From: Andrea Bianco Date: Sat, 29 Jan 2022 18:58:42 +0000 (+0100) Subject: Built motion from commit e7fe2cf1.|2.5.50 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=1540a773b3b952adc9a869e35f249f1edec9ec38;p=motion2.git Built motion from commit e7fe2cf1.|2.5.50 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b8135f8..b2f002d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-29T15:12:15.124Z", + "time": "2022-01-29T18:31:51.546Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4d810f8..4f5d478 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-29T15:12:15.124Z", + "time": "2022-01-29T18:31:51.546Z", "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 a675af3..a8f9fe7 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 _0x47aa=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x138830,_0x2b4c51){var _0x3d652c=function(_0x23f56e){while(--_0x23f56e){_0x138830['push'](_0x138830['shift']());}};_0x3d652c(++_0x2b4c51);}(_0x47aa,0x9e));var _0xa47a=function(_0xbb9911,_0x29d55b){_0xbb9911=_0xbb9911-0x0;var _0xb718c6=_0x47aa[_0xbb9911];return _0xb718c6;};'use strict';var Sequelize=require(_0xa47a('0x0'));module[_0xa47a('0x1')]={'name':{'type':Sequelize[_0xa47a('0x2')],'get':function(_0x57fcae){return this[_0xa47a('0x3')]('action');}},'action':{'type':Sequelize[_0xa47a('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa47a('0x5'),_0xa47a('0x6'),_0xa47a('0x7'),_0xa47a('0x8'),_0xa47a('0x9'),_0xa47a('0xa'),'bot',_0xa47a('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xa47a('0xc')},'data1':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comment':_0xa47a('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xa47a('0xe')},'data3':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comment':_0xa47a('0xf')},'data4':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comments':_0xa47a('0x10')},'data5':{'type':Sequelize[_0xa47a('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xa47a('0x11')},'data7':{'type':Sequelize[_0xa47a('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xc43b=['integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x4ae139,_0x56de76){var _0x45ada8=function(_0x3ca8f8){while(--_0x3ca8f8){_0x4ae139['push'](_0x4ae139['shift']());}};_0x45ada8(++_0x56de76);}(_0xc43b,0x134));var _0xbc43=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xc43b[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xbc43('0x0'));module[_0xbc43('0x1')]={'name':{'type':Sequelize[_0xbc43('0x2')],'get':function(_0x4b9bfc){return this[_0xbc43('0x3')](_0xbc43('0x4'));}},'action':{'type':Sequelize[_0xbc43('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbc43('0x6'),_0xbc43('0x7'),'motionbar',_0xbc43('0x8'),_0xbc43('0x9'),_0xbc43('0xa'),_0xbc43('0xb'),_0xbc43('0xc')]],'msg':_0xbc43('0xd')}},'comment':_0xbc43('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xbc43('0xe')},'data2':{'type':Sequelize[_0xbc43('0x5')](0x1000),'comment':_0xbc43('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xbc43('0x10')},'data4':{'type':Sequelize[_0xbc43('0x5')](0x1000),'comments':_0xbc43('0x11')},'data5':{'type':Sequelize[_0xbc43('0x5')](0x1000),'comments':_0xbc43('0x12')},'data6':{'type':Sequelize['STRING'],'comments':_0xbc43('0x13')},'data7':{'type':Sequelize[_0xbc43('0x14')],'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 4aa3f05..25a0e49 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 _0xe8f1=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x30ae7f,_0x2f8e07){var _0x3122cd=function(_0xb7c91b){while(--_0xb7c91b){_0x30ae7f['push'](_0x30ae7f['shift']());}};_0x3122cd(++_0x2f8e07);}(_0xe8f1,0x18c));var _0x1e8f=function(_0x41763a,_0xe1a239){_0x41763a=_0x41763a-0x0;var _0x7b9f9b=_0xe8f1[_0x41763a];return _0x7b9f9b;};'use strict';var emlformat=require(_0x1e8f('0x0'));var rimraf=require(_0x1e8f('0x1'));var zipdir=require(_0x1e8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e8f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1e8f('0x4'));var util=require(_0x1e8f('0x5'));var path=require(_0x1e8f('0x6'));var sox=require(_0x1e8f('0x7'));var csv=require(_0x1e8f('0x8'));var ejs=require(_0x1e8f('0x9'));var fs=require('fs');var fs_extra=require(_0x1e8f('0xa'));var _=require('lodash');var squel=require(_0x1e8f('0xb'));var crypto=require('crypto');var jsforce=require(_0x1e8f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1e8f('0x8'));var querystring=require(_0x1e8f('0xd'));var Papa=require('papaparse');var Redis=require(_0x1e8f('0xe'));var authService=require(_0x1e8f('0xf'));var qs=require(_0x1e8f('0x10'));var as=require(_0x1e8f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e8f('0x12'))(_0x1e8f('0x13'));var utils=require('../../config/utils');var config=require(_0x1e8f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e8f('0x15'))['db'];function respondWithStatusCode(_0x343ea5,_0x14ce2e){_0x14ce2e=_0x14ce2e||0xcc;return function(_0x123883){if(_0x123883){return _0x343ea5[_0x1e8f('0x16')](_0x14ce2e);}return _0x343ea5[_0x1e8f('0x17')](_0x14ce2e)[_0x1e8f('0x18')]();};}function respondWithResult(_0x4a3772,_0x3406b1){_0x3406b1=_0x3406b1||0xc8;return function(_0x173d01){if(_0x173d01){return _0x4a3772[_0x1e8f('0x17')](_0x3406b1)[_0x1e8f('0x19')](_0x173d01);}};}function respondWithFilteredResult(_0x53af9f,_0x521d1a){return function(_0x3c501e){if(_0x3c501e){var _0x385a97=typeof _0x521d1a[_0x1e8f('0x1a')]===_0x1e8f('0x1b')&&typeof _0x521d1a[_0x1e8f('0x1c')]===_0x1e8f('0x1b');var _0x5dc88b=_0x3c501e[_0x1e8f('0x1d')];var _0x383e9b=_0x385a97?0x0:_0x521d1a[_0x1e8f('0x1a')];var _0x3732a6=_0x385a97?_0x3c501e['count']:_0x521d1a[_0x1e8f('0x1a')]+_0x521d1a['limit'];var _0x3e7cff;if(_0x3732a6>=_0x5dc88b){_0x3732a6=_0x5dc88b;_0x3e7cff=0xc8;}else{_0x3e7cff=0xce;}_0x53af9f[_0x1e8f('0x17')](_0x3e7cff);return _0x53af9f['set'](_0x1e8f('0x1e'),_0x383e9b+'-'+_0x3732a6+'/'+_0x5dc88b)[_0x1e8f('0x19')](_0x3c501e);}return null;};}function patchUpdates(_0x70ff80){return function(_0x4434b5){try{jsonpatch[_0x1e8f('0x1f')](_0x4434b5,_0x70ff80,!![]);}catch(_0x3dcf7c){return BPromise[_0x1e8f('0x20')](_0x3dcf7c);}return _0x4434b5[_0x1e8f('0x21')]();};}function saveUpdates(_0x3c1e3c,_0xe8090e){return function(_0xfa1f8e){if(_0xfa1f8e){return _0xfa1f8e[_0x1e8f('0x22')](_0x3c1e3c)[_0x1e8f('0x23')](function(_0x4966d3){return _0x4966d3;});}return null;};}function removeEntity(_0x1736ed,_0x5629f6){return function(_0x22687f){if(_0x22687f){return _0x22687f[_0x1e8f('0x24')]()[_0x1e8f('0x23')](function(){_0x1736ed[_0x1e8f('0x17')](0xcc)[_0x1e8f('0x18')]();});}};}function handleEntityNotFound(_0x5e1a14,_0x4d4d28){return function(_0x541e8c){if(!_0x541e8c){_0x5e1a14[_0x1e8f('0x16')](0x194);}return _0x541e8c;};}function handleError(_0xffe53b,_0x51ba5a){_0x51ba5a=_0x51ba5a||0x1f4;return function(_0x2769ca){logger[_0x1e8f('0x25')](_0x2769ca[_0x1e8f('0x26')]);if(_0x2769ca[_0x1e8f('0x27')]){delete _0x2769ca[_0x1e8f('0x27')];}_0xffe53b[_0x1e8f('0x17')](_0x51ba5a)[_0x1e8f('0x28')](_0x2769ca);};}exports[_0x1e8f('0x22')]=function(_0x53fcac,_0x465b00){if(_0x53fcac[_0x1e8f('0x29')]['id']){delete _0x53fcac[_0x1e8f('0x29')]['id'];}return db[_0x1e8f('0x2a')][_0x1e8f('0x2b')]({'where':{'id':_0x53fcac[_0x1e8f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x465b00,null))['then'](saveUpdates(_0x53fcac[_0x1e8f('0x29')],null))[_0x1e8f('0x23')](respondWithResult(_0x465b00,null))[_0x1e8f('0x2d')](handleError(_0x465b00,null));};exports[_0x1e8f('0x24')]=function(_0x14e01f,_0x3fef72){return db[_0x1e8f('0x2a')][_0x1e8f('0x2b')]({'where':{'id':_0x14e01f[_0x1e8f('0x2c')]['id']}})[_0x1e8f('0x23')](handleEntityNotFound(_0x3fef72,null))[_0x1e8f('0x23')](removeEntity(_0x3fef72,null))[_0x1e8f('0x2d')](handleError(_0x3fef72,null));}; \ No newline at end of file +var _0x92f8=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','Action','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x3c662a,_0x2e64de){var _0x330b60=function(_0x1f00cc){while(--_0x1f00cc){_0x3c662a['push'](_0x3c662a['shift']());}};_0x330b60(++_0x2e64de);}(_0x92f8,0x17c));var _0x892f=function(_0x3f0bfc,_0x104792){_0x3f0bfc=_0x3f0bfc-0x0;var _0x52b0c3=_0x92f8[_0x3f0bfc];return _0x52b0c3;};'use strict';var emlformat=require(_0x892f('0x0'));var rimraf=require(_0x892f('0x1'));var zipdir=require(_0x892f('0x2'));var jsonpatch=require(_0x892f('0x3'));var rp=require(_0x892f('0x4'));var moment=require(_0x892f('0x5'));var BPromise=require(_0x892f('0x6'));var Mustache=require('mustache');var util=require(_0x892f('0x7'));var path=require(_0x892f('0x8'));var sox=require(_0x892f('0x9'));var csv=require(_0x892f('0xa'));var ejs=require(_0x892f('0xb'));var fs=require('fs');var fs_extra=require(_0x892f('0xc'));var _=require(_0x892f('0xd'));var squel=require('squel');var crypto=require(_0x892f('0xe'));var jsforce=require(_0x892f('0xf'));var deskjs=require(_0x892f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x892f('0x11'));var Papa=require('papaparse');var Redis=require(_0x892f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x892f('0x13'));var as=require(_0x892f('0x14'));var hardwareService=require(_0x892f('0x15'));var logger=require(_0x892f('0x16'))(_0x892f('0x17'));var utils=require(_0x892f('0x18'));var config=require(_0x892f('0x19'));var licenseUtil=require(_0x892f('0x1a'));var db=require(_0x892f('0x1b'))['db'];function respondWithStatusCode(_0x1eefc9,_0x513091){_0x513091=_0x513091||0xcc;return function(_0x5a3b36){if(_0x5a3b36){return _0x1eefc9[_0x892f('0x1c')](_0x513091);}return _0x1eefc9[_0x892f('0x1d')](_0x513091)[_0x892f('0x1e')]();};}function respondWithResult(_0x3f6e4f,_0x20a8da){_0x20a8da=_0x20a8da||0xc8;return function(_0x7f122a){if(_0x7f122a){return _0x3f6e4f[_0x892f('0x1d')](_0x20a8da)[_0x892f('0x1f')](_0x7f122a);}};}function respondWithFilteredResult(_0x3001f1,_0x22012a){return function(_0x4bb204){if(_0x4bb204){var _0x437361=typeof _0x22012a['offset']===_0x892f('0x20')&&typeof _0x22012a[_0x892f('0x21')]===_0x892f('0x20');var _0x46007d=_0x4bb204['count'];var _0x5bad1c=_0x437361?0x0:_0x22012a[_0x892f('0x22')];var _0x148157=_0x437361?_0x4bb204[_0x892f('0x23')]:_0x22012a[_0x892f('0x22')]+_0x22012a[_0x892f('0x21')];var _0x7a857c;if(_0x148157>=_0x46007d){_0x148157=_0x46007d;_0x7a857c=0xc8;}else{_0x7a857c=0xce;}_0x3001f1[_0x892f('0x1d')](_0x7a857c);return _0x3001f1[_0x892f('0x24')](_0x892f('0x25'),_0x5bad1c+'-'+_0x148157+'/'+_0x46007d)[_0x892f('0x1f')](_0x4bb204);}return null;};}function patchUpdates(_0x1c25d9){return function(_0x40320d){try{jsonpatch[_0x892f('0x26')](_0x40320d,_0x1c25d9,!![]);}catch(_0x34ec71){return BPromise['reject'](_0x34ec71);}return _0x40320d[_0x892f('0x27')]();};}function saveUpdates(_0x1b20d7,_0x31761b){return function(_0x523110){if(_0x523110){return _0x523110['update'](_0x1b20d7)[_0x892f('0x28')](function(_0x335b71){return _0x335b71;});}return null;};}function removeEntity(_0x459648,_0x6a2c85){return function(_0x409ca7){if(_0x409ca7){return _0x409ca7[_0x892f('0x29')]()[_0x892f('0x28')](function(){_0x459648['status'](0xcc)[_0x892f('0x1e')]();});}};}function handleEntityNotFound(_0x36338d,_0x64e2c3){return function(_0x4a833e){if(!_0x4a833e){_0x36338d[_0x892f('0x1c')](0x194);}return _0x4a833e;};}function handleError(_0xeb4700,_0x2f2a7b){_0x2f2a7b=_0x2f2a7b||0x1f4;return function(_0x453c1d){logger[_0x892f('0x2a')](_0x453c1d[_0x892f('0x2b')]);if(_0x453c1d[_0x892f('0x2c')]){delete _0x453c1d[_0x892f('0x2c')];}_0xeb4700[_0x892f('0x1d')](_0x2f2a7b)[_0x892f('0x2d')](_0x453c1d);};}exports['update']=function(_0x34e8a7,_0x20c8ef){if(_0x34e8a7['body']['id']){delete _0x34e8a7['body']['id'];}return db[_0x892f('0x2e')][_0x892f('0x2f')]({'where':{'id':_0x34e8a7['params']['id']}})[_0x892f('0x28')](handleEntityNotFound(_0x20c8ef,null))[_0x892f('0x28')](saveUpdates(_0x34e8a7[_0x892f('0x30')],null))[_0x892f('0x28')](respondWithResult(_0x20c8ef,null))[_0x892f('0x31')](handleError(_0x20c8ef,null));};exports[_0x892f('0x29')]=function(_0xdb1609,_0x23b4a6){return db[_0x892f('0x2e')][_0x892f('0x2f')]({'where':{'id':_0xdb1609['params']['id']}})[_0x892f('0x28')](handleEntityNotFound(_0x23b4a6,null))[_0x892f('0x28')](removeEntity(_0x23b4a6,null))[_0x892f('0x31')](handleError(_0x23b4a6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index f128ecc..dabdb12 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 _0xf9fd=['rimraf','../../config/environment','./action.attributes','exports','define','util','../../config/logger','api','moment','path'];(function(_0x4bbece,_0x44dd1a){var _0x3633ba=function(_0x16fd97){while(--_0x16fd97){_0x4bbece['push'](_0x4bbece['shift']());}};_0x3633ba(++_0x44dd1a);}(_0xf9fd,0x14f));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xdf9f('0x0'));var logger=require(_0xdf9f('0x1'))(_0xdf9f('0x2'));var moment=require(_0xdf9f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf9f('0x4'));var rimraf=require(_0xdf9f('0x5'));var config=require(_0xdf9f('0x6'));var attributes=require(_0xdf9f('0x7'));module[_0xdf9f('0x8')]=function(_0x549031,_0x4734df){return _0x549031[_0xdf9f('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x374d=['rimraf','./action.attributes','define','tools_actions','lodash','util','api','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x374d,0x144));var _0xd374=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x374d[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xd374('0x0'));var util=require(_0xd374('0x1'));var logger=require('../../config/logger')(_0xd374('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd374('0x3'));var rimraf=require(_0xd374('0x4'));var config=require('../../config/environment');var attributes=require(_0xd374('0x5'));module['exports']=function(_0x1d9a68,_0x31b2b0){return _0x1d9a68[_0xd374('0x6')]('Action',attributes,{'tableName':_0xd374('0x7'),'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 862c251..2aa81c4 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x53ec,0x192));var _0xc53e=function(_0x2fcd90,_0x4780cc){_0x2fcd90=_0x2fcd90-0x0;var _0x55b596=_0x53ec[_0x2fcd90];return _0x55b596;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x54a266,_0x4f3915){var _0x474b87=function(_0x4ed076){while(--_0x4ed076){_0x54a266['push'](_0x54a266['shift']());}};_0x474b87(++_0x4f3915);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e4d6af7..a49706e 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 _0xfcd1=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update'];(function(_0x374383,_0x4481c4){var _0x37f308=function(_0xf7927){while(--_0xf7927){_0x374383['push'](_0x374383['shift']());}};_0x37f308(++_0x4481c4);}(_0xfcd1,0x1e3));var _0x1fcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcd1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1fcd('0x0'));var util=require(_0x1fcd('0x1'));var path=require(_0x1fcd('0x2'));var timeout=require(_0x1fcd('0x3'));var express=require(_0x1fcd('0x4'));var router=express['Router']();var fs_extra=require(_0x1fcd('0x5'));var auth=require(_0x1fcd('0x6'));var interaction=require(_0x1fcd('0x7'));var config=require(_0x1fcd('0x8'));var controller=require(_0x1fcd('0x9'));router[_0x1fcd('0xa')]('/:id',auth[_0x1fcd('0xb')](),controller[_0x1fcd('0xc')]);router[_0x1fcd('0xd')]('/:id',auth[_0x1fcd('0xb')](),controller[_0x1fcd('0xe')]);module[_0x1fcd('0xf')]=router; \ No newline at end of file +var _0x841c=['Router','fs-extra','../../components/auth/service','./action.controller','put','isAuthenticated','update','delete','/:id','multer','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x841c,0x1ad));var _0xc841=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x841c[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0xc841('0x0'));var util=require('util');var path=require(_0xc841('0x1'));var timeout=require(_0xc841('0x2'));var express=require('express');var router=express[_0xc841('0x3')]();var fs_extra=require(_0xc841('0x4'));var auth=require(_0xc841('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc841('0x6'));router[_0xc841('0x7')]('/:id',auth[_0xc841('0x8')](),controller[_0xc841('0x9')]);router[_0xc841('0xa')](_0xc841('0xb'),auth['isAuthenticated'](),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 e8bdb8f..9d92e6b 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x2cf2f3,_0x5af528){var _0x436d75=function(_0x522924){while(--_0x522924){_0x2cf2f3['push'](_0x2cf2f3['shift']());}};_0x436d75(++_0x5af528);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x26fa1e,_0x3b1ed4){var _0x229228=function(_0x31f9a7){while(--_0x31f9a7){_0x26fa1e['push'](_0x26fa1e['shift']());}};_0x229228(++_0x3b1ed4);}(_0xabce,0x103));var _0xeabc=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xabce[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e5b08c4..df10480 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 _0xa2d0=['GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','params','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','parse','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','IS\x20EMPTY','operator','value','AnalyticMetric','clone','output','web','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','SELECT','COUNT(%s)','MAX(%s)','Sequelize','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','CustomReports','destroy','error','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xa2d0,0x194));var _0x0a2d=function(_0x5d0d0c,_0x4281bb){_0x5d0d0c=_0x5d0d0c-0x0;var _0x407e99=_0xa2d0[_0x5d0d0c];return _0x407e99;};'use strict';var emlformat=require(_0x0a2d('0x0'));var rimraf=require(_0x0a2d('0x1'));var zipdir=require(_0x0a2d('0x2'));var jsonpatch=require(_0x0a2d('0x3'));var rp=require(_0x0a2d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0a2d('0x5'));var util=require('util');var path=require(_0x0a2d('0x6'));var sox=require(_0x0a2d('0x7'));var csv=require(_0x0a2d('0x8'));var ejs=require(_0x0a2d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a2d('0xa'));var squel=require('squel');var crypto=require(_0x0a2d('0xb'));var jsforce=require(_0x0a2d('0xc'));var deskjs=require(_0x0a2d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a2d('0xe'));var authService=require(_0x0a2d('0xf'));var qs=require(_0x0a2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a2d('0x11'))(_0x0a2d('0x12'));var utils=require(_0x0a2d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0a2d('0x14'));var db=require(_0x0a2d('0x15'))['db'];var dbH=require(_0x0a2d('0x15'))[_0x0a2d('0x16')];function respondWithStatusCode(_0x5a79a1,_0x4a773a){_0x4a773a=_0x4a773a||0xcc;return function(_0x48f0c4){if(_0x48f0c4){return _0x5a79a1[_0x0a2d('0x17')](_0x4a773a);}return _0x5a79a1[_0x0a2d('0x18')](_0x4a773a)[_0x0a2d('0x19')]();};}function respondWithResult(_0xc7f441,_0x112c4f){_0x112c4f=_0x112c4f||0xc8;return function(_0x4cea6c){if(_0x4cea6c){return _0xc7f441[_0x0a2d('0x18')](_0x112c4f)[_0x0a2d('0x1a')](_0x4cea6c);}};}function respondWithFilteredResult(_0xdacd1f,_0x5e0c0d){return function(_0x281f13){if(_0x281f13){var _0xc9370=typeof _0x5e0c0d[_0x0a2d('0x1b')]==='undefined'&&typeof _0x5e0c0d[_0x0a2d('0x1c')]===_0x0a2d('0x1d');var _0x4bf489=_0x281f13['count'];var _0x9b5690=_0xc9370?0x0:_0x5e0c0d['offset'];var _0x3eeaab=_0xc9370?_0x281f13[_0x0a2d('0x1e')]:_0x5e0c0d[_0x0a2d('0x1b')]+_0x5e0c0d[_0x0a2d('0x1c')];var _0x27d7cc;if(_0x3eeaab>=_0x4bf489){_0x3eeaab=_0x4bf489;_0x27d7cc=0xc8;}else{_0x27d7cc=0xce;}_0xdacd1f[_0x0a2d('0x18')](_0x27d7cc);return _0xdacd1f[_0x0a2d('0x1f')](_0x0a2d('0x20'),_0x9b5690+'-'+_0x3eeaab+'/'+_0x4bf489)[_0x0a2d('0x1a')](_0x281f13);}return null;};}function patchUpdates(_0x390dbb){return function(_0x23a097){try{jsonpatch[_0x0a2d('0x21')](_0x23a097,_0x390dbb,!![]);}catch(_0x235e25){return BPromise[_0x0a2d('0x22')](_0x235e25);}return _0x23a097[_0x0a2d('0x23')]();};}function saveUpdates(_0x2334e2,_0x5e0bac){return function(_0x5cefed){if(_0x5cefed){return _0x5cefed['update'](_0x2334e2)['then'](function(_0x3e4b63){return _0x3e4b63;});}return null;};}function removeEntity(_0x161a0b,_0x20e78d){return function(_0x37bd23){if(_0x37bd23){return _0x37bd23['destroy']()[_0x0a2d('0x24')](function(){var _0xd5438a=_0x37bd23[_0x0a2d('0x25')]({'plain':!![]});var _0x125fc3=_0x0a2d('0x26');return db['UserProfileResource'][_0x0a2d('0x27')]({'where':{'type':_0x125fc3,'resourceId':_0xd5438a['id']}})['then'](function(){return _0x37bd23;});})['then'](function(){_0x161a0b[_0x0a2d('0x18')](0xcc)[_0x0a2d('0x19')]();});}};}function handleEntityNotFound(_0x221386,_0x16fa37){return function(_0x3c74a9){if(!_0x3c74a9){_0x221386[_0x0a2d('0x17')](0x194);}return _0x3c74a9;};}function handleError(_0x2db498,_0x5dfe1d){_0x5dfe1d=_0x5dfe1d||0x1f4;return function(_0x2e6cc7){logger[_0x0a2d('0x28')](_0x2e6cc7['stack']);if(_0x2e6cc7[_0x0a2d('0x29')]){delete _0x2e6cc7['name'];}_0x2db498[_0x0a2d('0x18')](_0x5dfe1d)[_0x0a2d('0x2a')](_0x2e6cc7);};}exports[_0x0a2d('0x2b')]=function(_0x1b3a12,_0x34ed91){var _0x31ac59={},_0xf31888={},_0x1bfaab={'count':0x0,'rows':[]};var _0x2b2818=_['map'](db[_0x0a2d('0x2c')][_0x0a2d('0x2d')],function(_0xe319aa){return{'name':_0xe319aa[_0x0a2d('0x2e')],'type':_0xe319aa[_0x0a2d('0x2f')][_0x0a2d('0x30')]};});_0xf31888[_0x0a2d('0x31')]=_[_0x0a2d('0x32')](_0x2b2818,'name');_0xf31888[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x1b3a12[_0x0a2d('0x33')]);_0xf31888[_0x0a2d('0x35')]=_['intersection'](_0xf31888[_0x0a2d('0x31')],_0xf31888['query']);_0x31ac59[_0x0a2d('0x36')]=_[_0x0a2d('0x37')](_0xf31888[_0x0a2d('0x31')],qs[_0x0a2d('0x38')](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x38')]));_0x31ac59[_0x0a2d('0x36')]=_0x31ac59[_0x0a2d('0x36')][_0x0a2d('0x39')]?_0x31ac59[_0x0a2d('0x36')]:_0xf31888[_0x0a2d('0x31')];if(!_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x3a')](_0x0a2d('0x3b'))){_0x31ac59[_0x0a2d('0x1c')]=qs['limit'](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x1c')]);_0x31ac59[_0x0a2d('0x1b')]=qs[_0x0a2d('0x1b')](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x1b')]);}_0x31ac59[_0x0a2d('0x3c')]=qs['sort'](_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x3d')]);_0x31ac59[_0x0a2d('0x3e')]=qs[_0x0a2d('0x35')](_[_0x0a2d('0x3f')](_0x1b3a12['query'],_0xf31888[_0x0a2d('0x35')]),_0x2b2818);if(_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x40')]){_0x31ac59[_0x0a2d('0x3e')]=_['merge'](_0x31ac59[_0x0a2d('0x3e')],{'$or':_[_0x0a2d('0x32')](_0x2b2818,function(_0x56211e){if(_0x56211e[_0x0a2d('0x2f')]!=='VIRTUAL'){var _0x40a2c7={};_0x40a2c7[_0x56211e[_0x0a2d('0x29')]]={'$like':'%'+_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x40')]+'%'};return _0x40a2c7;}})});}_0x31ac59=_[_0x0a2d('0x41')]({},_0x31ac59,_0x1b3a12[_0x0a2d('0x42')]);var _0x2e58be={'where':_0x31ac59['where']};return db[_0x0a2d('0x2c')][_0x0a2d('0x1e')](_0x2e58be)[_0x0a2d('0x24')](function(_0x1b323d){_0x1bfaab['count']=_0x1b323d;if(_0x1b3a12[_0x0a2d('0x33')][_0x0a2d('0x43')]){_0x31ac59[_0x0a2d('0x44')]=[{'all':!![]}];}return db[_0x0a2d('0x2c')][_0x0a2d('0x45')](_0x31ac59);})[_0x0a2d('0x24')](function(_0x385d57){_0x1bfaab[_0x0a2d('0x46')]=_0x385d57;return _0x1bfaab;})[_0x0a2d('0x24')](respondWithFilteredResult(_0x34ed91,_0x31ac59))[_0x0a2d('0x47')](handleError(_0x34ed91,null));};exports[_0x0a2d('0x48')]=function(_0x3f22d2,_0x3386d3){var _0x2ca3f5={'raw':![],'where':{'id':_0x3f22d2['params']['id']}},_0x11e70b={};_0x11e70b[_0x0a2d('0x31')]=_[_0x0a2d('0x34')](db[_0x0a2d('0x2c')][_0x0a2d('0x2d')]);_0x11e70b[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x3f22d2[_0x0a2d('0x33')]);_0x11e70b[_0x0a2d('0x35')]=_[_0x0a2d('0x37')](_0x11e70b['model'],_0x11e70b['query']);_0x2ca3f5[_0x0a2d('0x36')]=_[_0x0a2d('0x37')](_0x11e70b['model'],qs[_0x0a2d('0x38')](_0x3f22d2[_0x0a2d('0x33')][_0x0a2d('0x38')]));_0x2ca3f5['attributes']=_0x2ca3f5[_0x0a2d('0x36')][_0x0a2d('0x39')]?_0x2ca3f5[_0x0a2d('0x36')]:_0x11e70b['model'];if(_0x3f22d2[_0x0a2d('0x33')][_0x0a2d('0x43')]){_0x2ca3f5[_0x0a2d('0x44')]=[{'all':!![]}];}_0x2ca3f5=_[_0x0a2d('0x41')]({},_0x2ca3f5,_0x3f22d2['options']);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0x2ca3f5)['then'](handleEntityNotFound(_0x3386d3,null))[_0x0a2d('0x24')](respondWithResult(_0x3386d3,null))['catch'](handleError(_0x3386d3,null));};exports[_0x0a2d('0x4a')]=function(_0x20662d,_0x187b5b){return db[_0x0a2d('0x2c')][_0x0a2d('0x4a')](_0x20662d['body'],{})[_0x0a2d('0x24')](function(_0x403105){var _0x40d09f=_0x20662d['user'][_0x0a2d('0x25')]({'plain':!![]});if(!_0x40d09f)throw new Error(_0x0a2d('0x4b'));if(_0x40d09f[_0x0a2d('0x4c')]===_0x0a2d('0x4d')){var _0x1ddecf=_0x403105[_0x0a2d('0x25')]({'plain':!![]});var _0x34829e=_0x0a2d('0x4e');return db[_0x0a2d('0x4f')][_0x0a2d('0x49')]({'where':{'name':_0x34829e,'userProfileId':_0x40d09f[_0x0a2d('0x50')]},'raw':!![]})[_0x0a2d('0x24')](function(_0x40b0d8){if(_0x40b0d8&&_0x40b0d8[_0x0a2d('0x51')]===0x0){return db['UserProfileResource'][_0x0a2d('0x4a')]({'name':_0x1ddecf[_0x0a2d('0x29')],'resourceId':_0x1ddecf['id'],'type':_0x0a2d('0x26'),'sectionId':_0x40b0d8['id']},{})['then'](function(){return _0x403105;});}else{return _0x403105;}})[_0x0a2d('0x47')](function(_0x5558d0){logger[_0x0a2d('0x28')](_0x0a2d('0x52'),_0x5558d0);throw _0x5558d0;});}return _0x403105;})[_0x0a2d('0x24')](respondWithResult(_0x187b5b,0xc9))[_0x0a2d('0x47')](handleError(_0x187b5b,null));};exports[_0x0a2d('0x53')]=function(_0x5d7620,_0x28cf11){if(_0x5d7620[_0x0a2d('0x54')]['id']){delete _0x5d7620[_0x0a2d('0x54')]['id'];}return db[_0x0a2d('0x2c')][_0x0a2d('0x49')]({'where':{'id':_0x5d7620['params']['id']}})[_0x0a2d('0x24')](handleEntityNotFound(_0x28cf11,null))['then'](saveUpdates(_0x5d7620[_0x0a2d('0x54')],null))['then'](respondWithResult(_0x28cf11,null))['catch'](handleError(_0x28cf11,null));};exports[_0x0a2d('0x27')]=function(_0x453343,_0x123d00){return db['AnalyticCustomReport'][_0x0a2d('0x49')]({'where':{'id':_0x453343['params']['id']}})['then'](handleEntityNotFound(_0x123d00,null))['then'](removeEntity(_0x123d00,null))['catch'](handleError(_0x123d00,null));};exports['preview']=function(_0x34ae88,_0x4555af){var _0x26c67b=0xa;var _0x64e314=[_0x0a2d('0x55'),'left_join','right_join',_0x0a2d('0x56')];var _0x20f817={'SUM':_0x0a2d('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0a2d('0x58'),'MAX':'MAX(%s)','MIN':_0x0a2d('0x59'),'AVG':_0x0a2d('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0a2d('0x5b')};var _0x49fded={'SEC_TO_TIME':_0x0a2d('0x5c'),'DATE':'DATE(%s)','HOUR':_0x0a2d('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0a2d('0x5e')};var _0x482bc4=function(_0x2fdfaf){return!_[_0x0a2d('0x5f')]([_0x0a2d('0x60'),_0x0a2d('0x61'),'IS\x20EMPTY',_0x0a2d('0x62')],_0x2fdfaf);};var _0x33f996=function(_0x15e439){if(!_0x15e439||!_0x15e439[_0x0a2d('0x63')][_0x0a2d('0x39')]){return'';}for(var _0x28acd0='(',_0x434a51=0x0;_0x434a51<_0x15e439[_0x0a2d('0x63')][_0x0a2d('0x39')];_0x434a51+=0x1){_0x434a51>0x0&&(_0x28acd0+='\x20'+_0x15e439['operator']+'\x20');_0x28acd0+=_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x64')]?_0x33f996(_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x64')]):_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x65')]+'\x20'+_0x15e439['rules'][_0x434a51][_0x0a2d('0x66')]+(_0x482bc4(_0x15e439[_0x0a2d('0x63')][_0x434a51][_0x0a2d('0x66')])?'\x20'+_0x15e439[_0x0a2d('0x63')][_0x434a51]['value']:'');}return _0x28acd0+')';};var _0x490dc9={'where':{'id':_0x34ae88[_0x0a2d('0x67')]['id']}},_0x4613f1,_0x255f9e,_0x5b2b44,_0x10ec20,_0x43780e;_0x490dc9=_[_0x0a2d('0x41')]({},_0x490dc9,_0x34ae88[_0x0a2d('0x42')]);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0x490dc9)[_0x0a2d('0x24')](function(_0x6843ec){if(_0x6843ec){_0x4613f1=_0x6843ec;return _0x6843ec[_0x0a2d('0x68')]();}return null;})[_0x0a2d('0x24')](function(_0x206043){if(_0x206043){if(!_0x206043[_0x0a2d('0x39')]){throw new db['Sequelize'][(_0x0a2d('0x69'))](_0x0a2d('0x6a'),0x193);}_0x255f9e=_0x206043;return db['AnalyticMetric'][_0x0a2d('0x45')]({'raw':!![]});}return null;})['then'](function(_0x504d7a){if(_0x504d7a){_0x5b2b44=_[_0x0a2d('0x6b')](_0x504d7a,'id');var _0x5e6322;var _0x3e906d=squel[_0x0a2d('0x6c')]();_0x3e906d['from'](_0x4613f1[_0x0a2d('0x6d')]);for(var _0x2caefa=0x0;_0x2caefa<_0x255f9e[_0x0a2d('0x39')];_0x2caefa+=0x1){_0x5e6322=_0x255f9e[_0x2caefa]['MetricId']?_0x5b2b44[_0x255f9e[_0x2caefa][_0x0a2d('0x6e')]][_0x0a2d('0x6f')]:_0x255f9e[_0x2caefa]['field'];_0x5e6322=_0x255f9e[_0x2caefa][_0x0a2d('0x70')]?_[_0x0a2d('0x71')](_0x20f817[_0x255f9e[_0x2caefa][_0x0a2d('0x70')]],'%s',_0x5e6322):_0x5e6322;_0x5e6322=_0x255f9e[_0x2caefa]['format']?_[_0x0a2d('0x71')](_0x49fded[_0x255f9e[_0x2caefa][_0x0a2d('0x72')]],'%s',_0x5e6322):_0x5e6322;if(_0x255f9e[_0x2caefa][_0x0a2d('0x73')]){_0x3e906d[_0x0a2d('0x64')](_0x5e6322);}_0x255f9e[_0x2caefa][_0x0a2d('0x74')]&&_0x3e906d[_0x0a2d('0x3c')](_0x5e6322,_0x255f9e[_0x2caefa][_0x0a2d('0x74')]===_0x0a2d('0x75')?![]:!![]);_0x3e906d[_0x0a2d('0x65')](_0x5e6322,_0x255f9e[_0x2caefa][_0x0a2d('0x76')]||_0x5e6322);}if(_0x4613f1['joins']){_0x4613f1['joins']=JSON[_0x0a2d('0x77')](_0x4613f1['joins']);for(var _0x5f3f73=0x0;_0x5f3f73<_0x4613f1[_0x0a2d('0x78')][_0x0a2d('0x39')];_0x5f3f73+=0x1){if(_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x2f')]&&_[_0x0a2d('0x5f')](_0x64e314,_0x4613f1['joins'][_0x5f3f73][_0x0a2d('0x2f')])&&_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x79')]&&_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x7a')]&&_0x4613f1[_0x0a2d('0x78')][_0x5f3f73]['foreignKey']){_0x3e906d[_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x2f')]](_0x4613f1['joins'][_0x5f3f73]['foreignTable'],null,util[_0x0a2d('0x72')](_0x0a2d('0x7b'),_0x4613f1[_0x0a2d('0x6d')],_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x79')],_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x7a')],_0x4613f1[_0x0a2d('0x78')][_0x5f3f73][_0x0a2d('0x7c')]));}}}if(_0x4613f1[_0x0a2d('0x7d')]){_0x4613f1[_0x0a2d('0x7d')]=JSON['parse'](_0x4613f1[_0x0a2d('0x7d')]);_0x3e906d['where'](_0x33f996(_0x4613f1[_0x0a2d('0x7d')][_0x0a2d('0x64')]));}_0x43780e=_0x3e906d['clone']();_0x3e906d[_0x0a2d('0x1c')](_0x26c67b);_0x3e906d[_0x0a2d('0x1b')](0x0);logger['debug'](_0x0a2d('0x7e'),_0x3e906d[_0x0a2d('0x7f')]());return dbH[_0x0a2d('0x80')][_0x0a2d('0x33')](_0x3e906d[_0x0a2d('0x7f')](),{'type':dbH['sequelize'][_0x0a2d('0x81')]['SELECT']});}})[_0x0a2d('0x24')](respondWithResult(_0x4555af,null))[_0x0a2d('0x47')](handleError(_0x4555af,null));};function runReport(_0x42d918,_0x5d0379,_0x3ebcd4){var _0x747885=_0x5d0379['name'];var _0x25614f=0xa;var _0x511e71=[_0x0a2d('0x55'),_0x0a2d('0x82'),_0x0a2d('0x83'),_0x0a2d('0x56')];var _0x3981a2={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0a2d('0x58'),'MAX':'MAX(%s)','MIN':_0x0a2d('0x59'),'AVG':_0x0a2d('0x5a'),'GROUP_CONCAT':_0x0a2d('0x84'),'GROUP_CONCAT ASC':_0x0a2d('0x85'),'GROUP_CONCAT DESC':_0x0a2d('0x5b')};var _0xabe737={'SEC_TO_TIME':_0x0a2d('0x5c'),'DATE':_0x0a2d('0x86'),'HOUR':'HOUR(%s)','ROUND':_0x0a2d('0x87'),'UNIX_TIMESTAMP':_0x0a2d('0x5e')};var _0x208012=function(_0x4b78ea){return!_[_0x0a2d('0x5f')]([_0x0a2d('0x60'),_0x0a2d('0x61'),_0x0a2d('0x88'),_0x0a2d('0x62')],_0x4b78ea);};var _0x131ef8=function(_0x4cef2b){if(!_0x4cef2b||!_0x4cef2b['rules'][_0x0a2d('0x39')]){return'';}for(var _0x1a9d6a='(',_0x518404=0x0;_0x518404<_0x4cef2b['rules'][_0x0a2d('0x39')];_0x518404+=0x1){_0x518404>0x0&&(_0x1a9d6a+='\x20'+_0x4cef2b[_0x0a2d('0x89')]+'\x20');_0x1a9d6a+=_0x4cef2b['rules'][_0x518404]['group']?_0x131ef8(_0x4cef2b[_0x0a2d('0x63')][_0x518404]['group']):_0x4cef2b[_0x0a2d('0x63')][_0x518404][_0x0a2d('0x65')]+'\x20'+_0x4cef2b['rules'][_0x518404]['condition']+(_0x208012(_0x4cef2b[_0x0a2d('0x63')][_0x518404][_0x0a2d('0x66')])?'\x20'+_0x4cef2b[_0x0a2d('0x63')][_0x518404][_0x0a2d('0x8a')]:'');}return _0x1a9d6a+')';};var _0x4888d1={'where':{'id':_0x42d918['id']}},_0x3eb434,_0xa93bdf,_0x20be06,_0x47868b,_0x4f82d1;_0x4888d1=_[_0x0a2d('0x41')]({},_0x4888d1,_0x3ebcd4);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0x4888d1)[_0x0a2d('0x24')](function(_0x232596){if(_0x232596){_0x3eb434=_0x232596;return _0x232596[_0x0a2d('0x68')]();}return null;})[_0x0a2d('0x24')](function(_0xa70695){if(_0xa70695){if(!_0xa70695[_0x0a2d('0x39')]){throw new db['Sequelize'][(_0x0a2d('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa93bdf=_0xa70695;return db[_0x0a2d('0x8b')][_0x0a2d('0x45')]({'raw':!![]});}return null;})[_0x0a2d('0x24')](function(_0x2fcb06){if(_0x2fcb06){_0x20be06=_['keyBy'](_0x2fcb06,'id');var _0x5dcb0b;var _0x3cadd3=squel[_0x0a2d('0x6c')]();_0x3cadd3['from'](_0x3eb434[_0x0a2d('0x6d')]);for(var _0x5ce3bc=0x0;_0x5ce3bc<_0xa93bdf[_0x0a2d('0x39')];_0x5ce3bc+=0x1){_0x5dcb0b=_0xa93bdf[_0x5ce3bc][_0x0a2d('0x6e')]?_0x20be06[_0xa93bdf[_0x5ce3bc][_0x0a2d('0x6e')]][_0x0a2d('0x6f')]:_0xa93bdf[_0x5ce3bc][_0x0a2d('0x65')];_0x5dcb0b=_0xa93bdf[_0x5ce3bc][_0x0a2d('0x70')]?_['replace'](_0x3981a2[_0xa93bdf[_0x5ce3bc][_0x0a2d('0x70')]],'%s',_0x5dcb0b):_0x5dcb0b;_0x5dcb0b=_0xa93bdf[_0x5ce3bc][_0x0a2d('0x72')]?_[_0x0a2d('0x71')](_0xabe737[_0xa93bdf[_0x5ce3bc]['format']],'%s',_0x5dcb0b):_0x5dcb0b;if(_0xa93bdf[_0x5ce3bc][_0x0a2d('0x73')]){_0x3cadd3[_0x0a2d('0x64')](_0x5dcb0b);}_0xa93bdf[_0x5ce3bc][_0x0a2d('0x74')]&&_0x3cadd3[_0x0a2d('0x3c')](_0x5dcb0b,_0xa93bdf[_0x5ce3bc][_0x0a2d('0x74')]===_0x0a2d('0x75')?![]:!![]);_0x3cadd3[_0x0a2d('0x65')](_0x5dcb0b,_0xa93bdf[_0x5ce3bc]['alias']||_0x5dcb0b);}if(_0x3eb434[_0x0a2d('0x78')]){_0x3eb434[_0x0a2d('0x78')]=JSON[_0x0a2d('0x77')](_0x3eb434[_0x0a2d('0x78')]);for(var _0x2509d9=0x0;_0x2509d9<_0x3eb434[_0x0a2d('0x78')]['length'];_0x2509d9+=0x1){if(_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['type']&&_['includes'](_0x511e71,_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x2f')])&&_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x79')]&&_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['foreignTable']&&_0x3eb434['joins'][_0x2509d9][_0x0a2d('0x7c')]){_0x3cadd3[_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['type']](_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x7a')],null,util[_0x0a2d('0x72')](_0x0a2d('0x7b'),_0x3eb434[_0x0a2d('0x6d')],_0x3eb434[_0x0a2d('0x78')][_0x2509d9]['parentKey'],_0x3eb434[_0x0a2d('0x78')][_0x2509d9][_0x0a2d('0x7a')],_0x3eb434['joins'][_0x2509d9]['foreignKey']));}}}if(_0x3eb434['conditions']){_0x3eb434['conditions']=JSON['parse'](_0x3eb434[_0x0a2d('0x7d')]);_0x3cadd3[_0x0a2d('0x3e')](_0x131ef8(_0x3eb434['conditions'][_0x0a2d('0x64')]));}_0x4f82d1=_0x3cadd3[_0x0a2d('0x8c')]();_0x3cadd3['limit'](_0x25614f);_0x3cadd3['offset'](0x0);return;}})['then'](function(){if(_0x5d0379[_0x0a2d('0x8d')]===_0x0a2d('0x8e')){return null;}var _0x1f5ffb=_[_0x0a2d('0x41')](_0x5d0379,{'name':_0x5d0379['fullPath']||_0x5d0379[_0x0a2d('0x29')]||_0x3eb434[_0x0a2d('0x29')],'basename':_0x747885,'savename':util[_0x0a2d('0x72')](_0x0a2d('0x8f'),_0x5d0379[_0x0a2d('0x29')]||_0x3eb434[_0x0a2d('0x29')],require(_0x0a2d('0x90'))['generate'](0x4),_0x5d0379['output']||_0x0a2d('0x91')),'reportId':_0x3eb434['id'],'reportType':_0x0a2d('0x92')});return db[_0x0a2d('0x93')][_0x0a2d('0x4a')](_0x1f5ffb,{'raw':!![]});})[_0x0a2d('0x24')](function(_0x29fa81){if(_0x3eb434['table']==='cdr'){_0x4f82d1[_0x0a2d('0x3e')](_0x3eb434[_0x0a2d('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5d0379['startDate'],_0x5d0379['endDate']);}else{_0x4f82d1['where'](_0x3eb434[_0x0a2d('0x6d')]+_0x0a2d('0x94'),_0x5d0379[_0x0a2d('0x95')],_0x5d0379[_0x0a2d('0x96')]);}if(_0x29fa81){logger[_0x0a2d('0x97')]('Run\x20Query:',_0x4f82d1['toString']());require(_0x0a2d('0x98'))[_0x0a2d('0x99')](path[_0x0a2d('0x55')](__dirname,_0x0a2d('0x9a'),_0x29fa81[_0x0a2d('0x8d')]),[_0x29fa81['id'],_0x4f82d1['toString'](),path[_0x0a2d('0x55')](__dirname,_0x0a2d('0x9b'),_0x29fa81[_0x0a2d('0x9c')]),_0x747885]);return _0x29fa81;}else{var _0x44c01d=squel[_0x0a2d('0x6c')]();_0x44c01d[_0x0a2d('0x9d')]('('+_0x4f82d1[_0x0a2d('0x7f')]()+')',_0x0a2d('0x9e'));_0x44c01d[_0x0a2d('0x65')](_0x0a2d('0x9f'),_0x0a2d('0x1e'));_0x4f82d1[_0x0a2d('0x1c')](_0x5d0379['limit']||_0x25614f);_0x4f82d1['offset'](_0x5d0379[_0x0a2d('0x1b')]||0x0);return dbH[_0x0a2d('0x80')]['query'](_0x44c01d[_0x0a2d('0x7f')](),{'type':dbH[_0x0a2d('0x80')][_0x0a2d('0x81')][_0x0a2d('0xa0')]})['then'](function(_0x5e323a){if(!_0x5e323a[_0x0a2d('0x39')]){_0x47868b=0x0;}else{_0x47868b=_0x5e323a[0x0]['count']||0x0;}return dbH[_0x0a2d('0x80')][_0x0a2d('0x33')](_0x4f82d1[_0x0a2d('0x7f')](),{'type':dbH[_0x0a2d('0x80')][_0x0a2d('0x81')][_0x0a2d('0xa0')]});})[_0x0a2d('0x24')](function(_0x207ec9){return{'rows':_0x207ec9||[],'count':_0x47868b};});}});}exports['run']=function(_0xbbce4,_0x5010f7){return runReport(_0xbbce4[_0x0a2d('0x67')],_0xbbce4['query'],_0xbbce4[_0x0a2d('0x42')])['then'](respondWithResult(_0x5010f7,null))['catch'](handleError(_0x5010f7,null));};exports['runReport']=runReport;exports['query']=function(_0x1bb148,_0x5cf798){var _0x24185c=0xa;var _0x268292=['join',_0x0a2d('0x82'),_0x0a2d('0x83'),_0x0a2d('0x56')];var _0x48c600={'SUM':'SUM(%s)','COUNT':_0x0a2d('0xa1'),'COUNT DISTINCT':_0x0a2d('0x58'),'MAX':_0x0a2d('0xa2'),'MIN':_0x0a2d('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0a2d('0x84'),'GROUP_CONCAT ASC':_0x0a2d('0x85'),'GROUP_CONCAT DESC':_0x0a2d('0x5b')};var _0x3cd55e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0a2d('0x86'),'HOUR':_0x0a2d('0x5d'),'ROUND':_0x0a2d('0x87'),'UNIX_TIMESTAMP':_0x0a2d('0x5e')};var _0x3deeac=function(_0x1e4022){return!_[_0x0a2d('0x5f')]([_0x0a2d('0x60'),_0x0a2d('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1e4022);};var _0x4f3ab3=function(_0x35607c){if(!_0x35607c||!_0x35607c[_0x0a2d('0x63')][_0x0a2d('0x39')]){return'';}for(var _0x5a2e41='(',_0x574445=0x0;_0x574445<_0x35607c[_0x0a2d('0x63')][_0x0a2d('0x39')];_0x574445+=0x1){_0x574445>0x0&&(_0x5a2e41+='\x20'+_0x35607c['operator']+'\x20');_0x5a2e41+=_0x35607c['rules'][_0x574445][_0x0a2d('0x64')]?_0x4f3ab3(_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x64')]):_0x35607c[_0x0a2d('0x63')][_0x574445]['field']+'\x20'+_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x66')]+(_0x3deeac(_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x66')])?'\x20'+_0x35607c[_0x0a2d('0x63')][_0x574445][_0x0a2d('0x8a')]:'');}return _0x5a2e41+')';};var _0xb02fb7={'where':{'id':_0x1bb148[_0x0a2d('0x67')]['id']}},_0xde2f10,_0x436b7b,_0x2abbc0,_0x14ae4c,_0x47e420;_0xb02fb7=_[_0x0a2d('0x41')]({},_0xb02fb7,_0x1bb148['options']);return db[_0x0a2d('0x2c')][_0x0a2d('0x49')](_0xb02fb7)[_0x0a2d('0x24')](function(_0x233720){if(_0x233720){_0xde2f10=_0x233720;return _0x233720[_0x0a2d('0x68')]();}return null;})[_0x0a2d('0x24')](function(_0x4ea8e7){if(_0x4ea8e7){if(!_0x4ea8e7['length']){throw new db[(_0x0a2d('0xa3'))]['ValidationErrorItem'](_0x0a2d('0x6a'),0x193);}_0x436b7b=_0x4ea8e7;return db[_0x0a2d('0x8b')][_0x0a2d('0x45')]({'raw':!![]});}return null;})[_0x0a2d('0x24')](function(_0x12f1d3){if(_0x12f1d3){_0x2abbc0=_[_0x0a2d('0x6b')](_0x12f1d3,'id');var _0x2c2a52;var _0x451a19=squel[_0x0a2d('0x6c')]();_0x451a19[_0x0a2d('0x9d')](_0xde2f10[_0x0a2d('0x6d')]);for(var _0x1624a9=0x0;_0x1624a9<_0x436b7b[_0x0a2d('0x39')];_0x1624a9+=0x1){_0x2c2a52=_0x436b7b[_0x1624a9][_0x0a2d('0x6e')]?_0x2abbc0[_0x436b7b[_0x1624a9][_0x0a2d('0x6e')]][_0x0a2d('0x6f')]:_0x436b7b[_0x1624a9][_0x0a2d('0x65')];_0x2c2a52=_0x436b7b[_0x1624a9][_0x0a2d('0x70')]?_[_0x0a2d('0x71')](_0x48c600[_0x436b7b[_0x1624a9][_0x0a2d('0x70')]],'%s',_0x2c2a52):_0x2c2a52;_0x2c2a52=_0x436b7b[_0x1624a9]['format']?_[_0x0a2d('0x71')](_0x3cd55e[_0x436b7b[_0x1624a9][_0x0a2d('0x72')]],'%s',_0x2c2a52):_0x2c2a52;if(_0x436b7b[_0x1624a9][_0x0a2d('0x73')]){_0x451a19[_0x0a2d('0x64')](_0x2c2a52);}_0x436b7b[_0x1624a9]['orderBy']&&_0x451a19[_0x0a2d('0x3c')](_0x2c2a52,_0x436b7b[_0x1624a9]['orderBy']===_0x0a2d('0x75')?![]:!![]);_0x451a19[_0x0a2d('0x65')](_0x2c2a52,_0x436b7b[_0x1624a9][_0x0a2d('0x76')]||_0x2c2a52);}if(_0xde2f10[_0x0a2d('0x78')]){_0xde2f10[_0x0a2d('0x78')]=JSON['parse'](_0xde2f10['joins']);for(var _0x5de04f=0x0;_0x5de04f<_0xde2f10[_0x0a2d('0x78')][_0x0a2d('0x39')];_0x5de04f+=0x1){if(_0xde2f10['joins'][_0x5de04f][_0x0a2d('0x2f')]&&_[_0x0a2d('0x5f')](_0x268292,_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x2f')])&&_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x79')]&&_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['foreignTable']&&_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['foreignKey']){_0x451a19[_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['type']](_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x7a')],null,util[_0x0a2d('0x72')](_0x0a2d('0x7b'),_0xde2f10[_0x0a2d('0x6d')],_0xde2f10['joins'][_0x5de04f]['parentKey'],_0xde2f10[_0x0a2d('0x78')][_0x5de04f]['foreignTable'],_0xde2f10[_0x0a2d('0x78')][_0x5de04f][_0x0a2d('0x7c')]));}}}if(_0xde2f10[_0x0a2d('0x7d')]){_0xde2f10['conditions']=JSON[_0x0a2d('0x77')](_0xde2f10[_0x0a2d('0x7d')]);_0x451a19[_0x0a2d('0x3e')](_0x4f3ab3(_0xde2f10[_0x0a2d('0x7d')][_0x0a2d('0x64')]));}_0x47e420=_0x451a19[_0x0a2d('0x8c')]();_0x451a19[_0x0a2d('0x1c')](_0x24185c);_0x451a19[_0x0a2d('0x1b')](0x0);logger[_0x0a2d('0xa4')](_0x0a2d('0x7e'),_0x451a19[_0x0a2d('0x7f')]());return dbH[_0x0a2d('0x80')][_0x0a2d('0x33')](_0x451a19[_0x0a2d('0x7f')](),{'type':dbH[_0x0a2d('0x80')]['QueryTypes'][_0x0a2d('0xa0')]});}})[_0x0a2d('0x24')](function(){return{'sql':_0x47e420[_0x0a2d('0x7f')]()};})[_0x0a2d('0x24')](respondWithResult(_0x5cf798,null))[_0x0a2d('0x47')](handleError(_0x5cf798,null));}; \ No newline at end of file +var _0x43fd=['getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','ValidationErrorItem','groupBy','clone','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','operator','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','save','update','then','get','CustomReports','destroy','error','stack','send','index','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','findAll','rows','catch','rawAttributes','include','AnalyticCustomReport','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','left_join','right_join','cross_join','SUM(%s)','COUNT(%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)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value'];(function(_0x475aeb,_0x38d0fa){var _0x4e2330=function(_0x3470b0){while(--_0x3470b0){_0x475aeb['push'](_0x475aeb['shift']());}};_0x4e2330(++_0x38d0fa);}(_0x43fd,0x186));var _0xd43f=function(_0x4bd7e6,_0x57c5ba){_0x4bd7e6=_0x4bd7e6-0x0;var _0x51ad22=_0x43fd[_0x4bd7e6];return _0x51ad22;};'use strict';var emlformat=require(_0xd43f('0x0'));var rimraf=require(_0xd43f('0x1'));var zipdir=require(_0xd43f('0x2'));var jsonpatch=require(_0xd43f('0x3'));var rp=require(_0xd43f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd43f('0x5'));var util=require(_0xd43f('0x6'));var path=require(_0xd43f('0x7'));var sox=require(_0xd43f('0x8'));var csv=require(_0xd43f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd43f('0xa'));var crypto=require(_0xd43f('0xb'));var jsforce=require(_0xd43f('0xc'));var deskjs=require(_0xd43f('0xd'));var toCsv=require(_0xd43f('0x9'));var querystring=require('querystring');var Papa=require(_0xd43f('0xe'));var Redis=require(_0xd43f('0xf'));var authService=require(_0xd43f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd43f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd43f('0x12'));var licenseUtil=require(_0xd43f('0x13'));var db=require(_0xd43f('0x14'))['db'];var dbH=require(_0xd43f('0x14'))[_0xd43f('0x15')];function respondWithStatusCode(_0x241c1f,_0xb96903){_0xb96903=_0xb96903||0xcc;return function(_0x13e22f){if(_0x13e22f){return _0x241c1f[_0xd43f('0x16')](_0xb96903);}return _0x241c1f[_0xd43f('0x17')](_0xb96903)[_0xd43f('0x18')]();};}function respondWithResult(_0x3ab445,_0x1683a1){_0x1683a1=_0x1683a1||0xc8;return function(_0x5e9215){if(_0x5e9215){return _0x3ab445[_0xd43f('0x17')](_0x1683a1)[_0xd43f('0x19')](_0x5e9215);}};}function respondWithFilteredResult(_0x239e4e,_0x319a5f){return function(_0x434f98){if(_0x434f98){var _0x344792=typeof _0x319a5f['offset']===_0xd43f('0x1a')&&typeof _0x319a5f[_0xd43f('0x1b')]===_0xd43f('0x1a');var _0xdda6ff=_0x434f98['count'];var _0x595e5c=_0x344792?0x0:_0x319a5f[_0xd43f('0x1c')];var _0x22a607=_0x344792?_0x434f98[_0xd43f('0x1d')]:_0x319a5f[_0xd43f('0x1c')]+_0x319a5f[_0xd43f('0x1b')];var _0x3887ca;if(_0x22a607>=_0xdda6ff){_0x22a607=_0xdda6ff;_0x3887ca=0xc8;}else{_0x3887ca=0xce;}_0x239e4e[_0xd43f('0x17')](_0x3887ca);return _0x239e4e[_0xd43f('0x1e')]('Content-Range',_0x595e5c+'-'+_0x22a607+'/'+_0xdda6ff)[_0xd43f('0x19')](_0x434f98);}return null;};}function patchUpdates(_0xfb6e9e){return function(_0x1b5c44){try{jsonpatch[_0xd43f('0x1f')](_0x1b5c44,_0xfb6e9e,!![]);}catch(_0x3f579e){return BPromise['reject'](_0x3f579e);}return _0x1b5c44[_0xd43f('0x20')]();};}function saveUpdates(_0x498386,_0x43e95d){return function(_0x4d50cc){if(_0x4d50cc){return _0x4d50cc[_0xd43f('0x21')](_0x498386)[_0xd43f('0x22')](function(_0xe481af){return _0xe481af;});}return null;};}function removeEntity(_0x3052a2,_0x262f24){return function(_0x55a24e){if(_0x55a24e){return _0x55a24e['destroy']()[_0xd43f('0x22')](function(){var _0x378f52=_0x55a24e[_0xd43f('0x23')]({'plain':!![]});var _0x4469d2=_0xd43f('0x24');return db['UserProfileResource'][_0xd43f('0x25')]({'where':{'type':_0x4469d2,'resourceId':_0x378f52['id']}})['then'](function(){return _0x55a24e;});})[_0xd43f('0x22')](function(){_0x3052a2[_0xd43f('0x17')](0xcc)[_0xd43f('0x18')]();});}};}function handleEntityNotFound(_0x4e35bb,_0x4a536c){return function(_0xa7a0c){if(!_0xa7a0c){_0x4e35bb[_0xd43f('0x16')](0x194);}return _0xa7a0c;};}function handleError(_0x3d9963,_0x29a9be){_0x29a9be=_0x29a9be||0x1f4;return function(_0x11a022){logger[_0xd43f('0x26')](_0x11a022[_0xd43f('0x27')]);if(_0x11a022['name']){delete _0x11a022['name'];}_0x3d9963[_0xd43f('0x17')](_0x29a9be)[_0xd43f('0x28')](_0x11a022);};}exports[_0xd43f('0x29')]=function(_0x524f18,_0x33d072){var _0xc9f1ca={},_0x44b3cf={},_0x26ba1b={'count':0x0,'rows':[]};var _0x4b0578=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x471f6b){return{'name':_0x471f6b[_0xd43f('0x2a')],'type':_0x471f6b[_0xd43f('0x2b')][_0xd43f('0x2c')]};});_0x44b3cf[_0xd43f('0x2d')]=_[_0xd43f('0x2e')](_0x4b0578,_0xd43f('0x2f'));_0x44b3cf[_0xd43f('0x30')]=_[_0xd43f('0x31')](_0x524f18[_0xd43f('0x30')]);_0x44b3cf[_0xd43f('0x32')]=_[_0xd43f('0x33')](_0x44b3cf[_0xd43f('0x2d')],_0x44b3cf['query']);_0xc9f1ca[_0xd43f('0x34')]=_[_0xd43f('0x33')](_0x44b3cf[_0xd43f('0x2d')],qs[_0xd43f('0x35')](_0x524f18[_0xd43f('0x30')][_0xd43f('0x35')]));_0xc9f1ca[_0xd43f('0x34')]=_0xc9f1ca[_0xd43f('0x34')][_0xd43f('0x36')]?_0xc9f1ca[_0xd43f('0x34')]:_0x44b3cf[_0xd43f('0x2d')];if(!_0x524f18['query'][_0xd43f('0x37')](_0xd43f('0x38'))){_0xc9f1ca['limit']=qs[_0xd43f('0x1b')](_0x524f18[_0xd43f('0x30')][_0xd43f('0x1b')]);_0xc9f1ca[_0xd43f('0x1c')]=qs[_0xd43f('0x1c')](_0x524f18[_0xd43f('0x30')]['offset']);}_0xc9f1ca[_0xd43f('0x39')]=qs[_0xd43f('0x3a')](_0x524f18[_0xd43f('0x30')][_0xd43f('0x3a')]);_0xc9f1ca['where']=qs[_0xd43f('0x32')](_[_0xd43f('0x3b')](_0x524f18[_0xd43f('0x30')],_0x44b3cf[_0xd43f('0x32')]),_0x4b0578);if(_0x524f18[_0xd43f('0x30')]['filter']){_0xc9f1ca[_0xd43f('0x3c')]=_[_0xd43f('0x3d')](_0xc9f1ca[_0xd43f('0x3c')],{'$or':_[_0xd43f('0x2e')](_0x4b0578,function(_0x138d07){if(_0x138d07[_0xd43f('0x2b')]!=='VIRTUAL'){var _0xb5771f={};_0xb5771f[_0x138d07[_0xd43f('0x2f')]]={'$like':'%'+_0x524f18[_0xd43f('0x30')]['filter']+'%'};return _0xb5771f;}})});}_0xc9f1ca=_[_0xd43f('0x3d')]({},_0xc9f1ca,_0x524f18[_0xd43f('0x3e')]);var _0xf4de64={'where':_0xc9f1ca[_0xd43f('0x3c')]};return db['AnalyticCustomReport'][_0xd43f('0x1d')](_0xf4de64)[_0xd43f('0x22')](function(_0x486d9d){_0x26ba1b['count']=_0x486d9d;if(_0x524f18[_0xd43f('0x30')][_0xd43f('0x3f')]){_0xc9f1ca['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xd43f('0x40')](_0xc9f1ca);})[_0xd43f('0x22')](function(_0x299eaf){_0x26ba1b[_0xd43f('0x41')]=_0x299eaf;return _0x26ba1b;})['then'](respondWithFilteredResult(_0x33d072,_0xc9f1ca))[_0xd43f('0x42')](handleError(_0x33d072,null));};exports['show']=function(_0x19cd6a,_0xc48b57){var _0x125332={'raw':![],'where':{'id':_0x19cd6a['params']['id']}},_0x1141cd={};_0x1141cd[_0xd43f('0x2d')]=_[_0xd43f('0x31')](db['AnalyticCustomReport'][_0xd43f('0x43')]);_0x1141cd[_0xd43f('0x30')]=_[_0xd43f('0x31')](_0x19cd6a[_0xd43f('0x30')]);_0x1141cd[_0xd43f('0x32')]=_[_0xd43f('0x33')](_0x1141cd['model'],_0x1141cd[_0xd43f('0x30')]);_0x125332[_0xd43f('0x34')]=_[_0xd43f('0x33')](_0x1141cd[_0xd43f('0x2d')],qs[_0xd43f('0x35')](_0x19cd6a[_0xd43f('0x30')]['fields']));_0x125332[_0xd43f('0x34')]=_0x125332[_0xd43f('0x34')][_0xd43f('0x36')]?_0x125332[_0xd43f('0x34')]:_0x1141cd[_0xd43f('0x2d')];if(_0x19cd6a[_0xd43f('0x30')][_0xd43f('0x3f')]){_0x125332[_0xd43f('0x44')]=[{'all':!![]}];}_0x125332=_[_0xd43f('0x3d')]({},_0x125332,_0x19cd6a['options']);return db[_0xd43f('0x45')][_0xd43f('0x46')](_0x125332)[_0xd43f('0x22')](handleEntityNotFound(_0xc48b57,null))[_0xd43f('0x22')](respondWithResult(_0xc48b57,null))[_0xd43f('0x42')](handleError(_0xc48b57,null));};exports[_0xd43f('0x47')]=function(_0x229424,_0xefa375){return db[_0xd43f('0x45')][_0xd43f('0x47')](_0x229424['body'],{})[_0xd43f('0x22')](function(_0x33d4d0){var _0x43a2b5=_0x229424['user'][_0xd43f('0x23')]({'plain':!![]});if(!_0x43a2b5)throw new Error(_0xd43f('0x48'));if(_0x43a2b5[_0xd43f('0x49')]===_0xd43f('0x4a')){var _0x5e1f24=_0x33d4d0['get']({'plain':!![]});var _0x394c0b=_0xd43f('0x4b');return db[_0xd43f('0x4c')][_0xd43f('0x46')]({'where':{'name':_0x394c0b,'userProfileId':_0x43a2b5[_0xd43f('0x4d')]},'raw':!![]})[_0xd43f('0x22')](function(_0x5c273b){if(_0x5c273b&&_0x5c273b[_0xd43f('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e1f24[_0xd43f('0x2f')],'resourceId':_0x5e1f24['id'],'type':'CustomReports','sectionId':_0x5c273b['id']},{})[_0xd43f('0x22')](function(){return _0x33d4d0;});}else{return _0x33d4d0;}})[_0xd43f('0x42')](function(_0x36d3f3){logger[_0xd43f('0x26')](_0xd43f('0x4f'),_0x36d3f3);throw _0x36d3f3;});}return _0x33d4d0;})[_0xd43f('0x22')](respondWithResult(_0xefa375,0xc9))[_0xd43f('0x42')](handleError(_0xefa375,null));};exports[_0xd43f('0x21')]=function(_0x5980ff,_0x107549){if(_0x5980ff[_0xd43f('0x50')]['id']){delete _0x5980ff[_0xd43f('0x50')]['id'];}return db[_0xd43f('0x45')][_0xd43f('0x46')]({'where':{'id':_0x5980ff[_0xd43f('0x51')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x107549,null))[_0xd43f('0x22')](saveUpdates(_0x5980ff[_0xd43f('0x50')],null))['then'](respondWithResult(_0x107549,null))[_0xd43f('0x42')](handleError(_0x107549,null));};exports[_0xd43f('0x25')]=function(_0x213e35,_0x24323c){return db[_0xd43f('0x45')][_0xd43f('0x46')]({'where':{'id':_0x213e35[_0xd43f('0x51')]['id']}})[_0xd43f('0x22')](handleEntityNotFound(_0x24323c,null))[_0xd43f('0x22')](removeEntity(_0x24323c,null))['catch'](handleError(_0x24323c,null));};exports['preview']=function(_0x5cbd95,_0x2558c4){var _0x554792=0xa;var _0x4d67d1=['join',_0xd43f('0x52'),_0xd43f('0x53'),_0xd43f('0x54')];var _0x1196e6={'SUM':_0xd43f('0x55'),'COUNT':_0xd43f('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd43f('0x57'),'MIN':_0xd43f('0x58'),'AVG':_0xd43f('0x59'),'GROUP_CONCAT':_0xd43f('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd43f('0x5b')};var _0x3c9715={'SEC_TO_TIME':_0xd43f('0x5c'),'DATE':_0xd43f('0x5d'),'HOUR':_0xd43f('0x5e'),'ROUND':_0xd43f('0x5f'),'UNIX_TIMESTAMP':_0xd43f('0x60')};var _0x2832e5=function(_0x16c145){return!_['includes']([_0xd43f('0x61'),'IS\x20NOT\x20NULL',_0xd43f('0x62'),_0xd43f('0x63')],_0x16c145);};var _0x575a1a=function(_0x5065ad){if(!_0x5065ad||!_0x5065ad[_0xd43f('0x64')]['length']){return'';}for(var _0x2c15f6='(',_0x11f32b=0x0;_0x11f32b<_0x5065ad[_0xd43f('0x64')]['length'];_0x11f32b+=0x1){_0x11f32b>0x0&&(_0x2c15f6+='\x20'+_0x5065ad['operator']+'\x20');_0x2c15f6+=_0x5065ad['rules'][_0x11f32b][_0xd43f('0x65')]?_0x575a1a(_0x5065ad[_0xd43f('0x64')][_0x11f32b][_0xd43f('0x65')]):_0x5065ad[_0xd43f('0x64')][_0x11f32b][_0xd43f('0x66')]+'\x20'+_0x5065ad[_0xd43f('0x64')][_0x11f32b][_0xd43f('0x67')]+(_0x2832e5(_0x5065ad['rules'][_0x11f32b]['condition'])?'\x20'+_0x5065ad['rules'][_0x11f32b][_0xd43f('0x68')]:'');}return _0x2c15f6+')';};var _0x467c13={'where':{'id':_0x5cbd95[_0xd43f('0x51')]['id']}},_0x4c769f,_0x4849e6,_0x3fe29d,_0x3da882,_0x1d8d6f;_0x467c13=_[_0xd43f('0x3d')]({},_0x467c13,_0x5cbd95[_0xd43f('0x3e')]);return db[_0xd43f('0x45')][_0xd43f('0x46')](_0x467c13)['then'](function(_0x23f97b){if(_0x23f97b){_0x4c769f=_0x23f97b;return _0x23f97b[_0xd43f('0x69')]();}return null;})['then'](function(_0xa3ed66){if(_0xa3ed66){if(!_0xa3ed66[_0xd43f('0x36')]){throw new db[(_0xd43f('0x6a'))]['ValidationErrorItem'](_0xd43f('0x6b'),0x193);}_0x4849e6=_0xa3ed66;return db[_0xd43f('0x6c')][_0xd43f('0x40')]({'raw':!![]});}return null;})[_0xd43f('0x22')](function(_0x225a71){if(_0x225a71){_0x3fe29d=_[_0xd43f('0x6d')](_0x225a71,'id');var _0x40a1c9;var _0x5dd5fa=squel[_0xd43f('0x6e')]();_0x5dd5fa[_0xd43f('0x6f')](_0x4c769f['table']);for(var _0x1924df=0x0;_0x1924df<_0x4849e6[_0xd43f('0x36')];_0x1924df+=0x1){_0x40a1c9=_0x4849e6[_0x1924df][_0xd43f('0x70')]?_0x3fe29d[_0x4849e6[_0x1924df][_0xd43f('0x70')]][_0xd43f('0x71')]:_0x4849e6[_0x1924df][_0xd43f('0x66')];_0x40a1c9=_0x4849e6[_0x1924df]['function']?_[_0xd43f('0x72')](_0x1196e6[_0x4849e6[_0x1924df][_0xd43f('0x73')]],'%s',_0x40a1c9):_0x40a1c9;_0x40a1c9=_0x4849e6[_0x1924df]['format']?_[_0xd43f('0x72')](_0x3c9715[_0x4849e6[_0x1924df][_0xd43f('0x74')]],'%s',_0x40a1c9):_0x40a1c9;if(_0x4849e6[_0x1924df]['groupBy']){_0x5dd5fa[_0xd43f('0x65')](_0x40a1c9);}_0x4849e6[_0x1924df][_0xd43f('0x75')]&&_0x5dd5fa[_0xd43f('0x39')](_0x40a1c9,_0x4849e6[_0x1924df]['orderBy']===_0xd43f('0x76')?![]:!![]);_0x5dd5fa[_0xd43f('0x66')](_0x40a1c9,_0x4849e6[_0x1924df][_0xd43f('0x77')]||_0x40a1c9);}if(_0x4c769f[_0xd43f('0x78')]){_0x4c769f[_0xd43f('0x78')]=JSON[_0xd43f('0x79')](_0x4c769f[_0xd43f('0x78')]);for(var _0x256bde=0x0;_0x256bde<_0x4c769f[_0xd43f('0x78')]['length'];_0x256bde+=0x1){if(_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x2b')]&&_[_0xd43f('0x7a')](_0x4d67d1,_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x2b')])&&_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x7b')]&&_0x4c769f['joins'][_0x256bde][_0xd43f('0x7c')]&&_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x7d')]){_0x5dd5fa[_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x2b')]](_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x7c')],null,util[_0xd43f('0x74')](_0xd43f('0x7e'),_0x4c769f[_0xd43f('0x7f')],_0x4c769f['joins'][_0x256bde][_0xd43f('0x7b')],_0x4c769f[_0xd43f('0x78')][_0x256bde]['foreignTable'],_0x4c769f[_0xd43f('0x78')][_0x256bde][_0xd43f('0x7d')]));}}}if(_0x4c769f[_0xd43f('0x80')]){_0x4c769f['conditions']=JSON[_0xd43f('0x79')](_0x4c769f[_0xd43f('0x80')]);_0x5dd5fa[_0xd43f('0x3c')](_0x575a1a(_0x4c769f['conditions'][_0xd43f('0x65')]));}_0x1d8d6f=_0x5dd5fa['clone']();_0x5dd5fa[_0xd43f('0x1b')](_0x554792);_0x5dd5fa[_0xd43f('0x1c')](0x0);logger[_0xd43f('0x81')](_0xd43f('0x82'),_0x5dd5fa[_0xd43f('0x83')]());return dbH[_0xd43f('0x84')][_0xd43f('0x30')](_0x5dd5fa[_0xd43f('0x83')](),{'type':dbH[_0xd43f('0x84')][_0xd43f('0x85')][_0xd43f('0x86')]});}})[_0xd43f('0x22')](respondWithResult(_0x2558c4,null))[_0xd43f('0x42')](handleError(_0x2558c4,null));};function runReport(_0x1e8375,_0x1c8f40,_0x2d77eb){var _0x23e1e4=_0x1c8f40[_0xd43f('0x2f')];var _0x24fe1c=0xa;var _0x7b3c09=[_0xd43f('0x87'),_0xd43f('0x52'),_0xd43f('0x53'),_0xd43f('0x54')];var _0x1c5b5b={'SUM':_0xd43f('0x55'),'COUNT':_0xd43f('0x56'),'COUNT DISTINCT':_0xd43f('0x88'),'MAX':_0xd43f('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd43f('0x5a'),'GROUP_CONCAT ASC':_0xd43f('0x89'),'GROUP_CONCAT DESC':_0xd43f('0x5b')};var _0x2ae5ea={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd43f('0x5d'),'HOUR':_0xd43f('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd43f('0x60')};var _0x2a2f41=function(_0xcd972){return!_[_0xd43f('0x7a')]([_0xd43f('0x61'),_0xd43f('0x8a'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xcd972);};var _0x241b0d=function(_0x4b2c83){if(!_0x4b2c83||!_0x4b2c83[_0xd43f('0x64')]['length']){return'';}for(var _0x5cc9b8='(',_0x560f6f=0x0;_0x560f6f<_0x4b2c83[_0xd43f('0x64')]['length'];_0x560f6f+=0x1){_0x560f6f>0x0&&(_0x5cc9b8+='\x20'+_0x4b2c83['operator']+'\x20');_0x5cc9b8+=_0x4b2c83[_0xd43f('0x64')][_0x560f6f][_0xd43f('0x65')]?_0x241b0d(_0x4b2c83[_0xd43f('0x64')][_0x560f6f][_0xd43f('0x65')]):_0x4b2c83[_0xd43f('0x64')][_0x560f6f][_0xd43f('0x66')]+'\x20'+_0x4b2c83['rules'][_0x560f6f]['condition']+(_0x2a2f41(_0x4b2c83[_0xd43f('0x64')][_0x560f6f][_0xd43f('0x67')])?'\x20'+_0x4b2c83['rules'][_0x560f6f]['value']:'');}return _0x5cc9b8+')';};var _0x3b63ab={'where':{'id':_0x1e8375['id']}},_0x4efbd4,_0x357c41,_0x325e28,_0x5442b7,_0x3c03fd;_0x3b63ab=_[_0xd43f('0x3d')]({},_0x3b63ab,_0x2d77eb);return db['AnalyticCustomReport'][_0xd43f('0x46')](_0x3b63ab)[_0xd43f('0x22')](function(_0x2269c9){if(_0x2269c9){_0x4efbd4=_0x2269c9;return _0x2269c9[_0xd43f('0x69')]();}return null;})['then'](function(_0x17f57c){if(_0x17f57c){if(!_0x17f57c[_0xd43f('0x36')]){throw new db[(_0xd43f('0x6a'))][(_0xd43f('0x8b'))](_0xd43f('0x6b'),0x193);}_0x357c41=_0x17f57c;return db['AnalyticMetric'][_0xd43f('0x40')]({'raw':!![]});}return null;})[_0xd43f('0x22')](function(_0x483e49){if(_0x483e49){_0x325e28=_['keyBy'](_0x483e49,'id');var _0x1bf1bb;var _0x37a125=squel[_0xd43f('0x6e')]();_0x37a125[_0xd43f('0x6f')](_0x4efbd4[_0xd43f('0x7f')]);for(var _0x4a3681=0x0;_0x4a3681<_0x357c41[_0xd43f('0x36')];_0x4a3681+=0x1){_0x1bf1bb=_0x357c41[_0x4a3681][_0xd43f('0x70')]?_0x325e28[_0x357c41[_0x4a3681][_0xd43f('0x70')]][_0xd43f('0x71')]:_0x357c41[_0x4a3681][_0xd43f('0x66')];_0x1bf1bb=_0x357c41[_0x4a3681][_0xd43f('0x73')]?_[_0xd43f('0x72')](_0x1c5b5b[_0x357c41[_0x4a3681][_0xd43f('0x73')]],'%s',_0x1bf1bb):_0x1bf1bb;_0x1bf1bb=_0x357c41[_0x4a3681]['format']?_[_0xd43f('0x72')](_0x2ae5ea[_0x357c41[_0x4a3681][_0xd43f('0x74')]],'%s',_0x1bf1bb):_0x1bf1bb;if(_0x357c41[_0x4a3681][_0xd43f('0x8c')]){_0x37a125[_0xd43f('0x65')](_0x1bf1bb);}_0x357c41[_0x4a3681][_0xd43f('0x75')]&&_0x37a125[_0xd43f('0x39')](_0x1bf1bb,_0x357c41[_0x4a3681][_0xd43f('0x75')]===_0xd43f('0x76')?![]:!![]);_0x37a125[_0xd43f('0x66')](_0x1bf1bb,_0x357c41[_0x4a3681]['alias']||_0x1bf1bb);}if(_0x4efbd4[_0xd43f('0x78')]){_0x4efbd4[_0xd43f('0x78')]=JSON[_0xd43f('0x79')](_0x4efbd4[_0xd43f('0x78')]);for(var _0x2c2cd2=0x0;_0x2c2cd2<_0x4efbd4[_0xd43f('0x78')][_0xd43f('0x36')];_0x2c2cd2+=0x1){if(_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x2b')]&&_[_0xd43f('0x7a')](_0x7b3c09,_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x2b')])&&_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x7b')]&&_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x7c')]&&_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2]['foreignKey']){_0x37a125[_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2]['type']](_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x7c')],null,util[_0xd43f('0x74')](_0xd43f('0x7e'),_0x4efbd4[_0xd43f('0x7f')],_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x7b')],_0x4efbd4['joins'][_0x2c2cd2][_0xd43f('0x7c')],_0x4efbd4[_0xd43f('0x78')][_0x2c2cd2][_0xd43f('0x7d')]));}}}if(_0x4efbd4[_0xd43f('0x80')]){_0x4efbd4[_0xd43f('0x80')]=JSON[_0xd43f('0x79')](_0x4efbd4[_0xd43f('0x80')]);_0x37a125[_0xd43f('0x3c')](_0x241b0d(_0x4efbd4['conditions'][_0xd43f('0x65')]));}_0x3c03fd=_0x37a125[_0xd43f('0x8d')]();_0x37a125[_0xd43f('0x1b')](_0x24fe1c);_0x37a125['offset'](0x0);return;}})[_0xd43f('0x22')](function(){if(_0x1c8f40[_0xd43f('0x8e')]===_0xd43f('0x8f')){return null;}var _0x41e7fe=_[_0xd43f('0x3d')](_0x1c8f40,{'name':_0x1c8f40[_0xd43f('0x90')]||_0x1c8f40[_0xd43f('0x2f')]||_0x4efbd4[_0xd43f('0x2f')],'basename':_0x23e1e4,'savename':util[_0xd43f('0x74')]('%s-%s.%s',_0x1c8f40[_0xd43f('0x2f')]||_0x4efbd4['name'],require(_0xd43f('0x91'))[_0xd43f('0x92')](0x4),_0x1c8f40[_0xd43f('0x8e')]||_0xd43f('0x93')),'reportId':_0x4efbd4['id'],'reportType':'custom'});return db[_0xd43f('0x94')][_0xd43f('0x47')](_0x41e7fe,{'raw':!![]});})['then'](function(_0x451087){if(_0x4efbd4[_0xd43f('0x7f')]===_0xd43f('0x95')){_0x3c03fd[_0xd43f('0x3c')](_0x4efbd4[_0xd43f('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1c8f40['startDate'],_0x1c8f40[_0xd43f('0x96')]);}else{_0x3c03fd[_0xd43f('0x3c')](_0x4efbd4[_0xd43f('0x7f')]+_0xd43f('0x97'),_0x1c8f40[_0xd43f('0x98')],_0x1c8f40['endDate']);}if(_0x451087){logger[_0xd43f('0x99')](_0xd43f('0x9a'),_0x3c03fd['toString']());require(_0xd43f('0x9b'))[_0xd43f('0x9c')](path[_0xd43f('0x87')](__dirname,_0xd43f('0x9d'),_0x451087[_0xd43f('0x8e')]),[_0x451087['id'],_0x3c03fd['toString'](),path['join'](__dirname,_0xd43f('0x9e'),_0x451087[_0xd43f('0x9f')]),_0x23e1e4]);return _0x451087;}else{var _0xdb25aa=squel[_0xd43f('0x6e')]();_0xdb25aa['from']('('+_0x3c03fd['toString']()+')',_0xd43f('0xa0'));_0xdb25aa[_0xd43f('0x66')](_0xd43f('0xa1'),_0xd43f('0x1d'));_0x3c03fd['limit'](_0x1c8f40[_0xd43f('0x1b')]||_0x24fe1c);_0x3c03fd[_0xd43f('0x1c')](_0x1c8f40['offset']||0x0);return dbH[_0xd43f('0x84')][_0xd43f('0x30')](_0xdb25aa[_0xd43f('0x83')](),{'type':dbH[_0xd43f('0x84')][_0xd43f('0x85')][_0xd43f('0x86')]})[_0xd43f('0x22')](function(_0x1a2685){if(!_0x1a2685[_0xd43f('0x36')]){_0x5442b7=0x0;}else{_0x5442b7=_0x1a2685[0x0][_0xd43f('0x1d')]||0x0;}return dbH[_0xd43f('0x84')]['query'](_0x3c03fd[_0xd43f('0x83')](),{'type':dbH[_0xd43f('0x84')]['QueryTypes'][_0xd43f('0x86')]});})[_0xd43f('0x22')](function(_0x4e969e){return{'rows':_0x4e969e||[],'count':_0x5442b7};});}});}exports[_0xd43f('0xa2')]=function(_0x1860d3,_0x12523d){return runReport(_0x1860d3[_0xd43f('0x51')],_0x1860d3['query'],_0x1860d3[_0xd43f('0x3e')])[_0xd43f('0x22')](respondWithResult(_0x12523d,null))['catch'](handleError(_0x12523d,null));};exports[_0xd43f('0xa3')]=runReport;exports[_0xd43f('0x30')]=function(_0x31e8ba,_0xb37531){var _0x442a62=0xa;var _0x104def=['join',_0xd43f('0x52'),'right_join',_0xd43f('0x54')];var _0x2c271f={'SUM':_0xd43f('0x55'),'COUNT':_0xd43f('0x56'),'COUNT DISTINCT':_0xd43f('0x88'),'MAX':_0xd43f('0x57'),'MIN':'MIN(%s)','AVG':_0xd43f('0x59'),'GROUP_CONCAT':_0xd43f('0x5a'),'GROUP_CONCAT ASC':_0xd43f('0x89'),'GROUP_CONCAT DESC':_0xd43f('0x5b')};var _0x496619={'SEC_TO_TIME':_0xd43f('0x5c'),'DATE':'DATE(%s)','HOUR':_0xd43f('0x5e'),'ROUND':_0xd43f('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc9c1ba=function(_0x4fcd30){return!_[_0xd43f('0x7a')]([_0xd43f('0x61'),_0xd43f('0x8a'),_0xd43f('0x62'),_0xd43f('0x63')],_0x4fcd30);};var _0xfae877=function(_0x16e1ec){if(!_0x16e1ec||!_0x16e1ec[_0xd43f('0x64')][_0xd43f('0x36')]){return'';}for(var _0x5e9f4d='(',_0x14bee3=0x0;_0x14bee3<_0x16e1ec[_0xd43f('0x64')][_0xd43f('0x36')];_0x14bee3+=0x1){_0x14bee3>0x0&&(_0x5e9f4d+='\x20'+_0x16e1ec[_0xd43f('0xa4')]+'\x20');_0x5e9f4d+=_0x16e1ec[_0xd43f('0x64')][_0x14bee3][_0xd43f('0x65')]?_0xfae877(_0x16e1ec['rules'][_0x14bee3][_0xd43f('0x65')]):_0x16e1ec[_0xd43f('0x64')][_0x14bee3][_0xd43f('0x66')]+'\x20'+_0x16e1ec['rules'][_0x14bee3][_0xd43f('0x67')]+(_0xc9c1ba(_0x16e1ec[_0xd43f('0x64')][_0x14bee3][_0xd43f('0x67')])?'\x20'+_0x16e1ec[_0xd43f('0x64')][_0x14bee3][_0xd43f('0x68')]:'');}return _0x5e9f4d+')';};var _0x4c7eab={'where':{'id':_0x31e8ba[_0xd43f('0x51')]['id']}},_0x1bc00c,_0x40e4f6,_0x485408,_0x42a880,_0x25c76c;_0x4c7eab=_['merge']({},_0x4c7eab,_0x31e8ba[_0xd43f('0x3e')]);return db[_0xd43f('0x45')]['find'](_0x4c7eab)[_0xd43f('0x22')](function(_0x55505c){if(_0x55505c){_0x1bc00c=_0x55505c;return _0x55505c['getFields']();}return null;})['then'](function(_0x5eaf8e){if(_0x5eaf8e){if(!_0x5eaf8e[_0xd43f('0x36')]){throw new db[(_0xd43f('0x6a'))][(_0xd43f('0x8b'))](_0xd43f('0x6b'),0x193);}_0x40e4f6=_0x5eaf8e;return db[_0xd43f('0x6c')][_0xd43f('0x40')]({'raw':!![]});}return null;})[_0xd43f('0x22')](function(_0x509712){if(_0x509712){_0x485408=_[_0xd43f('0x6d')](_0x509712,'id');var _0x1a0217;var _0x2cec28=squel['select']();_0x2cec28[_0xd43f('0x6f')](_0x1bc00c[_0xd43f('0x7f')]);for(var _0x599be2=0x0;_0x599be2<_0x40e4f6['length'];_0x599be2+=0x1){_0x1a0217=_0x40e4f6[_0x599be2][_0xd43f('0x70')]?_0x485408[_0x40e4f6[_0x599be2]['MetricId']]['metric']:_0x40e4f6[_0x599be2][_0xd43f('0x66')];_0x1a0217=_0x40e4f6[_0x599be2][_0xd43f('0x73')]?_[_0xd43f('0x72')](_0x2c271f[_0x40e4f6[_0x599be2][_0xd43f('0x73')]],'%s',_0x1a0217):_0x1a0217;_0x1a0217=_0x40e4f6[_0x599be2][_0xd43f('0x74')]?_[_0xd43f('0x72')](_0x496619[_0x40e4f6[_0x599be2][_0xd43f('0x74')]],'%s',_0x1a0217):_0x1a0217;if(_0x40e4f6[_0x599be2][_0xd43f('0x8c')]){_0x2cec28[_0xd43f('0x65')](_0x1a0217);}_0x40e4f6[_0x599be2][_0xd43f('0x75')]&&_0x2cec28['order'](_0x1a0217,_0x40e4f6[_0x599be2][_0xd43f('0x75')]===_0xd43f('0x76')?![]:!![]);_0x2cec28['field'](_0x1a0217,_0x40e4f6[_0x599be2][_0xd43f('0x77')]||_0x1a0217);}if(_0x1bc00c['joins']){_0x1bc00c[_0xd43f('0x78')]=JSON[_0xd43f('0x79')](_0x1bc00c[_0xd43f('0x78')]);for(var _0x12409=0x0;_0x12409<_0x1bc00c[_0xd43f('0x78')][_0xd43f('0x36')];_0x12409+=0x1){if(_0x1bc00c[_0xd43f('0x78')][_0x12409]['type']&&_[_0xd43f('0x7a')](_0x104def,_0x1bc00c[_0xd43f('0x78')][_0x12409][_0xd43f('0x2b')])&&_0x1bc00c[_0xd43f('0x78')][_0x12409]['parentKey']&&_0x1bc00c[_0xd43f('0x78')][_0x12409][_0xd43f('0x7c')]&&_0x1bc00c['joins'][_0x12409][_0xd43f('0x7d')]){_0x2cec28[_0x1bc00c['joins'][_0x12409][_0xd43f('0x2b')]](_0x1bc00c['joins'][_0x12409][_0xd43f('0x7c')],null,util[_0xd43f('0x74')]('%s.%s\x20=\x20%s.%s',_0x1bc00c[_0xd43f('0x7f')],_0x1bc00c[_0xd43f('0x78')][_0x12409][_0xd43f('0x7b')],_0x1bc00c[_0xd43f('0x78')][_0x12409][_0xd43f('0x7c')],_0x1bc00c['joins'][_0x12409][_0xd43f('0x7d')]));}}}if(_0x1bc00c['conditions']){_0x1bc00c['conditions']=JSON[_0xd43f('0x79')](_0x1bc00c[_0xd43f('0x80')]);_0x2cec28[_0xd43f('0x3c')](_0xfae877(_0x1bc00c[_0xd43f('0x80')][_0xd43f('0x65')]));}_0x25c76c=_0x2cec28[_0xd43f('0x8d')]();_0x2cec28[_0xd43f('0x1b')](_0x442a62);_0x2cec28[_0xd43f('0x1c')](0x0);logger[_0xd43f('0x81')](_0xd43f('0x82'),_0x2cec28[_0xd43f('0x83')]());return dbH['sequelize'][_0xd43f('0x30')](_0x2cec28[_0xd43f('0x83')](),{'type':dbH['sequelize'][_0xd43f('0x85')]['SELECT']});}})[_0xd43f('0x22')](function(){return{'sql':_0x25c76c[_0xd43f('0x83')]()};})[_0xd43f('0x22')](respondWithResult(_0xb37531,null))[_0xd43f('0x42')](handleError(_0xb37531,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d4d7571..5f67724 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 _0xc27c=['AnalyticCustomReport','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x575269,_0x251332){var _0x4924c0=function(_0x50bba0){while(--_0x50bba0){_0x575269['push'](_0x575269['shift']());}};_0x4924c0(++_0x251332);}(_0xc27c,0x1b9));var _0xcc27=function(_0x231a4d,_0x2d52ec){_0x231a4d=_0x231a4d-0x0;var _0x4c55c3=_0xc27c[_0x231a4d];return _0x4c55c3;};'use strict';var _=require(_0xcc27('0x0'));var util=require(_0xcc27('0x1'));var logger=require(_0xcc27('0x2'))('api');var moment=require(_0xcc27('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc27('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc27('0x5'));var config=require(_0xcc27('0x6'));var attributes=require(_0xcc27('0x7'));module[_0xcc27('0x8')]=function(_0x436b21,_0x402bb4){return _0x436b21['define'](_0xcc27('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3752=['request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10df87,_0x4e3dcb){var _0x22923d=function(_0x439738){while(--_0x439738){_0x10df87['push'](_0x10df87['shift']());}};_0x22923d(++_0x4e3dcb);}(_0x3752,0x7e));var _0x2375=function(_0x4ca89a,_0x33ffb8){_0x4ca89a=_0x4ca89a-0x0;var _0xfeb04d=_0x3752[_0x4ca89a];return _0xfeb04d;};'use strict';var _=require(_0x2375('0x0'));var util=require(_0x2375('0x1'));var logger=require(_0x2375('0x2'))(_0x2375('0x3'));var moment=require(_0x2375('0x4'));var BPromise=require(_0x2375('0x5'));var rp=require(_0x2375('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2375('0x7'));var attributes=require(_0x2375('0x8'));module[_0x2375('0x9')]=function(_0x3bf10b,_0x248431){return _0x3bf10b[_0x2375('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x2375('0xb'),'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 aa7f426..18c0e8d 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 _0x7d3a=['client','http','request','then','info','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2a94f0,_0x357a80){var _0x8fe809=function(_0x16a3c5){while(--_0x16a3c5){_0x2a94f0['push'](_0x2a94f0['shift']());}};_0x8fe809(++_0x357a80);}(_0x7d3a,0x198));var _0xa7d3=function(_0xe0f3e9,_0x59fd23){_0xe0f3e9=_0xe0f3e9-0x0;var _0x589ff7=_0x7d3a[_0xe0f3e9];return _0x589ff7;};'use strict';var _=require(_0xa7d3('0x0'));var util=require('util');var moment=require(_0xa7d3('0x1'));var BPromise=require(_0xa7d3('0x2'));var rs=require(_0xa7d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7d3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa7d3('0x6')][_0xa7d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f4ef6,_0x3ffd06,_0x132e8b){return new BPromise(function(_0x208d4a,_0x2e2ea0){return client[_0xa7d3('0x8')](_0x1f4ef6,_0x132e8b)[_0xa7d3('0x9')](function(_0x155d41){logger[_0xa7d3('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3ffd06,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3ffd06,'request\x20sent',JSON['stringify'](_0x155d41));if(_0x155d41[_0xa7d3('0xb')]){if(_0x155d41['error'][_0xa7d3('0xc')]===0x1f4){logger[_0xa7d3('0xb')](_0xa7d3('0xd'),_0x3ffd06,_0x155d41[_0xa7d3('0xb')]['message']);return _0x2e2ea0(_0x155d41['error'][_0xa7d3('0xe')]);}logger['error'](_0xa7d3('0xd'),_0x3ffd06,_0x155d41[_0xa7d3('0xb')]['message']);return _0x208d4a(_0x155d41[_0xa7d3('0xb')][_0xa7d3('0xe')]);}else{logger[_0xa7d3('0xa')](_0xa7d3('0xd'),_0x3ffd06,_0xa7d3('0xf'));_0x208d4a(_0x155d41[_0xa7d3('0x10')][_0xa7d3('0xe')]);}})[_0xa7d3('0x11')](function(_0x5c7ea4){logger[_0xa7d3('0xb')](_0xa7d3('0xd'),_0x3ffd06,_0x5c7ea4);_0x2e2ea0(_0x5c7ea4);});});} \ No newline at end of file +var _0xd4f3=['error','message','info','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d570b,_0x490e1b){var _0x401a28=function(_0x2b1c6c){while(--_0x2b1c6c){_0x4d570b['push'](_0x4d570b['shift']());}};_0x401a28(++_0x490e1b);}(_0xd4f3,0x100));var _0x3d4f=function(_0x2fc33d,_0x4a3a73){_0x2fc33d=_0x2fc33d-0x0;var _0x272473=_0xd4f3[_0x2fc33d];return _0x272473;};'use strict';var _=require(_0x3d4f('0x0'));var util=require(_0x3d4f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d4f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d4f('0x3'));var logger=require(_0x3d4f('0x4'))(_0x3d4f('0x5'));var config=require(_0x3d4f('0x6'));var jayson=require(_0x3d4f('0x7'));var client=jayson[_0x3d4f('0x8')][_0x3d4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x203e19,_0x49cec7,_0x483a11){return new BPromise(function(_0x59ee01,_0x2b5ec5){return client[_0x3d4f('0xa')](_0x203e19,_0x483a11)[_0x3d4f('0xb')](function(_0x53dd36){logger['info'](_0x3d4f('0xc'),_0x49cec7,_0x3d4f('0xd'));logger[_0x3d4f('0xe')](_0x3d4f('0xf'),_0x49cec7,_0x3d4f('0xd'),JSON[_0x3d4f('0x10')](_0x53dd36));if(_0x53dd36[_0x3d4f('0x11')]){if(_0x53dd36['error']['code']===0x1f4){logger[_0x3d4f('0x11')](_0x3d4f('0xc'),_0x49cec7,_0x53dd36[_0x3d4f('0x11')][_0x3d4f('0x12')]);return _0x2b5ec5(_0x53dd36[_0x3d4f('0x11')][_0x3d4f('0x12')]);}logger[_0x3d4f('0x11')](_0x3d4f('0xc'),_0x49cec7,_0x53dd36[_0x3d4f('0x11')]['message']);return _0x59ee01(_0x53dd36[_0x3d4f('0x11')][_0x3d4f('0x12')]);}else{logger[_0x3d4f('0x13')](_0x3d4f('0xc'),_0x49cec7,_0x3d4f('0xd'));_0x59ee01(_0x53dd36['result'][_0x3d4f('0x12')]);}})[_0x3d4f('0x14')](function(_0x7fce1){logger[_0x3d4f('0x11')](_0x3d4f('0xc'),_0x49cec7,_0x7fce1);_0x2b5ec5(_0x7fce1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a8a6d4f..25eabc0 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 _0x4b01=['run','query','create','put','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x8ac6f9,_0x31a5a6){var _0x243ed5=function(_0xac099b){while(--_0xac099b){_0x8ac6f9['push'](_0x8ac6f9['shift']());}};_0x243ed5(++_0x31a5a6);}(_0x4b01,0x170));var _0x14b0=function(_0xe05fed,_0x1bd4aa){_0xe05fed=_0xe05fed-0x0;var _0x157a20=_0x4b01[_0xe05fed];return _0x157a20;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x14b0('0x0'));var express=require(_0x14b0('0x1'));var router=express[_0x14b0('0x2')]();var fs_extra=require(_0x14b0('0x3'));var auth=require(_0x14b0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14b0('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x14b0('0x6')]('/',auth[_0x14b0('0x7')](),controller[_0x14b0('0x8')]);router[_0x14b0('0x6')](_0x14b0('0x9'),auth[_0x14b0('0x7')](),controller[_0x14b0('0xa')]);router[_0x14b0('0x6')](_0x14b0('0xb'),auth[_0x14b0('0x7')](),controller['preview']);router[_0x14b0('0x6')]('/:id/run',auth[_0x14b0('0x7')](),controller[_0x14b0('0xc')]);router[_0x14b0('0x6')]('/:id/query',auth[_0x14b0('0x7')](),controller[_0x14b0('0xd')]);router['post']('/',auth[_0x14b0('0x7')](),controller[_0x14b0('0xe')]);router[_0x14b0('0xf')](_0x14b0('0x9'),auth['isAuthenticated'](),controller[_0x14b0('0x10')]);router['delete']('/:id',auth[_0x14b0('0x7')](),controller[_0x14b0('0x11')]);module[_0x14b0('0x12')]=router; \ No newline at end of file +var _0xba5e=['Router','fs-extra','get','isAuthenticated','index','show','preview','/:id/run','/:id/query','post','create','update','/:id','destroy','exports','multer','path','connect-timeout','express'];(function(_0x26c19d,_0x3f7b9b){var _0x37d676=function(_0x4d091e){while(--_0x4d091e){_0x26c19d['push'](_0x26c19d['shift']());}};_0x37d676(++_0x3f7b9b);}(_0xba5e,0x12c));var _0xeba5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xba5e[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xeba5('0x0'));var util=require('util');var path=require(_0xeba5('0x1'));var timeout=require(_0xeba5('0x2'));var express=require(_0xeba5('0x3'));var router=express[_0xeba5('0x4')]();var fs_extra=require(_0xeba5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xeba5('0x6')]('/',auth[_0xeba5('0x7')](),controller[_0xeba5('0x8')]);router[_0xeba5('0x6')]('/:id',auth[_0xeba5('0x7')](),controller[_0xeba5('0x9')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller[_0xeba5('0xa')]);router[_0xeba5('0x6')](_0xeba5('0xb'),auth[_0xeba5('0x7')](),controller['run']);router[_0xeba5('0x6')](_0xeba5('0xc'),auth[_0xeba5('0x7')](),controller['query']);router[_0xeba5('0xd')]('/',auth[_0xeba5('0x7')](),controller[_0xeba5('0xe')]);router['put']('/:id',auth[_0xeba5('0x7')](),controller[_0xeba5('0xf')]);router['delete'](_0xeba5('0x10'),auth['isAuthenticated'](),controller[_0xeba5('0x11')]);module[_0xeba5('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 836525e..f584fb2 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 _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x2375f1,_0x31d6cf){var _0x1237b5=function(_0x125eda){while(--_0x125eda){_0x2375f1['push'](_0x2375f1['shift']());}};_0x1237b5(++_0x31d6cf);}(_0xd8fb,0x99));var _0xbd8f=function(_0x29b244,_0x3de9e3){_0x29b244=_0x29b244-0x0;var _0x218f5e=_0xd8fb[_0x29b244];return _0x218f5e;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','TEXT'];(function(_0x33ea32,_0x288fa3){var _0x4fc865=function(_0x12386c){while(--_0x12386c){_0x33ea32['push'](_0x33ea32['shift']());}};_0x4fc865(++_0x288fa3);}(_0x425d,0x1e0));var _0xd425=function(_0x276eb7,_0xcfea0f){_0x276eb7=_0x276eb7-0x0;var _0x120211=_0x425d[_0x276eb7];return _0x120211;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index da71e7e..02a211e 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 _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2433aa,_0x29d117){_0x2433aa=_0x2433aa-0x0;var _0x2c614b=_0xc6ac[_0x2433aa];return _0x2c614b;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x38a045,_0x402d6b){var _0x45c34c=function(_0x2bde36){while(--_0x2bde36){_0x38a045['push'](_0x38a045['shift']());}};_0x45c34c(++_0x402d6b);}(_0x7a54,0x106));var _0x47a5=function(_0x1254bb,_0x1f3a9d){_0x1254bb=_0x1254bb-0x0;var _0x296a15=_0x7a54[_0x1254bb];return _0x296a15;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3692f80..92655f6 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 _0x811e=['util','../../config/logger','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x2630a5,_0x5c59e8){var _0x4b0d4c=function(_0x5a4728){while(--_0x5a4728){_0x2630a5['push'](_0x2630a5['shift']());}};_0x4b0d4c(++_0x5c59e8);}(_0x811e,0x144));var _0xe811=function(_0x42dd89,_0x51aef2){_0x42dd89=_0x42dd89-0x0;var _0x745142=_0x811e[_0x42dd89];return _0x745142;};'use strict';var _=require('lodash');var util=require(_0xe811('0x0'));var logger=require(_0xe811('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe811('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe811('0x3'));var config=require(_0xe811('0x4'));var attributes=require(_0xe811('0x5'));module[_0xe811('0x6')]=function(_0x1c4e23,_0x12d49e){return _0x1c4e23[_0xe811('0x7')](_0xe811('0x8'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1085=['rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x58b488,_0x2c702b){var _0x2e270c=function(_0x16a838){while(--_0x16a838){_0x58b488['push'](_0x58b488['shift']());}};_0x2e270c(++_0x2c702b);}(_0x1085,0xd7));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5108('0x0'))(_0x5108('0x1'));var moment=require(_0x5108('0x2'));var BPromise=require(_0x5108('0x3'));var rp=require(_0x5108('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5108('0x5'));var config=require(_0x5108('0x6'));var attributes=require(_0x5108('0x7'));module['exports']=function(_0x11e5e0,_0x4abfaa){return _0x11e5e0[_0x5108('0x8')](_0x5108('0x9'),attributes,{'tableName':_0x5108('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index db260ec..1b32977 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 _0x0046=['client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x6656b1,_0x3421ee){var _0x45ae3a=function(_0x4ba6f5){while(--_0x4ba6f5){_0x6656b1['push'](_0x6656b1['shift']());}};_0x45ae3a(++_0x3421ee);}(_0x0046,0x1af));var _0x6004=function(_0x42641f,_0x59982b){_0x42641f=_0x42641f-0x0;var _0x190aff=_0x0046[_0x42641f];return _0x190aff;};'use strict';var _=require(_0x6004('0x0'));var util=require('util');var moment=require(_0x6004('0x1'));var BPromise=require('bluebird');var rs=require(_0x6004('0x2'));var fs=require('fs');var Redis=require(_0x6004('0x3'));var db=require(_0x6004('0x4'))['db'];var utils=require(_0x6004('0x5'));var logger=require(_0x6004('0x6'))(_0x6004('0x7'));var config=require(_0x6004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6004('0x9')][_0x6004('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x590c7a,_0x4b4c20,_0x2f8401){return new BPromise(function(_0x1da74b,_0x13a348){return client[_0x6004('0xb')](_0x590c7a,_0x2f8401)[_0x6004('0xc')](function(_0x56adfb){logger[_0x6004('0xd')](_0x6004('0xe'),_0x4b4c20,_0x6004('0xf'));logger[_0x6004('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4b4c20,_0x6004('0xf'),JSON[_0x6004('0x11')](_0x56adfb));if(_0x56adfb[_0x6004('0x12')]){if(_0x56adfb[_0x6004('0x12')]['code']===0x1f4){logger['error'](_0x6004('0xe'),_0x4b4c20,_0x56adfb[_0x6004('0x12')][_0x6004('0x13')]);return _0x13a348(_0x56adfb[_0x6004('0x12')][_0x6004('0x13')]);}logger[_0x6004('0x12')](_0x6004('0xe'),_0x4b4c20,_0x56adfb[_0x6004('0x12')][_0x6004('0x13')]);return _0x1da74b(_0x56adfb[_0x6004('0x12')]['message']);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b4c20,_0x6004('0xf'));_0x1da74b(_0x56adfb[_0x6004('0x14')][_0x6004('0x13')]);}})[_0x6004('0x15')](function(_0x3b859d){logger['error'](_0x6004('0xe'),_0x4b4c20,_0x3b859d);_0x13a348(_0x3b859d);});});} \ No newline at end of file +var _0xc440=['request','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4bac84,_0x5a800d){var _0x4b5c8e=function(_0x594a8d){while(--_0x594a8d){_0x4bac84['push'](_0x4bac84['shift']());}};_0x4b5c8e(++_0x5a800d);}(_0xc440,0x1c0));var _0x0c44=function(_0x41e7d0,_0x22b473){_0x41e7d0=_0x41e7d0-0x0;var _0x274ea9=_0xc440[_0x41e7d0];return _0x274ea9;};'use strict';var _=require(_0x0c44('0x0'));var util=require('util');var moment=require(_0x0c44('0x1'));var BPromise=require(_0x0c44('0x2'));var rs=require(_0x0c44('0x3'));var fs=require('fs');var Redis=require(_0x0c44('0x4'));var db=require(_0x0c44('0x5'))['db'];var utils=require(_0x0c44('0x6'));var logger=require(_0x0c44('0x7'))('rpc');var config=require(_0x0c44('0x8'));var jayson=require(_0x0c44('0x9'));var client=jayson[_0x0c44('0xa')][_0x0c44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30a98a,_0x48004b,_0x4017a6){return new BPromise(function(_0x3ec14b,_0x1e433b){return client[_0x0c44('0xc')](_0x30a98a,_0x4017a6)['then'](function(_0x4ea9f3){logger['info'](_0x0c44('0xd'),_0x48004b,'request\x20sent');logger[_0x0c44('0xe')](_0x0c44('0xf'),_0x48004b,'request\x20sent',JSON[_0x0c44('0x10')](_0x4ea9f3));if(_0x4ea9f3['error']){if(_0x4ea9f3[_0x0c44('0x11')][_0x0c44('0x12')]===0x1f4){logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x48004b,_0x4ea9f3[_0x0c44('0x11')][_0x0c44('0x13')]);return _0x1e433b(_0x4ea9f3[_0x0c44('0x11')]['message']);}logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x48004b,_0x4ea9f3[_0x0c44('0x11')]['message']);return _0x3ec14b(_0x4ea9f3[_0x0c44('0x11')][_0x0c44('0x13')]);}else{logger[_0x0c44('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x48004b,_0x0c44('0x15'));_0x3ec14b(_0x4ea9f3[_0x0c44('0x16')]['message']);}})['catch'](function(_0x373513){logger['error'](_0x0c44('0xd'),_0x48004b,_0x373513);_0x1e433b(_0x373513);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1f8cbaa..7042f21 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 _0x7d8b=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x49f671,_0x97347d){var _0x959285=function(_0x1be675){while(--_0x1be675){_0x49f671['push'](_0x49f671['shift']());}};_0x959285(++_0x97347d);}(_0x7d8b,0x1c1));var _0xb7d8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x7d8b[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require(_0xb7d8('0x0'));var path=require(_0xb7d8('0x1'));var timeout=require(_0xb7d8('0x2'));var express=require(_0xb7d8('0x3'));var router=express[_0xb7d8('0x4')]();var fs_extra=require(_0xb7d8('0x5'));var auth=require(_0xb7d8('0x6'));var interaction=require(_0xb7d8('0x7'));var config=require(_0xb7d8('0x8'));var controller=require(_0xb7d8('0x9'));router[_0xb7d8('0xa')]('/',auth[_0xb7d8('0xb')](),controller[_0xb7d8('0xc')]);router[_0xb7d8('0xa')](_0xb7d8('0xd'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/preview',auth[_0xb7d8('0xb')](),controller[_0xb7d8('0xe')]);router[_0xb7d8('0xa')](_0xb7d8('0xf'),auth[_0xb7d8('0xb')](),controller[_0xb7d8('0x10')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0xb7d8('0x11')]);router[_0xb7d8('0x12')]('/',auth['isAuthenticated'](),controller[_0xb7d8('0x13')]);router[_0xb7d8('0x14')](_0xb7d8('0xd'),auth[_0xb7d8('0xb')](),controller[_0xb7d8('0x15')]);router[_0xb7d8('0x16')]('/:id',auth[_0xb7d8('0xb')](),controller[_0xb7d8('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc965=['../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update','destroy','exports','multer','express','../../components/auth/service'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xc965,0x6f));var _0x5c96=function(_0x2bdf29,_0x40cab0){_0x2bdf29=_0x2bdf29-0x0;var _0x60cb83=_0xc965[_0x2bdf29];return _0x60cb83;};'use strict';var multer=require(_0x5c96('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c96('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5c96('0x2'));var interaction=require(_0x5c96('0x3'));var config=require('../../config/environment');var controller=require(_0x5c96('0x4'));router[_0x5c96('0x5')]('/',auth[_0x5c96('0x6')](),controller['index']);router[_0x5c96('0x5')](_0x5c96('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x5c96('0x5')](_0x5c96('0x8'),auth[_0x5c96('0x6')](),controller[_0x5c96('0x9')]);router['get'](_0x5c96('0xa'),auth['isAuthenticated'](),controller[_0x5c96('0xb')]);router[_0x5c96('0x5')](_0x5c96('0xc'),auth['isAuthenticated'](),controller[_0x5c96('0xd')]);router[_0x5c96('0xe')]('/',auth[_0x5c96('0x6')](),controller['create']);router[_0x5c96('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5c96('0x10')]);router['delete'](_0x5c96('0x7'),auth['isAuthenticated'](),controller[_0x5c96('0x11')]);module[_0x5c96('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 5ebdcb1..156cd75 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 _0x07d4=['ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','sequelize','moment','exports','STRING'];(function(_0x594808,_0x59e415){var _0x439dcb=function(_0x4a974f){while(--_0x4a974f){_0x594808['push'](_0x594808['shift']());}};_0x439dcb(++_0x59e415);}(_0x07d4,0x1a0));var _0x407d=function(_0x3b5819,_0x3d7caf){_0x3b5819=_0x3b5819-0x0;var _0x13c387=_0x07d4[_0x3b5819];return _0x13c387;};'use strict';var Sequelize=require(_0x407d('0x0'));var moment=require(_0x407d('0x1'));module[_0x407d('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x407d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x407d('0x4')](_0x407d('0x5'),'pdf',_0x407d('0x6')),'allowNull':![],'defaultValue':_0x407d('0x5')},'savename':{'type':Sequelize[_0x407d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x407d('0x7')]},'status':{'type':Sequelize[_0x407d('0x3')],'defaultValue':_0x407d('0x8')},'type':{'type':Sequelize['ENUM'](_0x407d('0x9'),_0x407d('0xa')),'allowNull':![],'defaultValue':_0x407d('0x9')},'reportId':{'type':Sequelize[_0x407d('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x407d('0x3')]}}; \ No newline at end of file +var _0x7763=['DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','pdf','xlsx'];(function(_0x1ef9ef,_0x597194){var _0x4302e5=function(_0x3f3deb){while(--_0x3f3deb){_0x1ef9ef['push'](_0x1ef9ef['shift']());}};_0x4302e5(++_0x597194);}(_0x7763,0x1d9));var _0x3776=function(_0x27adae,_0x375e3a){_0x27adae=_0x27adae-0x0;var _0x125156=_0x7763[_0x27adae];return _0x125156;};'use strict';var Sequelize=require(_0x3776('0x0'));var moment=require(_0x3776('0x1'));module[_0x3776('0x2')]={'name':{'type':Sequelize[_0x3776('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3776('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x3776('0x4')]('csv',_0x3776('0x5'),_0x3776('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3776('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3776('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x3776('0x3')],'defaultValue':_0x3776('0x8')},'type':{'type':Sequelize[_0x3776('0x4')](_0x3776('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x3776('0x9')},'reportId':{'type':Sequelize[_0x3776('0xa')](0xb)[_0x3776('0xb')]},'reportType':{'type':Sequelize[_0x3776('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ac78840..9e84b28 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 _0x651e=['map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','savename','output','join','server/files/reports','Sequelize','exists','format','%s.%s','basename','toLowerCase','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','get','ExtractedReports','destroy','sendStatus','error','stack','name','send'];(function(_0xc7f885,_0x1f8b90){var _0x2e146c=function(_0x48b8ec){while(--_0x48b8ec){_0xc7f885['push'](_0xc7f885['shift']());}};_0x2e146c(++_0x1f8b90);}(_0x651e,0x19f));var _0xe651=function(_0x200ab8,_0x5afe01){_0x200ab8=_0x200ab8-0x0;var _0x40791a=_0x651e[_0x200ab8];return _0x40791a;};'use strict';var emlformat=require(_0xe651('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe651('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe651('0x2'));var moment=require(_0xe651('0x3'));var BPromise=require(_0xe651('0x4'));var Mustache=require(_0xe651('0x5'));var util=require(_0xe651('0x6'));var path=require('path');var sox=require(_0xe651('0x7'));var csv=require(_0xe651('0x8'));var ejs=require(_0xe651('0x9'));var fs=require('fs');var fs_extra=require(_0xe651('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe651('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe651('0xc'));var toCsv=require(_0xe651('0x8'));var querystring=require(_0xe651('0xd'));var Papa=require(_0xe651('0xe'));var Redis=require(_0xe651('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe651('0x10'));var as=require(_0xe651('0x11'));var hardwareService=require(_0xe651('0x12'));var logger=require('../../config/logger')(_0xe651('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe651('0x14'))['db'];function respondWithStatusCode(_0x18612e,_0x34f8c3){_0x34f8c3=_0x34f8c3||0xcc;return function(_0x36c5be){if(_0x36c5be){return _0x18612e['sendStatus'](_0x34f8c3);}return _0x18612e[_0xe651('0x15')](_0x34f8c3)[_0xe651('0x16')]();};}function respondWithResult(_0x15b815,_0x35e02a){_0x35e02a=_0x35e02a||0xc8;return function(_0x3159bc){if(_0x3159bc){return _0x15b815[_0xe651('0x15')](_0x35e02a)[_0xe651('0x17')](_0x3159bc);}};}function respondWithFilteredResult(_0xaad455,_0x3a5d3a){return function(_0x7f1b18){if(_0x7f1b18){var _0x2a88e1=typeof _0x3a5d3a[_0xe651('0x18')]===_0xe651('0x19')&&typeof _0x3a5d3a[_0xe651('0x1a')]===_0xe651('0x19');var _0xa757b5=_0x7f1b18[_0xe651('0x1b')];var _0x4e8dd2=_0x2a88e1?0x0:_0x3a5d3a[_0xe651('0x18')];var _0x498426=_0x2a88e1?_0x7f1b18['count']:_0x3a5d3a[_0xe651('0x18')]+_0x3a5d3a[_0xe651('0x1a')];var _0x4d3b46;if(_0x498426>=_0xa757b5){_0x498426=_0xa757b5;_0x4d3b46=0xc8;}else{_0x4d3b46=0xce;}_0xaad455[_0xe651('0x15')](_0x4d3b46);return _0xaad455['set'](_0xe651('0x1c'),_0x4e8dd2+'-'+_0x498426+'/'+_0xa757b5)['json'](_0x7f1b18);}return null;};}function patchUpdates(_0x459240){return function(_0x486f70){try{jsonpatch['apply'](_0x486f70,_0x459240,!![]);}catch(_0x6528eb){return BPromise['reject'](_0x6528eb);}return _0x486f70[_0xe651('0x1d')]();};}function saveUpdates(_0x3b6460,_0xbc66b9){return function(_0x2da77e){if(_0x2da77e){return _0x2da77e[_0xe651('0x1e')](_0x3b6460)[_0xe651('0x1f')](function(_0x34beb0){return _0x34beb0;});}return null;};}function removeEntity(_0x36bc50,_0x4a6b12){return function(_0x294973){if(_0x294973){return _0x294973['destroy']()[_0xe651('0x1f')](function(){var _0x5c2a41=_0x294973[_0xe651('0x20')]({'plain':!![]});var _0x3491fa=_0xe651('0x21');return db['UserProfileResource'][_0xe651('0x22')]({'where':{'type':_0x3491fa,'resourceId':_0x5c2a41['id']}})[_0xe651('0x1f')](function(){return _0x294973;});})[_0xe651('0x1f')](function(){_0x36bc50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c598,_0x17161e){return function(_0x3090dc){if(!_0x3090dc){_0x51c598[_0xe651('0x23')](0x194);}return _0x3090dc;};}function handleError(_0x3e765b,_0x59ced0){_0x59ced0=_0x59ced0||0x1f4;return function(_0x319348){logger[_0xe651('0x24')](_0x319348[_0xe651('0x25')]);if(_0x319348[_0xe651('0x26')]){delete _0x319348[_0xe651('0x26')];}_0x3e765b[_0xe651('0x15')](_0x59ced0)[_0xe651('0x27')](_0x319348);};}exports['index']=function(_0x4d3444,_0x3ba6c4){var _0x6158a2={},_0x53c245={},_0x3efd6c={'count':0x0,'rows':[]};var _0x3957e9=_[_0xe651('0x28')](db[_0xe651('0x29')][_0xe651('0x2a')],function(_0x590606){return{'name':_0x590606[_0xe651('0x2b')],'type':_0x590606[_0xe651('0x2c')][_0xe651('0x2d')]};});_0x53c245[_0xe651('0x2e')]=_['map'](_0x3957e9,_0xe651('0x26'));_0x53c245[_0xe651('0x2f')]=_[_0xe651('0x30')](_0x4d3444[_0xe651('0x2f')]);_0x53c245[_0xe651('0x31')]=_[_0xe651('0x32')](_0x53c245[_0xe651('0x2e')],_0x53c245['query']);_0x6158a2[_0xe651('0x33')]=_['intersection'](_0x53c245[_0xe651('0x2e')],qs[_0xe651('0x34')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x34')]));_0x6158a2[_0xe651('0x33')]=_0x6158a2[_0xe651('0x33')]['length']?_0x6158a2[_0xe651('0x33')]:_0x53c245[_0xe651('0x2e')];if(!_0x4d3444[_0xe651('0x2f')][_0xe651('0x35')]('nolimit')){_0x6158a2[_0xe651('0x1a')]=qs[_0xe651('0x1a')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x1a')]);_0x6158a2['offset']=qs[_0xe651('0x18')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x18')]);}_0x6158a2[_0xe651('0x36')]=qs[_0xe651('0x37')](_0x4d3444[_0xe651('0x2f')][_0xe651('0x37')]);_0x6158a2[_0xe651('0x38')]=qs['filters'](_[_0xe651('0x39')](_0x4d3444['query'],_0x53c245[_0xe651('0x31')]),_0x3957e9);if(_0x4d3444[_0xe651('0x2f')]['filter']){_0x6158a2[_0xe651('0x38')]=_[_0xe651('0x3a')](_0x6158a2[_0xe651('0x38')],{'$or':_[_0xe651('0x28')](_0x3957e9,function(_0x16cb7a){if(_0x16cb7a[_0xe651('0x2c')]!=='VIRTUAL'){var _0x4dfb11={};_0x4dfb11[_0x16cb7a[_0xe651('0x26')]]={'$like':'%'+_0x4d3444['query'][_0xe651('0x3b')]+'%'};return _0x4dfb11;}})});}_0x6158a2=_[_0xe651('0x3a')]({},_0x6158a2,_0x4d3444[_0xe651('0x3c')]);var _0x5b3406={'where':_0x6158a2[_0xe651('0x38')]};return db[_0xe651('0x29')]['count'](_0x5b3406)[_0xe651('0x1f')](function(_0x1739b1){_0x3efd6c[_0xe651('0x1b')]=_0x1739b1;if(_0x4d3444['query'][_0xe651('0x3d')]){_0x6158a2[_0xe651('0x3e')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xe651('0x3f')](_0x6158a2);})[_0xe651('0x1f')](function(_0x1d0138){_0x3efd6c[_0xe651('0x40')]=_0x1d0138;return _0x3efd6c;})['then'](respondWithFilteredResult(_0x3ba6c4,_0x6158a2))[_0xe651('0x41')](handleError(_0x3ba6c4,null));};exports[_0xe651('0x42')]=function(_0x9a666d,_0x4d9d9c){var _0x1c31e0={'raw':!![],'where':{'id':_0x9a666d['params']['id']}},_0x142f49={};_0x142f49[_0xe651('0x2e')]=_['keys'](db[_0xe651('0x29')]['rawAttributes']);_0x142f49['query']=_[_0xe651('0x30')](_0x9a666d[_0xe651('0x2f')]);_0x142f49[_0xe651('0x31')]=_[_0xe651('0x32')](_0x142f49[_0xe651('0x2e')],_0x142f49[_0xe651('0x2f')]);_0x1c31e0[_0xe651('0x33')]=_[_0xe651('0x32')](_0x142f49[_0xe651('0x2e')],qs[_0xe651('0x34')](_0x9a666d[_0xe651('0x2f')][_0xe651('0x34')]));_0x1c31e0[_0xe651('0x33')]=_0x1c31e0[_0xe651('0x33')][_0xe651('0x43')]?_0x1c31e0[_0xe651('0x33')]:_0x142f49[_0xe651('0x2e')];if(_0x9a666d[_0xe651('0x2f')]['includeAll']){_0x1c31e0[_0xe651('0x3e')]=[{'all':!![]}];}_0x1c31e0=_[_0xe651('0x3a')]({},_0x1c31e0,_0x9a666d[_0xe651('0x3c')]);return db[_0xe651('0x29')]['find'](_0x1c31e0)['then'](handleEntityNotFound(_0x4d9d9c,null))[_0xe651('0x1f')](respondWithResult(_0x4d9d9c,null))[_0xe651('0x41')](handleError(_0x4d9d9c,null));};exports['create']=function(_0x2df465,_0x11ea2a){return db['AnalyticExtractedReport'][_0xe651('0x44')](_0x2df465[_0xe651('0x45')],{})[_0xe651('0x1f')](function(_0x13457f){var _0x5d5d61=_0x2df465[_0xe651('0x46')][_0xe651('0x20')]({'plain':!![]});if(!_0x5d5d61)throw new Error(_0xe651('0x47'));if(_0x5d5d61[_0xe651('0x48')]===_0xe651('0x46')){var _0x74e84b=_0x13457f['get']({'plain':!![]});var _0x287d70=_0xe651('0x21');return db[_0xe651('0x49')][_0xe651('0x4a')]({'where':{'name':_0x287d70,'userProfileId':_0x5d5d61[_0xe651('0x4b')]},'raw':!![]})[_0xe651('0x1f')](function(_0x3d19db){if(_0x3d19db&&_0x3d19db[_0xe651('0x4c')]===0x0){return db[_0xe651('0x4d')]['create']({'name':_0x74e84b['name'],'resourceId':_0x74e84b['id'],'type':_0x3d19db['name'],'sectionId':_0x3d19db['id']},{})[_0xe651('0x1f')](function(){return _0x13457f;});}else{return _0x13457f;}})[_0xe651('0x41')](function(_0x590682){logger[_0xe651('0x24')](_0xe651('0x4e'),_0x590682);throw _0x590682;});}return _0x13457f;})[_0xe651('0x1f')](respondWithResult(_0x11ea2a,0xc9))[_0xe651('0x41')](handleError(_0x11ea2a,null));};exports[_0xe651('0x1e')]=function(_0x121d88,_0x495378){if(_0x121d88['body']['id']){delete _0x121d88[_0xe651('0x45')]['id'];}return db[_0xe651('0x29')]['find']({'where':{'id':_0x121d88[_0xe651('0x4f')]['id']}})[_0xe651('0x1f')](handleEntityNotFound(_0x495378,null))[_0xe651('0x1f')](saveUpdates(_0x121d88[_0xe651('0x45')],null))[_0xe651('0x1f')](respondWithResult(_0x495378,null))[_0xe651('0x41')](handleError(_0x495378,null));};exports[_0xe651('0x22')]=function(_0x564071,_0x2c66bc){return db[_0xe651('0x29')][_0xe651('0x4a')]({'where':{'id':_0x564071[_0xe651('0x4f')]['id']}})[_0xe651('0x1f')](handleEntityNotFound(_0x2c66bc,null))['then'](removeEntity(_0x2c66bc,null))[_0xe651('0x41')](handleError(_0x2c66bc,null));};exports[_0xe651('0x50')]=function(_0x480319,_0x77073a,_0x50e95f){return db[_0xe651('0x29')][_0xe651('0x4a')]({'where':{'id':_0x480319[_0xe651('0x4f')]['id']},'attributes':[_0xe651('0x26'),'basename',_0xe651('0x51'),_0xe651('0x52')],'raw':!![]})[_0xe651('0x1f')](handleEntityNotFound(_0x77073a,null))[_0xe651('0x1f')](function(_0x25ab12){if(_0x25ab12){if(!fs['existsSync'](path[_0xe651('0x53')](config['root'],_0xe651('0x54'),_0x25ab12[_0xe651('0x51')]))){throw new db[(_0xe651('0x55'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x480319['query'][_0xe651('0x56')]){return _0x77073a[_0xe651('0x23')](0xc8);}return _0x77073a[_0xe651('0x50')](path[_0xe651('0x53')](config['root'],_0xe651('0x54'),_0x25ab12['savename']),util[_0xe651('0x57')](_0xe651('0x58'),_0x25ab12[_0xe651('0x59')]||_0x25ab12[_0xe651('0x26')],_0x25ab12['output'][_0xe651('0x5a')]()));}})['catch'](handleError(_0x77073a,null));}; \ No newline at end of file +var _0xae69=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','get','ExtractedReports','destroy','then','end','error','stack','name','map','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','rows','catch','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','existsSync','join','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','root','server/files/reports','format','%s.%s','toLowerCase','eml-format','zip-dir','request-promise','moment','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae69,0x163));var _0x9ae6=function(_0x1203aa,_0x5af115){_0x1203aa=_0x1203aa-0x0;var _0x1dfb77=_0xae69[_0x1203aa];return _0x1dfb77;};'use strict';var emlformat=require(_0x9ae6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ae6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ae6('0x2'));var moment=require(_0x9ae6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ae6('0x4'));var path=require(_0x9ae6('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ae6('0x6'));var fs=require('fs');var fs_extra=require(_0x9ae6('0x7'));var _=require(_0x9ae6('0x8'));var squel=require('squel');var crypto=require(_0x9ae6('0x9'));var jsforce=require(_0x9ae6('0xa'));var deskjs=require(_0x9ae6('0xb'));var toCsv=require(_0x9ae6('0xc'));var querystring=require(_0x9ae6('0xd'));var Papa=require('papaparse');var Redis=require(_0x9ae6('0xe'));var authService=require(_0x9ae6('0xf'));var qs=require(_0x9ae6('0x10'));var as=require(_0x9ae6('0x11'));var hardwareService=require(_0x9ae6('0x12'));var logger=require(_0x9ae6('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x9ae6('0x14'));var licenseUtil=require(_0x9ae6('0x15'));var db=require(_0x9ae6('0x16'))['db'];function respondWithStatusCode(_0x2b81c6,_0x360ee3){_0x360ee3=_0x360ee3||0xcc;return function(_0x14b648){if(_0x14b648){return _0x2b81c6[_0x9ae6('0x17')](_0x360ee3);}return _0x2b81c6[_0x9ae6('0x18')](_0x360ee3)['end']();};}function respondWithResult(_0x50f287,_0xb165a9){_0xb165a9=_0xb165a9||0xc8;return function(_0x3b0704){if(_0x3b0704){return _0x50f287[_0x9ae6('0x18')](_0xb165a9)[_0x9ae6('0x19')](_0x3b0704);}};}function respondWithFilteredResult(_0x397378,_0x4f52db){return function(_0x5615b9){if(_0x5615b9){var _0x227de1=typeof _0x4f52db[_0x9ae6('0x1a')]==='undefined'&&typeof _0x4f52db[_0x9ae6('0x1b')]===_0x9ae6('0x1c');var _0x39dfe5=_0x5615b9[_0x9ae6('0x1d')];var _0x54c1a2=_0x227de1?0x0:_0x4f52db[_0x9ae6('0x1a')];var _0xee6a74=_0x227de1?_0x5615b9[_0x9ae6('0x1d')]:_0x4f52db[_0x9ae6('0x1a')]+_0x4f52db[_0x9ae6('0x1b')];var _0x16b712;if(_0xee6a74>=_0x39dfe5){_0xee6a74=_0x39dfe5;_0x16b712=0xc8;}else{_0x16b712=0xce;}_0x397378[_0x9ae6('0x18')](_0x16b712);return _0x397378[_0x9ae6('0x1e')](_0x9ae6('0x1f'),_0x54c1a2+'-'+_0xee6a74+'/'+_0x39dfe5)['json'](_0x5615b9);}return null;};}function patchUpdates(_0x3c1c73){return function(_0xb4c286){try{jsonpatch[_0x9ae6('0x20')](_0xb4c286,_0x3c1c73,!![]);}catch(_0x3b93ce){return BPromise[_0x9ae6('0x21')](_0x3b93ce);}return _0xb4c286[_0x9ae6('0x22')]();};}function saveUpdates(_0x5a0be6,_0x3919cf){return function(_0x49be68){if(_0x49be68){return _0x49be68[_0x9ae6('0x23')](_0x5a0be6)['then'](function(_0xd8089e){return _0xd8089e;});}return null;};}function removeEntity(_0x23e4de,_0xb9390b){return function(_0x3ba6d3){if(_0x3ba6d3){return _0x3ba6d3['destroy']()['then'](function(){var _0x12f08e=_0x3ba6d3[_0x9ae6('0x24')]({'plain':!![]});var _0x2b38c5=_0x9ae6('0x25');return db['UserProfileResource'][_0x9ae6('0x26')]({'where':{'type':_0x2b38c5,'resourceId':_0x12f08e['id']}})['then'](function(){return _0x3ba6d3;});})[_0x9ae6('0x27')](function(){_0x23e4de[_0x9ae6('0x18')](0xcc)[_0x9ae6('0x28')]();});}};}function handleEntityNotFound(_0x1cb6a9,_0x2f6cb2){return function(_0x328852){if(!_0x328852){_0x1cb6a9['sendStatus'](0x194);}return _0x328852;};}function handleError(_0x58ed94,_0x1e344c){_0x1e344c=_0x1e344c||0x1f4;return function(_0x13b691){logger[_0x9ae6('0x29')](_0x13b691[_0x9ae6('0x2a')]);if(_0x13b691[_0x9ae6('0x2b')]){delete _0x13b691[_0x9ae6('0x2b')];}_0x58ed94[_0x9ae6('0x18')](_0x1e344c)['send'](_0x13b691);};}exports['index']=function(_0x531c4b,_0x47b298){var _0x13ae9d={},_0x66d787={},_0x364f48={'count':0x0,'rows':[]};var _0x331e0c=_[_0x9ae6('0x2c')](db['AnalyticExtractedReport'][_0x9ae6('0x2d')],function(_0x20a671){return{'name':_0x20a671['fieldName'],'type':_0x20a671['type']['key']};});_0x66d787[_0x9ae6('0x2e')]=_[_0x9ae6('0x2c')](_0x331e0c,_0x9ae6('0x2b'));_0x66d787[_0x9ae6('0x2f')]=_['keys'](_0x531c4b['query']);_0x66d787[_0x9ae6('0x30')]=_['intersection'](_0x66d787[_0x9ae6('0x2e')],_0x66d787['query']);_0x13ae9d[_0x9ae6('0x31')]=_[_0x9ae6('0x32')](_0x66d787['model'],qs[_0x9ae6('0x33')](_0x531c4b[_0x9ae6('0x2f')][_0x9ae6('0x33')]));_0x13ae9d[_0x9ae6('0x31')]=_0x13ae9d[_0x9ae6('0x31')][_0x9ae6('0x34')]?_0x13ae9d['attributes']:_0x66d787[_0x9ae6('0x2e')];if(!_0x531c4b[_0x9ae6('0x2f')][_0x9ae6('0x35')](_0x9ae6('0x36'))){_0x13ae9d[_0x9ae6('0x1b')]=qs[_0x9ae6('0x1b')](_0x531c4b['query']['limit']);_0x13ae9d['offset']=qs[_0x9ae6('0x1a')](_0x531c4b[_0x9ae6('0x2f')][_0x9ae6('0x1a')]);}_0x13ae9d['order']=qs[_0x9ae6('0x37')](_0x531c4b[_0x9ae6('0x2f')]['sort']);_0x13ae9d[_0x9ae6('0x38')]=qs['filters'](_[_0x9ae6('0x39')](_0x531c4b[_0x9ae6('0x2f')],_0x66d787[_0x9ae6('0x30')]),_0x331e0c);if(_0x531c4b[_0x9ae6('0x2f')][_0x9ae6('0x3a')]){_0x13ae9d[_0x9ae6('0x38')]=_[_0x9ae6('0x3b')](_0x13ae9d[_0x9ae6('0x38')],{'$or':_[_0x9ae6('0x2c')](_0x331e0c,function(_0x3e2474){if(_0x3e2474[_0x9ae6('0x3c')]!==_0x9ae6('0x3d')){var _0x16a690={};_0x16a690[_0x3e2474[_0x9ae6('0x2b')]]={'$like':'%'+_0x531c4b['query'][_0x9ae6('0x3a')]+'%'};return _0x16a690;}})});}_0x13ae9d=_[_0x9ae6('0x3b')]({},_0x13ae9d,_0x531c4b[_0x9ae6('0x3e')]);var _0x2a450b={'where':_0x13ae9d[_0x9ae6('0x38')]};return db[_0x9ae6('0x3f')][_0x9ae6('0x1d')](_0x2a450b)['then'](function(_0x2cd0e9){_0x364f48[_0x9ae6('0x1d')]=_0x2cd0e9;if(_0x531c4b[_0x9ae6('0x2f')][_0x9ae6('0x40')]){_0x13ae9d[_0x9ae6('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x13ae9d);})[_0x9ae6('0x27')](function(_0x321027){_0x364f48[_0x9ae6('0x42')]=_0x321027;return _0x364f48;})[_0x9ae6('0x27')](respondWithFilteredResult(_0x47b298,_0x13ae9d))[_0x9ae6('0x43')](handleError(_0x47b298,null));};exports['show']=function(_0x3d861,_0x54a46b){var _0x26f54a={'raw':!![],'where':{'id':_0x3d861[_0x9ae6('0x44')]['id']}},_0x2d8ac1={};_0x2d8ac1['model']=_['keys'](db['AnalyticExtractedReport'][_0x9ae6('0x2d')]);_0x2d8ac1[_0x9ae6('0x2f')]=_[_0x9ae6('0x45')](_0x3d861[_0x9ae6('0x2f')]);_0x2d8ac1[_0x9ae6('0x30')]=_[_0x9ae6('0x32')](_0x2d8ac1[_0x9ae6('0x2e')],_0x2d8ac1[_0x9ae6('0x2f')]);_0x26f54a[_0x9ae6('0x31')]=_['intersection'](_0x2d8ac1[_0x9ae6('0x2e')],qs[_0x9ae6('0x33')](_0x3d861[_0x9ae6('0x2f')][_0x9ae6('0x33')]));_0x26f54a[_0x9ae6('0x31')]=_0x26f54a[_0x9ae6('0x31')]['length']?_0x26f54a[_0x9ae6('0x31')]:_0x2d8ac1['model'];if(_0x3d861[_0x9ae6('0x2f')][_0x9ae6('0x40')]){_0x26f54a['include']=[{'all':!![]}];}_0x26f54a=_[_0x9ae6('0x3b')]({},_0x26f54a,_0x3d861[_0x9ae6('0x3e')]);return db[_0x9ae6('0x3f')][_0x9ae6('0x46')](_0x26f54a)[_0x9ae6('0x27')](handleEntityNotFound(_0x54a46b,null))[_0x9ae6('0x27')](respondWithResult(_0x54a46b,null))[_0x9ae6('0x43')](handleError(_0x54a46b,null));};exports[_0x9ae6('0x47')]=function(_0x311e7f,_0x268cd0){return db[_0x9ae6('0x3f')]['create'](_0x311e7f['body'],{})[_0x9ae6('0x27')](function(_0x325fd9){var _0x1dcaa6=_0x311e7f['user'][_0x9ae6('0x24')]({'plain':!![]});if(!_0x1dcaa6)throw new Error(_0x9ae6('0x48'));if(_0x1dcaa6['role']===_0x9ae6('0x49')){var _0x2d1e09=_0x325fd9['get']({'plain':!![]});var _0x147e57=_0x9ae6('0x25');return db[_0x9ae6('0x4a')][_0x9ae6('0x46')]({'where':{'name':_0x147e57,'userProfileId':_0x1dcaa6[_0x9ae6('0x4b')]},'raw':!![]})[_0x9ae6('0x27')](function(_0x4f7bbe){if(_0x4f7bbe&&_0x4f7bbe[_0x9ae6('0x4c')]===0x0){return db[_0x9ae6('0x4d')]['create']({'name':_0x2d1e09[_0x9ae6('0x2b')],'resourceId':_0x2d1e09['id'],'type':_0x4f7bbe[_0x9ae6('0x2b')],'sectionId':_0x4f7bbe['id']},{})['then'](function(){return _0x325fd9;});}else{return _0x325fd9;}})['catch'](function(_0x4c4292){logger['error'](_0x9ae6('0x4e'),_0x4c4292);throw _0x4c4292;});}return _0x325fd9;})[_0x9ae6('0x27')](respondWithResult(_0x268cd0,0xc9))[_0x9ae6('0x43')](handleError(_0x268cd0,null));};exports[_0x9ae6('0x23')]=function(_0x5ad69c,_0x24467c){if(_0x5ad69c['body']['id']){delete _0x5ad69c[_0x9ae6('0x4f')]['id'];}return db['AnalyticExtractedReport'][_0x9ae6('0x46')]({'where':{'id':_0x5ad69c[_0x9ae6('0x44')]['id']}})['then'](handleEntityNotFound(_0x24467c,null))[_0x9ae6('0x27')](saveUpdates(_0x5ad69c['body'],null))['then'](respondWithResult(_0x24467c,null))[_0x9ae6('0x43')](handleError(_0x24467c,null));};exports[_0x9ae6('0x26')]=function(_0x53fd6c,_0x311950){return db['AnalyticExtractedReport'][_0x9ae6('0x46')]({'where':{'id':_0x53fd6c['params']['id']}})[_0x9ae6('0x27')](handleEntityNotFound(_0x311950,null))[_0x9ae6('0x27')](removeEntity(_0x311950,null))['catch'](handleError(_0x311950,null));};exports['download']=function(_0x290b96,_0x19268b,_0x4db6c4){return db[_0x9ae6('0x3f')][_0x9ae6('0x46')]({'where':{'id':_0x290b96[_0x9ae6('0x44')]['id']},'attributes':[_0x9ae6('0x2b'),_0x9ae6('0x50'),_0x9ae6('0x51'),_0x9ae6('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x19268b,null))[_0x9ae6('0x27')](function(_0xd99bf3){if(_0xd99bf3){if(!fs[_0x9ae6('0x53')](path[_0x9ae6('0x54')](config['root'],'server/files/reports',_0xd99bf3[_0x9ae6('0x51')]))){throw new db[(_0x9ae6('0x55'))]['ValidationError'](_0x9ae6('0x56'));}if(_0x290b96[_0x9ae6('0x2f')][_0x9ae6('0x57')]){return _0x19268b['sendStatus'](0xc8);}return _0x19268b['download'](path[_0x9ae6('0x54')](config[_0x9ae6('0x58')],_0x9ae6('0x59'),_0xd99bf3[_0x9ae6('0x51')]),util[_0x9ae6('0x5a')](_0x9ae6('0x5b'),_0xd99bf3[_0x9ae6('0x50')]||_0xd99bf3[_0x9ae6('0x2b')],_0xd99bf3[_0x9ae6('0x52')][_0x9ae6('0x5c')]()));}})['catch'](handleError(_0x19268b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5e925d6..c7fee2b 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 _0xcdd7=['define','analytics_extracted_reports','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5a8d63,_0x18ea42){var _0x161a1a=function(_0x1850ac){while(--_0x1850ac){_0x5a8d63['push'](_0x5a8d63['shift']());}};_0x161a1a(++_0x18ea42);}(_0xcdd7,0x1db));var _0x7cdd=function(_0xeedcc,_0x59fff8){_0xeedcc=_0xeedcc-0x0;var _0x4d5c35=_0xcdd7[_0xeedcc];return _0x4d5c35;};'use strict';var _=require(_0x7cdd('0x0'));var util=require('util');var logger=require(_0x7cdd('0x1'))(_0x7cdd('0x2'));var moment=require(_0x7cdd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cdd('0x4'));var fs=require('fs');var path=require(_0x7cdd('0x5'));var rimraf=require(_0x7cdd('0x6'));var config=require(_0x7cdd('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x7cdd('0x8')]=function(_0x1343a4,_0x2d5f45){return _0x1343a4[_0x7cdd('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x7cdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf64=['define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x2c98ee,_0x41039a){var _0x37deef=function(_0x3c1e68){while(--_0x3c1e68){_0x2c98ee['push'](_0x2c98ee['shift']());}};_0x37deef(++_0x41039a);}(_0xcf64,0x1e7));var _0x4cf6=function(_0x34102d,_0x5d2401){_0x34102d=_0x34102d-0x0;var _0x47635d=_0xcf64[_0x34102d];return _0x47635d;};'use strict';var _=require('lodash');var util=require(_0x4cf6('0x0'));var logger=require(_0x4cf6('0x1'))(_0x4cf6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cf6('0x3'));var rimraf=require(_0x4cf6('0x4'));var config=require(_0x4cf6('0x5'));var attributes=require(_0x4cf6('0x6'));module[_0x4cf6('0x7')]=function(_0x36668e,_0x46e003){return _0x36668e[_0x4cf6('0x8')](_0x4cf6('0x9'),attributes,{'tableName':_0x4cf6('0xa'),'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 ce9e46f..649cae9 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 _0x9e47=['client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5ebf3e,_0x476696){var _0x40f180=function(_0x59b9cc){while(--_0x59b9cc){_0x5ebf3e['push'](_0x5ebf3e['shift']());}};_0x40f180(++_0x476696);}(_0x9e47,0xe7));var _0x79e4=function(_0x364050,_0x3270b7){_0x364050=_0x364050-0x0;var _0x368337=_0x9e47[_0x364050];return _0x368337;};'use strict';var _=require(_0x79e4('0x0'));var util=require(_0x79e4('0x1'));var moment=require(_0x79e4('0x2'));var BPromise=require(_0x79e4('0x3'));var rs=require(_0x79e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x79e4('0x5'));var logger=require(_0x79e4('0x6'))('rpc');var config=require(_0x79e4('0x7'));var jayson=require(_0x79e4('0x8'));var client=jayson[_0x79e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229bd5,_0x3dca7b,_0x356327){return new BPromise(function(_0x563474,_0x3eecf4){return client[_0x79e4('0xa')](_0x229bd5,_0x356327)[_0x79e4('0xb')](function(_0x4c3ea5){logger[_0x79e4('0xc')](_0x79e4('0xd'),_0x3dca7b,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3dca7b,_0x79e4('0xe'),JSON[_0x79e4('0xf')](_0x4c3ea5));if(_0x4c3ea5[_0x79e4('0x10')]){if(_0x4c3ea5['error']['code']===0x1f4){logger[_0x79e4('0x10')](_0x79e4('0xd'),_0x3dca7b,_0x4c3ea5[_0x79e4('0x10')][_0x79e4('0x11')]);return _0x3eecf4(_0x4c3ea5[_0x79e4('0x10')][_0x79e4('0x11')]);}logger['error'](_0x79e4('0xd'),_0x3dca7b,_0x4c3ea5['error'][_0x79e4('0x11')]);return _0x563474(_0x4c3ea5[_0x79e4('0x10')][_0x79e4('0x11')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3dca7b,'request\x20sent');_0x563474(_0x4c3ea5[_0x79e4('0x12')][_0x79e4('0x11')]);}})[_0x79e4('0x13')](function(_0x588c7b){logger['error'](_0x79e4('0xd'),_0x3dca7b,_0x588c7b);_0x3eecf4(_0x588c7b);});});} \ No newline at end of file +var _0x9b89=['jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x303a14,_0x464873){var _0x47ee14=function(_0x1629d0){while(--_0x1629d0){_0x303a14['push'](_0x303a14['shift']());}};_0x47ee14(++_0x464873);}(_0x9b89,0x17d));var _0x99b8=function(_0x4ea906,_0x3b19be){_0x4ea906=_0x4ea906-0x0;var _0x150c3f=_0x9b89[_0x4ea906];return _0x150c3f;};'use strict';var _=require(_0x99b8('0x0'));var util=require(_0x99b8('0x1'));var moment=require(_0x99b8('0x2'));var BPromise=require(_0x99b8('0x3'));var rs=require(_0x99b8('0x4'));var fs=require('fs');var Redis=require(_0x99b8('0x5'));var db=require(_0x99b8('0x6'))['db'];var utils=require(_0x99b8('0x7'));var logger=require('../../config/logger')(_0x99b8('0x8'));var config=require(_0x99b8('0x9'));var jayson=require(_0x99b8('0xa'));var client=jayson[_0x99b8('0xb')][_0x99b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4beb64,_0x351439,_0x56cbd6){return new BPromise(function(_0x14c7e7,_0x2ad940){return client[_0x99b8('0xd')](_0x4beb64,_0x56cbd6)['then'](function(_0x127782){logger['info'](_0x99b8('0xe'),_0x351439,_0x99b8('0xf'));logger['debug'](_0x99b8('0x10'),_0x351439,_0x99b8('0xf'),JSON[_0x99b8('0x11')](_0x127782));if(_0x127782[_0x99b8('0x12')]){if(_0x127782[_0x99b8('0x12')][_0x99b8('0x13')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x351439,_0x127782[_0x99b8('0x12')][_0x99b8('0x14')]);return _0x2ad940(_0x127782[_0x99b8('0x12')][_0x99b8('0x14')]);}logger['error'](_0x99b8('0xe'),_0x351439,_0x127782['error']['message']);return _0x14c7e7(_0x127782[_0x99b8('0x12')][_0x99b8('0x14')]);}else{logger[_0x99b8('0x15')](_0x99b8('0xe'),_0x351439,_0x99b8('0xf'));_0x14c7e7(_0x127782['result']['message']);}})[_0x99b8('0x16')](function(_0x45d7de){logger[_0x99b8('0x12')](_0x99b8('0xe'),_0x351439,_0x45d7de);_0x2ad940(_0x45d7de);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e5d5364..81313de 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 _0x377f=['isAuthenticated','index','/:id','/:id/download','download','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x58a049,_0x1e9ab2){var _0x4d7aca=function(_0x162ff5){while(--_0x162ff5){_0x58a049['push'](_0x58a049['shift']());}};_0x4d7aca(++_0x1e9ab2);}(_0x377f,0x144));var _0xf377=function(_0x1659c1,_0x24882f){_0x1659c1=_0x1659c1-0x0;var _0xaefe5a=_0x377f[_0x1659c1];return _0xaefe5a;};'use strict';var multer=require(_0xf377('0x0'));var util=require(_0xf377('0x1'));var path=require(_0xf377('0x2'));var timeout=require(_0xf377('0x3'));var express=require(_0xf377('0x4'));var router=express[_0xf377('0x5')]();var fs_extra=require(_0xf377('0x6'));var auth=require(_0xf377('0x7'));var interaction=require(_0xf377('0x8'));var config=require(_0xf377('0x9'));var controller=require(_0xf377('0xa'));router[_0xf377('0xb')]('/',auth[_0xf377('0xc')](),controller[_0xf377('0xd')]);router[_0xf377('0xb')](_0xf377('0xe'),auth[_0xf377('0xc')](),controller['show']);router['get'](_0xf377('0xf'),auth[_0xf377('0xc')](),controller[_0xf377('0x10')]);router[_0xf377('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf377('0xe'),auth[_0xf377('0xc')](),controller[_0xf377('0x12')]);router[_0xf377('0x13')](_0xf377('0xe'),auth[_0xf377('0xc')](),controller[_0xf377('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1f14=['isAuthenticated','index','/:id','show','download','post','create','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x1f14,0x104));var _0x41f1=function(_0x1d2ff6,_0x3828db){_0x1d2ff6=_0x1d2ff6-0x0;var _0x52651e=_0x1f14[_0x1d2ff6];return _0x52651e;};'use strict';var multer=require(_0x41f1('0x0'));var util=require(_0x41f1('0x1'));var path=require('path');var timeout=require(_0x41f1('0x2'));var express=require(_0x41f1('0x3'));var router=express['Router']();var fs_extra=require(_0x41f1('0x4'));var auth=require(_0x41f1('0x5'));var interaction=require(_0x41f1('0x6'));var config=require(_0x41f1('0x7'));var controller=require(_0x41f1('0x8'));router[_0x41f1('0x9')]('/',auth[_0x41f1('0xa')](),controller[_0x41f1('0xb')]);router['get'](_0x41f1('0xc'),auth[_0x41f1('0xa')](),controller[_0x41f1('0xd')]);router[_0x41f1('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x41f1('0xe')]);router[_0x41f1('0xf')]('/',auth[_0x41f1('0xa')](),controller[_0x41f1('0x10')]);router['put']('/:id',auth[_0x41f1('0xa')](),controller['update']);router['delete'](_0x41f1('0xc'),auth[_0x41f1('0xa')](),controller['destroy']);module[_0x41f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index dc5fb25..a9643e2 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 _0x68e7=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x5cfe74,_0x26fcf1){var _0x4751e7=function(_0x2a7898){while(--_0x2a7898){_0x5cfe74['push'](_0x5cfe74['shift']());}};_0x4751e7(++_0x26fcf1);}(_0x68e7,0xdb));var _0x768e=function(_0x4401ef,_0x221a30){_0x4401ef=_0x4401ef-0x0;var _0x2326d8=_0x68e7[_0x4401ef];return _0x2326d8;};'use strict';var Sequelize=require(_0x768e('0x0'));module[_0x768e('0x1')]={'field':{'type':Sequelize[_0x768e('0x2')]},'alias':{'type':Sequelize[_0x768e('0x3')]},'function':{'type':Sequelize[_0x768e('0x3')]},'format':{'type':Sequelize[_0x768e('0x3')]},'groupBy':{'type':Sequelize[_0x768e('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x768e('0x3')]},'custom':{'type':Sequelize[_0x768e('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc259=['TEXT','STRING','BOOLEAN','exports'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xc259,0x7b));var _0x9c25=function(_0x420c28,_0x56f6c0){_0x420c28=_0x420c28-0x0;var _0x307b8=_0xc259[_0x420c28];return _0x307b8;};'use strict';var Sequelize=require('sequelize');module[_0x9c25('0x0')]={'field':{'type':Sequelize[_0x9c25('0x1')]},'alias':{'type':Sequelize[_0x9c25('0x2')]},'function':{'type':Sequelize[_0x9c25('0x2')]},'format':{'type':Sequelize[_0x9c25('0x2')]},'groupBy':{'type':Sequelize[_0x9c25('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9c25('0x2')]},'custom':{'type':Sequelize[_0x9c25('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b9d3284..a7e908d 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 _0xc1dc=['../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','AnalyticFieldReport','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','findAll','catch','show','length','find','create','body','bulkCreate','params','bulkDestroy','ids','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x6c8df2,_0x44145c){var _0x49c98e=function(_0x333686){while(--_0x333686){_0x6c8df2['push'](_0x6c8df2['shift']());}};_0x49c98e(++_0x44145c);}(_0xc1dc,0x15e));var _0xcc1d=function(_0xb6777d,_0x3d0666){_0xb6777d=_0xb6777d-0x0;var _0x2fcd17=_0xc1dc[_0xb6777d];return _0x2fcd17;};'use strict';var emlformat=require(_0xcc1d('0x0'));var rimraf=require(_0xcc1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc1d('0x3'));var util=require('util');var path=require(_0xcc1d('0x4'));var sox=require(_0xcc1d('0x5'));var csv=require(_0xcc1d('0x6'));var ejs=require(_0xcc1d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc1d('0x8'));var squel=require(_0xcc1d('0x9'));var crypto=require(_0xcc1d('0xa'));var jsforce=require(_0xcc1d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcc1d('0x6'));var querystring=require('querystring');var Papa=require(_0xcc1d('0xc'));var Redis=require(_0xcc1d('0xd'));var authService=require(_0xcc1d('0xe'));var qs=require(_0xcc1d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcc1d('0x10'));var config=require(_0xcc1d('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc1d('0x12'))['db'];function respondWithStatusCode(_0x4aba6f,_0x3ebdfb){_0x3ebdfb=_0x3ebdfb||0xcc;return function(_0x12a1c6){if(_0x12a1c6){return _0x4aba6f[_0xcc1d('0x13')](_0x3ebdfb);}return _0x4aba6f[_0xcc1d('0x14')](_0x3ebdfb)[_0xcc1d('0x15')]();};}function respondWithResult(_0x45e384,_0x467002){_0x467002=_0x467002||0xc8;return function(_0x34a1b5){if(_0x34a1b5){return _0x45e384[_0xcc1d('0x14')](_0x467002)[_0xcc1d('0x16')](_0x34a1b5);}};}function respondWithFilteredResult(_0x2cf49a,_0x512e16){return function(_0x5cb618){if(_0x5cb618){var _0x2b8330=typeof _0x512e16[_0xcc1d('0x17')]===_0xcc1d('0x18')&&typeof _0x512e16[_0xcc1d('0x19')]==='undefined';var _0x1eab16=_0x5cb618['count'];var _0x432458=_0x2b8330?0x0:_0x512e16['offset'];var _0x245181=_0x2b8330?_0x5cb618[_0xcc1d('0x1a')]:_0x512e16[_0xcc1d('0x17')]+_0x512e16[_0xcc1d('0x19')];var _0x4ec71f;if(_0x245181>=_0x1eab16){_0x245181=_0x1eab16;_0x4ec71f=0xc8;}else{_0x4ec71f=0xce;}_0x2cf49a[_0xcc1d('0x14')](_0x4ec71f);return _0x2cf49a['set'](_0xcc1d('0x1b'),_0x432458+'-'+_0x245181+'/'+_0x1eab16)['json'](_0x5cb618);}return null;};}function patchUpdates(_0x16931d){return function(_0xa669e9){try{jsonpatch[_0xcc1d('0x1c')](_0xa669e9,_0x16931d,!![]);}catch(_0x29c96b){return BPromise[_0xcc1d('0x1d')](_0x29c96b);}return _0xa669e9[_0xcc1d('0x1e')]();};}function saveUpdates(_0x334032,_0x11b6cd){return function(_0x424255){if(_0x424255){return _0x424255[_0xcc1d('0x1f')](_0x334032)['then'](function(_0x427bd7){return _0x427bd7;});}return null;};}function removeEntity(_0x54503a,_0x32cf01){return function(_0x4c7b41){if(_0x4c7b41){return _0x4c7b41[_0xcc1d('0x20')]()[_0xcc1d('0x21')](function(){_0x54503a['status'](0xcc)[_0xcc1d('0x15')]();});}};}function handleEntityNotFound(_0x4f7ab6,_0x1dac30){return function(_0x30d540){if(!_0x30d540){_0x4f7ab6[_0xcc1d('0x13')](0x194);}return _0x30d540;};}function handleError(_0x21e3f2,_0x49d1fc){_0x49d1fc=_0x49d1fc||0x1f4;return function(_0xce609b){logger[_0xcc1d('0x22')](_0xce609b[_0xcc1d('0x23')]);if(_0xce609b[_0xcc1d('0x24')]){delete _0xce609b['name'];}_0x21e3f2[_0xcc1d('0x14')](_0x49d1fc)['send'](_0xce609b);};}exports['index']=function(_0x447bb4,_0x54a379){var _0x4864f5={},_0x54a1d0={},_0x31bbf7={'count':0x0,'rows':[]};var _0x5954d1=_['map'](db[_0xcc1d('0x25')][_0xcc1d('0x26')],function(_0x56d7bc){return{'name':_0x56d7bc[_0xcc1d('0x27')],'type':_0x56d7bc[_0xcc1d('0x28')]['key']};});_0x54a1d0[_0xcc1d('0x29')]=_[_0xcc1d('0x2a')](_0x5954d1,_0xcc1d('0x24'));_0x54a1d0['query']=_[_0xcc1d('0x2b')](_0x447bb4['query']);_0x54a1d0[_0xcc1d('0x2c')]=_[_0xcc1d('0x2d')](_0x54a1d0[_0xcc1d('0x29')],_0x54a1d0[_0xcc1d('0x2e')]);_0x4864f5[_0xcc1d('0x2f')]=_['intersection'](_0x54a1d0['model'],qs[_0xcc1d('0x30')](_0x447bb4['query']['fields']));_0x4864f5[_0xcc1d('0x2f')]=_0x4864f5[_0xcc1d('0x2f')]['length']?_0x4864f5[_0xcc1d('0x2f')]:_0x54a1d0[_0xcc1d('0x29')];if(!_0x447bb4['query'][_0xcc1d('0x31')](_0xcc1d('0x32'))){_0x4864f5[_0xcc1d('0x19')]=qs[_0xcc1d('0x19')](_0x447bb4[_0xcc1d('0x2e')][_0xcc1d('0x19')]);_0x4864f5['offset']=qs[_0xcc1d('0x17')](_0x447bb4[_0xcc1d('0x2e')]['offset']);}_0x4864f5[_0xcc1d('0x33')]=qs['sort'](_0x447bb4[_0xcc1d('0x2e')][_0xcc1d('0x34')]);_0x4864f5['where']=qs['filters'](_[_0xcc1d('0x35')](_0x447bb4[_0xcc1d('0x2e')],_0x54a1d0[_0xcc1d('0x2c')]),_0x5954d1);if(_0x447bb4[_0xcc1d('0x2e')][_0xcc1d('0x36')]){_0x4864f5['where']=_['merge'](_0x4864f5['where'],{'$or':_[_0xcc1d('0x2a')](_0x5954d1,function(_0x55ffcf){if(_0x55ffcf[_0xcc1d('0x28')]!=='VIRTUAL'){var _0xa96342={};_0xa96342[_0x55ffcf[_0xcc1d('0x24')]]={'$like':'%'+_0x447bb4[_0xcc1d('0x2e')]['filter']+'%'};return _0xa96342;}})});}_0x4864f5=_[_0xcc1d('0x37')]({},_0x4864f5,_0x447bb4[_0xcc1d('0x38')]);var _0x1545c3={'where':_0x4864f5[_0xcc1d('0x39')]};return db[_0xcc1d('0x25')]['count'](_0x1545c3)[_0xcc1d('0x21')](function(_0x4fa34f){_0x31bbf7[_0xcc1d('0x1a')]=_0x4fa34f;if(_0x447bb4[_0xcc1d('0x2e')]['includeAll']){_0x4864f5['include']=[{'all':!![]}];}return db[_0xcc1d('0x25')][_0xcc1d('0x3a')](_0x4864f5);})[_0xcc1d('0x21')](function(_0x37c336){_0x31bbf7['rows']=_0x37c336;return _0x31bbf7;})[_0xcc1d('0x21')](respondWithFilteredResult(_0x54a379,_0x4864f5))[_0xcc1d('0x3b')](handleError(_0x54a379,null));};exports[_0xcc1d('0x3c')]=function(_0x2f9090,_0x467b78){var _0x40116f={'raw':![],'where':{'id':_0x2f9090['params']['id']}},_0x2705be={};_0x2705be[_0xcc1d('0x29')]=_[_0xcc1d('0x2b')](db[_0xcc1d('0x25')]['rawAttributes']);_0x2705be[_0xcc1d('0x2e')]=_[_0xcc1d('0x2b')](_0x2f9090[_0xcc1d('0x2e')]);_0x2705be[_0xcc1d('0x2c')]=_[_0xcc1d('0x2d')](_0x2705be[_0xcc1d('0x29')],_0x2705be[_0xcc1d('0x2e')]);_0x40116f[_0xcc1d('0x2f')]=_['intersection'](_0x2705be[_0xcc1d('0x29')],qs[_0xcc1d('0x30')](_0x2f9090[_0xcc1d('0x2e')][_0xcc1d('0x30')]));_0x40116f[_0xcc1d('0x2f')]=_0x40116f[_0xcc1d('0x2f')][_0xcc1d('0x3d')]?_0x40116f[_0xcc1d('0x2f')]:_0x2705be[_0xcc1d('0x29')];if(_0x2f9090['query']['includeAll']){_0x40116f['include']=[{'all':!![]}];}_0x40116f=_['merge']({},_0x40116f,_0x2f9090[_0xcc1d('0x38')]);return db[_0xcc1d('0x25')][_0xcc1d('0x3e')](_0x40116f)[_0xcc1d('0x21')](handleEntityNotFound(_0x467b78,null))[_0xcc1d('0x21')](respondWithResult(_0x467b78,null))[_0xcc1d('0x3b')](handleError(_0x467b78,null));};exports[_0xcc1d('0x3f')]=function(_0x4be22d,_0x295d98){return db[_0xcc1d('0x25')][_0xcc1d('0x3f')](_0x4be22d[_0xcc1d('0x40')],{})['then'](respondWithResult(_0x295d98,0xc9))[_0xcc1d('0x3b')](handleError(_0x295d98,null));};exports[_0xcc1d('0x41')]=function(_0x20be70,_0x3a559e){return db['AnalyticFieldReport'][_0xcc1d('0x41')](_0x20be70[_0xcc1d('0x40')],{'raw':![],'individualHooks':!![]})[_0xcc1d('0x21')](respondWithResult(_0x3a559e,0xc9))[_0xcc1d('0x3b')](handleError(_0x3a559e,null));};exports['update']=function(_0x148aac,_0x2020e8){if(_0x148aac[_0xcc1d('0x40')]['id']){delete _0x148aac[_0xcc1d('0x40')]['id'];}return db['AnalyticFieldReport'][_0xcc1d('0x3e')]({'where':{'id':_0x148aac[_0xcc1d('0x42')]['id']}})[_0xcc1d('0x21')](handleEntityNotFound(_0x2020e8,null))[_0xcc1d('0x21')](saveUpdates(_0x148aac[_0xcc1d('0x40')],null))[_0xcc1d('0x21')](respondWithResult(_0x2020e8,null))['catch'](handleError(_0x2020e8,null));};exports['destroy']=function(_0x308de0,_0x346ece){return db[_0xcc1d('0x25')]['find']({'where':{'id':_0x308de0[_0xcc1d('0x42')]['id']}})[_0xcc1d('0x21')](handleEntityNotFound(_0x346ece,null))[_0xcc1d('0x21')](removeEntity(_0x346ece,null))['catch'](handleError(_0x346ece,null));};exports[_0xcc1d('0x43')]=function(_0x1f8e7e,_0x5bafc6){return db['AnalyticFieldReport'][_0xcc1d('0x20')]({'where':{'id':_0x1f8e7e[_0xcc1d('0x2e')][_0xcc1d('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0xcc1d('0x21')](respondWithResult(_0x5bafc6,0xcc))[_0xcc1d('0x3b')](handleError(_0x5bafc6,null));};exports['addFields']=function(_0x25c455,_0x216b01,_0x5ec5dd){return db['AnalyticCustomReport'][_0xcc1d('0x45')]({'where':{'id':_0x25c455[_0xcc1d('0x42')]['id']}})['then'](handleEntityNotFound(_0x216b01,null))[_0xcc1d('0x21')](function(_0xa44b08){if(_0xa44b08){return db[_0xcc1d('0x46')][_0xcc1d('0x47')](function(_0x12102b){return db['AnalyticFieldReport'][_0xcc1d('0x20')]({'where':{'CustomReportId':_0x25c455[_0xcc1d('0x42')]['id']},'transaction':_0x12102b})[_0xcc1d('0x21')](function(_0x15cde1){var _0x374d21=_[_0xcc1d('0x2a')](_0x25c455[_0xcc1d('0x40')],function(_0x417ff9){delete _0x417ff9['id'];_0x417ff9[_0xcc1d('0x48')]=_0x25c455[_0xcc1d('0x42')]['id'];return _0x417ff9;});return db[_0xcc1d('0x25')]['bulkCreate'](_0x374d21,{'transaction':_0x12102b});});})['then'](function(){return db[_0xcc1d('0x25')]['findAll']({'where':{'CustomReportId':_0x25c455[_0xcc1d('0x42')]['id']}});});}})['then'](respondWithResult(_0x216b01,null))['catch'](handleError(_0x216b01,null));}; \ No newline at end of file +var _0x340f=['fast-json-patch','request-promise','moment','bluebird','path','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','json','offset','limit','undefined','count','status','Content-Range','save','update','destroy','then','sendStatus','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','keys','include','find','catch','create','bulkCreate','body','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf'];(function(_0x133b9f,_0x1ef2b9){var _0x56c5e5=function(_0x5105ac){while(--_0x5105ac){_0x133b9f['push'](_0x133b9f['shift']());}};_0x56c5e5(++_0x1ef2b9);}(_0x340f,0xe8));var _0xf340=function(_0x353583,_0x2463fe){_0x353583=_0x353583-0x0;var _0x4f1028=_0x340f[_0x353583];return _0x4f1028;};'use strict';var emlformat=require(_0xf340('0x0'));var rimraf=require(_0xf340('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf340('0x2'));var rp=require(_0xf340('0x3'));var moment=require(_0xf340('0x4'));var BPromise=require(_0xf340('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf340('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf340('0x7'));var _=require('lodash');var squel=require(_0xf340('0x8'));var crypto=require(_0xf340('0x9'));var jsforce=require(_0xf340('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf340('0xb'));var querystring=require('querystring');var Papa=require(_0xf340('0xc'));var Redis=require(_0xf340('0xd'));var authService=require(_0xf340('0xe'));var qs=require(_0xf340('0xf'));var as=require(_0xf340('0x10'));var hardwareService=require(_0xf340('0x11'));var logger=require(_0xf340('0x12'))(_0xf340('0x13'));var utils=require(_0xf340('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf340('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2dbe08,_0x357015){_0x357015=_0x357015||0xcc;return function(_0x5991c0){if(_0x5991c0){return _0x2dbe08['sendStatus'](_0x357015);}return _0x2dbe08['status'](_0x357015)[_0xf340('0x16')]();};}function respondWithResult(_0x5f244f,_0x529839){_0x529839=_0x529839||0xc8;return function(_0x5cce02){if(_0x5cce02){return _0x5f244f['status'](_0x529839)[_0xf340('0x17')](_0x5cce02);}};}function respondWithFilteredResult(_0x2ea757,_0x4e966e){return function(_0x452647){if(_0x452647){var _0x46c19e=typeof _0x4e966e[_0xf340('0x18')]==='undefined'&&typeof _0x4e966e[_0xf340('0x19')]===_0xf340('0x1a');var _0x53ba55=_0x452647[_0xf340('0x1b')];var _0x406834=_0x46c19e?0x0:_0x4e966e[_0xf340('0x18')];var _0x5be404=_0x46c19e?_0x452647[_0xf340('0x1b')]:_0x4e966e[_0xf340('0x18')]+_0x4e966e['limit'];var _0x43caed;if(_0x5be404>=_0x53ba55){_0x5be404=_0x53ba55;_0x43caed=0xc8;}else{_0x43caed=0xce;}_0x2ea757[_0xf340('0x1c')](_0x43caed);return _0x2ea757['set'](_0xf340('0x1d'),_0x406834+'-'+_0x5be404+'/'+_0x53ba55)[_0xf340('0x17')](_0x452647);}return null;};}function patchUpdates(_0x204be8){return function(_0x23770f){try{jsonpatch['apply'](_0x23770f,_0x204be8,!![]);}catch(_0x1b03cd){return BPromise['reject'](_0x1b03cd);}return _0x23770f[_0xf340('0x1e')]();};}function saveUpdates(_0xc50be5,_0x4fa7e3){return function(_0x489977){if(_0x489977){return _0x489977[_0xf340('0x1f')](_0xc50be5)['then'](function(_0x1ab763){return _0x1ab763;});}return null;};}function removeEntity(_0x7e97a8,_0x1e418a){return function(_0x487c99){if(_0x487c99){return _0x487c99[_0xf340('0x20')]()[_0xf340('0x21')](function(){_0x7e97a8[_0xf340('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4067a2,_0x1260fb){return function(_0xd0d9a4){if(!_0xd0d9a4){_0x4067a2[_0xf340('0x22')](0x194);}return _0xd0d9a4;};}function handleError(_0x2e184e,_0x354f32){_0x354f32=_0x354f32||0x1f4;return function(_0xcaa467){logger['error'](_0xcaa467[_0xf340('0x23')]);if(_0xcaa467[_0xf340('0x24')]){delete _0xcaa467[_0xf340('0x24')];}_0x2e184e['status'](_0x354f32)[_0xf340('0x25')](_0xcaa467);};}exports[_0xf340('0x26')]=function(_0xe0be3e,_0x19b7de){var _0x2253a4={},_0x5e07c1={},_0x51e8da={'count':0x0,'rows':[]};var _0x1f4b63=_['map'](db[_0xf340('0x27')][_0xf340('0x28')],function(_0x1a65e3){return{'name':_0x1a65e3[_0xf340('0x29')],'type':_0x1a65e3[_0xf340('0x2a')][_0xf340('0x2b')]};});_0x5e07c1['model']=_[_0xf340('0x2c')](_0x1f4b63,_0xf340('0x24'));_0x5e07c1[_0xf340('0x2d')]=_['keys'](_0xe0be3e['query']);_0x5e07c1[_0xf340('0x2e')]=_[_0xf340('0x2f')](_0x5e07c1[_0xf340('0x30')],_0x5e07c1[_0xf340('0x2d')]);_0x2253a4[_0xf340('0x31')]=_[_0xf340('0x2f')](_0x5e07c1[_0xf340('0x30')],qs[_0xf340('0x32')](_0xe0be3e[_0xf340('0x2d')][_0xf340('0x32')]));_0x2253a4[_0xf340('0x31')]=_0x2253a4[_0xf340('0x31')][_0xf340('0x33')]?_0x2253a4[_0xf340('0x31')]:_0x5e07c1[_0xf340('0x30')];if(!_0xe0be3e[_0xf340('0x2d')][_0xf340('0x34')](_0xf340('0x35'))){_0x2253a4[_0xf340('0x19')]=qs['limit'](_0xe0be3e['query']['limit']);_0x2253a4[_0xf340('0x18')]=qs[_0xf340('0x18')](_0xe0be3e[_0xf340('0x2d')][_0xf340('0x18')]);}_0x2253a4[_0xf340('0x36')]=qs[_0xf340('0x37')](_0xe0be3e[_0xf340('0x2d')][_0xf340('0x37')]);_0x2253a4[_0xf340('0x38')]=qs[_0xf340('0x2e')](_['pick'](_0xe0be3e['query'],_0x5e07c1[_0xf340('0x2e')]),_0x1f4b63);if(_0xe0be3e[_0xf340('0x2d')]['filter']){_0x2253a4[_0xf340('0x38')]=_['merge'](_0x2253a4[_0xf340('0x38')],{'$or':_[_0xf340('0x2c')](_0x1f4b63,function(_0x23867a){if(_0x23867a['type']!==_0xf340('0x39')){var _0x3a669a={};_0x3a669a[_0x23867a['name']]={'$like':'%'+_0xe0be3e[_0xf340('0x2d')]['filter']+'%'};return _0x3a669a;}})});}_0x2253a4=_[_0xf340('0x3a')]({},_0x2253a4,_0xe0be3e[_0xf340('0x3b')]);var _0x560188={'where':_0x2253a4['where']};return db[_0xf340('0x27')]['count'](_0x560188)[_0xf340('0x21')](function(_0x2e072b){_0x51e8da[_0xf340('0x1b')]=_0x2e072b;if(_0xe0be3e[_0xf340('0x2d')][_0xf340('0x3c')]){_0x2253a4['include']=[{'all':!![]}];}return db[_0xf340('0x27')][_0xf340('0x3d')](_0x2253a4);})[_0xf340('0x21')](function(_0x58ee8c){_0x51e8da[_0xf340('0x3e')]=_0x58ee8c;return _0x51e8da;})[_0xf340('0x21')](respondWithFilteredResult(_0x19b7de,_0x2253a4))['catch'](handleError(_0x19b7de,null));};exports['show']=function(_0x18922c,_0x5dc95f){var _0x32c2db={'raw':![],'where':{'id':_0x18922c['params']['id']}},_0x485475={};_0x485475[_0xf340('0x30')]=_[_0xf340('0x3f')](db[_0xf340('0x27')][_0xf340('0x28')]);_0x485475[_0xf340('0x2d')]=_[_0xf340('0x3f')](_0x18922c[_0xf340('0x2d')]);_0x485475[_0xf340('0x2e')]=_['intersection'](_0x485475[_0xf340('0x30')],_0x485475['query']);_0x32c2db[_0xf340('0x31')]=_['intersection'](_0x485475[_0xf340('0x30')],qs[_0xf340('0x32')](_0x18922c[_0xf340('0x2d')]['fields']));_0x32c2db[_0xf340('0x31')]=_0x32c2db[_0xf340('0x31')][_0xf340('0x33')]?_0x32c2db[_0xf340('0x31')]:_0x485475['model'];if(_0x18922c[_0xf340('0x2d')][_0xf340('0x3c')]){_0x32c2db[_0xf340('0x40')]=[{'all':!![]}];}_0x32c2db=_[_0xf340('0x3a')]({},_0x32c2db,_0x18922c[_0xf340('0x3b')]);return db[_0xf340('0x27')][_0xf340('0x41')](_0x32c2db)[_0xf340('0x21')](handleEntityNotFound(_0x5dc95f,null))[_0xf340('0x21')](respondWithResult(_0x5dc95f,null))[_0xf340('0x42')](handleError(_0x5dc95f,null));};exports[_0xf340('0x43')]=function(_0xa9421e,_0x353441){return db[_0xf340('0x27')][_0xf340('0x43')](_0xa9421e['body'],{})[_0xf340('0x21')](respondWithResult(_0x353441,0xc9))[_0xf340('0x42')](handleError(_0x353441,null));};exports['bulkCreate']=function(_0x58c9b0,_0x3e7d7b){return db['AnalyticFieldReport'][_0xf340('0x44')](_0x58c9b0['body'],{'raw':![],'individualHooks':!![]})[_0xf340('0x21')](respondWithResult(_0x3e7d7b,0xc9))[_0xf340('0x42')](handleError(_0x3e7d7b,null));};exports[_0xf340('0x1f')]=function(_0x4445d4,_0x5118b7){if(_0x4445d4[_0xf340('0x45')]['id']){delete _0x4445d4[_0xf340('0x45')]['id'];}return db[_0xf340('0x27')][_0xf340('0x41')]({'where':{'id':_0x4445d4[_0xf340('0x46')]['id']}})['then'](handleEntityNotFound(_0x5118b7,null))['then'](saveUpdates(_0x4445d4[_0xf340('0x45')],null))[_0xf340('0x21')](respondWithResult(_0x5118b7,null))['catch'](handleError(_0x5118b7,null));};exports[_0xf340('0x20')]=function(_0x28b1cc,_0x22481e){return db['AnalyticFieldReport'][_0xf340('0x41')]({'where':{'id':_0x28b1cc['params']['id']}})[_0xf340('0x21')](handleEntityNotFound(_0x22481e,null))[_0xf340('0x21')](removeEntity(_0x22481e,null))[_0xf340('0x42')](handleError(_0x22481e,null));};exports[_0xf340('0x47')]=function(_0x26236c,_0x53888f){return db[_0xf340('0x27')]['destroy']({'where':{'id':_0x26236c[_0xf340('0x2d')][_0xf340('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0xf340('0x21')](respondWithResult(_0x53888f,0xcc))[_0xf340('0x42')](handleError(_0x53888f,null));};exports[_0xf340('0x49')]=function(_0x132b4c,_0x3f82d3,_0x1265a9){return db[_0xf340('0x4a')][_0xf340('0x4b')]({'where':{'id':_0x132b4c[_0xf340('0x46')]['id']}})[_0xf340('0x21')](handleEntityNotFound(_0x3f82d3,null))[_0xf340('0x21')](function(_0x32b88b){if(_0x32b88b){return db['sequelize'][_0xf340('0x4c')](function(_0x337bce){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x132b4c[_0xf340('0x46')]['id']},'transaction':_0x337bce})[_0xf340('0x21')](function(_0x56d9f2){var _0x36f205=_[_0xf340('0x2c')](_0x132b4c[_0xf340('0x45')],function(_0x26e60c){delete _0x26e60c['id'];_0x26e60c[_0xf340('0x4d')]=_0x132b4c[_0xf340('0x46')]['id'];return _0x26e60c;});return db['AnalyticFieldReport'][_0xf340('0x44')](_0x36f205,{'transaction':_0x337bce});});})[_0xf340('0x21')](function(){return db[_0xf340('0x27')][_0xf340('0x3d')]({'where':{'CustomReportId':_0x132b4c[_0xf340('0x46')]['id']}});});}})[_0xf340('0x21')](respondWithResult(_0x3f82d3,null))['catch'](handleError(_0x3f82d3,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b1dca8e..188b800 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 _0x0295=['./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x342072,_0x50bf45){var _0x530822=function(_0x112a66){while(--_0x112a66){_0x342072['push'](_0x342072['shift']());}};_0x530822(++_0x50bf45);}(_0x0295,0xc9));var _0x5029=function(_0x33990e,_0x27b1f4){_0x33990e=_0x33990e-0x0;var _0x366423=_0x0295[_0x33990e];return _0x366423;};'use strict';var _=require(_0x5029('0x0'));var util=require(_0x5029('0x1'));var logger=require(_0x5029('0x2'))('api');var moment=require(_0x5029('0x3'));var BPromise=require(_0x5029('0x4'));var rp=require(_0x5029('0x5'));var fs=require('fs');var path=require(_0x5029('0x6'));var rimraf=require(_0x5029('0x7'));var config=require('../../config/environment');var attributes=require(_0x5029('0x8'));module['exports']=function(_0x56995c,_0x439891){return _0x56995c['define'](_0x5029('0x9'),attributes,{'tableName':_0x5029('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59f0=['request-promise','path','../../config/environment','exports','define','analytics_report_fields','lodash','util','api','moment'];(function(_0x4b56c4,_0xfb1534){var _0x531804=function(_0x4c4071){while(--_0x4c4071){_0x4b56c4['push'](_0x4b56c4['shift']());}};_0x531804(++_0xfb1534);}(_0x59f0,0xec));var _0x059f=function(_0x583fa3,_0x43cd55){_0x583fa3=_0x583fa3-0x0;var _0x501bb0=_0x59f0[_0x583fa3];return _0x501bb0;};'use strict';var _=require(_0x059f('0x0'));var util=require(_0x059f('0x1'));var logger=require('../../config/logger')(_0x059f('0x2'));var moment=require(_0x059f('0x3'));var BPromise=require('bluebird');var rp=require(_0x059f('0x4'));var fs=require('fs');var path=require(_0x059f('0x5'));var rimraf=require('rimraf');var config=require(_0x059f('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x059f('0x7')]=function(_0x45ec5a,_0x223bb2){return _0x45ec5a[_0x059f('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x059f('0x9'),'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 d559692..39eeb00 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 _0x3903=['request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0xf32485,_0x3f03e1){var _0x25af45=function(_0x18fac4){while(--_0x18fac4){_0xf32485['push'](_0xf32485['shift']());}};_0x25af45(++_0x3f03e1);}(_0x3903,0x181));var _0x3390=function(_0x14c180,_0x106d82){_0x14c180=_0x14c180-0x0;var _0x5aaf60=_0x3903[_0x14c180];return _0x5aaf60;};'use strict';var _=require(_0x3390('0x0'));var util=require(_0x3390('0x1'));var moment=require(_0x3390('0x2'));var BPromise=require(_0x3390('0x3'));var rs=require(_0x3390('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3390('0x5'))['db'];var utils=require(_0x3390('0x6'));var logger=require('../../config/logger')(_0x3390('0x7'));var config=require(_0x3390('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3390('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x332352,_0x2d4167,_0x5e37df){return new BPromise(function(_0x1ab8c8,_0x5205e8){return client[_0x3390('0xa')](_0x332352,_0x5e37df)[_0x3390('0xb')](function(_0x18d12e){logger[_0x3390('0xc')](_0x3390('0xd'),_0x2d4167,_0x3390('0xe'));logger['debug'](_0x3390('0xf'),_0x2d4167,_0x3390('0xe'),JSON[_0x3390('0x10')](_0x18d12e));if(_0x18d12e[_0x3390('0x11')]){if(_0x18d12e[_0x3390('0x11')]['code']===0x1f4){logger['error'](_0x3390('0xd'),_0x2d4167,_0x18d12e[_0x3390('0x11')][_0x3390('0x12')]);return _0x5205e8(_0x18d12e[_0x3390('0x11')][_0x3390('0x12')]);}logger['error'](_0x3390('0xd'),_0x2d4167,_0x18d12e[_0x3390('0x11')][_0x3390('0x12')]);return _0x1ab8c8(_0x18d12e['error'][_0x3390('0x12')]);}else{logger[_0x3390('0xc')](_0x3390('0xd'),_0x2d4167,'request\x20sent');_0x1ab8c8(_0x18d12e[_0x3390('0x13')][_0x3390('0x12')]);}})[_0x3390('0x14')](function(_0x37174c){logger[_0x3390('0x11')](_0x3390('0xd'),_0x2d4167,_0x37174c);_0x5205e8(_0x37174c);});});} \ No newline at end of file +var _0x0805=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x42da94,_0x337285){var _0x16344b=function(_0x3b93bd){while(--_0x3b93bd){_0x42da94['push'](_0x42da94['shift']());}};_0x16344b(++_0x337285);}(_0x0805,0x13c));var _0x5080=function(_0x2b326f,_0x102d26){_0x2b326f=_0x2b326f-0x0;var _0x1c46a6=_0x0805[_0x2b326f];return _0x1c46a6;};'use strict';var _=require(_0x5080('0x0'));var util=require(_0x5080('0x1'));var moment=require(_0x5080('0x2'));var BPromise=require(_0x5080('0x3'));var rs=require(_0x5080('0x4'));var fs=require('fs');var Redis=require(_0x5080('0x5'));var db=require(_0x5080('0x6'))['db'];var utils=require(_0x5080('0x7'));var logger=require('../../config/logger')(_0x5080('0x8'));var config=require(_0x5080('0x9'));var jayson=require(_0x5080('0xa'));var client=jayson[_0x5080('0xb')][_0x5080('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50eddf,_0x4f2c63,_0x4ce8d4){return new BPromise(function(_0xba6a59,_0x429c21){return client[_0x5080('0xd')](_0x50eddf,_0x4ce8d4)['then'](function(_0x18c6be){logger[_0x5080('0xe')](_0x5080('0xf'),_0x4f2c63,_0x5080('0x10'));logger[_0x5080('0x11')](_0x5080('0x12'),_0x4f2c63,_0x5080('0x10'),JSON[_0x5080('0x13')](_0x18c6be));if(_0x18c6be['error']){if(_0x18c6be[_0x5080('0x14')][_0x5080('0x15')]===0x1f4){logger[_0x5080('0x14')](_0x5080('0xf'),_0x4f2c63,_0x18c6be[_0x5080('0x14')][_0x5080('0x16')]);return _0x429c21(_0x18c6be[_0x5080('0x14')][_0x5080('0x16')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x4f2c63,_0x18c6be['error'][_0x5080('0x16')]);return _0xba6a59(_0x18c6be[_0x5080('0x14')][_0x5080('0x16')]);}else{logger[_0x5080('0xe')](_0x5080('0xf'),_0x4f2c63,'request\x20sent');_0xba6a59(_0x18c6be['result']['message']);}})['catch'](function(_0x4a9eb0){logger[_0x5080('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4f2c63,_0x4a9eb0);_0x429c21(_0x4a9eb0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e21645d..c9dce1f 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(_0x4b2ea3,_0x1c48a1){var _0x22cc58=function(_0x3afca6){while(--_0x3afca6){_0x4b2ea3['push'](_0x4b2ea3['shift']());}};_0x22cc58(++_0x1c48a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x4e2315,_0x417736){var _0x35a59f=function(_0x2de11b){while(--_0x2de11b){_0x4e2315['push'](_0x4e2315['shift']());}};_0x35a59f(++_0x417736);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 f4d77d2..b97f0da 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 _0xa900=['name','TEXT','sequelize','exports','STRING'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0xa900,0x101));var _0x0a90=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0xa900[_0xd13a88];return _0x1c993c;};'use strict';var Sequelize=require(_0x0a90('0x0'));module[_0x0a90('0x1')]={'name':{'type':Sequelize[_0x0a90('0x2')],'allowNull':![],'unique':_0x0a90('0x3')},'table':{'type':Sequelize[_0x0a90('0x2')]},'metric':{'type':Sequelize[_0x0a90('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa1b=['sequelize','exports','STRING'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xbaa1('0x0'));module[_0xbaa1('0x1')]={'name':{'type':Sequelize[_0xbaa1('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xbaa1('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xbaa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bb60081..cecc6f4 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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x35ded9,_0x415e45){var _0x626dbf=function(_0xa3c2c8){while(--_0xa3c2c8){_0x35ded9['push'](_0x35ded9['shift']());}};_0x626dbf(++_0x415e45);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2c095f,_0x2cf962){_0x2c095f=_0x2c095f-0x0;var _0x397c9e=_0xdc97[_0x2c095f];return _0x397c9e;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','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','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x4bd861,_0x41d6c4){var _0x23dad6=function(_0x23f60c){while(--_0x23f60c){_0x4bd861['push'](_0x4bd861['shift']());}};_0x23dad6(++_0x41d6c4);}(_0x7217,0x19e));var _0x7721=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x7217[_0x36dfbd];return _0x4ecad9;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 19c61af..22a5b95 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 _0xa1aa=['exports','define','AnalyticMetric','analytics_metrics','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0xede398,_0x552aff){var _0x5dd527=function(_0x59e8f0){while(--_0x59e8f0){_0xede398['push'](_0xede398['shift']());}};_0x5dd527(++_0x552aff);}(_0xa1aa,0x88));var _0xaa1a=function(_0x1deace,_0x161a28){_0x1deace=_0x1deace-0x0;var _0x10f183=_0xa1aa[_0x1deace];return _0x10f183;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa1a('0x0'))(_0xaa1a('0x1'));var moment=require(_0xaa1a('0x2'));var BPromise=require(_0xaa1a('0x3'));var rp=require(_0xaa1a('0x4'));var fs=require('fs');var path=require(_0xaa1a('0x5'));var rimraf=require(_0xaa1a('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa1a('0x7'));module[_0xaa1a('0x8')]=function(_0x4934e6,_0x3500c9){return _0x4934e6[_0xaa1a('0x9')](_0xaa1a('0xa'),attributes,{'tableName':_0xaa1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dc3=['request-promise','path','rimraf','exports','AnalyticMetric','util','../../config/logger','api','moment','bluebird'];(function(_0x2c8dd6,_0x3d86ca){var _0x55ffca=function(_0x452930){while(--_0x452930){_0x2c8dd6['push'](_0x2c8dd6['shift']());}};_0x55ffca(++_0x3d86ca);}(_0x2dc3,0x127));var _0x32dc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2dc3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x32dc('0x0'));var logger=require(_0x32dc('0x1'))(_0x32dc('0x2'));var moment=require(_0x32dc('0x3'));var BPromise=require(_0x32dc('0x4'));var rp=require(_0x32dc('0x5'));var fs=require('fs');var path=require(_0x32dc('0x6'));var rimraf=require(_0x32dc('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x32dc('0x8')]=function(_0x58b6ba,_0x1f59d3){return _0x58b6ba['define'](_0x32dc('0x9'),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 9a066f5..08192e7 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 _0x0660=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0xa4963e,_0x2ff8f1){var _0x309ee3=function(_0x460f97){while(--_0x460f97){_0xa4963e['push'](_0xa4963e['shift']());}};_0x309ee3(++_0x2ff8f1);}(_0x0660,0x17c));var _0x0066=function(_0x55c8de,_0xf1c57b){_0x55c8de=_0x55c8de-0x0;var _0x5dcd72=_0x0660[_0x55c8de];return _0x5dcd72;};'use strict';var _=require(_0x0066('0x0'));var util=require(_0x0066('0x1'));var moment=require(_0x0066('0x2'));var BPromise=require(_0x0066('0x3'));var rs=require(_0x0066('0x4'));var fs=require('fs');var Redis=require(_0x0066('0x5'));var db=require(_0x0066('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0066('0x7'))(_0x0066('0x8'));var config=require(_0x0066('0x9'));var jayson=require(_0x0066('0xa'));var client=jayson[_0x0066('0xb')][_0x0066('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc57993,_0xae18f0,_0x2333c9){return new BPromise(function(_0x1aba4f,_0x3c55cb){return client[_0x0066('0xd')](_0xc57993,_0x2333c9)[_0x0066('0xe')](function(_0x1bcc21){logger[_0x0066('0xf')](_0x0066('0x10'),_0xae18f0,'request\x20sent');logger[_0x0066('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xae18f0,_0x0066('0x12'),JSON[_0x0066('0x13')](_0x1bcc21));if(_0x1bcc21['error']){if(_0x1bcc21[_0x0066('0x14')][_0x0066('0x15')]===0x1f4){logger[_0x0066('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0xae18f0,_0x1bcc21[_0x0066('0x14')]['message']);return _0x3c55cb(_0x1bcc21[_0x0066('0x14')][_0x0066('0x16')]);}logger[_0x0066('0x14')](_0x0066('0x10'),_0xae18f0,_0x1bcc21[_0x0066('0x14')][_0x0066('0x16')]);return _0x1aba4f(_0x1bcc21[_0x0066('0x14')][_0x0066('0x16')]);}else{logger[_0x0066('0xf')](_0x0066('0x10'),_0xae18f0,_0x0066('0x12'));_0x1aba4f(_0x1bcc21[_0x0066('0x17')][_0x0066('0x16')]);}})[_0x0066('0x18')](function(_0x1d3ec2){logger[_0x0066('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0xae18f0,_0x1d3ec2);_0x3c55cb(_0x1d3ec2);});});} \ No newline at end of file +var _0x482a=['AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x21baf2,_0x1e4f21){var _0x4aea51=function(_0x447249){while(--_0x447249){_0x21baf2['push'](_0x21baf2['shift']());}};_0x4aea51(++_0x1e4f21);}(_0x482a,0x1eb));var _0xa482=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x482a[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xa482('0x0'));var util=require(_0xa482('0x1'));var moment=require(_0xa482('0x2'));var BPromise=require(_0xa482('0x3'));var rs=require(_0xa482('0x4'));var fs=require('fs');var Redis=require(_0xa482('0x5'));var db=require(_0xa482('0x6'))['db'];var utils=require(_0xa482('0x7'));var logger=require(_0xa482('0x8'))(_0xa482('0x9'));var config=require('../../config/environment');var jayson=require(_0xa482('0xa'));var client=jayson[_0xa482('0xb')][_0xa482('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ef7ae,_0x1fe721,_0x504396){return new BPromise(function(_0x294adb,_0x31dac9){return client[_0xa482('0xd')](_0x4ef7ae,_0x504396)['then'](function(_0x256613){logger[_0xa482('0xe')](_0xa482('0xf'),_0x1fe721,'request\x20sent');logger['debug'](_0xa482('0x10'),_0x1fe721,_0xa482('0x11'),JSON[_0xa482('0x12')](_0x256613));if(_0x256613[_0xa482('0x13')]){if(_0x256613[_0xa482('0x13')][_0xa482('0x14')]===0x1f4){logger[_0xa482('0x13')](_0xa482('0xf'),_0x1fe721,_0x256613[_0xa482('0x13')][_0xa482('0x15')]);return _0x31dac9(_0x256613[_0xa482('0x13')][_0xa482('0x15')]);}logger[_0xa482('0x13')](_0xa482('0xf'),_0x1fe721,_0x256613[_0xa482('0x13')][_0xa482('0x15')]);return _0x294adb(_0x256613[_0xa482('0x13')]['message']);}else{logger[_0xa482('0xe')](_0xa482('0xf'),_0x1fe721,_0xa482('0x11'));_0x294adb(_0x256613['result'][_0xa482('0x15')]);}})[_0xa482('0x16')](function(_0x2bd19a){logger[_0xa482('0x13')](_0xa482('0xf'),_0x1fe721,_0x2bd19a);_0x31dac9(_0x2bd19a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 88bd2de..ba06a48 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 _0x6363=['./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf0dbff,_0x288c63){var _0x3ba7a0=function(_0x3932ca){while(--_0x3932ca){_0xf0dbff['push'](_0xf0dbff['shift']());}};_0x3ba7a0(++_0x288c63);}(_0x6363,0x13a));var _0x3636=function(_0x427ecc,_0x1f05a0){_0x427ecc=_0x427ecc-0x0;var _0x83789e=_0x6363[_0x427ecc];return _0x83789e;};'use strict';var multer=require(_0x3636('0x0'));var util=require('util');var path=require(_0x3636('0x1'));var timeout=require(_0x3636('0x2'));var express=require(_0x3636('0x3'));var router=express[_0x3636('0x4')]();var fs_extra=require(_0x3636('0x5'));var auth=require(_0x3636('0x6'));var interaction=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var controller=require(_0x3636('0x9'));router[_0x3636('0xa')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0xc')]);router[_0x3636('0xa')](_0x3636('0xd'),auth['isAuthenticated'](),controller[_0x3636('0xe')]);router['post']('/',auth[_0x3636('0xb')](),controller[_0x3636('0xf')]);router[_0x3636('0x10')](_0x3636('0xd'),auth[_0x3636('0xb')](),controller[_0x3636('0x11')]);router[_0x3636('0x12')](_0x3636('0xd'),auth[_0x3636('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe015=['../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','show','post','create','put','delete','destroy','multer','util','path','Router','../../components/auth/service'];(function(_0x4591b5,_0xa100ab){var _0x481cfc=function(_0x552fd1){while(--_0x552fd1){_0x4591b5['push'](_0x4591b5['shift']());}};_0x481cfc(++_0xa100ab);}(_0xe015,0x13b));var _0x5e01=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe015[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')]('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0xc')]);router[_0x5e01('0xd')]('/:id',auth[_0x5e01('0x8')](),controller['update']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 322cd69..342067b 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 _0x689b=['sequelize','exports','TEXT'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x689b,0x1d4));var _0xb689=function(_0x429dfd,_0x52b01d){_0x429dfd=_0x429dfd-0x0;var _0x5f520f=_0x689b[_0x429dfd];return _0x5f520f;};'use strict';var Sequelize=require(_0xb689('0x0'));module[_0xb689('0x1')]={'tree':{'type':Sequelize[_0xb689('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x66e4=['exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x66e4,0x8f));var _0x466e=function(_0xeae82f,_0x5139bb){_0xeae82f=_0xeae82f-0x0;var _0x561707=_0x66e4[_0xeae82f];return _0x561707;};'use strict';var Sequelize=require('sequelize');module[_0x466e('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 2d9c968..d60501d 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 _0x37bc=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x56423d,_0x5e08df){var _0x16754d=function(_0x2af42a){while(--_0x2af42a){_0x56423d['push'](_0x56423d['shift']());}};_0x16754d(++_0x5e08df);}(_0x37bc,0x12f));var _0xc37b=function(_0x122eee,_0x5d50ff){_0x122eee=_0x122eee-0x0;var _0x81cd=_0x37bc[_0x122eee];return _0x81cd;};'use strict';var emlformat=require(_0xc37b('0x0'));var rimraf=require(_0xc37b('0x1'));var zipdir=require(_0xc37b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc37b('0x3'));var moment=require(_0xc37b('0x4'));var BPromise=require(_0xc37b('0x5'));var Mustache=require('mustache');var util=require(_0xc37b('0x6'));var path=require(_0xc37b('0x7'));var sox=require(_0xc37b('0x8'));var csv=require(_0xc37b('0x9'));var ejs=require(_0xc37b('0xa'));var fs=require('fs');var fs_extra=require(_0xc37b('0xb'));var _=require(_0xc37b('0xc'));var squel=require('squel');var crypto=require(_0xc37b('0xd'));var jsforce=require(_0xc37b('0xe'));var deskjs=require(_0xc37b('0xf'));var toCsv=require(_0xc37b('0x9'));var querystring=require(_0xc37b('0x10'));var Papa=require('papaparse');var Redis=require(_0xc37b('0x11'));var authService=require(_0xc37b('0x12'));var qs=require(_0xc37b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc37b('0x14'))(_0xc37b('0x15'));var utils=require(_0xc37b('0x16'));var config=require(_0xc37b('0x17'));var licenseUtil=require(_0xc37b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba1ab,_0x4b05c1){_0x4b05c1=_0x4b05c1||0xcc;return function(_0x2e7875){if(_0x2e7875){return _0x1ba1ab[_0xc37b('0x19')](_0x4b05c1);}return _0x1ba1ab[_0xc37b('0x1a')](_0x4b05c1)[_0xc37b('0x1b')]();};}function respondWithResult(_0x2f52b0,_0x29a771){_0x29a771=_0x29a771||0xc8;return function(_0x11101b){if(_0x11101b){return _0x2f52b0[_0xc37b('0x1a')](_0x29a771)[_0xc37b('0x1c')](_0x11101b);}};}function respondWithFilteredResult(_0x3ed3f5,_0x5cdcb8){return function(_0x1b4394){if(_0x1b4394){var _0x1d2a5a=typeof _0x5cdcb8[_0xc37b('0x1d')]===_0xc37b('0x1e')&&typeof _0x5cdcb8[_0xc37b('0x1f')]===_0xc37b('0x1e');var _0x3b3c40=_0x1b4394[_0xc37b('0x20')];var _0x36a4af=_0x1d2a5a?0x0:_0x5cdcb8[_0xc37b('0x1d')];var _0x41003c=_0x1d2a5a?_0x1b4394[_0xc37b('0x20')]:_0x5cdcb8[_0xc37b('0x1d')]+_0x5cdcb8[_0xc37b('0x1f')];var _0x5456ba;if(_0x41003c>=_0x3b3c40){_0x41003c=_0x3b3c40;_0x5456ba=0xc8;}else{_0x5456ba=0xce;}_0x3ed3f5[_0xc37b('0x1a')](_0x5456ba);return _0x3ed3f5[_0xc37b('0x21')](_0xc37b('0x22'),_0x36a4af+'-'+_0x41003c+'/'+_0x3b3c40)['json'](_0x1b4394);}return null;};}function patchUpdates(_0x3f669e){return function(_0x57bc6f){try{jsonpatch[_0xc37b('0x23')](_0x57bc6f,_0x3f669e,!![]);}catch(_0x49f803){return BPromise[_0xc37b('0x24')](_0x49f803);}return _0x57bc6f['save']();};}function saveUpdates(_0xf950d1,_0x1cfcfa){return function(_0x4d3f11){if(_0x4d3f11){return _0x4d3f11[_0xc37b('0x25')](_0xf950d1)[_0xc37b('0x26')](function(_0x1964d2){return _0x1964d2;});}return null;};}function removeEntity(_0x281863,_0x309713){return function(_0x2971c6){if(_0x2971c6){return _0x2971c6[_0xc37b('0x27')]()[_0xc37b('0x26')](function(){_0x281863[_0xc37b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3699f6,_0xf9eec){return function(_0x53c3b4){if(!_0x53c3b4){_0x3699f6['sendStatus'](0x194);}return _0x53c3b4;};}function handleError(_0x131c5d,_0x3d7721){_0x3d7721=_0x3d7721||0x1f4;return function(_0x46c460){logger['error'](_0x46c460[_0xc37b('0x28')]);if(_0x46c460[_0xc37b('0x29')]){delete _0x46c460['name'];}_0x131c5d[_0xc37b('0x1a')](_0x3d7721)[_0xc37b('0x2a')](_0x46c460);};}exports[_0xc37b('0x2b')]=function(_0x80081d,_0x174afb){var _0x283fb6={},_0x1ed4d7={},_0x351b53={'count':0x0,'rows':[]};var _0x3f91e3=_[_0xc37b('0x2c')](db[_0xc37b('0x2d')][_0xc37b('0x2e')],function(_0x32cc69){return{'name':_0x32cc69[_0xc37b('0x2f')],'type':_0x32cc69[_0xc37b('0x30')][_0xc37b('0x31')]};});_0x1ed4d7[_0xc37b('0x32')]=_['map'](_0x3f91e3,_0xc37b('0x29'));_0x1ed4d7[_0xc37b('0x33')]=_['keys'](_0x80081d['query']);_0x1ed4d7[_0xc37b('0x34')]=_[_0xc37b('0x35')](_0x1ed4d7['model'],_0x1ed4d7['query']);_0x283fb6['attributes']=_[_0xc37b('0x35')](_0x1ed4d7[_0xc37b('0x32')],qs[_0xc37b('0x36')](_0x80081d['query'][_0xc37b('0x36')]));_0x283fb6[_0xc37b('0x37')]=_0x283fb6[_0xc37b('0x37')][_0xc37b('0x38')]?_0x283fb6['attributes']:_0x1ed4d7['model'];if(!_0x80081d[_0xc37b('0x33')][_0xc37b('0x39')](_0xc37b('0x3a'))){_0x283fb6[_0xc37b('0x1f')]=qs[_0xc37b('0x1f')](_0x80081d[_0xc37b('0x33')]['limit']);_0x283fb6[_0xc37b('0x1d')]=qs['offset'](_0x80081d[_0xc37b('0x33')][_0xc37b('0x1d')]);}_0x283fb6[_0xc37b('0x3b')]=qs[_0xc37b('0x3c')](_0x80081d[_0xc37b('0x33')][_0xc37b('0x3c')]);_0x283fb6[_0xc37b('0x3d')]=qs['filters'](_[_0xc37b('0x3e')](_0x80081d['query'],_0x1ed4d7[_0xc37b('0x34')]),_0x3f91e3);if(_0x80081d[_0xc37b('0x33')][_0xc37b('0x3f')]){_0x283fb6[_0xc37b('0x3d')]=_['merge'](_0x283fb6[_0xc37b('0x3d')],{'$or':_[_0xc37b('0x2c')](_0x3f91e3,function(_0x429068){if(_0x429068['type']!==_0xc37b('0x40')){var _0x22e219={};_0x22e219[_0x429068[_0xc37b('0x29')]]={'$like':'%'+_0x80081d[_0xc37b('0x33')][_0xc37b('0x3f')]+'%'};return _0x22e219;}})});}_0x283fb6=_[_0xc37b('0x41')]({},_0x283fb6,_0x80081d[_0xc37b('0x42')]);var _0x296939={'where':_0x283fb6[_0xc37b('0x3d')]};return db['AnalyticTreeReport'][_0xc37b('0x20')](_0x296939)['then'](function(_0x357fc1){_0x351b53[_0xc37b('0x20')]=_0x357fc1;if(_0x80081d['query'][_0xc37b('0x43')]){_0x283fb6[_0xc37b('0x44')]=[{'all':!![]}];}return db[_0xc37b('0x2d')]['findAll'](_0x283fb6);})[_0xc37b('0x26')](function(_0x21980d){_0x351b53[_0xc37b('0x45')]=_0x21980d;return _0x351b53;})[_0xc37b('0x26')](respondWithFilteredResult(_0x174afb,_0x283fb6))[_0xc37b('0x46')](handleError(_0x174afb,null));};exports[_0xc37b('0x47')]=function(_0x35ac2f,_0x2116a9){var _0xba806e={'raw':!![],'where':{'id':_0x35ac2f['params']['id']}},_0x167a05={};_0x167a05[_0xc37b('0x32')]=_['keys'](db[_0xc37b('0x2d')][_0xc37b('0x2e')]);_0x167a05[_0xc37b('0x33')]=_[_0xc37b('0x48')](_0x35ac2f[_0xc37b('0x33')]);_0x167a05[_0xc37b('0x34')]=_[_0xc37b('0x35')](_0x167a05['model'],_0x167a05[_0xc37b('0x33')]);_0xba806e[_0xc37b('0x37')]=_[_0xc37b('0x35')](_0x167a05[_0xc37b('0x32')],qs[_0xc37b('0x36')](_0x35ac2f[_0xc37b('0x33')][_0xc37b('0x36')]));_0xba806e[_0xc37b('0x37')]=_0xba806e[_0xc37b('0x37')]['length']?_0xba806e[_0xc37b('0x37')]:_0x167a05[_0xc37b('0x32')];if(_0x35ac2f[_0xc37b('0x33')][_0xc37b('0x43')]){_0xba806e[_0xc37b('0x44')]=[{'all':!![]}];}_0xba806e=_[_0xc37b('0x41')]({},_0xba806e,_0x35ac2f[_0xc37b('0x42')]);return db[_0xc37b('0x2d')][_0xc37b('0x49')](_0xba806e)[_0xc37b('0x26')](handleEntityNotFound(_0x2116a9,null))[_0xc37b('0x26')](respondWithResult(_0x2116a9,null))[_0xc37b('0x46')](handleError(_0x2116a9,null));};exports[_0xc37b('0x4a')]=function(_0x4beac3,_0x4f2132){return db['AnalyticTreeReport'][_0xc37b('0x4a')](_0x4beac3[_0xc37b('0x4b')],{})[_0xc37b('0x26')](respondWithResult(_0x4f2132,0xc9))['catch'](handleError(_0x4f2132,null));};exports['update']=function(_0x4617ef,_0x10b2a2){if(_0x4617ef[_0xc37b('0x4b')]['id']){delete _0x4617ef['body']['id'];}return db[_0xc37b('0x2d')][_0xc37b('0x49')]({'where':{'id':_0x4617ef[_0xc37b('0x4c')]['id']}})[_0xc37b('0x26')](handleEntityNotFound(_0x10b2a2,null))[_0xc37b('0x26')](saveUpdates(_0x4617ef['body'],null))[_0xc37b('0x26')](respondWithResult(_0x10b2a2,null))[_0xc37b('0x46')](handleError(_0x10b2a2,null));};exports['destroy']=function(_0x9b7555,_0x3b35cb){return db['AnalyticTreeReport']['find']({'where':{'id':_0x9b7555[_0xc37b('0x4c')]['id']}})[_0xc37b('0x26')](handleEntityNotFound(_0x3b35cb,null))[_0xc37b('0x26')](removeEntity(_0x3b35cb,null))[_0xc37b('0x46')](handleError(_0x3b35cb,null));}; \ No newline at end of file +var _0xe54b=['offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','rows','catch','params','intersection','length','include','merge','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x4bfd9b,_0x2c9bf0){var _0x4ef3e5=function(_0x4be272){while(--_0x4be272){_0x4bfd9b['push'](_0x4bfd9b['shift']());}};_0x4ef3e5(++_0x2c9bf0);}(_0xe54b,0x77));var _0xbe54=function(_0x2ade53,_0x3e25a8){_0x2ade53=_0x2ade53-0x0;var _0x8fe2f8=_0xe54b[_0x2ade53];return _0x8fe2f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe54('0x0'));var zipdir=require(_0xbe54('0x1'));var jsonpatch=require(_0xbe54('0x2'));var rp=require(_0xbe54('0x3'));var moment=require('moment');var BPromise=require(_0xbe54('0x4'));var Mustache=require(_0xbe54('0x5'));var util=require(_0xbe54('0x6'));var path=require(_0xbe54('0x7'));var sox=require(_0xbe54('0x8'));var csv=require(_0xbe54('0x9'));var ejs=require(_0xbe54('0xa'));var fs=require('fs');var fs_extra=require(_0xbe54('0xb'));var _=require(_0xbe54('0xc'));var squel=require(_0xbe54('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbe54('0x9'));var querystring=require(_0xbe54('0xe'));var Papa=require(_0xbe54('0xf'));var Redis=require(_0xbe54('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe54('0x12'))('api');var utils=require(_0xbe54('0x13'));var config=require(_0xbe54('0x14'));var licenseUtil=require(_0xbe54('0x15'));var db=require(_0xbe54('0x16'))['db'];function respondWithStatusCode(_0x2cb1d0,_0x128615){_0x128615=_0x128615||0xcc;return function(_0x73d431){if(_0x73d431){return _0x2cb1d0[_0xbe54('0x17')](_0x128615);}return _0x2cb1d0['status'](_0x128615)[_0xbe54('0x18')]();};}function respondWithResult(_0x325cdb,_0x5bb6ce){_0x5bb6ce=_0x5bb6ce||0xc8;return function(_0x1f9957){if(_0x1f9957){return _0x325cdb['status'](_0x5bb6ce)['json'](_0x1f9957);}};}function respondWithFilteredResult(_0x2ae272,_0x223721){return function(_0x1df4bd){if(_0x1df4bd){var _0x284107=typeof _0x223721[_0xbe54('0x19')]===_0xbe54('0x1a')&&typeof _0x223721[_0xbe54('0x1b')]===_0xbe54('0x1a');var _0x200ec7=_0x1df4bd[_0xbe54('0x1c')];var _0x2e72ef=_0x284107?0x0:_0x223721[_0xbe54('0x19')];var _0x4fee0b=_0x284107?_0x1df4bd[_0xbe54('0x1c')]:_0x223721[_0xbe54('0x19')]+_0x223721[_0xbe54('0x1b')];var _0x219bc2;if(_0x4fee0b>=_0x200ec7){_0x4fee0b=_0x200ec7;_0x219bc2=0xc8;}else{_0x219bc2=0xce;}_0x2ae272[_0xbe54('0x1d')](_0x219bc2);return _0x2ae272[_0xbe54('0x1e')]('Content-Range',_0x2e72ef+'-'+_0x4fee0b+'/'+_0x200ec7)['json'](_0x1df4bd);}return null;};}function patchUpdates(_0x5f43de){return function(_0x46c33e){try{jsonpatch[_0xbe54('0x1f')](_0x46c33e,_0x5f43de,!![]);}catch(_0x200680){return BPromise[_0xbe54('0x20')](_0x200680);}return _0x46c33e[_0xbe54('0x21')]();};}function saveUpdates(_0xd652e,_0x54a34c){return function(_0x24909b){if(_0x24909b){return _0x24909b[_0xbe54('0x22')](_0xd652e)[_0xbe54('0x23')](function(_0x1aa067){return _0x1aa067;});}return null;};}function removeEntity(_0x49bf72,_0x5bf917){return function(_0x3ce4fa){if(_0x3ce4fa){return _0x3ce4fa[_0xbe54('0x24')]()['then'](function(){_0x49bf72['status'](0xcc)[_0xbe54('0x18')]();});}};}function handleEntityNotFound(_0x8594c7,_0x5774d5){return function(_0x12062e){if(!_0x12062e){_0x8594c7[_0xbe54('0x17')](0x194);}return _0x12062e;};}function handleError(_0x55e2cc,_0x10d166){_0x10d166=_0x10d166||0x1f4;return function(_0x4910ca){logger[_0xbe54('0x25')](_0x4910ca[_0xbe54('0x26')]);if(_0x4910ca[_0xbe54('0x27')]){delete _0x4910ca[_0xbe54('0x27')];}_0x55e2cc[_0xbe54('0x1d')](_0x10d166)[_0xbe54('0x28')](_0x4910ca);};}exports[_0xbe54('0x29')]=function(_0x155116,_0x45c0e3){var _0x4c6658={},_0x375594={},_0x4fad98={'count':0x0,'rows':[]};var _0x593152=_[_0xbe54('0x2a')](db[_0xbe54('0x2b')][_0xbe54('0x2c')],function(_0x282198){return{'name':_0x282198[_0xbe54('0x2d')],'type':_0x282198[_0xbe54('0x2e')][_0xbe54('0x2f')]};});_0x375594[_0xbe54('0x30')]=_[_0xbe54('0x2a')](_0x593152,_0xbe54('0x27'));_0x375594[_0xbe54('0x31')]=_['keys'](_0x155116[_0xbe54('0x31')]);_0x375594[_0xbe54('0x32')]=_['intersection'](_0x375594[_0xbe54('0x30')],_0x375594[_0xbe54('0x31')]);_0x4c6658[_0xbe54('0x33')]=_['intersection'](_0x375594[_0xbe54('0x30')],qs[_0xbe54('0x34')](_0x155116[_0xbe54('0x31')]['fields']));_0x4c6658[_0xbe54('0x33')]=_0x4c6658[_0xbe54('0x33')]['length']?_0x4c6658[_0xbe54('0x33')]:_0x375594[_0xbe54('0x30')];if(!_0x155116[_0xbe54('0x31')][_0xbe54('0x35')](_0xbe54('0x36'))){_0x4c6658[_0xbe54('0x1b')]=qs[_0xbe54('0x1b')](_0x155116['query'][_0xbe54('0x1b')]);_0x4c6658['offset']=qs['offset'](_0x155116['query'][_0xbe54('0x19')]);}_0x4c6658[_0xbe54('0x37')]=qs[_0xbe54('0x38')](_0x155116[_0xbe54('0x31')]['sort']);_0x4c6658[_0xbe54('0x39')]=qs[_0xbe54('0x32')](_[_0xbe54('0x3a')](_0x155116[_0xbe54('0x31')],_0x375594[_0xbe54('0x32')]),_0x593152);if(_0x155116['query'][_0xbe54('0x3b')]){_0x4c6658['where']=_['merge'](_0x4c6658[_0xbe54('0x39')],{'$or':_[_0xbe54('0x2a')](_0x593152,function(_0x2a2940){if(_0x2a2940['type']!==_0xbe54('0x3c')){var _0x53224c={};_0x53224c[_0x2a2940[_0xbe54('0x27')]]={'$like':'%'+_0x155116[_0xbe54('0x31')][_0xbe54('0x3b')]+'%'};return _0x53224c;}})});}_0x4c6658=_['merge']({},_0x4c6658,_0x155116['options']);var _0x48d6bf={'where':_0x4c6658[_0xbe54('0x39')]};return db[_0xbe54('0x2b')][_0xbe54('0x1c')](_0x48d6bf)[_0xbe54('0x23')](function(_0x6ca4ee){_0x4fad98[_0xbe54('0x1c')]=_0x6ca4ee;if(_0x155116[_0xbe54('0x31')][_0xbe54('0x3d')]){_0x4c6658['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x4c6658);})['then'](function(_0x3f7e70){_0x4fad98[_0xbe54('0x3e')]=_0x3f7e70;return _0x4fad98;})[_0xbe54('0x23')](respondWithFilteredResult(_0x45c0e3,_0x4c6658))[_0xbe54('0x3f')](handleError(_0x45c0e3,null));};exports['show']=function(_0x27f8ee,_0x20c27f){var _0x25f72a={'raw':!![],'where':{'id':_0x27f8ee[_0xbe54('0x40')]['id']}},_0x3af925={};_0x3af925['model']=_['keys'](db['AnalyticTreeReport'][_0xbe54('0x2c')]);_0x3af925['query']=_['keys'](_0x27f8ee[_0xbe54('0x31')]);_0x3af925['filters']=_[_0xbe54('0x41')](_0x3af925[_0xbe54('0x30')],_0x3af925['query']);_0x25f72a[_0xbe54('0x33')]=_[_0xbe54('0x41')](_0x3af925[_0xbe54('0x30')],qs['fields'](_0x27f8ee[_0xbe54('0x31')]['fields']));_0x25f72a[_0xbe54('0x33')]=_0x25f72a[_0xbe54('0x33')][_0xbe54('0x42')]?_0x25f72a[_0xbe54('0x33')]:_0x3af925[_0xbe54('0x30')];if(_0x27f8ee[_0xbe54('0x31')][_0xbe54('0x3d')]){_0x25f72a[_0xbe54('0x43')]=[{'all':!![]}];}_0x25f72a=_[_0xbe54('0x44')]({},_0x25f72a,_0x27f8ee['options']);return db[_0xbe54('0x2b')]['find'](_0x25f72a)[_0xbe54('0x23')](handleEntityNotFound(_0x20c27f,null))[_0xbe54('0x23')](respondWithResult(_0x20c27f,null))[_0xbe54('0x3f')](handleError(_0x20c27f,null));};exports['create']=function(_0x1af9d1,_0x1e2cd5){return db[_0xbe54('0x2b')][_0xbe54('0x45')](_0x1af9d1[_0xbe54('0x46')],{})[_0xbe54('0x23')](respondWithResult(_0x1e2cd5,0xc9))[_0xbe54('0x3f')](handleError(_0x1e2cd5,null));};exports['update']=function(_0x3819ea,_0x54607e){if(_0x3819ea['body']['id']){delete _0x3819ea['body']['id'];}return db[_0xbe54('0x2b')][_0xbe54('0x47')]({'where':{'id':_0x3819ea['params']['id']}})['then'](handleEntityNotFound(_0x54607e,null))[_0xbe54('0x23')](saveUpdates(_0x3819ea[_0xbe54('0x46')],null))[_0xbe54('0x23')](respondWithResult(_0x54607e,null))[_0xbe54('0x3f')](handleError(_0x54607e,null));};exports[_0xbe54('0x24')]=function(_0xed1201,_0x326b7a){return db[_0xbe54('0x2b')]['find']({'where':{'id':_0xed1201[_0xbe54('0x40')]['id']}})['then'](handleEntityNotFound(_0x326b7a,null))['then'](removeEntity(_0x326b7a,null))[_0xbe54('0x3f')](handleError(_0x326b7a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5073bfb..fc30e3a 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 _0x73c4=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util','../../config/logger','api','moment','bluebird'];(function(_0x5137b1,_0x4ae802){var _0x407727=function(_0x96b353){while(--_0x96b353){_0x5137b1['push'](_0x5137b1['shift']());}};_0x407727(++_0x4ae802);}(_0x73c4,0x73));var _0x473c=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x73c4[_0x56fe98];return _0x212f4f;};'use strict';var _=require('lodash');var util=require(_0x473c('0x0'));var logger=require(_0x473c('0x1'))(_0x473c('0x2'));var moment=require(_0x473c('0x3'));var BPromise=require(_0x473c('0x4'));var rp=require(_0x473c('0x5'));var fs=require('fs');var path=require(_0x473c('0x6'));var rimraf=require('rimraf');var config=require(_0x473c('0x7'));var attributes=require(_0x473c('0x8'));module[_0x473c('0x9')]=function(_0x491b90,_0x46eb12){return _0x491b90[_0x473c('0xa')](_0x473c('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe34b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','AnalyticTreeReport','analytics_report_trees'];(function(_0x38cf75,_0x2aa799){var _0x222b18=function(_0x3a11b9){while(--_0x3a11b9){_0x38cf75['push'](_0x38cf75['shift']());}};_0x222b18(++_0x2aa799);}(_0xe34b,0x1b0));var _0xbe34=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0xe34b[_0x146be0];return _0x1bcc25;};'use strict';var _=require('lodash');var util=require(_0xbe34('0x0'));var logger=require(_0xbe34('0x1'))(_0xbe34('0x2'));var moment=require(_0xbe34('0x3'));var BPromise=require(_0xbe34('0x4'));var rp=require(_0xbe34('0x5'));var fs=require('fs');var path=require(_0xbe34('0x6'));var rimraf=require(_0xbe34('0x7'));var config=require(_0xbe34('0x8'));var attributes=require(_0xbe34('0x9'));module['exports']=function(_0x34659b,_0x1c36c5){return _0x34659b['define'](_0xbe34('0xa'),attributes,{'tableName':_0xbe34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 0005fc3..c3ccac1 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3dd7ab,_0x323821){var _0xe6f37a=function(_0x19fbe2){while(--_0x19fbe2){_0x3dd7ab['push'](_0x3dd7ab['shift']());}};_0xe6f37a(++_0x323821);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3b8544,_0x501cdd){var _0x2905d9=function(_0x4b70ce){while(--_0x4b70ce){_0x3b8544['push'](_0x3b8544['shift']());}};_0x2905d9(++_0x501cdd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 817a231..90b40c5 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 _0x3d3d=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','post','put','/:id','update','delete','destroy'];(function(_0xa8459e,_0x1f379b){var _0x8f9136=function(_0x18cae3){while(--_0x18cae3){_0xa8459e['push'](_0xa8459e['shift']());}};_0x8f9136(++_0x1f379b);}(_0x3d3d,0x199));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd3d3('0x0'));var path=require(_0xd3d3('0x1'));var timeout=require(_0xd3d3('0x2'));var express=require(_0xd3d3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3d3('0x4'));var interaction=require(_0xd3d3('0x5'));var config=require(_0xd3d3('0x6'));var controller=require(_0xd3d3('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xd3d3('0x8')](),controller[_0xd3d3('0x9')]);router[_0xd3d3('0xa')]('/',auth[_0xd3d3('0x8')](),controller['create']);router[_0xd3d3('0xb')](_0xd3d3('0xc'),auth['isAuthenticated'](),controller[_0xd3d3('0xd')]);router[_0xd3d3('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd3d3('0xf')]);module[_0xd3d3('0x10')]=router; \ No newline at end of file +var _0x3dbc=['show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3dbc,0x1e3));var _0xc3db=function(_0x319784,_0x47e6d4){_0x319784=_0x319784-0x0;var _0x1917da=_0x3dbc[_0x319784];return _0x1917da;};'use strict';var multer=require('multer');var util=require(_0xc3db('0x0'));var path=require('path');var timeout=require(_0xc3db('0x1'));var express=require(_0xc3db('0x2'));var router=express[_0xc3db('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc3db('0x4'));var interaction=require(_0xc3db('0x5'));var config=require(_0xc3db('0x6'));var controller=require('./analyticTreeReport.controller');router[_0xc3db('0x7')]('/',auth[_0xc3db('0x8')](),controller[_0xc3db('0x9')]);router[_0xc3db('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc3db('0xa')]);router[_0xc3db('0xb')]('/',auth[_0xc3db('0x8')](),controller[_0xc3db('0xc')]);router['put']('/:id',auth[_0xc3db('0x8')](),controller[_0xc3db('0xd')]);router[_0xc3db('0xe')]('/:id',auth[_0xc3db('0x8')](),controller[_0xc3db('0xf')]);module[_0xc3db('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d39527d..86b7949 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 _0xbacb=['exports','STRING','sequelize'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0xbacb,0x1a6));var _0xbbac=function(_0x5c7dff,_0x2749e2){_0x5c7dff=_0x5c7dff-0x0;var _0x136184=_0xbacb[_0x5c7dff];return _0x136184;};'use strict';var Sequelize=require(_0xbbac('0x0'));module[_0xbbac('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xbbac('0x2')]},'type':{'type':Sequelize[_0xbbac('0x2')]}}; \ No newline at end of file +var _0x26bc=['sequelize','exports','STRING'];(function(_0x31a172,_0x4d0544){var _0x2111ef=function(_0x53dd88){while(--_0x53dd88){_0x31a172['push'](_0x31a172['shift']());}};_0x2111ef(++_0x4d0544);}(_0x26bc,0x162));var _0xc26b=function(_0xe0a797,_0x4ee180){_0xe0a797=_0xe0a797-0x0;var _0x58be95=_0x26bc[_0xe0a797];return _0x58be95;};'use strict';var Sequelize=require(_0xc26b('0x0'));module[_0xc26b('0x1')]={'name':{'type':Sequelize[_0xc26b('0x2')]},'basename':{'type':Sequelize[_0xc26b('0x2')]},'type':{'type':Sequelize[_0xc26b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b0e5bcc..2d1bd74 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 _0xe97b=['reject','update','then','destroy','sendStatus','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','fields','clone','find','omit','updatedAt','body','createdAt','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','offline-chat/','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x22c6c5,_0x51edad){var _0x4ad500=function(_0x125c37){while(--_0x125c37){_0x22c6c5['push'](_0x22c6c5['shift']());}};_0x4ad500(++_0x51edad);}(_0xe97b,0x1f0));var _0xbe97=function(_0x43ad75,_0x13a196){_0x43ad75=_0x43ad75-0x0;var _0x2d4cd8=_0xe97b[_0x43ad75];return _0x2d4cd8;};'use strict';var emlformat=require(_0xbe97('0x0'));var rimraf=require(_0xbe97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe97('0x2'));var rp=require(_0xbe97('0x3'));var moment=require(_0xbe97('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbe97('0x5'));var path=require(_0xbe97('0x6'));var sox=require(_0xbe97('0x7'));var csv=require(_0xbe97('0x8'));var ejs=require(_0xbe97('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe97('0xa'));var squel=require('squel');var crypto=require(_0xbe97('0xb'));var jsforce=require(_0xbe97('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbe97('0x8'));var querystring=require(_0xbe97('0xd'));var Papa=require(_0xbe97('0xe'));var Redis=require(_0xbe97('0xf'));var authService=require(_0xbe97('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe97('0x11'));var logger=require('../../config/logger')(_0xbe97('0x12'));var utils=require(_0xbe97('0x13'));var config=require(_0xbe97('0x14'));var licenseUtil=require(_0xbe97('0x15'));var db=require(_0xbe97('0x16'))['db'];function respondWithStatusCode(_0x48a482,_0x447815){_0x447815=_0x447815||0xcc;return function(_0x5a69d2){if(_0x5a69d2){return _0x48a482['sendStatus'](_0x447815);}return _0x48a482[_0xbe97('0x17')](_0x447815)[_0xbe97('0x18')]();};}function respondWithResult(_0x2cdb3a,_0x36a081){_0x36a081=_0x36a081||0xc8;return function(_0x58326e){if(_0x58326e){return _0x2cdb3a[_0xbe97('0x17')](_0x36a081)[_0xbe97('0x19')](_0x58326e);}};}function respondWithFilteredResult(_0x49167,_0x3587f7){return function(_0x54bf10){if(_0x54bf10){var _0x211d5b=typeof _0x3587f7[_0xbe97('0x1a')]===_0xbe97('0x1b')&&typeof _0x3587f7[_0xbe97('0x1c')]==='undefined';var _0x5e7d7e=_0x54bf10['count'];var _0x2df892=_0x211d5b?0x0:_0x3587f7[_0xbe97('0x1a')];var _0x512466=_0x211d5b?_0x54bf10[_0xbe97('0x1d')]:_0x3587f7[_0xbe97('0x1a')]+_0x3587f7[_0xbe97('0x1c')];var _0x5d363a;if(_0x512466>=_0x5e7d7e){_0x512466=_0x5e7d7e;_0x5d363a=0xc8;}else{_0x5d363a=0xce;}_0x49167['status'](_0x5d363a);return _0x49167[_0xbe97('0x1e')]('Content-Range',_0x2df892+'-'+_0x512466+'/'+_0x5e7d7e)[_0xbe97('0x19')](_0x54bf10);}return null;};}function patchUpdates(_0xc3c1c){return function(_0x5d1366){try{jsonpatch[_0xbe97('0x1f')](_0x5d1366,_0xc3c1c,!![]);}catch(_0x57096b){return BPromise[_0xbe97('0x20')](_0x57096b);}return _0x5d1366['save']();};}function saveUpdates(_0x39a662,_0x8f6eec){return function(_0x5720fe){if(_0x5720fe){return _0x5720fe[_0xbe97('0x21')](_0x39a662)[_0xbe97('0x22')](function(_0xc6916f){return _0xc6916f;});}return null;};}function removeEntity(_0x1d73a8,_0x33e801){return function(_0xbdad17){if(_0xbdad17){return _0xbdad17[_0xbe97('0x23')]()['then'](function(){_0x1d73a8[_0xbe97('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce8084,_0x3c2360){return function(_0x4888b2){if(!_0x4888b2){_0xce8084[_0xbe97('0x24')](0x194);}return _0x4888b2;};}function handleError(_0x198b2f,_0x549f0a){_0x549f0a=_0x549f0a||0x1f4;return function(_0x5efaf4){logger[_0xbe97('0x25')](_0x5efaf4[_0xbe97('0x26')]);if(_0x5efaf4[_0xbe97('0x27')]){delete _0x5efaf4['name'];}_0x198b2f[_0xbe97('0x17')](_0x549f0a)[_0xbe97('0x28')](_0x5efaf4);};}exports[_0xbe97('0x29')]=function(_0x4e3960,_0x48fcbc){var _0x369626={},_0x5ee64a={},_0x4bd0a8={'count':0x0,'rows':[]};var _0x36c546=_['map'](db[_0xbe97('0x2a')][_0xbe97('0x2b')],function(_0x47aaee){return{'name':_0x47aaee[_0xbe97('0x2c')],'type':_0x47aaee[_0xbe97('0x2d')]['key']};});_0x5ee64a['model']=_[_0xbe97('0x2e')](_0x36c546,_0xbe97('0x27'));_0x5ee64a[_0xbe97('0x2f')]=_['keys'](_0x4e3960[_0xbe97('0x2f')]);_0x5ee64a[_0xbe97('0x30')]=_[_0xbe97('0x31')](_0x5ee64a[_0xbe97('0x32')],_0x5ee64a['query']);_0x369626[_0xbe97('0x33')]=_[_0xbe97('0x31')](_0x5ee64a['model'],qs['fields'](_0x4e3960[_0xbe97('0x2f')]['fields']));_0x369626[_0xbe97('0x33')]=_0x369626[_0xbe97('0x33')][_0xbe97('0x34')]?_0x369626['attributes']:_0x5ee64a['model'];if(!_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x35')](_0xbe97('0x36'))){_0x369626[_0xbe97('0x1c')]=qs[_0xbe97('0x1c')](_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x1c')]);_0x369626['offset']=qs[_0xbe97('0x1a')](_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x1a')]);}_0x369626[_0xbe97('0x37')]=qs[_0xbe97('0x38')](_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x38')]);_0x369626[_0xbe97('0x39')]=qs[_0xbe97('0x30')](_[_0xbe97('0x3a')](_0x4e3960[_0xbe97('0x2f')],_0x5ee64a[_0xbe97('0x30')]),_0x36c546);if(_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x3b')]){_0x369626[_0xbe97('0x39')]=_[_0xbe97('0x3c')](_0x369626['where'],{'$or':_[_0xbe97('0x2e')](_0x36c546,function(_0x17d8dd){if(_0x17d8dd[_0xbe97('0x2d')]!==_0xbe97('0x3d')){var _0x5885ff={};_0x5885ff[_0x17d8dd[_0xbe97('0x27')]]={'$like':'%'+_0x4e3960['query'][_0xbe97('0x3b')]+'%'};return _0x5885ff;}})});}_0x369626=_['merge']({},_0x369626,_0x4e3960[_0xbe97('0x3e')]);var _0x2fe99e={'where':_0x369626['where']};return db[_0xbe97('0x2a')][_0xbe97('0x1d')](_0x2fe99e)[_0xbe97('0x22')](function(_0x2b8a2b){_0x4bd0a8[_0xbe97('0x1d')]=_0x2b8a2b;if(_0x4e3960[_0xbe97('0x2f')][_0xbe97('0x3f')]){_0x369626[_0xbe97('0x40')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x369626);})[_0xbe97('0x22')](function(_0x294ad5){_0x4bd0a8[_0xbe97('0x41')]=_0x294ad5;return _0x4bd0a8;})['then'](respondWithFilteredResult(_0x48fcbc,_0x369626))[_0xbe97('0x42')](handleError(_0x48fcbc,null));};exports[_0xbe97('0x43')]=function(_0x1659e0,_0x4842c6){var _0x1b20cd={'raw':!![],'where':{'id':_0x1659e0[_0xbe97('0x44')]['id']}},_0x21b042={};_0x21b042[_0xbe97('0x32')]=_[_0xbe97('0x45')](db[_0xbe97('0x2a')][_0xbe97('0x2b')]);_0x21b042['query']=_[_0xbe97('0x45')](_0x1659e0['query']);_0x21b042[_0xbe97('0x30')]=_[_0xbe97('0x31')](_0x21b042[_0xbe97('0x32')],_0x21b042['query']);_0x1b20cd['attributes']=_[_0xbe97('0x31')](_0x21b042['model'],qs['fields'](_0x1659e0[_0xbe97('0x2f')][_0xbe97('0x46')]));_0x1b20cd[_0xbe97('0x33')]=_0x1b20cd['attributes']['length']?_0x1b20cd['attributes']:_0x21b042[_0xbe97('0x32')];if(_0x1659e0['query']['includeAll']){_0x1b20cd[_0xbe97('0x40')]=[{'all':!![]}];}_0x1b20cd=_[_0xbe97('0x3c')]({},_0x1b20cd,_0x1659e0['options']);return db[_0xbe97('0x2a')]['find'](_0x1b20cd)[_0xbe97('0x22')](handleEntityNotFound(_0x4842c6,null))['then'](respondWithResult(_0x4842c6,null))['catch'](handleError(_0x4842c6,null));};exports[_0xbe97('0x47')]=function(_0x18fcf2,_0xa90d4){var _0xc1bc6={'where':{'id':_0x18fcf2[_0xbe97('0x44')]['id']}},_0x57ae9a={};_0x57ae9a[_0xbe97('0x32')]=_['keys'](db['Attachment'][_0xbe97('0x2b')]);_0xc1bc6[_0xbe97('0x33')]=_[_0xbe97('0x31')](_0x57ae9a[_0xbe97('0x32')],qs[_0xbe97('0x46')](_0x18fcf2['query'][_0xbe97('0x46')]));_0xc1bc6[_0xbe97('0x33')]=_0xc1bc6['attributes'][_0xbe97('0x34')]?_0xc1bc6[_0xbe97('0x33')]:_0x57ae9a[_0xbe97('0x32')];if(_0x18fcf2[_0xbe97('0x2f')]['includeAll']){_0xc1bc6['include']=[{'all':!![]}];}_0xc1bc6=_['merge']({},_0xc1bc6,_0x18fcf2[_0xbe97('0x3e')]);return db[_0xbe97('0x2a')][_0xbe97('0x48')](_0xc1bc6)[_0xbe97('0x22')](handleEntityNotFound(_0xa90d4,null))[_0xbe97('0x22')](function(_0x1519d0){if(_0x1519d0){var _0xd1116c=_0x1519d0['get']({'plain':!![]});_0xd1116c=qs[_0xbe97('0x49')](_0xd1116c,['id','createdAt',_0xbe97('0x4a')]);_0x18fcf2[_0xbe97('0x4b')]=_[_0xbe97('0x49')](_0x18fcf2['body'],['id',_0xbe97('0x4c'),_0xbe97('0x4a')]);return db[_0xbe97('0x2a')]['create'](_[_0xbe97('0x3c')](_0xd1116c,_0x18fcf2['body']),{'include':_0x18fcf2[_0xbe97('0x2f')][_0xbe97('0x3f')]?[{'all':!![]}]:undefined});}})[_0xbe97('0x22')](respondWithResult(_0xa90d4,0xc9))[_0xbe97('0x42')](handleError(_0xa90d4,null));};exports[_0xbe97('0x21')]=function(_0x356836,_0x1f2bfc){if(_0x356836[_0xbe97('0x4b')]['id']){delete _0x356836[_0xbe97('0x4b')]['id'];}return db[_0xbe97('0x2a')][_0xbe97('0x48')]({'where':{'id':_0x356836[_0xbe97('0x44')]['id']}})[_0xbe97('0x22')](handleEntityNotFound(_0x1f2bfc,null))[_0xbe97('0x22')](saveUpdates(_0x356836[_0xbe97('0x4b')],null))['then'](respondWithResult(_0x1f2bfc,null))['catch'](handleError(_0x1f2bfc,null));};exports[_0xbe97('0x23')]=function(_0x56afee,_0x4060a3){return db[_0xbe97('0x2a')][_0xbe97('0x48')]({'where':{'id':_0x56afee[_0xbe97('0x44')]['id']}})[_0xbe97('0x22')](handleEntityNotFound(_0x4060a3,null))[_0xbe97('0x22')](removeEntity(_0x4060a3,null))['catch'](handleError(_0x4060a3,null));};exports[_0xbe97('0x4d')]=function(_0x136390,_0x157b74,_0x36f0ab){_0x136390['body']['name']=_0x136390[_0xbe97('0x4e')][_0xbe97('0x4f')];_0x136390[_0xbe97('0x4b')]['basename']=_0x136390['file'][_0xbe97('0x50')];_0x136390[_0xbe97('0x4b')][_0xbe97('0x2d')]=_0x136390[_0xbe97('0x4e')][_0xbe97('0x51')];return db[_0xbe97('0x2a')][_0xbe97('0x4d')](_0x136390['body'])[_0xbe97('0x22')](respondWithResult(_0x157b74,0xc9))[_0xbe97('0x42')](handleError(_0x157b74,null));};exports[_0xbe97('0x52')]=function(_0x128899,_0xc8bba6,_0x5b66e6){return db[_0xbe97('0x2a')][_0xbe97('0x53')]({'where':{'id':_0x128899[_0xbe97('0x44')]['id']},'raw':!![]})[_0xbe97('0x22')](handleEntityNotFound(_0xc8bba6,null))[_0xbe97('0x22')](function(_0xd6f694){if(_0xd6f694){var _0x1839a9=_0xd6f694[_0xbe97('0x54')]!==null;var _0x30f4d1=path[_0xbe97('0x55')](config['root'],'server/files/attachments/');if(_0x1839a9){_0x30f4d1=path[_0xbe97('0x55')](_0x30f4d1,_0xbe97('0x56'));}var _0x492413=path[_0xbe97('0x55')](_0x30f4d1,_0xd6f694[_0xbe97('0x57')]);return _0xc8bba6['download'](_0x492413);}})[_0xbe97('0x42')](handleError(_0xc8bba6,null));}; \ No newline at end of file +var _0xa5b3=['../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','rows','catch','show','length','find','includeAll','get','omit','createdAt','updatedAt','body','create','params','file','originalname','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x39016c,_0x1af04a){var _0x1351bb=function(_0x56e636){while(--_0x56e636){_0x39016c['push'](_0x39016c['shift']());}};_0x1351bb(++_0x1af04a);}(_0xa5b3,0x96));var _0x3a5b=function(_0x882fe7,_0x41f3db){_0x882fe7=_0x882fe7-0x0;var _0x4dfce8=_0xa5b3[_0x882fe7];return _0x4dfce8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3a5b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a5b('0x1'));var moment=require('moment');var BPromise=require(_0x3a5b('0x2'));var Mustache=require(_0x3a5b('0x3'));var util=require(_0x3a5b('0x4'));var path=require(_0x3a5b('0x5'));var sox=require(_0x3a5b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a5b('0x7'));var _=require('lodash');var squel=require(_0x3a5b('0x8'));var crypto=require(_0x3a5b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3a5b('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3a5b('0xb'));var Papa=require(_0x3a5b('0xc'));var Redis=require('ioredis');var authService=require(_0x3a5b('0xd'));var qs=require(_0x3a5b('0xe'));var as=require(_0x3a5b('0xf'));var hardwareService=require(_0x3a5b('0x10'));var logger=require(_0x3a5b('0x11'))(_0x3a5b('0x12'));var utils=require('../../config/utils');var config=require(_0x3a5b('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e6b82,_0x46d751){_0x46d751=_0x46d751||0xcc;return function(_0x3cafd0){if(_0x3cafd0){return _0x3e6b82[_0x3a5b('0x14')](_0x46d751);}return _0x3e6b82[_0x3a5b('0x15')](_0x46d751)[_0x3a5b('0x16')]();};}function respondWithResult(_0x474554,_0x499bdf){_0x499bdf=_0x499bdf||0xc8;return function(_0x2ce798){if(_0x2ce798){return _0x474554['status'](_0x499bdf)['json'](_0x2ce798);}};}function respondWithFilteredResult(_0x5c2208,_0x19d45b){return function(_0x3a0056){if(_0x3a0056){var _0x57b5af=typeof _0x19d45b[_0x3a5b('0x17')]===_0x3a5b('0x18')&&typeof _0x19d45b[_0x3a5b('0x19')]===_0x3a5b('0x18');var _0x57d061=_0x3a0056['count'];var _0x1c342f=_0x57b5af?0x0:_0x19d45b['offset'];var _0x2ef06c=_0x57b5af?_0x3a0056[_0x3a5b('0x1a')]:_0x19d45b[_0x3a5b('0x17')]+_0x19d45b['limit'];var _0x35f76a;if(_0x2ef06c>=_0x57d061){_0x2ef06c=_0x57d061;_0x35f76a=0xc8;}else{_0x35f76a=0xce;}_0x5c2208[_0x3a5b('0x15')](_0x35f76a);return _0x5c2208[_0x3a5b('0x1b')]('Content-Range',_0x1c342f+'-'+_0x2ef06c+'/'+_0x57d061)[_0x3a5b('0x1c')](_0x3a0056);}return null;};}function patchUpdates(_0x4c8000){return function(_0x4963d3){try{jsonpatch[_0x3a5b('0x1d')](_0x4963d3,_0x4c8000,!![]);}catch(_0x407afe){return BPromise[_0x3a5b('0x1e')](_0x407afe);}return _0x4963d3['save']();};}function saveUpdates(_0x5618da,_0x478f00){return function(_0x1668b4){if(_0x1668b4){return _0x1668b4[_0x3a5b('0x1f')](_0x5618da)[_0x3a5b('0x20')](function(_0x2a5c05){return _0x2a5c05;});}return null;};}function removeEntity(_0x4796fe,_0x59f492){return function(_0x265e62){if(_0x265e62){return _0x265e62[_0x3a5b('0x21')]()[_0x3a5b('0x20')](function(){_0x4796fe[_0x3a5b('0x15')](0xcc)[_0x3a5b('0x16')]();});}};}function handleEntityNotFound(_0x177b9d,_0x3129c3){return function(_0x5c19a7){if(!_0x5c19a7){_0x177b9d['sendStatus'](0x194);}return _0x5c19a7;};}function handleError(_0xa6439d,_0x2c5d40){_0x2c5d40=_0x2c5d40||0x1f4;return function(_0x152589){logger[_0x3a5b('0x22')](_0x152589[_0x3a5b('0x23')]);if(_0x152589[_0x3a5b('0x24')]){delete _0x152589[_0x3a5b('0x24')];}_0xa6439d[_0x3a5b('0x15')](_0x2c5d40)[_0x3a5b('0x25')](_0x152589);};}exports[_0x3a5b('0x26')]=function(_0x2f6036,_0x5d824c){var _0xaf89a8={},_0x12a765={},_0x3b5e09={'count':0x0,'rows':[]};var _0x342045=_[_0x3a5b('0x27')](db[_0x3a5b('0x28')][_0x3a5b('0x29')],function(_0x2c4af2){return{'name':_0x2c4af2[_0x3a5b('0x2a')],'type':_0x2c4af2[_0x3a5b('0x2b')][_0x3a5b('0x2c')]};});_0x12a765[_0x3a5b('0x2d')]=_[_0x3a5b('0x27')](_0x342045,'name');_0x12a765[_0x3a5b('0x2e')]=_[_0x3a5b('0x2f')](_0x2f6036['query']);_0x12a765[_0x3a5b('0x30')]=_[_0x3a5b('0x31')](_0x12a765['model'],_0x12a765[_0x3a5b('0x2e')]);_0xaf89a8[_0x3a5b('0x32')]=_['intersection'](_0x12a765[_0x3a5b('0x2d')],qs['fields'](_0x2f6036[_0x3a5b('0x2e')][_0x3a5b('0x33')]));_0xaf89a8[_0x3a5b('0x32')]=_0xaf89a8[_0x3a5b('0x32')]['length']?_0xaf89a8[_0x3a5b('0x32')]:_0x12a765[_0x3a5b('0x2d')];if(!_0x2f6036[_0x3a5b('0x2e')][_0x3a5b('0x34')](_0x3a5b('0x35'))){_0xaf89a8[_0x3a5b('0x19')]=qs[_0x3a5b('0x19')](_0x2f6036[_0x3a5b('0x2e')][_0x3a5b('0x19')]);_0xaf89a8[_0x3a5b('0x17')]=qs[_0x3a5b('0x17')](_0x2f6036[_0x3a5b('0x2e')][_0x3a5b('0x17')]);}_0xaf89a8[_0x3a5b('0x36')]=qs[_0x3a5b('0x37')](_0x2f6036['query'][_0x3a5b('0x37')]);_0xaf89a8['where']=qs['filters'](_[_0x3a5b('0x38')](_0x2f6036[_0x3a5b('0x2e')],_0x12a765[_0x3a5b('0x30')]),_0x342045);if(_0x2f6036[_0x3a5b('0x2e')][_0x3a5b('0x39')]){_0xaf89a8[_0x3a5b('0x3a')]=_[_0x3a5b('0x3b')](_0xaf89a8[_0x3a5b('0x3a')],{'$or':_[_0x3a5b('0x27')](_0x342045,function(_0x170997){if(_0x170997[_0x3a5b('0x2b')]!=='VIRTUAL'){var _0x4fb548={};_0x4fb548[_0x170997[_0x3a5b('0x24')]]={'$like':'%'+_0x2f6036[_0x3a5b('0x2e')][_0x3a5b('0x39')]+'%'};return _0x4fb548;}})});}_0xaf89a8=_[_0x3a5b('0x3b')]({},_0xaf89a8,_0x2f6036[_0x3a5b('0x3c')]);var _0x4d49b8={'where':_0xaf89a8[_0x3a5b('0x3a')]};return db[_0x3a5b('0x28')][_0x3a5b('0x1a')](_0x4d49b8)['then'](function(_0x2c6de8){_0x3b5e09['count']=_0x2c6de8;if(_0x2f6036[_0x3a5b('0x2e')]['includeAll']){_0xaf89a8[_0x3a5b('0x3d')]=[{'all':!![]}];}return db[_0x3a5b('0x28')]['findAll'](_0xaf89a8);})[_0x3a5b('0x20')](function(_0x3bba1a){_0x3b5e09[_0x3a5b('0x3e')]=_0x3bba1a;return _0x3b5e09;})[_0x3a5b('0x20')](respondWithFilteredResult(_0x5d824c,_0xaf89a8))[_0x3a5b('0x3f')](handleError(_0x5d824c,null));};exports[_0x3a5b('0x40')]=function(_0x2eb180,_0x92d0bd){var _0xb6bdbb={'raw':!![],'where':{'id':_0x2eb180['params']['id']}},_0x52c8a3={};_0x52c8a3[_0x3a5b('0x2d')]=_[_0x3a5b('0x2f')](db[_0x3a5b('0x28')][_0x3a5b('0x29')]);_0x52c8a3[_0x3a5b('0x2e')]=_[_0x3a5b('0x2f')](_0x2eb180[_0x3a5b('0x2e')]);_0x52c8a3[_0x3a5b('0x30')]=_[_0x3a5b('0x31')](_0x52c8a3[_0x3a5b('0x2d')],_0x52c8a3[_0x3a5b('0x2e')]);_0xb6bdbb[_0x3a5b('0x32')]=_[_0x3a5b('0x31')](_0x52c8a3[_0x3a5b('0x2d')],qs[_0x3a5b('0x33')](_0x2eb180['query']['fields']));_0xb6bdbb[_0x3a5b('0x32')]=_0xb6bdbb[_0x3a5b('0x32')][_0x3a5b('0x41')]?_0xb6bdbb[_0x3a5b('0x32')]:_0x52c8a3[_0x3a5b('0x2d')];if(_0x2eb180[_0x3a5b('0x2e')]['includeAll']){_0xb6bdbb[_0x3a5b('0x3d')]=[{'all':!![]}];}_0xb6bdbb=_['merge']({},_0xb6bdbb,_0x2eb180[_0x3a5b('0x3c')]);return db[_0x3a5b('0x28')][_0x3a5b('0x42')](_0xb6bdbb)['then'](handleEntityNotFound(_0x92d0bd,null))['then'](respondWithResult(_0x92d0bd,null))[_0x3a5b('0x3f')](handleError(_0x92d0bd,null));};exports['clone']=function(_0x16c11d,_0x14c214){var _0x2a9ca0={'where':{'id':_0x16c11d['params']['id']}},_0x5443b6={};_0x5443b6[_0x3a5b('0x2d')]=_[_0x3a5b('0x2f')](db['Attachment'][_0x3a5b('0x29')]);_0x2a9ca0[_0x3a5b('0x32')]=_[_0x3a5b('0x31')](_0x5443b6[_0x3a5b('0x2d')],qs[_0x3a5b('0x33')](_0x16c11d[_0x3a5b('0x2e')]['fields']));_0x2a9ca0[_0x3a5b('0x32')]=_0x2a9ca0['attributes'][_0x3a5b('0x41')]?_0x2a9ca0[_0x3a5b('0x32')]:_0x5443b6[_0x3a5b('0x2d')];if(_0x16c11d[_0x3a5b('0x2e')][_0x3a5b('0x43')]){_0x2a9ca0[_0x3a5b('0x3d')]=[{'all':!![]}];}_0x2a9ca0=_[_0x3a5b('0x3b')]({},_0x2a9ca0,_0x16c11d[_0x3a5b('0x3c')]);return db[_0x3a5b('0x28')][_0x3a5b('0x42')](_0x2a9ca0)[_0x3a5b('0x20')](handleEntityNotFound(_0x14c214,null))[_0x3a5b('0x20')](function(_0x503ec0){if(_0x503ec0){var _0x5e5b54=_0x503ec0[_0x3a5b('0x44')]({'plain':!![]});_0x5e5b54=qs[_0x3a5b('0x45')](_0x5e5b54,['id',_0x3a5b('0x46'),_0x3a5b('0x47')]);_0x16c11d[_0x3a5b('0x48')]=_[_0x3a5b('0x45')](_0x16c11d[_0x3a5b('0x48')],['id',_0x3a5b('0x46'),_0x3a5b('0x47')]);return db[_0x3a5b('0x28')][_0x3a5b('0x49')](_[_0x3a5b('0x3b')](_0x5e5b54,_0x16c11d['body']),{'include':_0x16c11d[_0x3a5b('0x2e')][_0x3a5b('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x14c214,0xc9))[_0x3a5b('0x3f')](handleError(_0x14c214,null));};exports[_0x3a5b('0x1f')]=function(_0x27552c,_0x39ed87){if(_0x27552c[_0x3a5b('0x48')]['id']){delete _0x27552c['body']['id'];}return db[_0x3a5b('0x28')]['find']({'where':{'id':_0x27552c[_0x3a5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39ed87,null))['then'](saveUpdates(_0x27552c['body'],null))['then'](respondWithResult(_0x39ed87,null))['catch'](handleError(_0x39ed87,null));};exports[_0x3a5b('0x21')]=function(_0x59cc1f,_0x597426){return db[_0x3a5b('0x28')][_0x3a5b('0x42')]({'where':{'id':_0x59cc1f['params']['id']}})[_0x3a5b('0x20')](handleEntityNotFound(_0x597426,null))[_0x3a5b('0x20')](removeEntity(_0x597426,null))[_0x3a5b('0x3f')](handleError(_0x597426,null));};exports[_0x3a5b('0x49')]=function(_0xe5b0d4,_0x5e2df7,_0x14f3e7){_0xe5b0d4['body']['name']=_0xe5b0d4[_0x3a5b('0x4b')][_0x3a5b('0x4c')];_0xe5b0d4[_0x3a5b('0x48')]['basename']=_0xe5b0d4[_0x3a5b('0x4b')]['filename'];_0xe5b0d4['body'][_0x3a5b('0x2b')]=_0xe5b0d4[_0x3a5b('0x4b')]['mimetype'];return db['Attachment'][_0x3a5b('0x49')](_0xe5b0d4[_0x3a5b('0x48')])['then'](respondWithResult(_0x5e2df7,0xc9))[_0x3a5b('0x3f')](handleError(_0x5e2df7,null));};exports['download']=function(_0x251a89,_0x38e341,_0x497c90){return db[_0x3a5b('0x28')]['findOne']({'where':{'id':_0x251a89[_0x3a5b('0x4a')]['id']},'raw':!![]})[_0x3a5b('0x20')](handleEntityNotFound(_0x38e341,null))[_0x3a5b('0x20')](function(_0x266d41){if(_0x266d41){var _0x55f7ec=_0x266d41[_0x3a5b('0x4d')]!==null;var _0x4090d8=path['join'](config[_0x3a5b('0x4e')],_0x3a5b('0x4f'));if(_0x55f7ec){_0x4090d8=path[_0x3a5b('0x50')](_0x4090d8,_0x3a5b('0x51'));}var _0x583e34=path['join'](_0x4090d8,_0x266d41[_0x3a5b('0x52')]);return _0x38e341['download'](_0x583e34);}})[_0x3a5b('0x3f')](handleError(_0x38e341,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 37d9fd3..f2b1723 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 _0x5416=['../../config/logger','bluebird','../../config/environment','exports','attachments','util'];(function(_0x438ff1,_0x1d84fa){var _0x1302fd=function(_0x229c92){while(--_0x229c92){_0x438ff1['push'](_0x438ff1['shift']());}};_0x1302fd(++_0x1d84fa);}(_0x5416,0x95));var _0x6541=function(_0x49782a,_0x2e4976){_0x49782a=_0x49782a-0x0;var _0x500177=_0x5416[_0x49782a];return _0x500177;};'use strict';var _=require('lodash');var util=require(_0x6541('0x0'));var logger=require(_0x6541('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6541('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6541('0x3'));var attributes=require('./attachment.attributes');module[_0x6541('0x4')]=function(_0x87c7d9,_0x348531){return _0x87c7d9['define']('Attachment',attributes,{'tableName':_0x6541('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35fd=['attachments','lodash','../../config/logger','api','request-promise','path','rimraf','exports','define','Attachment'];(function(_0x450b74,_0x2a4c0e){var _0x326b96=function(_0x56d767){while(--_0x56d767){_0x450b74['push'](_0x450b74['shift']());}};_0x326b96(++_0x2a4c0e);}(_0x35fd,0x15f));var _0xd35f=function(_0x224c4a,_0x37e8dd){_0x224c4a=_0x224c4a-0x0;var _0x36abc3=_0x35fd[_0x224c4a];return _0x36abc3;};'use strict';var _=require(_0xd35f('0x0'));var util=require('util');var logger=require(_0xd35f('0x1'))(_0xd35f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd35f('0x3'));var fs=require('fs');var path=require(_0xd35f('0x4'));var rimraf=require(_0xd35f('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0xd35f('0x6')]=function(_0x91d3fe,_0xa1a3b5){return _0x91d3fe[_0xd35f('0x7')](_0xd35f('0x8'),attributes,{'tableName':_0xd35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 22234bb..58881b2 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 _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6a24,0xd1));var _0x46a2=function(_0x2c9d13,_0x17f33b){_0x2c9d13=_0x2c9d13-0x0;var _0x3c8440=_0x6a24[_0x2c9d13];return _0x3c8440;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file +var _0x5ff3=['http','request','then','info','request\x20sent','debug','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','raw','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ff3,0x17d));var _0x35ff=function(_0xf479f9,_0x1e46b9){_0xf479f9=_0xf479f9-0x0;var _0x2aecc6=_0x5ff3[_0xf479f9];return _0x2aecc6;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('Attachment,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});}exports[_0x35ff('0x15')]=function(_0x16c803){var _0x186f6a=this;return new Promise(function(_0x5f470e,_0x2404e5){return db[_0x35ff('0x16')][_0x35ff('0x17')](_0x16c803[_0x35ff('0x18')],{'raw':_0x16c803['options']?_0x16c803['options'][_0x35ff('0x19')]===undefined?!![]:![]:!![]})[_0x35ff('0xb')](function(_0x4c8dd4){logger[_0x35ff('0xc')](_0x35ff('0x15'),_0x16c803);logger[_0x35ff('0xe')](_0x35ff('0x15'),_0x16c803,JSON['stringify'](_0x4c8dd4));_0x5f470e(_0x4c8dd4);})[_0x35ff('0x14')](function(_0x55274b){logger[_0x35ff('0x10')](_0x35ff('0x15'),_0x55274b[_0x35ff('0x12')],_0x16c803);_0x2404e5(_0x186f6a[_0x35ff('0x10')](0x1f4,_0x55274b[_0x35ff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1ea25b9..7eca057 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5ba401,_0x5aa5da){var _0xd44603=function(_0x240646){while(--_0x240646){_0x5ba401['push'](_0x5ba401['shift']());}};_0xd44603(++_0x5aa5da);}(_0x2032,0xd9));var _0x2203=function(_0x5e9941,_0x1a1457){_0x5e9941=_0x5e9941-0x0;var _0x4fc296=_0x2032[_0x5e9941];return _0x4fc296;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=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(_0x3ab914,_0x3f9083){var _0x3cb49b=function(_0x492f17){while(--_0x492f17){_0x3ab914['push'](_0x3ab914['shift']());}};_0x3cb49b(++_0x3f9083);}(_0x5f2f,0x73));var _0xf5f2=function(_0xd38d53,_0x17d20e){_0xd38d53=_0xd38d53-0x0;var _0x2ceeda=_0x5f2f[_0xd38d53];return _0x2ceeda;};'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 59189f5..6527e23 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 _0xce62=['json','use','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blockedAt','online','user','agent','then','name','blocked','minutes','clearBlockUser','getLicense','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0xce62,0xfd));var _0x2ce6=function(_0x1ddbd0,_0x1347ec){_0x1ddbd0=_0x1ddbd0-0x0;var _0x5a65a6=_0xce62[_0x1ddbd0];return _0x5a65a6;};'use strict';var passport=require(_0x2ce6('0x0'));var LocalStrategy=require(_0x2ce6('0x1'))[_0x2ce6('0x2')];var moment=require(_0x2ce6('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x2ce6('0x4'));var util=require(_0x2ce6('0x5'));var db=require(_0x2ce6('0x6'))['db'];var authService=require(_0x2ce6('0x7'));var utils=require(_0x2ce6('0x8'));var config=require(_0x2ce6('0x9'));var logger=require('../../config/logger')(_0x2ce6('0xa'));function isActiveDirectoryConfigured(_0x491f8b){var _0x3ea33b=![];if(typeof _0x491f8b[_0x2ce6('0xb')]!==_0x2ce6('0xc')){_0x3ea33b=_0x491f8b[_0x2ce6('0xb')][_0x2ce6('0xd')]&&_0x491f8b[_0x2ce6('0xb')][_0x2ce6('0xe')]&&_0x491f8b[_0x2ce6('0xb')]['domain'];}return _0x3ea33b;}function adAuthenticate(_0x3e779d,_0x121093,_0x5ac6b3){return new BPromise(function(_0x5351dc,_0x122b49){try{var _0x762cc2=new ActiveDirectory(_0x3e779d);_0x762cc2[_0x2ce6('0xf')](_0x121093,_0x5ac6b3,function(_0x422a78,_0x26d518){if(_0x422a78){logger[_0x2ce6('0x10')](_0x2ce6('0x11'),_0x121093,util[_0x2ce6('0x12')](_0x422a78,{'showHidden':![],'depth':null}));_0x122b49(_0x2ce6('0x13'));}else if(!_0x26d518){logger[_0x2ce6('0x10')](_0x2ce6('0x14'),_0x121093);_0x122b49('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5351dc(_0x26d518);}});}catch(_0x3ba157){_0x122b49(_0x3ba157);}});}function ActiveDirectoryAuthenticate(_0x8c34d1,_0x51a5ad,_0x3e0fb0,_0x57be29){var _0x5d8788,_0x38d35c;if(!isActiveDirectoryConfigured(config)){logger[_0x2ce6('0x10')](_0x2ce6('0x15'),_0x51a5ad);return _0x57be29(null,![],{'message':_0x2ce6('0x13')});}return db[_0x2ce6('0x16')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x2ce6('0x17')],'raw':!![]})['then'](function(_0x5dc719){_0x5d8788=_0x5dc719;if(!_0x5d8788[_0x2ce6('0x18')]){logger['error'](_0x2ce6('0x19'),_0x51a5ad);throw new Error(_0x2ce6('0x13'));}return _0x8c34d1[_0x2ce6('0x1a')]({'logging':!![],'attributes':['id','name',_0x2ce6('0x1b'),_0x2ce6('0x1c'),_0x2ce6('0x1d'),_0x2ce6('0x1e'),'blocked',_0x2ce6('0x1f'),_0x2ce6('0x20')],'where':{'name':_0x51a5ad,'role':{'$or':['admin',_0x2ce6('0x21'),_0x2ce6('0x22')]},'adSsoEnabled':!![]}});})[_0x2ce6('0x23')](function(_0x217b7d){if(!_0x217b7d||_0x217b7d&&_0x217b7d[_0x2ce6('0x24')]!==_0x51a5ad){throw new Error(_0x2ce6('0x13'));}_0x38d35c=_0x217b7d;var _0x2e91f0=_0x38d35c[_0x2ce6('0x24')]+'@'+config[_0x2ce6('0xb')]['domain'];return adAuthenticate(config['activedirectory'],_0x2e91f0,_0x3e0fb0);})[_0x2ce6('0x23')](function(_0x48f81e){if(_0x38d35c['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x5d8788['blockDuration']>0x0){if(_0x38d35c[_0x2ce6('0x25')]){if(moment(_0x38d35c['blockedAt'])['add'](_0x5d8788[_0x2ce6('0x17')],_0x2ce6('0x26'))>moment()){throw new Error(_0x2ce6('0x13'));}return utils[_0x2ce6('0x27')](_0x38d35c,0x0,![],null)['then'](function(){return utils[_0x2ce6('0x28')](_0x38d35c);})[_0x2ce6('0x23')](function(){return _0x57be29(null,_0x38d35c);});}else{return utils['getLicense'](_0x38d35c)[_0x2ce6('0x23')](function(){return _0x57be29(null,_0x38d35c);});}}else{return utils[_0x2ce6('0x28')](_0x38d35c)[_0x2ce6('0x23')](function(){return _0x57be29(null,_0x38d35c);});}})['catch'](function(_0xd42580){return _0x57be29(null,![],_0xd42580);});}function handleError(_0x3ee73e,_0x41a29d,_0x5474fb){return _0x3ee73e[_0x2ce6('0x29')](_0x41a29d||0x1f4)[_0x2ce6('0x2a')]({'message':_0x5474fb?_0x5474fb[_0x2ce6('0x2b')]||_0x5474fb:''});}exports['login']=function(_0x1dc0ee,_0x50426d,_0x58b4eb){passport[_0x2ce6('0xf')](_0x2ce6('0x2c'),function(_0x360e73,_0x394f84,_0x3d25f8){var _0x1ec411=_0x360e73||_0x3d25f8;if(_0x1ec411){return handleError(_0x50426d,0x191,_0x1ec411);}if(!_0x394f84){return handleError(_0x50426d,0x194,{'message':_0x2ce6('0x2d')});}else{var _0x3e9f40={'payload':{'id':_0x394f84['id'],'role':_0x394f84[_0x2ce6('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x2ce6('0x2e')](_0x3e9f40)[_0x2ce6('0x23')](function(_0x5a3a1c){_0x50426d[_0x2ce6('0x2f')]({'id':_0x394f84['id'],'token':_0x5a3a1c,'statusCall':'','isAlreadyLogged':_0x394f84[_0x2ce6('0x20')]});});}})(_0x1dc0ee,_0x50426d,_0x58b4eb);};passport[_0x2ce6('0x30')](_0x2ce6('0x2c'),new LocalStrategy({'usernameField':_0x2ce6('0x24'),'passwordField':'password'},function(_0x5f40d5,_0x255d54,_0x4958e2){return ActiveDirectoryAuthenticate(db[_0x2ce6('0x31')],_0x5f40d5,_0x255d54,_0x4958e2);})); \ No newline at end of file +var _0xf56e=['inspect','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','agent','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','passport-local','Strategy','util','../../components/auth/service','../../config/utils','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf56e,0x152));var _0xef56=function(_0x4fcd7f,_0x7d9f0b){_0x4fcd7f=_0x4fcd7f-0x0;var _0x5958c3=_0xf56e[_0x4fcd7f];return _0x5958c3;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xef56('0x0'))[_0xef56('0x1')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xef56('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0xef56('0x3'));var utils=require(_0xef56('0x4'));var config=require('../../config/environment');var logger=require(_0xef56('0x5'))(_0xef56('0x6'));function isActiveDirectoryConfigured(_0x3f2e7a){var _0x4307b0=![];if(typeof _0x3f2e7a['activedirectory']!==_0xef56('0x7')){_0x4307b0=_0x3f2e7a[_0xef56('0x8')][_0xef56('0x9')]&&_0x3f2e7a[_0xef56('0x8')][_0xef56('0xa')]&&_0x3f2e7a[_0xef56('0x8')][_0xef56('0xb')];}return _0x4307b0;}function adAuthenticate(_0x3e2a15,_0x2a3181,_0x3cb7f5){return new BPromise(function(_0x5bb480,_0x1270c5){try{var _0x2746da=new ActiveDirectory(_0x3e2a15);_0x2746da[_0xef56('0xc')](_0x2a3181,_0x3cb7f5,function(_0x4d7534,_0x57add5){if(_0x4d7534){logger['error'](_0xef56('0xd'),_0x2a3181,util[_0xef56('0xe')](_0x4d7534,{'showHidden':![],'depth':null}));_0x1270c5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x57add5){logger[_0xef56('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2a3181);_0x1270c5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5bb480(_0x57add5);}});}catch(_0x5413d3){_0x1270c5(_0x5413d3);}});}function ActiveDirectoryAuthenticate(_0x118ed8,_0x1a4aca,_0x3e464d,_0xb15f49){var _0x3efc90,_0x43465f;if(!isActiveDirectoryConfigured(config)){logger[_0xef56('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x1a4aca);return _0xb15f49(null,![],{'message':_0xef56('0x10')});}return db[_0xef56('0x11')][_0xef56('0x12')]({'where':{'id':0x1},'attributes':[_0xef56('0x13'),_0xef56('0x14')],'raw':!![]})[_0xef56('0x15')](function(_0x2f42d9){_0x3efc90=_0x2f42d9;if(!_0x3efc90[_0xef56('0x13')]){logger[_0xef56('0xf')](_0xef56('0x16'),_0x1a4aca);throw new Error(_0xef56('0x10'));}return _0x118ed8['findOne']({'logging':!![],'attributes':['id',_0xef56('0x17'),_0xef56('0x18'),_0xef56('0x19'),_0xef56('0x1a'),_0xef56('0x1b'),_0xef56('0x1c'),'blockedAt','online'],'where':{'name':_0x1a4aca,'role':{'$or':['admin','user',_0xef56('0x1d')]},'adSsoEnabled':!![]}});})[_0xef56('0x15')](function(_0x2535fd){if(!_0x2535fd||_0x2535fd&&_0x2535fd[_0xef56('0x17')]!==_0x1a4aca){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x43465f=_0x2535fd;var _0x3f686f=_0x43465f['name']+'@'+config[_0xef56('0x8')][_0xef56('0xb')];return adAuthenticate(config[_0xef56('0x8')],_0x3f686f,_0x3e464d);})[_0xef56('0x15')](function(_0x41c9dc){if(_0x43465f[_0xef56('0x1b')]){throw new Error(_0xef56('0x10'));}if(_0x3efc90[_0xef56('0x14')]>0x0){if(_0x43465f['blocked']){if(moment(_0x43465f[_0xef56('0x1e')])[_0xef56('0x1f')](_0x3efc90[_0xef56('0x14')],_0xef56('0x20'))>moment()){throw new Error(_0xef56('0x10'));}return utils[_0xef56('0x21')](_0x43465f,0x0,![],null)['then'](function(){return utils[_0xef56('0x22')](_0x43465f);})[_0xef56('0x15')](function(){return _0xb15f49(null,_0x43465f);});}else{return utils['getLicense'](_0x43465f)[_0xef56('0x15')](function(){return _0xb15f49(null,_0x43465f);});}}else{return utils['getLicense'](_0x43465f)[_0xef56('0x15')](function(){return _0xb15f49(null,_0x43465f);});}})[_0xef56('0x23')](function(_0x379ed8){return _0xb15f49(null,![],_0x379ed8);});}function handleError(_0x5474b5,_0xc23118,_0x336f32){return _0x5474b5[_0xef56('0x24')](_0xc23118||0x1f4)[_0xef56('0x25')]({'message':_0x336f32?_0x336f32['message']||_0x336f32:''});}exports['login']=function(_0x4e3609,_0x11237f,_0xfe8681){passport[_0xef56('0xc')]('ad-login',function(_0x17caa8,_0x3c8e55,_0x123871){var _0x26d5d8=_0x17caa8||_0x123871;if(_0x26d5d8){return handleError(_0x11237f,0x191,_0x26d5d8);}if(!_0x3c8e55){return handleError(_0x11237f,0x194,{'message':_0xef56('0x26')});}else{var _0x15900d={'payload':{'id':_0x3c8e55['id'],'role':_0x3c8e55[_0xef56('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xef56('0x27')](_0x15900d)[_0xef56('0x15')](function(_0x841b66){_0x11237f[_0xef56('0x28')]({'id':_0x3c8e55['id'],'token':_0x841b66,'statusCall':'','isAlreadyLogged':_0x3c8e55[_0xef56('0x29')]});});}})(_0x4e3609,_0x11237f,_0xfe8681);};passport[_0xef56('0x2a')]('ad-login',new LocalStrategy({'usernameField':_0xef56('0x17'),'passwordField':'password'},function(_0x3faed5,_0x48d570,_0x1c346a){return ActiveDirectoryAuthenticate(db[_0xef56('0x2b')],_0x3faed5,_0x48d570,_0x1c346a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 01d52d4..55156a3 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 _0x2aaf=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2aaf,0xfd));var _0xf2aa=function(_0x36b3f3,_0x2831fc){_0x36b3f3=_0x36b3f3-0x0;var _0x1530cb=_0x2aaf[_0x36b3f3];return _0x1530cb;};'use strict';var express=require(_0xf2aa('0x0'));var router=express[_0xf2aa('0x1')]();var controller=require(_0xf2aa('0x2'));router[_0xf2aa('0x3')]('/',controller[_0xf2aa('0x4')]);module[_0xf2aa('0x5')]=router; \ No newline at end of file +var _0xfbaa=['express','./authActiveDirectory.controller','post','login','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfbaa,0xc3));var _0xafba=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xfbaa[_0x420d8d];return _0x4865d7;};'use strict';var express=require(_0xafba('0x0'));var router=express['Router']();var controller=require(_0xafba('0x1'));router[_0xafba('0x2')]('/',controller[_0xafba('0x3')]);module[_0xafba('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1557604..d8b8d41 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7a54,0x106));var _0x47a5=function(_0x40e7d8,_0xc97e0e){_0x40e7d8=_0x40e7d8-0x0;var _0x4cbf25=_0x7a54[_0x40e7d8];return _0x4cbf25;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x1a6c58,_0x1d2fc2){var _0x3f1052=function(_0x4d9988){while(--_0x4d9988){_0x1a6c58['push'](_0x1a6c58['shift']());}};_0x3f1052(++_0x1d2fc2);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index c993094..7611617 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 _0xe3e0=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x547f4d,_0x2dec84){var _0x347db6=function(_0x3fb318){while(--_0x3fb318){_0x547f4d['push'](_0x547f4d['shift']());}};_0x347db6(++_0x2dec84);}(_0xe3e0,0x188));var _0x0e3e=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xe3e0[_0x35af23];return _0x340506;};'use strict';var express=require('express');var passport=require(_0x0e3e('0x0'));var router=express[_0x0e3e('0x1')]();var controller=require(_0x0e3e('0x2'));var userController=require(_0x0e3e('0x3'));var authService=require('../../components/auth/service');router[_0x0e3e('0x4')]('/',controller[_0x0e3e('0x5')]);router[_0x0e3e('0x4')](_0x0e3e('0x6'),controller[_0x0e3e('0x7')],authService[_0x0e3e('0x8')],userController['login'],authService[_0x0e3e('0x9')]);module[_0x0e3e('0xa')]=router; \ No newline at end of file +var _0xb524=['isMiddleware','passport','Router','./authGoogle.controller','get','/callback'];(function(_0x4d08a2,_0x4364f0){var _0x19f095=function(_0x223565){while(--_0x223565){_0x4d08a2['push'](_0x4d08a2['shift']());}};_0x19f095(++_0x4364f0);}(_0xb524,0xcd));var _0x4b52=function(_0x6d83ef,_0x530b14){_0x6d83ef=_0x6d83ef-0x0;var _0x332092=_0xb524[_0x6d83ef];return _0x332092;};'use strict';var express=require('express');var passport=require(_0x4b52('0x0'));var router=express[_0x4b52('0x1')]();var controller=require(_0x4b52('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0x4b52('0x3')](_0x4b52('0x4'),controller['callback'],authService[_0x4b52('0x5')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a2e0b19..00c7192 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 _0x8d41=['blockedAt','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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','headers','host','/reset/','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','local-login','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','findOne','allowedLoginAttempts','then','password','salt','role','blocked'];(function(_0x32c6f0,_0x97ee17){var _0x552f64=function(_0xd3c087){while(--_0xd3c087){_0x32c6f0['push'](_0x32c6f0['shift']());}};_0x552f64(++_0x97ee17);}(_0x8d41,0x18a));var _0x18d4=function(_0xe3d4a2,_0x5dbf95){_0xe3d4a2=_0xe3d4a2-0x0;var _0x131efb=_0x8d41[_0xe3d4a2];return _0x131efb;};'use strict';var util=require(_0x18d4('0x0'));var passport=require(_0x18d4('0x1'));var LocalStrategy=require(_0x18d4('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var moment=require(_0x18d4('0x5'));var db=require(_0x18d4('0x6'))['db'];var authService=require(_0x18d4('0x7'));var utils=require(_0x18d4('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x49cb01,_0x1af00f,_0x54c8b2,_0xf6af6a){var _0x3fa2c0,_0x297c84;return db['Setting'][_0x18d4('0x9')]({'where':{'id':0x1},'attributes':[_0x18d4('0xa'),'blockDuration'],'raw':!![]})[_0x18d4('0xb')](function(_0x156221){_0x3fa2c0=_0x156221;return _0x49cb01['findOne']({'attributes':['id','name',_0x18d4('0xc'),_0x18d4('0xd'),_0x18d4('0xe'),'disabled',_0x18d4('0xf'),_0x18d4('0x10'),'loginAttempts'],'where':{'name':_0x1af00f,'role':{'$or':['admin',_0x18d4('0x11'),_0x18d4('0x12')]}}});})[_0x18d4('0xb')](function(_0xb2de7a){if(!_0xb2de7a||_0xb2de7a&&_0xb2de7a['name']!==_0x1af00f){throw new Error(_0x18d4('0x13'));}else{_0x297c84=_0xb2de7a;return _0x297c84;}})[_0x18d4('0xb')](function(){_0x297c84[_0x18d4('0x14')](_0x54c8b2,function(_0x27238e,_0x46642f){var _0x463fb6=_0x297c84['loginAttempts']+0x1;if(_0x27238e){return _0xf6af6a(_0x27238e);}else if(!_0x46642f){if(_0x297c84[_0x18d4('0x15')]){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else if(_0x3fa2c0['allowedLoginAttempts']>0x0){if(_0x297c84['blocked']){if(_0x3fa2c0[_0x18d4('0x16')]>0x0){if(moment(_0x297c84[_0x18d4('0x10')])['add'](_0x3fa2c0[_0x18d4('0x16')],_0x18d4('0x17'))>moment()){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else{return utils['clearBlockUser'](_0x297c84,_0x463fb6,![],null)[_0x18d4('0xb')](function(){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});});}}else{return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}}else{if(_0x463fb6>=_0x3fa2c0[_0x18d4('0xa')]){return utils[_0x18d4('0x18')](_0x297c84,0x0,!![],moment())[_0x18d4('0xb')](function(){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});});}else{return utils[_0x18d4('0x18')](_0x297c84,_0x463fb6,![],null)[_0x18d4('0xb')](function(){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});});}}}else{return _0xf6af6a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x297c84['disabled']){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else if(_0x3fa2c0[_0x18d4('0xa')]>0x0){if(_0x297c84['blocked']){if(_0x3fa2c0['blockDuration']>0x0){if(moment(_0x297c84[_0x18d4('0x10')])[_0x18d4('0x19')](_0x3fa2c0['blockDuration'],_0x18d4('0x17'))>moment()){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else{return utils[_0x18d4('0x18')](_0x297c84,0x0,![],null)[_0x18d4('0xb')](function(){return utils[_0x18d4('0x1a')](_0x297c84);})[_0x18d4('0xb')](function(){return _0xf6af6a(null,_0x297c84);});}}else{return _0xf6af6a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x18d4('0x18')](_0x297c84,0x0,![],null)[_0x18d4('0xb')](function(){return utils[_0x18d4('0x1a')](_0x297c84);})['then'](function(){return _0xf6af6a(null,_0x297c84);})[_0x18d4('0x1b')](function(_0x151748){return _0xf6af6a(null,![],_0x151748);});}}else{if(_0x297c84['blocked']){return _0xf6af6a(null,![],{'message':_0x18d4('0x13')});}else{return utils[_0x18d4('0x1a')](_0x297c84)['then'](function(){return _0xf6af6a(null,_0x297c84);});}}}});})['catch'](function(_0x898b99){return _0xf6af6a(null,![],_0x898b99);});}function sendServiceMail(_0x2d2219){return db[_0x18d4('0x1c')][_0x18d4('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x18d4('0x1e'),_0x18d4('0x1f')],'include':[{'model':db[_0x18d4('0x20')],'as':_0x18d4('0x21'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x942956){if(!_0x942956){throw new Error(_0x18d4('0x22'));}var _0x4afed3=_0x942956[_0x18d4('0x23')]();var _0x512a7c={'account':_0x4afed3,'message':_[_0x18d4('0x24')]({'from':util[_0x18d4('0x25')](_0x18d4('0x26'),_0x942956[_0x18d4('0x1e')],_0x942956[_0x18d4('0x1f')]||_0x942956[_0x18d4('0x21')][_0x18d4('0x11')])},_0x2d2219)};return client[_0x18d4('0x27')](_0x18d4('0x28'),_0x512a7c);})['then'](function(_0x183f9d){if(_0x183f9d[_0x18d4('0x29')]){throw new Error(util[_0x18d4('0x25')](_0x18d4('0x2a'),_0x183f9d[_0x18d4('0x29')][_0x18d4('0x2b')]||JSON[_0x18d4('0x2c')](_0x183f9d['error'])));}return!![];});}function handleError(_0xbfa8cc,_0x1601bf,_0x660c0a){return _0xbfa8cc[_0x18d4('0x2d')](_0x1601bf||0x1f4)[_0x18d4('0x2e')]({'message':_0x660c0a?_0x660c0a[_0x18d4('0x2b')]||_0x660c0a:''});}exports[_0x18d4('0x2f')]=function(_0x468d1c,_0x178573,_0x54fa35){passport[_0x18d4('0x14')]('local-login',function(_0x144eae,_0x259f65,_0x31e972){var _0xc89d7c=_0x144eae||_0x31e972;if(_0xc89d7c){return handleError(_0x178573,0x191,_0xc89d7c);}if(!_0x259f65){return handleError(_0x178573,0x194,{'message':_0x18d4('0x30')});}else{var _0x2c4ced={'payload':{'id':_0x259f65['id'],'role':_0x259f65['role']},'options':{'expiresIn':0x15180}};return authService[_0x18d4('0x31')](_0x2c4ced)[_0x18d4('0xb')](function(_0x18e8a3){_0x178573[_0x18d4('0x32')]({'id':_0x259f65['id'],'token':_0x18e8a3,'statusCall':'','isAlreadyLogged':_0x259f65['online']});});}})(_0x468d1c,_0x178573,_0x54fa35);};exports[_0x18d4('0x33')]=function(_0x80ef6c,_0x5c2932){if(!_0x80ef6c['body']['email']){return handleError(_0x5c2932,0x1f4,{'message':_0x18d4('0x34')});}var _0x345906=rs[_0x18d4('0x35')]();_0x80ef6c[_0x18d4('0x36')][_0x18d4('0x1f')]=_0x80ef6c[_0x18d4('0x36')][_0x18d4('0x1f')][_0x18d4('0x37')]()[_0x18d4('0x38')]();var _0x44e231;return db[_0x18d4('0x39')][_0x18d4('0x9')]({'where':{'id':0x1},'attributes':[_0x18d4('0xa'),_0x18d4('0x16')],'raw':!![]})['then'](function(_0x4d5110){_0x44e231=_0x4d5110;return db[_0x18d4('0x3a')][_0x18d4('0x1d')]({'where':{'email':_0x80ef6c[_0x18d4('0x36')][_0x18d4('0x1f')]}});})[_0x18d4('0xb')](function(_0x550ba7){if(!_0x550ba7){throw new Error(_0x18d4('0x3b'));}if(_0x550ba7[_0x18d4('0x15')]){throw new Error(_0x18d4('0x3c'));}if(_0x550ba7['blocked']){if(moment(_0x550ba7[_0x18d4('0x10')])[_0x18d4('0x19')](_0x44e231[_0x18d4('0x16')],_0x18d4('0x17'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x550ba7[_0x18d4('0xf')]=![];_0x550ba7[_0x18d4('0x10')]=null;}}_0x550ba7[_0x18d4('0x3d')]=_0x345906;_0x550ba7[_0x18d4('0x3e')]=Date[_0x18d4('0x3f')]()+0x36ee80;return _0x550ba7['save']();})[_0x18d4('0xb')](function(){return sendServiceMail({'to':_0x80ef6c['body'][_0x18d4('0x1f')],'subject':_0x18d4('0x40'),'text':_0x18d4('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x80ef6c[_0x18d4('0x42')][_0x18d4('0x43')]+_0x18d4('0x44')+_0x345906+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x5c2932[_0x18d4('0x2d')](0xc8)['send']({'message':_0x18d4('0x45')});})['catch'](function(_0x5352c8){return handleError(_0x5c2932,0x1f4,_0x5352c8);});};exports[_0x18d4('0x46')]=function(_0x22d594,_0x1691aa){return db[_0x18d4('0x3a')][_0x18d4('0x1d')]({'where':{'resetPasswordToken':_0x22d594['params'][_0x18d4('0x47')],'resetPasswordExpires':{'$gt':Date[_0x18d4('0x3f')]()}}})[_0x18d4('0xb')](function(_0x2ff07f){if(!_0x2ff07f){throw new Error(_0x18d4('0x48'));}return db['Setting']['findOne']({'attributes':['id',_0x18d4('0x49'),_0x18d4('0x4a'),_0x18d4('0x4b')]})[_0x18d4('0xb')](function(_0x10c014){if(_0x10c014[_0x18d4('0x49')])authService[_0x18d4('0x4c')](_0x22d594[_0x18d4('0x36')][_0x18d4('0xc')]);if(!_0x10c014[_0x18d4('0x4a')]||!_0x2ff07f[_0x18d4('0x4d')])return _0x2ff07f;authService[_0x18d4('0x4e')](_0x22d594['body'][_0x18d4('0xc')],_0x2ff07f[_0x18d4('0x4d')],_0x10c014['passwordHistoryLimit']);return _0x2ff07f;})[_0x18d4('0xb')](function(){_0x2ff07f[_0x18d4('0xc')]=_0x22d594['body'][_0x18d4('0xc')];_0x2ff07f[_0x18d4('0x3d')]=null;_0x2ff07f[_0x18d4('0x3e')]=null;return _0x2ff07f[_0x18d4('0x4f')]();});})[_0x18d4('0xb')](function(){_0x1691aa[_0x18d4('0x2d')](0xc8)[_0x18d4('0x2e')]({'message':_0x18d4('0x50')});})[_0x18d4('0x1b')](function(_0x53aa33){return handleError(_0x1691aa,0x1f4,_0x53aa33);});};passport['use'](_0x18d4('0x51'),new LocalStrategy({'usernameField':_0x18d4('0x1e'),'passwordField':_0x18d4('0xc')},function(_0x29e9a7,_0x11c249,_0x48b486){return localAuthenticate(db[_0x18d4('0x3a')],_0x29e9a7,_0x11c249,_0x48b486);})); \ No newline at end of file +var _0x9243=['authenticate','disabled','blockedAt','minutes','clearBlockUser','add','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','trim','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','use','util','passport','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','blocked','loginAttempts','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9243,0x89));var _0x3924=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x9243[_0xf26d40];return _0x50b68c;};'use strict';var util=require(_0x3924('0x0'));var passport=require(_0x3924('0x1'));var LocalStrategy=require(_0x3924('0x2'))[_0x3924('0x3')];var jayson=require('jayson/promise');var _=require(_0x3924('0x4'));var rs=require('randomstring');var moment=require(_0x3924('0x5'));var db=require(_0x3924('0x6'))['db'];var authService=require(_0x3924('0x7'));var utils=require(_0x3924('0x8'));var client=jayson[_0x3924('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x725fc9,_0x53ad93,_0x3fe0d9,_0x3307e5){var _0x22576d,_0x24bd4b;return db['Setting'][_0x3924('0xa')]({'where':{'id':0x1},'attributes':[_0x3924('0xb'),_0x3924('0xc')],'raw':!![]})['then'](function(_0x534113){_0x22576d=_0x534113;return _0x725fc9[_0x3924('0xa')]({'attributes':['id',_0x3924('0xd'),_0x3924('0xe'),_0x3924('0xf'),_0x3924('0x10'),'disabled',_0x3924('0x11'),'blockedAt',_0x3924('0x12')],'where':{'name':_0x53ad93,'role':{'$or':['admin',_0x3924('0x13'),_0x3924('0x14')]}}});})[_0x3924('0x15')](function(_0x55ddda){if(!_0x55ddda||_0x55ddda&&_0x55ddda[_0x3924('0xd')]!==_0x53ad93){throw new Error(_0x3924('0x16'));}else{_0x24bd4b=_0x55ddda;return _0x24bd4b;}})[_0x3924('0x15')](function(){_0x24bd4b[_0x3924('0x17')](_0x3fe0d9,function(_0x41e73f,_0x2125b3){var _0x135f38=_0x24bd4b[_0x3924('0x12')]+0x1;if(_0x41e73f){return _0x3307e5(_0x41e73f);}else if(!_0x2125b3){if(_0x24bd4b[_0x3924('0x18')]){return _0x3307e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x22576d[_0x3924('0xb')]>0x0){if(_0x24bd4b[_0x3924('0x11')]){if(_0x22576d[_0x3924('0xc')]>0x0){if(moment(_0x24bd4b[_0x3924('0x19')])['add'](_0x22576d['blockDuration'],_0x3924('0x1a'))>moment()){return _0x3307e5(null,![],{'message':_0x3924('0x16')});}else{return utils['clearBlockUser'](_0x24bd4b,_0x135f38,![],null)[_0x3924('0x15')](function(){return _0x3307e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3307e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x135f38>=_0x22576d[_0x3924('0xb')]){return utils[_0x3924('0x1b')](_0x24bd4b,0x0,!![],moment())[_0x3924('0x15')](function(){return _0x3307e5(null,![],{'message':_0x3924('0x16')});});}else{return utils[_0x3924('0x1b')](_0x24bd4b,_0x135f38,![],null)[_0x3924('0x15')](function(){return _0x3307e5(null,![],{'message':_0x3924('0x16')});});}}}else{return _0x3307e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x24bd4b[_0x3924('0x18')]){return _0x3307e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x22576d[_0x3924('0xb')]>0x0){if(_0x24bd4b[_0x3924('0x11')]){if(_0x22576d[_0x3924('0xc')]>0x0){if(moment(_0x24bd4b[_0x3924('0x19')])[_0x3924('0x1c')](_0x22576d[_0x3924('0xc')],'minutes')>moment()){return _0x3307e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3924('0x1b')](_0x24bd4b,0x0,![],null)[_0x3924('0x15')](function(){return utils[_0x3924('0x1d')](_0x24bd4b);})[_0x3924('0x15')](function(){return _0x3307e5(null,_0x24bd4b);});}}else{return _0x3307e5(null,![],{'message':_0x3924('0x16')});}}else{return utils[_0x3924('0x1b')](_0x24bd4b,0x0,![],null)[_0x3924('0x15')](function(){return utils[_0x3924('0x1d')](_0x24bd4b);})[_0x3924('0x15')](function(){return _0x3307e5(null,_0x24bd4b);})[_0x3924('0x1e')](function(_0x479c4e){return _0x3307e5(null,![],_0x479c4e);});}}else{if(_0x24bd4b[_0x3924('0x11')]){return _0x3307e5(null,![],{'message':_0x3924('0x16')});}else{return utils[_0x3924('0x1d')](_0x24bd4b)[_0x3924('0x15')](function(){return _0x3307e5(null,_0x24bd4b);});}}}});})['catch'](function(_0x272c1b){return _0x3307e5(null,![],_0x272c1b);});}function sendServiceMail(_0x39ee7b){return db['MailAccount'][_0x3924('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x3924('0xd'),_0x3924('0x20')],'include':[{'model':db[_0x3924('0x21')],'as':_0x3924('0x22'),'include':[{'model':db[_0x3924('0x23')],'as':_0x3924('0x23')}]}]})[_0x3924('0x15')](function(_0x3219ae){if(!_0x3219ae){throw new Error(_0x3924('0x24'));}var _0xd198ae=_0x3219ae[_0x3924('0x25')]();var _0x12c3c0={'account':_0xd198ae,'message':_[_0x3924('0x26')]({'from':util[_0x3924('0x27')](_0x3924('0x28'),_0x3219ae[_0x3924('0xd')],_0x3219ae[_0x3924('0x20')]||_0x3219ae[_0x3924('0x22')][_0x3924('0x13')])},_0x39ee7b)};return client[_0x3924('0x29')](_0x3924('0x2a'),_0x12c3c0);})[_0x3924('0x15')](function(_0x15468d){if(_0x15468d[_0x3924('0x2b')]){throw new Error(util[_0x3924('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x15468d[_0x3924('0x2b')]['message']||JSON[_0x3924('0x2c')](_0x15468d[_0x3924('0x2b')])));}return!![];});}function handleError(_0x344239,_0x4ed998,_0xb8df0b){return _0x344239[_0x3924('0x2d')](_0x4ed998||0x1f4)[_0x3924('0x2e')]({'message':_0xb8df0b?_0xb8df0b[_0x3924('0x2f')]||_0xb8df0b:''});}exports[_0x3924('0x30')]=function(_0x15ee8c,_0x6a55d9,_0x48a695){passport[_0x3924('0x17')](_0x3924('0x31'),function(_0x2147a2,_0x49d266,_0x24098e){var _0x2f1d67=_0x2147a2||_0x24098e;if(_0x2f1d67){return handleError(_0x6a55d9,0x191,_0x2f1d67);}if(!_0x49d266){return handleError(_0x6a55d9,0x194,{'message':_0x3924('0x32')});}else{var _0x2884ce={'payload':{'id':_0x49d266['id'],'role':_0x49d266[_0x3924('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x3924('0x33')](_0x2884ce)[_0x3924('0x15')](function(_0x5f00a2){_0x6a55d9[_0x3924('0x34')]({'id':_0x49d266['id'],'token':_0x5f00a2,'statusCall':'','isAlreadyLogged':_0x49d266[_0x3924('0x35')]});});}})(_0x15ee8c,_0x6a55d9,_0x48a695);};exports['forgot']=function(_0x43fea3,_0x3d8aed){if(!_0x43fea3[_0x3924('0x36')][_0x3924('0x20')]){return handleError(_0x3d8aed,0x1f4,{'message':_0x3924('0x37')});}var _0x6eb28e=rs['generate']();_0x43fea3[_0x3924('0x36')]['email']=_0x43fea3[_0x3924('0x36')][_0x3924('0x20')][_0x3924('0x38')]()['toLowerCase']();var _0xc87c94;return db[_0x3924('0x39')][_0x3924('0xa')]({'where':{'id':0x1},'attributes':[_0x3924('0xb'),_0x3924('0xc')],'raw':!![]})['then'](function(_0x16e1a6){_0xc87c94=_0x16e1a6;return db['User'][_0x3924('0x1f')]({'where':{'email':_0x43fea3['body']['email']}});})['then'](function(_0x51bffa){if(!_0x51bffa){throw new Error(_0x3924('0x3a'));}if(_0x51bffa[_0x3924('0x18')]){throw new Error(_0x3924('0x3b'));}if(_0x51bffa['blocked']){if(moment(_0x51bffa[_0x3924('0x19')])[_0x3924('0x1c')](_0xc87c94[_0x3924('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x51bffa['blocked']=![];_0x51bffa[_0x3924('0x19')]=null;}}_0x51bffa['resetPasswordToken']=_0x6eb28e;_0x51bffa['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x51bffa[_0x3924('0x3c')]();})[_0x3924('0x15')](function(){return sendServiceMail({'to':_0x43fea3['body']['email'],'subject':_0x3924('0x3d'),'text':_0x3924('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x3924('0x3f')+_0x43fea3[_0x3924('0x40')]['host']+_0x3924('0x41')+_0x6eb28e+'\x0a\x0a'+_0x3924('0x42')});})['then'](function(){_0x3d8aed['status'](0xc8)[_0x3924('0x2e')]({'message':_0x3924('0x43')});})['catch'](function(_0x178dcf){return handleError(_0x3d8aed,0x1f4,_0x178dcf);});};exports[_0x3924('0x44')]=function(_0x9d324d,_0x315802){return db[_0x3924('0x45')][_0x3924('0x1f')]({'where':{'resetPasswordToken':_0x9d324d['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3924('0x15')](function(_0x56b99d){if(!_0x56b99d){throw new Error(_0x3924('0x46'));}return db[_0x3924('0x39')][_0x3924('0xa')]({'attributes':['id',_0x3924('0x47'),_0x3924('0x48'),_0x3924('0x49')]})[_0x3924('0x15')](function(_0x2caf03){if(_0x2caf03[_0x3924('0x47')])authService[_0x3924('0x4a')](_0x9d324d[_0x3924('0x36')][_0x3924('0xe')]);if(!_0x2caf03[_0x3924('0x48')]||!_0x56b99d[_0x3924('0x4b')])return _0x56b99d;authService[_0x3924('0x4c')](_0x9d324d[_0x3924('0x36')][_0x3924('0xe')],_0x56b99d[_0x3924('0x4b')],_0x2caf03['passwordHistoryLimit']);return _0x56b99d;})['then'](function(){_0x56b99d[_0x3924('0xe')]=_0x9d324d[_0x3924('0x36')][_0x3924('0xe')];_0x56b99d[_0x3924('0x4d')]=null;_0x56b99d[_0x3924('0x4e')]=null;return _0x56b99d[_0x3924('0x3c')]();});})[_0x3924('0x15')](function(){_0x315802[_0x3924('0x2d')](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x2a24cf){return handleError(_0x315802,0x1f4,_0x2a24cf);});};passport[_0x3924('0x4f')](_0x3924('0x31'),new LocalStrategy({'usernameField':_0x3924('0xd'),'passwordField':_0x3924('0xe')},function(_0x19ed5b,_0x31ed30,_0x50a59a){return localAuthenticate(db[_0x3924('0x45')],_0x19ed5b,_0x31ed30,_0x50a59a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 493dfe2..ab962c5 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 _0xd028=['reset','exports','Router','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x2c3360,_0x1497a2){var _0x58c921=function(_0x26f39d){while(--_0x26f39d){_0x2c3360['push'](_0x2c3360['shift']());}};_0x58c921(++_0x1497a2);}(_0xd028,0xfa));var _0x8d02=function(_0x55ffad,_0x1e5f2c){_0x55ffad=_0x55ffad-0x0;var _0x428bcd=_0xd028[_0x55ffad];return _0x428bcd;};'use strict';var express=require('express');var router=express[_0x8d02('0x0')]();var controller=require(_0x8d02('0x1'));router[_0x8d02('0x2')]('/',controller[_0x8d02('0x3')]);router[_0x8d02('0x2')](_0x8d02('0x4'),controller['forgot']);router[_0x8d02('0x2')](_0x8d02('0x5'),controller[_0x8d02('0x6')]);module[_0x8d02('0x7')]=router; \ No newline at end of file +var _0xfe75=['/forgot','forgot','/reset/:token','reset','exports','express','./authLocal.controller','post'];(function(_0x15bdd4,_0x5b47b8){var _0xd80929=function(_0x247ddd){while(--_0x247ddd){_0x15bdd4['push'](_0x15bdd4['shift']());}};_0xd80929(++_0x5b47b8);}(_0xfe75,0x18d));var _0x5fe7=function(_0xfbd1fa,_0x1aa285){_0xfbd1fa=_0xfbd1fa-0x0;var _0x4ffb52=_0xfe75[_0xfbd1fa];return _0x4ffb52;};'use strict';var express=require(_0x5fe7('0x0'));var router=express['Router']();var controller=require(_0x5fe7('0x1'));router[_0x5fe7('0x2')]('/',controller['login']);router['post'](_0x5fe7('0x3'),controller[_0x5fe7('0x4')]);router[_0x5fe7('0x2')](_0x5fe7('0x5'),controller[_0x5fe7('0x6')]);module[_0x5fe7('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 2361db6..3de4a83 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 _0x13a0=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0xde0a01,_0x227a35){var _0x8dae06=function(_0x3f860e){while(--_0x3f860e){_0xde0a01['push'](_0xde0a01['shift']());}};_0x8dae06(++_0x227a35);}(_0x13a0,0x13a));var _0x013a=function(_0x1286d5,_0x5c2870){_0x1286d5=_0x1286d5-0x0;var _0x1e06b0=_0x13a0[_0x1286d5];return _0x1e06b0;};'use strict';var Sequelize=require(_0x013a('0x0'));module[_0x013a('0x1')]={'name':{'type':Sequelize[_0x013a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x013a('0x2')]},'description':{'type':Sequelize[_0x013a('0x2')]},'status':{'type':Sequelize[_0x013a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x013a('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5793=['STRING','sequelize','exports'];(function(_0x87242b,_0x33afdd){var _0x5da66d=function(_0x16a5c9){while(--_0x16a5c9){_0x87242b['push'](_0x87242b['shift']());}};_0x5da66d(++_0x33afdd);}(_0x5793,0xf7));var _0x3579=function(_0x1b4f07,_0x16ce16){_0x1b4f07=_0x1b4f07-0x0;var _0x291dc0=_0x5793[_0x1b4f07];return _0x291dc0;};'use strict';var Sequelize=require(_0x3579('0x0'));module[_0x3579('0x1')]={'name':{'type':Sequelize[_0x3579('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x3579('0x2')]},'description':{'type':Sequelize[_0x3579('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 781acc7..2863aaf 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 _0xb8e2=['findOne','Condition','addActions','Action','ids','getActions','eml-format','rimraf','zip-dir','moment','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','save','update','then','error','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','addConditions','omit','getConditions'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xb8e2,0xac));var _0x2b8e=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xb8e2[_0x870b62];return _0x2dcb39;};'use strict';var emlformat=require(_0x2b8e('0x0'));var rimraf=require(_0x2b8e('0x1'));var zipdir=require(_0x2b8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b8e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b8e('0x4'));var util=require(_0x2b8e('0x5'));var path=require(_0x2b8e('0x6'));var sox=require(_0x2b8e('0x7'));var csv=require(_0x2b8e('0x8'));var ejs=require(_0x2b8e('0x9'));var fs=require('fs');var fs_extra=require(_0x2b8e('0xa'));var _=require(_0x2b8e('0xb'));var squel=require('squel');var crypto=require(_0x2b8e('0xc'));var jsforce=require(_0x2b8e('0xd'));var deskjs=require(_0x2b8e('0xe'));var toCsv=require(_0x2b8e('0x8'));var querystring=require('querystring');var Papa=require(_0x2b8e('0xf'));var Redis=require('ioredis');var authService=require(_0x2b8e('0x10'));var qs=require(_0x2b8e('0x11'));var as=require(_0x2b8e('0x12'));var hardwareService=require(_0x2b8e('0x13'));var logger=require(_0x2b8e('0x14'))(_0x2b8e('0x15'));var utils=require('../../config/utils');var config=require(_0x2b8e('0x16'));var licenseUtil=require(_0x2b8e('0x17'));var db=require(_0x2b8e('0x18'))['db'];function respondWithStatusCode(_0x485be3,_0x457fd9){_0x457fd9=_0x457fd9||0xcc;return function(_0x550b5a){if(_0x550b5a){return _0x485be3[_0x2b8e('0x19')](_0x457fd9);}return _0x485be3[_0x2b8e('0x1a')](_0x457fd9)[_0x2b8e('0x1b')]();};}function respondWithResult(_0xa57f19,_0x1c9cff){_0x1c9cff=_0x1c9cff||0xc8;return function(_0x19a05c){if(_0x19a05c){return _0xa57f19[_0x2b8e('0x1a')](_0x1c9cff)[_0x2b8e('0x1c')](_0x19a05c);}};}function respondWithFilteredResult(_0x3f6132,_0x59f870){return function(_0x505ca4){if(_0x505ca4){var _0x32d85d=typeof _0x59f870[_0x2b8e('0x1d')]===_0x2b8e('0x1e')&&typeof _0x59f870['limit']===_0x2b8e('0x1e');var _0x58f56c=_0x505ca4[_0x2b8e('0x1f')];var _0x393464=_0x32d85d?0x0:_0x59f870['offset'];var _0xb38c2=_0x32d85d?_0x505ca4[_0x2b8e('0x1f')]:_0x59f870[_0x2b8e('0x1d')]+_0x59f870[_0x2b8e('0x20')];var _0x3e7466;if(_0xb38c2>=_0x58f56c){_0xb38c2=_0x58f56c;_0x3e7466=0xc8;}else{_0x3e7466=0xce;}_0x3f6132[_0x2b8e('0x1a')](_0x3e7466);return _0x3f6132['set']('Content-Range',_0x393464+'-'+_0xb38c2+'/'+_0x58f56c)['json'](_0x505ca4);}return null;};}function patchUpdates(_0x14663d){return function(_0x4e3543){try{jsonpatch['apply'](_0x4e3543,_0x14663d,!![]);}catch(_0x3cdff4){return BPromise['reject'](_0x3cdff4);}return _0x4e3543[_0x2b8e('0x21')]();};}function saveUpdates(_0x3aea55,_0x5d4706){return function(_0x2859b4){if(_0x2859b4){return _0x2859b4[_0x2b8e('0x22')](_0x3aea55)[_0x2b8e('0x23')](function(_0x2a1f16){return _0x2a1f16;});}return null;};}function removeEntity(_0x1e674b,_0x1262ce){return function(_0x1c532c){if(_0x1c532c){return _0x1c532c['destroy']()[_0x2b8e('0x23')](function(){_0x1e674b[_0x2b8e('0x1a')](0xcc)[_0x2b8e('0x1b')]();});}};}function handleEntityNotFound(_0x30004e,_0xb46fdb){return function(_0xaad863){if(!_0xaad863){_0x30004e[_0x2b8e('0x19')](0x194);}return _0xaad863;};}function handleError(_0x2932a8,_0x506172){_0x506172=_0x506172||0x1f4;return function(_0x5d90b4){logger[_0x2b8e('0x24')](_0x5d90b4['stack']);if(_0x5d90b4['name']){delete _0x5d90b4['name'];}_0x2932a8[_0x2b8e('0x1a')](_0x506172)[_0x2b8e('0x25')](_0x5d90b4);};}exports[_0x2b8e('0x26')]=function(_0x477ec7,_0x44cae5){var _0x486336={},_0x46f4c5={},_0x3c1d1f={'count':0x0,'rows':[]};var _0x263b83=_[_0x2b8e('0x27')](db['Automation'][_0x2b8e('0x28')],function(_0x2a053c){return{'name':_0x2a053c[_0x2b8e('0x29')],'type':_0x2a053c[_0x2b8e('0x2a')]['key']};});_0x46f4c5[_0x2b8e('0x2b')]=_[_0x2b8e('0x27')](_0x263b83,_0x2b8e('0x2c'));_0x46f4c5[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x477ec7[_0x2b8e('0x2d')]);_0x46f4c5[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x46f4c5[_0x2b8e('0x2b')],_0x46f4c5[_0x2b8e('0x2d')]);_0x486336[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x46f4c5['model'],qs[_0x2b8e('0x32')](_0x477ec7['query'][_0x2b8e('0x32')]));_0x486336[_0x2b8e('0x31')]=_0x486336[_0x2b8e('0x31')][_0x2b8e('0x33')]?_0x486336[_0x2b8e('0x31')]:_0x46f4c5[_0x2b8e('0x2b')];if(!_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x34')](_0x2b8e('0x35'))){_0x486336['limit']=qs[_0x2b8e('0x20')](_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x20')]);_0x486336[_0x2b8e('0x1d')]=qs[_0x2b8e('0x1d')](_0x477ec7[_0x2b8e('0x2d')]['offset']);}_0x486336[_0x2b8e('0x36')]=qs[_0x2b8e('0x37')](_0x477ec7[_0x2b8e('0x2d')]['sort']);_0x486336[_0x2b8e('0x38')]=qs[_0x2b8e('0x2f')](_[_0x2b8e('0x39')](_0x477ec7[_0x2b8e('0x2d')],_0x46f4c5[_0x2b8e('0x2f')]),_0x263b83);if(_0x477ec7[_0x2b8e('0x2d')]['filter']){_0x486336['where']=_['merge'](_0x486336[_0x2b8e('0x38')],{'$or':_[_0x2b8e('0x27')](_0x263b83,function(_0xcf0da2){if(_0xcf0da2[_0x2b8e('0x2a')]!==_0x2b8e('0x3a')){var _0x5af89c={};_0x5af89c[_0xcf0da2[_0x2b8e('0x2c')]]={'$like':'%'+_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x3b')]+'%'};return _0x5af89c;}})});}_0x486336=_[_0x2b8e('0x3c')]({},_0x486336,_0x477ec7[_0x2b8e('0x3d')]);var _0x101ce9={'where':_0x486336[_0x2b8e('0x38')]};return db[_0x2b8e('0x3e')]['count'](_0x101ce9)[_0x2b8e('0x23')](function(_0xe06f10){_0x3c1d1f[_0x2b8e('0x1f')]=_0xe06f10;if(_0x477ec7[_0x2b8e('0x2d')][_0x2b8e('0x3f')]){_0x486336[_0x2b8e('0x40')]=[{'all':!![]}];}return db[_0x2b8e('0x3e')][_0x2b8e('0x41')](_0x486336);})[_0x2b8e('0x23')](function(_0x9271ab){_0x3c1d1f[_0x2b8e('0x42')]=_0x9271ab;return _0x3c1d1f;})[_0x2b8e('0x23')](respondWithFilteredResult(_0x44cae5,_0x486336))[_0x2b8e('0x43')](handleError(_0x44cae5,null));};exports[_0x2b8e('0x44')]=function(_0x3c86a4,_0x3d5e6c){var _0x3fa02c={'raw':![],'where':{'id':_0x3c86a4[_0x2b8e('0x45')]['id']}},_0x1d34d9={};_0x1d34d9[_0x2b8e('0x2b')]=_['keys'](db[_0x2b8e('0x3e')]['rawAttributes']);_0x1d34d9[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x3c86a4[_0x2b8e('0x2d')]);_0x1d34d9[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x1d34d9['model'],_0x1d34d9['query']);_0x3fa02c[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x1d34d9[_0x2b8e('0x2b')],qs[_0x2b8e('0x32')](_0x3c86a4[_0x2b8e('0x2d')]['fields']));_0x3fa02c[_0x2b8e('0x31')]=_0x3fa02c[_0x2b8e('0x31')][_0x2b8e('0x33')]?_0x3fa02c[_0x2b8e('0x31')]:_0x1d34d9['model'];if(_0x3c86a4[_0x2b8e('0x2d')]['includeAll']){_0x3fa02c[_0x2b8e('0x40')]=[{'all':!![]}];}_0x3fa02c=_[_0x2b8e('0x3c')]({},_0x3fa02c,_0x3c86a4['options']);return db[_0x2b8e('0x3e')][_0x2b8e('0x46')](_0x3fa02c)['then'](handleEntityNotFound(_0x3d5e6c,null))[_0x2b8e('0x23')](respondWithResult(_0x3d5e6c,null))[_0x2b8e('0x43')](handleError(_0x3d5e6c,null));};exports[_0x2b8e('0x47')]=function(_0x326231,_0x3429b4){return db[_0x2b8e('0x3e')][_0x2b8e('0x47')](_0x326231['body'],{})['then'](respondWithResult(_0x3429b4,0xc9))[_0x2b8e('0x43')](handleError(_0x3429b4,null));};exports['update']=function(_0xa43ae2,_0x11364a){if(_0xa43ae2[_0x2b8e('0x48')]['id']){delete _0xa43ae2[_0x2b8e('0x48')]['id'];}return db[_0x2b8e('0x3e')][_0x2b8e('0x46')]({'where':{'id':_0xa43ae2[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x11364a,null))[_0x2b8e('0x23')](saveUpdates(_0xa43ae2[_0x2b8e('0x48')],null))[_0x2b8e('0x23')](respondWithResult(_0x11364a,null))[_0x2b8e('0x43')](handleError(_0x11364a,null));};exports[_0x2b8e('0x49')]=function(_0x1f757e,_0xf3a9dc){return db['Automation'][_0x2b8e('0x46')]({'where':{'id':_0x1f757e[_0x2b8e('0x45')]['id']}})['then'](handleEntityNotFound(_0xf3a9dc,null))['then'](removeEntity(_0xf3a9dc,null))[_0x2b8e('0x43')](handleError(_0xf3a9dc,null));};exports[_0x2b8e('0x4a')]=function(_0x3b52c8,_0x490093,_0x5b0766){return db['Condition']['find']({'where':{'id':_0x3b52c8[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x490093,null))['then'](function(_0x49e515){if(_0x49e515){return _0x49e515['addConditions'](_0x3b52c8['body']['ids'],_[_0x2b8e('0x4b')](_0x3b52c8[_0x2b8e('0x48')],['ids','id'])||{});}})[_0x2b8e('0x23')](respondWithResult(_0x490093,null))[_0x2b8e('0x43')](handleError(_0x490093,null));};exports[_0x2b8e('0x4c')]=function(_0x13b943,_0x127e0b,_0x49845f){var _0x5ec869={};var _0x174e3c={};var _0x23e2c5;var _0x2c142a;return db[_0x2b8e('0x3e')][_0x2b8e('0x4d')]({'where':{'id':_0x13b943[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x127e0b,null))[_0x2b8e('0x23')](function(_0x20e2ef){if(_0x20e2ef){_0x23e2c5=_0x20e2ef;_0x174e3c[_0x2b8e('0x2b')]=_[_0x2b8e('0x2e')](db[_0x2b8e('0x4e')]['rawAttributes']);_0x174e3c[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x13b943['query']);_0x174e3c[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x174e3c[_0x2b8e('0x2b')],_0x174e3c['query']);_0x5ec869[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x174e3c[_0x2b8e('0x2b')],qs['fields'](_0x13b943['query'][_0x2b8e('0x32')]));_0x5ec869[_0x2b8e('0x31')]=_0x5ec869[_0x2b8e('0x31')][_0x2b8e('0x33')]?_0x5ec869[_0x2b8e('0x31')]:_0x174e3c[_0x2b8e('0x2b')];_0x5ec869[_0x2b8e('0x36')]=qs[_0x2b8e('0x37')](_0x13b943[_0x2b8e('0x2d')][_0x2b8e('0x37')]);_0x5ec869[_0x2b8e('0x38')]=qs['filters'](_[_0x2b8e('0x39')](_0x13b943[_0x2b8e('0x2d')],_0x174e3c[_0x2b8e('0x2f')]));if(_0x13b943['query'][_0x2b8e('0x3b')]){_0x5ec869[_0x2b8e('0x38')]=_[_0x2b8e('0x3c')](_0x5ec869['where'],{'$or':_[_0x2b8e('0x27')](_0x5ec869[_0x2b8e('0x31')],function(_0x14da1c){var _0x1ed4a6={};_0x1ed4a6[_0x14da1c]={'$like':'%'+_0x13b943[_0x2b8e('0x2d')][_0x2b8e('0x3b')]+'%'};return _0x1ed4a6;})});}_0x5ec869=_[_0x2b8e('0x3c')]({},_0x5ec869,_0x13b943['options']);return _0x23e2c5[_0x2b8e('0x4c')](_0x5ec869);}})['then'](function(_0x59c54c){if(_0x59c54c){_0x2c142a=_0x59c54c[_0x2b8e('0x33')];if(!_0x13b943[_0x2b8e('0x2d')][_0x2b8e('0x34')](_0x2b8e('0x35'))){_0x5ec869[_0x2b8e('0x20')]=qs[_0x2b8e('0x20')](_0x13b943[_0x2b8e('0x2d')]['limit']);_0x5ec869['offset']=qs[_0x2b8e('0x1d')](_0x13b943['query'][_0x2b8e('0x1d')]);}return _0x23e2c5[_0x2b8e('0x4c')](_0x5ec869);}})[_0x2b8e('0x23')](function(_0x387fe2){if(_0x387fe2){return _0x387fe2?{'count':_0x2c142a,'rows':_0x387fe2}:null;}})[_0x2b8e('0x23')](respondWithResult(_0x127e0b,null))[_0x2b8e('0x43')](handleError(_0x127e0b,null));};exports[_0x2b8e('0x4f')]=function(_0x1d9e6d,_0x43dfd8,_0x42d4f7){return db[_0x2b8e('0x50')][_0x2b8e('0x46')]({'where':{'id':_0x1d9e6d[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x43dfd8,null))[_0x2b8e('0x23')](function(_0x1d8b83){if(_0x1d8b83){return _0x1d8b83['addActions'](_0x1d9e6d['body'][_0x2b8e('0x51')],_[_0x2b8e('0x4b')](_0x1d9e6d[_0x2b8e('0x48')],['ids','id'])||{});}})[_0x2b8e('0x23')](respondWithResult(_0x43dfd8,null))[_0x2b8e('0x43')](handleError(_0x43dfd8,null));};exports[_0x2b8e('0x52')]=function(_0x11fd30,_0x365a82,_0xf0c876){var _0xaa0b56={};var _0x258afa={};var _0x483781;var _0x2eb2ce;return db[_0x2b8e('0x3e')][_0x2b8e('0x4d')]({'where':{'id':_0x11fd30[_0x2b8e('0x45')]['id']}})[_0x2b8e('0x23')](handleEntityNotFound(_0x365a82,null))[_0x2b8e('0x23')](function(_0x10024c){if(_0x10024c){_0x483781=_0x10024c;_0x258afa['model']=_['keys'](db[_0x2b8e('0x50')][_0x2b8e('0x28')]);_0x258afa[_0x2b8e('0x2d')]=_[_0x2b8e('0x2e')](_0x11fd30['query']);_0x258afa[_0x2b8e('0x2f')]=_[_0x2b8e('0x30')](_0x258afa['model'],_0x258afa[_0x2b8e('0x2d')]);_0xaa0b56[_0x2b8e('0x31')]=_[_0x2b8e('0x30')](_0x258afa[_0x2b8e('0x2b')],qs[_0x2b8e('0x32')](_0x11fd30[_0x2b8e('0x2d')]['fields']));_0xaa0b56[_0x2b8e('0x31')]=_0xaa0b56[_0x2b8e('0x31')]['length']?_0xaa0b56[_0x2b8e('0x31')]:_0x258afa['model'];_0xaa0b56[_0x2b8e('0x36')]=qs[_0x2b8e('0x37')](_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x37')]);_0xaa0b56[_0x2b8e('0x38')]=qs['filters'](_[_0x2b8e('0x39')](_0x11fd30[_0x2b8e('0x2d')],_0x258afa[_0x2b8e('0x2f')]));if(_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x3b')]){_0xaa0b56[_0x2b8e('0x38')]=_[_0x2b8e('0x3c')](_0xaa0b56['where'],{'$or':_['map'](_0xaa0b56['attributes'],function(_0x1e3718){var _0x236f92={};_0x236f92[_0x1e3718]={'$like':'%'+_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x3b')]+'%'};return _0x236f92;})});}_0xaa0b56=_[_0x2b8e('0x3c')]({},_0xaa0b56,_0x11fd30[_0x2b8e('0x3d')]);return _0x483781[_0x2b8e('0x52')](_0xaa0b56);}})[_0x2b8e('0x23')](function(_0x2af65e){if(_0x2af65e){_0x2eb2ce=_0x2af65e['length'];if(!_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x34')]('nolimit')){_0xaa0b56[_0x2b8e('0x20')]=qs[_0x2b8e('0x20')](_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x20')]);_0xaa0b56[_0x2b8e('0x1d')]=qs[_0x2b8e('0x1d')](_0x11fd30[_0x2b8e('0x2d')][_0x2b8e('0x1d')]);}return _0x483781['getActions'](_0xaa0b56);}})[_0x2b8e('0x23')](function(_0x3564c1){if(_0x3564c1){return _0x3564c1?{'count':_0x2eb2ce,'rows':_0x3564c1}:null;}})[_0x2b8e('0x23')](respondWithResult(_0x365a82,null))[_0x2b8e('0x43')](handleError(_0x365a82,null));}; \ No newline at end of file +var _0x23c7=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','rawAttributes','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','Automation','intersection','find','create','body','params','addConditions','omit','ids','findOne','Condition','getConditions','hasOwnProperty','Action','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','desk.js'];(function(_0x5404f6,_0x5900a7){var _0x13230b=function(_0x15be12){while(--_0x15be12){_0x5404f6['push'](_0x5404f6['shift']());}};_0x13230b(++_0x5900a7);}(_0x23c7,0x196));var _0x723c=function(_0x1e689e,_0x52abd7){_0x1e689e=_0x1e689e-0x0;var _0x571b73=_0x23c7[_0x1e689e];return _0x571b73;};'use strict';var emlformat=require(_0x723c('0x0'));var rimraf=require(_0x723c('0x1'));var zipdir=require(_0x723c('0x2'));var jsonpatch=require(_0x723c('0x3'));var rp=require(_0x723c('0x4'));var moment=require(_0x723c('0x5'));var BPromise=require(_0x723c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x723c('0x7'));var sox=require(_0x723c('0x8'));var csv=require(_0x723c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x723c('0xa'));var _=require('lodash');var squel=require(_0x723c('0xb'));var crypto=require(_0x723c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x723c('0xd'));var toCsv=require(_0x723c('0x9'));var querystring=require(_0x723c('0xe'));var Papa=require(_0x723c('0xf'));var Redis=require(_0x723c('0x10'));var authService=require(_0x723c('0x11'));var qs=require(_0x723c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x723c('0x13'))(_0x723c('0x14'));var utils=require(_0x723c('0x15'));var config=require(_0x723c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10b45e,_0x3c2b7f){_0x3c2b7f=_0x3c2b7f||0xcc;return function(_0x1a5e4a){if(_0x1a5e4a){return _0x10b45e[_0x723c('0x17')](_0x3c2b7f);}return _0x10b45e[_0x723c('0x18')](_0x3c2b7f)['end']();};}function respondWithResult(_0x37be10,_0x419bdf){_0x419bdf=_0x419bdf||0xc8;return function(_0xb55094){if(_0xb55094){return _0x37be10['status'](_0x419bdf)[_0x723c('0x19')](_0xb55094);}};}function respondWithFilteredResult(_0x1b9d9b,_0x16f388){return function(_0x41418a){if(_0x41418a){var _0x5f5cdf=typeof _0x16f388[_0x723c('0x1a')]===_0x723c('0x1b')&&typeof _0x16f388[_0x723c('0x1c')]==='undefined';var _0x576365=_0x41418a[_0x723c('0x1d')];var _0x17b4ad=_0x5f5cdf?0x0:_0x16f388[_0x723c('0x1a')];var _0x34541e=_0x5f5cdf?_0x41418a['count']:_0x16f388[_0x723c('0x1a')]+_0x16f388['limit'];var _0x281353;if(_0x34541e>=_0x576365){_0x34541e=_0x576365;_0x281353=0xc8;}else{_0x281353=0xce;}_0x1b9d9b[_0x723c('0x18')](_0x281353);return _0x1b9d9b[_0x723c('0x1e')](_0x723c('0x1f'),_0x17b4ad+'-'+_0x34541e+'/'+_0x576365)[_0x723c('0x19')](_0x41418a);}return null;};}function patchUpdates(_0x26c08d){return function(_0x51256c){try{jsonpatch[_0x723c('0x20')](_0x51256c,_0x26c08d,!![]);}catch(_0x2f89e6){return BPromise[_0x723c('0x21')](_0x2f89e6);}return _0x51256c[_0x723c('0x22')]();};}function saveUpdates(_0x496814,_0x904754){return function(_0x311474){if(_0x311474){return _0x311474['update'](_0x496814)[_0x723c('0x23')](function(_0x305c0a){return _0x305c0a;});}return null;};}function removeEntity(_0x16dade,_0x56766e){return function(_0x31dc68){if(_0x31dc68){return _0x31dc68[_0x723c('0x24')]()[_0x723c('0x23')](function(){_0x16dade[_0x723c('0x18')](0xcc)[_0x723c('0x25')]();});}};}function handleEntityNotFound(_0x42c35f,_0x51fc19){return function(_0xe40c1b){if(!_0xe40c1b){_0x42c35f[_0x723c('0x17')](0x194);}return _0xe40c1b;};}function handleError(_0x3dd6a9,_0x47ca29){_0x47ca29=_0x47ca29||0x1f4;return function(_0x5da838){logger[_0x723c('0x26')](_0x5da838[_0x723c('0x27')]);if(_0x5da838[_0x723c('0x28')]){delete _0x5da838[_0x723c('0x28')];}_0x3dd6a9[_0x723c('0x18')](_0x47ca29)[_0x723c('0x29')](_0x5da838);};}exports['index']=function(_0x2f5289,_0xbf5499){var _0x3d48ff={},_0x3311ed={},_0x4de30a={'count':0x0,'rows':[]};var _0xb90522=_['map'](db['Automation'][_0x723c('0x2a')],function(_0x38ae0e){return{'name':_0x38ae0e['fieldName'],'type':_0x38ae0e['type'][_0x723c('0x2b')]};});_0x3311ed[_0x723c('0x2c')]=_[_0x723c('0x2d')](_0xb90522,'name');_0x3311ed[_0x723c('0x2e')]=_[_0x723c('0x2f')](_0x2f5289[_0x723c('0x2e')]);_0x3311ed[_0x723c('0x30')]=_['intersection'](_0x3311ed[_0x723c('0x2c')],_0x3311ed['query']);_0x3d48ff[_0x723c('0x31')]=_['intersection'](_0x3311ed[_0x723c('0x2c')],qs[_0x723c('0x32')](_0x2f5289[_0x723c('0x2e')][_0x723c('0x32')]));_0x3d48ff[_0x723c('0x31')]=_0x3d48ff['attributes'][_0x723c('0x33')]?_0x3d48ff['attributes']:_0x3311ed['model'];if(!_0x2f5289[_0x723c('0x2e')]['hasOwnProperty'](_0x723c('0x34'))){_0x3d48ff[_0x723c('0x1c')]=qs[_0x723c('0x1c')](_0x2f5289['query']['limit']);_0x3d48ff['offset']=qs[_0x723c('0x1a')](_0x2f5289[_0x723c('0x2e')]['offset']);}_0x3d48ff[_0x723c('0x35')]=qs[_0x723c('0x36')](_0x2f5289[_0x723c('0x2e')][_0x723c('0x36')]);_0x3d48ff[_0x723c('0x37')]=qs[_0x723c('0x30')](_[_0x723c('0x38')](_0x2f5289['query'],_0x3311ed['filters']),_0xb90522);if(_0x2f5289[_0x723c('0x2e')][_0x723c('0x39')]){_0x3d48ff[_0x723c('0x37')]=_[_0x723c('0x3a')](_0x3d48ff[_0x723c('0x37')],{'$or':_[_0x723c('0x2d')](_0xb90522,function(_0x2ab5f9){if(_0x2ab5f9[_0x723c('0x3b')]!==_0x723c('0x3c')){var _0x49924f={};_0x49924f[_0x2ab5f9[_0x723c('0x28')]]={'$like':'%'+_0x2f5289['query']['filter']+'%'};return _0x49924f;}})});}_0x3d48ff=_[_0x723c('0x3a')]({},_0x3d48ff,_0x2f5289[_0x723c('0x3d')]);var _0x4d7d3c={'where':_0x3d48ff[_0x723c('0x37')]};return db['Automation'][_0x723c('0x1d')](_0x4d7d3c)['then'](function(_0x580d51){_0x4de30a['count']=_0x580d51;if(_0x2f5289[_0x723c('0x2e')][_0x723c('0x3e')]){_0x3d48ff[_0x723c('0x3f')]=[{'all':!![]}];}return db['Automation'][_0x723c('0x40')](_0x3d48ff);})[_0x723c('0x23')](function(_0x40ade7){_0x4de30a[_0x723c('0x41')]=_0x40ade7;return _0x4de30a;})[_0x723c('0x23')](respondWithFilteredResult(_0xbf5499,_0x3d48ff))[_0x723c('0x42')](handleError(_0xbf5499,null));};exports[_0x723c('0x43')]=function(_0x21dff6,_0x469a3a){var _0x34d5c1={'raw':![],'where':{'id':_0x21dff6['params']['id']}},_0x4b96d1={};_0x4b96d1[_0x723c('0x2c')]=_[_0x723c('0x2f')](db[_0x723c('0x44')][_0x723c('0x2a')]);_0x4b96d1[_0x723c('0x2e')]=_[_0x723c('0x2f')](_0x21dff6['query']);_0x4b96d1['filters']=_[_0x723c('0x45')](_0x4b96d1['model'],_0x4b96d1['query']);_0x34d5c1[_0x723c('0x31')]=_[_0x723c('0x45')](_0x4b96d1['model'],qs[_0x723c('0x32')](_0x21dff6[_0x723c('0x2e')][_0x723c('0x32')]));_0x34d5c1[_0x723c('0x31')]=_0x34d5c1[_0x723c('0x31')][_0x723c('0x33')]?_0x34d5c1[_0x723c('0x31')]:_0x4b96d1['model'];if(_0x21dff6[_0x723c('0x2e')][_0x723c('0x3e')]){_0x34d5c1['include']=[{'all':!![]}];}_0x34d5c1=_[_0x723c('0x3a')]({},_0x34d5c1,_0x21dff6[_0x723c('0x3d')]);return db[_0x723c('0x44')][_0x723c('0x46')](_0x34d5c1)[_0x723c('0x23')](handleEntityNotFound(_0x469a3a,null))[_0x723c('0x23')](respondWithResult(_0x469a3a,null))[_0x723c('0x42')](handleError(_0x469a3a,null));};exports[_0x723c('0x47')]=function(_0x594c67,_0x4d3313){return db[_0x723c('0x44')][_0x723c('0x47')](_0x594c67['body'],{})[_0x723c('0x23')](respondWithResult(_0x4d3313,0xc9))[_0x723c('0x42')](handleError(_0x4d3313,null));};exports['update']=function(_0x4c5756,_0x209b93){if(_0x4c5756[_0x723c('0x48')]['id']){delete _0x4c5756[_0x723c('0x48')]['id'];}return db[_0x723c('0x44')][_0x723c('0x46')]({'where':{'id':_0x4c5756[_0x723c('0x49')]['id']}})[_0x723c('0x23')](handleEntityNotFound(_0x209b93,null))[_0x723c('0x23')](saveUpdates(_0x4c5756[_0x723c('0x48')],null))[_0x723c('0x23')](respondWithResult(_0x209b93,null))['catch'](handleError(_0x209b93,null));};exports[_0x723c('0x24')]=function(_0x4b18bb,_0x240537){return db[_0x723c('0x44')]['find']({'where':{'id':_0x4b18bb[_0x723c('0x49')]['id']}})['then'](handleEntityNotFound(_0x240537,null))['then'](removeEntity(_0x240537,null))[_0x723c('0x42')](handleError(_0x240537,null));};exports[_0x723c('0x4a')]=function(_0x3961bb,_0x11df52,_0x2e1404){return db['Condition']['find']({'where':{'id':_0x3961bb[_0x723c('0x49')]['id']}})[_0x723c('0x23')](handleEntityNotFound(_0x11df52,null))[_0x723c('0x23')](function(_0x459df4){if(_0x459df4){return _0x459df4[_0x723c('0x4a')](_0x3961bb[_0x723c('0x48')]['ids'],_[_0x723c('0x4b')](_0x3961bb[_0x723c('0x48')],[_0x723c('0x4c'),'id'])||{});}})[_0x723c('0x23')](respondWithResult(_0x11df52,null))[_0x723c('0x42')](handleError(_0x11df52,null));};exports['getConditions']=function(_0x184e7e,_0x3cd27e,_0x6c95bf){var _0x3592db={};var _0x483f47={};var _0x546029;var _0x33ce10;return db['Automation'][_0x723c('0x4d')]({'where':{'id':_0x184e7e[_0x723c('0x49')]['id']}})[_0x723c('0x23')](handleEntityNotFound(_0x3cd27e,null))['then'](function(_0x3208e5){if(_0x3208e5){_0x546029=_0x3208e5;_0x483f47[_0x723c('0x2c')]=_[_0x723c('0x2f')](db[_0x723c('0x4e')][_0x723c('0x2a')]);_0x483f47['query']=_[_0x723c('0x2f')](_0x184e7e['query']);_0x483f47[_0x723c('0x30')]=_[_0x723c('0x45')](_0x483f47[_0x723c('0x2c')],_0x483f47['query']);_0x3592db[_0x723c('0x31')]=_[_0x723c('0x45')](_0x483f47[_0x723c('0x2c')],qs[_0x723c('0x32')](_0x184e7e['query'][_0x723c('0x32')]));_0x3592db[_0x723c('0x31')]=_0x3592db['attributes'][_0x723c('0x33')]?_0x3592db[_0x723c('0x31')]:_0x483f47['model'];_0x3592db['order']=qs['sort'](_0x184e7e[_0x723c('0x2e')][_0x723c('0x36')]);_0x3592db[_0x723c('0x37')]=qs[_0x723c('0x30')](_[_0x723c('0x38')](_0x184e7e[_0x723c('0x2e')],_0x483f47[_0x723c('0x30')]));if(_0x184e7e[_0x723c('0x2e')][_0x723c('0x39')]){_0x3592db['where']=_[_0x723c('0x3a')](_0x3592db[_0x723c('0x37')],{'$or':_[_0x723c('0x2d')](_0x3592db[_0x723c('0x31')],function(_0x4652ee){var _0x181464={};_0x181464[_0x4652ee]={'$like':'%'+_0x184e7e[_0x723c('0x2e')][_0x723c('0x39')]+'%'};return _0x181464;})});}_0x3592db=_[_0x723c('0x3a')]({},_0x3592db,_0x184e7e['options']);return _0x546029[_0x723c('0x4f')](_0x3592db);}})['then'](function(_0x380f00){if(_0x380f00){_0x33ce10=_0x380f00[_0x723c('0x33')];if(!_0x184e7e['query'][_0x723c('0x50')](_0x723c('0x34'))){_0x3592db['limit']=qs['limit'](_0x184e7e['query'][_0x723c('0x1c')]);_0x3592db['offset']=qs[_0x723c('0x1a')](_0x184e7e[_0x723c('0x2e')][_0x723c('0x1a')]);}return _0x546029['getConditions'](_0x3592db);}})[_0x723c('0x23')](function(_0x42988e){if(_0x42988e){return _0x42988e?{'count':_0x33ce10,'rows':_0x42988e}:null;}})[_0x723c('0x23')](respondWithResult(_0x3cd27e,null))[_0x723c('0x42')](handleError(_0x3cd27e,null));};exports['addActions']=function(_0x2e1199,_0x4a99b6,_0x1855d8){return db[_0x723c('0x51')][_0x723c('0x46')]({'where':{'id':_0x2e1199[_0x723c('0x49')]['id']}})[_0x723c('0x23')](handleEntityNotFound(_0x4a99b6,null))[_0x723c('0x23')](function(_0x3e472a){if(_0x3e472a){return _0x3e472a[_0x723c('0x52')](_0x2e1199[_0x723c('0x48')][_0x723c('0x4c')],_[_0x723c('0x4b')](_0x2e1199[_0x723c('0x48')],[_0x723c('0x4c'),'id'])||{});}})[_0x723c('0x23')](respondWithResult(_0x4a99b6,null))[_0x723c('0x42')](handleError(_0x4a99b6,null));};exports[_0x723c('0x53')]=function(_0x46f4eb,_0x4fdf1d,_0xb79bd7){var _0xa612ff={};var _0x29da06={};var _0x52ffe1;var _0x2fc2c2;return db[_0x723c('0x44')][_0x723c('0x4d')]({'where':{'id':_0x46f4eb[_0x723c('0x49')]['id']}})[_0x723c('0x23')](handleEntityNotFound(_0x4fdf1d,null))['then'](function(_0xa4b052){if(_0xa4b052){_0x52ffe1=_0xa4b052;_0x29da06[_0x723c('0x2c')]=_[_0x723c('0x2f')](db[_0x723c('0x51')][_0x723c('0x2a')]);_0x29da06['query']=_[_0x723c('0x2f')](_0x46f4eb[_0x723c('0x2e')]);_0x29da06[_0x723c('0x30')]=_['intersection'](_0x29da06[_0x723c('0x2c')],_0x29da06['query']);_0xa612ff[_0x723c('0x31')]=_[_0x723c('0x45')](_0x29da06['model'],qs[_0x723c('0x32')](_0x46f4eb[_0x723c('0x2e')][_0x723c('0x32')]));_0xa612ff[_0x723c('0x31')]=_0xa612ff[_0x723c('0x31')][_0x723c('0x33')]?_0xa612ff[_0x723c('0x31')]:_0x29da06[_0x723c('0x2c')];_0xa612ff[_0x723c('0x35')]=qs[_0x723c('0x36')](_0x46f4eb[_0x723c('0x2e')][_0x723c('0x36')]);_0xa612ff[_0x723c('0x37')]=qs['filters'](_[_0x723c('0x38')](_0x46f4eb[_0x723c('0x2e')],_0x29da06['filters']));if(_0x46f4eb['query'][_0x723c('0x39')]){_0xa612ff[_0x723c('0x37')]=_[_0x723c('0x3a')](_0xa612ff[_0x723c('0x37')],{'$or':_[_0x723c('0x2d')](_0xa612ff['attributes'],function(_0x9c7f3){var _0x43233d={};_0x43233d[_0x9c7f3]={'$like':'%'+_0x46f4eb['query'][_0x723c('0x39')]+'%'};return _0x43233d;})});}_0xa612ff=_[_0x723c('0x3a')]({},_0xa612ff,_0x46f4eb[_0x723c('0x3d')]);return _0x52ffe1[_0x723c('0x53')](_0xa612ff);}})[_0x723c('0x23')](function(_0x3e349e){if(_0x3e349e){_0x2fc2c2=_0x3e349e[_0x723c('0x33')];if(!_0x46f4eb[_0x723c('0x2e')][_0x723c('0x50')]('nolimit')){_0xa612ff[_0x723c('0x1c')]=qs[_0x723c('0x1c')](_0x46f4eb[_0x723c('0x2e')][_0x723c('0x1c')]);_0xa612ff[_0x723c('0x1a')]=qs['offset'](_0x46f4eb['query'][_0x723c('0x1a')]);}return _0x52ffe1['getActions'](_0xa612ff);}})[_0x723c('0x23')](function(_0x2f7b36){if(_0x2f7b36){return _0x2f7b36?{'count':_0x2fc2c2,'rows':_0x2f7b36}:null;}})[_0x723c('0x23')](respondWithResult(_0x4fdf1d,null))['catch'](handleError(_0x4fdf1d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ef94876..f585585 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 _0xab7a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util'];(function(_0x346454,_0x4be199){var _0x198086=function(_0x2af467){while(--_0x2af467){_0x346454['push'](_0x346454['shift']());}};_0x198086(++_0x4be199);}(_0xab7a,0x179));var _0xaab7=function(_0x5230ed,_0x2eb03e){_0x5230ed=_0x5230ed-0x0;var _0x43bb42=_0xab7a[_0x5230ed];return _0x43bb42;};'use strict';var _=require('lodash');var util=require(_0xaab7('0x0'));var logger=require(_0xaab7('0x1'))(_0xaab7('0x2'));var moment=require(_0xaab7('0x3'));var BPromise=require(_0xaab7('0x4'));var rp=require(_0xaab7('0x5'));var fs=require('fs');var path=require(_0xaab7('0x6'));var rimraf=require(_0xaab7('0x7'));var config=require(_0xaab7('0x8'));var attributes=require(_0xaab7('0x9'));module[_0xaab7('0xa')]=function(_0x3a9630,_0x2aadd2){return _0x3a9630[_0xaab7('0xb')](_0xaab7('0xc'),attributes,{'tableName':_0xaab7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2f4=['define','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x3658dd,_0xfa5782){var _0x226b60=function(_0x2a792d){while(--_0x2a792d){_0x3658dd['push'](_0x3658dd['shift']());}};_0x226b60(++_0xfa5782);}(_0xa2f4,0xc7));var _0x4a2f=function(_0x552097,_0x225983){_0x552097=_0x552097-0x0;var _0x2a98a0=_0xa2f4[_0x552097];return _0x2a98a0;};'use strict';var _=require(_0x4a2f('0x0'));var util=require(_0x4a2f('0x1'));var logger=require(_0x4a2f('0x2'))(_0x4a2f('0x3'));var moment=require('moment');var BPromise=require(_0x4a2f('0x4'));var rp=require(_0x4a2f('0x5'));var fs=require('fs');var path=require(_0x4a2f('0x6'));var rimraf=require(_0x4a2f('0x7'));var config=require(_0x4a2f('0x8'));var attributes=require(_0x4a2f('0x9'));module[_0x4a2f('0xa')]=function(_0x15319a,_0x2bcf24){return _0x15319a[_0x4a2f('0xb')](_0x4a2f('0xc'),attributes,{'tableName':_0x4a2f('0xd'),'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 14aa701..7bccfcf 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 _0xeaab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xeaab,0xd9));var _0xbeaa=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xeaab[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xbeaa('0x0'));var util=require('util');var moment=require(_0xbeaa('0x1'));var BPromise=require(_0xbeaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbeaa('0x3'))['db'];var utils=require(_0xbeaa('0x4'));var logger=require(_0xbeaa('0x5'))(_0xbeaa('0x6'));var config=require(_0xbeaa('0x7'));var jayson=require(_0xbeaa('0x8'));var client=jayson[_0xbeaa('0x9')][_0xbeaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f015b,_0x42a779,_0x346043){return new BPromise(function(_0x2da505,_0x15a826){return client[_0xbeaa('0xb')](_0x2f015b,_0x346043)['then'](function(_0x389c0b){logger[_0xbeaa('0xc')](_0xbeaa('0xd'),_0x42a779,_0xbeaa('0xe'));logger[_0xbeaa('0xf')](_0xbeaa('0x10'),_0x42a779,_0xbeaa('0xe'),JSON['stringify'](_0x389c0b));if(_0x389c0b[_0xbeaa('0x11')]){if(_0x389c0b['error'][_0xbeaa('0x12')]===0x1f4){logger[_0xbeaa('0x11')]('Automation,\x20%s,\x20%s',_0x42a779,_0x389c0b[_0xbeaa('0x11')]['message']);return _0x15a826(_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);}logger['error'](_0xbeaa('0xd'),_0x42a779,_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);return _0x2da505(_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);}else{logger[_0xbeaa('0xc')](_0xbeaa('0xd'),_0x42a779,_0xbeaa('0xe'));_0x2da505(_0x389c0b[_0xbeaa('0x14')][_0xbeaa('0x13')]);}})[_0xbeaa('0x15')](function(_0x1cc387){logger[_0xbeaa('0x11')](_0xbeaa('0xd'),_0x42a779,_0x1cc387);_0x15a826(_0x1cc387);});});} \ No newline at end of file +var _0x341c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x5e56d4,_0x1edae9){var _0x5c0784=function(_0x516ab1){while(--_0x516ab1){_0x5e56d4['push'](_0x5e56d4['shift']());}};_0x5c0784(++_0x1edae9);}(_0x341c,0xcc));var _0xc341=function(_0x74a76c,_0x87c60d){_0x74a76c=_0x74a76c-0x0;var _0x3d8e25=_0x341c[_0x74a76c];return _0x3d8e25;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var moment=require(_0xc341('0x1'));var BPromise=require('bluebird');var rs=require(_0xc341('0x2'));var fs=require('fs');var Redis=require(_0xc341('0x3'));var db=require(_0xc341('0x4'))['db'];var utils=require(_0xc341('0x5'));var logger=require(_0xc341('0x6'))(_0xc341('0x7'));var config=require(_0xc341('0x8'));var jayson=require(_0xc341('0x9'));var client=jayson['client'][_0xc341('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c5b4,_0x296387,_0x31ce96){return new BPromise(function(_0x3e83c9,_0x53aab7){return client[_0xc341('0xb')](_0x13c5b4,_0x31ce96)[_0xc341('0xc')](function(_0x3f08b0){logger[_0xc341('0xd')](_0xc341('0xe'),_0x296387,_0xc341('0xf'));logger['debug'](_0xc341('0x10'),_0x296387,_0xc341('0xf'),JSON[_0xc341('0x11')](_0x3f08b0));if(_0x3f08b0[_0xc341('0x12')]){if(_0x3f08b0[_0xc341('0x12')][_0xc341('0x13')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x296387,_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);return _0x53aab7(_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);}logger[_0xc341('0x12')]('Automation,\x20%s,\x20%s',_0x296387,_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);return _0x3e83c9(_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);}else{logger[_0xc341('0xd')](_0xc341('0xe'),_0x296387,_0xc341('0xf'));_0x3e83c9(_0x3f08b0[_0xc341('0x15')][_0xc341('0x14')]);}})[_0xc341('0x16')](function(_0x1d499c){logger['error']('Automation,\x20%s,\x20%s',_0x296387,_0x1d499c);_0x53aab7(_0x1d499c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 40ae9f2..c3ea129 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 _0x54f3=['show','get','/:id/actions','post','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','index','/:id','isAuthenticated'];(function(_0x710c48,_0x5557){var _0x4d89ad=function(_0x114ea4){while(--_0x114ea4){_0x710c48['push'](_0x710c48['shift']());}};_0x4d89ad(++_0x5557);}(_0x54f3,0x120));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0x354f('0x0'));var path=require(_0x354f('0x1'));var timeout=require(_0x354f('0x2'));var express=require(_0x354f('0x3'));var router=express[_0x354f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var controller=require(_0x354f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x354f('0x8')]);router['get'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller[_0x354f('0xb')]);router[_0x354f('0xc')]('/:id/conditions',auth[_0x354f('0xa')](),controller['getConditions']);router[_0x354f('0xc')](_0x354f('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x354f('0xe')]('/',auth[_0x354f('0xa')](),controller['create']);router[_0x354f('0xe')](_0x354f('0xf'),auth['isAuthenticated'](),controller[_0x354f('0x10')]);router[_0x354f('0xe')](_0x354f('0xd'),auth[_0x354f('0xa')](),controller[_0x354f('0x11')]);router[_0x354f('0x12')](_0x354f('0x9'),auth['isAuthenticated'](),controller[_0x354f('0x13')]);router[_0x354f('0x14')](_0x354f('0x9'),auth['isAuthenticated'](),controller[_0x354f('0x15')]);module[_0x354f('0x16')]=router; \ No newline at end of file +var _0xf041=['post','addConditions','addActions','put','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x1c1f17,_0x1cc243){var _0x41aa9f=function(_0x574438){while(--_0x574438){_0x1c1f17['push'](_0x1c1f17['shift']());}};_0x41aa9f(++_0x1cc243);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f04('0x0'));var timeout=require(_0x1f04('0x1'));var express=require(_0x1f04('0x2'));var router=express[_0x1f04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f04('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f04('0x5'));var controller=require('./automation.controller');router['get']('/',auth[_0x1f04('0x6')](),controller['index']);router[_0x1f04('0x7')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x9')]);router['get'](_0x1f04('0xa'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xb')]);router[_0x1f04('0x7')](_0x1f04('0xc'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xd')]);router[_0x1f04('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f04('0xe')](_0x1f04('0xa'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xf')]);router[_0x1f04('0xe')](_0x1f04('0xc'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x10')]);router[_0x1f04('0x11')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller['update']);router['delete'](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x12')]);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 bd704db..91e028a 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 _0xe96e=['Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED'];(function(_0x1eaa6f,_0x556e77){var _0x370839=function(_0x22e3fe){while(--_0x22e3fe){_0x1eaa6f['push'](_0x1eaa6f['shift']());}};_0x370839(++_0x556e77);}(_0xe96e,0x8b));var _0xee96=function(_0x42250b,_0x407254){_0x42250b=_0x42250b-0x0;var _0x431436=_0xe96e[_0x42250b];return _0x431436;};'use strict';var Sequelize=require(_0xee96('0x0'));module[_0xee96('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xee96('0x2')](_0xee96('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xee96('0x4')]},'active':{'type':Sequelize[_0xee96('0x5')],'defaultValue':0x0,'comment':_0xee96('0x6')},'limitCalls':{'type':Sequelize[_0xee96('0x7')](0x4)[_0xee96('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xee96('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xee96('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xee96('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'comment':_0xee96('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xee96('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xee96('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xee96('0x12'),'never',_0xee96('0x13')),'defaultValue':_0xee96('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xee96('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xee96('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xee96('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xee96('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xee96('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xee96('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xee96('0x7')](0x9)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xee96('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xee96('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xee96('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xee96('0x1b'),_0xee96('0x1c')),'defaultValue':_0xee96('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xee96('0x1d')},'dialCutDigit':{'type':Sequelize[_0xee96('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xee96('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xee96('0x7')](0x3)[_0xee96('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xee96('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xee96('0x7')](0x5)[_0xee96('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xee96('0x24')}}; \ No newline at end of file +var _0xeb7c=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\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)','sequelize','STRING','name','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','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)','07:00-22:00,*,*,*','ENUM','always','never','Active/Disactive\x20AMD','#AMD\x20Greeting'];(function(_0x663a3b,_0x551af3){var _0x5b6211=function(_0x540053){while(--_0x540053){_0x663a3b['push'](_0x663a3b['shift']());}};_0x5b6211(++_0x551af3);}(_0xeb7c,0x10c));var _0xceb7=function(_0x5c1c13,_0x223388){_0x5c1c13=_0x5c1c13-0x0;var _0x4d9e2f=_0xeb7c[_0x5c1c13];return _0x4d9e2f;};'use strict';var Sequelize=require(_0xceb7('0x0'));module['exports']={'name':{'type':Sequelize[_0xceb7('0x1')],'unique':_0xceb7('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xceb7('0x1')]},'active':{'type':Sequelize[_0xceb7('0x3')],'defaultValue':0x0,'comment':_0xceb7('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xceb7('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb7('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)[_0xceb7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb7('0x8')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb7('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb7('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'comment':_0xceb7('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb7('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xceb7('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xceb7('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xceb7('0xf')](_0xceb7('0x10'),_0xceb7('0x11'),'onlyIfOpen'),'defaultValue':_0xceb7('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xceb7('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xceb7('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xceb7('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xceb7('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xceb7('0x7')](0x9)[_0xceb7('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xceb7('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xceb7('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xceb7('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xceb7('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xceb7('0x7')](0x9)[_0xceb7('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xceb7('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xceb7('0x7')](0x5)[_0xceb7('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xceb7('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xceb7('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xceb7('0xf')]('DESC',_0xceb7('0x18')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xceb7('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xceb7('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb7('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb7('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb7('0x1b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)[_0xceb7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb7('0x1c')},'dialMachineRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)[_0xceb7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb7('0x1d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xceb7('0x7')](0x3)[_0xceb7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb7('0x1e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xceb7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb7('0x1f')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c3a5526..b03b105 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 _0x352a=['omit','updatedAt','createdAt','getHoppers','CmHopper','order','CampaignId','getHopperHistories','CmHopperHistory','findOne','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','removeLists','CmList','getBlackLists','addBlackLists','push','sequelize','all','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x221b48,_0x18067f){var _0x360677=function(_0x1def10){while(--_0x1def10){_0x221b48['push'](_0x221b48['shift']());}};_0x360677(++_0x18067f);}(_0x352a,0x1cf));var _0xa352=function(_0x582c98,_0x53b3a0){_0x582c98=_0x582c98-0x0;var _0x593449=_0x352a[_0x582c98];return _0x593449;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa352('0x0'));var jsonpatch=require(_0xa352('0x1'));var rp=require(_0xa352('0x2'));var moment=require(_0xa352('0x3'));var BPromise=require(_0xa352('0x4'));var Mustache=require(_0xa352('0x5'));var util=require(_0xa352('0x6'));var path=require(_0xa352('0x7'));var sox=require(_0xa352('0x8'));var csv=require(_0xa352('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa352('0xa'));var _=require(_0xa352('0xb'));var squel=require(_0xa352('0xc'));var crypto=require(_0xa352('0xd'));var jsforce=require(_0xa352('0xe'));var deskjs=require(_0xa352('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa352('0x10'));var Redis=require(_0xa352('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa352('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa352('0x13'));var logger=require(_0xa352('0x14'))(_0xa352('0x15'));var utils=require(_0xa352('0x16'));var config=require(_0xa352('0x17'));var licenseUtil=require(_0xa352('0x18'));var db=require(_0xa352('0x19'))['db'];function respondWithStatusCode(_0x1d67cc,_0x1d48b7){_0x1d48b7=_0x1d48b7||0xcc;return function(_0x78f114){if(_0x78f114){return _0x1d67cc[_0xa352('0x1a')](_0x1d48b7);}return _0x1d67cc[_0xa352('0x1b')](_0x1d48b7)[_0xa352('0x1c')]();};}function respondWithResult(_0x41661a,_0x4e0944){_0x4e0944=_0x4e0944||0xc8;return function(_0x25cbb8){if(_0x25cbb8){return _0x41661a[_0xa352('0x1b')](_0x4e0944)[_0xa352('0x1d')](_0x25cbb8);}};}function respondWithFilteredResult(_0x58711f,_0x5c2495){return function(_0x47afb9){if(_0x47afb9){var _0x386f74=typeof _0x5c2495[_0xa352('0x1e')]==='undefined'&&typeof _0x5c2495['limit']===_0xa352('0x1f');var _0x40000d=_0x47afb9[_0xa352('0x20')];var _0x36109a=_0x386f74?0x0:_0x5c2495[_0xa352('0x1e')];var _0x4e9aba=_0x386f74?_0x47afb9[_0xa352('0x20')]:_0x5c2495[_0xa352('0x1e')]+_0x5c2495[_0xa352('0x21')];var _0x4c638e;if(_0x4e9aba>=_0x40000d){_0x4e9aba=_0x40000d;_0x4c638e=0xc8;}else{_0x4c638e=0xce;}_0x58711f['status'](_0x4c638e);return _0x58711f[_0xa352('0x22')](_0xa352('0x23'),_0x36109a+'-'+_0x4e9aba+'/'+_0x40000d)['json'](_0x47afb9);}return null;};}function patchUpdates(_0x8f7708){return function(_0x18ea7d){try{jsonpatch[_0xa352('0x24')](_0x18ea7d,_0x8f7708,!![]);}catch(_0x537684){return BPromise[_0xa352('0x25')](_0x537684);}return _0x18ea7d[_0xa352('0x26')]();};}function saveUpdates(_0x5ec290,_0x185568){return function(_0x23b937){if(_0x23b937){return _0x23b937[_0xa352('0x27')](_0x5ec290)[_0xa352('0x28')](function(_0x449e67){return _0x449e67;});}return null;};}function removeEntity(_0x33efa3,_0x5ae928){return function(_0x360e7d){if(_0x360e7d){return _0x360e7d[_0xa352('0x29')]()[_0xa352('0x28')](function(){var _0x20a207=_0x360e7d[_0xa352('0x2a')]({'plain':!![]});var _0x95168=_0xa352('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x95168,'resourceId':_0x20a207['id']}})[_0xa352('0x28')](function(){return _0x360e7d;});})[_0xa352('0x28')](function(){_0x33efa3[_0xa352('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce9f8,_0x133c98){return function(_0x102730){if(!_0x102730){_0x2ce9f8[_0xa352('0x1a')](0x194);}return _0x102730;};}function handleError(_0x23fadb,_0x3069f0){_0x3069f0=_0x3069f0||0x1f4;return function(_0x495332){logger[_0xa352('0x2c')](_0x495332[_0xa352('0x2d')]);if(_0x495332['name']){delete _0x495332[_0xa352('0x2e')];}_0x23fadb[_0xa352('0x1b')](_0x3069f0)['send'](_0x495332);};}exports[_0xa352('0x2f')]=function(_0x272659,_0x47a32e){var _0x443efd={},_0x50e4f0={},_0x8406b8={'count':0x0,'rows':[]};var _0xa61354=_[_0xa352('0x30')](db[_0xa352('0x31')][_0xa352('0x32')],function(_0x1847a8){return{'name':_0x1847a8[_0xa352('0x33')],'type':_0x1847a8[_0xa352('0x34')][_0xa352('0x35')]};});_0x50e4f0[_0xa352('0x36')]=_[_0xa352('0x30')](_0xa61354,'name');_0x50e4f0[_0xa352('0x37')]=_[_0xa352('0x38')](_0x272659[_0xa352('0x37')]);_0x50e4f0[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x50e4f0[_0xa352('0x36')],_0x50e4f0[_0xa352('0x37')]);_0x443efd[_0xa352('0x3b')]=_['intersection'](_0x50e4f0['model'],qs[_0xa352('0x3c')](_0x272659[_0xa352('0x37')][_0xa352('0x3c')]));_0x443efd[_0xa352('0x3b')]=_0x443efd[_0xa352('0x3b')]['length']?_0x443efd[_0xa352('0x3b')]:_0x50e4f0['model'];if(!_0x272659[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x443efd['limit']=qs['limit'](_0x272659['query'][_0xa352('0x21')]);_0x443efd[_0xa352('0x1e')]=qs['offset'](_0x272659[_0xa352('0x37')][_0xa352('0x1e')]);}_0x443efd['order']=qs['sort'](_0x272659['query'][_0xa352('0x3f')]);_0x443efd[_0xa352('0x40')]=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x272659[_0xa352('0x37')],_0x50e4f0[_0xa352('0x39')]),_0xa61354);if(_0x272659[_0xa352('0x37')][_0xa352('0x42')]){_0x443efd[_0xa352('0x40')]=_[_0xa352('0x43')](_0x443efd[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0xa61354,function(_0x4e0f7f){if(_0x4e0f7f[_0xa352('0x34')]!==_0xa352('0x44')){var _0x5eb3f0={};_0x5eb3f0[_0x4e0f7f[_0xa352('0x2e')]]={'$like':'%'+_0x272659['query'][_0xa352('0x42')]+'%'};return _0x5eb3f0;}})});}_0x443efd=_['merge']({},_0x443efd,_0x272659[_0xa352('0x45')]);var _0x2ac1ee={'where':_0x443efd[_0xa352('0x40')]};return db[_0xa352('0x31')][_0xa352('0x20')](_0x2ac1ee)['then'](function(_0x24f8c5){_0x8406b8['count']=_0x24f8c5;if(_0x272659[_0xa352('0x37')][_0xa352('0x46')]){_0x443efd[_0xa352('0x47')]=[{'all':!![]}];}return db['Campaign'][_0xa352('0x48')](_0x443efd);})[_0xa352('0x28')](function(_0x341b1a){_0x8406b8[_0xa352('0x49')]=_0x341b1a;return _0x8406b8;})[_0xa352('0x28')](respondWithFilteredResult(_0x47a32e,_0x443efd))['catch'](handleError(_0x47a32e,null));};exports[_0xa352('0x4a')]=function(_0x4c4ca7,_0x4abdd4){var _0x5d94ce={'raw':![],'where':{'id':_0x4c4ca7[_0xa352('0x4b')]['id']}},_0x3ad3c0={};_0x3ad3c0[_0xa352('0x36')]=_['keys'](db[_0xa352('0x31')][_0xa352('0x32')]);_0x3ad3c0['query']=_[_0xa352('0x38')](_0x4c4ca7[_0xa352('0x37')]);_0x3ad3c0[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x3ad3c0['model'],_0x3ad3c0['query']);_0x5d94ce[_0xa352('0x3b')]=_[_0xa352('0x3a')](_0x3ad3c0[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x4c4ca7[_0xa352('0x37')][_0xa352('0x3c')]));_0x5d94ce[_0xa352('0x3b')]=_0x5d94ce[_0xa352('0x3b')][_0xa352('0x4c')]?_0x5d94ce[_0xa352('0x3b')]:_0x3ad3c0[_0xa352('0x36')];if(_0x4c4ca7[_0xa352('0x37')][_0xa352('0x46')]){_0x5d94ce[_0xa352('0x47')]=[{'all':!![]}];}_0x5d94ce=_[_0xa352('0x43')]({},_0x5d94ce,_0x4c4ca7[_0xa352('0x45')]);return db[_0xa352('0x31')]['find'](_0x5d94ce)[_0xa352('0x28')](handleEntityNotFound(_0x4abdd4,null))[_0xa352('0x28')](respondWithResult(_0x4abdd4,null))[_0xa352('0x4d')](handleError(_0x4abdd4,null));};exports[_0xa352('0x4e')]=function(_0x4f37a9,_0x3bccde){return db['Campaign'][_0xa352('0x4e')](_0x4f37a9[_0xa352('0x4f')],{})[_0xa352('0x28')](function(_0x56cf36){var _0x57ef1a=_0x4f37a9[_0xa352('0x50')][_0xa352('0x2a')]({'plain':!![]});if(!_0x57ef1a)throw new Error(_0xa352('0x51'));if(_0x57ef1a[_0xa352('0x52')]===_0xa352('0x50')){var _0x892b25=_0x56cf36['get']({'plain':!![]});var _0x10c5fe=_0xa352('0x2b');return db[_0xa352('0x53')][_0xa352('0x54')]({'where':{'name':_0x10c5fe,'userProfileId':_0x57ef1a[_0xa352('0x55')]},'raw':!![]})[_0xa352('0x28')](function(_0x57dec4){if(_0x57dec4&&_0x57dec4[_0xa352('0x56')]===0x0){return db[_0xa352('0x57')]['create']({'name':_0x892b25[_0xa352('0x2e')],'resourceId':_0x892b25['id'],'type':_0x57dec4[_0xa352('0x2e')],'sectionId':_0x57dec4['id']},{})[_0xa352('0x28')](function(){return _0x56cf36;});}else{return _0x56cf36;}})[_0xa352('0x4d')](function(_0x20b9f6){logger[_0xa352('0x2c')](_0xa352('0x58'),_0x20b9f6);throw _0x20b9f6;});}return _0x56cf36;})[_0xa352('0x28')](respondWithResult(_0x3bccde,0xc9))[_0xa352('0x4d')](handleError(_0x3bccde,null));};exports['clone']=function(_0x5d433a,_0x297506){var _0x1f67cb={'where':{'id':_0x5d433a[_0xa352('0x4b')]['id']}},_0x1cbb2e={};_0x1cbb2e[_0xa352('0x36')]=_[_0xa352('0x38')](db[_0xa352('0x31')][_0xa352('0x32')]);_0x1f67cb[_0xa352('0x3b')]=_['intersection'](_0x1cbb2e[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x5d433a[_0xa352('0x37')]['fields']));_0x1f67cb[_0xa352('0x3b')]=_0x1f67cb[_0xa352('0x3b')][_0xa352('0x4c')]?_0x1f67cb['attributes']:_0x1cbb2e['model'];if(_0x5d433a[_0xa352('0x37')][_0xa352('0x46')]){_0x1f67cb['include']=[{'all':!![]}];}_0x1f67cb=_[_0xa352('0x43')]({},_0x1f67cb,_0x5d433a[_0xa352('0x45')]);return db['Campaign'][_0xa352('0x54')](_0x1f67cb)[_0xa352('0x28')](handleEntityNotFound(_0x297506,null))['then'](function(_0x128ead){if(_0x128ead){var _0x4649cc=_0x128ead['get']({'plain':!![]});_0x4649cc=qs[_0xa352('0x59')](_0x4649cc,['id','createdAt',_0xa352('0x5a')]);_0x5d433a['body']=_[_0xa352('0x59')](_0x5d433a[_0xa352('0x4f')],['id',_0xa352('0x5b'),_0xa352('0x5a')]);return db[_0xa352('0x31')][_0xa352('0x4e')](_['merge'](_0x4649cc,_0x5d433a[_0xa352('0x4f')]),{'include':_0x5d433a['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa352('0x28')](function(_0x48fbc5){var _0x472e0d=_0x5d433a[_0xa352('0x50')][_0xa352('0x2a')]({'plain':!![]});if(!_0x472e0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x472e0d['role']==='user'){var _0x31848f=_0x48fbc5[_0xa352('0x2a')]({'plain':!![]});var _0x211d77=_0xa352('0x2b');return db[_0xa352('0x53')]['find']({'where':{'name':_0x211d77,'userProfileId':_0x472e0d[_0xa352('0x55')]},'raw':!![]})[_0xa352('0x28')](function(_0x337c81){if(_0x337c81&&_0x337c81['autoAssociation']===0x0){return db[_0xa352('0x57')][_0xa352('0x4e')]({'name':_0x31848f[_0xa352('0x2e')],'resourceId':_0x31848f['id'],'type':_0x337c81[_0xa352('0x2e')],'sectionId':_0x337c81['id']},{})[_0xa352('0x28')](function(){return _0x48fbc5;});}else{return _0x48fbc5;}})[_0xa352('0x4d')](function(_0x14074b){logger[_0xa352('0x2c')](_0xa352('0x58'),_0x14074b);throw _0x14074b;});}return _0x48fbc5;});}})[_0xa352('0x28')](respondWithResult(_0x297506,0xc9))[_0xa352('0x4d')](handleError(_0x297506,null));};exports[_0xa352('0x27')]=function(_0xa2a6fd,_0x1da2de){if(_0xa2a6fd[_0xa352('0x4f')]['id']){delete _0xa2a6fd[_0xa352('0x4f')]['id'];}return db[_0xa352('0x31')][_0xa352('0x54')]({'where':{'id':_0xa2a6fd[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1da2de,null))[_0xa352('0x28')](saveUpdates(_0xa2a6fd['body'],null))[_0xa352('0x28')](respondWithResult(_0x1da2de,null))[_0xa352('0x4d')](handleError(_0x1da2de,null));};exports[_0xa352('0x29')]=function(_0x27e670,_0x70ee12){return db['Campaign']['find']({'where':{'id':_0x27e670[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x70ee12,null))[_0xa352('0x28')](removeEntity(_0x70ee12,null))[_0xa352('0x4d')](handleError(_0x70ee12,null));};exports[_0xa352('0x5c')]=function(_0x300669,_0x49f100,_0x46ca7b){var _0x205733={'raw':!![],'where':{}};var _0x377769={};var _0x45df9c={'count':0x0,'rows':[]};return db[_0xa352('0x31')]['findOne']({'where':{'id':_0x300669[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49f100,null))[_0xa352('0x28')](function(_0x1c2d44){if(_0x1c2d44){_0x377769['model']=_['keys'](db[_0xa352('0x5d')]['rawAttributes']);_0x377769[_0xa352('0x37')]=_['keys'](_0x300669[_0xa352('0x37')]);_0x377769['filters']=_[_0xa352('0x3a')](_0x377769[_0xa352('0x36')],_0x377769[_0xa352('0x37')]);_0x205733[_0xa352('0x3b')]=_[_0xa352('0x3a')](_0x377769[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x300669[_0xa352('0x37')][_0xa352('0x3c')]));_0x205733[_0xa352('0x3b')]=_0x205733[_0xa352('0x3b')][_0xa352('0x4c')]?_0x205733[_0xa352('0x3b')]:_0x377769[_0xa352('0x36')];if(!_0x300669['query'][_0xa352('0x3d')](_0xa352('0x3e'))){_0x205733[_0xa352('0x21')]=qs[_0xa352('0x21')](_0x300669['query'][_0xa352('0x21')]);_0x205733[_0xa352('0x1e')]=qs['offset'](_0x300669[_0xa352('0x37')][_0xa352('0x1e')]);}_0x205733[_0xa352('0x5e')]=qs[_0xa352('0x3f')](_0x300669[_0xa352('0x37')][_0xa352('0x3f')]);_0x205733[_0xa352('0x40')]=qs['filters'](_[_0xa352('0x41')](_0x300669[_0xa352('0x37')],_0x377769[_0xa352('0x39')]));_0x205733[_0xa352('0x40')][_0xa352('0x5f')]=_0x1c2d44['id'];if(_0x300669[_0xa352('0x37')][_0xa352('0x42')]){_0x205733['where']=_[_0xa352('0x43')](_0x205733[_0xa352('0x40')],{'$or':_['map'](_0x205733[_0xa352('0x3b')],function(_0x38ae8c){var _0x5d9441={};_0x5d9441[_0x38ae8c]={'$like':'%'+_0x300669['query'][_0xa352('0x42')]+'%'};return _0x5d9441;})});}_0x205733=_['merge']({},_0x205733,_0x300669[_0xa352('0x45')]);return db[_0xa352('0x5d')][_0xa352('0x20')]({'where':_0x205733[_0xa352('0x40')]})[_0xa352('0x28')](function(_0x4b84af){_0x45df9c[_0xa352('0x20')]=_0x4b84af;if(_0x300669[_0xa352('0x37')][_0xa352('0x46')]){_0x205733['include']=[{'all':!![]}];}return db['CmHopper'][_0xa352('0x48')](_0x205733);})[_0xa352('0x28')](function(_0x5542b4){_0x45df9c['rows']=_0x5542b4;return _0x45df9c;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x49f100,_0x205733))['catch'](handleError(_0x49f100,null));};exports[_0xa352('0x60')]=function(_0x9d98c2,_0x7e77b4,_0x226833){var _0x1d17ca={'raw':!![],'where':{}};var _0x403b07={};var _0x2269ab={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x9d98c2[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x7e77b4,null))['then'](function(_0x5b9815){if(_0x5b9815){_0x403b07[_0xa352('0x36')]=_[_0xa352('0x38')](db[_0xa352('0x61')][_0xa352('0x32')]);_0x403b07[_0xa352('0x37')]=_['keys'](_0x9d98c2[_0xa352('0x37')]);_0x403b07[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x403b07['model'],_0x403b07[_0xa352('0x37')]);_0x1d17ca['attributes']=_[_0xa352('0x3a')](_0x403b07[_0xa352('0x36')],qs['fields'](_0x9d98c2[_0xa352('0x37')]['fields']));_0x1d17ca['attributes']=_0x1d17ca['attributes'][_0xa352('0x4c')]?_0x1d17ca[_0xa352('0x3b')]:_0x403b07[_0xa352('0x36')];if(!_0x9d98c2[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x1d17ca[_0xa352('0x21')]=qs['limit'](_0x9d98c2['query'][_0xa352('0x21')]);_0x1d17ca[_0xa352('0x1e')]=qs['offset'](_0x9d98c2['query']['offset']);}_0x1d17ca[_0xa352('0x5e')]=qs['sort'](_0x9d98c2[_0xa352('0x37')]['sort']);_0x1d17ca[_0xa352('0x40')]=qs['filters'](_['pick'](_0x9d98c2[_0xa352('0x37')],_0x403b07['filters']));_0x1d17ca['where'][_0xa352('0x5f')]=_0x5b9815['id'];if(_0x9d98c2[_0xa352('0x37')][_0xa352('0x42')]){_0x1d17ca[_0xa352('0x40')]=_['merge'](_0x1d17ca['where'],{'$or':_[_0xa352('0x30')](_0x1d17ca[_0xa352('0x3b')],function(_0x11a892){var _0x147285={};_0x147285[_0x11a892]={'$like':'%'+_0x9d98c2[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x147285;})});}_0x1d17ca=_[_0xa352('0x43')]({},_0x1d17ca,_0x9d98c2['options']);return db[_0xa352('0x61')][_0xa352('0x20')]({'where':_0x1d17ca[_0xa352('0x40')]})['then'](function(_0x4cad83){_0x2269ab[_0xa352('0x20')]=_0x4cad83;if(_0x9d98c2[_0xa352('0x37')][_0xa352('0x46')]){_0x1d17ca[_0xa352('0x47')]=[{'all':!![]}];}return db[_0xa352('0x61')]['findAll'](_0x1d17ca);})['then'](function(_0x58cf70){_0x2269ab['rows']=_0x58cf70;return _0x2269ab;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x7e77b4,_0x1d17ca))[_0xa352('0x4d')](handleError(_0x7e77b4,null));};exports['getHopperFinals']=function(_0x22e14f,_0x3107f1,_0x45d0bc){var _0x4a496c={'raw':!![],'where':{}};var _0x5a4974={};var _0x3739f9={'count':0x0,'rows':[]};return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x22e14f['params']['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x3107f1,null))[_0xa352('0x28')](function(_0x45ca82){if(_0x45ca82){_0x5a4974[_0xa352('0x36')]=_[_0xa352('0x38')](db[_0xa352('0x63')][_0xa352('0x32')]);_0x5a4974[_0xa352('0x37')]=_[_0xa352('0x38')](_0x22e14f['query']);_0x5a4974[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x5a4974[_0xa352('0x36')],_0x5a4974[_0xa352('0x37')]);_0x4a496c['attributes']=_[_0xa352('0x3a')](_0x5a4974['model'],qs['fields'](_0x22e14f[_0xa352('0x37')][_0xa352('0x3c')]));_0x4a496c['attributes']=_0x4a496c[_0xa352('0x3b')][_0xa352('0x4c')]?_0x4a496c['attributes']:_0x5a4974['model'];if(!_0x22e14f[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x4a496c['limit']=qs[_0xa352('0x21')](_0x22e14f[_0xa352('0x37')][_0xa352('0x21')]);_0x4a496c[_0xa352('0x1e')]=qs['offset'](_0x22e14f[_0xa352('0x37')][_0xa352('0x1e')]);}_0x4a496c['order']=qs[_0xa352('0x3f')](_0x22e14f[_0xa352('0x37')]['sort']);_0x4a496c[_0xa352('0x40')]=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x22e14f[_0xa352('0x37')],_0x5a4974['filters']));_0x4a496c[_0xa352('0x40')][_0xa352('0x5f')]=_0x45ca82['id'];if(_0x22e14f['query'][_0xa352('0x42')]){_0x4a496c['where']=_[_0xa352('0x43')](_0x4a496c['where'],{'$or':_[_0xa352('0x30')](_0x4a496c[_0xa352('0x3b')],function(_0x142638){var _0x3db962={};_0x3db962[_0x142638]={'$like':'%'+_0x22e14f[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x3db962;})});}_0x4a496c=_[_0xa352('0x43')]({},_0x4a496c,_0x22e14f[_0xa352('0x45')]);return db[_0xa352('0x63')][_0xa352('0x20')]({'where':_0x4a496c['where']})['then'](function(_0x558d0d){_0x3739f9['count']=_0x558d0d;if(_0x22e14f[_0xa352('0x37')][_0xa352('0x46')]){_0x4a496c[_0xa352('0x47')]=[{'all':!![]}];}return db[_0xa352('0x63')][_0xa352('0x48')](_0x4a496c);})['then'](function(_0x38e7ca){_0x3739f9['rows']=_0x38e7ca;return _0x3739f9;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x3107f1,_0x4a496c))[_0xa352('0x4d')](handleError(_0x3107f1,null));};exports['getHopperBlacks']=function(_0x2434ba,_0x3c5a41,_0x4f336a){var _0x221b69={'raw':!![],'where':{}};var _0x1158f2={};var _0x29ae0f={'count':0x0,'rows':[]};return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x2434ba[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x3c5a41,null))[_0xa352('0x28')](function(_0x343b29){if(_0x343b29){_0x1158f2[_0xa352('0x36')]=_['keys'](db[_0xa352('0x64')]['rawAttributes']);_0x1158f2[_0xa352('0x37')]=_[_0xa352('0x38')](_0x2434ba[_0xa352('0x37')]);_0x1158f2[_0xa352('0x39')]=_['intersection'](_0x1158f2['model'],_0x1158f2[_0xa352('0x37')]);_0x221b69['attributes']=_[_0xa352('0x3a')](_0x1158f2['model'],qs[_0xa352('0x3c')](_0x2434ba[_0xa352('0x37')][_0xa352('0x3c')]));_0x221b69[_0xa352('0x3b')]=_0x221b69[_0xa352('0x3b')][_0xa352('0x4c')]?_0x221b69[_0xa352('0x3b')]:_0x1158f2['model'];if(!_0x2434ba['query'][_0xa352('0x3d')](_0xa352('0x3e'))){_0x221b69[_0xa352('0x21')]=qs[_0xa352('0x21')](_0x2434ba['query'][_0xa352('0x21')]);_0x221b69['offset']=qs['offset'](_0x2434ba[_0xa352('0x37')][_0xa352('0x1e')]);}_0x221b69[_0xa352('0x5e')]=qs['sort'](_0x2434ba[_0xa352('0x37')][_0xa352('0x3f')]);_0x221b69[_0xa352('0x40')]=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x2434ba[_0xa352('0x37')],_0x1158f2[_0xa352('0x39')]));_0x221b69[_0xa352('0x40')]['CampaignId']=_0x343b29['id'];if(_0x2434ba['query'][_0xa352('0x42')]){_0x221b69[_0xa352('0x40')]=_[_0xa352('0x43')](_0x221b69[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0x221b69[_0xa352('0x3b')],function(_0x348b4a){var _0xdfaa5f={};_0xdfaa5f[_0x348b4a]={'$like':'%'+_0x2434ba[_0xa352('0x37')]['filter']+'%'};return _0xdfaa5f;})});}_0x221b69=_[_0xa352('0x43')]({},_0x221b69,_0x2434ba[_0xa352('0x45')]);return db[_0xa352('0x64')][_0xa352('0x20')]({'where':_0x221b69['where']})[_0xa352('0x28')](function(_0x1972e9){_0x29ae0f['count']=_0x1972e9;if(_0x2434ba[_0xa352('0x37')][_0xa352('0x46')]){_0x221b69[_0xa352('0x47')]=[{'all':!![]}];}return db[_0xa352('0x64')][_0xa352('0x48')](_0x221b69);})[_0xa352('0x28')](function(_0x37a3f1){_0x29ae0f['rows']=_0x37a3f1;return _0x29ae0f;});}})[_0xa352('0x28')](respondWithFilteredResult(_0x3c5a41,_0x221b69))[_0xa352('0x4d')](handleError(_0x3c5a41,null));};exports[_0xa352('0x65')]=function(_0x193e77,_0x26b610,_0xd16bb3){var _0x640ee5={};var _0x6757ce={};var _0x536182;var _0x2b4ddc;return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x193e77[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x26b610,null))[_0xa352('0x28')](function(_0xb14634){if(_0xb14634){_0x536182=_0xb14634;_0x6757ce[_0xa352('0x36')]=_['keys'](db['CmList']['rawAttributes']);_0x6757ce['query']=_[_0xa352('0x38')](_0x193e77[_0xa352('0x37')]);_0x6757ce['filters']=_[_0xa352('0x3a')](_0x6757ce[_0xa352('0x36')],_0x6757ce[_0xa352('0x37')]);_0x640ee5[_0xa352('0x3b')]=_[_0xa352('0x3a')](_0x6757ce[_0xa352('0x36')],qs['fields'](_0x193e77[_0xa352('0x37')][_0xa352('0x3c')]));_0x640ee5[_0xa352('0x3b')]=_0x640ee5['attributes'][_0xa352('0x4c')]?_0x640ee5[_0xa352('0x3b')]:_0x6757ce[_0xa352('0x36')];_0x640ee5[_0xa352('0x5e')]=qs[_0xa352('0x3f')](_0x193e77[_0xa352('0x37')]['sort']);_0x640ee5[_0xa352('0x40')]=qs['filters'](_[_0xa352('0x41')](_0x193e77[_0xa352('0x37')],_0x6757ce[_0xa352('0x39')]));if(_0x193e77[_0xa352('0x37')]['filter']){_0x640ee5[_0xa352('0x40')]=_[_0xa352('0x43')](_0x640ee5[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0x640ee5['attributes'],function(_0x52d3d4){var _0x52e1a4={};_0x52e1a4[_0x52d3d4]={'$like':'%'+_0x193e77[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x52e1a4;})});}_0x640ee5=_[_0xa352('0x43')]({},_0x640ee5,_0x193e77[_0xa352('0x45')]);return _0x536182['getLists'](_0x640ee5);}})['then'](function(_0x3efc5c){if(_0x3efc5c){_0x2b4ddc=_0x3efc5c['length'];if(!_0x193e77['query']['hasOwnProperty'](_0xa352('0x3e'))){_0x640ee5[_0xa352('0x21')]=qs['limit'](_0x193e77[_0xa352('0x37')]['limit']);_0x640ee5[_0xa352('0x1e')]=qs[_0xa352('0x1e')](_0x193e77['query'][_0xa352('0x1e')]);}return _0x536182[_0xa352('0x65')](_0x640ee5);}})[_0xa352('0x28')](function(_0x568ac2){if(_0x568ac2){return _0x568ac2?{'count':_0x2b4ddc,'rows':_0x568ac2}:null;}})[_0xa352('0x28')](respondWithResult(_0x26b610,null))[_0xa352('0x4d')](handleError(_0x26b610,null));};exports[_0xa352('0x66')]=function(_0x52a741,_0x9f68ae,_0x326414){var _0x28d4d6,_0x1b8ab7;return db[_0xa352('0x31')][_0xa352('0x54')]({'where':{'id':_0x52a741['params']['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x9f68ae,null))['then'](function(_0x335931){if(_0x335931){_0x1b8ab7=_0x335931;return _0x335931[_0xa352('0x66')](_0x52a741[_0xa352('0x4f')][_0xa352('0x67')],_[_0xa352('0x59')](_0x52a741[_0xa352('0x4f')],[_0xa352('0x67'),'id'])||{});}return null;})[_0xa352('0x68')](function(_0xfb95cd){var _0x521ccf;_0x28d4d6=_0xfb95cd||[];var _0x5d7222=[];if(_0xfb95cd){for(var _0x52c012=0x0;_0x52c012<_0xfb95cd[_0xa352('0x4c')];_0x52c012+=0x1){var _0x41b946=_0xfb95cd[_0x52c012][_0xa352('0x2a')]({'plain':!![]});_0x1b8ab7[_0xa352('0x69')]=_0x52a741[_0xa352('0x4f')][_0xa352('0x69')]?_0x52a741[_0xa352('0x4f')][_0xa352('0x69')]:_0x1b8ab7['dialCheckDuplicateType'];switch(_0x1b8ab7[_0xa352('0x69')]){case _0xa352('0x6a'):_0x521ccf=squel['insert']()[_0xa352('0x6b')](_0xa352('0x6c'))[_0xa352('0x6d')]([_0xa352('0x6e'),_0xa352('0x6f'),_0xa352('0x70'),_0xa352('0x71'),'CampaignId',_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()['field'](_0xa352('0x6e'),_0xa352('0x6e'))[_0xa352('0x73')](_0xa352('0x74'),_0xa352('0x6f'))[_0xa352('0x73')]('id',_0xa352('0x70'))['field'](_0x41b946[_0xa352('0x75')]['toString'](),_0xa352('0x71'))['field'](_0x52a741[_0xa352('0x4b')]['id'][_0xa352('0x76')](),_0xa352('0x5f'))['field'](_0xa352('0x74'),_0xa352('0x5b'))[_0xa352('0x73')](_0xa352('0x74'),_0xa352('0x5a'))[_0xa352('0x77')](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))[_0xa352('0x40')]('ListId\x20=\x20?',_0x41b946[_0xa352('0x75')]['toString']())[_0xa352('0x40')](_0xa352('0x7a'))['where'](_0xa352('0x7b'),squel[_0xa352('0x72')]()['field'](_0xa352('0x7c'))[_0xa352('0x77')]('cm_hopper_final')['where'](_0xa352('0x7d'),_0x52a741['params']['id'][_0xa352('0x76')]()))[_0xa352('0x40')](_0xa352('0x7b'),squel[_0xa352('0x72')]()['field']('COALESCE(phone,\x27\x27)')[_0xa352('0x77')](_0xa352('0x6c'))[_0xa352('0x40')]('CampaignId\x20=\x20?',_0x52a741[_0xa352('0x4b')]['id'][_0xa352('0x76')]())))[_0xa352('0x76')]();break;case _0xa352('0x7e'):_0x521ccf=squel[_0xa352('0x7f')]()[_0xa352('0x6b')](_0xa352('0x6c'))[_0xa352('0x6d')](['phone',_0xa352('0x6f'),_0xa352('0x70'),'ListId',_0xa352('0x5f'),_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()[_0xa352('0x73')](_0xa352('0x6e'),_0xa352('0x6e'))['field'](_0xa352('0x74'),_0xa352('0x6f'))['field']('id',_0xa352('0x70'))[_0xa352('0x73')](_0x41b946[_0xa352('0x75')]['toString'](),_0xa352('0x71'))[_0xa352('0x73')](_0x52a741['params']['id'][_0xa352('0x76')](),'CampaignId')[_0xa352('0x73')]('NOW()',_0xa352('0x5b'))['field']('NOW()',_0xa352('0x5a'))['from'](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))['where'](_0xa352('0x80'),_0x41b946[_0xa352('0x75')][_0xa352('0x76')]())[_0xa352('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0xa352('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa352('0x72')]()['field'](_0xa352('0x81'))['from'](_0xa352('0x6c'))[_0xa352('0x40')](_0xa352('0x7d'),_0x52a741[_0xa352('0x4b')]['id']['toString']())))[_0xa352('0x76')]();break;default:_0x521ccf=squel[_0xa352('0x7f')]()[_0xa352('0x6b')](_0xa352('0x6c'))[_0xa352('0x6d')]([_0xa352('0x6e'),_0xa352('0x6f'),_0xa352('0x70'),_0xa352('0x71'),_0xa352('0x5f'),_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()[_0xa352('0x73')]('phone','phone')['field'](_0xa352('0x74'),_0xa352('0x6f'))[_0xa352('0x73')]('id',_0xa352('0x70'))['field'](_0x41b946[_0xa352('0x75')][_0xa352('0x76')](),_0xa352('0x71'))[_0xa352('0x73')](_0x52a741[_0xa352('0x4b')]['id']['toString'](),_0xa352('0x5f'))[_0xa352('0x73')]('NOW()','createdAt')[_0xa352('0x73')](_0xa352('0x74'),_0xa352('0x5a'))[_0xa352('0x77')](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))[_0xa352('0x40')]('ListId\x20=\x20?',_0x41b946[_0xa352('0x75')][_0xa352('0x76')]())[_0xa352('0x40')](_0xa352('0x7a')))[_0xa352('0x76')]();}_0x5d7222['push'](db['sequelize'][_0xa352('0x37')](_0x521ccf));}return BPromise['all'](_0x5d7222);}})[_0xa352('0x28')](function(){return _0x28d4d6;})[_0xa352('0x28')](respondWithResult(_0x9f68ae,null))[_0xa352('0x4d')](handleError(_0x9f68ae,null));};exports[_0xa352('0x82')]=function(_0x38df59,_0x3e53d8,_0x11d053){return db['Campaign']['find']({'where':{'id':_0x38df59[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e53d8,null))[_0xa352('0x28')](function(_0x4c71df){if(_0x4c71df){return _0x4c71df[_0xa352('0x82')](_0x38df59[_0xa352('0x37')][_0xa352('0x67')]);}})[_0xa352('0x28')](function(_0x5ada38){if(_0x5ada38){return db[_0xa352('0x5d')][_0xa352('0x29')]({'where':{'ListId':_0x38df59[_0xa352('0x37')][_0xa352('0x67')],'CampaignId':_0x38df59['params']['id']}})['then'](function(){return _0x5ada38;});}})['then'](respondWithStatusCode(_0x3e53d8,null))['catch'](handleError(_0x3e53d8,null));};exports['getBlackLists']=function(_0x1d5788,_0x292bff,_0x11a37a){var _0x2f34d3={};var _0x15179f={};var _0x29b810;var _0x18d8bd;return db[_0xa352('0x31')][_0xa352('0x62')]({'where':{'id':_0x1d5788[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x292bff,null))['then'](function(_0x38f1fd){if(_0x38f1fd){_0x29b810=_0x38f1fd;_0x15179f['model']=_[_0xa352('0x38')](db[_0xa352('0x83')]['rawAttributes']);_0x15179f['query']=_['keys'](_0x1d5788[_0xa352('0x37')]);_0x15179f[_0xa352('0x39')]=_[_0xa352('0x3a')](_0x15179f['model'],_0x15179f[_0xa352('0x37')]);_0x2f34d3[_0xa352('0x3b')]=_['intersection'](_0x15179f[_0xa352('0x36')],qs[_0xa352('0x3c')](_0x1d5788[_0xa352('0x37')]['fields']));_0x2f34d3[_0xa352('0x3b')]=_0x2f34d3['attributes'][_0xa352('0x4c')]?_0x2f34d3[_0xa352('0x3b')]:_0x15179f[_0xa352('0x36')];_0x2f34d3[_0xa352('0x5e')]=qs[_0xa352('0x3f')](_0x1d5788['query'][_0xa352('0x3f')]);_0x2f34d3['where']=qs[_0xa352('0x39')](_[_0xa352('0x41')](_0x1d5788[_0xa352('0x37')],_0x15179f['filters']));if(_0x1d5788[_0xa352('0x37')][_0xa352('0x42')]){_0x2f34d3['where']=_[_0xa352('0x43')](_0x2f34d3[_0xa352('0x40')],{'$or':_[_0xa352('0x30')](_0x2f34d3['attributes'],function(_0x5a545a){var _0x486368={};_0x486368[_0x5a545a]={'$like':'%'+_0x1d5788[_0xa352('0x37')][_0xa352('0x42')]+'%'};return _0x486368;})});}_0x2f34d3=_['merge']({},_0x2f34d3,_0x1d5788[_0xa352('0x45')]);return _0x29b810['getBlackLists'](_0x2f34d3);}})[_0xa352('0x28')](function(_0x54af93){if(_0x54af93){_0x18d8bd=_0x54af93[_0xa352('0x4c')];if(!_0x1d5788[_0xa352('0x37')][_0xa352('0x3d')](_0xa352('0x3e'))){_0x2f34d3[_0xa352('0x21')]=qs[_0xa352('0x21')](_0x1d5788[_0xa352('0x37')][_0xa352('0x21')]);_0x2f34d3['offset']=qs[_0xa352('0x1e')](_0x1d5788['query'][_0xa352('0x1e')]);}return _0x29b810[_0xa352('0x84')](_0x2f34d3);}})[_0xa352('0x28')](function(_0x43777e){if(_0x43777e){return _0x43777e?{'count':_0x18d8bd,'rows':_0x43777e}:null;}})[_0xa352('0x28')](respondWithResult(_0x292bff,null))[_0xa352('0x4d')](handleError(_0x292bff,null));};exports[_0xa352('0x85')]=function(_0x5a7b33,_0xaa0510,_0x20538a){var _0x4b38c9,_0x5cd5b8;return db['Campaign']['find']({'where':{'id':_0x5a7b33[_0xa352('0x4b')]['id']}})['then'](handleEntityNotFound(_0xaa0510,null))[_0xa352('0x28')](function(_0x5608e8){if(_0x5608e8){_0x5cd5b8=_0x5608e8;return _0x5608e8[_0xa352('0x85')](_0x5a7b33[_0xa352('0x4f')]['ids'],_[_0xa352('0x59')](_0x5a7b33['body'],[_0xa352('0x67'),'id'])||{});}return null;})[_0xa352('0x68')](function(_0x4f22fa){var _0x3bef6f;_0x4b38c9=_0x4f22fa||[];var _0x186f4c=[];if(_0x4f22fa){for(var _0x5e243e=0x0;_0x5e243e<_0x4f22fa[_0xa352('0x4c')];_0x5e243e+=0x1){var _0x33fbcd=_0x4f22fa[_0x5e243e][_0xa352('0x2a')]({'plain':!![]});_0x3bef6f=squel[_0xa352('0x7f')]()['into']('cm_hopper_black')['fromQuery']([_0xa352('0x6e'),_0xa352('0x70'),_0xa352('0x71'),'CampaignId',_0xa352('0x5b'),_0xa352('0x5a')],squel[_0xa352('0x72')]()['field'](_0xa352('0x6e'),_0xa352('0x6e'))[_0xa352('0x73')]('id',_0xa352('0x70'))['field'](_0x33fbcd[_0xa352('0x75')][_0xa352('0x76')](),'ListId')[_0xa352('0x73')](_0x5a7b33['params']['id']['toString'](),_0xa352('0x5f'))['field'](_0xa352('0x74'),'createdAt')['field'](_0xa352('0x74'),_0xa352('0x5a'))[_0xa352('0x77')](_0xa352('0x78'))[_0xa352('0x40')](_0xa352('0x79'))[_0xa352('0x40')]('ListId\x20=\x20?',_0x33fbcd[_0xa352('0x75')]['toString']())[_0xa352('0x40')](_0xa352('0x7a')))[_0xa352('0x76')]();_0x186f4c[_0xa352('0x86')](db[_0xa352('0x87')][_0xa352('0x37')](_0x3bef6f));}return BPromise[_0xa352('0x88')](_0x186f4c);}})[_0xa352('0x28')](function(){return _0x4b38c9;})[_0xa352('0x28')](respondWithResult(_0xaa0510,null))['catch'](handleError(_0xaa0510,null));};exports[_0xa352('0x89')]=function(_0x261475,_0x3fed9e,_0x2111f1){return db[_0xa352('0x31')][_0xa352('0x54')]({'where':{'id':_0x261475[_0xa352('0x4b')]['id']}})[_0xa352('0x28')](handleEntityNotFound(_0x3fed9e,null))[_0xa352('0x28')](function(_0x68c76a){if(_0x68c76a){return _0x68c76a[_0xa352('0x89')](_0x261475[_0xa352('0x37')][_0xa352('0x67')]);}})['then'](function(_0x4a2779){if(_0x4a2779){return db[_0xa352('0x64')]['destroy']({'where':{'ListId':_0x261475[_0xa352('0x37')][_0xa352('0x67')],'CampaignId':_0x261475['params']['id']}})[_0xa352('0x28')](function(){return _0x4a2779;});}})[_0xa352('0x28')](respondWithStatusCode(_0x3fed9e,null))[_0xa352('0x4d')](handleError(_0x3fed9e,null));}; \ No newline at end of file +var _0x32f6=['all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','Campaign','rawAttributes','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','NOW()','field','ListId\x20=\x20?','CmListId','toString','phone\x20IS\x20NOT\x20NULL','from','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','sequelize'];(function(_0x19da38,_0xc24ab4){var _0x4e63ee=function(_0x201ae9){while(--_0x201ae9){_0x19da38['push'](_0x19da38['shift']());}};_0x4e63ee(++_0xc24ab4);}(_0x32f6,0x118));var _0x632f=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x32f6[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require(_0x632f('0x0'));var rimraf=require(_0x632f('0x1'));var zipdir=require(_0x632f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x632f('0x3'));var BPromise=require(_0x632f('0x4'));var Mustache=require(_0x632f('0x5'));var util=require(_0x632f('0x6'));var path=require('path');var sox=require(_0x632f('0x7'));var csv=require(_0x632f('0x8'));var ejs=require(_0x632f('0x9'));var fs=require('fs');var fs_extra=require(_0x632f('0xa'));var _=require(_0x632f('0xb'));var squel=require(_0x632f('0xc'));var crypto=require(_0x632f('0xd'));var jsforce=require(_0x632f('0xe'));var deskjs=require(_0x632f('0xf'));var toCsv=require(_0x632f('0x8'));var querystring=require(_0x632f('0x10'));var Papa=require(_0x632f('0x11'));var Redis=require(_0x632f('0x12'));var authService=require(_0x632f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x632f('0x14'));var hardwareService=require(_0x632f('0x15'));var logger=require('../../config/logger')(_0x632f('0x16'));var utils=require(_0x632f('0x17'));var config=require(_0x632f('0x18'));var licenseUtil=require(_0x632f('0x19'));var db=require(_0x632f('0x1a'))['db'];function respondWithStatusCode(_0x2612a1,_0x1da8be){_0x1da8be=_0x1da8be||0xcc;return function(_0x438d9e){if(_0x438d9e){return _0x2612a1[_0x632f('0x1b')](_0x1da8be);}return _0x2612a1[_0x632f('0x1c')](_0x1da8be)[_0x632f('0x1d')]();};}function respondWithResult(_0x5e1e1c,_0x223e04){_0x223e04=_0x223e04||0xc8;return function(_0x5b3023){if(_0x5b3023){return _0x5e1e1c[_0x632f('0x1c')](_0x223e04)['json'](_0x5b3023);}};}function respondWithFilteredResult(_0x289bba,_0x149479){return function(_0xccbf66){if(_0xccbf66){var _0x1870e4=typeof _0x149479[_0x632f('0x1e')]==='undefined'&&typeof _0x149479[_0x632f('0x1f')]===_0x632f('0x20');var _0x5278c4=_0xccbf66[_0x632f('0x21')];var _0x4724fe=_0x1870e4?0x0:_0x149479[_0x632f('0x1e')];var _0x19dc71=_0x1870e4?_0xccbf66[_0x632f('0x21')]:_0x149479[_0x632f('0x1e')]+_0x149479[_0x632f('0x1f')];var _0x78f376;if(_0x19dc71>=_0x5278c4){_0x19dc71=_0x5278c4;_0x78f376=0xc8;}else{_0x78f376=0xce;}_0x289bba[_0x632f('0x1c')](_0x78f376);return _0x289bba[_0x632f('0x22')]('Content-Range',_0x4724fe+'-'+_0x19dc71+'/'+_0x5278c4)[_0x632f('0x23')](_0xccbf66);}return null;};}function patchUpdates(_0x11de97){return function(_0x4b662d){try{jsonpatch[_0x632f('0x24')](_0x4b662d,_0x11de97,!![]);}catch(_0x3d747f){return BPromise[_0x632f('0x25')](_0x3d747f);}return _0x4b662d[_0x632f('0x26')]();};}function saveUpdates(_0x28d854,_0x1734d0){return function(_0x7fed67){if(_0x7fed67){return _0x7fed67[_0x632f('0x27')](_0x28d854)[_0x632f('0x28')](function(_0x596c63){return _0x596c63;});}return null;};}function removeEntity(_0x1feb2c,_0x22bd47){return function(_0x442f1b){if(_0x442f1b){return _0x442f1b['destroy']()[_0x632f('0x28')](function(){var _0x36ce49=_0x442f1b[_0x632f('0x29')]({'plain':!![]});var _0x52088c=_0x632f('0x2a');return db[_0x632f('0x2b')][_0x632f('0x2c')]({'where':{'type':_0x52088c,'resourceId':_0x36ce49['id']}})[_0x632f('0x28')](function(){return _0x442f1b;});})['then'](function(){_0x1feb2c[_0x632f('0x1c')](0xcc)[_0x632f('0x1d')]();});}};}function handleEntityNotFound(_0x3c09c4,_0x3c74b1){return function(_0x3947bb){if(!_0x3947bb){_0x3c09c4['sendStatus'](0x194);}return _0x3947bb;};}function handleError(_0x47dc58,_0x1751e7){_0x1751e7=_0x1751e7||0x1f4;return function(_0x4f084c){logger[_0x632f('0x2d')](_0x4f084c[_0x632f('0x2e')]);if(_0x4f084c[_0x632f('0x2f')]){delete _0x4f084c[_0x632f('0x2f')];}_0x47dc58[_0x632f('0x1c')](_0x1751e7)[_0x632f('0x30')](_0x4f084c);};}exports[_0x632f('0x31')]=function(_0x5ee770,_0x530c53){var _0x2e5584={},_0x11e903={},_0x1ffcab={'count':0x0,'rows':[]};var _0x2bbd55=_['map'](db[_0x632f('0x32')][_0x632f('0x33')],function(_0x16548b){return{'name':_0x16548b['fieldName'],'type':_0x16548b['type']['key']};});_0x11e903[_0x632f('0x34')]=_[_0x632f('0x35')](_0x2bbd55,_0x632f('0x2f'));_0x11e903[_0x632f('0x36')]=_['keys'](_0x5ee770[_0x632f('0x36')]);_0x11e903['filters']=_['intersection'](_0x11e903[_0x632f('0x34')],_0x11e903['query']);_0x2e5584[_0x632f('0x37')]=_[_0x632f('0x38')](_0x11e903[_0x632f('0x34')],qs['fields'](_0x5ee770['query'][_0x632f('0x39')]));_0x2e5584[_0x632f('0x37')]=_0x2e5584[_0x632f('0x37')][_0x632f('0x3a')]?_0x2e5584[_0x632f('0x37')]:_0x11e903[_0x632f('0x34')];if(!_0x5ee770[_0x632f('0x36')][_0x632f('0x3b')](_0x632f('0x3c'))){_0x2e5584[_0x632f('0x1f')]=qs['limit'](_0x5ee770['query'][_0x632f('0x1f')]);_0x2e5584[_0x632f('0x1e')]=qs[_0x632f('0x1e')](_0x5ee770[_0x632f('0x36')][_0x632f('0x1e')]);}_0x2e5584[_0x632f('0x3d')]=qs[_0x632f('0x3e')](_0x5ee770['query']['sort']);_0x2e5584[_0x632f('0x3f')]=qs[_0x632f('0x40')](_[_0x632f('0x41')](_0x5ee770[_0x632f('0x36')],_0x11e903[_0x632f('0x40')]),_0x2bbd55);if(_0x5ee770[_0x632f('0x36')][_0x632f('0x42')]){_0x2e5584['where']=_['merge'](_0x2e5584['where'],{'$or':_[_0x632f('0x35')](_0x2bbd55,function(_0x302161){if(_0x302161[_0x632f('0x43')]!=='VIRTUAL'){var _0x2f43bb={};_0x2f43bb[_0x302161[_0x632f('0x2f')]]={'$like':'%'+_0x5ee770[_0x632f('0x36')][_0x632f('0x42')]+'%'};return _0x2f43bb;}})});}_0x2e5584=_[_0x632f('0x44')]({},_0x2e5584,_0x5ee770['options']);var _0x467510={'where':_0x2e5584['where']};return db[_0x632f('0x32')][_0x632f('0x21')](_0x467510)[_0x632f('0x28')](function(_0x5ef581){_0x1ffcab[_0x632f('0x21')]=_0x5ef581;if(_0x5ee770[_0x632f('0x36')][_0x632f('0x45')]){_0x2e5584[_0x632f('0x46')]=[{'all':!![]}];}return db[_0x632f('0x32')][_0x632f('0x47')](_0x2e5584);})[_0x632f('0x28')](function(_0x255f70){_0x1ffcab[_0x632f('0x48')]=_0x255f70;return _0x1ffcab;})[_0x632f('0x28')](respondWithFilteredResult(_0x530c53,_0x2e5584))[_0x632f('0x49')](handleError(_0x530c53,null));};exports['show']=function(_0x657179,_0x257bea){var _0xb55e1={'raw':![],'where':{'id':_0x657179[_0x632f('0x4a')]['id']}},_0x989da5={};_0x989da5['model']=_['keys'](db[_0x632f('0x32')][_0x632f('0x33')]);_0x989da5[_0x632f('0x36')]=_[_0x632f('0x4b')](_0x657179[_0x632f('0x36')]);_0x989da5[_0x632f('0x40')]=_['intersection'](_0x989da5[_0x632f('0x34')],_0x989da5['query']);_0xb55e1[_0x632f('0x37')]=_[_0x632f('0x38')](_0x989da5['model'],qs['fields'](_0x657179[_0x632f('0x36')][_0x632f('0x39')]));_0xb55e1['attributes']=_0xb55e1['attributes']['length']?_0xb55e1['attributes']:_0x989da5[_0x632f('0x34')];if(_0x657179[_0x632f('0x36')][_0x632f('0x45')]){_0xb55e1[_0x632f('0x46')]=[{'all':!![]}];}_0xb55e1=_['merge']({},_0xb55e1,_0x657179[_0x632f('0x4c')]);return db[_0x632f('0x32')][_0x632f('0x4d')](_0xb55e1)['then'](handleEntityNotFound(_0x257bea,null))[_0x632f('0x28')](respondWithResult(_0x257bea,null))[_0x632f('0x49')](handleError(_0x257bea,null));};exports[_0x632f('0x4e')]=function(_0x25ebff,_0x1cdfbe){return db[_0x632f('0x32')][_0x632f('0x4e')](_0x25ebff[_0x632f('0x4f')],{})[_0x632f('0x28')](function(_0x558241){var _0x441d3d=_0x25ebff[_0x632f('0x50')][_0x632f('0x29')]({'plain':!![]});if(!_0x441d3d)throw new Error(_0x632f('0x51'));if(_0x441d3d['role']===_0x632f('0x50')){var _0x10dc62=_0x558241[_0x632f('0x29')]({'plain':!![]});var _0xf8107f=_0x632f('0x2a');return db[_0x632f('0x52')][_0x632f('0x4d')]({'where':{'name':_0xf8107f,'userProfileId':_0x441d3d['userProfileId']},'raw':!![]})['then'](function(_0x34224c){if(_0x34224c&&_0x34224c[_0x632f('0x53')]===0x0){return db[_0x632f('0x2b')][_0x632f('0x4e')]({'name':_0x10dc62[_0x632f('0x2f')],'resourceId':_0x10dc62['id'],'type':_0x34224c['name'],'sectionId':_0x34224c['id']},{})[_0x632f('0x28')](function(){return _0x558241;});}else{return _0x558241;}})[_0x632f('0x49')](function(_0x172190){logger[_0x632f('0x2d')](_0x632f('0x54'),_0x172190);throw _0x172190;});}return _0x558241;})[_0x632f('0x28')](respondWithResult(_0x1cdfbe,0xc9))[_0x632f('0x49')](handleError(_0x1cdfbe,null));};exports['clone']=function(_0x51f698,_0x422d01){var _0x3847c7={'where':{'id':_0x51f698[_0x632f('0x4a')]['id']}},_0x1ca6d4={};_0x1ca6d4['model']=_['keys'](db[_0x632f('0x32')]['rawAttributes']);_0x3847c7['attributes']=_[_0x632f('0x38')](_0x1ca6d4[_0x632f('0x34')],qs['fields'](_0x51f698[_0x632f('0x36')][_0x632f('0x39')]));_0x3847c7[_0x632f('0x37')]=_0x3847c7[_0x632f('0x37')][_0x632f('0x3a')]?_0x3847c7[_0x632f('0x37')]:_0x1ca6d4[_0x632f('0x34')];if(_0x51f698[_0x632f('0x36')][_0x632f('0x45')]){_0x3847c7['include']=[{'all':!![]}];}_0x3847c7=_[_0x632f('0x44')]({},_0x3847c7,_0x51f698[_0x632f('0x4c')]);return db[_0x632f('0x32')][_0x632f('0x4d')](_0x3847c7)[_0x632f('0x28')](handleEntityNotFound(_0x422d01,null))[_0x632f('0x28')](function(_0x118aa0){if(_0x118aa0){var _0x48cd18=_0x118aa0[_0x632f('0x29')]({'plain':!![]});_0x48cd18=qs[_0x632f('0x55')](_0x48cd18,['id',_0x632f('0x56'),_0x632f('0x57')]);_0x51f698[_0x632f('0x4f')]=_[_0x632f('0x55')](_0x51f698[_0x632f('0x4f')],['id',_0x632f('0x56'),_0x632f('0x57')]);return db['Campaign'][_0x632f('0x4e')](_[_0x632f('0x44')](_0x48cd18,_0x51f698[_0x632f('0x4f')]),{'include':_0x51f698['query'][_0x632f('0x45')]?[{'all':!![]}]:undefined})[_0x632f('0x28')](function(_0x3fba20){var _0x1122eb=_0x51f698[_0x632f('0x50')][_0x632f('0x29')]({'plain':!![]});if(!_0x1122eb)throw new Error(_0x632f('0x51'));if(_0x1122eb['role']===_0x632f('0x50')){var _0x219828=_0x3fba20['get']({'plain':!![]});var _0x298372='IvrCampaigns';return db[_0x632f('0x52')]['find']({'where':{'name':_0x298372,'userProfileId':_0x1122eb[_0x632f('0x58')]},'raw':!![]})['then'](function(_0xc9088c){if(_0xc9088c&&_0xc9088c['autoAssociation']===0x0){return db[_0x632f('0x2b')]['create']({'name':_0x219828[_0x632f('0x2f')],'resourceId':_0x219828['id'],'type':_0xc9088c[_0x632f('0x2f')],'sectionId':_0xc9088c['id']},{})[_0x632f('0x28')](function(){return _0x3fba20;});}else{return _0x3fba20;}})[_0x632f('0x49')](function(_0x47483b){logger[_0x632f('0x2d')](_0x632f('0x54'),_0x47483b);throw _0x47483b;});}return _0x3fba20;});}})[_0x632f('0x28')](respondWithResult(_0x422d01,0xc9))[_0x632f('0x49')](handleError(_0x422d01,null));};exports[_0x632f('0x27')]=function(_0xfb72ab,_0x4a9932){if(_0xfb72ab[_0x632f('0x4f')]['id']){delete _0xfb72ab[_0x632f('0x4f')]['id'];}return db[_0x632f('0x32')][_0x632f('0x4d')]({'where':{'id':_0xfb72ab[_0x632f('0x4a')]['id']}})[_0x632f('0x28')](handleEntityNotFound(_0x4a9932,null))[_0x632f('0x28')](saveUpdates(_0xfb72ab[_0x632f('0x4f')],null))[_0x632f('0x28')](respondWithResult(_0x4a9932,null))[_0x632f('0x49')](handleError(_0x4a9932,null));};exports['destroy']=function(_0x48c38e,_0x43feff){return db['Campaign'][_0x632f('0x4d')]({'where':{'id':_0x48c38e[_0x632f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43feff,null))[_0x632f('0x28')](removeEntity(_0x43feff,null))[_0x632f('0x49')](handleError(_0x43feff,null));};exports[_0x632f('0x59')]=function(_0x1b95d7,_0x547b8a,_0x27684a){var _0x442285={'raw':!![],'where':{}};var _0x23a95f={};var _0x1e5d9e={'count':0x0,'rows':[]};return db[_0x632f('0x32')][_0x632f('0x5a')]({'where':{'id':_0x1b95d7['params']['id']}})[_0x632f('0x28')](handleEntityNotFound(_0x547b8a,null))[_0x632f('0x28')](function(_0x370c29){if(_0x370c29){_0x23a95f[_0x632f('0x34')]=_['keys'](db['CmHopper'][_0x632f('0x33')]);_0x23a95f[_0x632f('0x36')]=_['keys'](_0x1b95d7['query']);_0x23a95f[_0x632f('0x40')]=_['intersection'](_0x23a95f[_0x632f('0x34')],_0x23a95f[_0x632f('0x36')]);_0x442285[_0x632f('0x37')]=_[_0x632f('0x38')](_0x23a95f[_0x632f('0x34')],qs['fields'](_0x1b95d7[_0x632f('0x36')][_0x632f('0x39')]));_0x442285['attributes']=_0x442285[_0x632f('0x37')][_0x632f('0x3a')]?_0x442285[_0x632f('0x37')]:_0x23a95f[_0x632f('0x34')];if(!_0x1b95d7[_0x632f('0x36')][_0x632f('0x3b')](_0x632f('0x3c'))){_0x442285['limit']=qs[_0x632f('0x1f')](_0x1b95d7[_0x632f('0x36')][_0x632f('0x1f')]);_0x442285[_0x632f('0x1e')]=qs[_0x632f('0x1e')](_0x1b95d7[_0x632f('0x36')]['offset']);}_0x442285[_0x632f('0x3d')]=qs[_0x632f('0x3e')](_0x1b95d7['query'][_0x632f('0x3e')]);_0x442285[_0x632f('0x3f')]=qs[_0x632f('0x40')](_[_0x632f('0x41')](_0x1b95d7['query'],_0x23a95f[_0x632f('0x40')]));_0x442285['where'][_0x632f('0x5b')]=_0x370c29['id'];if(_0x1b95d7[_0x632f('0x36')][_0x632f('0x42')]){_0x442285[_0x632f('0x3f')]=_[_0x632f('0x44')](_0x442285[_0x632f('0x3f')],{'$or':_[_0x632f('0x35')](_0x442285[_0x632f('0x37')],function(_0x58d53f){var _0x366d94={};_0x366d94[_0x58d53f]={'$like':'%'+_0x1b95d7[_0x632f('0x36')][_0x632f('0x42')]+'%'};return _0x366d94;})});}_0x442285=_[_0x632f('0x44')]({},_0x442285,_0x1b95d7[_0x632f('0x4c')]);return db['CmHopper']['count']({'where':_0x442285['where']})[_0x632f('0x28')](function(_0x2281cf){_0x1e5d9e['count']=_0x2281cf;if(_0x1b95d7[_0x632f('0x36')][_0x632f('0x45')]){_0x442285['include']=[{'all':!![]}];}return db[_0x632f('0x5c')][_0x632f('0x47')](_0x442285);})[_0x632f('0x28')](function(_0x18af02){_0x1e5d9e[_0x632f('0x48')]=_0x18af02;return _0x1e5d9e;});}})[_0x632f('0x28')](respondWithFilteredResult(_0x547b8a,_0x442285))[_0x632f('0x49')](handleError(_0x547b8a,null));};exports[_0x632f('0x5d')]=function(_0x17912d,_0x2963ca,_0x40ece3){var _0x1045f4={'raw':!![],'where':{}};var _0x4affab={};var _0x432d29={'count':0x0,'rows':[]};return db[_0x632f('0x32')][_0x632f('0x5a')]({'where':{'id':_0x17912d[_0x632f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2963ca,null))[_0x632f('0x28')](function(_0x43f606){if(_0x43f606){_0x4affab[_0x632f('0x34')]=_[_0x632f('0x4b')](db[_0x632f('0x5e')][_0x632f('0x33')]);_0x4affab['query']=_['keys'](_0x17912d[_0x632f('0x36')]);_0x4affab[_0x632f('0x40')]=_[_0x632f('0x38')](_0x4affab[_0x632f('0x34')],_0x4affab[_0x632f('0x36')]);_0x1045f4[_0x632f('0x37')]=_[_0x632f('0x38')](_0x4affab['model'],qs[_0x632f('0x39')](_0x17912d[_0x632f('0x36')][_0x632f('0x39')]));_0x1045f4[_0x632f('0x37')]=_0x1045f4[_0x632f('0x37')][_0x632f('0x3a')]?_0x1045f4[_0x632f('0x37')]:_0x4affab['model'];if(!_0x17912d[_0x632f('0x36')]['hasOwnProperty']('nolimit')){_0x1045f4[_0x632f('0x1f')]=qs[_0x632f('0x1f')](_0x17912d[_0x632f('0x36')][_0x632f('0x1f')]);_0x1045f4[_0x632f('0x1e')]=qs[_0x632f('0x1e')](_0x17912d[_0x632f('0x36')][_0x632f('0x1e')]);}_0x1045f4['order']=qs[_0x632f('0x3e')](_0x17912d[_0x632f('0x36')][_0x632f('0x3e')]);_0x1045f4[_0x632f('0x3f')]=qs[_0x632f('0x40')](_[_0x632f('0x41')](_0x17912d[_0x632f('0x36')],_0x4affab[_0x632f('0x40')]));_0x1045f4[_0x632f('0x3f')][_0x632f('0x5b')]=_0x43f606['id'];if(_0x17912d['query'][_0x632f('0x42')]){_0x1045f4['where']=_[_0x632f('0x44')](_0x1045f4[_0x632f('0x3f')],{'$or':_['map'](_0x1045f4['attributes'],function(_0x78af24){var _0x4a0c95={};_0x4a0c95[_0x78af24]={'$like':'%'+_0x17912d[_0x632f('0x36')][_0x632f('0x42')]+'%'};return _0x4a0c95;})});}_0x1045f4=_['merge']({},_0x1045f4,_0x17912d[_0x632f('0x4c')]);return db['CmHopperHistory'][_0x632f('0x21')]({'where':_0x1045f4[_0x632f('0x3f')]})[_0x632f('0x28')](function(_0x38f32e){_0x432d29[_0x632f('0x21')]=_0x38f32e;if(_0x17912d[_0x632f('0x36')][_0x632f('0x45')]){_0x1045f4[_0x632f('0x46')]=[{'all':!![]}];}return db[_0x632f('0x5e')][_0x632f('0x47')](_0x1045f4);})['then'](function(_0x46d69c){_0x432d29['rows']=_0x46d69c;return _0x432d29;});}})[_0x632f('0x28')](respondWithFilteredResult(_0x2963ca,_0x1045f4))[_0x632f('0x49')](handleError(_0x2963ca,null));};exports[_0x632f('0x5f')]=function(_0x3cbd3e,_0xa15cc1,_0x2f952f){var _0x760e9f={'raw':!![],'where':{}};var _0x7e3eb={};var _0x400397={'count':0x0,'rows':[]};return db[_0x632f('0x32')]['findOne']({'where':{'id':_0x3cbd3e[_0x632f('0x4a')]['id']}})[_0x632f('0x28')](handleEntityNotFound(_0xa15cc1,null))[_0x632f('0x28')](function(_0x283c67){if(_0x283c67){_0x7e3eb['model']=_[_0x632f('0x4b')](db[_0x632f('0x60')][_0x632f('0x33')]);_0x7e3eb[_0x632f('0x36')]=_[_0x632f('0x4b')](_0x3cbd3e[_0x632f('0x36')]);_0x7e3eb['filters']=_['intersection'](_0x7e3eb[_0x632f('0x34')],_0x7e3eb[_0x632f('0x36')]);_0x760e9f[_0x632f('0x37')]=_['intersection'](_0x7e3eb['model'],qs[_0x632f('0x39')](_0x3cbd3e[_0x632f('0x36')][_0x632f('0x39')]));_0x760e9f[_0x632f('0x37')]=_0x760e9f[_0x632f('0x37')][_0x632f('0x3a')]?_0x760e9f['attributes']:_0x7e3eb[_0x632f('0x34')];if(!_0x3cbd3e[_0x632f('0x36')]['hasOwnProperty'](_0x632f('0x3c'))){_0x760e9f[_0x632f('0x1f')]=qs[_0x632f('0x1f')](_0x3cbd3e[_0x632f('0x36')][_0x632f('0x1f')]);_0x760e9f[_0x632f('0x1e')]=qs[_0x632f('0x1e')](_0x3cbd3e[_0x632f('0x36')][_0x632f('0x1e')]);}_0x760e9f[_0x632f('0x3d')]=qs[_0x632f('0x3e')](_0x3cbd3e['query'][_0x632f('0x3e')]);_0x760e9f['where']=qs[_0x632f('0x40')](_['pick'](_0x3cbd3e[_0x632f('0x36')],_0x7e3eb[_0x632f('0x40')]));_0x760e9f['where']['CampaignId']=_0x283c67['id'];if(_0x3cbd3e[_0x632f('0x36')][_0x632f('0x42')]){_0x760e9f[_0x632f('0x3f')]=_['merge'](_0x760e9f[_0x632f('0x3f')],{'$or':_[_0x632f('0x35')](_0x760e9f['attributes'],function(_0x51d816){var _0xe89187={};_0xe89187[_0x51d816]={'$like':'%'+_0x3cbd3e[_0x632f('0x36')]['filter']+'%'};return _0xe89187;})});}_0x760e9f=_['merge']({},_0x760e9f,_0x3cbd3e['options']);return db[_0x632f('0x60')][_0x632f('0x21')]({'where':_0x760e9f[_0x632f('0x3f')]})[_0x632f('0x28')](function(_0x1605bb){_0x400397[_0x632f('0x21')]=_0x1605bb;if(_0x3cbd3e['query'][_0x632f('0x45')]){_0x760e9f[_0x632f('0x46')]=[{'all':!![]}];}return db[_0x632f('0x60')][_0x632f('0x47')](_0x760e9f);})['then'](function(_0x14ae55){_0x400397[_0x632f('0x48')]=_0x14ae55;return _0x400397;});}})[_0x632f('0x28')](respondWithFilteredResult(_0xa15cc1,_0x760e9f))['catch'](handleError(_0xa15cc1,null));};exports[_0x632f('0x61')]=function(_0x5bd218,_0x5ad1d6,_0x259286){var _0x2ad039={'raw':!![],'where':{}};var _0x59dd60={};var _0x3665a3={'count':0x0,'rows':[]};return db[_0x632f('0x32')][_0x632f('0x5a')]({'where':{'id':_0x5bd218['params']['id']}})[_0x632f('0x28')](handleEntityNotFound(_0x5ad1d6,null))[_0x632f('0x28')](function(_0x1c336d){if(_0x1c336d){_0x59dd60[_0x632f('0x34')]=_['keys'](db[_0x632f('0x62')][_0x632f('0x33')]);_0x59dd60[_0x632f('0x36')]=_[_0x632f('0x4b')](_0x5bd218[_0x632f('0x36')]);_0x59dd60[_0x632f('0x40')]=_[_0x632f('0x38')](_0x59dd60[_0x632f('0x34')],_0x59dd60[_0x632f('0x36')]);_0x2ad039[_0x632f('0x37')]=_[_0x632f('0x38')](_0x59dd60[_0x632f('0x34')],qs['fields'](_0x5bd218[_0x632f('0x36')]['fields']));_0x2ad039[_0x632f('0x37')]=_0x2ad039[_0x632f('0x37')][_0x632f('0x3a')]?_0x2ad039[_0x632f('0x37')]:_0x59dd60['model'];if(!_0x5bd218[_0x632f('0x36')][_0x632f('0x3b')](_0x632f('0x3c'))){_0x2ad039['limit']=qs[_0x632f('0x1f')](_0x5bd218[_0x632f('0x36')][_0x632f('0x1f')]);_0x2ad039[_0x632f('0x1e')]=qs[_0x632f('0x1e')](_0x5bd218[_0x632f('0x36')]['offset']);}_0x2ad039[_0x632f('0x3d')]=qs[_0x632f('0x3e')](_0x5bd218[_0x632f('0x36')][_0x632f('0x3e')]);_0x2ad039[_0x632f('0x3f')]=qs[_0x632f('0x40')](_[_0x632f('0x41')](_0x5bd218[_0x632f('0x36')],_0x59dd60[_0x632f('0x40')]));_0x2ad039[_0x632f('0x3f')][_0x632f('0x5b')]=_0x1c336d['id'];if(_0x5bd218[_0x632f('0x36')][_0x632f('0x42')]){_0x2ad039[_0x632f('0x3f')]=_[_0x632f('0x44')](_0x2ad039[_0x632f('0x3f')],{'$or':_[_0x632f('0x35')](_0x2ad039[_0x632f('0x37')],function(_0x571e61){var _0x17f27a={};_0x17f27a[_0x571e61]={'$like':'%'+_0x5bd218['query']['filter']+'%'};return _0x17f27a;})});}_0x2ad039=_[_0x632f('0x44')]({},_0x2ad039,_0x5bd218[_0x632f('0x4c')]);return db[_0x632f('0x62')][_0x632f('0x21')]({'where':_0x2ad039[_0x632f('0x3f')]})['then'](function(_0x129792){_0x3665a3[_0x632f('0x21')]=_0x129792;if(_0x5bd218['query'][_0x632f('0x45')]){_0x2ad039[_0x632f('0x46')]=[{'all':!![]}];}return db[_0x632f('0x62')][_0x632f('0x47')](_0x2ad039);})['then'](function(_0x48ba45){_0x3665a3['rows']=_0x48ba45;return _0x3665a3;});}})[_0x632f('0x28')](respondWithFilteredResult(_0x5ad1d6,_0x2ad039))[_0x632f('0x49')](handleError(_0x5ad1d6,null));};exports[_0x632f('0x63')]=function(_0x18a7aa,_0x58a879,_0xfb74d2){var _0x4243df={};var _0x276fd5={};var _0x448093;var _0x2b7054;return db[_0x632f('0x32')][_0x632f('0x5a')]({'where':{'id':_0x18a7aa[_0x632f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58a879,null))['then'](function(_0x4b66ad){if(_0x4b66ad){_0x448093=_0x4b66ad;_0x276fd5[_0x632f('0x34')]=_[_0x632f('0x4b')](db['CmList']['rawAttributes']);_0x276fd5[_0x632f('0x36')]=_['keys'](_0x18a7aa[_0x632f('0x36')]);_0x276fd5['filters']=_['intersection'](_0x276fd5['model'],_0x276fd5[_0x632f('0x36')]);_0x4243df[_0x632f('0x37')]=_[_0x632f('0x38')](_0x276fd5[_0x632f('0x34')],qs[_0x632f('0x39')](_0x18a7aa[_0x632f('0x36')]['fields']));_0x4243df['attributes']=_0x4243df[_0x632f('0x37')][_0x632f('0x3a')]?_0x4243df[_0x632f('0x37')]:_0x276fd5[_0x632f('0x34')];_0x4243df['order']=qs[_0x632f('0x3e')](_0x18a7aa[_0x632f('0x36')][_0x632f('0x3e')]);_0x4243df[_0x632f('0x3f')]=qs[_0x632f('0x40')](_['pick'](_0x18a7aa[_0x632f('0x36')],_0x276fd5[_0x632f('0x40')]));if(_0x18a7aa[_0x632f('0x36')]['filter']){_0x4243df['where']=_['merge'](_0x4243df[_0x632f('0x3f')],{'$or':_[_0x632f('0x35')](_0x4243df[_0x632f('0x37')],function(_0x3b5788){var _0xb467a={};_0xb467a[_0x3b5788]={'$like':'%'+_0x18a7aa[_0x632f('0x36')][_0x632f('0x42')]+'%'};return _0xb467a;})});}_0x4243df=_['merge']({},_0x4243df,_0x18a7aa[_0x632f('0x4c')]);return _0x448093[_0x632f('0x63')](_0x4243df);}})['then'](function(_0xa1a3c2){if(_0xa1a3c2){_0x2b7054=_0xa1a3c2['length'];if(!_0x18a7aa[_0x632f('0x36')][_0x632f('0x3b')](_0x632f('0x3c'))){_0x4243df[_0x632f('0x1f')]=qs[_0x632f('0x1f')](_0x18a7aa[_0x632f('0x36')][_0x632f('0x1f')]);_0x4243df[_0x632f('0x1e')]=qs['offset'](_0x18a7aa[_0x632f('0x36')][_0x632f('0x1e')]);}return _0x448093[_0x632f('0x63')](_0x4243df);}})[_0x632f('0x28')](function(_0x50e06f){if(_0x50e06f){return _0x50e06f?{'count':_0x2b7054,'rows':_0x50e06f}:null;}})['then'](respondWithResult(_0x58a879,null))[_0x632f('0x49')](handleError(_0x58a879,null));};exports[_0x632f('0x64')]=function(_0x3edfad,_0x30504c,_0x56acef){var _0x3e31eb,_0x43577b;return db['Campaign'][_0x632f('0x4d')]({'where':{'id':_0x3edfad[_0x632f('0x4a')]['id']}})[_0x632f('0x28')](handleEntityNotFound(_0x30504c,null))[_0x632f('0x28')](function(_0x562b3e){if(_0x562b3e){_0x43577b=_0x562b3e;return _0x562b3e[_0x632f('0x64')](_0x3edfad['body'][_0x632f('0x65')],_[_0x632f('0x55')](_0x3edfad['body'],[_0x632f('0x65'),'id'])||{});}return null;})[_0x632f('0x66')](function(_0x3fafa7){var _0x2a089c;_0x3e31eb=_0x3fafa7||[];var _0x2c2435=[];if(_0x3fafa7){for(var _0x230447=0x0;_0x230447<_0x3fafa7[_0x632f('0x3a')];_0x230447+=0x1){var _0x52516b=_0x3fafa7[_0x230447][_0x632f('0x29')]({'plain':!![]});_0x43577b[_0x632f('0x67')]=_0x3edfad[_0x632f('0x4f')][_0x632f('0x67')]?_0x3edfad['body'][_0x632f('0x67')]:_0x43577b[_0x632f('0x67')];switch(_0x43577b[_0x632f('0x67')]){case _0x632f('0x68'):_0x2a089c=squel[_0x632f('0x69')]()[_0x632f('0x6a')](_0x632f('0x6b'))[_0x632f('0x6c')]([_0x632f('0x6d'),_0x632f('0x6e'),_0x632f('0x6f'),_0x632f('0x70'),_0x632f('0x5b'),_0x632f('0x56'),_0x632f('0x57')],squel[_0x632f('0x71')]()['field'](_0x632f('0x6d'),'phone')['field'](_0x632f('0x72'),_0x632f('0x6e'))['field']('id','ContactId')[_0x632f('0x73')](_0x52516b['CmListId']['toString'](),_0x632f('0x70'))[_0x632f('0x73')](_0x3edfad[_0x632f('0x4a')]['id']['toString'](),_0x632f('0x5b'))['field'](_0x632f('0x72'),_0x632f('0x56'))[_0x632f('0x73')]('NOW()',_0x632f('0x57'))['from']('cm_contacts')[_0x632f('0x3f')]('deletedAt\x20IS\x20NULL')[_0x632f('0x3f')](_0x632f('0x74'),_0x52516b[_0x632f('0x75')][_0x632f('0x76')]())[_0x632f('0x3f')](_0x632f('0x77'))[_0x632f('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')[_0x632f('0x78')]('cm_hopper_final')[_0x632f('0x3f')](_0x632f('0x79'),_0x3edfad[_0x632f('0x4a')]['id']['toString']()))[_0x632f('0x3f')](_0x632f('0x7a'),squel[_0x632f('0x71')]()[_0x632f('0x73')](_0x632f('0x7b'))[_0x632f('0x78')](_0x632f('0x6b'))[_0x632f('0x3f')]('CampaignId\x20=\x20?',_0x3edfad[_0x632f('0x4a')]['id'][_0x632f('0x76')]())))[_0x632f('0x76')]();break;case _0x632f('0x7c'):_0x2a089c=squel[_0x632f('0x69')]()[_0x632f('0x6a')]('cm_hopper')[_0x632f('0x6c')]([_0x632f('0x6d'),_0x632f('0x6e'),'ContactId',_0x632f('0x70'),_0x632f('0x5b'),'createdAt','updatedAt'],squel[_0x632f('0x71')]()['field']('phone','phone')[_0x632f('0x73')](_0x632f('0x72'),_0x632f('0x6e'))['field']('id',_0x632f('0x6f'))[_0x632f('0x73')](_0x52516b[_0x632f('0x75')][_0x632f('0x76')](),_0x632f('0x70'))[_0x632f('0x73')](_0x3edfad[_0x632f('0x4a')]['id']['toString'](),_0x632f('0x5b'))['field'](_0x632f('0x72'),_0x632f('0x56'))[_0x632f('0x73')]('NOW()',_0x632f('0x57'))[_0x632f('0x78')](_0x632f('0x7d'))['where'](_0x632f('0x7e'))[_0x632f('0x3f')]('ListId\x20=\x20?',_0x52516b[_0x632f('0x75')][_0x632f('0x76')]())[_0x632f('0x3f')](_0x632f('0x77'))['where'](_0x632f('0x7a'),squel[_0x632f('0x71')]()[_0x632f('0x73')](_0x632f('0x7b'))[_0x632f('0x78')]('cm_hopper')[_0x632f('0x3f')](_0x632f('0x79'),_0x3edfad[_0x632f('0x4a')]['id'][_0x632f('0x76')]())))['toString']();break;default:_0x2a089c=squel['insert']()[_0x632f('0x6a')](_0x632f('0x6b'))[_0x632f('0x6c')](['phone',_0x632f('0x6e'),_0x632f('0x6f'),_0x632f('0x70'),_0x632f('0x5b'),_0x632f('0x56'),_0x632f('0x57')],squel[_0x632f('0x71')]()[_0x632f('0x73')]('phone',_0x632f('0x6d'))[_0x632f('0x73')]('NOW()','scheduledAt')[_0x632f('0x73')]('id',_0x632f('0x6f'))[_0x632f('0x73')](_0x52516b[_0x632f('0x75')][_0x632f('0x76')](),_0x632f('0x70'))[_0x632f('0x73')](_0x3edfad['params']['id'][_0x632f('0x76')](),'CampaignId')[_0x632f('0x73')]('NOW()',_0x632f('0x56'))['field'](_0x632f('0x72'),_0x632f('0x57'))[_0x632f('0x78')](_0x632f('0x7d'))['where']('deletedAt\x20IS\x20NULL')[_0x632f('0x3f')](_0x632f('0x74'),_0x52516b[_0x632f('0x75')][_0x632f('0x76')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x632f('0x76')]();}_0x2c2435['push'](db[_0x632f('0x7f')][_0x632f('0x36')](_0x2a089c));}return BPromise[_0x632f('0x80')](_0x2c2435);}})[_0x632f('0x28')](function(){return _0x3e31eb;})[_0x632f('0x28')](respondWithResult(_0x30504c,null))['catch'](handleError(_0x30504c,null));};exports[_0x632f('0x81')]=function(_0x3785de,_0x1b1134,_0x21b41b){return db[_0x632f('0x32')][_0x632f('0x4d')]({'where':{'id':_0x3785de[_0x632f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b1134,null))[_0x632f('0x28')](function(_0xa0abb){if(_0xa0abb){return _0xa0abb[_0x632f('0x81')](_0x3785de[_0x632f('0x36')]['ids']);}})[_0x632f('0x28')](function(_0x224acd){if(_0x224acd){return db[_0x632f('0x5c')][_0x632f('0x2c')]({'where':{'ListId':_0x3785de[_0x632f('0x36')][_0x632f('0x65')],'CampaignId':_0x3785de['params']['id']}})['then'](function(){return _0x224acd;});}})[_0x632f('0x28')](respondWithStatusCode(_0x1b1134,null))[_0x632f('0x49')](handleError(_0x1b1134,null));};exports[_0x632f('0x82')]=function(_0x14d7d3,_0x3aa82f,_0x1ee0c4){var _0xe1d43f={};var _0xb553cd={};var _0x5a6880;var _0x44cb6f;return db[_0x632f('0x32')][_0x632f('0x5a')]({'where':{'id':_0x14d7d3[_0x632f('0x4a')]['id']}})[_0x632f('0x28')](handleEntityNotFound(_0x3aa82f,null))['then'](function(_0x1f2ef5){if(_0x1f2ef5){_0x5a6880=_0x1f2ef5;_0xb553cd['model']=_[_0x632f('0x4b')](db[_0x632f('0x83')][_0x632f('0x33')]);_0xb553cd['query']=_['keys'](_0x14d7d3[_0x632f('0x36')]);_0xb553cd[_0x632f('0x40')]=_[_0x632f('0x38')](_0xb553cd[_0x632f('0x34')],_0xb553cd[_0x632f('0x36')]);_0xe1d43f[_0x632f('0x37')]=_['intersection'](_0xb553cd[_0x632f('0x34')],qs[_0x632f('0x39')](_0x14d7d3['query'][_0x632f('0x39')]));_0xe1d43f['attributes']=_0xe1d43f[_0x632f('0x37')][_0x632f('0x3a')]?_0xe1d43f[_0x632f('0x37')]:_0xb553cd[_0x632f('0x34')];_0xe1d43f[_0x632f('0x3d')]=qs[_0x632f('0x3e')](_0x14d7d3['query'][_0x632f('0x3e')]);_0xe1d43f[_0x632f('0x3f')]=qs[_0x632f('0x40')](_[_0x632f('0x41')](_0x14d7d3[_0x632f('0x36')],_0xb553cd[_0x632f('0x40')]));if(_0x14d7d3[_0x632f('0x36')]['filter']){_0xe1d43f['where']=_[_0x632f('0x44')](_0xe1d43f[_0x632f('0x3f')],{'$or':_[_0x632f('0x35')](_0xe1d43f[_0x632f('0x37')],function(_0x24689e){var _0x5c3a95={};_0x5c3a95[_0x24689e]={'$like':'%'+_0x14d7d3[_0x632f('0x36')][_0x632f('0x42')]+'%'};return _0x5c3a95;})});}_0xe1d43f=_['merge']({},_0xe1d43f,_0x14d7d3[_0x632f('0x4c')]);return _0x5a6880[_0x632f('0x82')](_0xe1d43f);}})['then'](function(_0x37e840){if(_0x37e840){_0x44cb6f=_0x37e840['length'];if(!_0x14d7d3[_0x632f('0x36')][_0x632f('0x3b')]('nolimit')){_0xe1d43f[_0x632f('0x1f')]=qs[_0x632f('0x1f')](_0x14d7d3[_0x632f('0x36')][_0x632f('0x1f')]);_0xe1d43f[_0x632f('0x1e')]=qs[_0x632f('0x1e')](_0x14d7d3['query'][_0x632f('0x1e')]);}return _0x5a6880[_0x632f('0x82')](_0xe1d43f);}})['then'](function(_0x2ba4e5){if(_0x2ba4e5){return _0x2ba4e5?{'count':_0x44cb6f,'rows':_0x2ba4e5}:null;}})[_0x632f('0x28')](respondWithResult(_0x3aa82f,null))['catch'](handleError(_0x3aa82f,null));};exports[_0x632f('0x84')]=function(_0x25f86d,_0x2a23e1,_0x3b1801){var _0x3ebba8,_0x599e76;return db[_0x632f('0x32')][_0x632f('0x4d')]({'where':{'id':_0x25f86d[_0x632f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a23e1,null))[_0x632f('0x28')](function(_0x3343f7){if(_0x3343f7){_0x599e76=_0x3343f7;return _0x3343f7['addBlackLists'](_0x25f86d[_0x632f('0x4f')][_0x632f('0x65')],_[_0x632f('0x55')](_0x25f86d[_0x632f('0x4f')],[_0x632f('0x65'),'id'])||{});}return null;})[_0x632f('0x66')](function(_0x3a5085){var _0x125363;_0x3ebba8=_0x3a5085||[];var _0x124df3=[];if(_0x3a5085){for(var _0x23f406=0x0;_0x23f406<_0x3a5085[_0x632f('0x3a')];_0x23f406+=0x1){var _0x37ba4c=_0x3a5085[_0x23f406][_0x632f('0x29')]({'plain':!![]});_0x125363=squel[_0x632f('0x69')]()[_0x632f('0x6a')](_0x632f('0x85'))[_0x632f('0x6c')]([_0x632f('0x6d'),_0x632f('0x6f'),_0x632f('0x70'),_0x632f('0x5b'),_0x632f('0x56'),_0x632f('0x57')],squel[_0x632f('0x71')]()[_0x632f('0x73')](_0x632f('0x6d'),_0x632f('0x6d'))[_0x632f('0x73')]('id',_0x632f('0x6f'))['field'](_0x37ba4c[_0x632f('0x75')][_0x632f('0x76')](),_0x632f('0x70'))[_0x632f('0x73')](_0x25f86d[_0x632f('0x4a')]['id'][_0x632f('0x76')](),_0x632f('0x5b'))[_0x632f('0x73')](_0x632f('0x72'),_0x632f('0x56'))[_0x632f('0x73')](_0x632f('0x72'),_0x632f('0x57'))[_0x632f('0x78')](_0x632f('0x7d'))[_0x632f('0x3f')](_0x632f('0x7e'))[_0x632f('0x3f')](_0x632f('0x74'),_0x37ba4c[_0x632f('0x75')]['toString']())[_0x632f('0x3f')](_0x632f('0x77')))[_0x632f('0x76')]();_0x124df3[_0x632f('0x86')](db[_0x632f('0x7f')][_0x632f('0x36')](_0x125363));}return BPromise['all'](_0x124df3);}})['then'](function(){return _0x3ebba8;})[_0x632f('0x28')](respondWithResult(_0x2a23e1,null))['catch'](handleError(_0x2a23e1,null));};exports[_0x632f('0x87')]=function(_0x9d105d,_0x32f66e,_0x25242b){return db[_0x632f('0x32')]['find']({'where':{'id':_0x9d105d['params']['id']}})['then'](handleEntityNotFound(_0x32f66e,null))[_0x632f('0x28')](function(_0x177e8a){if(_0x177e8a){return _0x177e8a[_0x632f('0x87')](_0x9d105d[_0x632f('0x36')][_0x632f('0x65')]);}})[_0x632f('0x28')](function(_0x315b35){if(_0x315b35){return db['CmHopperBlack'][_0x632f('0x2c')]({'where':{'ListId':_0x9d105d[_0x632f('0x36')]['ids'],'CampaignId':_0x9d105d[_0x632f('0x4a')]['id']}})['then'](function(){return _0x315b35;});}})[_0x632f('0x28')](respondWithStatusCode(_0x32f66e,null))[_0x632f('0x49')](handleError(_0x32f66e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 449e262..5fd12da 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3b96e5,_0x124abe){var _0x8facbe=function(_0x5a95ac){while(--_0x5a95ac){_0x3b96e5['push'](_0x3b96e5['shift']());}};_0x8facbe(++_0x124abe);}(_0x7a54,0x106));var _0x47a5=function(_0x1b5b11,_0x34cce8){_0x1b5b11=_0x1b5b11-0x0;var _0x183cde=_0x7a54[_0x1b5b11];return _0x183cde;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 efd09a6..19ca22f 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 _0x5bbd=['info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetCampaign','Campaign','options','raw','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var moment=require(_0xd5bb('0x2'));var BPromise=require(_0xd5bb('0x3'));var rs=require(_0xd5bb('0x4'));var fs=require('fs');var Redis=require(_0xd5bb('0x5'));var db=require(_0xd5bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5bb('0x7'));var jayson=require(_0xd5bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x292873,_0x5093d3,_0x3878ba){return new BPromise(function(_0x17c08f,_0x1e7ad6){return client['request'](_0x292873,_0x3878ba)['then'](function(_0x44ffea){logger[_0xd5bb('0x9')](_0xd5bb('0xa'),_0x5093d3,'request\x20sent');logger[_0xd5bb('0xb')](_0xd5bb('0xc'),_0x5093d3,_0xd5bb('0xd'),JSON['stringify'](_0x44ffea));if(_0x44ffea['error']){if(_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0xf')]===0x1f4){logger['error'](_0xd5bb('0xa'),_0x5093d3,_0x44ffea['error'][_0xd5bb('0x10')]);return _0x1e7ad6(_0x44ffea['error'][_0xd5bb('0x10')]);}logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0x10')]);return _0x17c08f(_0x44ffea[_0xd5bb('0xe')]['message']);}else{logger['info'](_0xd5bb('0xa'),_0x5093d3,_0xd5bb('0xd'));_0x17c08f(_0x44ffea['result'][_0xd5bb('0x10')]);}})[_0xd5bb('0x11')](function(_0x3b7021){logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x3b7021);_0x1e7ad6(_0x3b7021);});});}exports[_0xd5bb('0x12')]=function(_0x41bc89){var _0x567d06=this;return new Promise(function(_0x3d312f,_0x222b0c){return db[_0xd5bb('0x13')]['findAll']({'raw':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x15')]===undefined?!![]:![]:!![],'where':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x16')]||null:null,'attributes':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')]['attributes']||null:null,'limit':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')]['limit']||null:null,'include':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')],function(_0x52383c){return{'model':db[_0x52383c[_0xd5bb('0x19')]],'as':_0x52383c['as'],'attributes':_0x52383c[_0xd5bb('0x1a')],'include':_0x52383c[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x52383c[_0xd5bb('0x17')],function(_0x48f15d){return{'model':db[_0x48f15d['model']],'as':_0x48f15d['as'],'attributes':_0x48f15d[_0xd5bb('0x1a')],'include':_0x48f15d[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x48f15d[_0xd5bb('0x17')],function(_0x351c33){return{'model':db[_0x351c33['model']],'as':_0x351c33['as'],'attributes':_0x351c33[_0xd5bb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30fa6d){logger[_0xd5bb('0x9')](_0xd5bb('0x12'),_0x41bc89);logger[_0xd5bb('0xb')](_0xd5bb('0x12'),_0x41bc89,JSON[_0xd5bb('0x1b')](_0x30fa6d));_0x3d312f(_0x30fa6d);})[_0xd5bb('0x11')](function(_0x228fc4){logger[_0xd5bb('0xe')](_0xd5bb('0x12'),_0x228fc4[_0xd5bb('0x10')],_0x41bc89);_0x222b0c(_0x567d06[_0xd5bb('0xe')](0x1f4,_0x228fc4[_0xd5bb('0x10')]));});});}; \ No newline at end of file +var _0x5178=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','include','map','model','then','util','moment','bluebird'];(function(_0x319674,_0x3be6e7){var _0x5b140a=function(_0x20277d){while(--_0x20277d){_0x319674['push'](_0x319674['shift']());}};_0x5b140a(++_0x3be6e7);}(_0x5178,0x171));var _0x8517=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5178[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var moment=require(_0x8517('0x1'));var BPromise=require(_0x8517('0x2'));var rs=require(_0x8517('0x3'));var fs=require('fs');var Redis=require(_0x8517('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8517('0x5'))(_0x8517('0x6'));var config=require('../../config/environment');var jayson=require(_0x8517('0x7'));var client=jayson['client'][_0x8517('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45498e,_0x3615b2,_0x10f918){return new BPromise(function(_0x25146d,_0x49739b){return client[_0x8517('0x9')](_0x45498e,_0x10f918)['then'](function(_0x485677){logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,'request\x20sent');logger[_0x8517('0xc')](_0x8517('0xd'),_0x3615b2,_0x8517('0xe'),JSON[_0x8517('0xf')](_0x485677));if(_0x485677[_0x8517('0x10')]){if(_0x485677[_0x8517('0x10')][_0x8517('0x11')]===0x1f4){logger[_0x8517('0x10')]('Campaign,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x49739b(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}logger[_0x8517('0x10')]('Campaign,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x25146d(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}else{logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,_0x8517('0xe'));_0x25146d(_0x485677[_0x8517('0x13')][_0x8517('0x12')]);}})[_0x8517('0x14')](function(_0x22b687){logger[_0x8517('0x10')]('Campaign,\x20%s,\x20%s',_0x3615b2,_0x22b687);_0x49739b(_0x22b687);});});}exports[_0x8517('0x15')]=function(_0x100b76){var _0x38e0f3=this;return new Promise(function(_0xf1b53b,_0x64875e){return db[_0x8517('0x16')][_0x8517('0x17')]({'raw':_0x100b76['options']?_0x100b76[_0x8517('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x100b76['options']?_0x100b76[_0x8517('0x18')][_0x8517('0x19')]||null:null,'attributes':_0x100b76[_0x8517('0x18')]?_0x100b76[_0x8517('0x18')][_0x8517('0x1a')]||null:null,'limit':_0x100b76[_0x8517('0x18')]?_0x100b76['options']['limit']||null:null,'include':_0x100b76[_0x8517('0x18')]?_0x100b76[_0x8517('0x18')][_0x8517('0x1b')]?_[_0x8517('0x1c')](_0x100b76[_0x8517('0x18')][_0x8517('0x1b')],function(_0x5f02ee){return{'model':db[_0x5f02ee[_0x8517('0x1d')]],'as':_0x5f02ee['as'],'attributes':_0x5f02ee[_0x8517('0x1a')],'include':_0x5f02ee['include']?_[_0x8517('0x1c')](_0x5f02ee[_0x8517('0x1b')],function(_0x42c779){return{'model':db[_0x42c779['model']],'as':_0x42c779['as'],'attributes':_0x42c779[_0x8517('0x1a')],'include':_0x42c779['include']?_[_0x8517('0x1c')](_0x42c779[_0x8517('0x1b')],function(_0x448211){return{'model':db[_0x448211[_0x8517('0x1d')]],'as':_0x448211['as'],'attributes':_0x448211[_0x8517('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8517('0x1e')](function(_0x481ceb){logger[_0x8517('0xa')]('GetCampaign',_0x100b76);logger[_0x8517('0xc')](_0x8517('0x15'),_0x100b76,JSON[_0x8517('0xf')](_0x481ceb));_0xf1b53b(_0x481ceb);})[_0x8517('0x14')](function(_0x3e6f89){logger[_0x8517('0x10')]('GetCampaign',_0x3e6f89[_0x8517('0x12')],_0x100b76);_0x64875e(_0x38e0f3['error'](0x1f4,_0x3e6f89[_0x8517('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 648136d..e62269e 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 _0x07b5=['/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','/:id/clone','clone','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x3e45b1,_0x23ff50){var _0x433f3c=function(_0x31f593){while(--_0x31f593){_0x3e45b1['push'](_0x3e45b1['shift']());}};_0x433f3c(++_0x23ff50);}(_0x07b5,0x131));var _0x507b=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x07b5[_0x3bb5b4];return _0x586c60;};'use strict';var multer=require(_0x507b('0x0'));var util=require(_0x507b('0x1'));var path=require(_0x507b('0x2'));var timeout=require(_0x507b('0x3'));var express=require(_0x507b('0x4'));var router=express[_0x507b('0x5')]();var fs_extra=require(_0x507b('0x6'));var auth=require(_0x507b('0x7'));var interaction=require(_0x507b('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x507b('0x9')]('/',auth[_0x507b('0xa')](),controller[_0x507b('0xb')]);router['get'](_0x507b('0xc'),auth[_0x507b('0xa')](),controller[_0x507b('0xd')]);router[_0x507b('0x9')](_0x507b('0xe'),auth['isAuthenticated'](),controller[_0x507b('0xf')]);router[_0x507b('0x9')](_0x507b('0x10'),auth[_0x507b('0xa')](),controller[_0x507b('0x11')]);router[_0x507b('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x507b('0x12')]);router[_0x507b('0x9')](_0x507b('0x13'),auth[_0x507b('0xa')](),controller[_0x507b('0x14')]);router[_0x507b('0x9')]('/:id/lists',auth[_0x507b('0xa')](),controller[_0x507b('0x15')]);router[_0x507b('0x9')]('/:id/blacklists',auth[_0x507b('0xa')](),controller[_0x507b('0x16')]);router[_0x507b('0x17')]('/',auth[_0x507b('0xa')](),controller['create']);router[_0x507b('0x17')](_0x507b('0x18'),auth[_0x507b('0xa')](),controller[_0x507b('0x19')]);router[_0x507b('0x17')](_0x507b('0x1a'),auth[_0x507b('0xa')](),controller[_0x507b('0x1b')]);router[_0x507b('0x17')](_0x507b('0x1c'),auth[_0x507b('0xa')](),controller[_0x507b('0x1d')]);router[_0x507b('0x1e')](_0x507b('0xc'),auth[_0x507b('0xa')](),controller[_0x507b('0x1f')]);router['delete'](_0x507b('0xc'),auth[_0x507b('0xa')](),controller[_0x507b('0x20')]);router[_0x507b('0x21')](_0x507b('0x1a'),auth[_0x507b('0xa')](),controller[_0x507b('0x22')]);router[_0x507b('0x21')](_0x507b('0x1c'),auth[_0x507b('0xa')](),controller['removeBlackLists']);module[_0x507b('0x23')]=router; \ No newline at end of file +var _0x49e9=['isAuthenticated','/:id','show','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./campaign.controller','get'];(function(_0x37dee5,_0x894eb5){var _0x42544b=function(_0x31d562){while(--_0x31d562){_0x37dee5['push'](_0x37dee5['shift']());}};_0x42544b(++_0x894eb5);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var path=require('path');var timeout=require(_0x949e('0x2'));var express=require(_0x949e('0x3'));var router=express[_0x949e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x949e('0x5'));var config=require('../../config/environment');var controller=require(_0x949e('0x6'));router[_0x949e('0x7')]('/',auth[_0x949e('0x8')](),controller['index']);router[_0x949e('0x7')](_0x949e('0x9'),auth[_0x949e('0x8')](),controller[_0x949e('0xa')]);router[_0x949e('0x7')](_0x949e('0xb'),auth[_0x949e('0x8')](),controller['getHoppers']);router[_0x949e('0x7')]('/:id/hopper_histories',auth[_0x949e('0x8')](),controller[_0x949e('0xc')]);router[_0x949e('0x7')]('/:id/hopper_finals',auth[_0x949e('0x8')](),controller[_0x949e('0xd')]);router[_0x949e('0x7')](_0x949e('0xe'),auth[_0x949e('0x8')](),controller[_0x949e('0xf')]);router[_0x949e('0x7')](_0x949e('0x10'),auth[_0x949e('0x8')](),controller[_0x949e('0x11')]);router[_0x949e('0x7')](_0x949e('0x12'),auth[_0x949e('0x8')](),controller[_0x949e('0x13')]);router[_0x949e('0x14')]('/',auth['isAuthenticated'](),controller[_0x949e('0x15')]);router[_0x949e('0x14')](_0x949e('0x16'),auth[_0x949e('0x8')](),controller['clone']);router[_0x949e('0x14')](_0x949e('0x10'),auth['isAuthenticated'](),controller[_0x949e('0x17')]);router[_0x949e('0x14')](_0x949e('0x12'),auth[_0x949e('0x8')](),controller[_0x949e('0x18')]);router['put'](_0x949e('0x9'),auth[_0x949e('0x8')](),controller[_0x949e('0x19')]);router[_0x949e('0x1a')](_0x949e('0x9'),auth[_0x949e('0x8')](),controller[_0x949e('0x1b')]);router[_0x949e('0x1a')](_0x949e('0x10'),auth[_0x949e('0x8')](),controller[_0x949e('0x1c')]);router[_0x949e('0x1a')](_0x949e('0x12'),auth[_0x949e('0x8')](),controller[_0x949e('0x1d')]);module[_0x949e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index af4b9fe..d50beda 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 _0x8cf4=['exports','STRING','TEXT','getDataValue','key','sequelize'];(function(_0x37a416,_0x14ee6a){var _0x47959e=function(_0x57aa93){while(--_0x57aa93){_0x37a416['push'](_0x37a416['shift']());}};_0x47959e(++_0x14ee6a);}(_0x8cf4,0x18b));var _0x48cf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8cf4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x48cf('0x0'));module[_0x48cf('0x1')]={'key':{'type':Sequelize[_0x48cf('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x48cf('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x48cf('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x48cf('0x4')](_0x48cf('0x5'));}}}; \ No newline at end of file +var _0x5075=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x119ffc,_0x2bfa14){var _0x21603f=function(_0x43c105){while(--_0x43c105){_0x119ffc['push'](_0x119ffc['shift']());}};_0x21603f(++_0x2bfa14);}(_0x5075,0x15f));var _0x5507=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x5075[_0x1b02bb];return _0x131245;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'key':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x5507('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'name':{'type':Sequelize[_0x5507('0x4')],'get':function(){return this[_0x5507('0x5')](_0x5507('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 68c61ca..eb85a6a 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 _0x3bb3=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','CannedAnswers','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','CannedAnswer','includeAll','include','rows','catch','params','keys','merge','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0x3bb3,0x1b2));var _0x33bb=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3bb3[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x33bb('0x0'));var rimraf=require(_0x33bb('0x1'));var zipdir=require(_0x33bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33bb('0x3'));var moment=require('moment');var BPromise=require(_0x33bb('0x4'));var Mustache=require(_0x33bb('0x5'));var util=require(_0x33bb('0x6'));var path=require(_0x33bb('0x7'));var sox=require(_0x33bb('0x8'));var csv=require('to-csv');var ejs=require(_0x33bb('0x9'));var fs=require('fs');var fs_extra=require(_0x33bb('0xa'));var _=require(_0x33bb('0xb'));var squel=require('squel');var crypto=require(_0x33bb('0xc'));var jsforce=require(_0x33bb('0xd'));var deskjs=require(_0x33bb('0xe'));var toCsv=require(_0x33bb('0xf'));var querystring=require(_0x33bb('0x10'));var Papa=require(_0x33bb('0x11'));var Redis=require(_0x33bb('0x12'));var authService=require(_0x33bb('0x13'));var qs=require(_0x33bb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bb('0x15'))(_0x33bb('0x16'));var utils=require('../../config/utils');var config=require(_0x33bb('0x17'));var licenseUtil=require(_0x33bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d3b63,_0x145601){_0x145601=_0x145601||0xcc;return function(_0x1432c8){if(_0x1432c8){return _0x2d3b63[_0x33bb('0x19')](_0x145601);}return _0x2d3b63[_0x33bb('0x1a')](_0x145601)['end']();};}function respondWithResult(_0x4500d1,_0x4295a3){_0x4295a3=_0x4295a3||0xc8;return function(_0x13bda8){if(_0x13bda8){return _0x4500d1[_0x33bb('0x1a')](_0x4295a3)[_0x33bb('0x1b')](_0x13bda8);}};}function respondWithFilteredResult(_0x1f3918,_0x27b44){return function(_0x40a8de){if(_0x40a8de){var _0x35b9c5=typeof _0x27b44['offset']===_0x33bb('0x1c')&&typeof _0x27b44[_0x33bb('0x1d')]==='undefined';var _0x589e01=_0x40a8de[_0x33bb('0x1e')];var _0x2bbd5b=_0x35b9c5?0x0:_0x27b44['offset'];var _0x8fc64e=_0x35b9c5?_0x40a8de[_0x33bb('0x1e')]:_0x27b44[_0x33bb('0x1f')]+_0x27b44['limit'];var _0x5f1b1d;if(_0x8fc64e>=_0x589e01){_0x8fc64e=_0x589e01;_0x5f1b1d=0xc8;}else{_0x5f1b1d=0xce;}_0x1f3918['status'](_0x5f1b1d);return _0x1f3918[_0x33bb('0x20')]('Content-Range',_0x2bbd5b+'-'+_0x8fc64e+'/'+_0x589e01)[_0x33bb('0x1b')](_0x40a8de);}return null;};}function patchUpdates(_0x59efdb){return function(_0x53c093){try{jsonpatch[_0x33bb('0x21')](_0x53c093,_0x59efdb,!![]);}catch(_0x125dac){return BPromise[_0x33bb('0x22')](_0x125dac);}return _0x53c093[_0x33bb('0x23')]();};}function saveUpdates(_0x2dc194,_0xec3d83){return function(_0x22a0eb){if(_0x22a0eb){return _0x22a0eb[_0x33bb('0x24')](_0x2dc194)[_0x33bb('0x25')](function(_0x1492fd){return _0x1492fd;});}return null;};}function removeEntity(_0x34b0d5,_0x1c4a17){return function(_0x2e73e0){if(_0x2e73e0){return _0x2e73e0[_0x33bb('0x26')]()[_0x33bb('0x25')](function(){var _0x250e35=_0x2e73e0[_0x33bb('0x27')]({'plain':!![]});var _0x3a9a8d=_0x33bb('0x28');return db['UserProfileResource'][_0x33bb('0x26')]({'where':{'type':_0x3a9a8d,'resourceId':_0x250e35['id']}})['then'](function(){return _0x2e73e0;});})['then'](function(){_0x34b0d5[_0x33bb('0x1a')](0xcc)[_0x33bb('0x29')]();});}};}function handleEntityNotFound(_0x3b5cc1,_0x5b3fd6){return function(_0x46052b){if(!_0x46052b){_0x3b5cc1[_0x33bb('0x19')](0x194);}return _0x46052b;};}function handleError(_0x1f7245,_0x4458f1){_0x4458f1=_0x4458f1||0x1f4;return function(_0x54c253){logger[_0x33bb('0x2a')](_0x54c253[_0x33bb('0x2b')]);if(_0x54c253[_0x33bb('0x2c')]){delete _0x54c253[_0x33bb('0x2c')];}_0x1f7245[_0x33bb('0x1a')](_0x4458f1)[_0x33bb('0x2d')](_0x54c253);};}exports['index']=function(_0x259d63,_0x5d4bb3){var _0x3f5849={},_0x29f305={},_0x4aa1a8={'count':0x0,'rows':[]};var _0x56be39=_[_0x33bb('0x2e')](db['CannedAnswer'][_0x33bb('0x2f')],function(_0x3d4551){return{'name':_0x3d4551[_0x33bb('0x30')],'type':_0x3d4551[_0x33bb('0x31')][_0x33bb('0x32')]};});_0x29f305[_0x33bb('0x33')]=_['map'](_0x56be39,_0x33bb('0x2c'));_0x29f305[_0x33bb('0x34')]=_['keys'](_0x259d63[_0x33bb('0x34')]);_0x29f305['filters']=_[_0x33bb('0x35')](_0x29f305[_0x33bb('0x33')],_0x29f305[_0x33bb('0x34')]);_0x3f5849['attributes']=_[_0x33bb('0x35')](_0x29f305['model'],qs['fields'](_0x259d63['query'][_0x33bb('0x36')]));_0x3f5849[_0x33bb('0x37')]=_0x3f5849['attributes'][_0x33bb('0x38')]?_0x3f5849[_0x33bb('0x37')]:_0x29f305[_0x33bb('0x33')];if(!_0x259d63[_0x33bb('0x34')]['hasOwnProperty'](_0x33bb('0x39'))){_0x3f5849[_0x33bb('0x1d')]=qs[_0x33bb('0x1d')](_0x259d63[_0x33bb('0x34')][_0x33bb('0x1d')]);_0x3f5849['offset']=qs[_0x33bb('0x1f')](_0x259d63[_0x33bb('0x34')][_0x33bb('0x1f')]);}_0x3f5849['order']=qs[_0x33bb('0x3a')](_0x259d63[_0x33bb('0x34')][_0x33bb('0x3a')]);_0x3f5849[_0x33bb('0x3b')]=qs[_0x33bb('0x3c')](_[_0x33bb('0x3d')](_0x259d63[_0x33bb('0x34')],_0x29f305[_0x33bb('0x3c')]),_0x56be39);if(_0x259d63['query']['filter']){_0x3f5849[_0x33bb('0x3b')]=_['merge'](_0x3f5849[_0x33bb('0x3b')],{'$or':[{'key':{'$like':'%'+_0x259d63[_0x33bb('0x34')][_0x33bb('0x3e')]+'%'}},{'value':{'$like':'%'+_0x259d63[_0x33bb('0x34')][_0x33bb('0x3e')]+'%'}}]});}_0x3f5849=_['merge']({},_0x3f5849,_0x259d63['options']);var _0x530eb9={'where':_0x3f5849[_0x33bb('0x3b')]};return db[_0x33bb('0x3f')]['count'](_0x530eb9)['then'](function(_0x1b1f7f){_0x4aa1a8[_0x33bb('0x1e')]=_0x1b1f7f;if(_0x259d63[_0x33bb('0x34')][_0x33bb('0x40')]){_0x3f5849[_0x33bb('0x41')]=[{'all':!![]}];}return db[_0x33bb('0x3f')]['findAll'](_0x3f5849);})[_0x33bb('0x25')](function(_0x5d6648){_0x4aa1a8[_0x33bb('0x42')]=_0x5d6648;return _0x4aa1a8;})['then'](respondWithFilteredResult(_0x5d4bb3,_0x3f5849))[_0x33bb('0x43')](handleError(_0x5d4bb3,null));};exports['show']=function(_0x284cbb,_0x3a652f){var _0x88336f={'raw':!![],'where':{'id':_0x284cbb[_0x33bb('0x44')]['id']}},_0x3a30d7={};_0x3a30d7[_0x33bb('0x33')]=_[_0x33bb('0x45')](db[_0x33bb('0x3f')][_0x33bb('0x2f')]);_0x3a30d7[_0x33bb('0x34')]=_[_0x33bb('0x45')](_0x284cbb[_0x33bb('0x34')]);_0x3a30d7[_0x33bb('0x3c')]=_[_0x33bb('0x35')](_0x3a30d7[_0x33bb('0x33')],_0x3a30d7[_0x33bb('0x34')]);_0x88336f[_0x33bb('0x37')]=_[_0x33bb('0x35')](_0x3a30d7[_0x33bb('0x33')],qs[_0x33bb('0x36')](_0x284cbb[_0x33bb('0x34')][_0x33bb('0x36')]));_0x88336f[_0x33bb('0x37')]=_0x88336f['attributes'][_0x33bb('0x38')]?_0x88336f['attributes']:_0x3a30d7[_0x33bb('0x33')];if(_0x284cbb['query'][_0x33bb('0x40')]){_0x88336f[_0x33bb('0x41')]=[{'all':!![]}];}_0x88336f=_[_0x33bb('0x46')]({},_0x88336f,_0x284cbb[_0x33bb('0x47')]);return db['CannedAnswer'][_0x33bb('0x48')](_0x88336f)[_0x33bb('0x25')](handleEntityNotFound(_0x3a652f,null))[_0x33bb('0x25')](respondWithResult(_0x3a652f,null))[_0x33bb('0x43')](handleError(_0x3a652f,null));};exports['update']=function(_0x272b68,_0xac4b49){if(_0x272b68['body']['id']){delete _0x272b68[_0x33bb('0x49')]['id'];}return db[_0x33bb('0x3f')][_0x33bb('0x48')]({'where':{'id':_0x272b68[_0x33bb('0x44')]['id']}})[_0x33bb('0x25')](handleEntityNotFound(_0xac4b49,null))[_0x33bb('0x25')](saveUpdates(_0x272b68[_0x33bb('0x49')],null))['then'](respondWithResult(_0xac4b49,null))[_0x33bb('0x43')](handleError(_0xac4b49,null));};exports[_0x33bb('0x26')]=function(_0x40296c,_0x2b5cd8){return db[_0x33bb('0x3f')][_0x33bb('0x48')]({'where':{'id':_0x40296c[_0x33bb('0x44')]['id']}})[_0x33bb('0x25')](handleEntityNotFound(_0x2b5cd8,null))[_0x33bb('0x25')](removeEntity(_0x2b5cd8,null))[_0x33bb('0x43')](handleError(_0x2b5cd8,null));};exports[_0x33bb('0x4a')]=function(_0x211f78,_0x11e555){var _0x4d523f={'key':_0x211f78[_0x33bb('0x49')][_0x33bb('0x32')]};if(_0x211f78[_0x33bb('0x49')][_0x33bb('0x4b')]){_0x4d523f[_0x33bb('0x4b')]=_0x211f78[_0x33bb('0x49')]['MailAccountId'];}else if(_0x211f78['body'][_0x33bb('0x4c')]){_0x4d523f[_0x33bb('0x4c')]=_0x211f78['body'][_0x33bb('0x4c')];}else if(_0x211f78[_0x33bb('0x49')][_0x33bb('0x4d')]){_0x4d523f['OpenchannelAccountId']=_0x211f78[_0x33bb('0x49')][_0x33bb('0x4d')];}else if(_0x211f78[_0x33bb('0x49')][_0x33bb('0x4e')]){_0x4d523f[_0x33bb('0x4e')]=_0x211f78[_0x33bb('0x49')][_0x33bb('0x4e')];}return db[_0x33bb('0x3f')][_0x33bb('0x48')]({'where':_0x4d523f})['then'](function(_0x4fe440){if(_0x4fe440){throw new db[(_0x33bb('0x4f'))]['ValidationError'](_0x33bb('0x50'));}return db[_0x33bb('0x3f')][_0x33bb('0x4a')](_0x211f78[_0x33bb('0x49')]);})[_0x33bb('0x25')](function(_0x19107a){var _0x190961=_0x211f78[_0x33bb('0x51')]['get']({'plain':!![]});if(!_0x190961)throw new Error(_0x33bb('0x52'));if(_0x190961[_0x33bb('0x53')]===_0x33bb('0x51')){var _0xac77d2=_0x19107a['get']({'plain':!![]});return db[_0x33bb('0x54')][_0x33bb('0x48')]({'where':{'name':_0x33bb('0x28'),'userProfileId':_0x190961[_0x33bb('0x55')]},'raw':!![]})[_0x33bb('0x25')](function(_0x22eed0){if(_0x22eed0&&_0x22eed0[_0x33bb('0x56')]===0x0){return db[_0x33bb('0x57')][_0x33bb('0x4a')]({'name':_0xac77d2[_0x33bb('0x2c')],'resourceId':_0xac77d2['id'],'type':_0x22eed0[_0x33bb('0x2c')],'sectionId':_0x22eed0['id']},{})[_0x33bb('0x25')](function(){return _0x19107a;});}else{return _0x19107a;}})[_0x33bb('0x43')](function(_0xbfd1ba){logger['error'](_0x33bb('0x58'),_0xbfd1ba);throw _0xbfd1ba;});}return _0x19107a;})[_0x33bb('0x25')](respondWithResult(_0x11e555,0xc9))['catch'](handleError(_0x11e555,null));}; \ No newline at end of file +var _0x95e2=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','show','params','catch','body','find','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId'];(function(_0x466f46,_0x53cb02){var _0x3fad5d=function(_0x58ce80){while(--_0x58ce80){_0x466f46['push'](_0x466f46['shift']());}};_0x3fad5d(++_0x53cb02);}(_0x95e2,0x113));var _0x295e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x295e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x295e('0x1'));var jsonpatch=require(_0x295e('0x2'));var rp=require('request-promise');var moment=require(_0x295e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x295e('0x4'));var path=require(_0x295e('0x5'));var sox=require(_0x295e('0x6'));var csv=require(_0x295e('0x7'));var ejs=require(_0x295e('0x8'));var fs=require('fs');var fs_extra=require(_0x295e('0x9'));var _=require(_0x295e('0xa'));var squel=require('squel');var crypto=require(_0x295e('0xb'));var jsforce=require(_0x295e('0xc'));var deskjs=require(_0x295e('0xd'));var toCsv=require(_0x295e('0x7'));var querystring=require(_0x295e('0xe'));var Papa=require(_0x295e('0xf'));var Redis=require(_0x295e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x295e('0x11'));var as=require(_0x295e('0x12'));var hardwareService=require(_0x295e('0x13'));var logger=require(_0x295e('0x14'))('api');var utils=require(_0x295e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x295e('0x16'));var db=require(_0x295e('0x17'))['db'];function respondWithStatusCode(_0x519644,_0x2e5002){_0x2e5002=_0x2e5002||0xcc;return function(_0x5bd4ef){if(_0x5bd4ef){return _0x519644['sendStatus'](_0x2e5002);}return _0x519644[_0x295e('0x18')](_0x2e5002)[_0x295e('0x19')]();};}function respondWithResult(_0x1138a9,_0x5d06d5){_0x5d06d5=_0x5d06d5||0xc8;return function(_0x1fd731){if(_0x1fd731){return _0x1138a9[_0x295e('0x18')](_0x5d06d5)[_0x295e('0x1a')](_0x1fd731);}};}function respondWithFilteredResult(_0x2757de,_0x24ac86){return function(_0x14c1ea){if(_0x14c1ea){var _0x1f1aac=typeof _0x24ac86[_0x295e('0x1b')]===_0x295e('0x1c')&&typeof _0x24ac86[_0x295e('0x1d')]===_0x295e('0x1c');var _0x460440=_0x14c1ea[_0x295e('0x1e')];var _0x5a4671=_0x1f1aac?0x0:_0x24ac86[_0x295e('0x1b')];var _0x4a9a09=_0x1f1aac?_0x14c1ea[_0x295e('0x1e')]:_0x24ac86[_0x295e('0x1b')]+_0x24ac86['limit'];var _0x4e2085;if(_0x4a9a09>=_0x460440){_0x4a9a09=_0x460440;_0x4e2085=0xc8;}else{_0x4e2085=0xce;}_0x2757de[_0x295e('0x18')](_0x4e2085);return _0x2757de[_0x295e('0x1f')]('Content-Range',_0x5a4671+'-'+_0x4a9a09+'/'+_0x460440)[_0x295e('0x1a')](_0x14c1ea);}return null;};}function patchUpdates(_0x5b4a7a){return function(_0x2ff97e){try{jsonpatch[_0x295e('0x20')](_0x2ff97e,_0x5b4a7a,!![]);}catch(_0x4371b6){return BPromise[_0x295e('0x21')](_0x4371b6);}return _0x2ff97e[_0x295e('0x22')]();};}function saveUpdates(_0x3362f3,_0x1304b8){return function(_0x3bb554){if(_0x3bb554){return _0x3bb554[_0x295e('0x23')](_0x3362f3)['then'](function(_0x5d380c){return _0x5d380c;});}return null;};}function removeEntity(_0x2d0e09,_0x39e73a){return function(_0x28b91f){if(_0x28b91f){return _0x28b91f[_0x295e('0x24')]()[_0x295e('0x25')](function(){var _0x5d4f87=_0x28b91f['get']({'plain':!![]});var _0x230d97=_0x295e('0x26');return db[_0x295e('0x27')][_0x295e('0x24')]({'where':{'type':_0x230d97,'resourceId':_0x5d4f87['id']}})[_0x295e('0x25')](function(){return _0x28b91f;});})[_0x295e('0x25')](function(){_0x2d0e09[_0x295e('0x18')](0xcc)[_0x295e('0x19')]();});}};}function handleEntityNotFound(_0x3587fb,_0x584d90){return function(_0x4dea8d){if(!_0x4dea8d){_0x3587fb[_0x295e('0x28')](0x194);}return _0x4dea8d;};}function handleError(_0x553a0b,_0x49f666){_0x49f666=_0x49f666||0x1f4;return function(_0x3fcdb5){logger[_0x295e('0x29')](_0x3fcdb5[_0x295e('0x2a')]);if(_0x3fcdb5[_0x295e('0x2b')]){delete _0x3fcdb5[_0x295e('0x2b')];}_0x553a0b[_0x295e('0x18')](_0x49f666)[_0x295e('0x2c')](_0x3fcdb5);};}exports[_0x295e('0x2d')]=function(_0x535801,_0x3620cd){var _0x23518f={},_0xd96174={},_0x358fb6={'count':0x0,'rows':[]};var _0x16ed0a=_['map'](db[_0x295e('0x2e')][_0x295e('0x2f')],function(_0x29c692){return{'name':_0x29c692[_0x295e('0x30')],'type':_0x29c692[_0x295e('0x31')]['key']};});_0xd96174[_0x295e('0x32')]=_[_0x295e('0x33')](_0x16ed0a,_0x295e('0x2b'));_0xd96174['query']=_[_0x295e('0x34')](_0x535801[_0x295e('0x35')]);_0xd96174[_0x295e('0x36')]=_[_0x295e('0x37')](_0xd96174[_0x295e('0x32')],_0xd96174[_0x295e('0x35')]);_0x23518f[_0x295e('0x38')]=_[_0x295e('0x37')](_0xd96174['model'],qs[_0x295e('0x39')](_0x535801['query'][_0x295e('0x39')]));_0x23518f[_0x295e('0x38')]=_0x23518f[_0x295e('0x38')][_0x295e('0x3a')]?_0x23518f[_0x295e('0x38')]:_0xd96174[_0x295e('0x32')];if(!_0x535801['query'][_0x295e('0x3b')](_0x295e('0x3c'))){_0x23518f[_0x295e('0x1d')]=qs[_0x295e('0x1d')](_0x535801[_0x295e('0x35')]['limit']);_0x23518f[_0x295e('0x1b')]=qs[_0x295e('0x1b')](_0x535801[_0x295e('0x35')][_0x295e('0x1b')]);}_0x23518f[_0x295e('0x3d')]=qs['sort'](_0x535801[_0x295e('0x35')][_0x295e('0x3e')]);_0x23518f[_0x295e('0x3f')]=qs[_0x295e('0x36')](_[_0x295e('0x40')](_0x535801['query'],_0xd96174[_0x295e('0x36')]),_0x16ed0a);if(_0x535801[_0x295e('0x35')]['filter']){_0x23518f['where']=_[_0x295e('0x41')](_0x23518f[_0x295e('0x3f')],{'$or':[{'key':{'$like':'%'+_0x535801[_0x295e('0x35')][_0x295e('0x42')]+'%'}},{'value':{'$like':'%'+_0x535801[_0x295e('0x35')][_0x295e('0x42')]+'%'}}]});}_0x23518f=_[_0x295e('0x41')]({},_0x23518f,_0x535801[_0x295e('0x43')]);var _0x1688d7={'where':_0x23518f[_0x295e('0x3f')]};return db[_0x295e('0x2e')][_0x295e('0x1e')](_0x1688d7)[_0x295e('0x25')](function(_0x312326){_0x358fb6[_0x295e('0x1e')]=_0x312326;if(_0x535801[_0x295e('0x35')][_0x295e('0x44')]){_0x23518f[_0x295e('0x45')]=[{'all':!![]}];}return db[_0x295e('0x2e')][_0x295e('0x46')](_0x23518f);})[_0x295e('0x25')](function(_0x349337){_0x358fb6['rows']=_0x349337;return _0x358fb6;})[_0x295e('0x25')](respondWithFilteredResult(_0x3620cd,_0x23518f))['catch'](handleError(_0x3620cd,null));};exports[_0x295e('0x47')]=function(_0x4fc28c,_0x14f45f){var _0x19e013={'raw':!![],'where':{'id':_0x4fc28c[_0x295e('0x48')]['id']}},_0x527422={};_0x527422[_0x295e('0x32')]=_[_0x295e('0x34')](db[_0x295e('0x2e')][_0x295e('0x2f')]);_0x527422[_0x295e('0x35')]=_[_0x295e('0x34')](_0x4fc28c[_0x295e('0x35')]);_0x527422[_0x295e('0x36')]=_[_0x295e('0x37')](_0x527422[_0x295e('0x32')],_0x527422['query']);_0x19e013[_0x295e('0x38')]=_[_0x295e('0x37')](_0x527422[_0x295e('0x32')],qs[_0x295e('0x39')](_0x4fc28c[_0x295e('0x35')][_0x295e('0x39')]));_0x19e013[_0x295e('0x38')]=_0x19e013[_0x295e('0x38')][_0x295e('0x3a')]?_0x19e013[_0x295e('0x38')]:_0x527422['model'];if(_0x4fc28c[_0x295e('0x35')][_0x295e('0x44')]){_0x19e013['include']=[{'all':!![]}];}_0x19e013=_[_0x295e('0x41')]({},_0x19e013,_0x4fc28c[_0x295e('0x43')]);return db['CannedAnswer']['find'](_0x19e013)[_0x295e('0x25')](handleEntityNotFound(_0x14f45f,null))[_0x295e('0x25')](respondWithResult(_0x14f45f,null))[_0x295e('0x49')](handleError(_0x14f45f,null));};exports[_0x295e('0x23')]=function(_0x1c434e,_0xb59234){if(_0x1c434e[_0x295e('0x4a')]['id']){delete _0x1c434e[_0x295e('0x4a')]['id'];}return db[_0x295e('0x2e')][_0x295e('0x4b')]({'where':{'id':_0x1c434e[_0x295e('0x48')]['id']}})[_0x295e('0x25')](handleEntityNotFound(_0xb59234,null))['then'](saveUpdates(_0x1c434e[_0x295e('0x4a')],null))[_0x295e('0x25')](respondWithResult(_0xb59234,null))[_0x295e('0x49')](handleError(_0xb59234,null));};exports['destroy']=function(_0x351191,_0x231b06){return db[_0x295e('0x2e')][_0x295e('0x4b')]({'where':{'id':_0x351191[_0x295e('0x48')]['id']}})[_0x295e('0x25')](handleEntityNotFound(_0x231b06,null))[_0x295e('0x25')](removeEntity(_0x231b06,null))[_0x295e('0x49')](handleError(_0x231b06,null));};exports[_0x295e('0x4c')]=function(_0x40f74e,_0x28da7e){var _0x40a9dc={'key':_0x40f74e[_0x295e('0x4a')][_0x295e('0x4d')]};if(_0x40f74e['body'][_0x295e('0x4e')]){_0x40a9dc[_0x295e('0x4e')]=_0x40f74e[_0x295e('0x4a')][_0x295e('0x4e')];}else if(_0x40f74e[_0x295e('0x4a')][_0x295e('0x4f')]){_0x40a9dc['SmsAccountId']=_0x40f74e[_0x295e('0x4a')][_0x295e('0x4f')];}else if(_0x40f74e['body'][_0x295e('0x50')]){_0x40a9dc[_0x295e('0x50')]=_0x40f74e[_0x295e('0x4a')]['OpenchannelAccountId'];}else if(_0x40f74e[_0x295e('0x4a')][_0x295e('0x51')]){_0x40a9dc['ChatWebsiteId']=_0x40f74e[_0x295e('0x4a')][_0x295e('0x51')];}return db[_0x295e('0x2e')][_0x295e('0x4b')]({'where':_0x40a9dc})[_0x295e('0x25')](function(_0x2e53e6){if(_0x2e53e6){throw new db[(_0x295e('0x52'))][(_0x295e('0x53'))](_0x295e('0x54'));}return db[_0x295e('0x2e')]['create'](_0x40f74e[_0x295e('0x4a')]);})[_0x295e('0x25')](function(_0x5b025e){var _0x2f140c=_0x40f74e['user']['get']({'plain':!![]});if(!_0x2f140c)throw new Error(_0x295e('0x55'));if(_0x2f140c['role']==='user'){var _0x2ccb93=_0x5b025e[_0x295e('0x56')]({'plain':!![]});return db[_0x295e('0x57')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x2f140c[_0x295e('0x58')]},'raw':!![]})['then'](function(_0x5cf4d8){if(_0x5cf4d8&&_0x5cf4d8[_0x295e('0x59')]===0x0){return db[_0x295e('0x27')]['create']({'name':_0x2ccb93[_0x295e('0x2b')],'resourceId':_0x2ccb93['id'],'type':_0x5cf4d8[_0x295e('0x2b')],'sectionId':_0x5cf4d8['id']},{})['then'](function(){return _0x5b025e;});}else{return _0x5b025e;}})[_0x295e('0x49')](function(_0x5a25a6){logger['error'](_0x295e('0x5a'),_0x5a25a6);throw _0x5a25a6;});}return _0x5b025e;})[_0x295e('0x25')](respondWithResult(_0x28da7e,0xc9))[_0x295e('0x49')](handleError(_0x28da7e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1115659..547e7fb 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 _0x7990=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x7990,0xe3));var _0x0799=function(_0xa8a859,_0x5cfcec){_0xa8a859=_0xa8a859-0x0;var _0xc4b628=_0x7990[_0xa8a859];return _0xc4b628;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));var logger=require(_0x0799('0x2'))(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var BPromise=require(_0x0799('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0799('0x6'));var rimraf=require('rimraf');var config=require(_0x0799('0x7'));var attributes=require(_0x0799('0x8'));module['exports']=function(_0x25f287,_0x14bdfc){return _0x25f287['define'](_0x0799('0x9'),attributes,{'tableName':_0x0799('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0799('0xb')});}; \ No newline at end of file +var _0xd490=['request-promise','path','./cannedAnswer.attributes','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x48a24a,_0x3cb63c){var _0x5e35d8=function(_0x406d56){while(--_0x406d56){_0x48a24a['push'](_0x48a24a['shift']());}};_0x5e35d8(++_0x3cb63c);}(_0xd490,0xd7));var _0x0d49=function(_0x5b3ae9,_0x1332fc){_0x5b3ae9=_0x5b3ae9-0x0;var _0x113f50=_0xd490[_0x5b3ae9];return _0x113f50;};'use strict';var _=require(_0x0d49('0x0'));var util=require('util');var logger=require(_0x0d49('0x1'))(_0x0d49('0x2'));var moment=require(_0x0d49('0x3'));var BPromise=require(_0x0d49('0x4'));var rp=require(_0x0d49('0x5'));var fs=require('fs');var path=require(_0x0d49('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0d49('0x7'));module['exports']=function(_0x11a5b4,_0x18b70b){return _0x11a5b4['define'](_0x0d49('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d49('0x9'),'collate':_0x0d49('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 57a0e78..36f247b 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(_0x46aa27,_0x1b8e08){var _0x3c570e=function(_0x38b5cf){while(--_0x38b5cf){_0x46aa27['push'](_0x46aa27['shift']());}};_0x3c570e(++_0x1b8e08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x1fca2a,_0x5a8934){var _0xce64d8=function(_0x621d84){while(--_0x621d84){_0x1fca2a['push'](_0x1fca2a['shift']());}};_0xce64d8(++_0x5a8934);}(_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 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 089aa93..e2804e0 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 _0x1ec2=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x17933a,_0x1319ef){var _0x4b6a02=function(_0x321b46){while(--_0x321b46){_0x17933a['push'](_0x17933a['shift']());}};_0x4b6a02(++_0x1319ef);}(_0x1ec2,0x103));var _0x21ec=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x1ec2[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x21ec('0x0'));var util=require(_0x21ec('0x1'));var path=require(_0x21ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x21ec('0x3'));var router=express['Router']();var fs_extra=require(_0x21ec('0x4'));var auth=require(_0x21ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x21ec('0x6'));var controller=require(_0x21ec('0x7'));router[_0x21ec('0x8')]('/',auth[_0x21ec('0x9')](),controller[_0x21ec('0xa')]);router['get'](_0x21ec('0xb'),auth[_0x21ec('0x9')](),controller[_0x21ec('0xc')]);router[_0x21ec('0xd')]('/',auth[_0x21ec('0x9')](),controller[_0x21ec('0xe')]);router[_0x21ec('0xf')](_0x21ec('0xb'),auth[_0x21ec('0x9')](),controller['update']);router[_0x21ec('0x10')](_0x21ec('0xb'),auth[_0x21ec('0x9')](),controller[_0x21ec('0x11')]);module[_0x21ec('0x12')]=router; \ No newline at end of file +var _0x9beb=['show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id'];(function(_0x74415f,_0x53a87a){var _0x593f5c=function(_0x1f07c8){while(--_0x1f07c8){_0x74415f['push'](_0x74415f['shift']());}};_0x593f5c(++_0x53a87a);}(_0x9beb,0x181));var _0xb9be=function(_0x1f29c2,_0x10b19c){_0x1f29c2=_0x1f29c2-0x0;var _0x2898a3=_0x9beb[_0x1f29c2];return _0x2898a3;};'use strict';var multer=require('multer');var util=require(_0xb9be('0x0'));var path=require(_0xb9be('0x1'));var timeout=require(_0xb9be('0x2'));var express=require(_0xb9be('0x3'));var router=express[_0xb9be('0x4')]();var fs_extra=require(_0xb9be('0x5'));var auth=require(_0xb9be('0x6'));var interaction=require(_0xb9be('0x7'));var config=require(_0xb9be('0x8'));var controller=require(_0xb9be('0x9'));router['get']('/',auth[_0xb9be('0xa')](),controller[_0xb9be('0xb')]);router[_0xb9be('0xc')](_0xb9be('0xd'),auth[_0xb9be('0xa')](),controller[_0xb9be('0xe')]);router[_0xb9be('0xf')]('/',auth[_0xb9be('0xa')](),controller[_0xb9be('0x10')]);router[_0xb9be('0x11')](_0xb9be('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb9be('0x12')](_0xb9be('0xd'),auth[_0xb9be('0xa')](),controller[_0xb9be('0x13')]);module[_0xb9be('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 56d77e1..71c463f 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 _0x2e3d=['STRING','INTEGER','sequelize','1970-01-01\x2000:00:01'];(function(_0x4591e0,_0xec4c9f){var _0x1c6ad6=function(_0x332520){while(--_0x332520){_0x4591e0['push'](_0x4591e0['shift']());}};_0x1c6ad6(++_0xec4c9f);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x4be929,_0x11bbda){_0x4be929=_0x4be929-0x0;var _0x34c57f=_0x2e3d[_0x4be929];return _0x34c57f;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xd2e3('0x1')},'clid':{'type':Sequelize[_0xd2e3('0x2')]},'src':{'type':Sequelize[_0xd2e3('0x2')]},'dst':{'type':Sequelize[_0xd2e3('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd2e3('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd2e3('0x2')]},'duration':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd2e3('0x2')]},'amaflags':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd2e3('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd2e3('0x2')]},'linkedid':{'type':Sequelize[_0xd2e3('0x2')]},'sequence':{'type':Sequelize[_0xd2e3('0x2')]},'peeraccount':{'type':Sequelize[_0xd2e3('0x2')]},'type':{'type':Sequelize[_0xd2e3('0x2')]},'tag':{'type':Sequelize[_0xd2e3('0x2')]}}; \ No newline at end of file +var _0xe189=['sequelize','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x101ed5,_0x4f5c30){var _0x5ae524=function(_0x568fd2){while(--_0x568fd2){_0x101ed5['push'](_0x101ed5['shift']());}};_0x5ae524(++_0x4f5c30);}(_0xe189,0x194));var _0x9e18=function(_0x51d320,_0x342f0b){_0x51d320=_0x51d320-0x0;var _0x4dee61=_0xe189[_0x51d320];return _0x4dee61;};'use strict';var Sequelize=require(_0x9e18('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x9e18('0x1')},'clid':{'type':Sequelize[_0x9e18('0x2')]},'src':{'type':Sequelize[_0x9e18('0x2')]},'dst':{'type':Sequelize[_0x9e18('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x9e18('0x2')]},'lastapp':{'type':Sequelize[_0x9e18('0x2')]},'lastdata':{'type':Sequelize[_0x9e18('0x2')]},'duration':{'type':Sequelize[_0x9e18('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9e18('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9e18('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9e18('0x2')]},'userfield':{'type':Sequelize[_0x9e18('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9e18('0x2')]},'sequence':{'type':Sequelize[_0x9e18('0x2')]},'peeraccount':{'type':Sequelize[_0x9e18('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9e18('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 91af2a0..1d9f752 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 _0x7da7=['count','limit','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','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','status','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x7da7[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){_0x27b6c7['status'](0xcc)[_0x77da('0x23')]();});}};}function handleEntityNotFound(_0x2d009f,_0x835167){return function(_0xbd06b7){if(!_0xbd06b7){_0x2d009f['sendStatus'](0x194);}return _0xbd06b7;};}function handleError(_0x42240b,_0x167240){_0x167240=_0x167240||0x1f4;return function(_0x470c9f){logger[_0x77da('0x24')](_0x470c9f[_0x77da('0x25')]);if(_0x470c9f['name']){delete _0x470c9f[_0x77da('0x26')];}_0x42240b[_0x77da('0x18')](_0x167240)[_0x77da('0x27')](_0x470c9f);};}exports[_0x77da('0x28')]=function(_0x496ecd,_0x5b4638){var _0x4d395a={},_0x2258e9={},_0x30456a={'count':0x0,'rows':[]};var _0x410d09=_[_0x77da('0x29')](db[_0x77da('0x2a')]['rawAttributes'],function(_0x350b4e){return{'name':_0x350b4e[_0x77da('0x2b')],'type':_0x350b4e[_0x77da('0x2c')][_0x77da('0x2d')]};});_0x2258e9[_0x77da('0x2e')]=_[_0x77da('0x29')](_0x410d09,'name');_0x2258e9[_0x77da('0x2f')]=_[_0x77da('0x30')](_0x496ecd[_0x77da('0x2f')]);_0x2258e9[_0x77da('0x31')]=_[_0x77da('0x32')](_0x2258e9[_0x77da('0x2e')],_0x2258e9[_0x77da('0x2f')]);_0x4d395a[_0x77da('0x33')]=_['intersection'](_0x2258e9['model'],qs[_0x77da('0x34')](_0x496ecd[_0x77da('0x2f')]['fields']));_0x4d395a[_0x77da('0x33')]=_0x4d395a[_0x77da('0x33')][_0x77da('0x35')]?_0x4d395a[_0x77da('0x33')]:_0x2258e9[_0x77da('0x2e')];if(!_0x496ecd[_0x77da('0x2f')][_0x77da('0x36')]('nolimit')){_0x4d395a[_0x77da('0x1c')]=qs['limit'](_0x496ecd['query']['limit']);_0x4d395a[_0x77da('0x19')]=qs['offset'](_0x496ecd[_0x77da('0x2f')][_0x77da('0x19')]);}_0x4d395a[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x496ecd[_0x77da('0x2f')][_0x77da('0x38')]);_0x4d395a[_0x77da('0x39')]=qs['filters'](_[_0x77da('0x3a')](_0x496ecd[_0x77da('0x2f')],_0x2258e9[_0x77da('0x31')]),_0x410d09);if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3b')]){_0x4d395a[_0x77da('0x39')]=_['merge'](_0x4d395a[_0x77da('0x39')],{'$or':_[_0x77da('0x29')](_0x410d09,function(_0x2cd190){if(_0x2cd190['type']!==_0x77da('0x3c')){var _0x505ffb={};_0x505ffb[_0x2cd190['name']]={'$like':'%'+_0x496ecd['query']['filter']+'%'};return _0x505ffb;}})});}_0x4d395a=_[_0x77da('0x3d')]({},_0x4d395a,_0x496ecd[_0x77da('0x3e')]);var _0xebdea1={'where':_0x4d395a['where']};return db[_0x77da('0x2a')]['count'](_0xebdea1)[_0x77da('0x21')](function(_0x517bd0){_0x30456a[_0x77da('0x1b')]=_0x517bd0;if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3f')]){_0x4d395a[_0x77da('0x40')]=[{'all':!![]}];}return db[_0x77da('0x2a')]['findAll'](_0x4d395a);})[_0x77da('0x21')](function(_0x1f48bd){_0x30456a[_0x77da('0x41')]=_0x1f48bd;return _0x30456a;})[_0x77da('0x21')](respondWithFilteredResult(_0x5b4638,_0x4d395a))[_0x77da('0x42')](handleError(_0x5b4638,null));};exports[_0x77da('0x43')]=function(_0x4ea24c,_0x319625){var _0x2f0495={'raw':!![],'where':{'id':_0x4ea24c[_0x77da('0x44')]['id']}},_0x21de41={};_0x21de41[_0x77da('0x2e')]=_[_0x77da('0x30')](db['Cdr'][_0x77da('0x45')]);_0x21de41['query']=_[_0x77da('0x30')](_0x4ea24c[_0x77da('0x2f')]);_0x21de41[_0x77da('0x31')]=_['intersection'](_0x21de41[_0x77da('0x2e')],_0x21de41[_0x77da('0x2f')]);_0x2f0495[_0x77da('0x33')]=_[_0x77da('0x32')](_0x21de41[_0x77da('0x2e')],qs[_0x77da('0x34')](_0x4ea24c[_0x77da('0x2f')][_0x77da('0x34')]));_0x2f0495[_0x77da('0x33')]=_0x2f0495['attributes'][_0x77da('0x35')]?_0x2f0495[_0x77da('0x33')]:_0x21de41[_0x77da('0x2e')];if(_0x4ea24c[_0x77da('0x2f')][_0x77da('0x3f')]){_0x2f0495[_0x77da('0x40')]=[{'all':!![]}];}_0x2f0495=_['merge']({},_0x2f0495,_0x4ea24c['options']);return db[_0x77da('0x2a')][_0x77da('0x46')](_0x2f0495)[_0x77da('0x21')](handleEntityNotFound(_0x319625,null))[_0x77da('0x21')](respondWithResult(_0x319625,null))[_0x77da('0x42')](handleError(_0x319625,null));};exports[_0x77da('0x47')]=function(_0x4e811e,_0x6ccb8f){return db[_0x77da('0x2a')][_0x77da('0x47')](_0x4e811e[_0x77da('0x48')],{})['then'](respondWithResult(_0x6ccb8f,0xc9))[_0x77da('0x42')](handleError(_0x6ccb8f,null));};exports['update']=function(_0x518fd5,_0x36263b){if(_0x518fd5[_0x77da('0x48')]['id']){delete _0x518fd5[_0x77da('0x48')]['id'];}return db[_0x77da('0x2a')]['find']({'where':{'id':_0x518fd5[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x36263b,null))['then'](saveUpdates(_0x518fd5[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x36263b,null))['catch'](handleError(_0x36263b,null));};exports[_0x77da('0x22')]=function(_0x3aaf5b,_0x2b73d3){return db[_0x77da('0x2a')][_0x77da('0x46')]({'where':{'id':_0x3aaf5b[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x2b73d3,null))[_0x77da('0x21')](removeEntity(_0x2b73d3,null))[_0x77da('0x42')](handleError(_0x2b73d3,null));};exports[_0x77da('0x49')]=function(_0x52aa0a,_0x3d04a3){return db['Cdr'][_0x77da('0x49')]()[_0x77da('0x21')](respondWithResult(_0x3d04a3,null))[_0x77da('0x42')](handleError(_0x3d04a3,null));}; \ No newline at end of file +var _0xd6d6=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type'];(function(_0x15e90d,_0x3a68b9){var _0x252c63=function(_0x5c6929){while(--_0x5c6929){_0x15e90d['push'](_0x15e90d['shift']());}};_0x252c63(++_0x3a68b9);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x10669d,_0x9e471a){_0x10669d=_0x10669d-0x0;var _0x57b51e=_0xd6d6[_0x10669d];return _0x57b51e;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x2d')](_0xde3272,'name');_0x8a9a84[_0x6d6d('0x34')]=_['keys'](_0x553645[_0x6d6d('0x34')]);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x553645['query'][_0x6d6d('0x38')]));_0x5273cd[_0x6d6d('0x37')]=_0x5273cd[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x5273cd[_0x6d6d('0x37')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x34')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1e')]);_0x5273cd[_0x6d6d('0x1f')]=qs['offset'](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1f')]);}_0x5273cd[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3d')](_0x553645['query']['sort']);_0x5273cd[_0x6d6d('0x3e')]=qs[_0x6d6d('0x35')](_[_0x6d6d('0x3f')](_0x553645['query'],_0x8a9a84[_0x6d6d('0x35')]),_0xde3272);if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]){_0x5273cd[_0x6d6d('0x3e')]=_['merge'](_0x5273cd['where'],{'$or':_['map'](_0xde3272,function(_0x62620d){if(_0x62620d[_0x6d6d('0x31')]!==_0x6d6d('0x41')){var _0x22a49a={};_0x22a49a[_0x62620d['name']]={'$like':'%'+_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]+'%'};return _0x22a49a;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x3d632c={'where':_0x5273cd[_0x6d6d('0x3e')]};return db['Cdr'][_0x6d6d('0x20')](_0x3d632c)[_0x6d6d('0x27')](function(_0x42aff0){_0x57341f[_0x6d6d('0x20')]=_0x42aff0;if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x5273cd[_0x6d6d('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x6d6d('0x46')](_0x5273cd);})[_0x6d6d('0x27')](function(_0x16e177){_0x57341f[_0x6d6d('0x47')]=_0x16e177;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))['catch'](handleError(_0x3edcce,null));};exports[_0x6d6d('0x48')]=function(_0x39f2a9,_0x55dba8){var _0x452de2={'raw':!![],'where':{'id':_0x39f2a9[_0x6d6d('0x49')]['id']}},_0x50dc17={};_0x50dc17[_0x6d6d('0x33')]=_['keys'](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x50dc17[_0x6d6d('0x34')]=_[_0x6d6d('0x4a')](_0x39f2a9[_0x6d6d('0x34')]);_0x50dc17['filters']=_['intersection'](_0x50dc17[_0x6d6d('0x33')],_0x50dc17['query']);_0x452de2['attributes']=_[_0x6d6d('0x36')](_0x50dc17[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x39f2a9['query'][_0x6d6d('0x38')]));_0x452de2['attributes']=_0x452de2[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x452de2[_0x6d6d('0x37')]:_0x50dc17[_0x6d6d('0x33')];if(_0x39f2a9[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x452de2[_0x6d6d('0x45')]=[{'all':!![]}];}_0x452de2=_['merge']({},_0x452de2,_0x39f2a9[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')](_0x452de2)[_0x6d6d('0x27')](handleEntityNotFound(_0x55dba8,null))[_0x6d6d('0x27')](respondWithResult(_0x55dba8,null))[_0x6d6d('0x4c')](handleError(_0x55dba8,null));};exports[_0x6d6d('0x4d')]=function(_0x1d2b20,_0x24cec2){return db['Cdr']['create'](_0x1d2b20[_0x6d6d('0x4e')],{})[_0x6d6d('0x27')](respondWithResult(_0x24cec2,0xc9))[_0x6d6d('0x4c')](handleError(_0x24cec2,null));};exports[_0x6d6d('0x26')]=function(_0xe2a20e,_0x492834){if(_0xe2a20e[_0x6d6d('0x4e')]['id']){delete _0xe2a20e[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0xe2a20e[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0x27')](saveUpdates(_0xe2a20e[_0x6d6d('0x4e')],null))[_0x6d6d('0x27')](respondWithResult(_0x492834,null))[_0x6d6d('0x4c')](handleError(_0x492834,null));};exports[_0x6d6d('0x28')]=function(_0x175e26,_0x4d9811){return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0x175e26[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x4d9811,null))[_0x6d6d('0x27')](removeEntity(_0x4d9811,null))['catch'](handleError(_0x4d9811,null));};exports[_0x6d6d('0x4f')]=function(_0x36bc5a,_0x45340b){return db['Cdr']['describe']()[_0x6d6d('0x27')](respondWithResult(_0x45340b,null))['catch'](handleError(_0x45340b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 34dd384..2dbcca1 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x665877,_0x454a08){var _0x5473bc=function(_0x1c9536){while(--_0x1c9536){_0x665877['push'](_0x665877['shift']());}};_0x5473bc(++_0x454a08);}(_0x7a54,0x106));var _0x47a5=function(_0x48bbe9,_0x33d8ec){_0x48bbe9=_0x48bbe9-0x0;var _0x302e7a=_0x7a54[_0x48bbe9];return _0x302e7a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x9dbbdb,_0x40551a){var _0x5f4548=function(_0x9a10ca){while(--_0x9a10ca){_0x9dbbdb['push'](_0x9dbbdb['shift']());}};_0x5f4548(++_0x40551a);}(_0x7a54,0x106));var _0x47a5=function(_0x157bf7,_0x527be6){_0x157bf7=_0x157bf7-0x0;var _0x18b867=_0x7a54[_0x157bf7];return _0x18b867;};'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 620b33a..eac4df8 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 _0xd626=['then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x25e2a5,_0x2d7270){var _0x429243=function(_0x16853){while(--_0x16853){_0x25e2a5['push'](_0x25e2a5['shift']());}};_0x429243(++_0x2d7270);}(_0xd626,0x1d5));var _0x6d62=function(_0x2f3b65,_0x4db279){_0x2f3b65=_0x2f3b65-0x0;var _0x312b32=_0xd626[_0x2f3b65];return _0x312b32;};'use strict';var _=require('lodash');var util=require(_0x6d62('0x0'));var moment=require(_0x6d62('0x1'));var BPromise=require(_0x6d62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d62('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d62('0x4'))(_0x6d62('0x5'));var config=require(_0x6d62('0x6'));var jayson=require(_0x6d62('0x7'));var client=jayson[_0x6d62('0x8')][_0x6d62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x289689,_0x219c72,_0x576e0f){return new BPromise(function(_0x16f5fe,_0x2ee642){return client[_0x6d62('0xa')](_0x289689,_0x576e0f)[_0x6d62('0xb')](function(_0x4c14f2){logger[_0x6d62('0xc')](_0x6d62('0xd'),_0x219c72,_0x6d62('0xe'));logger[_0x6d62('0xf')](_0x6d62('0x10'),_0x219c72,_0x6d62('0xe'),JSON[_0x6d62('0x11')](_0x4c14f2));if(_0x4c14f2[_0x6d62('0x12')]){if(_0x4c14f2[_0x6d62('0x12')]['code']===0x1f4){logger[_0x6d62('0x12')](_0x6d62('0xd'),_0x219c72,_0x4c14f2[_0x6d62('0x12')][_0x6d62('0x13')]);return _0x2ee642(_0x4c14f2['error']['message']);}logger[_0x6d62('0x12')]('Cdr,\x20%s,\x20%s',_0x219c72,_0x4c14f2[_0x6d62('0x12')][_0x6d62('0x13')]);return _0x16f5fe(_0x4c14f2[_0x6d62('0x12')][_0x6d62('0x13')]);}else{logger[_0x6d62('0xc')](_0x6d62('0xd'),_0x219c72,_0x6d62('0xe'));_0x16f5fe(_0x4c14f2['result'][_0x6d62('0x13')]);}})['catch'](function(_0x238c25){logger[_0x6d62('0x12')](_0x6d62('0xd'),_0x219c72,_0x238c25);_0x2ee642(_0x238c25);});});} \ No newline at end of file +var _0x5460=['result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5460,0x75));var _0x0546=function(_0x41c76f,_0x339363){_0x41c76f=_0x41c76f-0x0;var _0x22fefb=_0x5460[_0x41c76f];return _0x22fefb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0546('0x0'));var BPromise=require(_0x0546('0x1'));var rs=require(_0x0546('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0546('0x3'))['db'];var utils=require(_0x0546('0x4'));var logger=require(_0x0546('0x5'))(_0x0546('0x6'));var config=require(_0x0546('0x7'));var jayson=require(_0x0546('0x8'));var client=jayson[_0x0546('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1bd4,_0xd5510c,_0xf904f1){return new BPromise(function(_0x4eb162,_0x518b3b){return client[_0x0546('0xa')](_0x3f1bd4,_0xf904f1)[_0x0546('0xb')](function(_0x2cb259){logger[_0x0546('0xc')](_0x0546('0xd'),_0xd5510c,'request\x20sent');logger[_0x0546('0xe')](_0x0546('0xf'),_0xd5510c,_0x0546('0x10'),JSON[_0x0546('0x11')](_0x2cb259));if(_0x2cb259[_0x0546('0x12')]){if(_0x2cb259[_0x0546('0x12')][_0x0546('0x13')]===0x1f4){logger[_0x0546('0x12')]('Cdr,\x20%s,\x20%s',_0xd5510c,_0x2cb259['error'][_0x0546('0x14')]);return _0x518b3b(_0x2cb259[_0x0546('0x12')]['message']);}logger[_0x0546('0x12')](_0x0546('0xd'),_0xd5510c,_0x2cb259['error'][_0x0546('0x14')]);return _0x4eb162(_0x2cb259[_0x0546('0x12')][_0x0546('0x14')]);}else{logger[_0x0546('0xc')](_0x0546('0xd'),_0xd5510c,_0x0546('0x10'));_0x4eb162(_0x2cb259[_0x0546('0x15')]['message']);}})[_0x0546('0x16')](function(_0x44b033){logger[_0x0546('0x12')](_0x0546('0xd'),_0xd5510c,_0x44b033);_0x518b3b(_0x44b033);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a01b574..5539ff2 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1f9ee6,_0x7255cb){var _0x101b73=function(_0x2e6ef0){while(--_0x2e6ef0){_0x1f9ee6['push'](_0x1f9ee6['shift']());}};_0x101b73(++_0x7255cb);}(_0xb10b,0x12a));var _0xbb10=function(_0xafdf47,_0x38b5b3){_0xafdf47=_0xafdf47-0x0;var _0x1e6c17=_0xb10b[_0xafdf47];return _0x1e6c17;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3e57d1,_0x92cfe8){var _0x2d1413=function(_0x43ec48){while(--_0x43ec48){_0x3e57d1['push'](_0x3e57d1['shift']());}};_0x2d1413(++_0x92cfe8);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e4c55,_0x1415eb){_0x1e4c55=_0x1e4c55-0x0;var _0x511ab5=_0xb10b[_0x1e4c55];return _0x511ab5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0f38d7e..c16d240 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 _0xd6ad=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x47686a,_0x23470a){var _0x119e1a=function(_0xef25e3){while(--_0xef25e3){_0x47686a['push'](_0x47686a['shift']());}};_0x119e1a(++_0x23470a);}(_0xd6ad,0x1f0));var _0xdd6a=function(_0x100519,_0x50dd2c){_0x100519=_0x100519-0x0;var _0x1dd752=_0xd6ad[_0x100519];return _0x1dd752;};'use strict';var Sequelize=require(_0xdd6a('0x0'));module[_0xdd6a('0x1')]={'priority':{'type':Sequelize[_0xdd6a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdd6a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdd6a('0x4')]()},'description':{'type':Sequelize[_0xdd6a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1d7e=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x93462d,_0x4679b2){var _0xc0bce3=function(_0xec7e93){while(--_0xec7e93){_0x93462d['push'](_0x93462d['shift']());}};_0xc0bce3(++_0x4679b2);}(_0x1d7e,0x15f));var _0xe1d7=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x1d7e[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0xe1d7('0x0'));module[_0xe1d7('0x1')]={'priority':{'type':Sequelize[_0xe1d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe1d7('0x3')],'allowNull':![],'defaultValue':_0xe1d7('0x4')},'appdata':{'type':Sequelize[_0xe1d7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe1d7('0x3')],'defaultValue':_0xe1d7('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 76bff24..33a8930 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 _0xca66=['reject','save','update','destroy','then','sendStatus','name','send','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','includeAll','merge','options','find','catch','body','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x367834,_0x54134b){var _0x62c7eb=function(_0xcf9591){while(--_0xcf9591){_0x367834['push'](_0x367834['shift']());}};_0x62c7eb(++_0x54134b);}(_0xca66,0x8b));var _0x6ca6=function(_0x41e460,_0x55647a){_0x41e460=_0x41e460-0x0;var _0x2ce3e4=_0xca66[_0x41e460];return _0x2ce3e4;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){_0xfbf496['status'](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x1d6caa,_0x1c43ee){return function(_0x2d8c64){if(!_0x2d8c64){_0x1d6caa[_0x6ca6('0x28')](0x194);}return _0x2d8c64;};}function handleError(_0x29f37e,_0x3c32ae){_0x3c32ae=_0x3c32ae||0x1f4;return function(_0x2a1e2d){logger['error'](_0x2a1e2d['stack']);if(_0x2a1e2d[_0x6ca6('0x29')]){delete _0x2a1e2d[_0x6ca6('0x29')];}_0x29f37e[_0x6ca6('0x19')](_0x3c32ae)[_0x6ca6('0x2a')](_0x2a1e2d);};}exports['show']=function(_0x5ea6f7,_0x306583){var _0x47cf48={'raw':!![],'where':{'id':_0x5ea6f7[_0x6ca6('0x2b')]['id']}},_0x4ab84c={};_0x4ab84c[_0x6ca6('0x2c')]=_['keys'](db[_0x6ca6('0x2d')][_0x6ca6('0x2e')]);_0x4ab84c[_0x6ca6('0x2f')]=_[_0x6ca6('0x30')](_0x5ea6f7['query']);_0x4ab84c[_0x6ca6('0x31')]=_[_0x6ca6('0x32')](_0x4ab84c[_0x6ca6('0x2c')],_0x4ab84c[_0x6ca6('0x2f')]);_0x47cf48['attributes']=_[_0x6ca6('0x32')](_0x4ab84c[_0x6ca6('0x2c')],qs[_0x6ca6('0x33')](_0x5ea6f7[_0x6ca6('0x2f')]['fields']));_0x47cf48['attributes']=_0x47cf48['attributes']['length']?_0x47cf48['attributes']:_0x4ab84c[_0x6ca6('0x2c')];if(_0x5ea6f7[_0x6ca6('0x2f')][_0x6ca6('0x34')]){_0x47cf48['include']=[{'all':!![]}];}_0x47cf48=_[_0x6ca6('0x35')]({},_0x47cf48,_0x5ea6f7[_0x6ca6('0x36')]);return db[_0x6ca6('0x2d')][_0x6ca6('0x37')](_0x47cf48)['then'](handleEntityNotFound(_0x306583,null))[_0x6ca6('0x27')](respondWithResult(_0x306583,null))[_0x6ca6('0x38')](handleError(_0x306583,null));};exports[_0x6ca6('0x25')]=function(_0x3fac33,_0x4da670){if(_0x3fac33[_0x6ca6('0x39')]['id']){delete _0x3fac33['body']['id'];}return db[_0x6ca6('0x2d')]['find']({'where':{'id':_0x3fac33['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x4da670,null))[_0x6ca6('0x27')](saveUpdates(_0x3fac33[_0x6ca6('0x39')],null))[_0x6ca6('0x27')](respondWithResult(_0x4da670,null))['catch'](handleError(_0x4da670,null));};exports['destroy']=function(_0x17a1da,_0x224257){return db['ChatApplication'][_0x6ca6('0x37')]({'where':{'id':_0x17a1da['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x224257,null))['then'](removeEntity(_0x224257,null))[_0x6ca6('0x38')](handleError(_0x224257,null));}; \ No newline at end of file +var _0x2cae=['keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model'];(function(_0x5641e3,_0x1437ae){var _0x4065e8=function(_0x55dbf9){while(--_0x55dbf9){_0x5641e3['push'](_0x5641e3['shift']());}};_0x4065e8(++_0x1437ae);}(_0x2cae,0x16b));var _0xe2ca=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x2cae[_0x28611e];return _0x530f69;};'use strict';var emlformat=require(_0xe2ca('0x0'));var rimraf=require(_0xe2ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ca('0x2'));var moment=require(_0xe2ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe2ca('0x4'));var util=require(_0xe2ca('0x5'));var path=require(_0xe2ca('0x6'));var sox=require(_0xe2ca('0x7'));var csv=require('to-csv');var ejs=require(_0xe2ca('0x8'));var fs=require('fs');var fs_extra=require(_0xe2ca('0x9'));var _=require('lodash');var squel=require(_0xe2ca('0xa'));var crypto=require('crypto');var jsforce=require(_0xe2ca('0xb'));var deskjs=require(_0xe2ca('0xc'));var toCsv=require(_0xe2ca('0xd'));var querystring=require(_0xe2ca('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2ca('0xf'));var hardwareService=require(_0xe2ca('0x10'));var logger=require(_0xe2ca('0x11'))(_0xe2ca('0x12'));var utils=require(_0xe2ca('0x13'));var config=require(_0xe2ca('0x14'));var licenseUtil=require(_0xe2ca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1138ee,_0x2773cc){_0x2773cc=_0x2773cc||0xcc;return function(_0x199237){if(_0x199237){return _0x1138ee[_0xe2ca('0x16')](_0x2773cc);}return _0x1138ee[_0xe2ca('0x17')](_0x2773cc)['end']();};}function respondWithResult(_0x31f283,_0x3cfcc9){_0x3cfcc9=_0x3cfcc9||0xc8;return function(_0x27c3ad){if(_0x27c3ad){return _0x31f283[_0xe2ca('0x17')](_0x3cfcc9)[_0xe2ca('0x18')](_0x27c3ad);}};}function respondWithFilteredResult(_0x3a9612,_0x1c1514){return function(_0x29cdcf){if(_0x29cdcf){var _0x326340=typeof _0x1c1514[_0xe2ca('0x19')]==='undefined'&&typeof _0x1c1514[_0xe2ca('0x1a')]==='undefined';var _0x4ca8fd=_0x29cdcf[_0xe2ca('0x1b')];var _0x18cd42=_0x326340?0x0:_0x1c1514['offset'];var _0x393c23=_0x326340?_0x29cdcf[_0xe2ca('0x1b')]:_0x1c1514[_0xe2ca('0x19')]+_0x1c1514['limit'];var _0x4380fb;if(_0x393c23>=_0x4ca8fd){_0x393c23=_0x4ca8fd;_0x4380fb=0xc8;}else{_0x4380fb=0xce;}_0x3a9612[_0xe2ca('0x17')](_0x4380fb);return _0x3a9612[_0xe2ca('0x1c')]('Content-Range',_0x18cd42+'-'+_0x393c23+'/'+_0x4ca8fd)[_0xe2ca('0x18')](_0x29cdcf);}return null;};}function patchUpdates(_0x56b574){return function(_0x16f418){try{jsonpatch[_0xe2ca('0x1d')](_0x16f418,_0x56b574,!![]);}catch(_0x60d8e8){return BPromise[_0xe2ca('0x1e')](_0x60d8e8);}return _0x16f418[_0xe2ca('0x1f')]();};}function saveUpdates(_0x1b98d8,_0x50af69){return function(_0x1a1522){if(_0x1a1522){return _0x1a1522[_0xe2ca('0x20')](_0x1b98d8)[_0xe2ca('0x21')](function(_0x2ca129){return _0x2ca129;});}return null;};}function removeEntity(_0x18a6c6,_0x2772b5){return function(_0xa1fa2b){if(_0xa1fa2b){return _0xa1fa2b[_0xe2ca('0x22')]()[_0xe2ca('0x21')](function(){_0x18a6c6['status'](0xcc)[_0xe2ca('0x23')]();});}};}function handleEntityNotFound(_0x272bb3,_0x3f3d6e){return function(_0xc52f5e){if(!_0xc52f5e){_0x272bb3[_0xe2ca('0x16')](0x194);}return _0xc52f5e;};}function handleError(_0x4b2a2e,_0x524b6c){_0x524b6c=_0x524b6c||0x1f4;return function(_0x20ac37){logger[_0xe2ca('0x24')](_0x20ac37[_0xe2ca('0x25')]);if(_0x20ac37[_0xe2ca('0x26')]){delete _0x20ac37[_0xe2ca('0x26')];}_0x4b2a2e[_0xe2ca('0x17')](_0x524b6c)[_0xe2ca('0x27')](_0x20ac37);};}exports[_0xe2ca('0x28')]=function(_0x565e9b,_0x5df46f){var _0x333665={'raw':!![],'where':{'id':_0x565e9b[_0xe2ca('0x29')]['id']}},_0x300d0e={};_0x300d0e[_0xe2ca('0x2a')]=_[_0xe2ca('0x2b')](db[_0xe2ca('0x2c')][_0xe2ca('0x2d')]);_0x300d0e[_0xe2ca('0x2e')]=_[_0xe2ca('0x2b')](_0x565e9b[_0xe2ca('0x2e')]);_0x300d0e[_0xe2ca('0x2f')]=_[_0xe2ca('0x30')](_0x300d0e[_0xe2ca('0x2a')],_0x300d0e[_0xe2ca('0x2e')]);_0x333665['attributes']=_[_0xe2ca('0x30')](_0x300d0e[_0xe2ca('0x2a')],qs[_0xe2ca('0x31')](_0x565e9b[_0xe2ca('0x2e')][_0xe2ca('0x31')]));_0x333665[_0xe2ca('0x32')]=_0x333665[_0xe2ca('0x32')]['length']?_0x333665['attributes']:_0x300d0e['model'];if(_0x565e9b[_0xe2ca('0x2e')][_0xe2ca('0x33')]){_0x333665[_0xe2ca('0x34')]=[{'all':!![]}];}_0x333665=_[_0xe2ca('0x35')]({},_0x333665,_0x565e9b[_0xe2ca('0x36')]);return db['ChatApplication'][_0xe2ca('0x37')](_0x333665)[_0xe2ca('0x21')](handleEntityNotFound(_0x5df46f,null))['then'](respondWithResult(_0x5df46f,null))[_0xe2ca('0x38')](handleError(_0x5df46f,null));};exports[_0xe2ca('0x20')]=function(_0x21d7bf,_0x48b0f8){if(_0x21d7bf[_0xe2ca('0x39')]['id']){delete _0x21d7bf[_0xe2ca('0x39')]['id'];}return db[_0xe2ca('0x2c')]['find']({'where':{'id':_0x21d7bf[_0xe2ca('0x29')]['id']}})['then'](handleEntityNotFound(_0x48b0f8,null))[_0xe2ca('0x21')](saveUpdates(_0x21d7bf['body'],null))['then'](respondWithResult(_0x48b0f8,null))[_0xe2ca('0x38')](handleError(_0x48b0f8,null));};exports[_0xe2ca('0x22')]=function(_0x2dbf5e,_0x57e784){return db[_0xe2ca('0x2c')][_0xe2ca('0x37')]({'where':{'id':_0x2dbf5e[_0xe2ca('0x29')]['id']}})[_0xe2ca('0x21')](handleEntityNotFound(_0x57e784,null))['then'](removeEntity(_0x57e784,null))['catch'](handleError(_0x57e784,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 535cd37..b3f12d4 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 _0x7846=['util','../../config/logger','moment','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1ac2d8,_0xe1aa59){var _0x2744af=function(_0x37a898){while(--_0x37a898){_0x1ac2d8['push'](_0x1ac2d8['shift']());}};_0x2744af(++_0xe1aa59);}(_0x7846,0xbf));var _0x6784=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x7846[_0x30f030];return _0xf7614f;};'use strict';var _=require(_0x6784('0x0'));var util=require(_0x6784('0x1'));var logger=require(_0x6784('0x2'))('api');var moment=require(_0x6784('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6784('0x4'));var rimraf=require(_0x6784('0x5'));var config=require('../../config/environment');var attributes=require(_0x6784('0x6'));module[_0x6784('0x7')]=function(_0xe42d9c,_0x1cf910){return _0xe42d9c[_0x6784('0x8')](_0x6784('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6784('0xa'),'collate':_0x6784('0xb')});}; \ No newline at end of file +var _0x4c3c=['util','api','request-promise','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x278b09,_0x15449b){var _0xeb6da8=function(_0x1276ca){while(--_0x1276ca){_0x278b09['push'](_0x278b09['shift']());}};_0xeb6da8(++_0x15449b);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x28041b,_0x12093b){_0x28041b=_0x28041b-0x0;var _0x11a839=_0x4c3c[_0x28041b];return _0x11a839;};'use strict';var _=require(_0xc4c3('0x0'));var util=require(_0xc4c3('0x1'));var logger=require('../../config/logger')(_0xc4c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4c3('0x4'));var attributes=require(_0xc4c3('0x5'));module[_0xc4c3('0x6')]=function(_0x36cea1,_0x1cb620){return _0x36cea1[_0xc4c3('0x7')](_0xc4c3('0x8'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc4c3('0x9'),'collate':_0xc4c3('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5137117..117e6df 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 _0x8b30=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x8b30,0x142));var _0x08b3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8b30[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var moment=require(_0x08b3('0x2'));var BPromise=require(_0x08b3('0x3'));var rs=require(_0x08b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x08b3('0x6'));var config=require('../../config/environment');var jayson=require(_0x08b3('0x7'));var client=jayson[_0x08b3('0x8')][_0x08b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x532e46,_0x2e454f,_0x4457ab){return new BPromise(function(_0x434c62,_0x555d93){return client[_0x08b3('0xa')](_0x532e46,_0x4457ab)[_0x08b3('0xb')](function(_0x20af6a){logger['info'](_0x08b3('0xc'),_0x2e454f,_0x08b3('0xd'));logger[_0x08b3('0xe')](_0x08b3('0xf'),_0x2e454f,_0x08b3('0xd'),JSON['stringify'](_0x20af6a));if(_0x20af6a[_0x08b3('0x10')]){if(_0x20af6a[_0x08b3('0x10')]['code']===0x1f4){logger[_0x08b3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2e454f,_0x20af6a['error'][_0x08b3('0x11')]);return _0x555d93(_0x20af6a[_0x08b3('0x10')]['message']);}logger[_0x08b3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2e454f,_0x20af6a[_0x08b3('0x10')][_0x08b3('0x11')]);return _0x434c62(_0x20af6a[_0x08b3('0x10')][_0x08b3('0x11')]);}else{logger[_0x08b3('0x12')](_0x08b3('0xc'),_0x2e454f,_0x08b3('0xd'));_0x434c62(_0x20af6a[_0x08b3('0x13')][_0x08b3('0x11')]);}})[_0x08b3('0x14')](function(_0x4e534a){logger[_0x08b3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2e454f,_0x4e534a);_0x555d93(_0x4e534a);});});} \ No newline at end of file +var _0xdf56=['util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x12a5a9,_0x454056){var _0x490dbb=function(_0x11b1cc){while(--_0x11b1cc){_0x12a5a9['push'](_0x12a5a9['shift']());}};_0x490dbb(++_0x454056);}(_0xdf56,0x7e));var _0x6df5=function(_0x1d4bdb,_0x58f77b){_0x1d4bdb=_0x1d4bdb-0x0;var _0x288bea=_0xdf56[_0x1d4bdb];return _0x288bea;};'use strict';var _=require('lodash');var util=require(_0x6df5('0x0'));var moment=require(_0x6df5('0x1'));var BPromise=require('bluebird');var rs=require(_0x6df5('0x2'));var fs=require('fs');var Redis=require(_0x6df5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6df5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6df5('0x5'));var client=jayson[_0x6df5('0x6')][_0x6df5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x842356,_0x108781,_0x4c5efb){return new BPromise(function(_0x586620,_0x39599f){return client[_0x6df5('0x8')](_0x842356,_0x4c5efb)[_0x6df5('0x9')](function(_0x759d25){logger[_0x6df5('0xa')](_0x6df5('0xb'),_0x108781,_0x6df5('0xc'));logger['debug'](_0x6df5('0xd'),_0x108781,'request\x20sent',JSON[_0x6df5('0xe')](_0x759d25));if(_0x759d25[_0x6df5('0xf')]){if(_0x759d25[_0x6df5('0xf')]['code']===0x1f4){logger['error'](_0x6df5('0xb'),_0x108781,_0x759d25[_0x6df5('0xf')][_0x6df5('0x10')]);return _0x39599f(_0x759d25[_0x6df5('0xf')]['message']);}logger[_0x6df5('0xf')](_0x6df5('0xb'),_0x108781,_0x759d25['error'][_0x6df5('0x10')]);return _0x586620(_0x759d25['error'][_0x6df5('0x10')]);}else{logger[_0x6df5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x108781,_0x6df5('0xc'));_0x586620(_0x759d25[_0x6df5('0x11')][_0x6df5('0x10')]);}})['catch'](function(_0x32e85c){logger[_0x6df5('0xf')](_0x6df5('0xb'),_0x108781,_0x32e85c);_0x39599f(_0x32e85c);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9ced608..b3d9913 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 _0x0aff=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x312c48,_0x5e52a8){var _0x271c50=function(_0x389927){while(--_0x389927){_0x312c48['push'](_0x312c48['shift']());}};_0x271c50(++_0x5e52a8);}(_0x0aff,0x191));var _0xf0af=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0x0aff[_0x446f11];return _0x385cb5;};'use strict';var multer=require(_0xf0af('0x0'));var util=require(_0xf0af('0x1'));var path=require(_0xf0af('0x2'));var timeout=require(_0xf0af('0x3'));var express=require('express');var router=express[_0xf0af('0x4')]();var fs_extra=require(_0xf0af('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0af('0x6'));var config=require(_0xf0af('0x7'));var controller=require('./chatApplication.controller');router[_0xf0af('0x8')](_0xf0af('0x9'),auth['isAuthenticated'](),controller[_0xf0af('0xa')]);router['put']('/:id',auth[_0xf0af('0xb')](),controller[_0xf0af('0xc')]);router[_0xf0af('0xd')](_0xf0af('0x9'),auth[_0xf0af('0xb')](),controller[_0xf0af('0xe')]);module['exports']=router; \ No newline at end of file +var _0x137b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x11db00,_0x8c21ff){var _0x1753ff=function(_0x4ef51b){while(--_0x4ef51b){_0x11db00['push'](_0x11db00['shift']());}};_0x1753ff(++_0x8c21ff);}(_0x137b,0x10c));var _0xb137=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x137b[_0x484c03];return _0x294127;};'use strict';var multer=require(_0xb137('0x0'));var util=require('util');var path=require(_0xb137('0x1'));var timeout=require(_0xb137('0x2'));var express=require(_0xb137('0x3'));var router=express['Router']();var fs_extra=require(_0xb137('0x4'));var auth=require(_0xb137('0x5'));var interaction=require(_0xb137('0x6'));var config=require(_0xb137('0x7'));var controller=require('./chatApplication.controller');router[_0xb137('0x8')](_0xb137('0x9'),auth[_0xb137('0xa')](),controller[_0xb137('0xb')]);router[_0xb137('0xc')](_0xb137('0x9'),auth[_0xb137('0xa')](),controller[_0xb137('0xd')]);router[_0xb137('0xe')](_0xb137('0x9'),auth['isAuthenticated'](),controller[_0xb137('0xf')]);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 289584d..3b5c6bd 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 _0x96ae=['exports','STRING','sequelize'];(function(_0x10a4bc,_0x3b9fd0){var _0x496909=function(_0x1a18e0){while(--_0x1a18e0){_0x10a4bc['push'](_0x10a4bc['shift']());}};_0x496909(++_0x3b9fd0);}(_0x96ae,0xda));var _0xe96a=function(_0x17e69b,_0x512806){_0x17e69b=_0x17e69b-0x0;var _0x55eea8=_0x96ae[_0x17e69b];return _0x55eea8;};'use strict';var Sequelize=require(_0xe96a('0x0'));module[_0xe96a('0x1')]={'name':{'type':Sequelize[_0xe96a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe96a('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe396=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2063c2,_0xef771f){var _0x3f059a=function(_0x448d9d){while(--_0x448d9d){_0x2063c2['push'](_0x2063c2['shift']());}};_0x3f059a(++_0xef771f);}(_0xe396,0xa3));var _0x6e39=function(_0x16ccac,_0x42b93f){_0x16ccac=_0x16ccac-0x0;var _0x48dafd=_0xe396[_0x16ccac];return _0x48dafd;};'use strict';var Sequelize=require(_0x6e39('0x0'));module[_0x6e39('0x1')]={'name':{'type':Sequelize[_0x6e39('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6e39('0x2')]},'write':{'type':Sequelize[_0x6e39('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 8e40f3f..dd81ed0 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 _0x8435=['socket.io-emitter','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','ChatGroup','findAll','catch','params','intersection','options','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','order','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost'];(function(_0x3baaa9,_0x887c1c){var _0x530513=function(_0x19092d){while(--_0x19092d){_0x3baaa9['push'](_0x3baaa9['shift']());}};_0x530513(++_0x887c1c);}(_0x8435,0x161));var _0x5843=function(_0x48dcd3,_0x8e11b7){_0x48dcd3=_0x48dcd3-0x0;var _0xdfe356=_0x8435[_0x48dcd3];return _0xdfe356;};'use strict';var emlformat=require(_0x5843('0x0'));var rimraf=require(_0x5843('0x1'));var zipdir=require(_0x5843('0x2'));var jsonpatch=require(_0x5843('0x3'));var rp=require(_0x5843('0x4'));var moment=require(_0x5843('0x5'));var BPromise=require(_0x5843('0x6'));var Mustache=require(_0x5843('0x7'));var util=require(_0x5843('0x8'));var path=require('path');var sox=require(_0x5843('0x9'));var csv=require(_0x5843('0xa'));var ejs=require(_0x5843('0xb'));var fs=require('fs');var fs_extra=require(_0x5843('0xc'));var _=require(_0x5843('0xd'));var squel=require(_0x5843('0xe'));var crypto=require(_0x5843('0xf'));var jsforce=require(_0x5843('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5843('0xa'));var querystring=require(_0x5843('0x11'));var Papa=require('papaparse');var Redis=require(_0x5843('0x12'));var authService=require(_0x5843('0x13'));var qs=require(_0x5843('0x14'));var as=require(_0x5843('0x15'));var hardwareService=require(_0x5843('0x16'));var logger=require(_0x5843('0x17'))('api');var utils=require(_0x5843('0x18'));var config=require(_0x5843('0x19'));var licenseUtil=require(_0x5843('0x1a'));var db=require(_0x5843('0x1b'))['db'];config['redis']=_[_0x5843('0x1c')](config[_0x5843('0x1d')],{'host':_0x5843('0x1e'),'port':0x18eb});var socket=require(_0x5843('0x1f'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x4495dc,_0x26df65){_0x26df65=_0x26df65||0xcc;return function(_0x4b920e){if(_0x4b920e){return _0x4495dc['sendStatus'](_0x26df65);}return _0x4495dc[_0x5843('0x20')](_0x26df65)[_0x5843('0x21')]();};}function respondWithResult(_0x5a5d4f,_0x4a8e90){_0x4a8e90=_0x4a8e90||0xc8;return function(_0x5af3a1){if(_0x5af3a1){return _0x5a5d4f[_0x5843('0x20')](_0x4a8e90)[_0x5843('0x22')](_0x5af3a1);}};}function respondWithFilteredResult(_0x6949d9,_0x152d26){return function(_0xc48cd){if(_0xc48cd){var _0x2ccff2=typeof _0x152d26[_0x5843('0x23')]==='undefined'&&typeof _0x152d26[_0x5843('0x24')]==='undefined';var _0x15064e=_0xc48cd['count'];var _0x3bf376=_0x2ccff2?0x0:_0x152d26[_0x5843('0x23')];var _0x2ed700=_0x2ccff2?_0xc48cd[_0x5843('0x25')]:_0x152d26[_0x5843('0x23')]+_0x152d26[_0x5843('0x24')];var _0x42b367;if(_0x2ed700>=_0x15064e){_0x2ed700=_0x15064e;_0x42b367=0xc8;}else{_0x42b367=0xce;}_0x6949d9[_0x5843('0x20')](_0x42b367);return _0x6949d9[_0x5843('0x26')](_0x5843('0x27'),_0x3bf376+'-'+_0x2ed700+'/'+_0x15064e)[_0x5843('0x22')](_0xc48cd);}return null;};}function patchUpdates(_0x6f5c1d){return function(_0x487276){try{jsonpatch['apply'](_0x487276,_0x6f5c1d,!![]);}catch(_0x174b4e){return BPromise[_0x5843('0x28')](_0x174b4e);}return _0x487276[_0x5843('0x29')]();};}function saveUpdates(_0x242d76,_0x586604){return function(_0x51b553){if(_0x51b553){return _0x51b553[_0x5843('0x2a')](_0x242d76)['then'](function(_0x22330f){return _0x22330f;});}return null;};}function removeEntity(_0xd6799d,_0x52cb9f){return function(_0x3a2be0){if(_0x3a2be0){return _0x3a2be0[_0x5843('0x2b')]()[_0x5843('0x2c')](function(){_0xd6799d[_0x5843('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271b59,_0x5d03d9){return function(_0x4c5fd8){if(!_0x4c5fd8){_0x271b59[_0x5843('0x2d')](0x194);}return _0x4c5fd8;};}function handleError(_0x71133d,_0x25cb43){_0x25cb43=_0x25cb43||0x1f4;return function(_0x2177a1){logger['error'](_0x2177a1[_0x5843('0x2e')]);if(_0x2177a1[_0x5843('0x2f')]){delete _0x2177a1[_0x5843('0x2f')];}_0x71133d['status'](_0x25cb43)['send'](_0x2177a1);};}exports['index']=function(_0x40cab9,_0xeb3041){var _0x87427e={},_0x1a7067={},_0x149c14={'count':0x0,'rows':[]};var _0x10ac35=_[_0x5843('0x30')](db['ChatGroup'][_0x5843('0x31')],function(_0x373e51){return{'name':_0x373e51[_0x5843('0x32')],'type':_0x373e51[_0x5843('0x33')]['key']};});_0x1a7067[_0x5843('0x34')]=_[_0x5843('0x30')](_0x10ac35,_0x5843('0x2f'));_0x1a7067[_0x5843('0x35')]=_[_0x5843('0x36')](_0x40cab9[_0x5843('0x35')]);_0x1a7067[_0x5843('0x37')]=_['intersection'](_0x1a7067[_0x5843('0x34')],_0x1a7067[_0x5843('0x35')]);_0x87427e['attributes']=_['intersection'](_0x1a7067[_0x5843('0x34')],qs[_0x5843('0x38')](_0x40cab9['query']['fields']));_0x87427e[_0x5843('0x39')]=_0x87427e['attributes'][_0x5843('0x3a')]?_0x87427e[_0x5843('0x39')]:_0x1a7067[_0x5843('0x34')];if(!_0x40cab9[_0x5843('0x35')][_0x5843('0x3b')](_0x5843('0x3c'))){_0x87427e[_0x5843('0x24')]=qs[_0x5843('0x24')](_0x40cab9['query'][_0x5843('0x24')]);_0x87427e['offset']=qs[_0x5843('0x23')](_0x40cab9[_0x5843('0x35')][_0x5843('0x23')]);}_0x87427e['order']=qs[_0x5843('0x3d')](_0x40cab9['query'][_0x5843('0x3d')]);_0x87427e['where']=qs['filters'](_[_0x5843('0x3e')](_0x40cab9[_0x5843('0x35')],_0x1a7067[_0x5843('0x37')]),_0x10ac35);if(_0x40cab9['query'][_0x5843('0x3f')]){_0x87427e[_0x5843('0x40')]=_[_0x5843('0x41')](_0x87427e['where'],{'$or':_['map'](_0x10ac35,function(_0x2cc098){if(_0x2cc098['type']!==_0x5843('0x42')){var _0x313572={};_0x313572[_0x2cc098[_0x5843('0x2f')]]={'$like':'%'+_0x40cab9[_0x5843('0x35')][_0x5843('0x3f')]+'%'};return _0x313572;}})});}_0x87427e=_['merge']({},_0x87427e,_0x40cab9['options']);var _0x375b61={'where':_0x87427e[_0x5843('0x40')]};return db['ChatGroup'][_0x5843('0x25')](_0x375b61)['then'](function(_0x50c946){_0x149c14[_0x5843('0x25')]=_0x50c946;if(_0x40cab9['query'][_0x5843('0x43')]){_0x87427e[_0x5843('0x44')]=[{'all':!![]}];}return db[_0x5843('0x45')][_0x5843('0x46')](_0x87427e);})[_0x5843('0x2c')](function(_0x1f9dc2){_0x149c14['rows']=_0x1f9dc2;return _0x149c14;})[_0x5843('0x2c')](respondWithFilteredResult(_0xeb3041,_0x87427e))[_0x5843('0x47')](handleError(_0xeb3041,null));};exports['show']=function(_0x3acff9,_0x3db34e){var _0x41971a={'raw':!![],'where':{'id':_0x3acff9[_0x5843('0x48')]['id']}},_0x754c7b={};_0x754c7b[_0x5843('0x34')]=_[_0x5843('0x36')](db[_0x5843('0x45')]['rawAttributes']);_0x754c7b[_0x5843('0x35')]=_[_0x5843('0x36')](_0x3acff9['query']);_0x754c7b[_0x5843('0x37')]=_[_0x5843('0x49')](_0x754c7b['model'],_0x754c7b['query']);_0x41971a[_0x5843('0x39')]=_[_0x5843('0x49')](_0x754c7b['model'],qs[_0x5843('0x38')](_0x3acff9['query'][_0x5843('0x38')]));_0x41971a['attributes']=_0x41971a[_0x5843('0x39')][_0x5843('0x3a')]?_0x41971a[_0x5843('0x39')]:_0x754c7b[_0x5843('0x34')];if(_0x3acff9[_0x5843('0x35')][_0x5843('0x43')]){_0x41971a[_0x5843('0x44')]=[{'all':!![]}];}_0x41971a=_[_0x5843('0x41')]({},_0x41971a,_0x3acff9[_0x5843('0x4a')]);return db[_0x5843('0x45')]['find'](_0x41971a)['then'](handleEntityNotFound(_0x3db34e,null))['then'](respondWithResult(_0x3db34e,null))[_0x5843('0x47')](handleError(_0x3db34e,null));};exports['create']=function(_0x1a43c2,_0x2b7f75){return db[_0x5843('0x45')][_0x5843('0x4b')](_0x1a43c2[_0x5843('0x4c')],{})[_0x5843('0x2c')](respondWithResult(_0x2b7f75,0xc9))[_0x5843('0x47')](handleError(_0x2b7f75,null));};exports[_0x5843('0x2a')]=function(_0x37836b,_0x13b4dc){if(_0x37836b[_0x5843('0x4c')]['id']){delete _0x37836b[_0x5843('0x4c')]['id'];}return db['ChatGroup'][_0x5843('0x4d')]({'where':{'id':_0x37836b['params']['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x13b4dc,null))[_0x5843('0x2c')](saveUpdates(_0x37836b['body'],null))[_0x5843('0x2c')](respondWithResult(_0x13b4dc,null))[_0x5843('0x47')](handleError(_0x13b4dc,null));};exports[_0x5843('0x2b')]=function(_0xba9ffa,_0x5f1191){return db[_0x5843('0x45')][_0x5843('0x4d')]({'where':{'id':_0xba9ffa[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x5f1191,null))[_0x5843('0x2c')](removeEntity(_0x5f1191,null))[_0x5843('0x47')](handleError(_0x5f1191,null));};exports['describe']=function(_0x40ef56,_0x581a87){return db[_0x5843('0x45')][_0x5843('0x4e')]()[_0x5843('0x2c')](respondWithResult(_0x581a87,null))[_0x5843('0x47')](handleError(_0x581a87,null));};exports['getUnread']=function(_0x3e985f,_0xf2b4e0,_0x5f5dd5){return db[_0x5843('0x4f')][_0x5843('0x25')]({'where':{'ChatGroupId':_0x3e985f[_0x5843('0x48')]['id'],'ToId':_0x3e985f[_0x5843('0x50')]['id'],'read':![]}})[_0x5843('0x2c')](function(_0x53f416){return{'id':_[_0x5843('0x51')](_0x3e985f[_0x5843('0x48')]['id']),'count':_0x53f416};})[_0x5843('0x2c')](respondWithResult(_0xf2b4e0,null))[_0x5843('0x47')](handleError(_0xf2b4e0,null));};exports[_0x5843('0x52')]=function(_0x1ac937,_0x412352,_0x2a40b2){return db['ChatGroup'][_0x5843('0x4d')]({'where':{'id':_0x1ac937['params']['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x412352,null))[_0x5843('0x2c')](function(_0x4fdb10){if(_0x4fdb10){return _0x4fdb10[_0x5843('0x52')](_0x1ac937[_0x5843('0x4c')][_0x5843('0x53')],_[_0x5843('0x54')](_0x1ac937[_0x5843('0x4c')],[_0x5843('0x53'),'id'])||{});}})[_0x5843('0x2c')](respondWithResult(_0x412352,null))['catch'](handleError(_0x412352,null));};exports[_0x5843('0x55')]=function(_0x560483,_0x134e8d,_0x48be1b){var _0x4aab14={};var _0x5261db={};var _0x724826;var _0x343b51;return db[_0x5843('0x45')][_0x5843('0x56')]({'where':{'id':_0x560483[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x134e8d,null))[_0x5843('0x2c')](function(_0x18f51d){if(_0x18f51d){_0x724826=_0x18f51d;_0x5261db[_0x5843('0x34')]=_[_0x5843('0x36')](db['User']['rawAttributes']);_0x5261db[_0x5843('0x35')]=_[_0x5843('0x36')](_0x560483[_0x5843('0x35')]);_0x5261db[_0x5843('0x37')]=_[_0x5843('0x49')](_0x5261db['model'],_0x5261db[_0x5843('0x35')]);_0x4aab14[_0x5843('0x39')]=_[_0x5843('0x49')](_0x5261db[_0x5843('0x34')],qs[_0x5843('0x38')](_0x560483['query']['fields']));_0x4aab14[_0x5843('0x39')]=_0x4aab14[_0x5843('0x39')][_0x5843('0x3a')]?_0x4aab14['attributes']:_0x5261db[_0x5843('0x34')];_0x4aab14[_0x5843('0x57')]=qs[_0x5843('0x3d')](_0x560483[_0x5843('0x35')][_0x5843('0x3d')]);_0x4aab14['where']=qs['filters'](_[_0x5843('0x3e')](_0x560483['query'],_0x5261db[_0x5843('0x37')]));if(_0x560483[_0x5843('0x35')]['filter']){_0x4aab14['where']=_['merge'](_0x4aab14['where'],{'$or':_[_0x5843('0x30')](_0x4aab14[_0x5843('0x39')],function(_0xe90b22){var _0x436cd7={};_0x436cd7[_0xe90b22]={'$like':'%'+_0x560483[_0x5843('0x35')]['filter']+'%'};return _0x436cd7;})});}_0x4aab14=_['merge']({},_0x4aab14,_0x560483[_0x5843('0x4a')]);return _0x724826[_0x5843('0x55')](_0x4aab14);}})[_0x5843('0x2c')](function(_0x560b7d){if(_0x560b7d){_0x343b51=_0x560b7d[_0x5843('0x3a')];if(!_0x560483[_0x5843('0x35')][_0x5843('0x3b')](_0x5843('0x3c'))){_0x4aab14[_0x5843('0x24')]=qs[_0x5843('0x24')](_0x560483['query'][_0x5843('0x24')]);_0x4aab14[_0x5843('0x23')]=qs[_0x5843('0x23')](_0x560483[_0x5843('0x35')][_0x5843('0x23')]);}return _0x724826[_0x5843('0x55')](_0x4aab14);}})[_0x5843('0x2c')](function(_0x50f62b){if(_0x50f62b){return _0x50f62b?{'count':_0x343b51,'rows':_0x50f62b}:null;}})[_0x5843('0x2c')](respondWithResult(_0x134e8d,null))['catch'](handleError(_0x134e8d,null));};exports[_0x5843('0x58')]=function(_0x3b75bc,_0x18af63,_0x764265){return db[_0x5843('0x45')][_0x5843('0x4d')]({'where':{'id':_0x3b75bc[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x18af63,null))[_0x5843('0x2c')](function(_0x976b61){if(_0x976b61){return _0x976b61[_0x5843('0x58')](_0x3b75bc['query'][_0x5843('0x53')]);}})['then'](respondWithStatusCode(_0x18af63,null))[_0x5843('0x47')](handleError(_0x18af63,null));};exports[_0x5843('0x59')]=function(_0x290595,_0x22f7a0,_0x5448a4){if(_0x290595[_0x5843('0x4c')]['id']){delete _0x290595[_0x5843('0x4c')]['id'];}return db[_0x5843('0x45')][_0x5843('0x4d')]({'where':{'id':_0x290595[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x22f7a0,null))[_0x5843('0x2c')](function(_0x1c34e7){if(_0x1c34e7){_0x290595['body'][_0x5843('0x5a')]=_0x1c34e7['id'];return db[_0x5843('0x4f')]['create'](_0x290595[_0x5843('0x4c')]);}})[_0x5843('0x2c')](respondWithResult(_0x22f7a0,null))[_0x5843('0x47')](handleError(_0x22f7a0,null));};exports[_0x5843('0x5b')]=function(_0x1190c9,_0x43cfbf,_0x1b76f0){var _0x2a3910={};var _0x344697={};var _0x372f02;var _0x210664;return db['ChatGroup']['findOne']({'where':{'id':_0x1190c9[_0x5843('0x48')]['id']}})[_0x5843('0x2c')](handleEntityNotFound(_0x43cfbf,null))[_0x5843('0x2c')](function(_0x464b9e){if(_0x464b9e){_0x372f02=_0x464b9e;_0x344697[_0x5843('0x34')]=_[_0x5843('0x36')](db['ChatInternalMessage'][_0x5843('0x31')]);_0x344697['query']=_[_0x5843('0x36')](_0x1190c9[_0x5843('0x35')]);_0x344697['filters']=_[_0x5843('0x49')](_0x344697['model'],_0x344697[_0x5843('0x35')]);_0x2a3910[_0x5843('0x39')]=_[_0x5843('0x49')](_0x344697['model'],qs[_0x5843('0x38')](_0x1190c9[_0x5843('0x35')]['fields']));_0x2a3910[_0x5843('0x39')]=_0x2a3910[_0x5843('0x39')][_0x5843('0x3a')]?_0x2a3910[_0x5843('0x39')]:_0x344697[_0x5843('0x34')];_0x2a3910[_0x5843('0x57')]=qs[_0x5843('0x3d')](_0x1190c9[_0x5843('0x35')][_0x5843('0x3d')]);_0x2a3910[_0x5843('0x40')]=qs[_0x5843('0x37')](_['pick'](_0x1190c9[_0x5843('0x35')],_0x344697[_0x5843('0x37')]));if(_0x1190c9[_0x5843('0x35')][_0x5843('0x3f')]){_0x2a3910[_0x5843('0x40')]=_[_0x5843('0x41')](_0x2a3910[_0x5843('0x40')],{'$or':_[_0x5843('0x30')](_0x2a3910[_0x5843('0x39')],function(_0x3e3a56){var _0x60f8a={};_0x60f8a[_0x3e3a56]={'$like':'%'+_0x1190c9[_0x5843('0x35')][_0x5843('0x3f')]+'%'};return _0x60f8a;})});}if(_0x1190c9[_0x5843('0x35')][_0x5843('0x5c')]){var _0x3c3267=_0x1190c9[_0x5843('0x35')]['$gte'][_0x5843('0x5d')](',');var _0x5b1fda={};_0x5b1fda[_0x3c3267[0x0]]={'$gte':moment(_0x3c3267[0x1])[_0x5843('0x5e')](_0x5843('0x5f'))};_0x2a3910[_0x5843('0x40')]=_[_0x5843('0x41')](_0x2a3910[_0x5843('0x40')],_0x5b1fda);}_0x2a3910=_[_0x5843('0x41')]({},_0x2a3910,_0x1190c9['options']);return _0x372f02['getMessages'](_0x2a3910);}})['then'](function(_0x47dbbf){if(_0x47dbbf){_0x210664=_0x47dbbf[_0x5843('0x3a')];if(!_0x1190c9[_0x5843('0x35')][_0x5843('0x3b')](_0x5843('0x3c'))){_0x2a3910['limit']=qs['limit'](_0x1190c9['query'][_0x5843('0x24')]);_0x2a3910[_0x5843('0x23')]=qs[_0x5843('0x23')](_0x1190c9[_0x5843('0x35')][_0x5843('0x23')]);}return _0x372f02[_0x5843('0x5b')](_0x2a3910);}})[_0x5843('0x2c')](function(_0x1f9888){if(_0x1f9888){return _0x1f9888?{'count':_0x210664,'rows':_0x1f9888}:null;}})[_0x5843('0x2c')](respondWithResult(_0x43cfbf,null))[_0x5843('0x47')](handleError(_0x43cfbf,null));}; \ No newline at end of file +var _0x34e0=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','length','create','body','find','params','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','pick','options','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x6ec3b,_0x1606e9){var _0x21364b=function(_0x4e6b9a){while(--_0x4e6b9a){_0x6ec3b['push'](_0x6ec3b['shift']());}};_0x21364b(++_0x1606e9);}(_0x34e0,0x1e9));var _0x034e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x34e0[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require(_0x034e('0x0'));var rimraf=require(_0x034e('0x1'));var zipdir=require(_0x034e('0x2'));var jsonpatch=require(_0x034e('0x3'));var rp=require(_0x034e('0x4'));var moment=require('moment');var BPromise=require(_0x034e('0x5'));var Mustache=require('mustache');var util=require(_0x034e('0x6'));var path=require(_0x034e('0x7'));var sox=require(_0x034e('0x8'));var csv=require(_0x034e('0x9'));var ejs=require(_0x034e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x034e('0xb'));var squel=require(_0x034e('0xc'));var crypto=require(_0x034e('0xd'));var jsforce=require(_0x034e('0xe'));var deskjs=require(_0x034e('0xf'));var toCsv=require(_0x034e('0x9'));var querystring=require(_0x034e('0x10'));var Papa=require(_0x034e('0x11'));var Redis=require('ioredis');var authService=require(_0x034e('0x12'));var qs=require(_0x034e('0x13'));var as=require(_0x034e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x034e('0x15'))('api');var utils=require(_0x034e('0x16'));var config=require(_0x034e('0x17'));var licenseUtil=require(_0x034e('0x18'));var db=require(_0x034e('0x19'))['db'];config['redis']=_[_0x034e('0x1a')](config[_0x034e('0x1b')],{'host':_0x034e('0x1c'),'port':0x18eb});var socket=require(_0x034e('0x1d'))(new Redis(config[_0x034e('0x1b')]));require(_0x034e('0x1e'))[_0x034e('0x1f')](socket);function respondWithStatusCode(_0xe256dd,_0x46e261){_0x46e261=_0x46e261||0xcc;return function(_0x289411){if(_0x289411){return _0xe256dd[_0x034e('0x20')](_0x46e261);}return _0xe256dd['status'](_0x46e261)['end']();};}function respondWithResult(_0x225d43,_0x4c44f1){_0x4c44f1=_0x4c44f1||0xc8;return function(_0x36ea76){if(_0x36ea76){return _0x225d43[_0x034e('0x21')](_0x4c44f1)[_0x034e('0x22')](_0x36ea76);}};}function respondWithFilteredResult(_0x3c5e6f,_0x5d2558){return function(_0x49fd21){if(_0x49fd21){var _0x50d8cd=typeof _0x5d2558[_0x034e('0x23')]===_0x034e('0x24')&&typeof _0x5d2558['limit']===_0x034e('0x24');var _0x4c62ef=_0x49fd21['count'];var _0x946320=_0x50d8cd?0x0:_0x5d2558[_0x034e('0x23')];var _0x20b649=_0x50d8cd?_0x49fd21[_0x034e('0x25')]:_0x5d2558[_0x034e('0x23')]+_0x5d2558[_0x034e('0x26')];var _0x76ca1b;if(_0x20b649>=_0x4c62ef){_0x20b649=_0x4c62ef;_0x76ca1b=0xc8;}else{_0x76ca1b=0xce;}_0x3c5e6f['status'](_0x76ca1b);return _0x3c5e6f['set'](_0x034e('0x27'),_0x946320+'-'+_0x20b649+'/'+_0x4c62ef)[_0x034e('0x22')](_0x49fd21);}return null;};}function patchUpdates(_0x30ceef){return function(_0x5d4b0d){try{jsonpatch[_0x034e('0x28')](_0x5d4b0d,_0x30ceef,!![]);}catch(_0x3439b1){return BPromise['reject'](_0x3439b1);}return _0x5d4b0d[_0x034e('0x29')]();};}function saveUpdates(_0x1c4da5,_0x58269f){return function(_0x4d82ce){if(_0x4d82ce){return _0x4d82ce[_0x034e('0x2a')](_0x1c4da5)[_0x034e('0x2b')](function(_0xee728d){return _0xee728d;});}return null;};}function removeEntity(_0x34030c,_0x14e72e){return function(_0x544c79){if(_0x544c79){return _0x544c79[_0x034e('0x2c')]()['then'](function(){_0x34030c[_0x034e('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4639d6,_0x1b4d62){return function(_0x1806b5){if(!_0x1806b5){_0x4639d6[_0x034e('0x20')](0x194);}return _0x1806b5;};}function handleError(_0x38fec4,_0x26aae2){_0x26aae2=_0x26aae2||0x1f4;return function(_0x52a494){logger[_0x034e('0x2d')](_0x52a494[_0x034e('0x2e')]);if(_0x52a494['name']){delete _0x52a494[_0x034e('0x2f')];}_0x38fec4[_0x034e('0x21')](_0x26aae2)[_0x034e('0x30')](_0x52a494);};}exports[_0x034e('0x31')]=function(_0x52b5c8,_0x436100){var _0xad2673={},_0x1e2719={},_0x13b65b={'count':0x0,'rows':[]};var _0x31db32=_[_0x034e('0x32')](db[_0x034e('0x33')][_0x034e('0x34')],function(_0x3e8038){return{'name':_0x3e8038['fieldName'],'type':_0x3e8038[_0x034e('0x35')][_0x034e('0x36')]};});_0x1e2719[_0x034e('0x37')]=_['map'](_0x31db32,'name');_0x1e2719[_0x034e('0x38')]=_[_0x034e('0x39')](_0x52b5c8['query']);_0x1e2719[_0x034e('0x3a')]=_[_0x034e('0x3b')](_0x1e2719[_0x034e('0x37')],_0x1e2719[_0x034e('0x38')]);_0xad2673['attributes']=_[_0x034e('0x3b')](_0x1e2719['model'],qs[_0x034e('0x3c')](_0x52b5c8['query'][_0x034e('0x3c')]));_0xad2673[_0x034e('0x3d')]=_0xad2673['attributes']['length']?_0xad2673[_0x034e('0x3d')]:_0x1e2719[_0x034e('0x37')];if(!_0x52b5c8[_0x034e('0x38')][_0x034e('0x3e')]('nolimit')){_0xad2673['limit']=qs[_0x034e('0x26')](_0x52b5c8[_0x034e('0x38')][_0x034e('0x26')]);_0xad2673['offset']=qs[_0x034e('0x23')](_0x52b5c8[_0x034e('0x38')]['offset']);}_0xad2673['order']=qs['sort'](_0x52b5c8['query'][_0x034e('0x3f')]);_0xad2673[_0x034e('0x40')]=qs[_0x034e('0x3a')](_['pick'](_0x52b5c8['query'],_0x1e2719['filters']),_0x31db32);if(_0x52b5c8[_0x034e('0x38')]['filter']){_0xad2673[_0x034e('0x40')]=_[_0x034e('0x41')](_0xad2673[_0x034e('0x40')],{'$or':_['map'](_0x31db32,function(_0x6cdd3c){if(_0x6cdd3c[_0x034e('0x35')]!==_0x034e('0x42')){var _0x4200bb={};_0x4200bb[_0x6cdd3c[_0x034e('0x2f')]]={'$like':'%'+_0x52b5c8[_0x034e('0x38')][_0x034e('0x43')]+'%'};return _0x4200bb;}})});}_0xad2673=_[_0x034e('0x41')]({},_0xad2673,_0x52b5c8['options']);var _0x29a607={'where':_0xad2673[_0x034e('0x40')]};return db['ChatGroup']['count'](_0x29a607)[_0x034e('0x2b')](function(_0x3a5d0e){_0x13b65b[_0x034e('0x25')]=_0x3a5d0e;if(_0x52b5c8['query'][_0x034e('0x44')]){_0xad2673[_0x034e('0x45')]=[{'all':!![]}];}return db[_0x034e('0x33')][_0x034e('0x46')](_0xad2673);})['then'](function(_0x3bb020){_0x13b65b['rows']=_0x3bb020;return _0x13b65b;})[_0x034e('0x2b')](respondWithFilteredResult(_0x436100,_0xad2673))[_0x034e('0x47')](handleError(_0x436100,null));};exports[_0x034e('0x48')]=function(_0x11c83d,_0x2e3c44){var _0x31f099={'raw':!![],'where':{'id':_0x11c83d['params']['id']}},_0x1bf869={};_0x1bf869[_0x034e('0x37')]=_[_0x034e('0x39')](db[_0x034e('0x33')][_0x034e('0x34')]);_0x1bf869[_0x034e('0x38')]=_[_0x034e('0x39')](_0x11c83d[_0x034e('0x38')]);_0x1bf869[_0x034e('0x3a')]=_[_0x034e('0x3b')](_0x1bf869[_0x034e('0x37')],_0x1bf869[_0x034e('0x38')]);_0x31f099[_0x034e('0x3d')]=_['intersection'](_0x1bf869[_0x034e('0x37')],qs[_0x034e('0x3c')](_0x11c83d[_0x034e('0x38')][_0x034e('0x3c')]));_0x31f099['attributes']=_0x31f099['attributes'][_0x034e('0x49')]?_0x31f099[_0x034e('0x3d')]:_0x1bf869[_0x034e('0x37')];if(_0x11c83d[_0x034e('0x38')][_0x034e('0x44')]){_0x31f099[_0x034e('0x45')]=[{'all':!![]}];}_0x31f099=_['merge']({},_0x31f099,_0x11c83d['options']);return db[_0x034e('0x33')]['find'](_0x31f099)[_0x034e('0x2b')](handleEntityNotFound(_0x2e3c44,null))['then'](respondWithResult(_0x2e3c44,null))[_0x034e('0x47')](handleError(_0x2e3c44,null));};exports[_0x034e('0x4a')]=function(_0x4fcdd,_0x50c2be){return db['ChatGroup'][_0x034e('0x4a')](_0x4fcdd[_0x034e('0x4b')],{})[_0x034e('0x2b')](respondWithResult(_0x50c2be,0xc9))[_0x034e('0x47')](handleError(_0x50c2be,null));};exports[_0x034e('0x2a')]=function(_0x484e63,_0x114a24){if(_0x484e63[_0x034e('0x4b')]['id']){delete _0x484e63[_0x034e('0x4b')]['id'];}return db[_0x034e('0x33')][_0x034e('0x4c')]({'where':{'id':_0x484e63[_0x034e('0x4d')]['id']}})[_0x034e('0x2b')](handleEntityNotFound(_0x114a24,null))[_0x034e('0x2b')](saveUpdates(_0x484e63[_0x034e('0x4b')],null))[_0x034e('0x2b')](respondWithResult(_0x114a24,null))['catch'](handleError(_0x114a24,null));};exports[_0x034e('0x2c')]=function(_0x443dca,_0x2b1c62){return db[_0x034e('0x33')][_0x034e('0x4c')]({'where':{'id':_0x443dca[_0x034e('0x4d')]['id']}})[_0x034e('0x2b')](handleEntityNotFound(_0x2b1c62,null))[_0x034e('0x2b')](removeEntity(_0x2b1c62,null))[_0x034e('0x47')](handleError(_0x2b1c62,null));};exports[_0x034e('0x4e')]=function(_0x4e45c7,_0x7e651d){return db['ChatGroup'][_0x034e('0x4e')]()[_0x034e('0x2b')](respondWithResult(_0x7e651d,null))[_0x034e('0x47')](handleError(_0x7e651d,null));};exports[_0x034e('0x4f')]=function(_0x42c498,_0x2550a7,_0x295e86){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x42c498[_0x034e('0x4d')]['id'],'ToId':_0x42c498[_0x034e('0x50')]['id'],'read':![]}})[_0x034e('0x2b')](function(_0x530fc8){return{'id':_[_0x034e('0x51')](_0x42c498[_0x034e('0x4d')]['id']),'count':_0x530fc8};})[_0x034e('0x2b')](respondWithResult(_0x2550a7,null))[_0x034e('0x47')](handleError(_0x2550a7,null));};exports[_0x034e('0x52')]=function(_0x44208f,_0xadab03,_0xd1a2c5){return db[_0x034e('0x33')][_0x034e('0x4c')]({'where':{'id':_0x44208f['params']['id']}})[_0x034e('0x2b')](handleEntityNotFound(_0xadab03,null))[_0x034e('0x2b')](function(_0x4c52b1){if(_0x4c52b1){return _0x4c52b1[_0x034e('0x52')](_0x44208f[_0x034e('0x4b')][_0x034e('0x53')],_[_0x034e('0x54')](_0x44208f[_0x034e('0x4b')],[_0x034e('0x53'),'id'])||{});}})[_0x034e('0x2b')](respondWithResult(_0xadab03,null))[_0x034e('0x47')](handleError(_0xadab03,null));};exports[_0x034e('0x55')]=function(_0x3c54f0,_0x27ba2e,_0x20a2c6){var _0x130c9c={};var _0x3a67ae={};var _0x152dab;var _0x352f12;return db[_0x034e('0x33')][_0x034e('0x56')]({'where':{'id':_0x3c54f0['params']['id']}})['then'](handleEntityNotFound(_0x27ba2e,null))[_0x034e('0x2b')](function(_0x2ebc9b){if(_0x2ebc9b){_0x152dab=_0x2ebc9b;_0x3a67ae[_0x034e('0x37')]=_[_0x034e('0x39')](db[_0x034e('0x57')]['rawAttributes']);_0x3a67ae[_0x034e('0x38')]=_[_0x034e('0x39')](_0x3c54f0[_0x034e('0x38')]);_0x3a67ae['filters']=_[_0x034e('0x3b')](_0x3a67ae['model'],_0x3a67ae[_0x034e('0x38')]);_0x130c9c[_0x034e('0x3d')]=_['intersection'](_0x3a67ae[_0x034e('0x37')],qs[_0x034e('0x3c')](_0x3c54f0[_0x034e('0x38')][_0x034e('0x3c')]));_0x130c9c[_0x034e('0x3d')]=_0x130c9c['attributes'][_0x034e('0x49')]?_0x130c9c['attributes']:_0x3a67ae[_0x034e('0x37')];_0x130c9c[_0x034e('0x58')]=qs['sort'](_0x3c54f0[_0x034e('0x38')]['sort']);_0x130c9c[_0x034e('0x40')]=qs[_0x034e('0x3a')](_[_0x034e('0x59')](_0x3c54f0['query'],_0x3a67ae[_0x034e('0x3a')]));if(_0x3c54f0[_0x034e('0x38')]['filter']){_0x130c9c[_0x034e('0x40')]=_[_0x034e('0x41')](_0x130c9c[_0x034e('0x40')],{'$or':_[_0x034e('0x32')](_0x130c9c['attributes'],function(_0x27149f){var _0x2df75f={};_0x2df75f[_0x27149f]={'$like':'%'+_0x3c54f0['query'][_0x034e('0x43')]+'%'};return _0x2df75f;})});}_0x130c9c=_['merge']({},_0x130c9c,_0x3c54f0[_0x034e('0x5a')]);return _0x152dab['getMembers'](_0x130c9c);}})['then'](function(_0x57d86b){if(_0x57d86b){_0x352f12=_0x57d86b[_0x034e('0x49')];if(!_0x3c54f0[_0x034e('0x38')][_0x034e('0x3e')]('nolimit')){_0x130c9c[_0x034e('0x26')]=qs[_0x034e('0x26')](_0x3c54f0[_0x034e('0x38')][_0x034e('0x26')]);_0x130c9c[_0x034e('0x23')]=qs[_0x034e('0x23')](_0x3c54f0[_0x034e('0x38')][_0x034e('0x23')]);}return _0x152dab[_0x034e('0x55')](_0x130c9c);}})['then'](function(_0x3059d0){if(_0x3059d0){return _0x3059d0?{'count':_0x352f12,'rows':_0x3059d0}:null;}})[_0x034e('0x2b')](respondWithResult(_0x27ba2e,null))[_0x034e('0x47')](handleError(_0x27ba2e,null));};exports[_0x034e('0x5b')]=function(_0x32c01d,_0xc1c252,_0x3aef54){return db[_0x034e('0x33')][_0x034e('0x4c')]({'where':{'id':_0x32c01d['params']['id']}})[_0x034e('0x2b')](handleEntityNotFound(_0xc1c252,null))[_0x034e('0x2b')](function(_0x38bc3b){if(_0x38bc3b){return _0x38bc3b['removeMembers'](_0x32c01d[_0x034e('0x38')][_0x034e('0x53')]);}})['then'](respondWithStatusCode(_0xc1c252,null))[_0x034e('0x47')](handleError(_0xc1c252,null));};exports[_0x034e('0x5c')]=function(_0x5e21f8,_0x20927e,_0x2e0466){if(_0x5e21f8['body']['id']){delete _0x5e21f8[_0x034e('0x4b')]['id'];}return db[_0x034e('0x33')][_0x034e('0x4c')]({'where':{'id':_0x5e21f8['params']['id']}})['then'](handleEntityNotFound(_0x20927e,null))[_0x034e('0x2b')](function(_0x35233c){if(_0x35233c){_0x5e21f8[_0x034e('0x4b')]['ChatGroupId']=_0x35233c['id'];return db[_0x034e('0x5d')][_0x034e('0x4a')](_0x5e21f8[_0x034e('0x4b')]);}})[_0x034e('0x2b')](respondWithResult(_0x20927e,null))[_0x034e('0x47')](handleError(_0x20927e,null));};exports[_0x034e('0x5e')]=function(_0x4a9a75,_0x59f18e,_0x2a597e){var _0xa0fbf9={};var _0x394f76={};var _0x6adcad;var _0x400eac;return db['ChatGroup'][_0x034e('0x56')]({'where':{'id':_0x4a9a75[_0x034e('0x4d')]['id']}})[_0x034e('0x2b')](handleEntityNotFound(_0x59f18e,null))[_0x034e('0x2b')](function(_0x24f386){if(_0x24f386){_0x6adcad=_0x24f386;_0x394f76[_0x034e('0x37')]=_[_0x034e('0x39')](db[_0x034e('0x5d')][_0x034e('0x34')]);_0x394f76[_0x034e('0x38')]=_['keys'](_0x4a9a75['query']);_0x394f76[_0x034e('0x3a')]=_['intersection'](_0x394f76[_0x034e('0x37')],_0x394f76[_0x034e('0x38')]);_0xa0fbf9[_0x034e('0x3d')]=_['intersection'](_0x394f76[_0x034e('0x37')],qs[_0x034e('0x3c')](_0x4a9a75['query']['fields']));_0xa0fbf9[_0x034e('0x3d')]=_0xa0fbf9['attributes'][_0x034e('0x49')]?_0xa0fbf9[_0x034e('0x3d')]:_0x394f76[_0x034e('0x37')];_0xa0fbf9[_0x034e('0x58')]=qs[_0x034e('0x3f')](_0x4a9a75[_0x034e('0x38')][_0x034e('0x3f')]);_0xa0fbf9['where']=qs['filters'](_[_0x034e('0x59')](_0x4a9a75[_0x034e('0x38')],_0x394f76[_0x034e('0x3a')]));if(_0x4a9a75[_0x034e('0x38')][_0x034e('0x43')]){_0xa0fbf9[_0x034e('0x40')]=_[_0x034e('0x41')](_0xa0fbf9[_0x034e('0x40')],{'$or':_['map'](_0xa0fbf9['attributes'],function(_0x30e14a){var _0x1bf292={};_0x1bf292[_0x30e14a]={'$like':'%'+_0x4a9a75[_0x034e('0x38')][_0x034e('0x43')]+'%'};return _0x1bf292;})});}if(_0x4a9a75['query']['$gte']){var _0x11ea27=_0x4a9a75[_0x034e('0x38')][_0x034e('0x5f')][_0x034e('0x60')](',');var _0x3b85e1={};_0x3b85e1[_0x11ea27[0x0]]={'$gte':moment(_0x11ea27[0x1])[_0x034e('0x61')](_0x034e('0x62'))};_0xa0fbf9[_0x034e('0x40')]=_['merge'](_0xa0fbf9[_0x034e('0x40')],_0x3b85e1);}_0xa0fbf9=_[_0x034e('0x41')]({},_0xa0fbf9,_0x4a9a75['options']);return _0x6adcad['getMessages'](_0xa0fbf9);}})[_0x034e('0x2b')](function(_0x37107b){if(_0x37107b){_0x400eac=_0x37107b[_0x034e('0x49')];if(!_0x4a9a75[_0x034e('0x38')][_0x034e('0x3e')]('nolimit')){_0xa0fbf9[_0x034e('0x26')]=qs['limit'](_0x4a9a75[_0x034e('0x38')][_0x034e('0x26')]);_0xa0fbf9[_0x034e('0x23')]=qs[_0x034e('0x23')](_0x4a9a75[_0x034e('0x38')]['offset']);}return _0x6adcad[_0x034e('0x5e')](_0xa0fbf9);}})['then'](function(_0x5b83ee){if(_0x5b83ee){return _0x5b83ee?{'count':_0x400eac,'rows':_0x5b83ee}:null;}})['then'](respondWithResult(_0x59f18e,null))[_0x034e('0x47')](handleError(_0x59f18e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6a26cff..2df342d 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 _0x287e=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','ChatGroup'];(function(_0x3a2a20,_0x48e10a){var _0x366ec2=function(_0x15a9b0){while(--_0x15a9b0){_0x3a2a20['push'](_0x3a2a20['shift']());}};_0x366ec2(++_0x48e10a);}(_0x287e,0x1e3));var _0xe287=function(_0x366edb,_0x4b5780){_0x366edb=_0x366edb-0x0;var _0x22472f=_0x287e[_0x366edb];return _0x22472f;};'use strict';var EventEmitter=require(_0xe287('0x0'));var ChatGroup=require(_0xe287('0x1'))['db'][_0xe287('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe287('0x3')](0x0);var events={'afterCreate':_0xe287('0x4'),'afterUpdate':_0xe287('0x5'),'afterDestroy':_0xe287('0x6')};function emitEvent(_0x3ce68e){return function(_0x16d2d7,_0x5f34d6,_0x113035){ChatGroupEvents[_0xe287('0x7')](_0x3ce68e+':'+_0x16d2d7['id'],_0x16d2d7);ChatGroupEvents['emit'](_0x3ce68e,_0x16d2d7);_0x113035(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xe287('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x7b5f=['hook','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove'];(function(_0xe9bf31,_0x4481ac){var _0x41c53a=function(_0x4380ae){while(--_0x4380ae){_0xe9bf31['push'](_0xe9bf31['shift']());}};_0x41c53a(++_0x4481ac);}(_0x7b5f,0x1ac));var _0xf7b5=function(_0x32cf1e,_0x4aa713){_0x32cf1e=_0x32cf1e-0x0;var _0x1899b9=_0x7b5f[_0x32cf1e];return _0x1899b9;};'use strict';var EventEmitter=require(_0xf7b5('0x0'));var ChatGroup=require(_0xf7b5('0x1'))['db'][_0xf7b5('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf7b5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7b5('0x4'),'afterDestroy':_0xf7b5('0x5')};function emitEvent(_0x3a3b77){return function(_0x74d691,_0x3160b6,_0x81f8dd){ChatGroupEvents['emit'](_0x3a3b77+':'+_0x74d691['id'],_0x74d691);ChatGroupEvents['emit'](_0x3a3b77,_0x74d691);_0x81f8dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf7b5('0x6')](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 1f2471a..cb6ab4f 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 _0x6f66=['chat_groups','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup'];(function(_0x26b13c,_0x1d5e01){var _0x23092b=function(_0x5309be){while(--_0x5309be){_0x26b13c['push'](_0x26b13c['shift']());}};_0x23092b(++_0x1d5e01);}(_0x6f66,0x156));var _0x66f6=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x6f66[_0x1e500e];return _0x10dc5e;};'use strict';var _=require('lodash');var util=require(_0x66f6('0x0'));var logger=require('../../config/logger')(_0x66f6('0x1'));var moment=require(_0x66f6('0x2'));var BPromise=require(_0x66f6('0x3'));var rp=require(_0x66f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66f6('0x5'));var config=require(_0x66f6('0x6'));var attributes=require(_0x66f6('0x7'));module[_0x66f6('0x8')]=function(_0x144409,_0x535b62){return _0x144409['define'](_0x66f6('0x9'),attributes,{'tableName':_0x66f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2e8=['ChatGroup','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xc2e8,0xd2));var _0x8c2e=function(_0xdd5f,_0x13b310){_0xdd5f=_0xdd5f-0x0;var _0x34e257=_0xc2e8[_0xdd5f];return _0x34e257;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var logger=require(_0x8c2e('0x2'))('api');var moment=require(_0x8c2e('0x3'));var BPromise=require(_0x8c2e('0x4'));var rp=require(_0x8c2e('0x5'));var fs=require('fs');var path=require(_0x8c2e('0x6'));var rimraf=require(_0x8c2e('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c2e('0x8'));module['exports']=function(_0x20e89c,_0x21653c){return _0x20e89c[_0x8c2e('0x9')](_0x8c2e('0xa'),attributes,{'tableName':'chat_groups','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 4e497bf..90f9954 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 _0x4f6c=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','ChatGroup,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x5796cb,_0x15b2e1){var _0x126d5e=function(_0x3d319e){while(--_0x3d319e){_0x5796cb['push'](_0x5796cb['shift']());}};_0x126d5e(++_0x15b2e1);}(_0x4f6c,0x176));var _0xc4f6=function(_0x438bbf,_0x21c23b){_0x438bbf=_0x438bbf-0x0;var _0x32de30=_0x4f6c[_0x438bbf];return _0x32de30;};'use strict';var _=require(_0xc4f6('0x0'));var util=require(_0xc4f6('0x1'));var moment=require(_0xc4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4f6('0x3'));var fs=require('fs');var Redis=require(_0xc4f6('0x4'));var db=require(_0xc4f6('0x5'))['db'];var utils=require(_0xc4f6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4f6('0x8')][_0xc4f6('0x9')]({'port':0x232a});config[_0xc4f6('0xa')]=_[_0xc4f6('0xb')](config[_0xc4f6('0xa')],{'host':_0xc4f6('0xc'),'port':0x18eb});var socket=require(_0xc4f6('0xd'))(new Redis(config[_0xc4f6('0xa')]));require('./chatGroup.socket')[_0xc4f6('0xe')](socket);function respondWithRpcPromise(_0x253735,_0x83274b,_0x3dc18c){return new BPromise(function(_0x10ee6c,_0x4e6c49){return client['request'](_0x253735,_0x3dc18c)[_0xc4f6('0xf')](function(_0x345299){logger[_0xc4f6('0x10')]('ChatGroup,\x20%s,\x20%s',_0x83274b,'request\x20sent');logger[_0xc4f6('0x11')](_0xc4f6('0x12'),_0x83274b,'request\x20sent',JSON['stringify'](_0x345299));if(_0x345299[_0xc4f6('0x13')]){if(_0x345299[_0xc4f6('0x13')]['code']===0x1f4){logger['error'](_0xc4f6('0x14'),_0x83274b,_0x345299[_0xc4f6('0x13')][_0xc4f6('0x15')]);return _0x4e6c49(_0x345299[_0xc4f6('0x13')]['message']);}logger[_0xc4f6('0x13')](_0xc4f6('0x14'),_0x83274b,_0x345299[_0xc4f6('0x13')][_0xc4f6('0x15')]);return _0x10ee6c(_0x345299[_0xc4f6('0x13')][_0xc4f6('0x15')]);}else{logger[_0xc4f6('0x10')](_0xc4f6('0x14'),_0x83274b,_0xc4f6('0x16'));_0x10ee6c(_0x345299[_0xc4f6('0x17')]['message']);}})[_0xc4f6('0x18')](function(_0x5e5326){logger[_0xc4f6('0x13')](_0xc4f6('0x14'),_0x83274b,_0x5e5326);_0x4e6c49(_0x5e5326);});});} \ No newline at end of file +var _0x45c9=['rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1075b8,_0xd606e2){var _0x5d047f=function(_0x5e6652){while(--_0x5e6652){_0x1075b8['push'](_0x1075b8['shift']());}};_0x5d047f(++_0xd606e2);}(_0x45c9,0x96));var _0x945c=function(_0x4dcfc3,_0x65e123){_0x4dcfc3=_0x4dcfc3-0x0;var _0x400cd8=_0x45c9[_0x4dcfc3];return _0x400cd8;};'use strict';var _=require('lodash');var util=require(_0x945c('0x0'));var moment=require('moment');var BPromise=require(_0x945c('0x1'));var rs=require(_0x945c('0x2'));var fs=require('fs');var Redis=require(_0x945c('0x3'));var db=require(_0x945c('0x4'))['db'];var utils=require(_0x945c('0x5'));var logger=require('../../config/logger')(_0x945c('0x6'));var config=require('../../config/environment');var jayson=require(_0x945c('0x7'));var client=jayson[_0x945c('0x8')][_0x945c('0x9')]({'port':0x232a});config[_0x945c('0xa')]=_[_0x945c('0xb')](config[_0x945c('0xa')],{'host':_0x945c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x945c('0xa')]));require('./chatGroup.socket')[_0x945c('0xd')](socket);function respondWithRpcPromise(_0x569568,_0x3e46e1,_0x4e0f64){return new BPromise(function(_0x2a8d86,_0x11c8ce){return client[_0x945c('0xe')](_0x569568,_0x4e0f64)[_0x945c('0xf')](function(_0x1a6954){logger[_0x945c('0x10')](_0x945c('0x11'),_0x3e46e1,_0x945c('0x12'));logger[_0x945c('0x13')](_0x945c('0x14'),_0x3e46e1,_0x945c('0x12'),JSON[_0x945c('0x15')](_0x1a6954));if(_0x1a6954[_0x945c('0x16')]){if(_0x1a6954[_0x945c('0x16')]['code']===0x1f4){logger[_0x945c('0x16')](_0x945c('0x11'),_0x3e46e1,_0x1a6954[_0x945c('0x16')][_0x945c('0x17')]);return _0x11c8ce(_0x1a6954[_0x945c('0x16')][_0x945c('0x17')]);}logger[_0x945c('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3e46e1,_0x1a6954[_0x945c('0x16')][_0x945c('0x17')]);return _0x2a8d86(_0x1a6954[_0x945c('0x16')]['message']);}else{logger[_0x945c('0x10')](_0x945c('0x11'),_0x3e46e1,_0x945c('0x12'));_0x2a8d86(_0x1a6954[_0x945c('0x18')][_0x945c('0x17')]);}})[_0x945c('0x19')](function(_0x59f759){logger[_0x945c('0x16')](_0x945c('0x11'),_0x3e46e1,_0x59f759);_0x11c8ce(_0x59f759);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index baa354b..84d5864 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 _0x97cc=['update','emit','length','chatGroup:','./chatGroup.events','save'];(function(_0x33f1a3,_0x1557a5){var _0x1f3d03=function(_0xfc6e8b){while(--_0xfc6e8b){_0x33f1a3['push'](_0x33f1a3['shift']());}};_0x1f3d03(++_0x1557a5);}(_0x97cc,0x154));var _0xc97c=function(_0x574b62,_0x4d28ae){_0x574b62=_0x574b62-0x0;var _0x2eae82=_0x97cc[_0x574b62];return _0x2eae82;};'use strict';var ChatGroupEvents=require(_0xc97c('0x0'));var events=[_0xc97c('0x1'),'remove',_0xc97c('0x2')];function createListener(_0x47fae7,_0x3a8b51){return function(_0x62c29b){_0x3a8b51[_0xc97c('0x3')](_0x47fae7,_0x62c29b);};}function removeListener(_0x385fdd,_0x492476){return function(){ChatGroupEvents['removeListener'](_0x385fdd,_0x492476);};}exports['register']=function(_0x204ea4){for(var _0x5efaae=0x0,_0x42e141=events[_0xc97c('0x4')];_0x5efaae<_0x42e141;_0x5efaae++){var _0x151a8e=events[_0x5efaae];var _0x764734=createListener(_0xc97c('0x5')+_0x151a8e,_0x204ea4);ChatGroupEvents['on'](_0x151a8e,_0x764734);}}; \ No newline at end of file +var _0xfd58=['save','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x1559a0,_0x9b8fd7){var _0x37e36f=function(_0x1bf6ad){while(--_0x1bf6ad){_0x1559a0['push'](_0x1559a0['shift']());}};_0x37e36f(++_0x9b8fd7);}(_0xfd58,0x170));var _0x8fd5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd58[_0x321bb2];return _0x9c12ed;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x8fd5('0x0'),_0x8fd5('0x1'),_0x8fd5('0x2')];function createListener(_0x22cfa5,_0x5b99ff){return function(_0x5d3086){_0x5b99ff[_0x8fd5('0x3')](_0x22cfa5,_0x5d3086);};}function removeListener(_0x25baec,_0x1822b3){return function(){ChatGroupEvents[_0x8fd5('0x4')](_0x25baec,_0x1822b3);};}exports[_0x8fd5('0x5')]=function(_0x39053d){for(var _0xd17657=0x0,_0x2ab8d9=events[_0x8fd5('0x6')];_0xd17657<_0x2ab8d9;_0xd17657++){var _0x53ebf7=events[_0xd17657];var _0x33c0be=createListener(_0x8fd5('0x7')+_0x53ebf7,_0x39053d);ChatGroupEvents['on'](_0x53ebf7,_0x33c0be);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d73d1fa..0ca9216 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 _0x87be=['show','getUnread','/:id/members','getMembers','/:id/messages','post','addMembers','addMessage','put','/:id','update','delete','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x87be,0x7e));var _0xe87b=function(_0x1c9a49,_0x273ee6){_0x1c9a49=_0x1c9a49-0x0;var _0x19c4ad=_0x87be[_0x1c9a49];return _0x19c4ad;};'use strict';var multer=require(_0xe87b('0x0'));var util=require(_0xe87b('0x1'));var path=require(_0xe87b('0x2'));var timeout=require('connect-timeout');var express=require(_0xe87b('0x3'));var router=express[_0xe87b('0x4')]();var fs_extra=require(_0xe87b('0x5'));var auth=require(_0xe87b('0x6'));var interaction=require(_0xe87b('0x7'));var config=require(_0xe87b('0x8'));var controller=require(_0xe87b('0x9'));router[_0xe87b('0xa')]('/',auth[_0xe87b('0xb')](),controller[_0xe87b('0xc')]);router[_0xe87b('0xa')]('/describe',auth[_0xe87b('0xb')](),controller[_0xe87b('0xd')]);router[_0xe87b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe87b('0xe')]);router[_0xe87b('0xa')]('/:id/unread',auth['isAuthenticated'](),controller[_0xe87b('0xf')]);router[_0xe87b('0xa')](_0xe87b('0x10'),auth['isAuthenticated'](),controller[_0xe87b('0x11')]);router[_0xe87b('0xa')](_0xe87b('0x12'),auth[_0xe87b('0xb')](),controller['getMessages']);router[_0xe87b('0x13')]('/',auth[_0xe87b('0xb')](),controller['create']);router['post'](_0xe87b('0x10'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x14')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xe87b('0x15')]);router[_0xe87b('0x16')](_0xe87b('0x17'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x18')]);router[_0xe87b('0x19')](_0xe87b('0x17'),auth[_0xe87b('0xb')](),controller['destroy']);router['delete'](_0xe87b('0x10'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x1a')]);module[_0xe87b('0x1b')]=router; \ No newline at end of file +var _0x02b1=['delete','destroy','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','create','post','/:id/members','addMembers','addMessage','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x02b1,0x112));var _0x102b=function(_0x459bf3,_0x5a5a7a){_0x459bf3=_0x459bf3-0x0;var _0x19bb7e=_0x02b1[_0x459bf3];return _0x19bb7e;};'use strict';var multer=require(_0x102b('0x0'));var util=require(_0x102b('0x1'));var path=require(_0x102b('0x2'));var timeout=require('connect-timeout');var express=require(_0x102b('0x3'));var router=express[_0x102b('0x4')]();var fs_extra=require(_0x102b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x102b('0x6'));var config=require('../../config/environment');var controller=require(_0x102b('0x7'));router['get']('/',auth[_0x102b('0x8')](),controller[_0x102b('0x9')]);router[_0x102b('0xa')](_0x102b('0xb'),auth[_0x102b('0x8')](),controller[_0x102b('0xc')]);router[_0x102b('0xa')](_0x102b('0xd'),auth[_0x102b('0x8')](),controller[_0x102b('0xe')]);router['get'](_0x102b('0xf'),auth[_0x102b('0x8')](),controller[_0x102b('0x10')]);router['get']('/:id/members',auth[_0x102b('0x8')](),controller[_0x102b('0x11')]);router[_0x102b('0xa')](_0x102b('0x12'),auth[_0x102b('0x8')](),controller[_0x102b('0x13')]);router['post']('/',auth[_0x102b('0x8')](),controller[_0x102b('0x14')]);router[_0x102b('0x15')](_0x102b('0x16'),auth[_0x102b('0x8')](),controller[_0x102b('0x17')]);router[_0x102b('0x15')](_0x102b('0x12'),auth[_0x102b('0x8')](),controller[_0x102b('0x18')]);router['put'](_0x102b('0xd'),auth[_0x102b('0x8')](),controller[_0x102b('0x19')]);router[_0x102b('0x1a')]('/:id',auth[_0x102b('0x8')](),controller[_0x102b('0x1b')]);router[_0x102b('0x1a')](_0x102b('0x16'),auth[_0x102b('0x8')](),controller[_0x102b('0x1c')]);module[_0x102b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index dc19d24..c6dc385 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 _0xb03e=['out','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x2005dd,_0x37e644){var _0x494d45=function(_0x5ec976){while(--_0x5ec976){_0x2005dd['push'](_0x2005dd['shift']());}};_0x494d45(++_0x37e644);}(_0xb03e,0x1eb));var _0xeb03=function(_0x475e41,_0x2a7806){_0x475e41=_0x475e41-0x0;var _0x234f33=_0xb03e[_0x475e41];return _0x234f33;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'closed':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xeb03('0x2')]},'ratingType':{'type':Sequelize[_0xeb03('0x3')](_0xeb03('0x4'),_0xeb03('0x5')),'defaultValue':_0xeb03('0x4')},'ratingMessage':{'type':Sequelize[_0xeb03('0x6')]},'pathTranscript':{'type':Sequelize[_0xeb03('0x6')]},'mailTranscript':{'type':Sequelize[_0xeb03('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xeb03('0x8')]},'disposition':{'type':Sequelize[_0xeb03('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeb03('0x7')]},'note':{'type':Sequelize[_0xeb03('0x7')]},'browserName':{'type':Sequelize[_0xeb03('0x7')]},'browserVersion':{'type':Sequelize[_0xeb03('0x7')]},'osName':{'type':Sequelize[_0xeb03('0x7')]},'osVersion':{'type':Sequelize[_0xeb03('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xeb03('0x7')]},'deviceType':{'type':Sequelize[_0xeb03('0x7')]},'referer':{'type':Sequelize[_0xeb03('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xeb03('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xeb03('0x8')]},'lastMsgAt':{'type':Sequelize[_0xeb03('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xeb03('0x3')]('in',_0xeb03('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xeb03('0x7')]},'customerPort':{'type':Sequelize[_0xeb03('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xeb03('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xeb03('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x7633=['DATE','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','long'];(function(_0x516cd9,_0x3e3e4a){var _0x12e271=function(_0x55d680){while(--_0x55d680){_0x516cd9['push'](_0x516cd9['shift']());}};_0x12e271(++_0x3e3e4a);}(_0x7633,0x1c4));var _0x3763=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7633[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x3763('0x0'));module[_0x3763('0x1')]={'closed':{'type':Sequelize[_0x3763('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3763('0x3')]},'ratingType':{'type':Sequelize[_0x3763('0x4')]('star',_0x3763('0x5')),'defaultValue':_0x3763('0x6')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x3763('0x7')]},'mailTranscript':{'type':Sequelize[_0x3763('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3763('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3763('0x8')]},'note':{'type':Sequelize[_0x3763('0x8')]},'browserName':{'type':Sequelize[_0x3763('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x3763('0x8')]},'deviceModel':{'type':Sequelize[_0x3763('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x3763('0x8')]},'referer':{'type':Sequelize[_0x3763('0x7')]},'customerIp':{'type':Sequelize[_0x3763('0x8')]},'formData':{'type':Sequelize[_0x3763('0x7')](_0x3763('0x9'))},'read1stAt':{'type':Sequelize[_0x3763('0xa')]},'lastMsgAt':{'type':Sequelize[_0x3763('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x3763('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3763('0x8')]},'customerPort':{'type':Sequelize[_0x3763('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x3763('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index dc9d012..4016d34 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 _0xedd9=['account','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','abandoned','closed','UserId','disposition','unmanaged','total','index','ChatInteraction','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','user','role','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','createVidaooSession','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','Attachment','Unauthorized','attachId','root','server/files/attachments/','offline-chat/','join','download','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','alias','setTags','spread','findAll','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Owner','get','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerPort','tail','basename','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','result','message','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','name','send','render','merge','body','contact','agent','interaction'];(function(_0x46fbde,_0x25cedf){var _0x2f8b74=function(_0x5e20d4){while(--_0x5e20d4){_0x46fbde['push'](_0x46fbde['shift']());}};_0x2f8b74(++_0x25cedf);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c9e70,_0x410345){_0x2c9e70=_0x2c9e70-0x0;var _0x25ece3=_0xedd9[_0x2c9e70];return _0x25ece3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9edd('0x0'));var rp=require(_0x9edd('0x1'));var moment=require(_0x9edd('0x2'));var BPromise=require(_0x9edd('0x3'));var Mustache=require(_0x9edd('0x4'));var util=require(_0x9edd('0x5'));var path=require(_0x9edd('0x6'));var ejs=require(_0x9edd('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0x8'));var Redis=require(_0x9edd('0x9'));var qs=require(_0x9edd('0xa'));var as=require(_0x9edd('0xb'));var pdf=require('../../components/export/pdf');var logger=require(_0x9edd('0xc'))('api');var config=require(_0x9edd('0xd'));var db=require(_0x9edd('0xe'))['db'];config[_0x9edd('0xf')]=_[_0x9edd('0x10')](config['redis'],{'host':_0x9edd('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x12'))['register'](socket);var jayson=require(_0x9edd('0x13'));var client=jayson[_0x9edd('0x14')]['http']({'port':0x232b});var client9004=jayson[_0x9edd('0x14')][_0x9edd('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x25e64c,_0xfd544a,_0x287ddd,_0x3a7b84){return new BPromise(function(_0xfca576,_0xef5498){var _0x47eb64=_0x3a7b84||client;return _0x47eb64[_0x9edd('0x16')](_0x25e64c,_0x287ddd)[_0x9edd('0x17')](function(_0x891832){logger[_0x9edd('0x18')](_0x9edd('0x19'),_0xfd544a,_0x9edd('0x1a'));logger[_0x9edd('0x1b')](_0x9edd('0x1c'),_0xfd544a,'request\x20sent',JSON[_0x9edd('0x1d')](_0x891832));if(_0x891832[_0x9edd('0x1e')]){if(_0x891832[_0x9edd('0x1e')]['code']===0x1f4){logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x891832[_0x9edd('0x1e')]['message']);return _0xef5498(_0x891832[_0x9edd('0x1e')]['message']);}logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x891832['error']['message']);return _0xfca576(_0x891832[_0x9edd('0x1e')]['message']);}else{logger[_0x9edd('0x18')]('ChatInteraction,\x20%s,\x20%s',_0xfd544a,'request\x20sent');_0xfca576(_0x891832[_0x9edd('0x1f')][_0x9edd('0x20')]);}})['catch'](function(_0x5823bc){logger[_0x9edd('0x1e')](_0x9edd('0x19'),_0xfd544a,_0x5823bc);_0xef5498(_0x5823bc);});});}function respondWithStatusCode(_0x477878,_0x542172){_0x542172=_0x542172||0xcc;return function(_0x3741c8){if(_0x3741c8){return _0x477878[_0x9edd('0x21')](_0x542172);}return _0x477878[_0x9edd('0x22')](_0x542172)[_0x9edd('0x23')]();};}function respondWithResult(_0x339a0d,_0x4c75d2){_0x4c75d2=_0x4c75d2||0xc8;return function(_0x46c383){if(_0x46c383){return _0x339a0d[_0x9edd('0x22')](_0x4c75d2)[_0x9edd('0x24')](_0x46c383);}};}function respondWithFilteredResult(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(_0x4d507f){var _0x4b3d1b=typeof _0x310a4d[_0x9edd('0x25')]===_0x9edd('0x26')&&typeof _0x310a4d[_0x9edd('0x27')]===_0x9edd('0x26');var _0x3c2227=_0x4d507f['count'];var _0x57a2cc=_0x4b3d1b?0x0:_0x310a4d[_0x9edd('0x25')];var _0x257a26=_0x4b3d1b?_0x4d507f[_0x9edd('0x28')]:_0x310a4d['offset']+_0x310a4d[_0x9edd('0x27')];var _0x28cfae;if(_0x257a26>=_0x3c2227){_0x257a26=_0x3c2227;_0x28cfae=0xc8;}else{_0x28cfae=0xce;}_0x2f9f86[_0x9edd('0x22')](_0x28cfae);return _0x2f9f86[_0x9edd('0x29')]('Content-Range',_0x57a2cc+'-'+_0x257a26+'/'+_0x3c2227)[_0x9edd('0x24')](_0x4d507f);}return null;};}function saveUpdates(_0x3fb556){return function(_0xbe87e1){if(_0xbe87e1){return _0xbe87e1[_0x9edd('0x2a')](_0x3fb556)[_0x9edd('0x17')](function(_0x42e664){return _0x42e664;});}return null;};}function removeEntity(_0x209aba){return function(_0x1fba7b){if(_0x1fba7b){return _0x1fba7b[_0x9edd('0x2b')]()[_0x9edd('0x17')](function(){_0x209aba[_0x9edd('0x22')](0xcc)[_0x9edd('0x23')]();});}};}function handleEntityNotFound(_0x6907a5){return function(_0xa55906){if(!_0xa55906){_0x6907a5[_0x9edd('0x21')](0x194);}return _0xa55906;};}function handleError(_0x5af178,_0x1453d2){_0x1453d2=_0x1453d2||0x1f4;return function(_0x259259){logger[_0x9edd('0x1e')](_0x259259['stack']);if(_0x259259[_0x9edd('0x2c')]){delete _0x259259[_0x9edd('0x2c')];}_0x5af178[_0x9edd('0x22')](_0x1453d2)[_0x9edd('0x2d')](_0x259259);};}function getMustacheRender(_0x21bc30,_0x2bc4ed){return Mustache[_0x9edd('0x2e')](_0x21bc30,_[_0x9edd('0x2f')](_0x2bc4ed[_0x9edd('0x30')],{'contact':_0x2bc4ed[_0x9edd('0x31')],'message':_0x2bc4ed[_0x9edd('0x20')],'agent':_0x2bc4ed[_0x9edd('0x32')],'interaction':_0x2bc4ed[_0x9edd('0x33')],'account':_0x2bc4ed[_0x9edd('0x34')]}))||'';}function getInteractionUsers(_0x5757fc,_0x37fcb2){return new BPromise(function(_0x5ed62d,_0x968303){try{if(_0x37fcb2[_0x5757fc['id']]){_0x5757fc[_0x9edd('0x35')]=_[_0x9edd('0x36')](_0x37fcb2[_0x5757fc['id']],function(_0x434d26){return{'id':_0x434d26['id'],'fullname':_0x434d26[_0x9edd('0x37')]};});}}catch(_0x4fa5ab){_0x968303(_0x4fa5ab);}_0x5ed62d(_0x5757fc);});}function getInteractionTags(_0x6de835,_0x44dbfc){return new BPromise(function(_0x2b3469,_0x38e9be){try{if(_0x6de835[_0x9edd('0x38')]){_0x6de835[_0x9edd('0x39')]=[];_0x6de835[_0x9edd('0x38')][_0x9edd('0x3a')](',')[_0x9edd('0x3b')](function(_0x35c16f){_0x6de835['Tags'][_0x9edd('0x3c')](_0x44dbfc[_0x35c16f]);});}delete _0x6de835['TagIds'];}catch(_0x3ef1d5){_0x38e9be(_0x3ef1d5);}_0x2b3469(_0x6de835);});}function updateChatInteraction(_0x5658d6,_0x30883e,_0x2858b5){return new BPromise(function(_0x34e9d2,_0x479661){return getInteractionUsers(_0x5658d6,_0x2858b5)[_0x9edd('0x17')](function(_0xcbd0ef){return getInteractionTags(_0xcbd0ef,_0x30883e);})[_0x9edd('0x17')](function(_0x48958a){return getStateInteraction(_0x48958a);})[_0x9edd('0x17')](function(_0x51ad91){_0x34e9d2(_0x51ad91);})[_0x9edd('0x3d')](function(_0xfbc492){_0x479661(_0xfbc492);});});}function getStateInteraction(_0x50be2c){return new BPromise(function(_0x315f52){_0x50be2c[_0x9edd('0x3e')]=0x0;_0x50be2c[_0x9edd('0x3f')]=0x0;_0x50be2c[_0x9edd('0x40')]=0x0;_0x50be2c['unmanaged']=0x0;_0x50be2c[_0x9edd('0x41')]=0x0;_0x50be2c['total']=0x0;if(!_0x50be2c[_0x9edd('0x42')]&&!_0x50be2c[_0x9edd('0x43')]){_0x50be2c['waiting']+=0x1;}if(!_0x50be2c[_0x9edd('0x42')]&&_0x50be2c['UserId']){_0x50be2c['talking']+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}if(_0x50be2c[_0x9edd('0x42')]&&_0x50be2c[_0x9edd('0x44')]===_0x9edd('0x41')){_0x50be2c[_0x9edd('0x41')]+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}else if(_0x50be2c[_0x9edd('0x42')]&&!_0x50be2c[_0x9edd('0x43')]&&_0x50be2c[_0x9edd('0x44')]){_0x50be2c[_0x9edd('0x45')]+=0x1;if(_0x50be2c[_0x9edd('0x3e')]){_0x50be2c[_0x9edd('0x3e')]-=0x1;}}else if(_0x50be2c[_0x9edd('0x42')]&&_0x50be2c['UserId']){_0x50be2c[_0x9edd('0x40')]+=0x1;if(_0x50be2c[_0x9edd('0x3f')]){_0x50be2c[_0x9edd('0x3f')]-=0x1;}}_0x50be2c[_0x9edd('0x46')]+=0x1;_0x315f52(_0x50be2c);});}exports[_0x9edd('0x47')]=function(_0x3ecdfd,_0x10d41e){var _0x4e9ad1={},_0x4a4656={},_0x4bc7a1={'count':0x0,'rows':[]};var _0x4a7dc9=_['map'](db[_0x9edd('0x48')][_0x9edd('0x49')],function(_0x2b06d3){return{'name':_0x2b06d3[_0x9edd('0x4a')],'type':_0x2b06d3[_0x9edd('0x4b')]['key']};});_0x4a4656[_0x9edd('0x4c')]=_[_0x9edd('0x36')](_0x4a7dc9,_0x9edd('0x2c'));_0x4a4656['query']=_[_0x9edd('0x4d')](_0x3ecdfd[_0x9edd('0x4e')]);_0x4a4656[_0x9edd('0x4f')]=_[_0x9edd('0x50')](_0x4a4656[_0x9edd('0x4c')],_0x4a4656[_0x9edd('0x4e')]);_0x4e9ad1['attributes']=_[_0x9edd('0x50')](_0x4a4656[_0x9edd('0x4c')],qs['fields'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x4e9ad1['attributes']=_0x4e9ad1[_0x9edd('0x52')][_0x9edd('0x53')]?_0x4e9ad1[_0x9edd('0x52')]:_0x4a4656['model'];if(!_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x54')](_0x9edd('0x55'))){_0x4e9ad1[_0x9edd('0x27')]=qs['limit'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x4e9ad1[_0x9edd('0x25')]=qs['offset'](_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x25')]);}_0x4e9ad1['order']=qs[_0x9edd('0x56')](_0x3ecdfd['query'][_0x9edd('0x56')]);_0x4e9ad1[_0x9edd('0x57')]=qs[_0x9edd('0x4f')](_[_0x9edd('0x58')](_0x3ecdfd[_0x9edd('0x4e')],_0x4a4656[_0x9edd('0x4f')]),_0x4a7dc9);var _0x2334d4=[];var _0x14dd27=squel[_0x9edd('0x59')]()[_0x9edd('0x5a')]('id')[_0x9edd('0x5a')]('name')[_0x9edd('0x5a')](_0x9edd('0x5b'))[_0x9edd('0x5c')]('tools_tags');var _0xe96d6a=squel['select']()['field']('u.id')[_0x9edd('0x5a')](_0x9edd('0x5d'))[_0x9edd('0x5a')](_0x9edd('0x5e'))['from']('user_has_chat_interactions','ui')['left_join'](_0x9edd('0x5f'),'u',_0x9edd('0x60'));var _0xd5090a=squel[_0x9edd('0x59')]()[_0x9edd('0x5c')](_0x9edd('0x61'),'i')[_0x9edd('0x62')](_0x9edd('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9edd('0x62')]('users','o',_0x9edd('0x64'))[_0x9edd('0x62')]('chat_websites','a',_0x9edd('0x65'))[_0x9edd('0x62')](_0x9edd('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x9edd('0x62')](_0x9edd('0x67'),'it',_0x9edd('0x68'))[_0x9edd('0x62')](_0x9edd('0x69'),'t',_0x9edd('0x6a'));var _0x53f55b=squel['expr']();var _0x452ca5=[];var _0x54f96c=squel[_0x9edd('0x6b')]();var _0x3e9a3e;if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x6c')]){_0x3e9a3e=as['parseSearch'](_0x3ecdfd[_0x9edd('0x4e')]['search']);var _0x3e5dca=_0x3e9a3e[_0x9edd('0x6d')];for(var _0xc6bde6=0x0;_0xc6bde6<_0x3e9a3e['conditions'][_0x9edd('0x53')];_0xc6bde6++){var _0x57da5b=_0x3e9a3e[_0x9edd('0x6e')][_0xc6bde6];var _0x4e1eda='i';var _0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,['name',_0x57da5b[_0x9edd('0x5a')]]);if(!_0x4915a9){switch(_0x57da5b[_0x9edd('0x5a')]){case _0x9edd('0x70'):if(_0x57da5b['value']==0x1){_0xd5090a[_0x9edd('0x71')]('`'+_0x57da5b[_0x9edd('0x5a')]+_0x9edd('0x72'));}else{_0xd5090a[_0x9edd('0x71')]('`'+_0x57da5b[_0x9edd('0x5a')]+'`\x20>\x200');}break;case'Contact':if(_0x57da5b[_0x9edd('0x73')]===_0x9edd('0x74')){if(_0x57da5b['value']['split']('\x20')['length']>0x1){_0x53f55b[_0x3e5dca](_0x9edd('0x75'),qs['getFullTextValue'](_0x57da5b['value']),null);}else{var _0x3ef9c9='%'+_0x57da5b[_0x9edd('0x76')]+'%';_0x53f55b[_0x3e5dca]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3ef9c9,_0x3ef9c9,_0x3ef9c9);}}else{_0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,[_0x9edd('0x2c'),_0x9edd('0x77')]);_0x57da5b['field']=_0x9edd('0x77');_0x3801c4=as['buildExpression'](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4['value'][_0x9edd('0x79')],_0x3801c4[_0x9edd('0x76')]['end']);}break;case _0x9edd('0x7a'):var _0x475dc3=_0x57da5b[_0x9edd('0x76')][_0x9edd('0x3a')](',')['map'](function(_0x366b04){return Number(_0x366b04);});_0x475dc3['forEach'](function(_0x1a618c){_0x54f96c['or'](_0x9edd('0x7b'),'%,'+_0x1a618c+',%');});_0x452ca5=_[_0x9edd('0x7c')](_0x452ca5,_0x475dc3);break;case'User':if(_0x57da5b[_0x9edd('0x73')]===_0x9edd('0x74')){_0x53f55b[_0x3e5dca](_0x9edd('0x7d'),'%'+_0x57da5b[_0x9edd('0x76')]+'%',null);}else{_0x4915a9=_[_0x9edd('0x6f')](_0x4a7dc9,[_0x9edd('0x2c'),_0x9edd('0x43')]);_0x57da5b['field']='UserId';_0x3801c4=as[_0x9edd('0x7e')](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4[_0x9edd('0x76')][_0x9edd('0x79')],_0x3801c4['value'][_0x9edd('0x23')]);}break;case _0x9edd('0x30'):_0x3801c4=as[_0x9edd('0x7e')]('me',null,_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4['text'],_0x3801c4[_0x9edd('0x76')][_0x9edd('0x79')],_0x3801c4['value'][_0x9edd('0x23')]);break;}}else{var _0x3801c4=as['buildExpression'](_0x4e1eda,_0x4915a9[_0x9edd('0x4b')],_0x57da5b);_0x53f55b[_0x3e5dca](_0x3801c4[_0x9edd('0x78')],_0x3801c4['value'][_0x9edd('0x79')],_0x3801c4['value']['end']);}}}else{var _0x45c9ef=_(_0x3ecdfd[_0x9edd('0x4e')])[_0x9edd('0x4d')]()['map'](function(_0x3c7df3){return _[_0x9edd('0x7f')](_0x4a7dc9,['name',_0x3c7df3])?_0x3c7df3:undefined;})[_0x9edd('0x80')]()[_0x9edd('0x76')]();if(!_[_0x9edd('0x81')](_0x45c9ef)){_0x45c9ef[_0x9edd('0x3b')](function(_0x54ac71){if(_0x54ac71==='ChatWebsiteId'){_0xd5090a[_0x9edd('0x57')]('i.ChatWebsiteId\x20IN\x20?',[][_0x9edd('0x82')](_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]));}else if(_0x54ac71===_0x9edd('0x83')){var _0x3cfd35=JSON[_0x9edd('0x84')](_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71])[_0x9edd('0x85')];var _0x5a4d4b=JSON[_0x9edd('0x84')](_0x3ecdfd['query'][_0x54ac71])[_0x9edd('0x86')];_0xd5090a[_0x9edd('0x57')](_0x9edd('0x87'),_0x3cfd35,_0x5a4d4b);}else{if(_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]===_0x9edd('0x88')){_0xd5090a[_0x9edd('0x57')]('i.'+_0x54ac71+_0x9edd('0x89'));}else{_0xd5090a['where']('i.'+_0x54ac71+_0x9edd('0x8a'),_0x3ecdfd[_0x9edd('0x4e')][_0x54ac71]);}}});}if(_0x3ecdfd['query'][_0x9edd('0x8b')]){if(_0x3ecdfd[_0x9edd('0x4e')]['read']==0x1){_0xd5090a[_0x9edd('0x71')](_0x9edd('0x8c'));}else{_0xd5090a[_0x9edd('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8d')]){_0x452ca5=_[_0x9edd('0x8e')](_0x3ecdfd['query']['tag'])?_0x3ecdfd['query']['tag']:new Array(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8d')]);_0x452ca5[_0x9edd('0x3b')](function(_0x521810){_0x54f96c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x521810+',%');});}if(_0x3ecdfd['query'][_0x9edd('0x8f')]){var _0x388252=_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x8f')][_0x9edd('0x90')]('\x5c','\x5c\x5c')[_0x9edd('0x90')](/'/g,'\x27\x27');if(qs[_0x9edd('0x91')](_0x388252)){_0x53f55b['or'](_0x9edd('0x92'),_0x388252+'%');}else{_0x53f55b['or'](_0x9edd('0x93'),qs[_0x9edd('0x94')](_0x388252))['or'](_0x9edd('0x95'),_0x388252+'%');}}}_0xd5090a[_0x9edd('0x57')](_0x53f55b);_0xd5090a['group'](_0x9edd('0x96'));var _0x29f3b2={'type':db[_0x9edd('0x97')][_0x9edd('0x98')][_0x9edd('0x99')],'raw':!![]};var _0x2d067b=_0xd5090a[_0x9edd('0x9a')]();_0x2d067b[_0x9edd('0x5a')]('i.id');_0x2d067b['field'](_0x9edd('0x9b'),'unreadMessages');if(_0x4e9ad1[_0x9edd('0x9c')]){_0x4e9ad1['order'][_0x9edd('0x3b')](function(_0x3f2452){var _0x554804=_0x3f2452[0x0]===_0x9edd('0x9d')?_0x3f2452[0x0]:'i.'+_0x3f2452[0x0];_0xd5090a[_0x9edd('0x9c')](_0x554804,_0x3f2452[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9edd('0x81')](_0x452ca5)){_0xd5090a[_0x9edd('0x71')](_0x54f96c);_0x2d067b[_0x9edd('0x57')](_0x9edd('0x9e'),_0x452ca5);}BPromise[_0x9edd('0x9f')]()['then'](function(){if(!_0x3e9a3e){if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0xa0')])return;_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa1'));_0xd5090a[_0x9edd('0x57')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x3ecdfd['user']['role']!=='agent')return;return _0x3ecdfd['user'][_0x9edd('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58cb3f){if(_[_0x9edd('0x81')](_0x58cb3f)){_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa3'));_0xd5090a[_0x9edd('0x57')](_0x9edd('0xa3'));}else{_0x2d067b[_0x9edd('0x57')](_0x9edd('0xa4'),_[_0x9edd('0x36')](_0x58cb3f,'id'));_0xd5090a[_0x9edd('0x57')](_0x9edd('0xa4'),_['map'](_0x58cb3f,'id'));}});})[_0x9edd('0x17')](function(){if(_0x3ecdfd[_0x9edd('0xa5')][_0x9edd('0xa6')]===_0x9edd('0x32')&&!_0x3e9a3e&&!_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0xa0')])return[];return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0x2d067b['toString'](),_0x29f3b2);})['then'](function(_0x401ad3){_0x4bc7a1[_0x9edd('0x28')]=_0x401ad3[_0x9edd('0x53')];if(_0x4bc7a1[_0x9edd('0x28')]===0x0)return[];return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0x14dd27[_0x9edd('0xa8')](),_0x29f3b2)[_0x9edd('0x17')](function(_0x93fef1){_0x2334d4=_[_0x9edd('0xa9')](_0x93fef1,'id');_0x29f3b2=_[_0x9edd('0x2f')](_0x29f3b2,{'model':db[_0x9edd('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ecdfd[_0x9edd('0x4e')][_0x9edd('0x51')]){_0x4e9ad1['attributes'][_0x9edd('0x3b')](function(_0x34ee39){_0xd5090a['field']('i.'+_0x34ee39);});}else{_0xd5090a[_0x9edd('0x5a')](_0x9edd('0x9b'),_0x9edd('0x70'));_0xd5090a[_0x9edd('0x5a')]('a.key',_0x9edd('0xaa'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xab'),_0x9edd('0xac'));_0xd5090a[_0x9edd('0x5a')]('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',_0x9edd('0x9d'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xad'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xae'),'Contact.firstName');_0xd5090a['field'](_0x9edd('0xaf'),'Contact.lastName');_0xd5090a[_0x9edd('0x5a')]('c.email',_0x9edd('0xb0'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb1'),_0x9edd('0xb2'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb3'),'Contact.mobile');_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb4'),_0x9edd('0xb5'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb6'),_0x9edd('0xb7'));_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb8'),'Owner.internal');_0xd5090a[_0x9edd('0x5a')](_0x9edd('0xb9'),_0x9edd('0x38'));}if(_0x4e9ad1[_0x9edd('0x27')])_0xd5090a[_0x9edd('0x27')](_0x4e9ad1[_0x9edd('0x27')]);if(_0x4e9ad1[_0x9edd('0x25')])_0xd5090a[_0x9edd('0x25')](_0x4e9ad1[_0x9edd('0x25')]);return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0xd5090a[_0x9edd('0xa8')](),_0x29f3b2);})[_0x9edd('0x17')](function(_0x315a4c){if(_0x315a4c[_0x9edd('0x53')]>0x0)_0xe96d6a[_0x9edd('0x57')](_0x9edd('0xba'),_[_0x9edd('0x36')](_0x315a4c,'id'));return db[_0x9edd('0xa7')][_0x9edd('0x4e')](_0xe96d6a[_0x9edd('0xa8')](),_0x29f3b2)['then'](function(_0xa704eb){var _0x553018=_['groupBy'](_0xa704eb,_0x9edd('0xbb'));var _0x108244=[];_0x315a4c[_0x9edd('0x3b')](function(_0x11b556){_0x108244[_0x9edd('0x3c')](updateChatInteraction(_0x11b556,_0x2334d4,_0x553018));});return BPromise[_0x9edd('0xbc')](_0x108244);});});})[_0x9edd('0x17')](function(_0x69925a){_0x4bc7a1[_0x9edd('0xbd')]=_0x69925a;return _0x4bc7a1;})[_0x9edd('0x17')](respondWithFilteredResult(_0x10d41e,_0x4e9ad1))['catch'](handleError(_0x10d41e,null));};exports[_0x9edd('0xbe')]=function(_0x3c2c2c,_0x48f1ae){var _0x568067={'raw':![],'where':{'id':_0x3c2c2c[_0x9edd('0xbf')]['id']}},_0x176427={};_0x176427[_0x9edd('0x4c')]=_[_0x9edd('0x4d')](db['ChatInteraction']['rawAttributes']);_0x176427[_0x9edd('0x4e')]=_['keys'](_0x3c2c2c[_0x9edd('0x4e')]);_0x176427[_0x9edd('0x4f')]=_[_0x9edd('0x50')](_0x176427['model'],_0x176427['query']);_0x568067['attributes']=_[_0x9edd('0x50')](_0x176427[_0x9edd('0x4c')],qs[_0x9edd('0x51')](_0x3c2c2c['query'][_0x9edd('0x51')]));_0x568067[_0x9edd('0x52')]=_0x568067['attributes'][_0x9edd('0x53')]?_0x568067[_0x9edd('0x52')]:_0x176427['model'];if(_0x3c2c2c['query'][_0x9edd('0xc0')]){_0x568067[_0x9edd('0xc1')]=[{'all':!![]}];}_0x568067=_['merge']({},_0x568067,_0x3c2c2c[_0x9edd('0xc2')]);return db[_0x9edd('0x48')]['find'](_0x568067)[_0x9edd('0x17')](handleEntityNotFound(_0x48f1ae,null))['then'](respondWithResult(_0x48f1ae,null))[_0x9edd('0x3d')](handleError(_0x48f1ae,null));};exports[_0x9edd('0xc3')]=function(_0x23eb54,_0x742e13){return db[_0x9edd('0x48')][_0x9edd('0xc3')](_0x23eb54['body'],{})[_0x9edd('0x17')](respondWithResult(_0x742e13,0xc9))[_0x9edd('0x3d')](handleError(_0x742e13,null));};exports[_0x9edd('0x2a')]=function(_0x511ea1,_0x956219){if(_0x511ea1['body']['id']){delete _0x511ea1[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x511ea1[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x956219,null))['then'](saveUpdates(_0x511ea1['body'],null))[_0x9edd('0x17')](respondWithResult(_0x956219,null))[_0x9edd('0x3d')](handleError(_0x956219,null));};exports[_0x9edd('0x2b')]=function(_0x50af78,_0x41a761){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x50af78[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x41a761,null))[_0x9edd('0x17')](removeEntity(_0x41a761,null))['catch'](handleError(_0x41a761,null));};exports['describe']=function(_0x12ceb1,_0x47676c){return db[_0x9edd('0x48')]['describe']()[_0x9edd('0x17')](respondWithResult(_0x47676c,null))[_0x9edd('0x3d')](handleError(_0x47676c,null));};exports[_0x9edd('0xc4')]=function(_0x454cce,_0x524217){var _0x2122de=_0x454cce['params']['id'];var _0x3d8b18;var _0x3eeb0c;var _0x7b0a4f;return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x2122de}})['then'](function(_0x3e07f1){_0x3d8b18=_0x3e07f1;return db['ChatWebsite'][_0x9edd('0xc5')]({'where':{'id':_0x3e07f1['ChatWebsiteId']},'attributes':['id',_0x9edd('0xc6'),'vidaooEscalation',_0x9edd('0xc7'),_0x9edd('0xc8'),_0x9edd('0xc9')],'raw':!![]});})['then'](function(_0x244dce){if(_0x244dce&&_0x244dce[_0x9edd('0xc6')]&&_0x244dce[_0x9edd('0xca')]){_0x3eeb0c=_0x244dce;var _0x2e7b0d={'interaction':{'id':_0x2122de},'agent':{'id':_0x454cce[_0x9edd('0xa5')]['id'],'name':_0x454cce[_0x9edd('0xa5')][_0x9edd('0x2c')],'fullname':_0x454cce[_0x9edd('0xa5')][_0x9edd('0x37')],'email':_0x454cce[_0x9edd('0xa5')][_0x9edd('0xcb')]},'contact':_0x454cce[_0x9edd('0x30')][_0x9edd('0x31')],'account':_0x454cce[_0x9edd('0x30')][_0x9edd('0x34')]};var _0x81dd98={'rejectUnauthorized':![],'method':_0x9edd('0xcc'),'url':_0x9edd('0xcd'),'headers':{'X-APIKEY':_0x244dce[_0x9edd('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x454cce[_0x9edd('0xa5')][_0x9edd('0xcb')]],'buttons':null,'topic':_0x3eeb0c[_0x9edd('0xc7')],'note':_['isNull'](_0x3eeb0c[_0x9edd('0xc8')])?null:getMustacheRender(_0x3eeb0c['vidaooNote'],_0x2e7b0d),'metadata':null},'redirect':_0x9edd('0xce'),'json':!![]};try{if(!_[_0x9edd('0xcf')](_0x3eeb0c[_0x9edd('0xc9')])){var _0x8ab7e8=getMustacheRender(_0x3eeb0c[_0x9edd('0xc9')],_0x2e7b0d);var _0x5465fd=JSON[_0x9edd('0x84')](_0x8ab7e8);_0x81dd98['body'][_0x9edd('0xd0')]=_0x5465fd;}}catch(_0x438cc5){throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xd2'));}return rp(_0x81dd98);}else{throw new db[(_0x9edd('0x97'))]['ValidationError'](_0x9edd('0xd3'));}})[_0x9edd('0x17')](function(_0x5be4a6){_0x7b0a4f=_0x5be4a6;if(_0x7b0a4f['id']){var _0x4f7350={'body':_0x7b0a4f['join_url'],'ChatWebsiteId':_0x3eeb0c['id'],'ChatInteractionId':_0x3d8b18['id'],'direction':'out','UserId':_0x454cce[_0x9edd('0xa5')]['id']};return db[_0x9edd('0xd4')][_0x9edd('0xc3')](_0x4f7350,{});}else{throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xd5'));}})[_0x9edd('0x17')](function(){return _0x3d8b18[_0x9edd('0xd6')]({'vidaooSessionId':_0x7b0a4f['id']});})[_0x9edd('0x17')](respondWithResult(_0x524217,null))[_0x9edd('0x3d')](handleError(_0x524217,null));};exports['customUpdate']=function(_0x361b57,_0x4b3449){if(_0x361b57['body']['id']){delete _0x361b57[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x361b57[_0x9edd('0xbf')]['id']},'include':[{'model':db[_0x9edd('0xd7')],'as':'Contact'}]})[_0x9edd('0x17')](handleEntityNotFound(_0x4b3449,null))[_0x9edd('0x17')](saveUpdates(_0x361b57[_0x9edd('0x30')],null))[_0x9edd('0x17')](respondWithResult(_0x4b3449,null))['catch'](handleError(_0x4b3449,null));};exports[_0x9edd('0xd8')]=function(_0x2a3076,_0x3df631){if(_0x2a3076[_0x9edd('0x30')]['id']){delete _0x2a3076[_0x9edd('0x30')]['id'];}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x2a3076[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](function(_0xa8c1f7){if(!_0xa8c1f7){logger[_0x9edd('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9edd('0xd8'),0x194,_0x9edd('0xd9'));_0x3df631[_0x9edd('0x21')](0x194);}else{if(_0xa8c1f7[_0x9edd('0x43')]){throw new db[(_0x9edd('0x97'))][(_0x9edd('0xd1'))](_0x9edd('0xda'));}}return _0xa8c1f7;})[_0x9edd('0x17')](function(_0x4a3955){if(_0x4a3955){return _0x4a3955['update']({'closed':_0x2a3076['body'][_0x9edd('0x42')],'disposition':_0x2a3076[_0x9edd('0x30')][_0x9edd('0x44')]})[_0x9edd('0x17')](function(_0x223c42){return _0x223c42;});}})[_0x9edd('0x17')](function(){return respondWithRpcPromise(_0x9edd('0xdb'),_0x9edd('0xd8'),_0x2a3076[_0x9edd('0x30')],client9004);})[_0x9edd('0x17')](respondWithResult(_0x3df631,null))['catch'](handleError(_0x3df631,null));};exports[_0x9edd('0xdc')]=function(_0x56dc7e,_0x4db9fc){_0x56dc7e[_0x9edd('0x30')][_0x9edd('0x2c')]=_0x56dc7e[_0x9edd('0xdd')]['originalname'];_0x56dc7e['body']['basename']=_0x56dc7e['file']['filename'];_0x56dc7e[_0x9edd('0x30')][_0x9edd('0x4b')]=_0x56dc7e[_0x9edd('0xdd')]['mimetype'];return db[_0x9edd('0xde')][_0x9edd('0xc3')](_0x56dc7e[_0x9edd('0x30')])['then'](respondWithResult(_0x4db9fc,0xc9))[_0x9edd('0x3d')](handleError(_0x4db9fc,null));};exports['attachmentDownload']=function(_0x16a1c8,_0x1a2376){return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x16a1c8['params']['id']},'raw':!![]})[_0x9edd('0x17')](handleEntityNotFound(_0x1a2376,null))[_0x9edd('0x17')](function(_0x499e2a){if(_0x499e2a){if(_0x499e2a[_0x9edd('0x42')]){return _0x1a2376[_0x9edd('0x22')](0x193)[_0x9edd('0x24')]({'status':0x193,'message':_0x9edd('0xdf')});}return db['Attachment'][_0x9edd('0xc5')]({'where':{'id':_0x16a1c8[_0x9edd('0x4e')][_0x9edd('0xe0')]},'raw':!![]})[_0x9edd('0x17')](handleEntityNotFound(_0x1a2376,null));}})[_0x9edd('0x17')](function(_0x35d21e){if(_0x35d21e){var _0x390354=_0x35d21e['ChatOfflineMessageId']!==null;var _0xb29591=path['join'](config[_0x9edd('0xe1')],_0x9edd('0xe2'));if(_0x390354){_0xb29591=path['join'](_0xb29591,_0x9edd('0xe3'));}var _0x2f212d=path[_0x9edd('0xe4')](_0xb29591,_0x35d21e['basename']);return _0x1a2376[_0x9edd('0xe5')](_0x2f212d);}})[_0x9edd('0x3d')](handleError(_0x1a2376,null));};exports[_0x9edd('0xe6')]=function(_0x52f0e2,_0x155ca5){var _0x517142=null;var _0x288ecc=null;var _0x30d03a=null;if(_0x52f0e2[_0x9edd('0x30')]['id']){delete _0x52f0e2[_0x9edd('0x30')]['id'];}if(_0x52f0e2['body']['mailTranscript']){_0x30d03a=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0xe7'),util[_0x9edd('0xe8')](_0x9edd('0xe9'),Date['now']()));_0x52f0e2[_0x9edd('0x30')][_0x9edd('0xea')]=_0x30d03a;}return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x52f0e2[_0x9edd('0xbf')]['id']},'include':[{'model':db[_0x9edd('0xd4')],'as':_0x9edd('0xeb'),'include':[{'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec')}]}]})[_0x9edd('0x17')](handleEntityNotFound(_0x155ca5,null))[_0x9edd('0x17')](saveUpdates(_0x52f0e2[_0x9edd('0x30')],null))[_0x9edd('0x17')](function(_0x549cd6){if(_0x549cd6){_0x517142=_0x549cd6;return db[_0x9edd('0xed')][_0x9edd('0x6f')]({'where':{'id':_0x517142[_0x9edd('0xa0')]}});}})[_0x9edd('0x17')](function(_0x5aab0e){if(_0x5aab0e){_0x288ecc=_0x5aab0e;return db[_0x9edd('0xd7')][_0x9edd('0x6f')]({'where':{'id':_0x517142[_0x9edd('0x77')]}});}})['then'](function(_0x910adf){if(_0x910adf){if(_0x30d03a){var _0x49a24f=null;for(var _0x483d82=0x1;_0x483d82<_0x517142[_0x9edd('0xeb')][_0x9edd('0x53')];++_0x483d82){_0x49a24f=_0x517142[_0x9edd('0xeb')][_0x483d82];var _0x1934d3=_0x49a24f['UserId']?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f[_0x9edd('0x43')]):_0x9edd('0xf0');var _0x38efe5=_0x52f0e2[_0x9edd('0x30')][_0x9edd('0xf1')]||util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x9edd('0xf2'),_0x49a24f[_0x9edd('0x77')]);switch(_0x288ecc['agentIdentifier']){case _0x9edd('0xf3'):_0x1934d3=_0x49a24f[_0x9edd('0x43')]?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f['UserId']):_0x9edd('0xf0');break;case'agent_alias':_0x1934d3=_0x49a24f[_0x9edd('0x43')]?_0x49a24f[_0x9edd('0xec')]['alias']||_0x49a24f['User'][_0x9edd('0x37')]:_0x9edd('0xf0');break;case _0x9edd('0xf4'):_0x1934d3=_0x49a24f[_0x9edd('0x43')]?_0x49a24f[_0x9edd('0xec')]['fullname']:'System';break;default:_0x1934d3=_0x49a24f[_0x9edd('0x43')]?util[_0x9edd('0xe8')](_0x9edd('0xee'),_0x288ecc[_0x9edd('0xef')],_0x49a24f['UserId']):_0x9edd('0xf0');}var _0x3b36ed=util[_0x9edd('0xe8')](_0x9edd('0xf5'),moment(_0x49a24f[_0x9edd('0x83')])[_0x9edd('0xe8')](_0x9edd('0xf6')),_0x49a24f['direction']==='in'?_0x38efe5:_0x1934d3,_0x49a24f[_0x9edd('0x30')]);if(!_0x49a24f[_0x9edd('0xf7')]){fs[_0x9edd('0xf8')](_0x30d03a,_0x3b36ed);}}return db[_0x9edd('0xf9')][_0x9edd('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x9edd('0xfa')],'as':_0x9edd('0xfb'),'raw':!![],'include':[{'model':db[_0x9edd('0xfc')],'as':_0x9edd('0xfc'),'raw':!![]}]}]});}}})[_0x9edd('0x17')](function(_0x288bc8){if(!_0x288bc8||!_0x288bc8[_0x9edd('0xfb')]||!_0x52f0e2[_0x9edd('0x30')])return _0x517142;var _0x50bfd5=_0x288bc8[_0x9edd('0xfd')]();return respondWithRpcPromise(_0x9edd('0xfe'),_0x9edd('0xff'),{'account':_0x50bfd5,'message':{'from':util[_0x9edd('0xe8')]('\x22%s\x22\x20<%s>',_0x288bc8[_0x9edd('0x2c')],_0x288bc8[_0x9edd('0xcb')]||_0x288bc8[_0x9edd('0xfb')][_0x9edd('0xa5')]),'to':_0x52f0e2[_0x9edd('0x30')][_0x9edd('0x100')],'subject':_0x9edd('0x101'),'text':util[_0x9edd('0xe8')](_0x9edd('0x102'),_0x52f0e2[_0x9edd('0x30')][_0x9edd('0x100')]),'attachments':[{'path':_0x30d03a}]}})['then'](function(){return _0x517142;})[_0x9edd('0x3d')](function(_0x7916cf){logger[_0x9edd('0x1e')](_0x7916cf);});})[_0x9edd('0x17')](respondWithStatusCode(_0x155ca5,0xc8))[_0x9edd('0x3d')](handleError(_0x155ca5,null));};exports[_0x9edd('0x103')]=function(_0x3bdbed,_0x55d08b){return db[_0x9edd('0xd4')][_0x9edd('0x6f')]({'where':{'id':_0x3bdbed[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x55d08b,null))[_0x9edd('0x17')](function(_0x116fcb){if(_0x116fcb){return _0x116fcb[_0x9edd('0x103')](_0x3bdbed[_0x9edd('0x30')][_0x9edd('0x104')],_[_0x9edd('0x105')](_0x3bdbed[_0x9edd('0x30')],[_0x9edd('0x104'),'id'])||{});}})[_0x9edd('0x17')](respondWithResult(_0x55d08b,null))[_0x9edd('0x3d')](handleError(_0x55d08b,null));};exports[_0x9edd('0x106')]=function(_0xd227fe,_0x106889){var _0x56a952={'raw':![],'where':{}};var _0xadc0be={};var _0x300094={'count':0x0,'rows':[]};return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0xd227fe[_0x9edd('0xbf')]['id']}})[_0x9edd('0x17')](handleEntityNotFound(_0x106889,null))[_0x9edd('0x17')](function(_0x11d72d){if(_0x11d72d){_0xadc0be[_0x9edd('0x4c')]=_['keys'](db[_0x9edd('0xd4')][_0x9edd('0x49')]);_0xadc0be[_0x9edd('0x4e')]=_['keys'](_0xd227fe[_0x9edd('0x4e')]);_0xadc0be['filters']=_[_0x9edd('0x50')](_0xadc0be['model'],_0xadc0be[_0x9edd('0x4e')]);_0x56a952[_0x9edd('0x52')]=_['intersection'](_0xadc0be[_0x9edd('0x4c')],qs[_0x9edd('0x51')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x56a952[_0x9edd('0x52')]=_0x56a952[_0x9edd('0x52')][_0x9edd('0x53')]?_0x56a952['attributes']:_0xadc0be[_0x9edd('0x4c')];if(!_0xd227fe[_0x9edd('0x4e')]['hasOwnProperty'](_0x9edd('0x55'))){_0x56a952['limit']=qs[_0x9edd('0x27')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x56a952[_0x9edd('0x25')]=qs[_0x9edd('0x25')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x25')]);}_0x56a952[_0x9edd('0x9c')]=qs[_0x9edd('0x56')](_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x56')]);_0x56a952[_0x9edd('0x57')]=qs['filters'](_['pick'](_0xd227fe[_0x9edd('0x4e')],_0xadc0be[_0x9edd('0x4f')]));_0x56a952[_0x9edd('0x57')][_0x9edd('0xbb')]=_0x11d72d['id'];if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x8f')]){_0x56a952[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x56a952[_0x9edd('0x57')],{'$or':_['map'](_0x56a952[_0x9edd('0x52')],function(_0x49181c){var _0x3ca64d={};_0x3ca64d[_0x49181c]={'$like':'%'+_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x8f')]+'%'};return _0x3ca64d;})});}if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x85')]){var _0x12561b=_0xd227fe[_0x9edd('0x4e')][_0x9edd('0x85')][_0x9edd('0x3a')](',');var _0x3fcbc0={};_0x3fcbc0[_0x12561b[0x0]]={'$gte':moment(_0x12561b[0x1])[_0x9edd('0xe8')](_0x9edd('0x107'))};_0x56a952[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x56a952[_0x9edd('0x57')],_0x3fcbc0);}_0x56a952=_[_0x9edd('0x2f')]({},_0x56a952,_0xd227fe[_0x9edd('0xc2')]);return db[_0x9edd('0xd4')][_0x9edd('0x28')]({'where':_0x56a952['where']})['then'](function(_0x33a86d){_0x300094['count']=_0x33a86d;if(_0xd227fe[_0x9edd('0x4e')][_0x9edd('0xc0')]){_0x56a952[_0x9edd('0xc1')]=[{'all':!![]}];}return db[_0x9edd('0xd4')]['findAll'](_0x56a952);})['then'](function(_0x593f45){_0x300094[_0x9edd('0xbd')]=_0x593f45;return _0x300094;});}})[_0x9edd('0x17')](respondWithFilteredResult(_0x106889,_0x56a952))[_0x9edd('0x3d')](handleError(_0x106889,null));};exports[_0x9edd('0x108')]=function(_0x51ac25,_0x4707b7){var _0x48f055={'where':{}},_0x43e9fa={},_0x2e260a={'count':0x0,'rows':[]};return db[_0x9edd('0x48')][_0x9edd('0xc5')]({'where':{'id':_0x51ac25['params']['id']}})['then'](handleEntityNotFound(_0x4707b7,null))['then'](function(_0x3bb205){if(_0x3bb205){_0x43e9fa[_0x9edd('0x4c')]=_[_0x9edd('0x4d')](db[_0x9edd('0xd4')][_0x9edd('0x49')]);_0x43e9fa[_0x9edd('0x4e')]=_['keys'](_0x51ac25[_0x9edd('0x4e')]);_0x43e9fa[_0x9edd('0x4f')]=_['intersection'](_0x43e9fa['model'],_0x43e9fa[_0x9edd('0x4e')]);_0x48f055[_0x9edd('0x52')]=_[_0x9edd('0x50')](_0x43e9fa['model'],qs[_0x9edd('0x51')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x51')]));_0x48f055[_0x9edd('0x52')]=_0x48f055['attributes'][_0x9edd('0x53')]?_0x48f055[_0x9edd('0x52')]:_0x43e9fa[_0x9edd('0x4c')];if(!_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x54')](_0x9edd('0x55'))){_0x48f055['limit']=qs[_0x9edd('0x27')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x27')]);_0x48f055[_0x9edd('0x25')]=qs['offset'](_0x51ac25['query'][_0x9edd('0x25')]);}_0x48f055[_0x9edd('0x9c')]=qs[_0x9edd('0x56')](_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x56')]);_0x48f055[_0x9edd('0x57')]=qs[_0x9edd('0x4f')](_[_0x9edd('0x58')](_0x51ac25[_0x9edd('0x4e')],_0x43e9fa[_0x9edd('0x4f')]));_0x48f055[_0x9edd('0x57')][_0x9edd('0xbb')]=_0x3bb205['id'];if(_0x51ac25['query']['filter']){_0x48f055[_0x9edd('0x57')]=_[_0x9edd('0x2f')](_0x48f055[_0x9edd('0x57')],{'$or':_[_0x9edd('0x36')](_0x48f055[_0x9edd('0x52')],function(_0x180c4d){var _0x425948={};_0x425948[_0x180c4d]={'$like':'%'+_0x51ac25[_0x9edd('0x4e')]['filter']+'%'};return _0x425948;})});}_0x48f055[_0x9edd('0x57')][_0x9edd('0xf7')]=![];if(_0x51ac25[_0x9edd('0x4e')]['id']){_0x48f055[_0x9edd('0x57')]['id']={'$gt':_0x51ac25[_0x9edd('0x4e')]['id']};}_0x48f055=_[_0x9edd('0x2f')]({},_0x48f055,_0x51ac25['options']);return db['ChatMessage'][_0x9edd('0x28')]({'where':_0x48f055[_0x9edd('0x57')]})[_0x9edd('0x17')](function(_0x50c328){_0x2e260a['count']=_0x50c328;_0x48f055[_0x9edd('0xc1')]=[];if(_0x51ac25[_0x9edd('0x4e')][_0x9edd('0x109')]){_0x48f055[_0x9edd('0xc1')][_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec'),'attributes':['id',_0x9edd('0x37'),_0x9edd('0x10a')]});}if(_0x51ac25[_0x9edd('0x4e')][_0x9edd('0xc0')]){_0x48f055['include']=[{'all':!![]}];}return db[_0x9edd('0xd4')]['findAll'](_0x48f055);})['then'](function(_0x58756b){_0x2e260a[_0x9edd('0xbd')]=_0x58756b;return _0x2e260a;});}})[_0x9edd('0x17')](respondWithFilteredResult(_0x4707b7,_0x48f055))['catch'](handleError(_0x4707b7,null));};exports['addTags']=function(_0x5e721c,_0x47d20b){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x5e721c[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x47d20b,null))[_0x9edd('0x17')](function(_0x2f99ac){if(_0x2f99ac){return _0x2f99ac[_0x9edd('0x10b')](_0x5e721c[_0x9edd('0x30')][_0x9edd('0x104')],_['omit'](_0x5e721c[_0x9edd('0x30')],['ids','id'])||{})[_0x9edd('0x10c')](function(){return db['Tag'][_0x9edd('0x10d')]({'attributes':['id',_0x9edd('0x2c'),_0x9edd('0x5b')],'where':{'id':_0x5e721c['body'][_0x9edd('0x104')]}});})[_0x9edd('0x17')](function(_0x3e2fc7){socket['emit']('chatInteractionTags:save',{'id':Number(_0x5e721c[_0x9edd('0xbf')]['id']),'tags':_0x3e2fc7||[]});return{'id':Number(_0x5e721c[_0x9edd('0xbf')]['id']),'tags':_0x3e2fc7||[]};});}})[_0x9edd('0x17')](respondWithResult(_0x47d20b,null))[_0x9edd('0x3d')](handleError(_0x47d20b,null));};exports[_0x9edd('0x10e')]=function(_0x83693e,_0x4308a2){return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x83693e[_0x9edd('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4308a2,null))[_0x9edd('0x17')](function(_0x276a53){if(_0x276a53){return _0x276a53['removeTags'](_0x83693e['query'][_0x9edd('0x104')]);}})[_0x9edd('0x17')](respondWithStatusCode(_0x4308a2,null))[_0x9edd('0x3d')](handleError(_0x4308a2,null));};exports[_0x9edd('0xe5')]=function(_0x5eec20,_0xc23db6){var _0x33a71d=moment()[_0x9edd('0x10f')]()[_0x9edd('0xa8')]();var _0x5d8749=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),'files',_0x9edd('0x111'));var _0x1e9806=path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),_0x9edd('0x112'),_0x9edd('0x113'));var _0x4fa1b2=path[_0x9edd('0xe4')](_0x5d8749,_0x33a71d);var _0x2c0620=util['format'](_0x9edd('0x114'),_0x5eec20['params']['id'],_0x33a71d);var _0x5a43af=path[_0x9edd('0xe4')](_0x5d8749,_0x2c0620);var _0x6018fd=[];_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0xec'),'attributes':['id',_0x9edd('0x37')],'raw':!![]});_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xd7')],'as':_0x9edd('0x115'),'attributes':['id',_0x9edd('0x116'),_0x9edd('0x117')],'raw':!![]});if(_0x5eec20['query']['attachments']){_0x6018fd[_0x9edd('0x3c')]({'model':db[_0x9edd('0xde')],'as':_0x9edd('0xde'),'raw':!![]});}var _0x3a2dad=[{'model':db[_0x9edd('0xd4')],'as':_0x9edd('0xeb'),'attributes':['id','body',_0x9edd('0x83'),_0x9edd('0x118'),_0x9edd('0xf7'),'read'],'include':_0x6018fd}];_0x3a2dad[_0x9edd('0x3c')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id','name']});_0x3a2dad[_0x9edd('0x3c')]({'model':db[_0x9edd('0xec')],'as':_0x9edd('0x119'),'attributes':['id',_0x9edd('0x37')]});return db[_0x9edd('0x48')][_0x9edd('0x6f')]({'where':{'id':_0x5eec20[_0x9edd('0xbf')]['id']},'include':_0x3a2dad})[_0x9edd('0x17')](handleEntityNotFound(_0xc23db6,null))[_0x9edd('0x17')](function(_0x5033e3){if(_0x5033e3){var _0x3a6ffa=_0x5033e3[_0x9edd('0x11a')]({'plain':!![]});fs['mkdirSync'](_0x4fa1b2);var _0x5d7461={'channel':_0x9edd('0x11b'),'account':_0x3a6ffa[_0x9edd('0x11c')]['name'],'agent':_0x3a6ffa[_0x9edd('0x119')]?_0x3a6ffa[_0x9edd('0x119')][_0x9edd('0x37')]:_0x9edd('0x11d'),'createdAt':moment(_0x3a6ffa['createdAt'])[_0x9edd('0xe8')](_0x9edd('0x107'))[_0x9edd('0xa8')](),'closedAt':_0x3a6ffa['closed']?moment(_0x3a6ffa[_0x9edd('0x11e')])[_0x9edd('0xe8')](_0x9edd('0x107'))[_0x9edd('0xa8')]():'','disposition':_0x3a6ffa[_0x9edd('0x44')],'chatInfo':{'browser':_0x3a6ffa[_0x9edd('0x11f')],'os':_0x3a6ffa[_0x9edd('0x120')],'referer':_0x3a6ffa[_0x9edd('0x121')],'customerIp':_0x3a6ffa['customerIp'],'customerPort':_0x3a6ffa[_0x9edd('0x122')]?_0x3a6ffa[_0x9edd('0x122')]:_0x9edd('0x11d')},'messages':_(_0x3a6ffa[_0x9edd('0xeb')])[_0x9edd('0x123')]()[_0x9edd('0x8f')]({'secret':![]})[_0x9edd('0x36')](function(_0x57845c){if(_0x57845c[_0x9edd('0xde')]){var _0x55d8e1=path['join'](_0x1e9806,_0x57845c[_0x9edd('0xde')][_0x9edd('0x124')]);if(fs['existsSync'](_0x55d8e1)){fs[_0x9edd('0x125')](_0x55d8e1)[_0x9edd('0x126')](fs[_0x9edd('0x127')](path['join'](_0x4fa1b2,_0x57845c['Attachment'][_0x9edd('0x124')])));}}return{'date':moment(_0x57845c[_0x9edd('0x83')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9edd('0xa8')](),'sender':_0x57845c[_0x9edd('0x118')]===_0x9edd('0x128')?_0x57845c[_0x9edd('0xec')]?_0x57845c['User']['fullname']:_0x9edd('0xf0'):_0x57845c[_0x9edd('0x115')]['firstName']+(_0x57845c[_0x9edd('0x115')]['lastName']?'\x20'+_0x57845c[_0x9edd('0x115')][_0x9edd('0x117')]:''),'body':_0x57845c[_0x9edd('0xde')]?_0x57845c[_0x9edd('0xde')]['basename']:_0x57845c[_0x9edd('0x30')],'direction':_0x57845c[_0x9edd('0x118')]==='out'?'A':'C','secret':_0x57845c[_0x9edd('0xf7')],'read':_0x57845c['read'],'attachment':_0x57845c[_0x9edd('0xde')]};})[_0x9edd('0x76')]()};return ejs[_0x9edd('0x129')](path[_0x9edd('0xe4')](config[_0x9edd('0xe1')],_0x9edd('0x110'),'views',_0x9edd('0x12a')),{'interaction':_0x5d7461})[_0x9edd('0x17')](function(_0x268088){var _0x3aa372=path[_0x9edd('0xe4')](_0x4fa1b2,_0x9edd('0x12b')+_0x3a6ffa['id']+'-'+_0x33a71d+_0x9edd('0x12c'));var _0x299444={'path':_0x3aa372,'channel':_0x9edd('0x11b'),'interactionId':_0x3a6ffa['id']};return pdf[_0x9edd('0x12d')](_0x268088,_0x299444);})['then'](function(){return new Promise(function(_0x2b7c53,_0x62b689){zipdir(_0x4fa1b2,{'saveTo':_0x5a43af},function(_0x319670,_0x108640){if(_0x319670)return _0x62b689(_0x319670);return _0x2b7c53(_0x108640);});})[_0x9edd('0x17')](function(){return new BPromise(function(_0x350ae2,_0x202f59){rimraf(_0x4fa1b2,function(_0x2f5a6e){if(_0x2f5a6e)_0x202f59(_0x2f5a6e);return _0x350ae2();});});})[_0x9edd('0x17')](function(){return _0xc23db6[_0x9edd('0xe5')](_0x5a43af,_0x2c0620,function(_0x142052){if(_0x142052){logger[_0x9edd('0x1e')](_0x9edd('0x12e'),_0x142052);}else{fs[_0x9edd('0x12f')](_0x5a43af);}});});});}else{return _0xc23db6[_0x9edd('0x21')](0xc8);}})['catch'](handleError(_0xc23db6,null));}; \ No newline at end of file +var _0x5c12=['Interaction\x20already\x20assigned','disposition','AbandonInteraction','basename','file','filename','mimetype','Attachment','attachmentDownload','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','User','Messages','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','spread','Tag','emit','removeTags','server','files','tmp','transcript-%d-%s.zip','Contact','firstName','attachments','Owner','Account','browserName','referer','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','lastName','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','send','merge','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','answered','unmanaged','total','UserId','waiting','closed','abandoned','talking','index','ChatInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','field','color','from','select','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','`\x20=\x200','having','`\x20>\x200','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','start','buildExpression','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','toString','keyBy','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found'];(function(_0x26790e,_0x4c09e8){var _0x17b987=function(_0x27db37){while(--_0x27db37){_0x26790e['push'](_0x26790e['shift']());}};_0x17b987(++_0x4c09e8);}(_0x5c12,0x188));var _0x25c1=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x5c12[_0x460666];return _0x555cbf;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x25c1('0x0'));var rp=require(_0x25c1('0x1'));var moment=require('moment');var BPromise=require(_0x25c1('0x2'));var Mustache=require(_0x25c1('0x3'));var util=require(_0x25c1('0x4'));var path=require(_0x25c1('0x5'));var ejs=require(_0x25c1('0x6'));var fs=require('fs');var _=require(_0x25c1('0x7'));var squel=require(_0x25c1('0x8'));var Redis=require('ioredis');var qs=require(_0x25c1('0x9'));var as=require(_0x25c1('0xa'));var pdf=require(_0x25c1('0xb'));var logger=require('../../config/logger')('api');var config=require(_0x25c1('0xc'));var db=require(_0x25c1('0xd'))['db'];config[_0x25c1('0xe')]=_[_0x25c1('0xf')](config[_0x25c1('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x25c1('0x10'))(new Redis(config[_0x25c1('0xe')]));require(_0x25c1('0x11'))[_0x25c1('0x12')](socket);var jayson=require(_0x25c1('0x13'));var client=jayson['client'][_0x25c1('0x14')]({'port':0x232b});var client9004=jayson[_0x25c1('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x256ecd,_0x209af5,_0x323d3c,_0x329ba9){return new BPromise(function(_0x5d3d11,_0x569ef9){var _0x4ef5d7=_0x329ba9||client;return _0x4ef5d7['request'](_0x256ecd,_0x323d3c)[_0x25c1('0x16')](function(_0x1412ed){logger[_0x25c1('0x17')](_0x25c1('0x18'),_0x209af5,_0x25c1('0x19'));logger['debug'](_0x25c1('0x1a'),_0x209af5,'request\x20sent',JSON['stringify'](_0x1412ed));if(_0x1412ed['error']){if(_0x1412ed[_0x25c1('0x1b')][_0x25c1('0x1c')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x209af5,_0x1412ed[_0x25c1('0x1b')]['message']);return _0x569ef9(_0x1412ed[_0x25c1('0x1b')][_0x25c1('0x1d')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x209af5,_0x1412ed['error'][_0x25c1('0x1d')]);return _0x5d3d11(_0x1412ed[_0x25c1('0x1b')][_0x25c1('0x1d')]);}else{logger[_0x25c1('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x209af5,_0x25c1('0x19'));_0x5d3d11(_0x1412ed[_0x25c1('0x1e')][_0x25c1('0x1d')]);}})[_0x25c1('0x1f')](function(_0x517a46){logger['error'](_0x25c1('0x18'),_0x209af5,_0x517a46);_0x569ef9(_0x517a46);});});}function respondWithStatusCode(_0xac3335,_0x396ed5){_0x396ed5=_0x396ed5||0xcc;return function(_0x1c61e7){if(_0x1c61e7){return _0xac3335[_0x25c1('0x20')](_0x396ed5);}return _0xac3335[_0x25c1('0x21')](_0x396ed5)[_0x25c1('0x22')]();};}function respondWithResult(_0x324ea9,_0x14ffd9){_0x14ffd9=_0x14ffd9||0xc8;return function(_0x261604){if(_0x261604){return _0x324ea9[_0x25c1('0x21')](_0x14ffd9)[_0x25c1('0x23')](_0x261604);}};}function respondWithFilteredResult(_0x399d72,_0x4915cc){return function(_0x2dadae){if(_0x2dadae){var _0x20dbb9=typeof _0x4915cc[_0x25c1('0x24')]===_0x25c1('0x25')&&typeof _0x4915cc[_0x25c1('0x26')]===_0x25c1('0x25');var _0x5ad776=_0x2dadae[_0x25c1('0x27')];var _0x428ce8=_0x20dbb9?0x0:_0x4915cc[_0x25c1('0x24')];var _0x38c1d5=_0x20dbb9?_0x2dadae[_0x25c1('0x27')]:_0x4915cc[_0x25c1('0x24')]+_0x4915cc['limit'];var _0x1e498;if(_0x38c1d5>=_0x5ad776){_0x38c1d5=_0x5ad776;_0x1e498=0xc8;}else{_0x1e498=0xce;}_0x399d72['status'](_0x1e498);return _0x399d72[_0x25c1('0x28')](_0x25c1('0x29'),_0x428ce8+'-'+_0x38c1d5+'/'+_0x5ad776)[_0x25c1('0x23')](_0x2dadae);}return null;};}function saveUpdates(_0x41bc82){return function(_0x2e80b5){if(_0x2e80b5){return _0x2e80b5[_0x25c1('0x2a')](_0x41bc82)[_0x25c1('0x16')](function(_0x23f2f6){return _0x23f2f6;});}return null;};}function removeEntity(_0x402f32){return function(_0x4d9882){if(_0x4d9882){return _0x4d9882[_0x25c1('0x2b')]()['then'](function(){_0x402f32['status'](0xcc)[_0x25c1('0x22')]();});}};}function handleEntityNotFound(_0x1dc3a7){return function(_0x4ef790){if(!_0x4ef790){_0x1dc3a7[_0x25c1('0x20')](0x194);}return _0x4ef790;};}function handleError(_0x5a5a32,_0x3bfcff){_0x3bfcff=_0x3bfcff||0x1f4;return function(_0x4834b3){logger[_0x25c1('0x1b')](_0x4834b3[_0x25c1('0x2c')]);if(_0x4834b3[_0x25c1('0x2d')]){delete _0x4834b3[_0x25c1('0x2d')];}_0x5a5a32[_0x25c1('0x21')](_0x3bfcff)[_0x25c1('0x2e')](_0x4834b3);};}function getMustacheRender(_0x461d23,_0x167477){return Mustache['render'](_0x461d23,_[_0x25c1('0x2f')](_0x167477['body'],{'contact':_0x167477[_0x25c1('0x30')],'message':_0x167477['message'],'agent':_0x167477[_0x25c1('0x31')],'interaction':_0x167477[_0x25c1('0x32')],'account':_0x167477[_0x25c1('0x33')]}))||'';}function getInteractionUsers(_0x2f86de,_0x390083){return new BPromise(function(_0x92184a,_0x35e632){try{if(_0x390083[_0x2f86de['id']]){_0x2f86de[_0x25c1('0x34')]=_[_0x25c1('0x35')](_0x390083[_0x2f86de['id']],function(_0x2d060c){return{'id':_0x2d060c['id'],'fullname':_0x2d060c[_0x25c1('0x36')]};});}}catch(_0x3f02f2){_0x35e632(_0x3f02f2);}_0x92184a(_0x2f86de);});}function getInteractionTags(_0x1041a3,_0x1b6e92){return new BPromise(function(_0x266f3b,_0x14288b){try{if(_0x1041a3[_0x25c1('0x37')]){_0x1041a3[_0x25c1('0x38')]=[];_0x1041a3[_0x25c1('0x37')][_0x25c1('0x39')](',')['forEach'](function(_0x32cc49){_0x1041a3[_0x25c1('0x38')]['push'](_0x1b6e92[_0x32cc49]);});}delete _0x1041a3[_0x25c1('0x37')];}catch(_0x5eca99){_0x14288b(_0x5eca99);}_0x266f3b(_0x1041a3);});}function updateChatInteraction(_0x32b3a4,_0x4f978c,_0x4326fb){return new BPromise(function(_0x3aca68,_0x1cf0b8){return getInteractionUsers(_0x32b3a4,_0x4326fb)[_0x25c1('0x16')](function(_0xbc20a3){return getInteractionTags(_0xbc20a3,_0x4f978c);})['then'](function(_0x1fe6d7){return getStateInteraction(_0x1fe6d7);})['then'](function(_0x1d9940){_0x3aca68(_0x1d9940);})[_0x25c1('0x1f')](function(_0x6d588a){_0x1cf0b8(_0x6d588a);});});}function getStateInteraction(_0x17fc23){return new BPromise(function(_0x57c65a){_0x17fc23['waiting']=0x0;_0x17fc23['talking']=0x0;_0x17fc23[_0x25c1('0x3a')]=0x0;_0x17fc23[_0x25c1('0x3b')]=0x0;_0x17fc23['abandoned']=0x0;_0x17fc23[_0x25c1('0x3c')]=0x0;if(!_0x17fc23['closed']&&!_0x17fc23[_0x25c1('0x3d')]){_0x17fc23[_0x25c1('0x3e')]+=0x1;}if(!_0x17fc23[_0x25c1('0x3f')]&&_0x17fc23['UserId']){_0x17fc23['talking']+=0x1;if(_0x17fc23['waiting']){_0x17fc23[_0x25c1('0x3e')]-=0x1;}}if(_0x17fc23[_0x25c1('0x3f')]&&_0x17fc23['disposition']===_0x25c1('0x40')){_0x17fc23[_0x25c1('0x40')]+=0x1;if(_0x17fc23[_0x25c1('0x3e')]){_0x17fc23['waiting']-=0x1;}}else if(_0x17fc23['closed']&&!_0x17fc23['UserId']&&_0x17fc23['disposition']){_0x17fc23[_0x25c1('0x3b')]+=0x1;if(_0x17fc23[_0x25c1('0x3e')]){_0x17fc23['waiting']-=0x1;}}else if(_0x17fc23[_0x25c1('0x3f')]&&_0x17fc23[_0x25c1('0x3d')]){_0x17fc23[_0x25c1('0x3a')]+=0x1;if(_0x17fc23[_0x25c1('0x41')]){_0x17fc23[_0x25c1('0x41')]-=0x1;}}_0x17fc23[_0x25c1('0x3c')]+=0x1;_0x57c65a(_0x17fc23);});}exports[_0x25c1('0x42')]=function(_0x552174,_0x545934){var _0x28fc89={},_0x43d96a={},_0x389547={'count':0x0,'rows':[]};var _0x4bed0a=_[_0x25c1('0x35')](db[_0x25c1('0x43')][_0x25c1('0x44')],function(_0xa009d1){return{'name':_0xa009d1['fieldName'],'type':_0xa009d1[_0x25c1('0x45')][_0x25c1('0x46')]};});_0x43d96a[_0x25c1('0x47')]=_[_0x25c1('0x35')](_0x4bed0a,'name');_0x43d96a['query']=_[_0x25c1('0x48')](_0x552174[_0x25c1('0x49')]);_0x43d96a[_0x25c1('0x4a')]=_[_0x25c1('0x4b')](_0x43d96a['model'],_0x43d96a[_0x25c1('0x49')]);_0x28fc89[_0x25c1('0x4c')]=_['intersection'](_0x43d96a[_0x25c1('0x47')],qs[_0x25c1('0x4d')](_0x552174[_0x25c1('0x49')][_0x25c1('0x4d')]));_0x28fc89['attributes']=_0x28fc89['attributes'][_0x25c1('0x4e')]?_0x28fc89[_0x25c1('0x4c')]:_0x43d96a[_0x25c1('0x47')];if(!_0x552174['query'][_0x25c1('0x4f')](_0x25c1('0x50'))){_0x28fc89['limit']=qs[_0x25c1('0x26')](_0x552174[_0x25c1('0x49')][_0x25c1('0x26')]);_0x28fc89[_0x25c1('0x24')]=qs[_0x25c1('0x24')](_0x552174[_0x25c1('0x49')][_0x25c1('0x24')]);}_0x28fc89['order']=qs['sort'](_0x552174['query'][_0x25c1('0x51')]);_0x28fc89['where']=qs[_0x25c1('0x4a')](_[_0x25c1('0x52')](_0x552174[_0x25c1('0x49')],_0x43d96a[_0x25c1('0x4a')]),_0x4bed0a);var _0x40fe57=[];var _0x1b72e5=squel['select']()[_0x25c1('0x53')]('id')[_0x25c1('0x53')](_0x25c1('0x2d'))[_0x25c1('0x53')](_0x25c1('0x54'))[_0x25c1('0x55')]('tools_tags');var _0x411c5c=squel[_0x25c1('0x56')]()[_0x25c1('0x53')](_0x25c1('0x57'))[_0x25c1('0x53')]('u.fullname')[_0x25c1('0x53')](_0x25c1('0x58'))['from'](_0x25c1('0x59'),'ui')[_0x25c1('0x5a')](_0x25c1('0x5b'),'u',_0x25c1('0x5c'));var _0x30ca5d=squel[_0x25c1('0x56')]()['from'](_0x25c1('0x5d'),'i')[_0x25c1('0x5a')](_0x25c1('0x5e'),'c',_0x25c1('0x5f'))[_0x25c1('0x5a')](_0x25c1('0x5b'),'o',_0x25c1('0x60'))[_0x25c1('0x5a')](_0x25c1('0x61'),'a',_0x25c1('0x62'))[_0x25c1('0x5a')](_0x25c1('0x63'),'me',_0x25c1('0x64'))[_0x25c1('0x5a')]('chat_interaction_has_tags','it',_0x25c1('0x65'))[_0x25c1('0x5a')](_0x25c1('0x66'),'t',_0x25c1('0x67'));var _0x3d3ea2=squel[_0x25c1('0x68')]();var _0xb3cbfc=[];var _0x5c3124=squel[_0x25c1('0x68')]();var _0x571d1a;if(_0x552174[_0x25c1('0x49')][_0x25c1('0x69')]){_0x571d1a=as[_0x25c1('0x6a')](_0x552174[_0x25c1('0x49')][_0x25c1('0x69')]);var _0x23ba04=_0x571d1a[_0x25c1('0x6b')];for(var _0x19df83=0x0;_0x19df83<_0x571d1a['conditions'][_0x25c1('0x4e')];_0x19df83++){var _0xa65e9e=_0x571d1a[_0x25c1('0x6c')][_0x19df83];var _0x2a7f35='i';var _0xa41216=_[_0x25c1('0x6d')](_0x4bed0a,[_0x25c1('0x2d'),_0xa65e9e['field']]);if(!_0xa41216){switch(_0xa65e9e[_0x25c1('0x53')]){case'unreadMessages':if(_0xa65e9e['value']==0x1){_0x30ca5d['having']('`'+_0xa65e9e[_0x25c1('0x53')]+_0x25c1('0x6e'));}else{_0x30ca5d[_0x25c1('0x6f')]('`'+_0xa65e9e[_0x25c1('0x53')]+_0x25c1('0x70'));}break;case'Contact':if(_0xa65e9e[_0x25c1('0x71')]==='$substring'){if(_0xa65e9e[_0x25c1('0x72')][_0x25c1('0x39')]('\x20')[_0x25c1('0x4e')]>0x1){_0x3d3ea2[_0x23ba04](_0x25c1('0x73'),qs[_0x25c1('0x74')](_0xa65e9e[_0x25c1('0x72')]),null);}else{var _0x11bdc4='%'+_0xa65e9e['value']+'%';_0x3d3ea2[_0x23ba04](_0x25c1('0x75'),_0x11bdc4,_0x11bdc4,_0x11bdc4);}}else{_0xa41216=_[_0x25c1('0x6d')](_0x4bed0a,[_0x25c1('0x2d'),_0x25c1('0x76')]);_0xa65e9e[_0x25c1('0x53')]=_0x25c1('0x76');_0x55efcf=as['buildExpression'](_0x2a7f35,_0xa41216[_0x25c1('0x45')],_0xa65e9e);_0x3d3ea2[_0x23ba04](_0x55efcf['text'],_0x55efcf[_0x25c1('0x72')]['start'],_0x55efcf['value'][_0x25c1('0x22')]);}break;case'Tag':var _0x56929c=_0xa65e9e['value']['split'](',')[_0x25c1('0x35')](function(_0x5244f9){return Number(_0x5244f9);});_0x56929c[_0x25c1('0x77')](function(_0x17dd76){_0x5c3124['or'](_0x25c1('0x78'),'%,'+_0x17dd76+',%');});_0xb3cbfc=_[_0x25c1('0x79')](_0xb3cbfc,_0x56929c);break;case'User':if(_0xa65e9e['operator']===_0x25c1('0x7a')){_0x3d3ea2[_0x23ba04](_0x25c1('0x7b'),'%'+_0xa65e9e['value']+'%',null);}else{_0xa41216=_[_0x25c1('0x6d')](_0x4bed0a,[_0x25c1('0x2d'),_0x25c1('0x3d')]);_0xa65e9e['field']=_0x25c1('0x3d');_0x55efcf=as['buildExpression'](_0x2a7f35,_0xa41216[_0x25c1('0x45')],_0xa65e9e);_0x3d3ea2[_0x23ba04](_0x55efcf[_0x25c1('0x7c')],_0x55efcf[_0x25c1('0x72')]['start'],_0x55efcf[_0x25c1('0x72')][_0x25c1('0x22')]);}break;case _0x25c1('0x7d'):_0x55efcf=as['buildExpression']('me',null,_0xa65e9e);_0x3d3ea2[_0x23ba04](_0x55efcf[_0x25c1('0x7c')],_0x55efcf[_0x25c1('0x72')][_0x25c1('0x7e')],_0x55efcf[_0x25c1('0x72')][_0x25c1('0x22')]);break;}}else{var _0x55efcf=as[_0x25c1('0x7f')](_0x2a7f35,_0xa41216[_0x25c1('0x45')],_0xa65e9e);_0x3d3ea2[_0x23ba04](_0x55efcf[_0x25c1('0x7c')],_0x55efcf[_0x25c1('0x72')][_0x25c1('0x7e')],_0x55efcf[_0x25c1('0x72')][_0x25c1('0x22')]);}}}else{var _0x14bfa4=_(_0x552174['query'])[_0x25c1('0x48')]()[_0x25c1('0x35')](function(_0x138376){return _[_0x25c1('0x80')](_0x4bed0a,[_0x25c1('0x2d'),_0x138376])?_0x138376:undefined;})[_0x25c1('0x81')]()[_0x25c1('0x72')]();if(!_[_0x25c1('0x82')](_0x14bfa4)){_0x14bfa4[_0x25c1('0x77')](function(_0x46de21){if(_0x46de21===_0x25c1('0x83')){_0x30ca5d['where'](_0x25c1('0x84'),[]['concat'](_0x552174[_0x25c1('0x49')][_0x46de21]));}else if(_0x46de21===_0x25c1('0x85')){var _0x593e17=JSON[_0x25c1('0x86')](_0x552174[_0x25c1('0x49')][_0x46de21])[_0x25c1('0x87')];var _0x48fc08=JSON[_0x25c1('0x86')](_0x552174[_0x25c1('0x49')][_0x46de21])['$lte'];_0x30ca5d[_0x25c1('0x88')](_0x25c1('0x89'),_0x593e17,_0x48fc08);}else{if(_0x552174[_0x25c1('0x49')][_0x46de21]==='null'){_0x30ca5d[_0x25c1('0x88')]('i.'+_0x46de21+_0x25c1('0x8a'));}else{_0x30ca5d[_0x25c1('0x88')]('i.'+_0x46de21+_0x25c1('0x8b'),_0x552174['query'][_0x46de21]);}}});}if(_0x552174[_0x25c1('0x49')]['read']){if(_0x552174[_0x25c1('0x49')][_0x25c1('0x8c')]==0x1){_0x30ca5d['having'](_0x25c1('0x8d'));}else{_0x30ca5d['having'](_0x25c1('0x8e'));}}if(_0x552174[_0x25c1('0x49')][_0x25c1('0x8f')]){_0xb3cbfc=_[_0x25c1('0x90')](_0x552174[_0x25c1('0x49')][_0x25c1('0x8f')])?_0x552174[_0x25c1('0x49')]['tag']:new Array(_0x552174['query'][_0x25c1('0x8f')]);_0xb3cbfc[_0x25c1('0x77')](function(_0x5c867e){_0x5c3124['or'](_0x25c1('0x78'),'%,'+_0x5c867e+',%');});}if(_0x552174[_0x25c1('0x49')][_0x25c1('0x91')]){var _0x483bdd=_0x552174['query'][_0x25c1('0x91')]['replace']('\x5c','\x5c\x5c')[_0x25c1('0x92')](/'/g,'\x27\x27');if(qs[_0x25c1('0x93')](_0x483bdd)){_0x3d3ea2['or'](_0x25c1('0x94'),_0x483bdd+'%');}else{_0x3d3ea2['or'](_0x25c1('0x95'),qs['getFullTextValue'](_0x483bdd))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x483bdd+'%');}}}_0x30ca5d[_0x25c1('0x88')](_0x3d3ea2);_0x30ca5d['group'](_0x25c1('0x96'));var _0x77b14a={'type':db[_0x25c1('0x97')]['QueryTypes'][_0x25c1('0x98')],'raw':!![]};var _0x116743=_0x30ca5d[_0x25c1('0x99')]();_0x116743[_0x25c1('0x53')](_0x25c1('0x96'));_0x116743[_0x25c1('0x53')](_0x25c1('0x9a'),_0x25c1('0x9b'));if(_0x28fc89[_0x25c1('0x9c')]){_0x28fc89[_0x25c1('0x9c')][_0x25c1('0x77')](function(_0x512da8){var _0x2fba76=_0x512da8[0x0]==='contactName'?_0x512da8[0x0]:'i.'+_0x512da8[0x0];_0x30ca5d[_0x25c1('0x9c')](_0x2fba76,_0x512da8[0x1]===_0x25c1('0x9d')?![]:!![]);});}if(!_[_0x25c1('0x82')](_0xb3cbfc)){_0x30ca5d[_0x25c1('0x6f')](_0x5c3124);_0x116743[_0x25c1('0x88')](_0x25c1('0x9e'),_0xb3cbfc);}BPromise[_0x25c1('0x9f')]()['then'](function(){if(!_0x571d1a){if(_0x552174['query'][_0x25c1('0x83')])return;_0x116743['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x30ca5d[_0x25c1('0x88')](_0x25c1('0xa0'));return;}if(_0x552174[_0x25c1('0xa1')][_0x25c1('0xa2')]!==_0x25c1('0x31'))return;return _0x552174[_0x25c1('0xa1')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x25c1('0x16')](function(_0xfcfe5){if(_[_0x25c1('0x82')](_0xfcfe5)){_0x116743[_0x25c1('0x88')]('i.ChatWebsiteId\x20IS\x20NULL');_0x30ca5d[_0x25c1('0x88')](_0x25c1('0xa3'));}else{_0x116743[_0x25c1('0x88')](_0x25c1('0x84'),_['map'](_0xfcfe5,'id'));_0x30ca5d[_0x25c1('0x88')](_0x25c1('0x84'),_[_0x25c1('0x35')](_0xfcfe5,'id'));}});})[_0x25c1('0x16')](function(){if(_0x552174[_0x25c1('0xa1')]['role']===_0x25c1('0x31')&&!_0x571d1a&&!_0x552174['query'][_0x25c1('0x83')])return[];return db['sequelize'][_0x25c1('0x49')](_0x116743[_0x25c1('0xa4')](),_0x77b14a);})[_0x25c1('0x16')](function(_0x4bc48f){_0x389547[_0x25c1('0x27')]=_0x4bc48f['length'];if(_0x389547[_0x25c1('0x27')]===0x0)return[];return db['sequelize'][_0x25c1('0x49')](_0x1b72e5[_0x25c1('0xa4')](),_0x77b14a)[_0x25c1('0x16')](function(_0x137725){_0x40fe57=_[_0x25c1('0xa5')](_0x137725,'id');_0x77b14a=_[_0x25c1('0x2f')](_0x77b14a,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x552174[_0x25c1('0x49')][_0x25c1('0x4d')]){_0x28fc89[_0x25c1('0x4c')]['forEach'](function(_0x5d93ab){_0x30ca5d[_0x25c1('0x53')]('i.'+_0x5d93ab);});}else{_0x30ca5d[_0x25c1('0x53')](_0x25c1('0x9a'),_0x25c1('0x9b'));_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xa6'),_0x25c1('0xa7'));_0x30ca5d['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x30ca5d['field'](_0x25c1('0xa8'),_0x25c1('0xa9'));_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xaa'));_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xab'),_0x25c1('0xac'));_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xad'),_0x25c1('0xae'));_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xaf'),_0x25c1('0xb0'));_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xb1'),'Contact.phone');_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xb2'),'Contact.mobile');_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xb3'),'Contact.fax');_0x30ca5d['field']('o.fullname','Owner.fullname');_0x30ca5d[_0x25c1('0x53')](_0x25c1('0xb4'),_0x25c1('0xb5'));_0x30ca5d['field'](_0x25c1('0xb6'),_0x25c1('0x37'));}if(_0x28fc89[_0x25c1('0x26')])_0x30ca5d['limit'](_0x28fc89[_0x25c1('0x26')]);if(_0x28fc89[_0x25c1('0x24')])_0x30ca5d['offset'](_0x28fc89[_0x25c1('0x24')]);return db[_0x25c1('0xb7')][_0x25c1('0x49')](_0x30ca5d[_0x25c1('0xa4')](),_0x77b14a);})[_0x25c1('0x16')](function(_0x47d354){if(_0x47d354[_0x25c1('0x4e')]>0x0)_0x411c5c[_0x25c1('0x88')]('ui.ChatInteractionId\x20IN\x20?',_[_0x25c1('0x35')](_0x47d354,'id'));return db[_0x25c1('0xb7')][_0x25c1('0x49')](_0x411c5c[_0x25c1('0xa4')](),_0x77b14a)[_0x25c1('0x16')](function(_0x14196d){var _0x12247b=_[_0x25c1('0xb8')](_0x14196d,_0x25c1('0xb9'));var _0x589b20=[];_0x47d354[_0x25c1('0x77')](function(_0x30a6d8){_0x589b20[_0x25c1('0xba')](updateChatInteraction(_0x30a6d8,_0x40fe57,_0x12247b));});return BPromise[_0x25c1('0xbb')](_0x589b20);});});})['then'](function(_0x2dcbb8){_0x389547[_0x25c1('0xbc')]=_0x2dcbb8;return _0x389547;})[_0x25c1('0x16')](respondWithFilteredResult(_0x545934,_0x28fc89))[_0x25c1('0x1f')](handleError(_0x545934,null));};exports[_0x25c1('0xbd')]=function(_0x2fd02c,_0x1308a1){var _0x239b80={'raw':![],'where':{'id':_0x2fd02c[_0x25c1('0xbe')]['id']}},_0x49f697={};_0x49f697['model']=_[_0x25c1('0x48')](db[_0x25c1('0x43')][_0x25c1('0x44')]);_0x49f697[_0x25c1('0x49')]=_[_0x25c1('0x48')](_0x2fd02c[_0x25c1('0x49')]);_0x49f697['filters']=_[_0x25c1('0x4b')](_0x49f697[_0x25c1('0x47')],_0x49f697['query']);_0x239b80[_0x25c1('0x4c')]=_[_0x25c1('0x4b')](_0x49f697[_0x25c1('0x47')],qs[_0x25c1('0x4d')](_0x2fd02c[_0x25c1('0x49')][_0x25c1('0x4d')]));_0x239b80[_0x25c1('0x4c')]=_0x239b80[_0x25c1('0x4c')][_0x25c1('0x4e')]?_0x239b80[_0x25c1('0x4c')]:_0x49f697[_0x25c1('0x47')];if(_0x2fd02c['query'][_0x25c1('0xbf')]){_0x239b80[_0x25c1('0xc0')]=[{'all':!![]}];}_0x239b80=_['merge']({},_0x239b80,_0x2fd02c[_0x25c1('0xc1')]);return db[_0x25c1('0x43')][_0x25c1('0x6d')](_0x239b80)[_0x25c1('0x16')](handleEntityNotFound(_0x1308a1,null))[_0x25c1('0x16')](respondWithResult(_0x1308a1,null))[_0x25c1('0x1f')](handleError(_0x1308a1,null));};exports[_0x25c1('0xc2')]=function(_0x8e2b7b,_0x2d325d){return db[_0x25c1('0x43')]['create'](_0x8e2b7b[_0x25c1('0x7d')],{})['then'](respondWithResult(_0x2d325d,0xc9))[_0x25c1('0x1f')](handleError(_0x2d325d,null));};exports[_0x25c1('0x2a')]=function(_0x3d9c53,_0x3bf69f){if(_0x3d9c53['body']['id']){delete _0x3d9c53[_0x25c1('0x7d')]['id'];}return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x3d9c53[_0x25c1('0xbe')]['id']}})['then'](handleEntityNotFound(_0x3bf69f,null))['then'](saveUpdates(_0x3d9c53['body'],null))[_0x25c1('0x16')](respondWithResult(_0x3bf69f,null))[_0x25c1('0x1f')](handleError(_0x3bf69f,null));};exports[_0x25c1('0x2b')]=function(_0x423dbe,_0x1605f6){return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x423dbe['params']['id']}})[_0x25c1('0x16')](handleEntityNotFound(_0x1605f6,null))['then'](removeEntity(_0x1605f6,null))['catch'](handleError(_0x1605f6,null));};exports[_0x25c1('0xc3')]=function(_0x402557,_0x46f384){return db[_0x25c1('0x43')][_0x25c1('0xc3')]()[_0x25c1('0x16')](respondWithResult(_0x46f384,null))[_0x25c1('0x1f')](handleError(_0x46f384,null));};exports[_0x25c1('0xc4')]=function(_0x12bd96,_0x576a97){var _0x53259d=_0x12bd96['params']['id'];var _0x327119;var _0xff391d;var _0x59085d;return db[_0x25c1('0x43')][_0x25c1('0xc5')]({'where':{'id':_0x53259d}})['then'](function(_0x16a8e7){_0x327119=_0x16a8e7;return db[_0x25c1('0xc6')][_0x25c1('0xc5')]({'where':{'id':_0x16a8e7[_0x25c1('0x83')]},'attributes':['id',_0x25c1('0xc7'),_0x25c1('0xc8'),_0x25c1('0xc9'),_0x25c1('0xca'),_0x25c1('0xcb')],'raw':!![]});})[_0x25c1('0x16')](function(_0x483c05){if(_0x483c05&&_0x483c05[_0x25c1('0xc7')]&&_0x483c05[_0x25c1('0xc8')]){_0xff391d=_0x483c05;var _0x30bd45={'interaction':{'id':_0x53259d},'agent':{'id':_0x12bd96['user']['id'],'name':_0x12bd96[_0x25c1('0xa1')][_0x25c1('0x2d')],'fullname':_0x12bd96[_0x25c1('0xa1')]['fullname'],'email':_0x12bd96[_0x25c1('0xa1')][_0x25c1('0xcc')]},'contact':_0x12bd96[_0x25c1('0x7d')][_0x25c1('0x30')],'account':_0x12bd96[_0x25c1('0x7d')][_0x25c1('0x33')]};var _0x583cf4={'rejectUnauthorized':![],'method':_0x25c1('0xcd'),'url':_0x25c1('0xce'),'headers':{'X-APIKEY':_0x483c05[_0x25c1('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x12bd96[_0x25c1('0xa1')]['email']],'buttons':null,'topic':_0xff391d[_0x25c1('0xc9')],'note':_[_0x25c1('0xcf')](_0xff391d[_0x25c1('0xca')])?null:getMustacheRender(_0xff391d[_0x25c1('0xca')],_0x30bd45),'metadata':null},'redirect':_0x25c1('0xd0'),'json':!![]};try{if(!_[_0x25c1('0xcf')](_0xff391d[_0x25c1('0xcb')])){var _0x1665a2=getMustacheRender(_0xff391d[_0x25c1('0xcb')],_0x30bd45);var _0xe6283b=JSON['parse'](_0x1665a2);_0x583cf4[_0x25c1('0x7d')][_0x25c1('0xd1')]=_0xe6283b;}}catch(_0x2fa46e){throw new db[(_0x25c1('0x97'))][(_0x25c1('0xd2'))](_0x25c1('0xd3'));}return rp(_0x583cf4);}else{throw new db['Sequelize']['ValidationError'](_0x25c1('0xd4'));}})[_0x25c1('0x16')](function(_0x1f4965){_0x59085d=_0x1f4965;if(_0x59085d['id']){var _0x169c61={'body':_0x59085d[_0x25c1('0xd5')],'ChatWebsiteId':_0xff391d['id'],'ChatInteractionId':_0x327119['id'],'direction':_0x25c1('0xd6'),'UserId':_0x12bd96['user']['id']};return db['ChatMessage']['create'](_0x169c61,{});}else{throw new db[(_0x25c1('0x97'))][(_0x25c1('0xd2'))](_0x25c1('0xd7'));}})['then'](function(){return _0x327119[_0x25c1('0xd8')]({'vidaooSessionId':_0x59085d['id']});})[_0x25c1('0x16')](respondWithResult(_0x576a97,null))[_0x25c1('0x1f')](handleError(_0x576a97,null));};exports[_0x25c1('0xd9')]=function(_0x145fc4,_0x18829e){if(_0x145fc4[_0x25c1('0x7d')]['id']){delete _0x145fc4[_0x25c1('0x7d')]['id'];}return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x145fc4[_0x25c1('0xbe')]['id']},'include':[{'model':db[_0x25c1('0xda')],'as':'Contact'}]})[_0x25c1('0x16')](handleEntityNotFound(_0x18829e,null))[_0x25c1('0x16')](saveUpdates(_0x145fc4['body'],null))[_0x25c1('0x16')](respondWithResult(_0x18829e,null))[_0x25c1('0x1f')](handleError(_0x18829e,null));};exports[_0x25c1('0xdb')]=function(_0x28af6d,_0xd3bda4){if(_0x28af6d['body']['id']){delete _0x28af6d[_0x25c1('0x7d')]['id'];}return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x28af6d[_0x25c1('0xbe')]['id']}})['then'](function(_0x81d62f){if(!_0x81d62f){logger['error'](_0x25c1('0xdc'),_0x25c1('0xdb'),0x194,_0x25c1('0xdd'));_0xd3bda4['sendStatus'](0x194);}else{if(_0x81d62f[_0x25c1('0x3d')]){throw new db[(_0x25c1('0x97'))][(_0x25c1('0xd2'))](_0x25c1('0xde'));}}return _0x81d62f;})[_0x25c1('0x16')](function(_0x230f47){if(_0x230f47){return _0x230f47[_0x25c1('0x2a')]({'closed':_0x28af6d[_0x25c1('0x7d')][_0x25c1('0x3f')],'disposition':_0x28af6d['body'][_0x25c1('0xdf')]})[_0x25c1('0x16')](function(_0x3b5769){return _0x3b5769;});}})[_0x25c1('0x16')](function(){return respondWithRpcPromise(_0x25c1('0xe0'),'abandon',_0x28af6d[_0x25c1('0x7d')],client9004);})[_0x25c1('0x16')](respondWithResult(_0xd3bda4,null))[_0x25c1('0x1f')](handleError(_0xd3bda4,null));};exports['attachmentUpload']=function(_0xc6345a,_0x386a3d){_0xc6345a[_0x25c1('0x7d')]['name']=_0xc6345a['file']['originalname'];_0xc6345a[_0x25c1('0x7d')][_0x25c1('0xe1')]=_0xc6345a[_0x25c1('0xe2')][_0x25c1('0xe3')];_0xc6345a[_0x25c1('0x7d')][_0x25c1('0x45')]=_0xc6345a[_0x25c1('0xe2')][_0x25c1('0xe4')];return db[_0x25c1('0xe5')][_0x25c1('0xc2')](_0xc6345a[_0x25c1('0x7d')])['then'](respondWithResult(_0x386a3d,0xc9))['catch'](handleError(_0x386a3d,null));};exports[_0x25c1('0xe6')]=function(_0x39306b,_0x17d6dd){return db[_0x25c1('0x43')][_0x25c1('0xc5')]({'where':{'id':_0x39306b['params']['id']},'raw':!![]})[_0x25c1('0x16')](handleEntityNotFound(_0x17d6dd,null))['then'](function(_0x3a9e3b){if(_0x3a9e3b){if(_0x3a9e3b[_0x25c1('0x3f')]){return _0x17d6dd[_0x25c1('0x21')](0x193)[_0x25c1('0x23')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x25c1('0xc5')]({'where':{'id':_0x39306b[_0x25c1('0x49')][_0x25c1('0xe7')]},'raw':!![]})['then'](handleEntityNotFound(_0x17d6dd,null));}})['then'](function(_0x2b0c7f){if(_0x2b0c7f){var _0xd9acda=_0x2b0c7f['ChatOfflineMessageId']!==null;var _0x177463=path[_0x25c1('0xe8')](config[_0x25c1('0xe9')],_0x25c1('0xea'));if(_0xd9acda){_0x177463=path[_0x25c1('0xe8')](_0x177463,_0x25c1('0xeb'));}var _0x28af2d=path[_0x25c1('0xe8')](_0x177463,_0x2b0c7f[_0x25c1('0xe1')]);return _0x17d6dd[_0x25c1('0xec')](_0x28af2d);}})[_0x25c1('0x1f')](handleError(_0x17d6dd,null));};exports[_0x25c1('0xed')]=function(_0x1f53c3,_0x2f71f6){var _0x5c6bbb=null;var _0x38e111=null;var _0x20d482=null;if(_0x1f53c3['body']['id']){delete _0x1f53c3[_0x25c1('0x7d')]['id'];}if(_0x1f53c3['body'][_0x25c1('0xee')]){_0x20d482=path[_0x25c1('0xe8')](config['root'],_0x25c1('0xef'),util[_0x25c1('0xf0')](_0x25c1('0xf1'),Date[_0x25c1('0xf2')]()));_0x1f53c3[_0x25c1('0x7d')]['pathTranscript']=_0x20d482;}return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x1f53c3[_0x25c1('0xbe')]['id']},'include':[{'model':db[_0x25c1('0xf3')],'as':'Messages','include':[{'model':db[_0x25c1('0xf4')],'as':_0x25c1('0xf4')}]}]})[_0x25c1('0x16')](handleEntityNotFound(_0x2f71f6,null))['then'](saveUpdates(_0x1f53c3[_0x25c1('0x7d')],null))[_0x25c1('0x16')](function(_0x47288a){if(_0x47288a){_0x5c6bbb=_0x47288a;return db[_0x25c1('0xc6')][_0x25c1('0x6d')]({'where':{'id':_0x5c6bbb[_0x25c1('0x83')]}});}})[_0x25c1('0x16')](function(_0x7d1584){if(_0x7d1584){_0x38e111=_0x7d1584;return db['CmContact']['find']({'where':{'id':_0x5c6bbb['ContactId']}});}})[_0x25c1('0x16')](function(_0x93f06){if(_0x93f06){if(_0x20d482){var _0x9d24d2=null;for(var _0x529ea6=0x1;_0x529ea6<_0x5c6bbb[_0x25c1('0xf5')][_0x25c1('0x4e')];++_0x529ea6){_0x9d24d2=_0x5c6bbb[_0x25c1('0xf5')][_0x529ea6];var _0x412b5a=_0x9d24d2[_0x25c1('0x3d')]?util[_0x25c1('0xf0')](_0x25c1('0xf6'),_0x38e111['agentAlias'],_0x9d24d2[_0x25c1('0x3d')]):_0x25c1('0xf7');var _0x5679ab=_0x1f53c3[_0x25c1('0x7d')][_0x25c1('0xf8')]||util[_0x25c1('0xf0')](_0x25c1('0xf6'),_0x25c1('0xf9'),_0x9d24d2[_0x25c1('0x76')]);switch(_0x38e111[_0x25c1('0xfa')]){case _0x25c1('0xfb'):_0x412b5a=_0x9d24d2[_0x25c1('0x3d')]?util[_0x25c1('0xf0')](_0x25c1('0xf6'),_0x38e111[_0x25c1('0xfc')],_0x9d24d2[_0x25c1('0x3d')]):_0x25c1('0xf7');break;case _0x25c1('0xfd'):_0x412b5a=_0x9d24d2['UserId']?_0x9d24d2['User'][_0x25c1('0xfe')]||_0x9d24d2[_0x25c1('0xf4')]['fullname']:_0x25c1('0xf7');break;case _0x25c1('0xff'):_0x412b5a=_0x9d24d2[_0x25c1('0x3d')]?_0x9d24d2['User'][_0x25c1('0x36')]:_0x25c1('0xf7');break;default:_0x412b5a=_0x9d24d2[_0x25c1('0x3d')]?util[_0x25c1('0xf0')](_0x25c1('0xf6'),_0x38e111['agentAlias'],_0x9d24d2[_0x25c1('0x3d')]):_0x25c1('0xf7');}var _0x1c6686=util[_0x25c1('0xf0')]('[%s]\x20%s:\x20%s\x0a',moment(_0x9d24d2['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x9d24d2[_0x25c1('0x100')]==='in'?_0x5679ab:_0x412b5a,_0x9d24d2['body']);if(!_0x9d24d2[_0x25c1('0x101')]){fs['appendFileSync'](_0x20d482,_0x1c6686);}}return db[_0x25c1('0x102')][_0x25c1('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0x25c1('0x103')],'as':_0x25c1('0x104'),'raw':!![],'include':[{'model':db[_0x25c1('0x105')],'as':_0x25c1('0x105'),'raw':!![]}]}]});}}})[_0x25c1('0x16')](function(_0x4d07d4){if(!_0x4d07d4||!_0x4d07d4['Smtp']||!_0x1f53c3[_0x25c1('0x7d')])return _0x5c6bbb;var _0x474d22=_0x4d07d4[_0x25c1('0x106')]();return respondWithRpcPromise(_0x25c1('0x107'),_0x25c1('0x108'),{'account':_0x474d22,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4d07d4[_0x25c1('0x2d')],_0x4d07d4[_0x25c1('0xcc')]||_0x4d07d4[_0x25c1('0x104')][_0x25c1('0xa1')]),'to':_0x1f53c3[_0x25c1('0x7d')][_0x25c1('0xee')],'subject':_0x25c1('0x109'),'text':util[_0x25c1('0xf0')](_0x25c1('0x10a'),_0x1f53c3[_0x25c1('0x7d')][_0x25c1('0xee')]),'attachments':[{'path':_0x20d482}]}})[_0x25c1('0x16')](function(){return _0x5c6bbb;})['catch'](function(_0x30e70a){logger['error'](_0x30e70a);});})[_0x25c1('0x16')](respondWithStatusCode(_0x2f71f6,0xc8))[_0x25c1('0x1f')](handleError(_0x2f71f6,null));};exports[_0x25c1('0x10b')]=function(_0x10b2c0,_0x4fdca2){return db[_0x25c1('0xf3')]['find']({'where':{'id':_0x10b2c0['params']['id']}})[_0x25c1('0x16')](handleEntityNotFound(_0x4fdca2,null))[_0x25c1('0x16')](function(_0x567ea4){if(_0x567ea4){return _0x567ea4['addMessage'](_0x10b2c0[_0x25c1('0x7d')][_0x25c1('0x10c')],_[_0x25c1('0x10d')](_0x10b2c0[_0x25c1('0x7d')],[_0x25c1('0x10c'),'id'])||{});}})['then'](respondWithResult(_0x4fdca2,null))[_0x25c1('0x1f')](handleError(_0x4fdca2,null));};exports[_0x25c1('0x10e')]=function(_0x53a35d,_0x5816c3){var _0x38ed31={'raw':![],'where':{}};var _0x287354={};var _0x33a141={'count':0x0,'rows':[]};return db[_0x25c1('0x43')][_0x25c1('0xc5')]({'where':{'id':_0x53a35d[_0x25c1('0xbe')]['id']}})[_0x25c1('0x16')](handleEntityNotFound(_0x5816c3,null))[_0x25c1('0x16')](function(_0x364f94){if(_0x364f94){_0x287354[_0x25c1('0x47')]=_[_0x25c1('0x48')](db[_0x25c1('0xf3')][_0x25c1('0x44')]);_0x287354[_0x25c1('0x49')]=_[_0x25c1('0x48')](_0x53a35d[_0x25c1('0x49')]);_0x287354[_0x25c1('0x4a')]=_[_0x25c1('0x4b')](_0x287354[_0x25c1('0x47')],_0x287354[_0x25c1('0x49')]);_0x38ed31[_0x25c1('0x4c')]=_[_0x25c1('0x4b')](_0x287354[_0x25c1('0x47')],qs[_0x25c1('0x4d')](_0x53a35d[_0x25c1('0x49')][_0x25c1('0x4d')]));_0x38ed31['attributes']=_0x38ed31[_0x25c1('0x4c')]['length']?_0x38ed31[_0x25c1('0x4c')]:_0x287354['model'];if(!_0x53a35d['query']['hasOwnProperty']('nolimit')){_0x38ed31[_0x25c1('0x26')]=qs[_0x25c1('0x26')](_0x53a35d[_0x25c1('0x49')]['limit']);_0x38ed31['offset']=qs[_0x25c1('0x24')](_0x53a35d[_0x25c1('0x49')]['offset']);}_0x38ed31[_0x25c1('0x9c')]=qs[_0x25c1('0x51')](_0x53a35d[_0x25c1('0x49')][_0x25c1('0x51')]);_0x38ed31[_0x25c1('0x88')]=qs[_0x25c1('0x4a')](_[_0x25c1('0x52')](_0x53a35d[_0x25c1('0x49')],_0x287354['filters']));_0x38ed31[_0x25c1('0x88')][_0x25c1('0xb9')]=_0x364f94['id'];if(_0x53a35d['query']['filter']){_0x38ed31['where']=_[_0x25c1('0x2f')](_0x38ed31[_0x25c1('0x88')],{'$or':_[_0x25c1('0x35')](_0x38ed31[_0x25c1('0x4c')],function(_0x2757e7){var _0x4bbf3c={};_0x4bbf3c[_0x2757e7]={'$like':'%'+_0x53a35d[_0x25c1('0x49')][_0x25c1('0x91')]+'%'};return _0x4bbf3c;})});}if(_0x53a35d['query'][_0x25c1('0x87')]){var _0x9aba08=_0x53a35d[_0x25c1('0x49')][_0x25c1('0x87')][_0x25c1('0x39')](',');var _0x4bf7b2={};_0x4bf7b2[_0x9aba08[0x0]]={'$gte':moment(_0x9aba08[0x1])[_0x25c1('0xf0')](_0x25c1('0x10f'))};_0x38ed31[_0x25c1('0x88')]=_[_0x25c1('0x2f')](_0x38ed31[_0x25c1('0x88')],_0x4bf7b2);}_0x38ed31=_[_0x25c1('0x2f')]({},_0x38ed31,_0x53a35d[_0x25c1('0xc1')]);return db[_0x25c1('0xf3')][_0x25c1('0x27')]({'where':_0x38ed31['where']})[_0x25c1('0x16')](function(_0x485b8e){_0x33a141[_0x25c1('0x27')]=_0x485b8e;if(_0x53a35d['query'][_0x25c1('0xbf')]){_0x38ed31[_0x25c1('0xc0')]=[{'all':!![]}];}return db[_0x25c1('0xf3')][_0x25c1('0x110')](_0x38ed31);})[_0x25c1('0x16')](function(_0x44b339){_0x33a141[_0x25c1('0xbc')]=_0x44b339;return _0x33a141;});}})['then'](respondWithFilteredResult(_0x5816c3,_0x38ed31))['catch'](handleError(_0x5816c3,null));};exports[_0x25c1('0x111')]=function(_0x346e7a,_0x3d27f5){var _0x5d9abc={'where':{}},_0x2eecfe={},_0x42c358={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x25c1('0xc5')]({'where':{'id':_0x346e7a[_0x25c1('0xbe')]['id']}})[_0x25c1('0x16')](handleEntityNotFound(_0x3d27f5,null))[_0x25c1('0x16')](function(_0x1e77f4){if(_0x1e77f4){_0x2eecfe[_0x25c1('0x47')]=_['keys'](db[_0x25c1('0xf3')][_0x25c1('0x44')]);_0x2eecfe[_0x25c1('0x49')]=_[_0x25c1('0x48')](_0x346e7a[_0x25c1('0x49')]);_0x2eecfe[_0x25c1('0x4a')]=_[_0x25c1('0x4b')](_0x2eecfe[_0x25c1('0x47')],_0x2eecfe[_0x25c1('0x49')]);_0x5d9abc[_0x25c1('0x4c')]=_[_0x25c1('0x4b')](_0x2eecfe[_0x25c1('0x47')],qs[_0x25c1('0x4d')](_0x346e7a[_0x25c1('0x49')][_0x25c1('0x4d')]));_0x5d9abc[_0x25c1('0x4c')]=_0x5d9abc[_0x25c1('0x4c')][_0x25c1('0x4e')]?_0x5d9abc[_0x25c1('0x4c')]:_0x2eecfe[_0x25c1('0x47')];if(!_0x346e7a[_0x25c1('0x49')][_0x25c1('0x4f')]('nolimit')){_0x5d9abc[_0x25c1('0x26')]=qs['limit'](_0x346e7a['query'][_0x25c1('0x26')]);_0x5d9abc[_0x25c1('0x24')]=qs[_0x25c1('0x24')](_0x346e7a[_0x25c1('0x49')]['offset']);}_0x5d9abc[_0x25c1('0x9c')]=qs[_0x25c1('0x51')](_0x346e7a[_0x25c1('0x49')][_0x25c1('0x51')]);_0x5d9abc[_0x25c1('0x88')]=qs[_0x25c1('0x4a')](_[_0x25c1('0x52')](_0x346e7a[_0x25c1('0x49')],_0x2eecfe[_0x25c1('0x4a')]));_0x5d9abc[_0x25c1('0x88')][_0x25c1('0xb9')]=_0x1e77f4['id'];if(_0x346e7a[_0x25c1('0x49')][_0x25c1('0x91')]){_0x5d9abc[_0x25c1('0x88')]=_['merge'](_0x5d9abc['where'],{'$or':_['map'](_0x5d9abc[_0x25c1('0x4c')],function(_0x4782a1){var _0x5476fd={};_0x5476fd[_0x4782a1]={'$like':'%'+_0x346e7a[_0x25c1('0x49')][_0x25c1('0x91')]+'%'};return _0x5476fd;})});}_0x5d9abc[_0x25c1('0x88')][_0x25c1('0x101')]=![];if(_0x346e7a[_0x25c1('0x49')]['id']){_0x5d9abc['where']['id']={'$gt':_0x346e7a[_0x25c1('0x49')]['id']};}_0x5d9abc=_[_0x25c1('0x2f')]({},_0x5d9abc,_0x346e7a[_0x25c1('0xc1')]);return db[_0x25c1('0xf3')]['count']({'where':_0x5d9abc[_0x25c1('0x88')]})[_0x25c1('0x16')](function(_0x41a852){_0x42c358[_0x25c1('0x27')]=_0x41a852;_0x5d9abc[_0x25c1('0xc0')]=[];if(_0x346e7a[_0x25c1('0x49')][_0x25c1('0x112')]){_0x5d9abc[_0x25c1('0xc0')][_0x25c1('0xba')]({'model':db[_0x25c1('0xf4')],'as':_0x25c1('0xf4'),'attributes':['id','fullname',_0x25c1('0xfe')]});}if(_0x346e7a['query'][_0x25c1('0xbf')]){_0x5d9abc[_0x25c1('0xc0')]=[{'all':!![]}];}return db[_0x25c1('0xf3')][_0x25c1('0x110')](_0x5d9abc);})[_0x25c1('0x16')](function(_0x490a5a){_0x42c358[_0x25c1('0xbc')]=_0x490a5a;return _0x42c358;});}})[_0x25c1('0x16')](respondWithFilteredResult(_0x3d27f5,_0x5d9abc))['catch'](handleError(_0x3d27f5,null));};exports[_0x25c1('0x113')]=function(_0x794186,_0x369eae){return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x794186[_0x25c1('0xbe')]['id']}})[_0x25c1('0x16')](handleEntityNotFound(_0x369eae,null))[_0x25c1('0x16')](function(_0xb7f731){if(_0xb7f731){return _0xb7f731[_0x25c1('0x114')](_0x794186[_0x25c1('0x7d')][_0x25c1('0x10c')],_[_0x25c1('0x10d')](_0x794186[_0x25c1('0x7d')],[_0x25c1('0x10c'),'id'])||{})[_0x25c1('0x115')](function(){return db[_0x25c1('0x116')]['findAll']({'attributes':['id',_0x25c1('0x2d'),_0x25c1('0x54')],'where':{'id':_0x794186[_0x25c1('0x7d')][_0x25c1('0x10c')]}});})[_0x25c1('0x16')](function(_0x567eaa){socket[_0x25c1('0x117')]('chatInteractionTags:save',{'id':Number(_0x794186['params']['id']),'tags':_0x567eaa||[]});return{'id':Number(_0x794186[_0x25c1('0xbe')]['id']),'tags':_0x567eaa||[]};});}})['then'](respondWithResult(_0x369eae,null))[_0x25c1('0x1f')](handleError(_0x369eae,null));};exports[_0x25c1('0x118')]=function(_0x4db32e,_0x1ef23b){return db[_0x25c1('0x43')]['find']({'where':{'id':_0x4db32e[_0x25c1('0xbe')]['id']}})[_0x25c1('0x16')](handleEntityNotFound(_0x1ef23b,null))[_0x25c1('0x16')](function(_0x398c71){if(_0x398c71){return _0x398c71['removeTags'](_0x4db32e[_0x25c1('0x49')][_0x25c1('0x10c')]);}})[_0x25c1('0x16')](respondWithStatusCode(_0x1ef23b,null))[_0x25c1('0x1f')](handleError(_0x1ef23b,null));};exports[_0x25c1('0xec')]=function(_0x239d47,_0x709325){var _0x397cdb=moment()['unix']()['toString']();var _0x2218d9=path[_0x25c1('0xe8')](config[_0x25c1('0xe9')],_0x25c1('0x119'),_0x25c1('0x11a'),_0x25c1('0x11b'));var _0x27835b=path[_0x25c1('0xe8')](config[_0x25c1('0xe9')],_0x25c1('0x119'),'files','attachments');var _0x2b87d2=path[_0x25c1('0xe8')](_0x2218d9,_0x397cdb);var _0x2d6283=util[_0x25c1('0xf0')](_0x25c1('0x11c'),_0x239d47['params']['id'],_0x397cdb);var _0x366f6c=path[_0x25c1('0xe8')](_0x2218d9,_0x2d6283);var _0x4ab3db=[];_0x4ab3db[_0x25c1('0xba')]({'model':db['User'],'as':_0x25c1('0xf4'),'attributes':['id',_0x25c1('0x36')],'raw':!![]});_0x4ab3db[_0x25c1('0xba')]({'model':db[_0x25c1('0xda')],'as':_0x25c1('0x11d'),'attributes':['id',_0x25c1('0x11e'),'lastName'],'raw':!![]});if(_0x239d47[_0x25c1('0x49')][_0x25c1('0x11f')]){_0x4ab3db['push']({'model':db[_0x25c1('0xe5')],'as':_0x25c1('0xe5'),'raw':!![]});}var _0x5dc403=[{'model':db[_0x25c1('0xf3')],'as':'Messages','attributes':['id',_0x25c1('0x7d'),_0x25c1('0x85'),_0x25c1('0x100'),_0x25c1('0x101'),'read'],'include':_0x4ab3db}];_0x5dc403['push']({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x25c1('0x2d')]});_0x5dc403[_0x25c1('0xba')]({'model':db[_0x25c1('0xf4')],'as':_0x25c1('0x120'),'attributes':['id','fullname']});return db[_0x25c1('0x43')][_0x25c1('0x6d')]({'where':{'id':_0x239d47[_0x25c1('0xbe')]['id']},'include':_0x5dc403})[_0x25c1('0x16')](handleEntityNotFound(_0x709325,null))[_0x25c1('0x16')](function(_0x2fc76c){if(_0x2fc76c){var _0x7b4c19=_0x2fc76c['get']({'plain':!![]});fs['mkdirSync'](_0x2b87d2);var _0x571289={'channel':'Chat','account':_0x7b4c19[_0x25c1('0x121')]['name'],'agent':_0x7b4c19[_0x25c1('0x120')]?_0x7b4c19[_0x25c1('0x120')][_0x25c1('0x36')]:'N.A.','createdAt':moment(_0x7b4c19[_0x25c1('0x85')])[_0x25c1('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x25c1('0xa4')](),'closedAt':_0x7b4c19[_0x25c1('0x3f')]?moment(_0x7b4c19['closedAt'])[_0x25c1('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x25c1('0xa4')]():'','disposition':_0x7b4c19[_0x25c1('0xdf')],'chatInfo':{'browser':_0x7b4c19[_0x25c1('0x122')],'os':_0x7b4c19['osName'],'referer':_0x7b4c19[_0x25c1('0x123')],'customerIp':_0x7b4c19['customerIp'],'customerPort':_0x7b4c19[_0x25c1('0x124')]?_0x7b4c19['customerPort']:_0x25c1('0x125')},'messages':_(_0x7b4c19[_0x25c1('0xf5')])['tail']()[_0x25c1('0x91')]({'secret':![]})[_0x25c1('0x35')](function(_0x11e82f){if(_0x11e82f[_0x25c1('0xe5')]){var _0x2d73d5=path[_0x25c1('0xe8')](_0x27835b,_0x11e82f[_0x25c1('0xe5')]['basename']);if(fs[_0x25c1('0x126')](_0x2d73d5)){fs[_0x25c1('0x127')](_0x2d73d5)[_0x25c1('0x128')](fs[_0x25c1('0x129')](path[_0x25c1('0xe8')](_0x2b87d2,_0x11e82f['Attachment'][_0x25c1('0xe1')])));}}return{'date':moment(_0x11e82f['createdAt'])[_0x25c1('0xf0')](_0x25c1('0x10f'))[_0x25c1('0xa4')](),'sender':_0x11e82f[_0x25c1('0x100')]===_0x25c1('0xd6')?_0x11e82f[_0x25c1('0xf4')]?_0x11e82f['User'][_0x25c1('0x36')]:_0x25c1('0xf7'):_0x11e82f[_0x25c1('0x11d')][_0x25c1('0x11e')]+(_0x11e82f[_0x25c1('0x11d')][_0x25c1('0x12a')]?'\x20'+_0x11e82f[_0x25c1('0x11d')]['lastName']:''),'body':_0x11e82f[_0x25c1('0xe5')]?_0x11e82f['Attachment'][_0x25c1('0xe1')]:_0x11e82f[_0x25c1('0x7d')],'direction':_0x11e82f['direction']===_0x25c1('0xd6')?'A':'C','secret':_0x11e82f[_0x25c1('0x101')],'read':_0x11e82f['read'],'attachment':_0x11e82f[_0x25c1('0xe5')]};})[_0x25c1('0x72')]()};return ejs['renderFile'](path[_0x25c1('0xe8')](config[_0x25c1('0xe9')],'server',_0x25c1('0x12b'),_0x25c1('0x12c')),{'interaction':_0x571289})[_0x25c1('0x16')](function(_0x29d142){var _0x3fb5ed=path[_0x25c1('0xe8')](_0x2b87d2,_0x25c1('0x12d')+_0x7b4c19['id']+'-'+_0x397cdb+_0x25c1('0x12e'));var _0x1547ac={'path':_0x3fb5ed,'channel':_0x25c1('0x12f'),'interactionId':_0x7b4c19['id']};return pdf[_0x25c1('0x130')](_0x29d142,_0x1547ac);})[_0x25c1('0x16')](function(){return new Promise(function(_0x45d150,_0x17f776){zipdir(_0x2b87d2,{'saveTo':_0x366f6c},function(_0x246ed8,_0x5f4c8d){if(_0x246ed8)return _0x17f776(_0x246ed8);return _0x45d150(_0x5f4c8d);});})[_0x25c1('0x16')](function(){return new BPromise(function(_0x265362,_0x4ad924){rimraf(_0x2b87d2,function(_0x51c0e7){if(_0x51c0e7)_0x4ad924(_0x51c0e7);return _0x265362();});});})['then'](function(){return _0x709325[_0x25c1('0xec')](_0x366f6c,_0x2d6283,function(_0x4c7055){if(_0x4c7055){logger['error'](_0x25c1('0x131'),_0x4c7055);}else{fs[_0x25c1('0x132')](_0x366f6c);}});});});}else{return _0x709325['sendStatus'](0xc8);}})[_0x25c1('0x1f')](handleError(_0x709325,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5f6aee0..208c689 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 _0x0a44=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x56a835,_0x38af97){var _0x2331af=function(_0xce0dbb){while(--_0xce0dbb){_0x56a835['push'](_0x56a835['shift']());}};_0x2331af(++_0x38af97);}(_0x0a44,0x133));var _0x40a4=function(_0x1f352b,_0x4edec5){_0x1f352b=_0x1f352b-0x0;var _0x59f654=_0x0a44[_0x1f352b];return _0x59f654;};'use strict';var EventEmitter=require(_0x40a4('0x0'));var ChatInteraction=require(_0x40a4('0x1'))['db'][_0x40a4('0x2')];var ChatMessage=require(_0x40a4('0x1'))['db'][_0x40a4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x40a4('0x4'),'afterDestroy':_0x40a4('0x5')};function emitEvent(_0x59434c){return function(_0x23606b,_0x1b6a46,_0x43f9db){_0x23606b[_0x40a4('0x6')]({'attributes':['id'],'raw':!![]})[_0x40a4('0x7')](function(_0x1e0df7){_0x23606b[_0x40a4('0x8')](_0x40a4('0x9'),_0x1e0df7[_0x40a4('0xa')](function(_0x3a4aea){return{'id':_0x3a4aea['id']};}));return ChatMessage[_0x40a4('0xb')]({'where':{'ChatInteractionId':_0x23606b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x40a4('0x7')](function(_0x2fa52e){_0x23606b[_0x40a4('0x8')]('unreadMessages',_0x2fa52e[_0x40a4('0xc')]);ChatInteractionEvents[_0x40a4('0xd')](_0x59434c+':'+_0x23606b['id'],_0x23606b);ChatInteractionEvents[_0x40a4('0xd')](_0x59434c,_0x23606b);_0x43f9db(null);})[_0x40a4('0xe')](_0x43f9db(null));};}for(var e in events){if(events[_0x40a4('0xf')](e)){var event=events[e];ChatInteraction[_0x40a4('0x10')](e,emitEvent(event));}}module[_0x40a4('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xd367=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x5886a7,_0x11a0a4){var _0x1d03ee=function(_0x3cf39e){while(--_0x3cf39e){_0x5886a7['push'](_0x5886a7['shift']());}};_0x1d03ee(++_0x11a0a4);}(_0xd367,0xbf));var _0x7d36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd367[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x7d36('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x7d36('0x1'))['db'][_0x7d36('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7d36('0x3')](0x0);var events={'afterCreate':_0x7d36('0x4'),'afterUpdate':_0x7d36('0x5'),'afterDestroy':_0x7d36('0x6')};function emitEvent(_0x405395){return function(_0x132c04,_0x34cc33,_0x220057){_0x132c04[_0x7d36('0x7')]({'attributes':['id'],'raw':!![]})[_0x7d36('0x8')](function(_0x2116cb){_0x132c04[_0x7d36('0x9')](_0x7d36('0xa'),_0x2116cb[_0x7d36('0xb')](function(_0xf6f485){return{'id':_0xf6f485['id']};}));return ChatMessage[_0x7d36('0xc')]({'where':{'ChatInteractionId':_0x132c04['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d36('0x8')](function(_0x4087c8){_0x132c04[_0x7d36('0x9')](_0x7d36('0xd'),_0x4087c8['length']);ChatInteractionEvents[_0x7d36('0xe')](_0x405395+':'+_0x132c04['id'],_0x132c04);ChatInteractionEvents[_0x7d36('0xe')](_0x405395,_0x132c04);_0x220057(null);})[_0x7d36('0xf')](_0x220057(null));};}for(var e in events){if(events[_0x7d36('0x10')](e)){var event=events[e];ChatInteraction[_0x7d36('0x11')](e,emitEvent(event));}}module[_0x7d36('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1ab44f9..6b00959 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 _0x27e5=['ChatInteraction','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x27e5,0x150));var _0x527e=function(_0xd316f8,_0x2c9655){_0xd316f8=_0xd316f8-0x0;var _0xc2109c=_0x27e5[_0xd316f8];return _0xc2109c;};'use strict';var _=require(_0x527e('0x0'));var util=require('util');var logger=require(_0x527e('0x1'))(_0x527e('0x2'));var moment=require(_0x527e('0x3'));var BPromise=require('bluebird');var rp=require(_0x527e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x527e('0x5'));var config=require(_0x527e('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x527e('0x7')]=function(_0x2fd0c9,_0x20e34e){return _0x2fd0c9[_0x527e('0x8')](_0x527e('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3baa52,_0x74a976,_0x2ddd2d){if(_0x3baa52['changed'](_0x527e('0xa'))){_0x3baa52[_0x527e('0xb')]=moment()[_0x527e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ddd2d(null,_0x3baa52);}},'charset':_0x527e('0xd'),'collate':_0x527e('0xe')});}; \ No newline at end of file +var _0xa552=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','define','ChatInteraction','chat_interactions'];(function(_0x58ced8,_0x202c27){var _0x15e21a=function(_0x4106f2){while(--_0x4106f2){_0x58ced8['push'](_0x58ced8['shift']());}};_0x15e21a(++_0x202c27);}(_0xa552,0x197));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2a55('0x0'));var util=require(_0x2a55('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2a55('0x2'));var BPromise=require(_0x2a55('0x3'));var rp=require(_0x2a55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a55('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x5d1ed8,_0x2a15c6){return _0x5d1ed8[_0x2a55('0x6')](_0x2a55('0x7'),attributes,{'tableName':_0x2a55('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x590615,_0x583ee2,_0x26da30){if(_0x590615[_0x2a55('0x9')](_0x2a55('0xa'))){_0x590615[_0x2a55('0xb')]=moment()[_0x2a55('0xc')](_0x2a55('0xd'));}_0x26da30(null,_0x590615);}},'charset':_0x2a55('0xe'),'collate':_0x2a55('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b6062f4..6b22f9f 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 _0x2ad3=['then','UpdateChatInteraction','AddTagsToChatInteraction','ids','omit','spread','AddTags','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','debug','stringify','error','ChatInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','ChatInteraction','body','options','raw','where','attributes','limit'];(function(_0x53615b,_0xf060d5){var _0x6058f=function(_0x559d20){while(--_0x559d20){_0x53615b['push'](_0x53615b['shift']());}};_0x6058f(++_0xf060d5);}(_0x2ad3,0xca));var _0x32ad=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2ad3[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32ad('0x0'));var fs=require('fs');var Redis=require(_0x32ad('0x1'));var db=require(_0x32ad('0x2'))['db'];var utils=require(_0x32ad('0x3'));var logger=require(_0x32ad('0x4'))(_0x32ad('0x5'));var config=require(_0x32ad('0x6'));var jayson=require(_0x32ad('0x7'));var client=jayson[_0x32ad('0x8')]['http']({'port':0x232a});config[_0x32ad('0x9')]=_[_0x32ad('0xa')](config[_0x32ad('0x9')],{'host':_0x32ad('0xb'),'port':0x18eb});var socket=require(_0x32ad('0xc'))(new Redis(config[_0x32ad('0x9')]));require(_0x32ad('0xd'))[_0x32ad('0xe')](socket);function respondWithRpcPromise(_0x160650,_0x4fa213,_0x2ac7ad){return new BPromise(function(_0x2aa34d,_0x10e6dc){return client[_0x32ad('0xf')](_0x160650,_0x2ac7ad)['then'](function(_0x207a2a){logger[_0x32ad('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4fa213,'request\x20sent');logger[_0x32ad('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4fa213,'request\x20sent',JSON[_0x32ad('0x12')](_0x207a2a));if(_0x207a2a[_0x32ad('0x13')]){if(_0x207a2a['error']['code']===0x1f4){logger[_0x32ad('0x13')](_0x32ad('0x14'),_0x4fa213,_0x207a2a[_0x32ad('0x13')][_0x32ad('0x15')]);return _0x10e6dc(_0x207a2a[_0x32ad('0x13')]['message']);}logger['error'](_0x32ad('0x14'),_0x4fa213,_0x207a2a[_0x32ad('0x13')][_0x32ad('0x15')]);return _0x2aa34d(_0x207a2a[_0x32ad('0x13')]['message']);}else{logger['info'](_0x32ad('0x14'),_0x4fa213,_0x32ad('0x16'));_0x2aa34d(_0x207a2a[_0x32ad('0x17')][_0x32ad('0x15')]);}})[_0x32ad('0x18')](function(_0x12a1b4){logger[_0x32ad('0x13')](_0x32ad('0x14'),_0x4fa213,_0x12a1b4);_0x10e6dc(_0x12a1b4);});});}exports['UpdateChatInteraction']=function(_0x1c7a35){var _0x1ea469=this;return new Promise(function(_0x41cb29,_0x2a44fa){return db[_0x32ad('0x19')]['update'](_0x1c7a35[_0x32ad('0x1a')],{'raw':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35[_0x32ad('0x1b')][_0x32ad('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35[_0x32ad('0x1b')][_0x32ad('0x1d')]||null:null,'attributes':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35['options'][_0x32ad('0x1e')]||null:null,'limit':_0x1c7a35[_0x32ad('0x1b')]?_0x1c7a35[_0x32ad('0x1b')][_0x32ad('0x1f')]||null:null})[_0x32ad('0x20')](function(_0x4faa3c){logger[_0x32ad('0x10')](_0x32ad('0x21'),_0x1c7a35);logger[_0x32ad('0x11')](_0x32ad('0x21'),_0x1c7a35,JSON[_0x32ad('0x12')](_0x4faa3c));_0x41cb29(_0x4faa3c);})[_0x32ad('0x18')](function(_0x2f834d){logger[_0x32ad('0x13')](_0x32ad('0x21'),_0x2f834d[_0x32ad('0x15')],_0x1c7a35);_0x2a44fa(_0x1ea469['error'](0x1f4,_0x2f834d[_0x32ad('0x15')]));});});};exports[_0x32ad('0x22')]=function(_0x3f28c9){return new Promise(function(_0x1f98e2,_0x4924a3){return db[_0x32ad('0x19')]['find']({'where':_0x3f28c9[_0x32ad('0x1b')]?_0x3f28c9['options'][_0x32ad('0x1d')]||null:null})['then'](function(_0x24f6dd){if(_0x24f6dd){return _0x24f6dd['addTags'](_0x3f28c9['body'][_0x32ad('0x23')],_[_0x32ad('0x24')](_0x3f28c9[_0x32ad('0x1a')],[_0x32ad('0x23'),'id'])||{});}})[_0x32ad('0x25')](function(_0x4b324e){logger['info'](_0x32ad('0x26'),_0x3f28c9);logger[_0x32ad('0x11')](_0x32ad('0x26'),_0x3f28c9,JSON['stringify'](_0x4b324e));_0x1f98e2(_0x4b324e);})[_0x32ad('0x18')](function(_0x37a804){logger[_0x32ad('0x13')](_0x32ad('0x26'),_0x37a804[_0x32ad('0x15')],_0x3f28c9);_0x4924a3(_this[_0x32ad('0x13')](0x1f4,_0x37a804[_0x32ad('0x15')]));});});}; \ No newline at end of file +var _0xcdce=['catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','AddTagsToChatInteraction','find','addTags','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result'];(function(_0x1c70a6,_0x181310){var _0x33783c=function(_0x3b7118){while(--_0x3b7118){_0x1c70a6['push'](_0x1c70a6['shift']());}};_0x33783c(++_0x181310);}(_0xcdce,0xeb));var _0xecdc=function(_0x120bf8,_0x4e3509){_0x120bf8=_0x120bf8-0x0;var _0x43e434=_0xcdce[_0x120bf8];return _0x43e434;};'use strict';var _=require('lodash');var util=require(_0xecdc('0x0'));var moment=require('moment');var BPromise=require(_0xecdc('0x1'));var rs=require(_0xecdc('0x2'));var fs=require('fs');var Redis=require(_0xecdc('0x3'));var db=require(_0xecdc('0x4'))['db'];var utils=require(_0xecdc('0x5'));var logger=require(_0xecdc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xecdc('0x7'));var client=jayson[_0xecdc('0x8')]['http']({'port':0x232a});config[_0xecdc('0x9')]=_[_0xecdc('0xa')](config[_0xecdc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xecdc('0xb'))(new Redis(config['redis']));require(_0xecdc('0xc'))[_0xecdc('0xd')](socket);function respondWithRpcPromise(_0x41d192,_0xae72e9,_0x4d6b85){return new BPromise(function(_0x4a5d62,_0xfa3ae2){return client['request'](_0x41d192,_0x4d6b85)['then'](function(_0x3e5254){logger['info']('ChatInteraction,\x20%s,\x20%s',_0xae72e9,_0xecdc('0xe'));logger[_0xecdc('0xf')](_0xecdc('0x10'),_0xae72e9,'request\x20sent',JSON[_0xecdc('0x11')](_0x3e5254));if(_0x3e5254[_0xecdc('0x12')]){if(_0x3e5254['error'][_0xecdc('0x13')]===0x1f4){logger[_0xecdc('0x12')](_0xecdc('0x14'),_0xae72e9,_0x3e5254[_0xecdc('0x12')][_0xecdc('0x15')]);return _0xfa3ae2(_0x3e5254[_0xecdc('0x12')][_0xecdc('0x15')]);}logger[_0xecdc('0x12')](_0xecdc('0x14'),_0xae72e9,_0x3e5254[_0xecdc('0x12')]['message']);return _0x4a5d62(_0x3e5254[_0xecdc('0x12')][_0xecdc('0x15')]);}else{logger[_0xecdc('0x16')]('ChatInteraction,\x20%s,\x20%s',_0xae72e9,'request\x20sent');_0x4a5d62(_0x3e5254[_0xecdc('0x17')][_0xecdc('0x15')]);}})[_0xecdc('0x18')](function(_0x3b199e){logger[_0xecdc('0x12')](_0xecdc('0x14'),_0xae72e9,_0x3b199e);_0xfa3ae2(_0x3b199e);});});}exports[_0xecdc('0x19')]=function(_0x277b14){var _0x3fd107=this;return new Promise(function(_0x59de03,_0x393d5a){return db[_0xecdc('0x1a')]['update'](_0x277b14[_0xecdc('0x1b')],{'raw':_0x277b14[_0xecdc('0x1c')]?_0x277b14[_0xecdc('0x1c')][_0xecdc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277b14[_0xecdc('0x1c')]?_0x277b14[_0xecdc('0x1c')][_0xecdc('0x1e')]||null:null,'attributes':_0x277b14[_0xecdc('0x1c')]?_0x277b14[_0xecdc('0x1c')]['attributes']||null:null,'limit':_0x277b14[_0xecdc('0x1c')]?_0x277b14['options']['limit']||null:null})['then'](function(_0x4c13ea){logger[_0xecdc('0x16')]('UpdateChatInteraction',_0x277b14);logger['debug'](_0xecdc('0x19'),_0x277b14,JSON['stringify'](_0x4c13ea));_0x59de03(_0x4c13ea);})[_0xecdc('0x18')](function(_0x540bdf){logger[_0xecdc('0x12')]('UpdateChatInteraction',_0x540bdf[_0xecdc('0x15')],_0x277b14);_0x393d5a(_0x3fd107[_0xecdc('0x12')](0x1f4,_0x540bdf[_0xecdc('0x15')]));});});};exports[_0xecdc('0x1f')]=function(_0x309133){return new Promise(function(_0x3d111a,_0x3974ec){return db['ChatInteraction'][_0xecdc('0x20')]({'where':_0x309133['options']?_0x309133[_0xecdc('0x1c')][_0xecdc('0x1e')]||null:null})['then'](function(_0x399e08){if(_0x399e08){return _0x399e08[_0xecdc('0x21')](_0x309133['body']['ids'],_[_0xecdc('0x22')](_0x309133[_0xecdc('0x1b')],['ids','id'])||{});}})[_0xecdc('0x23')](function(_0x534aa4){logger[_0xecdc('0x16')]('AddTags',_0x309133);logger[_0xecdc('0xf')](_0xecdc('0x24'),_0x309133,JSON[_0xecdc('0x11')](_0x534aa4));_0x3d111a(_0x534aa4);})[_0xecdc('0x18')](function(_0x442e20){logger['error'](_0xecdc('0x24'),_0x442e20[_0xecdc('0x15')],_0x309133);_0x3974ec(_this['error'](0x1f4,_0x442e20[_0xecdc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5980f9d..c8098a2 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 _0x8939=['save','remove','update','emit','removeListener','register','length'];(function(_0x4f7411,_0x591282){var _0x3bfe5b=function(_0x1c5ad0){while(--_0x1c5ad0){_0x4f7411['push'](_0x4f7411['shift']());}};_0x3bfe5b(++_0x591282);}(_0x8939,0x12d));var _0x9893=function(_0x545b6d,_0x1210b2){_0x545b6d=_0x545b6d-0x0;var _0x342968=_0x8939[_0x545b6d];return _0x342968;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9893('0x0'),_0x9893('0x1'),_0x9893('0x2')];function createListener(_0x574a2c,_0x18ef1e){return function(_0x575fa3){_0x18ef1e[_0x9893('0x3')](_0x574a2c,_0x575fa3);};}function removeListener(_0x27f124,_0x4f85fd){return function(){ChatInteractionEvents[_0x9893('0x4')](_0x27f124,_0x4f85fd);};}exports[_0x9893('0x5')]=function(_0x5aee08){for(var _0x1e1654=0x0,_0x415e95=events[_0x9893('0x6')];_0x1e1654<_0x415e95;_0x1e1654++){var _0x1c97d0=events[_0x1e1654];var _0x13ff86=createListener('chatInteraction:'+_0x1c97d0,_0x5aee08);ChatInteractionEvents['on'](_0x1c97d0,_0x13ff86);}}; \ No newline at end of file +var _0x0faf=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','remove'];(function(_0x1adb5d,_0x1e36cc){var _0x3acc58=function(_0x30a5ac){while(--_0x30a5ac){_0x1adb5d['push'](_0x1adb5d['shift']());}};_0x3acc58(++_0x1e36cc);}(_0x0faf,0x132));var _0xf0fa=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x0faf[_0x507403];return _0x1327c;};'use strict';var ChatInteractionEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatInteractionEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatInteractionEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 435f3c1..23c3e4e 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 _0x3a57=['attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file'];(function(_0x2ca743,_0x1b66e7){var _0x4c1fa1=function(_0x1d3f3c){while(--_0x1d3f3c){_0x2ca743['push'](_0x2ca743['shift']());}};_0x4c1fa1(++_0x1b66e7);}(_0x3a57,0x1e6));var _0x73a5=function(_0x49d3c1,_0x574cf3){_0x49d3c1=_0x49d3c1-0x0;var _0x107871=_0x3a57[_0x49d3c1];return _0x107871;};'use strict';var multer=require('multer');var util=require(_0x73a5('0x0'));var path=require(_0x73a5('0x1'));var timeout=require(_0x73a5('0x2'));var express=require('express');var router=express[_0x73a5('0x3')]();var fs_extra=require(_0x73a5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73a5('0x5'));var config=require(_0x73a5('0x6'));var controller=require('./chatInteraction.controller');router[_0x73a5('0x7')]('/',auth[_0x73a5('0x8')](),controller['index']);router['get'](_0x73a5('0x9'),auth['isAuthenticated'](),controller[_0x73a5('0xa')]);router[_0x73a5('0x7')](_0x73a5('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x73a5('0x7')]('/:id/attachment_download',auth[_0x73a5('0xc')](),controller[_0x73a5('0xd')]);router[_0x73a5('0x7')](_0x73a5('0xe'),auth[_0x73a5('0x8')](),controller['getMessages']);router[_0x73a5('0x7')](_0x73a5('0xf'),auth[_0x73a5('0xc')](),controller[_0x73a5('0x10')]);router[_0x73a5('0x7')](_0x73a5('0x11'),auth['isAuthenticated'](),controller[_0x73a5('0x12')]);router[_0x73a5('0x13')]('/',auth['isAuthenticated'](),controller[_0x73a5('0x14')]);router[_0x73a5('0x13')](_0x73a5('0x15'),auth[_0x73a5('0x8')](),controller[_0x73a5('0x16')]);var upload=multer({'storage':multer[_0x73a5('0x17')]({'destination':function(_0x2935d6,_0x56c7f7,_0x1bcba8){_0x1bcba8(null,path[_0x73a5('0x18')](config[_0x73a5('0x19')],'server/files/attachments/'));},'filename':function(_0x3dd0be,_0x426a2c,_0xa94e2b){_0xa94e2b(null,util[_0x73a5('0x1a')](_0x73a5('0x1b'),Date[_0x73a5('0x1c')](),_0x426a2c[_0x73a5('0x1d')][_0x73a5('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x73a5('0x13')](_0x73a5('0x1f'),upload[_0x73a5('0x20')](_0x73a5('0x21')),controller[_0x73a5('0x22')]);router['post']('/:id/messages',auth[_0x73a5('0xc')](),controller[_0x73a5('0x23')]);router['post'](_0x73a5('0x24'),auth[_0x73a5('0x8')](),interaction[_0x73a5('0x25')](_0x73a5('0x26'),_0x73a5('0x27')),controller[_0x73a5('0x28')]);router[_0x73a5('0x29')]('/:id',auth[_0x73a5('0x8')](),interaction[_0x73a5('0x25')](_0x73a5('0x26'),'chatinteraction:update'),controller[_0x73a5('0x2a')]);router['put'](_0x73a5('0x2b'),controller[_0x73a5('0x2c')]);router[_0x73a5('0x29')](_0x73a5('0x2d'),auth[_0x73a5('0xc')](),controller['abandon']);router['put'](_0x73a5('0x2e'),controller[_0x73a5('0x2f')]);router[_0x73a5('0x30')]('/:id',auth[_0x73a5('0x8')](),interaction[_0x73a5('0x25')](_0x73a5('0x26'),'chatinteraction:destroy'),controller[_0x73a5('0x31')]);router[_0x73a5('0x30')](_0x73a5('0x24'),auth[_0x73a5('0x8')](),controller[_0x73a5('0x32')]);module[_0x73a5('0x33')]=router; \ No newline at end of file +var _0x6bbb=['/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','format','%s-%s','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','put','/:id','tracked','update','/:id/abandon','abandon'];(function(_0x135448,_0x4ca19f){var _0x28389e=function(_0x5a2113){while(--_0x5a2113){_0x135448['push'](_0x135448['shift']());}};_0x28389e(++_0x4ca19f);}(_0x6bbb,0xa6));var _0xb6bb=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x6bbb[_0x44cb92];return _0x56b9e6;};'use strict';var multer=require(_0xb6bb('0x0'));var util=require('util');var path=require(_0xb6bb('0x1'));var timeout=require(_0xb6bb('0x2'));var express=require(_0xb6bb('0x3'));var router=express[_0xb6bb('0x4')]();var fs_extra=require(_0xb6bb('0x5'));var auth=require(_0xb6bb('0x6'));var interaction=require(_0xb6bb('0x7'));var config=require(_0xb6bb('0x8'));var controller=require(_0xb6bb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb6bb('0xa')]);router[_0xb6bb('0xb')](_0xb6bb('0xc'),auth[_0xb6bb('0xd')](),controller[_0xb6bb('0xe')]);router[_0xb6bb('0xb')]('/:id',auth[_0xb6bb('0xf')](),controller[_0xb6bb('0x10')]);router[_0xb6bb('0xb')](_0xb6bb('0x11'),auth[_0xb6bb('0xf')](),controller[_0xb6bb('0x12')]);router[_0xb6bb('0xb')]('/:id/messages',auth[_0xb6bb('0xd')](),controller[_0xb6bb('0x13')]);router['get'](_0xb6bb('0x14'),auth[_0xb6bb('0xf')](),controller[_0xb6bb('0x15')]);router[_0xb6bb('0xb')](_0xb6bb('0x16'),auth[_0xb6bb('0xd')](),controller['download']);router[_0xb6bb('0x17')]('/',auth[_0xb6bb('0xd')](),controller[_0xb6bb('0x18')]);router[_0xb6bb('0x17')](_0xb6bb('0x19'),auth[_0xb6bb('0xd')](),controller[_0xb6bb('0x1a')]);var upload=multer({'storage':multer[_0xb6bb('0x1b')]({'destination':function(_0xbf4ed9,_0x147790,_0x3de449){_0x3de449(null,path[_0xb6bb('0x1c')](config['root'],'server/files/attachments/'));},'filename':function(_0x3759cc,_0x119345,_0x2fa519){_0x2fa519(null,util[_0xb6bb('0x1d')](_0xb6bb('0x1e'),Date['now'](),_0x119345[_0xb6bb('0x1f')][_0xb6bb('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xb6bb('0x21')](_0xb6bb('0x22')),controller[_0xb6bb('0x23')]);router[_0xb6bb('0x17')]('/:id/messages',auth[_0xb6bb('0xf')](),controller[_0xb6bb('0x24')]);router[_0xb6bb('0x17')](_0xb6bb('0x25'),auth[_0xb6bb('0xd')](),interaction['tracked'](_0xb6bb('0x26'),_0xb6bb('0x27')),controller['addTags']);router[_0xb6bb('0x28')](_0xb6bb('0x29'),auth['isAuthenticated'](),interaction[_0xb6bb('0x2a')](_0xb6bb('0x26'),'chatinteraction:update'),controller[_0xb6bb('0x2b')]);router['put']('/:id/custom_update',controller['customUpdate']);router[_0xb6bb('0x28')](_0xb6bb('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0xb6bb('0x2d')]);router[_0xb6bb('0x28')](_0xb6bb('0x2e'),controller[_0xb6bb('0x2f')]);router[_0xb6bb('0x30')](_0xb6bb('0x29'),auth[_0xb6bb('0xd')](),interaction[_0xb6bb('0x2a')](_0xb6bb('0x26'),_0xb6bb('0x31')),controller[_0xb6bb('0x32')]);router[_0xb6bb('0x30')](_0xb6bb('0x25'),auth[_0xb6bb('0xd')](),controller[_0xb6bb('0x33')]);module[_0xb6bb('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 987d932..248ee6f 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 _0xc3b8=['INTEGER','sequelize','TEXT','medium','BOOLEAN'];(function(_0x26d26f,_0x302cce){var _0x5c8c0e=function(_0x519b9d){while(--_0x519b9d){_0x26d26f['push'](_0x26d26f['shift']());}};_0x5c8c0e(++_0x302cce);}(_0xc3b8,0x173));var _0x8c3b=function(_0x3bb89c,_0x3bd0de){_0x3bb89c=_0x3bb89c-0x0;var _0x1f4b69=_0xc3b8[_0x3bb89c];return _0x1f4b69;};'use strict';var Sequelize=require(_0x8c3b('0x0'));module['exports']={'body':{'type':Sequelize[_0x8c3b('0x1')](_0x8c3b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8c3b('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8c3b('0x4')]}}; \ No newline at end of file +var _0x2a1d=['sequelize','exports','TEXT','INTEGER'];(function(_0x36847d,_0x3273a7){var _0x3f3617=function(_0x55fa47){while(--_0x55fa47){_0x36847d['push'](_0x36847d['shift']());}};_0x3f3617(++_0x3273a7);}(_0x2a1d,0x144));var _0xd2a1=function(_0x554c70,_0xf212c6){_0x554c70=_0x554c70-0x0;var _0xe830fa=_0x2a1d[_0x554c70];return _0xe830fa;};'use strict';var Sequelize=require(_0xd2a1('0x0'));module[_0xd2a1('0x1')]={'body':{'type':Sequelize[_0xd2a1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd2a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1501362..efaadaa 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 _0x4315=['name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','User','admin','user','role','online','lastLoginAt','showWebBar','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','agent','resourceId','push','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack'];(function(_0x3be417,_0x1cc829){var _0x3b8b93=function(_0x476ef5){while(--_0x476ef5){_0x3be417['push'](_0x3be417['shift']());}};_0x3b8b93(++_0x1cc829);}(_0x4315,0x17b));var _0x5431=function(_0x5c110c,_0x58d08b){_0x5c110c=_0x5c110c-0x0;var _0x485822=_0x4315[_0x5c110c];return _0x485822;};'use strict';var emlformat=require(_0x5431('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5431('0x1'));var jsonpatch=require(_0x5431('0x2'));var rp=require(_0x5431('0x3'));var moment=require('moment');var BPromise=require(_0x5431('0x4'));var Mustache=require(_0x5431('0x5'));var util=require(_0x5431('0x6'));var path=require(_0x5431('0x7'));var sox=require(_0x5431('0x8'));var csv=require(_0x5431('0x9'));var ejs=require(_0x5431('0xa'));var fs=require('fs');var fs_extra=require(_0x5431('0xb'));var _=require('lodash');var squel=require(_0x5431('0xc'));var crypto=require(_0x5431('0xd'));var jsforce=require(_0x5431('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5431('0x9'));var querystring=require(_0x5431('0xf'));var Papa=require('papaparse');var Redis=require(_0x5431('0x10'));var authService=require(_0x5431('0x11'));var qs=require(_0x5431('0x12'));var as=require(_0x5431('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5431('0x14'));var config=require(_0x5431('0x15'));var licenseUtil=require(_0x5431('0x16'));var db=require(_0x5431('0x17'))['db'];config[_0x5431('0x18')]=_[_0x5431('0x19')](config[_0x5431('0x18')],{'host':_0x5431('0x1a'),'port':0x18eb});var socket=require(_0x5431('0x1b'))(new Redis(config[_0x5431('0x18')]));require(_0x5431('0x1c'))['register'](socket);function respondWithStatusCode(_0x33571e,_0x3a25c8){_0x3a25c8=_0x3a25c8||0xcc;return function(_0x4838d6){if(_0x4838d6){return _0x33571e[_0x5431('0x1d')](_0x3a25c8);}return _0x33571e['status'](_0x3a25c8)['end']();};}function respondWithResult(_0x2a8ff0,_0x43e1ee){_0x43e1ee=_0x43e1ee||0xc8;return function(_0x335147){if(_0x335147){return _0x2a8ff0[_0x5431('0x1e')](_0x43e1ee)[_0x5431('0x1f')](_0x335147);}};}function respondWithFilteredResult(_0x2b0cee,_0x3e058e){return function(_0x3f2380){if(_0x3f2380){var _0x2c8ca6=typeof _0x3e058e[_0x5431('0x20')]===_0x5431('0x21')&&typeof _0x3e058e[_0x5431('0x22')]==='undefined';var _0x2b1004=_0x3f2380[_0x5431('0x23')];var _0x4b2285=_0x2c8ca6?0x0:_0x3e058e[_0x5431('0x20')];var _0x437609=_0x2c8ca6?_0x3f2380[_0x5431('0x23')]:_0x3e058e[_0x5431('0x20')]+_0x3e058e['limit'];var _0x574470;if(_0x437609>=_0x2b1004){_0x437609=_0x2b1004;_0x574470=0xc8;}else{_0x574470=0xce;}_0x2b0cee['status'](_0x574470);return _0x2b0cee[_0x5431('0x24')](_0x5431('0x25'),_0x4b2285+'-'+_0x437609+'/'+_0x2b1004)['json'](_0x3f2380);}return null;};}function patchUpdates(_0x1f9fde){return function(_0x16cd11){try{jsonpatch[_0x5431('0x26')](_0x16cd11,_0x1f9fde,!![]);}catch(_0x2d46fa){return BPromise[_0x5431('0x27')](_0x2d46fa);}return _0x16cd11['save']();};}function saveUpdates(_0x33cf13,_0x4693d6){return function(_0x259845){if(_0x259845){return _0x259845[_0x5431('0x28')](_0x33cf13)[_0x5431('0x29')](function(_0x50019a){return _0x50019a;});}return null;};}function removeEntity(_0x18d897,_0x522cec){return function(_0x29cb14){if(_0x29cb14){return _0x29cb14[_0x5431('0x2a')]()['then'](function(){_0x18d897[_0x5431('0x1e')](0xcc)[_0x5431('0x2b')]();});}};}function handleEntityNotFound(_0x2775ff,_0x477293){return function(_0x530c6e){if(!_0x530c6e){_0x2775ff['sendStatus'](0x194);}return _0x530c6e;};}function handleError(_0x1eb265,_0x9f3a87){_0x9f3a87=_0x9f3a87||0x1f4;return function(_0x1e6577){logger['error'](_0x1e6577[_0x5431('0x2c')]);if(_0x1e6577[_0x5431('0x2d')]){delete _0x1e6577['name'];}_0x1eb265[_0x5431('0x1e')](_0x9f3a87)[_0x5431('0x2e')](_0x1e6577);};}exports[_0x5431('0x2f')]=function(_0x3ec403,_0x5a3a97){var _0x52f799={},_0x3c2fb5={},_0x56f24c={'count':0x0,'rows':[]};var _0x1ec2be=_[_0x5431('0x30')](db[_0x5431('0x31')][_0x5431('0x32')],function(_0x4edea1){return{'name':_0x4edea1[_0x5431('0x33')],'type':_0x4edea1[_0x5431('0x34')][_0x5431('0x35')]};});_0x3c2fb5[_0x5431('0x36')]=_[_0x5431('0x30')](_0x1ec2be,_0x5431('0x2d'));_0x3c2fb5['query']=_[_0x5431('0x37')](_0x3ec403['query']);_0x3c2fb5[_0x5431('0x38')]=_['intersection'](_0x3c2fb5[_0x5431('0x36')],_0x3c2fb5[_0x5431('0x39')]);_0x52f799[_0x5431('0x3a')]=_['intersection'](_0x3c2fb5[_0x5431('0x36')],qs[_0x5431('0x3b')](_0x3ec403[_0x5431('0x39')][_0x5431('0x3b')]));_0x52f799[_0x5431('0x3a')]=_0x52f799[_0x5431('0x3a')][_0x5431('0x3c')]?_0x52f799[_0x5431('0x3a')]:_0x3c2fb5[_0x5431('0x36')];if(!_0x3ec403[_0x5431('0x39')]['hasOwnProperty'](_0x5431('0x3d'))){_0x52f799['limit']=qs[_0x5431('0x22')](_0x3ec403['query']['limit']);_0x52f799[_0x5431('0x20')]=qs['offset'](_0x3ec403['query']['offset']);}_0x52f799[_0x5431('0x3e')]=qs[_0x5431('0x3f')](_0x3ec403[_0x5431('0x39')][_0x5431('0x3f')]);_0x52f799[_0x5431('0x40')]=qs[_0x5431('0x38')](_[_0x5431('0x41')](_0x3ec403[_0x5431('0x39')],_0x3c2fb5[_0x5431('0x38')]),_0x1ec2be);if(_0x3ec403['query']['filter']){_0x52f799[_0x5431('0x40')]=_[_0x5431('0x42')](_0x52f799[_0x5431('0x40')],{'$or':_[_0x5431('0x30')](_0x1ec2be,function(_0x2e3da1){if(_0x2e3da1[_0x5431('0x34')]!==_0x5431('0x43')){var _0x4e38a5={};_0x4e38a5[_0x2e3da1['name']]={'$like':'%'+_0x3ec403[_0x5431('0x39')][_0x5431('0x44')]+'%'};return _0x4e38a5;}})});}_0x52f799=_['merge']({},_0x52f799,_0x3ec403[_0x5431('0x45')]);var _0x33e635={'where':_0x52f799['where']};return db['ChatInternalMessage'][_0x5431('0x23')](_0x33e635)[_0x5431('0x29')](function(_0x37ed32){_0x56f24c[_0x5431('0x23')]=_0x37ed32;if(_0x3ec403[_0x5431('0x39')][_0x5431('0x46')]){_0x52f799[_0x5431('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5431('0x48')](_0x52f799);})[_0x5431('0x29')](function(_0x421372){_0x56f24c['rows']=_0x421372;return _0x56f24c;})[_0x5431('0x29')](respondWithFilteredResult(_0x5a3a97,_0x52f799))[_0x5431('0x49')](handleError(_0x5a3a97,null));};exports[_0x5431('0x4a')]=function(_0x362e00,_0x7d131d){var _0x159c61={'raw':!![],'where':{'id':_0x362e00[_0x5431('0x4b')]['id']}},_0x57c5bd={};_0x57c5bd[_0x5431('0x36')]=_[_0x5431('0x37')](db[_0x5431('0x31')][_0x5431('0x32')]);_0x57c5bd['query']=_['keys'](_0x362e00[_0x5431('0x39')]);_0x57c5bd[_0x5431('0x38')]=_[_0x5431('0x4c')](_0x57c5bd[_0x5431('0x36')],_0x57c5bd[_0x5431('0x39')]);_0x159c61[_0x5431('0x3a')]=_['intersection'](_0x57c5bd[_0x5431('0x36')],qs[_0x5431('0x3b')](_0x362e00[_0x5431('0x39')][_0x5431('0x3b')]));_0x159c61['attributes']=_0x159c61[_0x5431('0x3a')][_0x5431('0x3c')]?_0x159c61['attributes']:_0x57c5bd['model'];if(_0x362e00[_0x5431('0x39')]['includeAll']){_0x159c61[_0x5431('0x47')]=[{'all':!![]}];}_0x159c61=_[_0x5431('0x42')]({},_0x159c61,_0x362e00[_0x5431('0x45')]);return db[_0x5431('0x31')][_0x5431('0x4d')](_0x159c61)[_0x5431('0x29')](handleEntityNotFound(_0x7d131d,null))[_0x5431('0x29')](respondWithResult(_0x7d131d,null))[_0x5431('0x49')](handleError(_0x7d131d,null));};exports['create']=function(_0x53d0cd,_0x35c869){return db[_0x5431('0x31')][_0x5431('0x4e')](_0x53d0cd[_0x5431('0x4f')],{})[_0x5431('0x29')](respondWithResult(_0x35c869,0xc9))[_0x5431('0x49')](handleError(_0x35c869,null));};exports[_0x5431('0x28')]=function(_0x5a83b5,_0x2765e7){if(_0x5a83b5['body']['id']){delete _0x5a83b5[_0x5431('0x4f')]['id'];}return db[_0x5431('0x31')][_0x5431('0x4d')]({'where':{'id':_0x5a83b5[_0x5431('0x4b')]['id']}})[_0x5431('0x29')](handleEntityNotFound(_0x2765e7,null))['then'](saveUpdates(_0x5a83b5[_0x5431('0x4f')],null))[_0x5431('0x29')](respondWithResult(_0x2765e7,null))['catch'](handleError(_0x2765e7,null));};exports[_0x5431('0x2a')]=function(_0x319fc1,_0x406d13){return db[_0x5431('0x31')][_0x5431('0x4d')]({'where':{'id':_0x319fc1[_0x5431('0x4b')]['id']}})[_0x5431('0x29')](handleEntityNotFound(_0x406d13,null))['then'](removeEntity(_0x406d13,null))[_0x5431('0x49')](handleError(_0x406d13,null));};exports[_0x5431('0x50')]=function(_0x37c751,_0x21594f){return db[_0x5431('0x31')][_0x5431('0x50')]()[_0x5431('0x29')](respondWithResult(_0x21594f,null))[_0x5431('0x49')](handleError(_0x21594f,null));};function wrapUser(_0x1be936){return function(_0x185138){var _0x1f95d7=_0x1be936[_0x5431('0x51')]({'plain':!![]});_0x1f95d7[_0x5431('0x52')]=[];if(_0x185138){_0x1f95d7[_0x5431('0x53')]=_0x185138[_0x5431('0x54')];_0x1f95d7['lastMessage']=_0x185138;}else{_0x1f95d7[_0x5431('0x53')]=moment(0x0)[_0x5431('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f95d7[_0x5431('0x56')]={};}return _0x1f95d7;};}exports['getUsers']=function(_0x5ca8bf,_0x217fb5,_0x42616d){var _0x5eea47=[];return db[_0x5431('0x57')][_0x5431('0x48')]({'where':{'role':['agent',_0x5431('0x58'),_0x5431('0x59')]},'attributes':['id','fullname',_0x5431('0x2d'),_0x5431('0x5a'),'userpic','internal',_0x5431('0x5b'),_0x5431('0x5c'),'allowmessenger',_0x5431('0x5d')],'order':qs['sort'](_0x5431('0x5e')),'include':[{'model':db[_0x5431('0x5f')],'as':'VoiceQueues','attributes':['id',_0x5431('0x2d'),_0x5431('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x3c684b){if(_0x3c684b){var _0x3ebf2f=_0x5ca8bf['user']['get']({'plain':!![]});if(!_0x3ebf2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ebf2f[_0x5431('0x5a')]===_0x5431('0x59')){return db[_0x5431('0x60')]['find']({'where':{'name':_0x5431('0x61'),'userProfileId':_0x3ebf2f[_0x5431('0x62')]},'raw':!![]})[_0x5431('0x29')](function(_0x354835){if(_0x354835){if(_0x354835[_0x5431('0x63')]===0x0){return db['UserProfileResource'][_0x5431('0x48')]({'where':{'sectionId':_0x354835['id']},'raw':!![]})[_0x5431('0x29')](function(_0x4a999f){var _0x304aa9=[];if(_['isEmpty'](_0x4a999f)){_0x304aa9=_[_0x5431('0x44')](_0x3c684b,function(_0x5cb5a6){if(_0x5cb5a6[_0x5431('0x5a')]!==_0x5431('0x64')){return _0x5cb5a6;}});return _0x304aa9;}else{for(var _0x5631da=0x0;_0x5631da<_0x3c684b[_0x5431('0x3c')];_0x5631da++){var _0x47a51d=_0x3c684b[_0x5631da];if(_0x47a51d['role']===_0x5431('0x64')){var _0x209799=_[_0x5431('0x4d')](_0x4a999f,function(_0x3acbff){return _0x3acbff[_0x5431('0x65')]===_0x47a51d['id'];});if(_0x209799)_0x304aa9[_0x5431('0x66')](_0x47a51d);}else{_0x304aa9['push'](_0x47a51d);}}return _0x304aa9;}});}else{return _0x3c684b;}}else{var _0xfaafc=_[_0x5431('0x44')](_0x3c684b,function(_0x50a777){if(_0x50a777[_0x5431('0x5a')]!==_0x5431('0x64')){return _0x50a777;}});return _0xfaafc;}});}else{return _0x3c684b;}}})[_0x5431('0x29')](function(_0x11d170){var _0x4eab19=[];if(_0x11d170){_0x5eea47=_0x11d170;for(var _0x8a01a1=0x0;_0x8a01a1<_0x11d170['length'];_0x8a01a1+=0x1){_0x5eea47[_0x8a01a1]['messages']=[];_0x4eab19[_0x5431('0x66')](db[_0x5431('0x31')]['find']({'where':{'FromId':[_0x5ca8bf[_0x5431('0x59')]['id'],_0x11d170[_0x8a01a1]['id']],'ToId':[_0x5ca8bf[_0x5431('0x59')]['id'],_0x11d170[_0x8a01a1]['id']],'ChatGroupId':null},'attributes':['id',_0x5431('0x54'),'FromId',_0x5431('0x67'),_0x5431('0x68'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x11d170[_0x8a01a1])));}return BPromise[_0x5431('0x69')](_0x4eab19);}return[];})[_0x5431('0x29')](function(_0x439d5c){return{'rows':_0x439d5c,'count':_0x439d5c[_0x5431('0x3c')]};})['then'](respondWithResult(_0x217fb5,null))[_0x5431('0x49')](handleError(_0x217fb5,null));}; \ No newline at end of file +var _0x4cad=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','user','fullname','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','filter','createdAt','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x2b824d,_0x424788){var _0x573ed4=function(_0x2c312c){while(--_0x2c312c){_0x2b824d['push'](_0x2b824d['shift']());}};_0x573ed4(++_0x424788);}(_0x4cad,0x1e5));var _0xd4ca=function(_0x1204ac,_0x36fd4d){_0x1204ac=_0x1204ac-0x0;var _0x429afa=_0x4cad[_0x1204ac];return _0x429afa;};'use strict';var emlformat=require(_0xd4ca('0x0'));var rimraf=require(_0xd4ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4ca('0x2'));var rp=require(_0xd4ca('0x3'));var moment=require('moment');var BPromise=require(_0xd4ca('0x4'));var Mustache=require(_0xd4ca('0x5'));var util=require(_0xd4ca('0x6'));var path=require(_0xd4ca('0x7'));var sox=require(_0xd4ca('0x8'));var csv=require(_0xd4ca('0x9'));var ejs=require(_0xd4ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4ca('0xb'));var squel=require(_0xd4ca('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4ca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd4ca('0x9'));var querystring=require('querystring');var Papa=require(_0xd4ca('0xe'));var Redis=require(_0xd4ca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd4ca('0x10'));var as=require(_0xd4ca('0x11'));var hardwareService=require(_0xd4ca('0x12'));var logger=require(_0xd4ca('0x13'))(_0xd4ca('0x14'));var utils=require(_0xd4ca('0x15'));var config=require(_0xd4ca('0x16'));var licenseUtil=require(_0xd4ca('0x17'));var db=require(_0xd4ca('0x18'))['db'];config[_0xd4ca('0x19')]=_[_0xd4ca('0x1a')](config[_0xd4ca('0x19')],{'host':_0xd4ca('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4ca('0x19')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x47b9bc,_0x11a379){_0x11a379=_0x11a379||0xcc;return function(_0x488cc8){if(_0x488cc8){return _0x47b9bc[_0xd4ca('0x1c')](_0x11a379);}return _0x47b9bc[_0xd4ca('0x1d')](_0x11a379)[_0xd4ca('0x1e')]();};}function respondWithResult(_0x55857b,_0x44d34d){_0x44d34d=_0x44d34d||0xc8;return function(_0x468b87){if(_0x468b87){return _0x55857b[_0xd4ca('0x1d')](_0x44d34d)['json'](_0x468b87);}};}function respondWithFilteredResult(_0x19feb0,_0x342e62){return function(_0x3881d0){if(_0x3881d0){var _0x412dd6=typeof _0x342e62[_0xd4ca('0x1f')]===_0xd4ca('0x20')&&typeof _0x342e62[_0xd4ca('0x21')]===_0xd4ca('0x20');var _0x27c50b=_0x3881d0['count'];var _0x4e328b=_0x412dd6?0x0:_0x342e62['offset'];var _0x22432e=_0x412dd6?_0x3881d0[_0xd4ca('0x22')]:_0x342e62[_0xd4ca('0x1f')]+_0x342e62[_0xd4ca('0x21')];var _0x1f04e7;if(_0x22432e>=_0x27c50b){_0x22432e=_0x27c50b;_0x1f04e7=0xc8;}else{_0x1f04e7=0xce;}_0x19feb0[_0xd4ca('0x1d')](_0x1f04e7);return _0x19feb0[_0xd4ca('0x23')]('Content-Range',_0x4e328b+'-'+_0x22432e+'/'+_0x27c50b)['json'](_0x3881d0);}return null;};}function patchUpdates(_0x1f15e3){return function(_0x91d66d){try{jsonpatch[_0xd4ca('0x24')](_0x91d66d,_0x1f15e3,!![]);}catch(_0x29044c){return BPromise[_0xd4ca('0x25')](_0x29044c);}return _0x91d66d['save']();};}function saveUpdates(_0x217f14,_0x309838){return function(_0x9a6993){if(_0x9a6993){return _0x9a6993[_0xd4ca('0x26')](_0x217f14)[_0xd4ca('0x27')](function(_0x3b252e){return _0x3b252e;});}return null;};}function removeEntity(_0x4340e3,_0x45125e){return function(_0x1539ce){if(_0x1539ce){return _0x1539ce[_0xd4ca('0x28')]()[_0xd4ca('0x27')](function(){_0x4340e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20a984,_0x18c326){return function(_0x2276ac){if(!_0x2276ac){_0x20a984['sendStatus'](0x194);}return _0x2276ac;};}function handleError(_0x5d45f2,_0x3c9378){_0x3c9378=_0x3c9378||0x1f4;return function(_0x28e5ba){logger[_0xd4ca('0x29')](_0x28e5ba[_0xd4ca('0x2a')]);if(_0x28e5ba[_0xd4ca('0x2b')]){delete _0x28e5ba[_0xd4ca('0x2b')];}_0x5d45f2[_0xd4ca('0x1d')](_0x3c9378)['send'](_0x28e5ba);};}exports[_0xd4ca('0x2c')]=function(_0x255814,_0x22b9d){var _0x4580c6={},_0xd858f={},_0x21a81f={'count':0x0,'rows':[]};var _0x128c8f=_[_0xd4ca('0x2d')](db[_0xd4ca('0x2e')][_0xd4ca('0x2f')],function(_0xcb5070){return{'name':_0xcb5070[_0xd4ca('0x30')],'type':_0xcb5070[_0xd4ca('0x31')][_0xd4ca('0x32')]};});_0xd858f[_0xd4ca('0x33')]=_[_0xd4ca('0x2d')](_0x128c8f,_0xd4ca('0x2b'));_0xd858f[_0xd4ca('0x34')]=_['keys'](_0x255814[_0xd4ca('0x34')]);_0xd858f[_0xd4ca('0x35')]=_[_0xd4ca('0x36')](_0xd858f['model'],_0xd858f[_0xd4ca('0x34')]);_0x4580c6[_0xd4ca('0x37')]=_[_0xd4ca('0x36')](_0xd858f[_0xd4ca('0x33')],qs[_0xd4ca('0x38')](_0x255814['query'][_0xd4ca('0x38')]));_0x4580c6[_0xd4ca('0x37')]=_0x4580c6[_0xd4ca('0x37')][_0xd4ca('0x39')]?_0x4580c6['attributes']:_0xd858f[_0xd4ca('0x33')];if(!_0x255814['query']['hasOwnProperty'](_0xd4ca('0x3a'))){_0x4580c6['limit']=qs[_0xd4ca('0x21')](_0x255814['query'][_0xd4ca('0x21')]);_0x4580c6[_0xd4ca('0x1f')]=qs[_0xd4ca('0x1f')](_0x255814['query'][_0xd4ca('0x1f')]);}_0x4580c6[_0xd4ca('0x3b')]=qs[_0xd4ca('0x3c')](_0x255814[_0xd4ca('0x34')]['sort']);_0x4580c6[_0xd4ca('0x3d')]=qs[_0xd4ca('0x35')](_[_0xd4ca('0x3e')](_0x255814[_0xd4ca('0x34')],_0xd858f[_0xd4ca('0x35')]),_0x128c8f);if(_0x255814[_0xd4ca('0x34')]['filter']){_0x4580c6['where']=_[_0xd4ca('0x3f')](_0x4580c6[_0xd4ca('0x3d')],{'$or':_[_0xd4ca('0x2d')](_0x128c8f,function(_0x3c28a1){if(_0x3c28a1[_0xd4ca('0x31')]!==_0xd4ca('0x40')){var _0x594727={};_0x594727[_0x3c28a1[_0xd4ca('0x2b')]]={'$like':'%'+_0x255814[_0xd4ca('0x34')]['filter']+'%'};return _0x594727;}})});}_0x4580c6=_[_0xd4ca('0x3f')]({},_0x4580c6,_0x255814[_0xd4ca('0x41')]);var _0xa65643={'where':_0x4580c6['where']};return db['ChatInternalMessage']['count'](_0xa65643)[_0xd4ca('0x27')](function(_0x2ee31a){_0x21a81f[_0xd4ca('0x22')]=_0x2ee31a;if(_0x255814[_0xd4ca('0x34')][_0xd4ca('0x42')]){_0x4580c6[_0xd4ca('0x43')]=[{'all':!![]}];}return db[_0xd4ca('0x2e')]['findAll'](_0x4580c6);})[_0xd4ca('0x27')](function(_0x49cd1c){_0x21a81f[_0xd4ca('0x44')]=_0x49cd1c;return _0x21a81f;})[_0xd4ca('0x27')](respondWithFilteredResult(_0x22b9d,_0x4580c6))[_0xd4ca('0x45')](handleError(_0x22b9d,null));};exports['show']=function(_0x29e52c,_0x52291f){var _0x5be141={'raw':!![],'where':{'id':_0x29e52c[_0xd4ca('0x46')]['id']}},_0x1facc0={};_0x1facc0[_0xd4ca('0x33')]=_[_0xd4ca('0x47')](db[_0xd4ca('0x2e')][_0xd4ca('0x2f')]);_0x1facc0[_0xd4ca('0x34')]=_[_0xd4ca('0x47')](_0x29e52c[_0xd4ca('0x34')]);_0x1facc0['filters']=_[_0xd4ca('0x36')](_0x1facc0[_0xd4ca('0x33')],_0x1facc0[_0xd4ca('0x34')]);_0x5be141[_0xd4ca('0x37')]=_[_0xd4ca('0x36')](_0x1facc0[_0xd4ca('0x33')],qs[_0xd4ca('0x38')](_0x29e52c[_0xd4ca('0x34')][_0xd4ca('0x38')]));_0x5be141[_0xd4ca('0x37')]=_0x5be141[_0xd4ca('0x37')][_0xd4ca('0x39')]?_0x5be141[_0xd4ca('0x37')]:_0x1facc0[_0xd4ca('0x33')];if(_0x29e52c[_0xd4ca('0x34')]['includeAll']){_0x5be141[_0xd4ca('0x43')]=[{'all':!![]}];}_0x5be141=_[_0xd4ca('0x3f')]({},_0x5be141,_0x29e52c[_0xd4ca('0x41')]);return db['ChatInternalMessage'][_0xd4ca('0x48')](_0x5be141)['then'](handleEntityNotFound(_0x52291f,null))['then'](respondWithResult(_0x52291f,null))[_0xd4ca('0x45')](handleError(_0x52291f,null));};exports[_0xd4ca('0x49')]=function(_0x3692fc,_0x931c13){return db[_0xd4ca('0x2e')][_0xd4ca('0x49')](_0x3692fc[_0xd4ca('0x4a')],{})['then'](respondWithResult(_0x931c13,0xc9))['catch'](handleError(_0x931c13,null));};exports['update']=function(_0x212978,_0x5a8c42){if(_0x212978[_0xd4ca('0x4a')]['id']){delete _0x212978[_0xd4ca('0x4a')]['id'];}return db[_0xd4ca('0x2e')]['find']({'where':{'id':_0x212978['params']['id']}})[_0xd4ca('0x27')](handleEntityNotFound(_0x5a8c42,null))[_0xd4ca('0x27')](saveUpdates(_0x212978['body'],null))[_0xd4ca('0x27')](respondWithResult(_0x5a8c42,null))[_0xd4ca('0x45')](handleError(_0x5a8c42,null));};exports['destroy']=function(_0x184c1f,_0xa84530){return db[_0xd4ca('0x2e')][_0xd4ca('0x48')]({'where':{'id':_0x184c1f[_0xd4ca('0x46')]['id']}})[_0xd4ca('0x27')](handleEntityNotFound(_0xa84530,null))[_0xd4ca('0x27')](removeEntity(_0xa84530,null))[_0xd4ca('0x45')](handleError(_0xa84530,null));};exports[_0xd4ca('0x4b')]=function(_0x3a4892,_0x2fcb05){return db[_0xd4ca('0x2e')]['describe']()[_0xd4ca('0x27')](respondWithResult(_0x2fcb05,null))[_0xd4ca('0x45')](handleError(_0x2fcb05,null));};function wrapUser(_0x3c976d){return function(_0x597a3d){var _0x171a6d=_0x3c976d['get']({'plain':!![]});_0x171a6d[_0xd4ca('0x4c')]=[];if(_0x597a3d){_0x171a6d[_0xd4ca('0x4d')]=_0x597a3d['createdAt'];_0x171a6d[_0xd4ca('0x4e')]=_0x597a3d;}else{_0x171a6d[_0xd4ca('0x4d')]=moment(0x0)[_0xd4ca('0x4f')](_0xd4ca('0x50'));_0x171a6d['lastMessage']={};}return _0x171a6d;};}exports[_0xd4ca('0x51')]=function(_0x2bd263,_0x3f02b9,_0x11dab1){var _0x4ece7c=[];return db['User'][_0xd4ca('0x52')]({'where':{'role':[_0xd4ca('0x53'),'admin',_0xd4ca('0x54')]},'attributes':['id',_0xd4ca('0x55'),_0xd4ca('0x2b'),'role',_0xd4ca('0x56'),_0xd4ca('0x57'),_0xd4ca('0x58'),_0xd4ca('0x59'),'allowmessenger',_0xd4ca('0x5a')],'order':qs[_0xd4ca('0x3c')]('-online'),'include':[{'model':db[_0xd4ca('0x5b')],'as':_0xd4ca('0x5c'),'attributes':['id','name',_0xd4ca('0x31')],'through':{'attributes':[]}}]})[_0xd4ca('0x27')](function(_0x44f656){if(_0x44f656){var _0x31e5fd=_0x2bd263[_0xd4ca('0x54')]['get']({'plain':!![]});if(!_0x31e5fd)throw new Error(_0xd4ca('0x5d'));if(_0x31e5fd[_0xd4ca('0x5e')]===_0xd4ca('0x54')){return db[_0xd4ca('0x5f')][_0xd4ca('0x48')]({'where':{'name':_0xd4ca('0x60'),'userProfileId':_0x31e5fd[_0xd4ca('0x61')]},'raw':!![]})[_0xd4ca('0x27')](function(_0x38bffd){if(_0x38bffd){if(_0x38bffd[_0xd4ca('0x62')]===0x0){return db[_0xd4ca('0x63')][_0xd4ca('0x52')]({'where':{'sectionId':_0x38bffd['id']},'raw':!![]})['then'](function(_0xc7845d){var _0x3eda99=[];if(_[_0xd4ca('0x64')](_0xc7845d)){_0x3eda99=_['filter'](_0x44f656,function(_0x29da09){if(_0x29da09[_0xd4ca('0x5e')]!==_0xd4ca('0x53')){return _0x29da09;}});return _0x3eda99;}else{for(var _0x349a0f=0x0;_0x349a0f<_0x44f656[_0xd4ca('0x39')];_0x349a0f++){var _0x4d79b6=_0x44f656[_0x349a0f];if(_0x4d79b6[_0xd4ca('0x5e')]==='agent'){var _0xa6c936=_['find'](_0xc7845d,function(_0x2ff998){return _0x2ff998[_0xd4ca('0x65')]===_0x4d79b6['id'];});if(_0xa6c936)_0x3eda99['push'](_0x4d79b6);}else{_0x3eda99[_0xd4ca('0x66')](_0x4d79b6);}}return _0x3eda99;}});}else{return _0x44f656;}}else{var _0x40b614=_[_0xd4ca('0x67')](_0x44f656,function(_0x66d55a){if(_0x66d55a['role']!=='agent'){return _0x66d55a;}});return _0x40b614;}});}else{return _0x44f656;}}})['then'](function(_0xaafc61){var _0x497ad6=[];if(_0xaafc61){_0x4ece7c=_0xaafc61;for(var _0x2bae35=0x0;_0x2bae35<_0xaafc61[_0xd4ca('0x39')];_0x2bae35+=0x1){_0x4ece7c[_0x2bae35]['messages']=[];_0x497ad6['push'](db[_0xd4ca('0x2e')][_0xd4ca('0x48')]({'where':{'FromId':[_0x2bd263[_0xd4ca('0x54')]['id'],_0xaafc61[_0x2bae35]['id']],'ToId':[_0x2bd263[_0xd4ca('0x54')]['id'],_0xaafc61[_0x2bae35]['id']],'ChatGroupId':null},'attributes':['id',_0xd4ca('0x68'),'FromId',_0xd4ca('0x69'),_0xd4ca('0x6a'),_0xd4ca('0x4a')],'order':qs[_0xd4ca('0x3c')](_0xd4ca('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xaafc61[_0x2bae35])));}return BPromise[_0xd4ca('0x6c')](_0x497ad6);}return[];})[_0xd4ca('0x27')](function(_0x2281bb){return{'rows':_0x2281bb,'count':_0x2281bb[_0xd4ca('0x39')]};})[_0xd4ca('0x27')](respondWithResult(_0x3f02b9,null))[_0xd4ca('0x45')](handleError(_0x3f02b9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7d96255..9f14790 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 _0x3adb=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x4c157e,_0x10526a){var _0x293d33=function(_0x57c424){while(--_0x57c424){_0x4c157e['push'](_0x4c157e['shift']());}};_0x293d33(++_0x10526a);}(_0x3adb,0xd3));var _0xb3ad=function(_0x3e2212,_0x39d19d){_0x3e2212=_0x3e2212-0x0;var _0x4ff8c7=_0x3adb[_0x3e2212];return _0x4ff8c7;};'use strict';var EventEmitter=require(_0xb3ad('0x0'));var ChatInternalMessage=require(_0xb3ad('0x1'))['db'][_0xb3ad('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb3ad('0x3')](0x0);var events={'afterCreate':_0xb3ad('0x4'),'afterUpdate':'update','afterDestroy':_0xb3ad('0x5')};function emitEvent(_0x411222){return function(_0x3a11d3,_0x4025d3,_0x5f2038){ChatInternalMessageEvents[_0xb3ad('0x6')](_0x411222+':'+_0x3a11d3['id'],_0x3a11d3);ChatInternalMessageEvents[_0xb3ad('0x6')](_0x411222,_0x3a11d3);_0x5f2038(null);};}for(var e in events){if(events[_0xb3ad('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb3ad('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x3266=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3266,0x6a));var _0x6326=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x3266[_0x580647];return _0x5f0792;};'use strict';var EventEmitter=require(_0x6326('0x0'));var ChatInternalMessage=require(_0x6326('0x1'))['db'][_0x6326('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6326('0x3')](0x0);var events={'afterCreate':_0x6326('0x4'),'afterUpdate':_0x6326('0x5'),'afterDestroy':_0x6326('0x6')};function emitEvent(_0x365dbf){return function(_0x265264,_0x5a6b4d,_0x30b22e){ChatInternalMessageEvents['emit'](_0x365dbf+':'+_0x265264['id'],_0x265264);ChatInternalMessageEvents[_0x6326('0x7')](_0x365dbf,_0x265264);_0x30b22e(null);};}for(var e in events){if(events[_0x6326('0x8')](e)){var event=events[e];ChatInternalMessage[_0x6326('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8258390..10968a8 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 _0x4f94=['./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x318e54,_0x468a09){var _0x528c14=function(_0x266c42){while(--_0x266c42){_0x318e54['push'](_0x318e54['shift']());}};_0x528c14(++_0x468a09);}(_0x4f94,0x16d));var _0x44f9=function(_0x14075f,_0x567a02){_0x14075f=_0x14075f-0x0;var _0x3e76a8=_0x4f94[_0x14075f];return _0x3e76a8;};'use strict';var _=require('lodash');var util=require(_0x44f9('0x0'));var logger=require(_0x44f9('0x1'))(_0x44f9('0x2'));var moment=require('moment');var BPromise=require(_0x44f9('0x3'));var rp=require(_0x44f9('0x4'));var fs=require('fs');var path=require(_0x44f9('0x5'));var rimraf=require('rimraf');var config=require(_0x44f9('0x6'));var attributes=require(_0x44f9('0x7'));module[_0x44f9('0x8')]=function(_0x4a4b80,_0x383e9f){return _0x4a4b80[_0x44f9('0x9')](_0x44f9('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x44f9('0xb')});}; \ No newline at end of file +var _0x99c9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x3df3ec,_0xd7156d){var _0x1666ac=function(_0xd8be4d){while(--_0xd8be4d){_0x3df3ec['push'](_0x3df3ec['shift']());}};_0x1666ac(++_0xd7156d);}(_0x99c9,0xe9));var _0x999c=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x99c9[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var logger=require(_0x999c('0x2'))(_0x999c('0x3'));var moment=require(_0x999c('0x4'));var BPromise=require('bluebird');var rp=require(_0x999c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x999c('0x6'));var config=require(_0x999c('0x7'));var attributes=require(_0x999c('0x8'));module['exports']=function(_0x235904,_0x2eb49c){return _0x235904['define']('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x999c('0x9'),'collate':_0x999c('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index a6d69ce..ccc4dc3 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 _0x4ed0=['./chatInternalMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4ed0,0x79));var _0x04ed=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ed0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x04ed('0x0'));var util=require('util');var moment=require(_0x04ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x04ed('0x2'));var fs=require('fs');var Redis=require(_0x04ed('0x3'));var db=require(_0x04ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x04ed('0x5'))(_0x04ed('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ed('0x7'));var client=jayson[_0x04ed('0x8')][_0x04ed('0x9')]({'port':0x232a});config[_0x04ed('0xa')]=_[_0x04ed('0xb')](config[_0x04ed('0xa')],{'host':_0x04ed('0xc'),'port':0x18eb});var socket=require(_0x04ed('0xd'))(new Redis(config[_0x04ed('0xa')]));require(_0x04ed('0xe'))[_0x04ed('0xf')](socket);function respondWithRpcPromise(_0x4351ab,_0xc00c5c,_0x74f626){return new BPromise(function(_0x54d8e6,_0xdc4ea1){return client[_0x04ed('0x10')](_0x4351ab,_0x74f626)[_0x04ed('0x11')](function(_0x5e0c16){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0xc00c5c,_0x04ed('0x12'));logger[_0x04ed('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xc00c5c,_0x04ed('0x12'),JSON[_0x04ed('0x14')](_0x5e0c16));if(_0x5e0c16[_0x04ed('0x15')]){if(_0x5e0c16['error'][_0x04ed('0x16')]===0x1f4){logger[_0x04ed('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0xc00c5c,_0x5e0c16[_0x04ed('0x15')]['message']);return _0xdc4ea1(_0x5e0c16[_0x04ed('0x15')][_0x04ed('0x17')]);}logger[_0x04ed('0x15')](_0x04ed('0x18'),_0xc00c5c,_0x5e0c16[_0x04ed('0x15')][_0x04ed('0x17')]);return _0x54d8e6(_0x5e0c16['error']['message']);}else{logger[_0x04ed('0x19')](_0x04ed('0x18'),_0xc00c5c,_0x04ed('0x12'));_0x54d8e6(_0x5e0c16['result']['message']);}})[_0x04ed('0x1a')](function(_0x270ccc){logger[_0x04ed('0x15')](_0x04ed('0x18'),_0xc00c5c,_0x270ccc);_0xdc4ea1(_0x270ccc);});});} \ No newline at end of file +var _0xd4f4=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd4f4,0x6d));var _0x4d4f=function(_0x34addd,_0xa05fe4){_0x34addd=_0x34addd-0x0;var _0x1c9500=_0xd4f4[_0x34addd];return _0x1c9500;};'use strict';var _=require(_0x4d4f('0x0'));var util=require('util');var moment=require(_0x4d4f('0x1'));var BPromise=require(_0x4d4f('0x2'));var rs=require(_0x4d4f('0x3'));var fs=require('fs');var Redis=require(_0x4d4f('0x4'));var db=require(_0x4d4f('0x5'))['db'];var utils=require(_0x4d4f('0x6'));var logger=require('../../config/logger')(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var jayson=require(_0x4d4f('0x9'));var client=jayson[_0x4d4f('0xa')][_0x4d4f('0xb')]({'port':0x232a});config[_0x4d4f('0xc')]=_['defaults'](config[_0x4d4f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d4f('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x4d4f('0xe')](socket);function respondWithRpcPromise(_0xe45812,_0x4c3ce9,_0x25458c){return new BPromise(function(_0x2201c4,_0x5993a3){return client[_0x4d4f('0xf')](_0xe45812,_0x25458c)[_0x4d4f('0x10')](function(_0x3d325d){logger[_0x4d4f('0x11')](_0x4d4f('0x12'),_0x4c3ce9,'request\x20sent');logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0x4c3ce9,_0x4d4f('0x15'),JSON[_0x4d4f('0x16')](_0x3d325d));if(_0x3d325d[_0x4d4f('0x17')]){if(_0x3d325d[_0x4d4f('0x17')][_0x4d4f('0x18')]===0x1f4){logger[_0x4d4f('0x17')](_0x4d4f('0x12'),_0x4c3ce9,_0x3d325d[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x5993a3(_0x3d325d[_0x4d4f('0x17')]['message']);}logger['error'](_0x4d4f('0x12'),_0x4c3ce9,_0x3d325d[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x2201c4(_0x3d325d[_0x4d4f('0x17')][_0x4d4f('0x19')]);}else{logger[_0x4d4f('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4c3ce9,_0x4d4f('0x15'));_0x2201c4(_0x3d325d[_0x4d4f('0x1a')][_0x4d4f('0x19')]);}})['catch'](function(_0x550df7){logger[_0x4d4f('0x17')](_0x4d4f('0x12'),_0x4c3ce9,_0x550df7);_0x5993a3(_0x550df7);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 8102e2f..88f9c11 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 _0x8fb4=['remove','update','emit','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x8fb4,0x156));var _0x48fb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fb4[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInternalMessageEvents=require(_0x48fb('0x0'));var events=['save',_0x48fb('0x1'),_0x48fb('0x2')];function createListener(_0x4f857b,_0x2a4bae){return function(_0x1db893){_0x2a4bae[_0x48fb('0x3')](_0x4f857b,_0x1db893);};}function removeListener(_0x2dbe46,_0x1a76ae){return function(){ChatInternalMessageEvents['removeListener'](_0x2dbe46,_0x1a76ae);};}exports[_0x48fb('0x4')]=function(_0x5e3ea0){for(var _0x452acf=0x0,_0x513eb2=events[_0x48fb('0x5')];_0x452acf<_0x513eb2;_0x452acf++){var _0x413cf9=events[_0x452acf];var _0x1ede6c=createListener(_0x48fb('0x6')+_0x413cf9,_0x5e3ea0);ChatInternalMessageEvents['on'](_0x413cf9,_0x1ede6c);}}; \ No newline at end of file +var _0xf164=['length','./chatInternalMessage.events','remove','update','removeListener','register'];(function(_0x34799f,_0xeeb8d9){var _0x348163=function(_0x892c78){while(--_0x892c78){_0x34799f['push'](_0x34799f['shift']());}};_0x348163(++_0xeeb8d9);}(_0xf164,0x12d));var _0x4f16=function(_0x4cb03b,_0x47d402){_0x4cb03b=_0x4cb03b-0x0;var _0x132ba4=_0xf164[_0x4cb03b];return _0x132ba4;};'use strict';var ChatInternalMessageEvents=require(_0x4f16('0x0'));var events=['save',_0x4f16('0x1'),_0x4f16('0x2')];function createListener(_0x9b8b0c,_0x3de103){return function(_0x1b14fb){_0x3de103['emit'](_0x9b8b0c,_0x1b14fb);};}function removeListener(_0x47e579,_0x3a0b85){return function(){ChatInternalMessageEvents[_0x4f16('0x3')](_0x47e579,_0x3a0b85);};}exports[_0x4f16('0x4')]=function(_0x281100){for(var _0x6fb05=0x0,_0x3e5df4=events[_0x4f16('0x5')];_0x6fb05<_0x3e5df4;_0x6fb05++){var _0x4fafd4=events[_0x6fb05];var _0x5d945e=createListener('chatInternalMessage:'+_0x4fafd4,_0x281100);ChatInternalMessageEvents['on'](_0x4fafd4,_0x5d945e);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c5e8b3d..b3629e4 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 _0xc149=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','/:id','show','put','util','path','express','fs-extra','../../components/auth/service'];(function(_0x509482,_0x5ab7e7){var _0x35f955=function(_0x58d5f9){while(--_0x58d5f9){_0x509482['push'](_0x509482['shift']());}};_0x35f955(++_0x5ab7e7);}(_0xc149,0x73));var _0x9c14=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc149[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x9c14('0x0'));var path=require(_0x9c14('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c14('0x2'));var router=express['Router']();var fs_extra=require(_0x9c14('0x3'));var auth=require(_0x9c14('0x4'));var interaction=require(_0x9c14('0x5'));var config=require(_0x9c14('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x9c14('0x7')]('/',auth[_0x9c14('0x8')](),controller[_0x9c14('0x9')]);router[_0x9c14('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9c14('0xa')]);router[_0x9c14('0x7')](_0x9c14('0xb'),auth[_0x9c14('0x8')](),controller['getUsers']);router[_0x9c14('0x7')](_0x9c14('0xc'),auth[_0x9c14('0x8')](),controller[_0x9c14('0xd')]);router['post']('/',auth[_0x9c14('0x8')](),controller['create']);router[_0x9c14('0xe')](_0x9c14('0xc'),controller['update']);router['delete'](_0x9c14('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1e9a=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers'];(function(_0x50b2e7,_0x16bea5){var _0x8c493d=function(_0x2bc15b){while(--_0x2bc15b){_0x50b2e7['push'](_0x50b2e7['shift']());}};_0x8c493d(++_0x16bea5);}(_0x1e9a,0xd9));var _0xa1e9=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x1e9a[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xa1e9('0x0'));var util=require(_0xa1e9('0x1'));var path=require(_0xa1e9('0x2'));var timeout=require(_0xa1e9('0x3'));var express=require(_0xa1e9('0x4'));var router=express[_0xa1e9('0x5')]();var fs_extra=require(_0xa1e9('0x6'));var auth=require(_0xa1e9('0x7'));var interaction=require(_0xa1e9('0x8'));var config=require('../../config/environment');var controller=require(_0xa1e9('0x9'));router[_0xa1e9('0xa')]('/',auth[_0xa1e9('0xb')](),controller[_0xa1e9('0xc')]);router[_0xa1e9('0xa')](_0xa1e9('0xd'),auth[_0xa1e9('0xb')](),controller[_0xa1e9('0xe')]);router['get'](_0xa1e9('0xf'),auth['isAuthenticated'](),controller[_0xa1e9('0x10')]);router['get'](_0xa1e9('0x11'),auth['isAuthenticated'](),controller[_0xa1e9('0x12')]);router[_0xa1e9('0x13')]('/',auth[_0xa1e9('0xb')](),controller[_0xa1e9('0x14')]);router[_0xa1e9('0x15')](_0xa1e9('0x11'),controller[_0xa1e9('0x16')]);router[_0xa1e9('0x17')](_0xa1e9('0x11'),auth['isAuthenticated'](),controller[_0xa1e9('0x18')]);module[_0xa1e9('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 98615b4..b73a9bf 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 _0xbc9d=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x5e2862,_0x4760eb){var _0x8dcad4=function(_0x205ddf){while(--_0x205ddf){_0x5e2862['push'](_0x5e2862['shift']());}};_0x8dcad4(++_0x4760eb);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x272105,_0x5486dc){_0x272105=_0x272105-0x0;var _0x4f1470=_0xbc9d[_0x272105];return _0x4f1470;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'body':{'type':Sequelize[_0xdbc9('0x2')](_0xdbc9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdbc9('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xdbc9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdbc9('0x6')]},'providerName':{'type':Sequelize[_0xdbc9('0x7')]},'providerResponse':{'type':Sequelize[_0xdbc9('0x2')]}}; \ No newline at end of file +var _0x5b12=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5b12,0xa3));var _0x25b1=function(_0x406a50,_0x5178b6){_0x406a50=_0x406a50-0x0;var _0x18afd9=_0x5b12[_0x406a50];return _0x18afd9;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'body':{'type':Sequelize[_0x25b1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x25b1('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x25b1('0x4')]('in',_0x25b1('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x25b1('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8fc7e7f..76de722 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 _0xadcc=['rejectMessage','User','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','ChatMessage','count','includeAll','findAll','show','params','include','find','create','body','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','update','format','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x49b10f,_0x5d03ff){var _0x313620=function(_0x1f46ff){while(--_0x1f46ff){_0x49b10f['push'](_0x49b10f['shift']());}};_0x313620(++_0x5d03ff);}(_0xadcc,0x88));var _0xcadc=function(_0x37d538,_0x1cffdd){_0x37d538=_0x37d538-0x0;var _0x4fa76e=_0xadcc[_0x37d538];return _0x4fa76e;};'use strict';var emlformat=require(_0xcadc('0x0'));var rimraf=require(_0xcadc('0x1'));var zipdir=require(_0xcadc('0x2'));var jsonpatch=require(_0xcadc('0x3'));var rp=require(_0xcadc('0x4'));var moment=require(_0xcadc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcadc('0x6'));var util=require(_0xcadc('0x7'));var path=require(_0xcadc('0x8'));var sox=require(_0xcadc('0x9'));var csv=require(_0xcadc('0xa'));var ejs=require(_0xcadc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcadc('0xc'));var crypto=require(_0xcadc('0xd'));var jsforce=require(_0xcadc('0xe'));var deskjs=require(_0xcadc('0xf'));var toCsv=require(_0xcadc('0xa'));var querystring=require('querystring');var Papa=require(_0xcadc('0x10'));var Redis=require(_0xcadc('0x11'));var authService=require(_0xcadc('0x12'));var qs=require(_0xcadc('0x13'));var as=require(_0xcadc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcadc('0x15'))(_0xcadc('0x16'));var utils=require(_0xcadc('0x17'));var config=require(_0xcadc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcadc('0x19'))['db'];config[_0xcadc('0x1a')]=_['defaults'](config['redis'],{'host':_0xcadc('0x1b'),'port':0x18eb});var socket=require(_0xcadc('0x1c'))(new Redis(config[_0xcadc('0x1a')]));require(_0xcadc('0x1d'))['register'](socket);var jayson=require(_0xcadc('0x1e'));var client=jayson[_0xcadc('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xcadc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2b535e,_0x4b2ec1,_0xe333ac,_0x48f9a2){return new BPromise(function(_0x4e112d,_0x29bae8){var _0x426da8=_0x48f9a2||client;return _0x426da8['request'](_0x2b535e,_0xe333ac)[_0xcadc('0x21')](function(_0x213751){logger[_0xcadc('0x22')](_0xcadc('0x23'),_0x4b2ec1,'request\x20sent');logger[_0xcadc('0x24')](_0xcadc('0x25'),_0x4b2ec1,'request\x20sent',JSON[_0xcadc('0x26')](_0x213751));if(_0x213751[_0xcadc('0x27')]){if(_0x213751[_0xcadc('0x27')][_0xcadc('0x28')]===0x1f4){logger[_0xcadc('0x27')](_0xcadc('0x23'),_0x4b2ec1,_0x213751[_0xcadc('0x27')][_0xcadc('0x29')]);return _0x29bae8(_0x213751[_0xcadc('0x27')][_0xcadc('0x29')]);}logger[_0xcadc('0x27')](_0xcadc('0x23'),_0x4b2ec1,_0x213751['error']['message']);return _0x4e112d(_0x213751[_0xcadc('0x27')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4b2ec1,_0xcadc('0x2a'));_0x4e112d(_0x213751['result'][_0xcadc('0x29')]);}})[_0xcadc('0x2b')](function(_0x132547){logger['error'](_0xcadc('0x23'),_0x4b2ec1,_0x132547);_0x29bae8(_0x132547);});});}function respondWithStatusCode(_0x3ead46,_0x248433){_0x248433=_0x248433||0xcc;return function(_0x47af25){if(_0x47af25){return _0x3ead46[_0xcadc('0x2c')](_0x248433);}return _0x3ead46['status'](_0x248433)[_0xcadc('0x2d')]();};}function respondWithResult(_0x871380,_0x4657e1){_0x4657e1=_0x4657e1||0xc8;return function(_0x130567){if(_0x130567){return _0x871380[_0xcadc('0x2e')](_0x4657e1)[_0xcadc('0x2f')](_0x130567);}};}function respondWithFilteredResult(_0x2139e,_0x35666f){return function(_0x4f9f0f){if(_0x4f9f0f){var _0x52e927=typeof _0x35666f[_0xcadc('0x30')]===_0xcadc('0x31')&&typeof _0x35666f['limit']==='undefined';var _0x278e6f=_0x4f9f0f['count'];var _0x380cb2=_0x52e927?0x0:_0x35666f['offset'];var _0x22e5ee=_0x52e927?_0x4f9f0f['count']:_0x35666f[_0xcadc('0x30')]+_0x35666f[_0xcadc('0x32')];var _0x1fd8c5;if(_0x22e5ee>=_0x278e6f){_0x22e5ee=_0x278e6f;_0x1fd8c5=0xc8;}else{_0x1fd8c5=0xce;}_0x2139e[_0xcadc('0x2e')](_0x1fd8c5);return _0x2139e[_0xcadc('0x33')](_0xcadc('0x34'),_0x380cb2+'-'+_0x22e5ee+'/'+_0x278e6f)['json'](_0x4f9f0f);}return null;};}function patchUpdates(_0x438d80){return function(_0x4df340){try{jsonpatch[_0xcadc('0x35')](_0x4df340,_0x438d80,!![]);}catch(_0x29e262){return BPromise[_0xcadc('0x36')](_0x29e262);}return _0x4df340[_0xcadc('0x37')]();};}function saveUpdates(_0xe58649,_0x3990b6){return function(_0x2ffae6){if(_0x2ffae6){return _0x2ffae6['update'](_0xe58649)[_0xcadc('0x21')](function(_0x50763e){return _0x50763e;});}return null;};}function removeEntity(_0x556d85,_0x2abfa6){return function(_0x268343){if(_0x268343){return _0x268343[_0xcadc('0x38')]()[_0xcadc('0x21')](function(){_0x556d85[_0xcadc('0x2e')](0xcc)[_0xcadc('0x2d')]();});}};}function handleEntityNotFound(_0x57db80,_0x3aabf1){return function(_0x542e4c){if(!_0x542e4c){_0x57db80[_0xcadc('0x2c')](0x194);}return _0x542e4c;};}function handleError(_0x35b095,_0xf3549d){_0xf3549d=_0xf3549d||0x1f4;return function(_0x4ba72f){logger[_0xcadc('0x27')](_0x4ba72f[_0xcadc('0x39')]);if(_0x4ba72f['name']){delete _0x4ba72f[_0xcadc('0x3a')];}_0x35b095[_0xcadc('0x2e')](_0xf3549d)[_0xcadc('0x3b')](_0x4ba72f);};}exports[_0xcadc('0x3c')]=function(_0x418cf9,_0x1d9796){var _0x1b5bb1={},_0x3bd4fc={},_0xc71ffa={'count':0x0,'rows':[]};var _0x546a53=_['map'](db['ChatMessage'][_0xcadc('0x3d')],function(_0x1cb205){return{'name':_0x1cb205['fieldName'],'type':_0x1cb205[_0xcadc('0x3e')][_0xcadc('0x3f')]};});_0x3bd4fc['model']=_[_0xcadc('0x40')](_0x546a53,'name');_0x3bd4fc[_0xcadc('0x41')]=_[_0xcadc('0x42')](_0x418cf9['query']);_0x3bd4fc[_0xcadc('0x43')]=_[_0xcadc('0x44')](_0x3bd4fc[_0xcadc('0x45')],_0x3bd4fc[_0xcadc('0x41')]);_0x1b5bb1[_0xcadc('0x46')]=_[_0xcadc('0x44')](_0x3bd4fc[_0xcadc('0x45')],qs['fields'](_0x418cf9[_0xcadc('0x41')][_0xcadc('0x47')]));_0x1b5bb1['attributes']=_0x1b5bb1['attributes'][_0xcadc('0x48')]?_0x1b5bb1[_0xcadc('0x46')]:_0x3bd4fc['model'];if(!_0x418cf9[_0xcadc('0x41')][_0xcadc('0x49')]('nolimit')){_0x1b5bb1['limit']=qs[_0xcadc('0x32')](_0x418cf9[_0xcadc('0x41')]['limit']);_0x1b5bb1['offset']=qs['offset'](_0x418cf9['query'][_0xcadc('0x30')]);}_0x1b5bb1[_0xcadc('0x4a')]=qs['sort'](_0x418cf9[_0xcadc('0x41')][_0xcadc('0x4b')]);_0x1b5bb1[_0xcadc('0x4c')]=qs[_0xcadc('0x43')](_[_0xcadc('0x4d')](_0x418cf9[_0xcadc('0x41')],_0x3bd4fc[_0xcadc('0x43')]),_0x546a53);if(_0x418cf9[_0xcadc('0x41')]['filter']){_0x1b5bb1['where']=_[_0xcadc('0x4e')](_0x1b5bb1[_0xcadc('0x4c')],{'$or':_[_0xcadc('0x40')](_0x546a53,function(_0x2d9762){if(_0x2d9762['type']!==_0xcadc('0x4f')){var _0x1d0870={};_0x1d0870[_0x2d9762['name']]={'$like':'%'+_0x418cf9[_0xcadc('0x41')]['filter']+'%'};return _0x1d0870;}})});}_0x1b5bb1=_[_0xcadc('0x4e')]({},_0x1b5bb1,_0x418cf9[_0xcadc('0x50')]);var _0x4b5cb7={'where':_0x1b5bb1['where']};return db[_0xcadc('0x51')]['count'](_0x4b5cb7)[_0xcadc('0x21')](function(_0x4389e7){_0xc71ffa[_0xcadc('0x52')]=_0x4389e7;if(_0x418cf9[_0xcadc('0x41')][_0xcadc('0x53')]){_0x1b5bb1['include']=[{'all':!![]}];}return db[_0xcadc('0x51')][_0xcadc('0x54')](_0x1b5bb1);})[_0xcadc('0x21')](function(_0x333fc0){_0xc71ffa['rows']=_0x333fc0;return _0xc71ffa;})['then'](respondWithFilteredResult(_0x1d9796,_0x1b5bb1))[_0xcadc('0x2b')](handleError(_0x1d9796,null));};exports[_0xcadc('0x55')]=function(_0x588823,_0x4d1825){var _0x2e0002={'raw':!![],'where':{'id':_0x588823[_0xcadc('0x56')]['id']}},_0x1255c2={};_0x1255c2[_0xcadc('0x45')]=_[_0xcadc('0x42')](db[_0xcadc('0x51')][_0xcadc('0x3d')]);_0x1255c2[_0xcadc('0x41')]=_[_0xcadc('0x42')](_0x588823['query']);_0x1255c2[_0xcadc('0x43')]=_[_0xcadc('0x44')](_0x1255c2[_0xcadc('0x45')],_0x1255c2[_0xcadc('0x41')]);_0x2e0002[_0xcadc('0x46')]=_[_0xcadc('0x44')](_0x1255c2[_0xcadc('0x45')],qs[_0xcadc('0x47')](_0x588823[_0xcadc('0x41')][_0xcadc('0x47')]));_0x2e0002[_0xcadc('0x46')]=_0x2e0002[_0xcadc('0x46')][_0xcadc('0x48')]?_0x2e0002[_0xcadc('0x46')]:_0x1255c2[_0xcadc('0x45')];if(_0x588823['query']['includeAll']){_0x2e0002[_0xcadc('0x57')]=[{'all':!![]}];}_0x2e0002=_[_0xcadc('0x4e')]({},_0x2e0002,_0x588823[_0xcadc('0x50')]);return db['ChatMessage'][_0xcadc('0x58')](_0x2e0002)[_0xcadc('0x21')](handleEntityNotFound(_0x4d1825,null))[_0xcadc('0x21')](respondWithResult(_0x4d1825,null))[_0xcadc('0x2b')](handleError(_0x4d1825,null));};exports[_0xcadc('0x59')]=function(_0x447355,_0x54018a){return db[_0xcadc('0x51')]['create'](_0x447355[_0xcadc('0x5a')],{})[_0xcadc('0x21')](respondWithResult(_0x54018a,0xc9))[_0xcadc('0x2b')](handleError(_0x54018a,null));};exports['update']=function(_0x420651,_0x21d08a){if(_0x420651[_0xcadc('0x5a')]['id']){delete _0x420651[_0xcadc('0x5a')]['id'];}return db['ChatMessage'][_0xcadc('0x58')]({'where':{'id':_0x420651['params']['id']}})[_0xcadc('0x21')](handleEntityNotFound(_0x21d08a,null))[_0xcadc('0x21')](saveUpdates(_0x420651[_0xcadc('0x5a')],null))[_0xcadc('0x21')](respondWithResult(_0x21d08a,null))['catch'](handleError(_0x21d08a,null));};exports[_0xcadc('0x38')]=function(_0x2b4ba5,_0x48cbe4){return db[_0xcadc('0x51')]['find']({'where':{'id':_0x2b4ba5[_0xcadc('0x56')]['id']}})['then'](handleEntityNotFound(_0x48cbe4,null))[_0xcadc('0x21')](removeEntity(_0x48cbe4,null))[_0xcadc('0x2b')](handleError(_0x48cbe4,null));};exports[_0xcadc('0x5b')]=function(_0x51b191,_0x13e80b){return db['ChatMessage']['describe']()[_0xcadc('0x21')](respondWithResult(_0x13e80b,null))[_0xcadc('0x2b')](handleError(_0x13e80b,null));};var interaction_log=require(_0xcadc('0x15'))(_0xcadc('0x5c'));exports[_0xcadc('0x5d')]=function(_0x73316b,_0x3bd402,_0x197c6d){var _0x22e644={'agent':{},'channel':_0xcadc('0x5e')};if(_0x73316b[_0xcadc('0x5a')]['id']){delete _0x73316b[_0xcadc('0x5a')]['id'];}_0x73316b[_0xcadc('0x5a')][_0xcadc('0x5f')]=!![];_0x73316b[_0xcadc('0x5a')]['readAt']=moment()['format'](_0xcadc('0x60'));_0x73316b[_0xcadc('0x5a')]['UserId']=_0x73316b['body'][_0xcadc('0x61')]||_0x73316b[_0xcadc('0x62')]['id'];_0x22e644[_0xcadc('0x63')]['id']=_0x73316b[_0xcadc('0x5a')][_0xcadc('0x61')];return db[_0xcadc('0x51')][_0xcadc('0x58')]({'where':{'id':_0x73316b[_0xcadc('0x56')]['id'],'UserId':null}})[_0xcadc('0x21')](handleEntityNotFound(_0x3bd402,null))[_0xcadc('0x21')](saveUpdates(_0x73316b['body'],null))[_0xcadc('0x21')](function(_0x3c974e){if(_0x3c974e){_0x22e644[_0xcadc('0x29')]=_0x3c974e[_0xcadc('0x64')]({'plain':!![]});return db[_0xcadc('0x65')]['find']({'where':{'id':_0x3c974e['ChatInteractionId']}});}return null;})[_0xcadc('0x21')](handleEntityNotFound(_0x3bd402,null))[_0xcadc('0x21')](function(_0x467dcb){if(_0x467dcb){return _0x467dcb[_0xcadc('0x66')]({'UserId':_0x73316b[_0xcadc('0x5a')][_0xcadc('0x61')],'read1stAt':_['isNil'](_0x467dcb['read1stAt'])?moment()[_0xcadc('0x67')](_0xcadc('0x60')):undefined});}return null;})[_0xcadc('0x21')](function(_0x1deff1){if(_0x1deff1){_0x22e644['interaction']=_0x1deff1[_0xcadc('0x64')]({'plain':!![]});interaction_log[_0xcadc('0x22')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x73316b[_0xcadc('0x62')]['id'],_0x73316b[_0xcadc('0x62')][_0xcadc('0x3a')],_0x73316b['user'][_0xcadc('0x68')],_0x22e644[_0xcadc('0x69')]['id'],_0x73316b[_0xcadc('0x5a')]?JSON[_0xcadc('0x26')](_0x73316b[_0xcadc('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xcadc('0x6a'),_0x22e644);}return null;})[_0xcadc('0x21')](function(_0x74fe91){var _0x3572c8=_0xcadc('0x6b')+_0x74fe91[_0xcadc('0x29')][_0xcadc('0x6c')];return db[_0xcadc('0x6d')][_0xcadc('0x41')](_0x3572c8,{'type':db[_0xcadc('0x6e')][_0xcadc('0x6f')][_0xcadc('0x70')],'raw':!![]})[_0xcadc('0x21')](function(_0x603b8e){return _0x603b8e;});})[_0xcadc('0x21')](function(_0x2d2dcd){if(_0x2d2dcd){_0x22e644[_0xcadc('0x29')][_0xcadc('0x71')]=_0x2d2dcd[0x0];if(!_0x73316b['body'][_0xcadc('0x61')])return;return db['User'][_0xcadc('0x58')]({'where':{'id':_0x73316b[_0xcadc('0x5a')][_0xcadc('0x61')],'role':'agent'},'attributes':['id',_0xcadc('0x3a'),_0xcadc('0x72'),_0xcadc('0x73'),_0xcadc('0x74')],'raw':!![]});}return null;})['then'](function(_0x593e0b){if(!_0x593e0b)return null;_0x22e644['message'][_0xcadc('0x63')]=_0x593e0b;return _0x22e644;})[_0xcadc('0x21')](function(_0x12ec99){if(_0x12ec99){if(_0x73316b[_0xcadc('0x5a')]['manual']){_0x22e644['message'][_0xcadc('0x75')]=util[_0xcadc('0x67')](_0xcadc('0x76'),_0x73316b[_0xcadc('0x62')][_0xcadc('0x3a')]);_0x22e644['message']['channel']=_0x22e644[_0xcadc('0x77')];_0x22e644[_0xcadc('0x29')][_0xcadc('0x78')]=_0x22e644[_0xcadc('0x77')];_0x22e644[_0xcadc('0x29')]['event']=_0xcadc('0x5d');return respondWithRpcPromise(_0xcadc('0x79'),_0xcadc('0x79'),{'event':_0xcadc('0x7a'),'message':_[_0xcadc('0x4e')](_0x22e644[_0xcadc('0x29')],JSON[_0xcadc('0x7b')](_0x22e644['interaction'][_0xcadc('0x7c')]))},client9002)['then'](function(){return _0x22e644;});}return _0x22e644;}return null;})['then'](respondWithResult(_0x3bd402,null))['catch'](handleError(_0x3bd402,null));};var interaction_log=require(_0xcadc('0x15'))(_0xcadc('0x5c'));exports['reject']=function(_0xea7eb1,_0x49af21,_0x1c4236){var _0x37a362={'agent':{},'channel':_0xcadc('0x5e')};if(_0xea7eb1[_0xcadc('0x5a')]['id']){delete _0xea7eb1[_0xcadc('0x5a')]['id'];}_0xea7eb1[_0xcadc('0x5a')][_0xcadc('0x61')]=_0xea7eb1[_0xcadc('0x5a')][_0xcadc('0x61')]||_0xea7eb1[_0xcadc('0x62')]['id'];_0x37a362['agent']['id']=_0xea7eb1['body']['UserId'];return db['ChatMessage'][_0xcadc('0x58')]({'where':{'id':_0xea7eb1[_0xcadc('0x56')]['id'],'UserId':null}})[_0xcadc('0x21')](handleEntityNotFound(_0x49af21,null))['then'](function(_0x1f7f53){if(_0x1f7f53){_0x37a362[_0xcadc('0x29')]=_0x1f7f53[_0xcadc('0x64')]({'plain':!![]});return db[_0xcadc('0x65')][_0xcadc('0x58')]({'where':{'id':_0x1f7f53[_0xcadc('0x7d')]}});}return null;})[_0xcadc('0x21')](handleEntityNotFound(_0x49af21,null))['then'](function(_0x2e7496){if(_0x2e7496){_0x37a362[_0xcadc('0x69')]=_0x2e7496[_0xcadc('0x64')]({'plain':!![]});interaction_log[_0xcadc('0x22')](_0xcadc('0x7e'),_0xea7eb1[_0xcadc('0x62')]['id'],_0xea7eb1[_0xcadc('0x62')]['name'],_0xea7eb1['user'][_0xcadc('0x68')],_0x37a362[_0xcadc('0x69')]['id'],_0xea7eb1['body']?JSON[_0xcadc('0x26')](_0xea7eb1[_0xcadc('0x5a')]):'null');return respondWithRpcPromise(_0xcadc('0x7f'),_0xcadc('0x80'),_0x37a362);}return null;})['then'](function(_0x2c6bcf){var _0x1a86bf=_0xcadc('0x6b')+_0x2c6bcf[_0xcadc('0x29')][_0xcadc('0x6c')];return db[_0xcadc('0x6d')][_0xcadc('0x41')](_0x1a86bf,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x3e02f6){return _0x3e02f6;});})[_0xcadc('0x21')](function(_0x486f66){if(_0x486f66){_0x37a362['message'][_0xcadc('0x71')]=_0x486f66[0x0];if(!_0xea7eb1[_0xcadc('0x5a')][_0xcadc('0x61')])return;return db[_0xcadc('0x81')][_0xcadc('0x58')]({'where':{'id':_0xea7eb1['body'][_0xcadc('0x61')],'role':_0xcadc('0x63')},'attributes':['id',_0xcadc('0x3a'),_0xcadc('0x72'),_0xcadc('0x73'),_0xcadc('0x74')],'raw':!![]});}return null;})[_0xcadc('0x21')](function(_0x446ebd){if(!_0x446ebd)return null;_0x37a362[_0xcadc('0x29')][_0xcadc('0x63')]=_0x446ebd;return _0x37a362;})[_0xcadc('0x21')](function(_0x136783){if(_0x136783){_0x136783[_0xcadc('0x29')]['interface']=util[_0xcadc('0x67')](_0xcadc('0x76'),_0xea7eb1[_0xcadc('0x62')][_0xcadc('0x3a')]);_0x136783['message'][_0xcadc('0x77')]=_0x37a362[_0xcadc('0x77')];_0x136783['message'][_0xcadc('0x78')]=_0x37a362[_0xcadc('0x77')];_0x136783['message'][_0xcadc('0x82')]=_0xcadc('0x36');respondWithRpcPromise(_0xcadc('0x79'),_0xcadc('0x79'),{'event':_0xcadc('0x83'),'message':_['merge'](_0x37a362['message'],JSON[_0xcadc('0x7b')](_0x37a362[_0xcadc('0x69')][_0xcadc('0x7c')]))},client9002);return _0x37a362;}return null;})[_0xcadc('0x21')](respondWithResult(_0x49af21,null))[_0xcadc('0x2b')](handleError(_0x49af21,null));}; \ No newline at end of file +var _0xee05=['include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','rejectmessage','merge','parse','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','result','ChatMessage,\x20%s,\x20%s','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xee05,0x1c8));var _0x5ee0=function(_0x22a2aa,_0x258d18){_0x22a2aa=_0x22a2aa-0x0;var _0x21f853=_0xee05[_0x22a2aa];return _0x21f853;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ee0('0x0'));var zipdir=require(_0x5ee0('0x1'));var jsonpatch=require(_0x5ee0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ee0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5ee0('0x4'));var sox=require(_0x5ee0('0x5'));var csv=require('to-csv');var ejs=require(_0x5ee0('0x6'));var fs=require('fs');var fs_extra=require(_0x5ee0('0x7'));var _=require(_0x5ee0('0x8'));var squel=require(_0x5ee0('0x9'));var crypto=require(_0x5ee0('0xa'));var jsforce=require(_0x5ee0('0xb'));var deskjs=require(_0x5ee0('0xc'));var toCsv=require(_0x5ee0('0xd'));var querystring=require(_0x5ee0('0xe'));var Papa=require(_0x5ee0('0xf'));var Redis=require(_0x5ee0('0x10'));var authService=require(_0x5ee0('0x11'));var qs=require(_0x5ee0('0x12'));var as=require(_0x5ee0('0x13'));var hardwareService=require(_0x5ee0('0x14'));var logger=require(_0x5ee0('0x15'))(_0x5ee0('0x16'));var utils=require('../../config/utils');var config=require(_0x5ee0('0x17'));var licenseUtil=require(_0x5ee0('0x18'));var db=require(_0x5ee0('0x19'))['db'];config[_0x5ee0('0x1a')]=_['defaults'](config['redis'],{'host':_0x5ee0('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ee0('0x1a')]));require('./chatMessage.socket')[_0x5ee0('0x1c')](socket);var jayson=require(_0x5ee0('0x1d'));var client=jayson[_0x5ee0('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x5ee0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x33b942,_0x114e3f,_0x468a04,_0x50a2eb){return new BPromise(function(_0x14f4e3,_0x163005){var _0x460af1=_0x50a2eb||client;return _0x460af1[_0x5ee0('0x20')](_0x33b942,_0x468a04)[_0x5ee0('0x21')](function(_0x543b8a){logger[_0x5ee0('0x22')]('ChatMessage,\x20%s,\x20%s',_0x114e3f,_0x5ee0('0x23'));logger[_0x5ee0('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x114e3f,_0x5ee0('0x23'),JSON[_0x5ee0('0x25')](_0x543b8a));if(_0x543b8a[_0x5ee0('0x26')]){if(_0x543b8a[_0x5ee0('0x26')][_0x5ee0('0x27')]===0x1f4){logger[_0x5ee0('0x26')]('ChatMessage,\x20%s,\x20%s',_0x114e3f,_0x543b8a[_0x5ee0('0x26')][_0x5ee0('0x28')]);return _0x163005(_0x543b8a[_0x5ee0('0x26')][_0x5ee0('0x28')]);}logger[_0x5ee0('0x26')]('ChatMessage,\x20%s,\x20%s',_0x114e3f,_0x543b8a[_0x5ee0('0x26')][_0x5ee0('0x28')]);return _0x14f4e3(_0x543b8a['error'][_0x5ee0('0x28')]);}else{logger[_0x5ee0('0x22')]('ChatMessage,\x20%s,\x20%s',_0x114e3f,_0x5ee0('0x23'));_0x14f4e3(_0x543b8a[_0x5ee0('0x29')][_0x5ee0('0x28')]);}})['catch'](function(_0x112019){logger[_0x5ee0('0x26')](_0x5ee0('0x2a'),_0x114e3f,_0x112019);_0x163005(_0x112019);});});}function respondWithStatusCode(_0x337824,_0x5cc818){_0x5cc818=_0x5cc818||0xcc;return function(_0x457cd7){if(_0x457cd7){return _0x337824[_0x5ee0('0x2b')](_0x5cc818);}return _0x337824[_0x5ee0('0x2c')](_0x5cc818)['end']();};}function respondWithResult(_0x58da0d,_0x2c2c09){_0x2c2c09=_0x2c2c09||0xc8;return function(_0x5a59ee){if(_0x5a59ee){return _0x58da0d[_0x5ee0('0x2c')](_0x2c2c09)[_0x5ee0('0x2d')](_0x5a59ee);}};}function respondWithFilteredResult(_0x163ca7,_0x52573b){return function(_0x365245){if(_0x365245){var _0x57f9a0=typeof _0x52573b[_0x5ee0('0x2e')]===_0x5ee0('0x2f')&&typeof _0x52573b[_0x5ee0('0x30')]==='undefined';var _0x35301c=_0x365245[_0x5ee0('0x31')];var _0x32ee79=_0x57f9a0?0x0:_0x52573b[_0x5ee0('0x2e')];var _0x25fec5=_0x57f9a0?_0x365245[_0x5ee0('0x31')]:_0x52573b[_0x5ee0('0x2e')]+_0x52573b[_0x5ee0('0x30')];var _0x43c80c;if(_0x25fec5>=_0x35301c){_0x25fec5=_0x35301c;_0x43c80c=0xc8;}else{_0x43c80c=0xce;}_0x163ca7[_0x5ee0('0x2c')](_0x43c80c);return _0x163ca7[_0x5ee0('0x32')]('Content-Range',_0x32ee79+'-'+_0x25fec5+'/'+_0x35301c)['json'](_0x365245);}return null;};}function patchUpdates(_0x1ebac6){return function(_0xb2256b){try{jsonpatch[_0x5ee0('0x33')](_0xb2256b,_0x1ebac6,!![]);}catch(_0x146be6){return BPromise[_0x5ee0('0x34')](_0x146be6);}return _0xb2256b['save']();};}function saveUpdates(_0xbb5f20,_0x45afb1){return function(_0x16632d){if(_0x16632d){return _0x16632d[_0x5ee0('0x35')](_0xbb5f20)['then'](function(_0x52822b){return _0x52822b;});}return null;};}function removeEntity(_0x357f16,_0x463199){return function(_0x539229){if(_0x539229){return _0x539229['destroy']()[_0x5ee0('0x21')](function(){_0x357f16['status'](0xcc)[_0x5ee0('0x36')]();});}};}function handleEntityNotFound(_0x4b5c67,_0x261379){return function(_0x51a06a){if(!_0x51a06a){_0x4b5c67['sendStatus'](0x194);}return _0x51a06a;};}function handleError(_0x13794a,_0x3dcbc1){_0x3dcbc1=_0x3dcbc1||0x1f4;return function(_0x13e711){logger['error'](_0x13e711[_0x5ee0('0x37')]);if(_0x13e711[_0x5ee0('0x38')]){delete _0x13e711['name'];}_0x13794a['status'](_0x3dcbc1)[_0x5ee0('0x39')](_0x13e711);};}exports[_0x5ee0('0x3a')]=function(_0x159042,_0x49a8bb){var _0x4a776b={},_0x423bf0={},_0x158053={'count':0x0,'rows':[]};var _0x566017=_['map'](db[_0x5ee0('0x3b')][_0x5ee0('0x3c')],function(_0x1c30a6){return{'name':_0x1c30a6[_0x5ee0('0x3d')],'type':_0x1c30a6[_0x5ee0('0x3e')][_0x5ee0('0x3f')]};});_0x423bf0[_0x5ee0('0x40')]=_[_0x5ee0('0x41')](_0x566017,_0x5ee0('0x38'));_0x423bf0[_0x5ee0('0x42')]=_[_0x5ee0('0x43')](_0x159042[_0x5ee0('0x42')]);_0x423bf0[_0x5ee0('0x44')]=_[_0x5ee0('0x45')](_0x423bf0[_0x5ee0('0x40')],_0x423bf0[_0x5ee0('0x42')]);_0x4a776b['attributes']=_['intersection'](_0x423bf0[_0x5ee0('0x40')],qs['fields'](_0x159042[_0x5ee0('0x42')][_0x5ee0('0x46')]));_0x4a776b[_0x5ee0('0x47')]=_0x4a776b[_0x5ee0('0x47')][_0x5ee0('0x48')]?_0x4a776b[_0x5ee0('0x47')]:_0x423bf0[_0x5ee0('0x40')];if(!_0x159042['query'][_0x5ee0('0x49')]('nolimit')){_0x4a776b['limit']=qs[_0x5ee0('0x30')](_0x159042[_0x5ee0('0x42')][_0x5ee0('0x30')]);_0x4a776b[_0x5ee0('0x2e')]=qs[_0x5ee0('0x2e')](_0x159042['query']['offset']);}_0x4a776b[_0x5ee0('0x4a')]=qs[_0x5ee0('0x4b')](_0x159042[_0x5ee0('0x42')]['sort']);_0x4a776b[_0x5ee0('0x4c')]=qs[_0x5ee0('0x44')](_['pick'](_0x159042[_0x5ee0('0x42')],_0x423bf0[_0x5ee0('0x44')]),_0x566017);if(_0x159042[_0x5ee0('0x42')]['filter']){_0x4a776b[_0x5ee0('0x4c')]=_['merge'](_0x4a776b[_0x5ee0('0x4c')],{'$or':_[_0x5ee0('0x41')](_0x566017,function(_0x4a26e6){if(_0x4a26e6[_0x5ee0('0x3e')]!==_0x5ee0('0x4d')){var _0x5a3caf={};_0x5a3caf[_0x4a26e6['name']]={'$like':'%'+_0x159042[_0x5ee0('0x42')][_0x5ee0('0x4e')]+'%'};return _0x5a3caf;}})});}_0x4a776b=_['merge']({},_0x4a776b,_0x159042[_0x5ee0('0x4f')]);var _0x22ecb4={'where':_0x4a776b[_0x5ee0('0x4c')]};return db[_0x5ee0('0x3b')][_0x5ee0('0x31')](_0x22ecb4)[_0x5ee0('0x21')](function(_0xdddb34){_0x158053[_0x5ee0('0x31')]=_0xdddb34;if(_0x159042[_0x5ee0('0x42')]['includeAll']){_0x4a776b[_0x5ee0('0x50')]=[{'all':!![]}];}return db[_0x5ee0('0x3b')][_0x5ee0('0x51')](_0x4a776b);})[_0x5ee0('0x21')](function(_0x2f9e01){_0x158053[_0x5ee0('0x52')]=_0x2f9e01;return _0x158053;})[_0x5ee0('0x21')](respondWithFilteredResult(_0x49a8bb,_0x4a776b))[_0x5ee0('0x53')](handleError(_0x49a8bb,null));};exports[_0x5ee0('0x54')]=function(_0x2e11b0,_0x5d9d10){var _0x2677f3={'raw':!![],'where':{'id':_0x2e11b0[_0x5ee0('0x55')]['id']}},_0x58ca00={};_0x58ca00['model']=_[_0x5ee0('0x43')](db['ChatMessage']['rawAttributes']);_0x58ca00[_0x5ee0('0x42')]=_[_0x5ee0('0x43')](_0x2e11b0[_0x5ee0('0x42')]);_0x58ca00[_0x5ee0('0x44')]=_[_0x5ee0('0x45')](_0x58ca00[_0x5ee0('0x40')],_0x58ca00[_0x5ee0('0x42')]);_0x2677f3[_0x5ee0('0x47')]=_[_0x5ee0('0x45')](_0x58ca00[_0x5ee0('0x40')],qs[_0x5ee0('0x46')](_0x2e11b0['query'][_0x5ee0('0x46')]));_0x2677f3['attributes']=_0x2677f3[_0x5ee0('0x47')]['length']?_0x2677f3[_0x5ee0('0x47')]:_0x58ca00['model'];if(_0x2e11b0[_0x5ee0('0x42')][_0x5ee0('0x56')]){_0x2677f3[_0x5ee0('0x50')]=[{'all':!![]}];}_0x2677f3=_['merge']({},_0x2677f3,_0x2e11b0[_0x5ee0('0x4f')]);return db[_0x5ee0('0x3b')][_0x5ee0('0x57')](_0x2677f3)['then'](handleEntityNotFound(_0x5d9d10,null))[_0x5ee0('0x21')](respondWithResult(_0x5d9d10,null))[_0x5ee0('0x53')](handleError(_0x5d9d10,null));};exports['create']=function(_0x428c90,_0x3cbb34){return db['ChatMessage'][_0x5ee0('0x58')](_0x428c90[_0x5ee0('0x59')],{})[_0x5ee0('0x21')](respondWithResult(_0x3cbb34,0xc9))[_0x5ee0('0x53')](handleError(_0x3cbb34,null));};exports[_0x5ee0('0x35')]=function(_0x1a208b,_0x551361){if(_0x1a208b[_0x5ee0('0x59')]['id']){delete _0x1a208b['body']['id'];}return db[_0x5ee0('0x3b')][_0x5ee0('0x57')]({'where':{'id':_0x1a208b['params']['id']}})['then'](handleEntityNotFound(_0x551361,null))[_0x5ee0('0x21')](saveUpdates(_0x1a208b[_0x5ee0('0x59')],null))[_0x5ee0('0x21')](respondWithResult(_0x551361,null))[_0x5ee0('0x53')](handleError(_0x551361,null));};exports[_0x5ee0('0x5a')]=function(_0x48adb4,_0x43f7ae){return db['ChatMessage']['find']({'where':{'id':_0x48adb4[_0x5ee0('0x55')]['id']}})[_0x5ee0('0x21')](handleEntityNotFound(_0x43f7ae,null))[_0x5ee0('0x21')](removeEntity(_0x43f7ae,null))[_0x5ee0('0x53')](handleError(_0x43f7ae,null));};exports['describe']=function(_0x3c5a01,_0x2ee0b3){return db[_0x5ee0('0x3b')][_0x5ee0('0x5b')]()['then'](respondWithResult(_0x2ee0b3,null))[_0x5ee0('0x53')](handleError(_0x2ee0b3,null));};var interaction_log=require(_0x5ee0('0x15'))(_0x5ee0('0x5c'));exports[_0x5ee0('0x5d')]=function(_0xafb356,_0x4f78d2,_0x177193){var _0x51569e={'agent':{},'channel':_0x5ee0('0x5e')};if(_0xafb356[_0x5ee0('0x59')]['id']){delete _0xafb356[_0x5ee0('0x59')]['id'];}_0xafb356[_0x5ee0('0x59')][_0x5ee0('0x5f')]=!![];_0xafb356[_0x5ee0('0x59')]['readAt']=moment()['format'](_0x5ee0('0x60'));_0xafb356['body'][_0x5ee0('0x61')]=_0xafb356['body'][_0x5ee0('0x61')]||_0xafb356['user']['id'];_0x51569e[_0x5ee0('0x62')]['id']=_0xafb356[_0x5ee0('0x59')][_0x5ee0('0x61')];return db[_0x5ee0('0x3b')][_0x5ee0('0x57')]({'where':{'id':_0xafb356['params']['id'],'UserId':null}})[_0x5ee0('0x21')](handleEntityNotFound(_0x4f78d2,null))[_0x5ee0('0x21')](saveUpdates(_0xafb356['body'],null))[_0x5ee0('0x21')](function(_0x16f006){if(_0x16f006){_0x51569e[_0x5ee0('0x28')]=_0x16f006['get']({'plain':!![]});return db[_0x5ee0('0x63')]['find']({'where':{'id':_0x16f006['ChatInteractionId']}});}return null;})[_0x5ee0('0x21')](handleEntityNotFound(_0x4f78d2,null))[_0x5ee0('0x21')](function(_0x56bdb1){if(_0x56bdb1){return _0x56bdb1[_0x5ee0('0x35')]({'UserId':_0xafb356[_0x5ee0('0x59')]['UserId'],'read1stAt':_[_0x5ee0('0x64')](_0x56bdb1['read1stAt'])?moment()['format'](_0x5ee0('0x60')):undefined});}return null;})[_0x5ee0('0x21')](function(_0x176fbd){if(_0x176fbd){_0x51569e[_0x5ee0('0x65')]=_0x176fbd['get']({'plain':!![]});interaction_log['info'](_0x5ee0('0x66'),_0xafb356[_0x5ee0('0x67')]['id'],_0xafb356[_0x5ee0('0x67')][_0x5ee0('0x38')],_0xafb356[_0x5ee0('0x67')][_0x5ee0('0x68')],_0x51569e[_0x5ee0('0x65')]['id'],_0xafb356['body']?JSON[_0x5ee0('0x25')](_0xafb356[_0x5ee0('0x59')]):'null');return respondWithRpcPromise(_0x5ee0('0x69'),'acceptMessage',_0x51569e);}return null;})['then'](function(_0x2b41f6){var _0x3a4d76=_0x5ee0('0x6a')+_0x2b41f6[_0x5ee0('0x28')][_0x5ee0('0x6b')];return db[_0x5ee0('0x6c')]['query'](_0x3a4d76,{'type':db['Sequelize'][_0x5ee0('0x6d')][_0x5ee0('0x6e')],'raw':!![]})[_0x5ee0('0x21')](function(_0x178876){return _0x178876;});})['then'](function(_0x1e0956){if(_0x1e0956){_0x51569e['message'][_0x5ee0('0x6f')]=_0x1e0956[0x0];if(!_0xafb356['body']['UserId'])return;return db[_0x5ee0('0x70')][_0x5ee0('0x57')]({'where':{'id':_0xafb356['body'][_0x5ee0('0x61')],'role':'agent'},'attributes':['id',_0x5ee0('0x38'),_0x5ee0('0x71'),_0x5ee0('0x72'),_0x5ee0('0x73')],'raw':!![]});}return null;})[_0x5ee0('0x21')](function(_0x4ee9d7){if(!_0x4ee9d7)return null;_0x51569e['message'][_0x5ee0('0x62')]=_0x4ee9d7;return _0x51569e;})['then'](function(_0x24187b){if(_0x24187b){if(_0xafb356[_0x5ee0('0x59')][_0x5ee0('0x74')]){_0x51569e[_0x5ee0('0x28')][_0x5ee0('0x75')]=util[_0x5ee0('0x76')](_0x5ee0('0x77'),_0xafb356[_0x5ee0('0x67')][_0x5ee0('0x38')]);_0x51569e['message']['channel']=_0x51569e[_0x5ee0('0x78')];_0x51569e[_0x5ee0('0x28')][_0x5ee0('0x79')]=_0x51569e[_0x5ee0('0x78')];_0x51569e[_0x5ee0('0x28')][_0x5ee0('0x7a')]=_0x5ee0('0x5d');return respondWithRpcPromise(_0x5ee0('0x7b'),_0x5ee0('0x7b'),{'event':_0x5ee0('0x7c'),'message':_['merge'](_0x51569e[_0x5ee0('0x28')],JSON['parse'](_0x51569e[_0x5ee0('0x65')]['formData']))},client9002)[_0x5ee0('0x21')](function(){return _0x51569e;});}return _0x51569e;}return null;})[_0x5ee0('0x21')](respondWithResult(_0x4f78d2,null))[_0x5ee0('0x53')](handleError(_0x4f78d2,null));};var interaction_log=require(_0x5ee0('0x15'))(_0x5ee0('0x5c'));exports[_0x5ee0('0x34')]=function(_0x84dc92,_0x44c45f,_0x31a7db){var _0x4201cd={'agent':{},'channel':_0x5ee0('0x5e')};if(_0x84dc92[_0x5ee0('0x59')]['id']){delete _0x84dc92[_0x5ee0('0x59')]['id'];}_0x84dc92['body'][_0x5ee0('0x61')]=_0x84dc92['body'][_0x5ee0('0x61')]||_0x84dc92[_0x5ee0('0x67')]['id'];_0x4201cd[_0x5ee0('0x62')]['id']=_0x84dc92[_0x5ee0('0x59')]['UserId'];return db[_0x5ee0('0x3b')][_0x5ee0('0x57')]({'where':{'id':_0x84dc92['params']['id'],'UserId':null}})[_0x5ee0('0x21')](handleEntityNotFound(_0x44c45f,null))[_0x5ee0('0x21')](function(_0x304126){if(_0x304126){_0x4201cd[_0x5ee0('0x28')]=_0x304126['get']({'plain':!![]});return db[_0x5ee0('0x63')]['find']({'where':{'id':_0x304126['ChatInteractionId']}});}return null;})[_0x5ee0('0x21')](handleEntityNotFound(_0x44c45f,null))[_0x5ee0('0x21')](function(_0x54f311){if(_0x54f311){_0x4201cd[_0x5ee0('0x65')]=_0x54f311[_0x5ee0('0x7d')]({'plain':!![]});interaction_log[_0x5ee0('0x22')](_0x5ee0('0x7e'),_0x84dc92[_0x5ee0('0x67')]['id'],_0x84dc92['user']['name'],_0x84dc92['user'][_0x5ee0('0x68')],_0x4201cd['interaction']['id'],_0x84dc92[_0x5ee0('0x59')]?JSON[_0x5ee0('0x25')](_0x84dc92[_0x5ee0('0x59')]):_0x5ee0('0x7f'));return respondWithRpcPromise(_0x5ee0('0x80'),_0x5ee0('0x81'),_0x4201cd);}return null;})[_0x5ee0('0x21')](function(_0x50a45f){var _0x45e49b=_0x5ee0('0x6a')+_0x50a45f[_0x5ee0('0x28')][_0x5ee0('0x6b')];return db[_0x5ee0('0x6c')][_0x5ee0('0x42')](_0x45e49b,{'type':db[_0x5ee0('0x82')][_0x5ee0('0x6d')][_0x5ee0('0x6e')],'raw':!![]})['then'](function(_0x35eb72){return _0x35eb72;});})['then'](function(_0x3364e1){if(_0x3364e1){_0x4201cd['message'][_0x5ee0('0x6f')]=_0x3364e1[0x0];if(!_0x84dc92['body']['UserId'])return;return db[_0x5ee0('0x70')][_0x5ee0('0x57')]({'where':{'id':_0x84dc92[_0x5ee0('0x59')][_0x5ee0('0x61')],'role':_0x5ee0('0x62')},'attributes':['id',_0x5ee0('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x5ee0('0x21')](function(_0x44326c){if(!_0x44326c)return null;_0x4201cd[_0x5ee0('0x28')][_0x5ee0('0x62')]=_0x44326c;return _0x4201cd;})['then'](function(_0x2bb953){if(_0x2bb953){_0x2bb953[_0x5ee0('0x28')]['interface']=util[_0x5ee0('0x76')]('SIP/%s',_0x84dc92[_0x5ee0('0x67')][_0x5ee0('0x38')]);_0x2bb953[_0x5ee0('0x28')][_0x5ee0('0x78')]=_0x4201cd[_0x5ee0('0x78')];_0x2bb953['message'][_0x5ee0('0x79')]=_0x4201cd[_0x5ee0('0x78')];_0x2bb953['message']['event']=_0x5ee0('0x34');respondWithRpcPromise(_0x5ee0('0x7b'),'EventManager',{'event':_0x5ee0('0x83'),'message':_[_0x5ee0('0x84')](_0x4201cd[_0x5ee0('0x28')],JSON[_0x5ee0('0x85')](_0x4201cd[_0x5ee0('0x65')]['formData']))},client9002);return _0x4201cd;}return null;})[_0x5ee0('0x21')](respondWithResult(_0x44c45f,null))[_0x5ee0('0x53')](handleError(_0x44c45f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8cfcf07..d8f20a9 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 _0xf19e=['update','remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf19e,0xbc));var _0xef19=function(_0x26294a,_0x420213){_0x26294a=_0x26294a-0x0;var _0x5dbac7=_0xf19e[_0x26294a];return _0x5dbac7;};'use strict';var EventEmitter=require(_0xef19('0x0'));var ChatMessage=require(_0xef19('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xef19('0x2')](0x0);var events={'afterCreate':_0xef19('0x3'),'afterUpdate':_0xef19('0x4'),'afterDestroy':_0xef19('0x5')};function emitEvent(_0x1f1b03){return function(_0x505a18,_0x1b4712,_0x364c47){ChatMessageEvents[_0xef19('0x6')](_0x1f1b03+':'+_0x505a18['id'],_0x505a18);ChatMessageEvents[_0xef19('0x6')](_0x1f1b03,_0x505a18);_0x364c47(null);};}for(var e in events){if(events[_0xef19('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x4fc2=['emit','hasOwnProperty','exports','ChatMessage','update','remove'];(function(_0x2f5102,_0x41ee06){var _0x3a20ea=function(_0x5317f0){while(--_0x5317f0){_0x2f5102['push'](_0x2f5102['shift']());}};_0x3a20ea(++_0x41ee06);}(_0x4fc2,0x99));var _0x24fc=function(_0x38231c,_0x1a5931){_0x38231c=_0x38231c-0x0;var _0x5be4e8=_0x4fc2[_0x38231c];return _0x5be4e8;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x24fc('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x24fc('0x1'),'afterDestroy':_0x24fc('0x2')};function emitEvent(_0x1ddcfe){return function(_0x3d0180,_0x227674,_0x3c5625){ChatMessageEvents['emit'](_0x1ddcfe+':'+_0x3d0180['id'],_0x3d0180);ChatMessageEvents[_0x24fc('0x3')](_0x1ddcfe,_0x3d0180);_0x3c5625(null);};}for(var e in events){if(events[_0x24fc('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x24fc('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ddd951b..a775757 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 _0xfb45=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','fti_chat_messages','body','models','get','direction','toLowerCase','out','UserId','ChatInteractionId','then','update','createdAt','catch','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb45,0x115));var _0x5fb4=function(_0x26820c,_0x5de3f7){_0x26820c=_0x26820c-0x0;var _0x301d26=_0xfb45[_0x26820c];return _0x301d26;};'use strict';var _=require(_0x5fb4('0x0'));var util=require(_0x5fb4('0x1'));var logger=require(_0x5fb4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5fb4('0x3'));var rp=require(_0x5fb4('0x4'));var fs=require('fs');var path=require(_0x5fb4('0x5'));var rimraf=require(_0x5fb4('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fb4('0x7'));module['exports']=function(_0x19d18d,_0x3f7256){return _0x19d18d[_0x5fb4('0x8')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x5fb4('0x9'),'fields':[_0x5fb4('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45b064,_0x5cdcca,_0xd8d96){var _0x262291=_0x19d18d[_0x5fb4('0xb')];var _0x2f5427=_0x45b064[_0x5fb4('0xc')]({'plain':!![]});if(_0x2f5427[_0x5fb4('0xd')][_0x5fb4('0xe')]()==='in'||_0x2f5427[_0x5fb4('0xd')][_0x5fb4('0xe')]()===_0x5fb4('0xf')&&!_0x2f5427['secret']&&!_['isNil'](_0x2f5427[_0x5fb4('0x10')])){_0x262291['ChatInteraction']['findOne']({'where':{'id':_0x2f5427[_0x5fb4('0x11')]}})[_0x5fb4('0x12')](function(_0x490990){if(_0x490990){_0x490990[_0x5fb4('0x13')]({'lastMsgAt':_0x2f5427[_0x5fb4('0x14')],'lastMsgDirection':_0x2f5427[_0x5fb4('0xd')][_0x5fb4('0xe')]()});}})[_0x5fb4('0x15')](function(_0x48d2ba){console[_0x5fb4('0x16')](_0x48d2ba);});}_0xd8d96();}},'charset':_0x5fb4('0x17'),'collate':_0x5fb4('0x18')});}; \ No newline at end of file +var _0xc434=['then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc434,0x17a));var _0x4c43=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc434[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x4c43('0x0'));var logger=require(_0x4c43('0x1'))(_0x4c43('0x2'));var moment=require(_0x4c43('0x3'));var BPromise=require(_0x4c43('0x4'));var rp=require(_0x4c43('0x5'));var fs=require('fs');var path=require(_0x4c43('0x6'));var rimraf=require(_0x4c43('0x7'));var config=require(_0x4c43('0x8'));var attributes=require('./chatMessage.attributes');module[_0x4c43('0x9')]=function(_0x1c6a96,_0x8d5a2c){return _0x1c6a96[_0x4c43('0xa')]('ChatMessage',attributes,{'tableName':_0x4c43('0xb'),'paranoid':![],'indexes':[{'name':_0x4c43('0xc'),'fields':[_0x4c43('0xd')],'type':_0x4c43('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x553fb3,_0x400fdb,_0x5426ae){var _0xfc7da5=_0x1c6a96[_0x4c43('0xf')];var _0x58f807=_0x553fb3[_0x4c43('0x10')]({'plain':!![]});if(_0x58f807['direction'][_0x4c43('0x11')]()==='in'||_0x58f807[_0x4c43('0x12')][_0x4c43('0x11')]()===_0x4c43('0x13')&&!_0x58f807[_0x4c43('0x14')]&&!_[_0x4c43('0x15')](_0x58f807[_0x4c43('0x16')])){_0xfc7da5[_0x4c43('0x17')]['findOne']({'where':{'id':_0x58f807[_0x4c43('0x18')]}})[_0x4c43('0x19')](function(_0xc4df2a){if(_0xc4df2a){_0xc4df2a[_0x4c43('0x1a')]({'lastMsgAt':_0x58f807[_0x4c43('0x1b')],'lastMsgDirection':_0x58f807[_0x4c43('0x12')]['toLowerCase']()});}})[_0x4c43('0x1c')](function(_0x24b0c3){console['error'](_0x24b0c3);});}_0x5426ae();}},'charset':_0x4c43('0x1d'),'collate':_0x4c43('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bf55bbd..fbd7d6f 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 _0x8dbb=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','ChatMessage','create','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info'];(function(_0x2707ff,_0x29ef73){var _0x1c3324=function(_0x18a6e3){while(--_0x18a6e3){_0x2707ff['push'](_0x2707ff['shift']());}};_0x1c3324(++_0x29ef73);}(_0x8dbb,0x6d));var _0xb8db=function(_0x1b852e,_0x185f0d){_0x1b852e=_0x1b852e-0x0;var _0x2fd5cf=_0x8dbb[_0x1b852e];return _0x2fd5cf;};'use strict';var _=require('lodash');var util=require(_0xb8db('0x0'));var moment=require(_0xb8db('0x1'));var BPromise=require(_0xb8db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8db('0x3'));var db=require(_0xb8db('0x4'))['db'];var utils=require(_0xb8db('0x5'));var logger=require(_0xb8db('0x6'))('rpc');var config=require(_0xb8db('0x7'));var jayson=require(_0xb8db('0x8'));var client=jayson['client'][_0xb8db('0x9')]({'port':0x232a});config[_0xb8db('0xa')]=_[_0xb8db('0xb')](config['redis'],{'host':_0xb8db('0xc'),'port':0x18eb});var socket=require(_0xb8db('0xd'))(new Redis(config[_0xb8db('0xa')]));require(_0xb8db('0xe'))[_0xb8db('0xf')](socket);function respondWithRpcPromise(_0x32bfef,_0x202ef0,_0x57c20f){return new BPromise(function(_0x1c13ef,_0x2a9831){return client[_0xb8db('0x10')](_0x32bfef,_0x57c20f)[_0xb8db('0x11')](function(_0x51c4b5){logger[_0xb8db('0x12')](_0xb8db('0x13'),_0x202ef0,_0xb8db('0x14'));logger[_0xb8db('0x15')](_0xb8db('0x16'),_0x202ef0,_0xb8db('0x14'),JSON[_0xb8db('0x17')](_0x51c4b5));if(_0x51c4b5[_0xb8db('0x18')]){if(_0x51c4b5[_0xb8db('0x18')][_0xb8db('0x19')]===0x1f4){logger[_0xb8db('0x18')](_0xb8db('0x13'),_0x202ef0,_0x51c4b5['error'][_0xb8db('0x1a')]);return _0x2a9831(_0x51c4b5['error']['message']);}logger[_0xb8db('0x18')](_0xb8db('0x13'),_0x202ef0,_0x51c4b5[_0xb8db('0x18')][_0xb8db('0x1a')]);return _0x1c13ef(_0x51c4b5[_0xb8db('0x18')][_0xb8db('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x202ef0,_0xb8db('0x14'));_0x1c13ef(_0x51c4b5[_0xb8db('0x1b')][_0xb8db('0x1a')]);}})['catch'](function(_0x3d7693){logger[_0xb8db('0x18')](_0xb8db('0x13'),_0x202ef0,_0x3d7693);_0x2a9831(_0x3d7693);});});}exports[_0xb8db('0x1c')]=function(_0x45e367){var _0x4db20d=this;return new Promise(function(_0x20d287,_0x474997){return db[_0xb8db('0x1d')][_0xb8db('0x1e')](_0x45e367['body'],{'raw':_0x45e367[_0xb8db('0x1f')]?_0x45e367[_0xb8db('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xb8db('0x11')](function(_0x11e750){logger[_0xb8db('0x12')](_0xb8db('0x1c'),_0x45e367);logger[_0xb8db('0x15')]('CreateChatMessage',_0x45e367,JSON[_0xb8db('0x17')](_0x11e750));_0x20d287(_0x11e750);})['catch'](function(_0x56a2ef){logger['error']('CreateChatMessage',_0x56a2ef[_0xb8db('0x1a')],_0x45e367);_0x474997(_0x4db20d['error'](0x1f4,_0x56a2ef[_0xb8db('0x1a')]));});});}; \ No newline at end of file +var _0x6c18=['client','http','defaults','redis','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1dda93,_0x2b7426){var _0xf16237=function(_0x283c55){while(--_0x283c55){_0x1dda93['push'](_0x1dda93['shift']());}};_0xf16237(++_0x2b7426);}(_0x6c18,0x195));var _0x86c1=function(_0x347515,_0x2bd900){_0x347515=_0x347515-0x0;var _0x5c0e1c=_0x6c18[_0x347515];return _0x5c0e1c;};'use strict';var _=require(_0x86c1('0x0'));var util=require(_0x86c1('0x1'));var moment=require(_0x86c1('0x2'));var BPromise=require(_0x86c1('0x3'));var rs=require(_0x86c1('0x4'));var fs=require('fs');var Redis=require(_0x86c1('0x5'));var db=require(_0x86c1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x86c1('0x7'))(_0x86c1('0x8'));var config=require(_0x86c1('0x9'));var jayson=require(_0x86c1('0xa'));var client=jayson[_0x86c1('0xb')][_0x86c1('0xc')]({'port':0x232a});config['redis']=_[_0x86c1('0xd')](config[_0x86c1('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86c1('0xe')]));require('./chatMessage.socket')[_0x86c1('0xf')](socket);function respondWithRpcPromise(_0xbf820a,_0x1e8cf6,_0x229f17){return new BPromise(function(_0x1eac1e,_0x50f633){return client['request'](_0xbf820a,_0x229f17)[_0x86c1('0x10')](function(_0x373ea1){logger[_0x86c1('0x11')](_0x86c1('0x12'),_0x1e8cf6,_0x86c1('0x13'));logger[_0x86c1('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1e8cf6,_0x86c1('0x13'),JSON[_0x86c1('0x15')](_0x373ea1));if(_0x373ea1[_0x86c1('0x16')]){if(_0x373ea1['error'][_0x86c1('0x17')]===0x1f4){logger[_0x86c1('0x16')](_0x86c1('0x12'),_0x1e8cf6,_0x373ea1[_0x86c1('0x16')]['message']);return _0x50f633(_0x373ea1['error'][_0x86c1('0x18')]);}logger[_0x86c1('0x16')](_0x86c1('0x12'),_0x1e8cf6,_0x373ea1['error'][_0x86c1('0x18')]);return _0x1eac1e(_0x373ea1['error'][_0x86c1('0x18')]);}else{logger[_0x86c1('0x11')](_0x86c1('0x12'),_0x1e8cf6,_0x86c1('0x13'));_0x1eac1e(_0x373ea1[_0x86c1('0x19')][_0x86c1('0x18')]);}})[_0x86c1('0x1a')](function(_0x119fbe){logger[_0x86c1('0x16')](_0x86c1('0x12'),_0x1e8cf6,_0x119fbe);_0x50f633(_0x119fbe);});});}exports[_0x86c1('0x1b')]=function(_0x4f9c5d){var _0x3c5e79=this;return new Promise(function(_0x4f9370,_0xb937cf){return db[_0x86c1('0x1c')][_0x86c1('0x1d')](_0x4f9c5d['body'],{'raw':_0x4f9c5d[_0x86c1('0x1e')]?_0x4f9c5d[_0x86c1('0x1e')][_0x86c1('0x1f')]===undefined?!![]:![]:!![]})[_0x86c1('0x10')](function(_0x5ae985){logger[_0x86c1('0x11')]('CreateChatMessage',_0x4f9c5d);logger['debug'](_0x86c1('0x1b'),_0x4f9c5d,JSON[_0x86c1('0x15')](_0x5ae985));_0x4f9370(_0x5ae985);})['catch'](function(_0x454c67){logger[_0x86c1('0x16')](_0x86c1('0x1b'),_0x454c67[_0x86c1('0x18')],_0x4f9c5d);_0xb937cf(_0x3c5e79['error'](0x1f4,_0x454c67['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index b9cb647..05aa096 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 _0x3baf=['save','remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x3baf,0xf7));var _0xf3ba=function(_0x344f62,_0x4bd138){_0x344f62=_0x344f62-0x0;var _0x191372=_0x3baf[_0x344f62];return _0x191372;};'use strict';var ChatMessageEvents=require(_0xf3ba('0x0'));var events=[_0xf3ba('0x1'),_0xf3ba('0x2'),_0xf3ba('0x3')];function createListener(_0x29bbc2,_0x22f9c0){return function(_0xfce22){_0x22f9c0[_0xf3ba('0x4')](_0x29bbc2,_0xfce22);};}function removeListener(_0x3e6058,_0x1ae6e6){return function(){ChatMessageEvents[_0xf3ba('0x5')](_0x3e6058,_0x1ae6e6);};}exports[_0xf3ba('0x6')]=function(_0x475268){for(var _0x2e6df2=0x0,_0x1284b7=events['length'];_0x2e6df2<_0x1284b7;_0x2e6df2++){var _0x579135=events[_0x2e6df2];var _0x5ab058=createListener(_0xf3ba('0x7')+_0x579135,_0x475268);ChatMessageEvents['on'](_0x579135,_0x5ab058);}}; \ No newline at end of file +var _0x55ca=['removeListener','register','./chatMessage.events','save'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x55ca,0x126));var _0xa55c=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0x55ca[_0x2c5340];return _0x3c505e;};'use strict';var ChatMessageEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){ChatMessageEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('chatMessage:'+_0x2121fd,_0x3c97c8);ChatMessageEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 334c5e8..b9ec286 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 _0x9bfc=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','tracked','chat','chatmessage:create','put','update','/:id/accept','accept'];(function(_0x151ddd,_0xb1a593){var _0x5ef1f0=function(_0x5731e9){while(--_0x5731e9){_0x151ddd['push'](_0x151ddd['shift']());}};_0x5ef1f0(++_0xb1a593);}(_0x9bfc,0x195));var _0xc9bf=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x9bfc[_0x4b03d3];return _0x58a968;};'use strict';var multer=require(_0xc9bf('0x0'));var util=require(_0xc9bf('0x1'));var path=require('path');var timeout=require(_0xc9bf('0x2'));var express=require(_0xc9bf('0x3'));var router=express['Router']();var fs_extra=require(_0xc9bf('0x4'));var auth=require(_0xc9bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9bf('0x6'));var controller=require(_0xc9bf('0x7'));router[_0xc9bf('0x8')]('/',auth[_0xc9bf('0x9')](),controller['index']);router[_0xc9bf('0x8')](_0xc9bf('0xa'),auth[_0xc9bf('0x9')](),controller[_0xc9bf('0xb')]);router['get'](_0xc9bf('0xc'),auth[_0xc9bf('0x9')](),controller['show']);router['post']('/',auth[_0xc9bf('0x9')](),interaction[_0xc9bf('0xd')](_0xc9bf('0xe'),_0xc9bf('0xf')),controller['create']);router[_0xc9bf('0x10')](_0xc9bf('0xc'),controller[_0xc9bf('0x11')]);router[_0xc9bf('0x10')](_0xc9bf('0x12'),auth['isAuthenticated'](),controller[_0xc9bf('0x13')]);router[_0xc9bf('0x10')](_0xc9bf('0x14'),auth[_0xc9bf('0x9')](),controller[_0xc9bf('0x15')]);router[_0xc9bf('0x16')](_0xc9bf('0xc'),auth['isAuthenticated'](),controller[_0xc9bf('0x17')]);module[_0xc9bf('0x18')]=router; \ No newline at end of file +var _0xf453=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','chat','chatmessage:create','create','put','/:id','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x577087,_0x119fa4){var _0xc85fd5=function(_0x497c84){while(--_0x497c84){_0x577087['push'](_0x577087['shift']());}};_0xc85fd5(++_0x119fa4);}(_0xf453,0xa8));var _0x3f45=function(_0x5a5db5,_0x1f4853){_0x5a5db5=_0x5a5db5-0x0;var _0x151e5c=_0xf453[_0x5a5db5];return _0x151e5c;};'use strict';var multer=require(_0x3f45('0x0'));var util=require(_0x3f45('0x1'));var path=require(_0x3f45('0x2'));var timeout=require(_0x3f45('0x3'));var express=require(_0x3f45('0x4'));var router=express[_0x3f45('0x5')]();var fs_extra=require(_0x3f45('0x6'));var auth=require(_0x3f45('0x7'));var interaction=require(_0x3f45('0x8'));var config=require('../../config/environment');var controller=require(_0x3f45('0x9'));router[_0x3f45('0xa')]('/',auth[_0x3f45('0xb')](),controller[_0x3f45('0xc')]);router[_0x3f45('0xa')](_0x3f45('0xd'),auth['isAuthenticated'](),controller[_0x3f45('0xe')]);router['get']('/:id',auth[_0x3f45('0xb')](),controller[_0x3f45('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3f45('0x10')](_0x3f45('0x11'),_0x3f45('0x12')),controller[_0x3f45('0x13')]);router[_0x3f45('0x14')](_0x3f45('0x15'),controller['update']);router[_0x3f45('0x14')]('/:id/accept',auth[_0x3f45('0xb')](),controller[_0x3f45('0x16')]);router['put'](_0x3f45('0x17'),auth[_0x3f45('0xb')](),controller[_0x3f45('0x18')]);router[_0x3f45('0x19')]('/:id',auth[_0x3f45('0xb')](),controller[_0x3f45('0x1a')]);module[_0x3f45('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 5d69d04..b86dc2c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['medium','TEXT','exports'];(function(_0x2d3400,_0x29caaf){var _0x2ed6fe=function(_0x5adf80){while(--_0x5adf80){_0x2d3400['push'](_0x2d3400['shift']());}};_0x2ed6fe(++_0x29caaf);}(_0xadb5,0xad));var _0x5adb=function(_0x26f1a6,_0x28f55e){_0x26f1a6=_0x26f1a6-0x0;var _0x3172a8=_0xadb5[_0x26f1a6];return _0x3172a8;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x2b7908,_0x53b8d5){var _0x4ddbb7=function(_0x299ac5){while(--_0x299ac5){_0x2b7908['push'](_0x2b7908['shift']());}};_0x4ddbb7(++_0x53b8d5);}(_0x2032,0xd9));var _0x2203=function(_0x141e35,_0x4c474b){_0x141e35=_0x141e35-0x0;var _0x1310f1=_0x2032[_0x141e35];return _0x1310f1;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f6b84e7..7b46684 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x219043,_0x1e871b){var _0x33c51b=function(_0x460fc0){while(--_0x460fc0){_0x219043['push'](_0x219043['shift']());}};_0x33c51b(++_0x1e871b);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x269a35,_0x3b2129){_0x269a35=_0x269a35-0x0;var _0x4c4c66=_0x7a54[_0x269a35];return _0x4c4c66;};'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 a6e5609..e4245f9 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 _0xe9d5=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners','update'];(function(_0x2da794,_0x9d2ed3){var _0x11b534=function(_0x1d9b9e){while(--_0x1d9b9e){_0x2da794['push'](_0x2da794['shift']());}};_0x11b534(++_0x9d2ed3);}(_0xe9d5,0x7a));var _0x5e9d=function(_0x34c8ff,_0x674110){_0x34c8ff=_0x34c8ff-0x0;var _0x42601c=_0xe9d5[_0x34c8ff];return _0x42601c;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x5e9d('0x0'))['db'][_0x5e9d('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5e9d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e9d('0x3'),'afterDestroy':_0x5e9d('0x4')};function emitEvent(_0x4abcb1){return function(_0x110269,_0x42b25a,_0x3608fd){ChatOfflineMessageEvents[_0x5e9d('0x5')](_0x4abcb1+':'+_0x110269['id'],_0x110269);ChatOfflineMessageEvents[_0x5e9d('0x5')](_0x4abcb1,_0x110269);_0x3608fd(null);};}for(var e in events){if(events[_0x5e9d('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x5e9d('0x7')](e,emitEvent(event));}}module[_0x5e9d('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xfcb2=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage'];(function(_0x678c26,_0x343c5d){var _0x4fc253=function(_0x19366c){while(--_0x19366c){_0x678c26['push'](_0x678c26['shift']());}};_0x4fc253(++_0x343c5d);}(_0xfcb2,0x1ae));var _0x2fcb=function(_0x2258a4,_0x3defca){_0x2258a4=_0x2258a4-0x0;var _0x3ba628=_0xfcb2[_0x2258a4];return _0x3ba628;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x2fcb('0x0'))['db'][_0x2fcb('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2fcb('0x2')](0x0);var events={'afterCreate':_0x2fcb('0x3'),'afterUpdate':'update','afterDestroy':_0x2fcb('0x4')};function emitEvent(_0x5e8f55){return function(_0x30350f,_0x139a56,_0xfdb412){ChatOfflineMessageEvents[_0x2fcb('0x5')](_0x5e8f55+':'+_0x30350f['id'],_0x30350f);ChatOfflineMessageEvents['emit'](_0x5e8f55,_0x30350f);_0xfdb412(null);};}for(var e in events){if(events[_0x2fcb('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x2fcb('0x7')](e,emitEvent(event));}}module[_0x2fcb('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 3f2913e..27f8427 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 _0xe280=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe280,0xfc));var _0x0e28=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xe280[_0x4b2863];return _0x567d67;};'use strict';var attributes=require(_0x0e28('0x0'));module[_0x0e28('0x1')]=function(_0x4337dd){return _0x4337dd[_0x0e28('0x2')](_0x0e28('0x3'),attributes,{'tableName':_0x0e28('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e28('0x5')});}; \ No newline at end of file +var _0x1afc=['ChatOfflineMessage','utf8mb4_unicode_ci','exports','define'];(function(_0xeac3cb,_0x18e4a5){var _0x3fa5dd=function(_0x5a7137){while(--_0x5a7137){_0xeac3cb['push'](_0xeac3cb['shift']());}};_0x3fa5dd(++_0x18e4a5);}(_0x1afc,0xe2));var _0xc1af=function(_0x114894,_0x139164){_0x114894=_0x114894-0x0;var _0x5ab69c=_0x1afc[_0x114894];return _0x5ab69c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xc1af('0x0')]=function(_0x5009fd){return _0x5009fd[_0xc1af('0x1')](_0xc1af('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc1af('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e792039..0130093 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 _0xa4b0=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x58f62c,_0x1b61f9){var _0x391249=function(_0x59bdd7){while(--_0x59bdd7){_0x58f62c['push'](_0x58f62c['shift']());}};_0x391249(++_0x1b61f9);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x3d1d49,_0xeee5ea){_0x3d1d49=_0x3d1d49-0x0;var _0x100e80=_0xa4b0[_0x3d1d49];return _0x100e80;};'use strict';var _=require(_0x0a4b('0x0'));var util=require(_0x0a4b('0x1'));var moment=require(_0x0a4b('0x2'));var BPromise=require(_0x0a4b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a4b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a4b('0x5'))('rpc');var config=require(_0x0a4b('0x6'));var jayson=require(_0x0a4b('0x7'));var client=jayson['client'][_0x0a4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15ff0f,_0x1bd353,_0x37ab40){return new BPromise(function(_0x690a14,_0x2832d0){return client[_0x0a4b('0x9')](_0x15ff0f,_0x37ab40)[_0x0a4b('0xa')](function(_0x2c58ba){logger[_0x0a4b('0xb')](_0x0a4b('0xc'),_0x1bd353,'request\x20sent');logger['debug'](_0x0a4b('0xd'),_0x1bd353,_0x0a4b('0xe'),JSON[_0x0a4b('0xf')](_0x2c58ba));if(_0x2c58ba[_0x0a4b('0x10')]){if(_0x2c58ba['error'][_0x0a4b('0x11')]===0x1f4){logger[_0x0a4b('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1bd353,_0x2c58ba[_0x0a4b('0x10')][_0x0a4b('0x12')]);return _0x2832d0(_0x2c58ba[_0x0a4b('0x10')]['message']);}logger['error'](_0x0a4b('0xc'),_0x1bd353,_0x2c58ba[_0x0a4b('0x10')][_0x0a4b('0x12')]);return _0x690a14(_0x2c58ba[_0x0a4b('0x10')][_0x0a4b('0x12')]);}else{logger['info'](_0x0a4b('0xc'),_0x1bd353,_0x0a4b('0xe'));_0x690a14(_0x2c58ba[_0x0a4b('0x13')][_0x0a4b('0x12')]);}})[_0x0a4b('0x14')](function(_0x3533f8){logger[_0x0a4b('0x10')](_0x0a4b('0xc'),_0x1bd353,_0x3533f8);_0x2832d0(_0x3533f8);});});} \ No newline at end of file +var _0x861a=['stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x1259af,_0x4d1b93){var _0x27a0f3=function(_0x31d2a8){while(--_0x31d2a8){_0x1259af['push'](_0x1259af['shift']());}};_0x27a0f3(++_0x4d1b93);}(_0x861a,0x194));var _0xa861=function(_0x3c6b5f,_0x387ec5){_0x3c6b5f=_0x3c6b5f-0x0;var _0x54252c=_0x861a[_0x3c6b5f];return _0x54252c;};'use strict';var _=require(_0xa861('0x0'));var util=require('util');var moment=require(_0xa861('0x1'));var BPromise=require(_0xa861('0x2'));var rs=require(_0xa861('0x3'));var fs=require('fs');var Redis=require(_0xa861('0x4'));var db=require(_0xa861('0x5'))['db'];var utils=require(_0xa861('0x6'));var logger=require('../../config/logger')(_0xa861('0x7'));var config=require(_0xa861('0x8'));var jayson=require(_0xa861('0x9'));var client=jayson[_0xa861('0xa')][_0xa861('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc6cb,_0x2c9016,_0x410918){return new BPromise(function(_0x46e2ce,_0x300ab7){return client[_0xa861('0xc')](_0x5bc6cb,_0x410918)[_0xa861('0xd')](function(_0x24e3ad){logger[_0xa861('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2c9016,'request\x20sent');logger[_0xa861('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2c9016,'request\x20sent',JSON[_0xa861('0x10')](_0x24e3ad));if(_0x24e3ad[_0xa861('0x11')]){if(_0x24e3ad[_0xa861('0x11')]['code']===0x1f4){logger[_0xa861('0x11')](_0xa861('0x12'),_0x2c9016,_0x24e3ad[_0xa861('0x11')][_0xa861('0x13')]);return _0x300ab7(_0x24e3ad[_0xa861('0x11')]['message']);}logger['error'](_0xa861('0x12'),_0x2c9016,_0x24e3ad['error']['message']);return _0x46e2ce(_0x24e3ad[_0xa861('0x11')][_0xa861('0x13')]);}else{logger[_0xa861('0xe')](_0xa861('0x12'),_0x2c9016,'request\x20sent');_0x46e2ce(_0x24e3ad[_0xa861('0x14')]['message']);}})['catch'](function(_0x5503fd){logger[_0xa861('0x11')](_0xa861('0x12'),_0x2c9016,_0x5503fd);_0x300ab7(_0x5503fd);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 62f2221..fdadfb5 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 _0x1bd7=['fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1e7af1,_0x3c1e7c){var _0x11d548=function(_0x1d4447){while(--_0x1d4447){_0x1e7af1['push'](_0x1e7af1['shift']());}};_0x11d548(++_0x3c1e7c);}(_0x1bd7,0x1ca));var _0x71bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bd7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x71bd('0x0'));var util=require('util');var path=require(_0x71bd('0x1'));var timeout=require(_0x71bd('0x2'));var express=require('express');var router=express[_0x71bd('0x3')]();var fs_extra=require(_0x71bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x71bd('0x5'));var config=require(_0x71bd('0x6'));var controller=require(_0x71bd('0x7'));router[_0x71bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x71bd('0x9')]);router['get'](_0x71bd('0xa'),auth['isAuthenticated'](),controller[_0x71bd('0xb')]);router[_0x71bd('0x8')](_0x71bd('0xc'),auth[_0x71bd('0xd')](),controller[_0x71bd('0xe')]);router[_0x71bd('0xf')]('/',auth[_0x71bd('0xd')](),controller[_0x71bd('0x10')]);router[_0x71bd('0x11')](_0x71bd('0xc'),auth[_0x71bd('0xd')](),controller[_0x71bd('0x12')]);router[_0x71bd('0x13')](_0x71bd('0xc'),auth[_0x71bd('0xd')](),controller[_0x71bd('0x14')]);module[_0x71bd('0x15')]=router; \ No newline at end of file +var _0x3b3b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x3b3b,0x169));var _0xb3b3=function(_0x28d417,_0x253557){_0x28d417=_0x28d417-0x0;var _0x5b96f4=_0x3b3b[_0x28d417];return _0x5b96f4;};'use strict';var multer=require('multer');var util=require(_0xb3b3('0x0'));var path=require(_0xb3b3('0x1'));var timeout=require(_0xb3b3('0x2'));var express=require(_0xb3b3('0x3'));var router=express[_0xb3b3('0x4')]();var fs_extra=require(_0xb3b3('0x5'));var auth=require(_0xb3b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3b3('0x7'));var controller=require(_0xb3b3('0x8'));router[_0xb3b3('0x9')]('/',auth[_0xb3b3('0xa')](),controller[_0xb3b3('0xb')]);router['get'](_0xb3b3('0xc'),auth[_0xb3b3('0xa')](),controller[_0xb3b3('0xd')]);router[_0xb3b3('0x9')](_0xb3b3('0xe'),auth[_0xb3b3('0xa')](),controller['show']);router[_0xb3b3('0xf')]('/',auth[_0xb3b3('0xa')](),controller[_0xb3b3('0x10')]);router[_0xb3b3('0x11')](_0xb3b3('0xe'),auth[_0xb3b3('0xa')](),controller['update']);router[_0xb3b3('0x12')](_0xb3b3('0xe'),auth[_0xb3b3('0xa')](),controller['destroy']);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 30459ad..2ce33d0 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 _0x9773=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x4a2da9,_0x42d63d){var _0x382dbc=function(_0xf7a203){while(--_0xf7a203){_0x4a2da9['push'](_0x4a2da9['shift']());}};_0x382dbc(++_0x42d63d);}(_0x9773,0x9b));var _0x3977=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9773[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3977('0x0'));module[_0x3977('0x1')]={'name':{'type':Sequelize[_0x3977('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3977('0x3')](_0x3977('0x4'),_0x3977('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3977('0x2')]},'timeout':{'type':Sequelize[_0x3977('0x6')]}}; \ No newline at end of file +var _0x5453=['ENUM','mouseOver','STRING','INTEGER','exports'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0x5453,0x68));var _0x3545=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5453[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x3545('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3545('0x1')](_0x3545('0x2'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3545('0x3')]},'timeout':{'type':Sequelize[_0x3545('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index bfee1a2..5a2e07e 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 _0x8585=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','show','params','rawAttributes','query','keys','filters','intersection','model','fields','attributes','includeAll','include','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x21e591,_0x40612d){var _0x4c3223=function(_0x37b8f6){while(--_0x37b8f6){_0x21e591['push'](_0x21e591['shift']());}};_0x4c3223(++_0x40612d);}(_0x8585,0x64));var _0x5858=function(_0x31adf9,_0x511868){_0x31adf9=_0x31adf9-0x0;var _0x4412b5=_0x8585[_0x31adf9];return _0x4412b5;};'use strict';var emlformat=require(_0x5858('0x0'));var rimraf=require(_0x5858('0x1'));var zipdir=require(_0x5858('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5858('0x3'));var moment=require(_0x5858('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5858('0x5'));var sox=require(_0x5858('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5858('0x7'));var _=require(_0x5858('0x8'));var squel=require(_0x5858('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5858('0xa'));var toCsv=require(_0x5858('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5858('0xc'));var authService=require(_0x5858('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x5858('0xe'));var hardwareService=require(_0x5858('0xf'));var logger=require(_0x5858('0x10'))(_0x5858('0x11'));var utils=require(_0x5858('0x12'));var config=require(_0x5858('0x13'));var licenseUtil=require(_0x5858('0x14'));var db=require(_0x5858('0x15'))['db'];function respondWithStatusCode(_0x31f0b3,_0x5659d6){_0x5659d6=_0x5659d6||0xcc;return function(_0x3cc424){if(_0x3cc424){return _0x31f0b3[_0x5858('0x16')](_0x5659d6);}return _0x31f0b3[_0x5858('0x17')](_0x5659d6)['end']();};}function respondWithResult(_0x3e62f8,_0x2db74c){_0x2db74c=_0x2db74c||0xc8;return function(_0x40335a){if(_0x40335a){return _0x3e62f8[_0x5858('0x17')](_0x2db74c)[_0x5858('0x18')](_0x40335a);}};}function respondWithFilteredResult(_0x623683,_0x34e900){return function(_0x329635){if(_0x329635){var _0x273f69=typeof _0x34e900[_0x5858('0x19')]===_0x5858('0x1a')&&typeof _0x34e900[_0x5858('0x1b')]===_0x5858('0x1a');var _0x1a0f9f=_0x329635[_0x5858('0x1c')];var _0x46d6ae=_0x273f69?0x0:_0x34e900['offset'];var _0x18100f=_0x273f69?_0x329635[_0x5858('0x1c')]:_0x34e900[_0x5858('0x19')]+_0x34e900['limit'];var _0x22b9af;if(_0x18100f>=_0x1a0f9f){_0x18100f=_0x1a0f9f;_0x22b9af=0xc8;}else{_0x22b9af=0xce;}_0x623683[_0x5858('0x17')](_0x22b9af);return _0x623683[_0x5858('0x1d')]('Content-Range',_0x46d6ae+'-'+_0x18100f+'/'+_0x1a0f9f)[_0x5858('0x18')](_0x329635);}return null;};}function patchUpdates(_0x229fe4){return function(_0x57c278){try{jsonpatch[_0x5858('0x1e')](_0x57c278,_0x229fe4,!![]);}catch(_0x254071){return BPromise[_0x5858('0x1f')](_0x254071);}return _0x57c278[_0x5858('0x20')]();};}function saveUpdates(_0xc74e2f,_0x49d1af){return function(_0x1d772c){if(_0x1d772c){return _0x1d772c[_0x5858('0x21')](_0xc74e2f)[_0x5858('0x22')](function(_0x4ee132){return _0x4ee132;});}return null;};}function removeEntity(_0x2a43de,_0x2f6328){return function(_0x28105f){if(_0x28105f){return _0x28105f[_0x5858('0x23')]()['then'](function(){_0x2a43de['status'](0xcc)[_0x5858('0x24')]();});}};}function handleEntityNotFound(_0x2e07ab,_0x53f2aa){return function(_0x517178){if(!_0x517178){_0x2e07ab['sendStatus'](0x194);}return _0x517178;};}function handleError(_0x1a1e50,_0x3df1dc){_0x3df1dc=_0x3df1dc||0x1f4;return function(_0x2c579e){logger['error'](_0x2c579e[_0x5858('0x25')]);if(_0x2c579e[_0x5858('0x26')]){delete _0x2c579e[_0x5858('0x26')];}_0x1a1e50['status'](_0x3df1dc)[_0x5858('0x27')](_0x2c579e);};}exports[_0x5858('0x28')]=function(_0xbc841e,_0x7ac5de){var _0x5776ca={'raw':!![],'where':{'id':_0xbc841e[_0x5858('0x29')]['id']}},_0x248bed={};_0x248bed['model']=_['keys'](db['ChatProactiveAction'][_0x5858('0x2a')]);_0x248bed[_0x5858('0x2b')]=_[_0x5858('0x2c')](_0xbc841e['query']);_0x248bed[_0x5858('0x2d')]=_[_0x5858('0x2e')](_0x248bed[_0x5858('0x2f')],_0x248bed[_0x5858('0x2b')]);_0x5776ca['attributes']=_[_0x5858('0x2e')](_0x248bed[_0x5858('0x2f')],qs['fields'](_0xbc841e[_0x5858('0x2b')][_0x5858('0x30')]));_0x5776ca[_0x5858('0x31')]=_0x5776ca[_0x5858('0x31')]['length']?_0x5776ca[_0x5858('0x31')]:_0x248bed[_0x5858('0x2f')];if(_0xbc841e['query'][_0x5858('0x32')]){_0x5776ca[_0x5858('0x33')]=[{'all':!![]}];}_0x5776ca=_['merge']({},_0x5776ca,_0xbc841e[_0x5858('0x34')]);return db[_0x5858('0x35')][_0x5858('0x36')](_0x5776ca)[_0x5858('0x22')](handleEntityNotFound(_0x7ac5de,null))['then'](respondWithResult(_0x7ac5de,null))[_0x5858('0x37')](handleError(_0x7ac5de,null));};exports['create']=function(_0x29266b,_0x593834){return db[_0x5858('0x35')][_0x5858('0x38')](_0x29266b[_0x5858('0x39')],{})[_0x5858('0x22')](respondWithResult(_0x593834,0xc9))[_0x5858('0x37')](handleError(_0x593834,null));};exports[_0x5858('0x21')]=function(_0x5baddc,_0x56e6a7){if(_0x5baddc['body']['id']){delete _0x5baddc[_0x5858('0x39')]['id'];}return db[_0x5858('0x35')][_0x5858('0x36')]({'where':{'id':_0x5baddc[_0x5858('0x29')]['id']}})[_0x5858('0x22')](handleEntityNotFound(_0x56e6a7,null))[_0x5858('0x22')](saveUpdates(_0x5baddc[_0x5858('0x39')],null))[_0x5858('0x22')](respondWithResult(_0x56e6a7,null))['catch'](handleError(_0x56e6a7,null));};exports[_0x5858('0x23')]=function(_0x2c66c7,_0x139a7b){return db[_0x5858('0x35')]['find']({'where':{'id':_0x2c66c7[_0x5858('0x29')]['id']}})['then'](handleEntityNotFound(_0x139a7b,null))[_0x5858('0x22')](removeEntity(_0x139a7b,null))['catch'](handleError(_0x139a7b,null));}; \ No newline at end of file +var _0xa276=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','find','catch','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x6970d3,_0x14a3d2){var _0x4b7550=function(_0x48e474){while(--_0x48e474){_0x6970d3['push'](_0x6970d3['shift']());}};_0x4b7550(++_0x14a3d2);}(_0xa276,0x9a));var _0x6a27=function(_0x55123c,_0x586007){_0x55123c=_0x55123c-0x0;var _0x29acf3=_0xa276[_0x55123c];return _0x29acf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a27('0x0'));var zipdir=require(_0x6a27('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a27('0x2'));var moment=require(_0x6a27('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a27('0x4'));var util=require(_0x6a27('0x5'));var path=require(_0x6a27('0x6'));var sox=require('sox');var csv=require(_0x6a27('0x7'));var ejs=require(_0x6a27('0x8'));var fs=require('fs');var fs_extra=require(_0x6a27('0x9'));var _=require('lodash');var squel=require(_0x6a27('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a27('0xb'));var Papa=require(_0x6a27('0xc'));var Redis=require(_0x6a27('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a27('0xe'));var hardwareService=require(_0x6a27('0xf'));var logger=require(_0x6a27('0x10'))(_0x6a27('0x11'));var utils=require(_0x6a27('0x12'));var config=require(_0x6a27('0x13'));var licenseUtil=require(_0x6a27('0x14'));var db=require(_0x6a27('0x15'))['db'];function respondWithStatusCode(_0x394307,_0x4a7209){_0x4a7209=_0x4a7209||0xcc;return function(_0x96472c){if(_0x96472c){return _0x394307['sendStatus'](_0x4a7209);}return _0x394307['status'](_0x4a7209)[_0x6a27('0x16')]();};}function respondWithResult(_0x1e987f,_0x39ef85){_0x39ef85=_0x39ef85||0xc8;return function(_0x5b28c6){if(_0x5b28c6){return _0x1e987f[_0x6a27('0x17')](_0x39ef85)[_0x6a27('0x18')](_0x5b28c6);}};}function respondWithFilteredResult(_0x318b61,_0x8f297b){return function(_0x294ac7){if(_0x294ac7){var _0x523e6d=typeof _0x8f297b['offset']===_0x6a27('0x19')&&typeof _0x8f297b[_0x6a27('0x1a')]===_0x6a27('0x19');var _0x4339d3=_0x294ac7[_0x6a27('0x1b')];var _0x1d5925=_0x523e6d?0x0:_0x8f297b['offset'];var _0x3fd414=_0x523e6d?_0x294ac7[_0x6a27('0x1b')]:_0x8f297b[_0x6a27('0x1c')]+_0x8f297b[_0x6a27('0x1a')];var _0x50ddcc;if(_0x3fd414>=_0x4339d3){_0x3fd414=_0x4339d3;_0x50ddcc=0xc8;}else{_0x50ddcc=0xce;}_0x318b61[_0x6a27('0x17')](_0x50ddcc);return _0x318b61[_0x6a27('0x1d')](_0x6a27('0x1e'),_0x1d5925+'-'+_0x3fd414+'/'+_0x4339d3)[_0x6a27('0x18')](_0x294ac7);}return null;};}function patchUpdates(_0x57649a){return function(_0x531d60){try{jsonpatch[_0x6a27('0x1f')](_0x531d60,_0x57649a,!![]);}catch(_0x4231c3){return BPromise['reject'](_0x4231c3);}return _0x531d60[_0x6a27('0x20')]();};}function saveUpdates(_0x2a7fdf,_0x13fc15){return function(_0x167076){if(_0x167076){return _0x167076[_0x6a27('0x21')](_0x2a7fdf)[_0x6a27('0x22')](function(_0x29348c){return _0x29348c;});}return null;};}function removeEntity(_0x13e148,_0x5e3a2e){return function(_0x241029){if(_0x241029){return _0x241029[_0x6a27('0x23')]()[_0x6a27('0x22')](function(){_0x13e148[_0x6a27('0x17')](0xcc)[_0x6a27('0x16')]();});}};}function handleEntityNotFound(_0x5f4897,_0x5b725c){return function(_0x30454b){if(!_0x30454b){_0x5f4897[_0x6a27('0x24')](0x194);}return _0x30454b;};}function handleError(_0x73dc52,_0x354781){_0x354781=_0x354781||0x1f4;return function(_0x54fc6c){logger[_0x6a27('0x25')](_0x54fc6c['stack']);if(_0x54fc6c['name']){delete _0x54fc6c[_0x6a27('0x26')];}_0x73dc52[_0x6a27('0x17')](_0x354781)['send'](_0x54fc6c);};}exports[_0x6a27('0x27')]=function(_0x52cc5d,_0x35fe1c){var _0xa42f9c={'raw':!![],'where':{'id':_0x52cc5d[_0x6a27('0x28')]['id']}},_0x5140b2={};_0x5140b2[_0x6a27('0x29')]=_[_0x6a27('0x2a')](db[_0x6a27('0x2b')][_0x6a27('0x2c')]);_0x5140b2[_0x6a27('0x2d')]=_[_0x6a27('0x2a')](_0x52cc5d[_0x6a27('0x2d')]);_0x5140b2['filters']=_[_0x6a27('0x2e')](_0x5140b2[_0x6a27('0x29')],_0x5140b2[_0x6a27('0x2d')]);_0xa42f9c[_0x6a27('0x2f')]=_['intersection'](_0x5140b2['model'],qs[_0x6a27('0x30')](_0x52cc5d['query'][_0x6a27('0x30')]));_0xa42f9c[_0x6a27('0x2f')]=_0xa42f9c[_0x6a27('0x2f')][_0x6a27('0x31')]?_0xa42f9c[_0x6a27('0x2f')]:_0x5140b2[_0x6a27('0x29')];if(_0x52cc5d[_0x6a27('0x2d')][_0x6a27('0x32')]){_0xa42f9c['include']=[{'all':!![]}];}_0xa42f9c=_[_0x6a27('0x33')]({},_0xa42f9c,_0x52cc5d['options']);return db[_0x6a27('0x2b')][_0x6a27('0x34')](_0xa42f9c)[_0x6a27('0x22')](handleEntityNotFound(_0x35fe1c,null))[_0x6a27('0x22')](respondWithResult(_0x35fe1c,null))[_0x6a27('0x35')](handleError(_0x35fe1c,null));};exports['create']=function(_0xabaac8,_0x316bb5){return db['ChatProactiveAction']['create'](_0xabaac8[_0x6a27('0x36')],{})[_0x6a27('0x22')](respondWithResult(_0x316bb5,0xc9))[_0x6a27('0x35')](handleError(_0x316bb5,null));};exports[_0x6a27('0x21')]=function(_0x1d9c1c,_0x3c3ad2){if(_0x1d9c1c['body']['id']){delete _0x1d9c1c[_0x6a27('0x36')]['id'];}return db['ChatProactiveAction'][_0x6a27('0x34')]({'where':{'id':_0x1d9c1c[_0x6a27('0x28')]['id']}})[_0x6a27('0x22')](handleEntityNotFound(_0x3c3ad2,null))[_0x6a27('0x22')](saveUpdates(_0x1d9c1c[_0x6a27('0x36')],null))[_0x6a27('0x22')](respondWithResult(_0x3c3ad2,null))[_0x6a27('0x35')](handleError(_0x3c3ad2,null));};exports[_0x6a27('0x23')]=function(_0x55020d,_0x43c9f3){return db['ChatProactiveAction']['find']({'where':{'id':_0x55020d[_0x6a27('0x28')]['id']}})[_0x6a27('0x22')](handleEntityNotFound(_0x43c9f3,null))[_0x6a27('0x22')](removeEntity(_0x43c9f3,null))[_0x6a27('0x35')](handleError(_0x43c9f3,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2de4121..b11793c 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 _0x843a=['exports','define','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x843a,0x1b3));var _0xa843=function(_0x41d5d8,_0x453a3c){_0x41d5d8=_0x41d5d8-0x0;var _0x5f1106=_0x843a[_0x41d5d8];return _0x5f1106;};'use strict';var _=require('lodash');var util=require(_0xa843('0x0'));var logger=require(_0xa843('0x1'))(_0xa843('0x2'));var moment=require(_0xa843('0x3'));var BPromise=require(_0xa843('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa843('0x5'));var rimraf=require(_0xa843('0x6'));var config=require(_0xa843('0x7'));var attributes=require(_0xa843('0x8'));module[_0xa843('0x9')]=function(_0x1f29e1,_0x5f0673){return _0x1f29e1[_0xa843('0xa')]('ChatProactiveAction',attributes,{'tableName':_0xa843('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c93=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x53f707,_0x51a2f7){var _0x10a9f5=function(_0x14b513){while(--_0x14b513){_0x53f707['push'](_0x53f707['shift']());}};_0x10a9f5(++_0x51a2f7);}(_0x4c93,0x1d1));var _0x34c9=function(_0x5b5d10,_0x4ebc90){_0x5b5d10=_0x5b5d10-0x0;var _0x5138ab=_0x4c93[_0x5b5d10];return _0x5138ab;};'use strict';var _=require(_0x34c9('0x0'));var util=require(_0x34c9('0x1'));var logger=require(_0x34c9('0x2'))(_0x34c9('0x3'));var moment=require('moment');var BPromise=require(_0x34c9('0x4'));var rp=require(_0x34c9('0x5'));var fs=require('fs');var path=require(_0x34c9('0x6'));var rimraf=require(_0x34c9('0x7'));var config=require(_0x34c9('0x8'));var attributes=require(_0x34c9('0x9'));module[_0x34c9('0xa')]=function(_0xf719bc,_0x4ada44){return _0xf719bc[_0x34c9('0xb')](_0x34c9('0xc'),attributes,{'tableName':_0x34c9('0xd'),'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 9abf5d6..ae24226 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 _0xa4e8=['request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4e713e,_0x1ac682){var _0x296ac0=function(_0x26a297){while(--_0x26a297){_0x4e713e['push'](_0x4e713e['shift']());}};_0x296ac0(++_0x1ac682);}(_0xa4e8,0x99));var _0x8a4e=function(_0x449487,_0x145fa3){_0x449487=_0x449487-0x0;var _0x2db51e=_0xa4e8[_0x449487];return _0x2db51e;};'use strict';var _=require(_0x8a4e('0x0'));var util=require(_0x8a4e('0x1'));var moment=require(_0x8a4e('0x2'));var BPromise=require(_0x8a4e('0x3'));var rs=require(_0x8a4e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a4e('0x5'))['db'];var utils=require(_0x8a4e('0x6'));var logger=require(_0x8a4e('0x7'))('rpc');var config=require(_0x8a4e('0x8'));var jayson=require(_0x8a4e('0x9'));var client=jayson[_0x8a4e('0xa')][_0x8a4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fdd0c,_0x4bd448,_0x19f095){return new BPromise(function(_0xd00255,_0x1ef696){return client['request'](_0x1fdd0c,_0x19f095)[_0x8a4e('0xc')](function(_0x30fc6b){logger[_0x8a4e('0xd')](_0x8a4e('0xe'),_0x4bd448,_0x8a4e('0xf'));logger[_0x8a4e('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4bd448,_0x8a4e('0xf'),JSON['stringify'](_0x30fc6b));if(_0x30fc6b[_0x8a4e('0x11')]){if(_0x30fc6b[_0x8a4e('0x11')][_0x8a4e('0x12')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4bd448,_0x30fc6b['error'][_0x8a4e('0x13')]);return _0x1ef696(_0x30fc6b[_0x8a4e('0x11')][_0x8a4e('0x13')]);}logger['error'](_0x8a4e('0xe'),_0x4bd448,_0x30fc6b[_0x8a4e('0x11')][_0x8a4e('0x13')]);return _0xd00255(_0x30fc6b['error']['message']);}else{logger[_0x8a4e('0xd')](_0x8a4e('0xe'),_0x4bd448,_0x8a4e('0xf'));_0xd00255(_0x30fc6b['result'][_0x8a4e('0x13')]);}})[_0x8a4e('0x14')](function(_0x1cb9e3){logger[_0x8a4e('0x11')](_0x8a4e('0xe'),_0x4bd448,_0x1cb9e3);_0x1ef696(_0x1cb9e3);});});} \ No newline at end of file +var _0xac69=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xac69,0x160));var _0x9ac6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xac69[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9ac6('0x0'));var util=require(_0x9ac6('0x1'));var moment=require(_0x9ac6('0x2'));var BPromise=require(_0x9ac6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ac6('0x4'));var db=require(_0x9ac6('0x5'))['db'];var utils=require(_0x9ac6('0x6'));var logger=require(_0x9ac6('0x7'))(_0x9ac6('0x8'));var config=require(_0x9ac6('0x9'));var jayson=require(_0x9ac6('0xa'));var client=jayson[_0x9ac6('0xb')][_0x9ac6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb02b1,_0x2ed8c6,_0x46f97f){return new BPromise(function(_0x3c7456,_0x23c51b){return client[_0x9ac6('0xd')](_0xb02b1,_0x46f97f)[_0x9ac6('0xe')](function(_0x93803e){logger[_0x9ac6('0xf')](_0x9ac6('0x10'),_0x2ed8c6,'request\x20sent');logger[_0x9ac6('0x11')](_0x9ac6('0x12'),_0x2ed8c6,_0x9ac6('0x13'),JSON[_0x9ac6('0x14')](_0x93803e));if(_0x93803e[_0x9ac6('0x15')]){if(_0x93803e['error'][_0x9ac6('0x16')]===0x1f4){logger[_0x9ac6('0x15')](_0x9ac6('0x10'),_0x2ed8c6,_0x93803e['error'][_0x9ac6('0x17')]);return _0x23c51b(_0x93803e['error'][_0x9ac6('0x17')]);}logger['error'](_0x9ac6('0x10'),_0x2ed8c6,_0x93803e[_0x9ac6('0x15')][_0x9ac6('0x17')]);return _0x3c7456(_0x93803e[_0x9ac6('0x15')][_0x9ac6('0x17')]);}else{logger[_0x9ac6('0xf')](_0x9ac6('0x10'),_0x2ed8c6,_0x9ac6('0x13'));_0x3c7456(_0x93803e[_0x9ac6('0x18')]['message']);}})['catch'](function(_0x5b73bb){logger[_0x9ac6('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ed8c6,_0x5b73bb);_0x23c51b(_0x5b73bb);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 47ab15a..7227683 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 _0x5fc3=['create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','show','isAuthenticated'];(function(_0x52d121,_0x1e3558){var _0x1ea01a=function(_0x31ebe8){while(--_0x31ebe8){_0x52d121['push'](_0x52d121['shift']());}};_0x1ea01a(++_0x1e3558);}(_0x5fc3,0xa8));var _0x35fc=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x5fc3[_0x503950];return _0x1657a9;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x35fc('0xa')]);router['post']('/',auth[_0x35fc('0xb')](),controller[_0x35fc('0xc')]);router[_0x35fc('0xd')](_0x35fc('0xe'),auth[_0x35fc('0xb')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xb')](),controller[_0x35fc('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x2b634f,_0x585e28){var _0x56e0ba=function(_0x416657){while(--_0x416657){_0x2b634f['push'](_0x2b634f['shift']());}};_0x56e0ba(++_0x585e28);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x39805e,_0x56a3c0){_0x39805e=_0x39805e-0x0;var _0x44eb0b=_0xdbf5[_0x39805e];return _0x44eb0b;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index daaa35f..2d9a8fa 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 _0xcd93=['rrmemory','beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd93,0x105));var _0x3cd9=function(_0x53c023,_0x1b911a){_0x53c023=_0x53c023-0x0;var _0x29d80f=_0xcd93[_0x53c023];return _0x29d80f;};'use strict';var Sequelize=require('sequelize');module[_0x3cd9('0x0')]={'name':{'type':Sequelize[_0x3cd9('0x1')],'unique':_0x3cd9('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3cd9('0x1')]},'timeout':{'type':Sequelize[_0x3cd9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3cd9('0x4')](_0x3cd9('0x5'),_0x3cd9('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xf0b2=['name','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0xd06df9,_0x42eb29){var _0x144a22=function(_0x4634a2){while(--_0x4634a2){_0xd06df9['push'](_0xd06df9['shift']());}};_0x144a22(++_0x42eb29);}(_0xf0b2,0x18b));var _0x2f0b=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xf0b2[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x2f0b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2f0b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2f0b('0x2')]},'timeout':{'type':Sequelize[_0x2f0b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2f0b('0x4')](_0x2f0b('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 473369d..c788565 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 _0x2d94=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','ChatQueue','includeAll','findAll','rows','show','include','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','params','describe','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','options','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','field'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x2d94,0x1dc));var _0x42d9=function(_0x5e8128,_0x42866f){_0x5e8128=_0x5e8128-0x0;var _0x3cc61b=_0x2d94[_0x5e8128];return _0x3cc61b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42d9('0x1'));var rp=require(_0x42d9('0x2'));var moment=require(_0x42d9('0x3'));var BPromise=require(_0x42d9('0x4'));var Mustache=require(_0x42d9('0x5'));var util=require(_0x42d9('0x6'));var path=require(_0x42d9('0x7'));var sox=require(_0x42d9('0x8'));var csv=require(_0x42d9('0x9'));var ejs=require(_0x42d9('0xa'));var fs=require('fs');var fs_extra=require(_0x42d9('0xb'));var _=require(_0x42d9('0xc'));var squel=require(_0x42d9('0xd'));var crypto=require(_0x42d9('0xe'));var jsforce=require(_0x42d9('0xf'));var deskjs=require(_0x42d9('0x10'));var toCsv=require(_0x42d9('0x9'));var querystring=require(_0x42d9('0x11'));var Papa=require(_0x42d9('0x12'));var Redis=require(_0x42d9('0x13'));var authService=require(_0x42d9('0x14'));var qs=require(_0x42d9('0x15'));var as=require(_0x42d9('0x16'));var hardwareService=require(_0x42d9('0x17'));var logger=require(_0x42d9('0x18'))('api');var utils=require(_0x42d9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x42d9('0x1a'));var db=require(_0x42d9('0x1b'))['db'];config[_0x42d9('0x1c')]=_['defaults'](config['redis'],{'host':_0x42d9('0x1d'),'port':0x18eb});var socket=require(_0x42d9('0x1e'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x42d9('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x42d9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5499f9,_0x580fcd,_0x4c2aea,_0x4ac978){return new BPromise(function(_0xdf677b,_0xb00e31){var _0x1c8ac8=_0x4ac978||client;return _0x1c8ac8['request'](_0x5499f9,_0x4c2aea)['then'](function(_0x34ae33){logger[_0x42d9('0x21')](_0x42d9('0x22'),_0x580fcd,_0x42d9('0x23'));logger['debug'](_0x42d9('0x24'),_0x580fcd,_0x42d9('0x23'),JSON[_0x42d9('0x25')](_0x34ae33));if(_0x34ae33[_0x42d9('0x26')]){if(_0x34ae33['error'][_0x42d9('0x27')]===0x1f4){logger[_0x42d9('0x26')]('ChatQueue,\x20%s,\x20%s',_0x580fcd,_0x34ae33['error']['message']);return _0xb00e31(_0x34ae33['error']['message']);}logger[_0x42d9('0x26')](_0x42d9('0x22'),_0x580fcd,_0x34ae33[_0x42d9('0x26')][_0x42d9('0x28')]);return _0xdf677b(_0x34ae33[_0x42d9('0x26')][_0x42d9('0x28')]);}else{logger[_0x42d9('0x21')]('ChatQueue,\x20%s,\x20%s',_0x580fcd,_0x42d9('0x23'));_0xdf677b(_0x34ae33['result'][_0x42d9('0x28')]);}})[_0x42d9('0x29')](function(_0x1c1faf){logger['error'](_0x42d9('0x22'),_0x580fcd,_0x1c1faf);_0xb00e31(_0x1c1faf);});});}function respondWithStatusCode(_0x3f23d6,_0x1144d2){_0x1144d2=_0x1144d2||0xcc;return function(_0x23616){if(_0x23616){return _0x3f23d6[_0x42d9('0x2a')](_0x1144d2);}return _0x3f23d6[_0x42d9('0x2b')](_0x1144d2)[_0x42d9('0x2c')]();};}function respondWithResult(_0x4f27ce,_0x3e512f){_0x3e512f=_0x3e512f||0xc8;return function(_0x7873aa){if(_0x7873aa){return _0x4f27ce[_0x42d9('0x2b')](_0x3e512f)['json'](_0x7873aa);}};}function respondWithFilteredResult(_0x321c31,_0x14b866){return function(_0x314779){if(_0x314779){var _0x4890ce=typeof _0x14b866[_0x42d9('0x2d')]==='undefined'&&typeof _0x14b866[_0x42d9('0x2e')]===_0x42d9('0x2f');var _0x3f98f5=_0x314779['count'];var _0x4bc00c=_0x4890ce?0x0:_0x14b866['offset'];var _0x5134e9=_0x4890ce?_0x314779[_0x42d9('0x30')]:_0x14b866['offset']+_0x14b866['limit'];var _0x2dbf04;if(_0x5134e9>=_0x3f98f5){_0x5134e9=_0x3f98f5;_0x2dbf04=0xc8;}else{_0x2dbf04=0xce;}_0x321c31[_0x42d9('0x2b')](_0x2dbf04);return _0x321c31[_0x42d9('0x31')](_0x42d9('0x32'),_0x4bc00c+'-'+_0x5134e9+'/'+_0x3f98f5)[_0x42d9('0x33')](_0x314779);}return null;};}function patchUpdates(_0x729646){return function(_0x5cecb8){try{jsonpatch[_0x42d9('0x34')](_0x5cecb8,_0x729646,!![]);}catch(_0x5b52ed){return BPromise[_0x42d9('0x35')](_0x5b52ed);}return _0x5cecb8[_0x42d9('0x36')]();};}function saveUpdates(_0x197eb3,_0x231687){return function(_0xe2dcd9){if(_0xe2dcd9){return _0xe2dcd9['update'](_0x197eb3)[_0x42d9('0x37')](function(_0x1ec705){return _0x1ec705;});}return null;};}function removeEntity(_0x5c3699,_0x4a243b){return function(_0x550c5b){if(_0x550c5b){return _0x550c5b[_0x42d9('0x38')]()['then'](function(){var _0x2a9e76=_0x550c5b['get']({'plain':!![]});var _0xf81421=_0x42d9('0x39');return db[_0x42d9('0x3a')]['destroy']({'where':{'type':_0xf81421,'resourceId':_0x2a9e76['id']}})[_0x42d9('0x37')](function(){return _0x550c5b;});})[_0x42d9('0x37')](function(){_0x5c3699['status'](0xcc)[_0x42d9('0x2c')]();});}};}function handleEntityNotFound(_0x4e2f07,_0x18ec7d){return function(_0x32338d){if(!_0x32338d){_0x4e2f07[_0x42d9('0x2a')](0x194);}return _0x32338d;};}function handleError(_0x38404c,_0x52bc10){_0x52bc10=_0x52bc10||0x1f4;return function(_0x396222){logger['error'](_0x396222[_0x42d9('0x3b')]);if(_0x396222['name']){delete _0x396222[_0x42d9('0x3c')];}_0x38404c['status'](_0x52bc10)[_0x42d9('0x3d')](_0x396222);};}exports[_0x42d9('0x3e')]=function(_0x26dbb9,_0x517754){var _0x473435={},_0x5528df={},_0x482d39={'count':0x0,'rows':[]};var _0xe00356=_[_0x42d9('0x3f')](db['ChatQueue'][_0x42d9('0x40')],function(_0x1b96df){return{'name':_0x1b96df[_0x42d9('0x41')],'type':_0x1b96df[_0x42d9('0x42')]['key']};});_0x5528df[_0x42d9('0x43')]=_[_0x42d9('0x3f')](_0xe00356,_0x42d9('0x3c'));_0x5528df[_0x42d9('0x44')]=_[_0x42d9('0x45')](_0x26dbb9[_0x42d9('0x44')]);_0x5528df[_0x42d9('0x46')]=_[_0x42d9('0x47')](_0x5528df[_0x42d9('0x43')],_0x5528df[_0x42d9('0x44')]);_0x473435[_0x42d9('0x48')]=_[_0x42d9('0x47')](_0x5528df[_0x42d9('0x43')],qs[_0x42d9('0x49')](_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x49')]));_0x473435[_0x42d9('0x48')]=_0x473435[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x473435['attributes']:_0x5528df[_0x42d9('0x43')];if(!_0x26dbb9['query'][_0x42d9('0x4b')](_0x42d9('0x4c'))){_0x473435[_0x42d9('0x2e')]=qs[_0x42d9('0x2e')](_0x26dbb9[_0x42d9('0x44')]['limit']);_0x473435['offset']=qs[_0x42d9('0x2d')](_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x2d')]);}_0x473435[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x4e')]);_0x473435['where']=qs['filters'](_['pick'](_0x26dbb9[_0x42d9('0x44')],_0x5528df['filters']),_0xe00356);if(_0x26dbb9[_0x42d9('0x44')]['filter']){_0x473435[_0x42d9('0x4f')]=_['merge'](_0x473435[_0x42d9('0x4f')],{'$or':_[_0x42d9('0x3f')](_0xe00356,function(_0x297c2a){if(_0x297c2a[_0x42d9('0x42')]!==_0x42d9('0x50')){var _0x26f495={};_0x26f495[_0x297c2a['name']]={'$like':'%'+_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x51')]+'%'};return _0x26f495;}})});}_0x473435=_['merge']({},_0x473435,_0x26dbb9['options']);var _0x47f145={'where':_0x473435[_0x42d9('0x4f')]};return db[_0x42d9('0x52')]['count'](_0x47f145)[_0x42d9('0x37')](function(_0x906b38){_0x482d39[_0x42d9('0x30')]=_0x906b38;if(_0x26dbb9[_0x42d9('0x44')][_0x42d9('0x53')]){_0x473435['include']=[{'all':!![]}];}return db['ChatQueue'][_0x42d9('0x54')](_0x473435);})[_0x42d9('0x37')](function(_0x2d1281){_0x482d39[_0x42d9('0x55')]=_0x2d1281;return _0x482d39;})[_0x42d9('0x37')](respondWithFilteredResult(_0x517754,_0x473435))['catch'](handleError(_0x517754,null));};exports[_0x42d9('0x56')]=function(_0x57f005,_0x4d46ef){var _0x1a204f={'raw':!![],'where':{'id':_0x57f005['params']['id']}},_0x7be063={};_0x7be063[_0x42d9('0x43')]=_['keys'](db['ChatQueue'][_0x42d9('0x40')]);_0x7be063[_0x42d9('0x44')]=_[_0x42d9('0x45')](_0x57f005[_0x42d9('0x44')]);_0x7be063['filters']=_[_0x42d9('0x47')](_0x7be063['model'],_0x7be063[_0x42d9('0x44')]);_0x1a204f[_0x42d9('0x48')]=_[_0x42d9('0x47')](_0x7be063[_0x42d9('0x43')],qs[_0x42d9('0x49')](_0x57f005[_0x42d9('0x44')][_0x42d9('0x49')]));_0x1a204f[_0x42d9('0x48')]=_0x1a204f[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x1a204f[_0x42d9('0x48')]:_0x7be063[_0x42d9('0x43')];if(_0x57f005[_0x42d9('0x44')]['includeAll']){_0x1a204f[_0x42d9('0x57')]=[{'all':!![]}];}_0x1a204f=_[_0x42d9('0x58')]({},_0x1a204f,_0x57f005['options']);return db[_0x42d9('0x52')]['find'](_0x1a204f)[_0x42d9('0x37')](handleEntityNotFound(_0x4d46ef,null))[_0x42d9('0x37')](respondWithResult(_0x4d46ef,null))[_0x42d9('0x29')](handleError(_0x4d46ef,null));};exports['create']=function(_0x4ce56a,_0x9801e3){return db[_0x42d9('0x52')][_0x42d9('0x59')](_0x4ce56a[_0x42d9('0x5a')],{})[_0x42d9('0x37')](function(_0x2a9b3d){var _0x4359b8=_0x4ce56a[_0x42d9('0x5b')][_0x42d9('0x5c')]({'plain':!![]});if(!_0x4359b8)throw new Error(_0x42d9('0x5d'));if(_0x4359b8[_0x42d9('0x5e')]==='user'){var _0x14013d=_0x2a9b3d['get']({'plain':!![]});var _0x170b61='ChatQueues';return db['UserProfileSection'][_0x42d9('0x5f')]({'where':{'name':_0x170b61,'userProfileId':_0x4359b8['userProfileId']},'raw':!![]})['then'](function(_0x4a8131){if(_0x4a8131&&_0x4a8131[_0x42d9('0x60')]===0x0){return db[_0x42d9('0x3a')][_0x42d9('0x59')]({'name':_0x14013d['name'],'resourceId':_0x14013d['id'],'type':_0x4a8131[_0x42d9('0x3c')],'sectionId':_0x4a8131['id']},{})[_0x42d9('0x37')](function(){return _0x2a9b3d;});}else{return _0x2a9b3d;}})[_0x42d9('0x29')](function(_0xd092ce){logger[_0x42d9('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd092ce);throw _0xd092ce;});}return _0x2a9b3d;})['then'](respondWithResult(_0x9801e3,0xc9))[_0x42d9('0x29')](handleError(_0x9801e3,null));};exports['update']=function(_0xa32ff7,_0xc822a9){if(_0xa32ff7[_0x42d9('0x5a')]['id']){delete _0xa32ff7[_0x42d9('0x5a')]['id'];}return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0xa32ff7[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0xc822a9,null))[_0x42d9('0x37')](saveUpdates(_0xa32ff7[_0x42d9('0x5a')],null))['then'](respondWithResult(_0xc822a9,null))['catch'](handleError(_0xc822a9,null));};exports[_0x42d9('0x38')]=function(_0x8470ab,_0x2f2099){return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0x8470ab[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x2f2099,null))['then'](removeEntity(_0x2f2099,null))[_0x42d9('0x29')](handleError(_0x2f2099,null));};exports[_0x42d9('0x62')]=function(_0x599277,_0x561972){return db[_0x42d9('0x52')]['describe']()[_0x42d9('0x37')](respondWithResult(_0x561972,null))[_0x42d9('0x29')](handleError(_0x561972,null));};exports['getMembers']=function(_0x4c8d73,_0x54357f,_0x412340){var _0x4c3095={'raw':!![],'where':{}},_0x5f4290={},_0x41620e;return db[_0x42d9('0x52')]['findOne']({'where':{'id':_0x4c8d73[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x54357f,null))[_0x42d9('0x37')](function(_0x404a0d){if(_0x404a0d){_0x41620e=_0x404a0d[_0x42d9('0x5c')]({'plain':!![]});_0x5f4290[_0x42d9('0x43')]=_[_0x42d9('0x45')](db[_0x42d9('0x63')][_0x42d9('0x40')]);_0x5f4290[_0x42d9('0x44')]=_[_0x42d9('0x45')](_0x4c8d73['query']);_0x5f4290[_0x42d9('0x46')]=_['intersection'](_0x5f4290[_0x42d9('0x43')],_0x5f4290[_0x42d9('0x44')]);_0x4c3095[_0x42d9('0x48')]=_['intersection'](_0x5f4290[_0x42d9('0x43')],qs['fields'](_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x49')]));_0x4c3095[_0x42d9('0x48')]=_0x4c3095[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x4c3095[_0x42d9('0x48')]:_0x5f4290['model'];if(!_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x4b')](_0x42d9('0x4c'))){_0x4c3095[_0x42d9('0x2e')]=qs['limit'](_0x4c8d73['query'][_0x42d9('0x2e')]);_0x4c3095[_0x42d9('0x2d')]=qs['offset'](_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x2d')]);}_0x4c3095[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x4e')]);_0x4c3095[_0x42d9('0x4f')]=qs[_0x42d9('0x46')](_[_0x42d9('0x64')](_0x4c8d73[_0x42d9('0x44')],_0x5f4290[_0x42d9('0x46')]));_0x4c3095['where'][_0x42d9('0x65')]=_0x404a0d['id'];if(_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x51')]){_0x4c3095['where']=_[_0x42d9('0x58')](_0x4c3095['where'],{'$or':_[_0x42d9('0x3f')](_0x4c3095[_0x42d9('0x48')],function(_0x333fbf){var _0x3b3aa3={};_0x3b3aa3[_0x333fbf]={'$like':'%'+_0x4c8d73[_0x42d9('0x44')][_0x42d9('0x51')]+'%'};return _0x3b3aa3;})});}_0x4c3095=_['merge']({},_0x4c3095,_0x4c8d73['options']);return db[_0x42d9('0x63')]['findAll'](_0x4c3095);}})[_0x42d9('0x37')](function(_0x57b2f3){if(_0x57b2f3){return db[_0x42d9('0x66')][_0x42d9('0x67')]({'where':{'id':_['map'](_0x57b2f3,'UserId'),'role':_0x42d9('0x68')},'attributes':['id','name','chatPause',_0x42d9('0x69'),_0x42d9('0x6a')]});}})['then'](function(_0x12c769){if(_0x12c769){return{'count':_0x12c769[_0x42d9('0x30')],'rows':_['map'](_0x12c769['rows'],function(_0x423cbb){return{'membername':_0x423cbb['name'],'UserId':_0x423cbb['id'],'queue_name':_0x41620e[_0x42d9('0x3c')],'ChatQueueId':_0x41620e['id'],'interface':util[_0x42d9('0x6b')](_0x42d9('0x6c'),_0x42d9('0x6d'),_0x423cbb['name']),'penalty':0x0,'paused':_0x423cbb[_0x42d9('0x6e')],'createdAt':_0x423cbb[_0x42d9('0x6a')],'updatedAt':_0x423cbb[_0x42d9('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x42d9('0x37')](respondWithFilteredResult(_0x54357f,_0x4c3095))[_0x42d9('0x29')](handleError(_0x54357f,null));};exports[_0x42d9('0x6f')]=function(_0x466776,_0x58132a,_0x30acce){var _0x18abca={};var _0x2f5bfc={};var _0x26caa3;var _0x3e7658;return db[_0x42d9('0x52')]['findOne']({'where':{'id':_0x466776[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x58132a,null))['then'](function(_0x18dbbc){if(_0x18dbbc){_0x26caa3=_0x18dbbc;_0x2f5bfc[_0x42d9('0x43')]=_['keys'](db[_0x42d9('0x70')][_0x42d9('0x40')]);_0x2f5bfc['query']=_[_0x42d9('0x45')](_0x466776['query']);_0x2f5bfc['filters']=_[_0x42d9('0x47')](_0x2f5bfc['model'],_0x2f5bfc[_0x42d9('0x44')]);_0x18abca[_0x42d9('0x48')]=_[_0x42d9('0x47')](_0x2f5bfc['model'],qs['fields'](_0x466776[_0x42d9('0x44')][_0x42d9('0x49')]));_0x18abca[_0x42d9('0x48')]=_0x18abca[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x18abca[_0x42d9('0x48')]:_0x2f5bfc['model'];_0x18abca[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x466776['query'][_0x42d9('0x4e')]);_0x18abca[_0x42d9('0x4f')]=qs[_0x42d9('0x46')](_[_0x42d9('0x64')](_0x466776[_0x42d9('0x44')],_0x2f5bfc[_0x42d9('0x46')]));if(_0x466776[_0x42d9('0x44')][_0x42d9('0x51')]){_0x18abca['where']=_[_0x42d9('0x58')](_0x18abca[_0x42d9('0x4f')],{'$or':_[_0x42d9('0x3f')](_0x18abca[_0x42d9('0x48')],function(_0x27a99f){var _0x5c5801={};_0x5c5801[_0x27a99f]={'$like':'%'+_0x466776['query'][_0x42d9('0x51')]+'%'};return _0x5c5801;})});}_0x18abca=_[_0x42d9('0x58')]({},_0x18abca,_0x466776[_0x42d9('0x71')]);return _0x26caa3[_0x42d9('0x6f')](_0x18abca);}})['then'](function(_0x523069){if(_0x523069){_0x3e7658=_0x523069[_0x42d9('0x4a')];if(!_0x466776[_0x42d9('0x44')][_0x42d9('0x4b')](_0x42d9('0x4c'))){_0x18abca[_0x42d9('0x2e')]=qs[_0x42d9('0x2e')](_0x466776[_0x42d9('0x44')][_0x42d9('0x2e')]);_0x18abca[_0x42d9('0x2d')]=qs[_0x42d9('0x2d')](_0x466776[_0x42d9('0x44')][_0x42d9('0x2d')]);}return _0x26caa3[_0x42d9('0x6f')](_0x18abca);}})[_0x42d9('0x37')](function(_0x59747d){if(_0x59747d){return _0x59747d?{'count':_0x3e7658,'rows':_0x59747d}:null;}})[_0x42d9('0x37')](respondWithResult(_0x58132a,null))[_0x42d9('0x29')](handleError(_0x58132a,null));};exports[_0x42d9('0x72')]=function(_0x49c4b3,_0x4b3be2,_0x500495){var _0x3bcf35=_0x49c4b3[_0x42d9('0x5a')][_0x42d9('0x73')];return db[_0x42d9('0x70')][_0x42d9('0x54')]({'where':{'id':_0x3bcf35},'attributes':['id'],'include':[{'model':db['User'],'as':_0x42d9('0x74'),'attributes':['id',_0x42d9('0x3c'),_0x42d9('0x75'),_0x42d9('0x76'),_0x42d9('0x77')],'raw':!![]}]})['then'](function(_0x37e43d){if(_0x37e43d){var _0x30a031=_[_0x42d9('0x78')](_0x37e43d,function(_0x2b9b55){var _0x295f74=_0x2b9b55[_0x42d9('0x5c')]({'plain':!![]});return _0x295f74[_0x42d9('0x74')];});return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0x49c4b3[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](function(_0x43aa3c){return db[_0x42d9('0x79')][_0x42d9('0x7a')](function(_0x2fe197){return _0x43aa3c[_0x42d9('0x72')](_0x3bcf35,{'transaction':_0x2fe197})[_0x42d9('0x37')](function(){return BPromise['each'](_0x30a031,function(_0x21e82e){return db[_0x42d9('0x63')][_0x42d9('0x7b')]({'where':{'UserId':_0x21e82e['id'],'ChatQueueId':_0x49c4b3[_0x42d9('0x61')]['id']},'transaction':_0x2fe197});});})['then'](function(){_0x30a031[_0x42d9('0x7c')](function(_0x4078b7){socket[_0x42d9('0x7d')](_0x42d9('0x7e'),{'UserId':_0x4078b7['id'],'ChatQueueId':_0x43aa3c['id']});});});});});}})[_0x42d9('0x37')](respondWithStatusCode(_0x4b3be2,null))[_0x42d9('0x29')](handleError(_0x4b3be2,null));};exports['removeTeams']=function(_0x45f2d9,_0x50cdbc,_0x427ec8){return db[_0x42d9('0x70')][_0x42d9('0x54')]({'where':{'id':_0x45f2d9[_0x42d9('0x44')][_0x42d9('0x73')]},'attributes':['id'],'include':[{'model':db[_0x42d9('0x66')],'as':_0x42d9('0x74'),'attributes':['id'],'raw':!![]}]})[_0x42d9('0x37')](handleEntityNotFound(_0x50cdbc,null))[_0x42d9('0x37')](function(_0x397bc3){var _0x4f13fe=_['map'](_0x397bc3,'id');var _0x20d1a7=[];var _0x3e9c34=[];var _0x43149f=squel['select']();_0x43149f[_0x42d9('0x7f')]('tq.TeamId')['from']('team_has_chat_queues','tq')['join'](_0x42d9('0x80'),'ut',_0x42d9('0x81'))['where'](_0x42d9('0x82'),_0x45f2d9[_0x42d9('0x61')]['id']);for(var _0x4cb4d5=0x0;_0x4cb4d5<_0x397bc3[_0x42d9('0x4a')];_0x4cb4d5+=0x1){let _0x4a7eee=_0x397bc3[_0x4cb4d5];for(var _0x38fc0c=0x0;_0x38fc0c<_0x4a7eee[_0x42d9('0x74')][_0x42d9('0x4a')];_0x38fc0c+=0x1){let _0x17e6de=_0x4a7eee[_0x42d9('0x74')][_0x38fc0c];var _0x45c11a=_0x43149f['clone']();_0x45c11a[_0x42d9('0x4f')](_0x42d9('0x83'),_0x17e6de['id']);_0x3e9c34[_0x42d9('0x84')](db[_0x42d9('0x79')]['query'](_0x45c11a[_0x42d9('0x85')](),{'type':db['sequelize'][_0x42d9('0x86')][_0x42d9('0x87')]})[_0x42d9('0x37')](function(_0x2e18df){if(_0x2e18df[_0x42d9('0x4a')]===0x1){return _0x17e6de['id'];}else{var _0x67602f=_[_0x42d9('0x88')](_[_0x42d9('0x3f')](_0x2e18df,_0x42d9('0x89')),function(_0x3f32e9){return _[_0x42d9('0x8a')](_0x4f13fe,_0x3f32e9);});if(_0x67602f){return _0x17e6de['id'];}}}));}}return BPromise[_0x42d9('0x8b')](_0x3e9c34)[_0x42d9('0x37')](function(_0x5c5c16){_0x20d1a7=_(_0x20d1a7)[_0x42d9('0x8c')](_0x5c5c16)[_0x42d9('0x8d')]()[_0x42d9('0x8e')]();return db[_0x42d9('0x52')]['find']({'where':{'id':_0x45f2d9['params']['id']}})['then'](function(_0x3e6566){return db[_0x42d9('0x79')][_0x42d9('0x7a')](function(_0x384071){return _0x3e6566['removeTeams'](_0x45f2d9[_0x42d9('0x44')][_0x42d9('0x73')],{'transaction':_0x384071})[_0x42d9('0x37')](function(){if(!_['isEmpty'](_0x20d1a7)){return _0x3e6566['removeAgents'](_0x20d1a7,{'transaction':_0x384071});}})[_0x42d9('0x37')](function(){_0x20d1a7['forEach'](function(_0x5bedf2){socket[_0x42d9('0x7d')](_0x42d9('0x8f'),{'UserId':_0x5bedf2,'ChatQueueId':_0x3e6566['id']});});});});});});})[_0x42d9('0x37')](respondWithStatusCode(_0x50cdbc,null))['catch'](handleError(_0x50cdbc,null));};exports[_0x42d9('0x90')]=function(_0x30ab98,_0x27c215,_0x254e65){return db['ChatQueue']['find']({'where':{'id':_0x30ab98[_0x42d9('0x61')]['id']}})['then'](handleEntityNotFound(_0x27c215,null))[_0x42d9('0x37')](function(_0x3fc716){if(_0x3fc716){return _0x3fc716[_0x42d9('0x90')](_0x30ab98[_0x42d9('0x5a')][_0x42d9('0x73')],_[_0x42d9('0x91')](_0x30ab98[_0x42d9('0x5a')],['ids','id'])||{})[_0x42d9('0x92')](function(_0x969b19){for(var _0x3b9250=0x0;_0x3b9250<_0x30ab98[_0x42d9('0x5a')][_0x42d9('0x73')]['length'];_0x3b9250+=0x1){socket['emit'](_0x42d9('0x7e'),{'UserId':Number(_0x30ab98[_0x42d9('0x5a')][_0x42d9('0x73')][_0x3b9250]),'ChatQueueId':Number(_0x30ab98['params']['id'])});}return _0x969b19;});}})[_0x42d9('0x37')](respondWithResult(_0x27c215,null))[_0x42d9('0x29')](handleError(_0x27c215,null));};exports[_0x42d9('0x93')]=function(_0x4f5353,_0x7de850,_0x1e8b0e){return db[_0x42d9('0x52')][_0x42d9('0x5f')]({'where':{'id':_0x4f5353[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x7de850,null))[_0x42d9('0x37')](function(_0x14c0bf){if(_0x14c0bf){return _0x14c0bf['removeAgents'](_0x4f5353[_0x42d9('0x44')][_0x42d9('0x73')])[_0x42d9('0x37')](function(){if(_[_0x42d9('0x94')](_0x4f5353[_0x42d9('0x44')][_0x42d9('0x73')])){for(var _0x3f4f73=0x0;_0x3f4f73<_0x4f5353[_0x42d9('0x44')]['ids'][_0x42d9('0x4a')];_0x3f4f73+=0x1){socket[_0x42d9('0x7d')](_0x42d9('0x8f'),{'UserId':Number(_0x4f5353['query']['ids'][_0x3f4f73]),'ChatQueueId':Number(_0x4f5353[_0x42d9('0x61')]['id'])});}}else{socket[_0x42d9('0x7d')](_0x42d9('0x8f'),{'UserId':Number(_0x4f5353['query'][_0x42d9('0x73')]),'ChatQueueId':Number(_0x4f5353[_0x42d9('0x61')]['id'])});}});}})[_0x42d9('0x37')](respondWithStatusCode(_0x7de850,null))[_0x42d9('0x29')](handleError(_0x7de850,null));};exports[_0x42d9('0x95')]=function(_0x23d221,_0x24d7a7,_0x41c139){var _0x249e96={};var _0x48fce7={};var _0x4125d1;var _0x349860;return db[_0x42d9('0x52')][_0x42d9('0x96')]({'where':{'id':_0x23d221[_0x42d9('0x61')]['id']}})[_0x42d9('0x37')](handleEntityNotFound(_0x24d7a7,null))[_0x42d9('0x37')](function(_0x47fdfe){if(_0x47fdfe){_0x4125d1=_0x47fdfe;_0x48fce7[_0x42d9('0x43')]=_[_0x42d9('0x45')](db['User'][_0x42d9('0x40')]);_0x48fce7[_0x42d9('0x44')]=_['keys'](_0x23d221[_0x42d9('0x44')]);_0x48fce7[_0x42d9('0x46')]=_[_0x42d9('0x47')](_0x48fce7[_0x42d9('0x43')],_0x48fce7[_0x42d9('0x44')]);_0x249e96[_0x42d9('0x48')]=_['intersection'](_0x48fce7[_0x42d9('0x43')],qs['fields'](_0x23d221[_0x42d9('0x44')]['fields']));_0x249e96[_0x42d9('0x48')]=_0x249e96[_0x42d9('0x48')][_0x42d9('0x4a')]?_0x249e96[_0x42d9('0x48')]:_0x48fce7[_0x42d9('0x43')];_0x249e96[_0x42d9('0x4d')]=qs[_0x42d9('0x4e')](_0x23d221[_0x42d9('0x44')][_0x42d9('0x4e')]);_0x249e96['where']=qs['filters'](_[_0x42d9('0x64')](_0x23d221['query'],_0x48fce7['filters']));if(_0x23d221[_0x42d9('0x44')][_0x42d9('0x51')]){_0x249e96[_0x42d9('0x4f')]=_[_0x42d9('0x58')](_0x249e96[_0x42d9('0x4f')],{'$or':_[_0x42d9('0x3f')](_0x249e96['attributes'],function(_0x49197b){var _0x1010ae={};_0x1010ae[_0x49197b]={'$like':'%'+_0x23d221['query'][_0x42d9('0x51')]+'%'};return _0x1010ae;})});}_0x249e96=_[_0x42d9('0x58')]({},_0x249e96,_0x23d221['options']);return _0x4125d1['getAgents'](_0x249e96);}})[_0x42d9('0x37')](function(_0x3dc7ad){if(_0x3dc7ad){_0x349860=_0x3dc7ad[_0x42d9('0x4a')];if(!_0x23d221[_0x42d9('0x44')][_0x42d9('0x4b')]('nolimit')){_0x249e96[_0x42d9('0x2e')]=qs[_0x42d9('0x2e')](_0x23d221[_0x42d9('0x44')][_0x42d9('0x2e')]);_0x249e96[_0x42d9('0x2d')]=qs[_0x42d9('0x2d')](_0x23d221['query']['offset']);}return _0x4125d1[_0x42d9('0x95')](_0x249e96);}})['then'](function(_0x59a888){if(_0x59a888){return _0x59a888?{'count':_0x349860,'rows':_0x59a888}:null;}})[_0x42d9('0x37')](respondWithResult(_0x24d7a7,null))[_0x42d9('0x29')](handleError(_0x24d7a7,null));}; \ No newline at end of file +var _0xf952=['describe','getMembers','UserChatQueue','nolimit','sort','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','getTeams','findOne','Team','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','get','ChatQueues','stack','name','send','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','ChatQueue','include','findAll','rows','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy'];(function(_0x15a6b6,_0x5bdea4){var _0x29ec64=function(_0x4a5d39){while(--_0x4a5d39){_0x15a6b6['push'](_0x15a6b6['shift']());}};_0x29ec64(++_0x5bdea4);}(_0xf952,0x1f2));var _0x2f95=function(_0x4f2b55,_0x4735dc){_0x4f2b55=_0x4f2b55-0x0;var _0x51692c=_0xf952[_0x4f2b55];return _0x51692c;};'use strict';var emlformat=require(_0x2f95('0x0'));var rimraf=require(_0x2f95('0x1'));var zipdir=require(_0x2f95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f95('0x3'));var BPromise=require(_0x2f95('0x4'));var Mustache=require(_0x2f95('0x5'));var util=require(_0x2f95('0x6'));var path=require(_0x2f95('0x7'));var sox=require(_0x2f95('0x8'));var csv=require(_0x2f95('0x9'));var ejs=require(_0x2f95('0xa'));var fs=require('fs');var fs_extra=require(_0x2f95('0xb'));var _=require(_0x2f95('0xc'));var squel=require(_0x2f95('0xd'));var crypto=require(_0x2f95('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f95('0x9'));var querystring=require('querystring');var Papa=require(_0x2f95('0xf'));var Redis=require(_0x2f95('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2f95('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f95('0x12'));var logger=require(_0x2f95('0x13'))('api');var utils=require(_0x2f95('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2f95('0x15'));var db=require('../../mysqldb')['db'];config[_0x2f95('0x16')]=_[_0x2f95('0x17')](config[_0x2f95('0x16')],{'host':_0x2f95('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f95('0x19'))[_0x2f95('0x1a')](socket);var jayson=require(_0x2f95('0x1b'));var client=jayson[_0x2f95('0x1c')][_0x2f95('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x50db0d,_0x265f97,_0x70c917,_0x10977e){return new BPromise(function(_0x2f4f42,_0x4c680e){var _0x3dfb2e=_0x10977e||client;return _0x3dfb2e[_0x2f95('0x1e')](_0x50db0d,_0x70c917)[_0x2f95('0x1f')](function(_0x5d15ca){logger[_0x2f95('0x20')](_0x2f95('0x21'),_0x265f97,_0x2f95('0x22'));logger[_0x2f95('0x23')](_0x2f95('0x24'),_0x265f97,_0x2f95('0x22'),JSON[_0x2f95('0x25')](_0x5d15ca));if(_0x5d15ca['error']){if(_0x5d15ca[_0x2f95('0x26')]['code']===0x1f4){logger[_0x2f95('0x26')](_0x2f95('0x21'),_0x265f97,_0x5d15ca[_0x2f95('0x26')][_0x2f95('0x27')]);return _0x4c680e(_0x5d15ca[_0x2f95('0x26')][_0x2f95('0x27')]);}logger[_0x2f95('0x26')](_0x2f95('0x21'),_0x265f97,_0x5d15ca['error'][_0x2f95('0x27')]);return _0x2f4f42(_0x5d15ca[_0x2f95('0x26')]['message']);}else{logger[_0x2f95('0x20')](_0x2f95('0x21'),_0x265f97,_0x2f95('0x22'));_0x2f4f42(_0x5d15ca[_0x2f95('0x28')][_0x2f95('0x27')]);}})[_0x2f95('0x29')](function(_0x59d39f){logger[_0x2f95('0x26')](_0x2f95('0x21'),_0x265f97,_0x59d39f);_0x4c680e(_0x59d39f);});});}function respondWithStatusCode(_0x43c507,_0x45c71b){_0x45c71b=_0x45c71b||0xcc;return function(_0x1c8bed){if(_0x1c8bed){return _0x43c507[_0x2f95('0x2a')](_0x45c71b);}return _0x43c507[_0x2f95('0x2b')](_0x45c71b)[_0x2f95('0x2c')]();};}function respondWithResult(_0xa2544c,_0x1802e0){_0x1802e0=_0x1802e0||0xc8;return function(_0xb68ec8){if(_0xb68ec8){return _0xa2544c[_0x2f95('0x2b')](_0x1802e0)[_0x2f95('0x2d')](_0xb68ec8);}};}function respondWithFilteredResult(_0x5b2940,_0x286aea){return function(_0x4dad8c){if(_0x4dad8c){var _0x4a981e=typeof _0x286aea[_0x2f95('0x2e')]==='undefined'&&typeof _0x286aea[_0x2f95('0x2f')]===_0x2f95('0x30');var _0x1d8854=_0x4dad8c['count'];var _0x4d609a=_0x4a981e?0x0:_0x286aea[_0x2f95('0x2e')];var _0x23eb9c=_0x4a981e?_0x4dad8c[_0x2f95('0x31')]:_0x286aea[_0x2f95('0x2e')]+_0x286aea[_0x2f95('0x2f')];var _0x320b20;if(_0x23eb9c>=_0x1d8854){_0x23eb9c=_0x1d8854;_0x320b20=0xc8;}else{_0x320b20=0xce;}_0x5b2940[_0x2f95('0x2b')](_0x320b20);return _0x5b2940[_0x2f95('0x32')](_0x2f95('0x33'),_0x4d609a+'-'+_0x23eb9c+'/'+_0x1d8854)[_0x2f95('0x2d')](_0x4dad8c);}return null;};}function patchUpdates(_0x57f0d9){return function(_0x487d2a){try{jsonpatch[_0x2f95('0x34')](_0x487d2a,_0x57f0d9,!![]);}catch(_0x1a9c75){return BPromise['reject'](_0x1a9c75);}return _0x487d2a[_0x2f95('0x35')]();};}function saveUpdates(_0x239d57,_0x477b67){return function(_0x1b5af9){if(_0x1b5af9){return _0x1b5af9['update'](_0x239d57)[_0x2f95('0x1f')](function(_0x2d137d){return _0x2d137d;});}return null;};}function removeEntity(_0x5c8d56,_0x2e1c83){return function(_0x578361){if(_0x578361){return _0x578361['destroy']()[_0x2f95('0x1f')](function(){var _0x145d6e=_0x578361[_0x2f95('0x36')]({'plain':!![]});var _0x3ad839=_0x2f95('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x3ad839,'resourceId':_0x145d6e['id']}})[_0x2f95('0x1f')](function(){return _0x578361;});})[_0x2f95('0x1f')](function(){_0x5c8d56[_0x2f95('0x2b')](0xcc)[_0x2f95('0x2c')]();});}};}function handleEntityNotFound(_0x2d52f5,_0x4ee077){return function(_0x4747b8){if(!_0x4747b8){_0x2d52f5['sendStatus'](0x194);}return _0x4747b8;};}function handleError(_0x5c3b6d,_0x1dff06){_0x1dff06=_0x1dff06||0x1f4;return function(_0x2d0f70){logger['error'](_0x2d0f70[_0x2f95('0x38')]);if(_0x2d0f70['name']){delete _0x2d0f70[_0x2f95('0x39')];}_0x5c3b6d[_0x2f95('0x2b')](_0x1dff06)[_0x2f95('0x3a')](_0x2d0f70);};}exports['index']=function(_0x117fe1,_0x410a10){var _0xa79db2={},_0x2fbefc={},_0x586e07={'count':0x0,'rows':[]};var _0x49d035=_[_0x2f95('0x3b')](db['ChatQueue'][_0x2f95('0x3c')],function(_0x1ce9af){return{'name':_0x1ce9af[_0x2f95('0x3d')],'type':_0x1ce9af[_0x2f95('0x3e')]['key']};});_0x2fbefc['model']=_[_0x2f95('0x3b')](_0x49d035,'name');_0x2fbefc['query']=_[_0x2f95('0x3f')](_0x117fe1[_0x2f95('0x40')]);_0x2fbefc[_0x2f95('0x41')]=_[_0x2f95('0x42')](_0x2fbefc[_0x2f95('0x43')],_0x2fbefc[_0x2f95('0x40')]);_0xa79db2[_0x2f95('0x44')]=_[_0x2f95('0x42')](_0x2fbefc[_0x2f95('0x43')],qs[_0x2f95('0x45')](_0x117fe1[_0x2f95('0x40')][_0x2f95('0x45')]));_0xa79db2['attributes']=_0xa79db2[_0x2f95('0x44')]['length']?_0xa79db2[_0x2f95('0x44')]:_0x2fbefc[_0x2f95('0x43')];if(!_0x117fe1[_0x2f95('0x40')][_0x2f95('0x46')]('nolimit')){_0xa79db2[_0x2f95('0x2f')]=qs[_0x2f95('0x2f')](_0x117fe1['query'][_0x2f95('0x2f')]);_0xa79db2[_0x2f95('0x2e')]=qs[_0x2f95('0x2e')](_0x117fe1[_0x2f95('0x40')][_0x2f95('0x2e')]);}_0xa79db2[_0x2f95('0x47')]=qs['sort'](_0x117fe1[_0x2f95('0x40')]['sort']);_0xa79db2[_0x2f95('0x48')]=qs['filters'](_[_0x2f95('0x49')](_0x117fe1[_0x2f95('0x40')],_0x2fbefc['filters']),_0x49d035);if(_0x117fe1[_0x2f95('0x40')][_0x2f95('0x4a')]){_0xa79db2['where']=_['merge'](_0xa79db2[_0x2f95('0x48')],{'$or':_[_0x2f95('0x3b')](_0x49d035,function(_0x26b992){if(_0x26b992[_0x2f95('0x3e')]!==_0x2f95('0x4b')){var _0x5da8b9={};_0x5da8b9[_0x26b992[_0x2f95('0x39')]]={'$like':'%'+_0x117fe1[_0x2f95('0x40')]['filter']+'%'};return _0x5da8b9;}})});}_0xa79db2=_[_0x2f95('0x4c')]({},_0xa79db2,_0x117fe1[_0x2f95('0x4d')]);var _0x51cbab={'where':_0xa79db2['where']};return db[_0x2f95('0x4e')][_0x2f95('0x31')](_0x51cbab)[_0x2f95('0x1f')](function(_0xad89d1){_0x586e07[_0x2f95('0x31')]=_0xad89d1;if(_0x117fe1[_0x2f95('0x40')]['includeAll']){_0xa79db2[_0x2f95('0x4f')]=[{'all':!![]}];}return db[_0x2f95('0x4e')][_0x2f95('0x50')](_0xa79db2);})[_0x2f95('0x1f')](function(_0x26a75c){_0x586e07[_0x2f95('0x51')]=_0x26a75c;return _0x586e07;})['then'](respondWithFilteredResult(_0x410a10,_0xa79db2))['catch'](handleError(_0x410a10,null));};exports['show']=function(_0x52d6f7,_0x2c15cd){var _0xa60781={'raw':!![],'where':{'id':_0x52d6f7[_0x2f95('0x52')]['id']}},_0x50ce29={};_0x50ce29[_0x2f95('0x43')]=_[_0x2f95('0x3f')](db[_0x2f95('0x4e')]['rawAttributes']);_0x50ce29[_0x2f95('0x40')]=_['keys'](_0x52d6f7[_0x2f95('0x40')]);_0x50ce29[_0x2f95('0x41')]=_[_0x2f95('0x42')](_0x50ce29[_0x2f95('0x43')],_0x50ce29[_0x2f95('0x40')]);_0xa60781[_0x2f95('0x44')]=_[_0x2f95('0x42')](_0x50ce29[_0x2f95('0x43')],qs['fields'](_0x52d6f7[_0x2f95('0x40')]['fields']));_0xa60781[_0x2f95('0x44')]=_0xa60781[_0x2f95('0x44')][_0x2f95('0x53')]?_0xa60781['attributes']:_0x50ce29[_0x2f95('0x43')];if(_0x52d6f7['query']['includeAll']){_0xa60781['include']=[{'all':!![]}];}_0xa60781=_[_0x2f95('0x4c')]({},_0xa60781,_0x52d6f7['options']);return db[_0x2f95('0x4e')][_0x2f95('0x54')](_0xa60781)[_0x2f95('0x1f')](handleEntityNotFound(_0x2c15cd,null))[_0x2f95('0x1f')](respondWithResult(_0x2c15cd,null))[_0x2f95('0x29')](handleError(_0x2c15cd,null));};exports[_0x2f95('0x55')]=function(_0xe4d388,_0x590ad8){return db[_0x2f95('0x4e')][_0x2f95('0x55')](_0xe4d388[_0x2f95('0x56')],{})[_0x2f95('0x1f')](function(_0x4b4179){var _0x894eae=_0xe4d388[_0x2f95('0x57')]['get']({'plain':!![]});if(!_0x894eae)throw new Error(_0x2f95('0x58'));if(_0x894eae['role']===_0x2f95('0x57')){var _0x2fa3eb=_0x4b4179['get']({'plain':!![]});var _0x3bffb6=_0x2f95('0x37');return db[_0x2f95('0x59')]['find']({'where':{'name':_0x3bffb6,'userProfileId':_0x894eae[_0x2f95('0x5a')]},'raw':!![]})[_0x2f95('0x1f')](function(_0x289d83){if(_0x289d83&&_0x289d83[_0x2f95('0x5b')]===0x0){return db['UserProfileResource'][_0x2f95('0x55')]({'name':_0x2fa3eb[_0x2f95('0x39')],'resourceId':_0x2fa3eb['id'],'type':_0x289d83[_0x2f95('0x39')],'sectionId':_0x289d83['id']},{})[_0x2f95('0x1f')](function(){return _0x4b4179;});}else{return _0x4b4179;}})[_0x2f95('0x29')](function(_0x190609){logger[_0x2f95('0x26')](_0x2f95('0x5c'),_0x190609);throw _0x190609;});}return _0x4b4179;})[_0x2f95('0x1f')](respondWithResult(_0x590ad8,0xc9))[_0x2f95('0x29')](handleError(_0x590ad8,null));};exports['update']=function(_0x2ea5b9,_0x11b8d1){if(_0x2ea5b9[_0x2f95('0x56')]['id']){delete _0x2ea5b9[_0x2f95('0x56')]['id'];}return db[_0x2f95('0x4e')][_0x2f95('0x54')]({'where':{'id':_0x2ea5b9[_0x2f95('0x52')]['id']}})['then'](handleEntityNotFound(_0x11b8d1,null))[_0x2f95('0x1f')](saveUpdates(_0x2ea5b9[_0x2f95('0x56')],null))[_0x2f95('0x1f')](respondWithResult(_0x11b8d1,null))[_0x2f95('0x29')](handleError(_0x11b8d1,null));};exports[_0x2f95('0x5d')]=function(_0x26348a,_0x232692){return db[_0x2f95('0x4e')][_0x2f95('0x54')]({'where':{'id':_0x26348a['params']['id']}})[_0x2f95('0x1f')](handleEntityNotFound(_0x232692,null))[_0x2f95('0x1f')](removeEntity(_0x232692,null))[_0x2f95('0x29')](handleError(_0x232692,null));};exports[_0x2f95('0x5e')]=function(_0x133ea1,_0x308035){return db[_0x2f95('0x4e')][_0x2f95('0x5e')]()['then'](respondWithResult(_0x308035,null))[_0x2f95('0x29')](handleError(_0x308035,null));};exports[_0x2f95('0x5f')]=function(_0x43ee8e,_0x1be025,_0x4924b5){var _0x48891a={'raw':!![],'where':{}},_0x38dcbc={},_0x45c5a0;return db[_0x2f95('0x4e')]['findOne']({'where':{'id':_0x43ee8e[_0x2f95('0x52')]['id']}})['then'](handleEntityNotFound(_0x1be025,null))[_0x2f95('0x1f')](function(_0x4bc368){if(_0x4bc368){_0x45c5a0=_0x4bc368['get']({'plain':!![]});_0x38dcbc[_0x2f95('0x43')]=_[_0x2f95('0x3f')](db[_0x2f95('0x60')][_0x2f95('0x3c')]);_0x38dcbc['query']=_[_0x2f95('0x3f')](_0x43ee8e[_0x2f95('0x40')]);_0x38dcbc[_0x2f95('0x41')]=_[_0x2f95('0x42')](_0x38dcbc['model'],_0x38dcbc[_0x2f95('0x40')]);_0x48891a[_0x2f95('0x44')]=_[_0x2f95('0x42')](_0x38dcbc[_0x2f95('0x43')],qs['fields'](_0x43ee8e['query']['fields']));_0x48891a[_0x2f95('0x44')]=_0x48891a[_0x2f95('0x44')]['length']?_0x48891a['attributes']:_0x38dcbc[_0x2f95('0x43')];if(!_0x43ee8e[_0x2f95('0x40')][_0x2f95('0x46')](_0x2f95('0x61'))){_0x48891a['limit']=qs[_0x2f95('0x2f')](_0x43ee8e[_0x2f95('0x40')][_0x2f95('0x2f')]);_0x48891a['offset']=qs[_0x2f95('0x2e')](_0x43ee8e['query']['offset']);}_0x48891a[_0x2f95('0x47')]=qs[_0x2f95('0x62')](_0x43ee8e[_0x2f95('0x40')][_0x2f95('0x62')]);_0x48891a['where']=qs[_0x2f95('0x41')](_[_0x2f95('0x49')](_0x43ee8e['query'],_0x38dcbc[_0x2f95('0x41')]));_0x48891a['where'][_0x2f95('0x63')]=_0x4bc368['id'];if(_0x43ee8e[_0x2f95('0x40')]['filter']){_0x48891a[_0x2f95('0x48')]=_['merge'](_0x48891a[_0x2f95('0x48')],{'$or':_[_0x2f95('0x3b')](_0x48891a[_0x2f95('0x44')],function(_0x5e8050){var _0x5c3ef8={};_0x5c3ef8[_0x5e8050]={'$like':'%'+_0x43ee8e['query'][_0x2f95('0x4a')]+'%'};return _0x5c3ef8;})});}_0x48891a=_['merge']({},_0x48891a,_0x43ee8e[_0x2f95('0x4d')]);return db[_0x2f95('0x60')][_0x2f95('0x50')](_0x48891a);}})[_0x2f95('0x1f')](function(_0x2cd56e){if(_0x2cd56e){return db[_0x2f95('0x64')][_0x2f95('0x65')]({'where':{'id':_[_0x2f95('0x3b')](_0x2cd56e,'UserId'),'role':_0x2f95('0x66')},'attributes':['id',_0x2f95('0x39'),_0x2f95('0x67'),_0x2f95('0x68'),_0x2f95('0x69')]});}})[_0x2f95('0x1f')](function(_0x50f726){if(_0x50f726){return{'count':_0x50f726['count'],'rows':_[_0x2f95('0x3b')](_0x50f726[_0x2f95('0x51')],function(_0x5a603d){return{'membername':_0x5a603d[_0x2f95('0x39')],'UserId':_0x5a603d['id'],'queue_name':_0x45c5a0['name'],'ChatQueueId':_0x45c5a0['id'],'interface':util['format'](_0x2f95('0x6a'),'SIP',_0x5a603d['name']),'penalty':0x0,'paused':_0x5a603d[_0x2f95('0x67')],'createdAt':_0x5a603d[_0x2f95('0x69')],'updatedAt':_0x5a603d[_0x2f95('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2f95('0x1f')](respondWithFilteredResult(_0x1be025,_0x48891a))['catch'](handleError(_0x1be025,null));};exports[_0x2f95('0x6b')]=function(_0x1d4292,_0x316d69,_0x51e39b){var _0x515923={};var _0x9eacfa={};var _0x2c87e5;var _0x7c5bf7;return db[_0x2f95('0x4e')][_0x2f95('0x6c')]({'where':{'id':_0x1d4292[_0x2f95('0x52')]['id']}})[_0x2f95('0x1f')](handleEntityNotFound(_0x316d69,null))[_0x2f95('0x1f')](function(_0x2f058a){if(_0x2f058a){_0x2c87e5=_0x2f058a;_0x9eacfa[_0x2f95('0x43')]=_[_0x2f95('0x3f')](db[_0x2f95('0x6d')][_0x2f95('0x3c')]);_0x9eacfa[_0x2f95('0x40')]=_[_0x2f95('0x3f')](_0x1d4292['query']);_0x9eacfa[_0x2f95('0x41')]=_['intersection'](_0x9eacfa[_0x2f95('0x43')],_0x9eacfa[_0x2f95('0x40')]);_0x515923[_0x2f95('0x44')]=_[_0x2f95('0x42')](_0x9eacfa[_0x2f95('0x43')],qs[_0x2f95('0x45')](_0x1d4292[_0x2f95('0x40')]['fields']));_0x515923[_0x2f95('0x44')]=_0x515923[_0x2f95('0x44')][_0x2f95('0x53')]?_0x515923['attributes']:_0x9eacfa['model'];_0x515923[_0x2f95('0x47')]=qs['sort'](_0x1d4292[_0x2f95('0x40')][_0x2f95('0x62')]);_0x515923[_0x2f95('0x48')]=qs[_0x2f95('0x41')](_[_0x2f95('0x49')](_0x1d4292[_0x2f95('0x40')],_0x9eacfa[_0x2f95('0x41')]));if(_0x1d4292['query']['filter']){_0x515923['where']=_[_0x2f95('0x4c')](_0x515923['where'],{'$or':_[_0x2f95('0x3b')](_0x515923['attributes'],function(_0x2874bc){var _0x5108b0={};_0x5108b0[_0x2874bc]={'$like':'%'+_0x1d4292[_0x2f95('0x40')]['filter']+'%'};return _0x5108b0;})});}_0x515923=_[_0x2f95('0x4c')]({},_0x515923,_0x1d4292['options']);return _0x2c87e5[_0x2f95('0x6b')](_0x515923);}})[_0x2f95('0x1f')](function(_0x3d85da){if(_0x3d85da){_0x7c5bf7=_0x3d85da['length'];if(!_0x1d4292['query']['hasOwnProperty'](_0x2f95('0x61'))){_0x515923[_0x2f95('0x2f')]=qs['limit'](_0x1d4292[_0x2f95('0x40')][_0x2f95('0x2f')]);_0x515923[_0x2f95('0x2e')]=qs[_0x2f95('0x2e')](_0x1d4292[_0x2f95('0x40')][_0x2f95('0x2e')]);}return _0x2c87e5[_0x2f95('0x6b')](_0x515923);}})[_0x2f95('0x1f')](function(_0xf3611a){if(_0xf3611a){return _0xf3611a?{'count':_0x7c5bf7,'rows':_0xf3611a}:null;}})[_0x2f95('0x1f')](respondWithResult(_0x316d69,null))['catch'](handleError(_0x316d69,null));};exports[_0x2f95('0x6e')]=function(_0x46d9cc,_0x4c62fe,_0x832499){var _0x10f5af=_0x46d9cc[_0x2f95('0x56')][_0x2f95('0x6f')];return db['Team'][_0x2f95('0x50')]({'where':{'id':_0x10f5af},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x2f95('0x39'),_0x2f95('0x70'),_0x2f95('0x71'),'interface'],'raw':!![]}]})[_0x2f95('0x1f')](function(_0x5e6a78){if(_0x5e6a78){var _0x172f82=_[_0x2f95('0x72')](_0x5e6a78,function(_0x317df5){var _0x37db4=_0x317df5[_0x2f95('0x36')]({'plain':!![]});return _0x37db4[_0x2f95('0x73')];});return db[_0x2f95('0x4e')][_0x2f95('0x54')]({'where':{'id':_0x46d9cc[_0x2f95('0x52')]['id']}})['then'](function(_0x6b1083){return db['sequelize'][_0x2f95('0x74')](function(_0x23bd0a){return _0x6b1083['addTeams'](_0x10f5af,{'transaction':_0x23bd0a})[_0x2f95('0x1f')](function(){return BPromise[_0x2f95('0x75')](_0x172f82,function(_0x209f8b){return db[_0x2f95('0x60')]['findOrCreate']({'where':{'UserId':_0x209f8b['id'],'ChatQueueId':_0x46d9cc[_0x2f95('0x52')]['id']},'transaction':_0x23bd0a});});})[_0x2f95('0x1f')](function(){_0x172f82[_0x2f95('0x76')](function(_0x2b4b7d){socket[_0x2f95('0x77')](_0x2f95('0x78'),{'UserId':_0x2b4b7d['id'],'ChatQueueId':_0x6b1083['id']});});});});});}})['then'](respondWithStatusCode(_0x4c62fe,null))[_0x2f95('0x29')](handleError(_0x4c62fe,null));};exports[_0x2f95('0x79')]=function(_0x7d17b8,_0x9167a9,_0x424c8d){return db[_0x2f95('0x6d')][_0x2f95('0x50')]({'where':{'id':_0x7d17b8['query'][_0x2f95('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x2f95('0x64')],'as':_0x2f95('0x73'),'attributes':['id'],'raw':!![]}]})[_0x2f95('0x1f')](handleEntityNotFound(_0x9167a9,null))[_0x2f95('0x1f')](function(_0x2d0094){var _0x121a5b=_[_0x2f95('0x3b')](_0x2d0094,'id');var _0x3464f8=[];var _0x3933b3=[];var _0x12b784=squel[_0x2f95('0x7a')]();_0x12b784[_0x2f95('0x7b')](_0x2f95('0x7c'))[_0x2f95('0x7d')](_0x2f95('0x7e'),'tq')[_0x2f95('0x7f')](_0x2f95('0x80'),'ut',_0x2f95('0x81'))[_0x2f95('0x48')](_0x2f95('0x82'),_0x7d17b8[_0x2f95('0x52')]['id']);for(var _0x3a10f3=0x0;_0x3a10f3<_0x2d0094[_0x2f95('0x53')];_0x3a10f3+=0x1){let _0x3cb60c=_0x2d0094[_0x3a10f3];for(var _0x1b18dc=0x0;_0x1b18dc<_0x3cb60c[_0x2f95('0x73')][_0x2f95('0x53')];_0x1b18dc+=0x1){let _0x65a559=_0x3cb60c[_0x2f95('0x73')][_0x1b18dc];var _0x5d3c0b=_0x12b784['clone']();_0x5d3c0b[_0x2f95('0x48')](_0x2f95('0x83'),_0x65a559['id']);_0x3933b3[_0x2f95('0x84')](db['sequelize']['query'](_0x5d3c0b[_0x2f95('0x85')](),{'type':db[_0x2f95('0x86')][_0x2f95('0x87')][_0x2f95('0x88')]})[_0x2f95('0x1f')](function(_0x213323){if(_0x213323[_0x2f95('0x53')]===0x1){return _0x65a559['id'];}else{var _0xcfd9d6=_[_0x2f95('0x89')](_['map'](_0x213323,'TeamId'),function(_0x21f7f1){return _[_0x2f95('0x8a')](_0x121a5b,_0x21f7f1);});if(_0xcfd9d6){return _0x65a559['id'];}}}));}}return BPromise['all'](_0x3933b3)[_0x2f95('0x1f')](function(_0x2140a6){_0x3464f8=_(_0x3464f8)[_0x2f95('0x8b')](_0x2140a6)['compact']()[_0x2f95('0x8c')]();return db[_0x2f95('0x4e')][_0x2f95('0x54')]({'where':{'id':_0x7d17b8[_0x2f95('0x52')]['id']}})[_0x2f95('0x1f')](function(_0xdbe987){return db['sequelize'][_0x2f95('0x74')](function(_0x3b838a){return _0xdbe987['removeTeams'](_0x7d17b8[_0x2f95('0x40')][_0x2f95('0x6f')],{'transaction':_0x3b838a})[_0x2f95('0x1f')](function(){if(!_[_0x2f95('0x8d')](_0x3464f8)){return _0xdbe987[_0x2f95('0x8e')](_0x3464f8,{'transaction':_0x3b838a});}})[_0x2f95('0x1f')](function(){_0x3464f8[_0x2f95('0x76')](function(_0x3592eb){socket[_0x2f95('0x77')](_0x2f95('0x8f'),{'UserId':_0x3592eb,'ChatQueueId':_0xdbe987['id']});});});});});});})[_0x2f95('0x1f')](respondWithStatusCode(_0x9167a9,null))[_0x2f95('0x29')](handleError(_0x9167a9,null));};exports[_0x2f95('0x90')]=function(_0x2e5aa4,_0x51a993,_0x171c7e){return db[_0x2f95('0x4e')][_0x2f95('0x54')]({'where':{'id':_0x2e5aa4['params']['id']}})['then'](handleEntityNotFound(_0x51a993,null))[_0x2f95('0x1f')](function(_0x292ef4){if(_0x292ef4){return _0x292ef4['addAgents'](_0x2e5aa4[_0x2f95('0x56')][_0x2f95('0x6f')],_['omit'](_0x2e5aa4[_0x2f95('0x56')],['ids','id'])||{})[_0x2f95('0x91')](function(_0x5ce0fd){for(var _0x50733c=0x0;_0x50733c<_0x2e5aa4[_0x2f95('0x56')]['ids'][_0x2f95('0x53')];_0x50733c+=0x1){socket['emit'](_0x2f95('0x78'),{'UserId':Number(_0x2e5aa4[_0x2f95('0x56')]['ids'][_0x50733c]),'ChatQueueId':Number(_0x2e5aa4[_0x2f95('0x52')]['id'])});}return _0x5ce0fd;});}})[_0x2f95('0x1f')](respondWithResult(_0x51a993,null))['catch'](handleError(_0x51a993,null));};exports['removeAgents']=function(_0xaa9fec,_0x41b335,_0x542b76){return db[_0x2f95('0x4e')][_0x2f95('0x54')]({'where':{'id':_0xaa9fec[_0x2f95('0x52')]['id']}})[_0x2f95('0x1f')](handleEntityNotFound(_0x41b335,null))[_0x2f95('0x1f')](function(_0x375ab0){if(_0x375ab0){return _0x375ab0[_0x2f95('0x8e')](_0xaa9fec[_0x2f95('0x40')]['ids'])[_0x2f95('0x1f')](function(){if(_[_0x2f95('0x92')](_0xaa9fec[_0x2f95('0x40')]['ids'])){for(var _0x1876bd=0x0;_0x1876bd<_0xaa9fec[_0x2f95('0x40')][_0x2f95('0x6f')][_0x2f95('0x53')];_0x1876bd+=0x1){socket[_0x2f95('0x77')]('userChatQueue:remove',{'UserId':Number(_0xaa9fec[_0x2f95('0x40')]['ids'][_0x1876bd]),'ChatQueueId':Number(_0xaa9fec[_0x2f95('0x52')]['id'])});}}else{socket[_0x2f95('0x77')](_0x2f95('0x8f'),{'UserId':Number(_0xaa9fec[_0x2f95('0x40')][_0x2f95('0x6f')]),'ChatQueueId':Number(_0xaa9fec[_0x2f95('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x41b335,null))[_0x2f95('0x29')](handleError(_0x41b335,null));};exports[_0x2f95('0x93')]=function(_0x2eb188,_0x4a9884,_0x30a249){var _0x148041={};var _0x17cc25={};var _0x3edd33;var _0x4a0cea;return db[_0x2f95('0x4e')][_0x2f95('0x6c')]({'where':{'id':_0x2eb188[_0x2f95('0x52')]['id']}})[_0x2f95('0x1f')](handleEntityNotFound(_0x4a9884,null))['then'](function(_0x2ed15b){if(_0x2ed15b){_0x3edd33=_0x2ed15b;_0x17cc25['model']=_[_0x2f95('0x3f')](db[_0x2f95('0x64')]['rawAttributes']);_0x17cc25[_0x2f95('0x40')]=_['keys'](_0x2eb188[_0x2f95('0x40')]);_0x17cc25['filters']=_[_0x2f95('0x42')](_0x17cc25[_0x2f95('0x43')],_0x17cc25[_0x2f95('0x40')]);_0x148041[_0x2f95('0x44')]=_['intersection'](_0x17cc25['model'],qs[_0x2f95('0x45')](_0x2eb188['query'][_0x2f95('0x45')]));_0x148041['attributes']=_0x148041[_0x2f95('0x44')]['length']?_0x148041[_0x2f95('0x44')]:_0x17cc25[_0x2f95('0x43')];_0x148041[_0x2f95('0x47')]=qs[_0x2f95('0x62')](_0x2eb188[_0x2f95('0x40')][_0x2f95('0x62')]);_0x148041[_0x2f95('0x48')]=qs[_0x2f95('0x41')](_[_0x2f95('0x49')](_0x2eb188['query'],_0x17cc25[_0x2f95('0x41')]));if(_0x2eb188[_0x2f95('0x40')][_0x2f95('0x4a')]){_0x148041[_0x2f95('0x48')]=_[_0x2f95('0x4c')](_0x148041['where'],{'$or':_[_0x2f95('0x3b')](_0x148041[_0x2f95('0x44')],function(_0x460692){var _0x489400={};_0x489400[_0x460692]={'$like':'%'+_0x2eb188[_0x2f95('0x40')][_0x2f95('0x4a')]+'%'};return _0x489400;})});}_0x148041=_[_0x2f95('0x4c')]({},_0x148041,_0x2eb188[_0x2f95('0x4d')]);return _0x3edd33[_0x2f95('0x93')](_0x148041);}})[_0x2f95('0x1f')](function(_0x36f6e1){if(_0x36f6e1){_0x4a0cea=_0x36f6e1[_0x2f95('0x53')];if(!_0x2eb188[_0x2f95('0x40')][_0x2f95('0x46')]('nolimit')){_0x148041['limit']=qs['limit'](_0x2eb188[_0x2f95('0x40')][_0x2f95('0x2f')]);_0x148041[_0x2f95('0x2e')]=qs[_0x2f95('0x2e')](_0x2eb188[_0x2f95('0x40')][_0x2f95('0x2e')]);}return _0x3edd33[_0x2f95('0x93')](_0x148041);}})[_0x2f95('0x1f')](function(_0x3bf5fc){if(_0x3bf5fc){return _0x3bf5fc?{'count':_0x4a0cea,'rows':_0x3bf5fc}:null;}})[_0x2f95('0x1f')](respondWithResult(_0x4a9884,null))[_0x2f95('0x29')](handleError(_0x4a9884,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f851329..1a5fc89 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 _0x63c5=['save','update','emit','hasOwnProperty','hook','ChatQueue','setMaxListeners'];(function(_0x190e15,_0x3ae444){var _0x4edc9d=function(_0x13a932){while(--_0x13a932){_0x190e15['push'](_0x190e15['shift']());}};_0x4edc9d(++_0x3ae444);}(_0x63c5,0xde));var _0x563c=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x63c5[_0x19ac6e];return _0x1cdcf3;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x563c('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x563c('0x1')](0x0);var events={'afterCreate':_0x563c('0x2'),'afterUpdate':_0x563c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4a1c0a){return function(_0x31a098,_0x3e4756,_0x5a029f){ChatQueueEvents[_0x563c('0x4')](_0x4a1c0a+':'+_0x31a098['id'],_0x31a098);ChatQueueEvents[_0x563c('0x4')](_0x4a1c0a,_0x31a098);_0x5a029f(null);};}for(var e in events){if(events[_0x563c('0x5')](e)){var event=events[e];ChatQueue[_0x563c('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xdf0a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save'];(function(_0x200785,_0x243eb9){var _0x4d018f=function(_0x34c155){while(--_0x34c155){_0x200785['push'](_0x200785['shift']());}};_0x4d018f(++_0x243eb9);}(_0xdf0a,0x1a9));var _0xadf0=function(_0x4689da,_0x27449b){_0x4689da=_0x4689da-0x0;var _0x1c3037=_0xdf0a[_0x4689da];return _0x1c3037;};'use strict';var EventEmitter=require(_0xadf0('0x0'));var ChatQueue=require(_0xadf0('0x1'))['db'][_0xadf0('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xadf0('0x3')](0x0);var events={'afterCreate':_0xadf0('0x4'),'afterUpdate':'update','afterDestroy':_0xadf0('0x5')};function emitEvent(_0x50f8a2){return function(_0x54af37,_0x183ad1,_0x1c5842){ChatQueueEvents['emit'](_0x50f8a2+':'+_0x54af37['id'],_0x54af37);ChatQueueEvents[_0xadf0('0x6')](_0x50f8a2,_0x54af37);_0x1c5842(null);};}for(var e in events){if(events[_0xadf0('0x7')](e)){var event=events[e];ChatQueue[_0xadf0('0x8')](e,emitEvent(event));}}module[_0xadf0('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d2d52f9..ca3d99e 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 _0xcea4=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','api','moment'];(function(_0x3330b8,_0x19b32a){var _0x191799=function(_0xb95e53){while(--_0xb95e53){_0x3330b8['push'](_0x3330b8['shift']());}};_0x191799(++_0x19b32a);}(_0xcea4,0x80));var _0x4cea=function(_0x35a329,_0x488fee){_0x35a329=_0x35a329-0x0;var _0x4cbdb1=_0xcea4[_0x35a329];return _0x4cbdb1;};'use strict';var _=require(_0x4cea('0x0'));var util=require(_0x4cea('0x1'));var logger=require('../../config/logger')(_0x4cea('0x2'));var moment=require(_0x4cea('0x3'));var BPromise=require(_0x4cea('0x4'));var rp=require(_0x4cea('0x5'));var fs=require('fs');var path=require(_0x4cea('0x6'));var rimraf=require('rimraf');var config=require(_0x4cea('0x7'));var attributes=require(_0x4cea('0x8'));module['exports']=function(_0x5b081c,_0x4514d2){return _0x5b081c[_0x4cea('0x9')](_0x4cea('0xa'),attributes,{'tableName':_0x4cea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f2d=['chat_queues','util','moment','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4f2d,0x9a));var _0xd4f2=function(_0x4a9628,_0xd1aaba){_0x4a9628=_0x4a9628-0x0;var _0x282875=_0x4f2d[_0x4a9628];return _0x282875;};'use strict';var _=require('lodash');var util=require(_0xd4f2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd4f2('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f2('0x2'));var rimraf=require(_0xd4f2('0x3'));var config=require(_0xd4f2('0x4'));var attributes=require(_0xd4f2('0x5'));module['exports']=function(_0x5193e1,_0x35fbef){return _0x5193e1[_0xd4f2('0x6')](_0xd4f2('0x7'),attributes,{'tableName':_0xd4f2('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 eba2351..98a59b4 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 _0x8f59=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','then','GetChatQueue','ShowChatQueue','ChatQueue','find','lodash','util'];(function(_0x480e69,_0x372174){var _0x5e68f2=function(_0x4b4d80){while(--_0x4b4d80){_0x480e69['push'](_0x480e69['shift']());}};_0x5e68f2(++_0x372174);}(_0x8f59,0x11d));var _0x98f5=function(_0x1f98c0,_0x4ddddf){_0x1f98c0=_0x1f98c0-0x0;var _0x1cc656=_0x8f59[_0x1f98c0];return _0x1cc656;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./chatQueue.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('ChatQueue,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('ChatQueue,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});}exports['GetChatQueue']=function(_0xf88f34){var _0x5500a2=this;return new Promise(function(_0xd1209d,_0x191f23){return db['ChatQueue'][_0x98f5('0x1b')]({'raw':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x1d')]===undefined?!![]:![]:!![],'where':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x1e')]||null:null,'attributes':_0xf88f34['options']?_0xf88f34[_0x98f5('0x1c')]['attributes']||null:null,'limit':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34['options'][_0x98f5('0x1f')]||null:null,'include':_0xf88f34[_0x98f5('0x1c')]?_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x20')]?_[_0x98f5('0x21')](_0xf88f34[_0x98f5('0x1c')][_0x98f5('0x20')],function(_0x58d506){return{'model':db[_0x58d506[_0x98f5('0x22')]],'as':_0x58d506['as'],'attributes':_0x58d506[_0x98f5('0x23')],'include':_0x58d506['include']?_[_0x98f5('0x21')](_0x58d506[_0x98f5('0x20')],function(_0x5b08c2){return{'model':db[_0x5b08c2[_0x98f5('0x22')]],'as':_0x5b08c2['as'],'attributes':_0x5b08c2[_0x98f5('0x23')],'include':_0x5b08c2[_0x98f5('0x20')]?_[_0x98f5('0x21')](_0x5b08c2[_0x98f5('0x20')],function(_0x576c4b){return{'model':db[_0x576c4b['model']],'as':_0x576c4b['as'],'attributes':_0x576c4b[_0x98f5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x24')](function(_0x18bb29){logger[_0x98f5('0x10')](_0x98f5('0x25'),_0xf88f34);logger[_0x98f5('0x12')]('GetChatQueue',_0xf88f34,JSON[_0x98f5('0x14')](_0x18bb29));_0xd1209d(_0x18bb29);})[_0x98f5('0x1a')](function(_0x7a922b){logger[_0x98f5('0x15')](_0x98f5('0x25'),_0x7a922b[_0x98f5('0x17')],_0xf88f34);_0x191f23(_0x5500a2['error'](0x1f4,_0x7a922b[_0x98f5('0x17')]));});});};exports[_0x98f5('0x26')]=function(_0x229495){var _0x1e193c=this;return new Promise(function(_0x492771,_0x45ca95){return db[_0x98f5('0x27')][_0x98f5('0x28')]({'raw':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x1e')]||null:null,'attributes':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x23')]||null:null,'include':_0x229495[_0x98f5('0x1c')]?_0x229495[_0x98f5('0x1c')][_0x98f5('0x20')]?_[_0x98f5('0x21')](_0x229495[_0x98f5('0x1c')][_0x98f5('0x20')],function(_0x3187bd){return{'model':db[_0x3187bd[_0x98f5('0x22')]],'as':_0x3187bd['as'],'attributes':_0x3187bd['attributes'],'include':_0x3187bd[_0x98f5('0x20')]?_['map'](_0x3187bd['include'],function(_0xd69228){return{'model':db[_0xd69228[_0x98f5('0x22')]],'as':_0xd69228['as'],'attributes':_0xd69228[_0x98f5('0x23')],'include':_0xd69228[_0x98f5('0x20')]?_['map'](_0xd69228[_0x98f5('0x20')],function(_0x250933){return{'model':db[_0x250933[_0x98f5('0x22')]],'as':_0x250933['as'],'attributes':_0x250933['attributes']};}):[]};}):[]};}):[]:[]})[_0x98f5('0x24')](function(_0x1bf25b){logger['info'](_0x98f5('0x26'),_0x229495);logger[_0x98f5('0x12')](_0x98f5('0x26'),_0x229495,JSON['stringify'](_0x1bf25b));_0x492771(_0x1bf25b);})[_0x98f5('0x1a')](function(_0x3388cb){logger[_0x98f5('0x15')](_0x98f5('0x26'),_0x3388cb[_0x98f5('0x17')],_0x229495);_0x45ca95(_0x1e193c['error'](0x1f4,_0x3388cb['message']));});});}; \ No newline at end of file +var _0x86bc=['GetChatQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','ChatQueue','find','where','ShowChatQueue','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0x86bc,0x1b1));var _0xc86b=function(_0x19a54f,_0x51f8da){_0x19a54f=_0x19a54f-0x0;var _0x7baa25=_0x86bc[_0x19a54f];return _0x7baa25;};'use strict';var _=require(_0xc86b('0x0'));var util=require('util');var moment=require(_0xc86b('0x1'));var BPromise=require(_0xc86b('0x2'));var rs=require(_0xc86b('0x3'));var fs=require('fs');var Redis=require(_0xc86b('0x4'));var db=require(_0xc86b('0x5'))['db'];var utils=require(_0xc86b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc86b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc86b('0x8')]['http']({'port':0x232a});config['redis']=_[_0xc86b('0x9')](config[_0xc86b('0xa')],{'host':_0xc86b('0xb'),'port':0x18eb});var socket=require(_0xc86b('0xc'))(new Redis(config[_0xc86b('0xa')]));require('./chatQueue.socket')[_0xc86b('0xd')](socket);function respondWithRpcPromise(_0x320f92,_0x207e57,_0x2472a){return new BPromise(function(_0x28de01,_0x3c05c1){return client[_0xc86b('0xe')](_0x320f92,_0x2472a)[_0xc86b('0xf')](function(_0x4e2620){logger[_0xc86b('0x10')](_0xc86b('0x11'),_0x207e57,_0xc86b('0x12'));logger['debug'](_0xc86b('0x13'),_0x207e57,'request\x20sent',JSON['stringify'](_0x4e2620));if(_0x4e2620[_0xc86b('0x14')]){if(_0x4e2620[_0xc86b('0x14')]['code']===0x1f4){logger[_0xc86b('0x14')]('ChatQueue,\x20%s,\x20%s',_0x207e57,_0x4e2620[_0xc86b('0x14')][_0xc86b('0x15')]);return _0x3c05c1(_0x4e2620[_0xc86b('0x14')][_0xc86b('0x15')]);}logger[_0xc86b('0x14')]('ChatQueue,\x20%s,\x20%s',_0x207e57,_0x4e2620[_0xc86b('0x14')][_0xc86b('0x15')]);return _0x28de01(_0x4e2620[_0xc86b('0x14')][_0xc86b('0x15')]);}else{logger['info'](_0xc86b('0x11'),_0x207e57,_0xc86b('0x12'));_0x28de01(_0x4e2620[_0xc86b('0x16')][_0xc86b('0x15')]);}})['catch'](function(_0x18c2d1){logger[_0xc86b('0x14')]('ChatQueue,\x20%s,\x20%s',_0x207e57,_0x18c2d1);_0x3c05c1(_0x18c2d1);});});}exports[_0xc86b('0x17')]=function(_0x2ade00){var _0x5236f5=this;return new Promise(function(_0x58446d,_0x2d9172){return db['ChatQueue'][_0xc86b('0x18')]({'raw':_0x2ade00['options']?_0x2ade00[_0xc86b('0x19')][_0xc86b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ade00['options']?_0x2ade00[_0xc86b('0x19')]['where']||null:null,'attributes':_0x2ade00[_0xc86b('0x19')]?_0x2ade00[_0xc86b('0x19')][_0xc86b('0x1b')]||null:null,'limit':_0x2ade00[_0xc86b('0x19')]?_0x2ade00['options'][_0xc86b('0x1c')]||null:null,'include':_0x2ade00[_0xc86b('0x19')]?_0x2ade00[_0xc86b('0x19')][_0xc86b('0x1d')]?_[_0xc86b('0x1e')](_0x2ade00['options'][_0xc86b('0x1d')],function(_0x564f1){return{'model':db[_0x564f1[_0xc86b('0x1f')]],'as':_0x564f1['as'],'attributes':_0x564f1[_0xc86b('0x1b')],'include':_0x564f1[_0xc86b('0x1d')]?_['map'](_0x564f1[_0xc86b('0x1d')],function(_0x57c7fd){return{'model':db[_0x57c7fd[_0xc86b('0x1f')]],'as':_0x57c7fd['as'],'attributes':_0x57c7fd[_0xc86b('0x1b')],'include':_0x57c7fd[_0xc86b('0x1d')]?_[_0xc86b('0x1e')](_0x57c7fd[_0xc86b('0x1d')],function(_0x4482dc){return{'model':db[_0x4482dc[_0xc86b('0x1f')]],'as':_0x4482dc['as'],'attributes':_0x4482dc[_0xc86b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc86b('0xf')](function(_0x35ca48){logger[_0xc86b('0x10')]('GetChatQueue',_0x2ade00);logger['debug']('GetChatQueue',_0x2ade00,JSON[_0xc86b('0x20')](_0x35ca48));_0x58446d(_0x35ca48);})['catch'](function(_0x4fb2bd){logger[_0xc86b('0x14')](_0xc86b('0x17'),_0x4fb2bd[_0xc86b('0x15')],_0x2ade00);_0x2d9172(_0x5236f5[_0xc86b('0x14')](0x1f4,_0x4fb2bd[_0xc86b('0x15')]));});});};exports['ShowChatQueue']=function(_0x56f3f5){var _0x115223=this;return new Promise(function(_0x282301,_0x9e4348){return db[_0xc86b('0x21')][_0xc86b('0x22')]({'raw':_0x56f3f5[_0xc86b('0x19')]?_0x56f3f5[_0xc86b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56f3f5[_0xc86b('0x19')]?_0x56f3f5['options'][_0xc86b('0x23')]||null:null,'attributes':_0x56f3f5[_0xc86b('0x19')]?_0x56f3f5[_0xc86b('0x19')][_0xc86b('0x1b')]||null:null,'include':_0x56f3f5[_0xc86b('0x19')]?_0x56f3f5['options'][_0xc86b('0x1d')]?_[_0xc86b('0x1e')](_0x56f3f5[_0xc86b('0x19')]['include'],function(_0x359f35){return{'model':db[_0x359f35['model']],'as':_0x359f35['as'],'attributes':_0x359f35['attributes'],'include':_0x359f35[_0xc86b('0x1d')]?_['map'](_0x359f35['include'],function(_0x1d5486){return{'model':db[_0x1d5486[_0xc86b('0x1f')]],'as':_0x1d5486['as'],'attributes':_0x1d5486[_0xc86b('0x1b')],'include':_0x1d5486['include']?_['map'](_0x1d5486[_0xc86b('0x1d')],function(_0x2a11d3){return{'model':db[_0x2a11d3['model']],'as':_0x2a11d3['as'],'attributes':_0x2a11d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc86b('0xf')](function(_0x2116be){logger[_0xc86b('0x10')](_0xc86b('0x24'),_0x56f3f5);logger['debug'](_0xc86b('0x24'),_0x56f3f5,JSON[_0xc86b('0x20')](_0x2116be));_0x282301(_0x2116be);})[_0xc86b('0x25')](function(_0x419695){logger[_0xc86b('0x14')](_0xc86b('0x24'),_0x419695[_0xc86b('0x15')],_0x56f3f5);_0x9e4348(_0x115223[_0xc86b('0x14')](0x1f4,_0x419695['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d23c5c4..da333b5 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 _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x51b81d,_0x2dfac5){var _0x2c389d=function(_0x3249ce){while(--_0x3249ce){_0x51b81d['push'](_0x51b81d['shift']());}};_0x2c389d(++_0x2dfac5);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x4b84[_0x3b2244];return _0x2dcc14;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file +var _0x7bae=['remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x1379c7,_0x53496f){var _0x262625=function(_0x36d80e){while(--_0x36d80e){_0x1379c7['push'](_0x1379c7['shift']());}};_0x262625(++_0x53496f);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7bae[_0x4e9628];return _0x27bc8c;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0xe7ba('0x0'),_0xe7ba('0x1')];function createListener(_0x503803,_0x3963c7){return function(_0x4f2e91){_0x3963c7[_0xe7ba('0x2')](_0x503803,_0x4f2e91);};}function removeListener(_0x10908b,_0x166acb){return function(){ChatQueueEvents[_0xe7ba('0x3')](_0x10908b,_0x166acb);};}exports[_0xe7ba('0x4')]=function(_0xfd3a22){for(var _0x2d31df=0x0,_0x3c5e59=events[_0xe7ba('0x5')];_0x2d31df<_0x3c5e59;_0x2d31df++){var _0x34fb18=events[_0x2d31df];var _0x160565=createListener(_0xe7ba('0x6')+_0x34fb18,_0xfd3a22);ChatQueueEvents['on'](_0x34fb18,_0x160565);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 42e3c49..2b3bc82 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x47397f,_0x45ba05){var _0xba5ff1=function(_0x4e139a){while(--_0x4e139a){_0x47397f['push'](_0x47397f['shift']());}};_0xba5ff1(++_0x45ba05);}(_0x55ca,0x126));var _0xa55c=function(_0x411b14,_0x3f9e36){_0x411b14=_0x411b14-0x0;var _0x402736=_0x55ca[_0x411b14];return _0x402736;};'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')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);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['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x5dc6a7,_0x1fe8f5){var _0x1bd8e4=function(_0x33e2ad){while(--_0x33e2ad){_0x5dc6a7['push'](_0x5dc6a7['shift']());}};_0x1bd8e4(++_0x1fe8f5);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 842bb23..f3ccdc3 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 _0x9fc3=['DATE','moment','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9fc3,0x199));var _0x39fc=function(_0x520beb,_0x256dc1){_0x520beb=_0x520beb-0x0;var _0x17c1e1=_0x9fc3[_0x520beb];return _0x17c1e1;};'use strict';var moment=require(_0x39fc('0x0'));var Sequelize=require('sequelize');module[_0x39fc('0x1')]={'uniqueid':{'type':Sequelize[_0x39fc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x39fc('0x2')]},'joinAt':{'type':Sequelize[_0x39fc('0x3')]},'leaveAt':{'type':Sequelize[_0x39fc('0x3')]},'acceptAt':{'type':Sequelize[_0x39fc('0x3')]},'exitAt':{'type':Sequelize[_0x39fc('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfbcb=['exports','STRING','DATE','moment','sequelize'];(function(_0x10a19a,_0x1a45ec){var _0x3f7183=function(_0x33ef0c){while(--_0x33ef0c){_0x10a19a['push'](_0x10a19a['shift']());}};_0x3f7183(++_0x1a45ec);}(_0xfbcb,0xd0));var _0xbfbc=function(_0x39444a,_0x54bb08){_0x39444a=_0x39444a-0x0;var _0x54ca26=_0xfbcb[_0x39444a];return _0x54ca26;};'use strict';var moment=require(_0xbfbc('0x0'));var Sequelize=require(_0xbfbc('0x1'));module[_0xbfbc('0x2')]={'uniqueid':{'type':Sequelize[_0xbfbc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbfbc('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbfbc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbfbc('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7b3c9a0..ee03653 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 _0x1410=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','find','catch','create','body','params','describe'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0x1410,0x130));var _0x0141=function(_0x5ac381,_0x50aabb){_0x5ac381=_0x5ac381-0x0;var _0x516264=_0x1410[_0x5ac381];return _0x516264;};'use strict';var emlformat=require(_0x0141('0x0'));var rimraf=require(_0x0141('0x1'));var zipdir=require(_0x0141('0x2'));var jsonpatch=require(_0x0141('0x3'));var rp=require('request-promise');var moment=require(_0x0141('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0141('0x5'));var util=require('util');var path=require(_0x0141('0x6'));var sox=require(_0x0141('0x7'));var csv=require(_0x0141('0x8'));var ejs=require(_0x0141('0x9'));var fs=require('fs');var fs_extra=require(_0x0141('0xa'));var _=require(_0x0141('0xb'));var squel=require(_0x0141('0xc'));var crypto=require(_0x0141('0xd'));var jsforce=require(_0x0141('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0141('0x8'));var querystring=require(_0x0141('0xf'));var Papa=require(_0x0141('0x10'));var Redis=require(_0x0141('0x11'));var authService=require(_0x0141('0x12'));var qs=require(_0x0141('0x13'));var as=require(_0x0141('0x14'));var hardwareService=require(_0x0141('0x15'));var logger=require('../../config/logger')(_0x0141('0x16'));var utils=require(_0x0141('0x17'));var config=require(_0x0141('0x18'));var licenseUtil=require(_0x0141('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49cebd,_0xab59e3){_0xab59e3=_0xab59e3||0xcc;return function(_0x25aefb){if(_0x25aefb){return _0x49cebd['sendStatus'](_0xab59e3);}return _0x49cebd[_0x0141('0x1a')](_0xab59e3)[_0x0141('0x1b')]();};}function respondWithResult(_0x16a55a,_0x245007){_0x245007=_0x245007||0xc8;return function(_0x1665e2){if(_0x1665e2){return _0x16a55a['status'](_0x245007)[_0x0141('0x1c')](_0x1665e2);}};}function respondWithFilteredResult(_0x5edd9f,_0x2ee001){return function(_0x3db66a){if(_0x3db66a){var _0x345fbd=typeof _0x2ee001[_0x0141('0x1d')]===_0x0141('0x1e')&&typeof _0x2ee001[_0x0141('0x1f')]==='undefined';var _0x58c3bb=_0x3db66a[_0x0141('0x20')];var _0x3720f6=_0x345fbd?0x0:_0x2ee001['offset'];var _0x9c1eec=_0x345fbd?_0x3db66a[_0x0141('0x20')]:_0x2ee001[_0x0141('0x1d')]+_0x2ee001[_0x0141('0x1f')];var _0x5427b5;if(_0x9c1eec>=_0x58c3bb){_0x9c1eec=_0x58c3bb;_0x5427b5=0xc8;}else{_0x5427b5=0xce;}_0x5edd9f[_0x0141('0x1a')](_0x5427b5);return _0x5edd9f[_0x0141('0x21')]('Content-Range',_0x3720f6+'-'+_0x9c1eec+'/'+_0x58c3bb)[_0x0141('0x1c')](_0x3db66a);}return null;};}function patchUpdates(_0x3e8603){return function(_0x17585f){try{jsonpatch[_0x0141('0x22')](_0x17585f,_0x3e8603,!![]);}catch(_0x316f70){return BPromise[_0x0141('0x23')](_0x316f70);}return _0x17585f['save']();};}function saveUpdates(_0x21d8fc,_0x40c774){return function(_0x363860){if(_0x363860){return _0x363860[_0x0141('0x24')](_0x21d8fc)[_0x0141('0x25')](function(_0x1a4b0b){return _0x1a4b0b;});}return null;};}function removeEntity(_0xccf0c,_0x20656b){return function(_0x12a11e){if(_0x12a11e){return _0x12a11e[_0x0141('0x26')]()[_0x0141('0x25')](function(){_0xccf0c[_0x0141('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4247d,_0x14ecbf){return function(_0xb80072){if(!_0xb80072){_0x4247d[_0x0141('0x27')](0x194);}return _0xb80072;};}function handleError(_0xcc5658,_0x52e90a){_0x52e90a=_0x52e90a||0x1f4;return function(_0x59196f){logger[_0x0141('0x28')](_0x59196f[_0x0141('0x29')]);if(_0x59196f['name']){delete _0x59196f[_0x0141('0x2a')];}_0xcc5658['status'](_0x52e90a)[_0x0141('0x2b')](_0x59196f);};}exports[_0x0141('0x2c')]=function(_0x400602,_0x378a87){var _0x2379ad={},_0x29f463={},_0x146daf={'count':0x0,'rows':[]};var _0xc6eabc=_[_0x0141('0x2d')](db[_0x0141('0x2e')][_0x0141('0x2f')],function(_0x36c409){return{'name':_0x36c409[_0x0141('0x30')],'type':_0x36c409['type'][_0x0141('0x31')]};});_0x29f463['model']=_[_0x0141('0x2d')](_0xc6eabc,_0x0141('0x2a'));_0x29f463[_0x0141('0x32')]=_[_0x0141('0x33')](_0x400602[_0x0141('0x32')]);_0x29f463[_0x0141('0x34')]=_['intersection'](_0x29f463[_0x0141('0x35')],_0x29f463['query']);_0x2379ad[_0x0141('0x36')]=_[_0x0141('0x37')](_0x29f463[_0x0141('0x35')],qs['fields'](_0x400602[_0x0141('0x32')][_0x0141('0x38')]));_0x2379ad['attributes']=_0x2379ad[_0x0141('0x36')][_0x0141('0x39')]?_0x2379ad[_0x0141('0x36')]:_0x29f463[_0x0141('0x35')];if(!_0x400602[_0x0141('0x32')]['hasOwnProperty'](_0x0141('0x3a'))){_0x2379ad[_0x0141('0x1f')]=qs[_0x0141('0x1f')](_0x400602[_0x0141('0x32')][_0x0141('0x1f')]);_0x2379ad[_0x0141('0x1d')]=qs['offset'](_0x400602['query'][_0x0141('0x1d')]);}_0x2379ad[_0x0141('0x3b')]=qs['sort'](_0x400602[_0x0141('0x32')][_0x0141('0x3c')]);_0x2379ad[_0x0141('0x3d')]=qs['filters'](_['pick'](_0x400602['query'],_0x29f463[_0x0141('0x34')]),_0xc6eabc);if(_0x400602[_0x0141('0x32')][_0x0141('0x3e')]){_0x2379ad[_0x0141('0x3d')]=_[_0x0141('0x3f')](_0x2379ad[_0x0141('0x3d')],{'$or':_[_0x0141('0x2d')](_0xc6eabc,function(_0x51ae65){if(_0x51ae65[_0x0141('0x40')]!==_0x0141('0x41')){var _0x5b76c1={};_0x5b76c1[_0x51ae65[_0x0141('0x2a')]]={'$like':'%'+_0x400602[_0x0141('0x32')][_0x0141('0x3e')]+'%'};return _0x5b76c1;}})});}_0x2379ad=_[_0x0141('0x3f')]({},_0x2379ad,_0x400602[_0x0141('0x42')]);var _0x158480={'where':_0x2379ad[_0x0141('0x3d')]};return db[_0x0141('0x2e')]['count'](_0x158480)[_0x0141('0x25')](function(_0x9e9408){_0x146daf['count']=_0x9e9408;if(_0x400602[_0x0141('0x32')][_0x0141('0x43')]){_0x2379ad[_0x0141('0x44')]=[{'all':!![]}];}return db[_0x0141('0x2e')][_0x0141('0x45')](_0x2379ad);})['then'](function(_0x1746a1){_0x146daf['rows']=_0x1746a1;return _0x146daf;})[_0x0141('0x25')](respondWithFilteredResult(_0x378a87,_0x2379ad))['catch'](handleError(_0x378a87,null));};exports['show']=function(_0x4e863f,_0x25870d){var _0x2579df={'raw':!![],'where':{'id':_0x4e863f['params']['id']}},_0x210a8c={};_0x210a8c[_0x0141('0x35')]=_[_0x0141('0x33')](db[_0x0141('0x2e')][_0x0141('0x2f')]);_0x210a8c['query']=_[_0x0141('0x33')](_0x4e863f[_0x0141('0x32')]);_0x210a8c[_0x0141('0x34')]=_[_0x0141('0x37')](_0x210a8c[_0x0141('0x35')],_0x210a8c[_0x0141('0x32')]);_0x2579df[_0x0141('0x36')]=_[_0x0141('0x37')](_0x210a8c['model'],qs[_0x0141('0x38')](_0x4e863f[_0x0141('0x32')][_0x0141('0x38')]));_0x2579df['attributes']=_0x2579df[_0x0141('0x36')][_0x0141('0x39')]?_0x2579df[_0x0141('0x36')]:_0x210a8c['model'];if(_0x4e863f[_0x0141('0x32')]['includeAll']){_0x2579df[_0x0141('0x44')]=[{'all':!![]}];}_0x2579df=_['merge']({},_0x2579df,_0x4e863f[_0x0141('0x42')]);return db['ChatQueueReport'][_0x0141('0x46')](_0x2579df)[_0x0141('0x25')](handleEntityNotFound(_0x25870d,null))[_0x0141('0x25')](respondWithResult(_0x25870d,null))[_0x0141('0x47')](handleError(_0x25870d,null));};exports[_0x0141('0x48')]=function(_0x482e1e,_0x3890ef){return db[_0x0141('0x2e')][_0x0141('0x48')](_0x482e1e['body'],{})[_0x0141('0x25')](respondWithResult(_0x3890ef,0xc9))[_0x0141('0x47')](handleError(_0x3890ef,null));};exports[_0x0141('0x24')]=function(_0x4978a3,_0x3e30a8){if(_0x4978a3['body']['id']){delete _0x4978a3[_0x0141('0x49')]['id'];}return db[_0x0141('0x2e')][_0x0141('0x46')]({'where':{'id':_0x4978a3[_0x0141('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e30a8,null))[_0x0141('0x25')](saveUpdates(_0x4978a3[_0x0141('0x49')],null))[_0x0141('0x25')](respondWithResult(_0x3e30a8,null))[_0x0141('0x47')](handleError(_0x3e30a8,null));};exports[_0x0141('0x26')]=function(_0x2da74f,_0x4a37d3){return db['ChatQueueReport'][_0x0141('0x46')]({'where':{'id':_0x2da74f[_0x0141('0x4a')]['id']}})[_0x0141('0x25')](handleEntityNotFound(_0x4a37d3,null))['then'](removeEntity(_0x4a37d3,null))[_0x0141('0x47')](handleError(_0x4a37d3,null));};exports[_0x0141('0x4b')]=function(_0x1a4217,_0x4b7d84){return db[_0x0141('0x2e')]['describe']()[_0x0141('0x25')](respondWithResult(_0x4b7d84,null))[_0x0141('0x47')](handleError(_0x4b7d84,null));}; \ No newline at end of file +var _0x9c63=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','update','then','destroy','stack','name','send','index','ChatQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x5a9b03,_0x1f37a7){var _0x17f72c=function(_0x4af997){while(--_0x4af997){_0x5a9b03['push'](_0x5a9b03['shift']());}};_0x17f72c(++_0x1f37a7);}(_0x9c63,0x1a7));var _0x39c6=function(_0x20e864,_0x97df2f){_0x20e864=_0x20e864-0x0;var _0x50535b=_0x9c63[_0x20e864];return _0x50535b;};'use strict';var emlformat=require(_0x39c6('0x0'));var rimraf=require(_0x39c6('0x1'));var zipdir=require(_0x39c6('0x2'));var jsonpatch=require(_0x39c6('0x3'));var rp=require(_0x39c6('0x4'));var moment=require('moment');var BPromise=require(_0x39c6('0x5'));var Mustache=require(_0x39c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x39c6('0x7'));var csv=require(_0x39c6('0x8'));var ejs=require(_0x39c6('0x9'));var fs=require('fs');var fs_extra=require(_0x39c6('0xa'));var _=require(_0x39c6('0xb'));var squel=require(_0x39c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39c6('0xd'));var deskjs=require(_0x39c6('0xe'));var toCsv=require(_0x39c6('0x8'));var querystring=require(_0x39c6('0xf'));var Papa=require(_0x39c6('0x10'));var Redis=require('ioredis');var authService=require(_0x39c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x39c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c6('0x13'))(_0x39c6('0x14'));var utils=require(_0x39c6('0x15'));var config=require(_0x39c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x39c6('0x17'))['db'];function respondWithStatusCode(_0x5a9e9a,_0x58a65f){_0x58a65f=_0x58a65f||0xcc;return function(_0x1f3e1d){if(_0x1f3e1d){return _0x5a9e9a[_0x39c6('0x18')](_0x58a65f);}return _0x5a9e9a[_0x39c6('0x19')](_0x58a65f)[_0x39c6('0x1a')]();};}function respondWithResult(_0x504041,_0x124d43){_0x124d43=_0x124d43||0xc8;return function(_0x4c83dc){if(_0x4c83dc){return _0x504041[_0x39c6('0x19')](_0x124d43)[_0x39c6('0x1b')](_0x4c83dc);}};}function respondWithFilteredResult(_0x2ac896,_0x4c732a){return function(_0x5e3046){if(_0x5e3046){var _0x4581d7=typeof _0x4c732a[_0x39c6('0x1c')]==='undefined'&&typeof _0x4c732a[_0x39c6('0x1d')]===_0x39c6('0x1e');var _0x10ffb8=_0x5e3046[_0x39c6('0x1f')];var _0x129613=_0x4581d7?0x0:_0x4c732a[_0x39c6('0x1c')];var _0x518536=_0x4581d7?_0x5e3046['count']:_0x4c732a['offset']+_0x4c732a['limit'];var _0x524702;if(_0x518536>=_0x10ffb8){_0x518536=_0x10ffb8;_0x524702=0xc8;}else{_0x524702=0xce;}_0x2ac896[_0x39c6('0x19')](_0x524702);return _0x2ac896['set']('Content-Range',_0x129613+'-'+_0x518536+'/'+_0x10ffb8)[_0x39c6('0x1b')](_0x5e3046);}return null;};}function patchUpdates(_0x37dce5){return function(_0x1d91aa){try{jsonpatch[_0x39c6('0x20')](_0x1d91aa,_0x37dce5,!![]);}catch(_0x5608dd){return BPromise['reject'](_0x5608dd);}return _0x1d91aa['save']();};}function saveUpdates(_0x35fc85,_0x588c1d){return function(_0x5d4083){if(_0x5d4083){return _0x5d4083[_0x39c6('0x21')](_0x35fc85)[_0x39c6('0x22')](function(_0x358f6f){return _0x358f6f;});}return null;};}function removeEntity(_0x2e88a3,_0x3e4d7d){return function(_0x33132f){if(_0x33132f){return _0x33132f[_0x39c6('0x23')]()[_0x39c6('0x22')](function(){_0x2e88a3[_0x39c6('0x19')](0xcc)[_0x39c6('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3a7,_0x3018f6){return function(_0x3e49ca){if(!_0x3e49ca){_0x2fd3a7[_0x39c6('0x18')](0x194);}return _0x3e49ca;};}function handleError(_0x1ebdf2,_0x46d0c3){_0x46d0c3=_0x46d0c3||0x1f4;return function(_0x1708e7){logger['error'](_0x1708e7[_0x39c6('0x24')]);if(_0x1708e7[_0x39c6('0x25')]){delete _0x1708e7[_0x39c6('0x25')];}_0x1ebdf2['status'](_0x46d0c3)[_0x39c6('0x26')](_0x1708e7);};}exports[_0x39c6('0x27')]=function(_0x185869,_0x179f15){var _0x5c07f7={},_0x4937c4={},_0x43d1be={'count':0x0,'rows':[]};var _0x243d47=_['map'](db[_0x39c6('0x28')]['rawAttributes'],function(_0x520e8a){return{'name':_0x520e8a[_0x39c6('0x29')],'type':_0x520e8a[_0x39c6('0x2a')][_0x39c6('0x2b')]};});_0x4937c4[_0x39c6('0x2c')]=_[_0x39c6('0x2d')](_0x243d47,_0x39c6('0x25'));_0x4937c4[_0x39c6('0x2e')]=_[_0x39c6('0x2f')](_0x185869[_0x39c6('0x2e')]);_0x4937c4[_0x39c6('0x30')]=_[_0x39c6('0x31')](_0x4937c4[_0x39c6('0x2c')],_0x4937c4[_0x39c6('0x2e')]);_0x5c07f7[_0x39c6('0x32')]=_[_0x39c6('0x31')](_0x4937c4[_0x39c6('0x2c')],qs[_0x39c6('0x33')](_0x185869['query']['fields']));_0x5c07f7[_0x39c6('0x32')]=_0x5c07f7[_0x39c6('0x32')][_0x39c6('0x34')]?_0x5c07f7[_0x39c6('0x32')]:_0x4937c4[_0x39c6('0x2c')];if(!_0x185869[_0x39c6('0x2e')][_0x39c6('0x35')]('nolimit')){_0x5c07f7[_0x39c6('0x1d')]=qs[_0x39c6('0x1d')](_0x185869['query']['limit']);_0x5c07f7[_0x39c6('0x1c')]=qs[_0x39c6('0x1c')](_0x185869[_0x39c6('0x2e')][_0x39c6('0x1c')]);}_0x5c07f7[_0x39c6('0x36')]=qs[_0x39c6('0x37')](_0x185869[_0x39c6('0x2e')][_0x39c6('0x37')]);_0x5c07f7[_0x39c6('0x38')]=qs[_0x39c6('0x30')](_[_0x39c6('0x39')](_0x185869[_0x39c6('0x2e')],_0x4937c4[_0x39c6('0x30')]),_0x243d47);if(_0x185869['query']['filter']){_0x5c07f7[_0x39c6('0x38')]=_[_0x39c6('0x3a')](_0x5c07f7[_0x39c6('0x38')],{'$or':_['map'](_0x243d47,function(_0x2eda73){if(_0x2eda73[_0x39c6('0x2a')]!==_0x39c6('0x3b')){var _0xd92ccc={};_0xd92ccc[_0x2eda73['name']]={'$like':'%'+_0x185869['query'][_0x39c6('0x3c')]+'%'};return _0xd92ccc;}})});}_0x5c07f7=_['merge']({},_0x5c07f7,_0x185869[_0x39c6('0x3d')]);var _0x18aae9={'where':_0x5c07f7[_0x39c6('0x38')]};return db[_0x39c6('0x28')]['count'](_0x18aae9)[_0x39c6('0x22')](function(_0x8e4821){_0x43d1be[_0x39c6('0x1f')]=_0x8e4821;if(_0x185869[_0x39c6('0x2e')][_0x39c6('0x3e')]){_0x5c07f7[_0x39c6('0x3f')]=[{'all':!![]}];}return db[_0x39c6('0x28')][_0x39c6('0x40')](_0x5c07f7);})[_0x39c6('0x22')](function(_0x4bf748){_0x43d1be['rows']=_0x4bf748;return _0x43d1be;})[_0x39c6('0x22')](respondWithFilteredResult(_0x179f15,_0x5c07f7))['catch'](handleError(_0x179f15,null));};exports[_0x39c6('0x41')]=function(_0x4c3bf2,_0x4989ac){var _0x3642fc={'raw':!![],'where':{'id':_0x4c3bf2[_0x39c6('0x42')]['id']}},_0x1f6d26={};_0x1f6d26['model']=_[_0x39c6('0x2f')](db[_0x39c6('0x28')][_0x39c6('0x43')]);_0x1f6d26[_0x39c6('0x2e')]=_[_0x39c6('0x2f')](_0x4c3bf2[_0x39c6('0x2e')]);_0x1f6d26['filters']=_['intersection'](_0x1f6d26[_0x39c6('0x2c')],_0x1f6d26[_0x39c6('0x2e')]);_0x3642fc['attributes']=_[_0x39c6('0x31')](_0x1f6d26[_0x39c6('0x2c')],qs['fields'](_0x4c3bf2[_0x39c6('0x2e')][_0x39c6('0x33')]));_0x3642fc[_0x39c6('0x32')]=_0x3642fc[_0x39c6('0x32')][_0x39c6('0x34')]?_0x3642fc[_0x39c6('0x32')]:_0x1f6d26['model'];if(_0x4c3bf2[_0x39c6('0x2e')][_0x39c6('0x3e')]){_0x3642fc[_0x39c6('0x3f')]=[{'all':!![]}];}_0x3642fc=_[_0x39c6('0x3a')]({},_0x3642fc,_0x4c3bf2[_0x39c6('0x3d')]);return db['ChatQueueReport'][_0x39c6('0x44')](_0x3642fc)['then'](handleEntityNotFound(_0x4989ac,null))[_0x39c6('0x22')](respondWithResult(_0x4989ac,null))[_0x39c6('0x45')](handleError(_0x4989ac,null));};exports[_0x39c6('0x46')]=function(_0x15dc9a,_0x144130){return db[_0x39c6('0x28')][_0x39c6('0x46')](_0x15dc9a[_0x39c6('0x47')],{})['then'](respondWithResult(_0x144130,0xc9))[_0x39c6('0x45')](handleError(_0x144130,null));};exports[_0x39c6('0x21')]=function(_0x209bda,_0x3147e2){if(_0x209bda[_0x39c6('0x47')]['id']){delete _0x209bda[_0x39c6('0x47')]['id'];}return db[_0x39c6('0x28')][_0x39c6('0x44')]({'where':{'id':_0x209bda[_0x39c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3147e2,null))[_0x39c6('0x22')](saveUpdates(_0x209bda[_0x39c6('0x47')],null))[_0x39c6('0x22')](respondWithResult(_0x3147e2,null))['catch'](handleError(_0x3147e2,null));};exports[_0x39c6('0x23')]=function(_0x56df9b,_0x34f0bf){return db['ChatQueueReport'][_0x39c6('0x44')]({'where':{'id':_0x56df9b[_0x39c6('0x42')]['id']}})[_0x39c6('0x22')](handleEntityNotFound(_0x34f0bf,null))['then'](removeEntity(_0x34f0bf,null))[_0x39c6('0x45')](handleError(_0x34f0bf,null));};exports[_0x39c6('0x48')]=function(_0x348228,_0x27e8e7){return db[_0x39c6('0x28')][_0x39c6('0x48')]()['then'](respondWithResult(_0x27e8e7,null))[_0x39c6('0x45')](handleError(_0x27e8e7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ee2a5c7..20e5a98 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5eeab4,_0x54e64d){var _0x17db45=function(_0x48f859){while(--_0x48f859){_0x5eeab4['push'](_0x5eeab4['shift']());}};_0x17db45(++_0x54e64d);}(_0x757a,0xde));var _0xa757=function(_0x5beefa,_0x23c13d){_0x5beefa=_0x5beefa-0x0;var _0x5504c3=_0x757a[_0x5beefa];return _0x5504c3;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index a538412..74eff32 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 _0xdcbc=['catch','create','body','options','raw','CreateChatQueueReport','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x53c5df,_0x55ca90){var _0x102fd5=function(_0x35e6b7){while(--_0x35e6b7){_0x53c5df['push'](_0x53c5df['shift']());}};_0x102fd5(++_0x55ca90);}(_0xdcbc,0x80));var _0xcdcb=function(_0x5bcd52,_0x40b674){_0x5bcd52=_0x5bcd52-0x0;var _0x2ce4df=_0xdcbc[_0x5bcd52];return _0x2ce4df;};'use strict';var _=require(_0xcdcb('0x0'));var util=require(_0xcdcb('0x1'));var moment=require(_0xcdcb('0x2'));var BPromise=require(_0xcdcb('0x3'));var rs=require(_0xcdcb('0x4'));var fs=require('fs');var Redis=require(_0xcdcb('0x5'));var db=require(_0xcdcb('0x6'))['db'];var utils=require(_0xcdcb('0x7'));var logger=require(_0xcdcb('0x8'))(_0xcdcb('0x9'));var config=require(_0xcdcb('0xa'));var jayson=require(_0xcdcb('0xb'));var client=jayson[_0xcdcb('0xc')][_0xcdcb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38de32,_0x33a6dc,_0x1e97a3){return new BPromise(function(_0x566592,_0x27d608){return client[_0xcdcb('0xe')](_0x38de32,_0x1e97a3)['then'](function(_0x2dc70a){logger[_0xcdcb('0xf')](_0xcdcb('0x10'),_0x33a6dc,_0xcdcb('0x11'));logger[_0xcdcb('0x12')](_0xcdcb('0x13'),_0x33a6dc,_0xcdcb('0x11'),JSON['stringify'](_0x2dc70a));if(_0x2dc70a['error']){if(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x15')]===0x1f4){logger[_0xcdcb('0x14')](_0xcdcb('0x10'),_0x33a6dc,_0x2dc70a['error'][_0xcdcb('0x16')]);return _0x27d608(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);}logger[_0xcdcb('0x14')](_0xcdcb('0x10'),_0x33a6dc,_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);return _0x566592(_0x2dc70a[_0xcdcb('0x14')][_0xcdcb('0x16')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x33a6dc,_0xcdcb('0x11'));_0x566592(_0x2dc70a[_0xcdcb('0x17')][_0xcdcb('0x16')]);}})[_0xcdcb('0x18')](function(_0x59e554){logger[_0xcdcb('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x33a6dc,_0x59e554);_0x27d608(_0x59e554);});});}exports['CreateChatQueueReport']=function(_0xbe493b){var _0x9b5430=this;return new Promise(function(_0x1f58ec,_0x5df6f1){return db['ChatQueueReport'][_0xcdcb('0x19')](_0xbe493b[_0xcdcb('0x1a')],{'raw':_0xbe493b[_0xcdcb('0x1b')]?_0xbe493b[_0xcdcb('0x1b')][_0xcdcb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2c34a1){logger[_0xcdcb('0xf')](_0xcdcb('0x1d'),_0xbe493b);logger['debug']('CreateChatQueueReport',_0xbe493b,JSON[_0xcdcb('0x1e')](_0x2c34a1));_0x1f58ec(_0x2c34a1);})[_0xcdcb('0x18')](function(_0x2887ce){logger[_0xcdcb('0x14')](_0xcdcb('0x1d'),_0x2887ce['message'],_0xbe493b);_0x5df6f1(_0x9b5430[_0xcdcb('0x14')](0x1f4,_0x2887ce[_0xcdcb('0x16')]));});});};exports[_0xcdcb('0x1f')]=function(_0x22c9ba){var _0x14c553=this;return new Promise(function(_0x506044,_0x25bc83){return db[_0xcdcb('0x20')][_0xcdcb('0x21')](_0x22c9ba[_0xcdcb('0x1a')],{'raw':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x22')]||null:null,'attributes':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x23')]||null:null,'limit':_0x22c9ba[_0xcdcb('0x1b')]?_0x22c9ba[_0xcdcb('0x1b')][_0xcdcb('0x24')]||null:null})[_0xcdcb('0x25')](function(_0x1c0d5d){logger[_0xcdcb('0xf')]('UpdateChatQueueReport',_0x22c9ba);logger['debug'](_0xcdcb('0x1f'),_0x22c9ba,JSON['stringify'](_0x1c0d5d));_0x506044(_0x1c0d5d);})[_0xcdcb('0x18')](function(_0x16ee2e){logger[_0xcdcb('0x14')](_0xcdcb('0x1f'),_0x16ee2e['message'],_0x22c9ba);_0x25bc83(_0x14c553[_0xcdcb('0x14')](0x1f4,_0x16ee2e[_0xcdcb('0x16')]));});});}; \ No newline at end of file +var _0x769d=['ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','options','raw','then','catch','UpdateChatQueueReport','update','body','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x15d6d5,_0x38c614){var _0x56a52d=function(_0x37cb9f){while(--_0x37cb9f){_0x15d6d5['push'](_0x15d6d5['shift']());}};_0x56a52d(++_0x38c614);}(_0x769d,0x132));var _0xd769=function(_0x16b816,_0x59c5f7){_0x16b816=_0x16b816-0x0;var _0xcbca40=_0x769d[_0x16b816];return _0xcbca40;};'use strict';var _=require(_0xd769('0x0'));var util=require(_0xd769('0x1'));var moment=require(_0xd769('0x2'));var BPromise=require(_0xd769('0x3'));var rs=require(_0xd769('0x4'));var fs=require('fs');var Redis=require(_0xd769('0x5'));var db=require(_0xd769('0x6'))['db'];var utils=require(_0xd769('0x7'));var logger=require(_0xd769('0x8'))(_0xd769('0x9'));var config=require('../../config/environment');var jayson=require(_0xd769('0xa'));var client=jayson[_0xd769('0xb')][_0xd769('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39bb4c,_0x22fa61,_0xced3ae){return new BPromise(function(_0x2dfd2b,_0x4cb6e6){return client['request'](_0x39bb4c,_0xced3ae)['then'](function(_0x36ec60){logger[_0xd769('0xd')](_0xd769('0xe'),_0x22fa61,'request\x20sent');logger[_0xd769('0xf')](_0xd769('0x10'),_0x22fa61,_0xd769('0x11'),JSON[_0xd769('0x12')](_0x36ec60));if(_0x36ec60['error']){if(_0x36ec60[_0xd769('0x13')]['code']===0x1f4){logger[_0xd769('0x13')](_0xd769('0xe'),_0x22fa61,_0x36ec60[_0xd769('0x13')][_0xd769('0x14')]);return _0x4cb6e6(_0x36ec60[_0xd769('0x13')]['message']);}logger[_0xd769('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x22fa61,_0x36ec60[_0xd769('0x13')][_0xd769('0x14')]);return _0x2dfd2b(_0x36ec60[_0xd769('0x13')][_0xd769('0x14')]);}else{logger[_0xd769('0xd')](_0xd769('0xe'),_0x22fa61,_0xd769('0x11'));_0x2dfd2b(_0x36ec60[_0xd769('0x15')]['message']);}})['catch'](function(_0x5222fc){logger[_0xd769('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x22fa61,_0x5222fc);_0x4cb6e6(_0x5222fc);});});}exports[_0xd769('0x16')]=function(_0x4c6719){var _0x2d499b=this;return new Promise(function(_0x409134,_0x394a92){return db[_0xd769('0x17')]['create'](_0x4c6719['body'],{'raw':_0x4c6719['options']?_0x4c6719[_0xd769('0x18')][_0xd769('0x19')]===undefined?!![]:![]:!![]})[_0xd769('0x1a')](function(_0x322771){logger['info'](_0xd769('0x16'),_0x4c6719);logger[_0xd769('0xf')]('CreateChatQueueReport',_0x4c6719,JSON[_0xd769('0x12')](_0x322771));_0x409134(_0x322771);})[_0xd769('0x1b')](function(_0x36c220){logger['error'](_0xd769('0x16'),_0x36c220[_0xd769('0x14')],_0x4c6719);_0x394a92(_0x2d499b[_0xd769('0x13')](0x1f4,_0x36c220['message']));});});};exports[_0xd769('0x1c')]=function(_0x52e77a){var _0x5b9ac8=this;return new Promise(function(_0x1336e0,_0x9ec648){return db[_0xd769('0x17')][_0xd769('0x1d')](_0x52e77a[_0xd769('0x1e')],{'raw':_0x52e77a[_0xd769('0x18')]?_0x52e77a[_0xd769('0x18')][_0xd769('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e77a[_0xd769('0x18')]?_0x52e77a[_0xd769('0x18')]['where']||null:null,'attributes':_0x52e77a[_0xd769('0x18')]?_0x52e77a['options'][_0xd769('0x1f')]||null:null,'limit':_0x52e77a[_0xd769('0x18')]?_0x52e77a[_0xd769('0x18')]['limit']||null:null})['then'](function(_0x15f8f7){logger[_0xd769('0xd')]('UpdateChatQueueReport',_0x52e77a);logger[_0xd769('0xf')](_0xd769('0x1c'),_0x52e77a,JSON['stringify'](_0x15f8f7));_0x1336e0(_0x15f8f7);})[_0xd769('0x1b')](function(_0x3db963){logger['error'](_0xd769('0x1c'),_0x3db963[_0xd769('0x14')],_0x52e77a);_0x9ec648(_0x5b9ac8[_0xd769('0x13')](0x1f4,_0x3db963[_0xd769('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7b4e0bd..15a5234 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 _0xa5ae=['put','update','delete','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0xa5ae,0x10d));var _0xea5a=function(_0x5eb868,_0x3edfb0){_0x5eb868=_0x5eb868-0x0;var _0x278458=_0xa5ae[_0x5eb868];return _0x278458;};'use strict';var multer=require('multer');var util=require(_0xea5a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xea5a('0x1'));var router=express[_0xea5a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xea5a('0x3'));var interaction=require(_0xea5a('0x4'));var config=require(_0xea5a('0x5'));var controller=require(_0xea5a('0x6'));router[_0xea5a('0x7')]('/',auth['isAuthenticated'](),controller[_0xea5a('0x8')]);router[_0xea5a('0x7')](_0xea5a('0x9'),auth[_0xea5a('0xa')](),controller[_0xea5a('0xb')]);router[_0xea5a('0x7')](_0xea5a('0xc'),auth[_0xea5a('0xa')](),controller[_0xea5a('0xd')]);router[_0xea5a('0xe')]('/',auth[_0xea5a('0xa')](),controller[_0xea5a('0xf')]);router[_0xea5a('0x10')](_0xea5a('0xc'),auth['isAuthenticated'](),controller[_0xea5a('0x11')]);router[_0xea5a('0x12')]('/:id',auth[_0xea5a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf74d=['index','/describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xf74d,0x149));var _0xdf74=function(_0x218ed8,_0x488d2f){_0x218ed8=_0x218ed8-0x0;var _0x2cc496=_0xf74d[_0x218ed8];return _0x2cc496;};'use strict';var multer=require(_0xdf74('0x0'));var util=require(_0xdf74('0x1'));var path=require(_0xdf74('0x2'));var timeout=require(_0xdf74('0x3'));var express=require(_0xdf74('0x4'));var router=express['Router']();var fs_extra=require(_0xdf74('0x5'));var auth=require(_0xdf74('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdf74('0x7'));var controller=require(_0xdf74('0x8'));router[_0xdf74('0x9')]('/',auth[_0xdf74('0xa')](),controller[_0xdf74('0xb')]);router[_0xdf74('0x9')](_0xdf74('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xdf74('0x9')](_0xdf74('0xd'),auth[_0xdf74('0xa')](),controller[_0xdf74('0xe')]);router['post']('/',auth[_0xdf74('0xa')](),controller[_0xdf74('0xf')]);router[_0xdf74('0x10')]('/:id',auth[_0xdf74('0xa')](),controller[_0xdf74('0x11')]);router[_0xdf74('0x12')](_0xdf74('0xd'),auth['isAuthenticated'](),controller[_0xdf74('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 64d85d6..44f9fe9 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3d82ce,_0xf149e1){var _0x40a2ba=function(_0x1ef273){while(--_0x1ef273){_0x3d82ce['push'](_0x3d82ce['shift']());}};_0x40a2ba(++_0xf149e1);}(_0xaa88,0x137));var _0x8aa8=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0xaa88[_0x51a6d6];return _0x5ef1a8;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x58f1ef,_0x4cf4d5){var _0x2ef772=function(_0x3b04ab){while(--_0x3b04ab){_0x58f1ef['push'](_0x58f1ef['shift']());}};_0x2ef772(++_0x4cf4d5);}(_0x34e8,0x12c));var _0x834e=function(_0x56938f,_0x34a52d){_0x56938f=_0x56938f-0x0;var _0x4b79b8=_0x34e8[_0x56938f];return _0x4b79b8;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 86f52c0..5078d2e 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 _0x699a=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','update','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3c594c,_0x50a59f){var _0xd6a3f1=function(_0x4a3bfc){while(--_0x4a3bfc){_0x3c594c['push'](_0x3c594c['shift']());}};_0xd6a3f1(++_0x50a59f);}(_0x699a,0x175));var _0xa699=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x699a[_0x53c4f8];return _0x416458;};'use strict';var emlformat=require(_0xa699('0x0'));var rimraf=require(_0xa699('0x1'));var zipdir=require(_0xa699('0x2'));var jsonpatch=require(_0xa699('0x3'));var rp=require(_0xa699('0x4'));var moment=require(_0xa699('0x5'));var BPromise=require(_0xa699('0x6'));var Mustache=require(_0xa699('0x7'));var util=require('util');var path=require(_0xa699('0x8'));var sox=require(_0xa699('0x9'));var csv=require(_0xa699('0xa'));var ejs=require(_0xa699('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa699('0xc'));var crypto=require(_0xa699('0xd'));var jsforce=require(_0xa699('0xe'));var deskjs=require(_0xa699('0xf'));var toCsv=require(_0xa699('0xa'));var querystring=require(_0xa699('0x10'));var Papa=require(_0xa699('0x11'));var Redis=require(_0xa699('0x12'));var authService=require(_0xa699('0x13'));var qs=require(_0xa699('0x14'));var as=require(_0xa699('0x15'));var hardwareService=require(_0xa699('0x16'));var logger=require(_0xa699('0x17'))(_0xa699('0x18'));var utils=require('../../config/utils');var config=require(_0xa699('0x19'));var licenseUtil=require(_0xa699('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ba8e4,_0x37e793){_0x37e793=_0x37e793||0xcc;return function(_0x128358){if(_0x128358){return _0x2ba8e4[_0xa699('0x1b')](_0x37e793);}return _0x2ba8e4[_0xa699('0x1c')](_0x37e793)['end']();};}function respondWithResult(_0x1b81b4,_0x1eab00){_0x1eab00=_0x1eab00||0xc8;return function(_0x486452){if(_0x486452){return _0x1b81b4['status'](_0x1eab00)[_0xa699('0x1d')](_0x486452);}};}function respondWithFilteredResult(_0x300427,_0x45f586){return function(_0x3b16b1){if(_0x3b16b1){var _0x44925f=typeof _0x45f586['offset']===_0xa699('0x1e')&&typeof _0x45f586['limit']==='undefined';var _0xd021f8=_0x3b16b1[_0xa699('0x1f')];var _0x41a9fa=_0x44925f?0x0:_0x45f586['offset'];var _0x2aa3a4=_0x44925f?_0x3b16b1[_0xa699('0x1f')]:_0x45f586[_0xa699('0x20')]+_0x45f586[_0xa699('0x21')];var _0x3f1aac;if(_0x2aa3a4>=_0xd021f8){_0x2aa3a4=_0xd021f8;_0x3f1aac=0xc8;}else{_0x3f1aac=0xce;}_0x300427['status'](_0x3f1aac);return _0x300427[_0xa699('0x22')]('Content-Range',_0x41a9fa+'-'+_0x2aa3a4+'/'+_0xd021f8)[_0xa699('0x1d')](_0x3b16b1);}return null;};}function patchUpdates(_0x2d78aa){return function(_0x2da020){try{jsonpatch[_0xa699('0x23')](_0x2da020,_0x2d78aa,!![]);}catch(_0x41b157){return BPromise[_0xa699('0x24')](_0x41b157);}return _0x2da020['save']();};}function saveUpdates(_0x2c48ed,_0x281031){return function(_0x2992f2){if(_0x2992f2){return _0x2992f2[_0xa699('0x25')](_0x2c48ed)['then'](function(_0x2ee66d){return _0x2ee66d;});}return null;};}function removeEntity(_0x1ea04d,_0x44928d){return function(_0x37f555){if(_0x37f555){return _0x37f555['destroy']()[_0xa699('0x26')](function(){_0x1ea04d[_0xa699('0x1c')](0xcc)[_0xa699('0x27')]();});}};}function handleEntityNotFound(_0x1594f9,_0x1591b4){return function(_0xff2354){if(!_0xff2354){_0x1594f9[_0xa699('0x1b')](0x194);}return _0xff2354;};}function handleError(_0x246224,_0x3c6fa9){_0x3c6fa9=_0x3c6fa9||0x1f4;return function(_0x13d5f3){logger[_0xa699('0x28')](_0x13d5f3[_0xa699('0x29')]);if(_0x13d5f3[_0xa699('0x2a')]){delete _0x13d5f3[_0xa699('0x2a')];}_0x246224['status'](_0x3c6fa9)[_0xa699('0x2b')](_0x13d5f3);};}exports[_0xa699('0x2c')]=function(_0xd9682f,_0x538a82){var _0x5bd985={},_0x344051={},_0x432787={'count':0x0,'rows':[]};var _0x4a1064=_[_0xa699('0x2d')](db[_0xa699('0x2e')][_0xa699('0x2f')],function(_0x333bf7){return{'name':_0x333bf7[_0xa699('0x30')],'type':_0x333bf7[_0xa699('0x31')][_0xa699('0x32')]};});_0x344051['model']=_['map'](_0x4a1064,_0xa699('0x2a'));_0x344051[_0xa699('0x33')]=_[_0xa699('0x34')](_0xd9682f[_0xa699('0x33')]);_0x344051[_0xa699('0x35')]=_[_0xa699('0x36')](_0x344051[_0xa699('0x37')],_0x344051['query']);_0x5bd985[_0xa699('0x38')]=_[_0xa699('0x36')](_0x344051[_0xa699('0x37')],qs['fields'](_0xd9682f['query'][_0xa699('0x39')]));_0x5bd985['attributes']=_0x5bd985[_0xa699('0x38')][_0xa699('0x3a')]?_0x5bd985['attributes']:_0x344051[_0xa699('0x37')];if(!_0xd9682f[_0xa699('0x33')]['hasOwnProperty'](_0xa699('0x3b'))){_0x5bd985['limit']=qs[_0xa699('0x21')](_0xd9682f[_0xa699('0x33')][_0xa699('0x21')]);_0x5bd985['offset']=qs['offset'](_0xd9682f[_0xa699('0x33')][_0xa699('0x20')]);}_0x5bd985[_0xa699('0x3c')]=qs[_0xa699('0x3d')](_0xd9682f[_0xa699('0x33')]['sort']);_0x5bd985[_0xa699('0x3e')]=qs[_0xa699('0x35')](_['pick'](_0xd9682f[_0xa699('0x33')],_0x344051[_0xa699('0x35')]),_0x4a1064);if(_0xd9682f[_0xa699('0x33')][_0xa699('0x3f')]){_0x5bd985[_0xa699('0x3e')]=_['merge'](_0x5bd985[_0xa699('0x3e')],{'$or':_[_0xa699('0x2d')](_0x4a1064,function(_0x556874){if(_0x556874[_0xa699('0x31')]!==_0xa699('0x40')){var _0x30a22c={};_0x30a22c[_0x556874[_0xa699('0x2a')]]={'$like':'%'+_0xd9682f[_0xa699('0x33')][_0xa699('0x3f')]+'%'};return _0x30a22c;}})});}_0x5bd985=_[_0xa699('0x41')]({},_0x5bd985,_0xd9682f[_0xa699('0x42')]);var _0x37645e={'where':_0x5bd985[_0xa699('0x3e')]};return db[_0xa699('0x2e')]['count'](_0x37645e)['then'](function(_0x44c26f){_0x432787[_0xa699('0x1f')]=_0x44c26f;if(_0xd9682f[_0xa699('0x33')][_0xa699('0x43')]){_0x5bd985['include']=[{'all':!![]}];}return db[_0xa699('0x2e')][_0xa699('0x44')](_0x5bd985);})[_0xa699('0x26')](function(_0x5b69cb){_0x432787[_0xa699('0x45')]=_0x5b69cb;return _0x432787;})[_0xa699('0x26')](respondWithFilteredResult(_0x538a82,_0x5bd985))[_0xa699('0x46')](handleError(_0x538a82,null));};exports[_0xa699('0x47')]=function(_0x1cbffe,_0x26e24a){var _0x20d8dd={'raw':!![],'where':{'id':_0x1cbffe[_0xa699('0x48')]['id']}},_0x5b5349={};_0x5b5349[_0xa699('0x37')]=_[_0xa699('0x34')](db[_0xa699('0x2e')][_0xa699('0x2f')]);_0x5b5349[_0xa699('0x33')]=_[_0xa699('0x34')](_0x1cbffe[_0xa699('0x33')]);_0x5b5349[_0xa699('0x35')]=_[_0xa699('0x36')](_0x5b5349[_0xa699('0x37')],_0x5b5349[_0xa699('0x33')]);_0x20d8dd[_0xa699('0x38')]=_[_0xa699('0x36')](_0x5b5349[_0xa699('0x37')],qs[_0xa699('0x39')](_0x1cbffe[_0xa699('0x33')][_0xa699('0x39')]));_0x20d8dd[_0xa699('0x38')]=_0x20d8dd[_0xa699('0x38')][_0xa699('0x3a')]?_0x20d8dd[_0xa699('0x38')]:_0x5b5349[_0xa699('0x37')];if(_0x1cbffe[_0xa699('0x33')]['includeAll']){_0x20d8dd[_0xa699('0x49')]=[{'all':!![]}];}_0x20d8dd=_[_0xa699('0x41')]({},_0x20d8dd,_0x1cbffe[_0xa699('0x42')]);return db[_0xa699('0x2e')][_0xa699('0x4a')](_0x20d8dd)[_0xa699('0x26')](handleEntityNotFound(_0x26e24a,null))[_0xa699('0x26')](respondWithResult(_0x26e24a,null))[_0xa699('0x46')](handleError(_0x26e24a,null));};exports[_0xa699('0x4b')]=function(_0x2c6346,_0x35bfb2){return db[_0xa699('0x2e')][_0xa699('0x4b')](_0x2c6346[_0xa699('0x4c')],{})[_0xa699('0x26')](respondWithResult(_0x35bfb2,0xc9))['catch'](handleError(_0x35bfb2,null));};exports[_0xa699('0x25')]=function(_0x4de637,_0x4213c7){if(_0x4de637[_0xa699('0x4c')]['id']){delete _0x4de637['body']['id'];}return db[_0xa699('0x2e')][_0xa699('0x4a')]({'where':{'id':_0x4de637[_0xa699('0x48')]['id']}})[_0xa699('0x26')](handleEntityNotFound(_0x4213c7,null))[_0xa699('0x26')](saveUpdates(_0x4de637[_0xa699('0x4c')],null))[_0xa699('0x26')](respondWithResult(_0x4213c7,null))[_0xa699('0x46')](handleError(_0x4213c7,null));};exports[_0xa699('0x4d')]=function(_0x306ba4,_0x5d2041){return db['ChatTransferReport'][_0xa699('0x4a')]({'where':{'id':_0x306ba4[_0xa699('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d2041,null))[_0xa699('0x26')](removeEntity(_0x5d2041,null))['catch'](handleError(_0x5d2041,null));};exports['describe']=function(_0x53278c,_0x26f03b){return db[_0xa699('0x2e')][_0xa699('0x4e')]()[_0xa699('0x26')](respondWithResult(_0x26f03b,null))[_0xa699('0x46')](handleError(_0x26f03b,null));}; \ No newline at end of file +var _0x8e8f=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','map','ChatTransferReport','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache'];(function(_0x3d94ef,_0x12ea90){var _0x205e97=function(_0x4107c4){while(--_0x4107c4){_0x3d94ef['push'](_0x3d94ef['shift']());}};_0x205e97(++_0x12ea90);}(_0x8e8f,0x16d));var _0xf8e8=function(_0x414e9e,_0x1575f6){_0x414e9e=_0x414e9e-0x0;var _0x31141f=_0x8e8f[_0x414e9e];return _0x31141f;};'use strict';var emlformat=require(_0xf8e8('0x0'));var rimraf=require(_0xf8e8('0x1'));var zipdir=require(_0xf8e8('0x2'));var jsonpatch=require(_0xf8e8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf8e8('0x4'));var util=require(_0xf8e8('0x5'));var path=require(_0xf8e8('0x6'));var sox=require(_0xf8e8('0x7'));var csv=require(_0xf8e8('0x8'));var ejs=require(_0xf8e8('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e8('0xa'));var _=require(_0xf8e8('0xb'));var squel=require(_0xf8e8('0xc'));var crypto=require('crypto');var jsforce=require(_0xf8e8('0xd'));var deskjs=require(_0xf8e8('0xe'));var toCsv=require(_0xf8e8('0x8'));var querystring=require(_0xf8e8('0xf'));var Papa=require(_0xf8e8('0x10'));var Redis=require(_0xf8e8('0x11'));var authService=require(_0xf8e8('0x12'));var qs=require(_0xf8e8('0x13'));var as=require(_0xf8e8('0x14'));var hardwareService=require(_0xf8e8('0x15'));var logger=require(_0xf8e8('0x16'))('api');var utils=require(_0xf8e8('0x17'));var config=require(_0xf8e8('0x18'));var licenseUtil=require(_0xf8e8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132afa,_0x5ea064){_0x5ea064=_0x5ea064||0xcc;return function(_0x53ed6e){if(_0x53ed6e){return _0x132afa[_0xf8e8('0x1a')](_0x5ea064);}return _0x132afa[_0xf8e8('0x1b')](_0x5ea064)[_0xf8e8('0x1c')]();};}function respondWithResult(_0x590c39,_0x1b37d5){_0x1b37d5=_0x1b37d5||0xc8;return function(_0x2387ad){if(_0x2387ad){return _0x590c39[_0xf8e8('0x1b')](_0x1b37d5)[_0xf8e8('0x1d')](_0x2387ad);}};}function respondWithFilteredResult(_0x6cf1db,_0x5021b3){return function(_0x28809d){if(_0x28809d){var _0xa964ef=typeof _0x5021b3[_0xf8e8('0x1e')]===_0xf8e8('0x1f')&&typeof _0x5021b3[_0xf8e8('0x20')]===_0xf8e8('0x1f');var _0x10adf6=_0x28809d[_0xf8e8('0x21')];var _0x37d804=_0xa964ef?0x0:_0x5021b3[_0xf8e8('0x1e')];var _0x1f8a3a=_0xa964ef?_0x28809d[_0xf8e8('0x21')]:_0x5021b3[_0xf8e8('0x1e')]+_0x5021b3[_0xf8e8('0x20')];var _0x380019;if(_0x1f8a3a>=_0x10adf6){_0x1f8a3a=_0x10adf6;_0x380019=0xc8;}else{_0x380019=0xce;}_0x6cf1db[_0xf8e8('0x1b')](_0x380019);return _0x6cf1db[_0xf8e8('0x22')](_0xf8e8('0x23'),_0x37d804+'-'+_0x1f8a3a+'/'+_0x10adf6)['json'](_0x28809d);}return null;};}function patchUpdates(_0x27cac0){return function(_0x688467){try{jsonpatch['apply'](_0x688467,_0x27cac0,!![]);}catch(_0x524f39){return BPromise[_0xf8e8('0x24')](_0x524f39);}return _0x688467['save']();};}function saveUpdates(_0x420f5f,_0x38ccd7){return function(_0x5f5a73){if(_0x5f5a73){return _0x5f5a73[_0xf8e8('0x25')](_0x420f5f)[_0xf8e8('0x26')](function(_0x157f86){return _0x157f86;});}return null;};}function removeEntity(_0x316008,_0xe79d09){return function(_0x46c106){if(_0x46c106){return _0x46c106[_0xf8e8('0x27')]()[_0xf8e8('0x26')](function(){_0x316008[_0xf8e8('0x1b')](0xcc)[_0xf8e8('0x1c')]();});}};}function handleEntityNotFound(_0x5dcf73,_0x6e7e){return function(_0x49ae97){if(!_0x49ae97){_0x5dcf73[_0xf8e8('0x1a')](0x194);}return _0x49ae97;};}function handleError(_0x1892ed,_0x1b1129){_0x1b1129=_0x1b1129||0x1f4;return function(_0x5a8a2e){logger[_0xf8e8('0x28')](_0x5a8a2e['stack']);if(_0x5a8a2e[_0xf8e8('0x29')]){delete _0x5a8a2e[_0xf8e8('0x29')];}_0x1892ed[_0xf8e8('0x1b')](_0x1b1129)[_0xf8e8('0x2a')](_0x5a8a2e);};}exports['index']=function(_0x1cf46d,_0x30bd54){var _0xb7c1e={},_0x19d0a0={},_0x661b84={'count':0x0,'rows':[]};var _0x37ae2d=_[_0xf8e8('0x2b')](db[_0xf8e8('0x2c')][_0xf8e8('0x2d')],function(_0x3676db){return{'name':_0x3676db['fieldName'],'type':_0x3676db[_0xf8e8('0x2e')][_0xf8e8('0x2f')]};});_0x19d0a0[_0xf8e8('0x30')]=_[_0xf8e8('0x2b')](_0x37ae2d,_0xf8e8('0x29'));_0x19d0a0['query']=_[_0xf8e8('0x31')](_0x1cf46d['query']);_0x19d0a0[_0xf8e8('0x32')]=_[_0xf8e8('0x33')](_0x19d0a0[_0xf8e8('0x30')],_0x19d0a0['query']);_0xb7c1e[_0xf8e8('0x34')]=_['intersection'](_0x19d0a0[_0xf8e8('0x30')],qs[_0xf8e8('0x35')](_0x1cf46d[_0xf8e8('0x36')]['fields']));_0xb7c1e[_0xf8e8('0x34')]=_0xb7c1e['attributes']['length']?_0xb7c1e[_0xf8e8('0x34')]:_0x19d0a0[_0xf8e8('0x30')];if(!_0x1cf46d[_0xf8e8('0x36')][_0xf8e8('0x37')](_0xf8e8('0x38'))){_0xb7c1e['limit']=qs[_0xf8e8('0x20')](_0x1cf46d[_0xf8e8('0x36')][_0xf8e8('0x20')]);_0xb7c1e[_0xf8e8('0x1e')]=qs[_0xf8e8('0x1e')](_0x1cf46d[_0xf8e8('0x36')][_0xf8e8('0x1e')]);}_0xb7c1e[_0xf8e8('0x39')]=qs['sort'](_0x1cf46d[_0xf8e8('0x36')]['sort']);_0xb7c1e['where']=qs[_0xf8e8('0x32')](_['pick'](_0x1cf46d[_0xf8e8('0x36')],_0x19d0a0[_0xf8e8('0x32')]),_0x37ae2d);if(_0x1cf46d[_0xf8e8('0x36')][_0xf8e8('0x3a')]){_0xb7c1e[_0xf8e8('0x3b')]=_[_0xf8e8('0x3c')](_0xb7c1e[_0xf8e8('0x3b')],{'$or':_[_0xf8e8('0x2b')](_0x37ae2d,function(_0x29f00a){if(_0x29f00a[_0xf8e8('0x2e')]!==_0xf8e8('0x3d')){var _0x391d8a={};_0x391d8a[_0x29f00a[_0xf8e8('0x29')]]={'$like':'%'+_0x1cf46d[_0xf8e8('0x36')][_0xf8e8('0x3a')]+'%'};return _0x391d8a;}})});}_0xb7c1e=_[_0xf8e8('0x3c')]({},_0xb7c1e,_0x1cf46d[_0xf8e8('0x3e')]);var _0xe76139={'where':_0xb7c1e[_0xf8e8('0x3b')]};return db[_0xf8e8('0x2c')][_0xf8e8('0x21')](_0xe76139)[_0xf8e8('0x26')](function(_0xe829d3){_0x661b84[_0xf8e8('0x21')]=_0xe829d3;if(_0x1cf46d[_0xf8e8('0x36')][_0xf8e8('0x3f')]){_0xb7c1e[_0xf8e8('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xf8e8('0x41')](_0xb7c1e);})[_0xf8e8('0x26')](function(_0x1da5de){_0x661b84['rows']=_0x1da5de;return _0x661b84;})[_0xf8e8('0x26')](respondWithFilteredResult(_0x30bd54,_0xb7c1e))[_0xf8e8('0x42')](handleError(_0x30bd54,null));};exports[_0xf8e8('0x43')]=function(_0x410264,_0x34eaa7){var _0x4ec116={'raw':!![],'where':{'id':_0x410264[_0xf8e8('0x44')]['id']}},_0x3b2b1c={};_0x3b2b1c[_0xf8e8('0x30')]=_[_0xf8e8('0x31')](db['ChatTransferReport'][_0xf8e8('0x2d')]);_0x3b2b1c[_0xf8e8('0x36')]=_[_0xf8e8('0x31')](_0x410264[_0xf8e8('0x36')]);_0x3b2b1c[_0xf8e8('0x32')]=_[_0xf8e8('0x33')](_0x3b2b1c[_0xf8e8('0x30')],_0x3b2b1c[_0xf8e8('0x36')]);_0x4ec116['attributes']=_['intersection'](_0x3b2b1c['model'],qs['fields'](_0x410264['query'][_0xf8e8('0x35')]));_0x4ec116['attributes']=_0x4ec116[_0xf8e8('0x34')][_0xf8e8('0x45')]?_0x4ec116[_0xf8e8('0x34')]:_0x3b2b1c['model'];if(_0x410264['query'][_0xf8e8('0x3f')]){_0x4ec116[_0xf8e8('0x40')]=[{'all':!![]}];}_0x4ec116=_[_0xf8e8('0x3c')]({},_0x4ec116,_0x410264[_0xf8e8('0x3e')]);return db[_0xf8e8('0x2c')][_0xf8e8('0x46')](_0x4ec116)['then'](handleEntityNotFound(_0x34eaa7,null))[_0xf8e8('0x26')](respondWithResult(_0x34eaa7,null))[_0xf8e8('0x42')](handleError(_0x34eaa7,null));};exports[_0xf8e8('0x47')]=function(_0xaff1cc,_0x266c73){return db[_0xf8e8('0x2c')][_0xf8e8('0x47')](_0xaff1cc[_0xf8e8('0x48')],{})[_0xf8e8('0x26')](respondWithResult(_0x266c73,0xc9))[_0xf8e8('0x42')](handleError(_0x266c73,null));};exports[_0xf8e8('0x25')]=function(_0x5b6a98,_0x51146e){if(_0x5b6a98[_0xf8e8('0x48')]['id']){delete _0x5b6a98[_0xf8e8('0x48')]['id'];}return db[_0xf8e8('0x2c')][_0xf8e8('0x46')]({'where':{'id':_0x5b6a98['params']['id']}})[_0xf8e8('0x26')](handleEntityNotFound(_0x51146e,null))[_0xf8e8('0x26')](saveUpdates(_0x5b6a98[_0xf8e8('0x48')],null))[_0xf8e8('0x26')](respondWithResult(_0x51146e,null))[_0xf8e8('0x42')](handleError(_0x51146e,null));};exports[_0xf8e8('0x27')]=function(_0xe53949,_0x3c84a1){return db[_0xf8e8('0x2c')][_0xf8e8('0x46')]({'where':{'id':_0xe53949['params']['id']}})[_0xf8e8('0x26')](handleEntityNotFound(_0x3c84a1,null))[_0xf8e8('0x26')](removeEntity(_0x3c84a1,null))[_0xf8e8('0x42')](handleError(_0x3c84a1,null));};exports[_0xf8e8('0x49')]=function(_0x4b967a,_0x5518ee){return db['ChatTransferReport'][_0xf8e8('0x49')]()[_0xf8e8('0x26')](respondWithResult(_0x5518ee,null))['catch'](handleError(_0x5518ee,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 56af486..1c91741 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 _0x133f=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3984ba,_0x2ee57f){var _0x2b06be=function(_0x39929e){while(--_0x39929e){_0x3984ba['push'](_0x3984ba['shift']());}};_0x2b06be(++_0x2ee57f);}(_0x133f,0xbc));var _0xf133=function(_0x11cd72,_0x37d3ac){_0x11cd72=_0x11cd72-0x0;var _0x4b6f60=_0x133f[_0x11cd72];return _0x4b6f60;};'use strict';var _=require(_0xf133('0x0'));var util=require(_0xf133('0x1'));var logger=require('../../config/logger')(_0xf133('0x2'));var moment=require(_0xf133('0x3'));var BPromise=require(_0xf133('0x4'));var rp=require(_0xf133('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf133('0x6'));var config=require(_0xf133('0x7'));var attributes=require(_0xf133('0x8'));module[_0xf133('0x9')]=function(_0x4cbd1f,_0x56e809){return _0x4cbd1f[_0xf133('0xa')](_0xf133('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf133('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x46ae=['path','../../config/environment','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2aa9d8,_0x229c09){var _0x5da03a=function(_0x224481){while(--_0x224481){_0x2aa9d8['push'](_0x2aa9d8['shift']());}};_0x5da03a(++_0x229c09);}(_0x46ae,0x19b));var _0xe46a=function(_0x4f232a,_0x529d8){_0x4f232a=_0x4f232a-0x0;var _0x4fda49=_0x46ae[_0x4f232a];return _0x4fda49;};'use strict';var _=require(_0xe46a('0x0'));var util=require(_0xe46a('0x1'));var logger=require(_0xe46a('0x2'))(_0xe46a('0x3'));var moment=require(_0xe46a('0x4'));var BPromise=require(_0xe46a('0x5'));var rp=require(_0xe46a('0x6'));var fs=require('fs');var path=require(_0xe46a('0x7'));var rimraf=require('rimraf');var config=require(_0xe46a('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x2078e3,_0xb69651){return _0x2078e3['define']('ChatTransferReport',attributes,{'tableName':_0xe46a('0x9'),'paranoid':![],'indexes':[{'name':_0xe46a('0xa'),'fields':[_0xe46a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index a3bbce7..eda8e76 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 _0x2c26=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x7df626,_0x500898){var _0x7db49d=function(_0x2f20af){while(--_0x2f20af){_0x7df626['push'](_0x7df626['shift']());}};_0x7db49d(++_0x500898);}(_0x2c26,0x1eb));var _0x62c2=function(_0x28d2ce,_0x2cabab){_0x28d2ce=_0x28d2ce-0x0;var _0x58c109=_0x2c26[_0x28d2ce];return _0x58c109;};'use strict';var _=require(_0x62c2('0x0'));var util=require(_0x62c2('0x1'));var moment=require(_0x62c2('0x2'));var BPromise=require(_0x62c2('0x3'));var rs=require(_0x62c2('0x4'));var fs=require('fs');var Redis=require(_0x62c2('0x5'));var db=require(_0x62c2('0x6'))['db'];var utils=require(_0x62c2('0x7'));var logger=require(_0x62c2('0x8'))('rpc');var config=require(_0x62c2('0x9'));var jayson=require(_0x62c2('0xa'));var client=jayson[_0x62c2('0xb')][_0x62c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4bd9fb,_0x106edc,_0x3edc36){return new BPromise(function(_0x3d4aad,_0x5abd6f){return client[_0x62c2('0xd')](_0x4bd9fb,_0x3edc36)[_0x62c2('0xe')](function(_0xc68626){logger[_0x62c2('0xf')](_0x62c2('0x10'),_0x106edc,_0x62c2('0x11'));logger[_0x62c2('0x12')](_0x62c2('0x13'),_0x106edc,_0x62c2('0x11'),JSON['stringify'](_0xc68626));if(_0xc68626[_0x62c2('0x14')]){if(_0xc68626[_0x62c2('0x14')][_0x62c2('0x15')]===0x1f4){logger['error'](_0x62c2('0x10'),_0x106edc,_0xc68626[_0x62c2('0x14')]['message']);return _0x5abd6f(_0xc68626['error'][_0x62c2('0x16')]);}logger[_0x62c2('0x14')](_0x62c2('0x10'),_0x106edc,_0xc68626[_0x62c2('0x14')][_0x62c2('0x16')]);return _0x3d4aad(_0xc68626['error'][_0x62c2('0x16')]);}else{logger[_0x62c2('0xf')](_0x62c2('0x10'),_0x106edc,_0x62c2('0x11'));_0x3d4aad(_0xc68626['result']['message']);}})[_0x62c2('0x17')](function(_0x106aea){logger[_0x62c2('0x14')](_0x62c2('0x10'),_0x106edc,_0x106aea);_0x5abd6f(_0x106aea);});});} \ No newline at end of file +var _0x6c9c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatTransferReport,\x20%s,\x20%s','info','result','lodash'];(function(_0x185c47,_0x170b23){var _0x15c135=function(_0x39f071){while(--_0x39f071){_0x185c47['push'](_0x185c47['shift']());}};_0x15c135(++_0x170b23);}(_0x6c9c,0x149));var _0xc6c9=function(_0x5b5202,_0x2ddc6e){_0x5b5202=_0x5b5202-0x0;var _0x55c452=_0x6c9c[_0x5b5202];return _0x55c452;};'use strict';var _=require(_0xc6c9('0x0'));var util=require('util');var moment=require(_0xc6c9('0x1'));var BPromise=require(_0xc6c9('0x2'));var rs=require(_0xc6c9('0x3'));var fs=require('fs');var Redis=require(_0xc6c9('0x4'));var db=require(_0xc6c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6c9('0x6'))(_0xc6c9('0x7'));var config=require(_0xc6c9('0x8'));var jayson=require(_0xc6c9('0x9'));var client=jayson[_0xc6c9('0xa')][_0xc6c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd2cd0a,_0x14db95,_0x55df5b){return new BPromise(function(_0x335bd8,_0x1a8a9e){return client[_0xc6c9('0xc')](_0xd2cd0a,_0x55df5b)[_0xc6c9('0xd')](function(_0x1d76ad){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x14db95,_0xc6c9('0xe'));logger['debug'](_0xc6c9('0xf'),_0x14db95,'request\x20sent',JSON[_0xc6c9('0x10')](_0x1d76ad));if(_0x1d76ad['error']){if(_0x1d76ad[_0xc6c9('0x11')]['code']===0x1f4){logger[_0xc6c9('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x14db95,_0x1d76ad[_0xc6c9('0x11')]['message']);return _0x1a8a9e(_0x1d76ad[_0xc6c9('0x11')][_0xc6c9('0x12')]);}logger['error'](_0xc6c9('0x13'),_0x14db95,_0x1d76ad[_0xc6c9('0x11')][_0xc6c9('0x12')]);return _0x335bd8(_0x1d76ad[_0xc6c9('0x11')][_0xc6c9('0x12')]);}else{logger[_0xc6c9('0x14')](_0xc6c9('0x13'),_0x14db95,_0xc6c9('0xe'));_0x335bd8(_0x1d76ad[_0xc6c9('0x15')][_0xc6c9('0x12')]);}})['catch'](function(_0x5390e6){logger[_0xc6c9('0x11')](_0xc6c9('0x13'),_0x14db95,_0x5390e6);_0x1a8a9e(_0x5390e6);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7db1a69..2fb2ca4 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 _0xb08e=['express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4a9efd,_0x73947c){var _0x45f2c5=function(_0x2daeb1){while(--_0x2daeb1){_0x4a9efd['push'](_0x4a9efd['shift']());}};_0x45f2c5(++_0x73947c);}(_0xb08e,0x15d));var _0xeb08=function(_0x50acce,_0x6d880b){_0x50acce=_0x50acce-0x0;var _0xf40c85=_0xb08e[_0x50acce];return _0xf40c85;};'use strict';var multer=require(_0xeb08('0x0'));var util=require(_0xeb08('0x1'));var path=require('path');var timeout=require(_0xeb08('0x2'));var express=require(_0xeb08('0x3'));var router=express['Router']();var fs_extra=require(_0xeb08('0x4'));var auth=require(_0xeb08('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb08('0x6'));var controller=require(_0xeb08('0x7'));router[_0xeb08('0x8')]('/',auth['isAuthenticated'](),controller[_0xeb08('0x9')]);router[_0xeb08('0x8')](_0xeb08('0xa'),auth[_0xeb08('0xb')](),controller[_0xeb08('0xc')]);router[_0xeb08('0x8')](_0xeb08('0xd'),auth[_0xeb08('0xb')](),controller[_0xeb08('0xe')]);router[_0xeb08('0xf')]('/',auth[_0xeb08('0xb')](),controller[_0xeb08('0x10')]);router[_0xeb08('0x11')]('/:id',auth[_0xeb08('0xb')](),controller[_0xeb08('0x12')]);router[_0xeb08('0x13')](_0xeb08('0xd'),auth[_0xeb08('0xb')](),controller[_0xeb08('0x14')]);module[_0xeb08('0x15')]=router; \ No newline at end of file +var _0x13b9=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','index','get','/describe','isAuthenticated','/:id','show','create','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2b2c7f,_0x4c987){var _0x5aa2c2=function(_0x5080b1){while(--_0x5080b1){_0x2b2c7f['push'](_0x2b2c7f['shift']());}};_0x5aa2c2(++_0x4c987);}(_0x13b9,0x152));var _0x913b=function(_0x466e03,_0x1b0e3d){_0x466e03=_0x466e03-0x0;var _0x1ecaa2=_0x13b9[_0x466e03];return _0x1ecaa2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x913b('0x0'));var timeout=require(_0x913b('0x1'));var express=require(_0x913b('0x2'));var router=express[_0x913b('0x3')]();var fs_extra=require(_0x913b('0x4'));var auth=require(_0x913b('0x5'));var interaction=require(_0x913b('0x6'));var config=require('../../config/environment');var controller=require(_0x913b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x913b('0x8')]);router[_0x913b('0x9')](_0x913b('0xa'),auth[_0x913b('0xb')](),controller['describe']);router[_0x913b('0x9')](_0x913b('0xc'),auth[_0x913b('0xb')](),controller[_0x913b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x913b('0xe')]);router[_0x913b('0xf')](_0x913b('0xc'),auth[_0x913b('0xb')](),controller[_0x913b('0x10')]);router['delete'](_0x913b('0xc'),auth['isAuthenticated'](),controller[_0x913b('0x11')]);module[_0x913b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index bf8a7bc..76e93f1 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 _0x91a7=['rounded','squared','We\x20are\x20here!','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','star','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN'];(function(_0x297e28,_0x3b1969){var _0xf97226=function(_0x3ca11f){while(--_0x3ca11f){_0x297e28['push'](_0x297e28['shift']());}};_0xf97226(++_0x3b1969);}(_0x91a7,0xe7));var _0x791a=function(_0x596484,_0x4ab476){_0x596484=_0x596484-0x0;var _0x3d27ec=_0x91a7[_0x596484];return _0x3d27ec;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x791a('0x0'));module[_0x791a('0x1')]={'name':{'type':Sequelize[_0x791a('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x791a('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x4')},'key':{'type':Sequelize[_0x791a('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':_0x791a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x791a('0x2')]},'animation':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x791a('0x9'),_0x791a('0xa')),'defaultValue':_0x791a('0x9')},'header_online':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0xb')},'start_chat_button':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xc')},'header_offline':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x791a('0xf')]},'closingQuestion':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x13')},'ratingType':{'type':Sequelize[_0x791a('0x14')](_0x791a('0x15'),_0x791a('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return JSON[_0x791a('0x17')]({'items':[{'type':_0x791a('0x18'),'variable':null,'config':{'placeholder':_0x791a('0x19'),'type':_0x791a('0x1a'),'required':!![]},'props':{'title':_0x791a('0x19'),'helpText':''}},{'type':_0x791a('0x18'),'props':{'title':_0x791a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x791a('0x4'),'type':_0x791a('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x791a('0x1b'))?JSON[_0x791a('0x1c')](this[_0x791a('0x1d')](_0x791a('0x1b'))):{};},'set':function(_0x4d748a){return this[_0x791a('0x1e')](_0x791a('0x1b'),JSON['stringify'](_0x4d748a));}},'offlineForm':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return JSON[_0x791a('0x17')]({'items':[{'type':_0x791a('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x791a('0x4'),'type':_0x791a('0x4')},'variable':null},{'type':_0x791a('0x1f'),'config':{'placeholder':_0x791a('0x20')},'props':{'title':_0x791a('0x20'),'helpText':_0x791a('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x791a('0x1d')](_0x791a('0x22'))?JSON['parse'](this[_0x791a('0x1d')](_0x791a('0x22'))):{};},'set':function(_0x1b10a7){return this['setDataValue'](_0x791a('0x22'),JSON['stringify'](_0x1b10a7));}},'token':{'type':Sequelize[_0x791a('0x2')],'defaultValue':function(){return rs[_0x791a('0x23')]();}},'autoclose':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x791a('0x2')]},'forwardOffline':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x24')},'waitingMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x791a('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x791a('0x28')},'sendUnmanaged':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x791a('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x791a('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x791a('0x2')]},'customerAvatar':{'type':Sequelize[_0x791a('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x791a('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x791a('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x791a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x791a('0x2')],'defaultValue':_0x791a('0x2b')},'systemAvatar':{'type':Sequelize[_0x791a('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x791a('0xd')],'comment':_0x791a('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15f066){if(!_0x15f066)this[_0x791a('0x1e')](_0x791a('0x2d'),null);this['setDataValue'](_0x791a('0x2e'),_0x15f066);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x791a('0x2f')},'vidaooNote':{'type':Sequelize[_0x791a('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x791a('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x791a('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x791a('0xf')]}}; \ No newline at end of file +var _0x1be1=['textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','parse','setDataValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be1,0x192));var _0x11be=function(_0x28af70,_0x1ed39f){_0x28af70=_0x28af70-0x0;var _0x5bc238=_0x1be1[_0x28af70];return _0x5bc238;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x11be('0x0')]={'name':{'type':Sequelize[_0x11be('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11be('0x2')},'description':{'type':Sequelize[_0x11be('0x1')]},'mapKey':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x3')},'key':{'type':Sequelize[_0x11be('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x11be('0x8')](_0x11be('0x9'),_0x11be('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xb')},'start_chat_button':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x10')},'noteTitle':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x12')},'closingMessageButton':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x13')},'ratingType':{'type':Sequelize[_0x11be('0x8')](_0x11be('0x14'),_0x11be('0x15')),'defaultValue':_0x11be('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x11be('0x16')],'defaultValue':function(){return JSON[_0x11be('0x17')]({'items':[{'type':_0x11be('0x18'),'variable':null,'config':{'placeholder':_0x11be('0x19'),'type':'text','required':!![]},'props':{'title':_0x11be('0x19'),'helpText':''}},{'type':_0x11be('0x18'),'props':{'title':_0x11be('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x11be('0x1a')](_0x11be('0x1b'))?JSON[_0x11be('0x1c')](this['getDataValue'](_0x11be('0x1b'))):{};},'set':function(_0x518e2b){return this[_0x11be('0x1d')]('onlineForm',JSON[_0x11be('0x17')](_0x518e2b));}},'offlineForm':{'type':Sequelize[_0x11be('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x11be('0x18'),'props':{'title':_0x11be('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x11be('0x3'),'type':_0x11be('0x3')},'variable':null},{'type':_0x11be('0x1e'),'config':{'placeholder':_0x11be('0x1f')},'props':{'title':_0x11be('0x1f'),'helpText':_0x11be('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x11be('0x1a')]('offlineForm')?JSON[_0x11be('0x1c')](this['getDataValue'](_0x11be('0x21'))):{};},'set':function(_0x147b62){return this['setDataValue']('offlineForm',JSON[_0x11be('0x17')](_0x147b62));}},'token':{'type':Sequelize[_0x11be('0x1')],'defaultValue':function(){return rs[_0x11be('0x22')]();}},'autoclose':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x11be('0x1')]},'forwardOffline':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x11be('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x23')},'waitingMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x25')},'offlineMessageBody':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x26')},'skipUnmanaged':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x27')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x28')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x29')},'defaultTitle':{'type':Sequelize[_0x11be('0x1')]},'customerAvatar':{'type':Sequelize[_0x11be('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x2b')},'systemAvatar':{'type':Sequelize[_0x11be('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x11be('0x6')],'comment':_0x11be('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2618f5){if(!_0x2618f5)this[_0x11be('0x1d')]('mandatoryDispositionPauseId',null);this[_0x11be('0x1d')](_0x11be('0x2d'),_0x2618f5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x11be('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x11be('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x11be('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x11be('0x16')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 98ccc56..198510f 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 _0x7b27=['removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','getLogo','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','root','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','unmanaged','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','findOne','MailServerOut','CloudProvider','Smtp','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','Owner','Tags','color','tag','Command','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','mustache','util','path','ejs','fs-extra','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','get','ChatWebsites','destroy','stack','name','send','index','Pause','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatWebsite','then','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','rawAttributes','hasOwnProperty','findAll'];(function(_0x1a6156,_0x85c3c){var _0x480dda=function(_0x1c5710){while(--_0x1c5710){_0x1a6156['push'](_0x1a6156['shift']());}};_0x480dda(++_0x85c3c);}(_0x7b27,0xcd));var _0x77b2=function(_0x43e740,_0x46b998){_0x43e740=_0x43e740-0x0;var _0x8da82b=_0x7b27[_0x43e740];return _0x8da82b;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x77b2('0x0'));var util=require(_0x77b2('0x1'));var path=require(_0x77b2('0x2'));var ejs=require(_0x77b2('0x3'));var fs=require('fs');var fs_extra=require(_0x77b2('0x4'));var _=require(_0x77b2('0x5'));var querystring=require('querystring');var Redis=require(_0x77b2('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x77b2('0x7'))(_0x77b2('0x8'));var config=require(_0x77b2('0x9'));var db=require(_0x77b2('0xa'))['db'];config[_0x77b2('0xb')]=_[_0x77b2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x77b2('0xd'))(new Redis(config['redis']));require(_0x77b2('0xe'))[_0x77b2('0xf')](socket);var htmlToText=require(_0x77b2('0x10'));var jayson=require('jayson/promise');var client=jayson[_0x77b2('0x11')]['http']({'port':0x232c});var client9002=jayson[_0x77b2('0x11')][_0x77b2('0x12')]({'port':0x232a});var client9003=jayson['client'][_0x77b2('0x12')]({'port':0x232b});var client9001=jayson[_0x77b2('0x11')][_0x77b2('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x2b1b98,_0x4c1bf0,_0x14035c,_0x1dea48){return new BPromise(function(_0x1c66aa,_0x2e3375){var _0x1160ac=_0x1dea48||client;return _0x1160ac[_0x77b2('0x13')](_0x2b1b98,_0x14035c)['then'](function(_0x382c16){logger[_0x77b2('0x14')](_0x77b2('0x15'),_0x4c1bf0,_0x77b2('0x16'));logger[_0x77b2('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4c1bf0,'request\x20sent',JSON[_0x77b2('0x18')](_0x382c16));if(_0x382c16[_0x77b2('0x19')]){if(_0x382c16[_0x77b2('0x19')]['code']===0x1f4){logger['error'](_0x77b2('0x15'),_0x4c1bf0,_0x382c16['error'][_0x77b2('0x1a')]);return _0x2e3375(_0x382c16['error'][_0x77b2('0x1a')]);}logger[_0x77b2('0x19')](_0x77b2('0x15'),_0x4c1bf0,_0x382c16[_0x77b2('0x19')]['message']);return _0x1c66aa(_0x382c16[_0x77b2('0x19')][_0x77b2('0x1a')]);}else{logger['info'](_0x77b2('0x15'),_0x4c1bf0,'request\x20sent');_0x1c66aa(_0x382c16[_0x77b2('0x1b')][_0x77b2('0x1a')]);}})['catch'](function(_0x3c368d){logger[_0x77b2('0x19')](_0x77b2('0x15'),_0x4c1bf0,_0x3c368d);_0x2e3375(_0x3c368d);});});}function respondWithStatusCode(_0x3afdf9,_0x3d3efd){_0x3d3efd=_0x3d3efd||0xcc;return function(_0xd8f3ae){if(_0xd8f3ae){return _0x3afdf9[_0x77b2('0x1c')](_0x3d3efd);}return _0x3afdf9[_0x77b2('0x1d')](_0x3d3efd)[_0x77b2('0x1e')]();};}function respondWithResult(_0x499a2a,_0xd58b29){_0xd58b29=_0xd58b29||0xc8;return function(_0x1d04f4){if(_0x1d04f4){return _0x499a2a[_0x77b2('0x1d')](_0xd58b29)[_0x77b2('0x1f')](_0x1d04f4);}};}function respondWithFilteredResult(_0x7b5074,_0x5cb6e8){return function(_0x30d06d){if(_0x30d06d){var _0x16fdd8=typeof _0x5cb6e8[_0x77b2('0x20')]==='undefined'&&typeof _0x5cb6e8[_0x77b2('0x21')]===_0x77b2('0x22');var _0x2b3ab4=_0x30d06d['count'];var _0x1274ec=_0x16fdd8?0x0:_0x5cb6e8[_0x77b2('0x20')];var _0x352a81=_0x16fdd8?_0x30d06d[_0x77b2('0x23')]:_0x5cb6e8[_0x77b2('0x20')]+_0x5cb6e8['limit'];var _0x4b742a;if(_0x352a81>=_0x2b3ab4){_0x352a81=_0x2b3ab4;_0x4b742a=0xc8;}else{_0x4b742a=0xce;}_0x7b5074[_0x77b2('0x1d')](_0x4b742a);return _0x7b5074[_0x77b2('0x24')]('Content-Range',_0x1274ec+'-'+_0x352a81+'/'+_0x2b3ab4)[_0x77b2('0x1f')](_0x30d06d);}return null;};}function saveUpdates(_0x39c562){return function(_0x564d18){if(_0x564d18){return _0x564d18['update'](_0x39c562)['then'](function(_0x6760ec){return _0x6760ec;});}return null;};}function removeEntity(_0x46e891){return function(_0x492084){if(_0x492084){return _0x492084['destroy']()['then'](function(){var _0x5a1281=_0x492084[_0x77b2('0x25')]({'plain':!![]});var _0x33a29d=_0x77b2('0x26');return db['UserProfileResource'][_0x77b2('0x27')]({'where':{'type':_0x33a29d,'resourceId':_0x5a1281['id']}})['then'](function(){return _0x492084;});})['then'](function(){_0x46e891[_0x77b2('0x1d')](0xcc)[_0x77b2('0x1e')]();});}};}function handleEntityNotFound(_0x4eca3c){return function(_0x4e5319){if(!_0x4e5319){_0x4eca3c[_0x77b2('0x1c')](0x194);}return _0x4e5319;};}function handleError(_0x4f1638,_0xb0a5b4){_0xb0a5b4=_0xb0a5b4||0x1f4;return function(_0x2fe189){logger[_0x77b2('0x19')](_0x2fe189[_0x77b2('0x28')]);if(_0x2fe189['name']){delete _0x2fe189[_0x77b2('0x29')];}_0x4f1638[_0x77b2('0x1d')](_0xb0a5b4)[_0x77b2('0x2a')](_0x2fe189);};}exports[_0x77b2('0x2b')]=function(_0x2e548c,_0x231629){var _0x365fbd={'include':[{'model':db[_0x77b2('0x2c')],'as':'mandatoryDispositionPause'}]},_0x286a50={},_0x3d1d01={'count':0x0,'rows':[]};var _0x1cf765=_['map'](db['ChatWebsite']['rawAttributes'],function(_0x208e66){return{'name':_0x208e66[_0x77b2('0x2d')],'type':_0x208e66[_0x77b2('0x2e')][_0x77b2('0x2f')]};});_0x286a50[_0x77b2('0x30')]=_[_0x77b2('0x31')](_0x1cf765,'name');_0x286a50[_0x77b2('0x32')]=_['keys'](_0x2e548c['query']);_0x286a50[_0x77b2('0x33')]=_['intersection'](_0x286a50[_0x77b2('0x30')],_0x286a50['query']);_0x365fbd[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x286a50['model'],qs[_0x77b2('0x36')](_0x2e548c[_0x77b2('0x32')][_0x77b2('0x36')]));_0x365fbd['attributes']=_0x365fbd[_0x77b2('0x34')][_0x77b2('0x37')]?_0x365fbd[_0x77b2('0x34')]:_0x286a50['model'];if(!_0x2e548c[_0x77b2('0x32')]['hasOwnProperty'](_0x77b2('0x38'))){_0x365fbd[_0x77b2('0x21')]=qs['limit'](_0x2e548c['query'][_0x77b2('0x21')]);_0x365fbd[_0x77b2('0x20')]=qs['offset'](_0x2e548c[_0x77b2('0x32')][_0x77b2('0x20')]);}_0x365fbd[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x2e548c['query']['sort']);_0x365fbd['where']=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x2e548c[_0x77b2('0x32')],_0x286a50[_0x77b2('0x33')]),_0x1cf765);if(_0x2e548c['query'][_0x77b2('0x3c')]){_0x365fbd['where']=_[_0x77b2('0x3d')](_0x365fbd[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x1cf765,function(_0x18efe7){if(_0x18efe7['type']!==_0x77b2('0x3f')){var _0x529388={};_0x529388[_0x18efe7[_0x77b2('0x29')]]={'$like':'%'+_0x2e548c[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x529388;}})});}_0x365fbd=_[_0x77b2('0x3d')]({},_0x365fbd,_0x2e548c[_0x77b2('0x40')]);var _0x54ca7f={'where':_0x365fbd[_0x77b2('0x3e')]};return db[_0x77b2('0x41')][_0x77b2('0x23')](_0x54ca7f)[_0x77b2('0x42')](function(_0x24150a){_0x3d1d01[_0x77b2('0x23')]=_0x24150a;if(_0x2e548c['query'][_0x77b2('0x43')]){_0x365fbd[_0x77b2('0x44')]=[{'all':!![]}];}return db[_0x77b2('0x41')]['findAll'](_0x365fbd);})[_0x77b2('0x42')](function(_0xd53b81){_0x3d1d01[_0x77b2('0x45')]=_0xd53b81;return _0x3d1d01;})[_0x77b2('0x42')](respondWithFilteredResult(_0x231629,_0x365fbd))[_0x77b2('0x46')](handleError(_0x231629,null));};exports[_0x77b2('0x47')]=function(_0x2b3ef5,_0x5a6332){var _0x63f01d={'raw':![],'where':{'id':_0x2b3ef5[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x2c')],'as':_0x77b2('0x49')}]},_0x18c2a9={};_0x18c2a9['model']=_[_0x77b2('0x4a')](db[_0x77b2('0x41')]['rawAttributes']);_0x18c2a9[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x2b3ef5[_0x77b2('0x32')]);_0x18c2a9[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x18c2a9[_0x77b2('0x30')],_0x18c2a9['query']);_0x63f01d['attributes']=_['intersection'](_0x18c2a9[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x2b3ef5['query']['fields']));_0x63f01d['attributes']=_0x63f01d[_0x77b2('0x34')][_0x77b2('0x37')]?_0x63f01d[_0x77b2('0x34')]:_0x18c2a9[_0x77b2('0x30')];if(_0x2b3ef5['query'][_0x77b2('0x43')]){_0x63f01d[_0x77b2('0x44')]=[{'all':!![]}];}_0x63f01d=_['merge']({},_0x63f01d,_0x2b3ef5[_0x77b2('0x40')]);return db[_0x77b2('0x41')][_0x77b2('0x4b')](_0x63f01d)[_0x77b2('0x42')](handleEntityNotFound(_0x5a6332,null))[_0x77b2('0x42')](respondWithResult(_0x5a6332,null))[_0x77b2('0x46')](handleError(_0x5a6332,null));};exports[_0x77b2('0x4c')]=function(_0x1ff353,_0x1be355){return db[_0x77b2('0x41')][_0x77b2('0x4c')](_0x1ff353[_0x77b2('0x4d')],{})[_0x77b2('0x42')](function(_0x384711){var _0x2ad86d=_0x1ff353[_0x77b2('0x4e')][_0x77b2('0x25')]({'plain':!![]});if(!_0x2ad86d)throw new Error(_0x77b2('0x4f'));if(_0x2ad86d[_0x77b2('0x50')]===_0x77b2('0x4e')){var _0x53af53=_0x384711[_0x77b2('0x25')]({'plain':!![]});var _0x4700dc=_0x77b2('0x26');return db['UserProfileSection'][_0x77b2('0x4b')]({'where':{'name':_0x4700dc,'userProfileId':_0x2ad86d[_0x77b2('0x51')]},'raw':!![]})[_0x77b2('0x42')](function(_0x2a35d0){if(_0x2a35d0&&_0x2a35d0['autoAssociation']===0x0){return db['UserProfileResource'][_0x77b2('0x4c')]({'name':_0x53af53[_0x77b2('0x29')],'resourceId':_0x53af53['id'],'type':_0x2a35d0['name'],'sectionId':_0x2a35d0['id']},{})['then'](function(){return _0x384711;});}else{return _0x384711;}})[_0x77b2('0x46')](function(_0x5e2e74){logger[_0x77b2('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e2e74);throw _0x5e2e74;});}return _0x384711;})[_0x77b2('0x42')](respondWithResult(_0x1be355,0xc9))[_0x77b2('0x46')](handleError(_0x1be355,null));};exports[_0x77b2('0x52')]=function(_0x4153cf,_0x3cfed6){if(_0x4153cf[_0x77b2('0x4d')]['id']){delete _0x4153cf[_0x77b2('0x4d')]['id'];}return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x4153cf[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x2c')],'as':_0x77b2('0x49')}]})[_0x77b2('0x42')](handleEntityNotFound(_0x3cfed6,null))[_0x77b2('0x42')](saveUpdates(_0x4153cf[_0x77b2('0x4d')],null))[_0x77b2('0x42')](respondWithResult(_0x3cfed6,null))[_0x77b2('0x46')](handleError(_0x3cfed6,null));};exports['destroy']=function(_0x45ea0c,_0x6ff435){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x45ea0c[_0x77b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ff435,null))[_0x77b2('0x42')](removeEntity(_0x6ff435,null))['catch'](handleError(_0x6ff435,null));};exports[_0x77b2('0x53')]=function(_0xa58ba5,_0x162753){return db[_0x77b2('0x41')][_0x77b2('0x53')]()[_0x77b2('0x42')](respondWithResult(_0x162753,null))[_0x77b2('0x46')](handleError(_0x162753,null));};exports[_0x77b2('0x54')]=function(_0x491ddc,_0x28f4ba){if(_0x491ddc[_0x77b2('0x4d')]['id']){delete _0x491ddc[_0x77b2('0x4d')]['id'];}return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x491ddc['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x28f4ba,null))['then'](function(_0x1b3d15){if(_0x1b3d15){_0x491ddc[_0x77b2('0x4d')][_0x77b2('0x55')]=_0x1b3d15['id'];return db[_0x77b2('0x56')][_0x77b2('0x4c')](_0x491ddc['body']);}})[_0x77b2('0x42')](respondWithResult(_0x28f4ba,null))[_0x77b2('0x46')](handleError(_0x28f4ba,null));};exports[_0x77b2('0x57')]=function(_0x337701,_0xa9618d){var _0x327384={'raw':![],'where':{}};var _0x23eb45={};var _0x25cf2f={'count':0x0,'rows':[]};return db[_0x77b2('0x41')]['findOne']({'where':{'id':_0x337701[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0xa9618d,null))[_0x77b2('0x42')](function(_0x300838){if(_0x300838){_0x23eb45['model']=_[_0x77b2('0x4a')](db[_0x77b2('0x56')][_0x77b2('0x58')]);_0x23eb45[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x337701[_0x77b2('0x32')]);_0x23eb45['filters']=_[_0x77b2('0x35')](_0x23eb45[_0x77b2('0x30')],_0x23eb45[_0x77b2('0x32')]);_0x327384[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x23eb45[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x337701[_0x77b2('0x32')][_0x77b2('0x36')]));_0x327384[_0x77b2('0x34')]=_0x327384[_0x77b2('0x34')]['length']?_0x327384[_0x77b2('0x34')]:_0x23eb45[_0x77b2('0x30')];if(!_0x337701['query'][_0x77b2('0x59')](_0x77b2('0x38'))){_0x327384[_0x77b2('0x21')]=qs[_0x77b2('0x21')](_0x337701[_0x77b2('0x32')]['limit']);_0x327384[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x337701['query'][_0x77b2('0x20')]);}_0x327384[_0x77b2('0x39')]=qs['sort'](_0x337701[_0x77b2('0x32')]['sort']);_0x327384[_0x77b2('0x3e')]=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x337701['query'],_0x23eb45[_0x77b2('0x33')]));_0x327384['where'][_0x77b2('0x55')]=_0x300838['id'];if(_0x337701[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x327384[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x327384[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x327384[_0x77b2('0x34')],function(_0x3427e2){var _0x413053={};_0x413053[_0x3427e2]={'$like':'%'+_0x337701[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x413053;})});}_0x327384=_[_0x77b2('0x3d')]({},_0x327384,_0x337701[_0x77b2('0x40')]);return db['Disposition'][_0x77b2('0x23')]({'where':_0x327384[_0x77b2('0x3e')]})[_0x77b2('0x42')](function(_0x5dde9f){_0x25cf2f[_0x77b2('0x23')]=_0x5dde9f;if(_0x337701[_0x77b2('0x32')][_0x77b2('0x43')]){_0x327384[_0x77b2('0x44')]=[{'all':!![]}];}return db[_0x77b2('0x56')][_0x77b2('0x5a')](_0x327384);})['then'](function(_0x1a2770){_0x25cf2f[_0x77b2('0x45')]=_0x1a2770;return _0x25cf2f;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0xa9618d,_0x327384))[_0x77b2('0x46')](handleError(_0xa9618d,null));};exports[_0x77b2('0x5b')]=function(_0x2cf7a5,_0x2c4301){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x2cf7a5['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x2c4301,null))[_0x77b2('0x42')](function(_0xcf7df7){if(_0xcf7df7){return _0xcf7df7[_0x77b2('0x5b')](_0x2cf7a5[_0x77b2('0x32')][_0x77b2('0x5c')]);}})[_0x77b2('0x42')](respondWithStatusCode(_0x2c4301,null))[_0x77b2('0x46')](handleError(_0x2c4301,null));};exports[_0x77b2('0x5d')]=function(_0x24202e,_0x330748){if(_0x24202e[_0x77b2('0x4d')]['id']){delete _0x24202e[_0x77b2('0x4d')]['id'];}return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x24202e[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x330748,null))['then'](function(_0x57212f){if(_0x57212f){_0x24202e['body'][_0x77b2('0x55')]=_0x57212f['id'];return db[_0x77b2('0x5e')][_0x77b2('0x4c')](_0x24202e[_0x77b2('0x4d')]);}})['then'](respondWithResult(_0x330748,null))['catch'](handleError(_0x330748,null));};exports[_0x77b2('0x5f')]=function(_0x3c5136,_0x38b97d){var _0x4f4076={'raw':![],'where':{}};var _0x1f5dd4={};var _0xd23003={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3c5136[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x38b97d,null))['then'](function(_0x361e43){if(_0x361e43){_0x1f5dd4[_0x77b2('0x30')]=_['keys'](db[_0x77b2('0x5e')][_0x77b2('0x58')]);_0x1f5dd4['query']=_[_0x77b2('0x4a')](_0x3c5136[_0x77b2('0x32')]);_0x1f5dd4[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x1f5dd4[_0x77b2('0x30')],_0x1f5dd4[_0x77b2('0x32')]);_0x4f4076[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x1f5dd4[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x3c5136[_0x77b2('0x32')]['fields']));_0x4f4076[_0x77b2('0x34')]=_0x4f4076[_0x77b2('0x34')][_0x77b2('0x37')]?_0x4f4076['attributes']:_0x1f5dd4[_0x77b2('0x30')];if(!_0x3c5136['query']['hasOwnProperty'](_0x77b2('0x38'))){_0x4f4076[_0x77b2('0x21')]=qs['limit'](_0x3c5136[_0x77b2('0x32')][_0x77b2('0x21')]);_0x4f4076[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x3c5136[_0x77b2('0x32')][_0x77b2('0x20')]);}_0x4f4076[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x3c5136[_0x77b2('0x32')][_0x77b2('0x3a')]);_0x4f4076[_0x77b2('0x3e')]=qs['filters'](_[_0x77b2('0x3b')](_0x3c5136[_0x77b2('0x32')],_0x1f5dd4[_0x77b2('0x33')]));_0x4f4076['where'][_0x77b2('0x55')]=_0x361e43['id'];if(_0x3c5136[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x4f4076[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x4f4076[_0x77b2('0x3e')],{'$or':_['map'](_0x4f4076[_0x77b2('0x34')],function(_0x4923f3){var _0x2bca17={};_0x2bca17[_0x4923f3]={'$like':'%'+_0x3c5136[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x2bca17;})});}_0x4f4076=_[_0x77b2('0x3d')]({},_0x4f4076,_0x3c5136[_0x77b2('0x40')]);return db[_0x77b2('0x5e')]['count']({'where':_0x4f4076[_0x77b2('0x3e')]})[_0x77b2('0x42')](function(_0x505b62){_0xd23003['count']=_0x505b62;if(_0x3c5136[_0x77b2('0x32')][_0x77b2('0x43')]){_0x4f4076[_0x77b2('0x44')]=[{'all':!![]}];}return db[_0x77b2('0x5e')][_0x77b2('0x5a')](_0x4f4076);})[_0x77b2('0x42')](function(_0x46a9de){_0xd23003[_0x77b2('0x45')]=_0x46a9de;return _0xd23003;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0x38b97d,_0x4f4076))[_0x77b2('0x46')](handleError(_0x38b97d,null));};exports[_0x77b2('0x60')]=function(_0x153ec9,_0x3a31fb){return db['ChatWebsite']['find']({'where':{'id':_0x153ec9[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x3a31fb,null))[_0x77b2('0x42')](function(_0x2de514){if(_0x2de514){return _0x2de514[_0x77b2('0x60')](_0x153ec9[_0x77b2('0x32')][_0x77b2('0x5c')]);}})['then'](respondWithStatusCode(_0x3a31fb,null))[_0x77b2('0x46')](handleError(_0x3a31fb,null));};exports[_0x77b2('0x61')]=function(_0x5b398e,_0x1aae9){_0x5b398e['body'][_0x77b2('0x62')]=_0x5b398e['file'][_0x77b2('0x63')];return db['ChatWebsite'][_0x77b2('0x4b')]({'where':{'id':_0x5b398e[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x1aae9,null))[_0x77b2('0x42')](saveUpdates(_0x5b398e[_0x77b2('0x4d')],null))[_0x77b2('0x42')](respondWithResult(_0x1aae9,null))[_0x77b2('0x46')](handleError(_0x1aae9,null));};exports[_0x77b2('0x64')]=function(_0x53b777,_0x539682){_0x53b777[_0x77b2('0x4d')][_0x77b2('0x65')]=_0x53b777[_0x77b2('0x66')]['filename'];return db[_0x77b2('0x41')]['find']({'where':{'id':_0x53b777[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x539682,null))[_0x77b2('0x42')](saveUpdates(_0x53b777['body'],null))[_0x77b2('0x42')](respondWithResult(_0x539682,null))[_0x77b2('0x46')](handleError(_0x539682,null));};exports[_0x77b2('0x67')]=function(_0x4c7e75,_0x26c410){_0x4c7e75[_0x77b2('0x4d')]['customerAvatar']=_0x4c7e75[_0x77b2('0x66')][_0x77b2('0x63')];return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x4c7e75[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x26c410,null))[_0x77b2('0x42')](saveUpdates(_0x4c7e75[_0x77b2('0x4d')],null))['then'](respondWithResult(_0x26c410,null))[_0x77b2('0x46')](handleError(_0x26c410,null));};exports[_0x77b2('0x68')]=function(_0x36deda,_0x2c0fa8){_0x36deda[_0x77b2('0x4d')]['systemAvatar']=_0x36deda[_0x77b2('0x66')][_0x77b2('0x63')];return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x36deda['params']['id']}})['then'](handleEntityNotFound(_0x2c0fa8,null))[_0x77b2('0x42')](saveUpdates(_0x36deda[_0x77b2('0x4d')],null))[_0x77b2('0x42')](respondWithResult(_0x2c0fa8,null))['catch'](handleError(_0x2c0fa8,null));};exports[_0x77b2('0x69')]=function(_0x2a2516,_0x2c5d9e){var _0xf884c8=path['join'](config['root'],_0x77b2('0x6a'));var _0x159df7={'where':{'id':_0x2a2516[_0x77b2('0x48')]['id']},'attributes':['id',_0x77b2('0x62')],'raw':!![]};var _0x4100f1=![];return require(_0x77b2('0x6b'))[_0x77b2('0x6c')]()[_0x77b2('0x42')](function(_0x4be6da){if(_0x4be6da){_0x4100f1=_0x4be6da[_0x77b2('0x6d')];}})[_0x77b2('0x42')](function(){return db[_0x77b2('0x41')][_0x77b2('0x4b')](_0x159df7);})[_0x77b2('0x42')](handleEntityNotFound(_0x2c5d9e,null))[_0x77b2('0x42')](function(_0x39405b){if(_0x39405b){if(!_[_0x77b2('0x6e')](_0x39405b[_0x77b2('0x62')])){if(fs[_0x77b2('0x6f')](path[_0x77b2('0x70')](config['root'],_0x77b2('0x71'),_0x39405b[_0x77b2('0x62')]))&&_0x4100f1){_0xf884c8=path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x71'),_0x39405b[_0x77b2('0x62')]);}}return _0x2c5d9e['download'](_0xf884c8);}})[_0x77b2('0x46')](handleError(_0x2c5d9e,null));};exports[_0x77b2('0x73')]=function(_0x48c85b,_0x42d385){var _0x2700dd=path['join'](config['root'],_0x77b2('0x74'));var _0x4313de={'where':{'id':_0x48c85b[_0x77b2('0x48')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x77b2('0x4b')](_0x4313de)[_0x77b2('0x42')](handleEntityNotFound(_0x42d385,null))['then'](function(_0x1d2abe){if(_0x1d2abe){if(!_['isNil'](_0x1d2abe[_0x77b2('0x65')])){if(fs[_0x77b2('0x6f')](path['join'](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x1d2abe[_0x77b2('0x65')]))){_0x2700dd=path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x75'),_0x1d2abe[_0x77b2('0x65')]);}}return _0x42d385[_0x77b2('0x76')](_0x2700dd);}})['catch'](handleError(_0x42d385,null));};exports[_0x77b2('0x77')]=function(_0x511b83,_0x54e3e9){var _0x1538ed=path['join'](config[_0x77b2('0x72')],_0x77b2('0x78'));var _0x3e3f53={'where':{'id':_0x511b83[_0x77b2('0x48')]['id']},'attributes':['id',_0x77b2('0x79'),_0x77b2('0x7a')],'raw':!![]};return db[_0x77b2('0x41')][_0x77b2('0x4b')](_0x3e3f53)[_0x77b2('0x42')](handleEntityNotFound(_0x54e3e9,null))[_0x77b2('0x42')](function(_0x5a392f){if(_0x5a392f){if(!_[_0x77b2('0x6e')](_0x5a392f[_0x77b2('0x79')])){if(fs['existsSync'](path[_0x77b2('0x70')](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x5a392f[_0x77b2('0x79')]))&&_0x5a392f[_0x77b2('0x7a')]){_0x1538ed=path['join'](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x5a392f[_0x77b2('0x79')]);}}return _0x54e3e9[_0x77b2('0x76')](_0x1538ed);}})[_0x77b2('0x46')](handleError(_0x54e3e9,null));};exports[_0x77b2('0x7b')]=function(_0xb15f70,_0x172b6f){var _0x3b0f91=path[_0x77b2('0x70')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x461372={'where':{'id':_0xb15f70['params']['id']},'attributes':['id',_0x77b2('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x77b2('0x4b')](_0x461372)['then'](handleEntityNotFound(_0x172b6f,null))[_0x77b2('0x42')](function(_0x320e0a){if(_0x320e0a){if(!_['isNil'](_0x320e0a['systemAvatar'])){if(fs[_0x77b2('0x6f')](path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x75'),_0x320e0a[_0x77b2('0x7c')]))){_0x3b0f91=path[_0x77b2('0x70')](config[_0x77b2('0x72')],'server/files/images/avatars/',_0x320e0a[_0x77b2('0x7c')]);}}return _0x172b6f['download'](_0x3b0f91);}})['catch'](handleError(_0x172b6f,null));};exports[_0x77b2('0x7d')]=function(_0x5bd3c5,_0xcd4e63){var _0x5e719c=require(_0x77b2('0x7e'));var _0x45a744=new _0x5e719c();var _0x46ee60=_0x45a744['setUA'](_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0x80')])[_0x77b2('0x81')]();var _0x411b6b={'body':_0x5bd3c5['body'],'channel':_0x77b2('0x82')};var _0x15c656=[];var _0x565842=[];var _0x3772af={};var _0x4403ea=![];return db[_0x77b2('0x83')][_0x77b2('0x53')]()[_0x77b2('0x42')](function(_0x16e6b9){if(!_0x16e6b9){throw new db['Sequelize'][(_0x77b2('0x84'))](_0x77b2('0x85'));}_0x15c656=_[_0x77b2('0x86')](_[_0x77b2('0x4a')](_0x16e6b9),[_0x77b2('0x87'),_0x77b2('0x88')]);_0x565842=_['difference'](_[_0x77b2('0x4a')](_0x16e6b9),[_0x77b2('0x87'),_0x77b2('0x88'),_0x77b2('0x89'),_0x77b2('0x8a')]);if(_0x5bd3c5[_0x77b2('0x4d')]['id']){delete _0x5bd3c5['body']['id'];}if(_[_0x77b2('0x6e')](_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8b')])){throw new db[(_0x77b2('0x8c'))]['ValidationError'](_0x77b2('0x8d'));}if(_[_0x77b2('0x6e')](_0x5bd3c5[_0x77b2('0x4d')]['body'])||_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x4d')]===''){throw new db[(_0x77b2('0x8c'))]['ValidationError'](_0x77b2('0x8e'));}if(_[_0x77b2('0x6e')](_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8f')])){throw new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0x90')+_0x565842);}if(!_['includes'](_0x565842,_0x5bd3c5['body'][_0x77b2('0x8f')])){throw new db['Sequelize'][(_0x77b2('0x84'))](_0x77b2('0x91')+_0x565842);}_0x3772af[_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8f')]]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8b')];})[_0x77b2('0x42')](function(){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x5bd3c5[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x92')],'as':_0x77b2('0x93'),'include':[{'model':db['CmContact'],'as':_0x77b2('0x94'),'where':_0x3772af,'limit':0x1,'order':[[_0x77b2('0x88'),_0x77b2('0x95')]]}]},{'model':db[_0x77b2('0x96')],'as':_0x77b2('0x97')}]});})[_0x77b2('0x42')](handleEntityNotFound(_0xcd4e63,null))[_0x77b2('0x42')](function(_0x5830d8){if(_0x5830d8&&_0x5830d8[_0x77b2('0x93')]){_0x411b6b[_0x77b2('0x98')]=_0x5830d8;_0x411b6b[_0x77b2('0x99')]=_0x5830d8[_0x77b2('0x97')];_0x411b6b[_0x77b2('0x9a')]=_0x5830d8[_0x77b2('0x93')];_0x411b6b['applications']=_[_0x77b2('0x9b')](_0x411b6b[_0x77b2('0x99')],[_0x77b2('0x9c')],[_0x77b2('0x9d')]);if(_0x411b6b['account'][_0x77b2('0x97')]){delete _0x411b6b[_0x77b2('0x98')][_0x77b2('0x97')];}if(_0x411b6b[_0x77b2('0x98')]['List']&&_0x411b6b['account']['List'][_0x77b2('0x94')]['length']){return _0x411b6b['account'][_0x77b2('0x93')][_0x77b2('0x94')][0x0];}var _0x4a8ee2=_[_0x77b2('0xc')](_0x5bd3c5[_0x77b2('0x4d')],{'firstName':_0x5bd3c5['body'][_0x77b2('0x8b')],'ListId':_0x5830d8[_0x77b2('0x8a')]});_0x4a8ee2[_0x5bd3c5['body'][_0x77b2('0x8f')]]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0x8b')];return db[_0x77b2('0x83')][_0x77b2('0x4c')](_0x4a8ee2,{'fields':_0x15c656,'raw':!![]});}})['then'](handleEntityNotFound(_0xcd4e63,null))[_0x77b2('0x42')](function(_0x4b31b6){_0x411b6b[_0x77b2('0x9e')]=_0x4b31b6;var _0x558922=_0x5bd3c5['body']['customerIp'];if(_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0x9f')]){_0x558922=_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0x9f')];}else if(_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0xa0')]){_0x558922=_['first'](_0x5bd3c5[_0x77b2('0x7f')]['x-forwarded-for'][_0x77b2('0xa1')](','));}if(_0x4b31b6){var _0x7e15cc={'ContactId':_0x4b31b6['id'],'ChatWebsiteId':_0x5bd3c5[_0x77b2('0x48')]['id'],'from':(_0x4b31b6[_0x77b2('0xa2')]||'')+'\x20'+(_0x4b31b6[_0x77b2('0xa3')]||''),'customerIp':_0x558922,'customerPort':_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0xa4')]?_0x5bd3c5[_0x77b2('0x7f')][_0x77b2('0xa4')]:null,'referer':_0x5bd3c5[_0x77b2('0x4d')]['referer'],'browserName':_0x46ee60[_0x77b2('0xa5')][_0x77b2('0x29')]&&_0x46ee60['browser'][_0x77b2('0xa6')]?util[_0x77b2('0xa7')](_0x77b2('0xa8'),_0x46ee60[_0x77b2('0xa5')][_0x77b2('0x29')],_0x46ee60[_0x77b2('0xa5')][_0x77b2('0xa6')]):_0x77b2('0xa9'),'browserVersion':_0x46ee60[_0x77b2('0xa5')]['version']||_0x77b2('0xa9'),'osName':util[_0x77b2('0xa7')](_0x77b2('0xa8'),_0x46ee60['os']['name'],_0x46ee60['os'][_0x77b2('0xa6')]),'osVersion':_0x46ee60['os'][_0x77b2('0xa6')],'deviceModel':_0x46ee60['device'][_0x77b2('0x30')]&&_0x46ee60[_0x77b2('0xaa')][_0x77b2('0xab')]?util[_0x77b2('0xa7')]('%s\x20%s\x20%s',_0x46ee60[_0x77b2('0xaa')][_0x77b2('0x30')],_0x46ee60[_0x77b2('0xaa')][_0x77b2('0xab')],_0x46ee60['device'][_0x77b2('0x2e')]):null,'deviceVendor':_0x46ee60[_0x77b2('0xaa')]['vendor'],'deviceType':_0x46ee60['device'][_0x77b2('0x2e')],'formData':JSON['stringify'](_0x5bd3c5[_0x77b2('0x4d')])};var _0x1eca39={'ChatWebsiteId':_0x5bd3c5[_0x77b2('0x48')]['id'],'closed':![]};if(_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')]){_0x1eca39['threadId']=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')];return db['ChatInteraction'][_0x77b2('0x4b')]({'where':_0x1eca39})['then'](function(_0x1a0236){if(_0x1a0236){return[_0x1a0236,![]];}_0x7e15cc[_0x77b2('0xac')]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')];_0x7e15cc[_0x77b2('0xad')]=_0x5bd3c5[_0x77b2('0x4d')]['externalUrl'];return db[_0x77b2('0xae')][_0x77b2('0x4c')](_0x7e15cc)[_0x77b2('0x42')](function(_0x13fb54){return[_0x13fb54,!![]];});});}_0x1eca39['ContactId']=_0x4b31b6['id'];if(_0x5bd3c5[_0x77b2('0x4d')]['interaction']&&_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xaf')]['id']){_0x1eca39['id']=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xaf')]['id'];return db[_0x77b2('0xae')][_0x77b2('0x4b')]({'where':_0x1eca39})[_0x77b2('0x42')](function(_0x378838){if(_0x378838){return[_0x378838,![]];}return db[_0x77b2('0xae')][_0x77b2('0x4c')](_0x7e15cc)['then'](function(_0x71cfbf){return[_0x71cfbf,!![]];});});}return db[_0x77b2('0xae')][_0x77b2('0x4c')](_0x7e15cc)[_0x77b2('0x42')](function(_0x3b0f1c){return[_0x3b0f1c,!![]];});}})['spread'](function(_0x1ce512,_0x62361a){if(_0x1ce512){_0x4403ea=_0x62361a;if(!_0x62361a){var _0x269871={'from':(_0x411b6b['contact']['firstName']||'')+'\x20'+(_0x411b6b['contact'][_0x77b2('0xa3')]||'')};if(_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')]&&_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xb0')]&&_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xac')]!=_0x5bd3c5['body'][_0x77b2('0xb0')]){_0x269871[_0x77b2('0xac')]=_0x5bd3c5[_0x77b2('0x4d')][_0x77b2('0xb0')];}return _0x1ce512[_0x77b2('0x52')](_0x269871);}else{return _0x1ce512;}}})['then'](function(_0x2ac1b9){_0x411b6b['interaction']=_0x2ac1b9['get']({'plain':!![]});_0x411b6b[_0x77b2('0xaf')][_0x77b2('0xb1')]=_0x4403ea;if(_0x411b6b[_0x77b2('0xaf')][_0x77b2('0xb1')]){if(_0x411b6b['account'][_0x77b2('0xb2')]){_0x411b6b['applications'][_0x77b2('0xb3')]({'id':0x0,'priority':_0x411b6b[_0x77b2('0x99')]['length']+0x1,'app':'close','appdata':_0x77b2('0xb4'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x5bd3c5['body'][_0x77b2('0x4d')],'ChatWebsiteId':_0x5bd3c5[_0x77b2('0x48')]['id'],'ChatInteractionId':_0x2ac1b9['id'],'direction':'in','ContactId':_0x411b6b[_0x77b2('0x9e')]['id'],'AttachmentId':_0x5bd3c5[_0x77b2('0x4d')]['AttachmentId']});})['then'](function(_0x52d9d3){_0x411b6b[_0x77b2('0x1a')]=_0x52d9d3;if(_0x411b6b[_0x77b2('0xaf')][_0x77b2('0xb5')]){return db['User']['find']({'attributes':['id',_0x77b2('0x29')],'where':{'id':_0x411b6b[_0x77b2('0xaf')]['UserId']}})[_0x77b2('0x42')](function(_0x478d85){if(_0x478d85){_0x411b6b['applications'][_0x77b2('0xb6')]({'id':0x0,'priority':0x0,'app':_0x77b2('0xb7'),'appdata':_0x478d85['name']+','+(_0x411b6b[_0x77b2('0x98')][_0x77b2('0xb8')]||0xa),'interval':'*,*,*,*'});_0x411b6b['forcedOwnership']=!![];}return respondWithRpcPromise('Start','startRouting',_0x411b6b);});}return respondWithRpcPromise(_0x77b2('0xb9'),_0x77b2('0xba'),_0x411b6b);})[_0x77b2('0x42')](function(_0x42a1ff){respondWithRpcPromise('EventManager',_0x77b2('0xbb'),{'event':_0x77b2('0x7d'),'message':_0x42a1ff},client9002);return _0x42a1ff;})[_0x77b2('0x42')](respondWithResult(_0xcd4e63,null))[_0x77b2('0x46')](handleError(_0xcd4e63,null));};exports[_0x77b2('0xbc')]=function(_0x3a34a2,_0xae243){var _0x408edc,_0x1fd2f5,_0xa68597;var _0x392041=[];var _0x4e8ecd={};var _0x2f76e1=_0x3a34a2[_0x77b2('0xbd')]||[];var _0xa90826=[];var _0x34287c;return db[_0x77b2('0x83')][_0x77b2('0x53')]()[_0x77b2('0x42')](function(_0x6dbf12){if(!_0x6dbf12){throw new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0x85'));}_0x392041=_['difference'](_[_0x77b2('0x4a')](_0x6dbf12),[_0x77b2('0x87'),_0x77b2('0x88'),_0x77b2('0x89'),'ListId']);if(_0x3a34a2['body']['id']){delete _0x3a34a2[_0x77b2('0x4d')]['id'];}if(_[_0x77b2('0x6e')](_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x8b')])){throw _0xae243[_0x77b2('0x1d')](0x1f4)[_0x77b2('0x2a')](new db[(_0x77b2('0x8c'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x77b2('0x6e')](_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x4d')])||_0x3a34a2['body'][_0x77b2('0x4d')]===''){throw _0xae243['status'](0x1f4)['send'](new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0x8e')));}if(_[_0x77b2('0x6e')](_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0xbe')])){throw _0xae243[_0x77b2('0x1d')](0x1f4)[_0x77b2('0x2a')](new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0xbf')+_0x392041));}if(!_[_0x77b2('0xc0')](_0x392041,_0x3a34a2['body'][_0x77b2('0xbe')])){throw _0xae243[_0x77b2('0x1d')](0x1f4)[_0x77b2('0x2a')](new db[(_0x77b2('0x8c'))][(_0x77b2('0x84'))](_0x77b2('0xc1')+_0x392041));}_0x4e8ecd[_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0xbe')]]=_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x8b')];})[_0x77b2('0x42')](function(){return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'where':{'id':_0x3a34a2[_0x77b2('0x48')]['id']},'include':[{'model':db[_0x77b2('0x92')],'as':'List'},{'model':db[_0x77b2('0xc2')],'as':_0x77b2('0xc2')}]});})[_0x77b2('0x42')](handleEntityNotFound(_0xae243,null))[_0x77b2('0x42')](function(_0x3efdb1){if(_0x3efdb1&&_0x3efdb1[_0x77b2('0x93')]){_0x1fd2f5=_0x3efdb1;var _0x49ac06=_['defaults'](_0x3a34a2[_0x77b2('0x4d')],{'firstName':_0x3a34a2[_0x77b2('0x4d')]['from'],'phone':_0x3a34a2[_0x77b2('0x4d')][_0x77b2('0x8b')],'ListId':_0x3efdb1[_0x77b2('0x8a')]});_0x49ac06[_0x3a34a2[_0x77b2('0x4d')]['mapKeyOffline']]=_0x3a34a2['body'][_0x77b2('0x8b')];return db[_0x77b2('0x83')][_0x77b2('0xc3')]({'where':_0x4e8ecd,'defaults':_0x49ac06});}})[_0x77b2('0xc4')](function(_0x324743){if(_0x324743){_0xa68597=_0x324743;var _0x3abe5f=fs[_0x77b2('0xc5')](path['join'](config[_0x77b2('0x72')],_0x77b2('0xc6')),'utf8');var _0x103d11=ejs[_0x77b2('0xc7')](_0x3abe5f,{'body':_[_0x77b2('0xc8')](_0x3a34a2[_0x77b2('0x4d')]['body']),'bodyTitle':_0x1fd2f5[_0x77b2('0xc9')]});return db[_0x77b2('0xca')][_0x77b2('0x4c')]({'body':_0x103d11,'plainBody':htmlToText[_0x77b2('0xcb')](_0x103d11),'ContactId':_0x324743['id'],'ChatWebsiteId':_0x1fd2f5['id']});}})[_0x77b2('0x42')](function(_0x1cb2aa){_0x34287c=_0x1cb2aa;if(_0x2f76e1[_0x77b2('0x37')]){var _0x36b834=_0x2f76e1[_0x77b2('0x31')](function(_0x3429a9){return{'name':_0x3429a9[_0x77b2('0xcc')],'basename':_0x3429a9[_0x77b2('0x63')],'type':_0x3429a9['mimetype'],'ChatOfflineMessageId':_0x1cb2aa['id']};});_0xa90826=_0x36b834[_0x77b2('0x31')](_0x367ce1=>{var _0x3354e1={'filename':_0x367ce1[_0x77b2('0x29')],'path':path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0xcd'),'files','attachments',_0x77b2('0xce'),_0x367ce1[_0x77b2('0xcf')])};return _0x3354e1;});if(!_0x1fd2f5[_0x77b2('0xd0')]){return db[_0x77b2('0xd1')][_0x77b2('0xd2')](function(_0xf08b6b){return db['Attachment'][_0x77b2('0xd3')](_0x36b834,{'transaction':_0xf08b6b});});}}})[_0x77b2('0x42')](function(){if(_0x34287c){_0x408edc=_0x34287c;return db[_0x77b2('0xc2')][_0x77b2('0xd4')]({'where':{'service':!![]},'include':[{'model':db[_0x77b2('0xd5')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x77b2('0xd6')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x77b2('0x42')](function(_0x360c91){if(_0x360c91&&_0x360c91[_0x77b2('0xd7')]&&_0x1fd2f5['forwardOffline']&&_0x1fd2f5[_0x77b2('0xd8')]){var _0x1b7c9d=_0x360c91[_0x77b2('0xd9')]();return respondWithRpcPromise(_0x77b2('0xda'),_0x77b2('0xdb'),{'account':_0x1b7c9d,'message':{'from':util['format'](_0x77b2('0xdc'),_0x360c91[_0x77b2('0x29')],_0x360c91[_0x77b2('0xdd')]||_0x360c91['Smtp'][_0x77b2('0x4e')]),'to':_0x1fd2f5['forwardOfflineAddress'],'subject':_0x1fd2f5['offlineMessageSubject'],'html':_0x408edc[_0x77b2('0x4d')],'attachments':_0xa90826}},client9003)[_0x77b2('0x42')](function(){return _0x408edc;})[_0x77b2('0x46')](function(_0x5eecab){logger[_0x77b2('0x19')](_0x5eecab);});}})[_0x77b2('0x42')](function(){if(_0x1fd2f5&&_0x1fd2f5[_0x77b2('0xd0')]&&_0x1fd2f5[_0x77b2('0xde')]){var _0x4660e0=[];if(_0x2f76e1[_0x77b2('0x37')]){_0x4660e0=_0x2f76e1[_0x77b2('0x31')](function(_0xcedab4){return{'name':_0xcedab4[_0x77b2('0xcc')],'basename':_0xcedab4[_0x77b2('0x63')],'type':_0xcedab4[_0x77b2('0xdf')],'ChatOfflineMessageId':_0x34287c['id']};});}var _0x5121c3;if(!_['isNil'](_0x1fd2f5[_0x77b2('0xe0')])){var _0x3c56f0=_[_0x77b2('0x31')](_0x3a34a2[_0x77b2('0x4d')],function(_0xa3bf7b){return _0xa3bf7b;});var _0x4397d9=_[_0x77b2('0xe1')](_0x3c56f0)[0x0];var _0x45e73a=_[_0x77b2('0xe2')](_0x4397d9,function(_0x5665b8){return _0x5665b8;});_0x5121c3=_0x45e73a[0x1][_0x1fd2f5[_0x77b2('0xe0')]];}var _0x3fddab={'from':_0xa68597['email'],'firstName':_0xa68597[_0x77b2('0xa2')],'lastName':_0xa68597[_0x77b2('0xa3')],'mapKey':_0x77b2('0xdd'),'message':{'from':_0xa68597[_0x77b2('0xdd')],'to':_0x1fd2f5[_0x77b2('0xc2')][_0x77b2('0xdd')],'cc':'','subject':_[_0x77b2('0x6e')](_0x5121c3)?_0x1fd2f5[_0x77b2('0xe3')]:_0x5121c3,'messageId':'','sentAt':new Date(),'attach':_0x4660e0[_0x77b2('0x37')],'attachments':_0x4660e0,'originChannel':'Chat','ChatWebsiteId':_0x1fd2f5['id'],'ChatOfflineMessageId':_0x408edc['id'],'originTo':_0x1fd2f5[_0x77b2('0xc2')][_0x77b2('0xdd')]},'body':_0x408edc[_0x77b2('0x4d')]};var _0x101d5a={'account':{'id':_0x1fd2f5[_0x77b2('0xde')]},'body':_0x3fddab,'log':_0x77b2('0xe4')};return respondWithRpcPromise(_0x77b2('0xe4'),_0x77b2('0xe5'),_0x101d5a,client9001)[_0x77b2('0x42')](function(){return _0x408edc;})[_0x77b2('0x46')](function(_0x1849ea){logger[_0x77b2('0x19')](_0x1849ea);});}return;})[_0x77b2('0x42')](function(){if(_0x408edc){return _0x408edc;}})[_0x77b2('0x42')](respondWithResult(_0xae243,null))[_0x77b2('0x46')](function(_0x13ba1c){logger['error'](_0x77b2('0x46'),_0x13ba1c);for(var _0x3b25ce of _0x2f76e1){var _0x26b5e7=path[_0x77b2('0x70')](config['root'],_0x77b2('0xcd'),'files',_0x77b2('0xe6'),'offline-chat',_0x3b25ce[_0x77b2('0x63')]);fs_extra[_0x77b2('0xe7')](_0x26b5e7)['catch'](function(_0x37a948){logger[_0x77b2('0x19')](_0x77b2('0xe8'),_0x26b5e7,_0x37a948);});}});};exports[_0x77b2('0xe9')]=function(_0x40411a,_0x236570){return db[_0x77b2('0xae')]['find']({'where':{'id':_0x40411a['params']['id']}})['then'](handleEntityNotFound(_0x236570,null))[_0x77b2('0x42')](function(_0x12612f){if(_0x12612f){return _0x12612f[_0x77b2('0xe9')](_0x40411a[_0x77b2('0x4d')][_0x77b2('0x5c')],_[_0x77b2('0xea')](_0x40411a[_0x77b2('0x4d')],[_0x77b2('0x5c'),'id'])||{});}})[_0x77b2('0x42')](respondWithResult(_0x236570,null))['catch'](handleError(_0x236570,null));};exports[_0x77b2('0xeb')]=function(_0xa87d4b,_0x4a1149){var _0x24dffd={'raw':![],'where':{}};var _0x114dc7={};var _0x221f0e={'count':0x0,'rows':[]};return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0xa87d4b[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x4a1149,null))[_0x77b2('0x42')](function(_0x77f2d1){if(_0x77f2d1){_0x114dc7[_0x77b2('0x30')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x114dc7[_0x77b2('0x32')]=_['keys'](_0xa87d4b['query']);_0x114dc7[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x114dc7[_0x77b2('0x30')],_0x114dc7[_0x77b2('0x32')]);_0x24dffd['attributes']=_[_0x77b2('0x35')](_0x114dc7['model'],qs[_0x77b2('0x36')](_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x36')]));_0x24dffd[_0x77b2('0x34')]=_0x24dffd['attributes'][_0x77b2('0x37')]?_0x24dffd[_0x77b2('0x34')]:_0x114dc7[_0x77b2('0x30')];if(!_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x59')](_0x77b2('0x38'))){_0x24dffd[_0x77b2('0x21')]=qs[_0x77b2('0x21')](_0xa87d4b['query'][_0x77b2('0x21')]);_0x24dffd['offset']=qs['offset'](_0xa87d4b['query'][_0x77b2('0x20')]);}_0x24dffd[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x3a')]);_0x24dffd['where']=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0xa87d4b['query'],_0x114dc7[_0x77b2('0x33')]));_0x24dffd['where']['ChatWebsiteId']=_0x77f2d1['id'];if(_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x24dffd[_0x77b2('0x3e')]=_['merge'](_0x24dffd[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x24dffd[_0x77b2('0x34')],function(_0x230ca7){var _0x5b5b09={};_0x5b5b09[_0x230ca7]={'$like':'%'+_0xa87d4b[_0x77b2('0x32')]['filter']+'%'};return _0x5b5b09;})});}_0x24dffd=_[_0x77b2('0x3d')]({},_0x24dffd,_0xa87d4b['options']);return db[_0x77b2('0xae')][_0x77b2('0x23')]({'where':_0x24dffd[_0x77b2('0x3e')]})[_0x77b2('0x42')](function(_0x214596){_0x221f0e[_0x77b2('0x23')]=_0x214596;if(_0xa87d4b[_0x77b2('0x32')][_0x77b2('0x43')]){_0x24dffd['include']=[{'model':db[_0x77b2('0x83')],'as':'Contact','required':![]},{'model':db[_0x77b2('0xec')],'as':_0x77b2('0xed'),'attributes':[_0x77b2('0x29'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x77b2('0xee'),'attributes':['id',_0x77b2('0x29'),_0x77b2('0xef')],'where':_0xa87d4b[_0x77b2('0x32')][_0x77b2('0xf0')]?{'id':_0xa87d4b[_0x77b2('0x32')]['tag']}:undefined,'required':_0xa87d4b['query'][_0x77b2('0xf0')]?!![]:![]}];}return db[_0x77b2('0xae')][_0x77b2('0x5a')](_0x24dffd);})[_0x77b2('0x42')](function(_0x3fd958){_0x221f0e['rows']=_0x3fd958;return _0x221f0e;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0x4a1149,_0x24dffd))[_0x77b2('0x46')](handleError(_0x4a1149,null));};function iftimePromise(_0xc4bec3,_0x2c9011){return respondWithRpcPromise(_0x77b2('0xf1'),'getSnippet',{'command':_0x2c9011['timezone']?util[_0x77b2('0xa7')](_0x77b2('0xf2'),_0xc4bec3[_0x77b2('0xf3')],_0x2c9011['timezone']):util[_0x77b2('0xa7')]('iftime\x20%s',_0xc4bec3[_0x77b2('0xf3')])},client9002)['then'](function(_0x364576){var _0x57ad36=_0x364576&&_0x364576[_0x77b2('0xf4')](_0x77b2('0xf5'))>=0x0?!![]:![];logger[_0x77b2('0x14')](_0x77b2('0xf6'),_0x2c9011['id'],_0xc4bec3['id'],_0xc4bec3[_0x77b2('0xf3')],_0x57ad36?_0x77b2('0xf7'):_0x77b2('0xf8'),_0x2c9011[_0x77b2('0xf9')]?_0x2c9011[_0x77b2('0xf9')]:_0x77b2('0xfa'));return _0x57ad36;})['catch'](function(_0x5a7b6a){logger[_0x77b2('0x19')](_0x77b2('0xf6'),_0x2c9011['id'],_0xc4bec3['id'],_0xc4bec3[_0x77b2('0xf3')],util['inspect'](_0x5a7b6a,{'showHidden':![],'depth':null}),_0x2c9011[_0x77b2('0xf9')]?_0x2c9011[_0x77b2('0xf9')]:_0x77b2('0xfa'));return![];});}exports['getSnippet']=function(_0x3b5f0c,_0x1da4b9){var _0x23dcf5=0x0;var _0x355764=0x0;var _0x139ba8=![];var _0x405679;var _0x33c7af;return db[_0x77b2('0x41')]['find']({'where':{'id':_0x3b5f0c[_0x77b2('0x48')]['id']},'include':[{'model':db['Interval'],'as':_0x77b2('0xfb'),'include':[{'model':db[_0x77b2('0xfb')],'as':_0x77b2('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x77b2('0x42')](handleEntityNotFound(_0x1da4b9,null))[_0x77b2('0x42')](function(_0x58b7e8){if(_0x58b7e8){_0x405679=_0x58b7e8;return _0x58b7e8[_0x77b2('0xfd')]({'raw':!![]});}})[_0x77b2('0x42')](function(_0x39235c){if(_0x405679){if(_0x39235c){_0x33c7af=_0x39235c;}}return require(_0x77b2('0x6b'))[_0x77b2('0x6c')]();})['then'](function(_0x1f637c){if(_0x1f637c){_0x355764=_0x1f637c[_0x77b2('0xfe')];_0x139ba8=_0x1f637c[_0x77b2('0x6d')];}})[_0x77b2('0x42')](function(){return db[_0x77b2('0xae')][_0x77b2('0x23')]({'where':{'closed':![]}});})['then'](function(_0xa3e848){_0x23dcf5=_0xa3e848;if(_0x355764&&_0xa3e848>_0x355764){return db['License'][_0x77b2('0xd4')]({'where':{'id':0x1}})[_0x77b2('0x42')](function(_0x29a3aa){if(_0x29a3aa){_0x29a3aa[_0x77b2('0xff')](_0x77b2('0x100'));}});}})['then'](function(){if(_0x405679[_0x77b2('0xfb')]&&_0x405679[_0x77b2('0xfb')]['Intervals']){var _0x2f8d08=[];for(var _0x4ccf1f=0x0;_0x4ccf1f<_0x405679[_0x77b2('0xfb')]['Intervals']['length'];_0x4ccf1f++){var _0x30971d=_0x405679[_0x77b2('0xfb')][_0x77b2('0xfc')][_0x4ccf1f][_0x77b2('0x25')]({'plain':!![]});_0x2f8d08[_0x77b2('0xb3')](iftimePromise(_0x30971d,_0x405679));}return BPromise[_0x77b2('0x101')](_0x2f8d08)[_0x77b2('0x42')](function(_0xebed74){return _[_0x77b2('0x102')](_0xebed74);});}else{return!![];}})['then'](function(_0xf9409b){var _0x2411c9=fs[_0x77b2('0xc5')](path[_0x77b2('0x70')](config[_0x77b2('0x72')],_0x77b2('0x103')),_0x77b2('0x104'));var _0x23352f={'remote':_0x405679[_0x77b2('0x105')],'query':querystring[_0x77b2('0x18')](_[_0x77b2('0x3d')](_0x405679[_0x77b2('0x25')]({'plain':!![]}),{'customerIp':_0x3b5f0c['headers'][_0x77b2('0xa0')]||_0x3b5f0c[_0x77b2('0x7f')][_0x77b2('0x106')]||_0x3b5f0c[_0x77b2('0x107')][_0x77b2('0x108')]||_0x3b5f0c['ip'],'referer':_0x3b5f0c['headers'][_0x77b2('0x109')],'openedInteractions':_0x23dcf5,'maxInteractions':_0x355764,'virtual':_0x139ba8[_0x77b2('0xfe')],'online':_0xf9409b,'custom':_0x139ba8}))[_0x77b2('0x10a')](/'/g,'\x5c\x27')};_0x1da4b9[_0x77b2('0x2a')](ejs[_0x77b2('0xc7')](Mustache[_0x77b2('0xc7')](_0x2411c9,_0x23352f),{'proactiveActions':_0x33c7af,'alignment':_0x405679[_0x77b2('0x10b')],'verticalAlignment':_0x405679[_0x77b2('0x10c')],'div_color':_0x405679[_0x77b2('0xef')],'labelText':_0x405679[_0x77b2('0x10d')],'text_color':_0x405679[_0x77b2('0x10e')],'text_button_color':_0x405679[_0x77b2('0x10f')],'button_color':_0x405679[_0x77b2('0x110')],'background_color':_0x405679[_0x77b2('0x111')],'hideWhenOffline':_0x405679[_0x77b2('0x112')],'interval':_0x405679['IntervalId']}));})[_0x77b2('0x46')](handleError(_0x1da4b9,null));};exports[_0x77b2('0x113')]=function(_0x490aa3,_0x5b60d3){var _0x37d689=_0x490aa3[_0x77b2('0x48')]['id'];var _0x54b033=_0x490aa3['body'];var _0x3b9ece=0xc8;var _0x5bfbe4=null;return db[_0x77b2('0xd1')]['transaction']({'isolationLevel':db['sequelize'][_0x77b2('0x114')][_0x77b2('0x115')]['READ_COMMITTED']},function(_0x27cc5e){return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x37d689},'transaction':_0x27cc5e})[_0x77b2('0x42')](function(_0x15a2a5){if(_0x15a2a5){return db[_0x77b2('0x96')][_0x77b2('0x27')]({'where':{'ChatWebsiteId':_0x37d689},'transaction':_0x27cc5e})[_0x77b2('0x42')](function(){var _0xc80244=_[_0x77b2('0x31')](_0x54b033,function(_0x27716a){_0x27716a[_0x77b2('0x55')]=_0x37d689;return _0x27716a;});return db[_0x77b2('0x96')]['bulkCreate'](_0xc80244,{'transaction':_0x27cc5e});});}else{_0x3b9ece=0x194;_0x5bfbe4=[];}});})[_0x77b2('0x42')](function(){if(_0x3b9ece!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x37d689},'order':_0x77b2('0x9c')})['then'](function(_0x12659c){_0x5bfbe4=_0x12659c;});}})[_0x77b2('0x46')](function(_0x4be992){_0x3b9ece=0x1f4;logger['error'](_0x4be992[_0x77b2('0x28')]);if(_0x4be992[_0x77b2('0x29')]){delete _0x4be992[_0x77b2('0x29')];}_0x5bfbe4=_0x4be992;})[_0x77b2('0x116')](function(){if(_0x5bfbe4===null){_0x5b60d3[_0x77b2('0x1c')](_0x3b9ece);}else{if(_0x3b9ece===0x1f4){_0x5b60d3[_0x77b2('0x1d')](_0x3b9ece)[_0x77b2('0x2a')](_0x5bfbe4);}else{_0x5b60d3[_0x77b2('0x1d')](_0x3b9ece)[_0x77b2('0x1f')](_0x5bfbe4);}}});};exports[_0x77b2('0x117')]=function(_0x56d94e,_0x57d123){var _0x3319ac={};var _0x30e2ac={};var _0x27a7b0;var _0x142f30;return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x56d94e['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x57d123,null))[_0x77b2('0x42')](function(_0x38213b){if(_0x38213b){_0x27a7b0=_0x38213b;_0x30e2ac[_0x77b2('0x30')]=_[_0x77b2('0x4a')](db['ChatApplication'][_0x77b2('0x58')]);_0x30e2ac[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x56d94e[_0x77b2('0x32')]);_0x30e2ac[_0x77b2('0x33')]=_['intersection'](_0x30e2ac['model'],_0x30e2ac[_0x77b2('0x32')]);_0x3319ac['attributes']=_[_0x77b2('0x35')](_0x30e2ac[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x56d94e[_0x77b2('0x32')][_0x77b2('0x36')]));_0x3319ac[_0x77b2('0x34')]=_0x3319ac[_0x77b2('0x34')][_0x77b2('0x37')]?_0x3319ac[_0x77b2('0x34')]:_0x30e2ac[_0x77b2('0x30')];_0x3319ac[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x56d94e['query'][_0x77b2('0x3a')]);_0x3319ac[_0x77b2('0x3e')]=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x56d94e['query'],_0x30e2ac['filters']));if(_0x56d94e[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x3319ac[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x3319ac[_0x77b2('0x3e')],{'$or':_['map'](_0x3319ac[_0x77b2('0x34')],function(_0x544265){var _0x527e0b={};_0x527e0b[_0x544265]={'$like':'%'+_0x56d94e[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x527e0b;})});}_0x3319ac=_[_0x77b2('0x3d')]({},_0x3319ac,_0x56d94e[_0x77b2('0x40')]);return _0x27a7b0['getApplications'](_0x3319ac);}})[_0x77b2('0x42')](function(_0x172413){if(_0x172413){_0x142f30=_0x172413[_0x77b2('0x37')];if(!_0x56d94e['query'][_0x77b2('0x59')](_0x77b2('0x38'))){_0x3319ac[_0x77b2('0x21')]=qs['limit'](_0x56d94e[_0x77b2('0x32')][_0x77b2('0x21')]);_0x3319ac[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x56d94e[_0x77b2('0x32')]['offset']);}return _0x27a7b0[_0x77b2('0x117')](_0x3319ac);}})[_0x77b2('0x42')](function(_0x8b93a5){if(_0x8b93a5){return _0x8b93a5?{'count':_0x142f30,'rows':_0x8b93a5}:null;}})[_0x77b2('0x42')](respondWithResult(_0x57d123,null))['catch'](handleError(_0x57d123,null));};exports['addProactiveActions']=function(_0x537826,_0x39d291){return db[_0x77b2('0x118')][_0x77b2('0x4b')]({'where':{'id':_0x537826[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x39d291,null))['then'](function(_0x42b4b4){if(_0x42b4b4){return _0x42b4b4[_0x77b2('0x119')](_0x537826[_0x77b2('0x4d')][_0x77b2('0x5c')],_[_0x77b2('0xea')](_0x537826['body'],[_0x77b2('0x5c'),'id'])||{});}})[_0x77b2('0x42')](respondWithResult(_0x39d291,null))[_0x77b2('0x46')](handleError(_0x39d291,null));};exports[_0x77b2('0xfd')]=function(_0x187e0b,_0x2496c3){var _0x1edd7f={};var _0x5d5a9e={};var _0x545401;var _0x29dcb7;return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x187e0b['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x2496c3,null))[_0x77b2('0x42')](function(_0x4e88fc){if(_0x4e88fc){_0x545401=_0x4e88fc;_0x5d5a9e[_0x77b2('0x30')]=_['keys'](db[_0x77b2('0x11a')]['rawAttributes']);_0x5d5a9e[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x187e0b[_0x77b2('0x32')]);_0x5d5a9e[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x5d5a9e['model'],_0x5d5a9e[_0x77b2('0x32')]);_0x1edd7f['attributes']=_[_0x77b2('0x35')](_0x5d5a9e['model'],qs[_0x77b2('0x36')](_0x187e0b[_0x77b2('0x32')]['fields']));_0x1edd7f['attributes']=_0x1edd7f[_0x77b2('0x34')][_0x77b2('0x37')]?_0x1edd7f[_0x77b2('0x34')]:_0x5d5a9e[_0x77b2('0x30')];_0x1edd7f[_0x77b2('0x39')]=qs['sort'](_0x187e0b['query'][_0x77b2('0x3a')]);_0x1edd7f['where']=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x187e0b['query'],_0x5d5a9e['filters']));if(_0x187e0b[_0x77b2('0x32')]['filter']){_0x1edd7f[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x1edd7f[_0x77b2('0x3e')],{'$or':_[_0x77b2('0x31')](_0x1edd7f[_0x77b2('0x34')],function(_0x405413){var _0x3be026={};_0x3be026[_0x405413]={'$like':'%'+_0x187e0b[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x3be026;})});}_0x1edd7f=_[_0x77b2('0x3d')]({},_0x1edd7f,_0x187e0b['options']);return _0x545401[_0x77b2('0xfd')](_0x1edd7f);}})[_0x77b2('0x42')](function(_0x281a7f){if(_0x281a7f){_0x29dcb7=_0x281a7f['length'];if(!_0x187e0b[_0x77b2('0x32')][_0x77b2('0x59')](_0x77b2('0x38'))){_0x1edd7f['limit']=qs[_0x77b2('0x21')](_0x187e0b[_0x77b2('0x32')][_0x77b2('0x21')]);_0x1edd7f[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x187e0b[_0x77b2('0x32')][_0x77b2('0x20')]);}return _0x545401['getProactiveActions'](_0x1edd7f);}})[_0x77b2('0x42')](function(_0x90242b){if(_0x90242b){return _0x90242b?{'count':_0x29dcb7,'rows':_0x90242b}:null;}})[_0x77b2('0x42')](respondWithResult(_0x2496c3,null))['catch'](handleError(_0x2496c3,null));};exports[_0x77b2('0x11b')]=function(_0x2ca76c,_0x5b3be4){var _0x541626=_0x2ca76c[_0x77b2('0x32')]['online']===_0x77b2('0x11c')?_0x77b2('0x11d'):'onlineForm';return db[_0x77b2('0x41')][_0x77b2('0x4b')]({'attributes':['id',_0x541626],'where':{'id':_0x2ca76c[_0x77b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b3be4,null))[_0x77b2('0x42')](function(_0x13a6d6){if(_0x13a6d6){var _0x25da89=_0x13a6d6[_0x541626];var _0x2e5138=_0x25da89&&_0x25da89[_0x77b2('0x11e')]?_0x25da89['items']:[];_0x5b3be4[_0x77b2('0x2a')]({'fromKey':_[_0x77b2('0x6e')](_0x25da89[_0x77b2('0x11f')])?undefined:_0x25da89['fromKey'],'count':_0x2e5138['length'],'rows':_0x2e5138});}})[_0x77b2('0x46')](handleError(_0x5b3be4,null));};exports[_0x77b2('0x120')]=function(_0x51c4c5,_0x17c1ef){var _0x238260={'raw':![],'where':{}};var _0x5bc934={};var _0x1c8ccb={'count':0x0,'rows':[]};return db[_0x77b2('0x41')]['findOne']({'where':{'id':_0x51c4c5['params']['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x17c1ef,null))[_0x77b2('0x42')](function(_0x526a75){if(_0x526a75){_0x5bc934[_0x77b2('0x30')]=_[_0x77b2('0x4a')](db[_0x77b2('0xca')][_0x77b2('0x58')]);_0x5bc934[_0x77b2('0x32')]=_['keys'](_0x51c4c5['query']);_0x5bc934[_0x77b2('0x33')]=_[_0x77b2('0x35')](_0x5bc934[_0x77b2('0x30')],_0x5bc934[_0x77b2('0x32')]);_0x238260[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x5bc934[_0x77b2('0x30')],qs['fields'](_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x36')]));_0x238260[_0x77b2('0x34')]=_0x238260['attributes']['length']?_0x238260[_0x77b2('0x34')]:_0x5bc934[_0x77b2('0x30')];if(!_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x59')](_0x77b2('0x38'))){_0x238260[_0x77b2('0x21')]=qs[_0x77b2('0x21')](_0x51c4c5['query'][_0x77b2('0x21')]);_0x238260[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x20')]);}_0x238260[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x3a')]);_0x238260[_0x77b2('0x3e')]=qs['filters'](_[_0x77b2('0x3b')](_0x51c4c5[_0x77b2('0x32')],_0x5bc934[_0x77b2('0x33')]));_0x238260['where'][_0x77b2('0x55')]=_0x526a75['id'];if(_0x51c4c5[_0x77b2('0x32')]['filter']){_0x238260[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x238260['where'],{'$or':_[_0x77b2('0x31')](_0x238260[_0x77b2('0x34')],function(_0x3590be){var _0x189619={};_0x189619[_0x3590be]={'$like':'%'+_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x3c')]+'%'};return _0x189619;})});}_0x238260=_[_0x77b2('0x3d')]({},_0x238260,_0x51c4c5[_0x77b2('0x40')]);return db[_0x77b2('0xca')][_0x77b2('0x23')]({'where':_0x238260['where']})[_0x77b2('0x42')](function(_0x34f1c1){_0x1c8ccb[_0x77b2('0x23')]=_0x34f1c1;if(_0x51c4c5[_0x77b2('0x32')][_0x77b2('0x43')]){_0x238260[_0x77b2('0x44')]=[{'all':!![]}];}else{_0x238260[_0x77b2('0x44')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x77b2('0x121')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x77b2('0x5a')](_0x238260);})[_0x77b2('0x42')](function(_0x4d791c){_0x1c8ccb[_0x77b2('0x45')]=_0x4d791c;return _0x1c8ccb;});}})[_0x77b2('0x42')](respondWithFilteredResult(_0x17c1ef,_0x238260))[_0x77b2('0x46')](handleError(_0x17c1ef,null));};exports[_0x77b2('0x122')]=function(_0x2defcc,_0x20f4e6){return db['ChatWebsite'][_0x77b2('0x4b')]({'where':{'id':_0x2defcc[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x20f4e6,null))[_0x77b2('0x42')](function(_0x39370d){if(_0x39370d){return _0x39370d[_0x77b2('0x122')](_0x2defcc[_0x77b2('0x4d')][_0x77b2('0x5c')],_[_0x77b2('0xea')](_0x2defcc[_0x77b2('0x4d')],[_0x77b2('0x5c'),'id'])||{})['spread'](function(_0x4fdb){for(var _0x537a90=0x0;_0x537a90<_0x2defcc['body'][_0x77b2('0x5c')]['length'];_0x537a90+=0x1){socket[_0x77b2('0x123')](_0x77b2('0x124'),{'UserId':Number(_0x2defcc[_0x77b2('0x4d')][_0x77b2('0x5c')][_0x537a90]),'ChatWebsiteId':Number(_0x2defcc['params']['id'])});}return _0x4fdb;});}})[_0x77b2('0x42')](respondWithResult(_0x20f4e6,null))[_0x77b2('0x46')](handleError(_0x20f4e6,null));};exports['removeAgents']=function(_0x452a65,_0x17c5fc){return db['ChatWebsite'][_0x77b2('0x4b')]({'where':{'id':_0x452a65[_0x77b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x17c5fc,null))[_0x77b2('0x42')](function(_0xf20fed){if(_0xf20fed){return _0xf20fed[_0x77b2('0x125')](_0x452a65['query'][_0x77b2('0x5c')])[_0x77b2('0x42')](function(){if(_[_0x77b2('0x126')](_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')])){for(var _0x1e8187=0x0;_0x1e8187<_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')][_0x77b2('0x37')];_0x1e8187+=0x1){socket[_0x77b2('0x123')]('userChatWebsite:remove',{'UserId':Number(_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')][_0x1e8187]),'ChatWebsiteId':Number(_0x452a65[_0x77b2('0x48')]['id'])});}}else{socket[_0x77b2('0x123')]('userChatWebsite:remove',{'UserId':Number(_0x452a65[_0x77b2('0x32')][_0x77b2('0x5c')]),'ChatWebsiteId':Number(_0x452a65[_0x77b2('0x48')]['id'])});}});}})[_0x77b2('0x42')](respondWithStatusCode(_0x17c5fc,null))[_0x77b2('0x46')](handleError(_0x17c5fc,null));};exports[_0x77b2('0x127')]=function(_0x18a967,_0x413f62){var _0x8a1a74={};var _0x34bc6a={};var _0x2f5c46;var _0xde51c1;return db[_0x77b2('0x41')][_0x77b2('0xd4')]({'where':{'id':_0x18a967[_0x77b2('0x48')]['id']}})[_0x77b2('0x42')](handleEntityNotFound(_0x413f62,null))[_0x77b2('0x42')](function(_0x474783){if(_0x474783){_0x2f5c46=_0x474783;_0x34bc6a[_0x77b2('0x30')]=_[_0x77b2('0x4a')](db['User'][_0x77b2('0x58')]);_0x34bc6a[_0x77b2('0x32')]=_[_0x77b2('0x4a')](_0x18a967[_0x77b2('0x32')]);_0x34bc6a[_0x77b2('0x33')]=_['intersection'](_0x34bc6a[_0x77b2('0x30')],_0x34bc6a[_0x77b2('0x32')]);_0x8a1a74[_0x77b2('0x34')]=_[_0x77b2('0x35')](_0x34bc6a[_0x77b2('0x30')],qs[_0x77b2('0x36')](_0x18a967[_0x77b2('0x32')][_0x77b2('0x36')]));_0x8a1a74[_0x77b2('0x34')]=_0x8a1a74[_0x77b2('0x34')][_0x77b2('0x37')]?_0x8a1a74['attributes']:_0x34bc6a[_0x77b2('0x30')];_0x8a1a74[_0x77b2('0x39')]=qs[_0x77b2('0x3a')](_0x18a967['query']['sort']);_0x8a1a74[_0x77b2('0x3e')]=qs[_0x77b2('0x33')](_[_0x77b2('0x3b')](_0x18a967[_0x77b2('0x32')],_0x34bc6a[_0x77b2('0x33')]));if(_0x18a967[_0x77b2('0x32')][_0x77b2('0x3c')]){_0x8a1a74[_0x77b2('0x3e')]=_[_0x77b2('0x3d')](_0x8a1a74['where'],{'$or':_[_0x77b2('0x31')](_0x8a1a74['attributes'],function(_0xc67a12){var _0x4f11a0={};_0x4f11a0[_0xc67a12]={'$like':'%'+_0x18a967[_0x77b2('0x32')]['filter']+'%'};return _0x4f11a0;})});}_0x8a1a74=_[_0x77b2('0x3d')]({},_0x8a1a74,_0x18a967['options']);return _0x2f5c46[_0x77b2('0x127')](_0x8a1a74);}})['then'](function(_0x1d27dd){if(_0x1d27dd){_0xde51c1=_0x1d27dd['length'];if(!_0x18a967[_0x77b2('0x32')]['hasOwnProperty']('nolimit')){_0x8a1a74[_0x77b2('0x21')]=qs['limit'](_0x18a967[_0x77b2('0x32')][_0x77b2('0x21')]);_0x8a1a74[_0x77b2('0x20')]=qs[_0x77b2('0x20')](_0x18a967[_0x77b2('0x32')][_0x77b2('0x20')]);}return _0x2f5c46[_0x77b2('0x127')](_0x8a1a74);}})[_0x77b2('0x42')](function(_0x24bddb){if(_0x24bddb){return _0x24bddb?{'count':_0xde51c1,'rows':_0x24bddb}:null;}})[_0x77b2('0x42')](respondWithResult(_0x413f62,null))[_0x77b2('0x46')](handleError(_0x413f62,null));}; \ No newline at end of file +var _0x4de3=['defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','UserProfileResource','destroy','end','stack','name','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','model','map','intersection','query','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','Pause','keys','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ChatWebsiteId','Disposition','findOne','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','sitepic','file','filename','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','ChatApplication','Applications','applications','list','priority','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','messageId','created','autoclose','push','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','notify','offline','describe','send','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','files','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','remove','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','../../config/license/util','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','hideWhenOffline','IntervalId','addApplications','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4de3,0x11f));var _0x34de=function(_0x2c4ed1,_0x241e33){_0x2c4ed1=_0x2c4ed1-0x0;var _0x27480e=_0x4de3[_0x2c4ed1];return _0x27480e;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x34de('0x0'));var util=require(_0x34de('0x1'));var path=require(_0x34de('0x2'));var ejs=require(_0x34de('0x3'));var fs=require('fs');var fs_extra=require(_0x34de('0x4'));var _=require(_0x34de('0x5'));var querystring=require(_0x34de('0x6'));var Redis=require(_0x34de('0x7'));var qs=require(_0x34de('0x8'));var logger=require(_0x34de('0x9'))(_0x34de('0xa'));var config=require(_0x34de('0xb'));var db=require(_0x34de('0xc'))['db'];config[_0x34de('0xd')]=_[_0x34de('0xe')](config['redis'],{'host':_0x34de('0xf'),'port':0x18eb});var socket=require(_0x34de('0x10'))(new Redis(config[_0x34de('0xd')]));require(_0x34de('0x11'))[_0x34de('0x12')](socket);var htmlToText=require(_0x34de('0x13'));var jayson=require(_0x34de('0x14'));var client=jayson[_0x34de('0x15')][_0x34de('0x16')]({'port':0x232c});var client9002=jayson[_0x34de('0x15')][_0x34de('0x16')]({'port':0x232a});var client9003=jayson['client'][_0x34de('0x16')]({'port':0x232b});var client9001=jayson[_0x34de('0x15')][_0x34de('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x3c5a73,_0xabbf9,_0x42b049,_0x1f59bc){return new BPromise(function(_0x5ed0db,_0x5d259f){var _0x3e6786=_0x1f59bc||client;return _0x3e6786['request'](_0x3c5a73,_0x42b049)[_0x34de('0x17')](function(_0x25664a){logger[_0x34de('0x18')](_0x34de('0x19'),_0xabbf9,_0x34de('0x1a'));logger[_0x34de('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xabbf9,_0x34de('0x1a'),JSON[_0x34de('0x1c')](_0x25664a));if(_0x25664a[_0x34de('0x1d')]){if(_0x25664a[_0x34de('0x1d')][_0x34de('0x1e')]===0x1f4){logger[_0x34de('0x1d')](_0x34de('0x19'),_0xabbf9,_0x25664a[_0x34de('0x1d')][_0x34de('0x1f')]);return _0x5d259f(_0x25664a[_0x34de('0x1d')]['message']);}logger[_0x34de('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0xabbf9,_0x25664a[_0x34de('0x1d')][_0x34de('0x1f')]);return _0x5ed0db(_0x25664a[_0x34de('0x1d')][_0x34de('0x1f')]);}else{logger[_0x34de('0x18')](_0x34de('0x19'),_0xabbf9,_0x34de('0x1a'));_0x5ed0db(_0x25664a[_0x34de('0x20')][_0x34de('0x1f')]);}})['catch'](function(_0x2b51e7){logger[_0x34de('0x1d')](_0x34de('0x19'),_0xabbf9,_0x2b51e7);_0x5d259f(_0x2b51e7);});});}function respondWithStatusCode(_0x33f80a,_0xa778eb){_0xa778eb=_0xa778eb||0xcc;return function(_0x1137c5){if(_0x1137c5){return _0x33f80a[_0x34de('0x21')](_0xa778eb);}return _0x33f80a['status'](_0xa778eb)['end']();};}function respondWithResult(_0x54017d,_0x59b449){_0x59b449=_0x59b449||0xc8;return function(_0x460d78){if(_0x460d78){return _0x54017d[_0x34de('0x22')](_0x59b449)[_0x34de('0x23')](_0x460d78);}};}function respondWithFilteredResult(_0x3493cf,_0xe6e089){return function(_0x2d8298){if(_0x2d8298){var _0x57b8ed=typeof _0xe6e089[_0x34de('0x24')]===_0x34de('0x25')&&typeof _0xe6e089['limit']===_0x34de('0x25');var _0x2aad57=_0x2d8298[_0x34de('0x26')];var _0x2b7708=_0x57b8ed?0x0:_0xe6e089['offset'];var _0x171477=_0x57b8ed?_0x2d8298['count']:_0xe6e089[_0x34de('0x24')]+_0xe6e089['limit'];var _0x10bdeb;if(_0x171477>=_0x2aad57){_0x171477=_0x2aad57;_0x10bdeb=0xc8;}else{_0x10bdeb=0xce;}_0x3493cf[_0x34de('0x22')](_0x10bdeb);return _0x3493cf[_0x34de('0x27')](_0x34de('0x28'),_0x2b7708+'-'+_0x171477+'/'+_0x2aad57)[_0x34de('0x23')](_0x2d8298);}return null;};}function saveUpdates(_0x43700a){return function(_0x4a67f1){if(_0x4a67f1){return _0x4a67f1[_0x34de('0x29')](_0x43700a)['then'](function(_0x10fdcc){return _0x10fdcc;});}return null;};}function removeEntity(_0x2e2a07){return function(_0x245c24){if(_0x245c24){return _0x245c24['destroy']()[_0x34de('0x17')](function(){var _0x34f8ba=_0x245c24['get']({'plain':!![]});var _0x26246e='ChatWebsites';return db[_0x34de('0x2a')][_0x34de('0x2b')]({'where':{'type':_0x26246e,'resourceId':_0x34f8ba['id']}})[_0x34de('0x17')](function(){return _0x245c24;});})['then'](function(){_0x2e2a07[_0x34de('0x22')](0xcc)[_0x34de('0x2c')]();});}};}function handleEntityNotFound(_0xffb59){return function(_0x46fe28){if(!_0x46fe28){_0xffb59['sendStatus'](0x194);}return _0x46fe28;};}function handleError(_0x1beb0e,_0x390e1d){_0x390e1d=_0x390e1d||0x1f4;return function(_0x46e8ff){logger[_0x34de('0x1d')](_0x46e8ff[_0x34de('0x2d')]);if(_0x46e8ff[_0x34de('0x2e')]){delete _0x46e8ff['name'];}_0x1beb0e[_0x34de('0x22')](_0x390e1d)['send'](_0x46e8ff);};}exports['index']=function(_0x1ad85f,_0x101eb8){var _0x58c249={'include':[{'model':db['Pause'],'as':_0x34de('0x2f')}]},_0x26ef15={},_0x165340={'count':0x0,'rows':[]};var _0x7622cc=_['map'](db[_0x34de('0x30')][_0x34de('0x31')],function(_0x583eb3){return{'name':_0x583eb3[_0x34de('0x32')],'type':_0x583eb3[_0x34de('0x33')]['key']};});_0x26ef15[_0x34de('0x34')]=_[_0x34de('0x35')](_0x7622cc,_0x34de('0x2e'));_0x26ef15['query']=_['keys'](_0x1ad85f['query']);_0x26ef15['filters']=_[_0x34de('0x36')](_0x26ef15[_0x34de('0x34')],_0x26ef15[_0x34de('0x37')]);_0x58c249[_0x34de('0x38')]=_[_0x34de('0x36')](_0x26ef15[_0x34de('0x34')],qs[_0x34de('0x39')](_0x1ad85f[_0x34de('0x37')][_0x34de('0x39')]));_0x58c249[_0x34de('0x38')]=_0x58c249['attributes'][_0x34de('0x3a')]?_0x58c249[_0x34de('0x38')]:_0x26ef15[_0x34de('0x34')];if(!_0x1ad85f[_0x34de('0x37')][_0x34de('0x3b')]('nolimit')){_0x58c249['limit']=qs[_0x34de('0x3c')](_0x1ad85f[_0x34de('0x37')]['limit']);_0x58c249[_0x34de('0x24')]=qs[_0x34de('0x24')](_0x1ad85f['query'][_0x34de('0x24')]);}_0x58c249['order']=qs[_0x34de('0x3d')](_0x1ad85f[_0x34de('0x37')][_0x34de('0x3d')]);_0x58c249[_0x34de('0x3e')]=qs['filters'](_[_0x34de('0x3f')](_0x1ad85f[_0x34de('0x37')],_0x26ef15[_0x34de('0x40')]),_0x7622cc);if(_0x1ad85f[_0x34de('0x37')][_0x34de('0x41')]){_0x58c249[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x58c249['where'],{'$or':_[_0x34de('0x35')](_0x7622cc,function(_0x47ca69){if(_0x47ca69['type']!==_0x34de('0x43')){var _0x3edf89={};_0x3edf89[_0x47ca69[_0x34de('0x2e')]]={'$like':'%'+_0x1ad85f[_0x34de('0x37')][_0x34de('0x41')]+'%'};return _0x3edf89;}})});}_0x58c249=_[_0x34de('0x42')]({},_0x58c249,_0x1ad85f['options']);var _0x193c83={'where':_0x58c249['where']};return db[_0x34de('0x30')]['count'](_0x193c83)[_0x34de('0x17')](function(_0xf75355){_0x165340[_0x34de('0x26')]=_0xf75355;if(_0x1ad85f['query'][_0x34de('0x44')]){_0x58c249[_0x34de('0x45')]=[{'all':!![]}];}return db[_0x34de('0x30')][_0x34de('0x46')](_0x58c249);})['then'](function(_0x1a1542){_0x165340['rows']=_0x1a1542;return _0x165340;})['then'](respondWithFilteredResult(_0x101eb8,_0x58c249))[_0x34de('0x47')](handleError(_0x101eb8,null));};exports[_0x34de('0x48')]=function(_0x222d74,_0x4301cb){var _0x4168f1={'raw':![],'where':{'id':_0x222d74[_0x34de('0x49')]['id']},'include':[{'model':db[_0x34de('0x4a')],'as':_0x34de('0x2f')}]},_0x50f2d={};_0x50f2d['model']=_[_0x34de('0x4b')](db[_0x34de('0x30')][_0x34de('0x31')]);_0x50f2d[_0x34de('0x37')]=_[_0x34de('0x4b')](_0x222d74['query']);_0x50f2d[_0x34de('0x40')]=_[_0x34de('0x36')](_0x50f2d[_0x34de('0x34')],_0x50f2d[_0x34de('0x37')]);_0x4168f1[_0x34de('0x38')]=_[_0x34de('0x36')](_0x50f2d[_0x34de('0x34')],qs[_0x34de('0x39')](_0x222d74[_0x34de('0x37')][_0x34de('0x39')]));_0x4168f1[_0x34de('0x38')]=_0x4168f1[_0x34de('0x38')]['length']?_0x4168f1[_0x34de('0x38')]:_0x50f2d[_0x34de('0x34')];if(_0x222d74['query'][_0x34de('0x44')]){_0x4168f1[_0x34de('0x45')]=[{'all':!![]}];}_0x4168f1=_[_0x34de('0x42')]({},_0x4168f1,_0x222d74[_0x34de('0x4c')]);return db[_0x34de('0x30')]['find'](_0x4168f1)[_0x34de('0x17')](handleEntityNotFound(_0x4301cb,null))[_0x34de('0x17')](respondWithResult(_0x4301cb,null))[_0x34de('0x47')](handleError(_0x4301cb,null));};exports[_0x34de('0x4d')]=function(_0xcdd424,_0x5df8b0){return db[_0x34de('0x30')][_0x34de('0x4d')](_0xcdd424[_0x34de('0x4e')],{})['then'](function(_0x528b1a){var _0x1df636=_0xcdd424['user'][_0x34de('0x4f')]({'plain':!![]});if(!_0x1df636)throw new Error(_0x34de('0x50'));if(_0x1df636[_0x34de('0x51')]===_0x34de('0x52')){var _0x299323=_0x528b1a[_0x34de('0x4f')]({'plain':!![]});var _0x12c0fa='ChatWebsites';return db[_0x34de('0x53')][_0x34de('0x54')]({'where':{'name':_0x12c0fa,'userProfileId':_0x1df636[_0x34de('0x55')]},'raw':!![]})[_0x34de('0x17')](function(_0x2ad3fc){if(_0x2ad3fc&&_0x2ad3fc[_0x34de('0x56')]===0x0){return db[_0x34de('0x2a')]['create']({'name':_0x299323[_0x34de('0x2e')],'resourceId':_0x299323['id'],'type':_0x2ad3fc[_0x34de('0x2e')],'sectionId':_0x2ad3fc['id']},{})[_0x34de('0x17')](function(){return _0x528b1a;});}else{return _0x528b1a;}})[_0x34de('0x47')](function(_0x1e30a4){logger[_0x34de('0x1d')](_0x34de('0x57'),_0x1e30a4);throw _0x1e30a4;});}return _0x528b1a;})[_0x34de('0x17')](respondWithResult(_0x5df8b0,0xc9))[_0x34de('0x47')](handleError(_0x5df8b0,null));};exports[_0x34de('0x29')]=function(_0x349e10,_0xb50c16){if(_0x349e10[_0x34de('0x4e')]['id']){delete _0x349e10['body']['id'];}return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x349e10['params']['id']},'include':[{'model':db[_0x34de('0x4a')],'as':'mandatoryDispositionPause'}]})[_0x34de('0x17')](handleEntityNotFound(_0xb50c16,null))['then'](saveUpdates(_0x349e10['body'],null))['then'](respondWithResult(_0xb50c16,null))[_0x34de('0x47')](handleError(_0xb50c16,null));};exports['destroy']=function(_0x8f1d03,_0x496bb7){return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x8f1d03[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x496bb7,null))['then'](removeEntity(_0x496bb7,null))[_0x34de('0x47')](handleError(_0x496bb7,null));};exports['describe']=function(_0x5378f5,_0x2e230f){return db[_0x34de('0x30')]['describe']()[_0x34de('0x17')](respondWithResult(_0x2e230f,null))[_0x34de('0x47')](handleError(_0x2e230f,null));};exports[_0x34de('0x58')]=function(_0x2052b4,_0x5b0be6){if(_0x2052b4['body']['id']){delete _0x2052b4[_0x34de('0x4e')]['id'];}return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x2052b4[_0x34de('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b0be6,null))[_0x34de('0x17')](function(_0x248676){if(_0x248676){_0x2052b4[_0x34de('0x4e')][_0x34de('0x59')]=_0x248676['id'];return db[_0x34de('0x5a')][_0x34de('0x4d')](_0x2052b4['body']);}})['then'](respondWithResult(_0x5b0be6,null))[_0x34de('0x47')](handleError(_0x5b0be6,null));};exports['getDispositions']=function(_0x5657c1,_0xa1b3b6){var _0x502053={'raw':![],'where':{}};var _0x2b48bf={};var _0x842bc1={'count':0x0,'rows':[]};return db[_0x34de('0x30')][_0x34de('0x5b')]({'where':{'id':_0x5657c1[_0x34de('0x49')]['id']}})['then'](handleEntityNotFound(_0xa1b3b6,null))[_0x34de('0x17')](function(_0x877d11){if(_0x877d11){_0x2b48bf['model']=_['keys'](db[_0x34de('0x5a')][_0x34de('0x31')]);_0x2b48bf[_0x34de('0x37')]=_['keys'](_0x5657c1[_0x34de('0x37')]);_0x2b48bf['filters']=_['intersection'](_0x2b48bf[_0x34de('0x34')],_0x2b48bf[_0x34de('0x37')]);_0x502053[_0x34de('0x38')]=_[_0x34de('0x36')](_0x2b48bf[_0x34de('0x34')],qs[_0x34de('0x39')](_0x5657c1[_0x34de('0x37')]['fields']));_0x502053[_0x34de('0x38')]=_0x502053[_0x34de('0x38')][_0x34de('0x3a')]?_0x502053[_0x34de('0x38')]:_0x2b48bf[_0x34de('0x34')];if(!_0x5657c1[_0x34de('0x37')]['hasOwnProperty'](_0x34de('0x5c'))){_0x502053[_0x34de('0x3c')]=qs[_0x34de('0x3c')](_0x5657c1[_0x34de('0x37')][_0x34de('0x3c')]);_0x502053['offset']=qs[_0x34de('0x24')](_0x5657c1['query']['offset']);}_0x502053['order']=qs[_0x34de('0x3d')](_0x5657c1[_0x34de('0x37')]['sort']);_0x502053[_0x34de('0x3e')]=qs['filters'](_[_0x34de('0x3f')](_0x5657c1['query'],_0x2b48bf['filters']));_0x502053[_0x34de('0x3e')][_0x34de('0x59')]=_0x877d11['id'];if(_0x5657c1[_0x34de('0x37')][_0x34de('0x41')]){_0x502053[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x502053[_0x34de('0x3e')],{'$or':_[_0x34de('0x35')](_0x502053[_0x34de('0x38')],function(_0x1960c1){var _0x1b8dae={};_0x1b8dae[_0x1960c1]={'$like':'%'+_0x5657c1[_0x34de('0x37')][_0x34de('0x41')]+'%'};return _0x1b8dae;})});}_0x502053=_[_0x34de('0x42')]({},_0x502053,_0x5657c1[_0x34de('0x4c')]);return db[_0x34de('0x5a')][_0x34de('0x26')]({'where':_0x502053[_0x34de('0x3e')]})[_0x34de('0x17')](function(_0x37aae4){_0x842bc1[_0x34de('0x26')]=_0x37aae4;if(_0x5657c1[_0x34de('0x37')][_0x34de('0x44')]){_0x502053[_0x34de('0x45')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x502053);})[_0x34de('0x17')](function(_0x42f19d){_0x842bc1[_0x34de('0x5d')]=_0x42f19d;return _0x842bc1;});}})[_0x34de('0x17')](respondWithFilteredResult(_0xa1b3b6,_0x502053))[_0x34de('0x47')](handleError(_0xa1b3b6,null));};exports[_0x34de('0x5e')]=function(_0x368c43,_0x3f3498){return db[_0x34de('0x30')]['find']({'where':{'id':_0x368c43[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x3f3498,null))[_0x34de('0x17')](function(_0x2824af){if(_0x2824af){return _0x2824af[_0x34de('0x5e')](_0x368c43[_0x34de('0x37')][_0x34de('0x5f')]);}})[_0x34de('0x17')](respondWithStatusCode(_0x3f3498,null))['catch'](handleError(_0x3f3498,null));};exports[_0x34de('0x60')]=function(_0x28ae6c,_0x19a9bc){if(_0x28ae6c[_0x34de('0x4e')]['id']){delete _0x28ae6c['body']['id'];}return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x28ae6c[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x19a9bc,null))[_0x34de('0x17')](function(_0x3c4d09){if(_0x3c4d09){_0x28ae6c['body'][_0x34de('0x59')]=_0x3c4d09['id'];return db[_0x34de('0x61')][_0x34de('0x4d')](_0x28ae6c[_0x34de('0x4e')]);}})[_0x34de('0x17')](respondWithResult(_0x19a9bc,null))[_0x34de('0x47')](handleError(_0x19a9bc,null));};exports[_0x34de('0x62')]=function(_0x1df26a,_0x5766f9){var _0x46d8eb={'raw':![],'where':{}};var _0x4e8b80={};var _0x43a4dd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x34de('0x5b')]({'where':{'id':_0x1df26a[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x5766f9,null))['then'](function(_0x57e488){if(_0x57e488){_0x4e8b80['model']=_['keys'](db[_0x34de('0x61')][_0x34de('0x31')]);_0x4e8b80[_0x34de('0x37')]=_[_0x34de('0x4b')](_0x1df26a[_0x34de('0x37')]);_0x4e8b80[_0x34de('0x40')]=_['intersection'](_0x4e8b80[_0x34de('0x34')],_0x4e8b80['query']);_0x46d8eb['attributes']=_[_0x34de('0x36')](_0x4e8b80[_0x34de('0x34')],qs[_0x34de('0x39')](_0x1df26a[_0x34de('0x37')][_0x34de('0x39')]));_0x46d8eb[_0x34de('0x38')]=_0x46d8eb[_0x34de('0x38')][_0x34de('0x3a')]?_0x46d8eb[_0x34de('0x38')]:_0x4e8b80[_0x34de('0x34')];if(!_0x1df26a[_0x34de('0x37')]['hasOwnProperty']('nolimit')){_0x46d8eb[_0x34de('0x3c')]=qs['limit'](_0x1df26a[_0x34de('0x37')][_0x34de('0x3c')]);_0x46d8eb[_0x34de('0x24')]=qs[_0x34de('0x24')](_0x1df26a[_0x34de('0x37')][_0x34de('0x24')]);}_0x46d8eb[_0x34de('0x63')]=qs['sort'](_0x1df26a[_0x34de('0x37')][_0x34de('0x3d')]);_0x46d8eb[_0x34de('0x3e')]=qs[_0x34de('0x40')](_[_0x34de('0x3f')](_0x1df26a[_0x34de('0x37')],_0x4e8b80['filters']));_0x46d8eb[_0x34de('0x3e')]['ChatWebsiteId']=_0x57e488['id'];if(_0x1df26a[_0x34de('0x37')][_0x34de('0x41')]){_0x46d8eb[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x46d8eb[_0x34de('0x3e')],{'$or':_[_0x34de('0x35')](_0x46d8eb[_0x34de('0x38')],function(_0x8b6435){var _0x95d1cd={};_0x95d1cd[_0x8b6435]={'$like':'%'+_0x1df26a['query']['filter']+'%'};return _0x95d1cd;})});}_0x46d8eb=_[_0x34de('0x42')]({},_0x46d8eb,_0x1df26a[_0x34de('0x4c')]);return db['CannedAnswer']['count']({'where':_0x46d8eb[_0x34de('0x3e')]})[_0x34de('0x17')](function(_0x1cc4a5){_0x43a4dd[_0x34de('0x26')]=_0x1cc4a5;if(_0x1df26a[_0x34de('0x37')][_0x34de('0x44')]){_0x46d8eb['include']=[{'all':!![]}];}return db[_0x34de('0x61')][_0x34de('0x46')](_0x46d8eb);})[_0x34de('0x17')](function(_0x256e2a){_0x43a4dd[_0x34de('0x5d')]=_0x256e2a;return _0x43a4dd;});}})[_0x34de('0x17')](respondWithFilteredResult(_0x5766f9,_0x46d8eb))[_0x34de('0x47')](handleError(_0x5766f9,null));};exports[_0x34de('0x64')]=function(_0x5cce3f,_0x28e2e4){return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x5cce3f[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x28e2e4,null))[_0x34de('0x17')](function(_0x4b8c0c){if(_0x4b8c0c){return _0x4b8c0c[_0x34de('0x64')](_0x5cce3f[_0x34de('0x37')][_0x34de('0x5f')]);}})[_0x34de('0x17')](respondWithStatusCode(_0x28e2e4,null))[_0x34de('0x47')](handleError(_0x28e2e4,null));};exports['addLogo']=function(_0x573520,_0x16f67d){_0x573520[_0x34de('0x4e')][_0x34de('0x65')]=_0x573520[_0x34de('0x66')][_0x34de('0x67')];return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x573520[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x16f67d,null))[_0x34de('0x17')](saveUpdates(_0x573520[_0x34de('0x4e')],null))[_0x34de('0x17')](respondWithResult(_0x16f67d,null))[_0x34de('0x47')](handleError(_0x16f67d,null));};exports['addAvatar']=function(_0x5062a7,_0x2c0201){_0x5062a7['body']['agentAvatar']=_0x5062a7[_0x34de('0x66')][_0x34de('0x67')];return db['ChatWebsite']['find']({'where':{'id':_0x5062a7['params']['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x2c0201,null))['then'](saveUpdates(_0x5062a7[_0x34de('0x4e')],null))[_0x34de('0x17')](respondWithResult(_0x2c0201,null))[_0x34de('0x47')](handleError(_0x2c0201,null));};exports['addCustomerAvatar']=function(_0x44fd2c,_0x8c7e99){_0x44fd2c[_0x34de('0x4e')]['customerAvatar']=_0x44fd2c['file'][_0x34de('0x67')];return db['ChatWebsite'][_0x34de('0x54')]({'where':{'id':_0x44fd2c[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x8c7e99,null))[_0x34de('0x17')](saveUpdates(_0x44fd2c[_0x34de('0x4e')],null))['then'](respondWithResult(_0x8c7e99,null))[_0x34de('0x47')](handleError(_0x8c7e99,null));};exports[_0x34de('0x68')]=function(_0x587660,_0x1bd2c0){_0x587660[_0x34de('0x4e')][_0x34de('0x69')]=_0x587660[_0x34de('0x66')]['filename'];return db['ChatWebsite'][_0x34de('0x54')]({'where':{'id':_0x587660[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x1bd2c0,null))[_0x34de('0x17')](saveUpdates(_0x587660[_0x34de('0x4e')],null))[_0x34de('0x17')](respondWithResult(_0x1bd2c0,null))[_0x34de('0x47')](handleError(_0x1bd2c0,null));};exports['getLogo']=function(_0x18dae5,_0x4744eb){var _0x5128d0=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x6c'));var _0x2ee231={'where':{'id':_0x18dae5[_0x34de('0x49')]['id']},'attributes':['id',_0x34de('0x65')],'raw':!![]};var _0x1a948f=![];return require('../../config/license/util')[_0x34de('0x6d')]()[_0x34de('0x17')](function(_0xa06933){if(_0xa06933){_0x1a948f=_0xa06933[_0x34de('0x6e')];}})[_0x34de('0x17')](function(){return db[_0x34de('0x30')][_0x34de('0x54')](_0x2ee231);})[_0x34de('0x17')](handleEntityNotFound(_0x4744eb,null))[_0x34de('0x17')](function(_0x2f3c11){if(_0x2f3c11){if(!_[_0x34de('0x6f')](_0x2f3c11[_0x34de('0x65')])){if(fs[_0x34de('0x70')](path[_0x34de('0x6a')](config['root'],'server/files/images/logos/',_0x2f3c11[_0x34de('0x65')]))&&_0x1a948f){_0x5128d0=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x71'),_0x2f3c11[_0x34de('0x65')]);}}return _0x4744eb[_0x34de('0x72')](_0x5128d0);}})[_0x34de('0x47')](handleError(_0x4744eb,null));};exports[_0x34de('0x73')]=function(_0x33ac7f,_0x15b107){var _0x2dda03=path[_0x34de('0x6a')](config[_0x34de('0x6b')],'server/files/images/avatars/default_avatar.png');var _0x1603f8={'where':{'id':_0x33ac7f['params']['id']},'attributes':['id',_0x34de('0x74')],'raw':!![]};return db[_0x34de('0x30')][_0x34de('0x54')](_0x1603f8)[_0x34de('0x17')](handleEntityNotFound(_0x15b107,null))[_0x34de('0x17')](function(_0x22adab){if(_0x22adab){if(!_[_0x34de('0x6f')](_0x22adab[_0x34de('0x74')])){if(fs[_0x34de('0x70')](path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x75'),_0x22adab[_0x34de('0x74')]))){_0x2dda03=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x75'),_0x22adab[_0x34de('0x74')]);}}return _0x15b107[_0x34de('0x72')](_0x2dda03);}})['catch'](handleError(_0x15b107,null));};exports[_0x34de('0x76')]=function(_0x35aba9,_0x5b8be8){var _0x2f0e83=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x77'));var _0x27b452={'where':{'id':_0x35aba9[_0x34de('0x49')]['id']},'attributes':['id',_0x34de('0x78'),_0x34de('0x79')],'raw':!![]};return db[_0x34de('0x30')][_0x34de('0x54')](_0x27b452)['then'](handleEntityNotFound(_0x5b8be8,null))[_0x34de('0x17')](function(_0x2006ab){if(_0x2006ab){if(!_[_0x34de('0x6f')](_0x2006ab[_0x34de('0x78')])){if(fs['existsSync'](path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x75'),_0x2006ab['customerAvatar']))&&_0x2006ab[_0x34de('0x79')]){_0x2f0e83=path['join'](config[_0x34de('0x6b')],_0x34de('0x75'),_0x2006ab[_0x34de('0x78')]);}}return _0x5b8be8['download'](_0x2f0e83);}})[_0x34de('0x47')](handleError(_0x5b8be8,null));};exports[_0x34de('0x7a')]=function(_0x2797ae,_0x452d36){var _0x21a98d=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x7b'));var _0x3f18f3={'where':{'id':_0x2797ae[_0x34de('0x49')]['id']},'attributes':['id',_0x34de('0x69')],'raw':!![]};return db[_0x34de('0x30')][_0x34de('0x54')](_0x3f18f3)[_0x34de('0x17')](handleEntityNotFound(_0x452d36,null))[_0x34de('0x17')](function(_0x54491b){if(_0x54491b){if(!_[_0x34de('0x6f')](_0x54491b[_0x34de('0x69')])){if(fs['existsSync'](path['join'](config[_0x34de('0x6b')],_0x34de('0x75'),_0x54491b[_0x34de('0x69')]))){_0x21a98d=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0x75'),_0x54491b[_0x34de('0x69')]);}}return _0x452d36[_0x34de('0x72')](_0x21a98d);}})[_0x34de('0x47')](handleError(_0x452d36,null));};exports['notify']=function(_0x2e7dcc,_0x24e8ce){var _0x5260c6=require(_0x34de('0x7c'));var _0x4f5f0d=new _0x5260c6();var _0x376c55=_0x4f5f0d[_0x34de('0x7d')](_0x2e7dcc[_0x34de('0x7e')][_0x34de('0x7f')])[_0x34de('0x80')]();var _0x5d985b={'body':_0x2e7dcc['body'],'channel':_0x34de('0x81')};var _0x446745=[];var _0x5f1305=[];var _0x57edbf={};var _0x468387=![];return db['CmContact']['describe']()[_0x34de('0x17')](function(_0x4e7ba5){if(!_0x4e7ba5){throw new db['Sequelize']['ValidationError'](_0x34de('0x82'));}_0x446745=_[_0x34de('0x83')](_[_0x34de('0x4b')](_0x4e7ba5),[_0x34de('0x84'),_0x34de('0x85')]);_0x5f1305=_['difference'](_[_0x34de('0x4b')](_0x4e7ba5),[_0x34de('0x84'),_0x34de('0x85'),_0x34de('0x86'),_0x34de('0x87')]);if(_0x2e7dcc[_0x34de('0x4e')]['id']){delete _0x2e7dcc[_0x34de('0x4e')]['id'];}if(_[_0x34de('0x6f')](_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x88')])){throw new db[(_0x34de('0x89'))][(_0x34de('0x8a'))](_0x34de('0x8b'));}if(_[_0x34de('0x6f')](_0x2e7dcc[_0x34de('0x4e')]['body'])||_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x4e')]===''){throw new db[(_0x34de('0x89'))][(_0x34de('0x8a'))](_0x34de('0x8c'));}if(_[_0x34de('0x6f')](_0x2e7dcc['body'][_0x34de('0x8d')])){throw new db['Sequelize'][(_0x34de('0x8a'))](_0x34de('0x8e')+_0x5f1305);}if(!_['includes'](_0x5f1305,_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x8d')])){throw new db[(_0x34de('0x89'))][(_0x34de('0x8a'))](_0x34de('0x8f')+_0x5f1305);}_0x57edbf[_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x8d')]]=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x88')];})[_0x34de('0x17')](function(){return db[_0x34de('0x30')]['find']({'where':{'id':_0x2e7dcc[_0x34de('0x49')]['id']},'include':[{'model':db[_0x34de('0x90')],'as':_0x34de('0x91'),'include':[{'model':db[_0x34de('0x92')],'as':_0x34de('0x93'),'where':_0x57edbf,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x34de('0x94')],'as':_0x34de('0x95')}]});})['then'](handleEntityNotFound(_0x24e8ce,null))[_0x34de('0x17')](function(_0x5885d7){if(_0x5885d7&&_0x5885d7[_0x34de('0x91')]){_0x5d985b['account']=_0x5885d7;_0x5d985b[_0x34de('0x96')]=_0x5885d7['Applications'];_0x5d985b[_0x34de('0x97')]=_0x5885d7[_0x34de('0x91')];_0x5d985b['applications']=_['orderBy'](_0x5d985b[_0x34de('0x96')],[_0x34de('0x98')],['asc']);if(_0x5d985b[_0x34de('0x99')][_0x34de('0x95')]){delete _0x5d985b[_0x34de('0x99')][_0x34de('0x95')];}if(_0x5d985b[_0x34de('0x99')][_0x34de('0x91')]&&_0x5d985b[_0x34de('0x99')][_0x34de('0x91')]['Contacts'][_0x34de('0x3a')]){return _0x5d985b['account'][_0x34de('0x91')][_0x34de('0x93')][0x0];}var _0x58c414=_[_0x34de('0xe')](_0x2e7dcc[_0x34de('0x4e')],{'firstName':_0x2e7dcc[_0x34de('0x4e')]['from'],'ListId':_0x5885d7['ListId']});_0x58c414[_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x8d')]]=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x88')];return db['CmContact'][_0x34de('0x4d')](_0x58c414,{'fields':_0x446745,'raw':!![]});}})[_0x34de('0x17')](handleEntityNotFound(_0x24e8ce,null))['then'](function(_0x4910c6){_0x5d985b[_0x34de('0x9a')]=_0x4910c6;var _0x33b26a=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x9b')];if(_0x2e7dcc[_0x34de('0x7e')]['cf-connecting-ip']){_0x33b26a=_0x2e7dcc[_0x34de('0x7e')][_0x34de('0x9c')];}else if(_0x2e7dcc[_0x34de('0x7e')][_0x34de('0x9d')]){_0x33b26a=_[_0x34de('0x9e')](_0x2e7dcc[_0x34de('0x7e')][_0x34de('0x9d')][_0x34de('0x9f')](','));}if(_0x4910c6){var _0x1f4e81={'ContactId':_0x4910c6['id'],'ChatWebsiteId':_0x2e7dcc['params']['id'],'from':(_0x4910c6['firstName']||'')+'\x20'+(_0x4910c6['lastName']||''),'customerIp':_0x33b26a,'customerPort':_0x2e7dcc[_0x34de('0x7e')][_0x34de('0xa0')]?_0x2e7dcc[_0x34de('0x7e')][_0x34de('0xa0')]:null,'referer':_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xa1')],'browserName':_0x376c55[_0x34de('0xa2')][_0x34de('0x2e')]&&_0x376c55[_0x34de('0xa2')]['version']?util[_0x34de('0xa3')]('%s\x20%s',_0x376c55['browser'][_0x34de('0x2e')],_0x376c55[_0x34de('0xa2')][_0x34de('0xa4')]):_0x34de('0xa5'),'browserVersion':_0x376c55['browser'][_0x34de('0xa4')]||_0x34de('0xa5'),'osName':util['format'](_0x34de('0xa6'),_0x376c55['os'][_0x34de('0x2e')],_0x376c55['os'][_0x34de('0xa4')]),'osVersion':_0x376c55['os'][_0x34de('0xa4')],'deviceModel':_0x376c55[_0x34de('0xa7')][_0x34de('0x34')]&&_0x376c55[_0x34de('0xa7')][_0x34de('0xa8')]?util[_0x34de('0xa3')]('%s\x20%s\x20%s',_0x376c55[_0x34de('0xa7')][_0x34de('0x34')],_0x376c55[_0x34de('0xa7')][_0x34de('0xa8')],_0x376c55[_0x34de('0xa7')]['type']):null,'deviceVendor':_0x376c55[_0x34de('0xa7')]['vendor'],'deviceType':_0x376c55['device'][_0x34de('0x33')],'formData':JSON[_0x34de('0x1c')](_0x2e7dcc['body'])};var _0x4d98ed={'ChatWebsiteId':_0x2e7dcc[_0x34de('0x49')]['id'],'closed':![]};if(_0x2e7dcc['body']['threadId']){_0x4d98ed[_0x34de('0xa9')]=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xa9')];return db[_0x34de('0xaa')][_0x34de('0x54')]({'where':_0x4d98ed})['then'](function(_0x4d288b){if(_0x4d288b){return[_0x4d288b,![]];}_0x1f4e81[_0x34de('0xa9')]=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xa9')];_0x1f4e81[_0x34de('0xab')]=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xab')];return db['ChatInteraction'][_0x34de('0x4d')](_0x1f4e81)['then'](function(_0x29f589){return[_0x29f589,!![]];});});}_0x4d98ed[_0x34de('0xac')]=_0x4910c6['id'];if(_0x2e7dcc['body'][_0x34de('0xad')]&&_0x2e7dcc['body']['interaction']['id']){_0x4d98ed['id']=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xad')]['id'];return db[_0x34de('0xaa')][_0x34de('0x54')]({'where':_0x4d98ed})['then'](function(_0x444076){if(_0x444076){return[_0x444076,![]];}return db[_0x34de('0xaa')][_0x34de('0x4d')](_0x1f4e81)[_0x34de('0x17')](function(_0x332531){return[_0x332531,!![]];});});}return db['ChatInteraction'][_0x34de('0x4d')](_0x1f4e81)[_0x34de('0x17')](function(_0x16d573){return[_0x16d573,!![]];});}})[_0x34de('0xae')](function(_0x3767ae,_0x4e5d4c){if(_0x3767ae){_0x468387=_0x4e5d4c;if(!_0x4e5d4c){var _0x4ea557={'from':(_0x5d985b[_0x34de('0x9a')][_0x34de('0xaf')]||'')+'\x20'+(_0x5d985b['contact']['lastName']||'')};if(_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xa9')]&&_0x2e7dcc['body'][_0x34de('0xb0')]&&_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xa9')]!=_0x2e7dcc['body'][_0x34de('0xb0')]){_0x4ea557[_0x34de('0xa9')]=_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xb0')];}return _0x3767ae['update'](_0x4ea557);}else{return _0x3767ae;}}})[_0x34de('0x17')](function(_0x25b217){_0x5d985b['interaction']=_0x25b217[_0x34de('0x4f')]({'plain':!![]});_0x5d985b[_0x34de('0xad')][_0x34de('0xb1')]=_0x468387;if(_0x5d985b[_0x34de('0xad')][_0x34de('0xb1')]){if(_0x5d985b[_0x34de('0x99')][_0x34de('0xb2')]){_0x5d985b[_0x34de('0x96')][_0x34de('0xb3')]({'id':0x0,'priority':_0x5d985b['applications'][_0x34de('0x3a')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x34de('0xb4')});}}return db['ChatMessage'][_0x34de('0x4d')]({'body':_0x2e7dcc[_0x34de('0x4e')][_0x34de('0x4e')],'ChatWebsiteId':_0x2e7dcc[_0x34de('0x49')]['id'],'ChatInteractionId':_0x25b217['id'],'direction':'in','ContactId':_0x5d985b[_0x34de('0x9a')]['id'],'AttachmentId':_0x2e7dcc[_0x34de('0x4e')][_0x34de('0xb5')]});})['then'](function(_0x147f9f){_0x5d985b[_0x34de('0x1f')]=_0x147f9f;if(_0x5d985b[_0x34de('0xad')][_0x34de('0xb6')]){return db[_0x34de('0xb7')][_0x34de('0x54')]({'attributes':['id','name'],'where':{'id':_0x5d985b['interaction'][_0x34de('0xb6')]}})[_0x34de('0x17')](function(_0x163065){if(_0x163065){_0x5d985b[_0x34de('0x96')][_0x34de('0xb8')]({'id':0x0,'priority':0x0,'app':_0x34de('0xb9'),'appdata':_0x163065['name']+','+(_0x5d985b[_0x34de('0x99')][_0x34de('0xba')]||0xa),'interval':_0x34de('0xb4')});_0x5d985b[_0x34de('0xbb')]=!![];}return respondWithRpcPromise('Start',_0x34de('0xbc'),_0x5d985b);});}return respondWithRpcPromise(_0x34de('0xbd'),_0x34de('0xbc'),_0x5d985b);})['then'](function(_0x52da09){respondWithRpcPromise('EventManager',_0x34de('0xbe'),{'event':_0x34de('0xbf'),'message':_0x52da09},client9002);return _0x52da09;})[_0x34de('0x17')](respondWithResult(_0x24e8ce,null))[_0x34de('0x47')](handleError(_0x24e8ce,null));};exports[_0x34de('0xc0')]=function(_0x5b6f6c,_0x15e637){var _0x2ff3e0,_0x540042,_0x4dcfbe;var _0x5807b5=[];var _0x1ef402={};var _0x1ffb67=_0x5b6f6c['files']||[];var _0x433564=[];var _0x53fd4a;return db[_0x34de('0x92')][_0x34de('0xc1')]()[_0x34de('0x17')](function(_0x3921f9){if(!_0x3921f9){throw new db[(_0x34de('0x89'))][(_0x34de('0x8a'))](_0x34de('0x82'));}_0x5807b5=_[_0x34de('0x83')](_['keys'](_0x3921f9),['createdAt',_0x34de('0x85'),'CompanyId','ListId']);if(_0x5b6f6c[_0x34de('0x4e')]['id']){delete _0x5b6f6c[_0x34de('0x4e')]['id'];}if(_['isNil'](_0x5b6f6c[_0x34de('0x4e')][_0x34de('0x88')])){throw _0x15e637['status'](0x1f4)[_0x34de('0xc2')](new db[(_0x34de('0x89'))][(_0x34de('0x8a'))]('from\x20is\x20mandatory'));}if(_[_0x34de('0x6f')](_0x5b6f6c[_0x34de('0x4e')][_0x34de('0x4e')])||_0x5b6f6c[_0x34de('0x4e')][_0x34de('0x4e')]===''){throw _0x15e637[_0x34de('0x22')](0x1f4)['send'](new db[(_0x34de('0x89'))]['ValidationError'](_0x34de('0x8c')));}if(_[_0x34de('0x6f')](_0x5b6f6c['body'][_0x34de('0xc3')])){throw _0x15e637[_0x34de('0x22')](0x1f4)[_0x34de('0xc2')](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5807b5));}if(!_[_0x34de('0xc4')](_0x5807b5,_0x5b6f6c['body'][_0x34de('0xc3')])){throw _0x15e637[_0x34de('0x22')](0x1f4)[_0x34de('0xc2')](new db[(_0x34de('0x89'))][(_0x34de('0x8a'))](_0x34de('0xc5')+_0x5807b5));}_0x1ef402[_0x5b6f6c[_0x34de('0x4e')][_0x34de('0xc3')]]=_0x5b6f6c[_0x34de('0x4e')]['from'];})[_0x34de('0x17')](function(){return db[_0x34de('0x30')]['find']({'where':{'id':_0x5b6f6c[_0x34de('0x49')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x34de('0xc6')],'as':'MailAccount'}]});})[_0x34de('0x17')](handleEntityNotFound(_0x15e637,null))[_0x34de('0x17')](function(_0x3e867f){if(_0x3e867f&&_0x3e867f[_0x34de('0x91')]){_0x540042=_0x3e867f;var _0x2973a3=_[_0x34de('0xe')](_0x5b6f6c[_0x34de('0x4e')],{'firstName':_0x5b6f6c[_0x34de('0x4e')][_0x34de('0x88')],'phone':_0x5b6f6c[_0x34de('0x4e')][_0x34de('0x88')],'ListId':_0x3e867f['ListId']});_0x2973a3[_0x5b6f6c[_0x34de('0x4e')][_0x34de('0xc3')]]=_0x5b6f6c[_0x34de('0x4e')]['from'];return db[_0x34de('0x92')][_0x34de('0xc7')]({'where':_0x1ef402,'defaults':_0x2973a3});}})['spread'](function(_0x11d231){if(_0x11d231){_0x4dcfbe=_0x11d231;var _0x539e0a=fs[_0x34de('0xc8')](path[_0x34de('0x6a')](config['root'],_0x34de('0xc9')),_0x34de('0xca'));var _0x40358c=ejs[_0x34de('0xcb')](_0x539e0a,{'body':_[_0x34de('0xcc')](_0x5b6f6c['body'][_0x34de('0x4e')]),'bodyTitle':_0x540042[_0x34de('0xcd')]});return db['ChatOfflineMessage'][_0x34de('0x4d')]({'body':_0x40358c,'plainBody':htmlToText[_0x34de('0xce')](_0x40358c),'ContactId':_0x11d231['id'],'ChatWebsiteId':_0x540042['id']});}})[_0x34de('0x17')](function(_0x3fd1e5){_0x53fd4a=_0x3fd1e5;if(_0x1ffb67['length']){var _0x376f97=_0x1ffb67[_0x34de('0x35')](function(_0x4a79fe){return{'name':_0x4a79fe[_0x34de('0xcf')],'basename':_0x4a79fe[_0x34de('0x67')],'type':_0x4a79fe[_0x34de('0xd0')],'ChatOfflineMessageId':_0x3fd1e5['id']};});_0x433564=_0x376f97[_0x34de('0x35')](_0x445030=>{var _0x1be9ec={'filename':_0x445030[_0x34de('0x2e')],'path':path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0xd1'),_0x34de('0xd2'),'attachments',_0x34de('0xd3'),_0x445030[_0x34de('0xd4')])};return _0x1be9ec;});if(!_0x540042[_0x34de('0xd5')]){return db[_0x34de('0xd6')]['transaction'](function(_0x10c574){return db[_0x34de('0xd7')][_0x34de('0xd8')](_0x376f97,{'transaction':_0x10c574});});}}})[_0x34de('0x17')](function(){if(_0x53fd4a){_0x2ff3e0=_0x53fd4a;return db[_0x34de('0xc6')][_0x34de('0x5b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x34de('0xd9'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x34de('0xda'),'raw':!![]}]}]});}})[_0x34de('0x17')](function(_0x159d1b){if(_0x159d1b&&_0x159d1b[_0x34de('0xd9')]&&_0x540042[_0x34de('0xdb')]&&_0x540042[_0x34de('0xdc')]){var _0x206755=_0x159d1b['getSmtpOptions']();return respondWithRpcPromise(_0x34de('0xdd'),_0x34de('0xde'),{'account':_0x206755,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x159d1b[_0x34de('0x2e')],_0x159d1b['email']||_0x159d1b[_0x34de('0xd9')][_0x34de('0x52')]),'to':_0x540042[_0x34de('0xdc')],'subject':_0x540042['offlineMessageSubject'],'html':_0x2ff3e0['body'],'attachments':_0x433564}},client9003)[_0x34de('0x17')](function(){return _0x2ff3e0;})[_0x34de('0x47')](function(_0x182738){logger['error'](_0x182738);});}})[_0x34de('0x17')](function(){if(_0x540042&&_0x540042[_0x34de('0xd5')]&&_0x540042[_0x34de('0xdf')]){var _0x20c90a=[];if(_0x1ffb67[_0x34de('0x3a')]){_0x20c90a=_0x1ffb67[_0x34de('0x35')](function(_0x31bc38){return{'name':_0x31bc38[_0x34de('0xcf')],'basename':_0x31bc38[_0x34de('0x67')],'type':_0x31bc38['mimetype'],'ChatOfflineMessageId':_0x53fd4a['id']};});}var _0x4a2441;if(!_[_0x34de('0x6f')](_0x540042[_0x34de('0xe0')])){var _0x3fa257=_[_0x34de('0x35')](_0x5b6f6c['body'],function(_0xf9873a){return _0xf9873a;});var _0x4c4e9f=_[_0x34de('0xe1')](_0x3fa257)[0x0];var _0x37c5c2=_[_0x34de('0xe2')](_0x4c4e9f,function(_0x3bd154){return _0x3bd154;});_0x4a2441=_0x37c5c2[0x1][_0x540042['subjectOffline']];}var _0x1b165a={'from':_0x4dcfbe[_0x34de('0xe3')],'firstName':_0x4dcfbe[_0x34de('0xaf')],'lastName':_0x4dcfbe['lastName'],'mapKey':_0x34de('0xe3'),'message':{'from':_0x4dcfbe[_0x34de('0xe3')],'to':_0x540042[_0x34de('0xc6')][_0x34de('0xe3')],'cc':'','subject':_[_0x34de('0x6f')](_0x4a2441)?_0x540042[_0x34de('0xe4')]:_0x4a2441,'messageId':'','sentAt':new Date(),'attach':_0x20c90a['length'],'attachments':_0x20c90a,'originChannel':_0x34de('0xe5'),'ChatWebsiteId':_0x540042['id'],'ChatOfflineMessageId':_0x2ff3e0['id'],'originTo':_0x540042[_0x34de('0xc6')][_0x34de('0xe3')]},'body':_0x2ff3e0[_0x34de('0x4e')]};var _0x4f2e03={'account':{'id':_0x540042[_0x34de('0xdf')]},'body':_0x1b165a,'log':_0x34de('0xe6')};return respondWithRpcPromise('NotifyMailAccount',_0x34de('0xe7'),_0x4f2e03,client9001)[_0x34de('0x17')](function(){return _0x2ff3e0;})[_0x34de('0x47')](function(_0x5e4e3d){logger['error'](_0x5e4e3d);});}return;})[_0x34de('0x17')](function(){if(_0x2ff3e0){return _0x2ff3e0;}})['then'](respondWithResult(_0x15e637,null))[_0x34de('0x47')](function(_0x31f736){logger[_0x34de('0x1d')](_0x34de('0x47'),_0x31f736);for(var _0x1709c5 of _0x1ffb67){var _0x10e17a=path[_0x34de('0x6a')](config[_0x34de('0x6b')],_0x34de('0xd1'),'files',_0x34de('0xe8'),_0x34de('0xd3'),_0x1709c5[_0x34de('0x67')]);fs_extra[_0x34de('0xe9')](_0x10e17a)['catch'](function(_0x2b7879){logger[_0x34de('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x10e17a,_0x2b7879);});}});};exports[_0x34de('0xea')]=function(_0xef28fe,_0x55f39a){return db[_0x34de('0xaa')]['find']({'where':{'id':_0xef28fe[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x55f39a,null))[_0x34de('0x17')](function(_0x2f738e){if(_0x2f738e){return _0x2f738e[_0x34de('0xea')](_0xef28fe['body'][_0x34de('0x5f')],_[_0x34de('0xeb')](_0xef28fe[_0x34de('0x4e')],[_0x34de('0x5f'),'id'])||{});}})[_0x34de('0x17')](respondWithResult(_0x55f39a,null))[_0x34de('0x47')](handleError(_0x55f39a,null));};exports['getInteractions']=function(_0x272725,_0x374ea4){var _0x138f25={'raw':![],'where':{}};var _0x44b6e9={};var _0x445ed5={'count':0x0,'rows':[]};return db[_0x34de('0x30')][_0x34de('0x5b')]({'where':{'id':_0x272725[_0x34de('0x49')]['id']}})['then'](handleEntityNotFound(_0x374ea4,null))[_0x34de('0x17')](function(_0x3b30e7){if(_0x3b30e7){_0x44b6e9[_0x34de('0x34')]=_[_0x34de('0x4b')](db[_0x34de('0xaa')][_0x34de('0x31')]);_0x44b6e9[_0x34de('0x37')]=_[_0x34de('0x4b')](_0x272725['query']);_0x44b6e9['filters']=_[_0x34de('0x36')](_0x44b6e9[_0x34de('0x34')],_0x44b6e9['query']);_0x138f25[_0x34de('0x38')]=_[_0x34de('0x36')](_0x44b6e9[_0x34de('0x34')],qs[_0x34de('0x39')](_0x272725[_0x34de('0x37')][_0x34de('0x39')]));_0x138f25['attributes']=_0x138f25[_0x34de('0x38')][_0x34de('0x3a')]?_0x138f25[_0x34de('0x38')]:_0x44b6e9['model'];if(!_0x272725[_0x34de('0x37')][_0x34de('0x3b')](_0x34de('0x5c'))){_0x138f25[_0x34de('0x3c')]=qs['limit'](_0x272725['query'][_0x34de('0x3c')]);_0x138f25[_0x34de('0x24')]=qs[_0x34de('0x24')](_0x272725['query'][_0x34de('0x24')]);}_0x138f25[_0x34de('0x63')]=qs[_0x34de('0x3d')](_0x272725['query'][_0x34de('0x3d')]);_0x138f25[_0x34de('0x3e')]=qs[_0x34de('0x40')](_[_0x34de('0x3f')](_0x272725['query'],_0x44b6e9[_0x34de('0x40')]));_0x138f25[_0x34de('0x3e')][_0x34de('0x59')]=_0x3b30e7['id'];if(_0x272725[_0x34de('0x37')][_0x34de('0x41')]){_0x138f25[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x138f25[_0x34de('0x3e')],{'$or':_[_0x34de('0x35')](_0x138f25[_0x34de('0x38')],function(_0x248f55){var _0x3e1d25={};_0x3e1d25[_0x248f55]={'$like':'%'+_0x272725[_0x34de('0x37')]['filter']+'%'};return _0x3e1d25;})});}_0x138f25=_[_0x34de('0x42')]({},_0x138f25,_0x272725[_0x34de('0x4c')]);return db[_0x34de('0xaa')][_0x34de('0x26')]({'where':_0x138f25[_0x34de('0x3e')]})[_0x34de('0x17')](function(_0x186c99){_0x445ed5['count']=_0x186c99;if(_0x272725['query']['includeAll']){_0x138f25[_0x34de('0x45')]=[{'model':db[_0x34de('0x92')],'as':_0x34de('0xec'),'required':![]},{'model':db[_0x34de('0xb7')],'as':_0x34de('0xed'),'attributes':[_0x34de('0x2e'),_0x34de('0xee'),_0x34de('0xef')],'required':![]},{'model':db[_0x34de('0xf0')],'as':_0x34de('0xf1'),'attributes':['id',_0x34de('0x2e'),'color'],'where':_0x272725[_0x34de('0x37')]['tag']?{'id':_0x272725['query'][_0x34de('0xf2')]}:undefined,'required':_0x272725[_0x34de('0x37')]['tag']?!![]:![]}];}return db[_0x34de('0xaa')][_0x34de('0x46')](_0x138f25);})[_0x34de('0x17')](function(_0x4b4544){_0x445ed5[_0x34de('0x5d')]=_0x4b4544;return _0x445ed5;});}})['then'](respondWithFilteredResult(_0x374ea4,_0x138f25))['catch'](handleError(_0x374ea4,null));};function iftimePromise(_0x872c7,_0x3a174e){return respondWithRpcPromise(_0x34de('0xf3'),_0x34de('0xf4'),{'command':_0x3a174e[_0x34de('0xf5')]?util[_0x34de('0xa3')](_0x34de('0xf6'),_0x872c7['interval'],_0x3a174e['timezone']):util[_0x34de('0xa3')](_0x34de('0xf7'),_0x872c7[_0x34de('0xf8')])},client9002)['then'](function(_0x528754){var _0x2db976=_0x528754&&_0x528754[_0x34de('0xf9')](_0x34de('0xfa'))>=0x0?!![]:![];logger[_0x34de('0x18')](_0x34de('0xfb'),_0x3a174e['id'],_0x872c7['id'],_0x872c7[_0x34de('0xf8')],_0x2db976?_0x34de('0xfc'):'OFFLINE',_0x3a174e['timezone']?_0x3a174e['timezone']:_0x34de('0xfd'));return _0x2db976;})[_0x34de('0x47')](function(_0x44b122){logger[_0x34de('0x1d')](_0x34de('0xfb'),_0x3a174e['id'],_0x872c7['id'],_0x872c7[_0x34de('0xf8')],util[_0x34de('0xfe')](_0x44b122,{'showHidden':![],'depth':null}),_0x3a174e[_0x34de('0xf5')]?_0x3a174e[_0x34de('0xf5')]:'No\x20timezone');return![];});}exports[_0x34de('0xf4')]=function(_0x1cc868,_0x40023f){var _0x294fe0=0x0;var _0x4871fc=0x0;var _0x465279=![];var _0x46d917;var _0x4bab4e;return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x1cc868[_0x34de('0x49')]['id']},'include':[{'model':db[_0x34de('0xff')],'as':_0x34de('0xff'),'include':[{'model':db[_0x34de('0xff')],'as':'Intervals','attributes':['id',_0x34de('0xf8')],'raw':!![]}]}]})[_0x34de('0x17')](handleEntityNotFound(_0x40023f,null))[_0x34de('0x17')](function(_0xc336fa){if(_0xc336fa){_0x46d917=_0xc336fa;return _0xc336fa['getProactiveActions']({'raw':!![]});}})['then'](function(_0x23ef7f){if(_0x46d917){if(_0x23ef7f){_0x4bab4e=_0x23ef7f;}}return require(_0x34de('0x100'))[_0x34de('0x6d')]();})[_0x34de('0x17')](function(_0x3426b2){if(_0x3426b2){_0x4871fc=_0x3426b2[_0x34de('0x101')];_0x465279=_0x3426b2['custom'];}})[_0x34de('0x17')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0xead287){_0x294fe0=_0xead287;if(_0x4871fc&&_0xead287>_0x4871fc){return db[_0x34de('0x102')][_0x34de('0x5b')]({'where':{'id':0x1}})[_0x34de('0x17')](function(_0x151154){if(_0x151154){_0x151154[_0x34de('0x103')](_0x34de('0x104'));}});}})['then'](function(){if(_0x46d917['Interval']&&_0x46d917[_0x34de('0xff')][_0x34de('0x105')]){var _0x2d7387=[];for(var _0x157c04=0x0;_0x157c04<_0x46d917[_0x34de('0xff')][_0x34de('0x105')][_0x34de('0x3a')];_0x157c04++){var _0x4e0732=_0x46d917[_0x34de('0xff')][_0x34de('0x105')][_0x157c04][_0x34de('0x4f')]({'plain':!![]});_0x2d7387[_0x34de('0xb3')](iftimePromise(_0x4e0732,_0x46d917));}return BPromise[_0x34de('0x106')](_0x2d7387)[_0x34de('0x17')](function(_0x5077f3){return _[_0x34de('0x107')](_0x5077f3);});}else{return!![];}})[_0x34de('0x17')](function(_0x3373b0){var _0x5ae0d2=fs[_0x34de('0xc8')](path['join'](config[_0x34de('0x6b')],_0x34de('0x108')),'utf8');var _0x16d942={'remote':_0x46d917[_0x34de('0x109')],'query':querystring['stringify'](_['merge'](_0x46d917['get']({'plain':!![]}),{'customerIp':_0x1cc868[_0x34de('0x7e')][_0x34de('0x9d')]||_0x1cc868[_0x34de('0x7e')][_0x34de('0x10a')]||_0x1cc868[_0x34de('0x10b')][_0x34de('0x10c')]||_0x1cc868['ip'],'referer':_0x1cc868[_0x34de('0x7e')][_0x34de('0xa1')],'openedInteractions':_0x294fe0,'maxInteractions':_0x4871fc,'virtual':_0x465279[_0x34de('0x101')],'online':_0x3373b0,'custom':_0x465279}))['replace'](/'/g,'\x5c\x27')};_0x40023f[_0x34de('0xc2')](ejs[_0x34de('0xcb')](Mustache['render'](_0x5ae0d2,_0x16d942),{'proactiveActions':_0x4bab4e,'alignment':_0x46d917[_0x34de('0x10d')],'verticalAlignment':_0x46d917[_0x34de('0x10e')],'div_color':_0x46d917[_0x34de('0x10f')],'labelText':_0x46d917[_0x34de('0x110')],'text_color':_0x46d917[_0x34de('0x111')],'text_button_color':_0x46d917[_0x34de('0x112')],'button_color':_0x46d917['color_button'],'background_color':_0x46d917['backgroundColor'],'hideWhenOffline':_0x46d917[_0x34de('0x113')],'interval':_0x46d917[_0x34de('0x114')]}));})[_0x34de('0x47')](handleError(_0x40023f,null));};exports[_0x34de('0x115')]=function(_0xff9f9a,_0xbea686){var _0x2fe698=_0xff9f9a['params']['id'];var _0x450acd=_0xff9f9a[_0x34de('0x4e')];var _0x4a3398=0xc8;var _0xbb2677=null;return db[_0x34de('0xd6')]['transaction']({'isolationLevel':db[_0x34de('0xd6')]['Transaction']['ISOLATION_LEVELS'][_0x34de('0x116')]},function(_0x1b597c){return db[_0x34de('0x30')]['findOne']({'where':{'id':_0x2fe698},'transaction':_0x1b597c})[_0x34de('0x17')](function(_0x42076a){if(_0x42076a){return db['ChatApplication'][_0x34de('0x2b')]({'where':{'ChatWebsiteId':_0x2fe698},'transaction':_0x1b597c})['then'](function(){var _0x26c627=_[_0x34de('0x35')](_0x450acd,function(_0x5f06cd){_0x5f06cd[_0x34de('0x59')]=_0x2fe698;return _0x5f06cd;});return db[_0x34de('0x94')]['bulkCreate'](_0x26c627,{'transaction':_0x1b597c});});}else{_0x4a3398=0x194;_0xbb2677=[];}});})[_0x34de('0x17')](function(){if(_0x4a3398!==0x194){return db[_0x34de('0x94')][_0x34de('0x117')]({'where':{'ChatWebsiteId':_0x2fe698},'order':_0x34de('0x98')})['then'](function(_0x170860){_0xbb2677=_0x170860;});}})[_0x34de('0x47')](function(_0xf61cbb){_0x4a3398=0x1f4;logger['error'](_0xf61cbb['stack']);if(_0xf61cbb[_0x34de('0x2e')]){delete _0xf61cbb['name'];}_0xbb2677=_0xf61cbb;})[_0x34de('0x118')](function(){if(_0xbb2677===null){_0xbea686[_0x34de('0x21')](_0x4a3398);}else{if(_0x4a3398===0x1f4){_0xbea686[_0x34de('0x22')](_0x4a3398)[_0x34de('0xc2')](_0xbb2677);}else{_0xbea686['status'](_0x4a3398)[_0x34de('0x23')](_0xbb2677);}}});};exports[_0x34de('0x119')]=function(_0x248331,_0x2e0181){var _0x43ca03={};var _0x1fe158={};var _0xec40e0;var _0xdb981a;return db[_0x34de('0x30')][_0x34de('0x5b')]({'where':{'id':_0x248331['params']['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x2e0181,null))['then'](function(_0x4e622a){if(_0x4e622a){_0xec40e0=_0x4e622a;_0x1fe158[_0x34de('0x34')]=_['keys'](db['ChatApplication'][_0x34de('0x31')]);_0x1fe158[_0x34de('0x37')]=_[_0x34de('0x4b')](_0x248331[_0x34de('0x37')]);_0x1fe158[_0x34de('0x40')]=_[_0x34de('0x36')](_0x1fe158[_0x34de('0x34')],_0x1fe158[_0x34de('0x37')]);_0x43ca03['attributes']=_[_0x34de('0x36')](_0x1fe158[_0x34de('0x34')],qs[_0x34de('0x39')](_0x248331['query'][_0x34de('0x39')]));_0x43ca03[_0x34de('0x38')]=_0x43ca03[_0x34de('0x38')][_0x34de('0x3a')]?_0x43ca03['attributes']:_0x1fe158[_0x34de('0x34')];_0x43ca03['order']=qs[_0x34de('0x3d')](_0x248331[_0x34de('0x37')][_0x34de('0x3d')]);_0x43ca03[_0x34de('0x3e')]=qs[_0x34de('0x40')](_[_0x34de('0x3f')](_0x248331[_0x34de('0x37')],_0x1fe158[_0x34de('0x40')]));if(_0x248331['query']['filter']){_0x43ca03[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x43ca03[_0x34de('0x3e')],{'$or':_[_0x34de('0x35')](_0x43ca03[_0x34de('0x38')],function(_0x72a86e){var _0x206ba9={};_0x206ba9[_0x72a86e]={'$like':'%'+_0x248331[_0x34de('0x37')]['filter']+'%'};return _0x206ba9;})});}_0x43ca03=_[_0x34de('0x42')]({},_0x43ca03,_0x248331[_0x34de('0x4c')]);return _0xec40e0[_0x34de('0x119')](_0x43ca03);}})['then'](function(_0x16a281){if(_0x16a281){_0xdb981a=_0x16a281['length'];if(!_0x248331[_0x34de('0x37')]['hasOwnProperty']('nolimit')){_0x43ca03['limit']=qs[_0x34de('0x3c')](_0x248331[_0x34de('0x37')][_0x34de('0x3c')]);_0x43ca03[_0x34de('0x24')]=qs[_0x34de('0x24')](_0x248331[_0x34de('0x37')][_0x34de('0x24')]);}return _0xec40e0[_0x34de('0x119')](_0x43ca03);}})[_0x34de('0x17')](function(_0x49e5f8){if(_0x49e5f8){return _0x49e5f8?{'count':_0xdb981a,'rows':_0x49e5f8}:null;}})[_0x34de('0x17')](respondWithResult(_0x2e0181,null))['catch'](handleError(_0x2e0181,null));};exports[_0x34de('0x11a')]=function(_0x50c8f2,_0x578b62){return db[_0x34de('0x11b')][_0x34de('0x54')]({'where':{'id':_0x50c8f2[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x578b62,null))[_0x34de('0x17')](function(_0x84139a){if(_0x84139a){return _0x84139a['addProactiveActions'](_0x50c8f2['body'][_0x34de('0x5f')],_['omit'](_0x50c8f2[_0x34de('0x4e')],['ids','id'])||{});}})[_0x34de('0x17')](respondWithResult(_0x578b62,null))[_0x34de('0x47')](handleError(_0x578b62,null));};exports['getProactiveActions']=function(_0x42f781,_0x63f62a){var _0x59a407={};var _0x530d8c={};var _0x36b975;var _0x4ae312;return db[_0x34de('0x30')][_0x34de('0x5b')]({'where':{'id':_0x42f781['params']['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x63f62a,null))[_0x34de('0x17')](function(_0x3bdecd){if(_0x3bdecd){_0x36b975=_0x3bdecd;_0x530d8c['model']=_['keys'](db[_0x34de('0x11c')]['rawAttributes']);_0x530d8c[_0x34de('0x37')]=_['keys'](_0x42f781[_0x34de('0x37')]);_0x530d8c[_0x34de('0x40')]=_['intersection'](_0x530d8c[_0x34de('0x34')],_0x530d8c[_0x34de('0x37')]);_0x59a407[_0x34de('0x38')]=_[_0x34de('0x36')](_0x530d8c[_0x34de('0x34')],qs[_0x34de('0x39')](_0x42f781[_0x34de('0x37')][_0x34de('0x39')]));_0x59a407['attributes']=_0x59a407[_0x34de('0x38')][_0x34de('0x3a')]?_0x59a407[_0x34de('0x38')]:_0x530d8c[_0x34de('0x34')];_0x59a407[_0x34de('0x63')]=qs[_0x34de('0x3d')](_0x42f781['query'][_0x34de('0x3d')]);_0x59a407[_0x34de('0x3e')]=qs[_0x34de('0x40')](_[_0x34de('0x3f')](_0x42f781['query'],_0x530d8c[_0x34de('0x40')]));if(_0x42f781[_0x34de('0x37')][_0x34de('0x41')]){_0x59a407[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x59a407['where'],{'$or':_['map'](_0x59a407[_0x34de('0x38')],function(_0x53569a){var _0xc47fb8={};_0xc47fb8[_0x53569a]={'$like':'%'+_0x42f781[_0x34de('0x37')]['filter']+'%'};return _0xc47fb8;})});}_0x59a407=_[_0x34de('0x42')]({},_0x59a407,_0x42f781['options']);return _0x36b975[_0x34de('0x11d')](_0x59a407);}})[_0x34de('0x17')](function(_0x371b48){if(_0x371b48){_0x4ae312=_0x371b48[_0x34de('0x3a')];if(!_0x42f781[_0x34de('0x37')][_0x34de('0x3b')]('nolimit')){_0x59a407['limit']=qs[_0x34de('0x3c')](_0x42f781[_0x34de('0x37')][_0x34de('0x3c')]);_0x59a407[_0x34de('0x24')]=qs[_0x34de('0x24')](_0x42f781['query'][_0x34de('0x24')]);}return _0x36b975[_0x34de('0x11d')](_0x59a407);}})[_0x34de('0x17')](function(_0x54774c){if(_0x54774c){return _0x54774c?{'count':_0x4ae312,'rows':_0x54774c}:null;}})['then'](respondWithResult(_0x63f62a,null))[_0x34de('0x47')](handleError(_0x63f62a,null));};exports[_0x34de('0x11e')]=function(_0x146bb8,_0x221ea5){var _0x17c5ed=_0x146bb8[_0x34de('0x37')]['online']===_0x34de('0x11f')?_0x34de('0x120'):_0x34de('0x121');return db[_0x34de('0x30')][_0x34de('0x54')]({'attributes':['id',_0x17c5ed],'where':{'id':_0x146bb8[_0x34de('0x49')]['id']}})['then'](handleEntityNotFound(_0x221ea5,null))[_0x34de('0x17')](function(_0x58df67){if(_0x58df67){var _0x1ce757=_0x58df67[_0x17c5ed];var _0x2cffff=_0x1ce757&&_0x1ce757[_0x34de('0x122')]?_0x1ce757[_0x34de('0x122')]:[];_0x221ea5[_0x34de('0xc2')]({'fromKey':_[_0x34de('0x6f')](_0x1ce757[_0x34de('0x123')])?undefined:_0x1ce757[_0x34de('0x123')],'count':_0x2cffff[_0x34de('0x3a')],'rows':_0x2cffff});}})[_0x34de('0x47')](handleError(_0x221ea5,null));};exports[_0x34de('0x124')]=function(_0x11dbcf,_0xeedcad){var _0x319fbd={'raw':![],'where':{}};var _0x44b97a={};var _0x92860d={'count':0x0,'rows':[]};return db[_0x34de('0x30')][_0x34de('0x5b')]({'where':{'id':_0x11dbcf[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0xeedcad,null))['then'](function(_0x4184eb){if(_0x4184eb){_0x44b97a[_0x34de('0x34')]=_[_0x34de('0x4b')](db[_0x34de('0x125')]['rawAttributes']);_0x44b97a[_0x34de('0x37')]=_['keys'](_0x11dbcf[_0x34de('0x37')]);_0x44b97a[_0x34de('0x40')]=_['intersection'](_0x44b97a[_0x34de('0x34')],_0x44b97a[_0x34de('0x37')]);_0x319fbd[_0x34de('0x38')]=_[_0x34de('0x36')](_0x44b97a[_0x34de('0x34')],qs['fields'](_0x11dbcf['query'][_0x34de('0x39')]));_0x319fbd[_0x34de('0x38')]=_0x319fbd[_0x34de('0x38')][_0x34de('0x3a')]?_0x319fbd[_0x34de('0x38')]:_0x44b97a[_0x34de('0x34')];if(!_0x11dbcf[_0x34de('0x37')][_0x34de('0x3b')](_0x34de('0x5c'))){_0x319fbd[_0x34de('0x3c')]=qs[_0x34de('0x3c')](_0x11dbcf[_0x34de('0x37')][_0x34de('0x3c')]);_0x319fbd[_0x34de('0x24')]=qs[_0x34de('0x24')](_0x11dbcf[_0x34de('0x37')]['offset']);}_0x319fbd['order']=qs[_0x34de('0x3d')](_0x11dbcf[_0x34de('0x37')]['sort']);_0x319fbd[_0x34de('0x3e')]=qs[_0x34de('0x40')](_[_0x34de('0x3f')](_0x11dbcf[_0x34de('0x37')],_0x44b97a[_0x34de('0x40')]));_0x319fbd['where']['ChatWebsiteId']=_0x4184eb['id'];if(_0x11dbcf[_0x34de('0x37')]['filter']){_0x319fbd['where']=_[_0x34de('0x42')](_0x319fbd[_0x34de('0x3e')],{'$or':_[_0x34de('0x35')](_0x319fbd['attributes'],function(_0x3dff99){var _0x13fd5e={};_0x13fd5e[_0x3dff99]={'$like':'%'+_0x11dbcf[_0x34de('0x37')]['filter']+'%'};return _0x13fd5e;})});}_0x319fbd=_[_0x34de('0x42')]({},_0x319fbd,_0x11dbcf[_0x34de('0x4c')]);return db[_0x34de('0x125')][_0x34de('0x26')]({'where':_0x319fbd[_0x34de('0x3e')]})[_0x34de('0x17')](function(_0x436675){_0x92860d[_0x34de('0x26')]=_0x436675;if(_0x11dbcf['query'][_0x34de('0x44')]){_0x319fbd[_0x34de('0x45')]=[{'all':!![]}];}else{_0x319fbd[_0x34de('0x45')]=[{'model':db['CmContact'],'as':_0x34de('0xec'),'required':![]},{'model':db[_0x34de('0xd7')],'as':_0x34de('0x126'),'required':![]}];}return db[_0x34de('0x125')]['findAll'](_0x319fbd);})[_0x34de('0x17')](function(_0x218dd5){_0x92860d['rows']=_0x218dd5;return _0x92860d;});}})[_0x34de('0x17')](respondWithFilteredResult(_0xeedcad,_0x319fbd))[_0x34de('0x47')](handleError(_0xeedcad,null));};exports[_0x34de('0x127')]=function(_0x280810,_0x1107b3){return db[_0x34de('0x30')]['find']({'where':{'id':_0x280810[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x1107b3,null))[_0x34de('0x17')](function(_0x48d8d8){if(_0x48d8d8){return _0x48d8d8[_0x34de('0x127')](_0x280810[_0x34de('0x4e')]['ids'],_[_0x34de('0xeb')](_0x280810['body'],['ids','id'])||{})['spread'](function(_0x325e0e){for(var _0x3901e9=0x0;_0x3901e9<_0x280810['body']['ids']['length'];_0x3901e9+=0x1){socket[_0x34de('0x128')]('userChatWebsite:save',{'UserId':Number(_0x280810['body'][_0x34de('0x5f')][_0x3901e9]),'ChatWebsiteId':Number(_0x280810[_0x34de('0x49')]['id'])});}return _0x325e0e;});}})[_0x34de('0x17')](respondWithResult(_0x1107b3,null))[_0x34de('0x47')](handleError(_0x1107b3,null));};exports[_0x34de('0x129')]=function(_0x21d287,_0x2b1564){return db[_0x34de('0x30')][_0x34de('0x54')]({'where':{'id':_0x21d287[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x2b1564,null))['then'](function(_0x37655b){if(_0x37655b){return _0x37655b[_0x34de('0x129')](_0x21d287[_0x34de('0x37')][_0x34de('0x5f')])[_0x34de('0x17')](function(){if(_[_0x34de('0x12a')](_0x21d287[_0x34de('0x37')][_0x34de('0x5f')])){for(var _0x3619f5=0x0;_0x3619f5<_0x21d287[_0x34de('0x37')][_0x34de('0x5f')][_0x34de('0x3a')];_0x3619f5+=0x1){socket[_0x34de('0x128')](_0x34de('0x12b'),{'UserId':Number(_0x21d287[_0x34de('0x37')][_0x34de('0x5f')][_0x3619f5]),'ChatWebsiteId':Number(_0x21d287[_0x34de('0x49')]['id'])});}}else{socket[_0x34de('0x128')](_0x34de('0x12b'),{'UserId':Number(_0x21d287[_0x34de('0x37')][_0x34de('0x5f')]),'ChatWebsiteId':Number(_0x21d287[_0x34de('0x49')]['id'])});}});}})[_0x34de('0x17')](respondWithStatusCode(_0x2b1564,null))[_0x34de('0x47')](handleError(_0x2b1564,null));};exports[_0x34de('0x12c')]=function(_0x571661,_0x26d43f){var _0x1f45f7={};var _0x195e40={};var _0x5a201f;var _0x52d963;return db['ChatWebsite'][_0x34de('0x5b')]({'where':{'id':_0x571661[_0x34de('0x49')]['id']}})[_0x34de('0x17')](handleEntityNotFound(_0x26d43f,null))['then'](function(_0x2dfc33){if(_0x2dfc33){_0x5a201f=_0x2dfc33;_0x195e40[_0x34de('0x34')]=_[_0x34de('0x4b')](db['User'][_0x34de('0x31')]);_0x195e40[_0x34de('0x37')]=_[_0x34de('0x4b')](_0x571661['query']);_0x195e40[_0x34de('0x40')]=_[_0x34de('0x36')](_0x195e40[_0x34de('0x34')],_0x195e40[_0x34de('0x37')]);_0x1f45f7[_0x34de('0x38')]=_[_0x34de('0x36')](_0x195e40['model'],qs[_0x34de('0x39')](_0x571661[_0x34de('0x37')][_0x34de('0x39')]));_0x1f45f7['attributes']=_0x1f45f7[_0x34de('0x38')][_0x34de('0x3a')]?_0x1f45f7['attributes']:_0x195e40[_0x34de('0x34')];_0x1f45f7['order']=qs[_0x34de('0x3d')](_0x571661[_0x34de('0x37')][_0x34de('0x3d')]);_0x1f45f7[_0x34de('0x3e')]=qs[_0x34de('0x40')](_['pick'](_0x571661[_0x34de('0x37')],_0x195e40[_0x34de('0x40')]));if(_0x571661[_0x34de('0x37')][_0x34de('0x41')]){_0x1f45f7[_0x34de('0x3e')]=_[_0x34de('0x42')](_0x1f45f7['where'],{'$or':_[_0x34de('0x35')](_0x1f45f7[_0x34de('0x38')],function(_0x2a36fb){var _0x39fe0d={};_0x39fe0d[_0x2a36fb]={'$like':'%'+_0x571661['query'][_0x34de('0x41')]+'%'};return _0x39fe0d;})});}_0x1f45f7=_['merge']({},_0x1f45f7,_0x571661[_0x34de('0x4c')]);return _0x5a201f[_0x34de('0x12c')](_0x1f45f7);}})[_0x34de('0x17')](function(_0x5edf46){if(_0x5edf46){_0x52d963=_0x5edf46[_0x34de('0x3a')];if(!_0x571661[_0x34de('0x37')][_0x34de('0x3b')](_0x34de('0x5c'))){_0x1f45f7[_0x34de('0x3c')]=qs[_0x34de('0x3c')](_0x571661['query'][_0x34de('0x3c')]);_0x1f45f7['offset']=qs['offset'](_0x571661[_0x34de('0x37')][_0x34de('0x24')]);}return _0x5a201f[_0x34de('0x12c')](_0x1f45f7);}})['then'](function(_0x42c929){if(_0x42c929){return _0x42c929?{'count':_0x52d963,'rows':_0x42c929}:null;}})['then'](respondWithResult(_0x26d43f,null))['catch'](handleError(_0x26d43f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f36e8fa..286cbc2 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 _0xfd2f=['exports','events','../../mysqldb','ChatWebsite','save','remove','hook'];(function(_0x62937f,_0x20243c){var _0x3d11e3=function(_0x428221){while(--_0x428221){_0x62937f['push'](_0x62937f['shift']());}};_0x3d11e3(++_0x20243c);}(_0xfd2f,0x14a));var _0xffd2=function(_0x31bbbd,_0x5c6a56){_0x31bbbd=_0x31bbbd-0x0;var _0x58e12f=_0xfd2f[_0x31bbbd];return _0x58e12f;};'use strict';var EventEmitter=require(_0xffd2('0x0'));var ChatWebsite=require(_0xffd2('0x1'))['db'][_0xffd2('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xffd2('0x3'),'afterUpdate':'update','afterDestroy':_0xffd2('0x4')};function emitEvent(_0x407d4b){return function(_0x492c33,_0x983987,_0x22c424){ChatWebsiteEvents['emit'](_0x407d4b+':'+_0x492c33['id'],_0x492c33);ChatWebsiteEvents['emit'](_0x407d4b,_0x492c33);_0x22c424(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xffd2('0x5')](e,emitEvent(event));}}module[_0xffd2('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7a2d=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a2d,0x142));var _0xd7a2=function(_0x5281fb,_0x3c091d){_0x5281fb=_0x5281fb-0x0;var _0x14b6e9=_0x7a2d[_0x5281fb];return _0x14b6e9;};'use strict';var EventEmitter=require(_0xd7a2('0x0'));var ChatWebsite=require(_0xd7a2('0x1'))['db'][_0xd7a2('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd7a2('0x3')](0x0);var events={'afterCreate':_0xd7a2('0x4'),'afterUpdate':_0xd7a2('0x5'),'afterDestroy':_0xd7a2('0x6')};function emitEvent(_0x4b5379){return function(_0x500472,_0x7370d9,_0x146786){ChatWebsiteEvents[_0xd7a2('0x7')](_0x4b5379+':'+_0x500472['id'],_0x500472);ChatWebsiteEvents[_0xd7a2('0x7')](_0x4b5379,_0x500472);_0x146786(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xd7a2('0x8')](e,emitEvent(event));}}module[_0xd7a2('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 76eb371..41f3044 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 _0x2cd8=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cd8,0x186));var _0x82cd=function(_0x4ca1a3,_0x8330cc){_0x4ca1a3=_0x4ca1a3-0x0;var _0x373192=_0x2cd8[_0x4ca1a3];return _0x373192;};'use strict';var _=require(_0x82cd('0x0'));var util=require(_0x82cd('0x1'));var logger=require(_0x82cd('0x2'))(_0x82cd('0x3'));var moment=require(_0x82cd('0x4'));var BPromise=require(_0x82cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82cd('0x6'));var rimraf=require(_0x82cd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82cd('0x8'));module[_0x82cd('0x9')]=function(_0x3b560c,_0xdb486c){return _0x3b560c[_0x82cd('0xa')](_0x82cd('0xb'),attributes,{'tableName':_0x82cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30b1=['moment','path','../../config/environment','./chatWebsite.attributes','define','chat_websites','lodash','util','../../config/logger','api'];(function(_0x265a86,_0x4bfa53){var _0x37c033=function(_0xb96339){while(--_0xb96339){_0x265a86['push'](_0x265a86['shift']());}};_0x37c033(++_0x4bfa53);}(_0x30b1,0x16e));var _0x130b=function(_0x5877f0,_0x5e3cba){_0x5877f0=_0x5877f0-0x0;var _0x59a00d=_0x30b1[_0x5877f0];return _0x59a00d;};'use strict';var _=require(_0x130b('0x0'));var util=require(_0x130b('0x1'));var logger=require(_0x130b('0x2'))(_0x130b('0x3'));var moment=require(_0x130b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x130b('0x5'));var rimraf=require('rimraf');var config=require(_0x130b('0x6'));var attributes=require(_0x130b('0x7'));module['exports']=function(_0x255f0f,_0x1f61a3){return _0x255f0f[_0x130b('0x8')]('ChatWebsite',attributes,{'tableName':_0x130b('0x9'),'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 b68aa60..104d49f 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 _0xde60=['debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','request\x20sent'];(function(_0x398eb1,_0x50f55d){var _0x58a83f=function(_0x3ebf00){while(--_0x3ebf00){_0x398eb1['push'](_0x398eb1['shift']());}};_0x58a83f(++_0x50f55d);}(_0xde60,0x126));var _0x0de6=function(_0x3c3698,_0xa0bf08){_0x3c3698=_0x3c3698-0x0;var _0x4e6637=_0xde60[_0x3c3698];return _0x4e6637;};'use strict';var _=require('lodash');var util=require(_0x0de6('0x0'));var moment=require(_0x0de6('0x1'));var BPromise=require(_0x0de6('0x2'));var rs=require(_0x0de6('0x3'));var fs=require('fs');var Redis=require(_0x0de6('0x4'));var db=require(_0x0de6('0x5'))['db'];var utils=require(_0x0de6('0x6'));var logger=require('../../config/logger')(_0x0de6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0de6('0x8')][_0x0de6('0x9')]({'port':0x232a});config[_0x0de6('0xa')]=_['defaults'](config[_0x0de6('0xa')],{'host':_0x0de6('0xb'),'port':0x18eb});var socket=require(_0x0de6('0xc'))(new Redis(config[_0x0de6('0xa')]));require(_0x0de6('0xd'))[_0x0de6('0xe')](socket);function respondWithRpcPromise(_0x49fce8,_0x27652f,_0x575e25){return new BPromise(function(_0x5e4638,_0x566741){return client[_0x0de6('0xf')](_0x49fce8,_0x575e25)['then'](function(_0x25c706){logger[_0x0de6('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x27652f,_0x0de6('0x11'));logger[_0x0de6('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x27652f,'request\x20sent',JSON[_0x0de6('0x13')](_0x25c706));if(_0x25c706[_0x0de6('0x14')]){if(_0x25c706[_0x0de6('0x14')][_0x0de6('0x15')]===0x1f4){logger['error'](_0x0de6('0x16'),_0x27652f,_0x25c706[_0x0de6('0x14')][_0x0de6('0x17')]);return _0x566741(_0x25c706[_0x0de6('0x14')]['message']);}logger['error'](_0x0de6('0x16'),_0x27652f,_0x25c706[_0x0de6('0x14')][_0x0de6('0x17')]);return _0x5e4638(_0x25c706[_0x0de6('0x14')][_0x0de6('0x17')]);}else{logger[_0x0de6('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x27652f,_0x0de6('0x11'));_0x5e4638(_0x25c706[_0x0de6('0x18')]['message']);}})[_0x0de6('0x19')](function(_0x524268){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x27652f,_0x524268);_0x566741(_0x524268);});});} \ No newline at end of file +var _0x93f8=['socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x44a4d1,_0x8a1ec0){var _0x35dd2e=function(_0x364650){while(--_0x364650){_0x44a4d1['push'](_0x44a4d1['shift']());}};_0x35dd2e(++_0x8a1ec0);}(_0x93f8,0x19c));var _0x893f=function(_0xaaf5a6,_0x4fcaf7){_0xaaf5a6=_0xaaf5a6-0x0;var _0xa50e57=_0x93f8[_0xaaf5a6];return _0xa50e57;};'use strict';var _=require(_0x893f('0x0'));var util=require('util');var moment=require(_0x893f('0x1'));var BPromise=require('bluebird');var rs=require(_0x893f('0x2'));var fs=require('fs');var Redis=require(_0x893f('0x3'));var db=require(_0x893f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x893f('0x5'))(_0x893f('0x6'));var config=require('../../config/environment');var jayson=require(_0x893f('0x7'));var client=jayson[_0x893f('0x8')][_0x893f('0x9')]({'port':0x232a});config['redis']=_[_0x893f('0xa')](config[_0x893f('0xb')],{'host':_0x893f('0xc'),'port':0x18eb});var socket=require(_0x893f('0xd'))(new Redis(config[_0x893f('0xb')]));require('./chatWebsite.socket')[_0x893f('0xe')](socket);function respondWithRpcPromise(_0x4fde71,_0x3623a7,_0x2422a4){return new BPromise(function(_0x4d653d,_0x3e0b31){return client['request'](_0x4fde71,_0x2422a4)[_0x893f('0xf')](function(_0x5ef303){logger[_0x893f('0x10')](_0x893f('0x11'),_0x3623a7,'request\x20sent');logger[_0x893f('0x12')](_0x893f('0x13'),_0x3623a7,_0x893f('0x14'),JSON[_0x893f('0x15')](_0x5ef303));if(_0x5ef303[_0x893f('0x16')]){if(_0x5ef303['error'][_0x893f('0x17')]===0x1f4){logger['error'](_0x893f('0x11'),_0x3623a7,_0x5ef303['error'][_0x893f('0x18')]);return _0x3e0b31(_0x5ef303['error'][_0x893f('0x18')]);}logger[_0x893f('0x16')](_0x893f('0x11'),_0x3623a7,_0x5ef303[_0x893f('0x16')]['message']);return _0x4d653d(_0x5ef303['error']['message']);}else{logger[_0x893f('0x10')](_0x893f('0x11'),_0x3623a7,_0x893f('0x14'));_0x4d653d(_0x5ef303['result'][_0x893f('0x18')]);}})['catch'](function(_0x21428f){logger[_0x893f('0x16')](_0x893f('0x11'),_0x3623a7,_0x21428f);_0x3e0b31(_0x21428f);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 178d179..7f00eae 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 _0xf40c=['removeListener','register','chatWebsite:','./chatWebsite.events','remove','update','emit'];(function(_0x424460,_0x52b6dc){var _0x208d60=function(_0x20e273){while(--_0x20e273){_0x424460['push'](_0x424460['shift']());}};_0x208d60(++_0x52b6dc);}(_0xf40c,0x114));var _0xcf40=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xf40c[_0x2f1762];return _0x8ab21;};'use strict';var ChatWebsiteEvents=require(_0xcf40('0x0'));var events=['save',_0xcf40('0x1'),_0xcf40('0x2')];function createListener(_0x32fa8b,_0x13ab2d){return function(_0x18a45f){_0x13ab2d[_0xcf40('0x3')](_0x32fa8b,_0x18a45f);};}function removeListener(_0x33d8a8,_0x27f91d){return function(){ChatWebsiteEvents[_0xcf40('0x4')](_0x33d8a8,_0x27f91d);};}exports[_0xcf40('0x5')]=function(_0x5a779c){for(var _0x45df28=0x0,_0x1172df=events['length'];_0x45df28<_0x1172df;_0x45df28++){var _0x13fb23=events[_0x45df28];var _0x3510af=createListener(_0xcf40('0x6')+_0x13fb23,_0x5a779c);ChatWebsiteEvents['on'](_0x13fb23,_0x3510af);}}; \ No newline at end of file +var _0xb306=['chatWebsite:','./chatWebsite.events','save','remove','removeListener','length'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0xb306,0x10f));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var ChatWebsiteEvents=require(_0x6b30('0x0'));var events=[_0x6b30('0x1'),_0x6b30('0x2'),'update'];function createListener(_0x162d1e,_0x55dbf9){return function(_0x409ec1){_0x55dbf9['emit'](_0x162d1e,_0x409ec1);};}function removeListener(_0x35a640,_0x322ad8){return function(){ChatWebsiteEvents[_0x6b30('0x3')](_0x35a640,_0x322ad8);};}exports['register']=function(_0x479757){for(var _0x4f014c=0x0,_0x1c9d2a=events[_0x6b30('0x4')];_0x4f014c<_0x1c9d2a;_0x4f014c++){var _0x5e528b=events[_0x4f014c];var _0x146bbf=createListener(_0x6b30('0x5')+_0x5e528b,_0x479757);ChatWebsiteEvents['on'](_0x5e528b,_0x146bbf);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cf5faaa..ff2a9c2 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 _0x0661=['server/files/images/avatars/','/:id/notify','notify','server/files','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','server/files/images/logos/','%s-%s','originalname','single','diskStorage','root','format','file','addAvatar','now','addCustomerAvatar'];(function(_0x4decc4,_0x289caa){var _0x31920f=function(_0x446056){while(--_0x446056){_0x4decc4['push'](_0x4decc4['shift']());}};_0x31920f(++_0x289caa);}(_0x0661,0x9a));var _0x1066=function(_0x3b541e,_0x14a851){_0x3b541e=_0x3b541e-0x0;var _0x1b54ae=_0x0661[_0x3b541e];return _0x1b54ae;};'use strict';var multer=require(_0x1066('0x0'));var util=require(_0x1066('0x1'));var path=require(_0x1066('0x2'));var timeout=require(_0x1066('0x3'));var express=require(_0x1066('0x4'));var router=express[_0x1066('0x5')]();var fs_extra=require(_0x1066('0x6'));var auth=require(_0x1066('0x7'));var interaction=require(_0x1066('0x8'));var config=require(_0x1066('0x9'));var controller=require(_0x1066('0xa'));router[_0x1066('0xb')]('/',auth[_0x1066('0xc')](),controller[_0x1066('0xd')]);router[_0x1066('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x1066('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x1066('0xb')]('/:id/dispositions',auth[_0x1066('0xc')](),controller['getDispositions']);router[_0x1066('0xb')](_0x1066('0xf'),auth[_0x1066('0xc')](),controller[_0x1066('0x10')]);router['get'](_0x1066('0x11'),controller[_0x1066('0x12')]);router[_0x1066('0xb')](_0x1066('0x13'),controller[_0x1066('0x14')]);router[_0x1066('0xb')](_0x1066('0x15'),controller[_0x1066('0x16')]);router[_0x1066('0xb')](_0x1066('0x17'),controller['getSystemAvatar']);router['get'](_0x1066('0x18'),auth['isAuthenticated'](),controller[_0x1066('0x19')]);router[_0x1066('0xb')]('/:id/snippet',controller[_0x1066('0x1a')]);router[_0x1066('0xb')](_0x1066('0x1b'),auth[_0x1066('0xc')](),controller[_0x1066('0x1c')]);router['get'](_0x1066('0x1d'),auth[_0x1066('0xc')](),controller[_0x1066('0x1e')]);router['get']('/:id/fields',controller[_0x1066('0x1f')]);router[_0x1066('0xb')](_0x1066('0x20'),auth[_0x1066('0xc')](),controller[_0x1066('0x21')]);router[_0x1066('0xb')](_0x1066('0x22'),auth[_0x1066('0xc')](),controller[_0x1066('0x23')]);router[_0x1066('0x24')]('/',auth[_0x1066('0xc')](),controller[_0x1066('0x25')]);router[_0x1066('0x24')](_0x1066('0x26'),auth['isAuthenticated'](),controller[_0x1066('0x27')]);router[_0x1066('0x24')](_0x1066('0xf'),auth[_0x1066('0xc')](),controller[_0x1066('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13961c,_0x4e7844,_0x26098f){_0x26098f(null,path[_0x1066('0x29')](config['root'],_0x1066('0x2a')));},'filename':function(_0x369881,_0x2e7bfd,_0x191a02){_0x191a02(null,util['format'](_0x1066('0x2b'),Date['now'](),_0x2e7bfd[_0x1066('0x2c')]));}})});router[_0x1066('0x24')]('/:id/logo',upload[_0x1066('0x2d')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x1066('0x2e')]({'destination':function(_0x260caa,_0x891a5c,_0x552b31){_0x552b31(null,path[_0x1066('0x29')](config[_0x1066('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x3429c6,_0x250118,_0x267373){_0x267373(null,util[_0x1066('0x30')](_0x1066('0x2b'),Date['now'](),_0x250118['originalname']));}})});router['post'](_0x1066('0x13'),upload[_0x1066('0x2d')](_0x1066('0x31')),controller[_0x1066('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1c6be1,_0x4353d2,_0x4821f5){_0x4821f5(null,path[_0x1066('0x29')](config[_0x1066('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x37cfb5,_0x2b6294,_0x3678b2){_0x3678b2(null,util[_0x1066('0x30')]('%s-%s',Date[_0x1066('0x33')](),_0x2b6294[_0x1066('0x2c')]));}})});router[_0x1066('0x24')](_0x1066('0x15'),upload[_0x1066('0x2d')](_0x1066('0x31')),controller[_0x1066('0x34')]);var upload=multer({'storage':multer[_0x1066('0x2e')]({'destination':function(_0x4256a8,_0x2c92bc,_0x125063){_0x125063(null,path['join'](config[_0x1066('0x2f')],_0x1066('0x35')));},'filename':function(_0x3aa0f7,_0x46c994,_0x556909){_0x556909(null,util['format']('%s-%s',Date['now'](),_0x46c994[_0x1066('0x2c')]));}})});router[_0x1066('0x24')]('/:id/system_avatar',upload[_0x1066('0x2d')]('file'),controller['addSystemAvatar']);router['post'](_0x1066('0x36'),controller[_0x1066('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x57cfb3,_0x207536,_0x15b0fd){const _0x54f23f=path[_0x1066('0x29')](config[_0x1066('0x2f')],_0x1066('0x38'),'attachments','offline-chat');fs_extra['ensureDir'](_0x54f23f,function(){_0x15b0fd(null,_0x54f23f);});},'filename':function(_0x2c6af1,_0x70d033,_0x50bb32){const _0x2ad2e7=_0x70d033[_0x1066('0x2c')][_0x1066('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x33f257=path['extname'](_0x2ad2e7);const _0x8bb5c9=Date['now']()+'-'+_0x2ad2e7[_0x1066('0x39')](_0x33f257,'')+_0x33f257;_0x50bb32(null,_0x8bb5c9);}})});router['post'](_0x1066('0x3a'),offlineUploadMulter[_0x1066('0x3b')](),controller['offline']);router[_0x1066('0x24')](_0x1066('0x18'),auth[_0x1066('0xc')](),controller[_0x1066('0x3c')]);router['post'](_0x1066('0x1b'),auth[_0x1066('0xc')](),controller[_0x1066('0x3d')]);router[_0x1066('0x24')](_0x1066('0x1d'),auth[_0x1066('0xc')](),controller[_0x1066('0x3e')]);router[_0x1066('0x24')](_0x1066('0x22'),auth[_0x1066('0xc')](),controller[_0x1066('0x3f')]);router[_0x1066('0x40')](_0x1066('0xe'),auth[_0x1066('0xc')](),controller[_0x1066('0x41')]);router[_0x1066('0x42')](_0x1066('0xe'),auth[_0x1066('0xc')](),controller['destroy']);router['delete'](_0x1066('0x26'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1066('0x42')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1066('0x43')]);router[_0x1066('0x42')]('/:id/users',auth[_0x1066('0xc')](),controller[_0x1066('0x44')]);module['exports']=router; \ No newline at end of file +var _0x940b=['addApplications','addProactiveActions','addAgents','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','originalname','file','addLogo','format','%s-%s','now','single','addAvatar','root','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','addInteraction'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x940b,0x117));var _0xb940=function(_0x5e1175,_0x2a76bb){_0x5e1175=_0x5e1175-0x0;var _0x440414=_0x940b[_0x5e1175];return _0x440414;};'use strict';var multer=require(_0xb940('0x0'));var util=require(_0xb940('0x1'));var path=require(_0xb940('0x2'));var timeout=require(_0xb940('0x3'));var express=require('express');var router=express[_0xb940('0x4')]();var fs_extra=require(_0xb940('0x5'));var auth=require(_0xb940('0x6'));var interaction=require(_0xb940('0x7'));var config=require(_0xb940('0x8'));var controller=require('./chatWebsite.controller');router[_0xb940('0x9')]('/',auth[_0xb940('0xa')](),controller[_0xb940('0xb')]);router['get'](_0xb940('0xc'),auth[_0xb940('0xa')](),controller['describe']);router[_0xb940('0x9')](_0xb940('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb940('0x9')]('/:id/dispositions',auth[_0xb940('0xa')](),controller['getDispositions']);router['get'](_0xb940('0xe'),auth[_0xb940('0xa')](),controller['getAnswers']);router[_0xb940('0x9')](_0xb940('0xf'),controller[_0xb940('0x10')]);router['get'](_0xb940('0x11'),controller[_0xb940('0x12')]);router['get'](_0xb940('0x13'),controller[_0xb940('0x14')]);router[_0xb940('0x9')]('/:id/system_avatar',controller[_0xb940('0x15')]);router['get'](_0xb940('0x16'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb940('0x9')](_0xb940('0x17'),controller['getSnippet']);router[_0xb940('0x9')](_0xb940('0x18'),auth['isAuthenticated'](),controller[_0xb940('0x19')]);router[_0xb940('0x9')](_0xb940('0x1a'),auth[_0xb940('0xa')](),controller['getProactiveActions']);router[_0xb940('0x9')](_0xb940('0x1b'),controller[_0xb940('0x1c')]);router[_0xb940('0x9')](_0xb940('0x1d'),auth[_0xb940('0xa')](),controller['getOfflineMessages']);router[_0xb940('0x9')](_0xb940('0x1e'),auth[_0xb940('0xa')](),controller[_0xb940('0x1f')]);router[_0xb940('0x20')]('/',auth[_0xb940('0xa')](),controller['create']);router[_0xb940('0x20')](_0xb940('0x21'),auth[_0xb940('0xa')](),controller[_0xb940('0x22')]);router['post'](_0xb940('0xe'),auth[_0xb940('0xa')](),controller[_0xb940('0x23')]);var upload=multer({'storage':multer[_0xb940('0x24')]({'destination':function(_0xb2dd39,_0x18cbd6,_0x33e5c2){_0x33e5c2(null,path[_0xb940('0x25')](config['root'],_0xb940('0x26')));},'filename':function(_0x2de12d,_0x47e608,_0xf64fc4){_0xf64fc4(null,util['format']('%s-%s',Date['now'](),_0x47e608[_0xb940('0x27')]));}})});router[_0xb940('0x20')](_0xb940('0xf'),upload['single'](_0xb940('0x28')),controller[_0xb940('0x29')]);var upload=multer({'storage':multer[_0xb940('0x24')]({'destination':function(_0x2ff572,_0x51fde0,_0x6ebb37){_0x6ebb37(null,path[_0xb940('0x25')](config['root'],'server/files/images/avatars/'));},'filename':function(_0xc7d5dd,_0x4123d2,_0x4bdc4e){_0x4bdc4e(null,util[_0xb940('0x2a')](_0xb940('0x2b'),Date[_0xb940('0x2c')](),_0x4123d2['originalname']));}})});router[_0xb940('0x20')](_0xb940('0x11'),upload[_0xb940('0x2d')](_0xb940('0x28')),controller[_0xb940('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5f17f2,_0x469ef7,_0x437150){_0x437150(null,path[_0xb940('0x25')](config[_0xb940('0x2f')],_0xb940('0x30')));},'filename':function(_0x134df2,_0x583198,_0x34a752){_0x34a752(null,util['format'](_0xb940('0x2b'),Date[_0xb940('0x2c')](),_0x583198[_0xb940('0x27')]));}})});router[_0xb940('0x20')](_0xb940('0x13'),upload[_0xb940('0x2d')](_0xb940('0x28')),controller[_0xb940('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2eabf3,_0x1d8231,_0x107db9){_0x107db9(null,path[_0xb940('0x25')](config[_0xb940('0x2f')],_0xb940('0x30')));},'filename':function(_0x292edf,_0x23a1b6,_0xfac6f6){_0xfac6f6(null,util[_0xb940('0x2a')](_0xb940('0x2b'),Date[_0xb940('0x2c')](),_0x23a1b6['originalname']));}})});router[_0xb940('0x20')]('/:id/system_avatar',upload['single'](_0xb940('0x28')),controller[_0xb940('0x32')]);router[_0xb940('0x20')](_0xb940('0x33'),controller[_0xb940('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xb940('0x24')]({'destination':function(_0x1ab398,_0x35938b,_0x4a5134){const _0x2fdf51=path[_0xb940('0x25')](config[_0xb940('0x2f')],_0xb940('0x35'),_0xb940('0x36'),_0xb940('0x37'));fs_extra[_0xb940('0x38')](_0x2fdf51,function(){_0x4a5134(null,_0x2fdf51);});},'filename':function(_0x204ee9,_0x429538,_0x30a3b5){const _0x575b33=_0x429538[_0xb940('0x27')][_0xb940('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x41a75f=path['extname'](_0x575b33);const _0x213edd=Date[_0xb940('0x2c')]()+'-'+_0x575b33[_0xb940('0x39')](_0x41a75f,'')+_0x41a75f;_0x30a3b5(null,_0x213edd);}})});router[_0xb940('0x20')](_0xb940('0x3a'),offlineUploadMulter[_0xb940('0x3b')](),controller['offline']);router['post'](_0xb940('0x16'),auth[_0xb940('0xa')](),controller[_0xb940('0x3c')]);router[_0xb940('0x20')](_0xb940('0x18'),auth['isAuthenticated'](),controller[_0xb940('0x3d')]);router['post']('/:id/proactive_actions',auth[_0xb940('0xa')](),controller[_0xb940('0x3e')]);router['post'](_0xb940('0x1e'),auth[_0xb940('0xa')](),controller[_0xb940('0x3f')]);router['put']('/:id',auth[_0xb940('0xa')](),controller[_0xb940('0x40')]);router[_0xb940('0x41')](_0xb940('0xd'),auth[_0xb940('0xa')](),controller[_0xb940('0x42')]);router[_0xb940('0x41')](_0xb940('0x21'),auth[_0xb940('0xa')](),controller['removeDispositions']);router['delete'](_0xb940('0xe'),auth[_0xb940('0xa')](),controller['removeAnswers']);router['delete'](_0xb940('0x1e'),auth['isAuthenticated'](),controller[_0xb940('0x43')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 18d9e42..008eefe 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 _0xd6fd=['production','app','get','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','../components/auth/service','Router','env'];(function(_0x274eb5,_0x1d9790){var _0x3f81ac=function(_0x99e4b9){while(--_0x99e4b9){_0x274eb5['push'](_0x274eb5['shift']());}};_0x3f81ac(++_0x1d9790);}(_0xd6fd,0xd8));var _0xdd6f=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0xd6fd[_0x185063];return _0x16d9d3;};var beaverLogger=require(_0xdd6f('0x0'));var express=require('express');var auth=require(_0xdd6f('0x1'));var config=require('../config/environment');var router=express[_0xdd6f('0x2')]();var isProduction=config[_0xdd6f('0x3')]===_0xdd6f('0x4')||![];function clientSideLogs(_0x1059c1,_0x2c8583,_0x5b1462){var _0x819fa=_0x1059c1[_0xdd6f('0x5')][_0xdd6f('0x6')]('client-side-logger');if(!_0x819fa){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xdd6f('0x7')]({'uri':_0xdd6f('0x8'),'logger':_0x819fa,'enableCors':!isProduction})(_0x1059c1,_0x2c8583,_0x5b1462);}router['use'](auth[_0xdd6f('0x9')](),clientSideLogs);module[_0xdd6f('0xa')]=router; \ No newline at end of file +var _0xdc4f=['exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated'];(function(_0xbe4c61,_0x24e06a){var _0x35076d=function(_0x126a03){while(--_0x126a03){_0xbe4c61['push'](_0xbe4c61['shift']());}};_0x35076d(++_0x24e06a);}(_0xdc4f,0x9d));var _0xfdc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc4f[_0x20a584];return _0x4b41a8;};var beaverLogger=require(_0xfdc4('0x0'));var express=require(_0xfdc4('0x1'));var auth=require(_0xfdc4('0x2'));var config=require(_0xfdc4('0x3'));var router=express[_0xfdc4('0x4')]();var isProduction=config[_0xfdc4('0x5')]===_0xfdc4('0x6')||![];function clientSideLogs(_0x215aaf,_0xd359b0,_0x20b469){var _0x3b89f3=_0x215aaf['app'][_0xfdc4('0x7')]('client-side-logger');if(!_0x3b89f3){throw new Error(_0xfdc4('0x8'));}return beaverLogger[_0xfdc4('0x9')]({'uri':_0xfdc4('0xa'),'logger':_0x3b89f3,'enableCors':!isProduction})(_0x215aaf,_0xd359b0,_0x20b469);}router['use'](auth[_0xfdc4('0xb')](),clientSideLogs);module[_0xfdc4('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 317be7d..4f1f942 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 _0x6ba4=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6ba4,0xe5));var _0x46ba=function(_0x2331e6,_0x571011){_0x2331e6=_0x2331e6-0x0;var _0x453f20=_0x6ba4[_0x2331e6];return _0x453f20;};'use strict';var Sequelize=require(_0x46ba('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x46ba('0x1')](_0x46ba('0x2'),_0x46ba('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x46ba('0x1')](_0x46ba('0x4'),_0x46ba('0x5'))},'data1':{'type':Sequelize[_0x46ba('0x6')],'comment':_0x46ba('0x7')},'data2':{'type':Sequelize[_0x46ba('0x6')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x46ba('0x8')},'data4':{'type':Sequelize[_0x46ba('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x46ba('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x46ba('0x9')],'comment':_0x46ba('0xa')},'data7':{'type':Sequelize[_0x46ba('0x9')],'comment':_0x46ba('0xb')}}; \ No newline at end of file +var _0x0a8e=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365'];(function(_0xe1fa6b,_0x24c4c9){var _0x16e21f=function(_0x2cd9bd){while(--_0x2cd9bd){_0xe1fa6b['push'](_0xe1fa6b['shift']());}};_0x16e21f(++_0x24c4c9);}(_0x0a8e,0x165));var _0xe0a8=function(_0x319ed4,_0x3320bc){_0x319ed4=_0x319ed4-0x0;var _0x2d30e0=_0x0a8e[_0x319ed4];return _0x2d30e0;};'use strict';var Sequelize=require('sequelize');module[_0xe0a8('0x0')]={'name':{'type':Sequelize[_0xe0a8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xe0a8('0x2'),_0xe0a8('0x3'),_0xe0a8('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe0a8('0x5')](_0xe0a8('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xe0a8('0x1')],'comment':_0xe0a8('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0xe0a8('0x8')},'data3':{'type':Sequelize[_0xe0a8('0x1')],'comment':_0xe0a8('0x9')},'data4':{'type':Sequelize[_0xe0a8('0x1')],'comment':_0xe0a8('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xe0a8('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe0a8('0xb')],'comment':_0xe0a8('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index dd1f7ec..2e0dee9 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 _0xa19e=['json','offset','undefined','limit','count','set','update','then','name','send','padEnd','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','service','decryptString','data3','show','params','length','find','MicrosoftAzure','catch','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','from','state','ascii','parse','isValidIdToken','oauth2Claims','getOauth2MicrosoftAccessToken','data5','data6','startRefreshInterval','emit','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status'];(function(_0x15dcad,_0x383596){var _0x5c83e0=function(_0x44aad0){while(--_0x44aad0){_0x15dcad['push'](_0x15dcad['shift']());}};_0x5c83e0(++_0x383596);}(_0xa19e,0x15d));var _0xea19=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xa19e[_0x55c3d9];return _0x19fd97;};'use strict';var _=require(_0xea19('0x0'));var Redis=require(_0xea19('0x1'));var qs=require(_0xea19('0x2'));var encryptor=require(_0xea19('0x3'));var config=require(_0xea19('0x4'));var logger=require(_0xea19('0x5'))(_0xea19('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xea19('0x7'));config['redis']=_[_0xea19('0x8')](config[_0xea19('0x9')],{'host':_0xea19('0xa'),'port':0x18eb});var socket=require(_0xea19('0xb'))(new Redis(config[_0xea19('0x9')]));var redis=new Redis(config[_0xea19('0x9')]);function respondWithStatusCode(_0xa3cc42,_0x127a79){_0x127a79=_0x127a79||0xcc;return function(_0x220f86){if(_0x220f86){return _0xa3cc42[_0xea19('0xc')](_0x127a79);}return _0xa3cc42['status'](_0x127a79)[_0xea19('0xd')]();};}function respondWithResult(_0x50c3a8,_0x176ab8){_0x176ab8=_0x176ab8||0xc8;return function(_0x26f7cd){if(_0x26f7cd){return _0x50c3a8[_0xea19('0xe')](_0x176ab8)[_0xea19('0xf')](_0x26f7cd);}};}function respondWithFilteredResult(_0x407a56,_0x1c6e56){return function(_0x1d42dc){if(_0x1d42dc){var _0x5c6295=typeof _0x1c6e56[_0xea19('0x10')]===_0xea19('0x11')&&typeof _0x1c6e56[_0xea19('0x12')]===_0xea19('0x11');var _0x564790=_0x1d42dc[_0xea19('0x13')];var _0x509daa=_0x5c6295?0x0:_0x1c6e56[_0xea19('0x10')];var _0x717be4=_0x5c6295?_0x1d42dc[_0xea19('0x13')]:_0x1c6e56[_0xea19('0x10')]+_0x1c6e56[_0xea19('0x12')];var _0x2d5f8f;if(_0x717be4>=_0x564790){_0x717be4=_0x564790;_0x2d5f8f=0xc8;}else{_0x2d5f8f=0xce;}_0x407a56['status'](_0x2d5f8f);return _0x407a56[_0xea19('0x14')]('Content-Range',_0x509daa+'-'+_0x717be4+'/'+_0x564790)['json'](_0x1d42dc);}return null;};}function saveUpdates(_0x5c8bed){return function(_0x10086e){if(_0x10086e){return _0x10086e[_0xea19('0x15')](_0x5c8bed)[_0xea19('0x16')](function(_0x1ab3ae){return _0x1ab3ae;});}return null;};}function removeEntity(_0x4e5e01){return function(_0x20f97b){if(_0x20f97b){return _0x20f97b['destroy']()[_0xea19('0x16')](function(){_0x4e5e01['status'](0xcc)[_0xea19('0xd')]();});}};}function handleEntityNotFound(_0x1cada9){return function(_0x489de7){if(!_0x489de7){_0x1cada9[_0xea19('0xc')](0x194);}return _0x489de7;};}function handleError(_0xedc16d,_0x5be55a){_0x5be55a=_0x5be55a||0x1f4;return function(_0x1914d3){logger['error'](_0x1914d3['stack']);if(_0x1914d3[_0xea19('0x17')]){delete _0x1914d3[_0xea19('0x17')];}_0xedc16d[_0xea19('0xe')](_0x5be55a)[_0xea19('0x18')](_0x1914d3);};}function maskClientSecret(_0x300ed4){return _[_0xea19('0x19')](_0x300ed4['slice'](0x0,0x3),0x14,'*');}exports[_0xea19('0x1a')]=function(_0x2c7a8a,_0x5df391){var _0x13db5e={},_0x370686={},_0x2cacf2={'count':0x0,'rows':[]};var _0x45a755=_[_0xea19('0x1b')](db[_0xea19('0x1c')]['rawAttributes'],function(_0x391872){return{'name':_0x391872[_0xea19('0x1d')],'type':_0x391872[_0xea19('0x1e')][_0xea19('0x1f')]};});_0x370686[_0xea19('0x20')]=_[_0xea19('0x1b')](_0x45a755,_0xea19('0x17'));_0x370686[_0xea19('0x21')]=_[_0xea19('0x22')](_0x2c7a8a[_0xea19('0x21')]);_0x370686[_0xea19('0x23')]=_[_0xea19('0x24')](_0x370686['model'],_0x370686[_0xea19('0x21')]);_0x13db5e[_0xea19('0x25')]=_[_0xea19('0x24')](_0x370686[_0xea19('0x20')],qs['fields'](_0x2c7a8a['query'][_0xea19('0x26')]));_0x13db5e['attributes']=_0x13db5e['attributes']['length']?_0x13db5e[_0xea19('0x25')]:_0x370686['model'];if(!_0x2c7a8a[_0xea19('0x21')][_0xea19('0x27')](_0xea19('0x28'))){_0x13db5e[_0xea19('0x12')]=qs['limit'](_0x2c7a8a[_0xea19('0x21')][_0xea19('0x12')]);_0x13db5e['offset']=qs[_0xea19('0x10')](_0x2c7a8a[_0xea19('0x21')][_0xea19('0x10')]);}_0x13db5e[_0xea19('0x29')]=qs['sort'](_0x2c7a8a['query'][_0xea19('0x2a')]);_0x13db5e['where']=qs['filters'](_['pick'](_0x2c7a8a[_0xea19('0x21')],_0x370686[_0xea19('0x23')]),_0x45a755);if(_0x2c7a8a[_0xea19('0x21')][_0xea19('0x2b')]){_0x13db5e['where']=_[_0xea19('0x2c')](_0x13db5e[_0xea19('0x2d')],{'$or':_[_0xea19('0x1b')](_0x45a755,function(_0x2e6256){if(_0x2e6256[_0xea19('0x1e')]!==_0xea19('0x2e')){var _0x27bd8a={};_0x27bd8a[_0x2e6256['name']]={'$like':'%'+_0x2c7a8a[_0xea19('0x21')][_0xea19('0x2b')]+'%'};return _0x27bd8a;}})});}_0x13db5e=_[_0xea19('0x2c')]({},_0x13db5e,_0x2c7a8a[_0xea19('0x2f')]);var _0x522b58={'where':_0x13db5e[_0xea19('0x2d')]};return db[_0xea19('0x1c')][_0xea19('0x13')](_0x522b58)[_0xea19('0x16')](function(_0x43acb0){_0x2cacf2[_0xea19('0x13')]=_0x43acb0;if(_0x2c7a8a[_0xea19('0x21')][_0xea19('0x30')]){_0x13db5e[_0xea19('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0xea19('0x32')](_0x13db5e);})[_0xea19('0x16')](function(_0x48f8d4){_0x2cacf2[_0xea19('0x33')]=_[_0xea19('0x1b')](_0x48f8d4,function(_0x67b6ba){if(_0x67b6ba[_0xea19('0x34')]==='MicrosoftAzure'){var _0x56e47f=encryptor[_0xea19('0x35')](_0x67b6ba[_0xea19('0x36')]);_0x67b6ba[_0xea19('0x36')]=maskClientSecret(_0x56e47f);}return _0x67b6ba;});return _0x2cacf2;})[_0xea19('0x16')](respondWithFilteredResult(_0x5df391,_0x13db5e))['catch'](handleError(_0x5df391,null));};exports[_0xea19('0x37')]=function(_0xb53d40,_0x269318){var _0x43bad6={'raw':!![],'where':{'id':_0xb53d40[_0xea19('0x38')]['id']}},_0x478703={};_0x478703[_0xea19('0x20')]=_[_0xea19('0x22')](db[_0xea19('0x1c')]['rawAttributes']);_0x478703[_0xea19('0x21')]=_[_0xea19('0x22')](_0xb53d40[_0xea19('0x21')]);_0x478703[_0xea19('0x23')]=_[_0xea19('0x24')](_0x478703[_0xea19('0x20')],_0x478703['query']);_0x43bad6[_0xea19('0x25')]=_[_0xea19('0x24')](_0x478703[_0xea19('0x20')],qs[_0xea19('0x26')](_0xb53d40['query'][_0xea19('0x26')]));_0x43bad6[_0xea19('0x25')]=_0x43bad6[_0xea19('0x25')][_0xea19('0x39')]?_0x43bad6[_0xea19('0x25')]:_0x478703[_0xea19('0x20')];if(_0xb53d40[_0xea19('0x21')][_0xea19('0x30')]){_0x43bad6[_0xea19('0x31')]=[{'all':!![]}];}_0x43bad6=_[_0xea19('0x2c')]({},_0x43bad6,_0xb53d40['options']);return db['CloudProvider'][_0xea19('0x3a')](_0x43bad6)[_0xea19('0x16')](handleEntityNotFound(_0x269318,null))[_0xea19('0x16')](function(_0x53e814){if(_0x53e814[_0xea19('0x34')]===_0xea19('0x3b')){var _0x55ceca=encryptor[_0xea19('0x35')](_0x53e814[_0xea19('0x36')]);_0x53e814[_0xea19('0x36')]=maskClientSecret(_0x55ceca);}return _0x53e814;})[_0xea19('0x16')](respondWithResult(_0x269318,null))[_0xea19('0x3c')](handleError(_0x269318,null));};exports[_0xea19('0x3d')]=function(_0x56fd86,_0xde8feb){if(!_0x56fd86[_0xea19('0x3e')][_0xea19('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x56fd86[_0xea19('0x3e')][_0xea19('0x34')])throw new Error(_0xea19('0x3f'));var _0x4910f2=db[_0xea19('0x1c')]['rawAttributes'][_0xea19('0x34')][_0xea19('0x40')];if(!_0x4910f2[_0xea19('0x41')](_0x56fd86[_0xea19('0x3e')][_0xea19('0x34')]))throw new Error(_0xea19('0x42')+_0x4910f2['join'](',\x20'));if(_0x56fd86[_0xea19('0x3e')]['service']===_0xea19('0x3b')&&_0x56fd86[_0xea19('0x3e')][_0xea19('0x36')]){_0x56fd86['body'][_0xea19('0x36')]=encryptor['encryptString'](_0x56fd86[_0xea19('0x3e')]['data3']);}return db[_0xea19('0x1c')][_0xea19('0x3d')](_0x56fd86[_0xea19('0x3e')],{})[_0xea19('0x16')](respondWithResult(_0xde8feb,0xc9))[_0xea19('0x3c')](handleError(_0xde8feb,null));};exports[_0xea19('0x15')]=function(_0x5840c1,_0x1e5759){if(_0x5840c1[_0xea19('0x3e')]['id']){delete _0x5840c1[_0xea19('0x3e')]['id'];}return db[_0xea19('0x1c')]['find']({'where':{'id':_0x5840c1[_0xea19('0x38')]['id']}})[_0xea19('0x16')](handleEntityNotFound(_0x1e5759,null))[_0xea19('0x16')](function(_0x3ab458){if(_0x3ab458[_0xea19('0x34')]===_0xea19('0x3b')&&_0x5840c1['body'][_0xea19('0x36')]){_0x5840c1[_0xea19('0x3e')]['data3']=encryptor[_0xea19('0x43')](_0x5840c1[_0xea19('0x3e')][_0xea19('0x36')]);}return _0x3ab458;})['then'](saveUpdates(_0x5840c1['body'],null))[_0xea19('0x16')](respondWithResult(_0x1e5759,null))['catch'](handleError(_0x1e5759,null));};exports[_0xea19('0x44')]=function(_0x5c0322,_0x4d85de){return db['CloudProvider'][_0xea19('0x3a')]({'where':{'id':_0x5c0322['params']['id']}})[_0xea19('0x16')](handleEntityNotFound(_0x4d85de,null))['then'](removeEntity(_0x4d85de,null))[_0xea19('0x3c')](handleError(_0x4d85de,null));};exports[_0xea19('0x45')]=function(_0x3953f6,_0x246e95){return db[_0xea19('0x1c')][_0xea19('0x46')]({'where':{'id':_0x3953f6['params']['id']},'raw':!![]})['then'](function(_0x2bf61e){if(!_0x2bf61e)return _0x246e95[_0xea19('0xc')](0x194);return{'url':oauth[_0xea19('0x47')](_0x2bf61e,_0x3953f6['user']['id'])};})[_0xea19('0x16')](respondWithResult(_0x246e95,null))[_0xea19('0x3c')](handleError(_0x246e95,null));};exports[_0xea19('0x48')]=function(_0x19ae2b,_0xf37f3e){var _0x1e855c=_0x19ae2b[_0xea19('0x3e')];var _0xa242f8;var _0x52e7a8;if(_0x1e855c['error'])throw _0x1e855c;redis[_0xea19('0x49')](_0x1e855c['state'])[_0xea19('0x16')](function(_0x2f3043){if(!_0x2f3043)throw new Error(_0xea19('0x4a'));_0xa242f8=JSON['parse'](_0x2f3043);var _0x59bbf1=Buffer[_0xea19('0x4b')](_0x1e855c[_0xea19('0x4c')],'base64')['toString'](_0xea19('0x4d'));_0x52e7a8=JSON[_0xea19('0x4e')](_0x59bbf1);if(!oauth[_0xea19('0x4f')](_0x1e855c['id_token'],_0xa242f8[_0xea19('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x1e855c[_0xea19('0x4c')]);return oauth[_0xea19('0x51')](_0x1e855c['code'],_0xa242f8);})[_0xea19('0x16')](function(_0xc91c3c){_0xa242f8[_0xea19('0x52')]=_0xc91c3c['access_token'];_0xa242f8[_0xea19('0x53')]=_0xc91c3c['refresh_token'];return db[_0xea19('0x1c')]['update']({'data5':_0xa242f8[_0xea19('0x52')],'data6':_0xa242f8[_0xea19('0x53')]},{'where':{'id':_0xa242f8['id']}});})['then'](function(){oauth[_0xea19('0x54')](_0xa242f8);socket[_0xea19('0x55')]('microsoftAuthorization:success',{'id':_0x52e7a8['id']});return;})[_0xea19('0x16')](respondWithStatusCode(_0xf37f3e,null))[_0xea19('0x3c')](function(_0x47fd99){if(_0x52e7a8){socket['emit'](_0xea19('0x56'),{'id':_0x52e7a8['id']});}if(!_0xa242f8){logger[_0xea19('0x57')](_0xea19('0x58'),_0x47fd99);return _0xf37f3e['status'](0x1f4)['send'](_0x47fd99[_0xea19('0x59')]);}logger[_0xea19('0x57')](_0xea19('0x5a'),_0xa242f8['id'],JSON['stringify'](_0x47fd99));});}; \ No newline at end of file +var _0x8c35=['catch','create','body','Name\x20parameter\x20not\x20specified','service','values','includes','join','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','destroy','stack','name','send','padEnd','slice','map','CloudProvider','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','MicrosoftAzure','decryptString','data3','show','params','find'];(function(_0x24c811,_0x3bb49a){var _0x536236=function(_0x3d0f87){while(--_0x3d0f87){_0x24c811['push'](_0x24c811['shift']());}};_0x536236(++_0x3bb49a);}(_0x8c35,0x87));var _0x58c3=function(_0x46ccb7,_0x48cc17){_0x46ccb7=_0x46ccb7-0x0;var _0x51d584=_0x8c35[_0x46ccb7];return _0x51d584;};'use strict';var _=require(_0x58c3('0x0'));var Redis=require(_0x58c3('0x1'));var qs=require(_0x58c3('0x2'));var encryptor=require(_0x58c3('0x3'));var config=require('../../config/environment');var logger=require(_0x58c3('0x4'))(_0x58c3('0x5'));var db=require(_0x58c3('0x6'))['db'];var oauth=require(_0x58c3('0x7'));config[_0x58c3('0x8')]=_['defaults'](config['redis'],{'host':_0x58c3('0x9'),'port':0x18eb});var socket=require(_0x58c3('0xa'))(new Redis(config[_0x58c3('0x8')]));var redis=new Redis(config[_0x58c3('0x8')]);function respondWithStatusCode(_0xaec8b5,_0x548c1d){_0x548c1d=_0x548c1d||0xcc;return function(_0x43af6a){if(_0x43af6a){return _0xaec8b5[_0x58c3('0xb')](_0x548c1d);}return _0xaec8b5[_0x58c3('0xc')](_0x548c1d)[_0x58c3('0xd')]();};}function respondWithResult(_0x5aa678,_0x12835f){_0x12835f=_0x12835f||0xc8;return function(_0x3f2522){if(_0x3f2522){return _0x5aa678[_0x58c3('0xc')](_0x12835f)[_0x58c3('0xe')](_0x3f2522);}};}function respondWithFilteredResult(_0xcabda5,_0x581949){return function(_0x2595aa){if(_0x2595aa){var _0x138858=typeof _0x581949[_0x58c3('0xf')]===_0x58c3('0x10')&&typeof _0x581949['limit']===_0x58c3('0x10');var _0x1337cc=_0x2595aa[_0x58c3('0x11')];var _0x5ed5bf=_0x138858?0x0:_0x581949[_0x58c3('0xf')];var _0x3f70d1=_0x138858?_0x2595aa[_0x58c3('0x11')]:_0x581949[_0x58c3('0xf')]+_0x581949[_0x58c3('0x12')];var _0x1038fb;if(_0x3f70d1>=_0x1337cc){_0x3f70d1=_0x1337cc;_0x1038fb=0xc8;}else{_0x1038fb=0xce;}_0xcabda5['status'](_0x1038fb);return _0xcabda5[_0x58c3('0x13')]('Content-Range',_0x5ed5bf+'-'+_0x3f70d1+'/'+_0x1337cc)[_0x58c3('0xe')](_0x2595aa);}return null;};}function saveUpdates(_0x5722db){return function(_0x1bdb85){if(_0x1bdb85){return _0x1bdb85[_0x58c3('0x14')](_0x5722db)[_0x58c3('0x15')](function(_0x1c40f5){return _0x1c40f5;});}return null;};}function removeEntity(_0x1350a1){return function(_0x30ed1b){if(_0x30ed1b){return _0x30ed1b[_0x58c3('0x16')]()[_0x58c3('0x15')](function(){_0x1350a1[_0x58c3('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a345){return function(_0x2f7e6d){if(!_0x2f7e6d){_0x55a345[_0x58c3('0xb')](0x194);}return _0x2f7e6d;};}function handleError(_0x3bcd4e,_0x2463d3){_0x2463d3=_0x2463d3||0x1f4;return function(_0x411267){logger['error'](_0x411267[_0x58c3('0x17')]);if(_0x411267[_0x58c3('0x18')]){delete _0x411267[_0x58c3('0x18')];}_0x3bcd4e[_0x58c3('0xc')](_0x2463d3)[_0x58c3('0x19')](_0x411267);};}function maskClientSecret(_0x42bdb2){return _[_0x58c3('0x1a')](_0x42bdb2[_0x58c3('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3737da,_0x553c7){var _0x5afc96={},_0x6370ee={},_0x4a9fe7={'count':0x0,'rows':[]};var _0x4e9baa=_[_0x58c3('0x1c')](db[_0x58c3('0x1d')]['rawAttributes'],function(_0x92a20f){return{'name':_0x92a20f['fieldName'],'type':_0x92a20f['type'][_0x58c3('0x1e')]};});_0x6370ee[_0x58c3('0x1f')]=_[_0x58c3('0x1c')](_0x4e9baa,'name');_0x6370ee['query']=_[_0x58c3('0x20')](_0x3737da[_0x58c3('0x21')]);_0x6370ee[_0x58c3('0x22')]=_[_0x58c3('0x23')](_0x6370ee[_0x58c3('0x1f')],_0x6370ee[_0x58c3('0x21')]);_0x5afc96['attributes']=_[_0x58c3('0x23')](_0x6370ee['model'],qs[_0x58c3('0x24')](_0x3737da[_0x58c3('0x21')][_0x58c3('0x24')]));_0x5afc96[_0x58c3('0x25')]=_0x5afc96['attributes'][_0x58c3('0x26')]?_0x5afc96[_0x58c3('0x25')]:_0x6370ee['model'];if(!_0x3737da[_0x58c3('0x21')][_0x58c3('0x27')](_0x58c3('0x28'))){_0x5afc96[_0x58c3('0x12')]=qs[_0x58c3('0x12')](_0x3737da[_0x58c3('0x21')][_0x58c3('0x12')]);_0x5afc96['offset']=qs[_0x58c3('0xf')](_0x3737da[_0x58c3('0x21')][_0x58c3('0xf')]);}_0x5afc96[_0x58c3('0x29')]=qs[_0x58c3('0x2a')](_0x3737da[_0x58c3('0x21')][_0x58c3('0x2a')]);_0x5afc96[_0x58c3('0x2b')]=qs[_0x58c3('0x22')](_[_0x58c3('0x2c')](_0x3737da[_0x58c3('0x21')],_0x6370ee[_0x58c3('0x22')]),_0x4e9baa);if(_0x3737da['query'][_0x58c3('0x2d')]){_0x5afc96[_0x58c3('0x2b')]=_[_0x58c3('0x2e')](_0x5afc96[_0x58c3('0x2b')],{'$or':_[_0x58c3('0x1c')](_0x4e9baa,function(_0x529f5a){if(_0x529f5a[_0x58c3('0x2f')]!==_0x58c3('0x30')){var _0x11a145={};_0x11a145[_0x529f5a['name']]={'$like':'%'+_0x3737da[_0x58c3('0x21')][_0x58c3('0x2d')]+'%'};return _0x11a145;}})});}_0x5afc96=_[_0x58c3('0x2e')]({},_0x5afc96,_0x3737da[_0x58c3('0x31')]);var _0x102f3f={'where':_0x5afc96[_0x58c3('0x2b')]};return db['CloudProvider']['count'](_0x102f3f)[_0x58c3('0x15')](function(_0x35de48){_0x4a9fe7[_0x58c3('0x11')]=_0x35de48;if(_0x3737da[_0x58c3('0x21')][_0x58c3('0x32')]){_0x5afc96[_0x58c3('0x33')]=[{'all':!![]}];}return db[_0x58c3('0x1d')][_0x58c3('0x34')](_0x5afc96);})[_0x58c3('0x15')](function(_0x181708){_0x4a9fe7['rows']=_[_0x58c3('0x1c')](_0x181708,function(_0x54a36d){if(_0x54a36d['service']===_0x58c3('0x35')){var _0x2eb117=encryptor[_0x58c3('0x36')](_0x54a36d[_0x58c3('0x37')]);_0x54a36d[_0x58c3('0x37')]=maskClientSecret(_0x2eb117);}return _0x54a36d;});return _0x4a9fe7;})[_0x58c3('0x15')](respondWithFilteredResult(_0x553c7,_0x5afc96))['catch'](handleError(_0x553c7,null));};exports[_0x58c3('0x38')]=function(_0xfd3c59,_0x1cb69e){var _0x3c6a5e={'raw':!![],'where':{'id':_0xfd3c59[_0x58c3('0x39')]['id']}},_0x1dfa13={};_0x1dfa13[_0x58c3('0x1f')]=_[_0x58c3('0x20')](db[_0x58c3('0x1d')]['rawAttributes']);_0x1dfa13[_0x58c3('0x21')]=_[_0x58c3('0x20')](_0xfd3c59[_0x58c3('0x21')]);_0x1dfa13['filters']=_[_0x58c3('0x23')](_0x1dfa13[_0x58c3('0x1f')],_0x1dfa13[_0x58c3('0x21')]);_0x3c6a5e[_0x58c3('0x25')]=_[_0x58c3('0x23')](_0x1dfa13[_0x58c3('0x1f')],qs[_0x58c3('0x24')](_0xfd3c59[_0x58c3('0x21')]['fields']));_0x3c6a5e[_0x58c3('0x25')]=_0x3c6a5e[_0x58c3('0x25')][_0x58c3('0x26')]?_0x3c6a5e[_0x58c3('0x25')]:_0x1dfa13[_0x58c3('0x1f')];if(_0xfd3c59[_0x58c3('0x21')][_0x58c3('0x32')]){_0x3c6a5e[_0x58c3('0x33')]=[{'all':!![]}];}_0x3c6a5e=_[_0x58c3('0x2e')]({},_0x3c6a5e,_0xfd3c59['options']);return db[_0x58c3('0x1d')][_0x58c3('0x3a')](_0x3c6a5e)[_0x58c3('0x15')](handleEntityNotFound(_0x1cb69e,null))[_0x58c3('0x15')](function(_0x198edd){if(_0x198edd['service']==='MicrosoftAzure'){var _0x3ebf16=encryptor[_0x58c3('0x36')](_0x198edd['data3']);_0x198edd['data3']=maskClientSecret(_0x3ebf16);}return _0x198edd;})[_0x58c3('0x15')](respondWithResult(_0x1cb69e,null))[_0x58c3('0x3b')](handleError(_0x1cb69e,null));};exports[_0x58c3('0x3c')]=function(_0x40750b,_0x1a37ef){if(!_0x40750b[_0x58c3('0x3d')][_0x58c3('0x18')])throw new Error(_0x58c3('0x3e'));if(!_0x40750b['body']['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x36b5b4=db[_0x58c3('0x1d')]['rawAttributes'][_0x58c3('0x3f')][_0x58c3('0x40')];if(!_0x36b5b4[_0x58c3('0x41')](_0x40750b[_0x58c3('0x3d')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x36b5b4[_0x58c3('0x42')](',\x20'));if(_0x40750b[_0x58c3('0x3d')]['service']===_0x58c3('0x35')&&_0x40750b['body'][_0x58c3('0x37')]){_0x40750b[_0x58c3('0x3d')]['data3']=encryptor[_0x58c3('0x43')](_0x40750b[_0x58c3('0x3d')][_0x58c3('0x37')]);}return db[_0x58c3('0x1d')][_0x58c3('0x3c')](_0x40750b[_0x58c3('0x3d')],{})[_0x58c3('0x15')](respondWithResult(_0x1a37ef,0xc9))[_0x58c3('0x3b')](handleError(_0x1a37ef,null));};exports[_0x58c3('0x14')]=function(_0x42216f,_0x1adc0c){if(_0x42216f[_0x58c3('0x3d')]['id']){delete _0x42216f[_0x58c3('0x3d')]['id'];}return db[_0x58c3('0x1d')][_0x58c3('0x3a')]({'where':{'id':_0x42216f[_0x58c3('0x39')]['id']}})['then'](handleEntityNotFound(_0x1adc0c,null))[_0x58c3('0x15')](function(_0x5a78de){if(_0x5a78de[_0x58c3('0x3f')]===_0x58c3('0x35')&&_0x42216f['body'][_0x58c3('0x37')]){_0x42216f[_0x58c3('0x3d')][_0x58c3('0x37')]=encryptor[_0x58c3('0x43')](_0x42216f[_0x58c3('0x3d')][_0x58c3('0x37')]);}return _0x5a78de;})[_0x58c3('0x15')](saveUpdates(_0x42216f[_0x58c3('0x3d')],null))[_0x58c3('0x15')](respondWithResult(_0x1adc0c,null))[_0x58c3('0x3b')](handleError(_0x1adc0c,null));};exports['destroy']=function(_0xe2cd90,_0x41e396){return db[_0x58c3('0x1d')][_0x58c3('0x3a')]({'where':{'id':_0xe2cd90['params']['id']}})[_0x58c3('0x15')](handleEntityNotFound(_0x41e396,null))[_0x58c3('0x15')](removeEntity(_0x41e396,null))[_0x58c3('0x3b')](handleError(_0x41e396,null));};exports['oauth2MicrosoftAuthorize']=function(_0xf43cdf,_0x850d1c){return db['CloudProvider'][_0x58c3('0x44')]({'where':{'id':_0xf43cdf[_0x58c3('0x39')]['id']},'raw':!![]})[_0x58c3('0x15')](function(_0x4b9bac){if(!_0x4b9bac)return _0x850d1c[_0x58c3('0xb')](0x194);return{'url':oauth[_0x58c3('0x45')](_0x4b9bac,_0xf43cdf[_0x58c3('0x46')]['id'])};})[_0x58c3('0x15')](respondWithResult(_0x850d1c,null))[_0x58c3('0x3b')](handleError(_0x850d1c,null));};exports[_0x58c3('0x47')]=function(_0x23723b,_0x122ef9){var _0x131005=_0x23723b[_0x58c3('0x3d')];var _0x2c7998;var _0x47b212;if(_0x131005['error'])throw _0x131005;redis['get'](_0x131005[_0x58c3('0x48')])['then'](function(_0x513c47){if(!_0x513c47)throw new Error(_0x58c3('0x49'));_0x2c7998=JSON[_0x58c3('0x4a')](_0x513c47);var _0xa8586a=Buffer[_0x58c3('0x4b')](_0x131005[_0x58c3('0x48')],_0x58c3('0x4c'))[_0x58c3('0x4d')](_0x58c3('0x4e'));_0x47b212=JSON[_0x58c3('0x4a')](_0xa8586a);if(!oauth[_0x58c3('0x4f')](_0x131005['id_token'],_0x2c7998[_0x58c3('0x50')]))throw new Error(_0x58c3('0x51'));redis[_0x58c3('0x52')](_0x131005[_0x58c3('0x48')]);return oauth[_0x58c3('0x53')](_0x131005['code'],_0x2c7998);})[_0x58c3('0x15')](function(_0x93ed9e){_0x2c7998[_0x58c3('0x54')]=_0x93ed9e[_0x58c3('0x55')];_0x2c7998[_0x58c3('0x56')]=_0x93ed9e[_0x58c3('0x57')];return db[_0x58c3('0x1d')][_0x58c3('0x14')]({'data5':_0x2c7998[_0x58c3('0x54')],'data6':_0x2c7998[_0x58c3('0x56')]},{'where':{'id':_0x2c7998['id']}});})['then'](function(){oauth[_0x58c3('0x58')](_0x2c7998);socket[_0x58c3('0x59')](_0x58c3('0x5a'),{'id':_0x47b212['id']});return;})[_0x58c3('0x15')](respondWithStatusCode(_0x122ef9,null))['catch'](function(_0x4eb6bc){if(_0x47b212){socket[_0x58c3('0x59')](_0x58c3('0x5b'),{'id':_0x47b212['id']});}if(!_0x2c7998){logger['error'](_0x58c3('0x5c'),_0x4eb6bc);return _0x122ef9[_0x58c3('0xc')](0x1f4)[_0x58c3('0x19')](_0x4eb6bc[_0x58c3('0x5d')]);}logger[_0x58c3('0x5e')](_0x58c3('0x5f'),_0x2c7998['id'],JSON[_0x58c3('0x60')](_0x4eb6bc));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 054b4d5..0bb9b59 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 _0x41f4=['cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x487f14,_0x1cb7ea){var _0x739a54=function(_0xab20d4){while(--_0xab20d4){_0x487f14['push'](_0x487f14['shift']());}};_0x739a54(++_0x1cb7ea);}(_0x41f4,0x175));var _0x441f=function(_0x29c87c,_0x5837e9){_0x29c87c=_0x29c87c-0x0;var _0x3fb66f=_0x41f4[_0x29c87c];return _0x3fb66f;};'use strict';var _=require(_0x441f('0x0'));var util=require(_0x441f('0x1'));var logger=require(_0x441f('0x2'))(_0x441f('0x3'));var moment=require(_0x441f('0x4'));var BPromise=require('bluebird');var rp=require(_0x441f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x441f('0x6'));var config=require(_0x441f('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x441f('0x8')]=function(_0x6c4f5,_0x292970){return _0x6c4f5[_0x441f('0x9')](_0x441f('0xa'),attributes,{'tableName':_0x441f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9bc=['moment','bluebird','request-promise','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x3b7fb0,_0x553e21){var _0x3b7fc5=function(_0x286bdc){while(--_0x286bdc){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x3b7fc5(++_0x553e21);}(_0xc9bc,0xda));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc9b('0x0'));var util=require(_0xcc9b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc9b('0x2'));var BPromise=require(_0xcc9b('0x3'));var rp=require(_0xcc9b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc9b('0x5'));var attributes=require(_0xcc9b('0x6'));module[_0xcc9b('0x7')]=function(_0x40d0a0,_0x4e9846){return _0x40d0a0[_0xcc9b('0x8')](_0xcc9b('0x9'),attributes,{'tableName':_0xcc9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 2046a2d..87b96e9 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 _0x6f33=['all','catch','inspect','exports','lodash','crypto','moment','request-promise','util','../../config/environment','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','push','data7','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','key','oauth2/','set','payload','issuer','aud','audience','isAfter','unix','resolve','data3','then','refresh_token','POST','data5','access_token','CloudProvider','data6','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll'];(function(_0x498b80,_0x4a207c){var _0x368941=function(_0x1397a9){while(--_0x1397a9){_0x498b80['push'](_0x498b80['shift']());}};_0x368941(++_0x4a207c);}(_0x6f33,0xee));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36f3('0x0'));var crypto=require(_0x36f3('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x36f3('0x2'));var Redis=require('ioredis');var rp=require(_0x36f3('0x3'));var util=require(_0x36f3('0x4'));var encryptor=require('../../components/encryptor');var config=require(_0x36f3('0x5'));var logger=require('../../config/logger')(_0x36f3('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x36f3('0x7'))['db'];config[_0x36f3('0x8')]=_[_0x36f3('0x9')](config[_0x36f3('0x8')],{'host':_0x36f3('0xa'),'port':0x18eb});var redis=new Redis(config[_0x36f3('0x8')]);var MICROSOFT_AUTH_URL=_0x36f3('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x36f3('0xc'),_0x36f3('0xd'),_0x36f3('0xe'),'offline_access',_0x36f3('0xf'),_0x36f3('0x10'),_0x36f3('0x11')],'Dynamics365':[_0x36f3('0xc'),_0x36f3('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x36f3('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x36f3('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x47afac){var _0x3a22f8=_[_0x36f3('0x15')](AZURE_AUTH_SCOPES[_0x47afac[_0x36f3('0x16')]]);if(_0x47afac[_0x36f3('0x16')]==='Dynamics365')_0x3a22f8[_0x36f3('0x17')](_0x47afac[_0x36f3('0x18')]+'/.default');return _0x3a22f8[_0x36f3('0x19')]('\x20');}function getAccessTokenScope(_0x3afdd4){if(_0x3afdd4[_0x36f3('0x16')]===_0x36f3('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3afdd4[_0x36f3('0x16')]===_0x36f3('0x1b'))return _0x3afdd4['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x20f60c,_0x2dbcf7){var _0x848d0d=MICROSOFT_AUTH_URL[_0x36f3('0x1c')](_0x36f3('0x1d'),_0x20f60c[_0x36f3('0x1e')]);var _0x50ad2c=['code',_0x36f3('0x1f')];var _0x416779=Buffer[_0x36f3('0x20')](JSON[_0x36f3('0x21')]({'id':_0x2dbcf7}))[_0x36f3('0x22')](_0x36f3('0x23'));var _0x1ab631=crypto[_0x36f3('0x24')](0x10)['toString'](_0x36f3('0x25'));var _0x308101=getAuthorizationScopes(_0x20f60c);var _0x219673=[{'key':_0x36f3('0x26'),'value':_0x20f60c[_0x36f3('0x27')]},{'key':_0x36f3('0x28'),'value':encodeURIComponent(_0x50ad2c['join']('\x20'))},{'key':_0x36f3('0x29'),'value':_0x20f60c[_0x36f3('0x2a')]},{'key':_0x36f3('0x2b'),'value':_0x36f3('0x2c')},{'key':_0x36f3('0x2d'),'value':encodeURIComponent(_0x308101)},{'key':_0x36f3('0x2e'),'value':_0x416779},{'key':_0x36f3('0x2f'),'value':_0x1ab631},{'key':'prompt','value':_0x36f3('0x30')}];var _0x51121a=_0x848d0d+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x219673,function(_0x54267e){return _0x54267e[_0x36f3('0x31')]+'='+_0x54267e['value'];})[_0x36f3('0x19')]('&');_0x20f60c['oauth2Claims']={'issuer':_0x848d0d[_0x36f3('0x1c')](_0x36f3('0x32'),''),'audience':_0x20f60c[_0x36f3('0x27')],'state':_0x416779,'nonce':_0x1ab631};redis[_0x36f3('0x33')](_0x416779,JSON[_0x36f3('0x21')](_0x20f60c));return _0x51121a;}function isValidIdToken(_0x4a8e5c,_0x4c09fa){try{var _0x2dc242=jwt['decode'](_0x4a8e5c,{'complete':!![]});var _0x30cc87=_0x2dc242[_0x36f3('0x34')];if(_0x30cc87['iss']!==_0x4c09fa[_0x36f3('0x35')])return![];if(_0x30cc87[_0x36f3('0x36')]!==_0x4c09fa[_0x36f3('0x37')])return![];if(_0x30cc87[_0x36f3('0x2f')]!==_0x4c09fa[_0x36f3('0x2f')])return![];if(moment()[_0x36f3('0x38')](moment[_0x36f3('0x39')](_0x30cc87['exp'])))return![];return!![];}catch(_0x1646ab){throw _0x1646ab;}}function refreshOauth2MicrosoftAccessToken(_0x151078){return Promise[_0x36f3('0x3a')]()['then'](function(){if(_0x151078[_0x36f3('0x3b')])return _0x151078;return db['CloudProvider']['findOne']({'where':{'id':_0x151078['id']},'raw':!![]});})[_0x36f3('0x3c')](function(_0xfff1b5){var _0x5865f2={'grant_type':_0x36f3('0x3d'),'refresh_token':_0xfff1b5['data6'],'scope':getAccessTokenScope(_0xfff1b5),'redirect_uri':_0xfff1b5[_0x36f3('0x2a')],'client_id':_0xfff1b5[_0x36f3('0x27')],'client_secret':encryptor['decryptString'](_0xfff1b5[_0x36f3('0x3b')])};var _0x3e5bf2={'method':_0x36f3('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x36f3('0x1c')]('{TENANT_ID}',_0xfff1b5[_0x36f3('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5865f2,'json':!![]};return rp(_0x3e5bf2);})[_0x36f3('0x3c')](function(_0x5bc239){_0x151078[_0x36f3('0x3f')]=_0x5bc239[_0x36f3('0x40')];_0x151078['data6']=_0x5bc239[_0x36f3('0x3d')];return db[_0x36f3('0x41')]['update']({'data5':_0x151078[_0x36f3('0x3f')],'data6':_0x151078[_0x36f3('0x42')]},{'where':{'id':_0x151078['id']}});})[_0x36f3('0x3c')](function(){return _0x151078;})['catch'](function(_0x3f7c68){logger[_0x36f3('0x43')](_0x36f3('0x44'),_0x151078['id'],_0x3f7c68);});}function getOauth2MicrosoftAccessToken(_0x31f22a,_0x2307b2){var _0x1677f2={'grant_type':_0x36f3('0x45'),'code':_0x31f22a,'scope':getAccessTokenScope(_0x2307b2),'redirect_uri':_0x2307b2[_0x36f3('0x2a')],'client_id':_0x2307b2['data1'],'client_secret':encryptor[_0x36f3('0x46')](_0x2307b2[_0x36f3('0x3b')])};var _0x4656e0={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x36f3('0x1c')](_0x36f3('0x1d'),_0x2307b2[_0x36f3('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1677f2,'json':!![]};return rp(_0x4656e0);}function startRefreshInterval(_0x4885e2){var _0x4a4ddb=schedule[_0x36f3('0x47')];if(_0x4a4ddb[_0x4885e2['id']])clearInterval(_0x4a4ddb[_0x4885e2['id']]);_0x4a4ddb[_0x4885e2['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x36f3('0x48')](this,{'id':_0x4885e2['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x36f3('0x47')]=_0x4a4ddb;}function startAllRefreshIntervals(){return db[_0x36f3('0x41')][_0x36f3('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x36f3('0x3c')](function(_0x4f0a4d){var _0x46a104=_0x4f0a4d[_0x36f3('0x15')](function(_0x50cec5){return refreshOauth2MicrosoftAccessToken(_0x50cec5)['then'](function(_0x1e7820){startRefreshInterval(_0x1e7820);});});return Promise[_0x36f3('0x4a')](_0x46a104);})[_0x36f3('0x4b')](function(_0x189be0){var _0x3d2c31=_0x189be0?util[_0x36f3('0x4c')](_0x189be0,{'showHidden':![],'depth':null}):'';logger[_0x36f3('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3d2c31);});}module[_0x36f3('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8cbb=['[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','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','/authorize','/token','map','Dynamics365','push','data7','/.default','join','type','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','hex','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','oauth2Claims','oauth2/','set','payload','iss','aud','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','catch','inspect'];(function(_0x44cd05,_0x4809ca){var _0x59d0e0=function(_0x340cb0){while(--_0x340cb0){_0x44cd05['push'](_0x44cd05['shift']());}};_0x59d0e0(++_0x4809ca);}(_0x8cbb,0x178));var _0xb8cb=function(_0x1c5462,_0x47253f){_0x1c5462=_0x1c5462-0x0;var _0x240ba1=_0x8cbb[_0x1c5462];return _0x240ba1;};'use strict';var _=require('lodash');var crypto=require(_0xb8cb('0x0'));var jwt=require(_0xb8cb('0x1'));var moment=require(_0xb8cb('0x2'));var Redis=require(_0xb8cb('0x3'));var rp=require(_0xb8cb('0x4'));var util=require(_0xb8cb('0x5'));var encryptor=require(_0xb8cb('0x6'));var config=require(_0xb8cb('0x7'));var logger=require(_0xb8cb('0x8'))(_0xb8cb('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xb8cb('0xa')]=_[_0xb8cb('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xb8cb('0xa')]);var MICROSOFT_AUTH_URL=_0xb8cb('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb8cb('0xd'),_0xb8cb('0xe'),_0xb8cb('0xf'),_0xb8cb('0x10'),_0xb8cb('0x11'),_0xb8cb('0x12'),_0xb8cb('0x13')],'Dynamics365':[_0xb8cb('0xd'),_0xb8cb('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xb8cb('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xb8cb('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x32f6da){var _0x2f525b=_[_0xb8cb('0x16')](AZURE_AUTH_SCOPES[_0x32f6da['type']]);if(_0x32f6da['type']===_0xb8cb('0x17'))_0x2f525b[_0xb8cb('0x18')](_0x32f6da[_0xb8cb('0x19')]+_0xb8cb('0x1a'));return _0x2f525b[_0xb8cb('0x1b')]('\x20');}function getAccessTokenScope(_0x3891e3){if(_0x3891e3[_0xb8cb('0x1c')]===_0xb8cb('0x1d'))return _0xb8cb('0x11');if(_0x3891e3[_0xb8cb('0x1c')]===_0xb8cb('0x17'))return _0x3891e3[_0xb8cb('0x19')]+_0xb8cb('0x1a');}function generateMicrosoftAuthorizationUrl(_0x242115,_0x255c2b){var _0x114826=MICROSOFT_AUTH_URL[_0xb8cb('0x1e')](_0xb8cb('0x1f'),_0x242115[_0xb8cb('0x20')]);var _0x5d9e35=[_0xb8cb('0x21'),'id_token'];var _0x178e12=Buffer[_0xb8cb('0x22')](JSON[_0xb8cb('0x23')]({'id':_0x255c2b}))[_0xb8cb('0x24')]('base64');var _0x3a191b=crypto['randomBytes'](0x10)[_0xb8cb('0x24')](_0xb8cb('0x25'));var _0x429a33=getAuthorizationScopes(_0x242115);var _0x454d5b=[{'key':_0xb8cb('0x26'),'value':_0x242115[_0xb8cb('0x27')]},{'key':_0xb8cb('0x28'),'value':encodeURIComponent(_0x5d9e35[_0xb8cb('0x1b')]('\x20'))},{'key':_0xb8cb('0x29'),'value':_0x242115[_0xb8cb('0x2a')]},{'key':'response_mode','value':_0xb8cb('0x2b')},{'key':_0xb8cb('0x2c'),'value':encodeURIComponent(_0x429a33)},{'key':_0xb8cb('0x2d'),'value':_0x178e12},{'key':_0xb8cb('0x2e'),'value':_0x3a191b},{'key':'prompt','value':'login'}];var _0x3f2cc2=_0x114826+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x454d5b,function(_0x509f9d){return _0x509f9d['key']+'='+_0x509f9d['value'];})[_0xb8cb('0x1b')]('&');_0x242115[_0xb8cb('0x2f')]={'issuer':_0x114826[_0xb8cb('0x1e')](_0xb8cb('0x30'),''),'audience':_0x242115[_0xb8cb('0x27')],'state':_0x178e12,'nonce':_0x3a191b};redis[_0xb8cb('0x31')](_0x178e12,JSON['stringify'](_0x242115));return _0x3f2cc2;}function isValidIdToken(_0x5370ff,_0x39ef19){try{var _0x3b6d4b=jwt['decode'](_0x5370ff,{'complete':!![]});var _0x13aa5e=_0x3b6d4b[_0xb8cb('0x32')];if(_0x13aa5e[_0xb8cb('0x33')]!==_0x39ef19['issuer'])return![];if(_0x13aa5e[_0xb8cb('0x34')]!==_0x39ef19['audience'])return![];if(_0x13aa5e[_0xb8cb('0x2e')]!==_0x39ef19[_0xb8cb('0x2e')])return![];if(moment()['isAfter'](moment[_0xb8cb('0x35')](_0x13aa5e[_0xb8cb('0x36')])))return![];return!![];}catch(_0x1beb99){throw _0x1beb99;}}function refreshOauth2MicrosoftAccessToken(_0x5dc574){return Promise[_0xb8cb('0x37')]()[_0xb8cb('0x38')](function(){if(_0x5dc574[_0xb8cb('0x39')])return _0x5dc574;return db[_0xb8cb('0x3a')][_0xb8cb('0x3b')]({'where':{'id':_0x5dc574['id']},'raw':!![]});})[_0xb8cb('0x38')](function(_0x633963){var _0x2bb0a8={'grant_type':_0xb8cb('0x3c'),'refresh_token':_0x633963[_0xb8cb('0x3d')],'scope':getAccessTokenScope(_0x633963),'redirect_uri':_0x633963[_0xb8cb('0x2a')],'client_id':_0x633963[_0xb8cb('0x27')],'client_secret':encryptor[_0xb8cb('0x3e')](_0x633963['data3'])};var _0x18aa8c={'method':_0xb8cb('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xb8cb('0x1f'),_0x633963[_0xb8cb('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2bb0a8,'json':!![]};return rp(_0x18aa8c);})[_0xb8cb('0x38')](function(_0x2346d3){_0x5dc574[_0xb8cb('0x40')]=_0x2346d3['access_token'];_0x5dc574[_0xb8cb('0x3d')]=_0x2346d3[_0xb8cb('0x3c')];return db[_0xb8cb('0x3a')][_0xb8cb('0x41')]({'data5':_0x5dc574[_0xb8cb('0x40')],'data6':_0x5dc574[_0xb8cb('0x3d')]},{'where':{'id':_0x5dc574['id']}});})[_0xb8cb('0x38')](function(){return _0x5dc574;})['catch'](function(_0x1b7b1e){logger[_0xb8cb('0x42')](_0xb8cb('0x43'),_0x5dc574['id'],_0x1b7b1e);});}function getOauth2MicrosoftAccessToken(_0x1bcf58,_0x2a56f0){var _0x4fd6d8={'grant_type':_0xb8cb('0x44'),'code':_0x1bcf58,'scope':getAccessTokenScope(_0x2a56f0),'redirect_uri':_0x2a56f0[_0xb8cb('0x2a')],'client_id':_0x2a56f0['data1'],'client_secret':encryptor[_0xb8cb('0x3e')](_0x2a56f0[_0xb8cb('0x39')])};var _0x44e6a3={'method':_0xb8cb('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xb8cb('0x1e')](_0xb8cb('0x1f'),_0x2a56f0[_0xb8cb('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4fd6d8,'json':!![]};return rp(_0x44e6a3);}function startRefreshInterval(_0x57b330){var _0x368fc9=schedule[_0xb8cb('0x45')];if(_0x368fc9[_0x57b330['id']])clearInterval(_0x368fc9[_0x57b330['id']]);_0x368fc9[_0x57b330['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x57b330['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x368fc9;}function startAllRefreshIntervals(){return db[_0xb8cb('0x3a')][_0xb8cb('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x41de55){var _0x12cc53=_0x41de55[_0xb8cb('0x16')](function(_0x2ef019){return refreshOauth2MicrosoftAccessToken(_0x2ef019)[_0xb8cb('0x38')](function(_0x53b4c5){startRefreshInterval(_0x53b4c5);});});return Promise[_0xb8cb('0x47')](_0x12cc53);})[_0xb8cb('0x48')](function(_0x351b0e){var _0x456f2c=_0x351b0e?util[_0xb8cb('0x49')](_0x351b0e,{'showHidden':![],'depth':null}):'';logger['error'](_0xb8cb('0x4a'),_0x456f2c);});}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 9d3496e..4b0657c 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 _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x23cca7,_0x3028b8){var _0x2b87d6=function(_0x22b4fc){while(--_0x22b4fc){_0x23cca7['push'](_0x23cca7['shift']());}};_0x2b87d6(++_0x3028b8);}(_0x3609,0x101));var _0x9360=function(_0x43d112,_0x1b23da){_0x43d112=_0x43d112-0x0;var _0x442a6d=_0x3609[_0x43d112];return _0x442a6d;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});} \ No newline at end of file +var _0xae24=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4b3acc,_0x3df83c){var _0x29cd65=function(_0x33d8d0){while(--_0x33d8d0){_0x4b3acc['push'](_0x4b3acc['shift']());}};_0x29cd65(++_0x3df83c);}(_0xae24,0x180));var _0x4ae2=function(_0x9b62e3,_0x223ec4){_0x9b62e3=_0x9b62e3-0x0;var _0x17d1bc=_0xae24[_0x9b62e3];return _0x17d1bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ae2('0x0'));var BPromise=require(_0x4ae2('0x1'));var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require(_0x4ae2('0x4'))['db'];var utils=require(_0x4ae2('0x5'));var logger=require(_0x4ae2('0x6'))(_0x4ae2('0x7'));var config=require(_0x4ae2('0x8'));var jayson=require(_0x4ae2('0x9'));var client=jayson['client'][_0x4ae2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46b90b,_0xda7751,_0x596c50){return new BPromise(function(_0x583af6,_0x1533d0){return client[_0x4ae2('0xb')](_0x46b90b,_0x596c50)[_0x4ae2('0xc')](function(_0x1b19cd){logger[_0x4ae2('0xd')](_0x4ae2('0xe'),_0xda7751,_0x4ae2('0xf'));logger[_0x4ae2('0x10')](_0x4ae2('0x11'),_0xda7751,'request\x20sent',JSON[_0x4ae2('0x12')](_0x1b19cd));if(_0x1b19cd[_0x4ae2('0x13')]){if(_0x1b19cd['error'][_0x4ae2('0x14')]===0x1f4){logger['error'](_0x4ae2('0xe'),_0xda7751,_0x1b19cd[_0x4ae2('0x13')]['message']);return _0x1533d0(_0x1b19cd[_0x4ae2('0x13')]['message']);}logger[_0x4ae2('0x13')](_0x4ae2('0xe'),_0xda7751,_0x1b19cd['error'][_0x4ae2('0x15')]);return _0x583af6(_0x1b19cd[_0x4ae2('0x13')][_0x4ae2('0x15')]);}else{logger[_0x4ae2('0xd')](_0x4ae2('0xe'),_0xda7751,_0x4ae2('0xf'));_0x583af6(_0x1b19cd[_0x4ae2('0x16')][_0x4ae2('0x15')]);}})[_0x4ae2('0x17')](function(_0x154df2){logger[_0x4ae2('0x13')]('CloudProvider,\x20%s,\x20%s',_0xda7751,_0x154df2);_0x1533d0(_0x154df2);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4d9cf2f..219c87f 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x8b09bc,_0x1b178c){var _0x1e89a2=function(_0x5a3c46){while(--_0x5a3c46){_0x8b09bc['push'](_0x8b09bc['shift']());}};_0x1e89a2(++_0x1b178c);}(_0x2ef3,0xba));var _0x32ef=function(_0x9736b7,_0x45c18d){_0x9736b7=_0x9736b7-0x0;var _0x1d502d=_0x2ef3[_0x9736b7];return _0x1d502d;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xadb5,0xad));var _0x5adb=function(_0x2f147f,_0x25e3f9){_0x2f147f=_0x2f147f-0x0;var _0x4b489b=_0xadb5[_0x2f147f];return _0x4b489b;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('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 e69b40a..d6258e6 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 _0x17f0=['name','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x17f0,0x91));var _0x017f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x17f0[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x017f('0x0'));module[_0x017f('0x1')]={'name':{'type':Sequelize[_0x017f('0x2')],'unique':_0x017f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x017f('0x2')]},'companyId':{'type':Sequelize[_0x017f('0x2')]},'website':{'type':Sequelize[_0x017f('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x017f('0x2')]},'type':{'type':Sequelize[_0x017f('0x2')]},'street':{'type':Sequelize[_0x017f('0x2')]},'postalCode':{'type':Sequelize[_0x017f('0x2')]},'city':{'type':Sequelize[_0x017f('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x017f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x017f('0x2')]},'sStreet':{'type':Sequelize[_0x017f('0x2')]},'sPostalCode':{'type':Sequelize[_0x017f('0x2')]},'sCity':{'type':Sequelize[_0x017f('0x2')]},'sCountry':{'type':Sequelize[_0x017f('0x2')]},'description':{'type':Sequelize[_0x017f('0x2')]}}; \ No newline at end of file +var _0x1b0b=['STRING','name','sequelize'];(function(_0xd4470d,_0x47318d){var _0x5544c5=function(_0x3486cb){while(--_0x3486cb){_0xd4470d['push'](_0xd4470d['shift']());}};_0x5544c5(++_0x47318d);}(_0x1b0b,0x16d));var _0xb1b0=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1b0b[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xb1b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1b0('0x1')],'unique':_0xb1b0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb1b0('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xb1b0('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb1b0('0x1')]},'type':{'type':Sequelize[_0xb1b0('0x1')]},'street':{'type':Sequelize[_0xb1b0('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb1b0('0x1')]},'country':{'type':Sequelize[_0xb1b0('0x1')]},'email':{'type':Sequelize[_0xb1b0('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb1b0('0x1')]},'sStreet':{'type':Sequelize[_0xb1b0('0x1')]},'sPostalCode':{'type':Sequelize[_0xb1b0('0x1')]},'sCity':{'type':Sequelize[_0xb1b0('0x1')]},'sCountry':{'type':Sequelize[_0xb1b0('0x1')]},'description':{'type':Sequelize[_0xb1b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c794984..aa0414f 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 _0xc5d0=['describe','addContacts','ids','getContacts','findOne','CmContact','order','options','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','includeAll','include','rows','show','params','rawAttributes','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc5d0,0x1ac));var _0x0c5d=function(_0x112147,_0x4e692e){_0x112147=_0x112147-0x0;var _0x3ba744=_0xc5d0[_0x112147];return _0x3ba744;};'use strict';var emlformat=require(_0x0c5d('0x0'));var rimraf=require(_0x0c5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c5d('0x2'));var rp=require('request-promise');var moment=require(_0x0c5d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c5d('0x4'));var path=require(_0x0c5d('0x5'));var sox=require(_0x0c5d('0x6'));var csv=require(_0x0c5d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c5d('0x8'));var _=require('lodash');var squel=require(_0x0c5d('0x9'));var crypto=require(_0x0c5d('0xa'));var jsforce=require(_0x0c5d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0c5d('0xc'));var authService=require(_0x0c5d('0xd'));var qs=require(_0x0c5d('0xe'));var as=require(_0x0c5d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c5d('0x10'))(_0x0c5d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0c5d('0x12'));var db=require(_0x0c5d('0x13'))['db'];function respondWithStatusCode(_0x296995,_0x3c94eb){_0x3c94eb=_0x3c94eb||0xcc;return function(_0x1101cd){if(_0x1101cd){return _0x296995[_0x0c5d('0x14')](_0x3c94eb);}return _0x296995[_0x0c5d('0x15')](_0x3c94eb)[_0x0c5d('0x16')]();};}function respondWithResult(_0x227a37,_0x53044d){_0x53044d=_0x53044d||0xc8;return function(_0x1bedf9){if(_0x1bedf9){return _0x227a37[_0x0c5d('0x15')](_0x53044d)[_0x0c5d('0x17')](_0x1bedf9);}};}function respondWithFilteredResult(_0x46868f,_0xb2c538){return function(_0x21e0bc){if(_0x21e0bc){var _0xc97884=typeof _0xb2c538[_0x0c5d('0x18')]===_0x0c5d('0x19')&&typeof _0xb2c538[_0x0c5d('0x1a')]===_0x0c5d('0x19');var _0x5a716c=_0x21e0bc[_0x0c5d('0x1b')];var _0x11b030=_0xc97884?0x0:_0xb2c538[_0x0c5d('0x18')];var _0x105932=_0xc97884?_0x21e0bc[_0x0c5d('0x1b')]:_0xb2c538['offset']+_0xb2c538[_0x0c5d('0x1a')];var _0x559150;if(_0x105932>=_0x5a716c){_0x105932=_0x5a716c;_0x559150=0xc8;}else{_0x559150=0xce;}_0x46868f[_0x0c5d('0x15')](_0x559150);return _0x46868f[_0x0c5d('0x1c')](_0x0c5d('0x1d'),_0x11b030+'-'+_0x105932+'/'+_0x5a716c)['json'](_0x21e0bc);}return null;};}function patchUpdates(_0x24a101){return function(_0x5b000b){try{jsonpatch[_0x0c5d('0x1e')](_0x5b000b,_0x24a101,!![]);}catch(_0x1468ba){return BPromise[_0x0c5d('0x1f')](_0x1468ba);}return _0x5b000b[_0x0c5d('0x20')]();};}function saveUpdates(_0x5a6e81,_0x5569f6){return function(_0x303939){if(_0x303939){return _0x303939['update'](_0x5a6e81)[_0x0c5d('0x21')](function(_0x4e47c6){return _0x4e47c6;});}return null;};}function removeEntity(_0xd64a39,_0x85a32b){return function(_0x22fe13){if(_0x22fe13){return _0x22fe13[_0x0c5d('0x22')]()[_0x0c5d('0x21')](function(){var _0x4b870c=_0x22fe13[_0x0c5d('0x23')]({'plain':!![]});var _0x3a826b=_0x0c5d('0x24');return db[_0x0c5d('0x25')]['destroy']({'where':{'type':_0x3a826b,'resourceId':_0x4b870c['id']}})['then'](function(){return _0x22fe13;});})[_0x0c5d('0x21')](function(){_0xd64a39[_0x0c5d('0x15')](0xcc)[_0x0c5d('0x16')]();});}};}function handleEntityNotFound(_0x1c359d,_0x4f7a6a){return function(_0x5a7234){if(!_0x5a7234){_0x1c359d[_0x0c5d('0x14')](0x194);}return _0x5a7234;};}function handleError(_0x6e23d6,_0x508bed){_0x508bed=_0x508bed||0x1f4;return function(_0x435180){logger[_0x0c5d('0x26')](_0x435180[_0x0c5d('0x27')]);if(_0x435180[_0x0c5d('0x28')]){delete _0x435180[_0x0c5d('0x28')];}_0x6e23d6['status'](_0x508bed)[_0x0c5d('0x29')](_0x435180);};}exports[_0x0c5d('0x2a')]=function(_0x3c3df3,_0x4b403c){var _0x53512c={},_0x8e92e4={},_0x1f3d86={'count':0x0,'rows':[]};return db[_0x0c5d('0x2b')]['describe']()[_0x0c5d('0x21')](function(_0x1425dd){_0x8e92e4[_0x0c5d('0x2c')]=_[_0x0c5d('0x2d')](_0x1425dd);_0x8e92e4[_0x0c5d('0x2e')]=_[_0x0c5d('0x2d')](_0x3c3df3[_0x0c5d('0x2e')]);_0x8e92e4[_0x0c5d('0x2f')]=_[_0x0c5d('0x30')](_0x8e92e4['model'],_0x8e92e4['query']);_0x53512c[_0x0c5d('0x31')]=_[_0x0c5d('0x30')](_0x8e92e4[_0x0c5d('0x2c')],qs[_0x0c5d('0x32')](_0x3c3df3[_0x0c5d('0x2e')]['fields']));_0x53512c[_0x0c5d('0x31')]=_0x53512c[_0x0c5d('0x31')][_0x0c5d('0x33')]?_0x53512c['attributes']:_0x8e92e4[_0x0c5d('0x2c')];if(!_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x34')](_0x0c5d('0x35'))){_0x53512c[_0x0c5d('0x1a')]=qs['limit'](_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x1a')]);_0x53512c['offset']=qs[_0x0c5d('0x18')](_0x3c3df3['query'][_0x0c5d('0x18')]);}_0x53512c['order']=qs[_0x0c5d('0x36')](_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x36')]);_0x53512c[_0x0c5d('0x37')]=qs['filters'](_[_0x0c5d('0x38')](_0x3c3df3[_0x0c5d('0x2e')],_0x8e92e4[_0x0c5d('0x2f')]),_0x1425dd);if(_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x39')]){_0x53512c['where']=_[_0x0c5d('0x3a')](_0x53512c[_0x0c5d('0x37')],{'$or':_[_0x0c5d('0x3b')](_0x53512c[_0x0c5d('0x31')],function(_0x2527b3){var _0x42b99c={};_0x42b99c[_0x2527b3]={'$like':'%'+_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x39')]+'%'};return _0x42b99c;})});}_0x53512c=_['merge']({},_0x53512c,_0x3c3df3['options']);var _0x524a4d={'where':_0x53512c[_0x0c5d('0x37')]};return db[_0x0c5d('0x2b')]['count'](_0x524a4d)[_0x0c5d('0x21')](function(_0x53593a){_0x1f3d86['count']=_0x53593a;if(_0x3c3df3[_0x0c5d('0x2e')][_0x0c5d('0x3c')]){_0x53512c[_0x0c5d('0x3d')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x53512c);})[_0x0c5d('0x21')](function(_0x323db4){_0x1f3d86[_0x0c5d('0x3e')]=_0x323db4;return _0x1f3d86;})[_0x0c5d('0x21')](respondWithFilteredResult(_0x4b403c,_0x53512c))['catch'](handleError(_0x4b403c,null));})['catch'](handleError(_0x4b403c,null));};exports[_0x0c5d('0x3f')]=function(_0x2ae3ad,_0x51702f){var _0x360091={'raw':![],'where':{'id':_0x2ae3ad[_0x0c5d('0x40')]['id']}},_0xfe48fb={};_0xfe48fb['model']=_[_0x0c5d('0x2d')](db[_0x0c5d('0x2b')][_0x0c5d('0x41')]);_0xfe48fb[_0x0c5d('0x2e')]=_[_0x0c5d('0x2d')](_0x2ae3ad[_0x0c5d('0x2e')]);_0xfe48fb['filters']=_[_0x0c5d('0x30')](_0xfe48fb['model'],_0xfe48fb[_0x0c5d('0x2e')]);_0x360091['attributes']=_['intersection'](_0xfe48fb[_0x0c5d('0x2c')],qs[_0x0c5d('0x32')](_0x2ae3ad[_0x0c5d('0x2e')][_0x0c5d('0x32')]));_0x360091[_0x0c5d('0x31')]=_0x360091[_0x0c5d('0x31')][_0x0c5d('0x33')]?_0x360091[_0x0c5d('0x31')]:_0xfe48fb[_0x0c5d('0x2c')];if(_0x2ae3ad['query'][_0x0c5d('0x3c')]){_0x360091[_0x0c5d('0x3d')]=[{'all':!![]}];}_0x360091=_[_0x0c5d('0x3a')]({},_0x360091,_0x2ae3ad['options']);return db['CmCompany']['find'](_0x360091)[_0x0c5d('0x21')](handleEntityNotFound(_0x51702f,null))['then'](respondWithResult(_0x51702f,null))[_0x0c5d('0x42')](handleError(_0x51702f,null));};exports['create']=function(_0x2ccd39,_0x575fb8){return db['CmCompany'][_0x0c5d('0x43')](_0x2ccd39[_0x0c5d('0x44')],{})['then'](function(_0x545f17){var _0x25ccdd=_0x2ccd39[_0x0c5d('0x45')][_0x0c5d('0x23')]({'plain':!![]});if(!_0x25ccdd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ccdd['role']===_0x0c5d('0x45')){var _0x4b27d3=_0x545f17[_0x0c5d('0x23')]({'plain':!![]});var _0x6a8d29=_0x0c5d('0x24');return db[_0x0c5d('0x46')][_0x0c5d('0x47')]({'where':{'name':_0x6a8d29,'userProfileId':_0x25ccdd[_0x0c5d('0x48')]},'raw':!![]})[_0x0c5d('0x21')](function(_0x57d473){if(_0x57d473&&_0x57d473[_0x0c5d('0x49')]===0x0){return db[_0x0c5d('0x25')]['create']({'name':_0x4b27d3[_0x0c5d('0x28')],'resourceId':_0x4b27d3['id'],'type':_0x57d473[_0x0c5d('0x28')],'sectionId':_0x57d473['id']},{})[_0x0c5d('0x21')](function(){return _0x545f17;});}else{return _0x545f17;}})['catch'](function(_0x419c1b){logger['error'](_0x0c5d('0x4a'),_0x419c1b);throw _0x419c1b;});}return _0x545f17;})[_0x0c5d('0x21')](respondWithResult(_0x575fb8,0xc9))[_0x0c5d('0x42')](handleError(_0x575fb8,null));};exports[_0x0c5d('0x4b')]=function(_0x36e0c4,_0x37b286){if(_0x36e0c4['body']['id']){delete _0x36e0c4[_0x0c5d('0x44')]['id'];}return db[_0x0c5d('0x2b')]['find']({'where':{'id':_0x36e0c4['params']['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x37b286,null))[_0x0c5d('0x21')](saveUpdates(_0x36e0c4['body'],null))[_0x0c5d('0x21')](respondWithResult(_0x37b286,null))[_0x0c5d('0x42')](handleError(_0x37b286,null));};exports[_0x0c5d('0x22')]=function(_0x1fb897,_0x1d6e1e){return db['CmCompany']['find']({'where':{'id':_0x1fb897[_0x0c5d('0x40')]['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x1d6e1e,null))[_0x0c5d('0x21')](removeEntity(_0x1d6e1e,null))[_0x0c5d('0x42')](handleError(_0x1d6e1e,null));};exports[_0x0c5d('0x4c')]=function(_0x385e10,_0x3fc3c3){return db['CmCompany'][_0x0c5d('0x4c')]()['then'](respondWithResult(_0x3fc3c3,null))[_0x0c5d('0x42')](handleError(_0x3fc3c3,null));};exports[_0x0c5d('0x4d')]=function(_0x52206c,_0x38ed11,_0x22f0e8){return db['CmContact']['find']({'where':{'id':_0x52206c['params']['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x38ed11,null))[_0x0c5d('0x21')](function(_0x5ede1e){if(_0x5ede1e){return _0x5ede1e[_0x0c5d('0x4d')](_0x52206c[_0x0c5d('0x44')][_0x0c5d('0x4e')],_['omit'](_0x52206c[_0x0c5d('0x44')],[_0x0c5d('0x4e'),'id'])||{});}})[_0x0c5d('0x21')](respondWithResult(_0x38ed11,null))[_0x0c5d('0x42')](handleError(_0x38ed11,null));};exports[_0x0c5d('0x4f')]=function(_0x54eace,_0x59c802,_0x516175){var _0x23b075={};var _0x3b33e9={};var _0x34d5d2;var _0x533457;return db[_0x0c5d('0x2b')][_0x0c5d('0x50')]({'where':{'id':_0x54eace[_0x0c5d('0x40')]['id']}})[_0x0c5d('0x21')](handleEntityNotFound(_0x59c802,null))[_0x0c5d('0x21')](function(_0x5ca26a){if(_0x5ca26a){_0x34d5d2=_0x5ca26a;_0x3b33e9[_0x0c5d('0x2c')]=_['keys'](db[_0x0c5d('0x51')][_0x0c5d('0x41')]);_0x3b33e9['query']=_[_0x0c5d('0x2d')](_0x54eace['query']);_0x3b33e9[_0x0c5d('0x2f')]=_[_0x0c5d('0x30')](_0x3b33e9[_0x0c5d('0x2c')],_0x3b33e9[_0x0c5d('0x2e')]);_0x23b075[_0x0c5d('0x31')]=_['intersection'](_0x3b33e9[_0x0c5d('0x2c')],qs[_0x0c5d('0x32')](_0x54eace['query'][_0x0c5d('0x32')]));_0x23b075[_0x0c5d('0x31')]=_0x23b075[_0x0c5d('0x31')][_0x0c5d('0x33')]?_0x23b075[_0x0c5d('0x31')]:_0x3b33e9[_0x0c5d('0x2c')];_0x23b075[_0x0c5d('0x52')]=qs[_0x0c5d('0x36')](_0x54eace[_0x0c5d('0x2e')][_0x0c5d('0x36')]);_0x23b075[_0x0c5d('0x37')]=qs[_0x0c5d('0x2f')](_[_0x0c5d('0x38')](_0x54eace[_0x0c5d('0x2e')],_0x3b33e9[_0x0c5d('0x2f')]));if(_0x54eace[_0x0c5d('0x2e')][_0x0c5d('0x39')]){_0x23b075[_0x0c5d('0x37')]=_[_0x0c5d('0x3a')](_0x23b075[_0x0c5d('0x37')],{'$or':_['map'](_0x23b075[_0x0c5d('0x31')],function(_0x32847f){var _0xcf856c={};_0xcf856c[_0x32847f]={'$like':'%'+_0x54eace[_0x0c5d('0x2e')][_0x0c5d('0x39')]+'%'};return _0xcf856c;})});}_0x23b075=_[_0x0c5d('0x3a')]({},_0x23b075,_0x54eace[_0x0c5d('0x53')]);return _0x34d5d2['getContacts'](_0x23b075);}})[_0x0c5d('0x21')](function(_0x4e0720){if(_0x4e0720){_0x533457=_0x4e0720['length'];if(!_0x54eace['query'][_0x0c5d('0x34')](_0x0c5d('0x35'))){_0x23b075[_0x0c5d('0x1a')]=qs['limit'](_0x54eace[_0x0c5d('0x2e')]['limit']);_0x23b075['offset']=qs[_0x0c5d('0x18')](_0x54eace['query'][_0x0c5d('0x18')]);}return _0x34d5d2[_0x0c5d('0x4f')](_0x23b075);}})[_0x0c5d('0x21')](function(_0x2de36c){if(_0x2de36c){return _0x2de36c?{'count':_0x533457,'rows':_0x2de36c}:null;}})['then'](respondWithResult(_0x59c802,null))[_0x0c5d('0x42')](handleError(_0x59c802,null));}; \ No newline at end of file +var _0x816c=['query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','map','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','ids','omit','getContacts','pick','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','Companies','UserProfileResource','destroy','error','send','index','CmCompany','describe','model','keys'];(function(_0x4cbb95,_0x4a3da5){var _0x567495=function(_0x3397c0){while(--_0x3397c0){_0x4cbb95['push'](_0x4cbb95['shift']());}};_0x567495(++_0x4a3da5);}(_0x816c,0x119));var _0xc816=function(_0x265fd0,_0x384bf5){_0x265fd0=_0x265fd0-0x0;var _0x3a6ce1=_0x816c[_0x265fd0];return _0x3a6ce1;};'use strict';var emlformat=require(_0xc816('0x0'));var rimraf=require(_0xc816('0x1'));var zipdir=require(_0xc816('0x2'));var jsonpatch=require(_0xc816('0x3'));var rp=require('request-promise');var moment=require(_0xc816('0x4'));var BPromise=require(_0xc816('0x5'));var Mustache=require(_0xc816('0x6'));var util=require(_0xc816('0x7'));var path=require(_0xc816('0x8'));var sox=require(_0xc816('0x9'));var csv=require(_0xc816('0xa'));var ejs=require(_0xc816('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc816('0xc'));var squel=require(_0xc816('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc816('0xe'));var toCsv=require(_0xc816('0xa'));var querystring=require(_0xc816('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc816('0x10'));var qs=require(_0xc816('0x11'));var as=require(_0xc816('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc816('0x13'))('api');var utils=require(_0xc816('0x14'));var config=require(_0xc816('0x15'));var licenseUtil=require(_0xc816('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ccea6,_0x38c6e3){_0x38c6e3=_0x38c6e3||0xcc;return function(_0x825fa3){if(_0x825fa3){return _0x2ccea6[_0xc816('0x17')](_0x38c6e3);}return _0x2ccea6[_0xc816('0x18')](_0x38c6e3)[_0xc816('0x19')]();};}function respondWithResult(_0xd36602,_0x28b88c){_0x28b88c=_0x28b88c||0xc8;return function(_0x240243){if(_0x240243){return _0xd36602[_0xc816('0x18')](_0x28b88c)[_0xc816('0x1a')](_0x240243);}};}function respondWithFilteredResult(_0x40be37,_0x471dca){return function(_0x5dcc0e){if(_0x5dcc0e){var _0x2a5cda=typeof _0x471dca[_0xc816('0x1b')]===_0xc816('0x1c')&&typeof _0x471dca[_0xc816('0x1d')]===_0xc816('0x1c');var _0x1bf73a=_0x5dcc0e[_0xc816('0x1e')];var _0x1336cb=_0x2a5cda?0x0:_0x471dca[_0xc816('0x1b')];var _0x4c3ae6=_0x2a5cda?_0x5dcc0e[_0xc816('0x1e')]:_0x471dca[_0xc816('0x1b')]+_0x471dca[_0xc816('0x1d')];var _0x37be7e;if(_0x4c3ae6>=_0x1bf73a){_0x4c3ae6=_0x1bf73a;_0x37be7e=0xc8;}else{_0x37be7e=0xce;}_0x40be37[_0xc816('0x18')](_0x37be7e);return _0x40be37['set'](_0xc816('0x1f'),_0x1336cb+'-'+_0x4c3ae6+'/'+_0x1bf73a)[_0xc816('0x1a')](_0x5dcc0e);}return null;};}function patchUpdates(_0x36af42){return function(_0x1e7af7){try{jsonpatch[_0xc816('0x20')](_0x1e7af7,_0x36af42,!![]);}catch(_0x4c60f4){return BPromise[_0xc816('0x21')](_0x4c60f4);}return _0x1e7af7[_0xc816('0x22')]();};}function saveUpdates(_0x1c59e7,_0x145723){return function(_0x281032){if(_0x281032){return _0x281032['update'](_0x1c59e7)[_0xc816('0x23')](function(_0x2fbd3c){return _0x2fbd3c;});}return null;};}function removeEntity(_0x445bae,_0x50fb58){return function(_0x3a6d64){if(_0x3a6d64){return _0x3a6d64['destroy']()[_0xc816('0x23')](function(){var _0x847710=_0x3a6d64[_0xc816('0x24')]({'plain':!![]});var _0x1b89d8=_0xc816('0x25');return db[_0xc816('0x26')][_0xc816('0x27')]({'where':{'type':_0x1b89d8,'resourceId':_0x847710['id']}})[_0xc816('0x23')](function(){return _0x3a6d64;});})[_0xc816('0x23')](function(){_0x445bae[_0xc816('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfbf4e4,_0x3f9d27){return function(_0x48b486){if(!_0x48b486){_0xfbf4e4[_0xc816('0x17')](0x194);}return _0x48b486;};}function handleError(_0x7652fb,_0x23d0b7){_0x23d0b7=_0x23d0b7||0x1f4;return function(_0x159e3f){logger[_0xc816('0x28')](_0x159e3f['stack']);if(_0x159e3f['name']){delete _0x159e3f['name'];}_0x7652fb[_0xc816('0x18')](_0x23d0b7)[_0xc816('0x29')](_0x159e3f);};}exports[_0xc816('0x2a')]=function(_0x397d80,_0x2ecbb3){var _0x1f39cc={},_0x5df332={},_0x31230b={'count':0x0,'rows':[]};return db[_0xc816('0x2b')][_0xc816('0x2c')]()[_0xc816('0x23')](function(_0x488b7c){_0x5df332[_0xc816('0x2d')]=_[_0xc816('0x2e')](_0x488b7c);_0x5df332[_0xc816('0x2f')]=_[_0xc816('0x2e')](_0x397d80[_0xc816('0x2f')]);_0x5df332[_0xc816('0x30')]=_['intersection'](_0x5df332[_0xc816('0x2d')],_0x5df332[_0xc816('0x2f')]);_0x1f39cc[_0xc816('0x31')]=_[_0xc816('0x32')](_0x5df332[_0xc816('0x2d')],qs[_0xc816('0x33')](_0x397d80[_0xc816('0x2f')][_0xc816('0x33')]));_0x1f39cc[_0xc816('0x31')]=_0x1f39cc[_0xc816('0x31')][_0xc816('0x34')]?_0x1f39cc[_0xc816('0x31')]:_0x5df332['model'];if(!_0x397d80[_0xc816('0x2f')]['hasOwnProperty']('nolimit')){_0x1f39cc[_0xc816('0x1d')]=qs[_0xc816('0x1d')](_0x397d80[_0xc816('0x2f')][_0xc816('0x1d')]);_0x1f39cc[_0xc816('0x1b')]=qs['offset'](_0x397d80['query'][_0xc816('0x1b')]);}_0x1f39cc[_0xc816('0x35')]=qs[_0xc816('0x36')](_0x397d80['query'][_0xc816('0x36')]);_0x1f39cc[_0xc816('0x37')]=qs[_0xc816('0x30')](_['pick'](_0x397d80[_0xc816('0x2f')],_0x5df332['filters']),_0x488b7c);if(_0x397d80[_0xc816('0x2f')][_0xc816('0x38')]){_0x1f39cc[_0xc816('0x37')]=_[_0xc816('0x39')](_0x1f39cc[_0xc816('0x37')],{'$or':_[_0xc816('0x3a')](_0x1f39cc[_0xc816('0x31')],function(_0x1556ea){var _0x59183c={};_0x59183c[_0x1556ea]={'$like':'%'+_0x397d80[_0xc816('0x2f')][_0xc816('0x38')]+'%'};return _0x59183c;})});}_0x1f39cc=_[_0xc816('0x39')]({},_0x1f39cc,_0x397d80[_0xc816('0x3b')]);var _0x4d7776={'where':_0x1f39cc[_0xc816('0x37')]};return db['CmCompany']['count'](_0x4d7776)[_0xc816('0x23')](function(_0x3bf6f0){_0x31230b['count']=_0x3bf6f0;if(_0x397d80[_0xc816('0x2f')][_0xc816('0x3c')]){_0x1f39cc[_0xc816('0x3d')]=[{'all':!![]}];}return db[_0xc816('0x2b')]['findAll'](_0x1f39cc);})[_0xc816('0x23')](function(_0x373d1f){_0x31230b['rows']=_0x373d1f;return _0x31230b;})[_0xc816('0x23')](respondWithFilteredResult(_0x2ecbb3,_0x1f39cc))[_0xc816('0x3e')](handleError(_0x2ecbb3,null));})[_0xc816('0x3e')](handleError(_0x2ecbb3,null));};exports['show']=function(_0x4987ac,_0x62174f){var _0x1d8ace={'raw':![],'where':{'id':_0x4987ac[_0xc816('0x3f')]['id']}},_0x2d33ff={};_0x2d33ff[_0xc816('0x2d')]=_[_0xc816('0x2e')](db[_0xc816('0x2b')]['rawAttributes']);_0x2d33ff[_0xc816('0x2f')]=_['keys'](_0x4987ac[_0xc816('0x2f')]);_0x2d33ff[_0xc816('0x30')]=_[_0xc816('0x32')](_0x2d33ff[_0xc816('0x2d')],_0x2d33ff[_0xc816('0x2f')]);_0x1d8ace[_0xc816('0x31')]=_[_0xc816('0x32')](_0x2d33ff['model'],qs[_0xc816('0x33')](_0x4987ac[_0xc816('0x2f')][_0xc816('0x33')]));_0x1d8ace[_0xc816('0x31')]=_0x1d8ace[_0xc816('0x31')]['length']?_0x1d8ace[_0xc816('0x31')]:_0x2d33ff[_0xc816('0x2d')];if(_0x4987ac['query'][_0xc816('0x3c')]){_0x1d8ace[_0xc816('0x3d')]=[{'all':!![]}];}_0x1d8ace=_[_0xc816('0x39')]({},_0x1d8ace,_0x4987ac[_0xc816('0x3b')]);return db[_0xc816('0x2b')][_0xc816('0x40')](_0x1d8ace)[_0xc816('0x23')](handleEntityNotFound(_0x62174f,null))[_0xc816('0x23')](respondWithResult(_0x62174f,null))[_0xc816('0x3e')](handleError(_0x62174f,null));};exports['create']=function(_0x2c6d9a,_0x522e68){return db[_0xc816('0x2b')][_0xc816('0x41')](_0x2c6d9a[_0xc816('0x42')],{})[_0xc816('0x23')](function(_0x15beda){var _0x4ee722=_0x2c6d9a[_0xc816('0x43')][_0xc816('0x24')]({'plain':!![]});if(!_0x4ee722)throw new Error(_0xc816('0x44'));if(_0x4ee722[_0xc816('0x45')]==='user'){var _0x2e883c=_0x15beda[_0xc816('0x24')]({'plain':!![]});var _0x53ab5e='Companies';return db[_0xc816('0x46')]['find']({'where':{'name':_0x53ab5e,'userProfileId':_0x4ee722[_0xc816('0x47')]},'raw':!![]})[_0xc816('0x23')](function(_0x35d8c9){if(_0x35d8c9&&_0x35d8c9['autoAssociation']===0x0){return db[_0xc816('0x26')][_0xc816('0x41')]({'name':_0x2e883c[_0xc816('0x48')],'resourceId':_0x2e883c['id'],'type':_0x35d8c9[_0xc816('0x48')],'sectionId':_0x35d8c9['id']},{})[_0xc816('0x23')](function(){return _0x15beda;});}else{return _0x15beda;}})['catch'](function(_0x3d4cc9){logger[_0xc816('0x28')](_0xc816('0x49'),_0x3d4cc9);throw _0x3d4cc9;});}return _0x15beda;})['then'](respondWithResult(_0x522e68,0xc9))['catch'](handleError(_0x522e68,null));};exports[_0xc816('0x4a')]=function(_0x314678,_0x428e59){if(_0x314678[_0xc816('0x42')]['id']){delete _0x314678[_0xc816('0x42')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x314678[_0xc816('0x3f')]['id']}})['then'](handleEntityNotFound(_0x428e59,null))['then'](saveUpdates(_0x314678[_0xc816('0x42')],null))['then'](respondWithResult(_0x428e59,null))[_0xc816('0x3e')](handleError(_0x428e59,null));};exports['destroy']=function(_0x5a4f3f,_0x354547){return db[_0xc816('0x2b')][_0xc816('0x40')]({'where':{'id':_0x5a4f3f[_0xc816('0x3f')]['id']}})[_0xc816('0x23')](handleEntityNotFound(_0x354547,null))[_0xc816('0x23')](removeEntity(_0x354547,null))[_0xc816('0x3e')](handleError(_0x354547,null));};exports[_0xc816('0x2c')]=function(_0x2da5b7,_0xb52cde){return db['CmCompany'][_0xc816('0x2c')]()[_0xc816('0x23')](respondWithResult(_0xb52cde,null))[_0xc816('0x3e')](handleError(_0xb52cde,null));};exports[_0xc816('0x4b')]=function(_0xe4ab04,_0x30d71d,_0x3d51d7){return db['CmContact'][_0xc816('0x40')]({'where':{'id':_0xe4ab04[_0xc816('0x3f')]['id']}})[_0xc816('0x23')](handleEntityNotFound(_0x30d71d,null))[_0xc816('0x23')](function(_0xae7a03){if(_0xae7a03){return _0xae7a03[_0xc816('0x4b')](_0xe4ab04[_0xc816('0x42')][_0xc816('0x4c')],_[_0xc816('0x4d')](_0xe4ab04[_0xc816('0x42')],[_0xc816('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x30d71d,null))[_0xc816('0x3e')](handleError(_0x30d71d,null));};exports[_0xc816('0x4e')]=function(_0x5f979b,_0x5b24e6,_0x3ee857){var _0x4dbc4e={};var _0x52b5a9={};var _0x2151e8;var _0x11e4ee;return db['CmCompany']['findOne']({'where':{'id':_0x5f979b['params']['id']}})[_0xc816('0x23')](handleEntityNotFound(_0x5b24e6,null))[_0xc816('0x23')](function(_0x216d95){if(_0x216d95){_0x2151e8=_0x216d95;_0x52b5a9[_0xc816('0x2d')]=_[_0xc816('0x2e')](db['CmContact']['rawAttributes']);_0x52b5a9[_0xc816('0x2f')]=_[_0xc816('0x2e')](_0x5f979b[_0xc816('0x2f')]);_0x52b5a9[_0xc816('0x30')]=_['intersection'](_0x52b5a9[_0xc816('0x2d')],_0x52b5a9[_0xc816('0x2f')]);_0x4dbc4e[_0xc816('0x31')]=_[_0xc816('0x32')](_0x52b5a9['model'],qs[_0xc816('0x33')](_0x5f979b[_0xc816('0x2f')][_0xc816('0x33')]));_0x4dbc4e['attributes']=_0x4dbc4e[_0xc816('0x31')]['length']?_0x4dbc4e['attributes']:_0x52b5a9[_0xc816('0x2d')];_0x4dbc4e[_0xc816('0x35')]=qs[_0xc816('0x36')](_0x5f979b[_0xc816('0x2f')][_0xc816('0x36')]);_0x4dbc4e[_0xc816('0x37')]=qs['filters'](_[_0xc816('0x4f')](_0x5f979b[_0xc816('0x2f')],_0x52b5a9[_0xc816('0x30')]));if(_0x5f979b[_0xc816('0x2f')][_0xc816('0x38')]){_0x4dbc4e[_0xc816('0x37')]=_[_0xc816('0x39')](_0x4dbc4e[_0xc816('0x37')],{'$or':_[_0xc816('0x3a')](_0x4dbc4e[_0xc816('0x31')],function(_0x361a13){var _0x323911={};_0x323911[_0x361a13]={'$like':'%'+_0x5f979b['query'][_0xc816('0x38')]+'%'};return _0x323911;})});}_0x4dbc4e=_['merge']({},_0x4dbc4e,_0x5f979b[_0xc816('0x3b')]);return _0x2151e8[_0xc816('0x4e')](_0x4dbc4e);}})[_0xc816('0x23')](function(_0x54c259){if(_0x54c259){_0x11e4ee=_0x54c259[_0xc816('0x34')];if(!_0x5f979b['query'][_0xc816('0x50')](_0xc816('0x51'))){_0x4dbc4e[_0xc816('0x1d')]=qs[_0xc816('0x1d')](_0x5f979b[_0xc816('0x2f')][_0xc816('0x1d')]);_0x4dbc4e[_0xc816('0x1b')]=qs[_0xc816('0x1b')](_0x5f979b[_0xc816('0x2f')]['offset']);}return _0x2151e8['getContacts'](_0x4dbc4e);}})[_0xc816('0x23')](function(_0x59a771){if(_0x59a771){return _0x59a771?{'count':_0x11e4ee,'rows':_0x59a771}:null;}})[_0xc816('0x23')](respondWithResult(_0x5b24e6,null))[_0xc816('0x3e')](handleError(_0x5b24e6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a70fcfe..2593431 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 _0x74a9=['CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x74a9,0xe2));var _0x974a=function(_0x1d4c33,_0x30274f){_0x1d4c33=_0x1d4c33-0x0;var _0x3abfa2=_0x74a9[_0x1d4c33];return _0x3abfa2;};'use strict';var _=require(_0x974a('0x0'));var util=require(_0x974a('0x1'));var logger=require(_0x974a('0x2'))(_0x974a('0x3'));var moment=require(_0x974a('0x4'));var BPromise=require(_0x974a('0x5'));var rp=require(_0x974a('0x6'));var fs=require('fs');var path=require(_0x974a('0x7'));var rimraf=require(_0x974a('0x8'));var config=require(_0x974a('0x9'));var attributes=require('./cmCompany.attributes');module[_0x974a('0xa')]=function(_0x14a486,_0x59119e){return _0x14a486[_0x974a('0xb')](_0x974a('0xc'),attributes,{'tableName':_0x974a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf9f=['define','lodash','util','api','moment','bluebird','path','../../config/environment','./cmCompany.attributes','exports'];(function(_0x321131,_0x266081){var _0x21557a=function(_0x1fc140){while(--_0x1fc140){_0x321131['push'](_0x321131['shift']());}};_0x21557a(++_0x266081);}(_0xcf9f,0xb5));var _0xfcf9=function(_0x2facd6,_0x2aaf16){_0x2facd6=_0x2facd6-0x0;var _0x4fbcb0=_0xcf9f[_0x2facd6];return _0x4fbcb0;};'use strict';var _=require(_0xfcf9('0x0'));var util=require(_0xfcf9('0x1'));var logger=require('../../config/logger')(_0xfcf9('0x2'));var moment=require(_0xfcf9('0x3'));var BPromise=require(_0xfcf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcf9('0x5'));var rimraf=require('rimraf');var config=require(_0xfcf9('0x6'));var attributes=require(_0xfcf9('0x7'));module[_0xfcf9('0x8')]=function(_0x4d74e7,_0x39c9c9){return _0x4d74e7[_0xfcf9('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 7d120f9..5353089 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 _0x70dc=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','CmCompany,\x20%s,\x20%s','result','catch'];(function(_0x2aae9c,_0xe0e9ef){var _0x46643d=function(_0x32f14f){while(--_0x32f14f){_0x2aae9c['push'](_0x2aae9c['shift']());}};_0x46643d(++_0xe0e9ef);}(_0x70dc,0x11e));var _0xc70d=function(_0x5b7eda,_0x557cdd){_0x5b7eda=_0x5b7eda-0x0;var _0x4e18d6=_0x70dc[_0x5b7eda];return _0x4e18d6;};'use strict';var _=require(_0xc70d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc70d('0x1'));var rs=require(_0xc70d('0x2'));var fs=require('fs');var Redis=require(_0xc70d('0x3'));var db=require(_0xc70d('0x4'))['db'];var utils=require(_0xc70d('0x5'));var logger=require(_0xc70d('0x6'))(_0xc70d('0x7'));var config=require(_0xc70d('0x8'));var jayson=require(_0xc70d('0x9'));var client=jayson[_0xc70d('0xa')][_0xc70d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3799e1,_0x16af22,_0x40f6e1){return new BPromise(function(_0x4ae7f9,_0x47daba){return client[_0xc70d('0xc')](_0x3799e1,_0x40f6e1)['then'](function(_0x46fbda){logger[_0xc70d('0xd')]('CmCompany,\x20%s,\x20%s',_0x16af22,_0xc70d('0xe'));logger['debug'](_0xc70d('0xf'),_0x16af22,'request\x20sent',JSON['stringify'](_0x46fbda));if(_0x46fbda[_0xc70d('0x10')]){if(_0x46fbda[_0xc70d('0x10')][_0xc70d('0x11')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x16af22,_0x46fbda[_0xc70d('0x10')][_0xc70d('0x12')]);return _0x47daba(_0x46fbda[_0xc70d('0x10')][_0xc70d('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x16af22,_0x46fbda['error'][_0xc70d('0x12')]);return _0x4ae7f9(_0x46fbda[_0xc70d('0x10')][_0xc70d('0x12')]);}else{logger[_0xc70d('0xd')](_0xc70d('0x13'),_0x16af22,'request\x20sent');_0x4ae7f9(_0x46fbda[_0xc70d('0x14')][_0xc70d('0x12')]);}})[_0xc70d('0x15')](function(_0x4b42bc){logger['error'](_0xc70d('0x13'),_0x16af22,_0x4b42bc);_0x47daba(_0x4b42bc);});});} \ No newline at end of file +var _0xc259=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc259,0x9b));var _0x9c25=function(_0x558270,_0x4e4c68){_0x558270=_0x558270-0x0;var _0xcab0b0=_0xc259[_0x558270];return _0xcab0b0;};'use strict';var _=require(_0x9c25('0x0'));var util=require(_0x9c25('0x1'));var moment=require(_0x9c25('0x2'));var BPromise=require(_0x9c25('0x3'));var rs=require(_0x9c25('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c25('0x5'))['db'];var utils=require(_0x9c25('0x6'));var logger=require(_0x9c25('0x7'))(_0x9c25('0x8'));var config=require(_0x9c25('0x9'));var jayson=require(_0x9c25('0xa'));var client=jayson['client'][_0x9c25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e27e0,_0x37147,_0x3bfab3){return new BPromise(function(_0x1f6195,_0x327145){return client[_0x9c25('0xc')](_0x1e27e0,_0x3bfab3)['then'](function(_0x399294){logger['info'](_0x9c25('0xd'),_0x37147,_0x9c25('0xe'));logger[_0x9c25('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x37147,_0x9c25('0xe'),JSON[_0x9c25('0x10')](_0x399294));if(_0x399294[_0x9c25('0x11')]){if(_0x399294[_0x9c25('0x11')][_0x9c25('0x12')]===0x1f4){logger[_0x9c25('0x11')](_0x9c25('0xd'),_0x37147,_0x399294['error'][_0x9c25('0x13')]);return _0x327145(_0x399294[_0x9c25('0x11')]['message']);}logger[_0x9c25('0x11')](_0x9c25('0xd'),_0x37147,_0x399294[_0x9c25('0x11')][_0x9c25('0x13')]);return _0x1f6195(_0x399294[_0x9c25('0x11')][_0x9c25('0x13')]);}else{logger[_0x9c25('0x14')](_0x9c25('0xd'),_0x37147,_0x9c25('0xe'));_0x1f6195(_0x399294[_0x9c25('0x15')]['message']);}})[_0x9c25('0x16')](function(_0x43f782){logger['error'](_0x9c25('0xd'),_0x37147,_0x43f782);_0x327145(_0x43f782);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ee0e2b3..9626808 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 _0x7f0d=['../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','post','/:id/contacts','addContacts','put','delete','destroy','exports','multer','express','Router','../../components/auth/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7f0d,0x1b4));var _0xd7f0=function(_0x1622bc,_0x5bfde3){_0x1622bc=_0x1622bc-0x0;var _0x3c476f=_0x7f0d[_0x1622bc];return _0x3c476f;};'use strict';var multer=require(_0xd7f0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd7f0('0x1'));var router=express[_0xd7f0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd7f0('0x3'));var interaction=require(_0xd7f0('0x4'));var config=require(_0xd7f0('0x5'));var controller=require(_0xd7f0('0x6'));router[_0xd7f0('0x7')]('/',auth[_0xd7f0('0x8')](),controller[_0xd7f0('0x9')]);router[_0xd7f0('0x7')](_0xd7f0('0xa'),auth[_0xd7f0('0x8')](),controller[_0xd7f0('0xb')]);router[_0xd7f0('0x7')](_0xd7f0('0xc'),auth[_0xd7f0('0x8')](),controller[_0xd7f0('0xd')]);router[_0xd7f0('0x7')]('/:id/contacts',auth[_0xd7f0('0x8')](),controller['getContacts']);router['post']('/',auth[_0xd7f0('0x8')](),controller[_0xd7f0('0xe')]);router[_0xd7f0('0xf')](_0xd7f0('0x10'),auth['isAuthenticated'](),controller[_0xd7f0('0x11')]);router[_0xd7f0('0x12')](_0xd7f0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd7f0('0x13')](_0xd7f0('0xc'),auth[_0xd7f0('0x8')](),controller[_0xd7f0('0x14')]);module[_0xd7f0('0x15')]=router; \ No newline at end of file +var _0xbec1=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/contacts','post','addContacts','put'];(function(_0x4bd3ae,_0x5c4edb){var _0x13cf8c=function(_0x5e1184){while(--_0x5e1184){_0x4bd3ae['push'](_0x4bd3ae['shift']());}};_0x13cf8c(++_0x5c4edb);}(_0xbec1,0x152));var _0x1bec=function(_0x25166c,_0x26c838){_0x25166c=_0x25166c-0x0;var _0x1021f2=_0xbec1[_0x25166c];return _0x1021f2;};'use strict';var multer=require(_0x1bec('0x0'));var util=require(_0x1bec('0x1'));var path=require(_0x1bec('0x2'));var timeout=require(_0x1bec('0x3'));var express=require(_0x1bec('0x4'));var router=express[_0x1bec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1bec('0x7'));var controller=require(_0x1bec('0x8'));router['get']('/',auth[_0x1bec('0x9')](),controller[_0x1bec('0xa')]);router[_0x1bec('0xb')](_0x1bec('0xc'),auth[_0x1bec('0x9')](),controller['describe']);router[_0x1bec('0xb')](_0x1bec('0xd'),auth['isAuthenticated'](),controller[_0x1bec('0xe')]);router[_0x1bec('0xb')](_0x1bec('0xf'),auth[_0x1bec('0x9')](),controller['getContacts']);router['post']('/',auth[_0x1bec('0x9')](),controller['create']);router[_0x1bec('0x10')]('/:id/contacts',auth[_0x1bec('0x9')](),controller[_0x1bec('0x11')]);router[_0x1bec('0x12')](_0x1bec('0xd'),auth[_0x1bec('0x9')](),controller['update']);router[_0x1bec('0x13')](_0x1bec('0xd'),auth[_0x1bec('0x9')](),controller['destroy']);module[_0x1bec('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8c38e63..636941f 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 _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x5493c8,_0x232b6d){var _0x3d008f=function(_0x5338e2){while(--_0x5338e2){_0x5493c8['push'](_0x5493c8['shift']());}};_0x3d008f(++_0x232b6d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52cbf8,_0x15934f){_0x52cbf8=_0x52cbf8-0x0;var _0x5a38af=_0x5f2f[_0x52cbf8];return _0x5a38af;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x757a=['STRING','TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x757a,0xde));var _0xa757=function(_0x101fd8,_0x69e68e){_0x101fd8=_0x101fd8-0x0;var _0x45ad7f=_0x757a[_0x101fd8];return _0x45ad7f;};'use strict';var _=require('lodash');var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa757('0x2')]},'city':{'type':Sequelize[_0xa757('0x2')]},'country':{'type':Sequelize[_0xa757('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa757('0x2')]},'description':{'type':Sequelize[_0xa757('0x3')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa757('0x2')]},'email':{'type':Sequelize[_0xa757('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa757('0x2')]},'fb_data':{'type':Sequelize[_0xa757('0x2')]},'twitter':{'type':Sequelize[_0xa757('0x2')]},'skype':{'type':Sequelize[_0xa757('0x2')]},'teams':{'type':Sequelize[_0xa757('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa757('0x2')]},'wechat':{'type':Sequelize[_0xa757('0x2')]},'telegram':{'type':Sequelize[_0xa757('0x2')]},'UserId':{'type':Sequelize[_0xa757('0x4')]},'priority':{'type':Sequelize[_0xa757('0x4')](0x2)[_0xa757('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa757('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e33521c..03d3ef9 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 _0x7ece=['filter','isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.id','QueryTypes','SELECT','clone','DESC','having','resolve','agent','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','user','sequelize','toString','keyBy','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','push','rows','catch','columnName','displayName','custom','values','merge','body','findAll','tags','join','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','dialTimezone','timezones','utcOffset','bulkCreate','duplicates','$or','findOrCreate','spread','params','name','get','$and','omit','format','cf_%d','pickBy','table','CmHopper','phone','rawAttributes','options','getTags','setTags','ids','findOne','ContactId','includeAll','include','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','userSecondDisposition','userThirdDisposition','UserId','createdAt','fullname','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingType','referer','subject','substatus','externalUrl','Interaction','findAndCountAll','flatten','slice','moment','bluebird','util','path','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmContact.socket','register','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','end','error','stack','index','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','trimStart','all','fieldType','type','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','select','field','color','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','map','hasOwnProperty'];(function(_0x1acdd9,_0x4be278){var _0x2058c4=function(_0x1bc472){while(--_0x1bc472){_0x1acdd9['push'](_0x1acdd9['shift']());}};_0x2058c4(++_0x4be278);}(_0x7ece,0x1e3));var _0xe7ec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7ece[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0xe7ec('0x0'));var BPromise=require(_0xe7ec('0x1'));var util=require(_0xe7ec('0x2'));var path=require(_0xe7ec('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe7ec('0x4'));var Papa=require('papaparse');var Redis=require(_0xe7ec('0x5'));var qs=require(_0xe7ec('0x6'));var as=require(_0xe7ec('0x7'));var logger=require(_0xe7ec('0x8'))(_0xe7ec('0x9'));var config=require(_0xe7ec('0xa'));var shared=require('../../config/environment/shared');var db=require(_0xe7ec('0xb'))['db'];config[_0xe7ec('0xc')]=_['defaults'](config[_0xe7ec('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe7ec('0xd'))(new Redis(config[_0xe7ec('0xc')]));require(_0xe7ec('0xe'))[_0xe7ec('0xf')](socket);function respondWithResult(_0x35535d,_0x266545){_0x266545=_0x266545||0xc8;return function(_0x508d15){if(_0x508d15){return _0x35535d['status'](_0x266545)['json'](_0x508d15);}};}function respondWithFilteredResult(_0x12f3e1,_0x365503){return function(_0x1a4b6f){if(_0x1a4b6f){var _0x4411f2=typeof _0x365503[_0xe7ec('0x10')]===_0xe7ec('0x11')&&typeof _0x365503[_0xe7ec('0x12')]===_0xe7ec('0x11');var _0x547c89=_0x1a4b6f[_0xe7ec('0x13')];var _0x3ec268=_0x4411f2?0x0:_0x365503[_0xe7ec('0x10')];var _0x1890fa=_0x4411f2?_0x1a4b6f[_0xe7ec('0x13')]:_0x365503[_0xe7ec('0x10')]+_0x365503[_0xe7ec('0x12')];var _0x5ec861;if(_0x1890fa>=_0x547c89){_0x1890fa=_0x547c89;_0x5ec861=0xc8;}else{_0x5ec861=0xce;}_0x12f3e1[_0xe7ec('0x14')](_0x5ec861);return _0x12f3e1[_0xe7ec('0x15')](_0xe7ec('0x16'),_0x3ec268+'-'+_0x1890fa+'/'+_0x547c89)[_0xe7ec('0x17')](_0x1a4b6f);}return null;};}function saveUpdates(_0x5bdd19){return function(_0x1f79b7){if(_0x1f79b7){return _0x1f79b7[_0xe7ec('0x18')](_0x5bdd19)[_0xe7ec('0x19')](function(_0x1c5016){return _0x1c5016;});}return null;};}function removeEntity(_0x2a70cb){return function(_0x3397da){if(_0x3397da){return _0x3397da[_0xe7ec('0x1a')]()['then'](function(){_0x2a70cb['status'](0xcc)[_0xe7ec('0x1b')]();});}};}function handleEntityNotFound(_0x490e83){return function(_0xb61f2d){if(!_0xb61f2d){_0x490e83['sendStatus'](0x194);}return _0xb61f2d;};}function handleError(_0x284c37,_0x42b287){_0x42b287=_0x42b287||0x1f4;return function(_0x30ca28){logger[_0xe7ec('0x1c')](_0x30ca28[_0xe7ec('0x1d')]);if(_0x30ca28['name']){delete _0x30ca28['name'];}_0x284c37[_0xe7ec('0x14')](_0x42b287)['send'](_0x30ca28);};}exports[_0xe7ec('0x1e')]=function(_0x349717,_0x1285ec){var _0x5349bd={},_0x11d3ca={},_0x3e51ae={'count':0x0,'rows':[]};return db[_0xe7ec('0x1f')][_0xe7ec('0x20')]()[_0xe7ec('0x19')](function(_0x169f07){var _0x4c63be=[];for(var _0x872ccb=0x0;_0x872ccb0x1){_0x176536['or'](_0xe7ec('0x64'),qs[_0xe7ec('0x65')](_0x4dafa1),null);}else{if(qs[_0xe7ec('0x66')](_0x4dafa1)){_0x176536['or'](_0xe7ec('0x67'),_0x4dafa1+'%');_0x176536['or'](_0xe7ec('0x68'),_0x4dafa1+'%');_0x176536['or']('c.mobile\x20LIKE\x20?',_0x4dafa1+'%');_0x176536['or'](_0xe7ec('0x69'),_0x4dafa1+'%');}else if(qs[_0xe7ec('0x6a')](_0x4dafa1)){_0x176536['or'](_0xe7ec('0x6b'),_0x4dafa1+'%');}else{_0x176536['or'](_0xe7ec('0x6c'),'%'+_0x4dafa1+'%');_0x176536['or']('c.lastName\x20LIKE\x20?','%'+_0x4dafa1+'%');_0x176536['or'](_0xe7ec('0x6b'),'%'+_0x4dafa1+'%');}}}}_0x233708[_0xe7ec('0x33')](_0x176536);_0x233708['group'](_0xe7ec('0x6d'));var _0x55096b={'type':db['Sequelize'][_0xe7ec('0x6e')][_0xe7ec('0x6f')],'raw':!![]};var _0x11767d=_0x233708[_0xe7ec('0x70')]()[_0xe7ec('0x36')](_0xe7ec('0x6d'));if(_0x5349bd[_0xe7ec('0x31')]){_0x5349bd[_0xe7ec('0x31')][_0xe7ec('0x4b')](function(_0x1e47e0){_0x233708['order']('c.'+_0x1e47e0[0x0],_0x1e47e0[0x1]===_0xe7ec('0x71')?![]:!![]);});}if(!_['isEmpty'](_0x1d4d7b)){_0x233708[_0xe7ec('0x72')](_0x9f2283);_0x11767d[_0xe7ec('0x33')]('t.id\x20IN\x20?',_0x1d4d7b);}BPromise[_0xe7ec('0x73')]()[_0xe7ec('0x19')](function(){if(!_0x34e5d7)return;if(_0x349717['user']['role']!==_0xe7ec('0x74'))return;if(!_['some'](_0x34e5d7[_0xe7ec('0x46')],[_0xe7ec('0x36'),'User'])){return _0x349717['user'][_0xe7ec('0x75')]({'attributes':['id'],'raw':!![]})[_0xe7ec('0x19')](function(_0x1efff7){if(_[_0xe7ec('0x5c')](_0x1efff7)){_0x11767d[_0xe7ec('0x33')]('c.ListId\x20IS\x20NULL');_0x233708[_0xe7ec('0x33')](_0xe7ec('0x76'));}else{_0x11767d[_0xe7ec('0x33')](_0xe7ec('0x77'),_['map'](_0x1efff7,'id'));_0x233708['where'](_0xe7ec('0x77'),_[_0xe7ec('0x57')](_0x1efff7,'id'));}});}})[_0xe7ec('0x19')](function(){if(_0x349717[_0xe7ec('0x78')]['role']===_0xe7ec('0x74')&&!_0x34e5d7&&!_0x349717[_0xe7ec('0x2a')]['ListId'])return[];return db[_0xe7ec('0x79')][_0xe7ec('0x2a')](_0x11767d['toString'](),_0x55096b);})[_0xe7ec('0x19')](function(_0x2ee3f3){_0x3e51ae[_0xe7ec('0x13')]=_0x2ee3f3[_0xe7ec('0x22')];if(_0x3e51ae['count']===0x0)return[];return db['sequelize']['query'](_0x37b946[_0xe7ec('0x7a')](),_0x55096b)[_0xe7ec('0x19')](function(_0x207e8b){_0x3fc32e=_[_0xe7ec('0x7b')](_0x207e8b,'id');_0x55096b=_['merge'](_0x55096b,{'model':db[_0xe7ec('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x349717['query']['fields']){_0x5349bd[_0xe7ec('0x2f')][_0xe7ec('0x4b')](function(_0x79587){_0x233708[_0xe7ec('0x36')]('c.'+_0x79587);});}else{_0x233708[_0xe7ec('0x36')](_0xe7ec('0x6d'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7c'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7d'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7e'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x7f'));_0x233708[_0xe7ec('0x36')]('c.fax');_0x233708[_0xe7ec('0x36')](_0xe7ec('0x80'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x81'));_0x233708['field'](_0xe7ec('0x82'));_0x233708['field'](_0xe7ec('0x83'));_0x233708[_0xe7ec('0x36')](_0xe7ec('0x84'));_0x233708[_0xe7ec('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe7ec('0x85'));}if(_0x5349bd[_0xe7ec('0x12')])_0x233708[_0xe7ec('0x12')](_0x5349bd[_0xe7ec('0x12')]);if(_0x5349bd[_0xe7ec('0x10')])_0x233708['offset'](_0x5349bd[_0xe7ec('0x10')]);return db['sequelize'][_0xe7ec('0x2a')](_0x233708[_0xe7ec('0x7a')](),_0x55096b);});})['then'](function(_0x1a741f){_0x1a741f[_0xe7ec('0x4b')](function(_0x49e977){if(_0x49e977[_0xe7ec('0x85')]){_0x49e977[_0xe7ec('0x86')]=[];_0x49e977[_0xe7ec('0x85')][_0xe7ec('0x4a')](',')[_0xe7ec('0x4b')](function(_0x40bbd0){_0x49e977[_0xe7ec('0x86')][_0xe7ec('0x87')](_0x3fc32e[_0x40bbd0]);});}delete _0x49e977['TagIds'];});_0x3e51ae[_0xe7ec('0x88')]=_0x1a741f;return _0x3e51ae;})[_0xe7ec('0x19')](respondWithFilteredResult(_0x1285ec,_0x5349bd));})[_0xe7ec('0x89')](handleError(_0x1285ec,null));};exports[_0xe7ec('0x1a')]=function(_0x344e23,_0x3c1117){return db[_0xe7ec('0x1f')]['find']({'where':{'id':_0x344e23['params']['id']}})['then'](handleEntityNotFound(_0x3c1117,null))[_0xe7ec('0x19')](removeEntity(_0x3c1117,null))[_0xe7ec('0x89')](handleError(_0x3c1117,null));};exports[_0xe7ec('0x20')]=function(_0x4faed3,_0x9cda0b){return db[_0xe7ec('0x1f')][_0xe7ec('0x20')]()[_0xe7ec('0x19')](function(_0x5f4ffc){delete _0x5f4ffc['tags'];for(var _0xac12d9=0x0;_0xac12d9=_0x2ef9d0){_0x22d61b=_0x2ef9d0;_0xb92f54=0xc8;}else{_0xb92f54=0xce;}_0x18faf1[_0xebb1('0x10')](_0xb92f54);return _0x18faf1[_0xebb1('0x16')]('Content-Range',_0x4d5094+'-'+_0x22d61b+'/'+_0x2ef9d0)[_0xebb1('0x11')](_0xc97362);}return null;};}function saveUpdates(_0x1aa214){return function(_0x2e9563){if(_0x2e9563){return _0x2e9563['update'](_0x1aa214)[_0xebb1('0x17')](function(_0x3d116e){return _0x3d116e;});}return null;};}function removeEntity(_0x12ea6b){return function(_0x42c1bc){if(_0x42c1bc){return _0x42c1bc[_0xebb1('0x18')]()['then'](function(){_0x12ea6b[_0xebb1('0x10')](0xcc)[_0xebb1('0x19')]();});}};}function handleEntityNotFound(_0xd95664){return function(_0x24c5cc){if(!_0x24c5cc){_0xd95664[_0xebb1('0x1a')](0x194);}return _0x24c5cc;};}function handleError(_0x2418c2,_0x416bf3){_0x416bf3=_0x416bf3||0x1f4;return function(_0x4f2583){logger['error'](_0x4f2583[_0xebb1('0x1b')]);if(_0x4f2583['name']){delete _0x4f2583[_0xebb1('0x1c')];}_0x2418c2[_0xebb1('0x10')](_0x416bf3)[_0xebb1('0x1d')](_0x4f2583);};}exports['index']=function(_0x52f35f,_0x46b273){var _0xdc0bd0={},_0x2c73db={},_0x22acb1={'count':0x0,'rows':[]};return db[_0xebb1('0x1e')]['describe']()[_0xebb1('0x17')](function(_0x4500ab){var _0x3ae018=[];for(var _0x59801c=0x0;_0x59801c0x1){_0x3d54f0['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x58ba20),null);}else{if(qs[_0xebb1('0x5e')](_0x58ba20)){_0x3d54f0['or']('c.id\x20LIKE\x20?',_0x58ba20+'%');_0x3d54f0['or'](_0xebb1('0x5f'),_0x58ba20+'%');_0x3d54f0['or'](_0xebb1('0x60'),_0x58ba20+'%');_0x3d54f0['or'](_0xebb1('0x61'),_0x58ba20+'%');}else if(qs['isEmail'](_0x58ba20)){_0x3d54f0['or'](_0xebb1('0x62'),_0x58ba20+'%');}else{_0x3d54f0['or'](_0xebb1('0x63'),'%'+_0x58ba20+'%');_0x3d54f0['or']('c.lastName\x20LIKE\x20?','%'+_0x58ba20+'%');_0x3d54f0['or'](_0xebb1('0x62'),'%'+_0x58ba20+'%');}}}}_0x3e0173[_0xebb1('0x33')](_0x3d54f0);_0x3e0173['group'](_0xebb1('0x64'));var _0x383cbf={'type':db['Sequelize'][_0xebb1('0x65')][_0xebb1('0x66')],'raw':!![]};var _0x54f36d=_0x3e0173['clone']()[_0xebb1('0x36')]('c.id');if(_0xdc0bd0[_0xebb1('0x31')]){_0xdc0bd0[_0xebb1('0x31')][_0xebb1('0x55')](function(_0x559695){_0x3e0173[_0xebb1('0x31')]('c.'+_0x559695[0x0],_0x559695[0x1]===_0xebb1('0x67')?![]:!![]);});}if(!_['isEmpty'](_0x34e982)){_0x3e0173[_0xebb1('0x68')](_0x578704);_0x54f36d[_0xebb1('0x33')]('t.id\x20IN\x20?',_0x34e982);}BPromise[_0xebb1('0x69')]()[_0xebb1('0x17')](function(){if(!_0x333d84)return;if(_0x52f35f[_0xebb1('0x6a')][_0xebb1('0x6b')]!==_0xebb1('0x6c'))return;if(!_[_0xebb1('0x6d')](_0x333d84[_0xebb1('0x41')],[_0xebb1('0x36'),_0xebb1('0x47')])){return _0x52f35f[_0xebb1('0x6a')][_0xebb1('0x6e')]({'attributes':['id'],'raw':!![]})[_0xebb1('0x17')](function(_0x497c22){if(_[_0xebb1('0x54')](_0x497c22)){_0x54f36d[_0xebb1('0x33')](_0xebb1('0x6f'));_0x3e0173[_0xebb1('0x33')](_0xebb1('0x6f'));}else{_0x54f36d[_0xebb1('0x33')](_0xebb1('0x57'),_['map'](_0x497c22,'id'));_0x3e0173['where'](_0xebb1('0x57'),_[_0xebb1('0x50')](_0x497c22,'id'));}});}})[_0xebb1('0x17')](function(){if(_0x52f35f[_0xebb1('0x6a')][_0xebb1('0x6b')]===_0xebb1('0x6c')&&!_0x333d84&&!_0x52f35f['query'][_0xebb1('0x56')])return[];return db[_0xebb1('0x70')]['query'](_0x54f36d[_0xebb1('0x71')](),_0x383cbf);})[_0xebb1('0x17')](function(_0x3bdd71){_0x22acb1['count']=_0x3bdd71[_0xebb1('0x26')];if(_0x22acb1['count']===0x0)return[];return db[_0xebb1('0x70')]['query'](_0x5bea42['toString'](),_0x383cbf)[_0xebb1('0x17')](function(_0x10d532){_0x4064ae=_[_0xebb1('0x72')](_0x10d532,'id');_0x383cbf=_['merge'](_0x383cbf,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52f35f['query'][_0xebb1('0x2e')]){_0xdc0bd0[_0xebb1('0x2c')]['forEach'](function(_0x39b0d6){_0x3e0173[_0xebb1('0x36')]('c.'+_0x39b0d6);});}else{_0x3e0173[_0xebb1('0x36')](_0xebb1('0x64'));_0x3e0173[_0xebb1('0x36')]('c.firstName');_0x3e0173['field'](_0xebb1('0x73'));_0x3e0173[_0xebb1('0x36')](_0xebb1('0x74'));_0x3e0173[_0xebb1('0x36')]('c.mobile');_0x3e0173[_0xebb1('0x36')]('c.fax');_0x3e0173[_0xebb1('0x36')](_0xebb1('0x75'));_0x3e0173[_0xebb1('0x36')](_0xebb1('0x76'));_0x3e0173[_0xebb1('0x36')](_0xebb1('0x77'));_0x3e0173[_0xebb1('0x36')]('c.deletedAt');_0x3e0173['field'](_0xebb1('0x78'));_0x3e0173[_0xebb1('0x36')](_0xebb1('0x79'),_0xebb1('0x7a'));}if(_0xdc0bd0[_0xebb1('0x14')])_0x3e0173[_0xebb1('0x14')](_0xdc0bd0[_0xebb1('0x14')]);if(_0xdc0bd0['offset'])_0x3e0173['offset'](_0xdc0bd0[_0xebb1('0x12')]);return db[_0xebb1('0x70')]['query'](_0x3e0173[_0xebb1('0x71')](),_0x383cbf);});})[_0xebb1('0x17')](function(_0x48fe90){_0x48fe90[_0xebb1('0x55')](function(_0x203cb1){if(_0x203cb1['TagIds']){_0x203cb1[_0xebb1('0x7b')]=[];_0x203cb1['TagIds'][_0xebb1('0x5d')](',')[_0xebb1('0x55')](function(_0x20e43f){_0x203cb1[_0xebb1('0x7b')][_0xebb1('0x22')](_0x4064ae[_0x20e43f]);});}delete _0x203cb1[_0xebb1('0x7a')];});_0x22acb1[_0xebb1('0x7c')]=_0x48fe90;return _0x22acb1;})['then'](respondWithFilteredResult(_0x46b273,_0xdc0bd0));})[_0xebb1('0x7d')](handleError(_0x46b273,null));};exports[_0xebb1('0x18')]=function(_0x1369b4,_0xcce191){return db[_0xebb1('0x1e')][_0xebb1('0x42')]({'where':{'id':_0x1369b4[_0xebb1('0x7e')]['id']}})['then'](handleEntityNotFound(_0xcce191,null))[_0xebb1('0x17')](removeEntity(_0xcce191,null))['catch'](handleError(_0xcce191,null));};exports[_0xebb1('0x7f')]=function(_0x312e90,_0x58707f){return db[_0xebb1('0x1e')][_0xebb1('0x7f')]()['then'](function(_0x89ad99){delete _0x89ad99['tags'];for(var _0x483be7=0x0;_0x483be7{}\s\\|]/g,'-');_0x1c2447(null,util[_0xaa60('0x25')](_0xaa60('0x26'),path[_0xaa60('0x27')](_0x10c33b[_0xaa60('0x23')],path['extname'](_0x10c33b[_0xaa60('0x23')])),Date[_0xaa60('0x28')](),path[_0xaa60('0x29')](_0x10c33b[_0xaa60('0x23')])));}})});router[_0xaa60('0x1c')]('/csv',upload['single'](_0xaa60('0x2a')),controller[_0xaa60('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48d281,_0x3998ee,_0x2d6727){_0x2d6727(null,path[_0xaa60('0x20')](config[_0xaa60('0x21')],_0xaa60('0x22')));},'filename':function(_0x55c286,_0x39d11b,_0x436929){_0x39d11b['originalname']=_0x39d11b[_0xaa60('0x23')][_0xaa60('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x436929(null,util[_0xaa60('0x25')](_0xaa60('0x26'),path[_0xaa60('0x27')](_0x39d11b['originalname'],path[_0xaa60('0x29')](_0x39d11b[_0xaa60('0x23')])),Date[_0xaa60('0x28')](),path[_0xaa60('0x29')](_0x39d11b[_0xaa60('0x23')])));}})});router[_0xaa60('0x1c')](_0xaa60('0x2c'),upload['single'](_0xaa60('0x2a')),controller['upload']);router[_0xaa60('0x1c')](_0xaa60('0x2d'),auth['isAuthenticated'](),controller[_0xaa60('0x2e')]);router['put'](_0xaa60('0x10'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x2f')]);router['delete'](_0xaa60('0x10'),auth[_0xaa60('0xb')](),controller[_0xaa60('0x30')]);module['exports']=router; \ No newline at end of file +var _0xb724=['single','upload','/upload/:id','import','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./cmContact.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','getJourney','/merge','merge','post','create','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','now','file','uploadCsv','/upload'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb724,0x174));var _0x4b72=function(_0x2c9fff,_0x2d8356){_0x2c9fff=_0x2c9fff-0x0;var _0x2e10e9=_0xb724[_0x2c9fff];return _0x2e10e9;};'use strict';var multer=require(_0x4b72('0x0'));var util=require(_0x4b72('0x1'));var path=require(_0x4b72('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4b72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4b72('0x4'));var interaction=require(_0x4b72('0x5'));var config=require('../../config/environment');var controller=require(_0x4b72('0x6'));router['get']('/',auth[_0x4b72('0x7')](),controller[_0x4b72('0x8')]);router[_0x4b72('0x9')](_0x4b72('0xa'),auth[_0x4b72('0x7')](),controller[_0x4b72('0xb')]);router[_0x4b72('0x9')](_0x4b72('0xc'),auth[_0x4b72('0x7')](),controller[_0x4b72('0xd')]);router[_0x4b72('0x9')](_0x4b72('0xe'),auth[_0x4b72('0x7')](),controller[_0x4b72('0xf')]);router['get'](_0x4b72('0x10'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x11')]);router['get'](_0x4b72('0x12'),auth['isAuthenticated'](),controller[_0x4b72('0x13')]);router[_0x4b72('0x9')](_0x4b72('0x14'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x15')]);router[_0x4b72('0x9')](_0x4b72('0x16'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x17')]);router[_0x4b72('0x9')]('/:id/journey',auth['isAuthenticated'](),controller[_0x4b72('0x18')]);router['post'](_0x4b72('0x19'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x1a')]);router[_0x4b72('0x1b')]('/',auth[_0x4b72('0x7')](),controller[_0x4b72('0x1c')]);router[_0x4b72('0x1b')]('/create_many',auth[_0x4b72('0x7')](),controller[_0x4b72('0x1d')]);router['post'](_0x4b72('0xe'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x1e')]);var upload=multer({'storage':multer[_0x4b72('0x1f')]({'destination':function(_0x2282f3,_0x3092bb,_0x966ca8){_0x966ca8(null,path[_0x4b72('0x20')](config[_0x4b72('0x21')],_0x4b72('0x22')));},'filename':function(_0x48cc6b,_0x145bb8,_0x96498a){_0x145bb8[_0x4b72('0x23')]=_0x145bb8[_0x4b72('0x23')][_0x4b72('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x96498a(null,util['format'](_0x4b72('0x25'),path[_0x4b72('0x26')](_0x145bb8[_0x4b72('0x23')],path[_0x4b72('0x27')](_0x145bb8['originalname'])),Date[_0x4b72('0x28')](),path[_0x4b72('0x27')](_0x145bb8[_0x4b72('0x23')])));}})});router['post']('/csv',upload['single'](_0x4b72('0x29')),controller[_0x4b72('0x2a')]);var upload=multer({'storage':multer[_0x4b72('0x1f')]({'destination':function(_0x4cb560,_0x29df02,_0x51fdda){_0x51fdda(null,path[_0x4b72('0x20')](config[_0x4b72('0x21')],'server/files/tmp'));},'filename':function(_0x175c08,_0xc696e8,_0x4a2f02){_0xc696e8[_0x4b72('0x23')]=_0xc696e8[_0x4b72('0x23')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4a2f02(null,util['format'](_0x4b72('0x25'),path[_0x4b72('0x26')](_0xc696e8[_0x4b72('0x23')],path[_0x4b72('0x27')](_0xc696e8[_0x4b72('0x23')])),Date[_0x4b72('0x28')](),path[_0x4b72('0x27')](_0xc696e8[_0x4b72('0x23')])));}})});router[_0x4b72('0x1b')](_0x4b72('0x2b'),upload[_0x4b72('0x2c')](_0x4b72('0x29')),controller[_0x4b72('0x2d')]);router[_0x4b72('0x1b')](_0x4b72('0x2e'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x2f')]);router[_0x4b72('0x30')](_0x4b72('0xc'),auth[_0x4b72('0x7')](),controller[_0x4b72('0x31')]);router[_0x4b72('0x32')](_0x4b72('0xc'),auth[_0x4b72('0x7')](),controller['destroy']);module[_0x4b72('0x33')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 759e596..a33cbf2 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 _0x6cfe=['values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','long','type','select'];(function(_0x2d89dd,_0x40929a){var _0x3c4bbe=function(_0x3158f1){while(--_0x3158f1){_0x2d89dd['push'](_0x2d89dd['shift']());}};_0x3c4bbe(++_0x40929a);}(_0x6cfe,0x146));var _0xe6cf=function(_0x19e432,_0xba4339){_0x19e432=_0x19e432-0x0;var _0x30b89a=_0x6cfe[_0x19e432];return _0x30b89a;};'use strict';var Sequelize=require(_0xe6cf('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xe6cf('0x1')],'get':function(_0x92ac60){return this[_0xe6cf('0x2')]('alias');}},'alias':{'type':Sequelize[_0xe6cf('0x3')],'allowNull':![],'set':function(_0x247408){this[_0xe6cf('0x4')](_0xe6cf('0x5'),_0x247408?_0x247408:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xe6cf('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xe6cf('0x6')](_0xe6cf('0x7')),'get':function(){if(this[_0xe6cf('0x2')](_0xe6cf('0x8'))===_0xe6cf('0x9')){return JSON['parse'](this['getDataValue']('values'));}else{return this['getDataValue'](_0xe6cf('0xa'));}},'set':function(_0x5cbe9d){if(Array[_0xe6cf('0xb')](_0x5cbe9d)){this['setDataValue'](_0xe6cf('0xa'),JSON[_0xe6cf('0xc')](_0x5cbe9d));}else{this['setDataValue']('values',_0x5cbe9d);}}},'required':{'type':Sequelize[_0xe6cf('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe6cf('0xe')](_0xe6cf('0xf'))}}; \ No newline at end of file +var _0xff0f=['parse','values','stringify','BOOLEAN','voice','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select'];(function(_0x3abb9a,_0x43a20a){var _0x3d70f6=function(_0xca58c8){while(--_0xca58c8){_0x3abb9a['push'](_0x3abb9a['shift']());}};_0x3d70f6(++_0x43a20a);}(_0xff0f,0xf5));var _0xfff0=function(_0x3ed1a0,_0x2a4505){_0x3ed1a0=_0x3ed1a0-0x0;var _0x47d58f=_0xff0f[_0x3ed1a0];return _0x47d58f;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xfff0('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x21749c){return this[_0xfff0('0x1')](_0xfff0('0x2'));}},'alias':{'type':Sequelize[_0xfff0('0x3')],'allowNull':![],'set':function(_0x36e858){this[_0xfff0('0x4')](_0xfff0('0x2'),_0x36e858?_0x36e858:this[_0xfff0('0x1')](_0xfff0('0x5')));}},'type':{'type':Sequelize[_0xfff0('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xfff0('0x6')](_0xfff0('0x7')),'get':function(){if(this[_0xfff0('0x1')](_0xfff0('0x8'))===_0xfff0('0x9')){return JSON[_0xfff0('0xa')](this[_0xfff0('0x1')](_0xfff0('0xb')));}else{return this[_0xfff0('0x1')]('values');}},'set':function(_0x4575b4){if(Array['isArray'](_0x4575b4)){this['setDataValue'](_0xfff0('0xb'),JSON[_0xfff0('0xc')](_0x4575b4));}else{this[_0xfff0('0x4')]('values',_0x4575b4);}}},'required':{'type':Sequelize[_0xfff0('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xfff0('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xfff0('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4aeb1a3..3d9efa7 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 _0xac2c=['then','catch','show','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll'];(function(_0x438d01,_0x544bd0){var _0x449b67=function(_0x1e1c1d){while(--_0x1e1c1d){_0x438d01['push'](_0x438d01['shift']());}};_0x449b67(++_0x544bd0);}(_0xac2c,0x6c));var _0xcac2=function(_0x96a05,_0x1f4b8c){_0x96a05=_0x96a05-0x0;var _0x253e31=_0xac2c[_0x96a05];return _0x253e31;};'use strict';var emlformat=require(_0xcac2('0x0'));var rimraf=require(_0xcac2('0x1'));var zipdir=require(_0xcac2('0x2'));var jsonpatch=require(_0xcac2('0x3'));var rp=require(_0xcac2('0x4'));var moment=require(_0xcac2('0x5'));var BPromise=require(_0xcac2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcac2('0x7'));var sox=require('sox');var csv=require(_0xcac2('0x8'));var ejs=require(_0xcac2('0x9'));var fs=require('fs');var fs_extra=require(_0xcac2('0xa'));var _=require(_0xcac2('0xb'));var squel=require(_0xcac2('0xc'));var crypto=require(_0xcac2('0xd'));var jsforce=require(_0xcac2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcac2('0xf'));var Papa=require('papaparse');var Redis=require(_0xcac2('0x10'));var authService=require(_0xcac2('0x11'));var qs=require(_0xcac2('0x12'));var as=require(_0xcac2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcac2('0x14'))(_0xcac2('0x15'));var utils=require(_0xcac2('0x16'));var config=require(_0xcac2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcac2('0x18'))['db'];function respondWithStatusCode(_0x574ea1,_0x2fae41){_0x2fae41=_0x2fae41||0xcc;return function(_0x41ed3a){if(_0x41ed3a){return _0x574ea1[_0xcac2('0x19')](_0x2fae41);}return _0x574ea1[_0xcac2('0x1a')](_0x2fae41)['end']();};}function respondWithResult(_0x15b01d,_0x283aad){_0x283aad=_0x283aad||0xc8;return function(_0x5487c8){if(_0x5487c8){return _0x15b01d['status'](_0x283aad)[_0xcac2('0x1b')](_0x5487c8);}};}function respondWithFilteredResult(_0x205eab,_0x4d8f68){return function(_0x151648){if(_0x151648){var _0x1bf47c=typeof _0x4d8f68['offset']==='undefined'&&typeof _0x4d8f68['limit']===_0xcac2('0x1c');var _0x2f2ed9=_0x151648[_0xcac2('0x1d')];var _0x98e4b1=_0x1bf47c?0x0:_0x4d8f68[_0xcac2('0x1e')];var _0x392b2f=_0x1bf47c?_0x151648[_0xcac2('0x1d')]:_0x4d8f68[_0xcac2('0x1e')]+_0x4d8f68[_0xcac2('0x1f')];var _0x3a4ebe;if(_0x392b2f>=_0x2f2ed9){_0x392b2f=_0x2f2ed9;_0x3a4ebe=0xc8;}else{_0x3a4ebe=0xce;}_0x205eab[_0xcac2('0x1a')](_0x3a4ebe);return _0x205eab[_0xcac2('0x20')](_0xcac2('0x21'),_0x98e4b1+'-'+_0x392b2f+'/'+_0x2f2ed9)[_0xcac2('0x1b')](_0x151648);}return null;};}function patchUpdates(_0x1731ba){return function(_0x5eb095){try{jsonpatch[_0xcac2('0x22')](_0x5eb095,_0x1731ba,!![]);}catch(_0x28cadf){return BPromise[_0xcac2('0x23')](_0x28cadf);}return _0x5eb095[_0xcac2('0x24')]();};}function saveUpdates(_0x44681f,_0x597252){return function(_0x3f2c51){if(_0x3f2c51){return _0x3f2c51[_0xcac2('0x25')](_0x44681f)['then'](function(_0x29688f){return _0x29688f;});}return null;};}function removeEntity(_0x4b743d,_0x38442f){return function(_0x5e85ac){if(_0x5e85ac){return _0x5e85ac[_0xcac2('0x26')]()['then'](function(){_0x4b743d[_0xcac2('0x1a')](0xcc)[_0xcac2('0x27')]();});}};}function handleEntityNotFound(_0x1f1165,_0x3e23a4){return function(_0x35141f){if(!_0x35141f){_0x1f1165[_0xcac2('0x19')](0x194);}return _0x35141f;};}function handleError(_0x5793ec,_0x2abcce){_0x2abcce=_0x2abcce||0x1f4;return function(_0x15c024){logger[_0xcac2('0x28')](_0x15c024[_0xcac2('0x29')]);if(_0x15c024[_0xcac2('0x2a')]){delete _0x15c024['name'];}_0x5793ec[_0xcac2('0x1a')](_0x2abcce)[_0xcac2('0x2b')](_0x15c024);};}exports[_0xcac2('0x2c')]=function(_0x23ab3e,_0x6606e5){var _0x336b2f={},_0x2199dc={},_0x247107={'count':0x0,'rows':[]};var _0x518658=_[_0xcac2('0x2d')](db[_0xcac2('0x2e')][_0xcac2('0x2f')],function(_0x457c4f){return{'name':_0x457c4f['fieldName'],'type':_0x457c4f[_0xcac2('0x30')][_0xcac2('0x31')]};});_0x2199dc[_0xcac2('0x32')]=_[_0xcac2('0x33')](_['map'](_0x518658,_0xcac2('0x2a')),[_0xcac2('0x2a')]);_0x2199dc[_0xcac2('0x34')]=_[_0xcac2('0x35')](_0x23ab3e['query']);_0x2199dc[_0xcac2('0x36')]=_[_0xcac2('0x37')](_0x2199dc['model'],_0x2199dc['query']);_0x336b2f[_0xcac2('0x38')]=_['intersection'](_0x2199dc[_0xcac2('0x32')],qs[_0xcac2('0x39')](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x39')]));_0x336b2f[_0xcac2('0x38')]=_0x336b2f[_0xcac2('0x38')][_0xcac2('0x3a')]?_0x336b2f['attributes']:_0x2199dc[_0xcac2('0x32')];if(!_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x3b')](_0xcac2('0x3c'))){_0x336b2f[_0xcac2('0x1f')]=qs[_0xcac2('0x1f')](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x1f')]);_0x336b2f[_0xcac2('0x1e')]=qs[_0xcac2('0x1e')](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x1e')]);}_0x336b2f[_0xcac2('0x3d')]=qs['sort'](_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x3e')]);_0x336b2f[_0xcac2('0x3f')]=qs[_0xcac2('0x36')](_[_0xcac2('0x40')](_0x23ab3e[_0xcac2('0x34')],_0x2199dc[_0xcac2('0x36')]),_0x518658);if(_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x41')]){_0x336b2f['where']=_[_0xcac2('0x42')](_0x336b2f[_0xcac2('0x3f')],{'$or':_['map'](_0x518658,function(_0x293b35){if(_0x293b35[_0xcac2('0x30')]!=='VIRTUAL'){var _0x2f795f={};_0x2f795f[_0x293b35[_0xcac2('0x2a')]]={'$like':'%'+_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x41')]+'%'};return _0x2f795f;}})});}_0x336b2f=_[_0xcac2('0x42')]({},_0x336b2f,_0x23ab3e[_0xcac2('0x43')]);var _0x37dbd4={'where':_0x336b2f[_0xcac2('0x3f')]};return db[_0xcac2('0x2e')][_0xcac2('0x1d')](_0x37dbd4)['then'](function(_0x1b93ac){_0x247107[_0xcac2('0x1d')]=_0x1b93ac;if(_0x23ab3e[_0xcac2('0x34')][_0xcac2('0x44')]){_0x336b2f['include']=[{'all':!![]}];}return db[_0xcac2('0x2e')][_0xcac2('0x45')](_0x336b2f);})[_0xcac2('0x46')](function(_0x326343){_0x247107['rows']=_0x326343;return _0x247107;})['then'](respondWithFilteredResult(_0x6606e5,_0x336b2f))[_0xcac2('0x47')](handleError(_0x6606e5,null));};exports[_0xcac2('0x48')]=function(_0x5a2ad4,_0x5be40e){var _0x12374d={'raw':!![],'where':{'id':_0x5a2ad4['params']['id']}},_0xd8bb2a={};_0xd8bb2a[_0xcac2('0x32')]=_['keys'](db['CmCustomField'][_0xcac2('0x2f')]);_0xd8bb2a[_0xcac2('0x34')]=_[_0xcac2('0x35')](_0x5a2ad4[_0xcac2('0x34')]);_0xd8bb2a[_0xcac2('0x36')]=_[_0xcac2('0x37')](_0xd8bb2a[_0xcac2('0x32')],_0xd8bb2a[_0xcac2('0x34')]);_0x12374d[_0xcac2('0x38')]=_['intersection'](_0xd8bb2a[_0xcac2('0x32')],qs[_0xcac2('0x39')](_0x5a2ad4[_0xcac2('0x34')][_0xcac2('0x39')]));_0x12374d[_0xcac2('0x38')]=_0x12374d[_0xcac2('0x38')][_0xcac2('0x3a')]?_0x12374d[_0xcac2('0x38')]:_0xd8bb2a[_0xcac2('0x32')];if(_0x5a2ad4[_0xcac2('0x34')]['includeAll']){_0x12374d['include']=[{'all':!![]}];}_0x12374d=_[_0xcac2('0x42')]({},_0x12374d,_0x5a2ad4['options']);return db[_0xcac2('0x2e')][_0xcac2('0x49')](_0x12374d)[_0xcac2('0x46')](handleEntityNotFound(_0x5be40e,null))[_0xcac2('0x46')](respondWithResult(_0x5be40e,null))[_0xcac2('0x47')](handleError(_0x5be40e,null));};exports[_0xcac2('0x25')]=function(_0x641cf4,_0x5dda61){if(_0x641cf4['body']['id']){delete _0x641cf4[_0xcac2('0x4a')]['id'];}return db[_0xcac2('0x2e')]['find']({'where':{'id':_0x641cf4[_0xcac2('0x4b')]['id']}})[_0xcac2('0x46')](handleEntityNotFound(_0x5dda61,null))[_0xcac2('0x46')](saveUpdates(_0x641cf4[_0xcac2('0x4a')],null))[_0xcac2('0x46')](respondWithResult(_0x5dda61,null))[_0xcac2('0x47')](handleError(_0x5dda61,null));};exports['destroy']=function(_0xf51275,_0x32954a){return db['CmCustomField']['find']({'where':{'id':_0xf51275[_0xcac2('0x4b')]['id']}})[_0xcac2('0x46')](handleEntityNotFound(_0x32954a,null))[_0xcac2('0x46')](removeEntity(_0x32954a,null))['catch'](handleError(_0x32954a,null));};exports[_0xcac2('0x4c')]=function(_0x3fabd3,_0x40e0f7){var _0x338aad;return db[_0xcac2('0x4d')][_0xcac2('0x4e')](function(_0x419456){return db[_0xcac2('0x2e')][_0xcac2('0x4c')](_0x3fabd3['body'],{'transaction':_0x419456})['then'](function(_0x5ae978){_0x338aad=_0x5ae978;var _0xad95cf={'type':db[_0xcac2('0x4f')][_0xcac2('0x50')],'transaction':_0x419456};switch(_0x3fabd3[_0xcac2('0x4a')][_0xcac2('0x30')]){case _0xcac2('0x51'):_0xad95cf[_0xcac2('0x30')]=db[_0xcac2('0x4f')]['TEXT'];break;case _0xcac2('0x52'):_0xad95cf[_0xcac2('0x30')]=db[_0xcac2('0x4f')][_0xcac2('0x53')];break;case'switch':_0xad95cf[_0xcac2('0x30')]=db[_0xcac2('0x4f')][_0xcac2('0x54')];_0xad95cf[_0xcac2('0x55')]=![];break;default:}return db[_0xcac2('0x4d')][_0xcac2('0x56')][_0xcac2('0x57')]('cm_contacts',util[_0xcac2('0x58')]('cf_%d',_0x338aad['id']),_0xad95cf);})[_0xcac2('0x46')](function(){return _0x338aad;});})['then'](respondWithResult(_0x40e0f7,0xc9))[_0xcac2('0x47')](handleError(_0x40e0f7,null));}; \ No newline at end of file +var _0xd509=['addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface'];(function(_0x4d07a4,_0x1e9163){var _0x3fd940=function(_0x418f35){while(--_0x418f35){_0x4d07a4['push'](_0x4d07a4['shift']());}};_0x3fd940(++_0x1e9163);}(_0xd509,0xfd));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d50('0x0'));var jsonpatch=require(_0x9d50('0x1'));var rp=require(_0x9d50('0x2'));var moment=require(_0x9d50('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9d50('0x4'));var util=require(_0x9d50('0x5'));var path=require(_0x9d50('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d50('0x7'));var fs=require('fs');var fs_extra=require(_0x9d50('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9d50('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9d50('0xa'));var Papa=require(_0x9d50('0xb'));var Redis=require(_0x9d50('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9d50('0xd'));var as=require(_0x9d50('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9d50('0xf'));var utils=require('../../config/utils');var config=require(_0x9d50('0x10'));var licenseUtil=require(_0x9d50('0x11'));var db=require(_0x9d50('0x12'))['db'];function respondWithStatusCode(_0x17dea7,_0x248669){_0x248669=_0x248669||0xcc;return function(_0x51cdcc){if(_0x51cdcc){return _0x17dea7['sendStatus'](_0x248669);}return _0x17dea7[_0x9d50('0x13')](_0x248669)[_0x9d50('0x14')]();};}function respondWithResult(_0x219ec5,_0x2f8b8c){_0x2f8b8c=_0x2f8b8c||0xc8;return function(_0x4d366b){if(_0x4d366b){return _0x219ec5[_0x9d50('0x13')](_0x2f8b8c)[_0x9d50('0x15')](_0x4d366b);}};}function respondWithFilteredResult(_0x5dd65c,_0x1db8e8){return function(_0x6f9a93){if(_0x6f9a93){var _0xd52158=typeof _0x1db8e8['offset']===_0x9d50('0x16')&&typeof _0x1db8e8['limit']===_0x9d50('0x16');var _0x488dba=_0x6f9a93['count'];var _0x3648b9=_0xd52158?0x0:_0x1db8e8[_0x9d50('0x17')];var _0x373433=_0xd52158?_0x6f9a93[_0x9d50('0x18')]:_0x1db8e8[_0x9d50('0x17')]+_0x1db8e8[_0x9d50('0x19')];var _0x262bfd;if(_0x373433>=_0x488dba){_0x373433=_0x488dba;_0x262bfd=0xc8;}else{_0x262bfd=0xce;}_0x5dd65c[_0x9d50('0x13')](_0x262bfd);return _0x5dd65c[_0x9d50('0x1a')](_0x9d50('0x1b'),_0x3648b9+'-'+_0x373433+'/'+_0x488dba)[_0x9d50('0x15')](_0x6f9a93);}return null;};}function patchUpdates(_0x535200){return function(_0x1d3c2a){try{jsonpatch['apply'](_0x1d3c2a,_0x535200,!![]);}catch(_0x232e21){return BPromise[_0x9d50('0x1c')](_0x232e21);}return _0x1d3c2a['save']();};}function saveUpdates(_0x194246,_0x43f21f){return function(_0x43eedb){if(_0x43eedb){return _0x43eedb[_0x9d50('0x1d')](_0x194246)[_0x9d50('0x1e')](function(_0x483da6){return _0x483da6;});}return null;};}function removeEntity(_0xedba8d,_0x11638e){return function(_0x50b2e9){if(_0x50b2e9){return _0x50b2e9[_0x9d50('0x1f')]()[_0x9d50('0x1e')](function(){_0xedba8d[_0x9d50('0x13')](0xcc)[_0x9d50('0x14')]();});}};}function handleEntityNotFound(_0x5345f3,_0x19b6ff){return function(_0x2b2c03){if(!_0x2b2c03){_0x5345f3[_0x9d50('0x20')](0x194);}return _0x2b2c03;};}function handleError(_0x78e76e,_0x56bd59){_0x56bd59=_0x56bd59||0x1f4;return function(_0x5cb452){logger[_0x9d50('0x21')](_0x5cb452[_0x9d50('0x22')]);if(_0x5cb452[_0x9d50('0x23')]){delete _0x5cb452[_0x9d50('0x23')];}_0x78e76e[_0x9d50('0x13')](_0x56bd59)[_0x9d50('0x24')](_0x5cb452);};}exports[_0x9d50('0x25')]=function(_0x5875ad,_0x521fbf){var _0x336086={},_0x3f5aff={},_0x52f222={'count':0x0,'rows':[]};var _0x228867=_[_0x9d50('0x26')](db[_0x9d50('0x27')]['rawAttributes'],function(_0x34f52b){return{'name':_0x34f52b[_0x9d50('0x28')],'type':_0x34f52b[_0x9d50('0x29')][_0x9d50('0x2a')]};});_0x3f5aff['model']=_['differenceBy'](_[_0x9d50('0x26')](_0x228867,_0x9d50('0x23')),[_0x9d50('0x23')]);_0x3f5aff[_0x9d50('0x2b')]=_['keys'](_0x5875ad[_0x9d50('0x2b')]);_0x3f5aff[_0x9d50('0x2c')]=_[_0x9d50('0x2d')](_0x3f5aff[_0x9d50('0x2e')],_0x3f5aff[_0x9d50('0x2b')]);_0x336086[_0x9d50('0x2f')]=_[_0x9d50('0x2d')](_0x3f5aff[_0x9d50('0x2e')],qs[_0x9d50('0x30')](_0x5875ad[_0x9d50('0x2b')][_0x9d50('0x30')]));_0x336086[_0x9d50('0x2f')]=_0x336086['attributes']['length']?_0x336086['attributes']:_0x3f5aff[_0x9d50('0x2e')];if(!_0x5875ad[_0x9d50('0x2b')][_0x9d50('0x31')](_0x9d50('0x32'))){_0x336086[_0x9d50('0x19')]=qs[_0x9d50('0x19')](_0x5875ad[_0x9d50('0x2b')][_0x9d50('0x19')]);_0x336086['offset']=qs[_0x9d50('0x17')](_0x5875ad['query'][_0x9d50('0x17')]);}_0x336086['order']=qs[_0x9d50('0x33')](_0x5875ad[_0x9d50('0x2b')][_0x9d50('0x33')]);_0x336086[_0x9d50('0x34')]=qs[_0x9d50('0x2c')](_['pick'](_0x5875ad[_0x9d50('0x2b')],_0x3f5aff[_0x9d50('0x2c')]),_0x228867);if(_0x5875ad['query'][_0x9d50('0x35')]){_0x336086['where']=_['merge'](_0x336086[_0x9d50('0x34')],{'$or':_[_0x9d50('0x26')](_0x228867,function(_0x5add38){if(_0x5add38[_0x9d50('0x29')]!==_0x9d50('0x36')){var _0x439031={};_0x439031[_0x5add38[_0x9d50('0x23')]]={'$like':'%'+_0x5875ad[_0x9d50('0x2b')][_0x9d50('0x35')]+'%'};return _0x439031;}})});}_0x336086=_[_0x9d50('0x37')]({},_0x336086,_0x5875ad[_0x9d50('0x38')]);var _0x382d18={'where':_0x336086['where']};return db[_0x9d50('0x27')][_0x9d50('0x18')](_0x382d18)[_0x9d50('0x1e')](function(_0x3af70b){_0x52f222[_0x9d50('0x18')]=_0x3af70b;if(_0x5875ad['query'][_0x9d50('0x39')]){_0x336086['include']=[{'all':!![]}];}return db[_0x9d50('0x27')][_0x9d50('0x3a')](_0x336086);})[_0x9d50('0x1e')](function(_0x5012ac){_0x52f222[_0x9d50('0x3b')]=_0x5012ac;return _0x52f222;})[_0x9d50('0x1e')](respondWithFilteredResult(_0x521fbf,_0x336086))[_0x9d50('0x3c')](handleError(_0x521fbf,null));};exports[_0x9d50('0x3d')]=function(_0xa411a4,_0x15c82d){var _0x998cf6={'raw':!![],'where':{'id':_0xa411a4[_0x9d50('0x3e')]['id']}},_0x591b95={};_0x591b95['model']=_[_0x9d50('0x3f')](db[_0x9d50('0x27')][_0x9d50('0x40')]);_0x591b95[_0x9d50('0x2b')]=_['keys'](_0xa411a4['query']);_0x591b95['filters']=_[_0x9d50('0x2d')](_0x591b95[_0x9d50('0x2e')],_0x591b95['query']);_0x998cf6[_0x9d50('0x2f')]=_[_0x9d50('0x2d')](_0x591b95[_0x9d50('0x2e')],qs[_0x9d50('0x30')](_0xa411a4[_0x9d50('0x2b')][_0x9d50('0x30')]));_0x998cf6[_0x9d50('0x2f')]=_0x998cf6[_0x9d50('0x2f')][_0x9d50('0x41')]?_0x998cf6['attributes']:_0x591b95[_0x9d50('0x2e')];if(_0xa411a4[_0x9d50('0x2b')][_0x9d50('0x39')]){_0x998cf6['include']=[{'all':!![]}];}_0x998cf6=_[_0x9d50('0x37')]({},_0x998cf6,_0xa411a4[_0x9d50('0x38')]);return db[_0x9d50('0x27')]['find'](_0x998cf6)['then'](handleEntityNotFound(_0x15c82d,null))['then'](respondWithResult(_0x15c82d,null))[_0x9d50('0x3c')](handleError(_0x15c82d,null));};exports[_0x9d50('0x1d')]=function(_0x42a773,_0x5c7e2c){if(_0x42a773[_0x9d50('0x42')]['id']){delete _0x42a773[_0x9d50('0x42')]['id'];}return db[_0x9d50('0x27')]['find']({'where':{'id':_0x42a773['params']['id']}})[_0x9d50('0x1e')](handleEntityNotFound(_0x5c7e2c,null))[_0x9d50('0x1e')](saveUpdates(_0x42a773[_0x9d50('0x42')],null))['then'](respondWithResult(_0x5c7e2c,null))['catch'](handleError(_0x5c7e2c,null));};exports['destroy']=function(_0x1d2bdf,_0x3efcec){return db[_0x9d50('0x27')][_0x9d50('0x43')]({'where':{'id':_0x1d2bdf[_0x9d50('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3efcec,null))[_0x9d50('0x1e')](removeEntity(_0x3efcec,null))['catch'](handleError(_0x3efcec,null));};exports[_0x9d50('0x44')]=function(_0x56111f,_0x410f5f){var _0x5cee4a;return db[_0x9d50('0x45')]['transaction'](function(_0x2d4297){return db[_0x9d50('0x27')][_0x9d50('0x44')](_0x56111f[_0x9d50('0x42')],{'transaction':_0x2d4297})['then'](function(_0x14349f){_0x5cee4a=_0x14349f;var _0x2ad31d={'type':db[_0x9d50('0x46')][_0x9d50('0x47')],'transaction':_0x2d4297};switch(_0x56111f['body'][_0x9d50('0x29')]){case _0x9d50('0x48'):_0x2ad31d[_0x9d50('0x29')]=db[_0x9d50('0x46')][_0x9d50('0x47')];break;case _0x9d50('0x49'):_0x2ad31d[_0x9d50('0x29')]=db[_0x9d50('0x46')][_0x9d50('0x4a')];break;case _0x9d50('0x4b'):_0x2ad31d[_0x9d50('0x29')]=db[_0x9d50('0x46')][_0x9d50('0x4c')];_0x2ad31d[_0x9d50('0x4d')]=![];break;default:}return db['sequelize'][_0x9d50('0x4e')][_0x9d50('0x4f')](_0x9d50('0x50'),util[_0x9d50('0x51')](_0x9d50('0x52'),_0x5cee4a['id']),_0x2ad31d);})[_0x9d50('0x1e')](function(){return _0x5cee4a;});})[_0x9d50('0x1e')](respondWithResult(_0x410f5f,0xc9))[_0x9d50('0x3c')](handleError(_0x410f5f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 06cceb4..1343cb1 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 _0x622f=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','cm_custom_fields','util'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x622f,0x149));var _0xf622=function(_0x23ddb6,_0x3d45fd){_0x23ddb6=_0x23ddb6-0x0;var _0x47f21b=_0x622f[_0x23ddb6];return _0x47f21b;};'use strict';var _=require('lodash');var util=require(_0xf622('0x0'));var logger=require(_0xf622('0x1'))(_0xf622('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf622('0x3'));var fs=require('fs');var path=require(_0xf622('0x4'));var rimraf=require(_0xf622('0x5'));var config=require(_0xf622('0x6'));var attributes=require('./cmCustomField.attributes');module[_0xf622('0x7')]=function(_0x50f795,_0x5d7994){return _0x50f795[_0xf622('0x8')]('CmCustomField',attributes,{'tableName':_0xf622('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8500=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','lodash'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x8500,0xc5));var _0x0850=function(_0xaf87ad,_0x3d976f){_0xaf87ad=_0xaf87ad-0x0;var _0x12d518=_0x8500[_0xaf87ad];return _0x12d518;};'use strict';var _=require(_0x0850('0x0'));var util=require('util');var logger=require(_0x0850('0x1'))(_0x0850('0x2'));var moment=require(_0x0850('0x3'));var BPromise=require('bluebird');var rp=require(_0x0850('0x4'));var fs=require('fs');var path=require(_0x0850('0x5'));var rimraf=require(_0x0850('0x6'));var config=require(_0x0850('0x7'));var attributes=require(_0x0850('0x8'));module[_0x0850('0x9')]=function(_0x13b4aa,_0x5d91c9){return _0x13b4aa[_0x0850('0xa')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 43bb8f4..c7d5a96 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 _0x7068=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s'];(function(_0x36b796,_0x5426a1){var _0x5b4097=function(_0x53bfd5){while(--_0x53bfd5){_0x36b796['push'](_0x36b796['shift']());}};_0x5b4097(++_0x5426a1);}(_0x7068,0x1e2));var _0x8706=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x7068[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x8706('0x0'));var util=require(_0x8706('0x1'));var moment=require(_0x8706('0x2'));var BPromise=require(_0x8706('0x3'));var rs=require(_0x8706('0x4'));var fs=require('fs');var Redis=require(_0x8706('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8706('0x6'))('rpc');var config=require(_0x8706('0x7'));var jayson=require(_0x8706('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52fa0f,_0x4fdb7b,_0x2d6358){return new BPromise(function(_0x4a8a96,_0x5cc7f7){return client[_0x8706('0x9')](_0x52fa0f,_0x2d6358)[_0x8706('0xa')](function(_0x335b12){logger['info']('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,'request\x20sent');logger[_0x8706('0xb')](_0x8706('0xc'),_0x4fdb7b,_0x8706('0xd'),JSON[_0x8706('0xe')](_0x335b12));if(_0x335b12['error']){if(_0x335b12['error']['code']===0x1f4){logger[_0x8706('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,_0x335b12['error']['message']);return _0x5cc7f7(_0x335b12[_0x8706('0xf')][_0x8706('0x10')]);}logger[_0x8706('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,_0x335b12[_0x8706('0xf')][_0x8706('0x10')]);return _0x4a8a96(_0x335b12[_0x8706('0xf')][_0x8706('0x10')]);}else{logger['info'](_0x8706('0x11'),_0x4fdb7b,_0x8706('0xd'));_0x4a8a96(_0x335b12[_0x8706('0x12')]['message']);}})[_0x8706('0x13')](function(_0x3b1dc1){logger[_0x8706('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4fdb7b,_0x3b1dc1);_0x5cc7f7(_0x3b1dc1);});});} \ No newline at end of file +var _0x574c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x51e173,_0x3bfef0){var _0x14c367=function(_0x3777b3){while(--_0x3777b3){_0x51e173['push'](_0x51e173['shift']());}};_0x14c367(++_0x3bfef0);}(_0x574c,0x7b));var _0xc574=function(_0x519905,_0xcdb715){_0x519905=_0x519905-0x0;var _0x4e2b91=_0x574c[_0x519905];return _0x4e2b91;};'use strict';var _=require(_0xc574('0x0'));var util=require(_0xc574('0x1'));var moment=require(_0xc574('0x2'));var BPromise=require(_0xc574('0x3'));var rs=require(_0xc574('0x4'));var fs=require('fs');var Redis=require(_0xc574('0x5'));var db=require(_0xc574('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc574('0x7'))(_0xc574('0x8'));var config=require(_0xc574('0x9'));var jayson=require(_0xc574('0xa'));var client=jayson[_0xc574('0xb')][_0xc574('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x590feb,_0x1c5506,_0x3315c0){return new BPromise(function(_0x3fcfd1,_0x36e3f2){return client[_0xc574('0xd')](_0x590feb,_0x3315c0)[_0xc574('0xe')](function(_0x55c5f8){logger[_0xc574('0xf')](_0xc574('0x10'),_0x1c5506,_0xc574('0x11'));logger[_0xc574('0x12')](_0xc574('0x13'),_0x1c5506,_0xc574('0x11'),JSON[_0xc574('0x14')](_0x55c5f8));if(_0x55c5f8[_0xc574('0x15')]){if(_0x55c5f8['error'][_0xc574('0x16')]===0x1f4){logger['error'](_0xc574('0x10'),_0x1c5506,_0x55c5f8[_0xc574('0x15')][_0xc574('0x17')]);return _0x36e3f2(_0x55c5f8[_0xc574('0x15')][_0xc574('0x17')]);}logger[_0xc574('0x15')](_0xc574('0x10'),_0x1c5506,_0x55c5f8[_0xc574('0x15')]['message']);return _0x3fcfd1(_0x55c5f8[_0xc574('0x15')][_0xc574('0x17')]);}else{logger[_0xc574('0xf')](_0xc574('0x10'),_0x1c5506,_0xc574('0x11'));_0x3fcfd1(_0x55c5f8['result'][_0xc574('0x17')]);}})[_0xc574('0x18')](function(_0x4f9fd3){logger[_0xc574('0x15')](_0xc574('0x10'),_0x1c5506,_0x4f9fd3);_0x36e3f2(_0x4f9fd3);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2c9ee93..d9082a9 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 _0x03db=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x483bab,_0x58d0da){var _0x20a53e=function(_0x5332e8){while(--_0x5332e8){_0x483bab['push'](_0x483bab['shift']());}};_0x20a53e(++_0x58d0da);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb03d('0x0'));var util=require(_0xb03d('0x1'));var path=require(_0xb03d('0x2'));var timeout=require(_0xb03d('0x3'));var express=require('express');var router=express[_0xb03d('0x4')]();var fs_extra=require(_0xb03d('0x5'));var auth=require(_0xb03d('0x6'));var interaction=require(_0xb03d('0x7'));var config=require(_0xb03d('0x8'));var controller=require('./cmCustomField.controller');router[_0xb03d('0x9')]('/',auth[_0xb03d('0xa')](),controller[_0xb03d('0xb')]);router['get'](_0xb03d('0xc'),auth['isAuthenticated'](),controller[_0xb03d('0xd')]);router[_0xb03d('0xe')]('/',auth[_0xb03d('0xa')](),controller[_0xb03d('0xf')]);router[_0xb03d('0x10')](_0xb03d('0xc'),auth[_0xb03d('0xa')](),controller['update']);router[_0xb03d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb03d('0x12')]);module[_0xb03d('0x13')]=router; \ No newline at end of file +var _0xf5dc=['isAuthenticated','index','/:id','show','post','create','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xf5dc,0x117));var _0xcf5d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf5dc[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf5d('0x0'));var timeout=require(_0xcf5d('0x1'));var express=require('express');var router=express[_0xcf5d('0x2')]();var fs_extra=require(_0xcf5d('0x3'));var auth=require(_0xcf5d('0x4'));var interaction=require(_0xcf5d('0x5'));var config=require(_0xcf5d('0x6'));var controller=require(_0xcf5d('0x7'));router[_0xcf5d('0x8')]('/',auth[_0xcf5d('0x9')](),controller[_0xcf5d('0xa')]);router[_0xcf5d('0x8')](_0xcf5d('0xb'),auth[_0xcf5d('0x9')](),controller[_0xcf5d('0xc')]);router[_0xcf5d('0xd')]('/',auth['isAuthenticated'](),controller[_0xcf5d('0xe')]);router['put'](_0xcf5d('0xb'),auth[_0xcf5d('0x9')](),controller['update']);router['delete'](_0xcf5d('0xb'),auth[_0xcf5d('0x9')](),controller[_0xcf5d('0xf')]);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 8590892..570835d 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 _0x1eba=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED'];(function(_0x583e72,_0x560a6d){var _0x1d7b74=function(_0x553f0e){while(--_0x553f0e){_0x583e72['push'](_0x583e72['shift']());}};_0x1d7b74(++_0x560a6d);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x1eba[_0x37c22c];return _0x119d79;};'use strict';var moment=require(_0xa1eb('0x0'));var Sequelize=require(_0xa1eb('0x1'));module[_0xa1eb('0x2')]={'phone':{'type':Sequelize[_0xa1eb('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xa1eb('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xa1eb('0x5'))},'countbusyretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa1eb('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa1eb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa1eb('0x7')]},'priority':{'type':Sequelize[_0xa1eb('0x6')](0x2)[_0xa1eb('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa1eb('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa1eb('0x6')],'unique':_0xa1eb('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa1eb('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa1eb('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xa1eb('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa1eb('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa1eb('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x14a0=['UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x310b9f,_0x3ac8c1){var _0x56cc4f=function(_0x49b879){while(--_0x49b879){_0x310b9f['push'](_0x310b9f['shift']());}};_0x56cc4f(++_0x3ac8c1);}(_0x14a0,0x8e));var _0x014a=function(_0x3a4377,_0x4c2b34){_0x3a4377=_0x3a4377-0x0;var _0x1d46ab=_0x14a0[_0x3a4377];return _0x1d46ab;};'use strict';var moment=require('moment');var Sequelize=require(_0x014a('0x0'));module[_0x014a('0x1')]={'phone':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x014a('0x4')],'defaultValue':moment()[_0x014a('0x5')](_0x014a('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x014a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x014a('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x014a('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x014a('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x014a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x014a('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x014a('0x4')],'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 5fbe725..5332515 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 _0xb332=['deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','Queue','dialActive','getPreviewRecall','getVoiceQueues','outbound','hopperId','findOne','recallme','Company','List','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','CmHopper','fieldName','type','key','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','include','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','statedesc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb332,0xd9));var _0x2b33=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xb332[_0xce9195];return _0x530fe6;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var shared=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0xca2248,_0x4df129){_0x4df129=_0x4df129||0xcc;return function(_0x183773){if(_0x183773){return _0xca2248[_0x2b33('0x17')](_0x4df129);}return _0xca2248[_0x2b33('0x18')](_0x4df129)['end']();};}function respondWithResult(_0x173c75,_0x4d39db){_0x4d39db=_0x4d39db||0xc8;return function(_0x3fcf4e){if(_0x3fcf4e){return _0x173c75[_0x2b33('0x18')](_0x4d39db)[_0x2b33('0x19')](_0x3fcf4e);}};}function respondWithFilteredResult(_0x57aea7,_0x52693f){return function(_0x1d8e75){if(_0x1d8e75){var _0x1d50d0=typeof _0x52693f[_0x2b33('0x1a')]===_0x2b33('0x1b')&&typeof _0x52693f[_0x2b33('0x1c')]==='undefined';var _0x554ab3=_0x1d8e75['count'];var _0x4041bd=_0x1d50d0?0x0:_0x52693f['offset'];var _0x543d52=_0x1d50d0?_0x1d8e75[_0x2b33('0x1d')]:_0x52693f[_0x2b33('0x1a')]+_0x52693f[_0x2b33('0x1c')];var _0x539c5f;if(_0x543d52>=_0x554ab3){_0x543d52=_0x554ab3;_0x539c5f=0xc8;}else{_0x539c5f=0xce;}_0x57aea7[_0x2b33('0x18')](_0x539c5f);return _0x57aea7['set'](_0x2b33('0x1e'),_0x4041bd+'-'+_0x543d52+'/'+_0x554ab3)[_0x2b33('0x19')](_0x1d8e75);}return null;};}function patchUpdates(_0x8c8dc2){return function(_0x2998dd){try{jsonpatch[_0x2b33('0x1f')](_0x2998dd,_0x8c8dc2,!![]);}catch(_0x6d20b){return BPromise[_0x2b33('0x20')](_0x6d20b);}return _0x2998dd['save']();};}function saveUpdates(_0x23024c,_0x1d9c98){return function(_0x100c8d){if(_0x100c8d){return _0x100c8d[_0x2b33('0x21')](_0x23024c)[_0x2b33('0x22')](function(_0x1c27d4){return _0x1c27d4;});}return null;};}function removeEntity(_0x27f1b8,_0x2605e6){return function(_0x5e1cba){if(_0x5e1cba){return _0x5e1cba[_0x2b33('0x23')]()[_0x2b33('0x22')](function(){_0x27f1b8[_0x2b33('0x18')](0xcc)[_0x2b33('0x24')]();});}};}function handleEntityNotFound(_0x4df3d4,_0x2ec9db){return function(_0x530098){if(!_0x530098){_0x4df3d4[_0x2b33('0x17')](0x194);}return _0x530098;};}function handleError(_0x483cf4,_0x2e74d0){_0x2e74d0=_0x2e74d0||0x1f4;return function(_0x341e0e){logger['error'](_0x341e0e[_0x2b33('0x25')]);if(_0x341e0e['name']){delete _0x341e0e[_0x2b33('0x26')];}_0x483cf4['status'](_0x2e74d0)[_0x2b33('0x27')](_0x341e0e);};}exports[_0x2b33('0x28')]=function(_0x9482a,_0x268c1d){var _0xaa6643={},_0x312d4d={},_0x2be034={'count':0x0,'rows':[]};var _0x1fadc5=_[_0x2b33('0x29')](db[_0x2b33('0x2a')]['rawAttributes'],function(_0x5b6527){return{'name':_0x5b6527[_0x2b33('0x2b')],'type':_0x5b6527[_0x2b33('0x2c')][_0x2b33('0x2d')]};});_0x312d4d[_0x2b33('0x2e')]=_[_0x2b33('0x29')](_0x1fadc5,'name');_0x312d4d['query']=_[_0x2b33('0x2f')](_0x9482a[_0x2b33('0x30')]);_0x312d4d[_0x2b33('0x31')]=_[_0x2b33('0x32')](_0x312d4d[_0x2b33('0x2e')],_0x312d4d[_0x2b33('0x30')]);_0x312d4d['filters']=_[_0x2b33('0x33')](_0x312d4d['filters'],[_0x2b33('0x34'),_0x2b33('0x35'),_0x2b33('0x36'),_0x2b33('0x37'),_0x2b33('0x38'),_0x2b33('0x39'),_0x2b33('0x3a'),_0x2b33('0x3b'),_0x2b33('0x3c'),_0x2b33('0x3d'),_0x2b33('0x3e'),_0x2b33('0x3f'),_0x2b33('0x40'),_0x2b33('0x41'),_0x2b33('0x42'),_0x2b33('0x43'),'$notILike','$like','$overlap',_0x2b33('0x44'),_0x2b33('0x45'),_0x2b33('0x46')]);_0xaa6643[_0x2b33('0x47')]=_[_0x2b33('0x32')](_0x312d4d['model'],qs['fields'](_0x9482a[_0x2b33('0x30')]['fields']));_0xaa6643[_0x2b33('0x47')]=_0xaa6643[_0x2b33('0x47')][_0x2b33('0x48')]?_0xaa6643[_0x2b33('0x47')]:_0x312d4d[_0x2b33('0x2e')];if(!_0x9482a[_0x2b33('0x30')][_0x2b33('0x49')](_0x2b33('0x4a'))){_0xaa6643[_0x2b33('0x1c')]=qs[_0x2b33('0x1c')](_0x9482a['query'][_0x2b33('0x1c')]);_0xaa6643[_0x2b33('0x1a')]=qs[_0x2b33('0x1a')](_0x9482a['query']['offset']);}_0xaa6643[_0x2b33('0x4b')]=qs['sort'](_0x9482a[_0x2b33('0x30')][_0x2b33('0x4c')]);_0xaa6643['where']=qs[_0x2b33('0x31')](_[_0x2b33('0x4d')](_0x9482a['query'],_0x312d4d[_0x2b33('0x31')]),_0x1fadc5);if(_0x9482a[_0x2b33('0x30')]['filter']){_0xaa6643[_0x2b33('0x4e')]=_[_0x2b33('0x4f')](_0xaa6643[_0x2b33('0x4e')],{'$or':_['map'](_0x1fadc5,function(_0x1bb73d){if(_0x1bb73d[_0x2b33('0x2c')]!==_0x2b33('0x50')){var _0x22f321={};_0x22f321[_0x1bb73d[_0x2b33('0x26')]]={'$like':'%'+_0x9482a['query'][_0x2b33('0x51')]+'%'};return _0x22f321;}})});}_0xaa6643=_[_0x2b33('0x4f')]({},_0xaa6643,_0x9482a[_0x2b33('0x52')]);var _0x5ad3b2={'where':_0xaa6643[_0x2b33('0x4e')]};return db[_0x2b33('0x2a')][_0x2b33('0x1d')](_0x5ad3b2)[_0x2b33('0x22')](function(_0x485f52){_0x2be034[_0x2b33('0x1d')]=_0x485f52;if(_0x9482a[_0x2b33('0x30')]['includeAll']){_0xaa6643['include']=[{'all':!![]}];}return db['CmHopper'][_0x2b33('0x53')](_0xaa6643);})['then'](function(_0x35df3c){_0x2be034[_0x2b33('0x54')]=_0x35df3c;return _0x2be034;})[_0x2b33('0x22')](respondWithFilteredResult(_0x268c1d,_0xaa6643))[_0x2b33('0x55')](handleError(_0x268c1d,null));};exports[_0x2b33('0x56')]=function(_0xd68bbd,_0x361b71){var _0x13bb23={'raw':!![],'where':{'id':_0xd68bbd[_0x2b33('0x57')]['id']}},_0x56224a={};_0x56224a[_0x2b33('0x2e')]=_[_0x2b33('0x2f')](db[_0x2b33('0x2a')][_0x2b33('0x58')]);_0x56224a[_0x2b33('0x30')]=_['keys'](_0xd68bbd['query']);_0x56224a['filters']=_['intersection'](_0x56224a[_0x2b33('0x2e')],_0x56224a['query']);_0x13bb23[_0x2b33('0x47')]=_['intersection'](_0x56224a['model'],qs[_0x2b33('0x59')](_0xd68bbd[_0x2b33('0x30')][_0x2b33('0x59')]));_0x13bb23['attributes']=_0x13bb23[_0x2b33('0x47')]['length']?_0x13bb23[_0x2b33('0x47')]:_0x56224a[_0x2b33('0x2e')];if(_0xd68bbd[_0x2b33('0x30')][_0x2b33('0x5a')]){_0x13bb23[_0x2b33('0x5b')]=[{'all':!![]}];}_0x13bb23=_[_0x2b33('0x4f')]({},_0x13bb23,_0xd68bbd['options']);return db[_0x2b33('0x2a')][_0x2b33('0x5c')](_0x13bb23)[_0x2b33('0x22')](handleEntityNotFound(_0x361b71,null))['then'](respondWithResult(_0x361b71,null))[_0x2b33('0x55')](handleError(_0x361b71,null));};exports[_0x2b33('0x5d')]=function(_0x434f0f,_0x569ba6){return db[_0x2b33('0x2a')]['create'](_0x434f0f['body'],{})[_0x2b33('0x22')](respondWithResult(_0x569ba6,0xc9))[_0x2b33('0x55')](handleError(_0x569ba6,null));};exports[_0x2b33('0x21')]=function(_0xae5ffe,_0x307370){if(_0xae5ffe[_0x2b33('0x5e')]['id']){delete _0xae5ffe[_0x2b33('0x5e')]['id'];}return db[_0x2b33('0x2a')]['find']({'where':{'id':_0xae5ffe[_0x2b33('0x57')]['id']}})[_0x2b33('0x22')](handleEntityNotFound(_0x307370,null))['then'](saveUpdates(_0xae5ffe[_0x2b33('0x5e')],null))[_0x2b33('0x22')](respondWithResult(_0x307370,null))['catch'](handleError(_0x307370,null));};exports[_0x2b33('0x5f')]=function(_0x433584,_0x20f473){return db[_0x2b33('0x2a')]['describe']()[_0x2b33('0x22')](respondWithResult(_0x20f473,null))[_0x2b33('0x55')](handleError(_0x20f473,null));};exports['destroy']=function(_0x150035,_0x162d13){var _0x1ce316;return db[_0x2b33('0x2a')][_0x2b33('0x5c')]({'where':{'id':_0x150035[_0x2b33('0x57')]['id']}})[_0x2b33('0x22')](handleEntityNotFound(_0x162d13,null))['then'](function(_0x5aa3c0){if(_0x5aa3c0){return _0x5aa3c0[_0x2b33('0x23')]()[_0x2b33('0x22')](function(_0x5c5f00){return _0x5c5f00;});}})[_0x2b33('0x22')](function(_0x569f2d){_0x1ce316=_0x569f2d;if(_0x569f2d){if(_0x569f2d[_0x2b33('0x60')]||_0x569f2d['CampaignId']){return db[_0x569f2d[_0x2b33('0x60')]?_0x2b33('0x61'):_0x2b33('0x62')][_0x2b33('0x5c')]({'where':{'id':_0x569f2d[_0x2b33('0x60')]?_0x569f2d[_0x2b33('0x60')]:_0x569f2d[_0x2b33('0x63')]},'attributes':['id',_0x2b33('0x26')],'raw':!![]});}}})['then'](function(_0x59e470){var _0x1e7b13={};if(_0x59e470){_[_0x2b33('0x4f')](_0x1e7b13,_[_0x2b33('0x64')](_0x1ce316[_0x2b33('0x65')],[_0x2b33('0x66'),_0x2b33('0x67'),'id']));_0x1e7b13['state']=0x15;_0x1e7b13[_0x2b33('0x68')]=_0x2b33('0x69');_0x1e7b13[_0x2b33('0x6a')]=_0x59e470[_0x2b33('0x26')];_0x1e7b13[_0x2b33('0x6b')]=_0x150035[_0x2b33('0x6c')]['name'];_0x1e7b13[_0x2b33('0x6d')]=_0x150035[_0x2b33('0x6c')]['id'];_0x1e7b13[_0x2b33('0x69')]=!![];_0x1e7b13[_0x2b33('0x6e')]=moment()[_0x2b33('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e7b13[_0x2b33('0x70')]=_0x1ce316[_0x2b33('0x71')];_0x1e7b13[_0x2b33('0x72')]=_0x1ce316[_0x2b33('0x60')]?'queue':_0x2b33('0x73');return db['CmContact'][_0x2b33('0x5c')]({'where':{'id':_0x1e7b13[_0x2b33('0x74')]},'attributes':[_0x2b33('0x75'),_0x2b33('0x76')]})[_0x2b33('0x22')](function(_0x321940){if(!_[_0x2b33('0x77')](_0x162d13)&&!_[_0x2b33('0x77')](_0x321940['firstName'])){_0x1e7b13[_0x2b33('0x78')]=_0x321940[_0x2b33('0x75')];if(!_[_0x2b33('0x77')](_0x321940[_0x2b33('0x76')])){_0x1e7b13[_0x2b33('0x78')]+='\x20'+_0x321940[_0x2b33('0x76')];}}})[_0x2b33('0x79')](function(){return db[_0x2b33('0x7a')][_0x2b33('0x5d')](_0x1e7b13);});}})[_0x2b33('0x22')](function(){return _0x162d13[_0x2b33('0x18')](0xcc)[_0x2b33('0x24')]();})['catch'](handleError(_0x162d13,null));};exports[_0x2b33('0x7b')]=function(_0x4db872,_0x4fb281,_0x6dd6fa){var _0x5404f8=[];return db[_0x2b33('0x7c')]['describe']()[_0x2b33('0x22')](function(_0x469825){_0x5404f8=_[_0x2b33('0x2f')](_0x469825);return _0x4db872[_0x2b33('0x6c')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x52b3ca){if(_0x52b3ca&&_0x52b3ca[_0x2b33('0x48')]){return db[_0x2b33('0x7d')][_0x2b33('0x7e')](function(_0x5429d7){var _0xa2226d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2b33('0x6f')](_0x2b33('0x7f'))},'VoiceQueueId':{'$in':_[_0x2b33('0x29')](_0x52b3ca,'id')},'$or':[{'UserId':null},{'UserId':_0x4db872[_0x2b33('0x6c')]['id']}]};var _0x474aca={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x52b3ca)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4db872['user']['id']}]};var _0x4cd745={'$or':[_0xa2226d,_0x474aca]};var _0x35a66b=[];if(_0x4db872[_0x2b33('0x5e')]['direction']&&_0x4db872[_0x2b33('0x5e')][_0x2b33('0x80')]===_0x2b33('0x81')){if(!_[_0x2b33('0x82')](_0x4db872[_0x2b33('0x5e')][_0x2b33('0x83')])){_0x4cd745['id']={'$in':_0x4db872[_0x2b33('0x5e')]['hopperIds']};}_0x35a66b=[['priority',_0x2b33('0x84')],[_0x2b33('0x85'),_0x52b3ca[0x0][_0x2b33('0x86')]===_0x2b33('0x84')?_0x2b33('0x87'):'ASC'],db['sequelize']['literal'](_0x2b33('0x88')),['id',_0x2b33('0x87')]];}else{if(!_[_0x2b33('0x82')](_0x4db872['body']['hopperIds'])){_0x4cd745['id']={'$notIn':_0x4db872[_0x2b33('0x5e')][_0x2b33('0x83')]};}_0x35a66b=[['priority',_0x2b33('0x87')],[_0x2b33('0x85'),_0x52b3ca[0x0][_0x2b33('0x86')]],db['sequelize'][_0x2b33('0x89')](_0x2b33('0x8a')),['id',_0x2b33('0x84')]];}return db[_0x2b33('0x2a')]['findOne']({'attributes':['id',_0x2b33('0x8b'),'recallme'],'where':_0x4cd745,'order':_0x35a66b,'transaction':_0x5429d7,'lock':_0x5429d7[_0x2b33('0x8c')][_0x2b33('0x8d')],'include':[{'model':db[_0x2b33('0x7c')],'as':_0x2b33('0x8e'),'attributes':_0x5404f8,'include':[{'model':db[_0x2b33('0x8f')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x2b33('0x90')],'as':'List','attributes':['id','name']},{'model':db[_0x2b33('0x61')],'as':_0x2b33('0x91'),'attributes':['id',_0x2b33('0x26'),_0x2b33('0x92')]}]})[_0x2b33('0x22')](function(_0x44ca31){if(_0x44ca31){return _0x44ca31[_0x2b33('0x21')]({'UserId':_0x4db872[_0x2b33('0x6c')]['id']},{'transaction':_0x5429d7});}});});}})['then'](handleEntityNotFound(_0x4fb281,null))['then'](respondWithResult(_0x4fb281,null))['catch'](handleError(_0x4fb281,null));};exports[_0x2b33('0x93')]=function(_0x2bc121,_0x589106,_0xf15ebc){var _0x7f70b6=[];return db['CmContact'][_0x2b33('0x5f')]()['then'](function(_0x403d06){_0x7f70b6=_[_0x2b33('0x2f')](_0x403d06);return _0x2bc121['user'][_0x2b33('0x94')]({'where':{'type':_0x2b33('0x95'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x2b33('0x86'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x2b33('0x22')](function(_0x5bfe3f){if(_0x5bfe3f&&_0x5bfe3f['length']){return db['sequelize'][_0x2b33('0x7e')](function(_0x4e4fce){var _0x190cc7={'active':![],'recallme':!![],'id':_0x2bc121[_0x2b33('0x5e')][_0x2b33('0x96')]};return db[_0x2b33('0x2a')][_0x2b33('0x97')]({'attributes':['id',_0x2b33('0x8b'),_0x2b33('0x98')],'where':_0x190cc7,'transaction':_0x4e4fce,'lock':_0x4e4fce[_0x2b33('0x8c')][_0x2b33('0x8d')],'include':[{'model':db[_0x2b33('0x7c')],'as':_0x2b33('0x8e'),'attributes':_0x7f70b6,'include':[{'model':db['CmCompany'],'as':_0x2b33('0x99'),'attributes':['id',_0x2b33('0x26')]}]},{'model':db['CmList'],'as':_0x2b33('0x9a'),'attributes':['id','name']},{'model':db[_0x2b33('0x61')],'as':'Queue','attributes':['id',_0x2b33('0x26'),'dialActive']}]})[_0x2b33('0x22')](function(_0x1388c4){if(_0x1388c4){return _0x1388c4[_0x2b33('0x21')]({'UserId':_0x2bc121[_0x2b33('0x6c')]['id']},{'transaction':_0x4e4fce});}});});}})['then'](handleEntityNotFound(_0x589106,null))[_0x2b33('0x22')](respondWithResult(_0x589106,null))[_0x2b33('0x55')](handleError(_0x589106,null));};exports['getOpenContacts']=function(_0x924b18,_0x38f168,_0x123639){return _0x924b18[_0x2b33('0x6c')]['getVoiceQueues']({'where':{'type':_0x2b33('0x95'),'dialActive':!![],'dialMethod':_0x2b33('0x9b')},'attributes':['id'],'raw':!![]})[_0x2b33('0x22')](function(_0x2949ef){if(_0x2949ef&&_0x2949ef['length']){return db[_0x2b33('0x2a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2b33('0x6f')](_0x2b33('0x7f'))},'VoiceQueueId':{'$in':_[_0x2b33('0x29')](_0x2949ef,'id')},'$or':[{'UserId':null},{'UserId':_0x924b18[_0x2b33('0x6c')]['id']}]}});}return 0x0;})['then'](function(_0x1689e9){if(!_[_0x2b33('0x77')](_0x1689e9)&&_[_0x2b33('0x9c')](_0x1689e9)){return _0x38f168[_0x2b33('0x18')](0xc8)[_0x2b33('0x19')]({'contacts':_0x1689e9});}else{logger['error'](_0x2b33('0x9d'),_0x2b33('0x9e'),0x194,_0x2b33('0x9f'));_0x38f168[_0x2b33('0x17')](0x194);}})[_0x2b33('0x55')](handleError(_0x38f168,null));};exports['getTimezones']=function(_0x3e8eec,_0x24713a,_0x2a6b3a){var _0x5c915b=shared[_0x2b33('0xa0')];var _0x5d9298=[];_[_0x2b33('0x29')](_0x5c915b,function(_0x36be69){_0x5d9298['push']({'id':_0x36be69[_0x2b33('0x26')],'name':_0x36be69[_0x2b33('0x26')],'utcOffset':_0x36be69['utcOffset']});});return _0x24713a['status'](0xc8)[_0x2b33('0x19')]({'tz':_0x5d9298});};exports['getTimezone']=function(_0x36ac4b,_0x32134f,_0x5861ed){var _0x4cdd20=shared['timezones'];var _0x3ddae6={};if(!_[_0x2b33('0x77')](_0x4cdd20[_0x36ac4b[_0x2b33('0x5e')]['id']]))_0x3ddae6=_0x4cdd20[_0x36ac4b['body']['id']];return _0x32134f['status'](0xc8)[_0x2b33('0x19')](_0x3ddae6);}; \ No newline at end of file +var _0x4f08=['hopperId','findOne','scheduledat','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','eml-format','rimraf','fast-json-patch','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','save','update','then','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','firstName','lastName','isNil','finally','CmHopperFinal','CmContact','outbound','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','getVoiceQueues','preview'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4f08,0xaa));var _0x84f0=function(_0x1a4f3c,_0x5ec1b6){_0x1a4f3c=_0x1a4f3c-0x0;var _0x18797d=_0x4f08[_0x1a4f3c];return _0x18797d;};'use strict';var emlformat=require(_0x84f0('0x0'));var rimraf=require(_0x84f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84f0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x84f0('0x3'));var Mustache=require(_0x84f0('0x4'));var util=require(_0x84f0('0x5'));var path=require(_0x84f0('0x6'));var sox=require(_0x84f0('0x7'));var csv=require(_0x84f0('0x8'));var ejs=require(_0x84f0('0x9'));var fs=require('fs');var fs_extra=require(_0x84f0('0xa'));var _=require(_0x84f0('0xb'));var squel=require('squel');var crypto=require(_0x84f0('0xc'));var jsforce=require(_0x84f0('0xd'));var deskjs=require(_0x84f0('0xe'));var toCsv=require(_0x84f0('0x8'));var querystring=require(_0x84f0('0xf'));var Papa=require(_0x84f0('0x10'));var Redis=require(_0x84f0('0x11'));var authService=require(_0x84f0('0x12'));var qs=require(_0x84f0('0x13'));var as=require(_0x84f0('0x14'));var hardwareService=require(_0x84f0('0x15'));var logger=require(_0x84f0('0x16'))('api');var utils=require(_0x84f0('0x17'));var config=require(_0x84f0('0x18'));var shared=require(_0x84f0('0x18'));var licenseUtil=require(_0x84f0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47debb,_0x8a079d){_0x8a079d=_0x8a079d||0xcc;return function(_0x3c46be){if(_0x3c46be){return _0x47debb[_0x84f0('0x1a')](_0x8a079d);}return _0x47debb['status'](_0x8a079d)[_0x84f0('0x1b')]();};}function respondWithResult(_0x2f8e41,_0x36a567){_0x36a567=_0x36a567||0xc8;return function(_0x17a29e){if(_0x17a29e){return _0x2f8e41['status'](_0x36a567)[_0x84f0('0x1c')](_0x17a29e);}};}function respondWithFilteredResult(_0x12afb6,_0x50da57){return function(_0x345df4){if(_0x345df4){var _0x566916=typeof _0x50da57[_0x84f0('0x1d')]===_0x84f0('0x1e')&&typeof _0x50da57['limit']===_0x84f0('0x1e');var _0x575208=_0x345df4[_0x84f0('0x1f')];var _0x297133=_0x566916?0x0:_0x50da57[_0x84f0('0x1d')];var _0x4b57f5=_0x566916?_0x345df4[_0x84f0('0x1f')]:_0x50da57[_0x84f0('0x1d')]+_0x50da57['limit'];var _0xe824b;if(_0x4b57f5>=_0x575208){_0x4b57f5=_0x575208;_0xe824b=0xc8;}else{_0xe824b=0xce;}_0x12afb6[_0x84f0('0x20')](_0xe824b);return _0x12afb6['set'](_0x84f0('0x21'),_0x297133+'-'+_0x4b57f5+'/'+_0x575208)['json'](_0x345df4);}return null;};}function patchUpdates(_0xdb3e6a){return function(_0x4b8479){try{jsonpatch[_0x84f0('0x22')](_0x4b8479,_0xdb3e6a,!![]);}catch(_0x371ceb){return BPromise['reject'](_0x371ceb);}return _0x4b8479[_0x84f0('0x23')]();};}function saveUpdates(_0x32d5c2,_0x107c36){return function(_0x1b7a4a){if(_0x1b7a4a){return _0x1b7a4a[_0x84f0('0x24')](_0x32d5c2)[_0x84f0('0x25')](function(_0x5ea19b){return _0x5ea19b;});}return null;};}function removeEntity(_0x1359f2,_0x332092){return function(_0x22ccfc){if(_0x22ccfc){return _0x22ccfc['destroy']()[_0x84f0('0x25')](function(){_0x1359f2[_0x84f0('0x20')](0xcc)[_0x84f0('0x1b')]();});}};}function handleEntityNotFound(_0x196d71,_0x649698){return function(_0x10e9cc){if(!_0x10e9cc){_0x196d71['sendStatus'](0x194);}return _0x10e9cc;};}function handleError(_0x67b1b2,_0x7679e6){_0x7679e6=_0x7679e6||0x1f4;return function(_0x3131e6){logger[_0x84f0('0x26')](_0x3131e6['stack']);if(_0x3131e6[_0x84f0('0x27')]){delete _0x3131e6[_0x84f0('0x27')];}_0x67b1b2[_0x84f0('0x20')](_0x7679e6)[_0x84f0('0x28')](_0x3131e6);};}exports[_0x84f0('0x29')]=function(_0x3dc83c,_0x3e4f40){var _0x844c1b={},_0x3c0a8d={},_0x133981={'count':0x0,'rows':[]};var _0x80a1be=_[_0x84f0('0x2a')](db[_0x84f0('0x2b')][_0x84f0('0x2c')],function(_0x4ba6f5){return{'name':_0x4ba6f5[_0x84f0('0x2d')],'type':_0x4ba6f5[_0x84f0('0x2e')][_0x84f0('0x2f')]};});_0x3c0a8d[_0x84f0('0x30')]=_[_0x84f0('0x2a')](_0x80a1be,_0x84f0('0x27'));_0x3c0a8d[_0x84f0('0x31')]=_[_0x84f0('0x32')](_0x3dc83c[_0x84f0('0x31')]);_0x3c0a8d[_0x84f0('0x33')]=_[_0x84f0('0x34')](_0x3c0a8d['model'],_0x3c0a8d[_0x84f0('0x31')]);_0x3c0a8d[_0x84f0('0x33')]=_[_0x84f0('0x35')](_0x3c0a8d[_0x84f0('0x33')],[_0x84f0('0x36'),_0x84f0('0x37'),_0x84f0('0x38'),_0x84f0('0x39'),'$lt',_0x84f0('0x3a'),'$ne','$eq',_0x84f0('0x3b'),'$between',_0x84f0('0x3c'),_0x84f0('0x3d'),_0x84f0('0x3e'),_0x84f0('0x3f'),_0x84f0('0x40'),_0x84f0('0x41'),_0x84f0('0x42'),_0x84f0('0x3f'),'$overlap',_0x84f0('0x43'),_0x84f0('0x44'),_0x84f0('0x45')]);_0x844c1b['attributes']=_[_0x84f0('0x34')](_0x3c0a8d['model'],qs[_0x84f0('0x46')](_0x3dc83c[_0x84f0('0x31')][_0x84f0('0x46')]));_0x844c1b[_0x84f0('0x47')]=_0x844c1b['attributes'][_0x84f0('0x48')]?_0x844c1b[_0x84f0('0x47')]:_0x3c0a8d[_0x84f0('0x30')];if(!_0x3dc83c[_0x84f0('0x31')][_0x84f0('0x49')](_0x84f0('0x4a'))){_0x844c1b[_0x84f0('0x4b')]=qs['limit'](_0x3dc83c[_0x84f0('0x31')]['limit']);_0x844c1b[_0x84f0('0x1d')]=qs[_0x84f0('0x1d')](_0x3dc83c[_0x84f0('0x31')][_0x84f0('0x1d')]);}_0x844c1b[_0x84f0('0x4c')]=qs[_0x84f0('0x4d')](_0x3dc83c[_0x84f0('0x31')][_0x84f0('0x4d')]);_0x844c1b[_0x84f0('0x4e')]=qs['filters'](_[_0x84f0('0x4f')](_0x3dc83c[_0x84f0('0x31')],_0x3c0a8d[_0x84f0('0x33')]),_0x80a1be);if(_0x3dc83c[_0x84f0('0x31')]['filter']){_0x844c1b[_0x84f0('0x4e')]=_['merge'](_0x844c1b[_0x84f0('0x4e')],{'$or':_[_0x84f0('0x2a')](_0x80a1be,function(_0x52feb6){if(_0x52feb6[_0x84f0('0x2e')]!==_0x84f0('0x50')){var _0x441052={};_0x441052[_0x52feb6['name']]={'$like':'%'+_0x3dc83c[_0x84f0('0x31')][_0x84f0('0x51')]+'%'};return _0x441052;}})});}_0x844c1b=_['merge']({},_0x844c1b,_0x3dc83c[_0x84f0('0x52')]);var _0x3445be={'where':_0x844c1b['where']};return db[_0x84f0('0x2b')][_0x84f0('0x1f')](_0x3445be)['then'](function(_0xa2b706){_0x133981['count']=_0xa2b706;if(_0x3dc83c['query'][_0x84f0('0x53')]){_0x844c1b['include']=[{'all':!![]}];}return db[_0x84f0('0x2b')][_0x84f0('0x54')](_0x844c1b);})[_0x84f0('0x25')](function(_0x363c38){_0x133981[_0x84f0('0x55')]=_0x363c38;return _0x133981;})[_0x84f0('0x25')](respondWithFilteredResult(_0x3e4f40,_0x844c1b))[_0x84f0('0x56')](handleError(_0x3e4f40,null));};exports[_0x84f0('0x57')]=function(_0x59cf30,_0x321088){var _0x1bfcc0={'raw':!![],'where':{'id':_0x59cf30[_0x84f0('0x58')]['id']}},_0x383e12={};_0x383e12[_0x84f0('0x30')]=_[_0x84f0('0x32')](db[_0x84f0('0x2b')][_0x84f0('0x2c')]);_0x383e12[_0x84f0('0x31')]=_['keys'](_0x59cf30[_0x84f0('0x31')]);_0x383e12['filters']=_['intersection'](_0x383e12['model'],_0x383e12['query']);_0x1bfcc0[_0x84f0('0x47')]=_[_0x84f0('0x34')](_0x383e12[_0x84f0('0x30')],qs['fields'](_0x59cf30['query'][_0x84f0('0x46')]));_0x1bfcc0[_0x84f0('0x47')]=_0x1bfcc0['attributes']['length']?_0x1bfcc0[_0x84f0('0x47')]:_0x383e12[_0x84f0('0x30')];if(_0x59cf30[_0x84f0('0x31')]['includeAll']){_0x1bfcc0[_0x84f0('0x59')]=[{'all':!![]}];}_0x1bfcc0=_[_0x84f0('0x5a')]({},_0x1bfcc0,_0x59cf30[_0x84f0('0x52')]);return db[_0x84f0('0x2b')][_0x84f0('0x5b')](_0x1bfcc0)[_0x84f0('0x25')](handleEntityNotFound(_0x321088,null))[_0x84f0('0x25')](respondWithResult(_0x321088,null))[_0x84f0('0x56')](handleError(_0x321088,null));};exports[_0x84f0('0x5c')]=function(_0x270e1c,_0x298b48){return db[_0x84f0('0x2b')][_0x84f0('0x5c')](_0x270e1c[_0x84f0('0x5d')],{})[_0x84f0('0x25')](respondWithResult(_0x298b48,0xc9))['catch'](handleError(_0x298b48,null));};exports[_0x84f0('0x24')]=function(_0x4bc889,_0x37af5c){if(_0x4bc889[_0x84f0('0x5d')]['id']){delete _0x4bc889[_0x84f0('0x5d')]['id'];}return db[_0x84f0('0x2b')][_0x84f0('0x5b')]({'where':{'id':_0x4bc889['params']['id']}})[_0x84f0('0x25')](handleEntityNotFound(_0x37af5c,null))[_0x84f0('0x25')](saveUpdates(_0x4bc889[_0x84f0('0x5d')],null))['then'](respondWithResult(_0x37af5c,null))[_0x84f0('0x56')](handleError(_0x37af5c,null));};exports[_0x84f0('0x5e')]=function(_0x59e868,_0xb7a061){return db[_0x84f0('0x2b')][_0x84f0('0x5e')]()[_0x84f0('0x25')](respondWithResult(_0xb7a061,null))[_0x84f0('0x56')](handleError(_0xb7a061,null));};exports['destroy']=function(_0x484956,_0x23af60){var _0x578686;return db[_0x84f0('0x2b')][_0x84f0('0x5b')]({'where':{'id':_0x484956[_0x84f0('0x58')]['id']}})[_0x84f0('0x25')](handleEntityNotFound(_0x23af60,null))[_0x84f0('0x25')](function(_0x415d0a){if(_0x415d0a){return _0x415d0a[_0x84f0('0x5f')]()[_0x84f0('0x25')](function(_0x380bfd){return _0x380bfd;});}})[_0x84f0('0x25')](function(_0x3d41ff){_0x578686=_0x3d41ff;if(_0x3d41ff){if(_0x3d41ff['VoiceQueueId']||_0x3d41ff['CampaignId']){return db[_0x3d41ff[_0x84f0('0x60')]?_0x84f0('0x61'):_0x84f0('0x62')]['find']({'where':{'id':_0x3d41ff['VoiceQueueId']?_0x3d41ff[_0x84f0('0x60')]:_0x3d41ff[_0x84f0('0x63')]},'attributes':['id',_0x84f0('0x27')],'raw':!![]});}}})[_0x84f0('0x25')](function(_0x349f6a){var _0x2df9cd={};if(_0x349f6a){_['merge'](_0x2df9cd,_[_0x84f0('0x64')](_0x578686['dataValues'],[_0x84f0('0x65'),_0x84f0('0x66'),'id']));_0x2df9cd[_0x84f0('0x67')]=0x15;_0x2df9cd[_0x84f0('0x68')]=_0x84f0('0x69');_0x2df9cd['campaign']=_0x349f6a[_0x84f0('0x27')];_0x2df9cd[_0x84f0('0x6a')]=_0x484956[_0x84f0('0x6b')]['name'];_0x2df9cd[_0x84f0('0x6c')]=_0x484956[_0x84f0('0x6b')]['id'];_0x2df9cd[_0x84f0('0x69')]=!![];_0x2df9cd['deletedat']=moment()[_0x84f0('0x6d')](_0x84f0('0x6e'));_0x2df9cd[_0x84f0('0x6f')]=_0x578686[_0x84f0('0x70')];_0x2df9cd[_0x84f0('0x71')]=_0x578686[_0x84f0('0x60')]?_0x84f0('0x72'):_0x84f0('0x73');return db['CmContact'][_0x84f0('0x5b')]({'where':{'id':_0x2df9cd['ContactId']},'attributes':[_0x84f0('0x74'),_0x84f0('0x75')]})['then'](function(_0x3b570a){if(!_[_0x84f0('0x76')](_0x23af60)&&!_[_0x84f0('0x76')](_0x3b570a[_0x84f0('0x74')])){_0x2df9cd['calleridname']=_0x3b570a['firstName'];if(!_[_0x84f0('0x76')](_0x3b570a[_0x84f0('0x75')])){_0x2df9cd['calleridname']+='\x20'+_0x3b570a[_0x84f0('0x75')];}}})[_0x84f0('0x77')](function(){return db[_0x84f0('0x78')][_0x84f0('0x5c')](_0x2df9cd);});}})[_0x84f0('0x25')](function(){return _0x23af60[_0x84f0('0x20')](0xcc)[_0x84f0('0x1b')]();})['catch'](handleError(_0x23af60,null));};exports['getPreview']=function(_0x41bdad,_0x312ebd,_0x55bc96){var _0x40e3b2=[];return db[_0x84f0('0x79')]['describe']()[_0x84f0('0x25')](function(_0x13bd7c){_0x40e3b2=_[_0x84f0('0x32')](_0x13bd7c);return _0x41bdad[_0x84f0('0x6b')]['getVoiceQueues']({'where':{'type':_0x84f0('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x84f0('0x7b')],'raw':!![]});})[_0x84f0('0x25')](function(_0x541805){if(_0x541805&&_0x541805[_0x84f0('0x48')]){return db[_0x84f0('0x7c')][_0x84f0('0x7d')](function(_0x1b1e36){var _0xe9f127={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x84f0('0x6d')](_0x84f0('0x6e'))},'VoiceQueueId':{'$in':_[_0x84f0('0x2a')](_0x541805,'id')},'$or':[{'UserId':null},{'UserId':_0x41bdad[_0x84f0('0x6b')]['id']}]};var _0x4a7d09={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x541805)['filter']([_0x84f0('0x7b'),0x0])['map']('id')[_0x84f0('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x41bdad[_0x84f0('0x6b')]['id']}]};var _0x3ba963={'$or':[_0xe9f127,_0x4a7d09]};var _0x509075=[];if(_0x41bdad['body'][_0x84f0('0x7f')]&&_0x41bdad[_0x84f0('0x5d')][_0x84f0('0x7f')]==='prev'){if(!_[_0x84f0('0x80')](_0x41bdad[_0x84f0('0x5d')][_0x84f0('0x81')])){_0x3ba963['id']={'$in':_0x41bdad[_0x84f0('0x5d')]['hopperIds']};}_0x509075=[['priority',_0x84f0('0x82')],[_0x84f0('0x83'),_0x541805[0x0][_0x84f0('0x84')]==='ASC'?'DESC':_0x84f0('0x82')],db[_0x84f0('0x7c')]['literal'](_0x84f0('0x85')),['id','DESC']];}else{if(!_[_0x84f0('0x80')](_0x41bdad[_0x84f0('0x5d')][_0x84f0('0x81')])){_0x3ba963['id']={'$notIn':_0x41bdad['body'][_0x84f0('0x81')]};}_0x509075=[[_0x84f0('0x86'),_0x84f0('0x87')],[_0x84f0('0x83'),_0x541805[0x0][_0x84f0('0x84')]],db['sequelize'][_0x84f0('0x88')](_0x84f0('0x89')),['id',_0x84f0('0x82')]];}return db[_0x84f0('0x2b')]['findOne']({'attributes':['id','scheduledat',_0x84f0('0x8a')],'where':_0x3ba963,'order':_0x509075,'transaction':_0x1b1e36,'lock':_0x1b1e36[_0x84f0('0x8b')][_0x84f0('0x8c')],'include':[{'model':db[_0x84f0('0x79')],'as':_0x84f0('0x8d'),'attributes':_0x40e3b2,'include':[{'model':db[_0x84f0('0x8e')],'as':_0x84f0('0x8f'),'attributes':['id',_0x84f0('0x27')]}]},{'model':db['CmList'],'as':_0x84f0('0x90'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x84f0('0x91'),'attributes':['id',_0x84f0('0x27'),_0x84f0('0x92')]}]})[_0x84f0('0x25')](function(_0x5cf41d){if(_0x5cf41d){return _0x5cf41d['update']({'UserId':_0x41bdad[_0x84f0('0x6b')]['id']},{'transaction':_0x1b1e36});}});});}})[_0x84f0('0x25')](handleEntityNotFound(_0x312ebd,null))[_0x84f0('0x25')](respondWithResult(_0x312ebd,null))[_0x84f0('0x56')](handleError(_0x312ebd,null));};exports[_0x84f0('0x93')]=function(_0x1b2e37,_0x595740,_0x2d9b98){var _0x533906=[];return db[_0x84f0('0x79')]['describe']()['then'](function(_0x35c9ad){_0x533906=_[_0x84f0('0x32')](_0x35c9ad);return _0x1b2e37[_0x84f0('0x6b')][_0x84f0('0x94')]({'where':{'type':_0x84f0('0x7a'),'dialActive':!![],'dialMethod':_0x84f0('0x95')},'attributes':['id',_0x84f0('0x84'),_0x84f0('0x7b')],'raw':!![]});})[_0x84f0('0x25')](function(_0x467a9b){if(_0x467a9b&&_0x467a9b[_0x84f0('0x48')]){return db[_0x84f0('0x7c')][_0x84f0('0x7d')](function(_0x23556c){var _0x3b2a9e={'active':![],'recallme':!![],'id':_0x1b2e37[_0x84f0('0x5d')][_0x84f0('0x96')]};return db[_0x84f0('0x2b')][_0x84f0('0x97')]({'attributes':['id',_0x84f0('0x98'),_0x84f0('0x8a')],'where':_0x3b2a9e,'transaction':_0x23556c,'lock':_0x23556c[_0x84f0('0x8b')][_0x84f0('0x8c')],'include':[{'model':db[_0x84f0('0x79')],'as':_0x84f0('0x8d'),'attributes':_0x533906,'include':[{'model':db[_0x84f0('0x8e')],'as':_0x84f0('0x8f'),'attributes':['id',_0x84f0('0x27')]}]},{'model':db['CmList'],'as':_0x84f0('0x90'),'attributes':['id',_0x84f0('0x27')]},{'model':db[_0x84f0('0x61')],'as':'Queue','attributes':['id',_0x84f0('0x27'),_0x84f0('0x92')]}]})[_0x84f0('0x25')](function(_0x9b28b6){if(_0x9b28b6){return _0x9b28b6[_0x84f0('0x24')]({'UserId':_0x1b2e37[_0x84f0('0x6b')]['id']},{'transaction':_0x23556c});}});});}})[_0x84f0('0x25')](handleEntityNotFound(_0x595740,null))[_0x84f0('0x25')](respondWithResult(_0x595740,null))[_0x84f0('0x56')](handleError(_0x595740,null));};exports[_0x84f0('0x99')]=function(_0x3159ed,_0x519b1d,_0x3e0d1f){return _0x3159ed[_0x84f0('0x6b')][_0x84f0('0x94')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x84f0('0x95')},'attributes':['id'],'raw':!![]})['then'](function(_0xb00b4e){if(_0xb00b4e&&_0xb00b4e[_0x84f0('0x48')]){return db['CmHopper'][_0x84f0('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x84f0('0x6e'))},'VoiceQueueId':{'$in':_[_0x84f0('0x2a')](_0xb00b4e,'id')},'$or':[{'UserId':null},{'UserId':_0x3159ed[_0x84f0('0x6b')]['id']}]}});}return 0x0;})[_0x84f0('0x25')](function(_0x368a31){if(!_[_0x84f0('0x76')](_0x368a31)&&_['isNumber'](_0x368a31)){return _0x519b1d[_0x84f0('0x20')](0xc8)[_0x84f0('0x1c')]({'contacts':_0x368a31});}else{logger[_0x84f0('0x26')](_0x84f0('0x9a'),_0x84f0('0x99'),0x194,_0x84f0('0x9b'));_0x519b1d[_0x84f0('0x1a')](0x194);}})[_0x84f0('0x56')](handleError(_0x519b1d,null));};exports[_0x84f0('0x9c')]=function(_0x1a9293,_0x109d23,_0x5a0256){var _0x591a99=shared[_0x84f0('0x9d')];var _0x5ff8a9=[];_[_0x84f0('0x2a')](_0x591a99,function(_0x16e8dc){_0x5ff8a9[_0x84f0('0x9e')]({'id':_0x16e8dc[_0x84f0('0x27')],'name':_0x16e8dc[_0x84f0('0x27')],'utcOffset':_0x16e8dc[_0x84f0('0x9f')]});});return _0x109d23['status'](0xc8)[_0x84f0('0x1c')]({'tz':_0x5ff8a9});};exports['getTimezone']=function(_0xb57824,_0x46b7a1,_0x226849){var _0x4cf705=shared[_0x84f0('0x9d')];var _0x417554={};if(!_['isNil'](_0x4cf705[_0xb57824[_0x84f0('0x5d')]['id']]))_0x417554=_0x4cf705[_0xb57824['body']['id']];return _0x46b7a1[_0x84f0('0x20')](0xc8)['json'](_0x417554);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4123742..dc1334e 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 _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x53ec,0x192));var _0xc53e=function(_0x4e3079,_0x2e48ea){_0x4e3079=_0x4e3079-0x0;var _0x4356fb=_0x53ec[_0x4e3079];return _0x4356fb;};'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':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeda8=['exports','define','cm_hopper','scheduledat','phone','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0xafd73f,_0x532970){var _0x1fb0a1=function(_0xb53c05){while(--_0xb53c05){_0xafd73f['push'](_0xafd73f['shift']());}};_0x1fb0a1(++_0x532970);}(_0xeda8,0x104));var _0x8eda=function(_0x137b97,_0x34a205){_0x137b97=_0x137b97-0x0;var _0x9e3bfa=_0xeda8[_0x137b97];return _0x9e3bfa;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('CmHopper',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('0xd')]},{'name':_0x8eda('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e7c48a0..c02e3dd 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 _0x5944=['body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','name','voicePause','length','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','UserId','GetCmHopperPreview','findAll','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','Agent','List','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','options','attributes','limit','map','include','model','stringify','ShowCmHopper','find','raw','where','CreateCmHopper','create'];(function(_0x672df7,_0x250458){var _0xc3c3e7=function(_0x321176){while(--_0x321176){_0x672df7['push'](_0x672df7['shift']());}};_0xc3c3e7(++_0x250458);}(_0x5944,0xf0));var _0x4594=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x5944[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4594('0x0'));var BPromise=require(_0x4594('0x1'));var rs=require(_0x4594('0x2'));var fs=require('fs');var Redis=require(_0x4594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4594('0x4'));var logger=require(_0x4594('0x5'))(_0x4594('0x6'));var config=require(_0x4594('0x7'));var jayson=require(_0x4594('0x8'));const {validateExpressRequest}=require(_0x4594('0x9'));var client=jayson[_0x4594('0xa')][_0x4594('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x281285,_0x467933,_0x27dce6){return new BPromise(function(_0x4e78d4,_0x621ad1){return client[_0x4594('0xc')](_0x281285,_0x27dce6)[_0x4594('0xd')](function(_0x2d8882){logger[_0x4594('0xe')]('CmHopper,\x20%s,\x20%s',_0x467933,_0x4594('0xf'));logger[_0x4594('0x10')](_0x4594('0x11'),_0x467933,_0x4594('0xf'),JSON['stringify'](_0x2d8882));if(_0x2d8882[_0x4594('0x12')]){if(_0x2d8882[_0x4594('0x12')][_0x4594('0x13')]===0x1f4){logger[_0x4594('0x12')](_0x4594('0x14'),_0x467933,_0x2d8882[_0x4594('0x12')][_0x4594('0x15')]);return _0x621ad1(_0x2d8882[_0x4594('0x12')]['message']);}logger[_0x4594('0x12')](_0x4594('0x14'),_0x467933,_0x2d8882[_0x4594('0x12')][_0x4594('0x15')]);return _0x4e78d4(_0x2d8882[_0x4594('0x12')][_0x4594('0x15')]);}else{logger[_0x4594('0xe')](_0x4594('0x14'),_0x467933,_0x4594('0xf'));_0x4e78d4(_0x2d8882[_0x4594('0x16')][_0x4594('0x15')]);}})[_0x4594('0x17')](function(_0x35c032){logger[_0x4594('0x12')]('CmHopper,\x20%s,\x20%s',_0x467933,_0x35c032);_0x621ad1(_0x35c032);});});}exports[_0x4594('0x18')]=function(_0x1eaf6d){var _0x2aa580=this;return new Promise(function(_0x3943fd,_0x1f3893){return db[_0x4594('0x19')]['findAll']({'raw':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')]['where']||null:null,'attributes':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')][_0x4594('0x1b')]||null:null,'limit':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')][_0x4594('0x1c')]||null:null,'include':_0x1eaf6d[_0x4594('0x1a')]?_0x1eaf6d[_0x4594('0x1a')]['include']?_[_0x4594('0x1d')](_0x1eaf6d[_0x4594('0x1a')][_0x4594('0x1e')],function(_0x1c3387){return{'model':db[_0x1c3387['model']],'as':_0x1c3387['as'],'attributes':_0x1c3387[_0x4594('0x1b')],'include':_0x1c3387[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x1c3387[_0x4594('0x1e')],function(_0x2c4b7d){return{'model':db[_0x2c4b7d['model']],'as':_0x2c4b7d['as'],'attributes':_0x2c4b7d[_0x4594('0x1b')],'include':_0x2c4b7d['include']?_[_0x4594('0x1d')](_0x2c4b7d[_0x4594('0x1e')],function(_0x266f6a){return{'model':db[_0x266f6a[_0x4594('0x1f')]],'as':_0x266f6a['as'],'attributes':_0x266f6a['attributes']};}):[]};}):[]};}):[]:[]})[_0x4594('0xd')](function(_0x37a6c0){logger[_0x4594('0xe')](_0x4594('0x18'),_0x1eaf6d);logger[_0x4594('0x10')](_0x4594('0x18'),_0x1eaf6d,JSON[_0x4594('0x20')](_0x37a6c0));_0x3943fd(_0x37a6c0);})['catch'](function(_0x4fb010){logger[_0x4594('0x12')](_0x4594('0x18'),_0x4fb010[_0x4594('0x15')],_0x1eaf6d);_0x1f3893(_0x2aa580[_0x4594('0x12')](0x1f4,_0x4fb010[_0x4594('0x15')]));});});};exports[_0x4594('0x21')]=function(_0xfbf5cb){var _0x2a574e=this;return new Promise(function(_0xaa8f11,_0x22375e){return db['CmHopper'][_0x4594('0x22')]({'raw':_0xfbf5cb[_0x4594('0x1a')]?_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'where':_0xfbf5cb[_0x4594('0x1a')]?_0xfbf5cb['options'][_0x4594('0x24')]||null:null,'attributes':_0xfbf5cb[_0x4594('0x1a')]?_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x1b')]||null:null,'include':_0xfbf5cb['options']?_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x1e')]?_[_0x4594('0x1d')](_0xfbf5cb[_0x4594('0x1a')][_0x4594('0x1e')],function(_0x26346c){return{'model':db[_0x26346c['model']],'as':_0x26346c['as'],'attributes':_0x26346c[_0x4594('0x1b')],'include':_0x26346c[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x26346c[_0x4594('0x1e')],function(_0x1fffe6){return{'model':db[_0x1fffe6[_0x4594('0x1f')]],'as':_0x1fffe6['as'],'attributes':_0x1fffe6[_0x4594('0x1b')],'include':_0x1fffe6[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x1fffe6['include'],function(_0x174bcd){return{'model':db[_0x174bcd[_0x4594('0x1f')]],'as':_0x174bcd['as'],'attributes':_0x174bcd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x467376){logger['info'](_0x4594('0x21'),_0xfbf5cb);logger[_0x4594('0x10')](_0x4594('0x21'),_0xfbf5cb,JSON[_0x4594('0x20')](_0x467376));_0xaa8f11(_0x467376);})[_0x4594('0x17')](function(_0x8783c2){logger[_0x4594('0x12')]('ShowCmHopper',_0x8783c2[_0x4594('0x15')],_0xfbf5cb);_0x22375e(_0x2a574e[_0x4594('0x12')](0x1f4,_0x8783c2['message']));});});};exports[_0x4594('0x25')]=function(_0x3e02eb){var _0x398283=this;return new Promise(function(_0x2580eb,_0x24575a){return db['CmHopper'][_0x4594('0x26')](_0x3e02eb[_0x4594('0x27')],{'raw':_0x3e02eb['options']?_0x3e02eb[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x230124){logger[_0x4594('0xe')](_0x4594('0x25'),_0x3e02eb);logger[_0x4594('0x10')]('CreateCmHopper',_0x3e02eb,JSON[_0x4594('0x20')](_0x230124));_0x2580eb(_0x230124);})['catch'](function(_0x24a0ee){logger[_0x4594('0x12')](_0x4594('0x25'),_0x24a0ee['message'],_0x3e02eb);_0x24575a(_0x398283['error'](0x1f4,_0x24a0ee[_0x4594('0x15')]));});});};exports[_0x4594('0x28')]=function(_0xbbb126){var _0x59a1ec=this;return new Promise(function(_0x303ac4,_0x2cdbf5){return db['CmHopper']['update'](_0xbbb126[_0x4594('0x27')],{'raw':_0xbbb126[_0x4594('0x1a')]?_0xbbb126[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbbb126[_0x4594('0x1a')]?_0xbbb126[_0x4594('0x1a')][_0x4594('0x24')]||null:null,'attributes':_0xbbb126['options']?_0xbbb126[_0x4594('0x1a')][_0x4594('0x1b')]||null:null,'limit':_0xbbb126[_0x4594('0x1a')]?_0xbbb126['options'][_0x4594('0x1c')]||null:null})['then'](function(_0x32fb69){logger[_0x4594('0xe')](_0x4594('0x28'),_0xbbb126);logger['info'](_0x4594('0x29'),JSON[_0x4594('0x20')](_0xbbb126[_0x4594('0x1a')][_0x4594('0x24')]),_0xbbb126[_0x4594('0x27')][_0x4594('0x2a')]);logger['debug'](_0x4594('0x28'),_0xbbb126,JSON['stringify'](_0x32fb69));_0x303ac4(_0x32fb69);})[_0x4594('0x17')](function(_0x1e8d61){logger[_0x4594('0x12')](_0x4594('0x28'),_0x1e8d61[_0x4594('0x15')],_0xbbb126);_0x2cdbf5(_0x59a1ec[_0x4594('0x12')](0x1f4,_0x1e8d61[_0x4594('0x15')]));});});};exports[_0x4594('0x2b')]=function(_0x5f0a15){var _0x1e00f3=this;return new Promise(function(_0x4dbd7d,_0x255e5f){return db[_0x4594('0x19')]['destroy']({'where':_0x5f0a15[_0x4594('0x1a')]?_0x5f0a15['options'][_0x4594('0x24')]||null:null})[_0x4594('0xd')](function(_0xf858e0){logger['info']('DestroyCmHopper',_0x5f0a15);logger[_0x4594('0x10')]('DestroyCmHopper',_0x5f0a15,JSON[_0x4594('0x20')](_0xf858e0));_0x4dbd7d(_0xf858e0);})['catch'](function(_0x3f59d6){logger['error'](_0x4594('0x2b'),_0x3f59d6['message'],_0x5f0a15);_0x255e5f(_0x1e00f3[_0x4594('0x12')](0x1f4,_0x3f59d6[_0x4594('0x15')]));});});};exports[_0x4594('0x2c')]=function(_0x114afe){var _0x4862b6=this;return new Promise(function(_0x5c9c80,_0x41332f){return db[_0x4594('0x2d')][_0x4594('0x2e')]()[_0x4594('0xd')](function(_0x36fdb3){return db[_0x4594('0x2f')]['transaction'](function(_0x2015ee){return db[_0x4594('0x19')]['findAll']({'where':_0x114afe['options']?_0x114afe[_0x4594('0x1a')]['where']||null:null,'attributes':_0x114afe[_0x4594('0x1a')]?_0x114afe['options'][_0x4594('0x1b')]||null:null,'limit':_0x114afe[_0x4594('0x1a')]?_0x114afe['options'][_0x4594('0x1c')]||null:null,'order':_0x114afe['options']?_0x114afe[_0x4594('0x1a')][_0x4594('0x30')]||null:null,'transaction':_0x2015ee,'lock':_0x2015ee[_0x4594('0x31')][_0x4594('0x32')],'include':[{'model':db[_0x4594('0x2d')],'as':_0x4594('0x33'),'attributes':_['keys'](_0x36fdb3)},{'model':db['User'],'as':'Agent','attributes':['id',_0x4594('0x34'),_0x4594('0x35')]}]})['then'](function(_0x5ced9a){var _0x5bd788=[];var _0x3cce95=[];for(var _0x5a0882=0x0;_0x5a0882<_0x5ced9a[_0x4594('0x36')];_0x5a0882+=0x1){var _0x132e76=_0x5ced9a[_0x5a0882]['UserId'];if(_0x132e76===null){_0x5bd788['push'](_0x5ced9a[_0x5a0882][_0x4594('0x37')](_0x114afe[_0x4594('0x27')],{'transaction':_0x2015ee}));}else if(!_0x3cce95[_0x4594('0x38')](_0x132e76)){_0x3cce95[_0x4594('0x39')](_0x132e76);_0x5bd788[_0x4594('0x39')](_0x5ced9a[_0x5a0882][_0x4594('0x37')](_0x114afe[_0x4594('0x27')],{'transaction':_0x2015ee}));}}return BPromise[_0x4594('0x3a')](_0x5bd788);});})[_0x4594('0xd')](function(_0x18c61e){logger[_0x4594('0xe')]('GetContactDialer',_0x114afe);if(_0x18c61e[_0x4594('0x36')]>0x0){logger[_0x4594('0xe')](_0x4594('0x3b'),_0x18c61e[0x0]['dataValues']['id'],_0x18c61e[0x0]['dataValues'][_0x4594('0x3c')],_0x18c61e[0x0][_0x4594('0x3d')]['active']);}logger[_0x4594('0x10')](_0x4594('0x2c'),_0x114afe,JSON[_0x4594('0x20')](_0x18c61e));_0x5c9c80(_0x18c61e);})[_0x4594('0x17')](function(_0x11392){logger[_0x4594('0x12')](_0x4594('0x2c'),_0x11392[_0x4594('0x15')],_0x114afe);_0x41332f(_0x4862b6[_0x4594('0x12')](0x1f4,_0x11392['message']));});});});};exports[_0x4594('0x3e')]=function(_0x7d4d58){var _0xd8291=this;return new Promise(function(_0x2d5bbe,_0x194ded){return db[_0x4594('0x2f')][_0x4594('0x3f')](function(_0x459f01){return db[_0x4594('0x40')]['create'](_0x7d4d58[_0x4594('0x27')],{'raw':_0x7d4d58[_0x4594('0x1a')]?_0x7d4d58[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'transaction':_0x459f01})[_0x4594('0xd')](function(){logger[_0x4594('0xe')](_0x4594('0x41'),JSON[_0x4594('0x20')](_0x7d4d58['options'][_0x4594('0x24')]),_0x7d4d58[_0x4594('0x1a')]['where']['active']);return db[_0x4594('0x19')][_0x4594('0x42')]({'where':_0x7d4d58[_0x4594('0x1a')]?_0x7d4d58['options'][_0x4594('0x24')]||null:null,'transaction':_0x459f01});});})[_0x4594('0xd')](function(_0x2d0ba1){logger[_0x4594('0xe')]('MoveContactManagedDialer',_0x7d4d58);logger[_0x4594('0x10')](_0x4594('0x3e'),_0x7d4d58,JSON[_0x4594('0x20')](_0x2d0ba1));_0x2d5bbe(_0x2d0ba1);})['catch'](function(_0x408462){logger['error'](_0x4594('0x3e'),_0x408462[_0x4594('0x15')],_0x7d4d58);_0x194ded(_0xd8291[_0x4594('0x12')](0x1f4,_0x408462[_0x4594('0x15')]));});});};exports['CountReScheduled']=function(_0x45425b){var _0x1558ba=this;return new Promise(function(_0x54a001,_0x3ed868){return db[_0x4594('0x19')]['findAll']({'raw':_0x45425b[_0x4594('0x1a')]?_0x45425b[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'where':_0x45425b[_0x4594('0x1a')]?_0x45425b['options'][_0x4594('0x24')]||null:null,'attributes':[[db[_0x4594('0x2f')]['fn'](_0x4594('0x43'),db[_0x4594('0x2f')]['fn']('IF',db[_0x4594('0x2f')][_0x4594('0x44')](_0x4594('0x45')+util[_0x4594('0x46')](_0x4594('0x47'),moment()[_0x4594('0x46')](_0x4594('0x48')))+'\x20,\x201,\x20null'))),_0x4594('0x49')]]})[_0x4594('0xd')](function(_0x4ee5ae){logger[_0x4594('0xe')]('CountReScheduled',_0x45425b);logger['debug']('CountReScheduled',_0x45425b,JSON['stringify'](_0x4ee5ae));_0x54a001(_0x4ee5ae);})[_0x4594('0x17')](function(_0x2cb9d0){logger['error'](_0x4594('0x4a'),_0x2cb9d0[_0x4594('0x15')],_0x45425b);_0x3ed868(_0x1558ba[_0x4594('0x12')](0x1f4,_0x2cb9d0[_0x4594('0x15')]));});});};exports[_0x4594('0x4b')]=function(_0x1bd358){var _0x4b8cce=this;return new Promise(function(_0x12a4f9,_0x3d3061){return db[_0x4594('0x2d')][_0x4594('0x2e')]()[_0x4594('0xd')](function(_0x2561a6){return db[_0x4594('0x2f')]['transaction'](function(_0xf3b1b1){return db['CmHopper']['findAll']({'where':_0x1bd358['options']?_0x1bd358[_0x4594('0x1a')]['where']||null:null,'attributes':_0x1bd358[_0x4594('0x1a')]?_0x1bd358['options']['attributes']||null:null,'limit':0x1,'order':_0x1bd358[_0x4594('0x1a')]?_0x1bd358[_0x4594('0x1a')][_0x4594('0x30')]||null:null,'group':db[_0x4594('0x19')][_0x4594('0x4c')],'transaction':_0xf3b1b1,'lock':_0xf3b1b1[_0x4594('0x31')][_0x4594('0x32')],'include':_0x1bd358[_0x4594('0x1a')]?_0x1bd358[_0x4594('0x1a')][_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x1bd358[_0x4594('0x1a')][_0x4594('0x1e')],function(_0xfba556){return{'model':db[_0xfba556[_0x4594('0x1f')]],'as':_0xfba556['as'],'attributes':_0xfba556['attributes'],'include':_0xfba556[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0xfba556['include'],function(_0x36faf8){return{'model':db[_0x36faf8['model']],'as':_0x36faf8['as'],'attributes':_0x36faf8['attributes'],'include':_0x36faf8[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x36faf8[_0x4594('0x1e')],function(_0x4cb727){return{'model':db[_0x4cb727[_0x4594('0x1f')]],'as':_0x4cb727['as'],'attributes':_0x4cb727[_0x4594('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4594('0xd')](function(_0x4339ab){var _0x1c56dc=[];for(var _0x4fb5b2=0x0;_0x4fb5b2<_0x4339ab[_0x4594('0x36')];_0x4fb5b2+=0x1){_0x1c56dc['push'](_0x4339ab[_0x4fb5b2]['update'](_0x1bd358[_0x4594('0x27')],{'transaction':_0xf3b1b1}));}return BPromise[_0x4594('0x3a')](_0x1c56dc);});})[_0x4594('0xd')](function(_0x1b3303){logger[_0x4594('0xe')](_0x4594('0x4b'),_0x1bd358);logger['debug']('GetContactRecallMe',_0x1bd358,JSON['stringify'](_0x1b3303));_0x12a4f9(_0x1b3303);})[_0x4594('0x17')](function(_0x28e5fe){logger[_0x4594('0x12')](_0x4594('0x4b'),_0x28e5fe[_0x4594('0x15')],_0x1bd358);_0x3d3061(_0x4b8cce[_0x4594('0x12')](0x1f4,_0x28e5fe['message']));});});});};exports[_0x4594('0x4d')]=function(_0x9902d7){var _0x393e88=this;return new Promise(function(_0x256650,_0x46c759){db[_0x4594('0x2d')][_0x4594('0x2e')]()[_0x4594('0xd')](function(_0x102672){return db['CmHopper'][_0x4594('0x4e')]({'raw':_0x9902d7['options']?_0x9902d7[_0x4594('0x1a')][_0x4594('0x23')]===undefined?!![]:![]:!![],'where':_0x9902d7[_0x4594('0x1a')]?_0x9902d7[_0x4594('0x1a')][_0x4594('0x24')]||null:null,'attributes':_0x9902d7[_0x4594('0x1a')]?_0x9902d7[_0x4594('0x1a')]['attributes']||null:null,'limit':_0x9902d7[_0x4594('0x1a')]?_0x9902d7[_0x4594('0x1a')][_0x4594('0x1c')]||null:null,'include':_0x9902d7[_0x4594('0x1a')]?_0x9902d7['options']['include']?_['map'](_0x9902d7[_0x4594('0x1a')][_0x4594('0x1e')],function(_0xb2583e){return{'model':db[_0xb2583e[_0x4594('0x1f')]],'as':_0xb2583e['as'],'attributes':_0xb2583e['as']===_0x4594('0x33')?_['keys'](_0x102672):_0xb2583e[_0x4594('0x1b')],'include':_0xb2583e[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0xb2583e[_0x4594('0x1e')],function(_0x26ae25){return{'model':db[_0x26ae25['model']],'as':_0x26ae25['as'],'attributes':_0x26ae25[_0x4594('0x1b')],'include':_0x26ae25[_0x4594('0x1e')]?_[_0x4594('0x1d')](_0x26ae25['include'],function(_0xfe2027){return{'model':db[_0xfe2027[_0x4594('0x1f')]],'as':_0xfe2027['as'],'attributes':_0xfe2027[_0x4594('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4594('0xd')](function(_0x4eb552){logger[_0x4594('0xe')]('GetCmHopper',_0x9902d7);logger['debug'](_0x4594('0x18'),_0x9902d7,JSON[_0x4594('0x20')](_0x4eb552));_0x256650(_0x4eb552);})[_0x4594('0x17')](function(_0x12e9f){logger['error']('GetCmHopper',_0x12e9f['message'],_0x9902d7);_0x46c759(_0x393e88[_0x4594('0x12')](0x1f4,_0x12e9f['message']));});});});};exports[_0x4594('0x4f')]=function(_0x2d0662){var _0x523966=this;return new Promise(function(_0x3bc7ff,_0x4fcf48){return db[_0x4594('0x2d')]['findOne']({'raw':!![],'where':{'phone':_0x2d0662['options'][_0x4594('0x24')][_0x4594('0x50')]},'attributes':['id',_0x4594('0x51')],'order':[['id',_0x4594('0x52')]]})[_0x4594('0xd')](function(_0x420a76){logger[_0x4594('0xe')](_0x4594('0x53'),_0x2d0662);logger[_0x4594('0x10')](_0x4594('0x53'),_0x2d0662,JSON[_0x4594('0x20')](_0x420a76));_0x3bc7ff(_0x420a76);})['catch'](function(_0x20feba){logger[_0x4594('0x12')](_0x4594('0x53'),_0x20feba[_0x4594('0x15')],_0x2d0662);_0x4fcf48(_0x523966[_0x4594('0x12')](0x1f4,_0x20feba[_0x4594('0x15')]));});});};exports[_0x4594('0x54')]=function(_0x39bf3b){var _0x493dab=this;return new Promise(function(_0x4214e9,_0x428959){return db[_0x4594('0x2f')][_0x4594('0x3f')](function(_0x532762){return db[_0x4594('0x19')]['update']({'active':![]},{'where':{},'transaction':_0x532762})[_0x4594('0xd')](function(_0x5b27e7){logger[_0x4594('0xe')]('ResetActiveCalls',_0x39bf3b);logger['debug'](_0x4594('0x54'),_0x39bf3b,JSON['stringify'](_0x5b27e7));_0x4214e9(_0x5b27e7);})[_0x4594('0x17')](function(_0x2dfbef){logger[_0x4594('0x12')]('ResetActiveCalls',_0x2dfbef[_0x4594('0x15')],_0x39bf3b);_0x428959(_0x493dab[_0x4594('0x12')](0x1f4,_0x2dfbef[_0x4594('0x15')]));});});});};exports[_0x4594('0x55')]=function(_0x18757e){var _0x3820a1=this;var _0x463627=_0x18757e[_0x4594('0x27')][_0x4594('0x24')][_0x4594('0x56')];var _0x37f6f9=_0x18757e['body']['where'][_0x4594('0x57')];return new Promise(function(_0x353425,_0x47b00a){return db[_0x4594('0x19')][_0x4594('0x4e')]({'where':{'voiceQueueId':_0x463627,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x4594('0x2f')][_0x4594('0x44')](_0x4594('0x58')+_0x37f6f9+_0x4594('0x59'))}},'include':[{'model':db[_0x4594('0x2d')],'as':'Contact'},{'model':db[_0x4594('0x5a')],'as':_0x4594('0x5b'),'attributes':['id',_0x4594('0x34'),_0x4594('0x35')]},{'model':db['CmList'],'as':_0x4594('0x5c')}]})[_0x4594('0xd')](function(_0x477d73){return db[_0x4594('0x2f')][_0x4594('0x3f')](function(_0x58489f){return db['CmHopper']['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x463627,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x4594('0x2f')]['literal'](_0x4594('0x58')+_0x37f6f9+_0x4594('0x59'))}},'transaction':_0x58489f})[_0x4594('0xd')](function(_0x233f87){_0x353425(_0x477d73);})['catch'](function(_0x1cb2bc){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x1cb2bc['message'],_0x18757e);_0x47b00a(validateExpressRequest);});});})[_0x4594('0x17')](function(_0x38b90a){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x38b90a[_0x4594('0x15')],_0x18757e);_0x47b00a(_0x3820a1['error'](0x1f4,_0x38b90a['message']));});});}; \ No newline at end of file +var _0x9b2b=['keys','Agent','name','voicePause','length','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','CmList','List','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','twilio/lib/webhooks/webhooks','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','GetCmHopper','findAll','options','raw','attributes','limit','map','include','model','info','ShowCmHopper','CmHopper','find','where','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','CmContact','order','UPDATE','Contact'];(function(_0x33e9ea,_0x373bb9){var _0x19b47d=function(_0x30931e){while(--_0x30931e){_0x33e9ea['push'](_0x33e9ea['shift']());}};_0x19b47d(++_0x373bb9);}(_0x9b2b,0x13a));var _0xb9b2=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x9b2b[_0x39780c];return _0x53c19b;};'use strict';var _=require(_0xb9b2('0x0'));var util=require('util');var moment=require(_0xb9b2('0x1'));var BPromise=require(_0xb9b2('0x2'));var rs=require(_0xb9b2('0x3'));var fs=require('fs');var Redis=require(_0xb9b2('0x4'));var db=require(_0xb9b2('0x5'))['db'];var utils=require(_0xb9b2('0x6'));var logger=require(_0xb9b2('0x7'))(_0xb9b2('0x8'));var config=require(_0xb9b2('0x9'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0xb9b2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fbe2e,_0x1e244,_0xec6493){return new BPromise(function(_0x5c499,_0x36c865){return client['request'](_0x1fbe2e,_0xec6493)[_0xb9b2('0xb')](function(_0x24c1c6){logger['info'](_0xb9b2('0xc'),_0x1e244,'request\x20sent');logger[_0xb9b2('0xd')](_0xb9b2('0xe'),_0x1e244,'request\x20sent',JSON[_0xb9b2('0xf')](_0x24c1c6));if(_0x24c1c6['error']){if(_0x24c1c6['error'][_0xb9b2('0x10')]===0x1f4){logger[_0xb9b2('0x11')](_0xb9b2('0xc'),_0x1e244,_0x24c1c6[_0xb9b2('0x11')][_0xb9b2('0x12')]);return _0x36c865(_0x24c1c6['error'][_0xb9b2('0x12')]);}logger[_0xb9b2('0x11')](_0xb9b2('0xc'),_0x1e244,_0x24c1c6['error'][_0xb9b2('0x12')]);return _0x5c499(_0x24c1c6[_0xb9b2('0x11')][_0xb9b2('0x12')]);}else{logger['info'](_0xb9b2('0xc'),_0x1e244,_0xb9b2('0x13'));_0x5c499(_0x24c1c6['result'][_0xb9b2('0x12')]);}})[_0xb9b2('0x14')](function(_0x4b77d4){logger['error'](_0xb9b2('0xc'),_0x1e244,_0x4b77d4);_0x36c865(_0x4b77d4);});});}exports[_0xb9b2('0x15')]=function(_0xf1df0e){var _0x214421=this;return new Promise(function(_0x235bcc,_0x312ca6){return db['CmHopper'][_0xb9b2('0x16')]({'raw':_0xf1df0e[_0xb9b2('0x17')]?_0xf1df0e[_0xb9b2('0x17')][_0xb9b2('0x18')]===undefined?!![]:![]:!![],'where':_0xf1df0e[_0xb9b2('0x17')]?_0xf1df0e[_0xb9b2('0x17')]['where']||null:null,'attributes':_0xf1df0e[_0xb9b2('0x17')]?_0xf1df0e[_0xb9b2('0x17')][_0xb9b2('0x19')]||null:null,'limit':_0xf1df0e[_0xb9b2('0x17')]?_0xf1df0e['options'][_0xb9b2('0x1a')]||null:null,'include':_0xf1df0e['options']?_0xf1df0e[_0xb9b2('0x17')]['include']?_[_0xb9b2('0x1b')](_0xf1df0e[_0xb9b2('0x17')][_0xb9b2('0x1c')],function(_0xfad0f5){return{'model':db[_0xfad0f5[_0xb9b2('0x1d')]],'as':_0xfad0f5['as'],'attributes':_0xfad0f5[_0xb9b2('0x19')],'include':_0xfad0f5[_0xb9b2('0x1c')]?_['map'](_0xfad0f5[_0xb9b2('0x1c')],function(_0x373661){return{'model':db[_0x373661['model']],'as':_0x373661['as'],'attributes':_0x373661['attributes'],'include':_0x373661[_0xb9b2('0x1c')]?_[_0xb9b2('0x1b')](_0x373661['include'],function(_0x1f5a5c){return{'model':db[_0x1f5a5c[_0xb9b2('0x1d')]],'as':_0x1f5a5c['as'],'attributes':_0x1f5a5c[_0xb9b2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32189d){logger[_0xb9b2('0x1e')]('GetCmHopper',_0xf1df0e);logger['debug'](_0xb9b2('0x15'),_0xf1df0e,JSON[_0xb9b2('0xf')](_0x32189d));_0x235bcc(_0x32189d);})[_0xb9b2('0x14')](function(_0x3323dc){logger[_0xb9b2('0x11')](_0xb9b2('0x15'),_0x3323dc[_0xb9b2('0x12')],_0xf1df0e);_0x312ca6(_0x214421[_0xb9b2('0x11')](0x1f4,_0x3323dc[_0xb9b2('0x12')]));});});};exports[_0xb9b2('0x1f')]=function(_0x26c0ca){var _0x204c35=this;return new Promise(function(_0x2dd04e,_0xf56936){return db[_0xb9b2('0x20')][_0xb9b2('0x21')]({'raw':_0x26c0ca[_0xb9b2('0x17')]?_0x26c0ca[_0xb9b2('0x17')][_0xb9b2('0x18')]===undefined?!![]:![]:!![],'where':_0x26c0ca['options']?_0x26c0ca['options'][_0xb9b2('0x22')]||null:null,'attributes':_0x26c0ca['options']?_0x26c0ca[_0xb9b2('0x17')][_0xb9b2('0x19')]||null:null,'include':_0x26c0ca[_0xb9b2('0x17')]?_0x26c0ca[_0xb9b2('0x17')][_0xb9b2('0x1c')]?_[_0xb9b2('0x1b')](_0x26c0ca[_0xb9b2('0x17')][_0xb9b2('0x1c')],function(_0x5b842a){return{'model':db[_0x5b842a['model']],'as':_0x5b842a['as'],'attributes':_0x5b842a[_0xb9b2('0x19')],'include':_0x5b842a[_0xb9b2('0x1c')]?_['map'](_0x5b842a[_0xb9b2('0x1c')],function(_0xc8a7fe){return{'model':db[_0xc8a7fe['model']],'as':_0xc8a7fe['as'],'attributes':_0xc8a7fe[_0xb9b2('0x19')],'include':_0xc8a7fe['include']?_[_0xb9b2('0x1b')](_0xc8a7fe['include'],function(_0x4947e){return{'model':db[_0x4947e[_0xb9b2('0x1d')]],'as':_0x4947e['as'],'attributes':_0x4947e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9b2('0xb')](function(_0x137a9c){logger[_0xb9b2('0x1e')](_0xb9b2('0x1f'),_0x26c0ca);logger['debug'](_0xb9b2('0x1f'),_0x26c0ca,JSON['stringify'](_0x137a9c));_0x2dd04e(_0x137a9c);})[_0xb9b2('0x14')](function(_0x304be1){logger[_0xb9b2('0x11')](_0xb9b2('0x1f'),_0x304be1[_0xb9b2('0x12')],_0x26c0ca);_0xf56936(_0x204c35[_0xb9b2('0x11')](0x1f4,_0x304be1[_0xb9b2('0x12')]));});});};exports['CreateCmHopper']=function(_0x18c58a){var _0xb54c7e=this;return new Promise(function(_0x132c6c,_0x33044d){return db[_0xb9b2('0x20')][_0xb9b2('0x23')](_0x18c58a[_0xb9b2('0x24')],{'raw':_0x18c58a[_0xb9b2('0x17')]?_0x18c58a[_0xb9b2('0x17')][_0xb9b2('0x18')]===undefined?!![]:![]:!![]})[_0xb9b2('0xb')](function(_0x4cedc6){logger[_0xb9b2('0x1e')](_0xb9b2('0x25'),_0x18c58a);logger[_0xb9b2('0xd')](_0xb9b2('0x25'),_0x18c58a,JSON[_0xb9b2('0xf')](_0x4cedc6));_0x132c6c(_0x4cedc6);})[_0xb9b2('0x14')](function(_0x424788){logger['error'](_0xb9b2('0x25'),_0x424788[_0xb9b2('0x12')],_0x18c58a);_0x33044d(_0xb54c7e[_0xb9b2('0x11')](0x1f4,_0x424788['message']));});});};exports['UpdateCmHopper']=function(_0x53fff5){var _0x1e408c=this;return new Promise(function(_0x4d397c,_0x524c75){return db[_0xb9b2('0x20')][_0xb9b2('0x26')](_0x53fff5[_0xb9b2('0x24')],{'raw':_0x53fff5[_0xb9b2('0x17')]?_0x53fff5[_0xb9b2('0x17')][_0xb9b2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53fff5[_0xb9b2('0x17')]?_0x53fff5[_0xb9b2('0x17')]['where']||null:null,'attributes':_0x53fff5['options']?_0x53fff5[_0xb9b2('0x17')]['attributes']||null:null,'limit':_0x53fff5['options']?_0x53fff5[_0xb9b2('0x17')][_0xb9b2('0x1a')]||null:null})['then'](function(_0x24fb0b){logger[_0xb9b2('0x1e')]('UpdateCmHopper',_0x53fff5);logger[_0xb9b2('0x1e')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xb9b2('0xf')](_0x53fff5['options'][_0xb9b2('0x22')]),_0x53fff5['body']['active']);logger[_0xb9b2('0xd')](_0xb9b2('0x27'),_0x53fff5,JSON[_0xb9b2('0xf')](_0x24fb0b));_0x4d397c(_0x24fb0b);})['catch'](function(_0x1f955c){logger[_0xb9b2('0x11')](_0xb9b2('0x27'),_0x1f955c[_0xb9b2('0x12')],_0x53fff5);_0x524c75(_0x1e408c['error'](0x1f4,_0x1f955c[_0xb9b2('0x12')]));});});};exports[_0xb9b2('0x28')]=function(_0xdf0544){var _0x3ed6b0=this;return new Promise(function(_0xa0ec06,_0x2592fd){return db[_0xb9b2('0x20')][_0xb9b2('0x29')]({'where':_0xdf0544[_0xb9b2('0x17')]?_0xdf0544[_0xb9b2('0x17')][_0xb9b2('0x22')]||null:null})['then'](function(_0x3ffae7){logger[_0xb9b2('0x1e')](_0xb9b2('0x28'),_0xdf0544);logger[_0xb9b2('0xd')](_0xb9b2('0x28'),_0xdf0544,JSON[_0xb9b2('0xf')](_0x3ffae7));_0xa0ec06(_0x3ffae7);})[_0xb9b2('0x14')](function(_0x537b8a){logger[_0xb9b2('0x11')](_0xb9b2('0x28'),_0x537b8a[_0xb9b2('0x12')],_0xdf0544);_0x2592fd(_0x3ed6b0[_0xb9b2('0x11')](0x1f4,_0x537b8a['message']));});});};exports['GetContactDialer']=function(_0x374e3b){var _0x41bf7b=this;return new Promise(function(_0x5e7206,_0x5755b3){return db[_0xb9b2('0x2a')]['describe']()[_0xb9b2('0xb')](function(_0x1b9686){return db['sequelize']['transaction'](function(_0x2fbc2d){return db[_0xb9b2('0x20')][_0xb9b2('0x16')]({'where':_0x374e3b[_0xb9b2('0x17')]?_0x374e3b[_0xb9b2('0x17')][_0xb9b2('0x22')]||null:null,'attributes':_0x374e3b['options']?_0x374e3b['options']['attributes']||null:null,'limit':_0x374e3b[_0xb9b2('0x17')]?_0x374e3b[_0xb9b2('0x17')][_0xb9b2('0x1a')]||null:null,'order':_0x374e3b[_0xb9b2('0x17')]?_0x374e3b[_0xb9b2('0x17')][_0xb9b2('0x2b')]||null:null,'transaction':_0x2fbc2d,'lock':_0x2fbc2d['LOCK'][_0xb9b2('0x2c')],'include':[{'model':db[_0xb9b2('0x2a')],'as':_0xb9b2('0x2d'),'attributes':_[_0xb9b2('0x2e')](_0x1b9686)},{'model':db['User'],'as':_0xb9b2('0x2f'),'attributes':['id',_0xb9b2('0x30'),_0xb9b2('0x31')]}]})[_0xb9b2('0xb')](function(_0x49ec57){var _0x47d648=[];var _0x20382b=[];for(var _0x3c06a0=0x0;_0x3c06a0<_0x49ec57[_0xb9b2('0x32')];_0x3c06a0+=0x1){var _0x17d74b=_0x49ec57[_0x3c06a0]['UserId'];if(_0x17d74b===null){_0x47d648[_0xb9b2('0x33')](_0x49ec57[_0x3c06a0][_0xb9b2('0x26')](_0x374e3b[_0xb9b2('0x24')],{'transaction':_0x2fbc2d}));}else if(!_0x20382b[_0xb9b2('0x34')](_0x17d74b)){_0x20382b['push'](_0x17d74b);_0x47d648[_0xb9b2('0x33')](_0x49ec57[_0x3c06a0][_0xb9b2('0x26')](_0x374e3b['body'],{'transaction':_0x2fbc2d}));}}return BPromise[_0xb9b2('0x35')](_0x47d648);});})[_0xb9b2('0xb')](function(_0x5204e8){logger[_0xb9b2('0x1e')](_0xb9b2('0x36'),_0x374e3b);if(_0x5204e8['length']>0x0){logger[_0xb9b2('0x1e')](_0xb9b2('0x37'),_0x5204e8[0x0][_0xb9b2('0x38')]['id'],_0x5204e8[0x0][_0xb9b2('0x38')][_0xb9b2('0x39')],_0x5204e8[0x0][_0xb9b2('0x38')][_0xb9b2('0x3a')]);}logger['debug'](_0xb9b2('0x36'),_0x374e3b,JSON[_0xb9b2('0xf')](_0x5204e8));_0x5e7206(_0x5204e8);})[_0xb9b2('0x14')](function(_0x312c87){logger[_0xb9b2('0x11')](_0xb9b2('0x36'),_0x312c87['message'],_0x374e3b);_0x5755b3(_0x41bf7b['error'](0x1f4,_0x312c87['message']));});});});};exports[_0xb9b2('0x3b')]=function(_0x86daa4){var _0xe2cee=this;return new Promise(function(_0x5a8e7,_0xb5005f){return db[_0xb9b2('0x3c')][_0xb9b2('0x3d')](function(_0x3f9bcd){return db[_0xb9b2('0x3e')][_0xb9b2('0x23')](_0x86daa4[_0xb9b2('0x24')],{'raw':_0x86daa4['options']?_0x86daa4['options'][_0xb9b2('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3f9bcd})['then'](function(){logger[_0xb9b2('0x1e')](_0xb9b2('0x3f'),JSON[_0xb9b2('0xf')](_0x86daa4[_0xb9b2('0x17')]['where']),_0x86daa4[_0xb9b2('0x17')][_0xb9b2('0x22')]['active']);return db[_0xb9b2('0x20')][_0xb9b2('0x29')]({'where':_0x86daa4[_0xb9b2('0x17')]?_0x86daa4[_0xb9b2('0x17')][_0xb9b2('0x22')]||null:null,'transaction':_0x3f9bcd});});})[_0xb9b2('0xb')](function(_0x39e378){logger[_0xb9b2('0x1e')](_0xb9b2('0x3b'),_0x86daa4);logger['debug']('MoveContactManagedDialer',_0x86daa4,JSON['stringify'](_0x39e378));_0x5a8e7(_0x39e378);})[_0xb9b2('0x14')](function(_0xbfb59f){logger[_0xb9b2('0x11')]('MoveContactManagedDialer',_0xbfb59f['message'],_0x86daa4);_0xb5005f(_0xe2cee['error'](0x1f4,_0xbfb59f[_0xb9b2('0x12')]));});});};exports[_0xb9b2('0x40')]=function(_0x26ede4){var _0x36cdf2=this;return new Promise(function(_0x502a85,_0x2ca37f){return db[_0xb9b2('0x20')][_0xb9b2('0x16')]({'raw':_0x26ede4[_0xb9b2('0x17')]?_0x26ede4[_0xb9b2('0x17')][_0xb9b2('0x18')]===undefined?!![]:![]:!![],'where':_0x26ede4[_0xb9b2('0x17')]?_0x26ede4[_0xb9b2('0x17')][_0xb9b2('0x22')]||null:null,'attributes':[[db[_0xb9b2('0x3c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb9b2('0x3c')][_0xb9b2('0x41')](_0xb9b2('0x42')+util[_0xb9b2('0x43')](_0xb9b2('0x44'),moment()[_0xb9b2('0x43')](_0xb9b2('0x45')))+_0xb9b2('0x46')))),_0xb9b2('0x47')]]})[_0xb9b2('0xb')](function(_0x3e20be){logger[_0xb9b2('0x1e')](_0xb9b2('0x40'),_0x26ede4);logger[_0xb9b2('0xd')](_0xb9b2('0x40'),_0x26ede4,JSON[_0xb9b2('0xf')](_0x3e20be));_0x502a85(_0x3e20be);})[_0xb9b2('0x14')](function(_0x2f7265){logger['error'](_0xb9b2('0x40'),_0x2f7265[_0xb9b2('0x12')],_0x26ede4);_0x2ca37f(_0x36cdf2[_0xb9b2('0x11')](0x1f4,_0x2f7265[_0xb9b2('0x12')]));});});};exports[_0xb9b2('0x48')]=function(_0x259a99){var _0x59c84e=this;return new Promise(function(_0x55d765,_0x29a2cd){return db[_0xb9b2('0x2a')][_0xb9b2('0x49')]()[_0xb9b2('0xb')](function(_0x42febf){return db[_0xb9b2('0x3c')][_0xb9b2('0x3d')](function(_0x1691ad){return db[_0xb9b2('0x20')][_0xb9b2('0x16')]({'where':_0x259a99[_0xb9b2('0x17')]?_0x259a99[_0xb9b2('0x17')][_0xb9b2('0x22')]||null:null,'attributes':_0x259a99[_0xb9b2('0x17')]?_0x259a99['options'][_0xb9b2('0x19')]||null:null,'limit':0x1,'order':_0x259a99[_0xb9b2('0x17')]?_0x259a99[_0xb9b2('0x17')][_0xb9b2('0x2b')]||null:null,'group':db['CmHopper'][_0xb9b2('0x4a')],'transaction':_0x1691ad,'lock':_0x1691ad['LOCK'][_0xb9b2('0x2c')],'include':_0x259a99[_0xb9b2('0x17')]?_0x259a99[_0xb9b2('0x17')]['include']?_[_0xb9b2('0x1b')](_0x259a99['options'][_0xb9b2('0x1c')],function(_0x4afa9a){return{'model':db[_0x4afa9a[_0xb9b2('0x1d')]],'as':_0x4afa9a['as'],'attributes':_0x4afa9a[_0xb9b2('0x19')],'include':_0x4afa9a['include']?_[_0xb9b2('0x1b')](_0x4afa9a[_0xb9b2('0x1c')],function(_0x1bb5c8){return{'model':db[_0x1bb5c8[_0xb9b2('0x1d')]],'as':_0x1bb5c8['as'],'attributes':_0x1bb5c8['attributes'],'include':_0x1bb5c8['include']?_[_0xb9b2('0x1b')](_0x1bb5c8[_0xb9b2('0x1c')],function(_0x2f4f75){return{'model':db[_0x2f4f75['model']],'as':_0x2f4f75['as'],'attributes':_0x2f4f75['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9b2('0xb')](function(_0x16958e){var _0x4e8265=[];for(var _0x31947d=0x0;_0x31947d<_0x16958e[_0xb9b2('0x32')];_0x31947d+=0x1){_0x4e8265['push'](_0x16958e[_0x31947d][_0xb9b2('0x26')](_0x259a99[_0xb9b2('0x24')],{'transaction':_0x1691ad}));}return BPromise[_0xb9b2('0x35')](_0x4e8265);});})['then'](function(_0x271c30){logger[_0xb9b2('0x1e')]('GetContactRecallMe',_0x259a99);logger[_0xb9b2('0xd')](_0xb9b2('0x48'),_0x259a99,JSON[_0xb9b2('0xf')](_0x271c30));_0x55d765(_0x271c30);})[_0xb9b2('0x14')](function(_0x91ab60){logger[_0xb9b2('0x11')](_0xb9b2('0x48'),_0x91ab60[_0xb9b2('0x12')],_0x259a99);_0x29a2cd(_0x59c84e[_0xb9b2('0x11')](0x1f4,_0x91ab60['message']));});});});};exports[_0xb9b2('0x4b')]=function(_0x3e7de7){var _0x3401a6=this;return new Promise(function(_0x321197,_0x2c6277){db[_0xb9b2('0x2a')]['describe']()[_0xb9b2('0xb')](function(_0x5b67a2){return db[_0xb9b2('0x20')][_0xb9b2('0x16')]({'raw':_0x3e7de7[_0xb9b2('0x17')]?_0x3e7de7[_0xb9b2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e7de7[_0xb9b2('0x17')]?_0x3e7de7[_0xb9b2('0x17')][_0xb9b2('0x22')]||null:null,'attributes':_0x3e7de7[_0xb9b2('0x17')]?_0x3e7de7[_0xb9b2('0x17')]['attributes']||null:null,'limit':_0x3e7de7[_0xb9b2('0x17')]?_0x3e7de7[_0xb9b2('0x17')][_0xb9b2('0x1a')]||null:null,'include':_0x3e7de7['options']?_0x3e7de7[_0xb9b2('0x17')]['include']?_[_0xb9b2('0x1b')](_0x3e7de7['options']['include'],function(_0x3cff52){return{'model':db[_0x3cff52['model']],'as':_0x3cff52['as'],'attributes':_0x3cff52['as']===_0xb9b2('0x2d')?_[_0xb9b2('0x2e')](_0x5b67a2):_0x3cff52[_0xb9b2('0x19')],'include':_0x3cff52[_0xb9b2('0x1c')]?_[_0xb9b2('0x1b')](_0x3cff52[_0xb9b2('0x1c')],function(_0x80afc4){return{'model':db[_0x80afc4[_0xb9b2('0x1d')]],'as':_0x80afc4['as'],'attributes':_0x80afc4[_0xb9b2('0x19')],'include':_0x80afc4[_0xb9b2('0x1c')]?_[_0xb9b2('0x1b')](_0x80afc4['include'],function(_0x548e18){return{'model':db[_0x548e18[_0xb9b2('0x1d')]],'as':_0x548e18['as'],'attributes':_0x548e18[_0xb9b2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb9b2('0xb')](function(_0x521d57){logger[_0xb9b2('0x1e')](_0xb9b2('0x15'),_0x3e7de7);logger['debug'](_0xb9b2('0x15'),_0x3e7de7,JSON['stringify'](_0x521d57));_0x321197(_0x521d57);})['catch'](function(_0x5c79f2){logger['error'](_0xb9b2('0x15'),_0x5c79f2[_0xb9b2('0x12')],_0x3e7de7);_0x2c6277(_0x3401a6[_0xb9b2('0x11')](0x1f4,_0x5c79f2[_0xb9b2('0x12')]));});});});};exports[_0xb9b2('0x4c')]=function(_0x48483f){var _0x44c6f7=this;return new Promise(function(_0x27b937,_0x2d6958){return db['CmContact'][_0xb9b2('0x4d')]({'raw':!![],'where':{'phone':_0x48483f[_0xb9b2('0x17')][_0xb9b2('0x22')][_0xb9b2('0x4e')]},'attributes':['id','dialTimezone'],'order':[['id',_0xb9b2('0x4f')]]})[_0xb9b2('0xb')](function(_0x2a2fb8){logger[_0xb9b2('0x1e')]('getContactByPhone',_0x48483f);logger[_0xb9b2('0xd')]('getContactByPhone',_0x48483f,JSON[_0xb9b2('0xf')](_0x2a2fb8));_0x27b937(_0x2a2fb8);})[_0xb9b2('0x14')](function(_0x18216e){logger[_0xb9b2('0x11')](_0xb9b2('0x50'),_0x18216e[_0xb9b2('0x12')],_0x48483f);_0x2d6958(_0x44c6f7[_0xb9b2('0x11')](0x1f4,_0x18216e[_0xb9b2('0x12')]));});});};exports['ResetActiveCalls']=function(_0x421115){var _0x50624d=this;return new Promise(function(_0x58b3ca,_0x291251){return db[_0xb9b2('0x3c')][_0xb9b2('0x3d')](function(_0x598560){return db['CmHopper'][_0xb9b2('0x26')]({'active':![]},{'where':{},'transaction':_0x598560})[_0xb9b2('0xb')](function(_0x4f4409){logger[_0xb9b2('0x1e')](_0xb9b2('0x51'),_0x421115);logger[_0xb9b2('0xd')](_0xb9b2('0x51'),_0x421115,JSON[_0xb9b2('0xf')](_0x4f4409));_0x58b3ca(_0x4f4409);})[_0xb9b2('0x14')](function(_0x204039){logger[_0xb9b2('0x11')]('ResetActiveCalls',_0x204039[_0xb9b2('0x12')],_0x421115);_0x291251(_0x50624d[_0xb9b2('0x11')](0x1f4,_0x204039[_0xb9b2('0x12')]));});});});};exports[_0xb9b2('0x52')]=function(_0x2342d1){var _0x1c1882=this;var _0x53e8a3=_0x2342d1['body']['where'][_0xb9b2('0x53')];var _0xd7ff4f=_0x2342d1[_0xb9b2('0x24')][_0xb9b2('0x22')][_0xb9b2('0x54')];return new Promise(function(_0x4c4b05,_0x590d63){return db[_0xb9b2('0x20')][_0xb9b2('0x16')]({'where':{'voiceQueueId':_0x53e8a3,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0xb9b2('0x41')](_0xb9b2('0x55')+_0xd7ff4f+_0xb9b2('0x56'))}},'include':[{'model':db['CmContact'],'as':_0xb9b2('0x2d')},{'model':db[_0xb9b2('0x57')],'as':_0xb9b2('0x2f'),'attributes':['id',_0xb9b2('0x30'),_0xb9b2('0x31')]},{'model':db[_0xb9b2('0x58')],'as':_0xb9b2('0x59')}]})[_0xb9b2('0xb')](function(_0x5dca47){return db[_0xb9b2('0x3c')][_0xb9b2('0x3d')](function(_0x399170){return db[_0xb9b2('0x20')][_0xb9b2('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x53e8a3,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xb9b2('0x3c')][_0xb9b2('0x41')]('NOW()\x20+\x20INTERVAL\x20'+_0xd7ff4f+_0xb9b2('0x56'))}},'transaction':_0x399170})['then'](function(_0x25bcdf){_0x4c4b05(_0x5dca47);})[_0xb9b2('0x14')](function(_0x43de09){logger[_0xb9b2('0x11')]('CmHopperHandlePreviewRecallNotifications',_0x43de09[_0xb9b2('0x12')],_0x2342d1);_0x590d63(validateExpressRequest);});});})[_0xb9b2('0x14')](function(_0x313a97){logger[_0xb9b2('0x11')](_0xb9b2('0x52'),_0x313a97[_0xb9b2('0x12')],_0x2342d1);_0x590d63(_0x1c1882[_0xb9b2('0x11')](0x1f4,_0x313a97['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 50f09cf..f6118a6 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 _0xd8c0=['create','/preview','getPreview','/timezone','getTimezone','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','/describe','get','/:id','show','post'];(function(_0x1cf4ca,_0x19ac0c){var _0x2a4469=function(_0xabf342){while(--_0xabf342){_0x1cf4ca['push'](_0x1cf4ca['shift']());}};_0x2a4469(++_0x19ac0c);}(_0xd8c0,0x76));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d8c('0x0'));var util=require(_0x0d8c('0x1'));var path=require('path');var timeout=require(_0x0d8c('0x2'));var express=require('express');var router=express[_0x0d8c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0d8c('0x4'));var interaction=require(_0x0d8c('0x5'));var config=require('../../config/environment');var controller=require(_0x0d8c('0x6'));router['get']('/',auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x8')]);router['get'](_0x0d8c('0x9'),auth[_0x0d8c('0x7')](),controller['describe']);router[_0x0d8c('0xa')]('/opencontacts',auth[_0x0d8c('0x7')](),controller['getOpenContacts']);router[_0x0d8c('0xa')]('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x0d8c('0xa')](_0x0d8c('0xb'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0xc')]);router[_0x0d8c('0xd')]('/',auth['isAuthenticated'](),controller[_0x0d8c('0xe')]);router[_0x0d8c('0xd')](_0x0d8c('0xf'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x10')]);router[_0x0d8c('0xd')](_0x0d8c('0x11'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x12')]);router[_0x0d8c('0xd')]('/previewrecall',auth[_0x0d8c('0x7')](),controller['getPreviewRecall']);router['put'](_0x0d8c('0xb'),auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x13')]);router[_0x0d8c('0x14')]('/:id',auth[_0x0d8c('0x7')](),controller[_0x0d8c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0806=['destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','post','create','/preview','getPreview','getTimezone','update','delete'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x0806,0x1ef));var _0x6080=function(_0x4450ec,_0x46c816){_0x4450ec=_0x4450ec-0x0;var _0x367d6a=_0x0806[_0x4450ec];return _0x367d6a;};'use strict';var multer=require(_0x6080('0x0'));var util=require(_0x6080('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6080('0x2'));var router=express[_0x6080('0x3')]();var fs_extra=require(_0x6080('0x4'));var auth=require(_0x6080('0x5'));var interaction=require(_0x6080('0x6'));var config=require('../../config/environment');var controller=require(_0x6080('0x7'));router[_0x6080('0x8')]('/',auth[_0x6080('0x9')](),controller['index']);router[_0x6080('0x8')](_0x6080('0xa'),auth[_0x6080('0x9')](),controller[_0x6080('0xb')]);router[_0x6080('0x8')](_0x6080('0xc'),auth[_0x6080('0x9')](),controller[_0x6080('0xd')]);router[_0x6080('0x8')](_0x6080('0xe'),auth[_0x6080('0x9')](),controller[_0x6080('0xf')]);router['get'](_0x6080('0x10'),auth[_0x6080('0x9')](),controller[_0x6080('0x11')]);router[_0x6080('0x12')]('/',auth[_0x6080('0x9')](),controller[_0x6080('0x13')]);router[_0x6080('0x12')](_0x6080('0x14'),auth[_0x6080('0x9')](),controller[_0x6080('0x15')]);router[_0x6080('0x12')]('/timezone',auth[_0x6080('0x9')](),controller[_0x6080('0x16')]);router['post']('/previewrecall',auth[_0x6080('0x9')](),controller['getPreviewRecall']);router['put'](_0x6080('0x10'),auth[_0x6080('0x9')](),controller[_0x6080('0x17')]);router[_0x6080('0x18')](_0x6080('0x10'),auth[_0x6080('0x9')](),controller[_0x6080('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6c0b160..284dc32 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 _0xee14=['INTEGER','contactListQueue','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x9986e0,_0x2f99de){_0x9986e0=_0x9986e0-0x0;var _0x46594f=_0xee14[_0x9986e0];return _0x46594f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4ee1('0x0')]={'phone':{'type':Sequelize[_0x4ee1('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4ee1('0x2')],'unique':_0x4ee1('0x3')},'ListId':{'type':Sequelize[_0x4ee1('0x2')],'unique':_0x4ee1('0x3')},'VoiceQueueId':{'type':Sequelize[_0x4ee1('0x2')],'unique':_0x4ee1('0x3')}}; \ No newline at end of file +var _0xe548=['exports','STRING','INTEGER','moment','sequelize'];(function(_0x360b87,_0x4d3a5e){var _0x241f29=function(_0x1a7441){while(--_0x1a7441){_0x360b87['push'](_0x360b87['shift']());}};_0x241f29(++_0x4d3a5e);}(_0xe548,0x184));var _0x8e54=function(_0x1ca4cc,_0x402c23){_0x1ca4cc=_0x1ca4cc-0x0;var _0x108010=_0xe548[_0x1ca4cc];return _0x108010;};'use strict';var moment=require(_0x8e54('0x0'));var Sequelize=require(_0x8e54('0x1'));module[_0x8e54('0x2')]={'phone':{'type':Sequelize[_0x8e54('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8e54('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 59da5dd..518bcd5 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 _0x6f86=['then','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x6f86,0x197));var _0x66f8=function(_0x3b1bba,_0x220536){_0x3b1bba=_0x3b1bba-0x0;var _0x4ca374=_0x6f86[_0x3b1bba];return _0x4ca374;};'use strict';var emlformat=require(_0x66f8('0x0'));var rimraf=require(_0x66f8('0x1'));var zipdir=require(_0x66f8('0x2'));var jsonpatch=require(_0x66f8('0x3'));var rp=require(_0x66f8('0x4'));var moment=require(_0x66f8('0x5'));var BPromise=require(_0x66f8('0x6'));var Mustache=require(_0x66f8('0x7'));var util=require(_0x66f8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x66f8('0x9'));var ejs=require(_0x66f8('0xa'));var fs=require('fs');var fs_extra=require(_0x66f8('0xb'));var _=require(_0x66f8('0xc'));var squel=require(_0x66f8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66f8('0xe'));var toCsv=require(_0x66f8('0x9'));var querystring=require(_0x66f8('0xf'));var Papa=require(_0x66f8('0x10'));var Redis=require(_0x66f8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66f8('0x13'));var logger=require('../../config/logger')(_0x66f8('0x14'));var utils=require(_0x66f8('0x15'));var config=require(_0x66f8('0x16'));var licenseUtil=require(_0x66f8('0x17'));var db=require(_0x66f8('0x18'))['db'];function respondWithStatusCode(_0x225caf,_0x36f9bc){_0x36f9bc=_0x36f9bc||0xcc;return function(_0x1796bc){if(_0x1796bc){return _0x225caf[_0x66f8('0x19')](_0x36f9bc);}return _0x225caf[_0x66f8('0x1a')](_0x36f9bc)[_0x66f8('0x1b')]();};}function respondWithResult(_0x2d0147,_0xf269fe){_0xf269fe=_0xf269fe||0xc8;return function(_0x5e245f){if(_0x5e245f){return _0x2d0147['status'](_0xf269fe)[_0x66f8('0x1c')](_0x5e245f);}};}function respondWithFilteredResult(_0x40159e,_0x4a64d3){return function(_0x204240){if(_0x204240){var _0x1f2376=typeof _0x4a64d3[_0x66f8('0x1d')]===_0x66f8('0x1e')&&typeof _0x4a64d3['limit']===_0x66f8('0x1e');var _0x3db726=_0x204240[_0x66f8('0x1f')];var _0xf303e9=_0x1f2376?0x0:_0x4a64d3[_0x66f8('0x1d')];var _0x44abdb=_0x1f2376?_0x204240['count']:_0x4a64d3[_0x66f8('0x1d')]+_0x4a64d3[_0x66f8('0x20')];var _0x47e957;if(_0x44abdb>=_0x3db726){_0x44abdb=_0x3db726;_0x47e957=0xc8;}else{_0x47e957=0xce;}_0x40159e[_0x66f8('0x1a')](_0x47e957);return _0x40159e['set'](_0x66f8('0x21'),_0xf303e9+'-'+_0x44abdb+'/'+_0x3db726)[_0x66f8('0x1c')](_0x204240);}return null;};}function patchUpdates(_0x2aa624){return function(_0xeae797){try{jsonpatch[_0x66f8('0x22')](_0xeae797,_0x2aa624,!![]);}catch(_0x1c61ab){return BPromise[_0x66f8('0x23')](_0x1c61ab);}return _0xeae797['save']();};}function saveUpdates(_0x4db568,_0x3189b0){return function(_0x340b6e){if(_0x340b6e){return _0x340b6e[_0x66f8('0x24')](_0x4db568)[_0x66f8('0x25')](function(_0x5793d1){return _0x5793d1;});}return null;};}function removeEntity(_0x392203,_0x5832c5){return function(_0x4aae92){if(_0x4aae92){return _0x4aae92['destroy']()[_0x66f8('0x25')](function(){_0x392203[_0x66f8('0x1a')](0xcc)[_0x66f8('0x1b')]();});}};}function handleEntityNotFound(_0x462091,_0x12117e){return function(_0x5e7192){if(!_0x5e7192){_0x462091[_0x66f8('0x19')](0x194);}return _0x5e7192;};}function handleError(_0x607cdb,_0x3592e2){_0x3592e2=_0x3592e2||0x1f4;return function(_0x16a20d){logger[_0x66f8('0x26')](_0x16a20d[_0x66f8('0x27')]);if(_0x16a20d['name']){delete _0x16a20d[_0x66f8('0x28')];}_0x607cdb[_0x66f8('0x1a')](_0x3592e2)['send'](_0x16a20d);};}exports[_0x66f8('0x29')]=function(_0x252d19,_0x19f00d){var _0x7b9110={},_0x1c23c9={},_0x38bbbd={'count':0x0,'rows':[]};var _0x1c2ab1=_[_0x66f8('0x2a')](db[_0x66f8('0x2b')][_0x66f8('0x2c')],function(_0x24ae49){return{'name':_0x24ae49[_0x66f8('0x2d')],'type':_0x24ae49['type'][_0x66f8('0x2e')]};});_0x1c23c9[_0x66f8('0x2f')]=_[_0x66f8('0x2a')](_0x1c2ab1,'name');_0x1c23c9['query']=_[_0x66f8('0x30')](_0x252d19[_0x66f8('0x31')]);_0x1c23c9[_0x66f8('0x32')]=_[_0x66f8('0x33')](_0x1c23c9[_0x66f8('0x2f')],_0x1c23c9[_0x66f8('0x31')]);_0x7b9110['attributes']=_[_0x66f8('0x33')](_0x1c23c9[_0x66f8('0x2f')],qs['fields'](_0x252d19['query'][_0x66f8('0x34')]));_0x7b9110[_0x66f8('0x35')]=_0x7b9110[_0x66f8('0x35')][_0x66f8('0x36')]?_0x7b9110[_0x66f8('0x35')]:_0x1c23c9[_0x66f8('0x2f')];if(!_0x252d19['query'][_0x66f8('0x37')]('nolimit')){_0x7b9110[_0x66f8('0x20')]=qs['limit'](_0x252d19[_0x66f8('0x31')][_0x66f8('0x20')]);_0x7b9110[_0x66f8('0x1d')]=qs['offset'](_0x252d19[_0x66f8('0x31')]['offset']);}_0x7b9110[_0x66f8('0x38')]=qs[_0x66f8('0x39')](_0x252d19[_0x66f8('0x31')][_0x66f8('0x39')]);_0x7b9110[_0x66f8('0x3a')]=qs['filters'](_[_0x66f8('0x3b')](_0x252d19[_0x66f8('0x31')],_0x1c23c9['filters']),_0x1c2ab1);if(_0x252d19[_0x66f8('0x31')]['filter']){_0x7b9110[_0x66f8('0x3a')]=_[_0x66f8('0x3c')](_0x7b9110['where'],{'$or':_[_0x66f8('0x2a')](_0x1c2ab1,function(_0x565c5e){if(_0x565c5e['type']!==_0x66f8('0x3d')){var _0x1fa628={};_0x1fa628[_0x565c5e[_0x66f8('0x28')]]={'$like':'%'+_0x252d19['query'][_0x66f8('0x3e')]+'%'};return _0x1fa628;}})});}_0x7b9110=_[_0x66f8('0x3c')]({},_0x7b9110,_0x252d19[_0x66f8('0x3f')]);var _0x26752b={'where':_0x7b9110[_0x66f8('0x3a')]};return db[_0x66f8('0x2b')]['count'](_0x26752b)[_0x66f8('0x25')](function(_0x40eb85){_0x38bbbd[_0x66f8('0x1f')]=_0x40eb85;if(_0x252d19['query'][_0x66f8('0x40')]){_0x7b9110[_0x66f8('0x41')]=[{'all':!![]}];}return db[_0x66f8('0x2b')]['findAll'](_0x7b9110);})[_0x66f8('0x25')](function(_0x5b7da0){_0x38bbbd[_0x66f8('0x42')]=_0x5b7da0;return _0x38bbbd;})[_0x66f8('0x25')](respondWithFilteredResult(_0x19f00d,_0x7b9110))[_0x66f8('0x43')](handleError(_0x19f00d,null));};exports[_0x66f8('0x44')]=function(_0x2bbee0,_0x28462e){var _0x1748ab={'raw':!![],'where':{'id':_0x2bbee0[_0x66f8('0x45')]['id']}},_0x5ebeea={};_0x5ebeea['model']=_['keys'](db['CmHopperBlack'][_0x66f8('0x2c')]);_0x5ebeea[_0x66f8('0x31')]=_[_0x66f8('0x30')](_0x2bbee0['query']);_0x5ebeea['filters']=_[_0x66f8('0x33')](_0x5ebeea[_0x66f8('0x2f')],_0x5ebeea[_0x66f8('0x31')]);_0x1748ab['attributes']=_[_0x66f8('0x33')](_0x5ebeea['model'],qs[_0x66f8('0x34')](_0x2bbee0[_0x66f8('0x31')][_0x66f8('0x34')]));_0x1748ab[_0x66f8('0x35')]=_0x1748ab[_0x66f8('0x35')][_0x66f8('0x36')]?_0x1748ab[_0x66f8('0x35')]:_0x5ebeea['model'];if(_0x2bbee0[_0x66f8('0x31')]['includeAll']){_0x1748ab['include']=[{'all':!![]}];}_0x1748ab=_[_0x66f8('0x3c')]({},_0x1748ab,_0x2bbee0[_0x66f8('0x3f')]);return db[_0x66f8('0x2b')]['find'](_0x1748ab)['then'](handleEntityNotFound(_0x28462e,null))[_0x66f8('0x25')](respondWithResult(_0x28462e,null))[_0x66f8('0x43')](handleError(_0x28462e,null));};exports[_0x66f8('0x24')]=function(_0x1b6f1f,_0x5eefa1){if(_0x1b6f1f['body']['id']){delete _0x1b6f1f[_0x66f8('0x46')]['id'];}return db[_0x66f8('0x2b')]['find']({'where':{'id':_0x1b6f1f[_0x66f8('0x45')]['id']}})[_0x66f8('0x25')](handleEntityNotFound(_0x5eefa1,null))[_0x66f8('0x25')](saveUpdates(_0x1b6f1f[_0x66f8('0x46')],null))[_0x66f8('0x25')](respondWithResult(_0x5eefa1,null))[_0x66f8('0x43')](handleError(_0x5eefa1,null));};exports[_0x66f8('0x47')]=function(_0x50aceb,_0x1eb937){return db[_0x66f8('0x2b')][_0x66f8('0x48')]({'where':{'id':_0x50aceb[_0x66f8('0x45')]['id']}})[_0x66f8('0x25')](handleEntityNotFound(_0x1eb937,null))[_0x66f8('0x25')](removeEntity(_0x1eb937,null))['catch'](handleError(_0x1eb937,null));};exports[_0x66f8('0x49')]=function(_0x1a0442,_0x565c63){return db[_0x66f8('0x2b')][_0x66f8('0x49')]()[_0x66f8('0x25')](respondWithResult(_0x565c63,null))['catch'](handleError(_0x565c63,null));}; \ No newline at end of file +var _0x9242=['show','params','find','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','error','name','send','map','CmHopperBlack','rawAttributes','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','then','includeAll','include','findAll','catch'];(function(_0x2c8db2,_0x2fc833){var _0x1afcc8=function(_0x5e4990){while(--_0x5e4990){_0x2c8db2['push'](_0x2c8db2['shift']());}};_0x1afcc8(++_0x2fc833);}(_0x9242,0x1a3));var _0x2924=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x9242[_0x51c819];return _0x15c5d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2924('0x0'));var zipdir=require(_0x2924('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2924('0x2'));var moment=require(_0x2924('0x3'));var BPromise=require(_0x2924('0x4'));var Mustache=require(_0x2924('0x5'));var util=require('util');var path=require(_0x2924('0x6'));var sox=require(_0x2924('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2924('0x8'));var _=require(_0x2924('0x9'));var squel=require(_0x2924('0xa'));var crypto=require(_0x2924('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2924('0xc'));var querystring=require(_0x2924('0xd'));var Papa=require(_0x2924('0xe'));var Redis=require(_0x2924('0xf'));var authService=require(_0x2924('0x10'));var qs=require(_0x2924('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2924('0x12'))('api');var utils=require(_0x2924('0x13'));var config=require(_0x2924('0x14'));var licenseUtil=require(_0x2924('0x15'));var db=require(_0x2924('0x16'))['db'];function respondWithStatusCode(_0x147463,_0x57d393){_0x57d393=_0x57d393||0xcc;return function(_0x2ce80d){if(_0x2ce80d){return _0x147463[_0x2924('0x17')](_0x57d393);}return _0x147463[_0x2924('0x18')](_0x57d393)[_0x2924('0x19')]();};}function respondWithResult(_0x529c12,_0x25ff35){_0x25ff35=_0x25ff35||0xc8;return function(_0x26b7c1){if(_0x26b7c1){return _0x529c12[_0x2924('0x18')](_0x25ff35)[_0x2924('0x1a')](_0x26b7c1);}};}function respondWithFilteredResult(_0x502d2c,_0x4b2776){return function(_0x2b7e0e){if(_0x2b7e0e){var _0x1af6c4=typeof _0x4b2776['offset']===_0x2924('0x1b')&&typeof _0x4b2776[_0x2924('0x1c')]===_0x2924('0x1b');var _0xabf091=_0x2b7e0e['count'];var _0x2eb2e0=_0x1af6c4?0x0:_0x4b2776[_0x2924('0x1d')];var _0x40dfcc=_0x1af6c4?_0x2b7e0e[_0x2924('0x1e')]:_0x4b2776[_0x2924('0x1d')]+_0x4b2776[_0x2924('0x1c')];var _0x1fa04d;if(_0x40dfcc>=_0xabf091){_0x40dfcc=_0xabf091;_0x1fa04d=0xc8;}else{_0x1fa04d=0xce;}_0x502d2c['status'](_0x1fa04d);return _0x502d2c[_0x2924('0x1f')]('Content-Range',_0x2eb2e0+'-'+_0x40dfcc+'/'+_0xabf091)['json'](_0x2b7e0e);}return null;};}function patchUpdates(_0x752fee){return function(_0x211439){try{jsonpatch[_0x2924('0x20')](_0x211439,_0x752fee,!![]);}catch(_0x2c1e22){return BPromise[_0x2924('0x21')](_0x2c1e22);}return _0x211439[_0x2924('0x22')]();};}function saveUpdates(_0x2ecd3c,_0x2ec147){return function(_0x1226e4){if(_0x1226e4){return _0x1226e4[_0x2924('0x23')](_0x2ecd3c)['then'](function(_0x1d650e){return _0x1d650e;});}return null;};}function removeEntity(_0x159e00,_0x184654){return function(_0x31aae4){if(_0x31aae4){return _0x31aae4[_0x2924('0x24')]()['then'](function(){_0x159e00[_0x2924('0x18')](0xcc)[_0x2924('0x19')]();});}};}function handleEntityNotFound(_0x130bf4,_0x236f15){return function(_0x3c16be){if(!_0x3c16be){_0x130bf4[_0x2924('0x17')](0x194);}return _0x3c16be;};}function handleError(_0x1a9b12,_0x4dc8c9){_0x4dc8c9=_0x4dc8c9||0x1f4;return function(_0x4cbe8e){logger[_0x2924('0x25')](_0x4cbe8e['stack']);if(_0x4cbe8e[_0x2924('0x26')]){delete _0x4cbe8e['name'];}_0x1a9b12[_0x2924('0x18')](_0x4dc8c9)[_0x2924('0x27')](_0x4cbe8e);};}exports['index']=function(_0x45ea1a,_0x5ee280){var _0x47fbff={},_0x4b060e={},_0x21bbe1={'count':0x0,'rows':[]};var _0x2399ff=_[_0x2924('0x28')](db[_0x2924('0x29')][_0x2924('0x2a')],function(_0x250e22){return{'name':_0x250e22['fieldName'],'type':_0x250e22[_0x2924('0x2b')]['key']};});_0x4b060e[_0x2924('0x2c')]=_[_0x2924('0x28')](_0x2399ff,_0x2924('0x26'));_0x4b060e[_0x2924('0x2d')]=_['keys'](_0x45ea1a[_0x2924('0x2d')]);_0x4b060e['filters']=_[_0x2924('0x2e')](_0x4b060e[_0x2924('0x2c')],_0x4b060e[_0x2924('0x2d')]);_0x47fbff[_0x2924('0x2f')]=_[_0x2924('0x2e')](_0x4b060e[_0x2924('0x2c')],qs[_0x2924('0x30')](_0x45ea1a[_0x2924('0x2d')][_0x2924('0x30')]));_0x47fbff[_0x2924('0x2f')]=_0x47fbff[_0x2924('0x2f')][_0x2924('0x31')]?_0x47fbff['attributes']:_0x4b060e[_0x2924('0x2c')];if(!_0x45ea1a['query']['hasOwnProperty'](_0x2924('0x32'))){_0x47fbff[_0x2924('0x1c')]=qs[_0x2924('0x1c')](_0x45ea1a[_0x2924('0x2d')][_0x2924('0x1c')]);_0x47fbff[_0x2924('0x1d')]=qs[_0x2924('0x1d')](_0x45ea1a[_0x2924('0x2d')]['offset']);}_0x47fbff[_0x2924('0x33')]=qs[_0x2924('0x34')](_0x45ea1a[_0x2924('0x2d')][_0x2924('0x34')]);_0x47fbff[_0x2924('0x35')]=qs[_0x2924('0x36')](_[_0x2924('0x37')](_0x45ea1a[_0x2924('0x2d')],_0x4b060e[_0x2924('0x36')]),_0x2399ff);if(_0x45ea1a[_0x2924('0x2d')][_0x2924('0x38')]){_0x47fbff[_0x2924('0x35')]=_[_0x2924('0x39')](_0x47fbff[_0x2924('0x35')],{'$or':_['map'](_0x2399ff,function(_0x4217a5){if(_0x4217a5[_0x2924('0x2b')]!=='VIRTUAL'){var _0xe8902e={};_0xe8902e[_0x4217a5[_0x2924('0x26')]]={'$like':'%'+_0x45ea1a[_0x2924('0x2d')][_0x2924('0x38')]+'%'};return _0xe8902e;}})});}_0x47fbff=_['merge']({},_0x47fbff,_0x45ea1a[_0x2924('0x3a')]);var _0x4f9856={'where':_0x47fbff[_0x2924('0x35')]};return db['CmHopperBlack'][_0x2924('0x1e')](_0x4f9856)[_0x2924('0x3b')](function(_0x31295f){_0x21bbe1[_0x2924('0x1e')]=_0x31295f;if(_0x45ea1a[_0x2924('0x2d')][_0x2924('0x3c')]){_0x47fbff[_0x2924('0x3d')]=[{'all':!![]}];}return db[_0x2924('0x29')][_0x2924('0x3e')](_0x47fbff);})[_0x2924('0x3b')](function(_0x587b62){_0x21bbe1['rows']=_0x587b62;return _0x21bbe1;})['then'](respondWithFilteredResult(_0x5ee280,_0x47fbff))[_0x2924('0x3f')](handleError(_0x5ee280,null));};exports[_0x2924('0x40')]=function(_0x3663e6,_0x7adfd2){var _0x1c9d95={'raw':!![],'where':{'id':_0x3663e6[_0x2924('0x41')]['id']}},_0x4a910d={};_0x4a910d[_0x2924('0x2c')]=_['keys'](db[_0x2924('0x29')][_0x2924('0x2a')]);_0x4a910d[_0x2924('0x2d')]=_['keys'](_0x3663e6[_0x2924('0x2d')]);_0x4a910d[_0x2924('0x36')]=_['intersection'](_0x4a910d[_0x2924('0x2c')],_0x4a910d[_0x2924('0x2d')]);_0x1c9d95[_0x2924('0x2f')]=_[_0x2924('0x2e')](_0x4a910d[_0x2924('0x2c')],qs[_0x2924('0x30')](_0x3663e6['query'][_0x2924('0x30')]));_0x1c9d95[_0x2924('0x2f')]=_0x1c9d95[_0x2924('0x2f')][_0x2924('0x31')]?_0x1c9d95['attributes']:_0x4a910d[_0x2924('0x2c')];if(_0x3663e6[_0x2924('0x2d')][_0x2924('0x3c')]){_0x1c9d95['include']=[{'all':!![]}];}_0x1c9d95=_[_0x2924('0x39')]({},_0x1c9d95,_0x3663e6[_0x2924('0x3a')]);return db['CmHopperBlack'][_0x2924('0x42')](_0x1c9d95)['then'](handleEntityNotFound(_0x7adfd2,null))[_0x2924('0x3b')](respondWithResult(_0x7adfd2,null))[_0x2924('0x3f')](handleError(_0x7adfd2,null));};exports['update']=function(_0x2a0c91,_0x4f530f){if(_0x2a0c91[_0x2924('0x43')]['id']){delete _0x2a0c91['body']['id'];}return db[_0x2924('0x29')]['find']({'where':{'id':_0x2a0c91[_0x2924('0x41')]['id']}})[_0x2924('0x3b')](handleEntityNotFound(_0x4f530f,null))[_0x2924('0x3b')](saveUpdates(_0x2a0c91['body'],null))[_0x2924('0x3b')](respondWithResult(_0x4f530f,null))['catch'](handleError(_0x4f530f,null));};exports[_0x2924('0x24')]=function(_0x4ae18b,_0x558ca0){return db['CmHopperBlack'][_0x2924('0x42')]({'where':{'id':_0x4ae18b[_0x2924('0x41')]['id']}})['then'](handleEntityNotFound(_0x558ca0,null))[_0x2924('0x3b')](removeEntity(_0x558ca0,null))[_0x2924('0x3f')](handleError(_0x558ca0,null));};exports[_0x2924('0x44')]=function(_0x249eb2,_0x3e48f1){return db[_0x2924('0x29')]['describe']()[_0x2924('0x3b')](respondWithResult(_0x3e48f1,null))[_0x2924('0x3f')](handleError(_0x3e48f1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 83aa599..40c304d 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 _0x79c7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperBlack','lodash','util','../../config/logger','moment'];(function(_0x16f6e4,_0x288b61){var _0x275354=function(_0x43865e){while(--_0x43865e){_0x16f6e4['push'](_0x16f6e4['shift']());}};_0x275354(++_0x288b61);}(_0x79c7,0xcd));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x779c('0x0'));var util=require(_0x779c('0x1'));var logger=require(_0x779c('0x2'))('api');var moment=require(_0x779c('0x3'));var BPromise=require(_0x779c('0x4'));var rp=require(_0x779c('0x5'));var fs=require('fs');var path=require(_0x779c('0x6'));var rimraf=require(_0x779c('0x7'));var config=require(_0x779c('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x779c('0x9')]=function(_0x4e0398,_0x626dd0){return _0x4e0398['define'](_0x779c('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4524=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x21b9e0,_0x4357ba){var _0x15c344=function(_0x4debd5){while(--_0x4debd5){_0x21b9e0['push'](_0x21b9e0['shift']());}};_0x15c344(++_0x4357ba);}(_0x4524,0x180));var _0x4452=function(_0x2dd10a,_0x59a648){_0x2dd10a=_0x2dd10a-0x0;var _0x3c5aa0=_0x4524[_0x2dd10a];return _0x3c5aa0;};'use strict';var _=require(_0x4452('0x0'));var util=require('util');var logger=require(_0x4452('0x1'))('api');var moment=require(_0x4452('0x2'));var BPromise=require('bluebird');var rp=require(_0x4452('0x3'));var fs=require('fs');var path=require(_0x4452('0x4'));var rimraf=require('rimraf');var config=require(_0x4452('0x5'));var attributes=require(_0x4452('0x6'));module[_0x4452('0x7')]=function(_0x4061df,_0x5a1a08){return _0x4061df[_0x4452('0x8')](_0x4452('0x9'),attributes,{'tableName':'cm_hopper_black','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 2a44dc2..f43bafd 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 _0x7413=['../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','where','limit','include','map','model','attributes','UpdateCmHopperBlack','update','body','raw','catch','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f0ac9,_0xf8844e){var _0x1d1f24=function(_0x4f1387){while(--_0x4f1387){_0x4f0ac9['push'](_0x4f0ac9['shift']());}};_0x1d1f24(++_0xf8844e);}(_0x7413,0x6f));var _0x3741=function(_0x54cf06,_0x2226a3){_0x54cf06=_0x54cf06-0x0;var _0x233653=_0x7413[_0x54cf06];return _0x233653;};'use strict';var _=require(_0x3741('0x0'));var util=require('util');var moment=require(_0x3741('0x1'));var BPromise=require(_0x3741('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3741('0x3'));var db=require(_0x3741('0x4'))['db'];var utils=require(_0x3741('0x5'));var logger=require(_0x3741('0x6'))(_0x3741('0x7'));var config=require('../../config/environment');var jayson=require(_0x3741('0x8'));var client=jayson[_0x3741('0x9')][_0x3741('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x492211,_0x27613e,_0xe07bbf){return new BPromise(function(_0x36fefa,_0x17e20d){return client['request'](_0x492211,_0xe07bbf)[_0x3741('0xb')](function(_0x535269){logger[_0x3741('0xc')](_0x3741('0xd'),_0x27613e,_0x3741('0xe'));logger[_0x3741('0xf')](_0x3741('0x10'),_0x27613e,_0x3741('0xe'),JSON[_0x3741('0x11')](_0x535269));if(_0x535269[_0x3741('0x12')]){if(_0x535269['error'][_0x3741('0x13')]===0x1f4){logger['error'](_0x3741('0xd'),_0x27613e,_0x535269[_0x3741('0x12')][_0x3741('0x14')]);return _0x17e20d(_0x535269[_0x3741('0x12')][_0x3741('0x14')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x27613e,_0x535269[_0x3741('0x12')][_0x3741('0x14')]);return _0x36fefa(_0x535269[_0x3741('0x12')]['message']);}else{logger['info'](_0x3741('0xd'),_0x27613e,_0x3741('0xe'));_0x36fefa(_0x535269[_0x3741('0x15')]['message']);}})['catch'](function(_0x30dee2){logger[_0x3741('0x12')](_0x3741('0xd'),_0x27613e,_0x30dee2);_0x17e20d(_0x30dee2);});});}exports[_0x3741('0x16')]=function(_0x335a9c){var _0x53f2ff=this;return new Promise(function(_0x39b9a3,_0xfe3064){return db[_0x3741('0x17')][_0x3741('0x18')]({'raw':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')][_0x3741('0x1a')]||null:null,'attributes':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')]['attributes']||null:null,'limit':_0x335a9c['options']?_0x335a9c[_0x3741('0x19')][_0x3741('0x1b')]||null:null,'include':_0x335a9c[_0x3741('0x19')]?_0x335a9c[_0x3741('0x19')][_0x3741('0x1c')]?_[_0x3741('0x1d')](_0x335a9c['options'][_0x3741('0x1c')],function(_0x178fdf){return{'model':db[_0x178fdf[_0x3741('0x1e')]],'as':_0x178fdf['as'],'attributes':_0x178fdf[_0x3741('0x1f')],'include':_0x178fdf[_0x3741('0x1c')]?_['map'](_0x178fdf[_0x3741('0x1c')],function(_0x58edcf){return{'model':db[_0x58edcf[_0x3741('0x1e')]],'as':_0x58edcf['as'],'attributes':_0x58edcf[_0x3741('0x1f')],'include':_0x58edcf['include']?_[_0x3741('0x1d')](_0x58edcf[_0x3741('0x1c')],function(_0x6020b4){return{'model':db[_0x6020b4[_0x3741('0x1e')]],'as':_0x6020b4['as'],'attributes':_0x6020b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3741('0xb')](function(_0x8606f9){logger[_0x3741('0xc')](_0x3741('0x16'),_0x335a9c);logger[_0x3741('0xf')](_0x3741('0x16'),_0x335a9c,JSON[_0x3741('0x11')](_0x8606f9));_0x39b9a3(_0x8606f9);})['catch'](function(_0x5ea0fa){logger[_0x3741('0x12')]('GetCmHopperBlack',_0x5ea0fa['message'],_0x335a9c);_0xfe3064(_0x53f2ff['error'](0x1f4,_0x5ea0fa['message']));});});};exports[_0x3741('0x20')]=function(_0x1928b9){var _0x2e29f4=this;return new Promise(function(_0x179b97,_0x474fd2){return db['CmHopperBlack'][_0x3741('0x21')](_0x1928b9[_0x3741('0x22')],{'raw':_0x1928b9[_0x3741('0x19')]?_0x1928b9[_0x3741('0x19')][_0x3741('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1928b9['options']?_0x1928b9[_0x3741('0x19')][_0x3741('0x1a')]||null:null,'attributes':_0x1928b9[_0x3741('0x19')]?_0x1928b9['options']['attributes']||null:null,'limit':_0x1928b9[_0x3741('0x19')]?_0x1928b9['options'][_0x3741('0x1b')]||null:null})[_0x3741('0xb')](function(_0x2b43a6){logger[_0x3741('0xc')]('UpdateCmHopperBlack',_0x1928b9);logger[_0x3741('0xf')](_0x3741('0x20'),_0x1928b9,JSON[_0x3741('0x11')](_0x2b43a6));_0x179b97(_0x2b43a6);})[_0x3741('0x24')](function(_0x19c307){logger['error'](_0x3741('0x20'),_0x19c307[_0x3741('0x14')],_0x1928b9);_0x474fd2(_0x2e29f4['error'](0x1f4,_0x19c307[_0x3741('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x4faa99){var _0x47753f=this;return new Promise(function(_0x15b705,_0x2044f7){return db[_0x3741('0x17')][_0x3741('0x25')]({'where':_0x4faa99[_0x3741('0x19')]?_0x4faa99[_0x3741('0x19')][_0x3741('0x1a')]||null:null})[_0x3741('0xb')](function(_0x326c96){logger[_0x3741('0xc')](_0x3741('0x26'),_0x4faa99);logger['debug'](_0x3741('0x26'),_0x4faa99,JSON['stringify'](_0x326c96));_0x15b705(_0x326c96);})['catch'](function(_0x5a8904){logger[_0x3741('0x12')](_0x3741('0x26'),_0x5a8904[_0x3741('0x14')],_0x4faa99);_0x2044f7(_0x47753f[_0x3741('0x12')](0x1f4,_0x5a8904[_0x3741('0x14')]));});});}; \ No newline at end of file +var _0xa0d6=['jayson/promise','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','include','map','model','then','update','raw','where','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x28836b,_0x389433){var _0x51f3f8=function(_0x503226){while(--_0x503226){_0x28836b['push'](_0x28836b['shift']());}};_0x51f3f8(++_0x389433);}(_0xa0d6,0xe0));var _0x6a0d=function(_0x5c3735,_0x390575){_0x5c3735=_0x5c3735-0x0;var _0x4de745=_0xa0d6[_0x5c3735];return _0x4de745;};'use strict';var _=require(_0x6a0d('0x0'));var util=require(_0x6a0d('0x1'));var moment=require(_0x6a0d('0x2'));var BPromise=require(_0x6a0d('0x3'));var rs=require(_0x6a0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a0d('0x5'))['db'];var utils=require(_0x6a0d('0x6'));var logger=require(_0x6a0d('0x7'))(_0x6a0d('0x8'));var config=require(_0x6a0d('0x9'));var jayson=require(_0x6a0d('0xa'));var client=jayson['client'][_0x6a0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1304c2,_0x5c37ca,_0x109486){return new BPromise(function(_0x3c1d6b,_0x3ee795){return client[_0x6a0d('0xc')](_0x1304c2,_0x109486)['then'](function(_0x2ee5be){logger[_0x6a0d('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x5c37ca,_0x6a0d('0xe'));logger[_0x6a0d('0xf')](_0x6a0d('0x10'),_0x5c37ca,_0x6a0d('0xe'),JSON[_0x6a0d('0x11')](_0x2ee5be));if(_0x2ee5be[_0x6a0d('0x12')]){if(_0x2ee5be[_0x6a0d('0x12')][_0x6a0d('0x13')]===0x1f4){logger[_0x6a0d('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x5c37ca,_0x2ee5be[_0x6a0d('0x12')]['message']);return _0x3ee795(_0x2ee5be[_0x6a0d('0x12')]['message']);}logger[_0x6a0d('0x12')](_0x6a0d('0x14'),_0x5c37ca,_0x2ee5be['error'][_0x6a0d('0x15')]);return _0x3c1d6b(_0x2ee5be['error'][_0x6a0d('0x15')]);}else{logger[_0x6a0d('0xd')](_0x6a0d('0x14'),_0x5c37ca,_0x6a0d('0xe'));_0x3c1d6b(_0x2ee5be[_0x6a0d('0x16')][_0x6a0d('0x15')]);}})[_0x6a0d('0x17')](function(_0x25b00e){logger[_0x6a0d('0x12')](_0x6a0d('0x14'),_0x5c37ca,_0x25b00e);_0x3ee795(_0x25b00e);});});}exports[_0x6a0d('0x18')]=function(_0x2abb25){var _0x693fce=this;return new Promise(function(_0x382141,_0x1b677a){return db[_0x6a0d('0x19')][_0x6a0d('0x1a')]({'raw':_0x2abb25[_0x6a0d('0x1b')]?_0x2abb25[_0x6a0d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2abb25[_0x6a0d('0x1b')]?_0x2abb25[_0x6a0d('0x1b')]['where']||null:null,'attributes':_0x2abb25[_0x6a0d('0x1b')]?_0x2abb25[_0x6a0d('0x1b')][_0x6a0d('0x1c')]||null:null,'limit':_0x2abb25[_0x6a0d('0x1b')]?_0x2abb25[_0x6a0d('0x1b')]['limit']||null:null,'include':_0x2abb25[_0x6a0d('0x1b')]?_0x2abb25[_0x6a0d('0x1b')][_0x6a0d('0x1d')]?_[_0x6a0d('0x1e')](_0x2abb25[_0x6a0d('0x1b')][_0x6a0d('0x1d')],function(_0x22b9e4){return{'model':db[_0x22b9e4[_0x6a0d('0x1f')]],'as':_0x22b9e4['as'],'attributes':_0x22b9e4[_0x6a0d('0x1c')],'include':_0x22b9e4[_0x6a0d('0x1d')]?_[_0x6a0d('0x1e')](_0x22b9e4[_0x6a0d('0x1d')],function(_0x50567a){return{'model':db[_0x50567a['model']],'as':_0x50567a['as'],'attributes':_0x50567a['attributes'],'include':_0x50567a['include']?_[_0x6a0d('0x1e')](_0x50567a[_0x6a0d('0x1d')],function(_0xdbf2fa){return{'model':db[_0xdbf2fa['model']],'as':_0xdbf2fa['as'],'attributes':_0xdbf2fa[_0x6a0d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6a0d('0x20')](function(_0x34ba0e){logger[_0x6a0d('0xd')](_0x6a0d('0x18'),_0x2abb25);logger['debug'](_0x6a0d('0x18'),_0x2abb25,JSON[_0x6a0d('0x11')](_0x34ba0e));_0x382141(_0x34ba0e);})[_0x6a0d('0x17')](function(_0x1d13ae){logger[_0x6a0d('0x12')](_0x6a0d('0x18'),_0x1d13ae[_0x6a0d('0x15')],_0x2abb25);_0x1b677a(_0x693fce[_0x6a0d('0x12')](0x1f4,_0x1d13ae[_0x6a0d('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x196fa7){var _0x5cb7e9=this;return new Promise(function(_0x105e66,_0x546e02){return db[_0x6a0d('0x19')][_0x6a0d('0x21')](_0x196fa7['body'],{'raw':_0x196fa7['options']?_0x196fa7[_0x6a0d('0x1b')][_0x6a0d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196fa7[_0x6a0d('0x1b')]?_0x196fa7[_0x6a0d('0x1b')][_0x6a0d('0x23')]||null:null,'attributes':_0x196fa7['options']?_0x196fa7[_0x6a0d('0x1b')]['attributes']||null:null,'limit':_0x196fa7[_0x6a0d('0x1b')]?_0x196fa7[_0x6a0d('0x1b')][_0x6a0d('0x24')]||null:null})[_0x6a0d('0x20')](function(_0x248983){logger[_0x6a0d('0xd')]('UpdateCmHopperBlack',_0x196fa7);logger[_0x6a0d('0xf')](_0x6a0d('0x25'),_0x196fa7,JSON[_0x6a0d('0x11')](_0x248983));_0x105e66(_0x248983);})[_0x6a0d('0x17')](function(_0x41c107){logger[_0x6a0d('0x12')](_0x6a0d('0x25'),_0x41c107[_0x6a0d('0x15')],_0x196fa7);_0x546e02(_0x5cb7e9['error'](0x1f4,_0x41c107[_0x6a0d('0x15')]));});});};exports[_0x6a0d('0x26')]=function(_0x7dbee0){var _0x1c2058=this;return new Promise(function(_0xbe010d,_0x3a8f9e){return db['CmHopperBlack']['destroy']({'where':_0x7dbee0['options']?_0x7dbee0[_0x6a0d('0x1b')]['where']||null:null})[_0x6a0d('0x20')](function(_0x497d3f){logger['info'](_0x6a0d('0x26'),_0x7dbee0);logger[_0x6a0d('0xf')](_0x6a0d('0x26'),_0x7dbee0,JSON[_0x6a0d('0x11')](_0x497d3f));_0xbe010d(_0x497d3f);})[_0x6a0d('0x17')](function(_0xf9965b){logger[_0x6a0d('0x12')]('DestroyCmHopperBlack',_0xf9965b[_0x6a0d('0x15')],_0x7dbee0);_0x3a8f9e(_0x1c2058[_0x6a0d('0x12')](0x1f4,_0xf9965b[_0x6a0d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c170c6b..fb4d4ec 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 _0x0295=['exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','put','update','delete','destroy'];(function(_0x52bef5,_0x25361e){var _0x365753=function(_0x2a5b41){while(--_0x2a5b41){_0x52bef5['push'](_0x52bef5['shift']());}};_0x365753(++_0x25361e);}(_0x0295,0x1f0));var _0x5029=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0x0295[_0x5d8987];return _0x2997eb;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/:id',auth[_0x5029('0x8')](),controller[_0x5029('0xb')]);router[_0x5029('0xc')]('/:id',auth[_0x5029('0x8')](),controller[_0x5029('0xd')]);module[_0x5029('0xe')]=router; \ No newline at end of file +var _0x2ef3=['describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','/describe','isAuthenticated'];(function(_0x46889b,_0x1a2e3b){var _0x402ff4=function(_0x25a64b){while(--_0x25a64b){_0x46889b['push'](_0x46889b['shift']());}};_0x402ff4(++_0x1a2e3b);}(_0x2ef3,0xba));var _0x32ef=function(_0x517fa7,_0x240c49){_0x517fa7=_0x517fa7-0x0;var _0x13ab6e=_0x2ef3[_0x517fa7];return _0x13ab6e;};'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('0xf')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x32ef('0x10')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 02aedc8..d56607f 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 _0xa2fc=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x51c90d,_0x5ea086){var _0x5259f6=function(_0x3431f3){while(--_0x3431f3){_0x51c90d['push'](_0x51c90d['shift']());}};_0x5259f6(++_0x5ea086);}(_0xa2fc,0x184));var _0xca2f=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0xa2fc[_0x5c6022];return _0x4ab5af;};'use strict';var Sequelize=require(_0xca2f('0x0'));var moment=require(_0xca2f('0x1'));module[_0xca2f('0x2')]={'state':{'type':Sequelize[_0xca2f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xca2f('0x4')]},'scheduledat':{'type':Sequelize[_0xca2f('0x5')]},'countbusyretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca2f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xca2f('0x4')]},'originatecalleridname':{'type':Sequelize[_0xca2f('0x4')]},'calleridnum':{'type':Sequelize[_0xca2f('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xca2f('0x5')]},'answertime':{'type':Sequelize[_0xca2f('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xca2f('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xca2f('0x4')]},'campaigntype':{'type':Sequelize[_0xca2f('0x4')]},'membername':{'type':Sequelize[_0xca2f('0x4')]},'reason':{'type':Sequelize[_0xca2f('0x4')]},'disposition':{'type':Sequelize[_0xca2f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca2f('0x4')]},'dispositionat':{'type':Sequelize[_0xca2f('0x5')],'set':function(_0x4c9d29){var _0x39a5e3=this[_0xca2f('0x6')](_0xca2f('0x7'));if(_0x39a5e3&&_0x4c9d29){this[_0xca2f('0x8')](_0xca2f('0x9'),moment(_0x4c9d29)[_0xca2f('0xa')](moment(_0x39a5e3),_0xca2f('0xb')));}return this[_0xca2f('0x8')](_0xca2f('0xc'),_0x4c9d29);}},'amd':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xca2f('0x5')]},'callback':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca2f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca2f('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xca2f('0xd')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xca2f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcdff=['BOOLEAN','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xcdff,0x169));var _0xfcdf=function(_0x445779,_0x4d1e77){_0x445779=_0x445779-0x0;var _0x1643fb=_0xcdff[_0x445779];return _0x1643fb;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfcdf('0x0')]},'countbusyretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfcdf('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xfcdf('0x2')]},'originatecalleridname':{'type':Sequelize[_0xfcdf('0x2')]},'calleridnum':{'type':Sequelize[_0xfcdf('0x2')]},'calleridname':{'type':Sequelize[_0xfcdf('0x2')]},'starttime':{'type':Sequelize[_0xfcdf('0x0')]},'responsetime':{'type':Sequelize[_0xfcdf('0x0')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xfcdf('0x0')]},'endtime':{'type':Sequelize[_0xfcdf('0x0')]},'ringtime':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xfcdf('0x2')]},'membername':{'type':Sequelize[_0xfcdf('0x2')]},'reason':{'type':Sequelize[_0xfcdf('0x2')]},'disposition':{'type':Sequelize[_0xfcdf('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfcdf('0x2')]},'dispositionat':{'type':Sequelize[_0xfcdf('0x0')],'set':function(_0x1e05e5){var _0x322c9b=this[_0xfcdf('0x3')](_0xfcdf('0x4'));if(_0x322c9b&&_0x1e05e5){this[_0xfcdf('0x5')](_0xfcdf('0x6'),moment(_0x1e05e5)[_0xfcdf('0x7')](moment(_0x322c9b),_0xfcdf('0x8')));}return this[_0xfcdf('0x5')]('dispositionat',_0x1e05e5);}},'amd':{'type':Sequelize[_0xfcdf('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfcdf('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfcdf('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfcdf('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfcdf('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfcdf('0x0')]},'deleted':{'type':Sequelize[_0xfcdf('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfcdf('0x0')]},'recallme':{'type':Sequelize[_0xfcdf('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfcdf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 85a700d..7707e22 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 _0xafc4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','CmHopperFinal','includeAll','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ContactId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','CampaignId\x20=\x20?','group','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0xa35380,_0x8c080e){var _0x304c13=function(_0x32f589){while(--_0x32f589){_0xa35380['push'](_0xa35380['shift']());}};_0x304c13(++_0x8c080e);}(_0xafc4,0x69));var _0x4afc=function(_0x207b59,_0x5121b1){_0x207b59=_0x207b59-0x0;var _0x1ead42=_0xafc4[_0x207b59];return _0x1ead42;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['CmHopperFinal'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x19a0ac,null))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x42e274,_0x269c24){if(_0x42e274[_0x4afc('0x43')][_0x4afc('0x44')]){delete _0x42e274[_0x4afc('0x43')][_0x4afc('0x44')];}return db[_0x4afc('0x3d')][_0x4afc('0x45')]({'where':{'uniqueid':_0x42e274['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x269c24,null))['then'](saveUpdates(_0x42e274['body'],null))[_0x4afc('0x25')](respondWithResult(_0x269c24,null))['catch'](handleError(_0x269c24,null));};exports[_0x4afc('0x46')]=function(_0x355198,_0x2fe2ae,_0x2cafc3){return db['CmHopperFinal'][_0x4afc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x355198['params']['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x4afc('0x4d')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x4afc('0x50')],[db['sequelize']['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x51')))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x53')))),_0x4afc('0x54')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})[_0x4afc('0x25')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x25')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x3f')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x57')]=function(_0x4985c6,_0x1771e8,_0x323c65){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x4985c6[_0x4afc('0x41')]['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x58')))),'noAnswerContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db['sequelize']['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x59')))),_0x4afc('0x50')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x5a')))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})['then'](handleEntityNotFound(_0x1771e8,null))[_0x4afc('0x25')](respondWithResult(_0x1771e8,null))[_0x4afc('0x3f')](handleError(_0x1771e8,null));};exports[_0x4afc('0x5b')]=function(_0x392252,_0x1f652a,_0x481263){return db['VoiceQueue'][_0x4afc('0x45')]({'where':{'id':_0x392252[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x1f652a,null))['then'](function(_0x380c56){var _0x14a216;if(_0x380c56){_0x14a216=squel[_0x4afc('0x5c')]()[_0x4afc('0x5d')](_0x4afc('0x5e'))['fromQuery']([_0x4afc('0x5f'),_0x4afc('0x60'),'ContactId',_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),'updatedAt'],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))['field']('ANY_VALUE(ListId)',_0x4afc('0x61'))[_0x4afc('0x65')](_0x4afc('0x69'),'VoiceQueueId')['field'](_0x4afc('0x67'),_0x4afc('0x63'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x6a'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x392252[_0x4afc('0x43')][_0x4afc('0x70')][_0x4afc('0x6e')]())['where'](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))[_0x4afc('0x37')]('VoiceQueueId\x20=\x20?',_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x74')))['group'](_0x4afc('0x68')))[_0x4afc('0x6e')]();return db['sequelize'][_0x4afc('0x2d')](_0x14a216);}return[];})[_0x4afc('0x25')](respondWithResult(_0x1f652a,null))[_0x4afc('0x3f')](handleError(_0x1f652a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1c3d20,_0x3478aa,_0x24553b){return db[_0x4afc('0x75')]['find']({'where':{'id':_0x1c3d20[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x3478aa,null))['then'](function(_0x2dc8a1){var _0x36f3ea;if(_0x2dc8a1){_0x36f3ea=squel[_0x4afc('0x5c')]()['into']('cm_hopper')[_0x4afc('0x76')]([_0x4afc('0x5f'),_0x4afc('0x60'),_0x4afc('0x68'),_0x4afc('0x61'),_0x4afc('0x77'),_0x4afc('0x63'),_0x4afc('0x6a')],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))[_0x4afc('0x65')]('ANY_VALUE(ListId)',_0x4afc('0x61'))['field']('ANY_VALUE(CampaignId)',_0x4afc('0x77'))['field']('NOW()',_0x4afc('0x63'))['field'](_0x4afc('0x67'),'updatedAt')[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x1c3d20['body']['state'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))['where'](_0x4afc('0x78'),_0x1c3d20['params']['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')]('state\x20=\x204'))[_0x4afc('0x79')]('ContactId'))['toString']();return db[_0x4afc('0x48')]['query'](_0x36f3ea);}return[];})['then'](respondWithResult(_0x3478aa,null))[_0x4afc('0x3f')](handleError(_0x3478aa,null));};exports['checkContactHopper']=function(_0x272e36,_0x24bf53,_0x5b1421){return db[_0x4afc('0x7a')][_0x4afc('0x7b')]({'where':{'VoiceQueueId':_0x272e36['body'][_0x4afc('0x62')],'CampaignId':_0x272e36[_0x4afc('0x43')][_0x4afc('0x77')],'ContactId':_0x272e36['body'][_0x4afc('0x68')]}})[_0x4afc('0x25')](handleEntityNotFound(_0x24bf53,null))[_0x4afc('0x25')](function(_0x16eb6d){if(_0x16eb6d){return _0x16eb6d;}return null;})[_0x4afc('0x25')](respondWithResult(_0x24bf53,null))[_0x4afc('0x3f')](handleError(_0x24bf53,null));}; \ No newline at end of file +var _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x42b6f7,_0x3b64eb){var _0x4021f2=function(_0x58f498){while(--_0x58f498){_0x42b6f7['push'](_0x42b6f7['shift']());}};_0x4021f2(++_0x3b64eb);}(_0x57ca,0x108));var _0xa57c=function(_0x258ee3,_0x4e983b){_0x258ee3=_0x258ee3-0x0;var _0x5b2228=_0x57ca[_0x258ee3];return _0x5b2228;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')]()['then'](respondWithResult(_0x44ea0a,null))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x5082ef,_0x232675){if(_0x5082ef['body'][_0xa57c('0x42')]){delete _0x5082ef[_0xa57c('0x43')]['uniqueid'];}return db[_0xa57c('0x2a')][_0xa57c('0x3f')]({'where':{'uniqueid':_0x5082ef[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x232675,null))[_0xa57c('0x21')](saveUpdates(_0x5082ef['body'],null))[_0xa57c('0x21')](respondWithResult(_0x232675,null))[_0xa57c('0x40')](handleError(_0x232675,null));};exports[_0xa57c('0x44')]=function(_0xd57bac,_0x2e4b84,_0x5ace6d){return db[_0xa57c('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xd57bac['params']['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize']['literal'](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4a')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x4b')))),_0xa57c('0x4c')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),_0xa57c('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db['sequelize']['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0x2e4b84,null))['then'](respondWithResult(_0x2e4b84,null))[_0xa57c('0x40')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x56')]=function(_0x1899ad,_0xb19d93,_0x2adcf6){return db[_0xa57c('0x2a')][_0xa57c('0x3d')]({'raw':![],'where':{'CampaignId':_0x1899ad[_0xa57c('0x3e')]['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xa57c('0x57')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4b')))),'busyContacts'],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),'dropContacts'],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0xb19d93,null))['then'](respondWithResult(_0xb19d93,null))[_0xa57c('0x40')](handleError(_0xb19d93,null));};exports[_0xa57c('0x58')]=function(_0x1be631,_0x47e3d5,_0x571e10){return db[_0xa57c('0x59')][_0xa57c('0x3f')]({'where':{'id':_0x1be631[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x47e3d5,null))[_0xa57c('0x21')](function(_0x39411b){var _0x2a7aab;if(_0x39411b){_0x2a7aab=squel[_0xa57c('0x5a')]()[_0xa57c('0x5b')]('cm_hopper')[_0xa57c('0x5c')]([_0xa57c('0x5d'),'scheduledAt',_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62')],squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x65'),'phone')[_0xa57c('0x64')](_0xa57c('0x66'),'scheduledAt')[_0xa57c('0x64')](_0xa57c('0x67'),'ContactId')['field'](_0xa57c('0x68'),_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x69'),_0xa57c('0x60'))['field'](_0xa57c('0x66'),_0xa57c('0x61'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x62'))['from'](_0xa57c('0x6a'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1be631[_0xa57c('0x43')][_0xa57c('0x6d')]['toString']())[_0xa57c('0x37')](_0xa57c('0x6e'))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x5d'))['from'](_0xa57c('0x6f'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']()))[_0xa57c('0x37')](_0xa57c('0x70'),squel['select']()[_0xa57c('0x64')](_0xa57c('0x71'))['from'](_0xa57c('0x6a'))['where'](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id'][_0xa57c('0x72')]())[_0xa57c('0x37')]('state\x20=\x204'))[_0xa57c('0x73')](_0xa57c('0x5e')))[_0xa57c('0x72')]();return db[_0xa57c('0x45')][_0xa57c('0x2e')](_0x2a7aab);}return[];})[_0xa57c('0x21')](respondWithResult(_0x47e3d5,null))[_0xa57c('0x40')](handleError(_0x47e3d5,null));};exports[_0xa57c('0x74')]=function(_0x1129f,_0x2c4e6c,_0x46dbb1){return db['Campaign']['find']({'where':{'id':_0x1129f['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2c4e6c,null))['then'](function(_0x43c430){var _0x442dc7;if(_0x43c430){_0x442dc7=squel[_0xa57c('0x5a')]()['into'](_0xa57c('0x6f'))[_0xa57c('0x5c')]([_0xa57c('0x5d'),_0xa57c('0x75'),_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x76'),'createdAt',_0xa57c('0x62')],squel[_0xa57c('0x63')]()['field']('ANY_VALUE(calleridnum)',_0xa57c('0x5d'))[_0xa57c('0x64')]('NOW()','scheduledAt')[_0xa57c('0x64')]('ANY_VALUE(ContactId)',_0xa57c('0x5e'))[_0xa57c('0x64')]('ANY_VALUE(ListId)',_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x77'),_0xa57c('0x76'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x61'))['field'](_0xa57c('0x66'),_0xa57c('0x62'))['from']('cm_hopper_final')['where'](_0xa57c('0x78'),_0x1129f['params']['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1129f[_0xa57c('0x43')]['state'][_0xa57c('0x72')]())[_0xa57c('0x37')](_0xa57c('0x6e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()['field'](_0xa57c('0x5d'))[_0xa57c('0x79')]('cm_hopper')[_0xa57c('0x37')]('CampaignId\x20=\x20?',_0x1129f['params']['id']['toString']()))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa57c('0x71'))[_0xa57c('0x79')]('cm_hopper_final')[_0xa57c('0x37')](_0xa57c('0x78'),_0x1129f[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x7a')))[_0xa57c('0x73')](_0xa57c('0x5e')))['toString']();return db['sequelize'][_0xa57c('0x2e')](_0x442dc7);}return[];})['then'](respondWithResult(_0x2c4e6c,null))[_0xa57c('0x40')](handleError(_0x2c4e6c,null));};exports[_0xa57c('0x7b')]=function(_0x2cc12b,_0x4dc6ac,_0x138c4e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2cc12b[_0xa57c('0x43')]['VoiceQueueId'],'CampaignId':_0x2cc12b[_0xa57c('0x43')][_0xa57c('0x76')],'ContactId':_0x2cc12b['body']['ContactId']}})[_0xa57c('0x21')](handleEntityNotFound(_0x4dc6ac,null))[_0xa57c('0x21')](function(_0x50a940){if(_0x50a940){return _0x50a940;}return null;})['then'](respondWithResult(_0x4dc6ac,null))[_0xa57c('0x40')](handleError(_0x4dc6ac,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8b0b008..431bdda 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 _0xe4f8=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe4f8,0x103));var _0x8e4f=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xe4f8[_0x56825b];return _0x69ce77;};'use strict';var _=require(_0x8e4f('0x0'));var util=require('util');var logger=require(_0x8e4f('0x1'))(_0x8e4f('0x2'));var moment=require(_0x8e4f('0x3'));var BPromise=require(_0x8e4f('0x4'));var rp=require(_0x8e4f('0x5'));var fs=require('fs');var path=require(_0x8e4f('0x6'));var rimraf=require(_0x8e4f('0x7'));var config=require(_0x8e4f('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0x8e4f('0x9')]=function(_0x215d06,_0x547f04){return _0x215d06[_0x8e4f('0xa')](_0x8e4f('0xb'),attributes,{'tableName':_0x8e4f('0xc'),'paranoid':![],'indexes':[{'name':_0x8e4f('0xd'),'fields':[_0x8e4f('0xd')]},{'name':_0x8e4f('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb95=['exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes'];(function(_0x259a87,_0x1a2113){var _0x35017e=function(_0x2178da){while(--_0x2178da){_0x259a87['push'](_0x259a87['shift']());}};_0x35017e(++_0x1a2113);}(_0xeb95,0x155));var _0x5eb9=function(_0x28e15e,_0x67565){_0x28e15e=_0x28e15e-0x0;var _0x104c41=_0xeb95[_0x28e15e];return _0x104c41;};'use strict';var _=require(_0x5eb9('0x0'));var util=require(_0x5eb9('0x1'));var logger=require(_0x5eb9('0x2'))(_0x5eb9('0x3'));var moment=require(_0x5eb9('0x4'));var BPromise=require(_0x5eb9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eb9('0x6'));var rimraf=require('rimraf');var config=require(_0x5eb9('0x7'));var attributes=require(_0x5eb9('0x8'));module[_0x5eb9('0x9')]=function(_0x4e4852,_0x5abd38){return _0x4e4852[_0x5eb9('0xa')]('CmHopperFinal',attributes,{'tableName':_0x5eb9('0xb'),'paranoid':![],'indexes':[{'name':_0x5eb9('0xc'),'fields':['calleridnum']},{'name':_0x5eb9('0xd'),'fields':[_0x5eb9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3c03861..ce9ce00 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x476791,_0x53bce0){var _0x31dae5=function(_0x292457){while(--_0x292457){_0x476791['push'](_0x476791['shift']());}};_0x31dae5(++_0x53bce0);}(_0x7a54,0x106));var _0x47a5=function(_0x5b333d,_0x18d907){_0x5b333d=_0x5b333d-0x0;var _0x4b4a9c=_0x7a54[_0x5b333d];return _0x4b4a9c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x14fe13,_0x48b516){var _0x29d465=function(_0x38269a){while(--_0x38269a){_0x14fe13['push'](_0x14fe13['shift']());}};_0x29d465(++_0x48b516);}(_0xb10b,0x12a));var _0xbb10=function(_0x443ec0,_0x186140){_0x443ec0=_0x443ec0-0x0;var _0x227249=_0xb10b[_0x443ec0];return _0x227249;};'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 11d6aad..4c9e452 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 _0x2d7b=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','/voice/queue/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer'];(function(_0x1cdc05,_0xe647c4){var _0x4aa5fc=function(_0x2ed688){while(--_0x2ed688){_0x1cdc05['push'](_0x1cdc05['shift']());}};_0x4aa5fc(++_0xe647c4);}(_0x2d7b,0x7c));var _0xb2d7=function(_0x5a6d97,_0xcf3f6a){_0x5a6d97=_0x5a6d97-0x0;var _0x19873a=_0x2d7b[_0x5a6d97];return _0x19873a;};'use strict';var multer=require(_0xb2d7('0x0'));var util=require(_0xb2d7('0x1'));var path=require(_0xb2d7('0x2'));var timeout=require(_0xb2d7('0x3'));var express=require(_0xb2d7('0x4'));var router=express['Router']();var fs_extra=require(_0xb2d7('0x5'));var auth=require(_0xb2d7('0x6'));var interaction=require(_0xb2d7('0x7'));var config=require(_0xb2d7('0x8'));var controller=require(_0xb2d7('0x9'));router[_0xb2d7('0xa')]('/',auth[_0xb2d7('0xb')](),controller['index']);router['get'](_0xb2d7('0xc'),auth['isAuthenticated'](),controller[_0xb2d7('0xd')]);router[_0xb2d7('0xa')](_0xb2d7('0xe'),auth[_0xb2d7('0xb')](),controller['show']);router[_0xb2d7('0xa')](_0xb2d7('0xf'),auth[_0xb2d7('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0xb2d7('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb2d7('0x10')](_0xb2d7('0x11'),auth[_0xb2d7('0xb')](),controller[_0xb2d7('0x12')]);router[_0xb2d7('0x10')](_0xb2d7('0x13'),auth[_0xb2d7('0xb')](),controller[_0xb2d7('0x14')]);router['post'](_0xb2d7('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xb2d7('0x16')](_0xb2d7('0xe'),auth[_0xb2d7('0xb')](),controller[_0xb2d7('0x17')]);module[_0xb2d7('0x18')]=router; \ No newline at end of file +var _0x065e=['put','update','exports','multer','express','Router','fs-extra','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x5d07ce,_0x1b0315){var _0x91c4d3=function(_0xfac0ab){while(--_0xfac0ab){_0x5d07ce['push'](_0x5d07ce['shift']());}};_0x91c4d3(++_0x1b0315);}(_0x065e,0x1a7));var _0xe065=function(_0x4acdd2,_0x5b40d2){_0x4acdd2=_0x4acdd2-0x0;var _0xeeac93=_0x065e[_0x4acdd2];return _0xeeac93;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));var controller=require(_0xe065('0x5'));router['get']('/',auth[_0xe065('0x6')](),controller[_0xe065('0x7')]);router[_0xe065('0x8')]('/describe',auth[_0xe065('0x6')](),controller['describe']);router[_0xe065('0x8')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0xa')]);router[_0xe065('0x8')]('/voice/queue/countAttributes/:id',auth[_0xe065('0x6')](),controller[_0xe065('0xb')]);router[_0xe065('0x8')](_0xe065('0xc'),auth[_0xe065('0x6')](),controller[_0xe065('0xd')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xe065('0x6')](),controller[_0xe065('0xe')]);router[_0xe065('0xf')]('/voice/campaign/moveContacts/:id',auth[_0xe065('0x6')](),controller[_0xe065('0x10')]);router[_0xe065('0xf')](_0xe065('0x11'),auth[_0xe065('0x6')](),controller['checkContactHopper']);router[_0xe065('0x12')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0x13')]);module[_0xe065('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 985a1bc..5a99f94 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 _0x8a5d=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x1ad4d2,_0x1cb648){var _0x15dc44=function(_0x4daaaa){while(--_0x4daaaa){_0x1ad4d2['push'](_0x1ad4d2['shift']());}};_0x15dc44(++_0x1cb648);}(_0x8a5d,0xbc));var _0xd8a5=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x8a5d[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xd8a5('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xd8a5('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xd8a5('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd8a5('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xd8a5('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd8a5('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd8a5('0x1')]},'campaign':{'type':Sequelize[_0xd8a5('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd8a5('0x1')]},'amd':{'type':Sequelize[_0xd8a5('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd8a5('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd8a5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd8a5('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd8a5('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd8a5('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd8a5('0x1')]}}; \ No newline at end of file +var _0xc1fc=['STRING','BOOLEAN','exports','INTEGER','DATE'];(function(_0x380df2,_0x281a15){var _0x47f4df=function(_0x132241){while(--_0x132241){_0x380df2['push'](_0x380df2['shift']());}};_0x47f4df(++_0x281a15);}(_0xc1fc,0x93));var _0xcc1f=function(_0x1fa078,_0x635078){_0x1fa078=_0x1fa078-0x0;var _0x4732ca=_0xc1fc[_0x1fa078];return _0x4732ca;};'use strict';var Sequelize=require('sequelize');module[_0xcc1f('0x0')]={'state':{'type':Sequelize[_0xcc1f('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xcc1f('0x2')]},'countbusyretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcc1f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xcc1f('0x3')]},'originatecalleridname':{'type':Sequelize[_0xcc1f('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xcc1f('0x2')]},'responsetime':{'type':Sequelize[_0xcc1f('0x2')]},'answertime':{'type':Sequelize[_0xcc1f('0x2')]},'droptime':{'type':Sequelize[_0xcc1f('0x2')]},'endtime':{'type':Sequelize[_0xcc1f('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcc1f('0x3')]},'campaign':{'type':Sequelize[_0xcc1f('0x3')]},'campaigntype':{'type':Sequelize[_0xcc1f('0x3')]},'membername':{'type':Sequelize[_0xcc1f('0x3')]},'reason':{'type':Sequelize[_0xcc1f('0x3')]},'amd':{'type':Sequelize[_0xcc1f('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcc1f('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xcc1f('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcc1f('0x2')]},'recallme':{'type':Sequelize[_0xcc1f('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcc1f('0x2')]},'edited':{'type':Sequelize[_0xcc1f('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc1f('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcc1f('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 43c3054..a34ba7f 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 _0x4948=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','CmHopperHistory','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x124bf4,_0x35de0e){var _0x4dae78=function(_0x498e94){while(--_0x498e94){_0x124bf4['push'](_0x124bf4['shift']());}};_0x4dae78(++_0x35de0e);}(_0x4948,0x116));var _0x8494=function(_0x17d80a,_0x1df855){_0x17d80a=_0x17d80a-0x0;var _0x58f29d=_0x4948[_0x17d80a];return _0x58f29d;};'use strict';var emlformat=require(_0x8494('0x0'));var rimraf=require(_0x8494('0x1'));var zipdir=require(_0x8494('0x2'));var jsonpatch=require(_0x8494('0x3'));var rp=require(_0x8494('0x4'));var moment=require(_0x8494('0x5'));var BPromise=require(_0x8494('0x6'));var Mustache=require(_0x8494('0x7'));var util=require('util');var path=require(_0x8494('0x8'));var sox=require(_0x8494('0x9'));var csv=require(_0x8494('0xa'));var ejs=require(_0x8494('0xb'));var fs=require('fs');var fs_extra=require(_0x8494('0xc'));var _=require(_0x8494('0xd'));var squel=require(_0x8494('0xe'));var crypto=require('crypto');var jsforce=require(_0x8494('0xf'));var deskjs=require(_0x8494('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8494('0x11'));var Papa=require(_0x8494('0x12'));var Redis=require(_0x8494('0x13'));var authService=require(_0x8494('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8494('0x15'));var logger=require(_0x8494('0x16'))('api');var utils=require(_0x8494('0x17'));var config=require(_0x8494('0x18'));var licenseUtil=require(_0x8494('0x19'));var db=require(_0x8494('0x1a'))['db'];function respondWithStatusCode(_0x64296b,_0x358016){_0x358016=_0x358016||0xcc;return function(_0xe045f2){if(_0xe045f2){return _0x64296b[_0x8494('0x1b')](_0x358016);}return _0x64296b[_0x8494('0x1c')](_0x358016)[_0x8494('0x1d')]();};}function respondWithResult(_0x387537,_0xb6152){_0xb6152=_0xb6152||0xc8;return function(_0x1d4542){if(_0x1d4542){return _0x387537[_0x8494('0x1c')](_0xb6152)[_0x8494('0x1e')](_0x1d4542);}};}function respondWithFilteredResult(_0x2604db,_0x3d8b8d){return function(_0x508164){if(_0x508164){var _0x7aa108=typeof _0x3d8b8d[_0x8494('0x1f')]===_0x8494('0x20')&&typeof _0x3d8b8d[_0x8494('0x21')]===_0x8494('0x20');var _0x5c34e9=_0x508164[_0x8494('0x22')];var _0x264235=_0x7aa108?0x0:_0x3d8b8d[_0x8494('0x1f')];var _0x512c83=_0x7aa108?_0x508164[_0x8494('0x22')]:_0x3d8b8d['offset']+_0x3d8b8d[_0x8494('0x21')];var _0x9cfea7;if(_0x512c83>=_0x5c34e9){_0x512c83=_0x5c34e9;_0x9cfea7=0xc8;}else{_0x9cfea7=0xce;}_0x2604db[_0x8494('0x1c')](_0x9cfea7);return _0x2604db['set'](_0x8494('0x23'),_0x264235+'-'+_0x512c83+'/'+_0x5c34e9)[_0x8494('0x1e')](_0x508164);}return null;};}function patchUpdates(_0x52b2fa){return function(_0x2f1806){try{jsonpatch['apply'](_0x2f1806,_0x52b2fa,!![]);}catch(_0x47b200){return BPromise[_0x8494('0x24')](_0x47b200);}return _0x2f1806['save']();};}function saveUpdates(_0x41833f,_0x9194b6){return function(_0x1cdff7){if(_0x1cdff7){return _0x1cdff7[_0x8494('0x25')](_0x41833f)[_0x8494('0x26')](function(_0x1b709e){return _0x1b709e;});}return null;};}function removeEntity(_0xb4542,_0x576634){return function(_0x2fb749){if(_0x2fb749){return _0x2fb749[_0x8494('0x27')]()[_0x8494('0x26')](function(){_0xb4542[_0x8494('0x1c')](0xcc)[_0x8494('0x1d')]();});}};}function handleEntityNotFound(_0x5353c0,_0x394034){return function(_0x53ca3e){if(!_0x53ca3e){_0x5353c0[_0x8494('0x1b')](0x194);}return _0x53ca3e;};}function handleError(_0xcb136d,_0x35a3ed){_0x35a3ed=_0x35a3ed||0x1f4;return function(_0x505057){logger[_0x8494('0x28')](_0x505057[_0x8494('0x29')]);if(_0x505057[_0x8494('0x2a')]){delete _0x505057[_0x8494('0x2a')];}_0xcb136d[_0x8494('0x1c')](_0x35a3ed)['send'](_0x505057);};}exports['index']=function(_0x5b240e,_0x4f0e91){var _0xe3129a={},_0x206e98={},_0x534624={'count':0x0,'rows':[]};var _0x5779ba=_['map'](db[_0x8494('0x2b')]['rawAttributes'],function(_0x30c844){return{'name':_0x30c844['fieldName'],'type':_0x30c844[_0x8494('0x2c')]['key']};});_0x206e98[_0x8494('0x2d')]=_[_0x8494('0x2e')](_0x5779ba,'name');_0x206e98[_0x8494('0x2f')]=_[_0x8494('0x30')](_0x5b240e[_0x8494('0x2f')]);_0x206e98[_0x8494('0x31')]=_[_0x8494('0x32')](_0x206e98[_0x8494('0x2d')],_0x206e98[_0x8494('0x2f')]);_0xe3129a[_0x8494('0x33')]=_[_0x8494('0x32')](_0x206e98[_0x8494('0x2d')],qs[_0x8494('0x34')](_0x5b240e[_0x8494('0x2f')][_0x8494('0x34')]));_0xe3129a[_0x8494('0x33')]=_0xe3129a['attributes'][_0x8494('0x35')]?_0xe3129a[_0x8494('0x33')]:_0x206e98['model'];if(!_0x5b240e[_0x8494('0x2f')]['hasOwnProperty']('nolimit')){_0xe3129a['limit']=qs[_0x8494('0x21')](_0x5b240e[_0x8494('0x2f')][_0x8494('0x21')]);_0xe3129a[_0x8494('0x1f')]=qs[_0x8494('0x1f')](_0x5b240e[_0x8494('0x2f')][_0x8494('0x1f')]);}_0xe3129a[_0x8494('0x36')]=qs['sort'](_0x5b240e[_0x8494('0x2f')]['sort']);_0xe3129a[_0x8494('0x37')]=qs['filters'](_[_0x8494('0x38')](_0x5b240e[_0x8494('0x2f')],_0x206e98[_0x8494('0x31')]),_0x5779ba);if(_0x5b240e[_0x8494('0x2f')][_0x8494('0x39')]){_0xe3129a['where']=_[_0x8494('0x3a')](_0xe3129a[_0x8494('0x37')],{'$or':_[_0x8494('0x2e')](_0x5779ba,function(_0x112067){if(_0x112067[_0x8494('0x2c')]!==_0x8494('0x3b')){var _0x535bb7={};_0x535bb7[_0x112067[_0x8494('0x2a')]]={'$like':'%'+_0x5b240e[_0x8494('0x2f')]['filter']+'%'};return _0x535bb7;}})});}_0xe3129a=_[_0x8494('0x3a')]({},_0xe3129a,_0x5b240e[_0x8494('0x3c')]);var _0x374a13={'where':_0xe3129a[_0x8494('0x37')]};return db[_0x8494('0x2b')][_0x8494('0x22')](_0x374a13)[_0x8494('0x26')](function(_0x442e13){_0x534624['count']=_0x442e13;if(_0x5b240e['query'][_0x8494('0x3d')]){_0xe3129a[_0x8494('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0xe3129a);})['then'](function(_0x2faa1a){_0x534624[_0x8494('0x3f')]=_0x2faa1a;return _0x534624;})[_0x8494('0x26')](respondWithFilteredResult(_0x4f0e91,_0xe3129a))[_0x8494('0x40')](handleError(_0x4f0e91,null));};exports['show']=function(_0x8bf6e0,_0x4fa490){var _0x4dbd44={'raw':!![],'where':{'id':_0x8bf6e0[_0x8494('0x41')]['id']}},_0x417291={};_0x417291[_0x8494('0x2d')]=_[_0x8494('0x30')](db['CmHopperHistory'][_0x8494('0x42')]);_0x417291[_0x8494('0x2f')]=_['keys'](_0x8bf6e0[_0x8494('0x2f')]);_0x417291[_0x8494('0x31')]=_['intersection'](_0x417291[_0x8494('0x2d')],_0x417291[_0x8494('0x2f')]);_0x4dbd44[_0x8494('0x33')]=_[_0x8494('0x32')](_0x417291['model'],qs[_0x8494('0x34')](_0x8bf6e0['query'][_0x8494('0x34')]));_0x4dbd44['attributes']=_0x4dbd44['attributes'][_0x8494('0x35')]?_0x4dbd44[_0x8494('0x33')]:_0x417291[_0x8494('0x2d')];if(_0x8bf6e0['query']['includeAll']){_0x4dbd44[_0x8494('0x3e')]=[{'all':!![]}];}_0x4dbd44=_[_0x8494('0x3a')]({},_0x4dbd44,_0x8bf6e0[_0x8494('0x3c')]);return db[_0x8494('0x2b')][_0x8494('0x43')](_0x4dbd44)[_0x8494('0x26')](handleEntityNotFound(_0x4fa490,null))[_0x8494('0x26')](respondWithResult(_0x4fa490,null))[_0x8494('0x40')](handleError(_0x4fa490,null));};exports['create']=function(_0x2a2335,_0x27c1da){return db[_0x8494('0x2b')][_0x8494('0x44')](_0x2a2335['body'],{})[_0x8494('0x26')](respondWithResult(_0x27c1da,0xc9))[_0x8494('0x40')](handleError(_0x27c1da,null));};exports[_0x8494('0x45')]=function(_0x15c768,_0x973304){return db[_0x8494('0x2b')]['describe']()['then'](respondWithResult(_0x973304,null))[_0x8494('0x40')](handleError(_0x973304,null));};exports[_0x8494('0x25')]=function(_0x48f58c,_0x87eab3){if(_0x48f58c[_0x8494('0x46')][_0x8494('0x47')]){delete _0x48f58c[_0x8494('0x46')]['uniqueid'];}return db['CmHopperHistory'][_0x8494('0x43')]({'where':{'uniqueid':_0x48f58c[_0x8494('0x41')]['id']}})[_0x8494('0x26')](handleEntityNotFound(_0x87eab3,null))[_0x8494('0x26')](saveUpdates(_0x48f58c[_0x8494('0x46')],null))['then'](respondWithResult(_0x87eab3,null))[_0x8494('0x40')](handleError(_0x87eab3,null));}; \ No newline at end of file +var _0x2877=['index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','describe','update','uniqueid','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','error','stack','name'];(function(_0x112d30,_0x39fdbd){var _0x157ef8=function(_0x1494ce){while(--_0x1494ce){_0x112d30['push'](_0x112d30['shift']());}};_0x157ef8(++_0x39fdbd);}(_0x2877,0x133));var _0x7287=function(_0x5b1525,_0x1c97c5){_0x5b1525=_0x5b1525-0x0;var _0x5b16c8=_0x2877[_0x5b1525];return _0x5b16c8;};'use strict';var emlformat=require(_0x7287('0x0'));var rimraf=require(_0x7287('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7287('0x2'));var moment=require('moment');var BPromise=require(_0x7287('0x3'));var Mustache=require('mustache');var util=require(_0x7287('0x4'));var path=require(_0x7287('0x5'));var sox=require(_0x7287('0x6'));var csv=require(_0x7287('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7287('0x8'));var _=require(_0x7287('0x9'));var squel=require(_0x7287('0xa'));var crypto=require(_0x7287('0xb'));var jsforce=require(_0x7287('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7287('0x7'));var querystring=require(_0x7287('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7287('0xe'));var hardwareService=require(_0x7287('0xf'));var logger=require(_0x7287('0x10'))(_0x7287('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7287('0x12'))['db'];function respondWithStatusCode(_0x11952e,_0x40bdc6){_0x40bdc6=_0x40bdc6||0xcc;return function(_0x3e4b74){if(_0x3e4b74){return _0x11952e[_0x7287('0x13')](_0x40bdc6);}return _0x11952e[_0x7287('0x14')](_0x40bdc6)[_0x7287('0x15')]();};}function respondWithResult(_0x15e59a,_0x2e3532){_0x2e3532=_0x2e3532||0xc8;return function(_0x310898){if(_0x310898){return _0x15e59a[_0x7287('0x14')](_0x2e3532)['json'](_0x310898);}};}function respondWithFilteredResult(_0x309dd1,_0x2a8ea9){return function(_0x2d67f6){if(_0x2d67f6){var _0x67edad=typeof _0x2a8ea9[_0x7287('0x16')]===_0x7287('0x17')&&typeof _0x2a8ea9[_0x7287('0x18')]==='undefined';var _0x2c7e98=_0x2d67f6[_0x7287('0x19')];var _0x5dbf0b=_0x67edad?0x0:_0x2a8ea9['offset'];var _0x3b2fb0=_0x67edad?_0x2d67f6['count']:_0x2a8ea9[_0x7287('0x16')]+_0x2a8ea9[_0x7287('0x18')];var _0x470f8a;if(_0x3b2fb0>=_0x2c7e98){_0x3b2fb0=_0x2c7e98;_0x470f8a=0xc8;}else{_0x470f8a=0xce;}_0x309dd1[_0x7287('0x14')](_0x470f8a);return _0x309dd1[_0x7287('0x1a')](_0x7287('0x1b'),_0x5dbf0b+'-'+_0x3b2fb0+'/'+_0x2c7e98)['json'](_0x2d67f6);}return null;};}function patchUpdates(_0x55de7b){return function(_0x152dab){try{jsonpatch['apply'](_0x152dab,_0x55de7b,!![]);}catch(_0x1fdfb6){return BPromise['reject'](_0x1fdfb6);}return _0x152dab[_0x7287('0x1c')]();};}function saveUpdates(_0x2ac4cf,_0x1c5ec1){return function(_0x307f29){if(_0x307f29){return _0x307f29['update'](_0x2ac4cf)[_0x7287('0x1d')](function(_0x3ff4a2){return _0x3ff4a2;});}return null;};}function removeEntity(_0x3858ad,_0x4c0fd7){return function(_0x5f5dec){if(_0x5f5dec){return _0x5f5dec['destroy']()[_0x7287('0x1d')](function(){_0x3858ad[_0x7287('0x14')](0xcc)[_0x7287('0x15')]();});}};}function handleEntityNotFound(_0x4a76bf,_0x42a657){return function(_0x5d4d34){if(!_0x5d4d34){_0x4a76bf[_0x7287('0x13')](0x194);}return _0x5d4d34;};}function handleError(_0x25ab7a,_0x20068f){_0x20068f=_0x20068f||0x1f4;return function(_0x26431f){logger[_0x7287('0x1e')](_0x26431f[_0x7287('0x1f')]);if(_0x26431f['name']){delete _0x26431f[_0x7287('0x20')];}_0x25ab7a[_0x7287('0x14')](_0x20068f)['send'](_0x26431f);};}exports[_0x7287('0x21')]=function(_0x2a8fa6,_0x2719f1){var _0x37c2e9={},_0x97bf2a={},_0x17e126={'count':0x0,'rows':[]};var _0x59f5ae=_[_0x7287('0x22')](db[_0x7287('0x23')][_0x7287('0x24')],function(_0xcabee9){return{'name':_0xcabee9[_0x7287('0x25')],'type':_0xcabee9[_0x7287('0x26')][_0x7287('0x27')]};});_0x97bf2a['model']=_['map'](_0x59f5ae,_0x7287('0x20'));_0x97bf2a['query']=_[_0x7287('0x28')](_0x2a8fa6[_0x7287('0x29')]);_0x97bf2a[_0x7287('0x2a')]=_[_0x7287('0x2b')](_0x97bf2a[_0x7287('0x2c')],_0x97bf2a['query']);_0x37c2e9[_0x7287('0x2d')]=_[_0x7287('0x2b')](_0x97bf2a[_0x7287('0x2c')],qs[_0x7287('0x2e')](_0x2a8fa6['query'][_0x7287('0x2e')]));_0x37c2e9[_0x7287('0x2d')]=_0x37c2e9[_0x7287('0x2d')]['length']?_0x37c2e9[_0x7287('0x2d')]:_0x97bf2a['model'];if(!_0x2a8fa6['query'][_0x7287('0x2f')](_0x7287('0x30'))){_0x37c2e9[_0x7287('0x18')]=qs[_0x7287('0x18')](_0x2a8fa6[_0x7287('0x29')][_0x7287('0x18')]);_0x37c2e9[_0x7287('0x16')]=qs[_0x7287('0x16')](_0x2a8fa6[_0x7287('0x29')][_0x7287('0x16')]);}_0x37c2e9[_0x7287('0x31')]=qs['sort'](_0x2a8fa6[_0x7287('0x29')]['sort']);_0x37c2e9[_0x7287('0x32')]=qs[_0x7287('0x2a')](_[_0x7287('0x33')](_0x2a8fa6[_0x7287('0x29')],_0x97bf2a[_0x7287('0x2a')]),_0x59f5ae);if(_0x2a8fa6[_0x7287('0x29')][_0x7287('0x34')]){_0x37c2e9['where']=_[_0x7287('0x35')](_0x37c2e9[_0x7287('0x32')],{'$or':_[_0x7287('0x22')](_0x59f5ae,function(_0x1e93a1){if(_0x1e93a1[_0x7287('0x26')]!==_0x7287('0x36')){var _0x3ee96e={};_0x3ee96e[_0x1e93a1['name']]={'$like':'%'+_0x2a8fa6[_0x7287('0x29')][_0x7287('0x34')]+'%'};return _0x3ee96e;}})});}_0x37c2e9=_[_0x7287('0x35')]({},_0x37c2e9,_0x2a8fa6[_0x7287('0x37')]);var _0x540a38={'where':_0x37c2e9[_0x7287('0x32')]};return db[_0x7287('0x23')][_0x7287('0x19')](_0x540a38)[_0x7287('0x1d')](function(_0xd7181f){_0x17e126[_0x7287('0x19')]=_0xd7181f;if(_0x2a8fa6[_0x7287('0x29')][_0x7287('0x38')]){_0x37c2e9[_0x7287('0x39')]=[{'all':!![]}];}return db[_0x7287('0x23')][_0x7287('0x3a')](_0x37c2e9);})['then'](function(_0x287614){_0x17e126[_0x7287('0x3b')]=_0x287614;return _0x17e126;})['then'](respondWithFilteredResult(_0x2719f1,_0x37c2e9))[_0x7287('0x3c')](handleError(_0x2719f1,null));};exports[_0x7287('0x3d')]=function(_0x2def7a,_0x23e472){var _0x4e914f={'raw':!![],'where':{'id':_0x2def7a[_0x7287('0x3e')]['id']}},_0x1ef00d={};_0x1ef00d[_0x7287('0x2c')]=_[_0x7287('0x28')](db[_0x7287('0x23')][_0x7287('0x24')]);_0x1ef00d[_0x7287('0x29')]=_[_0x7287('0x28')](_0x2def7a[_0x7287('0x29')]);_0x1ef00d[_0x7287('0x2a')]=_[_0x7287('0x2b')](_0x1ef00d[_0x7287('0x2c')],_0x1ef00d[_0x7287('0x29')]);_0x4e914f['attributes']=_['intersection'](_0x1ef00d[_0x7287('0x2c')],qs['fields'](_0x2def7a['query']['fields']));_0x4e914f[_0x7287('0x2d')]=_0x4e914f[_0x7287('0x2d')]['length']?_0x4e914f['attributes']:_0x1ef00d[_0x7287('0x2c')];if(_0x2def7a[_0x7287('0x29')][_0x7287('0x38')]){_0x4e914f[_0x7287('0x39')]=[{'all':!![]}];}_0x4e914f=_['merge']({},_0x4e914f,_0x2def7a['options']);return db[_0x7287('0x23')]['find'](_0x4e914f)[_0x7287('0x1d')](handleEntityNotFound(_0x23e472,null))[_0x7287('0x1d')](respondWithResult(_0x23e472,null))[_0x7287('0x3c')](handleError(_0x23e472,null));};exports[_0x7287('0x3f')]=function(_0x4aa806,_0x5af38c){return db['CmHopperHistory'][_0x7287('0x3f')](_0x4aa806[_0x7287('0x40')],{})[_0x7287('0x1d')](respondWithResult(_0x5af38c,0xc9))['catch'](handleError(_0x5af38c,null));};exports[_0x7287('0x41')]=function(_0x27926b,_0x4c160f){return db[_0x7287('0x23')]['describe']()['then'](respondWithResult(_0x4c160f,null))[_0x7287('0x3c')](handleError(_0x4c160f,null));};exports[_0x7287('0x42')]=function(_0xe517cb,_0x56b7a6){if(_0xe517cb[_0x7287('0x40')][_0x7287('0x43')]){delete _0xe517cb[_0x7287('0x40')][_0x7287('0x43')];}return db[_0x7287('0x23')]['find']({'where':{'uniqueid':_0xe517cb[_0x7287('0x3e')]['id']}})[_0x7287('0x1d')](handleEntityNotFound(_0x56b7a6,null))[_0x7287('0x1d')](saveUpdates(_0xe517cb[_0x7287('0x40')],null))[_0x7287('0x1d')](respondWithResult(_0x56b7a6,null))[_0x7287('0x3c')](handleError(_0x56b7a6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9f6694d..fc3ffb1 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 _0x29b6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x29b6,0x17e));var _0x629b=function(_0xb3f12b,_0x40e1e8){_0xb3f12b=_0xb3f12b-0x0;var _0x50e42f=_0x29b6[_0xb3f12b];return _0x50e42f;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var logger=require(_0x629b('0x2'))(_0x629b('0x3'));var moment=require(_0x629b('0x4'));var BPromise=require(_0x629b('0x5'));var rp=require(_0x629b('0x6'));var fs=require('fs');var path=require(_0x629b('0x7'));var rimraf=require(_0x629b('0x8'));var config=require(_0x629b('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x629b('0xa')]=function(_0x532d0e,_0x810a16){return _0x532d0e[_0x629b('0xb')](_0x629b('0xc'),attributes,{'tableName':_0x629b('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x629b('0xe')]},{'name':_0x629b('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc113=['path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xc113,0x1ab));var _0x3c11=function(_0xabe2be,_0x1b4e8c){_0xabe2be=_0xabe2be-0x0;var _0x2ef005=_0xc113[_0xabe2be];return _0x2ef005;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var logger=require(_0x3c11('0x2'))(_0x3c11('0x3'));var moment=require(_0x3c11('0x4'));var BPromise=require(_0x3c11('0x5'));var rp=require(_0x3c11('0x6'));var fs=require('fs');var path=require(_0x3c11('0x7'));var rimraf=require(_0x3c11('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c11('0x9'));module[_0x3c11('0xa')]=function(_0x595e66,_0x3dd753){return _0x595e66[_0x3c11('0xb')](_0x3c11('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x3c11('0xd'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 40b9dff..3744a03 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 _0x2bdb=['`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\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','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal'];(function(_0xdb4496,_0x34501e){var _0x2b9de8=function(_0x33a3f8){while(--_0x33a3f8){_0xdb4496['push'](_0xdb4496['shift']());}};_0x2b9de8(++_0x34501e);}(_0x2bdb,0x105));var _0xb2bd=function(_0x18e1a1,_0x5426d6){_0x18e1a1=_0x18e1a1-0x0;var _0x3613d0=_0x2bdb[_0x18e1a1];return _0x3613d0;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var moment=require(_0xb2bd('0x1'));var BPromise=require('bluebird');var rs=require(_0xb2bd('0x2'));var fs=require('fs');var Redis=require(_0xb2bd('0x3'));var db=require(_0xb2bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2bd('0x5'))(_0xb2bd('0x6'));var config=require(_0xb2bd('0x7'));var jayson=require(_0xb2bd('0x8'));var client=jayson[_0xb2bd('0x9')][_0xb2bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bff5b,_0x5bae78,_0x21462b){return new BPromise(function(_0x4d9d3f,_0x181f5a){return client[_0xb2bd('0xb')](_0x3bff5b,_0x21462b)[_0xb2bd('0xc')](function(_0xeaa2b7){logger[_0xb2bd('0xd')](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));logger[_0xb2bd('0x10')](_0xb2bd('0x11'),_0x5bae78,'request\x20sent',JSON[_0xb2bd('0x12')](_0xeaa2b7));if(_0xeaa2b7[_0xb2bd('0x13')]){if(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x14')]===0x1f4){logger[_0xb2bd('0x13')](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x181f5a(_0xeaa2b7['error'][_0xb2bd('0x15')]);}logger['error'](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x4d9d3f(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);}else{logger['info'](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));_0x4d9d3f(_0xeaa2b7[_0xb2bd('0x16')][_0xb2bd('0x15')]);}})['catch'](function(_0x14950f){logger[_0xb2bd('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x5bae78,_0x14950f);_0x181f5a(_0x14950f);});});}exports[_0xb2bd('0x17')]=function(_0x380089){var _0x387897=this;return new Promise(function(_0x315815,_0x5d848d){return db[_0xb2bd('0x18')][_0xb2bd('0x19')](_0x380089['body'],{'raw':_0x380089[_0xb2bd('0x1a')]?_0x380089[_0xb2bd('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51c595){logger[_0xb2bd('0xd')]('CreateCmHopperHistory',_0x380089);logger[_0xb2bd('0x10')]('CreateCmHopperHistory',_0x380089,JSON[_0xb2bd('0x12')](_0x51c595));_0x315815(_0x51c595);})[_0xb2bd('0x1b')](function(_0x505c35){logger[_0xb2bd('0x13')]('CreateCmHopperHistory',_0x505c35[_0xb2bd('0x15')],_0x380089);_0x5d848d(_0x387897[_0xb2bd('0x13')](0x1f4,_0x505c35[_0xb2bd('0x15')]));});});};exports[_0xb2bd('0x1c')]=function(_0x5665ae){var _0x44635a=this;return new Promise(function(_0x1df967,_0x35fa24){return db[_0xb2bd('0x18')][_0xb2bd('0x1d')]({'raw':_0x5665ae[_0xb2bd('0x1a')]?_0x5665ae[_0xb2bd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5665ae[_0xb2bd('0x1a')]?_0x5665ae[_0xb2bd('0x1a')][_0xb2bd('0x1e')]||null:null,'attributes':[[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')][_0xb2bd('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db['sequelize'][_0xb2bd('0x22')](_0xb2bd('0x23')))),_0xb2bd('0x24')],[db['sequelize']['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x25')))),_0xb2bd('0x26')],[db['sequelize']['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db['sequelize'][_0xb2bd('0x22')](_0xb2bd('0x27')))),_0xb2bd('0x28')],[db['sequelize']['fn'](_0xb2bd('0x29'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x2a')))),_0xb2bd('0x2b')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x29'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x2c')))),_0xb2bd('0x2d')]]})[_0xb2bd('0xc')](function(_0x41e805){logger['info'](_0xb2bd('0x1c'),_0x5665ae);logger[_0xb2bd('0x10')](_0xb2bd('0x1c'),_0x5665ae,JSON[_0xb2bd('0x12')](_0x41e805));_0x1df967(_0x41e805);})[_0xb2bd('0x1b')](function(_0x5cf15f){logger['error'](_0xb2bd('0x1c'),_0x5cf15f[_0xb2bd('0x15')],_0x5665ae);_0x35fa24(_0x44635a[_0xb2bd('0x13')](0x1f4,_0x5cf15f[_0xb2bd('0x15')]));});});};exports[_0xb2bd('0x2e')]=function(_0x5d30e8){var _0x8a6a59=this;return new Promise(function(_0x1c94dc,_0x8db469){return db[_0xb2bd('0x18')][_0xb2bd('0x1d')]({'raw':_0x5d30e8[_0xb2bd('0x1a')]?_0x5d30e8[_0xb2bd('0x1a')][_0xb2bd('0x2f')]===undefined?!![]:![]:!![],'where':_0x5d30e8[_0xb2bd('0x1a')]?_0x5d30e8[_0xb2bd('0x1a')][_0xb2bd('0x1e')]||null:null,'attributes':[[_0xb2bd('0x30'),_0xb2bd('0x31')],[db['sequelize']['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x32')))),_0xb2bd('0x33')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xb2bd('0x22')](_0xb2bd('0x34')))),'outboundNoAnswerCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x23')))),_0xb2bd('0x35')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x36')))),'outboundBusyCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db['sequelize']['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x37')))),_0xb2bd('0x38')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x39')))),_0xb2bd('0x3a')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb2bd('0x3b')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x3c')))),_0xb2bd('0x3d')],[db['sequelize']['fn'](_0xb2bd('0x20'),db['sequelize']['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x3e')))),_0xb2bd('0x3f')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x41')))),_0xb2bd('0x42')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')][_0xb2bd('0x22')](_0xb2bd('0x43')))),_0xb2bd('0x44')],[db[_0xb2bd('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb2bd('0x1f')]['literal'](_0xb2bd('0x45')))),'outboundRejectCallsDay'],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xb2bd('0x46')))),_0xb2bd('0x47')]],'group':[_0xb2bd('0x30')]})[_0xb2bd('0xc')](function(_0x338789){logger['info'](_0xb2bd('0x2e'),_0x5d30e8);logger[_0xb2bd('0x10')](_0xb2bd('0x2e'),_0x5d30e8,JSON[_0xb2bd('0x12')](_0x338789));_0x1c94dc(_0x338789);})['catch'](function(_0x2b07ae){logger['error'](_0xb2bd('0x2e'),_0x2b07ae[_0xb2bd('0x15')],_0x5d30e8);_0x8db469(_0x8a6a59['error'](0x1f4,_0x2b07ae[_0xb2bd('0x15')]));});});};exports[_0xb2bd('0x48')]=function(_0x1ed689){var _0x5b6874=this;return new Promise(function(_0x2681ab,_0x1c7bed){return db['CmHopperHistory'][_0xb2bd('0x1d')]({'raw':_0x1ed689[_0xb2bd('0x1a')]?_0x1ed689[_0xb2bd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ed689['options']?_0x1ed689[_0xb2bd('0x1a')][_0xb2bd('0x1e')]||null:null,'attributes':[[_0xb2bd('0x30'),_0xb2bd('0x31')],[db[_0xb2bd('0x1f')]['fn'](_0xb2bd('0x20'),db[_0xb2bd('0x1f')][_0xb2bd('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xb2bd('0x1f')]['fn']('COUNT',db[_0xb2bd('0x1f')]['fn']('IF',db[_0xb2bd('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xb2bd('0x49')]],'group':[_0xb2bd('0x30')]})['then'](function(_0x560921){logger[_0xb2bd('0xd')]('GetCampaignHopperHistory',_0x1ed689);logger['debug']('GetCampaignHopperHistory',_0x1ed689,JSON[_0xb2bd('0x12')](_0x560921));_0x2681ab(_0x560921);})['catch'](function(_0x367582){logger['error'](_0xb2bd('0x48'),_0x367582[_0xb2bd('0x15')],_0x1ed689);_0x1c7bed(_0x5b6874[_0xb2bd('0x13')](0x1f4,_0x367582[_0xb2bd('0x15')]));});});}; \ No newline at end of file +var _0x630e=['COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize'];(function(_0x295e3e,_0x30b417){var _0x4c8a9c=function(_0x2f4ef1){while(--_0x2f4ef1){_0x295e3e['push'](_0x295e3e['shift']());}};_0x4c8a9c(++_0x30b417);}(_0x630e,0x1af));var _0xe630=function(_0x2c1199,_0x243422){_0x2c1199=_0x2c1199-0x0;var _0x3a1d9a=_0x630e[_0x2c1199];return _0x3a1d9a;};'use strict';var _=require(_0xe630('0x0'));var util=require('util');var moment=require(_0xe630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe630('0x2'));var db=require(_0xe630('0x3'))['db'];var utils=require(_0xe630('0x4'));var logger=require('../../config/logger')(_0xe630('0x5'));var config=require(_0xe630('0x6'));var jayson=require(_0xe630('0x7'));var client=jayson[_0xe630('0x8')][_0xe630('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x481b21,_0x20193d,_0x34bad4){return new BPromise(function(_0x5a73ad,_0x267926){return client['request'](_0x481b21,_0x34bad4)[_0xe630('0xa')](function(_0x3da641){logger[_0xe630('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x20193d,'request\x20sent');logger[_0xe630('0xc')](_0xe630('0xd'),_0x20193d,_0xe630('0xe'),JSON[_0xe630('0xf')](_0x3da641));if(_0x3da641['error']){if(_0x3da641[_0xe630('0x10')][_0xe630('0x11')]===0x1f4){logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);return _0x267926(_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);}logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);return _0x5a73ad(_0x3da641[_0xe630('0x10')]['message']);}else{logger[_0xe630('0xb')](_0xe630('0x12'),_0x20193d,_0xe630('0xe'));_0x5a73ad(_0x3da641[_0xe630('0x14')][_0xe630('0x13')]);}})[_0xe630('0x15')](function(_0x26a2b7){logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x26a2b7);_0x267926(_0x26a2b7);});});}exports[_0xe630('0x16')]=function(_0x3dbcf6){var _0x9721fa=this;return new Promise(function(_0xafcf13,_0x79213e){return db[_0xe630('0x17')][_0xe630('0x18')](_0x3dbcf6[_0xe630('0x19')],{'raw':_0x3dbcf6[_0xe630('0x1a')]?_0x3dbcf6[_0xe630('0x1a')][_0xe630('0x1b')]===undefined?!![]:![]:!![]})[_0xe630('0xa')](function(_0x22fa75){logger[_0xe630('0xb')](_0xe630('0x16'),_0x3dbcf6);logger[_0xe630('0xc')](_0xe630('0x16'),_0x3dbcf6,JSON['stringify'](_0x22fa75));_0xafcf13(_0x22fa75);})[_0xe630('0x15')](function(_0x35e869){logger[_0xe630('0x10')]('CreateCmHopperHistory',_0x35e869[_0xe630('0x13')],_0x3dbcf6);_0x79213e(_0x9721fa[_0xe630('0x10')](0x1f4,_0x35e869[_0xe630('0x13')]));});});};exports['AvgHandleTime']=function(_0x2d797c){var _0x30bd2e=this;return new Promise(function(_0x11fc10,_0x30b079){return db[_0xe630('0x17')][_0xe630('0x1c')]({'raw':_0x2d797c[_0xe630('0x1a')]?_0x2d797c['options'][_0xe630('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d797c[_0xe630('0x1a')]?_0x2d797c['options'][_0xe630('0x1d')]||null:null,'attributes':[[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db['sequelize']['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0xe630('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xe630('0x20')))),_0xe630('0x21')],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0xe630('0x23')],[db[_0xe630('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe630('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),_0xe630('0x24')],[db[_0xe630('0x1e')]['fn'](_0xe630('0x25'),db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xe630('0x26')],[db['sequelize']['fn']('AVG',db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x27')))),'predictiveIntervalAvgTalktime']]})[_0xe630('0xa')](function(_0x1cb1e5){logger[_0xe630('0xb')](_0xe630('0x28'),_0x2d797c);logger[_0xe630('0xc')](_0xe630('0x28'),_0x2d797c,JSON[_0xe630('0xf')](_0x1cb1e5));_0x11fc10(_0x1cb1e5);})['catch'](function(_0xafcf1c){logger['error'](_0xe630('0x28'),_0xafcf1c[_0xe630('0x13')],_0x2d797c);_0x30b079(_0x30bd2e[_0xe630('0x10')](0x1f4,_0xafcf1c[_0xe630('0x13')]));});});};exports[_0xe630('0x29')]=function(_0x3db4ab){var _0x341173=this;return new Promise(function(_0x24d694,_0x58da07){return db[_0xe630('0x17')][_0xe630('0x1c')]({'raw':_0x3db4ab['options']?_0x3db4ab['options']['raw']===undefined?!![]:![]:!![],'where':_0x3db4ab['options']?_0x3db4ab[_0xe630('0x1a')][_0xe630('0x1d')]||null:null,'attributes':[[_0xe630('0x2a'),_0xe630('0x2b')],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x2c')))),_0xe630('0x2d')],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x2e')))),_0xe630('0x2f')],[db[_0xe630('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe630('0x22')](_0xe630('0x20')))),_0xe630('0x30')],[db['sequelize']['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xe630('0x31')))),'outboundBusyCallsDay'],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db['sequelize'][_0xe630('0x22')](_0xe630('0x32')))),_0xe630('0x33')],[db[_0xe630('0x1e')]['fn']('COUNT',db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')]['literal'](_0xe630('0x34')))),_0xe630('0x35')],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db['sequelize']['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')]['literal'](_0xe630('0x37')))),'outboundUnknownCallsDay'],[db[_0xe630('0x1e')]['fn']('COUNT',db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x38')))),_0xe630('0x39')],[db[_0xe630('0x1e')]['fn']('COUNT',db[_0xe630('0x1e')]['fn']('IF',db['sequelize'][_0xe630('0x22')](_0xe630('0x3a')))),_0xe630('0x3b')],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x3c')))),'outboundRejectCallsDay'],[db[_0xe630('0x1e')]['fn']('COUNT',db[_0xe630('0x1e')]['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0xe630('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe630('0x1e')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xe630('0x3e')],[db[_0xe630('0x1e')]['fn']('COUNT',db[_0xe630('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})[_0xe630('0xa')](function(_0xf0f784){logger['info']('GetVoiceQueueHopperHistory',_0x3db4ab);logger['debug'](_0xe630('0x29'),_0x3db4ab,JSON['stringify'](_0xf0f784));_0x24d694(_0xf0f784);})[_0xe630('0x15')](function(_0x264ed8){logger[_0xe630('0x10')](_0xe630('0x29'),_0x264ed8['message'],_0x3db4ab);_0x58da07(_0x341173[_0xe630('0x10')](0x1f4,_0x264ed8[_0xe630('0x13')]));});});};exports[_0xe630('0x3f')]=function(_0xb68796){var _0x4a9ee6=this;return new Promise(function(_0x48c724,_0x34db04){return db[_0xe630('0x17')]['findAll']({'raw':_0xb68796[_0xe630('0x1a')]?_0xb68796[_0xe630('0x1a')][_0xe630('0x1b')]===undefined?!![]:![]:!![],'where':_0xb68796[_0xe630('0x1a')]?_0xb68796['options'][_0xe630('0x1d')]||null:null,'attributes':[[_0xe630('0x2a'),'name'],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db[_0xe630('0x1e')][_0xe630('0x40')]('id')),'ivrTotalCallsDays'],[db[_0xe630('0x1e')]['fn'](_0xe630('0x1f'),db['sequelize']['fn']('IF',db[_0xe630('0x1e')][_0xe630('0x22')](_0xe630('0x20')))),_0xe630('0x41')]],'group':[_0xe630('0x2a')]})[_0xe630('0xa')](function(_0xae13d1){logger[_0xe630('0xb')](_0xe630('0x3f'),_0xb68796);logger[_0xe630('0xc')](_0xe630('0x3f'),_0xb68796,JSON[_0xe630('0xf')](_0xae13d1));_0x48c724(_0xae13d1);})[_0xe630('0x15')](function(_0x426177){logger['error'](_0xe630('0x3f'),_0x426177[_0xe630('0x13')],_0xb68796);_0x34db04(_0x4a9ee6[_0xe630('0x10')](0x1f4,_0x426177[_0xe630('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 59db01a..fe8488b 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 _0xbb7a=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','exports'];(function(_0x18369a,_0x4e8835){var _0xa6e2b8=function(_0x27fe31){while(--_0x27fe31){_0x18369a['push'](_0x18369a['shift']());}};_0xa6e2b8(++_0x4e8835);}(_0xbb7a,0x9a));var _0xabb7=function(_0x20dee7,_0xebc612){_0x20dee7=_0x20dee7-0x0;var _0x125891=_0xbb7a[_0x20dee7];return _0x125891;};'use strict';var multer=require(_0xabb7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xabb7('0x1'));var express=require(_0xabb7('0x2'));var router=express[_0xabb7('0x3')]();var fs_extra=require(_0xabb7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabb7('0x5'));var config=require(_0xabb7('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xabb7('0x7')]('/',auth[_0xabb7('0x8')](),controller['index']);router[_0xabb7('0x7')]('/describe',auth[_0xabb7('0x8')](),controller['describe']);router[_0xabb7('0x7')](_0xabb7('0x9'),auth[_0xabb7('0x8')](),controller[_0xabb7('0xa')]);router[_0xabb7('0xb')]('/',auth[_0xabb7('0x8')](),controller[_0xabb7('0xc')]);router['put']('/:id',auth[_0xabb7('0x8')](),controller['update']);module[_0xabb7('0xd')]=router; \ No newline at end of file +var _0x8156=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','exports'];(function(_0x45889f,_0x4e6ed6){var _0x5bcd43=function(_0x5c0dda){while(--_0x5c0dda){_0x45889f['push'](_0x45889f['shift']());}};_0x5bcd43(++_0x4e6ed6);}(_0x8156,0x85));var _0x6815=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8156[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x6815('0x0'));var util=require(_0x6815('0x1'));var path=require(_0x6815('0x2'));var timeout=require(_0x6815('0x3'));var express=require('express');var router=express[_0x6815('0x4')]();var fs_extra=require(_0x6815('0x5'));var auth=require(_0x6815('0x6'));var interaction=require(_0x6815('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x6815('0x8')](),controller[_0x6815('0x9')]);router[_0x6815('0xa')](_0x6815('0xb'),auth[_0x6815('0x8')](),controller[_0x6815('0xc')]);router[_0x6815('0xa')](_0x6815('0xd'),auth[_0x6815('0x8')](),controller[_0x6815('0xe')]);router['post']('/',auth[_0x6815('0x8')](),controller[_0x6815('0xf')]);router[_0x6815('0x10')]('/:id',auth[_0x6815('0x8')](),controller[_0x6815('0x11')]);module[_0x6815('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6c647dd..9c408d1 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 _0x53d5=['sequelize','exports','STRING','name'];(function(_0x4654d0,_0x19aa25){var _0x5f457e=function(_0x2207e7){while(--_0x2207e7){_0x4654d0['push'](_0x4654d0['shift']());}};_0x5f457e(++_0x19aa25);}(_0x53d5,0x1cc));var _0x553d=function(_0x14ee59,_0x236373){_0x14ee59=_0x14ee59-0x0;var _0x46dcd3=_0x53d5[_0x14ee59];return _0x46dcd3;};'use strict';var Sequelize=require(_0x553d('0x0'));module[_0x553d('0x1')]={'name':{'type':Sequelize[_0x553d('0x2')],'unique':_0x553d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x553d('0x2')]},'dialPrefix':{'type':Sequelize[_0x553d('0x2')]}}; \ No newline at end of file +var _0x4a25=['sequelize','STRING'];(function(_0x58c248,_0x2e1d63){var _0x469d39=function(_0x5309f7){while(--_0x5309f7){_0x58c248['push'](_0x58c248['shift']());}};_0x469d39(++_0x2e1d63);}(_0x4a25,0x1d4));var _0x54a2=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x4a25[_0x3ff4a3];return _0x38676f;};'use strict';var Sequelize=require(_0x54a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x54a2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x54a2('0x1')]},'dialPrefix':{'type':Sequelize[_0x54a2('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fb07c4b..669ad2b 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 _0x3d7e=['spread','emit','userCmList:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','save','update','destroy','get','Lists','UserProfileResource','then','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','describe','addDisposition','ListId','findOne','Disposition','hasOwnProperty','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit'];(function(_0x4fa169,_0x412b2c){var _0x337386=function(_0x5dac3e){while(--_0x5dac3e){_0x4fa169['push'](_0x4fa169['shift']());}};_0x337386(++_0x412b2c);}(_0x3d7e,0x1ae));var _0xe3d7=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x3d7e[_0x13ac10];return _0x28eda2;};'use strict';var emlformat=require(_0xe3d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3d7('0x2'));var moment=require(_0xe3d7('0x3'));var BPromise=require(_0xe3d7('0x4'));var Mustache=require(_0xe3d7('0x5'));var util=require(_0xe3d7('0x6'));var path=require(_0xe3d7('0x7'));var sox=require('sox');var csv=require(_0xe3d7('0x8'));var ejs=require(_0xe3d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe3d7('0xa'));var _=require('lodash');var squel=require(_0xe3d7('0xb'));var crypto=require(_0xe3d7('0xc'));var jsforce=require(_0xe3d7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3d7('0x8'));var querystring=require(_0xe3d7('0xe'));var Papa=require(_0xe3d7('0xf'));var Redis=require(_0xe3d7('0x10'));var authService=require(_0xe3d7('0x11'));var qs=require(_0xe3d7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3d7('0x13'));var logger=require(_0xe3d7('0x14'))(_0xe3d7('0x15'));var utils=require(_0xe3d7('0x16'));var config=require(_0xe3d7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3d7('0x18'))['db'];config['redis']=_[_0xe3d7('0x19')](config[_0xe3d7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3d7('0x1b'))(new Redis(config[_0xe3d7('0x1a')]));require(_0xe3d7('0x1c'))[_0xe3d7('0x1d')](socket);function respondWithStatusCode(_0x1ca9af,_0x35b879){_0x35b879=_0x35b879||0xcc;return function(_0xda611d){if(_0xda611d){return _0x1ca9af[_0xe3d7('0x1e')](_0x35b879);}return _0x1ca9af[_0xe3d7('0x1f')](_0x35b879)[_0xe3d7('0x20')]();};}function respondWithResult(_0x3a0f5d,_0x557a4b){_0x557a4b=_0x557a4b||0xc8;return function(_0x2370ab){if(_0x2370ab){return _0x3a0f5d[_0xe3d7('0x1f')](_0x557a4b)[_0xe3d7('0x21')](_0x2370ab);}};}function respondWithFilteredResult(_0x3598b7,_0x1be243){return function(_0xb2d3d1){if(_0xb2d3d1){var _0x4eddd6=typeof _0x1be243['offset']===_0xe3d7('0x22')&&typeof _0x1be243['limit']===_0xe3d7('0x22');var _0x3d3b5f=_0xb2d3d1[_0xe3d7('0x23')];var _0x1fee7c=_0x4eddd6?0x0:_0x1be243[_0xe3d7('0x24')];var _0xfaa878=_0x4eddd6?_0xb2d3d1[_0xe3d7('0x23')]:_0x1be243[_0xe3d7('0x24')]+_0x1be243[_0xe3d7('0x25')];var _0x53238c;if(_0xfaa878>=_0x3d3b5f){_0xfaa878=_0x3d3b5f;_0x53238c=0xc8;}else{_0x53238c=0xce;}_0x3598b7[_0xe3d7('0x1f')](_0x53238c);return _0x3598b7[_0xe3d7('0x26')]('Content-Range',_0x1fee7c+'-'+_0xfaa878+'/'+_0x3d3b5f)['json'](_0xb2d3d1);}return null;};}function patchUpdates(_0x469278){return function(_0x3fd1ba){try{jsonpatch['apply'](_0x3fd1ba,_0x469278,!![]);}catch(_0x2768fd){return BPromise['reject'](_0x2768fd);}return _0x3fd1ba[_0xe3d7('0x27')]();};}function saveUpdates(_0x447ee8,_0x6145c4){return function(_0x334480){if(_0x334480){return _0x334480[_0xe3d7('0x28')](_0x447ee8)['then'](function(_0x15b8d1){return _0x15b8d1;});}return null;};}function removeEntity(_0x4df9a0,_0x5cc3a4){return function(_0x39acc5){if(_0x39acc5){return _0x39acc5[_0xe3d7('0x29')]()['then'](function(){var _0x51a6b3=_0x39acc5[_0xe3d7('0x2a')]({'plain':!![]});var _0x523fc=_0xe3d7('0x2b');return db[_0xe3d7('0x2c')][_0xe3d7('0x29')]({'where':{'type':_0x523fc,'resourceId':_0x51a6b3['id']}})[_0xe3d7('0x2d')](function(){return _0x39acc5;});})[_0xe3d7('0x2d')](function(){_0x4df9a0[_0xe3d7('0x1f')](0xcc)[_0xe3d7('0x20')]();});}};}function handleEntityNotFound(_0x4b9437,_0x37d4b0){return function(_0x5c870b){if(!_0x5c870b){_0x4b9437[_0xe3d7('0x1e')](0x194);}return _0x5c870b;};}function handleError(_0xc804cd,_0x1fafc4){_0x1fafc4=_0x1fafc4||0x1f4;return function(_0x596678){logger['error'](_0x596678[_0xe3d7('0x2e')]);if(_0x596678[_0xe3d7('0x2f')]){delete _0x596678['name'];}_0xc804cd[_0xe3d7('0x1f')](_0x1fafc4)[_0xe3d7('0x30')](_0x596678);};}exports[_0xe3d7('0x31')]=function(_0x21840c,_0x5cbd35){var _0x5af9d6={},_0x88ea03={},_0x55747d={'count':0x0,'rows':[]};var _0x5e7dca=_[_0xe3d7('0x32')](db[_0xe3d7('0x33')][_0xe3d7('0x34')],function(_0x3b3281){return{'name':_0x3b3281[_0xe3d7('0x35')],'type':_0x3b3281['type'][_0xe3d7('0x36')]};});_0x88ea03[_0xe3d7('0x37')]=_[_0xe3d7('0x32')](_0x5e7dca,_0xe3d7('0x2f'));_0x88ea03[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0x21840c['query']);_0x88ea03[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x88ea03[_0xe3d7('0x37')],_0x88ea03[_0xe3d7('0x38')]);_0x5af9d6[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x88ea03[_0xe3d7('0x37')],qs[_0xe3d7('0x3d')](_0x21840c[_0xe3d7('0x38')]['fields']));_0x5af9d6['attributes']=_0x5af9d6[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x5af9d6[_0xe3d7('0x3c')]:_0x88ea03[_0xe3d7('0x37')];if(!_0x21840c[_0xe3d7('0x38')]['hasOwnProperty']('nolimit')){_0x5af9d6[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x5af9d6[_0xe3d7('0x24')]=qs[_0xe3d7('0x24')](_0x21840c[_0xe3d7('0x38')]['offset']);}_0x5af9d6[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x5af9d6[_0xe3d7('0x41')]=qs[_0xe3d7('0x3a')](_[_0xe3d7('0x42')](_0x21840c[_0xe3d7('0x38')],_0x88ea03['filters']),_0x5e7dca);if(_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x5af9d6['where']=_['merge'](_0x5af9d6[_0xe3d7('0x41')],{'$or':_[_0xe3d7('0x32')](_0x5e7dca,function(_0x837846){if(_0x837846[_0xe3d7('0x44')]!==_0xe3d7('0x45')){var _0x50897c={};_0x50897c[_0x837846[_0xe3d7('0x2f')]]={'$like':'%'+_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x50897c;}})});}_0x5af9d6=_[_0xe3d7('0x46')]({},_0x5af9d6,_0x21840c[_0xe3d7('0x47')]);var _0x2ae957={'where':_0x5af9d6[_0xe3d7('0x41')]};return db[_0xe3d7('0x33')][_0xe3d7('0x23')](_0x2ae957)[_0xe3d7('0x2d')](function(_0x56fb1a){_0x55747d[_0xe3d7('0x23')]=_0x56fb1a;if(_0x21840c[_0xe3d7('0x38')][_0xe3d7('0x48')]){_0x5af9d6['include']=[{'all':!![]}];}return db[_0xe3d7('0x33')]['findAll'](_0x5af9d6);})[_0xe3d7('0x2d')](function(_0x4407b1){_0x55747d[_0xe3d7('0x49')]=_0x4407b1;return _0x55747d;})['then'](respondWithFilteredResult(_0x5cbd35,_0x5af9d6))[_0xe3d7('0x4a')](handleError(_0x5cbd35,null));};exports['show']=function(_0x27b4a5,_0x2d1626){var _0x321e13={'raw':![],'where':{'id':_0x27b4a5[_0xe3d7('0x4b')]['id']}},_0x3c5410={};_0x3c5410[_0xe3d7('0x37')]=_[_0xe3d7('0x39')](db[_0xe3d7('0x33')][_0xe3d7('0x34')]);_0x3c5410[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0x27b4a5[_0xe3d7('0x38')]);_0x3c5410[_0xe3d7('0x3a')]=_['intersection'](_0x3c5410[_0xe3d7('0x37')],_0x3c5410['query']);_0x321e13[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x3c5410[_0xe3d7('0x37')],qs[_0xe3d7('0x3d')](_0x27b4a5[_0xe3d7('0x38')]['fields']));_0x321e13[_0xe3d7('0x3c')]=_0x321e13['attributes'][_0xe3d7('0x3e')]?_0x321e13[_0xe3d7('0x3c')]:_0x3c5410[_0xe3d7('0x37')];if(_0x27b4a5[_0xe3d7('0x38')][_0xe3d7('0x48')]){_0x321e13[_0xe3d7('0x4c')]=[{'all':!![]}];}_0x321e13=_[_0xe3d7('0x46')]({},_0x321e13,_0x27b4a5[_0xe3d7('0x47')]);return db['CmList'][_0xe3d7('0x4d')](_0x321e13)[_0xe3d7('0x2d')](handleEntityNotFound(_0x2d1626,null))[_0xe3d7('0x2d')](respondWithResult(_0x2d1626,null))[_0xe3d7('0x4a')](handleError(_0x2d1626,null));};exports[_0xe3d7('0x4e')]=function(_0x1d951c,_0x5e79d4){return db['CmList']['create'](_0x1d951c[_0xe3d7('0x4f')],{})[_0xe3d7('0x2d')](function(_0x16a7dd){var _0x272203=_0x1d951c['user'][_0xe3d7('0x2a')]({'plain':!![]});if(!_0x272203)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x272203['role']===_0xe3d7('0x50')){var _0x3e34cc=_0x16a7dd[_0xe3d7('0x2a')]({'plain':!![]});var _0x24fe7b=_0xe3d7('0x2b');return db[_0xe3d7('0x51')][_0xe3d7('0x4d')]({'where':{'name':_0x24fe7b,'userProfileId':_0x272203[_0xe3d7('0x52')]},'raw':!![]})[_0xe3d7('0x2d')](function(_0xc2869b){if(_0xc2869b&&_0xc2869b[_0xe3d7('0x53')]===0x0){return db[_0xe3d7('0x2c')][_0xe3d7('0x4e')]({'name':_0x3e34cc['name'],'resourceId':_0x3e34cc['id'],'type':_0xc2869b[_0xe3d7('0x2f')],'sectionId':_0xc2869b['id']},{})[_0xe3d7('0x2d')](function(){return _0x16a7dd;});}else{return _0x16a7dd;}})[_0xe3d7('0x4a')](function(_0x3a3301){logger[_0xe3d7('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a3301);throw _0x3a3301;});}return _0x16a7dd;})[_0xe3d7('0x2d')](respondWithResult(_0x5e79d4,0xc9))['catch'](handleError(_0x5e79d4,null));};exports[_0xe3d7('0x28')]=function(_0x2395e9,_0x262b39){if(_0x2395e9[_0xe3d7('0x4f')]['id']){delete _0x2395e9[_0xe3d7('0x4f')]['id'];}return db['CmList'][_0xe3d7('0x4d')]({'where':{'id':_0x2395e9[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x262b39,null))[_0xe3d7('0x2d')](saveUpdates(_0x2395e9['body'],null))[_0xe3d7('0x2d')](respondWithResult(_0x262b39,null))[_0xe3d7('0x4a')](handleError(_0x262b39,null));};exports[_0xe3d7('0x29')]=function(_0x1bb8b3,_0x378f6c){return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x1bb8b3[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x378f6c,null))[_0xe3d7('0x2d')](removeEntity(_0x378f6c,null))['catch'](handleError(_0x378f6c,null));};exports[_0xe3d7('0x55')]=function(_0x5b26fb,_0x4194de){return db[_0xe3d7('0x33')][_0xe3d7('0x55')]()[_0xe3d7('0x2d')](respondWithResult(_0x4194de,null))[_0xe3d7('0x4a')](handleError(_0x4194de,null));};exports[_0xe3d7('0x56')]=function(_0x2ac904,_0x324fd9,_0xffd632){if(_0x2ac904['body']['id']){delete _0x2ac904[_0xe3d7('0x4f')]['id'];}return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x2ac904[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x324fd9,null))['then'](function(_0x3687b8){if(_0x3687b8){_0x2ac904[_0xe3d7('0x4f')][_0xe3d7('0x57')]=_0x3687b8['id'];return db['Disposition']['create'](_0x2ac904['body']);}})[_0xe3d7('0x2d')](respondWithResult(_0x324fd9,null))[_0xe3d7('0x4a')](handleError(_0x324fd9,null));};exports['getDispositions']=function(_0xfe5a6e,_0x265fac,_0xc959e2){var _0x369aea={'raw':![],'where':{}};var _0x45ffb2={};var _0x12eb1b={'count':0x0,'rows':[]};return db['CmList'][_0xe3d7('0x58')]({'where':{'id':_0xfe5a6e[_0xe3d7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x265fac,null))[_0xe3d7('0x2d')](function(_0x23f7f0){if(_0x23f7f0){_0x45ffb2[_0xe3d7('0x37')]=_[_0xe3d7('0x39')](db[_0xe3d7('0x59')][_0xe3d7('0x34')]);_0x45ffb2[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0xfe5a6e[_0xe3d7('0x38')]);_0x45ffb2[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x45ffb2[_0xe3d7('0x37')],_0x45ffb2[_0xe3d7('0x38')]);_0x369aea[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x45ffb2['model'],qs[_0xe3d7('0x3d')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x3d')]));_0x369aea[_0xe3d7('0x3c')]=_0x369aea[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x369aea[_0xe3d7('0x3c')]:_0x45ffb2['model'];if(!_0xfe5a6e['query'][_0xe3d7('0x5a')]('nolimit')){_0x369aea[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x369aea[_0xe3d7('0x24')]=qs[_0xe3d7('0x24')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x24')]);}_0x369aea[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x369aea[_0xe3d7('0x41')]=qs[_0xe3d7('0x3a')](_[_0xe3d7('0x42')](_0xfe5a6e['query'],_0x45ffb2[_0xe3d7('0x3a')]));_0x369aea[_0xe3d7('0x41')]['ListId']=_0x23f7f0['id'];if(_0xfe5a6e[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x369aea[_0xe3d7('0x41')]=_[_0xe3d7('0x46')](_0x369aea['where'],{'$or':_[_0xe3d7('0x32')](_0x369aea[_0xe3d7('0x3c')],function(_0x3aa4fb){var _0x304f29={};_0x304f29[_0x3aa4fb]={'$like':'%'+_0xfe5a6e['query'][_0xe3d7('0x43')]+'%'};return _0x304f29;})});}_0x369aea=_['merge']({},_0x369aea,_0xfe5a6e['options']);return db['Disposition'][_0xe3d7('0x23')]({'where':_0x369aea[_0xe3d7('0x41')]})['then'](function(_0x272a7f){_0x12eb1b[_0xe3d7('0x23')]=_0x272a7f;if(_0xfe5a6e[_0xe3d7('0x38')]['includeAll']){_0x369aea['include']=[{'all':!![]}];}return db['Disposition'][_0xe3d7('0x5b')](_0x369aea);})['then'](function(_0x1362dc){_0x12eb1b[_0xe3d7('0x49')]=_0x1362dc;return _0x12eb1b;});}})['then'](respondWithFilteredResult(_0x265fac,_0x369aea))[_0xe3d7('0x4a')](handleError(_0x265fac,null));};exports[_0xe3d7('0x5c')]=function(_0x3d7fd2,_0x5d2cda,_0x47caff){return db['CmList']['find']({'where':{'id':_0x3d7fd2['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x5d2cda,null))[_0xe3d7('0x2d')](function(_0x511e9b){if(_0x511e9b){return _0x511e9b['removeDispositions'](_0x3d7fd2['query'][_0xe3d7('0x5d')]);}})['then'](respondWithStatusCode(_0x5d2cda,null))['catch'](handleError(_0x5d2cda,null));};exports[_0xe3d7('0x5e')]=function(_0x16879b,_0x5341de,_0x4d1628){return db[_0xe3d7('0x33')]['find']({'where':{'id':_0x16879b[_0xe3d7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5341de,null))[_0xe3d7('0x2d')](function(_0x561e4d){if(_0x561e4d){var _0x2fd54d=[];var _0x3f31df={'success':[],'errors':[]};return db[_0xe3d7('0x5f')][_0xe3d7('0x55')]()[_0xe3d7('0x2d')](function(_0x5da5d2){if(_0x16879b['body'][_0xe3d7('0x60')]&&_[_0xe3d7('0x61')](_0x16879b[_0xe3d7('0x4f')]['tags'])){if(_0x16879b['body'][_0xe3d7('0x60')][_0xe3d7('0x3e')]){_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')]=_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')][_0xe3d7('0x62')](';')+';';}else{_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')]=null;}}else{_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x60')]=null;}if(_0x16879b[_0xe3d7('0x4f')]&&_[_0xe3d7('0x61')](_0x16879b['body'])){for(var _0x22ecee=0x0;_0x22ecee<_0x16879b[_0xe3d7('0x4f')][_0xe3d7('0x3e')];_0x22ecee+=0x1){_0x16879b['body'][_0x22ecee][_0xe3d7('0x57')]=_0x16879b[_0xe3d7('0x4b')]['id'];_0x2fd54d[_0xe3d7('0x63')](_0x16879b['body'][_0x22ecee]);}return BPromise[_0xe3d7('0x64')](_0x2fd54d,function(_0x55ee08){return db[_0xe3d7('0x5f')][_0xe3d7('0x4e')](_['omit'](_0x55ee08,[_0xe3d7('0x5d'),'id'])||{},{'fields':_['keys'](_0x5da5d2),'raw':!![]})[_0xe3d7('0x2d')](function(_0x827399){_0x3f31df[_0xe3d7('0x65')]['push'](_0x827399[_0xe3d7('0x66')]);})[_0xe3d7('0x4a')](function(_0x3d6522){_0x3f31df[_0xe3d7('0x67')][_0xe3d7('0x63')]({'data':_0x55ee08,'error':_0x3d6522[_0xe3d7('0x68')]});});})['then'](function(_0x44a492){return _0x3f31df;})[_0xe3d7('0x4a')](function(_0x38e2e2){return _0x38e2e2;});}else{_0x5341de['status'](0x190)[_0xe3d7('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xe3d7('0x2d')](respondWithResult(_0x5341de,null))[_0xe3d7('0x4a')](handleError(_0x5341de,null));};exports[_0xe3d7('0x69')]=function(_0xda05d3,_0x9db989,_0x471aa5){var _0x52fd6a;return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0xda05d3[_0xe3d7('0x4b')]['id']},'include':[{'model':db[_0xe3d7('0x6a')],'as':_0xe3d7('0x6b')}]})[_0xe3d7('0x2d')](handleEntityNotFound(_0x9db989,null))[_0xe3d7('0x2d')](function(_0x39d71f){if(_0x39d71f){_0x52fd6a=_0x39d71f;return db[_0xe3d7('0x5f')]['rawAttributes'];}})[_0xe3d7('0x2d')](function(_0x400a9f){if(_0x400a9f){var _0x410fcb={};var _0xd01ff2={};_0xd01ff2[_0xe3d7('0x37')]=_[_0xe3d7('0x6c')](_['keys'](_0x400a9f),_['map'](_0x52fd6a[_0xe3d7('0x6b')],function(_0x579edb){return util[_0xe3d7('0x6d')](_0xe3d7('0x6e'),_0x579edb['id']);}));_0xd01ff2[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0xda05d3[_0xe3d7('0x38')]);_0xd01ff2['filters']=_[_0xe3d7('0x3b')](_0xd01ff2[_0xe3d7('0x37')],_0xd01ff2[_0xe3d7('0x38')]);_0x410fcb['attributes']=_[_0xe3d7('0x3b')](_0xd01ff2[_0xe3d7('0x37')],qs[_0xe3d7('0x3d')](_0xda05d3[_0xe3d7('0x38')]['fields']));_0x410fcb[_0xe3d7('0x3c')]=_0x410fcb[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x410fcb['attributes']:_0xd01ff2['model'];if(!_0xda05d3[_0xe3d7('0x38')]['hasOwnProperty'](_0xe3d7('0x6f'))){_0x410fcb[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x410fcb[_0xe3d7('0x24')]=qs['offset'](_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x24')]);}_0x410fcb[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x410fcb[_0xe3d7('0x41')]=qs[_0xe3d7('0x3a')](_[_0xe3d7('0x42')](_0xda05d3[_0xe3d7('0x38')],_0xd01ff2[_0xe3d7('0x3a')]));_0x410fcb['raw']=!![];if(_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x410fcb['where']=_[_0xe3d7('0x46')](_0x410fcb['where'],{'$or':_['map'](_0x410fcb[_0xe3d7('0x3c')],function(_0xc9ff3b){var _0x46b743={};_0x46b743[_0xc9ff3b]={'$like':'%'+_0xda05d3[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x46b743;})});}_0x410fcb=_['merge']({},_0x410fcb,_0xda05d3[_0xe3d7('0x47')]);return _0x52fd6a[_0xe3d7('0x69')](_0x410fcb);}})[_0xe3d7('0x2d')](respondWithResult(_0x9db989,null))[_0xe3d7('0x4a')](handleError(_0x9db989,null));};exports[_0xe3d7('0x70')]=function(_0x1d845b,_0x478ce5,_0x2ea2da){var _0x180c01;return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x1d845b[_0xe3d7('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xe3d7('0x2d')](handleEntityNotFound(_0x478ce5,null))[_0xe3d7('0x2d')](function(_0x2e3b6b){if(_0x2e3b6b){_0x180c01=_0x2e3b6b;return db[_0xe3d7('0x5f')][_0xe3d7('0x34')];}})[_0xe3d7('0x2d')](function(_0x125f16){if(_0x125f16){var _0x59265e={};var _0x3e38e4={};_0x3e38e4[_0xe3d7('0x37')]=_['concat'](_['keys'](_0x125f16),_[_0xe3d7('0x32')](_0x180c01['CustomFields'],function(_0x36dd04){return util[_0xe3d7('0x6d')](_0xe3d7('0x6e'),_0x36dd04['id']);}));_0x3e38e4[_0xe3d7('0x38')]=_['keys'](_0x1d845b[_0xe3d7('0x38')]);_0x3e38e4[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x3e38e4[_0xe3d7('0x37')],_0x3e38e4['query']);_0x59265e[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x3e38e4[_0xe3d7('0x37')],qs['fields'](_0x1d845b[_0xe3d7('0x38')]['fields']));_0x59265e[_0xe3d7('0x3c')]=_0x59265e[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x59265e['attributes']:_0x3e38e4[_0xe3d7('0x37')];if(!_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x5a')](_0xe3d7('0x6f'))){_0x59265e[_0xe3d7('0x25')]=qs[_0xe3d7('0x25')](_0x1d845b[_0xe3d7('0x38')]['limit']);_0x59265e[_0xe3d7('0x24')]=qs[_0xe3d7('0x24')](_0x1d845b['query'][_0xe3d7('0x24')]);}_0x59265e['order']=qs[_0xe3d7('0x40')](_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x59265e['where']=qs['filters'](_['pick'](_0x1d845b[_0xe3d7('0x38')],_0x3e38e4[_0xe3d7('0x3a')]));_0x59265e['raw']=!![];if(_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x59265e[_0xe3d7('0x41')]=_['merge'](_0x59265e[_0xe3d7('0x41')],{'$or':_[_0xe3d7('0x32')](_0x59265e[_0xe3d7('0x3c')],function(_0x4baa3c){var _0x14b973={};_0x14b973[_0x4baa3c]={'$like':'%'+_0x1d845b[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x14b973;})});}_0x59265e=_[_0xe3d7('0x46')]({},_0x59265e,_0x1d845b[_0xe3d7('0x47')]);return _0x180c01[_0xe3d7('0x69')](_0x59265e);}})[_0xe3d7('0x2d')](function(_0x178c9e){if(!_[_0xe3d7('0x71')](_0x178c9e)){var _0x40f1ec=toCsv(_0x178c9e);var _0x1f811b=Date[_0xe3d7('0x72')]();fs[_0xe3d7('0x73')](util[_0xe3d7('0x6d')](_0xe3d7('0x74'),_0x180c01['id'],_0x1f811b),_0x40f1ec);_0x478ce5[_0xe3d7('0x75')](_0xe3d7('0x76'),'attachment;\x20filename='+util[_0xe3d7('0x6d')](_0xe3d7('0x77'),_0x180c01['id'],_0x1f811b));_0x478ce5[_0xe3d7('0x75')](_0xe3d7('0x78'),'text/csv');return _0x478ce5[_0xe3d7('0x79')](util[_0xe3d7('0x6d')](_0xe3d7('0x74'),_0x180c01['id'],_0x1f811b));}else{return _0x478ce5[_0xe3d7('0x1e')](0xcc);}})['catch'](handleError(_0x478ce5,null));};exports[_0xe3d7('0x7a')]=function(_0x40524f,_0x319aa7,_0x532768){var _0x45f485;delete _0x40524f[_0xe3d7('0x4f')]['id'];return db[_0xe3d7('0x33')][_0xe3d7('0x58')]({'where':{'id':_0x40524f['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x319aa7,null))['then'](function(_0x375476){if(_0x375476){return db[_0xe3d7('0x7b')]['transaction'](function(_0xe5136e){return db[_0xe3d7('0x6a')][_0xe3d7('0x4e')](_0x40524f[_0xe3d7('0x4f')],{'transaction':_0xe5136e})[_0xe3d7('0x2d')](function(_0x3fff7c){_0x45f485=_0x3fff7c;return _0x375476[_0xe3d7('0x7c')](_0x3fff7c,{'transaction':_0xe5136e});})[_0xe3d7('0x2d')](function(){var _0x3db001={'type':db[_0xe3d7('0x7d')][_0xe3d7('0x7e')],'transaction':_0xe5136e};switch(_0x40524f[_0xe3d7('0x4f')][_0xe3d7('0x44')]){case _0xe3d7('0x7f'):_0x3db001[_0xe3d7('0x44')]=db[_0xe3d7('0x7d')][_0xe3d7('0x7e')];break;case _0xe3d7('0x80'):_0x3db001[_0xe3d7('0x44')]=db[_0xe3d7('0x7d')][_0xe3d7('0x81')];break;case'switch':_0x3db001[_0xe3d7('0x44')]=db[_0xe3d7('0x7d')][_0xe3d7('0x82')];_0x3db001[_0xe3d7('0x83')]=![];break;default:}return db[_0xe3d7('0x7b')]['queryInterface']['addColumn'](_0xe3d7('0x84'),util[_0xe3d7('0x6d')](_0xe3d7('0x85'),_0x45f485['id']),_0x3db001);})[_0xe3d7('0x2d')](function(){return _0x45f485;});});}})[_0xe3d7('0x2d')](respondWithResult(_0x319aa7,null))[_0xe3d7('0x4a')](handleError(_0x319aa7,null));};exports[_0xe3d7('0x86')]=function(_0x8d8914,_0x3eec94,_0x7e7a59){var _0x54822b={};var _0x4358c2={};var _0x52f8c3;var _0xc705a3;return db['CmList'][_0xe3d7('0x58')]({'where':{'id':_0x8d8914['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x3eec94,null))['then'](function(_0x3dfadf){if(_0x3dfadf){_0x52f8c3=_0x3dfadf;_0x4358c2['model']=_[_0xe3d7('0x39')](db[_0xe3d7('0x6a')][_0xe3d7('0x34')]);_0x4358c2['query']=_[_0xe3d7('0x39')](_0x8d8914[_0xe3d7('0x38')]);_0x4358c2[_0xe3d7('0x3a')]=_[_0xe3d7('0x3b')](_0x4358c2[_0xe3d7('0x37')],_0x4358c2[_0xe3d7('0x38')]);_0x54822b[_0xe3d7('0x3c')]=_[_0xe3d7('0x3b')](_0x4358c2[_0xe3d7('0x37')],qs['fields'](_0x8d8914[_0xe3d7('0x38')][_0xe3d7('0x3d')]));_0x54822b[_0xe3d7('0x3c')]=_0x54822b[_0xe3d7('0x3c')]['length']?_0x54822b[_0xe3d7('0x3c')]:_0x4358c2[_0xe3d7('0x37')];_0x54822b[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0x8d8914['query']['sort']);_0x54822b['where']=qs['filters'](_[_0xe3d7('0x42')](_0x8d8914['query'],_0x4358c2[_0xe3d7('0x3a')]));_0x54822b['where']=_[_0xe3d7('0x46')](_0x54822b[_0xe3d7('0x41')],{'$or':[{'ListId':_0x3dfadf['id']},{'ListId':null}]});if(_0x8d8914[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x54822b[_0xe3d7('0x41')]=_['merge'](_0x54822b[_0xe3d7('0x41')],{'$or':_['map'](_0x54822b[_0xe3d7('0x3c')],function(_0x1ad519){var _0x212a30={};_0x212a30[_0x1ad519]={'$like':'%'+_0x8d8914[_0xe3d7('0x38')][_0xe3d7('0x43')]+'%'};return _0x212a30;})});}_0x54822b=_[_0xe3d7('0x46')]({},_0x54822b,_0x8d8914[_0xe3d7('0x47')]);return db[_0xe3d7('0x6a')][_0xe3d7('0x87')](_0x54822b);}})[_0xe3d7('0x2d')](respondWithResult(_0x3eec94,null))['catch'](handleError(_0x3eec94,null));};exports[_0xe3d7('0x88')]=function(_0xa18fdc,_0x372190,_0x38166e){return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0xa18fdc['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x372190,null))[_0xe3d7('0x2d')](function(_0x52b213){if(_0x52b213){return _0x52b213[_0xe3d7('0x88')](_0xa18fdc[_0xe3d7('0x4f')][_0xe3d7('0x5d')],_[_0xe3d7('0x89')](_0xa18fdc['body'],[_0xe3d7('0x5d'),'id'])||{})[_0xe3d7('0x8a')](function(_0x4ad1ba){for(var _0x9765d9=0x0;_0x9765d9<_0xa18fdc[_0xe3d7('0x4f')][_0xe3d7('0x5d')][_0xe3d7('0x3e')];_0x9765d9+=0x1){socket[_0xe3d7('0x8b')]('userCmList:save',{'UserId':Number(_0xa18fdc[_0xe3d7('0x4f')][_0xe3d7('0x5d')][_0x9765d9]),'CmListId':Number(_0xa18fdc['params']['id'])});}return _0x4ad1ba;});}})[_0xe3d7('0x2d')](respondWithResult(_0x372190,null))[_0xe3d7('0x4a')](handleError(_0x372190,null));};exports['removeAgents']=function(_0x35c3b7,_0x5a0c8b,_0x1408ce){return db[_0xe3d7('0x33')][_0xe3d7('0x4d')]({'where':{'id':_0x35c3b7[_0xe3d7('0x4b')]['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x5a0c8b,null))[_0xe3d7('0x2d')](function(_0x2d4ca5){if(_0x2d4ca5){return _0x2d4ca5['removeAgents'](_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')])[_0xe3d7('0x2d')](function(){if(_[_0xe3d7('0x61')](_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')])){for(var _0x5db142=0x0;_0x5db142<_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')][_0xe3d7('0x3e')];_0x5db142+=0x1){socket[_0xe3d7('0x8b')](_0xe3d7('0x8c'),{'UserId':Number(_0x35c3b7[_0xe3d7('0x38')]['ids'][_0x5db142]),'CmListId':Number(_0x35c3b7[_0xe3d7('0x4b')]['id'])});}}else{socket[_0xe3d7('0x8b')](_0xe3d7('0x8c'),{'UserId':Number(_0x35c3b7[_0xe3d7('0x38')][_0xe3d7('0x5d')]),'CmListId':Number(_0x35c3b7[_0xe3d7('0x4b')]['id'])});}});}})[_0xe3d7('0x2d')](respondWithStatusCode(_0x5a0c8b,null))[_0xe3d7('0x4a')](handleError(_0x5a0c8b,null));};exports[_0xe3d7('0x8d')]=function(_0x33be45,_0x1f212f,_0x5e1a41){var _0x345881={};var _0xbc2457={};var _0x398f1c;var _0x1f62c5;return db['CmList'][_0xe3d7('0x58')]({'where':{'id':_0x33be45['params']['id']}})[_0xe3d7('0x2d')](handleEntityNotFound(_0x1f212f,null))['then'](function(_0x4c0e60){if(_0x4c0e60){_0x398f1c=_0x4c0e60;_0xbc2457['model']=_[_0xe3d7('0x39')](db['User'][_0xe3d7('0x34')]);_0xbc2457[_0xe3d7('0x38')]=_[_0xe3d7('0x39')](_0x33be45[_0xe3d7('0x38')]);_0xbc2457[_0xe3d7('0x3a')]=_['intersection'](_0xbc2457[_0xe3d7('0x37')],_0xbc2457['query']);_0x345881['attributes']=_['intersection'](_0xbc2457['model'],qs[_0xe3d7('0x3d')](_0x33be45[_0xe3d7('0x38')]['fields']));_0x345881[_0xe3d7('0x3c')]=_0x345881[_0xe3d7('0x3c')][_0xe3d7('0x3e')]?_0x345881[_0xe3d7('0x3c')]:_0xbc2457[_0xe3d7('0x37')];_0x345881[_0xe3d7('0x3f')]=qs[_0xe3d7('0x40')](_0x33be45[_0xe3d7('0x38')][_0xe3d7('0x40')]);_0x345881[_0xe3d7('0x41')]=qs['filters'](_['pick'](_0x33be45[_0xe3d7('0x38')],_0xbc2457[_0xe3d7('0x3a')]));if(_0x33be45[_0xe3d7('0x38')][_0xe3d7('0x43')]){_0x345881['where']=_[_0xe3d7('0x46')](_0x345881[_0xe3d7('0x41')],{'$or':_[_0xe3d7('0x32')](_0x345881[_0xe3d7('0x3c')],function(_0x1d31fa){var _0x36418a={};_0x36418a[_0x1d31fa]={'$like':'%'+_0x33be45['query'][_0xe3d7('0x43')]+'%'};return _0x36418a;})});}_0x345881=_[_0xe3d7('0x46')]({},_0x345881,_0x33be45[_0xe3d7('0x47')]);return _0x398f1c[_0xe3d7('0x8d')](_0x345881);}})[_0xe3d7('0x2d')](function(_0x46cd0d){if(_0x46cd0d){_0x1f62c5=_0x46cd0d['length'];if(!_0x33be45[_0xe3d7('0x38')]['hasOwnProperty'](_0xe3d7('0x6f'))){_0x345881[_0xe3d7('0x25')]=qs['limit'](_0x33be45[_0xe3d7('0x38')][_0xe3d7('0x25')]);_0x345881['offset']=qs[_0xe3d7('0x24')](_0x33be45[_0xe3d7('0x38')]['offset']);}return _0x398f1c['getAgents'](_0x345881);}})['then'](function(_0x1bf97e){if(_0x1bf97e){return _0x1bf97e?{'count':_0x1f62c5,'rows':_0x1bf97e}:null;}})[_0xe3d7('0x2d')](respondWithResult(_0x1f212f,null))[_0xe3d7('0x4a')](handleError(_0x1f212f,null));}; \ No newline at end of file +var _0x0b85=['download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','BOOLEAN','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','then','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','user','Lists','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','keys','nolimit','addContacts','CmContact','tags','isArray','join','push','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv'];(function(_0xe46f8a,_0x4742a6){var _0x398dbe=function(_0x28e670){while(--_0x28e670){_0xe46f8a['push'](_0xe46f8a['shift']());}};_0x398dbe(++_0x4742a6);}(_0x0b85,0xa4));var _0x50b8=function(_0xfe8756,_0x64c7a4){_0xfe8756=_0xfe8756-0x0;var _0x4dd5a4=_0x0b85[_0xfe8756];return _0x4dd5a4;};'use strict';var emlformat=require(_0x50b8('0x0'));var rimraf=require(_0x50b8('0x1'));var zipdir=require(_0x50b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x50b8('0x3'));var BPromise=require(_0x50b8('0x4'));var Mustache=require('mustache');var util=require(_0x50b8('0x5'));var path=require(_0x50b8('0x6'));var sox=require(_0x50b8('0x7'));var csv=require('to-csv');var ejs=require(_0x50b8('0x8'));var fs=require('fs');var fs_extra=require(_0x50b8('0x9'));var _=require(_0x50b8('0xa'));var squel=require('squel');var crypto=require(_0x50b8('0xb'));var jsforce=require(_0x50b8('0xc'));var deskjs=require(_0x50b8('0xd'));var toCsv=require(_0x50b8('0xe'));var querystring=require('querystring');var Papa=require(_0x50b8('0xf'));var Redis=require(_0x50b8('0x10'));var authService=require(_0x50b8('0x11'));var qs=require(_0x50b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x50b8('0x13'));var utils=require('../../config/utils');var config=require(_0x50b8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x50b8('0x15')]=_[_0x50b8('0x16')](config['redis'],{'host':_0x50b8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50b8('0x15')]));require(_0x50b8('0x18'))['register'](socket);function respondWithStatusCode(_0x2c14e4,_0x1222b5){_0x1222b5=_0x1222b5||0xcc;return function(_0x40b617){if(_0x40b617){return _0x2c14e4[_0x50b8('0x19')](_0x1222b5);}return _0x2c14e4[_0x50b8('0x1a')](_0x1222b5)[_0x50b8('0x1b')]();};}function respondWithResult(_0x22c082,_0x443ea8){_0x443ea8=_0x443ea8||0xc8;return function(_0x4b63bc){if(_0x4b63bc){return _0x22c082[_0x50b8('0x1a')](_0x443ea8)[_0x50b8('0x1c')](_0x4b63bc);}};}function respondWithFilteredResult(_0x144735,_0x3227c0){return function(_0x6fb338){if(_0x6fb338){var _0x2a58f8=typeof _0x3227c0[_0x50b8('0x1d')]===_0x50b8('0x1e')&&typeof _0x3227c0[_0x50b8('0x1f')]===_0x50b8('0x1e');var _0x5d1759=_0x6fb338[_0x50b8('0x20')];var _0x6ed8bf=_0x2a58f8?0x0:_0x3227c0[_0x50b8('0x1d')];var _0x1b0497=_0x2a58f8?_0x6fb338[_0x50b8('0x20')]:_0x3227c0[_0x50b8('0x1d')]+_0x3227c0[_0x50b8('0x1f')];var _0x2a29f1;if(_0x1b0497>=_0x5d1759){_0x1b0497=_0x5d1759;_0x2a29f1=0xc8;}else{_0x2a29f1=0xce;}_0x144735[_0x50b8('0x1a')](_0x2a29f1);return _0x144735[_0x50b8('0x21')](_0x50b8('0x22'),_0x6ed8bf+'-'+_0x1b0497+'/'+_0x5d1759)[_0x50b8('0x1c')](_0x6fb338);}return null;};}function patchUpdates(_0x40b8c2){return function(_0x22d5b9){try{jsonpatch['apply'](_0x22d5b9,_0x40b8c2,!![]);}catch(_0xfea9e1){return BPromise[_0x50b8('0x23')](_0xfea9e1);}return _0x22d5b9[_0x50b8('0x24')]();};}function saveUpdates(_0x189fc7,_0x27ee90){return function(_0x48c5de){if(_0x48c5de){return _0x48c5de['update'](_0x189fc7)['then'](function(_0x41fe69){return _0x41fe69;});}return null;};}function removeEntity(_0x4a672c,_0x23483b){return function(_0x59ef6d){if(_0x59ef6d){return _0x59ef6d[_0x50b8('0x25')]()['then'](function(){var _0x2b4fa0=_0x59ef6d[_0x50b8('0x26')]({'plain':!![]});var _0x208df4='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x208df4,'resourceId':_0x2b4fa0['id']}})[_0x50b8('0x27')](function(){return _0x59ef6d;});})[_0x50b8('0x27')](function(){_0x4a672c['status'](0xcc)[_0x50b8('0x1b')]();});}};}function handleEntityNotFound(_0x66ccc1,_0x4a455b){return function(_0x1ad4a1){if(!_0x1ad4a1){_0x66ccc1[_0x50b8('0x19')](0x194);}return _0x1ad4a1;};}function handleError(_0x44de4b,_0x29c269){_0x29c269=_0x29c269||0x1f4;return function(_0x541372){logger['error'](_0x541372[_0x50b8('0x28')]);if(_0x541372[_0x50b8('0x29')]){delete _0x541372[_0x50b8('0x29')];}_0x44de4b['status'](_0x29c269)[_0x50b8('0x2a')](_0x541372);};}exports[_0x50b8('0x2b')]=function(_0x55b5bd,_0x1ed7e8){var _0x2e3394={},_0x1aa879={},_0x4ff8a2={'count':0x0,'rows':[]};var _0x4bba6e=_[_0x50b8('0x2c')](db[_0x50b8('0x2d')][_0x50b8('0x2e')],function(_0x1157e3){return{'name':_0x1157e3[_0x50b8('0x2f')],'type':_0x1157e3[_0x50b8('0x30')]['key']};});_0x1aa879['model']=_[_0x50b8('0x2c')](_0x4bba6e,'name');_0x1aa879[_0x50b8('0x31')]=_['keys'](_0x55b5bd[_0x50b8('0x31')]);_0x1aa879[_0x50b8('0x32')]=_[_0x50b8('0x33')](_0x1aa879[_0x50b8('0x34')],_0x1aa879[_0x50b8('0x31')]);_0x2e3394[_0x50b8('0x35')]=_[_0x50b8('0x33')](_0x1aa879[_0x50b8('0x34')],qs['fields'](_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x36')]));_0x2e3394[_0x50b8('0x35')]=_0x2e3394[_0x50b8('0x35')][_0x50b8('0x37')]?_0x2e3394[_0x50b8('0x35')]:_0x1aa879[_0x50b8('0x34')];if(!_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x38')]('nolimit')){_0x2e3394[_0x50b8('0x1f')]=qs[_0x50b8('0x1f')](_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x1f')]);_0x2e3394[_0x50b8('0x1d')]=qs[_0x50b8('0x1d')](_0x55b5bd[_0x50b8('0x31')]['offset']);}_0x2e3394[_0x50b8('0x39')]=qs[_0x50b8('0x3a')](_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x3a')]);_0x2e3394['where']=qs['filters'](_[_0x50b8('0x3b')](_0x55b5bd[_0x50b8('0x31')],_0x1aa879[_0x50b8('0x32')]),_0x4bba6e);if(_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x3c')]){_0x2e3394[_0x50b8('0x3d')]=_[_0x50b8('0x3e')](_0x2e3394[_0x50b8('0x3d')],{'$or':_['map'](_0x4bba6e,function(_0x1386f5){if(_0x1386f5[_0x50b8('0x30')]!==_0x50b8('0x3f')){var _0x139749={};_0x139749[_0x1386f5[_0x50b8('0x29')]]={'$like':'%'+_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x3c')]+'%'};return _0x139749;}})});}_0x2e3394=_[_0x50b8('0x3e')]({},_0x2e3394,_0x55b5bd[_0x50b8('0x40')]);var _0x368e09={'where':_0x2e3394[_0x50b8('0x3d')]};return db[_0x50b8('0x2d')][_0x50b8('0x20')](_0x368e09)[_0x50b8('0x27')](function(_0x5dae77){_0x4ff8a2['count']=_0x5dae77;if(_0x55b5bd[_0x50b8('0x31')][_0x50b8('0x41')]){_0x2e3394[_0x50b8('0x42')]=[{'all':!![]}];}return db['CmList'][_0x50b8('0x43')](_0x2e3394);})['then'](function(_0x44fe3f){_0x4ff8a2[_0x50b8('0x44')]=_0x44fe3f;return _0x4ff8a2;})[_0x50b8('0x27')](respondWithFilteredResult(_0x1ed7e8,_0x2e3394))[_0x50b8('0x45')](handleError(_0x1ed7e8,null));};exports[_0x50b8('0x46')]=function(_0x477713,_0x5559cd){var _0x25de27={'raw':![],'where':{'id':_0x477713['params']['id']}},_0x5025a={};_0x5025a[_0x50b8('0x34')]=_['keys'](db['CmList'][_0x50b8('0x2e')]);_0x5025a[_0x50b8('0x31')]=_['keys'](_0x477713[_0x50b8('0x31')]);_0x5025a[_0x50b8('0x32')]=_[_0x50b8('0x33')](_0x5025a[_0x50b8('0x34')],_0x5025a[_0x50b8('0x31')]);_0x25de27['attributes']=_['intersection'](_0x5025a[_0x50b8('0x34')],qs[_0x50b8('0x36')](_0x477713[_0x50b8('0x31')][_0x50b8('0x36')]));_0x25de27[_0x50b8('0x35')]=_0x25de27[_0x50b8('0x35')][_0x50b8('0x37')]?_0x25de27[_0x50b8('0x35')]:_0x5025a['model'];if(_0x477713['query']['includeAll']){_0x25de27[_0x50b8('0x42')]=[{'all':!![]}];}_0x25de27=_[_0x50b8('0x3e')]({},_0x25de27,_0x477713[_0x50b8('0x40')]);return db[_0x50b8('0x2d')]['find'](_0x25de27)[_0x50b8('0x27')](handleEntityNotFound(_0x5559cd,null))[_0x50b8('0x27')](respondWithResult(_0x5559cd,null))[_0x50b8('0x45')](handleError(_0x5559cd,null));};exports[_0x50b8('0x47')]=function(_0x30e736,_0x16c7fd){return db['CmList']['create'](_0x30e736['body'],{})[_0x50b8('0x27')](function(_0x32ffbc){var _0x56a3c6=_0x30e736['user'][_0x50b8('0x26')]({'plain':!![]});if(!_0x56a3c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56a3c6['role']===_0x50b8('0x48')){var _0xb4ca5d=_0x32ffbc[_0x50b8('0x26')]({'plain':!![]});var _0x266b3a=_0x50b8('0x49');return db[_0x50b8('0x4a')][_0x50b8('0x4b')]({'where':{'name':_0x266b3a,'userProfileId':_0x56a3c6[_0x50b8('0x4c')]},'raw':!![]})['then'](function(_0x3858a9){if(_0x3858a9&&_0x3858a9[_0x50b8('0x4d')]===0x0){return db[_0x50b8('0x4e')]['create']({'name':_0xb4ca5d['name'],'resourceId':_0xb4ca5d['id'],'type':_0x3858a9['name'],'sectionId':_0x3858a9['id']},{})[_0x50b8('0x27')](function(){return _0x32ffbc;});}else{return _0x32ffbc;}})['catch'](function(_0x4a62fb){logger[_0x50b8('0x4f')](_0x50b8('0x50'),_0x4a62fb);throw _0x4a62fb;});}return _0x32ffbc;})[_0x50b8('0x27')](respondWithResult(_0x16c7fd,0xc9))['catch'](handleError(_0x16c7fd,null));};exports[_0x50b8('0x51')]=function(_0x36eaff,_0x33f5bf){if(_0x36eaff[_0x50b8('0x52')]['id']){delete _0x36eaff[_0x50b8('0x52')]['id'];}return db['CmList'][_0x50b8('0x4b')]({'where':{'id':_0x36eaff[_0x50b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x33f5bf,null))[_0x50b8('0x27')](saveUpdates(_0x36eaff[_0x50b8('0x52')],null))[_0x50b8('0x27')](respondWithResult(_0x33f5bf,null))[_0x50b8('0x45')](handleError(_0x33f5bf,null));};exports[_0x50b8('0x25')]=function(_0x490993,_0x34ded5){return db['CmList']['find']({'where':{'id':_0x490993[_0x50b8('0x53')]['id']}})[_0x50b8('0x27')](handleEntityNotFound(_0x34ded5,null))['then'](removeEntity(_0x34ded5,null))[_0x50b8('0x45')](handleError(_0x34ded5,null));};exports[_0x50b8('0x54')]=function(_0x58bb95,_0x4a0dd3){return db['CmList']['describe']()[_0x50b8('0x27')](respondWithResult(_0x4a0dd3,null))['catch'](handleError(_0x4a0dd3,null));};exports[_0x50b8('0x55')]=function(_0x1d688e,_0x366495,_0x226dc5){if(_0x1d688e[_0x50b8('0x52')]['id']){delete _0x1d688e[_0x50b8('0x52')]['id'];}return db['CmList']['find']({'where':{'id':_0x1d688e['params']['id']}})[_0x50b8('0x27')](handleEntityNotFound(_0x366495,null))[_0x50b8('0x27')](function(_0x475b4a){if(_0x475b4a){_0x1d688e[_0x50b8('0x52')][_0x50b8('0x56')]=_0x475b4a['id'];return db[_0x50b8('0x57')][_0x50b8('0x47')](_0x1d688e[_0x50b8('0x52')]);}})[_0x50b8('0x27')](respondWithResult(_0x366495,null))[_0x50b8('0x45')](handleError(_0x366495,null));};exports[_0x50b8('0x58')]=function(_0x35958f,_0x1a3f9e,_0x5c28e7){var _0x58dcd6={'raw':![],'where':{}};var _0x2746fb={};var _0x6eaa89={'count':0x0,'rows':[]};return db[_0x50b8('0x2d')][_0x50b8('0x59')]({'where':{'id':_0x35958f[_0x50b8('0x53')]['id']}})[_0x50b8('0x27')](handleEntityNotFound(_0x1a3f9e,null))[_0x50b8('0x27')](function(_0x56d553){if(_0x56d553){_0x2746fb['model']=_['keys'](db[_0x50b8('0x57')][_0x50b8('0x2e')]);_0x2746fb[_0x50b8('0x31')]=_[_0x50b8('0x5a')](_0x35958f['query']);_0x2746fb[_0x50b8('0x32')]=_[_0x50b8('0x33')](_0x2746fb[_0x50b8('0x34')],_0x2746fb[_0x50b8('0x31')]);_0x58dcd6[_0x50b8('0x35')]=_[_0x50b8('0x33')](_0x2746fb[_0x50b8('0x34')],qs[_0x50b8('0x36')](_0x35958f[_0x50b8('0x31')]['fields']));_0x58dcd6[_0x50b8('0x35')]=_0x58dcd6[_0x50b8('0x35')][_0x50b8('0x37')]?_0x58dcd6[_0x50b8('0x35')]:_0x2746fb[_0x50b8('0x34')];if(!_0x35958f[_0x50b8('0x31')][_0x50b8('0x38')](_0x50b8('0x5b'))){_0x58dcd6['limit']=qs[_0x50b8('0x1f')](_0x35958f[_0x50b8('0x31')]['limit']);_0x58dcd6[_0x50b8('0x1d')]=qs[_0x50b8('0x1d')](_0x35958f[_0x50b8('0x31')][_0x50b8('0x1d')]);}_0x58dcd6[_0x50b8('0x39')]=qs[_0x50b8('0x3a')](_0x35958f[_0x50b8('0x31')][_0x50b8('0x3a')]);_0x58dcd6[_0x50b8('0x3d')]=qs[_0x50b8('0x32')](_['pick'](_0x35958f[_0x50b8('0x31')],_0x2746fb[_0x50b8('0x32')]));_0x58dcd6[_0x50b8('0x3d')][_0x50b8('0x56')]=_0x56d553['id'];if(_0x35958f[_0x50b8('0x31')][_0x50b8('0x3c')]){_0x58dcd6[_0x50b8('0x3d')]=_[_0x50b8('0x3e')](_0x58dcd6[_0x50b8('0x3d')],{'$or':_[_0x50b8('0x2c')](_0x58dcd6[_0x50b8('0x35')],function(_0x276e55){var _0x4a5ce5={};_0x4a5ce5[_0x276e55]={'$like':'%'+_0x35958f[_0x50b8('0x31')][_0x50b8('0x3c')]+'%'};return _0x4a5ce5;})});}_0x58dcd6=_['merge']({},_0x58dcd6,_0x35958f[_0x50b8('0x40')]);return db[_0x50b8('0x57')][_0x50b8('0x20')]({'where':_0x58dcd6['where']})[_0x50b8('0x27')](function(_0x363487){_0x6eaa89[_0x50b8('0x20')]=_0x363487;if(_0x35958f[_0x50b8('0x31')][_0x50b8('0x41')]){_0x58dcd6['include']=[{'all':!![]}];}return db[_0x50b8('0x57')][_0x50b8('0x43')](_0x58dcd6);})['then'](function(_0xd880bc){_0x6eaa89[_0x50b8('0x44')]=_0xd880bc;return _0x6eaa89;});}})[_0x50b8('0x27')](respondWithFilteredResult(_0x1a3f9e,_0x58dcd6))[_0x50b8('0x45')](handleError(_0x1a3f9e,null));};exports['removeDispositions']=function(_0x3ac38f,_0x34c3be,_0x35db0f){return db[_0x50b8('0x2d')][_0x50b8('0x4b')]({'where':{'id':_0x3ac38f[_0x50b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x34c3be,null))[_0x50b8('0x27')](function(_0xc49cf2){if(_0xc49cf2){return _0xc49cf2['removeDispositions'](_0x3ac38f['query']['ids']);}})[_0x50b8('0x27')](respondWithStatusCode(_0x34c3be,null))[_0x50b8('0x45')](handleError(_0x34c3be,null));};exports[_0x50b8('0x5c')]=function(_0x24d3c3,_0xcd8e18,_0x387d5a){return db[_0x50b8('0x2d')][_0x50b8('0x4b')]({'where':{'id':_0x24d3c3[_0x50b8('0x53')]['id']}})['then'](handleEntityNotFound(_0xcd8e18,null))[_0x50b8('0x27')](function(_0x4aedba){if(_0x4aedba){var _0x3e9dbc=[];var _0x57a80a={'success':[],'errors':[]};return db[_0x50b8('0x5d')][_0x50b8('0x54')]()[_0x50b8('0x27')](function(_0x4b43ec){if(_0x24d3c3['body'][_0x50b8('0x5e')]&&_[_0x50b8('0x5f')](_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x5e')])){if(_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x5e')][_0x50b8('0x37')]){_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x5e')]=_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x5e')][_0x50b8('0x60')](';')+';';}else{_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x5e')]=null;}}else{_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x5e')]=null;}if(_0x24d3c3[_0x50b8('0x52')]&&_[_0x50b8('0x5f')](_0x24d3c3[_0x50b8('0x52')])){for(var _0x26f79a=0x0;_0x26f79a<_0x24d3c3[_0x50b8('0x52')][_0x50b8('0x37')];_0x26f79a+=0x1){_0x24d3c3[_0x50b8('0x52')][_0x26f79a]['ListId']=_0x24d3c3['params']['id'];_0x3e9dbc[_0x50b8('0x61')](_0x24d3c3[_0x50b8('0x52')][_0x26f79a]);}return BPromise['each'](_0x3e9dbc,function(_0x84da78){return db[_0x50b8('0x5d')][_0x50b8('0x47')](_[_0x50b8('0x62')](_0x84da78,[_0x50b8('0x63'),'id'])||{},{'fields':_[_0x50b8('0x5a')](_0x4b43ec),'raw':!![]})['then'](function(_0x34f06e){_0x57a80a[_0x50b8('0x64')][_0x50b8('0x61')](_0x34f06e[_0x50b8('0x65')]);})[_0x50b8('0x45')](function(_0x2c84e5){_0x57a80a['errors'][_0x50b8('0x61')]({'data':_0x84da78,'error':_0x2c84e5[_0x50b8('0x66')]});});})[_0x50b8('0x27')](function(_0x41fdc6){return _0x57a80a;})['catch'](function(_0x2facb8){return _0x2facb8;});}else{_0xcd8e18['status'](0x190)['json']({'message':_0x50b8('0x67')});}});}})[_0x50b8('0x27')](respondWithResult(_0xcd8e18,null))['catch'](handleError(_0xcd8e18,null));};exports[_0x50b8('0x68')]=function(_0x19fe20,_0x3e80b5,_0x5e9b12){var _0x2e4b7f;return db[_0x50b8('0x2d')]['find']({'where':{'id':_0x19fe20[_0x50b8('0x53')]['id']},'include':[{'model':db[_0x50b8('0x69')],'as':_0x50b8('0x6a')}]})[_0x50b8('0x27')](handleEntityNotFound(_0x3e80b5,null))[_0x50b8('0x27')](function(_0xd76149){if(_0xd76149){_0x2e4b7f=_0xd76149;return db[_0x50b8('0x5d')][_0x50b8('0x2e')];}})[_0x50b8('0x27')](function(_0x28612e){if(_0x28612e){var _0xb96f89={};var _0x52b0fe={};_0x52b0fe['model']=_[_0x50b8('0x6b')](_['keys'](_0x28612e),_[_0x50b8('0x2c')](_0x2e4b7f[_0x50b8('0x6a')],function(_0x49af7c){return util['format'](_0x50b8('0x6c'),_0x49af7c['id']);}));_0x52b0fe[_0x50b8('0x31')]=_[_0x50b8('0x5a')](_0x19fe20[_0x50b8('0x31')]);_0x52b0fe[_0x50b8('0x32')]=_['intersection'](_0x52b0fe[_0x50b8('0x34')],_0x52b0fe[_0x50b8('0x31')]);_0xb96f89[_0x50b8('0x35')]=_['intersection'](_0x52b0fe['model'],qs[_0x50b8('0x36')](_0x19fe20[_0x50b8('0x31')]['fields']));_0xb96f89[_0x50b8('0x35')]=_0xb96f89[_0x50b8('0x35')][_0x50b8('0x37')]?_0xb96f89[_0x50b8('0x35')]:_0x52b0fe[_0x50b8('0x34')];if(!_0x19fe20[_0x50b8('0x31')]['hasOwnProperty'](_0x50b8('0x5b'))){_0xb96f89['limit']=qs['limit'](_0x19fe20['query'][_0x50b8('0x1f')]);_0xb96f89[_0x50b8('0x1d')]=qs[_0x50b8('0x1d')](_0x19fe20[_0x50b8('0x31')]['offset']);}_0xb96f89[_0x50b8('0x39')]=qs[_0x50b8('0x3a')](_0x19fe20[_0x50b8('0x31')]['sort']);_0xb96f89[_0x50b8('0x3d')]=qs['filters'](_[_0x50b8('0x3b')](_0x19fe20[_0x50b8('0x31')],_0x52b0fe[_0x50b8('0x32')]));_0xb96f89[_0x50b8('0x6d')]=!![];if(_0x19fe20[_0x50b8('0x31')][_0x50b8('0x3c')]){_0xb96f89[_0x50b8('0x3d')]=_[_0x50b8('0x3e')](_0xb96f89[_0x50b8('0x3d')],{'$or':_[_0x50b8('0x2c')](_0xb96f89[_0x50b8('0x35')],function(_0x471f97){var _0x14fa02={};_0x14fa02[_0x471f97]={'$like':'%'+_0x19fe20[_0x50b8('0x31')][_0x50b8('0x3c')]+'%'};return _0x14fa02;})});}_0xb96f89=_[_0x50b8('0x3e')]({},_0xb96f89,_0x19fe20[_0x50b8('0x40')]);return _0x2e4b7f['getContacts'](_0xb96f89);}})[_0x50b8('0x27')](respondWithResult(_0x3e80b5,null))['catch'](handleError(_0x3e80b5,null));};exports[_0x50b8('0x6e')]=function(_0x2aa0b4,_0x1a418f,_0x53bd5d){var _0x14705e;return db[_0x50b8('0x2d')][_0x50b8('0x4b')]({'where':{'id':_0x2aa0b4[_0x50b8('0x53')]['id']},'include':[{'model':db[_0x50b8('0x69')],'as':_0x50b8('0x6a')}]})[_0x50b8('0x27')](handleEntityNotFound(_0x1a418f,null))['then'](function(_0x2113a1){if(_0x2113a1){_0x14705e=_0x2113a1;return db['CmContact'][_0x50b8('0x2e')];}})['then'](function(_0x59213f){if(_0x59213f){var _0x31ea6c={};var _0x458ba1={};_0x458ba1[_0x50b8('0x34')]=_[_0x50b8('0x6b')](_['keys'](_0x59213f),_['map'](_0x14705e[_0x50b8('0x6a')],function(_0x31e3c1){return util[_0x50b8('0x6f')](_0x50b8('0x6c'),_0x31e3c1['id']);}));_0x458ba1[_0x50b8('0x31')]=_[_0x50b8('0x5a')](_0x2aa0b4[_0x50b8('0x31')]);_0x458ba1['filters']=_['intersection'](_0x458ba1[_0x50b8('0x34')],_0x458ba1[_0x50b8('0x31')]);_0x31ea6c[_0x50b8('0x35')]=_[_0x50b8('0x33')](_0x458ba1[_0x50b8('0x34')],qs[_0x50b8('0x36')](_0x2aa0b4[_0x50b8('0x31')][_0x50b8('0x36')]));_0x31ea6c[_0x50b8('0x35')]=_0x31ea6c[_0x50b8('0x35')]['length']?_0x31ea6c[_0x50b8('0x35')]:_0x458ba1[_0x50b8('0x34')];if(!_0x2aa0b4['query'][_0x50b8('0x38')](_0x50b8('0x5b'))){_0x31ea6c[_0x50b8('0x1f')]=qs['limit'](_0x2aa0b4[_0x50b8('0x31')][_0x50b8('0x1f')]);_0x31ea6c[_0x50b8('0x1d')]=qs[_0x50b8('0x1d')](_0x2aa0b4['query'][_0x50b8('0x1d')]);}_0x31ea6c['order']=qs[_0x50b8('0x3a')](_0x2aa0b4[_0x50b8('0x31')][_0x50b8('0x3a')]);_0x31ea6c[_0x50b8('0x3d')]=qs[_0x50b8('0x32')](_['pick'](_0x2aa0b4[_0x50b8('0x31')],_0x458ba1['filters']));_0x31ea6c[_0x50b8('0x6d')]=!![];if(_0x2aa0b4['query']['filter']){_0x31ea6c[_0x50b8('0x3d')]=_[_0x50b8('0x3e')](_0x31ea6c[_0x50b8('0x3d')],{'$or':_[_0x50b8('0x2c')](_0x31ea6c[_0x50b8('0x35')],function(_0x433708){var _0x5d3945={};_0x5d3945[_0x433708]={'$like':'%'+_0x2aa0b4[_0x50b8('0x31')][_0x50b8('0x3c')]+'%'};return _0x5d3945;})});}_0x31ea6c=_[_0x50b8('0x3e')]({},_0x31ea6c,_0x2aa0b4[_0x50b8('0x40')]);return _0x14705e['getContacts'](_0x31ea6c);}})[_0x50b8('0x27')](function(_0x47cb8c){if(!_[_0x50b8('0x70')](_0x47cb8c)){var _0x33e530=toCsv(_0x47cb8c);var _0xe67a28=Date[_0x50b8('0x71')]();fs['writeFileSync'](util[_0x50b8('0x6f')]('/tmp/list_%d_%s.csv',_0x14705e['id'],_0xe67a28),_0x33e530);_0x1a418f[_0x50b8('0x72')](_0x50b8('0x73'),_0x50b8('0x74')+util[_0x50b8('0x6f')](_0x50b8('0x75'),_0x14705e['id'],_0xe67a28));_0x1a418f[_0x50b8('0x72')](_0x50b8('0x76'),_0x50b8('0x77'));return _0x1a418f[_0x50b8('0x78')](util[_0x50b8('0x6f')](_0x50b8('0x79'),_0x14705e['id'],_0xe67a28));}else{return _0x1a418f['sendStatus'](0xcc);}})['catch'](handleError(_0x1a418f,null));};exports[_0x50b8('0x7a')]=function(_0x1578ae,_0x4e842a,_0xd2949c){var _0x24b248;delete _0x1578ae[_0x50b8('0x52')]['id'];return db['CmList'][_0x50b8('0x59')]({'where':{'id':_0x1578ae[_0x50b8('0x53')]['id']}})[_0x50b8('0x27')](handleEntityNotFound(_0x4e842a,null))[_0x50b8('0x27')](function(_0x17d27f){if(_0x17d27f){return db[_0x50b8('0x7b')][_0x50b8('0x7c')](function(_0x26f6db){return db[_0x50b8('0x69')][_0x50b8('0x47')](_0x1578ae[_0x50b8('0x52')],{'transaction':_0x26f6db})[_0x50b8('0x27')](function(_0x320523){_0x24b248=_0x320523;return _0x17d27f['addCustomFields'](_0x320523,{'transaction':_0x26f6db});})[_0x50b8('0x27')](function(){var _0xa49054={'type':db[_0x50b8('0x7d')][_0x50b8('0x7e')],'transaction':_0x26f6db};switch(_0x1578ae['body'][_0x50b8('0x30')]){case _0x50b8('0x7f'):_0xa49054[_0x50b8('0x30')]=db['Sequelize'][_0x50b8('0x7e')];break;case _0x50b8('0x80'):_0xa49054[_0x50b8('0x30')]=db[_0x50b8('0x7d')]['INTEGER'];break;case'switch':_0xa49054['type']=db[_0x50b8('0x7d')][_0x50b8('0x81')];_0xa49054['defaultValue']=![];break;default:}return db['sequelize'][_0x50b8('0x82')]['addColumn'](_0x50b8('0x83'),util[_0x50b8('0x6f')](_0x50b8('0x84'),_0x24b248['id']),_0xa49054);})[_0x50b8('0x27')](function(){return _0x24b248;});});}})[_0x50b8('0x27')](respondWithResult(_0x4e842a,null))[_0x50b8('0x45')](handleError(_0x4e842a,null));};exports[_0x50b8('0x85')]=function(_0x9a89a4,_0xe5deb,_0x804b18){var _0x22612e={};var _0x5e52c2={};var _0x3c58cb;var _0x332293;return db['CmList'][_0x50b8('0x59')]({'where':{'id':_0x9a89a4[_0x50b8('0x53')]['id']}})[_0x50b8('0x27')](handleEntityNotFound(_0xe5deb,null))[_0x50b8('0x27')](function(_0x5eeb66){if(_0x5eeb66){_0x3c58cb=_0x5eeb66;_0x5e52c2[_0x50b8('0x34')]=_[_0x50b8('0x5a')](db[_0x50b8('0x69')][_0x50b8('0x2e')]);_0x5e52c2[_0x50b8('0x31')]=_[_0x50b8('0x5a')](_0x9a89a4[_0x50b8('0x31')]);_0x5e52c2[_0x50b8('0x32')]=_[_0x50b8('0x33')](_0x5e52c2[_0x50b8('0x34')],_0x5e52c2[_0x50b8('0x31')]);_0x22612e['attributes']=_[_0x50b8('0x33')](_0x5e52c2[_0x50b8('0x34')],qs['fields'](_0x9a89a4[_0x50b8('0x31')]['fields']));_0x22612e['attributes']=_0x22612e[_0x50b8('0x35')][_0x50b8('0x37')]?_0x22612e[_0x50b8('0x35')]:_0x5e52c2[_0x50b8('0x34')];_0x22612e[_0x50b8('0x39')]=qs[_0x50b8('0x3a')](_0x9a89a4['query'][_0x50b8('0x3a')]);_0x22612e[_0x50b8('0x3d')]=qs[_0x50b8('0x32')](_[_0x50b8('0x3b')](_0x9a89a4[_0x50b8('0x31')],_0x5e52c2['filters']));_0x22612e['where']=_[_0x50b8('0x3e')](_0x22612e['where'],{'$or':[{'ListId':_0x5eeb66['id']},{'ListId':null}]});if(_0x9a89a4[_0x50b8('0x31')]['filter']){_0x22612e[_0x50b8('0x3d')]=_[_0x50b8('0x3e')](_0x22612e[_0x50b8('0x3d')],{'$or':_[_0x50b8('0x2c')](_0x22612e['attributes'],function(_0x3a7fa4){var _0xa1fba={};_0xa1fba[_0x3a7fa4]={'$like':'%'+_0x9a89a4['query'][_0x50b8('0x3c')]+'%'};return _0xa1fba;})});}_0x22612e=_[_0x50b8('0x3e')]({},_0x22612e,_0x9a89a4['options']);return db[_0x50b8('0x69')][_0x50b8('0x86')](_0x22612e);}})['then'](respondWithResult(_0xe5deb,null))[_0x50b8('0x45')](handleError(_0xe5deb,null));};exports['addAgents']=function(_0x283e10,_0x1f0e81,_0x2cb187){return db[_0x50b8('0x2d')]['find']({'where':{'id':_0x283e10[_0x50b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f0e81,null))[_0x50b8('0x27')](function(_0x5e433d){if(_0x5e433d){return _0x5e433d['addAgents'](_0x283e10[_0x50b8('0x52')][_0x50b8('0x63')],_[_0x50b8('0x62')](_0x283e10[_0x50b8('0x52')],[_0x50b8('0x63'),'id'])||{})[_0x50b8('0x87')](function(_0x343fc8){for(var _0x58d87c=0x0;_0x58d87c<_0x283e10[_0x50b8('0x52')][_0x50b8('0x63')][_0x50b8('0x37')];_0x58d87c+=0x1){socket[_0x50b8('0x88')](_0x50b8('0x89'),{'UserId':Number(_0x283e10[_0x50b8('0x52')]['ids'][_0x58d87c]),'CmListId':Number(_0x283e10[_0x50b8('0x53')]['id'])});}return _0x343fc8;});}})[_0x50b8('0x27')](respondWithResult(_0x1f0e81,null))[_0x50b8('0x45')](handleError(_0x1f0e81,null));};exports[_0x50b8('0x8a')]=function(_0x270a83,_0x41da18,_0x36d393){return db[_0x50b8('0x2d')]['find']({'where':{'id':_0x270a83[_0x50b8('0x53')]['id']}})[_0x50b8('0x27')](handleEntityNotFound(_0x41da18,null))['then'](function(_0x1227ac){if(_0x1227ac){return _0x1227ac[_0x50b8('0x8a')](_0x270a83['query'][_0x50b8('0x63')])[_0x50b8('0x27')](function(){if(_['isArray'](_0x270a83[_0x50b8('0x31')][_0x50b8('0x63')])){for(var _0x28660f=0x0;_0x28660f<_0x270a83[_0x50b8('0x31')]['ids']['length'];_0x28660f+=0x1){socket['emit'](_0x50b8('0x8b'),{'UserId':Number(_0x270a83[_0x50b8('0x31')][_0x50b8('0x63')][_0x28660f]),'CmListId':Number(_0x270a83[_0x50b8('0x53')]['id'])});}}else{socket[_0x50b8('0x88')](_0x50b8('0x8b'),{'UserId':Number(_0x270a83[_0x50b8('0x31')][_0x50b8('0x63')]),'CmListId':Number(_0x270a83[_0x50b8('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x41da18,null))['catch'](handleError(_0x41da18,null));};exports[_0x50b8('0x8c')]=function(_0x37edfa,_0x5d6a5e,_0x3f4eee){var _0x308033={};var _0x213f3e={};var _0x44724b;var _0x11c4b3;return db[_0x50b8('0x2d')][_0x50b8('0x59')]({'where':{'id':_0x37edfa[_0x50b8('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d6a5e,null))['then'](function(_0x4eed67){if(_0x4eed67){_0x44724b=_0x4eed67;_0x213f3e[_0x50b8('0x34')]=_[_0x50b8('0x5a')](db[_0x50b8('0x8d')]['rawAttributes']);_0x213f3e[_0x50b8('0x31')]=_[_0x50b8('0x5a')](_0x37edfa[_0x50b8('0x31')]);_0x213f3e[_0x50b8('0x32')]=_['intersection'](_0x213f3e['model'],_0x213f3e[_0x50b8('0x31')]);_0x308033['attributes']=_['intersection'](_0x213f3e[_0x50b8('0x34')],qs[_0x50b8('0x36')](_0x37edfa[_0x50b8('0x31')]['fields']));_0x308033[_0x50b8('0x35')]=_0x308033[_0x50b8('0x35')][_0x50b8('0x37')]?_0x308033[_0x50b8('0x35')]:_0x213f3e['model'];_0x308033[_0x50b8('0x39')]=qs[_0x50b8('0x3a')](_0x37edfa['query']['sort']);_0x308033[_0x50b8('0x3d')]=qs[_0x50b8('0x32')](_[_0x50b8('0x3b')](_0x37edfa[_0x50b8('0x31')],_0x213f3e['filters']));if(_0x37edfa[_0x50b8('0x31')]['filter']){_0x308033[_0x50b8('0x3d')]=_[_0x50b8('0x3e')](_0x308033[_0x50b8('0x3d')],{'$or':_['map'](_0x308033[_0x50b8('0x35')],function(_0x33df20){var _0x1925f6={};_0x1925f6[_0x33df20]={'$like':'%'+_0x37edfa['query'][_0x50b8('0x3c')]+'%'};return _0x1925f6;})});}_0x308033=_[_0x50b8('0x3e')]({},_0x308033,_0x37edfa[_0x50b8('0x40')]);return _0x44724b['getAgents'](_0x308033);}})[_0x50b8('0x27')](function(_0x47c759){if(_0x47c759){_0x11c4b3=_0x47c759[_0x50b8('0x37')];if(!_0x37edfa[_0x50b8('0x31')]['hasOwnProperty']('nolimit')){_0x308033['limit']=qs[_0x50b8('0x1f')](_0x37edfa[_0x50b8('0x31')][_0x50b8('0x1f')]);_0x308033[_0x50b8('0x1d')]=qs[_0x50b8('0x1d')](_0x37edfa[_0x50b8('0x31')]['offset']);}return _0x44724b[_0x50b8('0x8c')](_0x308033);}})[_0x50b8('0x27')](function(_0x5a79ef){if(_0x5a79ef){return _0x5a79ef?{'count':_0x11c4b3,'rows':_0x5a79ef}:null;}})[_0x50b8('0x27')](respondWithResult(_0x5d6a5e,null))[_0x50b8('0x45')](handleError(_0x5d6a5e,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e5d2908..b8524be 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x2a240a,_0x45a3a7){_0x2a240a=_0x2a240a-0x0;var _0x242b5e=_0x326f[_0x2a240a];return _0x242b5e;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x5eea2d,_0x5ef0ae){_0x5eea2d=_0x5eea2d-0x0;var _0x3f156c=_0x3e74[_0x5eea2d];return _0x3f156c;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c0fb5c6..0f75c89 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 _0x702d=['exports','define','CmList','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4e8967,_0x30dda6){var _0x2ff29b=function(_0x54b5c6){while(--_0x54b5c6){_0x4e8967['push'](_0x4e8967['shift']());}};_0x2ff29b(++_0x30dda6);}(_0x702d,0x147));var _0xd702=function(_0x45a862,_0x26892a){_0x45a862=_0x45a862-0x0;var _0x88ce56=_0x702d[_0x45a862];return _0x88ce56;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./cmList.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2547=['rimraf','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x2547,0x1cd));var _0x7254=function(_0x2f9523,_0x19c8d7){_0x2f9523=_0x2f9523-0x0;var _0xd88af0=_0x2547[_0x2f9523];return _0xd88af0;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 395e0ce..a68452d 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 _0xfeab=['register','request','info','debug','error','message','CmList,\x20%s,\x20%s','request\x20sent','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket'];(function(_0x18e448,_0x114039){var _0x350a0f=function(_0x396cbc){while(--_0x396cbc){_0x18e448['push'](_0x18e448['shift']());}};_0x350a0f(++_0x114039);}(_0xfeab,0x106));var _0xbfea=function(_0x23d8b2,_0x48626c){_0x23d8b2=_0x23d8b2-0x0;var _0x12922d=_0xfeab[_0x23d8b2];return _0x12922d;};'use strict';var _=require('lodash');var util=require(_0xbfea('0x0'));var moment=require(_0xbfea('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbfea('0x3'));var logger=require(_0xbfea('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfea('0x5'));var client=jayson[_0xbfea('0x6')]['http']({'port':0x232a});config[_0xbfea('0x7')]=_['defaults'](config['redis'],{'host':_0xbfea('0x8'),'port':0x18eb});var socket=require(_0xbfea('0x9'))(new Redis(config[_0xbfea('0x7')]));require(_0xbfea('0xa'))[_0xbfea('0xb')](socket);function respondWithRpcPromise(_0x43a699,_0x522d85,_0x4abe24){return new BPromise(function(_0x34ec9f,_0x31a405){return client[_0xbfea('0xc')](_0x43a699,_0x4abe24)['then'](function(_0x464618){logger[_0xbfea('0xd')]('CmList,\x20%s,\x20%s',_0x522d85,'request\x20sent');logger[_0xbfea('0xe')]('CmList,\x20%s,\x20%s,\x20%s',_0x522d85,'request\x20sent',JSON['stringify'](_0x464618));if(_0x464618[_0xbfea('0xf')]){if(_0x464618[_0xbfea('0xf')]['code']===0x1f4){logger[_0xbfea('0xf')]('CmList,\x20%s,\x20%s',_0x522d85,_0x464618[_0xbfea('0xf')][_0xbfea('0x10')]);return _0x31a405(_0x464618['error'][_0xbfea('0x10')]);}logger['error'](_0xbfea('0x11'),_0x522d85,_0x464618[_0xbfea('0xf')][_0xbfea('0x10')]);return _0x34ec9f(_0x464618[_0xbfea('0xf')][_0xbfea('0x10')]);}else{logger[_0xbfea('0xd')]('CmList,\x20%s,\x20%s',_0x522d85,_0xbfea('0x12'));_0x34ec9f(_0x464618[_0xbfea('0x13')][_0xbfea('0x10')]);}})[_0xbfea('0x14')](function(_0x4ae410){logger[_0xbfea('0xf')]('CmList,\x20%s,\x20%s',_0x522d85,_0x4ae410);_0x31a405(_0x4ae410);});});} \ No newline at end of file +var _0x104c=['../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird','randomstring'];(function(_0x2bf5a4,_0x156ac3){var _0x15226e=function(_0x28b136){while(--_0x28b136){_0x2bf5a4['push'](_0x2bf5a4['shift']());}};_0x15226e(++_0x156ac3);}(_0x104c,0x110));var _0xc104=function(_0x19fcb8,_0x6b081e){_0x19fcb8=_0x19fcb8-0x0;var _0x3bd3b8=_0x104c[_0x19fcb8];return _0x3bd3b8;};'use strict';var _=require('lodash');var util=require(_0xc104('0x0'));var moment=require(_0xc104('0x1'));var BPromise=require(_0xc104('0x2'));var rs=require(_0xc104('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc104('0x4'));var logger=require(_0xc104('0x5'))(_0xc104('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc104('0x7')][_0xc104('0x8')]({'port':0x232a});config[_0xc104('0x9')]=_[_0xc104('0xa')](config[_0xc104('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc104('0x9')]));require(_0xc104('0xb'))[_0xc104('0xc')](socket);function respondWithRpcPromise(_0x4ff18f,_0x254614,_0x1162b8){return new BPromise(function(_0x41e8ae,_0x3ebc20){return client[_0xc104('0xd')](_0x4ff18f,_0x1162b8)[_0xc104('0xe')](function(_0x19804d){logger[_0xc104('0xf')](_0xc104('0x10'),_0x254614,_0xc104('0x11'));logger[_0xc104('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x254614,_0xc104('0x11'),JSON[_0xc104('0x13')](_0x19804d));if(_0x19804d[_0xc104('0x14')]){if(_0x19804d['error']['code']===0x1f4){logger[_0xc104('0x14')](_0xc104('0x10'),_0x254614,_0x19804d[_0xc104('0x14')][_0xc104('0x15')]);return _0x3ebc20(_0x19804d[_0xc104('0x14')][_0xc104('0x15')]);}logger['error'](_0xc104('0x10'),_0x254614,_0x19804d[_0xc104('0x14')][_0xc104('0x15')]);return _0x41e8ae(_0x19804d['error'][_0xc104('0x15')]);}else{logger[_0xc104('0xf')](_0xc104('0x10'),_0x254614,_0xc104('0x11'));_0x41e8ae(_0x19804d['result']['message']);}})[_0xc104('0x16')](function(_0x5a78fd){logger['error']('CmList,\x20%s,\x20%s',_0x254614,_0x5a78fd);_0x3ebc20(_0x5a78fd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 448f254..ff5acf3 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 _0xd11d=['remove','update','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0xd11d,0xc6));var _0xdd11=function(_0x38f63b,_0x590bac){_0x38f63b=_0x38f63b-0x0;var _0x164374=_0xd11d[_0x38f63b];return _0x164374;};'use strict';var CmListEvents=require(_0xdd11('0x0'));var events=[_0xdd11('0x1'),_0xdd11('0x2'),_0xdd11('0x3')];function createListener(_0x1e659b,_0x213b2e){return function(_0x1f32d2){_0x213b2e['emit'](_0x1e659b,_0x1f32d2);};}function removeListener(_0x577d65,_0xa118e0){return function(){CmListEvents[_0xdd11('0x4')](_0x577d65,_0xa118e0);};}exports[_0xdd11('0x5')]=function(_0x3f045d){for(var _0x547975=0x0,_0x4e092e=events[_0xdd11('0x6')];_0x547975<_0x4e092e;_0x547975++){var _0x6902c2=events[_0x547975];var _0x4aa271=createListener(_0xdd11('0x7')+_0x6902c2,_0x3f045d);CmListEvents['on'](_0x6902c2,_0x4aa271);}}; \ No newline at end of file +var _0xccca=['length','remove','update','removeListener','register'];(function(_0x45a33a,_0xfaf6bd){var _0x139beb=function(_0x3234e9){while(--_0x3234e9){_0x45a33a['push'](_0x45a33a['shift']());}};_0x139beb(++_0xfaf6bd);}(_0xccca,0xb5));var _0xaccc=function(_0x1faaca,_0x26498b){_0x1faaca=_0x1faaca-0x0;var _0x3a84fa=_0xccca[_0x1faaca];return _0x3a84fa;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xaccc('0x0'),_0xaccc('0x1')];function createListener(_0x55051a,_0x3620f7){return function(_0x4f8ddf){_0x3620f7['emit'](_0x55051a,_0x4f8ddf);};}function removeListener(_0x2a3ab8,_0x5c7600){return function(){CmListEvents[_0xaccc('0x2')](_0x2a3ab8,_0x5c7600);};}exports[_0xaccc('0x3')]=function(_0xdd83ce){for(var _0x149ec7=0x0,_0x5d3f54=events[_0xaccc('0x4')];_0x149ec7<_0x5d3f54;_0x149ec7++){var _0x630441=events[_0x149ec7];var _0x57b586=createListener('cmList:'+_0x630441,_0xdd83ce);CmListEvents['on'](_0x630441,_0x57b586);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d81c450..7f41571 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 _0xde64=['/:id/fields','addCustomField','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts'];(function(_0x2e72c7,_0x3cefda){var _0x12f876=function(_0x286755){while(--_0x286755){_0x2e72c7['push'](_0x2e72c7['shift']());}};_0x12f876(++_0x3cefda);}(_0xde64,0x17c));var _0x4de6=function(_0x600f5a,_0xb4fac0){_0x600f5a=_0x600f5a-0x0;var _0x2b3bd3=_0xde64[_0x600f5a];return _0x2b3bd3;};'use strict';var multer=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var path=require(_0x4de6('0x2'));var timeout=require(_0x4de6('0x3'));var express=require(_0x4de6('0x4'));var router=express[_0x4de6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4de6('0x6'));var interaction=require(_0x4de6('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x4de6('0x8')]('/',auth[_0x4de6('0x9')](),controller['index']);router['get'](_0x4de6('0xa'),auth[_0x4de6('0x9')](),controller[_0x4de6('0xb')]);router[_0x4de6('0x8')](_0x4de6('0xc'),auth[_0x4de6('0x9')](),controller['show']);router[_0x4de6('0x8')](_0x4de6('0xd'),auth[_0x4de6('0x9')](),controller['getDispositions']);router[_0x4de6('0x8')](_0x4de6('0xe'),auth[_0x4de6('0x9')](),controller[_0x4de6('0xf')]);router[_0x4de6('0x8')]('/:id/contacts/csv',auth[_0x4de6('0x9')](),controller[_0x4de6('0x10')]);router[_0x4de6('0x8')]('/:id/fields',auth[_0x4de6('0x9')](),controller[_0x4de6('0x11')]);router[_0x4de6('0x8')](_0x4de6('0x12'),auth['isAuthenticated'](),controller[_0x4de6('0x13')]);router[_0x4de6('0x14')]('/',auth[_0x4de6('0x9')](),controller['create']);router[_0x4de6('0x14')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4de6('0x15')]);router[_0x4de6('0x14')](_0x4de6('0xe'),auth[_0x4de6('0x9')](),controller[_0x4de6('0x16')]);router[_0x4de6('0x14')](_0x4de6('0x17'),auth['isAuthenticated'](),controller[_0x4de6('0x18')]);router[_0x4de6('0x14')](_0x4de6('0x12'),auth[_0x4de6('0x9')](),controller[_0x4de6('0x19')]);router[_0x4de6('0x1a')](_0x4de6('0xc'),auth[_0x4de6('0x9')](),controller[_0x4de6('0x1b')]);router[_0x4de6('0x1c')]('/:id',auth[_0x4de6('0x9')](),controller['destroy']);router[_0x4de6('0x1c')](_0x4de6('0xd'),auth[_0x4de6('0x9')](),controller['removeDispositions']);router[_0x4de6('0x1c')]('/:id/users',auth[_0x4de6('0x9')](),controller[_0x4de6('0x1d')]);module[_0x4de6('0x1e')]=router; \ No newline at end of file +var _0x4444=['describe','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','put','delete','/:id','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmList.controller','index','get','/describe','isAuthenticated'];(function(_0x2cf367,_0x416e52){var _0x228b25=function(_0x4c0ccf){while(--_0x4c0ccf){_0x2cf367['push'](_0x2cf367['shift']());}};_0x228b25(++_0x416e52);}(_0x4444,0xa3));var _0x4444=function(_0x1fbeaf,_0x256fbd){_0x1fbeaf=_0x1fbeaf-0x0;var _0x13daa3=_0x4444[_0x1fbeaf];return _0x13daa3;};'use strict';var multer=require(_0x4444('0x0'));var util=require(_0x4444('0x1'));var path=require('path');var timeout=require(_0x4444('0x2'));var express=require(_0x4444('0x3'));var router=express[_0x4444('0x4')]();var fs_extra=require(_0x4444('0x5'));var auth=require(_0x4444('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4444('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4444('0x8')]);router[_0x4444('0x9')](_0x4444('0xa'),auth[_0x4444('0xb')](),controller[_0x4444('0xc')]);router[_0x4444('0x9')]('/:id',auth[_0x4444('0xb')](),controller[_0x4444('0xd')]);router[_0x4444('0x9')](_0x4444('0xe'),auth[_0x4444('0xb')](),controller[_0x4444('0xf')]);router[_0x4444('0x9')](_0x4444('0x10'),auth[_0x4444('0xb')](),controller[_0x4444('0x11')]);router[_0x4444('0x9')](_0x4444('0x12'),auth['isAuthenticated'](),controller[_0x4444('0x13')]);router['get'](_0x4444('0x14'),auth[_0x4444('0xb')](),controller[_0x4444('0x15')]);router[_0x4444('0x9')]('/:id/users',auth[_0x4444('0xb')](),controller[_0x4444('0x16')]);router[_0x4444('0x17')]('/',auth[_0x4444('0xb')](),controller[_0x4444('0x18')]);router[_0x4444('0x17')](_0x4444('0xe'),auth[_0x4444('0xb')](),controller[_0x4444('0x19')]);router[_0x4444('0x17')](_0x4444('0x10'),auth['isAuthenticated'](),controller[_0x4444('0x1a')]);router[_0x4444('0x17')]('/:id/fields',auth[_0x4444('0xb')](),controller[_0x4444('0x1b')]);router[_0x4444('0x17')](_0x4444('0x1c'),auth[_0x4444('0xb')](),controller['addAgents']);router[_0x4444('0x1d')]('/:id',auth[_0x4444('0xb')](),controller['update']);router[_0x4444('0x1e')](_0x4444('0x1f'),auth[_0x4444('0xb')](),controller['destroy']);router[_0x4444('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4444('0x20')]);router['delete'](_0x4444('0x1c'),auth['isAuthenticated'](),controller[_0x4444('0x21')]);module[_0x4444('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f0b5f64..db8bdca 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 _0xe0a3=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x3f9da4,_0x1c80c0){var _0x101707=function(_0x37c2aa){while(--_0x37c2aa){_0x3f9da4['push'](_0x3f9da4['shift']());}};_0x101707(++_0x1c80c0);}(_0xe0a3,0x154));var _0x3e0a=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xe0a3[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0x3e0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0a('0x1')],'get':function(_0x50bc27){return this[_0x3e0a('0x2')](_0x3e0a('0x3'));}},'field':{'type':Sequelize[_0x3e0a('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3e0a('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x3e0a('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xb3d6=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x53bb1a,_0x57ffd5){var _0x26a477=function(_0x2e9c7d){while(--_0x2e9c7d){_0x53bb1a['push'](_0x53bb1a['shift']());}};_0x26a477(++_0x57ffd5);}(_0xb3d6,0x13a));var _0x6b3d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb3d6[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x6b3d('0x0'));module[_0x6b3d('0x1')]={'name':{'type':Sequelize[_0x6b3d('0x2')],'get':function(_0x5eb233){return this[_0x6b3d('0x3')](_0x6b3d('0x4'));}},'field':{'type':Sequelize[_0x6b3d('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 4e04ee9..c0f0475 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(_0x18cf80,_0x235efa){var _0x46d596=function(_0x3d45e2){while(--_0x3d45e2){_0x18cf80['push'](_0x18cf80['shift']());}};_0x46d596(++_0x235efa);}(_0x7a54,0x106));var _0x47a5=function(_0x31e817,_0x57ac86){_0x31e817=_0x31e817-0x0;var _0x101377=_0x7a54[_0x31e817];return _0x101377;};'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 _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(_0x155b2f,_0x927966){var _0x14f331=function(_0xf8b17a){while(--_0xf8b17a){_0x155b2f['push'](_0x155b2f['shift']());}};_0x14f331(++_0x927966);}(_0x7a54,0x106));var _0x47a5=function(_0x3c8755,_0x385e99){_0x3c8755=_0x3c8755-0x0;var _0xf3f28d=_0x7a54[_0x3c8755];return _0xf3f28d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5cd8706..23db0ba 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 _0xb8cc=['bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','util','api','moment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb8cc,0x194));var _0xcb8c=function(_0x21aac0,_0x3c6855){_0x21aac0=_0x21aac0-0x0;var _0x4f3846=_0xb8cc[_0x21aac0];return _0x4f3846;};'use strict';var _=require('lodash');var util=require(_0xcb8c('0x0'));var logger=require('../../config/logger')(_0xcb8c('0x1'));var moment=require(_0xcb8c('0x2'));var BPromise=require(_0xcb8c('0x3'));var rp=require(_0xcb8c('0x4'));var fs=require('fs');var path=require(_0xcb8c('0x5'));var rimraf=require('rimraf');var config=require(_0xcb8c('0x6'));var attributes=require(_0xcb8c('0x7'));module[_0xcb8c('0x8')]=function(_0x48866d,_0x123d13){return _0x48866d[_0xcb8c('0x9')](_0xcb8c('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc5=['bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','../../config/logger','api','moment'];(function(_0xeac5c1,_0x31fc3f){var _0x5836bc=function(_0x50e2cf){while(--_0x50e2cf){_0xeac5c1['push'](_0xeac5c1['shift']());}};_0x5836bc(++_0x31fc3f);}(_0x2bc5,0x71));var _0x52bc=function(_0x1c5db9,_0x2ec26d){_0x1c5db9=_0x1c5db9-0x0;var _0x34ebeb=_0x2bc5[_0x1c5db9];return _0x34ebeb;};'use strict';var _=require(_0x52bc('0x0'));var util=require('util');var logger=require(_0x52bc('0x1'))(_0x52bc('0x2'));var moment=require(_0x52bc('0x3'));var BPromise=require(_0x52bc('0x4'));var rp=require(_0x52bc('0x5'));var fs=require('fs');var path=require(_0x52bc('0x6'));var rimraf=require(_0x52bc('0x7'));var config=require('../../config/environment');var attributes=require(_0x52bc('0x8'));module[_0x52bc('0x9')]=function(_0x58f4b7,_0x19c99b){return _0x58f4b7[_0x52bc('0xa')](_0x52bc('0xb'),attributes,{'tableName':_0x52bc('0xc'),'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 2cf6eb7..ceb5a36 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 _0x4336=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x21596f,_0x4c7ba5){var _0x273962=function(_0x4100b2){while(--_0x4100b2){_0x21596f['push'](_0x21596f['shift']());}};_0x273962(++_0x4c7ba5);}(_0x4336,0x172));var _0x6433=function(_0x1ce042,_0xb19eae){_0x1ce042=_0x1ce042-0x0;var _0x441ac0=_0x4336[_0x1ce042];return _0x441ac0;};'use strict';var _=require(_0x6433('0x0'));var util=require(_0x6433('0x1'));var moment=require(_0x6433('0x2'));var BPromise=require(_0x6433('0x3'));var rs=require(_0x6433('0x4'));var fs=require('fs');var Redis=require(_0x6433('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6433('0x6'));var logger=require(_0x6433('0x7'))(_0x6433('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6433('0x9')][_0x6433('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb307ef,_0x4368ca,_0x2cbbc8){return new BPromise(function(_0x477457,_0x26c32a){return client[_0x6433('0xb')](_0xb307ef,_0x2cbbc8)[_0x6433('0xc')](function(_0x44e658){logger[_0x6433('0xd')]('Condition,\x20%s,\x20%s',_0x4368ca,_0x6433('0xe'));logger[_0x6433('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x4368ca,_0x6433('0xe'),JSON[_0x6433('0x10')](_0x44e658));if(_0x44e658[_0x6433('0x11')]){if(_0x44e658[_0x6433('0x11')][_0x6433('0x12')]===0x1f4){logger[_0x6433('0x11')](_0x6433('0x13'),_0x4368ca,_0x44e658[_0x6433('0x11')]['message']);return _0x26c32a(_0x44e658[_0x6433('0x11')]['message']);}logger[_0x6433('0x11')](_0x6433('0x13'),_0x4368ca,_0x44e658[_0x6433('0x11')][_0x6433('0x14')]);return _0x477457(_0x44e658['error']['message']);}else{logger[_0x6433('0xd')](_0x6433('0x13'),_0x4368ca,_0x6433('0xe'));_0x477457(_0x44e658[_0x6433('0x15')][_0x6433('0x14')]);}})['catch'](function(_0x1bce81){logger[_0x6433('0x11')]('Condition,\x20%s,\x20%s',_0x4368ca,_0x1bce81);_0x26c32a(_0x1bce81);});});} \ No newline at end of file +var _0x604d=['info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then'];(function(_0x32168c,_0x262fc4){var _0x270be6=function(_0x2318b2){while(--_0x2318b2){_0x32168c['push'](_0x32168c['shift']());}};_0x270be6(++_0x262fc4);}(_0x604d,0x170));var _0xd604=function(_0xdda14b,_0xf92546){_0xdda14b=_0xdda14b-0x0;var _0x3ae153=_0x604d[_0xdda14b];return _0x3ae153;};'use strict';var _=require(_0xd604('0x0'));var util=require(_0xd604('0x1'));var moment=require(_0xd604('0x2'));var BPromise=require('bluebird');var rs=require(_0xd604('0x3'));var fs=require('fs');var Redis=require(_0xd604('0x4'));var db=require(_0xd604('0x5'))['db'];var utils=require(_0xd604('0x6'));var logger=require(_0xd604('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd604('0x8'));var client=jayson[_0xd604('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568f21,_0x301f61,_0x534a74){return new BPromise(function(_0x4a1611,_0x6727da){return client[_0xd604('0xa')](_0x568f21,_0x534a74)[_0xd604('0xb')](function(_0x3926ca){logger[_0xd604('0xc')](_0xd604('0xd'),_0x301f61,_0xd604('0xe'));logger['debug'](_0xd604('0xf'),_0x301f61,_0xd604('0xe'),JSON['stringify'](_0x3926ca));if(_0x3926ca[_0xd604('0x10')]){if(_0x3926ca['error'][_0xd604('0x11')]===0x1f4){logger[_0xd604('0x10')]('Condition,\x20%s,\x20%s',_0x301f61,_0x3926ca[_0xd604('0x10')][_0xd604('0x12')]);return _0x6727da(_0x3926ca['error'][_0xd604('0x12')]);}logger[_0xd604('0x10')](_0xd604('0xd'),_0x301f61,_0x3926ca['error'][_0xd604('0x12')]);return _0x4a1611(_0x3926ca['error'][_0xd604('0x12')]);}else{logger[_0xd604('0xc')](_0xd604('0xd'),_0x301f61,_0xd604('0xe'));_0x4a1611(_0x3926ca['result'][_0xd604('0x12')]);}})[_0xd604('0x13')](function(_0x908650){logger[_0xd604('0x10')](_0xd604('0xd'),_0x301f61,_0x908650);_0x6727da(_0x908650);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c43d651..f18c9e1 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 _0x2d35=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout'];(function(_0x4862a3,_0x421f68){var _0x5a9df4=function(_0x302b86){while(--_0x302b86){_0x4862a3['push'](_0x4862a3['shift']());}};_0x5a9df4(++_0x421f68);}(_0x2d35,0x115));var _0x52d3=function(_0x246eeb,_0x1bf6ef){_0x246eeb=_0x246eeb-0x0;var _0x114642=_0x2d35[_0x246eeb];return _0x114642;};'use strict';var multer=require(_0x52d3('0x0'));var util=require(_0x52d3('0x1'));var path=require('path');var timeout=require(_0x52d3('0x2'));var express=require('express');var router=express[_0x52d3('0x3')]();var fs_extra=require(_0x52d3('0x4'));var auth=require(_0x52d3('0x5'));var interaction=require(_0x52d3('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x52d3('0x7')](_0x52d3('0x8'),auth['isAuthenticated'](),controller[_0x52d3('0x9')]);router[_0x52d3('0xa')](_0x52d3('0x8'),auth[_0x52d3('0xb')](),controller[_0x52d3('0xc')]);module[_0x52d3('0xd')]=router; \ No newline at end of file +var _0x5b70=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','/:id','isAuthenticated'];(function(_0x2a67e0,_0x38d4be){var _0x4c9274=function(_0x277245){while(--_0x277245){_0x2a67e0['push'](_0x2a67e0['shift']());}};_0x4c9274(++_0x38d4be);}(_0x5b70,0x1ee));var _0x05b7=function(_0x2b9a23,_0x49be94){_0x2b9a23=_0x2b9a23-0x0;var _0x5c3f07=_0x5b70[_0x2b9a23];return _0x5c3f07;};'use strict';var multer=require(_0x05b7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x05b7('0x1'));var express=require(_0x05b7('0x2'));var router=express[_0x05b7('0x3')]();var fs_extra=require(_0x05b7('0x4'));var auth=require(_0x05b7('0x5'));var interaction=require(_0x05b7('0x6'));var config=require('../../config/environment');var controller=require(_0x05b7('0x7'));router['put'](_0x05b7('0x8'),auth[_0x05b7('0x9')](),controller[_0x05b7('0xa')]);router[_0x05b7('0xb')](_0x05b7('0x8'),auth[_0x05b7('0x9')](),controller[_0x05b7('0xc')]);module[_0x05b7('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 27ca0a8..0d8e921 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x52930a,_0x419035){var _0x26b0c0=function(_0x4b21e7){while(--_0x4b21e7){_0x52930a['push'](_0x52930a['shift']());}};_0x26b0c0(++_0x419035);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x56b20e,_0x428d3c){var _0x3b2ee3=function(_0x2d8a68){while(--_0x2d8a68){_0x56b20e['push'](_0x56b20e['shift']());}};_0x3b2ee3(++_0x428d3c);}(_0x757a,0xde));var _0xa757=function(_0x2b1743,_0x587219){_0x2b1743=_0x2b1743-0x0;var _0x38f366=_0x757a[_0x2b1743];return _0x38f366;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 9d8cb51..3445ac1 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 _0xac93=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','CustomDashboards','UserProfileResource','error','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','Dashboard','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','destroy','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrReport','type','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xac93,0xe5));var _0x3ac9=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xac93[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x3ac9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ac9('0x1'));var rp=require(_0x3ac9('0x2'));var moment=require('moment');var BPromise=require(_0x3ac9('0x3'));var Mustache=require('mustache');var util=require(_0x3ac9('0x4'));var path=require(_0x3ac9('0x5'));var sox=require(_0x3ac9('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ac9('0x7'));var _=require(_0x3ac9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ac9('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3ac9('0xa'));var querystring=require(_0x3ac9('0xb'));var Papa=require(_0x3ac9('0xc'));var Redis=require(_0x3ac9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3ac9('0xe'));var as=require(_0x3ac9('0xf'));var hardwareService=require(_0x3ac9('0x10'));var logger=require('../../config/logger')(_0x3ac9('0x11'));var utils=require(_0x3ac9('0x12'));var config=require(_0x3ac9('0x13'));var licenseUtil=require(_0x3ac9('0x14'));var db=require(_0x3ac9('0x15'))['db'];config['redis']=_[_0x3ac9('0x16')](config[_0x3ac9('0x17')],{'host':_0x3ac9('0x18'),'port':0x18eb});var socket=require(_0x3ac9('0x19'))(new Redis(config[_0x3ac9('0x17')]));require(_0x3ac9('0x1a'))[_0x3ac9('0x1b')](socket);function respondWithStatusCode(_0x445647,_0x44b8bd){_0x44b8bd=_0x44b8bd||0xcc;return function(_0x26320c){if(_0x26320c){return _0x445647[_0x3ac9('0x1c')](_0x44b8bd);}return _0x445647[_0x3ac9('0x1d')](_0x44b8bd)[_0x3ac9('0x1e')]();};}function respondWithResult(_0x44a95b,_0x301d1e){_0x301d1e=_0x301d1e||0xc8;return function(_0x3945c4){if(_0x3945c4){return _0x44a95b[_0x3ac9('0x1d')](_0x301d1e)['json'](_0x3945c4);}};}function respondWithFilteredResult(_0x1e41b2,_0x1dfb58){return function(_0x51da52){if(_0x51da52){var _0x4d3a44=typeof _0x1dfb58[_0x3ac9('0x1f')]===_0x3ac9('0x20')&&typeof _0x1dfb58[_0x3ac9('0x21')]==='undefined';var _0x37112c=_0x51da52[_0x3ac9('0x22')];var _0x5bafae=_0x4d3a44?0x0:_0x1dfb58['offset'];var _0x2cc703=_0x4d3a44?_0x51da52[_0x3ac9('0x22')]:_0x1dfb58[_0x3ac9('0x1f')]+_0x1dfb58[_0x3ac9('0x21')];var _0x1fc9bc;if(_0x2cc703>=_0x37112c){_0x2cc703=_0x37112c;_0x1fc9bc=0xc8;}else{_0x1fc9bc=0xce;}_0x1e41b2[_0x3ac9('0x1d')](_0x1fc9bc);return _0x1e41b2[_0x3ac9('0x23')](_0x3ac9('0x24'),_0x5bafae+'-'+_0x2cc703+'/'+_0x37112c)['json'](_0x51da52);}return null;};}function patchUpdates(_0x30fdae){return function(_0x2640e3){try{jsonpatch['apply'](_0x2640e3,_0x30fdae,!![]);}catch(_0x1f383d){return BPromise[_0x3ac9('0x25')](_0x1f383d);}return _0x2640e3[_0x3ac9('0x26')]();};}function saveUpdates(_0x46a3bb,_0x107499){return function(_0x550bce){if(_0x550bce){return _0x550bce[_0x3ac9('0x27')](_0x46a3bb)[_0x3ac9('0x28')](function(_0x45cf43){return _0x45cf43;});}return null;};}function removeEntity(_0x4999f8,_0x41479f){return function(_0x468080){if(_0x468080){return _0x468080['destroy']()[_0x3ac9('0x28')](function(){var _0x523e2b=_0x468080[_0x3ac9('0x29')]({'plain':!![]});var _0x16c1a3=_0x3ac9('0x2a');return db[_0x3ac9('0x2b')]['destroy']({'where':{'type':_0x16c1a3,'resourceId':_0x523e2b['id']}})[_0x3ac9('0x28')](function(){return _0x468080;});})[_0x3ac9('0x28')](function(){_0x4999f8[_0x3ac9('0x1d')](0xcc)[_0x3ac9('0x1e')]();});}};}function handleEntityNotFound(_0x35d91e,_0x1f7023){return function(_0x31d86b){if(!_0x31d86b){_0x35d91e['sendStatus'](0x194);}return _0x31d86b;};}function handleError(_0x2b1276,_0x33ac10){_0x33ac10=_0x33ac10||0x1f4;return function(_0x1e3205){logger[_0x3ac9('0x2c')](_0x1e3205['stack']);if(_0x1e3205[_0x3ac9('0x2d')]){delete _0x1e3205[_0x3ac9('0x2d')];}_0x2b1276[_0x3ac9('0x1d')](_0x33ac10)[_0x3ac9('0x2e')](_0x1e3205);};}exports[_0x3ac9('0x2f')]=function(_0x2051f7,_0x45db69){var _0xc33c1f={},_0x1642ec={},_0x2fdc81={'count':0x0,'rows':[]};var _0x1b6ca8=_[_0x3ac9('0x30')](db['Dashboard']['rawAttributes'],function(_0x7ba9e9){return{'name':_0x7ba9e9[_0x3ac9('0x31')],'type':_0x7ba9e9['type'][_0x3ac9('0x32')]};});_0x1642ec['model']=_[_0x3ac9('0x30')](_0x1b6ca8,_0x3ac9('0x2d'));_0x1642ec[_0x3ac9('0x33')]=_[_0x3ac9('0x34')](_0x2051f7[_0x3ac9('0x33')]);_0x1642ec[_0x3ac9('0x35')]=_[_0x3ac9('0x36')](_0x1642ec[_0x3ac9('0x37')],_0x1642ec[_0x3ac9('0x33')]);_0xc33c1f['attributes']=_[_0x3ac9('0x36')](_0x1642ec[_0x3ac9('0x37')],qs[_0x3ac9('0x38')](_0x2051f7[_0x3ac9('0x33')]['fields']));_0xc33c1f[_0x3ac9('0x39')]=_0xc33c1f[_0x3ac9('0x39')][_0x3ac9('0x3a')]?_0xc33c1f[_0x3ac9('0x39')]:_0x1642ec['model'];if(!_0x2051f7['query'][_0x3ac9('0x3b')](_0x3ac9('0x3c'))){_0xc33c1f[_0x3ac9('0x21')]=qs[_0x3ac9('0x21')](_0x2051f7['query'][_0x3ac9('0x21')]);_0xc33c1f['offset']=qs[_0x3ac9('0x1f')](_0x2051f7[_0x3ac9('0x33')]['offset']);}_0xc33c1f[_0x3ac9('0x3d')]=qs[_0x3ac9('0x3e')](_0x2051f7['query'][_0x3ac9('0x3e')]);_0xc33c1f['where']=qs[_0x3ac9('0x35')](_['pick'](_0x2051f7['query'],_0x1642ec['filters']),_0x1b6ca8);if(_0x2051f7['query'][_0x3ac9('0x3f')]){_0xc33c1f['where']=_[_0x3ac9('0x40')](_0xc33c1f[_0x3ac9('0x41')],{'$or':_['map'](_0x1b6ca8,function(_0x355df7){if(_0x355df7['type']!=='VIRTUAL'){var _0xf2e13d={};_0xf2e13d[_0x355df7[_0x3ac9('0x2d')]]={'$like':'%'+_0x2051f7['query'][_0x3ac9('0x3f')]+'%'};return _0xf2e13d;}})});}_0xc33c1f=_[_0x3ac9('0x40')]({},_0xc33c1f,_0x2051f7['options']);var _0x1c7f3e={'where':_0xc33c1f[_0x3ac9('0x41')]};return db[_0x3ac9('0x42')][_0x3ac9('0x22')](_0x1c7f3e)[_0x3ac9('0x28')](function(_0x45c747){_0x2fdc81[_0x3ac9('0x22')]=_0x45c747;if(_0x2051f7['query'][_0x3ac9('0x43')]){_0xc33c1f[_0x3ac9('0x44')]=[{'all':!![]}];}return db[_0x3ac9('0x42')][_0x3ac9('0x45')](_0xc33c1f);})[_0x3ac9('0x28')](function(_0x4832a5){_0x2fdc81[_0x3ac9('0x46')]=_0x4832a5;return _0x2fdc81;})[_0x3ac9('0x28')](respondWithFilteredResult(_0x45db69,_0xc33c1f))[_0x3ac9('0x47')](handleError(_0x45db69,null));};exports[_0x3ac9('0x48')]=function(_0x471ce4,_0x285424){var _0x38a7ba={'raw':![],'where':{'id':_0x471ce4[_0x3ac9('0x49')]['id']}},_0x200e46={};_0x200e46[_0x3ac9('0x37')]=_[_0x3ac9('0x34')](db['Dashboard'][_0x3ac9('0x4a')]);_0x200e46['query']=_['keys'](_0x471ce4[_0x3ac9('0x33')]);_0x200e46[_0x3ac9('0x35')]=_[_0x3ac9('0x36')](_0x200e46[_0x3ac9('0x37')],_0x200e46[_0x3ac9('0x33')]);_0x38a7ba[_0x3ac9('0x39')]=_[_0x3ac9('0x36')](_0x200e46['model'],qs[_0x3ac9('0x38')](_0x471ce4[_0x3ac9('0x33')][_0x3ac9('0x38')]));_0x38a7ba[_0x3ac9('0x39')]=_0x38a7ba[_0x3ac9('0x39')][_0x3ac9('0x3a')]?_0x38a7ba['attributes']:_0x200e46[_0x3ac9('0x37')];if(_0x471ce4[_0x3ac9('0x33')][_0x3ac9('0x43')]){_0x38a7ba['include']=[{'all':!![]}];}_0x38a7ba=_[_0x3ac9('0x40')]({},_0x38a7ba,_0x471ce4[_0x3ac9('0x4b')]);return db[_0x3ac9('0x42')]['find'](_0x38a7ba)[_0x3ac9('0x28')](handleEntityNotFound(_0x285424,null))[_0x3ac9('0x28')](respondWithResult(_0x285424,null))[_0x3ac9('0x47')](handleError(_0x285424,null));};exports[_0x3ac9('0x4c')]=function(_0x307aaf,_0x94e70c){return db[_0x3ac9('0x42')]['create'](_0x307aaf['body'],{})[_0x3ac9('0x28')](function(_0x35f55c){var _0xaa9918=_0x307aaf['user'][_0x3ac9('0x29')]({'plain':!![]});if(!_0xaa9918)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaa9918[_0x3ac9('0x4d')]==='user'){var _0x569b9d=_0x35f55c[_0x3ac9('0x29')]({'plain':!![]});var _0xa1b562='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0xa1b562,'userProfileId':_0xaa9918[_0x3ac9('0x4e')]},'raw':!![]})[_0x3ac9('0x28')](function(_0x30353a){if(_0x30353a&&_0x30353a[_0x3ac9('0x4f')]===0x0){return db[_0x3ac9('0x2b')][_0x3ac9('0x4c')]({'name':_0x569b9d[_0x3ac9('0x2d')],'resourceId':_0x569b9d['id'],'type':_0x30353a[_0x3ac9('0x2d')],'sectionId':_0x30353a['id']},{})[_0x3ac9('0x28')](function(){return _0x35f55c;});}else{return _0x35f55c;}})[_0x3ac9('0x47')](function(_0xeff2b4){logger[_0x3ac9('0x2c')](_0x3ac9('0x50'),_0xeff2b4);throw _0xeff2b4;});}return _0x35f55c;})[_0x3ac9('0x28')](respondWithResult(_0x94e70c,0xc9))['catch'](handleError(_0x94e70c,null));};exports[_0x3ac9('0x51')]=function(_0x2a8853,_0x330644){var _0x283919={'where':{'id':_0x2a8853['params']['id']}},_0x289525={};_0x289525['model']=_[_0x3ac9('0x34')](db['Dashboard'][_0x3ac9('0x4a')]);_0x283919[_0x3ac9('0x39')]=_[_0x3ac9('0x36')](_0x289525['model'],qs[_0x3ac9('0x38')](_0x2a8853[_0x3ac9('0x33')][_0x3ac9('0x38')]));_0x283919[_0x3ac9('0x39')]=_0x283919['attributes']['length']?_0x283919['attributes']:_0x289525[_0x3ac9('0x37')];if(_0x2a8853[_0x3ac9('0x33')]['includeAll']){_0x283919[_0x3ac9('0x44')]=[{'all':!![]}];}_0x283919=_['merge']({},_0x283919,_0x2a8853[_0x3ac9('0x4b')]);return db[_0x3ac9('0x42')]['find'](_0x283919)['then'](handleEntityNotFound(_0x330644,null))[_0x3ac9('0x28')](function(_0x3857df){if(_0x3857df){var _0x2a811a=_0x3857df[_0x3ac9('0x29')]({'plain':!![]});_0x2a811a=qs[_0x3ac9('0x52')](_0x2a811a,['id','createdAt','updatedAt']);_0x2a8853[_0x3ac9('0x53')]=_[_0x3ac9('0x52')](_0x2a8853[_0x3ac9('0x53')],['id','createdAt',_0x3ac9('0x54')]);return db[_0x3ac9('0x42')]['create'](_[_0x3ac9('0x40')](_0x2a811a,_0x2a8853[_0x3ac9('0x53')]),{'include':_0x2a8853[_0x3ac9('0x33')][_0x3ac9('0x43')]?[{'all':!![]}]:undefined})[_0x3ac9('0x28')](function(_0x4d00db){var _0x147548=_0x2a8853[_0x3ac9('0x55')]['get']({'plain':!![]});if(!_0x147548)throw new Error(_0x3ac9('0x56'));if(_0x147548['role']===_0x3ac9('0x55')){var _0x3b7c9f=_0x4d00db[_0x3ac9('0x29')]({'plain':!![]});var _0x31c2ad='CustomDashboards';return db[_0x3ac9('0x57')][_0x3ac9('0x58')]({'where':{'name':_0x31c2ad,'userProfileId':_0x147548['userProfileId']},'raw':!![]})[_0x3ac9('0x28')](function(_0x5b5df6){if(_0x5b5df6&&_0x5b5df6[_0x3ac9('0x4f')]===0x0){return db['UserProfileResource'][_0x3ac9('0x4c')]({'name':_0x3b7c9f[_0x3ac9('0x2d')],'resourceId':_0x3b7c9f['id'],'type':_0x5b5df6[_0x3ac9('0x2d')],'sectionId':_0x5b5df6['id']},{})[_0x3ac9('0x28')](function(){return _0x4d00db;});}else{return _0x4d00db;}})[_0x3ac9('0x47')](function(_0x2e1e33){logger['error'](_0x3ac9('0x50'),_0x2e1e33);throw _0x2e1e33;});}return _0x4d00db;});}})[_0x3ac9('0x28')](respondWithResult(_0x330644,0xc9))[_0x3ac9('0x47')](handleError(_0x330644,null));};exports[_0x3ac9('0x27')]=function(_0x1b4fe6,_0x2d5c6a){if(_0x1b4fe6[_0x3ac9('0x53')]['id']){delete _0x1b4fe6[_0x3ac9('0x53')]['id'];}return db[_0x3ac9('0x42')][_0x3ac9('0x58')]({'where':{'id':_0x1b4fe6[_0x3ac9('0x49')]['id']}})[_0x3ac9('0x28')](handleEntityNotFound(_0x2d5c6a,null))[_0x3ac9('0x28')](saveUpdates(_0x1b4fe6[_0x3ac9('0x53')],null))[_0x3ac9('0x28')](respondWithResult(_0x2d5c6a,null))[_0x3ac9('0x47')](handleError(_0x2d5c6a,null));};exports[_0x3ac9('0x59')]=function(_0x2c0c53,_0x53a6c8){return db[_0x3ac9('0x42')][_0x3ac9('0x58')]({'where':{'id':_0x2c0c53['params']['id']}})[_0x3ac9('0x28')](handleEntityNotFound(_0x53a6c8,null))[_0x3ac9('0x28')](removeEntity(_0x53a6c8,null))[_0x3ac9('0x47')](handleError(_0x53a6c8,null));};function widgetAttributes(_0x4c5383){try{switch(_0x4c5383['type']){case _0x3ac9('0x5a'):return[{'name':_0x3ac9('0x5b'),'value':_0x4c5383[_0x3ac9('0x5b')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x3ac9('0x5d'),'value':_0x4c5383[_0x3ac9('0x5d')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||''}];case _0x3ac9('0x5f'):return[{'name':_0x3ac9('0x60'),'value':_0x4c5383[_0x3ac9('0x60')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x61')},{'name':'attrTimezone','value':_0x4c5383[_0x3ac9('0x62')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x1]?_0x4c5383[_0x3ac9('0x5c')][0x1]['value']:undefined)||_0x3ac9('0x63')},{'name':'attrFontSize','value':_0x4c5383['attrFontSize']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x2]?_0x4c5383['attrs'][0x2][_0x3ac9('0x5e')]:undefined)||0xc}];case _0x3ac9('0x64'):return[{'name':_0x3ac9('0x65'),'value':_0x4c5383['attrMetric']||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x66')},{'name':'attrVoiceQueues','value':_0x4c5383[_0x3ac9('0x67')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x1]?_0x4c5383[_0x3ac9('0x5c')][0x1]['value']:undefined)||[]},{'name':_0x3ac9('0x68'),'value':_0x4c5383['attrFontSize']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x2]?_0x4c5383['attrs'][0x2][_0x3ac9('0x5e')]:undefined)||0x14},{'name':_0x3ac9('0x69'),'value':_0x4c5383['attrChannel']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x3]?_0x4c5383[_0x3ac9('0x5c')][0x3][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x6a')},{'name':_0x3ac9('0x6b'),'value':_0x4c5383['attrEmailAccounts']||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x4]?_0x4c5383[_0x3ac9('0x5c')][0x4][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x6c'),'value':_0x4c5383[_0x3ac9('0x6c')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x5]?_0x4c5383['attrs'][0x5]['value']:undefined)||''},{'name':_0x3ac9('0x6d'),'value':_0x4c5383[_0x3ac9('0x6d')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x6]?_0x4c5383[_0x3ac9('0x5c')][0x6]['value']:undefined)||''},{'name':_0x3ac9('0x6e'),'value':_0x4c5383[_0x3ac9('0x6e')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x7]?_0x4c5383[_0x3ac9('0x5c')][0x7][_0x3ac9('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4c5383[_0x3ac9('0x6f')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x8]?_0x4c5383['attrs'][0x8][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x70'),'value':_0x4c5383[_0x3ac9('0x70')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x9]?_0x4c5383[_0x3ac9('0x5c')][0x9][_0x3ac9('0x5e')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x4c5383[_0x3ac9('0x71')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x66')},{'name':'attrSerie2','value':_0x4c5383[_0x3ac9('0x72')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x1]?_0x4c5383[_0x3ac9('0x5c')][0x1][_0x3ac9('0x5e')]:undefined)||null},{'name':_0x3ac9('0x73'),'value':_0x4c5383[_0x3ac9('0x73')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x2]?_0x4c5383[_0x3ac9('0x5c')][0x2]['value']:undefined)||null},{'name':_0x3ac9('0x67'),'value':_0x4c5383['attrVoiceQueues']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383['attrs'][0x3]?_0x4c5383[_0x3ac9('0x5c')][0x3][_0x3ac9('0x5e')]:undefined)||[]},{'name':_0x3ac9('0x69'),'value':_0x4c5383[_0x3ac9('0x69')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x4]?_0x4c5383[_0x3ac9('0x5c')][0x4][_0x3ac9('0x5e')]:undefined)||_0x3ac9('0x6a')},{'name':_0x3ac9('0x6b'),'value':_0x4c5383['attrEmailAccounts']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x5]?_0x4c5383[_0x3ac9('0x5c')][0x5][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x6c'),'value':_0x4c5383[_0x3ac9('0x6c')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x6]?_0x4c5383[_0x3ac9('0x5c')][0x6]['value']:undefined)||''},{'name':_0x3ac9('0x6d'),'value':_0x4c5383[_0x3ac9('0x6d')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x7]?_0x4c5383[_0x3ac9('0x5c')][0x7][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x6e'),'value':_0x4c5383[_0x3ac9('0x6e')]||(_0x4c5383['attrs']&&_0x4c5383[_0x3ac9('0x5c')][0x8]?_0x4c5383['attrs'][0x8]['value']:undefined)||''},{'name':_0x3ac9('0x6f'),'value':_0x4c5383['attrWhatsappAccounts']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x9]?_0x4c5383['attrs'][0x9][_0x3ac9('0x5e')]:undefined)||''},{'name':_0x3ac9('0x70'),'value':_0x4c5383[_0x3ac9('0x70')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0xa]?_0x4c5383[_0x3ac9('0x5c')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x3ac9('0x74'),'type':_0x4c5383['reportType']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383['attrs'][0x0][_0x3ac9('0x75')]:undefined)||null,'value':_0x4c5383['attrReport']||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x0]?_0x4c5383[_0x3ac9('0x5c')][0x0][_0x3ac9('0x5e')]:undefined)||null},{'name':_0x3ac9('0x76'),'value':_0x4c5383[_0x3ac9('0x76')]||(_0x4c5383[_0x3ac9('0x5c')]&&_0x4c5383[_0x3ac9('0x5c')][0x1]?_0x4c5383['attrs'][0x1][_0x3ac9('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x1537f1){logger[_0x3ac9('0x2c')](_0x3ac9('0x77'),JSON['stringify'](_0x1537f1));return[];}}exports[_0x3ac9('0x78')]=function(_0x202698,_0x1535d3,_0x3c54b4){if(_0x202698[_0x3ac9('0x53')]['id']){delete _0x202698[_0x3ac9('0x53')]['id'];}return db[_0x3ac9('0x42')][_0x3ac9('0x58')]({'where':{'id':_0x202698['params']['id']}})['then'](handleEntityNotFound(_0x1535d3,null))[_0x3ac9('0x28')](function(_0x282c45){if(_0x282c45){_0x202698[_0x3ac9('0x53')][_0x3ac9('0x79')]=_0x282c45['id'];_0x202698[_0x3ac9('0x53')][_0x3ac9('0x5c')]=widgetAttributes(_0x202698[_0x3ac9('0x53')]);return db[_0x3ac9('0x7a')][_0x3ac9('0x4c')](_0x202698[_0x3ac9('0x53')]);}})[_0x3ac9('0x28')](respondWithResult(_0x1535d3,null))[_0x3ac9('0x47')](handleError(_0x1535d3,null));};exports[_0x3ac9('0x7b')]=function(_0x22ddea,_0x450416,_0x513bcd){var _0x29e631={};var _0x1a173a={};var _0x2b1a4d;var _0x3ab170;return db[_0x3ac9('0x42')][_0x3ac9('0x7c')]({'where':{'id':_0x22ddea[_0x3ac9('0x49')]['id']}})['then'](handleEntityNotFound(_0x450416,null))[_0x3ac9('0x28')](function(_0x5b87bb){if(_0x5b87bb){_0x2b1a4d=_0x5b87bb;_0x1a173a[_0x3ac9('0x37')]=_[_0x3ac9('0x34')](db[_0x3ac9('0x7a')][_0x3ac9('0x4a')]);_0x1a173a[_0x3ac9('0x33')]=_[_0x3ac9('0x34')](_0x22ddea[_0x3ac9('0x33')]);_0x1a173a[_0x3ac9('0x35')]=_['intersection'](_0x1a173a['model'],_0x1a173a[_0x3ac9('0x33')]);_0x29e631['attributes']=_[_0x3ac9('0x36')](_0x1a173a[_0x3ac9('0x37')],qs['fields'](_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x38')]));_0x29e631[_0x3ac9('0x39')]=_0x29e631[_0x3ac9('0x39')][_0x3ac9('0x3a')]?_0x29e631[_0x3ac9('0x39')]:_0x1a173a[_0x3ac9('0x37')];_0x29e631[_0x3ac9('0x3d')]=qs[_0x3ac9('0x3e')](_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x3e')]);_0x29e631[_0x3ac9('0x41')]=qs['filters'](_['pick'](_0x22ddea[_0x3ac9('0x33')],_0x1a173a[_0x3ac9('0x35')]));if(_0x22ddea['query'][_0x3ac9('0x3f')]){_0x29e631[_0x3ac9('0x41')]=_[_0x3ac9('0x40')](_0x29e631[_0x3ac9('0x41')],{'$or':_[_0x3ac9('0x30')](_0x29e631['attributes'],function(_0xc5d6f1){var _0x46b72e={};_0x46b72e[_0xc5d6f1]={'$like':'%'+_0x22ddea['query'][_0x3ac9('0x3f')]+'%'};return _0x46b72e;})});}_0x29e631=_[_0x3ac9('0x40')]({},_0x29e631,_0x22ddea[_0x3ac9('0x4b')]);return _0x2b1a4d[_0x3ac9('0x7b')](_0x29e631);}})[_0x3ac9('0x28')](function(_0x131eb1){if(_0x131eb1){_0x3ab170=_0x131eb1['length'];if(!_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x3b')]('nolimit')){_0x29e631[_0x3ac9('0x21')]=qs[_0x3ac9('0x21')](_0x22ddea['query'][_0x3ac9('0x21')]);_0x29e631[_0x3ac9('0x1f')]=qs[_0x3ac9('0x1f')](_0x22ddea[_0x3ac9('0x33')][_0x3ac9('0x1f')]);}return _0x2b1a4d[_0x3ac9('0x7b')](_0x29e631);}})[_0x3ac9('0x28')](function(_0x373a62){if(_0x373a62){return _0x373a62?{'count':_0x3ab170,'rows':_0x373a62}:null;}})[_0x3ac9('0x28')](respondWithResult(_0x450416,null))[_0x3ac9('0x47')](handleError(_0x450416,null));}; \ No newline at end of file +var _0x7094=['length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','params','filters','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','updatedAt','omit','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','order','nolimit','getItems','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','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/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','offset','undefined','limit','set','Content-Range','apply','update','then','destroy','UserProfileResource','sendStatus','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','name','keys','intersection','attributes','fields','query'];(function(_0x236450,_0x242e95){var _0x5ebe7b=function(_0x2280cc){while(--_0x2280cc){_0x236450['push'](_0x236450['shift']());}};_0x5ebe7b(++_0x242e95);}(_0x7094,0xd0));var _0x4709=function(_0x789d5b,_0x1f9369){_0x789d5b=_0x789d5b-0x0;var _0x39a0e1=_0x7094[_0x789d5b];return _0x39a0e1;};'use strict';var emlformat=require(_0x4709('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4709('0x1'));var jsonpatch=require(_0x4709('0x2'));var rp=require(_0x4709('0x3'));var moment=require(_0x4709('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4709('0x5'));var path=require('path');var sox=require(_0x4709('0x6'));var csv=require(_0x4709('0x7'));var ejs=require(_0x4709('0x8'));var fs=require('fs');var fs_extra=require(_0x4709('0x9'));var _=require(_0x4709('0xa'));var squel=require(_0x4709('0xb'));var crypto=require(_0x4709('0xc'));var jsforce=require(_0x4709('0xd'));var deskjs=require(_0x4709('0xe'));var toCsv=require(_0x4709('0x7'));var querystring=require(_0x4709('0xf'));var Papa=require(_0x4709('0x10'));var Redis=require(_0x4709('0x11'));var authService=require(_0x4709('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4709('0x13'));var hardwareService=require(_0x4709('0x14'));var logger=require(_0x4709('0x15'))(_0x4709('0x16'));var utils=require('../../config/utils');var config=require(_0x4709('0x17'));var licenseUtil=require(_0x4709('0x18'));var db=require(_0x4709('0x19'))['db'];config[_0x4709('0x1a')]=_['defaults'](config[_0x4709('0x1a')],{'host':_0x4709('0x1b'),'port':0x18eb});var socket=require(_0x4709('0x1c'))(new Redis(config[_0x4709('0x1a')]));require(_0x4709('0x1d'))[_0x4709('0x1e')](socket);function respondWithStatusCode(_0x110b36,_0x144735){_0x144735=_0x144735||0xcc;return function(_0x29ec9d){if(_0x29ec9d){return _0x110b36['sendStatus'](_0x144735);}return _0x110b36['status'](_0x144735)[_0x4709('0x1f')]();};}function respondWithResult(_0x29222b,_0x3a4928){_0x3a4928=_0x3a4928||0xc8;return function(_0x17ccc6){if(_0x17ccc6){return _0x29222b[_0x4709('0x20')](_0x3a4928)[_0x4709('0x21')](_0x17ccc6);}};}function respondWithFilteredResult(_0x5c54e8,_0x3c3eb5){return function(_0x17e067){if(_0x17e067){var _0x50f8f=typeof _0x3c3eb5[_0x4709('0x22')]==='undefined'&&typeof _0x3c3eb5['limit']===_0x4709('0x23');var _0x5a9d77=_0x17e067['count'];var _0x498e4d=_0x50f8f?0x0:_0x3c3eb5[_0x4709('0x22')];var _0xe5c7ac=_0x50f8f?_0x17e067['count']:_0x3c3eb5[_0x4709('0x22')]+_0x3c3eb5[_0x4709('0x24')];var _0x1ce2a9;if(_0xe5c7ac>=_0x5a9d77){_0xe5c7ac=_0x5a9d77;_0x1ce2a9=0xc8;}else{_0x1ce2a9=0xce;}_0x5c54e8['status'](_0x1ce2a9);return _0x5c54e8[_0x4709('0x25')](_0x4709('0x26'),_0x498e4d+'-'+_0xe5c7ac+'/'+_0x5a9d77)[_0x4709('0x21')](_0x17e067);}return null;};}function patchUpdates(_0x7d7e0d){return function(_0x2bd96a){try{jsonpatch[_0x4709('0x27')](_0x2bd96a,_0x7d7e0d,!![]);}catch(_0x2ec058){return BPromise['reject'](_0x2ec058);}return _0x2bd96a['save']();};}function saveUpdates(_0x44d879,_0xd04927){return function(_0x1919c6){if(_0x1919c6){return _0x1919c6[_0x4709('0x28')](_0x44d879)[_0x4709('0x29')](function(_0x31a1f3){return _0x31a1f3;});}return null;};}function removeEntity(_0x3e30eb,_0x969f07){return function(_0x1673ff){if(_0x1673ff){return _0x1673ff[_0x4709('0x2a')]()[_0x4709('0x29')](function(){var _0x48773c=_0x1673ff['get']({'plain':!![]});var _0x12027a='CustomDashboards';return db[_0x4709('0x2b')][_0x4709('0x2a')]({'where':{'type':_0x12027a,'resourceId':_0x48773c['id']}})[_0x4709('0x29')](function(){return _0x1673ff;});})[_0x4709('0x29')](function(){_0x3e30eb[_0x4709('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b3b1,_0x5218f3){return function(_0x223070){if(!_0x223070){_0x13b3b1[_0x4709('0x2c')](0x194);}return _0x223070;};}function handleError(_0x53dc30,_0x212209){_0x212209=_0x212209||0x1f4;return function(_0x5cb5eb){logger['error'](_0x5cb5eb['stack']);if(_0x5cb5eb['name']){delete _0x5cb5eb['name'];}_0x53dc30[_0x4709('0x20')](_0x212209)[_0x4709('0x2d')](_0x5cb5eb);};}exports[_0x4709('0x2e')]=function(_0x59e3b6,_0x3abbe5){var _0x37b1d9={},_0x2031e4={},_0x27fb42={'count':0x0,'rows':[]};var _0x11e06d=_[_0x4709('0x2f')](db[_0x4709('0x30')][_0x4709('0x31')],function(_0x4447e9){return{'name':_0x4447e9[_0x4709('0x32')],'type':_0x4447e9[_0x4709('0x33')][_0x4709('0x34')]};});_0x2031e4[_0x4709('0x35')]=_['map'](_0x11e06d,_0x4709('0x36'));_0x2031e4['query']=_[_0x4709('0x37')](_0x59e3b6['query']);_0x2031e4['filters']=_[_0x4709('0x38')](_0x2031e4[_0x4709('0x35')],_0x2031e4['query']);_0x37b1d9[_0x4709('0x39')]=_[_0x4709('0x38')](_0x2031e4['model'],qs[_0x4709('0x3a')](_0x59e3b6[_0x4709('0x3b')][_0x4709('0x3a')]));_0x37b1d9[_0x4709('0x39')]=_0x37b1d9[_0x4709('0x39')][_0x4709('0x3c')]?_0x37b1d9[_0x4709('0x39')]:_0x2031e4[_0x4709('0x35')];if(!_0x59e3b6[_0x4709('0x3b')][_0x4709('0x3d')]('nolimit')){_0x37b1d9[_0x4709('0x24')]=qs['limit'](_0x59e3b6[_0x4709('0x3b')]['limit']);_0x37b1d9[_0x4709('0x22')]=qs[_0x4709('0x22')](_0x59e3b6[_0x4709('0x3b')][_0x4709('0x22')]);}_0x37b1d9['order']=qs[_0x4709('0x3e')](_0x59e3b6[_0x4709('0x3b')]['sort']);_0x37b1d9[_0x4709('0x3f')]=qs['filters'](_[_0x4709('0x40')](_0x59e3b6[_0x4709('0x3b')],_0x2031e4['filters']),_0x11e06d);if(_0x59e3b6[_0x4709('0x3b')][_0x4709('0x41')]){_0x37b1d9[_0x4709('0x3f')]=_[_0x4709('0x42')](_0x37b1d9['where'],{'$or':_[_0x4709('0x2f')](_0x11e06d,function(_0x109b9b){if(_0x109b9b[_0x4709('0x33')]!==_0x4709('0x43')){var _0x1c67cb={};_0x1c67cb[_0x109b9b[_0x4709('0x36')]]={'$like':'%'+_0x59e3b6[_0x4709('0x3b')][_0x4709('0x41')]+'%'};return _0x1c67cb;}})});}_0x37b1d9=_[_0x4709('0x42')]({},_0x37b1d9,_0x59e3b6['options']);var _0x1d6cb4={'where':_0x37b1d9[_0x4709('0x3f')]};return db['Dashboard'][_0x4709('0x44')](_0x1d6cb4)['then'](function(_0x3f9b8d){_0x27fb42[_0x4709('0x44')]=_0x3f9b8d;if(_0x59e3b6['query'][_0x4709('0x45')]){_0x37b1d9['include']=[{'all':!![]}];}return db[_0x4709('0x30')][_0x4709('0x46')](_0x37b1d9);})[_0x4709('0x29')](function(_0x2cdba5){_0x27fb42[_0x4709('0x47')]=_0x2cdba5;return _0x27fb42;})[_0x4709('0x29')](respondWithFilteredResult(_0x3abbe5,_0x37b1d9))['catch'](handleError(_0x3abbe5,null));};exports[_0x4709('0x48')]=function(_0x4393bd,_0x29f17c){var _0x6dee30={'raw':![],'where':{'id':_0x4393bd[_0x4709('0x49')]['id']}},_0x62d792={};_0x62d792[_0x4709('0x35')]=_[_0x4709('0x37')](db[_0x4709('0x30')][_0x4709('0x31')]);_0x62d792[_0x4709('0x3b')]=_[_0x4709('0x37')](_0x4393bd[_0x4709('0x3b')]);_0x62d792[_0x4709('0x4a')]=_[_0x4709('0x38')](_0x62d792['model'],_0x62d792['query']);_0x6dee30[_0x4709('0x39')]=_[_0x4709('0x38')](_0x62d792['model'],qs[_0x4709('0x3a')](_0x4393bd[_0x4709('0x3b')]['fields']));_0x6dee30[_0x4709('0x39')]=_0x6dee30[_0x4709('0x39')][_0x4709('0x3c')]?_0x6dee30[_0x4709('0x39')]:_0x62d792[_0x4709('0x35')];if(_0x4393bd[_0x4709('0x3b')][_0x4709('0x45')]){_0x6dee30[_0x4709('0x4b')]=[{'all':!![]}];}_0x6dee30=_[_0x4709('0x42')]({},_0x6dee30,_0x4393bd['options']);return db[_0x4709('0x30')][_0x4709('0x4c')](_0x6dee30)['then'](handleEntityNotFound(_0x29f17c,null))[_0x4709('0x29')](respondWithResult(_0x29f17c,null))['catch'](handleError(_0x29f17c,null));};exports[_0x4709('0x4d')]=function(_0x4d9f22,_0x1c8087){return db[_0x4709('0x30')][_0x4709('0x4d')](_0x4d9f22[_0x4709('0x4e')],{})[_0x4709('0x29')](function(_0x6bea76){var _0x31a5aa=_0x4d9f22[_0x4709('0x4f')][_0x4709('0x50')]({'plain':!![]});if(!_0x31a5aa)throw new Error(_0x4709('0x51'));if(_0x31a5aa[_0x4709('0x52')]===_0x4709('0x4f')){var _0x56d485=_0x6bea76[_0x4709('0x50')]({'plain':!![]});var _0x5f303a='CustomDashboards';return db[_0x4709('0x53')][_0x4709('0x4c')]({'where':{'name':_0x5f303a,'userProfileId':_0x31a5aa[_0x4709('0x54')]},'raw':!![]})['then'](function(_0x459a84){if(_0x459a84&&_0x459a84[_0x4709('0x55')]===0x0){return db[_0x4709('0x2b')]['create']({'name':_0x56d485[_0x4709('0x36')],'resourceId':_0x56d485['id'],'type':_0x459a84[_0x4709('0x36')],'sectionId':_0x459a84['id']},{})[_0x4709('0x29')](function(){return _0x6bea76;});}else{return _0x6bea76;}})[_0x4709('0x56')](function(_0x4fdeb7){logger[_0x4709('0x57')](_0x4709('0x58'),_0x4fdeb7);throw _0x4fdeb7;});}return _0x6bea76;})['then'](respondWithResult(_0x1c8087,0xc9))[_0x4709('0x56')](handleError(_0x1c8087,null));};exports[_0x4709('0x59')]=function(_0x1793b8,_0x2dbe52){var _0x51dac3={'where':{'id':_0x1793b8['params']['id']}},_0xf06476={};_0xf06476[_0x4709('0x35')]=_[_0x4709('0x37')](db[_0x4709('0x30')][_0x4709('0x31')]);_0x51dac3[_0x4709('0x39')]=_[_0x4709('0x38')](_0xf06476[_0x4709('0x35')],qs[_0x4709('0x3a')](_0x1793b8[_0x4709('0x3b')]['fields']));_0x51dac3[_0x4709('0x39')]=_0x51dac3[_0x4709('0x39')][_0x4709('0x3c')]?_0x51dac3['attributes']:_0xf06476['model'];if(_0x1793b8['query'][_0x4709('0x45')]){_0x51dac3['include']=[{'all':!![]}];}_0x51dac3=_['merge']({},_0x51dac3,_0x1793b8[_0x4709('0x5a')]);return db[_0x4709('0x30')][_0x4709('0x4c')](_0x51dac3)[_0x4709('0x29')](handleEntityNotFound(_0x2dbe52,null))['then'](function(_0x52cad6){if(_0x52cad6){var _0x4ee949=_0x52cad6[_0x4709('0x50')]({'plain':!![]});_0x4ee949=qs['omit'](_0x4ee949,['id','createdAt',_0x4709('0x5b')]);_0x1793b8['body']=_[_0x4709('0x5c')](_0x1793b8[_0x4709('0x4e')],['id',_0x4709('0x5d'),_0x4709('0x5b')]);return db[_0x4709('0x30')]['create'](_['merge'](_0x4ee949,_0x1793b8['body']),{'include':_0x1793b8['query'][_0x4709('0x45')]?[{'all':!![]}]:undefined})[_0x4709('0x29')](function(_0x2d2834){var _0x39b486=_0x1793b8['user']['get']({'plain':!![]});if(!_0x39b486)throw new Error(_0x4709('0x51'));if(_0x39b486[_0x4709('0x52')]===_0x4709('0x4f')){var _0x3889c9=_0x2d2834[_0x4709('0x50')]({'plain':!![]});var _0x211d49='CustomDashboards';return db[_0x4709('0x53')]['find']({'where':{'name':_0x211d49,'userProfileId':_0x39b486[_0x4709('0x54')]},'raw':!![]})[_0x4709('0x29')](function(_0x709d8){if(_0x709d8&&_0x709d8[_0x4709('0x55')]===0x0){return db[_0x4709('0x2b')][_0x4709('0x4d')]({'name':_0x3889c9[_0x4709('0x36')],'resourceId':_0x3889c9['id'],'type':_0x709d8[_0x4709('0x36')],'sectionId':_0x709d8['id']},{})[_0x4709('0x29')](function(){return _0x2d2834;});}else{return _0x2d2834;}})[_0x4709('0x56')](function(_0x5996aa){logger[_0x4709('0x57')](_0x4709('0x58'),_0x5996aa);throw _0x5996aa;});}return _0x2d2834;});}})[_0x4709('0x29')](respondWithResult(_0x2dbe52,0xc9))[_0x4709('0x56')](handleError(_0x2dbe52,null));};exports[_0x4709('0x28')]=function(_0x3005d8,_0x57d119){if(_0x3005d8[_0x4709('0x4e')]['id']){delete _0x3005d8[_0x4709('0x4e')]['id'];}return db[_0x4709('0x30')][_0x4709('0x4c')]({'where':{'id':_0x3005d8['params']['id']}})[_0x4709('0x29')](handleEntityNotFound(_0x57d119,null))[_0x4709('0x29')](saveUpdates(_0x3005d8[_0x4709('0x4e')],null))[_0x4709('0x29')](respondWithResult(_0x57d119,null))['catch'](handleError(_0x57d119,null));};exports[_0x4709('0x2a')]=function(_0x42ee71,_0x5cea04){return db[_0x4709('0x30')][_0x4709('0x4c')]({'where':{'id':_0x42ee71[_0x4709('0x49')]['id']}})[_0x4709('0x29')](handleEntityNotFound(_0x5cea04,null))[_0x4709('0x29')](removeEntity(_0x5cea04,null))['catch'](handleError(_0x5cea04,null));};function widgetAttributes(_0x4cb53a){try{switch(_0x4cb53a[_0x4709('0x33')]){case _0x4709('0x5e'):return[{'name':_0x4709('0x5f'),'value':_0x4cb53a[_0x4709('0x5f')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x0]?_0x4cb53a[_0x4709('0x60')][0x0][_0x4709('0x61')]:undefined)||_0x4709('0x62')}];case _0x4709('0x63'):return[{'name':_0x4709('0x64'),'value':_0x4cb53a['attrPath']||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x0]?_0x4cb53a[_0x4709('0x60')][0x0][_0x4709('0x61')]:undefined)||''}];case _0x4709('0x65'):return[{'name':_0x4709('0x66'),'value':_0x4cb53a[_0x4709('0x66')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x0]?_0x4cb53a[_0x4709('0x60')][0x0][_0x4709('0x61')]:undefined)||_0x4709('0x67')},{'name':_0x4709('0x68'),'value':_0x4cb53a[_0x4709('0x68')]||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0x1]?_0x4cb53a[_0x4709('0x60')][0x1][_0x4709('0x61')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x4cb53a[_0x4709('0x69')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x2]?_0x4cb53a['attrs'][0x2][_0x4709('0x61')]:undefined)||0xc}];case _0x4709('0x6a'):return[{'name':_0x4709('0x6b'),'value':_0x4cb53a['attrMetric']||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x0]?_0x4cb53a['attrs'][0x0][_0x4709('0x61')]:undefined)||_0x4709('0x6c')},{'name':_0x4709('0x6d'),'value':_0x4cb53a[_0x4709('0x6d')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x1]?_0x4cb53a[_0x4709('0x60')][0x1][_0x4709('0x61')]:undefined)||[]},{'name':'attrFontSize','value':_0x4cb53a[_0x4709('0x69')]||(_0x4cb53a['attrs']&&_0x4cb53a['attrs'][0x2]?_0x4cb53a[_0x4709('0x60')][0x2][_0x4709('0x61')]:undefined)||0x14},{'name':_0x4709('0x6e'),'value':_0x4cb53a[_0x4709('0x6e')]||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0x3]?_0x4cb53a[_0x4709('0x60')][0x3]['value']:undefined)||_0x4709('0x6f')},{'name':_0x4709('0x70'),'value':_0x4cb53a['attrEmailAccounts']||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x4]?_0x4cb53a[_0x4709('0x60')][0x4][_0x4709('0x61')]:undefined)||''},{'name':_0x4709('0x71'),'value':_0x4cb53a[_0x4709('0x71')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x5]?_0x4cb53a[_0x4709('0x60')][0x5][_0x4709('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4cb53a['attrSmsAccounts']||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0x6]?_0x4cb53a[_0x4709('0x60')][0x6][_0x4709('0x61')]:undefined)||''},{'name':_0x4709('0x72'),'value':_0x4cb53a[_0x4709('0x72')]||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0x7]?_0x4cb53a[_0x4709('0x60')][0x7]['value']:undefined)||''},{'name':_0x4709('0x73'),'value':_0x4cb53a[_0x4709('0x73')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x8]?_0x4cb53a['attrs'][0x8][_0x4709('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4cb53a[_0x4709('0x74')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x9]?_0x4cb53a[_0x4709('0x60')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x4709('0x75'):return[{'name':_0x4709('0x76'),'value':_0x4cb53a['attrSerie1']||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x0]?_0x4cb53a[_0x4709('0x60')][0x0]['value']:undefined)||_0x4709('0x6c')},{'name':_0x4709('0x77'),'value':_0x4cb53a[_0x4709('0x77')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x1]?_0x4cb53a[_0x4709('0x60')][0x1]['value']:undefined)||null},{'name':_0x4709('0x78'),'value':_0x4cb53a[_0x4709('0x78')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x2]?_0x4cb53a[_0x4709('0x60')][0x2][_0x4709('0x61')]:undefined)||null},{'name':_0x4709('0x6d'),'value':_0x4cb53a['attrVoiceQueues']||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x3]?_0x4cb53a['attrs'][0x3][_0x4709('0x61')]:undefined)||[]},{'name':_0x4709('0x6e'),'value':_0x4cb53a[_0x4709('0x6e')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x4]?_0x4cb53a[_0x4709('0x60')][0x4]['value']:undefined)||_0x4709('0x6f')},{'name':_0x4709('0x70'),'value':_0x4cb53a[_0x4709('0x70')]||(_0x4cb53a['attrs']&&_0x4cb53a['attrs'][0x5]?_0x4cb53a['attrs'][0x5][_0x4709('0x61')]:undefined)||''},{'name':_0x4709('0x71'),'value':_0x4cb53a[_0x4709('0x71')]||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0x6]?_0x4cb53a[_0x4709('0x60')][0x6][_0x4709('0x61')]:undefined)||''},{'name':_0x4709('0x79'),'value':_0x4cb53a[_0x4709('0x79')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x7]?_0x4cb53a[_0x4709('0x60')][0x7][_0x4709('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4cb53a[_0x4709('0x72')]||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0x8]?_0x4cb53a[_0x4709('0x60')][0x8][_0x4709('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4cb53a[_0x4709('0x73')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x9]?_0x4cb53a[_0x4709('0x60')][0x9]['value']:undefined)||''},{'name':_0x4709('0x74'),'value':_0x4cb53a[_0x4709('0x74')]||(_0x4cb53a['attrs']&&_0x4cb53a[_0x4709('0x60')][0xa]?_0x4cb53a['attrs'][0xa][_0x4709('0x61')]:undefined)||''}];case _0x4709('0x7a'):return[{'name':_0x4709('0x7b'),'type':_0x4cb53a[_0x4709('0x7c')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a['attrs'][0x0]?_0x4cb53a[_0x4709('0x60')][0x0][_0x4709('0x33')]:undefined)||null,'value':_0x4cb53a[_0x4709('0x7b')]||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x0]?_0x4cb53a[_0x4709('0x60')][0x0][_0x4709('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x4cb53a['attrRefresh']||(_0x4cb53a[_0x4709('0x60')]&&_0x4cb53a[_0x4709('0x60')][0x1]?_0x4cb53a[_0x4709('0x60')][0x1][_0x4709('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4d0874){logger['error'](_0x4709('0x7d'),JSON[_0x4709('0x7e')](_0x4d0874));return[];}}exports[_0x4709('0x7f')]=function(_0x499e5d,_0x2136b6,_0x2d60d1){if(_0x499e5d[_0x4709('0x4e')]['id']){delete _0x499e5d[_0x4709('0x4e')]['id'];}return db[_0x4709('0x30')]['find']({'where':{'id':_0x499e5d[_0x4709('0x49')]['id']}})[_0x4709('0x29')](handleEntityNotFound(_0x2136b6,null))['then'](function(_0xb488e1){if(_0xb488e1){_0x499e5d['body'][_0x4709('0x80')]=_0xb488e1['id'];_0x499e5d['body']['attrs']=widgetAttributes(_0x499e5d['body']);return db[_0x4709('0x81')][_0x4709('0x4d')](_0x499e5d[_0x4709('0x4e')]);}})[_0x4709('0x29')](respondWithResult(_0x2136b6,null))['catch'](handleError(_0x2136b6,null));};exports['getItems']=function(_0x59be4f,_0x429845,_0x3b4747){var _0x3de5a7={};var _0x482b52={};var _0x5423c8;var _0xeae872;return db[_0x4709('0x30')][_0x4709('0x82')]({'where':{'id':_0x59be4f[_0x4709('0x49')]['id']}})[_0x4709('0x29')](handleEntityNotFound(_0x429845,null))[_0x4709('0x29')](function(_0x6ae8ac){if(_0x6ae8ac){_0x5423c8=_0x6ae8ac;_0x482b52[_0x4709('0x35')]=_[_0x4709('0x37')](db['DashboardItem'][_0x4709('0x31')]);_0x482b52[_0x4709('0x3b')]=_[_0x4709('0x37')](_0x59be4f[_0x4709('0x3b')]);_0x482b52['filters']=_[_0x4709('0x38')](_0x482b52[_0x4709('0x35')],_0x482b52[_0x4709('0x3b')]);_0x3de5a7[_0x4709('0x39')]=_[_0x4709('0x38')](_0x482b52[_0x4709('0x35')],qs[_0x4709('0x3a')](_0x59be4f[_0x4709('0x3b')][_0x4709('0x3a')]));_0x3de5a7['attributes']=_0x3de5a7[_0x4709('0x39')][_0x4709('0x3c')]?_0x3de5a7[_0x4709('0x39')]:_0x482b52[_0x4709('0x35')];_0x3de5a7[_0x4709('0x83')]=qs[_0x4709('0x3e')](_0x59be4f[_0x4709('0x3b')][_0x4709('0x3e')]);_0x3de5a7['where']=qs[_0x4709('0x4a')](_[_0x4709('0x40')](_0x59be4f[_0x4709('0x3b')],_0x482b52[_0x4709('0x4a')]));if(_0x59be4f['query'][_0x4709('0x41')]){_0x3de5a7['where']=_[_0x4709('0x42')](_0x3de5a7[_0x4709('0x3f')],{'$or':_['map'](_0x3de5a7['attributes'],function(_0x202029){var _0x2ee899={};_0x2ee899[_0x202029]={'$like':'%'+_0x59be4f['query'][_0x4709('0x41')]+'%'};return _0x2ee899;})});}_0x3de5a7=_[_0x4709('0x42')]({},_0x3de5a7,_0x59be4f['options']);return _0x5423c8['getItems'](_0x3de5a7);}})[_0x4709('0x29')](function(_0x2119fe){if(_0x2119fe){_0xeae872=_0x2119fe[_0x4709('0x3c')];if(!_0x59be4f[_0x4709('0x3b')][_0x4709('0x3d')](_0x4709('0x84'))){_0x3de5a7[_0x4709('0x24')]=qs[_0x4709('0x24')](_0x59be4f[_0x4709('0x3b')]['limit']);_0x3de5a7[_0x4709('0x22')]=qs[_0x4709('0x22')](_0x59be4f[_0x4709('0x3b')][_0x4709('0x22')]);}return _0x5423c8[_0x4709('0x85')](_0x3de5a7);}})['then'](function(_0x3235f1){if(_0x3235f1){return _0x3235f1?{'count':_0xeae872,'rows':_0x3235f1}:null;}})[_0x4709('0x29')](respondWithResult(_0x429845,null))[_0x4709('0x56')](handleError(_0x429845,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index eb35a17..ad09416 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 _0x42ec=['hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x2cb4cc,_0x1042c9){var _0x54bca9=function(_0x2583f7){while(--_0x2583f7){_0x2cb4cc['push'](_0x2cb4cc['shift']());}};_0x54bca9(++_0x1042c9);}(_0x42ec,0x1e8));var _0xc42e=function(_0x10436f,_0x49ebc5){_0x10436f=_0x10436f-0x0;var _0x14d081=_0x42ec[_0x10436f];return _0x14d081;};'use strict';var EventEmitter=require(_0xc42e('0x0'));var Dashboard=require(_0xc42e('0x1'))['db'][_0xc42e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc42e('0x3')](0x0);var events={'afterCreate':_0xc42e('0x4'),'afterUpdate':'update','afterDestroy':_0xc42e('0x5')};function emitEvent(_0x49a4c9){return function(_0x107a41,_0x2f1f54,_0x2baaa9){DashboardEvents[_0xc42e('0x6')](_0x49a4c9+':'+_0x107a41['id'],_0x107a41);DashboardEvents['emit'](_0x49a4c9,_0x107a41);_0x2baaa9(null);};}for(var e in events){if(events[_0xc42e('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc42e('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb5f8=['events','../../mysqldb','Dashboard','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x483d2a,_0x4bffba){var _0x5ba5d5=function(_0x33e56a){while(--_0x33e56a){_0x483d2a['push'](_0x483d2a['shift']());}};_0x5ba5d5(++_0x4bffba);}(_0xb5f8,0x168));var _0x8b5f=function(_0x367d88,_0x2e288f){_0x367d88=_0x367d88-0x0;var _0x30de82=_0xb5f8[_0x367d88];return _0x30de82;};'use strict';var EventEmitter=require(_0x8b5f('0x0'));var Dashboard=require(_0x8b5f('0x1'))['db'][_0x8b5f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8b5f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b5f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3047a7){return function(_0xb70eb8,_0x46e6b5,_0xe1a7d0){DashboardEvents['emit'](_0x3047a7+':'+_0xb70eb8['id'],_0xb70eb8);DashboardEvents[_0x8b5f('0x5')](_0x3047a7,_0xb70eb8);_0xe1a7d0(null);};}for(var e in events){if(events[_0x8b5f('0x6')](e)){var event=events[e];Dashboard[_0x8b5f('0x7')](e,emitEvent(event));}}module[_0x8b5f('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 f54b865..09c972c 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 _0xf451=['define','dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x24cefa,_0x4d34d1){var _0x27cbdd=function(_0xd74a15){while(--_0xd74a15){_0x24cefa['push'](_0x24cefa['shift']());}};_0x27cbdd(++_0x4d34d1);}(_0xf451,0x161));var _0x1f45=function(_0x3d4080,_0x5a2514){_0x3d4080=_0x3d4080-0x0;var _0x1c3583=_0xf451[_0x3d4080];return _0x1c3583;};'use strict';var _=require(_0x1f45('0x0'));var util=require(_0x1f45('0x1'));var logger=require(_0x1f45('0x2'))(_0x1f45('0x3'));var moment=require('moment');var BPromise=require(_0x1f45('0x4'));var rp=require(_0x1f45('0x5'));var fs=require('fs');var path=require(_0x1f45('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x4a3c60,_0x3436b8){return _0x4a3c60[_0x1f45('0x7')]('Dashboard',attributes,{'tableName':_0x1f45('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd44f=['define','Dashboard','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x22b4df,_0x2971f3){var _0xb778a6=function(_0x355607){while(--_0x355607){_0x22b4df['push'](_0x22b4df['shift']());}};_0xb778a6(++_0x2971f3);}(_0xd44f,0x1c4));var _0xfd44=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xd44f[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd44('0x0'))('api');var moment=require(_0xfd44('0x1'));var BPromise=require(_0xfd44('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd44('0x3'));var rimraf=require(_0xfd44('0x4'));var config=require(_0xfd44('0x5'));var attributes=require('./dashboard.attributes');module[_0xfd44('0x6')]=function(_0x1a9bec,_0xda2abf){return _0x1a9bec[_0xfd44('0x7')](_0xfd44('0x8'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 18ac5b2..d7ee017 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 _0xc97d=['localhost','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0xc97d,0x12a));var _0xdc97=function(_0x46c00f,_0x33cf04){_0x46c00f=_0x46c00f-0x0;var _0x2a6462=_0xc97d[_0x46c00f];return _0x2a6462;};'use strict';var _=require(_0xdc97('0x0'));var util=require(_0xdc97('0x1'));var moment=require(_0xdc97('0x2'));var BPromise=require(_0xdc97('0x3'));var rs=require(_0xdc97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc97('0x5'))['db'];var utils=require(_0xdc97('0x6'));var logger=require('../../config/logger')(_0xdc97('0x7'));var config=require(_0xdc97('0x8'));var jayson=require(_0xdc97('0x9'));var client=jayson[_0xdc97('0xa')][_0xdc97('0xb')]({'port':0x232a});config[_0xdc97('0xc')]=_[_0xdc97('0xd')](config[_0xdc97('0xc')],{'host':_0xdc97('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc97('0xc')]));require('./dashboard.socket')[_0xdc97('0xf')](socket);function respondWithRpcPromise(_0x4da10e,_0x333d32,_0x2096e7){return new BPromise(function(_0x507c67,_0x31bcb8){return client[_0xdc97('0x10')](_0x4da10e,_0x2096e7)[_0xdc97('0x11')](function(_0x28fcb4){logger['info'](_0xdc97('0x12'),_0x333d32,_0xdc97('0x13'));logger['debug'](_0xdc97('0x14'),_0x333d32,'request\x20sent',JSON[_0xdc97('0x15')](_0x28fcb4));if(_0x28fcb4[_0xdc97('0x16')]){if(_0x28fcb4[_0xdc97('0x16')]['code']===0x1f4){logger[_0xdc97('0x16')](_0xdc97('0x12'),_0x333d32,_0x28fcb4[_0xdc97('0x16')][_0xdc97('0x17')]);return _0x31bcb8(_0x28fcb4[_0xdc97('0x16')]['message']);}logger[_0xdc97('0x16')](_0xdc97('0x12'),_0x333d32,_0x28fcb4['error'][_0xdc97('0x17')]);return _0x507c67(_0x28fcb4['error'][_0xdc97('0x17')]);}else{logger['info'](_0xdc97('0x12'),_0x333d32,'request\x20sent');_0x507c67(_0x28fcb4[_0xdc97('0x18')][_0xdc97('0x17')]);}})[_0xdc97('0x19')](function(_0x42f260){logger[_0xdc97('0x16')]('Dashboard,\x20%s,\x20%s',_0x333d32,_0x42f260);_0x31bcb8(_0x42f260);});});} \ No newline at end of file +var _0x4dfa=['../../config/environment','http','redis','defaults','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','ioredis','rpc'];(function(_0x408b9c,_0x2e922b){var _0x56be70=function(_0x31726b){while(--_0x31726b){_0x408b9c['push'](_0x408b9c['shift']());}};_0x56be70(++_0x2e922b);}(_0x4dfa,0xec));var _0xa4df=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4dfa[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xa4df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa4df('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4df('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa4df('0x3'));var config=require(_0xa4df('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa4df('0x5')]({'port':0x232a});config[_0xa4df('0x6')]=_[_0xa4df('0x7')](config[_0xa4df('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xa4df('0x8')](socket);function respondWithRpcPromise(_0x4cc832,_0x1ce9ef,_0x5cd317){return new BPromise(function(_0x59caaa,_0x446d4a){return client[_0xa4df('0x9')](_0x4cc832,_0x5cd317)['then'](function(_0xf4ce10){logger['info'](_0xa4df('0xa'),_0x1ce9ef,_0xa4df('0xb'));logger[_0xa4df('0xc')](_0xa4df('0xd'),_0x1ce9ef,_0xa4df('0xb'),JSON[_0xa4df('0xe')](_0xf4ce10));if(_0xf4ce10[_0xa4df('0xf')]){if(_0xf4ce10[_0xa4df('0xf')][_0xa4df('0x10')]===0x1f4){logger[_0xa4df('0xf')](_0xa4df('0xa'),_0x1ce9ef,_0xf4ce10[_0xa4df('0xf')][_0xa4df('0x11')]);return _0x446d4a(_0xf4ce10[_0xa4df('0xf')][_0xa4df('0x11')]);}logger[_0xa4df('0xf')](_0xa4df('0xa'),_0x1ce9ef,_0xf4ce10['error'][_0xa4df('0x11')]);return _0x59caaa(_0xf4ce10['error']['message']);}else{logger[_0xa4df('0x12')](_0xa4df('0xa'),_0x1ce9ef,_0xa4df('0xb'));_0x59caaa(_0xf4ce10[_0xa4df('0x13')][_0xa4df('0x11')]);}})['catch'](function(_0x56c369){logger[_0xa4df('0xf')](_0xa4df('0xa'),_0x1ce9ef,_0x56c369);_0x446d4a(_0x56c369);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a956d11..f027e51 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 _0xbff2=['removeListener','register','length','dashboard:','./dashboard.events','save','update','emit'];(function(_0x2ca765,_0x216da4){var _0x5d20b9=function(_0x1b357d){while(--_0x1b357d){_0x2ca765['push'](_0x2ca765['shift']());}};_0x5d20b9(++_0x216da4);}(_0xbff2,0x194));var _0x2bff=function(_0x2c49c2,_0x470653){_0x2c49c2=_0x2c49c2-0x0;var _0x2e15cf=_0xbff2[_0x2c49c2];return _0x2e15cf;};'use strict';var DashboardEvents=require(_0x2bff('0x0'));var events=[_0x2bff('0x1'),'remove',_0x2bff('0x2')];function createListener(_0x4aaad4,_0x552321){return function(_0xb34fd5){_0x552321[_0x2bff('0x3')](_0x4aaad4,_0xb34fd5);};}function removeListener(_0x37e97c,_0x59e16b){return function(){DashboardEvents[_0x2bff('0x4')](_0x37e97c,_0x59e16b);};}exports[_0x2bff('0x5')]=function(_0x241022){for(var _0x37ed80=0x0,_0x37a7e7=events[_0x2bff('0x6')];_0x37ed80<_0x37a7e7;_0x37ed80++){var _0x1ee59f=events[_0x37ed80];var _0x5eeb30=createListener(_0x2bff('0x7')+_0x1ee59f,_0x241022);DashboardEvents['on'](_0x1ee59f,_0x5eeb30);}}; \ No newline at end of file +var _0xeb7a=['removeListener','register','length','dashboard:','remove','update'];(function(_0x17dc92,_0x2e9db7){var _0x517303=function(_0x597fd0){while(--_0x597fd0){_0x17dc92['push'](_0x17dc92['shift']());}};_0x517303(++_0x2e9db7);}(_0xeb7a,0x166));var _0xaeb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb7a[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xaeb7('0x0'),_0xaeb7('0x1')];function createListener(_0x303e52,_0x57ae03){return function(_0x12a2eb){_0x57ae03['emit'](_0x303e52,_0x12a2eb);};}function removeListener(_0x54f1d5,_0x17edba){return function(){DashboardEvents[_0xaeb7('0x2')](_0x54f1d5,_0x17edba);};}exports[_0xaeb7('0x3')]=function(_0x55931f){for(var _0x348523=0x0,_0xccabf3=events[_0xaeb7('0x4')];_0x348523<_0xccabf3;_0x348523++){var _0x144c6d=events[_0x348523];var _0x3a0453=createListener(_0xaeb7('0x5')+_0x144c6d,_0x55931f);DashboardEvents['on'](_0x144c6d,_0x3a0453);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 65aacea..815471a 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 _0xb8e0=['destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete'];(function(_0x21a8b3,_0x92dbb5){var _0x117c35=function(_0x1f1f9b){while(--_0x1f1f9b){_0x21a8b3['push'](_0x21a8b3['shift']());}};_0x117c35(++_0x92dbb5);}(_0xb8e0,0x8c));var _0x0b8e=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0xb8e0[_0x2bddf9];return _0x3f3ae9;};'use strict';var multer=require(_0x0b8e('0x0'));var util=require(_0x0b8e('0x1'));var path=require('path');var timeout=require(_0x0b8e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0b8e('0x3'));var auth=require(_0x0b8e('0x4'));var interaction=require(_0x0b8e('0x5'));var config=require('../../config/environment');var controller=require(_0x0b8e('0x6'));router['get']('/',auth[_0x0b8e('0x7')](),controller[_0x0b8e('0x8')]);router[_0x0b8e('0x9')](_0x0b8e('0xa'),auth[_0x0b8e('0x7')](),controller[_0x0b8e('0xb')]);router['get'](_0x0b8e('0xc'),auth[_0x0b8e('0x7')](),controller[_0x0b8e('0xd')]);router[_0x0b8e('0xe')]('/',auth[_0x0b8e('0x7')](),controller['create']);router['post'](_0x0b8e('0xf'),auth[_0x0b8e('0x7')](),controller[_0x0b8e('0x10')]);router[_0x0b8e('0xe')]('/:id/items',auth['isAuthenticated'](),controller[_0x0b8e('0x11')]);router[_0x0b8e('0x12')](_0x0b8e('0xa'),auth['isAuthenticated'](),controller[_0x0b8e('0x13')]);router[_0x0b8e('0x14')](_0x0b8e('0xa'),auth['isAuthenticated'](),controller[_0x0b8e('0x15')]);module[_0x0b8e('0x16')]=router; \ No newline at end of file +var _0x708e=['post','create','clone','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items'];(function(_0xe1c518,_0x400c45){var _0x5c1b90=function(_0x589c11){while(--_0x589c11){_0xe1c518['push'](_0xe1c518['shift']());}};_0x5c1b90(++_0x400c45);}(_0x708e,0x9b));var _0xe708=function(_0x33f31b,_0x550ae9){_0x33f31b=_0x33f31b-0x0;var _0x33514e=_0x708e[_0x33f31b];return _0x33514e;};'use strict';var multer=require(_0xe708('0x0'));var util=require('util');var path=require(_0xe708('0x1'));var timeout=require('connect-timeout');var express=require(_0xe708('0x2'));var router=express[_0xe708('0x3')]();var fs_extra=require(_0xe708('0x4'));var auth=require(_0xe708('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe708('0x6'));var controller=require(_0xe708('0x7'));router[_0xe708('0x8')]('/',auth[_0xe708('0x9')](),controller[_0xe708('0xa')]);router[_0xe708('0x8')](_0xe708('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe708('0x8')](_0xe708('0xc'),auth[_0xe708('0x9')](),controller['getItems']);router[_0xe708('0xd')]('/',auth[_0xe708('0x9')](),controller[_0xe708('0xe')]);router[_0xe708('0xd')]('/:id/clone',auth[_0xe708('0x9')](),controller[_0xe708('0xf')]);router[_0xe708('0xd')](_0xe708('0xc'),auth[_0xe708('0x9')](),controller['addItem']);router[_0xe708('0x10')]('/:id',auth[_0xe708('0x9')](),controller[_0xe708('0x11')]);router[_0xe708('0x12')](_0xe708('0xb'),auth[_0xe708('0x9')](),controller[_0xe708('0x13')]);module[_0xe708('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index aa9d30b..7d4015f 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x1f9184,_0x2fc942){var _0x3a548d=function(_0x5c6020){while(--_0x5c6020){_0x1f9184['push'](_0x1f9184['shift']());}};_0x3a548d(++_0x2fc942);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x1125e8,_0x3c2e35){var _0x29cab3=function(_0x5e5bb6){while(--_0x5e5bb6){_0x1125e8['push'](_0x1125e8['shift']());}};_0x29cab3(++_0x3c2e35);}(_0x2ef3,0xba));var _0x32ef=function(_0x1bc95f,_0x24ed3d){_0x1bc95f=_0x1bc95f-0x0;var _0x255368=_0x2ef3[_0x1bc95f];return _0x255368;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'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 516caa9..96ef2e0 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 _0xa899=['keys','DashboardItem','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','voice','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','end','error','stack','name','send','show','model'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xa899,0x155));var _0x9a89=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0xa899[_0x15a634];return _0xf4f7a0;};'use strict';var emlformat=require(_0x9a89('0x0'));var rimraf=require(_0x9a89('0x1'));var zipdir=require(_0x9a89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a89('0x3'));var moment=require(_0x9a89('0x4'));var BPromise=require(_0x9a89('0x5'));var Mustache=require(_0x9a89('0x6'));var util=require(_0x9a89('0x7'));var path=require(_0x9a89('0x8'));var sox=require(_0x9a89('0x9'));var csv=require(_0x9a89('0xa'));var ejs=require(_0x9a89('0xb'));var fs=require('fs');var fs_extra=require(_0x9a89('0xc'));var _=require(_0x9a89('0xd'));var squel=require(_0x9a89('0xe'));var crypto=require(_0x9a89('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a89('0xa'));var querystring=require(_0x9a89('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a89('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a89('0x12'));var as=require(_0x9a89('0x13'));var hardwareService=require(_0x9a89('0x14'));var logger=require(_0x9a89('0x15'))(_0x9a89('0x16'));var utils=require(_0x9a89('0x17'));var config=require(_0x9a89('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9a89('0x19')]=_[_0x9a89('0x1a')](config[_0x9a89('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a89('0x1b'))[_0x9a89('0x1c')](socket);function respondWithStatusCode(_0x5720a2,_0x187616){_0x187616=_0x187616||0xcc;return function(_0x427569){if(_0x427569){return _0x5720a2[_0x9a89('0x1d')](_0x187616);}return _0x5720a2[_0x9a89('0x1e')](_0x187616)['end']();};}function respondWithResult(_0x11a933,_0x3fe542){_0x3fe542=_0x3fe542||0xc8;return function(_0x5adef3){if(_0x5adef3){return _0x11a933['status'](_0x3fe542)[_0x9a89('0x1f')](_0x5adef3);}};}function respondWithFilteredResult(_0x4a15f1,_0xba2eaa){return function(_0x334725){if(_0x334725){var _0x53db7f=typeof _0xba2eaa[_0x9a89('0x20')]==='undefined'&&typeof _0xba2eaa[_0x9a89('0x21')]===_0x9a89('0x22');var _0x54c45d=_0x334725[_0x9a89('0x23')];var _0x3759cb=_0x53db7f?0x0:_0xba2eaa[_0x9a89('0x20')];var _0x1619e0=_0x53db7f?_0x334725[_0x9a89('0x23')]:_0xba2eaa[_0x9a89('0x20')]+_0xba2eaa[_0x9a89('0x21')];var _0x1548db;if(_0x1619e0>=_0x54c45d){_0x1619e0=_0x54c45d;_0x1548db=0xc8;}else{_0x1548db=0xce;}_0x4a15f1['status'](_0x1548db);return _0x4a15f1['set'](_0x9a89('0x24'),_0x3759cb+'-'+_0x1619e0+'/'+_0x54c45d)[_0x9a89('0x1f')](_0x334725);}return null;};}function patchUpdates(_0xea8910){return function(_0x2e83aa){try{jsonpatch[_0x9a89('0x25')](_0x2e83aa,_0xea8910,!![]);}catch(_0x3cc288){return BPromise['reject'](_0x3cc288);}return _0x2e83aa['save']();};}function saveUpdates(_0x42c5ee,_0x4f99e9){return function(_0x3f5723){if(_0x3f5723){return _0x3f5723[_0x9a89('0x26')](_0x42c5ee)[_0x9a89('0x27')](function(_0x3b1807){return _0x3b1807;});}return null;};}function removeEntity(_0x423a1d,_0x35032a){return function(_0x3ab9e5){if(_0x3ab9e5){return _0x3ab9e5['destroy']()[_0x9a89('0x27')](function(){_0x423a1d['status'](0xcc)[_0x9a89('0x28')]();});}};}function handleEntityNotFound(_0x5a888b,_0x5817e4){return function(_0x340999){if(!_0x340999){_0x5a888b[_0x9a89('0x1d')](0x194);}return _0x340999;};}function handleError(_0x4aa0b1,_0x11c397){_0x11c397=_0x11c397||0x1f4;return function(_0x5abe70){logger[_0x9a89('0x29')](_0x5abe70[_0x9a89('0x2a')]);if(_0x5abe70[_0x9a89('0x2b')]){delete _0x5abe70[_0x9a89('0x2b')];}_0x4aa0b1[_0x9a89('0x1e')](_0x11c397)[_0x9a89('0x2c')](_0x5abe70);};}exports[_0x9a89('0x2d')]=function(_0x5e5751,_0x4df9f2){var _0x48f05d={'raw':![],'where':{'id':_0x5e5751['params']['id']}},_0x44e2fd={};_0x44e2fd[_0x9a89('0x2e')]=_[_0x9a89('0x2f')](db[_0x9a89('0x30')]['rawAttributes']);_0x44e2fd[_0x9a89('0x31')]=_['keys'](_0x5e5751[_0x9a89('0x31')]);_0x44e2fd[_0x9a89('0x32')]=_[_0x9a89('0x33')](_0x44e2fd[_0x9a89('0x2e')],_0x44e2fd[_0x9a89('0x31')]);_0x48f05d['attributes']=_[_0x9a89('0x33')](_0x44e2fd[_0x9a89('0x2e')],qs[_0x9a89('0x34')](_0x5e5751[_0x9a89('0x31')][_0x9a89('0x34')]));_0x48f05d[_0x9a89('0x35')]=_0x48f05d[_0x9a89('0x35')][_0x9a89('0x36')]?_0x48f05d[_0x9a89('0x35')]:_0x44e2fd['model'];if(_0x5e5751[_0x9a89('0x31')][_0x9a89('0x37')]){_0x48f05d[_0x9a89('0x38')]=[{'all':!![]}];}_0x48f05d=_[_0x9a89('0x39')]({},_0x48f05d,_0x5e5751[_0x9a89('0x3a')]);return db[_0x9a89('0x30')][_0x9a89('0x3b')](_0x48f05d)[_0x9a89('0x27')](handleEntityNotFound(_0x4df9f2,null))[_0x9a89('0x27')](respondWithResult(_0x4df9f2,null))[_0x9a89('0x3c')](handleError(_0x4df9f2,null));};exports['destroy']=function(_0x587f4d,_0x45d51e){return db[_0x9a89('0x30')][_0x9a89('0x3b')]({'where':{'id':_0x587f4d[_0x9a89('0x3d')]['id']}})[_0x9a89('0x27')](handleEntityNotFound(_0x45d51e,null))[_0x9a89('0x27')](removeEntity(_0x45d51e,null))[_0x9a89('0x3c')](handleError(_0x45d51e,null));};function widgetAttributes(_0x18f4bb){try{switch(_0x18f4bb[_0x9a89('0x3e')]){case _0x9a89('0x3f'):return[{'name':_0x9a89('0x40'),'value':_0x18f4bb['attrUrl']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0][_0x9a89('0x42')]:undefined)||_0x9a89('0x43')}];case _0x9a89('0x44'):return[{'name':_0x9a89('0x45'),'value':_0x18f4bb[_0x9a89('0x45')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||''}];case _0x9a89('0x46'):return[{'name':_0x9a89('0x47'),'value':_0x18f4bb[_0x9a89('0x47')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb['attrs'][0x0][_0x9a89('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x9a89('0x48'),'value':_0x18f4bb[_0x9a89('0x48')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x1]?_0x18f4bb[_0x9a89('0x41')][0x1][_0x9a89('0x42')]:undefined)||_0x9a89('0x49')},{'name':_0x9a89('0x4a'),'value':_0x18f4bb['attrFontSize']||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x2]?_0x18f4bb[_0x9a89('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x9a89('0x4b'),'value':_0x18f4bb[_0x9a89('0x4b')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||_0x9a89('0x4c')},{'name':'attrVoiceQueues','value':_0x18f4bb[_0x9a89('0x4d')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x1]?_0x18f4bb['attrs'][0x1][_0x9a89('0x42')]:undefined)||[]},{'name':_0x9a89('0x4a'),'value':_0x18f4bb[_0x9a89('0x4a')]||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x2]?_0x18f4bb[_0x9a89('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x9a89('0x4e'),'value':_0x18f4bb[_0x9a89('0x4e')]||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0x3]?_0x18f4bb[_0x9a89('0x41')][0x3]['value']:undefined)||'voice'},{'name':_0x9a89('0x4f'),'value':_0x18f4bb[_0x9a89('0x4f')]||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0x4]?_0x18f4bb['attrs'][0x4][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x50'),'value':_0x18f4bb[_0x9a89('0x50')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x5]?_0x18f4bb['attrs'][0x5][_0x9a89('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x18f4bb[_0x9a89('0x51')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x6]?_0x18f4bb[_0x9a89('0x41')][0x6][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x52'),'value':_0x18f4bb[_0x9a89('0x52')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x7]?_0x18f4bb[_0x9a89('0x41')][0x7][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x53'),'value':_0x18f4bb[_0x9a89('0x53')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x8]?_0x18f4bb[_0x9a89('0x41')][0x8][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x54'),'value':_0x18f4bb['attrChatWebsites']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x9]?_0x18f4bb['attrs'][0x9]['value']:undefined)||''}];case _0x9a89('0x55'):case _0x9a89('0x56'):return[{'name':_0x9a89('0x57'),'value':_0x18f4bb['attrSerie1']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||_0x9a89('0x4c')},{'name':'attrSerie2','value':_0x18f4bb[_0x9a89('0x58')]||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x1]?_0x18f4bb[_0x9a89('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x18f4bb['attrSerie3']||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x2]?_0x18f4bb['attrs'][0x2][_0x9a89('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x18f4bb[_0x9a89('0x4d')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x3]?_0x18f4bb[_0x9a89('0x41')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x18f4bb[_0x9a89('0x4e')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x4]?_0x18f4bb[_0x9a89('0x41')][0x4]['value']:undefined)||_0x9a89('0x59')},{'name':'attrEmailAccounts','value':_0x18f4bb[_0x9a89('0x4f')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x5]?_0x18f4bb[_0x9a89('0x41')][0x5][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x50'),'value':_0x18f4bb[_0x9a89('0x50')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x6]?_0x18f4bb[_0x9a89('0x41')][0x6][_0x9a89('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x18f4bb[_0x9a89('0x51')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x7]?_0x18f4bb[_0x9a89('0x41')][0x7][_0x9a89('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x18f4bb['attrOpenchannelAccounts']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x8]?_0x18f4bb[_0x9a89('0x41')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x18f4bb['attrWhatsappAccounts']||(_0x18f4bb['attrs']&&_0x18f4bb['attrs'][0x9]?_0x18f4bb[_0x9a89('0x41')][0x9][_0x9a89('0x42')]:undefined)||''},{'name':_0x9a89('0x54'),'value':_0x18f4bb['attrChatWebsites']||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0xa]?_0x18f4bb['attrs'][0xa]['value']:undefined)||''}];case _0x9a89('0x5a'):return[{'name':'attrReport','type':_0x18f4bb[_0x9a89('0x5b')]||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb['attrs'][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0][_0x9a89('0x3e')]:undefined)||null,'value':_0x18f4bb['attrReport']||(_0x18f4bb[_0x9a89('0x41')]&&_0x18f4bb[_0x9a89('0x41')][0x0]?_0x18f4bb[_0x9a89('0x41')][0x0]['value']:undefined)||null},{'name':_0x9a89('0x5c'),'value':_0x18f4bb[_0x9a89('0x5c')]||(_0x18f4bb['attrs']&&_0x18f4bb[_0x9a89('0x41')][0x1]?_0x18f4bb[_0x9a89('0x41')][0x1][_0x9a89('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x5b71e2){logger[_0x9a89('0x29')](_0x9a89('0x5d'),JSON[_0x9a89('0x5e')](_0x5b71e2));return[];}}exports[_0x9a89('0x5f')]=function(_0x5e41f1,_0x46ee8a){if(_0x5e41f1['body']){_0x5e41f1[_0x9a89('0x60')][_0x9a89('0x41')]=widgetAttributes(_0x5e41f1[_0x9a89('0x60')]);}return db[_0x9a89('0x30')][_0x9a89('0x5f')](_0x5e41f1[_0x9a89('0x60')],{})[_0x9a89('0x27')](respondWithResult(_0x46ee8a,0xc9))[_0x9a89('0x3c')](handleError(_0x46ee8a,null));};exports['update']=function(_0x5bad90,_0x2ed99d){if(_0x5bad90['body']['id']){delete _0x5bad90[_0x9a89('0x60')]['id'];}_0x5bad90[_0x9a89('0x60')]['attrs']=widgetAttributes(_0x5bad90['body']);return db[_0x9a89('0x30')][_0x9a89('0x3b')]({'where':{'id':_0x5bad90[_0x9a89('0x3d')]['id']}})[_0x9a89('0x27')](handleEntityNotFound(_0x2ed99d,null))[_0x9a89('0x27')](saveUpdates(_0x5bad90[_0x9a89('0x60')],null))[_0x9a89('0x27')](respondWithResult(_0x2ed99d,null))[_0x9a89('0x3c')](handleError(_0x2ed99d,null));}; \ No newline at end of file +var _0x2bd8=['attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie2','attrSerie3','voice','attrFaxAccounts','web-report','attrReport','reportType','stringify','create','body','catch','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','params','type','iframe','attrUrl','value','attrPath','attrs','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter'];(function(_0x5c53a1,_0xe83fc7){var _0x489089=function(_0x36957b){while(--_0x36957b){_0x5c53a1['push'](_0x5c53a1['shift']());}};_0x489089(++_0xe83fc7);}(_0x2bd8,0x130));var _0x82bd=function(_0x407586,_0x1067d1){_0x407586=_0x407586-0x0;var _0x23a623=_0x2bd8[_0x407586];return _0x23a623;};'use strict';var emlformat=require(_0x82bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82bd('0x1'));var jsonpatch=require(_0x82bd('0x2'));var rp=require(_0x82bd('0x3'));var moment=require(_0x82bd('0x4'));var BPromise=require(_0x82bd('0x5'));var Mustache=require(_0x82bd('0x6'));var util=require(_0x82bd('0x7'));var path=require('path');var sox=require(_0x82bd('0x8'));var csv=require(_0x82bd('0x9'));var ejs=require(_0x82bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82bd('0xb'));var squel=require(_0x82bd('0xc'));var crypto=require(_0x82bd('0xd'));var jsforce=require(_0x82bd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x82bd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82bd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82bd('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x82bd('0x11'));var config=require(_0x82bd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x82bd('0x13'))['db'];config['redis']=_[_0x82bd('0x14')](config['redis'],{'host':_0x82bd('0x15'),'port':0x18eb});var socket=require(_0x82bd('0x16'))(new Redis(config[_0x82bd('0x17')]));require(_0x82bd('0x18'))['register'](socket);function respondWithStatusCode(_0x446ffc,_0xd43e79){_0xd43e79=_0xd43e79||0xcc;return function(_0x52e533){if(_0x52e533){return _0x446ffc[_0x82bd('0x19')](_0xd43e79);}return _0x446ffc['status'](_0xd43e79)[_0x82bd('0x1a')]();};}function respondWithResult(_0x433e7d,_0x2c5155){_0x2c5155=_0x2c5155||0xc8;return function(_0x300982){if(_0x300982){return _0x433e7d[_0x82bd('0x1b')](_0x2c5155)[_0x82bd('0x1c')](_0x300982);}};}function respondWithFilteredResult(_0x387d21,_0xb7a986){return function(_0x31a350){if(_0x31a350){var _0xf180aa=typeof _0xb7a986[_0x82bd('0x1d')]===_0x82bd('0x1e')&&typeof _0xb7a986[_0x82bd('0x1f')]===_0x82bd('0x1e');var _0x4a1e62=_0x31a350['count'];var _0x283ce7=_0xf180aa?0x0:_0xb7a986[_0x82bd('0x1d')];var _0x2ee27c=_0xf180aa?_0x31a350[_0x82bd('0x20')]:_0xb7a986[_0x82bd('0x1d')]+_0xb7a986[_0x82bd('0x1f')];var _0x2c1810;if(_0x2ee27c>=_0x4a1e62){_0x2ee27c=_0x4a1e62;_0x2c1810=0xc8;}else{_0x2c1810=0xce;}_0x387d21[_0x82bd('0x1b')](_0x2c1810);return _0x387d21[_0x82bd('0x21')](_0x82bd('0x22'),_0x283ce7+'-'+_0x2ee27c+'/'+_0x4a1e62)[_0x82bd('0x1c')](_0x31a350);}return null;};}function patchUpdates(_0x177025){return function(_0x1ca91f){try{jsonpatch[_0x82bd('0x23')](_0x1ca91f,_0x177025,!![]);}catch(_0x3d9f03){return BPromise[_0x82bd('0x24')](_0x3d9f03);}return _0x1ca91f[_0x82bd('0x25')]();};}function saveUpdates(_0x3b6b93,_0x673943){return function(_0x547e45){if(_0x547e45){return _0x547e45['update'](_0x3b6b93)[_0x82bd('0x26')](function(_0x436ecd){return _0x436ecd;});}return null;};}function removeEntity(_0x1cb292,_0x3eb6a5){return function(_0x25cb16){if(_0x25cb16){return _0x25cb16[_0x82bd('0x27')]()[_0x82bd('0x26')](function(){_0x1cb292[_0x82bd('0x1b')](0xcc)[_0x82bd('0x1a')]();});}};}function handleEntityNotFound(_0x2add80,_0x53a2a6){return function(_0x5bd22f){if(!_0x5bd22f){_0x2add80['sendStatus'](0x194);}return _0x5bd22f;};}function handleError(_0x5d1015,_0x714d70){_0x714d70=_0x714d70||0x1f4;return function(_0x52bcd8){logger[_0x82bd('0x28')](_0x52bcd8[_0x82bd('0x29')]);if(_0x52bcd8[_0x82bd('0x2a')]){delete _0x52bcd8['name'];}_0x5d1015['status'](_0x714d70)['send'](_0x52bcd8);};}exports[_0x82bd('0x2b')]=function(_0x2a5867,_0x40884f){var _0x580ba8={'raw':![],'where':{'id':_0x2a5867['params']['id']}},_0x166c46={};_0x166c46[_0x82bd('0x2c')]=_[_0x82bd('0x2d')](db[_0x82bd('0x2e')][_0x82bd('0x2f')]);_0x166c46[_0x82bd('0x30')]=_[_0x82bd('0x2d')](_0x2a5867['query']);_0x166c46[_0x82bd('0x31')]=_[_0x82bd('0x32')](_0x166c46[_0x82bd('0x2c')],_0x166c46['query']);_0x580ba8[_0x82bd('0x33')]=_['intersection'](_0x166c46['model'],qs[_0x82bd('0x34')](_0x2a5867[_0x82bd('0x30')][_0x82bd('0x34')]));_0x580ba8[_0x82bd('0x33')]=_0x580ba8[_0x82bd('0x33')][_0x82bd('0x35')]?_0x580ba8[_0x82bd('0x33')]:_0x166c46[_0x82bd('0x2c')];if(_0x2a5867[_0x82bd('0x30')][_0x82bd('0x36')]){_0x580ba8[_0x82bd('0x37')]=[{'all':!![]}];}_0x580ba8=_[_0x82bd('0x38')]({},_0x580ba8,_0x2a5867[_0x82bd('0x39')]);return db[_0x82bd('0x2e')][_0x82bd('0x3a')](_0x580ba8)[_0x82bd('0x26')](handleEntityNotFound(_0x40884f,null))[_0x82bd('0x26')](respondWithResult(_0x40884f,null))['catch'](handleError(_0x40884f,null));};exports['destroy']=function(_0x59319d,_0x3fea10){return db[_0x82bd('0x2e')]['find']({'where':{'id':_0x59319d[_0x82bd('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3fea10,null))['then'](removeEntity(_0x3fea10,null))['catch'](handleError(_0x3fea10,null));};function widgetAttributes(_0x2b7675){try{switch(_0x2b7675[_0x82bd('0x3c')]){case _0x82bd('0x3d'):return[{'name':_0x82bd('0x3e'),'value':_0x2b7675[_0x82bd('0x3e')]||(_0x2b7675['attrs']&&_0x2b7675['attrs'][0x0]?_0x2b7675['attrs'][0x0][_0x82bd('0x3f')]:undefined)||'https://'}];case'custom':return[{'name':_0x82bd('0x40'),'value':_0x2b7675[_0x82bd('0x40')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x0]?_0x2b7675[_0x82bd('0x41')][0x0][_0x82bd('0x3f')]:undefined)||''}];case _0x82bd('0x42'):return[{'name':_0x82bd('0x43'),'value':_0x2b7675[_0x82bd('0x43')]||(_0x2b7675['attrs']&&_0x2b7675['attrs'][0x0]?_0x2b7675[_0x82bd('0x41')][0x0][_0x82bd('0x3f')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2b7675[_0x82bd('0x44')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675['attrs'][0x1]?_0x2b7675[_0x82bd('0x41')][0x1][_0x82bd('0x3f')]:undefined)||_0x82bd('0x45')},{'name':_0x82bd('0x46'),'value':_0x2b7675[_0x82bd('0x46')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x2]?_0x2b7675[_0x82bd('0x41')][0x2][_0x82bd('0x3f')]:undefined)||0xc}];case _0x82bd('0x47'):return[{'name':_0x82bd('0x48'),'value':_0x2b7675[_0x82bd('0x48')]||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0x0]?_0x2b7675[_0x82bd('0x41')][0x0]['value']:undefined)||'total'},{'name':_0x82bd('0x49'),'value':_0x2b7675[_0x82bd('0x49')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x1]?_0x2b7675[_0x82bd('0x41')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x2b7675[_0x82bd('0x46')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675['attrs'][0x2]?_0x2b7675[_0x82bd('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x82bd('0x4a'),'value':_0x2b7675[_0x82bd('0x4a')]||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0x3]?_0x2b7675[_0x82bd('0x41')][0x3]['value']:undefined)||'voice'},{'name':_0x82bd('0x4b'),'value':_0x2b7675['attrEmailAccounts']||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x4]?_0x2b7675[_0x82bd('0x41')][0x4][_0x82bd('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2b7675['attrFaxAccounts']||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x5]?_0x2b7675['attrs'][0x5][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4c'),'value':_0x2b7675[_0x82bd('0x4c')]||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0x6]?_0x2b7675[_0x82bd('0x41')][0x6][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4d'),'value':_0x2b7675[_0x82bd('0x4d')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x7]?_0x2b7675[_0x82bd('0x41')][0x7][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4e'),'value':_0x2b7675[_0x82bd('0x4e')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x8]?_0x2b7675['attrs'][0x8][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4f'),'value':_0x2b7675['attrChatWebsites']||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x9]?_0x2b7675[_0x82bd('0x41')][0x9][_0x82bd('0x3f')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x82bd('0x50'),'value':_0x2b7675['attrSerie1']||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0x0]?_0x2b7675['attrs'][0x0]['value']:undefined)||_0x82bd('0x51')},{'name':_0x82bd('0x52'),'value':_0x2b7675[_0x82bd('0x52')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x1]?_0x2b7675[_0x82bd('0x41')][0x1][_0x82bd('0x3f')]:undefined)||null},{'name':_0x82bd('0x53'),'value':_0x2b7675[_0x82bd('0x53')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x2]?_0x2b7675[_0x82bd('0x41')][0x2][_0x82bd('0x3f')]:undefined)||null},{'name':_0x82bd('0x49'),'value':_0x2b7675[_0x82bd('0x49')]||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0x3]?_0x2b7675[_0x82bd('0x41')][0x3][_0x82bd('0x3f')]:undefined)||[]},{'name':_0x82bd('0x4a'),'value':_0x2b7675[_0x82bd('0x4a')]||(_0x2b7675['attrs']&&_0x2b7675['attrs'][0x4]?_0x2b7675['attrs'][0x4]['value']:undefined)||_0x82bd('0x54')},{'name':_0x82bd('0x4b'),'value':_0x2b7675[_0x82bd('0x4b')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675['attrs'][0x5]?_0x2b7675['attrs'][0x5][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x55'),'value':_0x2b7675[_0x82bd('0x55')]||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0x6]?_0x2b7675[_0x82bd('0x41')][0x6][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4c'),'value':_0x2b7675[_0x82bd('0x4c')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x7]?_0x2b7675[_0x82bd('0x41')][0x7][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4d'),'value':_0x2b7675[_0x82bd('0x4d')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x8]?_0x2b7675[_0x82bd('0x41')][0x8][_0x82bd('0x3f')]:undefined)||''},{'name':_0x82bd('0x4e'),'value':_0x2b7675[_0x82bd('0x4e')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675['attrs'][0x9]?_0x2b7675[_0x82bd('0x41')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x2b7675[_0x82bd('0x4f')]||(_0x2b7675['attrs']&&_0x2b7675[_0x82bd('0x41')][0xa]?_0x2b7675[_0x82bd('0x41')][0xa][_0x82bd('0x3f')]:undefined)||''}];case _0x82bd('0x56'):return[{'name':_0x82bd('0x57'),'type':_0x2b7675[_0x82bd('0x58')]||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x0]?_0x2b7675[_0x82bd('0x41')][0x0][_0x82bd('0x3c')]:undefined)||null,'value':_0x2b7675[_0x82bd('0x57')]||(_0x2b7675['attrs']&&_0x2b7675['attrs'][0x0]?_0x2b7675[_0x82bd('0x41')][0x0][_0x82bd('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x2b7675['attrRefresh']||(_0x2b7675[_0x82bd('0x41')]&&_0x2b7675[_0x82bd('0x41')][0x1]?_0x2b7675[_0x82bd('0x41')][0x1][_0x82bd('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x5c2f56){logger[_0x82bd('0x28')]('widgetAttributes:\x20%s',JSON[_0x82bd('0x59')](_0x5c2f56));return[];}}exports[_0x82bd('0x5a')]=function(_0x51b3dd,_0x27d247){if(_0x51b3dd[_0x82bd('0x5b')]){_0x51b3dd[_0x82bd('0x5b')][_0x82bd('0x41')]=widgetAttributes(_0x51b3dd['body']);}return db[_0x82bd('0x2e')][_0x82bd('0x5a')](_0x51b3dd[_0x82bd('0x5b')],{})[_0x82bd('0x26')](respondWithResult(_0x27d247,0xc9))[_0x82bd('0x5c')](handleError(_0x27d247,null));};exports[_0x82bd('0x5d')]=function(_0x73c194,_0x19af06){if(_0x73c194[_0x82bd('0x5b')]['id']){delete _0x73c194['body']['id'];}_0x73c194[_0x82bd('0x5b')]['attrs']=widgetAttributes(_0x73c194['body']);return db[_0x82bd('0x2e')][_0x82bd('0x3a')]({'where':{'id':_0x73c194['params']['id']}})[_0x82bd('0x26')](handleEntityNotFound(_0x19af06,null))['then'](saveUpdates(_0x73c194[_0x82bd('0x5b')],null))[_0x82bd('0x26')](respondWithResult(_0x19af06,null))['catch'](handleError(_0x19af06,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e6f3a6d..77db589 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 _0x0afd=['exports','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x0afd,0x89));var _0xd0af=function(_0x1d8d09,_0x4fac0a){_0x1d8d09=_0x1d8d09-0x0;var _0xeef3fd=_0x0afd[_0x1d8d09];return _0xeef3fd;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd0af('0x0'))['db'][_0xd0af('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd0af('0x2')](0x0);var events={'afterCreate':_0xd0af('0x3'),'afterUpdate':'update','afterDestroy':_0xd0af('0x4')};function emitEvent(_0x4ee157){return function(_0x14ad13,_0xb9f1bf,_0x529c41){DashboardItemEvents[_0xd0af('0x5')](_0x4ee157+':'+_0x14ad13['id'],_0x14ad13);DashboardItemEvents[_0xd0af('0x5')](_0x4ee157,_0x14ad13);_0x529c41(null);};}for(var e in events){if(events[_0xd0af('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd0af('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x5e6c=['hasOwnProperty','hook','../../mysqldb','DashboardItem','save','emit'];(function(_0x3af021,_0x53a68a){var _0x4d5b44=function(_0x2bd601){while(--_0x2bd601){_0x3af021['push'](_0x3af021['shift']());}};_0x4d5b44(++_0x53a68a);}(_0x5e6c,0x1dc));var _0xc5e6=function(_0x5bf0d6,_0x31ba9c){_0x5bf0d6=_0x5bf0d6-0x0;var _0x163f86=_0x5e6c[_0x5bf0d6];return _0x163f86;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xc5e6('0x0'))['db'][_0xc5e6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc5e6('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5bb81d){return function(_0x3c392e,_0x107078,_0x59f827){DashboardItemEvents[_0xc5e6('0x3')](_0x5bb81d+':'+_0x3c392e['id'],_0x3c392e);DashboardItemEvents['emit'](_0x5bb81d,_0x3c392e);_0x59f827(null);};}for(var e in events){if(events[_0xc5e6('0x4')](e)){var event=events[e];DashboardItem[_0xc5e6('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 85568ad..21c1a21 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 _0xd2e2=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2f2dc2,_0x1718e2){var _0x3d8516=function(_0x170832){while(--_0x170832){_0x2f2dc2['push'](_0x2f2dc2['shift']());}};_0x3d8516(++_0x1718e2);}(_0xd2e2,0xa2));var _0x2d2e=function(_0x3cde58,_0x522de4){_0x3cde58=_0x3cde58-0x0;var _0x115021=_0xd2e2[_0x3cde58];return _0x115021;};'use strict';var _=require(_0x2d2e('0x0'));var util=require(_0x2d2e('0x1'));var logger=require(_0x2d2e('0x2'))(_0x2d2e('0x3'));var moment=require(_0x2d2e('0x4'));var BPromise=require(_0x2d2e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d2e('0x6'));var rimraf=require(_0x2d2e('0x7'));var config=require(_0x2d2e('0x8'));var attributes=require(_0x2d2e('0x9'));module[_0x2d2e('0xa')]=function(_0x55cc13,_0x2adde5){return _0x55cc13[_0x2d2e('0xb')](_0x2d2e('0xc'),attributes,{'tableName':_0x2d2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36a2=['api','moment','request-promise','path','rimraf','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x28d5e5,_0xa13c8e){var _0x288ab4=function(_0x795fac){while(--_0x795fac){_0x28d5e5['push'](_0x28d5e5['shift']());}};_0x288ab4(++_0xa13c8e);}(_0x36a2,0x105));var _0x236a=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x36a2[_0x48c4ef];return _0x435715;};'use strict';var _=require(_0x236a('0x0'));var util=require(_0x236a('0x1'));var logger=require(_0x236a('0x2'))(_0x236a('0x3'));var moment=require(_0x236a('0x4'));var BPromise=require('bluebird');var rp=require(_0x236a('0x5'));var fs=require('fs');var path=require(_0x236a('0x6'));var rimraf=require(_0x236a('0x7'));var config=require('../../config/environment');var attributes=require(_0x236a('0x8'));module[_0x236a('0x9')]=function(_0x35f388,_0xc19022){return _0x35f388['define'](_0x236a('0xa'),attributes,{'tableName':_0x236a('0xb'),'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 f1fea10..320c97e 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 _0x7451=['localhost','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis'];(function(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0x7451,0xe7));var _0x1745=function(_0x3fb673,_0x37ae86){_0x3fb673=_0x3fb673-0x0;var _0x15fe73=_0x7451[_0x3fb673];return _0x15fe73;};'use strict';var _=require(_0x1745('0x0'));var util=require('util');var moment=require(_0x1745('0x1'));var BPromise=require(_0x1745('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1745('0x3'));var db=require(_0x1745('0x4'))['db'];var utils=require(_0x1745('0x5'));var logger=require(_0x1745('0x6'))(_0x1745('0x7'));var config=require(_0x1745('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1745('0x9')]({'port':0x232a});config['redis']=_[_0x1745('0xa')](config[_0x1745('0xb')],{'host':_0x1745('0xc'),'port':0x18eb});var socket=require(_0x1745('0xd'))(new Redis(config[_0x1745('0xb')]));require(_0x1745('0xe'))[_0x1745('0xf')](socket);function respondWithRpcPromise(_0x9bf12a,_0x4b3f30,_0x2eb136){return new BPromise(function(_0x585227,_0x4ef1f6){return client[_0x1745('0x10')](_0x9bf12a,_0x2eb136)['then'](function(_0x455ee4){logger['info'](_0x1745('0x11'),_0x4b3f30,_0x1745('0x12'));logger[_0x1745('0x13')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4b3f30,_0x1745('0x12'),JSON[_0x1745('0x14')](_0x455ee4));if(_0x455ee4[_0x1745('0x15')]){if(_0x455ee4['error'][_0x1745('0x16')]===0x1f4){logger[_0x1745('0x15')]('DashboardItem,\x20%s,\x20%s',_0x4b3f30,_0x455ee4[_0x1745('0x15')][_0x1745('0x17')]);return _0x4ef1f6(_0x455ee4['error']['message']);}logger['error'](_0x1745('0x11'),_0x4b3f30,_0x455ee4[_0x1745('0x15')][_0x1745('0x17')]);return _0x585227(_0x455ee4[_0x1745('0x15')][_0x1745('0x17')]);}else{logger[_0x1745('0x18')](_0x1745('0x11'),_0x4b3f30,_0x1745('0x12'));_0x585227(_0x455ee4[_0x1745('0x19')][_0x1745('0x17')]);}})[_0x1745('0x1a')](function(_0x5dac1b){logger[_0x1745('0x15')](_0x1745('0x11'),_0x4b3f30,_0x5dac1b);_0x4ef1f6(_0x5dac1b);});});} \ No newline at end of file +var _0x1b6e=['../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x1b6e,0xfe));var _0xe1b6=function(_0x4f26f6,_0x4860aa){_0x4f26f6=_0x4f26f6-0x0;var _0x2cd10a=_0x1b6e[_0x4f26f6];return _0x2cd10a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1b6('0x0'));var BPromise=require(_0xe1b6('0x1'));var rs=require(_0xe1b6('0x2'));var fs=require('fs');var Redis=require(_0xe1b6('0x3'));var db=require(_0xe1b6('0x4'))['db'];var utils=require(_0xe1b6('0x5'));var logger=require(_0xe1b6('0x6'))(_0xe1b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b6('0x8'));var client=jayson[_0xe1b6('0x9')]['http']({'port':0x232a});config[_0xe1b6('0xa')]=_[_0xe1b6('0xb')](config['redis'],{'host':_0xe1b6('0xc'),'port':0x18eb});var socket=require(_0xe1b6('0xd'))(new Redis(config[_0xe1b6('0xa')]));require(_0xe1b6('0xe'))[_0xe1b6('0xf')](socket);function respondWithRpcPromise(_0x383c9c,_0xa6209e,_0x109b96){return new BPromise(function(_0x3d7651,_0xf614ca){return client['request'](_0x383c9c,_0x109b96)['then'](function(_0x39f62e){logger[_0xe1b6('0x10')](_0xe1b6('0x11'),_0xa6209e,_0xe1b6('0x12'));logger['debug'](_0xe1b6('0x13'),_0xa6209e,_0xe1b6('0x12'),JSON[_0xe1b6('0x14')](_0x39f62e));if(_0x39f62e[_0xe1b6('0x15')]){if(_0x39f62e['error'][_0xe1b6('0x16')]===0x1f4){logger[_0xe1b6('0x15')]('DashboardItem,\x20%s,\x20%s',_0xa6209e,_0x39f62e[_0xe1b6('0x15')][_0xe1b6('0x17')]);return _0xf614ca(_0x39f62e[_0xe1b6('0x15')][_0xe1b6('0x17')]);}logger[_0xe1b6('0x15')]('DashboardItem,\x20%s,\x20%s',_0xa6209e,_0x39f62e[_0xe1b6('0x15')][_0xe1b6('0x17')]);return _0x3d7651(_0x39f62e['error'][_0xe1b6('0x17')]);}else{logger['info'](_0xe1b6('0x11'),_0xa6209e,'request\x20sent');_0x3d7651(_0x39f62e[_0xe1b6('0x18')][_0xe1b6('0x17')]);}})[_0xe1b6('0x19')](function(_0x5d9311){logger[_0xe1b6('0x15')]('DashboardItem,\x20%s,\x20%s',_0xa6209e,_0x5d9311);_0xf614ca(_0x5d9311);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a1cee82..9366d58 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 _0x53aa=['./dashboardItem.events','remove'];(function(_0x2daa9a,_0x4c6870){var _0x487ec0=function(_0x15a6b0){while(--_0x15a6b0){_0x2daa9a['push'](_0x2daa9a['shift']());}};_0x487ec0(++_0x4c6870);}(_0x53aa,0x76));var _0xa53a=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x53aa[_0x176329];return _0x31997c;};'use strict';var DashboardItemEvents=require(_0xa53a('0x0'));var events=['save',_0xa53a('0x1'),'update'];function createListener(_0x186d08,_0x5b465c){return function(_0xaba33f){_0x5b465c['emit'](_0x186d08,_0xaba33f);};}function removeListener(_0x2f7f04,_0x311fe1){return function(){DashboardItemEvents['removeListener'](_0x2f7f04,_0x311fe1);};}exports['register']=function(_0x539544){for(var _0x3d2793=0x0,_0xd5d7ce=events['length'];_0x3d2793<_0xd5d7ce;_0x3d2793++){var _0x1eebab=events[_0x3d2793];var _0x1b290e=createListener('dashboardItem:'+_0x1eebab,_0x539544);DashboardItemEvents['on'](_0x1eebab,_0x1b290e);}}; \ No newline at end of file +var _0xedb7=['emit','removeListener','register','length','./dashboardItem.events','save','remove','update'];(function(_0x272e18,_0x75e43c){var _0x572ca9=function(_0xf2b51a){while(--_0xf2b51a){_0x272e18['push'](_0x272e18['shift']());}};_0x572ca9(++_0x75e43c);}(_0xedb7,0xd4));var _0x7edb=function(_0x101308,_0x214c56){_0x101308=_0x101308-0x0;var _0x57b7c8=_0xedb7[_0x101308];return _0x57b7c8;};'use strict';var DashboardItemEvents=require(_0x7edb('0x0'));var events=[_0x7edb('0x1'),_0x7edb('0x2'),_0x7edb('0x3')];function createListener(_0x5d1522,_0x24b78d){return function(_0x403938){_0x24b78d[_0x7edb('0x4')](_0x5d1522,_0x403938);};}function removeListener(_0x4da957,_0x36d1cf){return function(){DashboardItemEvents[_0x7edb('0x5')](_0x4da957,_0x36d1cf);};}exports[_0x7edb('0x6')]=function(_0x1d8918){for(var _0xd508cd=0x0,_0x152a9f=events[_0x7edb('0x7')];_0xd508cd<_0x152a9f;_0xd508cd++){var _0x13e357=events[_0xd508cd];var _0x507098=createListener('dashboardItem:'+_0x13e357,_0x1d8918);DashboardItemEvents['on'](_0x13e357,_0x507098);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ca971f2..2457a68 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 _0x16f3=['connect-timeout','express','Router','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xe51e1e,_0x2a2559){var _0x2d04ab=function(_0x2dab4a){while(--_0x2dab4a){_0xe51e1e['push'](_0xe51e1e['shift']());}};_0x2d04ab(++_0x2a2559);}(_0x16f3,0x10d));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x316f('0x0'));var util=require(_0x316f('0x1'));var path=require(_0x316f('0x2'));var timeout=require(_0x316f('0x3'));var express=require(_0x316f('0x4'));var router=express[_0x316f('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(_0x316f('0x6'));router[_0x316f('0x7')](_0x316f('0x8'),auth[_0x316f('0x9')](),controller['show']);router['post']('/',auth[_0x316f('0x9')](),controller[_0x316f('0xa')]);router[_0x316f('0xb')](_0x316f('0x8'),auth[_0x316f('0x9')](),controller[_0x316f('0xc')]);router[_0x316f('0xd')](_0x316f('0x8'),auth[_0x316f('0x9')](),controller[_0x316f('0xe')]);module[_0x316f('0xf')]=router; \ No newline at end of file +var _0xb8e5=['../../components/auth/service','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1d579a,_0x1eca72){var _0x4d900c=function(_0x1b0a93){while(--_0x1b0a93){_0x1d579a['push'](_0x1d579a['shift']());}};_0x4d900c(++_0x1eca72);}(_0xb8e5,0xea));var _0x5b8e=function(_0x3bfb7c,_0x3dabf3){_0x3bfb7c=_0x3bfb7c-0x0;var _0x5efb75=_0xb8e5[_0x3bfb7c];return _0x5efb75;};'use strict';var multer=require('multer');var util=require(_0x5b8e('0x0'));var path=require(_0x5b8e('0x1'));var timeout=require(_0x5b8e('0x2'));var express=require(_0x5b8e('0x3'));var router=express[_0x5b8e('0x4')]();var fs_extra=require(_0x5b8e('0x5'));var auth=require(_0x5b8e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b8e('0x7'));router['get'](_0x5b8e('0x8'),auth[_0x5b8e('0x9')](),controller[_0x5b8e('0xa')]);router['post']('/',auth[_0x5b8e('0x9')](),controller[_0x5b8e('0xb')]);router[_0x5b8e('0xc')]('/:id',auth[_0x5b8e('0x9')](),controller[_0x5b8e('0xd')]);router[_0x5b8e('0xe')]('/:id',auth[_0x5b8e('0x9')](),controller[_0x5b8e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 967ae5c..d433e41 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 _0xc223=['STRING','sequelize','exports','first','third'];(function(_0x13beff,_0x3919f5){var _0x50e34d=function(_0x56c8a3){while(--_0x56c8a3){_0x13beff['push'](_0x13beff['shift']());}};_0x50e34d(++_0x3919f5);}(_0xc223,0x1b9));var _0x3c22=function(_0x8f20de,_0x1a59ed){_0x8f20de=_0x8f20de-0x0;var _0x380167=_0xc223[_0x8f20de];return _0x380167;};'use strict';var Sequelize=require(_0x3c22('0x0'));module[_0x3c22('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x3c22('0x2'),'second',_0x3c22('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x3c22('0x4')]}}; \ No newline at end of file +var _0x76ca=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x44bd5d,_0x3e9389){var _0x12a8a4=function(_0xb4eb20){while(--_0xb4eb20){_0x44bd5d['push'](_0x44bd5d['shift']());}};_0x12a8a4(++_0x3e9389);}(_0x76ca,0x1f3));var _0xa76c=function(_0x3afdaf,_0x1e2e98){_0x3afdaf=_0x3afdaf-0x0;var _0x10374f=_0x76ca[_0x3afdaf];return _0x10374f;};'use strict';var Sequelize=require(_0xa76c('0x0'));module[_0xa76c('0x1')]={'name':{'type':Sequelize[_0xa76c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa76c('0x3')](_0xa76c('0x4'),_0xa76c('0x5'),_0xa76c('0x6')),'allowNull':![],'defaultValue':_0xa76c('0x4')},'description':{'type':Sequelize[_0xa76c('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e7ffbd1..2fc99c5 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 _0xea98=['Dispositions','end','error','stack','name','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x57c155,_0x5b4161){var _0x5a315b=function(_0x184e8d){while(--_0x184e8d){_0x57c155['push'](_0x57c155['shift']());}};_0x5a315b(++_0x5b4161);}(_0xea98,0xd8));var _0x8ea9=function(_0x22b41b,_0x32b31a){_0x22b41b=_0x22b41b-0x0;var _0x278dff=_0xea98[_0x22b41b];return _0x278dff;};'use strict';var emlformat=require(_0x8ea9('0x0'));var rimraf=require(_0x8ea9('0x1'));var zipdir=require(_0x8ea9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea9('0x3'));var moment=require(_0x8ea9('0x4'));var BPromise=require(_0x8ea9('0x5'));var Mustache=require(_0x8ea9('0x6'));var util=require('util');var path=require(_0x8ea9('0x7'));var sox=require(_0x8ea9('0x8'));var csv=require(_0x8ea9('0x9'));var ejs=require(_0x8ea9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ea9('0xb'));var _=require(_0x8ea9('0xc'));var squel=require('squel');var crypto=require(_0x8ea9('0xd'));var jsforce=require(_0x8ea9('0xe'));var deskjs=require(_0x8ea9('0xf'));var toCsv=require(_0x8ea9('0x9'));var querystring=require(_0x8ea9('0x10'));var Papa=require('papaparse');var Redis=require(_0x8ea9('0x11'));var authService=require(_0x8ea9('0x12'));var qs=require(_0x8ea9('0x13'));var as=require(_0x8ea9('0x14'));var hardwareService=require(_0x8ea9('0x15'));var logger=require(_0x8ea9('0x16'))(_0x8ea9('0x17'));var utils=require(_0x8ea9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ea9('0x19'))['db'];function respondWithStatusCode(_0x34e851,_0x5b8082){_0x5b8082=_0x5b8082||0xcc;return function(_0x46aa9e){if(_0x46aa9e){return _0x34e851[_0x8ea9('0x1a')](_0x5b8082);}return _0x34e851[_0x8ea9('0x1b')](_0x5b8082)['end']();};}function respondWithResult(_0x162b4b,_0x3e55ca){_0x3e55ca=_0x3e55ca||0xc8;return function(_0x5962d0){if(_0x5962d0){return _0x162b4b[_0x8ea9('0x1b')](_0x3e55ca)[_0x8ea9('0x1c')](_0x5962d0);}};}function respondWithFilteredResult(_0x4e1bc8,_0x43b4cf){return function(_0x501fe6){if(_0x501fe6){var _0x3d18f9=typeof _0x43b4cf[_0x8ea9('0x1d')]==='undefined'&&typeof _0x43b4cf[_0x8ea9('0x1e')]===_0x8ea9('0x1f');var _0x4a1d76=_0x501fe6[_0x8ea9('0x20')];var _0x1ff50e=_0x3d18f9?0x0:_0x43b4cf[_0x8ea9('0x1d')];var _0x58cae3=_0x3d18f9?_0x501fe6[_0x8ea9('0x20')]:_0x43b4cf[_0x8ea9('0x1d')]+_0x43b4cf[_0x8ea9('0x1e')];var _0x23e59b;if(_0x58cae3>=_0x4a1d76){_0x58cae3=_0x4a1d76;_0x23e59b=0xc8;}else{_0x23e59b=0xce;}_0x4e1bc8[_0x8ea9('0x1b')](_0x23e59b);return _0x4e1bc8[_0x8ea9('0x21')](_0x8ea9('0x22'),_0x1ff50e+'-'+_0x58cae3+'/'+_0x4a1d76)[_0x8ea9('0x1c')](_0x501fe6);}return null;};}function patchUpdates(_0x2585e3){return function(_0x34e8a8){try{jsonpatch[_0x8ea9('0x23')](_0x34e8a8,_0x2585e3,!![]);}catch(_0x128dda){return BPromise[_0x8ea9('0x24')](_0x128dda);}return _0x34e8a8[_0x8ea9('0x25')]();};}function saveUpdates(_0x1e0d0d,_0x3a067c){return function(_0x5cceac){if(_0x5cceac){return _0x5cceac[_0x8ea9('0x26')](_0x1e0d0d)[_0x8ea9('0x27')](function(_0x20c550){return _0x20c550;});}return null;};}function removeEntity(_0x2f691d,_0x369058){return function(_0x20ef0e){if(_0x20ef0e){return _0x20ef0e[_0x8ea9('0x28')]()[_0x8ea9('0x27')](function(){var _0x18c124=_0x20ef0e[_0x8ea9('0x29')]({'plain':!![]});var _0xd0c891=_0x8ea9('0x2a');return db['UserProfileResource'][_0x8ea9('0x28')]({'where':{'type':_0xd0c891,'resourceId':_0x18c124['id']}})[_0x8ea9('0x27')](function(){return _0x20ef0e;});})[_0x8ea9('0x27')](function(){_0x2f691d[_0x8ea9('0x1b')](0xcc)[_0x8ea9('0x2b')]();});}};}function handleEntityNotFound(_0x3c34a8,_0x36fa02){return function(_0x20ff98){if(!_0x20ff98){_0x3c34a8[_0x8ea9('0x1a')](0x194);}return _0x20ff98;};}function handleError(_0x5c385b,_0x16c783){_0x16c783=_0x16c783||0x1f4;return function(_0x397a28){logger[_0x8ea9('0x2c')](_0x397a28[_0x8ea9('0x2d')]);if(_0x397a28[_0x8ea9('0x2e')]){delete _0x397a28[_0x8ea9('0x2e')];}_0x5c385b[_0x8ea9('0x1b')](_0x16c783)['send'](_0x397a28);};}exports['index']=function(_0x1daa06,_0xeb388a){var _0x21b8e0={},_0x5956d6={},_0x5ae561={'count':0x0,'rows':[]};var _0x158c4e=_[_0x8ea9('0x2f')](db[_0x8ea9('0x30')][_0x8ea9('0x31')],function(_0x4bc043){return{'name':_0x4bc043[_0x8ea9('0x32')],'type':_0x4bc043[_0x8ea9('0x33')][_0x8ea9('0x34')]};});_0x5956d6[_0x8ea9('0x35')]=_['map'](_0x158c4e,_0x8ea9('0x2e'));_0x5956d6[_0x8ea9('0x36')]=_[_0x8ea9('0x37')](_0x1daa06[_0x8ea9('0x36')]);_0x5956d6[_0x8ea9('0x38')]=_[_0x8ea9('0x39')](_0x5956d6['model'],_0x5956d6[_0x8ea9('0x36')]);_0x21b8e0[_0x8ea9('0x3a')]=_[_0x8ea9('0x39')](_0x5956d6['model'],qs[_0x8ea9('0x3b')](_0x1daa06[_0x8ea9('0x36')]['fields']));_0x21b8e0[_0x8ea9('0x3a')]=_0x21b8e0[_0x8ea9('0x3a')][_0x8ea9('0x3c')]?_0x21b8e0['attributes']:_0x5956d6['model'];if(!_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x3d')](_0x8ea9('0x3e'))){_0x21b8e0[_0x8ea9('0x1e')]=qs[_0x8ea9('0x1e')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x1e')]);_0x21b8e0['offset']=qs[_0x8ea9('0x1d')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x1d')]);}_0x21b8e0[_0x8ea9('0x3f')]=qs[_0x8ea9('0x40')](_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x40')]);_0x21b8e0[_0x8ea9('0x41')]=qs[_0x8ea9('0x38')](_[_0x8ea9('0x42')](_0x1daa06['query'],_0x5956d6[_0x8ea9('0x38')]),_0x158c4e);if(_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x43')]){_0x21b8e0[_0x8ea9('0x41')]=_[_0x8ea9('0x44')](_0x21b8e0['where'],{'$or':_[_0x8ea9('0x2f')](_0x158c4e,function(_0x47ed01){if(_0x47ed01['type']!=='VIRTUAL'){var _0x326b6c={};_0x326b6c[_0x47ed01[_0x8ea9('0x2e')]]={'$like':'%'+_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x43')]+'%'};return _0x326b6c;}})});}_0x21b8e0=_[_0x8ea9('0x44')]({},_0x21b8e0,_0x1daa06['options']);var _0x493a0e={'where':_0x21b8e0['where']};return db['Disposition'][_0x8ea9('0x20')](_0x493a0e)[_0x8ea9('0x27')](function(_0x28a61e){_0x5ae561[_0x8ea9('0x20')]=_0x28a61e;if(_0x1daa06[_0x8ea9('0x36')][_0x8ea9('0x45')]){_0x21b8e0[_0x8ea9('0x46')]=[{'all':!![]}];}return db[_0x8ea9('0x30')]['findAll'](_0x21b8e0);})[_0x8ea9('0x27')](function(_0x832edf){_0x5ae561[_0x8ea9('0x47')]=_0x832edf;return _0x5ae561;})[_0x8ea9('0x27')](respondWithFilteredResult(_0xeb388a,_0x21b8e0))[_0x8ea9('0x48')](handleError(_0xeb388a,null));};exports[_0x8ea9('0x49')]=function(_0x212517,_0x1c208a){var _0x32e0d4={'raw':!![],'where':{'id':_0x212517[_0x8ea9('0x4a')]['id']}},_0x5eec31={};_0x5eec31[_0x8ea9('0x35')]=_[_0x8ea9('0x37')](db[_0x8ea9('0x30')][_0x8ea9('0x31')]);_0x5eec31[_0x8ea9('0x36')]=_['keys'](_0x212517[_0x8ea9('0x36')]);_0x5eec31[_0x8ea9('0x38')]=_[_0x8ea9('0x39')](_0x5eec31['model'],_0x5eec31[_0x8ea9('0x36')]);_0x32e0d4['attributes']=_[_0x8ea9('0x39')](_0x5eec31['model'],qs[_0x8ea9('0x3b')](_0x212517['query'][_0x8ea9('0x3b')]));_0x32e0d4[_0x8ea9('0x3a')]=_0x32e0d4[_0x8ea9('0x3a')][_0x8ea9('0x3c')]?_0x32e0d4[_0x8ea9('0x3a')]:_0x5eec31[_0x8ea9('0x35')];if(_0x212517[_0x8ea9('0x36')][_0x8ea9('0x45')]){_0x32e0d4[_0x8ea9('0x46')]=[{'all':!![]}];}_0x32e0d4=_['merge']({},_0x32e0d4,_0x212517[_0x8ea9('0x4b')]);return db[_0x8ea9('0x30')][_0x8ea9('0x4c')](_0x32e0d4)['then'](handleEntityNotFound(_0x1c208a,null))[_0x8ea9('0x27')](respondWithResult(_0x1c208a,null))['catch'](handleError(_0x1c208a,null));};exports[_0x8ea9('0x4d')]=function(_0x11e0f4,_0x390bcf){return db[_0x8ea9('0x30')]['create'](_0x11e0f4['body'],{})[_0x8ea9('0x27')](function(_0x2dcd93){var _0x1ca23d=_0x11e0f4[_0x8ea9('0x4e')][_0x8ea9('0x29')]({'plain':!![]});if(!_0x1ca23d)throw new Error(_0x8ea9('0x4f'));if(_0x1ca23d[_0x8ea9('0x50')]==='user'){var _0x13166c=_0x2dcd93[_0x8ea9('0x29')]({'plain':!![]});var _0x124d11=_0x8ea9('0x2a');return db[_0x8ea9('0x51')][_0x8ea9('0x4c')]({'where':{'name':_0x124d11,'userProfileId':_0x1ca23d[_0x8ea9('0x52')]},'raw':!![]})[_0x8ea9('0x27')](function(_0x199476){if(_0x199476&&_0x199476[_0x8ea9('0x53')]===0x0){return db[_0x8ea9('0x54')][_0x8ea9('0x4d')]({'name':_0x13166c[_0x8ea9('0x2e')],'resourceId':_0x13166c['id'],'type':_0x199476[_0x8ea9('0x2e')],'sectionId':_0x199476['id']},{})[_0x8ea9('0x27')](function(){return _0x2dcd93;});}else{return _0x2dcd93;}})['catch'](function(_0x1fc27a){logger[_0x8ea9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fc27a);throw _0x1fc27a;});}return _0x2dcd93;})[_0x8ea9('0x27')](respondWithResult(_0x390bcf,0xc9))[_0x8ea9('0x48')](handleError(_0x390bcf,null));};exports['update']=function(_0x3f9a44,_0x547456){if(_0x3f9a44[_0x8ea9('0x55')]['id']){delete _0x3f9a44[_0x8ea9('0x55')]['id'];}return db[_0x8ea9('0x30')][_0x8ea9('0x4c')]({'where':{'id':_0x3f9a44[_0x8ea9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x547456,null))[_0x8ea9('0x27')](saveUpdates(_0x3f9a44['body'],null))[_0x8ea9('0x27')](respondWithResult(_0x547456,null))['catch'](handleError(_0x547456,null));};exports[_0x8ea9('0x28')]=function(_0x5b370a,_0x2c0883){return db[_0x8ea9('0x30')]['find']({'where':{'id':_0x5b370a[_0x8ea9('0x4a')]['id']}})[_0x8ea9('0x27')](handleEntityNotFound(_0x2c0883,null))[_0x8ea9('0x27')](removeEntity(_0x2c0883,null))[_0x8ea9('0x48')](handleError(_0x2c0883,null));}; \ No newline at end of file +var _0xff00=['keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','find','catch','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','reject','save','update','then','destroy','Dispositions','UserProfileResource','end','error','name','send','index','map','Disposition','type','key','query'];(function(_0x2e3eea,_0x44102f){var _0xc7942c=function(_0x379d63){while(--_0x379d63){_0x2e3eea['push'](_0x2e3eea['shift']());}};_0xc7942c(++_0x44102f);}(_0xff00,0x1a6));var _0x0ff0=function(_0x59a760,_0x545a0d){_0x59a760=_0x59a760-0x0;var _0x4a0a38=_0xff00[_0x59a760];return _0x4a0a38;};'use strict';var emlformat=require(_0x0ff0('0x0'));var rimraf=require(_0x0ff0('0x1'));var zipdir=require(_0x0ff0('0x2'));var jsonpatch=require(_0x0ff0('0x3'));var rp=require('request-promise');var moment=require(_0x0ff0('0x4'));var BPromise=require(_0x0ff0('0x5'));var Mustache=require('mustache');var util=require(_0x0ff0('0x6'));var path=require(_0x0ff0('0x7'));var sox=require(_0x0ff0('0x8'));var csv=require(_0x0ff0('0x9'));var ejs=require(_0x0ff0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ff0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ff0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ff0('0xd'));var Redis=require('ioredis');var authService=require(_0x0ff0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0ff0('0xf'));var hardwareService=require(_0x0ff0('0x10'));var logger=require(_0x0ff0('0x11'))(_0x0ff0('0x12'));var utils=require('../../config/utils');var config=require(_0x0ff0('0x13'));var licenseUtil=require(_0x0ff0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2581b7,_0xaf8e0a){_0xaf8e0a=_0xaf8e0a||0xcc;return function(_0x20a119){if(_0x20a119){return _0x2581b7[_0x0ff0('0x15')](_0xaf8e0a);}return _0x2581b7['status'](_0xaf8e0a)['end']();};}function respondWithResult(_0x5d1498,_0x173c54){_0x173c54=_0x173c54||0xc8;return function(_0x1e3d57){if(_0x1e3d57){return _0x5d1498['status'](_0x173c54)[_0x0ff0('0x16')](_0x1e3d57);}};}function respondWithFilteredResult(_0x482610,_0x4154dc){return function(_0x10d422){if(_0x10d422){var _0x43bd62=typeof _0x4154dc[_0x0ff0('0x17')]===_0x0ff0('0x18')&&typeof _0x4154dc[_0x0ff0('0x19')]===_0x0ff0('0x18');var _0x55ad62=_0x10d422[_0x0ff0('0x1a')];var _0x433a08=_0x43bd62?0x0:_0x4154dc[_0x0ff0('0x17')];var _0x1e5eef=_0x43bd62?_0x10d422[_0x0ff0('0x1a')]:_0x4154dc[_0x0ff0('0x17')]+_0x4154dc['limit'];var _0x42d0a6;if(_0x1e5eef>=_0x55ad62){_0x1e5eef=_0x55ad62;_0x42d0a6=0xc8;}else{_0x42d0a6=0xce;}_0x482610[_0x0ff0('0x1b')](_0x42d0a6);return _0x482610[_0x0ff0('0x1c')]('Content-Range',_0x433a08+'-'+_0x1e5eef+'/'+_0x55ad62)[_0x0ff0('0x16')](_0x10d422);}return null;};}function patchUpdates(_0x3fed17){return function(_0x220a92){try{jsonpatch['apply'](_0x220a92,_0x3fed17,!![]);}catch(_0x3c9a0c){return BPromise[_0x0ff0('0x1d')](_0x3c9a0c);}return _0x220a92[_0x0ff0('0x1e')]();};}function saveUpdates(_0xe81b94,_0x274849){return function(_0x5b3f8d){if(_0x5b3f8d){return _0x5b3f8d[_0x0ff0('0x1f')](_0xe81b94)[_0x0ff0('0x20')](function(_0x327682){return _0x327682;});}return null;};}function removeEntity(_0x283e3c,_0x3bcf4b){return function(_0x1de31e){if(_0x1de31e){return _0x1de31e[_0x0ff0('0x21')]()[_0x0ff0('0x20')](function(){var _0x985831=_0x1de31e['get']({'plain':!![]});var _0x1a9d06=_0x0ff0('0x22');return db[_0x0ff0('0x23')]['destroy']({'where':{'type':_0x1a9d06,'resourceId':_0x985831['id']}})[_0x0ff0('0x20')](function(){return _0x1de31e;});})['then'](function(){_0x283e3c[_0x0ff0('0x1b')](0xcc)[_0x0ff0('0x24')]();});}};}function handleEntityNotFound(_0x42e4ee,_0x514655){return function(_0x104977){if(!_0x104977){_0x42e4ee['sendStatus'](0x194);}return _0x104977;};}function handleError(_0x5c3ae6,_0xf352d3){_0xf352d3=_0xf352d3||0x1f4;return function(_0x28c66b){logger[_0x0ff0('0x25')](_0x28c66b['stack']);if(_0x28c66b['name']){delete _0x28c66b[_0x0ff0('0x26')];}_0x5c3ae6['status'](_0xf352d3)[_0x0ff0('0x27')](_0x28c66b);};}exports[_0x0ff0('0x28')]=function(_0x5736a4,_0x4c300f){var _0x5116ba={},_0x299617={},_0xec1ce2={'count':0x0,'rows':[]};var _0x55c005=_[_0x0ff0('0x29')](db[_0x0ff0('0x2a')]['rawAttributes'],function(_0x9ed018){return{'name':_0x9ed018['fieldName'],'type':_0x9ed018[_0x0ff0('0x2b')][_0x0ff0('0x2c')]};});_0x299617['model']=_[_0x0ff0('0x29')](_0x55c005,_0x0ff0('0x26'));_0x299617[_0x0ff0('0x2d')]=_[_0x0ff0('0x2e')](_0x5736a4['query']);_0x299617[_0x0ff0('0x2f')]=_[_0x0ff0('0x30')](_0x299617[_0x0ff0('0x31')],_0x299617['query']);_0x5116ba['attributes']=_['intersection'](_0x299617[_0x0ff0('0x31')],qs['fields'](_0x5736a4[_0x0ff0('0x2d')][_0x0ff0('0x32')]));_0x5116ba[_0x0ff0('0x33')]=_0x5116ba[_0x0ff0('0x33')][_0x0ff0('0x34')]?_0x5116ba['attributes']:_0x299617[_0x0ff0('0x31')];if(!_0x5736a4[_0x0ff0('0x2d')]['hasOwnProperty'](_0x0ff0('0x35'))){_0x5116ba['limit']=qs[_0x0ff0('0x19')](_0x5736a4[_0x0ff0('0x2d')]['limit']);_0x5116ba[_0x0ff0('0x17')]=qs[_0x0ff0('0x17')](_0x5736a4['query'][_0x0ff0('0x17')]);}_0x5116ba[_0x0ff0('0x36')]=qs[_0x0ff0('0x37')](_0x5736a4['query'][_0x0ff0('0x37')]);_0x5116ba[_0x0ff0('0x38')]=qs[_0x0ff0('0x2f')](_[_0x0ff0('0x39')](_0x5736a4['query'],_0x299617[_0x0ff0('0x2f')]),_0x55c005);if(_0x5736a4[_0x0ff0('0x2d')][_0x0ff0('0x3a')]){_0x5116ba[_0x0ff0('0x38')]=_[_0x0ff0('0x3b')](_0x5116ba['where'],{'$or':_[_0x0ff0('0x29')](_0x55c005,function(_0x24a1a8){if(_0x24a1a8[_0x0ff0('0x2b')]!==_0x0ff0('0x3c')){var _0x339d68={};_0x339d68[_0x24a1a8[_0x0ff0('0x26')]]={'$like':'%'+_0x5736a4[_0x0ff0('0x2d')][_0x0ff0('0x3a')]+'%'};return _0x339d68;}})});}_0x5116ba=_['merge']({},_0x5116ba,_0x5736a4[_0x0ff0('0x3d')]);var _0x16b52a={'where':_0x5116ba['where']};return db['Disposition'][_0x0ff0('0x1a')](_0x16b52a)[_0x0ff0('0x20')](function(_0x24bd09){_0xec1ce2['count']=_0x24bd09;if(_0x5736a4[_0x0ff0('0x2d')][_0x0ff0('0x3e')]){_0x5116ba['include']=[{'all':!![]}];}return db[_0x0ff0('0x2a')][_0x0ff0('0x3f')](_0x5116ba);})[_0x0ff0('0x20')](function(_0x1efeee){_0xec1ce2[_0x0ff0('0x40')]=_0x1efeee;return _0xec1ce2;})[_0x0ff0('0x20')](respondWithFilteredResult(_0x4c300f,_0x5116ba))['catch'](handleError(_0x4c300f,null));};exports[_0x0ff0('0x41')]=function(_0x571935,_0x787d36){var _0x1e0c1e={'raw':!![],'where':{'id':_0x571935['params']['id']}},_0x2cd42a={};_0x2cd42a[_0x0ff0('0x31')]=_[_0x0ff0('0x2e')](db[_0x0ff0('0x2a')][_0x0ff0('0x42')]);_0x2cd42a['query']=_['keys'](_0x571935[_0x0ff0('0x2d')]);_0x2cd42a[_0x0ff0('0x2f')]=_[_0x0ff0('0x30')](_0x2cd42a[_0x0ff0('0x31')],_0x2cd42a[_0x0ff0('0x2d')]);_0x1e0c1e['attributes']=_[_0x0ff0('0x30')](_0x2cd42a['model'],qs[_0x0ff0('0x32')](_0x571935[_0x0ff0('0x2d')]['fields']));_0x1e0c1e[_0x0ff0('0x33')]=_0x1e0c1e['attributes'][_0x0ff0('0x34')]?_0x1e0c1e[_0x0ff0('0x33')]:_0x2cd42a[_0x0ff0('0x31')];if(_0x571935[_0x0ff0('0x2d')][_0x0ff0('0x3e')]){_0x1e0c1e['include']=[{'all':!![]}];}_0x1e0c1e=_[_0x0ff0('0x3b')]({},_0x1e0c1e,_0x571935[_0x0ff0('0x3d')]);return db['Disposition'][_0x0ff0('0x43')](_0x1e0c1e)[_0x0ff0('0x20')](handleEntityNotFound(_0x787d36,null))[_0x0ff0('0x20')](respondWithResult(_0x787d36,null))[_0x0ff0('0x44')](handleError(_0x787d36,null));};exports[_0x0ff0('0x45')]=function(_0x19df39,_0x3b1672){return db[_0x0ff0('0x2a')][_0x0ff0('0x45')](_0x19df39[_0x0ff0('0x46')],{})[_0x0ff0('0x20')](function(_0x166494){var _0x4e9591=_0x19df39[_0x0ff0('0x47')]['get']({'plain':!![]});if(!_0x4e9591)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e9591[_0x0ff0('0x48')]===_0x0ff0('0x47')){var _0x305309=_0x166494[_0x0ff0('0x49')]({'plain':!![]});var _0x1292a1='Dispositions';return db[_0x0ff0('0x4a')][_0x0ff0('0x43')]({'where':{'name':_0x1292a1,'userProfileId':_0x4e9591[_0x0ff0('0x4b')]},'raw':!![]})[_0x0ff0('0x20')](function(_0x2a9807){if(_0x2a9807&&_0x2a9807[_0x0ff0('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x305309[_0x0ff0('0x26')],'resourceId':_0x305309['id'],'type':_0x2a9807[_0x0ff0('0x26')],'sectionId':_0x2a9807['id']},{})['then'](function(){return _0x166494;});}else{return _0x166494;}})[_0x0ff0('0x44')](function(_0x3e96bc){logger[_0x0ff0('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e96bc);throw _0x3e96bc;});}return _0x166494;})['then'](respondWithResult(_0x3b1672,0xc9))[_0x0ff0('0x44')](handleError(_0x3b1672,null));};exports['update']=function(_0x2d65d1,_0x1cc2d3){if(_0x2d65d1[_0x0ff0('0x46')]['id']){delete _0x2d65d1[_0x0ff0('0x46')]['id'];}return db[_0x0ff0('0x2a')][_0x0ff0('0x43')]({'where':{'id':_0x2d65d1['params']['id']}})['then'](handleEntityNotFound(_0x1cc2d3,null))[_0x0ff0('0x20')](saveUpdates(_0x2d65d1[_0x0ff0('0x46')],null))[_0x0ff0('0x20')](respondWithResult(_0x1cc2d3,null))[_0x0ff0('0x44')](handleError(_0x1cc2d3,null));};exports[_0x0ff0('0x21')]=function(_0x2e2a5d,_0x17b53a){return db[_0x0ff0('0x2a')]['find']({'where':{'id':_0x2e2a5d[_0x0ff0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17b53a,null))[_0x0ff0('0x20')](removeEntity(_0x17b53a,null))[_0x0ff0('0x44')](handleError(_0x17b53a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 5fae798..cd71c8d 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 _0x543f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x3b4bfb,_0x52a83e){var _0x5a820f=function(_0x3f8b09){while(--_0x3f8b09){_0x3b4bfb['push'](_0x3b4bfb['shift']());}};_0x5a820f(++_0x52a83e);}(_0x543f,0x18f));var _0xf543=function(_0x10837b,_0x3f2838){_0x10837b=_0x10837b-0x0;var _0x1e64b5=_0x543f[_0x10837b];return _0x1e64b5;};'use strict';var _=require(_0xf543('0x0'));var util=require(_0xf543('0x1'));var logger=require(_0xf543('0x2'))(_0xf543('0x3'));var moment=require(_0xf543('0x4'));var BPromise=require(_0xf543('0x5'));var rp=require(_0xf543('0x6'));var fs=require('fs');var path=require(_0xf543('0x7'));var rimraf=require(_0xf543('0x8'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xf543('0x9')]=function(_0x5ccccd,_0x58b240){return _0x5ccccd['define'](_0xf543('0xa'),attributes,{'tableName':_0xf543('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf543('0xc'),'fields':['name',_0xf543('0xd')]},{'unique':!![],'name':_0xf543('0xe'),'fields':[_0xf543('0xf'),_0xf543('0x10')]},{'unique':!![],'name':_0xf543('0x11'),'fields':[_0xf543('0xf'),'MailAccountId']},{'unique':!![],'name':_0xf543('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xf543('0x13'),'fields':[_0xf543('0xf'),_0xf543('0x14')]},{'unique':!![],'name':_0xf543('0x15'),'fields':[_0xf543('0xf'),_0xf543('0x16')]},{'unique':!![],'name':_0xf543('0x17'),'fields':[_0xf543('0xf'),_0xf543('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb284=['name_voice','ListId','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_whatsapp','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions'];(function(_0x2abe6c,_0xf74f56){var _0x4a7db1=function(_0x3ff6b4){while(--_0x3ff6b4){_0x2abe6c['push'](_0x2abe6c['shift']());}};_0x4a7db1(++_0xf74f56);}(_0xb284,0x1ee));var _0x4b28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb284[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4b28('0x0'));var util=require(_0x4b28('0x1'));var logger=require('../../config/logger')(_0x4b28('0x2'));var moment=require(_0x4b28('0x3'));var BPromise=require(_0x4b28('0x4'));var rp=require(_0x4b28('0x5'));var fs=require('fs');var path=require(_0x4b28('0x6'));var rimraf=require('rimraf');var config=require(_0x4b28('0x7'));var attributes=require(_0x4b28('0x8'));module[_0x4b28('0x9')]=function(_0x1b0f86,_0x20fa0a){return _0x1b0f86['define'](_0x4b28('0xa'),attributes,{'tableName':_0x4b28('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4b28('0xc'),'fields':['name',_0x4b28('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x4b28('0xe'),_0x4b28('0xf')]},{'unique':!![],'name':_0x4b28('0x10'),'fields':[_0x4b28('0xe'),_0x4b28('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x4b28('0xe'),_0x4b28('0x12')]},{'unique':!![],'name':_0x4b28('0x13'),'fields':[_0x4b28('0xe'),_0x4b28('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x4b28('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4b28('0x15'),'fields':[_0x4b28('0xe'),'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 295107e..64a9b36 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(_0x1b341c,_0x100e51){var _0x36a3fb=function(_0x2ef63d){while(--_0x2ef63d){_0x1b341c['push'](_0x1b341c['shift']());}};_0x36a3fb(++_0x100e51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2ab0b6,_0x34078f){var _0x1bd9bb=function(_0x461cb1){while(--_0x461cb1){_0x2ab0b6['push'](_0x2ab0b6['shift']());}};_0x1bd9bb(++_0x34078f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 3f96b33..3e58263 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 _0x43e3=['post','create','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x43e3,0x16b));var _0x343e=function(_0x522bc8,_0x3525bf){_0x522bc8=_0x522bc8-0x0;var _0x5c5ab4=_0x43e3[_0x522bc8];return _0x5c5ab4;};'use strict';var multer=require(_0x343e('0x0'));var util=require('util');var path=require(_0x343e('0x1'));var timeout=require(_0x343e('0x2'));var express=require('express');var router=express[_0x343e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x343e('0x4'));var interaction=require(_0x343e('0x5'));var config=require(_0x343e('0x6'));var controller=require('./disposition.controller');router['get']('/',auth[_0x343e('0x7')](),controller[_0x343e('0x8')]);router[_0x343e('0x9')](_0x343e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x343e('0xb')]('/',auth[_0x343e('0x7')](),controller[_0x343e('0xc')]);router[_0x343e('0xd')](_0x343e('0xa'),auth['isAuthenticated'](),controller[_0x343e('0xe')]);router[_0x343e('0xf')]('/:id',auth[_0x343e('0x7')](),controller['destroy']);module[_0x343e('0x10')]=router; \ No newline at end of file +var _0x60c7=['update','delete','exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','/:id','show','post'];(function(_0xe3c2de,_0x450b01){var _0x1a73d4=function(_0x382736){while(--_0x382736){_0xe3c2de['push'](_0xe3c2de['shift']());}};_0x1a73d4(++_0x450b01);}(_0x60c7,0xb9));var _0x760c=function(_0x577623,_0x392653){_0x577623=_0x577623-0x0;var _0xb9c348=_0x60c7[_0x577623];return _0xb9c348;};'use strict';var multer=require('multer');var util=require(_0x760c('0x0'));var path=require('path');var timeout=require(_0x760c('0x1'));var express=require('express');var router=express[_0x760c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x760c('0x3'));var config=require(_0x760c('0x4'));var controller=require(_0x760c('0x5'));router['get']('/',auth[_0x760c('0x6')](),controller[_0x760c('0x7')]);router['get'](_0x760c('0x8'),auth['isAuthenticated'](),controller[_0x760c('0x9')]);router[_0x760c('0xa')]('/',auth[_0x760c('0x6')](),controller['create']);router['put'](_0x760c('0x8'),auth[_0x760c('0x6')](),controller[_0x760c('0xb')]);router[_0x760c('0xc')](_0x760c('0x8'),auth[_0x760c('0x6')](),controller['destroy']);module[_0x760c('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index fd942c6..ee6575b 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 _0x59a2=['INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','4800','14400','v17,v27,v29'];(function(_0x7642c,_0x2ec4b0){var _0x5412fd=function(_0xffc8e3){while(--_0xffc8e3){_0x7642c['push'](_0x7642c['shift']());}};_0x5412fd(++_0x2ec4b0);}(_0x59a2,0x12b));var _0x259a=function(_0x3896b6,_0x27450b){_0x3896b6=_0x3896b6-0x0;var _0x4ba030=_0x59a2[_0x3896b6];return _0x4ba030;};'use strict';var Sequelize=require('sequelize');module[_0x259a('0x0')]={'name':{'type':Sequelize[_0x259a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x259a('0x1')]},'ecm':{'type':Sequelize[_0x259a('0x2')](_0x259a('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x259a('0x1')],'defaultValue':_0x259a('0x4')},'localstationid':{'type':Sequelize[_0x259a('0x1')],'unique':_0x259a('0x5')},'minrate':{'type':Sequelize[_0x259a('0x2')](_0x259a('0x6'),'4800',_0x259a('0x7'),_0x259a('0x8'),_0x259a('0x9'),'14400'),'defaultValue':_0x259a('0xa')},'maxrate':{'type':Sequelize[_0x259a('0x2')](_0x259a('0x6'),_0x259a('0xa'),_0x259a('0x7'),_0x259a('0x8'),'12000',_0x259a('0xb')),'defaultValue':_0x259a('0xb')},'modem':{'type':Sequelize[_0x259a('0x1')],'defaultValue':_0x259a('0xc')},'gateway':{'type':Sequelize[_0x259a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x259a('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x259a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x259a('0xe'),_0x259a('0xf'),_0x259a('0x10'),_0x259a('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x259a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x259a('0x12');}},'notificationSound':{'type':Sequelize[_0x259a('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x259a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x259a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x259a('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x259a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x259a('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x259a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x259a('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x259a('0x14'),'set':function(_0x4e15ef){if(!_0x4e15ef)this[_0x259a('0x15')](_0x259a('0x16'),null);this[_0x259a('0x15')](_0x259a('0x17'),_0x4e15ef);}}}; \ No newline at end of file +var _0xf9de=['KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','14400','9600','12000','INTEGER','IAX','DADHI'];(function(_0x31fd35,_0x158155){var _0x574b81=function(_0x200faa){while(--_0x200faa){_0x31fd35['push'](_0x31fd35['shift']());}};_0x574b81(++_0x158155);}(_0xf9de,0x99));var _0xef9d=function(_0x554671,_0x546995){_0x554671=_0x554671-0x0;var _0x335a5c=_0xf9de[_0x554671];return _0x335a5c;};'use strict';var Sequelize=require(_0xef9d('0x0'));module[_0xef9d('0x1')]={'name':{'type':Sequelize[_0xef9d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xef9d('0x3')](_0xef9d('0x4'),'no'),'defaultValue':_0xef9d('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xef9d('0x2')],'unique':_0xef9d('0x5')},'minrate':{'type':Sequelize['ENUM'](_0xef9d('0x6'),_0xef9d('0x7'),_0xef9d('0x8'),'9600','12000',_0xef9d('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xef9d('0x3')](_0xef9d('0x6'),_0xef9d('0x7'),_0xef9d('0x8'),_0xef9d('0xa'),_0xef9d('0xb'),'14400'),'defaultValue':_0xef9d('0x9')},'modem':{'type':Sequelize[_0xef9d('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xef9d('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xef9d('0x3')]('SIP',_0xef9d('0xd'),_0xef9d('0xe'),_0xef9d('0xf')),'defaultValue':_0xef9d('0x10')},'key':{'type':Sequelize[_0xef9d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xef9d('0x11')],'defaultValue':function(){return _0xef9d('0x12');}},'notificationSound':{'type':Sequelize[_0xef9d('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xef9d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xef9d('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef9d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef9d('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef9d('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef9d('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xef9d('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xef9d('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x533f65){if(!_0x533f65)this['setDataValue'](_0xef9d('0x15'),null);this[_0xef9d('0x16')](_0xef9d('0x17'),_0x533f65);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2a2bb82..9b8e4dd 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 _0xcc11=['Contacts','attachments','join','basename','CheckAfterSend','isNil','from','fax','defaults','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','include','FaxAccount','findAll','rows','show','params','Pause','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','gateway','faxdetect','maxrate','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcc11,0xda));var _0x1cc1=function(_0x29f258,_0x559572){_0x29f258=_0x29f258-0x0;var _0x1315c7=_0xcc11[_0x29f258];return _0x1315c7;};'use strict';var emlformat=require(_0x1cc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1cc1('0x1'));var jsonpatch=require(_0x1cc1('0x2'));var rp=require(_0x1cc1('0x3'));var moment=require(_0x1cc1('0x4'));var BPromise=require(_0x1cc1('0x5'));var Mustache=require('mustache');var util=require(_0x1cc1('0x6'));var path=require(_0x1cc1('0x7'));var sox=require(_0x1cc1('0x8'));var csv=require(_0x1cc1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cc1('0xa'));var _=require(_0x1cc1('0xb'));var squel=require(_0x1cc1('0xc'));var crypto=require(_0x1cc1('0xd'));var jsforce=require(_0x1cc1('0xe'));var deskjs=require(_0x1cc1('0xf'));var toCsv=require(_0x1cc1('0x9'));var querystring=require(_0x1cc1('0x10'));var Papa=require(_0x1cc1('0x11'));var Redis=require(_0x1cc1('0x12'));var authService=require(_0x1cc1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1cc1('0x14'));var hardwareService=require(_0x1cc1('0x15'));var logger=require(_0x1cc1('0x16'))(_0x1cc1('0x17'));var utils=require('../../config/utils');var config=require(_0x1cc1('0x18'));var licenseUtil=require(_0x1cc1('0x19'));var db=require('../../mysqldb')['db'];config[_0x1cc1('0x1a')]=_['defaults'](config['redis'],{'host':_0x1cc1('0x1b'),'port':0x18eb});var socket=require(_0x1cc1('0x1c'))(new Redis(config['redis']));require(_0x1cc1('0x1d'))['register'](socket);var jayson=require(_0x1cc1('0x1e'));var client=jayson[_0x1cc1('0x1f')][_0x1cc1('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x1cc1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2ecfe0,_0x53cf5f,_0x1c2982,_0x10b341){return new BPromise(function(_0x5c8586,_0x154a32){var _0x5534c6=_0x10b341||client;return _0x5534c6[_0x1cc1('0x21')](_0x2ecfe0,_0x1c2982)['then'](function(_0x3abb62){logger[_0x1cc1('0x22')](_0x1cc1('0x23'),_0x53cf5f,_0x1cc1('0x24'));logger[_0x1cc1('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53cf5f,_0x1cc1('0x24'),JSON[_0x1cc1('0x26')](_0x3abb62));if(_0x3abb62[_0x1cc1('0x27')]){if(_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x28')]===0x1f4){logger[_0x1cc1('0x27')](_0x1cc1('0x23'),_0x53cf5f,_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);return _0x154a32(_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);}logger[_0x1cc1('0x27')](_0x1cc1('0x23'),_0x53cf5f,_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);return _0x5c8586(_0x3abb62[_0x1cc1('0x27')][_0x1cc1('0x29')]);}else{logger['info'](_0x1cc1('0x23'),_0x53cf5f,_0x1cc1('0x24'));_0x5c8586(_0x3abb62[_0x1cc1('0x2a')][_0x1cc1('0x29')]);}})[_0x1cc1('0x2b')](function(_0x428137){logger['error']('FaxAccount,\x20%s,\x20%s',_0x53cf5f,_0x428137);_0x154a32(_0x428137);});});}function respondWithStatusCode(_0x2dcfba,_0x31a51){_0x31a51=_0x31a51||0xcc;return function(_0x555e93){if(_0x555e93){return _0x2dcfba[_0x1cc1('0x2c')](_0x31a51);}return _0x2dcfba['status'](_0x31a51)[_0x1cc1('0x2d')]();};}function respondWithResult(_0x5b030f,_0x573d70){_0x573d70=_0x573d70||0xc8;return function(_0x51dfb2){if(_0x51dfb2){return _0x5b030f[_0x1cc1('0x2e')](_0x573d70)[_0x1cc1('0x2f')](_0x51dfb2);}};}function respondWithFilteredResult(_0x1f7a62,_0x93541a){return function(_0x3ed8a2){if(_0x3ed8a2){var _0x5af1d4=typeof _0x93541a[_0x1cc1('0x30')]===_0x1cc1('0x31')&&typeof _0x93541a['limit']==='undefined';var _0x3d343b=_0x3ed8a2['count'];var _0x326234=_0x5af1d4?0x0:_0x93541a[_0x1cc1('0x30')];var _0x21be14=_0x5af1d4?_0x3ed8a2[_0x1cc1('0x32')]:_0x93541a[_0x1cc1('0x30')]+_0x93541a[_0x1cc1('0x33')];var _0x11715e;if(_0x21be14>=_0x3d343b){_0x21be14=_0x3d343b;_0x11715e=0xc8;}else{_0x11715e=0xce;}_0x1f7a62[_0x1cc1('0x2e')](_0x11715e);return _0x1f7a62[_0x1cc1('0x34')](_0x1cc1('0x35'),_0x326234+'-'+_0x21be14+'/'+_0x3d343b)['json'](_0x3ed8a2);}return null;};}function patchUpdates(_0x455095){return function(_0x415985){try{jsonpatch[_0x1cc1('0x36')](_0x415985,_0x455095,!![]);}catch(_0x340b38){return BPromise['reject'](_0x340b38);}return _0x415985['save']();};}function saveUpdates(_0x368f18,_0x6cda36){return function(_0x2b5b78){if(_0x2b5b78){return _0x2b5b78[_0x1cc1('0x37')](_0x368f18)[_0x1cc1('0x38')](function(_0x27eaf9){return _0x27eaf9;});}return null;};}function removeEntity(_0x2c0262,_0x2f7b20){return function(_0x35e55d){if(_0x35e55d){return _0x35e55d['destroy']()[_0x1cc1('0x38')](function(){var _0x32a37a=_0x35e55d[_0x1cc1('0x39')]({'plain':!![]});var _0x307e44=_0x1cc1('0x3a');return db[_0x1cc1('0x3b')][_0x1cc1('0x3c')]({'where':{'type':_0x307e44,'resourceId':_0x32a37a['id']}})[_0x1cc1('0x38')](function(){return _0x35e55d;});})['then'](function(){_0x2c0262[_0x1cc1('0x2e')](0xcc)[_0x1cc1('0x2d')]();});}};}function handleEntityNotFound(_0x28392f,_0xdc117a){return function(_0xcff1b8){if(!_0xcff1b8){_0x28392f[_0x1cc1('0x2c')](0x194);}return _0xcff1b8;};}function handleError(_0x194392,_0x3f6bb2){_0x3f6bb2=_0x3f6bb2||0x1f4;return function(_0x132045){logger[_0x1cc1('0x27')](_0x132045[_0x1cc1('0x3d')]);if(_0x132045['name']){delete _0x132045[_0x1cc1('0x3e')];}_0x194392[_0x1cc1('0x2e')](_0x3f6bb2)['send'](_0x132045);};}exports[_0x1cc1('0x3f')]=function(_0x463aaa,_0x2e865){var _0x315892={'include':[{'model':db['Pause'],'as':_0x1cc1('0x40')}]},_0x324f74={},_0x990749={'count':0x0,'rows':[]};var _0x6306c5=_['map'](db['FaxAccount'][_0x1cc1('0x41')],function(_0x570425){return{'name':_0x570425[_0x1cc1('0x42')],'type':_0x570425[_0x1cc1('0x43')][_0x1cc1('0x44')]};});_0x324f74[_0x1cc1('0x45')]=_[_0x1cc1('0x46')](_0x6306c5,_0x1cc1('0x3e'));_0x324f74[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x463aaa[_0x1cc1('0x47')]);_0x324f74['filters']=_[_0x1cc1('0x49')](_0x324f74[_0x1cc1('0x45')],_0x324f74[_0x1cc1('0x47')]);_0x315892['attributes']=_['intersection'](_0x324f74['model'],qs[_0x1cc1('0x4a')](_0x463aaa[_0x1cc1('0x47')]['fields']));_0x315892[_0x1cc1('0x4b')]=_0x315892[_0x1cc1('0x4b')]['length']?_0x315892[_0x1cc1('0x4b')]:_0x324f74[_0x1cc1('0x45')];if(!_0x463aaa[_0x1cc1('0x47')][_0x1cc1('0x4c')](_0x1cc1('0x4d'))){_0x315892[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x463aaa[_0x1cc1('0x47')]['limit']);_0x315892[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x463aaa['query'][_0x1cc1('0x30')]);}_0x315892[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x463aaa[_0x1cc1('0x47')]['sort']);_0x315892[_0x1cc1('0x50')]=qs['filters'](_[_0x1cc1('0x51')](_0x463aaa['query'],_0x324f74[_0x1cc1('0x52')]),_0x6306c5);if(_0x463aaa[_0x1cc1('0x47')][_0x1cc1('0x53')]){_0x315892[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x315892['where'],{'$or':_[_0x1cc1('0x46')](_0x6306c5,function(_0xe0c23a){if(_0xe0c23a[_0x1cc1('0x43')]!=='VIRTUAL'){var _0x51cde5={};_0x51cde5[_0xe0c23a['name']]={'$like':'%'+_0x463aaa[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x51cde5;}})});}_0x315892=_[_0x1cc1('0x54')]({},_0x315892,_0x463aaa[_0x1cc1('0x55')]);var _0x285e68={'where':_0x315892[_0x1cc1('0x50')]};return db['FaxAccount']['count'](_0x285e68)[_0x1cc1('0x38')](function(_0x1db818){_0x990749[_0x1cc1('0x32')]=_0x1db818;if(_0x463aaa[_0x1cc1('0x47')]['includeAll']){_0x315892[_0x1cc1('0x56')]=[{'all':!![]}];}return db[_0x1cc1('0x57')][_0x1cc1('0x58')](_0x315892);})[_0x1cc1('0x38')](function(_0x289d8c){_0x990749[_0x1cc1('0x59')]=_0x289d8c;return _0x990749;})[_0x1cc1('0x38')](respondWithFilteredResult(_0x2e865,_0x315892))['catch'](handleError(_0x2e865,null));};exports[_0x1cc1('0x5a')]=function(_0x1436bf,_0x1d493c){var _0x547c7a={'raw':![],'where':{'id':_0x1436bf[_0x1cc1('0x5b')]['id']},'include':[{'model':db[_0x1cc1('0x5c')],'as':_0x1cc1('0x40')}]},_0x54b4a1={};_0x54b4a1[_0x1cc1('0x45')]=_[_0x1cc1('0x48')](db[_0x1cc1('0x57')]['rawAttributes']);_0x54b4a1[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x1436bf[_0x1cc1('0x47')]);_0x54b4a1[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x54b4a1[_0x1cc1('0x45')],_0x54b4a1[_0x1cc1('0x47')]);_0x547c7a['attributes']=_[_0x1cc1('0x49')](_0x54b4a1[_0x1cc1('0x45')],qs[_0x1cc1('0x4a')](_0x1436bf[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x547c7a[_0x1cc1('0x4b')]=_0x547c7a[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x547c7a[_0x1cc1('0x4b')]:_0x54b4a1[_0x1cc1('0x45')];if(_0x1436bf[_0x1cc1('0x47')]['includeAll']){_0x547c7a[_0x1cc1('0x56')]=[{'all':!![]}];}_0x547c7a=_[_0x1cc1('0x54')]({},_0x547c7a,_0x1436bf['options']);return db['FaxAccount'][_0x1cc1('0x5e')](_0x547c7a)[_0x1cc1('0x38')](handleEntityNotFound(_0x1d493c,null))[_0x1cc1('0x38')](respondWithResult(_0x1d493c,null))['catch'](handleError(_0x1d493c,null));};exports[_0x1cc1('0x5f')]=function(_0x4fe9b0,_0x4c339b){return db[_0x1cc1('0x57')][_0x1cc1('0x5f')](_0x4fe9b0['body'],{})[_0x1cc1('0x38')](function(_0x531c87){var _0xc9d849=_0x4fe9b0[_0x1cc1('0x60')][_0x1cc1('0x39')]({'plain':!![]});if(!_0xc9d849)throw new Error(_0x1cc1('0x61'));if(_0xc9d849[_0x1cc1('0x62')]===_0x1cc1('0x60')){var _0x26c627=_0x531c87[_0x1cc1('0x39')]({'plain':!![]});var _0x11f4b3='FaxAccounts';return db[_0x1cc1('0x63')][_0x1cc1('0x5e')]({'where':{'name':_0x11f4b3,'userProfileId':_0xc9d849['userProfileId']},'raw':!![]})[_0x1cc1('0x38')](function(_0x56cd44){if(_0x56cd44&&_0x56cd44[_0x1cc1('0x64')]===0x0){return db['UserProfileResource'][_0x1cc1('0x5f')]({'name':_0x26c627[_0x1cc1('0x3e')],'resourceId':_0x26c627['id'],'type':_0x56cd44[_0x1cc1('0x3e')],'sectionId':_0x56cd44['id']},{})[_0x1cc1('0x38')](function(){return _0x531c87;});}else{return _0x531c87;}})[_0x1cc1('0x2b')](function(_0x5f0db2){logger[_0x1cc1('0x27')](_0x1cc1('0x65'),_0x5f0db2);throw _0x5f0db2;});}return _0x531c87;})['then'](respondWithResult(_0x4c339b,0xc9))[_0x1cc1('0x2b')](handleError(_0x4c339b,null));};exports[_0x1cc1('0x37')]=function(_0x63d965,_0x3e0245){if(_0x63d965[_0x1cc1('0x66')]['id']){delete _0x63d965[_0x1cc1('0x66')]['id'];}return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x63d965[_0x1cc1('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x1cc1('0x40')}]})[_0x1cc1('0x38')](handleEntityNotFound(_0x3e0245,null))[_0x1cc1('0x38')](saveUpdates(_0x63d965[_0x1cc1('0x66')],null))[_0x1cc1('0x38')](respondWithResult(_0x3e0245,null))[_0x1cc1('0x2b')](handleError(_0x3e0245,null));};exports[_0x1cc1('0x3c')]=function(_0x41095e,_0x263590){return db[_0x1cc1('0x57')]['find']({'where':{'id':_0x41095e[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x263590,null))[_0x1cc1('0x38')](removeEntity(_0x263590,null))['catch'](handleError(_0x263590,null));};exports[_0x1cc1('0x67')]=function(_0x275060,_0x11cad4){return db[_0x1cc1('0x57')][_0x1cc1('0x67')]()[_0x1cc1('0x38')](respondWithResult(_0x11cad4,null))[_0x1cc1('0x2b')](handleError(_0x11cad4,null));};exports[_0x1cc1('0x68')]=function(_0x26d595,_0x5ebbeb,_0x1bedec){if(_0x26d595[_0x1cc1('0x66')]['id']){delete _0x26d595['body']['id'];}return db['FaxAccount'][_0x1cc1('0x5e')]({'where':{'id':_0x26d595[_0x1cc1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5ebbeb,null))[_0x1cc1('0x38')](function(_0x47f5ef){if(_0x47f5ef){_0x26d595[_0x1cc1('0x66')]['FaxAccountId']=_0x47f5ef['id'];return db[_0x1cc1('0x69')][_0x1cc1('0x5f')](_0x26d595[_0x1cc1('0x66')]);}})[_0x1cc1('0x38')](respondWithResult(_0x5ebbeb,null))[_0x1cc1('0x2b')](handleError(_0x5ebbeb,null));};exports[_0x1cc1('0x6a')]=function(_0x156d14,_0x5b2e00,_0x1195bf){var _0x377605={'raw':![],'where':{}};var _0x4a4303={};var _0x410d90={'count':0x0,'rows':[]};return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x156d14['params']['id']}})['then'](handleEntityNotFound(_0x5b2e00,null))[_0x1cc1('0x38')](function(_0x265383){if(_0x265383){_0x4a4303[_0x1cc1('0x45')]=_[_0x1cc1('0x48')](db['Disposition'][_0x1cc1('0x41')]);_0x4a4303[_0x1cc1('0x47')]=_['keys'](_0x156d14['query']);_0x4a4303[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x4a4303['model'],_0x4a4303[_0x1cc1('0x47')]);_0x377605[_0x1cc1('0x4b')]=_['intersection'](_0x4a4303['model'],qs[_0x1cc1('0x4a')](_0x156d14[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x377605[_0x1cc1('0x4b')]=_0x377605[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x377605[_0x1cc1('0x4b')]:_0x4a4303[_0x1cc1('0x45')];if(!_0x156d14[_0x1cc1('0x47')]['hasOwnProperty']('nolimit')){_0x377605[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x156d14[_0x1cc1('0x47')]['limit']);_0x377605[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x156d14['query']['offset']);}_0x377605[_0x1cc1('0x4e')]=qs['sort'](_0x156d14['query'][_0x1cc1('0x4f')]);_0x377605['where']=qs['filters'](_['pick'](_0x156d14[_0x1cc1('0x47')],_0x4a4303[_0x1cc1('0x52')]));_0x377605[_0x1cc1('0x50')][_0x1cc1('0x6c')]=_0x265383['id'];if(_0x156d14[_0x1cc1('0x47')]['filter']){_0x377605[_0x1cc1('0x50')]=_['merge'](_0x377605['where'],{'$or':_[_0x1cc1('0x46')](_0x377605[_0x1cc1('0x4b')],function(_0x7b790f){var _0x37cda5={};_0x37cda5[_0x7b790f]={'$like':'%'+_0x156d14[_0x1cc1('0x47')]['filter']+'%'};return _0x37cda5;})});}_0x377605=_[_0x1cc1('0x54')]({},_0x377605,_0x156d14[_0x1cc1('0x55')]);return db[_0x1cc1('0x69')][_0x1cc1('0x32')]({'where':_0x377605[_0x1cc1('0x50')]})[_0x1cc1('0x38')](function(_0x1ae4b9){_0x410d90[_0x1cc1('0x32')]=_0x1ae4b9;if(_0x156d14['query'][_0x1cc1('0x6d')]){_0x377605['include']=[{'all':!![]}];}return db[_0x1cc1('0x69')][_0x1cc1('0x58')](_0x377605);})[_0x1cc1('0x38')](function(_0x349e3d){_0x410d90[_0x1cc1('0x59')]=_0x349e3d;return _0x410d90;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x5b2e00,_0x377605))[_0x1cc1('0x2b')](handleError(_0x5b2e00,null));};exports[_0x1cc1('0x6e')]=function(_0x1d549e,_0x68df9a,_0x256d49){return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x1d549e[_0x1cc1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x68df9a,null))['then'](function(_0x2012ba){if(_0x2012ba){return _0x2012ba[_0x1cc1('0x6e')](_0x1d549e[_0x1cc1('0x47')][_0x1cc1('0x6f')]);}})[_0x1cc1('0x38')](respondWithStatusCode(_0x68df9a,null))[_0x1cc1('0x2b')](handleError(_0x68df9a,null));};exports[_0x1cc1('0x70')]=function(_0x483005,_0x2bcc28,_0x5c180d){if(_0x483005[_0x1cc1('0x66')]['id']){delete _0x483005['body']['id'];}return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x483005['params']['id']}})['then'](handleEntityNotFound(_0x2bcc28,null))[_0x1cc1('0x38')](function(_0x46a77e){if(_0x46a77e){_0x483005[_0x1cc1('0x66')][_0x1cc1('0x6c')]=_0x46a77e['id'];return db[_0x1cc1('0x71')]['create'](_0x483005[_0x1cc1('0x66')]);}})['then'](respondWithResult(_0x2bcc28,null))['catch'](handleError(_0x2bcc28,null));};exports[_0x1cc1('0x72')]=function(_0x3d2c51,_0x3b578c,_0xc08022){var _0x36bd0d={'raw':![],'where':{}};var _0x38e44c={};var _0x2640c5={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1cc1('0x6b')]({'where':{'id':_0x3d2c51['params']['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x3b578c,null))['then'](function(_0xe48d4e){if(_0xe48d4e){_0x38e44c[_0x1cc1('0x45')]=_['keys'](db[_0x1cc1('0x71')]['rawAttributes']);_0x38e44c[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x3d2c51[_0x1cc1('0x47')]);_0x38e44c[_0x1cc1('0x52')]=_['intersection'](_0x38e44c['model'],_0x38e44c[_0x1cc1('0x47')]);_0x36bd0d[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0x38e44c[_0x1cc1('0x45')],qs['fields'](_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x36bd0d['attributes']=_0x36bd0d['attributes'][_0x1cc1('0x5d')]?_0x36bd0d[_0x1cc1('0x4b')]:_0x38e44c[_0x1cc1('0x45')];if(!_0x3d2c51['query'][_0x1cc1('0x4c')]('nolimit')){_0x36bd0d[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x36bd0d['offset']=qs[_0x1cc1('0x30')](_0x3d2c51['query'][_0x1cc1('0x30')]);}_0x36bd0d[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x4f')]);_0x36bd0d[_0x1cc1('0x50')]=qs[_0x1cc1('0x52')](_[_0x1cc1('0x51')](_0x3d2c51[_0x1cc1('0x47')],_0x38e44c[_0x1cc1('0x52')]));_0x36bd0d[_0x1cc1('0x50')][_0x1cc1('0x6c')]=_0xe48d4e['id'];if(_0x3d2c51[_0x1cc1('0x47')]['filter']){_0x36bd0d[_0x1cc1('0x50')]=_['merge'](_0x36bd0d[_0x1cc1('0x50')],{'$or':_[_0x1cc1('0x46')](_0x36bd0d[_0x1cc1('0x4b')],function(_0x4fdae){var _0x41a432={};_0x41a432[_0x4fdae]={'$like':'%'+_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x41a432;})});}_0x36bd0d=_[_0x1cc1('0x54')]({},_0x36bd0d,_0x3d2c51[_0x1cc1('0x55')]);return db['CannedAnswer'][_0x1cc1('0x32')]({'where':_0x36bd0d[_0x1cc1('0x50')]})[_0x1cc1('0x38')](function(_0x53619e){_0x2640c5[_0x1cc1('0x32')]=_0x53619e;if(_0x3d2c51[_0x1cc1('0x47')][_0x1cc1('0x6d')]){_0x36bd0d[_0x1cc1('0x56')]=[{'all':!![]}];}return db[_0x1cc1('0x71')][_0x1cc1('0x58')](_0x36bd0d);})[_0x1cc1('0x38')](function(_0x14cd15){_0x2640c5['rows']=_0x14cd15;return _0x2640c5;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x3b578c,_0x36bd0d))['catch'](handleError(_0x3b578c,null));};exports['removeAnswers']=function(_0x14c0d6,_0x1444eb,_0x52551f){return db[_0x1cc1('0x57')]['find']({'where':{'id':_0x14c0d6[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x1444eb,null))[_0x1cc1('0x38')](function(_0x25ddbd){if(_0x25ddbd){return _0x25ddbd[_0x1cc1('0x73')](_0x14c0d6['query']['ids']);}})[_0x1cc1('0x38')](respondWithStatusCode(_0x1444eb,null))[_0x1cc1('0x2b')](handleError(_0x1444eb,null));};exports[_0x1cc1('0x74')]=function(_0x10f837,_0x37770f,_0x33701c){return db[_0x1cc1('0x75')][_0x1cc1('0x5e')]({'where':{'id':_0x10f837[_0x1cc1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x37770f,null))['then'](function(_0x5dc59c){if(_0x5dc59c){return _0x5dc59c[_0x1cc1('0x74')](_0x10f837['body'][_0x1cc1('0x6f')],_[_0x1cc1('0x76')](_0x10f837[_0x1cc1('0x66')],[_0x1cc1('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x37770f,null))['catch'](handleError(_0x37770f,null));};exports[_0x1cc1('0x77')]=function(_0x227f25,_0x410a1a,_0x46a1d2){var _0x4ac410={'raw':![],'where':{}};var _0x4d1d6a={};var _0x5575e5={'count':0x0,'rows':[]};return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x227f25[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x410a1a,null))[_0x1cc1('0x38')](function(_0x5a9eeb){if(_0x5a9eeb){_0x4d1d6a[_0x1cc1('0x45')]=_[_0x1cc1('0x48')](db[_0x1cc1('0x75')]['rawAttributes']);_0x4d1d6a[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x227f25[_0x1cc1('0x47')]);_0x4d1d6a[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x4d1d6a[_0x1cc1('0x45')],_0x4d1d6a[_0x1cc1('0x47')]);_0x4ac410[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0x4d1d6a[_0x1cc1('0x45')],qs['fields'](_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x4ac410[_0x1cc1('0x4b')]=_0x4ac410[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x4ac410[_0x1cc1('0x4b')]:_0x4d1d6a[_0x1cc1('0x45')];if(!_0x227f25['query']['hasOwnProperty']('nolimit')){_0x4ac410[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x4ac410[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x30')]);}_0x4ac410[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x227f25['query'][_0x1cc1('0x4f')]);_0x4ac410[_0x1cc1('0x50')]=qs['filters'](_[_0x1cc1('0x51')](_0x227f25[_0x1cc1('0x47')],_0x4d1d6a[_0x1cc1('0x52')]));_0x4ac410['where'][_0x1cc1('0x6c')]=_0x5a9eeb['id'];if(_0x227f25['query']['filter']){_0x4ac410[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x4ac410[_0x1cc1('0x50')],{'$or':_['map'](_0x4ac410[_0x1cc1('0x4b')],function(_0x39c511){var _0x1a8061={};_0x1a8061[_0x39c511]={'$like':'%'+_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x1a8061;})});}_0x4ac410=_['merge']({},_0x4ac410,_0x227f25[_0x1cc1('0x55')]);return db[_0x1cc1('0x75')][_0x1cc1('0x32')]({'where':_0x4ac410[_0x1cc1('0x50')]})['then'](function(_0x22ee51){_0x5575e5[_0x1cc1('0x32')]=_0x22ee51;if(_0x227f25['query'][_0x1cc1('0x6d')]){_0x4ac410['include']=[{'model':db[_0x1cc1('0x78')],'as':_0x1cc1('0x79'),'required':![]},{'model':db[_0x1cc1('0x7a')],'as':'Owner','attributes':[_0x1cc1('0x3e'),_0x1cc1('0x7b'),_0x1cc1('0x7c')],'required':![]},{'model':db[_0x1cc1('0x7d')],'as':'Tags','attributes':['id',_0x1cc1('0x3e'),'color'],'where':_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x7e')]?{'id':_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x7e')]}:undefined,'required':_0x227f25[_0x1cc1('0x47')][_0x1cc1('0x7e')]?!![]:![]}];}return db[_0x1cc1('0x75')]['findAll'](_0x4ac410);})[_0x1cc1('0x38')](function(_0x2aef92){_0x5575e5['rows']=_0x2aef92;return _0x5575e5;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x410a1a,_0x4ac410))[_0x1cc1('0x2b')](handleError(_0x410a1a,null));};exports[_0x1cc1('0x7f')]=function(_0xa56ee,_0x171bd8){var _0x269ad0=_0xa56ee[_0x1cc1('0x5b')]['id'];var _0x2d739a=_0xa56ee[_0x1cc1('0x66')];var _0x22f650=0xc8;var _0x5ad71=null;return db['sequelize'][_0x1cc1('0x80')]({'isolationLevel':db[_0x1cc1('0x81')][_0x1cc1('0x82')][_0x1cc1('0x83')][_0x1cc1('0x84')]},function(_0x3a824e){return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x269ad0},'transaction':_0x3a824e})['then'](function(_0x510bfc){if(_0x510bfc){return db[_0x1cc1('0x85')][_0x1cc1('0x3c')]({'where':{'FaxAccountId':_0x269ad0},'transaction':_0x3a824e})['then'](function(){var _0x1dcd79=_[_0x1cc1('0x46')](_0x2d739a,function(_0xa792a0){_0xa792a0[_0x1cc1('0x6c')]=_0x269ad0;return _0xa792a0;});return db[_0x1cc1('0x85')]['bulkCreate'](_0x1dcd79,{'transaction':_0x3a824e});});}else{_0x22f650=0x194;_0x5ad71=[];}});})[_0x1cc1('0x38')](function(){if(_0x22f650!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x269ad0},'order':_0x1cc1('0x86')})[_0x1cc1('0x38')](function(_0x49e90f){_0x5ad71=_0x49e90f;});}})['catch'](function(_0x36175c){_0x22f650=0x1f4;logger[_0x1cc1('0x27')](_0x36175c[_0x1cc1('0x3d')]);if(_0x36175c[_0x1cc1('0x3e')]){delete _0x36175c['name'];}_0x5ad71=_0x36175c;})[_0x1cc1('0x87')](function(){if(_0x5ad71===null){_0x171bd8['sendStatus'](_0x22f650);}else{if(_0x22f650===0x1f4){_0x171bd8['status'](_0x22f650)[_0x1cc1('0x88')](_0x5ad71);}else{_0x171bd8['status'](_0x22f650)[_0x1cc1('0x2f')](_0x5ad71);}}});};exports['getApplications']=function(_0x59c40b,_0x2589a9,_0xa9089f){var _0x340fd4={};var _0x4a67b8={};var _0xd47bd0;var _0x20ac5f;return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x59c40b['params']['id']}})['then'](handleEntityNotFound(_0x2589a9,null))['then'](function(_0x115bcf){if(_0x115bcf){_0xd47bd0=_0x115bcf;_0x4a67b8['model']=_[_0x1cc1('0x48')](db[_0x1cc1('0x85')]['rawAttributes']);_0x4a67b8[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x59c40b[_0x1cc1('0x47')]);_0x4a67b8[_0x1cc1('0x52')]=_['intersection'](_0x4a67b8[_0x1cc1('0x45')],_0x4a67b8[_0x1cc1('0x47')]);_0x340fd4[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0x4a67b8['model'],qs['fields'](_0x59c40b[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x340fd4['attributes']=_0x340fd4[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x340fd4[_0x1cc1('0x4b')]:_0x4a67b8[_0x1cc1('0x45')];_0x340fd4[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x59c40b[_0x1cc1('0x47')][_0x1cc1('0x4f')]);_0x340fd4[_0x1cc1('0x50')]=qs[_0x1cc1('0x52')](_['pick'](_0x59c40b[_0x1cc1('0x47')],_0x4a67b8[_0x1cc1('0x52')]));if(_0x59c40b[_0x1cc1('0x47')][_0x1cc1('0x53')]){_0x340fd4['where']=_[_0x1cc1('0x54')](_0x340fd4[_0x1cc1('0x50')],{'$or':_['map'](_0x340fd4[_0x1cc1('0x4b')],function(_0x14fbae){var _0x126a18={};_0x126a18[_0x14fbae]={'$like':'%'+_0x59c40b[_0x1cc1('0x47')]['filter']+'%'};return _0x126a18;})});}_0x340fd4=_[_0x1cc1('0x54')]({},_0x340fd4,_0x59c40b[_0x1cc1('0x55')]);return _0xd47bd0[_0x1cc1('0x89')](_0x340fd4);}})[_0x1cc1('0x38')](function(_0x182ebe){if(_0x182ebe){_0x20ac5f=_0x182ebe[_0x1cc1('0x5d')];if(!_0x59c40b['query'][_0x1cc1('0x4c')](_0x1cc1('0x4d'))){_0x340fd4[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x59c40b['query']['limit']);_0x340fd4[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x59c40b['query'][_0x1cc1('0x30')]);}return _0xd47bd0['getApplications'](_0x340fd4);}})[_0x1cc1('0x38')](function(_0x53fd81){if(_0x53fd81){return _0x53fd81?{'count':_0x20ac5f,'rows':_0x53fd81}:null;}})[_0x1cc1('0x38')](respondWithResult(_0x2589a9,null))[_0x1cc1('0x2b')](handleError(_0x2589a9,null));};function Extension(_0x1291f1,_0x5092b8,_0x5a26be,_0x1ec914){this[_0x1cc1('0x8a')]=_0x1cc1('0x8b');this[_0x1cc1('0x8c')]=_0x1291f1[_0x1cc1('0x8d')];this[_0x1cc1('0x8e')]=_0x1ec914;this[_0x1cc1('0x43')]=_0x1cc1('0x8f');this['description']=_0x1cc1('0x90');this[_0x1cc1('0x6c')]=_0x1291f1['id'];this[_0x1cc1('0x86')]=_0x5092b8;this[_0x1cc1('0x91')]=_0x5a26be;}function createExtensionsReciveFax(_0x499e1b){var _0x5f02cf=0x1;var _0x121883=[];_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'','Answer'));_0x5f02cf+=0x1;_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'CDR(type)=inbound-fax','Set'));_0x5f02cf+=0x1;for(var _0xcfde0f in _0x499e1b){if(_0x499e1b[_0x1cc1('0x4c')](_0xcfde0f)&&(_0xcfde0f==='ecm'||_0xcfde0f===_0x1cc1('0x8d')||_0xcfde0f===_0x1cc1('0x93')||_0xcfde0f===_0x1cc1('0x94')||_0xcfde0f==='headerinfo'||_0xcfde0f===_0x1cc1('0x95')||_0xcfde0f==='minrate'||_0xcfde0f==='modem'||_0xcfde0f===_0x1cc1('0x96'))){_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,_0x1cc1('0x97')+_0xcfde0f+')='+_0x499e1b[_0xcfde0f],'Set'));_0x5f02cf+=0x1;}}_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'6',_0x1cc1('0x98')));_0x5f02cf+=0x1;_0x121883[_0x1cc1('0x92')](new Extension(_0x499e1b,_0x5f02cf,'/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',_0x1cc1('0x99')));_0x5f02cf=0x0;return _0x121883;}exports[_0x1cc1('0x9a')]=function(_0x192e73,_0x33997e,_0x10bd73){var _0x3494c1;return db[_0x1cc1('0x81')][_0x1cc1('0x80')](function(_0x393812){return db[_0x1cc1('0x57')][_0x1cc1('0x5f')](_0x192e73['body'],{'transaction':_0x393812})[_0x1cc1('0x38')](function(_0x568440){_0x3494c1=_0x568440[_0x1cc1('0x39')]({'plain':!![]});return db[_0x1cc1('0x9b')][_0x1cc1('0x9c')](createExtensionsReciveFax(_0x3494c1),{'transaction':_0x393812});});})['then'](function(){return _0x3494c1;})[_0x1cc1('0x38')](respondWithResult(_0x33997e,null))[_0x1cc1('0x2b')](handleError(_0x33997e,null));};exports[_0x1cc1('0x9d')]=function(_0x444261,_0x1afc71,_0x5613d5){var _0x3edf3b;return db[_0x1cc1('0x81')][_0x1cc1('0x80')](function(_0x3a84e4){return db[_0x1cc1('0x57')][_0x1cc1('0x37')](_0x444261[_0x1cc1('0x66')],{'where':{'id':_0x444261[_0x1cc1('0x66')]['id']},'transaction':_0x3a84e4})[_0x1cc1('0x38')](function(_0x5885f5){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x444261['body']['id']},'transaction':_0x3a84e4})['then'](function(_0x530f92){return db['VoiceExtension'][_0x1cc1('0x9c')](createExtensionsReciveFax(_[_0x1cc1('0x76')](_0x444261[_0x1cc1('0x66')],[_0x1cc1('0x9e'),'key',_0x1cc1('0x9f'),_0x1cc1('0xa0'),_0x1cc1('0xa1'),_0x1cc1('0xa2')])),{'transaction':_0x3a84e4});});});})[_0x1cc1('0x38')](function(){return db[_0x1cc1('0x57')][_0x1cc1('0xa3')](_0x444261['body']['id']);})['then'](respondWithResult(_0x1afc71,null))['catch'](handleError(_0x1afc71,null));};exports[_0x1cc1('0xa4')]=function(_0x408a96,_0x127bc0,_0x44eeeb){var _0x125671={'raw':!![],'where':{}};var _0xfa98ef={};var _0x186e58={'count':0x0,'rows':[]};return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x408a96['params']['id']}})['then'](handleEntityNotFound(_0x127bc0,null))[_0x1cc1('0x38')](function(_0x4e64ef){if(_0x4e64ef){_0xfa98ef[_0x1cc1('0x45')]=_['keys'](db[_0x1cc1('0xa5')][_0x1cc1('0x41')]);_0xfa98ef[_0x1cc1('0x47')]=_['keys'](_0x408a96['query']);_0xfa98ef[_0x1cc1('0x52')]=_['intersection'](_0xfa98ef[_0x1cc1('0x45')],_0xfa98ef[_0x1cc1('0x47')]);_0x125671[_0x1cc1('0x4b')]=_[_0x1cc1('0x49')](_0xfa98ef[_0x1cc1('0x45')],qs[_0x1cc1('0x4a')](_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x4a')]));_0x125671[_0x1cc1('0x4b')]=_0x125671[_0x1cc1('0x4b')][_0x1cc1('0x5d')]?_0x125671[_0x1cc1('0x4b')]:_0xfa98ef[_0x1cc1('0x45')];if(!_0x408a96['query']['hasOwnProperty']('nolimit')){_0x125671[_0x1cc1('0x33')]=qs[_0x1cc1('0x33')](_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x125671[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x408a96[_0x1cc1('0x47')]['offset']);}_0x125671[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x408a96[_0x1cc1('0x47')]['sort']);_0x125671['where']=qs['filters'](_['pick'](_0x408a96['query'],_0xfa98ef['filters']));_0x125671[_0x1cc1('0x50')][_0x1cc1('0x6c')]=_0x4e64ef['id'];if(_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x53')]){_0x125671[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x125671[_0x1cc1('0x50')],{'$or':_[_0x1cc1('0x46')](_0x125671[_0x1cc1('0x4b')],function(_0x233c8c){var _0x55a66c={};_0x55a66c[_0x233c8c]={'$like':'%'+_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x53')]+'%'};return _0x55a66c;})});}if(_0x408a96['query'][_0x1cc1('0xa6')]){var _0x2068f9=_0x408a96[_0x1cc1('0x47')][_0x1cc1('0xa6')][_0x1cc1('0xa7')](',');var _0x7f735c={};_0x7f735c[_0x2068f9[0x0]]={'$gte':moment(_0x2068f9[0x1])[_0x1cc1('0xa8')](_0x1cc1('0xa9'))};_0x125671[_0x1cc1('0x50')]=_['merge'](_0x125671['where'],_0x7f735c);}_0x125671=_[_0x1cc1('0x54')]({},_0x125671,_0x408a96[_0x1cc1('0x55')]);return db[_0x1cc1('0xa5')][_0x1cc1('0x32')]({'where':_0x125671[_0x1cc1('0x50')]})[_0x1cc1('0x38')](function(_0x6ed7dc){_0x186e58[_0x1cc1('0x32')]=_0x6ed7dc;if(_0x408a96[_0x1cc1('0x47')][_0x1cc1('0x6d')]){_0x125671['include']=[{'all':!![]}];}return db[_0x1cc1('0xa5')][_0x1cc1('0x58')](_0x125671);})[_0x1cc1('0x38')](function(_0x3863e0){_0x186e58[_0x1cc1('0x59')]=_0x3863e0;return _0x186e58;});}})[_0x1cc1('0x38')](respondWithFilteredResult(_0x127bc0,_0x125671))['catch'](handleError(_0x127bc0,null));};exports[_0x1cc1('0x88')]=function(_0x1b37cd,_0x4ac0ab,_0x48d5aa){var _0x45d8f9,_0x41b30b={},_0xa496ea;if(_0x1b37cd['body']['to']){_0xa496ea=_0x1b37cd['body']['to'][0x0];}return db[_0x1cc1('0x57')]['find']({'where':{'id':_0x1b37cd[_0x1cc1('0x5b')]['id']},'include':[{'model':db[_0x1cc1('0xaa')],'as':_0x1cc1('0xab'),'include':[{'model':db['CmContact'],'as':_0x1cc1('0xac'),'where':{'fax':_0xa496ea},'limit':0x1,'order':[[_0x1cc1('0xa0'),'DESC']]}]}]})[_0x1cc1('0x38')](handleEntityNotFound(_0x4ac0ab,null))[_0x1cc1('0x38')](function(_0x4376eb){_0x45d8f9=_0x4376eb;if(_0x1b37cd['body']['attachments']&&_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][_0x1cc1('0x5d')]){for(var _0x4937f3=0x0;_0x4937f3<_0x1b37cd[_0x1cc1('0x66')]['attachments'][_0x1cc1('0x5d')];_0x4937f3+=0x1){_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][_0x4937f3]={'filename':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][_0x4937f3]['name'],'id':_0x1b37cd[_0x1cc1('0x66')]['attachments'][_0x4937f3]['id'],'path':path[_0x1cc1('0xae')](config['root'],'server/files/attachments',_0x1b37cd['body'][_0x1cc1('0xad')][_0x4937f3][_0x1cc1('0xaf')])};}}return respondWithRpcPromise(_0x1cc1('0xb0'),_0x1cc1('0xb0'),{'FaxAccountId':_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x5b')]['id'])?undefined:_0x1b37cd[_0x1cc1('0x5b')]['id'],'path':_[_0x1cc1('0xb1')](_0x1b37cd['body'][_0x1cc1('0xad')][0x0][_0x1cc1('0x7')])?undefined:_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0][_0x1cc1('0x7')],'fax':_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x66')]['to'][0x0])?undefined:_0x1b37cd[_0x1cc1('0x66')]['to'][0x0]},client9002);})['then'](function(){if(_0x45d8f9){if(_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x66')]['from'])){_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xb2')]=util[_0x1cc1('0xa8')]('\x22%s\x22\x20<%s>',_0x45d8f9[_0x1cc1('0x3e')],_0x45d8f9[_0x1cc1('0xb3')]);}if(_0x45d8f9[_0x1cc1('0xab')]){if(_0x45d8f9[_0x1cc1('0xab')][_0x1cc1('0xac')]['length']){return _0x45d8f9[_0x1cc1('0xab')][_0x1cc1('0xac')][0x0];}else{return db[_0x1cc1('0x78')][_0x1cc1('0x5f')](_[_0x1cc1('0xb4')](_0x1b37cd[_0x1cc1('0x66')],{'firstName':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'phone':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'fax':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'ListId':_0x45d8f9[_0x1cc1('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1cc1('0x38')](function(_0x58b550){if(_0x58b550){return db[_0x1cc1('0x75')][_0x1cc1('0x5e')]({'where':{'ContactId':_0x58b550['id'],'closed':![],'FaxAccountId':_0x45d8f9['id']}})[_0x1cc1('0x38')](function(_0x11b57d){if(_0x11b57d){return[_0x11b57d,![]];}return db[_0x1cc1('0x75')][_0x1cc1('0x5f')]({'UserId':_0x1b37cd['user']['id'],'ContactId':_0x58b550['id'],'FaxAccountId':_0x45d8f9['id'],'fax':_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'firstMsgDirection':_0x1cc1('0xb5'),'Messages':[_[_0x1cc1('0x54')](_0x1b37cd[_0x1cc1('0x66')],{'read':![],'body':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0]['filename'],'FaxAccountId':_0x45d8f9['id'],'UserId':_0x1b37cd[_0x1cc1('0x60')]['id'],'ContactId':_0x58b550['id'],'AttachmentId':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1cc1('0xb6')}]})[_0x1cc1('0x38')](function(_0x59674e){return[_0x59674e,!![]];});});}else{throw new Error(_0x1cc1('0xb7'));}})[_0x1cc1('0xb8')](function(_0x483590,_0x264377){if(_0x264377){return _0x483590;}return db[_0x1cc1('0xa5')][_0x1cc1('0x5f')]({'direction':'out','read':![],'body':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0][_0x1cc1('0xb9')],'FaxAccountId':_0x45d8f9['id'],'FaxInteractionId':_0x483590['id'],'UserId':_0x1b37cd['user']['id'],'ContactId':_0x483590['ContactId'],'AttachmentId':_0x1b37cd['body'][_0x1cc1('0xad')][0x0]['id']})[_0x1cc1('0x38')](function(_0x3949fb){_0x483590[_0x1cc1('0xba')][_0x1cc1('0xb6')]=[];_0x483590['dataValues']['Messages'][_0x1cc1('0x92')](_0x3949fb[_0x1cc1('0xba')]);return _0x483590;});})['then'](function(_0x35ebda){respondWithRpcPromise('SendFax',_0x1cc1('0xbb'),{'FaxAccountId':_[_0x1cc1('0xb1')](_0x1b37cd['params']['id'])?undefined:_0x1b37cd[_0x1cc1('0x5b')]['id'],'path':_['isNil'](_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0][_0x1cc1('0x7')])?undefined:_0x1b37cd[_0x1cc1('0x66')]['attachments'][0x0]['path'],'fax':_[_0x1cc1('0xb1')](_0x1b37cd[_0x1cc1('0x66')]['to'][0x0])?undefined:_0x1b37cd[_0x1cc1('0x66')]['to'][0x0],'AttachmentId':_0x1b37cd[_0x1cc1('0x66')][_0x1cc1('0xad')][0x0]['id']},client9002)[_0x1cc1('0x38')](function(_0x4ba1f3){logger[_0x1cc1('0x22')](_0x1cc1('0xbc'),_0x4ba1f3);})[_0x1cc1('0x2b')](function(_0x35f3cb){logger[_0x1cc1('0x22')](_0x1cc1('0xbc'),_0x35f3cb);});return _0x35ebda;})[_0x1cc1('0x38')](respondWithResult(_0x4ac0ab,null))['catch'](handleError(_0x4ac0ab,null));};exports['addAgents']=function(_0x564fff,_0x48029a,_0x4c2f22){return db['FaxAccount']['find']({'where':{'id':_0x564fff['params']['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x48029a,null))['then'](function(_0x3a945c){if(_0x3a945c){return _0x3a945c[_0x1cc1('0xbd')](_0x564fff[_0x1cc1('0x66')][_0x1cc1('0x6f')],_[_0x1cc1('0x76')](_0x564fff['body'],['ids','id'])||{})[_0x1cc1('0xb8')](function(_0x5a3c83){for(var _0x39a9f3=0x0;_0x39a9f3<_0x564fff[_0x1cc1('0x66')][_0x1cc1('0x6f')][_0x1cc1('0x5d')];_0x39a9f3+=0x1){socket[_0x1cc1('0xbe')](_0x1cc1('0xbf'),{'UserId':Number(_0x564fff[_0x1cc1('0x66')]['ids'][_0x39a9f3]),'FaxAccountId':Number(_0x564fff[_0x1cc1('0x5b')]['id'])});}return _0x5a3c83;});}})[_0x1cc1('0x38')](respondWithResult(_0x48029a,null))[_0x1cc1('0x2b')](handleError(_0x48029a,null));};exports[_0x1cc1('0xc0')]=function(_0x1b998d,_0x5388fd,_0x3ef131){return db[_0x1cc1('0x57')][_0x1cc1('0x5e')]({'where':{'id':_0x1b998d[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x5388fd,null))[_0x1cc1('0x38')](function(_0xa5c0ed){if(_0xa5c0ed){return _0xa5c0ed[_0x1cc1('0xc0')](_0x1b998d[_0x1cc1('0x47')]['ids'])[_0x1cc1('0x38')](function(){if(_['isArray'](_0x1b998d[_0x1cc1('0x47')]['ids'])){for(var _0x4df04d=0x0;_0x4df04d<_0x1b998d[_0x1cc1('0x47')][_0x1cc1('0x6f')][_0x1cc1('0x5d')];_0x4df04d+=0x1){socket[_0x1cc1('0xbe')](_0x1cc1('0xc1'),{'UserId':Number(_0x1b998d[_0x1cc1('0x47')][_0x1cc1('0x6f')][_0x4df04d]),'FaxAccountId':Number(_0x1b998d['params']['id'])});}}else{socket['emit'](_0x1cc1('0xc1'),{'UserId':Number(_0x1b998d[_0x1cc1('0x47')]['ids']),'FaxAccountId':Number(_0x1b998d['params']['id'])});}});}})[_0x1cc1('0x38')](respondWithStatusCode(_0x5388fd,null))[_0x1cc1('0x2b')](handleError(_0x5388fd,null));};exports[_0x1cc1('0xc2')]=function(_0x429f14,_0x8a4fbf,_0x49b5af){var _0x304e67={};var _0x1afd61={};var _0x3871f7;var _0x386c17;return db[_0x1cc1('0x57')][_0x1cc1('0x6b')]({'where':{'id':_0x429f14[_0x1cc1('0x5b')]['id']}})[_0x1cc1('0x38')](handleEntityNotFound(_0x8a4fbf,null))[_0x1cc1('0x38')](function(_0x114bc8){if(_0x114bc8){_0x3871f7=_0x114bc8;_0x1afd61[_0x1cc1('0x45')]=_['keys'](db[_0x1cc1('0x7a')][_0x1cc1('0x41')]);_0x1afd61[_0x1cc1('0x47')]=_[_0x1cc1('0x48')](_0x429f14[_0x1cc1('0x47')]);_0x1afd61[_0x1cc1('0x52')]=_[_0x1cc1('0x49')](_0x1afd61[_0x1cc1('0x45')],_0x1afd61['query']);_0x304e67[_0x1cc1('0x4b')]=_['intersection'](_0x1afd61[_0x1cc1('0x45')],qs[_0x1cc1('0x4a')](_0x429f14['query'][_0x1cc1('0x4a')]));_0x304e67['attributes']=_0x304e67['attributes'][_0x1cc1('0x5d')]?_0x304e67[_0x1cc1('0x4b')]:_0x1afd61[_0x1cc1('0x45')];_0x304e67[_0x1cc1('0x4e')]=qs[_0x1cc1('0x4f')](_0x429f14[_0x1cc1('0x47')][_0x1cc1('0x4f')]);_0x304e67[_0x1cc1('0x50')]=qs[_0x1cc1('0x52')](_[_0x1cc1('0x51')](_0x429f14['query'],_0x1afd61[_0x1cc1('0x52')]));if(_0x429f14['query'][_0x1cc1('0x53')]){_0x304e67[_0x1cc1('0x50')]=_[_0x1cc1('0x54')](_0x304e67[_0x1cc1('0x50')],{'$or':_[_0x1cc1('0x46')](_0x304e67[_0x1cc1('0x4b')],function(_0x1891fa){var _0x33fc41={};_0x33fc41[_0x1891fa]={'$like':'%'+_0x429f14[_0x1cc1('0x47')]['filter']+'%'};return _0x33fc41;})});}_0x304e67=_[_0x1cc1('0x54')]({},_0x304e67,_0x429f14[_0x1cc1('0x55')]);return _0x3871f7[_0x1cc1('0xc2')](_0x304e67);}})[_0x1cc1('0x38')](function(_0x4c6fd2){if(_0x4c6fd2){_0x386c17=_0x4c6fd2[_0x1cc1('0x5d')];if(!_0x429f14['query'][_0x1cc1('0x4c')](_0x1cc1('0x4d'))){_0x304e67[_0x1cc1('0x33')]=qs['limit'](_0x429f14[_0x1cc1('0x47')][_0x1cc1('0x33')]);_0x304e67[_0x1cc1('0x30')]=qs[_0x1cc1('0x30')](_0x429f14[_0x1cc1('0x47')][_0x1cc1('0x30')]);}return _0x3871f7[_0x1cc1('0xc2')](_0x304e67);}})[_0x1cc1('0x38')](function(_0x5036a9){if(_0x5036a9){return _0x5036a9?{'count':_0x386c17,'rows':_0x5036a9}:null;}})[_0x1cc1('0x38')](respondWithResult(_0x8a4fbf,null))[_0x1cc1('0x2b')](handleError(_0x8a4fbf,null));}; \ No newline at end of file +var _0x7eeb=['from','\x22%s\x22\x20<%s>','List\x20not\x20found','filename','Contact\x20not\x20found','ContactId','Messages','dataValues','SendFax','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','FaxAccountId','Disposition','findOne','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','FaxInteraction','addInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','getApplications','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','headerinfo','maxrate','modem','FAXOPT(','Set','Wait','addAccountApplications','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil'];(function(_0x20295d,_0x39caf6){var _0x125ca2=function(_0x2ebf44){while(--_0x2ebf44){_0x20295d['push'](_0x20295d['shift']());}};_0x125ca2(++_0x39caf6);}(_0x7eeb,0xcf));var _0xb7ee=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x7eeb[_0x26e727];return _0x563800;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7ee('0x0'));var zipdir=require(_0xb7ee('0x1'));var jsonpatch=require(_0xb7ee('0x2'));var rp=require(_0xb7ee('0x3'));var moment=require(_0xb7ee('0x4'));var BPromise=require(_0xb7ee('0x5'));var Mustache=require(_0xb7ee('0x6'));var util=require(_0xb7ee('0x7'));var path=require(_0xb7ee('0x8'));var sox=require('sox');var csv=require(_0xb7ee('0x9'));var ejs=require(_0xb7ee('0xa'));var fs=require('fs');var fs_extra=require(_0xb7ee('0xb'));var _=require(_0xb7ee('0xc'));var squel=require('squel');var crypto=require(_0xb7ee('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7ee('0xe'));var toCsv=require(_0xb7ee('0x9'));var querystring=require(_0xb7ee('0xf'));var Papa=require(_0xb7ee('0x10'));var Redis=require(_0xb7ee('0x11'));var authService=require(_0xb7ee('0x12'));var qs=require(_0xb7ee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb7ee('0x14'));var logger=require(_0xb7ee('0x15'))('api');var utils=require(_0xb7ee('0x16'));var config=require(_0xb7ee('0x17'));var licenseUtil=require(_0xb7ee('0x18'));var db=require(_0xb7ee('0x19'))['db'];config[_0xb7ee('0x1a')]=_[_0xb7ee('0x1b')](config[_0xb7ee('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7ee('0x1c'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xb7ee('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb7ee('0x1e')][_0xb7ee('0x1f')]({'port':0x232c});var client9002=jayson[_0xb7ee('0x1e')][_0xb7ee('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3c6f66,_0x42060c,_0x172760,_0x415fd8){return new BPromise(function(_0x5f2a46,_0x22b2ce){var _0x2c86ef=_0x415fd8||client;return _0x2c86ef[_0xb7ee('0x20')](_0x3c6f66,_0x172760)[_0xb7ee('0x21')](function(_0x327219){logger[_0xb7ee('0x22')](_0xb7ee('0x23'),_0x42060c,'request\x20sent');logger['debug'](_0xb7ee('0x24'),_0x42060c,_0xb7ee('0x25'),JSON[_0xb7ee('0x26')](_0x327219));if(_0x327219['error']){if(_0x327219[_0xb7ee('0x27')][_0xb7ee('0x28')]===0x1f4){logger['error'](_0xb7ee('0x23'),_0x42060c,_0x327219[_0xb7ee('0x27')][_0xb7ee('0x29')]);return _0x22b2ce(_0x327219[_0xb7ee('0x27')][_0xb7ee('0x29')]);}logger['error'](_0xb7ee('0x23'),_0x42060c,_0x327219[_0xb7ee('0x27')][_0xb7ee('0x29')]);return _0x5f2a46(_0x327219['error'][_0xb7ee('0x29')]);}else{logger[_0xb7ee('0x22')]('FaxAccount,\x20%s,\x20%s',_0x42060c,_0xb7ee('0x25'));_0x5f2a46(_0x327219[_0xb7ee('0x2a')][_0xb7ee('0x29')]);}})[_0xb7ee('0x2b')](function(_0x282507){logger[_0xb7ee('0x27')](_0xb7ee('0x23'),_0x42060c,_0x282507);_0x22b2ce(_0x282507);});});}function respondWithStatusCode(_0x45b0d6,_0x2daeca){_0x2daeca=_0x2daeca||0xcc;return function(_0x531592){if(_0x531592){return _0x45b0d6[_0xb7ee('0x2c')](_0x2daeca);}return _0x45b0d6['status'](_0x2daeca)['end']();};}function respondWithResult(_0x49e06e,_0x51bc02){_0x51bc02=_0x51bc02||0xc8;return function(_0xe1c043){if(_0xe1c043){return _0x49e06e[_0xb7ee('0x2d')](_0x51bc02)[_0xb7ee('0x2e')](_0xe1c043);}};}function respondWithFilteredResult(_0x2ad462,_0x3788e0){return function(_0x4df0e0){if(_0x4df0e0){var _0x40feb5=typeof _0x3788e0[_0xb7ee('0x2f')]===_0xb7ee('0x30')&&typeof _0x3788e0[_0xb7ee('0x31')]==='undefined';var _0x2edbb5=_0x4df0e0[_0xb7ee('0x32')];var _0x6118eb=_0x40feb5?0x0:_0x3788e0[_0xb7ee('0x2f')];var _0x36c7e9=_0x40feb5?_0x4df0e0['count']:_0x3788e0['offset']+_0x3788e0[_0xb7ee('0x31')];var _0x2fea6d;if(_0x36c7e9>=_0x2edbb5){_0x36c7e9=_0x2edbb5;_0x2fea6d=0xc8;}else{_0x2fea6d=0xce;}_0x2ad462[_0xb7ee('0x2d')](_0x2fea6d);return _0x2ad462['set'](_0xb7ee('0x33'),_0x6118eb+'-'+_0x36c7e9+'/'+_0x2edbb5)[_0xb7ee('0x2e')](_0x4df0e0);}return null;};}function patchUpdates(_0x2860c2){return function(_0x49973e){try{jsonpatch[_0xb7ee('0x34')](_0x49973e,_0x2860c2,!![]);}catch(_0x4d4480){return BPromise['reject'](_0x4d4480);}return _0x49973e[_0xb7ee('0x35')]();};}function saveUpdates(_0x303be4,_0x12cf99){return function(_0x4ed375){if(_0x4ed375){return _0x4ed375[_0xb7ee('0x36')](_0x303be4)['then'](function(_0x12f29f){return _0x12f29f;});}return null;};}function removeEntity(_0x1b844d,_0x4fe7c7){return function(_0x1830b0){if(_0x1830b0){return _0x1830b0['destroy']()[_0xb7ee('0x21')](function(){var _0x2b9969=_0x1830b0['get']({'plain':!![]});var _0x59bea3=_0xb7ee('0x37');return db[_0xb7ee('0x38')][_0xb7ee('0x39')]({'where':{'type':_0x59bea3,'resourceId':_0x2b9969['id']}})[_0xb7ee('0x21')](function(){return _0x1830b0;});})['then'](function(){_0x1b844d[_0xb7ee('0x2d')](0xcc)[_0xb7ee('0x3a')]();});}};}function handleEntityNotFound(_0x2ed935,_0x46627b){return function(_0x3b86ba){if(!_0x3b86ba){_0x2ed935[_0xb7ee('0x2c')](0x194);}return _0x3b86ba;};}function handleError(_0x427016,_0x3d0fde){_0x3d0fde=_0x3d0fde||0x1f4;return function(_0x166ebe){logger[_0xb7ee('0x27')](_0x166ebe[_0xb7ee('0x3b')]);if(_0x166ebe[_0xb7ee('0x3c')]){delete _0x166ebe[_0xb7ee('0x3c')];}_0x427016[_0xb7ee('0x2d')](_0x3d0fde)[_0xb7ee('0x3d')](_0x166ebe);};}exports[_0xb7ee('0x3e')]=function(_0x878744,_0x196f9c){var _0x497342={'include':[{'model':db[_0xb7ee('0x3f')],'as':_0xb7ee('0x40')}]},_0xfadf21={},_0x133823={'count':0x0,'rows':[]};var _0x4eb7e2=_['map'](db[_0xb7ee('0x41')][_0xb7ee('0x42')],function(_0x648b52){return{'name':_0x648b52[_0xb7ee('0x43')],'type':_0x648b52[_0xb7ee('0x44')]['key']};});_0xfadf21['model']=_[_0xb7ee('0x45')](_0x4eb7e2,_0xb7ee('0x3c'));_0xfadf21['query']=_[_0xb7ee('0x46')](_0x878744[_0xb7ee('0x47')]);_0xfadf21[_0xb7ee('0x48')]=_[_0xb7ee('0x49')](_0xfadf21[_0xb7ee('0x4a')],_0xfadf21['query']);_0x497342[_0xb7ee('0x4b')]=_[_0xb7ee('0x49')](_0xfadf21[_0xb7ee('0x4a')],qs[_0xb7ee('0x4c')](_0x878744[_0xb7ee('0x47')]['fields']));_0x497342[_0xb7ee('0x4b')]=_0x497342['attributes'][_0xb7ee('0x4d')]?_0x497342[_0xb7ee('0x4b')]:_0xfadf21[_0xb7ee('0x4a')];if(!_0x878744['query'][_0xb7ee('0x4e')](_0xb7ee('0x4f'))){_0x497342[_0xb7ee('0x31')]=qs[_0xb7ee('0x31')](_0x878744[_0xb7ee('0x47')][_0xb7ee('0x31')]);_0x497342['offset']=qs[_0xb7ee('0x2f')](_0x878744['query']['offset']);}_0x497342['order']=qs[_0xb7ee('0x50')](_0x878744[_0xb7ee('0x47')][_0xb7ee('0x50')]);_0x497342[_0xb7ee('0x51')]=qs[_0xb7ee('0x48')](_[_0xb7ee('0x52')](_0x878744['query'],_0xfadf21[_0xb7ee('0x48')]),_0x4eb7e2);if(_0x878744['query'][_0xb7ee('0x53')]){_0x497342[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x497342[_0xb7ee('0x51')],{'$or':_[_0xb7ee('0x45')](_0x4eb7e2,function(_0x230931){if(_0x230931[_0xb7ee('0x44')]!=='VIRTUAL'){var _0xcaa756={};_0xcaa756[_0x230931['name']]={'$like':'%'+_0x878744[_0xb7ee('0x47')][_0xb7ee('0x53')]+'%'};return _0xcaa756;}})});}_0x497342=_[_0xb7ee('0x54')]({},_0x497342,_0x878744['options']);var _0x3c2419={'where':_0x497342[_0xb7ee('0x51')]};return db['FaxAccount'][_0xb7ee('0x32')](_0x3c2419)[_0xb7ee('0x21')](function(_0x1256f7){_0x133823[_0xb7ee('0x32')]=_0x1256f7;if(_0x878744['query'][_0xb7ee('0x55')]){_0x497342[_0xb7ee('0x56')]=[{'all':!![]}];}return db[_0xb7ee('0x41')][_0xb7ee('0x57')](_0x497342);})[_0xb7ee('0x21')](function(_0x42e093){_0x133823[_0xb7ee('0x58')]=_0x42e093;return _0x133823;})[_0xb7ee('0x21')](respondWithFilteredResult(_0x196f9c,_0x497342))[_0xb7ee('0x2b')](handleError(_0x196f9c,null));};exports[_0xb7ee('0x59')]=function(_0x1ef101,_0x298dd9){var _0x2b3e98={'raw':![],'where':{'id':_0x1ef101['params']['id']},'include':[{'model':db[_0xb7ee('0x3f')],'as':'mandatoryDispositionPause'}]},_0xd207f9={};_0xd207f9['model']=_['keys'](db[_0xb7ee('0x41')][_0xb7ee('0x42')]);_0xd207f9[_0xb7ee('0x47')]=_[_0xb7ee('0x46')](_0x1ef101[_0xb7ee('0x47')]);_0xd207f9[_0xb7ee('0x48')]=_['intersection'](_0xd207f9[_0xb7ee('0x4a')],_0xd207f9['query']);_0x2b3e98[_0xb7ee('0x4b')]=_[_0xb7ee('0x49')](_0xd207f9[_0xb7ee('0x4a')],qs[_0xb7ee('0x4c')](_0x1ef101['query']['fields']));_0x2b3e98['attributes']=_0x2b3e98[_0xb7ee('0x4b')][_0xb7ee('0x4d')]?_0x2b3e98[_0xb7ee('0x4b')]:_0xd207f9['model'];if(_0x1ef101[_0xb7ee('0x47')][_0xb7ee('0x55')]){_0x2b3e98[_0xb7ee('0x56')]=[{'all':!![]}];}_0x2b3e98=_['merge']({},_0x2b3e98,_0x1ef101[_0xb7ee('0x5a')]);return db['FaxAccount'][_0xb7ee('0x5b')](_0x2b3e98)[_0xb7ee('0x21')](handleEntityNotFound(_0x298dd9,null))['then'](respondWithResult(_0x298dd9,null))[_0xb7ee('0x2b')](handleError(_0x298dd9,null));};exports[_0xb7ee('0x5c')]=function(_0xd07305,_0x1fb2f9){return db[_0xb7ee('0x41')]['create'](_0xd07305[_0xb7ee('0x5d')],{})[_0xb7ee('0x21')](function(_0x4da63b){var _0x3f398a=_0xd07305[_0xb7ee('0x5e')][_0xb7ee('0x5f')]({'plain':!![]});if(!_0x3f398a)throw new Error(_0xb7ee('0x60'));if(_0x3f398a[_0xb7ee('0x61')]===_0xb7ee('0x5e')){var _0x3842f4=_0x4da63b[_0xb7ee('0x5f')]({'plain':!![]});var _0x2787ea=_0xb7ee('0x37');return db[_0xb7ee('0x62')][_0xb7ee('0x5b')]({'where':{'name':_0x2787ea,'userProfileId':_0x3f398a[_0xb7ee('0x63')]},'raw':!![]})[_0xb7ee('0x21')](function(_0x5e4cce){if(_0x5e4cce&&_0x5e4cce[_0xb7ee('0x64')]===0x0){return db['UserProfileResource'][_0xb7ee('0x5c')]({'name':_0x3842f4[_0xb7ee('0x3c')],'resourceId':_0x3842f4['id'],'type':_0x5e4cce[_0xb7ee('0x3c')],'sectionId':_0x5e4cce['id']},{})[_0xb7ee('0x21')](function(){return _0x4da63b;});}else{return _0x4da63b;}})[_0xb7ee('0x2b')](function(_0x392aa0){logger[_0xb7ee('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x392aa0);throw _0x392aa0;});}return _0x4da63b;})['then'](respondWithResult(_0x1fb2f9,0xc9))[_0xb7ee('0x2b')](handleError(_0x1fb2f9,null));};exports[_0xb7ee('0x36')]=function(_0x519170,_0x3c01ed){if(_0x519170[_0xb7ee('0x5d')]['id']){delete _0x519170['body']['id'];}return db[_0xb7ee('0x41')]['find']({'where':{'id':_0x519170['params']['id']},'include':[{'model':db[_0xb7ee('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xb7ee('0x21')](handleEntityNotFound(_0x3c01ed,null))[_0xb7ee('0x21')](saveUpdates(_0x519170[_0xb7ee('0x5d')],null))[_0xb7ee('0x21')](respondWithResult(_0x3c01ed,null))[_0xb7ee('0x2b')](handleError(_0x3c01ed,null));};exports[_0xb7ee('0x39')]=function(_0x3ab4dd,_0x878df0){return db[_0xb7ee('0x41')]['find']({'where':{'id':_0x3ab4dd[_0xb7ee('0x65')]['id']}})['then'](handleEntityNotFound(_0x878df0,null))[_0xb7ee('0x21')](removeEntity(_0x878df0,null))[_0xb7ee('0x2b')](handleError(_0x878df0,null));};exports['describe']=function(_0x4f2e20,_0x1eb127){return db[_0xb7ee('0x41')][_0xb7ee('0x66')]()['then'](respondWithResult(_0x1eb127,null))['catch'](handleError(_0x1eb127,null));};exports[_0xb7ee('0x67')]=function(_0xe33d3b,_0x22b70a,_0x5dc623){if(_0xe33d3b[_0xb7ee('0x5d')]['id']){delete _0xe33d3b[_0xb7ee('0x5d')]['id'];}return db[_0xb7ee('0x41')][_0xb7ee('0x5b')]({'where':{'id':_0xe33d3b[_0xb7ee('0x65')]['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x22b70a,null))[_0xb7ee('0x21')](function(_0x5e4536){if(_0x5e4536){_0xe33d3b[_0xb7ee('0x5d')][_0xb7ee('0x68')]=_0x5e4536['id'];return db[_0xb7ee('0x69')][_0xb7ee('0x5c')](_0xe33d3b['body']);}})[_0xb7ee('0x21')](respondWithResult(_0x22b70a,null))[_0xb7ee('0x2b')](handleError(_0x22b70a,null));};exports['getDispositions']=function(_0x3f2292,_0x348e38,_0x1df9ad){var _0x3c2818={'raw':![],'where':{}};var _0x4ce034={};var _0x425bd6={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb7ee('0x6a')]({'where':{'id':_0x3f2292['params']['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x348e38,null))['then'](function(_0x41d14a){if(_0x41d14a){_0x4ce034[_0xb7ee('0x4a')]=_['keys'](db[_0xb7ee('0x69')][_0xb7ee('0x42')]);_0x4ce034['query']=_[_0xb7ee('0x46')](_0x3f2292[_0xb7ee('0x47')]);_0x4ce034[_0xb7ee('0x48')]=_[_0xb7ee('0x49')](_0x4ce034[_0xb7ee('0x4a')],_0x4ce034[_0xb7ee('0x47')]);_0x3c2818[_0xb7ee('0x4b')]=_['intersection'](_0x4ce034[_0xb7ee('0x4a')],qs[_0xb7ee('0x4c')](_0x3f2292['query']['fields']));_0x3c2818['attributes']=_0x3c2818['attributes'][_0xb7ee('0x4d')]?_0x3c2818[_0xb7ee('0x4b')]:_0x4ce034['model'];if(!_0x3f2292['query'][_0xb7ee('0x4e')](_0xb7ee('0x4f'))){_0x3c2818[_0xb7ee('0x31')]=qs[_0xb7ee('0x31')](_0x3f2292[_0xb7ee('0x47')]['limit']);_0x3c2818[_0xb7ee('0x2f')]=qs[_0xb7ee('0x2f')](_0x3f2292[_0xb7ee('0x47')][_0xb7ee('0x2f')]);}_0x3c2818[_0xb7ee('0x6b')]=qs[_0xb7ee('0x50')](_0x3f2292[_0xb7ee('0x47')][_0xb7ee('0x50')]);_0x3c2818[_0xb7ee('0x51')]=qs[_0xb7ee('0x48')](_[_0xb7ee('0x52')](_0x3f2292[_0xb7ee('0x47')],_0x4ce034[_0xb7ee('0x48')]));_0x3c2818[_0xb7ee('0x51')][_0xb7ee('0x68')]=_0x41d14a['id'];if(_0x3f2292[_0xb7ee('0x47')][_0xb7ee('0x53')]){_0x3c2818['where']=_[_0xb7ee('0x54')](_0x3c2818['where'],{'$or':_['map'](_0x3c2818['attributes'],function(_0x552d88){var _0x4544c3={};_0x4544c3[_0x552d88]={'$like':'%'+_0x3f2292[_0xb7ee('0x47')][_0xb7ee('0x53')]+'%'};return _0x4544c3;})});}_0x3c2818=_[_0xb7ee('0x54')]({},_0x3c2818,_0x3f2292['options']);return db[_0xb7ee('0x69')][_0xb7ee('0x32')]({'where':_0x3c2818[_0xb7ee('0x51')]})[_0xb7ee('0x21')](function(_0x47e9f9){_0x425bd6['count']=_0x47e9f9;if(_0x3f2292['query'][_0xb7ee('0x55')]){_0x3c2818[_0xb7ee('0x56')]=[{'all':!![]}];}return db[_0xb7ee('0x69')][_0xb7ee('0x57')](_0x3c2818);})[_0xb7ee('0x21')](function(_0x331ad5){_0x425bd6['rows']=_0x331ad5;return _0x425bd6;});}})['then'](respondWithFilteredResult(_0x348e38,_0x3c2818))[_0xb7ee('0x2b')](handleError(_0x348e38,null));};exports[_0xb7ee('0x6c')]=function(_0x4cd248,_0x262efd,_0x2b649d){return db[_0xb7ee('0x41')][_0xb7ee('0x5b')]({'where':{'id':_0x4cd248[_0xb7ee('0x65')]['id']}})['then'](handleEntityNotFound(_0x262efd,null))['then'](function(_0x1000e8){if(_0x1000e8){return _0x1000e8['removeDispositions'](_0x4cd248[_0xb7ee('0x47')]['ids']);}})[_0xb7ee('0x21')](respondWithStatusCode(_0x262efd,null))[_0xb7ee('0x2b')](handleError(_0x262efd,null));};exports[_0xb7ee('0x6d')]=function(_0x4f474c,_0x311d0d,_0x2d8058){if(_0x4f474c[_0xb7ee('0x5d')]['id']){delete _0x4f474c[_0xb7ee('0x5d')]['id'];}return db['FaxAccount'][_0xb7ee('0x5b')]({'where':{'id':_0x4f474c[_0xb7ee('0x65')]['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x311d0d,null))['then'](function(_0x4130ad){if(_0x4130ad){_0x4f474c['body'][_0xb7ee('0x68')]=_0x4130ad['id'];return db['CannedAnswer'][_0xb7ee('0x5c')](_0x4f474c[_0xb7ee('0x5d')]);}})['then'](respondWithResult(_0x311d0d,null))[_0xb7ee('0x2b')](handleError(_0x311d0d,null));};exports['getAnswers']=function(_0x318a26,_0x18c732,_0x28146b){var _0x1d3f38={'raw':![],'where':{}};var _0x3ed4af={};var _0x1af305={'count':0x0,'rows':[]};return db[_0xb7ee('0x41')]['findOne']({'where':{'id':_0x318a26['params']['id']}})['then'](handleEntityNotFound(_0x18c732,null))[_0xb7ee('0x21')](function(_0x490ece){if(_0x490ece){_0x3ed4af[_0xb7ee('0x4a')]=_[_0xb7ee('0x46')](db[_0xb7ee('0x6e')][_0xb7ee('0x42')]);_0x3ed4af[_0xb7ee('0x47')]=_[_0xb7ee('0x46')](_0x318a26[_0xb7ee('0x47')]);_0x3ed4af[_0xb7ee('0x48')]=_[_0xb7ee('0x49')](_0x3ed4af[_0xb7ee('0x4a')],_0x3ed4af[_0xb7ee('0x47')]);_0x1d3f38['attributes']=_['intersection'](_0x3ed4af['model'],qs[_0xb7ee('0x4c')](_0x318a26[_0xb7ee('0x47')][_0xb7ee('0x4c')]));_0x1d3f38['attributes']=_0x1d3f38[_0xb7ee('0x4b')][_0xb7ee('0x4d')]?_0x1d3f38['attributes']:_0x3ed4af[_0xb7ee('0x4a')];if(!_0x318a26[_0xb7ee('0x47')][_0xb7ee('0x4e')](_0xb7ee('0x4f'))){_0x1d3f38['limit']=qs[_0xb7ee('0x31')](_0x318a26[_0xb7ee('0x47')][_0xb7ee('0x31')]);_0x1d3f38[_0xb7ee('0x2f')]=qs['offset'](_0x318a26[_0xb7ee('0x47')]['offset']);}_0x1d3f38['order']=qs[_0xb7ee('0x50')](_0x318a26[_0xb7ee('0x47')]['sort']);_0x1d3f38[_0xb7ee('0x51')]=qs['filters'](_[_0xb7ee('0x52')](_0x318a26[_0xb7ee('0x47')],_0x3ed4af[_0xb7ee('0x48')]));_0x1d3f38[_0xb7ee('0x51')][_0xb7ee('0x68')]=_0x490ece['id'];if(_0x318a26[_0xb7ee('0x47')]['filter']){_0x1d3f38[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x1d3f38[_0xb7ee('0x51')],{'$or':_[_0xb7ee('0x45')](_0x1d3f38[_0xb7ee('0x4b')],function(_0x23cc94){var _0x3b7612={};_0x3b7612[_0x23cc94]={'$like':'%'+_0x318a26[_0xb7ee('0x47')]['filter']+'%'};return _0x3b7612;})});}_0x1d3f38=_[_0xb7ee('0x54')]({},_0x1d3f38,_0x318a26[_0xb7ee('0x5a')]);return db[_0xb7ee('0x6e')][_0xb7ee('0x32')]({'where':_0x1d3f38[_0xb7ee('0x51')]})['then'](function(_0x4d6d58){_0x1af305[_0xb7ee('0x32')]=_0x4d6d58;if(_0x318a26[_0xb7ee('0x47')]['includeAll']){_0x1d3f38['include']=[{'all':!![]}];}return db[_0xb7ee('0x6e')]['findAll'](_0x1d3f38);})[_0xb7ee('0x21')](function(_0x40f493){_0x1af305['rows']=_0x40f493;return _0x1af305;});}})['then'](respondWithFilteredResult(_0x18c732,_0x1d3f38))['catch'](handleError(_0x18c732,null));};exports['removeAnswers']=function(_0x29cfe8,_0x3a7512,_0x391e60){return db['FaxAccount']['find']({'where':{'id':_0x29cfe8[_0xb7ee('0x65')]['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x3a7512,null))[_0xb7ee('0x21')](function(_0x21ab46){if(_0x21ab46){return _0x21ab46[_0xb7ee('0x6f')](_0x29cfe8[_0xb7ee('0x47')][_0xb7ee('0x70')]);}})[_0xb7ee('0x21')](respondWithStatusCode(_0x3a7512,null))['catch'](handleError(_0x3a7512,null));};exports['addInteraction']=function(_0x20a3f8,_0x339520,_0x23433b){return db[_0xb7ee('0x71')][_0xb7ee('0x5b')]({'where':{'id':_0x20a3f8['params']['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x339520,null))['then'](function(_0x323b18){if(_0x323b18){return _0x323b18[_0xb7ee('0x72')](_0x20a3f8[_0xb7ee('0x5d')]['ids'],_[_0xb7ee('0x73')](_0x20a3f8[_0xb7ee('0x5d')],[_0xb7ee('0x70'),'id'])||{});}})['then'](respondWithResult(_0x339520,null))[_0xb7ee('0x2b')](handleError(_0x339520,null));};exports['getInteractions']=function(_0x2f82a8,_0x443e88,_0x6b6338){var _0x5a513d={'raw':![],'where':{}};var _0x4b20c9={};var _0x1a708f={'count':0x0,'rows':[]};return db[_0xb7ee('0x41')][_0xb7ee('0x6a')]({'where':{'id':_0x2f82a8[_0xb7ee('0x65')]['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x443e88,null))['then'](function(_0x52925b){if(_0x52925b){_0x4b20c9[_0xb7ee('0x4a')]=_[_0xb7ee('0x46')](db[_0xb7ee('0x71')][_0xb7ee('0x42')]);_0x4b20c9['query']=_[_0xb7ee('0x46')](_0x2f82a8[_0xb7ee('0x47')]);_0x4b20c9[_0xb7ee('0x48')]=_['intersection'](_0x4b20c9[_0xb7ee('0x4a')],_0x4b20c9[_0xb7ee('0x47')]);_0x5a513d[_0xb7ee('0x4b')]=_[_0xb7ee('0x49')](_0x4b20c9[_0xb7ee('0x4a')],qs[_0xb7ee('0x4c')](_0x2f82a8['query'][_0xb7ee('0x4c')]));_0x5a513d[_0xb7ee('0x4b')]=_0x5a513d[_0xb7ee('0x4b')][_0xb7ee('0x4d')]?_0x5a513d[_0xb7ee('0x4b')]:_0x4b20c9['model'];if(!_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x4e')](_0xb7ee('0x4f'))){_0x5a513d[_0xb7ee('0x31')]=qs[_0xb7ee('0x31')](_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x31')]);_0x5a513d[_0xb7ee('0x2f')]=qs[_0xb7ee('0x2f')](_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x2f')]);}_0x5a513d[_0xb7ee('0x6b')]=qs['sort'](_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x50')]);_0x5a513d['where']=qs[_0xb7ee('0x48')](_[_0xb7ee('0x52')](_0x2f82a8[_0xb7ee('0x47')],_0x4b20c9['filters']));_0x5a513d[_0xb7ee('0x51')][_0xb7ee('0x68')]=_0x52925b['id'];if(_0x2f82a8['query'][_0xb7ee('0x53')]){_0x5a513d[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x5a513d[_0xb7ee('0x51')],{'$or':_['map'](_0x5a513d[_0xb7ee('0x4b')],function(_0x1dd7a5){var _0x178637={};_0x178637[_0x1dd7a5]={'$like':'%'+_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x53')]+'%'};return _0x178637;})});}_0x5a513d=_[_0xb7ee('0x54')]({},_0x5a513d,_0x2f82a8[_0xb7ee('0x5a')]);return db['FaxInteraction'][_0xb7ee('0x32')]({'where':_0x5a513d[_0xb7ee('0x51')]})['then'](function(_0x5dc286){_0x1a708f[_0xb7ee('0x32')]=_0x5dc286;if(_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x55')]){_0x5a513d[_0xb7ee('0x56')]=[{'model':db['CmContact'],'as':_0xb7ee('0x74'),'required':![]},{'model':db[_0xb7ee('0x75')],'as':_0xb7ee('0x76'),'attributes':[_0xb7ee('0x3c'),_0xb7ee('0x77'),_0xb7ee('0x78')],'required':![]},{'model':db[_0xb7ee('0x79')],'as':_0xb7ee('0x7a'),'attributes':['id',_0xb7ee('0x3c'),'color'],'where':_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x7b')]?{'id':_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x7b')]}:undefined,'required':_0x2f82a8[_0xb7ee('0x47')][_0xb7ee('0x7b')]?!![]:![]}];}return db[_0xb7ee('0x71')][_0xb7ee('0x57')](_0x5a513d);})[_0xb7ee('0x21')](function(_0x34511c){_0x1a708f[_0xb7ee('0x58')]=_0x34511c;return _0x1a708f;});}})[_0xb7ee('0x21')](respondWithFilteredResult(_0x443e88,_0x5a513d))['catch'](handleError(_0x443e88,null));};exports['addApplications']=function(_0x1c061c,_0x5121b8){var _0x580d04=_0x1c061c[_0xb7ee('0x65')]['id'];var _0x323249=_0x1c061c[_0xb7ee('0x5d')];var _0x3a1828=0xc8;var _0x5997e4=null;return db['sequelize'][_0xb7ee('0x7c')]({'isolationLevel':db[_0xb7ee('0x7d')][_0xb7ee('0x7e')]['ISOLATION_LEVELS'][_0xb7ee('0x7f')]},function(_0x3ad314){return db['FaxAccount'][_0xb7ee('0x6a')]({'where':{'id':_0x580d04},'transaction':_0x3ad314})['then'](function(_0x35327c){if(_0x35327c){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x580d04},'transaction':_0x3ad314})[_0xb7ee('0x21')](function(){var _0x5c3eab=_[_0xb7ee('0x45')](_0x323249,function(_0x1d01c3){_0x1d01c3['FaxAccountId']=_0x580d04;return _0x1d01c3;});return db[_0xb7ee('0x80')][_0xb7ee('0x81')](_0x5c3eab,{'transaction':_0x3ad314});});}else{_0x3a1828=0x194;_0x5997e4=[];}});})[_0xb7ee('0x21')](function(){if(_0x3a1828!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x580d04},'order':_0xb7ee('0x82')})[_0xb7ee('0x21')](function(_0x21fcfb){_0x5997e4=_0x21fcfb;});}})[_0xb7ee('0x2b')](function(_0x1573d9){_0x3a1828=0x1f4;logger['error'](_0x1573d9[_0xb7ee('0x3b')]);if(_0x1573d9[_0xb7ee('0x3c')]){delete _0x1573d9[_0xb7ee('0x3c')];}_0x5997e4=_0x1573d9;})['finally'](function(){if(_0x5997e4===null){_0x5121b8[_0xb7ee('0x2c')](_0x3a1828);}else{if(_0x3a1828===0x1f4){_0x5121b8[_0xb7ee('0x2d')](_0x3a1828)[_0xb7ee('0x3d')](_0x5997e4);}else{_0x5121b8[_0xb7ee('0x2d')](_0x3a1828)[_0xb7ee('0x2e')](_0x5997e4);}}});};exports[_0xb7ee('0x83')]=function(_0x17df53,_0x30268f,_0x47e8ab){var _0x209668={};var _0x330829={};var _0x108954;var _0x245476;return db[_0xb7ee('0x41')][_0xb7ee('0x6a')]({'where':{'id':_0x17df53['params']['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x30268f,null))[_0xb7ee('0x21')](function(_0x54ecc2){if(_0x54ecc2){_0x108954=_0x54ecc2;_0x330829[_0xb7ee('0x4a')]=_[_0xb7ee('0x46')](db['FaxApplication']['rawAttributes']);_0x330829[_0xb7ee('0x47')]=_[_0xb7ee('0x46')](_0x17df53[_0xb7ee('0x47')]);_0x330829[_0xb7ee('0x48')]=_[_0xb7ee('0x49')](_0x330829[_0xb7ee('0x4a')],_0x330829['query']);_0x209668[_0xb7ee('0x4b')]=_['intersection'](_0x330829[_0xb7ee('0x4a')],qs[_0xb7ee('0x4c')](_0x17df53['query'][_0xb7ee('0x4c')]));_0x209668[_0xb7ee('0x4b')]=_0x209668['attributes'][_0xb7ee('0x4d')]?_0x209668[_0xb7ee('0x4b')]:_0x330829['model'];_0x209668[_0xb7ee('0x6b')]=qs[_0xb7ee('0x50')](_0x17df53[_0xb7ee('0x47')]['sort']);_0x209668[_0xb7ee('0x51')]=qs['filters'](_['pick'](_0x17df53[_0xb7ee('0x47')],_0x330829[_0xb7ee('0x48')]));if(_0x17df53[_0xb7ee('0x47')]['filter']){_0x209668[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x209668['where'],{'$or':_[_0xb7ee('0x45')](_0x209668[_0xb7ee('0x4b')],function(_0x1fc6bc){var _0x3b301d={};_0x3b301d[_0x1fc6bc]={'$like':'%'+_0x17df53[_0xb7ee('0x47')]['filter']+'%'};return _0x3b301d;})});}_0x209668=_[_0xb7ee('0x54')]({},_0x209668,_0x17df53[_0xb7ee('0x5a')]);return _0x108954[_0xb7ee('0x83')](_0x209668);}})[_0xb7ee('0x21')](function(_0x535131){if(_0x535131){_0x245476=_0x535131[_0xb7ee('0x4d')];if(!_0x17df53[_0xb7ee('0x47')]['hasOwnProperty'](_0xb7ee('0x4f'))){_0x209668[_0xb7ee('0x31')]=qs[_0xb7ee('0x31')](_0x17df53['query']['limit']);_0x209668[_0xb7ee('0x2f')]=qs[_0xb7ee('0x2f')](_0x17df53['query'][_0xb7ee('0x2f')]);}return _0x108954[_0xb7ee('0x83')](_0x209668);}})[_0xb7ee('0x21')](function(_0x30cc07){if(_0x30cc07){return _0x30cc07?{'count':_0x245476,'rows':_0x30cc07}:null;}})[_0xb7ee('0x21')](respondWithResult(_0x30268f,null))[_0xb7ee('0x2b')](handleError(_0x30268f,null));};function Extension(_0x57714e,_0x31ede5,_0x213c84,_0x3d860a){this['context']='from-voip-provider';this['exten']=_0x57714e[_0xb7ee('0x84')];this['app']=_0x3d860a;this[_0xb7ee('0x44')]=_0xb7ee('0x85');this[_0xb7ee('0x86')]=_0xb7ee('0x87');this[_0xb7ee('0x68')]=_0x57714e['id'];this[_0xb7ee('0x82')]=_0x31ede5;this[_0xb7ee('0x88')]=_0x213c84;}function createExtensionsReciveFax(_0x3fb9bb){var _0x2a0fa5=0x1;var _0x25ea73=[];_0x25ea73[_0xb7ee('0x89')](new Extension(_0x3fb9bb,_0x2a0fa5,'',_0xb7ee('0x8a')));_0x2a0fa5+=0x1;_0x25ea73[_0xb7ee('0x89')](new Extension(_0x3fb9bb,_0x2a0fa5,_0xb7ee('0x8b'),'Set'));_0x2a0fa5+=0x1;for(var _0x28e422 in _0x3fb9bb){if(_0x3fb9bb['hasOwnProperty'](_0x28e422)&&(_0x28e422===_0xb7ee('0x8c')||_0x28e422===_0xb7ee('0x84')||_0x28e422==='gateway'||_0x28e422==='faxdetect'||_0x28e422===_0xb7ee('0x8d')||_0x28e422===_0xb7ee('0x8e')||_0x28e422==='minrate'||_0x28e422===_0xb7ee('0x8f')||_0x28e422==='t38timeout')){_0x25ea73[_0xb7ee('0x89')](new Extension(_0x3fb9bb,_0x2a0fa5,_0xb7ee('0x90')+_0x28e422+')='+_0x3fb9bb[_0x28e422],_0xb7ee('0x91')));_0x2a0fa5+=0x1;}}_0x25ea73[_0xb7ee('0x89')](new Extension(_0x3fb9bb,_0x2a0fa5,'6',_0xb7ee('0x92')));_0x2a0fa5+=0x1;_0x25ea73[_0xb7ee('0x89')](new Extension(_0x3fb9bb,_0x2a0fa5,'/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'));_0x2a0fa5=0x0;return _0x25ea73;}exports[_0xb7ee('0x93')]=function(_0x49ab90,_0x4c7d72,_0x4b20cc){var _0x4549ef;return db['sequelize']['transaction'](function(_0x389fa3){return db[_0xb7ee('0x41')][_0xb7ee('0x5c')](_0x49ab90['body'],{'transaction':_0x389fa3})[_0xb7ee('0x21')](function(_0x4c0996){_0x4549ef=_0x4c0996['get']({'plain':!![]});return db['VoiceExtension'][_0xb7ee('0x81')](createExtensionsReciveFax(_0x4549ef),{'transaction':_0x389fa3});});})[_0xb7ee('0x21')](function(){return _0x4549ef;})[_0xb7ee('0x21')](respondWithResult(_0x4c7d72,null))[_0xb7ee('0x2b')](handleError(_0x4c7d72,null));};exports[_0xb7ee('0x94')]=function(_0x54b240,_0x195829,_0x376050){var _0x2b235;return db[_0xb7ee('0x7d')][_0xb7ee('0x7c')](function(_0x2bd950){return db['FaxAccount'][_0xb7ee('0x36')](_0x54b240[_0xb7ee('0x5d')],{'where':{'id':_0x54b240[_0xb7ee('0x5d')]['id']},'transaction':_0x2bd950})['then'](function(_0x944f9a){return db[_0xb7ee('0x95')]['destroy']({'where':{'FaxAccountId':_0x54b240[_0xb7ee('0x5d')]['id']},'transaction':_0x2bd950})['then'](function(_0x1af929){return db[_0xb7ee('0x95')][_0xb7ee('0x81')](createExtensionsReciveFax(_[_0xb7ee('0x73')](_0x54b240['body'],[_0xb7ee('0x96'),_0xb7ee('0x97'),_0xb7ee('0x98'),_0xb7ee('0x99'),_0xb7ee('0x9a'),_0xb7ee('0x9b')])),{'transaction':_0x2bd950});});});})[_0xb7ee('0x21')](function(){return db[_0xb7ee('0x41')][_0xb7ee('0x9c')](_0x54b240[_0xb7ee('0x5d')]['id']);})[_0xb7ee('0x21')](respondWithResult(_0x195829,null))['catch'](handleError(_0x195829,null));};exports[_0xb7ee('0x9d')]=function(_0x288d97,_0x42d259,_0x322b2d){var _0x1c7756={'raw':!![],'where':{}};var _0x11fa05={};var _0x21b933={'count':0x0,'rows':[]};return db[_0xb7ee('0x41')][_0xb7ee('0x6a')]({'where':{'id':_0x288d97[_0xb7ee('0x65')]['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x42d259,null))['then'](function(_0x13da25){if(_0x13da25){_0x11fa05[_0xb7ee('0x4a')]=_[_0xb7ee('0x46')](db['FaxMessage'][_0xb7ee('0x42')]);_0x11fa05[_0xb7ee('0x47')]=_[_0xb7ee('0x46')](_0x288d97[_0xb7ee('0x47')]);_0x11fa05['filters']=_['intersection'](_0x11fa05[_0xb7ee('0x4a')],_0x11fa05['query']);_0x1c7756[_0xb7ee('0x4b')]=_[_0xb7ee('0x49')](_0x11fa05['model'],qs[_0xb7ee('0x4c')](_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x4c')]));_0x1c7756[_0xb7ee('0x4b')]=_0x1c7756[_0xb7ee('0x4b')][_0xb7ee('0x4d')]?_0x1c7756[_0xb7ee('0x4b')]:_0x11fa05['model'];if(!_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x4e')](_0xb7ee('0x4f'))){_0x1c7756['limit']=qs[_0xb7ee('0x31')](_0x288d97['query'][_0xb7ee('0x31')]);_0x1c7756[_0xb7ee('0x2f')]=qs[_0xb7ee('0x2f')](_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x2f')]);}_0x1c7756[_0xb7ee('0x6b')]=qs[_0xb7ee('0x50')](_0x288d97['query'][_0xb7ee('0x50')]);_0x1c7756[_0xb7ee('0x51')]=qs['filters'](_['pick'](_0x288d97[_0xb7ee('0x47')],_0x11fa05[_0xb7ee('0x48')]));_0x1c7756[_0xb7ee('0x51')][_0xb7ee('0x68')]=_0x13da25['id'];if(_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x53')]){_0x1c7756[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x1c7756['where'],{'$or':_[_0xb7ee('0x45')](_0x1c7756[_0xb7ee('0x4b')],function(_0x1d17fc){var _0x4c506a={};_0x4c506a[_0x1d17fc]={'$like':'%'+_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x53')]+'%'};return _0x4c506a;})});}if(_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x9e')]){var _0x24d4c3=_0x288d97[_0xb7ee('0x47')]['$gte'][_0xb7ee('0x9f')](',');var _0xe83df={};_0xe83df[_0x24d4c3[0x0]]={'$gte':moment(_0x24d4c3[0x1])[_0xb7ee('0xa0')](_0xb7ee('0xa1'))};_0x1c7756[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x1c7756[_0xb7ee('0x51')],_0xe83df);}_0x1c7756=_[_0xb7ee('0x54')]({},_0x1c7756,_0x288d97['options']);return db[_0xb7ee('0xa2')][_0xb7ee('0x32')]({'where':_0x1c7756[_0xb7ee('0x51')]})['then'](function(_0x57376b){_0x21b933['count']=_0x57376b;if(_0x288d97[_0xb7ee('0x47')][_0xb7ee('0x55')]){_0x1c7756[_0xb7ee('0x56')]=[{'all':!![]}];}return db[_0xb7ee('0xa2')][_0xb7ee('0x57')](_0x1c7756);})[_0xb7ee('0x21')](function(_0xc4dd43){_0x21b933[_0xb7ee('0x58')]=_0xc4dd43;return _0x21b933;});}})[_0xb7ee('0x21')](respondWithFilteredResult(_0x42d259,_0x1c7756))[_0xb7ee('0x2b')](handleError(_0x42d259,null));};exports[_0xb7ee('0x3d')]=function(_0x3d1df8,_0x41884b,_0x237b14){var _0x4c17b7,_0x3e76a8={},_0x45e040;if(_0x3d1df8[_0xb7ee('0x5d')]['to']){_0x45e040=_0x3d1df8['body']['to'][0x0];}return db[_0xb7ee('0x41')][_0xb7ee('0x5b')]({'where':{'id':_0x3d1df8['params']['id']},'include':[{'model':db[_0xb7ee('0xa3')],'as':_0xb7ee('0xa4'),'include':[{'model':db[_0xb7ee('0xa5')],'as':_0xb7ee('0xa6'),'where':{'fax':_0x45e040},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xb7ee('0x21')](handleEntityNotFound(_0x41884b,null))[_0xb7ee('0x21')](function(_0x17bc36){_0x4c17b7=_0x17bc36;if(_0x3d1df8[_0xb7ee('0x5d')]['attachments']&&_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][_0xb7ee('0x4d')]){for(var _0xb363cc=0x0;_0xb363cc<_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')]['length'];_0xb363cc+=0x1){_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][_0xb363cc]={'filename':_0x3d1df8['body'][_0xb7ee('0xa7')][_0xb363cc][_0xb7ee('0x3c')],'id':_0x3d1df8['body'][_0xb7ee('0xa7')][_0xb363cc]['id'],'path':path[_0xb7ee('0xa8')](config['root'],_0xb7ee('0xa9'),_0x3d1df8['body'][_0xb7ee('0xa7')][_0xb363cc][_0xb7ee('0xaa')])};}}return respondWithRpcPromise(_0xb7ee('0xab'),_0xb7ee('0xab'),{'FaxAccountId':_[_0xb7ee('0xac')](_0x3d1df8[_0xb7ee('0x65')]['id'])?undefined:_0x3d1df8[_0xb7ee('0x65')]['id'],'path':_[_0xb7ee('0xac')](_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0][_0xb7ee('0x8')])?undefined:_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0][_0xb7ee('0x8')],'fax':_['isNil'](_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0])?undefined:_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0]},client9002);})['then'](function(){if(_0x4c17b7){if(_[_0xb7ee('0xac')](_0x3d1df8[_0xb7ee('0x5d')]['from'])){_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xad')]=util['format'](_0xb7ee('0xae'),_0x4c17b7[_0xb7ee('0x3c')],_0x4c17b7['fax']);}if(_0x4c17b7['List']){if(_0x4c17b7[_0xb7ee('0xa4')][_0xb7ee('0xa6')][_0xb7ee('0x4d')]){return _0x4c17b7[_0xb7ee('0xa4')]['Contacts'][0x0];}else{return db[_0xb7ee('0xa5')][_0xb7ee('0x5c')](_['defaults'](_0x3d1df8[_0xb7ee('0x5d')],{'firstName':_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0],'phone':_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0],'fax':_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0],'ListId':_0x4c17b7['ListId']}));}}else{throw new Error(_0xb7ee('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb7ee('0x21')](function(_0x479ecb){if(_0x479ecb){return db['FaxInteraction'][_0xb7ee('0x5b')]({'where':{'ContactId':_0x479ecb['id'],'closed':![],'FaxAccountId':_0x4c17b7['id']}})[_0xb7ee('0x21')](function(_0x40230b){if(_0x40230b){return[_0x40230b,![]];}return db[_0xb7ee('0x71')]['create']({'UserId':_0x3d1df8[_0xb7ee('0x5e')]['id'],'ContactId':_0x479ecb['id'],'FaxAccountId':_0x4c17b7['id'],'fax':_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xb7ee('0x54')](_0x3d1df8[_0xb7ee('0x5d')],{'read':![],'body':_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0][_0xb7ee('0xb0')],'FaxAccountId':_0x4c17b7['id'],'UserId':_0x3d1df8[_0xb7ee('0x5e')]['id'],'ContactId':_0x479ecb['id'],'AttachmentId':_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xb7ee('0xa2')],'as':'Messages'}]})[_0xb7ee('0x21')](function(_0x2ebef8){return[_0x2ebef8,!![]];});});}else{throw new Error(_0xb7ee('0xb1'));}})['spread'](function(_0x29eedb,_0x5e74f0){if(_0x5e74f0){return _0x29eedb;}return db[_0xb7ee('0xa2')][_0xb7ee('0x5c')]({'direction':'out','read':![],'body':_0x3d1df8['body']['attachments'][0x0][_0xb7ee('0xb0')],'FaxAccountId':_0x4c17b7['id'],'FaxInteractionId':_0x29eedb['id'],'UserId':_0x3d1df8[_0xb7ee('0x5e')]['id'],'ContactId':_0x29eedb[_0xb7ee('0xb2')],'AttachmentId':_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0]['id']})[_0xb7ee('0x21')](function(_0x37d145){_0x29eedb['dataValues'][_0xb7ee('0xb3')]=[];_0x29eedb[_0xb7ee('0xb4')][_0xb7ee('0xb3')][_0xb7ee('0x89')](_0x37d145['dataValues']);return _0x29eedb;});})[_0xb7ee('0x21')](function(_0x2bff31){respondWithRpcPromise(_0xb7ee('0xb5'),_0xb7ee('0xb5'),{'FaxAccountId':_[_0xb7ee('0xac')](_0x3d1df8['params']['id'])?undefined:_0x3d1df8[_0xb7ee('0x65')]['id'],'path':_[_0xb7ee('0xac')](_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0][_0xb7ee('0x8')])?undefined:_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0][_0xb7ee('0x8')],'fax':_['isNil'](_0x3d1df8[_0xb7ee('0x5d')]['to'][0x0])?undefined:_0x3d1df8['body']['to'][0x0],'AttachmentId':_0x3d1df8[_0xb7ee('0x5d')][_0xb7ee('0xa7')][0x0]['id']},client9002)['then'](function(_0x3e91bf){logger[_0xb7ee('0x22')]('SendFaxRpc,\x20%s',_0x3e91bf);})[_0xb7ee('0x2b')](function(_0x138ae8){logger[_0xb7ee('0x22')]('SendFaxRpc,\x20%s',_0x138ae8);});return _0x2bff31;})[_0xb7ee('0x21')](respondWithResult(_0x41884b,null))['catch'](handleError(_0x41884b,null));};exports[_0xb7ee('0xb6')]=function(_0x7730a2,_0x68d0ac,_0x427c85){return db['FaxAccount'][_0xb7ee('0x5b')]({'where':{'id':_0x7730a2[_0xb7ee('0x65')]['id']}})['then'](handleEntityNotFound(_0x68d0ac,null))[_0xb7ee('0x21')](function(_0xb6a127){if(_0xb6a127){return _0xb6a127['addAgents'](_0x7730a2[_0xb7ee('0x5d')][_0xb7ee('0x70')],_[_0xb7ee('0x73')](_0x7730a2[_0xb7ee('0x5d')],['ids','id'])||{})[_0xb7ee('0xb7')](function(_0x42103a){for(var _0x21ac0d=0x0;_0x21ac0d<_0x7730a2['body'][_0xb7ee('0x70')][_0xb7ee('0x4d')];_0x21ac0d+=0x1){socket['emit'](_0xb7ee('0xb8'),{'UserId':Number(_0x7730a2[_0xb7ee('0x5d')][_0xb7ee('0x70')][_0x21ac0d]),'FaxAccountId':Number(_0x7730a2[_0xb7ee('0x65')]['id'])});}return _0x42103a;});}})[_0xb7ee('0x21')](respondWithResult(_0x68d0ac,null))[_0xb7ee('0x2b')](handleError(_0x68d0ac,null));};exports[_0xb7ee('0xb9')]=function(_0x10b681,_0x2599f9,_0x12b6ec){return db[_0xb7ee('0x41')][_0xb7ee('0x5b')]({'where':{'id':_0x10b681['params']['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x2599f9,null))['then'](function(_0xc710b1){if(_0xc710b1){return _0xc710b1[_0xb7ee('0xb9')](_0x10b681[_0xb7ee('0x47')][_0xb7ee('0x70')])[_0xb7ee('0x21')](function(){if(_[_0xb7ee('0xba')](_0x10b681[_0xb7ee('0x47')]['ids'])){for(var _0x3763c5=0x0;_0x3763c5<_0x10b681[_0xb7ee('0x47')][_0xb7ee('0x70')][_0xb7ee('0x4d')];_0x3763c5+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x10b681[_0xb7ee('0x47')][_0xb7ee('0x70')][_0x3763c5]),'FaxAccountId':Number(_0x10b681[_0xb7ee('0x65')]['id'])});}}else{socket[_0xb7ee('0xbb')](_0xb7ee('0xbc'),{'UserId':Number(_0x10b681[_0xb7ee('0x47')]['ids']),'FaxAccountId':Number(_0x10b681[_0xb7ee('0x65')]['id'])});}});}})[_0xb7ee('0x21')](respondWithStatusCode(_0x2599f9,null))[_0xb7ee('0x2b')](handleError(_0x2599f9,null));};exports[_0xb7ee('0xbd')]=function(_0x5d8f4d,_0x398e3e,_0xcb9967){var _0x2a3fa6={};var _0x3a52d5={};var _0x1cafdc;var _0x395cb7;return db[_0xb7ee('0x41')][_0xb7ee('0x6a')]({'where':{'id':_0x5d8f4d[_0xb7ee('0x65')]['id']}})[_0xb7ee('0x21')](handleEntityNotFound(_0x398e3e,null))[_0xb7ee('0x21')](function(_0x390897){if(_0x390897){_0x1cafdc=_0x390897;_0x3a52d5[_0xb7ee('0x4a')]=_[_0xb7ee('0x46')](db[_0xb7ee('0x75')][_0xb7ee('0x42')]);_0x3a52d5[_0xb7ee('0x47')]=_[_0xb7ee('0x46')](_0x5d8f4d[_0xb7ee('0x47')]);_0x3a52d5[_0xb7ee('0x48')]=_['intersection'](_0x3a52d5[_0xb7ee('0x4a')],_0x3a52d5[_0xb7ee('0x47')]);_0x2a3fa6['attributes']=_['intersection'](_0x3a52d5[_0xb7ee('0x4a')],qs[_0xb7ee('0x4c')](_0x5d8f4d[_0xb7ee('0x47')]['fields']));_0x2a3fa6['attributes']=_0x2a3fa6[_0xb7ee('0x4b')][_0xb7ee('0x4d')]?_0x2a3fa6[_0xb7ee('0x4b')]:_0x3a52d5['model'];_0x2a3fa6[_0xb7ee('0x6b')]=qs[_0xb7ee('0x50')](_0x5d8f4d[_0xb7ee('0x47')][_0xb7ee('0x50')]);_0x2a3fa6[_0xb7ee('0x51')]=qs['filters'](_[_0xb7ee('0x52')](_0x5d8f4d[_0xb7ee('0x47')],_0x3a52d5[_0xb7ee('0x48')]));if(_0x5d8f4d[_0xb7ee('0x47')][_0xb7ee('0x53')]){_0x2a3fa6[_0xb7ee('0x51')]=_[_0xb7ee('0x54')](_0x2a3fa6['where'],{'$or':_['map'](_0x2a3fa6[_0xb7ee('0x4b')],function(_0x53b4ce){var _0x5d8a2d={};_0x5d8a2d[_0x53b4ce]={'$like':'%'+_0x5d8f4d[_0xb7ee('0x47')][_0xb7ee('0x53')]+'%'};return _0x5d8a2d;})});}_0x2a3fa6=_[_0xb7ee('0x54')]({},_0x2a3fa6,_0x5d8f4d[_0xb7ee('0x5a')]);return _0x1cafdc[_0xb7ee('0xbd')](_0x2a3fa6);}})[_0xb7ee('0x21')](function(_0x17502c){if(_0x17502c){_0x395cb7=_0x17502c['length'];if(!_0x5d8f4d[_0xb7ee('0x47')][_0xb7ee('0x4e')](_0xb7ee('0x4f'))){_0x2a3fa6[_0xb7ee('0x31')]=qs[_0xb7ee('0x31')](_0x5d8f4d[_0xb7ee('0x47')][_0xb7ee('0x31')]);_0x2a3fa6['offset']=qs[_0xb7ee('0x2f')](_0x5d8f4d[_0xb7ee('0x47')]['offset']);}return _0x1cafdc[_0xb7ee('0xbd')](_0x2a3fa6);}})['then'](function(_0xd5f30b){if(_0xd5f30b){return _0xd5f30b?{'count':_0x395cb7,'rows':_0xd5f30b}:null;}})[_0xb7ee('0x21')](respondWithResult(_0x398e3e,null))['catch'](handleError(_0x398e3e,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1105473..5377181 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 _0x95a2=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3db285,_0x2ce3dc){var _0x287478=function(_0x146324){while(--_0x146324){_0x3db285['push'](_0x3db285['shift']());}};_0x287478(++_0x2ce3dc);}(_0x95a2,0x120));var _0x295a=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x95a2[_0xbf8ebe];return _0x1e25e8;};'use strict';var EventEmitter=require(_0x295a('0x0'));var FaxAccount=require(_0x295a('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x295a('0x2')](0x0);var events={'afterCreate':_0x295a('0x3'),'afterUpdate':_0x295a('0x4'),'afterDestroy':_0x295a('0x5')};function emitEvent(_0x294eca){return function(_0x4c797f,_0x1c2169,_0x20a3bf){FaxAccountEvents['emit'](_0x294eca+':'+_0x4c797f['id'],_0x4c797f);FaxAccountEvents[_0x295a('0x6')](_0x294eca,_0x4c797f);_0x20a3bf(null);};}for(var e in events){if(events[_0x295a('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x295a('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xd66d=['events','FaxAccount','update','emit','hasOwnProperty','hook','exports'];(function(_0x1ed84c,_0x4f3751){var _0x2cc896=function(_0x1d75a5){while(--_0x1d75a5){_0x1ed84c['push'](_0x1ed84c['shift']());}};_0x2cc896(++_0x4f3751);}(_0xd66d,0x12d));var _0xdd66=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xd66d[_0x580647];return _0x5f0792;};'use strict';var EventEmitter=require(_0xdd66('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xdd66('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd66('0x2'),'afterDestroy':'remove'};function emitEvent(_0x35ec93){return function(_0xce83f7,_0x4b9c32,_0x4491b4){FaxAccountEvents[_0xdd66('0x3')](_0x35ec93+':'+_0xce83f7['id'],_0xce83f7);FaxAccountEvents[_0xdd66('0x3')](_0x35ec93,_0xce83f7);_0x4491b4(null);};}for(var e in events){if(events[_0xdd66('0x4')](e)){var event=events[e];FaxAccount[_0xdd66('0x5')](e,emitEvent(event));}}module[_0xdd66('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4037ae4..1b1f115 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 _0x7c0a=['../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1e25de,_0xf8a6ce){var _0x5f3cc8=function(_0x8cc260){while(--_0x8cc260){_0x1e25de['push'](_0x1e25de['shift']());}};_0x5f3cc8(++_0xf8a6ce);}(_0x7c0a,0xa1));var _0xa7c0=function(_0x20794f,_0x5ee4c7){_0x20794f=_0x20794f-0x0;var _0x4108b4=_0x7c0a[_0x20794f];return _0x4108b4;};'use strict';var _=require(_0xa7c0('0x0'));var util=require('util');var logger=require(_0xa7c0('0x1'))(_0xa7c0('0x2'));var moment=require(_0xa7c0('0x3'));var BPromise=require(_0xa7c0('0x4'));var rp=require(_0xa7c0('0x5'));var fs=require('fs');var path=require(_0xa7c0('0x6'));var rimraf=require('rimraf');var config=require(_0xa7c0('0x7'));var attributes=require(_0xa7c0('0x8'));module[_0xa7c0('0x9')]=function(_0x3e84d3,_0x120ac5){return _0x3e84d3['define'](_0xa7c0('0xa'),attributes,{'tableName':_0xa7c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc92c=['fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x2a2417,_0x28cbb6){var _0x4a0ae1=function(_0x10fe87){while(--_0x10fe87){_0x2a2417['push'](_0x2a2417['shift']());}};_0x4a0ae1(++_0x28cbb6);}(_0xc92c,0x139));var _0xcc92=function(_0x5320f0,_0x5e9601){_0x5320f0=_0x5320f0-0x0;var _0x497132=_0xc92c[_0x5320f0];return _0x497132;};'use strict';var _=require(_0xcc92('0x0'));var util=require('util');var logger=require(_0xcc92('0x1'))(_0xcc92('0x2'));var moment=require(_0xcc92('0x3'));var BPromise=require(_0xcc92('0x4'));var rp=require(_0xcc92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcc92('0x6'));var attributes=require(_0xcc92('0x7'));module[_0xcc92('0x8')]=function(_0x3c3763,_0x3933b4){return _0x3c3763[_0xcc92('0x9')](_0xcc92('0xa'),attributes,{'tableName':_0xcc92('0xb'),'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 b174e7a..c014275 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 _0x3a83=['where','attributes','limit','include','map','model','debug','NotifyFaxAccount','body','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','DESC','FaxApplication','get','applications','Applications','list','priority','asc','Contacts','defaults','create','contact','fax','FaxInteraction','spread','autoclose','push','length','close','created','AttachmentId','interaction','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','message','error','result','catch','GetFaxAccount','findAll','raw','options'];(function(_0x2479c5,_0x4703ae){var _0x870e13=function(_0x261f7b){while(--_0x261f7b){_0x2479c5['push'](_0x2479c5['shift']());}};_0x870e13(++_0x4703ae);}(_0x3a83,0x145));var _0x33a8=function(_0x277b19,_0x3b6aac){_0x277b19=_0x277b19-0x0;var _0x1fdb96=_0x3a83[_0x277b19];return _0x1fdb96;};'use strict';var _=require(_0x33a8('0x0'));var util=require(_0x33a8('0x1'));var moment=require(_0x33a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x33a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33a8('0x4'))['db'];var utils=require(_0x33a8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x33a8('0x6'));var jayson=require(_0x33a8('0x7'));var client=jayson[_0x33a8('0x8')][_0x33a8('0x9')]({'port':0x232c});config[_0x33a8('0xa')]=_['defaults'](config[_0x33a8('0xa')],{'host':_0x33a8('0xb'),'port':0x18eb});var socket=require(_0x33a8('0xc'))(new Redis(config[_0x33a8('0xa')]));require('./faxAccount.socket')[_0x33a8('0xd')](socket);function respondWithRpcPromise(_0x556bf4,_0x1aedad,_0x36d201){return new BPromise(function(_0x47bc71,_0x3e98e3){return client['request'](_0x556bf4,_0x36d201)[_0x33a8('0xe')](function(_0x2ec2c1){logger[_0x33a8('0xf')](_0x33a8('0x10'),_0x1aedad,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1aedad,_0x33a8('0x11'),JSON[_0x33a8('0x12')](_0x2ec2c1));if(_0x2ec2c1['error']){if(_0x2ec2c1['error']['code']===0x1f4){logger['error'](_0x33a8('0x10'),_0x1aedad,_0x2ec2c1['error'][_0x33a8('0x13')]);return _0x3e98e3(_0x2ec2c1['error'][_0x33a8('0x13')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1aedad,_0x2ec2c1[_0x33a8('0x14')]['message']);return _0x47bc71(_0x2ec2c1[_0x33a8('0x14')][_0x33a8('0x13')]);}else{logger['info'](_0x33a8('0x10'),_0x1aedad,_0x33a8('0x11'));_0x47bc71(_0x2ec2c1[_0x33a8('0x15')]['message']);}})[_0x33a8('0x16')](function(_0x21cf84){logger[_0x33a8('0x14')](_0x33a8('0x10'),_0x1aedad,_0x21cf84);_0x3e98e3(_0x21cf84);});});}exports[_0x33a8('0x17')]=function(_0x2381c3){var _0x558971=this;return new Promise(function(_0x6dda79,_0x221e3e){return db['FaxAccount'][_0x33a8('0x18')]({'raw':_0x2381c3['options']?_0x2381c3['options'][_0x33a8('0x19')]===undefined?!![]:![]:!![],'where':_0x2381c3['options']?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1b')]||null:null,'attributes':_0x2381c3[_0x33a8('0x1a')]?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1c')]||null:null,'limit':_0x2381c3[_0x33a8('0x1a')]?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1d')]||null:null,'include':_0x2381c3[_0x33a8('0x1a')]?_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1e')]?_[_0x33a8('0x1f')](_0x2381c3[_0x33a8('0x1a')][_0x33a8('0x1e')],function(_0x552947){return{'model':db[_0x552947['model']],'as':_0x552947['as'],'attributes':_0x552947[_0x33a8('0x1c')],'include':_0x552947[_0x33a8('0x1e')]?_['map'](_0x552947['include'],function(_0x593551){return{'model':db[_0x593551[_0x33a8('0x20')]],'as':_0x593551['as'],'attributes':_0x593551[_0x33a8('0x1c')],'include':_0x593551['include']?_['map'](_0x593551[_0x33a8('0x1e')],function(_0x3ee69c){return{'model':db[_0x3ee69c['model']],'as':_0x3ee69c['as'],'attributes':_0x3ee69c[_0x33a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x33a8('0xe')](function(_0x4d5476){logger[_0x33a8('0xf')]('GetFaxAccount',_0x2381c3);logger[_0x33a8('0x21')](_0x33a8('0x17'),_0x2381c3,JSON['stringify'](_0x4d5476));_0x6dda79(_0x4d5476);})[_0x33a8('0x16')](function(_0x319149){logger['error'](_0x33a8('0x17'),_0x319149['message'],_0x2381c3);_0x221e3e(_0x558971[_0x33a8('0x14')](0x1f4,_0x319149[_0x33a8('0x13')]));});});};exports[_0x33a8('0x22')]=function(_0x1904db,_0x21171f,_0x344e14){var _0x5154b4=this;return new Promise(function(_0x2841e6,_0x369933){var _0x2dbb6c={'body':_0x1904db[_0x33a8('0x23')],'channel':'fax'};var _0x3ad46a=[];var _0x28c152=[];var _0x5f1738={};return db[_0x33a8('0x24')]['describe']()['then'](function(_0x582e32){if(!_0x582e32){throw new db['Sequelize'][(_0x33a8('0x25'))](_0x33a8('0x26'));}_0x3ad46a=_[_0x33a8('0x27')](_['keys'](_0x582e32),[_0x33a8('0x28'),_0x33a8('0x29')]);_0x28c152=_[_0x33a8('0x27')](_[_0x33a8('0x2a')](_0x582e32),[_0x33a8('0x28'),'updatedAt',_0x33a8('0x2b'),_0x33a8('0x2c')]);if(_0x1904db[_0x33a8('0x23')]['id']){delete _0x1904db[_0x33a8('0x23')]['id'];}if(_[_0x33a8('0x2d')](_0x1904db[_0x33a8('0x23')][_0x33a8('0x2e')])){throw new db[(_0x33a8('0x2f'))][(_0x33a8('0x25'))](_0x33a8('0x30'));}if(_[_0x33a8('0x2d')](_0x1904db['body']['body'])||_0x1904db[_0x33a8('0x23')][_0x33a8('0x23')]===''){throw new db[(_0x33a8('0x2f'))][(_0x33a8('0x25'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x33a8('0x2d')](_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')])){throw new db[(_0x33a8('0x2f'))][(_0x33a8('0x25'))](_0x33a8('0x32')+_0x28c152);}if(!_[_0x33a8('0x33')](_0x28c152,_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')])){throw new db['Sequelize'][(_0x33a8('0x25'))](_0x33a8('0x34')+_0x28c152);}_0x5f1738[_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')]]=_0x1904db[_0x33a8('0x23')]['from'];})[_0x33a8('0xe')](function(){return db[_0x33a8('0x35')][_0x33a8('0x36')]({'where':{'id':_0x1904db[_0x33a8('0x37')]['id']},'include':[{'model':db[_0x33a8('0x38')],'as':_0x33a8('0x39'),'include':[{'model':db[_0x33a8('0x24')],'as':'Contacts','where':_0x5f1738,'limit':0x1,'order':[['updatedAt',_0x33a8('0x3a')]]}]},{'model':db[_0x33a8('0x3b')],'as':'Applications'}]});})[_0x33a8('0xe')](function(_0x4efad8){if(_0x4efad8&&_0x4efad8['List']){var _0x232f6f=_0x4efad8[_0x33a8('0x3c')]({'plain':!![]});_0x2dbb6c[_0x33a8('0x37')]=_0x232f6f;_0x2dbb6c[_0x33a8('0x3d')]=_0x232f6f[_0x33a8('0x3e')];_0x2dbb6c[_0x33a8('0x3f')]=_0x232f6f[_0x33a8('0x39')];_0x2dbb6c[_0x33a8('0x3d')]=_['orderBy'](_0x2dbb6c[_0x33a8('0x3d')],[_0x33a8('0x40')],[_0x33a8('0x41')]);if(_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x3e')]){delete _0x2dbb6c['account'][_0x33a8('0x3e')];}if(_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x39')]&&_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x39')][_0x33a8('0x42')]['length']){return _0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x39')][_0x33a8('0x42')][0x0];}var _0x134a7b=_[_0x33a8('0x43')](_0x1904db[_0x33a8('0x23')],{'firstName':_0x1904db[_0x33a8('0x23')][_0x33a8('0x2e')],'ListId':_0x232f6f[_0x33a8('0x2c')]});_0x134a7b[_0x1904db[_0x33a8('0x23')][_0x33a8('0x31')]]=_0x1904db['body'][_0x33a8('0x2e')];return db['CmContact'][_0x33a8('0x44')](_0x134a7b,{'fields':_0x3ad46a,'raw':!![]});}})[_0x33a8('0xe')](function(_0xe043e4){_0x2dbb6c[_0x33a8('0x45')]=_0xe043e4;if(_0xe043e4){var _0x2e58d8={'ContactId':_0xe043e4['id'],'FaxAccountId':_0x1904db['account']['id'],'fax':_0xe043e4[_0x33a8('0x46')]};return db['FaxInteraction'][_0x33a8('0x36')]({'where':{'ContactId':_0xe043e4['id'],'closed':![],'FaxAccountId':_0x1904db['account']['id']}})[_0x33a8('0xe')](function(_0x56c061){if(_0x56c061){return[_0x56c061,![]];}return db[_0x33a8('0x47')][_0x33a8('0x44')](_0x2e58d8)[_0x33a8('0xe')](function(_0x5d7d50){return[_0x5d7d50,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x33a8('0x48')](function(_0x18999a,_0xf8042f){var _0x1ef540=_0x18999a[_0x33a8('0x3c')]({'plain':!![]});if(_0xf8042f){if(_0x2dbb6c[_0x33a8('0x37')][_0x33a8('0x49')]){_0x2dbb6c[_0x33a8('0x3d')][_0x33a8('0x4a')]({'id':0x0,'priority':_0x2dbb6c[_0x33a8('0x3d')][_0x33a8('0x4b')]+0x1,'app':_0x33a8('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x1ef540['created']=!![];}else{_0x1ef540[_0x33a8('0x4d')]=![];}_0x2dbb6c['interaction']=_0x1ef540;return db['FaxMessage'][_0x33a8('0x44')]({'body':_0x1904db[_0x33a8('0x23')][_0x33a8('0x23')],'FaxAccountId':_0x1904db[_0x33a8('0x37')]['id'],'FaxInteractionId':_0x18999a['id'],'direction':'in','ContactId':_0x18999a['ContactId'],'AttachmentId':_0x1904db[_0x33a8('0x23')][_0x33a8('0x4e')]});})[_0x33a8('0xe')](function(_0x1ae753){_0x2dbb6c[_0x33a8('0x13')]=_0x1ae753;if(_0x2dbb6c[_0x33a8('0x4f')]['UserId']){return db[_0x33a8('0x50')]['find']({'attributes':['id',_0x33a8('0x51')],'where':{'id':_0x2dbb6c[_0x33a8('0x4f')][_0x33a8('0x52')]}})[_0x33a8('0xe')](function(_0x175d4d){if(_0x175d4d){_0x2dbb6c['applications'][_0x33a8('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x175d4d[_0x33a8('0x51')]+','+(_0x2dbb6c['account'][_0x33a8('0x54')]||0xa),'interval':_0x33a8('0x55')});}return respondWithRpcPromise(_0x33a8('0x56'),_0x33a8('0x57'),_0x2dbb6c);});}return respondWithRpcPromise(_0x33a8('0x56'),_0x33a8('0x57'),_0x2dbb6c);})[_0x33a8('0xe')](function(_0x383c01){_0x2841e6(_0x383c01);})[_0x33a8('0x16')](function(_0x2249e9){_0x369933(_0x5154b4['error'](0x1f4,_0x2249e9[_0x33a8('0x13')]));});});}; \ No newline at end of file +var _0x27ad=['createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','FaxApplication','get','applications','list','priority','asc','Contacts','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys'];(function(_0x58da8a,_0x1c0584){var _0x5ba3a3=function(_0x31552b){while(--_0x31552b){_0x58da8a['push'](_0x58da8a['shift']());}};_0x5ba3a3(++_0x1c0584);}(_0x27ad,0x146));var _0xd27a=function(_0x58fca5,_0x286478){_0x58fca5=_0x58fca5-0x0;var _0x557657=_0x27ad[_0x58fca5];return _0x557657;};'use strict';var _=require(_0xd27a('0x0'));var util=require(_0xd27a('0x1'));var moment=require('moment');var BPromise=require(_0xd27a('0x2'));var rs=require(_0xd27a('0x3'));var fs=require('fs');var Redis=require(_0xd27a('0x4'));var db=require(_0xd27a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd27a('0x6'))(_0xd27a('0x7'));var config=require(_0xd27a('0x8'));var jayson=require(_0xd27a('0x9'));var client=jayson[_0xd27a('0xa')][_0xd27a('0xb')]({'port':0x232c});config['redis']=_[_0xd27a('0xc')](config[_0xd27a('0xd')],{'host':_0xd27a('0xe'),'port':0x18eb});var socket=require(_0xd27a('0xf'))(new Redis(config['redis']));require(_0xd27a('0x10'))[_0xd27a('0x11')](socket);function respondWithRpcPromise(_0x9ecab7,_0x5d43ae,_0x8ae74f){return new BPromise(function(_0x44e2fc,_0x56b595){return client[_0xd27a('0x12')](_0x9ecab7,_0x8ae74f)[_0xd27a('0x13')](function(_0x287b69){logger[_0xd27a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x5d43ae,_0xd27a('0x15'));logger[_0xd27a('0x16')](_0xd27a('0x17'),_0x5d43ae,_0xd27a('0x15'),JSON[_0xd27a('0x18')](_0x287b69));if(_0x287b69['error']){if(_0x287b69[_0xd27a('0x19')][_0xd27a('0x1a')]===0x1f4){logger[_0xd27a('0x19')](_0xd27a('0x1b'),_0x5d43ae,_0x287b69[_0xd27a('0x19')]['message']);return _0x56b595(_0x287b69[_0xd27a('0x19')][_0xd27a('0x1c')]);}logger[_0xd27a('0x19')](_0xd27a('0x1b'),_0x5d43ae,_0x287b69['error'][_0xd27a('0x1c')]);return _0x44e2fc(_0x287b69[_0xd27a('0x19')]['message']);}else{logger[_0xd27a('0x14')](_0xd27a('0x1b'),_0x5d43ae,'request\x20sent');_0x44e2fc(_0x287b69[_0xd27a('0x1d')][_0xd27a('0x1c')]);}})['catch'](function(_0xced9a){logger['error'](_0xd27a('0x1b'),_0x5d43ae,_0xced9a);_0x56b595(_0xced9a);});});}exports[_0xd27a('0x1e')]=function(_0x2a6b12){var _0x269b72=this;return new Promise(function(_0x1a15ec,_0x323244){return db[_0xd27a('0x1f')][_0xd27a('0x20')]({'raw':_0x2a6b12[_0xd27a('0x21')]?_0x2a6b12[_0xd27a('0x21')][_0xd27a('0x22')]===undefined?!![]:![]:!![],'where':_0x2a6b12[_0xd27a('0x21')]?_0x2a6b12[_0xd27a('0x21')]['where']||null:null,'attributes':_0x2a6b12['options']?_0x2a6b12['options'][_0xd27a('0x23')]||null:null,'limit':_0x2a6b12[_0xd27a('0x21')]?_0x2a6b12[_0xd27a('0x21')][_0xd27a('0x24')]||null:null,'include':_0x2a6b12['options']?_0x2a6b12['options'][_0xd27a('0x25')]?_[_0xd27a('0x26')](_0x2a6b12[_0xd27a('0x21')]['include'],function(_0x25e78b){return{'model':db[_0x25e78b[_0xd27a('0x27')]],'as':_0x25e78b['as'],'attributes':_0x25e78b[_0xd27a('0x23')],'include':_0x25e78b['include']?_[_0xd27a('0x26')](_0x25e78b[_0xd27a('0x25')],function(_0x47bd98){return{'model':db[_0x47bd98['model']],'as':_0x47bd98['as'],'attributes':_0x47bd98['attributes'],'include':_0x47bd98[_0xd27a('0x25')]?_[_0xd27a('0x26')](_0x47bd98[_0xd27a('0x25')],function(_0x75922c){return{'model':db[_0x75922c[_0xd27a('0x27')]],'as':_0x75922c['as'],'attributes':_0x75922c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd27a('0x13')](function(_0x9a477b){logger[_0xd27a('0x14')](_0xd27a('0x1e'),_0x2a6b12);logger[_0xd27a('0x16')]('GetFaxAccount',_0x2a6b12,JSON[_0xd27a('0x18')](_0x9a477b));_0x1a15ec(_0x9a477b);})[_0xd27a('0x28')](function(_0x5971f2){logger[_0xd27a('0x19')](_0xd27a('0x1e'),_0x5971f2[_0xd27a('0x1c')],_0x2a6b12);_0x323244(_0x269b72[_0xd27a('0x19')](0x1f4,_0x5971f2[_0xd27a('0x1c')]));});});};exports[_0xd27a('0x29')]=function(_0x180a77,_0x77c5e9,_0x2f8894){var _0x5d0546=this;return new Promise(function(_0x431c56,_0x32b3b9){var _0x55c95e={'body':_0x180a77[_0xd27a('0x2a')],'channel':_0xd27a('0x2b')};var _0x21242c=[];var _0x10bee6=[];var _0x34a619={};return db[_0xd27a('0x2c')][_0xd27a('0x2d')]()[_0xd27a('0x13')](function(_0x372053){if(!_0x372053){throw new db[(_0xd27a('0x2e'))][(_0xd27a('0x2f'))]('no\x20available\x20attributes');}_0x21242c=_[_0xd27a('0x30')](_[_0xd27a('0x31')](_0x372053),[_0xd27a('0x32'),_0xd27a('0x33')]);_0x10bee6=_[_0xd27a('0x30')](_['keys'](_0x372053),[_0xd27a('0x32'),_0xd27a('0x33'),_0xd27a('0x34'),_0xd27a('0x35')]);if(_0x180a77[_0xd27a('0x2a')]['id']){delete _0x180a77[_0xd27a('0x2a')]['id'];}if(_[_0xd27a('0x36')](_0x180a77['body'][_0xd27a('0x37')])){throw new db[(_0xd27a('0x2e'))][(_0xd27a('0x2f'))](_0xd27a('0x38'));}if(_[_0xd27a('0x36')](_0x180a77[_0xd27a('0x2a')][_0xd27a('0x2a')])||_0x180a77['body'][_0xd27a('0x2a')]===''){throw new db[(_0xd27a('0x2e'))][(_0xd27a('0x2f'))](_0xd27a('0x39'));}if(_[_0xd27a('0x36')](_0x180a77['body'][_0xd27a('0x3a')])){throw new db['Sequelize'][(_0xd27a('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x10bee6);}if(!_[_0xd27a('0x3b')](_0x10bee6,_0x180a77[_0xd27a('0x2a')][_0xd27a('0x3a')])){throw new db[(_0xd27a('0x2e'))]['ValidationError'](_0xd27a('0x3c')+_0x10bee6);}_0x34a619[_0x180a77[_0xd27a('0x2a')][_0xd27a('0x3a')]]=_0x180a77['body']['from'];})[_0xd27a('0x13')](function(){return db[_0xd27a('0x1f')]['find']({'where':{'id':_0x180a77[_0xd27a('0x3d')]['id']},'include':[{'model':db[_0xd27a('0x3e')],'as':_0xd27a('0x3f'),'include':[{'model':db[_0xd27a('0x2c')],'as':'Contacts','where':_0x34a619,'limit':0x1,'order':[[_0xd27a('0x33'),'DESC']]}]},{'model':db[_0xd27a('0x40')],'as':'Applications'}]});})[_0xd27a('0x13')](function(_0x13f290){if(_0x13f290&&_0x13f290[_0xd27a('0x3f')]){var _0x26afc2=_0x13f290[_0xd27a('0x41')]({'plain':!![]});_0x55c95e[_0xd27a('0x3d')]=_0x26afc2;_0x55c95e[_0xd27a('0x42')]=_0x26afc2['Applications'];_0x55c95e[_0xd27a('0x43')]=_0x26afc2[_0xd27a('0x3f')];_0x55c95e[_0xd27a('0x42')]=_['orderBy'](_0x55c95e[_0xd27a('0x42')],[_0xd27a('0x44')],[_0xd27a('0x45')]);if(_0x55c95e[_0xd27a('0x3d')]['Applications']){delete _0x55c95e[_0xd27a('0x3d')]['Applications'];}if(_0x55c95e[_0xd27a('0x3d')][_0xd27a('0x3f')]&&_0x55c95e[_0xd27a('0x3d')]['List'][_0xd27a('0x46')][_0xd27a('0x47')]){return _0x55c95e[_0xd27a('0x3d')][_0xd27a('0x3f')][_0xd27a('0x46')][0x0];}var _0x4b9715=_[_0xd27a('0xc')](_0x180a77[_0xd27a('0x2a')],{'firstName':_0x180a77[_0xd27a('0x2a')]['from'],'ListId':_0x26afc2[_0xd27a('0x35')]});_0x4b9715[_0x180a77[_0xd27a('0x2a')][_0xd27a('0x3a')]]=_0x180a77[_0xd27a('0x2a')][_0xd27a('0x37')];return db[_0xd27a('0x2c')][_0xd27a('0x48')](_0x4b9715,{'fields':_0x21242c,'raw':!![]});}})[_0xd27a('0x13')](function(_0x2f2807){_0x55c95e[_0xd27a('0x49')]=_0x2f2807;if(_0x2f2807){var _0x121446={'ContactId':_0x2f2807['id'],'FaxAccountId':_0x180a77[_0xd27a('0x3d')]['id'],'fax':_0x2f2807[_0xd27a('0x2b')]};return db[_0xd27a('0x4a')][_0xd27a('0x4b')]({'where':{'ContactId':_0x2f2807['id'],'closed':![],'FaxAccountId':_0x180a77[_0xd27a('0x3d')]['id']}})[_0xd27a('0x13')](function(_0x2b6b38){if(_0x2b6b38){return[_0x2b6b38,![]];}return db['FaxInteraction']['create'](_0x121446)[_0xd27a('0x13')](function(_0x127e59){return[_0x127e59,!![]];});});}else{throw new Error(_0xd27a('0x4c'));}})[_0xd27a('0x4d')](function(_0x546712,_0x52a383){var _0x489c98=_0x546712['get']({'plain':!![]});if(_0x52a383){if(_0x55c95e[_0xd27a('0x3d')][_0xd27a('0x4e')]){_0x55c95e[_0xd27a('0x42')][_0xd27a('0x4f')]({'id':0x0,'priority':_0x55c95e[_0xd27a('0x42')][_0xd27a('0x47')]+0x1,'app':_0xd27a('0x50'),'appdata':'unmanaged','interval':_0xd27a('0x51')});}_0x489c98[_0xd27a('0x52')]=!![];}else{_0x489c98[_0xd27a('0x52')]=![];}_0x55c95e[_0xd27a('0x53')]=_0x489c98;return db[_0xd27a('0x54')][_0xd27a('0x48')]({'body':_0x180a77['body'][_0xd27a('0x2a')],'FaxAccountId':_0x180a77[_0xd27a('0x3d')]['id'],'FaxInteractionId':_0x546712['id'],'direction':'in','ContactId':_0x546712[_0xd27a('0x55')],'AttachmentId':_0x180a77[_0xd27a('0x2a')][_0xd27a('0x56')]});})[_0xd27a('0x13')](function(_0x36ac46){_0x55c95e['message']=_0x36ac46;if(_0x55c95e[_0xd27a('0x53')][_0xd27a('0x57')]){return db[_0xd27a('0x58')]['find']({'attributes':['id','name'],'where':{'id':_0x55c95e[_0xd27a('0x53')][_0xd27a('0x57')]}})[_0xd27a('0x13')](function(_0x48f615){if(_0x48f615){_0x55c95e[_0xd27a('0x42')][_0xd27a('0x59')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x48f615[_0xd27a('0x5a')]+','+(_0x55c95e[_0xd27a('0x3d')][_0xd27a('0x5b')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd27a('0x5c'),_0x55c95e);});}return respondWithRpcPromise(_0xd27a('0x5d'),_0xd27a('0x5c'),_0x55c95e);})[_0xd27a('0x13')](function(_0x143bb0){_0x431c56(_0x143bb0);})['catch'](function(_0x45f380){_0x32b3b9(_0x5d0546[_0xd27a('0x19')](0x1f4,_0x45f380[_0xd27a('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c5d2f3c..3a4b9e4 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 _0x74dc=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x74dc,0xd5));var _0xc74d=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x74dc[_0x6e1239];return _0x418150;};'use strict';var FaxAccountEvents=require(_0xc74d('0x0'));var events=[_0xc74d('0x1'),_0xc74d('0x2'),_0xc74d('0x3')];function createListener(_0x2583bf,_0x170ca1){return function(_0x30f68f){_0x170ca1[_0xc74d('0x4')](_0x2583bf,_0x30f68f);};}function removeListener(_0x46216a,_0x5c5cd8){return function(){FaxAccountEvents[_0xc74d('0x5')](_0x46216a,_0x5c5cd8);};}exports[_0xc74d('0x6')]=function(_0x3513a6){for(var _0x43db69=0x0,_0x1fe840=events[_0xc74d('0x7')];_0x43db69<_0x1fe840;_0x43db69++){var _0x4c3075=events[_0x43db69];var _0x2f75ce=createListener(_0xc74d('0x8')+_0x4c3075,_0x3513a6);FaxAccountEvents['on'](_0x4c3075,_0x2f75ce);}}; \ No newline at end of file +var _0xdb31=['remove','update','emit','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0x4aedd9,_0x49c805){var _0x5eda00=function(_0x244e97){while(--_0x244e97){_0x4aedd9['push'](_0x4aedd9['shift']());}};_0x5eda00(++_0x49c805);}(_0xdb31,0xae));var _0x1db3=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0xdb31[_0x5f36cd];return _0x49832a;};'use strict';var FaxAccountEvents=require(_0x1db3('0x0'));var events=[_0x1db3('0x1'),_0x1db3('0x2'),_0x1db3('0x3')];function createListener(_0x3e2847,_0x1c1aa2){return function(_0x3e3684){_0x1c1aa2[_0x1db3('0x4')](_0x3e2847,_0x3e3684);};}function removeListener(_0x456222,_0x835905){return function(){FaxAccountEvents[_0x1db3('0x5')](_0x456222,_0x835905);};}exports['register']=function(_0x2615c3){for(var _0x41b7b1=0x0,_0x3bdbb7=events[_0x1db3('0x6')];_0x41b7b1<_0x3bdbb7;_0x41b7b1++){var _0x368076=events[_0x41b7b1];var _0x1e9fad=createListener(_0x1db3('0x7')+_0x368076,_0x2615c3);FaxAccountEvents['on'](_0x368076,_0x1e9fad);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c35d615..72502d8 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5ec340,_0x547f62){var _0x2772b8=function(_0x43df49){while(--_0x43df49){_0x5ec340['push'](_0x5ec340['shift']());}};_0x2772b8(++_0x547f62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3d368b,_0x4db0e3){var _0x29cea0=function(_0x31caf6){while(--_0x31caf6){_0x3d368b['push'](_0x3d368b['shift']());}};_0x29cea0(++_0x4db0e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 024f719..5970fb5 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 _0x0d43=['TEXT','STRING','*,*,*,*','exports'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x0d43,0x133));var _0x30d4=function(_0x1e97a5,_0x37a2e9){_0x1e97a5=_0x1e97a5-0x0;var _0x42915d=_0x0d43[_0x1e97a5];return _0x42915d;};'use strict';var Sequelize=require('sequelize');module[_0x30d4('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x30d4('0x1')]()},'description':{'type':Sequelize[_0x30d4('0x2')]},'interval':{'type':Sequelize[_0x30d4('0x2')],'defaultValue':_0x30d4('0x3')}}; \ No newline at end of file +var _0x777b=['INTEGER','TEXT','STRING','*,*,*,*','exports'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x777b,0x185));var _0xb777=function(_0x1e6337,_0x50251e){_0x1e6337=_0x1e6337-0x0;var _0x78b0cc=_0x777b[_0x1e6337];return _0x78b0cc;};'use strict';var Sequelize=require('sequelize');module[_0xb777('0x0')]={'priority':{'type':Sequelize[_0xb777('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb777('0x2')]()},'description':{'type':Sequelize[_0xb777('0x3')]},'interval':{'type':Sequelize[_0xb777('0x3')],'defaultValue':_0xb777('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4229f04..c62e55a 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 _0x94ba=['lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','end','sendStatus','error','stack','name','send','FaxApplication','rawAttributes','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','body','update','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0xfd32be,_0xe0076b){var _0x376641=function(_0x1ec260){while(--_0x1ec260){_0xfd32be['push'](_0xfd32be['shift']());}};_0x376641(++_0xe0076b);}(_0x94ba,0xc2));var _0xa94b=function(_0x2b98d4,_0x1de753){_0x2b98d4=_0x2b98d4-0x0;var _0x76ce5b=_0x94ba[_0x2b98d4];return _0x76ce5b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa94b('0x0'));var rp=require(_0xa94b('0x1'));var moment=require(_0xa94b('0x2'));var BPromise=require(_0xa94b('0x3'));var Mustache=require(_0xa94b('0x4'));var util=require(_0xa94b('0x5'));var path=require(_0xa94b('0x6'));var sox=require(_0xa94b('0x7'));var csv=require(_0xa94b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa94b('0x9'));var _=require(_0xa94b('0xa'));var squel=require(_0xa94b('0xb'));var crypto=require(_0xa94b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa94b('0xd'));var Redis=require('ioredis');var authService=require(_0xa94b('0xe'));var qs=require(_0xa94b('0xf'));var as=require(_0xa94b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa94b('0x11'))(_0xa94b('0x12'));var utils=require('../../config/utils');var config=require(_0xa94b('0x13'));var licenseUtil=require(_0xa94b('0x14'));var db=require(_0xa94b('0x15'))['db'];function respondWithStatusCode(_0x1cc8a2,_0x25f757){_0x25f757=_0x25f757||0xcc;return function(_0x16e8bd){if(_0x16e8bd){return _0x1cc8a2['sendStatus'](_0x25f757);}return _0x1cc8a2['status'](_0x25f757)['end']();};}function respondWithResult(_0x20ca6a,_0x1ad659){_0x1ad659=_0x1ad659||0xc8;return function(_0xe09192){if(_0xe09192){return _0x20ca6a[_0xa94b('0x16')](_0x1ad659)[_0xa94b('0x17')](_0xe09192);}};}function respondWithFilteredResult(_0xb0db46,_0x494c71){return function(_0x4bfb95){if(_0x4bfb95){var _0x5d6276=typeof _0x494c71[_0xa94b('0x18')]===_0xa94b('0x19')&&typeof _0x494c71['limit']==='undefined';var _0x12076d=_0x4bfb95[_0xa94b('0x1a')];var _0x308a71=_0x5d6276?0x0:_0x494c71['offset'];var _0x4a80c2=_0x5d6276?_0x4bfb95[_0xa94b('0x1a')]:_0x494c71[_0xa94b('0x18')]+_0x494c71[_0xa94b('0x1b')];var _0x32516f;if(_0x4a80c2>=_0x12076d){_0x4a80c2=_0x12076d;_0x32516f=0xc8;}else{_0x32516f=0xce;}_0xb0db46[_0xa94b('0x16')](_0x32516f);return _0xb0db46[_0xa94b('0x1c')](_0xa94b('0x1d'),_0x308a71+'-'+_0x4a80c2+'/'+_0x12076d)[_0xa94b('0x17')](_0x4bfb95);}return null;};}function patchUpdates(_0x34d14f){return function(_0x481f56){try{jsonpatch['apply'](_0x481f56,_0x34d14f,!![]);}catch(_0x5ed056){return BPromise['reject'](_0x5ed056);}return _0x481f56[_0xa94b('0x1e')]();};}function saveUpdates(_0x5c2b7f,_0xf6604e){return function(_0x574fa2){if(_0x574fa2){return _0x574fa2['update'](_0x5c2b7f)[_0xa94b('0x1f')](function(_0x47cfac){return _0x47cfac;});}return null;};}function removeEntity(_0x79a56e,_0x5c906d){return function(_0xc1251b){if(_0xc1251b){return _0xc1251b[_0xa94b('0x20')]()[_0xa94b('0x1f')](function(){_0x79a56e[_0xa94b('0x16')](0xcc)[_0xa94b('0x21')]();});}};}function handleEntityNotFound(_0x1f091a,_0x13570d){return function(_0x284645){if(!_0x284645){_0x1f091a[_0xa94b('0x22')](0x194);}return _0x284645;};}function handleError(_0x148b9e,_0x56b42a){_0x56b42a=_0x56b42a||0x1f4;return function(_0x45e4fc){logger[_0xa94b('0x23')](_0x45e4fc[_0xa94b('0x24')]);if(_0x45e4fc[_0xa94b('0x25')]){delete _0x45e4fc['name'];}_0x148b9e['status'](_0x56b42a)[_0xa94b('0x26')](_0x45e4fc);};}exports['index']=function(_0xd160fb,_0x477a4a){var _0xf972b3={},_0xc033c5={},_0x32ad22={'count':0x0,'rows':[]};var _0x27831b=_['map'](db[_0xa94b('0x27')][_0xa94b('0x28')],function(_0x506d3c){return{'name':_0x506d3c['fieldName'],'type':_0x506d3c[_0xa94b('0x29')]['key']};});_0xc033c5[_0xa94b('0x2a')]=_['map'](_0x27831b,_0xa94b('0x25'));_0xc033c5['query']=_[_0xa94b('0x2b')](_0xd160fb[_0xa94b('0x2c')]);_0xc033c5['filters']=_[_0xa94b('0x2d')](_0xc033c5[_0xa94b('0x2a')],_0xc033c5[_0xa94b('0x2c')]);_0xf972b3['attributes']=_[_0xa94b('0x2d')](_0xc033c5[_0xa94b('0x2a')],qs[_0xa94b('0x2e')](_0xd160fb[_0xa94b('0x2c')]['fields']));_0xf972b3[_0xa94b('0x2f')]=_0xf972b3[_0xa94b('0x2f')]['length']?_0xf972b3['attributes']:_0xc033c5['model'];if(!_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x30')](_0xa94b('0x31'))){_0xf972b3[_0xa94b('0x1b')]=qs[_0xa94b('0x1b')](_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x1b')]);_0xf972b3['offset']=qs[_0xa94b('0x18')](_0xd160fb['query']['offset']);}_0xf972b3['order']=qs[_0xa94b('0x32')](_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x32')]);_0xf972b3['where']=qs[_0xa94b('0x33')](_['pick'](_0xd160fb[_0xa94b('0x2c')],_0xc033c5[_0xa94b('0x33')]),_0x27831b);if(_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x34')]){_0xf972b3[_0xa94b('0x35')]=_[_0xa94b('0x36')](_0xf972b3[_0xa94b('0x35')],{'$or':_['map'](_0x27831b,function(_0x54c0ec){if(_0x54c0ec[_0xa94b('0x29')]!==_0xa94b('0x37')){var _0x31843c={};_0x31843c[_0x54c0ec['name']]={'$like':'%'+_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x34')]+'%'};return _0x31843c;}})});}_0xf972b3=_[_0xa94b('0x36')]({},_0xf972b3,_0xd160fb[_0xa94b('0x38')]);var _0x7bbfa8={'where':_0xf972b3['where']};return db[_0xa94b('0x27')][_0xa94b('0x1a')](_0x7bbfa8)['then'](function(_0x149efb){_0x32ad22[_0xa94b('0x1a')]=_0x149efb;if(_0xd160fb[_0xa94b('0x2c')][_0xa94b('0x39')]){_0xf972b3[_0xa94b('0x3a')]=[{'all':!![]}];}return db[_0xa94b('0x27')][_0xa94b('0x3b')](_0xf972b3);})[_0xa94b('0x1f')](function(_0x2daea5){_0x32ad22[_0xa94b('0x3c')]=_0x2daea5;return _0x32ad22;})[_0xa94b('0x1f')](respondWithFilteredResult(_0x477a4a,_0xf972b3))[_0xa94b('0x3d')](handleError(_0x477a4a,null));};exports[_0xa94b('0x3e')]=function(_0xd3b31e,_0x3e8912){var _0x2b0ab6={'raw':!![],'where':{'id':_0xd3b31e['params']['id']}},_0x71ed39={};_0x71ed39[_0xa94b('0x2a')]=_['keys'](db[_0xa94b('0x27')][_0xa94b('0x28')]);_0x71ed39['query']=_[_0xa94b('0x2b')](_0xd3b31e[_0xa94b('0x2c')]);_0x71ed39[_0xa94b('0x33')]=_[_0xa94b('0x2d')](_0x71ed39[_0xa94b('0x2a')],_0x71ed39[_0xa94b('0x2c')]);_0x2b0ab6[_0xa94b('0x2f')]=_['intersection'](_0x71ed39[_0xa94b('0x2a')],qs[_0xa94b('0x2e')](_0xd3b31e[_0xa94b('0x2c')][_0xa94b('0x2e')]));_0x2b0ab6[_0xa94b('0x2f')]=_0x2b0ab6['attributes'][_0xa94b('0x3f')]?_0x2b0ab6['attributes']:_0x71ed39[_0xa94b('0x2a')];if(_0xd3b31e['query'][_0xa94b('0x39')]){_0x2b0ab6[_0xa94b('0x3a')]=[{'all':!![]}];}_0x2b0ab6=_[_0xa94b('0x36')]({},_0x2b0ab6,_0xd3b31e['options']);return db['FaxApplication'][_0xa94b('0x40')](_0x2b0ab6)[_0xa94b('0x1f')](handleEntityNotFound(_0x3e8912,null))[_0xa94b('0x1f')](respondWithResult(_0x3e8912,null))[_0xa94b('0x3d')](handleError(_0x3e8912,null));};exports['create']=function(_0x3dc000,_0x4814db){return db[_0xa94b('0x27')]['create'](_0x3dc000[_0xa94b('0x41')],{})[_0xa94b('0x1f')](respondWithResult(_0x4814db,0xc9))[_0xa94b('0x3d')](handleError(_0x4814db,null));};exports[_0xa94b('0x42')]=function(_0x5724b4,_0x6da8d8){if(_0x5724b4[_0xa94b('0x41')]['id']){delete _0x5724b4[_0xa94b('0x41')]['id'];}return db[_0xa94b('0x27')][_0xa94b('0x40')]({'where':{'id':_0x5724b4['params']['id']}})[_0xa94b('0x1f')](handleEntityNotFound(_0x6da8d8,null))[_0xa94b('0x1f')](saveUpdates(_0x5724b4[_0xa94b('0x41')],null))['then'](respondWithResult(_0x6da8d8,null))[_0xa94b('0x3d')](handleError(_0x6da8d8,null));};exports[_0xa94b('0x20')]=function(_0x235830,_0x10fccd){return db[_0xa94b('0x27')][_0xa94b('0x40')]({'where':{'id':_0x235830[_0xa94b('0x43')]['id']}})[_0xa94b('0x1f')](handleEntityNotFound(_0x10fccd,null))[_0xa94b('0x1f')](removeEntity(_0x10fccd,null))['catch'](handleError(_0x10fccd,null));}; \ No newline at end of file +var _0x221c=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','rows','show','params','keys','includeAll','include','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../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','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x221c,0xfb));var _0xc221=function(_0x58d82e,_0x4f22e6){_0x58d82e=_0x58d82e-0x0;var _0x46526e=_0x221c[_0x58d82e];return _0x46526e;};'use strict';var emlformat=require(_0xc221('0x0'));var rimraf=require(_0xc221('0x1'));var zipdir=require(_0xc221('0x2'));var jsonpatch=require(_0xc221('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc221('0x4'));var util=require('util');var path=require(_0xc221('0x5'));var sox=require(_0xc221('0x6'));var csv=require('to-csv');var ejs=require(_0xc221('0x7'));var fs=require('fs');var fs_extra=require(_0xc221('0x8'));var _=require(_0xc221('0x9'));var squel=require(_0xc221('0xa'));var crypto=require(_0xc221('0xb'));var jsforce=require(_0xc221('0xc'));var deskjs=require(_0xc221('0xd'));var toCsv=require(_0xc221('0xe'));var querystring=require('querystring');var Papa=require(_0xc221('0xf'));var Redis=require(_0xc221('0x10'));var authService=require(_0xc221('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc221('0x12'));var hardwareService=require(_0xc221('0x13'));var logger=require(_0xc221('0x14'))(_0xc221('0x15'));var utils=require(_0xc221('0x16'));var config=require(_0xc221('0x17'));var licenseUtil=require(_0xc221('0x18'));var db=require(_0xc221('0x19'))['db'];function respondWithStatusCode(_0x876900,_0x4bea58){_0x4bea58=_0x4bea58||0xcc;return function(_0xedd316){if(_0xedd316){return _0x876900[_0xc221('0x1a')](_0x4bea58);}return _0x876900[_0xc221('0x1b')](_0x4bea58)['end']();};}function respondWithResult(_0x912629,_0x19aa70){_0x19aa70=_0x19aa70||0xc8;return function(_0x37750c){if(_0x37750c){return _0x912629[_0xc221('0x1b')](_0x19aa70)[_0xc221('0x1c')](_0x37750c);}};}function respondWithFilteredResult(_0x20668f,_0x2a8bc2){return function(_0x3cf37e){if(_0x3cf37e){var _0x28dbc6=typeof _0x2a8bc2['offset']===_0xc221('0x1d')&&typeof _0x2a8bc2[_0xc221('0x1e')]===_0xc221('0x1d');var _0x5e49fd=_0x3cf37e[_0xc221('0x1f')];var _0x490fe2=_0x28dbc6?0x0:_0x2a8bc2[_0xc221('0x20')];var _0x29c2fe=_0x28dbc6?_0x3cf37e[_0xc221('0x1f')]:_0x2a8bc2[_0xc221('0x20')]+_0x2a8bc2['limit'];var _0x408242;if(_0x29c2fe>=_0x5e49fd){_0x29c2fe=_0x5e49fd;_0x408242=0xc8;}else{_0x408242=0xce;}_0x20668f[_0xc221('0x1b')](_0x408242);return _0x20668f[_0xc221('0x21')](_0xc221('0x22'),_0x490fe2+'-'+_0x29c2fe+'/'+_0x5e49fd)[_0xc221('0x1c')](_0x3cf37e);}return null;};}function patchUpdates(_0x21838e){return function(_0x1aeb21){try{jsonpatch[_0xc221('0x23')](_0x1aeb21,_0x21838e,!![]);}catch(_0x238070){return BPromise['reject'](_0x238070);}return _0x1aeb21[_0xc221('0x24')]();};}function saveUpdates(_0x20e04a,_0x633f4b){return function(_0x2f1f96){if(_0x2f1f96){return _0x2f1f96[_0xc221('0x25')](_0x20e04a)[_0xc221('0x26')](function(_0x43c656){return _0x43c656;});}return null;};}function removeEntity(_0x253ac7,_0x4c42b9){return function(_0x57c52e){if(_0x57c52e){return _0x57c52e[_0xc221('0x27')]()[_0xc221('0x26')](function(){_0x253ac7[_0xc221('0x1b')](0xcc)[_0xc221('0x28')]();});}};}function handleEntityNotFound(_0x277181,_0x12f682){return function(_0x86234){if(!_0x86234){_0x277181['sendStatus'](0x194);}return _0x86234;};}function handleError(_0x1dae87,_0x200b1a){_0x200b1a=_0x200b1a||0x1f4;return function(_0x5b061b){logger[_0xc221('0x29')](_0x5b061b[_0xc221('0x2a')]);if(_0x5b061b[_0xc221('0x2b')]){delete _0x5b061b[_0xc221('0x2b')];}_0x1dae87[_0xc221('0x1b')](_0x200b1a)[_0xc221('0x2c')](_0x5b061b);};}exports[_0xc221('0x2d')]=function(_0x539e79,_0x4d3afe){var _0x41b0b2={},_0x3331af={},_0x67f28b={'count':0x0,'rows':[]};var _0x55d081=_[_0xc221('0x2e')](db[_0xc221('0x2f')][_0xc221('0x30')],function(_0x1d03b8){return{'name':_0x1d03b8[_0xc221('0x31')],'type':_0x1d03b8[_0xc221('0x32')][_0xc221('0x33')]};});_0x3331af[_0xc221('0x34')]=_[_0xc221('0x2e')](_0x55d081,_0xc221('0x2b'));_0x3331af[_0xc221('0x35')]=_['keys'](_0x539e79[_0xc221('0x35')]);_0x3331af[_0xc221('0x36')]=_[_0xc221('0x37')](_0x3331af[_0xc221('0x34')],_0x3331af[_0xc221('0x35')]);_0x41b0b2[_0xc221('0x38')]=_[_0xc221('0x37')](_0x3331af[_0xc221('0x34')],qs[_0xc221('0x39')](_0x539e79[_0xc221('0x35')][_0xc221('0x39')]));_0x41b0b2[_0xc221('0x38')]=_0x41b0b2['attributes'][_0xc221('0x3a')]?_0x41b0b2[_0xc221('0x38')]:_0x3331af[_0xc221('0x34')];if(!_0x539e79[_0xc221('0x35')][_0xc221('0x3b')](_0xc221('0x3c'))){_0x41b0b2[_0xc221('0x1e')]=qs[_0xc221('0x1e')](_0x539e79[_0xc221('0x35')][_0xc221('0x1e')]);_0x41b0b2[_0xc221('0x20')]=qs['offset'](_0x539e79['query'][_0xc221('0x20')]);}_0x41b0b2['order']=qs[_0xc221('0x3d')](_0x539e79[_0xc221('0x35')][_0xc221('0x3d')]);_0x41b0b2[_0xc221('0x3e')]=qs['filters'](_[_0xc221('0x3f')](_0x539e79[_0xc221('0x35')],_0x3331af['filters']),_0x55d081);if(_0x539e79[_0xc221('0x35')][_0xc221('0x40')]){_0x41b0b2[_0xc221('0x3e')]=_[_0xc221('0x41')](_0x41b0b2['where'],{'$or':_[_0xc221('0x2e')](_0x55d081,function(_0x4191f0){if(_0x4191f0[_0xc221('0x32')]!=='VIRTUAL'){var _0x2c34b6={};_0x2c34b6[_0x4191f0[_0xc221('0x2b')]]={'$like':'%'+_0x539e79[_0xc221('0x35')][_0xc221('0x40')]+'%'};return _0x2c34b6;}})});}_0x41b0b2=_['merge']({},_0x41b0b2,_0x539e79['options']);var _0x340c9b={'where':_0x41b0b2[_0xc221('0x3e')]};return db[_0xc221('0x2f')]['count'](_0x340c9b)[_0xc221('0x26')](function(_0xecc977){_0x67f28b[_0xc221('0x1f')]=_0xecc977;if(_0x539e79[_0xc221('0x35')]['includeAll']){_0x41b0b2['include']=[{'all':!![]}];}return db[_0xc221('0x2f')]['findAll'](_0x41b0b2);})[_0xc221('0x26')](function(_0x2913e9){_0x67f28b[_0xc221('0x42')]=_0x2913e9;return _0x67f28b;})[_0xc221('0x26')](respondWithFilteredResult(_0x4d3afe,_0x41b0b2))['catch'](handleError(_0x4d3afe,null));};exports[_0xc221('0x43')]=function(_0xc6e59,_0x348283){var _0x290312={'raw':!![],'where':{'id':_0xc6e59[_0xc221('0x44')]['id']}},_0x473c08={};_0x473c08[_0xc221('0x34')]=_[_0xc221('0x45')](db[_0xc221('0x2f')][_0xc221('0x30')]);_0x473c08[_0xc221('0x35')]=_[_0xc221('0x45')](_0xc6e59[_0xc221('0x35')]);_0x473c08['filters']=_[_0xc221('0x37')](_0x473c08['model'],_0x473c08[_0xc221('0x35')]);_0x290312['attributes']=_[_0xc221('0x37')](_0x473c08[_0xc221('0x34')],qs[_0xc221('0x39')](_0xc6e59[_0xc221('0x35')][_0xc221('0x39')]));_0x290312[_0xc221('0x38')]=_0x290312[_0xc221('0x38')][_0xc221('0x3a')]?_0x290312[_0xc221('0x38')]:_0x473c08['model'];if(_0xc6e59['query'][_0xc221('0x46')]){_0x290312[_0xc221('0x47')]=[{'all':!![]}];}_0x290312=_[_0xc221('0x41')]({},_0x290312,_0xc6e59[_0xc221('0x48')]);return db[_0xc221('0x2f')][_0xc221('0x49')](_0x290312)[_0xc221('0x26')](handleEntityNotFound(_0x348283,null))[_0xc221('0x26')](respondWithResult(_0x348283,null))['catch'](handleError(_0x348283,null));};exports['create']=function(_0x3f43b3,_0x35cf1c){return db[_0xc221('0x2f')]['create'](_0x3f43b3[_0xc221('0x4a')],{})['then'](respondWithResult(_0x35cf1c,0xc9))[_0xc221('0x4b')](handleError(_0x35cf1c,null));};exports[_0xc221('0x25')]=function(_0x7bf6b3,_0x521120){if(_0x7bf6b3[_0xc221('0x4a')]['id']){delete _0x7bf6b3[_0xc221('0x4a')]['id'];}return db['FaxApplication'][_0xc221('0x49')]({'where':{'id':_0x7bf6b3[_0xc221('0x44')]['id']}})['then'](handleEntityNotFound(_0x521120,null))[_0xc221('0x26')](saveUpdates(_0x7bf6b3[_0xc221('0x4a')],null))[_0xc221('0x26')](respondWithResult(_0x521120,null))[_0xc221('0x4b')](handleError(_0x521120,null));};exports[_0xc221('0x27')]=function(_0x155c20,_0x433830){return db[_0xc221('0x2f')][_0xc221('0x49')]({'where':{'id':_0x155c20[_0xc221('0x44')]['id']}})[_0xc221('0x26')](handleEntityNotFound(_0x433830,null))[_0xc221('0x26')](removeEntity(_0x433830,null))[_0xc221('0x4b')](handleError(_0x433830,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4fe7f65..bdaf0a6 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 _0xcd82=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5c0e6b,_0x218652){var _0x495ca1=function(_0x4a6f0a){while(--_0x4a6f0a){_0x5c0e6b['push'](_0x5c0e6b['shift']());}};_0x495ca1(++_0x218652);}(_0xcd82,0x135));var _0x2cd8=function(_0x9033b4,_0x5e5af6){_0x9033b4=_0x9033b4-0x0;var _0x32d7bc=_0xcd82[_0x9033b4];return _0x32d7bc;};'use strict';var _=require(_0x2cd8('0x0'));var util=require(_0x2cd8('0x1'));var logger=require(_0x2cd8('0x2'))(_0x2cd8('0x3'));var moment=require('moment');var BPromise=require(_0x2cd8('0x4'));var rp=require(_0x2cd8('0x5'));var fs=require('fs');var path=require(_0x2cd8('0x6'));var rimraf=require(_0x2cd8('0x7'));var config=require(_0x2cd8('0x8'));var attributes=require(_0x2cd8('0x9'));module[_0x2cd8('0xa')]=function(_0x9b2d37,_0x4c871f){return _0x9b2d37[_0x2cd8('0xb')]('FaxApplication',attributes,{'tableName':_0x2cd8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cd8('0xd'),'collate':_0x2cd8('0xe')});}; \ No newline at end of file +var _0x00cf=['request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x00cf,0x134));var _0xf00c=function(_0x40e260,_0x3adb95){_0x40e260=_0x40e260-0x0;var _0x32e15c=_0x00cf[_0x40e260];return _0x32e15c;};'use strict';var _=require(_0xf00c('0x0'));var util=require(_0xf00c('0x1'));var logger=require('../../config/logger')(_0xf00c('0x2'));var moment=require(_0xf00c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf00c('0x4'));var fs=require('fs');var path=require(_0xf00c('0x5'));var rimraf=require(_0xf00c('0x6'));var config=require('../../config/environment');var attributes=require(_0xf00c('0x7'));module[_0xf00c('0x8')]=function(_0x559637,_0x59bf13){return _0x559637[_0xf00c('0x9')](_0xf00c('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf00c('0xb'),'collate':_0xf00c('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 22d8ecd..2748acb 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 _0x785d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','then'];(function(_0x503c40,_0x1683a5){var _0x53e8bc=function(_0x156ca5){while(--_0x156ca5){_0x503c40['push'](_0x503c40['shift']());}};_0x53e8bc(++_0x1683a5);}(_0x785d,0x1b3));var _0xd785=function(_0x50387f,_0x34c620){_0x50387f=_0x50387f-0x0;var _0x363ba4=_0x785d[_0x50387f];return _0x363ba4;};'use strict';var _=require(_0xd785('0x0'));var util=require(_0xd785('0x1'));var moment=require(_0xd785('0x2'));var BPromise=require(_0xd785('0x3'));var rs=require(_0xd785('0x4'));var fs=require('fs');var Redis=require(_0xd785('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd785('0x6'));var logger=require(_0xd785('0x7'))('rpc');var config=require(_0xd785('0x8'));var jayson=require(_0xd785('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x290679,_0x50599c,_0x579ff3){return new BPromise(function(_0x2158ec,_0x3e0196){return client[_0xd785('0xa')](_0x290679,_0x579ff3)['then'](function(_0x2af301){logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,_0xd785('0xd'));logger[_0xd785('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x50599c,_0xd785('0xd'),JSON[_0xd785('0xf')](_0x2af301));if(_0x2af301['error']){if(_0x2af301['error'][_0xd785('0x10')]===0x1f4){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x2af301[_0xd785('0x11')]['message']);return _0x3e0196(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}logger[_0xd785('0x11')]('FaxApplication,\x20%s,\x20%s',_0x50599c,_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);return _0x2158ec(_0x2af301[_0xd785('0x11')][_0xd785('0x12')]);}else{logger[_0xd785('0xb')](_0xd785('0xc'),_0x50599c,'request\x20sent');_0x2158ec(_0x2af301[_0xd785('0x13')][_0xd785('0x12')]);}})[_0xd785('0x14')](function(_0x467c1e){logger[_0xd785('0x11')](_0xd785('0xc'),_0x50599c,_0x467c1e);_0x3e0196(_0x467c1e);});});}exports[_0xd785('0x15')]=function(_0x29d72d){var _0x3c974c=this;return new Promise(function(_0x2d4079,_0x54aab3){return db[_0xd785('0x16')]['update'](_0x29d72d['body'],{'raw':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d72d['options']?_0x29d72d[_0xd785('0x17')][_0xd785('0x19')]||null:null,'attributes':_0x29d72d[_0xd785('0x17')]?_0x29d72d[_0xd785('0x17')][_0xd785('0x1a')]||null:null,'limit':_0x29d72d['options']?_0x29d72d[_0xd785('0x17')][_0xd785('0x1b')]||null:null})[_0xd785('0x1c')](function(_0x1a32d0){logger[_0xd785('0xb')](_0xd785('0x15'),_0x29d72d);logger[_0xd785('0xe')](_0xd785('0x15'),_0x29d72d,JSON['stringify'](_0x1a32d0));_0x2d4079(_0x1a32d0);})['catch'](function(_0x2c7f6d){logger[_0xd785('0x11')](_0xd785('0x15'),_0x2c7f6d[_0xd785('0x12')],_0x29d72d);_0x54aab3(_0x3c974c[_0xd785('0x11')](0x1f4,_0x2c7f6d[_0xd785('0x12')]));});});}; \ No newline at end of file +var _0x846e=['UpdateFaxApplication','update','body','options','where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x5b6d79,_0x1dff75){var _0x393a6e=function(_0x9baa98){while(--_0x9baa98){_0x5b6d79['push'](_0x5b6d79['shift']());}};_0x393a6e(++_0x1dff75);}(_0x846e,0x1a7));var _0xe846=function(_0xf36116,_0xa41e84){_0xf36116=_0xf36116-0x0;var _0x17179d=_0x846e[_0xf36116];return _0x17179d;};'use strict';var _=require('lodash');var util=require(_0xe846('0x0'));var moment=require('moment');var BPromise=require(_0xe846('0x1'));var rs=require(_0xe846('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe846('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe846('0x4'))('rpc');var config=require(_0xe846('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe846('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33072f,_0x36976d,_0x104374){return new BPromise(function(_0xfa8c7f,_0x319e94){return client[_0xe846('0x7')](_0x33072f,_0x104374)[_0xe846('0x8')](function(_0xa5b0b0){logger[_0xe846('0x9')]('FaxApplication,\x20%s,\x20%s',_0x36976d,_0xe846('0xa'));logger[_0xe846('0xb')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x36976d,'request\x20sent',JSON[_0xe846('0xc')](_0xa5b0b0));if(_0xa5b0b0[_0xe846('0xd')]){if(_0xa5b0b0[_0xe846('0xd')][_0xe846('0xe')]===0x1f4){logger['error'](_0xe846('0xf'),_0x36976d,_0xa5b0b0['error'][_0xe846('0x10')]);return _0x319e94(_0xa5b0b0[_0xe846('0xd')][_0xe846('0x10')]);}logger['error'](_0xe846('0xf'),_0x36976d,_0xa5b0b0[_0xe846('0xd')]['message']);return _0xfa8c7f(_0xa5b0b0[_0xe846('0xd')][_0xe846('0x10')]);}else{logger['info'](_0xe846('0xf'),_0x36976d,_0xe846('0xa'));_0xfa8c7f(_0xa5b0b0[_0xe846('0x11')][_0xe846('0x10')]);}})[_0xe846('0x12')](function(_0x40deae){logger['error'](_0xe846('0xf'),_0x36976d,_0x40deae);_0x319e94(_0x40deae);});});}exports[_0xe846('0x13')]=function(_0x53526b){var _0x2bf298=this;return new Promise(function(_0x4254c7,_0x3ccda3){return db['FaxApplication'][_0xe846('0x14')](_0x53526b[_0xe846('0x15')],{'raw':_0x53526b[_0xe846('0x16')]?_0x53526b[_0xe846('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53526b[_0xe846('0x16')]?_0x53526b[_0xe846('0x16')][_0xe846('0x17')]||null:null,'attributes':_0x53526b[_0xe846('0x16')]?_0x53526b[_0xe846('0x16')][_0xe846('0x18')]||null:null,'limit':_0x53526b[_0xe846('0x16')]?_0x53526b['options'][_0xe846('0x19')]||null:null})[_0xe846('0x8')](function(_0xf4f6f8){logger[_0xe846('0x9')](_0xe846('0x13'),_0x53526b);logger[_0xe846('0xb')]('UpdateFaxApplication',_0x53526b,JSON[_0xe846('0xc')](_0xf4f6f8));_0x4254c7(_0xf4f6f8);})[_0xe846('0x12')](function(_0x24557d){logger[_0xe846('0xd')](_0xe846('0x13'),_0x24557d[_0xe846('0x10')],_0x53526b);_0x3ccda3(_0x2bf298['error'](0x1f4,_0x24557d[_0xe846('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fc4df4c..52602d5 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 _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1109d5,_0x2da38f){_0x1109d5=_0x1109d5-0x0;var _0x58b0a8=_0xd7d1[_0x1109d5];return _0x58b0a8;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file +var _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x5811ea,_0x5ea11a){var _0x428d37=function(_0x43241f){while(--_0x43241f){_0x5811ea['push'](_0x5811ea['shift']());}};_0x428d37(++_0x5ea11a);}(_0x6324,0x142));var _0x4632=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x6324[_0x1a8bbc];return _0x212fc2;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('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 b174b6e..4404fc5 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 _0xec03=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3e85cd,_0x31466f){var _0x1cd092=function(_0x1f4409){while(--_0x1f4409){_0x3e85cd['push'](_0x3e85cd['shift']());}};_0x1cd092(++_0x31466f);}(_0xec03,0x7e));var _0x3ec0=function(_0x60eac7,_0xc05d7e){_0x60eac7=_0x60eac7-0x0;var _0xca5f1d=_0xec03[_0x60eac7];return _0xca5f1d;};'use strict';var Sequelize=require(_0x3ec0('0x0'));module[_0x3ec0('0x1')]={'closed':{'type':Sequelize[_0x3ec0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3ec0('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3ec0('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3ec0('0x3')]},'fax':{'type':Sequelize[_0x3ec0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3ec0('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3ec0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3ec0('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe773=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x5e6980,_0x40ceb2){var _0x15b138=function(_0x59ee93){while(--_0x59ee93){_0x5e6980['push'](_0x5e6980['shift']());}};_0x15b138(++_0x40ceb2);}(_0xe773,0x1ad));var _0x3e77=function(_0x2d5a47,_0x2af1df){_0x2d5a47=_0x2d5a47-0x0;var _0x5990b1=_0xe773[_0x2d5a47];return _0x5990b1;};'use strict';var Sequelize=require(_0x3e77('0x0'));module[_0x3e77('0x1')]={'closed':{'type':Sequelize[_0x3e77('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3e77('0x3')]},'disposition':{'type':Sequelize[_0x3e77('0x4')]},'secondDisposition':{'type':Sequelize[_0x3e77('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3e77('0x3')]},'fax':{'type':Sequelize[_0x3e77('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3e77('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3e77('0x5')]('in',_0x3e77('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 31d51c7..db35a94 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 _0x1e58=['Contact','operator','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','keys','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','resolve','FaxAccountId','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','params','FaxInteraction','include','merge','create','body','describe','addMessage','omit','getMessages','FaxMessage','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','ids','spread','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','closed','UserId','waiting','answered','total','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','from','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200'];(function(_0x3e18bf,_0x387f5e){var _0x1022e5=function(_0x242ec4){while(--_0x242ec4){_0x3e18bf['push'](_0x3e18bf['shift']());}};_0x1022e5(++_0x387f5e);}(_0x1e58,0x74));var _0x81e5=function(_0x1f26bb,_0x5ca46c){_0x1f26bb=_0x1f26bb-0x0;var _0x466c79=_0x1e58[_0x1f26bb];return _0x466c79;};'use strict';var emlformat=require(_0x81e5('0x0'));var rimraf=require(_0x81e5('0x1'));var zipdir=require(_0x81e5('0x2'));var jsonpatch=require(_0x81e5('0x3'));var rp=require(_0x81e5('0x4'));var moment=require(_0x81e5('0x5'));var BPromise=require(_0x81e5('0x6'));var Mustache=require(_0x81e5('0x7'));var util=require(_0x81e5('0x8'));var path=require('path');var sox=require(_0x81e5('0x9'));var csv=require(_0x81e5('0xa'));var ejs=require(_0x81e5('0xb'));var fs=require('fs');var fs_extra=require(_0x81e5('0xc'));var _=require(_0x81e5('0xd'));var squel=require('squel');var crypto=require(_0x81e5('0xe'));var jsforce=require(_0x81e5('0xf'));var deskjs=require(_0x81e5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x81e5('0x11'));var Papa=require(_0x81e5('0x12'));var Redis=require(_0x81e5('0x13'));var authService=require(_0x81e5('0x14'));var qs=require(_0x81e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81e5('0x16'));var logger=require(_0x81e5('0x17'))(_0x81e5('0x18'));var utils=require(_0x81e5('0x19'));var config=require(_0x81e5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x81e5('0x1b'))['db'];config[_0x81e5('0x1c')]=_[_0x81e5('0x1d')](config[_0x81e5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x81e5('0x1e'))(new Redis(config[_0x81e5('0x1c')]));require(_0x81e5('0x1f'))[_0x81e5('0x20')](socket);function respondWithStatusCode(_0x5ee13b,_0x30b9ba){_0x30b9ba=_0x30b9ba||0xcc;return function(_0x34a1e0){if(_0x34a1e0){return _0x5ee13b[_0x81e5('0x21')](_0x30b9ba);}return _0x5ee13b[_0x81e5('0x22')](_0x30b9ba)[_0x81e5('0x23')]();};}function respondWithResult(_0x512418,_0x5252f4){_0x5252f4=_0x5252f4||0xc8;return function(_0x37fead){if(_0x37fead){return _0x512418['status'](_0x5252f4)[_0x81e5('0x24')](_0x37fead);}};}function respondWithFilteredResult(_0x4431db,_0x4ccfb2){return function(_0x4b8c9d){if(_0x4b8c9d){var _0xfa41b4=typeof _0x4ccfb2[_0x81e5('0x25')]===_0x81e5('0x26')&&typeof _0x4ccfb2[_0x81e5('0x27')]==='undefined';var _0x3dc82f=_0x4b8c9d[_0x81e5('0x28')];var _0x30047a=_0xfa41b4?0x0:_0x4ccfb2[_0x81e5('0x25')];var _0x54d6f4=_0xfa41b4?_0x4b8c9d['count']:_0x4ccfb2[_0x81e5('0x25')]+_0x4ccfb2[_0x81e5('0x27')];var _0x516640;if(_0x54d6f4>=_0x3dc82f){_0x54d6f4=_0x3dc82f;_0x516640=0xc8;}else{_0x516640=0xce;}_0x4431db[_0x81e5('0x22')](_0x516640);return _0x4431db[_0x81e5('0x29')](_0x81e5('0x2a'),_0x30047a+'-'+_0x54d6f4+'/'+_0x3dc82f)[_0x81e5('0x24')](_0x4b8c9d);}return null;};}function patchUpdates(_0x13d676){return function(_0x5b537c){try{jsonpatch[_0x81e5('0x2b')](_0x5b537c,_0x13d676,!![]);}catch(_0x57ba51){return BPromise[_0x81e5('0x2c')](_0x57ba51);}return _0x5b537c['save']();};}function saveUpdates(_0x531214,_0x6245a1){return function(_0x3a34a2){if(_0x3a34a2){return _0x3a34a2[_0x81e5('0x2d')](_0x531214)[_0x81e5('0x2e')](function(_0x36fc4e){return _0x36fc4e;});}return null;};}function removeEntity(_0x1a8d63,_0x1fa988){return function(_0x1efeb9){if(_0x1efeb9){return _0x1efeb9[_0x81e5('0x2f')]()[_0x81e5('0x2e')](function(){_0x1a8d63['status'](0xcc)[_0x81e5('0x23')]();});}};}function handleEntityNotFound(_0x57fa41,_0x1a4829){return function(_0x365dfc){if(!_0x365dfc){_0x57fa41[_0x81e5('0x21')](0x194);}return _0x365dfc;};}function handleError(_0x16bc08,_0x4ff5a8){_0x4ff5a8=_0x4ff5a8||0x1f4;return function(_0x2b3909){logger['error'](_0x2b3909[_0x81e5('0x30')]);if(_0x2b3909[_0x81e5('0x31')]){delete _0x2b3909['name'];}_0x16bc08[_0x81e5('0x22')](_0x4ff5a8)[_0x81e5('0x32')](_0x2b3909);};}function getInteractionUsers(_0x30b361,_0x27d7eb){return new BPromise(function(_0x7157be,_0x54e040){try{if(_0x27d7eb[_0x30b361['id']]){_0x30b361[_0x81e5('0x33')]=_[_0x81e5('0x34')](_0x27d7eb[_0x30b361['id']],function(_0x4bc5da){return{'id':_0x4bc5da['id'],'fullname':_0x4bc5da['fullname']};});}}catch(_0x75bcf1){_0x54e040(_0x75bcf1);}_0x7157be(_0x30b361);});}function getInteractionTags(_0x4214cd,_0x2f5d0e){return new BPromise(function(_0x21eaeb,_0x534523){try{if(_0x4214cd[_0x81e5('0x35')]){_0x4214cd[_0x81e5('0x36')]=[];_0x4214cd[_0x81e5('0x35')][_0x81e5('0x37')](',')[_0x81e5('0x38')](function(_0xe133f7){_0x4214cd[_0x81e5('0x36')][_0x81e5('0x39')](_0x2f5d0e[_0xe133f7]);});}delete _0x4214cd[_0x81e5('0x35')];}catch(_0x504a96){_0x534523(_0x504a96);}_0x21eaeb(_0x4214cd);});}function updateFaxInteraction(_0x65282d,_0x58e6e0,_0x1009d2){return new BPromise(function(_0x191def,_0x57f9ad){return getInteractionUsers(_0x65282d,_0x1009d2)[_0x81e5('0x2e')](function(_0xd454fb){return getInteractionTags(_0xd454fb,_0x58e6e0);})[_0x81e5('0x2e')](function(_0x3d6920){return getStateInteraction(_0x3d6920);})[_0x81e5('0x2e')](function(_0x2745b){_0x191def(_0x2745b);})[_0x81e5('0x3a')](function(_0x315150){_0x57f9ad(_0x315150);});});}function getStateInteraction(_0x17bc45){return new BPromise(function(_0xb0bfe3){_0x17bc45['waiting']=0x0;_0x17bc45[_0x81e5('0x3b')]=0x0;_0x17bc45['answered']=0x0;_0x17bc45[_0x81e5('0x3c')]=0x0;_0x17bc45['total']=0x0;if(!_0x17bc45[_0x81e5('0x3d')]&&!_0x17bc45[_0x81e5('0x3e')]){_0x17bc45['waiting']+=0x1;}if(!_0x17bc45[_0x81e5('0x3d')]&&_0x17bc45['UserId']){_0x17bc45['talking']+=0x1;if(_0x17bc45[_0x81e5('0x3f')]){_0x17bc45['waiting']-=0x1;}}if(_0x17bc45[_0x81e5('0x3d')]&&_0x17bc45[_0x81e5('0x3e')]){_0x17bc45[_0x81e5('0x40')]+=0x1;if(_0x17bc45[_0x81e5('0x3b')]){_0x17bc45[_0x81e5('0x3b')]-=0x1;}}if(_0x17bc45[_0x81e5('0x3d')]&&!_0x17bc45[_0x81e5('0x3e')]){_0x17bc45[_0x81e5('0x3c')]+=0x1;if(_0x17bc45[_0x81e5('0x3f')]){_0x17bc45[_0x81e5('0x3f')]-=0x1;}}_0x17bc45[_0x81e5('0x41')]+=0x1;_0xb0bfe3(_0x17bc45);});}exports['index']=function(_0x1c356f,_0x5c34e5){var _0x53289e={},_0x252fae={},_0x60bf3={'count':0x0,'rows':[]};var _0x1b4ee4=_[_0x81e5('0x34')](db['FaxInteraction'][_0x81e5('0x42')],function(_0x1ff22a){return{'name':_0x1ff22a['fieldName'],'type':_0x1ff22a[_0x81e5('0x43')][_0x81e5('0x44')]};});_0x252fae[_0x81e5('0x45')]=_['map'](_0x1b4ee4,_0x81e5('0x31'));_0x252fae[_0x81e5('0x46')]=_['keys'](_0x1c356f[_0x81e5('0x46')]);_0x252fae['filters']=_[_0x81e5('0x47')](_0x252fae[_0x81e5('0x45')],_0x252fae['query']);_0x53289e[_0x81e5('0x48')]=_[_0x81e5('0x47')](_0x252fae[_0x81e5('0x45')],qs[_0x81e5('0x49')](_0x1c356f[_0x81e5('0x46')][_0x81e5('0x49')]));_0x53289e['attributes']=_0x53289e[_0x81e5('0x48')][_0x81e5('0x4a')]?_0x53289e['attributes']:_0x252fae['model'];if(!_0x1c356f[_0x81e5('0x46')][_0x81e5('0x4b')]('nolimit')){_0x53289e[_0x81e5('0x27')]=qs[_0x81e5('0x27')](_0x1c356f[_0x81e5('0x46')][_0x81e5('0x27')]);_0x53289e[_0x81e5('0x25')]=qs[_0x81e5('0x25')](_0x1c356f['query'][_0x81e5('0x25')]);}_0x53289e[_0x81e5('0x4c')]=qs[_0x81e5('0x4d')](_0x1c356f[_0x81e5('0x46')]['sort']);_0x53289e[_0x81e5('0x4e')]=qs[_0x81e5('0x4f')](_['pick'](_0x1c356f[_0x81e5('0x46')],_0x252fae[_0x81e5('0x4f')]),_0x1b4ee4);var _0x58ebba=[];var _0x2ce783=squel[_0x81e5('0x50')]()[_0x81e5('0x51')]('id')[_0x81e5('0x51')](_0x81e5('0x31'))[_0x81e5('0x51')](_0x81e5('0x52'))['from'](_0x81e5('0x53'));var _0x5d4115=squel[_0x81e5('0x50')]()['field'](_0x81e5('0x54'))[_0x81e5('0x51')](_0x81e5('0x55'))[_0x81e5('0x51')](_0x81e5('0x56'))['from']('user_has_fax_interactions','ui')['left_join'](_0x81e5('0x57'),'u',_0x81e5('0x58'));var _0x22a19c=squel['select']()[_0x81e5('0x59')](_0x81e5('0x5a'),'i')[_0x81e5('0x5b')](_0x81e5('0x5c'),'c',_0x81e5('0x5d'))[_0x81e5('0x5b')](_0x81e5('0x57'),'o',_0x81e5('0x5e'))[_0x81e5('0x5b')](_0x81e5('0x5f'),'a',_0x81e5('0x60'))[_0x81e5('0x5b')](_0x81e5('0x61'),'me',_0x81e5('0x62'))[_0x81e5('0x5b')](_0x81e5('0x63'),'it',_0x81e5('0x64'))[_0x81e5('0x5b')](_0x81e5('0x53'),'t',_0x81e5('0x65'));var _0x165ea2=squel[_0x81e5('0x66')]();var _0x131727=[];var _0x1f7ed1=squel['expr']();var _0x5b1254;if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x67')]){_0x5b1254=as['parseSearch'](_0x1c356f[_0x81e5('0x46')]['search']);var _0x1e2ae0=_0x5b1254['sqlOperator'];for(var _0x58246e=0x0;_0x58246e<_0x5b1254[_0x81e5('0x68')][_0x81e5('0x4a')];_0x58246e++){var _0x4ee5cb=_0x5b1254[_0x81e5('0x68')][_0x58246e];var _0x2962a4='i';var _0x493efa=_[_0x81e5('0x69')](_0x1b4ee4,[_0x81e5('0x31'),_0x4ee5cb[_0x81e5('0x51')]]);if(!_0x493efa){switch(_0x4ee5cb[_0x81e5('0x51')]){case _0x81e5('0x6a'):if(_0x4ee5cb['value']==0x1){_0x22a19c[_0x81e5('0x6b')]('`'+_0x4ee5cb[_0x81e5('0x51')]+_0x81e5('0x6c'));}else{_0x22a19c[_0x81e5('0x6b')]('`'+_0x4ee5cb[_0x81e5('0x51')]+_0x81e5('0x6d'));}break;case _0x81e5('0x6e'):if(_0x4ee5cb[_0x81e5('0x6f')]==='$substring'){if(_0x4ee5cb[_0x81e5('0x70')][_0x81e5('0x37')]('\x20')['length']>0x1){_0x165ea2[_0x1e2ae0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x81e5('0x71')](_0x4ee5cb['value']),null);}else{var _0x5a3077='%'+_0x4ee5cb[_0x81e5('0x70')]+'%';_0x165ea2[_0x1e2ae0](_0x81e5('0x72'),_0x5a3077,_0x5a3077,_0x5a3077);}}else{_0x493efa=_[_0x81e5('0x69')](_0x1b4ee4,[_0x81e5('0x31'),_0x81e5('0x73')]);_0x4ee5cb[_0x81e5('0x51')]=_0x81e5('0x73');_0x4b4c3b=as[_0x81e5('0x74')](_0x2962a4,_0x493efa['type'],_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b[_0x81e5('0x75')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x76')],_0x4b4c3b[_0x81e5('0x70')]['end']);}break;case _0x81e5('0x77'):var _0x331944=_0x4ee5cb[_0x81e5('0x70')][_0x81e5('0x37')](',')[_0x81e5('0x34')](function(_0x3c691e){return Number(_0x3c691e);});_0x331944['forEach'](function(_0x24b305){_0x1f7ed1['or'](_0x81e5('0x78'),'%,'+_0x24b305+',%');});_0x131727=_[_0x81e5('0x79')](_0x131727,_0x331944);break;case _0x81e5('0x7a'):if(_0x4ee5cb['operator']==='$substring'){_0x165ea2[_0x1e2ae0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4ee5cb[_0x81e5('0x70')]+'%',null);}else{_0x493efa=_['find'](_0x1b4ee4,[_0x81e5('0x31'),_0x81e5('0x3e')]);_0x4ee5cb[_0x81e5('0x51')]=_0x81e5('0x3e');_0x4b4c3b=as[_0x81e5('0x74')](_0x2962a4,_0x493efa[_0x81e5('0x43')],_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b[_0x81e5('0x75')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x76')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x23')]);}break;case'body':_0x4b4c3b=as[_0x81e5('0x74')]('me',null,_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b['text'],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x76')],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x23')]);break;}}else{var _0x4b4c3b=as['buildExpression'](_0x2962a4,_0x493efa[_0x81e5('0x43')],_0x4ee5cb);_0x165ea2[_0x1e2ae0](_0x4b4c3b[_0x81e5('0x75')],_0x4b4c3b['value']['start'],_0x4b4c3b[_0x81e5('0x70')][_0x81e5('0x23')]);}}}else{var _0x19768c=_(_0x1c356f[_0x81e5('0x46')])[_0x81e5('0x7b')]()[_0x81e5('0x34')](function(_0x2c6c3f){return _[_0x81e5('0x7c')](_0x1b4ee4,['name',_0x2c6c3f])?_0x2c6c3f:undefined;})[_0x81e5('0x7d')]()[_0x81e5('0x70')]();if(!_['isEmpty'](_0x19768c)){_0x19768c[_0x81e5('0x38')](function(_0x4809cb){if(_0x4809cb==='FaxAccountId'){_0x22a19c[_0x81e5('0x4e')](_0x81e5('0x7e'),[][_0x81e5('0x7f')](_0x1c356f[_0x81e5('0x46')][_0x4809cb]));}else if(_0x4809cb===_0x81e5('0x80')){var _0x5d88f3=JSON[_0x81e5('0x81')](_0x1c356f[_0x81e5('0x46')][_0x4809cb])[_0x81e5('0x82')];var _0x4c2e70=JSON[_0x81e5('0x81')](_0x1c356f['query'][_0x4809cb])['$lte'];_0x22a19c[_0x81e5('0x4e')](_0x81e5('0x83'),_0x5d88f3,_0x4c2e70);}else{if(_0x1c356f[_0x81e5('0x46')][_0x4809cb]===_0x81e5('0x84')){_0x22a19c['where']('i.'+_0x4809cb+_0x81e5('0x85'));}else{_0x22a19c[_0x81e5('0x4e')]('i.'+_0x4809cb+_0x81e5('0x86'),_0x1c356f['query'][_0x4809cb]);}}});}if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x87')]){if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x87')]==0x1){_0x22a19c['having'](_0x81e5('0x88'));}else{_0x22a19c['having'](_0x81e5('0x89'));}}if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x8a')]){_0x131727=_[_0x81e5('0x8b')](_0x1c356f[_0x81e5('0x46')][_0x81e5('0x8a')])?_0x1c356f[_0x81e5('0x46')]['tag']:new Array(_0x1c356f['query']['tag']);_0x131727[_0x81e5('0x38')](function(_0x5127d2){_0x1f7ed1['or'](_0x81e5('0x78'),'%,'+_0x5127d2+',%');});}if(_0x1c356f['query'][_0x81e5('0x8c')]){var _0x59168c=_0x1c356f[_0x81e5('0x46')][_0x81e5('0x8c')][_0x81e5('0x8d')]('\x5c','\x5c\x5c')[_0x81e5('0x8d')](/'/g,'\x27\x27');if(qs[_0x81e5('0x8e')](_0x59168c)){_0x165ea2['or']('i.id\x20LIKE\x20?',_0x59168c+'%')['or'](_0x81e5('0x8f'),_0x59168c+'%');}_0x165ea2['or'](_0x81e5('0x90'),_0x59168c+'%');}}_0x22a19c['where'](_0x165ea2);_0x22a19c[_0x81e5('0x91')](_0x81e5('0x92'));var _0x45c68e={'type':db[_0x81e5('0x93')][_0x81e5('0x94')][_0x81e5('0x95')],'raw':!![]};var _0x49244f=_0x22a19c['clone']();_0x49244f[_0x81e5('0x51')](_0x81e5('0x92'));_0x49244f[_0x81e5('0x51')](_0x81e5('0x96'),_0x81e5('0x6a'));if(_0x53289e[_0x81e5('0x4c')]){_0x53289e['order'][_0x81e5('0x38')](function(_0x2fe242){var _0x235118=_0x2fe242[0x0]==='contactName'?_0x2fe242[0x0]:'i.'+_0x2fe242[0x0];_0x22a19c['order'](_0x235118,_0x2fe242[0x1]==='DESC'?![]:!![]);});}if(!_[_0x81e5('0x97')](_0x131727)){_0x22a19c[_0x81e5('0x6b')](_0x1f7ed1);_0x49244f[_0x81e5('0x4e')](_0x81e5('0x98'),_0x131727);}BPromise[_0x81e5('0x99')]()[_0x81e5('0x2e')](function(){if(!_0x5b1254){if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x9a')])return;_0x49244f[_0x81e5('0x4e')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x22a19c['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1c356f[_0x81e5('0x9b')][_0x81e5('0x9c')]!=='agent')return;return _0x1c356f[_0x81e5('0x9b')][_0x81e5('0x9d')]({'attributes':['id'],'raw':!![]})[_0x81e5('0x2e')](function(_0x1dc997){if(_[_0x81e5('0x97')](_0x1dc997)){_0x49244f['where'](_0x81e5('0x9e'));_0x22a19c['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x49244f[_0x81e5('0x4e')]('i.FaxAccountId\x20IN\x20?',_[_0x81e5('0x34')](_0x1dc997,'id'));_0x22a19c[_0x81e5('0x4e')](_0x81e5('0x7e'),_[_0x81e5('0x34')](_0x1dc997,'id'));}});})['then'](function(){if(_0x1c356f[_0x81e5('0x9b')]['role']==='agent'&&!_0x5b1254&&!_0x1c356f[_0x81e5('0x46')][_0x81e5('0x9a')])return[];return db[_0x81e5('0x9f')][_0x81e5('0x46')](_0x49244f['toString'](),_0x45c68e);})[_0x81e5('0x2e')](function(_0x2447f9){_0x60bf3[_0x81e5('0x28')]=_0x2447f9[_0x81e5('0x4a')];if(_0x60bf3[_0x81e5('0x28')]===0x0)return[];return db[_0x81e5('0x9f')][_0x81e5('0x46')](_0x2ce783['toString'](),_0x45c68e)[_0x81e5('0x2e')](function(_0x39c5b9){_0x58ebba=_[_0x81e5('0xa0')](_0x39c5b9,'id');_0x45c68e=_['merge'](_0x45c68e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c356f[_0x81e5('0x46')][_0x81e5('0x49')]){_0x53289e['attributes']['forEach'](function(_0x984f17){_0x22a19c['field']('i.'+_0x984f17);});}else{_0x22a19c['field'](_0x81e5('0x96'),_0x81e5('0x6a'));_0x22a19c[_0x81e5('0x51')]('a.key',_0x81e5('0xa1'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa2'),_0x81e5('0xa3'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa4'),_0x81e5('0xa5'));_0x22a19c['field']('i.*');_0x22a19c['field'](_0x81e5('0xa6'),'Contact.firstName');_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa7'),'Contact.lastName');_0x22a19c[_0x81e5('0x51')](_0x81e5('0xa8'),_0x81e5('0xa9'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xaa'),_0x81e5('0xab'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xac'),'Contact.mobile');_0x22a19c[_0x81e5('0x51')]('c.fax',_0x81e5('0xad'));_0x22a19c[_0x81e5('0x51')](_0x81e5('0xae'),_0x81e5('0xaf'));_0x22a19c['field'](_0x81e5('0xb0'),_0x81e5('0xb1'));_0x22a19c['field'](_0x81e5('0xb2'),_0x81e5('0x35'));}if(_0x53289e[_0x81e5('0x27')])_0x22a19c[_0x81e5('0x27')](_0x53289e['limit']);if(_0x53289e[_0x81e5('0x25')])_0x22a19c[_0x81e5('0x25')](_0x53289e['offset']);return db['sequelize'][_0x81e5('0x46')](_0x22a19c[_0x81e5('0xb3')](),_0x45c68e);})[_0x81e5('0x2e')](function(_0x2e941f){if(_0x2e941f[_0x81e5('0x4a')]>0x0)_0x5d4115[_0x81e5('0x4e')](_0x81e5('0xb4'),_[_0x81e5('0x34')](_0x2e941f,'id'));return db[_0x81e5('0x9f')][_0x81e5('0x46')](_0x5d4115[_0x81e5('0xb3')](),_0x45c68e)['then'](function(_0x3075cf){var _0x1d01b9=_[_0x81e5('0xb5')](_0x3075cf,_0x81e5('0xb6'));var _0x5a3aa0=[];_0x2e941f[_0x81e5('0x38')](function(_0x4aac46){_0x5a3aa0['push'](updateFaxInteraction(_0x4aac46,_0x58ebba,_0x1d01b9));});return BPromise['all'](_0x5a3aa0);});});})['then'](function(_0x36c7fa){_0x60bf3[_0x81e5('0xb7')]=_0x36c7fa;return _0x60bf3;})[_0x81e5('0x2e')](respondWithFilteredResult(_0x5c34e5,_0x53289e))[_0x81e5('0x3a')](handleError(_0x5c34e5,null));};exports[_0x81e5('0xb8')]=function(_0x533ce7,_0x59d248){var _0x179850={'raw':![],'where':{'id':_0x533ce7[_0x81e5('0xb9')]['id']}},_0x49c807={};_0x49c807[_0x81e5('0x45')]=_[_0x81e5('0x7b')](db[_0x81e5('0xba')][_0x81e5('0x42')]);_0x49c807[_0x81e5('0x46')]=_[_0x81e5('0x7b')](_0x533ce7[_0x81e5('0x46')]);_0x49c807['filters']=_['intersection'](_0x49c807[_0x81e5('0x45')],_0x49c807[_0x81e5('0x46')]);_0x179850['attributes']=_['intersection'](_0x49c807[_0x81e5('0x45')],qs[_0x81e5('0x49')](_0x533ce7[_0x81e5('0x46')][_0x81e5('0x49')]));_0x179850[_0x81e5('0x48')]=_0x179850[_0x81e5('0x48')][_0x81e5('0x4a')]?_0x179850[_0x81e5('0x48')]:_0x49c807[_0x81e5('0x45')];if(_0x533ce7[_0x81e5('0x46')]['includeAll']){_0x179850[_0x81e5('0xbb')]=[{'all':!![]}];}_0x179850=_[_0x81e5('0xbc')]({},_0x179850,_0x533ce7['options']);return db['FaxInteraction'][_0x81e5('0x69')](_0x179850)[_0x81e5('0x2e')](handleEntityNotFound(_0x59d248,null))['then'](respondWithResult(_0x59d248,null))[_0x81e5('0x3a')](handleError(_0x59d248,null));};exports['create']=function(_0x4c8018,_0x5b2d8c){return db[_0x81e5('0xba')][_0x81e5('0xbd')](_0x4c8018[_0x81e5('0xbe')],{})[_0x81e5('0x2e')](respondWithResult(_0x5b2d8c,0xc9))[_0x81e5('0x3a')](handleError(_0x5b2d8c,null));};exports[_0x81e5('0x2d')]=function(_0x4a61cd,_0x3bff5e){if(_0x4a61cd[_0x81e5('0xbe')]['id']){delete _0x4a61cd[_0x81e5('0xbe')]['id'];}return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x4a61cd['params']['id']}})['then'](handleEntityNotFound(_0x3bff5e,null))['then'](saveUpdates(_0x4a61cd[_0x81e5('0xbe')],null))['then'](respondWithResult(_0x3bff5e,null))[_0x81e5('0x3a')](handleError(_0x3bff5e,null));};exports[_0x81e5('0x2f')]=function(_0x4c4e5f,_0x3c03b2){return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x4c4e5f[_0x81e5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x3c03b2,null))['then'](removeEntity(_0x3c03b2,null))[_0x81e5('0x3a')](handleError(_0x3c03b2,null));};exports[_0x81e5('0xbf')]=function(_0x3964ed,_0x335dc6){return db[_0x81e5('0xba')][_0x81e5('0xbf')]()['then'](respondWithResult(_0x335dc6,null))['catch'](handleError(_0x335dc6,null));};exports[_0x81e5('0xc0')]=function(_0x2bf8fa,_0x6da40d,_0x48abac){return db['FaxMessage'][_0x81e5('0x69')]({'where':{'id':_0x2bf8fa['params']['id']}})[_0x81e5('0x2e')](handleEntityNotFound(_0x6da40d,null))[_0x81e5('0x2e')](function(_0x281059){if(_0x281059){return _0x281059[_0x81e5('0xc0')](_0x2bf8fa[_0x81e5('0xbe')]['ids'],_[_0x81e5('0xc1')](_0x2bf8fa['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x6da40d,null))[_0x81e5('0x3a')](handleError(_0x6da40d,null));};exports[_0x81e5('0xc2')]=function(_0x5b8e39,_0x5292df,_0x56cc21){var _0x22a66a={'raw':![],'where':{}};var _0x343710={};var _0x12a4f7={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x5b8e39[_0x81e5('0xb9')]['id']}})[_0x81e5('0x2e')](handleEntityNotFound(_0x5292df,null))[_0x81e5('0x2e')](function(_0x50fad5){if(_0x50fad5){_0x343710[_0x81e5('0x45')]=_['keys'](db[_0x81e5('0xc3')][_0x81e5('0x42')]);_0x343710[_0x81e5('0x46')]=_[_0x81e5('0x7b')](_0x5b8e39[_0x81e5('0x46')]);_0x343710[_0x81e5('0x4f')]=_[_0x81e5('0x47')](_0x343710[_0x81e5('0x45')],_0x343710['query']);_0x22a66a[_0x81e5('0x48')]=_[_0x81e5('0x47')](_0x343710['model'],qs[_0x81e5('0x49')](_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x49')]));_0x22a66a[_0x81e5('0x48')]=_0x22a66a[_0x81e5('0x48')]['length']?_0x22a66a[_0x81e5('0x48')]:_0x343710[_0x81e5('0x45')];if(!_0x5b8e39[_0x81e5('0x46')]['hasOwnProperty']('nolimit')){_0x22a66a[_0x81e5('0x27')]=qs[_0x81e5('0x27')](_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x27')]);_0x22a66a[_0x81e5('0x25')]=qs[_0x81e5('0x25')](_0x5b8e39[_0x81e5('0x46')]['offset']);}_0x22a66a[_0x81e5('0x4c')]=qs[_0x81e5('0x4d')](_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x4d')]);_0x22a66a[_0x81e5('0x4e')]=qs[_0x81e5('0x4f')](_[_0x81e5('0xc4')](_0x5b8e39[_0x81e5('0x46')],_0x343710[_0x81e5('0x4f')]));_0x22a66a[_0x81e5('0x4e')][_0x81e5('0xb6')]=_0x50fad5['id'];if(_0x5b8e39[_0x81e5('0x46')]['filter']){_0x22a66a[_0x81e5('0x4e')]=_['merge'](_0x22a66a[_0x81e5('0x4e')],{'$or':_[_0x81e5('0x34')](_0x22a66a['attributes'],function(_0x557fd0){var _0x2674bc={};_0x2674bc[_0x557fd0]={'$like':'%'+_0x5b8e39[_0x81e5('0x46')]['filter']+'%'};return _0x2674bc;})});}if(_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x82')]){var _0x28543f=_0x5b8e39[_0x81e5('0x46')][_0x81e5('0x82')][_0x81e5('0x37')](',');var _0x3fce3d={};_0x3fce3d[_0x28543f[0x0]]={'$gte':moment(_0x28543f[0x1])[_0x81e5('0xc5')](_0x81e5('0xc6'))};_0x22a66a[_0x81e5('0x4e')]=_[_0x81e5('0xbc')](_0x22a66a[_0x81e5('0x4e')],_0x3fce3d);}_0x22a66a=_['merge']({},_0x22a66a,_0x5b8e39[_0x81e5('0xc7')]);return db[_0x81e5('0xc3')]['count']({'where':_0x22a66a['where']})[_0x81e5('0x2e')](function(_0x4b911a){_0x12a4f7['count']=_0x4b911a;if(_0x5b8e39[_0x81e5('0x46')][_0x81e5('0xc8')]){_0x22a66a[_0x81e5('0xbb')]=[{'all':!![]}];}return db[_0x81e5('0xc3')][_0x81e5('0xc9')](_0x22a66a);})['then'](function(_0xb0db3b){_0x12a4f7['rows']=_0xb0db3b;return _0x12a4f7;});}})[_0x81e5('0x2e')](respondWithFilteredResult(_0x5292df,_0x22a66a))[_0x81e5('0x3a')](handleError(_0x5292df,null));};exports[_0x81e5('0xca')]=function(_0x215016,_0x1e9113,_0xa21d0a){return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x215016[_0x81e5('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1e9113,null))['then'](function(_0x4367f3){if(_0x4367f3){return _0x4367f3[_0x81e5('0xcb')](_0x215016[_0x81e5('0xbe')]['ids'],_[_0x81e5('0xc1')](_0x215016['body'],[_0x81e5('0xcc'),'id'])||{})[_0x81e5('0xcd')](function(){return db['Tag'][_0x81e5('0xc9')]({'attributes':['id',_0x81e5('0x31'),_0x81e5('0x52')],'where':{'id':_0x215016['body'][_0x81e5('0xcc')]}});})[_0x81e5('0x2e')](function(_0xb38928){socket['emit'](_0x81e5('0xce'),{'id':Number(_0x215016[_0x81e5('0xb9')]['id']),'tags':_0xb38928||[]});return{'id':Number(_0x215016[_0x81e5('0xb9')]['id']),'tags':_0xb38928||[]};});}})[_0x81e5('0x2e')](respondWithResult(_0x1e9113,null))['catch'](handleError(_0x1e9113,null));};exports[_0x81e5('0xcf')]=function(_0x5377dc,_0x10e6b1,_0x18e2cd){return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x5377dc[_0x81e5('0xb9')]['id']}})[_0x81e5('0x2e')](handleEntityNotFound(_0x10e6b1,null))['then'](function(_0x1eda1c){if(_0x1eda1c){return _0x1eda1c[_0x81e5('0xcf')](_0x5377dc[_0x81e5('0x46')]['ids']);}})[_0x81e5('0x2e')](respondWithStatusCode(_0x10e6b1,null))[_0x81e5('0x3a')](handleError(_0x10e6b1,null));};exports[_0x81e5('0xd0')]=function(_0x49157e,_0x5e9079){var _0x5f1535=moment()[_0x81e5('0xd1')]()[_0x81e5('0xb3')]();var _0x3dd128=path['join'](config[_0x81e5('0xd2')],_0x81e5('0xd3'),_0x81e5('0xd4'),_0x81e5('0xd5'));var _0x118a28=path[_0x81e5('0xd6')](config['root'],_0x81e5('0xd3'),_0x81e5('0xd4'),'attachments');var _0x1c078a=path[_0x81e5('0xd6')](_0x3dd128,_0x5f1535);var _0x4f3105=util[_0x81e5('0xc5')](_0x81e5('0xd7'),_0x49157e[_0x81e5('0xb9')]['id'],_0x5f1535);var _0x35809f=path[_0x81e5('0xd6')](_0x3dd128,_0x4f3105);var _0x2692fa=[];_0x2692fa[_0x81e5('0x39')]({'model':db[_0x81e5('0xd8')],'as':_0x81e5('0xd8'),'raw':!![]});var _0x2ea08b=[{'model':db['FaxMessage'],'as':_0x81e5('0xd9'),'attributes':['id',_0x81e5('0xbe'),_0x81e5('0x80')],'include':_0x2692fa}];return db[_0x81e5('0xba')][_0x81e5('0x69')]({'where':{'id':_0x49157e[_0x81e5('0xb9')]['id']},'include':_0x2ea08b})[_0x81e5('0x2e')](handleEntityNotFound(_0x5e9079,null))['then'](function(_0x2ac817){if(_0x2ac817&&_0x2ac817[_0x81e5('0xd9')]){var _0x1bd54a=_0x2ac817[_0x81e5('0xda')]({'plain':!![]});fs[_0x81e5('0xdb')](_0x1c078a);for(var _0x59fa76=0x0;_0x59fa76<_0x1bd54a[_0x81e5('0xd9')][_0x81e5('0x4a')];_0x59fa76++){var _0x3ba966=_0x1bd54a[_0x81e5('0xd9')][_0x59fa76][_0x81e5('0xd8')];if(_0x3ba966){var _0x350a5d=path[_0x81e5('0xd6')](_0x118a28,_0x3ba966[_0x81e5('0xdc')]);if(fs['existsSync'](_0x350a5d)){fs['createReadStream'](_0x350a5d)[_0x81e5('0xdd')](fs[_0x81e5('0xde')](path['join'](_0x1c078a,_0x3ba966['basename'])));}}}return BPromise[_0x81e5('0x99')]()[_0x81e5('0x2e')](function(){return new BPromise(function(_0x4128e1,_0x49dfbb){zipdir(_0x1c078a,{'saveTo':_0x35809f},function(_0x4433e9,_0x38d455){if(_0x4433e9)return _0x49dfbb(_0x4433e9);return _0x4128e1(_0x38d455);});})[_0x81e5('0x2e')](function(){return new BPromise(function(_0x4aacf6,_0x5761b2){rimraf(_0x1c078a,function(_0x1fe669){if(_0x1fe669)_0x5761b2(_0x1fe669);return _0x4aacf6();});});})[_0x81e5('0x2e')](function(){return _0x5e9079[_0x81e5('0xd0')](_0x35809f,_0x4f3105,function(_0x49c988){if(_0x49c988){console[_0x81e5('0xdf')](_0x81e5('0xe0'),_0x49c988);}else{fs[_0x81e5('0xe1')](_0x35809f);}});});});}else{return _0x5e9079[_0x81e5('0x21')](0xc8);}})[_0x81e5('0x3a')](handleError(_0x5e9079,null));}; \ No newline at end of file +var _0xde15=['key','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','select','field','from','u.id','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','$substring','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','where','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','FaxAccountId','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.phone','c.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','push','all','rows','show','params','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','createWriteStream','log','err','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','Users','map','fullname','Tags','TagIds','split','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','FaxInteraction','rawAttributes','fieldName','type'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xde15,0x16f));var _0x5de1=function(_0x50e01a,_0x48c43e){_0x50e01a=_0x50e01a-0x0;var _0x32190a=_0xde15[_0x50e01a];return _0x32190a;};'use strict';var emlformat=require(_0x5de1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5de1('0x1'));var jsonpatch=require(_0x5de1('0x2'));var rp=require(_0x5de1('0x3'));var moment=require(_0x5de1('0x4'));var BPromise=require(_0x5de1('0x5'));var Mustache=require(_0x5de1('0x6'));var util=require('util');var path=require(_0x5de1('0x7'));var sox=require('sox');var csv=require(_0x5de1('0x8'));var ejs=require(_0x5de1('0x9'));var fs=require('fs');var fs_extra=require(_0x5de1('0xa'));var _=require(_0x5de1('0xb'));var squel=require(_0x5de1('0xc'));var crypto=require(_0x5de1('0xd'));var jsforce=require(_0x5de1('0xe'));var deskjs=require(_0x5de1('0xf'));var toCsv=require(_0x5de1('0x8'));var querystring=require(_0x5de1('0x10'));var Papa=require('papaparse');var Redis=require(_0x5de1('0x11'));var authService=require(_0x5de1('0x12'));var qs=require(_0x5de1('0x13'));var as=require(_0x5de1('0x14'));var hardwareService=require(_0x5de1('0x15'));var logger=require(_0x5de1('0x16'))(_0x5de1('0x17'));var utils=require(_0x5de1('0x18'));var config=require(_0x5de1('0x19'));var licenseUtil=require(_0x5de1('0x1a'));var db=require(_0x5de1('0x1b'))['db'];config[_0x5de1('0x1c')]=_['defaults'](config[_0x5de1('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x5de1('0x1d'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x5de1('0x1e')](socket);function respondWithStatusCode(_0x670290,_0x45e77f){_0x45e77f=_0x45e77f||0xcc;return function(_0x53c64b){if(_0x53c64b){return _0x670290[_0x5de1('0x1f')](_0x45e77f);}return _0x670290[_0x5de1('0x20')](_0x45e77f)[_0x5de1('0x21')]();};}function respondWithResult(_0x2ba42,_0x3fb8b0){_0x3fb8b0=_0x3fb8b0||0xc8;return function(_0x58ffe0){if(_0x58ffe0){return _0x2ba42[_0x5de1('0x20')](_0x3fb8b0)['json'](_0x58ffe0);}};}function respondWithFilteredResult(_0xb26ca1,_0x2ede99){return function(_0x35ce91){if(_0x35ce91){var _0x9e18d9=typeof _0x2ede99[_0x5de1('0x22')]===_0x5de1('0x23')&&typeof _0x2ede99[_0x5de1('0x24')]==='undefined';var _0x21b995=_0x35ce91[_0x5de1('0x25')];var _0x22bc33=_0x9e18d9?0x0:_0x2ede99[_0x5de1('0x22')];var _0x465c86=_0x9e18d9?_0x35ce91[_0x5de1('0x25')]:_0x2ede99[_0x5de1('0x22')]+_0x2ede99[_0x5de1('0x24')];var _0x3e2a75;if(_0x465c86>=_0x21b995){_0x465c86=_0x21b995;_0x3e2a75=0xc8;}else{_0x3e2a75=0xce;}_0xb26ca1['status'](_0x3e2a75);return _0xb26ca1[_0x5de1('0x26')](_0x5de1('0x27'),_0x22bc33+'-'+_0x465c86+'/'+_0x21b995)['json'](_0x35ce91);}return null;};}function patchUpdates(_0xd85a14){return function(_0x38657e){try{jsonpatch[_0x5de1('0x28')](_0x38657e,_0xd85a14,!![]);}catch(_0x5d7894){return BPromise[_0x5de1('0x29')](_0x5d7894);}return _0x38657e[_0x5de1('0x2a')]();};}function saveUpdates(_0x3e27a6,_0x504afd){return function(_0x14ae0b){if(_0x14ae0b){return _0x14ae0b[_0x5de1('0x2b')](_0x3e27a6)[_0x5de1('0x2c')](function(_0x298b51){return _0x298b51;});}return null;};}function removeEntity(_0x3ec8c1,_0x3e645c){return function(_0x5647d5){if(_0x5647d5){return _0x5647d5['destroy']()[_0x5de1('0x2c')](function(){_0x3ec8c1[_0x5de1('0x20')](0xcc)[_0x5de1('0x21')]();});}};}function handleEntityNotFound(_0x3c5e23,_0x167712){return function(_0x4c0558){if(!_0x4c0558){_0x3c5e23['sendStatus'](0x194);}return _0x4c0558;};}function handleError(_0x66358d,_0x41909b){_0x41909b=_0x41909b||0x1f4;return function(_0x38b4c6){logger['error'](_0x38b4c6[_0x5de1('0x2d')]);if(_0x38b4c6[_0x5de1('0x2e')]){delete _0x38b4c6['name'];}_0x66358d[_0x5de1('0x20')](_0x41909b)[_0x5de1('0x2f')](_0x38b4c6);};}function getInteractionUsers(_0x516a25,_0x40b7c6){return new BPromise(function(_0xfbedd0,_0x5708d4){try{if(_0x40b7c6[_0x516a25['id']]){_0x516a25[_0x5de1('0x30')]=_[_0x5de1('0x31')](_0x40b7c6[_0x516a25['id']],function(_0x36f7f0){return{'id':_0x36f7f0['id'],'fullname':_0x36f7f0[_0x5de1('0x32')]};});}}catch(_0x357fc6){_0x5708d4(_0x357fc6);}_0xfbedd0(_0x516a25);});}function getInteractionTags(_0x4df7df,_0xa4dabf){return new BPromise(function(_0x4434f8,_0x5769b9){try{if(_0x4df7df['TagIds']){_0x4df7df[_0x5de1('0x33')]=[];_0x4df7df[_0x5de1('0x34')][_0x5de1('0x35')](',')['forEach'](function(_0xbc3e21){_0x4df7df[_0x5de1('0x33')]['push'](_0xa4dabf[_0xbc3e21]);});}delete _0x4df7df[_0x5de1('0x34')];}catch(_0x3f60c3){_0x5769b9(_0x3f60c3);}_0x4434f8(_0x4df7df);});}function updateFaxInteraction(_0x4799e8,_0x5bd22c,_0x41bbe4){return new BPromise(function(_0x56b97f,_0x20b6c9){return getInteractionUsers(_0x4799e8,_0x41bbe4)[_0x5de1('0x2c')](function(_0x4f6a0c){return getInteractionTags(_0x4f6a0c,_0x5bd22c);})[_0x5de1('0x2c')](function(_0x18ea6a){return getStateInteraction(_0x18ea6a);})['then'](function(_0x298f11){_0x56b97f(_0x298f11);})[_0x5de1('0x36')](function(_0x3caf2d){_0x20b6c9(_0x3caf2d);});});}function getStateInteraction(_0x10679a){return new BPromise(function(_0x57f9ea){_0x10679a[_0x5de1('0x37')]=0x0;_0x10679a[_0x5de1('0x38')]=0x0;_0x10679a['answered']=0x0;_0x10679a[_0x5de1('0x39')]=0x0;_0x10679a[_0x5de1('0x3a')]=0x0;if(!_0x10679a[_0x5de1('0x3b')]&&!_0x10679a['UserId']){_0x10679a['waiting']+=0x1;}if(!_0x10679a[_0x5de1('0x3b')]&&_0x10679a[_0x5de1('0x3c')]){_0x10679a['talking']+=0x1;if(_0x10679a[_0x5de1('0x37')]){_0x10679a[_0x5de1('0x37')]-=0x1;}}if(_0x10679a['closed']&&_0x10679a[_0x5de1('0x3c')]){_0x10679a[_0x5de1('0x3d')]+=0x1;if(_0x10679a['talking']){_0x10679a[_0x5de1('0x38')]-=0x1;}}if(_0x10679a['closed']&&!_0x10679a[_0x5de1('0x3c')]){_0x10679a[_0x5de1('0x39')]+=0x1;if(_0x10679a[_0x5de1('0x37')]){_0x10679a[_0x5de1('0x37')]-=0x1;}}_0x10679a[_0x5de1('0x3a')]+=0x1;_0x57f9ea(_0x10679a);});}exports[_0x5de1('0x3e')]=function(_0x2b762c,_0x3457d4){var _0x77eef6={},_0xbcfade={},_0x238fbf={'count':0x0,'rows':[]};var _0xcfc9e6=_[_0x5de1('0x31')](db[_0x5de1('0x3f')][_0x5de1('0x40')],function(_0x1f2aaa){return{'name':_0x1f2aaa[_0x5de1('0x41')],'type':_0x1f2aaa[_0x5de1('0x42')][_0x5de1('0x43')]};});_0xbcfade['model']=_[_0x5de1('0x31')](_0xcfc9e6,_0x5de1('0x2e'));_0xbcfade['query']=_[_0x5de1('0x44')](_0x2b762c[_0x5de1('0x45')]);_0xbcfade[_0x5de1('0x46')]=_['intersection'](_0xbcfade[_0x5de1('0x47')],_0xbcfade['query']);_0x77eef6['attributes']=_[_0x5de1('0x48')](_0xbcfade[_0x5de1('0x47')],qs[_0x5de1('0x49')](_0x2b762c['query']['fields']));_0x77eef6[_0x5de1('0x4a')]=_0x77eef6[_0x5de1('0x4a')]['length']?_0x77eef6[_0x5de1('0x4a')]:_0xbcfade[_0x5de1('0x47')];if(!_0x2b762c[_0x5de1('0x45')][_0x5de1('0x4b')](_0x5de1('0x4c'))){_0x77eef6[_0x5de1('0x24')]=qs[_0x5de1('0x24')](_0x2b762c[_0x5de1('0x45')][_0x5de1('0x24')]);_0x77eef6[_0x5de1('0x22')]=qs[_0x5de1('0x22')](_0x2b762c[_0x5de1('0x45')]['offset']);}_0x77eef6[_0x5de1('0x4d')]=qs[_0x5de1('0x4e')](_0x2b762c[_0x5de1('0x45')][_0x5de1('0x4e')]);_0x77eef6['where']=qs[_0x5de1('0x46')](_['pick'](_0x2b762c[_0x5de1('0x45')],_0xbcfade['filters']),_0xcfc9e6);var _0x5a1e30=[];var _0x4f2f6e=squel[_0x5de1('0x4f')]()['field']('id')[_0x5de1('0x50')](_0x5de1('0x2e'))['field']('color')[_0x5de1('0x51')]('tools_tags');var _0x4b0b7b=squel[_0x5de1('0x4f')]()['field'](_0x5de1('0x52'))[_0x5de1('0x50')]('u.fullname')[_0x5de1('0x50')]('ui.FaxInteractionId')['from'](_0x5de1('0x53'),'ui')[_0x5de1('0x54')]('users','u',_0x5de1('0x55'));var _0x554599=squel[_0x5de1('0x4f')]()[_0x5de1('0x51')](_0x5de1('0x56'),'i')[_0x5de1('0x54')]('cm_contacts','c',_0x5de1('0x57'))[_0x5de1('0x54')]('users','o',_0x5de1('0x58'))[_0x5de1('0x54')](_0x5de1('0x59'),'a',_0x5de1('0x5a'))[_0x5de1('0x54')](_0x5de1('0x5b'),'me',_0x5de1('0x5c'))[_0x5de1('0x54')](_0x5de1('0x5d'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x5de1('0x5e'));var _0x356e24=squel[_0x5de1('0x5f')]();var _0x3e2a92=[];var _0x4005e5=squel[_0x5de1('0x5f')]();var _0x8a706e;if(_0x2b762c[_0x5de1('0x45')][_0x5de1('0x60')]){_0x8a706e=as['parseSearch'](_0x2b762c[_0x5de1('0x45')][_0x5de1('0x60')]);var _0x2d0e1a=_0x8a706e[_0x5de1('0x61')];for(var _0x3f5623=0x0;_0x3f5623<_0x8a706e[_0x5de1('0x62')]['length'];_0x3f5623++){var _0x12f386=_0x8a706e['conditions'][_0x3f5623];var _0x240af6='i';var _0x3822c6=_[_0x5de1('0x63')](_0xcfc9e6,[_0x5de1('0x2e'),_0x12f386[_0x5de1('0x50')]]);if(!_0x3822c6){switch(_0x12f386[_0x5de1('0x50')]){case _0x5de1('0x64'):if(_0x12f386['value']==0x1){_0x554599[_0x5de1('0x65')]('`'+_0x12f386[_0x5de1('0x50')]+_0x5de1('0x66'));}else{_0x554599[_0x5de1('0x65')]('`'+_0x12f386[_0x5de1('0x50')]+'`\x20>\x200');}break;case'Contact':if(_0x12f386['operator']===_0x5de1('0x67')){if(_0x12f386[_0x5de1('0x68')][_0x5de1('0x35')]('\x20')[_0x5de1('0x69')]>0x1){_0x356e24[_0x2d0e1a](_0x5de1('0x6a'),qs[_0x5de1('0x6b')](_0x12f386[_0x5de1('0x68')]),null);}else{var _0xa5a02c='%'+_0x12f386[_0x5de1('0x68')]+'%';_0x356e24[_0x2d0e1a](_0x5de1('0x6c'),_0xa5a02c,_0xa5a02c,_0xa5a02c);}}else{_0x3822c6=_[_0x5de1('0x63')](_0xcfc9e6,['name',_0x5de1('0x6d')]);_0x12f386[_0x5de1('0x50')]=_0x5de1('0x6d');_0x19b709=as[_0x5de1('0x6e')](_0x240af6,_0x3822c6[_0x5de1('0x42')],_0x12f386);_0x356e24[_0x2d0e1a](_0x19b709[_0x5de1('0x6f')],_0x19b709[_0x5de1('0x68')][_0x5de1('0x70')],_0x19b709[_0x5de1('0x68')][_0x5de1('0x21')]);}break;case _0x5de1('0x71'):var _0x3d3c5a=_0x12f386[_0x5de1('0x68')]['split'](',')[_0x5de1('0x31')](function(_0x5d255f){return Number(_0x5d255f);});_0x3d3c5a[_0x5de1('0x72')](function(_0x4ddaa4){_0x4005e5['or'](_0x5de1('0x73'),'%,'+_0x4ddaa4+',%');});_0x3e2a92=_['union'](_0x3e2a92,_0x3d3c5a);break;case'User':if(_0x12f386[_0x5de1('0x74')]===_0x5de1('0x67')){_0x356e24[_0x2d0e1a](_0x5de1('0x75'),'%'+_0x12f386[_0x5de1('0x68')]+'%',null);}else{_0x3822c6=_[_0x5de1('0x63')](_0xcfc9e6,[_0x5de1('0x2e'),_0x5de1('0x3c')]);_0x12f386[_0x5de1('0x50')]='UserId';_0x19b709=as['buildExpression'](_0x240af6,_0x3822c6['type'],_0x12f386);_0x356e24[_0x2d0e1a](_0x19b709[_0x5de1('0x6f')],_0x19b709[_0x5de1('0x68')][_0x5de1('0x70')],_0x19b709[_0x5de1('0x68')]['end']);}break;case'body':_0x19b709=as[_0x5de1('0x6e')]('me',null,_0x12f386);_0x356e24[_0x2d0e1a](_0x19b709[_0x5de1('0x6f')],_0x19b709[_0x5de1('0x68')][_0x5de1('0x70')],_0x19b709[_0x5de1('0x68')][_0x5de1('0x21')]);break;}}else{var _0x19b709=as[_0x5de1('0x6e')](_0x240af6,_0x3822c6['type'],_0x12f386);_0x356e24[_0x2d0e1a](_0x19b709[_0x5de1('0x6f')],_0x19b709[_0x5de1('0x68')]['start'],_0x19b709[_0x5de1('0x68')][_0x5de1('0x21')]);}}}else{var _0x319986=_(_0x2b762c[_0x5de1('0x45')])[_0x5de1('0x44')]()[_0x5de1('0x31')](function(_0x35b2bd){return _[_0x5de1('0x76')](_0xcfc9e6,[_0x5de1('0x2e'),_0x35b2bd])?_0x35b2bd:undefined;})['compact']()[_0x5de1('0x68')]();if(!_['isEmpty'](_0x319986)){_0x319986[_0x5de1('0x72')](function(_0x335ddd){if(_0x335ddd==='FaxAccountId'){_0x554599[_0x5de1('0x77')]('i.FaxAccountId\x20IN\x20?',[][_0x5de1('0x78')](_0x2b762c[_0x5de1('0x45')][_0x335ddd]));}else if(_0x335ddd===_0x5de1('0x79')){var _0x50d6b7=JSON['parse'](_0x2b762c[_0x5de1('0x45')][_0x335ddd])[_0x5de1('0x7a')];var _0x53e7bb=JSON[_0x5de1('0x7b')](_0x2b762c[_0x5de1('0x45')][_0x335ddd])[_0x5de1('0x7c')];_0x554599[_0x5de1('0x77')](_0x5de1('0x7d'),_0x50d6b7,_0x53e7bb);}else{if(_0x2b762c[_0x5de1('0x45')][_0x335ddd]===_0x5de1('0x7e')){_0x554599['where']('i.'+_0x335ddd+_0x5de1('0x7f'));}else{_0x554599['where']('i.'+_0x335ddd+_0x5de1('0x80'),_0x2b762c[_0x5de1('0x45')][_0x335ddd]);}}});}if(_0x2b762c[_0x5de1('0x45')][_0x5de1('0x81')]){if(_0x2b762c[_0x5de1('0x45')][_0x5de1('0x81')]==0x1){_0x554599[_0x5de1('0x65')](_0x5de1('0x82'));}else{_0x554599[_0x5de1('0x65')](_0x5de1('0x83'));}}if(_0x2b762c['query'][_0x5de1('0x84')]){_0x3e2a92=_['isArray'](_0x2b762c[_0x5de1('0x45')][_0x5de1('0x84')])?_0x2b762c[_0x5de1('0x45')][_0x5de1('0x84')]:new Array(_0x2b762c['query'][_0x5de1('0x84')]);_0x3e2a92[_0x5de1('0x72')](function(_0x1f8f97){_0x4005e5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1f8f97+',%');});}if(_0x2b762c[_0x5de1('0x45')][_0x5de1('0x85')]){var _0x1c0bc0=_0x2b762c[_0x5de1('0x45')][_0x5de1('0x85')][_0x5de1('0x86')]('\x5c','\x5c\x5c')[_0x5de1('0x86')](/'/g,'\x27\x27');if(qs[_0x5de1('0x87')](_0x1c0bc0)){_0x356e24['or'](_0x5de1('0x88'),_0x1c0bc0+'%')['or'](_0x5de1('0x89'),_0x1c0bc0+'%');}_0x356e24['or'](_0x5de1('0x8a'),_0x1c0bc0+'%');}}_0x554599[_0x5de1('0x77')](_0x356e24);_0x554599['group'](_0x5de1('0x8b'));var _0x26026d={'type':db['Sequelize'][_0x5de1('0x8c')][_0x5de1('0x8d')],'raw':!![]};var _0x31730b=_0x554599[_0x5de1('0x8e')]();_0x31730b['field']('i.id');_0x31730b['field'](_0x5de1('0x8f'),_0x5de1('0x64'));if(_0x77eef6[_0x5de1('0x4d')]){_0x77eef6[_0x5de1('0x4d')][_0x5de1('0x72')](function(_0x4662d2){var _0x9e9d07=_0x4662d2[0x0]===_0x5de1('0x90')?_0x4662d2[0x0]:'i.'+_0x4662d2[0x0];_0x554599['order'](_0x9e9d07,_0x4662d2[0x1]===_0x5de1('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x3e2a92)){_0x554599['having'](_0x4005e5);_0x31730b[_0x5de1('0x77')](_0x5de1('0x92'),_0x3e2a92);}BPromise[_0x5de1('0x93')]()[_0x5de1('0x2c')](function(){if(!_0x8a706e){if(_0x2b762c['query']['FaxAccountId'])return;_0x31730b[_0x5de1('0x77')](_0x5de1('0x94'));_0x554599['where'](_0x5de1('0x94'));return;}if(_0x2b762c[_0x5de1('0x95')][_0x5de1('0x96')]!==_0x5de1('0x97'))return;return _0x2b762c['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x5de1('0x2c')](function(_0x24cdb5){if(_[_0x5de1('0x98')](_0x24cdb5)){_0x31730b[_0x5de1('0x77')](_0x5de1('0x99'));_0x554599[_0x5de1('0x77')](_0x5de1('0x99'));}else{_0x31730b['where'](_0x5de1('0x9a'),_[_0x5de1('0x31')](_0x24cdb5,'id'));_0x554599['where'](_0x5de1('0x9a'),_[_0x5de1('0x31')](_0x24cdb5,'id'));}});})[_0x5de1('0x2c')](function(){if(_0x2b762c[_0x5de1('0x95')][_0x5de1('0x96')]===_0x5de1('0x97')&&!_0x8a706e&&!_0x2b762c[_0x5de1('0x45')][_0x5de1('0x9b')])return[];return db[_0x5de1('0x9c')]['query'](_0x31730b[_0x5de1('0x9d')](),_0x26026d);})[_0x5de1('0x2c')](function(_0x572322){_0x238fbf[_0x5de1('0x25')]=_0x572322[_0x5de1('0x69')];if(_0x238fbf[_0x5de1('0x25')]===0x0)return[];return db[_0x5de1('0x9c')][_0x5de1('0x45')](_0x4f2f6e[_0x5de1('0x9d')](),_0x26026d)[_0x5de1('0x2c')](function(_0x13e237){_0x5a1e30=_[_0x5de1('0x9e')](_0x13e237,'id');_0x26026d=_[_0x5de1('0x9f')](_0x26026d,{'model':db[_0x5de1('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b762c[_0x5de1('0x45')]['fields']){_0x77eef6[_0x5de1('0x4a')]['forEach'](function(_0x3d0e3c){_0x554599[_0x5de1('0x50')]('i.'+_0x3d0e3c);});}else{_0x554599['field'](_0x5de1('0x8f'),_0x5de1('0x64'));_0x554599['field']('a.key',_0x5de1('0xa0'));_0x554599[_0x5de1('0x50')](_0x5de1('0xa1'),_0x5de1('0xa2'));_0x554599['field'](_0x5de1('0xa3'),_0x5de1('0x90'));_0x554599[_0x5de1('0x50')](_0x5de1('0xa4'));_0x554599[_0x5de1('0x50')](_0x5de1('0xa5'),_0x5de1('0xa6'));_0x554599[_0x5de1('0x50')](_0x5de1('0xa7'),'Contact.lastName');_0x554599[_0x5de1('0x50')]('c.email','Contact.email');_0x554599['field'](_0x5de1('0xa8'),'Contact.phone');_0x554599[_0x5de1('0x50')](_0x5de1('0xa9'),'Contact.mobile');_0x554599[_0x5de1('0x50')](_0x5de1('0xaa'),'Contact.fax');_0x554599[_0x5de1('0x50')]('o.fullname',_0x5de1('0xab'));_0x554599['field'](_0x5de1('0xac'),_0x5de1('0xad'));_0x554599[_0x5de1('0x50')](_0x5de1('0xae'),_0x5de1('0x34'));}if(_0x77eef6[_0x5de1('0x24')])_0x554599[_0x5de1('0x24')](_0x77eef6[_0x5de1('0x24')]);if(_0x77eef6[_0x5de1('0x22')])_0x554599['offset'](_0x77eef6[_0x5de1('0x22')]);return db[_0x5de1('0x9c')][_0x5de1('0x45')](_0x554599['toString'](),_0x26026d);})[_0x5de1('0x2c')](function(_0x109df1){if(_0x109df1[_0x5de1('0x69')]>0x0)_0x4b0b7b[_0x5de1('0x77')]('ui.FaxInteractionId\x20IN\x20?',_[_0x5de1('0x31')](_0x109df1,'id'));return db[_0x5de1('0x9c')][_0x5de1('0x45')](_0x4b0b7b[_0x5de1('0x9d')](),_0x26026d)[_0x5de1('0x2c')](function(_0xca8ed5){var _0x527dc8=_[_0x5de1('0xaf')](_0xca8ed5,'FaxInteractionId');var _0x554205=[];_0x109df1['forEach'](function(_0x279da0){_0x554205[_0x5de1('0xb0')](updateFaxInteraction(_0x279da0,_0x5a1e30,_0x527dc8));});return BPromise[_0x5de1('0xb1')](_0x554205);});});})[_0x5de1('0x2c')](function(_0x5dc730){_0x238fbf[_0x5de1('0xb2')]=_0x5dc730;return _0x238fbf;})[_0x5de1('0x2c')](respondWithFilteredResult(_0x3457d4,_0x77eef6))[_0x5de1('0x36')](handleError(_0x3457d4,null));};exports[_0x5de1('0xb3')]=function(_0x4137f8,_0x1563be){var _0xae2fb5={'raw':![],'where':{'id':_0x4137f8[_0x5de1('0xb4')]['id']}},_0x523389={};_0x523389[_0x5de1('0x47')]=_[_0x5de1('0x44')](db[_0x5de1('0x3f')][_0x5de1('0x40')]);_0x523389[_0x5de1('0x45')]=_['keys'](_0x4137f8[_0x5de1('0x45')]);_0x523389[_0x5de1('0x46')]=_[_0x5de1('0x48')](_0x523389['model'],_0x523389[_0x5de1('0x45')]);_0xae2fb5['attributes']=_['intersection'](_0x523389['model'],qs[_0x5de1('0x49')](_0x4137f8[_0x5de1('0x45')][_0x5de1('0x49')]));_0xae2fb5['attributes']=_0xae2fb5[_0x5de1('0x4a')][_0x5de1('0x69')]?_0xae2fb5['attributes']:_0x523389[_0x5de1('0x47')];if(_0x4137f8['query']['includeAll']){_0xae2fb5['include']=[{'all':!![]}];}_0xae2fb5=_[_0x5de1('0x9f')]({},_0xae2fb5,_0x4137f8['options']);return db[_0x5de1('0x3f')][_0x5de1('0x63')](_0xae2fb5)[_0x5de1('0x2c')](handleEntityNotFound(_0x1563be,null))[_0x5de1('0x2c')](respondWithResult(_0x1563be,null))[_0x5de1('0x36')](handleError(_0x1563be,null));};exports['create']=function(_0x254c56,_0x100408){return db[_0x5de1('0x3f')][_0x5de1('0xb5')](_0x254c56[_0x5de1('0xb6')],{})[_0x5de1('0x2c')](respondWithResult(_0x100408,0xc9))[_0x5de1('0x36')](handleError(_0x100408,null));};exports[_0x5de1('0x2b')]=function(_0x189348,_0x5c7d5e){if(_0x189348[_0x5de1('0xb6')]['id']){delete _0x189348[_0x5de1('0xb6')]['id'];}return db['FaxInteraction'][_0x5de1('0x63')]({'where':{'id':_0x189348[_0x5de1('0xb4')]['id']}})[_0x5de1('0x2c')](handleEntityNotFound(_0x5c7d5e,null))['then'](saveUpdates(_0x189348[_0x5de1('0xb6')],null))['then'](respondWithResult(_0x5c7d5e,null))[_0x5de1('0x36')](handleError(_0x5c7d5e,null));};exports['destroy']=function(_0x4ecbf2,_0x4c7f31){return db[_0x5de1('0x3f')][_0x5de1('0x63')]({'where':{'id':_0x4ecbf2[_0x5de1('0xb4')]['id']}})[_0x5de1('0x2c')](handleEntityNotFound(_0x4c7f31,null))[_0x5de1('0x2c')](removeEntity(_0x4c7f31,null))[_0x5de1('0x36')](handleError(_0x4c7f31,null));};exports[_0x5de1('0xb7')]=function(_0x69ece1,_0xcd5ff5){return db[_0x5de1('0x3f')][_0x5de1('0xb7')]()['then'](respondWithResult(_0xcd5ff5,null))[_0x5de1('0x36')](handleError(_0xcd5ff5,null));};exports[_0x5de1('0xb8')]=function(_0x28c7a2,_0x1a945d,_0x1e41f5){return db[_0x5de1('0xb9')][_0x5de1('0x63')]({'where':{'id':_0x28c7a2[_0x5de1('0xb4')]['id']}})[_0x5de1('0x2c')](handleEntityNotFound(_0x1a945d,null))[_0x5de1('0x2c')](function(_0x26c370){if(_0x26c370){return _0x26c370[_0x5de1('0xb8')](_0x28c7a2['body'][_0x5de1('0xba')],_[_0x5de1('0xbb')](_0x28c7a2[_0x5de1('0xb6')],[_0x5de1('0xba'),'id'])||{});}})[_0x5de1('0x2c')](respondWithResult(_0x1a945d,null))['catch'](handleError(_0x1a945d,null));};exports[_0x5de1('0xbc')]=function(_0x21dc92,_0x2a7f65,_0x2bfeef){var _0x54aa90={'raw':![],'where':{}};var _0x22e81f={};var _0x5d7fec={'count':0x0,'rows':[]};return db[_0x5de1('0x3f')][_0x5de1('0xbd')]({'where':{'id':_0x21dc92[_0x5de1('0xb4')]['id']}})[_0x5de1('0x2c')](handleEntityNotFound(_0x2a7f65,null))[_0x5de1('0x2c')](function(_0x361365){if(_0x361365){_0x22e81f[_0x5de1('0x47')]=_[_0x5de1('0x44')](db[_0x5de1('0xb9')][_0x5de1('0x40')]);_0x22e81f[_0x5de1('0x45')]=_[_0x5de1('0x44')](_0x21dc92[_0x5de1('0x45')]);_0x22e81f['filters']=_[_0x5de1('0x48')](_0x22e81f[_0x5de1('0x47')],_0x22e81f[_0x5de1('0x45')]);_0x54aa90[_0x5de1('0x4a')]=_[_0x5de1('0x48')](_0x22e81f['model'],qs[_0x5de1('0x49')](_0x21dc92[_0x5de1('0x45')][_0x5de1('0x49')]));_0x54aa90[_0x5de1('0x4a')]=_0x54aa90[_0x5de1('0x4a')][_0x5de1('0x69')]?_0x54aa90[_0x5de1('0x4a')]:_0x22e81f['model'];if(!_0x21dc92[_0x5de1('0x45')]['hasOwnProperty']('nolimit')){_0x54aa90[_0x5de1('0x24')]=qs[_0x5de1('0x24')](_0x21dc92[_0x5de1('0x45')][_0x5de1('0x24')]);_0x54aa90[_0x5de1('0x22')]=qs[_0x5de1('0x22')](_0x21dc92[_0x5de1('0x45')][_0x5de1('0x22')]);}_0x54aa90[_0x5de1('0x4d')]=qs['sort'](_0x21dc92[_0x5de1('0x45')][_0x5de1('0x4e')]);_0x54aa90['where']=qs[_0x5de1('0x46')](_[_0x5de1('0xbe')](_0x21dc92[_0x5de1('0x45')],_0x22e81f['filters']));_0x54aa90[_0x5de1('0x77')]['FaxInteractionId']=_0x361365['id'];if(_0x21dc92['query'][_0x5de1('0x85')]){_0x54aa90[_0x5de1('0x77')]=_[_0x5de1('0x9f')](_0x54aa90[_0x5de1('0x77')],{'$or':_[_0x5de1('0x31')](_0x54aa90[_0x5de1('0x4a')],function(_0x3f4dc9){var _0x477eab={};_0x477eab[_0x3f4dc9]={'$like':'%'+_0x21dc92[_0x5de1('0x45')]['filter']+'%'};return _0x477eab;})});}if(_0x21dc92[_0x5de1('0x45')][_0x5de1('0x7a')]){var _0xd10f4f=_0x21dc92[_0x5de1('0x45')][_0x5de1('0x7a')]['split'](',');var _0x3bc636={};_0x3bc636[_0xd10f4f[0x0]]={'$gte':moment(_0xd10f4f[0x1])[_0x5de1('0xbf')](_0x5de1('0xc0'))};_0x54aa90['where']=_[_0x5de1('0x9f')](_0x54aa90['where'],_0x3bc636);}_0x54aa90=_['merge']({},_0x54aa90,_0x21dc92[_0x5de1('0xc1')]);return db[_0x5de1('0xb9')][_0x5de1('0x25')]({'where':_0x54aa90[_0x5de1('0x77')]})['then'](function(_0x69a6fa){_0x5d7fec[_0x5de1('0x25')]=_0x69a6fa;if(_0x21dc92[_0x5de1('0x45')][_0x5de1('0xc2')]){_0x54aa90['include']=[{'all':!![]}];}return db[_0x5de1('0xb9')][_0x5de1('0xc3')](_0x54aa90);})[_0x5de1('0x2c')](function(_0x3b2917){_0x5d7fec[_0x5de1('0xb2')]=_0x3b2917;return _0x5d7fec;});}})[_0x5de1('0x2c')](respondWithFilteredResult(_0x2a7f65,_0x54aa90))[_0x5de1('0x36')](handleError(_0x2a7f65,null));};exports[_0x5de1('0xc4')]=function(_0x52e9cb,_0x15d850,_0x1a69a1){return db[_0x5de1('0x3f')][_0x5de1('0x63')]({'where':{'id':_0x52e9cb['params']['id']}})[_0x5de1('0x2c')](handleEntityNotFound(_0x15d850,null))[_0x5de1('0x2c')](function(_0x445d40){if(_0x445d40){return _0x445d40['setTags'](_0x52e9cb[_0x5de1('0xb6')][_0x5de1('0xba')],_[_0x5de1('0xbb')](_0x52e9cb[_0x5de1('0xb6')],['ids','id'])||{})[_0x5de1('0xc5')](function(){return db[_0x5de1('0x71')][_0x5de1('0xc3')]({'attributes':['id','name','color'],'where':{'id':_0x52e9cb['body'][_0x5de1('0xba')]}});})[_0x5de1('0x2c')](function(_0xd14778){socket[_0x5de1('0xc6')]('faxInteractionTags:save',{'id':Number(_0x52e9cb['params']['id']),'tags':_0xd14778||[]});return{'id':Number(_0x52e9cb[_0x5de1('0xb4')]['id']),'tags':_0xd14778||[]};});}})['then'](respondWithResult(_0x15d850,null))['catch'](handleError(_0x15d850,null));};exports[_0x5de1('0xc7')]=function(_0x4198ce,_0x28aec4,_0x2c5def){return db['FaxInteraction'][_0x5de1('0x63')]({'where':{'id':_0x4198ce[_0x5de1('0xb4')]['id']}})[_0x5de1('0x2c')](handleEntityNotFound(_0x28aec4,null))['then'](function(_0x2b7ff1){if(_0x2b7ff1){return _0x2b7ff1[_0x5de1('0xc7')](_0x4198ce['query'][_0x5de1('0xba')]);}})[_0x5de1('0x2c')](respondWithStatusCode(_0x28aec4,null))[_0x5de1('0x36')](handleError(_0x28aec4,null));};exports[_0x5de1('0xc8')]=function(_0x4da59e,_0x2c66b3){var _0x30f345=moment()[_0x5de1('0xc9')]()[_0x5de1('0x9d')]();var _0xc1bf75=path[_0x5de1('0xca')](config[_0x5de1('0xcb')],_0x5de1('0xcc'),_0x5de1('0xcd'),'tmp');var _0x2b5094=path['join'](config[_0x5de1('0xcb')],'server','files',_0x5de1('0xce'));var _0x264582=path['join'](_0xc1bf75,_0x30f345);var _0x5ec161=util['format'](_0x5de1('0xcf'),_0x4da59e['params']['id'],_0x30f345);var _0x20125f=path['join'](_0xc1bf75,_0x5ec161);var _0x59da0d=[];_0x59da0d[_0x5de1('0xb0')]({'model':db[_0x5de1('0xd0')],'as':_0x5de1('0xd0'),'raw':!![]});var _0x25d64e=[{'model':db[_0x5de1('0xb9')],'as':_0x5de1('0xd1'),'attributes':['id',_0x5de1('0xb6'),_0x5de1('0x79')],'include':_0x59da0d}];return db[_0x5de1('0x3f')][_0x5de1('0x63')]({'where':{'id':_0x4da59e[_0x5de1('0xb4')]['id']},'include':_0x25d64e})['then'](handleEntityNotFound(_0x2c66b3,null))[_0x5de1('0x2c')](function(_0x3bafcb){if(_0x3bafcb&&_0x3bafcb[_0x5de1('0xd1')]){var _0x110ecf=_0x3bafcb[_0x5de1('0xd2')]({'plain':!![]});fs[_0x5de1('0xd3')](_0x264582);for(var _0x48b9c4=0x0;_0x48b9c4<_0x110ecf['Messages'][_0x5de1('0x69')];_0x48b9c4++){var _0x41af31=_0x110ecf[_0x5de1('0xd1')][_0x48b9c4][_0x5de1('0xd0')];if(_0x41af31){var _0x3d0365=path[_0x5de1('0xca')](_0x2b5094,_0x41af31['basename']);if(fs[_0x5de1('0xd4')](_0x3d0365)){fs[_0x5de1('0xd5')](_0x3d0365)['pipe'](fs[_0x5de1('0xd6')](path[_0x5de1('0xca')](_0x264582,_0x41af31['basename'])));}}}return BPromise[_0x5de1('0x93')]()[_0x5de1('0x2c')](function(){return new BPromise(function(_0x18ef44,_0x4ca9ef){zipdir(_0x264582,{'saveTo':_0x20125f},function(_0xc14c8a,_0x4566f8){if(_0xc14c8a)return _0x4ca9ef(_0xc14c8a);return _0x18ef44(_0x4566f8);});})[_0x5de1('0x2c')](function(){return new BPromise(function(_0x5cbfc3,_0x226c6c){rimraf(_0x264582,function(_0xc68ff0){if(_0xc68ff0)_0x226c6c(_0xc68ff0);return _0x5cbfc3();});});})[_0x5de1('0x2c')](function(){return _0x2c66b3[_0x5de1('0xc8')](_0x20125f,_0x5ec161,function(_0x321f6e){if(_0x321f6e){console[_0x5de1('0xd7')](_0x5de1('0xd8'),_0x321f6e);}else{fs['unlinkSync'](_0x20125f);}});});});}else{return _0x2c66b3[_0x5de1('0x1f')](0xc8);}})[_0x5de1('0x36')](handleError(_0x2c66b3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1dd1ad4..b5d62e2 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 _0x03d9=['update','remove','getUsers','setDataValue','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x5c3e6f,_0x5d8cb3){var _0x20a332=function(_0x5cc855){while(--_0x5cc855){_0x5c3e6f['push'](_0x5c3e6f['shift']());}};_0x20a332(++_0x5d8cb3);}(_0x03d9,0x1db));var _0x903d=function(_0x137bbb,_0x1867cc){_0x137bbb=_0x137bbb-0x0;var _0x464359=_0x03d9[_0x137bbb];return _0x464359;};'use strict';var EventEmitter=require(_0x903d('0x0'));var FaxInteraction=require(_0x903d('0x1'))['db'][_0x903d('0x2')];var FaxMessage=require(_0x903d('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x903d('0x3')](0x0);var events={'afterCreate':_0x903d('0x4'),'afterUpdate':_0x903d('0x5'),'afterDestroy':_0x903d('0x6')};function emitEvent(_0x222024){return function(_0x34e359,_0xd350a0,_0x1a1573){_0x34e359[_0x903d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56b563){_0x34e359[_0x903d('0x8')]('Users',_0x56b563['map'](function(_0x16291b){return{'id':_0x16291b['id']};}));return FaxMessage[_0x903d('0x9')]({'where':{'FaxInteractionId':_0x34e359['id'],'direction':'in','read':![]},'raw':!![]});})[_0x903d('0xa')](function(_0x5e4d66){_0x34e359[_0x903d('0x8')](_0x903d('0xb'),_0x5e4d66[_0x903d('0xc')]);FaxInteractionEvents[_0x903d('0xd')](_0x222024+':'+_0x34e359['id'],_0x34e359);FaxInteractionEvents[_0x903d('0xd')](_0x222024,_0x34e359);_0x1a1573(null);})[_0x903d('0xe')](_0x1a1573(null));};}for(var e in events){if(events[_0x903d('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x4da6=['setMaxListeners','save','update','remove','then','Users','findAll','setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage'];(function(_0x399b6e,_0x3ef3fd){var _0x145cf3=function(_0x7bc119){while(--_0x7bc119){_0x399b6e['push'](_0x399b6e['shift']());}};_0x145cf3(++_0x3ef3fd);}(_0x4da6,0x1d0));var _0x64da=function(_0x295a9c,_0x23e57c){_0x295a9c=_0x295a9c-0x0;var _0x3edd5d=_0x4da6[_0x295a9c];return _0x3edd5d;};'use strict';var EventEmitter=require(_0x64da('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x64da('0x1')];var FaxMessage=require(_0x64da('0x2'))['db'][_0x64da('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x64da('0x4')](0x0);var events={'afterCreate':_0x64da('0x5'),'afterUpdate':_0x64da('0x6'),'afterDestroy':_0x64da('0x7')};function emitEvent(_0x59472f){return function(_0x463946,_0x27e196,_0x438b3c){_0x463946['getUsers']({'attributes':['id'],'raw':!![]})[_0x64da('0x8')](function(_0x9e4073){_0x463946['setDataValue'](_0x64da('0x9'),_0x9e4073['map'](function(_0x4b37ce){return{'id':_0x4b37ce['id']};}));return FaxMessage[_0x64da('0xa')]({'where':{'FaxInteractionId':_0x463946['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64da('0x8')](function(_0x5eb63c){_0x463946[_0x64da('0xb')](_0x64da('0xc'),_0x5eb63c[_0x64da('0xd')]);FaxInteractionEvents['emit'](_0x59472f+':'+_0x463946['id'],_0x463946);FaxInteractionEvents['emit'](_0x59472f,_0x463946);_0x438b3c(null);})[_0x64da('0xe')](_0x438b3c(null));};}for(var e in events){if(events[_0x64da('0xf')](e)){var event=events[e];FaxInteraction[_0x64da('0x10')](e,emitEvent(event));}}module[_0x64da('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e97e5e2..5fc6e43 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 _0x68fc=['./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x68fc,0x13b));var _0xc68f=function(_0x36e292,_0x1ceee2){_0x36e292=_0x36e292-0x0;var _0x1ffb5a=_0x68fc[_0x36e292];return _0x1ffb5a;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))(_0xc68f('0x3'));var moment=require(_0xc68f('0x4'));var BPromise=require(_0xc68f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc68f('0x6'));var config=require('../../config/environment');var attributes=require(_0xc68f('0x7'));module[_0xc68f('0x8')]=function(_0x336546,_0x17691e){return _0x336546['define'](_0xc68f('0x9'),attributes,{'tableName':_0xc68f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b38b7,_0x741460,_0xc43b70){if(_0x4b38b7[_0xc68f('0xb')](_0xc68f('0xc'))){_0x4b38b7[_0xc68f('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xc43b70(null,_0x4b38b7);}}});}; \ No newline at end of file +var _0xde03=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x453171,_0x15484c){var _0x459c54=function(_0x4efd49){while(--_0x4efd49){_0x453171['push'](_0x453171['shift']());}};_0x459c54(++_0x15484c);}(_0xde03,0x1a2));var _0x3de0=function(_0x9adaf8,_0x5ed3b6){_0x9adaf8=_0x9adaf8-0x0;var _0x1d815b=_0xde03[_0x9adaf8];return _0x1d815b;};'use strict';var _=require(_0x3de0('0x0'));var util=require(_0x3de0('0x1'));var logger=require('../../config/logger')(_0x3de0('0x2'));var moment=require(_0x3de0('0x3'));var BPromise=require(_0x3de0('0x4'));var rp=require(_0x3de0('0x5'));var fs=require('fs');var path=require(_0x3de0('0x6'));var rimraf=require(_0x3de0('0x7'));var config=require(_0x3de0('0x8'));var attributes=require(_0x3de0('0x9'));module[_0x3de0('0xa')]=function(_0x2a1ae8,_0x5b4f05){return _0x2a1ae8[_0x3de0('0xb')]('FaxInteraction',attributes,{'tableName':_0x3de0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2be5a1,_0x4632a8,_0x195eb7){if(_0x2be5a1[_0x3de0('0xd')]('closed')){_0x2be5a1['closedAt']=moment()['format'](_0x3de0('0xe'));}_0x195eb7(null,_0x2be5a1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c12de2b..28234df 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 _0xe11a=['options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update'];(function(_0x279522,_0x497270){var _0xc6071d=function(_0x505793){while(--_0x505793){_0x279522['push'](_0x279522['shift']());}};_0xc6071d(++_0x497270);}(_0xe11a,0x86));var _0xae11=function(_0xfda808,_0x369464){_0xfda808=_0xfda808-0x0;var _0x3b95ce=_0xe11a[_0xfda808];return _0x3b95ce;};'use strict';var _=require(_0xae11('0x0'));var util=require(_0xae11('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae11('0x2'));var fs=require('fs');var Redis=require(_0xae11('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xae11('0x4'));var logger=require(_0xae11('0x5'))(_0xae11('0x6'));var config=require(_0xae11('0x7'));var jayson=require(_0xae11('0x8'));var client=jayson[_0xae11('0x9')]['http']({'port':0x232a});config[_0xae11('0xa')]=_[_0xae11('0xb')](config[_0xae11('0xa')],{'host':_0xae11('0xc'),'port':0x18eb});var socket=require(_0xae11('0xd'))(new Redis(config[_0xae11('0xa')]));require('./faxInteraction.socket')[_0xae11('0xe')](socket);function respondWithRpcPromise(_0x2ef886,_0x18320a,_0x6a00d9){return new BPromise(function(_0x578656,_0x39e8e7){return client[_0xae11('0xf')](_0x2ef886,_0x6a00d9)[_0xae11('0x10')](function(_0x32fcea){logger[_0xae11('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x18320a,_0xae11('0x12'));logger[_0xae11('0x13')](_0xae11('0x14'),_0x18320a,'request\x20sent',JSON[_0xae11('0x15')](_0x32fcea));if(_0x32fcea[_0xae11('0x16')]){if(_0x32fcea['error'][_0xae11('0x17')]===0x1f4){logger[_0xae11('0x16')](_0xae11('0x18'),_0x18320a,_0x32fcea[_0xae11('0x16')]['message']);return _0x39e8e7(_0x32fcea[_0xae11('0x16')][_0xae11('0x19')]);}logger[_0xae11('0x16')](_0xae11('0x18'),_0x18320a,_0x32fcea[_0xae11('0x16')][_0xae11('0x19')]);return _0x578656(_0x32fcea['error'][_0xae11('0x19')]);}else{logger[_0xae11('0x11')](_0xae11('0x18'),_0x18320a,_0xae11('0x12'));_0x578656(_0x32fcea[_0xae11('0x1a')][_0xae11('0x19')]);}})[_0xae11('0x1b')](function(_0x3f180d){logger['error'](_0xae11('0x18'),_0x18320a,_0x3f180d);_0x39e8e7(_0x3f180d);});});}exports[_0xae11('0x1c')]=function(_0x2457c6){var _0xdc38b9=this;return new Promise(function(_0x22755f,_0xb74de4){return db['FaxInteraction'][_0xae11('0x1d')](_0x2457c6['body'],{'raw':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')][_0xae11('0x1f')]||null:null,'attributes':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')][_0xae11('0x20')]||null:null,'limit':_0x2457c6[_0xae11('0x1e')]?_0x2457c6[_0xae11('0x1e')][_0xae11('0x21')]||null:null})[_0xae11('0x10')](function(_0x31418a){logger[_0xae11('0x11')](_0xae11('0x1c'),_0x2457c6);logger['debug'](_0xae11('0x1c'),_0x2457c6,JSON['stringify'](_0x31418a));_0x22755f(_0x31418a);})['catch'](function(_0x5b98ea){logger[_0xae11('0x16')](_0xae11('0x1c'),_0x5b98ea[_0xae11('0x19')],_0x2457c6);_0xb74de4(_0xdc38b9[_0xae11('0x16')](0x1f4,_0x5b98ea['message']));});});};exports[_0xae11('0x22')]=function(_0x27c1e2){return new Promise(function(_0x2cadc6,_0x129c4a){return db[_0xae11('0x23')]['find']({'where':_0x27c1e2[_0xae11('0x1e')]?_0x27c1e2[_0xae11('0x1e')][_0xae11('0x1f')]||null:null})[_0xae11('0x10')](function(_0x441d9b){if(_0x441d9b){return _0x441d9b[_0xae11('0x24')](_0x27c1e2['body'][_0xae11('0x25')],_[_0xae11('0x26')](_0x27c1e2['body'],[_0xae11('0x25'),'id'])||{});}})[_0xae11('0x27')](function(_0x1f2d72){logger[_0xae11('0x11')]('AddTags',_0x27c1e2);logger[_0xae11('0x13')](_0xae11('0x28'),_0x27c1e2,JSON['stringify'](_0x1f2d72));_0x2cadc6(_0x1f2d72);})['catch'](function(_0x3cff1d){logger[_0xae11('0x16')](_0xae11('0x28'),_0x3cff1d['message'],_0x27c1e2);_0x129c4a(_this[_0xae11('0x16')](0x1f4,_0x3cff1d['message']));});});}; \ No newline at end of file +var _0x74d6=['spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','addTags','ids','omit'];(function(_0x621fa5,_0x2589b6){var _0xea18a0=function(_0x55498c){while(--_0x55498c){_0x621fa5['push'](_0x621fa5['shift']());}};_0xea18a0(++_0x2589b6);}(_0x74d6,0x1db));var _0x674d=function(_0x1d5933,_0x583e35){_0x1d5933=_0x1d5933-0x0;var _0x202e37=_0x74d6[_0x1d5933];return _0x202e37;};'use strict';var _=require(_0x674d('0x0'));var util=require(_0x674d('0x1'));var moment=require(_0x674d('0x2'));var BPromise=require('bluebird');var rs=require(_0x674d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x674d('0x4'))['db'];var utils=require(_0x674d('0x5'));var logger=require(_0x674d('0x6'))(_0x674d('0x7'));var config=require(_0x674d('0x8'));var jayson=require(_0x674d('0x9'));var client=jayson[_0x674d('0xa')][_0x674d('0xb')]({'port':0x232a});config[_0x674d('0xc')]=_[_0x674d('0xd')](config[_0x674d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x674d('0xe'))(new Redis(config[_0x674d('0xc')]));require('./faxInteraction.socket')[_0x674d('0xf')](socket);function respondWithRpcPromise(_0x28075c,_0x4c0bd7,_0x3d1f3e){return new BPromise(function(_0x148598,_0x5a2d51){return client[_0x674d('0x10')](_0x28075c,_0x3d1f3e)[_0x674d('0x11')](function(_0x10dac2){logger[_0x674d('0x12')](_0x674d('0x13'),_0x4c0bd7,_0x674d('0x14'));logger[_0x674d('0x15')](_0x674d('0x16'),_0x4c0bd7,_0x674d('0x14'),JSON[_0x674d('0x17')](_0x10dac2));if(_0x10dac2[_0x674d('0x18')]){if(_0x10dac2['error'][_0x674d('0x19')]===0x1f4){logger['error'](_0x674d('0x13'),_0x4c0bd7,_0x10dac2[_0x674d('0x18')][_0x674d('0x1a')]);return _0x5a2d51(_0x10dac2['error'][_0x674d('0x1a')]);}logger[_0x674d('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x4c0bd7,_0x10dac2[_0x674d('0x18')][_0x674d('0x1a')]);return _0x148598(_0x10dac2['error'][_0x674d('0x1a')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4c0bd7,_0x674d('0x14'));_0x148598(_0x10dac2['result'][_0x674d('0x1a')]);}})[_0x674d('0x1b')](function(_0x1b8b92){logger[_0x674d('0x18')](_0x674d('0x13'),_0x4c0bd7,_0x1b8b92);_0x5a2d51(_0x1b8b92);});});}exports[_0x674d('0x1c')]=function(_0x35680b){var _0x49d99b=this;return new Promise(function(_0x2138fd,_0xc1e800){return db[_0x674d('0x1d')][_0x674d('0x1e')](_0x35680b[_0x674d('0x1f')],{'raw':_0x35680b[_0x674d('0x20')]?_0x35680b[_0x674d('0x20')][_0x674d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35680b['options']?_0x35680b['options'][_0x674d('0x22')]||null:null,'attributes':_0x35680b[_0x674d('0x20')]?_0x35680b[_0x674d('0x20')][_0x674d('0x23')]||null:null,'limit':_0x35680b[_0x674d('0x20')]?_0x35680b[_0x674d('0x20')][_0x674d('0x24')]||null:null})[_0x674d('0x11')](function(_0x3ec926){logger[_0x674d('0x12')](_0x674d('0x1c'),_0x35680b);logger['debug']('UpdateFaxInteraction',_0x35680b,JSON[_0x674d('0x17')](_0x3ec926));_0x2138fd(_0x3ec926);})[_0x674d('0x1b')](function(_0x225c91){logger[_0x674d('0x18')](_0x674d('0x1c'),_0x225c91[_0x674d('0x1a')],_0x35680b);_0xc1e800(_0x49d99b[_0x674d('0x18')](0x1f4,_0x225c91[_0x674d('0x1a')]));});});};exports[_0x674d('0x25')]=function(_0x4c4dd8){return new Promise(function(_0x5e0ac7,_0x5ac6a2){return db[_0x674d('0x1d')]['find']({'where':_0x4c4dd8[_0x674d('0x20')]?_0x4c4dd8[_0x674d('0x20')][_0x674d('0x22')]||null:null})['then'](function(_0x363370){if(_0x363370){return _0x363370[_0x674d('0x26')](_0x4c4dd8['body'][_0x674d('0x27')],_[_0x674d('0x28')](_0x4c4dd8[_0x674d('0x1f')],['ids','id'])||{});}})[_0x674d('0x29')](function(_0xc53295){logger[_0x674d('0x12')](_0x674d('0x2a'),_0x4c4dd8);logger['debug'](_0x674d('0x2a'),_0x4c4dd8,JSON[_0x674d('0x17')](_0xc53295));_0x5e0ac7(_0xc53295);})[_0x674d('0x1b')](function(_0x38f49d){logger['error']('AddTags',_0x38f49d[_0x674d('0x1a')],_0x4c4dd8);_0x5ac6a2(_this[_0x674d('0x18')](0x1f4,_0x38f49d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 55df2c5..860270a 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 _0xcbdb=['./faxInteraction.events','save','remove','emit','removeListener','register'];(function(_0x55c2ad,_0x558836){var _0x1daf4c=function(_0x269847){while(--_0x269847){_0x55c2ad['push'](_0x55c2ad['shift']());}};_0x1daf4c(++_0x558836);}(_0xcbdb,0x162));var _0xbcbd=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xcbdb[_0xa8883];return _0x479426;};'use strict';var FaxInteractionEvents=require(_0xbcbd('0x0'));var events=[_0xbcbd('0x1'),_0xbcbd('0x2'),'update'];function createListener(_0x3d28cd,_0x1eb7f2){return function(_0x5e2d5f){_0x1eb7f2[_0xbcbd('0x3')](_0x3d28cd,_0x5e2d5f);};}function removeListener(_0xac7588,_0x3c501f){return function(){FaxInteractionEvents[_0xbcbd('0x4')](_0xac7588,_0x3c501f);};}exports[_0xbcbd('0x5')]=function(_0xb9d7ae){for(var _0x4dee4f=0x0,_0x1887ec=events['length'];_0x4dee4f<_0x1887ec;_0x4dee4f++){var _0x1e13c5=events[_0x4dee4f];var _0x483fb2=createListener('faxInteraction:'+_0x1e13c5,_0xb9d7ae);FaxInteractionEvents['on'](_0x1e13c5,_0x483fb2);}}; \ No newline at end of file +var _0xaeb3=['register','./faxInteraction.events','save','remove','removeListener'];(function(_0x32d9fe,_0x213473){var _0x1b8f8e=function(_0x39c16c){while(--_0x39c16c){_0x32d9fe['push'](_0x32d9fe['shift']());}};_0x1b8f8e(++_0x213473);}(_0xaeb3,0x1cd));var _0x3aeb=function(_0xf0339b,_0x21a8ca){_0xf0339b=_0xf0339b-0x0;var _0x14d27f=_0xaeb3[_0xf0339b];return _0x14d27f;};'use strict';var FaxInteractionEvents=require(_0x3aeb('0x0'));var events=[_0x3aeb('0x1'),_0x3aeb('0x2'),'update'];function createListener(_0x9e2adb,_0x5ac256){return function(_0x276085){_0x5ac256['emit'](_0x9e2adb,_0x276085);};}function removeListener(_0x4a25a5,_0x4d259c){return function(){FaxInteractionEvents[_0x3aeb('0x3')](_0x4a25a5,_0x4d259c);};}exports[_0x3aeb('0x4')]=function(_0x3b2212){for(var _0x39edd5=0x0,_0x484be1=events['length'];_0x39edd5<_0x484be1;_0x39edd5++){var _0xfebd1e=events[_0x39edd5];var _0x272e80=createListener('faxInteraction:'+_0xfebd1e,_0x3b2212);FaxInteractionEvents['on'](_0xfebd1e,_0x272e80);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2c3f38d..18ec450 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 _0x6483=['/:id','/:id/messages','/:id/download','post','create','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x6483,0x1e2));var _0x3648=function(_0x2b3812,_0x47ddf3){_0x2b3812=_0x2b3812-0x0;var _0x5e2309=_0x6483[_0x2b3812];return _0x5e2309;};'use strict';var multer=require(_0x3648('0x0'));var util=require(_0x3648('0x1'));var path=require(_0x3648('0x2'));var timeout=require('connect-timeout');var express=require(_0x3648('0x3'));var router=express['Router']();var fs_extra=require(_0x3648('0x4'));var auth=require(_0x3648('0x5'));var interaction=require(_0x3648('0x6'));var config=require(_0x3648('0x7'));var controller=require(_0x3648('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3648('0x9')]);router['get'](_0x3648('0xa'),auth[_0x3648('0xb')](),controller[_0x3648('0xc')]);router[_0x3648('0xd')](_0x3648('0xe'),auth[_0x3648('0xb')](),controller['show']);router['get'](_0x3648('0xf'),auth[_0x3648('0xb')](),controller['getMessages']);router[_0x3648('0xd')](_0x3648('0x10'),auth[_0x3648('0xb')](),controller['download']);router[_0x3648('0x11')]('/',auth[_0x3648('0xb')](),controller[_0x3648('0x12')]);router['post'](_0x3648('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x3648('0x11')](_0x3648('0x13'),auth['isAuthenticated'](),interaction[_0x3648('0x14')]('fax',_0x3648('0x15')),controller[_0x3648('0x16')]);router[_0x3648('0x17')](_0x3648('0xe'),auth[_0x3648('0xb')](),interaction['tracked'](_0x3648('0x18'),'faxinteraction:update'),controller[_0x3648('0x19')]);router[_0x3648('0x1a')](_0x3648('0xe'),auth[_0x3648('0xb')](),interaction[_0x3648('0x14')](_0x3648('0x18'),_0x3648('0x1b')),controller[_0x3648('0x1c')]);router[_0x3648('0x1a')]('/:id/tags',auth[_0x3648('0xb')](),controller[_0x3648('0x1d')]);module[_0x3648('0x1e')]=router; \ No newline at end of file +var _0x2451=['destroy','removeTags','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','update','delete'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x2451,0xb7));var _0x1245=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x2451[_0x39e164];return _0x13fa6b;};'use strict';var multer=require(_0x1245('0x0'));var util=require(_0x1245('0x1'));var path=require(_0x1245('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1245('0x3'));var auth=require(_0x1245('0x4'));var interaction=require(_0x1245('0x5'));var config=require(_0x1245('0x6'));var controller=require(_0x1245('0x7'));router['get']('/',auth[_0x1245('0x8')](),controller[_0x1245('0x9')]);router[_0x1245('0xa')]('/describe',auth[_0x1245('0x8')](),controller['describe']);router['get'](_0x1245('0xb'),auth[_0x1245('0x8')](),controller[_0x1245('0xc')]);router[_0x1245('0xa')](_0x1245('0xd'),auth[_0x1245('0x8')](),controller[_0x1245('0xe')]);router[_0x1245('0xa')](_0x1245('0xf'),auth['isAuthenticated'](),controller[_0x1245('0x10')]);router[_0x1245('0x11')]('/',auth['isAuthenticated'](),controller[_0x1245('0x12')]);router[_0x1245('0x11')](_0x1245('0xd'),auth[_0x1245('0x8')](),controller['addMessage']);router[_0x1245('0x11')](_0x1245('0x13'),auth[_0x1245('0x8')](),interaction[_0x1245('0x14')]('fax',_0x1245('0x15')),controller[_0x1245('0x16')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x1245('0x14')](_0x1245('0x17'),_0x1245('0x18')),controller[_0x1245('0x19')]);router[_0x1245('0x1a')](_0x1245('0xb'),auth[_0x1245('0x8')](),interaction[_0x1245('0x14')]('fax','faxinteraction:destroy'),controller[_0x1245('0x1b')]);router[_0x1245('0x1a')](_0x1245('0x13'),auth['isAuthenticated'](),controller[_0x1245('0x1c')]);module[_0x1245('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index aeefae0..9d18fe5 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 _0xac31=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5e83c2,_0x48a6ae){var _0x41701f=function(_0x1da963){while(--_0x1da963){_0x5e83c2['push'](_0x5e83c2['shift']());}};_0x41701f(++_0x48a6ae);}(_0xac31,0xca));var _0x1ac3=function(_0x2c8640,_0x4fa2f2){_0x2c8640=_0x2c8640-0x0;var _0x21321b=_0xac31[_0x2c8640];return _0x21321b;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'body':{'type':Sequelize[_0x1ac3('0x2')](_0x1ac3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1ac3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ac3('0x5')]('in',_0x1ac3('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1ac3('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1ac3('0x7')]}}; \ No newline at end of file +var _0x4a81=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x381917,_0x2a6d98){var _0x4d2b05=function(_0x8abf90){while(--_0x8abf90){_0x381917['push'](_0x381917['shift']());}};_0x4d2b05(++_0x2a6d98);}(_0x4a81,0x1b7));var _0x14a8=function(_0x1af09f,_0x14b9ec){_0x1af09f=_0x1af09f-0x0;var _0xfab72=_0x4a81[_0x1af09f];return _0xfab72;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'body':{'type':Sequelize[_0x14a8('0x2')](_0x14a8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14a8('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x14a8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x14a8('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 50ec8f9..a261737 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 _0xaecb=['describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','FaxInteraction','RejectMessage','rejectMessage','User','fullname','motionChannel','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','body','find'];(function(_0x40e13e,_0x376d13){var _0x5db39e=function(_0x2dc3f6){while(--_0x2dc3f6){_0x40e13e['push'](_0x40e13e['shift']());}};_0x5db39e(++_0x376d13);}(_0xaecb,0x15e));var _0xbaec=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaecb[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbaec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbaec('0x1'));var jsonpatch=require(_0xbaec('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbaec('0x3'));var Mustache=require(_0xbaec('0x4'));var util=require(_0xbaec('0x5'));var path=require(_0xbaec('0x6'));var sox=require(_0xbaec('0x7'));var csv=require(_0xbaec('0x8'));var ejs=require(_0xbaec('0x9'));var fs=require('fs');var fs_extra=require(_0xbaec('0xa'));var _=require(_0xbaec('0xb'));var squel=require(_0xbaec('0xc'));var crypto=require(_0xbaec('0xd'));var jsforce=require(_0xbaec('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbaec('0xf'));var Redis=require(_0xbaec('0x10'));var authService=require(_0xbaec('0x11'));var qs=require(_0xbaec('0x12'));var as=require(_0xbaec('0x13'));var hardwareService=require(_0xbaec('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbaec('0x15'));var config=require(_0xbaec('0x16'));var licenseUtil=require(_0xbaec('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbaec('0x18')](config[_0xbaec('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbaec('0x1a'))(new Redis(config[_0xbaec('0x19')]));require(_0xbaec('0x1b'))[_0xbaec('0x1c')](socket);var jayson=require(_0xbaec('0x1d'));var client=jayson[_0xbaec('0x1e')][_0xbaec('0x1f')]({'port':0x232c});var client9002=jayson[_0xbaec('0x1e')][_0xbaec('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5ace5c,_0x1efbd7,_0x2d1b62,_0x3ee59){return new BPromise(function(_0x325eec,_0x51a3ea){var _0x1a2ed5=_0x3ee59||client;return _0x1a2ed5[_0xbaec('0x20')](_0x5ace5c,_0x2d1b62)['then'](function(_0x4b93f9){logger[_0xbaec('0x21')](_0xbaec('0x22'),_0x1efbd7,'request\x20sent');logger[_0xbaec('0x23')](_0xbaec('0x24'),_0x1efbd7,'request\x20sent',JSON[_0xbaec('0x25')](_0x4b93f9));if(_0x4b93f9[_0xbaec('0x26')]){if(_0x4b93f9[_0xbaec('0x26')][_0xbaec('0x27')]===0x1f4){logger['error'](_0xbaec('0x22'),_0x1efbd7,_0x4b93f9[_0xbaec('0x26')][_0xbaec('0x28')]);return _0x51a3ea(_0x4b93f9['error'][_0xbaec('0x28')]);}logger[_0xbaec('0x26')](_0xbaec('0x22'),_0x1efbd7,_0x4b93f9['error'][_0xbaec('0x28')]);return _0x325eec(_0x4b93f9[_0xbaec('0x26')][_0xbaec('0x28')]);}else{logger[_0xbaec('0x21')](_0xbaec('0x22'),_0x1efbd7,_0xbaec('0x29'));_0x325eec(_0x4b93f9['result'][_0xbaec('0x28')]);}})[_0xbaec('0x2a')](function(_0x5ab0fa){logger['error'](_0xbaec('0x22'),_0x1efbd7,_0x5ab0fa);_0x51a3ea(_0x5ab0fa);});});}function respondWithStatusCode(_0x523844,_0x556284){_0x556284=_0x556284||0xcc;return function(_0x45c53c){if(_0x45c53c){return _0x523844[_0xbaec('0x2b')](_0x556284);}return _0x523844['status'](_0x556284)[_0xbaec('0x2c')]();};}function respondWithResult(_0x428049,_0x2a0631){_0x2a0631=_0x2a0631||0xc8;return function(_0x5ea86a){if(_0x5ea86a){return _0x428049[_0xbaec('0x2d')](_0x2a0631)[_0xbaec('0x2e')](_0x5ea86a);}};}function respondWithFilteredResult(_0x45eaae,_0x541d4e){return function(_0x34d749){if(_0x34d749){var _0x1e44f9=typeof _0x541d4e['offset']===_0xbaec('0x2f')&&typeof _0x541d4e['limit']===_0xbaec('0x2f');var _0x35129c=_0x34d749[_0xbaec('0x30')];var _0x2db74c=_0x1e44f9?0x0:_0x541d4e[_0xbaec('0x31')];var _0x6cc6ab=_0x1e44f9?_0x34d749[_0xbaec('0x30')]:_0x541d4e[_0xbaec('0x31')]+_0x541d4e[_0xbaec('0x32')];var _0x33582f;if(_0x6cc6ab>=_0x35129c){_0x6cc6ab=_0x35129c;_0x33582f=0xc8;}else{_0x33582f=0xce;}_0x45eaae['status'](_0x33582f);return _0x45eaae['set'](_0xbaec('0x33'),_0x2db74c+'-'+_0x6cc6ab+'/'+_0x35129c)['json'](_0x34d749);}return null;};}function patchUpdates(_0x29252e){return function(_0xb0b842){try{jsonpatch[_0xbaec('0x34')](_0xb0b842,_0x29252e,!![]);}catch(_0x1d3e1d){return BPromise[_0xbaec('0x35')](_0x1d3e1d);}return _0xb0b842[_0xbaec('0x36')]();};}function saveUpdates(_0x584e92,_0x53ef37){return function(_0x276dfe){if(_0x276dfe){return _0x276dfe[_0xbaec('0x37')](_0x584e92)[_0xbaec('0x38')](function(_0x424f16){return _0x424f16;});}return null;};}function removeEntity(_0x31b229,_0x34b892){return function(_0x508360){if(_0x508360){return _0x508360[_0xbaec('0x39')]()[_0xbaec('0x38')](function(){_0x31b229[_0xbaec('0x2d')](0xcc)[_0xbaec('0x2c')]();});}};}function handleEntityNotFound(_0x469633,_0x3f9238){return function(_0x2cc981){if(!_0x2cc981){_0x469633['sendStatus'](0x194);}return _0x2cc981;};}function handleError(_0x508043,_0x799b6c){_0x799b6c=_0x799b6c||0x1f4;return function(_0x16fc2c){logger['error'](_0x16fc2c['stack']);if(_0x16fc2c[_0xbaec('0x3a')]){delete _0x16fc2c[_0xbaec('0x3a')];}_0x508043[_0xbaec('0x2d')](_0x799b6c)[_0xbaec('0x3b')](_0x16fc2c);};}exports[_0xbaec('0x3c')]=function(_0x24cc90,_0x5dd61a){var _0x4988b2={},_0x4aadb5={},_0x433645={'count':0x0,'rows':[]};var _0x3cb99d=_[_0xbaec('0x3d')](db[_0xbaec('0x3e')][_0xbaec('0x3f')],function(_0x2a7299){return{'name':_0x2a7299[_0xbaec('0x40')],'type':_0x2a7299[_0xbaec('0x41')][_0xbaec('0x42')]};});_0x4aadb5['model']=_[_0xbaec('0x3d')](_0x3cb99d,'name');_0x4aadb5['query']=_['keys'](_0x24cc90[_0xbaec('0x43')]);_0x4aadb5[_0xbaec('0x44')]=_[_0xbaec('0x45')](_0x4aadb5[_0xbaec('0x46')],_0x4aadb5['query']);_0x4988b2[_0xbaec('0x47')]=_[_0xbaec('0x45')](_0x4aadb5[_0xbaec('0x46')],qs[_0xbaec('0x48')](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x48')]));_0x4988b2[_0xbaec('0x47')]=_0x4988b2['attributes'][_0xbaec('0x49')]?_0x4988b2[_0xbaec('0x47')]:_0x4aadb5[_0xbaec('0x46')];if(!_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4a')](_0xbaec('0x4b'))){_0x4988b2[_0xbaec('0x32')]=qs['limit'](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x32')]);_0x4988b2['offset']=qs[_0xbaec('0x31')](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x31')]);}_0x4988b2[_0xbaec('0x4c')]=qs[_0xbaec('0x4d')](_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4d')]);_0x4988b2['where']=qs[_0xbaec('0x44')](_['pick'](_0x24cc90[_0xbaec('0x43')],_0x4aadb5[_0xbaec('0x44')]),_0x3cb99d);if(_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4e')]){_0x4988b2[_0xbaec('0x4f')]=_[_0xbaec('0x50')](_0x4988b2[_0xbaec('0x4f')],{'$or':_[_0xbaec('0x3d')](_0x3cb99d,function(_0xbc38e){if(_0xbc38e['type']!==_0xbaec('0x51')){var _0x29ea57={};_0x29ea57[_0xbc38e['name']]={'$like':'%'+_0x24cc90[_0xbaec('0x43')][_0xbaec('0x4e')]+'%'};return _0x29ea57;}})});}_0x4988b2=_['merge']({},_0x4988b2,_0x24cc90[_0xbaec('0x52')]);var _0x150c95={'where':_0x4988b2[_0xbaec('0x4f')]};return db['FaxMessage']['count'](_0x150c95)[_0xbaec('0x38')](function(_0x19435a){_0x433645[_0xbaec('0x30')]=_0x19435a;if(_0x24cc90[_0xbaec('0x43')][_0xbaec('0x53')]){_0x4988b2[_0xbaec('0x54')]=[{'all':!![]}];}return db[_0xbaec('0x3e')][_0xbaec('0x55')](_0x4988b2);})[_0xbaec('0x38')](function(_0x120530){_0x433645['rows']=_0x120530;return _0x433645;})[_0xbaec('0x38')](respondWithFilteredResult(_0x5dd61a,_0x4988b2))[_0xbaec('0x2a')](handleError(_0x5dd61a,null));};exports[_0xbaec('0x56')]=function(_0x1fde2e,_0x211b93){var _0x505d0c={'raw':!![],'where':{'id':_0x1fde2e[_0xbaec('0x57')]['id']}},_0x1f1102={};_0x1f1102[_0xbaec('0x46')]=_[_0xbaec('0x58')](db['FaxMessage'][_0xbaec('0x3f')]);_0x1f1102[_0xbaec('0x43')]=_[_0xbaec('0x58')](_0x1fde2e['query']);_0x1f1102[_0xbaec('0x44')]=_['intersection'](_0x1f1102['model'],_0x1f1102[_0xbaec('0x43')]);_0x505d0c['attributes']=_[_0xbaec('0x45')](_0x1f1102['model'],qs[_0xbaec('0x48')](_0x1fde2e[_0xbaec('0x43')][_0xbaec('0x48')]));_0x505d0c['attributes']=_0x505d0c[_0xbaec('0x47')][_0xbaec('0x49')]?_0x505d0c['attributes']:_0x1f1102['model'];if(_0x1fde2e[_0xbaec('0x43')][_0xbaec('0x53')]){_0x505d0c[_0xbaec('0x54')]=[{'all':!![]}];}_0x505d0c=_[_0xbaec('0x50')]({},_0x505d0c,_0x1fde2e['options']);return db[_0xbaec('0x3e')]['find'](_0x505d0c)[_0xbaec('0x38')](handleEntityNotFound(_0x211b93,null))['then'](respondWithResult(_0x211b93,null))['catch'](handleError(_0x211b93,null));};exports[_0xbaec('0x37')]=function(_0x41f906,_0x3b86d6){if(_0x41f906['body']['id']){delete _0x41f906[_0xbaec('0x59')]['id'];}return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x41f906[_0xbaec('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b86d6,null))['then'](saveUpdates(_0x41f906[_0xbaec('0x59')],null))[_0xbaec('0x38')](respondWithResult(_0x3b86d6,null))['catch'](handleError(_0x3b86d6,null));};exports['destroy']=function(_0x383a5b,_0x1752db){return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x383a5b['params']['id']}})[_0xbaec('0x38')](handleEntityNotFound(_0x1752db,null))['then'](removeEntity(_0x1752db,null))[_0xbaec('0x2a')](handleError(_0x1752db,null));};exports[_0xbaec('0x5b')]=function(_0x2b3156,_0x318817){return db[_0xbaec('0x3e')]['describe']()[_0xbaec('0x38')](respondWithResult(_0x318817,null))[_0xbaec('0x2a')](handleError(_0x318817,null));};var interaction_log=require(_0xbaec('0x5c'))('fax-interactions');exports[_0xbaec('0x5d')]=function(_0x14a273,_0x4ed988,_0x344654){var _0x3930aa={'agent':{},'channel':'fax'};if(_0x14a273['body']['id']){delete _0x14a273[_0xbaec('0x59')]['id'];}_0x14a273[_0xbaec('0x59')][_0xbaec('0x5e')]=!![];_0x14a273[_0xbaec('0x59')][_0xbaec('0x5f')]=moment()[_0xbaec('0x60')](_0xbaec('0x61'));_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')]=_0x14a273[_0xbaec('0x59')]['UserId']||_0x14a273[_0xbaec('0x63')]['id'];_0x3930aa[_0xbaec('0x64')]['id']=_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')];return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x14a273[_0xbaec('0x57')]['id'],'UserId':null}})[_0xbaec('0x38')](handleEntityNotFound(_0x4ed988,null))[_0xbaec('0x38')](saveUpdates(_0x14a273['body'],null))[_0xbaec('0x38')](function(_0x399bb8){if(_0x399bb8){_0x3930aa['message']=_0x399bb8[_0xbaec('0x65')]({'plain':!![]});return db['FaxInteraction'][_0xbaec('0x5a')]({'where':{'id':_0x399bb8[_0xbaec('0x66')]}});}return null;})[_0xbaec('0x38')](handleEntityNotFound(_0x4ed988,null))['then'](function(_0x905c6a){if(_0x905c6a){return _0x905c6a[_0xbaec('0x37')]({'UserId':_0x14a273[_0xbaec('0x59')]['UserId'],'read1stAt':_[_0xbaec('0x67')](_0x905c6a[_0xbaec('0x68')])?moment()[_0xbaec('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbaec('0x38')](function(_0x3f95b2){if(_0x3f95b2){_0x3930aa['interaction']=_0x3f95b2[_0xbaec('0x65')]({'plain':!![]});interaction_log['info'](_0xbaec('0x69'),_0x14a273['user']['id'],_0x14a273['user'][_0xbaec('0x3a')],_0x14a273['user'][_0xbaec('0x6a')],_0x3930aa[_0xbaec('0x6b')]['id'],_0x14a273['body']?JSON['stringify'](_0x14a273['body']):_0xbaec('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xbaec('0x6d'),_0x3930aa);}return null;})['then'](function(_0x33a749){var _0x4b6d3d=_0xbaec('0x6e')+_0x33a749['message'][_0xbaec('0x6f')];return db[_0xbaec('0x70')][_0xbaec('0x43')](_0x4b6d3d,{'type':db[_0xbaec('0x71')][_0xbaec('0x72')][_0xbaec('0x73')],'raw':!![]})['then'](function(_0x2a1354){return _0x2a1354;});})[_0xbaec('0x38')](function(_0x393114){if(_0x393114){_0x3930aa[_0xbaec('0x28')][_0xbaec('0x74')]=_0x393114[0x0];if(!_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')])return;return db['User'][_0xbaec('0x5a')]({'where':{'id':_0x14a273[_0xbaec('0x59')][_0xbaec('0x62')],'role':_0xbaec('0x64')},'attributes':['id','name','fullname',_0xbaec('0x75'),_0xbaec('0x76')],'raw':!![]});}return null;})[_0xbaec('0x38')](function(_0x52ec41){if(!_0x52ec41)return null;_0x3930aa[_0xbaec('0x28')]['agent']=_0x52ec41;return _0x3930aa;})[_0xbaec('0x38')](function(_0x63974c){if(_0x63974c){if(_0x14a273[_0xbaec('0x59')][_0xbaec('0x77')]){_0x3930aa[_0xbaec('0x28')][_0xbaec('0x78')]=util['format'](_0xbaec('0x79'),_0x14a273[_0xbaec('0x63')][_0xbaec('0x3a')]);_0x3930aa[_0xbaec('0x28')][_0xbaec('0x7a')]=_0x3930aa[_0xbaec('0x7a')];_0x3930aa['message']['motionChannel']=_0x3930aa[_0xbaec('0x7a')];_0x3930aa[_0xbaec('0x28')][_0xbaec('0x7b')]=_0xbaec('0x5d');return respondWithRpcPromise(_0xbaec('0x7c'),_0xbaec('0x7c'),{'event':_0xbaec('0x7d'),'message':_0x3930aa['message']},client9002)['then'](function(){return _0x3930aa;});}return _0x3930aa;}return null;})['then'](respondWithResult(_0x4ed988,null))['catch'](handleError(_0x4ed988,null));};var interaction_log=require(_0xbaec('0x5c'))('fax-interactions');exports[_0xbaec('0x35')]=function(_0x152ed3,_0x1cfa53,_0x1acfab){var _0x556599={'agent':{},'channel':_0xbaec('0x7e')};if(_0x152ed3['body']['id']){delete _0x152ed3['body']['id'];}_0x152ed3['body'][_0xbaec('0x62')]=_0x152ed3['body'][_0xbaec('0x62')]||_0x152ed3[_0xbaec('0x63')]['id'];_0x556599[_0xbaec('0x64')]['id']=_0x152ed3['body']['UserId'];return db[_0xbaec('0x3e')][_0xbaec('0x5a')]({'where':{'id':_0x152ed3['params']['id'],'UserId':null}})[_0xbaec('0x38')](handleEntityNotFound(_0x1cfa53,null))['then'](function(_0x378539){if(_0x378539){_0x556599[_0xbaec('0x28')]=_0x378539['get']({'plain':!![]});return db[_0xbaec('0x7f')][_0xbaec('0x5a')]({'where':{'id':_0x378539[_0xbaec('0x66')]}});}return null;})[_0xbaec('0x38')](handleEntityNotFound(_0x1cfa53,null))[_0xbaec('0x38')](function(_0x4a73fe){if(_0x4a73fe){_0x556599['interaction']=_0x4a73fe['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x152ed3[_0xbaec('0x63')]['id'],_0x152ed3[_0xbaec('0x63')]['name'],_0x152ed3[_0xbaec('0x63')][_0xbaec('0x6a')],_0x556599['interaction']['id'],_0x152ed3['body']?JSON[_0xbaec('0x25')](_0x152ed3[_0xbaec('0x59')]):'null');return respondWithRpcPromise(_0xbaec('0x80'),_0xbaec('0x81'),_0x556599);}return null;})[_0xbaec('0x38')](function(_0x1217e4){var _0x37398c=_0xbaec('0x6e')+_0x1217e4[_0xbaec('0x28')][_0xbaec('0x6f')];return db[_0xbaec('0x70')][_0xbaec('0x43')](_0x37398c,{'type':db[_0xbaec('0x71')][_0xbaec('0x72')]['SELECT'],'raw':!![]})[_0xbaec('0x38')](function(_0x275daa){return _0x275daa;});})[_0xbaec('0x38')](function(_0xe26507){if(_0xe26507){_0x556599['message']['contact']=_0xe26507[0x0];if(!_0x152ed3[_0xbaec('0x59')]['UserId'])return;return db[_0xbaec('0x82')][_0xbaec('0x5a')]({'where':{'id':_0x152ed3[_0xbaec('0x59')][_0xbaec('0x62')],'role':_0xbaec('0x64')},'attributes':['id',_0xbaec('0x3a'),_0xbaec('0x83'),_0xbaec('0x75'),_0xbaec('0x76')],'raw':!![]});}return null;})[_0xbaec('0x38')](function(_0x125a8a){if(!_0x125a8a)return null;_0x556599[_0xbaec('0x28')][_0xbaec('0x64')]=_0x125a8a;return _0x556599;})['then'](function(_0x4e2b3c){if(_0x4e2b3c){_0x4e2b3c['message'][_0xbaec('0x78')]=util[_0xbaec('0x60')](_0xbaec('0x79'),_0x152ed3['user'][_0xbaec('0x3a')]);_0x4e2b3c[_0xbaec('0x28')]['channel']=_0x556599[_0xbaec('0x7a')];_0x4e2b3c[_0xbaec('0x28')][_0xbaec('0x84')]=_0x556599[_0xbaec('0x7a')];_0x4e2b3c['message'][_0xbaec('0x7b')]=_0xbaec('0x35');respondWithRpcPromise('EventManager',_0xbaec('0x7c'),{'event':_0xbaec('0x85'),'message':_0x4e2b3c[_0xbaec('0x28')]},client9002);return _0x556599;}return null;})[_0xbaec('0x38')](respondWithResult(_0x1cfa53,null))[_0xbaec('0x2a')](handleError(_0x1cfa53,null));};exports['create']=function(_0x145517,_0x1784e4){var _0x4a7d3b;return db['FaxMessage'][_0xbaec('0x86')](_0x145517[_0xbaec('0x59')],{})[_0xbaec('0x38')](function(_0x165713){_0x4a7d3b=_0x165713;return db['CmContact']['findOne']({'where':{'id':_0x4a7d3b[_0xbaec('0x6f')]}});})[_0xbaec('0x38')](function(_0x7d6b11){if(_[_0xbaec('0x67')](_0x7d6b11)){return;}else{_0x4a7d3b[_0xbaec('0x7e')]=_0x7d6b11[_0xbaec('0x7e')];return db['Attachment'][_0xbaec('0x87')]({'where':{'id':_0x4a7d3b[_0xbaec('0x88')]}});}})[_0xbaec('0x38')](function(_0xb89b70){return respondWithRpcPromise(_0xbaec('0x89'),_0xbaec('0x89'),{'FaxAccountId':_[_0xbaec('0x67')](_0x145517[_0xbaec('0x59')])?undefined:_0x145517[_0xbaec('0x59')][_0xbaec('0x8a')],'path':_[_0xbaec('0x67')](_0xb89b70)?undefined:util[_0xbaec('0x60')](_0xbaec('0x8b'),_0xb89b70[_0xbaec('0x8c')]),'fax':_[_0xbaec('0x67')](_0x4a7d3b[_0xbaec('0x7e')])?undefined:_0x4a7d3b[_0xbaec('0x7e')],'AttachmentId':_0x4a7d3b[_0xbaec('0x88')]},client9002);})[_0xbaec('0x38')](respondWithResult(_0x1784e4,0xc9))[_0xbaec('0x2a')](handleError(_0x1784e4,null));};exports[_0xbaec('0x8d')]=function(_0x4d787f,_0x2f4cce){var _0x5ab5ee=path[_0xbaec('0x8e')](config['root'],_0xbaec('0x8f'),_0xbaec('0x90'),_0xbaec('0x91'));return db['FaxMessage'][_0xbaec('0x5a')]({'where':{'id':_0x4d787f[_0xbaec('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0xbaec('0x92')}]})[_0xbaec('0x38')](handleEntityNotFound(_0x2f4cce,null))[_0xbaec('0x38')](function(_0x89e506){if(_0x89e506){return _0x2f4cce['download'](path[_0xbaec('0x8e')](_0x5ab5ee,_0x89e506[_0xbaec('0x92')]['basename']));}})['catch'](handleError(_0x2f4cce,null));}; \ No newline at end of file +var _0xfedd=['apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','rawAttributes','key','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','pick','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','params','length','include','options','find','body','describe','../../config/logger','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE: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','fullname','email','internal','interface','channel','motionChannel','accept','EventManager','acceptmessage','fax-interactions','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x4569cb,_0x2c4969){var _0x137d51=function(_0x2b9d09){while(--_0x2b9d09){_0x4569cb['push'](_0x4569cb['shift']());}};_0x137d51(++_0x2c4969);}(_0xfedd,0x187));var _0xdfed=function(_0x5dd13a,_0xb74bf){_0x5dd13a=_0x5dd13a-0x0;var _0x22f845=_0xfedd[_0x5dd13a];return _0x22f845;};'use strict';var emlformat=require(_0xdfed('0x0'));var rimraf=require(_0xdfed('0x1'));var zipdir=require(_0xdfed('0x2'));var jsonpatch=require(_0xdfed('0x3'));var rp=require('request-promise');var moment=require(_0xdfed('0x4'));var BPromise=require(_0xdfed('0x5'));var Mustache=require(_0xdfed('0x6'));var util=require(_0xdfed('0x7'));var path=require(_0xdfed('0x8'));var sox=require(_0xdfed('0x9'));var csv=require(_0xdfed('0xa'));var ejs=require(_0xdfed('0xb'));var fs=require('fs');var fs_extra=require(_0xdfed('0xc'));var _=require(_0xdfed('0xd'));var squel=require(_0xdfed('0xe'));var crypto=require(_0xdfed('0xf'));var jsforce=require(_0xdfed('0x10'));var deskjs=require(_0xdfed('0x11'));var toCsv=require(_0xdfed('0xa'));var querystring=require(_0xdfed('0x12'));var Papa=require(_0xdfed('0x13'));var Redis=require(_0xdfed('0x14'));var authService=require(_0xdfed('0x15'));var qs=require(_0xdfed('0x16'));var as=require(_0xdfed('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdfed('0x18'));var utils=require(_0xdfed('0x19'));var config=require(_0xdfed('0x1a'));var licenseUtil=require(_0xdfed('0x1b'));var db=require(_0xdfed('0x1c'))['db'];config[_0xdfed('0x1d')]=_[_0xdfed('0x1e')](config[_0xdfed('0x1d')],{'host':_0xdfed('0x1f'),'port':0x18eb});var socket=require(_0xdfed('0x20'))(new Redis(config[_0xdfed('0x1d')]));require(_0xdfed('0x21'))[_0xdfed('0x22')](socket);var jayson=require(_0xdfed('0x23'));var client=jayson[_0xdfed('0x24')]['http']({'port':0x232c});var client9002=jayson[_0xdfed('0x24')][_0xdfed('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x38b820,_0xf88f77,_0x20302a,_0xe81388){return new BPromise(function(_0x399495,_0x570778){var _0x590e06=_0xe81388||client;return _0x590e06['request'](_0x38b820,_0x20302a)[_0xdfed('0x26')](function(_0x191c32){logger[_0xdfed('0x27')](_0xdfed('0x28'),_0xf88f77,_0xdfed('0x29'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xf88f77,'request\x20sent',JSON[_0xdfed('0x2a')](_0x191c32));if(_0x191c32[_0xdfed('0x2b')]){if(_0x191c32[_0xdfed('0x2b')]['code']===0x1f4){logger[_0xdfed('0x2b')](_0xdfed('0x28'),_0xf88f77,_0x191c32[_0xdfed('0x2b')][_0xdfed('0x2c')]);return _0x570778(_0x191c32[_0xdfed('0x2b')][_0xdfed('0x2c')]);}logger[_0xdfed('0x2b')](_0xdfed('0x28'),_0xf88f77,_0x191c32[_0xdfed('0x2b')]['message']);return _0x399495(_0x191c32[_0xdfed('0x2b')][_0xdfed('0x2c')]);}else{logger[_0xdfed('0x27')](_0xdfed('0x28'),_0xf88f77,_0xdfed('0x29'));_0x399495(_0x191c32[_0xdfed('0x2d')]['message']);}})[_0xdfed('0x2e')](function(_0x27f7d9){logger[_0xdfed('0x2b')](_0xdfed('0x28'),_0xf88f77,_0x27f7d9);_0x570778(_0x27f7d9);});});}function respondWithStatusCode(_0xf970cb,_0x198a2c){_0x198a2c=_0x198a2c||0xcc;return function(_0x3e7946){if(_0x3e7946){return _0xf970cb[_0xdfed('0x2f')](_0x198a2c);}return _0xf970cb[_0xdfed('0x30')](_0x198a2c)[_0xdfed('0x31')]();};}function respondWithResult(_0x306c83,_0x344de4){_0x344de4=_0x344de4||0xc8;return function(_0x35ca01){if(_0x35ca01){return _0x306c83['status'](_0x344de4)[_0xdfed('0x32')](_0x35ca01);}};}function respondWithFilteredResult(_0x9ac35a,_0x5d0ae6){return function(_0x1f6b51){if(_0x1f6b51){var _0x508398=typeof _0x5d0ae6[_0xdfed('0x33')]===_0xdfed('0x34')&&typeof _0x5d0ae6[_0xdfed('0x35')]===_0xdfed('0x34');var _0x3a1b72=_0x1f6b51['count'];var _0x426289=_0x508398?0x0:_0x5d0ae6[_0xdfed('0x33')];var _0x349762=_0x508398?_0x1f6b51['count']:_0x5d0ae6[_0xdfed('0x33')]+_0x5d0ae6['limit'];var _0x56e33c;if(_0x349762>=_0x3a1b72){_0x349762=_0x3a1b72;_0x56e33c=0xc8;}else{_0x56e33c=0xce;}_0x9ac35a['status'](_0x56e33c);return _0x9ac35a[_0xdfed('0x36')](_0xdfed('0x37'),_0x426289+'-'+_0x349762+'/'+_0x3a1b72)[_0xdfed('0x32')](_0x1f6b51);}return null;};}function patchUpdates(_0x9de0ed){return function(_0x1917ef){try{jsonpatch[_0xdfed('0x38')](_0x1917ef,_0x9de0ed,!![]);}catch(_0x2f0f14){return BPromise[_0xdfed('0x39')](_0x2f0f14);}return _0x1917ef[_0xdfed('0x3a')]();};}function saveUpdates(_0x53872c,_0x1e0315){return function(_0x518942){if(_0x518942){return _0x518942[_0xdfed('0x3b')](_0x53872c)[_0xdfed('0x26')](function(_0x51acb6){return _0x51acb6;});}return null;};}function removeEntity(_0x2daf25,_0x3d2d7c){return function(_0x466dca){if(_0x466dca){return _0x466dca[_0xdfed('0x3c')]()[_0xdfed('0x26')](function(){_0x2daf25['status'](0xcc)[_0xdfed('0x31')]();});}};}function handleEntityNotFound(_0xc94f53,_0x30c0b6){return function(_0x2a578d){if(!_0x2a578d){_0xc94f53[_0xdfed('0x2f')](0x194);}return _0x2a578d;};}function handleError(_0x530f1c,_0x2aed9e){_0x2aed9e=_0x2aed9e||0x1f4;return function(_0x1b6465){logger['error'](_0x1b6465[_0xdfed('0x3d')]);if(_0x1b6465[_0xdfed('0x3e')]){delete _0x1b6465['name'];}_0x530f1c[_0xdfed('0x30')](_0x2aed9e)[_0xdfed('0x3f')](_0x1b6465);};}exports[_0xdfed('0x40')]=function(_0x199da6,_0x1aff15){var _0x5abf32={},_0xd5ecf4={},_0x114339={'count':0x0,'rows':[]};var _0x9eac50=_['map'](db[_0xdfed('0x41')][_0xdfed('0x42')],function(_0x1840c3){return{'name':_0x1840c3['fieldName'],'type':_0x1840c3['type'][_0xdfed('0x43')]};});_0xd5ecf4['model']=_[_0xdfed('0x44')](_0x9eac50,'name');_0xd5ecf4[_0xdfed('0x45')]=_[_0xdfed('0x46')](_0x199da6[_0xdfed('0x45')]);_0xd5ecf4['filters']=_['intersection'](_0xd5ecf4[_0xdfed('0x47')],_0xd5ecf4[_0xdfed('0x45')]);_0x5abf32[_0xdfed('0x48')]=_[_0xdfed('0x49')](_0xd5ecf4['model'],qs['fields'](_0x199da6[_0xdfed('0x45')][_0xdfed('0x4a')]));_0x5abf32['attributes']=_0x5abf32['attributes']['length']?_0x5abf32[_0xdfed('0x48')]:_0xd5ecf4[_0xdfed('0x47')];if(!_0x199da6[_0xdfed('0x45')][_0xdfed('0x4b')]('nolimit')){_0x5abf32['limit']=qs['limit'](_0x199da6['query'][_0xdfed('0x35')]);_0x5abf32[_0xdfed('0x33')]=qs[_0xdfed('0x33')](_0x199da6[_0xdfed('0x45')]['offset']);}_0x5abf32['order']=qs[_0xdfed('0x4c')](_0x199da6[_0xdfed('0x45')][_0xdfed('0x4c')]);_0x5abf32['where']=qs['filters'](_[_0xdfed('0x4d')](_0x199da6[_0xdfed('0x45')],_0xd5ecf4[_0xdfed('0x4e')]),_0x9eac50);if(_0x199da6[_0xdfed('0x45')][_0xdfed('0x4f')]){_0x5abf32[_0xdfed('0x50')]=_[_0xdfed('0x51')](_0x5abf32['where'],{'$or':_['map'](_0x9eac50,function(_0x5089f7){if(_0x5089f7['type']!==_0xdfed('0x52')){var _0x5aa468={};_0x5aa468[_0x5089f7[_0xdfed('0x3e')]]={'$like':'%'+_0x199da6['query'][_0xdfed('0x4f')]+'%'};return _0x5aa468;}})});}_0x5abf32=_[_0xdfed('0x51')]({},_0x5abf32,_0x199da6['options']);var _0x27f8d={'where':_0x5abf32[_0xdfed('0x50')]};return db[_0xdfed('0x41')][_0xdfed('0x53')](_0x27f8d)['then'](function(_0x4acc39){_0x114339['count']=_0x4acc39;if(_0x199da6[_0xdfed('0x45')][_0xdfed('0x54')]){_0x5abf32['include']=[{'all':!![]}];}return db[_0xdfed('0x41')][_0xdfed('0x55')](_0x5abf32);})[_0xdfed('0x26')](function(_0x36f3f9){_0x114339['rows']=_0x36f3f9;return _0x114339;})[_0xdfed('0x26')](respondWithFilteredResult(_0x1aff15,_0x5abf32))[_0xdfed('0x2e')](handleError(_0x1aff15,null));};exports['show']=function(_0x3a2436,_0x5ee63f){var _0x5e8851={'raw':!![],'where':{'id':_0x3a2436[_0xdfed('0x56')]['id']}},_0x36613b={};_0x36613b[_0xdfed('0x47')]=_[_0xdfed('0x46')](db[_0xdfed('0x41')][_0xdfed('0x42')]);_0x36613b[_0xdfed('0x45')]=_[_0xdfed('0x46')](_0x3a2436['query']);_0x36613b[_0xdfed('0x4e')]=_['intersection'](_0x36613b[_0xdfed('0x47')],_0x36613b[_0xdfed('0x45')]);_0x5e8851[_0xdfed('0x48')]=_[_0xdfed('0x49')](_0x36613b[_0xdfed('0x47')],qs[_0xdfed('0x4a')](_0x3a2436[_0xdfed('0x45')][_0xdfed('0x4a')]));_0x5e8851[_0xdfed('0x48')]=_0x5e8851[_0xdfed('0x48')][_0xdfed('0x57')]?_0x5e8851[_0xdfed('0x48')]:_0x36613b['model'];if(_0x3a2436['query'][_0xdfed('0x54')]){_0x5e8851[_0xdfed('0x58')]=[{'all':!![]}];}_0x5e8851=_[_0xdfed('0x51')]({},_0x5e8851,_0x3a2436[_0xdfed('0x59')]);return db[_0xdfed('0x41')][_0xdfed('0x5a')](_0x5e8851)[_0xdfed('0x26')](handleEntityNotFound(_0x5ee63f,null))[_0xdfed('0x26')](respondWithResult(_0x5ee63f,null))[_0xdfed('0x2e')](handleError(_0x5ee63f,null));};exports[_0xdfed('0x3b')]=function(_0x3b0fb5,_0x587b87){if(_0x3b0fb5['body']['id']){delete _0x3b0fb5[_0xdfed('0x5b')]['id'];}return db[_0xdfed('0x41')][_0xdfed('0x5a')]({'where':{'id':_0x3b0fb5[_0xdfed('0x56')]['id']}})[_0xdfed('0x26')](handleEntityNotFound(_0x587b87,null))['then'](saveUpdates(_0x3b0fb5[_0xdfed('0x5b')],null))[_0xdfed('0x26')](respondWithResult(_0x587b87,null))[_0xdfed('0x2e')](handleError(_0x587b87,null));};exports[_0xdfed('0x3c')]=function(_0x24c67f,_0x18b77d){return db[_0xdfed('0x41')][_0xdfed('0x5a')]({'where':{'id':_0x24c67f[_0xdfed('0x56')]['id']}})[_0xdfed('0x26')](handleEntityNotFound(_0x18b77d,null))[_0xdfed('0x26')](removeEntity(_0x18b77d,null))['catch'](handleError(_0x18b77d,null));};exports['describe']=function(_0x1adefc,_0x51064b){return db[_0xdfed('0x41')][_0xdfed('0x5c')]()['then'](respondWithResult(_0x51064b,null))[_0xdfed('0x2e')](handleError(_0x51064b,null));};var interaction_log=require(_0xdfed('0x5d'))('fax-interactions');exports['accept']=function(_0x2adc70,_0x8d159a,_0x5c48cd){var _0x231766={'agent':{},'channel':_0xdfed('0x5e')};if(_0x2adc70[_0xdfed('0x5b')]['id']){delete _0x2adc70[_0xdfed('0x5b')]['id'];}_0x2adc70[_0xdfed('0x5b')][_0xdfed('0x5f')]=!![];_0x2adc70['body']['readAt']=moment()[_0xdfed('0x60')](_0xdfed('0x61'));_0x2adc70[_0xdfed('0x5b')][_0xdfed('0x62')]=_0x2adc70[_0xdfed('0x5b')][_0xdfed('0x62')]||_0x2adc70['user']['id'];_0x231766[_0xdfed('0x63')]['id']=_0x2adc70[_0xdfed('0x5b')]['UserId'];return db[_0xdfed('0x41')][_0xdfed('0x5a')]({'where':{'id':_0x2adc70[_0xdfed('0x56')]['id'],'UserId':null}})[_0xdfed('0x26')](handleEntityNotFound(_0x8d159a,null))[_0xdfed('0x26')](saveUpdates(_0x2adc70['body'],null))[_0xdfed('0x26')](function(_0x159355){if(_0x159355){_0x231766['message']=_0x159355[_0xdfed('0x64')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x159355[_0xdfed('0x65')]}});}return null;})[_0xdfed('0x26')](handleEntityNotFound(_0x8d159a,null))[_0xdfed('0x26')](function(_0x1ae825){if(_0x1ae825){return _0x1ae825[_0xdfed('0x3b')]({'UserId':_0x2adc70['body'][_0xdfed('0x62')],'read1stAt':_[_0xdfed('0x66')](_0x1ae825[_0xdfed('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdfed('0x26')](function(_0x532638){if(_0x532638){_0x231766[_0xdfed('0x68')]=_0x532638['get']({'plain':!![]});interaction_log[_0xdfed('0x27')](_0xdfed('0x69'),_0x2adc70[_0xdfed('0x6a')]['id'],_0x2adc70[_0xdfed('0x6a')][_0xdfed('0x3e')],_0x2adc70['user'][_0xdfed('0x6b')],_0x231766[_0xdfed('0x68')]['id'],_0x2adc70['body']?JSON[_0xdfed('0x2a')](_0x2adc70[_0xdfed('0x5b')]):_0xdfed('0x6c'));return respondWithRpcPromise(_0xdfed('0x6d'),_0xdfed('0x6e'),_0x231766);}return null;})[_0xdfed('0x26')](function(_0x480b46){var _0x54c5ad=_0xdfed('0x6f')+_0x480b46['message'][_0xdfed('0x70')];return db['sequelize'][_0xdfed('0x45')](_0x54c5ad,{'type':db[_0xdfed('0x71')][_0xdfed('0x72')][_0xdfed('0x73')],'raw':!![]})[_0xdfed('0x26')](function(_0x9e9611){return _0x9e9611;});})['then'](function(_0x1c3113){if(_0x1c3113){_0x231766[_0xdfed('0x2c')][_0xdfed('0x74')]=_0x1c3113[0x0];if(!_0x2adc70[_0xdfed('0x5b')][_0xdfed('0x62')])return;return db[_0xdfed('0x75')][_0xdfed('0x5a')]({'where':{'id':_0x2adc70[_0xdfed('0x5b')]['UserId'],'role':_0xdfed('0x63')},'attributes':['id',_0xdfed('0x3e'),_0xdfed('0x76'),_0xdfed('0x77'),_0xdfed('0x78')],'raw':!![]});}return null;})[_0xdfed('0x26')](function(_0x35547e){if(!_0x35547e)return null;_0x231766[_0xdfed('0x2c')][_0xdfed('0x63')]=_0x35547e;return _0x231766;})[_0xdfed('0x26')](function(_0x3ddc23){if(_0x3ddc23){if(_0x2adc70[_0xdfed('0x5b')]['manual']){_0x231766[_0xdfed('0x2c')][_0xdfed('0x79')]=util[_0xdfed('0x60')]('SIP/%s',_0x2adc70[_0xdfed('0x6a')]['name']);_0x231766[_0xdfed('0x2c')][_0xdfed('0x7a')]=_0x231766[_0xdfed('0x7a')];_0x231766[_0xdfed('0x2c')][_0xdfed('0x7b')]=_0x231766[_0xdfed('0x7a')];_0x231766[_0xdfed('0x2c')]['event']=_0xdfed('0x7c');return respondWithRpcPromise(_0xdfed('0x7d'),_0xdfed('0x7d'),{'event':_0xdfed('0x7e'),'message':_0x231766['message']},client9002)[_0xdfed('0x26')](function(){return _0x231766;});}return _0x231766;}return null;})[_0xdfed('0x26')](respondWithResult(_0x8d159a,null))[_0xdfed('0x2e')](handleError(_0x8d159a,null));};var interaction_log=require('../../config/logger')(_0xdfed('0x7f'));exports[_0xdfed('0x39')]=function(_0x348bd6,_0x4f2e29,_0x4e1132){var _0x4913bf={'agent':{},'channel':_0xdfed('0x5e')};if(_0x348bd6[_0xdfed('0x5b')]['id']){delete _0x348bd6[_0xdfed('0x5b')]['id'];}_0x348bd6[_0xdfed('0x5b')][_0xdfed('0x62')]=_0x348bd6['body'][_0xdfed('0x62')]||_0x348bd6[_0xdfed('0x6a')]['id'];_0x4913bf[_0xdfed('0x63')]['id']=_0x348bd6[_0xdfed('0x5b')][_0xdfed('0x62')];return db[_0xdfed('0x41')]['find']({'where':{'id':_0x348bd6[_0xdfed('0x56')]['id'],'UserId':null}})[_0xdfed('0x26')](handleEntityNotFound(_0x4f2e29,null))[_0xdfed('0x26')](function(_0x29243a){if(_0x29243a){_0x4913bf[_0xdfed('0x2c')]=_0x29243a[_0xdfed('0x64')]({'plain':!![]});return db[_0xdfed('0x80')][_0xdfed('0x5a')]({'where':{'id':_0x29243a[_0xdfed('0x65')]}});}return null;})[_0xdfed('0x26')](handleEntityNotFound(_0x4f2e29,null))[_0xdfed('0x26')](function(_0x3d80c2){if(_0x3d80c2){_0x4913bf[_0xdfed('0x68')]=_0x3d80c2['get']({'plain':!![]});interaction_log[_0xdfed('0x27')](_0xdfed('0x81'),_0x348bd6['user']['id'],_0x348bd6[_0xdfed('0x6a')]['name'],_0x348bd6[_0xdfed('0x6a')][_0xdfed('0x6b')],_0x4913bf[_0xdfed('0x68')]['id'],_0x348bd6[_0xdfed('0x5b')]?JSON[_0xdfed('0x2a')](_0x348bd6[_0xdfed('0x5b')]):'null');return respondWithRpcPromise(_0xdfed('0x82'),_0xdfed('0x83'),_0x4913bf);}return null;})[_0xdfed('0x26')](function(_0x40b07f){var _0x28e024='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40b07f[_0xdfed('0x2c')][_0xdfed('0x70')];return db['sequelize'][_0xdfed('0x45')](_0x28e024,{'type':db[_0xdfed('0x71')][_0xdfed('0x72')][_0xdfed('0x73')],'raw':!![]})[_0xdfed('0x26')](function(_0x2d7061){return _0x2d7061;});})[_0xdfed('0x26')](function(_0x4aace3){if(_0x4aace3){_0x4913bf[_0xdfed('0x2c')][_0xdfed('0x74')]=_0x4aace3[0x0];if(!_0x348bd6[_0xdfed('0x5b')][_0xdfed('0x62')])return;return db[_0xdfed('0x75')][_0xdfed('0x5a')]({'where':{'id':_0x348bd6[_0xdfed('0x5b')][_0xdfed('0x62')],'role':'agent'},'attributes':['id','name',_0xdfed('0x76'),'email','internal'],'raw':!![]});}return null;})[_0xdfed('0x26')](function(_0x92f6a8){if(!_0x92f6a8)return null;_0x4913bf['message'][_0xdfed('0x63')]=_0x92f6a8;return _0x4913bf;})[_0xdfed('0x26')](function(_0x4732a5){if(_0x4732a5){_0x4732a5[_0xdfed('0x2c')][_0xdfed('0x79')]=util[_0xdfed('0x60')](_0xdfed('0x84'),_0x348bd6[_0xdfed('0x6a')]['name']);_0x4732a5[_0xdfed('0x2c')][_0xdfed('0x7a')]=_0x4913bf['channel'];_0x4732a5[_0xdfed('0x2c')][_0xdfed('0x7b')]=_0x4913bf['channel'];_0x4732a5[_0xdfed('0x2c')][_0xdfed('0x85')]=_0xdfed('0x39');respondWithRpcPromise('EventManager',_0xdfed('0x7d'),{'event':_0xdfed('0x86'),'message':_0x4732a5['message']},client9002);return _0x4913bf;}return null;})[_0xdfed('0x26')](respondWithResult(_0x4f2e29,null))['catch'](handleError(_0x4f2e29,null));};exports['create']=function(_0x3e9135,_0x7f028a){var _0x1fd1dd;return db[_0xdfed('0x41')]['create'](_0x3e9135[_0xdfed('0x5b')],{})[_0xdfed('0x26')](function(_0x5a6987){_0x1fd1dd=_0x5a6987;return db[_0xdfed('0x87')]['findOne']({'where':{'id':_0x1fd1dd['ContactId']}});})['then'](function(_0x53c7b9){if(_[_0xdfed('0x66')](_0x53c7b9)){return;}else{_0x1fd1dd[_0xdfed('0x5e')]=_0x53c7b9[_0xdfed('0x5e')];return db[_0xdfed('0x88')][_0xdfed('0x89')]({'where':{'id':_0x1fd1dd[_0xdfed('0x8a')]}});}})[_0xdfed('0x26')](function(_0x5763dd){return respondWithRpcPromise(_0xdfed('0x8b'),'SendFax',{'FaxAccountId':_['isNil'](_0x3e9135[_0xdfed('0x5b')])?undefined:_0x3e9135[_0xdfed('0x5b')][_0xdfed('0x8c')],'path':_[_0xdfed('0x66')](_0x5763dd)?undefined:util[_0xdfed('0x60')](_0xdfed('0x8d'),_0x5763dd[_0xdfed('0x8e')]),'fax':_[_0xdfed('0x66')](_0x1fd1dd[_0xdfed('0x5e')])?undefined:_0x1fd1dd[_0xdfed('0x5e')],'AttachmentId':_0x1fd1dd['AttachmentId']},client9002);})[_0xdfed('0x26')](respondWithResult(_0x7f028a,0xc9))['catch'](handleError(_0x7f028a,null));};exports[_0xdfed('0x8f')]=function(_0x206c20,_0x262759){var _0x2bb6b7=path[_0xdfed('0x90')](config[_0xdfed('0x91')],_0xdfed('0x92'),_0xdfed('0x93'),_0xdfed('0x94'));return db[_0xdfed('0x41')]['find']({'where':{'id':_0x206c20['params']['id']},'include':[{'model':db[_0xdfed('0x88')],'as':_0xdfed('0x88')}]})['then'](handleEntityNotFound(_0x262759,null))[_0xdfed('0x26')](function(_0x47d2aa){if(_0x47d2aa){return _0x262759['download'](path[_0xdfed('0x90')](_0x2bb6b7,_0x47d2aa[_0xdfed('0x88')][_0xdfed('0x8e')]));}})[_0xdfed('0x2e')](handleError(_0x262759,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4ea1266..b488b7c 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 _0x66da=['../../mysqldb','FaxMessage','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0xa07b60,_0x5587f5){var _0x4a0f88=function(_0x2603aa){while(--_0x2603aa){_0xa07b60['push'](_0xa07b60['shift']());}};_0x4a0f88(++_0x5587f5);}(_0x66da,0x16f));var _0xa66d=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x66da[_0x4bd06e];return _0x85ebb;};'use strict';var EventEmitter=require(_0xa66d('0x0'));var FaxMessage=require(_0xa66d('0x1'))['db'][_0xa66d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa66d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17b831){return function(_0x950036,_0x1326e8,_0x436606){FaxMessageEvents[_0xa66d('0x4')](_0x17b831+':'+_0x950036['id'],_0x950036);FaxMessageEvents['emit'](_0x17b831,_0x950036);_0x436606(null);};}for(var e in events){if(events[_0xa66d('0x5')](e)){var event=events[e];FaxMessage[_0xa66d('0x6')](e,emitEvent(event));}}module[_0xa66d('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xd9ce=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x26e8bc,_0x453f37){var _0x146be4=function(_0x2f97d3){while(--_0x2f97d3){_0x26e8bc['push'](_0x26e8bc['shift']());}};_0x146be4(++_0x453f37);}(_0xd9ce,0xeb));var _0xed9c=function(_0x188cc8,_0xd39746){_0x188cc8=_0x188cc8-0x0;var _0x4cb155=_0xd9ce[_0x188cc8];return _0x4cb155;};'use strict';var EventEmitter=require(_0xed9c('0x0'));var FaxMessage=require(_0xed9c('0x1'))['db'][_0xed9c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xed9c('0x3')](0x0);var events={'afterCreate':_0xed9c('0x4'),'afterUpdate':_0xed9c('0x5'),'afterDestroy':_0xed9c('0x6')};function emitEvent(_0x1cd5b5){return function(_0x5903b6,_0x3c9c4a,_0xd13461){FaxMessageEvents[_0xed9c('0x7')](_0x1cd5b5+':'+_0x5903b6['id'],_0x5903b6);FaxMessageEvents[_0xed9c('0x7')](_0x1cd5b5,_0x5903b6);_0xd13461(null);};}for(var e in events){if(events[_0xed9c('0x8')](e)){var event=events[e];FaxMessage[_0xed9c('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 89f36a1..b5fcd41 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 _0x4b96=['path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f72d0,_0x8bee5a){var _0x57dc92=function(_0x2d03f2){while(--_0x2d03f2){_0x2f72d0['push'](_0x2f72d0['shift']());}};_0x57dc92(++_0x8bee5a);}(_0x4b96,0xba));var _0x64b9=function(_0x231281,_0x49e743){_0x231281=_0x231281-0x0;var _0x16dc2f=_0x4b96[_0x231281];return _0x16dc2f;};'use strict';var _=require(_0x64b9('0x0'));var util=require('util');var logger=require(_0x64b9('0x1'))(_0x64b9('0x2'));var moment=require(_0x64b9('0x3'));var BPromise=require(_0x64b9('0x4'));var rp=require(_0x64b9('0x5'));var fs=require('fs');var path=require(_0x64b9('0x6'));var rimraf=require(_0x64b9('0x7'));var config=require('../../config/environment');var attributes=require(_0x64b9('0x8'));module[_0x64b9('0x9')]=function(_0x2ee994,_0x1908e3){return _0x2ee994[_0x64b9('0xa')](_0x64b9('0xb'),attributes,{'tableName':_0x64b9('0xc'),'paranoid':![],'indexes':[{'name':_0x64b9('0xd'),'fields':[_0x64b9('0xe')],'type':_0x64b9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd32dd6,_0x58d775,_0x4c2966){var _0x121e1a=_0x2ee994[_0x64b9('0x10')];var _0x4d8a7c=_0xd32dd6[_0x64b9('0x11')]({'plain':!![]});if(_0x4d8a7c[_0x64b9('0x12')]['toLowerCase']()==='in'||_0x4d8a7c[_0x64b9('0x12')][_0x64b9('0x13')]()===_0x64b9('0x14')&&!_0x4d8a7c[_0x64b9('0x15')]&&!_['isNil'](_0x4d8a7c[_0x64b9('0x16')])){_0x121e1a[_0x64b9('0x17')][_0x64b9('0x18')]({'where':{'id':_0x4d8a7c[_0x64b9('0x19')]}})[_0x64b9('0x1a')](function(_0x594a0b){if(_0x594a0b){_0x594a0b[_0x64b9('0x1b')]({'lastMsgAt':_0x4d8a7c[_0x64b9('0x1c')],'lastMsgDirection':_0x4d8a7c[_0x64b9('0x12')][_0x64b9('0x13')]()});}})[_0x64b9('0x1d')](function(_0xeb37c8){console[_0x64b9('0x1e')](_0xeb37c8);});}_0x4c2966();}},'charset':_0x64b9('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3182=['utf8mb4_unicode_ci','util','api','request-promise','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','then','update','catch'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3182,0x199));var _0x2318=function(_0x8879c9,_0x586a6a){_0x8879c9=_0x8879c9-0x0;var _0x49758a=_0x3182[_0x8879c9];return _0x49758a;};'use strict';var _=require('lodash');var util=require(_0x2318('0x0'));var logger=require('../../config/logger')(_0x2318('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2318('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2318('0x3'));var config=require('../../config/environment');var attributes=require(_0x2318('0x4'));module['exports']=function(_0x930663,_0x10900b){return _0x930663[_0x2318('0x5')](_0x2318('0x6'),attributes,{'tableName':_0x2318('0x7'),'paranoid':![],'indexes':[{'name':_0x2318('0x8'),'fields':[_0x2318('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2684dc,_0x3effd2,_0x22e90f){var _0xfcbf8c=_0x930663[_0x2318('0xa')];var _0x8f834d=_0x2684dc[_0x2318('0xb')]({'plain':!![]});if(_0x8f834d['direction']['toLowerCase']()==='in'||_0x8f834d[_0x2318('0xc')][_0x2318('0xd')]()===_0x2318('0xe')&&!_0x8f834d[_0x2318('0xf')]&&!_[_0x2318('0x10')](_0x8f834d[_0x2318('0x11')])){_0xfcbf8c[_0x2318('0x12')][_0x2318('0x13')]({'where':{'id':_0x8f834d['FaxInteractionId']}})[_0x2318('0x14')](function(_0x34929b){if(_0x34929b){_0x34929b[_0x2318('0x15')]({'lastMsgAt':_0x8f834d['createdAt'],'lastMsgDirection':_0x8f834d[_0x2318('0xc')][_0x2318('0xd')]()});}})[_0x2318('0x16')](function(_0x1cff30){console['error'](_0x1cff30);});}_0x22e90f();}},'charset':'utf8mb4','collate':_0x2318('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index abee49f..38025cb 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 _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x3b9394,_0x108960){var _0x28e57b=function(_0x4e294d){while(--_0x4e294d){_0x3b9394['push'](_0x3b9394['shift']());}};_0x28e57b(++_0x108960);}(_0xbec5,0xe5));var _0x5bec=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0xbec5[_0x4ec13d];return _0x3c3fa7;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file +var _0xedd9=['create','body','raw','CreateFaxMessage','catch','FaxMessage','update','options','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2c4010,_0x1bc816){var _0x40cdf9=function(_0x1f6e78){while(--_0x1f6e78){_0x2c4010['push'](_0x2c4010['shift']());}};_0x40cdf9(++_0x1bc816);}(_0xedd9,0xfc));var _0x9edd=function(_0x588292,_0x30c2e6){_0x588292=_0x588292-0x0;var _0x2bd7a0=_0xedd9[_0x588292];return _0x2bd7a0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});config['redis']=_[_0x9edd('0xc')](config['redis'],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x10'))['register'](socket);function respondWithRpcPromise(_0x494a24,_0x5d2f90,_0x2076fc){return new BPromise(function(_0x138767,_0x523026){return client[_0x9edd('0x11')](_0x494a24,_0x2076fc)[_0x9edd('0x12')](function(_0x5b6c00){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x5d2f90,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x5b6c00));if(_0x5b6c00[_0x9edd('0x19')]){if(_0x5b6c00['error'][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')](_0x9edd('0x14'),_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x523026(_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);}logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x138767(_0x5b6c00[_0x9edd('0x19')]['message']);}else{logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));_0x138767(_0x5b6c00['result'][_0x9edd('0x1b')]);}})['catch'](function(_0x2cdcef){logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x2cdcef);_0x523026(_0x2cdcef);});});}exports['CreateFaxMessage']=function(_0x45c3ab){var _0x50338f=this;return new Promise(function(_0x27a95a,_0x54a03f){return db['FaxMessage'][_0x9edd('0x1c')](_0x45c3ab[_0x9edd('0x1d')],{'raw':_0x45c3ab['options']?_0x45c3ab['options'][_0x9edd('0x1e')]===undefined?!![]:![]:!![]})[_0x9edd('0x12')](function(_0x477878){logger['info'](_0x9edd('0x1f'),_0x45c3ab);logger[_0x9edd('0x16')](_0x9edd('0x1f'),_0x45c3ab,JSON[_0x9edd('0x18')](_0x477878));_0x27a95a(_0x477878);})[_0x9edd('0x20')](function(_0x4c75d2){logger[_0x9edd('0x19')](_0x9edd('0x1f'),_0x4c75d2[_0x9edd('0x1b')],_0x45c3ab);_0x54a03f(_0x50338f[_0x9edd('0x19')](0x1f4,_0x4c75d2[_0x9edd('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x4b3d1b){var _0x3276ee=this;return new Promise(function(_0xfeca7b,_0x8d67aa){return db[_0x9edd('0x21')][_0x9edd('0x22')](_0x4b3d1b['body'],{'raw':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b['options'][_0x9edd('0x24')]||null:null,'attributes':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x25')]||null:null,'limit':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x26')]||null:null})[_0x9edd('0x12')](function(_0x12c1bc){logger[_0x9edd('0x13')](_0x9edd('0x27'),_0x4b3d1b);logger[_0x9edd('0x16')](_0x9edd('0x27'),_0x4b3d1b,JSON[_0x9edd('0x18')](_0x12c1bc));_0xfeca7b(_0x12c1bc);})[_0x9edd('0x20')](function(_0x4fd03f){logger[_0x9edd('0x19')](_0x9edd('0x27'),_0x4fd03f[_0x9edd('0x1b')],_0x4b3d1b);_0x8d67aa(_0x3276ee[_0x9edd('0x19')](0x1f4,_0x4fd03f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index db64f6b..b69a368 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 _0x4da3=['emit','removeListener','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x45bd9f,_0x23507b){var _0x160dc3=function(_0x2ecf3c){while(--_0x2ecf3c){_0x45bd9f['push'](_0x45bd9f['shift']());}};_0x160dc3(++_0x23507b);}(_0x4da3,0x1ac));var _0x34da=function(_0x1eaa70,_0x5abda1){_0x1eaa70=_0x1eaa70-0x0;var _0x20b6e9=_0x4da3[_0x1eaa70];return _0x20b6e9;};'use strict';var FaxMessageEvents=require(_0x34da('0x0'));var events=[_0x34da('0x1'),_0x34da('0x2'),_0x34da('0x3')];function createListener(_0x2780f5,_0x56b593){return function(_0x476d82){_0x56b593[_0x34da('0x4')](_0x2780f5,_0x476d82);};}function removeListener(_0x11c5fa,_0x56b381){return function(){FaxMessageEvents[_0x34da('0x5')](_0x11c5fa,_0x56b381);};}exports['register']=function(_0x382cbf){for(var _0x4e81ac=0x0,_0x596265=events[_0x34da('0x6')];_0x4e81ac<_0x596265;_0x4e81ac++){var _0x31f7b1=events[_0x4e81ac];var _0x4bb909=createListener(_0x34da('0x7')+_0x31f7b1,_0x382cbf);FaxMessageEvents['on'](_0x31f7b1,_0x4bb909);}}; \ No newline at end of file +var _0xb1d6=['save','remove','emit','removeListener','register','length','./faxMessage.events'];(function(_0x1d6f82,_0x1e3208){var _0x1d9c09=function(_0x1312a3){while(--_0x1312a3){_0x1d6f82['push'](_0x1d6f82['shift']());}};_0x1d9c09(++_0x1e3208);}(_0xb1d6,0x19c));var _0x6b1d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb1d6[_0x14add3];return _0x4a174f;};'use strict';var FaxMessageEvents=require(_0x6b1d('0x0'));var events=[_0x6b1d('0x1'),_0x6b1d('0x2'),'update'];function createListener(_0x2824c9,_0x16dc57){return function(_0x22628e){_0x16dc57[_0x6b1d('0x3')](_0x2824c9,_0x22628e);};}function removeListener(_0x10bbf0,_0x2817e0){return function(){FaxMessageEvents[_0x6b1d('0x4')](_0x10bbf0,_0x2817e0);};}exports[_0x6b1d('0x5')]=function(_0x23db43){for(var _0x4d37aa=0x0,_0x587836=events[_0x6b1d('0x6')];_0x4d37aa<_0x587836;_0x4d37aa++){var _0xc9766b=events[_0x4d37aa];var _0x1adf86=createListener('faxMessage:'+_0xc9766b,_0x23db43);FaxMessageEvents['on'](_0xc9766b,_0x1adf86);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3c7deb7..fd30648 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc788,0xc4));var _0x8c78=function(_0x3fd50c,_0x1b41ed){_0x3fd50c=_0x3fd50c-0x0;var _0x4cebb2=_0xc788[_0x3fd50c];return _0x4cebb2;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file +var _0x1be1=['create','put','update','/:id/accept','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','faxmessage:create'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x1be1,0x192));var _0x11be=function(_0x4e0d7c,_0x8129fd){_0x4e0d7c=_0x4e0d7c-0x0;var _0x1a2f6d=_0x1be1[_0x4e0d7c];return _0x1a2f6d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),interaction[_0x11be('0xe')]('fax',_0x11be('0xf')),controller[_0x11be('0x10')]);router[_0x11be('0x11')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x12')]);router['put'](_0x11be('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x11be('0xa'),auth['isAuthenticated'](),controller[_0x11be('0x14')]);module[_0x11be('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ee24d88..e96adb3 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 _0xfb6e=['INTEGER','ENUM','rrmemory','beepall','exports','STRING','name'];(function(_0x3fe690,_0x4e4d40){var _0x2ffe41=function(_0x3db537){while(--_0x3db537){_0x3fe690['push'](_0x3fe690['shift']());}};_0x2ffe41(++_0x4e4d40);}(_0xfb6e,0x177));var _0xefb6=function(_0x5fc1ac,_0x422418){_0x5fc1ac=_0x5fc1ac-0x0;var _0xce7874=_0xfb6e[_0x5fc1ac];return _0xce7874;};'use strict';var Sequelize=require('sequelize');module[_0xefb6('0x0')]={'name':{'type':Sequelize[_0xefb6('0x1')],'unique':_0xefb6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xefb6('0x1')]},'timeout':{'type':Sequelize[_0xefb6('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xefb6('0x4')](_0xefb6('0x5'),_0xefb6('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xefb6('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8738=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x8738,0x1aa));var _0x8873=function(_0x54d547,_0x3f7c8f){_0x54d547=_0x54d547-0x0;var _0x1d09aa=_0x8738[_0x54d547];return _0x1d09aa;};'use strict';var Sequelize=require(_0x8873('0x0'));module['exports']={'name':{'type':Sequelize[_0x8873('0x1')],'unique':_0x8873('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8873('0x1')]},'timeout':{'type':Sequelize[_0x8873('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8873('0x4')](_0x8873('0x5'),'beepall',_0x8873('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index d417941..c96af02 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 _0x6c74=['userFaxQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','filters','query','intersection','fields','attributes','length','nolimit','sort','filter','where','options','include','findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserFaxQueue','hasOwnProperty','order','pick','FaxQueueId','User','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','compact','omit','spread','userFaxQueue:save','removeAgents','isArray'];(function(_0x25069c,_0x592c87){var _0x11eaec=function(_0x36d717){while(--_0x36d717){_0x25069c['push'](_0x25069c['shift']());}};_0x11eaec(++_0x592c87);}(_0x6c74,0x10a));var _0x46c7=function(_0x401298,_0x75d2c){_0x401298=_0x401298-0x0;var _0x52dd05=_0x6c74[_0x401298];return _0x52dd05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x46c7('0x0'));var rp=require(_0x46c7('0x1'));var moment=require(_0x46c7('0x2'));var BPromise=require(_0x46c7('0x3'));var Mustache=require('mustache');var util=require(_0x46c7('0x4'));var path=require(_0x46c7('0x5'));var sox=require('sox');var csv=require(_0x46c7('0x6'));var ejs=require(_0x46c7('0x7'));var fs=require('fs');var fs_extra=require(_0x46c7('0x8'));var _=require(_0x46c7('0x9'));var squel=require(_0x46c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x46c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x46c7('0x6'));var querystring=require(_0x46c7('0xc'));var Papa=require('papaparse');var Redis=require(_0x46c7('0xd'));var authService=require(_0x46c7('0xe'));var qs=require(_0x46c7('0xf'));var as=require(_0x46c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46c7('0x11'))(_0x46c7('0x12'));var utils=require(_0x46c7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x46c7('0x14'));var db=require(_0x46c7('0x15'))['db'];config[_0x46c7('0x16')]=_[_0x46c7('0x17')](config[_0x46c7('0x16')],{'host':_0x46c7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46c7('0x16')]));require('./faxQueue.socket')[_0x46c7('0x19')](socket);function respondWithStatusCode(_0x13eca2,_0x10af8f){_0x10af8f=_0x10af8f||0xcc;return function(_0x4ecf5c){if(_0x4ecf5c){return _0x13eca2[_0x46c7('0x1a')](_0x10af8f);}return _0x13eca2['status'](_0x10af8f)[_0x46c7('0x1b')]();};}function respondWithResult(_0xbfb3b7,_0x2adca7){_0x2adca7=_0x2adca7||0xc8;return function(_0x5859af){if(_0x5859af){return _0xbfb3b7[_0x46c7('0x1c')](_0x2adca7)[_0x46c7('0x1d')](_0x5859af);}};}function respondWithFilteredResult(_0x8546f6,_0x14ef0c){return function(_0x5ece33){if(_0x5ece33){var _0x1c7762=typeof _0x14ef0c[_0x46c7('0x1e')]===_0x46c7('0x1f')&&typeof _0x14ef0c[_0x46c7('0x20')]===_0x46c7('0x1f');var _0x2f4f15=_0x5ece33[_0x46c7('0x21')];var _0x3f7054=_0x1c7762?0x0:_0x14ef0c['offset'];var _0x59487a=_0x1c7762?_0x5ece33[_0x46c7('0x21')]:_0x14ef0c[_0x46c7('0x1e')]+_0x14ef0c[_0x46c7('0x20')];var _0x1ee726;if(_0x59487a>=_0x2f4f15){_0x59487a=_0x2f4f15;_0x1ee726=0xc8;}else{_0x1ee726=0xce;}_0x8546f6[_0x46c7('0x1c')](_0x1ee726);return _0x8546f6[_0x46c7('0x22')](_0x46c7('0x23'),_0x3f7054+'-'+_0x59487a+'/'+_0x2f4f15)[_0x46c7('0x1d')](_0x5ece33);}return null;};}function patchUpdates(_0x1e2974){return function(_0x5826e4){try{jsonpatch[_0x46c7('0x24')](_0x5826e4,_0x1e2974,!![]);}catch(_0x30da90){return BPromise[_0x46c7('0x25')](_0x30da90);}return _0x5826e4['save']();};}function saveUpdates(_0x3cf1f3,_0x38fc92){return function(_0x2ae214){if(_0x2ae214){return _0x2ae214[_0x46c7('0x26')](_0x3cf1f3)[_0x46c7('0x27')](function(_0x1cf64f){return _0x1cf64f;});}return null;};}function removeEntity(_0x46064a,_0x15a916){return function(_0x1b0f5f){if(_0x1b0f5f){return _0x1b0f5f[_0x46c7('0x28')]()[_0x46c7('0x27')](function(){var _0x1d5b6f=_0x1b0f5f[_0x46c7('0x29')]({'plain':!![]});var _0xdec61e='FaxQueues';return db[_0x46c7('0x2a')]['destroy']({'where':{'type':_0xdec61e,'resourceId':_0x1d5b6f['id']}})[_0x46c7('0x27')](function(){return _0x1b0f5f;});})['then'](function(){_0x46064a[_0x46c7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aabf5,_0x546ffd){return function(_0x3aaebd){if(!_0x3aaebd){_0x3aabf5[_0x46c7('0x1a')](0x194);}return _0x3aaebd;};}function handleError(_0x1ccd67,_0x249516){_0x249516=_0x249516||0x1f4;return function(_0x51db9b){logger['error'](_0x51db9b[_0x46c7('0x2b')]);if(_0x51db9b[_0x46c7('0x2c')]){delete _0x51db9b[_0x46c7('0x2c')];}_0x1ccd67[_0x46c7('0x1c')](_0x249516)[_0x46c7('0x2d')](_0x51db9b);};}exports[_0x46c7('0x2e')]=function(_0x3cba20,_0x29dd09){var _0x419eb8={},_0x536839={},_0x16bd3b={'count':0x0,'rows':[]};var _0x1c65eb=_[_0x46c7('0x2f')](db[_0x46c7('0x30')][_0x46c7('0x31')],function(_0x1d44e8){return{'name':_0x1d44e8['fieldName'],'type':_0x1d44e8[_0x46c7('0x32')][_0x46c7('0x33')]};});_0x536839[_0x46c7('0x34')]=_[_0x46c7('0x2f')](_0x1c65eb,_0x46c7('0x2c'));_0x536839['query']=_['keys'](_0x3cba20['query']);_0x536839[_0x46c7('0x35')]=_['intersection'](_0x536839[_0x46c7('0x34')],_0x536839[_0x46c7('0x36')]);_0x419eb8['attributes']=_[_0x46c7('0x37')](_0x536839['model'],qs[_0x46c7('0x38')](_0x3cba20['query'][_0x46c7('0x38')]));_0x419eb8['attributes']=_0x419eb8[_0x46c7('0x39')][_0x46c7('0x3a')]?_0x419eb8[_0x46c7('0x39')]:_0x536839[_0x46c7('0x34')];if(!_0x3cba20[_0x46c7('0x36')]['hasOwnProperty'](_0x46c7('0x3b'))){_0x419eb8[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x3cba20[_0x46c7('0x36')][_0x46c7('0x20')]);_0x419eb8[_0x46c7('0x1e')]=qs['offset'](_0x3cba20[_0x46c7('0x36')][_0x46c7('0x1e')]);}_0x419eb8['order']=qs[_0x46c7('0x3c')](_0x3cba20[_0x46c7('0x36')]['sort']);_0x419eb8['where']=qs[_0x46c7('0x35')](_['pick'](_0x3cba20[_0x46c7('0x36')],_0x536839[_0x46c7('0x35')]),_0x1c65eb);if(_0x3cba20[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x419eb8['where']=_['merge'](_0x419eb8[_0x46c7('0x3e')],{'$or':_[_0x46c7('0x2f')](_0x1c65eb,function(_0x2b684a){if(_0x2b684a[_0x46c7('0x32')]!=='VIRTUAL'){var _0x3dc682={};_0x3dc682[_0x2b684a[_0x46c7('0x2c')]]={'$like':'%'+_0x3cba20['query'][_0x46c7('0x3d')]+'%'};return _0x3dc682;}})});}_0x419eb8=_['merge']({},_0x419eb8,_0x3cba20[_0x46c7('0x3f')]);var _0x4508fb={'where':_0x419eb8['where']};return db[_0x46c7('0x30')]['count'](_0x4508fb)[_0x46c7('0x27')](function(_0xa2c9a9){_0x16bd3b[_0x46c7('0x21')]=_0xa2c9a9;if(_0x3cba20[_0x46c7('0x36')]['includeAll']){_0x419eb8[_0x46c7('0x40')]=[{'all':!![]}];}return db[_0x46c7('0x30')][_0x46c7('0x41')](_0x419eb8);})['then'](function(_0x3b0651){_0x16bd3b[_0x46c7('0x42')]=_0x3b0651;return _0x16bd3b;})[_0x46c7('0x27')](respondWithFilteredResult(_0x29dd09,_0x419eb8))[_0x46c7('0x43')](handleError(_0x29dd09,null));};exports[_0x46c7('0x44')]=function(_0x1838a4,_0x50e85e){var _0x23a891={'raw':!![],'where':{'id':_0x1838a4[_0x46c7('0x45')]['id']}},_0x3364ef={};_0x3364ef[_0x46c7('0x34')]=_[_0x46c7('0x46')](db[_0x46c7('0x30')][_0x46c7('0x31')]);_0x3364ef['query']=_['keys'](_0x1838a4['query']);_0x3364ef['filters']=_['intersection'](_0x3364ef[_0x46c7('0x34')],_0x3364ef[_0x46c7('0x36')]);_0x23a891[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x3364ef['model'],qs[_0x46c7('0x38')](_0x1838a4[_0x46c7('0x36')]['fields']));_0x23a891['attributes']=_0x23a891[_0x46c7('0x39')]['length']?_0x23a891[_0x46c7('0x39')]:_0x3364ef[_0x46c7('0x34')];if(_0x1838a4[_0x46c7('0x36')][_0x46c7('0x47')]){_0x23a891['include']=[{'all':!![]}];}_0x23a891=_[_0x46c7('0x48')]({},_0x23a891,_0x1838a4['options']);return db[_0x46c7('0x30')][_0x46c7('0x49')](_0x23a891)[_0x46c7('0x27')](handleEntityNotFound(_0x50e85e,null))[_0x46c7('0x27')](respondWithResult(_0x50e85e,null))[_0x46c7('0x43')](handleError(_0x50e85e,null));};exports[_0x46c7('0x4a')]=function(_0x1c70a9,_0x283b05){return db[_0x46c7('0x30')][_0x46c7('0x4a')](_0x1c70a9[_0x46c7('0x4b')],{})['then'](function(_0x109d45){var _0x3a9e6d=_0x1c70a9[_0x46c7('0x4c')][_0x46c7('0x29')]({'plain':!![]});if(!_0x3a9e6d)throw new Error(_0x46c7('0x4d'));if(_0x3a9e6d[_0x46c7('0x4e')]===_0x46c7('0x4c')){var _0x407fb9=_0x109d45[_0x46c7('0x29')]({'plain':!![]});var _0x43b36c=_0x46c7('0x4f');return db[_0x46c7('0x50')][_0x46c7('0x49')]({'where':{'name':_0x43b36c,'userProfileId':_0x3a9e6d['userProfileId']},'raw':!![]})[_0x46c7('0x27')](function(_0x498c7b){if(_0x498c7b&&_0x498c7b[_0x46c7('0x51')]===0x0){return db[_0x46c7('0x2a')][_0x46c7('0x4a')]({'name':_0x407fb9[_0x46c7('0x2c')],'resourceId':_0x407fb9['id'],'type':_0x498c7b[_0x46c7('0x2c')],'sectionId':_0x498c7b['id']},{})[_0x46c7('0x27')](function(){return _0x109d45;});}else{return _0x109d45;}})[_0x46c7('0x43')](function(_0x34a528){logger['error'](_0x46c7('0x52'),_0x34a528);throw _0x34a528;});}return _0x109d45;})['then'](respondWithResult(_0x283b05,0xc9))['catch'](handleError(_0x283b05,null));};exports['update']=function(_0x5e09e7,_0x200375){if(_0x5e09e7[_0x46c7('0x4b')]['id']){delete _0x5e09e7[_0x46c7('0x4b')]['id'];}return db['FaxQueue'][_0x46c7('0x49')]({'where':{'id':_0x5e09e7[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x200375,null))[_0x46c7('0x27')](saveUpdates(_0x5e09e7[_0x46c7('0x4b')],null))[_0x46c7('0x27')](respondWithResult(_0x200375,null))[_0x46c7('0x43')](handleError(_0x200375,null));};exports[_0x46c7('0x28')]=function(_0x69e324,_0x181c2e){return db[_0x46c7('0x30')]['find']({'where':{'id':_0x69e324['params']['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x181c2e,null))['then'](removeEntity(_0x181c2e,null))['catch'](handleError(_0x181c2e,null));};exports['describe']=function(_0x2e0157,_0x393dfe){return db[_0x46c7('0x30')]['describe']()[_0x46c7('0x27')](respondWithResult(_0x393dfe,null))['catch'](handleError(_0x393dfe,null));};exports['getMembers']=function(_0x5d3087,_0x45af78,_0x38ebf9){var _0x3383e9={'raw':!![],'where':{}},_0x41f980={},_0x35a493;return db[_0x46c7('0x30')][_0x46c7('0x53')]({'where':{'id':_0x5d3087[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x45af78,null))[_0x46c7('0x27')](function(_0x4216b0){if(_0x4216b0){_0x35a493=_0x4216b0[_0x46c7('0x29')]({'plain':!![]});_0x41f980[_0x46c7('0x34')]=_[_0x46c7('0x46')](db[_0x46c7('0x54')]['rawAttributes']);_0x41f980[_0x46c7('0x36')]=_[_0x46c7('0x46')](_0x5d3087[_0x46c7('0x36')]);_0x41f980[_0x46c7('0x35')]=_[_0x46c7('0x37')](_0x41f980[_0x46c7('0x34')],_0x41f980[_0x46c7('0x36')]);_0x3383e9[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x41f980[_0x46c7('0x34')],qs[_0x46c7('0x38')](_0x5d3087[_0x46c7('0x36')]['fields']));_0x3383e9['attributes']=_0x3383e9['attributes'][_0x46c7('0x3a')]?_0x3383e9[_0x46c7('0x39')]:_0x41f980['model'];if(!_0x5d3087[_0x46c7('0x36')][_0x46c7('0x55')]('nolimit')){_0x3383e9[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x5d3087['query'][_0x46c7('0x20')]);_0x3383e9[_0x46c7('0x1e')]=qs[_0x46c7('0x1e')](_0x5d3087[_0x46c7('0x36')][_0x46c7('0x1e')]);}_0x3383e9[_0x46c7('0x56')]=qs[_0x46c7('0x3c')](_0x5d3087[_0x46c7('0x36')][_0x46c7('0x3c')]);_0x3383e9['where']=qs['filters'](_[_0x46c7('0x57')](_0x5d3087['query'],_0x41f980['filters']));_0x3383e9[_0x46c7('0x3e')][_0x46c7('0x58')]=_0x4216b0['id'];if(_0x5d3087[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x3383e9[_0x46c7('0x3e')]=_[_0x46c7('0x48')](_0x3383e9[_0x46c7('0x3e')],{'$or':_[_0x46c7('0x2f')](_0x3383e9[_0x46c7('0x39')],function(_0x3b70b8){var _0x3f5f0a={};_0x3f5f0a[_0x3b70b8]={'$like':'%'+_0x5d3087[_0x46c7('0x36')][_0x46c7('0x3d')]+'%'};return _0x3f5f0a;})});}_0x3383e9=_[_0x46c7('0x48')]({},_0x3383e9,_0x5d3087[_0x46c7('0x3f')]);return db['UserFaxQueue'][_0x46c7('0x41')](_0x3383e9);}})['then'](function(_0x8bd0f4){if(_0x8bd0f4){return db[_0x46c7('0x59')]['findAndCountAll']({'where':{'id':_[_0x46c7('0x2f')](_0x8bd0f4,_0x46c7('0x5a')),'role':'agent'},'attributes':['id',_0x46c7('0x2c'),_0x46c7('0x5b'),_0x46c7('0x5c'),_0x46c7('0x5d')]});}})[_0x46c7('0x27')](function(_0x2a405d){if(_0x2a405d){return{'count':_0x2a405d[_0x46c7('0x21')],'rows':_[_0x46c7('0x2f')](_0x2a405d['rows'],function(_0x36558d){return{'membername':_0x36558d[_0x46c7('0x2c')],'UserId':_0x36558d['id'],'queue_name':_0x35a493[_0x46c7('0x2c')],'FaxQueueId':_0x35a493['id'],'interface':util['format'](_0x46c7('0x5e'),_0x46c7('0x5f'),_0x36558d[_0x46c7('0x2c')]),'penalty':0x0,'paused':_0x36558d[_0x46c7('0x5b')],'createdAt':_0x36558d[_0x46c7('0x5d')],'updatedAt':_0x36558d[_0x46c7('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45af78,_0x3383e9))['catch'](handleError(_0x45af78,null));};exports['getTeams']=function(_0x21c0ca,_0xf0f4cf,_0x2a84dc){var _0x137334={};var _0x1e7825={};var _0x50e3de;var _0x762f4c;return db[_0x46c7('0x30')][_0x46c7('0x53')]({'where':{'id':_0x21c0ca[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0xf0f4cf,null))['then'](function(_0x46fb39){if(_0x46fb39){_0x50e3de=_0x46fb39;_0x1e7825[_0x46c7('0x34')]=_['keys'](db['Team'][_0x46c7('0x31')]);_0x1e7825[_0x46c7('0x36')]=_[_0x46c7('0x46')](_0x21c0ca['query']);_0x1e7825['filters']=_[_0x46c7('0x37')](_0x1e7825[_0x46c7('0x34')],_0x1e7825[_0x46c7('0x36')]);_0x137334[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x1e7825['model'],qs[_0x46c7('0x38')](_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x38')]));_0x137334[_0x46c7('0x39')]=_0x137334[_0x46c7('0x39')][_0x46c7('0x3a')]?_0x137334[_0x46c7('0x39')]:_0x1e7825[_0x46c7('0x34')];_0x137334['order']=qs[_0x46c7('0x3c')](_0x21c0ca['query'][_0x46c7('0x3c')]);_0x137334['where']=qs[_0x46c7('0x35')](_[_0x46c7('0x57')](_0x21c0ca['query'],_0x1e7825['filters']));if(_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x137334['where']=_[_0x46c7('0x48')](_0x137334[_0x46c7('0x3e')],{'$or':_[_0x46c7('0x2f')](_0x137334['attributes'],function(_0x297c22){var _0x597c40={};_0x597c40[_0x297c22]={'$like':'%'+_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x3d')]+'%'};return _0x597c40;})});}_0x137334=_[_0x46c7('0x48')]({},_0x137334,_0x21c0ca[_0x46c7('0x3f')]);return _0x50e3de[_0x46c7('0x60')](_0x137334);}})[_0x46c7('0x27')](function(_0x12434f){if(_0x12434f){_0x762f4c=_0x12434f[_0x46c7('0x3a')];if(!_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x55')](_0x46c7('0x3b'))){_0x137334[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x21c0ca[_0x46c7('0x36')][_0x46c7('0x20')]);_0x137334[_0x46c7('0x1e')]=qs[_0x46c7('0x1e')](_0x21c0ca[_0x46c7('0x36')]['offset']);}return _0x50e3de[_0x46c7('0x60')](_0x137334);}})['then'](function(_0x47b22c){if(_0x47b22c){return _0x47b22c?{'count':_0x762f4c,'rows':_0x47b22c}:null;}})[_0x46c7('0x27')](respondWithResult(_0xf0f4cf,null))['catch'](handleError(_0xf0f4cf,null));};exports[_0x46c7('0x61')]=function(_0xce2d54,_0x1b5a92,_0x1d9195){var _0x45278b=_0xce2d54[_0x46c7('0x4b')][_0x46c7('0x62')];return db[_0x46c7('0x63')][_0x46c7('0x41')]({'where':{'id':_0x45278b},'attributes':['id'],'include':[{'model':db[_0x46c7('0x59')],'as':_0x46c7('0x64'),'attributes':['id',_0x46c7('0x2c'),_0x46c7('0x65'),_0x46c7('0x66'),'interface'],'raw':!![]}]})[_0x46c7('0x27')](function(_0xa18c70){if(_0xa18c70){var _0x244919=_[_0x46c7('0x67')](_0xa18c70,function(_0x299c23){var _0x1fe338=_0x299c23[_0x46c7('0x29')]({'plain':!![]});return _0x1fe338['Agents'];});return db['FaxQueue'][_0x46c7('0x49')]({'where':{'id':_0xce2d54[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](function(_0x1d3e5b){return db[_0x46c7('0x68')][_0x46c7('0x69')](function(_0x52f387){return _0x1d3e5b[_0x46c7('0x61')](_0x45278b,{'transaction':_0x52f387})[_0x46c7('0x27')](function(){return BPromise[_0x46c7('0x6a')](_0x244919,function(_0x10dedc){return db[_0x46c7('0x54')][_0x46c7('0x6b')]({'where':{'UserId':_0x10dedc['id'],'FaxQueueId':_0xce2d54['params']['id']},'transaction':_0x52f387});});})[_0x46c7('0x27')](function(){_0x244919[_0x46c7('0x6c')](function(_0x3d7d0e){socket[_0x46c7('0x6d')]('userFaxQueue:save',{'UserId':_0x3d7d0e['id'],'FaxQueueId':_0x1d3e5b['id']});});});});});}})[_0x46c7('0x27')](respondWithStatusCode(_0x1b5a92,null))[_0x46c7('0x43')](handleError(_0x1b5a92,null));};exports[_0x46c7('0x6e')]=function(_0x197bba,_0x32838d,_0x4145d7){return db[_0x46c7('0x63')][_0x46c7('0x41')]({'where':{'id':_0x197bba[_0x46c7('0x36')][_0x46c7('0x62')]},'attributes':['id'],'include':[{'model':db[_0x46c7('0x59')],'as':_0x46c7('0x64'),'attributes':['id'],'raw':!![]}]})[_0x46c7('0x27')](handleEntityNotFound(_0x32838d,null))[_0x46c7('0x27')](function(_0x1917ea){var _0x1d4b61=_['map'](_0x1917ea,'id');var _0x39c38a=[];var _0x4fb8b2=[];var _0x1be3c8=squel[_0x46c7('0x6f')]();_0x1be3c8[_0x46c7('0x70')](_0x46c7('0x71'))['from'](_0x46c7('0x72'),'tq')[_0x46c7('0x73')](_0x46c7('0x74'),'ut',_0x46c7('0x75'))['where']('FaxQueueId\x20=\x20?',_0x197bba[_0x46c7('0x45')]['id']);for(var _0x1b0205=0x0;_0x1b0205<_0x1917ea[_0x46c7('0x3a')];_0x1b0205+=0x1){let _0x3080ed=_0x1917ea[_0x1b0205];for(var _0x53230e=0x0;_0x53230e<_0x3080ed['Agents'][_0x46c7('0x3a')];_0x53230e+=0x1){let _0x3e2fea=_0x3080ed[_0x46c7('0x64')][_0x53230e];var _0x3a3d2a=_0x1be3c8['clone']();_0x3a3d2a[_0x46c7('0x3e')](_0x46c7('0x76'),_0x3e2fea['id']);_0x4fb8b2['push'](db[_0x46c7('0x68')][_0x46c7('0x36')](_0x3a3d2a['toString'](),{'type':db['sequelize'][_0x46c7('0x77')][_0x46c7('0x78')]})['then'](function(_0x567a47){if(_0x567a47[_0x46c7('0x3a')]===0x1){return _0x3e2fea['id'];}else{var _0x594be5=_[_0x46c7('0x79')](_[_0x46c7('0x2f')](_0x567a47,_0x46c7('0x7a')),function(_0x58febc){return _[_0x46c7('0x7b')](_0x1d4b61,_0x58febc);});if(_0x594be5){return _0x3e2fea['id'];}}}));}}return BPromise['all'](_0x4fb8b2)['then'](function(_0x4b8701){_0x39c38a=_(_0x39c38a)['union'](_0x4b8701)[_0x46c7('0x7c')]()['value']();return db[_0x46c7('0x30')][_0x46c7('0x49')]({'where':{'id':_0x197bba[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](function(_0x15446b){return db[_0x46c7('0x68')][_0x46c7('0x69')](function(_0xb849ec){return _0x15446b[_0x46c7('0x6e')](_0x197bba[_0x46c7('0x36')][_0x46c7('0x62')],{'transaction':_0xb849ec})['then'](function(){if(!_['isEmpty'](_0x39c38a)){return _0x15446b['removeAgents'](_0x39c38a,{'transaction':_0xb849ec});}})[_0x46c7('0x27')](function(){_0x39c38a[_0x46c7('0x6c')](function(_0x533e32){socket[_0x46c7('0x6d')]('userFaxQueue:remove',{'UserId':_0x533e32,'FaxQueueId':_0x15446b['id']});});});});});});})[_0x46c7('0x27')](respondWithStatusCode(_0x32838d,null))[_0x46c7('0x43')](handleError(_0x32838d,null));};exports['addAgents']=function(_0x368ab9,_0x157295,_0x581d1e){return db[_0x46c7('0x30')][_0x46c7('0x49')]({'where':{'id':_0x368ab9[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x157295,null))[_0x46c7('0x27')](function(_0x3a3b8f){if(_0x3a3b8f){return _0x3a3b8f['addAgents'](_0x368ab9[_0x46c7('0x4b')][_0x46c7('0x62')],_[_0x46c7('0x7d')](_0x368ab9['body'],[_0x46c7('0x62'),'id'])||{})[_0x46c7('0x7e')](function(_0x3dd582){for(var _0x35a70e=0x0;_0x35a70e<_0x368ab9[_0x46c7('0x4b')][_0x46c7('0x62')][_0x46c7('0x3a')];_0x35a70e+=0x1){socket[_0x46c7('0x6d')](_0x46c7('0x7f'),{'UserId':Number(_0x368ab9[_0x46c7('0x4b')]['ids'][_0x35a70e]),'FaxQueueId':Number(_0x368ab9[_0x46c7('0x45')]['id'])});}return _0x3dd582;});}})['then'](respondWithResult(_0x157295,null))[_0x46c7('0x43')](handleError(_0x157295,null));};exports[_0x46c7('0x80')]=function(_0x2960a5,_0x5a3056,_0x4d68ef){return db[_0x46c7('0x30')][_0x46c7('0x49')]({'where':{'id':_0x2960a5['params']['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x5a3056,null))[_0x46c7('0x27')](function(_0x4935cb){if(_0x4935cb){return _0x4935cb[_0x46c7('0x80')](_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')])[_0x46c7('0x27')](function(){if(_[_0x46c7('0x81')](_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')])){for(var _0xb908f5=0x0;_0xb908f5<_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')][_0x46c7('0x3a')];_0xb908f5+=0x1){socket[_0x46c7('0x6d')](_0x46c7('0x82'),{'UserId':Number(_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')][_0xb908f5]),'FaxQueueId':Number(_0x2960a5[_0x46c7('0x45')]['id'])});}}else{socket[_0x46c7('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x2960a5[_0x46c7('0x36')][_0x46c7('0x62')]),'FaxQueueId':Number(_0x2960a5[_0x46c7('0x45')]['id'])});}});}})[_0x46c7('0x27')](respondWithStatusCode(_0x5a3056,null))[_0x46c7('0x43')](handleError(_0x5a3056,null));};exports['getAgents']=function(_0x3d0ce7,_0x3614de,_0x282bbe){var _0x3ae3c6={};var _0x24053a={};var _0x23996e;var _0x387e0a;return db[_0x46c7('0x30')][_0x46c7('0x53')]({'where':{'id':_0x3d0ce7[_0x46c7('0x45')]['id']}})[_0x46c7('0x27')](handleEntityNotFound(_0x3614de,null))[_0x46c7('0x27')](function(_0x1c1053){if(_0x1c1053){_0x23996e=_0x1c1053;_0x24053a[_0x46c7('0x34')]=_[_0x46c7('0x46')](db['User'][_0x46c7('0x31')]);_0x24053a[_0x46c7('0x36')]=_[_0x46c7('0x46')](_0x3d0ce7[_0x46c7('0x36')]);_0x24053a[_0x46c7('0x35')]=_[_0x46c7('0x37')](_0x24053a[_0x46c7('0x34')],_0x24053a['query']);_0x3ae3c6[_0x46c7('0x39')]=_[_0x46c7('0x37')](_0x24053a['model'],qs[_0x46c7('0x38')](_0x3d0ce7['query'][_0x46c7('0x38')]));_0x3ae3c6[_0x46c7('0x39')]=_0x3ae3c6[_0x46c7('0x39')][_0x46c7('0x3a')]?_0x3ae3c6[_0x46c7('0x39')]:_0x24053a[_0x46c7('0x34')];_0x3ae3c6[_0x46c7('0x56')]=qs[_0x46c7('0x3c')](_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x3c')]);_0x3ae3c6[_0x46c7('0x3e')]=qs[_0x46c7('0x35')](_[_0x46c7('0x57')](_0x3d0ce7[_0x46c7('0x36')],_0x24053a[_0x46c7('0x35')]));if(_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x3d')]){_0x3ae3c6[_0x46c7('0x3e')]=_[_0x46c7('0x48')](_0x3ae3c6[_0x46c7('0x3e')],{'$or':_['map'](_0x3ae3c6[_0x46c7('0x39')],function(_0x591280){var _0x1ac5c2={};_0x1ac5c2[_0x591280]={'$like':'%'+_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x3d')]+'%'};return _0x1ac5c2;})});}_0x3ae3c6=_[_0x46c7('0x48')]({},_0x3ae3c6,_0x3d0ce7['options']);return _0x23996e[_0x46c7('0x83')](_0x3ae3c6);}})[_0x46c7('0x27')](function(_0x49d5d4){if(_0x49d5d4){_0x387e0a=_0x49d5d4['length'];if(!_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x55')](_0x46c7('0x3b'))){_0x3ae3c6[_0x46c7('0x20')]=qs[_0x46c7('0x20')](_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x20')]);_0x3ae3c6[_0x46c7('0x1e')]=qs['offset'](_0x3d0ce7[_0x46c7('0x36')][_0x46c7('0x1e')]);}return _0x23996e[_0x46c7('0x83')](_0x3ae3c6);}})[_0x46c7('0x27')](function(_0xb755cf){if(_0xb755cf){return _0xb755cf?{'count':_0x387e0a,'rows':_0xb755cf}:null;}})['then'](respondWithResult(_0x3614de,null))[_0x46c7('0x43')](handleError(_0x3614de,null));}; \ No newline at end of file +var _0xf0be=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','FaxQueue','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','get','user','UserProfileSection','userProfileId','autoAssociation','body','getMembers','findOne','keys','hasOwnProperty','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service'];(function(_0x2eaa8b,_0x3b815f){var _0x3f3b41=function(_0xc91d69){while(--_0xc91d69){_0x2eaa8b['push'](_0x2eaa8b['shift']());}};_0x3f3b41(++_0x3b815f);}(_0xf0be,0x1a2));var _0xef0b=function(_0xf8273d,_0x2e2458){_0xf8273d=_0xf8273d-0x0;var _0x2dad65=_0xf0be[_0xf8273d];return _0x2dad65;};'use strict';var emlformat=require(_0xef0b('0x0'));var rimraf=require(_0xef0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef0b('0x2'));var rp=require(_0xef0b('0x3'));var moment=require(_0xef0b('0x4'));var BPromise=require(_0xef0b('0x5'));var Mustache=require(_0xef0b('0x6'));var util=require(_0xef0b('0x7'));var path=require(_0xef0b('0x8'));var sox=require(_0xef0b('0x9'));var csv=require(_0xef0b('0xa'));var ejs=require(_0xef0b('0xb'));var fs=require('fs');var fs_extra=require(_0xef0b('0xc'));var _=require('lodash');var squel=require(_0xef0b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xef0b('0xa'));var querystring=require(_0xef0b('0xe'));var Papa=require(_0xef0b('0xf'));var Redis=require('ioredis');var authService=require(_0xef0b('0x10'));var qs=require(_0xef0b('0x11'));var as=require(_0xef0b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef0b('0x13'))(_0xef0b('0x14'));var utils=require(_0xef0b('0x15'));var config=require(_0xef0b('0x16'));var licenseUtil=require(_0xef0b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xef0b('0x18')](config[_0xef0b('0x19')],{'host':_0xef0b('0x1a'),'port':0x18eb});var socket=require(_0xef0b('0x1b'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xef0b('0x1c')](socket);function respondWithStatusCode(_0x1b7d6a,_0x221967){_0x221967=_0x221967||0xcc;return function(_0x2f652b){if(_0x2f652b){return _0x1b7d6a['sendStatus'](_0x221967);}return _0x1b7d6a[_0xef0b('0x1d')](_0x221967)[_0xef0b('0x1e')]();};}function respondWithResult(_0xad6c43,_0x50b316){_0x50b316=_0x50b316||0xc8;return function(_0x3b9a96){if(_0x3b9a96){return _0xad6c43[_0xef0b('0x1d')](_0x50b316)[_0xef0b('0x1f')](_0x3b9a96);}};}function respondWithFilteredResult(_0x868637,_0x426875){return function(_0x6ed7f2){if(_0x6ed7f2){var _0x15bd75=typeof _0x426875[_0xef0b('0x20')]===_0xef0b('0x21')&&typeof _0x426875[_0xef0b('0x22')]===_0xef0b('0x21');var _0x2e40c3=_0x6ed7f2[_0xef0b('0x23')];var _0x4a9efb=_0x15bd75?0x0:_0x426875[_0xef0b('0x20')];var _0x1d3372=_0x15bd75?_0x6ed7f2['count']:_0x426875[_0xef0b('0x20')]+_0x426875[_0xef0b('0x22')];var _0x3ef99a;if(_0x1d3372>=_0x2e40c3){_0x1d3372=_0x2e40c3;_0x3ef99a=0xc8;}else{_0x3ef99a=0xce;}_0x868637['status'](_0x3ef99a);return _0x868637[_0xef0b('0x24')](_0xef0b('0x25'),_0x4a9efb+'-'+_0x1d3372+'/'+_0x2e40c3)['json'](_0x6ed7f2);}return null;};}function patchUpdates(_0x269d51){return function(_0x3b9d24){try{jsonpatch['apply'](_0x3b9d24,_0x269d51,!![]);}catch(_0x6564a5){return BPromise['reject'](_0x6564a5);}return _0x3b9d24[_0xef0b('0x26')]();};}function saveUpdates(_0x39ee88,_0x419617){return function(_0x237a99){if(_0x237a99){return _0x237a99[_0xef0b('0x27')](_0x39ee88)[_0xef0b('0x28')](function(_0x45f3bf){return _0x45f3bf;});}return null;};}function removeEntity(_0x4ff05b,_0xb78235){return function(_0x4cda4e){if(_0x4cda4e){return _0x4cda4e[_0xef0b('0x29')]()[_0xef0b('0x28')](function(){var _0x27def7=_0x4cda4e['get']({'plain':!![]});var _0x3f08aa=_0xef0b('0x2a');return db[_0xef0b('0x2b')][_0xef0b('0x29')]({'where':{'type':_0x3f08aa,'resourceId':_0x27def7['id']}})[_0xef0b('0x28')](function(){return _0x4cda4e;});})[_0xef0b('0x28')](function(){_0x4ff05b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x587996,_0x15dc95){return function(_0x3fdf1e){if(!_0x3fdf1e){_0x587996[_0xef0b('0x2c')](0x194);}return _0x3fdf1e;};}function handleError(_0x975104,_0x393454){_0x393454=_0x393454||0x1f4;return function(_0x524f7e){logger[_0xef0b('0x2d')](_0x524f7e[_0xef0b('0x2e')]);if(_0x524f7e[_0xef0b('0x2f')]){delete _0x524f7e[_0xef0b('0x2f')];}_0x975104[_0xef0b('0x1d')](_0x393454)[_0xef0b('0x30')](_0x524f7e);};}exports[_0xef0b('0x31')]=function(_0x5ee2c7,_0x4c2ce0){var _0x1e2a85={},_0x58d7ea={},_0x523e2e={'count':0x0,'rows':[]};var _0x1e0c17=_[_0xef0b('0x32')](db[_0xef0b('0x33')]['rawAttributes'],function(_0x563ac1){return{'name':_0x563ac1[_0xef0b('0x34')],'type':_0x563ac1['type'][_0xef0b('0x35')]};});_0x58d7ea[_0xef0b('0x36')]=_['map'](_0x1e0c17,_0xef0b('0x2f'));_0x58d7ea[_0xef0b('0x37')]=_['keys'](_0x5ee2c7[_0xef0b('0x37')]);_0x58d7ea['filters']=_[_0xef0b('0x38')](_0x58d7ea[_0xef0b('0x36')],_0x58d7ea[_0xef0b('0x37')]);_0x1e2a85['attributes']=_[_0xef0b('0x38')](_0x58d7ea[_0xef0b('0x36')],qs[_0xef0b('0x39')](_0x5ee2c7['query'][_0xef0b('0x39')]));_0x1e2a85[_0xef0b('0x3a')]=_0x1e2a85[_0xef0b('0x3a')][_0xef0b('0x3b')]?_0x1e2a85[_0xef0b('0x3a')]:_0x58d7ea[_0xef0b('0x36')];if(!_0x5ee2c7[_0xef0b('0x37')]['hasOwnProperty'](_0xef0b('0x3c'))){_0x1e2a85[_0xef0b('0x22')]=qs['limit'](_0x5ee2c7[_0xef0b('0x37')][_0xef0b('0x22')]);_0x1e2a85[_0xef0b('0x20')]=qs[_0xef0b('0x20')](_0x5ee2c7[_0xef0b('0x37')][_0xef0b('0x20')]);}_0x1e2a85[_0xef0b('0x3d')]=qs[_0xef0b('0x3e')](_0x5ee2c7[_0xef0b('0x37')][_0xef0b('0x3e')]);_0x1e2a85[_0xef0b('0x3f')]=qs['filters'](_[_0xef0b('0x40')](_0x5ee2c7['query'],_0x58d7ea[_0xef0b('0x41')]),_0x1e0c17);if(_0x5ee2c7[_0xef0b('0x37')][_0xef0b('0x42')]){_0x1e2a85['where']=_[_0xef0b('0x43')](_0x1e2a85['where'],{'$or':_['map'](_0x1e0c17,function(_0x40633a){if(_0x40633a['type']!==_0xef0b('0x44')){var _0x4ae564={};_0x4ae564[_0x40633a[_0xef0b('0x2f')]]={'$like':'%'+_0x5ee2c7[_0xef0b('0x37')][_0xef0b('0x42')]+'%'};return _0x4ae564;}})});}_0x1e2a85=_[_0xef0b('0x43')]({},_0x1e2a85,_0x5ee2c7[_0xef0b('0x45')]);var _0x3845e7={'where':_0x1e2a85[_0xef0b('0x3f')]};return db['FaxQueue'][_0xef0b('0x23')](_0x3845e7)[_0xef0b('0x28')](function(_0x2927b6){_0x523e2e[_0xef0b('0x23')]=_0x2927b6;if(_0x5ee2c7[_0xef0b('0x37')][_0xef0b('0x46')]){_0x1e2a85[_0xef0b('0x47')]=[{'all':!![]}];}return db[_0xef0b('0x33')][_0xef0b('0x48')](_0x1e2a85);})[_0xef0b('0x28')](function(_0x5f4188){_0x523e2e[_0xef0b('0x49')]=_0x5f4188;return _0x523e2e;})[_0xef0b('0x28')](respondWithFilteredResult(_0x4c2ce0,_0x1e2a85))[_0xef0b('0x4a')](handleError(_0x4c2ce0,null));};exports[_0xef0b('0x4b')]=function(_0xf1b25e,_0x16c570){var _0x4a53d8={'raw':!![],'where':{'id':_0xf1b25e[_0xef0b('0x4c')]['id']}},_0x79024c={};_0x79024c[_0xef0b('0x36')]=_['keys'](db[_0xef0b('0x33')][_0xef0b('0x4d')]);_0x79024c[_0xef0b('0x37')]=_['keys'](_0xf1b25e['query']);_0x79024c[_0xef0b('0x41')]=_[_0xef0b('0x38')](_0x79024c[_0xef0b('0x36')],_0x79024c[_0xef0b('0x37')]);_0x4a53d8[_0xef0b('0x3a')]=_['intersection'](_0x79024c['model'],qs[_0xef0b('0x39')](_0xf1b25e['query'][_0xef0b('0x39')]));_0x4a53d8[_0xef0b('0x3a')]=_0x4a53d8['attributes'][_0xef0b('0x3b')]?_0x4a53d8['attributes']:_0x79024c['model'];if(_0xf1b25e[_0xef0b('0x37')][_0xef0b('0x46')]){_0x4a53d8['include']=[{'all':!![]}];}_0x4a53d8=_[_0xef0b('0x43')]({},_0x4a53d8,_0xf1b25e[_0xef0b('0x45')]);return db['FaxQueue'][_0xef0b('0x4e')](_0x4a53d8)[_0xef0b('0x28')](handleEntityNotFound(_0x16c570,null))[_0xef0b('0x28')](respondWithResult(_0x16c570,null))[_0xef0b('0x4a')](handleError(_0x16c570,null));};exports[_0xef0b('0x4f')]=function(_0x5cc0bd,_0x281db2){return db[_0xef0b('0x33')]['create'](_0x5cc0bd['body'],{})[_0xef0b('0x28')](function(_0x2d34c9){var _0x5e6eac=_0x5cc0bd['user'][_0xef0b('0x50')]({'plain':!![]});if(!_0x5e6eac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e6eac['role']===_0xef0b('0x51')){var _0x214d9e=_0x2d34c9[_0xef0b('0x50')]({'plain':!![]});var _0x1d18f1=_0xef0b('0x2a');return db[_0xef0b('0x52')][_0xef0b('0x4e')]({'where':{'name':_0x1d18f1,'userProfileId':_0x5e6eac[_0xef0b('0x53')]},'raw':!![]})[_0xef0b('0x28')](function(_0x25bc40){if(_0x25bc40&&_0x25bc40[_0xef0b('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x214d9e[_0xef0b('0x2f')],'resourceId':_0x214d9e['id'],'type':_0x25bc40['name'],'sectionId':_0x25bc40['id']},{})['then'](function(){return _0x2d34c9;});}else{return _0x2d34c9;}})[_0xef0b('0x4a')](function(_0x2140e3){logger[_0xef0b('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2140e3);throw _0x2140e3;});}return _0x2d34c9;})[_0xef0b('0x28')](respondWithResult(_0x281db2,0xc9))[_0xef0b('0x4a')](handleError(_0x281db2,null));};exports[_0xef0b('0x27')]=function(_0x371207,_0x3a54dd){if(_0x371207['body']['id']){delete _0x371207[_0xef0b('0x55')]['id'];}return db[_0xef0b('0x33')][_0xef0b('0x4e')]({'where':{'id':_0x371207[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](handleEntityNotFound(_0x3a54dd,null))[_0xef0b('0x28')](saveUpdates(_0x371207['body'],null))['then'](respondWithResult(_0x3a54dd,null))[_0xef0b('0x4a')](handleError(_0x3a54dd,null));};exports[_0xef0b('0x29')]=function(_0x545b99,_0x25e861){return db[_0xef0b('0x33')][_0xef0b('0x4e')]({'where':{'id':_0x545b99['params']['id']}})[_0xef0b('0x28')](handleEntityNotFound(_0x25e861,null))[_0xef0b('0x28')](removeEntity(_0x25e861,null))['catch'](handleError(_0x25e861,null));};exports['describe']=function(_0x5b15db,_0x2b4cfc){return db['FaxQueue']['describe']()[_0xef0b('0x28')](respondWithResult(_0x2b4cfc,null))['catch'](handleError(_0x2b4cfc,null));};exports[_0xef0b('0x56')]=function(_0x1191a1,_0x5370d7,_0xd28fa5){var _0x444520={'raw':!![],'where':{}},_0x30ca62={},_0x249e6b;return db[_0xef0b('0x33')][_0xef0b('0x57')]({'where':{'id':_0x1191a1[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](handleEntityNotFound(_0x5370d7,null))[_0xef0b('0x28')](function(_0x1ab799){if(_0x1ab799){_0x249e6b=_0x1ab799[_0xef0b('0x50')]({'plain':!![]});_0x30ca62['model']=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x30ca62[_0xef0b('0x37')]=_[_0xef0b('0x58')](_0x1191a1[_0xef0b('0x37')]);_0x30ca62[_0xef0b('0x41')]=_['intersection'](_0x30ca62[_0xef0b('0x36')],_0x30ca62[_0xef0b('0x37')]);_0x444520['attributes']=_[_0xef0b('0x38')](_0x30ca62[_0xef0b('0x36')],qs[_0xef0b('0x39')](_0x1191a1[_0xef0b('0x37')][_0xef0b('0x39')]));_0x444520['attributes']=_0x444520[_0xef0b('0x3a')]['length']?_0x444520[_0xef0b('0x3a')]:_0x30ca62[_0xef0b('0x36')];if(!_0x1191a1[_0xef0b('0x37')][_0xef0b('0x59')](_0xef0b('0x3c'))){_0x444520['limit']=qs['limit'](_0x1191a1[_0xef0b('0x37')]['limit']);_0x444520[_0xef0b('0x20')]=qs[_0xef0b('0x20')](_0x1191a1[_0xef0b('0x37')]['offset']);}_0x444520['order']=qs[_0xef0b('0x3e')](_0x1191a1[_0xef0b('0x37')][_0xef0b('0x3e')]);_0x444520[_0xef0b('0x3f')]=qs[_0xef0b('0x41')](_[_0xef0b('0x40')](_0x1191a1['query'],_0x30ca62['filters']));_0x444520[_0xef0b('0x3f')][_0xef0b('0x5a')]=_0x1ab799['id'];if(_0x1191a1[_0xef0b('0x37')][_0xef0b('0x42')]){_0x444520['where']=_[_0xef0b('0x43')](_0x444520['where'],{'$or':_[_0xef0b('0x32')](_0x444520[_0xef0b('0x3a')],function(_0x5e4a45){var _0x24abf6={};_0x24abf6[_0x5e4a45]={'$like':'%'+_0x1191a1[_0xef0b('0x37')][_0xef0b('0x42')]+'%'};return _0x24abf6;})});}_0x444520=_[_0xef0b('0x43')]({},_0x444520,_0x1191a1[_0xef0b('0x45')]);return db[_0xef0b('0x5b')][_0xef0b('0x48')](_0x444520);}})['then'](function(_0x44f7d6){if(_0x44f7d6){return db[_0xef0b('0x5c')][_0xef0b('0x5d')]({'where':{'id':_[_0xef0b('0x32')](_0x44f7d6,_0xef0b('0x5e')),'role':_0xef0b('0x5f')},'attributes':['id',_0xef0b('0x2f'),_0xef0b('0x60'),_0xef0b('0x61'),_0xef0b('0x62')]});}})[_0xef0b('0x28')](function(_0x449609){if(_0x449609){return{'count':_0x449609[_0xef0b('0x23')],'rows':_['map'](_0x449609[_0xef0b('0x49')],function(_0x502976){return{'membername':_0x502976[_0xef0b('0x2f')],'UserId':_0x502976['id'],'queue_name':_0x249e6b[_0xef0b('0x2f')],'FaxQueueId':_0x249e6b['id'],'interface':util[_0xef0b('0x63')](_0xef0b('0x64'),_0xef0b('0x65'),_0x502976['name']),'penalty':0x0,'paused':_0x502976['faxPause'],'createdAt':_0x502976['createdAt'],'updatedAt':_0x502976['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xef0b('0x28')](respondWithFilteredResult(_0x5370d7,_0x444520))['catch'](handleError(_0x5370d7,null));};exports[_0xef0b('0x66')]=function(_0x44fea5,_0x10b342,_0x549e05){var _0x436b65={};var _0x4da7e8={};var _0x1a3e31;var _0xe48ba;return db[_0xef0b('0x33')][_0xef0b('0x57')]({'where':{'id':_0x44fea5[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](handleEntityNotFound(_0x10b342,null))[_0xef0b('0x28')](function(_0x6dd789){if(_0x6dd789){_0x1a3e31=_0x6dd789;_0x4da7e8[_0xef0b('0x36')]=_[_0xef0b('0x58')](db[_0xef0b('0x67')][_0xef0b('0x4d')]);_0x4da7e8['query']=_[_0xef0b('0x58')](_0x44fea5[_0xef0b('0x37')]);_0x4da7e8['filters']=_[_0xef0b('0x38')](_0x4da7e8[_0xef0b('0x36')],_0x4da7e8['query']);_0x436b65[_0xef0b('0x3a')]=_[_0xef0b('0x38')](_0x4da7e8[_0xef0b('0x36')],qs[_0xef0b('0x39')](_0x44fea5['query'][_0xef0b('0x39')]));_0x436b65[_0xef0b('0x3a')]=_0x436b65[_0xef0b('0x3a')][_0xef0b('0x3b')]?_0x436b65[_0xef0b('0x3a')]:_0x4da7e8[_0xef0b('0x36')];_0x436b65['order']=qs['sort'](_0x44fea5[_0xef0b('0x37')][_0xef0b('0x3e')]);_0x436b65[_0xef0b('0x3f')]=qs[_0xef0b('0x41')](_[_0xef0b('0x40')](_0x44fea5[_0xef0b('0x37')],_0x4da7e8[_0xef0b('0x41')]));if(_0x44fea5[_0xef0b('0x37')]['filter']){_0x436b65['where']=_['merge'](_0x436b65['where'],{'$or':_[_0xef0b('0x32')](_0x436b65[_0xef0b('0x3a')],function(_0x35848a){var _0x28f6dc={};_0x28f6dc[_0x35848a]={'$like':'%'+_0x44fea5[_0xef0b('0x37')][_0xef0b('0x42')]+'%'};return _0x28f6dc;})});}_0x436b65=_['merge']({},_0x436b65,_0x44fea5[_0xef0b('0x45')]);return _0x1a3e31['getTeams'](_0x436b65);}})[_0xef0b('0x28')](function(_0x4c4066){if(_0x4c4066){_0xe48ba=_0x4c4066[_0xef0b('0x3b')];if(!_0x44fea5['query'][_0xef0b('0x59')](_0xef0b('0x3c'))){_0x436b65[_0xef0b('0x22')]=qs[_0xef0b('0x22')](_0x44fea5['query'][_0xef0b('0x22')]);_0x436b65[_0xef0b('0x20')]=qs['offset'](_0x44fea5[_0xef0b('0x37')]['offset']);}return _0x1a3e31[_0xef0b('0x66')](_0x436b65);}})[_0xef0b('0x28')](function(_0x3241f1){if(_0x3241f1){return _0x3241f1?{'count':_0xe48ba,'rows':_0x3241f1}:null;}})['then'](respondWithResult(_0x10b342,null))[_0xef0b('0x4a')](handleError(_0x10b342,null));};exports[_0xef0b('0x68')]=function(_0x401f78,_0x20f6f6,_0x3c4a69){var _0x53b094=_0x401f78['body'][_0xef0b('0x69')];return db[_0xef0b('0x67')][_0xef0b('0x48')]({'where':{'id':_0x53b094},'attributes':['id'],'include':[{'model':db[_0xef0b('0x5c')],'as':_0xef0b('0x6a'),'attributes':['id',_0xef0b('0x2f'),_0xef0b('0x6b'),_0xef0b('0x6c'),_0xef0b('0x6d')],'raw':!![]}]})['then'](function(_0x5ea5e7){if(_0x5ea5e7){var _0x59c111=_[_0xef0b('0x6e')](_0x5ea5e7,function(_0x328c16){var _0x132c66=_0x328c16['get']({'plain':!![]});return _0x132c66['Agents'];});return db['FaxQueue'][_0xef0b('0x4e')]({'where':{'id':_0x401f78[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](function(_0x54583e){return db[_0xef0b('0x6f')][_0xef0b('0x70')](function(_0x271387){return _0x54583e[_0xef0b('0x68')](_0x53b094,{'transaction':_0x271387})[_0xef0b('0x28')](function(){return BPromise[_0xef0b('0x71')](_0x59c111,function(_0x2bff6f){return db[_0xef0b('0x5b')][_0xef0b('0x72')]({'where':{'UserId':_0x2bff6f['id'],'FaxQueueId':_0x401f78[_0xef0b('0x4c')]['id']},'transaction':_0x271387});});})['then'](function(){_0x59c111['forEach'](function(_0x860944){socket[_0xef0b('0x73')]('userFaxQueue:save',{'UserId':_0x860944['id'],'FaxQueueId':_0x54583e['id']});});});});});}})[_0xef0b('0x28')](respondWithStatusCode(_0x20f6f6,null))['catch'](handleError(_0x20f6f6,null));};exports[_0xef0b('0x74')]=function(_0xb69bf2,_0x33cbe8,_0x179eeb){return db[_0xef0b('0x67')]['findAll']({'where':{'id':_0xb69bf2[_0xef0b('0x37')][_0xef0b('0x69')]},'attributes':['id'],'include':[{'model':db[_0xef0b('0x5c')],'as':_0xef0b('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xef0b('0x28')](handleEntityNotFound(_0x33cbe8,null))['then'](function(_0x134d2b){var _0x4cbb29=_[_0xef0b('0x32')](_0x134d2b,'id');var _0x3d32e1=[];var _0x16470b=[];var _0x34a84c=squel[_0xef0b('0x75')]();_0x34a84c[_0xef0b('0x76')](_0xef0b('0x77'))[_0xef0b('0x78')]('team_has_fax_queues','tq')['join']('user_has_teams','ut',_0xef0b('0x79'))[_0xef0b('0x3f')](_0xef0b('0x7a'),_0xb69bf2[_0xef0b('0x4c')]['id']);for(var _0x4f20ea=0x0;_0x4f20ea<_0x134d2b['length'];_0x4f20ea+=0x1){let _0x3b44ec=_0x134d2b[_0x4f20ea];for(var _0x3d0a1a=0x0;_0x3d0a1a<_0x3b44ec['Agents'][_0xef0b('0x3b')];_0x3d0a1a+=0x1){let _0x2745a3=_0x3b44ec[_0xef0b('0x6a')][_0x3d0a1a];var _0x209f00=_0x34a84c[_0xef0b('0x7b')]();_0x209f00[_0xef0b('0x3f')](_0xef0b('0x7c'),_0x2745a3['id']);_0x16470b[_0xef0b('0x7d')](db[_0xef0b('0x6f')][_0xef0b('0x37')](_0x209f00[_0xef0b('0x7e')](),{'type':db['sequelize'][_0xef0b('0x7f')][_0xef0b('0x80')]})[_0xef0b('0x28')](function(_0x23a8be){if(_0x23a8be[_0xef0b('0x3b')]===0x1){return _0x2745a3['id'];}else{var _0x40d436=_[_0xef0b('0x81')](_[_0xef0b('0x32')](_0x23a8be,_0xef0b('0x82')),function(_0x198566){return _[_0xef0b('0x83')](_0x4cbb29,_0x198566);});if(_0x40d436){return _0x2745a3['id'];}}}));}}return BPromise[_0xef0b('0x84')](_0x16470b)['then'](function(_0x193ddf){_0x3d32e1=_(_0x3d32e1)[_0xef0b('0x85')](_0x193ddf)[_0xef0b('0x86')]()[_0xef0b('0x87')]();return db[_0xef0b('0x33')][_0xef0b('0x4e')]({'where':{'id':_0xb69bf2[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](function(_0x5aab03){return db[_0xef0b('0x6f')][_0xef0b('0x70')](function(_0x255bea){return _0x5aab03[_0xef0b('0x74')](_0xb69bf2[_0xef0b('0x37')][_0xef0b('0x69')],{'transaction':_0x255bea})[_0xef0b('0x28')](function(){if(!_[_0xef0b('0x88')](_0x3d32e1)){return _0x5aab03[_0xef0b('0x89')](_0x3d32e1,{'transaction':_0x255bea});}})['then'](function(){_0x3d32e1[_0xef0b('0x8a')](function(_0x2da6da){socket['emit'](_0xef0b('0x8b'),{'UserId':_0x2da6da,'FaxQueueId':_0x5aab03['id']});});});});});});})[_0xef0b('0x28')](respondWithStatusCode(_0x33cbe8,null))[_0xef0b('0x4a')](handleError(_0x33cbe8,null));};exports[_0xef0b('0x8c')]=function(_0x56dd58,_0x4ab1a7,_0x5836a0){return db[_0xef0b('0x33')][_0xef0b('0x4e')]({'where':{'id':_0x56dd58[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](handleEntityNotFound(_0x4ab1a7,null))['then'](function(_0x8b71ac){if(_0x8b71ac){return _0x8b71ac[_0xef0b('0x8c')](_0x56dd58[_0xef0b('0x55')][_0xef0b('0x69')],_['omit'](_0x56dd58['body'],['ids','id'])||{})[_0xef0b('0x8d')](function(_0x210ad0){for(var _0x1d99e1=0x0;_0x1d99e1<_0x56dd58[_0xef0b('0x55')][_0xef0b('0x69')][_0xef0b('0x3b')];_0x1d99e1+=0x1){socket[_0xef0b('0x73')](_0xef0b('0x8e'),{'UserId':Number(_0x56dd58['body'][_0xef0b('0x69')][_0x1d99e1]),'FaxQueueId':Number(_0x56dd58[_0xef0b('0x4c')]['id'])});}return _0x210ad0;});}})[_0xef0b('0x28')](respondWithResult(_0x4ab1a7,null))[_0xef0b('0x4a')](handleError(_0x4ab1a7,null));};exports[_0xef0b('0x89')]=function(_0x2ae8d2,_0x3bc601,_0x3d8429){return db[_0xef0b('0x33')][_0xef0b('0x4e')]({'where':{'id':_0x2ae8d2[_0xef0b('0x4c')]['id']}})[_0xef0b('0x28')](handleEntityNotFound(_0x3bc601,null))[_0xef0b('0x28')](function(_0x57a82c){if(_0x57a82c){return _0x57a82c[_0xef0b('0x89')](_0x2ae8d2[_0xef0b('0x37')]['ids'])['then'](function(){if(_[_0xef0b('0x8f')](_0x2ae8d2['query'][_0xef0b('0x69')])){for(var _0x1f24ae=0x0;_0x1f24ae<_0x2ae8d2[_0xef0b('0x37')][_0xef0b('0x69')]['length'];_0x1f24ae+=0x1){socket['emit'](_0xef0b('0x8b'),{'UserId':Number(_0x2ae8d2[_0xef0b('0x37')]['ids'][_0x1f24ae]),'FaxQueueId':Number(_0x2ae8d2['params']['id'])});}}else{socket[_0xef0b('0x73')](_0xef0b('0x8b'),{'UserId':Number(_0x2ae8d2['query'][_0xef0b('0x69')]),'FaxQueueId':Number(_0x2ae8d2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3bc601,null))['catch'](handleError(_0x3bc601,null));};exports[_0xef0b('0x90')]=function(_0x43921d,_0x28dc6a,_0x2bf4dc){var _0x18d942={};var _0x325fda={};var _0x3247a6;var _0x583f22;return db[_0xef0b('0x33')][_0xef0b('0x57')]({'where':{'id':_0x43921d['params']['id']}})['then'](handleEntityNotFound(_0x28dc6a,null))['then'](function(_0x2952c4){if(_0x2952c4){_0x3247a6=_0x2952c4;_0x325fda[_0xef0b('0x36')]=_[_0xef0b('0x58')](db['User'][_0xef0b('0x4d')]);_0x325fda[_0xef0b('0x37')]=_[_0xef0b('0x58')](_0x43921d[_0xef0b('0x37')]);_0x325fda[_0xef0b('0x41')]=_[_0xef0b('0x38')](_0x325fda[_0xef0b('0x36')],_0x325fda[_0xef0b('0x37')]);_0x18d942['attributes']=_[_0xef0b('0x38')](_0x325fda[_0xef0b('0x36')],qs[_0xef0b('0x39')](_0x43921d[_0xef0b('0x37')][_0xef0b('0x39')]));_0x18d942[_0xef0b('0x3a')]=_0x18d942[_0xef0b('0x3a')][_0xef0b('0x3b')]?_0x18d942[_0xef0b('0x3a')]:_0x325fda[_0xef0b('0x36')];_0x18d942[_0xef0b('0x3d')]=qs['sort'](_0x43921d[_0xef0b('0x37')][_0xef0b('0x3e')]);_0x18d942[_0xef0b('0x3f')]=qs['filters'](_[_0xef0b('0x40')](_0x43921d[_0xef0b('0x37')],_0x325fda[_0xef0b('0x41')]));if(_0x43921d[_0xef0b('0x37')][_0xef0b('0x42')]){_0x18d942['where']=_[_0xef0b('0x43')](_0x18d942['where'],{'$or':_['map'](_0x18d942[_0xef0b('0x3a')],function(_0x50b9e2){var _0x3bfbb0={};_0x3bfbb0[_0x50b9e2]={'$like':'%'+_0x43921d[_0xef0b('0x37')][_0xef0b('0x42')]+'%'};return _0x3bfbb0;})});}_0x18d942=_[_0xef0b('0x43')]({},_0x18d942,_0x43921d['options']);return _0x3247a6[_0xef0b('0x90')](_0x18d942);}})[_0xef0b('0x28')](function(_0x1b6e3c){if(_0x1b6e3c){_0x583f22=_0x1b6e3c[_0xef0b('0x3b')];if(!_0x43921d[_0xef0b('0x37')][_0xef0b('0x59')](_0xef0b('0x3c'))){_0x18d942[_0xef0b('0x22')]=qs[_0xef0b('0x22')](_0x43921d[_0xef0b('0x37')]['limit']);_0x18d942['offset']=qs[_0xef0b('0x20')](_0x43921d[_0xef0b('0x37')]['offset']);}return _0x3247a6[_0xef0b('0x90')](_0x18d942);}})['then'](function(_0x201864){if(_0x201864){return _0x201864?{'count':_0x583f22,'rows':_0x201864}:null;}})['then'](respondWithResult(_0x28dc6a,null))['catch'](handleError(_0x28dc6a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 965f0fd..fc74584 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 _0x3482=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x3482,0x192));var _0x2348=function(_0x2d8d12,_0x5ec696){_0x2d8d12=_0x2d8d12-0x0;var _0x3c2473=_0x3482[_0x2d8d12];return _0x3c2473;};'use strict';var EventEmitter=require(_0x2348('0x0'));var FaxQueue=require(_0x2348('0x1'))['db'][_0x2348('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2348('0x3')](0x0);var events={'afterCreate':_0x2348('0x4'),'afterUpdate':_0x2348('0x5'),'afterDestroy':_0x2348('0x6')};function emitEvent(_0x15eb3b){return function(_0xd5366b,_0x5947e0,_0x48f4cb){FaxQueueEvents[_0x2348('0x7')](_0x15eb3b+':'+_0xd5366b['id'],_0xd5366b);FaxQueueEvents['emit'](_0x15eb3b,_0xd5366b);_0x48f4cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2348('0x8')](e,emitEvent(event));}}module[_0x2348('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xe2ea=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','save','update','remove','emit'];(function(_0x39c27e,_0x29c8b7){var _0x1eb1e8=function(_0xc00a3d){while(--_0xc00a3d){_0x39c27e['push'](_0x39c27e['shift']());}};_0x1eb1e8(++_0x29c8b7);}(_0xe2ea,0x89));var _0xae2e=function(_0x3344e1,_0x273223){_0x3344e1=_0x3344e1-0x0;var _0x20ae18=_0xe2ea[_0x3344e1];return _0x20ae18;};'use strict';var EventEmitter=require(_0xae2e('0x0'));var FaxQueue=require(_0xae2e('0x1'))['db'][_0xae2e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae2e('0x3'),'afterUpdate':_0xae2e('0x4'),'afterDestroy':_0xae2e('0x5')};function emitEvent(_0x36fabc){return function(_0xd1a941,_0x4f7cd5,_0x169445){FaxQueueEvents[_0xae2e('0x6')](_0x36fabc+':'+_0xd1a941['id'],_0xd1a941);FaxQueueEvents[_0xae2e('0x6')](_0x36fabc,_0xd1a941);_0x169445(null);};}for(var e in events){if(events[_0xae2e('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xae2e('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 10124cb..b78b575 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 _0x6fc4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x6fc4,0xdd));var _0x46fc=function(_0x25fef3,_0x2238b0){_0x25fef3=_0x25fef3-0x0;var _0x5d9ea1=_0x6fc4[_0x25fef3];return _0x5d9ea1;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var logger=require(_0x46fc('0x2'))(_0x46fc('0x3'));var moment=require(_0x46fc('0x4'));var BPromise=require(_0x46fc('0x5'));var rp=require(_0x46fc('0x6'));var fs=require('fs');var path=require(_0x46fc('0x7'));var rimraf=require(_0x46fc('0x8'));var config=require(_0x46fc('0x9'));var attributes=require(_0x46fc('0xa'));module[_0x46fc('0xb')]=function(_0x3fce43,_0x5d6bfd){return _0x3fce43[_0x46fc('0xc')](_0x46fc('0xd'),attributes,{'tableName':_0x46fc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc03=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0xbc03,0x197));var _0x3bc0=function(_0x552752,_0x423e32){_0x552752=_0x552752-0x0;var _0x19fa79=_0xbc03[_0x552752];return _0x19fa79;};'use strict';var _=require(_0x3bc0('0x0'));var util=require(_0x3bc0('0x1'));var logger=require(_0x3bc0('0x2'))('api');var moment=require(_0x3bc0('0x3'));var BPromise=require(_0x3bc0('0x4'));var rp=require(_0x3bc0('0x5'));var fs=require('fs');var path=require(_0x3bc0('0x6'));var rimraf=require(_0x3bc0('0x7'));var config=require(_0x3bc0('0x8'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x56087d,_0x7e1a76){return _0x56087d[_0x3bc0('0x9')]('FaxQueue',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 590f3e4..186a8e4 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 _0x2be3=['GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','redis','localhost','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3a42df,_0x3d9577){var _0x38e0a2=function(_0x3f7a03){while(--_0x3f7a03){_0x3a42df['push'](_0x3a42df['shift']());}};_0x38e0a2(++_0x3d9577);}(_0x2be3,0x99));var _0x32be=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2be3[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x32be('0x0'));var rs=require(_0x32be('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32be('0x2'));var logger=require('../../config/logger')(_0x32be('0x3'));var config=require(_0x32be('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x32be('0x5')]['http']({'port':0x232a});config[_0x32be('0x6')]=_['defaults'](config[_0x32be('0x6')],{'host':_0x32be('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32be('0x6')]));require(_0x32be('0x8'))['register'](socket);function respondWithRpcPromise(_0x3d2c65,_0x409a35,_0x251adb){return new BPromise(function(_0x3bedce,_0x5ab9d4){return client[_0x32be('0x9')](_0x3d2c65,_0x251adb)[_0x32be('0xa')](function(_0xad91a5){logger[_0x32be('0xb')](_0x32be('0xc'),_0x409a35,_0x32be('0xd'));logger[_0x32be('0xe')](_0x32be('0xf'),_0x409a35,'request\x20sent',JSON[_0x32be('0x10')](_0xad91a5));if(_0xad91a5[_0x32be('0x11')]){if(_0xad91a5[_0x32be('0x11')][_0x32be('0x12')]===0x1f4){logger[_0x32be('0x11')](_0x32be('0xc'),_0x409a35,_0xad91a5[_0x32be('0x11')][_0x32be('0x13')]);return _0x5ab9d4(_0xad91a5['error']['message']);}logger[_0x32be('0x11')](_0x32be('0xc'),_0x409a35,_0xad91a5[_0x32be('0x11')]['message']);return _0x3bedce(_0xad91a5[_0x32be('0x11')][_0x32be('0x13')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x409a35,_0x32be('0xd'));_0x3bedce(_0xad91a5[_0x32be('0x14')][_0x32be('0x13')]);}})[_0x32be('0x15')](function(_0x2d003e){logger['error'](_0x32be('0xc'),_0x409a35,_0x2d003e);_0x5ab9d4(_0x2d003e);});});}exports[_0x32be('0x16')]=function(_0x598d0e){var _0x29fa00=this;return new Promise(function(_0x5b5a66,_0x564cb8){return db[_0x32be('0x17')][_0x32be('0x18')]({'raw':_0x598d0e[_0x32be('0x19')]?_0x598d0e[_0x32be('0x19')][_0x32be('0x1a')]===undefined?!![]:![]:!![],'where':_0x598d0e[_0x32be('0x19')]?_0x598d0e['options'][_0x32be('0x1b')]||null:null,'attributes':_0x598d0e[_0x32be('0x19')]?_0x598d0e['options'][_0x32be('0x1c')]||null:null,'limit':_0x598d0e['options']?_0x598d0e[_0x32be('0x19')][_0x32be('0x1d')]||null:null,'include':_0x598d0e[_0x32be('0x19')]?_0x598d0e[_0x32be('0x19')][_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x598d0e[_0x32be('0x19')]['include'],function(_0x5a4766){return{'model':db[_0x5a4766[_0x32be('0x20')]],'as':_0x5a4766['as'],'attributes':_0x5a4766[_0x32be('0x1c')],'include':_0x5a4766[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x5a4766[_0x32be('0x1e')],function(_0x42b8f0){return{'model':db[_0x42b8f0[_0x32be('0x20')]],'as':_0x42b8f0['as'],'attributes':_0x42b8f0[_0x32be('0x1c')],'include':_0x42b8f0[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x42b8f0['include'],function(_0x4d10cd){return{'model':db[_0x4d10cd[_0x32be('0x20')]],'as':_0x4d10cd['as'],'attributes':_0x4d10cd[_0x32be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32be('0xa')](function(_0x364842){logger[_0x32be('0xb')]('GetFaxQueue',_0x598d0e);logger[_0x32be('0xe')](_0x32be('0x16'),_0x598d0e,JSON[_0x32be('0x10')](_0x364842));_0x5b5a66(_0x364842);})[_0x32be('0x15')](function(_0x328780){logger[_0x32be('0x11')]('GetFaxQueue',_0x328780['message'],_0x598d0e);_0x564cb8(_0x29fa00['error'](0x1f4,_0x328780[_0x32be('0x13')]));});});};exports[_0x32be('0x21')]=function(_0xd38912){var _0x53e58a=this;return new Promise(function(_0x33eba2,_0x4a2ad6){return db[_0x32be('0x17')][_0x32be('0x22')]({'raw':_0xd38912['options']?_0xd38912['options'][_0x32be('0x1a')]===undefined?!![]:![]:!![],'where':_0xd38912['options']?_0xd38912[_0x32be('0x19')]['where']||null:null,'attributes':_0xd38912['options']?_0xd38912[_0x32be('0x19')][_0x32be('0x1c')]||null:null,'include':_0xd38912['options']?_0xd38912[_0x32be('0x19')][_0x32be('0x1e')]?_[_0x32be('0x1f')](_0xd38912['options'][_0x32be('0x1e')],function(_0x497c85){return{'model':db[_0x497c85[_0x32be('0x20')]],'as':_0x497c85['as'],'attributes':_0x497c85[_0x32be('0x1c')],'include':_0x497c85[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x497c85[_0x32be('0x1e')],function(_0x20e1c4){return{'model':db[_0x20e1c4[_0x32be('0x20')]],'as':_0x20e1c4['as'],'attributes':_0x20e1c4[_0x32be('0x1c')],'include':_0x20e1c4[_0x32be('0x1e')]?_[_0x32be('0x1f')](_0x20e1c4['include'],function(_0x2e9bbf){return{'model':db[_0x2e9bbf[_0x32be('0x20')]],'as':_0x2e9bbf['as'],'attributes':_0x2e9bbf[_0x32be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x32be('0xa')](function(_0x41616e){logger[_0x32be('0xb')](_0x32be('0x21'),_0xd38912);logger[_0x32be('0xe')](_0x32be('0x21'),_0xd38912,JSON['stringify'](_0x41616e));_0x33eba2(_0x41616e);})[_0x32be('0x15')](function(_0x4d0bd0){logger['error'](_0x32be('0x21'),_0x4d0bd0[_0x32be('0x13')],_0xd38912);_0x4a2ad6(_0x53e58a['error'](0x1f4,_0x4d0bd0[_0x32be('0x13')]));});});}; \ No newline at end of file +var _0x1610=['options','raw','where','attributes','include','map','model','ShowFaxQueue','FaxQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','findAll'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x1610,0x1ea));var _0x0161=function(_0x1ba090,_0x233e76){_0x1ba090=_0x1ba090-0x0;var _0x49cf67=_0x1610[_0x1ba090];return _0x49cf67;};'use strict';var _=require(_0x0161('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0161('0x1'));var rs=require(_0x0161('0x2'));var fs=require('fs');var Redis=require(_0x0161('0x3'));var db=require(_0x0161('0x4'))['db'];var utils=require(_0x0161('0x5'));var logger=require(_0x0161('0x6'))(_0x0161('0x7'));var config=require(_0x0161('0x8'));var jayson=require(_0x0161('0x9'));var client=jayson[_0x0161('0xa')][_0x0161('0xb')]({'port':0x232a});config[_0x0161('0xc')]=_[_0x0161('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0161('0xe'))[_0x0161('0xf')](socket);function respondWithRpcPromise(_0xbbe3a5,_0x50c60a,_0xac44a4){return new BPromise(function(_0x3e7b94,_0x22a4b1){return client[_0x0161('0x10')](_0xbbe3a5,_0xac44a4)[_0x0161('0x11')](function(_0xe18b8c){logger[_0x0161('0x12')]('FaxQueue,\x20%s,\x20%s',_0x50c60a,_0x0161('0x13'));logger[_0x0161('0x14')](_0x0161('0x15'),_0x50c60a,_0x0161('0x13'),JSON[_0x0161('0x16')](_0xe18b8c));if(_0xe18b8c[_0x0161('0x17')]){if(_0xe18b8c[_0x0161('0x17')]['code']===0x1f4){logger[_0x0161('0x17')](_0x0161('0x18'),_0x50c60a,_0xe18b8c[_0x0161('0x17')][_0x0161('0x19')]);return _0x22a4b1(_0xe18b8c['error'][_0x0161('0x19')]);}logger[_0x0161('0x17')]('FaxQueue,\x20%s,\x20%s',_0x50c60a,_0xe18b8c['error'][_0x0161('0x19')]);return _0x3e7b94(_0xe18b8c[_0x0161('0x17')][_0x0161('0x19')]);}else{logger[_0x0161('0x12')](_0x0161('0x18'),_0x50c60a,'request\x20sent');_0x3e7b94(_0xe18b8c[_0x0161('0x1a')]['message']);}})[_0x0161('0x1b')](function(_0x206ed1){logger[_0x0161('0x17')](_0x0161('0x18'),_0x50c60a,_0x206ed1);_0x22a4b1(_0x206ed1);});});}exports[_0x0161('0x1c')]=function(_0x1a7e05){var _0x562a5c=this;return new Promise(function(_0x2f86bd,_0x5acbd8){return db['FaxQueue'][_0x0161('0x1d')]({'raw':_0x1a7e05[_0x0161('0x1e')]?_0x1a7e05[_0x0161('0x1e')][_0x0161('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a7e05['options']?_0x1a7e05[_0x0161('0x1e')][_0x0161('0x20')]||null:null,'attributes':_0x1a7e05[_0x0161('0x1e')]?_0x1a7e05['options'][_0x0161('0x21')]||null:null,'limit':_0x1a7e05[_0x0161('0x1e')]?_0x1a7e05[_0x0161('0x1e')]['limit']||null:null,'include':_0x1a7e05[_0x0161('0x1e')]?_0x1a7e05[_0x0161('0x1e')][_0x0161('0x22')]?_[_0x0161('0x23')](_0x1a7e05[_0x0161('0x1e')][_0x0161('0x22')],function(_0x20ff2f){return{'model':db[_0x20ff2f['model']],'as':_0x20ff2f['as'],'attributes':_0x20ff2f[_0x0161('0x21')],'include':_0x20ff2f[_0x0161('0x22')]?_[_0x0161('0x23')](_0x20ff2f[_0x0161('0x22')],function(_0x25da95){return{'model':db[_0x25da95[_0x0161('0x24')]],'as':_0x25da95['as'],'attributes':_0x25da95['attributes'],'include':_0x25da95[_0x0161('0x22')]?_[_0x0161('0x23')](_0x25da95[_0x0161('0x22')],function(_0x26ef3f){return{'model':db[_0x26ef3f[_0x0161('0x24')]],'as':_0x26ef3f['as'],'attributes':_0x26ef3f[_0x0161('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x532a8a){logger[_0x0161('0x12')](_0x0161('0x1c'),_0x1a7e05);logger[_0x0161('0x14')](_0x0161('0x1c'),_0x1a7e05,JSON['stringify'](_0x532a8a));_0x2f86bd(_0x532a8a);})[_0x0161('0x1b')](function(_0x2df302){logger[_0x0161('0x17')](_0x0161('0x1c'),_0x2df302[_0x0161('0x19')],_0x1a7e05);_0x5acbd8(_0x562a5c[_0x0161('0x17')](0x1f4,_0x2df302['message']));});});};exports[_0x0161('0x25')]=function(_0x2d58e0){var _0x15c0a0=this;return new Promise(function(_0x1b66d7,_0x1283db){return db[_0x0161('0x26')][_0x0161('0x27')]({'raw':_0x2d58e0['options']?_0x2d58e0[_0x0161('0x1e')][_0x0161('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d58e0[_0x0161('0x1e')]?_0x2d58e0['options']['where']||null:null,'attributes':_0x2d58e0[_0x0161('0x1e')]?_0x2d58e0[_0x0161('0x1e')][_0x0161('0x21')]||null:null,'include':_0x2d58e0['options']?_0x2d58e0['options'][_0x0161('0x22')]?_[_0x0161('0x23')](_0x2d58e0[_0x0161('0x1e')]['include'],function(_0x3f0ad){return{'model':db[_0x3f0ad[_0x0161('0x24')]],'as':_0x3f0ad['as'],'attributes':_0x3f0ad[_0x0161('0x21')],'include':_0x3f0ad[_0x0161('0x22')]?_[_0x0161('0x23')](_0x3f0ad[_0x0161('0x22')],function(_0x55166b){return{'model':db[_0x55166b['model']],'as':_0x55166b['as'],'attributes':_0x55166b[_0x0161('0x21')],'include':_0x55166b[_0x0161('0x22')]?_[_0x0161('0x23')](_0x55166b[_0x0161('0x22')],function(_0x40dde5){return{'model':db[_0x40dde5[_0x0161('0x24')]],'as':_0x40dde5['as'],'attributes':_0x40dde5[_0x0161('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0161('0x11')](function(_0x483d84){logger[_0x0161('0x12')](_0x0161('0x25'),_0x2d58e0);logger[_0x0161('0x14')](_0x0161('0x25'),_0x2d58e0,JSON[_0x0161('0x16')](_0x483d84));_0x1b66d7(_0x483d84);})[_0x0161('0x1b')](function(_0x2ab938){logger[_0x0161('0x17')](_0x0161('0x25'),_0x2ab938[_0x0161('0x19')],_0x2d58e0);_0x1283db(_0x15c0a0[_0x0161('0x17')](0x1f4,_0x2ab938[_0x0161('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 4fa7043..f5a9da2 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 _0xf45b=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x4a0e37,_0x2ccabf){var _0x57477b=function(_0x14c9a1){while(--_0x14c9a1){_0x4a0e37['push'](_0x4a0e37['shift']());}};_0x57477b(++_0x2ccabf);}(_0xf45b,0x13e));var _0xbf45=function(_0xf7dd0f,_0x396c3b){_0xf7dd0f=_0xf7dd0f-0x0;var _0x3fc64b=_0xf45b[_0xf7dd0f];return _0x3fc64b;};'use strict';var FaxQueueEvents=require(_0xbf45('0x0'));var events=[_0xbf45('0x1'),_0xbf45('0x2'),_0xbf45('0x3')];function createListener(_0x4f7b17,_0x5248d3){return function(_0x50e028){_0x5248d3[_0xbf45('0x4')](_0x4f7b17,_0x50e028);};}function removeListener(_0x3e559b,_0x5d019e){return function(){FaxQueueEvents[_0xbf45('0x5')](_0x3e559b,_0x5d019e);};}exports[_0xbf45('0x6')]=function(_0x57ea5d){for(var _0xe16b6d=0x0,_0x408cee=events[_0xbf45('0x7')];_0xe16b6d<_0x408cee;_0xe16b6d++){var _0x28c646=events[_0xe16b6d];var _0x38d56e=createListener(_0xbf45('0x8')+_0x28c646,_0x57ea5d);FaxQueueEvents['on'](_0x28c646,_0x38d56e);}}; \ No newline at end of file +var _0xc076=['save','remove','emit','removeListener','length','faxQueue:','./faxQueue.events'];(function(_0x331639,_0x3ceeaa){var _0x5420ea=function(_0x175c36){while(--_0x175c36){_0x331639['push'](_0x331639['shift']());}};_0x5420ea(++_0x3ceeaa);}(_0xc076,0x84));var _0x6c07=function(_0x1917bc,_0x197b0f){_0x1917bc=_0x1917bc-0x0;var _0x5254a1=_0xc076[_0x1917bc];return _0x5254a1;};'use strict';var FaxQueueEvents=require(_0x6c07('0x0'));var events=[_0x6c07('0x1'),_0x6c07('0x2'),'update'];function createListener(_0x2ecf83,_0x446e59){return function(_0x378c9a){_0x446e59[_0x6c07('0x3')](_0x2ecf83,_0x378c9a);};}function removeListener(_0x3b0d7b,_0x3cca5c){return function(){FaxQueueEvents[_0x6c07('0x4')](_0x3b0d7b,_0x3cca5c);};}exports['register']=function(_0x357e00){for(var _0x539506=0x0,_0x3c3e4a=events[_0x6c07('0x5')];_0x539506<_0x3c3e4a;_0x539506++){var _0x2eeb2b=events[_0x539506];var _0x2c1e72=createListener(_0x6c07('0x6')+_0x2eeb2b,_0x357e00);FaxQueueEvents['on'](_0x2eeb2b,_0x2c1e72);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7427823..4984d8f 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb934=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb934,0x92));var _0x4b93=function(_0x36a106,_0x1d271f){_0x36a106=_0x36a106-0x0;var _0x8531a2=_0xb934[_0x36a106];return _0x8531a2;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0x8')](_0x4b93('0xe'),auth[_0x4b93('0x9')](),controller['getMembers']);router[_0x4b93('0x8')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x8')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);router[_0x4b93('0x13')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0x14')]);router[_0x4b93('0x13')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x15')]);router['post'](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x16')]);router['put'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x17')]);router[_0x4b93('0x18')](_0x4b93('0xc'),auth['isAuthenticated'](),controller[_0x4b93('0x19')]);router[_0x4b93('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4b93('0x1a')]);router[_0x4b93('0x18')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x1b')]);module[_0x4b93('0x1c')]=router; \ No newline at end of file +var _0x83d0=['show','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x465442,_0x43d7a6){var _0x37434d=function(_0x4a08b6){while(--_0x4a08b6){_0x465442['push'](_0x465442['shift']());}};_0x37434d(++_0x43d7a6);}(_0x83d0,0xb7));var _0x083d=function(_0x35ae61,_0x3abaf2){_0x35ae61=_0x35ae61-0x0;var _0x5cbebb=_0x83d0[_0x35ae61];return _0x5cbebb;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require(_0x083d('0x4'));var router=express[_0x083d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x083d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x083d('0x7'));router[_0x083d('0x8')]('/',auth[_0x083d('0x9')](),controller[_0x083d('0xa')]);router[_0x083d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x083d('0xb')]);router[_0x083d('0x8')](_0x083d('0xc'),auth['isAuthenticated'](),controller[_0x083d('0xd')]);router[_0x083d('0x8')](_0x083d('0xe'),auth[_0x083d('0x9')](),controller['getMembers']);router[_0x083d('0x8')]('/:id/teams',auth[_0x083d('0x9')](),controller[_0x083d('0xf')]);router['get'](_0x083d('0x10'),auth[_0x083d('0x9')](),controller[_0x083d('0x11')]);router[_0x083d('0x12')]('/',auth[_0x083d('0x9')](),controller['create']);router[_0x083d('0x12')](_0x083d('0x13'),auth['isAuthenticated'](),controller[_0x083d('0x14')]);router['post']('/:id/users',auth[_0x083d('0x9')](),controller[_0x083d('0x15')]);router[_0x083d('0x16')](_0x083d('0xc'),auth[_0x083d('0x9')](),controller['update']);router[_0x083d('0x17')]('/:id',auth[_0x083d('0x9')](),controller[_0x083d('0x18')]);router[_0x083d('0x17')](_0x083d('0x13'),auth[_0x083d('0x9')](),controller[_0x083d('0x19')]);router[_0x083d('0x17')](_0x083d('0x10'),auth[_0x083d('0x9')](),controller[_0x083d('0x1a')]);module[_0x083d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index e283cc9..f2a2aff 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 _0x76d5=['exports','STRING','DATE'];(function(_0xbb8d37,_0x342d57){var _0x13844e=function(_0x47bfc5){while(--_0x47bfc5){_0xbb8d37['push'](_0xbb8d37['shift']());}};_0x13844e(++_0x342d57);}(_0x76d5,0x108));var _0x576d=function(_0x17dacd,_0xb39305){_0x17dacd=_0x17dacd-0x0;var _0x10a2aa=_0x76d5[_0x17dacd];return _0x10a2aa;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x576d('0x0')]={'uniqueid':{'type':Sequelize[_0x576d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x576d('0x2')]},'exitAt':{'type':Sequelize[_0x576d('0x2')]},'reason':{'type':Sequelize[_0x576d('0x1')]}}; \ No newline at end of file +var _0xa191=['DATE','STRING','moment','sequelize','exports'];(function(_0x2bfd9e,_0x3b8f49){var _0x3cfbbe=function(_0x3d0c71){while(--_0x3d0c71){_0x2bfd9e['push'](_0x2bfd9e['shift']());}};_0x3cfbbe(++_0x3b8f49);}(_0xa191,0xa7));var _0x1a19=function(_0x1c9432,_0xe0da2d){_0x1c9432=_0x1c9432-0x0;var _0x277c85=_0xa191[_0x1c9432];return _0x277c85;};'use strict';var moment=require(_0x1a19('0x0'));var Sequelize=require(_0x1a19('0x1'));module[_0x1a19('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1a19('0x3')]},'leaveAt':{'type':Sequelize[_0x1a19('0x3')]},'acceptAt':{'type':Sequelize[_0x1a19('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1a19('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 77ebead..bb30a83 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 _0x25b0=['sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','map','FaxQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x25b0,0x140));var _0x025b=function(_0x5459b0,_0x4d2ef8){_0x5459b0=_0x5459b0-0x0;var _0x675a35=_0x25b0[_0x5459b0];return _0x675a35;};'use strict';var emlformat=require(_0x025b('0x0'));var rimraf=require(_0x025b('0x1'));var zipdir=require(_0x025b('0x2'));var jsonpatch=require(_0x025b('0x3'));var rp=require(_0x025b('0x4'));var moment=require(_0x025b('0x5'));var BPromise=require(_0x025b('0x6'));var Mustache=require(_0x025b('0x7'));var util=require(_0x025b('0x8'));var path=require(_0x025b('0x9'));var sox=require('sox');var csv=require(_0x025b('0xa'));var ejs=require(_0x025b('0xb'));var fs=require('fs');var fs_extra=require(_0x025b('0xc'));var _=require('lodash');var squel=require(_0x025b('0xd'));var crypto=require(_0x025b('0xe'));var jsforce=require(_0x025b('0xf'));var deskjs=require(_0x025b('0x10'));var toCsv=require(_0x025b('0xa'));var querystring=require(_0x025b('0x11'));var Papa=require(_0x025b('0x12'));var Redis=require('ioredis');var authService=require(_0x025b('0x13'));var qs=require(_0x025b('0x14'));var as=require(_0x025b('0x15'));var hardwareService=require(_0x025b('0x16'));var logger=require(_0x025b('0x17'))(_0x025b('0x18'));var utils=require(_0x025b('0x19'));var config=require(_0x025b('0x1a'));var licenseUtil=require(_0x025b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403230,_0x4ff41a){_0x4ff41a=_0x4ff41a||0xcc;return function(_0x288d63){if(_0x288d63){return _0x403230[_0x025b('0x1c')](_0x4ff41a);}return _0x403230[_0x025b('0x1d')](_0x4ff41a)['end']();};}function respondWithResult(_0x2761e3,_0x4347ec){_0x4347ec=_0x4347ec||0xc8;return function(_0x2c831d){if(_0x2c831d){return _0x2761e3[_0x025b('0x1d')](_0x4347ec)[_0x025b('0x1e')](_0x2c831d);}};}function respondWithFilteredResult(_0x263191,_0x41b189){return function(_0x50d54b){if(_0x50d54b){var _0x242be4=typeof _0x41b189[_0x025b('0x1f')]===_0x025b('0x20')&&typeof _0x41b189[_0x025b('0x21')]===_0x025b('0x20');var _0x795cac=_0x50d54b[_0x025b('0x22')];var _0x525651=_0x242be4?0x0:_0x41b189[_0x025b('0x1f')];var _0x3c1a58=_0x242be4?_0x50d54b[_0x025b('0x22')]:_0x41b189[_0x025b('0x1f')]+_0x41b189[_0x025b('0x21')];var _0x102b89;if(_0x3c1a58>=_0x795cac){_0x3c1a58=_0x795cac;_0x102b89=0xc8;}else{_0x102b89=0xce;}_0x263191[_0x025b('0x1d')](_0x102b89);return _0x263191[_0x025b('0x23')](_0x025b('0x24'),_0x525651+'-'+_0x3c1a58+'/'+_0x795cac)[_0x025b('0x1e')](_0x50d54b);}return null;};}function patchUpdates(_0x56866e){return function(_0x463388){try{jsonpatch[_0x025b('0x25')](_0x463388,_0x56866e,!![]);}catch(_0x7430fd){return BPromise[_0x025b('0x26')](_0x7430fd);}return _0x463388['save']();};}function saveUpdates(_0x4c712a,_0x1a519d){return function(_0x415655){if(_0x415655){return _0x415655[_0x025b('0x27')](_0x4c712a)[_0x025b('0x28')](function(_0x4edb56){return _0x4edb56;});}return null;};}function removeEntity(_0x1c65fc,_0x2dd34b){return function(_0x34acb1){if(_0x34acb1){return _0x34acb1[_0x025b('0x29')]()[_0x025b('0x28')](function(){_0x1c65fc[_0x025b('0x1d')](0xcc)[_0x025b('0x2a')]();});}};}function handleEntityNotFound(_0x31fd5a,_0x25bd08){return function(_0x352f69){if(!_0x352f69){_0x31fd5a[_0x025b('0x1c')](0x194);}return _0x352f69;};}function handleError(_0x2b97ba,_0x14086f){_0x14086f=_0x14086f||0x1f4;return function(_0x3dca9b){logger['error'](_0x3dca9b[_0x025b('0x2b')]);if(_0x3dca9b[_0x025b('0x2c')]){delete _0x3dca9b[_0x025b('0x2c')];}_0x2b97ba[_0x025b('0x1d')](_0x14086f)['send'](_0x3dca9b);};}exports[_0x025b('0x2d')]=function(_0x503aaf,_0x1f19d9){var _0x21b41a={},_0x296de2={},_0x229e6d={'count':0x0,'rows':[]};var _0x2d074f=_[_0x025b('0x2e')](db[_0x025b('0x2f')]['rawAttributes'],function(_0x41d26e){return{'name':_0x41d26e['fieldName'],'type':_0x41d26e[_0x025b('0x30')][_0x025b('0x31')]};});_0x296de2[_0x025b('0x32')]=_[_0x025b('0x2e')](_0x2d074f,'name');_0x296de2[_0x025b('0x33')]=_[_0x025b('0x34')](_0x503aaf[_0x025b('0x33')]);_0x296de2[_0x025b('0x35')]=_[_0x025b('0x36')](_0x296de2[_0x025b('0x32')],_0x296de2[_0x025b('0x33')]);_0x21b41a[_0x025b('0x37')]=_['intersection'](_0x296de2[_0x025b('0x32')],qs[_0x025b('0x38')](_0x503aaf['query'][_0x025b('0x38')]));_0x21b41a[_0x025b('0x37')]=_0x21b41a[_0x025b('0x37')][_0x025b('0x39')]?_0x21b41a[_0x025b('0x37')]:_0x296de2['model'];if(!_0x503aaf['query'][_0x025b('0x3a')](_0x025b('0x3b'))){_0x21b41a[_0x025b('0x21')]=qs[_0x025b('0x21')](_0x503aaf[_0x025b('0x33')][_0x025b('0x21')]);_0x21b41a[_0x025b('0x1f')]=qs['offset'](_0x503aaf['query']['offset']);}_0x21b41a['order']=qs['sort'](_0x503aaf[_0x025b('0x33')][_0x025b('0x3c')]);_0x21b41a[_0x025b('0x3d')]=qs['filters'](_[_0x025b('0x3e')](_0x503aaf['query'],_0x296de2['filters']),_0x2d074f);if(_0x503aaf[_0x025b('0x33')][_0x025b('0x3f')]){_0x21b41a['where']=_[_0x025b('0x40')](_0x21b41a[_0x025b('0x3d')],{'$or':_[_0x025b('0x2e')](_0x2d074f,function(_0x4a4268){if(_0x4a4268[_0x025b('0x30')]!=='VIRTUAL'){var _0x30c3d5={};_0x30c3d5[_0x4a4268[_0x025b('0x2c')]]={'$like':'%'+_0x503aaf[_0x025b('0x33')][_0x025b('0x3f')]+'%'};return _0x30c3d5;}})});}_0x21b41a=_['merge']({},_0x21b41a,_0x503aaf[_0x025b('0x41')]);var _0x5ac85f={'where':_0x21b41a[_0x025b('0x3d')]};return db['FaxQueueReport'][_0x025b('0x22')](_0x5ac85f)[_0x025b('0x28')](function(_0x1880a7){_0x229e6d[_0x025b('0x22')]=_0x1880a7;if(_0x503aaf[_0x025b('0x33')]['includeAll']){_0x21b41a[_0x025b('0x42')]=[{'all':!![]}];}return db[_0x025b('0x2f')]['findAll'](_0x21b41a);})['then'](function(_0x1a77d6){_0x229e6d[_0x025b('0x43')]=_0x1a77d6;return _0x229e6d;})[_0x025b('0x28')](respondWithFilteredResult(_0x1f19d9,_0x21b41a))[_0x025b('0x44')](handleError(_0x1f19d9,null));};exports[_0x025b('0x45')]=function(_0x5134e4,_0x2f0d21){var _0x4b59df={'raw':!![],'where':{'id':_0x5134e4[_0x025b('0x46')]['id']}},_0x24b530={};_0x24b530[_0x025b('0x32')]=_[_0x025b('0x34')](db[_0x025b('0x2f')]['rawAttributes']);_0x24b530[_0x025b('0x33')]=_[_0x025b('0x34')](_0x5134e4[_0x025b('0x33')]);_0x24b530[_0x025b('0x35')]=_[_0x025b('0x36')](_0x24b530[_0x025b('0x32')],_0x24b530[_0x025b('0x33')]);_0x4b59df[_0x025b('0x37')]=_[_0x025b('0x36')](_0x24b530[_0x025b('0x32')],qs[_0x025b('0x38')](_0x5134e4[_0x025b('0x33')][_0x025b('0x38')]));_0x4b59df[_0x025b('0x37')]=_0x4b59df[_0x025b('0x37')]['length']?_0x4b59df['attributes']:_0x24b530['model'];if(_0x5134e4['query'][_0x025b('0x47')]){_0x4b59df[_0x025b('0x42')]=[{'all':!![]}];}_0x4b59df=_[_0x025b('0x40')]({},_0x4b59df,_0x5134e4[_0x025b('0x41')]);return db[_0x025b('0x2f')][_0x025b('0x48')](_0x4b59df)['then'](handleEntityNotFound(_0x2f0d21,null))[_0x025b('0x28')](respondWithResult(_0x2f0d21,null))[_0x025b('0x44')](handleError(_0x2f0d21,null));};exports['create']=function(_0x4424f0,_0x39ce38){return db['FaxQueueReport'][_0x025b('0x49')](_0x4424f0[_0x025b('0x4a')],{})[_0x025b('0x28')](respondWithResult(_0x39ce38,0xc9))[_0x025b('0x44')](handleError(_0x39ce38,null));};exports[_0x025b('0x27')]=function(_0x5489c0,_0x3b10c4){if(_0x5489c0[_0x025b('0x4a')]['id']){delete _0x5489c0[_0x025b('0x4a')]['id'];}return db[_0x025b('0x2f')]['find']({'where':{'id':_0x5489c0[_0x025b('0x46')]['id']}})[_0x025b('0x28')](handleEntityNotFound(_0x3b10c4,null))[_0x025b('0x28')](saveUpdates(_0x5489c0[_0x025b('0x4a')],null))[_0x025b('0x28')](respondWithResult(_0x3b10c4,null))[_0x025b('0x44')](handleError(_0x3b10c4,null));};exports['destroy']=function(_0x317001,_0xc216ff){return db[_0x025b('0x2f')]['find']({'where':{'id':_0x317001[_0x025b('0x46')]['id']}})[_0x025b('0x28')](handleEntityNotFound(_0xc216ff,null))[_0x025b('0x28')](removeEntity(_0xc216ff,null))['catch'](handleError(_0xc216ff,null));};exports['describe']=function(_0x1c4f03,_0x5ea697){return db[_0x025b('0x2f')][_0x025b('0x4b')]()[_0x025b('0x28')](respondWithResult(_0x5ea697,null))['catch'](handleError(_0x5ea697,null));}; \ No newline at end of file +var _0x0427=['pick','filter','where','VIRTUAL','merge','options','include','FaxQueueReport','rows','catch','show','keys','includeAll','find','create','body','update','params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x0427,0x137));var _0x7042=function(_0x35d84c,_0x56d412){_0x35d84c=_0x35d84c-0x0;var _0x23db15=_0x0427[_0x35d84c];return _0x23db15;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7042('0x0'));var jsonpatch=require(_0x7042('0x1'));var rp=require('request-promise');var moment=require(_0x7042('0x2'));var BPromise=require(_0x7042('0x3'));var Mustache=require(_0x7042('0x4'));var util=require(_0x7042('0x5'));var path=require(_0x7042('0x6'));var sox=require(_0x7042('0x7'));var csv=require(_0x7042('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7042('0x9'));var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0x8'));var querystring=require(_0x7042('0xf'));var Papa=require(_0x7042('0x10'));var Redis=require('ioredis');var authService=require(_0x7042('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7042('0x12'));var utils=require('../../config/utils');var config=require(_0x7042('0x13'));var licenseUtil=require(_0x7042('0x14'));var db=require(_0x7042('0x15'))['db'];function respondWithStatusCode(_0x5629f2,_0x5c06f0){_0x5c06f0=_0x5c06f0||0xcc;return function(_0x292c4a){if(_0x292c4a){return _0x5629f2[_0x7042('0x16')](_0x5c06f0);}return _0x5629f2[_0x7042('0x17')](_0x5c06f0)[_0x7042('0x18')]();};}function respondWithResult(_0x25dfe5,_0xee4c2){_0xee4c2=_0xee4c2||0xc8;return function(_0x5def25){if(_0x5def25){return _0x25dfe5[_0x7042('0x17')](_0xee4c2)[_0x7042('0x19')](_0x5def25);}};}function respondWithFilteredResult(_0x6ed505,_0x5c1ef0){return function(_0x4c68c4){if(_0x4c68c4){var _0xc7e44e=typeof _0x5c1ef0['offset']===_0x7042('0x1a')&&typeof _0x5c1ef0['limit']==='undefined';var _0x28add7=_0x4c68c4[_0x7042('0x1b')];var _0x1e69aa=_0xc7e44e?0x0:_0x5c1ef0[_0x7042('0x1c')];var _0x6e18fb=_0xc7e44e?_0x4c68c4['count']:_0x5c1ef0[_0x7042('0x1c')]+_0x5c1ef0[_0x7042('0x1d')];var _0x34fda6;if(_0x6e18fb>=_0x28add7){_0x6e18fb=_0x28add7;_0x34fda6=0xc8;}else{_0x34fda6=0xce;}_0x6ed505[_0x7042('0x17')](_0x34fda6);return _0x6ed505[_0x7042('0x1e')]('Content-Range',_0x1e69aa+'-'+_0x6e18fb+'/'+_0x28add7)[_0x7042('0x19')](_0x4c68c4);}return null;};}function patchUpdates(_0x580f84){return function(_0x363f3c){try{jsonpatch['apply'](_0x363f3c,_0x580f84,!![]);}catch(_0x3b8203){return BPromise[_0x7042('0x1f')](_0x3b8203);}return _0x363f3c[_0x7042('0x20')]();};}function saveUpdates(_0x456dfc,_0x484c82){return function(_0x5a224b){if(_0x5a224b){return _0x5a224b['update'](_0x456dfc)[_0x7042('0x21')](function(_0x30a722){return _0x30a722;});}return null;};}function removeEntity(_0x3af8bc,_0x1949fe){return function(_0x48d529){if(_0x48d529){return _0x48d529[_0x7042('0x22')]()[_0x7042('0x21')](function(){_0x3af8bc[_0x7042('0x17')](0xcc)[_0x7042('0x18')]();});}};}function handleEntityNotFound(_0x459ff6,_0x54445b){return function(_0xc5fed3){if(!_0xc5fed3){_0x459ff6[_0x7042('0x16')](0x194);}return _0xc5fed3;};}function handleError(_0xf3c3f9,_0x1a05d1){_0x1a05d1=_0x1a05d1||0x1f4;return function(_0x2e4dbe){logger[_0x7042('0x23')](_0x2e4dbe[_0x7042('0x24')]);if(_0x2e4dbe[_0x7042('0x25')]){delete _0x2e4dbe[_0x7042('0x25')];}_0xf3c3f9[_0x7042('0x17')](_0x1a05d1)[_0x7042('0x26')](_0x2e4dbe);};}exports[_0x7042('0x27')]=function(_0x88c156,_0x1b6a29){var _0x101b89={},_0x3203f3={},_0x477972={'count':0x0,'rows':[]};var _0xa7461d=_[_0x7042('0x28')](db['FaxQueueReport']['rawAttributes'],function(_0x37cf52){return{'name':_0x37cf52[_0x7042('0x29')],'type':_0x37cf52[_0x7042('0x2a')][_0x7042('0x2b')]};});_0x3203f3[_0x7042('0x2c')]=_[_0x7042('0x28')](_0xa7461d,_0x7042('0x25'));_0x3203f3['query']=_['keys'](_0x88c156[_0x7042('0x2d')]);_0x3203f3[_0x7042('0x2e')]=_['intersection'](_0x3203f3[_0x7042('0x2c')],_0x3203f3[_0x7042('0x2d')]);_0x101b89['attributes']=_[_0x7042('0x2f')](_0x3203f3[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x88c156[_0x7042('0x2d')][_0x7042('0x30')]));_0x101b89['attributes']=_0x101b89[_0x7042('0x31')]['length']?_0x101b89['attributes']:_0x3203f3[_0x7042('0x2c')];if(!_0x88c156['query'][_0x7042('0x32')](_0x7042('0x33'))){_0x101b89['limit']=qs[_0x7042('0x1d')](_0x88c156['query'][_0x7042('0x1d')]);_0x101b89[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x88c156[_0x7042('0x2d')][_0x7042('0x1c')]);}_0x101b89[_0x7042('0x34')]=qs[_0x7042('0x35')](_0x88c156[_0x7042('0x2d')][_0x7042('0x35')]);_0x101b89['where']=qs[_0x7042('0x2e')](_[_0x7042('0x36')](_0x88c156[_0x7042('0x2d')],_0x3203f3['filters']),_0xa7461d);if(_0x88c156['query'][_0x7042('0x37')]){_0x101b89[_0x7042('0x38')]=_['merge'](_0x101b89[_0x7042('0x38')],{'$or':_[_0x7042('0x28')](_0xa7461d,function(_0x349198){if(_0x349198[_0x7042('0x2a')]!==_0x7042('0x39')){var _0x3abd08={};_0x3abd08[_0x349198[_0x7042('0x25')]]={'$like':'%'+_0x88c156[_0x7042('0x2d')][_0x7042('0x37')]+'%'};return _0x3abd08;}})});}_0x101b89=_[_0x7042('0x3a')]({},_0x101b89,_0x88c156[_0x7042('0x3b')]);var _0x4232c2={'where':_0x101b89[_0x7042('0x38')]};return db['FaxQueueReport']['count'](_0x4232c2)[_0x7042('0x21')](function(_0x43f372){_0x477972[_0x7042('0x1b')]=_0x43f372;if(_0x88c156[_0x7042('0x2d')]['includeAll']){_0x101b89[_0x7042('0x3c')]=[{'all':!![]}];}return db[_0x7042('0x3d')]['findAll'](_0x101b89);})['then'](function(_0x1f8e68){_0x477972[_0x7042('0x3e')]=_0x1f8e68;return _0x477972;})[_0x7042('0x21')](respondWithFilteredResult(_0x1b6a29,_0x101b89))[_0x7042('0x3f')](handleError(_0x1b6a29,null));};exports[_0x7042('0x40')]=function(_0x4a4e90,_0x5de476){var _0x2c8d2a={'raw':!![],'where':{'id':_0x4a4e90['params']['id']}},_0x3897fc={};_0x3897fc[_0x7042('0x2c')]=_[_0x7042('0x41')](db[_0x7042('0x3d')]['rawAttributes']);_0x3897fc['query']=_[_0x7042('0x41')](_0x4a4e90[_0x7042('0x2d')]);_0x3897fc[_0x7042('0x2e')]=_['intersection'](_0x3897fc[_0x7042('0x2c')],_0x3897fc[_0x7042('0x2d')]);_0x2c8d2a['attributes']=_[_0x7042('0x2f')](_0x3897fc[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x4a4e90[_0x7042('0x2d')][_0x7042('0x30')]));_0x2c8d2a[_0x7042('0x31')]=_0x2c8d2a[_0x7042('0x31')]['length']?_0x2c8d2a[_0x7042('0x31')]:_0x3897fc[_0x7042('0x2c')];if(_0x4a4e90['query'][_0x7042('0x42')]){_0x2c8d2a[_0x7042('0x3c')]=[{'all':!![]}];}_0x2c8d2a=_[_0x7042('0x3a')]({},_0x2c8d2a,_0x4a4e90[_0x7042('0x3b')]);return db[_0x7042('0x3d')][_0x7042('0x43')](_0x2c8d2a)['then'](handleEntityNotFound(_0x5de476,null))['then'](respondWithResult(_0x5de476,null))['catch'](handleError(_0x5de476,null));};exports[_0x7042('0x44')]=function(_0x55ecfe,_0x4821d3){return db[_0x7042('0x3d')]['create'](_0x55ecfe[_0x7042('0x45')],{})[_0x7042('0x21')](respondWithResult(_0x4821d3,0xc9))[_0x7042('0x3f')](handleError(_0x4821d3,null));};exports[_0x7042('0x46')]=function(_0x1a22d5,_0x11e7ce){if(_0x1a22d5[_0x7042('0x45')]['id']){delete _0x1a22d5[_0x7042('0x45')]['id'];}return db[_0x7042('0x3d')][_0x7042('0x43')]({'where':{'id':_0x1a22d5[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x11e7ce,null))[_0x7042('0x21')](saveUpdates(_0x1a22d5['body'],null))[_0x7042('0x21')](respondWithResult(_0x11e7ce,null))[_0x7042('0x3f')](handleError(_0x11e7ce,null));};exports[_0x7042('0x22')]=function(_0x81b898,_0x3fcf0e){return db[_0x7042('0x3d')][_0x7042('0x43')]({'where':{'id':_0x81b898[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x3fcf0e,null))[_0x7042('0x21')](removeEntity(_0x3fcf0e,null))[_0x7042('0x3f')](handleError(_0x3fcf0e,null));};exports[_0x7042('0x48')]=function(_0x79f988,_0x4d1518){return db[_0x7042('0x3d')]['describe']()[_0x7042('0x21')](respondWithResult(_0x4d1518,null))[_0x7042('0x3f')](handleError(_0x4d1518,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index bd8b73b..9051c7b 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x26b4d8,_0x44c5bb){var _0x1484e5=function(_0x1119a4){while(--_0x1119a4){_0x26b4d8['push'](_0x26b4d8['shift']());}};_0x1484e5(++_0x44c5bb);}(_0xabce,0x103));var _0xeabc=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xabce[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x258232,_0x2c3ad2){var _0x242cf6=function(_0xf9c171){while(--_0xf9c171){_0x258232['push'](_0x258232['shift']());}};_0x242cf6(++_0x2c3ad2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc4aa[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 567ae3b..b3e8ee0 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 _0xa7df=['info','result','catch','FaxQueueReport','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','update','body','options','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0xc7f205,_0x2d60a7){var _0x11a494=function(_0x367ff8){while(--_0x367ff8){_0xc7f205['push'](_0xc7f205['shift']());}};_0x11a494(++_0x2d60a7);}(_0xa7df,0x1c7));var _0xfa7d=function(_0x4fd573,_0x2a953b){_0x4fd573=_0x4fd573-0x0;var _0x926f6d=_0xa7df[_0x4fd573];return _0x926f6d;};'use strict';var _=require(_0xfa7d('0x0'));var util=require(_0xfa7d('0x1'));var moment=require('moment');var BPromise=require(_0xfa7d('0x2'));var rs=require(_0xfa7d('0x3'));var fs=require('fs');var Redis=require(_0xfa7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa7d('0x5'));var logger=require(_0xfa7d('0x6'))(_0xfa7d('0x7'));var config=require(_0xfa7d('0x8'));var jayson=require(_0xfa7d('0x9'));var client=jayson[_0xfa7d('0xa')][_0xfa7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab846,_0x3fdf04,_0x1cba85){return new BPromise(function(_0x49036c,_0x3b501b){return client[_0xfa7d('0xc')](_0x5ab846,_0x1cba85)[_0xfa7d('0xd')](function(_0x326750){logger['info'](_0xfa7d('0xe'),_0x3fdf04,'request\x20sent');logger[_0xfa7d('0xf')](_0xfa7d('0x10'),_0x3fdf04,_0xfa7d('0x11'),JSON['stringify'](_0x326750));if(_0x326750['error']){if(_0x326750[_0xfa7d('0x12')][_0xfa7d('0x13')]===0x1f4){logger[_0xfa7d('0x12')](_0xfa7d('0xe'),_0x3fdf04,_0x326750[_0xfa7d('0x12')][_0xfa7d('0x14')]);return _0x3b501b(_0x326750['error'][_0xfa7d('0x14')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3fdf04,_0x326750[_0xfa7d('0x12')][_0xfa7d('0x14')]);return _0x49036c(_0x326750[_0xfa7d('0x12')][_0xfa7d('0x14')]);}else{logger[_0xfa7d('0x15')](_0xfa7d('0xe'),_0x3fdf04,_0xfa7d('0x11'));_0x49036c(_0x326750[_0xfa7d('0x16')]['message']);}})[_0xfa7d('0x17')](function(_0x12faec){logger[_0xfa7d('0x12')](_0xfa7d('0xe'),_0x3fdf04,_0x12faec);_0x3b501b(_0x12faec);});});}exports['CreateFaxQueueReport']=function(_0x9de0d7){var _0xf1d13d=this;return new Promise(function(_0x488c10,_0x24ac96){return db[_0xfa7d('0x18')]['create'](_0x9de0d7['body'],{'raw':_0x9de0d7['options']?_0x9de0d7['options']['raw']===undefined?!![]:![]:!![]})[_0xfa7d('0xd')](function(_0x8f1e8f){logger[_0xfa7d('0x15')](_0xfa7d('0x19'),_0x9de0d7);logger['debug'](_0xfa7d('0x19'),_0x9de0d7,JSON[_0xfa7d('0x1a')](_0x8f1e8f));_0x488c10(_0x8f1e8f);})[_0xfa7d('0x17')](function(_0x24676b){logger[_0xfa7d('0x12')]('CreateFaxQueueReport',_0x24676b['message'],_0x9de0d7);_0x24ac96(_0xf1d13d['error'](0x1f4,_0x24676b[_0xfa7d('0x14')]));});});};exports[_0xfa7d('0x1b')]=function(_0x48e60a){var _0x1b0106=this;return new Promise(function(_0x426a65,_0x4c2b60){return db[_0xfa7d('0x18')][_0xfa7d('0x1c')](_0x48e60a[_0xfa7d('0x1d')],{'raw':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a[_0xfa7d('0x1e')][_0xfa7d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a['options']['where']||null:null,'attributes':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a[_0xfa7d('0x1e')][_0xfa7d('0x20')]||null:null,'limit':_0x48e60a[_0xfa7d('0x1e')]?_0x48e60a[_0xfa7d('0x1e')][_0xfa7d('0x21')]||null:null})[_0xfa7d('0xd')](function(_0x7d2125){logger[_0xfa7d('0x15')]('UpdateFaxQueueReport',_0x48e60a);logger['debug'](_0xfa7d('0x1b'),_0x48e60a,JSON[_0xfa7d('0x1a')](_0x7d2125));_0x426a65(_0x7d2125);})[_0xfa7d('0x17')](function(_0x15dd1e){logger[_0xfa7d('0x12')](_0xfa7d('0x1b'),_0x15dd1e[_0xfa7d('0x14')],_0x48e60a);_0x4c2b60(_0x1b0106[_0xfa7d('0x12')](0x1f4,_0x15dd1e[_0xfa7d('0x14')]));});});}; \ No newline at end of file +var _0x44ea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','debug','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','moment','randomstring'];(function(_0x5d6ad2,_0x2e8b1b){var _0x2e21b8=function(_0x201435){while(--_0x201435){_0x5d6ad2['push'](_0x5d6ad2['shift']());}};_0x2e21b8(++_0x2e8b1b);}(_0x44ea,0x151));var _0xa44e=function(_0x4e6a0c,_0x4bb54c){_0x4e6a0c=_0x4e6a0c-0x0;var _0xcf2d47=_0x44ea[_0x4e6a0c];return _0xcf2d47;};'use strict';var _=require(_0xa44e('0x0'));var util=require('util');var moment=require(_0xa44e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa44e('0x2'));var fs=require('fs');var Redis=require(_0xa44e('0x3'));var db=require(_0xa44e('0x4'))['db'];var utils=require(_0xa44e('0x5'));var logger=require(_0xa44e('0x6'))(_0xa44e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa44e('0x8')][_0xa44e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5525af,_0x12c66a,_0x28172a){return new BPromise(function(_0xcac66c,_0x5381ad){return client[_0xa44e('0xa')](_0x5525af,_0x28172a)[_0xa44e('0xb')](function(_0x820dcf){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x12c66a,'request\x20sent');logger['debug'](_0xa44e('0xc'),_0x12c66a,'request\x20sent',JSON[_0xa44e('0xd')](_0x820dcf));if(_0x820dcf[_0xa44e('0xe')]){if(_0x820dcf[_0xa44e('0xe')][_0xa44e('0xf')]===0x1f4){logger[_0xa44e('0xe')](_0xa44e('0x10'),_0x12c66a,_0x820dcf[_0xa44e('0xe')][_0xa44e('0x11')]);return _0x5381ad(_0x820dcf[_0xa44e('0xe')][_0xa44e('0x11')]);}logger[_0xa44e('0xe')](_0xa44e('0x10'),_0x12c66a,_0x820dcf[_0xa44e('0xe')][_0xa44e('0x11')]);return _0xcac66c(_0x820dcf['error']['message']);}else{logger[_0xa44e('0x12')](_0xa44e('0x10'),_0x12c66a,_0xa44e('0x13'));_0xcac66c(_0x820dcf[_0xa44e('0x14')][_0xa44e('0x11')]);}})[_0xa44e('0x15')](function(_0x55fd72){logger[_0xa44e('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x12c66a,_0x55fd72);_0x5381ad(_0x55fd72);});});}exports[_0xa44e('0x16')]=function(_0x472c14){var _0x1d4cc5=this;return new Promise(function(_0x8bac6c,_0x22dccb){return db[_0xa44e('0x17')][_0xa44e('0x18')](_0x472c14[_0xa44e('0x19')],{'raw':_0x472c14['options']?_0x472c14[_0xa44e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa44e('0xb')](function(_0x1073d8){logger[_0xa44e('0x12')](_0xa44e('0x16'),_0x472c14);logger[_0xa44e('0x1b')](_0xa44e('0x16'),_0x472c14,JSON[_0xa44e('0xd')](_0x1073d8));_0x8bac6c(_0x1073d8);})[_0xa44e('0x15')](function(_0x1d44e3){logger[_0xa44e('0xe')](_0xa44e('0x16'),_0x1d44e3[_0xa44e('0x11')],_0x472c14);_0x22dccb(_0x1d4cc5[_0xa44e('0xe')](0x1f4,_0x1d44e3[_0xa44e('0x11')]));});});};exports[_0xa44e('0x1c')]=function(_0x32c8f2){var _0x570df4=this;return new Promise(function(_0x12838b,_0x44d221){return db['FaxQueueReport'][_0xa44e('0x1d')](_0x32c8f2[_0xa44e('0x19')],{'raw':_0x32c8f2['options']?_0x32c8f2[_0xa44e('0x1a')][_0xa44e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32c8f2[_0xa44e('0x1a')]?_0x32c8f2['options'][_0xa44e('0x1f')]||null:null,'attributes':_0x32c8f2[_0xa44e('0x1a')]?_0x32c8f2[_0xa44e('0x1a')][_0xa44e('0x20')]||null:null,'limit':_0x32c8f2[_0xa44e('0x1a')]?_0x32c8f2['options'][_0xa44e('0x21')]||null:null})['then'](function(_0x30ca5c){logger[_0xa44e('0x12')](_0xa44e('0x1c'),_0x32c8f2);logger[_0xa44e('0x1b')](_0xa44e('0x1c'),_0x32c8f2,JSON[_0xa44e('0xd')](_0x30ca5c));_0x12838b(_0x30ca5c);})[_0xa44e('0x15')](function(_0x2b09c4){logger[_0xa44e('0xe')](_0xa44e('0x1c'),_0x2b09c4[_0xa44e('0x11')],_0x32c8f2);_0x44d221(_0x570df4[_0xa44e('0xe')](0x1f4,_0x2b09c4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3d9af3a..d4575c6 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 _0xc5da=['update','destroy','exports','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x370092,_0x1cba5a){var _0x450c0d=function(_0x1e704d){while(--_0x1e704d){_0x370092['push'](_0x370092['shift']());}};_0x450c0d(++_0x1cba5a);}(_0xc5da,0xcf));var _0xac5d=function(_0x4adb52,_0xe8c27b){_0x4adb52=_0x4adb52-0x0;var _0x329062=_0xc5da[_0x4adb52];return _0x329062;};'use strict';var multer=require(_0xac5d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xac5d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xac5d('0x3'));var config=require(_0xac5d('0x4'));var controller=require(_0xac5d('0x5'));router[_0xac5d('0x6')]('/',auth[_0xac5d('0x7')](),controller[_0xac5d('0x8')]);router['get']('/describe',auth[_0xac5d('0x7')](),controller[_0xac5d('0x9')]);router['get'](_0xac5d('0xa'),auth[_0xac5d('0x7')](),controller[_0xac5d('0xb')]);router[_0xac5d('0xc')]('/',auth[_0xac5d('0x7')](),controller['create']);router[_0xac5d('0xd')](_0xac5d('0xa'),auth[_0xac5d('0x7')](),controller[_0xac5d('0xe')]);router['delete'](_0xac5d('0xa'),auth['isAuthenticated'](),controller[_0xac5d('0xf')]);module[_0xac5d('0x10')]=router; \ No newline at end of file +var _0xab10=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f8902,_0x502ecd){var _0x3408ac=function(_0x5550b2){while(--_0x5550b2){_0x4f8902['push'](_0x4f8902['shift']());}};_0x3408ac(++_0x502ecd);}(_0xab10,0x116));var _0x0ab1=function(_0x54f38f,_0x4e5b91){_0x54f38f=_0x54f38f-0x0;var _0x372183=_0xab10[_0x54f38f];return _0x372183;};'use strict';var multer=require(_0x0ab1('0x0'));var util=require(_0x0ab1('0x1'));var path=require('path');var timeout=require(_0x0ab1('0x2'));var express=require(_0x0ab1('0x3'));var router=express[_0x0ab1('0x4')]();var fs_extra=require(_0x0ab1('0x5'));var auth=require(_0x0ab1('0x6'));var interaction=require(_0x0ab1('0x7'));var config=require(_0x0ab1('0x8'));var controller=require('./faxQueueReport.controller');router[_0x0ab1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0ab1('0x9')]('/describe',auth[_0x0ab1('0xa')](),controller['describe']);router[_0x0ab1('0x9')](_0x0ab1('0xb'),auth[_0x0ab1('0xa')](),controller[_0x0ab1('0xc')]);router[_0x0ab1('0xd')]('/',auth[_0x0ab1('0xa')](),controller[_0x0ab1('0xe')]);router['put'](_0x0ab1('0xb'),auth[_0x0ab1('0xa')](),controller[_0x0ab1('0xf')]);router[_0x0ab1('0x10')](_0x0ab1('0xb'),auth['isAuthenticated'](),controller[_0x0ab1('0x11')]);module[_0x0ab1('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index cbcaec7..76433a9 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x42f07d,_0x424a90){_0x42f07d=_0x42f07d-0x0;var _0x20662f=_0xb43b[_0x42f07d];return _0x20662f;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x480310,_0x1f2e64){var _0x12a0ec=function(_0x580c07){while(--_0x580c07){_0x480310['push'](_0x480310['shift']());}};_0x12a0ec(++_0x1f2e64);}(_0xedd9,0xfc));var _0x9edd=function(_0x530804,_0x44e860){_0x530804=_0x530804-0x0;var _0x3c0f69=_0xedd9[_0x530804];return _0x3c0f69;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index dbf7b33..0cdf2a5 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 _0x6c02=['offset','set','Content-Range','then','destroy','end','stack','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','name','where','includeAll','include','findAll','rows','catch','show','params','merge','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','undefined','count'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x6c02,0x104));var _0x26c0=function(_0x54763f,_0x132c0e){_0x54763f=_0x54763f-0x0;var _0x1f25f0=_0x6c02[_0x54763f];return _0x1f25f0;};'use strict';var emlformat=require(_0x26c0('0x0'));var rimraf=require(_0x26c0('0x1'));var zipdir=require(_0x26c0('0x2'));var jsonpatch=require(_0x26c0('0x3'));var rp=require(_0x26c0('0x4'));var moment=require(_0x26c0('0x5'));var BPromise=require(_0x26c0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x26c0('0x7'));var csv=require(_0x26c0('0x8'));var ejs=require(_0x26c0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c0('0xa'));var squel=require(_0x26c0('0xb'));var crypto=require(_0x26c0('0xc'));var jsforce=require(_0x26c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x26c0('0x8'));var querystring=require(_0x26c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x26c0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x26c0('0x10'));var hardwareService=require(_0x26c0('0x11'));var logger=require(_0x26c0('0x12'))(_0x26c0('0x13'));var utils=require(_0x26c0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x26c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265585,_0x104be4){_0x104be4=_0x104be4||0xcc;return function(_0x4bdda7){if(_0x4bdda7){return _0x265585[_0x26c0('0x16')](_0x104be4);}return _0x265585['status'](_0x104be4)['end']();};}function respondWithResult(_0x3ccf7f,_0x56b95a){_0x56b95a=_0x56b95a||0xc8;return function(_0x437aa7){if(_0x437aa7){return _0x3ccf7f[_0x26c0('0x17')](_0x56b95a)[_0x26c0('0x18')](_0x437aa7);}};}function respondWithFilteredResult(_0x33fbe9,_0x365c55){return function(_0x4cde54){if(_0x4cde54){var _0x4dcd21=typeof _0x365c55['offset']==='undefined'&&typeof _0x365c55[_0x26c0('0x19')]===_0x26c0('0x1a');var _0x50967e=_0x4cde54[_0x26c0('0x1b')];var _0x1008ed=_0x4dcd21?0x0:_0x365c55['offset'];var _0x1dc570=_0x4dcd21?_0x4cde54[_0x26c0('0x1b')]:_0x365c55[_0x26c0('0x1c')]+_0x365c55[_0x26c0('0x19')];var _0x280197;if(_0x1dc570>=_0x50967e){_0x1dc570=_0x50967e;_0x280197=0xc8;}else{_0x280197=0xce;}_0x33fbe9[_0x26c0('0x17')](_0x280197);return _0x33fbe9[_0x26c0('0x1d')](_0x26c0('0x1e'),_0x1008ed+'-'+_0x1dc570+'/'+_0x50967e)[_0x26c0('0x18')](_0x4cde54);}return null;};}function patchUpdates(_0x397d09){return function(_0x54a22d){try{jsonpatch['apply'](_0x54a22d,_0x397d09,!![]);}catch(_0x179f85){return BPromise['reject'](_0x179f85);}return _0x54a22d['save']();};}function saveUpdates(_0x47a048,_0x286821){return function(_0x347a86){if(_0x347a86){return _0x347a86['update'](_0x47a048)[_0x26c0('0x1f')](function(_0x132cbf){return _0x132cbf;});}return null;};}function removeEntity(_0x258449,_0x7ade6f){return function(_0x3c4f08){if(_0x3c4f08){return _0x3c4f08[_0x26c0('0x20')]()['then'](function(){_0x258449[_0x26c0('0x17')](0xcc)[_0x26c0('0x21')]();});}};}function handleEntityNotFound(_0xcb70dd,_0x36ab47){return function(_0x288cf5){if(!_0x288cf5){_0xcb70dd[_0x26c0('0x16')](0x194);}return _0x288cf5;};}function handleError(_0xa57951,_0x31057f){_0x31057f=_0x31057f||0x1f4;return function(_0x1dc934){logger['error'](_0x1dc934[_0x26c0('0x22')]);if(_0x1dc934['name']){delete _0x1dc934['name'];}_0xa57951[_0x26c0('0x17')](_0x31057f)[_0x26c0('0x23')](_0x1dc934);};}exports['index']=function(_0x1378da,_0x8f9514){var _0x2b450a={},_0xd3486e={},_0x53ddfa={'count':0x0,'rows':[]};var _0x2346db=_[_0x26c0('0x24')](db[_0x26c0('0x25')][_0x26c0('0x26')],function(_0x12d949){return{'name':_0x12d949[_0x26c0('0x27')],'type':_0x12d949[_0x26c0('0x28')][_0x26c0('0x29')]};});_0xd3486e[_0x26c0('0x2a')]=_[_0x26c0('0x24')](_0x2346db,'name');_0xd3486e[_0x26c0('0x2b')]=_[_0x26c0('0x2c')](_0x1378da[_0x26c0('0x2b')]);_0xd3486e[_0x26c0('0x2d')]=_[_0x26c0('0x2e')](_0xd3486e[_0x26c0('0x2a')],_0xd3486e['query']);_0x2b450a[_0x26c0('0x2f')]=_[_0x26c0('0x2e')](_0xd3486e[_0x26c0('0x2a')],qs[_0x26c0('0x30')](_0x1378da[_0x26c0('0x2b')][_0x26c0('0x30')]));_0x2b450a[_0x26c0('0x2f')]=_0x2b450a[_0x26c0('0x2f')][_0x26c0('0x31')]?_0x2b450a[_0x26c0('0x2f')]:_0xd3486e[_0x26c0('0x2a')];if(!_0x1378da[_0x26c0('0x2b')][_0x26c0('0x32')](_0x26c0('0x33'))){_0x2b450a['limit']=qs[_0x26c0('0x19')](_0x1378da[_0x26c0('0x2b')][_0x26c0('0x19')]);_0x2b450a['offset']=qs[_0x26c0('0x1c')](_0x1378da[_0x26c0('0x2b')][_0x26c0('0x1c')]);}_0x2b450a[_0x26c0('0x34')]=qs[_0x26c0('0x35')](_0x1378da[_0x26c0('0x2b')]['sort']);_0x2b450a['where']=qs[_0x26c0('0x2d')](_[_0x26c0('0x36')](_0x1378da[_0x26c0('0x2b')],_0xd3486e[_0x26c0('0x2d')]),_0x2346db);if(_0x1378da[_0x26c0('0x2b')][_0x26c0('0x37')]){_0x2b450a['where']=_['merge'](_0x2b450a['where'],{'$or':_[_0x26c0('0x24')](_0x2346db,function(_0x517f2b){if(_0x517f2b['type']!==_0x26c0('0x38')){var _0x30d613={};_0x30d613[_0x517f2b[_0x26c0('0x39')]]={'$like':'%'+_0x1378da[_0x26c0('0x2b')][_0x26c0('0x37')]+'%'};return _0x30d613;}})});}_0x2b450a=_['merge']({},_0x2b450a,_0x1378da['options']);var _0x23ea7f={'where':_0x2b450a[_0x26c0('0x3a')]};return db['FaxTransferReport'][_0x26c0('0x1b')](_0x23ea7f)[_0x26c0('0x1f')](function(_0x241f63){_0x53ddfa[_0x26c0('0x1b')]=_0x241f63;if(_0x1378da[_0x26c0('0x2b')][_0x26c0('0x3b')]){_0x2b450a[_0x26c0('0x3c')]=[{'all':!![]}];}return db[_0x26c0('0x25')][_0x26c0('0x3d')](_0x2b450a);})[_0x26c0('0x1f')](function(_0xd1d026){_0x53ddfa[_0x26c0('0x3e')]=_0xd1d026;return _0x53ddfa;})[_0x26c0('0x1f')](respondWithFilteredResult(_0x8f9514,_0x2b450a))[_0x26c0('0x3f')](handleError(_0x8f9514,null));};exports[_0x26c0('0x40')]=function(_0x40e77d,_0x19d386){var _0x3d3cd5={'raw':!![],'where':{'id':_0x40e77d[_0x26c0('0x41')]['id']}},_0x4a7086={};_0x4a7086[_0x26c0('0x2a')]=_['keys'](db['FaxTransferReport'][_0x26c0('0x26')]);_0x4a7086[_0x26c0('0x2b')]=_[_0x26c0('0x2c')](_0x40e77d[_0x26c0('0x2b')]);_0x4a7086['filters']=_['intersection'](_0x4a7086[_0x26c0('0x2a')],_0x4a7086[_0x26c0('0x2b')]);_0x3d3cd5[_0x26c0('0x2f')]=_[_0x26c0('0x2e')](_0x4a7086['model'],qs['fields'](_0x40e77d[_0x26c0('0x2b')][_0x26c0('0x30')]));_0x3d3cd5[_0x26c0('0x2f')]=_0x3d3cd5['attributes'][_0x26c0('0x31')]?_0x3d3cd5[_0x26c0('0x2f')]:_0x4a7086[_0x26c0('0x2a')];if(_0x40e77d[_0x26c0('0x2b')][_0x26c0('0x3b')]){_0x3d3cd5[_0x26c0('0x3c')]=[{'all':!![]}];}_0x3d3cd5=_[_0x26c0('0x42')]({},_0x3d3cd5,_0x40e77d[_0x26c0('0x43')]);return db[_0x26c0('0x25')]['find'](_0x3d3cd5)[_0x26c0('0x1f')](handleEntityNotFound(_0x19d386,null))[_0x26c0('0x1f')](respondWithResult(_0x19d386,null))[_0x26c0('0x3f')](handleError(_0x19d386,null));};exports[_0x26c0('0x44')]=function(_0x248ffb,_0x12d40b){return db[_0x26c0('0x25')][_0x26c0('0x44')](_0x248ffb[_0x26c0('0x45')],{})['then'](respondWithResult(_0x12d40b,0xc9))[_0x26c0('0x3f')](handleError(_0x12d40b,null));};exports[_0x26c0('0x46')]=function(_0x5f351a,_0x1e1117){if(_0x5f351a[_0x26c0('0x45')]['id']){delete _0x5f351a['body']['id'];}return db[_0x26c0('0x25')][_0x26c0('0x47')]({'where':{'id':_0x5f351a[_0x26c0('0x41')]['id']}})[_0x26c0('0x1f')](handleEntityNotFound(_0x1e1117,null))['then'](saveUpdates(_0x5f351a[_0x26c0('0x45')],null))[_0x26c0('0x1f')](respondWithResult(_0x1e1117,null))[_0x26c0('0x3f')](handleError(_0x1e1117,null));};exports[_0x26c0('0x20')]=function(_0x150f49,_0x135ad4){return db[_0x26c0('0x25')][_0x26c0('0x47')]({'where':{'id':_0x150f49['params']['id']}})[_0x26c0('0x1f')](handleEntityNotFound(_0x135ad4,null))['then'](removeEntity(_0x135ad4,null))['catch'](handleError(_0x135ad4,null));};exports['describe']=function(_0x2f265e,_0x5e694c){return db[_0x26c0('0x25')]['describe']()[_0x26c0('0x1f')](respondWithResult(_0x5e694c,null))['catch'](handleError(_0x5e694c,null));}; \ No newline at end of file +var _0x5378=['sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','FaxTransferReport','count','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','end'];(function(_0x5d33a9,_0x1d72e9){var _0x59ec9d=function(_0x3505b3){while(--_0x3505b3){_0x5d33a9['push'](_0x5d33a9['shift']());}};_0x59ec9d(++_0x1d72e9);}(_0x5378,0x1ef));var _0x8537=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5378[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x8537('0x0'));var rimraf=require(_0x8537('0x1'));var zipdir=require(_0x8537('0x2'));var jsonpatch=require(_0x8537('0x3'));var rp=require(_0x8537('0x4'));var moment=require(_0x8537('0x5'));var BPromise=require(_0x8537('0x6'));var Mustache=require(_0x8537('0x7'));var util=require(_0x8537('0x8'));var path=require(_0x8537('0x9'));var sox=require(_0x8537('0xa'));var csv=require(_0x8537('0xb'));var ejs=require(_0x8537('0xc'));var fs=require('fs');var fs_extra=require(_0x8537('0xd'));var _=require('lodash');var squel=require(_0x8537('0xe'));var crypto=require(_0x8537('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8537('0x10'));var Papa=require(_0x8537('0x11'));var Redis=require(_0x8537('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8537('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8537('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8537('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8537('0x16'));var db=require(_0x8537('0x17'))['db'];function respondWithStatusCode(_0xb7f074,_0x10044e){_0x10044e=_0x10044e||0xcc;return function(_0x3f82d6){if(_0x3f82d6){return _0xb7f074['sendStatus'](_0x10044e);}return _0xb7f074[_0x8537('0x18')](_0x10044e)['end']();};}function respondWithResult(_0x530595,_0x4c8605){_0x4c8605=_0x4c8605||0xc8;return function(_0x156590){if(_0x156590){return _0x530595[_0x8537('0x18')](_0x4c8605)[_0x8537('0x19')](_0x156590);}};}function respondWithFilteredResult(_0xcacd5b,_0xb1a4e){return function(_0x4ded28){if(_0x4ded28){var _0x45f835=typeof _0xb1a4e[_0x8537('0x1a')]===_0x8537('0x1b')&&typeof _0xb1a4e[_0x8537('0x1c')]==='undefined';var _0x5b8ccf=_0x4ded28['count'];var _0x332271=_0x45f835?0x0:_0xb1a4e[_0x8537('0x1a')];var _0x2e874e=_0x45f835?_0x4ded28['count']:_0xb1a4e[_0x8537('0x1a')]+_0xb1a4e[_0x8537('0x1c')];var _0x358c0c;if(_0x2e874e>=_0x5b8ccf){_0x2e874e=_0x5b8ccf;_0x358c0c=0xc8;}else{_0x358c0c=0xce;}_0xcacd5b[_0x8537('0x18')](_0x358c0c);return _0xcacd5b[_0x8537('0x1d')](_0x8537('0x1e'),_0x332271+'-'+_0x2e874e+'/'+_0x5b8ccf)[_0x8537('0x19')](_0x4ded28);}return null;};}function patchUpdates(_0x38c221){return function(_0x2b353e){try{jsonpatch[_0x8537('0x1f')](_0x2b353e,_0x38c221,!![]);}catch(_0x528267){return BPromise[_0x8537('0x20')](_0x528267);}return _0x2b353e[_0x8537('0x21')]();};}function saveUpdates(_0x59f942,_0x266533){return function(_0xcd5c2c){if(_0xcd5c2c){return _0xcd5c2c[_0x8537('0x22')](_0x59f942)[_0x8537('0x23')](function(_0x567f4f){return _0x567f4f;});}return null;};}function removeEntity(_0x330787,_0x972860){return function(_0x4e6794){if(_0x4e6794){return _0x4e6794['destroy']()['then'](function(){_0x330787[_0x8537('0x18')](0xcc)[_0x8537('0x24')]();});}};}function handleEntityNotFound(_0x227765,_0x1be6ea){return function(_0x9baff7){if(!_0x9baff7){_0x227765[_0x8537('0x25')](0x194);}return _0x9baff7;};}function handleError(_0x28cb5f,_0x28802e){_0x28802e=_0x28802e||0x1f4;return function(_0x231546){logger[_0x8537('0x26')](_0x231546[_0x8537('0x27')]);if(_0x231546[_0x8537('0x28')]){delete _0x231546[_0x8537('0x28')];}_0x28cb5f['status'](_0x28802e)[_0x8537('0x29')](_0x231546);};}exports[_0x8537('0x2a')]=function(_0x5343b5,_0x46a138){var _0x1023f9={},_0xf0ef70={},_0x42b341={'count':0x0,'rows':[]};var _0x520c7a=_[_0x8537('0x2b')](db['FaxTransferReport'][_0x8537('0x2c')],function(_0x4213e5){return{'name':_0x4213e5[_0x8537('0x2d')],'type':_0x4213e5[_0x8537('0x2e')][_0x8537('0x2f')]};});_0xf0ef70[_0x8537('0x30')]=_['map'](_0x520c7a,_0x8537('0x28'));_0xf0ef70['query']=_[_0x8537('0x31')](_0x5343b5[_0x8537('0x32')]);_0xf0ef70[_0x8537('0x33')]=_[_0x8537('0x34')](_0xf0ef70[_0x8537('0x30')],_0xf0ef70[_0x8537('0x32')]);_0x1023f9[_0x8537('0x35')]=_[_0x8537('0x34')](_0xf0ef70[_0x8537('0x30')],qs[_0x8537('0x36')](_0x5343b5[_0x8537('0x32')]['fields']));_0x1023f9['attributes']=_0x1023f9['attributes']['length']?_0x1023f9[_0x8537('0x35')]:_0xf0ef70[_0x8537('0x30')];if(!_0x5343b5[_0x8537('0x32')][_0x8537('0x37')]('nolimit')){_0x1023f9[_0x8537('0x1c')]=qs[_0x8537('0x1c')](_0x5343b5[_0x8537('0x32')][_0x8537('0x1c')]);_0x1023f9[_0x8537('0x1a')]=qs[_0x8537('0x1a')](_0x5343b5['query'][_0x8537('0x1a')]);}_0x1023f9[_0x8537('0x38')]=qs[_0x8537('0x39')](_0x5343b5['query'][_0x8537('0x39')]);_0x1023f9['where']=qs[_0x8537('0x33')](_[_0x8537('0x3a')](_0x5343b5[_0x8537('0x32')],_0xf0ef70['filters']),_0x520c7a);if(_0x5343b5[_0x8537('0x32')]['filter']){_0x1023f9[_0x8537('0x3b')]=_[_0x8537('0x3c')](_0x1023f9[_0x8537('0x3b')],{'$or':_[_0x8537('0x2b')](_0x520c7a,function(_0x48126c){if(_0x48126c['type']!==_0x8537('0x3d')){var _0x2708f0={};_0x2708f0[_0x48126c[_0x8537('0x28')]]={'$like':'%'+_0x5343b5['query'][_0x8537('0x3e')]+'%'};return _0x2708f0;}})});}_0x1023f9=_[_0x8537('0x3c')]({},_0x1023f9,_0x5343b5['options']);var _0x6243ff={'where':_0x1023f9[_0x8537('0x3b')]};return db[_0x8537('0x3f')][_0x8537('0x40')](_0x6243ff)[_0x8537('0x23')](function(_0x55f8ed){_0x42b341[_0x8537('0x40')]=_0x55f8ed;if(_0x5343b5[_0x8537('0x32')][_0x8537('0x41')]){_0x1023f9[_0x8537('0x42')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x1023f9);})[_0x8537('0x23')](function(_0x2cf41e){_0x42b341[_0x8537('0x43')]=_0x2cf41e;return _0x42b341;})[_0x8537('0x23')](respondWithFilteredResult(_0x46a138,_0x1023f9))[_0x8537('0x44')](handleError(_0x46a138,null));};exports[_0x8537('0x45')]=function(_0x5c0cce,_0xf61259){var _0x38f1d4={'raw':!![],'where':{'id':_0x5c0cce[_0x8537('0x46')]['id']}},_0x408f30={};_0x408f30[_0x8537('0x30')]=_['keys'](db[_0x8537('0x3f')][_0x8537('0x2c')]);_0x408f30[_0x8537('0x32')]=_[_0x8537('0x31')](_0x5c0cce[_0x8537('0x32')]);_0x408f30[_0x8537('0x33')]=_['intersection'](_0x408f30[_0x8537('0x30')],_0x408f30[_0x8537('0x32')]);_0x38f1d4[_0x8537('0x35')]=_[_0x8537('0x34')](_0x408f30[_0x8537('0x30')],qs[_0x8537('0x36')](_0x5c0cce[_0x8537('0x32')]['fields']));_0x38f1d4[_0x8537('0x35')]=_0x38f1d4[_0x8537('0x35')]['length']?_0x38f1d4[_0x8537('0x35')]:_0x408f30[_0x8537('0x30')];if(_0x5c0cce[_0x8537('0x32')][_0x8537('0x41')]){_0x38f1d4['include']=[{'all':!![]}];}_0x38f1d4=_['merge']({},_0x38f1d4,_0x5c0cce[_0x8537('0x47')]);return db[_0x8537('0x3f')][_0x8537('0x48')](_0x38f1d4)[_0x8537('0x23')](handleEntityNotFound(_0xf61259,null))[_0x8537('0x23')](respondWithResult(_0xf61259,null))[_0x8537('0x44')](handleError(_0xf61259,null));};exports[_0x8537('0x49')]=function(_0x1c3e66,_0x31d3dc){return db[_0x8537('0x3f')]['create'](_0x1c3e66[_0x8537('0x4a')],{})[_0x8537('0x23')](respondWithResult(_0x31d3dc,0xc9))[_0x8537('0x44')](handleError(_0x31d3dc,null));};exports['update']=function(_0x137c56,_0x5e3b33){if(_0x137c56[_0x8537('0x4a')]['id']){delete _0x137c56[_0x8537('0x4a')]['id'];}return db[_0x8537('0x3f')][_0x8537('0x48')]({'where':{'id':_0x137c56['params']['id']}})[_0x8537('0x23')](handleEntityNotFound(_0x5e3b33,null))[_0x8537('0x23')](saveUpdates(_0x137c56['body'],null))[_0x8537('0x23')](respondWithResult(_0x5e3b33,null))['catch'](handleError(_0x5e3b33,null));};exports['destroy']=function(_0x86ee05,_0x1c4f39){return db['FaxTransferReport']['find']({'where':{'id':_0x86ee05[_0x8537('0x46')]['id']}})[_0x8537('0x23')](handleEntityNotFound(_0x1c4f39,null))['then'](removeEntity(_0x1c4f39,null))[_0x8537('0x44')](handleError(_0x1c4f39,null));};exports[_0x8537('0x4b')]=function(_0x5c1914,_0x637a62){return db[_0x8537('0x3f')][_0x8537('0x4b')]()[_0x8537('0x23')](respondWithResult(_0x637a62,null))[_0x8537('0x44')](handleError(_0x637a62,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 22a7657..e9cd9b4 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 _0x2572=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0x2572,0x110));var _0x2257=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2572[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var logger=require(_0x2257('0x2'))(_0x2257('0x3'));var moment=require(_0x2257('0x4'));var BPromise=require(_0x2257('0x5'));var rp=require(_0x2257('0x6'));var fs=require('fs');var path=require(_0x2257('0x7'));var rimraf=require(_0x2257('0x8'));var config=require('../../config/environment');var attributes=require(_0x2257('0x9'));module[_0x2257('0xa')]=function(_0x43ffe5,_0xa5bd9){return _0x43ffe5[_0x2257('0xb')](_0x2257('0xc'),attributes,{'tableName':_0x2257('0xd'),'paranoid':![],'indexes':[{'name':_0x2257('0xe'),'fields':[_0x2257('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9be2=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x9be2,0x85));var _0x29be=function(_0x587b2b,_0x215ce5){_0x587b2b=_0x587b2b-0x0;var _0x95ae76=_0x9be2[_0x587b2b];return _0x95ae76;};'use strict';var _=require(_0x29be('0x0'));var util=require(_0x29be('0x1'));var logger=require(_0x29be('0x2'))('api');var moment=require(_0x29be('0x3'));var BPromise=require(_0x29be('0x4'));var rp=require(_0x29be('0x5'));var fs=require('fs');var path=require(_0x29be('0x6'));var rimraf=require(_0x29be('0x7'));var config=require(_0x29be('0x8'));var attributes=require(_0x29be('0x9'));module[_0x29be('0xa')]=function(_0x259217,_0x29c580){return _0x259217[_0x29be('0xb')](_0x29be('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x29be('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f94be47..07f0f2c 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 _0x90ca=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x411efb,_0x507d52){var _0x5e3952=function(_0x3ffc78){while(--_0x3ffc78){_0x411efb['push'](_0x411efb['shift']());}};_0x5e3952(++_0x507d52);}(_0x90ca,0xf0));var _0xa90c=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x90ca[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xa90c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa90c('0x1'));var rs=require(_0xa90c('0x2'));var fs=require('fs');var Redis=require(_0xa90c('0x3'));var db=require(_0xa90c('0x4'))['db'];var utils=require(_0xa90c('0x5'));var logger=require('../../config/logger')(_0xa90c('0x6'));var config=require(_0xa90c('0x7'));var jayson=require(_0xa90c('0x8'));var client=jayson[_0xa90c('0x9')][_0xa90c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db424,_0x4bebfc,_0x4d9f2d){return new BPromise(function(_0x4ae3e0,_0xa90f71){return client[_0xa90c('0xb')](_0x4db424,_0x4d9f2d)[_0xa90c('0xc')](function(_0x54bebb){logger[_0xa90c('0xd')](_0xa90c('0xe'),_0x4bebfc,_0xa90c('0xf'));logger[_0xa90c('0x10')](_0xa90c('0x11'),_0x4bebfc,_0xa90c('0xf'),JSON[_0xa90c('0x12')](_0x54bebb));if(_0x54bebb[_0xa90c('0x13')]){if(_0x54bebb[_0xa90c('0x13')][_0xa90c('0x14')]===0x1f4){logger[_0xa90c('0x13')](_0xa90c('0xe'),_0x4bebfc,_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);return _0xa90f71(_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);}logger[_0xa90c('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x4bebfc,_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);return _0x4ae3e0(_0x54bebb[_0xa90c('0x13')][_0xa90c('0x15')]);}else{logger[_0xa90c('0xd')](_0xa90c('0xe'),_0x4bebfc,_0xa90c('0xf'));_0x4ae3e0(_0x54bebb[_0xa90c('0x16')]['message']);}})[_0xa90c('0x17')](function(_0x2e0765){logger['error'](_0xa90c('0xe'),_0x4bebfc,_0x2e0765);_0xa90f71(_0x2e0765);});});} \ No newline at end of file +var _0xdabe=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xdabe,0x9b));var _0xedab=function(_0x4bbe6c,_0x47e67a){_0x4bbe6c=_0x4bbe6c-0x0;var _0x1d519a=_0xdabe[_0x4bbe6c];return _0x1d519a;};'use strict';var _=require(_0xedab('0x0'));var util=require(_0xedab('0x1'));var moment=require(_0xedab('0x2'));var BPromise=require('bluebird');var rs=require(_0xedab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedab('0x4'))['db'];var utils=require(_0xedab('0x5'));var logger=require(_0xedab('0x6'))('rpc');var config=require(_0xedab('0x7'));var jayson=require(_0xedab('0x8'));var client=jayson['client'][_0xedab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a4f5,_0x20ba0a,_0x1d04f2){return new BPromise(function(_0x8aed64,_0x4e8f4a){return client[_0xedab('0xa')](_0x58a4f5,_0x1d04f2)[_0xedab('0xb')](function(_0x276dee){logger[_0xedab('0xc')](_0xedab('0xd'),_0x20ba0a,_0xedab('0xe'));logger[_0xedab('0xf')](_0xedab('0x10'),_0x20ba0a,_0xedab('0xe'),JSON[_0xedab('0x11')](_0x276dee));if(_0x276dee['error']){if(_0x276dee[_0xedab('0x12')][_0xedab('0x13')]===0x1f4){logger[_0xedab('0x12')](_0xedab('0xd'),_0x20ba0a,_0x276dee['error'][_0xedab('0x14')]);return _0x4e8f4a(_0x276dee[_0xedab('0x12')][_0xedab('0x14')]);}logger[_0xedab('0x12')](_0xedab('0xd'),_0x20ba0a,_0x276dee[_0xedab('0x12')][_0xedab('0x14')]);return _0x8aed64(_0x276dee[_0xedab('0x12')]['message']);}else{logger[_0xedab('0xc')](_0xedab('0xd'),_0x20ba0a,'request\x20sent');_0x8aed64(_0x276dee[_0xedab('0x15')]['message']);}})[_0xedab('0x16')](function(_0x3e3613){logger[_0xedab('0x12')](_0xedab('0xd'),_0x20ba0a,_0x3e3613);_0x4e8f4a(_0x3e3613);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 55ec89d..69f8866 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 _0xf14f=['./faxTransferReport.controller','isAuthenticated','index','get','describe','post','put','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17432e,_0x2434bf){var _0x2080fe=function(_0x12b079){while(--_0x12b079){_0x17432e['push'](_0x17432e['shift']());}};_0x2080fe(++_0x2434bf);}(_0xf14f,0x188));var _0xff14=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xf14f[_0x25bca6];return _0x3f8d02;};'use strict';var multer=require(_0xff14('0x0'));var util=require(_0xff14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xff14('0x2'));var router=express['Router']();var fs_extra=require(_0xff14('0x3'));var auth=require(_0xff14('0x4'));var interaction=require(_0xff14('0x5'));var config=require(_0xff14('0x6'));var controller=require(_0xff14('0x7'));router['get']('/',auth[_0xff14('0x8')](),controller[_0xff14('0x9')]);router[_0xff14('0xa')]('/describe',auth[_0xff14('0x8')](),controller[_0xff14('0xb')]);router[_0xff14('0xa')]('/:id',auth[_0xff14('0x8')](),controller['show']);router[_0xff14('0xc')]('/',auth[_0xff14('0x8')](),controller['create']);router[_0xff14('0xd')](_0xff14('0xe'),auth[_0xff14('0x8')](),controller[_0xff14('0xf')]);router[_0xff14('0x10')](_0xff14('0xe'),auth[_0xff14('0x8')](),controller[_0xff14('0x11')]);module[_0xff14('0x12')]=router; \ No newline at end of file +var _0x668d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','create','put','update','/:id','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x668d,0x1a2));var _0xd668=function(_0x33832f,_0x40c45f){_0x33832f=_0x33832f-0x0;var _0x575466=_0x668d[_0x33832f];return _0x575466;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd668('0x0'));var timeout=require(_0xd668('0x1'));var express=require(_0xd668('0x2'));var router=express[_0xd668('0x3')]();var fs_extra=require(_0xd668('0x4'));var auth=require(_0xd668('0x5'));var interaction=require(_0xd668('0x6'));var config=require(_0xd668('0x7'));var controller=require(_0xd668('0x8'));router[_0xd668('0x9')]('/',auth[_0xd668('0xa')](),controller['index']);router[_0xd668('0x9')](_0xd668('0xb'),auth[_0xd668('0xa')](),controller[_0xd668('0xc')]);router[_0xd668('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd668('0xa')](),controller[_0xd668('0xd')]);router[_0xd668('0xe')]('/:id',auth[_0xd668('0xa')](),controller[_0xd668('0xf')]);router['delete'](_0xd668('0x10'),auth['isAuthenticated'](),controller[_0xd668('0x11')]);module[_0xd668('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 8542ac1..154e757 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 _0x9b1e=['/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x507743,_0x2b1454){var _0x416a31=function(_0x4fdf10){while(--_0x4fdf10){_0x507743['push'](_0x507743['shift']());}};_0x416a31(++_0x2b1454);}(_0x9b1e,0xfd));var _0xe9b1=function(_0x51edd3,_0x5b97dc){_0x51edd3=_0x51edd3-0x0;var _0x14684a=_0x9b1e[_0x51edd3];return _0x14684a;};'use strict';var multer=require(_0xe9b1('0x0'));var util=require(_0xe9b1('0x1'));var path=require(_0xe9b1('0x2'));var timeout=require(_0xe9b1('0x3'));var express=require(_0xe9b1('0x4'));var router=express[_0xe9b1('0x5')]();var fs_extra=require(_0xe9b1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe9b1('0x7'));router[_0xe9b1('0x8')]('/',auth[_0xe9b1('0x9')](),controller[_0xe9b1('0xa')]);router[_0xe9b1('0x8')](_0xe9b1('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xe9b1('0xc')]);router['get'](_0xe9b1('0xd'),auth[_0xe9b1('0x9')](),controller[_0xe9b1('0xe')]);router[_0xe9b1('0xf')]('/',auth[_0xe9b1('0x9')](),controller[_0xe9b1('0x10')]);router['post'](_0xe9b1('0x11'),auth[_0xe9b1('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0xe9b1('0x9')](),controller[_0xe9b1('0x12')]);router[_0xe9b1('0x13')](_0xe9b1('0xb'),auth['isAuthenticated'](),controller[_0xe9b1('0x14')]);module[_0xe9b1('0x15')]=router; \ No newline at end of file +var _0xb72d=['addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x13d615,_0x2c5b8b){var _0x3478bd=function(_0x5aa9ea){while(--_0x5aa9ea){_0x13d615['push'](_0x13d615['shift']());}};_0x3478bd(++_0x2c5b8b);}(_0xb72d,0x88));var _0xdb72=function(_0x52997d,_0x597a7d){_0x52997d=_0x52997d-0x0;var _0xe85e00=_0xb72d[_0x52997d];return _0xe85e00;};'use strict';var multer=require(_0xdb72('0x0'));var util=require(_0xdb72('0x1'));var path=require(_0xdb72('0x2'));var timeout=require(_0xdb72('0x3'));var express=require(_0xdb72('0x4'));var router=express[_0xdb72('0x5')]();var fs_extra=require(_0xdb72('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb72('0x7'));var config=require('../../config/environment');var controller=require(_0xdb72('0x8'));router[_0xdb72('0x9')]('/',auth[_0xdb72('0xa')](),controller[_0xdb72('0xb')]);router['get'](_0xdb72('0xc'),auth[_0xdb72('0xa')](),controller['show']);router[_0xdb72('0x9')](_0xdb72('0xd'),auth['isAuthenticated'](),controller[_0xdb72('0xe')]);router[_0xdb72('0x9')](_0xdb72('0xf'),auth['isAuthenticated'](),controller[_0xdb72('0x10')]);router['post']('/',auth[_0xdb72('0xa')](),controller[_0xdb72('0x11')]);router['post'](_0xdb72('0xd'),auth[_0xdb72('0xa')](),controller[_0xdb72('0x12')]);router[_0xdb72('0x13')](_0xdb72('0xc'),auth[_0xdb72('0xa')](),controller[_0xdb72('0x14')]);router['delete'](_0xdb72('0xc'),auth[_0xdb72('0xa')](),controller[_0xdb72('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 4c8ee24..e15a69a 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 _0x74ea=['integrationTab','newTab','exports','STRING','basic','ENUM'];(function(_0x2bc54c,_0x4e8bb4){var _0x445db8=function(_0x34ab28){while(--_0x34ab28){_0x2bc54c['push'](_0x2bc54c['shift']());}};_0x445db8(++_0x4e8bb4);}(_0x74ea,0x1e8));var _0xa74e=function(_0x51dc1d,_0x5760c9){_0x51dc1d=_0x51dc1d-0x0;var _0x5de4b2=_0x74ea[_0x51dc1d];return _0x5de4b2;};'use strict';var Sequelize=require('sequelize');module[_0xa74e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa74e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xa74e('0x2')),'defaultValue':_0xa74e('0x2')},'password':{'type':Sequelize[_0xa74e('0x1')]},'consumerKey':{'type':Sequelize[_0xa74e('0x1')]},'consumerSecret':{'type':Sequelize[_0xa74e('0x1')]},'token':{'type':Sequelize[_0xa74e('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa74e('0x3')](_0xa74e('0x4'),_0xa74e('0x5')),'defaultValue':_0xa74e('0x4')}}; \ No newline at end of file +var _0xd7d4=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x556f4b,_0xd016bd){var _0x40f061=function(_0x281aca){while(--_0x281aca){_0x556f4b['push'](_0x556f4b['shift']());}};_0x40f061(++_0xd016bd);}(_0xd7d4,0x130));var _0x4d7d=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xd7d4[_0x56b138];return _0x3df878;};'use strict';var Sequelize=require(_0x4d7d('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d7d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d7d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x4d7d('0x2')](_0x4d7d('0x3')),'defaultValue':_0x4d7d('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x4d7d('0x1')]},'consumerSecret':{'type':Sequelize[_0x4d7d('0x1')]},'token':{'type':Sequelize[_0x4d7d('0x1')]},'tokenSecret':{'type':Sequelize[_0x4d7d('0x1')]},'serverUrl':{'type':Sequelize[_0x4d7d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4d7d('0x2')](_0x4d7d('0x4'),_0x4d7d('0x5')),'defaultValue':_0x4d7d('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 84ab886..e05140e 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 _0xf8c2=['show','params','rawAttributes','options','find','create','body','update','destroy','getConfigurations','DeskConfiguration','sort','findOne','AccountId','Subjects','getSubjects','getDescriptions','type','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','then','error','stack','name','send','index','map','DeskAccount','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch'];(function(_0x164fb4,_0xd8353d){var _0x1057fc=function(_0x4fedf4){while(--_0x4fedf4){_0x164fb4['push'](_0x164fb4['shift']());}};_0x1057fc(++_0xd8353d);}(_0xf8c2,0x188));var _0x2f8c=function(_0x4aa9f2,_0x3bec12){_0x4aa9f2=_0x4aa9f2-0x0;var _0x2375ef=_0xf8c2[_0x4aa9f2];return _0x2375ef;};'use strict';var emlformat=require(_0x2f8c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f8c('0x1'));var rp=require(_0x2f8c('0x2'));var moment=require('moment');var BPromise=require(_0x2f8c('0x3'));var Mustache=require('mustache');var util=require(_0x2f8c('0x4'));var path=require(_0x2f8c('0x5'));var sox=require(_0x2f8c('0x6'));var csv=require(_0x2f8c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f8c('0x8'));var _=require(_0x2f8c('0x9'));var squel=require(_0x2f8c('0xa'));var crypto=require(_0x2f8c('0xb'));var jsforce=require(_0x2f8c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f8c('0xd'));var Redis=require(_0x2f8c('0xe'));var authService=require(_0x2f8c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2f8c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f8c('0x11'))(_0x2f8c('0x12'));var utils=require(_0x2f8c('0x13'));var config=require(_0x2f8c('0x14'));var licenseUtil=require(_0x2f8c('0x15'));var db=require(_0x2f8c('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f5496,_0x466245){_0x466245=_0x466245||0xcc;return function(_0x34946f){if(_0x34946f){return _0x4f5496[_0x2f8c('0x17')](_0x466245);}return _0x4f5496['status'](_0x466245)[_0x2f8c('0x18')]();};}function respondWithResult(_0x327e25,_0x2ed1b7){_0x2ed1b7=_0x2ed1b7||0xc8;return function(_0x46ff5c){if(_0x46ff5c){return _0x327e25[_0x2f8c('0x19')](_0x2ed1b7)['json'](_0x46ff5c);}};}function respondWithFilteredResult(_0x47bccc,_0x525c0d){return function(_0x363252){if(_0x363252){var _0x664470=typeof _0x525c0d[_0x2f8c('0x1a')]===_0x2f8c('0x1b')&&typeof _0x525c0d['limit']===_0x2f8c('0x1b');var _0x51e76f=_0x363252['count'];var _0x5aa147=_0x664470?0x0:_0x525c0d[_0x2f8c('0x1a')];var _0x40a0ba=_0x664470?_0x363252[_0x2f8c('0x1c')]:_0x525c0d[_0x2f8c('0x1a')]+_0x525c0d[_0x2f8c('0x1d')];var _0x172190;if(_0x40a0ba>=_0x51e76f){_0x40a0ba=_0x51e76f;_0x172190=0xc8;}else{_0x172190=0xce;}_0x47bccc[_0x2f8c('0x19')](_0x172190);return _0x47bccc[_0x2f8c('0x1e')]('Content-Range',_0x5aa147+'-'+_0x40a0ba+'/'+_0x51e76f)[_0x2f8c('0x1f')](_0x363252);}return null;};}function patchUpdates(_0xae27c7){return function(_0x47722b){try{jsonpatch[_0x2f8c('0x20')](_0x47722b,_0xae27c7,!![]);}catch(_0x5af2d6){return BPromise[_0x2f8c('0x21')](_0x5af2d6);}return _0x47722b[_0x2f8c('0x22')]();};}function saveUpdates(_0x2e9eea,_0x4e36fe){return function(_0x31ef1e){if(_0x31ef1e){return _0x31ef1e['update'](_0x2e9eea)[_0x2f8c('0x23')](function(_0x166ecd){return _0x166ecd;});}return null;};}function removeEntity(_0x5aafde,_0x48fba7){return function(_0x4a592b){if(_0x4a592b){return _0x4a592b['destroy']()['then'](function(){_0x5aafde[_0x2f8c('0x19')](0xcc)[_0x2f8c('0x18')]();});}};}function handleEntityNotFound(_0x4cb763,_0x30810e){return function(_0x2904c3){if(!_0x2904c3){_0x4cb763[_0x2f8c('0x17')](0x194);}return _0x2904c3;};}function handleError(_0x2cc3b8,_0x134a56){_0x134a56=_0x134a56||0x1f4;return function(_0xf07aa3){logger[_0x2f8c('0x24')](_0xf07aa3[_0x2f8c('0x25')]);if(_0xf07aa3[_0x2f8c('0x26')]){delete _0xf07aa3[_0x2f8c('0x26')];}_0x2cc3b8[_0x2f8c('0x19')](_0x134a56)[_0x2f8c('0x27')](_0xf07aa3);};}exports[_0x2f8c('0x28')]=function(_0x26fc69,_0x7ec36b){var _0x10bd27={},_0x3b886c={},_0x401c46={'count':0x0,'rows':[]};var _0x44aa77=_[_0x2f8c('0x29')](db[_0x2f8c('0x2a')]['rawAttributes'],function(_0x1e98a0){return{'name':_0x1e98a0['fieldName'],'type':_0x1e98a0['type'][_0x2f8c('0x2b')]};});_0x3b886c['model']=_['map'](_0x44aa77,_0x2f8c('0x26'));_0x3b886c['query']=_[_0x2f8c('0x2c')](_0x26fc69[_0x2f8c('0x2d')]);_0x3b886c[_0x2f8c('0x2e')]=_[_0x2f8c('0x2f')](_0x3b886c[_0x2f8c('0x30')],_0x3b886c[_0x2f8c('0x2d')]);_0x10bd27[_0x2f8c('0x31')]=_[_0x2f8c('0x2f')](_0x3b886c[_0x2f8c('0x30')],qs[_0x2f8c('0x32')](_0x26fc69[_0x2f8c('0x2d')]['fields']));_0x10bd27[_0x2f8c('0x31')]=_0x10bd27[_0x2f8c('0x31')][_0x2f8c('0x33')]?_0x10bd27[_0x2f8c('0x31')]:_0x3b886c[_0x2f8c('0x30')];if(!_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x34')](_0x2f8c('0x35'))){_0x10bd27[_0x2f8c('0x1d')]=qs['limit'](_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x1d')]);_0x10bd27[_0x2f8c('0x1a')]=qs['offset'](_0x26fc69['query']['offset']);}_0x10bd27[_0x2f8c('0x36')]=qs['sort'](_0x26fc69['query']['sort']);_0x10bd27[_0x2f8c('0x37')]=qs[_0x2f8c('0x2e')](_[_0x2f8c('0x38')](_0x26fc69['query'],_0x3b886c[_0x2f8c('0x2e')]),_0x44aa77);if(_0x26fc69['query']['filter']){_0x10bd27[_0x2f8c('0x37')]=_[_0x2f8c('0x39')](_0x10bd27[_0x2f8c('0x37')],{'$or':_['map'](_0x44aa77,function(_0x24d6a8){if(_0x24d6a8['type']!==_0x2f8c('0x3a')){var _0x2ab671={};_0x2ab671[_0x24d6a8[_0x2f8c('0x26')]]={'$like':'%'+_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x3b')]+'%'};return _0x2ab671;}})});}_0x10bd27=_[_0x2f8c('0x39')]({},_0x10bd27,_0x26fc69['options']);var _0x214488={'where':_0x10bd27[_0x2f8c('0x37')]};return db['DeskAccount'][_0x2f8c('0x1c')](_0x214488)[_0x2f8c('0x23')](function(_0x41cce2){_0x401c46[_0x2f8c('0x1c')]=_0x41cce2;if(_0x26fc69[_0x2f8c('0x2d')][_0x2f8c('0x3c')]){_0x10bd27[_0x2f8c('0x3d')]=[{'all':!![]}];}return db[_0x2f8c('0x2a')]['findAll'](_0x10bd27);})['then'](function(_0x2bbdb0){_0x401c46[_0x2f8c('0x3e')]=_0x2bbdb0;return _0x401c46;})[_0x2f8c('0x23')](respondWithFilteredResult(_0x7ec36b,_0x10bd27))[_0x2f8c('0x3f')](handleError(_0x7ec36b,null));};exports[_0x2f8c('0x40')]=function(_0x1734bb,_0x981faa){var _0x58aa6d={'raw':![],'where':{'id':_0x1734bb[_0x2f8c('0x41')]['id']}},_0x1a7aff={};_0x1a7aff[_0x2f8c('0x30')]=_[_0x2f8c('0x2c')](db[_0x2f8c('0x2a')][_0x2f8c('0x42')]);_0x1a7aff[_0x2f8c('0x2d')]=_['keys'](_0x1734bb[_0x2f8c('0x2d')]);_0x1a7aff[_0x2f8c('0x2e')]=_[_0x2f8c('0x2f')](_0x1a7aff[_0x2f8c('0x30')],_0x1a7aff[_0x2f8c('0x2d')]);_0x58aa6d[_0x2f8c('0x31')]=_[_0x2f8c('0x2f')](_0x1a7aff[_0x2f8c('0x30')],qs[_0x2f8c('0x32')](_0x1734bb[_0x2f8c('0x2d')][_0x2f8c('0x32')]));_0x58aa6d[_0x2f8c('0x31')]=_0x58aa6d['attributes'][_0x2f8c('0x33')]?_0x58aa6d[_0x2f8c('0x31')]:_0x1a7aff[_0x2f8c('0x30')];if(_0x1734bb[_0x2f8c('0x2d')][_0x2f8c('0x3c')]){_0x58aa6d[_0x2f8c('0x3d')]=[{'all':!![]}];}_0x58aa6d=_[_0x2f8c('0x39')]({},_0x58aa6d,_0x1734bb[_0x2f8c('0x43')]);return db[_0x2f8c('0x2a')][_0x2f8c('0x44')](_0x58aa6d)[_0x2f8c('0x23')](handleEntityNotFound(_0x981faa,null))[_0x2f8c('0x23')](respondWithResult(_0x981faa,null))[_0x2f8c('0x3f')](handleError(_0x981faa,null));};exports[_0x2f8c('0x45')]=function(_0x499c8c,_0xd5c1b4){return db[_0x2f8c('0x2a')][_0x2f8c('0x45')](_0x499c8c[_0x2f8c('0x46')],{})[_0x2f8c('0x23')](respondWithResult(_0xd5c1b4,0xc9))['catch'](handleError(_0xd5c1b4,null));};exports[_0x2f8c('0x47')]=function(_0x56f8c9,_0x4390bd){if(_0x56f8c9['body']['id']){delete _0x56f8c9['body']['id'];}return db[_0x2f8c('0x2a')][_0x2f8c('0x44')]({'where':{'id':_0x56f8c9['params']['id']}})['then'](handleEntityNotFound(_0x4390bd,null))[_0x2f8c('0x23')](saveUpdates(_0x56f8c9[_0x2f8c('0x46')],null))[_0x2f8c('0x23')](respondWithResult(_0x4390bd,null))[_0x2f8c('0x3f')](handleError(_0x4390bd,null));};exports[_0x2f8c('0x48')]=function(_0x3acee8,_0x102f2f){return db[_0x2f8c('0x2a')][_0x2f8c('0x44')]({'where':{'id':_0x3acee8['params']['id']}})['then'](handleEntityNotFound(_0x102f2f,null))[_0x2f8c('0x23')](removeEntity(_0x102f2f,null))[_0x2f8c('0x3f')](handleError(_0x102f2f,null));};exports[_0x2f8c('0x49')]=function(_0x68582a,_0x401277,_0x43e54f){var _0x3ab690={};var _0x7aa5a3={};var _0x36fab9;var _0x493af6;return db[_0x2f8c('0x2a')]['findOne']({'where':{'id':_0x68582a[_0x2f8c('0x41')]['id']}})[_0x2f8c('0x23')](handleEntityNotFound(_0x401277,null))[_0x2f8c('0x23')](function(_0x4a405a){if(_0x4a405a){_0x36fab9=_0x4a405a;_0x7aa5a3['model']=_[_0x2f8c('0x2c')](db[_0x2f8c('0x4a')][_0x2f8c('0x42')]);_0x7aa5a3[_0x2f8c('0x2d')]=_['keys'](_0x68582a[_0x2f8c('0x2d')]);_0x7aa5a3[_0x2f8c('0x2e')]=_[_0x2f8c('0x2f')](_0x7aa5a3[_0x2f8c('0x30')],_0x7aa5a3[_0x2f8c('0x2d')]);_0x3ab690[_0x2f8c('0x31')]=_[_0x2f8c('0x2f')](_0x7aa5a3['model'],qs[_0x2f8c('0x32')](_0x68582a[_0x2f8c('0x2d')][_0x2f8c('0x32')]));_0x3ab690[_0x2f8c('0x31')]=_0x3ab690['attributes']['length']?_0x3ab690[_0x2f8c('0x31')]:_0x7aa5a3['model'];_0x3ab690[_0x2f8c('0x36')]=qs[_0x2f8c('0x4b')](_0x68582a[_0x2f8c('0x2d')]['sort']);_0x3ab690[_0x2f8c('0x37')]=qs[_0x2f8c('0x2e')](_[_0x2f8c('0x38')](_0x68582a[_0x2f8c('0x2d')],_0x7aa5a3[_0x2f8c('0x2e')]));if(_0x68582a['query']['filter']){_0x3ab690[_0x2f8c('0x37')]=_[_0x2f8c('0x39')](_0x3ab690[_0x2f8c('0x37')],{'$or':_[_0x2f8c('0x29')](_0x3ab690[_0x2f8c('0x31')],function(_0x2fe86b){var _0x5f5ec4={};_0x5f5ec4[_0x2fe86b]={'$like':'%'+_0x68582a['query'][_0x2f8c('0x3b')]+'%'};return _0x5f5ec4;})});}_0x3ab690=_[_0x2f8c('0x39')]({},_0x3ab690,_0x68582a[_0x2f8c('0x43')]);return _0x36fab9[_0x2f8c('0x49')](_0x3ab690);}})[_0x2f8c('0x23')](function(_0x149227){if(_0x149227){_0x493af6=_0x149227[_0x2f8c('0x33')];if(!_0x68582a['query'][_0x2f8c('0x34')](_0x2f8c('0x35'))){_0x3ab690[_0x2f8c('0x1d')]=qs[_0x2f8c('0x1d')](_0x68582a[_0x2f8c('0x2d')][_0x2f8c('0x1d')]);_0x3ab690[_0x2f8c('0x1a')]=qs[_0x2f8c('0x1a')](_0x68582a[_0x2f8c('0x2d')][_0x2f8c('0x1a')]);}return _0x36fab9[_0x2f8c('0x49')](_0x3ab690);}})['then'](function(_0x3591b5){if(_0x3591b5){return _0x3591b5?{'count':_0x493af6,'rows':_0x3591b5}:null;}})[_0x2f8c('0x23')](respondWithResult(_0x401277,null))[_0x2f8c('0x3f')](handleError(_0x401277,null));};exports['addConfiguration']=function(_0x5e691f,_0x44ad26,_0x3994d9){if(_0x5e691f[_0x2f8c('0x46')]['id']){delete _0x5e691f[_0x2f8c('0x46')]['id'];}return db[_0x2f8c('0x2a')][_0x2f8c('0x4c')]({'where':{'id':_0x5e691f[_0x2f8c('0x41')]['id']}})[_0x2f8c('0x23')](handleEntityNotFound(_0x44ad26,null))[_0x2f8c('0x23')](function(_0x47700f){if(_0x47700f){_0x5e691f['body'][_0x2f8c('0x4d')]=_0x47700f['id'];_0x5e691f['body'][_0x2f8c('0x4e')]=integrations[_0x2f8c('0x4f')](_0x5e691f[_0x2f8c('0x46')]['channel'],_0x5e691f[_0x2f8c('0x46')]['type']);_0x5e691f[_0x2f8c('0x46')]['Descriptions']=integrations[_0x2f8c('0x50')](_0x5e691f['body']['channel'],_0x5e691f[_0x2f8c('0x46')][_0x2f8c('0x51')]);return db['DeskConfiguration']['create'](_0x5e691f['body'],{'include':[{'model':db[_0x2f8c('0x52')],'as':_0x2f8c('0x4e')},{'model':db[_0x2f8c('0x52')],'as':_0x2f8c('0x53')}]});}return null;})[_0x2f8c('0x23')](respondWithResult(_0x44ad26,null))[_0x2f8c('0x3f')](handleError(_0x44ad26,null));};exports['getFields']=function(_0x306a7d,_0x5c64dc,_0x346cc2){var _0x4d3d03=[{'name':_0x2f8c('0x54'),'label':_0x2f8c('0x54'),'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 _0x220177='';return db[_0x2f8c('0x2a')][_0x2f8c('0x4c')]({'where':{'id':_0x306a7d[_0x2f8c('0x41')]['id']},'attributes':['id',_0x2f8c('0x55'),_0x2f8c('0x56'),_0x2f8c('0x57'),_0x2f8c('0x58'),_0x2f8c('0x59'),_0x2f8c('0x5a'),_0x2f8c('0x5b'),_0x2f8c('0x5c')]})[_0x2f8c('0x23')](handleEntityNotFound(_0x5c64dc,null))[_0x2f8c('0x23')](function(_0x374bac){if(_0x374bac){_0x220177=_0x374bac[_0x2f8c('0x55')];var _0x555e72=_0x220177[_0x2f8c('0x5d')](-0x1);if(_0x555e72==='/'){_0x220177=_0x220177['substring'](0x0,_0x220177[_0x2f8c('0x5e')](_0x555e72));}var _0x163722={'method':_0x2f8c('0x5f'),'uri':util[_0x2f8c('0x60')]('%s/custom_fields',_0x220177),'headers':{'Content-Type':_0x2f8c('0x61'),'Accept':'application/json'},'json':!![]};if(_0x374bac[_0x2f8c('0x56')]===_0x2f8c('0x62')){_0x163722['headers'][_0x2f8c('0x63')]=util['format'](_0x2f8c('0x64'),new Buffer(util[_0x2f8c('0x60')](_0x2f8c('0x65'),_0x374bac[_0x2f8c('0x57')],_0x374bac[_0x2f8c('0x58')]))[_0x2f8c('0x66')](_0x2f8c('0x67')));}return rp(_0x163722)[_0x2f8c('0x23')](function(_0x4098ba){return _0x4d3d03[_0x2f8c('0x68')](_['map'](_0x4098ba[_0x2f8c('0x69')][_0x2f8c('0x6a')],function(_0x7db6e2){return{'id':_0x7db6e2['name'],'name':_0x7db6e2[_0x2f8c('0x26')],'type':_0x7db6e2[_0x2f8c('0x51')],'active':_0x7db6e2['active'],'label':_0x7db6e2[_0x2f8c('0x6b')],'custom':!![]};}));});}})[_0x2f8c('0x23')](function(_0x453cea){return{'count':_0x453cea['length'],'rows':_0x453cea};})[_0x2f8c('0x23')](respondWithResult(_0x5c64dc,null))[_0x2f8c('0x3f')](function(_0xf0d899){var _0x4d8285=_0x306a7d[_0x2f8c('0x2d')][_0x2f8c('0x6c')]?0x1f4:_0xf0d899[_0x2f8c('0x6d')]||0x1f4;logger[_0x2f8c('0x24')](_0x2f8c('0x6e'),_0x2f8c('0x6f'),_0x4d8285,JSON[_0x2f8c('0x70')](_0xf0d899));delete _0xf0d899[_0x2f8c('0x26')];if(_0x4d8285===0x191){_0x4d8285=0x190;}_0x5c64dc[_0x2f8c('0x19')](_0x4d8285)['send'](_0x306a7d['query'][_0x2f8c('0x6c')]?{'message':_0x2f8c('0x71'),'statusCode':_0xf0d899[_0x2f8c('0x6d')]}:_0xf0d899);});}; \ No newline at end of file +var _0x51ae=['findOne','DeskConfiguration','filter','nolimit','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','username','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','name','send','index','map','DeskAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy'];(function(_0x5b6375,_0x4d6280){var _0x17858d=function(_0x4bc1ae){while(--_0x4bc1ae){_0x5b6375['push'](_0x5b6375['shift']());}};_0x17858d(++_0x4d6280);}(_0x51ae,0x182));var _0xe51a=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x51ae[_0x2f3848];return _0x102668;};'use strict';var emlformat=require(_0xe51a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe51a('0x1'));var jsonpatch=require(_0xe51a('0x2'));var rp=require('request-promise');var moment=require(_0xe51a('0x3'));var BPromise=require(_0xe51a('0x4'));var Mustache=require(_0xe51a('0x5'));var util=require(_0xe51a('0x6'));var path=require(_0xe51a('0x7'));var sox=require(_0xe51a('0x8'));var csv=require(_0xe51a('0x9'));var ejs=require(_0xe51a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe51a('0xb'));var crypto=require('crypto');var jsforce=require(_0xe51a('0xc'));var deskjs=require(_0xe51a('0xd'));var toCsv=require(_0xe51a('0x9'));var querystring=require(_0xe51a('0xe'));var Papa=require(_0xe51a('0xf'));var Redis=require(_0xe51a('0x10'));var authService=require(_0xe51a('0x11'));var qs=require(_0xe51a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe51a('0x13'));var logger=require(_0xe51a('0x14'))(_0xe51a('0x15'));var utils=require(_0xe51a('0x16'));var config=require(_0xe51a('0x17'));var licenseUtil=require(_0xe51a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe51a('0x19'));function respondWithStatusCode(_0x2b92bb,_0x115e8e){_0x115e8e=_0x115e8e||0xcc;return function(_0x3edbf1){if(_0x3edbf1){return _0x2b92bb[_0xe51a('0x1a')](_0x115e8e);}return _0x2b92bb[_0xe51a('0x1b')](_0x115e8e)[_0xe51a('0x1c')]();};}function respondWithResult(_0x582010,_0x221791){_0x221791=_0x221791||0xc8;return function(_0x24b657){if(_0x24b657){return _0x582010[_0xe51a('0x1b')](_0x221791)[_0xe51a('0x1d')](_0x24b657);}};}function respondWithFilteredResult(_0x46717c,_0x4155a4){return function(_0x22f99b){if(_0x22f99b){var _0x592226=typeof _0x4155a4[_0xe51a('0x1e')]===_0xe51a('0x1f')&&typeof _0x4155a4['limit']===_0xe51a('0x1f');var _0xe8b46b=_0x22f99b[_0xe51a('0x20')];var _0x1c33a8=_0x592226?0x0:_0x4155a4[_0xe51a('0x1e')];var _0x3046b3=_0x592226?_0x22f99b['count']:_0x4155a4[_0xe51a('0x1e')]+_0x4155a4[_0xe51a('0x21')];var _0x455f02;if(_0x3046b3>=_0xe8b46b){_0x3046b3=_0xe8b46b;_0x455f02=0xc8;}else{_0x455f02=0xce;}_0x46717c['status'](_0x455f02);return _0x46717c[_0xe51a('0x22')](_0xe51a('0x23'),_0x1c33a8+'-'+_0x3046b3+'/'+_0xe8b46b)[_0xe51a('0x1d')](_0x22f99b);}return null;};}function patchUpdates(_0x5cd81f){return function(_0x5cce32){try{jsonpatch[_0xe51a('0x24')](_0x5cce32,_0x5cd81f,!![]);}catch(_0x1be6b1){return BPromise[_0xe51a('0x25')](_0x1be6b1);}return _0x5cce32['save']();};}function saveUpdates(_0x3adb7d,_0x521190){return function(_0x290ef9){if(_0x290ef9){return _0x290ef9[_0xe51a('0x26')](_0x3adb7d)['then'](function(_0x2e79a3){return _0x2e79a3;});}return null;};}function removeEntity(_0x429d69,_0x388ccf){return function(_0x40d163){if(_0x40d163){return _0x40d163['destroy']()[_0xe51a('0x27')](function(){_0x429d69[_0xe51a('0x1b')](0xcc)[_0xe51a('0x1c')]();});}};}function handleEntityNotFound(_0x2cb02f,_0x5371ee){return function(_0x6bf68e){if(!_0x6bf68e){_0x2cb02f['sendStatus'](0x194);}return _0x6bf68e;};}function handleError(_0x4717c5,_0x21efda){_0x21efda=_0x21efda||0x1f4;return function(_0x12d8f1){logger[_0xe51a('0x28')](_0x12d8f1['stack']);if(_0x12d8f1[_0xe51a('0x29')]){delete _0x12d8f1[_0xe51a('0x29')];}_0x4717c5['status'](_0x21efda)[_0xe51a('0x2a')](_0x12d8f1);};}exports[_0xe51a('0x2b')]=function(_0x375d5d,_0x4d6b4c){var _0x230856={},_0x176f2a={},_0x68547={'count':0x0,'rows':[]};var _0x2a8989=_[_0xe51a('0x2c')](db[_0xe51a('0x2d')][_0xe51a('0x2e')],function(_0x2494ce){return{'name':_0x2494ce['fieldName'],'type':_0x2494ce[_0xe51a('0x2f')]['key']};});_0x176f2a[_0xe51a('0x30')]=_['map'](_0x2a8989,_0xe51a('0x29'));_0x176f2a[_0xe51a('0x31')]=_['keys'](_0x375d5d['query']);_0x176f2a[_0xe51a('0x32')]=_[_0xe51a('0x33')](_0x176f2a[_0xe51a('0x30')],_0x176f2a[_0xe51a('0x31')]);_0x230856['attributes']=_[_0xe51a('0x33')](_0x176f2a['model'],qs[_0xe51a('0x34')](_0x375d5d[_0xe51a('0x31')][_0xe51a('0x34')]));_0x230856[_0xe51a('0x35')]=_0x230856[_0xe51a('0x35')][_0xe51a('0x36')]?_0x230856[_0xe51a('0x35')]:_0x176f2a[_0xe51a('0x30')];if(!_0x375d5d[_0xe51a('0x31')]['hasOwnProperty']('nolimit')){_0x230856[_0xe51a('0x21')]=qs[_0xe51a('0x21')](_0x375d5d[_0xe51a('0x31')][_0xe51a('0x21')]);_0x230856[_0xe51a('0x1e')]=qs[_0xe51a('0x1e')](_0x375d5d[_0xe51a('0x31')][_0xe51a('0x1e')]);}_0x230856[_0xe51a('0x37')]=qs[_0xe51a('0x38')](_0x375d5d['query'][_0xe51a('0x38')]);_0x230856[_0xe51a('0x39')]=qs[_0xe51a('0x32')](_[_0xe51a('0x3a')](_0x375d5d[_0xe51a('0x31')],_0x176f2a[_0xe51a('0x32')]),_0x2a8989);if(_0x375d5d[_0xe51a('0x31')]['filter']){_0x230856[_0xe51a('0x39')]=_[_0xe51a('0x3b')](_0x230856['where'],{'$or':_[_0xe51a('0x2c')](_0x2a8989,function(_0xadcaf1){if(_0xadcaf1[_0xe51a('0x2f')]!==_0xe51a('0x3c')){var _0x3711a9={};_0x3711a9[_0xadcaf1[_0xe51a('0x29')]]={'$like':'%'+_0x375d5d[_0xe51a('0x31')]['filter']+'%'};return _0x3711a9;}})});}_0x230856=_['merge']({},_0x230856,_0x375d5d[_0xe51a('0x3d')]);var _0x335954={'where':_0x230856[_0xe51a('0x39')]};return db[_0xe51a('0x2d')][_0xe51a('0x20')](_0x335954)[_0xe51a('0x27')](function(_0x44a08a){_0x68547['count']=_0x44a08a;if(_0x375d5d[_0xe51a('0x31')][_0xe51a('0x3e')]){_0x230856[_0xe51a('0x3f')]=[{'all':!![]}];}return db[_0xe51a('0x2d')][_0xe51a('0x40')](_0x230856);})[_0xe51a('0x27')](function(_0x8e2bef){_0x68547[_0xe51a('0x41')]=_0x8e2bef;return _0x68547;})[_0xe51a('0x27')](respondWithFilteredResult(_0x4d6b4c,_0x230856))[_0xe51a('0x42')](handleError(_0x4d6b4c,null));};exports[_0xe51a('0x43')]=function(_0x2a4f6f,_0xaa8e1a){var _0x2400d5={'raw':![],'where':{'id':_0x2a4f6f[_0xe51a('0x44')]['id']}},_0x50af58={};_0x50af58[_0xe51a('0x30')]=_[_0xe51a('0x45')](db[_0xe51a('0x2d')][_0xe51a('0x2e')]);_0x50af58['query']=_[_0xe51a('0x45')](_0x2a4f6f[_0xe51a('0x31')]);_0x50af58[_0xe51a('0x32')]=_[_0xe51a('0x33')](_0x50af58['model'],_0x50af58[_0xe51a('0x31')]);_0x2400d5[_0xe51a('0x35')]=_[_0xe51a('0x33')](_0x50af58['model'],qs[_0xe51a('0x34')](_0x2a4f6f[_0xe51a('0x31')]['fields']));_0x2400d5['attributes']=_0x2400d5['attributes'][_0xe51a('0x36')]?_0x2400d5['attributes']:_0x50af58[_0xe51a('0x30')];if(_0x2a4f6f[_0xe51a('0x31')][_0xe51a('0x3e')]){_0x2400d5[_0xe51a('0x3f')]=[{'all':!![]}];}_0x2400d5=_[_0xe51a('0x3b')]({},_0x2400d5,_0x2a4f6f[_0xe51a('0x3d')]);return db[_0xe51a('0x2d')][_0xe51a('0x46')](_0x2400d5)[_0xe51a('0x27')](handleEntityNotFound(_0xaa8e1a,null))['then'](respondWithResult(_0xaa8e1a,null))[_0xe51a('0x42')](handleError(_0xaa8e1a,null));};exports[_0xe51a('0x47')]=function(_0x4c8375,_0x2b2e20){return db[_0xe51a('0x2d')][_0xe51a('0x47')](_0x4c8375['body'],{})[_0xe51a('0x27')](respondWithResult(_0x2b2e20,0xc9))['catch'](handleError(_0x2b2e20,null));};exports[_0xe51a('0x26')]=function(_0x3bf91a,_0x57dfbe){if(_0x3bf91a['body']['id']){delete _0x3bf91a[_0xe51a('0x48')]['id'];}return db[_0xe51a('0x2d')][_0xe51a('0x46')]({'where':{'id':_0x3bf91a[_0xe51a('0x44')]['id']}})[_0xe51a('0x27')](handleEntityNotFound(_0x57dfbe,null))[_0xe51a('0x27')](saveUpdates(_0x3bf91a[_0xe51a('0x48')],null))[_0xe51a('0x27')](respondWithResult(_0x57dfbe,null))[_0xe51a('0x42')](handleError(_0x57dfbe,null));};exports[_0xe51a('0x49')]=function(_0x330d15,_0x36a991){return db[_0xe51a('0x2d')][_0xe51a('0x46')]({'where':{'id':_0x330d15['params']['id']}})['then'](handleEntityNotFound(_0x36a991,null))[_0xe51a('0x27')](removeEntity(_0x36a991,null))['catch'](handleError(_0x36a991,null));};exports['getConfigurations']=function(_0x49b740,_0x5254e2,_0x189cc9){var _0x1e0128={};var _0x56bc70={};var _0x10241;var _0x5cdf33;return db[_0xe51a('0x2d')][_0xe51a('0x4a')]({'where':{'id':_0x49b740['params']['id']}})[_0xe51a('0x27')](handleEntityNotFound(_0x5254e2,null))[_0xe51a('0x27')](function(_0x294646){if(_0x294646){_0x10241=_0x294646;_0x56bc70['model']=_[_0xe51a('0x45')](db[_0xe51a('0x4b')]['rawAttributes']);_0x56bc70[_0xe51a('0x31')]=_['keys'](_0x49b740[_0xe51a('0x31')]);_0x56bc70[_0xe51a('0x32')]=_[_0xe51a('0x33')](_0x56bc70[_0xe51a('0x30')],_0x56bc70[_0xe51a('0x31')]);_0x1e0128['attributes']=_[_0xe51a('0x33')](_0x56bc70[_0xe51a('0x30')],qs['fields'](_0x49b740[_0xe51a('0x31')]['fields']));_0x1e0128[_0xe51a('0x35')]=_0x1e0128['attributes']['length']?_0x1e0128['attributes']:_0x56bc70[_0xe51a('0x30')];_0x1e0128['order']=qs['sort'](_0x49b740['query'][_0xe51a('0x38')]);_0x1e0128[_0xe51a('0x39')]=qs[_0xe51a('0x32')](_[_0xe51a('0x3a')](_0x49b740[_0xe51a('0x31')],_0x56bc70[_0xe51a('0x32')]));if(_0x49b740[_0xe51a('0x31')][_0xe51a('0x4c')]){_0x1e0128[_0xe51a('0x39')]=_['merge'](_0x1e0128['where'],{'$or':_[_0xe51a('0x2c')](_0x1e0128[_0xe51a('0x35')],function(_0xda9695){var _0xdf682a={};_0xdf682a[_0xda9695]={'$like':'%'+_0x49b740[_0xe51a('0x31')][_0xe51a('0x4c')]+'%'};return _0xdf682a;})});}_0x1e0128=_[_0xe51a('0x3b')]({},_0x1e0128,_0x49b740[_0xe51a('0x3d')]);return _0x10241['getConfigurations'](_0x1e0128);}})[_0xe51a('0x27')](function(_0x3eacd4){if(_0x3eacd4){_0x5cdf33=_0x3eacd4[_0xe51a('0x36')];if(!_0x49b740[_0xe51a('0x31')]['hasOwnProperty'](_0xe51a('0x4d'))){_0x1e0128['limit']=qs[_0xe51a('0x21')](_0x49b740[_0xe51a('0x31')][_0xe51a('0x21')]);_0x1e0128['offset']=qs['offset'](_0x49b740[_0xe51a('0x31')]['offset']);}return _0x10241[_0xe51a('0x4e')](_0x1e0128);}})[_0xe51a('0x27')](function(_0x566b2a){if(_0x566b2a){return _0x566b2a?{'count':_0x5cdf33,'rows':_0x566b2a}:null;}})[_0xe51a('0x27')](respondWithResult(_0x5254e2,null))[_0xe51a('0x42')](handleError(_0x5254e2,null));};exports[_0xe51a('0x4f')]=function(_0x3ec301,_0x56cf08,_0x2f74bf){if(_0x3ec301[_0xe51a('0x48')]['id']){delete _0x3ec301[_0xe51a('0x48')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x3ec301[_0xe51a('0x44')]['id']}})[_0xe51a('0x27')](handleEntityNotFound(_0x56cf08,null))[_0xe51a('0x27')](function(_0x5b4ee5){if(_0x5b4ee5){_0x3ec301[_0xe51a('0x48')]['AccountId']=_0x5b4ee5['id'];_0x3ec301[_0xe51a('0x48')]['Subjects']=integrations[_0xe51a('0x50')](_0x3ec301[_0xe51a('0x48')][_0xe51a('0x51')],_0x3ec301[_0xe51a('0x48')][_0xe51a('0x2f')]);_0x3ec301[_0xe51a('0x48')][_0xe51a('0x52')]=integrations[_0xe51a('0x53')](_0x3ec301[_0xe51a('0x48')][_0xe51a('0x51')],_0x3ec301[_0xe51a('0x48')]['type']);return db[_0xe51a('0x4b')]['create'](_0x3ec301[_0xe51a('0x48')],{'include':[{'model':db[_0xe51a('0x54')],'as':_0xe51a('0x55')},{'model':db['DeskField'],'as':_0xe51a('0x52')}]});}return null;})['then'](respondWithResult(_0x56cf08,null))[_0xe51a('0x42')](handleError(_0x56cf08,null));};exports['getFields']=function(_0x78e7e9,_0x4d09b9,_0x545524){var _0x10f679=[{'name':'priority','label':_0xe51a('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x232718='';return db[_0xe51a('0x2d')]['findOne']({'where':{'id':_0x78e7e9[_0xe51a('0x44')]['id']},'attributes':['id',_0xe51a('0x57'),_0xe51a('0x58'),'username',_0xe51a('0x59'),_0xe51a('0x5a'),_0xe51a('0x5b'),'token',_0xe51a('0x5c')]})[_0xe51a('0x27')](handleEntityNotFound(_0x4d09b9,null))[_0xe51a('0x27')](function(_0x1b2a4d){if(_0x1b2a4d){_0x232718=_0x1b2a4d['remoteUri'];var _0x205d5=_0x232718['slice'](-0x1);if(_0x205d5==='/'){_0x232718=_0x232718[_0xe51a('0x5d')](0x0,_0x232718[_0xe51a('0x5e')](_0x205d5));}var _0x2165c1={'method':_0xe51a('0x5f'),'uri':util[_0xe51a('0x60')](_0xe51a('0x61'),_0x232718),'headers':{'Content-Type':_0xe51a('0x62'),'Accept':_0xe51a('0x62')},'json':!![]};if(_0x1b2a4d[_0xe51a('0x58')]==='basic'){_0x2165c1[_0xe51a('0x63')][_0xe51a('0x64')]=util[_0xe51a('0x60')](_0xe51a('0x65'),new Buffer(util['format']('%s:%s',_0x1b2a4d[_0xe51a('0x66')],_0x1b2a4d['password']))['toString'](_0xe51a('0x67')));}return rp(_0x2165c1)[_0xe51a('0x27')](function(_0x496178){return _0x10f679[_0xe51a('0x68')](_[_0xe51a('0x2c')](_0x496178[_0xe51a('0x69')][_0xe51a('0x6a')],function(_0x1a85eb){return{'id':_0x1a85eb[_0xe51a('0x29')],'name':_0x1a85eb[_0xe51a('0x29')],'type':_0x1a85eb[_0xe51a('0x2f')],'active':_0x1a85eb[_0xe51a('0x6b')],'label':_0x1a85eb[_0xe51a('0x6c')],'custom':!![]};}));});}})[_0xe51a('0x27')](function(_0x4f6ee3){return{'count':_0x4f6ee3['length'],'rows':_0x4f6ee3};})[_0xe51a('0x27')](respondWithResult(_0x4d09b9,null))[_0xe51a('0x42')](function(_0x39e19b){var _0x16bba1=_0x78e7e9[_0xe51a('0x31')][_0xe51a('0x6d')]?0x1f4:_0x39e19b[_0xe51a('0x6e')]||0x1f4;logger[_0xe51a('0x28')](_0xe51a('0x6f'),_0xe51a('0x70'),_0x16bba1,JSON[_0xe51a('0x71')](_0x39e19b));delete _0x39e19b[_0xe51a('0x29')];if(_0x16bba1===0x191){_0x16bba1=0x190;}_0x4d09b9['status'](_0x16bba1)[_0xe51a('0x2a')](_0x78e7e9['query']['test']?{'message':_0xe51a('0x72'),'statusCode':_0x39e19b['statusCode']}:_0x39e19b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 591dc42..d4ca664 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 _0xfc59=['DeskAccount','lodash','util','api','bluebird','path','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4a86f8,_0x5edd40){var _0x5e9383=function(_0x3238ae){while(--_0x3238ae){_0x4a86f8['push'](_0x4a86f8['shift']());}};_0x5e9383(++_0x5edd40);}(_0xfc59,0xfd));var _0x9fc5=function(_0x195ee2,_0x4760d5){_0x195ee2=_0x195ee2-0x0;var _0x5ed5ef=_0xfc59[_0x195ee2];return _0x5ed5ef;};'use strict';var _=require(_0x9fc5('0x0'));var util=require(_0x9fc5('0x1'));var logger=require('../../config/logger')(_0x9fc5('0x2'));var moment=require('moment');var BPromise=require(_0x9fc5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fc5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9fc5('0x5'));var integrations=require(_0x9fc5('0x6'));module[_0x9fc5('0x7')]=function(_0x189ec7,_0x41b33d){return _0x189ec7['define'](_0x9fc5('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x880a=['int_desk_accounts','util','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x880a,0x9b));var _0xa880=function(_0x1aacfa,_0x353b2a){_0x1aacfa=_0x1aacfa-0x0;var _0x3cb1b9=_0x880a[_0x1aacfa];return _0x3cb1b9;};'use strict';var _=require('lodash');var util=require(_0xa880('0x0'));var logger=require('../../config/logger')(_0xa880('0x1'));var moment=require(_0xa880('0x2'));var BPromise=require(_0xa880('0x3'));var rp=require(_0xa880('0x4'));var fs=require('fs');var path=require(_0xa880('0x5'));var rimraf=require(_0xa880('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa880('0x7'));module[_0xa880('0x8')]=function(_0x41794b,_0x1377aa){return _0x41794b['define'](_0xa880('0x9'),attributes,{'tableName':_0xa880('0xa'),'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 e0cecf9..d29f37a 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 _0xdff3=['info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','DeskAccount','findAll','options','attributes','include','map','model','then','GetDeskAccount','ShowDeskAccount','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0xdff3,0xe2));var _0x3dff=function(_0x19cc01,_0x564500){_0x19cc01=_0x19cc01-0x0;var _0xb5835c=_0xdff3[_0x19cc01];return _0xb5835c;};'use strict';var _=require(_0x3dff('0x0'));var util=require(_0x3dff('0x1'));var moment=require('moment');var BPromise=require(_0x3dff('0x2'));var rs=require(_0x3dff('0x3'));var fs=require('fs');var Redis=require(_0x3dff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dff('0x5'));var logger=require(_0x3dff('0x6'))(_0x3dff('0x7'));var config=require(_0x3dff('0x8'));var jayson=require(_0x3dff('0x9'));var client=jayson['client'][_0x3dff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370dbf,_0x9490de,_0x584fa3){return new BPromise(function(_0x3fc96,_0x73c5e4){return client[_0x3dff('0xb')](_0x370dbf,_0x584fa3)['then'](function(_0x4ca065){logger[_0x3dff('0xc')](_0x3dff('0xd'),_0x9490de,_0x3dff('0xe'));logger[_0x3dff('0xf')](_0x3dff('0x10'),_0x9490de,'request\x20sent',JSON[_0x3dff('0x11')](_0x4ca065));if(_0x4ca065['error']){if(_0x4ca065[_0x3dff('0x12')][_0x3dff('0x13')]===0x1f4){logger[_0x3dff('0x12')](_0x3dff('0xd'),_0x9490de,_0x4ca065[_0x3dff('0x12')][_0x3dff('0x14')]);return _0x73c5e4(_0x4ca065['error'][_0x3dff('0x14')]);}logger[_0x3dff('0x12')]('DeskAccount,\x20%s,\x20%s',_0x9490de,_0x4ca065[_0x3dff('0x12')][_0x3dff('0x14')]);return _0x3fc96(_0x4ca065[_0x3dff('0x12')]['message']);}else{logger[_0x3dff('0xc')](_0x3dff('0xd'),_0x9490de,'request\x20sent');_0x3fc96(_0x4ca065[_0x3dff('0x15')][_0x3dff('0x14')]);}})[_0x3dff('0x16')](function(_0x4ae531){logger[_0x3dff('0x12')](_0x3dff('0xd'),_0x9490de,_0x4ae531);_0x73c5e4(_0x4ae531);});});}exports['GetDeskAccount']=function(_0x3482ad){var _0x1c39cc=this;return new Promise(function(_0x570852,_0x51bf56){return db[_0x3dff('0x17')][_0x3dff('0x18')]({'raw':_0x3482ad['options']?_0x3482ad[_0x3dff('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3482ad['options']?_0x3482ad[_0x3dff('0x19')]['where']||null:null,'attributes':_0x3482ad[_0x3dff('0x19')]?_0x3482ad[_0x3dff('0x19')][_0x3dff('0x1a')]||null:null,'limit':_0x3482ad[_0x3dff('0x19')]?_0x3482ad[_0x3dff('0x19')]['limit']||null:null,'include':_0x3482ad[_0x3dff('0x19')]?_0x3482ad[_0x3dff('0x19')][_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x3482ad[_0x3dff('0x19')][_0x3dff('0x1b')],function(_0x3b248f){return{'model':db[_0x3b248f[_0x3dff('0x1d')]],'as':_0x3b248f['as'],'attributes':_0x3b248f['attributes'],'include':_0x3b248f[_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x3b248f[_0x3dff('0x1b')],function(_0x478927){return{'model':db[_0x478927[_0x3dff('0x1d')]],'as':_0x478927['as'],'attributes':_0x478927[_0x3dff('0x1a')],'include':_0x478927[_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x478927['include'],function(_0x271acb){return{'model':db[_0x271acb['model']],'as':_0x271acb['as'],'attributes':_0x271acb['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dff('0x1e')](function(_0x23a4c0){logger['info'](_0x3dff('0x1f'),_0x3482ad);logger[_0x3dff('0xf')](_0x3dff('0x1f'),_0x3482ad,JSON[_0x3dff('0x11')](_0x23a4c0));_0x570852(_0x23a4c0);})['catch'](function(_0x52fd09){logger[_0x3dff('0x12')]('GetDeskAccount',_0x52fd09[_0x3dff('0x14')],_0x3482ad);_0x51bf56(_0x1c39cc[_0x3dff('0x12')](0x1f4,_0x52fd09[_0x3dff('0x14')]));});});};exports[_0x3dff('0x20')]=function(_0x277d26){var _0x1f51b8=this;return new Promise(function(_0x41daea,_0x4f463d){return db[_0x3dff('0x17')]['find']({'raw':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')][_0x3dff('0x21')]||null:null,'attributes':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')][_0x3dff('0x1a')]||null:null,'include':_0x277d26[_0x3dff('0x19')]?_0x277d26[_0x3dff('0x19')][_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x277d26[_0x3dff('0x19')][_0x3dff('0x1b')],function(_0x426b42){return{'model':db[_0x426b42['model']],'as':_0x426b42['as'],'attributes':_0x426b42[_0x3dff('0x1a')],'include':_0x426b42['include']?_[_0x3dff('0x1c')](_0x426b42[_0x3dff('0x1b')],function(_0x37a0ad){return{'model':db[_0x37a0ad[_0x3dff('0x1d')]],'as':_0x37a0ad['as'],'attributes':_0x37a0ad[_0x3dff('0x1a')],'include':_0x37a0ad[_0x3dff('0x1b')]?_[_0x3dff('0x1c')](_0x37a0ad[_0x3dff('0x1b')],function(_0x21a695){return{'model':db[_0x21a695[_0x3dff('0x1d')]],'as':_0x21a695['as'],'attributes':_0x21a695['attributes']};}):[]};}):[]};}):[]:[]})[_0x3dff('0x1e')](function(_0x4c91ce){logger[_0x3dff('0xc')](_0x3dff('0x20'),_0x277d26);logger['debug'](_0x3dff('0x20'),_0x277d26,JSON[_0x3dff('0x11')](_0x4c91ce));_0x41daea(_0x4c91ce);})[_0x3dff('0x16')](function(_0x1ffc4e){logger[_0x3dff('0x12')](_0x3dff('0x20'),_0x1ffc4e[_0x3dff('0x14')],_0x277d26);_0x4f463d(_0x1f51b8['error'](0x1f4,_0x1ffc4e['message']));});});}; \ No newline at end of file +var _0x277d=['rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','code','error','DeskAccount,\x20%s,\x20%s','message','info','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount','find','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2cb58b,_0x5a879d){var _0xe9dd9c=function(_0x11e835){while(--_0x11e835){_0x2cb58b['push'](_0x2cb58b['shift']());}};_0xe9dd9c(++_0x5a879d);}(_0x277d,0x1c1));var _0xd277=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x277d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd277('0x0'));var util=require(_0xd277('0x1'));var moment=require(_0xd277('0x2'));var BPromise=require(_0xd277('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd277('0x4'))['db'];var utils=require(_0xd277('0x5'));var logger=require('../../config/logger')(_0xd277('0x6'));var config=require(_0xd277('0x7'));var jayson=require(_0xd277('0x8'));var client=jayson['client'][_0xd277('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52cc14,_0x2f9832,_0x17e800){return new BPromise(function(_0x34a5c6,_0x30b3fb){return client[_0xd277('0xa')](_0x52cc14,_0x17e800)[_0xd277('0xb')](function(_0x335cb2){logger['info']('DeskAccount,\x20%s,\x20%s',_0x2f9832,_0xd277('0xc'));logger[_0xd277('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2f9832,_0xd277('0xc'),JSON[_0xd277('0xe')](_0x335cb2));if(_0x335cb2['error']){if(_0x335cb2['error'][_0xd277('0xf')]===0x1f4){logger[_0xd277('0x10')](_0xd277('0x11'),_0x2f9832,_0x335cb2['error'][_0xd277('0x12')]);return _0x30b3fb(_0x335cb2[_0xd277('0x10')][_0xd277('0x12')]);}logger[_0xd277('0x10')](_0xd277('0x11'),_0x2f9832,_0x335cb2[_0xd277('0x10')]['message']);return _0x34a5c6(_0x335cb2[_0xd277('0x10')][_0xd277('0x12')]);}else{logger[_0xd277('0x13')](_0xd277('0x11'),_0x2f9832,_0xd277('0xc'));_0x34a5c6(_0x335cb2[_0xd277('0x14')][_0xd277('0x12')]);}})[_0xd277('0x15')](function(_0xf20f4e){logger[_0xd277('0x10')](_0xd277('0x11'),_0x2f9832,_0xf20f4e);_0x30b3fb(_0xf20f4e);});});}exports['GetDeskAccount']=function(_0x366e8f){var _0x5ee255=this;return new Promise(function(_0x5c10d4,_0x24ccc3){return db[_0xd277('0x16')][_0xd277('0x17')]({'raw':_0x366e8f[_0xd277('0x18')]?_0x366e8f[_0xd277('0x18')][_0xd277('0x19')]===undefined?!![]:![]:!![],'where':_0x366e8f[_0xd277('0x18')]?_0x366e8f[_0xd277('0x18')][_0xd277('0x1a')]||null:null,'attributes':_0x366e8f[_0xd277('0x18')]?_0x366e8f[_0xd277('0x18')][_0xd277('0x1b')]||null:null,'limit':_0x366e8f[_0xd277('0x18')]?_0x366e8f[_0xd277('0x18')][_0xd277('0x1c')]||null:null,'include':_0x366e8f[_0xd277('0x18')]?_0x366e8f[_0xd277('0x18')]['include']?_[_0xd277('0x1d')](_0x366e8f[_0xd277('0x18')][_0xd277('0x1e')],function(_0x3b574c){return{'model':db[_0x3b574c[_0xd277('0x1f')]],'as':_0x3b574c['as'],'attributes':_0x3b574c[_0xd277('0x1b')],'include':_0x3b574c[_0xd277('0x1e')]?_[_0xd277('0x1d')](_0x3b574c[_0xd277('0x1e')],function(_0x8760c9){return{'model':db[_0x8760c9[_0xd277('0x1f')]],'as':_0x8760c9['as'],'attributes':_0x8760c9[_0xd277('0x1b')],'include':_0x8760c9['include']?_[_0xd277('0x1d')](_0x8760c9[_0xd277('0x1e')],function(_0x54628d){return{'model':db[_0x54628d[_0xd277('0x1f')]],'as':_0x54628d['as'],'attributes':_0x54628d[_0xd277('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x974d0c){logger[_0xd277('0x13')]('GetDeskAccount',_0x366e8f);logger[_0xd277('0xd')](_0xd277('0x20'),_0x366e8f,JSON[_0xd277('0xe')](_0x974d0c));_0x5c10d4(_0x974d0c);})[_0xd277('0x15')](function(_0x32c6e6){logger[_0xd277('0x10')]('GetDeskAccount',_0x32c6e6[_0xd277('0x12')],_0x366e8f);_0x24ccc3(_0x5ee255[_0xd277('0x10')](0x1f4,_0x32c6e6[_0xd277('0x12')]));});});};exports['ShowDeskAccount']=function(_0x20279f){var _0x3d5b98=this;return new Promise(function(_0x32e550,_0x37deeb){return db[_0xd277('0x16')][_0xd277('0x21')]({'raw':_0x20279f[_0xd277('0x18')]?_0x20279f[_0xd277('0x18')][_0xd277('0x19')]===undefined?!![]:![]:!![],'where':_0x20279f[_0xd277('0x18')]?_0x20279f['options']['where']||null:null,'attributes':_0x20279f['options']?_0x20279f[_0xd277('0x18')][_0xd277('0x1b')]||null:null,'include':_0x20279f[_0xd277('0x18')]?_0x20279f[_0xd277('0x18')][_0xd277('0x1e')]?_[_0xd277('0x1d')](_0x20279f['options'][_0xd277('0x1e')],function(_0x5d0196){return{'model':db[_0x5d0196[_0xd277('0x1f')]],'as':_0x5d0196['as'],'attributes':_0x5d0196['attributes'],'include':_0x5d0196['include']?_[_0xd277('0x1d')](_0x5d0196[_0xd277('0x1e')],function(_0x54af5a){return{'model':db[_0x54af5a[_0xd277('0x1f')]],'as':_0x54af5a['as'],'attributes':_0x54af5a['attributes'],'include':_0x54af5a['include']?_[_0xd277('0x1d')](_0x54af5a[_0xd277('0x1e')],function(_0x4e4fbb){return{'model':db[_0x4e4fbb[_0xd277('0x1f')]],'as':_0x4e4fbb['as'],'attributes':_0x4e4fbb[_0xd277('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44f171){logger[_0xd277('0x13')](_0xd277('0x22'),_0x20279f);logger[_0xd277('0xd')](_0xd277('0x22'),_0x20279f,JSON[_0xd277('0xe')](_0x44f171));_0x32e550(_0x44f171);})[_0xd277('0x15')](function(_0x264b7e){logger[_0xd277('0x10')](_0xd277('0x22'),_0x264b7e[_0xd277('0x12')],_0x20279f);_0x37deeb(_0x3d5b98[_0xd277('0x10')](0x1f4,_0x264b7e['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 33bbf11..d817012 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x89ddcd,_0x39022b){var _0x48ca3a=function(_0x1310b3){while(--_0x1310b3){_0x89ddcd['push'](_0x89ddcd['shift']());}};_0x48ca3a(++_0x39022b);}(_0x3e74,0x175));var _0x43e7=function(_0x2fe7ae,_0x12fa85){_0x2fe7ae=_0x2fe7ae-0x0;var _0x47fcab=_0x3e74[_0x2fe7ae];return _0x47fcab;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3eeff9,_0x1cd028){var _0x102ed6=function(_0x2fc534){while(--_0x2fc534){_0x3eeff9['push'](_0x3eeff9['shift']());}};_0x102ed6(++_0x1cd028);}(_0x008c,0x188));var _0xc008=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0x008c[_0xf58288];return _0x196e87;};'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('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);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('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c05d2de..cd42a22 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 _0x30c8=['exports','STRING','sequelize'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x30c8,0x12b));var _0x830c=function(_0x5d4b42,_0x2bbf37){_0x5d4b42=_0x5d4b42-0x0;var _0xc78a6=_0x30c8[_0x5d4b42];return _0xc78a6;};'use strict';var Sequelize=require(_0x830c('0x0'));module[_0x830c('0x1')]={'name':{'type':Sequelize[_0x830c('0x2')]},'description':{'type':Sequelize[_0x830c('0x2')]}}; \ No newline at end of file +var _0x4afc=['sequelize','STRING'];(function(_0x3a3c81,_0x253ca1){var _0x53acaf=function(_0x585113){while(--_0x585113){_0x3a3c81['push'](_0x3a3c81['shift']());}};_0x53acaf(++_0x253ca1);}(_0x4afc,0xa0));var _0xc4af=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4afc[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0xc4af('0x0'));module['exports']={'name':{'type':Sequelize[_0xc4af('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fe7043d..1b2c2ad 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 _0x06a3=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','find','create','body','getFields','findOne','DeskField','order','map','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','send','DeskConfiguration','rawAttributes','fieldName','type','key','name'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0x06a3,0x79));var _0x306a=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0x06a3[_0x5f2fea];return _0x198a0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x306a('0x0'));var zipdir=require(_0x306a('0x1'));var jsonpatch=require(_0x306a('0x2'));var rp=require(_0x306a('0x3'));var moment=require('moment');var BPromise=require(_0x306a('0x4'));var Mustache=require(_0x306a('0x5'));var util=require('util');var path=require(_0x306a('0x6'));var sox=require(_0x306a('0x7'));var csv=require(_0x306a('0x8'));var ejs=require(_0x306a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x306a('0xa'));var crypto=require(_0x306a('0xb'));var jsforce=require(_0x306a('0xc'));var deskjs=require(_0x306a('0xd'));var toCsv=require(_0x306a('0x8'));var querystring=require(_0x306a('0xe'));var Papa=require(_0x306a('0xf'));var Redis=require(_0x306a('0x10'));var authService=require(_0x306a('0x11'));var qs=require(_0x306a('0x12'));var as=require(_0x306a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x306a('0x14'))(_0x306a('0x15'));var utils=require(_0x306a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x306a('0x17'));var db=require(_0x306a('0x18'))['db'];function respondWithStatusCode(_0x5b1998,_0x1ba4b2){_0x1ba4b2=_0x1ba4b2||0xcc;return function(_0x51c304){if(_0x51c304){return _0x5b1998['sendStatus'](_0x1ba4b2);}return _0x5b1998[_0x306a('0x19')](_0x1ba4b2)[_0x306a('0x1a')]();};}function respondWithResult(_0x136ff0,_0x24b073){_0x24b073=_0x24b073||0xc8;return function(_0x212c24){if(_0x212c24){return _0x136ff0[_0x306a('0x19')](_0x24b073)['json'](_0x212c24);}};}function respondWithFilteredResult(_0x2b8e66,_0xc6fa9){return function(_0x26f724){if(_0x26f724){var _0x4828cd=typeof _0xc6fa9[_0x306a('0x1b')]==='undefined'&&typeof _0xc6fa9['limit']===_0x306a('0x1c');var _0x1ceb0a=_0x26f724['count'];var _0x304566=_0x4828cd?0x0:_0xc6fa9[_0x306a('0x1b')];var _0xae1c6b=_0x4828cd?_0x26f724[_0x306a('0x1d')]:_0xc6fa9['offset']+_0xc6fa9['limit'];var _0x22950a;if(_0xae1c6b>=_0x1ceb0a){_0xae1c6b=_0x1ceb0a;_0x22950a=0xc8;}else{_0x22950a=0xce;}_0x2b8e66[_0x306a('0x19')](_0x22950a);return _0x2b8e66['set'](_0x306a('0x1e'),_0x304566+'-'+_0xae1c6b+'/'+_0x1ceb0a)[_0x306a('0x1f')](_0x26f724);}return null;};}function patchUpdates(_0x40a32f){return function(_0x19879d){try{jsonpatch[_0x306a('0x20')](_0x19879d,_0x40a32f,!![]);}catch(_0x190604){return BPromise[_0x306a('0x21')](_0x190604);}return _0x19879d[_0x306a('0x22')]();};}function saveUpdates(_0x13e2b0,_0x2f18cd){return function(_0x14f383){if(_0x14f383){return _0x14f383[_0x306a('0x23')](_0x13e2b0)[_0x306a('0x24')](function(_0x2c3de8){return _0x2c3de8;});}return null;};}function removeEntity(_0x67c3b1,_0x4ebc1f){return function(_0x376d0b){if(_0x376d0b){return _0x376d0b[_0x306a('0x25')]()['then'](function(){_0x67c3b1[_0x306a('0x19')](0xcc)[_0x306a('0x1a')]();});}};}function handleEntityNotFound(_0x28f1b7,_0x275a0){return function(_0x36cd58){if(!_0x36cd58){_0x28f1b7[_0x306a('0x26')](0x194);}return _0x36cd58;};}function handleError(_0x947fd7,_0x3f2cce){_0x3f2cce=_0x3f2cce||0x1f4;return function(_0x32a7c8){logger['error'](_0x32a7c8[_0x306a('0x27')]);if(_0x32a7c8['name']){delete _0x32a7c8['name'];}_0x947fd7[_0x306a('0x19')](_0x3f2cce)[_0x306a('0x28')](_0x32a7c8);};}exports['index']=function(_0x48b8a5,_0x46f932){var _0x50f47b={},_0x1d0525={},_0x4fcfa9={'count':0x0,'rows':[]};var _0x553516=_['map'](db[_0x306a('0x29')][_0x306a('0x2a')],function(_0x5de6ec){return{'name':_0x5de6ec[_0x306a('0x2b')],'type':_0x5de6ec[_0x306a('0x2c')][_0x306a('0x2d')]};});_0x1d0525['model']=_['map'](_0x553516,_0x306a('0x2e'));_0x1d0525['query']=_[_0x306a('0x2f')](_0x48b8a5[_0x306a('0x30')]);_0x1d0525['filters']=_[_0x306a('0x31')](_0x1d0525['model'],_0x1d0525['query']);_0x50f47b[_0x306a('0x32')]=_['intersection'](_0x1d0525['model'],qs[_0x306a('0x33')](_0x48b8a5['query'][_0x306a('0x33')]));_0x50f47b[_0x306a('0x32')]=_0x50f47b[_0x306a('0x32')][_0x306a('0x34')]?_0x50f47b[_0x306a('0x32')]:_0x1d0525['model'];if(!_0x48b8a5['query'][_0x306a('0x35')](_0x306a('0x36'))){_0x50f47b[_0x306a('0x37')]=qs[_0x306a('0x37')](_0x48b8a5[_0x306a('0x30')][_0x306a('0x37')]);_0x50f47b[_0x306a('0x1b')]=qs['offset'](_0x48b8a5[_0x306a('0x30')][_0x306a('0x1b')]);}_0x50f47b['order']=qs[_0x306a('0x38')](_0x48b8a5['query'][_0x306a('0x38')]);_0x50f47b[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x48b8a5[_0x306a('0x30')],_0x1d0525['filters']),_0x553516);if(_0x48b8a5[_0x306a('0x30')][_0x306a('0x3c')]){_0x50f47b[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x50f47b[_0x306a('0x39')],{'$or':_['map'](_0x553516,function(_0x2c10fc){if(_0x2c10fc[_0x306a('0x2c')]!==_0x306a('0x3e')){var _0x3755ae={};_0x3755ae[_0x2c10fc['name']]={'$like':'%'+_0x48b8a5[_0x306a('0x30')][_0x306a('0x3c')]+'%'};return _0x3755ae;}})});}_0x50f47b=_[_0x306a('0x3d')]({},_0x50f47b,_0x48b8a5[_0x306a('0x3f')]);var _0x23cfe5={'where':_0x50f47b['where']};return db[_0x306a('0x29')][_0x306a('0x1d')](_0x23cfe5)[_0x306a('0x24')](function(_0x571bd5){_0x4fcfa9['count']=_0x571bd5;if(_0x48b8a5[_0x306a('0x30')][_0x306a('0x40')]){_0x50f47b[_0x306a('0x41')]=[{'all':!![]}];}return db[_0x306a('0x29')][_0x306a('0x42')](_0x50f47b);})[_0x306a('0x24')](function(_0x16f16b){_0x4fcfa9['rows']=_0x16f16b;return _0x4fcfa9;})[_0x306a('0x24')](respondWithFilteredResult(_0x46f932,_0x50f47b))[_0x306a('0x43')](handleError(_0x46f932,null));};exports[_0x306a('0x44')]=function(_0x309a5c,_0x5d5600){var _0x1757a8={'raw':![],'where':{'id':_0x309a5c[_0x306a('0x45')]['id']}},_0x138eeb={};_0x138eeb[_0x306a('0x46')]=_['keys'](db[_0x306a('0x29')]['rawAttributes']);_0x138eeb[_0x306a('0x30')]=_[_0x306a('0x2f')](_0x309a5c[_0x306a('0x30')]);_0x138eeb[_0x306a('0x3a')]=_[_0x306a('0x31')](_0x138eeb['model'],_0x138eeb[_0x306a('0x30')]);_0x1757a8[_0x306a('0x32')]=_[_0x306a('0x31')](_0x138eeb[_0x306a('0x46')],qs[_0x306a('0x33')](_0x309a5c[_0x306a('0x30')][_0x306a('0x33')]));_0x1757a8[_0x306a('0x32')]=_0x1757a8[_0x306a('0x32')][_0x306a('0x34')]?_0x1757a8[_0x306a('0x32')]:_0x138eeb[_0x306a('0x46')];if(_0x309a5c['query'][_0x306a('0x40')]){_0x1757a8[_0x306a('0x41')]=[{'all':!![]}];}_0x1757a8=_[_0x306a('0x3d')]({},_0x1757a8,_0x309a5c[_0x306a('0x3f')]);return db[_0x306a('0x29')][_0x306a('0x47')](_0x1757a8)[_0x306a('0x24')](handleEntityNotFound(_0x5d5600,null))['then'](respondWithResult(_0x5d5600,null))[_0x306a('0x43')](handleError(_0x5d5600,null));};exports[_0x306a('0x48')]=function(_0x5e892b,_0x1ccc30){return db['DeskConfiguration']['create'](_0x5e892b[_0x306a('0x49')],{})[_0x306a('0x24')](respondWithResult(_0x1ccc30,0xc9))[_0x306a('0x43')](handleError(_0x1ccc30,null));};exports[_0x306a('0x23')]=function(_0x41f06f,_0x475d86){if(_0x41f06f[_0x306a('0x49')]['id']){delete _0x41f06f[_0x306a('0x49')]['id'];}return db[_0x306a('0x29')][_0x306a('0x47')]({'where':{'id':_0x41f06f[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x475d86,null))[_0x306a('0x24')](saveUpdates(_0x41f06f[_0x306a('0x49')],null))['then'](respondWithResult(_0x475d86,null))[_0x306a('0x43')](handleError(_0x475d86,null));};exports[_0x306a('0x25')]=function(_0x364539,_0x1c98dd){return db['DeskConfiguration'][_0x306a('0x47')]({'where':{'id':_0x364539[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x1c98dd,null))[_0x306a('0x24')](removeEntity(_0x1c98dd,null))[_0x306a('0x43')](handleError(_0x1c98dd,null));};exports[_0x306a('0x4a')]=function(_0xcd289,_0x3d23fa,_0x50fb72){var _0x38fb69={};var _0x32e231={};var _0x46b506;var _0x2d1083;return db[_0x306a('0x29')][_0x306a('0x4b')]({'where':{'id':_0xcd289[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x3d23fa,null))['then'](function(_0x371afb){if(_0x371afb){_0x46b506=_0x371afb;_0x32e231[_0x306a('0x46')]=_['keys'](db[_0x306a('0x4c')]['rawAttributes']);_0x32e231[_0x306a('0x30')]=_[_0x306a('0x2f')](_0xcd289[_0x306a('0x30')]);_0x32e231[_0x306a('0x3a')]=_[_0x306a('0x31')](_0x32e231[_0x306a('0x46')],_0x32e231[_0x306a('0x30')]);_0x38fb69[_0x306a('0x32')]=_[_0x306a('0x31')](_0x32e231['model'],qs['fields'](_0xcd289[_0x306a('0x30')][_0x306a('0x33')]));_0x38fb69[_0x306a('0x32')]=_0x38fb69[_0x306a('0x32')][_0x306a('0x34')]?_0x38fb69[_0x306a('0x32')]:_0x32e231[_0x306a('0x46')];_0x38fb69[_0x306a('0x4d')]=qs['sort'](_0xcd289['query'][_0x306a('0x38')]);_0x38fb69[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0xcd289[_0x306a('0x30')],_0x32e231[_0x306a('0x3a')]));if(_0xcd289[_0x306a('0x30')][_0x306a('0x3c')]){_0x38fb69[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x38fb69['where'],{'$or':_[_0x306a('0x4e')](_0x38fb69[_0x306a('0x32')],function(_0x2ae38a){var _0x588755={};_0x588755[_0x2ae38a]={'$like':'%'+_0xcd289[_0x306a('0x30')][_0x306a('0x3c')]+'%'};return _0x588755;})});}_0x38fb69=_[_0x306a('0x3d')]({},_0x38fb69,_0xcd289[_0x306a('0x3f')]);return _0x46b506[_0x306a('0x4a')](_0x38fb69);}})[_0x306a('0x24')](function(_0x4a15cb){if(_0x4a15cb){_0x2d1083=_0x4a15cb[_0x306a('0x34')];if(!_0xcd289['query'][_0x306a('0x35')](_0x306a('0x36'))){_0x38fb69[_0x306a('0x37')]=qs['limit'](_0xcd289[_0x306a('0x30')][_0x306a('0x37')]);_0x38fb69['offset']=qs[_0x306a('0x1b')](_0xcd289[_0x306a('0x30')][_0x306a('0x1b')]);}return _0x46b506[_0x306a('0x4a')](_0x38fb69);}})[_0x306a('0x24')](function(_0x395199){if(_0x395199){return _0x395199?{'count':_0x2d1083,'rows':_0x395199}:null;}})[_0x306a('0x24')](respondWithResult(_0x3d23fa,null))[_0x306a('0x43')](handleError(_0x3d23fa,null));};exports[_0x306a('0x4f')]=function(_0x1b340f,_0x12e410,_0x2abad6){var _0x37e8a0={};var _0x3032f6={};var _0x53fe90;var _0x17e057;return db[_0x306a('0x29')][_0x306a('0x4b')]({'where':{'id':_0x1b340f[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x12e410,null))['then'](function(_0x5e8589){if(_0x5e8589){_0x53fe90=_0x5e8589;_0x3032f6[_0x306a('0x46')]=_['keys'](db[_0x306a('0x4c')][_0x306a('0x2a')]);_0x3032f6[_0x306a('0x30')]=_['keys'](_0x1b340f['query']);_0x3032f6[_0x306a('0x3a')]=_[_0x306a('0x31')](_0x3032f6['model'],_0x3032f6[_0x306a('0x30')]);_0x37e8a0[_0x306a('0x32')]=_[_0x306a('0x31')](_0x3032f6[_0x306a('0x46')],qs['fields'](_0x1b340f[_0x306a('0x30')][_0x306a('0x33')]));_0x37e8a0[_0x306a('0x32')]=_0x37e8a0['attributes'][_0x306a('0x34')]?_0x37e8a0['attributes']:_0x3032f6[_0x306a('0x46')];_0x37e8a0[_0x306a('0x4d')]=qs[_0x306a('0x38')](_0x1b340f[_0x306a('0x30')][_0x306a('0x38')]);_0x37e8a0[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x1b340f[_0x306a('0x30')],_0x3032f6[_0x306a('0x3a')]));if(_0x1b340f['query'][_0x306a('0x3c')]){_0x37e8a0[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x37e8a0['where'],{'$or':_[_0x306a('0x4e')](_0x37e8a0[_0x306a('0x32')],function(_0x462fff){var _0x5620e7={};_0x5620e7[_0x462fff]={'$like':'%'+_0x1b340f['query']['filter']+'%'};return _0x5620e7;})});}_0x37e8a0=_['merge']({},_0x37e8a0,_0x1b340f['options']);return _0x53fe90[_0x306a('0x4f')](_0x37e8a0);}})[_0x306a('0x24')](function(_0x5d7987){if(_0x5d7987){_0x17e057=_0x5d7987[_0x306a('0x34')];if(!_0x1b340f[_0x306a('0x30')][_0x306a('0x35')](_0x306a('0x36'))){_0x37e8a0[_0x306a('0x37')]=qs['limit'](_0x1b340f[_0x306a('0x30')]['limit']);_0x37e8a0['offset']=qs[_0x306a('0x1b')](_0x1b340f[_0x306a('0x30')][_0x306a('0x1b')]);}return _0x53fe90[_0x306a('0x4f')](_0x37e8a0);}})['then'](function(_0x4f9403){if(_0x4f9403){return _0x4f9403?{'count':_0x17e057,'rows':_0x4f9403}:null;}})[_0x306a('0x24')](respondWithResult(_0x12e410,null))[_0x306a('0x43')](handleError(_0x12e410,null));};exports['getDescriptions']=function(_0x2fb387,_0x437370,_0x1e79c1){var _0x89f8d9={};var _0x4f0905={};var _0x26bdb5;var _0x41a95;return db['DeskConfiguration'][_0x306a('0x4b')]({'where':{'id':_0x2fb387[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x437370,null))['then'](function(_0x69c34d){if(_0x69c34d){_0x26bdb5=_0x69c34d;_0x4f0905[_0x306a('0x46')]=_['keys'](db[_0x306a('0x4c')]['rawAttributes']);_0x4f0905['query']=_[_0x306a('0x2f')](_0x2fb387[_0x306a('0x30')]);_0x4f0905[_0x306a('0x3a')]=_['intersection'](_0x4f0905[_0x306a('0x46')],_0x4f0905['query']);_0x89f8d9[_0x306a('0x32')]=_[_0x306a('0x31')](_0x4f0905['model'],qs['fields'](_0x2fb387[_0x306a('0x30')][_0x306a('0x33')]));_0x89f8d9['attributes']=_0x89f8d9[_0x306a('0x32')][_0x306a('0x34')]?_0x89f8d9[_0x306a('0x32')]:_0x4f0905[_0x306a('0x46')];_0x89f8d9['order']=qs[_0x306a('0x38')](_0x2fb387[_0x306a('0x30')][_0x306a('0x38')]);_0x89f8d9[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x2fb387[_0x306a('0x30')],_0x4f0905[_0x306a('0x3a')]));if(_0x2fb387[_0x306a('0x30')][_0x306a('0x3c')]){_0x89f8d9[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x89f8d9[_0x306a('0x39')],{'$or':_['map'](_0x89f8d9[_0x306a('0x32')],function(_0x4721e7){var _0x5a2efe={};_0x5a2efe[_0x4721e7]={'$like':'%'+_0x2fb387[_0x306a('0x30')][_0x306a('0x3c')]+'%'};return _0x5a2efe;})});}_0x89f8d9=_[_0x306a('0x3d')]({},_0x89f8d9,_0x2fb387[_0x306a('0x3f')]);return _0x26bdb5[_0x306a('0x50')](_0x89f8d9);}})[_0x306a('0x24')](function(_0x38e01b){if(_0x38e01b){_0x41a95=_0x38e01b[_0x306a('0x34')];if(!_0x2fb387[_0x306a('0x30')][_0x306a('0x35')]('nolimit')){_0x89f8d9[_0x306a('0x37')]=qs[_0x306a('0x37')](_0x2fb387[_0x306a('0x30')][_0x306a('0x37')]);_0x89f8d9['offset']=qs[_0x306a('0x1b')](_0x2fb387['query'][_0x306a('0x1b')]);}return _0x26bdb5[_0x306a('0x50')](_0x89f8d9);}})[_0x306a('0x24')](function(_0x345c74){if(_0x345c74){return _0x345c74?{'count':_0x41a95,'rows':_0x345c74}:null;}})[_0x306a('0x24')](respondWithResult(_0x437370,null))[_0x306a('0x43')](handleError(_0x437370,null));};exports[_0x306a('0x51')]=function(_0x2f565d,_0x1aa0e9,_0x3cc928){var _0x332f0e={};var _0x18d255={};var _0x22aa14;var _0x5d2a72;return db[_0x306a('0x29')]['findOne']({'where':{'id':_0x2f565d['params']['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x1aa0e9,null))[_0x306a('0x24')](function(_0x2bc00b){if(_0x2bc00b){_0x22aa14=_0x2bc00b;_0x18d255[_0x306a('0x46')]=_[_0x306a('0x2f')](db[_0x306a('0x52')][_0x306a('0x2a')]);_0x18d255[_0x306a('0x30')]=_[_0x306a('0x2f')](_0x2f565d['query']);_0x18d255['filters']=_[_0x306a('0x31')](_0x18d255['model'],_0x18d255['query']);_0x332f0e['attributes']=_[_0x306a('0x31')](_0x18d255[_0x306a('0x46')],qs[_0x306a('0x33')](_0x2f565d[_0x306a('0x30')]['fields']));_0x332f0e[_0x306a('0x32')]=_0x332f0e[_0x306a('0x32')][_0x306a('0x34')]?_0x332f0e['attributes']:_0x18d255[_0x306a('0x46')];_0x332f0e['order']=qs[_0x306a('0x38')](_0x2f565d['query'][_0x306a('0x38')]);_0x332f0e[_0x306a('0x39')]=qs[_0x306a('0x3a')](_[_0x306a('0x3b')](_0x2f565d[_0x306a('0x30')],_0x18d255['filters']));if(_0x2f565d[_0x306a('0x30')][_0x306a('0x3c')]){_0x332f0e[_0x306a('0x39')]=_[_0x306a('0x3d')](_0x332f0e[_0x306a('0x39')],{'$or':_[_0x306a('0x4e')](_0x332f0e[_0x306a('0x32')],function(_0x2e4276){var _0x346f1a={};_0x346f1a[_0x2e4276]={'$like':'%'+_0x2f565d['query']['filter']+'%'};return _0x346f1a;})});}_0x332f0e=_['merge']({},_0x332f0e,_0x2f565d[_0x306a('0x3f')]);return _0x22aa14[_0x306a('0x51')](_0x332f0e);}})[_0x306a('0x24')](function(_0x1bddbb){if(_0x1bddbb){_0x5d2a72=_0x1bddbb[_0x306a('0x34')];if(!_0x2f565d['query'][_0x306a('0x35')](_0x306a('0x36'))){_0x332f0e['limit']=qs[_0x306a('0x37')](_0x2f565d[_0x306a('0x30')]['limit']);_0x332f0e[_0x306a('0x1b')]=qs['offset'](_0x2f565d[_0x306a('0x30')][_0x306a('0x1b')]);}return _0x22aa14[_0x306a('0x51')](_0x332f0e);}})['then'](function(_0x5051df){if(_0x5051df){return _0x5051df?{'count':_0x5d2a72,'rows':_0x5051df}:null;}})['then'](respondWithResult(_0x1aa0e9,null))['catch'](handleError(_0x1aa0e9,null));};exports[_0x306a('0x53')]=function(_0x310be3,_0x4ec6f5,_0x177bda){if(_0x310be3[_0x306a('0x49')]['id']){delete _0x310be3['body']['id'];}return db[_0x306a('0x29')]['findOne']({'where':{'id':_0x310be3[_0x306a('0x45')]['id']}})[_0x306a('0x24')](handleEntityNotFound(_0x4ec6f5,null))[_0x306a('0x24')](function(_0x1c8dc1){if(_0x1c8dc1){return _0x1c8dc1[_0x306a('0x53')](_0x310be3['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x4ec6f5,null))[_0x306a('0x43')](handleError(_0x4ec6f5,null));}; \ No newline at end of file +var _0x942d=['create','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x3f1e6b,_0x3f9001){var _0x34ab17=function(_0x2ab7e4){while(--_0x2ab7e4){_0x3f1e6b['push'](_0x3f1e6b['shift']());}};_0x34ab17(++_0x3f9001);}(_0x942d,0x105));var _0xd942=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x942d[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xd942('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd942('0x1'));var jsonpatch=require(_0xd942('0x2'));var rp=require(_0xd942('0x3'));var moment=require(_0xd942('0x4'));var BPromise=require(_0xd942('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd942('0x6'));var sox=require(_0xd942('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd942('0x8'));var crypto=require(_0xd942('0x9'));var jsforce=require(_0xd942('0xa'));var deskjs=require(_0xd942('0xb'));var toCsv=require(_0xd942('0xc'));var querystring=require(_0xd942('0xd'));var Papa=require('papaparse');var Redis=require(_0xd942('0xe'));var authService=require(_0xd942('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd942('0x10'));var logger=require('../../config/logger')(_0xd942('0x11'));var utils=require(_0xd942('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd942('0x13'));var db=require(_0xd942('0x14'))['db'];function respondWithStatusCode(_0x42ded2,_0x1f3eb5){_0x1f3eb5=_0x1f3eb5||0xcc;return function(_0x3d410c){if(_0x3d410c){return _0x42ded2['sendStatus'](_0x1f3eb5);}return _0x42ded2[_0xd942('0x15')](_0x1f3eb5)[_0xd942('0x16')]();};}function respondWithResult(_0x29c7cb,_0x474407){_0x474407=_0x474407||0xc8;return function(_0x4ca7f4){if(_0x4ca7f4){return _0x29c7cb['status'](_0x474407)[_0xd942('0x17')](_0x4ca7f4);}};}function respondWithFilteredResult(_0x5ba41b,_0x3dbfd){return function(_0x5d936a){if(_0x5d936a){var _0x1394d6=typeof _0x3dbfd[_0xd942('0x18')]===_0xd942('0x19')&&typeof _0x3dbfd['limit']===_0xd942('0x19');var _0x631380=_0x5d936a['count'];var _0xd4a5de=_0x1394d6?0x0:_0x3dbfd[_0xd942('0x18')];var _0x13394f=_0x1394d6?_0x5d936a['count']:_0x3dbfd['offset']+_0x3dbfd[_0xd942('0x1a')];var _0x134b10;if(_0x13394f>=_0x631380){_0x13394f=_0x631380;_0x134b10=0xc8;}else{_0x134b10=0xce;}_0x5ba41b['status'](_0x134b10);return _0x5ba41b[_0xd942('0x1b')](_0xd942('0x1c'),_0xd4a5de+'-'+_0x13394f+'/'+_0x631380)[_0xd942('0x17')](_0x5d936a);}return null;};}function patchUpdates(_0x147ab9){return function(_0x3091fb){try{jsonpatch[_0xd942('0x1d')](_0x3091fb,_0x147ab9,!![]);}catch(_0x1bbee9){return BPromise[_0xd942('0x1e')](_0x1bbee9);}return _0x3091fb[_0xd942('0x1f')]();};}function saveUpdates(_0x3b3c50,_0x12dc36){return function(_0x15a619){if(_0x15a619){return _0x15a619[_0xd942('0x20')](_0x3b3c50)[_0xd942('0x21')](function(_0x3becb4){return _0x3becb4;});}return null;};}function removeEntity(_0xc47ef7,_0x5902d0){return function(_0x208a97){if(_0x208a97){return _0x208a97[_0xd942('0x22')]()[_0xd942('0x21')](function(){_0xc47ef7[_0xd942('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f41c,_0x531db4){return function(_0x23a7a2){if(!_0x23a7a2){_0x12f41c[_0xd942('0x23')](0x194);}return _0x23a7a2;};}function handleError(_0xfd1085,_0x2b6a20){_0x2b6a20=_0x2b6a20||0x1f4;return function(_0x45bf24){logger[_0xd942('0x24')](_0x45bf24['stack']);if(_0x45bf24['name']){delete _0x45bf24[_0xd942('0x25')];}_0xfd1085['status'](_0x2b6a20)[_0xd942('0x26')](_0x45bf24);};}exports[_0xd942('0x27')]=function(_0xe18e47,_0xc8d079){var _0x5b0030={},_0x4b20c4={},_0x2c490a={'count':0x0,'rows':[]};var _0x5829a9=_['map'](db['DeskConfiguration'][_0xd942('0x28')],function(_0x2d381b){return{'name':_0x2d381b[_0xd942('0x29')],'type':_0x2d381b[_0xd942('0x2a')]['key']};});_0x4b20c4[_0xd942('0x2b')]=_[_0xd942('0x2c')](_0x5829a9,_0xd942('0x25'));_0x4b20c4['query']=_[_0xd942('0x2d')](_0xe18e47[_0xd942('0x2e')]);_0x4b20c4['filters']=_[_0xd942('0x2f')](_0x4b20c4[_0xd942('0x2b')],_0x4b20c4[_0xd942('0x2e')]);_0x5b0030[_0xd942('0x30')]=_[_0xd942('0x2f')](_0x4b20c4[_0xd942('0x2b')],qs[_0xd942('0x31')](_0xe18e47[_0xd942('0x2e')][_0xd942('0x31')]));_0x5b0030[_0xd942('0x30')]=_0x5b0030[_0xd942('0x30')][_0xd942('0x32')]?_0x5b0030[_0xd942('0x30')]:_0x4b20c4[_0xd942('0x2b')];if(!_0xe18e47[_0xd942('0x2e')][_0xd942('0x33')](_0xd942('0x34'))){_0x5b0030[_0xd942('0x1a')]=qs['limit'](_0xe18e47[_0xd942('0x2e')]['limit']);_0x5b0030[_0xd942('0x18')]=qs[_0xd942('0x18')](_0xe18e47[_0xd942('0x2e')][_0xd942('0x18')]);}_0x5b0030[_0xd942('0x35')]=qs[_0xd942('0x36')](_0xe18e47['query'][_0xd942('0x36')]);_0x5b0030[_0xd942('0x37')]=qs[_0xd942('0x38')](_['pick'](_0xe18e47[_0xd942('0x2e')],_0x4b20c4[_0xd942('0x38')]),_0x5829a9);if(_0xe18e47[_0xd942('0x2e')][_0xd942('0x39')]){_0x5b0030[_0xd942('0x37')]=_[_0xd942('0x3a')](_0x5b0030[_0xd942('0x37')],{'$or':_[_0xd942('0x2c')](_0x5829a9,function(_0x2379f3){if(_0x2379f3[_0xd942('0x2a')]!==_0xd942('0x3b')){var _0x4f38e5={};_0x4f38e5[_0x2379f3[_0xd942('0x25')]]={'$like':'%'+_0xe18e47[_0xd942('0x2e')][_0xd942('0x39')]+'%'};return _0x4f38e5;}})});}_0x5b0030=_[_0xd942('0x3a')]({},_0x5b0030,_0xe18e47[_0xd942('0x3c')]);var _0x3983a7={'where':_0x5b0030[_0xd942('0x37')]};return db[_0xd942('0x3d')][_0xd942('0x3e')](_0x3983a7)[_0xd942('0x21')](function(_0x128de7){_0x2c490a[_0xd942('0x3e')]=_0x128de7;if(_0xe18e47[_0xd942('0x2e')][_0xd942('0x3f')]){_0x5b0030['include']=[{'all':!![]}];}return db[_0xd942('0x3d')][_0xd942('0x40')](_0x5b0030);})[_0xd942('0x21')](function(_0x544016){_0x2c490a[_0xd942('0x41')]=_0x544016;return _0x2c490a;})[_0xd942('0x21')](respondWithFilteredResult(_0xc8d079,_0x5b0030))[_0xd942('0x42')](handleError(_0xc8d079,null));};exports[_0xd942('0x43')]=function(_0x3a3a6a,_0x35408f){var _0xd554ff={'raw':![],'where':{'id':_0x3a3a6a[_0xd942('0x44')]['id']}},_0x28de5d={};_0x28de5d[_0xd942('0x2b')]=_[_0xd942('0x2d')](db[_0xd942('0x3d')][_0xd942('0x28')]);_0x28de5d[_0xd942('0x2e')]=_[_0xd942('0x2d')](_0x3a3a6a['query']);_0x28de5d[_0xd942('0x38')]=_['intersection'](_0x28de5d[_0xd942('0x2b')],_0x28de5d[_0xd942('0x2e')]);_0xd554ff[_0xd942('0x30')]=_[_0xd942('0x2f')](_0x28de5d['model'],qs[_0xd942('0x31')](_0x3a3a6a[_0xd942('0x2e')]['fields']));_0xd554ff[_0xd942('0x30')]=_0xd554ff['attributes'][_0xd942('0x32')]?_0xd554ff[_0xd942('0x30')]:_0x28de5d[_0xd942('0x2b')];if(_0x3a3a6a[_0xd942('0x2e')][_0xd942('0x3f')]){_0xd554ff[_0xd942('0x45')]=[{'all':!![]}];}_0xd554ff=_[_0xd942('0x3a')]({},_0xd554ff,_0x3a3a6a[_0xd942('0x3c')]);return db[_0xd942('0x3d')][_0xd942('0x46')](_0xd554ff)[_0xd942('0x21')](handleEntityNotFound(_0x35408f,null))[_0xd942('0x21')](respondWithResult(_0x35408f,null))[_0xd942('0x42')](handleError(_0x35408f,null));};exports[_0xd942('0x47')]=function(_0x3ff277,_0x132417){return db[_0xd942('0x3d')][_0xd942('0x47')](_0x3ff277[_0xd942('0x48')],{})['then'](respondWithResult(_0x132417,0xc9))['catch'](handleError(_0x132417,null));};exports[_0xd942('0x20')]=function(_0x164f33,_0x3a9439){if(_0x164f33[_0xd942('0x48')]['id']){delete _0x164f33['body']['id'];}return db[_0xd942('0x3d')][_0xd942('0x46')]({'where':{'id':_0x164f33['params']['id']}})[_0xd942('0x21')](handleEntityNotFound(_0x3a9439,null))[_0xd942('0x21')](saveUpdates(_0x164f33[_0xd942('0x48')],null))[_0xd942('0x21')](respondWithResult(_0x3a9439,null))['catch'](handleError(_0x3a9439,null));};exports[_0xd942('0x22')]=function(_0x363603,_0x2bebf2){return db[_0xd942('0x3d')]['find']({'where':{'id':_0x363603[_0xd942('0x44')]['id']}})['then'](handleEntityNotFound(_0x2bebf2,null))[_0xd942('0x21')](removeEntity(_0x2bebf2,null))[_0xd942('0x42')](handleError(_0x2bebf2,null));};exports[_0xd942('0x49')]=function(_0x49afe9,_0x330027,_0x58154f){var _0x624029={};var _0x15599e={};var _0x1bbe11;var _0x3a3ec5;return db['DeskConfiguration'][_0xd942('0x4a')]({'where':{'id':_0x49afe9[_0xd942('0x44')]['id']}})['then'](handleEntityNotFound(_0x330027,null))[_0xd942('0x21')](function(_0x2fbe82){if(_0x2fbe82){_0x1bbe11=_0x2fbe82;_0x15599e[_0xd942('0x2b')]=_[_0xd942('0x2d')](db[_0xd942('0x4b')][_0xd942('0x28')]);_0x15599e[_0xd942('0x2e')]=_[_0xd942('0x2d')](_0x49afe9[_0xd942('0x2e')]);_0x15599e[_0xd942('0x38')]=_['intersection'](_0x15599e[_0xd942('0x2b')],_0x15599e['query']);_0x624029[_0xd942('0x30')]=_['intersection'](_0x15599e[_0xd942('0x2b')],qs['fields'](_0x49afe9['query'][_0xd942('0x31')]));_0x624029[_0xd942('0x30')]=_0x624029[_0xd942('0x30')][_0xd942('0x32')]?_0x624029[_0xd942('0x30')]:_0x15599e[_0xd942('0x2b')];_0x624029['order']=qs[_0xd942('0x36')](_0x49afe9['query'][_0xd942('0x36')]);_0x624029['where']=qs['filters'](_[_0xd942('0x4c')](_0x49afe9['query'],_0x15599e[_0xd942('0x38')]));if(_0x49afe9['query']['filter']){_0x624029['where']=_[_0xd942('0x3a')](_0x624029['where'],{'$or':_[_0xd942('0x2c')](_0x624029['attributes'],function(_0x1e05be){var _0x208d45={};_0x208d45[_0x1e05be]={'$like':'%'+_0x49afe9[_0xd942('0x2e')]['filter']+'%'};return _0x208d45;})});}_0x624029=_[_0xd942('0x3a')]({},_0x624029,_0x49afe9[_0xd942('0x3c')]);return _0x1bbe11[_0xd942('0x49')](_0x624029);}})[_0xd942('0x21')](function(_0x19d404){if(_0x19d404){_0x3a3ec5=_0x19d404['length'];if(!_0x49afe9[_0xd942('0x2e')]['hasOwnProperty'](_0xd942('0x34'))){_0x624029[_0xd942('0x1a')]=qs[_0xd942('0x1a')](_0x49afe9[_0xd942('0x2e')]['limit']);_0x624029[_0xd942('0x18')]=qs[_0xd942('0x18')](_0x49afe9[_0xd942('0x2e')][_0xd942('0x18')]);}return _0x1bbe11[_0xd942('0x49')](_0x624029);}})[_0xd942('0x21')](function(_0x583217){if(_0x583217){return _0x583217?{'count':_0x3a3ec5,'rows':_0x583217}:null;}})[_0xd942('0x21')](respondWithResult(_0x330027,null))[_0xd942('0x42')](handleError(_0x330027,null));};exports[_0xd942('0x4d')]=function(_0xf699d0,_0x2826a4,_0x4c5d75){var _0x119c21={};var _0x38b37d={};var _0x298654;var _0x283549;return db['DeskConfiguration'][_0xd942('0x4a')]({'where':{'id':_0xf699d0[_0xd942('0x44')]['id']}})[_0xd942('0x21')](handleEntityNotFound(_0x2826a4,null))[_0xd942('0x21')](function(_0x5665ed){if(_0x5665ed){_0x298654=_0x5665ed;_0x38b37d[_0xd942('0x2b')]=_[_0xd942('0x2d')](db[_0xd942('0x4b')]['rawAttributes']);_0x38b37d['query']=_[_0xd942('0x2d')](_0xf699d0['query']);_0x38b37d[_0xd942('0x38')]=_[_0xd942('0x2f')](_0x38b37d[_0xd942('0x2b')],_0x38b37d['query']);_0x119c21[_0xd942('0x30')]=_[_0xd942('0x2f')](_0x38b37d[_0xd942('0x2b')],qs[_0xd942('0x31')](_0xf699d0[_0xd942('0x2e')]['fields']));_0x119c21['attributes']=_0x119c21[_0xd942('0x30')][_0xd942('0x32')]?_0x119c21[_0xd942('0x30')]:_0x38b37d[_0xd942('0x2b')];_0x119c21['order']=qs['sort'](_0xf699d0[_0xd942('0x2e')]['sort']);_0x119c21[_0xd942('0x37')]=qs[_0xd942('0x38')](_[_0xd942('0x4c')](_0xf699d0[_0xd942('0x2e')],_0x38b37d[_0xd942('0x38')]));if(_0xf699d0['query']['filter']){_0x119c21[_0xd942('0x37')]=_[_0xd942('0x3a')](_0x119c21[_0xd942('0x37')],{'$or':_[_0xd942('0x2c')](_0x119c21['attributes'],function(_0x2d775b){var _0x412d7c={};_0x412d7c[_0x2d775b]={'$like':'%'+_0xf699d0[_0xd942('0x2e')][_0xd942('0x39')]+'%'};return _0x412d7c;})});}_0x119c21=_[_0xd942('0x3a')]({},_0x119c21,_0xf699d0[_0xd942('0x3c')]);return _0x298654[_0xd942('0x4d')](_0x119c21);}})[_0xd942('0x21')](function(_0x14d2e9){if(_0x14d2e9){_0x283549=_0x14d2e9['length'];if(!_0xf699d0[_0xd942('0x2e')][_0xd942('0x33')]('nolimit')){_0x119c21[_0xd942('0x1a')]=qs['limit'](_0xf699d0['query'][_0xd942('0x1a')]);_0x119c21[_0xd942('0x18')]=qs[_0xd942('0x18')](_0xf699d0[_0xd942('0x2e')]['offset']);}return _0x298654[_0xd942('0x4d')](_0x119c21);}})['then'](function(_0x37e68f){if(_0x37e68f){return _0x37e68f?{'count':_0x283549,'rows':_0x37e68f}:null;}})['then'](respondWithResult(_0x2826a4,null))[_0xd942('0x42')](handleError(_0x2826a4,null));};exports[_0xd942('0x4e')]=function(_0x276483,_0x2f2cc3,_0x9b3d48){var _0x3d3464={};var _0x3866a2={};var _0xe1b6e7;var _0x136e6a;return db[_0xd942('0x3d')][_0xd942('0x4a')]({'where':{'id':_0x276483[_0xd942('0x44')]['id']}})[_0xd942('0x21')](handleEntityNotFound(_0x2f2cc3,null))[_0xd942('0x21')](function(_0x4aa2d7){if(_0x4aa2d7){_0xe1b6e7=_0x4aa2d7;_0x3866a2[_0xd942('0x2b')]=_[_0xd942('0x2d')](db[_0xd942('0x4b')][_0xd942('0x28')]);_0x3866a2[_0xd942('0x2e')]=_[_0xd942('0x2d')](_0x276483[_0xd942('0x2e')]);_0x3866a2[_0xd942('0x38')]=_['intersection'](_0x3866a2[_0xd942('0x2b')],_0x3866a2[_0xd942('0x2e')]);_0x3d3464['attributes']=_[_0xd942('0x2f')](_0x3866a2[_0xd942('0x2b')],qs[_0xd942('0x31')](_0x276483[_0xd942('0x2e')][_0xd942('0x31')]));_0x3d3464[_0xd942('0x30')]=_0x3d3464['attributes'][_0xd942('0x32')]?_0x3d3464[_0xd942('0x30')]:_0x3866a2['model'];_0x3d3464[_0xd942('0x35')]=qs['sort'](_0x276483[_0xd942('0x2e')]['sort']);_0x3d3464[_0xd942('0x37')]=qs[_0xd942('0x38')](_['pick'](_0x276483[_0xd942('0x2e')],_0x3866a2['filters']));if(_0x276483[_0xd942('0x2e')][_0xd942('0x39')]){_0x3d3464[_0xd942('0x37')]=_['merge'](_0x3d3464[_0xd942('0x37')],{'$or':_[_0xd942('0x2c')](_0x3d3464[_0xd942('0x30')],function(_0x3e3bc9){var _0x153777={};_0x153777[_0x3e3bc9]={'$like':'%'+_0x276483[_0xd942('0x2e')]['filter']+'%'};return _0x153777;})});}_0x3d3464=_['merge']({},_0x3d3464,_0x276483[_0xd942('0x3c')]);return _0xe1b6e7['getDescriptions'](_0x3d3464);}})[_0xd942('0x21')](function(_0x2368ea){if(_0x2368ea){_0x136e6a=_0x2368ea[_0xd942('0x32')];if(!_0x276483[_0xd942('0x2e')][_0xd942('0x33')](_0xd942('0x34'))){_0x3d3464[_0xd942('0x1a')]=qs['limit'](_0x276483[_0xd942('0x2e')]['limit']);_0x3d3464[_0xd942('0x18')]=qs[_0xd942('0x18')](_0x276483[_0xd942('0x2e')][_0xd942('0x18')]);}return _0xe1b6e7[_0xd942('0x4e')](_0x3d3464);}})['then'](function(_0xa087c){if(_0xa087c){return _0xa087c?{'count':_0x136e6a,'rows':_0xa087c}:null;}})['then'](respondWithResult(_0x2f2cc3,null))[_0xd942('0x42')](handleError(_0x2f2cc3,null));};exports[_0xd942('0x4f')]=function(_0x25418d,_0xe5c65a,_0x2d1087){var _0x2f9043={};var _0xb432a0={};var _0x569e92;var _0x3363e9;return db[_0xd942('0x3d')][_0xd942('0x4a')]({'where':{'id':_0x25418d['params']['id']}})[_0xd942('0x21')](handleEntityNotFound(_0xe5c65a,null))['then'](function(_0x572f9e){if(_0x572f9e){_0x569e92=_0x572f9e;_0xb432a0[_0xd942('0x2b')]=_[_0xd942('0x2d')](db[_0xd942('0x50')][_0xd942('0x28')]);_0xb432a0[_0xd942('0x2e')]=_['keys'](_0x25418d['query']);_0xb432a0[_0xd942('0x38')]=_[_0xd942('0x2f')](_0xb432a0[_0xd942('0x2b')],_0xb432a0[_0xd942('0x2e')]);_0x2f9043[_0xd942('0x30')]=_['intersection'](_0xb432a0[_0xd942('0x2b')],qs[_0xd942('0x31')](_0x25418d['query'][_0xd942('0x31')]));_0x2f9043['attributes']=_0x2f9043[_0xd942('0x30')][_0xd942('0x32')]?_0x2f9043['attributes']:_0xb432a0[_0xd942('0x2b')];_0x2f9043[_0xd942('0x35')]=qs[_0xd942('0x36')](_0x25418d[_0xd942('0x2e')][_0xd942('0x36')]);_0x2f9043[_0xd942('0x37')]=qs['filters'](_['pick'](_0x25418d[_0xd942('0x2e')],_0xb432a0[_0xd942('0x38')]));if(_0x25418d[_0xd942('0x2e')][_0xd942('0x39')]){_0x2f9043[_0xd942('0x37')]=_[_0xd942('0x3a')](_0x2f9043[_0xd942('0x37')],{'$or':_[_0xd942('0x2c')](_0x2f9043['attributes'],function(_0x5a60d7){var _0x84a308={};_0x84a308[_0x5a60d7]={'$like':'%'+_0x25418d[_0xd942('0x2e')][_0xd942('0x39')]+'%'};return _0x84a308;})});}_0x2f9043=_[_0xd942('0x3a')]({},_0x2f9043,_0x25418d['options']);return _0x569e92[_0xd942('0x4f')](_0x2f9043);}})[_0xd942('0x21')](function(_0x654181){if(_0x654181){_0x3363e9=_0x654181[_0xd942('0x32')];if(!_0x25418d[_0xd942('0x2e')]['hasOwnProperty'](_0xd942('0x34'))){_0x2f9043[_0xd942('0x1a')]=qs['limit'](_0x25418d[_0xd942('0x2e')][_0xd942('0x1a')]);_0x2f9043[_0xd942('0x18')]=qs['offset'](_0x25418d['query'][_0xd942('0x18')]);}return _0x569e92[_0xd942('0x4f')](_0x2f9043);}})['then'](function(_0x315a25){if(_0x315a25){return _0x315a25?{'count':_0x3363e9,'rows':_0x315a25}:null;}})[_0xd942('0x21')](respondWithResult(_0xe5c65a,null))[_0xd942('0x42')](handleError(_0xe5c65a,null));};exports[_0xd942('0x51')]=function(_0x1c18aa,_0x2a563d,_0x4a1aa0){if(_0x1c18aa[_0xd942('0x48')]['id']){delete _0x1c18aa[_0xd942('0x48')]['id'];}return db[_0xd942('0x3d')]['findOne']({'where':{'id':_0x1c18aa[_0xd942('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a563d,null))[_0xd942('0x21')](function(_0x34032b){if(_0x34032b){return _0x34032b[_0xd942('0x51')](_0x1c18aa['body'][_0xd942('0x52')]||[]);}return null;})[_0xd942('0x21')](respondWithResult(_0x2a563d,null))[_0xd942('0x42')](handleError(_0x2a563d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c3a6197..0927f51 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 _0xb2dd=['int_desk_configurations','util','api','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration'];(function(_0x469d84,_0x5ad27e){var _0xdf80df=function(_0x2c9932){while(--_0x2c9932){_0x469d84['push'](_0x469d84['shift']());}};_0xdf80df(++_0x5ad27e);}(_0xb2dd,0xb5));var _0xdb2d=function(_0x2583b2,_0x45a743){_0x2583b2=_0x2583b2-0x0;var _0xc1b07c=_0xb2dd[_0x2583b2];return _0xc1b07c;};'use strict';var _=require('lodash');var util=require(_0xdb2d('0x0'));var logger=require('../../config/logger')(_0xdb2d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb2d('0x2'));var fs=require('fs');var path=require(_0xdb2d('0x3'));var rimraf=require('rimraf');var config=require(_0xdb2d('0x4'));var attributes=require(_0xdb2d('0x5'));module[_0xdb2d('0x6')]=function(_0x24926b,_0xa289e6){return _0x24926b['define'](_0xdb2d('0x7'),attributes,{'tableName':_0xdb2d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8b7=['../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1496bc,_0x369cd5){var _0x4f8978=function(_0x32d2b7){while(--_0x32d2b7){_0x1496bc['push'](_0x1496bc['shift']());}};_0x4f8978(++_0x369cd5);}(_0xf8b7,0x1b5));var _0x7f8b=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0xf8b7[_0x2742db];return _0x18659e;};'use strict';var _=require(_0x7f8b('0x0'));var util=require(_0x7f8b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f8b('0x2'));var BPromise=require(_0x7f8b('0x3'));var rp=require(_0x7f8b('0x4'));var fs=require('fs');var path=require(_0x7f8b('0x5'));var rimraf=require(_0x7f8b('0x6'));var config=require(_0x7f8b('0x7'));var attributes=require(_0x7f8b('0x8'));module[_0x7f8b('0x9')]=function(_0x10a516,_0xb4cd11){return _0x10a516['define'](_0x7f8b('0xa'),attributes,{'tableName':_0x7f8b('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 e7ad17a..5fd058a 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 _0x7880=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0xd76e03,_0x527b40){var _0x30dd20=function(_0x10d530){while(--_0x10d530){_0xd76e03['push'](_0xd76e03['shift']());}};_0x30dd20(++_0x527b40);}(_0x7880,0x10f));var _0x0788=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x7880[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0x0788('0x0'));var util=require('util');var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0788('0x6'));var config=require('../../config/environment');var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ece1c,_0x14cfa5,_0x450b71){return new BPromise(function(_0x5366c7,_0x1662a2){return client[_0x0788('0xa')](_0x5ece1c,_0x450b71)[_0x0788('0xb')](function(_0x95ebe3){logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x14cfa5,_0x0788('0xe'),JSON[_0x0788('0x11')](_0x95ebe3));if(_0x95ebe3['error']){if(_0x95ebe3[_0x0788('0x12')]['code']===0x1f4){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x95ebe3[_0x0788('0x12')][_0x0788('0x13')]);return _0x1662a2(_0x95ebe3[_0x0788('0x12')]['message']);}logger[_0x0788('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x14cfa5,_0x95ebe3[_0x0788('0x12')]['message']);return _0x5366c7(_0x95ebe3['error'][_0x0788('0x13')]);}else{logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,'request\x20sent');_0x5366c7(_0x95ebe3[_0x0788('0x14')][_0x0788('0x13')]);}})['catch'](function(_0x334f58){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x334f58);_0x1662a2(_0x334f58);});});} \ No newline at end of file +var _0x2fc0=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2fc0,0x192));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x02fc('0x0'));var moment=require(_0x02fc('0x1'));var BPromise=require(_0x02fc('0x2'));var rs=require(_0x02fc('0x3'));var fs=require('fs');var Redis=require(_0x02fc('0x4'));var db=require(_0x02fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x02fc('0x6'))(_0x02fc('0x7'));var config=require(_0x02fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x02fc('0x9')][_0x02fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a283b,_0x116104,_0x4ad1cd){return new BPromise(function(_0x6b7484,_0x3a154d){return client[_0x02fc('0xb')](_0x2a283b,_0x4ad1cd)[_0x02fc('0xc')](function(_0x57157c){logger[_0x02fc('0xd')](_0x02fc('0xe'),_0x116104,_0x02fc('0xf'));logger['debug'](_0x02fc('0x10'),_0x116104,_0x02fc('0xf'),JSON['stringify'](_0x57157c));if(_0x57157c[_0x02fc('0x11')]){if(_0x57157c[_0x02fc('0x11')][_0x02fc('0x12')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x116104,_0x57157c[_0x02fc('0x11')][_0x02fc('0x13')]);return _0x3a154d(_0x57157c[_0x02fc('0x11')][_0x02fc('0x13')]);}logger['error'](_0x02fc('0xe'),_0x116104,_0x57157c['error'][_0x02fc('0x13')]);return _0x6b7484(_0x57157c[_0x02fc('0x11')]['message']);}else{logger[_0x02fc('0xd')](_0x02fc('0xe'),_0x116104,_0x02fc('0xf'));_0x6b7484(_0x57157c[_0x02fc('0x14')]['message']);}})['catch'](function(_0x18f3c8){logger[_0x02fc('0x11')](_0x02fc('0xe'),_0x116104,_0x18f3c8);_0x3a154d(_0x18f3c8);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a5b9cb6..f56a8f1 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 _0x8be9=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x5d9fdf,_0x4bbefa){var _0x361769=function(_0x34e8f5){while(--_0x34e8f5){_0x5d9fdf['push'](_0x5d9fdf['shift']());}};_0x361769(++_0x4bbefa);}(_0x8be9,0x8f));var _0x98be=function(_0x8dfc35,_0x115773){_0x8dfc35=_0x8dfc35-0x0;var _0x2a98bd=_0x8be9[_0x8dfc35];return _0x2a98bd;};'use strict';var multer=require(_0x98be('0x0'));var util=require('util');var path=require(_0x98be('0x1'));var timeout=require(_0x98be('0x2'));var express=require(_0x98be('0x3'));var router=express[_0x98be('0x4')]();var fs_extra=require(_0x98be('0x5'));var auth=require(_0x98be('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x98be('0x7'));var controller=require('./intDeskField.controller');router[_0x98be('0x8')]('/',auth[_0x98be('0x9')](),controller[_0x98be('0xa')]);router['get'](_0x98be('0xb'),auth[_0x98be('0x9')](),controller[_0x98be('0xc')]);router[_0x98be('0xd')]('/',auth[_0x98be('0x9')](),controller[_0x98be('0xe')]);router['put'](_0x98be('0xb'),auth['isAuthenticated'](),controller[_0x98be('0xf')]);router['delete'](_0x98be('0xb'),auth['isAuthenticated'](),controller[_0x98be('0x10')]);module[_0x98be('0x11')]=router; \ No newline at end of file +var _0x024b=['delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x54aaba,_0x333651){var _0x3a2074=function(_0x1ef705){while(--_0x1ef705){_0x54aaba['push'](_0x54aaba['shift']());}};_0x3a2074(++_0x333651);}(_0x024b,0xac));var _0xb024=function(_0x4e78ec,_0x11f4f3){_0x4e78ec=_0x4e78ec-0x0;var _0x5a78cd=_0x024b[_0x4e78ec];return _0x5a78cd;};'use strict';var multer=require(_0xb024('0x0'));var util=require(_0xb024('0x1'));var path=require(_0xb024('0x2'));var timeout=require('connect-timeout');var express=require(_0xb024('0x3'));var router=express[_0xb024('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb024('0x5'));var interaction=require(_0xb024('0x6'));var config=require('../../config/environment');var controller=require(_0xb024('0x7'));router[_0xb024('0x8')]('/',auth[_0xb024('0x9')](),controller['index']);router['get'](_0xb024('0xa'),auth[_0xb024('0x9')](),controller[_0xb024('0xb')]);router[_0xb024('0xc')]('/',auth[_0xb024('0x9')](),controller[_0xb024('0xd')]);router['put'](_0xb024('0xa'),auth[_0xb024('0x9')](),controller[_0xb024('0xe')]);router[_0xb024('0xf')](_0xb024('0xa'),auth['isAuthenticated'](),controller[_0xb024('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f5e2212..ef992b6 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 _0x6c93=['BOOLEAN','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5ca004,_0x9d926b){var _0x8b7a64=function(_0x44ed7d){while(--_0x44ed7d){_0x5ca004['push'](_0x5ca004['shift']());}};_0x8b7a64(++_0x9d926b);}(_0x6c93,0x1c3));var _0x36c9=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0x6c93[_0x2dd6b1];return _0x494306;};'use strict';var Sequelize=require('sequelize');module[_0x36c9('0x0')]={'type':{'type':Sequelize[_0x36c9('0x1')]('string',_0x36c9('0x2'),_0x36c9('0x3'),_0x36c9('0x4'),_0x36c9('0x5')),'defaultValue':_0x36c9('0x6')},'content':{'type':Sequelize[_0x36c9('0x7')]},'key':{'type':Sequelize[_0x36c9('0x7')]},'keyType':{'type':Sequelize[_0x36c9('0x1')](_0x36c9('0x6'),'variable',_0x36c9('0x3'))},'keyContent':{'type':Sequelize[_0x36c9('0x7')]},'idField':{'type':Sequelize[_0x36c9('0x7')]},'nameField':{'type':Sequelize[_0x36c9('0x7')]},'customField':{'type':Sequelize[_0x36c9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36c9('0x7')]}}; \ No newline at end of file +var _0xaa04=['BOOLEAN','sequelize','ENUM','keyValue','picklist','string','STRING','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa04,0x6d));var _0x4aa0=function(_0x32b47c,_0x408bb5){_0x32b47c=_0x32b47c-0x0;var _0x4023aa=_0xaa04[_0x32b47c];return _0x4023aa;};'use strict';var Sequelize=require(_0x4aa0('0x0'));module['exports']={'type':{'type':Sequelize[_0x4aa0('0x1')]('string','variable','customVariable',_0x4aa0('0x2'),_0x4aa0('0x3')),'defaultValue':_0x4aa0('0x4')},'content':{'type':Sequelize[_0x4aa0('0x5')]},'key':{'type':Sequelize[_0x4aa0('0x5')]},'keyType':{'type':Sequelize[_0x4aa0('0x1')]('string',_0x4aa0('0x6'),_0x4aa0('0x7'))},'keyContent':{'type':Sequelize[_0x4aa0('0x5')]},'idField':{'type':Sequelize[_0x4aa0('0x5')]},'nameField':{'type':Sequelize[_0x4aa0('0x5')]},'customField':{'type':Sequelize[_0x4aa0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 77bbaec..835dd74 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 _0x960c=['set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','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','sendStatus','status','offset','undefined','limit','count'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x960c,0x113));var _0xc960=function(_0x5de8c7,_0x498fa3){_0x5de8c7=_0x5de8c7-0x0;var _0x1611af=_0x960c[_0x5de8c7];return _0x1611af;};'use strict';var emlformat=require(_0xc960('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc960('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc960('0x2'));var moment=require(_0xc960('0x3'));var BPromise=require(_0xc960('0x4'));var Mustache=require('mustache');var util=require(_0xc960('0x5'));var path=require(_0xc960('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc960('0x7'));var fs=require('fs');var fs_extra=require(_0xc960('0x8'));var _=require(_0xc960('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc960('0xa'));var deskjs=require(_0xc960('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc960('0xc'));var Redis=require(_0xc960('0xd'));var authService=require(_0xc960('0xe'));var qs=require(_0xc960('0xf'));var as=require(_0xc960('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc960('0x11'))(_0xc960('0x12'));var utils=require(_0xc960('0x13'));var config=require(_0xc960('0x14'));var licenseUtil=require(_0xc960('0x15'));var db=require(_0xc960('0x16'))['db'];function respondWithStatusCode(_0x371361,_0x25cbcc){_0x25cbcc=_0x25cbcc||0xcc;return function(_0x25e805){if(_0x25e805){return _0x371361[_0xc960('0x17')](_0x25cbcc);}return _0x371361[_0xc960('0x18')](_0x25cbcc)['end']();};}function respondWithResult(_0x3a6e2c,_0x2e6f0e){_0x2e6f0e=_0x2e6f0e||0xc8;return function(_0x427c4d){if(_0x427c4d){return _0x3a6e2c[_0xc960('0x18')](_0x2e6f0e)['json'](_0x427c4d);}};}function respondWithFilteredResult(_0x1fb9fe,_0x49326c){return function(_0x195ff0){if(_0x195ff0){var _0x43cd5a=typeof _0x49326c[_0xc960('0x19')]===_0xc960('0x1a')&&typeof _0x49326c[_0xc960('0x1b')]===_0xc960('0x1a');var _0x32e2f5=_0x195ff0[_0xc960('0x1c')];var _0x34ccf1=_0x43cd5a?0x0:_0x49326c[_0xc960('0x19')];var _0x3462c5=_0x43cd5a?_0x195ff0[_0xc960('0x1c')]:_0x49326c[_0xc960('0x19')]+_0x49326c['limit'];var _0x6ad87d;if(_0x3462c5>=_0x32e2f5){_0x3462c5=_0x32e2f5;_0x6ad87d=0xc8;}else{_0x6ad87d=0xce;}_0x1fb9fe[_0xc960('0x18')](_0x6ad87d);return _0x1fb9fe[_0xc960('0x1d')](_0xc960('0x1e'),_0x34ccf1+'-'+_0x3462c5+'/'+_0x32e2f5)[_0xc960('0x1f')](_0x195ff0);}return null;};}function patchUpdates(_0x5e0536){return function(_0x3b4b5c){try{jsonpatch[_0xc960('0x20')](_0x3b4b5c,_0x5e0536,!![]);}catch(_0x232375){return BPromise[_0xc960('0x21')](_0x232375);}return _0x3b4b5c[_0xc960('0x22')]();};}function saveUpdates(_0x881df5,_0x309885){return function(_0x3770de){if(_0x3770de){return _0x3770de[_0xc960('0x23')](_0x881df5)['then'](function(_0x5671f2){return _0x5671f2;});}return null;};}function removeEntity(_0x9cf5e8,_0x536ed4){return function(_0x8dbf09){if(_0x8dbf09){return _0x8dbf09[_0xc960('0x24')]()[_0xc960('0x25')](function(){_0x9cf5e8[_0xc960('0x18')](0xcc)[_0xc960('0x26')]();});}};}function handleEntityNotFound(_0x43c5aa,_0xc14cb6){return function(_0x3458f4){if(!_0x3458f4){_0x43c5aa[_0xc960('0x17')](0x194);}return _0x3458f4;};}function handleError(_0x540390,_0x56a6d5){_0x56a6d5=_0x56a6d5||0x1f4;return function(_0x274481){logger[_0xc960('0x27')](_0x274481[_0xc960('0x28')]);if(_0x274481[_0xc960('0x29')]){delete _0x274481[_0xc960('0x29')];}_0x540390[_0xc960('0x18')](_0x56a6d5)[_0xc960('0x2a')](_0x274481);};}exports[_0xc960('0x2b')]=function(_0x5b42c4,_0x5ce276){var _0x535275={},_0x1f6212={},_0x49079a={'count':0x0,'rows':[]};var _0x478024=_[_0xc960('0x2c')](db['DeskField']['rawAttributes'],function(_0x2accff){return{'name':_0x2accff[_0xc960('0x2d')],'type':_0x2accff[_0xc960('0x2e')][_0xc960('0x2f')]};});_0x1f6212[_0xc960('0x30')]=_['map'](_0x478024,_0xc960('0x29'));_0x1f6212[_0xc960('0x31')]=_[_0xc960('0x32')](_0x5b42c4['query']);_0x1f6212[_0xc960('0x33')]=_['intersection'](_0x1f6212[_0xc960('0x30')],_0x1f6212['query']);_0x535275[_0xc960('0x34')]=_[_0xc960('0x35')](_0x1f6212[_0xc960('0x30')],qs[_0xc960('0x36')](_0x5b42c4[_0xc960('0x31')][_0xc960('0x36')]));_0x535275[_0xc960('0x34')]=_0x535275['attributes']['length']?_0x535275[_0xc960('0x34')]:_0x1f6212[_0xc960('0x30')];if(!_0x5b42c4[_0xc960('0x31')][_0xc960('0x37')]('nolimit')){_0x535275[_0xc960('0x1b')]=qs[_0xc960('0x1b')](_0x5b42c4[_0xc960('0x31')][_0xc960('0x1b')]);_0x535275[_0xc960('0x19')]=qs[_0xc960('0x19')](_0x5b42c4[_0xc960('0x31')][_0xc960('0x19')]);}_0x535275[_0xc960('0x38')]=qs[_0xc960('0x39')](_0x5b42c4[_0xc960('0x31')]['sort']);_0x535275['where']=qs[_0xc960('0x33')](_[_0xc960('0x3a')](_0x5b42c4[_0xc960('0x31')],_0x1f6212[_0xc960('0x33')]),_0x478024);if(_0x5b42c4[_0xc960('0x31')][_0xc960('0x3b')]){_0x535275['where']=_[_0xc960('0x3c')](_0x535275['where'],{'$or':_[_0xc960('0x2c')](_0x478024,function(_0x29ae2d){if(_0x29ae2d[_0xc960('0x2e')]!==_0xc960('0x3d')){var _0x141235={};_0x141235[_0x29ae2d[_0xc960('0x29')]]={'$like':'%'+_0x5b42c4[_0xc960('0x31')]['filter']+'%'};return _0x141235;}})});}_0x535275=_[_0xc960('0x3c')]({},_0x535275,_0x5b42c4[_0xc960('0x3e')]);var _0x123edc={'where':_0x535275['where']};return db[_0xc960('0x3f')]['count'](_0x123edc)[_0xc960('0x25')](function(_0x65a99f){_0x49079a[_0xc960('0x1c')]=_0x65a99f;if(_0x5b42c4['query'][_0xc960('0x40')]){_0x535275[_0xc960('0x41')]=[{'all':!![]}];}return db[_0xc960('0x3f')][_0xc960('0x42')](_0x535275);})[_0xc960('0x25')](function(_0x1ce91c){_0x49079a[_0xc960('0x43')]=_0x1ce91c;return _0x49079a;})[_0xc960('0x25')](respondWithFilteredResult(_0x5ce276,_0x535275))['catch'](handleError(_0x5ce276,null));};exports[_0xc960('0x44')]=function(_0xd94ad7,_0x2798ef){var _0x3f2e72={'raw':!![],'where':{'id':_0xd94ad7[_0xc960('0x45')]['id']}},_0xf8b2b={};_0xf8b2b[_0xc960('0x30')]=_[_0xc960('0x32')](db[_0xc960('0x3f')][_0xc960('0x46')]);_0xf8b2b[_0xc960('0x31')]=_[_0xc960('0x32')](_0xd94ad7['query']);_0xf8b2b[_0xc960('0x33')]=_[_0xc960('0x35')](_0xf8b2b[_0xc960('0x30')],_0xf8b2b[_0xc960('0x31')]);_0x3f2e72[_0xc960('0x34')]=_[_0xc960('0x35')](_0xf8b2b[_0xc960('0x30')],qs['fields'](_0xd94ad7[_0xc960('0x31')][_0xc960('0x36')]));_0x3f2e72[_0xc960('0x34')]=_0x3f2e72['attributes'][_0xc960('0x47')]?_0x3f2e72[_0xc960('0x34')]:_0xf8b2b[_0xc960('0x30')];if(_0xd94ad7['query']['includeAll']){_0x3f2e72['include']=[{'all':!![]}];}_0x3f2e72=_[_0xc960('0x3c')]({},_0x3f2e72,_0xd94ad7[_0xc960('0x3e')]);return db[_0xc960('0x3f')][_0xc960('0x48')](_0x3f2e72)[_0xc960('0x25')](handleEntityNotFound(_0x2798ef,null))[_0xc960('0x25')](respondWithResult(_0x2798ef,null))[_0xc960('0x49')](handleError(_0x2798ef,null));};exports['create']=function(_0x241949,_0x460e98){return db[_0xc960('0x3f')][_0xc960('0x4a')](_0x241949[_0xc960('0x4b')],{})[_0xc960('0x25')](respondWithResult(_0x460e98,0xc9))['catch'](handleError(_0x460e98,null));};exports['update']=function(_0x2ec45b,_0x232479){if(_0x2ec45b['body']['id']){delete _0x2ec45b['body']['id'];}return db[_0xc960('0x3f')][_0xc960('0x48')]({'where':{'id':_0x2ec45b[_0xc960('0x45')]['id']}})['then'](handleEntityNotFound(_0x232479,null))[_0xc960('0x25')](saveUpdates(_0x2ec45b[_0xc960('0x4b')],null))[_0xc960('0x25')](respondWithResult(_0x232479,null))[_0xc960('0x49')](handleError(_0x232479,null));};exports[_0xc960('0x24')]=function(_0x3458c6,_0x11ecee){return db[_0xc960('0x3f')][_0xc960('0x48')]({'where':{'id':_0x3458c6[_0xc960('0x45')]['id']}})[_0xc960('0x25')](handleEntityNotFound(_0x11ecee,null))[_0xc960('0x25')](removeEntity(_0x11ecee,null))[_0xc960('0x49')](handleError(_0x11ecee,null));}; \ No newline at end of file +var _0xc891=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','name','send','DeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','params','create','body','find','catch','destroy','eml-format','fast-json-patch'];(function(_0x46848e,_0xe1b792){var _0x3fcfcb=function(_0x2777dd){while(--_0x2777dd){_0x46848e['push'](_0x46848e['shift']());}};_0x3fcfcb(++_0xe1b792);}(_0xc891,0x152));var _0x1c89=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc891[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x1c89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c89('0x1'));var rp=require('request-promise');var moment=require(_0x1c89('0x2'));var BPromise=require(_0x1c89('0x3'));var Mustache=require(_0x1c89('0x4'));var util=require('util');var path=require(_0x1c89('0x5'));var sox=require(_0x1c89('0x6'));var csv=require(_0x1c89('0x7'));var ejs=require(_0x1c89('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c89('0x9'));var squel=require(_0x1c89('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c89('0xb'));var deskjs=require(_0x1c89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1c89('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c89('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c89('0xf'))('api');var utils=require(_0x1c89('0x10'));var config=require(_0x1c89('0x11'));var licenseUtil=require(_0x1c89('0x12'));var db=require(_0x1c89('0x13'))['db'];function respondWithStatusCode(_0x7a4a2b,_0x27e7c0){_0x27e7c0=_0x27e7c0||0xcc;return function(_0x393b5f){if(_0x393b5f){return _0x7a4a2b[_0x1c89('0x14')](_0x27e7c0);}return _0x7a4a2b['status'](_0x27e7c0)[_0x1c89('0x15')]();};}function respondWithResult(_0x514e4d,_0x46be15){_0x46be15=_0x46be15||0xc8;return function(_0x424651){if(_0x424651){return _0x514e4d[_0x1c89('0x16')](_0x46be15)['json'](_0x424651);}};}function respondWithFilteredResult(_0x45354d,_0x29602e){return function(_0x2c9572){if(_0x2c9572){var _0x4af31b=typeof _0x29602e[_0x1c89('0x17')]===_0x1c89('0x18')&&typeof _0x29602e[_0x1c89('0x19')]===_0x1c89('0x18');var _0x33afcf=_0x2c9572[_0x1c89('0x1a')];var _0x2cb186=_0x4af31b?0x0:_0x29602e[_0x1c89('0x17')];var _0x166444=_0x4af31b?_0x2c9572[_0x1c89('0x1a')]:_0x29602e[_0x1c89('0x17')]+_0x29602e['limit'];var _0x18ce93;if(_0x166444>=_0x33afcf){_0x166444=_0x33afcf;_0x18ce93=0xc8;}else{_0x18ce93=0xce;}_0x45354d[_0x1c89('0x16')](_0x18ce93);return _0x45354d['set'](_0x1c89('0x1b'),_0x2cb186+'-'+_0x166444+'/'+_0x33afcf)[_0x1c89('0x1c')](_0x2c9572);}return null;};}function patchUpdates(_0x14121c){return function(_0x43a17a){try{jsonpatch['apply'](_0x43a17a,_0x14121c,!![]);}catch(_0x4ef155){return BPromise[_0x1c89('0x1d')](_0x4ef155);}return _0x43a17a[_0x1c89('0x1e')]();};}function saveUpdates(_0x253e07,_0x23def1){return function(_0x5b4fbc){if(_0x5b4fbc){return _0x5b4fbc[_0x1c89('0x1f')](_0x253e07)[_0x1c89('0x20')](function(_0x4fbd33){return _0x4fbd33;});}return null;};}function removeEntity(_0x45f604,_0x26a1cc){return function(_0x1ac0cc){if(_0x1ac0cc){return _0x1ac0cc['destroy']()[_0x1c89('0x20')](function(){_0x45f604[_0x1c89('0x16')](0xcc)[_0x1c89('0x15')]();});}};}function handleEntityNotFound(_0x59a87e,_0x22afe9){return function(_0x49f69b){if(!_0x49f69b){_0x59a87e['sendStatus'](0x194);}return _0x49f69b;};}function handleError(_0x35cc05,_0x352449){_0x352449=_0x352449||0x1f4;return function(_0x4c4694){logger['error'](_0x4c4694['stack']);if(_0x4c4694[_0x1c89('0x21')]){delete _0x4c4694['name'];}_0x35cc05['status'](_0x352449)[_0x1c89('0x22')](_0x4c4694);};}exports['index']=function(_0x193d8d,_0x51aa70){var _0x4dac46={},_0x25500d={},_0x10dc12={'count':0x0,'rows':[]};var _0x14f7cb=_['map'](db[_0x1c89('0x23')][_0x1c89('0x24')],function(_0x487916){return{'name':_0x487916[_0x1c89('0x25')],'type':_0x487916['type'][_0x1c89('0x26')]};});_0x25500d[_0x1c89('0x27')]=_[_0x1c89('0x28')](_0x14f7cb,_0x1c89('0x21'));_0x25500d[_0x1c89('0x29')]=_[_0x1c89('0x2a')](_0x193d8d[_0x1c89('0x29')]);_0x25500d[_0x1c89('0x2b')]=_[_0x1c89('0x2c')](_0x25500d[_0x1c89('0x27')],_0x25500d['query']);_0x4dac46[_0x1c89('0x2d')]=_['intersection'](_0x25500d['model'],qs[_0x1c89('0x2e')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x4dac46[_0x1c89('0x2d')]=_0x4dac46[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x4dac46[_0x1c89('0x2d')]:_0x25500d[_0x1c89('0x27')];if(!_0x193d8d[_0x1c89('0x29')][_0x1c89('0x30')](_0x1c89('0x31'))){_0x4dac46['limit']=qs['limit'](_0x193d8d[_0x1c89('0x29')]['limit']);_0x4dac46['offset']=qs[_0x1c89('0x17')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x17')]);}_0x4dac46[_0x1c89('0x32')]=qs[_0x1c89('0x33')](_0x193d8d[_0x1c89('0x29')][_0x1c89('0x33')]);_0x4dac46['where']=qs[_0x1c89('0x2b')](_[_0x1c89('0x34')](_0x193d8d['query'],_0x25500d[_0x1c89('0x2b')]),_0x14f7cb);if(_0x193d8d[_0x1c89('0x29')][_0x1c89('0x35')]){_0x4dac46[_0x1c89('0x36')]=_[_0x1c89('0x37')](_0x4dac46['where'],{'$or':_[_0x1c89('0x28')](_0x14f7cb,function(_0x2e6ebd){if(_0x2e6ebd[_0x1c89('0x38')]!=='VIRTUAL'){var _0xed5122={};_0xed5122[_0x2e6ebd['name']]={'$like':'%'+_0x193d8d[_0x1c89('0x29')]['filter']+'%'};return _0xed5122;}})});}_0x4dac46=_[_0x1c89('0x37')]({},_0x4dac46,_0x193d8d[_0x1c89('0x39')]);var _0x45152f={'where':_0x4dac46[_0x1c89('0x36')]};return db[_0x1c89('0x23')][_0x1c89('0x1a')](_0x45152f)[_0x1c89('0x20')](function(_0x1b8566){_0x10dc12[_0x1c89('0x1a')]=_0x1b8566;if(_0x193d8d['query'][_0x1c89('0x3a')]){_0x4dac46[_0x1c89('0x3b')]=[{'all':!![]}];}return db[_0x1c89('0x23')][_0x1c89('0x3c')](_0x4dac46);})['then'](function(_0x36e3a7){_0x10dc12[_0x1c89('0x3d')]=_0x36e3a7;return _0x10dc12;})[_0x1c89('0x20')](respondWithFilteredResult(_0x51aa70,_0x4dac46))['catch'](handleError(_0x51aa70,null));};exports['show']=function(_0xa1d4bb,_0x21fa5c){var _0x5f33c0={'raw':!![],'where':{'id':_0xa1d4bb[_0x1c89('0x3e')]['id']}},_0xebb4c3={};_0xebb4c3[_0x1c89('0x27')]=_[_0x1c89('0x2a')](db[_0x1c89('0x23')][_0x1c89('0x24')]);_0xebb4c3[_0x1c89('0x29')]=_['keys'](_0xa1d4bb[_0x1c89('0x29')]);_0xebb4c3['filters']=_['intersection'](_0xebb4c3[_0x1c89('0x27')],_0xebb4c3[_0x1c89('0x29')]);_0x5f33c0[_0x1c89('0x2d')]=_[_0x1c89('0x2c')](_0xebb4c3[_0x1c89('0x27')],qs[_0x1c89('0x2e')](_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x2e')]));_0x5f33c0[_0x1c89('0x2d')]=_0x5f33c0[_0x1c89('0x2d')][_0x1c89('0x2f')]?_0x5f33c0[_0x1c89('0x2d')]:_0xebb4c3[_0x1c89('0x27')];if(_0xa1d4bb[_0x1c89('0x29')][_0x1c89('0x3a')]){_0x5f33c0[_0x1c89('0x3b')]=[{'all':!![]}];}_0x5f33c0=_['merge']({},_0x5f33c0,_0xa1d4bb[_0x1c89('0x39')]);return db['DeskField']['find'](_0x5f33c0)[_0x1c89('0x20')](handleEntityNotFound(_0x21fa5c,null))['then'](respondWithResult(_0x21fa5c,null))['catch'](handleError(_0x21fa5c,null));};exports[_0x1c89('0x3f')]=function(_0x4b4d3f,_0x5f102d){return db['DeskField'][_0x1c89('0x3f')](_0x4b4d3f['body'],{})[_0x1c89('0x20')](respondWithResult(_0x5f102d,0xc9))['catch'](handleError(_0x5f102d,null));};exports[_0x1c89('0x1f')]=function(_0x5114bb,_0x36d5fc){if(_0x5114bb[_0x1c89('0x40')]['id']){delete _0x5114bb[_0x1c89('0x40')]['id'];}return db['DeskField'][_0x1c89('0x41')]({'where':{'id':_0x5114bb[_0x1c89('0x3e')]['id']}})['then'](handleEntityNotFound(_0x36d5fc,null))['then'](saveUpdates(_0x5114bb[_0x1c89('0x40')],null))[_0x1c89('0x20')](respondWithResult(_0x36d5fc,null))[_0x1c89('0x42')](handleError(_0x36d5fc,null));};exports[_0x1c89('0x43')]=function(_0x94f616,_0x392fdb){return db[_0x1c89('0x23')][_0x1c89('0x41')]({'where':{'id':_0x94f616[_0x1c89('0x3e')]['id']}})[_0x1c89('0x20')](handleEntityNotFound(_0x392fdb,null))[_0x1c89('0x20')](removeEntity(_0x392fdb,null))[_0x1c89('0x42')](handleError(_0x392fdb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 89555eb..08c8b4e 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 _0x4d2e=['../../config/logger','api','moment','bluebird','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util'];(function(_0x4a04f3,_0x2fff74){var _0x1b0686=function(_0xfa3eb){while(--_0xfa3eb){_0x4a04f3['push'](_0x4a04f3['shift']());}};_0x1b0686(++_0x2fff74);}(_0x4d2e,0x110));var _0xe4d2=function(_0x5f27f2,_0x1448f0){_0x5f27f2=_0x5f27f2-0x0;var _0x8817d7=_0x4d2e[_0x5f27f2];return _0x8817d7;};'use strict';var _=require('lodash');var util=require(_0xe4d2('0x0'));var logger=require(_0xe4d2('0x1'))(_0xe4d2('0x2'));var moment=require(_0xe4d2('0x3'));var BPromise=require(_0xe4d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe4d2('0x5'));var attributes=require('./intDeskField.attributes');module[_0xe4d2('0x6')]=function(_0x3de4cd,_0x2c0cb8){return _0x3de4cd[_0xe4d2('0x7')](_0xe4d2('0x8'),attributes,{'tableName':_0xe4d2('0x9'),'paranoid':![],'indexes':[{'name':_0xe4d2('0xa'),'fields':[_0xe4d2('0xb'),_0xe4d2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92ba=['int_desk_fields','idField','FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','DeskField'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x92ba,0x6b));var _0xa92b=function(_0x5f5036,_0x23289b){_0x5f5036=_0x5f5036-0x0;var _0x2140f7=_0x92ba[_0x5f5036];return _0x2140f7;};'use strict';var _=require(_0xa92b('0x0'));var util=require('util');var logger=require(_0xa92b('0x1'))('api');var moment=require(_0xa92b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa92b('0x3'));var fs=require('fs');var path=require(_0xa92b('0x4'));var rimraf=require(_0xa92b('0x5'));var config=require(_0xa92b('0x6'));var attributes=require('./intDeskField.attributes');module[_0xa92b('0x7')]=function(_0x49f103,_0x4870e1){return _0x49f103[_0xa92b('0x8')](_0xa92b('0x9'),attributes,{'tableName':_0xa92b('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xa92b('0xb'),_0xa92b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4ba230e..240c978 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 _0x53ee=['client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x211a82,_0x17f675){var _0x14932f=function(_0x4245e1){while(--_0x4245e1){_0x211a82['push'](_0x211a82['shift']());}};_0x14932f(++_0x17f675);}(_0x53ee,0x1af));var _0xe53e=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x53ee[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe53e('0x0'));var BPromise=require(_0xe53e('0x1'));var rs=require(_0xe53e('0x2'));var fs=require('fs');var Redis=require(_0xe53e('0x3'));var db=require(_0xe53e('0x4'))['db'];var utils=require(_0xe53e('0x5'));var logger=require(_0xe53e('0x6'))(_0xe53e('0x7'));var config=require('../../config/environment');var jayson=require(_0xe53e('0x8'));var client=jayson[_0xe53e('0x9')][_0xe53e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47459e,_0x11376c,_0x55da57){return new BPromise(function(_0x375f1f,_0x42669d){return client[_0xe53e('0xb')](_0x47459e,_0x55da57)[_0xe53e('0xc')](function(_0xa1ef16){logger['info'](_0xe53e('0xd'),_0x11376c,_0xe53e('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x11376c,_0xe53e('0xe'),JSON[_0xe53e('0xf')](_0xa1ef16));if(_0xa1ef16[_0xe53e('0x10')]){if(_0xa1ef16[_0xe53e('0x10')][_0xe53e('0x11')]===0x1f4){logger[_0xe53e('0x10')]('DeskField,\x20%s,\x20%s',_0x11376c,_0xa1ef16['error']['message']);return _0x42669d(_0xa1ef16['error'][_0xe53e('0x12')]);}logger['error'](_0xe53e('0xd'),_0x11376c,_0xa1ef16[_0xe53e('0x10')][_0xe53e('0x12')]);return _0x375f1f(_0xa1ef16['error'][_0xe53e('0x12')]);}else{logger[_0xe53e('0x13')](_0xe53e('0xd'),_0x11376c,_0xe53e('0xe'));_0x375f1f(_0xa1ef16[_0xe53e('0x14')]['message']);}})[_0xe53e('0x15')](function(_0x4f2176){logger[_0xe53e('0x10')]('DeskField,\x20%s,\x20%s',_0x11376c,_0x4f2176);_0x42669d(_0x4f2176);});});} \ No newline at end of file +var _0xeb16=['../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0xe1370a,_0x4a7df6){var _0x5e6a5a=function(_0x119fcb){while(--_0x119fcb){_0xe1370a['push'](_0xe1370a['shift']());}};_0x5e6a5a(++_0x4a7df6);}(_0xeb16,0xfe));var _0x6eb1=function(_0x1cb073,_0x4c8a52){_0x1cb073=_0x1cb073-0x0;var _0x1fd148=_0xeb16[_0x1cb073];return _0x1fd148;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6eb1('0x0'));var BPromise=require(_0x6eb1('0x1'));var rs=require(_0x6eb1('0x2'));var fs=require('fs');var Redis=require(_0x6eb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6eb1('0x4'));var logger=require('../../config/logger')(_0x6eb1('0x5'));var config=require(_0x6eb1('0x6'));var jayson=require(_0x6eb1('0x7'));var client=jayson[_0x6eb1('0x8')][_0x6eb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a742,_0x14979e,_0x46fe0b){return new BPromise(function(_0x16d235,_0x5e1970){return client[_0x6eb1('0xa')](_0x32a742,_0x46fe0b)[_0x6eb1('0xb')](function(_0xbe5c50){logger['info'](_0x6eb1('0xc'),_0x14979e,_0x6eb1('0xd'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x14979e,'request\x20sent',JSON[_0x6eb1('0xe')](_0xbe5c50));if(_0xbe5c50['error']){if(_0xbe5c50[_0x6eb1('0xf')][_0x6eb1('0x10')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x14979e,_0xbe5c50['error'][_0x6eb1('0x11')]);return _0x5e1970(_0xbe5c50[_0x6eb1('0xf')][_0x6eb1('0x11')]);}logger['error'](_0x6eb1('0xc'),_0x14979e,_0xbe5c50[_0x6eb1('0xf')][_0x6eb1('0x11')]);return _0x16d235(_0xbe5c50[_0x6eb1('0xf')][_0x6eb1('0x11')]);}else{logger['info'](_0x6eb1('0xc'),_0x14979e,_0x6eb1('0xd'));_0x16d235(_0xbe5c50[_0x6eb1('0x12')]['message']);}})[_0x6eb1('0x13')](function(_0x818a8a){logger[_0x6eb1('0xf')](_0x6eb1('0xc'),_0x14979e,_0x818a8a);_0x5e1970(_0x818a8a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a050ad9..ce27f09 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 _0x5885=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0x5885,0x198));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5588('0x0'));var util=require(_0x5588('0x1'));var path=require('path');var timeout=require(_0x5588('0x2'));var express=require(_0x5588('0x3'));var router=express[_0x5588('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5588('0x5'));var interaction=require(_0x5588('0x6'));var config=require('../../config/environment');var controller=require(_0x5588('0x7'));router['get']('/',auth[_0x5588('0x8')](),controller[_0x5588('0x9')]);router[_0x5588('0xa')](_0x5588('0xb'),auth[_0x5588('0x8')](),controller[_0x5588('0xc')]);router[_0x5588('0xa')](_0x5588('0xd'),auth[_0x5588('0x8')](),controller[_0x5588('0xe')]);router[_0x5588('0xa')](_0x5588('0xf'),auth[_0x5588('0x8')](),controller[_0x5588('0x10')]);router['post']('/',auth[_0x5588('0x8')](),controller[_0x5588('0x11')]);router[_0x5588('0x12')](_0x5588('0xd'),auth[_0x5588('0x8')](),controller[_0x5588('0x13')]);router['put'](_0x5588('0xb'),auth['isAuthenticated'](),controller[_0x5588('0x14')]);router[_0x5588('0x15')](_0x5588('0xb'),auth[_0x5588('0x8')](),controller[_0x5588('0x16')]);module[_0x5588('0x17')]=router; \ No newline at end of file +var _0xbfdd=['../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','put','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4489ce,_0x34237b){var _0x3a2d83=function(_0x132ebd){while(--_0x132ebd){_0x4489ce['push'](_0x4489ce['shift']());}};_0x3a2d83(++_0x34237b);}(_0xbfdd,0xfd));var _0xdbfd=function(_0x364e2b,_0x30b028){_0x364e2b=_0x364e2b-0x0;var _0x943fef=_0xbfdd[_0x364e2b];return _0x943fef;};'use strict';var multer=require(_0xdbfd('0x0'));var util=require('util');var path=require(_0xdbfd('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbfd('0x2'));var router=express[_0xdbfd('0x3')]();var fs_extra=require(_0xdbfd('0x4'));var auth=require(_0xdbfd('0x5'));var interaction=require(_0xdbfd('0x6'));var config=require(_0xdbfd('0x7'));var controller=require(_0xdbfd('0x8'));router['get']('/',auth[_0xdbfd('0x9')](),controller[_0xdbfd('0xa')]);router[_0xdbfd('0xb')](_0xdbfd('0xc'),auth['isAuthenticated'](),controller[_0xdbfd('0xd')]);router['get'](_0xdbfd('0xe'),auth['isAuthenticated'](),controller[_0xdbfd('0xf')]);router['get'](_0xdbfd('0x10'),auth[_0xdbfd('0x9')](),controller['getFields']);router[_0xdbfd('0x11')]('/',auth[_0xdbfd('0x9')](),controller['create']);router[_0xdbfd('0x11')](_0xdbfd('0xe'),auth[_0xdbfd('0x9')](),controller['addConfiguration']);router[_0xdbfd('0x12')]('/:id',auth[_0xdbfd('0x9')](),controller['update']);router[_0xdbfd('0x13')](_0xdbfd('0xc'),auth[_0xdbfd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ed8304f..e71c385 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 _0x38e4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e6452,_0x228b08){var _0x1459ba=function(_0x2c20ef){while(--_0x2c20ef){_0x4e6452['push'](_0x4e6452['shift']());}};_0x1459ba(++_0x228b08);}(_0x38e4,0x9e));var _0x438e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x38e4[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x438e('0x0'));module[_0x438e('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x438e('0x2')]},'password':{'type':Sequelize[_0x438e('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x438e('0x2')]},'clientId':{'type':Sequelize[_0x438e('0x2')]},'clientSecret':{'type':Sequelize[_0x438e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x438e('0x2')]},'modernAuthentication':{'type':Sequelize[_0x438e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc21e=['STRING','BOOLEAN','exports'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xec21('0x0')]={'name':{'type':Sequelize[_0xec21('0x1')]},'username':{'type':Sequelize[_0xec21('0x1')]},'password':{'type':Sequelize[_0xec21('0x1')]},'remoteUri':{'type':Sequelize[_0xec21('0x1')]},'tenantId':{'type':Sequelize[_0xec21('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xec21('0x1')]},'serverUrl':{'type':Sequelize[_0xec21('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xec21('0x1')]},'modernAuthentication':{'type':Sequelize[_0xec21('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 62e4255..509a74d 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 _0x7a77=['slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','push','all','forEach','isNil','BooleanAttributeMetadata','substring','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','Content-Range','update','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue'];(function(_0x3ea935,_0x13a566){var _0x55c782=function(_0x107d0e){while(--_0x107d0e){_0x3ea935['push'](_0x3ea935['shift']());}};_0x55c782(++_0x13a566);}(_0x7a77,0x1c3));var _0x77a7=function(_0xe87b40,_0x2120f3){_0xe87b40=_0xe87b40-0x0;var _0x4970f8=_0x7a77[_0xe87b40];return _0x4970f8;};'use strict';var rp=require(_0x77a7('0x0'));var util=require(_0x77a7('0x1'));var _=require(_0x77a7('0x2'));var qs=require(_0x77a7('0x3'));var logger=require('../../config/logger')(_0x77a7('0x4'));var db=require(_0x77a7('0x5'))['db'];var integrations=require(_0x77a7('0x6'));function respondWithResult(_0x4bd9a7,_0x247b91){_0x247b91=_0x247b91||0xc8;return function(_0x45a5c0){if(_0x45a5c0){return _0x4bd9a7[_0x77a7('0x7')](_0x247b91)[_0x77a7('0x8')](_0x45a5c0);}};}function respondWithFilteredResult(_0x425669,_0x359bac){return function(_0x1d349c){if(_0x1d349c){var _0x2df3d8=typeof _0x359bac[_0x77a7('0x9')]===_0x77a7('0xa')&&typeof _0x359bac['limit']===_0x77a7('0xa');var _0x42d87d=_0x1d349c[_0x77a7('0xb')];var _0x4d8b3d=_0x2df3d8?0x0:_0x359bac[_0x77a7('0x9')];var _0x5bf561=_0x2df3d8?_0x1d349c[_0x77a7('0xb')]:_0x359bac[_0x77a7('0x9')]+_0x359bac['limit'];var _0x262580;if(_0x5bf561>=_0x42d87d){_0x5bf561=_0x42d87d;_0x262580=0xc8;}else{_0x262580=0xce;}_0x425669['status'](_0x262580);return _0x425669['set'](_0x77a7('0xc'),_0x4d8b3d+'-'+_0x5bf561+'/'+_0x42d87d)[_0x77a7('0x8')](_0x1d349c);}return null;};}function saveUpdates(_0x601eef){return function(_0x6f5703){if(_0x6f5703){return _0x6f5703[_0x77a7('0xd')](_0x601eef)['then'](function(_0x1e556e){return _0x1e556e;});}return null;};}function removeEntity(_0x468345){return function(_0x431fbf){if(_0x431fbf){return _0x431fbf[_0x77a7('0xe')]()['then'](function(){_0x468345[_0x77a7('0x7')](0xcc)[_0x77a7('0xf')]();});}};}function handleEntityNotFound(_0x3a7ad4){return function(_0x1bd2bd){if(!_0x1bd2bd){_0x3a7ad4['sendStatus'](0x194);}return _0x1bd2bd;};}function handleError(_0x691982,_0x5e470c){_0x5e470c=_0x5e470c||0x1f4;return function(_0x41b7c9){logger[_0x77a7('0x10')](_0x41b7c9[_0x77a7('0x11')]);if(_0x41b7c9[_0x77a7('0x12')]){delete _0x41b7c9['name'];}_0x691982[_0x77a7('0x7')](_0x5e470c)[_0x77a7('0x13')](_0x41b7c9);};}exports[_0x77a7('0x14')]=function(_0x262a39,_0x5a3d66){var _0x149dda={},_0x407f13={},_0x552f1f={'count':0x0,'rows':[]};var _0x4c8f22=_[_0x77a7('0x15')](db[_0x77a7('0x16')][_0x77a7('0x17')],function(_0x349c3a){return{'name':_0x349c3a[_0x77a7('0x18')],'type':_0x349c3a[_0x77a7('0x19')][_0x77a7('0x1a')]};});_0x407f13['model']=_[_0x77a7('0x15')](_0x4c8f22,_0x77a7('0x12'));_0x407f13[_0x77a7('0x1b')]=_[_0x77a7('0x1c')](_0x262a39[_0x77a7('0x1b')]);_0x407f13[_0x77a7('0x1d')]=_[_0x77a7('0x1e')](_0x407f13['model'],_0x407f13['query']);_0x149dda[_0x77a7('0x1f')]=_[_0x77a7('0x1e')](_0x407f13['model'],qs[_0x77a7('0x20')](_0x262a39[_0x77a7('0x1b')][_0x77a7('0x20')]));_0x149dda[_0x77a7('0x1f')]=_0x149dda['attributes'][_0x77a7('0x21')]?_0x149dda['attributes']:_0x407f13[_0x77a7('0x22')];if(!_0x262a39[_0x77a7('0x1b')][_0x77a7('0x23')](_0x77a7('0x24'))){_0x149dda['limit']=qs['limit'](_0x262a39['query'][_0x77a7('0x25')]);_0x149dda[_0x77a7('0x9')]=qs[_0x77a7('0x9')](_0x262a39[_0x77a7('0x1b')][_0x77a7('0x9')]);}_0x149dda[_0x77a7('0x26')]=qs[_0x77a7('0x27')](_0x262a39[_0x77a7('0x1b')][_0x77a7('0x27')]);_0x149dda[_0x77a7('0x28')]=qs[_0x77a7('0x1d')](_[_0x77a7('0x29')](_0x262a39[_0x77a7('0x1b')],_0x407f13[_0x77a7('0x1d')]),_0x4c8f22);if(_0x262a39[_0x77a7('0x1b')][_0x77a7('0x2a')]){_0x149dda[_0x77a7('0x28')]=_[_0x77a7('0x2b')](_0x149dda[_0x77a7('0x28')],{'$or':_[_0x77a7('0x15')](_0x4c8f22,function(_0x541563){if(_0x541563[_0x77a7('0x19')]!==_0x77a7('0x2c')){var _0x5a1d35={};_0x5a1d35[_0x541563[_0x77a7('0x12')]]={'$like':'%'+_0x262a39['query'][_0x77a7('0x2a')]+'%'};return _0x5a1d35;}})});}_0x149dda=_[_0x77a7('0x2b')]({},_0x149dda,_0x262a39['options']);var _0x32d194={'where':_0x149dda['where']};return db['Dynamics365Account']['count'](_0x32d194)[_0x77a7('0x2d')](function(_0xe95232){_0x552f1f[_0x77a7('0xb')]=_0xe95232;if(_0x262a39[_0x77a7('0x1b')]['includeAll']){_0x149dda[_0x77a7('0x2e')]=[{'all':!![]}];}return db[_0x77a7('0x16')][_0x77a7('0x2f')](_0x149dda);})[_0x77a7('0x2d')](function(_0xf9dbf6){_0x552f1f[_0x77a7('0x30')]=_0xf9dbf6;return _0x552f1f;})[_0x77a7('0x2d')](respondWithFilteredResult(_0x5a3d66,_0x149dda))[_0x77a7('0x31')](handleError(_0x5a3d66,null));};exports[_0x77a7('0x32')]=function(_0xeee306,_0x36e287){var _0x43673e={'raw':![],'where':{'id':_0xeee306[_0x77a7('0x33')]['id']}},_0x5e907d={};_0x5e907d['model']=_[_0x77a7('0x1c')](db[_0x77a7('0x16')]['rawAttributes']);_0x5e907d[_0x77a7('0x1b')]=_['keys'](_0xeee306[_0x77a7('0x1b')]);_0x5e907d[_0x77a7('0x1d')]=_['intersection'](_0x5e907d['model'],_0x5e907d[_0x77a7('0x1b')]);_0x43673e[_0x77a7('0x1f')]=_['intersection'](_0x5e907d[_0x77a7('0x22')],qs[_0x77a7('0x20')](_0xeee306['query'][_0x77a7('0x20')]));_0x43673e[_0x77a7('0x1f')]=_0x43673e[_0x77a7('0x1f')][_0x77a7('0x21')]?_0x43673e['attributes']:_0x5e907d['model'];if(_0xeee306['query'][_0x77a7('0x34')]){_0x43673e[_0x77a7('0x2e')]=[{'all':!![]}];}_0x43673e=_[_0x77a7('0x2b')]({},_0x43673e,_0xeee306[_0x77a7('0x35')]);return db[_0x77a7('0x16')][_0x77a7('0x36')](_0x43673e)[_0x77a7('0x2d')](handleEntityNotFound(_0x36e287,null))[_0x77a7('0x2d')](respondWithResult(_0x36e287,null))[_0x77a7('0x31')](handleError(_0x36e287,null));};exports[_0x77a7('0x37')]=function(_0x5b722f,_0x566712){return db['Dynamics365Account'][_0x77a7('0x37')](_0x5b722f['body'],{})[_0x77a7('0x2d')](respondWithResult(_0x566712,0xc9))[_0x77a7('0x31')](handleError(_0x566712,null));};exports[_0x77a7('0xd')]=function(_0x7c903,_0x29ce5c){if(_0x7c903[_0x77a7('0x38')]['id']){delete _0x7c903[_0x77a7('0x38')]['id'];}return db[_0x77a7('0x16')]['find']({'where':{'id':_0x7c903[_0x77a7('0x33')]['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0x29ce5c,null))[_0x77a7('0x2d')](saveUpdates(_0x7c903[_0x77a7('0x38')],null))[_0x77a7('0x2d')](respondWithResult(_0x29ce5c,null))['catch'](handleError(_0x29ce5c,null));};exports['destroy']=function(_0x56e33c,_0xb963ca){return db[_0x77a7('0x16')][_0x77a7('0x36')]({'where':{'id':_0x56e33c['params']['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0xb963ca,null))['then'](removeEntity(_0xb963ca,null))['catch'](handleError(_0xb963ca,null));};exports[_0x77a7('0x39')]=function(_0x322433,_0x5d0405){var _0x572036={};var _0x729a96={};var _0x40cd19;var _0xbb147f;return db[_0x77a7('0x16')][_0x77a7('0x3a')]({'where':{'id':_0x322433[_0x77a7('0x33')]['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0x5d0405,null))['then'](function(_0x4a8e92){if(_0x4a8e92){_0x40cd19=_0x4a8e92;_0x729a96[_0x77a7('0x22')]=_[_0x77a7('0x1c')](db[_0x77a7('0x3b')][_0x77a7('0x17')]);_0x729a96[_0x77a7('0x1b')]=_[_0x77a7('0x1c')](_0x322433[_0x77a7('0x1b')]);_0x729a96['filters']=_[_0x77a7('0x1e')](_0x729a96[_0x77a7('0x22')],_0x729a96[_0x77a7('0x1b')]);_0x572036[_0x77a7('0x1f')]=_[_0x77a7('0x1e')](_0x729a96[_0x77a7('0x22')],qs['fields'](_0x322433[_0x77a7('0x1b')][_0x77a7('0x20')]));_0x572036[_0x77a7('0x1f')]=_0x572036[_0x77a7('0x1f')]['length']?_0x572036['attributes']:_0x729a96[_0x77a7('0x22')];_0x572036[_0x77a7('0x26')]=qs[_0x77a7('0x27')](_0x322433[_0x77a7('0x1b')]['sort']);_0x572036['where']=qs[_0x77a7('0x1d')](_[_0x77a7('0x29')](_0x322433[_0x77a7('0x1b')],_0x729a96['filters']));if(_0x322433[_0x77a7('0x1b')]['filter']){_0x572036[_0x77a7('0x28')]=_[_0x77a7('0x2b')](_0x572036['where'],{'$or':_['map'](_0x572036['attributes'],function(_0x3a559e){var _0x2091d7={};_0x2091d7[_0x3a559e]={'$like':'%'+_0x322433[_0x77a7('0x1b')][_0x77a7('0x2a')]+'%'};return _0x2091d7;})});}_0x572036=_[_0x77a7('0x2b')]({},_0x572036,_0x322433[_0x77a7('0x35')]);return _0x40cd19['getConfigurations'](_0x572036);}})[_0x77a7('0x2d')](function(_0x3d381a){if(_0x3d381a){_0xbb147f=_0x3d381a[_0x77a7('0x21')];if(!_0x322433[_0x77a7('0x1b')]['hasOwnProperty'](_0x77a7('0x24'))){_0x572036['limit']=qs['limit'](_0x322433[_0x77a7('0x1b')]['limit']);_0x572036['offset']=qs[_0x77a7('0x9')](_0x322433['query'][_0x77a7('0x9')]);}return _0x40cd19[_0x77a7('0x39')](_0x572036);}})[_0x77a7('0x2d')](function(_0x295e4a){if(_0x295e4a){return _0x295e4a?{'count':_0xbb147f,'rows':_0x295e4a}:null;}})[_0x77a7('0x2d')](respondWithResult(_0x5d0405,null))[_0x77a7('0x31')](handleError(_0x5d0405,null));};exports[_0x77a7('0x3c')]=function(_0x5c3d35,_0x2a0cd5){if(_0x5c3d35['body']['id']){delete _0x5c3d35[_0x77a7('0x38')]['id'];}return db[_0x77a7('0x16')][_0x77a7('0x3a')]({'where':{'id':_0x5c3d35[_0x77a7('0x33')]['id']}})[_0x77a7('0x2d')](handleEntityNotFound(_0x2a0cd5,null))[_0x77a7('0x2d')](function(_0x4f4430){if(_0x4f4430){_0x5c3d35[_0x77a7('0x38')][_0x77a7('0x3d')]=_0x4f4430['id'];_0x5c3d35[_0x77a7('0x38')]['Subjects']=integrations[_0x77a7('0x3e')](_0x5c3d35[_0x77a7('0x38')]['channel'],_0x5c3d35['body']['type']);_0x5c3d35[_0x77a7('0x38')][_0x77a7('0x3f')]=integrations[_0x77a7('0x40')](_0x5c3d35['body'][_0x77a7('0x41')],_0x5c3d35['body'][_0x77a7('0x19')]);return db[_0x77a7('0x3b')][_0x77a7('0x37')](_0x5c3d35[_0x77a7('0x38')],{'include':[{'model':db[_0x77a7('0x42')],'as':_0x77a7('0x43')},{'model':db['Dynamics365Field'],'as':_0x77a7('0x3f')}]});}return null;})['then'](respondWithResult(_0x2a0cd5,null))[_0x77a7('0x31')](handleError(_0x2a0cd5,null));};function sanitizeRemoteUri(_0x975888){var _0x2b0fca=_0x975888[_0x77a7('0x44')](-0x1);if(_0x2b0fca==='/')return _0x975888['substring'](0x0,_0x975888[_0x77a7('0x45')](_0x2b0fca));return _0x975888;}function getWebApiUrl(_0x2672d9){return util[_0x77a7('0x46')](_0x77a7('0x47'),_0x2672d9);}exports[_0x77a7('0x48')]=function(_0x1e4719,_0x2c28ef){var _0x243077=_0x1e4719[_0x77a7('0x1b')][_0x77a7('0x49')];var _0x1d5931=_0x243077===_0x77a7('0x4a')?_0x77a7('0x4b'):_0x77a7('0x4c');var _0x24dbf0='';var _0x420754='';var _0x3e12dd='';var _0x1d0c90='';var _0x34930a='';var _0x1a9990='';var _0xf63405='';var _0x3ae87f='';var _0x15ca83=['title',_0x77a7('0x4d'),_0x77a7('0x4e'),_0x77a7('0x4f'),_0x77a7('0x50'),'subject',_0x77a7('0x51'),_0x77a7('0x52'),_0x77a7('0x53'),_0x77a7('0x54')];var _0x3445df=[_0x77a7('0x55'),_0x77a7('0x56'),'actualserviceunits','billedserviceunits',_0x77a7('0x57'),'contactidyominame',_0x77a7('0x58'),_0x77a7('0x59'),'createdbyexternalpartyname',_0x77a7('0x5a'),_0x77a7('0x5b'),_0x77a7('0x5c'),_0x77a7('0x5d'),_0x77a7('0x5e'),'createdonbehalfbyyominame',_0x77a7('0x5f'),_0x77a7('0x60'),_0x77a7('0x61'),_0x77a7('0x62'),_0x77a7('0x63'),_0x77a7('0x64'),_0x77a7('0x65'),_0x77a7('0x66'),'exchangerate',_0x77a7('0x67'),_0x77a7('0x68'),'importsequencenumber',_0x77a7('0x69'),_0x77a7('0x6a'),_0x77a7('0x6b'),'masteridname',_0x77a7('0x6c'),'modifiedbyexternalpartyyominame',_0x77a7('0x6d'),'modifiedbyyominame',_0x77a7('0x6e'),_0x77a7('0x6f'),_0x77a7('0x70'),_0x77a7('0x71'),'msdyn_iotalertname',_0x77a7('0x72'),_0x77a7('0x73'),_0x77a7('0x74'),_0x77a7('0x75'),_0x77a7('0x76'),_0x77a7('0x77'),_0x77a7('0x78'),_0x77a7('0x79'),_0x77a7('0x7a'),_0x77a7('0x7b'),_0x77a7('0x7c'),'productserialnumber',_0x77a7('0x7d'),_0x77a7('0x7e'),_0x77a7('0x7f'),_0x77a7('0x80'),_0x77a7('0x81'),_0x77a7('0x82'),'slainvokedidname',_0x77a7('0x83'),'socialprofileidname',_0x77a7('0x84'),_0x77a7('0x85'),_0x77a7('0x86'),_0x77a7('0x87'),_0x77a7('0x88'),_0x77a7('0x89'),'traversedpath',_0x77a7('0x8a'),_0x77a7('0x8b')];var _0x1a6f42=_0x15ca83[_0x77a7('0x8c')](_0x3445df);return db[_0x77a7('0x16')][_0x77a7('0x3a')]({'where':{'id':_0x1e4719[_0x77a7('0x33')]['id']},'attributes':['id',_0x77a7('0x8d'),_0x77a7('0x8e'),_0x77a7('0x8f'),_0x77a7('0x90'),'clientId',_0x77a7('0x91'),_0x77a7('0x92')],'include':[{'model':db[_0x77a7('0x93')],'as':'CloudProvider','attributes':['id',_0x77a7('0x94'),_0x77a7('0x95')]}]})[_0x77a7('0x2d')](handleEntityNotFound(_0x2c28ef,null))['then'](function(_0x6171ba){if(_0x6171ba){if(_0x6171ba[_0x77a7('0x92')]){_0x6171ba[_0x77a7('0x96')]=_0x6171ba['CloudProvider'][_0x77a7('0x94')];_0x3ae87f=sanitizeRemoteUri(_0x6171ba[_0x77a7('0x93')][_0x77a7('0x95')]);_0xf63405=getWebApiUrl(_0x3ae87f);return _0x6171ba;}_0x3ae87f=sanitizeRemoteUri(_0x6171ba[_0x77a7('0x8f')]);_0xf63405=getWebApiUrl(_0x3ae87f);var _0xb292cf={'method':_0x77a7('0x97'),'uri':'https://login.microsoftonline.com/'+_0x6171ba[_0x77a7('0x90')]+_0x77a7('0x98'),'form':{'client_id':_0x6171ba[_0x77a7('0x99')],'resource':_0x3ae87f,'username':_0x6171ba['username'],'password':_0x6171ba['password'],'grant_type':_0x77a7('0x8e'),'client_secret':_0x6171ba['clientSecret']},'json':!![]};return rp(_0xb292cf);}})[_0x77a7('0x2d')](function(_0x33b64f){_0x1a9990=_0x33b64f[_0x77a7('0x96')];var _0x5d6fa5={'method':'GET','uri':encodeURI(_0xf63405+_0x77a7('0x9a')+_0x1d5931+'\x27'),'headers':{'Authorization':_0x77a7('0x9b')+_0x1a9990,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x5d6fa5);})['then'](function(_0x2bc4b3){var _0x5791a2=_0x2bc4b3[_0x77a7('0x9d')][0x0];var _0x16639e=_0x5791a2[_0x77a7('0x9e')];var _0x2bf195={'method':_0x77a7('0x9f'),'uri':_0xf63405+_0x77a7('0xa0')+_0x16639e+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x1a9990,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x2bf195);})[_0x77a7('0x2d')](function(_0x58066d){_0x24dbf0=_0x58066d;_0x420754=_0x24dbf0[_0x77a7('0xa1')];_0x420754=_[_0x77a7('0xa2')](_0x420754,function(_0x9bd285){return!_0x1a6f42[_0x77a7('0xa3')](_0x9bd285[_0x77a7('0xa4')]);});var _0x12f3e0=[];var _0x1a1cf8=[];_0x420754['forEach'](function(_0x97cd62){if(_0x97cd62['@odata.type']){var _0x2ca59b=_0x97cd62[_0x77a7('0xa5')]['substring'](_0x97cd62[_0x77a7('0xa5')][_0x77a7('0x45')]('.')+0x1);if(_0x2ca59b==='PicklistAttributeMetadata'){_0x12f3e0[_0x77a7('0xa6')](getSelectList(_0xf63405,_0x243077,_0x1a1cf8,_0x24dbf0[_0x77a7('0x9e')],_0x97cd62[_0x77a7('0x9e')],_0x1a9990));}}});return Promise[_0x77a7('0xa7')](_0x12f3e0);})[_0x77a7('0x2d')](function(_0x1ec197){_0x3e12dd=_0x1ec197[0x0];var _0x96756c=[];var _0x1be2a7=[];_0x420754[_0x77a7('0xa8')](function(_0x5cf324){if(!_[_0x77a7('0xa9')](_0x5cf324[_0x77a7('0xa5')])){var _0x2d4bd3=_0x5cf324[_0x77a7('0xa5')]['substring'](_0x5cf324[_0x77a7('0xa5')][_0x77a7('0x45')]('.')+0x1);if(_0x2d4bd3===_0x77a7('0xaa')){_0x96756c['push'](getBooleanList(_0xf63405,_0x243077,_0x1be2a7,_0x24dbf0[_0x77a7('0x9e')],_0x5cf324[_0x77a7('0x9e')],_0x1a9990));}}});return Promise[_0x77a7('0xa7')](_0x96756c);})[_0x77a7('0x2d')](function(_0x17a13a){_0x1d0c90=_0x17a13a[0x0];var _0x29f55f=[];var _0x2ab350=[];_0x420754[_0x77a7('0xa8')](function(_0x5d7761){if(_0x5d7761[_0x77a7('0xa5')]){var _0x120e0c=_0x5d7761[_0x77a7('0xa5')][_0x77a7('0xab')](_0x5d7761['@odata.type'][_0x77a7('0x45')]('.')+0x1);if(_0x120e0c===_0x77a7('0xac')||_0x120e0c==='DoubleAttributeMetadata'||_0x120e0c===_0x77a7('0xad')||_0x120e0c===_0x77a7('0xae')||_0x120e0c===_0x77a7('0xaf')||_0x120e0c===_0x77a7('0xb0')||_0x120e0c==='StatusAttributeMetadata'||_0x120e0c===_0x77a7('0xb1')||_0x120e0c===_0x77a7('0xb2')||_0x120e0c==='DecimalAttributeMetadata'){_0x29f55f[_0x77a7('0xa6')](getInputList(_0xf63405,_0x243077,_0x120e0c,_0x2ab350,_0x24dbf0[_0x77a7('0x9e')],_0x5d7761[_0x77a7('0x9e')],_0x1a9990));}}});return Promise[_0x77a7('0xa7')](_0x29f55f);})[_0x77a7('0x2d')](function(_0x46f3cc){_0x34930a=_0x46f3cc[0x0];var _0x384d0f=_0x3e12dd[_0x77a7('0x8c')](_0x1d0c90)['concat'](_0x34930a);var _0x5a7871={'count':_0x384d0f[_0x77a7('0x21')],'rows':_0x384d0f};return _0x5a7871;})[_0x77a7('0x2d')](respondWithResult(_0x2c28ef,null))[_0x77a7('0x31')](function(_0xb99953){var _0x18a1d7=_0x1e4719[_0x77a7('0x1b')][_0x77a7('0xb3')]?0x1f4:_0xb99953[_0x77a7('0xb4')]||0x1f4;logger[_0x77a7('0x10')](_0xb99953[_0x77a7('0x11')]);delete _0xb99953[_0x77a7('0x12')];if(_0x18a1d7===0x191){_0x18a1d7=0x190;}_0x2c28ef[_0x77a7('0x7')](_0x18a1d7)[_0x77a7('0x13')](_0x1e4719[_0x77a7('0x1b')][_0x77a7('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0xb99953[_0x77a7('0xb4')]}:_0xb99953);});};function getSelectList(_0x1785d2,_0x4a28a6,_0x2fb2bf,_0xdb9fb4,_0x171e85,_0x360df3){var _0xbaed2e={'method':_0x77a7('0x9f'),'uri':_0x1785d2+'EntityDefinitions('+_0xdb9fb4+_0x77a7('0xb5')+_0x171e85+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x360df3,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0xbaed2e)[_0x77a7('0x2d')](function(_0x2e3707){var _0x482051=[];var _0x5529b3=_0x2e3707[_0x77a7('0xb6')][_0x77a7('0xb7')];_0x5529b3[_0x77a7('0xa8')](function(_0x3c3c1c){_0x482051['push']({'name':_0x3c3c1c[_0x77a7('0xb8')][_0x77a7('0xb9')][_0x77a7('0xb8')],'value':String(_0x3c3c1c['Value'])});});var _0x5d40c1={'id':_0x4a28a6+'_'+_0x2e3707[_0x77a7('0xa4')],'name':_0x2e3707['DisplayName'][_0x77a7('0xb9')][_0x77a7('0xb8')],'custom':![],'options':_0x482051};_0x2fb2bf['push'](_0x5d40c1);return _0x2fb2bf;});}function getBooleanList(_0x540796,_0xca97fb,_0x14b93e,_0x3dd843,_0x2b4e18,_0x321055){var _0x5cb234={'method':_0x77a7('0x9f'),'uri':_0x540796+_0x77a7('0xa0')+_0x3dd843+_0x77a7('0xb5')+_0x2b4e18+_0x77a7('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x321055,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x5cb234)[_0x77a7('0x2d')](function(_0x3e6c06){var _0x8111c5=[];_0x8111c5[_0x77a7('0xa6')]({'name':_0x3e6c06[_0x77a7('0xb6')][_0x77a7('0xbb')][_0x77a7('0xb8')][_0x77a7('0xb9')][_0x77a7('0xb8')],'value':_0x77a7('0xbc')},{'name':_0x3e6c06[_0x77a7('0xb6')][_0x77a7('0xbd')][_0x77a7('0xb8')][_0x77a7('0xb9')]['Label'],'value':_0x77a7('0xbe')});var _0x326c99={'id':_0xca97fb+'_'+_0x3e6c06[_0x77a7('0xa4')],'name':_0x3e6c06[_0x77a7('0xbf')][_0x77a7('0xb9')][_0x77a7('0xb8')],'custom':![],'options':_0x8111c5};_0x14b93e['push'](_0x326c99);return _0x14b93e;});}function getInputList(_0x383ae2,_0x4429be,_0x307429,_0x4a6863,_0x24f3d8,_0x4fdb52,_0x3bb8dc){var _0x27cbc4={'method':_0x77a7('0x9f'),'uri':_0x383ae2+_0x77a7('0xa0')+_0x24f3d8+_0x77a7('0xb5')+_0x4fdb52+_0x77a7('0xc0')+_0x307429+_0x77a7('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x3bb8dc,'If-None-Match':null,'OData-Version':_0x77a7('0x9c')},'json':!![]};return rp(_0x27cbc4)[_0x77a7('0x2d')](function(_0x5d75e7){var _0x319d65={'id':_0x4429be+'_'+_0x5d75e7[_0x77a7('0xa4')],'name':_0x5d75e7[_0x77a7('0xbf')][_0x77a7('0xb9')]?_0x5d75e7['DisplayName'][_0x77a7('0xb9')][_0x77a7('0xb8')]:_0x5d75e7[_0x77a7('0xa4')],'custom':![],'options':[]};_0x4a6863[_0x77a7('0xa6')](_0x319d65);return _0x4a6863;});} \ No newline at end of file +var _0xcbde=['phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','POST','https://login.microsoftonline.com/','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','type','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','Dynamics365Account','findAll','rows','catch','show','params','keys','options','find','create','body','getConfigurations','Dynamics365Configuration','hasOwnProperty','addConfiguration','findOne','Subjects','channel','Descriptions','Dynamics365Field','slice','substring','%s/api/data/v9.0/','ticketType','incident','Incident','title','description','customerid','ownerid','subject'];(function(_0x3e0024,_0x4f083f){var _0xdcd3f3=function(_0x913124){while(--_0x913124){_0x3e0024['push'](_0x3e0024['shift']());}};_0xdcd3f3(++_0x4f083f);}(_0xcbde,0x1df));var _0xecbd=function(_0x56b571,_0x445ae2){_0x56b571=_0x56b571-0x0;var _0x380b39=_0xcbde[_0x56b571];return _0x380b39;};'use strict';var rp=require('request-promise');var util=require(_0xecbd('0x0'));var _=require(_0xecbd('0x1'));var qs=require(_0xecbd('0x2'));var logger=require('../../config/logger')(_0xecbd('0x3'));var db=require(_0xecbd('0x4'))['db'];var integrations=require(_0xecbd('0x5'));function respondWithResult(_0x2454b9,_0x29a8ba){_0x29a8ba=_0x29a8ba||0xc8;return function(_0x43335f){if(_0x43335f){return _0x2454b9[_0xecbd('0x6')](_0x29a8ba)[_0xecbd('0x7')](_0x43335f);}};}function respondWithFilteredResult(_0x6b2490,_0x4b2af3){return function(_0x45cbb0){if(_0x45cbb0){var _0x5f3219=typeof _0x4b2af3[_0xecbd('0x8')]===_0xecbd('0x9')&&typeof _0x4b2af3[_0xecbd('0xa')]===_0xecbd('0x9');var _0x551ad5=_0x45cbb0[_0xecbd('0xb')];var _0x542750=_0x5f3219?0x0:_0x4b2af3[_0xecbd('0x8')];var _0x517e78=_0x5f3219?_0x45cbb0['count']:_0x4b2af3['offset']+_0x4b2af3[_0xecbd('0xa')];var _0x549fff;if(_0x517e78>=_0x551ad5){_0x517e78=_0x551ad5;_0x549fff=0xc8;}else{_0x549fff=0xce;}_0x6b2490[_0xecbd('0x6')](_0x549fff);return _0x6b2490['set'](_0xecbd('0xc'),_0x542750+'-'+_0x517e78+'/'+_0x551ad5)[_0xecbd('0x7')](_0x45cbb0);}return null;};}function saveUpdates(_0x3c7265){return function(_0x122d8d){if(_0x122d8d){return _0x122d8d[_0xecbd('0xd')](_0x3c7265)['then'](function(_0x1c5e46){return _0x1c5e46;});}return null;};}function removeEntity(_0x26d805){return function(_0x16589d){if(_0x16589d){return _0x16589d[_0xecbd('0xe')]()[_0xecbd('0xf')](function(){_0x26d805[_0xecbd('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x102b54){return function(_0x26e01a){if(!_0x26e01a){_0x102b54[_0xecbd('0x10')](0x194);}return _0x26e01a;};}function handleError(_0x4e54cc,_0x34b2f3){_0x34b2f3=_0x34b2f3||0x1f4;return function(_0x312d4c){logger[_0xecbd('0x11')](_0x312d4c[_0xecbd('0x12')]);if(_0x312d4c['name']){delete _0x312d4c[_0xecbd('0x13')];}_0x4e54cc[_0xecbd('0x6')](_0x34b2f3)[_0xecbd('0x14')](_0x312d4c);};}exports[_0xecbd('0x15')]=function(_0x26f403,_0x180eea){var _0x55df88={},_0x561b7b={},_0x75dc4b={'count':0x0,'rows':[]};var _0x506104=_['map'](db['Dynamics365Account'][_0xecbd('0x16')],function(_0x34a019){return{'name':_0x34a019['fieldName'],'type':_0x34a019[_0xecbd('0x17')]['key']};});_0x561b7b[_0xecbd('0x18')]=_[_0xecbd('0x19')](_0x506104,_0xecbd('0x13'));_0x561b7b[_0xecbd('0x1a')]=_['keys'](_0x26f403[_0xecbd('0x1a')]);_0x561b7b['filters']=_[_0xecbd('0x1b')](_0x561b7b[_0xecbd('0x18')],_0x561b7b[_0xecbd('0x1a')]);_0x55df88[_0xecbd('0x1c')]=_[_0xecbd('0x1b')](_0x561b7b[_0xecbd('0x18')],qs[_0xecbd('0x1d')](_0x26f403['query'][_0xecbd('0x1d')]));_0x55df88[_0xecbd('0x1c')]=_0x55df88[_0xecbd('0x1c')][_0xecbd('0x1e')]?_0x55df88[_0xecbd('0x1c')]:_0x561b7b[_0xecbd('0x18')];if(!_0x26f403[_0xecbd('0x1a')]['hasOwnProperty'](_0xecbd('0x1f'))){_0x55df88[_0xecbd('0xa')]=qs['limit'](_0x26f403[_0xecbd('0x1a')][_0xecbd('0xa')]);_0x55df88[_0xecbd('0x8')]=qs[_0xecbd('0x8')](_0x26f403[_0xecbd('0x1a')][_0xecbd('0x8')]);}_0x55df88[_0xecbd('0x20')]=qs[_0xecbd('0x21')](_0x26f403[_0xecbd('0x1a')][_0xecbd('0x21')]);_0x55df88[_0xecbd('0x22')]=qs[_0xecbd('0x23')](_[_0xecbd('0x24')](_0x26f403[_0xecbd('0x1a')],_0x561b7b[_0xecbd('0x23')]),_0x506104);if(_0x26f403[_0xecbd('0x1a')][_0xecbd('0x25')]){_0x55df88[_0xecbd('0x22')]=_[_0xecbd('0x26')](_0x55df88[_0xecbd('0x22')],{'$or':_[_0xecbd('0x19')](_0x506104,function(_0x441fd7){if(_0x441fd7[_0xecbd('0x17')]!==_0xecbd('0x27')){var _0xeb85ed={};_0xeb85ed[_0x441fd7['name']]={'$like':'%'+_0x26f403[_0xecbd('0x1a')][_0xecbd('0x25')]+'%'};return _0xeb85ed;}})});}_0x55df88=_[_0xecbd('0x26')]({},_0x55df88,_0x26f403['options']);var _0x16554c={'where':_0x55df88[_0xecbd('0x22')]};return db['Dynamics365Account']['count'](_0x16554c)['then'](function(_0x56d005){_0x75dc4b[_0xecbd('0xb')]=_0x56d005;if(_0x26f403[_0xecbd('0x1a')][_0xecbd('0x28')]){_0x55df88[_0xecbd('0x29')]=[{'all':!![]}];}return db[_0xecbd('0x2a')][_0xecbd('0x2b')](_0x55df88);})['then'](function(_0x329afd){_0x75dc4b[_0xecbd('0x2c')]=_0x329afd;return _0x75dc4b;})[_0xecbd('0xf')](respondWithFilteredResult(_0x180eea,_0x55df88))[_0xecbd('0x2d')](handleError(_0x180eea,null));};exports[_0xecbd('0x2e')]=function(_0x329581,_0x52f568){var _0x38b41d={'raw':![],'where':{'id':_0x329581[_0xecbd('0x2f')]['id']}},_0x314a46={};_0x314a46[_0xecbd('0x18')]=_['keys'](db[_0xecbd('0x2a')]['rawAttributes']);_0x314a46[_0xecbd('0x1a')]=_[_0xecbd('0x30')](_0x329581[_0xecbd('0x1a')]);_0x314a46[_0xecbd('0x23')]=_[_0xecbd('0x1b')](_0x314a46['model'],_0x314a46[_0xecbd('0x1a')]);_0x38b41d[_0xecbd('0x1c')]=_['intersection'](_0x314a46[_0xecbd('0x18')],qs['fields'](_0x329581[_0xecbd('0x1a')][_0xecbd('0x1d')]));_0x38b41d[_0xecbd('0x1c')]=_0x38b41d[_0xecbd('0x1c')][_0xecbd('0x1e')]?_0x38b41d[_0xecbd('0x1c')]:_0x314a46['model'];if(_0x329581[_0xecbd('0x1a')][_0xecbd('0x28')]){_0x38b41d['include']=[{'all':!![]}];}_0x38b41d=_[_0xecbd('0x26')]({},_0x38b41d,_0x329581[_0xecbd('0x31')]);return db[_0xecbd('0x2a')][_0xecbd('0x32')](_0x38b41d)[_0xecbd('0xf')](handleEntityNotFound(_0x52f568,null))['then'](respondWithResult(_0x52f568,null))[_0xecbd('0x2d')](handleError(_0x52f568,null));};exports[_0xecbd('0x33')]=function(_0x263b17,_0x810884){return db[_0xecbd('0x2a')][_0xecbd('0x33')](_0x263b17['body'],{})['then'](respondWithResult(_0x810884,0xc9))[_0xecbd('0x2d')](handleError(_0x810884,null));};exports[_0xecbd('0xd')]=function(_0x295134,_0x1e05dc){if(_0x295134[_0xecbd('0x34')]['id']){delete _0x295134['body']['id'];}return db[_0xecbd('0x2a')][_0xecbd('0x32')]({'where':{'id':_0x295134[_0xecbd('0x2f')]['id']}})[_0xecbd('0xf')](handleEntityNotFound(_0x1e05dc,null))[_0xecbd('0xf')](saveUpdates(_0x295134[_0xecbd('0x34')],null))[_0xecbd('0xf')](respondWithResult(_0x1e05dc,null))[_0xecbd('0x2d')](handleError(_0x1e05dc,null));};exports[_0xecbd('0xe')]=function(_0x56bd68,_0x2e0c4a){return db['Dynamics365Account'][_0xecbd('0x32')]({'where':{'id':_0x56bd68['params']['id']}})['then'](handleEntityNotFound(_0x2e0c4a,null))[_0xecbd('0xf')](removeEntity(_0x2e0c4a,null))[_0xecbd('0x2d')](handleError(_0x2e0c4a,null));};exports[_0xecbd('0x35')]=function(_0xe31671,_0x237f72){var _0x236c38={};var _0x39243b={};var _0x347275;var _0x5f2193;return db[_0xecbd('0x2a')]['findOne']({'where':{'id':_0xe31671[_0xecbd('0x2f')]['id']}})[_0xecbd('0xf')](handleEntityNotFound(_0x237f72,null))[_0xecbd('0xf')](function(_0x41c056){if(_0x41c056){_0x347275=_0x41c056;_0x39243b[_0xecbd('0x18')]=_['keys'](db[_0xecbd('0x36')][_0xecbd('0x16')]);_0x39243b[_0xecbd('0x1a')]=_[_0xecbd('0x30')](_0xe31671[_0xecbd('0x1a')]);_0x39243b['filters']=_[_0xecbd('0x1b')](_0x39243b[_0xecbd('0x18')],_0x39243b[_0xecbd('0x1a')]);_0x236c38[_0xecbd('0x1c')]=_['intersection'](_0x39243b[_0xecbd('0x18')],qs['fields'](_0xe31671[_0xecbd('0x1a')][_0xecbd('0x1d')]));_0x236c38[_0xecbd('0x1c')]=_0x236c38['attributes'][_0xecbd('0x1e')]?_0x236c38[_0xecbd('0x1c')]:_0x39243b['model'];_0x236c38[_0xecbd('0x20')]=qs[_0xecbd('0x21')](_0xe31671['query']['sort']);_0x236c38[_0xecbd('0x22')]=qs[_0xecbd('0x23')](_['pick'](_0xe31671[_0xecbd('0x1a')],_0x39243b[_0xecbd('0x23')]));if(_0xe31671[_0xecbd('0x1a')][_0xecbd('0x25')]){_0x236c38[_0xecbd('0x22')]=_[_0xecbd('0x26')](_0x236c38['where'],{'$or':_[_0xecbd('0x19')](_0x236c38[_0xecbd('0x1c')],function(_0x5be7a3){var _0x2c9012={};_0x2c9012[_0x5be7a3]={'$like':'%'+_0xe31671['query']['filter']+'%'};return _0x2c9012;})});}_0x236c38=_[_0xecbd('0x26')]({},_0x236c38,_0xe31671['options']);return _0x347275[_0xecbd('0x35')](_0x236c38);}})[_0xecbd('0xf')](function(_0x48cb44){if(_0x48cb44){_0x5f2193=_0x48cb44[_0xecbd('0x1e')];if(!_0xe31671['query'][_0xecbd('0x37')](_0xecbd('0x1f'))){_0x236c38[_0xecbd('0xa')]=qs[_0xecbd('0xa')](_0xe31671[_0xecbd('0x1a')][_0xecbd('0xa')]);_0x236c38[_0xecbd('0x8')]=qs['offset'](_0xe31671[_0xecbd('0x1a')]['offset']);}return _0x347275[_0xecbd('0x35')](_0x236c38);}})[_0xecbd('0xf')](function(_0x49529e){if(_0x49529e){return _0x49529e?{'count':_0x5f2193,'rows':_0x49529e}:null;}})[_0xecbd('0xf')](respondWithResult(_0x237f72,null))[_0xecbd('0x2d')](handleError(_0x237f72,null));};exports[_0xecbd('0x38')]=function(_0x37c4f5,_0x326fe2){if(_0x37c4f5[_0xecbd('0x34')]['id']){delete _0x37c4f5[_0xecbd('0x34')]['id'];}return db[_0xecbd('0x2a')][_0xecbd('0x39')]({'where':{'id':_0x37c4f5[_0xecbd('0x2f')]['id']}})[_0xecbd('0xf')](handleEntityNotFound(_0x326fe2,null))[_0xecbd('0xf')](function(_0x554b05){if(_0x554b05){_0x37c4f5['body']['AccountId']=_0x554b05['id'];_0x37c4f5[_0xecbd('0x34')][_0xecbd('0x3a')]=integrations['getSubjects'](_0x37c4f5[_0xecbd('0x34')][_0xecbd('0x3b')],_0x37c4f5['body'][_0xecbd('0x17')]);_0x37c4f5[_0xecbd('0x34')][_0xecbd('0x3c')]=integrations['getDescriptions'](_0x37c4f5['body']['channel'],_0x37c4f5[_0xecbd('0x34')][_0xecbd('0x17')]);return db[_0xecbd('0x36')][_0xecbd('0x33')](_0x37c4f5[_0xecbd('0x34')],{'include':[{'model':db[_0xecbd('0x3d')],'as':_0xecbd('0x3a')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xecbd('0xf')](respondWithResult(_0x326fe2,null))[_0xecbd('0x2d')](handleError(_0x326fe2,null));};function sanitizeRemoteUri(_0x46d83f){var _0x1a0623=_0x46d83f[_0xecbd('0x3e')](-0x1);if(_0x1a0623==='/')return _0x46d83f[_0xecbd('0x3f')](0x0,_0x46d83f['lastIndexOf'](_0x1a0623));return _0x46d83f;}function getWebApiUrl(_0x7829d3){return util['format'](_0xecbd('0x40'),_0x7829d3);}exports['getFields']=function(_0x115bb3,_0x4fef03){var _0x3cc45c=_0x115bb3[_0xecbd('0x1a')][_0xecbd('0x41')];var _0x265c5d=_0x3cc45c===_0xecbd('0x42')?_0xecbd('0x43'):'PhoneCall';var _0x47b9a8='';var _0x32b2bd='';var _0x2f2359='';var _0xc0efea='';var _0x8501be='';var _0x4fc50d='';var _0x49d812='';var _0x530aa6='';var _0x17b35d=[_0xecbd('0x44'),_0xecbd('0x45'),_0xecbd('0x46'),_0xecbd('0x47'),'caseorigincode',_0xecbd('0x48'),_0xecbd('0x49'),_0xecbd('0x4a'),_0xecbd('0x4b'),_0xecbd('0x4c')];var _0x3362a6=[_0xecbd('0x4d'),_0xecbd('0x4e'),'actualserviceunits',_0xecbd('0x4f'),'contactidname',_0xecbd('0x50'),'contractdetailidname',_0xecbd('0x51'),'createdbyexternalpartyname',_0xecbd('0x52'),_0xecbd('0x53'),'createdbyyominame',_0xecbd('0x54'),_0xecbd('0x55'),_0xecbd('0x56'),_0xecbd('0x57'),_0xecbd('0x58'),_0xecbd('0x59'),_0xecbd('0x5a'),_0xecbd('0x5b'),'entityimage_timestamp','entityimage_url',_0xecbd('0x5c'),_0xecbd('0x5d'),'firstresponsebykpiidname','followupby',_0xecbd('0x5e'),'influencescore',_0xecbd('0x5f'),_0xecbd('0x60'),_0xecbd('0x61'),'modifiedbyexternalpartyname',_0xecbd('0x62'),_0xecbd('0x63'),_0xecbd('0x64'),_0xecbd('0x65'),_0xecbd('0x66'),_0xecbd('0x67'),_0xecbd('0x68'),'msdyn_iotalertname',_0xecbd('0x69'),_0xecbd('0x6a'),_0xecbd('0x6b'),'owneridname',_0xecbd('0x6c'),_0xecbd('0x6d'),_0xecbd('0x6e'),'primarycontactidname',_0xecbd('0x6f'),'prioritycodename',_0xecbd('0x70'),_0xecbd('0x71'),_0xecbd('0x72'),_0xecbd('0x73'),_0xecbd('0x74'),_0xecbd('0x75'),_0xecbd('0x76'),_0xecbd('0x77'),_0xecbd('0x78'),_0xecbd('0x79'),'socialprofileidname',_0xecbd('0x7a'),_0xecbd('0x7b'),_0xecbd('0x7c'),_0xecbd('0x7d'),_0xecbd('0x7e'),_0xecbd('0x7f'),'traversedpath','utcconversiontimezonecode',_0xecbd('0x80')];var _0x33bdf8=_0x17b35d[_0xecbd('0x81')](_0x3362a6);return db[_0xecbd('0x2a')][_0xecbd('0x39')]({'where':{'id':_0x115bb3['params']['id']},'attributes':['id',_0xecbd('0x82'),_0xecbd('0x83'),_0xecbd('0x84'),_0xecbd('0x85'),_0xecbd('0x86'),_0xecbd('0x87'),_0xecbd('0x88')],'include':[{'model':db[_0xecbd('0x89')],'as':'CloudProvider','attributes':['id',_0xecbd('0x8a'),'data7']}]})[_0xecbd('0xf')](handleEntityNotFound(_0x4fef03,null))[_0xecbd('0xf')](function(_0x2d4dbe){if(_0x2d4dbe){if(_0x2d4dbe[_0xecbd('0x88')]){_0x2d4dbe[_0xecbd('0x8b')]=_0x2d4dbe[_0xecbd('0x89')][_0xecbd('0x8a')];_0x530aa6=sanitizeRemoteUri(_0x2d4dbe['CloudProvider']['data7']);_0x49d812=getWebApiUrl(_0x530aa6);return _0x2d4dbe;}_0x530aa6=sanitizeRemoteUri(_0x2d4dbe[_0xecbd('0x84')]);_0x49d812=getWebApiUrl(_0x530aa6);var _0x3d80c4={'method':_0xecbd('0x8c'),'uri':_0xecbd('0x8d')+_0x2d4dbe['tenantId']+'/oauth2/token','form':{'client_id':_0x2d4dbe['clientId'],'resource':_0x530aa6,'username':_0x2d4dbe[_0xecbd('0x82')],'password':_0x2d4dbe['password'],'grant_type':'password','client_secret':_0x2d4dbe['clientSecret']},'json':!![]};return rp(_0x3d80c4);}})[_0xecbd('0xf')](function(_0x18f034){_0x4fc50d=_0x18f034[_0xecbd('0x8b')];var _0x8551f3={'method':'GET','uri':encodeURI(_0x49d812+_0xecbd('0x8e')+_0x265c5d+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4fc50d,'If-None-Match':null,'OData-Version':_0xecbd('0x8f')},'json':!![]};return rp(_0x8551f3);})[_0xecbd('0xf')](function(_0x3738ae){var _0x2e39c2=_0x3738ae['value'][0x0];var _0x26a12c=_0x2e39c2[_0xecbd('0x90')];var _0x120b17={'method':'GET','uri':_0x49d812+_0xecbd('0x91')+_0x26a12c+_0xecbd('0x92'),'headers':{'Authorization':_0xecbd('0x93')+_0x4fc50d,'If-None-Match':null,'OData-Version':_0xecbd('0x8f')},'json':!![]};return rp(_0x120b17);})[_0xecbd('0xf')](function(_0x108558){_0x47b9a8=_0x108558;_0x32b2bd=_0x47b9a8['Attributes'];_0x32b2bd=_[_0xecbd('0x94')](_0x32b2bd,function(_0x4d9b85){return!_0x33bdf8['includes'](_0x4d9b85['LogicalName']);});var _0x43e909=[];var _0x337bf9=[];_0x32b2bd[_0xecbd('0x95')](function(_0x4d89bf){if(_0x4d89bf[_0xecbd('0x96')]){var _0x2c35a5=_0x4d89bf['@odata.type'][_0xecbd('0x3f')](_0x4d89bf[_0xecbd('0x96')][_0xecbd('0x97')]('.')+0x1);if(_0x2c35a5===_0xecbd('0x98')){_0x43e909[_0xecbd('0x99')](getSelectList(_0x49d812,_0x3cc45c,_0x337bf9,_0x47b9a8['MetadataId'],_0x4d89bf[_0xecbd('0x90')],_0x4fc50d));}}});return Promise[_0xecbd('0x9a')](_0x43e909);})[_0xecbd('0xf')](function(_0x3e3e22){_0x2f2359=_0x3e3e22[0x0];var _0x4992f5=[];var _0x13a239=[];_0x32b2bd['forEach'](function(_0x46b915){if(!_[_0xecbd('0x9b')](_0x46b915[_0xecbd('0x96')])){var _0x123979=_0x46b915[_0xecbd('0x96')][_0xecbd('0x3f')](_0x46b915['@odata.type'][_0xecbd('0x97')]('.')+0x1);if(_0x123979===_0xecbd('0x9c')){_0x4992f5[_0xecbd('0x99')](getBooleanList(_0x49d812,_0x3cc45c,_0x13a239,_0x47b9a8[_0xecbd('0x90')],_0x46b915[_0xecbd('0x90')],_0x4fc50d));}}});return Promise[_0xecbd('0x9a')](_0x4992f5);})[_0xecbd('0xf')](function(_0x511142){_0xc0efea=_0x511142[0x0];var _0x2640b9=[];var _0x4b1800=[];_0x32b2bd['forEach'](function(_0x446cbc){if(_0x446cbc[_0xecbd('0x96')]){var _0x233aba=_0x446cbc['@odata.type'][_0xecbd('0x3f')](_0x446cbc['@odata.type'][_0xecbd('0x97')]('.')+0x1);if(_0x233aba===_0xecbd('0x9d')||_0x233aba===_0xecbd('0x9e')||_0x233aba===_0xecbd('0x9f')||_0x233aba===_0xecbd('0xa0')||_0x233aba===_0xecbd('0xa1')||_0x233aba===_0xecbd('0xa2')||_0x233aba===_0xecbd('0xa3')||_0x233aba===_0xecbd('0xa4')||_0x233aba===_0xecbd('0xa5')||_0x233aba==='DecimalAttributeMetadata'){_0x2640b9['push'](getInputList(_0x49d812,_0x3cc45c,_0x233aba,_0x4b1800,_0x47b9a8[_0xecbd('0x90')],_0x446cbc[_0xecbd('0x90')],_0x4fc50d));}}});return Promise[_0xecbd('0x9a')](_0x2640b9);})[_0xecbd('0xf')](function(_0x2566f5){_0x8501be=_0x2566f5[0x0];var _0x3d8e99=_0x2f2359[_0xecbd('0x81')](_0xc0efea)[_0xecbd('0x81')](_0x8501be);var _0x1bbbab={'count':_0x3d8e99[_0xecbd('0x1e')],'rows':_0x3d8e99};return _0x1bbbab;})[_0xecbd('0xf')](respondWithResult(_0x4fef03,null))[_0xecbd('0x2d')](function(_0x2688b2){var _0x14ee42=_0x115bb3[_0xecbd('0x1a')][_0xecbd('0xa6')]?0x1f4:_0x2688b2[_0xecbd('0xa7')]||0x1f4;logger[_0xecbd('0x11')](_0x2688b2[_0xecbd('0x12')]);delete _0x2688b2[_0xecbd('0x13')];if(_0x14ee42===0x191){_0x14ee42=0x190;}_0x4fef03[_0xecbd('0x6')](_0x14ee42)[_0xecbd('0x14')](_0x115bb3[_0xecbd('0x1a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2688b2[_0xecbd('0xa7')]}:_0x2688b2);});};function getSelectList(_0x44f8cf,_0x2e601f,_0x1c98c4,_0x2ac16a,_0x3f6055,_0x1ff40a){var _0x422c02={'method':_0xecbd('0xa8'),'uri':_0x44f8cf+_0xecbd('0x91')+_0x2ac16a+_0xecbd('0xa9')+_0x3f6055+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xecbd('0xaa'),'headers':{'Authorization':_0xecbd('0x93')+_0x1ff40a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x422c02)[_0xecbd('0xf')](function(_0x2def77){var _0x5e877b=[];var _0x565aa4=_0x2def77[_0xecbd('0xab')]['Options'];_0x565aa4['forEach'](function(_0x28816f){_0x5e877b[_0xecbd('0x99')]({'name':_0x28816f[_0xecbd('0xac')]['UserLocalizedLabel'][_0xecbd('0xac')],'value':String(_0x28816f[_0xecbd('0xad')])});});var _0x4fae5a={'id':_0x2e601f+'_'+_0x2def77[_0xecbd('0xae')],'name':_0x2def77[_0xecbd('0xaf')][_0xecbd('0xb0')]['Label'],'custom':![],'options':_0x5e877b};_0x1c98c4[_0xecbd('0x99')](_0x4fae5a);return _0x1c98c4;});}function getBooleanList(_0xe5497c,_0x19342e,_0x23b655,_0x15d8f0,_0x35041f,_0xa50972){var _0x4913b5={'method':_0xecbd('0xa8'),'uri':_0xe5497c+_0xecbd('0x91')+_0x15d8f0+_0xecbd('0xa9')+_0x35041f+_0xecbd('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0xa50972,'If-None-Match':null,'OData-Version':_0xecbd('0x8f')},'json':!![]};return rp(_0x4913b5)['then'](function(_0x4dd7ed){var _0x4186e9=[];_0x4186e9[_0xecbd('0x99')]({'name':_0x4dd7ed[_0xecbd('0xab')][_0xecbd('0xb2')][_0xecbd('0xac')][_0xecbd('0xb0')]['Label'],'value':_0xecbd('0xb3')},{'name':_0x4dd7ed['OptionSet'][_0xecbd('0xb4')][_0xecbd('0xac')][_0xecbd('0xb0')][_0xecbd('0xac')],'value':_0xecbd('0xb5')});var _0x11086f={'id':_0x19342e+'_'+_0x4dd7ed[_0xecbd('0xae')],'name':_0x4dd7ed[_0xecbd('0xaf')][_0xecbd('0xb0')][_0xecbd('0xac')],'custom':![],'options':_0x4186e9};_0x23b655[_0xecbd('0x99')](_0x11086f);return _0x23b655;});}function getInputList(_0x1bd821,_0x3ce66c,_0x908a77,_0x4db124,_0x4da906,_0x384fbe,_0xa077c8){var _0x5ba503={'method':_0xecbd('0xa8'),'uri':_0x1bd821+'EntityDefinitions('+_0x4da906+_0xecbd('0xa9')+_0x384fbe+_0xecbd('0xb6')+_0x908a77+_0xecbd('0xb7'),'headers':{'Authorization':_0xecbd('0x93')+_0xa077c8,'If-None-Match':null,'OData-Version':_0xecbd('0x8f')},'json':!![]};return rp(_0x5ba503)[_0xecbd('0xf')](function(_0x341c17){var _0x1e69ba={'id':_0x3ce66c+'_'+_0x341c17[_0xecbd('0xae')],'name':_0x341c17[_0xecbd('0xaf')]['UserLocalizedLabel']?_0x341c17[_0xecbd('0xaf')][_0xecbd('0xb0')][_0xecbd('0xac')]:_0x341c17[_0xecbd('0xae')],'custom':![],'options':[]};_0x4db124[_0xecbd('0x99')](_0x1e69ba);return _0x4db124;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index aba6069..34faf4c 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x4c8e24,_0x46101b){var _0x22e201=function(_0x369efa){while(--_0x369efa){_0x4c8e24['push'](_0x4c8e24['shift']());}};_0x22e201(++_0x46101b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_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 f674dd4..9be4d59 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 _0x92ac=['model','map','GetDynamics365Account','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0x1d85bf,_0x54b3c0){var _0x96edc7=function(_0x1a2848){while(--_0x1a2848){_0x1d85bf['push'](_0x1d85bf['shift']());}};_0x96edc7(++_0x54b3c0);}(_0x92ac,0x186));var _0xc92a=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x92ac[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require('lodash');var util=require(_0xc92a('0x0'));var moment=require(_0xc92a('0x1'));var BPromise=require(_0xc92a('0x2'));var rs=require(_0xc92a('0x3'));var fs=require('fs');var Redis=require(_0xc92a('0x4'));var db=require(_0xc92a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc92a('0x6'));var config=require(_0xc92a('0x7'));var jayson=require(_0xc92a('0x8'));var client=jayson['client'][_0xc92a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x473997,_0x31c2dc,_0x992f43){return new BPromise(function(_0x4d56a0,_0x17134d){return client[_0xc92a('0xa')](_0x473997,_0x992f43)[_0xc92a('0xb')](function(_0x60e6ec){logger[_0xc92a('0xc')](_0xc92a('0xd'),_0x31c2dc,_0xc92a('0xe'));logger[_0xc92a('0xf')](_0xc92a('0x10'),_0x31c2dc,_0xc92a('0xe'),JSON[_0xc92a('0x11')](_0x60e6ec));if(_0x60e6ec[_0xc92a('0x12')]){if(_0x60e6ec[_0xc92a('0x12')][_0xc92a('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x31c2dc,_0x60e6ec[_0xc92a('0x12')]['message']);return _0x17134d(_0x60e6ec[_0xc92a('0x12')]['message']);}logger[_0xc92a('0x12')](_0xc92a('0xd'),_0x31c2dc,_0x60e6ec[_0xc92a('0x12')][_0xc92a('0x14')]);return _0x4d56a0(_0x60e6ec[_0xc92a('0x12')][_0xc92a('0x14')]);}else{logger['info'](_0xc92a('0xd'),_0x31c2dc,_0xc92a('0xe'));_0x4d56a0(_0x60e6ec[_0xc92a('0x15')][_0xc92a('0x14')]);}})[_0xc92a('0x16')](function(_0x57e70f){logger[_0xc92a('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x31c2dc,_0x57e70f);_0x17134d(_0x57e70f);});});}exports['GetDynamics365Account']=function(_0x134640){var _0x259343=this;return new Promise(function(_0x1acaf2,_0x494ec7){return db['Dynamics365Account'][_0xc92a('0x17')]({'raw':_0x134640[_0xc92a('0x18')]?_0x134640[_0xc92a('0x18')][_0xc92a('0x19')]===undefined?!![]:![]:!![],'where':_0x134640['options']?_0x134640[_0xc92a('0x18')][_0xc92a('0x1a')]||null:null,'attributes':_0x134640['options']?_0x134640[_0xc92a('0x18')][_0xc92a('0x1b')]||null:null,'limit':_0x134640[_0xc92a('0x18')]?_0x134640[_0xc92a('0x18')][_0xc92a('0x1c')]||null:null,'include':_0x134640['options']?_0x134640['options']['include']?_['map'](_0x134640['options'][_0xc92a('0x1d')],function(_0x9f72ad){return{'model':db[_0x9f72ad[_0xc92a('0x1e')]],'as':_0x9f72ad['as'],'attributes':_0x9f72ad[_0xc92a('0x1b')],'include':_0x9f72ad[_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x9f72ad[_0xc92a('0x1d')],function(_0x1f0d5a){return{'model':db[_0x1f0d5a[_0xc92a('0x1e')]],'as':_0x1f0d5a['as'],'attributes':_0x1f0d5a[_0xc92a('0x1b')],'include':_0x1f0d5a['include']?_[_0xc92a('0x1f')](_0x1f0d5a['include'],function(_0x58225a){return{'model':db[_0x58225a['model']],'as':_0x58225a['as'],'attributes':_0x58225a[_0xc92a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc92a('0xb')](function(_0x4fdba0){logger['info']('GetDynamics365Account',_0x134640);logger[_0xc92a('0xf')](_0xc92a('0x20'),_0x134640,JSON[_0xc92a('0x11')](_0x4fdba0));_0x1acaf2(_0x4fdba0);})[_0xc92a('0x16')](function(_0x5cfddf){logger[_0xc92a('0x12')](_0xc92a('0x20'),_0x5cfddf[_0xc92a('0x14')],_0x134640);_0x494ec7(_0x259343[_0xc92a('0x12')](0x1f4,_0x5cfddf[_0xc92a('0x14')]));});});};exports[_0xc92a('0x21')]=function(_0x180b7a){var _0x74689f=this;return new Promise(function(_0x3e0bd7,_0x15ba6a){return db['Dynamics365Account'][_0xc92a('0x22')]({'raw':_0x180b7a[_0xc92a('0x18')]?_0x180b7a[_0xc92a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x180b7a[_0xc92a('0x18')]?_0x180b7a['options'][_0xc92a('0x1a')]||null:null,'attributes':_0x180b7a[_0xc92a('0x18')]?_0x180b7a['options']['attributes']||null:null,'include':_0x180b7a[_0xc92a('0x18')]?_0x180b7a[_0xc92a('0x18')][_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x180b7a[_0xc92a('0x18')][_0xc92a('0x1d')],function(_0x3304d5){return{'model':db[_0x3304d5[_0xc92a('0x1e')]],'as':_0x3304d5['as'],'attributes':_0x3304d5[_0xc92a('0x1b')],'include':_0x3304d5[_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x3304d5['include'],function(_0x288152){return{'model':db[_0x288152['model']],'as':_0x288152['as'],'attributes':_0x288152[_0xc92a('0x1b')],'include':_0x288152[_0xc92a('0x1d')]?_[_0xc92a('0x1f')](_0x288152[_0xc92a('0x1d')],function(_0x25c927){return{'model':db[_0x25c927[_0xc92a('0x1e')]],'as':_0x25c927['as'],'attributes':_0x25c927[_0xc92a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc92a('0xb')](function(_0x246b90){logger[_0xc92a('0xc')](_0xc92a('0x21'),_0x180b7a);logger[_0xc92a('0xf')](_0xc92a('0x21'),_0x180b7a,JSON[_0xc92a('0x11')](_0x246b90));_0x3e0bd7(_0x246b90);})[_0xc92a('0x16')](function(_0x41bdeb){logger[_0xc92a('0x12')]('ShowDynamics365Account',_0x41bdeb[_0xc92a('0x14')],_0x180b7a);_0x15ba6a(_0x74689f[_0xc92a('0x12')](0x1f4,_0x41bdeb[_0xc92a('0x14')]));});});}; \ No newline at end of file +var _0xbfe8=['message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowDynamics365Account','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xbfe8,0x100));var _0x8bfe=function(_0x1bc137,_0x448833){_0x1bc137=_0x1bc137-0x0;var _0x585001=_0xbfe8[_0x1bc137];return _0x585001;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var moment=require(_0x8bfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bfe('0x2'));var db=require(_0x8bfe('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bfe('0x4'))(_0x8bfe('0x5'));var config=require(_0x8bfe('0x6'));var jayson=require(_0x8bfe('0x7'));var client=jayson['client'][_0x8bfe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbaa93b,_0x58881a,_0x2b3dcb){return new BPromise(function(_0x2b5e42,_0x55abda){return client['request'](_0xbaa93b,_0x2b3dcb)[_0x8bfe('0x9')](function(_0x35c171){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x58881a,_0x8bfe('0xa'));logger['debug'](_0x8bfe('0xb'),_0x58881a,_0x8bfe('0xa'),JSON[_0x8bfe('0xc')](_0x35c171));if(_0x35c171[_0x8bfe('0xd')]){if(_0x35c171[_0x8bfe('0xd')][_0x8bfe('0xe')]===0x1f4){logger[_0x8bfe('0xd')](_0x8bfe('0xf'),_0x58881a,_0x35c171[_0x8bfe('0xd')][_0x8bfe('0x10')]);return _0x55abda(_0x35c171[_0x8bfe('0xd')][_0x8bfe('0x10')]);}logger[_0x8bfe('0xd')](_0x8bfe('0xf'),_0x58881a,_0x35c171[_0x8bfe('0xd')][_0x8bfe('0x10')]);return _0x2b5e42(_0x35c171['error'][_0x8bfe('0x10')]);}else{logger[_0x8bfe('0x11')](_0x8bfe('0xf'),_0x58881a,_0x8bfe('0xa'));_0x2b5e42(_0x35c171[_0x8bfe('0x12')][_0x8bfe('0x10')]);}})[_0x8bfe('0x13')](function(_0x41d0a4){logger[_0x8bfe('0xd')](_0x8bfe('0xf'),_0x58881a,_0x41d0a4);_0x55abda(_0x41d0a4);});});}exports[_0x8bfe('0x14')]=function(_0x3da47c){var _0x1abee3=this;return new Promise(function(_0x2a1a73,_0x36d00f){return db[_0x8bfe('0x15')][_0x8bfe('0x16')]({'raw':_0x3da47c[_0x8bfe('0x17')]?_0x3da47c[_0x8bfe('0x17')][_0x8bfe('0x18')]===undefined?!![]:![]:!![],'where':_0x3da47c[_0x8bfe('0x17')]?_0x3da47c[_0x8bfe('0x17')][_0x8bfe('0x19')]||null:null,'attributes':_0x3da47c[_0x8bfe('0x17')]?_0x3da47c[_0x8bfe('0x17')][_0x8bfe('0x1a')]||null:null,'limit':_0x3da47c[_0x8bfe('0x17')]?_0x3da47c[_0x8bfe('0x17')][_0x8bfe('0x1b')]||null:null,'include':_0x3da47c['options']?_0x3da47c[_0x8bfe('0x17')][_0x8bfe('0x1c')]?_[_0x8bfe('0x1d')](_0x3da47c[_0x8bfe('0x17')]['include'],function(_0x53eb2a){return{'model':db[_0x53eb2a[_0x8bfe('0x1e')]],'as':_0x53eb2a['as'],'attributes':_0x53eb2a['attributes'],'include':_0x53eb2a['include']?_[_0x8bfe('0x1d')](_0x53eb2a[_0x8bfe('0x1c')],function(_0x4c0bb5){return{'model':db[_0x4c0bb5[_0x8bfe('0x1e')]],'as':_0x4c0bb5['as'],'attributes':_0x4c0bb5['attributes'],'include':_0x4c0bb5[_0x8bfe('0x1c')]?_['map'](_0x4c0bb5[_0x8bfe('0x1c')],function(_0x17e031){return{'model':db[_0x17e031[_0x8bfe('0x1e')]],'as':_0x17e031['as'],'attributes':_0x17e031['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bfe('0x9')](function(_0x35fcaa){logger[_0x8bfe('0x11')](_0x8bfe('0x14'),_0x3da47c);logger[_0x8bfe('0x1f')](_0x8bfe('0x14'),_0x3da47c,JSON[_0x8bfe('0xc')](_0x35fcaa));_0x2a1a73(_0x35fcaa);})[_0x8bfe('0x13')](function(_0x38dea0){logger[_0x8bfe('0xd')](_0x8bfe('0x14'),_0x38dea0[_0x8bfe('0x10')],_0x3da47c);_0x36d00f(_0x1abee3['error'](0x1f4,_0x38dea0[_0x8bfe('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x2eb308){var _0x40110c=this;return new Promise(function(_0x3df752,_0x2fe160){return db[_0x8bfe('0x15')][_0x8bfe('0x20')]({'raw':_0x2eb308[_0x8bfe('0x17')]?_0x2eb308[_0x8bfe('0x17')][_0x8bfe('0x18')]===undefined?!![]:![]:!![],'where':_0x2eb308[_0x8bfe('0x17')]?_0x2eb308['options'][_0x8bfe('0x19')]||null:null,'attributes':_0x2eb308[_0x8bfe('0x17')]?_0x2eb308[_0x8bfe('0x17')]['attributes']||null:null,'include':_0x2eb308[_0x8bfe('0x17')]?_0x2eb308[_0x8bfe('0x17')]['include']?_['map'](_0x2eb308['options'][_0x8bfe('0x1c')],function(_0x2aa332){return{'model':db[_0x2aa332[_0x8bfe('0x1e')]],'as':_0x2aa332['as'],'attributes':_0x2aa332['attributes'],'include':_0x2aa332[_0x8bfe('0x1c')]?_['map'](_0x2aa332['include'],function(_0x1cf2fc){return{'model':db[_0x1cf2fc['model']],'as':_0x1cf2fc['as'],'attributes':_0x1cf2fc[_0x8bfe('0x1a')],'include':_0x1cf2fc['include']?_[_0x8bfe('0x1d')](_0x1cf2fc[_0x8bfe('0x1c')],function(_0x5c7fad){return{'model':db[_0x5c7fad[_0x8bfe('0x1e')]],'as':_0x5c7fad['as'],'attributes':_0x5c7fad[_0x8bfe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8bfe('0x9')](function(_0x84f6ae){logger[_0x8bfe('0x11')](_0x8bfe('0x21'),_0x2eb308);logger[_0x8bfe('0x1f')]('ShowDynamics365Account',_0x2eb308,JSON[_0x8bfe('0xc')](_0x84f6ae));_0x3df752(_0x84f6ae);})[_0x8bfe('0x13')](function(_0x361ba1){logger[_0x8bfe('0xd')]('ShowDynamics365Account',_0x361ba1[_0x8bfe('0x10')],_0x2eb308);_0x2fe160(_0x40110c['error'](0x1f4,_0x361ba1[_0x8bfe('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2a4144b..14d2693 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 _0xdd4f=['multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports'];(function(_0x4e6e99,_0x5c41fc){var _0x28cdcc=function(_0x3cf717){while(--_0x3cf717){_0x4e6e99['push'](_0x4e6e99['shift']());}};_0x28cdcc(++_0x5c41fc);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x56d344,_0x26fa8e){_0x56d344=_0x56d344-0x0;var _0x82e07c=_0xdd4f[_0x56d344];return _0x82e07c;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./intDynamics365Configuration.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x13')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0x14')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller['destroy']);module[_0xfdd4('0x15')]=router; \ No newline at end of file +var _0x9101=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','/:id'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x9101,0x9c));var _0x1910=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x9101[_0x45783c];return _0x1161da;};'use strict';var multer=require(_0x1910('0x0'));var util=require(_0x1910('0x1'));var path=require('path');var timeout=require(_0x1910('0x2'));var express=require(_0x1910('0x3'));var router=express[_0x1910('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1910('0x5'));var config=require('../../config/environment');var controller=require(_0x1910('0x6'));router[_0x1910('0x7')]('/',auth[_0x1910('0x8')](),controller[_0x1910('0x9')]);router[_0x1910('0x7')]('/:id',auth[_0x1910('0x8')](),controller['show']);router[_0x1910('0x7')](_0x1910('0xa'),auth['isAuthenticated'](),controller[_0x1910('0xb')]);router[_0x1910('0x7')](_0x1910('0xc'),auth[_0x1910('0x8')](),controller[_0x1910('0xd')]);router[_0x1910('0x7')](_0x1910('0xe'),auth['isAuthenticated'](),controller[_0x1910('0xf')]);router[_0x1910('0x10')]('/',auth[_0x1910('0x8')](),controller[_0x1910('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1910('0x12')]);router['delete'](_0x1910('0x13'),auth[_0x1910('0x8')](),controller[_0x1910('0x14')]);module[_0x1910('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0eb4bed..033b237 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 _0x72f1=['STRING','phonecall','incident','ENUM','nothing','contact','sequelize'];(function(_0x3eff16,_0x3e77f){var _0x381da4=function(_0x138bff){while(--_0x138bff){_0x3eff16['push'](_0x3eff16['shift']());}};_0x381da4(++_0x3e77f);}(_0x72f1,0x1bf));var _0x172f=function(_0x45ab1b,_0x54fe6d){_0x45ab1b=_0x45ab1b-0x0;var _0x507db7=_0x72f1[_0x45ab1b];return _0x507db7;};'use strict';var Sequelize=require(_0x172f('0x0'));module['exports']={'name':{'type':Sequelize[_0x172f('0x1')]},'description':{'type':Sequelize[_0x172f('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x172f('0x2')),'defaultValue':_0x172f('0x3')},'moduleCreate':{'type':Sequelize[_0x172f('0x4')]('contact',_0x172f('0x5')),'defaultValue':_0x172f('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x480b=['exports','STRING','ENUM','incident','contact','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x480b,0x197));var _0xb480=function(_0x59829e,_0x5bf039){_0x59829e=_0x59829e-0x0;var _0x3bdb0e=_0x480b[_0x59829e];return _0x3bdb0e;};'use strict';var Sequelize=require(_0xb480('0x0'));module[_0xb480('0x1')]={'name':{'type':Sequelize[_0xb480('0x2')]},'description':{'type':Sequelize[_0xb480('0x2')]},'ticketType':{'type':Sequelize[_0xb480('0x3')](_0xb480('0x4'),'phonecall'),'defaultValue':_0xb480('0x4')},'moduleCreate':{'type':Sequelize[_0xb480('0x3')](_0xb480('0x5'),'nothing'),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 313dd3c..c280a6b 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 _0x108e=['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','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','Dynamics365Configuration','findAll','rows','catch','show','rawAttributes','includeAll','merge','find','create','body','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0x108e,0x1e8));var _0xe108=function(_0x32f6e7,_0x23f23b){_0x32f6e7=_0x32f6e7-0x0;var _0x5958ad=_0x108e[_0x32f6e7];return _0x5958ad;};'use strict';var emlformat=require(_0xe108('0x0'));var rimraf=require(_0xe108('0x1'));var zipdir=require(_0xe108('0x2'));var jsonpatch=require(_0xe108('0x3'));var rp=require('request-promise');var moment=require(_0xe108('0x4'));var BPromise=require(_0xe108('0x5'));var Mustache=require(_0xe108('0x6'));var util=require(_0xe108('0x7'));var path=require('path');var sox=require(_0xe108('0x8'));var csv=require('to-csv');var ejs=require(_0xe108('0x9'));var fs=require('fs');var fs_extra=require(_0xe108('0xa'));var _=require(_0xe108('0xb'));var squel=require(_0xe108('0xc'));var crypto=require(_0xe108('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe108('0xe'));var toCsv=require(_0xe108('0xf'));var querystring=require(_0xe108('0x10'));var Papa=require('papaparse');var Redis=require(_0xe108('0x11'));var authService=require(_0xe108('0x12'));var qs=require(_0xe108('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe108('0x14'));var logger=require(_0xe108('0x15'))(_0xe108('0x16'));var utils=require(_0xe108('0x17'));var config=require(_0xe108('0x18'));var licenseUtil=require(_0xe108('0x19'));var db=require(_0xe108('0x1a'))['db'];function respondWithStatusCode(_0x3e10c2,_0x5f5d69){_0x5f5d69=_0x5f5d69||0xcc;return function(_0x3b829a){if(_0x3b829a){return _0x3e10c2[_0xe108('0x1b')](_0x5f5d69);}return _0x3e10c2[_0xe108('0x1c')](_0x5f5d69)[_0xe108('0x1d')]();};}function respondWithResult(_0x241d71,_0x19cd23){_0x19cd23=_0x19cd23||0xc8;return function(_0x5e5794){if(_0x5e5794){return _0x241d71[_0xe108('0x1c')](_0x19cd23)[_0xe108('0x1e')](_0x5e5794);}};}function respondWithFilteredResult(_0x2dbe4d,_0x5c11ae){return function(_0x6666c2){if(_0x6666c2){var _0x299410=typeof _0x5c11ae[_0xe108('0x1f')]===_0xe108('0x20')&&typeof _0x5c11ae[_0xe108('0x21')]===_0xe108('0x20');var _0x6d3579=_0x6666c2[_0xe108('0x22')];var _0x581a67=_0x299410?0x0:_0x5c11ae['offset'];var _0x2083f7=_0x299410?_0x6666c2[_0xe108('0x22')]:_0x5c11ae[_0xe108('0x1f')]+_0x5c11ae[_0xe108('0x21')];var _0xc4e3cb;if(_0x2083f7>=_0x6d3579){_0x2083f7=_0x6d3579;_0xc4e3cb=0xc8;}else{_0xc4e3cb=0xce;}_0x2dbe4d[_0xe108('0x1c')](_0xc4e3cb);return _0x2dbe4d[_0xe108('0x23')](_0xe108('0x24'),_0x581a67+'-'+_0x2083f7+'/'+_0x6d3579)[_0xe108('0x1e')](_0x6666c2);}return null;};}function patchUpdates(_0x3892cd){return function(_0x5bc6f6){try{jsonpatch['apply'](_0x5bc6f6,_0x3892cd,!![]);}catch(_0x1779ad){return BPromise[_0xe108('0x25')](_0x1779ad);}return _0x5bc6f6['save']();};}function saveUpdates(_0x3fb6ee,_0x58354d){return function(_0x5092ae){if(_0x5092ae){return _0x5092ae[_0xe108('0x26')](_0x3fb6ee)[_0xe108('0x27')](function(_0x1206bb){return _0x1206bb;});}return null;};}function removeEntity(_0x4fc390,_0x2b22e4){return function(_0x2bb736){if(_0x2bb736){return _0x2bb736[_0xe108('0x28')]()[_0xe108('0x27')](function(){_0x4fc390[_0xe108('0x1c')](0xcc)[_0xe108('0x1d')]();});}};}function handleEntityNotFound(_0x37bd03,_0x171418){return function(_0xfc2776){if(!_0xfc2776){_0x37bd03[_0xe108('0x1b')](0x194);}return _0xfc2776;};}function handleError(_0x4478dd,_0x25b153){_0x25b153=_0x25b153||0x1f4;return function(_0x2a5560){logger[_0xe108('0x29')](_0x2a5560[_0xe108('0x2a')]);if(_0x2a5560['name']){delete _0x2a5560[_0xe108('0x2b')];}_0x4478dd[_0xe108('0x1c')](_0x25b153)['send'](_0x2a5560);};}exports[_0xe108('0x2c')]=function(_0x4d894c,_0x185d18){var _0x37b3c8={},_0x4a71eb={},_0x100fea={'count':0x0,'rows':[]};var _0x49136f=_[_0xe108('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0x3ec050){return{'name':_0x3ec050[_0xe108('0x2e')],'type':_0x3ec050[_0xe108('0x2f')][_0xe108('0x30')]};});_0x4a71eb[_0xe108('0x31')]=_[_0xe108('0x2d')](_0x49136f,'name');_0x4a71eb['query']=_[_0xe108('0x32')](_0x4d894c[_0xe108('0x33')]);_0x4a71eb[_0xe108('0x34')]=_[_0xe108('0x35')](_0x4a71eb[_0xe108('0x31')],_0x4a71eb['query']);_0x37b3c8[_0xe108('0x36')]=_[_0xe108('0x35')](_0x4a71eb[_0xe108('0x31')],qs[_0xe108('0x37')](_0x4d894c[_0xe108('0x33')]['fields']));_0x37b3c8[_0xe108('0x36')]=_0x37b3c8['attributes'][_0xe108('0x38')]?_0x37b3c8[_0xe108('0x36')]:_0x4a71eb[_0xe108('0x31')];if(!_0x4d894c[_0xe108('0x33')][_0xe108('0x39')](_0xe108('0x3a'))){_0x37b3c8['limit']=qs[_0xe108('0x21')](_0x4d894c[_0xe108('0x33')][_0xe108('0x21')]);_0x37b3c8['offset']=qs['offset'](_0x4d894c[_0xe108('0x33')][_0xe108('0x1f')]);}_0x37b3c8[_0xe108('0x3b')]=qs[_0xe108('0x3c')](_0x4d894c[_0xe108('0x33')][_0xe108('0x3c')]);_0x37b3c8[_0xe108('0x3d')]=qs[_0xe108('0x34')](_[_0xe108('0x3e')](_0x4d894c[_0xe108('0x33')],_0x4a71eb[_0xe108('0x34')]),_0x49136f);if(_0x4d894c['query'][_0xe108('0x3f')]){_0x37b3c8['where']=_['merge'](_0x37b3c8['where'],{'$or':_[_0xe108('0x2d')](_0x49136f,function(_0x2eecc7){if(_0x2eecc7['type']!==_0xe108('0x40')){var _0x286c90={};_0x286c90[_0x2eecc7[_0xe108('0x2b')]]={'$like':'%'+_0x4d894c['query'][_0xe108('0x3f')]+'%'};return _0x286c90;}})});}_0x37b3c8=_['merge']({},_0x37b3c8,_0x4d894c[_0xe108('0x41')]);var _0x645791={'where':_0x37b3c8[_0xe108('0x3d')]};return db['Dynamics365Configuration'][_0xe108('0x22')](_0x645791)[_0xe108('0x27')](function(_0x3f8816){_0x100fea[_0xe108('0x22')]=_0x3f8816;if(_0x4d894c['query']['includeAll']){_0x37b3c8[_0xe108('0x42')]=[{'all':!![]}];}return db[_0xe108('0x43')][_0xe108('0x44')](_0x37b3c8);})[_0xe108('0x27')](function(_0x40433c){_0x100fea[_0xe108('0x45')]=_0x40433c;return _0x100fea;})[_0xe108('0x27')](respondWithFilteredResult(_0x185d18,_0x37b3c8))[_0xe108('0x46')](handleError(_0x185d18,null));};exports[_0xe108('0x47')]=function(_0xda4ea9,_0x23e211){var _0x11a56d={'raw':![],'where':{'id':_0xda4ea9['params']['id']}},_0x407cd6={};_0x407cd6['model']=_[_0xe108('0x32')](db['Dynamics365Configuration'][_0xe108('0x48')]);_0x407cd6[_0xe108('0x33')]=_[_0xe108('0x32')](_0xda4ea9[_0xe108('0x33')]);_0x407cd6['filters']=_[_0xe108('0x35')](_0x407cd6['model'],_0x407cd6['query']);_0x11a56d[_0xe108('0x36')]=_['intersection'](_0x407cd6['model'],qs[_0xe108('0x37')](_0xda4ea9['query']['fields']));_0x11a56d['attributes']=_0x11a56d[_0xe108('0x36')]['length']?_0x11a56d[_0xe108('0x36')]:_0x407cd6['model'];if(_0xda4ea9[_0xe108('0x33')][_0xe108('0x49')]){_0x11a56d[_0xe108('0x42')]=[{'all':!![]}];}_0x11a56d=_[_0xe108('0x4a')]({},_0x11a56d,_0xda4ea9[_0xe108('0x41')]);return db['Dynamics365Configuration'][_0xe108('0x4b')](_0x11a56d)[_0xe108('0x27')](handleEntityNotFound(_0x23e211,null))[_0xe108('0x27')](respondWithResult(_0x23e211,null))[_0xe108('0x46')](handleError(_0x23e211,null));};exports[_0xe108('0x4c')]=function(_0x1b20d2,_0x4282c8){return db[_0xe108('0x43')][_0xe108('0x4c')](_0x1b20d2[_0xe108('0x4d')],{})[_0xe108('0x27')](respondWithResult(_0x4282c8,0xc9))[_0xe108('0x46')](handleError(_0x4282c8,null));};exports['update']=function(_0x309cc4,_0x2c47ea){if(_0x309cc4[_0xe108('0x4d')]['id']){delete _0x309cc4[_0xe108('0x4d')]['id'];}return db[_0xe108('0x43')][_0xe108('0x4b')]({'where':{'id':_0x309cc4[_0xe108('0x4e')]['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x2c47ea,null))[_0xe108('0x27')](saveUpdates(_0x309cc4[_0xe108('0x4d')],null))[_0xe108('0x27')](respondWithResult(_0x2c47ea,null))['catch'](handleError(_0x2c47ea,null));};exports[_0xe108('0x28')]=function(_0x1b7a99,_0x3184d8){return db['Dynamics365Configuration']['find']({'where':{'id':_0x1b7a99[_0xe108('0x4e')]['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x3184d8,null))[_0xe108('0x27')](removeEntity(_0x3184d8,null))[_0xe108('0x46')](handleError(_0x3184d8,null));};exports[_0xe108('0x4f')]=function(_0x1eb1fc,_0x1a05f8,_0x1a361a){var _0x18f0ff={};var _0x4ff3d6={};var _0x377b95;var _0x120481;return db[_0xe108('0x43')][_0xe108('0x50')]({'where':{'id':_0x1eb1fc['params']['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x1a05f8,null))[_0xe108('0x27')](function(_0x562bf0){if(_0x562bf0){_0x377b95=_0x562bf0;_0x4ff3d6[_0xe108('0x31')]=_[_0xe108('0x32')](db['Dynamics365Field']['rawAttributes']);_0x4ff3d6[_0xe108('0x33')]=_[_0xe108('0x32')](_0x1eb1fc[_0xe108('0x33')]);_0x4ff3d6[_0xe108('0x34')]=_['intersection'](_0x4ff3d6['model'],_0x4ff3d6[_0xe108('0x33')]);_0x18f0ff[_0xe108('0x36')]=_[_0xe108('0x35')](_0x4ff3d6[_0xe108('0x31')],qs[_0xe108('0x37')](_0x1eb1fc[_0xe108('0x33')][_0xe108('0x37')]));_0x18f0ff[_0xe108('0x36')]=_0x18f0ff['attributes'][_0xe108('0x38')]?_0x18f0ff[_0xe108('0x36')]:_0x4ff3d6[_0xe108('0x31')];_0x18f0ff[_0xe108('0x3b')]=qs['sort'](_0x1eb1fc[_0xe108('0x33')][_0xe108('0x3c')]);_0x18f0ff[_0xe108('0x3d')]=qs[_0xe108('0x34')](_[_0xe108('0x3e')](_0x1eb1fc['query'],_0x4ff3d6[_0xe108('0x34')]));if(_0x1eb1fc[_0xe108('0x33')][_0xe108('0x3f')]){_0x18f0ff[_0xe108('0x3d')]=_[_0xe108('0x4a')](_0x18f0ff['where'],{'$or':_['map'](_0x18f0ff[_0xe108('0x36')],function(_0x4c2d83){var _0x1c53b8={};_0x1c53b8[_0x4c2d83]={'$like':'%'+_0x1eb1fc[_0xe108('0x33')][_0xe108('0x3f')]+'%'};return _0x1c53b8;})});}_0x18f0ff=_['merge']({},_0x18f0ff,_0x1eb1fc[_0xe108('0x41')]);return _0x377b95[_0xe108('0x4f')](_0x18f0ff);}})[_0xe108('0x27')](function(_0x3192d4){if(_0x3192d4){_0x120481=_0x3192d4[_0xe108('0x38')];if(!_0x1eb1fc[_0xe108('0x33')][_0xe108('0x39')]('nolimit')){_0x18f0ff[_0xe108('0x21')]=qs[_0xe108('0x21')](_0x1eb1fc[_0xe108('0x33')][_0xe108('0x21')]);_0x18f0ff[_0xe108('0x1f')]=qs[_0xe108('0x1f')](_0x1eb1fc[_0xe108('0x33')]['offset']);}return _0x377b95[_0xe108('0x4f')](_0x18f0ff);}})[_0xe108('0x27')](function(_0x3bcad4){if(_0x3bcad4){return _0x3bcad4?{'count':_0x120481,'rows':_0x3bcad4}:null;}})[_0xe108('0x27')](respondWithResult(_0x1a05f8,null))['catch'](handleError(_0x1a05f8,null));};exports['getSubjects']=function(_0x5c9e0a,_0x18ded8,_0x1a16a4){var _0x3c54e5={};var _0x319c48={};var _0x38819a;var _0x35cc9f;return db[_0xe108('0x43')][_0xe108('0x50')]({'where':{'id':_0x5c9e0a[_0xe108('0x4e')]['id']}})[_0xe108('0x27')](handleEntityNotFound(_0x18ded8,null))[_0xe108('0x27')](function(_0x5a127f){if(_0x5a127f){_0x38819a=_0x5a127f;_0x319c48[_0xe108('0x31')]=_[_0xe108('0x32')](db[_0xe108('0x51')][_0xe108('0x48')]);_0x319c48[_0xe108('0x33')]=_[_0xe108('0x32')](_0x5c9e0a[_0xe108('0x33')]);_0x319c48['filters']=_[_0xe108('0x35')](_0x319c48[_0xe108('0x31')],_0x319c48['query']);_0x3c54e5[_0xe108('0x36')]=_[_0xe108('0x35')](_0x319c48[_0xe108('0x31')],qs[_0xe108('0x37')](_0x5c9e0a[_0xe108('0x33')][_0xe108('0x37')]));_0x3c54e5[_0xe108('0x36')]=_0x3c54e5['attributes']['length']?_0x3c54e5[_0xe108('0x36')]:_0x319c48[_0xe108('0x31')];_0x3c54e5['order']=qs['sort'](_0x5c9e0a[_0xe108('0x33')][_0xe108('0x3c')]);_0x3c54e5[_0xe108('0x3d')]=qs[_0xe108('0x34')](_[_0xe108('0x3e')](_0x5c9e0a[_0xe108('0x33')],_0x319c48['filters']));if(_0x5c9e0a['query'][_0xe108('0x3f')]){_0x3c54e5[_0xe108('0x3d')]=_[_0xe108('0x4a')](_0x3c54e5['where'],{'$or':_[_0xe108('0x2d')](_0x3c54e5['attributes'],function(_0x316b0f){var _0x5dddd9={};_0x5dddd9[_0x316b0f]={'$like':'%'+_0x5c9e0a[_0xe108('0x33')]['filter']+'%'};return _0x5dddd9;})});}_0x3c54e5=_[_0xe108('0x4a')]({},_0x3c54e5,_0x5c9e0a['options']);return _0x38819a[_0xe108('0x52')](_0x3c54e5);}})['then'](function(_0x40b21){if(_0x40b21){_0x35cc9f=_0x40b21['length'];if(!_0x5c9e0a['query'][_0xe108('0x39')](_0xe108('0x3a'))){_0x3c54e5[_0xe108('0x21')]=qs[_0xe108('0x21')](_0x5c9e0a['query']['limit']);_0x3c54e5['offset']=qs['offset'](_0x5c9e0a['query'][_0xe108('0x1f')]);}return _0x38819a['getSubjects'](_0x3c54e5);}})[_0xe108('0x27')](function(_0x8119df){if(_0x8119df){return _0x8119df?{'count':_0x35cc9f,'rows':_0x8119df}:null;}})['then'](respondWithResult(_0x18ded8,null))['catch'](handleError(_0x18ded8,null));};exports[_0xe108('0x53')]=function(_0x34be0d,_0x1ac920,_0x77efc5){var _0x40cb7d={};var _0x425b0c={};var _0x5d1db2;var _0x478d4c;return db[_0xe108('0x43')][_0xe108('0x50')]({'where':{'id':_0x34be0d[_0xe108('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ac920,null))[_0xe108('0x27')](function(_0x4edd94){if(_0x4edd94){_0x5d1db2=_0x4edd94;_0x425b0c[_0xe108('0x31')]=_['keys'](db[_0xe108('0x51')]['rawAttributes']);_0x425b0c[_0xe108('0x33')]=_[_0xe108('0x32')](_0x34be0d['query']);_0x425b0c[_0xe108('0x34')]=_[_0xe108('0x35')](_0x425b0c[_0xe108('0x31')],_0x425b0c[_0xe108('0x33')]);_0x40cb7d[_0xe108('0x36')]=_[_0xe108('0x35')](_0x425b0c[_0xe108('0x31')],qs[_0xe108('0x37')](_0x34be0d[_0xe108('0x33')][_0xe108('0x37')]));_0x40cb7d[_0xe108('0x36')]=_0x40cb7d[_0xe108('0x36')]['length']?_0x40cb7d[_0xe108('0x36')]:_0x425b0c['model'];_0x40cb7d[_0xe108('0x3b')]=qs[_0xe108('0x3c')](_0x34be0d['query'][_0xe108('0x3c')]);_0x40cb7d[_0xe108('0x3d')]=qs[_0xe108('0x34')](_['pick'](_0x34be0d[_0xe108('0x33')],_0x425b0c['filters']));if(_0x34be0d[_0xe108('0x33')]['filter']){_0x40cb7d['where']=_[_0xe108('0x4a')](_0x40cb7d[_0xe108('0x3d')],{'$or':_[_0xe108('0x2d')](_0x40cb7d['attributes'],function(_0x238a64){var _0xc8bad9={};_0xc8bad9[_0x238a64]={'$like':'%'+_0x34be0d[_0xe108('0x33')]['filter']+'%'};return _0xc8bad9;})});}_0x40cb7d=_[_0xe108('0x4a')]({},_0x40cb7d,_0x34be0d[_0xe108('0x41')]);return _0x5d1db2[_0xe108('0x53')](_0x40cb7d);}})[_0xe108('0x27')](function(_0x5cceea){if(_0x5cceea){_0x478d4c=_0x5cceea[_0xe108('0x38')];if(!_0x34be0d['query'][_0xe108('0x39')](_0xe108('0x3a'))){_0x40cb7d[_0xe108('0x21')]=qs[_0xe108('0x21')](_0x34be0d['query']['limit']);_0x40cb7d[_0xe108('0x1f')]=qs['offset'](_0x34be0d[_0xe108('0x33')][_0xe108('0x1f')]);}return _0x5d1db2[_0xe108('0x53')](_0x40cb7d);}})['then'](function(_0x5c2293){if(_0x5c2293){return _0x5c2293?{'count':_0x478d4c,'rows':_0x5c2293}:null;}})[_0xe108('0x27')](respondWithResult(_0x1ac920,null))['catch'](handleError(_0x1ac920,null));}; \ No newline at end of file +var _0xd02c=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','merge','includeAll','findAll','catch','params','rawAttributes','include','options','find','create','body','findOne','Dynamics365Field','order','filter','getFields','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Configuration','type','key','keys','query'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd02c,0x6c));var _0xcd02=function(_0x4b0ede,_0x1a337d){_0x4b0ede=_0x4b0ede-0x0;var _0x425a0f=_0xd02c[_0x4b0ede];return _0x425a0f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcd02('0x0'));var rp=require(_0xcd02('0x1'));var moment=require(_0xcd02('0x2'));var BPromise=require(_0xcd02('0x3'));var Mustache=require(_0xcd02('0x4'));var util=require('util');var path=require(_0xcd02('0x5'));var sox=require(_0xcd02('0x6'));var csv=require(_0xcd02('0x7'));var ejs=require(_0xcd02('0x8'));var fs=require('fs');var fs_extra=require(_0xcd02('0x9'));var _=require(_0xcd02('0xa'));var squel=require(_0xcd02('0xb'));var crypto=require('crypto');var jsforce=require(_0xcd02('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcd02('0x7'));var querystring=require(_0xcd02('0xd'));var Papa=require(_0xcd02('0xe'));var Redis=require(_0xcd02('0xf'));var authService=require(_0xcd02('0x10'));var qs=require(_0xcd02('0x11'));var as=require(_0xcd02('0x12'));var hardwareService=require(_0xcd02('0x13'));var logger=require(_0xcd02('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcd02('0x15'));var db=require(_0xcd02('0x16'))['db'];function respondWithStatusCode(_0xa5cd23,_0xded145){_0xded145=_0xded145||0xcc;return function(_0x27e677){if(_0x27e677){return _0xa5cd23[_0xcd02('0x17')](_0xded145);}return _0xa5cd23[_0xcd02('0x18')](_0xded145)[_0xcd02('0x19')]();};}function respondWithResult(_0x1a1a0b,_0x95839c){_0x95839c=_0x95839c||0xc8;return function(_0x449aad){if(_0x449aad){return _0x1a1a0b[_0xcd02('0x18')](_0x95839c)[_0xcd02('0x1a')](_0x449aad);}};}function respondWithFilteredResult(_0x58f341,_0xbfa870){return function(_0x11ec4){if(_0x11ec4){var _0x548787=typeof _0xbfa870['offset']===_0xcd02('0x1b')&&typeof _0xbfa870[_0xcd02('0x1c')]===_0xcd02('0x1b');var _0x3acceb=_0x11ec4['count'];var _0x2b6610=_0x548787?0x0:_0xbfa870[_0xcd02('0x1d')];var _0x37f770=_0x548787?_0x11ec4[_0xcd02('0x1e')]:_0xbfa870['offset']+_0xbfa870[_0xcd02('0x1c')];var _0x1a6dbc;if(_0x37f770>=_0x3acceb){_0x37f770=_0x3acceb;_0x1a6dbc=0xc8;}else{_0x1a6dbc=0xce;}_0x58f341[_0xcd02('0x18')](_0x1a6dbc);return _0x58f341[_0xcd02('0x1f')](_0xcd02('0x20'),_0x2b6610+'-'+_0x37f770+'/'+_0x3acceb)[_0xcd02('0x1a')](_0x11ec4);}return null;};}function patchUpdates(_0x44a6de){return function(_0x36599a){try{jsonpatch[_0xcd02('0x21')](_0x36599a,_0x44a6de,!![]);}catch(_0x4a9ff0){return BPromise[_0xcd02('0x22')](_0x4a9ff0);}return _0x36599a[_0xcd02('0x23')]();};}function saveUpdates(_0x4b843d,_0x14675c){return function(_0x13466c){if(_0x13466c){return _0x13466c[_0xcd02('0x24')](_0x4b843d)[_0xcd02('0x25')](function(_0x196e61){return _0x196e61;});}return null;};}function removeEntity(_0x5d1517,_0x5e0112){return function(_0xaaf162){if(_0xaaf162){return _0xaaf162['destroy']()[_0xcd02('0x25')](function(){_0x5d1517[_0xcd02('0x18')](0xcc)[_0xcd02('0x19')]();});}};}function handleEntityNotFound(_0xcfdee1,_0x48b44f){return function(_0xd99902){if(!_0xd99902){_0xcfdee1[_0xcd02('0x17')](0x194);}return _0xd99902;};}function handleError(_0x2fee89,_0x203a7c){_0x203a7c=_0x203a7c||0x1f4;return function(_0x1122ae){logger['error'](_0x1122ae[_0xcd02('0x26')]);if(_0x1122ae['name']){delete _0x1122ae[_0xcd02('0x27')];}_0x2fee89[_0xcd02('0x18')](_0x203a7c)[_0xcd02('0x28')](_0x1122ae);};}exports[_0xcd02('0x29')]=function(_0x429bbd,_0xe82616){var _0x12b8f0={},_0x4d792f={},_0x459408={'count':0x0,'rows':[]};var _0x38809=_[_0xcd02('0x2a')](db[_0xcd02('0x2b')]['rawAttributes'],function(_0x193a84){return{'name':_0x193a84['fieldName'],'type':_0x193a84[_0xcd02('0x2c')][_0xcd02('0x2d')]};});_0x4d792f['model']=_[_0xcd02('0x2a')](_0x38809,'name');_0x4d792f['query']=_[_0xcd02('0x2e')](_0x429bbd[_0xcd02('0x2f')]);_0x4d792f['filters']=_[_0xcd02('0x30')](_0x4d792f['model'],_0x4d792f[_0xcd02('0x2f')]);_0x12b8f0['attributes']=_[_0xcd02('0x30')](_0x4d792f[_0xcd02('0x31')],qs[_0xcd02('0x32')](_0x429bbd[_0xcd02('0x2f')][_0xcd02('0x32')]));_0x12b8f0[_0xcd02('0x33')]=_0x12b8f0[_0xcd02('0x33')][_0xcd02('0x34')]?_0x12b8f0[_0xcd02('0x33')]:_0x4d792f[_0xcd02('0x31')];if(!_0x429bbd['query'][_0xcd02('0x35')](_0xcd02('0x36'))){_0x12b8f0['limit']=qs[_0xcd02('0x1c')](_0x429bbd[_0xcd02('0x2f')][_0xcd02('0x1c')]);_0x12b8f0[_0xcd02('0x1d')]=qs[_0xcd02('0x1d')](_0x429bbd['query'][_0xcd02('0x1d')]);}_0x12b8f0['order']=qs['sort'](_0x429bbd['query'][_0xcd02('0x37')]);_0x12b8f0['where']=qs[_0xcd02('0x38')](_[_0xcd02('0x39')](_0x429bbd[_0xcd02('0x2f')],_0x4d792f['filters']),_0x38809);if(_0x429bbd['query']['filter']){_0x12b8f0[_0xcd02('0x3a')]=_['merge'](_0x12b8f0[_0xcd02('0x3a')],{'$or':_[_0xcd02('0x2a')](_0x38809,function(_0x3331a9){if(_0x3331a9[_0xcd02('0x2c')]!==_0xcd02('0x3b')){var _0x14f87f={};_0x14f87f[_0x3331a9[_0xcd02('0x27')]]={'$like':'%'+_0x429bbd['query']['filter']+'%'};return _0x14f87f;}})});}_0x12b8f0=_[_0xcd02('0x3c')]({},_0x12b8f0,_0x429bbd['options']);var _0x4fa11d={'where':_0x12b8f0[_0xcd02('0x3a')]};return db[_0xcd02('0x2b')]['count'](_0x4fa11d)[_0xcd02('0x25')](function(_0x575bc9){_0x459408[_0xcd02('0x1e')]=_0x575bc9;if(_0x429bbd[_0xcd02('0x2f')][_0xcd02('0x3d')]){_0x12b8f0['include']=[{'all':!![]}];}return db[_0xcd02('0x2b')][_0xcd02('0x3e')](_0x12b8f0);})[_0xcd02('0x25')](function(_0x2f1433){_0x459408['rows']=_0x2f1433;return _0x459408;})[_0xcd02('0x25')](respondWithFilteredResult(_0xe82616,_0x12b8f0))[_0xcd02('0x3f')](handleError(_0xe82616,null));};exports['show']=function(_0x270e27,_0x4dcf1c){var _0x44476e={'raw':![],'where':{'id':_0x270e27[_0xcd02('0x40')]['id']}},_0x3edd0c={};_0x3edd0c['model']=_[_0xcd02('0x2e')](db[_0xcd02('0x2b')][_0xcd02('0x41')]);_0x3edd0c[_0xcd02('0x2f')]=_[_0xcd02('0x2e')](_0x270e27['query']);_0x3edd0c[_0xcd02('0x38')]=_[_0xcd02('0x30')](_0x3edd0c[_0xcd02('0x31')],_0x3edd0c[_0xcd02('0x2f')]);_0x44476e['attributes']=_[_0xcd02('0x30')](_0x3edd0c['model'],qs[_0xcd02('0x32')](_0x270e27[_0xcd02('0x2f')][_0xcd02('0x32')]));_0x44476e[_0xcd02('0x33')]=_0x44476e[_0xcd02('0x33')][_0xcd02('0x34')]?_0x44476e[_0xcd02('0x33')]:_0x3edd0c[_0xcd02('0x31')];if(_0x270e27['query'][_0xcd02('0x3d')]){_0x44476e[_0xcd02('0x42')]=[{'all':!![]}];}_0x44476e=_[_0xcd02('0x3c')]({},_0x44476e,_0x270e27[_0xcd02('0x43')]);return db[_0xcd02('0x2b')][_0xcd02('0x44')](_0x44476e)[_0xcd02('0x25')](handleEntityNotFound(_0x4dcf1c,null))[_0xcd02('0x25')](respondWithResult(_0x4dcf1c,null))[_0xcd02('0x3f')](handleError(_0x4dcf1c,null));};exports[_0xcd02('0x45')]=function(_0x3c8886,_0x10cf11){return db[_0xcd02('0x2b')][_0xcd02('0x45')](_0x3c8886[_0xcd02('0x46')],{})[_0xcd02('0x25')](respondWithResult(_0x10cf11,0xc9))[_0xcd02('0x3f')](handleError(_0x10cf11,null));};exports[_0xcd02('0x24')]=function(_0x20c9fb,_0x141c7e){if(_0x20c9fb[_0xcd02('0x46')]['id']){delete _0x20c9fb[_0xcd02('0x46')]['id'];}return db[_0xcd02('0x2b')]['find']({'where':{'id':_0x20c9fb[_0xcd02('0x40')]['id']}})[_0xcd02('0x25')](handleEntityNotFound(_0x141c7e,null))[_0xcd02('0x25')](saveUpdates(_0x20c9fb[_0xcd02('0x46')],null))['then'](respondWithResult(_0x141c7e,null))['catch'](handleError(_0x141c7e,null));};exports['destroy']=function(_0x330159,_0x1b3def){return db[_0xcd02('0x2b')][_0xcd02('0x44')]({'where':{'id':_0x330159['params']['id']}})[_0xcd02('0x25')](handleEntityNotFound(_0x1b3def,null))['then'](removeEntity(_0x1b3def,null))[_0xcd02('0x3f')](handleError(_0x1b3def,null));};exports['getFields']=function(_0x3c49bd,_0x5e8213,_0x312e65){var _0x4ad22c={};var _0x367110={};var _0x52fe63;var _0x2b5d06;return db['Dynamics365Configuration'][_0xcd02('0x47')]({'where':{'id':_0x3c49bd[_0xcd02('0x40')]['id']}})[_0xcd02('0x25')](handleEntityNotFound(_0x5e8213,null))['then'](function(_0x146c0b){if(_0x146c0b){_0x52fe63=_0x146c0b;_0x367110[_0xcd02('0x31')]=_[_0xcd02('0x2e')](db[_0xcd02('0x48')][_0xcd02('0x41')]);_0x367110[_0xcd02('0x2f')]=_[_0xcd02('0x2e')](_0x3c49bd[_0xcd02('0x2f')]);_0x367110['filters']=_[_0xcd02('0x30')](_0x367110[_0xcd02('0x31')],_0x367110[_0xcd02('0x2f')]);_0x4ad22c[_0xcd02('0x33')]=_[_0xcd02('0x30')](_0x367110['model'],qs[_0xcd02('0x32')](_0x3c49bd['query'][_0xcd02('0x32')]));_0x4ad22c[_0xcd02('0x33')]=_0x4ad22c[_0xcd02('0x33')][_0xcd02('0x34')]?_0x4ad22c['attributes']:_0x367110[_0xcd02('0x31')];_0x4ad22c[_0xcd02('0x49')]=qs[_0xcd02('0x37')](_0x3c49bd[_0xcd02('0x2f')][_0xcd02('0x37')]);_0x4ad22c['where']=qs[_0xcd02('0x38')](_[_0xcd02('0x39')](_0x3c49bd[_0xcd02('0x2f')],_0x367110[_0xcd02('0x38')]));if(_0x3c49bd[_0xcd02('0x2f')]['filter']){_0x4ad22c[_0xcd02('0x3a')]=_[_0xcd02('0x3c')](_0x4ad22c[_0xcd02('0x3a')],{'$or':_[_0xcd02('0x2a')](_0x4ad22c[_0xcd02('0x33')],function(_0x4a504d){var _0x536bb0={};_0x536bb0[_0x4a504d]={'$like':'%'+_0x3c49bd['query'][_0xcd02('0x4a')]+'%'};return _0x536bb0;})});}_0x4ad22c=_['merge']({},_0x4ad22c,_0x3c49bd[_0xcd02('0x43')]);return _0x52fe63[_0xcd02('0x4b')](_0x4ad22c);}})[_0xcd02('0x25')](function(_0x2e7725){if(_0x2e7725){_0x2b5d06=_0x2e7725[_0xcd02('0x34')];if(!_0x3c49bd[_0xcd02('0x2f')]['hasOwnProperty']('nolimit')){_0x4ad22c[_0xcd02('0x1c')]=qs[_0xcd02('0x1c')](_0x3c49bd['query'][_0xcd02('0x1c')]);_0x4ad22c[_0xcd02('0x1d')]=qs[_0xcd02('0x1d')](_0x3c49bd[_0xcd02('0x2f')][_0xcd02('0x1d')]);}return _0x52fe63[_0xcd02('0x4b')](_0x4ad22c);}})[_0xcd02('0x25')](function(_0x4ec6e5){if(_0x4ec6e5){return _0x4ec6e5?{'count':_0x2b5d06,'rows':_0x4ec6e5}:null;}})[_0xcd02('0x25')](respondWithResult(_0x5e8213,null))[_0xcd02('0x3f')](handleError(_0x5e8213,null));};exports[_0xcd02('0x4c')]=function(_0x2e66e8,_0x2c05ee,_0x1bdbbb){var _0x51dbca={};var _0x4a713e={};var _0x234d4e;var _0x4ff03d;return db[_0xcd02('0x2b')][_0xcd02('0x47')]({'where':{'id':_0x2e66e8[_0xcd02('0x40')]['id']}})[_0xcd02('0x25')](handleEntityNotFound(_0x2c05ee,null))['then'](function(_0x1ac7de){if(_0x1ac7de){_0x234d4e=_0x1ac7de;_0x4a713e['model']=_[_0xcd02('0x2e')](db[_0xcd02('0x48')][_0xcd02('0x41')]);_0x4a713e[_0xcd02('0x2f')]=_['keys'](_0x2e66e8[_0xcd02('0x2f')]);_0x4a713e[_0xcd02('0x38')]=_[_0xcd02('0x30')](_0x4a713e[_0xcd02('0x31')],_0x4a713e[_0xcd02('0x2f')]);_0x51dbca[_0xcd02('0x33')]=_[_0xcd02('0x30')](_0x4a713e[_0xcd02('0x31')],qs['fields'](_0x2e66e8[_0xcd02('0x2f')][_0xcd02('0x32')]));_0x51dbca[_0xcd02('0x33')]=_0x51dbca[_0xcd02('0x33')]['length']?_0x51dbca[_0xcd02('0x33')]:_0x4a713e[_0xcd02('0x31')];_0x51dbca[_0xcd02('0x49')]=qs[_0xcd02('0x37')](_0x2e66e8[_0xcd02('0x2f')][_0xcd02('0x37')]);_0x51dbca['where']=qs[_0xcd02('0x38')](_[_0xcd02('0x39')](_0x2e66e8[_0xcd02('0x2f')],_0x4a713e[_0xcd02('0x38')]));if(_0x2e66e8[_0xcd02('0x2f')]['filter']){_0x51dbca[_0xcd02('0x3a')]=_['merge'](_0x51dbca['where'],{'$or':_[_0xcd02('0x2a')](_0x51dbca[_0xcd02('0x33')],function(_0x4d721b){var _0x11cec3={};_0x11cec3[_0x4d721b]={'$like':'%'+_0x2e66e8[_0xcd02('0x2f')][_0xcd02('0x4a')]+'%'};return _0x11cec3;})});}_0x51dbca=_[_0xcd02('0x3c')]({},_0x51dbca,_0x2e66e8['options']);return _0x234d4e[_0xcd02('0x4c')](_0x51dbca);}})[_0xcd02('0x25')](function(_0x2feb2f){if(_0x2feb2f){_0x4ff03d=_0x2feb2f['length'];if(!_0x2e66e8[_0xcd02('0x2f')][_0xcd02('0x35')]('nolimit')){_0x51dbca['limit']=qs['limit'](_0x2e66e8['query'][_0xcd02('0x1c')]);_0x51dbca[_0xcd02('0x1d')]=qs[_0xcd02('0x1d')](_0x2e66e8[_0xcd02('0x2f')][_0xcd02('0x1d')]);}return _0x234d4e[_0xcd02('0x4c')](_0x51dbca);}})[_0xcd02('0x25')](function(_0x38e7b0){if(_0x38e7b0){return _0x38e7b0?{'count':_0x4ff03d,'rows':_0x38e7b0}:null;}})[_0xcd02('0x25')](respondWithResult(_0x2c05ee,null))[_0xcd02('0x3f')](handleError(_0x2c05ee,null));};exports[_0xcd02('0x4d')]=function(_0x339155,_0x4852da,_0x136c34){var _0x44479e={};var _0x45c34f={};var _0x1ffa80;var _0x1afb01;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x339155[_0xcd02('0x40')]['id']}})[_0xcd02('0x25')](handleEntityNotFound(_0x4852da,null))[_0xcd02('0x25')](function(_0x431173){if(_0x431173){_0x1ffa80=_0x431173;_0x45c34f[_0xcd02('0x31')]=_[_0xcd02('0x2e')](db[_0xcd02('0x48')][_0xcd02('0x41')]);_0x45c34f[_0xcd02('0x2f')]=_[_0xcd02('0x2e')](_0x339155['query']);_0x45c34f[_0xcd02('0x38')]=_['intersection'](_0x45c34f[_0xcd02('0x31')],_0x45c34f[_0xcd02('0x2f')]);_0x44479e['attributes']=_[_0xcd02('0x30')](_0x45c34f[_0xcd02('0x31')],qs[_0xcd02('0x32')](_0x339155[_0xcd02('0x2f')][_0xcd02('0x32')]));_0x44479e[_0xcd02('0x33')]=_0x44479e[_0xcd02('0x33')]['length']?_0x44479e[_0xcd02('0x33')]:_0x45c34f[_0xcd02('0x31')];_0x44479e[_0xcd02('0x49')]=qs[_0xcd02('0x37')](_0x339155['query'][_0xcd02('0x37')]);_0x44479e[_0xcd02('0x3a')]=qs['filters'](_['pick'](_0x339155['query'],_0x45c34f[_0xcd02('0x38')]));if(_0x339155['query'][_0xcd02('0x4a')]){_0x44479e['where']=_['merge'](_0x44479e[_0xcd02('0x3a')],{'$or':_[_0xcd02('0x2a')](_0x44479e[_0xcd02('0x33')],function(_0x278ba1){var _0x1ceb50={};_0x1ceb50[_0x278ba1]={'$like':'%'+_0x339155['query'][_0xcd02('0x4a')]+'%'};return _0x1ceb50;})});}_0x44479e=_[_0xcd02('0x3c')]({},_0x44479e,_0x339155[_0xcd02('0x43')]);return _0x1ffa80[_0xcd02('0x4d')](_0x44479e);}})['then'](function(_0x3f313e){if(_0x3f313e){_0x1afb01=_0x3f313e[_0xcd02('0x34')];if(!_0x339155['query'][_0xcd02('0x35')](_0xcd02('0x36'))){_0x44479e['limit']=qs[_0xcd02('0x1c')](_0x339155[_0xcd02('0x2f')]['limit']);_0x44479e[_0xcd02('0x1d')]=qs[_0xcd02('0x1d')](_0x339155[_0xcd02('0x2f')][_0xcd02('0x1d')]);}return _0x1ffa80[_0xcd02('0x4d')](_0x44479e);}})[_0xcd02('0x25')](function(_0x41d684){if(_0x41d684){return _0x41d684?{'count':_0x1afb01,'rows':_0x41d684}:null;}})[_0xcd02('0x25')](respondWithResult(_0x4852da,null))[_0xcd02('0x3f')](handleError(_0x4852da,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 88852c0..64971fd 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x504c6d,_0x465664){var _0x25fce5=function(_0x28e695){while(--_0x28e695){_0x504c6d['push'](_0x504c6d['shift']());}};_0x25fce5(++_0x465664);}(_0x54ef,0x112));var _0xf54e=function(_0x56096e,_0x45ea43){_0x56096e=_0x56096e-0x0;var _0x4ecccd=_0x54ef[_0x56096e];return _0x4ecccd;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ebdc3,_0x8bd510){var _0x383b9e=function(_0x51dbb4){while(--_0x51dbb4){_0x1ebdc3['push'](_0x1ebdc3['shift']());}};_0x383b9e(++_0x8bd510);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0xb4e6[_0x1d426f];return _0x17f71a;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 4b13a32..5c51831 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 _0xc8b6=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xc8b6,0xd4));var _0x6c8b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xc8b6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6c8b('0x0'));var util=require(_0x6c8b('0x1'));var moment=require(_0x6c8b('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c8b('0x3'));var fs=require('fs');var Redis=require(_0x6c8b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c8b('0x5'));var logger=require(_0x6c8b('0x6'))(_0x6c8b('0x7'));var config=require(_0x6c8b('0x8'));var jayson=require(_0x6c8b('0x9'));var client=jayson[_0x6c8b('0xa')][_0x6c8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39ede0,_0x2f3434,_0x1d43b1){return new BPromise(function(_0x3852e8,_0x1c8d36){return client[_0x6c8b('0xc')](_0x39ede0,_0x1d43b1)[_0x6c8b('0xd')](function(_0x71d5c1){logger['info'](_0x6c8b('0xe'),_0x2f3434,_0x6c8b('0xf'));logger[_0x6c8b('0x10')](_0x6c8b('0x11'),_0x2f3434,_0x6c8b('0xf'),JSON[_0x6c8b('0x12')](_0x71d5c1));if(_0x71d5c1[_0x6c8b('0x13')]){if(_0x71d5c1['error'][_0x6c8b('0x14')]===0x1f4){logger[_0x6c8b('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2f3434,_0x71d5c1[_0x6c8b('0x13')][_0x6c8b('0x15')]);return _0x1c8d36(_0x71d5c1[_0x6c8b('0x13')][_0x6c8b('0x15')]);}logger[_0x6c8b('0x13')](_0x6c8b('0xe'),_0x2f3434,_0x71d5c1['error'][_0x6c8b('0x15')]);return _0x3852e8(_0x71d5c1[_0x6c8b('0x13')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2f3434,_0x6c8b('0xf'));_0x3852e8(_0x71d5c1[_0x6c8b('0x16')][_0x6c8b('0x15')]);}})['catch'](function(_0x552a01){logger['error'](_0x6c8b('0xe'),_0x2f3434,_0x552a01);_0x1c8d36(_0x552a01);});});} \ No newline at end of file +var _0xc9d3=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x3e3d12,_0x5d8c29){var _0x2685a8=function(_0x10943b){while(--_0x10943b){_0x3e3d12['push'](_0x3e3d12['shift']());}};_0x2685a8(++_0x5d8c29);}(_0xc9d3,0xf7));var _0x3c9d=function(_0x295ccd,_0x365b70){_0x295ccd=_0x295ccd-0x0;var _0x59c4a5=_0xc9d3[_0x295ccd];return _0x59c4a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c9d('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c9d('0x1'));var fs=require('fs');var Redis=require(_0x3c9d('0x2'));var db=require(_0x3c9d('0x3'))['db'];var utils=require(_0x3c9d('0x4'));var logger=require(_0x3c9d('0x5'))(_0x3c9d('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c9d('0x7'));var client=jayson[_0x3c9d('0x8')][_0x3c9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f8749,_0x854bd9,_0x16b87c){return new BPromise(function(_0x30f3e5,_0x343fd2){return client[_0x3c9d('0xa')](_0x2f8749,_0x16b87c)['then'](function(_0x4dd0b7){logger[_0x3c9d('0xb')](_0x3c9d('0xc'),_0x854bd9,_0x3c9d('0xd'));logger[_0x3c9d('0xe')](_0x3c9d('0xf'),_0x854bd9,'request\x20sent',JSON[_0x3c9d('0x10')](_0x4dd0b7));if(_0x4dd0b7['error']){if(_0x4dd0b7[_0x3c9d('0x11')]['code']===0x1f4){logger[_0x3c9d('0x11')](_0x3c9d('0xc'),_0x854bd9,_0x4dd0b7[_0x3c9d('0x11')][_0x3c9d('0x12')]);return _0x343fd2(_0x4dd0b7[_0x3c9d('0x11')][_0x3c9d('0x12')]);}logger[_0x3c9d('0x11')](_0x3c9d('0xc'),_0x854bd9,_0x4dd0b7['error']['message']);return _0x30f3e5(_0x4dd0b7[_0x3c9d('0x11')][_0x3c9d('0x12')]);}else{logger[_0x3c9d('0xb')](_0x3c9d('0xc'),_0x854bd9,_0x3c9d('0xd'));_0x30f3e5(_0x4dd0b7[_0x3c9d('0x13')][_0x3c9d('0x12')]);}})['catch'](function(_0x4ea4ef){logger['error'](_0x3c9d('0xc'),_0x854bd9,_0x4ea4ef);_0x343fd2(_0x4ea4ef);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3adbcc3..951912e 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 _0x139d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2f70d2,_0x49da1c){var _0x3581d0=function(_0x2824a8){while(--_0x2824a8){_0x2f70d2['push'](_0x2f70d2['shift']());}};_0x3581d0(++_0x49da1c);}(_0x139d,0x1c9));var _0xd139=function(_0x48f76a,_0x29b2ac){_0x48f76a=_0x48f76a-0x0;var _0x3385a6=_0x139d[_0x48f76a];return _0x3385a6;};'use strict';var multer=require(_0xd139('0x0'));var util=require(_0xd139('0x1'));var path=require(_0xd139('0x2'));var timeout=require(_0xd139('0x3'));var express=require(_0xd139('0x4'));var router=express[_0xd139('0x5')]();var fs_extra=require(_0xd139('0x6'));var auth=require(_0xd139('0x7'));var interaction=require(_0xd139('0x8'));var config=require(_0xd139('0x9'));var controller=require(_0xd139('0xa'));router[_0xd139('0xb')]('/',auth['isAuthenticated'](),controller[_0xd139('0xc')]);router[_0xd139('0xb')](_0xd139('0xd'),auth[_0xd139('0xe')](),controller[_0xd139('0xf')]);router['post']('/',auth[_0xd139('0xe')](),controller[_0xd139('0x10')]);router[_0xd139('0x11')](_0xd139('0xd'),auth[_0xd139('0xe')](),controller[_0xd139('0x12')]);router[_0xd139('0x13')](_0xd139('0xd'),auth['isAuthenticated'](),controller[_0xd139('0x14')]);module[_0xd139('0x15')]=router; \ No newline at end of file +var _0x19aa=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put'];(function(_0x172328,_0xeb050b){var _0x30db98=function(_0x2b77be){while(--_0x2b77be){_0x172328['push'](_0x172328['shift']());}};_0x30db98(++_0xeb050b);}(_0x19aa,0xc4));var _0xa19a=function(_0x1f62a9,_0xdb6a99){_0x1f62a9=_0x1f62a9-0x0;var _0x3115a2=_0x19aa[_0x1f62a9];return _0x3115a2;};'use strict';var multer=require(_0xa19a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa19a('0x1'));var express=require(_0xa19a('0x2'));var router=express[_0xa19a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa19a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa19a('0x5'));var controller=require('./intDynamics365Field.controller');router[_0xa19a('0x6')]('/',auth[_0xa19a('0x7')](),controller[_0xa19a('0x8')]);router[_0xa19a('0x6')](_0xa19a('0x9'),auth[_0xa19a('0x7')](),controller[_0xa19a('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa19a('0xb')](_0xa19a('0x9'),auth[_0xa19a('0x7')](),controller[_0xa19a('0xc')]);router[_0xa19a('0xd')](_0xa19a('0x9'),auth['isAuthenticated'](),controller[_0xa19a('0xe')]);module[_0xa19a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7ade0b5..6149dda 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 _0xb83a=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xb83a,0xc5));var _0xab83=function(_0x2f9d59,_0x89d5b1){_0x2f9d59=_0x2f9d59-0x0;var _0x18755d=_0xb83a[_0x2f9d59];return _0x18755d;};'use strict';var Sequelize=require(_0xab83('0x0'));module[_0xab83('0x1')]={'type':{'type':Sequelize[_0xab83('0x2')](_0xab83('0x3'),_0xab83('0x4'),_0xab83('0x5'),_0xab83('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xab83('0x7')]},'keyType':{'type':Sequelize[_0xab83('0x2')](_0xab83('0x3'),_0xab83('0x4'),_0xab83('0x5'))},'keyContent':{'type':Sequelize[_0xab83('0x7')]},'idField':{'type':Sequelize[_0xab83('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xab83('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab83('0x7')]}}; \ No newline at end of file +var _0xa921=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x3604ce,_0x45d75a){var _0x2708ca=function(_0x372998){while(--_0x372998){_0x3604ce['push'](_0x3604ce['shift']());}};_0x2708ca(++_0x45d75a);}(_0xa921,0x1b9));var _0x1a92=function(_0x5c6ef5,_0xa49019){_0x5c6ef5=_0x5c6ef5-0x0;var _0x744d0f=_0xa921[_0x5c6ef5];return _0x744d0f;};'use strict';var Sequelize=require(_0x1a92('0x0'));module[_0x1a92('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1a92('0x2'),_0x1a92('0x3'),_0x1a92('0x4'),_0x1a92('0x5'),'picklist'),'defaultValue':_0x1a92('0x2')},'content':{'type':Sequelize[_0x1a92('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1a92('0x7')](_0x1a92('0x2'),_0x1a92('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1a92('0x6')]},'idField':{'type':Sequelize[_0x1a92('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1a92('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1a92('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c1ac118..a1a6862 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 _0x37bc=['query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','Dynamics365Field','include','rows','catch','show','params','includeAll','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x37bc,0xb0));var _0xc37b=function(_0x1808aa,_0x26c66b){_0x1808aa=_0x1808aa-0x0;var _0x55d788=_0x37bc[_0x1808aa];return _0x55d788;};'use strict';var emlformat=require(_0xc37b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc37b('0x1'));var jsonpatch=require(_0xc37b('0x2'));var rp=require(_0xc37b('0x3'));var moment=require('moment');var BPromise=require(_0xc37b('0x4'));var Mustache=require(_0xc37b('0x5'));var util=require('util');var path=require(_0xc37b('0x6'));var sox=require(_0xc37b('0x7'));var csv=require(_0xc37b('0x8'));var ejs=require(_0xc37b('0x9'));var fs=require('fs');var fs_extra=require(_0xc37b('0xa'));var _=require(_0xc37b('0xb'));var squel=require(_0xc37b('0xc'));var crypto=require(_0xc37b('0xd'));var jsforce=require(_0xc37b('0xe'));var deskjs=require(_0xc37b('0xf'));var toCsv=require(_0xc37b('0x8'));var querystring=require(_0xc37b('0x10'));var Papa=require(_0xc37b('0x11'));var Redis=require(_0xc37b('0x12'));var authService=require(_0xc37b('0x13'));var qs=require(_0xc37b('0x14'));var as=require(_0xc37b('0x15'));var hardwareService=require(_0xc37b('0x16'));var logger=require(_0xc37b('0x17'))('api');var utils=require(_0xc37b('0x18'));var config=require(_0xc37b('0x19'));var licenseUtil=require(_0xc37b('0x1a'));var db=require(_0xc37b('0x1b'))['db'];function respondWithStatusCode(_0x27955b,_0x2fa4bb){_0x2fa4bb=_0x2fa4bb||0xcc;return function(_0x108390){if(_0x108390){return _0x27955b[_0xc37b('0x1c')](_0x2fa4bb);}return _0x27955b[_0xc37b('0x1d')](_0x2fa4bb)[_0xc37b('0x1e')]();};}function respondWithResult(_0x29e575,_0x43786f){_0x43786f=_0x43786f||0xc8;return function(_0x8b543f){if(_0x8b543f){return _0x29e575[_0xc37b('0x1d')](_0x43786f)['json'](_0x8b543f);}};}function respondWithFilteredResult(_0x2ddff0,_0x17b665){return function(_0x288569){if(_0x288569){var _0x2f73d8=typeof _0x17b665['offset']==='undefined'&&typeof _0x17b665[_0xc37b('0x1f')]==='undefined';var _0x4a42b1=_0x288569[_0xc37b('0x20')];var _0xdf455e=_0x2f73d8?0x0:_0x17b665[_0xc37b('0x21')];var _0x5e4bb6=_0x2f73d8?_0x288569[_0xc37b('0x20')]:_0x17b665[_0xc37b('0x21')]+_0x17b665['limit'];var _0xa5319d;if(_0x5e4bb6>=_0x4a42b1){_0x5e4bb6=_0x4a42b1;_0xa5319d=0xc8;}else{_0xa5319d=0xce;}_0x2ddff0[_0xc37b('0x1d')](_0xa5319d);return _0x2ddff0[_0xc37b('0x22')](_0xc37b('0x23'),_0xdf455e+'-'+_0x5e4bb6+'/'+_0x4a42b1)['json'](_0x288569);}return null;};}function patchUpdates(_0x11612a){return function(_0x4683fe){try{jsonpatch[_0xc37b('0x24')](_0x4683fe,_0x11612a,!![]);}catch(_0xa29a89){return BPromise[_0xc37b('0x25')](_0xa29a89);}return _0x4683fe[_0xc37b('0x26')]();};}function saveUpdates(_0x2ce2ff,_0x1f40c7){return function(_0x5357a0){if(_0x5357a0){return _0x5357a0[_0xc37b('0x27')](_0x2ce2ff)[_0xc37b('0x28')](function(_0x5068a9){return _0x5068a9;});}return null;};}function removeEntity(_0x3d8f03,_0x4b65d8){return function(_0x58a6f0){if(_0x58a6f0){return _0x58a6f0[_0xc37b('0x29')]()[_0xc37b('0x28')](function(){_0x3d8f03[_0xc37b('0x1d')](0xcc)[_0xc37b('0x1e')]();});}};}function handleEntityNotFound(_0x4d7d47,_0x3d1118){return function(_0x159c73){if(!_0x159c73){_0x4d7d47[_0xc37b('0x1c')](0x194);}return _0x159c73;};}function handleError(_0x34f69a,_0x5be868){_0x5be868=_0x5be868||0x1f4;return function(_0x444fbe){logger['error'](_0x444fbe[_0xc37b('0x2a')]);if(_0x444fbe['name']){delete _0x444fbe[_0xc37b('0x2b')];}_0x34f69a[_0xc37b('0x1d')](_0x5be868)[_0xc37b('0x2c')](_0x444fbe);};}exports[_0xc37b('0x2d')]=function(_0x461de2,_0x242ced){var _0x3b1675={},_0x5e1307={},_0x59c024={'count':0x0,'rows':[]};var _0x123722=_['map'](db['Dynamics365Field'][_0xc37b('0x2e')],function(_0x1e6fec){return{'name':_0x1e6fec[_0xc37b('0x2f')],'type':_0x1e6fec[_0xc37b('0x30')]['key']};});_0x5e1307[_0xc37b('0x31')]=_[_0xc37b('0x32')](_0x123722,_0xc37b('0x2b'));_0x5e1307['query']=_[_0xc37b('0x33')](_0x461de2[_0xc37b('0x34')]);_0x5e1307[_0xc37b('0x35')]=_[_0xc37b('0x36')](_0x5e1307['model'],_0x5e1307[_0xc37b('0x34')]);_0x3b1675[_0xc37b('0x37')]=_['intersection'](_0x5e1307[_0xc37b('0x31')],qs[_0xc37b('0x38')](_0x461de2[_0xc37b('0x34')]['fields']));_0x3b1675['attributes']=_0x3b1675[_0xc37b('0x37')][_0xc37b('0x39')]?_0x3b1675[_0xc37b('0x37')]:_0x5e1307[_0xc37b('0x31')];if(!_0x461de2[_0xc37b('0x34')]['hasOwnProperty']('nolimit')){_0x3b1675['limit']=qs[_0xc37b('0x1f')](_0x461de2['query']['limit']);_0x3b1675['offset']=qs[_0xc37b('0x21')](_0x461de2[_0xc37b('0x34')]['offset']);}_0x3b1675[_0xc37b('0x3a')]=qs[_0xc37b('0x3b')](_0x461de2[_0xc37b('0x34')]['sort']);_0x3b1675[_0xc37b('0x3c')]=qs['filters'](_[_0xc37b('0x3d')](_0x461de2[_0xc37b('0x34')],_0x5e1307[_0xc37b('0x35')]),_0x123722);if(_0x461de2[_0xc37b('0x34')]['filter']){_0x3b1675[_0xc37b('0x3c')]=_[_0xc37b('0x3e')](_0x3b1675['where'],{'$or':_[_0xc37b('0x32')](_0x123722,function(_0x29f18c){if(_0x29f18c[_0xc37b('0x30')]!==_0xc37b('0x3f')){var _0x258105={};_0x258105[_0x29f18c[_0xc37b('0x2b')]]={'$like':'%'+_0x461de2[_0xc37b('0x34')][_0xc37b('0x40')]+'%'};return _0x258105;}})});}_0x3b1675=_[_0xc37b('0x3e')]({},_0x3b1675,_0x461de2['options']);var _0x23d7e4={'where':_0x3b1675[_0xc37b('0x3c')]};return db[_0xc37b('0x41')][_0xc37b('0x20')](_0x23d7e4)[_0xc37b('0x28')](function(_0x13fabf){_0x59c024[_0xc37b('0x20')]=_0x13fabf;if(_0x461de2[_0xc37b('0x34')]['includeAll']){_0x3b1675[_0xc37b('0x42')]=[{'all':!![]}];}return db[_0xc37b('0x41')]['findAll'](_0x3b1675);})[_0xc37b('0x28')](function(_0x4a07ac){_0x59c024[_0xc37b('0x43')]=_0x4a07ac;return _0x59c024;})['then'](respondWithFilteredResult(_0x242ced,_0x3b1675))[_0xc37b('0x44')](handleError(_0x242ced,null));};exports[_0xc37b('0x45')]=function(_0x3ef296,_0xeec854){var _0x23e5ff={'raw':!![],'where':{'id':_0x3ef296[_0xc37b('0x46')]['id']}},_0x26de51={};_0x26de51[_0xc37b('0x31')]=_['keys'](db['Dynamics365Field'][_0xc37b('0x2e')]);_0x26de51[_0xc37b('0x34')]=_[_0xc37b('0x33')](_0x3ef296[_0xc37b('0x34')]);_0x26de51[_0xc37b('0x35')]=_[_0xc37b('0x36')](_0x26de51['model'],_0x26de51[_0xc37b('0x34')]);_0x23e5ff[_0xc37b('0x37')]=_[_0xc37b('0x36')](_0x26de51[_0xc37b('0x31')],qs[_0xc37b('0x38')](_0x3ef296['query'][_0xc37b('0x38')]));_0x23e5ff[_0xc37b('0x37')]=_0x23e5ff[_0xc37b('0x37')][_0xc37b('0x39')]?_0x23e5ff[_0xc37b('0x37')]:_0x26de51[_0xc37b('0x31')];if(_0x3ef296[_0xc37b('0x34')][_0xc37b('0x47')]){_0x23e5ff[_0xc37b('0x42')]=[{'all':!![]}];}_0x23e5ff=_[_0xc37b('0x3e')]({},_0x23e5ff,_0x3ef296[_0xc37b('0x48')]);return db[_0xc37b('0x41')][_0xc37b('0x49')](_0x23e5ff)[_0xc37b('0x28')](handleEntityNotFound(_0xeec854,null))[_0xc37b('0x28')](respondWithResult(_0xeec854,null))[_0xc37b('0x44')](handleError(_0xeec854,null));};exports['create']=function(_0xf3d981,_0x5364aa){return db[_0xc37b('0x41')][_0xc37b('0x4a')](_0xf3d981[_0xc37b('0x4b')],{})['then'](respondWithResult(_0x5364aa,0xc9))[_0xc37b('0x44')](handleError(_0x5364aa,null));};exports['update']=function(_0x36a110,_0x11e1a2){if(_0x36a110['body']['id']){delete _0x36a110[_0xc37b('0x4b')]['id'];}return db['Dynamics365Field'][_0xc37b('0x49')]({'where':{'id':_0x36a110[_0xc37b('0x46')]['id']}})['then'](handleEntityNotFound(_0x11e1a2,null))['then'](saveUpdates(_0x36a110['body'],null))[_0xc37b('0x28')](respondWithResult(_0x11e1a2,null))['catch'](handleError(_0x11e1a2,null));};exports[_0xc37b('0x29')]=function(_0x3c9ff2,_0x208f12){return db['Dynamics365Field'][_0xc37b('0x49')]({'where':{'id':_0x3c9ff2[_0xc37b('0x46')]['id']}})[_0xc37b('0x28')](handleEntityNotFound(_0x208f12,null))[_0xc37b('0x28')](removeEntity(_0x208f12,null))[_0xc37b('0x44')](handleError(_0x208f12,null));}; \ No newline at end of file +var _0xd556=['status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','Dynamics365Field','includeAll','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x16af86,_0x518e6e){var _0x28f370=function(_0x574295){while(--_0x574295){_0x16af86['push'](_0x16af86['shift']());}};_0x28f370(++_0x518e6e);}(_0xd556,0x102));var _0x6d55=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd556[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x6d55('0x0'));var rimraf=require(_0x6d55('0x1'));var zipdir=require(_0x6d55('0x2'));var jsonpatch=require(_0x6d55('0x3'));var rp=require('request-promise');var moment=require(_0x6d55('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6d55('0x5'));var util=require(_0x6d55('0x6'));var path=require('path');var sox=require(_0x6d55('0x7'));var csv=require('to-csv');var ejs=require(_0x6d55('0x8'));var fs=require('fs');var fs_extra=require(_0x6d55('0x9'));var _=require(_0x6d55('0xa'));var squel=require(_0x6d55('0xb'));var crypto=require(_0x6d55('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6d55('0xd'));var toCsv=require(_0x6d55('0xe'));var querystring=require('querystring');var Papa=require(_0x6d55('0xf'));var Redis=require('ioredis');var authService=require(_0x6d55('0x10'));var qs=require(_0x6d55('0x11'));var as=require(_0x6d55('0x12'));var hardwareService=require(_0x6d55('0x13'));var logger=require(_0x6d55('0x14'))(_0x6d55('0x15'));var utils=require('../../config/utils');var config=require(_0x6d55('0x16'));var licenseUtil=require(_0x6d55('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3de0a6,_0x4efdbd){_0x4efdbd=_0x4efdbd||0xcc;return function(_0x3a6fa2){if(_0x3a6fa2){return _0x3de0a6[_0x6d55('0x18')](_0x4efdbd);}return _0x3de0a6['status'](_0x4efdbd)[_0x6d55('0x19')]();};}function respondWithResult(_0x8ebf1d,_0x3e8837){_0x3e8837=_0x3e8837||0xc8;return function(_0x494540){if(_0x494540){return _0x8ebf1d[_0x6d55('0x1a')](_0x3e8837)['json'](_0x494540);}};}function respondWithFilteredResult(_0x327811,_0xe8de13){return function(_0x3d2ecd){if(_0x3d2ecd){var _0x52803e=typeof _0xe8de13[_0x6d55('0x1b')]===_0x6d55('0x1c')&&typeof _0xe8de13[_0x6d55('0x1d')]===_0x6d55('0x1c');var _0x3ffc0c=_0x3d2ecd[_0x6d55('0x1e')];var _0x5dfb88=_0x52803e?0x0:_0xe8de13['offset'];var _0x5b202d=_0x52803e?_0x3d2ecd[_0x6d55('0x1e')]:_0xe8de13[_0x6d55('0x1b')]+_0xe8de13[_0x6d55('0x1d')];var _0x1542c5;if(_0x5b202d>=_0x3ffc0c){_0x5b202d=_0x3ffc0c;_0x1542c5=0xc8;}else{_0x1542c5=0xce;}_0x327811['status'](_0x1542c5);return _0x327811[_0x6d55('0x1f')](_0x6d55('0x20'),_0x5dfb88+'-'+_0x5b202d+'/'+_0x3ffc0c)['json'](_0x3d2ecd);}return null;};}function patchUpdates(_0x296fd5){return function(_0xe579dd){try{jsonpatch[_0x6d55('0x21')](_0xe579dd,_0x296fd5,!![]);}catch(_0x297d0d){return BPromise[_0x6d55('0x22')](_0x297d0d);}return _0xe579dd[_0x6d55('0x23')]();};}function saveUpdates(_0x243de3,_0x3a4ca5){return function(_0x512690){if(_0x512690){return _0x512690[_0x6d55('0x24')](_0x243de3)[_0x6d55('0x25')](function(_0x497314){return _0x497314;});}return null;};}function removeEntity(_0x521ca8,_0x2657c7){return function(_0x267bca){if(_0x267bca){return _0x267bca[_0x6d55('0x26')]()['then'](function(){_0x521ca8['status'](0xcc)[_0x6d55('0x19')]();});}};}function handleEntityNotFound(_0x17f874,_0x268106){return function(_0x3d9681){if(!_0x3d9681){_0x17f874['sendStatus'](0x194);}return _0x3d9681;};}function handleError(_0x28d8b7,_0x1af13b){_0x1af13b=_0x1af13b||0x1f4;return function(_0x152ce7){logger['error'](_0x152ce7[_0x6d55('0x27')]);if(_0x152ce7[_0x6d55('0x28')]){delete _0x152ce7[_0x6d55('0x28')];}_0x28d8b7[_0x6d55('0x1a')](_0x1af13b)['send'](_0x152ce7);};}exports[_0x6d55('0x29')]=function(_0x2c030e,_0x27a572){var _0x477c67={},_0x5be203={},_0x8d4136={'count':0x0,'rows':[]};var _0x3cfee2=_[_0x6d55('0x2a')](db['Dynamics365Field'][_0x6d55('0x2b')],function(_0x4e7bb4){return{'name':_0x4e7bb4['fieldName'],'type':_0x4e7bb4[_0x6d55('0x2c')][_0x6d55('0x2d')]};});_0x5be203[_0x6d55('0x2e')]=_[_0x6d55('0x2a')](_0x3cfee2,_0x6d55('0x28'));_0x5be203[_0x6d55('0x2f')]=_[_0x6d55('0x30')](_0x2c030e['query']);_0x5be203['filters']=_[_0x6d55('0x31')](_0x5be203['model'],_0x5be203[_0x6d55('0x2f')]);_0x477c67[_0x6d55('0x32')]=_['intersection'](_0x5be203['model'],qs[_0x6d55('0x33')](_0x2c030e[_0x6d55('0x2f')]['fields']));_0x477c67[_0x6d55('0x32')]=_0x477c67[_0x6d55('0x32')][_0x6d55('0x34')]?_0x477c67[_0x6d55('0x32')]:_0x5be203[_0x6d55('0x2e')];if(!_0x2c030e['query'][_0x6d55('0x35')]('nolimit')){_0x477c67[_0x6d55('0x1d')]=qs[_0x6d55('0x1d')](_0x2c030e[_0x6d55('0x2f')]['limit']);_0x477c67['offset']=qs[_0x6d55('0x1b')](_0x2c030e[_0x6d55('0x2f')]['offset']);}_0x477c67[_0x6d55('0x36')]=qs[_0x6d55('0x37')](_0x2c030e[_0x6d55('0x2f')][_0x6d55('0x37')]);_0x477c67[_0x6d55('0x38')]=qs[_0x6d55('0x39')](_['pick'](_0x2c030e['query'],_0x5be203[_0x6d55('0x39')]),_0x3cfee2);if(_0x2c030e[_0x6d55('0x2f')][_0x6d55('0x3a')]){_0x477c67[_0x6d55('0x38')]=_['merge'](_0x477c67[_0x6d55('0x38')],{'$or':_[_0x6d55('0x2a')](_0x3cfee2,function(_0xa768a2){if(_0xa768a2[_0x6d55('0x2c')]!=='VIRTUAL'){var _0x577860={};_0x577860[_0xa768a2[_0x6d55('0x28')]]={'$like':'%'+_0x2c030e[_0x6d55('0x2f')]['filter']+'%'};return _0x577860;}})});}_0x477c67=_[_0x6d55('0x3b')]({},_0x477c67,_0x2c030e[_0x6d55('0x3c')]);var _0x6b5e87={'where':_0x477c67[_0x6d55('0x38')]};return db[_0x6d55('0x3d')]['count'](_0x6b5e87)[_0x6d55('0x25')](function(_0x58f61b){_0x8d4136[_0x6d55('0x1e')]=_0x58f61b;if(_0x2c030e[_0x6d55('0x2f')][_0x6d55('0x3e')]){_0x477c67['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x6d55('0x3f')](_0x477c67);})[_0x6d55('0x25')](function(_0x159596){_0x8d4136[_0x6d55('0x40')]=_0x159596;return _0x8d4136;})[_0x6d55('0x25')](respondWithFilteredResult(_0x27a572,_0x477c67))[_0x6d55('0x41')](handleError(_0x27a572,null));};exports[_0x6d55('0x42')]=function(_0x13cf83,_0x2dba59){var _0x18b292={'raw':!![],'where':{'id':_0x13cf83[_0x6d55('0x43')]['id']}},_0x168c4c={};_0x168c4c[_0x6d55('0x2e')]=_['keys'](db[_0x6d55('0x3d')][_0x6d55('0x2b')]);_0x168c4c[_0x6d55('0x2f')]=_[_0x6d55('0x30')](_0x13cf83[_0x6d55('0x2f')]);_0x168c4c['filters']=_['intersection'](_0x168c4c['model'],_0x168c4c['query']);_0x18b292[_0x6d55('0x32')]=_[_0x6d55('0x31')](_0x168c4c['model'],qs['fields'](_0x13cf83['query'][_0x6d55('0x33')]));_0x18b292[_0x6d55('0x32')]=_0x18b292['attributes']['length']?_0x18b292[_0x6d55('0x32')]:_0x168c4c[_0x6d55('0x2e')];if(_0x13cf83[_0x6d55('0x2f')][_0x6d55('0x3e')]){_0x18b292['include']=[{'all':!![]}];}_0x18b292=_[_0x6d55('0x3b')]({},_0x18b292,_0x13cf83[_0x6d55('0x3c')]);return db[_0x6d55('0x3d')]['find'](_0x18b292)[_0x6d55('0x25')](handleEntityNotFound(_0x2dba59,null))[_0x6d55('0x25')](respondWithResult(_0x2dba59,null))[_0x6d55('0x41')](handleError(_0x2dba59,null));};exports[_0x6d55('0x44')]=function(_0x176571,_0x24b722){return db['Dynamics365Field'][_0x6d55('0x44')](_0x176571[_0x6d55('0x45')],{})[_0x6d55('0x25')](respondWithResult(_0x24b722,0xc9))[_0x6d55('0x41')](handleError(_0x24b722,null));};exports['update']=function(_0x21c26a,_0x4fb924){if(_0x21c26a[_0x6d55('0x45')]['id']){delete _0x21c26a[_0x6d55('0x45')]['id'];}return db['Dynamics365Field'][_0x6d55('0x46')]({'where':{'id':_0x21c26a['params']['id']}})[_0x6d55('0x25')](handleEntityNotFound(_0x4fb924,null))[_0x6d55('0x25')](saveUpdates(_0x21c26a[_0x6d55('0x45')],null))[_0x6d55('0x25')](respondWithResult(_0x4fb924,null))[_0x6d55('0x41')](handleError(_0x4fb924,null));};exports['destroy']=function(_0x698ee5,_0x2c2db2){return db[_0x6d55('0x3d')][_0x6d55('0x46')]({'where':{'id':_0x698ee5[_0x6d55('0x43')]['id']}})[_0x6d55('0x25')](handleEntityNotFound(_0x2c2db2,null))[_0x6d55('0x25')](removeEntity(_0x2c2db2,null))[_0x6d55('0x41')](handleError(_0x2c2db2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index db86c1a..a292c66 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 _0x2149=['Dynamics365Field','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa65cc,_0x3ffcd5){var _0x22a2d4=function(_0x17fe94){while(--_0x17fe94){_0xa65cc['push'](_0xa65cc['shift']());}};_0x22a2d4(++_0x3ffcd5);}(_0x2149,0x148));var _0x9214=function(_0x53524f,_0x16d8ba){_0x53524f=_0x53524f-0x0;var _0x47b996=_0x2149[_0x53524f];return _0x47b996;};'use strict';var _=require(_0x9214('0x0'));var util=require(_0x9214('0x1'));var logger=require(_0x9214('0x2'))(_0x9214('0x3'));var moment=require(_0x9214('0x4'));var BPromise=require(_0x9214('0x5'));var rp=require(_0x9214('0x6'));var fs=require('fs');var path=require(_0x9214('0x7'));var rimraf=require(_0x9214('0x8'));var config=require(_0x9214('0x9'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x4cf875,_0x3b960c){return _0x4cf875['define'](_0x9214('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x9214('0xb'),'fields':[_0x9214('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d6d=['exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes'];(function(_0x3bbcc5,_0x4c9605){var _0x41251e=function(_0x35003c){while(--_0x35003c){_0x3bbcc5['push'](_0x3bbcc5['shift']());}};_0x41251e(++_0x4c9605);}(_0x7d6d,0xc5));var _0xd7d6=function(_0x575c8f,_0x19703a){_0x575c8f=_0x575c8f-0x0;var _0x613953=_0x7d6d[_0x575c8f];return _0x613953;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd7d6('0x0'))(_0xd7d6('0x1'));var moment=require(_0xd7d6('0x2'));var BPromise=require(_0xd7d6('0x3'));var rp=require(_0xd7d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7d6('0x5'));var config=require('../../config/environment');var attributes=require(_0xd7d6('0x6'));module[_0xd7d6('0x7')]=function(_0x4c5807,_0x5c375e){return _0x4c5807[_0xd7d6('0x8')]('Dynamics365Field',attributes,{'tableName':_0xd7d6('0x9'),'paranoid':![],'indexes':[{'name':_0xd7d6('0xa'),'fields':[_0xd7d6('0xb'),'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 1b67166..7d38cec 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 _0x582a=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x1ca247,_0x2f501c){var _0x56c711=function(_0x3a5f4d){while(--_0x3a5f4d){_0x1ca247['push'](_0x1ca247['shift']());}};_0x56c711(++_0x2f501c);}(_0x582a,0x198));var _0xa582=function(_0xca5e7d,_0xd2bf69){_0xca5e7d=_0xca5e7d-0x0;var _0x4fa0cf=_0x582a[_0xca5e7d];return _0x4fa0cf;};'use strict';var _=require('lodash');var util=require(_0xa582('0x0'));var moment=require('moment');var BPromise=require(_0xa582('0x1'));var rs=require(_0xa582('0x2'));var fs=require('fs');var Redis=require(_0xa582('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa582('0x4'))(_0xa582('0x5'));var config=require(_0xa582('0x6'));var jayson=require(_0xa582('0x7'));var client=jayson[_0xa582('0x8')][_0xa582('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x186209,_0x7a086c,_0x233ab1){return new BPromise(function(_0x388af8,_0x13827e){return client[_0xa582('0xa')](_0x186209,_0x233ab1)[_0xa582('0xb')](function(_0x3f8edf){logger[_0xa582('0xc')](_0xa582('0xd'),_0x7a086c,_0xa582('0xe'));logger[_0xa582('0xf')](_0xa582('0x10'),_0x7a086c,_0xa582('0xe'),JSON[_0xa582('0x11')](_0x3f8edf));if(_0x3f8edf[_0xa582('0x12')]){if(_0x3f8edf[_0xa582('0x12')][_0xa582('0x13')]===0x1f4){logger[_0xa582('0x12')](_0xa582('0xd'),_0x7a086c,_0x3f8edf[_0xa582('0x12')]['message']);return _0x13827e(_0x3f8edf[_0xa582('0x12')][_0xa582('0x14')]);}logger[_0xa582('0x12')](_0xa582('0xd'),_0x7a086c,_0x3f8edf[_0xa582('0x12')]['message']);return _0x388af8(_0x3f8edf[_0xa582('0x12')][_0xa582('0x14')]);}else{logger[_0xa582('0xc')](_0xa582('0xd'),_0x7a086c,'request\x20sent');_0x388af8(_0x3f8edf[_0xa582('0x15')][_0xa582('0x14')]);}})[_0xa582('0x16')](function(_0x1e7bc8){logger['error'](_0xa582('0xd'),_0x7a086c,_0x1e7bc8);_0x13827e(_0x1e7bc8);});});} \ No newline at end of file +var _0xf967=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0xb0ce8f,_0x170db6){var _0x1bbe9a=function(_0x231352){while(--_0x231352){_0xb0ce8f['push'](_0xb0ce8f['shift']());}};_0x1bbe9a(++_0x170db6);}(_0xf967,0x17b));var _0x7f96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf967[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x7f96('0x0'));var util=require(_0x7f96('0x1'));var moment=require(_0x7f96('0x2'));var BPromise=require(_0x7f96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f96('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f96('0x5'))(_0x7f96('0x6'));var config=require(_0x7f96('0x7'));var jayson=require(_0x7f96('0x8'));var client=jayson['client'][_0x7f96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56ca6c,_0x512600,_0x5dcdd9){return new BPromise(function(_0x16fb06,_0x8c09fb){return client[_0x7f96('0xa')](_0x56ca6c,_0x5dcdd9)[_0x7f96('0xb')](function(_0x1a02df){logger['info'](_0x7f96('0xc'),_0x512600,'request\x20sent');logger[_0x7f96('0xd')](_0x7f96('0xe'),_0x512600,_0x7f96('0xf'),JSON['stringify'](_0x1a02df));if(_0x1a02df[_0x7f96('0x10')]){if(_0x1a02df[_0x7f96('0x10')][_0x7f96('0x11')]===0x1f4){logger[_0x7f96('0x10')](_0x7f96('0xc'),_0x512600,_0x1a02df[_0x7f96('0x10')]['message']);return _0x8c09fb(_0x1a02df[_0x7f96('0x10')][_0x7f96('0x12')]);}logger[_0x7f96('0x10')](_0x7f96('0xc'),_0x512600,_0x1a02df[_0x7f96('0x10')][_0x7f96('0x12')]);return _0x16fb06(_0x1a02df[_0x7f96('0x10')][_0x7f96('0x12')]);}else{logger[_0x7f96('0x13')](_0x7f96('0xc'),_0x512600,_0x7f96('0xf'));_0x16fb06(_0x1a02df[_0x7f96('0x14')][_0x7f96('0x12')]);}})['catch'](function(_0xfc7c1a){logger['error'](_0x7f96('0xc'),_0x512600,_0xfc7c1a);_0x8c09fb(_0xfc7c1a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e434942..b76d792 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 _0xe0c1=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0xe0c1,0x84));var _0x1e0c=function(_0x5b7282,_0x277d44){_0x5b7282=_0x5b7282-0x0;var _0x250a1e=_0xe0c1[_0x5b7282];return _0x250a1e;};'use strict';var multer=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var path=require('path');var timeout=require(_0x1e0c('0x2'));var express=require('express');var router=express[_0x1e0c('0x3')]();var fs_extra=require(_0x1e0c('0x4'));var auth=require(_0x1e0c('0x5'));var interaction=require(_0x1e0c('0x6'));var config=require(_0x1e0c('0x7'));var controller=require(_0x1e0c('0x8'));router['get']('/',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0xa')]);router['get'](_0x1e0c('0xb'),auth['isAuthenticated'](),controller[_0x1e0c('0xc')]);router['get'](_0x1e0c('0xd'),auth[_0x1e0c('0x9')](),controller[_0x1e0c('0xe')]);router['get']('/:id/fields',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0xf')]);router[_0x1e0c('0x10')]('/',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0x11')]);router['post'](_0x1e0c('0xd'),auth[_0x1e0c('0x9')](),controller['addConfiguration']);router[_0x1e0c('0x12')]('/:id',auth[_0x1e0c('0x9')](),controller[_0x1e0c('0x13')]);router['delete'](_0x1e0c('0xb'),auth[_0x1e0c('0x9')](),controller[_0x1e0c('0x14')]);module[_0x1e0c('0x15')]=router; \ No newline at end of file +var _0x8b3e=['destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b3e,0x144));var _0xe8b3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b3e[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8b3('0x0'));var timeout=require(_0xe8b3('0x1'));var express=require(_0xe8b3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8b3('0x3'));var interaction=require(_0xe8b3('0x4'));var config=require(_0xe8b3('0x5'));var controller=require(_0xe8b3('0x6'));router[_0xe8b3('0x7')]('/',auth[_0xe8b3('0x8')](),controller[_0xe8b3('0x9')]);router[_0xe8b3('0x7')](_0xe8b3('0xa'),auth[_0xe8b3('0x8')](),controller[_0xe8b3('0xb')]);router[_0xe8b3('0x7')](_0xe8b3('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xe8b3('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xe8b3('0xe')]('/',auth['isAuthenticated'](),controller[_0xe8b3('0xf')]);router[_0xe8b3('0xe')](_0xe8b3('0xc'),auth[_0xe8b3('0x8')](),controller[_0xe8b3('0x10')]);router['put'](_0xe8b3('0xa'),auth['isAuthenticated'](),controller[_0xe8b3('0x11')]);router['delete'](_0xe8b3('0xa'),auth['isAuthenticated'](),controller[_0xe8b3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f6ac097..2b885d7 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 _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x24a2cc,_0x455e1f){var _0x1cf0ad=function(_0x3ad71b){while(--_0x3ad71b){_0x24a2cc['push'](_0x24a2cc['shift']());}};_0x1cf0ad(++_0x455e1f);}(_0x4bd3,0x174));var _0x34bd=function(_0x307617,_0x3d0a23){_0x307617=_0x307617-0x0;var _0x1a005b=_0x4bd3[_0x307617];return _0x1a005b;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x160f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')]},'description':{'type':Sequelize[_0xf160('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf160('0x3')},'apiKey':{'type':Sequelize[_0xf160('0x2')]},'remoteUri':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x4')},'serverUrl':{'type':Sequelize[_0xf160('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 e04c080..6293c1c 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 _0xf7b4=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','agent','description','priority','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2d5594,_0x420501){var _0x2c1ea2=function(_0x26847e){while(--_0x26847e){_0x2d5594['push'](_0x2d5594['shift']());}};_0x2c1ea2(++_0x420501);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4a1e96,_0x143e6b){_0x4a1e96=_0x4a1e96-0x0;var _0x5acea9=_0xf7b4[_0x4a1e96];return _0x5acea9;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['FreshdeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['FreshdeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['FreshdeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55')]})[_0x4f7b('0x23')](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x803e04){if(_0x803e04){_0x1ca442=_0x803e04['remoteUri'];var _0x960913=_0x1ca442[_0x4f7b('0x56')](-0x1);if(_0x960913==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x57')](0x0,_0x1ca442[_0x4f7b('0x58')](_0x960913));}return rp({'method':_0x4f7b('0x59'),'uri':util[_0x4f7b('0x5a')](_0x4f7b('0x5b'),_0x1ca442,_0x4f7b('0x5c')),'headers':{'Authorization':util[_0x4f7b('0x5a')](_0x4f7b('0x5d'),new Buffer(util[_0x4f7b('0x5a')](_0x4f7b('0x5e'),_0x803e04[_0x4f7b('0x55')]))[_0x4f7b('0x5f')](_0x4f7b('0x60')))},'json':!![]});}})[_0x4f7b('0x23')](function(_0xcb5f7e){if(_0xcb5f7e){var _0xf0691e=['requester','subject',_0x4f7b('0x61'),_0x4f7b('0x62'),_0x4f7b('0x18'),_0x4f7b('0x63'),'group',_0x4f7b('0x64'),_0x4f7b('0x65'),_0x4f7b('0x66'),_0x4f7b('0x67')];_[_0x4f7b('0x68')](_0xcb5f7e,function(_0x378587){return _0xf0691e[_0x4f7b('0x69')](_0x378587[_0x4f7b('0x28')])||!_0x378587[_0x4f7b('0x6a')]&&_0x378587[_0x4f7b('0x3c')]!==_0x4f7b('0x6b')&&_0x378587[_0x4f7b('0x3c')]!==_0x4f7b('0x6c');});return{'count':_0xcb5f7e[_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0xcb5f7e,function(_0x5d4227){return{'id':_0x5d4227[_0x4f7b('0x28')],'name':_0x5d4227[_0x4f7b('0x6d')],'custom':!_0x5d4227['default'],'options':_0x5d4227['choices']?_[_0x4f7b('0x2f')](_0x5d4227[_0x4f7b('0x6e')],function(_0x3d25a6){return{'name':_[_0x4f7b('0x6f')](_0x3d25a6),'value':_0x3d25a6};}):[]};})};}})[_0x4f7b('0x23')](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x1f7692){var _0x48d9c6=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x1f7692[_0x4f7b('0x71')]||0x1f4;logger[_0x4f7b('0x26')](_0x4f7b('0x72'),'getFields',_0x48d9c6,JSON[_0x4f7b('0x73')](_0x1f7692));delete _0x1f7692[_0x4f7b('0x28')];if(_0x48d9c6===0x191){_0x48d9c6=0x190;}_0xa10c21['status'](_0x48d9c6)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1f7692[_0x4f7b('0x71')]}:_0x1f7692);});}; \ No newline at end of file +var _0x2964=['AccountId','channel','Descriptions','getDescriptions','FreshdeskField','findOne','apiKey','substring','format','%s/%s','Basic\x20%s','%s:X','base64','requester','subject','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','FreshdeskAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','FreshdeskConfiguration','order','getConfigurations','hasOwnProperty','nolimit'];(function(_0x181c61,_0x4b1602){var _0x5146f2=function(_0x5b3cc4){while(--_0x5b3cc4){_0x181c61['push'](_0x181c61['shift']());}};_0x5146f2(++_0x4b1602);}(_0x2964,0x108));var _0x4296=function(_0x384fd0,_0x3a7019){_0x384fd0=_0x384fd0-0x0;var _0xa834ab=_0x2964[_0x384fd0];return _0xa834ab;};'use strict';var emlformat=require(_0x4296('0x0'));var rimraf=require(_0x4296('0x1'));var zipdir=require(_0x4296('0x2'));var jsonpatch=require(_0x4296('0x3'));var rp=require(_0x4296('0x4'));var moment=require(_0x4296('0x5'));var BPromise=require(_0x4296('0x6'));var Mustache=require(_0x4296('0x7'));var util=require(_0x4296('0x8'));var path=require('path');var sox=require(_0x4296('0x9'));var csv=require(_0x4296('0xa'));var ejs=require(_0x4296('0xb'));var fs=require('fs');var fs_extra=require(_0x4296('0xc'));var _=require(_0x4296('0xd'));var squel=require(_0x4296('0xe'));var crypto=require('crypto');var jsforce=require(_0x4296('0xf'));var deskjs=require(_0x4296('0x10'));var toCsv=require(_0x4296('0xa'));var querystring=require(_0x4296('0x11'));var Papa=require(_0x4296('0x12'));var Redis=require(_0x4296('0x13'));var authService=require(_0x4296('0x14'));var qs=require(_0x4296('0x15'));var as=require(_0x4296('0x16'));var hardwareService=require(_0x4296('0x17'));var logger=require(_0x4296('0x18'))(_0x4296('0x19'));var utils=require('../../config/utils');var config=require(_0x4296('0x1a'));var licenseUtil=require(_0x4296('0x1b'));var db=require(_0x4296('0x1c'))['db'];var integrations=require(_0x4296('0x1d'));function respondWithStatusCode(_0x23ba5a,_0x676674){_0x676674=_0x676674||0xcc;return function(_0x3789a2){if(_0x3789a2){return _0x23ba5a['sendStatus'](_0x676674);}return _0x23ba5a[_0x4296('0x1e')](_0x676674)[_0x4296('0x1f')]();};}function respondWithResult(_0x3574da,_0x56b6d7){_0x56b6d7=_0x56b6d7||0xc8;return function(_0x1c192c){if(_0x1c192c){return _0x3574da[_0x4296('0x1e')](_0x56b6d7)[_0x4296('0x20')](_0x1c192c);}};}function respondWithFilteredResult(_0x53af4b,_0x182910){return function(_0x2e63c4){if(_0x2e63c4){var _0x1e7af8=typeof _0x182910['offset']===_0x4296('0x21')&&typeof _0x182910[_0x4296('0x22')]===_0x4296('0x21');var _0x1dcb36=_0x2e63c4[_0x4296('0x23')];var _0x540b0d=_0x1e7af8?0x0:_0x182910[_0x4296('0x24')];var _0x4ac668=_0x1e7af8?_0x2e63c4[_0x4296('0x23')]:_0x182910['offset']+_0x182910[_0x4296('0x22')];var _0x6c50b7;if(_0x4ac668>=_0x1dcb36){_0x4ac668=_0x1dcb36;_0x6c50b7=0xc8;}else{_0x6c50b7=0xce;}_0x53af4b[_0x4296('0x1e')](_0x6c50b7);return _0x53af4b[_0x4296('0x25')](_0x4296('0x26'),_0x540b0d+'-'+_0x4ac668+'/'+_0x1dcb36)[_0x4296('0x20')](_0x2e63c4);}return null;};}function patchUpdates(_0x4ca11f){return function(_0x33839e){try{jsonpatch[_0x4296('0x27')](_0x33839e,_0x4ca11f,!![]);}catch(_0x5456ca){return BPromise[_0x4296('0x28')](_0x5456ca);}return _0x33839e[_0x4296('0x29')]();};}function saveUpdates(_0x257f51,_0x3c899f){return function(_0x5d285d){if(_0x5d285d){return _0x5d285d['update'](_0x257f51)[_0x4296('0x2a')](function(_0x3902b5){return _0x3902b5;});}return null;};}function removeEntity(_0x4ce761,_0x179e5d){return function(_0x4c5aca){if(_0x4c5aca){return _0x4c5aca[_0x4296('0x2b')]()[_0x4296('0x2a')](function(){_0x4ce761[_0x4296('0x1e')](0xcc)[_0x4296('0x1f')]();});}};}function handleEntityNotFound(_0x5098c1,_0x3b8b48){return function(_0x4c56e5){if(!_0x4c56e5){_0x5098c1[_0x4296('0x2c')](0x194);}return _0x4c56e5;};}function handleError(_0x516365,_0x4f2d8e){_0x4f2d8e=_0x4f2d8e||0x1f4;return function(_0x853bf5){logger[_0x4296('0x2d')](_0x853bf5[_0x4296('0x2e')]);if(_0x853bf5['name']){delete _0x853bf5[_0x4296('0x2f')];}_0x516365[_0x4296('0x1e')](_0x4f2d8e)['send'](_0x853bf5);};}exports[_0x4296('0x30')]=function(_0x5cb6b7,_0x4f9a1a){var _0x14c84f={},_0x2f5a2e={},_0x37f4e5={'count':0x0,'rows':[]};var _0x1bf57b=_[_0x4296('0x31')](db[_0x4296('0x32')][_0x4296('0x33')],function(_0x9ac120){return{'name':_0x9ac120['fieldName'],'type':_0x9ac120[_0x4296('0x34')]['key']};});_0x2f5a2e[_0x4296('0x35')]=_['map'](_0x1bf57b,'name');_0x2f5a2e[_0x4296('0x36')]=_['keys'](_0x5cb6b7[_0x4296('0x36')]);_0x2f5a2e[_0x4296('0x37')]=_[_0x4296('0x38')](_0x2f5a2e[_0x4296('0x35')],_0x2f5a2e[_0x4296('0x36')]);_0x14c84f[_0x4296('0x39')]=_[_0x4296('0x38')](_0x2f5a2e[_0x4296('0x35')],qs[_0x4296('0x3a')](_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3a')]));_0x14c84f['attributes']=_0x14c84f['attributes'][_0x4296('0x3b')]?_0x14c84f[_0x4296('0x39')]:_0x2f5a2e[_0x4296('0x35')];if(!_0x5cb6b7[_0x4296('0x36')]['hasOwnProperty']('nolimit')){_0x14c84f[_0x4296('0x22')]=qs[_0x4296('0x22')](_0x5cb6b7[_0x4296('0x36')][_0x4296('0x22')]);_0x14c84f['offset']=qs[_0x4296('0x24')](_0x5cb6b7[_0x4296('0x36')]['offset']);}_0x14c84f['order']=qs['sort'](_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3c')]);_0x14c84f['where']=qs[_0x4296('0x37')](_[_0x4296('0x3d')](_0x5cb6b7[_0x4296('0x36')],_0x2f5a2e[_0x4296('0x37')]),_0x1bf57b);if(_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3e')]){_0x14c84f[_0x4296('0x3f')]=_[_0x4296('0x40')](_0x14c84f[_0x4296('0x3f')],{'$or':_[_0x4296('0x31')](_0x1bf57b,function(_0x1e96ed){if(_0x1e96ed[_0x4296('0x34')]!==_0x4296('0x41')){var _0x542ef9={};_0x542ef9[_0x1e96ed[_0x4296('0x2f')]]={'$like':'%'+_0x5cb6b7[_0x4296('0x36')][_0x4296('0x3e')]+'%'};return _0x542ef9;}})});}_0x14c84f=_[_0x4296('0x40')]({},_0x14c84f,_0x5cb6b7[_0x4296('0x42')]);var _0x2fa9c0={'where':_0x14c84f['where']};return db[_0x4296('0x32')][_0x4296('0x23')](_0x2fa9c0)[_0x4296('0x2a')](function(_0x536531){_0x37f4e5[_0x4296('0x23')]=_0x536531;if(_0x5cb6b7['query'][_0x4296('0x43')]){_0x14c84f[_0x4296('0x44')]=[{'all':!![]}];}return db[_0x4296('0x32')][_0x4296('0x45')](_0x14c84f);})[_0x4296('0x2a')](function(_0x43e3b2){_0x37f4e5['rows']=_0x43e3b2;return _0x37f4e5;})[_0x4296('0x2a')](respondWithFilteredResult(_0x4f9a1a,_0x14c84f))[_0x4296('0x46')](handleError(_0x4f9a1a,null));};exports['show']=function(_0x47bd76,_0xa64359){var _0x3fffd3={'raw':![],'where':{'id':_0x47bd76[_0x4296('0x47')]['id']}},_0x2da579={};_0x2da579[_0x4296('0x35')]=_['keys'](db['FreshdeskAccount'][_0x4296('0x33')]);_0x2da579[_0x4296('0x36')]=_[_0x4296('0x48')](_0x47bd76[_0x4296('0x36')]);_0x2da579[_0x4296('0x37')]=_[_0x4296('0x38')](_0x2da579[_0x4296('0x35')],_0x2da579[_0x4296('0x36')]);_0x3fffd3[_0x4296('0x39')]=_['intersection'](_0x2da579[_0x4296('0x35')],qs[_0x4296('0x3a')](_0x47bd76[_0x4296('0x36')]['fields']));_0x3fffd3[_0x4296('0x39')]=_0x3fffd3[_0x4296('0x39')]['length']?_0x3fffd3['attributes']:_0x2da579[_0x4296('0x35')];if(_0x47bd76[_0x4296('0x36')][_0x4296('0x43')]){_0x3fffd3['include']=[{'all':!![]}];}_0x3fffd3=_['merge']({},_0x3fffd3,_0x47bd76['options']);return db[_0x4296('0x32')][_0x4296('0x49')](_0x3fffd3)[_0x4296('0x2a')](handleEntityNotFound(_0xa64359,null))['then'](respondWithResult(_0xa64359,null))['catch'](handleError(_0xa64359,null));};exports[_0x4296('0x4a')]=function(_0x1ddb06,_0x403e7d){return db[_0x4296('0x32')][_0x4296('0x4a')](_0x1ddb06[_0x4296('0x4b')],{})[_0x4296('0x2a')](respondWithResult(_0x403e7d,0xc9))[_0x4296('0x46')](handleError(_0x403e7d,null));};exports['update']=function(_0x419cab,_0x1f050b){if(_0x419cab[_0x4296('0x4b')]['id']){delete _0x419cab[_0x4296('0x4b')]['id'];}return db[_0x4296('0x32')][_0x4296('0x49')]({'where':{'id':_0x419cab['params']['id']}})['then'](handleEntityNotFound(_0x1f050b,null))['then'](saveUpdates(_0x419cab[_0x4296('0x4b')],null))[_0x4296('0x2a')](respondWithResult(_0x1f050b,null))[_0x4296('0x46')](handleError(_0x1f050b,null));};exports[_0x4296('0x2b')]=function(_0x4baee7,_0x2ac96d){return db[_0x4296('0x32')][_0x4296('0x49')]({'where':{'id':_0x4baee7[_0x4296('0x47')]['id']}})[_0x4296('0x2a')](handleEntityNotFound(_0x2ac96d,null))[_0x4296('0x2a')](removeEntity(_0x2ac96d,null))[_0x4296('0x46')](handleError(_0x2ac96d,null));};exports['getConfigurations']=function(_0x468453,_0x47f668,_0x52c28a){var _0x6379ec={};var _0x18080a={};var _0x4f306a;var _0x17e212;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x468453[_0x4296('0x47')]['id']}})[_0x4296('0x2a')](handleEntityNotFound(_0x47f668,null))['then'](function(_0x4faac4){if(_0x4faac4){_0x4f306a=_0x4faac4;_0x18080a[_0x4296('0x35')]=_[_0x4296('0x48')](db[_0x4296('0x4c')][_0x4296('0x33')]);_0x18080a[_0x4296('0x36')]=_['keys'](_0x468453[_0x4296('0x36')]);_0x18080a[_0x4296('0x37')]=_['intersection'](_0x18080a[_0x4296('0x35')],_0x18080a[_0x4296('0x36')]);_0x6379ec[_0x4296('0x39')]=_[_0x4296('0x38')](_0x18080a[_0x4296('0x35')],qs[_0x4296('0x3a')](_0x468453['query'][_0x4296('0x3a')]));_0x6379ec[_0x4296('0x39')]=_0x6379ec[_0x4296('0x39')][_0x4296('0x3b')]?_0x6379ec['attributes']:_0x18080a['model'];_0x6379ec[_0x4296('0x4d')]=qs[_0x4296('0x3c')](_0x468453['query'][_0x4296('0x3c')]);_0x6379ec[_0x4296('0x3f')]=qs[_0x4296('0x37')](_[_0x4296('0x3d')](_0x468453[_0x4296('0x36')],_0x18080a['filters']));if(_0x468453[_0x4296('0x36')]['filter']){_0x6379ec[_0x4296('0x3f')]=_['merge'](_0x6379ec[_0x4296('0x3f')],{'$or':_[_0x4296('0x31')](_0x6379ec[_0x4296('0x39')],function(_0x26a400){var _0x2e8b42={};_0x2e8b42[_0x26a400]={'$like':'%'+_0x468453[_0x4296('0x36')][_0x4296('0x3e')]+'%'};return _0x2e8b42;})});}_0x6379ec=_[_0x4296('0x40')]({},_0x6379ec,_0x468453['options']);return _0x4f306a[_0x4296('0x4e')](_0x6379ec);}})[_0x4296('0x2a')](function(_0x128f96){if(_0x128f96){_0x17e212=_0x128f96[_0x4296('0x3b')];if(!_0x468453['query'][_0x4296('0x4f')](_0x4296('0x50'))){_0x6379ec[_0x4296('0x22')]=qs[_0x4296('0x22')](_0x468453[_0x4296('0x36')][_0x4296('0x22')]);_0x6379ec[_0x4296('0x24')]=qs[_0x4296('0x24')](_0x468453[_0x4296('0x36')][_0x4296('0x24')]);}return _0x4f306a[_0x4296('0x4e')](_0x6379ec);}})[_0x4296('0x2a')](function(_0x3841c1){if(_0x3841c1){return _0x3841c1?{'count':_0x17e212,'rows':_0x3841c1}:null;}})[_0x4296('0x2a')](respondWithResult(_0x47f668,null))[_0x4296('0x46')](handleError(_0x47f668,null));};exports['addConfiguration']=function(_0x2c2823,_0x6360e7,_0xe4cf57){if(_0x2c2823[_0x4296('0x4b')]['id']){delete _0x2c2823[_0x4296('0x4b')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x2c2823[_0x4296('0x47')]['id']}})[_0x4296('0x2a')](handleEntityNotFound(_0x6360e7,null))[_0x4296('0x2a')](function(_0x24054b){if(_0x24054b){_0x2c2823[_0x4296('0x4b')][_0x4296('0x51')]=_0x24054b['id'];_0x2c2823[_0x4296('0x4b')]['Subjects']=integrations['getSubjects'](_0x2c2823['body'][_0x4296('0x52')],_0x2c2823[_0x4296('0x4b')][_0x4296('0x34')]);_0x2c2823['body'][_0x4296('0x53')]=integrations[_0x4296('0x54')](_0x2c2823[_0x4296('0x4b')][_0x4296('0x52')],_0x2c2823['body'][_0x4296('0x34')]);return db[_0x4296('0x4c')][_0x4296('0x4a')](_0x2c2823['body'],{'include':[{'model':db[_0x4296('0x55')],'as':'Subjects'},{'model':db[_0x4296('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6360e7,null))[_0x4296('0x46')](handleError(_0x6360e7,null));};exports['getFields']=function(_0x171ffb,_0x22ab58,_0x309225){var _0x45c839='';return db[_0x4296('0x32')][_0x4296('0x56')]({'where':{'id':_0x171ffb[_0x4296('0x47')]['id']},'attributes':['id','remoteUri',_0x4296('0x57')]})['then'](handleEntityNotFound(_0x22ab58,null))[_0x4296('0x2a')](function(_0x5aa04d){if(_0x5aa04d){_0x45c839=_0x5aa04d['remoteUri'];var _0xea86ed=_0x45c839['slice'](-0x1);if(_0xea86ed==='/'){_0x45c839=_0x45c839[_0x4296('0x58')](0x0,_0x45c839['lastIndexOf'](_0xea86ed));}return rp({'method':'GET','uri':util[_0x4296('0x59')](_0x4296('0x5a'),_0x45c839,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x4296('0x59')](_0x4296('0x5b'),new Buffer(util['format'](_0x4296('0x5c'),_0x5aa04d[_0x4296('0x57')]))['toString'](_0x4296('0x5d')))},'json':!![]});}})[_0x4296('0x2a')](function(_0x54a6c){if(_0x54a6c){var _0x1ea1de=[_0x4296('0x5e'),_0x4296('0x5f'),'agent',_0x4296('0x60'),_0x4296('0x1e'),_0x4296('0x61'),_0x4296('0x62'),_0x4296('0x63'),_0x4296('0x64'),_0x4296('0x62'),'company'];_[_0x4296('0x65')](_0x54a6c,function(_0x12efc5){return _0x1ea1de[_0x4296('0x66')](_0x12efc5[_0x4296('0x2f')])||!_0x12efc5[_0x4296('0x67')]&&_0x12efc5[_0x4296('0x34')]!==_0x4296('0x68')&&_0x12efc5[_0x4296('0x34')]!==_0x4296('0x69');});return{'count':_0x54a6c[_0x4296('0x3b')],'rows':_[_0x4296('0x31')](_0x54a6c,function(_0x5599b8){return{'id':_0x5599b8[_0x4296('0x2f')],'name':_0x5599b8[_0x4296('0x6a')],'custom':!_0x5599b8[_0x4296('0x67')],'options':_0x5599b8[_0x4296('0x6b')]?_['map'](_0x5599b8[_0x4296('0x6b')],function(_0x5b3dce){return{'name':_[_0x4296('0x6c')](_0x5b3dce),'value':_0x5b3dce};}):[]};})};}})[_0x4296('0x2a')](respondWithResult(_0x22ab58,null))[_0x4296('0x46')](function(_0x57319b){var _0x4eeaa8=_0x171ffb[_0x4296('0x36')]['test']?0x1f4:_0x57319b['statusCode']||0x1f4;logger[_0x4296('0x2d')](_0x4296('0x6d'),_0x4296('0x6e'),_0x4eeaa8,JSON[_0x4296('0x6f')](_0x57319b));delete _0x57319b[_0x4296('0x2f')];if(_0x4eeaa8===0x191){_0x4eeaa8=0x190;}_0x22ab58[_0x4296('0x1e')](_0x4eeaa8)[_0x4296('0x70')](_0x171ffb['query']['test']?{'message':_0x4296('0x71'),'statusCode':_0x57319b[_0x4296('0x72')]}:_0x57319b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f801d10..d07d7a0 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 _0x112f=['./intFreshdeskAccount.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29ad08,_0x2d3929){var _0x205d44=function(_0x4266b0){while(--_0x4266b0){_0x29ad08['push'](_0x29ad08['shift']());}};_0x205d44(++_0x2d3929);}(_0x112f,0x85));var _0xf112=function(_0x3234cf,_0x134836){_0x3234cf=_0x3234cf-0x0;var _0x300532=_0x112f[_0x3234cf];return _0x300532;};'use strict';var _=require(_0xf112('0x0'));var util=require(_0xf112('0x1'));var logger=require(_0xf112('0x2'))(_0xf112('0x3'));var moment=require(_0xf112('0x4'));var BPromise=require(_0xf112('0x5'));var rp=require(_0xf112('0x6'));var fs=require('fs');var path=require(_0xf112('0x7'));var rimraf=require(_0xf112('0x8'));var config=require(_0xf112('0x9'));var attributes=require(_0xf112('0xa'));var integrations=require('../../components/integrations/configuration');module[_0xf112('0xb')]=function(_0x2650f0,_0x39c810){return _0x2650f0[_0xf112('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbd0=['../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','util'];(function(_0x58490d,_0x45ba67){var _0x16c989=function(_0x666b87){while(--_0x666b87){_0x58490d['push'](_0x58490d['shift']());}};_0x16c989(++_0x45ba67);}(_0xdbd0,0x18b));var _0x0dbd=function(_0x3bb91c,_0x5cdd77){_0x3bb91c=_0x3bb91c-0x0;var _0x4f0e58=_0xdbd0[_0x3bb91c];return _0x4f0e58;};'use strict';var _=require('lodash');var util=require(_0x0dbd('0x0'));var logger=require(_0x0dbd('0x1'))(_0x0dbd('0x2'));var moment=require(_0x0dbd('0x3'));var BPromise=require(_0x0dbd('0x4'));var rp=require(_0x0dbd('0x5'));var fs=require('fs');var path=require(_0x0dbd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0dbd('0x7'));var integrations=require(_0x0dbd('0x8'));module[_0x0dbd('0x9')]=function(_0x26c5ad,_0x21b945){return _0x26c5ad['define'](_0x0dbd('0xa'),attributes,{'tableName':_0x0dbd('0xb'),'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 e5e042d..4f642e2 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 _0xadd2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','stringify','FreshdeskAccount','find','ShowFreshdeskAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x536efe,_0x1cd079){var _0x10daba=function(_0x19a38d){while(--_0x19a38d){_0x536efe['push'](_0x536efe['shift']());}};_0x10daba(++_0x1cd079);}(_0xadd2,0xa5));var _0x2add=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xadd2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2add('0x0'));var BPromise=require('bluebird');var rs=require(_0x2add('0x1'));var fs=require('fs');var Redis=require(_0x2add('0x2'));var db=require(_0x2add('0x3'))['db'];var utils=require(_0x2add('0x4'));var logger=require(_0x2add('0x5'))(_0x2add('0x6'));var config=require(_0x2add('0x7'));var jayson=require(_0x2add('0x8'));var client=jayson[_0x2add('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48fb55,_0x447b6d,_0x18489c){return new BPromise(function(_0x5b5047,_0x21f439){return client['request'](_0x48fb55,_0x18489c)[_0x2add('0xa')](function(_0x4363a1){logger[_0x2add('0xb')](_0x2add('0xc'),_0x447b6d,_0x2add('0xd'));logger[_0x2add('0xe')](_0x2add('0xf'),_0x447b6d,_0x2add('0xd'),JSON['stringify'](_0x4363a1));if(_0x4363a1[_0x2add('0x10')]){if(_0x4363a1[_0x2add('0x10')][_0x2add('0x11')]===0x1f4){logger[_0x2add('0x10')](_0x2add('0xc'),_0x447b6d,_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);return _0x21f439(_0x4363a1[_0x2add('0x10')]['message']);}logger[_0x2add('0x10')](_0x2add('0xc'),_0x447b6d,_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);return _0x5b5047(_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);}else{logger[_0x2add('0xb')](_0x2add('0xc'),_0x447b6d,'request\x20sent');_0x5b5047(_0x4363a1[_0x2add('0x13')][_0x2add('0x12')]);}})[_0x2add('0x14')](function(_0x1cd847){logger[_0x2add('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x447b6d,_0x1cd847);_0x21f439(_0x1cd847);});});}exports['GetFreshdeskAccount']=function(_0x3630f0){var _0x524a3f=this;return new Promise(function(_0x525afc,_0x54d277){return db['FreshdeskAccount']['findAll']({'raw':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x16')]===undefined?!![]:![]:!![],'where':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x17')]||null:null,'attributes':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x18')]||null:null,'limit':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x19')]||null:null,'include':_0x3630f0[_0x2add('0x15')]?_0x3630f0['options']['include']?_['map'](_0x3630f0[_0x2add('0x15')]['include'],function(_0x50bd25){return{'model':db[_0x50bd25['model']],'as':_0x50bd25['as'],'attributes':_0x50bd25[_0x2add('0x18')],'include':_0x50bd25['include']?_[_0x2add('0x1a')](_0x50bd25[_0x2add('0x1b')],function(_0x40c4e9){return{'model':db[_0x40c4e9[_0x2add('0x1c')]],'as':_0x40c4e9['as'],'attributes':_0x40c4e9[_0x2add('0x18')],'include':_0x40c4e9[_0x2add('0x1b')]?_[_0x2add('0x1a')](_0x40c4e9['include'],function(_0x199a54){return{'model':db[_0x199a54[_0x2add('0x1c')]],'as':_0x199a54['as'],'attributes':_0x199a54['attributes']};}):[]};}):[]};}):[]:[]})[_0x2add('0xa')](function(_0x12b704){logger[_0x2add('0xb')](_0x2add('0x1d'),_0x3630f0);logger[_0x2add('0xe')](_0x2add('0x1d'),_0x3630f0,JSON[_0x2add('0x1e')](_0x12b704));_0x525afc(_0x12b704);})[_0x2add('0x14')](function(_0x334ff0){logger[_0x2add('0x10')](_0x2add('0x1d'),_0x334ff0[_0x2add('0x12')],_0x3630f0);_0x54d277(_0x524a3f[_0x2add('0x10')](0x1f4,_0x334ff0[_0x2add('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x1dac76){var _0x201008=this;return new Promise(function(_0x165e8d,_0x1f780d){return db[_0x2add('0x1f')][_0x2add('0x20')]({'raw':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')][_0x2add('0x16')]===undefined?!![]:![]:!![],'where':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')][_0x2add('0x17')]||null:null,'attributes':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')]['attributes']||null:null,'include':_0x1dac76['options']?_0x1dac76[_0x2add('0x15')]['include']?_[_0x2add('0x1a')](_0x1dac76[_0x2add('0x15')][_0x2add('0x1b')],function(_0x4f43af){return{'model':db[_0x4f43af['model']],'as':_0x4f43af['as'],'attributes':_0x4f43af[_0x2add('0x18')],'include':_0x4f43af['include']?_[_0x2add('0x1a')](_0x4f43af[_0x2add('0x1b')],function(_0x99dadb){return{'model':db[_0x99dadb[_0x2add('0x1c')]],'as':_0x99dadb['as'],'attributes':_0x99dadb[_0x2add('0x18')],'include':_0x99dadb['include']?_[_0x2add('0x1a')](_0x99dadb[_0x2add('0x1b')],function(_0x2ca10b){return{'model':db[_0x2ca10b[_0x2add('0x1c')]],'as':_0x2ca10b['as'],'attributes':_0x2ca10b[_0x2add('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2add('0xa')](function(_0x3d58c7){logger['info']('ShowFreshdeskAccount',_0x1dac76);logger[_0x2add('0xe')]('ShowFreshdeskAccount',_0x1dac76,JSON[_0x2add('0x1e')](_0x3d58c7));_0x165e8d(_0x3d58c7);})[_0x2add('0x14')](function(_0x53ff4a){logger[_0x2add('0x10')](_0x2add('0x21'),_0x53ff4a[_0x2add('0x12')],_0x1dac76);_0x1f780d(_0x201008[_0x2add('0x10')](0x1f4,_0x53ff4a[_0x2add('0x12')]));});});}; \ No newline at end of file +var _0xc995=['map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include'];(function(_0xc52bf0,_0xbc1799){var _0x46d34b=function(_0x4b83a2){while(--_0x4b83a2){_0xc52bf0['push'](_0xc52bf0['shift']());}};_0x46d34b(++_0xbc1799);}(_0xc995,0x8c));var _0x5c99=function(_0x3e6000,_0x1b3399){_0x3e6000=_0x3e6000-0x0;var _0x3d92e3=_0xc995[_0x3e6000];return _0x3d92e3;};'use strict';var _=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var moment=require(_0x5c99('0x2'));var BPromise=require(_0x5c99('0x3'));var rs=require(_0x5c99('0x4'));var fs=require('fs');var Redis=require(_0x5c99('0x5'));var db=require(_0x5c99('0x6'))['db'];var utils=require(_0x5c99('0x7'));var logger=require('../../config/logger')(_0x5c99('0x8'));var config=require('../../config/environment');var jayson=require(_0x5c99('0x9'));var client=jayson['client'][_0x5c99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f127,_0x10885a,_0x22416d){return new BPromise(function(_0x570e5c,_0x105056){return client[_0x5c99('0xb')](_0x39f127,_0x22416d)[_0x5c99('0xc')](function(_0xc185b5){logger[_0x5c99('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x10885a,_0x5c99('0xe'));logger[_0x5c99('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x10885a,_0x5c99('0xe'),JSON[_0x5c99('0x10')](_0xc185b5));if(_0xc185b5[_0x5c99('0x11')]){if(_0xc185b5[_0x5c99('0x11')][_0x5c99('0x12')]===0x1f4){logger[_0x5c99('0x11')](_0x5c99('0x13'),_0x10885a,_0xc185b5[_0x5c99('0x11')]['message']);return _0x105056(_0xc185b5[_0x5c99('0x11')][_0x5c99('0x14')]);}logger[_0x5c99('0x11')](_0x5c99('0x13'),_0x10885a,_0xc185b5[_0x5c99('0x11')][_0x5c99('0x14')]);return _0x570e5c(_0xc185b5['error'][_0x5c99('0x14')]);}else{logger['info'](_0x5c99('0x13'),_0x10885a,'request\x20sent');_0x570e5c(_0xc185b5['result'][_0x5c99('0x14')]);}})[_0x5c99('0x15')](function(_0x1bbee8){logger['error'](_0x5c99('0x13'),_0x10885a,_0x1bbee8);_0x105056(_0x1bbee8);});});}exports[_0x5c99('0x16')]=function(_0x178bb4){var _0x2b0e8e=this;return new Promise(function(_0x481f0b,_0x196285){return db[_0x5c99('0x17')][_0x5c99('0x18')]({'raw':_0x178bb4['options']?_0x178bb4[_0x5c99('0x19')][_0x5c99('0x1a')]===undefined?!![]:![]:!![],'where':_0x178bb4[_0x5c99('0x19')]?_0x178bb4['options'][_0x5c99('0x1b')]||null:null,'attributes':_0x178bb4[_0x5c99('0x19')]?_0x178bb4[_0x5c99('0x19')][_0x5c99('0x1c')]||null:null,'limit':_0x178bb4[_0x5c99('0x19')]?_0x178bb4[_0x5c99('0x19')]['limit']||null:null,'include':_0x178bb4[_0x5c99('0x19')]?_0x178bb4['options'][_0x5c99('0x1d')]?_[_0x5c99('0x1e')](_0x178bb4[_0x5c99('0x19')][_0x5c99('0x1d')],function(_0x2d7071){return{'model':db[_0x2d7071[_0x5c99('0x1f')]],'as':_0x2d7071['as'],'attributes':_0x2d7071['attributes'],'include':_0x2d7071['include']?_[_0x5c99('0x1e')](_0x2d7071[_0x5c99('0x1d')],function(_0x118ebd){return{'model':db[_0x118ebd[_0x5c99('0x1f')]],'as':_0x118ebd['as'],'attributes':_0x118ebd[_0x5c99('0x1c')],'include':_0x118ebd[_0x5c99('0x1d')]?_[_0x5c99('0x1e')](_0x118ebd[_0x5c99('0x1d')],function(_0x585ab5){return{'model':db[_0x585ab5['model']],'as':_0x585ab5['as'],'attributes':_0x585ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c99('0xc')](function(_0x5c4c4a){logger[_0x5c99('0xd')](_0x5c99('0x16'),_0x178bb4);logger['debug']('GetFreshdeskAccount',_0x178bb4,JSON[_0x5c99('0x10')](_0x5c4c4a));_0x481f0b(_0x5c4c4a);})['catch'](function(_0x12a220){logger[_0x5c99('0x11')](_0x5c99('0x16'),_0x12a220[_0x5c99('0x14')],_0x178bb4);_0x196285(_0x2b0e8e[_0x5c99('0x11')](0x1f4,_0x12a220[_0x5c99('0x14')]));});});};exports[_0x5c99('0x20')]=function(_0x40ccfb){var _0x4f99ac=this;return new Promise(function(_0x405056,_0x226a8a){return db[_0x5c99('0x17')][_0x5c99('0x21')]({'raw':_0x40ccfb[_0x5c99('0x19')]?_0x40ccfb[_0x5c99('0x19')][_0x5c99('0x1a')]===undefined?!![]:![]:!![],'where':_0x40ccfb[_0x5c99('0x19')]?_0x40ccfb['options']['where']||null:null,'attributes':_0x40ccfb[_0x5c99('0x19')]?_0x40ccfb[_0x5c99('0x19')][_0x5c99('0x1c')]||null:null,'include':_0x40ccfb[_0x5c99('0x19')]?_0x40ccfb[_0x5c99('0x19')][_0x5c99('0x1d')]?_[_0x5c99('0x1e')](_0x40ccfb[_0x5c99('0x19')]['include'],function(_0x36c802){return{'model':db[_0x36c802[_0x5c99('0x1f')]],'as':_0x36c802['as'],'attributes':_0x36c802['attributes'],'include':_0x36c802[_0x5c99('0x1d')]?_[_0x5c99('0x1e')](_0x36c802[_0x5c99('0x1d')],function(_0x447ad8){return{'model':db[_0x447ad8[_0x5c99('0x1f')]],'as':_0x447ad8['as'],'attributes':_0x447ad8[_0x5c99('0x1c')],'include':_0x447ad8[_0x5c99('0x1d')]?_[_0x5c99('0x1e')](_0x447ad8['include'],function(_0x5f1b57){return{'model':db[_0x5f1b57[_0x5c99('0x1f')]],'as':_0x5f1b57['as'],'attributes':_0x5f1b57[_0x5c99('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5c99('0xc')](function(_0x3a4cd8){logger['info'](_0x5c99('0x20'),_0x40ccfb);logger[_0x5c99('0xf')](_0x5c99('0x20'),_0x40ccfb,JSON[_0x5c99('0x10')](_0x3a4cd8));_0x405056(_0x3a4cd8);})[_0x5c99('0x15')](function(_0x30fabc){logger[_0x5c99('0x11')](_0x5c99('0x20'),_0x30fabc['message'],_0x40ccfb);_0x226a8a(_0x4f99ac['error'](0x1f4,_0x30fabc[_0x5c99('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index d24cfee..6014928 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 _0xb219=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','getFields','/:id/descriptions','/:id/tags','post','create','put','/:id','update','destroy','exports'];(function(_0x5830f3,_0x3c6c01){var _0x38efdb=function(_0x2716bb){while(--_0x2716bb){_0x5830f3['push'](_0x5830f3['shift']());}};_0x38efdb(++_0x3c6c01);}(_0xb219,0x84));var _0x9b21=function(_0x442f3a,_0x1ac71a){_0x442f3a=_0x442f3a-0x0;var _0x3aee26=_0xb219[_0x442f3a];return _0x3aee26;};'use strict';var multer=require(_0x9b21('0x0'));var util=require(_0x9b21('0x1'));var path=require(_0x9b21('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b21('0x3')]();var fs_extra=require(_0x9b21('0x4'));var auth=require(_0x9b21('0x5'));var interaction=require(_0x9b21('0x6'));var config=require(_0x9b21('0x7'));var controller=require(_0x9b21('0x8'));router['get']('/',auth[_0x9b21('0x9')](),controller[_0x9b21('0xa')]);router[_0x9b21('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9b21('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9b21('0xc')]);router['get']('/:id/subjects',auth[_0x9b21('0x9')](),controller['getSubjects']);router['get'](_0x9b21('0xd'),auth[_0x9b21('0x9')](),controller['getDescriptions']);router[_0x9b21('0xb')](_0x9b21('0xe'),auth['isAuthenticated'](),controller['getTags']);router[_0x9b21('0xf')]('/',auth['isAuthenticated'](),controller[_0x9b21('0x10')]);router[_0x9b21('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x9b21('0x11')](_0x9b21('0x12'),auth[_0x9b21('0x9')](),controller[_0x9b21('0x13')]);router['delete'](_0x9b21('0x12'),auth[_0x9b21('0x9')](),controller[_0x9b21('0x14')]);module[_0x9b21('0x15')]=router; \ No newline at end of file +var _0x987e=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x987e,0x1bd));var _0xe987=function(_0x4b6651,_0x20ab3d){_0x4b6651=_0x4b6651-0x0;var _0x3c867c=_0x987e[_0x4b6651];return _0x3c867c;};'use strict';var multer=require(_0xe987('0x0'));var util=require('util');var path=require(_0xe987('0x1'));var timeout=require(_0xe987('0x2'));var express=require('express');var router=express[_0xe987('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe987('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe987('0x5'));var controller=require(_0xe987('0x6'));router[_0xe987('0x7')]('/',auth[_0xe987('0x8')](),controller[_0xe987('0x9')]);router[_0xe987('0x7')](_0xe987('0xa'),auth[_0xe987('0x8')](),controller[_0xe987('0xb')]);router[_0xe987('0x7')](_0xe987('0xc'),auth[_0xe987('0x8')](),controller['getFields']);router['get'](_0xe987('0xd'),auth[_0xe987('0x8')](),controller[_0xe987('0xe')]);router[_0xe987('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe987('0xf')]);router[_0xe987('0x7')](_0xe987('0x10'),auth[_0xe987('0x8')](),controller[_0xe987('0x11')]);router[_0xe987('0x12')]('/',auth[_0xe987('0x8')](),controller[_0xe987('0x13')]);router['post']('/:id/tags',auth[_0xe987('0x8')](),controller['setTags']);router[_0xe987('0x14')]('/:id',auth[_0xe987('0x8')](),controller[_0xe987('0x15')]);router[_0xe987('0x16')](_0xe987('0xa'),auth[_0xe987('0x8')](),controller[_0xe987('0x17')]);module[_0xe987('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a7f2e50..1a4acde 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 _0xa594=['exports','STRING'];(function(_0x3593f4,_0x48a5e6){var _0x1aceb4=function(_0x246a04){while(--_0x246a04){_0x3593f4['push'](_0x3593f4['shift']());}};_0x1aceb4(++_0x48a5e6);}(_0xa594,0x66));var _0x4a59=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0xa594[_0x4d8666];return _0x37175b;};'use strict';var Sequelize=require('sequelize');module[_0x4a59('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a59('0x1')]}}; \ No newline at end of file +var _0xaaab=['sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xaaab,0xbe));var _0xbaaa=function(_0x4caa3a,_0x22d330){_0x4caa3a=_0x4caa3a-0x0;var _0x1777e1=_0xaaab[_0x4caa3a];return _0x1777e1;};'use strict';var Sequelize=require(_0xbaaa('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 8eff845..24e415f 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 _0x9c02=['getTags','setTags','ids','eml-format','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions'];(function(_0x5c3b79,_0x13b43b){var _0x3bacc7=function(_0x3c7714){while(--_0x3c7714){_0x5c3b79['push'](_0x5c3b79['shift']());}};_0x3bacc7(++_0x13b43b);}(_0x9c02,0x99));var _0x29c0=function(_0x2ba676,_0x3843d1){_0x2ba676=_0x2ba676-0x0;var _0xfbd231=_0x9c02[_0x2ba676];return _0xfbd231;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29c0('0x1'));var rp=require('request-promise');var moment=require(_0x29c0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require('path');var sox=require(_0x29c0('0x4'));var csv=require('to-csv');var ejs=require(_0x29c0('0x5'));var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require('squel');var crypto=require(_0x29c0('0x8'));var jsforce=require(_0x29c0('0x9'));var deskjs=require(_0x29c0('0xa'));var toCsv=require('to-csv');var querystring=require(_0x29c0('0xb'));var Papa=require(_0x29c0('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require(_0x29c0('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x29c0('0xf'));var licenseUtil=require(_0x29c0('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346cfd,_0x170e0c){_0x170e0c=_0x170e0c||0xcc;return function(_0x52a049){if(_0x52a049){return _0x346cfd[_0x29c0('0x11')](_0x170e0c);}return _0x346cfd[_0x29c0('0x12')](_0x170e0c)[_0x29c0('0x13')]();};}function respondWithResult(_0x1e7514,_0x52eecd){_0x52eecd=_0x52eecd||0xc8;return function(_0x4cb0c2){if(_0x4cb0c2){return _0x1e7514['status'](_0x52eecd)['json'](_0x4cb0c2);}};}function respondWithFilteredResult(_0x11041f,_0x599ac3){return function(_0x3a62da){if(_0x3a62da){var _0x4a28ed=typeof _0x599ac3[_0x29c0('0x14')]===_0x29c0('0x15')&&typeof _0x599ac3[_0x29c0('0x16')]===_0x29c0('0x15');var _0x4ad2b9=_0x3a62da[_0x29c0('0x17')];var _0x596108=_0x4a28ed?0x0:_0x599ac3['offset'];var _0x423a3a=_0x4a28ed?_0x3a62da[_0x29c0('0x17')]:_0x599ac3[_0x29c0('0x14')]+_0x599ac3[_0x29c0('0x16')];var _0x57ca66;if(_0x423a3a>=_0x4ad2b9){_0x423a3a=_0x4ad2b9;_0x57ca66=0xc8;}else{_0x57ca66=0xce;}_0x11041f['status'](_0x57ca66);return _0x11041f['set'](_0x29c0('0x18'),_0x596108+'-'+_0x423a3a+'/'+_0x4ad2b9)['json'](_0x3a62da);}return null;};}function patchUpdates(_0xb31d70){return function(_0x18c729){try{jsonpatch[_0x29c0('0x19')](_0x18c729,_0xb31d70,!![]);}catch(_0x367fcd){return BPromise[_0x29c0('0x1a')](_0x367fcd);}return _0x18c729['save']();};}function saveUpdates(_0xbba8fe,_0x5da54f){return function(_0x393b93){if(_0x393b93){return _0x393b93[_0x29c0('0x1b')](_0xbba8fe)[_0x29c0('0x1c')](function(_0x9c1ace){return _0x9c1ace;});}return null;};}function removeEntity(_0xd70043,_0x401026){return function(_0x3b494f){if(_0x3b494f){return _0x3b494f[_0x29c0('0x1d')]()[_0x29c0('0x1c')](function(){_0xd70043['status'](0xcc)[_0x29c0('0x13')]();});}};}function handleEntityNotFound(_0x294def,_0x4099ce){return function(_0x5b72ce){if(!_0x5b72ce){_0x294def[_0x29c0('0x11')](0x194);}return _0x5b72ce;};}function handleError(_0x3bfc65,_0x58ac99){_0x58ac99=_0x58ac99||0x1f4;return function(_0x353e31){logger[_0x29c0('0x1e')](_0x353e31[_0x29c0('0x1f')]);if(_0x353e31[_0x29c0('0x20')]){delete _0x353e31[_0x29c0('0x20')];}_0x3bfc65['status'](_0x58ac99)[_0x29c0('0x21')](_0x353e31);};}exports[_0x29c0('0x22')]=function(_0x3339fa,_0x511757){var _0x57b138={},_0x5b68e0={},_0x1046ea={'count':0x0,'rows':[]};var _0x5dd46f=_[_0x29c0('0x23')](db[_0x29c0('0x24')][_0x29c0('0x25')],function(_0x1b753b){return{'name':_0x1b753b['fieldName'],'type':_0x1b753b[_0x29c0('0x26')]['key']};});_0x5b68e0['model']=_[_0x29c0('0x23')](_0x5dd46f,_0x29c0('0x20'));_0x5b68e0['query']=_['keys'](_0x3339fa[_0x29c0('0x27')]);_0x5b68e0[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x5b68e0[_0x29c0('0x2a')],_0x5b68e0['query']);_0x57b138['attributes']=_[_0x29c0('0x29')](_0x5b68e0[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x57b138['attributes']=_0x57b138[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x57b138[_0x29c0('0x2c')]:_0x5b68e0[_0x29c0('0x2a')];if(!_0x3339fa[_0x29c0('0x27')][_0x29c0('0x2e')]('nolimit')){_0x57b138['limit']=qs[_0x29c0('0x16')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x16')]);_0x57b138[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x14')]);}_0x57b138[_0x29c0('0x2f')]=qs[_0x29c0('0x30')](_0x3339fa[_0x29c0('0x27')][_0x29c0('0x30')]);_0x57b138[_0x29c0('0x31')]=qs[_0x29c0('0x28')](_[_0x29c0('0x32')](_0x3339fa[_0x29c0('0x27')],_0x5b68e0['filters']),_0x5dd46f);if(_0x3339fa[_0x29c0('0x27')][_0x29c0('0x33')]){_0x57b138['where']=_['merge'](_0x57b138[_0x29c0('0x31')],{'$or':_['map'](_0x5dd46f,function(_0x5c6e5c){if(_0x5c6e5c['type']!==_0x29c0('0x34')){var _0xfdeffe={};_0xfdeffe[_0x5c6e5c[_0x29c0('0x20')]]={'$like':'%'+_0x3339fa[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0xfdeffe;}})});}_0x57b138=_[_0x29c0('0x35')]({},_0x57b138,_0x3339fa['options']);var _0x261713={'where':_0x57b138['where']};return db[_0x29c0('0x24')][_0x29c0('0x17')](_0x261713)[_0x29c0('0x1c')](function(_0x317d80){_0x1046ea[_0x29c0('0x17')]=_0x317d80;if(_0x3339fa['query'][_0x29c0('0x36')]){_0x57b138[_0x29c0('0x37')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x29c0('0x38')](_0x57b138);})[_0x29c0('0x1c')](function(_0x2c5bd7){_0x1046ea[_0x29c0('0x39')]=_0x2c5bd7;return _0x1046ea;})[_0x29c0('0x1c')](respondWithFilteredResult(_0x511757,_0x57b138))[_0x29c0('0x3a')](handleError(_0x511757,null));};exports[_0x29c0('0x3b')]=function(_0x16482d,_0x41cf29){var _0x391543={'raw':![],'where':{'id':_0x16482d[_0x29c0('0x3c')]['id']}},_0x1bab6c={};_0x1bab6c[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db[_0x29c0('0x24')][_0x29c0('0x25')]);_0x1bab6c[_0x29c0('0x27')]=_['keys'](_0x16482d[_0x29c0('0x27')]);_0x1bab6c[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x1bab6c[_0x29c0('0x2a')],_0x1bab6c[_0x29c0('0x27')]);_0x391543[_0x29c0('0x2c')]=_[_0x29c0('0x29')](_0x1bab6c[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x16482d[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x391543[_0x29c0('0x2c')]=_0x391543[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x391543['attributes']:_0x1bab6c[_0x29c0('0x2a')];if(_0x16482d[_0x29c0('0x27')][_0x29c0('0x36')]){_0x391543[_0x29c0('0x37')]=[{'all':!![]}];}_0x391543=_[_0x29c0('0x35')]({},_0x391543,_0x16482d[_0x29c0('0x3e')]);return db['FreshdeskConfiguration'][_0x29c0('0x3f')](_0x391543)[_0x29c0('0x1c')](handleEntityNotFound(_0x41cf29,null))[_0x29c0('0x1c')](respondWithResult(_0x41cf29,null))[_0x29c0('0x3a')](handleError(_0x41cf29,null));};exports[_0x29c0('0x40')]=function(_0x34f226,_0x2715b1){return db[_0x29c0('0x24')][_0x29c0('0x40')](_0x34f226[_0x29c0('0x41')],{})[_0x29c0('0x1c')](respondWithResult(_0x2715b1,0xc9))[_0x29c0('0x3a')](handleError(_0x2715b1,null));};exports[_0x29c0('0x1b')]=function(_0xb38671,_0x2ac97e){if(_0xb38671[_0x29c0('0x41')]['id']){delete _0xb38671[_0x29c0('0x41')]['id'];}return db[_0x29c0('0x24')]['find']({'where':{'id':_0xb38671[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x2ac97e,null))[_0x29c0('0x1c')](saveUpdates(_0xb38671[_0x29c0('0x41')],null))[_0x29c0('0x1c')](respondWithResult(_0x2ac97e,null))[_0x29c0('0x3a')](handleError(_0x2ac97e,null));};exports[_0x29c0('0x1d')]=function(_0x1b2116,_0x124bbd){return db['FreshdeskConfiguration'][_0x29c0('0x3f')]({'where':{'id':_0x1b2116[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x124bbd,null))[_0x29c0('0x1c')](removeEntity(_0x124bbd,null))[_0x29c0('0x3a')](handleError(_0x124bbd,null));};exports[_0x29c0('0x42')]=function(_0x5378de,_0x230db8,_0x375342){var _0x4e757b={};var _0x4c6dcf={};var _0x56caf0;var _0x10b34b;return db[_0x29c0('0x24')][_0x29c0('0x43')]({'where':{'id':_0x5378de['params']['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x230db8,null))[_0x29c0('0x1c')](function(_0x37d9ec){if(_0x37d9ec){_0x56caf0=_0x37d9ec;_0x4c6dcf[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db[_0x29c0('0x44')][_0x29c0('0x25')]);_0x4c6dcf['query']=_[_0x29c0('0x3d')](_0x5378de[_0x29c0('0x27')]);_0x4c6dcf[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x4c6dcf['model'],_0x4c6dcf['query']);_0x4e757b['attributes']=_[_0x29c0('0x29')](_0x4c6dcf[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x5378de['query'][_0x29c0('0x2b')]));_0x4e757b[_0x29c0('0x2c')]=_0x4e757b['attributes'][_0x29c0('0x2d')]?_0x4e757b[_0x29c0('0x2c')]:_0x4c6dcf[_0x29c0('0x2a')];_0x4e757b['order']=qs[_0x29c0('0x30')](_0x5378de['query'][_0x29c0('0x30')]);_0x4e757b['where']=qs[_0x29c0('0x28')](_[_0x29c0('0x32')](_0x5378de[_0x29c0('0x27')],_0x4c6dcf[_0x29c0('0x28')]));if(_0x5378de[_0x29c0('0x27')]['filter']){_0x4e757b['where']=_[_0x29c0('0x35')](_0x4e757b[_0x29c0('0x31')],{'$or':_[_0x29c0('0x23')](_0x4e757b[_0x29c0('0x2c')],function(_0x2f0396){var _0x11937a={};_0x11937a[_0x2f0396]={'$like':'%'+_0x5378de[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0x11937a;})});}_0x4e757b=_['merge']({},_0x4e757b,_0x5378de['options']);return _0x56caf0[_0x29c0('0x42')](_0x4e757b);}})[_0x29c0('0x1c')](function(_0x127de9){if(_0x127de9){_0x10b34b=_0x127de9[_0x29c0('0x2d')];if(!_0x5378de[_0x29c0('0x27')][_0x29c0('0x2e')](_0x29c0('0x45'))){_0x4e757b['limit']=qs[_0x29c0('0x16')](_0x5378de[_0x29c0('0x27')]['limit']);_0x4e757b[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x5378de[_0x29c0('0x27')][_0x29c0('0x14')]);}return _0x56caf0[_0x29c0('0x42')](_0x4e757b);}})[_0x29c0('0x1c')](function(_0x16bf40){if(_0x16bf40){return _0x16bf40?{'count':_0x10b34b,'rows':_0x16bf40}:null;}})[_0x29c0('0x1c')](respondWithResult(_0x230db8,null))[_0x29c0('0x3a')](handleError(_0x230db8,null));};exports[_0x29c0('0x46')]=function(_0x421878,_0x3c85b4,_0x1f0e72){var _0x18c3ca={};var _0x47de7b={};var _0x534197;var _0x41751e;return db['FreshdeskConfiguration'][_0x29c0('0x43')]({'where':{'id':_0x421878[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x3c85b4,null))[_0x29c0('0x1c')](function(_0xd26c36){if(_0xd26c36){_0x534197=_0xd26c36;_0x47de7b['model']=_[_0x29c0('0x3d')](db['FreshdeskField'][_0x29c0('0x25')]);_0x47de7b[_0x29c0('0x27')]=_[_0x29c0('0x3d')](_0x421878['query']);_0x47de7b[_0x29c0('0x28')]=_['intersection'](_0x47de7b[_0x29c0('0x2a')],_0x47de7b[_0x29c0('0x27')]);_0x18c3ca[_0x29c0('0x2c')]=_[_0x29c0('0x29')](_0x47de7b[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x421878[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x18c3ca['attributes']=_0x18c3ca[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x18c3ca[_0x29c0('0x2c')]:_0x47de7b['model'];_0x18c3ca['order']=qs[_0x29c0('0x30')](_0x421878[_0x29c0('0x27')]['sort']);_0x18c3ca['where']=qs[_0x29c0('0x28')](_[_0x29c0('0x32')](_0x421878[_0x29c0('0x27')],_0x47de7b[_0x29c0('0x28')]));if(_0x421878[_0x29c0('0x27')]['filter']){_0x18c3ca[_0x29c0('0x31')]=_[_0x29c0('0x35')](_0x18c3ca[_0x29c0('0x31')],{'$or':_[_0x29c0('0x23')](_0x18c3ca[_0x29c0('0x2c')],function(_0x3ad78b){var _0x3390a3={};_0x3390a3[_0x3ad78b]={'$like':'%'+_0x421878[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0x3390a3;})});}_0x18c3ca=_[_0x29c0('0x35')]({},_0x18c3ca,_0x421878['options']);return _0x534197[_0x29c0('0x46')](_0x18c3ca);}})[_0x29c0('0x1c')](function(_0x34e443){if(_0x34e443){_0x41751e=_0x34e443[_0x29c0('0x2d')];if(!_0x421878[_0x29c0('0x27')]['hasOwnProperty'](_0x29c0('0x45'))){_0x18c3ca[_0x29c0('0x16')]=qs[_0x29c0('0x16')](_0x421878[_0x29c0('0x27')]['limit']);_0x18c3ca[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x421878['query'][_0x29c0('0x14')]);}return _0x534197[_0x29c0('0x46')](_0x18c3ca);}})['then'](function(_0x393095){if(_0x393095){return _0x393095?{'count':_0x41751e,'rows':_0x393095}:null;}})[_0x29c0('0x1c')](respondWithResult(_0x3c85b4,null))['catch'](handleError(_0x3c85b4,null));};exports['getDescriptions']=function(_0x566054,_0x338a93,_0x1aecd7){var _0x160401={};var _0x351739={};var _0x465e59;var _0x1f3b68;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x566054[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x338a93,null))[_0x29c0('0x1c')](function(_0x21b02d){if(_0x21b02d){_0x465e59=_0x21b02d;_0x351739[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db[_0x29c0('0x44')][_0x29c0('0x25')]);_0x351739[_0x29c0('0x27')]=_[_0x29c0('0x3d')](_0x566054[_0x29c0('0x27')]);_0x351739[_0x29c0('0x28')]=_[_0x29c0('0x29')](_0x351739[_0x29c0('0x2a')],_0x351739['query']);_0x160401[_0x29c0('0x2c')]=_[_0x29c0('0x29')](_0x351739[_0x29c0('0x2a')],qs[_0x29c0('0x2b')](_0x566054[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x160401[_0x29c0('0x2c')]=_0x160401[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x160401[_0x29c0('0x2c')]:_0x351739[_0x29c0('0x2a')];_0x160401[_0x29c0('0x2f')]=qs[_0x29c0('0x30')](_0x566054[_0x29c0('0x27')][_0x29c0('0x30')]);_0x160401[_0x29c0('0x31')]=qs['filters'](_[_0x29c0('0x32')](_0x566054[_0x29c0('0x27')],_0x351739[_0x29c0('0x28')]));if(_0x566054['query']['filter']){_0x160401[_0x29c0('0x31')]=_[_0x29c0('0x35')](_0x160401['where'],{'$or':_[_0x29c0('0x23')](_0x160401[_0x29c0('0x2c')],function(_0x5d2d49){var _0x1a44ad={};_0x1a44ad[_0x5d2d49]={'$like':'%'+_0x566054[_0x29c0('0x27')][_0x29c0('0x33')]+'%'};return _0x1a44ad;})});}_0x160401=_[_0x29c0('0x35')]({},_0x160401,_0x566054[_0x29c0('0x3e')]);return _0x465e59[_0x29c0('0x47')](_0x160401);}})[_0x29c0('0x1c')](function(_0x40f857){if(_0x40f857){_0x1f3b68=_0x40f857[_0x29c0('0x2d')];if(!_0x566054['query'][_0x29c0('0x2e')](_0x29c0('0x45'))){_0x160401[_0x29c0('0x16')]=qs['limit'](_0x566054[_0x29c0('0x27')][_0x29c0('0x16')]);_0x160401[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x566054[_0x29c0('0x27')][_0x29c0('0x14')]);}return _0x465e59[_0x29c0('0x47')](_0x160401);}})[_0x29c0('0x1c')](function(_0x313417){if(_0x313417){return _0x313417?{'count':_0x1f3b68,'rows':_0x313417}:null;}})['then'](respondWithResult(_0x338a93,null))[_0x29c0('0x3a')](handleError(_0x338a93,null));};exports['getTags']=function(_0x141185,_0x5ef85f,_0x586b53){var _0x556625={};var _0x5ad8ec={};var _0x5ed366;var _0x1b787a;return db[_0x29c0('0x24')][_0x29c0('0x43')]({'where':{'id':_0x141185[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x5ef85f,null))[_0x29c0('0x1c')](function(_0x4ef893){if(_0x4ef893){_0x5ed366=_0x4ef893;_0x5ad8ec[_0x29c0('0x2a')]=_[_0x29c0('0x3d')](db['Tag']['rawAttributes']);_0x5ad8ec[_0x29c0('0x27')]=_[_0x29c0('0x3d')](_0x141185['query']);_0x5ad8ec['filters']=_[_0x29c0('0x29')](_0x5ad8ec[_0x29c0('0x2a')],_0x5ad8ec[_0x29c0('0x27')]);_0x556625['attributes']=_['intersection'](_0x5ad8ec['model'],qs[_0x29c0('0x2b')](_0x141185[_0x29c0('0x27')][_0x29c0('0x2b')]));_0x556625[_0x29c0('0x2c')]=_0x556625[_0x29c0('0x2c')][_0x29c0('0x2d')]?_0x556625[_0x29c0('0x2c')]:_0x5ad8ec['model'];_0x556625[_0x29c0('0x2f')]=qs[_0x29c0('0x30')](_0x141185[_0x29c0('0x27')][_0x29c0('0x30')]);_0x556625[_0x29c0('0x31')]=qs['filters'](_[_0x29c0('0x32')](_0x141185[_0x29c0('0x27')],_0x5ad8ec[_0x29c0('0x28')]));if(_0x141185['query'][_0x29c0('0x33')]){_0x556625[_0x29c0('0x31')]=_[_0x29c0('0x35')](_0x556625[_0x29c0('0x31')],{'$or':_[_0x29c0('0x23')](_0x556625[_0x29c0('0x2c')],function(_0x442f39){var _0x25aec7={};_0x25aec7[_0x442f39]={'$like':'%'+_0x141185['query'][_0x29c0('0x33')]+'%'};return _0x25aec7;})});}_0x556625=_[_0x29c0('0x35')]({},_0x556625,_0x141185[_0x29c0('0x3e')]);return _0x5ed366[_0x29c0('0x48')](_0x556625);}})[_0x29c0('0x1c')](function(_0x2a2203){if(_0x2a2203){_0x1b787a=_0x2a2203[_0x29c0('0x2d')];if(!_0x141185[_0x29c0('0x27')]['hasOwnProperty'](_0x29c0('0x45'))){_0x556625[_0x29c0('0x16')]=qs[_0x29c0('0x16')](_0x141185[_0x29c0('0x27')][_0x29c0('0x16')]);_0x556625[_0x29c0('0x14')]=qs[_0x29c0('0x14')](_0x141185['query'][_0x29c0('0x14')]);}return _0x5ed366[_0x29c0('0x48')](_0x556625);}})[_0x29c0('0x1c')](function(_0x44607c){if(_0x44607c){return _0x44607c?{'count':_0x1b787a,'rows':_0x44607c}:null;}})[_0x29c0('0x1c')](respondWithResult(_0x5ef85f,null))['catch'](handleError(_0x5ef85f,null));};exports[_0x29c0('0x49')]=function(_0x2c2b48,_0x59a708,_0x98a81e){if(_0x2c2b48[_0x29c0('0x41')]['id']){delete _0x2c2b48[_0x29c0('0x41')]['id'];}return db['FreshdeskConfiguration'][_0x29c0('0x43')]({'where':{'id':_0x2c2b48[_0x29c0('0x3c')]['id']}})[_0x29c0('0x1c')](handleEntityNotFound(_0x59a708,null))[_0x29c0('0x1c')](function(_0x376e2f){if(_0x376e2f){return _0x376e2f[_0x29c0('0x49')](_0x2c2b48[_0x29c0('0x41')][_0x29c0('0x4a')]||[]);}return null;})[_0x29c0('0x1c')](respondWithResult(_0x59a708,null))[_0x29c0('0x3a')](handleError(_0x59a708,null));}; \ No newline at end of file +var _0x0893=['catch','show','params','keys','create','body','find','getFields','FreshdeskField','order','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x198962,_0x247f6a){var _0x35d350=function(_0x22558e){while(--_0x22558e){_0x198962['push'](_0x198962['shift']());}};_0x35d350(++_0x247f6a);}(_0x0893,0x169));var _0x3089=function(_0x5ce5a5,_0x15941d){_0x5ce5a5=_0x5ce5a5-0x0;var _0x554836=_0x0893[_0x5ce5a5];return _0x554836;};'use strict';var emlformat=require(_0x3089('0x0'));var rimraf=require(_0x3089('0x1'));var zipdir=require(_0x3089('0x2'));var jsonpatch=require(_0x3089('0x3'));var rp=require(_0x3089('0x4'));var moment=require(_0x3089('0x5'));var BPromise=require(_0x3089('0x6'));var Mustache=require(_0x3089('0x7'));var util=require('util');var path=require(_0x3089('0x8'));var sox=require('sox');var csv=require(_0x3089('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3089('0xa'));var _=require('lodash');var squel=require(_0x3089('0xb'));var crypto=require(_0x3089('0xc'));var jsforce=require(_0x3089('0xd'));var deskjs=require(_0x3089('0xe'));var toCsv=require(_0x3089('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3089('0xf'));var authService=require(_0x3089('0x10'));var qs=require(_0x3089('0x11'));var as=require(_0x3089('0x12'));var hardwareService=require(_0x3089('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3089('0x14'));var config=require(_0x3089('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3089('0x16'))['db'];function respondWithStatusCode(_0x405b15,_0x5621a4){_0x5621a4=_0x5621a4||0xcc;return function(_0x31236d){if(_0x31236d){return _0x405b15[_0x3089('0x17')](_0x5621a4);}return _0x405b15[_0x3089('0x18')](_0x5621a4)[_0x3089('0x19')]();};}function respondWithResult(_0x51b3ba,_0x5603d9){_0x5603d9=_0x5603d9||0xc8;return function(_0x571e71){if(_0x571e71){return _0x51b3ba[_0x3089('0x18')](_0x5603d9)[_0x3089('0x1a')](_0x571e71);}};}function respondWithFilteredResult(_0x57b07,_0xabeacb){return function(_0x35cb8f){if(_0x35cb8f){var _0xfb51e0=typeof _0xabeacb[_0x3089('0x1b')]===_0x3089('0x1c')&&typeof _0xabeacb[_0x3089('0x1d')]===_0x3089('0x1c');var _0x4a4d7e=_0x35cb8f[_0x3089('0x1e')];var _0x683a4=_0xfb51e0?0x0:_0xabeacb[_0x3089('0x1b')];var _0x3f4de1=_0xfb51e0?_0x35cb8f[_0x3089('0x1e')]:_0xabeacb[_0x3089('0x1b')]+_0xabeacb[_0x3089('0x1d')];var _0x9d3a69;if(_0x3f4de1>=_0x4a4d7e){_0x3f4de1=_0x4a4d7e;_0x9d3a69=0xc8;}else{_0x9d3a69=0xce;}_0x57b07[_0x3089('0x18')](_0x9d3a69);return _0x57b07[_0x3089('0x1f')](_0x3089('0x20'),_0x683a4+'-'+_0x3f4de1+'/'+_0x4a4d7e)[_0x3089('0x1a')](_0x35cb8f);}return null;};}function patchUpdates(_0x37c6e7){return function(_0x586ccc){try{jsonpatch[_0x3089('0x21')](_0x586ccc,_0x37c6e7,!![]);}catch(_0x359600){return BPromise[_0x3089('0x22')](_0x359600);}return _0x586ccc[_0x3089('0x23')]();};}function saveUpdates(_0x1b41d1,_0x113c41){return function(_0x41e7ed){if(_0x41e7ed){return _0x41e7ed[_0x3089('0x24')](_0x1b41d1)[_0x3089('0x25')](function(_0x28d6ac){return _0x28d6ac;});}return null;};}function removeEntity(_0x5ad854,_0x1df664){return function(_0x11523e){if(_0x11523e){return _0x11523e[_0x3089('0x26')]()[_0x3089('0x25')](function(){_0x5ad854[_0x3089('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4281f6,_0x162eae){return function(_0x574eb6){if(!_0x574eb6){_0x4281f6[_0x3089('0x17')](0x194);}return _0x574eb6;};}function handleError(_0x4314ec,_0x32bba4){_0x32bba4=_0x32bba4||0x1f4;return function(_0x4c93e5){logger[_0x3089('0x27')](_0x4c93e5[_0x3089('0x28')]);if(_0x4c93e5[_0x3089('0x29')]){delete _0x4c93e5['name'];}_0x4314ec[_0x3089('0x18')](_0x32bba4)[_0x3089('0x2a')](_0x4c93e5);};}exports[_0x3089('0x2b')]=function(_0x109d48,_0x1531d8){var _0x35b4a1={},_0x24457c={},_0x389efe={'count':0x0,'rows':[]};var _0x4438ee=_[_0x3089('0x2c')](db[_0x3089('0x2d')][_0x3089('0x2e')],function(_0xeab931){return{'name':_0xeab931['fieldName'],'type':_0xeab931[_0x3089('0x2f')][_0x3089('0x30')]};});_0x24457c[_0x3089('0x31')]=_[_0x3089('0x2c')](_0x4438ee,_0x3089('0x29'));_0x24457c[_0x3089('0x32')]=_['keys'](_0x109d48[_0x3089('0x32')]);_0x24457c[_0x3089('0x33')]=_['intersection'](_0x24457c[_0x3089('0x31')],_0x24457c['query']);_0x35b4a1[_0x3089('0x34')]=_[_0x3089('0x35')](_0x24457c[_0x3089('0x31')],qs[_0x3089('0x36')](_0x109d48[_0x3089('0x32')][_0x3089('0x36')]));_0x35b4a1[_0x3089('0x34')]=_0x35b4a1[_0x3089('0x34')][_0x3089('0x37')]?_0x35b4a1[_0x3089('0x34')]:_0x24457c['model'];if(!_0x109d48[_0x3089('0x32')][_0x3089('0x38')](_0x3089('0x39'))){_0x35b4a1[_0x3089('0x1d')]=qs['limit'](_0x109d48[_0x3089('0x32')][_0x3089('0x1d')]);_0x35b4a1['offset']=qs[_0x3089('0x1b')](_0x109d48[_0x3089('0x32')][_0x3089('0x1b')]);}_0x35b4a1['order']=qs[_0x3089('0x3a')](_0x109d48[_0x3089('0x32')][_0x3089('0x3a')]);_0x35b4a1[_0x3089('0x3b')]=qs[_0x3089('0x33')](_[_0x3089('0x3c')](_0x109d48[_0x3089('0x32')],_0x24457c['filters']),_0x4438ee);if(_0x109d48[_0x3089('0x32')][_0x3089('0x3d')]){_0x35b4a1[_0x3089('0x3b')]=_[_0x3089('0x3e')](_0x35b4a1[_0x3089('0x3b')],{'$or':_[_0x3089('0x2c')](_0x4438ee,function(_0x3ce538){if(_0x3ce538[_0x3089('0x2f')]!==_0x3089('0x3f')){var _0x463f1a={};_0x463f1a[_0x3ce538[_0x3089('0x29')]]={'$like':'%'+_0x109d48[_0x3089('0x32')]['filter']+'%'};return _0x463f1a;}})});}_0x35b4a1=_[_0x3089('0x3e')]({},_0x35b4a1,_0x109d48[_0x3089('0x40')]);var _0x2dc3a0={'where':_0x35b4a1[_0x3089('0x3b')]};return db['FreshdeskConfiguration'][_0x3089('0x1e')](_0x2dc3a0)['then'](function(_0x13b207){_0x389efe[_0x3089('0x1e')]=_0x13b207;if(_0x109d48[_0x3089('0x32')][_0x3089('0x41')]){_0x35b4a1[_0x3089('0x42')]=[{'all':!![]}];}return db[_0x3089('0x2d')][_0x3089('0x43')](_0x35b4a1);})['then'](function(_0x4763a9){_0x389efe[_0x3089('0x44')]=_0x4763a9;return _0x389efe;})[_0x3089('0x25')](respondWithFilteredResult(_0x1531d8,_0x35b4a1))[_0x3089('0x45')](handleError(_0x1531d8,null));};exports[_0x3089('0x46')]=function(_0x406ef3,_0x15487c){var _0xa22f25={'raw':![],'where':{'id':_0x406ef3[_0x3089('0x47')]['id']}},_0x3d1316={};_0x3d1316[_0x3089('0x31')]=_[_0x3089('0x48')](db[_0x3089('0x2d')]['rawAttributes']);_0x3d1316[_0x3089('0x32')]=_[_0x3089('0x48')](_0x406ef3['query']);_0x3d1316['filters']=_[_0x3089('0x35')](_0x3d1316[_0x3089('0x31')],_0x3d1316['query']);_0xa22f25[_0x3089('0x34')]=_[_0x3089('0x35')](_0x3d1316[_0x3089('0x31')],qs[_0x3089('0x36')](_0x406ef3[_0x3089('0x32')]['fields']));_0xa22f25[_0x3089('0x34')]=_0xa22f25[_0x3089('0x34')]['length']?_0xa22f25[_0x3089('0x34')]:_0x3d1316['model'];if(_0x406ef3[_0x3089('0x32')][_0x3089('0x41')]){_0xa22f25[_0x3089('0x42')]=[{'all':!![]}];}_0xa22f25=_[_0x3089('0x3e')]({},_0xa22f25,_0x406ef3[_0x3089('0x40')]);return db[_0x3089('0x2d')]['find'](_0xa22f25)[_0x3089('0x25')](handleEntityNotFound(_0x15487c,null))[_0x3089('0x25')](respondWithResult(_0x15487c,null))[_0x3089('0x45')](handleError(_0x15487c,null));};exports[_0x3089('0x49')]=function(_0x5d0fc0,_0x4549a0){return db[_0x3089('0x2d')][_0x3089('0x49')](_0x5d0fc0[_0x3089('0x4a')],{})[_0x3089('0x25')](respondWithResult(_0x4549a0,0xc9))['catch'](handleError(_0x4549a0,null));};exports[_0x3089('0x24')]=function(_0x28319c,_0x405b4b){if(_0x28319c[_0x3089('0x4a')]['id']){delete _0x28319c['body']['id'];}return db[_0x3089('0x2d')][_0x3089('0x4b')]({'where':{'id':_0x28319c['params']['id']}})[_0x3089('0x25')](handleEntityNotFound(_0x405b4b,null))['then'](saveUpdates(_0x28319c[_0x3089('0x4a')],null))[_0x3089('0x25')](respondWithResult(_0x405b4b,null))[_0x3089('0x45')](handleError(_0x405b4b,null));};exports[_0x3089('0x26')]=function(_0x151f18,_0x470e53){return db[_0x3089('0x2d')]['find']({'where':{'id':_0x151f18[_0x3089('0x47')]['id']}})[_0x3089('0x25')](handleEntityNotFound(_0x470e53,null))[_0x3089('0x25')](removeEntity(_0x470e53,null))[_0x3089('0x45')](handleError(_0x470e53,null));};exports[_0x3089('0x4c')]=function(_0x461472,_0x33fc0a,_0x51f87c){var _0x4bc148={};var _0x3c7774={};var _0x86a2ce;var _0x48d073;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x461472['params']['id']}})[_0x3089('0x25')](handleEntityNotFound(_0x33fc0a,null))[_0x3089('0x25')](function(_0x1f9db7){if(_0x1f9db7){_0x86a2ce=_0x1f9db7;_0x3c7774['model']=_['keys'](db[_0x3089('0x4d')]['rawAttributes']);_0x3c7774[_0x3089('0x32')]=_[_0x3089('0x48')](_0x461472['query']);_0x3c7774['filters']=_[_0x3089('0x35')](_0x3c7774[_0x3089('0x31')],_0x3c7774[_0x3089('0x32')]);_0x4bc148[_0x3089('0x34')]=_[_0x3089('0x35')](_0x3c7774[_0x3089('0x31')],qs[_0x3089('0x36')](_0x461472['query'][_0x3089('0x36')]));_0x4bc148[_0x3089('0x34')]=_0x4bc148[_0x3089('0x34')][_0x3089('0x37')]?_0x4bc148[_0x3089('0x34')]:_0x3c7774[_0x3089('0x31')];_0x4bc148[_0x3089('0x4e')]=qs['sort'](_0x461472[_0x3089('0x32')][_0x3089('0x3a')]);_0x4bc148[_0x3089('0x3b')]=qs[_0x3089('0x33')](_[_0x3089('0x3c')](_0x461472[_0x3089('0x32')],_0x3c7774[_0x3089('0x33')]));if(_0x461472[_0x3089('0x32')][_0x3089('0x3d')]){_0x4bc148[_0x3089('0x3b')]=_['merge'](_0x4bc148[_0x3089('0x3b')],{'$or':_[_0x3089('0x2c')](_0x4bc148[_0x3089('0x34')],function(_0xe8e5d6){var _0x199644={};_0x199644[_0xe8e5d6]={'$like':'%'+_0x461472[_0x3089('0x32')][_0x3089('0x3d')]+'%'};return _0x199644;})});}_0x4bc148=_[_0x3089('0x3e')]({},_0x4bc148,_0x461472[_0x3089('0x40')]);return _0x86a2ce[_0x3089('0x4c')](_0x4bc148);}})['then'](function(_0x2fd97d){if(_0x2fd97d){_0x48d073=_0x2fd97d[_0x3089('0x37')];if(!_0x461472[_0x3089('0x32')]['hasOwnProperty'](_0x3089('0x39'))){_0x4bc148[_0x3089('0x1d')]=qs[_0x3089('0x1d')](_0x461472[_0x3089('0x32')]['limit']);_0x4bc148[_0x3089('0x1b')]=qs[_0x3089('0x1b')](_0x461472[_0x3089('0x32')][_0x3089('0x1b')]);}return _0x86a2ce[_0x3089('0x4c')](_0x4bc148);}})[_0x3089('0x25')](function(_0x1c6198){if(_0x1c6198){return _0x1c6198?{'count':_0x48d073,'rows':_0x1c6198}:null;}})[_0x3089('0x25')](respondWithResult(_0x33fc0a,null))[_0x3089('0x45')](handleError(_0x33fc0a,null));};exports['getSubjects']=function(_0x362fcb,_0x2cc7d6,_0x30f215){var _0x561e0d={};var _0x4d29b3={};var _0x54f062;var _0x29d88a;return db[_0x3089('0x2d')][_0x3089('0x4f')]({'where':{'id':_0x362fcb['params']['id']}})[_0x3089('0x25')](handleEntityNotFound(_0x2cc7d6,null))[_0x3089('0x25')](function(_0xe2978b){if(_0xe2978b){_0x54f062=_0xe2978b;_0x4d29b3['model']=_['keys'](db[_0x3089('0x4d')][_0x3089('0x2e')]);_0x4d29b3['query']=_[_0x3089('0x48')](_0x362fcb[_0x3089('0x32')]);_0x4d29b3['filters']=_[_0x3089('0x35')](_0x4d29b3[_0x3089('0x31')],_0x4d29b3['query']);_0x561e0d[_0x3089('0x34')]=_[_0x3089('0x35')](_0x4d29b3[_0x3089('0x31')],qs[_0x3089('0x36')](_0x362fcb[_0x3089('0x32')][_0x3089('0x36')]));_0x561e0d[_0x3089('0x34')]=_0x561e0d[_0x3089('0x34')]['length']?_0x561e0d[_0x3089('0x34')]:_0x4d29b3[_0x3089('0x31')];_0x561e0d[_0x3089('0x4e')]=qs[_0x3089('0x3a')](_0x362fcb['query'][_0x3089('0x3a')]);_0x561e0d[_0x3089('0x3b')]=qs[_0x3089('0x33')](_['pick'](_0x362fcb[_0x3089('0x32')],_0x4d29b3[_0x3089('0x33')]));if(_0x362fcb['query'][_0x3089('0x3d')]){_0x561e0d[_0x3089('0x3b')]=_[_0x3089('0x3e')](_0x561e0d[_0x3089('0x3b')],{'$or':_[_0x3089('0x2c')](_0x561e0d[_0x3089('0x34')],function(_0x19e3ac){var _0x424ffa={};_0x424ffa[_0x19e3ac]={'$like':'%'+_0x362fcb[_0x3089('0x32')][_0x3089('0x3d')]+'%'};return _0x424ffa;})});}_0x561e0d=_['merge']({},_0x561e0d,_0x362fcb[_0x3089('0x40')]);return _0x54f062[_0x3089('0x50')](_0x561e0d);}})[_0x3089('0x25')](function(_0x41895a){if(_0x41895a){_0x29d88a=_0x41895a[_0x3089('0x37')];if(!_0x362fcb[_0x3089('0x32')]['hasOwnProperty'](_0x3089('0x39'))){_0x561e0d[_0x3089('0x1d')]=qs['limit'](_0x362fcb[_0x3089('0x32')][_0x3089('0x1d')]);_0x561e0d[_0x3089('0x1b')]=qs[_0x3089('0x1b')](_0x362fcb['query'][_0x3089('0x1b')]);}return _0x54f062['getSubjects'](_0x561e0d);}})[_0x3089('0x25')](function(_0x5a7e61){if(_0x5a7e61){return _0x5a7e61?{'count':_0x29d88a,'rows':_0x5a7e61}:null;}})['then'](respondWithResult(_0x2cc7d6,null))[_0x3089('0x45')](handleError(_0x2cc7d6,null));};exports[_0x3089('0x51')]=function(_0x4edf9d,_0x2acb50,_0x247688){var _0x309ae2={};var _0x3bd501={};var _0x3faa71;var _0x19db61;return db[_0x3089('0x2d')]['findOne']({'where':{'id':_0x4edf9d['params']['id']}})['then'](handleEntityNotFound(_0x2acb50,null))[_0x3089('0x25')](function(_0x24dbd7){if(_0x24dbd7){_0x3faa71=_0x24dbd7;_0x3bd501[_0x3089('0x31')]=_[_0x3089('0x48')](db['FreshdeskField'][_0x3089('0x2e')]);_0x3bd501[_0x3089('0x32')]=_[_0x3089('0x48')](_0x4edf9d[_0x3089('0x32')]);_0x3bd501[_0x3089('0x33')]=_['intersection'](_0x3bd501[_0x3089('0x31')],_0x3bd501[_0x3089('0x32')]);_0x309ae2[_0x3089('0x34')]=_['intersection'](_0x3bd501['model'],qs[_0x3089('0x36')](_0x4edf9d[_0x3089('0x32')][_0x3089('0x36')]));_0x309ae2[_0x3089('0x34')]=_0x309ae2[_0x3089('0x34')][_0x3089('0x37')]?_0x309ae2[_0x3089('0x34')]:_0x3bd501[_0x3089('0x31')];_0x309ae2[_0x3089('0x4e')]=qs[_0x3089('0x3a')](_0x4edf9d[_0x3089('0x32')][_0x3089('0x3a')]);_0x309ae2['where']=qs[_0x3089('0x33')](_['pick'](_0x4edf9d[_0x3089('0x32')],_0x3bd501[_0x3089('0x33')]));if(_0x4edf9d[_0x3089('0x32')][_0x3089('0x3d')]){_0x309ae2['where']=_['merge'](_0x309ae2[_0x3089('0x3b')],{'$or':_[_0x3089('0x2c')](_0x309ae2[_0x3089('0x34')],function(_0x59278c){var _0x1be935={};_0x1be935[_0x59278c]={'$like':'%'+_0x4edf9d[_0x3089('0x32')][_0x3089('0x3d')]+'%'};return _0x1be935;})});}_0x309ae2=_[_0x3089('0x3e')]({},_0x309ae2,_0x4edf9d['options']);return _0x3faa71[_0x3089('0x51')](_0x309ae2);}})['then'](function(_0x213fce){if(_0x213fce){_0x19db61=_0x213fce[_0x3089('0x37')];if(!_0x4edf9d[_0x3089('0x32')]['hasOwnProperty'](_0x3089('0x39'))){_0x309ae2[_0x3089('0x1d')]=qs[_0x3089('0x1d')](_0x4edf9d[_0x3089('0x32')]['limit']);_0x309ae2[_0x3089('0x1b')]=qs[_0x3089('0x1b')](_0x4edf9d['query']['offset']);}return _0x3faa71[_0x3089('0x51')](_0x309ae2);}})[_0x3089('0x25')](function(_0x5d5716){if(_0x5d5716){return _0x5d5716?{'count':_0x19db61,'rows':_0x5d5716}:null;}})[_0x3089('0x25')](respondWithResult(_0x2acb50,null))[_0x3089('0x45')](handleError(_0x2acb50,null));};exports[_0x3089('0x52')]=function(_0x57ad7d,_0x1bae67,_0x1c7257){var _0x50aaa6={};var _0x20e337={};var _0x3d9a93;var _0x35d538;return db[_0x3089('0x2d')]['findOne']({'where':{'id':_0x57ad7d[_0x3089('0x47')]['id']}})[_0x3089('0x25')](handleEntityNotFound(_0x1bae67,null))[_0x3089('0x25')](function(_0x49de46){if(_0x49de46){_0x3d9a93=_0x49de46;_0x20e337['model']=_['keys'](db[_0x3089('0x53')][_0x3089('0x2e')]);_0x20e337[_0x3089('0x32')]=_[_0x3089('0x48')](_0x57ad7d[_0x3089('0x32')]);_0x20e337[_0x3089('0x33')]=_[_0x3089('0x35')](_0x20e337['model'],_0x20e337[_0x3089('0x32')]);_0x50aaa6[_0x3089('0x34')]=_[_0x3089('0x35')](_0x20e337['model'],qs[_0x3089('0x36')](_0x57ad7d['query'][_0x3089('0x36')]));_0x50aaa6[_0x3089('0x34')]=_0x50aaa6[_0x3089('0x34')]['length']?_0x50aaa6['attributes']:_0x20e337[_0x3089('0x31')];_0x50aaa6[_0x3089('0x4e')]=qs['sort'](_0x57ad7d[_0x3089('0x32')][_0x3089('0x3a')]);_0x50aaa6['where']=qs['filters'](_[_0x3089('0x3c')](_0x57ad7d[_0x3089('0x32')],_0x20e337[_0x3089('0x33')]));if(_0x57ad7d[_0x3089('0x32')][_0x3089('0x3d')]){_0x50aaa6[_0x3089('0x3b')]=_[_0x3089('0x3e')](_0x50aaa6['where'],{'$or':_[_0x3089('0x2c')](_0x50aaa6['attributes'],function(_0x34d9d6){var _0x456668={};_0x456668[_0x34d9d6]={'$like':'%'+_0x57ad7d[_0x3089('0x32')][_0x3089('0x3d')]+'%'};return _0x456668;})});}_0x50aaa6=_[_0x3089('0x3e')]({},_0x50aaa6,_0x57ad7d[_0x3089('0x40')]);return _0x3d9a93[_0x3089('0x52')](_0x50aaa6);}})[_0x3089('0x25')](function(_0x5ca6f6){if(_0x5ca6f6){_0x35d538=_0x5ca6f6['length'];if(!_0x57ad7d['query'][_0x3089('0x38')](_0x3089('0x39'))){_0x50aaa6['limit']=qs[_0x3089('0x1d')](_0x57ad7d[_0x3089('0x32')][_0x3089('0x1d')]);_0x50aaa6[_0x3089('0x1b')]=qs['offset'](_0x57ad7d[_0x3089('0x32')][_0x3089('0x1b')]);}return _0x3d9a93[_0x3089('0x52')](_0x50aaa6);}})['then'](function(_0x93b958){if(_0x93b958){return _0x93b958?{'count':_0x35d538,'rows':_0x93b958}:null;}})[_0x3089('0x25')](respondWithResult(_0x1bae67,null))[_0x3089('0x45')](handleError(_0x1bae67,null));};exports[_0x3089('0x54')]=function(_0x391513,_0x135206,_0x243016){if(_0x391513[_0x3089('0x4a')]['id']){delete _0x391513[_0x3089('0x4a')]['id'];}return db[_0x3089('0x2d')][_0x3089('0x4f')]({'where':{'id':_0x391513[_0x3089('0x47')]['id']}})[_0x3089('0x25')](handleEntityNotFound(_0x135206,null))[_0x3089('0x25')](function(_0x41242e){if(_0x41242e){return _0x41242e[_0x3089('0x54')](_0x391513[_0x3089('0x4a')][_0x3089('0x55')]||[]);}return null;})[_0x3089('0x25')](respondWithResult(_0x135206,null))[_0x3089('0x45')](handleError(_0x135206,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 66a503d..e0c5a11 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 _0xb73e=['int_freshdesk_configurations','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports','FreshdeskConfiguration'];(function(_0xa0a2e0,_0x4b6fdd){var _0x6a4a9a=function(_0x30e988){while(--_0x30e988){_0xa0a2e0['push'](_0xa0a2e0['shift']());}};_0x6a4a9a(++_0x4b6fdd);}(_0xb73e,0x7f));var _0xeb73=function(_0x7459fe,_0x1024a0){_0x7459fe=_0x7459fe-0x0;var _0x2f698d=_0xb73e[_0x7459fe];return _0x2f698d;};'use strict';var _=require(_0xeb73('0x0'));var util=require(_0xeb73('0x1'));var logger=require(_0xeb73('0x2'))(_0xeb73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb73('0x4'));var config=require(_0xeb73('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xeb73('0x6')]=function(_0x4993d8,_0x44fa53){return _0x4993d8['define'](_0xeb73('0x7'),attributes,{'tableName':_0xeb73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ec0=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0x6ec0,0x110));var _0x06ec=function(_0x3276ef,_0x552350){_0x3276ef=_0x3276ef-0x0;var _0x5940f5=_0x6ec0[_0x3276ef];return _0x5940f5;};'use strict';var _=require('lodash');var util=require(_0x06ec('0x0'));var logger=require(_0x06ec('0x1'))(_0x06ec('0x2'));var moment=require(_0x06ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x06ec('0x4'));var fs=require('fs');var path=require(_0x06ec('0x5'));var rimraf=require('rimraf');var config=require(_0x06ec('0x6'));var attributes=require(_0x06ec('0x7'));module[_0x06ec('0x8')]=function(_0x4003c2,_0xbf2c24){return _0x4003c2[_0x06ec('0x9')](_0x06ec('0xa'),attributes,{'tableName':_0x06ec('0xb'),'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 215dac2..66c7df2 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 _0x5cbe=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x3a2fc9,_0x526677){var _0x2e0e54=function(_0x3de021){while(--_0x3de021){_0x3a2fc9['push'](_0x3a2fc9['shift']());}};_0x2e0e54(++_0x526677);}(_0x5cbe,0x182));var _0xe5cb=function(_0x41141c,_0x6b1368){_0x41141c=_0x41141c-0x0;var _0x58adc5=_0x5cbe[_0x41141c];return _0x58adc5;};'use strict';var _=require(_0xe5cb('0x0'));var util=require(_0xe5cb('0x1'));var moment=require(_0xe5cb('0x2'));var BPromise=require(_0xe5cb('0x3'));var rs=require(_0xe5cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5cb('0x5'))['db'];var utils=require(_0xe5cb('0x6'));var logger=require(_0xe5cb('0x7'))('rpc');var config=require(_0xe5cb('0x8'));var jayson=require(_0xe5cb('0x9'));var client=jayson[_0xe5cb('0xa')][_0xe5cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fb14c,_0x43cfdb,_0x136221){return new BPromise(function(_0x415b28,_0x298153){return client[_0xe5cb('0xc')](_0x1fb14c,_0x136221)[_0xe5cb('0xd')](function(_0x1e945){logger[_0xe5cb('0xe')](_0xe5cb('0xf'),_0x43cfdb,'request\x20sent');logger[_0xe5cb('0x10')](_0xe5cb('0x11'),_0x43cfdb,'request\x20sent',JSON[_0xe5cb('0x12')](_0x1e945));if(_0x1e945[_0xe5cb('0x13')]){if(_0x1e945[_0xe5cb('0x13')]['code']===0x1f4){logger[_0xe5cb('0x13')](_0xe5cb('0xf'),_0x43cfdb,_0x1e945['error']['message']);return _0x298153(_0x1e945[_0xe5cb('0x13')]['message']);}logger[_0xe5cb('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x43cfdb,_0x1e945[_0xe5cb('0x13')][_0xe5cb('0x14')]);return _0x415b28(_0x1e945[_0xe5cb('0x13')][_0xe5cb('0x14')]);}else{logger[_0xe5cb('0xe')](_0xe5cb('0xf'),_0x43cfdb,_0xe5cb('0x15'));_0x415b28(_0x1e945[_0xe5cb('0x16')][_0xe5cb('0x14')]);}})[_0xe5cb('0x17')](function(_0x2dc0cb){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x43cfdb,_0x2dc0cb);_0x298153(_0x2dc0cb);});});} \ No newline at end of file +var _0x5056=['randomstring','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment'];(function(_0x18f1eb,_0x16d38a){var _0x2cce34=function(_0x5984e3){while(--_0x5984e3){_0x18f1eb['push'](_0x18f1eb['shift']());}};_0x2cce34(++_0x16d38a);}(_0x5056,0x141));var _0x6505=function(_0x3d5667,_0x49505c){_0x3d5667=_0x3d5667-0x0;var _0xf8c59=_0x5056[_0x3d5667];return _0xf8c59;};'use strict';var _=require(_0x6505('0x0'));var util=require('util');var moment=require(_0x6505('0x1'));var BPromise=require('bluebird');var rs=require(_0x6505('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6505('0x3'))(_0x6505('0x4'));var config=require(_0x6505('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6505('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481b76,_0x2914f4,_0x151e82){return new BPromise(function(_0x5b80fe,_0x389429){return client[_0x6505('0x7')](_0x481b76,_0x151e82)[_0x6505('0x8')](function(_0x13aad5){logger[_0x6505('0x9')](_0x6505('0xa'),_0x2914f4,'request\x20sent');logger[_0x6505('0xb')](_0x6505('0xc'),_0x2914f4,_0x6505('0xd'),JSON['stringify'](_0x13aad5));if(_0x13aad5['error']){if(_0x13aad5[_0x6505('0xe')][_0x6505('0xf')]===0x1f4){logger[_0x6505('0xe')](_0x6505('0xa'),_0x2914f4,_0x13aad5[_0x6505('0xe')][_0x6505('0x10')]);return _0x389429(_0x13aad5[_0x6505('0xe')]['message']);}logger[_0x6505('0xe')](_0x6505('0xa'),_0x2914f4,_0x13aad5[_0x6505('0xe')][_0x6505('0x10')]);return _0x5b80fe(_0x13aad5['error'][_0x6505('0x10')]);}else{logger[_0x6505('0x9')](_0x6505('0xa'),_0x2914f4,_0x6505('0xd'));_0x5b80fe(_0x13aad5[_0x6505('0x11')][_0x6505('0x10')]);}})[_0x6505('0x12')](function(_0x2d7930){logger[_0x6505('0xe')](_0x6505('0xa'),_0x2914f4,_0x2d7930);_0x389429(_0x2d7930);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6e51a1a..32a8034 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 _0x3e93=['../../config/environment','./intFreshdeskField.controller','index','get','/:id','isAuthenticated','show','post','put','delete','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x88a98e,_0x56668b){var _0x23eede=function(_0x165899){while(--_0x165899){_0x88a98e['push'](_0x88a98e['shift']());}};_0x23eede(++_0x56668b);}(_0x3e93,0xda));var _0x33e9=function(_0x4029dc,_0x5c3bf1){_0x4029dc=_0x4029dc-0x0;var _0x4971e0=_0x3e93[_0x4029dc];return _0x4971e0;};'use strict';var multer=require(_0x33e9('0x0'));var util=require(_0x33e9('0x1'));var path=require(_0x33e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x33e9('0x3'));var router=express['Router']();var fs_extra=require(_0x33e9('0x4'));var auth=require(_0x33e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x33e9('0x6'));var controller=require(_0x33e9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x33e9('0x8')]);router[_0x33e9('0x9')](_0x33e9('0xa'),auth[_0x33e9('0xb')](),controller[_0x33e9('0xc')]);router[_0x33e9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x33e9('0xe')](_0x33e9('0xa'),auth[_0x33e9('0xb')](),controller['update']);router[_0x33e9('0xf')](_0x33e9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8808=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','update','delete'];(function(_0x102ba4,_0x32460e){var _0x2dbea4=function(_0x48b006){while(--_0x48b006){_0x102ba4['push'](_0x102ba4['shift']());}};_0x2dbea4(++_0x32460e);}(_0x8808,0x1b5));var _0x8880=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8808[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x8880('0x0'));var util=require(_0x8880('0x1'));var path=require(_0x8880('0x2'));var timeout=require(_0x8880('0x3'));var express=require('express');var router=express[_0x8880('0x4')]();var fs_extra=require(_0x8880('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8880('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x8880('0x7')]('/',auth[_0x8880('0x8')](),controller['index']);router[_0x8880('0x7')](_0x8880('0x9'),auth[_0x8880('0x8')](),controller[_0x8880('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8880('0x9'),auth['isAuthenticated'](),controller[_0x8880('0xb')]);router[_0x8880('0xc')](_0x8880('0x9'),auth[_0x8880('0x8')](),controller[_0x8880('0xd')]);module[_0x8880('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c816cc5..61dbaa6 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 _0x9e63=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x36f896,_0x1a615b){var _0x267f0d=function(_0x2809e7){while(--_0x2809e7){_0x36f896['push'](_0x36f896['shift']());}};_0x267f0d(++_0x1a615b);}(_0x9e63,0x173));var _0x39e6=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x9e63[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x39e6('0x0'));module['exports']={'type':{'type':Sequelize[_0x39e6('0x1')](_0x39e6('0x2'),_0x39e6('0x3'),_0x39e6('0x4'),_0x39e6('0x5'),_0x39e6('0x6')),'defaultValue':_0x39e6('0x2')},'content':{'type':Sequelize[_0x39e6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x39e6('0x2'),'variable',_0x39e6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x39e6('0x7')]},'nameField':{'type':Sequelize[_0x39e6('0x7')]},'customField':{'type':Sequelize[_0x39e6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39e6('0x7')]}}; \ No newline at end of file +var _0x8769=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x30cd53,_0x5b5d2f){var _0x1d459f=function(_0x5ed200){while(--_0x5ed200){_0x30cd53['push'](_0x30cd53['shift']());}};_0x1d459f(++_0x5b5d2f);}(_0x8769,0x18f));var _0x9876=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x8769[_0x9c2427];return _0x51984f;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'type':{'type':Sequelize[_0x9876('0x2')](_0x9876('0x3'),_0x9876('0x4'),_0x9876('0x5'),_0x9876('0x6'),_0x9876('0x7')),'defaultValue':_0x9876('0x3')},'content':{'type':Sequelize[_0x9876('0x8')]},'key':{'type':Sequelize[_0x9876('0x8')]},'keyType':{'type':Sequelize[_0x9876('0x2')](_0x9876('0x3'),_0x9876('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9876('0x8')]},'nameField':{'type':Sequelize[_0x9876('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9876('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index fb927f7..d6b2a84 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 _0x5712=['fieldName','type','query','keys','filters','intersection','attributes','model','fields','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','FreshdeskField','rawAttributes'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d455d,_0x77e02){return function(_0x1cbbdc){if(!_0x1cbbdc){_0x5d455d[_0x2571('0x1a')](0x194);}return _0x1cbbdc;};}function handleError(_0x1547d2,_0x2f5cae){_0x2f5cae=_0x2f5cae||0x1f4;return function(_0x246bbd){logger['error'](_0x246bbd['stack']);if(_0x246bbd[_0x2571('0x27')]){delete _0x246bbd[_0x2571('0x27')];}_0x1547d2[_0x2571('0x1b')](_0x2f5cae)[_0x2571('0x28')](_0x246bbd);};}exports[_0x2571('0x29')]=function(_0x165aa8,_0x3d5660){var _0x315dc1={},_0x1f7562={},_0xac59bc={'count':0x0,'rows':[]};var _0x5b3373=_[_0x2571('0x2a')](db[_0x2571('0x2b')][_0x2571('0x2c')],function(_0x441e7d){return{'name':_0x441e7d[_0x2571('0x2d')],'type':_0x441e7d[_0x2571('0x2e')]['key']};});_0x1f7562['model']=_[_0x2571('0x2a')](_0x5b3373,_0x2571('0x27'));_0x1f7562[_0x2571('0x2f')]=_[_0x2571('0x30')](_0x165aa8['query']);_0x1f7562[_0x2571('0x31')]=_[_0x2571('0x32')](_0x1f7562['model'],_0x1f7562['query']);_0x315dc1[_0x2571('0x33')]=_[_0x2571('0x32')](_0x1f7562[_0x2571('0x34')],qs['fields'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x35')]));_0x315dc1['attributes']=_0x315dc1[_0x2571('0x33')]['length']?_0x315dc1[_0x2571('0x33')]:_0x1f7562[_0x2571('0x34')];if(!_0x165aa8[_0x2571('0x2f')]['hasOwnProperty']('nolimit')){_0x315dc1[_0x2571('0x20')]=qs['limit'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x20')]);_0x315dc1[_0x2571('0x36')]=qs[_0x2571('0x36')](_0x165aa8['query'][_0x2571('0x36')]);}_0x315dc1[_0x2571('0x37')]=qs['sort'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x38')]);_0x315dc1['where']=qs[_0x2571('0x31')](_[_0x2571('0x39')](_0x165aa8[_0x2571('0x2f')],_0x1f7562[_0x2571('0x31')]),_0x5b3373);if(_0x165aa8[_0x2571('0x2f')][_0x2571('0x3a')]){_0x315dc1[_0x2571('0x3b')]=_[_0x2571('0x3c')](_0x315dc1[_0x2571('0x3b')],{'$or':_[_0x2571('0x2a')](_0x5b3373,function(_0x379a45){if(_0x379a45[_0x2571('0x2e')]!==_0x2571('0x3d')){var _0x198f44={};_0x198f44[_0x379a45['name']]={'$like':'%'+_0x165aa8[_0x2571('0x2f')][_0x2571('0x3a')]+'%'};return _0x198f44;}})});}_0x315dc1=_[_0x2571('0x3c')]({},_0x315dc1,_0x165aa8[_0x2571('0x3e')]);var _0x158432={'where':_0x315dc1[_0x2571('0x3b')]};return db[_0x2571('0x2b')]['count'](_0x158432)[_0x2571('0x25')](function(_0x15c610){_0xac59bc[_0x2571('0x1f')]=_0x15c610;if(_0x165aa8['query'][_0x2571('0x3f')]){_0x315dc1[_0x2571('0x40')]=[{'all':!![]}];}return db[_0x2571('0x2b')]['findAll'](_0x315dc1);})[_0x2571('0x25')](function(_0x1c6ccd){_0xac59bc[_0x2571('0x41')]=_0x1c6ccd;return _0xac59bc;})[_0x2571('0x25')](respondWithFilteredResult(_0x3d5660,_0x315dc1))[_0x2571('0x42')](handleError(_0x3d5660,null));};exports[_0x2571('0x43')]=function(_0x3a817a,_0x45fdd9){var _0x3d4004={'raw':!![],'where':{'id':_0x3a817a[_0x2571('0x44')]['id']}},_0x5d2734={};_0x5d2734[_0x2571('0x34')]=_[_0x2571('0x30')](db[_0x2571('0x2b')][_0x2571('0x2c')]);_0x5d2734[_0x2571('0x2f')]=_[_0x2571('0x30')](_0x3a817a[_0x2571('0x2f')]);_0x5d2734['filters']=_['intersection'](_0x5d2734['model'],_0x5d2734['query']);_0x3d4004['attributes']=_['intersection'](_0x5d2734[_0x2571('0x34')],qs[_0x2571('0x35')](_0x3a817a['query'][_0x2571('0x35')]));_0x3d4004[_0x2571('0x33')]=_0x3d4004[_0x2571('0x33')][_0x2571('0x45')]?_0x3d4004[_0x2571('0x33')]:_0x5d2734['model'];if(_0x3a817a['query']['includeAll']){_0x3d4004[_0x2571('0x40')]=[{'all':!![]}];}_0x3d4004=_[_0x2571('0x3c')]({},_0x3d4004,_0x3a817a[_0x2571('0x3e')]);return db[_0x2571('0x2b')][_0x2571('0x46')](_0x3d4004)[_0x2571('0x25')](handleEntityNotFound(_0x45fdd9,null))[_0x2571('0x25')](respondWithResult(_0x45fdd9,null))['catch'](handleError(_0x45fdd9,null));};exports[_0x2571('0x47')]=function(_0x20189c,_0x1642a8){return db['FreshdeskField'][_0x2571('0x47')](_0x20189c[_0x2571('0x48')],{})[_0x2571('0x25')](respondWithResult(_0x1642a8,0xc9))[_0x2571('0x42')](handleError(_0x1642a8,null));};exports['update']=function(_0x18291c,_0x245edb){if(_0x18291c[_0x2571('0x48')]['id']){delete _0x18291c[_0x2571('0x48')]['id'];}return db['FreshdeskField'][_0x2571('0x46')]({'where':{'id':_0x18291c[_0x2571('0x44')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x245edb,null))[_0x2571('0x25')](saveUpdates(_0x18291c[_0x2571('0x48')],null))['then'](respondWithResult(_0x245edb,null))[_0x2571('0x42')](handleError(_0x245edb,null));};exports[_0x2571('0x26')]=function(_0x20302b,_0x1d2e36){return db[_0x2571('0x2b')][_0x2571('0x46')]({'where':{'id':_0x20302b['params']['id']}})['then'](handleEntityNotFound(_0x1d2e36,null))[_0x2571('0x25')](removeEntity(_0x1d2e36,null))['catch'](handleError(_0x1d2e36,null));}; \ No newline at end of file +var _0xac55=['keys','filters','attributes','intersection','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','status','error','stack','name','send','index','FreshdeskField','fieldName','type','key','model','query'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xac55,0x1c8));var _0x5ac5=function(_0x11306e,_0x2334e4){_0x11306e=_0x11306e-0x0;var _0x3dfa78=_0xac55[_0x11306e];return _0x3dfa78;};'use strict';var emlformat=require(_0x5ac5('0x0'));var rimraf=require(_0x5ac5('0x1'));var zipdir=require(_0x5ac5('0x2'));var jsonpatch=require(_0x5ac5('0x3'));var rp=require('request-promise');var moment=require(_0x5ac5('0x4'));var BPromise=require(_0x5ac5('0x5'));var Mustache=require(_0x5ac5('0x6'));var util=require(_0x5ac5('0x7'));var path=require(_0x5ac5('0x8'));var sox=require(_0x5ac5('0x9'));var csv=require(_0x5ac5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ac5('0xb'));var squel=require(_0x5ac5('0xc'));var crypto=require(_0x5ac5('0xd'));var jsforce=require(_0x5ac5('0xe'));var deskjs=require(_0x5ac5('0xf'));var toCsv=require(_0x5ac5('0xa'));var querystring=require(_0x5ac5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ac5('0x11'));var qs=require(_0x5ac5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ac5('0x13'));var logger=require(_0x5ac5('0x14'))('api');var utils=require(_0x5ac5('0x15'));var config=require(_0x5ac5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ac5('0x17'))['db'];function respondWithStatusCode(_0x1d2b5f,_0x7c4f62){_0x7c4f62=_0x7c4f62||0xcc;return function(_0x13fad8){if(_0x13fad8){return _0x1d2b5f[_0x5ac5('0x18')](_0x7c4f62);}return _0x1d2b5f['status'](_0x7c4f62)[_0x5ac5('0x19')]();};}function respondWithResult(_0x56db18,_0x1ce256){_0x1ce256=_0x1ce256||0xc8;return function(_0x40ee8a){if(_0x40ee8a){return _0x56db18['status'](_0x1ce256)[_0x5ac5('0x1a')](_0x40ee8a);}};}function respondWithFilteredResult(_0x57377b,_0x2a145d){return function(_0x340195){if(_0x340195){var _0x30244d=typeof _0x2a145d[_0x5ac5('0x1b')]===_0x5ac5('0x1c')&&typeof _0x2a145d[_0x5ac5('0x1d')]===_0x5ac5('0x1c');var _0x5510ef=_0x340195[_0x5ac5('0x1e')];var _0x5364a6=_0x30244d?0x0:_0x2a145d[_0x5ac5('0x1b')];var _0x14d164=_0x30244d?_0x340195['count']:_0x2a145d[_0x5ac5('0x1b')]+_0x2a145d['limit'];var _0x264422;if(_0x14d164>=_0x5510ef){_0x14d164=_0x5510ef;_0x264422=0xc8;}else{_0x264422=0xce;}_0x57377b['status'](_0x264422);return _0x57377b['set'](_0x5ac5('0x1f'),_0x5364a6+'-'+_0x14d164+'/'+_0x5510ef)['json'](_0x340195);}return null;};}function patchUpdates(_0x39f3cf){return function(_0x3cb669){try{jsonpatch['apply'](_0x3cb669,_0x39f3cf,!![]);}catch(_0x4066f5){return BPromise['reject'](_0x4066f5);}return _0x3cb669[_0x5ac5('0x20')]();};}function saveUpdates(_0x40bdbc,_0x47993e){return function(_0x47a898){if(_0x47a898){return _0x47a898[_0x5ac5('0x21')](_0x40bdbc)[_0x5ac5('0x22')](function(_0x400308){return _0x400308;});}return null;};}function removeEntity(_0x182683,_0xee1c62){return function(_0x4dec2f){if(_0x4dec2f){return _0x4dec2f[_0x5ac5('0x23')]()[_0x5ac5('0x22')](function(){_0x182683[_0x5ac5('0x24')](0xcc)[_0x5ac5('0x19')]();});}};}function handleEntityNotFound(_0x4b81e2,_0x22398f){return function(_0x4eda97){if(!_0x4eda97){_0x4b81e2[_0x5ac5('0x18')](0x194);}return _0x4eda97;};}function handleError(_0x74f32b,_0x1d78cf){_0x1d78cf=_0x1d78cf||0x1f4;return function(_0x2cb82f){logger[_0x5ac5('0x25')](_0x2cb82f[_0x5ac5('0x26')]);if(_0x2cb82f['name']){delete _0x2cb82f[_0x5ac5('0x27')];}_0x74f32b['status'](_0x1d78cf)[_0x5ac5('0x28')](_0x2cb82f);};}exports[_0x5ac5('0x29')]=function(_0x35535f,_0x509db7){var _0x283c41={},_0x229941={},_0x21df31={'count':0x0,'rows':[]};var _0x21307c=_['map'](db[_0x5ac5('0x2a')]['rawAttributes'],function(_0x3414ba){return{'name':_0x3414ba[_0x5ac5('0x2b')],'type':_0x3414ba[_0x5ac5('0x2c')][_0x5ac5('0x2d')]};});_0x229941[_0x5ac5('0x2e')]=_['map'](_0x21307c,_0x5ac5('0x27'));_0x229941[_0x5ac5('0x2f')]=_[_0x5ac5('0x30')](_0x35535f['query']);_0x229941[_0x5ac5('0x31')]=_['intersection'](_0x229941[_0x5ac5('0x2e')],_0x229941[_0x5ac5('0x2f')]);_0x283c41[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x229941[_0x5ac5('0x2e')],qs['fields'](_0x35535f[_0x5ac5('0x2f')]['fields']));_0x283c41[_0x5ac5('0x32')]=_0x283c41['attributes'][_0x5ac5('0x34')]?_0x283c41[_0x5ac5('0x32')]:_0x229941['model'];if(!_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x35')]('nolimit')){_0x283c41['limit']=qs[_0x5ac5('0x1d')](_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x1d')]);_0x283c41[_0x5ac5('0x1b')]=qs[_0x5ac5('0x1b')](_0x35535f[_0x5ac5('0x2f')]['offset']);}_0x283c41['order']=qs['sort'](_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x36')]);_0x283c41['where']=qs[_0x5ac5('0x31')](_[_0x5ac5('0x37')](_0x35535f[_0x5ac5('0x2f')],_0x229941[_0x5ac5('0x31')]),_0x21307c);if(_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x38')]){_0x283c41[_0x5ac5('0x39')]=_[_0x5ac5('0x3a')](_0x283c41[_0x5ac5('0x39')],{'$or':_['map'](_0x21307c,function(_0x1b991e){if(_0x1b991e['type']!==_0x5ac5('0x3b')){var _0x432740={};_0x432740[_0x1b991e[_0x5ac5('0x27')]]={'$like':'%'+_0x35535f[_0x5ac5('0x2f')][_0x5ac5('0x38')]+'%'};return _0x432740;}})});}_0x283c41=_[_0x5ac5('0x3a')]({},_0x283c41,_0x35535f[_0x5ac5('0x3c')]);var _0x37cfad={'where':_0x283c41[_0x5ac5('0x39')]};return db['FreshdeskField'][_0x5ac5('0x1e')](_0x37cfad)[_0x5ac5('0x22')](function(_0x4c245b){_0x21df31['count']=_0x4c245b;if(_0x35535f[_0x5ac5('0x2f')]['includeAll']){_0x283c41[_0x5ac5('0x3d')]=[{'all':!![]}];}return db[_0x5ac5('0x2a')]['findAll'](_0x283c41);})['then'](function(_0x1e261d){_0x21df31[_0x5ac5('0x3e')]=_0x1e261d;return _0x21df31;})[_0x5ac5('0x22')](respondWithFilteredResult(_0x509db7,_0x283c41))[_0x5ac5('0x3f')](handleError(_0x509db7,null));};exports[_0x5ac5('0x40')]=function(_0x34bd04,_0x151c5e){var _0x5a86a0={'raw':!![],'where':{'id':_0x34bd04[_0x5ac5('0x41')]['id']}},_0x1d4ef5={};_0x1d4ef5[_0x5ac5('0x2e')]=_[_0x5ac5('0x30')](db[_0x5ac5('0x2a')][_0x5ac5('0x42')]);_0x1d4ef5['query']=_[_0x5ac5('0x30')](_0x34bd04[_0x5ac5('0x2f')]);_0x1d4ef5[_0x5ac5('0x31')]=_[_0x5ac5('0x33')](_0x1d4ef5['model'],_0x1d4ef5[_0x5ac5('0x2f')]);_0x5a86a0[_0x5ac5('0x32')]=_[_0x5ac5('0x33')](_0x1d4ef5['model'],qs['fields'](_0x34bd04[_0x5ac5('0x2f')][_0x5ac5('0x43')]));_0x5a86a0[_0x5ac5('0x32')]=_0x5a86a0[_0x5ac5('0x32')]['length']?_0x5a86a0[_0x5ac5('0x32')]:_0x1d4ef5['model'];if(_0x34bd04[_0x5ac5('0x2f')][_0x5ac5('0x44')]){_0x5a86a0['include']=[{'all':!![]}];}_0x5a86a0=_[_0x5ac5('0x3a')]({},_0x5a86a0,_0x34bd04['options']);return db[_0x5ac5('0x2a')][_0x5ac5('0x45')](_0x5a86a0)[_0x5ac5('0x22')](handleEntityNotFound(_0x151c5e,null))['then'](respondWithResult(_0x151c5e,null))['catch'](handleError(_0x151c5e,null));};exports[_0x5ac5('0x46')]=function(_0x1229c3,_0xd6ae55){return db[_0x5ac5('0x2a')][_0x5ac5('0x46')](_0x1229c3[_0x5ac5('0x47')],{})[_0x5ac5('0x22')](respondWithResult(_0xd6ae55,0xc9))[_0x5ac5('0x3f')](handleError(_0xd6ae55,null));};exports[_0x5ac5('0x21')]=function(_0x536765,_0x2d6aa5){if(_0x536765[_0x5ac5('0x47')]['id']){delete _0x536765[_0x5ac5('0x47')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x536765[_0x5ac5('0x41')]['id']}})[_0x5ac5('0x22')](handleEntityNotFound(_0x2d6aa5,null))[_0x5ac5('0x22')](saveUpdates(_0x536765['body'],null))[_0x5ac5('0x22')](respondWithResult(_0x2d6aa5,null))[_0x5ac5('0x3f')](handleError(_0x2d6aa5,null));};exports[_0x5ac5('0x23')]=function(_0x2a3396,_0x326f60){return db[_0x5ac5('0x2a')][_0x5ac5('0x45')]({'where':{'id':_0x2a3396['params']['id']}})['then'](handleEntityNotFound(_0x326f60,null))['then'](removeEntity(_0x326f60,null))[_0x5ac5('0x3f')](handleError(_0x326f60,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9cd1379..67681dc 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 _0xd164=['idField','FieldId','util','../../config/logger','api','request-promise','path','../../config/environment','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x2ef1de,_0x568cfa){var _0x57e525=function(_0x2cf566){while(--_0x2cf566){_0x2ef1de['push'](_0x2ef1de['shift']());}};_0x57e525(++_0x568cfa);}(_0xd164,0x9e));var _0x4d16=function(_0x26db68,_0x4d956d){_0x26db68=_0x26db68-0x0;var _0x5f0c21=_0xd164[_0x26db68];return _0x5f0c21;};'use strict';var _=require('lodash');var util=require(_0x4d16('0x0'));var logger=require(_0x4d16('0x1'))(_0x4d16('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d16('0x3'));var fs=require('fs');var path=require(_0x4d16('0x4'));var rimraf=require('rimraf');var config=require(_0x4d16('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x4d16('0x6')]=function(_0x1f7c27,_0x49bd1e){return _0x1f7c27['define'](_0x4d16('0x7'),attributes,{'tableName':_0x4d16('0x8'),'paranoid':![],'indexes':[{'name':_0x4d16('0x9'),'fields':[_0x4d16('0xa'),_0x4d16('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7568=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField'];(function(_0x19f670,_0x36d23f){var _0x3ffd49=function(_0x5d9e05){while(--_0x5d9e05){_0x19f670['push'](_0x19f670['shift']());}};_0x3ffd49(++_0x36d23f);}(_0x7568,0xd1));var _0x8756=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x7568[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x8756('0x0'));var util=require(_0x8756('0x1'));var logger=require('../../config/logger')(_0x8756('0x2'));var moment=require(_0x8756('0x3'));var BPromise=require(_0x8756('0x4'));var rp=require(_0x8756('0x5'));var fs=require('fs');var path=require(_0x8756('0x6'));var rimraf=require(_0x8756('0x7'));var config=require(_0x8756('0x8'));var attributes=require(_0x8756('0x9'));module[_0x8756('0xa')]=function(_0x380c86,_0x59dfb2){return _0x380c86[_0x8756('0xb')](_0x8756('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x8756('0xd'),'fields':[_0x8756('0xe'),_0x8756('0xf')],'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 c2627c3..9cb24e6 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 _0xdb45=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xdb45,0x1da));var _0x5db4=function(_0x31163d,_0x215b95){_0x31163d=_0x31163d-0x0;var _0x4acb12=_0xdb45[_0x31163d];return _0x4acb12;};'use strict';var _=require(_0x5db4('0x0'));var util=require(_0x5db4('0x1'));var moment=require(_0x5db4('0x2'));var BPromise=require(_0x5db4('0x3'));var rs=require(_0x5db4('0x4'));var fs=require('fs');var Redis=require(_0x5db4('0x5'));var db=require(_0x5db4('0x6'))['db'];var utils=require(_0x5db4('0x7'));var logger=require(_0x5db4('0x8'))(_0x5db4('0x9'));var config=require(_0x5db4('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5db4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f2b65,_0x4438b0,_0x4c3a0f){return new BPromise(function(_0x1231cf,_0x15420a){return client[_0x5db4('0xc')](_0x1f2b65,_0x4c3a0f)[_0x5db4('0xd')](function(_0x52ce93){logger[_0x5db4('0xe')](_0x5db4('0xf'),_0x4438b0,'request\x20sent');logger[_0x5db4('0x10')](_0x5db4('0x11'),_0x4438b0,_0x5db4('0x12'),JSON['stringify'](_0x52ce93));if(_0x52ce93[_0x5db4('0x13')]){if(_0x52ce93[_0x5db4('0x13')][_0x5db4('0x14')]===0x1f4){logger[_0x5db4('0x13')](_0x5db4('0xf'),_0x4438b0,_0x52ce93[_0x5db4('0x13')]['message']);return _0x15420a(_0x52ce93['error']['message']);}logger[_0x5db4('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x4438b0,_0x52ce93[_0x5db4('0x13')][_0x5db4('0x15')]);return _0x1231cf(_0x52ce93[_0x5db4('0x13')]['message']);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4438b0,_0x5db4('0x12'));_0x1231cf(_0x52ce93[_0x5db4('0x16')][_0x5db4('0x15')]);}})[_0x5db4('0x17')](function(_0x5c1095){logger[_0x5db4('0x13')](_0x5db4('0xf'),_0x4438b0,_0x5c1095);_0x15420a(_0x5c1095);});});} \ No newline at end of file +var _0xa053=['debug','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x1013a8,_0x359e67){var _0x41dd8a=function(_0x4d59c0){while(--_0x4d59c0){_0x1013a8['push'](_0x1013a8['shift']());}};_0x41dd8a(++_0x359e67);}(_0xa053,0xee));var _0x3a05=function(_0x29aa6d,_0x5b138b){_0x29aa6d=_0x29aa6d-0x0;var _0x4e7e21=_0xa053[_0x29aa6d];return _0x4e7e21;};'use strict';var _=require(_0x3a05('0x0'));var util=require(_0x3a05('0x1'));var moment=require('moment');var BPromise=require(_0x3a05('0x2'));var rs=require(_0x3a05('0x3'));var fs=require('fs');var Redis=require(_0x3a05('0x4'));var db=require(_0x3a05('0x5'))['db'];var utils=require(_0x3a05('0x6'));var logger=require(_0x3a05('0x7'))(_0x3a05('0x8'));var config=require(_0x3a05('0x9'));var jayson=require(_0x3a05('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d653f,_0x244cc1,_0x5bcb2a){return new BPromise(function(_0xb07184,_0x1d724d){return client[_0x3a05('0xb')](_0x4d653f,_0x5bcb2a)[_0x3a05('0xc')](function(_0x4969f8){logger[_0x3a05('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x244cc1,_0x3a05('0xe'));logger[_0x3a05('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x244cc1,'request\x20sent',JSON[_0x3a05('0x10')](_0x4969f8));if(_0x4969f8[_0x3a05('0x11')]){if(_0x4969f8[_0x3a05('0x11')][_0x3a05('0x12')]===0x1f4){logger[_0x3a05('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x244cc1,_0x4969f8[_0x3a05('0x11')][_0x3a05('0x13')]);return _0x1d724d(_0x4969f8[_0x3a05('0x11')][_0x3a05('0x13')]);}logger[_0x3a05('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x244cc1,_0x4969f8[_0x3a05('0x11')][_0x3a05('0x13')]);return _0xb07184(_0x4969f8[_0x3a05('0x11')][_0x3a05('0x13')]);}else{logger[_0x3a05('0xd')](_0x3a05('0x14'),_0x244cc1,_0x3a05('0xe'));_0xb07184(_0x4969f8[_0x3a05('0x15')][_0x3a05('0x13')]);}})[_0x3a05('0x16')](function(_0x1af39e){logger['error'](_0x3a05('0x14'),_0x244cc1,_0x1af39e);_0x1d724d(_0x1af39e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b1fabd2..0469779 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(_0x1172c0,_0x4de4e0){var _0x3dc00b=function(_0x74a578){while(--_0x74a578){_0x1172c0['push'](_0x1172c0['shift']());}};_0x3dc00b(++_0x4de4e0);}(_0x80ed,0x11c));var _0xd80e=function(_0xb96f0b,_0x375b3c){_0xb96f0b=_0xb96f0b-0x0;var _0x1e0167=_0x80ed[_0xb96f0b];return _0x1e0167;};'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 _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x16d2,0x123));var _0x216d=function(_0x28696d,_0xb860b0){_0x28696d=_0x28696d-0x0;var _0x446708=_0x16d2[_0x28696d];return _0x446708;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1379a8e..8961ef1 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 _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xfef3,0x118));var _0x3fef=function(_0x4ce2f4,_0x5e3d4a){_0x4ce2f4=_0x4ce2f4-0x0;var _0x13145e=_0xfef3[_0x4ce2f4];return _0x13145e;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd4a2=['STRING','username','sequelize'];(function(_0x5f4a17,_0xb78130){var _0x1fc7d5=function(_0x5791ca){while(--_0x5791ca){_0x5f4a17['push'](_0x5f4a17['shift']());}};_0x1fc7d5(++_0xb78130);}(_0xd4a2,0x173));var _0x2d4a=function(_0x579263,_0x29626e){_0x579263=_0x579263-0x0;var _0x1585b9=_0xd4a2[_0x579263];return _0x1585b9;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 31418ab..beb36c5 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 _0xf937=['then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','create','body','find','getConfigurations','findOne','filter','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update'];(function(_0x2f5142,_0x1ab07a){var _0x4e0de5=function(_0x2c65ac){while(--_0x2c65ac){_0x2f5142['push'](_0x2f5142['shift']());}};_0x4e0de5(++_0x1ab07a);}(_0xf937,0x1e4));var _0x7f93=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0xf937[_0x2fff83];return _0xa2a722;};'use strict';var emlformat=require(_0x7f93('0x0'));var rimraf=require(_0x7f93('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f93('0x2'));var moment=require(_0x7f93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7f93('0x4'));var util=require(_0x7f93('0x5'));var path=require(_0x7f93('0x6'));var sox=require(_0x7f93('0x7'));var csv=require(_0x7f93('0x8'));var ejs=require(_0x7f93('0x9'));var fs=require('fs');var fs_extra=require(_0x7f93('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f93('0xb'));var jsforce=require(_0x7f93('0xc'));var deskjs=require(_0x7f93('0xd'));var toCsv=require(_0x7f93('0x8'));var querystring=require('querystring');var Papa=require(_0x7f93('0xe'));var Redis=require(_0x7f93('0xf'));var authService=require(_0x7f93('0x10'));var qs=require(_0x7f93('0x11'));var as=require(_0x7f93('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f93('0x13'));var utils=require(_0x7f93('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7f93('0x15'));var db=require(_0x7f93('0x16'))['db'];var integrations=require(_0x7f93('0x17'));function respondWithStatusCode(_0x220344,_0x457d52){_0x457d52=_0x457d52||0xcc;return function(_0x32b68b){if(_0x32b68b){return _0x220344[_0x7f93('0x18')](_0x457d52);}return _0x220344['status'](_0x457d52)[_0x7f93('0x19')]();};}function respondWithResult(_0x2d4cea,_0xcaa33){_0xcaa33=_0xcaa33||0xc8;return function(_0x310a7a){if(_0x310a7a){return _0x2d4cea[_0x7f93('0x1a')](_0xcaa33)[_0x7f93('0x1b')](_0x310a7a);}};}function respondWithFilteredResult(_0x5b2c43,_0x52cefc){return function(_0x3808b6){if(_0x3808b6){var _0x2cde82=typeof _0x52cefc[_0x7f93('0x1c')]===_0x7f93('0x1d')&&typeof _0x52cefc[_0x7f93('0x1e')]===_0x7f93('0x1d');var _0x36e334=_0x3808b6[_0x7f93('0x1f')];var _0x1bc2da=_0x2cde82?0x0:_0x52cefc[_0x7f93('0x1c')];var _0x1b2215=_0x2cde82?_0x3808b6['count']:_0x52cefc[_0x7f93('0x1c')]+_0x52cefc[_0x7f93('0x1e')];var _0x159ba4;if(_0x1b2215>=_0x36e334){_0x1b2215=_0x36e334;_0x159ba4=0xc8;}else{_0x159ba4=0xce;}_0x5b2c43[_0x7f93('0x1a')](_0x159ba4);return _0x5b2c43[_0x7f93('0x20')]('Content-Range',_0x1bc2da+'-'+_0x1b2215+'/'+_0x36e334)[_0x7f93('0x1b')](_0x3808b6);}return null;};}function patchUpdates(_0x5e45ed){return function(_0x35f0a3){try{jsonpatch[_0x7f93('0x21')](_0x35f0a3,_0x5e45ed,!![]);}catch(_0x52417){return BPromise['reject'](_0x52417);}return _0x35f0a3[_0x7f93('0x22')]();};}function saveUpdates(_0x4736b1,_0x9b84fb){return function(_0x444e7e){if(_0x444e7e){return _0x444e7e[_0x7f93('0x23')](_0x4736b1)[_0x7f93('0x24')](function(_0x5b1b1b){return _0x5b1b1b;});}return null;};}function removeEntity(_0x195e3d,_0x29f2cd){return function(_0x5db056){if(_0x5db056){return _0x5db056['destroy']()[_0x7f93('0x24')](function(){_0x195e3d[_0x7f93('0x1a')](0xcc)[_0x7f93('0x19')]();});}};}function handleEntityNotFound(_0x2b5260,_0x44c9dc){return function(_0x225234){if(!_0x225234){_0x2b5260[_0x7f93('0x18')](0x194);}return _0x225234;};}function handleError(_0x5f04ef,_0x2863ec){_0x2863ec=_0x2863ec||0x1f4;return function(_0x36b26e){logger[_0x7f93('0x25')](_0x36b26e[_0x7f93('0x26')]);if(_0x36b26e[_0x7f93('0x27')]){delete _0x36b26e['name'];}_0x5f04ef[_0x7f93('0x1a')](_0x2863ec)[_0x7f93('0x28')](_0x36b26e);};}exports[_0x7f93('0x29')]=function(_0x3d19d5,_0x476a79){var _0x3c9e09={},_0x1b099e={},_0x38499e={'count':0x0,'rows':[]};var _0x2ed6da=_[_0x7f93('0x2a')](db[_0x7f93('0x2b')]['rawAttributes'],function(_0x342a41){return{'name':_0x342a41[_0x7f93('0x2c')],'type':_0x342a41[_0x7f93('0x2d')][_0x7f93('0x2e')]};});_0x1b099e['model']=_[_0x7f93('0x2a')](_0x2ed6da,_0x7f93('0x27'));_0x1b099e[_0x7f93('0x2f')]=_[_0x7f93('0x30')](_0x3d19d5[_0x7f93('0x2f')]);_0x1b099e['filters']=_[_0x7f93('0x31')](_0x1b099e[_0x7f93('0x32')],_0x1b099e['query']);_0x3c9e09['attributes']=_[_0x7f93('0x31')](_0x1b099e['model'],qs['fields'](_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x33')]));_0x3c9e09[_0x7f93('0x34')]=_0x3c9e09[_0x7f93('0x34')][_0x7f93('0x35')]?_0x3c9e09[_0x7f93('0x34')]:_0x1b099e[_0x7f93('0x32')];if(!_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x36')]('nolimit')){_0x3c9e09[_0x7f93('0x1e')]=qs[_0x7f93('0x1e')](_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x1e')]);_0x3c9e09[_0x7f93('0x1c')]=qs[_0x7f93('0x1c')](_0x3d19d5[_0x7f93('0x2f')][_0x7f93('0x1c')]);}_0x3c9e09[_0x7f93('0x37')]=qs[_0x7f93('0x38')](_0x3d19d5[_0x7f93('0x2f')]['sort']);_0x3c9e09[_0x7f93('0x39')]=qs[_0x7f93('0x3a')](_[_0x7f93('0x3b')](_0x3d19d5['query'],_0x1b099e[_0x7f93('0x3a')]),_0x2ed6da);if(_0x3d19d5[_0x7f93('0x2f')]['filter']){_0x3c9e09[_0x7f93('0x39')]=_['merge'](_0x3c9e09['where'],{'$or':_[_0x7f93('0x2a')](_0x2ed6da,function(_0x34da1e){if(_0x34da1e[_0x7f93('0x2d')]!==_0x7f93('0x3c')){var _0x3ed21f={};_0x3ed21f[_0x34da1e[_0x7f93('0x27')]]={'$like':'%'+_0x3d19d5[_0x7f93('0x2f')]['filter']+'%'};return _0x3ed21f;}})});}_0x3c9e09=_['merge']({},_0x3c9e09,_0x3d19d5[_0x7f93('0x3d')]);var _0x57c79d={'where':_0x3c9e09[_0x7f93('0x39')]};return db[_0x7f93('0x2b')][_0x7f93('0x1f')](_0x57c79d)[_0x7f93('0x24')](function(_0x470fbd){_0x38499e['count']=_0x470fbd;if(_0x3d19d5['query'][_0x7f93('0x3e')]){_0x3c9e09[_0x7f93('0x3f')]=[{'all':!![]}];}return db[_0x7f93('0x2b')][_0x7f93('0x40')](_0x3c9e09);})['then'](function(_0x578ed8){_0x38499e[_0x7f93('0x41')]=_0x578ed8;return _0x38499e;})['then'](respondWithFilteredResult(_0x476a79,_0x3c9e09))[_0x7f93('0x42')](handleError(_0x476a79,null));};exports[_0x7f93('0x43')]=function(_0x39a3e9,_0x377b08){var _0x533b3d={'raw':![],'where':{'id':_0x39a3e9[_0x7f93('0x44')]['id']}},_0x33c254={};_0x33c254['model']=_[_0x7f93('0x30')](db['FreshsalesAccount'][_0x7f93('0x45')]);_0x33c254[_0x7f93('0x2f')]=_['keys'](_0x39a3e9['query']);_0x33c254[_0x7f93('0x3a')]=_[_0x7f93('0x31')](_0x33c254[_0x7f93('0x32')],_0x33c254[_0x7f93('0x2f')]);_0x533b3d['attributes']=_['intersection'](_0x33c254[_0x7f93('0x32')],qs[_0x7f93('0x33')](_0x39a3e9[_0x7f93('0x2f')][_0x7f93('0x33')]));_0x533b3d[_0x7f93('0x34')]=_0x533b3d[_0x7f93('0x34')]['length']?_0x533b3d[_0x7f93('0x34')]:_0x33c254[_0x7f93('0x32')];if(_0x39a3e9[_0x7f93('0x2f')]['includeAll']){_0x533b3d[_0x7f93('0x3f')]=[{'all':!![]}];}_0x533b3d=_[_0x7f93('0x46')]({},_0x533b3d,_0x39a3e9[_0x7f93('0x3d')]);return db[_0x7f93('0x2b')]['find'](_0x533b3d)[_0x7f93('0x24')](handleEntityNotFound(_0x377b08,null))[_0x7f93('0x24')](respondWithResult(_0x377b08,null))['catch'](handleError(_0x377b08,null));};exports[_0x7f93('0x47')]=function(_0x239220,_0x29eb1d){return db['FreshsalesAccount'][_0x7f93('0x47')](_0x239220[_0x7f93('0x48')],{})['then'](respondWithResult(_0x29eb1d,0xc9))['catch'](handleError(_0x29eb1d,null));};exports['update']=function(_0x3252fb,_0x15f57a){if(_0x3252fb[_0x7f93('0x48')]['id']){delete _0x3252fb[_0x7f93('0x48')]['id'];}return db['FreshsalesAccount'][_0x7f93('0x49')]({'where':{'id':_0x3252fb[_0x7f93('0x44')]['id']}})['then'](handleEntityNotFound(_0x15f57a,null))[_0x7f93('0x24')](saveUpdates(_0x3252fb[_0x7f93('0x48')],null))[_0x7f93('0x24')](respondWithResult(_0x15f57a,null))['catch'](handleError(_0x15f57a,null));};exports['destroy']=function(_0x2c82d6,_0x21bfec){return db[_0x7f93('0x2b')][_0x7f93('0x49')]({'where':{'id':_0x2c82d6[_0x7f93('0x44')]['id']}})[_0x7f93('0x24')](handleEntityNotFound(_0x21bfec,null))[_0x7f93('0x24')](removeEntity(_0x21bfec,null))['catch'](handleError(_0x21bfec,null));};exports[_0x7f93('0x4a')]=function(_0x42923e,_0x130199,_0x484bbe){var _0x5f856={};var _0x38dd41={};var _0x189092;var _0x2f4bfb;return db[_0x7f93('0x2b')][_0x7f93('0x4b')]({'where':{'id':_0x42923e[_0x7f93('0x44')]['id']}})['then'](handleEntityNotFound(_0x130199,null))[_0x7f93('0x24')](function(_0x1ec689){if(_0x1ec689){_0x189092=_0x1ec689;_0x38dd41[_0x7f93('0x32')]=_[_0x7f93('0x30')](db['FreshsalesConfiguration'][_0x7f93('0x45')]);_0x38dd41['query']=_[_0x7f93('0x30')](_0x42923e[_0x7f93('0x2f')]);_0x38dd41[_0x7f93('0x3a')]=_[_0x7f93('0x31')](_0x38dd41['model'],_0x38dd41[_0x7f93('0x2f')]);_0x5f856['attributes']=_['intersection'](_0x38dd41[_0x7f93('0x32')],qs[_0x7f93('0x33')](_0x42923e[_0x7f93('0x2f')]['fields']));_0x5f856[_0x7f93('0x34')]=_0x5f856[_0x7f93('0x34')][_0x7f93('0x35')]?_0x5f856['attributes']:_0x38dd41['model'];_0x5f856['order']=qs[_0x7f93('0x38')](_0x42923e[_0x7f93('0x2f')]['sort']);_0x5f856[_0x7f93('0x39')]=qs[_0x7f93('0x3a')](_['pick'](_0x42923e[_0x7f93('0x2f')],_0x38dd41[_0x7f93('0x3a')]));if(_0x42923e[_0x7f93('0x2f')][_0x7f93('0x4c')]){_0x5f856['where']=_[_0x7f93('0x46')](_0x5f856[_0x7f93('0x39')],{'$or':_[_0x7f93('0x2a')](_0x5f856['attributes'],function(_0x11a28d){var _0x559f53={};_0x559f53[_0x11a28d]={'$like':'%'+_0x42923e[_0x7f93('0x2f')][_0x7f93('0x4c')]+'%'};return _0x559f53;})});}_0x5f856=_[_0x7f93('0x46')]({},_0x5f856,_0x42923e[_0x7f93('0x3d')]);return _0x189092[_0x7f93('0x4a')](_0x5f856);}})[_0x7f93('0x24')](function(_0x186459){if(_0x186459){_0x2f4bfb=_0x186459['length'];if(!_0x42923e[_0x7f93('0x2f')][_0x7f93('0x36')](_0x7f93('0x4d'))){_0x5f856[_0x7f93('0x1e')]=qs[_0x7f93('0x1e')](_0x42923e['query'][_0x7f93('0x1e')]);_0x5f856[_0x7f93('0x1c')]=qs[_0x7f93('0x1c')](_0x42923e[_0x7f93('0x2f')][_0x7f93('0x1c')]);}return _0x189092[_0x7f93('0x4a')](_0x5f856);}})['then'](function(_0x38ea98){if(_0x38ea98){return _0x38ea98?{'count':_0x2f4bfb,'rows':_0x38ea98}:null;}})[_0x7f93('0x24')](respondWithResult(_0x130199,null))[_0x7f93('0x42')](handleError(_0x130199,null));};exports[_0x7f93('0x4e')]=function(_0x171342,_0x578c2d,_0x2081d1){if(_0x171342['body']['id']){delete _0x171342['body']['id'];}return db[_0x7f93('0x2b')]['findOne']({'where':{'id':_0x171342['params']['id']}})[_0x7f93('0x24')](handleEntityNotFound(_0x578c2d,null))[_0x7f93('0x24')](function(_0xb271a0){if(_0xb271a0){_0x171342['body']['AccountId']=_0xb271a0['id'];_0x171342[_0x7f93('0x48')][_0x7f93('0x4f')]=integrations[_0x7f93('0x50')](_0x171342['body'][_0x7f93('0x51')],_0x171342[_0x7f93('0x48')][_0x7f93('0x2d')]);_0x171342[_0x7f93('0x48')]['Descriptions']=integrations[_0x7f93('0x52')](_0x171342[_0x7f93('0x48')][_0x7f93('0x51')],_0x171342['body']['type']);return db[_0x7f93('0x53')][_0x7f93('0x47')](_0x171342['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x7f93('0x4f')},{'model':db[_0x7f93('0x54')],'as':_0x7f93('0x55')}]});}return null;})[_0x7f93('0x24')](respondWithResult(_0x578c2d,null))['catch'](handleError(_0x578c2d,null));};exports[_0x7f93('0x56')]=function(_0x366cf9,_0xe0a928,_0x4dc057){var _0x1cd261='';var _0x205a80='';return db[_0x7f93('0x2b')][_0x7f93('0x4b')]({'where':{'id':_0x366cf9[_0x7f93('0x44')]['id']},'attributes':['id',_0x7f93('0x57'),_0x7f93('0x58'),_0x7f93('0x59')]})[_0x7f93('0x24')](handleEntityNotFound(_0xe0a928,null))['then'](function(_0x146fc7){if(_0x146fc7){_0x205a80=_0x146fc7[_0x7f93('0x57')];_0x1cd261=_0x146fc7[_0x7f93('0x58')];var _0x15b10b=_0x146fc7[_0x7f93('0x58')][_0x7f93('0x5a')](-0x1);if(_0x15b10b==='/'){_0x1cd261=_0x1cd261[_0x7f93('0x5b')](0x0,_0x1cd261['lastIndexOf'](_0x15b10b));}return rp({'method':'GET','uri':util[_0x7f93('0x5c')](_0x7f93('0x5d'),_0x1cd261,_0x7f93('0x5e')),'headers':{'Authorization':_0x7f93('0x5f')+_0x146fc7[_0x7f93('0x59')]},'json':!![]});}})[_0x7f93('0x24')](function(_0x368fc9){if(_0x368fc9){var _0x37d769=_0x368fc9[_0x7f93('0x60')];var _0x32716a=![];var _0xd30b48=null;for(_0xd30b48=0x0;_0xd30b48<_0x37d769[_0x7f93('0x35')];_0xd30b48++){if(_0x37d769[_0xd30b48][_0x7f93('0x61')]===_0x205a80){_0x32716a=!![];}}if(_0x32716a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7f93('0x62')});}}})[_0x7f93('0x24')](respondWithResult(_0xe0a928,null))[_0x7f93('0x42')](function(_0x55127b){var _0x2f6c5d=_0x366cf9[_0x7f93('0x2f')][_0x7f93('0x63')]?0x1f4:_0x55127b['statusCode']||0x1f4;logger[_0x7f93('0x25')](_0x7f93('0x64'),_0x7f93('0x56'),_0x2f6c5d,JSON[_0x7f93('0x65')](_0x55127b));delete _0x55127b['name'];if(_0x2f6c5d===0x191){_0x2f6c5d=0x190;}_0xe0a928[_0x7f93('0x1a')](_0x2f6c5d)['send'](_0x366cf9[_0x7f93('0x2f')][_0x7f93('0x63')]?{'message':_0x7f93('0x66'),'statusCode':_0x55127b[_0x7f93('0x67')]}:_0x55127b);});}; \ No newline at end of file +var _0xd4a9=['FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','format','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','send','eml-format','rimraf','request-promise','moment','mustache','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','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','sendStatus','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration'];(function(_0x2ad9ae,_0x29a5f0){var _0x36a84a=function(_0x23f86f){while(--_0x23f86f){_0x2ad9ae['push'](_0x2ad9ae['shift']());}};_0x36a84a(++_0x29a5f0);}(_0xd4a9,0x144));var _0x9d4a=function(_0x13ca63,_0x31882a){_0x13ca63=_0x13ca63-0x0;var _0xbf36a9=_0xd4a9[_0x13ca63];return _0xbf36a9;};'use strict';var emlformat=require(_0x9d4a('0x0'));var rimraf=require(_0x9d4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d4a('0x2'));var moment=require(_0x9d4a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9d4a('0x4'));var util=require('util');var path=require(_0x9d4a('0x5'));var sox=require(_0x9d4a('0x6'));var csv=require(_0x9d4a('0x7'));var ejs=require(_0x9d4a('0x8'));var fs=require('fs');var fs_extra=require(_0x9d4a('0x9'));var _=require(_0x9d4a('0xa'));var squel=require('squel');var crypto=require(_0x9d4a('0xb'));var jsforce=require(_0x9d4a('0xc'));var deskjs=require(_0x9d4a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9d4a('0xe'));var Papa=require(_0x9d4a('0xf'));var Redis=require(_0x9d4a('0x10'));var authService=require(_0x9d4a('0x11'));var qs=require(_0x9d4a('0x12'));var as=require(_0x9d4a('0x13'));var hardwareService=require(_0x9d4a('0x14'));var logger=require(_0x9d4a('0x15'))(_0x9d4a('0x16'));var utils=require(_0x9d4a('0x17'));var config=require(_0x9d4a('0x18'));var licenseUtil=require(_0x9d4a('0x19'));var db=require(_0x9d4a('0x1a'))['db'];var integrations=require(_0x9d4a('0x1b'));function respondWithStatusCode(_0x1ba9a2,_0x3a7fef){_0x3a7fef=_0x3a7fef||0xcc;return function(_0x35e33d){if(_0x35e33d){return _0x1ba9a2['sendStatus'](_0x3a7fef);}return _0x1ba9a2['status'](_0x3a7fef)[_0x9d4a('0x1c')]();};}function respondWithResult(_0x233885,_0x4e2a62){_0x4e2a62=_0x4e2a62||0xc8;return function(_0x23d1a0){if(_0x23d1a0){return _0x233885[_0x9d4a('0x1d')](_0x4e2a62)[_0x9d4a('0x1e')](_0x23d1a0);}};}function respondWithFilteredResult(_0x4b0e4f,_0x3f0e93){return function(_0x223f8c){if(_0x223f8c){var _0x539cd2=typeof _0x3f0e93[_0x9d4a('0x1f')]===_0x9d4a('0x20')&&typeof _0x3f0e93[_0x9d4a('0x21')]===_0x9d4a('0x20');var _0x307db2=_0x223f8c['count'];var _0x37a399=_0x539cd2?0x0:_0x3f0e93[_0x9d4a('0x1f')];var _0x2c020e=_0x539cd2?_0x223f8c[_0x9d4a('0x22')]:_0x3f0e93[_0x9d4a('0x1f')]+_0x3f0e93[_0x9d4a('0x21')];var _0x228d9e;if(_0x2c020e>=_0x307db2){_0x2c020e=_0x307db2;_0x228d9e=0xc8;}else{_0x228d9e=0xce;}_0x4b0e4f[_0x9d4a('0x1d')](_0x228d9e);return _0x4b0e4f['set'](_0x9d4a('0x23'),_0x37a399+'-'+_0x2c020e+'/'+_0x307db2)['json'](_0x223f8c);}return null;};}function patchUpdates(_0x11f54c){return function(_0x5e0392){try{jsonpatch['apply'](_0x5e0392,_0x11f54c,!![]);}catch(_0x3ef3cd){return BPromise[_0x9d4a('0x24')](_0x3ef3cd);}return _0x5e0392['save']();};}function saveUpdates(_0x20f3ca,_0x28a233){return function(_0x318ce7){if(_0x318ce7){return _0x318ce7[_0x9d4a('0x25')](_0x20f3ca)[_0x9d4a('0x26')](function(_0x5ee8ad){return _0x5ee8ad;});}return null;};}function removeEntity(_0x43a3d0,_0x30ae80){return function(_0x596c8b){if(_0x596c8b){return _0x596c8b['destroy']()['then'](function(){_0x43a3d0[_0x9d4a('0x1d')](0xcc)[_0x9d4a('0x1c')]();});}};}function handleEntityNotFound(_0x321cf5,_0x112d4c){return function(_0x215295){if(!_0x215295){_0x321cf5[_0x9d4a('0x27')](0x194);}return _0x215295;};}function handleError(_0x14f9dc,_0x44933b){_0x44933b=_0x44933b||0x1f4;return function(_0x3f0057){logger['error'](_0x3f0057['stack']);if(_0x3f0057[_0x9d4a('0x28')]){delete _0x3f0057[_0x9d4a('0x28')];}_0x14f9dc[_0x9d4a('0x1d')](_0x44933b)['send'](_0x3f0057);};}exports[_0x9d4a('0x29')]=function(_0x3dd048,_0x508a6e){var _0x3aa60a={},_0x4b44c2={},_0x38e9b7={'count':0x0,'rows':[]};var _0x1e0524=_[_0x9d4a('0x2a')](db['FreshsalesAccount'][_0x9d4a('0x2b')],function(_0x14ee0f){return{'name':_0x14ee0f['fieldName'],'type':_0x14ee0f['type'][_0x9d4a('0x2c')]};});_0x4b44c2[_0x9d4a('0x2d')]=_['map'](_0x1e0524,'name');_0x4b44c2[_0x9d4a('0x2e')]=_[_0x9d4a('0x2f')](_0x3dd048[_0x9d4a('0x2e')]);_0x4b44c2[_0x9d4a('0x30')]=_[_0x9d4a('0x31')](_0x4b44c2[_0x9d4a('0x2d')],_0x4b44c2['query']);_0x3aa60a[_0x9d4a('0x32')]=_[_0x9d4a('0x31')](_0x4b44c2['model'],qs['fields'](_0x3dd048[_0x9d4a('0x2e')][_0x9d4a('0x33')]));_0x3aa60a[_0x9d4a('0x32')]=_0x3aa60a[_0x9d4a('0x32')]['length']?_0x3aa60a[_0x9d4a('0x32')]:_0x4b44c2[_0x9d4a('0x2d')];if(!_0x3dd048[_0x9d4a('0x2e')]['hasOwnProperty'](_0x9d4a('0x34'))){_0x3aa60a[_0x9d4a('0x21')]=qs[_0x9d4a('0x21')](_0x3dd048[_0x9d4a('0x2e')][_0x9d4a('0x21')]);_0x3aa60a[_0x9d4a('0x1f')]=qs['offset'](_0x3dd048[_0x9d4a('0x2e')][_0x9d4a('0x1f')]);}_0x3aa60a[_0x9d4a('0x35')]=qs['sort'](_0x3dd048[_0x9d4a('0x2e')][_0x9d4a('0x36')]);_0x3aa60a[_0x9d4a('0x37')]=qs[_0x9d4a('0x30')](_['pick'](_0x3dd048[_0x9d4a('0x2e')],_0x4b44c2[_0x9d4a('0x30')]),_0x1e0524);if(_0x3dd048[_0x9d4a('0x2e')][_0x9d4a('0x38')]){_0x3aa60a[_0x9d4a('0x37')]=_[_0x9d4a('0x39')](_0x3aa60a[_0x9d4a('0x37')],{'$or':_[_0x9d4a('0x2a')](_0x1e0524,function(_0x1b7d4a){if(_0x1b7d4a[_0x9d4a('0x3a')]!==_0x9d4a('0x3b')){var _0x7710a4={};_0x7710a4[_0x1b7d4a[_0x9d4a('0x28')]]={'$like':'%'+_0x3dd048['query']['filter']+'%'};return _0x7710a4;}})});}_0x3aa60a=_[_0x9d4a('0x39')]({},_0x3aa60a,_0x3dd048[_0x9d4a('0x3c')]);var _0x4d9848={'where':_0x3aa60a[_0x9d4a('0x37')]};return db[_0x9d4a('0x3d')][_0x9d4a('0x22')](_0x4d9848)['then'](function(_0x2247df){_0x38e9b7[_0x9d4a('0x22')]=_0x2247df;if(_0x3dd048['query'][_0x9d4a('0x3e')]){_0x3aa60a[_0x9d4a('0x3f')]=[{'all':!![]}];}return db[_0x9d4a('0x3d')]['findAll'](_0x3aa60a);})['then'](function(_0x3eb243){_0x38e9b7[_0x9d4a('0x40')]=_0x3eb243;return _0x38e9b7;})[_0x9d4a('0x26')](respondWithFilteredResult(_0x508a6e,_0x3aa60a))[_0x9d4a('0x41')](handleError(_0x508a6e,null));};exports[_0x9d4a('0x42')]=function(_0x1b1d96,_0x1023ad){var _0x453cfd={'raw':![],'where':{'id':_0x1b1d96[_0x9d4a('0x43')]['id']}},_0x451419={};_0x451419['model']=_[_0x9d4a('0x2f')](db[_0x9d4a('0x3d')][_0x9d4a('0x2b')]);_0x451419[_0x9d4a('0x2e')]=_[_0x9d4a('0x2f')](_0x1b1d96[_0x9d4a('0x2e')]);_0x451419[_0x9d4a('0x30')]=_[_0x9d4a('0x31')](_0x451419[_0x9d4a('0x2d')],_0x451419[_0x9d4a('0x2e')]);_0x453cfd[_0x9d4a('0x32')]=_[_0x9d4a('0x31')](_0x451419[_0x9d4a('0x2d')],qs[_0x9d4a('0x33')](_0x1b1d96[_0x9d4a('0x2e')][_0x9d4a('0x33')]));_0x453cfd['attributes']=_0x453cfd[_0x9d4a('0x32')][_0x9d4a('0x44')]?_0x453cfd[_0x9d4a('0x32')]:_0x451419[_0x9d4a('0x2d')];if(_0x1b1d96[_0x9d4a('0x2e')]['includeAll']){_0x453cfd['include']=[{'all':!![]}];}_0x453cfd=_[_0x9d4a('0x39')]({},_0x453cfd,_0x1b1d96[_0x9d4a('0x3c')]);return db[_0x9d4a('0x3d')][_0x9d4a('0x45')](_0x453cfd)[_0x9d4a('0x26')](handleEntityNotFound(_0x1023ad,null))[_0x9d4a('0x26')](respondWithResult(_0x1023ad,null))[_0x9d4a('0x41')](handleError(_0x1023ad,null));};exports[_0x9d4a('0x46')]=function(_0x17fc1,_0x2bf787){return db['FreshsalesAccount'][_0x9d4a('0x46')](_0x17fc1['body'],{})[_0x9d4a('0x26')](respondWithResult(_0x2bf787,0xc9))[_0x9d4a('0x41')](handleError(_0x2bf787,null));};exports[_0x9d4a('0x25')]=function(_0x5d66d3,_0x1fb3ce){if(_0x5d66d3[_0x9d4a('0x47')]['id']){delete _0x5d66d3['body']['id'];}return db['FreshsalesAccount'][_0x9d4a('0x45')]({'where':{'id':_0x5d66d3['params']['id']}})[_0x9d4a('0x26')](handleEntityNotFound(_0x1fb3ce,null))[_0x9d4a('0x26')](saveUpdates(_0x5d66d3[_0x9d4a('0x47')],null))[_0x9d4a('0x26')](respondWithResult(_0x1fb3ce,null))[_0x9d4a('0x41')](handleError(_0x1fb3ce,null));};exports['destroy']=function(_0x58288c,_0x5def99){return db[_0x9d4a('0x3d')][_0x9d4a('0x45')]({'where':{'id':_0x58288c[_0x9d4a('0x43')]['id']}})[_0x9d4a('0x26')](handleEntityNotFound(_0x5def99,null))['then'](removeEntity(_0x5def99,null))['catch'](handleError(_0x5def99,null));};exports[_0x9d4a('0x48')]=function(_0x36605a,_0x1ed146,_0x560ecb){var _0x4366c1={};var _0x255b37={};var _0x383194;var _0x386e44;return db[_0x9d4a('0x3d')][_0x9d4a('0x49')]({'where':{'id':_0x36605a[_0x9d4a('0x43')]['id']}})[_0x9d4a('0x26')](handleEntityNotFound(_0x1ed146,null))[_0x9d4a('0x26')](function(_0xf2fb82){if(_0xf2fb82){_0x383194=_0xf2fb82;_0x255b37[_0x9d4a('0x2d')]=_[_0x9d4a('0x2f')](db['FreshsalesConfiguration'][_0x9d4a('0x2b')]);_0x255b37[_0x9d4a('0x2e')]=_[_0x9d4a('0x2f')](_0x36605a[_0x9d4a('0x2e')]);_0x255b37[_0x9d4a('0x30')]=_[_0x9d4a('0x31')](_0x255b37[_0x9d4a('0x2d')],_0x255b37[_0x9d4a('0x2e')]);_0x4366c1['attributes']=_[_0x9d4a('0x31')](_0x255b37[_0x9d4a('0x2d')],qs[_0x9d4a('0x33')](_0x36605a[_0x9d4a('0x2e')][_0x9d4a('0x33')]));_0x4366c1[_0x9d4a('0x32')]=_0x4366c1['attributes'][_0x9d4a('0x44')]?_0x4366c1[_0x9d4a('0x32')]:_0x255b37['model'];_0x4366c1[_0x9d4a('0x35')]=qs['sort'](_0x36605a[_0x9d4a('0x2e')]['sort']);_0x4366c1['where']=qs[_0x9d4a('0x30')](_[_0x9d4a('0x4a')](_0x36605a[_0x9d4a('0x2e')],_0x255b37[_0x9d4a('0x30')]));if(_0x36605a['query']['filter']){_0x4366c1['where']=_[_0x9d4a('0x39')](_0x4366c1[_0x9d4a('0x37')],{'$or':_['map'](_0x4366c1[_0x9d4a('0x32')],function(_0x9d54da){var _0x2fcc91={};_0x2fcc91[_0x9d54da]={'$like':'%'+_0x36605a['query'][_0x9d4a('0x38')]+'%'};return _0x2fcc91;})});}_0x4366c1=_[_0x9d4a('0x39')]({},_0x4366c1,_0x36605a[_0x9d4a('0x3c')]);return _0x383194['getConfigurations'](_0x4366c1);}})[_0x9d4a('0x26')](function(_0x58fd05){if(_0x58fd05){_0x386e44=_0x58fd05[_0x9d4a('0x44')];if(!_0x36605a['query'][_0x9d4a('0x4b')](_0x9d4a('0x34'))){_0x4366c1['limit']=qs[_0x9d4a('0x21')](_0x36605a[_0x9d4a('0x2e')][_0x9d4a('0x21')]);_0x4366c1[_0x9d4a('0x1f')]=qs[_0x9d4a('0x1f')](_0x36605a[_0x9d4a('0x2e')][_0x9d4a('0x1f')]);}return _0x383194[_0x9d4a('0x48')](_0x4366c1);}})['then'](function(_0x49c8e0){if(_0x49c8e0){return _0x49c8e0?{'count':_0x386e44,'rows':_0x49c8e0}:null;}})['then'](respondWithResult(_0x1ed146,null))[_0x9d4a('0x41')](handleError(_0x1ed146,null));};exports[_0x9d4a('0x4c')]=function(_0xf3c2e9,_0x1d8fca,_0x31707f){if(_0xf3c2e9[_0x9d4a('0x47')]['id']){delete _0xf3c2e9[_0x9d4a('0x47')]['id'];}return db['FreshsalesAccount'][_0x9d4a('0x49')]({'where':{'id':_0xf3c2e9[_0x9d4a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d8fca,null))[_0x9d4a('0x26')](function(_0x329044){if(_0x329044){_0xf3c2e9['body'][_0x9d4a('0x4d')]=_0x329044['id'];_0xf3c2e9[_0x9d4a('0x47')][_0x9d4a('0x4e')]=integrations[_0x9d4a('0x4f')](_0xf3c2e9[_0x9d4a('0x47')][_0x9d4a('0x50')],_0xf3c2e9[_0x9d4a('0x47')]['type']);_0xf3c2e9[_0x9d4a('0x47')][_0x9d4a('0x51')]=integrations[_0x9d4a('0x52')](_0xf3c2e9['body'][_0x9d4a('0x50')],_0xf3c2e9[_0x9d4a('0x47')][_0x9d4a('0x3a')]);return db[_0x9d4a('0x53')][_0x9d4a('0x46')](_0xf3c2e9['body'],{'include':[{'model':db[_0x9d4a('0x54')],'as':_0x9d4a('0x4e')},{'model':db['FreshsalesField'],'as':_0x9d4a('0x51')}]});}return null;})['then'](respondWithResult(_0x1d8fca,null))['catch'](handleError(_0x1d8fca,null));};exports[_0x9d4a('0x55')]=function(_0x586ed2,_0x1f4088,_0x3b2075){var _0x52f252='';var _0x33ee79='';return db[_0x9d4a('0x3d')][_0x9d4a('0x49')]({'where':{'id':_0x586ed2['params']['id']},'attributes':['id',_0x9d4a('0x56'),_0x9d4a('0x57'),'apiKey']})[_0x9d4a('0x26')](handleEntityNotFound(_0x1f4088,null))[_0x9d4a('0x26')](function(_0xb7224c){if(_0xb7224c){_0x33ee79=_0xb7224c[_0x9d4a('0x56')];_0x52f252=_0xb7224c[_0x9d4a('0x57')];var _0x533a29=_0xb7224c[_0x9d4a('0x57')][_0x9d4a('0x58')](-0x1);if(_0x533a29==='/'){_0x52f252=_0x52f252['substring'](0x0,_0x52f252[_0x9d4a('0x59')](_0x533a29));}return rp({'method':'GET','uri':util[_0x9d4a('0x5a')]('%s%s',_0x52f252,_0x9d4a('0x5b')),'headers':{'Authorization':_0x9d4a('0x5c')+_0xb7224c[_0x9d4a('0x5d')]},'json':!![]});}})[_0x9d4a('0x26')](function(_0x34899f){if(_0x34899f){var _0x12b7f8=_0x34899f[_0x9d4a('0x5e')];var _0x22942e=![];var _0x2da94b=null;for(_0x2da94b=0x0;_0x2da94b<_0x12b7f8['length'];_0x2da94b++){if(_0x12b7f8[_0x2da94b][_0x9d4a('0x5f')]===_0x33ee79){_0x22942e=!![];}}if(_0x22942e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9d4a('0x60')});}}})[_0x9d4a('0x26')](respondWithResult(_0x1f4088,null))[_0x9d4a('0x41')](function(_0x26696e){var _0x9ad7c1=_0x586ed2[_0x9d4a('0x2e')][_0x9d4a('0x61')]?0x1f4:_0x26696e[_0x9d4a('0x62')]||0x1f4;logger[_0x9d4a('0x63')]('getFields,\x20%s,\x20%s,\x20%s',_0x9d4a('0x55'),_0x9ad7c1,JSON[_0x9d4a('0x64')](_0x26696e));delete _0x26696e[_0x9d4a('0x28')];if(_0x9ad7c1===0x191){_0x9ad7c1=0x190;}_0x1f4088[_0x9d4a('0x1d')](_0x9ad7c1)[_0x9d4a('0x65')](_0x586ed2[_0x9d4a('0x2e')][_0x9d4a('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x26696e[_0x9d4a('0x62')]}:_0x26696e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index baf31a8..3c06886 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 _0xba34=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x579f49,_0x10efb2){var _0x277855=function(_0x33263d){while(--_0x33263d){_0x579f49['push'](_0x579f49['shift']());}};_0x277855(++_0x10efb2);}(_0xba34,0x119));var _0x4ba3=function(_0x2a52e8,_0x51e75b){_0x2a52e8=_0x2a52e8-0x0;var _0x33f3ea=_0xba34[_0x2a52e8];return _0x33f3ea;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x6a55,0xdb));var _0x56a5=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x6a55[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'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 6663d22..691d35c 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 _0x4325=['stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5aa21b,_0x425dbe){var _0x37eaef=function(_0x381938){while(--_0x381938){_0x5aa21b['push'](_0x5aa21b['shift']());}};_0x37eaef(++_0x425dbe);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')]({'raw':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options'][_0x5432('0x1c')]||null:null,'attributes':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'limit':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options']['limit']||null:null,'include':_0x32fe60['options']?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x32fe60[_0x5432('0x1a')]['include'],function(_0x4af5f4){return{'model':db[_0x4af5f4[_0x5432('0x20')]],'as':_0x4af5f4['as'],'attributes':_0x4af5f4[_0x5432('0x1d')],'include':_0x4af5f4['include']?_[_0x5432('0x1f')](_0x4af5f4[_0x5432('0x1e')],function(_0x637582){return{'model':db[_0x637582['model']],'as':_0x637582['as'],'attributes':_0x637582[_0x5432('0x1d')],'include':_0x637582[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x637582['include'],function(_0x4ab09d){return{'model':db[_0x4ab09d[_0x5432('0x20')]],'as':_0x4ab09d['as'],'attributes':_0x4ab09d[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1abe73){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug'](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x1abe73));_0x5f011f(_0x1abe73);})['catch'](function(_0x6fc7f5){logger['error'](_0x5432('0x17'),_0x6fc7f5['message'],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x6fc7f5[_0x5432('0x13')]));});});};exports[_0x5432('0x21')]=function(_0x345b51){var _0x4e92d5=this;return new Promise(function(_0x31490c,_0x1d436c){return db[_0x5432('0x18')][_0x5432('0x22')]({'raw':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')]['where']||null:null,'attributes':_0x345b51['options']?_0x345b51[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'include':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1e')]?_['map'](_0x345b51[_0x5432('0x1a')]['include'],function(_0x2955e0){return{'model':db[_0x2955e0[_0x5432('0x20')]],'as':_0x2955e0['as'],'attributes':_0x2955e0[_0x5432('0x1d')],'include':_0x2955e0[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x2955e0[_0x5432('0x1e')],function(_0x5c3c77){return{'model':db[_0x5c3c77[_0x5432('0x20')]],'as':_0x5c3c77['as'],'attributes':_0x5c3c77[_0x5432('0x1d')],'include':_0x5c3c77[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x5c3c77['include'],function(_0xe01f4b){return{'model':db[_0xe01f4b[_0x5432('0x20')]],'as':_0xe01f4b['as'],'attributes':_0xe01f4b[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5432('0xb')](function(_0x3fb586){logger[_0x5432('0x14')](_0x5432('0x21'),_0x345b51);logger[_0x5432('0xd')](_0x5432('0x21'),_0x345b51,JSON[_0x5432('0x10')](_0x3fb586));_0x31490c(_0x3fb586);})[_0x5432('0x16')](function(_0x1f4679){logger[_0x5432('0x12')](_0x5432('0x21'),_0x1f4679['message'],_0x345b51);_0x1d436c(_0x4e92d5[_0x5432('0x12')](0x1f4,_0x1f4679['message']));});});}; \ No newline at end of file +var _0x3a6d=['client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowFreshsalesAccount','find','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x20fbb0,_0x1df479){var _0x4180a1=function(_0x5c9d67){while(--_0x5c9d67){_0x20fbb0['push'](_0x20fbb0['shift']());}};_0x4180a1(++_0x1df479);}(_0x3a6d,0x143));var _0xd3a6=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3a6d[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')]({'raw':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1a')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'limit':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1c')]||null:null,'include':_0x8d1286['options']?_0x8d1286['options']['include']?_['map'](_0x8d1286['options'][_0xd3a6('0x1d')],function(_0x400982){return{'model':db[_0x400982[_0xd3a6('0x1e')]],'as':_0x400982['as'],'attributes':_0x400982['attributes'],'include':_0x400982[_0xd3a6('0x1d')]?_['map'](_0x400982[_0xd3a6('0x1d')],function(_0x16afc8){return{'model':db[_0x16afc8[_0xd3a6('0x1e')]],'as':_0x16afc8['as'],'attributes':_0x16afc8['attributes'],'include':_0x16afc8[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x16afc8[_0xd3a6('0x1d')],function(_0x219e32){return{'model':db[_0x219e32[_0xd3a6('0x1e')]],'as':_0x219e32['as'],'attributes':_0x219e32[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30df90){logger[_0xd3a6('0xe')](_0xd3a6('0x16'),_0x8d1286);logger[_0xd3a6('0x20')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x30df90));_0xbe58b4(_0x30df90);})['catch'](function(_0x535bd4){logger[_0xd3a6('0x13')](_0xd3a6('0x16'),_0x535bd4[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x535bd4['message']));});});};exports[_0xd3a6('0x21')]=function(_0xa4efd){var _0x4d322a=this;return new Promise(function(_0x14381c,_0x5d9867){return db[_0xd3a6('0x17')][_0xd3a6('0x22')]({'raw':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x23')]===undefined?!![]:![]:!![],'where':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')]['where']||null:null,'attributes':_0xa4efd['options']?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'include':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd['options'][_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1d')],function(_0x3ebd0d){return{'model':db[_0x3ebd0d[_0xd3a6('0x1e')]],'as':_0x3ebd0d['as'],'attributes':_0x3ebd0d[_0xd3a6('0x1b')],'include':_0x3ebd0d[_0xd3a6('0x1d')]?_['map'](_0x3ebd0d[_0xd3a6('0x1d')],function(_0x41981c){return{'model':db[_0x41981c[_0xd3a6('0x1e')]],'as':_0x41981c['as'],'attributes':_0x41981c[_0xd3a6('0x1b')],'include':_0x41981c[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x41981c['include'],function(_0x16a30a){return{'model':db[_0x16a30a['model']],'as':_0x16a30a['as'],'attributes':_0x16a30a[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd3a6('0xd')](function(_0x180bb9){logger[_0xd3a6('0xe')]('ShowFreshsalesAccount',_0xa4efd);logger['debug'](_0xd3a6('0x21'),_0xa4efd,JSON[_0xd3a6('0x12')](_0x180bb9));_0x14381c(_0x180bb9);})[_0xd3a6('0x24')](function(_0x5188e1){logger[_0xd3a6('0x13')](_0xd3a6('0x21'),_0x5188e1['message'],_0xa4efd);_0x5d9867(_0x4d322a[_0xd3a6('0x13')](0x1f4,_0x5188e1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 831a284..f4e7b0e 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 _0x123d=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer','util'];(function(_0x251041,_0x270cd8){var _0x2c2759=function(_0x1c06ca){while(--_0x1c06ca){_0x251041['push'](_0x251041['shift']());}};_0x2c2759(++_0x270cd8);}(_0x123d,0xd6));var _0xd123=function(_0x3783ab,_0xa5bc3b){_0x3783ab=_0x3783ab-0x0;var _0x4ddddf=_0x123d[_0x3783ab];return _0x4ddddf;};'use strict';var multer=require(_0xd123('0x0'));var util=require(_0xd123('0x1'));var path=require(_0xd123('0x2'));var timeout=require(_0xd123('0x3'));var express=require(_0xd123('0x4'));var router=express[_0xd123('0x5')]();var fs_extra=require(_0xd123('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd123('0x7'));var config=require(_0xd123('0x8'));var controller=require(_0xd123('0x9'));router[_0xd123('0xa')]('/',auth['isAuthenticated'](),controller[_0xd123('0xb')]);router[_0xd123('0xa')](_0xd123('0xc'),auth[_0xd123('0xd')](),controller[_0xd123('0xe')]);router[_0xd123('0xa')](_0xd123('0xf'),auth[_0xd123('0xd')](),controller['getSubjects']);router[_0xd123('0xa')](_0xd123('0x10'),auth[_0xd123('0xd')](),controller['getDescriptions']);router['get'](_0xd123('0x11'),auth[_0xd123('0xd')](),controller[_0xd123('0x12')]);router[_0xd123('0x13')]('/',auth[_0xd123('0xd')](),controller['create']);router['put'](_0xd123('0xc'),auth['isAuthenticated'](),controller[_0xd123('0x14')]);router[_0xd123('0x15')](_0xd123('0xc'),auth[_0xd123('0xd')](),controller[_0xd123('0x16')]);module[_0xd123('0x17')]=router; \ No newline at end of file +var _0xe68c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xe68c,0x158));var _0xce68=function(_0x483134,_0x57de34){_0x483134=_0x483134-0x0;var _0x47518d=_0xe68c[_0x483134];return _0x47518d;};'use strict';var multer=require(_0xce68('0x0'));var util=require('util');var path=require(_0xce68('0x1'));var timeout=require(_0xce68('0x2'));var express=require(_0xce68('0x3'));var router=express[_0xce68('0x4')]();var fs_extra=require(_0xce68('0x5'));var auth=require(_0xce68('0x6'));var interaction=require(_0xce68('0x7'));var config=require(_0xce68('0x8'));var controller=require(_0xce68('0x9'));router[_0xce68('0xa')]('/',auth[_0xce68('0xb')](),controller[_0xce68('0xc')]);router[_0xce68('0xa')]('/:id',auth[_0xce68('0xb')](),controller[_0xce68('0xd')]);router[_0xce68('0xa')](_0xce68('0xe'),auth[_0xce68('0xb')](),controller[_0xce68('0xf')]);router[_0xce68('0xa')](_0xce68('0x10'),auth[_0xce68('0xb')](),controller['getDescriptions']);router[_0xce68('0xa')](_0xce68('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0xce68('0x12')]('/',auth[_0xce68('0xb')](),controller[_0xce68('0x13')]);router['put'](_0xce68('0x14'),auth[_0xce68('0xb')](),controller[_0xce68('0x15')]);router[_0xce68('0x16')](_0xce68('0x14'),auth['isAuthenticated'](),controller[_0xce68('0x17')]);module[_0xce68('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c497382..152c9b5 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 _0xe713=['sequelize','exports','STRING'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe713,0xab));var _0x3e71=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xe713[_0x218972];return _0x1bb1a8;};'use strict';var Sequelize=require(_0x3e71('0x0'));module[_0x3e71('0x1')]={'name':{'type':Sequelize[_0x3e71('0x2')]},'description':{'type':Sequelize[_0x3e71('0x2')]}}; \ No newline at end of file +var _0x4f44=['STRING','sequelize','exports'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x4f44,0x19f));var _0x44f4=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4f44[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x44f4('0x0'));module[_0x44f4('0x1')]={'name':{'type':Sequelize[_0x44f4('0x2')]},'description':{'type':Sequelize[_0x44f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 78129e1..7ad13ed 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 _0xc50f=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getSubjects','findOne','fields','nolimit','getDescriptions','FreshsalesField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','save','update','then','sendStatus','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x57354f,_0x2bc06f){var _0x41aeef=function(_0x5c298b){while(--_0x5c298b){_0x57354f['push'](_0x57354f['shift']());}};_0x41aeef(++_0x2bc06f);}(_0xc50f,0x66));var _0xfc50=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc50f[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xfc50('0x0'));var rimraf=require(_0xfc50('0x1'));var zipdir=require(_0xfc50('0x2'));var jsonpatch=require(_0xfc50('0x3'));var rp=require(_0xfc50('0x4'));var moment=require(_0xfc50('0x5'));var BPromise=require(_0xfc50('0x6'));var Mustache=require('mustache');var util=require(_0xfc50('0x7'));var path=require('path');var sox=require(_0xfc50('0x8'));var csv=require(_0xfc50('0x9'));var ejs=require(_0xfc50('0xa'));var fs=require('fs');var fs_extra=require(_0xfc50('0xb'));var _=require(_0xfc50('0xc'));var squel=require(_0xfc50('0xd'));var crypto=require(_0xfc50('0xe'));var jsforce=require(_0xfc50('0xf'));var deskjs=require(_0xfc50('0x10'));var toCsv=require(_0xfc50('0x9'));var querystring=require(_0xfc50('0x11'));var Papa=require(_0xfc50('0x12'));var Redis=require(_0xfc50('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfc50('0x14'));var as=require(_0xfc50('0x15'));var hardwareService=require(_0xfc50('0x16'));var logger=require(_0xfc50('0x17'))(_0xfc50('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc50('0x19'));var db=require(_0xfc50('0x1a'))['db'];function respondWithStatusCode(_0x5656f1,_0x1b1c01){_0x1b1c01=_0x1b1c01||0xcc;return function(_0xb81a56){if(_0xb81a56){return _0x5656f1['sendStatus'](_0x1b1c01);}return _0x5656f1[_0xfc50('0x1b')](_0x1b1c01)[_0xfc50('0x1c')]();};}function respondWithResult(_0x16ebdf,_0x187597){_0x187597=_0x187597||0xc8;return function(_0x46c5b8){if(_0x46c5b8){return _0x16ebdf['status'](_0x187597)[_0xfc50('0x1d')](_0x46c5b8);}};}function respondWithFilteredResult(_0xe8733f,_0x1c670c){return function(_0x13cc5f){if(_0x13cc5f){var _0x583f70=typeof _0x1c670c[_0xfc50('0x1e')]==='undefined'&&typeof _0x1c670c[_0xfc50('0x1f')]==='undefined';var _0x4e8ca9=_0x13cc5f[_0xfc50('0x20')];var _0x1d6750=_0x583f70?0x0:_0x1c670c['offset'];var _0x101dae=_0x583f70?_0x13cc5f['count']:_0x1c670c['offset']+_0x1c670c[_0xfc50('0x1f')];var _0x25a835;if(_0x101dae>=_0x4e8ca9){_0x101dae=_0x4e8ca9;_0x25a835=0xc8;}else{_0x25a835=0xce;}_0xe8733f[_0xfc50('0x1b')](_0x25a835);return _0xe8733f[_0xfc50('0x21')]('Content-Range',_0x1d6750+'-'+_0x101dae+'/'+_0x4e8ca9)[_0xfc50('0x1d')](_0x13cc5f);}return null;};}function patchUpdates(_0x177656){return function(_0x5c0a3c){try{jsonpatch[_0xfc50('0x22')](_0x5c0a3c,_0x177656,!![]);}catch(_0x385560){return BPromise['reject'](_0x385560);}return _0x5c0a3c[_0xfc50('0x23')]();};}function saveUpdates(_0x25610f,_0x317fe4){return function(_0x453ea8){if(_0x453ea8){return _0x453ea8[_0xfc50('0x24')](_0x25610f)[_0xfc50('0x25')](function(_0x51d488){return _0x51d488;});}return null;};}function removeEntity(_0x5a49c6,_0x4a10f0){return function(_0x1b0bcf){if(_0x1b0bcf){return _0x1b0bcf['destroy']()['then'](function(){_0x5a49c6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x167e8e,_0x1cec7e){return function(_0x56491d){if(!_0x56491d){_0x167e8e[_0xfc50('0x26')](0x194);}return _0x56491d;};}function handleError(_0x743fae,_0x27509c){_0x27509c=_0x27509c||0x1f4;return function(_0x1fa74e){logger[_0xfc50('0x27')](_0x1fa74e[_0xfc50('0x28')]);if(_0x1fa74e[_0xfc50('0x29')]){delete _0x1fa74e['name'];}_0x743fae['status'](_0x27509c)['send'](_0x1fa74e);};}exports[_0xfc50('0x2a')]=function(_0x5a5818,_0x1a7151){var _0x2b59c7={},_0x18b3bc={},_0x1835ea={'count':0x0,'rows':[]};var _0x544878=_[_0xfc50('0x2b')](db[_0xfc50('0x2c')][_0xfc50('0x2d')],function(_0xa3c539){return{'name':_0xa3c539['fieldName'],'type':_0xa3c539[_0xfc50('0x2e')][_0xfc50('0x2f')]};});_0x18b3bc[_0xfc50('0x30')]=_[_0xfc50('0x2b')](_0x544878,'name');_0x18b3bc['query']=_[_0xfc50('0x31')](_0x5a5818[_0xfc50('0x32')]);_0x18b3bc[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x18b3bc[_0xfc50('0x30')],_0x18b3bc[_0xfc50('0x32')]);_0x2b59c7[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x18b3bc[_0xfc50('0x30')],qs['fields'](_0x5a5818[_0xfc50('0x32')]['fields']));_0x2b59c7[_0xfc50('0x35')]=_0x2b59c7[_0xfc50('0x35')][_0xfc50('0x36')]?_0x2b59c7[_0xfc50('0x35')]:_0x18b3bc[_0xfc50('0x30')];if(!_0x5a5818['query'][_0xfc50('0x37')]('nolimit')){_0x2b59c7[_0xfc50('0x1f')]=qs['limit'](_0x5a5818['query'][_0xfc50('0x1f')]);_0x2b59c7['offset']=qs[_0xfc50('0x1e')](_0x5a5818[_0xfc50('0x32')][_0xfc50('0x1e')]);}_0x2b59c7[_0xfc50('0x38')]=qs['sort'](_0x5a5818[_0xfc50('0x32')][_0xfc50('0x39')]);_0x2b59c7['where']=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x5a5818[_0xfc50('0x32')],_0x18b3bc[_0xfc50('0x33')]),_0x544878);if(_0x5a5818[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x2b59c7[_0xfc50('0x3c')]=_[_0xfc50('0x3d')](_0x2b59c7[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x2b')](_0x544878,function(_0x2595c2){if(_0x2595c2[_0xfc50('0x2e')]!==_0xfc50('0x3e')){var _0x20b282={};_0x20b282[_0x2595c2['name']]={'$like':'%'+_0x5a5818[_0xfc50('0x32')][_0xfc50('0x3b')]+'%'};return _0x20b282;}})});}_0x2b59c7=_['merge']({},_0x2b59c7,_0x5a5818[_0xfc50('0x3f')]);var _0x122f86={'where':_0x2b59c7[_0xfc50('0x3c')]};return db[_0xfc50('0x2c')][_0xfc50('0x20')](_0x122f86)[_0xfc50('0x25')](function(_0xee73cb){_0x1835ea[_0xfc50('0x20')]=_0xee73cb;if(_0x5a5818['query'][_0xfc50('0x40')]){_0x2b59c7[_0xfc50('0x41')]=[{'all':!![]}];}return db[_0xfc50('0x2c')][_0xfc50('0x42')](_0x2b59c7);})[_0xfc50('0x25')](function(_0x37a32e){_0x1835ea[_0xfc50('0x43')]=_0x37a32e;return _0x1835ea;})[_0xfc50('0x25')](respondWithFilteredResult(_0x1a7151,_0x2b59c7))[_0xfc50('0x44')](handleError(_0x1a7151,null));};exports[_0xfc50('0x45')]=function(_0x291d3f,_0x2a6fa9){var _0x59c8dd={'raw':![],'where':{'id':_0x291d3f[_0xfc50('0x46')]['id']}},_0x11dea2={};_0x11dea2['model']=_[_0xfc50('0x31')](db[_0xfc50('0x2c')]['rawAttributes']);_0x11dea2[_0xfc50('0x32')]=_[_0xfc50('0x31')](_0x291d3f[_0xfc50('0x32')]);_0x11dea2['filters']=_[_0xfc50('0x34')](_0x11dea2[_0xfc50('0x30')],_0x11dea2[_0xfc50('0x32')]);_0x59c8dd[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x11dea2['model'],qs['fields'](_0x291d3f[_0xfc50('0x32')]['fields']));_0x59c8dd['attributes']=_0x59c8dd['attributes'][_0xfc50('0x36')]?_0x59c8dd['attributes']:_0x11dea2[_0xfc50('0x30')];if(_0x291d3f[_0xfc50('0x32')][_0xfc50('0x40')]){_0x59c8dd['include']=[{'all':!![]}];}_0x59c8dd=_[_0xfc50('0x3d')]({},_0x59c8dd,_0x291d3f['options']);return db[_0xfc50('0x2c')][_0xfc50('0x47')](_0x59c8dd)[_0xfc50('0x25')](handleEntityNotFound(_0x2a6fa9,null))[_0xfc50('0x25')](respondWithResult(_0x2a6fa9,null))['catch'](handleError(_0x2a6fa9,null));};exports[_0xfc50('0x48')]=function(_0x1bf1e5,_0x21a55a){return db[_0xfc50('0x2c')][_0xfc50('0x48')](_0x1bf1e5[_0xfc50('0x49')],{})[_0xfc50('0x25')](respondWithResult(_0x21a55a,0xc9))[_0xfc50('0x44')](handleError(_0x21a55a,null));};exports[_0xfc50('0x24')]=function(_0x3a745c,_0x3cb852){if(_0x3a745c[_0xfc50('0x49')]['id']){delete _0x3a745c[_0xfc50('0x49')]['id'];}return db[_0xfc50('0x2c')]['find']({'where':{'id':_0x3a745c[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x3cb852,null))[_0xfc50('0x25')](saveUpdates(_0x3a745c[_0xfc50('0x49')],null))['then'](respondWithResult(_0x3cb852,null))[_0xfc50('0x44')](handleError(_0x3cb852,null));};exports[_0xfc50('0x4a')]=function(_0x58ad69,_0x3ca122){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x58ad69[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x3ca122,null))['then'](removeEntity(_0x3ca122,null))[_0xfc50('0x44')](handleError(_0x3ca122,null));};exports[_0xfc50('0x4b')]=function(_0x4ffb9a,_0x1e2a7e,_0x4b9e53){var _0x64d8ac={};var _0x298b2d={};var _0x44a6d7;var _0x4e5551;return db[_0xfc50('0x2c')][_0xfc50('0x4c')]({'where':{'id':_0x4ffb9a['params']['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x1e2a7e,null))[_0xfc50('0x25')](function(_0x4babb2){if(_0x4babb2){_0x44a6d7=_0x4babb2;_0x298b2d[_0xfc50('0x30')]=_[_0xfc50('0x31')](db['FreshsalesField']['rawAttributes']);_0x298b2d[_0xfc50('0x32')]=_[_0xfc50('0x31')](_0x4ffb9a['query']);_0x298b2d[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x298b2d[_0xfc50('0x30')],_0x298b2d[_0xfc50('0x32')]);_0x64d8ac['attributes']=_[_0xfc50('0x34')](_0x298b2d[_0xfc50('0x30')],qs[_0xfc50('0x4d')](_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x4d')]));_0x64d8ac['attributes']=_0x64d8ac[_0xfc50('0x35')]['length']?_0x64d8ac['attributes']:_0x298b2d[_0xfc50('0x30')];_0x64d8ac['order']=qs[_0xfc50('0x39')](_0x4ffb9a[_0xfc50('0x32')]['sort']);_0x64d8ac[_0xfc50('0x3c')]=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x4ffb9a[_0xfc50('0x32')],_0x298b2d[_0xfc50('0x33')]));if(_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x64d8ac['where']=_[_0xfc50('0x3d')](_0x64d8ac[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x2b')](_0x64d8ac[_0xfc50('0x35')],function(_0x409653){var _0x3df1b1={};_0x3df1b1[_0x409653]={'$like':'%'+_0x4ffb9a[_0xfc50('0x32')]['filter']+'%'};return _0x3df1b1;})});}_0x64d8ac=_[_0xfc50('0x3d')]({},_0x64d8ac,_0x4ffb9a[_0xfc50('0x3f')]);return _0x44a6d7[_0xfc50('0x4b')](_0x64d8ac);}})[_0xfc50('0x25')](function(_0x2241e0){if(_0x2241e0){_0x4e5551=_0x2241e0[_0xfc50('0x36')];if(!_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x37')](_0xfc50('0x4e'))){_0x64d8ac[_0xfc50('0x1f')]=qs[_0xfc50('0x1f')](_0x4ffb9a[_0xfc50('0x32')]['limit']);_0x64d8ac['offset']=qs[_0xfc50('0x1e')](_0x4ffb9a[_0xfc50('0x32')][_0xfc50('0x1e')]);}return _0x44a6d7[_0xfc50('0x4b')](_0x64d8ac);}})[_0xfc50('0x25')](function(_0x32320b){if(_0x32320b){return _0x32320b?{'count':_0x4e5551,'rows':_0x32320b}:null;}})[_0xfc50('0x25')](respondWithResult(_0x1e2a7e,null))[_0xfc50('0x44')](handleError(_0x1e2a7e,null));};exports[_0xfc50('0x4f')]=function(_0x584e0d,_0x34739c,_0x185954){var _0x906c20={};var _0x186705={};var _0x149cf7;var _0x361f7f;return db[_0xfc50('0x2c')][_0xfc50('0x4c')]({'where':{'id':_0x584e0d[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0x34739c,null))[_0xfc50('0x25')](function(_0x4a92f4){if(_0x4a92f4){_0x149cf7=_0x4a92f4;_0x186705[_0xfc50('0x30')]=_['keys'](db[_0xfc50('0x50')][_0xfc50('0x2d')]);_0x186705[_0xfc50('0x32')]=_['keys'](_0x584e0d[_0xfc50('0x32')]);_0x186705[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x186705[_0xfc50('0x30')],_0x186705['query']);_0x906c20[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x186705['model'],qs[_0xfc50('0x4d')](_0x584e0d['query'][_0xfc50('0x4d')]));_0x906c20[_0xfc50('0x35')]=_0x906c20[_0xfc50('0x35')][_0xfc50('0x36')]?_0x906c20['attributes']:_0x186705[_0xfc50('0x30')];_0x906c20['order']=qs['sort'](_0x584e0d[_0xfc50('0x32')][_0xfc50('0x39')]);_0x906c20['where']=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x584e0d[_0xfc50('0x32')],_0x186705[_0xfc50('0x33')]));if(_0x584e0d[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x906c20['where']=_['merge'](_0x906c20[_0xfc50('0x3c')],{'$or':_['map'](_0x906c20[_0xfc50('0x35')],function(_0x1774ba){var _0x21b1b1={};_0x21b1b1[_0x1774ba]={'$like':'%'+_0x584e0d[_0xfc50('0x32')]['filter']+'%'};return _0x21b1b1;})});}_0x906c20=_[_0xfc50('0x3d')]({},_0x906c20,_0x584e0d[_0xfc50('0x3f')]);return _0x149cf7['getDescriptions'](_0x906c20);}})['then'](function(_0x5b913c){if(_0x5b913c){_0x361f7f=_0x5b913c[_0xfc50('0x36')];if(!_0x584e0d[_0xfc50('0x32')]['hasOwnProperty'](_0xfc50('0x4e'))){_0x906c20[_0xfc50('0x1f')]=qs['limit'](_0x584e0d[_0xfc50('0x32')][_0xfc50('0x1f')]);_0x906c20[_0xfc50('0x1e')]=qs[_0xfc50('0x1e')](_0x584e0d[_0xfc50('0x32')][_0xfc50('0x1e')]);}return _0x149cf7[_0xfc50('0x4f')](_0x906c20);}})[_0xfc50('0x25')](function(_0x3fce0e){if(_0x3fce0e){return _0x3fce0e?{'count':_0x361f7f,'rows':_0x3fce0e}:null;}})['then'](respondWithResult(_0x34739c,null))[_0xfc50('0x44')](handleError(_0x34739c,null));};exports['getFields']=function(_0x53b778,_0xf3004a,_0x3d1b5d){var _0x48a50b={};var _0x335793={};var _0x2f5eb4;var _0xa788cf;return db[_0xfc50('0x2c')]['findOne']({'where':{'id':_0x53b778[_0xfc50('0x46')]['id']}})[_0xfc50('0x25')](handleEntityNotFound(_0xf3004a,null))[_0xfc50('0x25')](function(_0x100454){if(_0x100454){_0x2f5eb4=_0x100454;_0x335793['model']=_[_0xfc50('0x31')](db['FreshsalesField'][_0xfc50('0x2d')]);_0x335793[_0xfc50('0x32')]=_[_0xfc50('0x31')](_0x53b778[_0xfc50('0x32')]);_0x335793[_0xfc50('0x33')]=_[_0xfc50('0x34')](_0x335793[_0xfc50('0x30')],_0x335793[_0xfc50('0x32')]);_0x48a50b[_0xfc50('0x35')]=_[_0xfc50('0x34')](_0x335793[_0xfc50('0x30')],qs['fields'](_0x53b778['query'][_0xfc50('0x4d')]));_0x48a50b[_0xfc50('0x35')]=_0x48a50b[_0xfc50('0x35')][_0xfc50('0x36')]?_0x48a50b[_0xfc50('0x35')]:_0x335793['model'];_0x48a50b[_0xfc50('0x38')]=qs[_0xfc50('0x39')](_0x53b778[_0xfc50('0x32')][_0xfc50('0x39')]);_0x48a50b[_0xfc50('0x3c')]=qs[_0xfc50('0x33')](_[_0xfc50('0x3a')](_0x53b778[_0xfc50('0x32')],_0x335793[_0xfc50('0x33')]));if(_0x53b778[_0xfc50('0x32')][_0xfc50('0x3b')]){_0x48a50b[_0xfc50('0x3c')]=_[_0xfc50('0x3d')](_0x48a50b[_0xfc50('0x3c')],{'$or':_[_0xfc50('0x2b')](_0x48a50b['attributes'],function(_0x1d3bb3){var _0x2dba70={};_0x2dba70[_0x1d3bb3]={'$like':'%'+_0x53b778[_0xfc50('0x32')][_0xfc50('0x3b')]+'%'};return _0x2dba70;})});}_0x48a50b=_['merge']({},_0x48a50b,_0x53b778['options']);return _0x2f5eb4['getFields'](_0x48a50b);}})[_0xfc50('0x25')](function(_0x2d4707){if(_0x2d4707){_0xa788cf=_0x2d4707['length'];if(!_0x53b778['query']['hasOwnProperty'](_0xfc50('0x4e'))){_0x48a50b[_0xfc50('0x1f')]=qs['limit'](_0x53b778['query']['limit']);_0x48a50b[_0xfc50('0x1e')]=qs[_0xfc50('0x1e')](_0x53b778[_0xfc50('0x32')][_0xfc50('0x1e')]);}return _0x2f5eb4['getFields'](_0x48a50b);}})['then'](function(_0xcbdf79){if(_0xcbdf79){return _0xcbdf79?{'count':_0xa788cf,'rows':_0xcbdf79}:null;}})[_0xfc50('0x25')](respondWithResult(_0xf3004a,null))['catch'](handleError(_0xf3004a,null));}; \ No newline at end of file +var _0xa28a=['nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../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','limit','count','set','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2aaf51,_0x2dbb49){var _0xbafd19=function(_0x158b2d){while(--_0x158b2d){_0x2aaf51['push'](_0x2aaf51['shift']());}};_0xbafd19(++_0x2dbb49);}(_0xa28a,0x1b2));var _0xaa28=function(_0x57fb08,_0x36b2bd){_0x57fb08=_0x57fb08-0x0;var _0x54b3b6=_0xa28a[_0x57fb08];return _0x54b3b6;};'use strict';var emlformat=require(_0xaa28('0x0'));var rimraf=require(_0xaa28('0x1'));var zipdir=require(_0xaa28('0x2'));var jsonpatch=require(_0xaa28('0x3'));var rp=require(_0xaa28('0x4'));var moment=require(_0xaa28('0x5'));var BPromise=require(_0xaa28('0x6'));var Mustache=require('mustache');var util=require(_0xaa28('0x7'));var path=require(_0xaa28('0x8'));var sox=require('sox');var csv=require(_0xaa28('0x9'));var ejs=require(_0xaa28('0xa'));var fs=require('fs');var fs_extra=require(_0xaa28('0xb'));var _=require('lodash');var squel=require(_0xaa28('0xc'));var crypto=require(_0xaa28('0xd'));var jsforce=require(_0xaa28('0xe'));var deskjs=require(_0xaa28('0xf'));var toCsv=require(_0xaa28('0x9'));var querystring=require(_0xaa28('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa28('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa28('0x12'));var hardwareService=require(_0xaa28('0x13'));var logger=require(_0xaa28('0x14'))(_0xaa28('0x15'));var utils=require(_0xaa28('0x16'));var config=require(_0xaa28('0x17'));var licenseUtil=require(_0xaa28('0x18'));var db=require(_0xaa28('0x19'))['db'];function respondWithStatusCode(_0xdba2f,_0x4e5d38){_0x4e5d38=_0x4e5d38||0xcc;return function(_0x5628ce){if(_0x5628ce){return _0xdba2f[_0xaa28('0x1a')](_0x4e5d38);}return _0xdba2f[_0xaa28('0x1b')](_0x4e5d38)[_0xaa28('0x1c')]();};}function respondWithResult(_0x1ae984,_0x5cd391){_0x5cd391=_0x5cd391||0xc8;return function(_0x4ff143){if(_0x4ff143){return _0x1ae984[_0xaa28('0x1b')](_0x5cd391)['json'](_0x4ff143);}};}function respondWithFilteredResult(_0x40b5f6,_0x835eca){return function(_0x3fb45b){if(_0x3fb45b){var _0x20deb9=typeof _0x835eca[_0xaa28('0x1d')]===_0xaa28('0x1e')&&typeof _0x835eca[_0xaa28('0x1f')]==='undefined';var _0x4a4a2c=_0x3fb45b[_0xaa28('0x20')];var _0x4a3989=_0x20deb9?0x0:_0x835eca[_0xaa28('0x1d')];var _0x282a78=_0x20deb9?_0x3fb45b['count']:_0x835eca['offset']+_0x835eca[_0xaa28('0x1f')];var _0xa450e2;if(_0x282a78>=_0x4a4a2c){_0x282a78=_0x4a4a2c;_0xa450e2=0xc8;}else{_0xa450e2=0xce;}_0x40b5f6[_0xaa28('0x1b')](_0xa450e2);return _0x40b5f6[_0xaa28('0x21')](_0xaa28('0x22'),_0x4a3989+'-'+_0x282a78+'/'+_0x4a4a2c)[_0xaa28('0x23')](_0x3fb45b);}return null;};}function patchUpdates(_0xf8e86b){return function(_0x3b4b96){try{jsonpatch[_0xaa28('0x24')](_0x3b4b96,_0xf8e86b,!![]);}catch(_0x33274a){return BPromise[_0xaa28('0x25')](_0x33274a);}return _0x3b4b96['save']();};}function saveUpdates(_0x210ae4,_0x1880ea){return function(_0x80bd32){if(_0x80bd32){return _0x80bd32['update'](_0x210ae4)['then'](function(_0x3e181c){return _0x3e181c;});}return null;};}function removeEntity(_0x294808,_0x7e9fc8){return function(_0x527121){if(_0x527121){return _0x527121[_0xaa28('0x26')]()[_0xaa28('0x27')](function(){_0x294808[_0xaa28('0x1b')](0xcc)[_0xaa28('0x1c')]();});}};}function handleEntityNotFound(_0x215f41,_0x516a40){return function(_0xf1716d){if(!_0xf1716d){_0x215f41[_0xaa28('0x1a')](0x194);}return _0xf1716d;};}function handleError(_0xf6e119,_0x227512){_0x227512=_0x227512||0x1f4;return function(_0x1c0624){logger[_0xaa28('0x28')](_0x1c0624[_0xaa28('0x29')]);if(_0x1c0624[_0xaa28('0x2a')]){delete _0x1c0624[_0xaa28('0x2a')];}_0xf6e119[_0xaa28('0x1b')](_0x227512)[_0xaa28('0x2b')](_0x1c0624);};}exports[_0xaa28('0x2c')]=function(_0x16a38c,_0x598a2e){var _0x59c383={},_0xd5b48e={},_0x3a3791={'count':0x0,'rows':[]};var _0x1033ce=_[_0xaa28('0x2d')](db[_0xaa28('0x2e')][_0xaa28('0x2f')],function(_0x596f06){return{'name':_0x596f06[_0xaa28('0x30')],'type':_0x596f06['type']['key']};});_0xd5b48e[_0xaa28('0x31')]=_[_0xaa28('0x2d')](_0x1033ce,_0xaa28('0x2a'));_0xd5b48e[_0xaa28('0x32')]=_[_0xaa28('0x33')](_0x16a38c[_0xaa28('0x32')]);_0xd5b48e[_0xaa28('0x34')]=_['intersection'](_0xd5b48e['model'],_0xd5b48e[_0xaa28('0x32')]);_0x59c383[_0xaa28('0x35')]=_[_0xaa28('0x36')](_0xd5b48e[_0xaa28('0x31')],qs['fields'](_0x16a38c[_0xaa28('0x32')][_0xaa28('0x37')]));_0x59c383[_0xaa28('0x35')]=_0x59c383[_0xaa28('0x35')][_0xaa28('0x38')]?_0x59c383[_0xaa28('0x35')]:_0xd5b48e[_0xaa28('0x31')];if(!_0x16a38c[_0xaa28('0x32')][_0xaa28('0x39')](_0xaa28('0x3a'))){_0x59c383[_0xaa28('0x1f')]=qs[_0xaa28('0x1f')](_0x16a38c[_0xaa28('0x32')]['limit']);_0x59c383['offset']=qs[_0xaa28('0x1d')](_0x16a38c[_0xaa28('0x32')][_0xaa28('0x1d')]);}_0x59c383[_0xaa28('0x3b')]=qs['sort'](_0x16a38c[_0xaa28('0x32')][_0xaa28('0x3c')]);_0x59c383[_0xaa28('0x3d')]=qs[_0xaa28('0x34')](_[_0xaa28('0x3e')](_0x16a38c[_0xaa28('0x32')],_0xd5b48e[_0xaa28('0x34')]),_0x1033ce);if(_0x16a38c['query']['filter']){_0x59c383[_0xaa28('0x3d')]=_[_0xaa28('0x3f')](_0x59c383[_0xaa28('0x3d')],{'$or':_[_0xaa28('0x2d')](_0x1033ce,function(_0xaa3017){if(_0xaa3017[_0xaa28('0x40')]!==_0xaa28('0x41')){var _0x5251c9={};_0x5251c9[_0xaa3017[_0xaa28('0x2a')]]={'$like':'%'+_0x16a38c[_0xaa28('0x32')][_0xaa28('0x42')]+'%'};return _0x5251c9;}})});}_0x59c383=_[_0xaa28('0x3f')]({},_0x59c383,_0x16a38c[_0xaa28('0x43')]);var _0x2ee1f7={'where':_0x59c383[_0xaa28('0x3d')]};return db[_0xaa28('0x2e')][_0xaa28('0x20')](_0x2ee1f7)[_0xaa28('0x27')](function(_0x75de3d){_0x3a3791['count']=_0x75de3d;if(_0x16a38c[_0xaa28('0x32')][_0xaa28('0x44')]){_0x59c383[_0xaa28('0x45')]=[{'all':!![]}];}return db[_0xaa28('0x2e')][_0xaa28('0x46')](_0x59c383);})[_0xaa28('0x27')](function(_0x426e85){_0x3a3791[_0xaa28('0x47')]=_0x426e85;return _0x3a3791;})[_0xaa28('0x27')](respondWithFilteredResult(_0x598a2e,_0x59c383))[_0xaa28('0x48')](handleError(_0x598a2e,null));};exports['show']=function(_0x1e6f38,_0x2481a6){var _0x3d96a0={'raw':![],'where':{'id':_0x1e6f38[_0xaa28('0x49')]['id']}},_0x3eb7ae={};_0x3eb7ae[_0xaa28('0x31')]=_['keys'](db['FreshsalesConfiguration'][_0xaa28('0x2f')]);_0x3eb7ae['query']=_[_0xaa28('0x33')](_0x1e6f38[_0xaa28('0x32')]);_0x3eb7ae[_0xaa28('0x34')]=_[_0xaa28('0x36')](_0x3eb7ae[_0xaa28('0x31')],_0x3eb7ae['query']);_0x3d96a0[_0xaa28('0x35')]=_[_0xaa28('0x36')](_0x3eb7ae[_0xaa28('0x31')],qs[_0xaa28('0x37')](_0x1e6f38['query'][_0xaa28('0x37')]));_0x3d96a0[_0xaa28('0x35')]=_0x3d96a0[_0xaa28('0x35')]['length']?_0x3d96a0[_0xaa28('0x35')]:_0x3eb7ae[_0xaa28('0x31')];if(_0x1e6f38[_0xaa28('0x32')][_0xaa28('0x44')]){_0x3d96a0[_0xaa28('0x45')]=[{'all':!![]}];}_0x3d96a0=_['merge']({},_0x3d96a0,_0x1e6f38['options']);return db['FreshsalesConfiguration'][_0xaa28('0x4a')](_0x3d96a0)[_0xaa28('0x27')](handleEntityNotFound(_0x2481a6,null))[_0xaa28('0x27')](respondWithResult(_0x2481a6,null))[_0xaa28('0x48')](handleError(_0x2481a6,null));};exports[_0xaa28('0x4b')]=function(_0x1b274c,_0x4338d2){return db[_0xaa28('0x2e')][_0xaa28('0x4b')](_0x1b274c[_0xaa28('0x4c')],{})[_0xaa28('0x27')](respondWithResult(_0x4338d2,0xc9))[_0xaa28('0x48')](handleError(_0x4338d2,null));};exports['update']=function(_0x55dc29,_0x3a82de){if(_0x55dc29[_0xaa28('0x4c')]['id']){delete _0x55dc29['body']['id'];}return db[_0xaa28('0x2e')]['find']({'where':{'id':_0x55dc29[_0xaa28('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a82de,null))['then'](saveUpdates(_0x55dc29[_0xaa28('0x4c')],null))[_0xaa28('0x27')](respondWithResult(_0x3a82de,null))[_0xaa28('0x48')](handleError(_0x3a82de,null));};exports[_0xaa28('0x26')]=function(_0x256690,_0x1ef215){return db[_0xaa28('0x2e')][_0xaa28('0x4a')]({'where':{'id':_0x256690['params']['id']}})[_0xaa28('0x27')](handleEntityNotFound(_0x1ef215,null))[_0xaa28('0x27')](removeEntity(_0x1ef215,null))[_0xaa28('0x48')](handleError(_0x1ef215,null));};exports[_0xaa28('0x4d')]=function(_0x229eaa,_0x489f9b,_0x481c7f){var _0x1b71b5={};var _0x570618={};var _0x504f4e;var _0x23e580;return db[_0xaa28('0x2e')]['findOne']({'where':{'id':_0x229eaa['params']['id']}})['then'](handleEntityNotFound(_0x489f9b,null))[_0xaa28('0x27')](function(_0x12514a){if(_0x12514a){_0x504f4e=_0x12514a;_0x570618[_0xaa28('0x31')]=_[_0xaa28('0x33')](db['FreshsalesField'][_0xaa28('0x2f')]);_0x570618[_0xaa28('0x32')]=_[_0xaa28('0x33')](_0x229eaa[_0xaa28('0x32')]);_0x570618[_0xaa28('0x34')]=_[_0xaa28('0x36')](_0x570618[_0xaa28('0x31')],_0x570618[_0xaa28('0x32')]);_0x1b71b5[_0xaa28('0x35')]=_['intersection'](_0x570618['model'],qs[_0xaa28('0x37')](_0x229eaa['query'][_0xaa28('0x37')]));_0x1b71b5[_0xaa28('0x35')]=_0x1b71b5[_0xaa28('0x35')]['length']?_0x1b71b5[_0xaa28('0x35')]:_0x570618[_0xaa28('0x31')];_0x1b71b5[_0xaa28('0x3b')]=qs[_0xaa28('0x3c')](_0x229eaa['query'][_0xaa28('0x3c')]);_0x1b71b5[_0xaa28('0x3d')]=qs[_0xaa28('0x34')](_[_0xaa28('0x3e')](_0x229eaa['query'],_0x570618[_0xaa28('0x34')]));if(_0x229eaa[_0xaa28('0x32')][_0xaa28('0x42')]){_0x1b71b5[_0xaa28('0x3d')]=_[_0xaa28('0x3f')](_0x1b71b5[_0xaa28('0x3d')],{'$or':_[_0xaa28('0x2d')](_0x1b71b5[_0xaa28('0x35')],function(_0x3cfc03){var _0x4a7411={};_0x4a7411[_0x3cfc03]={'$like':'%'+_0x229eaa[_0xaa28('0x32')][_0xaa28('0x42')]+'%'};return _0x4a7411;})});}_0x1b71b5=_['merge']({},_0x1b71b5,_0x229eaa[_0xaa28('0x43')]);return _0x504f4e[_0xaa28('0x4d')](_0x1b71b5);}})[_0xaa28('0x27')](function(_0x440e75){if(_0x440e75){_0x23e580=_0x440e75[_0xaa28('0x38')];if(!_0x229eaa[_0xaa28('0x32')][_0xaa28('0x39')]('nolimit')){_0x1b71b5[_0xaa28('0x1f')]=qs[_0xaa28('0x1f')](_0x229eaa[_0xaa28('0x32')][_0xaa28('0x1f')]);_0x1b71b5[_0xaa28('0x1d')]=qs[_0xaa28('0x1d')](_0x229eaa[_0xaa28('0x32')][_0xaa28('0x1d')]);}return _0x504f4e[_0xaa28('0x4d')](_0x1b71b5);}})['then'](function(_0x4c4c4f){if(_0x4c4c4f){return _0x4c4c4f?{'count':_0x23e580,'rows':_0x4c4c4f}:null;}})[_0xaa28('0x27')](respondWithResult(_0x489f9b,null))[_0xaa28('0x48')](handleError(_0x489f9b,null));};exports[_0xaa28('0x4e')]=function(_0x4ee3dc,_0x10a951,_0x378c2e){var _0x3bda47={};var _0x50512e={};var _0x4bd90b;var _0x27dcb9;return db[_0xaa28('0x2e')][_0xaa28('0x4f')]({'where':{'id':_0x4ee3dc[_0xaa28('0x49')]['id']}})[_0xaa28('0x27')](handleEntityNotFound(_0x10a951,null))[_0xaa28('0x27')](function(_0x325580){if(_0x325580){_0x4bd90b=_0x325580;_0x50512e['model']=_[_0xaa28('0x33')](db[_0xaa28('0x50')][_0xaa28('0x2f')]);_0x50512e[_0xaa28('0x32')]=_[_0xaa28('0x33')](_0x4ee3dc['query']);_0x50512e[_0xaa28('0x34')]=_[_0xaa28('0x36')](_0x50512e[_0xaa28('0x31')],_0x50512e[_0xaa28('0x32')]);_0x3bda47['attributes']=_[_0xaa28('0x36')](_0x50512e[_0xaa28('0x31')],qs[_0xaa28('0x37')](_0x4ee3dc[_0xaa28('0x32')][_0xaa28('0x37')]));_0x3bda47[_0xaa28('0x35')]=_0x3bda47[_0xaa28('0x35')][_0xaa28('0x38')]?_0x3bda47['attributes']:_0x50512e[_0xaa28('0x31')];_0x3bda47['order']=qs[_0xaa28('0x3c')](_0x4ee3dc[_0xaa28('0x32')][_0xaa28('0x3c')]);_0x3bda47[_0xaa28('0x3d')]=qs[_0xaa28('0x34')](_[_0xaa28('0x3e')](_0x4ee3dc[_0xaa28('0x32')],_0x50512e['filters']));if(_0x4ee3dc[_0xaa28('0x32')][_0xaa28('0x42')]){_0x3bda47[_0xaa28('0x3d')]=_[_0xaa28('0x3f')](_0x3bda47['where'],{'$or':_[_0xaa28('0x2d')](_0x3bda47[_0xaa28('0x35')],function(_0x3638cd){var _0x79abf4={};_0x79abf4[_0x3638cd]={'$like':'%'+_0x4ee3dc['query']['filter']+'%'};return _0x79abf4;})});}_0x3bda47=_[_0xaa28('0x3f')]({},_0x3bda47,_0x4ee3dc[_0xaa28('0x43')]);return _0x4bd90b[_0xaa28('0x4e')](_0x3bda47);}})[_0xaa28('0x27')](function(_0x55530d){if(_0x55530d){_0x27dcb9=_0x55530d['length'];if(!_0x4ee3dc[_0xaa28('0x32')]['hasOwnProperty'](_0xaa28('0x3a'))){_0x3bda47[_0xaa28('0x1f')]=qs[_0xaa28('0x1f')](_0x4ee3dc[_0xaa28('0x32')]['limit']);_0x3bda47[_0xaa28('0x1d')]=qs['offset'](_0x4ee3dc['query'][_0xaa28('0x1d')]);}return _0x4bd90b[_0xaa28('0x4e')](_0x3bda47);}})['then'](function(_0x9297c0){if(_0x9297c0){return _0x9297c0?{'count':_0x27dcb9,'rows':_0x9297c0}:null;}})[_0xaa28('0x27')](respondWithResult(_0x10a951,null))[_0xaa28('0x48')](handleError(_0x10a951,null));};exports['getFields']=function(_0x4323a3,_0x5e5193,_0x38f140){var _0x1c82a2={};var _0x3c1148={};var _0x4bb599;var _0x38f857;return db[_0xaa28('0x2e')][_0xaa28('0x4f')]({'where':{'id':_0x4323a3[_0xaa28('0x49')]['id']}})[_0xaa28('0x27')](handleEntityNotFound(_0x5e5193,null))[_0xaa28('0x27')](function(_0x491d62){if(_0x491d62){_0x4bb599=_0x491d62;_0x3c1148[_0xaa28('0x31')]=_[_0xaa28('0x33')](db[_0xaa28('0x50')][_0xaa28('0x2f')]);_0x3c1148[_0xaa28('0x32')]=_['keys'](_0x4323a3[_0xaa28('0x32')]);_0x3c1148[_0xaa28('0x34')]=_[_0xaa28('0x36')](_0x3c1148[_0xaa28('0x31')],_0x3c1148[_0xaa28('0x32')]);_0x1c82a2['attributes']=_['intersection'](_0x3c1148['model'],qs[_0xaa28('0x37')](_0x4323a3[_0xaa28('0x32')][_0xaa28('0x37')]));_0x1c82a2['attributes']=_0x1c82a2[_0xaa28('0x35')][_0xaa28('0x38')]?_0x1c82a2[_0xaa28('0x35')]:_0x3c1148[_0xaa28('0x31')];_0x1c82a2[_0xaa28('0x3b')]=qs[_0xaa28('0x3c')](_0x4323a3[_0xaa28('0x32')][_0xaa28('0x3c')]);_0x1c82a2['where']=qs[_0xaa28('0x34')](_[_0xaa28('0x3e')](_0x4323a3[_0xaa28('0x32')],_0x3c1148[_0xaa28('0x34')]));if(_0x4323a3['query'][_0xaa28('0x42')]){_0x1c82a2[_0xaa28('0x3d')]=_[_0xaa28('0x3f')](_0x1c82a2[_0xaa28('0x3d')],{'$or':_[_0xaa28('0x2d')](_0x1c82a2['attributes'],function(_0x10a9bb){var _0x21cde9={};_0x21cde9[_0x10a9bb]={'$like':'%'+_0x4323a3[_0xaa28('0x32')][_0xaa28('0x42')]+'%'};return _0x21cde9;})});}_0x1c82a2=_['merge']({},_0x1c82a2,_0x4323a3[_0xaa28('0x43')]);return _0x4bb599[_0xaa28('0x51')](_0x1c82a2);}})['then'](function(_0x2d3282){if(_0x2d3282){_0x38f857=_0x2d3282[_0xaa28('0x38')];if(!_0x4323a3[_0xaa28('0x32')][_0xaa28('0x39')](_0xaa28('0x3a'))){_0x1c82a2[_0xaa28('0x1f')]=qs[_0xaa28('0x1f')](_0x4323a3[_0xaa28('0x32')][_0xaa28('0x1f')]);_0x1c82a2[_0xaa28('0x1d')]=qs[_0xaa28('0x1d')](_0x4323a3[_0xaa28('0x32')][_0xaa28('0x1d')]);}return _0x4bb599[_0xaa28('0x51')](_0x1c82a2);}})['then'](function(_0xad5f7d){if(_0xad5f7d){return _0xad5f7d?{'count':_0x38f857,'rows':_0xad5f7d}:null;}})[_0xaa28('0x27')](respondWithResult(_0x5e5193,null))['catch'](handleError(_0x5e5193,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5710718..f39acd0 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 _0x2c65=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xba39bc,_0x53262f){var _0x152e04=function(_0x7d82ce){while(--_0x7d82ce){_0xba39bc['push'](_0xba39bc['shift']());}};_0x152e04(++_0x53262f);}(_0x2c65,0x130));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c6('0x0'));var util=require(_0x52c6('0x1'));var logger=require(_0x52c6('0x2'))(_0x52c6('0x3'));var moment=require(_0x52c6('0x4'));var BPromise=require(_0x52c6('0x5'));var rp=require(_0x52c6('0x6'));var fs=require('fs');var path=require(_0x52c6('0x7'));var rimraf=require(_0x52c6('0x8'));var config=require(_0x52c6('0x9'));var attributes=require(_0x52c6('0xa'));module[_0x52c6('0xb')]=function(_0x2320cd,_0x3d300d){return _0x2320cd['define'](_0x52c6('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x237d=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','lodash','util','api','moment'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x237d,0x14c));var _0xd237=function(_0x30e96f,_0x12dd96){_0x30e96f=_0x30e96f-0x0;var _0x356214=_0x237d[_0x30e96f];return _0x356214;};'use strict';var _=require(_0xd237('0x0'));var util=require(_0xd237('0x1'));var logger=require('../../config/logger')(_0xd237('0x2'));var moment=require(_0xd237('0x3'));var BPromise=require(_0xd237('0x4'));var rp=require(_0xd237('0x5'));var fs=require('fs');var path=require(_0xd237('0x6'));var rimraf=require(_0xd237('0x7'));var config=require(_0xd237('0x8'));var attributes=require(_0xd237('0x9'));module[_0xd237('0xa')]=function(_0x274ad6,_0x4c52b0){return _0x274ad6[_0xd237('0xb')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index cbc08e5..b87e262 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 _0xa052=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x417a94,_0x14f396){var _0x20e7d5=function(_0x2bdec7){while(--_0x2bdec7){_0x417a94['push'](_0x417a94['shift']());}};_0x20e7d5(++_0x14f396);}(_0xa052,0x99));var _0x2a05=function(_0x333a64,_0x3ef4a6){_0x333a64=_0x333a64-0x0;var _0x3b8c1e=_0xa052[_0x333a64];return _0x3b8c1e;};'use strict';var _=require(_0x2a05('0x0'));var util=require(_0x2a05('0x1'));var moment=require(_0x2a05('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a05('0x3'));var fs=require('fs');var Redis=require(_0x2a05('0x4'));var db=require(_0x2a05('0x5'))['db'];var utils=require(_0x2a05('0x6'));var logger=require(_0x2a05('0x7'))(_0x2a05('0x8'));var config=require(_0x2a05('0x9'));var jayson=require(_0x2a05('0xa'));var client=jayson[_0x2a05('0xb')][_0x2a05('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3db819,_0xbafe7e,_0x5562cd){return new BPromise(function(_0x156d30,_0x270f43){return client[_0x2a05('0xd')](_0x3db819,_0x5562cd)['then'](function(_0x4759f3){logger['info'](_0x2a05('0xe'),_0xbafe7e,_0x2a05('0xf'));logger[_0x2a05('0x10')](_0x2a05('0x11'),_0xbafe7e,_0x2a05('0xf'),JSON[_0x2a05('0x12')](_0x4759f3));if(_0x4759f3['error']){if(_0x4759f3[_0x2a05('0x13')][_0x2a05('0x14')]===0x1f4){logger['error'](_0x2a05('0xe'),_0xbafe7e,_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);return _0x270f43(_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);}logger[_0x2a05('0x13')](_0x2a05('0xe'),_0xbafe7e,_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);return _0x156d30(_0x4759f3[_0x2a05('0x13')][_0x2a05('0x15')]);}else{logger[_0x2a05('0x16')](_0x2a05('0xe'),_0xbafe7e,_0x2a05('0xf'));_0x156d30(_0x4759f3[_0x2a05('0x17')][_0x2a05('0x15')]);}})[_0x2a05('0x18')](function(_0xa9c86d){logger[_0x2a05('0x13')](_0x2a05('0xe'),_0xbafe7e,_0xa9c86d);_0x270f43(_0xa9c86d);});});} \ No newline at end of file +var _0xfc6d=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x18ef41,_0xb6c5a){var _0x2868c2=function(_0x3a1135){while(--_0x3a1135){_0x18ef41['push'](_0x18ef41['shift']());}};_0x2868c2(++_0xb6c5a);}(_0xfc6d,0x84));var _0xdfc6=function(_0x5d4384,_0x17bebf){_0x5d4384=_0x5d4384-0x0;var _0x5eaadd=_0xfc6d[_0x5d4384];return _0x5eaadd;};'use strict';var _=require(_0xdfc6('0x0'));var util=require('util');var moment=require(_0xdfc6('0x1'));var BPromise=require(_0xdfc6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfc6('0x3'))['db'];var utils=require(_0xdfc6('0x4'));var logger=require(_0xdfc6('0x5'))(_0xdfc6('0x6'));var config=require(_0xdfc6('0x7'));var jayson=require(_0xdfc6('0x8'));var client=jayson['client'][_0xdfc6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x313603,_0x5494fd,_0x5998e9){return new BPromise(function(_0x55d51e,_0x2ec0db){return client[_0xdfc6('0xa')](_0x313603,_0x5998e9)[_0xdfc6('0xb')](function(_0x48114e){logger['info'](_0xdfc6('0xc'),_0x5494fd,_0xdfc6('0xd'));logger[_0xdfc6('0xe')](_0xdfc6('0xf'),_0x5494fd,_0xdfc6('0xd'),JSON[_0xdfc6('0x10')](_0x48114e));if(_0x48114e['error']){if(_0x48114e[_0xdfc6('0x11')][_0xdfc6('0x12')]===0x1f4){logger[_0xdfc6('0x11')](_0xdfc6('0xc'),_0x5494fd,_0x48114e['error'][_0xdfc6('0x13')]);return _0x2ec0db(_0x48114e[_0xdfc6('0x11')][_0xdfc6('0x13')]);}logger[_0xdfc6('0x11')](_0xdfc6('0xc'),_0x5494fd,_0x48114e[_0xdfc6('0x11')][_0xdfc6('0x13')]);return _0x55d51e(_0x48114e[_0xdfc6('0x11')][_0xdfc6('0x13')]);}else{logger['info'](_0xdfc6('0xc'),_0x5494fd,_0xdfc6('0xd'));_0x55d51e(_0x48114e['result']['message']);}})[_0xdfc6('0x14')](function(_0x3d1f62){logger[_0xdfc6('0x11')](_0xdfc6('0xc'),_0x5494fd,_0x3d1f62);_0x2ec0db(_0x3d1f62);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 22fa009..7d133ac 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 _0xc737=['get','/:id','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x37930,_0x113c18){var _0x25faec=function(_0x344734){while(--_0x344734){_0x37930['push'](_0x37930['shift']());}};_0x25faec(++_0x113c18);}(_0xc737,0x8e));var _0x7c73=function(_0x3ca54c,_0xdaddba){_0x3ca54c=_0x3ca54c-0x0;var _0xbbccb4=_0xc737[_0x3ca54c];return _0xbbccb4;};'use strict';var multer=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var path=require('path');var timeout=require(_0x7c73('0x2'));var express=require(_0x7c73('0x3'));var router=express[_0x7c73('0x4')]();var fs_extra=require(_0x7c73('0x5'));var auth=require(_0x7c73('0x6'));var interaction=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x7c73('0x9')](),controller[_0x7c73('0xa')]);router[_0x7c73('0xb')](_0x7c73('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7c73('0xd')](_0x7c73('0xc'),auth[_0x7c73('0x9')](),controller[_0x7c73('0xe')]);router['delete'](_0x7c73('0xc'),auth['isAuthenticated'](),controller[_0x7c73('0xf')]);module[_0x7c73('0x10')]=router; \ No newline at end of file +var _0xd1d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x40c7d2,_0x2d7b08){var _0x3aeec6=function(_0x594bfe){while(--_0x594bfe){_0x40c7d2['push'](_0x40c7d2['shift']());}};_0x3aeec6(++_0x2d7b08);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xd1d4[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0x4d1d('0x0'));var util=require(_0x4d1d('0x1'));var path=require('path');var timeout=require(_0x4d1d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d1d('0x3'));var auth=require(_0x4d1d('0x4'));var interaction=require(_0x4d1d('0x5'));var config=require(_0x4d1d('0x6'));var controller=require(_0x4d1d('0x7'));router[_0x4d1d('0x8')]('/',auth[_0x4d1d('0x9')](),controller[_0x4d1d('0xa')]);router[_0x4d1d('0x8')](_0x4d1d('0xb'),auth[_0x4d1d('0x9')](),controller['show']);router['post']('/',auth[_0x4d1d('0x9')](),controller[_0x4d1d('0xc')]);router['put'](_0x4d1d('0xb'),auth[_0x4d1d('0x9')](),controller[_0x4d1d('0xd')]);router[_0x4d1d('0xe')](_0x4d1d('0xb'),auth[_0x4d1d('0x9')](),controller[_0x4d1d('0xf')]);module[_0x4d1d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ce8ae65..ecb43c2 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 _0x50c9=['customVariable','BOOLEAN','exports','string','keyValue','STRING','ENUM','variable'];(function(_0x30e3c8,_0x5a531b){var _0x38c130=function(_0x125f7f){while(--_0x125f7f){_0x30e3c8['push'](_0x30e3c8['shift']());}};_0x38c130(++_0x5a531b);}(_0x50c9,0xda));var _0x950c=function(_0x46365d,_0x2e46a5){_0x46365d=_0x46365d-0x0;var _0x4e8368=_0x50c9[_0x46365d];return _0x4e8368;};'use strict';var Sequelize=require('sequelize');module[_0x950c('0x0')]={'type':{'type':Sequelize['ENUM'](_0x950c('0x1'),'variable','customVariable',_0x950c('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x950c('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x950c('0x4')](_0x950c('0x1'),_0x950c('0x5'),_0x950c('0x6'))},'keyContent':{'type':Sequelize[_0x950c('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x950c('0x3')]},'customField':{'type':Sequelize[_0x950c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x950c('0x3')]}}; \ No newline at end of file +var _0xc7d4=['STRING','variable','BOOLEAN','sequelize','ENUM','string','keyValue','picklist'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0xc7d4,0x1e3));var _0x4c7d=function(_0x762d44,_0x276b18){_0x762d44=_0x762d44-0x0;var _0x1308ae=_0xc7d4[_0x762d44];return _0x1308ae;};'use strict';var Sequelize=require(_0x4c7d('0x0'));module['exports']={'type':{'type':Sequelize[_0x4c7d('0x1')](_0x4c7d('0x2'),'variable','customVariable',_0x4c7d('0x3'),_0x4c7d('0x4')),'defaultValue':_0x4c7d('0x2')},'content':{'type':Sequelize[_0x4c7d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4c7d('0x1')]('string',_0x4c7d('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x4c7d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4c7d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4c7d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 096b55f..acab7b6 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 _0xcc5f=['model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','stack','name','map','FreshsalesField','rawAttributes'];(function(_0x3da72b,_0x4fd809){var _0xc64ac4=function(_0x387e50){while(--_0x387e50){_0x3da72b['push'](_0x3da72b['shift']());}};_0xc64ac4(++_0x4fd809);}(_0xcc5f,0x1c7));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfcc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcc5('0x1'));var jsonpatch=require(_0xfcc5('0x2'));var rp=require('request-promise');var moment=require(_0xfcc5('0x3'));var BPromise=require(_0xfcc5('0x4'));var Mustache=require('mustache');var util=require(_0xfcc5('0x5'));var path=require(_0xfcc5('0x6'));var sox=require('sox');var csv=require(_0xfcc5('0x7'));var ejs=require(_0xfcc5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcc5('0x9'));var squel=require('squel');var crypto=require(_0xfcc5('0xa'));var jsforce=require(_0xfcc5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfcc5('0x7'));var querystring=require(_0xfcc5('0xc'));var Papa=require(_0xfcc5('0xd'));var Redis=require(_0xfcc5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcc5('0xf'));var hardwareService=require(_0xfcc5('0x10'));var logger=require(_0xfcc5('0x11'))(_0xfcc5('0x12'));var utils=require(_0xfcc5('0x13'));var config=require(_0xfcc5('0x14'));var licenseUtil=require(_0xfcc5('0x15'));var db=require(_0xfcc5('0x16'))['db'];function respondWithStatusCode(_0x2f1f4c,_0x965bc4){_0x965bc4=_0x965bc4||0xcc;return function(_0x46636e){if(_0x46636e){return _0x2f1f4c[_0xfcc5('0x17')](_0x965bc4);}return _0x2f1f4c[_0xfcc5('0x18')](_0x965bc4)[_0xfcc5('0x19')]();};}function respondWithResult(_0x20d379,_0x4c8b46){_0x4c8b46=_0x4c8b46||0xc8;return function(_0xab06c9){if(_0xab06c9){return _0x20d379[_0xfcc5('0x18')](_0x4c8b46)[_0xfcc5('0x1a')](_0xab06c9);}};}function respondWithFilteredResult(_0x4f5338,_0x17a54f){return function(_0x17c49e){if(_0x17c49e){var _0x6aba2d=typeof _0x17a54f[_0xfcc5('0x1b')]==='undefined'&&typeof _0x17a54f[_0xfcc5('0x1c')]===_0xfcc5('0x1d');var _0x39f691=_0x17c49e['count'];var _0x39a8fe=_0x6aba2d?0x0:_0x17a54f[_0xfcc5('0x1b')];var _0x1497d3=_0x6aba2d?_0x17c49e[_0xfcc5('0x1e')]:_0x17a54f[_0xfcc5('0x1b')]+_0x17a54f[_0xfcc5('0x1c')];var _0x4cee5c;if(_0x1497d3>=_0x39f691){_0x1497d3=_0x39f691;_0x4cee5c=0xc8;}else{_0x4cee5c=0xce;}_0x4f5338[_0xfcc5('0x18')](_0x4cee5c);return _0x4f5338[_0xfcc5('0x1f')](_0xfcc5('0x20'),_0x39a8fe+'-'+_0x1497d3+'/'+_0x39f691)[_0xfcc5('0x1a')](_0x17c49e);}return null;};}function patchUpdates(_0x28a159){return function(_0x50655f){try{jsonpatch['apply'](_0x50655f,_0x28a159,!![]);}catch(_0x3f5190){return BPromise[_0xfcc5('0x21')](_0x3f5190);}return _0x50655f[_0xfcc5('0x22')]();};}function saveUpdates(_0x25f44d,_0x2db98b){return function(_0x8eae6d){if(_0x8eae6d){return _0x8eae6d[_0xfcc5('0x23')](_0x25f44d)[_0xfcc5('0x24')](function(_0x6f33ed){return _0x6f33ed;});}return null;};}function removeEntity(_0x276e22,_0x492b19){return function(_0x306c28){if(_0x306c28){return _0x306c28['destroy']()['then'](function(){_0x276e22[_0xfcc5('0x18')](0xcc)[_0xfcc5('0x19')]();});}};}function handleEntityNotFound(_0x3ebbc0,_0x3ca706){return function(_0x1409d9){if(!_0x1409d9){_0x3ebbc0[_0xfcc5('0x17')](0x194);}return _0x1409d9;};}function handleError(_0x409023,_0x5af4f8){_0x5af4f8=_0x5af4f8||0x1f4;return function(_0x161d03){logger['error'](_0x161d03[_0xfcc5('0x25')]);if(_0x161d03['name']){delete _0x161d03[_0xfcc5('0x26')];}_0x409023[_0xfcc5('0x18')](_0x5af4f8)['send'](_0x161d03);};}exports['index']=function(_0x1e01be,_0x1b8495){var _0x27e152={},_0x476578={},_0x376474={'count':0x0,'rows':[]};var _0x3736d2=_[_0xfcc5('0x27')](db[_0xfcc5('0x28')][_0xfcc5('0x29')],function(_0x1f5eae){return{'name':_0x1f5eae['fieldName'],'type':_0x1f5eae['type']['key']};});_0x476578[_0xfcc5('0x2a')]=_[_0xfcc5('0x27')](_0x3736d2,_0xfcc5('0x26'));_0x476578['query']=_[_0xfcc5('0x2b')](_0x1e01be[_0xfcc5('0x2c')]);_0x476578['filters']=_['intersection'](_0x476578[_0xfcc5('0x2a')],_0x476578[_0xfcc5('0x2c')]);_0x27e152[_0xfcc5('0x2d')]=_[_0xfcc5('0x2e')](_0x476578[_0xfcc5('0x2a')],qs[_0xfcc5('0x2f')](_0x1e01be[_0xfcc5('0x2c')]['fields']));_0x27e152['attributes']=_0x27e152['attributes']['length']?_0x27e152[_0xfcc5('0x2d')]:_0x476578[_0xfcc5('0x2a')];if(!_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x30')](_0xfcc5('0x31'))){_0x27e152[_0xfcc5('0x1c')]=qs[_0xfcc5('0x1c')](_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x1c')]);_0x27e152['offset']=qs['offset'](_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x1b')]);}_0x27e152[_0xfcc5('0x32')]=qs[_0xfcc5('0x33')](_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x33')]);_0x27e152['where']=qs['filters'](_[_0xfcc5('0x34')](_0x1e01be[_0xfcc5('0x2c')],_0x476578[_0xfcc5('0x35')]),_0x3736d2);if(_0x1e01be['query'][_0xfcc5('0x36')]){_0x27e152[_0xfcc5('0x37')]=_[_0xfcc5('0x38')](_0x27e152[_0xfcc5('0x37')],{'$or':_[_0xfcc5('0x27')](_0x3736d2,function(_0x5f7d0f){if(_0x5f7d0f[_0xfcc5('0x39')]!==_0xfcc5('0x3a')){var _0x250e6a={};_0x250e6a[_0x5f7d0f['name']]={'$like':'%'+_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x36')]+'%'};return _0x250e6a;}})});}_0x27e152=_['merge']({},_0x27e152,_0x1e01be[_0xfcc5('0x3b')]);var _0x55d118={'where':_0x27e152[_0xfcc5('0x37')]};return db[_0xfcc5('0x28')][_0xfcc5('0x1e')](_0x55d118)[_0xfcc5('0x24')](function(_0x1075ce){_0x376474[_0xfcc5('0x1e')]=_0x1075ce;if(_0x1e01be[_0xfcc5('0x2c')][_0xfcc5('0x3c')]){_0x27e152[_0xfcc5('0x3d')]=[{'all':!![]}];}return db[_0xfcc5('0x28')][_0xfcc5('0x3e')](_0x27e152);})['then'](function(_0x1fec73){_0x376474['rows']=_0x1fec73;return _0x376474;})[_0xfcc5('0x24')](respondWithFilteredResult(_0x1b8495,_0x27e152))[_0xfcc5('0x3f')](handleError(_0x1b8495,null));};exports[_0xfcc5('0x40')]=function(_0x453bc0,_0x18a6be){var _0x53ce45={'raw':!![],'where':{'id':_0x453bc0[_0xfcc5('0x41')]['id']}},_0x587983={};_0x587983['model']=_[_0xfcc5('0x2b')](db[_0xfcc5('0x28')][_0xfcc5('0x29')]);_0x587983[_0xfcc5('0x2c')]=_['keys'](_0x453bc0[_0xfcc5('0x2c')]);_0x587983[_0xfcc5('0x35')]=_[_0xfcc5('0x2e')](_0x587983[_0xfcc5('0x2a')],_0x587983['query']);_0x53ce45['attributes']=_['intersection'](_0x587983['model'],qs['fields'](_0x453bc0['query'][_0xfcc5('0x2f')]));_0x53ce45[_0xfcc5('0x2d')]=_0x53ce45[_0xfcc5('0x2d')][_0xfcc5('0x42')]?_0x53ce45['attributes']:_0x587983[_0xfcc5('0x2a')];if(_0x453bc0['query'][_0xfcc5('0x3c')]){_0x53ce45[_0xfcc5('0x3d')]=[{'all':!![]}];}_0x53ce45=_[_0xfcc5('0x38')]({},_0x53ce45,_0x453bc0[_0xfcc5('0x3b')]);return db[_0xfcc5('0x28')]['find'](_0x53ce45)[_0xfcc5('0x24')](handleEntityNotFound(_0x18a6be,null))[_0xfcc5('0x24')](respondWithResult(_0x18a6be,null))[_0xfcc5('0x3f')](handleError(_0x18a6be,null));};exports[_0xfcc5('0x43')]=function(_0x775e3f,_0x19897e){return db['FreshsalesField'][_0xfcc5('0x43')](_0x775e3f[_0xfcc5('0x44')],{})[_0xfcc5('0x24')](respondWithResult(_0x19897e,0xc9))[_0xfcc5('0x3f')](handleError(_0x19897e,null));};exports['update']=function(_0x52b487,_0x157a93){if(_0x52b487['body']['id']){delete _0x52b487[_0xfcc5('0x44')]['id'];}return db[_0xfcc5('0x28')][_0xfcc5('0x45')]({'where':{'id':_0x52b487['params']['id']}})[_0xfcc5('0x24')](handleEntityNotFound(_0x157a93,null))[_0xfcc5('0x24')](saveUpdates(_0x52b487[_0xfcc5('0x44')],null))[_0xfcc5('0x24')](respondWithResult(_0x157a93,null))[_0xfcc5('0x3f')](handleError(_0x157a93,null));};exports[_0xfcc5('0x46')]=function(_0x43466a,_0x321d39){return db[_0xfcc5('0x28')]['find']({'where':{'id':_0x43466a[_0xfcc5('0x41')]['id']}})['then'](handleEntityNotFound(_0x321d39,null))[_0xfcc5('0x24')](removeEntity(_0x321d39,null))['catch'](handleError(_0x321d39,null));}; \ No newline at end of file +var _0x1e12=['catch','show','fields','includeAll','include','options','find','create','body','params','rimraf','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','FreshsalesField','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','findAll'];(function(_0x23b878,_0x41e5a0){var _0x3e4d14=function(_0x2b8651){while(--_0x2b8651){_0x23b878['push'](_0x23b878['shift']());}};_0x3e4d14(++_0x41e5a0);}(_0x1e12,0x172));var _0x21e1=function(_0x47f6ce,_0x1b7377){_0x47f6ce=_0x47f6ce-0x0;var _0x3b475f=_0x1e12[_0x47f6ce];return _0x3b475f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21e1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x21e1('0x1'));var moment=require('moment');var BPromise=require(_0x21e1('0x2'));var Mustache=require(_0x21e1('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x21e1('0x4'));var ejs=require(_0x21e1('0x5'));var fs=require('fs');var fs_extra=require(_0x21e1('0x6'));var _=require(_0x21e1('0x7'));var squel=require(_0x21e1('0x8'));var crypto=require(_0x21e1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x21e1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x21e1('0xb'));var Papa=require(_0x21e1('0xc'));var Redis=require('ioredis');var authService=require(_0x21e1('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x21e1('0xe'));var hardwareService=require(_0x21e1('0xf'));var logger=require(_0x21e1('0x10'))(_0x21e1('0x11'));var utils=require(_0x21e1('0x12'));var config=require(_0x21e1('0x13'));var licenseUtil=require(_0x21e1('0x14'));var db=require(_0x21e1('0x15'))['db'];function respondWithStatusCode(_0x267772,_0x38cef0){_0x38cef0=_0x38cef0||0xcc;return function(_0x2370af){if(_0x2370af){return _0x267772[_0x21e1('0x16')](_0x38cef0);}return _0x267772[_0x21e1('0x17')](_0x38cef0)['end']();};}function respondWithResult(_0x462950,_0x313bdc){_0x313bdc=_0x313bdc||0xc8;return function(_0x3a156f){if(_0x3a156f){return _0x462950[_0x21e1('0x17')](_0x313bdc)[_0x21e1('0x18')](_0x3a156f);}};}function respondWithFilteredResult(_0x18f33b,_0x396544){return function(_0x56ad17){if(_0x56ad17){var _0x409cbb=typeof _0x396544[_0x21e1('0x19')]===_0x21e1('0x1a')&&typeof _0x396544[_0x21e1('0x1b')]===_0x21e1('0x1a');var _0x2ca686=_0x56ad17[_0x21e1('0x1c')];var _0x376ff8=_0x409cbb?0x0:_0x396544[_0x21e1('0x19')];var _0x1e39c5=_0x409cbb?_0x56ad17[_0x21e1('0x1c')]:_0x396544['offset']+_0x396544[_0x21e1('0x1b')];var _0x23a581;if(_0x1e39c5>=_0x2ca686){_0x1e39c5=_0x2ca686;_0x23a581=0xc8;}else{_0x23a581=0xce;}_0x18f33b[_0x21e1('0x17')](_0x23a581);return _0x18f33b[_0x21e1('0x1d')](_0x21e1('0x1e'),_0x376ff8+'-'+_0x1e39c5+'/'+_0x2ca686)[_0x21e1('0x18')](_0x56ad17);}return null;};}function patchUpdates(_0x1b39d1){return function(_0x19cc8c){try{jsonpatch[_0x21e1('0x1f')](_0x19cc8c,_0x1b39d1,!![]);}catch(_0x4f428a){return BPromise[_0x21e1('0x20')](_0x4f428a);}return _0x19cc8c['save']();};}function saveUpdates(_0x2f2ab0,_0x62e1ca){return function(_0x394754){if(_0x394754){return _0x394754[_0x21e1('0x21')](_0x2f2ab0)[_0x21e1('0x22')](function(_0x40d2a5){return _0x40d2a5;});}return null;};}function removeEntity(_0x161a03,_0x2e0ff1){return function(_0x2cee24){if(_0x2cee24){return _0x2cee24[_0x21e1('0x23')]()[_0x21e1('0x22')](function(){_0x161a03['status'](0xcc)[_0x21e1('0x24')]();});}};}function handleEntityNotFound(_0x458226,_0x3772f3){return function(_0x2cfba1){if(!_0x2cfba1){_0x458226[_0x21e1('0x16')](0x194);}return _0x2cfba1;};}function handleError(_0x496b76,_0x105b89){_0x105b89=_0x105b89||0x1f4;return function(_0x419fd){logger[_0x21e1('0x25')](_0x419fd[_0x21e1('0x26')]);if(_0x419fd[_0x21e1('0x27')]){delete _0x419fd[_0x21e1('0x27')];}_0x496b76[_0x21e1('0x17')](_0x105b89)['send'](_0x419fd);};}exports[_0x21e1('0x28')]=function(_0x10778e,_0x3c15f8){var _0x24ca25={},_0x30c814={},_0x3cf24c={'count':0x0,'rows':[]};var _0x5f4d5b=_[_0x21e1('0x29')](db[_0x21e1('0x2a')][_0x21e1('0x2b')],function(_0x58685d){return{'name':_0x58685d['fieldName'],'type':_0x58685d[_0x21e1('0x2c')]['key']};});_0x30c814[_0x21e1('0x2d')]=_['map'](_0x5f4d5b,_0x21e1('0x27'));_0x30c814[_0x21e1('0x2e')]=_[_0x21e1('0x2f')](_0x10778e['query']);_0x30c814[_0x21e1('0x30')]=_[_0x21e1('0x31')](_0x30c814[_0x21e1('0x2d')],_0x30c814[_0x21e1('0x2e')]);_0x24ca25['attributes']=_[_0x21e1('0x31')](_0x30c814[_0x21e1('0x2d')],qs['fields'](_0x10778e[_0x21e1('0x2e')]['fields']));_0x24ca25[_0x21e1('0x32')]=_0x24ca25[_0x21e1('0x32')][_0x21e1('0x33')]?_0x24ca25['attributes']:_0x30c814['model'];if(!_0x10778e[_0x21e1('0x2e')][_0x21e1('0x34')](_0x21e1('0x35'))){_0x24ca25[_0x21e1('0x1b')]=qs[_0x21e1('0x1b')](_0x10778e['query'][_0x21e1('0x1b')]);_0x24ca25[_0x21e1('0x19')]=qs[_0x21e1('0x19')](_0x10778e[_0x21e1('0x2e')][_0x21e1('0x19')]);}_0x24ca25[_0x21e1('0x36')]=qs[_0x21e1('0x37')](_0x10778e[_0x21e1('0x2e')][_0x21e1('0x37')]);_0x24ca25[_0x21e1('0x38')]=qs[_0x21e1('0x30')](_[_0x21e1('0x39')](_0x10778e[_0x21e1('0x2e')],_0x30c814[_0x21e1('0x30')]),_0x5f4d5b);if(_0x10778e['query'][_0x21e1('0x3a')]){_0x24ca25['where']=_['merge'](_0x24ca25[_0x21e1('0x38')],{'$or':_['map'](_0x5f4d5b,function(_0x35c765){if(_0x35c765[_0x21e1('0x2c')]!==_0x21e1('0x3b')){var _0xde39e5={};_0xde39e5[_0x35c765['name']]={'$like':'%'+_0x10778e[_0x21e1('0x2e')][_0x21e1('0x3a')]+'%'};return _0xde39e5;}})});}_0x24ca25=_[_0x21e1('0x3c')]({},_0x24ca25,_0x10778e['options']);var _0x551eb7={'where':_0x24ca25['where']};return db[_0x21e1('0x2a')][_0x21e1('0x1c')](_0x551eb7)[_0x21e1('0x22')](function(_0x5ab7d6){_0x3cf24c[_0x21e1('0x1c')]=_0x5ab7d6;if(_0x10778e['query']['includeAll']){_0x24ca25['include']=[{'all':!![]}];}return db[_0x21e1('0x2a')][_0x21e1('0x3d')](_0x24ca25);})[_0x21e1('0x22')](function(_0x3b6bf0){_0x3cf24c['rows']=_0x3b6bf0;return _0x3cf24c;})[_0x21e1('0x22')](respondWithFilteredResult(_0x3c15f8,_0x24ca25))[_0x21e1('0x3e')](handleError(_0x3c15f8,null));};exports[_0x21e1('0x3f')]=function(_0x528391,_0x18d633){var _0x51e810={'raw':!![],'where':{'id':_0x528391['params']['id']}},_0x2b51dd={};_0x2b51dd[_0x21e1('0x2d')]=_[_0x21e1('0x2f')](db[_0x21e1('0x2a')][_0x21e1('0x2b')]);_0x2b51dd[_0x21e1('0x2e')]=_['keys'](_0x528391[_0x21e1('0x2e')]);_0x2b51dd[_0x21e1('0x30')]=_[_0x21e1('0x31')](_0x2b51dd[_0x21e1('0x2d')],_0x2b51dd[_0x21e1('0x2e')]);_0x51e810[_0x21e1('0x32')]=_[_0x21e1('0x31')](_0x2b51dd[_0x21e1('0x2d')],qs[_0x21e1('0x40')](_0x528391['query']['fields']));_0x51e810[_0x21e1('0x32')]=_0x51e810[_0x21e1('0x32')]['length']?_0x51e810[_0x21e1('0x32')]:_0x2b51dd[_0x21e1('0x2d')];if(_0x528391[_0x21e1('0x2e')][_0x21e1('0x41')]){_0x51e810[_0x21e1('0x42')]=[{'all':!![]}];}_0x51e810=_[_0x21e1('0x3c')]({},_0x51e810,_0x528391[_0x21e1('0x43')]);return db['FreshsalesField'][_0x21e1('0x44')](_0x51e810)[_0x21e1('0x22')](handleEntityNotFound(_0x18d633,null))[_0x21e1('0x22')](respondWithResult(_0x18d633,null))[_0x21e1('0x3e')](handleError(_0x18d633,null));};exports[_0x21e1('0x45')]=function(_0x571a92,_0x124521){return db[_0x21e1('0x2a')][_0x21e1('0x45')](_0x571a92[_0x21e1('0x46')],{})[_0x21e1('0x22')](respondWithResult(_0x124521,0xc9))[_0x21e1('0x3e')](handleError(_0x124521,null));};exports[_0x21e1('0x21')]=function(_0x8feb0b,_0x25b7e2){if(_0x8feb0b[_0x21e1('0x46')]['id']){delete _0x8feb0b['body']['id'];}return db[_0x21e1('0x2a')][_0x21e1('0x44')]({'where':{'id':_0x8feb0b[_0x21e1('0x47')]['id']}})[_0x21e1('0x22')](handleEntityNotFound(_0x25b7e2,null))[_0x21e1('0x22')](saveUpdates(_0x8feb0b[_0x21e1('0x46')],null))[_0x21e1('0x22')](respondWithResult(_0x25b7e2,null))['catch'](handleError(_0x25b7e2,null));};exports[_0x21e1('0x23')]=function(_0x481a9a,_0x5587ef){return db[_0x21e1('0x2a')][_0x21e1('0x44')]({'where':{'id':_0x481a9a[_0x21e1('0x47')]['id']}})[_0x21e1('0x22')](handleEntityNotFound(_0x5587ef,null))[_0x21e1('0x22')](removeEntity(_0x5587ef,null))[_0x21e1('0x3e')](handleError(_0x5587ef,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 9602c20..6644efa 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 _0x1472=['request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56352b,_0x25ed46){var _0x5ab7d6=function(_0x203dbf){while(--_0x203dbf){_0x56352b['push'](_0x56352b['shift']());}};_0x5ab7d6(++_0x25ed46);}(_0x1472,0x166));var _0x2147=function(_0x2a829f,_0x1b0c15){_0x2a829f=_0x2a829f-0x0;var _0x5737c3=_0x1472[_0x2a829f];return _0x5737c3;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var logger=require(_0x2147('0x2'))(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var rp=require(_0x2147('0x6'));var fs=require('fs');var path=require(_0x2147('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2147('0x8'));module[_0x2147('0x9')]=function(_0x146353,_0x5593f4){return _0x146353['define'](_0x2147('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x2147('0xb'),'fields':[_0x2147('0xc'),_0x2147('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa467=['path','rimraf','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53cc68,_0x3920c1){var _0x5d18c6=function(_0x5c8db9){while(--_0x5c8db9){_0x53cc68['push'](_0x53cc68['shift']());}};_0x5d18c6(++_0x3920c1);}(_0xa467,0x143));var _0x7a46=function(_0x222ef1,_0xad7df1){_0x222ef1=_0x222ef1-0x0;var _0x5177ca=_0xa467[_0x222ef1];return _0x5177ca;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var logger=require(_0x7a46('0x2'))(_0x7a46('0x3'));var moment=require(_0x7a46('0x4'));var BPromise=require(_0x7a46('0x5'));var rp=require(_0x7a46('0x6'));var fs=require('fs');var path=require(_0x7a46('0x7'));var rimraf=require(_0x7a46('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x7a46('0x9')]=function(_0x1940e6,_0x3bfa2c){return _0x1940e6[_0x7a46('0xa')](_0x7a46('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x7a46('0xc'),'fields':[_0x7a46('0xd'),_0x7a46('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 4055df2..5ef1d10 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x353cd8,_0x1eef98){var _0x518964=function(_0x1e21cd){while(--_0x1e21cd){_0x353cd8['push'](_0x353cd8['shift']());}};_0x518964(++_0x1eef98);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x5fc3[_0x43fdf8];return _0x1160c6;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\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']('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f4cf6,_0x2e8fc1){var _0x5871ca=function(_0x20ef1f){while(--_0x20ef1f){_0x1f4cf6['push'](_0x1f4cf6['shift']());}};_0x5871ca(++_0x2e8fc1);}(_0x1623,0xab));var _0x3162=function(_0x5bd982,_0x45f55d){_0x5bd982=_0x5bd982-0x0;var _0x5350ba=_0x1623[_0x5bd982];return _0x5350ba;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 33508b7..b004114 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3fc0d9,_0xb79daf){var _0x3e376a=function(_0x35f5ae){while(--_0x35f5ae){_0x3fc0d9['push'](_0x3fc0d9['shift']());}};_0x3e376a(++_0xb79daf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x8f87f8,_0x2070ab){var _0x5936c2=function(_0x1e315d){while(--_0x1e315d){_0x8f87f8['push'](_0x8f87f8['shift']());}};_0x5936c2(++_0x2070ab);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 59c18de..5ba9054 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 _0x803c=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x803c,0x65));var _0xc803=function(_0x2b06f4,_0x207c99){_0x2b06f4=_0x2b06f4-0x0;var _0x417105=_0x803c[_0x2b06f4];return _0x417105;};'use strict';var Sequelize=require(_0xc803('0x0'));module[_0xc803('0x1')]={'name':{'type':Sequelize[_0xc803('0x2')]},'description':{'type':Sequelize[_0xc803('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc803('0x3')},'remoteUri':{'type':Sequelize[_0xc803('0x2')]},'password':{'type':Sequelize[_0xc803('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc803('0x2')]},'securityToken':{'type':Sequelize[_0xc803('0x2')]},'serverUrl':{'type':Sequelize[_0xc803('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc803('0x4')]('integrationTab',_0xc803('0x5')),'defaultValue':_0xc803('0x6')}}; \ No newline at end of file +var _0x2e54=['integrationTab','STRING','username','ENUM'];(function(_0x4c977f,_0xfbbf23){var _0x3c39c1=function(_0x4593d6){while(--_0x4593d6){_0x4c977f['push'](_0x4c977f['shift']());}};_0x3c39c1(++_0xfbbf23);}(_0x2e54,0xc1));var _0x42e5=function(_0x346f13,_0x22d731){_0x346f13=_0x346f13-0x0;var _0x5efa37=_0x2e54[_0x346f13];return _0x5efa37;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x42e5('0x0')]},'description':{'type':Sequelize[_0x42e5('0x0')]},'username':{'type':Sequelize[_0x42e5('0x0')],'unique':_0x42e5('0x1')},'remoteUri':{'type':Sequelize[_0x42e5('0x0')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x42e5('0x0')]},'clientSecret':{'type':Sequelize[_0x42e5('0x0')]},'securityToken':{'type':Sequelize[_0x42e5('0x0')]},'serverUrl':{'type':Sequelize[_0x42e5('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x42e5('0x2')]('integrationTab','newTab'),'defaultValue':_0x42e5('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a7c81fa..0f41a93 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 _0x92eb=['addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','username','password','slice','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','boolean','email','textarea','remove','includes','custom','picklistValues','value','True','true','False','false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','json','offset','count','limit','status','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','catch','params','intersection','create','body','find','getConfigurations','SalesforceConfiguration'];(function(_0x398c66,_0x3d75d0){var _0x254322=function(_0x64a3e5){while(--_0x64a3e5){_0x398c66['push'](_0x398c66['shift']());}};_0x254322(++_0x3d75d0);}(_0x92eb,0x196));var _0xb92e=function(_0x263ef3,_0x5dde75){_0x263ef3=_0x263ef3-0x0;var _0x18e32a=_0x92eb[_0x263ef3];return _0x18e32a;};'use strict';var emlformat=require(_0xb92e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb92e('0x1'));var jsonpatch=require(_0xb92e('0x2'));var rp=require(_0xb92e('0x3'));var moment=require(_0xb92e('0x4'));var BPromise=require(_0xb92e('0x5'));var Mustache=require(_0xb92e('0x6'));var util=require(_0xb92e('0x7'));var path=require(_0xb92e('0x8'));var sox=require(_0xb92e('0x9'));var csv=require(_0xb92e('0xa'));var ejs=require(_0xb92e('0xb'));var fs=require('fs');var fs_extra=require(_0xb92e('0xc'));var _=require('lodash');var squel=require(_0xb92e('0xd'));var crypto=require(_0xb92e('0xe'));var jsforce=require(_0xb92e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb92e('0xa'));var querystring=require(_0xb92e('0x10'));var Papa=require(_0xb92e('0x11'));var Redis=require(_0xb92e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb92e('0x13'));var as=require(_0xb92e('0x14'));var hardwareService=require(_0xb92e('0x15'));var logger=require(_0xb92e('0x16'))(_0xb92e('0x17'));var utils=require('../../config/utils');var config=require(_0xb92e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb92e('0x19'))['db'];var integrations=require(_0xb92e('0x1a'));function respondWithStatusCode(_0x48ebf1,_0x373a11){_0x373a11=_0x373a11||0xcc;return function(_0x1b889f){if(_0x1b889f){return _0x48ebf1['sendStatus'](_0x373a11);}return _0x48ebf1['status'](_0x373a11)['end']();};}function respondWithResult(_0x21db47,_0x1e93ed){_0x1e93ed=_0x1e93ed||0xc8;return function(_0x104930){if(_0x104930){return _0x21db47['status'](_0x1e93ed)[_0xb92e('0x1b')](_0x104930);}};}function respondWithFilteredResult(_0x3bb797,_0x42aa6a){return function(_0x3954d9){if(_0x3954d9){var _0x3c467e=typeof _0x42aa6a[_0xb92e('0x1c')]==='undefined'&&typeof _0x42aa6a['limit']==='undefined';var _0x44ffd9=_0x3954d9[_0xb92e('0x1d')];var _0x244ed1=_0x3c467e?0x0:_0x42aa6a[_0xb92e('0x1c')];var _0x36ea2d=_0x3c467e?_0x3954d9[_0xb92e('0x1d')]:_0x42aa6a[_0xb92e('0x1c')]+_0x42aa6a[_0xb92e('0x1e')];var _0x154bdc;if(_0x36ea2d>=_0x44ffd9){_0x36ea2d=_0x44ffd9;_0x154bdc=0xc8;}else{_0x154bdc=0xce;}_0x3bb797[_0xb92e('0x1f')](_0x154bdc);return _0x3bb797['set']('Content-Range',_0x244ed1+'-'+_0x36ea2d+'/'+_0x44ffd9)[_0xb92e('0x1b')](_0x3954d9);}return null;};}function patchUpdates(_0x4fc33b){return function(_0x13b287){try{jsonpatch['apply'](_0x13b287,_0x4fc33b,!![]);}catch(_0x11a9e2){return BPromise[_0xb92e('0x20')](_0x11a9e2);}return _0x13b287[_0xb92e('0x21')]();};}function saveUpdates(_0x37392d,_0x4e7622){return function(_0x4ae112){if(_0x4ae112){return _0x4ae112[_0xb92e('0x22')](_0x37392d)['then'](function(_0x1a21ab){return _0x1a21ab;});}return null;};}function removeEntity(_0x222214,_0x275d8a){return function(_0x3e0361){if(_0x3e0361){return _0x3e0361[_0xb92e('0x23')]()['then'](function(){_0x222214[_0xb92e('0x1f')](0xcc)[_0xb92e('0x24')]();});}};}function handleEntityNotFound(_0x23eb6a,_0xc4a6f0){return function(_0x36b30f){if(!_0x36b30f){_0x23eb6a['sendStatus'](0x194);}return _0x36b30f;};}function handleError(_0x55b82a,_0x467740){_0x467740=_0x467740||0x1f4;return function(_0x31c95d){logger['error'](_0x31c95d[_0xb92e('0x25')]);if(_0x31c95d[_0xb92e('0x26')]){delete _0x31c95d[_0xb92e('0x26')];}_0x55b82a['status'](_0x467740)[_0xb92e('0x27')](_0x31c95d);};}exports[_0xb92e('0x28')]=function(_0x5e4d64,_0x14187d){var _0x44b484={},_0xc96dc={},_0x238ed9={'count':0x0,'rows':[]};var _0x4a667f=_[_0xb92e('0x29')](db[_0xb92e('0x2a')][_0xb92e('0x2b')],function(_0x2d237d){return{'name':_0x2d237d[_0xb92e('0x2c')],'type':_0x2d237d[_0xb92e('0x2d')][_0xb92e('0x2e')]};});_0xc96dc['model']=_[_0xb92e('0x29')](_0x4a667f,_0xb92e('0x26'));_0xc96dc[_0xb92e('0x2f')]=_[_0xb92e('0x30')](_0x5e4d64[_0xb92e('0x2f')]);_0xc96dc[_0xb92e('0x31')]=_['intersection'](_0xc96dc[_0xb92e('0x32')],_0xc96dc['query']);_0x44b484[_0xb92e('0x33')]=_['intersection'](_0xc96dc[_0xb92e('0x32')],qs[_0xb92e('0x34')](_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x34')]));_0x44b484['attributes']=_0x44b484[_0xb92e('0x33')][_0xb92e('0x35')]?_0x44b484[_0xb92e('0x33')]:_0xc96dc['model'];if(!_0x5e4d64['query'][_0xb92e('0x36')](_0xb92e('0x37'))){_0x44b484[_0xb92e('0x1e')]=qs[_0xb92e('0x1e')](_0x5e4d64['query']['limit']);_0x44b484[_0xb92e('0x1c')]=qs[_0xb92e('0x1c')](_0x5e4d64[_0xb92e('0x2f')]['offset']);}_0x44b484[_0xb92e('0x38')]=qs['sort'](_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x39')]);_0x44b484[_0xb92e('0x3a')]=qs[_0xb92e('0x31')](_['pick'](_0x5e4d64[_0xb92e('0x2f')],_0xc96dc[_0xb92e('0x31')]),_0x4a667f);if(_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x3b')]){_0x44b484[_0xb92e('0x3a')]=_[_0xb92e('0x3c')](_0x44b484[_0xb92e('0x3a')],{'$or':_['map'](_0x4a667f,function(_0x24d04b){if(_0x24d04b[_0xb92e('0x2d')]!==_0xb92e('0x3d')){var _0x26cbdd={};_0x26cbdd[_0x24d04b[_0xb92e('0x26')]]={'$like':'%'+_0x5e4d64[_0xb92e('0x2f')][_0xb92e('0x3b')]+'%'};return _0x26cbdd;}})});}_0x44b484=_[_0xb92e('0x3c')]({},_0x44b484,_0x5e4d64[_0xb92e('0x3e')]);var _0x37f8bf={'where':_0x44b484[_0xb92e('0x3a')]};return db[_0xb92e('0x2a')][_0xb92e('0x1d')](_0x37f8bf)[_0xb92e('0x3f')](function(_0x10c856){_0x238ed9[_0xb92e('0x1d')]=_0x10c856;if(_0x5e4d64['query'][_0xb92e('0x40')]){_0x44b484[_0xb92e('0x41')]=[{'all':!![]}];}return db[_0xb92e('0x2a')]['findAll'](_0x44b484);})[_0xb92e('0x3f')](function(_0x3f7f3d){_0x238ed9['rows']=_0x3f7f3d;return _0x238ed9;})['then'](respondWithFilteredResult(_0x14187d,_0x44b484))[_0xb92e('0x42')](handleError(_0x14187d,null));};exports['show']=function(_0x53203c,_0x17e73a){var _0x4c1cfa={'raw':![],'where':{'id':_0x53203c[_0xb92e('0x43')]['id']}},_0x163945={};_0x163945[_0xb92e('0x32')]=_[_0xb92e('0x30')](db[_0xb92e('0x2a')][_0xb92e('0x2b')]);_0x163945['query']=_[_0xb92e('0x30')](_0x53203c[_0xb92e('0x2f')]);_0x163945['filters']=_[_0xb92e('0x44')](_0x163945['model'],_0x163945[_0xb92e('0x2f')]);_0x4c1cfa['attributes']=_[_0xb92e('0x44')](_0x163945['model'],qs[_0xb92e('0x34')](_0x53203c[_0xb92e('0x2f')][_0xb92e('0x34')]));_0x4c1cfa[_0xb92e('0x33')]=_0x4c1cfa[_0xb92e('0x33')][_0xb92e('0x35')]?_0x4c1cfa['attributes']:_0x163945[_0xb92e('0x32')];if(_0x53203c[_0xb92e('0x2f')][_0xb92e('0x40')]){_0x4c1cfa[_0xb92e('0x41')]=[{'all':!![]}];}_0x4c1cfa=_[_0xb92e('0x3c')]({},_0x4c1cfa,_0x53203c[_0xb92e('0x3e')]);return db[_0xb92e('0x2a')]['find'](_0x4c1cfa)[_0xb92e('0x3f')](handleEntityNotFound(_0x17e73a,null))['then'](respondWithResult(_0x17e73a,null))[_0xb92e('0x42')](handleError(_0x17e73a,null));};exports[_0xb92e('0x45')]=function(_0x3c58d7,_0x3c894f){return db['SalesforceAccount']['create'](_0x3c58d7['body'],{})[_0xb92e('0x3f')](respondWithResult(_0x3c894f,0xc9))[_0xb92e('0x42')](handleError(_0x3c894f,null));};exports[_0xb92e('0x22')]=function(_0x4aad08,_0x5208bb){if(_0x4aad08[_0xb92e('0x46')]['id']){delete _0x4aad08[_0xb92e('0x46')]['id'];}return db[_0xb92e('0x2a')][_0xb92e('0x47')]({'where':{'id':_0x4aad08[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x5208bb,null))[_0xb92e('0x3f')](saveUpdates(_0x4aad08['body'],null))[_0xb92e('0x3f')](respondWithResult(_0x5208bb,null))[_0xb92e('0x42')](handleError(_0x5208bb,null));};exports['destroy']=function(_0x1baea8,_0x1fc278){return db[_0xb92e('0x2a')][_0xb92e('0x47')]({'where':{'id':_0x1baea8[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x1fc278,null))[_0xb92e('0x3f')](removeEntity(_0x1fc278,null))['catch'](handleError(_0x1fc278,null));};exports[_0xb92e('0x48')]=function(_0xe8f9aa,_0x458081,_0x56438f){var _0x32f124={};var _0x35f4b6={};var _0x46d5c4;var _0x52c84d;return db[_0xb92e('0x2a')]['findOne']({'where':{'id':_0xe8f9aa[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x458081,null))['then'](function(_0x4d0645){if(_0x4d0645){_0x46d5c4=_0x4d0645;_0x35f4b6[_0xb92e('0x32')]=_['keys'](db[_0xb92e('0x49')][_0xb92e('0x2b')]);_0x35f4b6['query']=_['keys'](_0xe8f9aa[_0xb92e('0x2f')]);_0x35f4b6['filters']=_[_0xb92e('0x44')](_0x35f4b6['model'],_0x35f4b6[_0xb92e('0x2f')]);_0x32f124[_0xb92e('0x33')]=_[_0xb92e('0x44')](_0x35f4b6[_0xb92e('0x32')],qs['fields'](_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x34')]));_0x32f124[_0xb92e('0x33')]=_0x32f124[_0xb92e('0x33')][_0xb92e('0x35')]?_0x32f124['attributes']:_0x35f4b6[_0xb92e('0x32')];_0x32f124['order']=qs[_0xb92e('0x39')](_0xe8f9aa['query']['sort']);_0x32f124[_0xb92e('0x3a')]=qs[_0xb92e('0x31')](_['pick'](_0xe8f9aa[_0xb92e('0x2f')],_0x35f4b6[_0xb92e('0x31')]));if(_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x3b')]){_0x32f124[_0xb92e('0x3a')]=_[_0xb92e('0x3c')](_0x32f124['where'],{'$or':_['map'](_0x32f124[_0xb92e('0x33')],function(_0x4e7590){var _0xfced4f={};_0xfced4f[_0x4e7590]={'$like':'%'+_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x3b')]+'%'};return _0xfced4f;})});}_0x32f124=_[_0xb92e('0x3c')]({},_0x32f124,_0xe8f9aa['options']);return _0x46d5c4[_0xb92e('0x48')](_0x32f124);}})[_0xb92e('0x3f')](function(_0x3bf6ce){if(_0x3bf6ce){_0x52c84d=_0x3bf6ce['length'];if(!_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x36')]('nolimit')){_0x32f124[_0xb92e('0x1e')]=qs[_0xb92e('0x1e')](_0xe8f9aa[_0xb92e('0x2f')]['limit']);_0x32f124[_0xb92e('0x1c')]=qs[_0xb92e('0x1c')](_0xe8f9aa[_0xb92e('0x2f')][_0xb92e('0x1c')]);}return _0x46d5c4[_0xb92e('0x48')](_0x32f124);}})['then'](function(_0x9e7adc){if(_0x9e7adc){return _0x9e7adc?{'count':_0x52c84d,'rows':_0x9e7adc}:null;}})[_0xb92e('0x3f')](respondWithResult(_0x458081,null))['catch'](handleError(_0x458081,null));};exports[_0xb92e('0x4a')]=function(_0x495dad,_0x2f9c97,_0x4bdd3e){if(_0x495dad[_0xb92e('0x46')]['id']){delete _0x495dad[_0xb92e('0x46')]['id'];}return db[_0xb92e('0x2a')][_0xb92e('0x4b')]({'where':{'id':_0x495dad[_0xb92e('0x43')]['id']}})[_0xb92e('0x3f')](handleEntityNotFound(_0x2f9c97,null))['then'](function(_0x4763b2){if(_0x4763b2){_0x495dad['body'][_0xb92e('0x4c')]=_0x4763b2['id'];_0x495dad[_0xb92e('0x46')][_0xb92e('0x4d')]=integrations[_0xb92e('0x4e')](_0x495dad['body']['channel'],_0x495dad[_0xb92e('0x46')][_0xb92e('0x2d')]);_0x495dad['body'][_0xb92e('0x4f')]=integrations[_0xb92e('0x50')](_0x495dad[_0xb92e('0x46')]['channel'],_0x495dad[_0xb92e('0x46')][_0xb92e('0x2d')]);return db['SalesforceConfiguration'][_0xb92e('0x45')](_0x495dad[_0xb92e('0x46')],{'include':[{'model':db[_0xb92e('0x51')],'as':_0xb92e('0x4d')},{'model':db[_0xb92e('0x51')],'as':_0xb92e('0x4f')}]});}return null;})[_0xb92e('0x3f')](respondWithResult(_0x2f9c97,null))[_0xb92e('0x42')](handleError(_0x2f9c97,null));};exports['getFields']=function(_0xe3271b,_0x13475d,_0x2fe1a3){var _0x354814;var _0x1bd13e='';var _0x599973='Task';return db['SalesforceAccount'][_0xb92e('0x4b')]({'where':{'id':_0xe3271b[_0xb92e('0x43')]['id']},'attributes':['id',_0xb92e('0x52'),'clientId',_0xb92e('0x53'),_0xb92e('0x54'),_0xb92e('0x55'),'securityToken']})[_0xb92e('0x3f')](handleEntityNotFound(_0x13475d,null))[_0xb92e('0x3f')](function(_0x4338ff){if(_0x4338ff){_0x1bd13e=_0x4338ff[_0xb92e('0x52')];var _0x3ff28b=_0x1bd13e[_0xb92e('0x56')](-0x1);if(_0x3ff28b==='/'){_0x1bd13e=_0x1bd13e['substring'](0x0,_0x1bd13e[_0xb92e('0x57')](_0x3ff28b));}_0x354814=new jsforce[(_0xb92e('0x58'))]({'oauth2':{'loginUrl':_0x1bd13e,'clientId':_0x4338ff[_0xb92e('0x59')],'clientSecret':_0x4338ff[_0xb92e('0x53')]}});return _0x354814[_0xb92e('0x5a')](_0x4338ff[_0xb92e('0x54')],_0x4338ff[_0xb92e('0x55')][_0xb92e('0x5b')](_0x4338ff[_0xb92e('0x5c')]));}})[_0xb92e('0x3f')](function(_0x44388b){if(_0x44388b){if(!_[_0xb92e('0x5d')](_0xe3271b['query'][_0xb92e('0x5e')])){_0x599973=_0xe3271b['query']['ticketType'];}return _0x354814[_0xb92e('0x5f')](_0x599973)['describe']();}})[_0xb92e('0x3f')](function(_0xc3f38b){var _0x38dd79=['OwnerId',_0xb92e('0x60'),_0xb92e('0x61'),_0xb92e('0x62'),_0xb92e('0x63'),'Description'];var _0x27db32=[_0xb92e('0x64'),_0xb92e('0x65'),'picklist',_0xb92e('0x66'),_0xb92e('0x67'),_0xb92e('0x68'),'phone'];if(_0xc3f38b){_[_0xb92e('0x69')](_0xc3f38b[_0xb92e('0x34')],function(_0x1add60){return _0x38dd79[_0xb92e('0x6a')](_0x1add60['name'])||!_0x27db32[_0xb92e('0x6a')](_0x1add60[_0xb92e('0x2d')]);});return{'count':_0xc3f38b['fields']['length'],'rows':_[_0xb92e('0x29')](_0xc3f38b[_0xb92e('0x34')],function(_0x3103c8){return{'id':_0x3103c8[_0xb92e('0x26')],'name':_0x3103c8['label'],'custom':_0x3103c8[_0xb92e('0x6b')],'options':_0x3103c8[_0xb92e('0x6c')][_0xb92e('0x35')]>0x0?_[_0xb92e('0x29')](_0x3103c8['picklistValues'],function(_0x3abe56){return{'name':_0x3abe56['label'],'value':_0x3abe56[_0xb92e('0x6d')]};}):_0x3103c8[_0xb92e('0x2d')]==_0xb92e('0x66')?[{'name':_0xb92e('0x6e'),'value':_0xb92e('0x6f')},{'name':_0xb92e('0x70'),'value':_0xb92e('0x71')}]:[]};})};}})[_0xb92e('0x3f')](respondWithResult(_0x13475d,null))[_0xb92e('0x42')](function(_0x2c2bde){var _0xf39c88=_0xe3271b[_0xb92e('0x2f')]['test']?0x1f4:_0x2c2bde[_0xb92e('0x72')]||0x1f4;logger[_0xb92e('0x73')](_0xb92e('0x74'),_0xb92e('0x75'),_0xf39c88,JSON[_0xb92e('0x76')](_0x2c2bde));delete _0x2c2bde[_0xb92e('0x26')];if(_0xf39c88===0x191){_0xf39c88=0x190;}_0x13475d['status'](_0xf39c88)['send'](_0xe3271b[_0xb92e('0x2f')][_0xb92e('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x2c2bde[_0xb92e('0x72')]}:_0x2c2bde);});}; \ No newline at end of file +var _0x4aef=['textarea','phone','remove','includes','label','picklistValues','value','boolean','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','SalesforceAccount','rows','catch','show','include','find','create','body','destroy','params','getConfigurations','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','findOne','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','email'];(function(_0x354959,_0x1cd7a7){var _0x34ce0e=function(_0x2d6a70){while(--_0x2d6a70){_0x354959['push'](_0x354959['shift']());}};_0x34ce0e(++_0x1cd7a7);}(_0x4aef,0x8c));var _0xf4ae=function(_0x2f7109,_0x44f210){_0x2f7109=_0x2f7109-0x0;var _0x34b004=_0x4aef[_0x2f7109];return _0x34b004;};'use strict';var emlformat=require(_0xf4ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4ae('0x2'));var moment=require(_0xf4ae('0x3'));var BPromise=require(_0xf4ae('0x4'));var Mustache=require(_0xf4ae('0x5'));var util=require(_0xf4ae('0x6'));var path=require(_0xf4ae('0x7'));var sox=require(_0xf4ae('0x8'));var csv=require(_0xf4ae('0x9'));var ejs=require(_0xf4ae('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf4ae('0xb'));var crypto=require(_0xf4ae('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4ae('0x9'));var querystring=require('querystring');var Papa=require(_0xf4ae('0xd'));var Redis=require(_0xf4ae('0xe'));var authService=require(_0xf4ae('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf4ae('0x10'));var hardwareService=require(_0xf4ae('0x11'));var logger=require(_0xf4ae('0x12'))(_0xf4ae('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf4ae('0x14'));var db=require(_0xf4ae('0x15'))['db'];var integrations=require(_0xf4ae('0x16'));function respondWithStatusCode(_0x1ab683,_0x4238fd){_0x4238fd=_0x4238fd||0xcc;return function(_0x304823){if(_0x304823){return _0x1ab683[_0xf4ae('0x17')](_0x4238fd);}return _0x1ab683[_0xf4ae('0x18')](_0x4238fd)['end']();};}function respondWithResult(_0x2ba4dd,_0x44a448){_0x44a448=_0x44a448||0xc8;return function(_0x581c4d){if(_0x581c4d){return _0x2ba4dd[_0xf4ae('0x18')](_0x44a448)['json'](_0x581c4d);}};}function respondWithFilteredResult(_0x29b79d,_0x136c7e){return function(_0x408283){if(_0x408283){var _0x3bc008=typeof _0x136c7e[_0xf4ae('0x19')]===_0xf4ae('0x1a')&&typeof _0x136c7e[_0xf4ae('0x1b')]===_0xf4ae('0x1a');var _0xb238bb=_0x408283['count'];var _0x49f036=_0x3bc008?0x0:_0x136c7e['offset'];var _0x2e1b11=_0x3bc008?_0x408283[_0xf4ae('0x1c')]:_0x136c7e['offset']+_0x136c7e[_0xf4ae('0x1b')];var _0x417857;if(_0x2e1b11>=_0xb238bb){_0x2e1b11=_0xb238bb;_0x417857=0xc8;}else{_0x417857=0xce;}_0x29b79d[_0xf4ae('0x18')](_0x417857);return _0x29b79d[_0xf4ae('0x1d')]('Content-Range',_0x49f036+'-'+_0x2e1b11+'/'+_0xb238bb)['json'](_0x408283);}return null;};}function patchUpdates(_0x330b58){return function(_0x44011d){try{jsonpatch['apply'](_0x44011d,_0x330b58,!![]);}catch(_0x4b4e20){return BPromise[_0xf4ae('0x1e')](_0x4b4e20);}return _0x44011d[_0xf4ae('0x1f')]();};}function saveUpdates(_0x16ba4c,_0x20e3cd){return function(_0x133d3e){if(_0x133d3e){return _0x133d3e[_0xf4ae('0x20')](_0x16ba4c)[_0xf4ae('0x21')](function(_0x57a09d){return _0x57a09d;});}return null;};}function removeEntity(_0x364753,_0x4eab32){return function(_0x283f9c){if(_0x283f9c){return _0x283f9c['destroy']()[_0xf4ae('0x21')](function(){_0x364753[_0xf4ae('0x18')](0xcc)[_0xf4ae('0x22')]();});}};}function handleEntityNotFound(_0x1e4ce8,_0x69ba7d){return function(_0x4064c0){if(!_0x4064c0){_0x1e4ce8[_0xf4ae('0x17')](0x194);}return _0x4064c0;};}function handleError(_0x55d9f3,_0x5133a6){_0x5133a6=_0x5133a6||0x1f4;return function(_0x352f1a){logger[_0xf4ae('0x23')](_0x352f1a[_0xf4ae('0x24')]);if(_0x352f1a[_0xf4ae('0x25')]){delete _0x352f1a[_0xf4ae('0x25')];}_0x55d9f3[_0xf4ae('0x18')](_0x5133a6)[_0xf4ae('0x26')](_0x352f1a);};}exports[_0xf4ae('0x27')]=function(_0x5b20b5,_0x557069){var _0x1771ae={},_0x59bde6={},_0x5ba241={'count':0x0,'rows':[]};var _0xa430c0=_[_0xf4ae('0x28')](db['SalesforceAccount'][_0xf4ae('0x29')],function(_0x2dc9bb){return{'name':_0x2dc9bb[_0xf4ae('0x2a')],'type':_0x2dc9bb[_0xf4ae('0x2b')][_0xf4ae('0x2c')]};});_0x59bde6[_0xf4ae('0x2d')]=_[_0xf4ae('0x28')](_0xa430c0,_0xf4ae('0x25'));_0x59bde6[_0xf4ae('0x2e')]=_[_0xf4ae('0x2f')](_0x5b20b5[_0xf4ae('0x2e')]);_0x59bde6[_0xf4ae('0x30')]=_[_0xf4ae('0x31')](_0x59bde6[_0xf4ae('0x2d')],_0x59bde6[_0xf4ae('0x2e')]);_0x1771ae[_0xf4ae('0x32')]=_['intersection'](_0x59bde6['model'],qs[_0xf4ae('0x33')](_0x5b20b5[_0xf4ae('0x2e')]['fields']));_0x1771ae[_0xf4ae('0x32')]=_0x1771ae[_0xf4ae('0x32')][_0xf4ae('0x34')]?_0x1771ae[_0xf4ae('0x32')]:_0x59bde6[_0xf4ae('0x2d')];if(!_0x5b20b5[_0xf4ae('0x2e')][_0xf4ae('0x35')]('nolimit')){_0x1771ae['limit']=qs[_0xf4ae('0x1b')](_0x5b20b5[_0xf4ae('0x2e')][_0xf4ae('0x1b')]);_0x1771ae[_0xf4ae('0x19')]=qs[_0xf4ae('0x19')](_0x5b20b5['query'][_0xf4ae('0x19')]);}_0x1771ae[_0xf4ae('0x36')]=qs[_0xf4ae('0x37')](_0x5b20b5[_0xf4ae('0x2e')]['sort']);_0x1771ae[_0xf4ae('0x38')]=qs[_0xf4ae('0x30')](_[_0xf4ae('0x39')](_0x5b20b5[_0xf4ae('0x2e')],_0x59bde6[_0xf4ae('0x30')]),_0xa430c0);if(_0x5b20b5[_0xf4ae('0x2e')]['filter']){_0x1771ae[_0xf4ae('0x38')]=_[_0xf4ae('0x3a')](_0x1771ae[_0xf4ae('0x38')],{'$or':_[_0xf4ae('0x28')](_0xa430c0,function(_0x1f0a37){if(_0x1f0a37[_0xf4ae('0x2b')]!==_0xf4ae('0x3b')){var _0x4ab771={};_0x4ab771[_0x1f0a37[_0xf4ae('0x25')]]={'$like':'%'+_0x5b20b5[_0xf4ae('0x2e')][_0xf4ae('0x3c')]+'%'};return _0x4ab771;}})});}_0x1771ae=_['merge']({},_0x1771ae,_0x5b20b5[_0xf4ae('0x3d')]);var _0x5a8624={'where':_0x1771ae[_0xf4ae('0x38')]};return db['SalesforceAccount'][_0xf4ae('0x1c')](_0x5a8624)['then'](function(_0x15f68a){_0x5ba241[_0xf4ae('0x1c')]=_0x15f68a;if(_0x5b20b5[_0xf4ae('0x2e')][_0xf4ae('0x3e')]){_0x1771ae['include']=[{'all':!![]}];}return db[_0xf4ae('0x3f')]['findAll'](_0x1771ae);})[_0xf4ae('0x21')](function(_0x21a7e5){_0x5ba241[_0xf4ae('0x40')]=_0x21a7e5;return _0x5ba241;})[_0xf4ae('0x21')](respondWithFilteredResult(_0x557069,_0x1771ae))[_0xf4ae('0x41')](handleError(_0x557069,null));};exports[_0xf4ae('0x42')]=function(_0x374fa5,_0x4ac5b1){var _0x441af8={'raw':![],'where':{'id':_0x374fa5['params']['id']}},_0x5a6770={};_0x5a6770[_0xf4ae('0x2d')]=_['keys'](db['SalesforceAccount'][_0xf4ae('0x29')]);_0x5a6770[_0xf4ae('0x2e')]=_[_0xf4ae('0x2f')](_0x374fa5[_0xf4ae('0x2e')]);_0x5a6770[_0xf4ae('0x30')]=_['intersection'](_0x5a6770[_0xf4ae('0x2d')],_0x5a6770[_0xf4ae('0x2e')]);_0x441af8['attributes']=_[_0xf4ae('0x31')](_0x5a6770[_0xf4ae('0x2d')],qs[_0xf4ae('0x33')](_0x374fa5[_0xf4ae('0x2e')]['fields']));_0x441af8[_0xf4ae('0x32')]=_0x441af8[_0xf4ae('0x32')][_0xf4ae('0x34')]?_0x441af8[_0xf4ae('0x32')]:_0x5a6770['model'];if(_0x374fa5[_0xf4ae('0x2e')]['includeAll']){_0x441af8[_0xf4ae('0x43')]=[{'all':!![]}];}_0x441af8=_[_0xf4ae('0x3a')]({},_0x441af8,_0x374fa5['options']);return db[_0xf4ae('0x3f')][_0xf4ae('0x44')](_0x441af8)['then'](handleEntityNotFound(_0x4ac5b1,null))['then'](respondWithResult(_0x4ac5b1,null))[_0xf4ae('0x41')](handleError(_0x4ac5b1,null));};exports[_0xf4ae('0x45')]=function(_0x2fd282,_0x36c6a3){return db[_0xf4ae('0x3f')][_0xf4ae('0x45')](_0x2fd282['body'],{})['then'](respondWithResult(_0x36c6a3,0xc9))[_0xf4ae('0x41')](handleError(_0x36c6a3,null));};exports['update']=function(_0x57afc0,_0x2cfde7){if(_0x57afc0[_0xf4ae('0x46')]['id']){delete _0x57afc0[_0xf4ae('0x46')]['id'];}return db['SalesforceAccount'][_0xf4ae('0x44')]({'where':{'id':_0x57afc0['params']['id']}})['then'](handleEntityNotFound(_0x2cfde7,null))[_0xf4ae('0x21')](saveUpdates(_0x57afc0[_0xf4ae('0x46')],null))['then'](respondWithResult(_0x2cfde7,null))[_0xf4ae('0x41')](handleError(_0x2cfde7,null));};exports[_0xf4ae('0x47')]=function(_0x3fa10c,_0x3ecb3b){return db[_0xf4ae('0x3f')][_0xf4ae('0x44')]({'where':{'id':_0x3fa10c[_0xf4ae('0x48')]['id']}})[_0xf4ae('0x21')](handleEntityNotFound(_0x3ecb3b,null))[_0xf4ae('0x21')](removeEntity(_0x3ecb3b,null))[_0xf4ae('0x41')](handleError(_0x3ecb3b,null));};exports[_0xf4ae('0x49')]=function(_0x35f71e,_0x82c295,_0x4c5d7c){var _0x2d16c6={};var _0xd2b14f={};var _0x1d2980;var _0x344196;return db[_0xf4ae('0x3f')]['findOne']({'where':{'id':_0x35f71e[_0xf4ae('0x48')]['id']}})['then'](handleEntityNotFound(_0x82c295,null))[_0xf4ae('0x21')](function(_0x3c08cf){if(_0x3c08cf){_0x1d2980=_0x3c08cf;_0xd2b14f[_0xf4ae('0x2d')]=_[_0xf4ae('0x2f')](db[_0xf4ae('0x4a')][_0xf4ae('0x29')]);_0xd2b14f[_0xf4ae('0x2e')]=_['keys'](_0x35f71e['query']);_0xd2b14f['filters']=_[_0xf4ae('0x31')](_0xd2b14f[_0xf4ae('0x2d')],_0xd2b14f[_0xf4ae('0x2e')]);_0x2d16c6[_0xf4ae('0x32')]=_[_0xf4ae('0x31')](_0xd2b14f[_0xf4ae('0x2d')],qs[_0xf4ae('0x33')](_0x35f71e['query'][_0xf4ae('0x33')]));_0x2d16c6['attributes']=_0x2d16c6[_0xf4ae('0x32')][_0xf4ae('0x34')]?_0x2d16c6[_0xf4ae('0x32')]:_0xd2b14f['model'];_0x2d16c6[_0xf4ae('0x36')]=qs[_0xf4ae('0x37')](_0x35f71e[_0xf4ae('0x2e')][_0xf4ae('0x37')]);_0x2d16c6[_0xf4ae('0x38')]=qs[_0xf4ae('0x30')](_['pick'](_0x35f71e['query'],_0xd2b14f['filters']));if(_0x35f71e[_0xf4ae('0x2e')][_0xf4ae('0x3c')]){_0x2d16c6[_0xf4ae('0x38')]=_[_0xf4ae('0x3a')](_0x2d16c6['where'],{'$or':_[_0xf4ae('0x28')](_0x2d16c6['attributes'],function(_0x280d5b){var _0x28598f={};_0x28598f[_0x280d5b]={'$like':'%'+_0x35f71e[_0xf4ae('0x2e')][_0xf4ae('0x3c')]+'%'};return _0x28598f;})});}_0x2d16c6=_[_0xf4ae('0x3a')]({},_0x2d16c6,_0x35f71e[_0xf4ae('0x3d')]);return _0x1d2980[_0xf4ae('0x49')](_0x2d16c6);}})[_0xf4ae('0x21')](function(_0x28ca54){if(_0x28ca54){_0x344196=_0x28ca54['length'];if(!_0x35f71e[_0xf4ae('0x2e')][_0xf4ae('0x35')](_0xf4ae('0x4b'))){_0x2d16c6['limit']=qs[_0xf4ae('0x1b')](_0x35f71e[_0xf4ae('0x2e')]['limit']);_0x2d16c6[_0xf4ae('0x19')]=qs[_0xf4ae('0x19')](_0x35f71e['query'][_0xf4ae('0x19')]);}return _0x1d2980['getConfigurations'](_0x2d16c6);}})[_0xf4ae('0x21')](function(_0x23e2c9){if(_0x23e2c9){return _0x23e2c9?{'count':_0x344196,'rows':_0x23e2c9}:null;}})[_0xf4ae('0x21')](respondWithResult(_0x82c295,null))['catch'](handleError(_0x82c295,null));};exports[_0xf4ae('0x4c')]=function(_0x40a4ab,_0x55193d,_0x288978){if(_0x40a4ab[_0xf4ae('0x46')]['id']){delete _0x40a4ab[_0xf4ae('0x46')]['id'];}return db[_0xf4ae('0x3f')]['findOne']({'where':{'id':_0x40a4ab[_0xf4ae('0x48')]['id']}})[_0xf4ae('0x21')](handleEntityNotFound(_0x55193d,null))[_0xf4ae('0x21')](function(_0x3f7b6b){if(_0x3f7b6b){_0x40a4ab[_0xf4ae('0x46')][_0xf4ae('0x4d')]=_0x3f7b6b['id'];_0x40a4ab[_0xf4ae('0x46')][_0xf4ae('0x4e')]=integrations[_0xf4ae('0x4f')](_0x40a4ab['body'][_0xf4ae('0x50')],_0x40a4ab[_0xf4ae('0x46')][_0xf4ae('0x2b')]);_0x40a4ab[_0xf4ae('0x46')][_0xf4ae('0x51')]=integrations['getDescriptions'](_0x40a4ab[_0xf4ae('0x46')][_0xf4ae('0x50')],_0x40a4ab['body']['type']);return db[_0xf4ae('0x4a')][_0xf4ae('0x45')](_0x40a4ab[_0xf4ae('0x46')],{'include':[{'model':db[_0xf4ae('0x52')],'as':_0xf4ae('0x4e')},{'model':db[_0xf4ae('0x52')],'as':_0xf4ae('0x51')}]});}return null;})[_0xf4ae('0x21')](respondWithResult(_0x55193d,null))[_0xf4ae('0x41')](handleError(_0x55193d,null));};exports[_0xf4ae('0x53')]=function(_0x46db53,_0x31c2ae,_0x3ccf19){var _0x9f11c;var _0x3f80e5='';var _0x166264=_0xf4ae('0x54');return db[_0xf4ae('0x3f')][_0xf4ae('0x55')]({'where':{'id':_0x46db53[_0xf4ae('0x48')]['id']},'attributes':['id',_0xf4ae('0x56'),_0xf4ae('0x57'),_0xf4ae('0x58'),_0xf4ae('0x59'),_0xf4ae('0x5a'),_0xf4ae('0x5b')]})[_0xf4ae('0x21')](handleEntityNotFound(_0x31c2ae,null))[_0xf4ae('0x21')](function(_0x2f4418){if(_0x2f4418){_0x3f80e5=_0x2f4418['remoteUri'];var _0x46584a=_0x3f80e5[_0xf4ae('0x5c')](-0x1);if(_0x46584a==='/'){_0x3f80e5=_0x3f80e5[_0xf4ae('0x5d')](0x0,_0x3f80e5['lastIndexOf'](_0x46584a));}_0x9f11c=new jsforce[(_0xf4ae('0x5e'))]({'oauth2':{'loginUrl':_0x3f80e5,'clientId':_0x2f4418['clientId'],'clientSecret':_0x2f4418[_0xf4ae('0x58')]}});return _0x9f11c[_0xf4ae('0x5f')](_0x2f4418['username'],_0x2f4418[_0xf4ae('0x5a')][_0xf4ae('0x60')](_0x2f4418[_0xf4ae('0x5b')]));}})[_0xf4ae('0x21')](function(_0x5d56b4){if(_0x5d56b4){if(!_[_0xf4ae('0x61')](_0x46db53[_0xf4ae('0x2e')][_0xf4ae('0x62')])){_0x166264=_0x46db53['query'][_0xf4ae('0x62')];}return _0x9f11c[_0xf4ae('0x63')](_0x166264)['describe']();}})[_0xf4ae('0x21')](function(_0xf3dc02){var _0x58afae=[_0xf4ae('0x64'),_0xf4ae('0x65'),_0xf4ae('0x66'),'IsRecurrence',_0xf4ae('0x67'),_0xf4ae('0x68')];var _0x53d0b7=['string',_0xf4ae('0x69'),_0xf4ae('0x6a'),'boolean',_0xf4ae('0x6b'),_0xf4ae('0x6c'),_0xf4ae('0x6d')];if(_0xf3dc02){_[_0xf4ae('0x6e')](_0xf3dc02[_0xf4ae('0x33')],function(_0x3f270e){return _0x58afae[_0xf4ae('0x6f')](_0x3f270e[_0xf4ae('0x25')])||!_0x53d0b7[_0xf4ae('0x6f')](_0x3f270e['type']);});return{'count':_0xf3dc02[_0xf4ae('0x33')][_0xf4ae('0x34')],'rows':_[_0xf4ae('0x28')](_0xf3dc02[_0xf4ae('0x33')],function(_0x583869){return{'id':_0x583869[_0xf4ae('0x25')],'name':_0x583869[_0xf4ae('0x70')],'custom':_0x583869['custom'],'options':_0x583869['picklistValues'][_0xf4ae('0x34')]>0x0?_['map'](_0x583869[_0xf4ae('0x71')],function(_0x399c68){return{'name':_0x399c68[_0xf4ae('0x70')],'value':_0x399c68[_0xf4ae('0x72')]};}):_0x583869[_0xf4ae('0x2b')]==_0xf4ae('0x73')?[{'name':_0xf4ae('0x74'),'value':'true'},{'name':_0xf4ae('0x75'),'value':_0xf4ae('0x76')}]:[]};})};}})[_0xf4ae('0x21')](respondWithResult(_0x31c2ae,null))[_0xf4ae('0x41')](function(_0x171ceb){var _0x1ebe0a=_0x46db53[_0xf4ae('0x2e')][_0xf4ae('0x77')]?0x1f4:_0x171ceb[_0xf4ae('0x78')]||0x1f4;logger[_0xf4ae('0x23')](_0xf4ae('0x79'),'getFields',_0x1ebe0a,JSON[_0xf4ae('0x7a')](_0x171ceb));delete _0x171ceb['name'];if(_0x1ebe0a===0x191){_0x1ebe0a=0x190;}_0x31c2ae['status'](_0x1ebe0a)[_0xf4ae('0x26')](_0x46db53[_0xf4ae('0x2e')][_0xf4ae('0x77')]?{'message':_0xf4ae('0x7b'),'statusCode':_0x171ceb[_0xf4ae('0x78')]}:_0x171ceb);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index cec482a..4442486 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 _0xe85c=['SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x3da35e,_0x3680bc){var _0x5d3417=function(_0x38b149){while(--_0x38b149){_0x3da35e['push'](_0x3da35e['shift']());}};_0x5d3417(++_0x3680bc);}(_0xe85c,0x1a6));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var util=require('util');var logger=require(_0xce85('0x1'))(_0xce85('0x2'));var moment=require(_0xce85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce85('0x4'));var rimraf=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5ea8d4,_0x3fe62f){return _0x5ea8d4[_0xce85('0x7')](_0xce85('0x8'),attributes,{'tableName':_0xce85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6597=['moment','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6597,0x16e));var _0x7659=function(_0x108c22,_0xb983d5){_0x108c22=_0x108c22-0x0;var _0x5ee2f6=_0x6597[_0x108c22];return _0x5ee2f6;};'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'));var integrations=require(_0x7659('0x6'));module[_0x7659('0x7')]=function(_0xb90fa2,_0x11cb28){return _0xb90fa2['define']('SalesforceAccount',attributes,{'tableName':_0x7659('0x8'),'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 f1696f0..5cfb181 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 _0xc91e=['result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSalesforceAccount','debug','ShowSalesforceAccount','find','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info'];(function(_0x426de2,_0x24acaf){var _0x1dbafc=function(_0x57e5d4){while(--_0x57e5d4){_0x426de2['push'](_0x426de2['shift']());}};_0x1dbafc(++_0x24acaf);}(_0xc91e,0xdc));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec91('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec91('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec91('0x2'))(_0xec91('0x3'));var config=require(_0xec91('0x4'));var jayson=require(_0xec91('0x5'));var client=jayson[_0xec91('0x6')][_0xec91('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3252b7,_0x67d76f,_0x184169){return new BPromise(function(_0x5399cd,_0x290973){return client[_0xec91('0x8')](_0x3252b7,_0x184169)[_0xec91('0x9')](function(_0x37e40d){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x67d76f,_0xec91('0xa'));logger['debug'](_0xec91('0xb'),_0x67d76f,_0xec91('0xa'),JSON[_0xec91('0xc')](_0x37e40d));if(_0x37e40d[_0xec91('0xd')]){if(_0x37e40d[_0xec91('0xd')][_0xec91('0xe')]===0x1f4){logger[_0xec91('0xd')](_0xec91('0xf'),_0x67d76f,_0x37e40d[_0xec91('0xd')][_0xec91('0x10')]);return _0x290973(_0x37e40d['error'][_0xec91('0x10')]);}logger['error'](_0xec91('0xf'),_0x67d76f,_0x37e40d[_0xec91('0xd')][_0xec91('0x10')]);return _0x5399cd(_0x37e40d[_0xec91('0xd')][_0xec91('0x10')]);}else{logger[_0xec91('0x11')](_0xec91('0xf'),_0x67d76f,_0xec91('0xa'));_0x5399cd(_0x37e40d[_0xec91('0x12')]['message']);}})[_0xec91('0x13')](function(_0x198641){logger[_0xec91('0xd')](_0xec91('0xf'),_0x67d76f,_0x198641);_0x290973(_0x198641);});});}exports['GetSalesforceAccount']=function(_0x1402a4){var _0x47c219=this;return new Promise(function(_0x159ff3,_0x22a1ba){return db[_0xec91('0x14')][_0xec91('0x15')]({'raw':_0x1402a4[_0xec91('0x16')]?_0x1402a4[_0xec91('0x16')][_0xec91('0x17')]===undefined?!![]:![]:!![],'where':_0x1402a4[_0xec91('0x16')]?_0x1402a4[_0xec91('0x16')][_0xec91('0x18')]||null:null,'attributes':_0x1402a4[_0xec91('0x16')]?_0x1402a4['options'][_0xec91('0x19')]||null:null,'limit':_0x1402a4[_0xec91('0x16')]?_0x1402a4[_0xec91('0x16')][_0xec91('0x1a')]||null:null,'include':_0x1402a4[_0xec91('0x16')]?_0x1402a4['options'][_0xec91('0x1b')]?_['map'](_0x1402a4[_0xec91('0x16')][_0xec91('0x1b')],function(_0x2b7eac){return{'model':db[_0x2b7eac[_0xec91('0x1c')]],'as':_0x2b7eac['as'],'attributes':_0x2b7eac['attributes'],'include':_0x2b7eac['include']?_[_0xec91('0x1d')](_0x2b7eac[_0xec91('0x1b')],function(_0x43794c){return{'model':db[_0x43794c[_0xec91('0x1c')]],'as':_0x43794c['as'],'attributes':_0x43794c[_0xec91('0x19')],'include':_0x43794c[_0xec91('0x1b')]?_[_0xec91('0x1d')](_0x43794c[_0xec91('0x1b')],function(_0x55f477){return{'model':db[_0x55f477['model']],'as':_0x55f477['as'],'attributes':_0x55f477['attributes']};}):[]};}):[]};}):[]:[]})[_0xec91('0x9')](function(_0x4757f9){logger['info'](_0xec91('0x1e'),_0x1402a4);logger[_0xec91('0x1f')]('GetSalesforceAccount',_0x1402a4,JSON['stringify'](_0x4757f9));_0x159ff3(_0x4757f9);})[_0xec91('0x13')](function(_0x5a0c39){logger[_0xec91('0xd')](_0xec91('0x1e'),_0x5a0c39[_0xec91('0x10')],_0x1402a4);_0x22a1ba(_0x47c219[_0xec91('0xd')](0x1f4,_0x5a0c39[_0xec91('0x10')]));});});};exports[_0xec91('0x20')]=function(_0x2d564d){var _0xb3b04d=this;return new Promise(function(_0x184144,_0x2d9e9a){return db[_0xec91('0x14')][_0xec91('0x21')]({'raw':_0x2d564d['options']?_0x2d564d[_0xec91('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2d564d['options']?_0x2d564d[_0xec91('0x16')][_0xec91('0x18')]||null:null,'attributes':_0x2d564d[_0xec91('0x16')]?_0x2d564d['options'][_0xec91('0x19')]||null:null,'include':_0x2d564d[_0xec91('0x16')]?_0x2d564d[_0xec91('0x16')]['include']?_[_0xec91('0x1d')](_0x2d564d[_0xec91('0x16')]['include'],function(_0x3bd849){return{'model':db[_0x3bd849['model']],'as':_0x3bd849['as'],'attributes':_0x3bd849[_0xec91('0x19')],'include':_0x3bd849[_0xec91('0x1b')]?_['map'](_0x3bd849[_0xec91('0x1b')],function(_0x52ca6f){return{'model':db[_0x52ca6f[_0xec91('0x1c')]],'as':_0x52ca6f['as'],'attributes':_0x52ca6f[_0xec91('0x19')],'include':_0x52ca6f[_0xec91('0x1b')]?_[_0xec91('0x1d')](_0x52ca6f[_0xec91('0x1b')],function(_0x1f69ea){return{'model':db[_0x1f69ea[_0xec91('0x1c')]],'as':_0x1f69ea['as'],'attributes':_0x1f69ea[_0xec91('0x19')]};}):[]};}):[]};}):[]:[]})[_0xec91('0x9')](function(_0x2c1e52){logger[_0xec91('0x11')](_0xec91('0x20'),_0x2d564d);logger[_0xec91('0x1f')](_0xec91('0x20'),_0x2d564d,JSON[_0xec91('0xc')](_0x2c1e52));_0x184144(_0x2c1e52);})[_0xec91('0x13')](function(_0x40da4c){logger[_0xec91('0xd')](_0xec91('0x20'),_0x40da4c[_0xec91('0x10')],_0x2d564d);_0x2d9e9a(_0xb3b04d[_0xec91('0xd')](0x1f4,_0x40da4c[_0xec91('0x10')]));});});}; \ No newline at end of file +var _0xf7f4=['raw','where','attributes','include','map','model','stringify','ShowSalesforceAccount','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7f4,0x68));var _0x4f7f=function(_0x36cab1,_0x20b215){_0x36cab1=_0x36cab1-0x0;var _0x3bb91=_0xf7f4[_0x36cab1];return _0x3bb91;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7f('0x0'));var rs=require(_0x4f7f('0x1'));var fs=require('fs');var Redis=require(_0x4f7f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f7f('0x3'));var logger=require('../../config/logger')(_0x4f7f('0x4'));var config=require(_0x4f7f('0x5'));var jayson=require(_0x4f7f('0x6'));var client=jayson[_0x4f7f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459f3d,_0x3a3fd2,_0x58bc57){return new BPromise(function(_0x177923,_0x24ba8d){return client[_0x4f7f('0x8')](_0x459f3d,_0x58bc57)[_0x4f7f('0x9')](function(_0x452366){logger['info'](_0x4f7f('0xa'),_0x3a3fd2,_0x4f7f('0xb'));logger[_0x4f7f('0xc')](_0x4f7f('0xd'),_0x3a3fd2,_0x4f7f('0xb'),JSON['stringify'](_0x452366));if(_0x452366[_0x4f7f('0xe')]){if(_0x452366['error'][_0x4f7f('0xf')]===0x1f4){logger['error'](_0x4f7f('0xa'),_0x3a3fd2,_0x452366[_0x4f7f('0xe')][_0x4f7f('0x10')]);return _0x24ba8d(_0x452366[_0x4f7f('0xe')][_0x4f7f('0x10')]);}logger['error'](_0x4f7f('0xa'),_0x3a3fd2,_0x452366[_0x4f7f('0xe')]['message']);return _0x177923(_0x452366['error'][_0x4f7f('0x10')]);}else{logger[_0x4f7f('0x11')](_0x4f7f('0xa'),_0x3a3fd2,_0x4f7f('0xb'));_0x177923(_0x452366[_0x4f7f('0x12')][_0x4f7f('0x10')]);}})[_0x4f7f('0x13')](function(_0x1fa79f){logger['error'](_0x4f7f('0xa'),_0x3a3fd2,_0x1fa79f);_0x24ba8d(_0x1fa79f);});});}exports[_0x4f7f('0x14')]=function(_0x5646d5){var _0x31633d=this;return new Promise(function(_0x2c3049,_0x5cb9a7){return db[_0x4f7f('0x15')][_0x4f7f('0x16')]({'raw':_0x5646d5[_0x4f7f('0x17')]?_0x5646d5[_0x4f7f('0x17')][_0x4f7f('0x18')]===undefined?!![]:![]:!![],'where':_0x5646d5['options']?_0x5646d5[_0x4f7f('0x17')][_0x4f7f('0x19')]||null:null,'attributes':_0x5646d5[_0x4f7f('0x17')]?_0x5646d5[_0x4f7f('0x17')][_0x4f7f('0x1a')]||null:null,'limit':_0x5646d5[_0x4f7f('0x17')]?_0x5646d5[_0x4f7f('0x17')]['limit']||null:null,'include':_0x5646d5[_0x4f7f('0x17')]?_0x5646d5[_0x4f7f('0x17')][_0x4f7f('0x1b')]?_[_0x4f7f('0x1c')](_0x5646d5[_0x4f7f('0x17')][_0x4f7f('0x1b')],function(_0x567227){return{'model':db[_0x567227[_0x4f7f('0x1d')]],'as':_0x567227['as'],'attributes':_0x567227[_0x4f7f('0x1a')],'include':_0x567227[_0x4f7f('0x1b')]?_[_0x4f7f('0x1c')](_0x567227[_0x4f7f('0x1b')],function(_0x3b71c0){return{'model':db[_0x3b71c0[_0x4f7f('0x1d')]],'as':_0x3b71c0['as'],'attributes':_0x3b71c0[_0x4f7f('0x1a')],'include':_0x3b71c0[_0x4f7f('0x1b')]?_['map'](_0x3b71c0[_0x4f7f('0x1b')],function(_0x3d8d28){return{'model':db[_0x3d8d28[_0x4f7f('0x1d')]],'as':_0x3d8d28['as'],'attributes':_0x3d8d28[_0x4f7f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bef7b){logger['info'](_0x4f7f('0x14'),_0x5646d5);logger[_0x4f7f('0xc')](_0x4f7f('0x14'),_0x5646d5,JSON[_0x4f7f('0x1e')](_0x3bef7b));_0x2c3049(_0x3bef7b);})[_0x4f7f('0x13')](function(_0x5023b3){logger[_0x4f7f('0xe')]('GetSalesforceAccount',_0x5023b3['message'],_0x5646d5);_0x5cb9a7(_0x31633d['error'](0x1f4,_0x5023b3['message']));});});};exports['ShowSalesforceAccount']=function(_0x349d94){var _0x4bf258=this;return new Promise(function(_0xc0f392,_0xd22212){return db[_0x4f7f('0x15')]['find']({'raw':_0x349d94[_0x4f7f('0x17')]?_0x349d94[_0x4f7f('0x17')][_0x4f7f('0x18')]===undefined?!![]:![]:!![],'where':_0x349d94[_0x4f7f('0x17')]?_0x349d94[_0x4f7f('0x17')][_0x4f7f('0x19')]||null:null,'attributes':_0x349d94[_0x4f7f('0x17')]?_0x349d94[_0x4f7f('0x17')][_0x4f7f('0x1a')]||null:null,'include':_0x349d94[_0x4f7f('0x17')]?_0x349d94[_0x4f7f('0x17')][_0x4f7f('0x1b')]?_[_0x4f7f('0x1c')](_0x349d94[_0x4f7f('0x17')][_0x4f7f('0x1b')],function(_0xed900){return{'model':db[_0xed900[_0x4f7f('0x1d')]],'as':_0xed900['as'],'attributes':_0xed900['attributes'],'include':_0xed900[_0x4f7f('0x1b')]?_[_0x4f7f('0x1c')](_0xed900[_0x4f7f('0x1b')],function(_0x296124){return{'model':db[_0x296124['model']],'as':_0x296124['as'],'attributes':_0x296124[_0x4f7f('0x1a')],'include':_0x296124['include']?_[_0x4f7f('0x1c')](_0x296124['include'],function(_0x58d1e8){return{'model':db[_0x58d1e8[_0x4f7f('0x1d')]],'as':_0x58d1e8['as'],'attributes':_0x58d1e8[_0x4f7f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7f('0x9')](function(_0x4f7171){logger[_0x4f7f('0x11')](_0x4f7f('0x1f'),_0x349d94);logger[_0x4f7f('0xc')](_0x4f7f('0x1f'),_0x349d94,JSON[_0x4f7f('0x1e')](_0x4f7171));_0xc0f392(_0x4f7171);})[_0x4f7f('0x13')](function(_0x25698a){logger[_0x4f7f('0xe')](_0x4f7f('0x1f'),_0x25698a[_0x4f7f('0x10')],_0x349d94);_0xd22212(_0x4bf258[_0x4f7f('0xe')](0x1f4,_0x25698a[_0x4f7f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 36dc154..1bb4a12 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x0b0e[_0x5575cd];return _0x4979a0;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xdb28,0x106));var _0x8db2=function(_0x3df756,_0x1f14ac){_0x3df756=_0x3df756-0x0;var _0x324c3f=_0xdb28[_0x3df756];return _0x324c3f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 30588ee..95af88f 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 _0x95cc=['account_contact_lead','account','nothing','sequelize','exports','STRING','Task','ENUM','contact_lead','contact','lead'];(function(_0x231238,_0x5117a6){var _0x3d15fe=function(_0x7e0cb4){while(--_0x7e0cb4){_0x231238['push'](_0x231238['shift']());}};_0x3d15fe(++_0x5117a6);}(_0x95cc,0x19a));var _0xc95c=function(_0x3faa69,_0x3706c8){_0x3faa69=_0x3faa69-0x0;var _0x2b83a4=_0x95cc[_0x3faa69];return _0x2b83a4;};'use strict';var Sequelize=require(_0xc95c('0x0'));module[_0xc95c('0x1')]={'name':{'type':Sequelize[_0xc95c('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xc95c('0x3'),'Case'),'defaultValue':_0xc95c('0x3')},'moduleSearch':{'type':Sequelize[_0xc95c('0x4')](_0xc95c('0x5'),_0xc95c('0x6'),_0xc95c('0x7'),_0xc95c('0x8'),_0xc95c('0x9')),'defaultValue':_0xc95c('0x5')},'moduleCreate':{'type':Sequelize[_0xc95c('0x4')](_0xc95c('0xa'),_0xc95c('0x6'),'lead',_0xc95c('0x9')),'defaultValue':_0xc95c('0x7')},'leadId':{'type':Sequelize[_0xc95c('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc95c('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc95c('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc95c('0x2')]}}; \ No newline at end of file +var _0xd2f0=['exports','STRING','ENUM','Case','Task','contact','lead','account','contact_lead','nothing','sequelize'];(function(_0x1f2701,_0x49718b){var _0x27a2e4=function(_0x552da5){while(--_0x552da5){_0x1f2701['push'](_0x1f2701['shift']());}};_0x27a2e4(++_0x49718b);}(_0xd2f0,0x18b));var _0x0d2f=function(_0x4b936b,_0x1ae154){_0x4b936b=_0x4b936b-0x0;var _0x2d7fe2=_0xd2f0[_0x4b936b];return _0x2d7fe2;};'use strict';var Sequelize=require(_0x0d2f('0x0'));module[_0x0d2f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d2f('0x2')]},'ticketType':{'type':Sequelize[_0x0d2f('0x3')]('Task',_0x0d2f('0x4')),'defaultValue':_0x0d2f('0x5')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x0d2f('0x6'),_0x0d2f('0x7'),'account_contact_lead',_0x0d2f('0x8')),'defaultValue':_0x0d2f('0x9')},'moduleCreate':{'type':Sequelize[_0x0d2f('0x3')](_0x0d2f('0xa'),_0x0d2f('0x6'),_0x0d2f('0x7'),_0x0d2f('0x8')),'defaultValue':_0x0d2f('0x7')},'leadId':{'type':Sequelize[_0x0d2f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x0d2f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x0d2f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x0d2f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 290b70f..1ec6e07 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 _0x9d9d=['sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','params','length','options','find','create','body','catch','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x115638,_0x561aae){var _0x2d0dc8=function(_0x402be4){while(--_0x402be4){_0x115638['push'](_0x115638['shift']());}};_0x2d0dc8(++_0x561aae);}(_0x9d9d,0x129));var _0xd9d9=function(_0x25e931,_0x3ae075){_0x25e931=_0x25e931-0x0;var _0x42f489=_0x9d9d[_0x25e931];return _0x42f489;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd9d9('0x0'));var zipdir=require(_0xd9d9('0x1'));var jsonpatch=require(_0xd9d9('0x2'));var rp=require(_0xd9d9('0x3'));var moment=require(_0xd9d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd9d9('0x5'));var util=require(_0xd9d9('0x6'));var path=require(_0xd9d9('0x7'));var sox=require(_0xd9d9('0x8'));var csv=require(_0xd9d9('0x9'));var ejs=require(_0xd9d9('0xa'));var fs=require('fs');var fs_extra=require(_0xd9d9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd9d9('0xc'));var jsforce=require(_0xd9d9('0xd'));var deskjs=require(_0xd9d9('0xe'));var toCsv=require(_0xd9d9('0x9'));var querystring=require(_0xd9d9('0xf'));var Papa=require('papaparse');var Redis=require(_0xd9d9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd9d9('0x11'));var as=require(_0xd9d9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9d9('0x13'))('api');var utils=require(_0xd9d9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd9d9('0x15'));var db=require(_0xd9d9('0x16'))['db'];function respondWithStatusCode(_0x118203,_0x54b024){_0x54b024=_0x54b024||0xcc;return function(_0x3842f1){if(_0x3842f1){return _0x118203[_0xd9d9('0x17')](_0x54b024);}return _0x118203['status'](_0x54b024)[_0xd9d9('0x18')]();};}function respondWithResult(_0x550392,_0x54bf64){_0x54bf64=_0x54bf64||0xc8;return function(_0x3e1c02){if(_0x3e1c02){return _0x550392[_0xd9d9('0x19')](_0x54bf64)['json'](_0x3e1c02);}};}function respondWithFilteredResult(_0x159fe4,_0x25ca0a){return function(_0x54ef05){if(_0x54ef05){var _0x417eda=typeof _0x25ca0a['offset']===_0xd9d9('0x1a')&&typeof _0x25ca0a[_0xd9d9('0x1b')]===_0xd9d9('0x1a');var _0x330fac=_0x54ef05[_0xd9d9('0x1c')];var _0x123d50=_0x417eda?0x0:_0x25ca0a['offset'];var _0x13748e=_0x417eda?_0x54ef05[_0xd9d9('0x1c')]:_0x25ca0a[_0xd9d9('0x1d')]+_0x25ca0a[_0xd9d9('0x1b')];var _0x3be93e;if(_0x13748e>=_0x330fac){_0x13748e=_0x330fac;_0x3be93e=0xc8;}else{_0x3be93e=0xce;}_0x159fe4[_0xd9d9('0x19')](_0x3be93e);return _0x159fe4[_0xd9d9('0x1e')](_0xd9d9('0x1f'),_0x123d50+'-'+_0x13748e+'/'+_0x330fac)[_0xd9d9('0x20')](_0x54ef05);}return null;};}function patchUpdates(_0x4f5cf5){return function(_0x33c970){try{jsonpatch[_0xd9d9('0x21')](_0x33c970,_0x4f5cf5,!![]);}catch(_0x5dbf85){return BPromise[_0xd9d9('0x22')](_0x5dbf85);}return _0x33c970[_0xd9d9('0x23')]();};}function saveUpdates(_0x2dddfa,_0x372225){return function(_0x2fb324){if(_0x2fb324){return _0x2fb324[_0xd9d9('0x24')](_0x2dddfa)['then'](function(_0x211465){return _0x211465;});}return null;};}function removeEntity(_0x532723,_0x15554f){return function(_0x2e859c){if(_0x2e859c){return _0x2e859c[_0xd9d9('0x25')]()[_0xd9d9('0x26')](function(){_0x532723[_0xd9d9('0x19')](0xcc)[_0xd9d9('0x18')]();});}};}function handleEntityNotFound(_0x29ee73,_0x4ea5ce){return function(_0xdd1422){if(!_0xdd1422){_0x29ee73[_0xd9d9('0x17')](0x194);}return _0xdd1422;};}function handleError(_0x5a37b5,_0x2abf6d){_0x2abf6d=_0x2abf6d||0x1f4;return function(_0x40bb7a){logger['error'](_0x40bb7a[_0xd9d9('0x27')]);if(_0x40bb7a[_0xd9d9('0x28')]){delete _0x40bb7a[_0xd9d9('0x28')];}_0x5a37b5[_0xd9d9('0x19')](_0x2abf6d)[_0xd9d9('0x29')](_0x40bb7a);};}exports[_0xd9d9('0x2a')]=function(_0x2e1d83,_0x571e35){var _0x36aca1={},_0xb9746={},_0x1e8676={'count':0x0,'rows':[]};var _0x13f16a=_[_0xd9d9('0x2b')](db[_0xd9d9('0x2c')][_0xd9d9('0x2d')],function(_0x5133c8){return{'name':_0x5133c8[_0xd9d9('0x2e')],'type':_0x5133c8[_0xd9d9('0x2f')][_0xd9d9('0x30')]};});_0xb9746['model']=_[_0xd9d9('0x2b')](_0x13f16a,'name');_0xb9746[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x2e1d83['query']);_0xb9746[_0xd9d9('0x33')]=_['intersection'](_0xb9746[_0xd9d9('0x34')],_0xb9746[_0xd9d9('0x31')]);_0x36aca1[_0xd9d9('0x35')]=_[_0xd9d9('0x36')](_0xb9746[_0xd9d9('0x34')],qs[_0xd9d9('0x37')](_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x37')]));_0x36aca1[_0xd9d9('0x35')]=_0x36aca1['attributes']['length']?_0x36aca1[_0xd9d9('0x35')]:_0xb9746[_0xd9d9('0x34')];if(!_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x38')]('nolimit')){_0x36aca1['limit']=qs['limit'](_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x1b')]);_0x36aca1[_0xd9d9('0x1d')]=qs[_0xd9d9('0x1d')](_0x2e1d83[_0xd9d9('0x31')]['offset']);}_0x36aca1[_0xd9d9('0x39')]=qs['sort'](_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x3a')]);_0x36aca1['where']=qs['filters'](_[_0xd9d9('0x3b')](_0x2e1d83['query'],_0xb9746[_0xd9d9('0x33')]),_0x13f16a);if(_0x2e1d83['query']['filter']){_0x36aca1[_0xd9d9('0x3c')]=_['merge'](_0x36aca1['where'],{'$or':_['map'](_0x13f16a,function(_0x20ec83){if(_0x20ec83[_0xd9d9('0x2f')]!==_0xd9d9('0x3d')){var _0x1f1ece={};_0x1f1ece[_0x20ec83[_0xd9d9('0x28')]]={'$like':'%'+_0x2e1d83[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x1f1ece;}})});}_0x36aca1=_[_0xd9d9('0x3f')]({},_0x36aca1,_0x2e1d83['options']);var _0xd9bbce={'where':_0x36aca1[_0xd9d9('0x3c')]};return db['SalesforceConfiguration'][_0xd9d9('0x1c')](_0xd9bbce)['then'](function(_0x379989){_0x1e8676['count']=_0x379989;if(_0x2e1d83['query'][_0xd9d9('0x40')]){_0x36aca1[_0xd9d9('0x41')]=[{'all':!![]}];}return db[_0xd9d9('0x2c')]['findAll'](_0x36aca1);})[_0xd9d9('0x26')](function(_0x2ffe86){_0x1e8676[_0xd9d9('0x42')]=_0x2ffe86;return _0x1e8676;})['then'](respondWithFilteredResult(_0x571e35,_0x36aca1))['catch'](handleError(_0x571e35,null));};exports['show']=function(_0x40c1a7,_0x139ed5){var _0x40b1c9={'raw':![],'where':{'id':_0x40c1a7[_0xd9d9('0x43')]['id']}},_0x6aab0a={};_0x6aab0a[_0xd9d9('0x34')]=_[_0xd9d9('0x32')](db[_0xd9d9('0x2c')][_0xd9d9('0x2d')]);_0x6aab0a[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x40c1a7[_0xd9d9('0x31')]);_0x6aab0a[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x6aab0a['model'],_0x6aab0a[_0xd9d9('0x31')]);_0x40b1c9['attributes']=_[_0xd9d9('0x36')](_0x6aab0a['model'],qs['fields'](_0x40c1a7['query'][_0xd9d9('0x37')]));_0x40b1c9[_0xd9d9('0x35')]=_0x40b1c9[_0xd9d9('0x35')][_0xd9d9('0x44')]?_0x40b1c9['attributes']:_0x6aab0a[_0xd9d9('0x34')];if(_0x40c1a7[_0xd9d9('0x31')][_0xd9d9('0x40')]){_0x40b1c9[_0xd9d9('0x41')]=[{'all':!![]}];}_0x40b1c9=_[_0xd9d9('0x3f')]({},_0x40b1c9,_0x40c1a7[_0xd9d9('0x45')]);return db[_0xd9d9('0x2c')][_0xd9d9('0x46')](_0x40b1c9)[_0xd9d9('0x26')](handleEntityNotFound(_0x139ed5,null))['then'](respondWithResult(_0x139ed5,null))['catch'](handleError(_0x139ed5,null));};exports[_0xd9d9('0x47')]=function(_0x5b244d,_0x5ea292){return db[_0xd9d9('0x2c')][_0xd9d9('0x47')](_0x5b244d[_0xd9d9('0x48')],{})['then'](respondWithResult(_0x5ea292,0xc9))['catch'](handleError(_0x5ea292,null));};exports[_0xd9d9('0x24')]=function(_0x161ff7,_0x5c2086){if(_0x161ff7[_0xd9d9('0x48')]['id']){delete _0x161ff7[_0xd9d9('0x48')]['id'];}return db[_0xd9d9('0x2c')][_0xd9d9('0x46')]({'where':{'id':_0x161ff7[_0xd9d9('0x43')]['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x5c2086,null))[_0xd9d9('0x26')](saveUpdates(_0x161ff7['body'],null))[_0xd9d9('0x26')](respondWithResult(_0x5c2086,null))['catch'](handleError(_0x5c2086,null));};exports[_0xd9d9('0x25')]=function(_0x2ac231,_0x4a4b15){return db[_0xd9d9('0x2c')]['find']({'where':{'id':_0x2ac231[_0xd9d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a4b15,null))[_0xd9d9('0x26')](removeEntity(_0x4a4b15,null))[_0xd9d9('0x49')](handleError(_0x4a4b15,null));};exports[_0xd9d9('0x4a')]=function(_0x8a80b4,_0x517746,_0x22ea44){var _0x6a03fc={};var _0x15b6b8={};var _0x5915bd;var _0x4ba0aa;return db[_0xd9d9('0x2c')][_0xd9d9('0x4b')]({'where':{'id':_0x8a80b4['params']['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x517746,null))[_0xd9d9('0x26')](function(_0x324d96){if(_0x324d96){_0x5915bd=_0x324d96;_0x15b6b8[_0xd9d9('0x34')]=_[_0xd9d9('0x32')](db[_0xd9d9('0x4c')][_0xd9d9('0x2d')]);_0x15b6b8[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x8a80b4[_0xd9d9('0x31')]);_0x15b6b8[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x15b6b8['model'],_0x15b6b8[_0xd9d9('0x31')]);_0x6a03fc[_0xd9d9('0x35')]=_[_0xd9d9('0x36')](_0x15b6b8[_0xd9d9('0x34')],qs[_0xd9d9('0x37')](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x37')]));_0x6a03fc[_0xd9d9('0x35')]=_0x6a03fc[_0xd9d9('0x35')][_0xd9d9('0x44')]?_0x6a03fc[_0xd9d9('0x35')]:_0x15b6b8[_0xd9d9('0x34')];_0x6a03fc[_0xd9d9('0x39')]=qs[_0xd9d9('0x3a')](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x3a')]);_0x6a03fc['where']=qs[_0xd9d9('0x33')](_[_0xd9d9('0x3b')](_0x8a80b4[_0xd9d9('0x31')],_0x15b6b8[_0xd9d9('0x33')]));if(_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x3e')]){_0x6a03fc['where']=_['merge'](_0x6a03fc[_0xd9d9('0x3c')],{'$or':_['map'](_0x6a03fc[_0xd9d9('0x35')],function(_0x179a15){var _0x4b0a48={};_0x4b0a48[_0x179a15]={'$like':'%'+_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x4b0a48;})});}_0x6a03fc=_[_0xd9d9('0x3f')]({},_0x6a03fc,_0x8a80b4[_0xd9d9('0x45')]);return _0x5915bd[_0xd9d9('0x4a')](_0x6a03fc);}})[_0xd9d9('0x26')](function(_0x29edf5){if(_0x29edf5){_0x4ba0aa=_0x29edf5[_0xd9d9('0x44')];if(!_0x8a80b4['query'][_0xd9d9('0x38')](_0xd9d9('0x4d'))){_0x6a03fc[_0xd9d9('0x1b')]=qs['limit'](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x1b')]);_0x6a03fc[_0xd9d9('0x1d')]=qs[_0xd9d9('0x1d')](_0x8a80b4[_0xd9d9('0x31')][_0xd9d9('0x1d')]);}return _0x5915bd['getFields'](_0x6a03fc);}})[_0xd9d9('0x26')](function(_0x3464f0){if(_0x3464f0){return _0x3464f0?{'count':_0x4ba0aa,'rows':_0x3464f0}:null;}})['then'](respondWithResult(_0x517746,null))[_0xd9d9('0x49')](handleError(_0x517746,null));};exports[_0xd9d9('0x4e')]=function(_0x2ab64e,_0x3f5a0d,_0x505dbe){var _0x474150={};var _0x3a279c={};var _0x2a5528;var _0x4b833a;return db['SalesforceConfiguration'][_0xd9d9('0x4b')]({'where':{'id':_0x2ab64e[_0xd9d9('0x43')]['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x3f5a0d,null))[_0xd9d9('0x26')](function(_0x458011){if(_0x458011){_0x2a5528=_0x458011;_0x3a279c['model']=_[_0xd9d9('0x32')](db[_0xd9d9('0x4c')]['rawAttributes']);_0x3a279c[_0xd9d9('0x31')]=_[_0xd9d9('0x32')](_0x2ab64e[_0xd9d9('0x31')]);_0x3a279c[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x3a279c[_0xd9d9('0x34')],_0x3a279c[_0xd9d9('0x31')]);_0x474150[_0xd9d9('0x35')]=_['intersection'](_0x3a279c[_0xd9d9('0x34')],qs['fields'](_0x2ab64e['query'][_0xd9d9('0x37')]));_0x474150['attributes']=_0x474150['attributes'][_0xd9d9('0x44')]?_0x474150['attributes']:_0x3a279c[_0xd9d9('0x34')];_0x474150[_0xd9d9('0x39')]=qs['sort'](_0x2ab64e['query'][_0xd9d9('0x3a')]);_0x474150[_0xd9d9('0x3c')]=qs[_0xd9d9('0x33')](_[_0xd9d9('0x3b')](_0x2ab64e[_0xd9d9('0x31')],_0x3a279c[_0xd9d9('0x33')]));if(_0x2ab64e['query'][_0xd9d9('0x3e')]){_0x474150[_0xd9d9('0x3c')]=_['merge'](_0x474150['where'],{'$or':_[_0xd9d9('0x2b')](_0x474150[_0xd9d9('0x35')],function(_0x60b4eb){var _0x28e959={};_0x28e959[_0x60b4eb]={'$like':'%'+_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x28e959;})});}_0x474150=_[_0xd9d9('0x3f')]({},_0x474150,_0x2ab64e[_0xd9d9('0x45')]);return _0x2a5528[_0xd9d9('0x4e')](_0x474150);}})['then'](function(_0x5f0b16){if(_0x5f0b16){_0x4b833a=_0x5f0b16[_0xd9d9('0x44')];if(!_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x38')](_0xd9d9('0x4d'))){_0x474150[_0xd9d9('0x1b')]=qs[_0xd9d9('0x1b')](_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x1b')]);_0x474150[_0xd9d9('0x1d')]=qs[_0xd9d9('0x1d')](_0x2ab64e[_0xd9d9('0x31')][_0xd9d9('0x1d')]);}return _0x2a5528[_0xd9d9('0x4e')](_0x474150);}})[_0xd9d9('0x26')](function(_0x5d1919){if(_0x5d1919){return _0x5d1919?{'count':_0x4b833a,'rows':_0x5d1919}:null;}})['then'](respondWithResult(_0x3f5a0d,null))[_0xd9d9('0x49')](handleError(_0x3f5a0d,null));};exports[_0xd9d9('0x4f')]=function(_0x569d64,_0x598fff,_0x3f3457){var _0x58a711={};var _0x5bd082={};var _0x55bc7f;var _0x2cae4d;return db[_0xd9d9('0x2c')][_0xd9d9('0x4b')]({'where':{'id':_0x569d64[_0xd9d9('0x43')]['id']}})[_0xd9d9('0x26')](handleEntityNotFound(_0x598fff,null))[_0xd9d9('0x26')](function(_0x44749c){if(_0x44749c){_0x55bc7f=_0x44749c;_0x5bd082['model']=_[_0xd9d9('0x32')](db[_0xd9d9('0x4c')][_0xd9d9('0x2d')]);_0x5bd082[_0xd9d9('0x31')]=_['keys'](_0x569d64[_0xd9d9('0x31')]);_0x5bd082[_0xd9d9('0x33')]=_[_0xd9d9('0x36')](_0x5bd082[_0xd9d9('0x34')],_0x5bd082[_0xd9d9('0x31')]);_0x58a711['attributes']=_[_0xd9d9('0x36')](_0x5bd082[_0xd9d9('0x34')],qs[_0xd9d9('0x37')](_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x37')]));_0x58a711[_0xd9d9('0x35')]=_0x58a711[_0xd9d9('0x35')][_0xd9d9('0x44')]?_0x58a711[_0xd9d9('0x35')]:_0x5bd082['model'];_0x58a711[_0xd9d9('0x39')]=qs[_0xd9d9('0x3a')](_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x3a')]);_0x58a711[_0xd9d9('0x3c')]=qs[_0xd9d9('0x33')](_[_0xd9d9('0x3b')](_0x569d64[_0xd9d9('0x31')],_0x5bd082[_0xd9d9('0x33')]));if(_0x569d64[_0xd9d9('0x31')]['filter']){_0x58a711[_0xd9d9('0x3c')]=_['merge'](_0x58a711[_0xd9d9('0x3c')],{'$or':_[_0xd9d9('0x2b')](_0x58a711[_0xd9d9('0x35')],function(_0x3035f0){var _0x494f2c={};_0x494f2c[_0x3035f0]={'$like':'%'+_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x3e')]+'%'};return _0x494f2c;})});}_0x58a711=_[_0xd9d9('0x3f')]({},_0x58a711,_0x569d64['options']);return _0x55bc7f['getDescriptions'](_0x58a711);}})[_0xd9d9('0x26')](function(_0x3cb127){if(_0x3cb127){_0x2cae4d=_0x3cb127[_0xd9d9('0x44')];if(!_0x569d64[_0xd9d9('0x31')]['hasOwnProperty'](_0xd9d9('0x4d'))){_0x58a711[_0xd9d9('0x1b')]=qs[_0xd9d9('0x1b')](_0x569d64[_0xd9d9('0x31')]['limit']);_0x58a711['offset']=qs[_0xd9d9('0x1d')](_0x569d64[_0xd9d9('0x31')][_0xd9d9('0x1d')]);}return _0x55bc7f['getDescriptions'](_0x58a711);}})[_0xd9d9('0x26')](function(_0x479834){if(_0x479834){return _0x479834?{'count':_0x2cae4d,'rows':_0x479834}:null;}})[_0xd9d9('0x26')](respondWithResult(_0x598fff,null))[_0xd9d9('0x49')](handleError(_0x598fff,null));}; \ No newline at end of file +var _0xe253=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','fieldName','key','query','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','keys','catch','create','body','params','find','getFields','findOne','SalesforceField','length','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x59d9fc,_0x49d288){var _0x37dd9b=function(_0x236de1){while(--_0x236de1){_0x59d9fc['push'](_0x59d9fc['shift']());}};_0x37dd9b(++_0x49d288);}(_0xe253,0x134));var _0x3e25=function(_0x31586e,_0x182d65){_0x31586e=_0x31586e-0x0;var _0x427412=_0xe253[_0x31586e];return _0x427412;};'use strict';var emlformat=require(_0x3e25('0x0'));var rimraf=require(_0x3e25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e25('0x2'));var rp=require(_0x3e25('0x3'));var moment=require(_0x3e25('0x4'));var BPromise=require(_0x3e25('0x5'));var Mustache=require(_0x3e25('0x6'));var util=require(_0x3e25('0x7'));var path=require(_0x3e25('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e25('0x9'));var fs=require('fs');var fs_extra=require(_0x3e25('0xa'));var _=require(_0x3e25('0xb'));var squel=require(_0x3e25('0xc'));var crypto=require(_0x3e25('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3e25('0xe'));var toCsv=require(_0x3e25('0xf'));var querystring=require('querystring');var Papa=require(_0x3e25('0x10'));var Redis=require(_0x3e25('0x11'));var authService=require(_0x3e25('0x12'));var qs=require(_0x3e25('0x13'));var as=require(_0x3e25('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e25('0x15'))('api');var utils=require(_0x3e25('0x16'));var config=require(_0x3e25('0x17'));var licenseUtil=require(_0x3e25('0x18'));var db=require(_0x3e25('0x19'))['db'];function respondWithStatusCode(_0x45e66b,_0x20efc6){_0x20efc6=_0x20efc6||0xcc;return function(_0x2abbd3){if(_0x2abbd3){return _0x45e66b[_0x3e25('0x1a')](_0x20efc6);}return _0x45e66b[_0x3e25('0x1b')](_0x20efc6)[_0x3e25('0x1c')]();};}function respondWithResult(_0xe29a24,_0x439346){_0x439346=_0x439346||0xc8;return function(_0x1e2f68){if(_0x1e2f68){return _0xe29a24[_0x3e25('0x1b')](_0x439346)[_0x3e25('0x1d')](_0x1e2f68);}};}function respondWithFilteredResult(_0x279fe8,_0x4a0ef3){return function(_0x21443d){if(_0x21443d){var _0xc427fc=typeof _0x4a0ef3[_0x3e25('0x1e')]===_0x3e25('0x1f')&&typeof _0x4a0ef3[_0x3e25('0x20')]==='undefined';var _0x2d43e2=_0x21443d[_0x3e25('0x21')];var _0x3a41b2=_0xc427fc?0x0:_0x4a0ef3[_0x3e25('0x1e')];var _0xb27281=_0xc427fc?_0x21443d[_0x3e25('0x21')]:_0x4a0ef3[_0x3e25('0x1e')]+_0x4a0ef3[_0x3e25('0x20')];var _0x38c0df;if(_0xb27281>=_0x2d43e2){_0xb27281=_0x2d43e2;_0x38c0df=0xc8;}else{_0x38c0df=0xce;}_0x279fe8[_0x3e25('0x1b')](_0x38c0df);return _0x279fe8[_0x3e25('0x22')]('Content-Range',_0x3a41b2+'-'+_0xb27281+'/'+_0x2d43e2)[_0x3e25('0x1d')](_0x21443d);}return null;};}function patchUpdates(_0x26943f){return function(_0x49bbaf){try{jsonpatch[_0x3e25('0x23')](_0x49bbaf,_0x26943f,!![]);}catch(_0x539879){return BPromise[_0x3e25('0x24')](_0x539879);}return _0x49bbaf['save']();};}function saveUpdates(_0x223c6d,_0x591058){return function(_0x20a676){if(_0x20a676){return _0x20a676[_0x3e25('0x25')](_0x223c6d)[_0x3e25('0x26')](function(_0x491b71){return _0x491b71;});}return null;};}function removeEntity(_0x3e7a9e,_0x5800a6){return function(_0x31188d){if(_0x31188d){return _0x31188d[_0x3e25('0x27')]()['then'](function(){_0x3e7a9e[_0x3e25('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8e4f,_0xe2c370){return function(_0x571522){if(!_0x571522){_0x1f8e4f[_0x3e25('0x1a')](0x194);}return _0x571522;};}function handleError(_0x33483e,_0x482dac){_0x482dac=_0x482dac||0x1f4;return function(_0x76b369){logger[_0x3e25('0x28')](_0x76b369[_0x3e25('0x29')]);if(_0x76b369[_0x3e25('0x2a')]){delete _0x76b369[_0x3e25('0x2a')];}_0x33483e[_0x3e25('0x1b')](_0x482dac)['send'](_0x76b369);};}exports[_0x3e25('0x2b')]=function(_0x246000,_0x234cd1){var _0x5bfa8e={},_0x21be44={},_0x3c6728={'count':0x0,'rows':[]};var _0x3a2456=_[_0x3e25('0x2c')](db[_0x3e25('0x2d')]['rawAttributes'],function(_0x626d67){return{'name':_0x626d67[_0x3e25('0x2e')],'type':_0x626d67['type'][_0x3e25('0x2f')]};});_0x21be44['model']=_[_0x3e25('0x2c')](_0x3a2456,'name');_0x21be44[_0x3e25('0x30')]=_['keys'](_0x246000[_0x3e25('0x30')]);_0x21be44['filters']=_['intersection'](_0x21be44['model'],_0x21be44[_0x3e25('0x30')]);_0x5bfa8e[_0x3e25('0x31')]=_[_0x3e25('0x32')](_0x21be44[_0x3e25('0x33')],qs[_0x3e25('0x34')](_0x246000['query'][_0x3e25('0x34')]));_0x5bfa8e['attributes']=_0x5bfa8e[_0x3e25('0x31')]['length']?_0x5bfa8e[_0x3e25('0x31')]:_0x21be44[_0x3e25('0x33')];if(!_0x246000[_0x3e25('0x30')][_0x3e25('0x35')](_0x3e25('0x36'))){_0x5bfa8e[_0x3e25('0x20')]=qs['limit'](_0x246000[_0x3e25('0x30')][_0x3e25('0x20')]);_0x5bfa8e[_0x3e25('0x1e')]=qs[_0x3e25('0x1e')](_0x246000[_0x3e25('0x30')][_0x3e25('0x1e')]);}_0x5bfa8e[_0x3e25('0x37')]=qs[_0x3e25('0x38')](_0x246000[_0x3e25('0x30')][_0x3e25('0x38')]);_0x5bfa8e[_0x3e25('0x39')]=qs[_0x3e25('0x3a')](_[_0x3e25('0x3b')](_0x246000['query'],_0x21be44[_0x3e25('0x3a')]),_0x3a2456);if(_0x246000[_0x3e25('0x30')][_0x3e25('0x3c')]){_0x5bfa8e['where']=_[_0x3e25('0x3d')](_0x5bfa8e[_0x3e25('0x39')],{'$or':_['map'](_0x3a2456,function(_0x25db18){if(_0x25db18[_0x3e25('0x3e')]!==_0x3e25('0x3f')){var _0x57b9e9={};_0x57b9e9[_0x25db18[_0x3e25('0x2a')]]={'$like':'%'+_0x246000['query'][_0x3e25('0x3c')]+'%'};return _0x57b9e9;}})});}_0x5bfa8e=_[_0x3e25('0x3d')]({},_0x5bfa8e,_0x246000[_0x3e25('0x40')]);var _0x4543e1={'where':_0x5bfa8e[_0x3e25('0x39')]};return db[_0x3e25('0x2d')]['count'](_0x4543e1)['then'](function(_0x568791){_0x3c6728[_0x3e25('0x21')]=_0x568791;if(_0x246000['query'][_0x3e25('0x41')]){_0x5bfa8e[_0x3e25('0x42')]=[{'all':!![]}];}return db[_0x3e25('0x2d')][_0x3e25('0x43')](_0x5bfa8e);})[_0x3e25('0x26')](function(_0x6d3a6b){_0x3c6728[_0x3e25('0x44')]=_0x6d3a6b;return _0x3c6728;})[_0x3e25('0x26')](respondWithFilteredResult(_0x234cd1,_0x5bfa8e))['catch'](handleError(_0x234cd1,null));};exports[_0x3e25('0x45')]=function(_0x576632,_0x5e9bd1){var _0x19c156={'raw':![],'where':{'id':_0x576632['params']['id']}},_0x42de6e={};_0x42de6e[_0x3e25('0x33')]=_['keys'](db['SalesforceConfiguration'][_0x3e25('0x46')]);_0x42de6e[_0x3e25('0x30')]=_[_0x3e25('0x47')](_0x576632[_0x3e25('0x30')]);_0x42de6e[_0x3e25('0x3a')]=_[_0x3e25('0x32')](_0x42de6e[_0x3e25('0x33')],_0x42de6e[_0x3e25('0x30')]);_0x19c156[_0x3e25('0x31')]=_[_0x3e25('0x32')](_0x42de6e[_0x3e25('0x33')],qs[_0x3e25('0x34')](_0x576632[_0x3e25('0x30')][_0x3e25('0x34')]));_0x19c156[_0x3e25('0x31')]=_0x19c156[_0x3e25('0x31')]['length']?_0x19c156[_0x3e25('0x31')]:_0x42de6e[_0x3e25('0x33')];if(_0x576632[_0x3e25('0x30')]['includeAll']){_0x19c156[_0x3e25('0x42')]=[{'all':!![]}];}_0x19c156=_['merge']({},_0x19c156,_0x576632['options']);return db[_0x3e25('0x2d')]['find'](_0x19c156)[_0x3e25('0x26')](handleEntityNotFound(_0x5e9bd1,null))['then'](respondWithResult(_0x5e9bd1,null))[_0x3e25('0x48')](handleError(_0x5e9bd1,null));};exports[_0x3e25('0x49')]=function(_0x24addb,_0x406484){return db['SalesforceConfiguration'][_0x3e25('0x49')](_0x24addb['body'],{})['then'](respondWithResult(_0x406484,0xc9))['catch'](handleError(_0x406484,null));};exports[_0x3e25('0x25')]=function(_0x5e2bf0,_0xe60c3d){if(_0x5e2bf0[_0x3e25('0x4a')]['id']){delete _0x5e2bf0[_0x3e25('0x4a')]['id'];}return db[_0x3e25('0x2d')]['find']({'where':{'id':_0x5e2bf0[_0x3e25('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe60c3d,null))[_0x3e25('0x26')](saveUpdates(_0x5e2bf0['body'],null))[_0x3e25('0x26')](respondWithResult(_0xe60c3d,null))[_0x3e25('0x48')](handleError(_0xe60c3d,null));};exports[_0x3e25('0x27')]=function(_0x1999e7,_0x51eff7){return db[_0x3e25('0x2d')][_0x3e25('0x4c')]({'where':{'id':_0x1999e7[_0x3e25('0x4b')]['id']}})[_0x3e25('0x26')](handleEntityNotFound(_0x51eff7,null))['then'](removeEntity(_0x51eff7,null))[_0x3e25('0x48')](handleError(_0x51eff7,null));};exports[_0x3e25('0x4d')]=function(_0x687d4c,_0x105ea3,_0x4e21c8){var _0x10bdb6={};var _0x406d5a={};var _0x5ab654;var _0x572a40;return db[_0x3e25('0x2d')][_0x3e25('0x4e')]({'where':{'id':_0x687d4c[_0x3e25('0x4b')]['id']}})[_0x3e25('0x26')](handleEntityNotFound(_0x105ea3,null))[_0x3e25('0x26')](function(_0x273cc3){if(_0x273cc3){_0x5ab654=_0x273cc3;_0x406d5a[_0x3e25('0x33')]=_[_0x3e25('0x47')](db[_0x3e25('0x4f')][_0x3e25('0x46')]);_0x406d5a[_0x3e25('0x30')]=_[_0x3e25('0x47')](_0x687d4c[_0x3e25('0x30')]);_0x406d5a['filters']=_[_0x3e25('0x32')](_0x406d5a[_0x3e25('0x33')],_0x406d5a[_0x3e25('0x30')]);_0x10bdb6[_0x3e25('0x31')]=_['intersection'](_0x406d5a[_0x3e25('0x33')],qs[_0x3e25('0x34')](_0x687d4c[_0x3e25('0x30')]['fields']));_0x10bdb6[_0x3e25('0x31')]=_0x10bdb6[_0x3e25('0x31')][_0x3e25('0x50')]?_0x10bdb6[_0x3e25('0x31')]:_0x406d5a[_0x3e25('0x33')];_0x10bdb6['order']=qs[_0x3e25('0x38')](_0x687d4c['query'][_0x3e25('0x38')]);_0x10bdb6[_0x3e25('0x39')]=qs['filters'](_['pick'](_0x687d4c[_0x3e25('0x30')],_0x406d5a[_0x3e25('0x3a')]));if(_0x687d4c[_0x3e25('0x30')]['filter']){_0x10bdb6[_0x3e25('0x39')]=_[_0x3e25('0x3d')](_0x10bdb6['where'],{'$or':_[_0x3e25('0x2c')](_0x10bdb6[_0x3e25('0x31')],function(_0xae0962){var _0x511168={};_0x511168[_0xae0962]={'$like':'%'+_0x687d4c['query'][_0x3e25('0x3c')]+'%'};return _0x511168;})});}_0x10bdb6=_[_0x3e25('0x3d')]({},_0x10bdb6,_0x687d4c['options']);return _0x5ab654[_0x3e25('0x4d')](_0x10bdb6);}})[_0x3e25('0x26')](function(_0x195e97){if(_0x195e97){_0x572a40=_0x195e97[_0x3e25('0x50')];if(!_0x687d4c['query'][_0x3e25('0x35')]('nolimit')){_0x10bdb6[_0x3e25('0x20')]=qs['limit'](_0x687d4c[_0x3e25('0x30')]['limit']);_0x10bdb6[_0x3e25('0x1e')]=qs['offset'](_0x687d4c[_0x3e25('0x30')][_0x3e25('0x1e')]);}return _0x5ab654[_0x3e25('0x4d')](_0x10bdb6);}})['then'](function(_0x545214){if(_0x545214){return _0x545214?{'count':_0x572a40,'rows':_0x545214}:null;}})[_0x3e25('0x26')](respondWithResult(_0x105ea3,null))[_0x3e25('0x48')](handleError(_0x105ea3,null));};exports[_0x3e25('0x51')]=function(_0x490fd7,_0x1de582,_0x327ace){var _0xf4ceb7={};var _0x2b69a2={};var _0x4b71d3;var _0x479e33;return db[_0x3e25('0x2d')][_0x3e25('0x4e')]({'where':{'id':_0x490fd7['params']['id']}})['then'](handleEntityNotFound(_0x1de582,null))[_0x3e25('0x26')](function(_0x9bbfba){if(_0x9bbfba){_0x4b71d3=_0x9bbfba;_0x2b69a2[_0x3e25('0x33')]=_[_0x3e25('0x47')](db['SalesforceField']['rawAttributes']);_0x2b69a2[_0x3e25('0x30')]=_[_0x3e25('0x47')](_0x490fd7[_0x3e25('0x30')]);_0x2b69a2[_0x3e25('0x3a')]=_[_0x3e25('0x32')](_0x2b69a2[_0x3e25('0x33')],_0x2b69a2['query']);_0xf4ceb7[_0x3e25('0x31')]=_[_0x3e25('0x32')](_0x2b69a2[_0x3e25('0x33')],qs[_0x3e25('0x34')](_0x490fd7['query'][_0x3e25('0x34')]));_0xf4ceb7['attributes']=_0xf4ceb7[_0x3e25('0x31')][_0x3e25('0x50')]?_0xf4ceb7[_0x3e25('0x31')]:_0x2b69a2[_0x3e25('0x33')];_0xf4ceb7[_0x3e25('0x37')]=qs[_0x3e25('0x38')](_0x490fd7['query']['sort']);_0xf4ceb7[_0x3e25('0x39')]=qs[_0x3e25('0x3a')](_['pick'](_0x490fd7['query'],_0x2b69a2[_0x3e25('0x3a')]));if(_0x490fd7['query'][_0x3e25('0x3c')]){_0xf4ceb7[_0x3e25('0x39')]=_[_0x3e25('0x3d')](_0xf4ceb7[_0x3e25('0x39')],{'$or':_[_0x3e25('0x2c')](_0xf4ceb7[_0x3e25('0x31')],function(_0x328424){var _0x8c3312={};_0x8c3312[_0x328424]={'$like':'%'+_0x490fd7[_0x3e25('0x30')][_0x3e25('0x3c')]+'%'};return _0x8c3312;})});}_0xf4ceb7=_[_0x3e25('0x3d')]({},_0xf4ceb7,_0x490fd7['options']);return _0x4b71d3[_0x3e25('0x51')](_0xf4ceb7);}})['then'](function(_0x5d6bbe){if(_0x5d6bbe){_0x479e33=_0x5d6bbe[_0x3e25('0x50')];if(!_0x490fd7[_0x3e25('0x30')]['hasOwnProperty'](_0x3e25('0x36'))){_0xf4ceb7['limit']=qs[_0x3e25('0x20')](_0x490fd7[_0x3e25('0x30')][_0x3e25('0x20')]);_0xf4ceb7[_0x3e25('0x1e')]=qs[_0x3e25('0x1e')](_0x490fd7[_0x3e25('0x30')]['offset']);}return _0x4b71d3['getSubjects'](_0xf4ceb7);}})['then'](function(_0x2e837e){if(_0x2e837e){return _0x2e837e?{'count':_0x479e33,'rows':_0x2e837e}:null;}})[_0x3e25('0x26')](respondWithResult(_0x1de582,null))[_0x3e25('0x48')](handleError(_0x1de582,null));};exports[_0x3e25('0x52')]=function(_0x25be7b,_0x4c1e8d,_0x5cae7b){var _0x3015e3={};var _0x38f9ab={};var _0x2332f2;var _0x2621ae;return db[_0x3e25('0x2d')]['findOne']({'where':{'id':_0x25be7b[_0x3e25('0x4b')]['id']}})[_0x3e25('0x26')](handleEntityNotFound(_0x4c1e8d,null))[_0x3e25('0x26')](function(_0x62dcd8){if(_0x62dcd8){_0x2332f2=_0x62dcd8;_0x38f9ab[_0x3e25('0x33')]=_[_0x3e25('0x47')](db[_0x3e25('0x4f')][_0x3e25('0x46')]);_0x38f9ab['query']=_['keys'](_0x25be7b[_0x3e25('0x30')]);_0x38f9ab[_0x3e25('0x3a')]=_[_0x3e25('0x32')](_0x38f9ab[_0x3e25('0x33')],_0x38f9ab['query']);_0x3015e3[_0x3e25('0x31')]=_['intersection'](_0x38f9ab[_0x3e25('0x33')],qs[_0x3e25('0x34')](_0x25be7b['query']['fields']));_0x3015e3[_0x3e25('0x31')]=_0x3015e3[_0x3e25('0x31')][_0x3e25('0x50')]?_0x3015e3[_0x3e25('0x31')]:_0x38f9ab['model'];_0x3015e3[_0x3e25('0x37')]=qs[_0x3e25('0x38')](_0x25be7b[_0x3e25('0x30')][_0x3e25('0x38')]);_0x3015e3['where']=qs[_0x3e25('0x3a')](_[_0x3e25('0x3b')](_0x25be7b[_0x3e25('0x30')],_0x38f9ab['filters']));if(_0x25be7b[_0x3e25('0x30')]['filter']){_0x3015e3[_0x3e25('0x39')]=_[_0x3e25('0x3d')](_0x3015e3[_0x3e25('0x39')],{'$or':_[_0x3e25('0x2c')](_0x3015e3[_0x3e25('0x31')],function(_0x707c99){var _0x18f18a={};_0x18f18a[_0x707c99]={'$like':'%'+_0x25be7b[_0x3e25('0x30')]['filter']+'%'};return _0x18f18a;})});}_0x3015e3=_['merge']({},_0x3015e3,_0x25be7b[_0x3e25('0x40')]);return _0x2332f2[_0x3e25('0x52')](_0x3015e3);}})['then'](function(_0x22ee12){if(_0x22ee12){_0x2621ae=_0x22ee12[_0x3e25('0x50')];if(!_0x25be7b[_0x3e25('0x30')][_0x3e25('0x35')](_0x3e25('0x36'))){_0x3015e3[_0x3e25('0x20')]=qs['limit'](_0x25be7b[_0x3e25('0x30')][_0x3e25('0x20')]);_0x3015e3[_0x3e25('0x1e')]=qs[_0x3e25('0x1e')](_0x25be7b[_0x3e25('0x30')][_0x3e25('0x1e')]);}return _0x2332f2[_0x3e25('0x52')](_0x3015e3);}})[_0x3e25('0x26')](function(_0x310fab){if(_0x310fab){return _0x310fab?{'count':_0x2621ae,'rows':_0x310fab}:null;}})[_0x3e25('0x26')](respondWithResult(_0x4c1e8d,null))['catch'](handleError(_0x4c1e8d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 06cdbe9..d1b8471 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 _0x7f90=['rimraf','./intSalesforceConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','path'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x7f90,0xf4));var _0x07f9=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0x7f90[_0x41010e];return _0x59e342;};'use strict';var _=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var logger=require(_0x07f9('0x2'))(_0x07f9('0x3'));var moment=require(_0x07f9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07f9('0x5'));var rimraf=require(_0x07f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x07f9('0x7'));module[_0x07f9('0x8')]=function(_0x46f86e,_0x449544){return _0x46f86e[_0x07f9('0x9')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef50=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','SalesforceConfiguration','lodash','util'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xef50,0x1a5));var _0x0ef5=function(_0x510675,_0xea9f5f){_0x510675=_0x510675-0x0;var _0x38cfd1=_0xef50[_0x510675];return _0x38cfd1;};'use strict';var _=require(_0x0ef5('0x0'));var util=require(_0x0ef5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0ef5('0x2'));var BPromise=require(_0x0ef5('0x3'));var rp=require(_0x0ef5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ef5('0x5'));var config=require(_0x0ef5('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0ef5('0x7')]=function(_0x2a7574,_0x515559){return _0x2a7574['define'](_0x0ef5('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 40ee0b3..554222b 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 _0xf3b4=['rpc','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x51885c,_0x2711a7){var _0x3ab453=function(_0xc9a744){while(--_0xc9a744){_0x51885c['push'](_0x51885c['shift']());}};_0x3ab453(++_0x2711a7);}(_0xf3b4,0x1c7));var _0x4f3b=function(_0x2abdd3,_0x33cb82){_0x2abdd3=_0x2abdd3-0x0;var _0x3e002e=_0xf3b4[_0x2abdd3];return _0x3e002e;};'use strict';var _=require(_0x4f3b('0x0'));var util=require(_0x4f3b('0x1'));var moment=require(_0x4f3b('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f3b('0x3'));var fs=require('fs');var Redis=require(_0x4f3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f3b('0x5'));var logger=require(_0x4f3b('0x6'))(_0x4f3b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4f3b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e62d3,_0x351d0f,_0x339f10){return new BPromise(function(_0x163768,_0x4249c7){return client[_0x4f3b('0x9')](_0x1e62d3,_0x339f10)[_0x4f3b('0xa')](function(_0x5f351d){logger[_0x4f3b('0xb')](_0x4f3b('0xc'),_0x351d0f,'request\x20sent');logger[_0x4f3b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x351d0f,'request\x20sent',JSON[_0x4f3b('0xe')](_0x5f351d));if(_0x5f351d[_0x4f3b('0xf')]){if(_0x5f351d[_0x4f3b('0xf')][_0x4f3b('0x10')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x351d0f,_0x5f351d[_0x4f3b('0xf')][_0x4f3b('0x11')]);return _0x4249c7(_0x5f351d['error']['message']);}logger[_0x4f3b('0xf')](_0x4f3b('0xc'),_0x351d0f,_0x5f351d[_0x4f3b('0xf')][_0x4f3b('0x11')]);return _0x163768(_0x5f351d['error'][_0x4f3b('0x11')]);}else{logger[_0x4f3b('0xb')](_0x4f3b('0xc'),_0x351d0f,_0x4f3b('0x12'));_0x163768(_0x5f351d[_0x4f3b('0x13')][_0x4f3b('0x11')]);}})[_0x4f3b('0x14')](function(_0xc1cabc){logger[_0x4f3b('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x351d0f,_0xc1cabc);_0x4249c7(_0xc1cabc);});});} \ No newline at end of file +var _0xc3c9=['then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x43e0c5,_0x5aaf95){var _0x124601=function(_0x4b9e65){while(--_0x4b9e65){_0x43e0c5['push'](_0x43e0c5['shift']());}};_0x124601(++_0x5aaf95);}(_0xc3c9,0x8e));var _0x9c3c=function(_0x147e9f,_0x57b3cb){_0x147e9f=_0x147e9f-0x0;var _0x321585=_0xc3c9[_0x147e9f];return _0x321585;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c3c('0x0'));var BPromise=require(_0x9c3c('0x1'));var rs=require(_0x9c3c('0x2'));var fs=require('fs');var Redis=require(_0x9c3c('0x3'));var db=require(_0x9c3c('0x4'))['db'];var utils=require(_0x9c3c('0x5'));var logger=require(_0x9c3c('0x6'))(_0x9c3c('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c3c('0x8'));var client=jayson[_0x9c3c('0x9')][_0x9c3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fdbcc,_0x469c6f,_0x21692e){return new BPromise(function(_0x18da8f,_0x374f0b){return client[_0x9c3c('0xb')](_0x1fdbcc,_0x21692e)[_0x9c3c('0xc')](function(_0x38fc6b){logger[_0x9c3c('0xd')](_0x9c3c('0xe'),_0x469c6f,'request\x20sent');logger['debug'](_0x9c3c('0xf'),_0x469c6f,'request\x20sent',JSON[_0x9c3c('0x10')](_0x38fc6b));if(_0x38fc6b[_0x9c3c('0x11')]){if(_0x38fc6b[_0x9c3c('0x11')][_0x9c3c('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x469c6f,_0x38fc6b['error'][_0x9c3c('0x13')]);return _0x374f0b(_0x38fc6b[_0x9c3c('0x11')][_0x9c3c('0x13')]);}logger['error'](_0x9c3c('0xe'),_0x469c6f,_0x38fc6b[_0x9c3c('0x11')][_0x9c3c('0x13')]);return _0x18da8f(_0x38fc6b['error'][_0x9c3c('0x13')]);}else{logger[_0x9c3c('0xd')](_0x9c3c('0xe'),_0x469c6f,_0x9c3c('0x14'));_0x18da8f(_0x38fc6b[_0x9c3c('0x15')]['message']);}})['catch'](function(_0x57033c){logger[_0x9c3c('0x11')](_0x9c3c('0xe'),_0x469c6f,_0x57033c);_0x374f0b(_0x57033c);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0765178..5b43a36 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 _0x62d8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x4ced97,_0x2c46d4){var _0x11ae41=function(_0x35d8c5){while(--_0x35d8c5){_0x4ced97['push'](_0x4ced97['shift']());}};_0x11ae41(++_0x2c46d4);}(_0x62d8,0xc7));var _0x862d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x62d8[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x862d('0x0'));var path=require(_0x862d('0x1'));var timeout=require(_0x862d('0x2'));var express=require('express');var router=express[_0x862d('0x3')]();var fs_extra=require(_0x862d('0x4'));var auth=require(_0x862d('0x5'));var interaction=require(_0x862d('0x6'));var config=require(_0x862d('0x7'));var controller=require(_0x862d('0x8'));router[_0x862d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x862d('0x9')]('/:id',auth[_0x862d('0xa')](),controller[_0x862d('0xb')]);router[_0x862d('0xc')]('/',auth[_0x862d('0xa')](),controller[_0x862d('0xd')]);router[_0x862d('0xe')](_0x862d('0xf'),auth[_0x862d('0xa')](),controller[_0x862d('0x10')]);router[_0x862d('0x11')](_0x862d('0xf'),auth['isAuthenticated'](),controller[_0x862d('0x12')]);module[_0x862d('0x13')]=router; \ No newline at end of file +var _0xf766=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x59f081,_0x43fe79){var _0x483533=function(_0x5f281c){while(--_0x5f281c){_0x59f081['push'](_0x59f081['shift']());}};_0x483533(++_0x43fe79);}(_0xf766,0x77));var _0x6f76=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xf766[_0x25fc41];return _0x1371d1;};'use strict';var multer=require(_0x6f76('0x0'));var util=require(_0x6f76('0x1'));var path=require(_0x6f76('0x2'));var timeout=require(_0x6f76('0x3'));var express=require(_0x6f76('0x4'));var router=express[_0x6f76('0x5')]();var fs_extra=require(_0x6f76('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6f76('0x7'));var config=require(_0x6f76('0x8'));var controller=require(_0x6f76('0x9'));router[_0x6f76('0xa')]('/',auth[_0x6f76('0xb')](),controller[_0x6f76('0xc')]);router['get'](_0x6f76('0xd'),auth[_0x6f76('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6f76('0xe')](_0x6f76('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6f76('0xf')](_0x6f76('0xd'),auth[_0x6f76('0xb')](),controller[_0x6f76('0x10')]);module[_0x6f76('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b7b28e4..df2cb09 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 _0x0842=['string','customVariable','picklist','STRING','variable','ENUM'];(function(_0xb3e798,_0x5e982a){var _0x41dca1=function(_0x5dc573){while(--_0x5dc573){_0xb3e798['push'](_0xb3e798['shift']());}};_0x41dca1(++_0x5e982a);}(_0x0842,0x77));var _0x2084=function(_0x4acb9d,_0x28894b){_0x4acb9d=_0x4acb9d-0x0;var _0x252ccb=_0x0842[_0x4acb9d];return _0x252ccb;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2084('0x0')](_0x2084('0x1'),'variable',_0x2084('0x2'),'keyValue',_0x2084('0x3')),'defaultValue':_0x2084('0x1')},'content':{'type':Sequelize[_0x2084('0x4')]},'key':{'type':Sequelize[_0x2084('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x2084('0x1'),_0x2084('0x5'),_0x2084('0x2'))},'keyContent':{'type':Sequelize[_0x2084('0x4')]},'idField':{'type':Sequelize[_0x2084('0x4')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8133=['variable','customVariable','STRING','string','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8133,0xcf));var _0x3813=function(_0x395778,_0x3bec90){_0x395778=_0x395778-0x0;var _0xfc32b3=_0x8133[_0x395778];return _0xfc32b3;};'use strict';var Sequelize=require(_0x3813('0x0'));module[_0x3813('0x1')]={'type':{'type':Sequelize[_0x3813('0x2')]('string',_0x3813('0x3'),_0x3813('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3813('0x5')]},'key':{'type':Sequelize[_0x3813('0x5')]},'keyType':{'type':Sequelize[_0x3813('0x2')](_0x3813('0x6'),_0x3813('0x3'),_0x3813('0x4'))},'keyContent':{'type':Sequelize[_0x3813('0x5')]},'idField':{'type':Sequelize[_0x3813('0x5')]},'variableName':{'type':Sequelize[_0x3813('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cc17609..dbbb867 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 _0xa8da=['merge','options','includeAll','include','then','catch','show','params','SalesforceField','length','find','create','body','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x55203d,_0xe80ef8){var _0x3119fd=function(_0x39c0f5){while(--_0x39c0f5){_0x55203d['push'](_0x55203d['shift']());}};_0x3119fd(++_0xe80ef8);}(_0xa8da,0x184));var _0xaa8d=function(_0x2942af,_0x2166ac){_0x2942af=_0x2942af-0x0;var _0x2b91ea=_0xa8da[_0x2942af];return _0x2b91ea;};'use strict';var emlformat=require(_0xaa8d('0x0'));var rimraf=require(_0xaa8d('0x1'));var zipdir=require(_0xaa8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa8d('0x3'));var moment=require(_0xaa8d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa8d('0x5'));var path=require(_0xaa8d('0x6'));var sox=require('sox');var csv=require(_0xaa8d('0x7'));var ejs=require(_0xaa8d('0x8'));var fs=require('fs');var fs_extra=require(_0xaa8d('0x9'));var _=require(_0xaa8d('0xa'));var squel=require(_0xaa8d('0xb'));var crypto=require(_0xaa8d('0xc'));var jsforce=require(_0xaa8d('0xd'));var deskjs=require(_0xaa8d('0xe'));var toCsv=require(_0xaa8d('0x7'));var querystring=require(_0xaa8d('0xf'));var Papa=require(_0xaa8d('0x10'));var Redis=require(_0xaa8d('0x11'));var authService=require(_0xaa8d('0x12'));var qs=require(_0xaa8d('0x13'));var as=require(_0xaa8d('0x14'));var hardwareService=require(_0xaa8d('0x15'));var logger=require(_0xaa8d('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa8d('0x17'));var db=require(_0xaa8d('0x18'))['db'];function respondWithStatusCode(_0x1bba6a,_0x43d89e){_0x43d89e=_0x43d89e||0xcc;return function(_0x5a3dad){if(_0x5a3dad){return _0x1bba6a['sendStatus'](_0x43d89e);}return _0x1bba6a[_0xaa8d('0x19')](_0x43d89e)[_0xaa8d('0x1a')]();};}function respondWithResult(_0xefde89,_0x26a16b){_0x26a16b=_0x26a16b||0xc8;return function(_0x5f28b0){if(_0x5f28b0){return _0xefde89[_0xaa8d('0x19')](_0x26a16b)[_0xaa8d('0x1b')](_0x5f28b0);}};}function respondWithFilteredResult(_0x43bf44,_0x4ebeba){return function(_0x3e36c8){if(_0x3e36c8){var _0x2fdc08=typeof _0x4ebeba['offset']===_0xaa8d('0x1c')&&typeof _0x4ebeba[_0xaa8d('0x1d')]===_0xaa8d('0x1c');var _0x13bdbc=_0x3e36c8[_0xaa8d('0x1e')];var _0x2e6017=_0x2fdc08?0x0:_0x4ebeba['offset'];var _0x46f74d=_0x2fdc08?_0x3e36c8[_0xaa8d('0x1e')]:_0x4ebeba[_0xaa8d('0x1f')]+_0x4ebeba[_0xaa8d('0x1d')];var _0x2d434a;if(_0x46f74d>=_0x13bdbc){_0x46f74d=_0x13bdbc;_0x2d434a=0xc8;}else{_0x2d434a=0xce;}_0x43bf44['status'](_0x2d434a);return _0x43bf44[_0xaa8d('0x20')](_0xaa8d('0x21'),_0x2e6017+'-'+_0x46f74d+'/'+_0x13bdbc)['json'](_0x3e36c8);}return null;};}function patchUpdates(_0x22c598){return function(_0x4b9fc1){try{jsonpatch['apply'](_0x4b9fc1,_0x22c598,!![]);}catch(_0x426131){return BPromise[_0xaa8d('0x22')](_0x426131);}return _0x4b9fc1[_0xaa8d('0x23')]();};}function saveUpdates(_0x51b1c0,_0x500816){return function(_0x374f7c){if(_0x374f7c){return _0x374f7c[_0xaa8d('0x24')](_0x51b1c0)['then'](function(_0x51f258){return _0x51f258;});}return null;};}function removeEntity(_0x37991f,_0x93e073){return function(_0x2dff43){if(_0x2dff43){return _0x2dff43[_0xaa8d('0x25')]()['then'](function(){_0x37991f[_0xaa8d('0x19')](0xcc)[_0xaa8d('0x1a')]();});}};}function handleEntityNotFound(_0x35883e,_0x5a5268){return function(_0x1b84c9){if(!_0x1b84c9){_0x35883e['sendStatus'](0x194);}return _0x1b84c9;};}function handleError(_0x10f197,_0x4b0e57){_0x4b0e57=_0x4b0e57||0x1f4;return function(_0x4dde46){logger[_0xaa8d('0x26')](_0x4dde46[_0xaa8d('0x27')]);if(_0x4dde46[_0xaa8d('0x28')]){delete _0x4dde46[_0xaa8d('0x28')];}_0x10f197[_0xaa8d('0x19')](_0x4b0e57)[_0xaa8d('0x29')](_0x4dde46);};}exports[_0xaa8d('0x2a')]=function(_0x2f885e,_0x2e8cdf){var _0x8ceec8={},_0x1d950d={},_0x18c947={'count':0x0,'rows':[]};var _0x13be6f=_[_0xaa8d('0x2b')](db['SalesforceField'][_0xaa8d('0x2c')],function(_0x22d49b){return{'name':_0x22d49b[_0xaa8d('0x2d')],'type':_0x22d49b[_0xaa8d('0x2e')][_0xaa8d('0x2f')]};});_0x1d950d[_0xaa8d('0x30')]=_[_0xaa8d('0x2b')](_0x13be6f,_0xaa8d('0x28'));_0x1d950d['query']=_[_0xaa8d('0x31')](_0x2f885e[_0xaa8d('0x32')]);_0x1d950d['filters']=_[_0xaa8d('0x33')](_0x1d950d['model'],_0x1d950d[_0xaa8d('0x32')]);_0x8ceec8[_0xaa8d('0x34')]=_['intersection'](_0x1d950d[_0xaa8d('0x30')],qs[_0xaa8d('0x35')](_0x2f885e['query']['fields']));_0x8ceec8['attributes']=_0x8ceec8[_0xaa8d('0x34')]['length']?_0x8ceec8[_0xaa8d('0x34')]:_0x1d950d[_0xaa8d('0x30')];if(!_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x36')]('nolimit')){_0x8ceec8[_0xaa8d('0x1d')]=qs['limit'](_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x1d')]);_0x8ceec8[_0xaa8d('0x1f')]=qs['offset'](_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x1f')]);}_0x8ceec8[_0xaa8d('0x37')]=qs[_0xaa8d('0x38')](_0x2f885e[_0xaa8d('0x32')]['sort']);_0x8ceec8[_0xaa8d('0x39')]=qs[_0xaa8d('0x3a')](_[_0xaa8d('0x3b')](_0x2f885e[_0xaa8d('0x32')],_0x1d950d[_0xaa8d('0x3a')]),_0x13be6f);if(_0x2f885e['query'][_0xaa8d('0x3c')]){_0x8ceec8[_0xaa8d('0x39')]=_['merge'](_0x8ceec8['where'],{'$or':_[_0xaa8d('0x2b')](_0x13be6f,function(_0x338c00){if(_0x338c00['type']!==_0xaa8d('0x3d')){var _0x2562f0={};_0x2562f0[_0x338c00[_0xaa8d('0x28')]]={'$like':'%'+_0x2f885e[_0xaa8d('0x32')]['filter']+'%'};return _0x2562f0;}})});}_0x8ceec8=_[_0xaa8d('0x3e')]({},_0x8ceec8,_0x2f885e[_0xaa8d('0x3f')]);var _0x511ae6={'where':_0x8ceec8[_0xaa8d('0x39')]};return db['SalesforceField']['count'](_0x511ae6)['then'](function(_0x405b71){_0x18c947['count']=_0x405b71;if(_0x2f885e[_0xaa8d('0x32')][_0xaa8d('0x40')]){_0x8ceec8[_0xaa8d('0x41')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x8ceec8);})[_0xaa8d('0x42')](function(_0x34f0b2){_0x18c947['rows']=_0x34f0b2;return _0x18c947;})['then'](respondWithFilteredResult(_0x2e8cdf,_0x8ceec8))[_0xaa8d('0x43')](handleError(_0x2e8cdf,null));};exports[_0xaa8d('0x44')]=function(_0xcf308f,_0x13d501){var _0x296c0c={'raw':!![],'where':{'id':_0xcf308f[_0xaa8d('0x45')]['id']}},_0x155470={};_0x155470[_0xaa8d('0x30')]=_[_0xaa8d('0x31')](db[_0xaa8d('0x46')][_0xaa8d('0x2c')]);_0x155470[_0xaa8d('0x32')]=_[_0xaa8d('0x31')](_0xcf308f[_0xaa8d('0x32')]);_0x155470[_0xaa8d('0x3a')]=_[_0xaa8d('0x33')](_0x155470[_0xaa8d('0x30')],_0x155470['query']);_0x296c0c[_0xaa8d('0x34')]=_[_0xaa8d('0x33')](_0x155470[_0xaa8d('0x30')],qs[_0xaa8d('0x35')](_0xcf308f[_0xaa8d('0x32')][_0xaa8d('0x35')]));_0x296c0c[_0xaa8d('0x34')]=_0x296c0c['attributes'][_0xaa8d('0x47')]?_0x296c0c[_0xaa8d('0x34')]:_0x155470['model'];if(_0xcf308f['query'][_0xaa8d('0x40')]){_0x296c0c['include']=[{'all':!![]}];}_0x296c0c=_['merge']({},_0x296c0c,_0xcf308f[_0xaa8d('0x3f')]);return db[_0xaa8d('0x46')][_0xaa8d('0x48')](_0x296c0c)[_0xaa8d('0x42')](handleEntityNotFound(_0x13d501,null))[_0xaa8d('0x42')](respondWithResult(_0x13d501,null))['catch'](handleError(_0x13d501,null));};exports[_0xaa8d('0x49')]=function(_0x2a2738,_0x2cc27f){return db[_0xaa8d('0x46')]['create'](_0x2a2738[_0xaa8d('0x4a')],{})[_0xaa8d('0x42')](respondWithResult(_0x2cc27f,0xc9))[_0xaa8d('0x43')](handleError(_0x2cc27f,null));};exports[_0xaa8d('0x24')]=function(_0x56b989,_0x5f1c13){if(_0x56b989['body']['id']){delete _0x56b989['body']['id'];}return db[_0xaa8d('0x46')][_0xaa8d('0x48')]({'where':{'id':_0x56b989[_0xaa8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5f1c13,null))[_0xaa8d('0x42')](saveUpdates(_0x56b989[_0xaa8d('0x4a')],null))['then'](respondWithResult(_0x5f1c13,null))['catch'](handleError(_0x5f1c13,null));};exports['destroy']=function(_0x3a32c7,_0x5b1c5b){return db['SalesforceField'][_0xaa8d('0x48')]({'where':{'id':_0x3a32c7[_0xaa8d('0x45')]['id']}})[_0xaa8d('0x42')](handleEntityNotFound(_0x5b1c5b,null))[_0xaa8d('0x42')](removeEntity(_0x5b1c5b,null))[_0xaa8d('0x43')](handleError(_0x5b1c5b,null));}; \ No newline at end of file +var _0x397a=['apply','save','update','destroy','sendStatus','error','stack','name','index','map','SalesforceField','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','findAll','rows','catch','show','params','keys','includeAll','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range'];(function(_0x4cdd58,_0x53cd73){var _0x1308c6=function(_0xfaba30){while(--_0xfaba30){_0x4cdd58['push'](_0x4cdd58['shift']());}};_0x1308c6(++_0x53cd73);}(_0x397a,0xb7));var _0xa397=function(_0x4e2461,_0x2061d1){_0x4e2461=_0x4e2461-0x0;var _0x4b93a8=_0x397a[_0x4e2461];return _0x4b93a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa397('0x0'));var zipdir=require(_0xa397('0x1'));var jsonpatch=require(_0xa397('0x2'));var rp=require(_0xa397('0x3'));var moment=require('moment');var BPromise=require(_0xa397('0x4'));var Mustache=require(_0xa397('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa397('0x6'));var csv=require('to-csv');var ejs=require(_0xa397('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa397('0x8'));var crypto=require('crypto');var jsforce=require(_0xa397('0x9'));var deskjs=require(_0xa397('0xa'));var toCsv=require(_0xa397('0xb'));var querystring=require(_0xa397('0xc'));var Papa=require(_0xa397('0xd'));var Redis=require(_0xa397('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa397('0xf'));var as=require(_0xa397('0x10'));var hardwareService=require(_0xa397('0x11'));var logger=require(_0xa397('0x12'))('api');var utils=require(_0xa397('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa397('0x14'));var db=require(_0xa397('0x15'))['db'];function respondWithStatusCode(_0x36ec28,_0x130b1f){_0x130b1f=_0x130b1f||0xcc;return function(_0x56e19e){if(_0x56e19e){return _0x36ec28['sendStatus'](_0x130b1f);}return _0x36ec28[_0xa397('0x16')](_0x130b1f)[_0xa397('0x17')]();};}function respondWithResult(_0x3e9db9,_0x42d51f){_0x42d51f=_0x42d51f||0xc8;return function(_0x2cc955){if(_0x2cc955){return _0x3e9db9['status'](_0x42d51f)[_0xa397('0x18')](_0x2cc955);}};}function respondWithFilteredResult(_0x42986c,_0x498420){return function(_0x319378){if(_0x319378){var _0x579a18=typeof _0x498420['offset']===_0xa397('0x19')&&typeof _0x498420[_0xa397('0x1a')]===_0xa397('0x19');var _0x15b915=_0x319378[_0xa397('0x1b')];var _0x23ffc2=_0x579a18?0x0:_0x498420['offset'];var _0x3a52e8=_0x579a18?_0x319378['count']:_0x498420[_0xa397('0x1c')]+_0x498420[_0xa397('0x1a')];var _0x122b24;if(_0x3a52e8>=_0x15b915){_0x3a52e8=_0x15b915;_0x122b24=0xc8;}else{_0x122b24=0xce;}_0x42986c[_0xa397('0x16')](_0x122b24);return _0x42986c['set'](_0xa397('0x1d'),_0x23ffc2+'-'+_0x3a52e8+'/'+_0x15b915)[_0xa397('0x18')](_0x319378);}return null;};}function patchUpdates(_0xb51b5c){return function(_0x552b32){try{jsonpatch[_0xa397('0x1e')](_0x552b32,_0xb51b5c,!![]);}catch(_0x385799){return BPromise['reject'](_0x385799);}return _0x552b32[_0xa397('0x1f')]();};}function saveUpdates(_0x319dca,_0xffcee8){return function(_0x4813c5){if(_0x4813c5){return _0x4813c5[_0xa397('0x20')](_0x319dca)['then'](function(_0xb36a82){return _0xb36a82;});}return null;};}function removeEntity(_0x12d8f2,_0x40e1b0){return function(_0x31eb6a){if(_0x31eb6a){return _0x31eb6a[_0xa397('0x21')]()['then'](function(){_0x12d8f2[_0xa397('0x16')](0xcc)[_0xa397('0x17')]();});}};}function handleEntityNotFound(_0x266a9a,_0x3db7ee){return function(_0x5d0638){if(!_0x5d0638){_0x266a9a[_0xa397('0x22')](0x194);}return _0x5d0638;};}function handleError(_0x385c5f,_0x5833b2){_0x5833b2=_0x5833b2||0x1f4;return function(_0x268a67){logger[_0xa397('0x23')](_0x268a67[_0xa397('0x24')]);if(_0x268a67[_0xa397('0x25')]){delete _0x268a67['name'];}_0x385c5f[_0xa397('0x16')](_0x5833b2)['send'](_0x268a67);};}exports[_0xa397('0x26')]=function(_0x3221a6,_0x24be71){var _0x27c725={},_0x43ffc5={},_0x46184f={'count':0x0,'rows':[]};var _0x4c1dfa=_[_0xa397('0x27')](db[_0xa397('0x28')]['rawAttributes'],function(_0x37f19f){return{'name':_0x37f19f[_0xa397('0x29')],'type':_0x37f19f[_0xa397('0x2a')]['key']};});_0x43ffc5[_0xa397('0x2b')]=_[_0xa397('0x27')](_0x4c1dfa,_0xa397('0x25'));_0x43ffc5[_0xa397('0x2c')]=_['keys'](_0x3221a6[_0xa397('0x2c')]);_0x43ffc5['filters']=_[_0xa397('0x2d')](_0x43ffc5[_0xa397('0x2b')],_0x43ffc5[_0xa397('0x2c')]);_0x27c725[_0xa397('0x2e')]=_[_0xa397('0x2d')](_0x43ffc5[_0xa397('0x2b')],qs[_0xa397('0x2f')](_0x3221a6['query'][_0xa397('0x2f')]));_0x27c725[_0xa397('0x2e')]=_0x27c725['attributes'][_0xa397('0x30')]?_0x27c725['attributes']:_0x43ffc5['model'];if(!_0x3221a6[_0xa397('0x2c')][_0xa397('0x31')]('nolimit')){_0x27c725[_0xa397('0x1a')]=qs['limit'](_0x3221a6[_0xa397('0x2c')][_0xa397('0x1a')]);_0x27c725['offset']=qs[_0xa397('0x1c')](_0x3221a6['query'][_0xa397('0x1c')]);}_0x27c725[_0xa397('0x32')]=qs['sort'](_0x3221a6[_0xa397('0x2c')][_0xa397('0x33')]);_0x27c725[_0xa397('0x34')]=qs['filters'](_[_0xa397('0x35')](_0x3221a6[_0xa397('0x2c')],_0x43ffc5[_0xa397('0x36')]),_0x4c1dfa);if(_0x3221a6[_0xa397('0x2c')][_0xa397('0x37')]){_0x27c725['where']=_[_0xa397('0x38')](_0x27c725['where'],{'$or':_[_0xa397('0x27')](_0x4c1dfa,function(_0x250862){if(_0x250862[_0xa397('0x2a')]!==_0xa397('0x39')){var _0x131584={};_0x131584[_0x250862['name']]={'$like':'%'+_0x3221a6['query'][_0xa397('0x37')]+'%'};return _0x131584;}})});}_0x27c725=_['merge']({},_0x27c725,_0x3221a6[_0xa397('0x3a')]);var _0x4b0d9b={'where':_0x27c725[_0xa397('0x34')]};return db['SalesforceField'][_0xa397('0x1b')](_0x4b0d9b)[_0xa397('0x3b')](function(_0x3669fd){_0x46184f['count']=_0x3669fd;if(_0x3221a6['query']['includeAll']){_0x27c725['include']=[{'all':!![]}];}return db[_0xa397('0x28')][_0xa397('0x3c')](_0x27c725);})[_0xa397('0x3b')](function(_0x589821){_0x46184f[_0xa397('0x3d')]=_0x589821;return _0x46184f;})[_0xa397('0x3b')](respondWithFilteredResult(_0x24be71,_0x27c725))[_0xa397('0x3e')](handleError(_0x24be71,null));};exports[_0xa397('0x3f')]=function(_0x4853b6,_0x5b5b8e){var _0x458dcc={'raw':!![],'where':{'id':_0x4853b6[_0xa397('0x40')]['id']}},_0x443b25={};_0x443b25['model']=_[_0xa397('0x41')](db['SalesforceField']['rawAttributes']);_0x443b25['query']=_['keys'](_0x4853b6[_0xa397('0x2c')]);_0x443b25[_0xa397('0x36')]=_[_0xa397('0x2d')](_0x443b25[_0xa397('0x2b')],_0x443b25[_0xa397('0x2c')]);_0x458dcc[_0xa397('0x2e')]=_[_0xa397('0x2d')](_0x443b25[_0xa397('0x2b')],qs['fields'](_0x4853b6[_0xa397('0x2c')][_0xa397('0x2f')]));_0x458dcc[_0xa397('0x2e')]=_0x458dcc[_0xa397('0x2e')][_0xa397('0x30')]?_0x458dcc[_0xa397('0x2e')]:_0x443b25[_0xa397('0x2b')];if(_0x4853b6[_0xa397('0x2c')][_0xa397('0x42')]){_0x458dcc[_0xa397('0x43')]=[{'all':!![]}];}_0x458dcc=_[_0xa397('0x38')]({},_0x458dcc,_0x4853b6[_0xa397('0x3a')]);return db[_0xa397('0x28')]['find'](_0x458dcc)['then'](handleEntityNotFound(_0x5b5b8e,null))[_0xa397('0x3b')](respondWithResult(_0x5b5b8e,null))['catch'](handleError(_0x5b5b8e,null));};exports[_0xa397('0x44')]=function(_0x42a6d5,_0x3efa38){return db['SalesforceField']['create'](_0x42a6d5['body'],{})[_0xa397('0x3b')](respondWithResult(_0x3efa38,0xc9))['catch'](handleError(_0x3efa38,null));};exports[_0xa397('0x20')]=function(_0x37c486,_0x25b721){if(_0x37c486[_0xa397('0x45')]['id']){delete _0x37c486[_0xa397('0x45')]['id'];}return db[_0xa397('0x28')][_0xa397('0x46')]({'where':{'id':_0x37c486[_0xa397('0x40')]['id']}})[_0xa397('0x3b')](handleEntityNotFound(_0x25b721,null))[_0xa397('0x3b')](saveUpdates(_0x37c486[_0xa397('0x45')],null))[_0xa397('0x3b')](respondWithResult(_0x25b721,null))['catch'](handleError(_0x25b721,null));};exports[_0xa397('0x21')]=function(_0x51b01f,_0x6cd05f){return db[_0xa397('0x28')][_0xa397('0x46')]({'where':{'id':_0x51b01f[_0xa397('0x40')]['id']}})[_0xa397('0x3b')](handleEntityNotFound(_0x6cd05f,null))['then'](removeEntity(_0x6cd05f,null))[_0xa397('0x3e')](handleError(_0x6cd05f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 150de5b..56a71b4 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 _0x19d0=['SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x33d239,_0x24bb87){var _0x6784c2=function(_0x2d8fb6){while(--_0x2d8fb6){_0x33d239['push'](_0x33d239['shift']());}};_0x6784c2(++_0x24bb87);}(_0x19d0,0x154));var _0x019d=function(_0x2db4d9,_0x1a4a79){_0x2db4d9=_0x2db4d9-0x0;var _0xfc9d02=_0x19d0[_0x2db4d9];return _0xfc9d02;};'use strict';var _=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var logger=require('../../config/logger')(_0x019d('0x2'));var moment=require(_0x019d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x019d('0x4'));var rimraf=require(_0x019d('0x5'));var config=require(_0x019d('0x6'));var attributes=require(_0x019d('0x7'));module[_0x019d('0x8')]=function(_0x423484,_0x46b692){return _0x423484[_0x019d('0x9')](_0x019d('0xa'),attributes,{'tableName':_0x019d('0xb'),'paranoid':![],'indexes':[{'name':_0x019d('0xc'),'fields':['idField',_0x019d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06b4=['exports','define','SalesforceField','FieldId','lodash','util','../../config/logger','bluebird','path','rimraf','./intSalesforceField.attributes'];(function(_0x17b4f1,_0x3e56bf){var _0x81bcac=function(_0x28262b){while(--_0x28262b){_0x17b4f1['push'](_0x17b4f1['shift']());}};_0x81bcac(++_0x3e56bf);}(_0x06b4,0x1d2));var _0x406b=function(_0x7dc2ba,_0x4cac84){_0x7dc2ba=_0x7dc2ba-0x0;var _0x2330ac=_0x06b4[_0x7dc2ba];return _0x2330ac;};'use strict';var _=require(_0x406b('0x0'));var util=require(_0x406b('0x1'));var logger=require(_0x406b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x406b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x406b('0x4'));var rimraf=require(_0x406b('0x5'));var config=require('../../config/environment');var attributes=require(_0x406b('0x6'));module[_0x406b('0x7')]=function(_0x51086c,_0x58e963){return _0x51086c[_0x406b('0x8')](_0x406b('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x406b('0xa')],'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 7ffb1d9..e25d4a0 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 _0x8971=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0x8971,0x132));var _0x1897=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x8971[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x1897('0x0'));var util=require(_0x1897('0x1'));var moment=require(_0x1897('0x2'));var BPromise=require(_0x1897('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1897('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1897('0x5'))(_0x1897('0x6'));var config=require(_0x1897('0x7'));var jayson=require(_0x1897('0x8'));var client=jayson[_0x1897('0x9')][_0x1897('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4518a5,_0x1c9111,_0x1ad0c4){return new BPromise(function(_0xb50f5e,_0x223ee9){return client['request'](_0x4518a5,_0x1ad0c4)[_0x1897('0xb')](function(_0x1e6328){logger['info'](_0x1897('0xc'),_0x1c9111,_0x1897('0xd'));logger[_0x1897('0xe')](_0x1897('0xf'),_0x1c9111,'request\x20sent',JSON[_0x1897('0x10')](_0x1e6328));if(_0x1e6328['error']){if(_0x1e6328[_0x1897('0x11')]['code']===0x1f4){logger[_0x1897('0x11')](_0x1897('0xc'),_0x1c9111,_0x1e6328[_0x1897('0x11')][_0x1897('0x12')]);return _0x223ee9(_0x1e6328['error'][_0x1897('0x12')]);}logger[_0x1897('0x11')]('SalesforceField,\x20%s,\x20%s',_0x1c9111,_0x1e6328[_0x1897('0x11')]['message']);return _0xb50f5e(_0x1e6328[_0x1897('0x11')][_0x1897('0x12')]);}else{logger[_0x1897('0x13')](_0x1897('0xc'),_0x1c9111,_0x1897('0xd'));_0xb50f5e(_0x1e6328[_0x1897('0x14')][_0x1897('0x12')]);}})[_0x1897('0x15')](function(_0x79ca9d){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1c9111,_0x79ca9d);_0x223ee9(_0x79ca9d);});});} \ No newline at end of file +var _0x1b07=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','lodash','bluebird','randomstring','ioredis'];(function(_0x5c7b86,_0x361fde){var _0x189239=function(_0x36887c){while(--_0x36887c){_0x5c7b86['push'](_0x5c7b86['shift']());}};_0x189239(++_0x361fde);}(_0x1b07,0x13f));var _0x71b0=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x1b07[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x71b0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x71b0('0x1'));var rs=require(_0x71b0('0x2'));var fs=require('fs');var Redis=require(_0x71b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x71b0('0x4'));var logger=require(_0x71b0('0x5'))(_0x71b0('0x6'));var config=require('../../config/environment');var jayson=require(_0x71b0('0x7'));var client=jayson[_0x71b0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52e060,_0x6811f5,_0x39b25e){return new BPromise(function(_0x1d7a73,_0x2f25f2){return client[_0x71b0('0x9')](_0x52e060,_0x39b25e)['then'](function(_0x5d38e3){logger['info']('SalesforceField,\x20%s,\x20%s',_0x6811f5,_0x71b0('0xa'));logger[_0x71b0('0xb')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x6811f5,_0x71b0('0xa'),JSON[_0x71b0('0xc')](_0x5d38e3));if(_0x5d38e3[_0x71b0('0xd')]){if(_0x5d38e3[_0x71b0('0xd')][_0x71b0('0xe')]===0x1f4){logger['error'](_0x71b0('0xf'),_0x6811f5,_0x5d38e3[_0x71b0('0xd')][_0x71b0('0x10')]);return _0x2f25f2(_0x5d38e3[_0x71b0('0xd')][_0x71b0('0x10')]);}logger[_0x71b0('0xd')]('SalesforceField,\x20%s,\x20%s',_0x6811f5,_0x5d38e3[_0x71b0('0xd')][_0x71b0('0x10')]);return _0x1d7a73(_0x5d38e3[_0x71b0('0xd')]['message']);}else{logger[_0x71b0('0x11')](_0x71b0('0xf'),_0x6811f5,'request\x20sent');_0x1d7a73(_0x5d38e3[_0x71b0('0x12')][_0x71b0('0x10')]);}})['catch'](function(_0x35afa6){logger[_0x71b0('0xd')](_0x71b0('0xf'),_0x6811f5,_0x35afa6);_0x2f25f2(_0x35afa6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 841d79d..a336f99 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 _0xdfaa=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','create','post','/:id/configurations','addConfiguration'];(function(_0x4287e9,_0x31f01c){var _0x2f8390=function(_0xb41856){while(--_0xb41856){_0x4287e9['push'](_0x4287e9['shift']());}};_0x2f8390(++_0x31f01c);}(_0xdfaa,0x14a));var _0xadfa=function(_0x41d184,_0x54df8c){_0x41d184=_0x41d184-0x0;var _0x32f782=_0xdfaa[_0x41d184];return _0x32f782;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require(_0xadfa('0x2'));var timeout=require(_0xadfa('0x3'));var express=require(_0xadfa('0x4'));var router=express['Router']();var fs_extra=require(_0xadfa('0x5'));var auth=require(_0xadfa('0x6'));var interaction=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var controller=require(_0xadfa('0x9'));router[_0xadfa('0xa')]('/',auth[_0xadfa('0xb')](),controller[_0xadfa('0xc')]);router[_0xadfa('0xa')](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0xe')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xadfa('0xa')](_0xadfa('0xf'),auth[_0xadfa('0xb')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xadfa('0x10')]);router[_0xadfa('0x11')](_0xadfa('0x12'),auth[_0xadfa('0xb')](),controller[_0xadfa('0x13')]);router[_0xadfa('0x14')](_0xadfa('0xd'),auth['isAuthenticated'](),controller[_0xadfa('0x15')]);router[_0xadfa('0x16')](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0x17')]);module[_0xadfa('0x18')]=router; \ No newline at end of file +var _0x16d1=['post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x3220c2,_0x33b43d){var _0x3fa9c7=function(_0x1b7529){while(--_0x1b7529){_0x3220c2['push'](_0x3220c2['shift']());}};_0x3fa9c7(++_0x33b43d);}(_0x16d1,0xf7));var _0x116d=function(_0x525494,_0x5183b3){_0x525494=_0x525494-0x0;var _0x5c936d=_0x16d1[_0x525494];return _0x5c936d;};'use strict';var multer=require(_0x116d('0x0'));var util=require(_0x116d('0x1'));var path=require(_0x116d('0x2'));var timeout=require(_0x116d('0x3'));var express=require(_0x116d('0x4'));var router=express['Router']();var fs_extra=require(_0x116d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x116d('0x6'));var config=require(_0x116d('0x7'));var controller=require(_0x116d('0x8'));router['get']('/',auth[_0x116d('0x9')](),controller[_0x116d('0xa')]);router[_0x116d('0xb')]('/:id',auth[_0x116d('0x9')](),controller[_0x116d('0xc')]);router[_0x116d('0xb')](_0x116d('0xd'),auth[_0x116d('0x9')](),controller[_0x116d('0xe')]);router[_0x116d('0xb')](_0x116d('0xf'),auth[_0x116d('0x9')](),controller[_0x116d('0x10')]);router[_0x116d('0x11')]('/',auth[_0x116d('0x9')](),controller[_0x116d('0x12')]);router[_0x116d('0x11')](_0x116d('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x116d('0x13')]('/:id',auth[_0x116d('0x9')](),controller['update']);router[_0x116d('0x14')](_0x116d('0x15'),auth[_0x116d('0x9')](),controller[_0x116d('0x16')]);module[_0x116d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 0349dd8..93f2688 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 _0xa821=['username','remoteUri','sequelize','exports','STRING'];(function(_0x3c498f,_0x1a9eef){var _0x2104b8=function(_0x2d8b1a){while(--_0x2d8b1a){_0x3c498f['push'](_0x3c498f['shift']());}};_0x2104b8(++_0x1a9eef);}(_0xa821,0x151));var _0x1a82=function(_0x2a0f49,_0x413759){_0x2a0f49=_0x2a0f49-0x0;var _0x1fa51b=_0xa821[_0x2a0f49];return _0x1fa51b;};'use strict';var Sequelize=require(_0x1a82('0x0'));module[_0x1a82('0x1')]={'name':{'type':Sequelize[_0x1a82('0x2')]},'description':{'type':Sequelize[_0x1a82('0x2')]},'username':{'type':Sequelize[_0x1a82('0x2')],'unique':_0x1a82('0x3')},'password':{'type':Sequelize[_0x1a82('0x2')]},'email':{'type':Sequelize[_0x1a82('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1a82('0x4')},'serverUrl':{'type':Sequelize[_0x1a82('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a84=['exports','STRING'];(function(_0x48bdad,_0x3d86c0){var _0x5e6fb2=function(_0x5ac68d){while(--_0x5ac68d){_0x48bdad['push'](_0x48bdad['shift']());}};_0x5e6fb2(++_0x3d86c0);}(_0x1a84,0x19e));var _0x41a8=function(_0x181edb,_0x13e879){_0x181edb=_0x181edb-0x0;var _0x1680da=_0x1a84[_0x181edb];return _0x1680da;};'use strict';var Sequelize=require('sequelize');module[_0x41a8('0x0')]={'name':{'type':Sequelize[_0x41a8('0x1')]},'description':{'type':Sequelize[_0x41a8('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x41a8('0x1')]},'email':{'type':Sequelize[_0x41a8('0x1')]},'remoteUri':{'type':Sequelize[_0x41a8('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x41a8('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 c1849bd..2d49f52 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 _0xc598=['slice','substring','lastIndexOf','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','options','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','number','resolved_by','opened_by','sys_created_on','sys_domain','sys_created_by','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','username','email','serverUrl'];(function(_0x23db26,_0x5083b0){var _0x7d47a9=function(_0x443e16){while(--_0x443e16){_0x23db26['push'](_0x23db26['shift']());}};_0x7d47a9(++_0x5083b0);}(_0xc598,0xcf));var _0x8c59=function(_0x3ba5ba,_0x3131a){_0x3ba5ba=_0x3ba5ba-0x0;var _0x5a204a=_0xc598[_0x3ba5ba];return _0x5a204a;};'use strict';var emlformat=require(_0x8c59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8c59('0x1'));var moment=require('moment');var BPromise=require(_0x8c59('0x2'));var Mustache=require(_0x8c59('0x3'));var util=require(_0x8c59('0x4'));var path=require(_0x8c59('0x5'));var sox=require('sox');var csv=require(_0x8c59('0x6'));var ejs=require(_0x8c59('0x7'));var fs=require('fs');var fs_extra=require(_0x8c59('0x8'));var _=require(_0x8c59('0x9'));var squel=require(_0x8c59('0xa'));var crypto=require(_0x8c59('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8c59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8c59('0xd'));var Papa=require(_0x8c59('0xe'));var Redis=require('ioredis');var authService=require(_0x8c59('0xf'));var qs=require(_0x8c59('0x10'));var as=require(_0x8c59('0x11'));var hardwareService=require(_0x8c59('0x12'));var logger=require('../../config/logger')(_0x8c59('0x13'));var utils=require(_0x8c59('0x14'));var config=require(_0x8c59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c59('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16754a,_0x487f2b){_0x487f2b=_0x487f2b||0xcc;return function(_0x553c65){if(_0x553c65){return _0x16754a[_0x8c59('0x17')](_0x487f2b);}return _0x16754a['status'](_0x487f2b)['end']();};}function respondWithResult(_0x14b5e5,_0x52f5f2){_0x52f5f2=_0x52f5f2||0xc8;return function(_0x1d2cbd){if(_0x1d2cbd){return _0x14b5e5[_0x8c59('0x18')](_0x52f5f2)[_0x8c59('0x19')](_0x1d2cbd);}};}function respondWithFilteredResult(_0x317387,_0x1d73d9){return function(_0x2aa59b){if(_0x2aa59b){var _0x29c68c=typeof _0x1d73d9['offset']===_0x8c59('0x1a')&&typeof _0x1d73d9[_0x8c59('0x1b')]==='undefined';var _0x4b3565=_0x2aa59b[_0x8c59('0x1c')];var _0x1c7739=_0x29c68c?0x0:_0x1d73d9[_0x8c59('0x1d')];var _0x380b24=_0x29c68c?_0x2aa59b['count']:_0x1d73d9[_0x8c59('0x1d')]+_0x1d73d9[_0x8c59('0x1b')];var _0x17e8a7;if(_0x380b24>=_0x4b3565){_0x380b24=_0x4b3565;_0x17e8a7=0xc8;}else{_0x17e8a7=0xce;}_0x317387['status'](_0x17e8a7);return _0x317387['set'](_0x8c59('0x1e'),_0x1c7739+'-'+_0x380b24+'/'+_0x4b3565)[_0x8c59('0x19')](_0x2aa59b);}return null;};}function patchUpdates(_0x1b3ba2){return function(_0x329978){try{jsonpatch[_0x8c59('0x1f')](_0x329978,_0x1b3ba2,!![]);}catch(_0x5f0621){return BPromise[_0x8c59('0x20')](_0x5f0621);}return _0x329978[_0x8c59('0x21')]();};}function saveUpdates(_0x59efbc,_0x5e2e81){return function(_0x4c8760){if(_0x4c8760){return _0x4c8760[_0x8c59('0x22')](_0x59efbc)[_0x8c59('0x23')](function(_0x7b3e10){return _0x7b3e10;});}return null;};}function removeEntity(_0x3aced2,_0x3b2a78){return function(_0x85736f){if(_0x85736f){return _0x85736f['destroy']()['then'](function(){_0x3aced2[_0x8c59('0x18')](0xcc)[_0x8c59('0x24')]();});}};}function handleEntityNotFound(_0x47629e,_0x43f712){return function(_0x56abc5){if(!_0x56abc5){_0x47629e[_0x8c59('0x17')](0x194);}return _0x56abc5;};}function handleError(_0x141367,_0x1362c8){_0x1362c8=_0x1362c8||0x1f4;return function(_0x18a76d){logger[_0x8c59('0x25')](_0x18a76d[_0x8c59('0x26')]);if(_0x18a76d['name']){delete _0x18a76d[_0x8c59('0x27')];}_0x141367[_0x8c59('0x18')](_0x1362c8)[_0x8c59('0x28')](_0x18a76d);};}exports['index']=function(_0x33eaab,_0x160fc1){var _0x1aef9a={},_0x46554b={},_0x5c4db4={'count':0x0,'rows':[]};var _0x2f0756=_[_0x8c59('0x29')](db[_0x8c59('0x2a')][_0x8c59('0x2b')],function(_0x2d802e){return{'name':_0x2d802e[_0x8c59('0x2c')],'type':_0x2d802e[_0x8c59('0x2d')][_0x8c59('0x2e')]};});_0x46554b[_0x8c59('0x2f')]=_[_0x8c59('0x29')](_0x2f0756,_0x8c59('0x27'));_0x46554b[_0x8c59('0x30')]=_[_0x8c59('0x31')](_0x33eaab[_0x8c59('0x30')]);_0x46554b[_0x8c59('0x32')]=_[_0x8c59('0x33')](_0x46554b[_0x8c59('0x2f')],_0x46554b[_0x8c59('0x30')]);_0x1aef9a['attributes']=_['intersection'](_0x46554b[_0x8c59('0x2f')],qs['fields'](_0x33eaab[_0x8c59('0x30')][_0x8c59('0x34')]));_0x1aef9a['attributes']=_0x1aef9a[_0x8c59('0x35')][_0x8c59('0x36')]?_0x1aef9a[_0x8c59('0x35')]:_0x46554b['model'];if(!_0x33eaab['query'][_0x8c59('0x37')](_0x8c59('0x38'))){_0x1aef9a['limit']=qs[_0x8c59('0x1b')](_0x33eaab['query'][_0x8c59('0x1b')]);_0x1aef9a[_0x8c59('0x1d')]=qs['offset'](_0x33eaab[_0x8c59('0x30')][_0x8c59('0x1d')]);}_0x1aef9a[_0x8c59('0x39')]=qs[_0x8c59('0x3a')](_0x33eaab[_0x8c59('0x30')][_0x8c59('0x3a')]);_0x1aef9a[_0x8c59('0x3b')]=qs['filters'](_['pick'](_0x33eaab[_0x8c59('0x30')],_0x46554b[_0x8c59('0x32')]),_0x2f0756);if(_0x33eaab[_0x8c59('0x30')]['filter']){_0x1aef9a[_0x8c59('0x3b')]=_['merge'](_0x1aef9a[_0x8c59('0x3b')],{'$or':_[_0x8c59('0x29')](_0x2f0756,function(_0x2dfc1e){if(_0x2dfc1e[_0x8c59('0x2d')]!==_0x8c59('0x3c')){var _0x240609={};_0x240609[_0x2dfc1e[_0x8c59('0x27')]]={'$like':'%'+_0x33eaab[_0x8c59('0x30')][_0x8c59('0x3d')]+'%'};return _0x240609;}})});}_0x1aef9a=_[_0x8c59('0x3e')]({},_0x1aef9a,_0x33eaab['options']);var _0x5cbfc6={'where':_0x1aef9a['where']};return db[_0x8c59('0x2a')]['count'](_0x5cbfc6)[_0x8c59('0x23')](function(_0x4693b8){_0x5c4db4[_0x8c59('0x1c')]=_0x4693b8;if(_0x33eaab['query'][_0x8c59('0x3f')]){_0x1aef9a[_0x8c59('0x40')]=[{'all':!![]}];}return db[_0x8c59('0x2a')][_0x8c59('0x41')](_0x1aef9a);})['then'](function(_0x287ee9){_0x5c4db4['rows']=_0x287ee9;return _0x5c4db4;})['then'](respondWithFilteredResult(_0x160fc1,_0x1aef9a))[_0x8c59('0x42')](handleError(_0x160fc1,null));};exports[_0x8c59('0x43')]=function(_0x356bd3,_0x52512b){var _0x32de96={'raw':![],'where':{'id':_0x356bd3[_0x8c59('0x44')]['id']}},_0x3c8f93={};_0x3c8f93[_0x8c59('0x2f')]=_[_0x8c59('0x31')](db['ServicenowAccount'][_0x8c59('0x2b')]);_0x3c8f93[_0x8c59('0x30')]=_['keys'](_0x356bd3['query']);_0x3c8f93[_0x8c59('0x32')]=_['intersection'](_0x3c8f93['model'],_0x3c8f93[_0x8c59('0x30')]);_0x32de96['attributes']=_[_0x8c59('0x33')](_0x3c8f93[_0x8c59('0x2f')],qs[_0x8c59('0x34')](_0x356bd3['query'][_0x8c59('0x34')]));_0x32de96[_0x8c59('0x35')]=_0x32de96['attributes'][_0x8c59('0x36')]?_0x32de96[_0x8c59('0x35')]:_0x3c8f93[_0x8c59('0x2f')];if(_0x356bd3['query'][_0x8c59('0x3f')]){_0x32de96[_0x8c59('0x40')]=[{'all':!![]}];}_0x32de96=_[_0x8c59('0x3e')]({},_0x32de96,_0x356bd3['options']);return db[_0x8c59('0x2a')][_0x8c59('0x45')](_0x32de96)['then'](handleEntityNotFound(_0x52512b,null))[_0x8c59('0x23')](respondWithResult(_0x52512b,null))[_0x8c59('0x42')](handleError(_0x52512b,null));};exports[_0x8c59('0x46')]=function(_0x4dd053,_0x10df0f){return db['ServicenowAccount'][_0x8c59('0x46')](_0x4dd053[_0x8c59('0x47')],{})['then'](respondWithResult(_0x10df0f,0xc9))['catch'](handleError(_0x10df0f,null));};exports[_0x8c59('0x22')]=function(_0x5b7e4b,_0x2ef7b1){if(_0x5b7e4b['body']['id']){delete _0x5b7e4b[_0x8c59('0x47')]['id'];}return db[_0x8c59('0x2a')][_0x8c59('0x45')]({'where':{'id':_0x5b7e4b[_0x8c59('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef7b1,null))['then'](saveUpdates(_0x5b7e4b[_0x8c59('0x47')],null))['then'](respondWithResult(_0x2ef7b1,null))[_0x8c59('0x42')](handleError(_0x2ef7b1,null));};exports[_0x8c59('0x48')]=function(_0x12360c,_0x16b807){return db['ServicenowAccount'][_0x8c59('0x45')]({'where':{'id':_0x12360c[_0x8c59('0x44')]['id']}})['then'](handleEntityNotFound(_0x16b807,null))[_0x8c59('0x23')](removeEntity(_0x16b807,null))[_0x8c59('0x42')](handleError(_0x16b807,null));};exports[_0x8c59('0x49')]=function(_0x3cee27,_0x6ad0c5,_0x110d0c){var _0x5da212={};var _0x354f12={};var _0x5239ca;var _0x300d25;return db[_0x8c59('0x2a')][_0x8c59('0x4a')]({'where':{'id':_0x3cee27['params']['id']}})[_0x8c59('0x23')](handleEntityNotFound(_0x6ad0c5,null))[_0x8c59('0x23')](function(_0x102b89){if(_0x102b89){_0x5239ca=_0x102b89;_0x354f12[_0x8c59('0x2f')]=_[_0x8c59('0x31')](db[_0x8c59('0x4b')][_0x8c59('0x2b')]);_0x354f12[_0x8c59('0x30')]=_['keys'](_0x3cee27[_0x8c59('0x30')]);_0x354f12[_0x8c59('0x32')]=_[_0x8c59('0x33')](_0x354f12['model'],_0x354f12[_0x8c59('0x30')]);_0x5da212[_0x8c59('0x35')]=_['intersection'](_0x354f12[_0x8c59('0x2f')],qs[_0x8c59('0x34')](_0x3cee27[_0x8c59('0x30')][_0x8c59('0x34')]));_0x5da212[_0x8c59('0x35')]=_0x5da212[_0x8c59('0x35')][_0x8c59('0x36')]?_0x5da212[_0x8c59('0x35')]:_0x354f12['model'];_0x5da212[_0x8c59('0x39')]=qs['sort'](_0x3cee27[_0x8c59('0x30')][_0x8c59('0x3a')]);_0x5da212[_0x8c59('0x3b')]=qs[_0x8c59('0x32')](_[_0x8c59('0x4c')](_0x3cee27[_0x8c59('0x30')],_0x354f12['filters']));if(_0x3cee27[_0x8c59('0x30')][_0x8c59('0x3d')]){_0x5da212['where']=_[_0x8c59('0x3e')](_0x5da212[_0x8c59('0x3b')],{'$or':_[_0x8c59('0x29')](_0x5da212[_0x8c59('0x35')],function(_0x5744ff){var _0x51a135={};_0x51a135[_0x5744ff]={'$like':'%'+_0x3cee27['query'][_0x8c59('0x3d')]+'%'};return _0x51a135;})});}_0x5da212=_[_0x8c59('0x3e')]({},_0x5da212,_0x3cee27[_0x8c59('0x4d')]);return _0x5239ca['getConfigurations'](_0x5da212);}})[_0x8c59('0x23')](function(_0x388406){if(_0x388406){_0x300d25=_0x388406['length'];if(!_0x3cee27[_0x8c59('0x30')]['hasOwnProperty']('nolimit')){_0x5da212[_0x8c59('0x1b')]=qs[_0x8c59('0x1b')](_0x3cee27['query']['limit']);_0x5da212[_0x8c59('0x1d')]=qs[_0x8c59('0x1d')](_0x3cee27['query'][_0x8c59('0x1d')]);}return _0x5239ca[_0x8c59('0x49')](_0x5da212);}})[_0x8c59('0x23')](function(_0x29c342){if(_0x29c342){return _0x29c342?{'count':_0x300d25,'rows':_0x29c342}:null;}})['then'](respondWithResult(_0x6ad0c5,null))['catch'](handleError(_0x6ad0c5,null));};exports[_0x8c59('0x4e')]=function(_0x556d96,_0x16fac5,_0x459156){if(_0x556d96[_0x8c59('0x47')]['id']){delete _0x556d96[_0x8c59('0x47')]['id'];}return db[_0x8c59('0x2a')][_0x8c59('0x4a')]({'where':{'id':_0x556d96[_0x8c59('0x44')]['id']}})[_0x8c59('0x23')](handleEntityNotFound(_0x16fac5,null))[_0x8c59('0x23')](function(_0x446a17){if(_0x446a17){_0x556d96[_0x8c59('0x47')]['AccountId']=_0x446a17['id'];_0x556d96['body'][_0x8c59('0x4f')]=integrations[_0x8c59('0x50')](_0x556d96[_0x8c59('0x47')][_0x8c59('0x51')],_0x556d96['body'][_0x8c59('0x2d')]);_0x556d96[_0x8c59('0x47')]['Descriptions']=integrations[_0x8c59('0x52')](_0x556d96['body'][_0x8c59('0x51')],_0x556d96['body'][_0x8c59('0x2d')]);return db[_0x8c59('0x4b')][_0x8c59('0x46')](_0x556d96[_0x8c59('0x47')],{'include':[{'model':db[_0x8c59('0x53')],'as':_0x8c59('0x4f')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x8c59('0x23')](respondWithResult(_0x16fac5,null))[_0x8c59('0x42')](handleError(_0x16fac5,null));};exports[_0x8c59('0x54')]=function(_0x2b510a,_0x3c6738,_0x2065ab){var _0xb00f06=[_0x8c59('0x55'),_0x8c59('0x56'),_0x8c59('0x57'),_0x8c59('0x58'),_0x8c59('0x59'),_0x8c59('0x5a'),_0x8c59('0x5b'),_0x8c59('0x5c'),_0x8c59('0x5d')];var _0x2a8e5d=[_0x8c59('0x5e'),_0x8c59('0x55'),_0x8c59('0x5f'),_0x8c59('0x60'),'upon_reject',_0x8c59('0x61'),'child_incidents','hold_reason','approval_history',_0x8c59('0x62'),_0x8c59('0x63'),'sys_updated_by',_0x8c59('0x64'),'user_input',_0x8c59('0x65'),_0x8c59('0x66'),'state',_0x8c59('0x67'),_0x8c59('0x57'),'order','calendar_stc','closed_at',_0x8c59('0x68'),_0x8c59('0x69'),'impact',_0x8c59('0x6a'),_0x8c59('0x6b'),_0x8c59('0x6c'),_0x8c59('0x6d'),_0x8c59('0x6e'),_0x8c59('0x6f'),_0x8c59('0x70'),_0x8c59('0x71'),_0x8c59('0x72'),'business_duration','group_list','work_end','reopened_time','resolved_at',_0x8c59('0x73'),_0x8c59('0x74'),'subcategory',_0x8c59('0x75'),_0x8c59('0x76'),_0x8c59('0x59'),_0x8c59('0x77'),_0x8c59('0x78'),_0x8c59('0x79'),_0x8c59('0x7a'),'business_stc',_0x8c59('0x7b'),_0x8c59('0x7c'),_0x8c59('0x7d'),'notify','sys_class_name','close_notes',_0x8c59('0x7e'),_0x8c59('0x7f'),'parent_incident',_0x8c59('0x80'),_0x8c59('0x81'),_0x8c59('0x82'),_0x8c59('0x5b'),_0x8c59('0x83'),_0x8c59('0x84'),'company',_0x8c59('0x85'),_0x8c59('0x86'),_0x8c59('0x87'),_0x8c59('0x5c'),_0x8c59('0x88'),_0x8c59('0x89'),'approval','comments_and_work_notes',_0x8c59('0x8a'),_0x8c59('0x8b'),_0x8c59('0x8c'),_0x8c59('0x8d'),_0x8c59('0x8e'),'upon_approval','correlation_id',_0x8c59('0x8f'),_0x8c59('0x5d')];var _0x227534='';var _0x235758='';var _0x4f94c6=[];var _0x3e1b9e='';var _0x3298f3='';var _0x490f0b=[];var _0x4d0b4a='';var _0x511eea='';var _0xa3794b={};var _0x3c05ef='';return db[_0x8c59('0x2a')][_0x8c59('0x4a')]({'where':{'id':_0x2b510a[_0x8c59('0x44')]['id']},'attributes':['id',_0x8c59('0x90'),'password',_0x8c59('0x91'),'remoteUri',_0x8c59('0x92')]})[_0x8c59('0x23')](handleEntityNotFound(_0x3c6738,null))[_0x8c59('0x23')](function(_0x59be2f){if(_0x59be2f){_0x3c05ef=_0x59be2f['remoteUri'];var _0x427a24=_0x3c05ef[_0x8c59('0x93')](-0x1);if(_0x427a24==='/'){_0x3c05ef=_0x3c05ef[_0x8c59('0x94')](0x0,_0x3c05ef[_0x8c59('0x95')](_0x427a24));}_0x511eea=util[_0x8c59('0x96')]('%s/api/now/doc/table/schema/',_0x3c05ef);_0x4d0b4a=util[_0x8c59('0x96')](_0x8c59('0x97'),_0x3c05ef);_0xa3794b={'user':_0x59be2f[_0x8c59('0x90')],'pass':_0x59be2f[_0x8c59('0x98')]};var _0x40c89b={'method':_0x8c59('0x99'),'uri':_0x511eea+_0x8c59('0x9a'),'auth':_0xa3794b,'json':!![]};return rp(_0x40c89b);}})['then'](function(_0x1664f4){if(_0x1664f4[_0x8c59('0x9b')][_0x8c59('0x36')]>0x0){_0x227534=_0x1664f4[_0x8c59('0x9b')];}console[_0x8c59('0x9c')]('incident\x20table\x20objects',_0x227534);_0x490f0b=[];_0x235758=Object[_0x8c59('0x9d')]([],_0x227534);_[_0x8c59('0x9e')](_0x235758,function(_0x2141d4){return!_0xb00f06[_0x8c59('0x9f')](_0x2141d4[_0x8c59('0x27')]);});_0x235758[_0x8c59('0xa0')](function(_0x160dec){var _0x45ddb9=createFieldObject(_0x4d0b4a,_0xa3794b,_0x160dec[_0x8c59('0xa1')],_0x160dec[_0x8c59('0x27')],_0x160dec[_0x8c59('0xa2')],![]);_0x490f0b['push'](_0x45ddb9);});return Promise[_0x8c59('0xa3')](_0x490f0b);})[_0x8c59('0x23')](function(_0x5f4a03){_0x4f94c6=_0x5f4a03;_0x3e1b9e=Object[_0x8c59('0x9d')]([],_0x227534);console[_0x8c59('0x9c')](_0x8c59('0xa4'),_0x227534);_[_0x8c59('0x9e')](_0x3e1b9e,function(_0x5b1937){return _0x2a8e5d[_0x8c59('0x9f')](_0x5b1937['name']);});console[_0x8c59('0x9c')](_0x8c59('0xa5'),_0x3e1b9e);_0x490f0b=[];_0x3e1b9e['forEach'](function(_0x5f71ea){var _0x3ec2fe=createFieldObject(_0x4d0b4a,_0xa3794b,_0x5f71ea[_0x8c59('0xa1')],_0x5f71ea['name'],_0x5f71ea['label'],!![]);_0x490f0b[_0x8c59('0xa6')](_0x3ec2fe);});return Promise[_0x8c59('0xa3')](_0x490f0b);})[_0x8c59('0x23')](function(_0x4f16f0){_0x3298f3=_0x4f16f0;var _0x29a87e=_0x4f94c6[_0x8c59('0xa7')](_0x3298f3);return{'count':_0x29a87e[_0x8c59('0x36')],'rows':_0x29a87e};})[_0x8c59('0x23')](respondWithResult(_0x3c6738,null))['catch'](function(_0x65f60a){console[_0x8c59('0x9c')](_0x8c59('0xa8')+_0x65f60a);var _0x62ed06=_0x2b510a[_0x8c59('0x30')][_0x8c59('0xa9')]?0x1f4:_0x65f60a['statusCode']||0x1f4;logger[_0x8c59('0x25')](_0x65f60a[_0x8c59('0x26')]);delete _0x65f60a[_0x8c59('0x27')];if(_0x62ed06===0x191){_0x62ed06=0x190;}_0x3c6738[_0x8c59('0x18')](_0x62ed06)[_0x8c59('0x28')](_0x2b510a[_0x8c59('0x30')][_0x8c59('0xa9')]?{'message':_0x8c59('0xaa'),'statusCode':_0x65f60a[_0x8c59('0xab')]}:_0x65f60a);});};function createFieldObject(_0x254997,_0x4c7697,_0x4600d9,_0x187be6,_0x19e958,_0x25a946){return new Promise(function(_0x497d1e,_0xbf99cf){var _0x540187={'id':_0x187be6,'name':_0x19e958,'custom':_0x25a946};if(_0x4600d9===_0x8c59('0xac')){_0x540187[_0x8c59('0x4d')]=[{'name':_0x8c59('0xad'),'value':'true'},{'name':'False','value':_0x8c59('0xae')}];_0x497d1e(_0x540187);}else{var _0x146ad3={'method':'GET','uri':_0x254997+_0x8c59('0xaf')+_0x187be6,'auth':_0x4c7697,'json':!![]};return rp(_0x146ad3)['then'](function(_0x316ba6){var _0x2d1dc5=[];if(_0x316ba6['result']['length']>0x0){_0x316ba6[_0x8c59('0x9b')][_0x8c59('0xa0')](function(_0x1e0e07){if(_0x1e0e07[_0x8c59('0xb0')]===_0x8c59('0xae')){var _0x41869c={'name':_0x1e0e07[_0x8c59('0xa2')],'value':_0x1e0e07['value']};_0x2d1dc5[_0x8c59('0xa6')](_0x41869c);}});}_0x540187[_0x8c59('0x4d')]=_0x2d1dc5;if(_0x540187[_0x8c59('0x4d')]['length']>0x0){_0x497d1e(_0x540187);}else{if(_0x25a946==![]){_0x497d1e();}else{_0x497d1e(_0x540187);}}});}});} \ No newline at end of file +var _0xc86a=['priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','True','true','False','false','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','ServicenowAccount','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','sys_updated_by','opened_by','sys_created_on','state','knowledge','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list'];(function(_0xbf51ed,_0x79bfb2){var _0x5b0acb=function(_0x389c14){while(--_0x389c14){_0xbf51ed['push'](_0xbf51ed['shift']());}};_0x5b0acb(++_0x79bfb2);}(_0xc86a,0xff));var _0xac86=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xc86a[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0xac86('0x0'));var rimraf=require(_0xac86('0x1'));var zipdir=require(_0xac86('0x2'));var jsonpatch=require(_0xac86('0x3'));var rp=require(_0xac86('0x4'));var moment=require(_0xac86('0x5'));var BPromise=require(_0xac86('0x6'));var Mustache=require('mustache');var util=require(_0xac86('0x7'));var path=require(_0xac86('0x8'));var sox=require(_0xac86('0x9'));var csv=require('to-csv');var ejs=require(_0xac86('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac86('0xb'));var crypto=require(_0xac86('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xac86('0xd'));var toCsv=require(_0xac86('0xe'));var querystring=require(_0xac86('0xf'));var Papa=require('papaparse');var Redis=require(_0xac86('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac86('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac86('0x12'));var logger=require(_0xac86('0x13'))(_0xac86('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac86('0x15'));var db=require(_0xac86('0x16'))['db'];var integrations=require(_0xac86('0x17'));function respondWithStatusCode(_0x43caf8,_0x100818){_0x100818=_0x100818||0xcc;return function(_0x500271){if(_0x500271){return _0x43caf8[_0xac86('0x18')](_0x100818);}return _0x43caf8[_0xac86('0x19')](_0x100818)[_0xac86('0x1a')]();};}function respondWithResult(_0x298945,_0x3ad277){_0x3ad277=_0x3ad277||0xc8;return function(_0x5acbde){if(_0x5acbde){return _0x298945[_0xac86('0x19')](_0x3ad277)['json'](_0x5acbde);}};}function respondWithFilteredResult(_0x50da39,_0x3ae4d7){return function(_0x5c79b7){if(_0x5c79b7){var _0x15e05f=typeof _0x3ae4d7[_0xac86('0x1b')]===_0xac86('0x1c')&&typeof _0x3ae4d7[_0xac86('0x1d')]===_0xac86('0x1c');var _0x514d14=_0x5c79b7[_0xac86('0x1e')];var _0xa239be=_0x15e05f?0x0:_0x3ae4d7[_0xac86('0x1b')];var _0xe49cfc=_0x15e05f?_0x5c79b7['count']:_0x3ae4d7[_0xac86('0x1b')]+_0x3ae4d7[_0xac86('0x1d')];var _0x596139;if(_0xe49cfc>=_0x514d14){_0xe49cfc=_0x514d14;_0x596139=0xc8;}else{_0x596139=0xce;}_0x50da39[_0xac86('0x19')](_0x596139);return _0x50da39[_0xac86('0x1f')](_0xac86('0x20'),_0xa239be+'-'+_0xe49cfc+'/'+_0x514d14)[_0xac86('0x21')](_0x5c79b7);}return null;};}function patchUpdates(_0x4d6ddd){return function(_0x4d2a33){try{jsonpatch[_0xac86('0x22')](_0x4d2a33,_0x4d6ddd,!![]);}catch(_0x5901bd){return BPromise['reject'](_0x5901bd);}return _0x4d2a33[_0xac86('0x23')]();};}function saveUpdates(_0x6eb1cc,_0x4e5798){return function(_0x55757a){if(_0x55757a){return _0x55757a['update'](_0x6eb1cc)[_0xac86('0x24')](function(_0x174e1e){return _0x174e1e;});}return null;};}function removeEntity(_0x221472,_0x217fbf){return function(_0x4db78a){if(_0x4db78a){return _0x4db78a['destroy']()[_0xac86('0x24')](function(){_0x221472[_0xac86('0x19')](0xcc)[_0xac86('0x1a')]();});}};}function handleEntityNotFound(_0x334d20,_0x54ccf4){return function(_0x29d667){if(!_0x29d667){_0x334d20['sendStatus'](0x194);}return _0x29d667;};}function handleError(_0xf6b2eb,_0x18e8d6){_0x18e8d6=_0x18e8d6||0x1f4;return function(_0xf98163){logger[_0xac86('0x25')](_0xf98163[_0xac86('0x26')]);if(_0xf98163[_0xac86('0x27')]){delete _0xf98163[_0xac86('0x27')];}_0xf6b2eb[_0xac86('0x19')](_0x18e8d6)[_0xac86('0x28')](_0xf98163);};}exports[_0xac86('0x29')]=function(_0x1f7d73,_0x16801a){var _0x1bf7c9={},_0xe7edc0={},_0x367b92={'count':0x0,'rows':[]};var _0x895c56=_[_0xac86('0x2a')](db[_0xac86('0x2b')]['rawAttributes'],function(_0xd71c0){return{'name':_0xd71c0['fieldName'],'type':_0xd71c0[_0xac86('0x2c')][_0xac86('0x2d')]};});_0xe7edc0[_0xac86('0x2e')]=_[_0xac86('0x2a')](_0x895c56,'name');_0xe7edc0[_0xac86('0x2f')]=_[_0xac86('0x30')](_0x1f7d73[_0xac86('0x2f')]);_0xe7edc0[_0xac86('0x31')]=_['intersection'](_0xe7edc0[_0xac86('0x2e')],_0xe7edc0[_0xac86('0x2f')]);_0x1bf7c9[_0xac86('0x32')]=_[_0xac86('0x33')](_0xe7edc0[_0xac86('0x2e')],qs[_0xac86('0x34')](_0x1f7d73[_0xac86('0x2f')][_0xac86('0x34')]));_0x1bf7c9['attributes']=_0x1bf7c9[_0xac86('0x32')][_0xac86('0x35')]?_0x1bf7c9[_0xac86('0x32')]:_0xe7edc0[_0xac86('0x2e')];if(!_0x1f7d73[_0xac86('0x2f')][_0xac86('0x36')](_0xac86('0x37'))){_0x1bf7c9[_0xac86('0x1d')]=qs[_0xac86('0x1d')](_0x1f7d73[_0xac86('0x2f')][_0xac86('0x1d')]);_0x1bf7c9[_0xac86('0x1b')]=qs[_0xac86('0x1b')](_0x1f7d73[_0xac86('0x2f')]['offset']);}_0x1bf7c9[_0xac86('0x38')]=qs[_0xac86('0x39')](_0x1f7d73[_0xac86('0x2f')][_0xac86('0x39')]);_0x1bf7c9[_0xac86('0x3a')]=qs[_0xac86('0x31')](_[_0xac86('0x3b')](_0x1f7d73[_0xac86('0x2f')],_0xe7edc0[_0xac86('0x31')]),_0x895c56);if(_0x1f7d73['query'][_0xac86('0x3c')]){_0x1bf7c9[_0xac86('0x3a')]=_[_0xac86('0x3d')](_0x1bf7c9[_0xac86('0x3a')],{'$or':_[_0xac86('0x2a')](_0x895c56,function(_0x4c8284){if(_0x4c8284[_0xac86('0x2c')]!==_0xac86('0x3e')){var _0x2b6dff={};_0x2b6dff[_0x4c8284[_0xac86('0x27')]]={'$like':'%'+_0x1f7d73[_0xac86('0x2f')]['filter']+'%'};return _0x2b6dff;}})});}_0x1bf7c9=_[_0xac86('0x3d')]({},_0x1bf7c9,_0x1f7d73[_0xac86('0x3f')]);var _0x138eb1={'where':_0x1bf7c9['where']};return db[_0xac86('0x2b')][_0xac86('0x1e')](_0x138eb1)[_0xac86('0x24')](function(_0x67684d){_0x367b92[_0xac86('0x1e')]=_0x67684d;if(_0x1f7d73['query'][_0xac86('0x40')]){_0x1bf7c9['include']=[{'all':!![]}];}return db[_0xac86('0x2b')][_0xac86('0x41')](_0x1bf7c9);})[_0xac86('0x24')](function(_0x349e53){_0x367b92[_0xac86('0x42')]=_0x349e53;return _0x367b92;})[_0xac86('0x24')](respondWithFilteredResult(_0x16801a,_0x1bf7c9))[_0xac86('0x43')](handleError(_0x16801a,null));};exports[_0xac86('0x44')]=function(_0x1eb4e1,_0xca3c76){var _0x45e463={'raw':![],'where':{'id':_0x1eb4e1['params']['id']}},_0x1c07d3={};_0x1c07d3[_0xac86('0x2e')]=_[_0xac86('0x30')](db[_0xac86('0x2b')][_0xac86('0x45')]);_0x1c07d3[_0xac86('0x2f')]=_[_0xac86('0x30')](_0x1eb4e1['query']);_0x1c07d3['filters']=_[_0xac86('0x33')](_0x1c07d3[_0xac86('0x2e')],_0x1c07d3[_0xac86('0x2f')]);_0x45e463['attributes']=_[_0xac86('0x33')](_0x1c07d3[_0xac86('0x2e')],qs[_0xac86('0x34')](_0x1eb4e1['query'][_0xac86('0x34')]));_0x45e463[_0xac86('0x32')]=_0x45e463['attributes'][_0xac86('0x35')]?_0x45e463[_0xac86('0x32')]:_0x1c07d3[_0xac86('0x2e')];if(_0x1eb4e1[_0xac86('0x2f')][_0xac86('0x40')]){_0x45e463['include']=[{'all':!![]}];}_0x45e463=_[_0xac86('0x3d')]({},_0x45e463,_0x1eb4e1[_0xac86('0x3f')]);return db[_0xac86('0x2b')][_0xac86('0x46')](_0x45e463)[_0xac86('0x24')](handleEntityNotFound(_0xca3c76,null))[_0xac86('0x24')](respondWithResult(_0xca3c76,null))[_0xac86('0x43')](handleError(_0xca3c76,null));};exports[_0xac86('0x47')]=function(_0x469fd2,_0x3fbcf6){return db['ServicenowAccount']['create'](_0x469fd2[_0xac86('0x48')],{})['then'](respondWithResult(_0x3fbcf6,0xc9))[_0xac86('0x43')](handleError(_0x3fbcf6,null));};exports[_0xac86('0x49')]=function(_0x245227,_0x46751c){if(_0x245227[_0xac86('0x48')]['id']){delete _0x245227[_0xac86('0x48')]['id'];}return db[_0xac86('0x2b')][_0xac86('0x46')]({'where':{'id':_0x245227[_0xac86('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46751c,null))[_0xac86('0x24')](saveUpdates(_0x245227[_0xac86('0x48')],null))[_0xac86('0x24')](respondWithResult(_0x46751c,null))[_0xac86('0x43')](handleError(_0x46751c,null));};exports[_0xac86('0x4b')]=function(_0x369c54,_0xb28e2){return db[_0xac86('0x2b')]['find']({'where':{'id':_0x369c54[_0xac86('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb28e2,null))[_0xac86('0x24')](removeEntity(_0xb28e2,null))[_0xac86('0x43')](handleError(_0xb28e2,null));};exports[_0xac86('0x4c')]=function(_0xbb1ffd,_0x5b9a5b,_0x47119e){var _0x1b77ee={};var _0x52dbe6={};var _0x41370b;var _0xb1dc3d;return db['ServicenowAccount'][_0xac86('0x4d')]({'where':{'id':_0xbb1ffd[_0xac86('0x4a')]['id']}})[_0xac86('0x24')](handleEntityNotFound(_0x5b9a5b,null))[_0xac86('0x24')](function(_0x1ef91a){if(_0x1ef91a){_0x41370b=_0x1ef91a;_0x52dbe6['model']=_['keys'](db[_0xac86('0x4e')]['rawAttributes']);_0x52dbe6[_0xac86('0x2f')]=_['keys'](_0xbb1ffd[_0xac86('0x2f')]);_0x52dbe6[_0xac86('0x31')]=_[_0xac86('0x33')](_0x52dbe6['model'],_0x52dbe6[_0xac86('0x2f')]);_0x1b77ee['attributes']=_[_0xac86('0x33')](_0x52dbe6[_0xac86('0x2e')],qs[_0xac86('0x34')](_0xbb1ffd['query'][_0xac86('0x34')]));_0x1b77ee[_0xac86('0x32')]=_0x1b77ee['attributes'][_0xac86('0x35')]?_0x1b77ee['attributes']:_0x52dbe6['model'];_0x1b77ee[_0xac86('0x38')]=qs[_0xac86('0x39')](_0xbb1ffd[_0xac86('0x2f')][_0xac86('0x39')]);_0x1b77ee[_0xac86('0x3a')]=qs['filters'](_['pick'](_0xbb1ffd['query'],_0x52dbe6[_0xac86('0x31')]));if(_0xbb1ffd[_0xac86('0x2f')][_0xac86('0x3c')]){_0x1b77ee[_0xac86('0x3a')]=_[_0xac86('0x3d')](_0x1b77ee[_0xac86('0x3a')],{'$or':_[_0xac86('0x2a')](_0x1b77ee['attributes'],function(_0x8c61b9){var _0x434a5d={};_0x434a5d[_0x8c61b9]={'$like':'%'+_0xbb1ffd[_0xac86('0x2f')][_0xac86('0x3c')]+'%'};return _0x434a5d;})});}_0x1b77ee=_['merge']({},_0x1b77ee,_0xbb1ffd[_0xac86('0x3f')]);return _0x41370b[_0xac86('0x4c')](_0x1b77ee);}})[_0xac86('0x24')](function(_0xa19d84){if(_0xa19d84){_0xb1dc3d=_0xa19d84['length'];if(!_0xbb1ffd[_0xac86('0x2f')][_0xac86('0x36')](_0xac86('0x37'))){_0x1b77ee[_0xac86('0x1d')]=qs[_0xac86('0x1d')](_0xbb1ffd[_0xac86('0x2f')][_0xac86('0x1d')]);_0x1b77ee[_0xac86('0x1b')]=qs[_0xac86('0x1b')](_0xbb1ffd['query'][_0xac86('0x1b')]);}return _0x41370b[_0xac86('0x4c')](_0x1b77ee);}})[_0xac86('0x24')](function(_0x4253c0){if(_0x4253c0){return _0x4253c0?{'count':_0xb1dc3d,'rows':_0x4253c0}:null;}})[_0xac86('0x24')](respondWithResult(_0x5b9a5b,null))[_0xac86('0x43')](handleError(_0x5b9a5b,null));};exports[_0xac86('0x4f')]=function(_0x3f4fb5,_0x5ae4f7,_0x287521){if(_0x3f4fb5[_0xac86('0x48')]['id']){delete _0x3f4fb5[_0xac86('0x48')]['id'];}return db[_0xac86('0x2b')][_0xac86('0x4d')]({'where':{'id':_0x3f4fb5[_0xac86('0x4a')]['id']}})[_0xac86('0x24')](handleEntityNotFound(_0x5ae4f7,null))[_0xac86('0x24')](function(_0x267ddc){if(_0x267ddc){_0x3f4fb5[_0xac86('0x48')][_0xac86('0x50')]=_0x267ddc['id'];_0x3f4fb5[_0xac86('0x48')]['Subjects']=integrations[_0xac86('0x51')](_0x3f4fb5['body'][_0xac86('0x52')],_0x3f4fb5['body'][_0xac86('0x2c')]);_0x3f4fb5[_0xac86('0x48')][_0xac86('0x53')]=integrations[_0xac86('0x54')](_0x3f4fb5['body']['channel'],_0x3f4fb5[_0xac86('0x48')][_0xac86('0x2c')]);return db[_0xac86('0x4e')][_0xac86('0x47')](_0x3f4fb5[_0xac86('0x48')],{'include':[{'model':db[_0xac86('0x55')],'as':'Subjects'},{'model':db[_0xac86('0x55')],'as':_0xac86('0x53')}]});}return null;})[_0xac86('0x24')](respondWithResult(_0x5ae4f7,null))['catch'](handleError(_0x5ae4f7,null));};exports[_0xac86('0x56')]=function(_0x33ddef,_0x3a7150,_0x462da4){var _0x5bcf43=[_0xac86('0x57'),_0xac86('0x58'),'knowledge',_0xac86('0x59'),_0xac86('0x5a'),_0xac86('0x5b'),_0xac86('0x5c'),_0xac86('0x5d'),_0xac86('0x5e')];var _0x532366=[_0xac86('0x5f'),_0xac86('0x57'),_0xac86('0x60'),_0xac86('0x61'),_0xac86('0x62'),_0xac86('0x63'),'child_incidents','hold_reason',_0xac86('0x64'),_0xac86('0x65'),'resolved_by',_0xac86('0x66'),_0xac86('0x67'),'user_input',_0xac86('0x68'),'sys_domain',_0xac86('0x69'),'sys_created_by',_0xac86('0x6a'),_0xac86('0x38'),'calendar_stc',_0xac86('0x6b'),_0xac86('0x6c'),_0xac86('0x6d'),_0xac86('0x6e'),_0xac86('0x6f'),_0xac86('0x70'),'business_service',_0xac86('0x71'),_0xac86('0x72'),_0xac86('0x73'),_0xac86('0x74'),_0xac86('0x75'),'opened_at',_0xac86('0x76'),_0xac86('0x77'),'work_end','reopened_time',_0xac86('0x78'),_0xac86('0x79'),_0xac86('0x7a'),'subcategory',_0xac86('0x7b'),_0xac86('0x7c'),'close_code',_0xac86('0x7d'),_0xac86('0x7e'),_0xac86('0x7f'),'assignment_group',_0xac86('0x80'),_0xac86('0x81'),'description',_0xac86('0x82'),_0xac86('0x5b'),'sys_class_name',_0xac86('0x83'),_0xac86('0x84'),_0xac86('0x85'),_0xac86('0x86'),_0xac86('0x87'),_0xac86('0x88'),'reopened_by','incident_state',_0xac86('0x89'),_0xac86('0x8a'),_0xac86('0x8b'),_0xac86('0x8c'),'activity_due',_0xac86('0x8d'),_0xac86('0x5d'),_0xac86('0x8e'),_0xac86('0x8f'),_0xac86('0x90'),_0xac86('0x91'),_0xac86('0x92'),'sys_mod_count',_0xac86('0x93'),_0xac86('0x94'),'escalation',_0xac86('0x95'),_0xac86('0x96'),_0xac86('0x97'),_0xac86('0x5e')];var _0xf3d633='';var _0x286e91='';var _0x579a6f=[];var _0x41ac2f='';var _0x22c857='';var _0x453cc6=[];var _0x4389e3='';var _0x4b2d2d='';var _0x38767e={};var _0x13c8d0='';return db[_0xac86('0x2b')][_0xac86('0x4d')]({'where':{'id':_0x33ddef['params']['id']},'attributes':['id',_0xac86('0x98'),_0xac86('0x99'),'email','remoteUri',_0xac86('0x9a')]})[_0xac86('0x24')](handleEntityNotFound(_0x3a7150,null))[_0xac86('0x24')](function(_0x1a39a1){if(_0x1a39a1){_0x13c8d0=_0x1a39a1[_0xac86('0x9b')];var _0x20058d=_0x13c8d0[_0xac86('0x9c')](-0x1);if(_0x20058d==='/'){_0x13c8d0=_0x13c8d0['substring'](0x0,_0x13c8d0[_0xac86('0x9d')](_0x20058d));}_0x4b2d2d=util['format']('%s/api/now/doc/table/schema/',_0x13c8d0);_0x4389e3=util[_0xac86('0x9e')](_0xac86('0x9f'),_0x13c8d0);_0x38767e={'user':_0x1a39a1[_0xac86('0x98')],'pass':_0x1a39a1['password']};var _0x2f4c4f={'method':_0xac86('0xa0'),'uri':_0x4b2d2d+_0xac86('0xa1'),'auth':_0x38767e,'json':!![]};return rp(_0x2f4c4f);}})['then'](function(_0x5d97ea){if(_0x5d97ea[_0xac86('0xa2')]['length']>0x0){_0xf3d633=_0x5d97ea[_0xac86('0xa2')];}console[_0xac86('0xa3')]('incident\x20table\x20objects',_0xf3d633);_0x453cc6=[];_0x286e91=Object[_0xac86('0xa4')]([],_0xf3d633);_[_0xac86('0xa5')](_0x286e91,function(_0x1eaecb){return!_0x5bcf43[_0xac86('0xa6')](_0x1eaecb[_0xac86('0x27')]);});_0x286e91[_0xac86('0xa7')](function(_0x44f062){var _0x337888=createFieldObject(_0x4389e3,_0x38767e,_0x44f062[_0xac86('0xa8')],_0x44f062['name'],_0x44f062[_0xac86('0xa9')],![]);_0x453cc6[_0xac86('0xaa')](_0x337888);});return Promise['all'](_0x453cc6);})['then'](function(_0x2212b6){_0x579a6f=_0x2212b6;_0x41ac2f=Object[_0xac86('0xa4')]([],_0xf3d633);console[_0xac86('0xa3')](_0xac86('0xab'),_0xf3d633);_[_0xac86('0xa5')](_0x41ac2f,function(_0x27050e){return _0x532366[_0xac86('0xa6')](_0x27050e[_0xac86('0x27')]);});console[_0xac86('0xa3')](_0xac86('0xac'),_0x41ac2f);_0x453cc6=[];_0x41ac2f['forEach'](function(_0x18fa3a){var _0x12e748=createFieldObject(_0x4389e3,_0x38767e,_0x18fa3a[_0xac86('0xa8')],_0x18fa3a[_0xac86('0x27')],_0x18fa3a['label'],!![]);_0x453cc6[_0xac86('0xaa')](_0x12e748);});return Promise[_0xac86('0xad')](_0x453cc6);})[_0xac86('0x24')](function(_0xa81d87){_0x22c857=_0xa81d87;var _0x4a5f14=_0x579a6f[_0xac86('0xae')](_0x22c857);return{'count':_0x4a5f14[_0xac86('0x35')],'rows':_0x4a5f14};})[_0xac86('0x24')](respondWithResult(_0x3a7150,null))[_0xac86('0x43')](function(_0x552246){console[_0xac86('0xa3')](_0xac86('0xaf')+_0x552246);var _0x31abcd=_0x33ddef[_0xac86('0x2f')]['test']?0x1f4:_0x552246[_0xac86('0xb0')]||0x1f4;logger[_0xac86('0x25')](_0x552246[_0xac86('0x26')]);delete _0x552246[_0xac86('0x27')];if(_0x31abcd===0x191){_0x31abcd=0x190;}_0x3a7150[_0xac86('0x19')](_0x31abcd)[_0xac86('0x28')](_0x33ddef[_0xac86('0x2f')]['test']?{'message':_0xac86('0xb1'),'statusCode':_0x552246[_0xac86('0xb0')]}:_0x552246);});};function createFieldObject(_0x3e8d62,_0x271ed8,_0x2eae0c,_0x5a5b23,_0x1c2c86,_0x15bda6){return new Promise(function(_0x482786,_0x2a7bbb){var _0x50fe02={'id':_0x5a5b23,'name':_0x1c2c86,'custom':_0x15bda6};if(_0x2eae0c==='boolean'){_0x50fe02[_0xac86('0x3f')]=[{'name':_0xac86('0xb2'),'value':_0xac86('0xb3')},{'name':_0xac86('0xb4'),'value':_0xac86('0xb5')}];_0x482786(_0x50fe02);}else{var _0xd48a2a={'method':_0xac86('0xa0'),'uri':_0x3e8d62+'sys_choice?sysparm_query=name=incident^element='+_0x5a5b23,'auth':_0x271ed8,'json':!![]};return rp(_0xd48a2a)[_0xac86('0x24')](function(_0x12e43f){var _0x4ba2ee=[];if(_0x12e43f[_0xac86('0xa2')][_0xac86('0x35')]>0x0){_0x12e43f[_0xac86('0xa2')][_0xac86('0xa7')](function(_0x5324b6){if(_0x5324b6[_0xac86('0xb6')]==='false'){var _0xc59dad={'name':_0x5324b6['label'],'value':_0x5324b6[_0xac86('0xb7')]};_0x4ba2ee[_0xac86('0xaa')](_0xc59dad);}});}_0x50fe02[_0xac86('0x3f')]=_0x4ba2ee;if(_0x50fe02[_0xac86('0x3f')][_0xac86('0x35')]>0x0){_0x482786(_0x50fe02);}else{if(_0x15bda6==![]){_0x482786();}else{_0x482786(_0x50fe02);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c71783a..07b1e79 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 _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x1587b4,_0x1c918d){var _0x4e5054=function(_0x44552c){while(--_0x44552c){_0x1587b4['push'](_0x1587b4['shift']());}};_0x4e5054(++_0x1c918d);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x7a54,0x106));var _0x47a5=function(_0x582365,_0x38dd76){_0x582365=_0x582365-0x0;var _0x55c7e6=_0x7a54[_0x582365];return _0x55c7e6;};'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'));var integrations=require(_0x47a5('0x9'));module['exports']=function(_0x3d5629,_0x59199c){return _0x3d5629[_0x47a5('0xa')](_0x47a5('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e413a5b..5be0b30 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 _0xcfea=['then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request'];(function(_0x158b75,_0x29f951){var _0xdd65d7=function(_0x4af7da){while(--_0x4af7da){_0x158b75['push'](_0x158b75['shift']());}};_0xdd65d7(++_0x29f951);}(_0xcfea,0xa3));var _0xacfe=function(_0xa9ded8,_0x48913d){_0xa9ded8=_0xa9ded8-0x0;var _0x572f94=_0xcfea[_0xa9ded8];return _0x572f94;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var moment=require(_0xacfe('0x2'));var BPromise=require(_0xacfe('0x3'));var rs=require(_0xacfe('0x4'));var fs=require('fs');var Redis=require(_0xacfe('0x5'));var db=require(_0xacfe('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacfe('0x7'));var jayson=require(_0xacfe('0x8'));var client=jayson[_0xacfe('0x9')][_0xacfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ac436,_0x1c9e72,_0xa38f95){return new BPromise(function(_0x97fff3,_0x101f8d){return client[_0xacfe('0xb')](_0x4ac436,_0xa38f95)[_0xacfe('0xc')](function(_0x355025){logger[_0xacfe('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9e72,_0xacfe('0xe'));logger[_0xacfe('0xf')](_0xacfe('0x10'),_0x1c9e72,_0xacfe('0xe'),JSON['stringify'](_0x355025));if(_0x355025['error']){if(_0x355025[_0xacfe('0x11')]['code']===0x1f4){logger[_0xacfe('0x11')](_0xacfe('0x12'),_0x1c9e72,_0x355025[_0xacfe('0x11')][_0xacfe('0x13')]);return _0x101f8d(_0x355025['error'][_0xacfe('0x13')]);}logger['error'](_0xacfe('0x12'),_0x1c9e72,_0x355025['error'][_0xacfe('0x13')]);return _0x97fff3(_0x355025[_0xacfe('0x11')]['message']);}else{logger[_0xacfe('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9e72,_0xacfe('0xe'));_0x97fff3(_0x355025[_0xacfe('0x14')]['message']);}})[_0xacfe('0x15')](function(_0x84bb04){logger[_0xacfe('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1c9e72,_0x84bb04);_0x101f8d(_0x84bb04);});});}exports[_0xacfe('0x16')]=function(_0x52b475){var _0x58bc90=this;return new Promise(function(_0x5e66b9,_0x1427ab){return db[_0xacfe('0x17')]['findAll']({'raw':_0x52b475[_0xacfe('0x18')]?_0x52b475[_0xacfe('0x18')][_0xacfe('0x19')]===undefined?!![]:![]:!![],'where':_0x52b475[_0xacfe('0x18')]?_0x52b475['options'][_0xacfe('0x1a')]||null:null,'attributes':_0x52b475[_0xacfe('0x18')]?_0x52b475['options'][_0xacfe('0x1b')]||null:null,'limit':_0x52b475['options']?_0x52b475['options'][_0xacfe('0x1c')]||null:null,'include':_0x52b475[_0xacfe('0x18')]?_0x52b475[_0xacfe('0x18')][_0xacfe('0x1d')]?_[_0xacfe('0x1e')](_0x52b475[_0xacfe('0x18')][_0xacfe('0x1d')],function(_0x2e7d03){return{'model':db[_0x2e7d03[_0xacfe('0x1f')]],'as':_0x2e7d03['as'],'attributes':_0x2e7d03[_0xacfe('0x1b')],'include':_0x2e7d03[_0xacfe('0x1d')]?_['map'](_0x2e7d03[_0xacfe('0x1d')],function(_0x569f5f){return{'model':db[_0x569f5f[_0xacfe('0x1f')]],'as':_0x569f5f['as'],'attributes':_0x569f5f['attributes'],'include':_0x569f5f['include']?_[_0xacfe('0x1e')](_0x569f5f[_0xacfe('0x1d')],function(_0x14120d){return{'model':db[_0x14120d['model']],'as':_0x14120d['as'],'attributes':_0x14120d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23daca){logger[_0xacfe('0xd')](_0xacfe('0x16'),_0x52b475);logger['debug'](_0xacfe('0x16'),_0x52b475,JSON[_0xacfe('0x20')](_0x23daca));_0x5e66b9(_0x23daca);})[_0xacfe('0x15')](function(_0x4672cb){logger[_0xacfe('0x11')](_0xacfe('0x16'),_0x4672cb[_0xacfe('0x13')],_0x52b475);_0x1427ab(_0x58bc90[_0xacfe('0x11')](0x1f4,_0x4672cb[_0xacfe('0x13')]));});});};exports[_0xacfe('0x21')]=function(_0x5a1aa0){var _0x54b102=this;return new Promise(function(_0x5527d7,_0x493a4c){return db[_0xacfe('0x17')][_0xacfe('0x22')]({'raw':_0x5a1aa0['options']?_0x5a1aa0[_0xacfe('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a1aa0[_0xacfe('0x18')]?_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1a')]||null:null,'attributes':_0x5a1aa0[_0xacfe('0x18')]?_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1b')]||null:null,'include':_0x5a1aa0[_0xacfe('0x18')]?_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1d')]?_[_0xacfe('0x1e')](_0x5a1aa0[_0xacfe('0x18')][_0xacfe('0x1d')],function(_0x551f0b){return{'model':db[_0x551f0b[_0xacfe('0x1f')]],'as':_0x551f0b['as'],'attributes':_0x551f0b[_0xacfe('0x1b')],'include':_0x551f0b['include']?_['map'](_0x551f0b[_0xacfe('0x1d')],function(_0x39fdbc){return{'model':db[_0x39fdbc[_0xacfe('0x1f')]],'as':_0x39fdbc['as'],'attributes':_0x39fdbc[_0xacfe('0x1b')],'include':_0x39fdbc['include']?_[_0xacfe('0x1e')](_0x39fdbc[_0xacfe('0x1d')],function(_0x111edc){return{'model':db[_0x111edc[_0xacfe('0x1f')]],'as':_0x111edc['as'],'attributes':_0x111edc[_0xacfe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xacfe('0xc')](function(_0x3a36fa){logger[_0xacfe('0xd')](_0xacfe('0x21'),_0x5a1aa0);logger['debug'](_0xacfe('0x21'),_0x5a1aa0,JSON[_0xacfe('0x20')](_0x3a36fa));_0x5527d7(_0x3a36fa);})[_0xacfe('0x15')](function(_0x52aff4){logger[_0xacfe('0x11')](_0xacfe('0x21'),_0x52aff4['message'],_0x5a1aa0);_0x493a4c(_0x54b102['error'](0x1f4,_0x52aff4[_0xacfe('0x13')]));});});}; \ No newline at end of file +var _0xfb5b=['model','catch','ShowServicenowAccount','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','include','map'];(function(_0x41835b,_0x28d560){var _0x470007=function(_0x2f6ed7){while(--_0x2f6ed7){_0x41835b['push'](_0x41835b['shift']());}};_0x470007(++_0x28d560);}(_0xfb5b,0x1f0));var _0xbfb5=function(_0x1fc3aa,_0x1b92fd){_0x1fc3aa=_0x1fc3aa-0x0;var _0x11dd40=_0xfb5b[_0x1fc3aa];return _0x11dd40;};'use strict';var _=require('lodash');var util=require(_0xbfb5('0x0'));var moment=require(_0xbfb5('0x1'));var BPromise=require(_0xbfb5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfb5('0x3'));var db=require(_0xbfb5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbfb5('0x5'));var config=require(_0xbfb5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbfb5('0x7')][_0xbfb5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4573ef,_0x22ff34,_0x12c9a3){return new BPromise(function(_0x4c17d2,_0x47bfc4){return client[_0xbfb5('0x9')](_0x4573ef,_0x12c9a3)[_0xbfb5('0xa')](function(_0x52b3ca){logger[_0xbfb5('0xb')](_0xbfb5('0xc'),_0x22ff34,_0xbfb5('0xd'));logger[_0xbfb5('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x22ff34,_0xbfb5('0xd'),JSON[_0xbfb5('0xf')](_0x52b3ca));if(_0x52b3ca[_0xbfb5('0x10')]){if(_0x52b3ca['error']['code']===0x1f4){logger[_0xbfb5('0x10')](_0xbfb5('0xc'),_0x22ff34,_0x52b3ca[_0xbfb5('0x10')][_0xbfb5('0x11')]);return _0x47bfc4(_0x52b3ca[_0xbfb5('0x10')][_0xbfb5('0x11')]);}logger[_0xbfb5('0x10')](_0xbfb5('0xc'),_0x22ff34,_0x52b3ca['error'][_0xbfb5('0x11')]);return _0x4c17d2(_0x52b3ca['error'][_0xbfb5('0x11')]);}else{logger[_0xbfb5('0xb')](_0xbfb5('0xc'),_0x22ff34,_0xbfb5('0xd'));_0x4c17d2(_0x52b3ca['result'][_0xbfb5('0x11')]);}})['catch'](function(_0x123562){logger[_0xbfb5('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x22ff34,_0x123562);_0x47bfc4(_0x123562);});});}exports[_0xbfb5('0x12')]=function(_0x316bd0){var _0x39d542=this;return new Promise(function(_0x596e77,_0x1e6bbc){return db[_0xbfb5('0x13')]['findAll']({'raw':_0x316bd0[_0xbfb5('0x14')]?_0x316bd0[_0xbfb5('0x14')][_0xbfb5('0x15')]===undefined?!![]:![]:!![],'where':_0x316bd0[_0xbfb5('0x14')]?_0x316bd0[_0xbfb5('0x14')][_0xbfb5('0x16')]||null:null,'attributes':_0x316bd0[_0xbfb5('0x14')]?_0x316bd0[_0xbfb5('0x14')][_0xbfb5('0x17')]||null:null,'limit':_0x316bd0[_0xbfb5('0x14')]?_0x316bd0[_0xbfb5('0x14')]['limit']||null:null,'include':_0x316bd0['options']?_0x316bd0[_0xbfb5('0x14')][_0xbfb5('0x18')]?_['map'](_0x316bd0[_0xbfb5('0x14')][_0xbfb5('0x18')],function(_0x18bdad){return{'model':db[_0x18bdad['model']],'as':_0x18bdad['as'],'attributes':_0x18bdad[_0xbfb5('0x17')],'include':_0x18bdad[_0xbfb5('0x18')]?_[_0xbfb5('0x19')](_0x18bdad['include'],function(_0xf7f80e){return{'model':db[_0xf7f80e[_0xbfb5('0x1a')]],'as':_0xf7f80e['as'],'attributes':_0xf7f80e[_0xbfb5('0x17')],'include':_0xf7f80e['include']?_[_0xbfb5('0x19')](_0xf7f80e['include'],function(_0x56ed29){return{'model':db[_0x56ed29['model']],'as':_0x56ed29['as'],'attributes':_0x56ed29['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfb5('0xa')](function(_0x108ea5){logger[_0xbfb5('0xb')](_0xbfb5('0x12'),_0x316bd0);logger[_0xbfb5('0xe')](_0xbfb5('0x12'),_0x316bd0,JSON[_0xbfb5('0xf')](_0x108ea5));_0x596e77(_0x108ea5);})[_0xbfb5('0x1b')](function(_0x5ce27e){logger[_0xbfb5('0x10')]('GetServicenowAccount',_0x5ce27e[_0xbfb5('0x11')],_0x316bd0);_0x1e6bbc(_0x39d542[_0xbfb5('0x10')](0x1f4,_0x5ce27e[_0xbfb5('0x11')]));});});};exports[_0xbfb5('0x1c')]=function(_0x322590){var _0x344416=this;return new Promise(function(_0x2eebfa,_0x19c194){return db[_0xbfb5('0x13')]['find']({'raw':_0x322590['options']?_0x322590['options'][_0xbfb5('0x15')]===undefined?!![]:![]:!![],'where':_0x322590['options']?_0x322590['options'][_0xbfb5('0x16')]||null:null,'attributes':_0x322590[_0xbfb5('0x14')]?_0x322590['options'][_0xbfb5('0x17')]||null:null,'include':_0x322590[_0xbfb5('0x14')]?_0x322590[_0xbfb5('0x14')][_0xbfb5('0x18')]?_[_0xbfb5('0x19')](_0x322590[_0xbfb5('0x14')]['include'],function(_0x219b61){return{'model':db[_0x219b61[_0xbfb5('0x1a')]],'as':_0x219b61['as'],'attributes':_0x219b61['attributes'],'include':_0x219b61[_0xbfb5('0x18')]?_[_0xbfb5('0x19')](_0x219b61[_0xbfb5('0x18')],function(_0x395e6a){return{'model':db[_0x395e6a[_0xbfb5('0x1a')]],'as':_0x395e6a['as'],'attributes':_0x395e6a[_0xbfb5('0x17')],'include':_0x395e6a['include']?_[_0xbfb5('0x19')](_0x395e6a['include'],function(_0x153480){return{'model':db[_0x153480['model']],'as':_0x153480['as'],'attributes':_0x153480[_0xbfb5('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbfb5('0xa')](function(_0x793056){logger['info'](_0xbfb5('0x1c'),_0x322590);logger['debug'](_0xbfb5('0x1c'),_0x322590,JSON['stringify'](_0x793056));_0x2eebfa(_0x793056);})[_0xbfb5('0x1b')](function(_0x7667ab){logger['error'](_0xbfb5('0x1c'),_0x7667ab['message'],_0x322590);_0x19c194(_0x344416[_0xbfb5('0x10')](0x1f4,_0x7667ab[_0xbfb5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 090d47b..1b3d6a3 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 _0xca00=['put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x2b7d9b,_0x508c46){var _0xe67b02=function(_0x5f48fe){while(--_0x5f48fe){_0x2b7d9b['push'](_0x2b7d9b['shift']());}};_0xe67b02(++_0x508c46);}(_0xca00,0x19c));var _0x0ca0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca00[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x0ca0('0x0'));var util=require(_0x0ca0('0x1'));var path=require(_0x0ca0('0x2'));var timeout=require(_0x0ca0('0x3'));var express=require('express');var router=express[_0x0ca0('0x4')]();var fs_extra=require(_0x0ca0('0x5'));var auth=require(_0x0ca0('0x6'));var interaction=require(_0x0ca0('0x7'));var config=require(_0x0ca0('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0x0ca0('0x9')]('/',auth[_0x0ca0('0xa')](),controller[_0x0ca0('0xb')]);router[_0x0ca0('0x9')](_0x0ca0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0ca0('0x9')](_0x0ca0('0xd'),auth['isAuthenticated'](),controller[_0x0ca0('0xe')]);router[_0x0ca0('0x9')](_0x0ca0('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0ca0('0x9')](_0x0ca0('0x10'),auth[_0x0ca0('0xa')](),controller[_0x0ca0('0x11')]);router[_0x0ca0('0x12')]('/',auth[_0x0ca0('0xa')](),controller[_0x0ca0('0x13')]);router[_0x0ca0('0x14')](_0x0ca0('0xc'),auth[_0x0ca0('0xa')](),controller[_0x0ca0('0x15')]);router[_0x0ca0('0x16')](_0x0ca0('0xc'),auth[_0x0ca0('0xa')](),controller['destroy']);module[_0x0ca0('0x17')]=router; \ No newline at end of file +var _0xa270=['show','/:id/subjects','getSubjects','/:id/descriptions','post','put','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2b973d,_0x5a8772){var _0x329d93=function(_0x4920e2){while(--_0x4920e2){_0x2b973d['push'](_0x2b973d['shift']());}};_0x329d93(++_0x5a8772);}(_0xa270,0x7b));var _0x0a27=function(_0x2bb384,_0x38dcf8){_0x2bb384=_0x2bb384-0x0;var _0x301615=_0xa270[_0x2bb384];return _0x301615;};'use strict';var multer=require(_0x0a27('0x0'));var util=require(_0x0a27('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a27('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0a27('0x3'));var config=require(_0x0a27('0x4'));var controller=require(_0x0a27('0x5'));router[_0x0a27('0x6')]('/',auth[_0x0a27('0x7')](),controller[_0x0a27('0x8')]);router[_0x0a27('0x6')](_0x0a27('0x9'),auth['isAuthenticated'](),controller[_0x0a27('0xa')]);router[_0x0a27('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0a27('0x6')](_0x0a27('0xb'),auth['isAuthenticated'](),controller[_0x0a27('0xc')]);router[_0x0a27('0x6')](_0x0a27('0xd'),auth[_0x0a27('0x7')](),controller['getDescriptions']);router[_0x0a27('0xe')]('/',auth[_0x0a27('0x7')](),controller['create']);router[_0x0a27('0xf')](_0x0a27('0x9'),auth[_0x0a27('0x7')](),controller['update']);router[_0x0a27('0x10')](_0x0a27('0x9'),auth[_0x0a27('0x7')](),controller[_0x0a27('0x11')]);module[_0x0a27('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 53dbef7..ce4a0eb 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 _0xedc1=['STRING'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xedc1,0x133));var _0x1edc=function(_0x11dbbe,_0x7b04d3){_0x11dbbe=_0x11dbbe-0x0;var _0x475061=_0xedc1[_0x11dbbe];return _0x475061;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1edc('0x0')]},'description':{'type':Sequelize[_0x1edc('0x0')]}}; \ No newline at end of file +var _0x5927=['sequelize','exports','STRING'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0x5927,0xc6));var _0x7592=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x5927[_0x374ccf];return _0x443cde;};'use strict';var Sequelize=require(_0x7592('0x0'));module[_0x7592('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7592('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index be8e5e1..0692980 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 _0xc148=['pick','hasOwnProperty','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','ServicenowConfiguration','include','findAll','show','params','options','find','catch','create','getFields','ServicenowField'];(function(_0x670c80,_0x42c00e){var _0x5d15ec=function(_0x37c4f1){while(--_0x37c4f1){_0x670c80['push'](_0x670c80['shift']());}};_0x5d15ec(++_0x42c00e);}(_0xc148,0x149));var _0x8c14=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc148[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c14('0x0'));var zipdir=require(_0x8c14('0x1'));var jsonpatch=require(_0x8c14('0x2'));var rp=require(_0x8c14('0x3'));var moment=require('moment');var BPromise=require(_0x8c14('0x4'));var Mustache=require(_0x8c14('0x5'));var util=require(_0x8c14('0x6'));var path=require(_0x8c14('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c14('0x8'));var fs=require('fs');var fs_extra=require(_0x8c14('0x9'));var _=require('lodash');var squel=require(_0x8c14('0xa'));var crypto=require(_0x8c14('0xb'));var jsforce=require(_0x8c14('0xc'));var deskjs=require(_0x8c14('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8c14('0xe'));var Papa=require(_0x8c14('0xf'));var Redis=require(_0x8c14('0x10'));var authService=require(_0x8c14('0x11'));var qs=require(_0x8c14('0x12'));var as=require(_0x8c14('0x13'));var hardwareService=require(_0x8c14('0x14'));var logger=require(_0x8c14('0x15'))(_0x8c14('0x16'));var utils=require(_0x8c14('0x17'));var config=require(_0x8c14('0x18'));var licenseUtil=require(_0x8c14('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263ab6,_0x2786f5){_0x2786f5=_0x2786f5||0xcc;return function(_0x265eff){if(_0x265eff){return _0x263ab6[_0x8c14('0x1a')](_0x2786f5);}return _0x263ab6[_0x8c14('0x1b')](_0x2786f5)[_0x8c14('0x1c')]();};}function respondWithResult(_0x2bb2cc,_0x4ddf5f){_0x4ddf5f=_0x4ddf5f||0xc8;return function(_0x2a90bb){if(_0x2a90bb){return _0x2bb2cc[_0x8c14('0x1b')](_0x4ddf5f)[_0x8c14('0x1d')](_0x2a90bb);}};}function respondWithFilteredResult(_0x1f0ea4,_0x5f5b3a){return function(_0x4578aa){if(_0x4578aa){var _0x48d273=typeof _0x5f5b3a[_0x8c14('0x1e')]===_0x8c14('0x1f')&&typeof _0x5f5b3a[_0x8c14('0x20')]===_0x8c14('0x1f');var _0x5dddb4=_0x4578aa[_0x8c14('0x21')];var _0x3adf0c=_0x48d273?0x0:_0x5f5b3a['offset'];var _0x22204c=_0x48d273?_0x4578aa[_0x8c14('0x21')]:_0x5f5b3a[_0x8c14('0x1e')]+_0x5f5b3a[_0x8c14('0x20')];var _0x4c677b;if(_0x22204c>=_0x5dddb4){_0x22204c=_0x5dddb4;_0x4c677b=0xc8;}else{_0x4c677b=0xce;}_0x1f0ea4[_0x8c14('0x1b')](_0x4c677b);return _0x1f0ea4[_0x8c14('0x22')](_0x8c14('0x23'),_0x3adf0c+'-'+_0x22204c+'/'+_0x5dddb4)[_0x8c14('0x1d')](_0x4578aa);}return null;};}function patchUpdates(_0x5e310c){return function(_0x247197){try{jsonpatch[_0x8c14('0x24')](_0x247197,_0x5e310c,!![]);}catch(_0xfa36be){return BPromise[_0x8c14('0x25')](_0xfa36be);}return _0x247197[_0x8c14('0x26')]();};}function saveUpdates(_0xd57b0,_0x29a181){return function(_0x4139cb){if(_0x4139cb){return _0x4139cb[_0x8c14('0x27')](_0xd57b0)[_0x8c14('0x28')](function(_0x18b712){return _0x18b712;});}return null;};}function removeEntity(_0x217103,_0x233a3e){return function(_0x2f044a){if(_0x2f044a){return _0x2f044a['destroy']()['then'](function(){_0x217103[_0x8c14('0x1b')](0xcc)[_0x8c14('0x1c')]();});}};}function handleEntityNotFound(_0x4c9c29,_0xb51740){return function(_0xa1ce33){if(!_0xa1ce33){_0x4c9c29[_0x8c14('0x1a')](0x194);}return _0xa1ce33;};}function handleError(_0xf88e0d,_0x2b2fff){_0x2b2fff=_0x2b2fff||0x1f4;return function(_0x5d078a){logger[_0x8c14('0x29')](_0x5d078a[_0x8c14('0x2a')]);if(_0x5d078a[_0x8c14('0x2b')]){delete _0x5d078a[_0x8c14('0x2b')];}_0xf88e0d[_0x8c14('0x1b')](_0x2b2fff)[_0x8c14('0x2c')](_0x5d078a);};}exports[_0x8c14('0x2d')]=function(_0x14e7b2,_0xc0d9a4){var _0x172e79={},_0x41682e={},_0x484fef={'count':0x0,'rows':[]};var _0x2f6bf4=_[_0x8c14('0x2e')](db['ServicenowConfiguration'][_0x8c14('0x2f')],function(_0x353463){return{'name':_0x353463[_0x8c14('0x30')],'type':_0x353463[_0x8c14('0x31')]['key']};});_0x41682e[_0x8c14('0x32')]=_[_0x8c14('0x2e')](_0x2f6bf4,_0x8c14('0x2b'));_0x41682e[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x14e7b2[_0x8c14('0x33')]);_0x41682e[_0x8c14('0x35')]=_[_0x8c14('0x36')](_0x41682e[_0x8c14('0x32')],_0x41682e[_0x8c14('0x33')]);_0x172e79['attributes']=_[_0x8c14('0x36')](_0x41682e[_0x8c14('0x32')],qs[_0x8c14('0x37')](_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x37')]));_0x172e79['attributes']=_0x172e79[_0x8c14('0x38')][_0x8c14('0x39')]?_0x172e79[_0x8c14('0x38')]:_0x41682e[_0x8c14('0x32')];if(!_0x14e7b2[_0x8c14('0x33')]['hasOwnProperty'](_0x8c14('0x3a'))){_0x172e79[_0x8c14('0x20')]=qs[_0x8c14('0x20')](_0x14e7b2['query']['limit']);_0x172e79['offset']=qs['offset'](_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x1e')]);}_0x172e79[_0x8c14('0x3b')]=qs[_0x8c14('0x3c')](_0x14e7b2['query'][_0x8c14('0x3c')]);_0x172e79[_0x8c14('0x3d')]=qs[_0x8c14('0x35')](_['pick'](_0x14e7b2[_0x8c14('0x33')],_0x41682e[_0x8c14('0x35')]),_0x2f6bf4);if(_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x172e79[_0x8c14('0x3d')]=_[_0x8c14('0x3f')](_0x172e79[_0x8c14('0x3d')],{'$or':_[_0x8c14('0x2e')](_0x2f6bf4,function(_0x46381e){if(_0x46381e[_0x8c14('0x31')]!==_0x8c14('0x40')){var _0x5b842e={};_0x5b842e[_0x46381e[_0x8c14('0x2b')]]={'$like':'%'+_0x14e7b2[_0x8c14('0x33')][_0x8c14('0x3e')]+'%'};return _0x5b842e;}})});}_0x172e79=_[_0x8c14('0x3f')]({},_0x172e79,_0x14e7b2['options']);var _0x2bb041={'where':_0x172e79[_0x8c14('0x3d')]};return db[_0x8c14('0x41')][_0x8c14('0x21')](_0x2bb041)[_0x8c14('0x28')](function(_0x1b0114){_0x484fef['count']=_0x1b0114;if(_0x14e7b2[_0x8c14('0x33')]['includeAll']){_0x172e79[_0x8c14('0x42')]=[{'all':!![]}];}return db[_0x8c14('0x41')][_0x8c14('0x43')](_0x172e79);})[_0x8c14('0x28')](function(_0x313c02){_0x484fef['rows']=_0x313c02;return _0x484fef;})[_0x8c14('0x28')](respondWithFilteredResult(_0xc0d9a4,_0x172e79))['catch'](handleError(_0xc0d9a4,null));};exports[_0x8c14('0x44')]=function(_0x19de80,_0x50ba81){var _0x890958={'raw':![],'where':{'id':_0x19de80[_0x8c14('0x45')]['id']}},_0x4bc246={};_0x4bc246['model']=_[_0x8c14('0x34')](db[_0x8c14('0x41')]['rawAttributes']);_0x4bc246[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x19de80[_0x8c14('0x33')]);_0x4bc246[_0x8c14('0x35')]=_['intersection'](_0x4bc246[_0x8c14('0x32')],_0x4bc246['query']);_0x890958['attributes']=_[_0x8c14('0x36')](_0x4bc246['model'],qs[_0x8c14('0x37')](_0x19de80[_0x8c14('0x33')]['fields']));_0x890958[_0x8c14('0x38')]=_0x890958[_0x8c14('0x38')][_0x8c14('0x39')]?_0x890958[_0x8c14('0x38')]:_0x4bc246[_0x8c14('0x32')];if(_0x19de80[_0x8c14('0x33')]['includeAll']){_0x890958[_0x8c14('0x42')]=[{'all':!![]}];}_0x890958=_[_0x8c14('0x3f')]({},_0x890958,_0x19de80[_0x8c14('0x46')]);return db[_0x8c14('0x41')][_0x8c14('0x47')](_0x890958)[_0x8c14('0x28')](handleEntityNotFound(_0x50ba81,null))[_0x8c14('0x28')](respondWithResult(_0x50ba81,null))[_0x8c14('0x48')](handleError(_0x50ba81,null));};exports['create']=function(_0x4e2e78,_0xa1e26e){return db[_0x8c14('0x41')][_0x8c14('0x49')](_0x4e2e78['body'],{})[_0x8c14('0x28')](respondWithResult(_0xa1e26e,0xc9))[_0x8c14('0x48')](handleError(_0xa1e26e,null));};exports[_0x8c14('0x27')]=function(_0xc112ad,_0x4bd859){if(_0xc112ad['body']['id']){delete _0xc112ad['body']['id'];}return db[_0x8c14('0x41')][_0x8c14('0x47')]({'where':{'id':_0xc112ad[_0x8c14('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bd859,null))[_0x8c14('0x28')](saveUpdates(_0xc112ad['body'],null))[_0x8c14('0x28')](respondWithResult(_0x4bd859,null))[_0x8c14('0x48')](handleError(_0x4bd859,null));};exports['destroy']=function(_0x7ce664,_0x4a18fd){return db['ServicenowConfiguration'][_0x8c14('0x47')]({'where':{'id':_0x7ce664[_0x8c14('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a18fd,null))[_0x8c14('0x28')](removeEntity(_0x4a18fd,null))[_0x8c14('0x48')](handleError(_0x4a18fd,null));};exports[_0x8c14('0x4a')]=function(_0x3d57c1,_0x5c95c5,_0x3f8070){var _0x5bc79a={};var _0xfb7e0b={};var _0x13c1a9;var _0x4b5adc;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3d57c1['params']['id']}})['then'](handleEntityNotFound(_0x5c95c5,null))['then'](function(_0x26b27d){if(_0x26b27d){_0x13c1a9=_0x26b27d;_0xfb7e0b[_0x8c14('0x32')]=_[_0x8c14('0x34')](db[_0x8c14('0x4b')][_0x8c14('0x2f')]);_0xfb7e0b[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x3d57c1[_0x8c14('0x33')]);_0xfb7e0b[_0x8c14('0x35')]=_[_0x8c14('0x36')](_0xfb7e0b[_0x8c14('0x32')],_0xfb7e0b[_0x8c14('0x33')]);_0x5bc79a[_0x8c14('0x38')]=_['intersection'](_0xfb7e0b[_0x8c14('0x32')],qs[_0x8c14('0x37')](_0x3d57c1['query'][_0x8c14('0x37')]));_0x5bc79a[_0x8c14('0x38')]=_0x5bc79a[_0x8c14('0x38')][_0x8c14('0x39')]?_0x5bc79a[_0x8c14('0x38')]:_0xfb7e0b['model'];_0x5bc79a['order']=qs[_0x8c14('0x3c')](_0x3d57c1[_0x8c14('0x33')]['sort']);_0x5bc79a['where']=qs['filters'](_[_0x8c14('0x4c')](_0x3d57c1['query'],_0xfb7e0b[_0x8c14('0x35')]));if(_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x5bc79a[_0x8c14('0x3d')]=_['merge'](_0x5bc79a['where'],{'$or':_['map'](_0x5bc79a['attributes'],function(_0x578e6b){var _0x2e109e={};_0x2e109e[_0x578e6b]={'$like':'%'+_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x3e')]+'%'};return _0x2e109e;})});}_0x5bc79a=_[_0x8c14('0x3f')]({},_0x5bc79a,_0x3d57c1[_0x8c14('0x46')]);return _0x13c1a9[_0x8c14('0x4a')](_0x5bc79a);}})[_0x8c14('0x28')](function(_0x1f6d56){if(_0x1f6d56){_0x4b5adc=_0x1f6d56[_0x8c14('0x39')];if(!_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x4d')](_0x8c14('0x3a'))){_0x5bc79a[_0x8c14('0x20')]=qs[_0x8c14('0x20')](_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x20')]);_0x5bc79a[_0x8c14('0x1e')]=qs[_0x8c14('0x1e')](_0x3d57c1[_0x8c14('0x33')][_0x8c14('0x1e')]);}return _0x13c1a9['getFields'](_0x5bc79a);}})[_0x8c14('0x28')](function(_0x11c161){if(_0x11c161){return _0x11c161?{'count':_0x4b5adc,'rows':_0x11c161}:null;}})[_0x8c14('0x28')](respondWithResult(_0x5c95c5,null))[_0x8c14('0x48')](handleError(_0x5c95c5,null));};exports[_0x8c14('0x4e')]=function(_0x1f13a2,_0x415155,_0x4c861b){var _0x179aef={};var _0x253d0a={};var _0x5e2c90;var _0x157633;return db[_0x8c14('0x41')]['findOne']({'where':{'id':_0x1f13a2[_0x8c14('0x45')]['id']}})[_0x8c14('0x28')](handleEntityNotFound(_0x415155,null))['then'](function(_0x234989){if(_0x234989){_0x5e2c90=_0x234989;_0x253d0a['model']=_[_0x8c14('0x34')](db['ServicenowField'][_0x8c14('0x2f')]);_0x253d0a[_0x8c14('0x33')]=_[_0x8c14('0x34')](_0x1f13a2[_0x8c14('0x33')]);_0x253d0a['filters']=_[_0x8c14('0x36')](_0x253d0a[_0x8c14('0x32')],_0x253d0a[_0x8c14('0x33')]);_0x179aef[_0x8c14('0x38')]=_['intersection'](_0x253d0a['model'],qs[_0x8c14('0x37')](_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x37')]));_0x179aef['attributes']=_0x179aef['attributes'][_0x8c14('0x39')]?_0x179aef[_0x8c14('0x38')]:_0x253d0a[_0x8c14('0x32')];_0x179aef[_0x8c14('0x3b')]=qs['sort'](_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x3c')]);_0x179aef[_0x8c14('0x3d')]=qs['filters'](_['pick'](_0x1f13a2['query'],_0x253d0a[_0x8c14('0x35')]));if(_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x179aef[_0x8c14('0x3d')]=_[_0x8c14('0x3f')](_0x179aef['where'],{'$or':_[_0x8c14('0x2e')](_0x179aef[_0x8c14('0x38')],function(_0x4902ee){var _0x2ac52c={};_0x2ac52c[_0x4902ee]={'$like':'%'+_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x3e')]+'%'};return _0x2ac52c;})});}_0x179aef=_['merge']({},_0x179aef,_0x1f13a2[_0x8c14('0x46')]);return _0x5e2c90['getSubjects'](_0x179aef);}})[_0x8c14('0x28')](function(_0x217e0a){if(_0x217e0a){_0x157633=_0x217e0a[_0x8c14('0x39')];if(!_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x4d')]('nolimit')){_0x179aef['limit']=qs[_0x8c14('0x20')](_0x1f13a2[_0x8c14('0x33')][_0x8c14('0x20')]);_0x179aef[_0x8c14('0x1e')]=qs[_0x8c14('0x1e')](_0x1f13a2[_0x8c14('0x33')]['offset']);}return _0x5e2c90[_0x8c14('0x4e')](_0x179aef);}})[_0x8c14('0x28')](function(_0x1e937a){if(_0x1e937a){return _0x1e937a?{'count':_0x157633,'rows':_0x1e937a}:null;}})['then'](respondWithResult(_0x415155,null))['catch'](handleError(_0x415155,null));};exports[_0x8c14('0x4f')]=function(_0x44672d,_0x90075f,_0xce9584){var _0x51f19c={};var _0xa61731={};var _0xa0cdca;var _0x1059a2;return db[_0x8c14('0x41')][_0x8c14('0x50')]({'where':{'id':_0x44672d[_0x8c14('0x45')]['id']}})['then'](handleEntityNotFound(_0x90075f,null))[_0x8c14('0x28')](function(_0x1784ac){if(_0x1784ac){_0xa0cdca=_0x1784ac;_0xa61731[_0x8c14('0x32')]=_[_0x8c14('0x34')](db[_0x8c14('0x4b')][_0x8c14('0x2f')]);_0xa61731['query']=_[_0x8c14('0x34')](_0x44672d['query']);_0xa61731[_0x8c14('0x35')]=_[_0x8c14('0x36')](_0xa61731[_0x8c14('0x32')],_0xa61731[_0x8c14('0x33')]);_0x51f19c[_0x8c14('0x38')]=_[_0x8c14('0x36')](_0xa61731[_0x8c14('0x32')],qs[_0x8c14('0x37')](_0x44672d['query'][_0x8c14('0x37')]));_0x51f19c[_0x8c14('0x38')]=_0x51f19c[_0x8c14('0x38')]['length']?_0x51f19c[_0x8c14('0x38')]:_0xa61731['model'];_0x51f19c[_0x8c14('0x3b')]=qs[_0x8c14('0x3c')](_0x44672d[_0x8c14('0x33')][_0x8c14('0x3c')]);_0x51f19c[_0x8c14('0x3d')]=qs['filters'](_[_0x8c14('0x4c')](_0x44672d[_0x8c14('0x33')],_0xa61731['filters']));if(_0x44672d[_0x8c14('0x33')][_0x8c14('0x3e')]){_0x51f19c['where']=_[_0x8c14('0x3f')](_0x51f19c['where'],{'$or':_[_0x8c14('0x2e')](_0x51f19c[_0x8c14('0x38')],function(_0x3e61cb){var _0x285229={};_0x285229[_0x3e61cb]={'$like':'%'+_0x44672d['query'][_0x8c14('0x3e')]+'%'};return _0x285229;})});}_0x51f19c=_[_0x8c14('0x3f')]({},_0x51f19c,_0x44672d[_0x8c14('0x46')]);return _0xa0cdca[_0x8c14('0x4f')](_0x51f19c);}})['then'](function(_0x4d08c6){if(_0x4d08c6){_0x1059a2=_0x4d08c6[_0x8c14('0x39')];if(!_0x44672d[_0x8c14('0x33')]['hasOwnProperty'](_0x8c14('0x3a'))){_0x51f19c[_0x8c14('0x20')]=qs['limit'](_0x44672d['query'][_0x8c14('0x20')]);_0x51f19c[_0x8c14('0x1e')]=qs[_0x8c14('0x1e')](_0x44672d[_0x8c14('0x33')]['offset']);}return _0xa0cdca['getDescriptions'](_0x51f19c);}})[_0x8c14('0x28')](function(_0x4d96b2){if(_0x4d96b2){return _0x4d96b2?{'count':_0x1059a2,'rows':_0x4d96b2}:null;}})['then'](respondWithResult(_0x90075f,null))[_0x8c14('0x48')](handleError(_0x90075f,null));}; \ No newline at end of file +var _0x23b6=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','save','then','sendStatus','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x23b6,0x8f));var _0x623b=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x23b6[_0x33e4a7];return _0x598620;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x623b('0x0'));var zipdir=require(_0x623b('0x1'));var jsonpatch=require(_0x623b('0x2'));var rp=require(_0x623b('0x3'));var moment=require(_0x623b('0x4'));var BPromise=require(_0x623b('0x5'));var Mustache=require('mustache');var util=require(_0x623b('0x6'));var path=require(_0x623b('0x7'));var sox=require('sox');var csv=require(_0x623b('0x8'));var ejs=require(_0x623b('0x9'));var fs=require('fs');var fs_extra=require(_0x623b('0xa'));var _=require(_0x623b('0xb'));var squel=require('squel');var crypto=require(_0x623b('0xc'));var jsforce=require(_0x623b('0xd'));var deskjs=require(_0x623b('0xe'));var toCsv=require(_0x623b('0x8'));var querystring=require(_0x623b('0xf'));var Papa=require(_0x623b('0x10'));var Redis=require('ioredis');var authService=require(_0x623b('0x11'));var qs=require(_0x623b('0x12'));var as=require(_0x623b('0x13'));var hardwareService=require(_0x623b('0x14'));var logger=require('../../config/logger')(_0x623b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x623b('0x16'));var db=require(_0x623b('0x17'))['db'];function respondWithStatusCode(_0x2454f8,_0x164eae){_0x164eae=_0x164eae||0xcc;return function(_0x4c03c0){if(_0x4c03c0){return _0x2454f8['sendStatus'](_0x164eae);}return _0x2454f8[_0x623b('0x18')](_0x164eae)[_0x623b('0x19')]();};}function respondWithResult(_0x53d158,_0xacec11){_0xacec11=_0xacec11||0xc8;return function(_0xc94385){if(_0xc94385){return _0x53d158[_0x623b('0x18')](_0xacec11)[_0x623b('0x1a')](_0xc94385);}};}function respondWithFilteredResult(_0x43cc01,_0x4de7f6){return function(_0x589105){if(_0x589105){var _0x1db0c1=typeof _0x4de7f6['offset']===_0x623b('0x1b')&&typeof _0x4de7f6[_0x623b('0x1c')]==='undefined';var _0x4c8ffe=_0x589105[_0x623b('0x1d')];var _0x36e82a=_0x1db0c1?0x0:_0x4de7f6[_0x623b('0x1e')];var _0x532109=_0x1db0c1?_0x589105['count']:_0x4de7f6[_0x623b('0x1e')]+_0x4de7f6['limit'];var _0x8419f3;if(_0x532109>=_0x4c8ffe){_0x532109=_0x4c8ffe;_0x8419f3=0xc8;}else{_0x8419f3=0xce;}_0x43cc01['status'](_0x8419f3);return _0x43cc01[_0x623b('0x1f')](_0x623b('0x20'),_0x36e82a+'-'+_0x532109+'/'+_0x4c8ffe)[_0x623b('0x1a')](_0x589105);}return null;};}function patchUpdates(_0xf7f030){return function(_0x8eae39){try{jsonpatch['apply'](_0x8eae39,_0xf7f030,!![]);}catch(_0xce08f9){return BPromise['reject'](_0xce08f9);}return _0x8eae39[_0x623b('0x21')]();};}function saveUpdates(_0x1a0c63,_0x13c50a){return function(_0x13128e){if(_0x13128e){return _0x13128e['update'](_0x1a0c63)[_0x623b('0x22')](function(_0x29b544){return _0x29b544;});}return null;};}function removeEntity(_0x4fac59,_0x556e4e){return function(_0x572c56){if(_0x572c56){return _0x572c56['destroy']()[_0x623b('0x22')](function(){_0x4fac59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dd02,_0x3dc4ee){return function(_0x120deb){if(!_0x120deb){_0x25dd02[_0x623b('0x23')](0x194);}return _0x120deb;};}function handleError(_0x2e1189,_0x10cec8){_0x10cec8=_0x10cec8||0x1f4;return function(_0x154f30){logger[_0x623b('0x24')](_0x154f30[_0x623b('0x25')]);if(_0x154f30[_0x623b('0x26')]){delete _0x154f30[_0x623b('0x26')];}_0x2e1189[_0x623b('0x18')](_0x10cec8)[_0x623b('0x27')](_0x154f30);};}exports[_0x623b('0x28')]=function(_0x266592,_0x33dcf9){var _0x4af84d={},_0x39a184={},_0x6499f6={'count':0x0,'rows':[]};var _0x587fca=_['map'](db[_0x623b('0x29')][_0x623b('0x2a')],function(_0x343ae2){return{'name':_0x343ae2[_0x623b('0x2b')],'type':_0x343ae2[_0x623b('0x2c')][_0x623b('0x2d')]};});_0x39a184['model']=_[_0x623b('0x2e')](_0x587fca,_0x623b('0x26'));_0x39a184[_0x623b('0x2f')]=_[_0x623b('0x30')](_0x266592['query']);_0x39a184[_0x623b('0x31')]=_['intersection'](_0x39a184[_0x623b('0x32')],_0x39a184['query']);_0x4af84d[_0x623b('0x33')]=_[_0x623b('0x34')](_0x39a184['model'],qs['fields'](_0x266592[_0x623b('0x2f')]['fields']));_0x4af84d[_0x623b('0x33')]=_0x4af84d[_0x623b('0x33')][_0x623b('0x35')]?_0x4af84d[_0x623b('0x33')]:_0x39a184[_0x623b('0x32')];if(!_0x266592[_0x623b('0x2f')][_0x623b('0x36')](_0x623b('0x37'))){_0x4af84d[_0x623b('0x1c')]=qs['limit'](_0x266592[_0x623b('0x2f')]['limit']);_0x4af84d[_0x623b('0x1e')]=qs[_0x623b('0x1e')](_0x266592[_0x623b('0x2f')]['offset']);}_0x4af84d['order']=qs['sort'](_0x266592[_0x623b('0x2f')][_0x623b('0x38')]);_0x4af84d[_0x623b('0x39')]=qs[_0x623b('0x31')](_[_0x623b('0x3a')](_0x266592[_0x623b('0x2f')],_0x39a184[_0x623b('0x31')]),_0x587fca);if(_0x266592[_0x623b('0x2f')]['filter']){_0x4af84d[_0x623b('0x39')]=_[_0x623b('0x3b')](_0x4af84d[_0x623b('0x39')],{'$or':_[_0x623b('0x2e')](_0x587fca,function(_0x479555){if(_0x479555[_0x623b('0x2c')]!==_0x623b('0x3c')){var _0xda5633={};_0xda5633[_0x479555['name']]={'$like':'%'+_0x266592[_0x623b('0x2f')][_0x623b('0x3d')]+'%'};return _0xda5633;}})});}_0x4af84d=_['merge']({},_0x4af84d,_0x266592[_0x623b('0x3e')]);var _0x592479={'where':_0x4af84d[_0x623b('0x39')]};return db[_0x623b('0x29')]['count'](_0x592479)[_0x623b('0x22')](function(_0x47b291){_0x6499f6['count']=_0x47b291;if(_0x266592[_0x623b('0x2f')][_0x623b('0x3f')]){_0x4af84d[_0x623b('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x623b('0x41')](_0x4af84d);})[_0x623b('0x22')](function(_0x5eceb9){_0x6499f6[_0x623b('0x42')]=_0x5eceb9;return _0x6499f6;})['then'](respondWithFilteredResult(_0x33dcf9,_0x4af84d))[_0x623b('0x43')](handleError(_0x33dcf9,null));};exports['show']=function(_0x921663,_0x4452db){var _0x1936eb={'raw':![],'where':{'id':_0x921663[_0x623b('0x44')]['id']}},_0x18de79={};_0x18de79['model']=_[_0x623b('0x30')](db[_0x623b('0x29')]['rawAttributes']);_0x18de79[_0x623b('0x2f')]=_[_0x623b('0x30')](_0x921663[_0x623b('0x2f')]);_0x18de79[_0x623b('0x31')]=_[_0x623b('0x34')](_0x18de79[_0x623b('0x32')],_0x18de79[_0x623b('0x2f')]);_0x1936eb[_0x623b('0x33')]=_[_0x623b('0x34')](_0x18de79[_0x623b('0x32')],qs[_0x623b('0x45')](_0x921663[_0x623b('0x2f')][_0x623b('0x45')]));_0x1936eb['attributes']=_0x1936eb[_0x623b('0x33')][_0x623b('0x35')]?_0x1936eb[_0x623b('0x33')]:_0x18de79[_0x623b('0x32')];if(_0x921663[_0x623b('0x2f')][_0x623b('0x3f')]){_0x1936eb[_0x623b('0x40')]=[{'all':!![]}];}_0x1936eb=_[_0x623b('0x3b')]({},_0x1936eb,_0x921663['options']);return db[_0x623b('0x29')][_0x623b('0x46')](_0x1936eb)[_0x623b('0x22')](handleEntityNotFound(_0x4452db,null))['then'](respondWithResult(_0x4452db,null))['catch'](handleError(_0x4452db,null));};exports[_0x623b('0x47')]=function(_0x16eaa9,_0x281aa1){return db[_0x623b('0x29')][_0x623b('0x47')](_0x16eaa9[_0x623b('0x48')],{})[_0x623b('0x22')](respondWithResult(_0x281aa1,0xc9))['catch'](handleError(_0x281aa1,null));};exports['update']=function(_0x28ba1e,_0x556344){if(_0x28ba1e[_0x623b('0x48')]['id']){delete _0x28ba1e[_0x623b('0x48')]['id'];}return db[_0x623b('0x29')]['find']({'where':{'id':_0x28ba1e[_0x623b('0x44')]['id']}})['then'](handleEntityNotFound(_0x556344,null))[_0x623b('0x22')](saveUpdates(_0x28ba1e['body'],null))['then'](respondWithResult(_0x556344,null))['catch'](handleError(_0x556344,null));};exports['destroy']=function(_0x115274,_0x290430){return db[_0x623b('0x29')]['find']({'where':{'id':_0x115274[_0x623b('0x44')]['id']}})[_0x623b('0x22')](handleEntityNotFound(_0x290430,null))[_0x623b('0x22')](removeEntity(_0x290430,null))[_0x623b('0x43')](handleError(_0x290430,null));};exports[_0x623b('0x49')]=function(_0x5d39a8,_0x53d877,_0x54f4a8){var _0x247579={};var _0x2e62b8={};var _0x193bd0;var _0x1b0b58;return db[_0x623b('0x29')][_0x623b('0x4a')]({'where':{'id':_0x5d39a8['params']['id']}})[_0x623b('0x22')](handleEntityNotFound(_0x53d877,null))[_0x623b('0x22')](function(_0x1bdadb){if(_0x1bdadb){_0x193bd0=_0x1bdadb;_0x2e62b8[_0x623b('0x32')]=_[_0x623b('0x30')](db[_0x623b('0x4b')][_0x623b('0x2a')]);_0x2e62b8['query']=_[_0x623b('0x30')](_0x5d39a8[_0x623b('0x2f')]);_0x2e62b8['filters']=_[_0x623b('0x34')](_0x2e62b8['model'],_0x2e62b8['query']);_0x247579[_0x623b('0x33')]=_[_0x623b('0x34')](_0x2e62b8['model'],qs[_0x623b('0x45')](_0x5d39a8[_0x623b('0x2f')][_0x623b('0x45')]));_0x247579['attributes']=_0x247579['attributes'][_0x623b('0x35')]?_0x247579[_0x623b('0x33')]:_0x2e62b8[_0x623b('0x32')];_0x247579[_0x623b('0x4c')]=qs['sort'](_0x5d39a8['query'][_0x623b('0x38')]);_0x247579['where']=qs[_0x623b('0x31')](_[_0x623b('0x3a')](_0x5d39a8[_0x623b('0x2f')],_0x2e62b8[_0x623b('0x31')]));if(_0x5d39a8[_0x623b('0x2f')][_0x623b('0x3d')]){_0x247579[_0x623b('0x39')]=_['merge'](_0x247579[_0x623b('0x39')],{'$or':_[_0x623b('0x2e')](_0x247579[_0x623b('0x33')],function(_0x45f0c6){var _0x289470={};_0x289470[_0x45f0c6]={'$like':'%'+_0x5d39a8[_0x623b('0x2f')][_0x623b('0x3d')]+'%'};return _0x289470;})});}_0x247579=_[_0x623b('0x3b')]({},_0x247579,_0x5d39a8[_0x623b('0x3e')]);return _0x193bd0['getFields'](_0x247579);}})[_0x623b('0x22')](function(_0x2091ab){if(_0x2091ab){_0x1b0b58=_0x2091ab['length'];if(!_0x5d39a8[_0x623b('0x2f')][_0x623b('0x36')](_0x623b('0x37'))){_0x247579['limit']=qs[_0x623b('0x1c')](_0x5d39a8[_0x623b('0x2f')]['limit']);_0x247579[_0x623b('0x1e')]=qs[_0x623b('0x1e')](_0x5d39a8[_0x623b('0x2f')][_0x623b('0x1e')]);}return _0x193bd0[_0x623b('0x49')](_0x247579);}})['then'](function(_0x164be3){if(_0x164be3){return _0x164be3?{'count':_0x1b0b58,'rows':_0x164be3}:null;}})[_0x623b('0x22')](respondWithResult(_0x53d877,null))['catch'](handleError(_0x53d877,null));};exports[_0x623b('0x4d')]=function(_0xe5d8c8,_0x589587,_0x337cc2){var _0xaf2c2a={};var _0x1bd71b={};var _0x7be295;var _0x3a3def;return db['ServicenowConfiguration'][_0x623b('0x4a')]({'where':{'id':_0xe5d8c8[_0x623b('0x44')]['id']}})['then'](handleEntityNotFound(_0x589587,null))[_0x623b('0x22')](function(_0x28ff3b){if(_0x28ff3b){_0x7be295=_0x28ff3b;_0x1bd71b[_0x623b('0x32')]=_[_0x623b('0x30')](db[_0x623b('0x4b')]['rawAttributes']);_0x1bd71b['query']=_['keys'](_0xe5d8c8[_0x623b('0x2f')]);_0x1bd71b[_0x623b('0x31')]=_['intersection'](_0x1bd71b[_0x623b('0x32')],_0x1bd71b[_0x623b('0x2f')]);_0xaf2c2a['attributes']=_[_0x623b('0x34')](_0x1bd71b[_0x623b('0x32')],qs[_0x623b('0x45')](_0xe5d8c8[_0x623b('0x2f')]['fields']));_0xaf2c2a['attributes']=_0xaf2c2a[_0x623b('0x33')]['length']?_0xaf2c2a[_0x623b('0x33')]:_0x1bd71b['model'];_0xaf2c2a[_0x623b('0x4c')]=qs[_0x623b('0x38')](_0xe5d8c8['query'][_0x623b('0x38')]);_0xaf2c2a[_0x623b('0x39')]=qs[_0x623b('0x31')](_[_0x623b('0x3a')](_0xe5d8c8[_0x623b('0x2f')],_0x1bd71b[_0x623b('0x31')]));if(_0xe5d8c8['query'][_0x623b('0x3d')]){_0xaf2c2a[_0x623b('0x39')]=_[_0x623b('0x3b')](_0xaf2c2a[_0x623b('0x39')],{'$or':_['map'](_0xaf2c2a[_0x623b('0x33')],function(_0x42e1ed){var _0x3eff8c={};_0x3eff8c[_0x42e1ed]={'$like':'%'+_0xe5d8c8[_0x623b('0x2f')]['filter']+'%'};return _0x3eff8c;})});}_0xaf2c2a=_[_0x623b('0x3b')]({},_0xaf2c2a,_0xe5d8c8[_0x623b('0x3e')]);return _0x7be295[_0x623b('0x4d')](_0xaf2c2a);}})[_0x623b('0x22')](function(_0x8a9063){if(_0x8a9063){_0x3a3def=_0x8a9063[_0x623b('0x35')];if(!_0xe5d8c8['query'][_0x623b('0x36')]('nolimit')){_0xaf2c2a['limit']=qs['limit'](_0xe5d8c8[_0x623b('0x2f')][_0x623b('0x1c')]);_0xaf2c2a[_0x623b('0x1e')]=qs['offset'](_0xe5d8c8[_0x623b('0x2f')][_0x623b('0x1e')]);}return _0x7be295['getSubjects'](_0xaf2c2a);}})[_0x623b('0x22')](function(_0x19a28f){if(_0x19a28f){return _0x19a28f?{'count':_0x3a3def,'rows':_0x19a28f}:null;}})['then'](respondWithResult(_0x589587,null))[_0x623b('0x43')](handleError(_0x589587,null));};exports[_0x623b('0x4e')]=function(_0x4a6fd9,_0x24605c,_0x23fe1d){var _0x50ce66={};var _0x3f64f5={};var _0x459d0a;var _0x4b764c;return db['ServicenowConfiguration'][_0x623b('0x4a')]({'where':{'id':_0x4a6fd9[_0x623b('0x44')]['id']}})['then'](handleEntityNotFound(_0x24605c,null))[_0x623b('0x22')](function(_0x31ab54){if(_0x31ab54){_0x459d0a=_0x31ab54;_0x3f64f5['model']=_[_0x623b('0x30')](db[_0x623b('0x4b')][_0x623b('0x2a')]);_0x3f64f5[_0x623b('0x2f')]=_['keys'](_0x4a6fd9[_0x623b('0x2f')]);_0x3f64f5[_0x623b('0x31')]=_[_0x623b('0x34')](_0x3f64f5['model'],_0x3f64f5[_0x623b('0x2f')]);_0x50ce66['attributes']=_[_0x623b('0x34')](_0x3f64f5[_0x623b('0x32')],qs['fields'](_0x4a6fd9[_0x623b('0x2f')]['fields']));_0x50ce66[_0x623b('0x33')]=_0x50ce66['attributes'][_0x623b('0x35')]?_0x50ce66[_0x623b('0x33')]:_0x3f64f5[_0x623b('0x32')];_0x50ce66[_0x623b('0x4c')]=qs[_0x623b('0x38')](_0x4a6fd9[_0x623b('0x2f')]['sort']);_0x50ce66[_0x623b('0x39')]=qs['filters'](_[_0x623b('0x3a')](_0x4a6fd9[_0x623b('0x2f')],_0x3f64f5[_0x623b('0x31')]));if(_0x4a6fd9['query'][_0x623b('0x3d')]){_0x50ce66[_0x623b('0x39')]=_['merge'](_0x50ce66[_0x623b('0x39')],{'$or':_['map'](_0x50ce66[_0x623b('0x33')],function(_0x3b1ab2){var _0x222fc3={};_0x222fc3[_0x3b1ab2]={'$like':'%'+_0x4a6fd9[_0x623b('0x2f')][_0x623b('0x3d')]+'%'};return _0x222fc3;})});}_0x50ce66=_['merge']({},_0x50ce66,_0x4a6fd9[_0x623b('0x3e')]);return _0x459d0a[_0x623b('0x4e')](_0x50ce66);}})[_0x623b('0x22')](function(_0x1cc319){if(_0x1cc319){_0x4b764c=_0x1cc319[_0x623b('0x35')];if(!_0x4a6fd9[_0x623b('0x2f')]['hasOwnProperty'](_0x623b('0x37'))){_0x50ce66['limit']=qs['limit'](_0x4a6fd9[_0x623b('0x2f')]['limit']);_0x50ce66['offset']=qs[_0x623b('0x1e')](_0x4a6fd9['query']['offset']);}return _0x459d0a[_0x623b('0x4e')](_0x50ce66);}})[_0x623b('0x22')](function(_0x58e68d){if(_0x58e68d){return _0x58e68d?{'count':_0x4b764c,'rows':_0x58e68d}:null;}})[_0x623b('0x22')](respondWithResult(_0x24605c,null))[_0x623b('0x43')](handleError(_0x24605c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c4d0dbe..d73e5fc 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 _0x4f7b=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x4398fc,_0x341cb7){_0x4398fc=_0x4398fc-0x0;var _0x4922c4=_0x4f7b[_0x4398fc];return _0x4922c4;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var logger=require(_0xb4f7('0x2'))(_0xb4f7('0x3'));var moment=require('moment');var BPromise=require(_0xb4f7('0x4'));var rp=require(_0xb4f7('0x5'));var fs=require('fs');var path=require(_0xb4f7('0x6'));var rimraf=require(_0xb4f7('0x7'));var config=require(_0xb4f7('0x8'));var attributes=require(_0xb4f7('0x9'));module[_0xb4f7('0xa')]=function(_0x15443c,_0x4d2d83){return _0x15443c[_0xb4f7('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0xb4f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x726f=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','request-promise','path','rimraf'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x726f,0xa2));var _0xf726=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x726f[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var logger=require('../../config/logger')(_0xf726('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf726('0x3'));var fs=require('fs');var path=require(_0xf726('0x4'));var rimraf=require(_0xf726('0x5'));var config=require(_0xf726('0x6'));var attributes=require(_0xf726('0x7'));module[_0xf726('0x8')]=function(_0x26ba00,_0x1cae3f){return _0x26ba00[_0xf726('0x9')](_0xf726('0xa'),attributes,{'tableName':_0xf726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index ac2e3b1..18bd151 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 _0x5398=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1bd425,_0x334d54){var _0x1e4f11=function(_0x31e0fa){while(--_0x31e0fa){_0x1bd425['push'](_0x1bd425['shift']());}};_0x1e4f11(++_0x334d54);}(_0x5398,0xe2));var _0x8539=function(_0x3cba36,_0x5eccbc){_0x3cba36=_0x3cba36-0x0;var _0x2866e2=_0x5398[_0x3cba36];return _0x2866e2;};'use strict';var _=require('lodash');var util=require(_0x8539('0x0'));var moment=require(_0x8539('0x1'));var BPromise=require(_0x8539('0x2'));var rs=require(_0x8539('0x3'));var fs=require('fs');var Redis=require(_0x8539('0x4'));var db=require(_0x8539('0x5'))['db'];var utils=require(_0x8539('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8539('0x7'));var jayson=require(_0x8539('0x8'));var client=jayson[_0x8539('0x9')][_0x8539('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f25c,_0x30f2ab,_0x47c5be){return new BPromise(function(_0x1fad89,_0x3bf5c4){return client[_0x8539('0xb')](_0x28f25c,_0x47c5be)[_0x8539('0xc')](function(_0x2dda95){logger[_0x8539('0xd')](_0x8539('0xe'),_0x30f2ab,_0x8539('0xf'));logger[_0x8539('0x10')](_0x8539('0x11'),_0x30f2ab,'request\x20sent',JSON[_0x8539('0x12')](_0x2dda95));if(_0x2dda95[_0x8539('0x13')]){if(_0x2dda95[_0x8539('0x13')]['code']===0x1f4){logger[_0x8539('0x13')](_0x8539('0xe'),_0x30f2ab,_0x2dda95[_0x8539('0x13')][_0x8539('0x14')]);return _0x3bf5c4(_0x2dda95['error']['message']);}logger[_0x8539('0x13')](_0x8539('0xe'),_0x30f2ab,_0x2dda95[_0x8539('0x13')][_0x8539('0x14')]);return _0x1fad89(_0x2dda95[_0x8539('0x13')]['message']);}else{logger['info'](_0x8539('0xe'),_0x30f2ab,_0x8539('0xf'));_0x1fad89(_0x2dda95[_0x8539('0x15')][_0x8539('0x14')]);}})[_0x8539('0x16')](function(_0x29bf43){logger[_0x8539('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x30f2ab,_0x29bf43);_0x3bf5c4(_0x29bf43);});});} \ No newline at end of file +var _0x4af8=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4af8,0x81));var _0x84af=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x4af8[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x84af('0x0'));var util=require(_0x84af('0x1'));var moment=require(_0x84af('0x2'));var BPromise=require(_0x84af('0x3'));var rs=require(_0x84af('0x4'));var fs=require('fs');var Redis=require(_0x84af('0x5'));var db=require(_0x84af('0x6'))['db'];var utils=require(_0x84af('0x7'));var logger=require(_0x84af('0x8'))('rpc');var config=require(_0x84af('0x9'));var jayson=require(_0x84af('0xa'));var client=jayson[_0x84af('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51550b,_0x585e91,_0x53acf9){return new BPromise(function(_0x147524,_0x3676a0){return client[_0x84af('0xc')](_0x51550b,_0x53acf9)[_0x84af('0xd')](function(_0x5261c4){logger[_0x84af('0xe')](_0x84af('0xf'),_0x585e91,_0x84af('0x10'));logger[_0x84af('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x585e91,_0x84af('0x10'),JSON[_0x84af('0x12')](_0x5261c4));if(_0x5261c4[_0x84af('0x13')]){if(_0x5261c4[_0x84af('0x13')][_0x84af('0x14')]===0x1f4){logger['error'](_0x84af('0xf'),_0x585e91,_0x5261c4[_0x84af('0x13')][_0x84af('0x15')]);return _0x3676a0(_0x5261c4[_0x84af('0x13')][_0x84af('0x15')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x585e91,_0x5261c4[_0x84af('0x13')][_0x84af('0x15')]);return _0x147524(_0x5261c4[_0x84af('0x13')][_0x84af('0x15')]);}else{logger[_0x84af('0xe')](_0x84af('0xf'),_0x585e91,_0x84af('0x10'));_0x147524(_0x5261c4[_0x84af('0x16')][_0x84af('0x15')]);}})[_0x84af('0x17')](function(_0x566f36){logger['error'](_0x84af('0xf'),_0x585e91,_0x566f36);_0x3676a0(_0x566f36);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 826ef4c..4f61616 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 _0x2b98=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put'];(function(_0x20c1c0,_0x382264){var _0x55241f=function(_0x23e42a){while(--_0x23e42a){_0x20c1c0['push'](_0x20c1c0['shift']());}};_0x55241f(++_0x382264);}(_0x2b98,0x169));var _0x82b9=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x2b98[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x82b9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x82b9('0x1'));var express=require(_0x82b9('0x2'));var router=express[_0x82b9('0x3')]();var fs_extra=require(_0x82b9('0x4'));var auth=require(_0x82b9('0x5'));var interaction=require(_0x82b9('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x82b9('0x7')]('/',auth[_0x82b9('0x8')](),controller[_0x82b9('0x9')]);router[_0x82b9('0x7')](_0x82b9('0xa'),auth[_0x82b9('0x8')](),controller[_0x82b9('0xb')]);router['post']('/',auth[_0x82b9('0x8')](),controller['create']);router[_0x82b9('0xc')](_0x82b9('0xa'),auth[_0x82b9('0x8')](),controller[_0x82b9('0xd')]);router[_0x82b9('0xe')](_0x82b9('0xa'),auth['isAuthenticated'](),controller[_0x82b9('0xf')]);module[_0x82b9('0x10')]=router; \ No newline at end of file +var _0xbbee=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','create','put','/:id','update'];(function(_0x1b129f,_0x6d1483){var _0x117f95=function(_0x445ad7){while(--_0x445ad7){_0x1b129f['push'](_0x1b129f['shift']());}};_0x117f95(++_0x6d1483);}(_0xbbee,0xde));var _0xebbe=function(_0x162769,_0xafc66c){_0x162769=_0x162769-0x0;var _0xff2e8e=_0xbbee[_0x162769];return _0xff2e8e;};'use strict';var multer=require(_0xebbe('0x0'));var util=require(_0xebbe('0x1'));var path=require(_0xebbe('0x2'));var timeout=require(_0xebbe('0x3'));var express=require(_0xebbe('0x4'));var router=express['Router']();var fs_extra=require(_0xebbe('0x5'));var auth=require(_0xebbe('0x6'));var interaction=require(_0xebbe('0x7'));var config=require(_0xebbe('0x8'));var controller=require(_0xebbe('0x9'));router[_0xebbe('0xa')]('/',auth[_0xebbe('0xb')](),controller[_0xebbe('0xc')]);router[_0xebbe('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xebbe('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xebbe('0xe')]);router[_0xebbe('0xf')](_0xebbe('0x10'),auth[_0xebbe('0xb')](),controller[_0xebbe('0x11')]);router['delete'](_0xebbe('0x10'),auth[_0xebbe('0xb')](),controller[_0xebbe('0x12')]);module[_0xebbe('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1151f6d..1eb3eb9 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 _0x1a79=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x1ae7b0,_0x2301a2){var _0x2d83dc=function(_0x32a63f){while(--_0x32a63f){_0x1ae7b0['push'](_0x1ae7b0['shift']());}};_0x2d83dc(++_0x2301a2);}(_0x1a79,0x19b));var _0x91a7=function(_0x5d313a,_0x1a0bcf){_0x5d313a=_0x5d313a-0x0;var _0x5cf450=_0x1a79[_0x5d313a];return _0x5cf450;};'use strict';var Sequelize=require(_0x91a7('0x0'));module[_0x91a7('0x1')]={'type':{'type':Sequelize[_0x91a7('0x2')]('string',_0x91a7('0x3'),_0x91a7('0x4'),_0x91a7('0x5'),_0x91a7('0x6')),'defaultValue':_0x91a7('0x7')},'content':{'type':Sequelize[_0x91a7('0x8')]},'key':{'type':Sequelize[_0x91a7('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x91a7('0x3'),_0x91a7('0x4'))},'keyContent':{'type':Sequelize[_0x91a7('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x91a7('0x8')]},'customField':{'type':Sequelize[_0x91a7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x91a7('0x8')]}}; \ No newline at end of file +var _0x0e64=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x331ce0,_0xe335b9){var _0x31c3c7=function(_0x2bf43c){while(--_0x2bf43c){_0x331ce0['push'](_0x331ce0['shift']());}};_0x31c3c7(++_0xe335b9);}(_0x0e64,0x164));var _0x40e6=function(_0x549fd4,_0x56010b){_0x549fd4=_0x549fd4-0x0;var _0x47baf2=_0x0e64[_0x549fd4];return _0x47baf2;};'use strict';var Sequelize=require(_0x40e6('0x0'));module[_0x40e6('0x1')]={'type':{'type':Sequelize[_0x40e6('0x2')](_0x40e6('0x3'),_0x40e6('0x4'),_0x40e6('0x5'),_0x40e6('0x6'),'picklist'),'defaultValue':_0x40e6('0x3')},'content':{'type':Sequelize[_0x40e6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x40e6('0x3'),_0x40e6('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x40e6('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x40e6('0x7')]},'customField':{'type':Sequelize[_0x40e6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1327ddf..627695d 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 _0x0e9e=['zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','ServicenowField','includeAll','include','findAll','rows','catch','params','intersection','length','find','create','body','eml-format','rimraf'];(function(_0x5adeab,_0x3ddf5f){var _0x147201=function(_0x4459a5){while(--_0x4459a5){_0x5adeab['push'](_0x5adeab['shift']());}};_0x147201(++_0x3ddf5f);}(_0x0e9e,0x1ba));var _0xe0e9=function(_0x3c7079,_0x1d505b){_0x3c7079=_0x3c7079-0x0;var _0x5f2bd6=_0x0e9e[_0x3c7079];return _0x5f2bd6;};'use strict';var emlformat=require(_0xe0e9('0x0'));var rimraf=require(_0xe0e9('0x1'));var zipdir=require(_0xe0e9('0x2'));var jsonpatch=require(_0xe0e9('0x3'));var rp=require(_0xe0e9('0x4'));var moment=require('moment');var BPromise=require(_0xe0e9('0x5'));var Mustache=require('mustache');var util=require(_0xe0e9('0x6'));var path=require(_0xe0e9('0x7'));var sox=require(_0xe0e9('0x8'));var csv=require(_0xe0e9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0e9('0xa'));var _=require(_0xe0e9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0e9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe0e9('0x9'));var querystring=require(_0xe0e9('0xd'));var Papa=require(_0xe0e9('0xe'));var Redis=require(_0xe0e9('0xf'));var authService=require(_0xe0e9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0e9('0x11'));var hardwareService=require(_0xe0e9('0x12'));var logger=require(_0xe0e9('0x13'))(_0xe0e9('0x14'));var utils=require(_0xe0e9('0x15'));var config=require(_0xe0e9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0e9('0x17'))['db'];function respondWithStatusCode(_0x465bec,_0x11293a){_0x11293a=_0x11293a||0xcc;return function(_0x542303){if(_0x542303){return _0x465bec[_0xe0e9('0x18')](_0x11293a);}return _0x465bec[_0xe0e9('0x19')](_0x11293a)['end']();};}function respondWithResult(_0xfe4c52,_0xe27edc){_0xe27edc=_0xe27edc||0xc8;return function(_0x296bd9){if(_0x296bd9){return _0xfe4c52['status'](_0xe27edc)[_0xe0e9('0x1a')](_0x296bd9);}};}function respondWithFilteredResult(_0x1ed504,_0xffe0ab){return function(_0x356a0a){if(_0x356a0a){var _0xc3298d=typeof _0xffe0ab[_0xe0e9('0x1b')]==='undefined'&&typeof _0xffe0ab[_0xe0e9('0x1c')]===_0xe0e9('0x1d');var _0xecae2b=_0x356a0a[_0xe0e9('0x1e')];var _0x3b24cc=_0xc3298d?0x0:_0xffe0ab[_0xe0e9('0x1b')];var _0x1f9492=_0xc3298d?_0x356a0a[_0xe0e9('0x1e')]:_0xffe0ab[_0xe0e9('0x1b')]+_0xffe0ab[_0xe0e9('0x1c')];var _0x2bb5f0;if(_0x1f9492>=_0xecae2b){_0x1f9492=_0xecae2b;_0x2bb5f0=0xc8;}else{_0x2bb5f0=0xce;}_0x1ed504[_0xe0e9('0x19')](_0x2bb5f0);return _0x1ed504[_0xe0e9('0x1f')](_0xe0e9('0x20'),_0x3b24cc+'-'+_0x1f9492+'/'+_0xecae2b)[_0xe0e9('0x1a')](_0x356a0a);}return null;};}function patchUpdates(_0x306af3){return function(_0x30cb6b){try{jsonpatch[_0xe0e9('0x21')](_0x30cb6b,_0x306af3,!![]);}catch(_0x35b5db){return BPromise[_0xe0e9('0x22')](_0x35b5db);}return _0x30cb6b[_0xe0e9('0x23')]();};}function saveUpdates(_0x4fb830,_0x2821c4){return function(_0xcac505){if(_0xcac505){return _0xcac505[_0xe0e9('0x24')](_0x4fb830)[_0xe0e9('0x25')](function(_0x3faafe){return _0x3faafe;});}return null;};}function removeEntity(_0x10397b,_0x416f42){return function(_0x3ca411){if(_0x3ca411){return _0x3ca411[_0xe0e9('0x26')]()[_0xe0e9('0x25')](function(){_0x10397b[_0xe0e9('0x19')](0xcc)[_0xe0e9('0x27')]();});}};}function handleEntityNotFound(_0x1d22e3,_0x44138b){return function(_0x40e6bf){if(!_0x40e6bf){_0x1d22e3[_0xe0e9('0x18')](0x194);}return _0x40e6bf;};}function handleError(_0x14332e,_0x123a11){_0x123a11=_0x123a11||0x1f4;return function(_0x2b00b9){logger['error'](_0x2b00b9[_0xe0e9('0x28')]);if(_0x2b00b9[_0xe0e9('0x29')]){delete _0x2b00b9[_0xe0e9('0x29')];}_0x14332e['status'](_0x123a11)['send'](_0x2b00b9);};}exports[_0xe0e9('0x2a')]=function(_0x4b13a0,_0x2f383e){var _0x248dc5={},_0x1932c3={},_0x11573c={'count':0x0,'rows':[]};var _0x26cfa6=_[_0xe0e9('0x2b')](db['ServicenowField'][_0xe0e9('0x2c')],function(_0x1aa216){return{'name':_0x1aa216[_0xe0e9('0x2d')],'type':_0x1aa216[_0xe0e9('0x2e')][_0xe0e9('0x2f')]};});_0x1932c3[_0xe0e9('0x30')]=_[_0xe0e9('0x2b')](_0x26cfa6,'name');_0x1932c3['query']=_[_0xe0e9('0x31')](_0x4b13a0['query']);_0x1932c3[_0xe0e9('0x32')]=_['intersection'](_0x1932c3['model'],_0x1932c3[_0xe0e9('0x33')]);_0x248dc5['attributes']=_['intersection'](_0x1932c3['model'],qs[_0xe0e9('0x34')](_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x34')]));_0x248dc5[_0xe0e9('0x35')]=_0x248dc5['attributes']['length']?_0x248dc5[_0xe0e9('0x35')]:_0x1932c3['model'];if(!_0x4b13a0[_0xe0e9('0x33')]['hasOwnProperty'](_0xe0e9('0x36'))){_0x248dc5[_0xe0e9('0x1c')]=qs[_0xe0e9('0x1c')](_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x1c')]);_0x248dc5[_0xe0e9('0x1b')]=qs[_0xe0e9('0x1b')](_0x4b13a0[_0xe0e9('0x33')]['offset']);}_0x248dc5[_0xe0e9('0x37')]=qs[_0xe0e9('0x38')](_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x38')]);_0x248dc5[_0xe0e9('0x39')]=qs[_0xe0e9('0x32')](_[_0xe0e9('0x3a')](_0x4b13a0[_0xe0e9('0x33')],_0x1932c3[_0xe0e9('0x32')]),_0x26cfa6);if(_0x4b13a0['query'][_0xe0e9('0x3b')]){_0x248dc5[_0xe0e9('0x39')]=_[_0xe0e9('0x3c')](_0x248dc5[_0xe0e9('0x39')],{'$or':_[_0xe0e9('0x2b')](_0x26cfa6,function(_0x5a290f){if(_0x5a290f[_0xe0e9('0x2e')]!=='VIRTUAL'){var _0x2c3a42={};_0x2c3a42[_0x5a290f[_0xe0e9('0x29')]]={'$like':'%'+_0x4b13a0[_0xe0e9('0x33')][_0xe0e9('0x3b')]+'%'};return _0x2c3a42;}})});}_0x248dc5=_['merge']({},_0x248dc5,_0x4b13a0[_0xe0e9('0x3d')]);var _0x1577a0={'where':_0x248dc5['where']};return db[_0xe0e9('0x3e')][_0xe0e9('0x1e')](_0x1577a0)['then'](function(_0x5eabc4){_0x11573c[_0xe0e9('0x1e')]=_0x5eabc4;if(_0x4b13a0['query'][_0xe0e9('0x3f')]){_0x248dc5[_0xe0e9('0x40')]=[{'all':!![]}];}return db[_0xe0e9('0x3e')][_0xe0e9('0x41')](_0x248dc5);})[_0xe0e9('0x25')](function(_0xd4edd0){_0x11573c[_0xe0e9('0x42')]=_0xd4edd0;return _0x11573c;})[_0xe0e9('0x25')](respondWithFilteredResult(_0x2f383e,_0x248dc5))[_0xe0e9('0x43')](handleError(_0x2f383e,null));};exports['show']=function(_0x1f5f91,_0x17e222){var _0x4fd087={'raw':!![],'where':{'id':_0x1f5f91[_0xe0e9('0x44')]['id']}},_0x16fee3={};_0x16fee3[_0xe0e9('0x30')]=_[_0xe0e9('0x31')](db['ServicenowField'][_0xe0e9('0x2c')]);_0x16fee3['query']=_[_0xe0e9('0x31')](_0x1f5f91[_0xe0e9('0x33')]);_0x16fee3[_0xe0e9('0x32')]=_['intersection'](_0x16fee3['model'],_0x16fee3['query']);_0x4fd087[_0xe0e9('0x35')]=_[_0xe0e9('0x45')](_0x16fee3[_0xe0e9('0x30')],qs['fields'](_0x1f5f91[_0xe0e9('0x33')][_0xe0e9('0x34')]));_0x4fd087[_0xe0e9('0x35')]=_0x4fd087[_0xe0e9('0x35')][_0xe0e9('0x46')]?_0x4fd087['attributes']:_0x16fee3[_0xe0e9('0x30')];if(_0x1f5f91[_0xe0e9('0x33')]['includeAll']){_0x4fd087[_0xe0e9('0x40')]=[{'all':!![]}];}_0x4fd087=_[_0xe0e9('0x3c')]({},_0x4fd087,_0x1f5f91[_0xe0e9('0x3d')]);return db['ServicenowField'][_0xe0e9('0x47')](_0x4fd087)['then'](handleEntityNotFound(_0x17e222,null))[_0xe0e9('0x25')](respondWithResult(_0x17e222,null))[_0xe0e9('0x43')](handleError(_0x17e222,null));};exports['create']=function(_0x16741f,_0x1065b5){return db[_0xe0e9('0x3e')][_0xe0e9('0x48')](_0x16741f[_0xe0e9('0x49')],{})[_0xe0e9('0x25')](respondWithResult(_0x1065b5,0xc9))['catch'](handleError(_0x1065b5,null));};exports[_0xe0e9('0x24')]=function(_0x43e924,_0x37ce88){if(_0x43e924['body']['id']){delete _0x43e924[_0xe0e9('0x49')]['id'];}return db[_0xe0e9('0x3e')][_0xe0e9('0x47')]({'where':{'id':_0x43e924['params']['id']}})['then'](handleEntityNotFound(_0x37ce88,null))[_0xe0e9('0x25')](saveUpdates(_0x43e924['body'],null))[_0xe0e9('0x25')](respondWithResult(_0x37ce88,null))[_0xe0e9('0x43')](handleError(_0x37ce88,null));};exports[_0xe0e9('0x26')]=function(_0x1406aa,_0x2c234f){return db[_0xe0e9('0x3e')][_0xe0e9('0x47')]({'where':{'id':_0x1406aa['params']['id']}})[_0xe0e9('0x25')](handleEntityNotFound(_0x2c234f,null))[_0xe0e9('0x25')](removeEntity(_0x2c234f,null))['catch'](handleError(_0x2c234f,null));}; \ No newline at end of file +var _0x6acb=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','options','includeAll','findAll','catch','show','create','body','find','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1c4cf0,_0x300eb8){var _0x2c7a39=function(_0x2fa3c0){while(--_0x2fa3c0){_0x1c4cf0['push'](_0x1c4cf0['shift']());}};_0x2c7a39(++_0x300eb8);}(_0x6acb,0x116));var _0xb6ac=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x6acb[_0x3e5bc8];return _0xfd84bc;};'use strict';var emlformat=require(_0xb6ac('0x0'));var rimraf=require(_0xb6ac('0x1'));var zipdir=require(_0xb6ac('0x2'));var jsonpatch=require(_0xb6ac('0x3'));var rp=require(_0xb6ac('0x4'));var moment=require(_0xb6ac('0x5'));var BPromise=require(_0xb6ac('0x6'));var Mustache=require(_0xb6ac('0x7'));var util=require(_0xb6ac('0x8'));var path=require(_0xb6ac('0x9'));var sox=require('sox');var csv=require(_0xb6ac('0xa'));var ejs=require(_0xb6ac('0xb'));var fs=require('fs');var fs_extra=require(_0xb6ac('0xc'));var _=require(_0xb6ac('0xd'));var squel=require(_0xb6ac('0xe'));var crypto=require(_0xb6ac('0xf'));var jsforce=require(_0xb6ac('0x10'));var deskjs=require(_0xb6ac('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb6ac('0x12'));var Papa=require(_0xb6ac('0x13'));var Redis=require(_0xb6ac('0x14'));var authService=require(_0xb6ac('0x15'));var qs=require(_0xb6ac('0x16'));var as=require(_0xb6ac('0x17'));var hardwareService=require(_0xb6ac('0x18'));var logger=require('../../config/logger')(_0xb6ac('0x19'));var utils=require('../../config/utils');var config=require(_0xb6ac('0x1a'));var licenseUtil=require(_0xb6ac('0x1b'));var db=require(_0xb6ac('0x1c'))['db'];function respondWithStatusCode(_0x18c57a,_0x31cc76){_0x31cc76=_0x31cc76||0xcc;return function(_0x1a49e3){if(_0x1a49e3){return _0x18c57a['sendStatus'](_0x31cc76);}return _0x18c57a[_0xb6ac('0x1d')](_0x31cc76)[_0xb6ac('0x1e')]();};}function respondWithResult(_0x450eac,_0x27f349){_0x27f349=_0x27f349||0xc8;return function(_0x21984c){if(_0x21984c){return _0x450eac['status'](_0x27f349)[_0xb6ac('0x1f')](_0x21984c);}};}function respondWithFilteredResult(_0x2d162b,_0x5900f1){return function(_0x4b0187){if(_0x4b0187){var _0x3c077f=typeof _0x5900f1[_0xb6ac('0x20')]===_0xb6ac('0x21')&&typeof _0x5900f1['limit']===_0xb6ac('0x21');var _0x1bfe90=_0x4b0187[_0xb6ac('0x22')];var _0xf6a3bc=_0x3c077f?0x0:_0x5900f1[_0xb6ac('0x20')];var _0x28a699=_0x3c077f?_0x4b0187['count']:_0x5900f1['offset']+_0x5900f1[_0xb6ac('0x23')];var _0x3a280e;if(_0x28a699>=_0x1bfe90){_0x28a699=_0x1bfe90;_0x3a280e=0xc8;}else{_0x3a280e=0xce;}_0x2d162b[_0xb6ac('0x1d')](_0x3a280e);return _0x2d162b['set']('Content-Range',_0xf6a3bc+'-'+_0x28a699+'/'+_0x1bfe90)[_0xb6ac('0x1f')](_0x4b0187);}return null;};}function patchUpdates(_0x46f74b){return function(_0x15141c){try{jsonpatch[_0xb6ac('0x24')](_0x15141c,_0x46f74b,!![]);}catch(_0x5c4cf4){return BPromise[_0xb6ac('0x25')](_0x5c4cf4);}return _0x15141c[_0xb6ac('0x26')]();};}function saveUpdates(_0x110505,_0x5a1455){return function(_0x4cc97f){if(_0x4cc97f){return _0x4cc97f[_0xb6ac('0x27')](_0x110505)[_0xb6ac('0x28')](function(_0x11d0c2){return _0x11d0c2;});}return null;};}function removeEntity(_0x553825,_0x2f8782){return function(_0x117377){if(_0x117377){return _0x117377['destroy']()[_0xb6ac('0x28')](function(){_0x553825['status'](0xcc)[_0xb6ac('0x1e')]();});}};}function handleEntityNotFound(_0xfb57a0,_0x3699fb){return function(_0x2e160e){if(!_0x2e160e){_0xfb57a0['sendStatus'](0x194);}return _0x2e160e;};}function handleError(_0x269263,_0x454d79){_0x454d79=_0x454d79||0x1f4;return function(_0x384dfb){logger[_0xb6ac('0x29')](_0x384dfb['stack']);if(_0x384dfb[_0xb6ac('0x2a')]){delete _0x384dfb['name'];}_0x269263['status'](_0x454d79)[_0xb6ac('0x2b')](_0x384dfb);};}exports[_0xb6ac('0x2c')]=function(_0x6cd5d9,_0x5a0e22){var _0x1ded4a={},_0x13975b={},_0x5624dc={'count':0x0,'rows':[]};var _0x48b07c=_[_0xb6ac('0x2d')](db[_0xb6ac('0x2e')][_0xb6ac('0x2f')],function(_0x5b92f7){return{'name':_0x5b92f7[_0xb6ac('0x30')],'type':_0x5b92f7['type'][_0xb6ac('0x31')]};});_0x13975b[_0xb6ac('0x32')]=_[_0xb6ac('0x2d')](_0x48b07c,_0xb6ac('0x2a'));_0x13975b['query']=_[_0xb6ac('0x33')](_0x6cd5d9['query']);_0x13975b[_0xb6ac('0x34')]=_[_0xb6ac('0x35')](_0x13975b[_0xb6ac('0x32')],_0x13975b[_0xb6ac('0x36')]);_0x1ded4a[_0xb6ac('0x37')]=_['intersection'](_0x13975b[_0xb6ac('0x32')],qs[_0xb6ac('0x38')](_0x6cd5d9['query'][_0xb6ac('0x38')]));_0x1ded4a['attributes']=_0x1ded4a[_0xb6ac('0x37')][_0xb6ac('0x39')]?_0x1ded4a['attributes']:_0x13975b[_0xb6ac('0x32')];if(!_0x6cd5d9[_0xb6ac('0x36')]['hasOwnProperty'](_0xb6ac('0x3a'))){_0x1ded4a['limit']=qs[_0xb6ac('0x23')](_0x6cd5d9[_0xb6ac('0x36')]['limit']);_0x1ded4a['offset']=qs[_0xb6ac('0x20')](_0x6cd5d9['query'][_0xb6ac('0x20')]);}_0x1ded4a[_0xb6ac('0x3b')]=qs[_0xb6ac('0x3c')](_0x6cd5d9[_0xb6ac('0x36')]['sort']);_0x1ded4a[_0xb6ac('0x3d')]=qs[_0xb6ac('0x34')](_[_0xb6ac('0x3e')](_0x6cd5d9[_0xb6ac('0x36')],_0x13975b['filters']),_0x48b07c);if(_0x6cd5d9['query']['filter']){_0x1ded4a[_0xb6ac('0x3d')]=_[_0xb6ac('0x3f')](_0x1ded4a[_0xb6ac('0x3d')],{'$or':_[_0xb6ac('0x2d')](_0x48b07c,function(_0x265f34){if(_0x265f34[_0xb6ac('0x40')]!=='VIRTUAL'){var _0x1cb98b={};_0x1cb98b[_0x265f34[_0xb6ac('0x2a')]]={'$like':'%'+_0x6cd5d9[_0xb6ac('0x36')]['filter']+'%'};return _0x1cb98b;}})});}_0x1ded4a=_[_0xb6ac('0x3f')]({},_0x1ded4a,_0x6cd5d9[_0xb6ac('0x41')]);var _0x687634={'where':_0x1ded4a[_0xb6ac('0x3d')]};return db[_0xb6ac('0x2e')][_0xb6ac('0x22')](_0x687634)['then'](function(_0x28b90d){_0x5624dc[_0xb6ac('0x22')]=_0x28b90d;if(_0x6cd5d9[_0xb6ac('0x36')][_0xb6ac('0x42')]){_0x1ded4a['include']=[{'all':!![]}];}return db[_0xb6ac('0x2e')][_0xb6ac('0x43')](_0x1ded4a);})[_0xb6ac('0x28')](function(_0x4db176){_0x5624dc['rows']=_0x4db176;return _0x5624dc;})['then'](respondWithFilteredResult(_0x5a0e22,_0x1ded4a))[_0xb6ac('0x44')](handleError(_0x5a0e22,null));};exports[_0xb6ac('0x45')]=function(_0xde8cb9,_0xa41ed0){var _0x386950={'raw':!![],'where':{'id':_0xde8cb9['params']['id']}},_0x587412={};_0x587412[_0xb6ac('0x32')]=_['keys'](db['ServicenowField'][_0xb6ac('0x2f')]);_0x587412[_0xb6ac('0x36')]=_[_0xb6ac('0x33')](_0xde8cb9[_0xb6ac('0x36')]);_0x587412['filters']=_[_0xb6ac('0x35')](_0x587412[_0xb6ac('0x32')],_0x587412[_0xb6ac('0x36')]);_0x386950[_0xb6ac('0x37')]=_['intersection'](_0x587412[_0xb6ac('0x32')],qs[_0xb6ac('0x38')](_0xde8cb9[_0xb6ac('0x36')][_0xb6ac('0x38')]));_0x386950[_0xb6ac('0x37')]=_0x386950['attributes']['length']?_0x386950['attributes']:_0x587412[_0xb6ac('0x32')];if(_0xde8cb9[_0xb6ac('0x36')][_0xb6ac('0x42')]){_0x386950['include']=[{'all':!![]}];}_0x386950=_['merge']({},_0x386950,_0xde8cb9[_0xb6ac('0x41')]);return db['ServicenowField']['find'](_0x386950)['then'](handleEntityNotFound(_0xa41ed0,null))['then'](respondWithResult(_0xa41ed0,null))[_0xb6ac('0x44')](handleError(_0xa41ed0,null));};exports[_0xb6ac('0x46')]=function(_0x3876f0,_0x388bac){return db[_0xb6ac('0x2e')]['create'](_0x3876f0[_0xb6ac('0x47')],{})[_0xb6ac('0x28')](respondWithResult(_0x388bac,0xc9))[_0xb6ac('0x44')](handleError(_0x388bac,null));};exports[_0xb6ac('0x27')]=function(_0x3235eb,_0x503972){if(_0x3235eb[_0xb6ac('0x47')]['id']){delete _0x3235eb[_0xb6ac('0x47')]['id'];}return db[_0xb6ac('0x2e')][_0xb6ac('0x48')]({'where':{'id':_0x3235eb['params']['id']}})['then'](handleEntityNotFound(_0x503972,null))[_0xb6ac('0x28')](saveUpdates(_0x3235eb['body'],null))[_0xb6ac('0x28')](respondWithResult(_0x503972,null))['catch'](handleError(_0x503972,null));};exports[_0xb6ac('0x49')]=function(_0x3a6de0,_0x187db9){return db[_0xb6ac('0x2e')]['find']({'where':{'id':_0x3a6de0[_0xb6ac('0x4a')]['id']}})[_0xb6ac('0x28')](handleEntityNotFound(_0x187db9,null))['then'](removeEntity(_0x187db9,null))[_0xb6ac('0x44')](handleError(_0x187db9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6561023..eda52f6 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 _0xbddb=['api','moment','bluebird','request-promise','path','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','util'];(function(_0xaa0679,_0x8f4bcb){var _0x3ff0a7=function(_0x3b66e8){while(--_0x3b66e8){_0xaa0679['push'](_0xaa0679['shift']());}};_0x3ff0a7(++_0x8f4bcb);}(_0xbddb,0x11d));var _0xbbdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbddb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xbbdd('0x0'));var logger=require('../../config/logger')(_0xbbdd('0x1'));var moment=require(_0xbbdd('0x2'));var BPromise=require(_0xbbdd('0x3'));var rp=require(_0xbbdd('0x4'));var fs=require('fs');var path=require(_0xbbdd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbdd('0x6'));module[_0xbbdd('0x7')]=function(_0x4a52b9,_0x2b2b98){return _0x4a52b9[_0xbbdd('0x8')](_0xbbdd('0x9'),attributes,{'tableName':_0xbbdd('0xa'),'paranoid':![],'indexes':[{'name':_0xbbdd('0xb'),'fields':['idField',_0xbbdd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7348=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x325cc0,_0x4f6b66){var _0x4fab66=function(_0x168dd7){while(--_0x168dd7){_0x325cc0['push'](_0x325cc0['shift']());}};_0x4fab66(++_0x4f6b66);}(_0x7348,0xa8));var _0x8734=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7348[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8734('0x0'));var util=require(_0x8734('0x1'));var logger=require('../../config/logger')(_0x8734('0x2'));var moment=require(_0x8734('0x3'));var BPromise=require(_0x8734('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8734('0x5'));var rimraf=require(_0x8734('0x6'));var config=require(_0x8734('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x8734('0x8')]=function(_0x21e3ab,_0x2dc9ac){return _0x21e3ab['define']('ServicenowField',attributes,{'tableName':_0x8734('0x9'),'paranoid':![],'indexes':[{'name':_0x8734('0xa'),'fields':[_0x8734('0xb'),'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 25a6e6e..5ed2f46 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x32f70b,_0x26430f){var _0x5cb010=function(_0x50228e){while(--_0x50228e){_0x32f70b['push'](_0x32f70b['shift']());}};_0x5cb010(++_0x26430f);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x6c176,_0x14e00b){_0x6c176=_0x6c176-0x0;var _0x11fa0d=_0x9ffd[_0x6c176];return _0x11fa0d;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x1891b9,_0x2d2c08){var _0x57c5c2=function(_0xf142c1){while(--_0xf142c1){_0x1891b9['push'](_0x1891b9['shift']());}};_0x57c5c2(++_0x2d2c08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7d550ee..4b8d81c 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(_0x1109f3,_0x10333e){var _0x552b03=function(_0x1cc982){while(--_0x1cc982){_0x1109f3['push'](_0x1109f3['shift']());}};_0x552b03(++_0x10333e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x1d1da2,_0x2d0234){var _0x1b6c79=function(_0x1add24){while(--_0x1add24){_0x1d1da2['push'](_0x1d1da2['shift']());}};_0x1b6c79(++_0x2d0234);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 22adebe..6f5ee3e 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(_0x4700b9,_0x58879a){var _0xf9a14d=function(_0x4be797){while(--_0x4be797){_0x4700b9['push'](_0x4700b9['shift']());}};_0xf9a14d(++_0x58879a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x1275eb,_0xcb0044){var _0x54e646=function(_0x459425){while(--_0x459425){_0x1275eb['push'](_0x1275eb['shift']());}};_0x54e646(++_0xcb0044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 a17ffc6..e057042 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 _0x5e71=['body','getConfigurations','findOne','SugarcrmConfiguration','order','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','channel','create','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x5e71,0x123));var _0x15e7=function(_0x385ebe,_0x25fe9d){_0x385ebe=_0x385ebe-0x0;var _0xb18314=_0x5e71[_0x385ebe];return _0xb18314;};'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(_0x15e7('0x0'));var moment=require(_0x15e7('0x1'));var BPromise=require(_0x15e7('0x2'));var Mustache=require('mustache');var util=require(_0x15e7('0x3'));var path=require(_0x15e7('0x4'));var sox=require(_0x15e7('0x5'));var csv=require(_0x15e7('0x6'));var ejs=require(_0x15e7('0x7'));var fs=require('fs');var fs_extra=require(_0x15e7('0x8'));var _=require(_0x15e7('0x9'));var squel=require('squel');var crypto=require(_0x15e7('0xa'));var jsforce=require(_0x15e7('0xb'));var deskjs=require(_0x15e7('0xc'));var toCsv=require(_0x15e7('0x6'));var querystring=require(_0x15e7('0xd'));var Papa=require(_0x15e7('0xe'));var Redis=require('ioredis');var authService=require(_0x15e7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x15e7('0x10'));var hardwareService=require(_0x15e7('0x11'));var logger=require(_0x15e7('0x12'))('api');var utils=require(_0x15e7('0x13'));var config=require(_0x15e7('0x14'));var licenseUtil=require(_0x15e7('0x15'));var db=require(_0x15e7('0x16'))['db'];var integrations=require(_0x15e7('0x17'));function respondWithStatusCode(_0x4dab2e,_0x17afe2){_0x17afe2=_0x17afe2||0xcc;return function(_0x2b7975){if(_0x2b7975){return _0x4dab2e[_0x15e7('0x18')](_0x17afe2);}return _0x4dab2e[_0x15e7('0x19')](_0x17afe2)[_0x15e7('0x1a')]();};}function respondWithResult(_0x578f25,_0x4665c6){_0x4665c6=_0x4665c6||0xc8;return function(_0x2b079b){if(_0x2b079b){return _0x578f25[_0x15e7('0x19')](_0x4665c6)[_0x15e7('0x1b')](_0x2b079b);}};}function respondWithFilteredResult(_0xcb22ca,_0x30ebec){return function(_0x5f53f1){if(_0x5f53f1){var _0x7c610b=typeof _0x30ebec[_0x15e7('0x1c')]==='undefined'&&typeof _0x30ebec[_0x15e7('0x1d')]===_0x15e7('0x1e');var _0x1ae4ed=_0x5f53f1[_0x15e7('0x1f')];var _0x53a34c=_0x7c610b?0x0:_0x30ebec[_0x15e7('0x1c')];var _0xb6b0f4=_0x7c610b?_0x5f53f1['count']:_0x30ebec[_0x15e7('0x1c')]+_0x30ebec['limit'];var _0x3a2af4;if(_0xb6b0f4>=_0x1ae4ed){_0xb6b0f4=_0x1ae4ed;_0x3a2af4=0xc8;}else{_0x3a2af4=0xce;}_0xcb22ca[_0x15e7('0x19')](_0x3a2af4);return _0xcb22ca['set'](_0x15e7('0x20'),_0x53a34c+'-'+_0xb6b0f4+'/'+_0x1ae4ed)[_0x15e7('0x1b')](_0x5f53f1);}return null;};}function patchUpdates(_0x15d33d){return function(_0x2d60c6){try{jsonpatch[_0x15e7('0x21')](_0x2d60c6,_0x15d33d,!![]);}catch(_0x3771a7){return BPromise['reject'](_0x3771a7);}return _0x2d60c6[_0x15e7('0x22')]();};}function saveUpdates(_0x2379ec,_0xe59125){return function(_0x15b710){if(_0x15b710){return _0x15b710[_0x15e7('0x23')](_0x2379ec)[_0x15e7('0x24')](function(_0x322c95){return _0x322c95;});}return null;};}function removeEntity(_0x29da7,_0x4f6301){return function(_0xb71dac){if(_0xb71dac){return _0xb71dac[_0x15e7('0x25')]()[_0x15e7('0x24')](function(){_0x29da7[_0x15e7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfcd202,_0x55ed35){return function(_0x525bd1){if(!_0x525bd1){_0xfcd202[_0x15e7('0x18')](0x194);}return _0x525bd1;};}function handleError(_0x22f974,_0x2a18d6){_0x2a18d6=_0x2a18d6||0x1f4;return function(_0x22c542){logger['error'](_0x22c542[_0x15e7('0x26')]);if(_0x22c542['name']){delete _0x22c542[_0x15e7('0x27')];}_0x22f974['status'](_0x2a18d6)['send'](_0x22c542);};}exports['index']=function(_0x19160e,_0x171520){var _0x12ed1={},_0x1adfac={},_0x1f3f97={'count':0x0,'rows':[]};var _0x43e323=_[_0x15e7('0x28')](db[_0x15e7('0x29')][_0x15e7('0x2a')],function(_0x494fdc){return{'name':_0x494fdc[_0x15e7('0x2b')],'type':_0x494fdc[_0x15e7('0x2c')][_0x15e7('0x2d')]};});_0x1adfac[_0x15e7('0x2e')]=_[_0x15e7('0x28')](_0x43e323,_0x15e7('0x27'));_0x1adfac['query']=_[_0x15e7('0x2f')](_0x19160e[_0x15e7('0x30')]);_0x1adfac[_0x15e7('0x31')]=_['intersection'](_0x1adfac[_0x15e7('0x2e')],_0x1adfac[_0x15e7('0x30')]);_0x12ed1[_0x15e7('0x32')]=_[_0x15e7('0x33')](_0x1adfac[_0x15e7('0x2e')],qs[_0x15e7('0x34')](_0x19160e[_0x15e7('0x30')][_0x15e7('0x34')]));_0x12ed1[_0x15e7('0x32')]=_0x12ed1[_0x15e7('0x32')][_0x15e7('0x35')]?_0x12ed1['attributes']:_0x1adfac[_0x15e7('0x2e')];if(!_0x19160e[_0x15e7('0x30')][_0x15e7('0x36')]('nolimit')){_0x12ed1[_0x15e7('0x1d')]=qs[_0x15e7('0x1d')](_0x19160e[_0x15e7('0x30')]['limit']);_0x12ed1[_0x15e7('0x1c')]=qs[_0x15e7('0x1c')](_0x19160e['query'][_0x15e7('0x1c')]);}_0x12ed1['order']=qs[_0x15e7('0x37')](_0x19160e[_0x15e7('0x30')][_0x15e7('0x37')]);_0x12ed1[_0x15e7('0x38')]=qs['filters'](_[_0x15e7('0x39')](_0x19160e[_0x15e7('0x30')],_0x1adfac['filters']),_0x43e323);if(_0x19160e[_0x15e7('0x30')][_0x15e7('0x3a')]){_0x12ed1[_0x15e7('0x38')]=_[_0x15e7('0x3b')](_0x12ed1[_0x15e7('0x38')],{'$or':_['map'](_0x43e323,function(_0x7ed514){if(_0x7ed514['type']!=='VIRTUAL'){var _0x55df67={};_0x55df67[_0x7ed514['name']]={'$like':'%'+_0x19160e[_0x15e7('0x30')][_0x15e7('0x3a')]+'%'};return _0x55df67;}})});}_0x12ed1=_[_0x15e7('0x3b')]({},_0x12ed1,_0x19160e[_0x15e7('0x3c')]);var _0x63de17={'where':_0x12ed1[_0x15e7('0x38')]};return db[_0x15e7('0x29')][_0x15e7('0x1f')](_0x63de17)[_0x15e7('0x24')](function(_0x5335b5){_0x1f3f97[_0x15e7('0x1f')]=_0x5335b5;if(_0x19160e[_0x15e7('0x30')][_0x15e7('0x3d')]){_0x12ed1[_0x15e7('0x3e')]=[{'all':!![]}];}return db[_0x15e7('0x29')][_0x15e7('0x3f')](_0x12ed1);})[_0x15e7('0x24')](function(_0x2c1988){_0x1f3f97[_0x15e7('0x40')]=_0x2c1988;return _0x1f3f97;})[_0x15e7('0x24')](respondWithFilteredResult(_0x171520,_0x12ed1))[_0x15e7('0x41')](handleError(_0x171520,null));};exports[_0x15e7('0x42')]=function(_0x1b2e17,_0x47d175){var _0x1a57a7={'raw':![],'where':{'id':_0x1b2e17[_0x15e7('0x43')]['id']}},_0x24e8df={};_0x24e8df[_0x15e7('0x2e')]=_[_0x15e7('0x2f')](db[_0x15e7('0x29')]['rawAttributes']);_0x24e8df[_0x15e7('0x30')]=_[_0x15e7('0x2f')](_0x1b2e17['query']);_0x24e8df[_0x15e7('0x31')]=_['intersection'](_0x24e8df[_0x15e7('0x2e')],_0x24e8df['query']);_0x1a57a7['attributes']=_[_0x15e7('0x33')](_0x24e8df[_0x15e7('0x2e')],qs['fields'](_0x1b2e17[_0x15e7('0x30')][_0x15e7('0x34')]));_0x1a57a7[_0x15e7('0x32')]=_0x1a57a7[_0x15e7('0x32')][_0x15e7('0x35')]?_0x1a57a7['attributes']:_0x24e8df[_0x15e7('0x2e')];if(_0x1b2e17['query'][_0x15e7('0x3d')]){_0x1a57a7['include']=[{'all':!![]}];}_0x1a57a7=_[_0x15e7('0x3b')]({},_0x1a57a7,_0x1b2e17[_0x15e7('0x3c')]);return db[_0x15e7('0x29')][_0x15e7('0x44')](_0x1a57a7)[_0x15e7('0x24')](handleEntityNotFound(_0x47d175,null))[_0x15e7('0x24')](respondWithResult(_0x47d175,null))[_0x15e7('0x41')](handleError(_0x47d175,null));};exports['create']=function(_0x3d4d07,_0x327ce7){return db[_0x15e7('0x29')]['create'](_0x3d4d07[_0x15e7('0x45')],{})[_0x15e7('0x24')](respondWithResult(_0x327ce7,0xc9))[_0x15e7('0x41')](handleError(_0x327ce7,null));};exports[_0x15e7('0x23')]=function(_0x2bfc6d,_0x466d4c){if(_0x2bfc6d[_0x15e7('0x45')]['id']){delete _0x2bfc6d['body']['id'];}return db['SugarcrmAccount'][_0x15e7('0x44')]({'where':{'id':_0x2bfc6d[_0x15e7('0x43')]['id']}})['then'](handleEntityNotFound(_0x466d4c,null))[_0x15e7('0x24')](saveUpdates(_0x2bfc6d['body'],null))[_0x15e7('0x24')](respondWithResult(_0x466d4c,null))[_0x15e7('0x41')](handleError(_0x466d4c,null));};exports[_0x15e7('0x25')]=function(_0x3bc810,_0x2c71bf){return db[_0x15e7('0x29')][_0x15e7('0x44')]({'where':{'id':_0x3bc810[_0x15e7('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c71bf,null))[_0x15e7('0x24')](removeEntity(_0x2c71bf,null))['catch'](handleError(_0x2c71bf,null));};exports[_0x15e7('0x46')]=function(_0x315072,_0x5a0c22,_0x2e6e5b){var _0x1831c5={};var _0x267a3c={};var _0x2498c0;var _0x4a9403;return db[_0x15e7('0x29')][_0x15e7('0x47')]({'where':{'id':_0x315072[_0x15e7('0x43')]['id']}})[_0x15e7('0x24')](handleEntityNotFound(_0x5a0c22,null))['then'](function(_0x33d669){if(_0x33d669){_0x2498c0=_0x33d669;_0x267a3c[_0x15e7('0x2e')]=_[_0x15e7('0x2f')](db[_0x15e7('0x48')][_0x15e7('0x2a')]);_0x267a3c[_0x15e7('0x30')]=_[_0x15e7('0x2f')](_0x315072['query']);_0x267a3c[_0x15e7('0x31')]=_[_0x15e7('0x33')](_0x267a3c['model'],_0x267a3c[_0x15e7('0x30')]);_0x1831c5[_0x15e7('0x32')]=_[_0x15e7('0x33')](_0x267a3c[_0x15e7('0x2e')],qs[_0x15e7('0x34')](_0x315072[_0x15e7('0x30')]['fields']));_0x1831c5[_0x15e7('0x32')]=_0x1831c5[_0x15e7('0x32')][_0x15e7('0x35')]?_0x1831c5['attributes']:_0x267a3c[_0x15e7('0x2e')];_0x1831c5[_0x15e7('0x49')]=qs[_0x15e7('0x37')](_0x315072[_0x15e7('0x30')][_0x15e7('0x37')]);_0x1831c5[_0x15e7('0x38')]=qs[_0x15e7('0x31')](_[_0x15e7('0x39')](_0x315072[_0x15e7('0x30')],_0x267a3c['filters']));if(_0x315072[_0x15e7('0x30')]['filter']){_0x1831c5['where']=_['merge'](_0x1831c5[_0x15e7('0x38')],{'$or':_[_0x15e7('0x28')](_0x1831c5[_0x15e7('0x32')],function(_0x266805){var _0x481e7f={};_0x481e7f[_0x266805]={'$like':'%'+_0x315072[_0x15e7('0x30')][_0x15e7('0x3a')]+'%'};return _0x481e7f;})});}_0x1831c5=_[_0x15e7('0x3b')]({},_0x1831c5,_0x315072['options']);return _0x2498c0[_0x15e7('0x46')](_0x1831c5);}})['then'](function(_0x21a823){if(_0x21a823){_0x4a9403=_0x21a823[_0x15e7('0x35')];if(!_0x315072[_0x15e7('0x30')]['hasOwnProperty'](_0x15e7('0x4a'))){_0x1831c5['limit']=qs[_0x15e7('0x1d')](_0x315072[_0x15e7('0x30')]['limit']);_0x1831c5['offset']=qs[_0x15e7('0x1c')](_0x315072[_0x15e7('0x30')][_0x15e7('0x1c')]);}return _0x2498c0[_0x15e7('0x46')](_0x1831c5);}})['then'](function(_0x52859c){if(_0x52859c){return _0x52859c?{'count':_0x4a9403,'rows':_0x52859c}:null;}})['then'](respondWithResult(_0x5a0c22,null))[_0x15e7('0x41')](handleError(_0x5a0c22,null));};exports['addConfiguration']=function(_0x3be9ee,_0x5a5b22,_0x29c791){if(_0x3be9ee['body']['id']){delete _0x3be9ee['body']['id'];}return db['SugarcrmAccount'][_0x15e7('0x47')]({'where':{'id':_0x3be9ee[_0x15e7('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a5b22,null))[_0x15e7('0x24')](function(_0x4c9b17){if(_0x4c9b17){_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x4b')]=_0x4c9b17['id'];_0x3be9ee['body']['Subjects']=integrations[_0x15e7('0x4c')](_0x3be9ee[_0x15e7('0x45')]['channel'],_0x3be9ee['body'][_0x15e7('0x2c')]);_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x4d')]=integrations[_0x15e7('0x4e')](_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x4f')],_0x3be9ee[_0x15e7('0x45')][_0x15e7('0x2c')]);return db['SugarcrmConfiguration'][_0x15e7('0x50')](_0x3be9ee[_0x15e7('0x45')],{'include':[{'model':db[_0x15e7('0x51')],'as':_0x15e7('0x52')},{'model':db[_0x15e7('0x51')],'as':_0x15e7('0x4d')}]});}return null;})[_0x15e7('0x24')](respondWithResult(_0x5a5b22,null))['catch'](handleError(_0x5a5b22,null));};exports[_0x15e7('0x53')]=function(_0x4f72ae,_0x269c97,_0x34d725){var _0x956c62='';var _0x2091c3=['id','name',_0x15e7('0x54'),_0x15e7('0x55'),'description','date_start',_0x15e7('0x56'),_0x15e7('0x57'),'parent_id',_0x15e7('0x58'),_0x15e7('0x59'),_0x15e7('0x5a')];return db['SugarcrmAccount'][_0x15e7('0x47')]({'where':{'id':_0x4f72ae[_0x15e7('0x43')]['id']},'attributes':['id',_0x15e7('0x5b'),_0x15e7('0x5c'),_0x15e7('0x5d')]})[_0x15e7('0x24')](handleEntityNotFound(_0x269c97,null))[_0x15e7('0x24')](function(_0x456596){if(_0x456596){_0x956c62=_0x456596['remoteUri'];var _0x1c8d13=_0x956c62[_0x15e7('0x5e')](-0x1);if(_0x1c8d13==='/'){_0x956c62=_0x956c62[_0x15e7('0x5f')](0x0,_0x956c62[_0x15e7('0x60')](_0x1c8d13));}return rp({'method':'POST','uri':util[_0x15e7('0x61')](_0x15e7('0x62'),_0x956c62,_0x15e7('0x63')),'json':!![],'form':{'method':_0x15e7('0x64'),'input_type':_0x15e7('0x65'),'response_type':_0x15e7('0x65'),'rest_data':JSON[_0x15e7('0x66')]({'user_auth':{'user_name':_0x456596[_0x15e7('0x5b')],'password':_0x456596[_0x15e7('0x5c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x15e7('0x24')](function(_0x38e39a){if(_0x38e39a&&_0x38e39a['name']!=='Invalid\x20Login'&&_0x38e39a[_0x15e7('0x27')]!==_0x15e7('0x67')){return rp({'method':_0x15e7('0x68'),'uri':util['format'](_0x15e7('0x62'),_0x956c62,_0x15e7('0x63')),'json':!![],'form':{'method':_0x15e7('0x69'),'input_type':_0x15e7('0x65'),'response_type':_0x15e7('0x65'),'rest_data':JSON[_0x15e7('0x66')]({'session':_0x38e39a['id'],'module_name':_0x15e7('0x6a')})}})[_0x15e7('0x24')](function(_0x179b7b){if(_0x179b7b){var _0x95dc08=_[_0x15e7('0x6b')](_0x179b7b[_0x15e7('0x6c')]);_[_0x15e7('0x6d')](_0x95dc08,function(_0x10d387){return _0x2091c3[_0x15e7('0x6e')](_0x10d387[_0x15e7('0x27')]);});return{'count':_0x95dc08[_0x15e7('0x35')],'rows':_[_0x15e7('0x28')](_0x95dc08,function(_0x381b2d){return{'id':_0x381b2d['name'],'name':_0x381b2d[_0x15e7('0x6f')],'custom':_[_0x15e7('0x70')](_0x381b2d[_0x15e7('0x27')],'_c')?!![]:![],'options':_0x381b2d[_0x15e7('0x3c')]?_['map'](_['values'](_0x381b2d[_0x15e7('0x3c')]),function(_0x3c3cf0){return{'name':_0x3c3cf0[_0x15e7('0x71')],'value':_0x3c3cf0[_0x15e7('0x27')]};}):[]};})};}})[_0x15e7('0x24')](respondWithResult(_0x269c97,null))[_0x15e7('0x41')](function(_0x353abe){var _0x45b999=_0x4f72ae[_0x15e7('0x30')][_0x15e7('0x72')]?0x1f4:_0x353abe[_0x15e7('0x73')]||0x1f4;logger[_0x15e7('0x74')](_0x15e7('0x75'),_0x15e7('0x53'),_0x45b999,JSON[_0x15e7('0x66')](_0x353abe));delete _0x353abe[_0x15e7('0x27')];if(_0x45b999===0x191){_0x45b999=0x190;}_0x269c97['status'](_0x45b999)[_0x15e7('0x76')](_0x4f72ae['query'][_0x15e7('0x72')]?{'message':_0x15e7('0x77'),'statusCode':_0x353abe[_0x15e7('0x73')]}:_0x353abe);});}else{var _0x3f660b=0x1f4;_0x269c97[_0x15e7('0x19')](_0x3f660b)[_0x15e7('0x76')]({'message':_0x15e7('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9aae=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','value','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9aae,0x163));var _0xe9aa=function(_0x37b3ed,_0x3eca89){_0x37b3ed=_0x37b3ed-0x0;var _0x3a2a2a=_0x9aae[_0x37b3ed];return _0x3a2a2a;};'use strict';var emlformat=require(_0xe9aa('0x0'));var rimraf=require(_0xe9aa('0x1'));var zipdir=require(_0xe9aa('0x2'));var jsonpatch=require(_0xe9aa('0x3'));var rp=require(_0xe9aa('0x4'));var moment=require(_0xe9aa('0x5'));var BPromise=require(_0xe9aa('0x6'));var Mustache=require('mustache');var util=require(_0xe9aa('0x7'));var path=require(_0xe9aa('0x8'));var sox=require(_0xe9aa('0x9'));var csv=require(_0xe9aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9aa('0xb'));var squel=require(_0xe9aa('0xc'));var crypto=require(_0xe9aa('0xd'));var jsforce=require(_0xe9aa('0xe'));var deskjs=require(_0xe9aa('0xf'));var toCsv=require(_0xe9aa('0xa'));var querystring=require('querystring');var Papa=require(_0xe9aa('0x10'));var Redis=require(_0xe9aa('0x11'));var authService=require(_0xe9aa('0x12'));var qs=require(_0xe9aa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9aa('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xe9aa('0x15'));var config=require(_0xe9aa('0x16'));var licenseUtil=require(_0xe9aa('0x17'));var db=require(_0xe9aa('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5bed92,_0x487057){_0x487057=_0x487057||0xcc;return function(_0x23e617){if(_0x23e617){return _0x5bed92[_0xe9aa('0x19')](_0x487057);}return _0x5bed92['status'](_0x487057)[_0xe9aa('0x1a')]();};}function respondWithResult(_0x2d99cb,_0x33acbc){_0x33acbc=_0x33acbc||0xc8;return function(_0x138f30){if(_0x138f30){return _0x2d99cb[_0xe9aa('0x1b')](_0x33acbc)[_0xe9aa('0x1c')](_0x138f30);}};}function respondWithFilteredResult(_0x2bc04b,_0x22694f){return function(_0x3e818d){if(_0x3e818d){var _0x905e0b=typeof _0x22694f[_0xe9aa('0x1d')]===_0xe9aa('0x1e')&&typeof _0x22694f[_0xe9aa('0x1f')]===_0xe9aa('0x1e');var _0xe6741f=_0x3e818d[_0xe9aa('0x20')];var _0x7ecf1b=_0x905e0b?0x0:_0x22694f[_0xe9aa('0x1d')];var _0x4545f6=_0x905e0b?_0x3e818d[_0xe9aa('0x20')]:_0x22694f['offset']+_0x22694f['limit'];var _0x53962f;if(_0x4545f6>=_0xe6741f){_0x4545f6=_0xe6741f;_0x53962f=0xc8;}else{_0x53962f=0xce;}_0x2bc04b[_0xe9aa('0x1b')](_0x53962f);return _0x2bc04b['set'](_0xe9aa('0x21'),_0x7ecf1b+'-'+_0x4545f6+'/'+_0xe6741f)[_0xe9aa('0x1c')](_0x3e818d);}return null;};}function patchUpdates(_0x5743d7){return function(_0x253e1d){try{jsonpatch[_0xe9aa('0x22')](_0x253e1d,_0x5743d7,!![]);}catch(_0x3c3aa3){return BPromise[_0xe9aa('0x23')](_0x3c3aa3);}return _0x253e1d[_0xe9aa('0x24')]();};}function saveUpdates(_0x292ca3,_0x1ec15b){return function(_0x533e89){if(_0x533e89){return _0x533e89[_0xe9aa('0x25')](_0x292ca3)[_0xe9aa('0x26')](function(_0x19a2f4){return _0x19a2f4;});}return null;};}function removeEntity(_0x25520a,_0x4d711f){return function(_0x201661){if(_0x201661){return _0x201661[_0xe9aa('0x27')]()[_0xe9aa('0x26')](function(){_0x25520a[_0xe9aa('0x1b')](0xcc)[_0xe9aa('0x1a')]();});}};}function handleEntityNotFound(_0x540e33,_0x192dab){return function(_0x3140ff){if(!_0x3140ff){_0x540e33[_0xe9aa('0x19')](0x194);}return _0x3140ff;};}function handleError(_0x41f8e6,_0x43244e){_0x43244e=_0x43244e||0x1f4;return function(_0x428414){logger[_0xe9aa('0x28')](_0x428414[_0xe9aa('0x29')]);if(_0x428414[_0xe9aa('0x2a')]){delete _0x428414[_0xe9aa('0x2a')];}_0x41f8e6[_0xe9aa('0x1b')](_0x43244e)['send'](_0x428414);};}exports[_0xe9aa('0x2b')]=function(_0x2800ea,_0x2e7aaf){var _0xcce67e={},_0x19e611={},_0x53d3ed={'count':0x0,'rows':[]};var _0x4d80bd=_[_0xe9aa('0x2c')](db[_0xe9aa('0x2d')][_0xe9aa('0x2e')],function(_0x324aa3){return{'name':_0x324aa3[_0xe9aa('0x2f')],'type':_0x324aa3[_0xe9aa('0x30')][_0xe9aa('0x31')]};});_0x19e611[_0xe9aa('0x32')]=_['map'](_0x4d80bd,_0xe9aa('0x2a'));_0x19e611[_0xe9aa('0x33')]=_[_0xe9aa('0x34')](_0x2800ea[_0xe9aa('0x33')]);_0x19e611[_0xe9aa('0x35')]=_[_0xe9aa('0x36')](_0x19e611[_0xe9aa('0x32')],_0x19e611[_0xe9aa('0x33')]);_0xcce67e[_0xe9aa('0x37')]=_[_0xe9aa('0x36')](_0x19e611[_0xe9aa('0x32')],qs[_0xe9aa('0x38')](_0x2800ea[_0xe9aa('0x33')]['fields']));_0xcce67e[_0xe9aa('0x37')]=_0xcce67e[_0xe9aa('0x37')][_0xe9aa('0x39')]?_0xcce67e[_0xe9aa('0x37')]:_0x19e611[_0xe9aa('0x32')];if(!_0x2800ea[_0xe9aa('0x33')]['hasOwnProperty'](_0xe9aa('0x3a'))){_0xcce67e['limit']=qs[_0xe9aa('0x1f')](_0x2800ea[_0xe9aa('0x33')]['limit']);_0xcce67e[_0xe9aa('0x1d')]=qs[_0xe9aa('0x1d')](_0x2800ea[_0xe9aa('0x33')][_0xe9aa('0x1d')]);}_0xcce67e['order']=qs[_0xe9aa('0x3b')](_0x2800ea['query'][_0xe9aa('0x3b')]);_0xcce67e[_0xe9aa('0x3c')]=qs[_0xe9aa('0x35')](_[_0xe9aa('0x3d')](_0x2800ea[_0xe9aa('0x33')],_0x19e611[_0xe9aa('0x35')]),_0x4d80bd);if(_0x2800ea[_0xe9aa('0x33')][_0xe9aa('0x3e')]){_0xcce67e[_0xe9aa('0x3c')]=_[_0xe9aa('0x3f')](_0xcce67e[_0xe9aa('0x3c')],{'$or':_[_0xe9aa('0x2c')](_0x4d80bd,function(_0x327d8f){if(_0x327d8f['type']!==_0xe9aa('0x40')){var _0x8f2e08={};_0x8f2e08[_0x327d8f[_0xe9aa('0x2a')]]={'$like':'%'+_0x2800ea[_0xe9aa('0x33')][_0xe9aa('0x3e')]+'%'};return _0x8f2e08;}})});}_0xcce67e=_['merge']({},_0xcce67e,_0x2800ea[_0xe9aa('0x41')]);var _0x7ac76e={'where':_0xcce67e[_0xe9aa('0x3c')]};return db[_0xe9aa('0x2d')][_0xe9aa('0x20')](_0x7ac76e)[_0xe9aa('0x26')](function(_0x1aceff){_0x53d3ed[_0xe9aa('0x20')]=_0x1aceff;if(_0x2800ea[_0xe9aa('0x33')][_0xe9aa('0x42')]){_0xcce67e[_0xe9aa('0x43')]=[{'all':!![]}];}return db[_0xe9aa('0x2d')][_0xe9aa('0x44')](_0xcce67e);})[_0xe9aa('0x26')](function(_0x54dc82){_0x53d3ed[_0xe9aa('0x45')]=_0x54dc82;return _0x53d3ed;})[_0xe9aa('0x26')](respondWithFilteredResult(_0x2e7aaf,_0xcce67e))[_0xe9aa('0x46')](handleError(_0x2e7aaf,null));};exports[_0xe9aa('0x47')]=function(_0x16019f,_0x4ffaba){var _0x196d8f={'raw':![],'where':{'id':_0x16019f[_0xe9aa('0x48')]['id']}},_0x55645a={};_0x55645a[_0xe9aa('0x32')]=_[_0xe9aa('0x34')](db[_0xe9aa('0x2d')]['rawAttributes']);_0x55645a[_0xe9aa('0x33')]=_[_0xe9aa('0x34')](_0x16019f['query']);_0x55645a[_0xe9aa('0x35')]=_[_0xe9aa('0x36')](_0x55645a[_0xe9aa('0x32')],_0x55645a[_0xe9aa('0x33')]);_0x196d8f[_0xe9aa('0x37')]=_['intersection'](_0x55645a['model'],qs[_0xe9aa('0x38')](_0x16019f['query'][_0xe9aa('0x38')]));_0x196d8f[_0xe9aa('0x37')]=_0x196d8f[_0xe9aa('0x37')]['length']?_0x196d8f[_0xe9aa('0x37')]:_0x55645a[_0xe9aa('0x32')];if(_0x16019f['query'][_0xe9aa('0x42')]){_0x196d8f[_0xe9aa('0x43')]=[{'all':!![]}];}_0x196d8f=_[_0xe9aa('0x3f')]({},_0x196d8f,_0x16019f['options']);return db[_0xe9aa('0x2d')][_0xe9aa('0x49')](_0x196d8f)[_0xe9aa('0x26')](handleEntityNotFound(_0x4ffaba,null))[_0xe9aa('0x26')](respondWithResult(_0x4ffaba,null))['catch'](handleError(_0x4ffaba,null));};exports[_0xe9aa('0x4a')]=function(_0x1e46e3,_0x25a946){return db[_0xe9aa('0x2d')][_0xe9aa('0x4a')](_0x1e46e3[_0xe9aa('0x4b')],{})[_0xe9aa('0x26')](respondWithResult(_0x25a946,0xc9))[_0xe9aa('0x46')](handleError(_0x25a946,null));};exports['update']=function(_0x52a1ad,_0x8dfd32){if(_0x52a1ad['body']['id']){delete _0x52a1ad['body']['id'];}return db[_0xe9aa('0x2d')][_0xe9aa('0x49')]({'where':{'id':_0x52a1ad[_0xe9aa('0x48')]['id']}})[_0xe9aa('0x26')](handleEntityNotFound(_0x8dfd32,null))[_0xe9aa('0x26')](saveUpdates(_0x52a1ad[_0xe9aa('0x4b')],null))[_0xe9aa('0x26')](respondWithResult(_0x8dfd32,null))[_0xe9aa('0x46')](handleError(_0x8dfd32,null));};exports[_0xe9aa('0x27')]=function(_0x1ecc7f,_0x103732){return db[_0xe9aa('0x2d')][_0xe9aa('0x49')]({'where':{'id':_0x1ecc7f['params']['id']}})[_0xe9aa('0x26')](handleEntityNotFound(_0x103732,null))[_0xe9aa('0x26')](removeEntity(_0x103732,null))[_0xe9aa('0x46')](handleError(_0x103732,null));};exports[_0xe9aa('0x4c')]=function(_0x476604,_0x10edd6,_0x11952f){var _0x343144={};var _0x2b23e7={};var _0x564f32;var _0xca2365;return db[_0xe9aa('0x2d')][_0xe9aa('0x4d')]({'where':{'id':_0x476604[_0xe9aa('0x48')]['id']}})[_0xe9aa('0x26')](handleEntityNotFound(_0x10edd6,null))['then'](function(_0x277c08){if(_0x277c08){_0x564f32=_0x277c08;_0x2b23e7[_0xe9aa('0x32')]=_[_0xe9aa('0x34')](db[_0xe9aa('0x4e')][_0xe9aa('0x2e')]);_0x2b23e7[_0xe9aa('0x33')]=_[_0xe9aa('0x34')](_0x476604[_0xe9aa('0x33')]);_0x2b23e7['filters']=_[_0xe9aa('0x36')](_0x2b23e7[_0xe9aa('0x32')],_0x2b23e7[_0xe9aa('0x33')]);_0x343144[_0xe9aa('0x37')]=_[_0xe9aa('0x36')](_0x2b23e7[_0xe9aa('0x32')],qs[_0xe9aa('0x38')](_0x476604['query'][_0xe9aa('0x38')]));_0x343144[_0xe9aa('0x37')]=_0x343144[_0xe9aa('0x37')][_0xe9aa('0x39')]?_0x343144['attributes']:_0x2b23e7['model'];_0x343144[_0xe9aa('0x4f')]=qs[_0xe9aa('0x3b')](_0x476604['query'][_0xe9aa('0x3b')]);_0x343144[_0xe9aa('0x3c')]=qs[_0xe9aa('0x35')](_[_0xe9aa('0x3d')](_0x476604[_0xe9aa('0x33')],_0x2b23e7[_0xe9aa('0x35')]));if(_0x476604[_0xe9aa('0x33')][_0xe9aa('0x3e')]){_0x343144[_0xe9aa('0x3c')]=_[_0xe9aa('0x3f')](_0x343144[_0xe9aa('0x3c')],{'$or':_[_0xe9aa('0x2c')](_0x343144[_0xe9aa('0x37')],function(_0x26e7c2){var _0x3ccb62={};_0x3ccb62[_0x26e7c2]={'$like':'%'+_0x476604[_0xe9aa('0x33')]['filter']+'%'};return _0x3ccb62;})});}_0x343144=_['merge']({},_0x343144,_0x476604[_0xe9aa('0x41')]);return _0x564f32[_0xe9aa('0x4c')](_0x343144);}})[_0xe9aa('0x26')](function(_0x26cf3a){if(_0x26cf3a){_0xca2365=_0x26cf3a['length'];if(!_0x476604['query'][_0xe9aa('0x50')](_0xe9aa('0x3a'))){_0x343144[_0xe9aa('0x1f')]=qs['limit'](_0x476604[_0xe9aa('0x33')][_0xe9aa('0x1f')]);_0x343144[_0xe9aa('0x1d')]=qs[_0xe9aa('0x1d')](_0x476604['query'][_0xe9aa('0x1d')]);}return _0x564f32[_0xe9aa('0x4c')](_0x343144);}})[_0xe9aa('0x26')](function(_0x449377){if(_0x449377){return _0x449377?{'count':_0xca2365,'rows':_0x449377}:null;}})[_0xe9aa('0x26')](respondWithResult(_0x10edd6,null))[_0xe9aa('0x46')](handleError(_0x10edd6,null));};exports[_0xe9aa('0x51')]=function(_0x207ab7,_0xd9de3e,_0x1892c8){if(_0x207ab7['body']['id']){delete _0x207ab7[_0xe9aa('0x4b')]['id'];}return db[_0xe9aa('0x2d')][_0xe9aa('0x4d')]({'where':{'id':_0x207ab7['params']['id']}})[_0xe9aa('0x26')](handleEntityNotFound(_0xd9de3e,null))[_0xe9aa('0x26')](function(_0x20eaf8){if(_0x20eaf8){_0x207ab7[_0xe9aa('0x4b')]['AccountId']=_0x20eaf8['id'];_0x207ab7['body'][_0xe9aa('0x52')]=integrations[_0xe9aa('0x53')](_0x207ab7['body'][_0xe9aa('0x54')],_0x207ab7['body'][_0xe9aa('0x30')]);_0x207ab7[_0xe9aa('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x207ab7[_0xe9aa('0x4b')][_0xe9aa('0x54')],_0x207ab7[_0xe9aa('0x4b')][_0xe9aa('0x30')]);return db[_0xe9aa('0x4e')][_0xe9aa('0x4a')](_0x207ab7[_0xe9aa('0x4b')],{'include':[{'model':db[_0xe9aa('0x55')],'as':_0xe9aa('0x52')},{'model':db[_0xe9aa('0x55')],'as':_0xe9aa('0x56')}]});}return null;})[_0xe9aa('0x26')](respondWithResult(_0xd9de3e,null))[_0xe9aa('0x46')](handleError(_0xd9de3e,null));};exports[_0xe9aa('0x57')]=function(_0xdba11,_0xe5c877,_0xc9105){var _0x1202f6='';var _0x29835b=['id',_0xe9aa('0x2a'),_0xe9aa('0x58'),_0xe9aa('0x59'),_0xe9aa('0x5a'),'date_start',_0xe9aa('0x5b'),_0xe9aa('0x5c'),_0xe9aa('0x5d'),'parent_type',_0xe9aa('0x5e'),_0xe9aa('0x5f')];return db[_0xe9aa('0x2d')][_0xe9aa('0x4d')]({'where':{'id':_0xdba11[_0xe9aa('0x48')]['id']},'attributes':['id',_0xe9aa('0x60'),'password','remoteUri']})[_0xe9aa('0x26')](handleEntityNotFound(_0xe5c877,null))[_0xe9aa('0x26')](function(_0x27de28){if(_0x27de28){_0x1202f6=_0x27de28[_0xe9aa('0x61')];var _0x2319cd=_0x1202f6[_0xe9aa('0x62')](-0x1);if(_0x2319cd==='/'){_0x1202f6=_0x1202f6[_0xe9aa('0x63')](0x0,_0x1202f6[_0xe9aa('0x64')](_0x2319cd));}return rp({'method':_0xe9aa('0x65'),'uri':util[_0xe9aa('0x66')](_0xe9aa('0x67'),_0x1202f6,_0xe9aa('0x68')),'json':!![],'form':{'method':_0xe9aa('0x69'),'input_type':_0xe9aa('0x6a'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x27de28[_0xe9aa('0x60')],'password':_0x27de28[_0xe9aa('0x6b')],'encryption':_0xe9aa('0x6c')},'application':_0xe9aa('0x6d')})}});}})[_0xe9aa('0x26')](function(_0x40205d){if(_0x40205d&&_0x40205d[_0xe9aa('0x2a')]!==_0xe9aa('0x6e')&&_0x40205d[_0xe9aa('0x2a')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xe9aa('0x66')](_0xe9aa('0x67'),_0x1202f6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xe9aa('0x6f'),'input_type':_0xe9aa('0x6a'),'response_type':_0xe9aa('0x6a'),'rest_data':JSON['stringify']({'session':_0x40205d['id'],'module_name':_0xe9aa('0x70')})}})['then'](function(_0x31b67b){if(_0x31b67b){var _0x1ae96e=_[_0xe9aa('0x71')](_0x31b67b[_0xe9aa('0x72')]);_[_0xe9aa('0x73')](_0x1ae96e,function(_0x5ea1a6){return _0x29835b[_0xe9aa('0x74')](_0x5ea1a6['name']);});return{'count':_0x1ae96e[_0xe9aa('0x39')],'rows':_[_0xe9aa('0x2c')](_0x1ae96e,function(_0x491bd4){return{'id':_0x491bd4['name'],'name':_0x491bd4[_0xe9aa('0x75')],'custom':_['endsWith'](_0x491bd4[_0xe9aa('0x2a')],'_c')?!![]:![],'options':_0x491bd4['options']?_['map'](_['values'](_0x491bd4[_0xe9aa('0x41')]),function(_0x14a5b8){return{'name':_0x14a5b8[_0xe9aa('0x76')],'value':_0x14a5b8[_0xe9aa('0x2a')]};}):[]};})};}})[_0xe9aa('0x26')](respondWithResult(_0xe5c877,null))[_0xe9aa('0x46')](function(_0x6551e0){var _0x6ea645=_0xdba11[_0xe9aa('0x33')]['test']?0x1f4:_0x6551e0['statusCode']||0x1f4;logger[_0xe9aa('0x28')](_0xe9aa('0x77'),_0xe9aa('0x57'),_0x6ea645,JSON[_0xe9aa('0x78')](_0x6551e0));delete _0x6551e0[_0xe9aa('0x2a')];if(_0x6ea645===0x191){_0x6ea645=0x190;}_0xe5c877[_0xe9aa('0x1b')](_0x6ea645)['send'](_0xdba11['query']['test']?{'message':_0xe9aa('0x79'),'statusCode':_0x6551e0[_0xe9aa('0x7a')]}:_0x6551e0);});}else{var _0x34287c=0x1f4;_0xe5c877['status'](_0x34287c)['send']({'message':_0xe9aa('0x79'),'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 b9e893f..0f8827b 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 _0x8c7d=['../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x395dc0,_0x3e1799){var _0x5c77d8=function(_0x32d9ad){while(--_0x32d9ad){_0x395dc0['push'](_0x395dc0['shift']());}};_0x5c77d8(++_0x3e1799);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x386926,_0x3ca0b0){_0x386926=_0x386926-0x0;var _0x48bd18=_0x8c7d[_0x386926];return _0x48bd18;};'use strict';var _=require(_0xd8c7('0x0'));var util=require('util');var logger=require(_0xd8c7('0x1'))('api');var moment=require(_0xd8c7('0x2'));var BPromise=require(_0xd8c7('0x3'));var rp=require(_0xd8c7('0x4'));var fs=require('fs');var path=require(_0xd8c7('0x5'));var rimraf=require(_0xd8c7('0x6'));var config=require(_0xd8c7('0x7'));var attributes=require(_0xd8c7('0x8'));var integrations=require(_0xd8c7('0x9'));module[_0xd8c7('0xa')]=function(_0x57c00f,_0x5aa388){return _0x57c00f[_0xd8c7('0xb')](_0xd8c7('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x211e=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x899c29,_0x56fdb2){var _0xc25ad0=function(_0x3b19bd){while(--_0x3b19bd){_0x899c29['push'](_0x899c29['shift']());}};_0xc25ad0(++_0x56fdb2);}(_0x211e,0x1b1));var _0xe211=function(_0x17edab,_0x46d00a){_0x17edab=_0x17edab-0x0;var _0x5eef3e=_0x211e[_0x17edab];return _0x5eef3e;};'use strict';var _=require(_0xe211('0x0'));var util=require(_0xe211('0x1'));var logger=require(_0xe211('0x2'))(_0xe211('0x3'));var moment=require(_0xe211('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe211('0x5'));var rimraf=require(_0xe211('0x6'));var config=require(_0xe211('0x7'));var attributes=require(_0xe211('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe211('0x9')]=function(_0x4d7863,_0x305b39){return _0x4d7863[_0xe211('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xe211('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 53a6d1e..1b234ec 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 _0x6b7e=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','stringify','catch','ShowSugarcrmAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x6b7e,0x148));var _0xe6b7=function(_0x30c29a,_0xfd0519){_0x30c29a=_0x30c29a-0x0;var _0x314d81=_0x6b7e[_0x30c29a];return _0x314d81;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe6b7('0x0'));var BPromise=require(_0xe6b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6b7('0x2'));var db=require(_0xe6b7('0x3'))['db'];var utils=require(_0xe6b7('0x4'));var logger=require(_0xe6b7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6b7('0x6'));var client=jayson[_0xe6b7('0x7')][_0xe6b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a0796,_0x48de6b,_0x2951c7){return new BPromise(function(_0xc6efa1,_0x3c652a){return client[_0xe6b7('0x9')](_0x4a0796,_0x2951c7)[_0xe6b7('0xa')](function(_0x273a94){logger[_0xe6b7('0xb')](_0xe6b7('0xc'),_0x48de6b,_0xe6b7('0xd'));logger[_0xe6b7('0xe')](_0xe6b7('0xf'),_0x48de6b,_0xe6b7('0xd'),JSON['stringify'](_0x273a94));if(_0x273a94[_0xe6b7('0x10')]){if(_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x11')]===0x1f4){logger[_0xe6b7('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x48de6b,_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x12')]);return _0x3c652a(_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x12')]);}logger[_0xe6b7('0x10')](_0xe6b7('0xc'),_0x48de6b,_0x273a94[_0xe6b7('0x10')][_0xe6b7('0x12')]);return _0xc6efa1(_0x273a94['error'][_0xe6b7('0x12')]);}else{logger[_0xe6b7('0xb')](_0xe6b7('0xc'),_0x48de6b,_0xe6b7('0xd'));_0xc6efa1(_0x273a94[_0xe6b7('0x13')]['message']);}})['catch'](function(_0x5ad500){logger['error'](_0xe6b7('0xc'),_0x48de6b,_0x5ad500);_0x3c652a(_0x5ad500);});});}exports['GetSugarcrmAccount']=function(_0x64aa19){var _0x2e7ae8=this;return new Promise(function(_0x524bfc,_0x54ff02){return db[_0xe6b7('0x14')]['findAll']({'raw':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19['options'][_0xe6b7('0x16')]===undefined?!![]:![]:!![],'where':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19[_0xe6b7('0x15')][_0xe6b7('0x17')]||null:null,'attributes':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19['options'][_0xe6b7('0x18')]||null:null,'limit':_0x64aa19['options']?_0x64aa19['options'][_0xe6b7('0x19')]||null:null,'include':_0x64aa19[_0xe6b7('0x15')]?_0x64aa19[_0xe6b7('0x15')][_0xe6b7('0x1a')]?_[_0xe6b7('0x1b')](_0x64aa19[_0xe6b7('0x15')]['include'],function(_0x414c28){return{'model':db[_0x414c28['model']],'as':_0x414c28['as'],'attributes':_0x414c28[_0xe6b7('0x18')],'include':_0x414c28[_0xe6b7('0x1a')]?_['map'](_0x414c28[_0xe6b7('0x1a')],function(_0x5f4161){return{'model':db[_0x5f4161[_0xe6b7('0x1c')]],'as':_0x5f4161['as'],'attributes':_0x5f4161[_0xe6b7('0x18')],'include':_0x5f4161[_0xe6b7('0x1a')]?_['map'](_0x5f4161[_0xe6b7('0x1a')],function(_0x4e1fc5){return{'model':db[_0x4e1fc5[_0xe6b7('0x1c')]],'as':_0x4e1fc5['as'],'attributes':_0x4e1fc5[_0xe6b7('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe6b7('0xa')](function(_0x1330f0){logger[_0xe6b7('0xb')](_0xe6b7('0x1d'),_0x64aa19);logger['debug'](_0xe6b7('0x1d'),_0x64aa19,JSON[_0xe6b7('0x1e')](_0x1330f0));_0x524bfc(_0x1330f0);})[_0xe6b7('0x1f')](function(_0x461935){logger['error'](_0xe6b7('0x1d'),_0x461935[_0xe6b7('0x12')],_0x64aa19);_0x54ff02(_0x2e7ae8[_0xe6b7('0x10')](0x1f4,_0x461935['message']));});});};exports[_0xe6b7('0x20')]=function(_0x582ac4){var _0x306298=this;return new Promise(function(_0x5f4ba6,_0x233271){return db[_0xe6b7('0x14')][_0xe6b7('0x21')]({'raw':_0x582ac4[_0xe6b7('0x15')]?_0x582ac4['options'][_0xe6b7('0x16')]===undefined?!![]:![]:!![],'where':_0x582ac4['options']?_0x582ac4[_0xe6b7('0x15')][_0xe6b7('0x17')]||null:null,'attributes':_0x582ac4[_0xe6b7('0x15')]?_0x582ac4[_0xe6b7('0x15')]['attributes']||null:null,'include':_0x582ac4['options']?_0x582ac4['options'][_0xe6b7('0x1a')]?_[_0xe6b7('0x1b')](_0x582ac4[_0xe6b7('0x15')]['include'],function(_0x2f81c1){return{'model':db[_0x2f81c1[_0xe6b7('0x1c')]],'as':_0x2f81c1['as'],'attributes':_0x2f81c1[_0xe6b7('0x18')],'include':_0x2f81c1[_0xe6b7('0x1a')]?_[_0xe6b7('0x1b')](_0x2f81c1['include'],function(_0x50a87f){return{'model':db[_0x50a87f[_0xe6b7('0x1c')]],'as':_0x50a87f['as'],'attributes':_0x50a87f[_0xe6b7('0x18')],'include':_0x50a87f['include']?_[_0xe6b7('0x1b')](_0x50a87f[_0xe6b7('0x1a')],function(_0x357477){return{'model':db[_0x357477[_0xe6b7('0x1c')]],'as':_0x357477['as'],'attributes':_0x357477[_0xe6b7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc70c0d){logger[_0xe6b7('0xb')](_0xe6b7('0x20'),_0x582ac4);logger[_0xe6b7('0xe')](_0xe6b7('0x20'),_0x582ac4,JSON[_0xe6b7('0x1e')](_0xc70c0d));_0x5f4ba6(_0xc70c0d);})[_0xe6b7('0x1f')](function(_0x5e7b55){logger[_0xe6b7('0x10')](_0xe6b7('0x20'),_0x5e7b55[_0xe6b7('0x12')],_0x582ac4);_0x233271(_0x306298[_0xe6b7('0x10')](0x1f4,_0x5e7b55[_0xe6b7('0x12')]));});});}; \ No newline at end of file +var _0xcc3a=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','include','map','model','attributes','info','ShowSugarcrmAccount','find','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','debug'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xcc3a,0xfc));var _0xacc3=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xcc3a[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0xacc3('0x0'));var util=require(_0xacc3('0x1'));var moment=require('moment');var BPromise=require(_0xacc3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacc3('0x3'));var db=require(_0xacc3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacc3('0x5'));var jayson=require(_0xacc3('0x6'));var client=jayson[_0xacc3('0x7')][_0xacc3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x271058,_0x98376a,_0x38395a){return new BPromise(function(_0x3d45c0,_0x1d39d6){return client[_0xacc3('0x9')](_0x271058,_0x38395a)['then'](function(_0x56a764){logger['info'](_0xacc3('0xa'),_0x98376a,'request\x20sent');logger[_0xacc3('0xb')](_0xacc3('0xc'),_0x98376a,_0xacc3('0xd'),JSON[_0xacc3('0xe')](_0x56a764));if(_0x56a764['error']){if(_0x56a764[_0xacc3('0xf')][_0xacc3('0x10')]===0x1f4){logger[_0xacc3('0xf')](_0xacc3('0xa'),_0x98376a,_0x56a764[_0xacc3('0xf')]['message']);return _0x1d39d6(_0x56a764['error']['message']);}logger[_0xacc3('0xf')](_0xacc3('0xa'),_0x98376a,_0x56a764[_0xacc3('0xf')]['message']);return _0x3d45c0(_0x56a764[_0xacc3('0xf')][_0xacc3('0x11')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x98376a,_0xacc3('0xd'));_0x3d45c0(_0x56a764[_0xacc3('0x12')][_0xacc3('0x11')]);}})[_0xacc3('0x13')](function(_0x15fd33){logger[_0xacc3('0xf')](_0xacc3('0xa'),_0x98376a,_0x15fd33);_0x1d39d6(_0x15fd33);});});}exports[_0xacc3('0x14')]=function(_0xac36b5){var _0x41c048=this;return new Promise(function(_0x3d9dc7,_0x9b9039){return db[_0xacc3('0x15')][_0xacc3('0x16')]({'raw':_0xac36b5['options']?_0xac36b5[_0xacc3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xac36b5[_0xacc3('0x17')]?_0xac36b5[_0xacc3('0x17')][_0xacc3('0x18')]||null:null,'attributes':_0xac36b5[_0xacc3('0x17')]?_0xac36b5[_0xacc3('0x17')]['attributes']||null:null,'limit':_0xac36b5[_0xacc3('0x17')]?_0xac36b5[_0xacc3('0x17')]['limit']||null:null,'include':_0xac36b5[_0xacc3('0x17')]?_0xac36b5['options'][_0xacc3('0x19')]?_[_0xacc3('0x1a')](_0xac36b5[_0xacc3('0x17')][_0xacc3('0x19')],function(_0x10427a){return{'model':db[_0x10427a[_0xacc3('0x1b')]],'as':_0x10427a['as'],'attributes':_0x10427a[_0xacc3('0x1c')],'include':_0x10427a[_0xacc3('0x19')]?_[_0xacc3('0x1a')](_0x10427a[_0xacc3('0x19')],function(_0x217ccb){return{'model':db[_0x217ccb[_0xacc3('0x1b')]],'as':_0x217ccb['as'],'attributes':_0x217ccb['attributes'],'include':_0x217ccb[_0xacc3('0x19')]?_[_0xacc3('0x1a')](_0x217ccb['include'],function(_0x3bca6c){return{'model':db[_0x3bca6c[_0xacc3('0x1b')]],'as':_0x3bca6c['as'],'attributes':_0x3bca6c[_0xacc3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a9e7a){logger[_0xacc3('0x1d')](_0xacc3('0x14'),_0xac36b5);logger[_0xacc3('0xb')](_0xacc3('0x14'),_0xac36b5,JSON[_0xacc3('0xe')](_0x3a9e7a));_0x3d9dc7(_0x3a9e7a);})[_0xacc3('0x13')](function(_0x27ac4f){logger[_0xacc3('0xf')](_0xacc3('0x14'),_0x27ac4f['message'],_0xac36b5);_0x9b9039(_0x41c048[_0xacc3('0xf')](0x1f4,_0x27ac4f[_0xacc3('0x11')]));});});};exports[_0xacc3('0x1e')]=function(_0x3b8aec){var _0x21919e=this;return new Promise(function(_0x30619c,_0x3deb49){return db[_0xacc3('0x15')][_0xacc3('0x1f')]({'raw':_0x3b8aec[_0xacc3('0x17')]?_0x3b8aec[_0xacc3('0x17')][_0xacc3('0x20')]===undefined?!![]:![]:!![],'where':_0x3b8aec[_0xacc3('0x17')]?_0x3b8aec[_0xacc3('0x17')][_0xacc3('0x18')]||null:null,'attributes':_0x3b8aec[_0xacc3('0x17')]?_0x3b8aec[_0xacc3('0x17')][_0xacc3('0x1c')]||null:null,'include':_0x3b8aec[_0xacc3('0x17')]?_0x3b8aec[_0xacc3('0x17')]['include']?_['map'](_0x3b8aec[_0xacc3('0x17')][_0xacc3('0x19')],function(_0x14339f){return{'model':db[_0x14339f[_0xacc3('0x1b')]],'as':_0x14339f['as'],'attributes':_0x14339f[_0xacc3('0x1c')],'include':_0x14339f[_0xacc3('0x19')]?_[_0xacc3('0x1a')](_0x14339f['include'],function(_0x2ee0ce){return{'model':db[_0x2ee0ce[_0xacc3('0x1b')]],'as':_0x2ee0ce['as'],'attributes':_0x2ee0ce[_0xacc3('0x1c')],'include':_0x2ee0ce['include']?_[_0xacc3('0x1a')](_0x2ee0ce[_0xacc3('0x19')],function(_0x4732f9){return{'model':db[_0x4732f9['model']],'as':_0x4732f9['as'],'attributes':_0x4732f9[_0xacc3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1be63d){logger[_0xacc3('0x1d')](_0xacc3('0x1e'),_0x3b8aec);logger[_0xacc3('0xb')]('ShowSugarcrmAccount',_0x3b8aec,JSON[_0xacc3('0xe')](_0x1be63d));_0x30619c(_0x1be63d);})['catch'](function(_0x543da4){logger['error'](_0xacc3('0x1e'),_0x543da4[_0xacc3('0x11')],_0x3b8aec);_0x3deb49(_0x21919e[_0xacc3('0xf')](0x1f4,_0x543da4[_0xacc3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b9ea96f..cdb035f 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 _0x6d49=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x414688,_0x4dae18){var _0x244712=function(_0x200c7a){while(--_0x200c7a){_0x414688['push'](_0x414688['shift']());}};_0x244712(++_0x4dae18);}(_0x6d49,0x174));var _0x96d4=function(_0x48c1a3,_0x461b4c){_0x48c1a3=_0x48c1a3-0x0;var _0xd6c631=_0x6d49[_0x48c1a3];return _0xd6c631;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x96d4('0x0'));var timeout=require(_0x96d4('0x1'));var express=require(_0x96d4('0x2'));var router=express['Router']();var fs_extra=require(_0x96d4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96d4('0x4'));var config=require('../../config/environment');var controller=require(_0x96d4('0x5'));router[_0x96d4('0x6')]('/',auth[_0x96d4('0x7')](),controller['index']);router[_0x96d4('0x6')]('/:id',auth[_0x96d4('0x7')](),controller[_0x96d4('0x8')]);router['get'](_0x96d4('0x9'),auth[_0x96d4('0x7')](),controller['getFields']);router['get'](_0x96d4('0xa'),auth[_0x96d4('0x7')](),controller[_0x96d4('0xb')]);router[_0x96d4('0x6')](_0x96d4('0xc'),auth['isAuthenticated'](),controller[_0x96d4('0xd')]);router[_0x96d4('0xe')]('/',auth[_0x96d4('0x7')](),controller[_0x96d4('0xf')]);router[_0x96d4('0x10')](_0x96d4('0x11'),auth['isAuthenticated'](),controller[_0x96d4('0x12')]);router['delete'](_0x96d4('0x11'),auth[_0x96d4('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd085=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','multer','path','connect-timeout'];(function(_0x8b3a7d,_0x3aec35){var _0x1d03df=function(_0x4bcfc4){while(--_0x4bcfc4){_0x8b3a7d['push'](_0x8b3a7d['shift']());}};_0x1d03df(++_0x3aec35);}(_0xd085,0x1b5));var _0x5d08=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xd085[_0x1db251];return _0x56685a;};'use strict';var multer=require(_0x5d08('0x0'));var util=require('util');var path=require(_0x5d08('0x1'));var timeout=require(_0x5d08('0x2'));var express=require(_0x5d08('0x3'));var router=express[_0x5d08('0x4')]();var fs_extra=require(_0x5d08('0x5'));var auth=require(_0x5d08('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5d08('0x7'));var controller=require(_0x5d08('0x8'));router[_0x5d08('0x9')]('/',auth[_0x5d08('0xa')](),controller[_0x5d08('0xb')]);router[_0x5d08('0x9')](_0x5d08('0xc'),auth[_0x5d08('0xa')](),controller[_0x5d08('0xd')]);router[_0x5d08('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5d08('0xe')]);router[_0x5d08('0x9')](_0x5d08('0xf'),auth[_0x5d08('0xa')](),controller['getSubjects']);router['get'](_0x5d08('0x10'),auth[_0x5d08('0xa')](),controller['getDescriptions']);router[_0x5d08('0x11')]('/',auth['isAuthenticated'](),controller[_0x5d08('0x12')]);router[_0x5d08('0x13')](_0x5d08('0xc'),auth[_0x5d08('0xa')](),controller[_0x5d08('0x14')]);router['delete'](_0x5d08('0xc'),auth[_0x5d08('0xa')](),controller[_0x5d08('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6e6ef90..f49d251 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 _0x8d92=['STRING','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8d92,0x79));var _0x28d9=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0x8d92[_0x57d0dc];return _0x177765;};'use strict';var Sequelize=require(_0x28d9('0x0'));module[_0x28d9('0x1')]={'name':{'type':Sequelize[_0x28d9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d79=['exports','STRING'];(function(_0x142a07,_0x251e3c){var _0x101b6d=function(_0xcc9433){while(--_0xcc9433){_0x142a07['push'](_0x142a07['shift']());}};_0x101b6d(++_0x251e3c);}(_0x3d79,0x1e0));var _0x93d7=function(_0x4073bf,_0x1a966f){_0x4073bf=_0x4073bf-0x0;var _0x8c085a=_0x3d79[_0x4073bf];return _0x8c085a;};'use strict';var Sequelize=require('sequelize');module[_0x93d7('0x0')]={'name':{'type':Sequelize[_0x93d7('0x1')]},'description':{'type':Sequelize[_0x93d7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a10656b..98f05c6 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 _0x2def=['fieldName','type','model','map','name','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','update','params','getFields','findOne','SugarcrmField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','index'];(function(_0x21823b,_0x19b482){var _0xc4b79=function(_0x2f6497){while(--_0x2f6497){_0x21823b['push'](_0x21823b['shift']());}};_0xc4b79(++_0x19b482);}(_0x2def,0x178));var _0xf2de=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2def[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xf2de('0x0'));var rimraf=require(_0xf2de('0x1'));var zipdir=require(_0xf2de('0x2'));var jsonpatch=require(_0xf2de('0x3'));var rp=require(_0xf2de('0x4'));var moment=require(_0xf2de('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf2de('0x6'));var util=require(_0xf2de('0x7'));var path=require('path');var sox=require(_0xf2de('0x8'));var csv=require(_0xf2de('0x9'));var ejs=require(_0xf2de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2de('0xb'));var squel=require(_0xf2de('0xc'));var crypto=require('crypto');var jsforce=require(_0xf2de('0xd'));var deskjs=require(_0xf2de('0xe'));var toCsv=require(_0xf2de('0x9'));var querystring=require(_0xf2de('0xf'));var Papa=require(_0xf2de('0x10'));var Redis=require(_0xf2de('0x11'));var authService=require(_0xf2de('0x12'));var qs=require(_0xf2de('0x13'));var as=require(_0xf2de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2de('0x15'))(_0xf2de('0x16'));var utils=require('../../config/utils');var config=require(_0xf2de('0x17'));var licenseUtil=require(_0xf2de('0x18'));var db=require(_0xf2de('0x19'))['db'];function respondWithStatusCode(_0x3a3b8c,_0x23859e){_0x23859e=_0x23859e||0xcc;return function(_0x4cc63c){if(_0x4cc63c){return _0x3a3b8c[_0xf2de('0x1a')](_0x23859e);}return _0x3a3b8c[_0xf2de('0x1b')](_0x23859e)['end']();};}function respondWithResult(_0x54685,_0x4b0620){_0x4b0620=_0x4b0620||0xc8;return function(_0x13ca46){if(_0x13ca46){return _0x54685[_0xf2de('0x1b')](_0x4b0620)[_0xf2de('0x1c')](_0x13ca46);}};}function respondWithFilteredResult(_0x176f14,_0x5dee95){return function(_0x48b857){if(_0x48b857){var _0x5befbf=typeof _0x5dee95[_0xf2de('0x1d')]===_0xf2de('0x1e')&&typeof _0x5dee95[_0xf2de('0x1f')]===_0xf2de('0x1e');var _0x17cfb0=_0x48b857[_0xf2de('0x20')];var _0x2ea5b3=_0x5befbf?0x0:_0x5dee95[_0xf2de('0x1d')];var _0x1ee77e=_0x5befbf?_0x48b857['count']:_0x5dee95['offset']+_0x5dee95['limit'];var _0x20d7d5;if(_0x1ee77e>=_0x17cfb0){_0x1ee77e=_0x17cfb0;_0x20d7d5=0xc8;}else{_0x20d7d5=0xce;}_0x176f14[_0xf2de('0x1b')](_0x20d7d5);return _0x176f14[_0xf2de('0x21')](_0xf2de('0x22'),_0x2ea5b3+'-'+_0x1ee77e+'/'+_0x17cfb0)[_0xf2de('0x1c')](_0x48b857);}return null;};}function patchUpdates(_0x1a8e4a){return function(_0x2421d7){try{jsonpatch[_0xf2de('0x23')](_0x2421d7,_0x1a8e4a,!![]);}catch(_0x16937f){return BPromise[_0xf2de('0x24')](_0x16937f);}return _0x2421d7[_0xf2de('0x25')]();};}function saveUpdates(_0x58b907,_0x5db9d3){return function(_0x1f5034){if(_0x1f5034){return _0x1f5034['update'](_0x58b907)['then'](function(_0x58f97c){return _0x58f97c;});}return null;};}function removeEntity(_0x3bccee,_0x27cee3){return function(_0x5352c7){if(_0x5352c7){return _0x5352c7[_0xf2de('0x26')]()[_0xf2de('0x27')](function(){_0x3bccee[_0xf2de('0x1b')](0xcc)[_0xf2de('0x28')]();});}};}function handleEntityNotFound(_0x390716,_0x16cf7a){return function(_0x22aacb){if(!_0x22aacb){_0x390716['sendStatus'](0x194);}return _0x22aacb;};}function handleError(_0x41f77f,_0x257c48){_0x257c48=_0x257c48||0x1f4;return function(_0x5ba7d3){logger[_0xf2de('0x29')](_0x5ba7d3[_0xf2de('0x2a')]);if(_0x5ba7d3['name']){delete _0x5ba7d3['name'];}_0x41f77f[_0xf2de('0x1b')](_0x257c48)['send'](_0x5ba7d3);};}exports[_0xf2de('0x2b')]=function(_0x146c1d,_0x2b0fb3){var _0x181eb9={},_0x49705b={},_0x4b14d4={'count':0x0,'rows':[]};var _0x91f9b=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x145808){return{'name':_0x145808[_0xf2de('0x2c')],'type':_0x145808[_0xf2de('0x2d')]['key']};});_0x49705b[_0xf2de('0x2e')]=_[_0xf2de('0x2f')](_0x91f9b,_0xf2de('0x30'));_0x49705b['query']=_[_0xf2de('0x31')](_0x146c1d['query']);_0x49705b[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x49705b[_0xf2de('0x2e')],_0x49705b[_0xf2de('0x34')]);_0x181eb9[_0xf2de('0x35')]=_[_0xf2de('0x33')](_0x49705b['model'],qs[_0xf2de('0x36')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x36')]));_0x181eb9['attributes']=_0x181eb9[_0xf2de('0x35')]['length']?_0x181eb9[_0xf2de('0x35')]:_0x49705b[_0xf2de('0x2e')];if(!_0x146c1d[_0xf2de('0x34')]['hasOwnProperty'](_0xf2de('0x37'))){_0x181eb9[_0xf2de('0x1f')]=qs[_0xf2de('0x1f')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x1f')]);_0x181eb9[_0xf2de('0x1d')]=qs[_0xf2de('0x1d')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x1d')]);}_0x181eb9[_0xf2de('0x38')]=qs[_0xf2de('0x39')](_0x146c1d[_0xf2de('0x34')][_0xf2de('0x39')]);_0x181eb9['where']=qs[_0xf2de('0x32')](_['pick'](_0x146c1d[_0xf2de('0x34')],_0x49705b[_0xf2de('0x32')]),_0x91f9b);if(_0x146c1d[_0xf2de('0x34')][_0xf2de('0x3a')]){_0x181eb9[_0xf2de('0x3b')]=_[_0xf2de('0x3c')](_0x181eb9[_0xf2de('0x3b')],{'$or':_[_0xf2de('0x2f')](_0x91f9b,function(_0x50b97c){if(_0x50b97c[_0xf2de('0x2d')]!==_0xf2de('0x3d')){var _0x38aa1d={};_0x38aa1d[_0x50b97c[_0xf2de('0x30')]]={'$like':'%'+_0x146c1d['query'][_0xf2de('0x3a')]+'%'};return _0x38aa1d;}})});}_0x181eb9=_[_0xf2de('0x3c')]({},_0x181eb9,_0x146c1d[_0xf2de('0x3e')]);var _0x44291b={'where':_0x181eb9[_0xf2de('0x3b')]};return db[_0xf2de('0x3f')][_0xf2de('0x20')](_0x44291b)[_0xf2de('0x27')](function(_0x4cafaf){_0x4b14d4[_0xf2de('0x20')]=_0x4cafaf;if(_0x146c1d['query'][_0xf2de('0x40')]){_0x181eb9[_0xf2de('0x41')]=[{'all':!![]}];}return db[_0xf2de('0x3f')][_0xf2de('0x42')](_0x181eb9);})[_0xf2de('0x27')](function(_0x4e7832){_0x4b14d4[_0xf2de('0x43')]=_0x4e7832;return _0x4b14d4;})[_0xf2de('0x27')](respondWithFilteredResult(_0x2b0fb3,_0x181eb9))[_0xf2de('0x44')](handleError(_0x2b0fb3,null));};exports[_0xf2de('0x45')]=function(_0x1c371c,_0x214598){var _0x399d30={'raw':![],'where':{'id':_0x1c371c['params']['id']}},_0x435bc3={};_0x435bc3[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db['SugarcrmConfiguration'][_0xf2de('0x46')]);_0x435bc3[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x1c371c[_0xf2de('0x34')]);_0x435bc3[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x435bc3[_0xf2de('0x2e')],_0x435bc3[_0xf2de('0x34')]);_0x399d30['attributes']=_[_0xf2de('0x33')](_0x435bc3[_0xf2de('0x2e')],qs[_0xf2de('0x36')](_0x1c371c[_0xf2de('0x34')][_0xf2de('0x36')]));_0x399d30[_0xf2de('0x35')]=_0x399d30[_0xf2de('0x35')][_0xf2de('0x47')]?_0x399d30[_0xf2de('0x35')]:_0x435bc3[_0xf2de('0x2e')];if(_0x1c371c['query']['includeAll']){_0x399d30[_0xf2de('0x41')]=[{'all':!![]}];}_0x399d30=_[_0xf2de('0x3c')]({},_0x399d30,_0x1c371c['options']);return db[_0xf2de('0x3f')][_0xf2de('0x48')](_0x399d30)[_0xf2de('0x27')](handleEntityNotFound(_0x214598,null))['then'](respondWithResult(_0x214598,null))['catch'](handleError(_0x214598,null));};exports[_0xf2de('0x49')]=function(_0x2553e2,_0x4e2b17){return db[_0xf2de('0x3f')]['create'](_0x2553e2[_0xf2de('0x4a')],{})['then'](respondWithResult(_0x4e2b17,0xc9))[_0xf2de('0x44')](handleError(_0x4e2b17,null));};exports[_0xf2de('0x4b')]=function(_0x123708,_0x4a1f74){if(_0x123708[_0xf2de('0x4a')]['id']){delete _0x123708[_0xf2de('0x4a')]['id'];}return db[_0xf2de('0x3f')][_0xf2de('0x48')]({'where':{'id':_0x123708[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x4a1f74,null))[_0xf2de('0x27')](saveUpdates(_0x123708['body'],null))[_0xf2de('0x27')](respondWithResult(_0x4a1f74,null))[_0xf2de('0x44')](handleError(_0x4a1f74,null));};exports['destroy']=function(_0x33dc58,_0x152cb7){return db['SugarcrmConfiguration'][_0xf2de('0x48')]({'where':{'id':_0x33dc58[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x152cb7,null))[_0xf2de('0x27')](removeEntity(_0x152cb7,null))[_0xf2de('0x44')](handleError(_0x152cb7,null));};exports[_0xf2de('0x4d')]=function(_0x4da994,_0x50cfdb,_0x3054df){var _0x199bcd={};var _0x440a3c={};var _0x2a2370;var _0xa5048f;return db['SugarcrmConfiguration'][_0xf2de('0x4e')]({'where':{'id':_0x4da994[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x50cfdb,null))[_0xf2de('0x27')](function(_0x30b31f){if(_0x30b31f){_0x2a2370=_0x30b31f;_0x440a3c[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db[_0xf2de('0x4f')][_0xf2de('0x46')]);_0x440a3c[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x4da994[_0xf2de('0x34')]);_0x440a3c[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x440a3c[_0xf2de('0x2e')],_0x440a3c[_0xf2de('0x34')]);_0x199bcd[_0xf2de('0x35')]=_['intersection'](_0x440a3c['model'],qs['fields'](_0x4da994['query']['fields']));_0x199bcd[_0xf2de('0x35')]=_0x199bcd[_0xf2de('0x35')]['length']?_0x199bcd[_0xf2de('0x35')]:_0x440a3c[_0xf2de('0x2e')];_0x199bcd[_0xf2de('0x38')]=qs[_0xf2de('0x39')](_0x4da994['query'][_0xf2de('0x39')]);_0x199bcd['where']=qs[_0xf2de('0x32')](_[_0xf2de('0x50')](_0x4da994[_0xf2de('0x34')],_0x440a3c[_0xf2de('0x32')]));if(_0x4da994['query'][_0xf2de('0x3a')]){_0x199bcd[_0xf2de('0x3b')]=_['merge'](_0x199bcd[_0xf2de('0x3b')],{'$or':_['map'](_0x199bcd[_0xf2de('0x35')],function(_0x493b81){var _0xa91c6b={};_0xa91c6b[_0x493b81]={'$like':'%'+_0x4da994[_0xf2de('0x34')][_0xf2de('0x3a')]+'%'};return _0xa91c6b;})});}_0x199bcd=_[_0xf2de('0x3c')]({},_0x199bcd,_0x4da994['options']);return _0x2a2370[_0xf2de('0x4d')](_0x199bcd);}})['then'](function(_0x1fa1e4){if(_0x1fa1e4){_0xa5048f=_0x1fa1e4[_0xf2de('0x47')];if(!_0x4da994[_0xf2de('0x34')][_0xf2de('0x51')](_0xf2de('0x37'))){_0x199bcd[_0xf2de('0x1f')]=qs['limit'](_0x4da994[_0xf2de('0x34')]['limit']);_0x199bcd[_0xf2de('0x1d')]=qs[_0xf2de('0x1d')](_0x4da994[_0xf2de('0x34')][_0xf2de('0x1d')]);}return _0x2a2370[_0xf2de('0x4d')](_0x199bcd);}})['then'](function(_0x19eb4a){if(_0x19eb4a){return _0x19eb4a?{'count':_0xa5048f,'rows':_0x19eb4a}:null;}})['then'](respondWithResult(_0x50cfdb,null))['catch'](handleError(_0x50cfdb,null));};exports['getSubjects']=function(_0x312650,_0x11a28f,_0x529f5a){var _0x5a8134={};var _0x17875b={};var _0x26560b;var _0x1d09c4;return db['SugarcrmConfiguration'][_0xf2de('0x4e')]({'where':{'id':_0x312650[_0xf2de('0x4c')]['id']}})[_0xf2de('0x27')](handleEntityNotFound(_0x11a28f,null))[_0xf2de('0x27')](function(_0x1496f9){if(_0x1496f9){_0x26560b=_0x1496f9;_0x17875b[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db[_0xf2de('0x4f')]['rawAttributes']);_0x17875b[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x312650[_0xf2de('0x34')]);_0x17875b[_0xf2de('0x32')]=_[_0xf2de('0x33')](_0x17875b[_0xf2de('0x2e')],_0x17875b[_0xf2de('0x34')]);_0x5a8134['attributes']=_[_0xf2de('0x33')](_0x17875b['model'],qs[_0xf2de('0x36')](_0x312650[_0xf2de('0x34')]['fields']));_0x5a8134[_0xf2de('0x35')]=_0x5a8134[_0xf2de('0x35')][_0xf2de('0x47')]?_0x5a8134['attributes']:_0x17875b[_0xf2de('0x2e')];_0x5a8134[_0xf2de('0x38')]=qs[_0xf2de('0x39')](_0x312650['query'][_0xf2de('0x39')]);_0x5a8134[_0xf2de('0x3b')]=qs['filters'](_[_0xf2de('0x50')](_0x312650['query'],_0x17875b[_0xf2de('0x32')]));if(_0x312650[_0xf2de('0x34')][_0xf2de('0x3a')]){_0x5a8134[_0xf2de('0x3b')]=_['merge'](_0x5a8134[_0xf2de('0x3b')],{'$or':_['map'](_0x5a8134[_0xf2de('0x35')],function(_0x4a42b1){var _0x18979b={};_0x18979b[_0x4a42b1]={'$like':'%'+_0x312650[_0xf2de('0x34')]['filter']+'%'};return _0x18979b;})});}_0x5a8134=_[_0xf2de('0x3c')]({},_0x5a8134,_0x312650['options']);return _0x26560b[_0xf2de('0x52')](_0x5a8134);}})[_0xf2de('0x27')](function(_0x1e960c){if(_0x1e960c){_0x1d09c4=_0x1e960c[_0xf2de('0x47')];if(!_0x312650['query'][_0xf2de('0x51')](_0xf2de('0x37'))){_0x5a8134[_0xf2de('0x1f')]=qs[_0xf2de('0x1f')](_0x312650['query'][_0xf2de('0x1f')]);_0x5a8134[_0xf2de('0x1d')]=qs[_0xf2de('0x1d')](_0x312650[_0xf2de('0x34')]['offset']);}return _0x26560b[_0xf2de('0x52')](_0x5a8134);}})[_0xf2de('0x27')](function(_0x3ddab7){if(_0x3ddab7){return _0x3ddab7?{'count':_0x1d09c4,'rows':_0x3ddab7}:null;}})[_0xf2de('0x27')](respondWithResult(_0x11a28f,null))[_0xf2de('0x44')](handleError(_0x11a28f,null));};exports[_0xf2de('0x53')]=function(_0x4935f6,_0x1cb34e,_0x3f5e10){var _0x19922b={};var _0x491ee3={};var _0x272b10;var _0x168cd1;return db[_0xf2de('0x3f')][_0xf2de('0x4e')]({'where':{'id':_0x4935f6[_0xf2de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cb34e,null))['then'](function(_0x44ec4e){if(_0x44ec4e){_0x272b10=_0x44ec4e;_0x491ee3[_0xf2de('0x2e')]=_[_0xf2de('0x31')](db[_0xf2de('0x4f')][_0xf2de('0x46')]);_0x491ee3[_0xf2de('0x34')]=_[_0xf2de('0x31')](_0x4935f6[_0xf2de('0x34')]);_0x491ee3[_0xf2de('0x32')]=_['intersection'](_0x491ee3[_0xf2de('0x2e')],_0x491ee3['query']);_0x19922b['attributes']=_[_0xf2de('0x33')](_0x491ee3[_0xf2de('0x2e')],qs[_0xf2de('0x36')](_0x4935f6[_0xf2de('0x34')]['fields']));_0x19922b[_0xf2de('0x35')]=_0x19922b[_0xf2de('0x35')][_0xf2de('0x47')]?_0x19922b[_0xf2de('0x35')]:_0x491ee3[_0xf2de('0x2e')];_0x19922b['order']=qs[_0xf2de('0x39')](_0x4935f6[_0xf2de('0x34')][_0xf2de('0x39')]);_0x19922b[_0xf2de('0x3b')]=qs[_0xf2de('0x32')](_[_0xf2de('0x50')](_0x4935f6[_0xf2de('0x34')],_0x491ee3[_0xf2de('0x32')]));if(_0x4935f6[_0xf2de('0x34')][_0xf2de('0x3a')]){_0x19922b[_0xf2de('0x3b')]=_[_0xf2de('0x3c')](_0x19922b[_0xf2de('0x3b')],{'$or':_[_0xf2de('0x2f')](_0x19922b['attributes'],function(_0x3bd8a7){var _0x325cc4={};_0x325cc4[_0x3bd8a7]={'$like':'%'+_0x4935f6[_0xf2de('0x34')]['filter']+'%'};return _0x325cc4;})});}_0x19922b=_[_0xf2de('0x3c')]({},_0x19922b,_0x4935f6['options']);return _0x272b10['getDescriptions'](_0x19922b);}})[_0xf2de('0x27')](function(_0x488c7a){if(_0x488c7a){_0x168cd1=_0x488c7a[_0xf2de('0x47')];if(!_0x4935f6['query']['hasOwnProperty'](_0xf2de('0x37'))){_0x19922b[_0xf2de('0x1f')]=qs[_0xf2de('0x1f')](_0x4935f6['query'][_0xf2de('0x1f')]);_0x19922b['offset']=qs[_0xf2de('0x1d')](_0x4935f6[_0xf2de('0x34')][_0xf2de('0x1d')]);}return _0x272b10[_0xf2de('0x53')](_0x19922b);}})[_0xf2de('0x27')](function(_0x256bc1){if(_0x256bc1){return _0x256bc1?{'count':_0x168cd1,'rows':_0x256bc1}:null;}})['then'](respondWithResult(_0x1cb34e,null))['catch'](handleError(_0x1cb34e,null));}; \ No newline at end of file +var _0xdb8e=['status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','stack','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xdb8e,0x87));var _0xedb8=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0xdb8e[_0x54a28a];return _0x3da1f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedb8('0x0'));var zipdir=require(_0xedb8('0x1'));var jsonpatch=require(_0xedb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xedb8('0x3'));var Mustache=require(_0xedb8('0x4'));var util=require(_0xedb8('0x5'));var path=require(_0xedb8('0x6'));var sox=require(_0xedb8('0x7'));var csv=require(_0xedb8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedb8('0x9'));var _=require(_0xedb8('0xa'));var squel=require(_0xedb8('0xb'));var crypto=require(_0xedb8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xedb8('0x8'));var querystring=require(_0xedb8('0xd'));var Papa=require(_0xedb8('0xe'));var Redis=require(_0xedb8('0xf'));var authService=require(_0xedb8('0x10'));var qs=require(_0xedb8('0x11'));var as=require(_0xedb8('0x12'));var hardwareService=require(_0xedb8('0x13'));var logger=require('../../config/logger')(_0xedb8('0x14'));var utils=require(_0xedb8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xedb8('0x16'));var db=require(_0xedb8('0x17'))['db'];function respondWithStatusCode(_0x55e17e,_0x4890d1){_0x4890d1=_0x4890d1||0xcc;return function(_0xcec05d){if(_0xcec05d){return _0x55e17e[_0xedb8('0x18')](_0x4890d1);}return _0x55e17e[_0xedb8('0x19')](_0x4890d1)[_0xedb8('0x1a')]();};}function respondWithResult(_0x2c466d,_0x5c6427){_0x5c6427=_0x5c6427||0xc8;return function(_0x46a6dd){if(_0x46a6dd){return _0x2c466d[_0xedb8('0x19')](_0x5c6427)['json'](_0x46a6dd);}};}function respondWithFilteredResult(_0x487634,_0x7458b){return function(_0x28e944){if(_0x28e944){var _0x36ac77=typeof _0x7458b[_0xedb8('0x1b')]===_0xedb8('0x1c')&&typeof _0x7458b['limit']===_0xedb8('0x1c');var _0x202d48=_0x28e944[_0xedb8('0x1d')];var _0x23f008=_0x36ac77?0x0:_0x7458b['offset'];var _0x2a63b1=_0x36ac77?_0x28e944[_0xedb8('0x1d')]:_0x7458b[_0xedb8('0x1b')]+_0x7458b[_0xedb8('0x1e')];var _0x39f242;if(_0x2a63b1>=_0x202d48){_0x2a63b1=_0x202d48;_0x39f242=0xc8;}else{_0x39f242=0xce;}_0x487634[_0xedb8('0x19')](_0x39f242);return _0x487634[_0xedb8('0x1f')](_0xedb8('0x20'),_0x23f008+'-'+_0x2a63b1+'/'+_0x202d48)[_0xedb8('0x21')](_0x28e944);}return null;};}function patchUpdates(_0x23e864){return function(_0x1254fc){try{jsonpatch[_0xedb8('0x22')](_0x1254fc,_0x23e864,!![]);}catch(_0x113860){return BPromise[_0xedb8('0x23')](_0x113860);}return _0x1254fc['save']();};}function saveUpdates(_0x17b72d,_0x488748){return function(_0x5a8e01){if(_0x5a8e01){return _0x5a8e01[_0xedb8('0x24')](_0x17b72d)[_0xedb8('0x25')](function(_0x432841){return _0x432841;});}return null;};}function removeEntity(_0x5767b3,_0x557545){return function(_0x4f7d53){if(_0x4f7d53){return _0x4f7d53['destroy']()[_0xedb8('0x25')](function(){_0x5767b3['status'](0xcc)[_0xedb8('0x1a')]();});}};}function handleEntityNotFound(_0x33f61a,_0x49a174){return function(_0x41802e){if(!_0x41802e){_0x33f61a[_0xedb8('0x18')](0x194);}return _0x41802e;};}function handleError(_0x3163a6,_0x5e3030){_0x5e3030=_0x5e3030||0x1f4;return function(_0x1dbb4f){logger['error'](_0x1dbb4f[_0xedb8('0x26')]);if(_0x1dbb4f['name']){delete _0x1dbb4f['name'];}_0x3163a6['status'](_0x5e3030)['send'](_0x1dbb4f);};}exports[_0xedb8('0x27')]=function(_0x1cc78f,_0x4f66e7){var _0x15602d={},_0x1f7425={},_0x19b7a5={'count':0x0,'rows':[]};var _0x4aa5aa=_[_0xedb8('0x28')](db[_0xedb8('0x29')][_0xedb8('0x2a')],function(_0x3e1d40){return{'name':_0x3e1d40[_0xedb8('0x2b')],'type':_0x3e1d40[_0xedb8('0x2c')][_0xedb8('0x2d')]};});_0x1f7425[_0xedb8('0x2e')]=_['map'](_0x4aa5aa,'name');_0x1f7425[_0xedb8('0x2f')]=_[_0xedb8('0x30')](_0x1cc78f[_0xedb8('0x2f')]);_0x1f7425['filters']=_['intersection'](_0x1f7425[_0xedb8('0x2e')],_0x1f7425['query']);_0x15602d[_0xedb8('0x31')]=_[_0xedb8('0x32')](_0x1f7425[_0xedb8('0x2e')],qs[_0xedb8('0x33')](_0x1cc78f[_0xedb8('0x2f')][_0xedb8('0x33')]));_0x15602d[_0xedb8('0x31')]=_0x15602d[_0xedb8('0x31')][_0xedb8('0x34')]?_0x15602d['attributes']:_0x1f7425[_0xedb8('0x2e')];if(!_0x1cc78f['query'][_0xedb8('0x35')](_0xedb8('0x36'))){_0x15602d[_0xedb8('0x1e')]=qs['limit'](_0x1cc78f[_0xedb8('0x2f')][_0xedb8('0x1e')]);_0x15602d[_0xedb8('0x1b')]=qs[_0xedb8('0x1b')](_0x1cc78f[_0xedb8('0x2f')][_0xedb8('0x1b')]);}_0x15602d[_0xedb8('0x37')]=qs[_0xedb8('0x38')](_0x1cc78f['query']['sort']);_0x15602d['where']=qs['filters'](_[_0xedb8('0x39')](_0x1cc78f[_0xedb8('0x2f')],_0x1f7425[_0xedb8('0x3a')]),_0x4aa5aa);if(_0x1cc78f['query'][_0xedb8('0x3b')]){_0x15602d['where']=_[_0xedb8('0x3c')](_0x15602d['where'],{'$or':_['map'](_0x4aa5aa,function(_0x12a054){if(_0x12a054[_0xedb8('0x2c')]!==_0xedb8('0x3d')){var _0x5cca3c={};_0x5cca3c[_0x12a054['name']]={'$like':'%'+_0x1cc78f['query'][_0xedb8('0x3b')]+'%'};return _0x5cca3c;}})});}_0x15602d=_['merge']({},_0x15602d,_0x1cc78f[_0xedb8('0x3e')]);var _0x52a53a={'where':_0x15602d[_0xedb8('0x3f')]};return db[_0xedb8('0x29')]['count'](_0x52a53a)[_0xedb8('0x25')](function(_0x3d4e36){_0x19b7a5[_0xedb8('0x1d')]=_0x3d4e36;if(_0x1cc78f[_0xedb8('0x2f')][_0xedb8('0x40')]){_0x15602d[_0xedb8('0x41')]=[{'all':!![]}];}return db[_0xedb8('0x29')][_0xedb8('0x42')](_0x15602d);})[_0xedb8('0x25')](function(_0x303959){_0x19b7a5[_0xedb8('0x43')]=_0x303959;return _0x19b7a5;})['then'](respondWithFilteredResult(_0x4f66e7,_0x15602d))[_0xedb8('0x44')](handleError(_0x4f66e7,null));};exports[_0xedb8('0x45')]=function(_0x24db9e,_0x2a3dbb){var _0x11f222={'raw':![],'where':{'id':_0x24db9e[_0xedb8('0x46')]['id']}},_0x5a38dd={};_0x5a38dd[_0xedb8('0x2e')]=_[_0xedb8('0x30')](db['SugarcrmConfiguration'][_0xedb8('0x2a')]);_0x5a38dd[_0xedb8('0x2f')]=_[_0xedb8('0x30')](_0x24db9e['query']);_0x5a38dd[_0xedb8('0x3a')]=_[_0xedb8('0x32')](_0x5a38dd[_0xedb8('0x2e')],_0x5a38dd['query']);_0x11f222[_0xedb8('0x31')]=_['intersection'](_0x5a38dd[_0xedb8('0x2e')],qs['fields'](_0x24db9e['query'][_0xedb8('0x33')]));_0x11f222[_0xedb8('0x31')]=_0x11f222[_0xedb8('0x31')][_0xedb8('0x34')]?_0x11f222[_0xedb8('0x31')]:_0x5a38dd[_0xedb8('0x2e')];if(_0x24db9e[_0xedb8('0x2f')][_0xedb8('0x40')]){_0x11f222['include']=[{'all':!![]}];}_0x11f222=_[_0xedb8('0x3c')]({},_0x11f222,_0x24db9e[_0xedb8('0x3e')]);return db[_0xedb8('0x29')]['find'](_0x11f222)[_0xedb8('0x25')](handleEntityNotFound(_0x2a3dbb,null))[_0xedb8('0x25')](respondWithResult(_0x2a3dbb,null))[_0xedb8('0x44')](handleError(_0x2a3dbb,null));};exports[_0xedb8('0x47')]=function(_0x15d43d,_0x1245f6){return db[_0xedb8('0x29')]['create'](_0x15d43d[_0xedb8('0x48')],{})['then'](respondWithResult(_0x1245f6,0xc9))['catch'](handleError(_0x1245f6,null));};exports['update']=function(_0x4f4fc0,_0x4accc5){if(_0x4f4fc0['body']['id']){delete _0x4f4fc0['body']['id'];}return db[_0xedb8('0x29')][_0xedb8('0x49')]({'where':{'id':_0x4f4fc0[_0xedb8('0x46')]['id']}})['then'](handleEntityNotFound(_0x4accc5,null))[_0xedb8('0x25')](saveUpdates(_0x4f4fc0[_0xedb8('0x48')],null))['then'](respondWithResult(_0x4accc5,null))[_0xedb8('0x44')](handleError(_0x4accc5,null));};exports[_0xedb8('0x4a')]=function(_0x35c87a,_0x22f38c){return db[_0xedb8('0x29')][_0xedb8('0x49')]({'where':{'id':_0x35c87a['params']['id']}})[_0xedb8('0x25')](handleEntityNotFound(_0x22f38c,null))[_0xedb8('0x25')](removeEntity(_0x22f38c,null))['catch'](handleError(_0x22f38c,null));};exports[_0xedb8('0x4b')]=function(_0x4d68d3,_0x260e92,_0x13c385){var _0x1e34c8={};var _0x3adf6e={};var _0xd1b4bf;var _0x3c5eaa;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4d68d3[_0xedb8('0x46')]['id']}})[_0xedb8('0x25')](handleEntityNotFound(_0x260e92,null))[_0xedb8('0x25')](function(_0x31e057){if(_0x31e057){_0xd1b4bf=_0x31e057;_0x3adf6e[_0xedb8('0x2e')]=_[_0xedb8('0x30')](db[_0xedb8('0x4c')]['rawAttributes']);_0x3adf6e[_0xedb8('0x2f')]=_[_0xedb8('0x30')](_0x4d68d3[_0xedb8('0x2f')]);_0x3adf6e[_0xedb8('0x3a')]=_[_0xedb8('0x32')](_0x3adf6e[_0xedb8('0x2e')],_0x3adf6e[_0xedb8('0x2f')]);_0x1e34c8[_0xedb8('0x31')]=_['intersection'](_0x3adf6e[_0xedb8('0x2e')],qs[_0xedb8('0x33')](_0x4d68d3['query'][_0xedb8('0x33')]));_0x1e34c8[_0xedb8('0x31')]=_0x1e34c8[_0xedb8('0x31')][_0xedb8('0x34')]?_0x1e34c8[_0xedb8('0x31')]:_0x3adf6e['model'];_0x1e34c8[_0xedb8('0x37')]=qs[_0xedb8('0x38')](_0x4d68d3[_0xedb8('0x2f')][_0xedb8('0x38')]);_0x1e34c8[_0xedb8('0x3f')]=qs[_0xedb8('0x3a')](_['pick'](_0x4d68d3[_0xedb8('0x2f')],_0x3adf6e['filters']));if(_0x4d68d3[_0xedb8('0x2f')][_0xedb8('0x3b')]){_0x1e34c8[_0xedb8('0x3f')]=_[_0xedb8('0x3c')](_0x1e34c8[_0xedb8('0x3f')],{'$or':_[_0xedb8('0x28')](_0x1e34c8[_0xedb8('0x31')],function(_0x42d966){var _0x339668={};_0x339668[_0x42d966]={'$like':'%'+_0x4d68d3[_0xedb8('0x2f')][_0xedb8('0x3b')]+'%'};return _0x339668;})});}_0x1e34c8=_[_0xedb8('0x3c')]({},_0x1e34c8,_0x4d68d3[_0xedb8('0x3e')]);return _0xd1b4bf[_0xedb8('0x4b')](_0x1e34c8);}})['then'](function(_0x4d2ff1){if(_0x4d2ff1){_0x3c5eaa=_0x4d2ff1[_0xedb8('0x34')];if(!_0x4d68d3[_0xedb8('0x2f')][_0xedb8('0x35')](_0xedb8('0x36'))){_0x1e34c8[_0xedb8('0x1e')]=qs[_0xedb8('0x1e')](_0x4d68d3[_0xedb8('0x2f')][_0xedb8('0x1e')]);_0x1e34c8['offset']=qs[_0xedb8('0x1b')](_0x4d68d3[_0xedb8('0x2f')][_0xedb8('0x1b')]);}return _0xd1b4bf[_0xedb8('0x4b')](_0x1e34c8);}})[_0xedb8('0x25')](function(_0xfd1b64){if(_0xfd1b64){return _0xfd1b64?{'count':_0x3c5eaa,'rows':_0xfd1b64}:null;}})[_0xedb8('0x25')](respondWithResult(_0x260e92,null))[_0xedb8('0x44')](handleError(_0x260e92,null));};exports[_0xedb8('0x4d')]=function(_0x9c0d66,_0x408dad,_0x44c077){var _0x162b0d={};var _0x5a45f6={};var _0x2b039c;var _0x424977;return db[_0xedb8('0x29')][_0xedb8('0x4e')]({'where':{'id':_0x9c0d66[_0xedb8('0x46')]['id']}})['then'](handleEntityNotFound(_0x408dad,null))[_0xedb8('0x25')](function(_0x3efa2d){if(_0x3efa2d){_0x2b039c=_0x3efa2d;_0x5a45f6[_0xedb8('0x2e')]=_[_0xedb8('0x30')](db[_0xedb8('0x4c')]['rawAttributes']);_0x5a45f6[_0xedb8('0x2f')]=_['keys'](_0x9c0d66[_0xedb8('0x2f')]);_0x5a45f6[_0xedb8('0x3a')]=_[_0xedb8('0x32')](_0x5a45f6[_0xedb8('0x2e')],_0x5a45f6[_0xedb8('0x2f')]);_0x162b0d[_0xedb8('0x31')]=_[_0xedb8('0x32')](_0x5a45f6[_0xedb8('0x2e')],qs[_0xedb8('0x33')](_0x9c0d66['query']['fields']));_0x162b0d['attributes']=_0x162b0d[_0xedb8('0x31')][_0xedb8('0x34')]?_0x162b0d['attributes']:_0x5a45f6[_0xedb8('0x2e')];_0x162b0d[_0xedb8('0x37')]=qs[_0xedb8('0x38')](_0x9c0d66['query'][_0xedb8('0x38')]);_0x162b0d['where']=qs[_0xedb8('0x3a')](_['pick'](_0x9c0d66[_0xedb8('0x2f')],_0x5a45f6[_0xedb8('0x3a')]));if(_0x9c0d66[_0xedb8('0x2f')][_0xedb8('0x3b')]){_0x162b0d[_0xedb8('0x3f')]=_['merge'](_0x162b0d[_0xedb8('0x3f')],{'$or':_[_0xedb8('0x28')](_0x162b0d[_0xedb8('0x31')],function(_0xb854ab){var _0x271f72={};_0x271f72[_0xb854ab]={'$like':'%'+_0x9c0d66[_0xedb8('0x2f')][_0xedb8('0x3b')]+'%'};return _0x271f72;})});}_0x162b0d=_['merge']({},_0x162b0d,_0x9c0d66[_0xedb8('0x3e')]);return _0x2b039c[_0xedb8('0x4d')](_0x162b0d);}})[_0xedb8('0x25')](function(_0x2f5b8e){if(_0x2f5b8e){_0x424977=_0x2f5b8e['length'];if(!_0x9c0d66[_0xedb8('0x2f')][_0xedb8('0x35')]('nolimit')){_0x162b0d['limit']=qs[_0xedb8('0x1e')](_0x9c0d66[_0xedb8('0x2f')][_0xedb8('0x1e')]);_0x162b0d[_0xedb8('0x1b')]=qs['offset'](_0x9c0d66[_0xedb8('0x2f')][_0xedb8('0x1b')]);}return _0x2b039c[_0xedb8('0x4d')](_0x162b0d);}})['then'](function(_0x201ff1){if(_0x201ff1){return _0x201ff1?{'count':_0x424977,'rows':_0x201ff1}:null;}})[_0xedb8('0x25')](respondWithResult(_0x408dad,null))[_0xedb8('0x44')](handleError(_0x408dad,null));};exports[_0xedb8('0x4f')]=function(_0x4c5bfa,_0x38d3b,_0x2780a8){var _0x1e0dfe={};var _0x317a82={};var _0x7c6307;var _0xe448b;return db['SugarcrmConfiguration'][_0xedb8('0x4e')]({'where':{'id':_0x4c5bfa[_0xedb8('0x46')]['id']}})[_0xedb8('0x25')](handleEntityNotFound(_0x38d3b,null))[_0xedb8('0x25')](function(_0x51d666){if(_0x51d666){_0x7c6307=_0x51d666;_0x317a82[_0xedb8('0x2e')]=_[_0xedb8('0x30')](db[_0xedb8('0x4c')][_0xedb8('0x2a')]);_0x317a82['query']=_[_0xedb8('0x30')](_0x4c5bfa[_0xedb8('0x2f')]);_0x317a82[_0xedb8('0x3a')]=_[_0xedb8('0x32')](_0x317a82['model'],_0x317a82['query']);_0x1e0dfe[_0xedb8('0x31')]=_[_0xedb8('0x32')](_0x317a82[_0xedb8('0x2e')],qs['fields'](_0x4c5bfa[_0xedb8('0x2f')][_0xedb8('0x33')]));_0x1e0dfe[_0xedb8('0x31')]=_0x1e0dfe[_0xedb8('0x31')][_0xedb8('0x34')]?_0x1e0dfe[_0xedb8('0x31')]:_0x317a82[_0xedb8('0x2e')];_0x1e0dfe['order']=qs[_0xedb8('0x38')](_0x4c5bfa[_0xedb8('0x2f')]['sort']);_0x1e0dfe['where']=qs[_0xedb8('0x3a')](_[_0xedb8('0x39')](_0x4c5bfa[_0xedb8('0x2f')],_0x317a82['filters']));if(_0x4c5bfa['query'][_0xedb8('0x3b')]){_0x1e0dfe[_0xedb8('0x3f')]=_[_0xedb8('0x3c')](_0x1e0dfe[_0xedb8('0x3f')],{'$or':_[_0xedb8('0x28')](_0x1e0dfe[_0xedb8('0x31')],function(_0x46fb50){var _0x315762={};_0x315762[_0x46fb50]={'$like':'%'+_0x4c5bfa[_0xedb8('0x2f')][_0xedb8('0x3b')]+'%'};return _0x315762;})});}_0x1e0dfe=_[_0xedb8('0x3c')]({},_0x1e0dfe,_0x4c5bfa[_0xedb8('0x3e')]);return _0x7c6307[_0xedb8('0x4f')](_0x1e0dfe);}})[_0xedb8('0x25')](function(_0x53d896){if(_0x53d896){_0xe448b=_0x53d896[_0xedb8('0x34')];if(!_0x4c5bfa[_0xedb8('0x2f')][_0xedb8('0x35')]('nolimit')){_0x1e0dfe['limit']=qs[_0xedb8('0x1e')](_0x4c5bfa[_0xedb8('0x2f')]['limit']);_0x1e0dfe[_0xedb8('0x1b')]=qs['offset'](_0x4c5bfa[_0xedb8('0x2f')][_0xedb8('0x1b')]);}return _0x7c6307[_0xedb8('0x4f')](_0x1e0dfe);}})['then'](function(_0x49dd71){if(_0x49dd71){return _0x49dd71?{'count':_0xe448b,'rows':_0x49dd71}:null;}})['then'](respondWithResult(_0x38d3b,null))[_0xedb8('0x44')](handleError(_0x38d3b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f84a070..5288ab4 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 _0x5ea2=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird'];(function(_0x4530a6,_0x20a8d5){var _0x52c438=function(_0x105a68){while(--_0x105a68){_0x4530a6['push'](_0x4530a6['shift']());}};_0x52c438(++_0x20a8d5);}(_0x5ea2,0x69));var _0x25ea=function(_0x429168,_0x31f0d0){_0x429168=_0x429168-0x0;var _0x549a22=_0x5ea2[_0x429168];return _0x549a22;};'use strict';var _=require('lodash');var util=require(_0x25ea('0x0'));var logger=require('../../config/logger')(_0x25ea('0x1'));var moment=require('moment');var BPromise=require(_0x25ea('0x2'));var rp=require(_0x25ea('0x3'));var fs=require('fs');var path=require(_0x25ea('0x4'));var rimraf=require(_0x25ea('0x5'));var config=require(_0x25ea('0x6'));var attributes=require(_0x25ea('0x7'));module[_0x25ea('0x8')]=function(_0x126809,_0x4ae0ec){return _0x126809[_0x25ea('0x9')](_0x25ea('0xa'),attributes,{'tableName':_0x25ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb1=['util','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x5b4502,_0x53147b){var _0x16e888=function(_0x26e708){while(--_0x26e708){_0x5b4502['push'](_0x5b4502['shift']());}};_0x16e888(++_0x53147b);}(_0x9cb1,0x149));var _0x19cb=function(_0x3d900c,_0x3b2152){_0x3d900c=_0x3d900c-0x0;var _0x3c0860=_0x9cb1[_0x3d900c];return _0x3c0860;};'use strict';var _=require(_0x19cb('0x0'));var util=require(_0x19cb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x19cb('0x2'));var rp=require(_0x19cb('0x3'));var fs=require('fs');var path=require(_0x19cb('0x4'));var rimraf=require(_0x19cb('0x5'));var config=require(_0x19cb('0x6'));var attributes=require(_0x19cb('0x7'));module['exports']=function(_0x50bee2,_0x1b7449){return _0x50bee2[_0x19cb('0x8')](_0x19cb('0x9'),attributes,{'tableName':_0x19cb('0xa'),'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 86a34b4..0df4ecc 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 _0x552d=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0x552d,0xd6));var _0xd552=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x552d[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0xd552('0x0'));var moment=require(_0xd552('0x1'));var BPromise=require(_0xd552('0x2'));var rs=require(_0xd552('0x3'));var fs=require('fs');var Redis=require(_0xd552('0x4'));var db=require(_0xd552('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd552('0x6'))('rpc');var config=require(_0xd552('0x7'));var jayson=require(_0xd552('0x8'));var client=jayson[_0xd552('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2576,_0x28804d,_0x5b6c17){return new BPromise(function(_0x5a2d91,_0x3b9e26){return client[_0xd552('0xa')](_0x1f2576,_0x5b6c17)[_0xd552('0xb')](function(_0x23fd5d){logger['info'](_0xd552('0xc'),_0x28804d,_0xd552('0xd'));logger[_0xd552('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x28804d,_0xd552('0xd'),JSON[_0xd552('0xf')](_0x23fd5d));if(_0x23fd5d[_0xd552('0x10')]){if(_0x23fd5d[_0xd552('0x10')][_0xd552('0x11')]===0x1f4){logger[_0xd552('0x10')](_0xd552('0xc'),_0x28804d,_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);return _0x3b9e26(_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);}logger[_0xd552('0x10')](_0xd552('0xc'),_0x28804d,_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);return _0x5a2d91(_0x23fd5d[_0xd552('0x10')][_0xd552('0x12')]);}else{logger[_0xd552('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28804d,_0xd552('0xd'));_0x5a2d91(_0x23fd5d['result']['message']);}})[_0xd552('0x14')](function(_0x38d589){logger[_0xd552('0x10')](_0xd552('0xc'),_0x28804d,_0x38d589);_0x3b9e26(_0x38d589);});});} \ No newline at end of file +var _0x0978=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x0978,0x176));var _0x8097=function(_0x17f6c3,_0xa83c68){_0x17f6c3=_0x17f6c3-0x0;var _0x31d6da=_0x0978[_0x17f6c3];return _0x31d6da;};'use strict';var _=require(_0x8097('0x0'));var util=require('util');var moment=require(_0x8097('0x1'));var BPromise=require(_0x8097('0x2'));var rs=require(_0x8097('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8097('0x4'))['db'];var utils=require(_0x8097('0x5'));var logger=require(_0x8097('0x6'))('rpc');var config=require(_0x8097('0x7'));var jayson=require(_0x8097('0x8'));var client=jayson[_0x8097('0x9')][_0x8097('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14d749,_0x39301d,_0x597d1c){return new BPromise(function(_0x23701c,_0x56170f){return client['request'](_0x14d749,_0x597d1c)[_0x8097('0xb')](function(_0x1421ba){logger[_0x8097('0xc')](_0x8097('0xd'),_0x39301d,'request\x20sent');logger[_0x8097('0xe')](_0x8097('0xf'),_0x39301d,_0x8097('0x10'),JSON[_0x8097('0x11')](_0x1421ba));if(_0x1421ba[_0x8097('0x12')]){if(_0x1421ba[_0x8097('0x12')]['code']===0x1f4){logger[_0x8097('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x39301d,_0x1421ba[_0x8097('0x12')]['message']);return _0x56170f(_0x1421ba[_0x8097('0x12')][_0x8097('0x13')]);}logger[_0x8097('0x12')](_0x8097('0xd'),_0x39301d,_0x1421ba[_0x8097('0x12')]['message']);return _0x23701c(_0x1421ba['error'][_0x8097('0x13')]);}else{logger[_0x8097('0xc')](_0x8097('0xd'),_0x39301d,_0x8097('0x10'));_0x23701c(_0x1421ba[_0x8097('0x14')][_0x8097('0x13')]);}})[_0x8097('0x15')](function(_0x1f2d22){logger[_0x8097('0x12')](_0x8097('0xd'),_0x39301d,_0x1f2d22);_0x56170f(_0x1f2d22);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 350f98d..b0651bf 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 _0xdeeb=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put'];(function(_0x198885,_0x2f71b6){var _0x3b0ca0=function(_0x377394){while(--_0x377394){_0x198885['push'](_0x198885['shift']());}};_0x3b0ca0(++_0x2f71b6);}(_0xdeeb,0x93));var _0xbdee=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xdeeb[_0x2bc3f4];return _0x14ac53;};'use strict';var multer=require(_0xbdee('0x0'));var util=require(_0xbdee('0x1'));var path=require(_0xbdee('0x2'));var timeout=require(_0xbdee('0x3'));var express=require('express');var router=express[_0xbdee('0x4')]();var fs_extra=require(_0xbdee('0x5'));var auth=require(_0xbdee('0x6'));var interaction=require(_0xbdee('0x7'));var config=require('../../config/environment');var controller=require(_0xbdee('0x8'));router[_0xbdee('0x9')]('/',auth[_0xbdee('0xa')](),controller[_0xbdee('0xb')]);router[_0xbdee('0x9')](_0xbdee('0xc'),auth[_0xbdee('0xa')](),controller['show']);router['post']('/',auth[_0xbdee('0xa')](),controller[_0xbdee('0xd')]);router[_0xbdee('0xe')](_0xbdee('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbdee('0xf')](_0xbdee('0xc'),auth['isAuthenticated'](),controller[_0xbdee('0x10')]);module[_0xbdee('0x11')]=router; \ No newline at end of file +var _0xef4e=['./intSugarcrmField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5d9f5c,_0x1ac192){var _0x560394=function(_0x575efc){while(--_0x575efc){_0x5d9f5c['push'](_0x5d9f5c['shift']());}};_0x560394(++_0x1ac192);}(_0xef4e,0xb9));var _0xeef4=function(_0x4fc435,_0x45eddf){_0x4fc435=_0x4fc435-0x0;var _0x3c5db1=_0xef4e[_0x4fc435];return _0x3c5db1;};'use strict';var multer=require(_0xeef4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeef4('0x1'));var express=require(_0xeef4('0x2'));var router=express[_0xeef4('0x3')]();var fs_extra=require(_0xeef4('0x4'));var auth=require(_0xeef4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeef4('0x6'));var controller=require(_0xeef4('0x7'));router[_0xeef4('0x8')]('/',auth[_0xeef4('0x9')](),controller['index']);router[_0xeef4('0x8')](_0xeef4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xeef4('0xb')]('/',auth[_0xeef4('0x9')](),controller[_0xeef4('0xc')]);router[_0xeef4('0xd')](_0xeef4('0xa'),auth[_0xeef4('0x9')](),controller['update']);router[_0xeef4('0xe')]('/:id',auth[_0xeef4('0x9')](),controller[_0xeef4('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 5d443dc..dad46a9 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 _0x0392=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0xc2a56e,_0x3650fb){var _0x20c022=function(_0x2e23bf){while(--_0x2e23bf){_0xc2a56e['push'](_0xc2a56e['shift']());}};_0x20c022(++_0x3650fb);}(_0x0392,0x66));var _0x2039=function(_0x331ce0,_0xe335b9){_0x331ce0=_0x331ce0-0x0;var _0x31c3c7=_0x0392[_0x331ce0];return _0x31c3c7;};'use strict';var Sequelize=require(_0x2039('0x0'));module[_0x2039('0x1')]={'type':{'type':Sequelize[_0x2039('0x2')](_0x2039('0x3'),_0x2039('0x4'),_0x2039('0x5'),_0x2039('0x6'),_0x2039('0x7')),'defaultValue':_0x2039('0x3')},'content':{'type':Sequelize[_0x2039('0x8')]},'key':{'type':Sequelize[_0x2039('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x2039('0x3'),'variable',_0x2039('0x5'))},'keyContent':{'type':Sequelize[_0x2039('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2039('0x8')]},'customField':{'type':Sequelize[_0x2039('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2039('0x8')]}}; \ No newline at end of file +var _0x9931=['variable','customVariable','keyValue','STRING','string','BOOLEAN','sequelize','ENUM'];(function(_0xdb7850,_0x22216e){var _0x973ff0=function(_0x16e0d3){while(--_0x16e0d3){_0xdb7850['push'](_0xdb7850['shift']());}};_0x973ff0(++_0x22216e);}(_0x9931,0x12e));var _0x1993=function(_0x1e3c76,_0x31ca93){_0x1e3c76=_0x1e3c76-0x0;var _0x276f45=_0x9931[_0x1e3c76];return _0x276f45;};'use strict';var Sequelize=require(_0x1993('0x0'));module['exports']={'type':{'type':Sequelize[_0x1993('0x1')]('string',_0x1993('0x2'),_0x1993('0x3'),_0x1993('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1993('0x5')]},'key':{'type':Sequelize[_0x1993('0x5')]},'keyType':{'type':Sequelize[_0x1993('0x1')](_0x1993('0x6'),'variable',_0x1993('0x3'))},'keyContent':{'type':Sequelize[_0x1993('0x5')]},'idField':{'type':Sequelize[_0x1993('0x5')]},'nameField':{'type':Sequelize[_0x1993('0x5')]},'customField':{'type':Sequelize[_0x1993('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 50224fc..e0c3ece 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 _0xfcfa=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util'];(function(_0x45dec8,_0x20a9c0){var _0x2f5625=function(_0x44e54b){while(--_0x44e54b){_0x45dec8['push'](_0x45dec8['shift']());}};_0x2f5625(++_0x20a9c0);}(_0xfcfa,0x84));var _0xafcf=function(_0x3c9058,_0x68b1e3){_0x3c9058=_0x3c9058-0x0;var _0x5c1c81=_0xfcfa[_0x3c9058];return _0x5c1c81;};'use strict';var emlformat=require(_0xafcf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafcf('0x1'));var rp=require(_0xafcf('0x2'));var moment=require(_0xafcf('0x3'));var BPromise=require(_0xafcf('0x4'));var Mustache=require(_0xafcf('0x5'));var util=require('util');var path=require(_0xafcf('0x6'));var sox=require(_0xafcf('0x7'));var csv=require(_0xafcf('0x8'));var ejs=require(_0xafcf('0x9'));var fs=require('fs');var fs_extra=require(_0xafcf('0xa'));var _=require(_0xafcf('0xb'));var squel=require(_0xafcf('0xc'));var crypto=require(_0xafcf('0xd'));var jsforce=require(_0xafcf('0xe'));var deskjs=require(_0xafcf('0xf'));var toCsv=require('to-csv');var querystring=require(_0xafcf('0x10'));var Papa=require(_0xafcf('0x11'));var Redis=require(_0xafcf('0x12'));var authService=require(_0xafcf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xafcf('0x14'));var hardwareService=require(_0xafcf('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xafcf('0x16'));var licenseUtil=require(_0xafcf('0x17'));var db=require(_0xafcf('0x18'))['db'];function respondWithStatusCode(_0x39a858,_0x539465){_0x539465=_0x539465||0xcc;return function(_0x3a9d6d){if(_0x3a9d6d){return _0x39a858[_0xafcf('0x19')](_0x539465);}return _0x39a858['status'](_0x539465)[_0xafcf('0x1a')]();};}function respondWithResult(_0x3b152d,_0x39b182){_0x39b182=_0x39b182||0xc8;return function(_0x1ad81c){if(_0x1ad81c){return _0x3b152d['status'](_0x39b182)[_0xafcf('0x1b')](_0x1ad81c);}};}function respondWithFilteredResult(_0x301131,_0xb1428e){return function(_0x27684d){if(_0x27684d){var _0x487659=typeof _0xb1428e[_0xafcf('0x1c')]===_0xafcf('0x1d')&&typeof _0xb1428e[_0xafcf('0x1e')]===_0xafcf('0x1d');var _0x13b65b=_0x27684d[_0xafcf('0x1f')];var _0x1bffe0=_0x487659?0x0:_0xb1428e['offset'];var _0x5e040f=_0x487659?_0x27684d[_0xafcf('0x1f')]:_0xb1428e[_0xafcf('0x1c')]+_0xb1428e['limit'];var _0x3c7611;if(_0x5e040f>=_0x13b65b){_0x5e040f=_0x13b65b;_0x3c7611=0xc8;}else{_0x3c7611=0xce;}_0x301131['status'](_0x3c7611);return _0x301131[_0xafcf('0x20')](_0xafcf('0x21'),_0x1bffe0+'-'+_0x5e040f+'/'+_0x13b65b)[_0xafcf('0x1b')](_0x27684d);}return null;};}function patchUpdates(_0x1f5425){return function(_0x1b16dd){try{jsonpatch[_0xafcf('0x22')](_0x1b16dd,_0x1f5425,!![]);}catch(_0x18cade){return BPromise[_0xafcf('0x23')](_0x18cade);}return _0x1b16dd[_0xafcf('0x24')]();};}function saveUpdates(_0x4f409e,_0x4b4798){return function(_0x4ea103){if(_0x4ea103){return _0x4ea103[_0xafcf('0x25')](_0x4f409e)[_0xafcf('0x26')](function(_0x2bdb8e){return _0x2bdb8e;});}return null;};}function removeEntity(_0x3beaeb,_0x1ff838){return function(_0xc26e42){if(_0xc26e42){return _0xc26e42[_0xafcf('0x27')]()['then'](function(){_0x3beaeb[_0xafcf('0x28')](0xcc)[_0xafcf('0x1a')]();});}};}function handleEntityNotFound(_0x65169e,_0x1290fc){return function(_0x402897){if(!_0x402897){_0x65169e[_0xafcf('0x19')](0x194);}return _0x402897;};}function handleError(_0x4ea27d,_0x3b0121){_0x3b0121=_0x3b0121||0x1f4;return function(_0x85f5d3){logger[_0xafcf('0x29')](_0x85f5d3[_0xafcf('0x2a')]);if(_0x85f5d3['name']){delete _0x85f5d3[_0xafcf('0x2b')];}_0x4ea27d[_0xafcf('0x28')](_0x3b0121)[_0xafcf('0x2c')](_0x85f5d3);};}exports[_0xafcf('0x2d')]=function(_0x408707,_0x3fc25e){var _0x195bf3={},_0x5644a8={},_0x4cbf87={'count':0x0,'rows':[]};var _0x870647=_[_0xafcf('0x2e')](db[_0xafcf('0x2f')][_0xafcf('0x30')],function(_0x5e115a){return{'name':_0x5e115a[_0xafcf('0x31')],'type':_0x5e115a[_0xafcf('0x32')][_0xafcf('0x33')]};});_0x5644a8[_0xafcf('0x34')]=_[_0xafcf('0x2e')](_0x870647,_0xafcf('0x2b'));_0x5644a8['query']=_[_0xafcf('0x35')](_0x408707[_0xafcf('0x36')]);_0x5644a8[_0xafcf('0x37')]=_['intersection'](_0x5644a8['model'],_0x5644a8[_0xafcf('0x36')]);_0x195bf3[_0xafcf('0x38')]=_[_0xafcf('0x39')](_0x5644a8[_0xafcf('0x34')],qs[_0xafcf('0x3a')](_0x408707[_0xafcf('0x36')][_0xafcf('0x3a')]));_0x195bf3['attributes']=_0x195bf3['attributes'][_0xafcf('0x3b')]?_0x195bf3['attributes']:_0x5644a8[_0xafcf('0x34')];if(!_0x408707[_0xafcf('0x36')][_0xafcf('0x3c')](_0xafcf('0x3d'))){_0x195bf3[_0xafcf('0x1e')]=qs[_0xafcf('0x1e')](_0x408707[_0xafcf('0x36')]['limit']);_0x195bf3[_0xafcf('0x1c')]=qs[_0xafcf('0x1c')](_0x408707[_0xafcf('0x36')]['offset']);}_0x195bf3[_0xafcf('0x3e')]=qs['sort'](_0x408707[_0xafcf('0x36')][_0xafcf('0x3f')]);_0x195bf3['where']=qs[_0xafcf('0x37')](_['pick'](_0x408707[_0xafcf('0x36')],_0x5644a8[_0xafcf('0x37')]),_0x870647);if(_0x408707[_0xafcf('0x36')][_0xafcf('0x40')]){_0x195bf3[_0xafcf('0x41')]=_['merge'](_0x195bf3[_0xafcf('0x41')],{'$or':_[_0xafcf('0x2e')](_0x870647,function(_0x511097){if(_0x511097[_0xafcf('0x32')]!==_0xafcf('0x42')){var _0x45c789={};_0x45c789[_0x511097[_0xafcf('0x2b')]]={'$like':'%'+_0x408707['query'][_0xafcf('0x40')]+'%'};return _0x45c789;}})});}_0x195bf3=_[_0xafcf('0x43')]({},_0x195bf3,_0x408707[_0xafcf('0x44')]);var _0x17aef7={'where':_0x195bf3[_0xafcf('0x41')]};return db[_0xafcf('0x2f')][_0xafcf('0x1f')](_0x17aef7)[_0xafcf('0x26')](function(_0x188626){_0x4cbf87[_0xafcf('0x1f')]=_0x188626;if(_0x408707[_0xafcf('0x36')][_0xafcf('0x45')]){_0x195bf3['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x195bf3);})[_0xafcf('0x26')](function(_0x49b9b7){_0x4cbf87[_0xafcf('0x46')]=_0x49b9b7;return _0x4cbf87;})['then'](respondWithFilteredResult(_0x3fc25e,_0x195bf3))[_0xafcf('0x47')](handleError(_0x3fc25e,null));};exports[_0xafcf('0x48')]=function(_0x503abc,_0xa3621d){var _0x17ba81={'raw':!![],'where':{'id':_0x503abc[_0xafcf('0x49')]['id']}},_0x3a17fa={};_0x3a17fa[_0xafcf('0x34')]=_[_0xafcf('0x35')](db[_0xafcf('0x2f')][_0xafcf('0x30')]);_0x3a17fa['query']=_[_0xafcf('0x35')](_0x503abc[_0xafcf('0x36')]);_0x3a17fa[_0xafcf('0x37')]=_[_0xafcf('0x39')](_0x3a17fa[_0xafcf('0x34')],_0x3a17fa[_0xafcf('0x36')]);_0x17ba81['attributes']=_[_0xafcf('0x39')](_0x3a17fa[_0xafcf('0x34')],qs[_0xafcf('0x3a')](_0x503abc['query'][_0xafcf('0x3a')]));_0x17ba81['attributes']=_0x17ba81['attributes'][_0xafcf('0x3b')]?_0x17ba81[_0xafcf('0x38')]:_0x3a17fa[_0xafcf('0x34')];if(_0x503abc[_0xafcf('0x36')][_0xafcf('0x45')]){_0x17ba81[_0xafcf('0x4a')]=[{'all':!![]}];}_0x17ba81=_['merge']({},_0x17ba81,_0x503abc[_0xafcf('0x44')]);return db[_0xafcf('0x2f')][_0xafcf('0x4b')](_0x17ba81)['then'](handleEntityNotFound(_0xa3621d,null))['then'](respondWithResult(_0xa3621d,null))[_0xafcf('0x47')](handleError(_0xa3621d,null));};exports[_0xafcf('0x4c')]=function(_0x399a1e,_0x52f99d){return db[_0xafcf('0x2f')]['create'](_0x399a1e[_0xafcf('0x4d')],{})[_0xafcf('0x26')](respondWithResult(_0x52f99d,0xc9))['catch'](handleError(_0x52f99d,null));};exports[_0xafcf('0x25')]=function(_0xed08fc,_0x233a50){if(_0xed08fc[_0xafcf('0x4d')]['id']){delete _0xed08fc[_0xafcf('0x4d')]['id'];}return db[_0xafcf('0x2f')][_0xafcf('0x4b')]({'where':{'id':_0xed08fc[_0xafcf('0x49')]['id']}})[_0xafcf('0x26')](handleEntityNotFound(_0x233a50,null))[_0xafcf('0x26')](saveUpdates(_0xed08fc[_0xafcf('0x4d')],null))[_0xafcf('0x26')](respondWithResult(_0x233a50,null))['catch'](handleError(_0x233a50,null));};exports[_0xafcf('0x27')]=function(_0x51d8b3,_0x3e5fe9){return db[_0xafcf('0x2f')][_0xafcf('0x4b')]({'where':{'id':_0x51d8b3['params']['id']}})[_0xafcf('0x26')](handleEntityNotFound(_0x3e5fe9,null))[_0xafcf('0x26')](removeEntity(_0x3e5fe9,null))[_0xafcf('0x47')](handleError(_0x3e5fe9,null));}; \ No newline at end of file +var _0x70cd=['error','stack','name','index','map','SugarcrmField','rawAttributes','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then'];(function(_0x125274,_0x3dde11){var _0x24e4ff=function(_0x3116f5){while(--_0x3116f5){_0x125274['push'](_0x125274['shift']());}};_0x24e4ff(++_0x3dde11);}(_0x70cd,0x149));var _0xd70c=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0x70cd[_0x4aac5a];return _0x42e7bc;};'use strict';var emlformat=require(_0xd70c('0x0'));var rimraf=require(_0xd70c('0x1'));var zipdir=require(_0xd70c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd70c('0x3'));var moment=require('moment');var BPromise=require(_0xd70c('0x4'));var Mustache=require(_0xd70c('0x5'));var util=require(_0xd70c('0x6'));var path=require('path');var sox=require(_0xd70c('0x7'));var csv=require('to-csv');var ejs=require(_0xd70c('0x8'));var fs=require('fs');var fs_extra=require(_0xd70c('0x9'));var _=require(_0xd70c('0xa'));var squel=require(_0xd70c('0xb'));var crypto=require(_0xd70c('0xc'));var jsforce=require(_0xd70c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd70c('0xe'));var querystring=require(_0xd70c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd70c('0x10'));var qs=require(_0xd70c('0x11'));var as=require(_0xd70c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd70c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd70c('0x14'));var licenseUtil=require(_0xd70c('0x15'));var db=require(_0xd70c('0x16'))['db'];function respondWithStatusCode(_0x2002f2,_0x75026a){_0x75026a=_0x75026a||0xcc;return function(_0x1aa8c8){if(_0x1aa8c8){return _0x2002f2[_0xd70c('0x17')](_0x75026a);}return _0x2002f2[_0xd70c('0x18')](_0x75026a)[_0xd70c('0x19')]();};}function respondWithResult(_0x18a002,_0x3d3811){_0x3d3811=_0x3d3811||0xc8;return function(_0x5a0abc){if(_0x5a0abc){return _0x18a002[_0xd70c('0x18')](_0x3d3811)[_0xd70c('0x1a')](_0x5a0abc);}};}function respondWithFilteredResult(_0x3a8c00,_0x58e173){return function(_0x349024){if(_0x349024){var _0x328672=typeof _0x58e173['offset']===_0xd70c('0x1b')&&typeof _0x58e173[_0xd70c('0x1c')]==='undefined';var _0x4d653c=_0x349024[_0xd70c('0x1d')];var _0x36ea44=_0x328672?0x0:_0x58e173[_0xd70c('0x1e')];var _0x943abe=_0x328672?_0x349024[_0xd70c('0x1d')]:_0x58e173[_0xd70c('0x1e')]+_0x58e173[_0xd70c('0x1c')];var _0x2b0530;if(_0x943abe>=_0x4d653c){_0x943abe=_0x4d653c;_0x2b0530=0xc8;}else{_0x2b0530=0xce;}_0x3a8c00[_0xd70c('0x18')](_0x2b0530);return _0x3a8c00[_0xd70c('0x1f')](_0xd70c('0x20'),_0x36ea44+'-'+_0x943abe+'/'+_0x4d653c)[_0xd70c('0x1a')](_0x349024);}return null;};}function patchUpdates(_0x3d48af){return function(_0x1a208b){try{jsonpatch[_0xd70c('0x21')](_0x1a208b,_0x3d48af,!![]);}catch(_0x2a264c){return BPromise[_0xd70c('0x22')](_0x2a264c);}return _0x1a208b['save']();};}function saveUpdates(_0x20c304,_0x1bd502){return function(_0x2348d8){if(_0x2348d8){return _0x2348d8['update'](_0x20c304)[_0xd70c('0x23')](function(_0x4f4a5f){return _0x4f4a5f;});}return null;};}function removeEntity(_0x80495e,_0x3ff5dd){return function(_0x3a83a2){if(_0x3a83a2){return _0x3a83a2['destroy']()['then'](function(){_0x80495e[_0xd70c('0x18')](0xcc)[_0xd70c('0x19')]();});}};}function handleEntityNotFound(_0x33d226,_0x555e6c){return function(_0x280118){if(!_0x280118){_0x33d226[_0xd70c('0x17')](0x194);}return _0x280118;};}function handleError(_0x597382,_0x59646f){_0x59646f=_0x59646f||0x1f4;return function(_0x31efd8){logger[_0xd70c('0x24')](_0x31efd8[_0xd70c('0x25')]);if(_0x31efd8[_0xd70c('0x26')]){delete _0x31efd8[_0xd70c('0x26')];}_0x597382[_0xd70c('0x18')](_0x59646f)['send'](_0x31efd8);};}exports[_0xd70c('0x27')]=function(_0x1eba51,_0x137240){var _0x48350b={},_0x4c3a38={},_0x3ef74d={'count':0x0,'rows':[]};var _0x31fb51=_[_0xd70c('0x28')](db[_0xd70c('0x29')][_0xd70c('0x2a')],function(_0x197386){return{'name':_0x197386['fieldName'],'type':_0x197386['type'][_0xd70c('0x2b')]};});_0x4c3a38[_0xd70c('0x2c')]=_[_0xd70c('0x28')](_0x31fb51,'name');_0x4c3a38[_0xd70c('0x2d')]=_['keys'](_0x1eba51[_0xd70c('0x2d')]);_0x4c3a38[_0xd70c('0x2e')]=_[_0xd70c('0x2f')](_0x4c3a38[_0xd70c('0x2c')],_0x4c3a38[_0xd70c('0x2d')]);_0x48350b[_0xd70c('0x30')]=_[_0xd70c('0x2f')](_0x4c3a38[_0xd70c('0x2c')],qs['fields'](_0x1eba51[_0xd70c('0x2d')]['fields']));_0x48350b['attributes']=_0x48350b[_0xd70c('0x30')][_0xd70c('0x31')]?_0x48350b[_0xd70c('0x30')]:_0x4c3a38[_0xd70c('0x2c')];if(!_0x1eba51[_0xd70c('0x2d')][_0xd70c('0x32')](_0xd70c('0x33'))){_0x48350b[_0xd70c('0x1c')]=qs['limit'](_0x1eba51['query'][_0xd70c('0x1c')]);_0x48350b[_0xd70c('0x1e')]=qs['offset'](_0x1eba51['query'][_0xd70c('0x1e')]);}_0x48350b[_0xd70c('0x34')]=qs['sort'](_0x1eba51[_0xd70c('0x2d')][_0xd70c('0x35')]);_0x48350b['where']=qs[_0xd70c('0x2e')](_['pick'](_0x1eba51[_0xd70c('0x2d')],_0x4c3a38[_0xd70c('0x2e')]),_0x31fb51);if(_0x1eba51[_0xd70c('0x2d')]['filter']){_0x48350b['where']=_[_0xd70c('0x36')](_0x48350b['where'],{'$or':_['map'](_0x31fb51,function(_0x39ed0f){if(_0x39ed0f[_0xd70c('0x37')]!==_0xd70c('0x38')){var _0x562347={};_0x562347[_0x39ed0f[_0xd70c('0x26')]]={'$like':'%'+_0x1eba51[_0xd70c('0x2d')][_0xd70c('0x39')]+'%'};return _0x562347;}})});}_0x48350b=_[_0xd70c('0x36')]({},_0x48350b,_0x1eba51[_0xd70c('0x3a')]);var _0x28870f={'where':_0x48350b['where']};return db[_0xd70c('0x29')][_0xd70c('0x1d')](_0x28870f)[_0xd70c('0x23')](function(_0x1bb2f1){_0x3ef74d['count']=_0x1bb2f1;if(_0x1eba51[_0xd70c('0x2d')][_0xd70c('0x3b')]){_0x48350b[_0xd70c('0x3c')]=[{'all':!![]}];}return db['SugarcrmField'][_0xd70c('0x3d')](_0x48350b);})[_0xd70c('0x23')](function(_0x1ca8db){_0x3ef74d[_0xd70c('0x3e')]=_0x1ca8db;return _0x3ef74d;})['then'](respondWithFilteredResult(_0x137240,_0x48350b))[_0xd70c('0x3f')](handleError(_0x137240,null));};exports[_0xd70c('0x40')]=function(_0x2c9f1f,_0x82fbc1){var _0x57c301={'raw':!![],'where':{'id':_0x2c9f1f[_0xd70c('0x41')]['id']}},_0x1129bc={};_0x1129bc[_0xd70c('0x2c')]=_['keys'](db[_0xd70c('0x29')][_0xd70c('0x2a')]);_0x1129bc[_0xd70c('0x2d')]=_[_0xd70c('0x42')](_0x2c9f1f['query']);_0x1129bc[_0xd70c('0x2e')]=_['intersection'](_0x1129bc[_0xd70c('0x2c')],_0x1129bc[_0xd70c('0x2d')]);_0x57c301[_0xd70c('0x30')]=_[_0xd70c('0x2f')](_0x1129bc['model'],qs[_0xd70c('0x43')](_0x2c9f1f[_0xd70c('0x2d')][_0xd70c('0x43')]));_0x57c301[_0xd70c('0x30')]=_0x57c301['attributes'][_0xd70c('0x31')]?_0x57c301[_0xd70c('0x30')]:_0x1129bc['model'];if(_0x2c9f1f[_0xd70c('0x2d')][_0xd70c('0x3b')]){_0x57c301[_0xd70c('0x3c')]=[{'all':!![]}];}_0x57c301=_[_0xd70c('0x36')]({},_0x57c301,_0x2c9f1f[_0xd70c('0x3a')]);return db[_0xd70c('0x29')][_0xd70c('0x44')](_0x57c301)['then'](handleEntityNotFound(_0x82fbc1,null))[_0xd70c('0x23')](respondWithResult(_0x82fbc1,null))[_0xd70c('0x3f')](handleError(_0x82fbc1,null));};exports['create']=function(_0x56ed5a,_0x3bacef){return db[_0xd70c('0x29')][_0xd70c('0x45')](_0x56ed5a[_0xd70c('0x46')],{})['then'](respondWithResult(_0x3bacef,0xc9))[_0xd70c('0x3f')](handleError(_0x3bacef,null));};exports[_0xd70c('0x47')]=function(_0x1a7c1a,_0x5b5242){if(_0x1a7c1a[_0xd70c('0x46')]['id']){delete _0x1a7c1a['body']['id'];}return db[_0xd70c('0x29')][_0xd70c('0x44')]({'where':{'id':_0x1a7c1a['params']['id']}})['then'](handleEntityNotFound(_0x5b5242,null))[_0xd70c('0x23')](saveUpdates(_0x1a7c1a[_0xd70c('0x46')],null))['then'](respondWithResult(_0x5b5242,null))[_0xd70c('0x3f')](handleError(_0x5b5242,null));};exports[_0xd70c('0x48')]=function(_0x4f54bd,_0x14ba57){return db[_0xd70c('0x29')]['find']({'where':{'id':_0x4f54bd[_0xd70c('0x41')]['id']}})['then'](handleEntityNotFound(_0x14ba57,null))['then'](removeEntity(_0x14ba57,null))[_0xd70c('0x3f')](handleError(_0x14ba57,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 48403c0..699d966 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 _0xfbe5=['int_sugarcrm_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xfbe5,0x1a6));var _0x5fbe=function(_0x87aa9e,_0x36e0a3){_0x87aa9e=_0x87aa9e-0x0;var _0x1d4ed3=_0xfbe5[_0x87aa9e];return _0x1d4ed3;};'use strict';var _=require(_0x5fbe('0x0'));var util=require(_0x5fbe('0x1'));var logger=require(_0x5fbe('0x2'))('api');var moment=require(_0x5fbe('0x3'));var BPromise=require(_0x5fbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fbe('0x5'));var rimraf=require(_0x5fbe('0x6'));var config=require(_0x5fbe('0x7'));var attributes=require(_0x5fbe('0x8'));module[_0x5fbe('0x9')]=function(_0x84c0be,_0x5b2819){return _0x84c0be[_0x5fbe('0xa')](_0x5fbe('0xb'),attributes,{'tableName':_0x5fbe('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x5fbe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28f3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util'];(function(_0x560fdb,_0xe678c1){var _0x18ef38=function(_0x1c7361){while(--_0x1c7361){_0x560fdb['push'](_0x560fdb['shift']());}};_0x18ef38(++_0xe678c1);}(_0x28f3,0x8b));var _0x328f=function(_0x518155,_0x231e0d){_0x518155=_0x518155-0x0;var _0x2d9e37=_0x28f3[_0x518155];return _0x2d9e37;};'use strict';var _=require('lodash');var util=require(_0x328f('0x0'));var logger=require('../../config/logger')(_0x328f('0x1'));var moment=require(_0x328f('0x2'));var BPromise=require(_0x328f('0x3'));var rp=require(_0x328f('0x4'));var fs=require('fs');var path=require(_0x328f('0x5'));var rimraf=require(_0x328f('0x6'));var config=require(_0x328f('0x7'));var attributes=require(_0x328f('0x8'));module['exports']=function(_0x2790a8,_0x383280){return _0x2790a8['define'](_0x328f('0x9'),attributes,{'tableName':_0x328f('0xa'),'paranoid':![],'indexes':[{'name':_0x328f('0xb'),'fields':[_0x328f('0xc'),_0x328f('0xd')],'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 d9e1b2c..c5c6811 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 _0x9c8e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x9c8e,0x14b));var _0xe9c8=function(_0x316067,_0x1766f9){_0x316067=_0x316067-0x0;var _0x1dfb40=_0x9c8e[_0x316067];return _0x1dfb40;};'use strict';var _=require(_0xe9c8('0x0'));var util=require(_0xe9c8('0x1'));var moment=require(_0xe9c8('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9c8('0x3'));var fs=require('fs');var Redis=require(_0xe9c8('0x4'));var db=require(_0xe9c8('0x5'))['db'];var utils=require(_0xe9c8('0x6'));var logger=require(_0xe9c8('0x7'))('rpc');var config=require(_0xe9c8('0x8'));var jayson=require(_0xe9c8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x547c74,_0x5c87cb,_0x155321){return new BPromise(function(_0x3e350f,_0x2b6be0){return client[_0xe9c8('0xa')](_0x547c74,_0x155321)['then'](function(_0x3616d9){logger['info'](_0xe9c8('0xb'),_0x5c87cb,_0xe9c8('0xc'));logger[_0xe9c8('0xd')](_0xe9c8('0xe'),_0x5c87cb,'request\x20sent',JSON[_0xe9c8('0xf')](_0x3616d9));if(_0x3616d9[_0xe9c8('0x10')]){if(_0x3616d9[_0xe9c8('0x10')]['code']===0x1f4){logger[_0xe9c8('0x10')](_0xe9c8('0xb'),_0x5c87cb,_0x3616d9[_0xe9c8('0x10')][_0xe9c8('0x11')]);return _0x2b6be0(_0x3616d9['error']['message']);}logger[_0xe9c8('0x10')](_0xe9c8('0xb'),_0x5c87cb,_0x3616d9[_0xe9c8('0x10')]['message']);return _0x3e350f(_0x3616d9[_0xe9c8('0x10')][_0xe9c8('0x11')]);}else{logger[_0xe9c8('0x12')](_0xe9c8('0xb'),_0x5c87cb,_0xe9c8('0xc'));_0x3e350f(_0x3616d9[_0xe9c8('0x13')][_0xe9c8('0x11')]);}})[_0xe9c8('0x14')](function(_0x1cc6ac){logger[_0xe9c8('0x10')](_0xe9c8('0xb'),_0x5c87cb,_0x1cc6ac);_0x2b6be0(_0x1cc6ac);});});} \ No newline at end of file +var _0xdd67=['jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x620961,_0x35e790){var _0x3c1aff=function(_0x190fa1){while(--_0x190fa1){_0x620961['push'](_0x620961['shift']());}};_0x3c1aff(++_0x35e790);}(_0xdd67,0x1d5));var _0x7dd6=function(_0x500ae1,_0x42a82e){_0x500ae1=_0x500ae1-0x0;var _0x59e1fb=_0xdd67[_0x500ae1];return _0x59e1fb;};'use strict';var _=require(_0x7dd6('0x0'));var util=require(_0x7dd6('0x1'));var moment=require(_0x7dd6('0x2'));var BPromise=require(_0x7dd6('0x3'));var rs=require(_0x7dd6('0x4'));var fs=require('fs');var Redis=require(_0x7dd6('0x5'));var db=require(_0x7dd6('0x6'))['db'];var utils=require(_0x7dd6('0x7'));var logger=require(_0x7dd6('0x8'))(_0x7dd6('0x9'));var config=require(_0x7dd6('0xa'));var jayson=require(_0x7dd6('0xb'));var client=jayson[_0x7dd6('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa1bb69,_0x26fc20,_0x59879e){return new BPromise(function(_0x5c51e8,_0x5af42d){return client[_0x7dd6('0xd')](_0xa1bb69,_0x59879e)[_0x7dd6('0xe')](function(_0x255209){logger[_0x7dd6('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x26fc20,_0x7dd6('0x10'));logger[_0x7dd6('0x11')](_0x7dd6('0x12'),_0x26fc20,'request\x20sent',JSON['stringify'](_0x255209));if(_0x255209['error']){if(_0x255209['error']['code']===0x1f4){logger[_0x7dd6('0x13')](_0x7dd6('0x14'),_0x26fc20,_0x255209[_0x7dd6('0x13')][_0x7dd6('0x15')]);return _0x5af42d(_0x255209['error'][_0x7dd6('0x15')]);}logger[_0x7dd6('0x13')](_0x7dd6('0x14'),_0x26fc20,_0x255209[_0x7dd6('0x13')]['message']);return _0x5c51e8(_0x255209['error'][_0x7dd6('0x15')]);}else{logger[_0x7dd6('0xf')](_0x7dd6('0x14'),_0x26fc20,_0x7dd6('0x10'));_0x5c51e8(_0x255209[_0x7dd6('0x16')]['message']);}})[_0x7dd6('0x17')](function(_0x42d0bb){logger[_0x7dd6('0x13')](_0x7dd6('0x14'),_0x26fc20,_0x42d0bb);_0x5af42d(_0x42d0bb);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7e18cff..e184b49 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 _0x95d9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x95d9,0x97));var _0x995d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x95d9[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var path=require(_0x995d('0x2'));var timeout=require(_0x995d('0x3'));var express=require('express');var router=express[_0x995d('0x4')]();var fs_extra=require(_0x995d('0x5'));var auth=require(_0x995d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x995d('0x7'));var controller=require(_0x995d('0x8'));router[_0x995d('0x9')]('/',auth[_0x995d('0xa')](),controller[_0x995d('0xb')]);router['get'](_0x995d('0xc'),auth[_0x995d('0xa')](),controller[_0x995d('0xd')]);router[_0x995d('0x9')](_0x995d('0xe'),auth[_0x995d('0xa')](),controller['getConfigurations']);router[_0x995d('0x9')](_0x995d('0xf'),auth[_0x995d('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x995d('0x10')](_0x995d('0xe'),auth[_0x995d('0xa')](),controller[_0x995d('0x11')]);router[_0x995d('0x12')]('/:id',auth[_0x995d('0xa')](),controller[_0x995d('0x13')]);router[_0x995d('0x14')](_0x995d('0xc'),auth['isAuthenticated'](),controller[_0x995d('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb73c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer'];(function(_0x2d9aa7,_0x366461){var _0x33e153=function(_0x2cdac6){while(--_0x2cdac6){_0x2d9aa7['push'](_0x2d9aa7['shift']());}};_0x33e153(++_0x366461);}(_0xb73c,0x1cd));var _0xcb73=function(_0xadf2fe,_0x36b03a){_0xadf2fe=_0xadf2fe-0x0;var _0x5754cf=_0xb73c[_0xadf2fe];return _0x5754cf;};'use strict';var multer=require(_0xcb73('0x0'));var util=require('util');var path=require(_0xcb73('0x1'));var timeout=require(_0xcb73('0x2'));var express=require(_0xcb73('0x3'));var router=express[_0xcb73('0x4')]();var fs_extra=require(_0xcb73('0x5'));var auth=require(_0xcb73('0x6'));var interaction=require(_0xcb73('0x7'));var config=require('../../config/environment');var controller=require(_0xcb73('0x8'));router[_0xcb73('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcb73('0xa'),auth[_0xcb73('0xb')](),controller[_0xcb73('0xc')]);router[_0xcb73('0x9')](_0xcb73('0xd'),auth[_0xcb73('0xb')](),controller['getConfigurations']);router[_0xcb73('0x9')]('/:id/fields',auth[_0xcb73('0xb')](),controller[_0xcb73('0xe')]);router[_0xcb73('0xf')]('/',auth[_0xcb73('0xb')](),controller[_0xcb73('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xcb73('0x11')]);router[_0xcb73('0x12')]('/:id',auth[_0xcb73('0xb')](),controller[_0xcb73('0x13')]);router[_0xcb73('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xcb73('0x15')]);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 4e82ef8..f28a272 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 _0xe658=['HelpDesk','sequelize','exports','STRING'];(function(_0x237786,_0x293124){var _0x184527=function(_0x541c9c){while(--_0x541c9c){_0x237786['push'](_0x237786['shift']());}};_0x184527(++_0x293124);}(_0xe658,0x115));var _0x8e65=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe658[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x8e65('0x0'));module[_0x8e65('0x1')]={'name':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8e65('0x2')]},'username':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8e65('0x3')},'remoteUri':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8e65('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x44c3=['STRING','HelpDesk','sequelize'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x44c3,0x134));var _0x344c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x44c3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x344c('0x0'));module['exports']={'name':{'type':Sequelize[_0x344c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x344c('0x1')]},'username':{'type':Sequelize[_0x344c('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x344c('0x1')],'allowNull':![],'defaultValue':_0x344c('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x344c('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1dbddaa..2ab75ab 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 _0x0183=['end','json','offset','count','limit','status','set','reject','save','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','VtigerConfiguration','sort','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','describe','result','sessionName','autogenerated','remove','includes','editable','false','cf_','picklist','picklistValues','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x0183,0xd4));var _0x3018=function(_0xc299f4,_0x23a17b){_0xc299f4=_0xc299f4-0x0;var _0x170d26=_0x0183[_0xc299f4];return _0x170d26;};'use strict';var emlformat=require(_0x3018('0x0'));var rimraf=require(_0x3018('0x1'));var zipdir=require(_0x3018('0x2'));var jsonpatch=require(_0x3018('0x3'));var rp=require(_0x3018('0x4'));var moment=require(_0x3018('0x5'));var BPromise=require(_0x3018('0x6'));var Mustache=require('mustache');var util=require(_0x3018('0x7'));var path=require('path');var sox=require(_0x3018('0x8'));var csv=require(_0x3018('0x9'));var ejs=require(_0x3018('0xa'));var fs=require('fs');var fs_extra=require(_0x3018('0xb'));var _=require(_0x3018('0xc'));var squel=require(_0x3018('0xd'));var crypto=require('crypto');var jsforce=require(_0x3018('0xe'));var deskjs=require(_0x3018('0xf'));var toCsv=require(_0x3018('0x9'));var querystring=require(_0x3018('0x10'));var Papa=require('papaparse');var Redis=require(_0x3018('0x11'));var authService=require(_0x3018('0x12'));var qs=require(_0x3018('0x13'));var as=require(_0x3018('0x14'));var hardwareService=require(_0x3018('0x15'));var logger=require(_0x3018('0x16'))(_0x3018('0x17'));var utils=require(_0x3018('0x18'));var config=require(_0x3018('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3018('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xeebe82,_0x32c95f){_0x32c95f=_0x32c95f||0xcc;return function(_0x320ae4){if(_0x320ae4){return _0xeebe82[_0x3018('0x1b')](_0x32c95f);}return _0xeebe82['status'](_0x32c95f)[_0x3018('0x1c')]();};}function respondWithResult(_0x974826,_0x2eff46){_0x2eff46=_0x2eff46||0xc8;return function(_0x5f0f5a){if(_0x5f0f5a){return _0x974826['status'](_0x2eff46)[_0x3018('0x1d')](_0x5f0f5a);}};}function respondWithFilteredResult(_0x4687ae,_0x4d8e12){return function(_0x4fdf06){if(_0x4fdf06){var _0x2605ef=typeof _0x4d8e12[_0x3018('0x1e')]==='undefined'&&typeof _0x4d8e12['limit']==='undefined';var _0x142273=_0x4fdf06[_0x3018('0x1f')];var _0x24ee6e=_0x2605ef?0x0:_0x4d8e12[_0x3018('0x1e')];var _0x48ef4f=_0x2605ef?_0x4fdf06[_0x3018('0x1f')]:_0x4d8e12['offset']+_0x4d8e12[_0x3018('0x20')];var _0x4e0640;if(_0x48ef4f>=_0x142273){_0x48ef4f=_0x142273;_0x4e0640=0xc8;}else{_0x4e0640=0xce;}_0x4687ae[_0x3018('0x21')](_0x4e0640);return _0x4687ae[_0x3018('0x22')]('Content-Range',_0x24ee6e+'-'+_0x48ef4f+'/'+_0x142273)['json'](_0x4fdf06);}return null;};}function patchUpdates(_0x11b40d){return function(_0x749037){try{jsonpatch['apply'](_0x749037,_0x11b40d,!![]);}catch(_0x138cc2){return BPromise[_0x3018('0x23')](_0x138cc2);}return _0x749037[_0x3018('0x24')]();};}function saveUpdates(_0x387ab1,_0x441e3b){return function(_0x438deb){if(_0x438deb){return _0x438deb[_0x3018('0x25')](_0x387ab1)[_0x3018('0x26')](function(_0x4cbc49){return _0x4cbc49;});}return null;};}function removeEntity(_0x32e2ea,_0x5a1db6){return function(_0xef7049){if(_0xef7049){return _0xef7049['destroy']()['then'](function(){_0x32e2ea[_0x3018('0x21')](0xcc)[_0x3018('0x1c')]();});}};}function handleEntityNotFound(_0x3fd28c,_0x9e346d){return function(_0x2dfdf8){if(!_0x2dfdf8){_0x3fd28c[_0x3018('0x1b')](0x194);}return _0x2dfdf8;};}function handleError(_0x21b9bb,_0x54e5d1){_0x54e5d1=_0x54e5d1||0x1f4;return function(_0x48cb91){logger[_0x3018('0x27')](_0x48cb91[_0x3018('0x28')]);if(_0x48cb91[_0x3018('0x29')]){delete _0x48cb91[_0x3018('0x29')];}_0x21b9bb[_0x3018('0x21')](_0x54e5d1)[_0x3018('0x2a')](_0x48cb91);};}exports[_0x3018('0x2b')]=function(_0x15bb5b,_0xee84a6){var _0x2e11de={},_0x433858={},_0x15d784={'count':0x0,'rows':[]};var _0x5357c9=_[_0x3018('0x2c')](db[_0x3018('0x2d')][_0x3018('0x2e')],function(_0x2176be){return{'name':_0x2176be['fieldName'],'type':_0x2176be[_0x3018('0x2f')]['key']};});_0x433858[_0x3018('0x30')]=_[_0x3018('0x2c')](_0x5357c9,_0x3018('0x29'));_0x433858[_0x3018('0x31')]=_[_0x3018('0x32')](_0x15bb5b[_0x3018('0x31')]);_0x433858['filters']=_[_0x3018('0x33')](_0x433858['model'],_0x433858[_0x3018('0x31')]);_0x2e11de[_0x3018('0x34')]=_['intersection'](_0x433858[_0x3018('0x30')],qs[_0x3018('0x35')](_0x15bb5b[_0x3018('0x31')][_0x3018('0x35')]));_0x2e11de[_0x3018('0x34')]=_0x2e11de[_0x3018('0x34')][_0x3018('0x36')]?_0x2e11de[_0x3018('0x34')]:_0x433858[_0x3018('0x30')];if(!_0x15bb5b[_0x3018('0x31')][_0x3018('0x37')](_0x3018('0x38'))){_0x2e11de['limit']=qs[_0x3018('0x20')](_0x15bb5b[_0x3018('0x31')][_0x3018('0x20')]);_0x2e11de['offset']=qs[_0x3018('0x1e')](_0x15bb5b['query'][_0x3018('0x1e')]);}_0x2e11de[_0x3018('0x39')]=qs['sort'](_0x15bb5b[_0x3018('0x31')]['sort']);_0x2e11de[_0x3018('0x3a')]=qs[_0x3018('0x3b')](_['pick'](_0x15bb5b[_0x3018('0x31')],_0x433858[_0x3018('0x3b')]),_0x5357c9);if(_0x15bb5b[_0x3018('0x31')][_0x3018('0x3c')]){_0x2e11de[_0x3018('0x3a')]=_['merge'](_0x2e11de[_0x3018('0x3a')],{'$or':_[_0x3018('0x2c')](_0x5357c9,function(_0x50b800){if(_0x50b800[_0x3018('0x2f')]!==_0x3018('0x3d')){var _0x2025c4={};_0x2025c4[_0x50b800[_0x3018('0x29')]]={'$like':'%'+_0x15bb5b[_0x3018('0x31')][_0x3018('0x3c')]+'%'};return _0x2025c4;}})});}_0x2e11de=_[_0x3018('0x3e')]({},_0x2e11de,_0x15bb5b['options']);var _0x208512={'where':_0x2e11de['where']};return db[_0x3018('0x2d')][_0x3018('0x1f')](_0x208512)['then'](function(_0x15d7ac){_0x15d784[_0x3018('0x1f')]=_0x15d7ac;if(_0x15bb5b[_0x3018('0x31')][_0x3018('0x3f')]){_0x2e11de[_0x3018('0x40')]=[{'all':!![]}];}return db[_0x3018('0x2d')][_0x3018('0x41')](_0x2e11de);})[_0x3018('0x26')](function(_0x4698e8){_0x15d784[_0x3018('0x42')]=_0x4698e8;return _0x15d784;})['then'](respondWithFilteredResult(_0xee84a6,_0x2e11de))[_0x3018('0x43')](handleError(_0xee84a6,null));};exports[_0x3018('0x44')]=function(_0x5f62d4,_0x17941c){var _0xb7a833={'raw':![],'where':{'id':_0x5f62d4[_0x3018('0x45')]['id']}},_0x40ba18={};_0x40ba18[_0x3018('0x30')]=_['keys'](db[_0x3018('0x2d')][_0x3018('0x2e')]);_0x40ba18[_0x3018('0x31')]=_['keys'](_0x5f62d4['query']);_0x40ba18[_0x3018('0x3b')]=_[_0x3018('0x33')](_0x40ba18[_0x3018('0x30')],_0x40ba18[_0x3018('0x31')]);_0xb7a833[_0x3018('0x34')]=_['intersection'](_0x40ba18['model'],qs['fields'](_0x5f62d4['query'][_0x3018('0x35')]));_0xb7a833[_0x3018('0x34')]=_0xb7a833['attributes'][_0x3018('0x36')]?_0xb7a833[_0x3018('0x34')]:_0x40ba18[_0x3018('0x30')];if(_0x5f62d4[_0x3018('0x31')][_0x3018('0x3f')]){_0xb7a833[_0x3018('0x40')]=[{'all':!![]}];}_0xb7a833=_[_0x3018('0x3e')]({},_0xb7a833,_0x5f62d4[_0x3018('0x46')]);return db[_0x3018('0x2d')][_0x3018('0x47')](_0xb7a833)[_0x3018('0x26')](handleEntityNotFound(_0x17941c,null))[_0x3018('0x26')](respondWithResult(_0x17941c,null))[_0x3018('0x43')](handleError(_0x17941c,null));};exports[_0x3018('0x48')]=function(_0x5a9449,_0x22bc1d){return db['VtigerAccount'][_0x3018('0x48')](_0x5a9449[_0x3018('0x49')],{})['then'](respondWithResult(_0x22bc1d,0xc9))[_0x3018('0x43')](handleError(_0x22bc1d,null));};exports[_0x3018('0x25')]=function(_0x9ba72a,_0x3300e4){if(_0x9ba72a[_0x3018('0x49')]['id']){delete _0x9ba72a[_0x3018('0x49')]['id'];}return db[_0x3018('0x2d')][_0x3018('0x47')]({'where':{'id':_0x9ba72a[_0x3018('0x45')]['id']}})[_0x3018('0x26')](handleEntityNotFound(_0x3300e4,null))[_0x3018('0x26')](saveUpdates(_0x9ba72a['body'],null))[_0x3018('0x26')](respondWithResult(_0x3300e4,null))[_0x3018('0x43')](handleError(_0x3300e4,null));};exports[_0x3018('0x4a')]=function(_0x8a843e,_0x468307){return db['VtigerAccount'][_0x3018('0x47')]({'where':{'id':_0x8a843e[_0x3018('0x45')]['id']}})['then'](handleEntityNotFound(_0x468307,null))[_0x3018('0x26')](removeEntity(_0x468307,null))[_0x3018('0x43')](handleError(_0x468307,null));};exports[_0x3018('0x4b')]=function(_0x23afd4,_0x127808,_0x1f032f){var _0x41ee60={};var _0x3b89c1={};var _0x749dee;var _0x5933aa;return db['VtigerAccount']['findOne']({'where':{'id':_0x23afd4['params']['id']}})[_0x3018('0x26')](handleEntityNotFound(_0x127808,null))[_0x3018('0x26')](function(_0xf43292){if(_0xf43292){_0x749dee=_0xf43292;_0x3b89c1[_0x3018('0x30')]=_[_0x3018('0x32')](db[_0x3018('0x4c')][_0x3018('0x2e')]);_0x3b89c1[_0x3018('0x31')]=_['keys'](_0x23afd4[_0x3018('0x31')]);_0x3b89c1[_0x3018('0x3b')]=_[_0x3018('0x33')](_0x3b89c1[_0x3018('0x30')],_0x3b89c1[_0x3018('0x31')]);_0x41ee60[_0x3018('0x34')]=_['intersection'](_0x3b89c1[_0x3018('0x30')],qs['fields'](_0x23afd4[_0x3018('0x31')][_0x3018('0x35')]));_0x41ee60['attributes']=_0x41ee60['attributes'][_0x3018('0x36')]?_0x41ee60[_0x3018('0x34')]:_0x3b89c1[_0x3018('0x30')];_0x41ee60['order']=qs['sort'](_0x23afd4[_0x3018('0x31')][_0x3018('0x4d')]);_0x41ee60[_0x3018('0x3a')]=qs['filters'](_[_0x3018('0x4e')](_0x23afd4[_0x3018('0x31')],_0x3b89c1['filters']));if(_0x23afd4[_0x3018('0x31')][_0x3018('0x3c')]){_0x41ee60[_0x3018('0x3a')]=_['merge'](_0x41ee60[_0x3018('0x3a')],{'$or':_[_0x3018('0x2c')](_0x41ee60[_0x3018('0x34')],function(_0x27da91){var _0x19a16a={};_0x19a16a[_0x27da91]={'$like':'%'+_0x23afd4[_0x3018('0x31')][_0x3018('0x3c')]+'%'};return _0x19a16a;})});}_0x41ee60=_[_0x3018('0x3e')]({},_0x41ee60,_0x23afd4[_0x3018('0x46')]);return _0x749dee['getConfigurations'](_0x41ee60);}})['then'](function(_0x159568){if(_0x159568){_0x5933aa=_0x159568[_0x3018('0x36')];if(!_0x23afd4[_0x3018('0x31')][_0x3018('0x37')](_0x3018('0x38'))){_0x41ee60[_0x3018('0x20')]=qs[_0x3018('0x20')](_0x23afd4[_0x3018('0x31')][_0x3018('0x20')]);_0x41ee60['offset']=qs[_0x3018('0x1e')](_0x23afd4[_0x3018('0x31')][_0x3018('0x1e')]);}return _0x749dee['getConfigurations'](_0x41ee60);}})[_0x3018('0x26')](function(_0x203509){if(_0x203509){return _0x203509?{'count':_0x5933aa,'rows':_0x203509}:null;}})[_0x3018('0x26')](respondWithResult(_0x127808,null))[_0x3018('0x43')](handleError(_0x127808,null));};exports[_0x3018('0x4f')]=function(_0x361481,_0x45f51d,_0x365534){if(_0x361481[_0x3018('0x49')]['id']){delete _0x361481[_0x3018('0x49')]['id'];}return db[_0x3018('0x2d')][_0x3018('0x50')]({'where':{'id':_0x361481[_0x3018('0x45')]['id']}})['then'](handleEntityNotFound(_0x45f51d,null))[_0x3018('0x26')](function(_0x5560d5){if(_0x5560d5){_0x361481[_0x3018('0x49')][_0x3018('0x51')]=_0x5560d5['id'];_0x361481[_0x3018('0x49')][_0x3018('0x52')]=integrations[_0x3018('0x53')](_0x361481[_0x3018('0x49')]['channel'],_0x361481['body']['type']);_0x361481['body'][_0x3018('0x54')]=integrations[_0x3018('0x55')](_0x361481['body']['channel'],_0x361481[_0x3018('0x49')][_0x3018('0x2f')]);return db['VtigerConfiguration']['create'](_0x361481['body'],{'include':[{'model':db[_0x3018('0x56')],'as':_0x3018('0x52')},{'model':db[_0x3018('0x56')],'as':_0x3018('0x54')}]});}return null;})[_0x3018('0x26')](respondWithResult(_0x45f51d,null))['catch'](handleError(_0x45f51d,null));};var md5=require(_0x3018('0x57'));exports[_0x3018('0x58')]=function(_0x404632,_0x18d6a5,_0x231af9){var _0x541029=null;var _0x2f6060=null;var _0x3ec054=null;var _0x4aa324=null;var _0x54a376='';return db[_0x3018('0x2d')][_0x3018('0x50')]({'where':{'id':_0x404632[_0x3018('0x45')]['id']},'attributes':['id',_0x3018('0x29'),_0x3018('0x59'),_0x3018('0x5a'),_0x3018('0x5b'),_0x3018('0x5c'),_0x3018('0x5d'),_0x3018('0x5e')]})[_0x3018('0x26')](handleEntityNotFound(_0x18d6a5,null))[_0x3018('0x26')](function(_0x3ee05f){if(_0x3ee05f){_0x541029=_0x3ee05f[_0x3018('0x59')];_0x2f6060=_0x3ee05f['accessKey'];_0x3ec054=_0x3ee05f[_0x3018('0x5b')];_0x54a376=_0x3ee05f[_0x3018('0x5c')];var _0x412d43=_0x54a376[_0x3018('0x5f')](-0x1);if(_0x412d43==='/'){_0x54a376=_0x54a376[_0x3018('0x60')](0x0,_0x54a376['lastIndexOf'](_0x412d43));}_0x4aa324=util[_0x3018('0x61')](_0x3018('0x62'),_0x54a376);var _0x2268ca={'method':_0x3018('0x63'),'uri':_0x4aa324,'qs':{'operation':_0x3018('0x64'),'username':_0x3ee05f[_0x3018('0x59')]},'json':!![]};return rp(_0x2268ca);}})[_0x3018('0x26')](function(_0x214017){if(_0x214017[_0x3018('0x65')]){var _0x267ab3={'method':_0x3018('0x66'),'uri':_0x4aa324,'form':{'operation':_0x3018('0x67'),'username':_0x541029,'accessKey':md5(_0x214017['result']['token']+_0x2f6060)},'json':!![]};return rp(_0x267ab3);}})[_0x3018('0x26')](function(_0x1e47e8){if(_0x1e47e8['success']){var _0x33dacb={'method':_0x3018('0x63'),'uri':_0x4aa324,'qs':{'operation':_0x3018('0x68'),'username':_0x541029,'sessionName':_0x1e47e8[_0x3018('0x69')][_0x3018('0x6a')],'elementType':_0x3ec054},'json':!![]};return rp(_0x33dacb);}})['then'](function(_0xbdd4b5){if(_0xbdd4b5[_0x3018('0x65')]){var _0x41cd38=[_0x3018('0x6b'),'reference','owner'];_[_0x3018('0x6c')](_0xbdd4b5[_0x3018('0x69')][_0x3018('0x35')],function(_0x136ba0){return _0x41cd38[_0x3018('0x6d')](_0x136ba0[_0x3018('0x2f')][_0x3018('0x29')]);});_[_0x3018('0x6c')](_0xbdd4b5[_0x3018('0x69')]['fields'],function(_0xd90732){return _0xd90732[_0x3018('0x6e')]===_0x3018('0x6f');});return{'count':_0xbdd4b5['result'][_0x3018('0x35')][_0x3018('0x36')],'rows':_['map'](_0xbdd4b5[_0x3018('0x69')]['fields'],function(_0x4d4aee){return{'id':_0x4d4aee[_0x3018('0x29')],'name':_0x4d4aee['label'],'custom':_['startsWith'](_0x4d4aee[_0x3018('0x29')],_0x3018('0x70'))?!![]:![],'options':_0x4d4aee[_0x3018('0x2f')][_0x3018('0x29')]===_0x3018('0x71')&&_0x4d4aee['type'][_0x3018('0x72')][_0x3018('0x36')]>0x0?_[_0x3018('0x2c')](_0x4d4aee[_0x3018('0x2f')][_0x3018('0x72')],function(_0x2482f1){return{'name':_0x2482f1[_0x3018('0x73')],'value':_0x2482f1[_0x3018('0x74')]};}):[]};})};}})['then'](respondWithResult(_0x18d6a5,null))[_0x3018('0x43')](function(_0x1e152a){console['log']('vTiger\x20error:\x20'+_0x1e152a);var _0xaf80b0=_0x404632[_0x3018('0x31')][_0x3018('0x75')]?0x1f4:_0x1e152a[_0x3018('0x76')]||0x1f4;logger['error'](_0x3018('0x77'),'getFields',_0xaf80b0,JSON['stringify'](_0x1e152a));delete _0x1e152a[_0x3018('0x29')];if(_0xaf80b0===0x191){_0xaf80b0=0x190;}_0x18d6a5['status'](_0xaf80b0)[_0x3018('0x2a')](_0x404632[_0x3018('0x31')][_0x3018('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x1e152a[_0x3018('0x76')]}:_0x1e152a);});}; \ No newline at end of file +var _0x5099=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','VtigerAccount','includeAll','catch','show','params','include','create','body','update','find','getConfigurations','findOne','VtigerConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','describe','autogenerated','reference','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x139f40,_0x37040e){var _0x5c3a9e=function(_0x44a1b6){while(--_0x44a1b6){_0x139f40['push'](_0x139f40['shift']());}};_0x5c3a9e(++_0x37040e);}(_0x5099,0x154));var _0x9509=function(_0xf845cc,_0x7bce78){_0xf845cc=_0xf845cc-0x0;var _0x24da94=_0x5099[_0xf845cc];return _0x24da94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9509('0x0'));var zipdir=require(_0x9509('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9509('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9509('0x3'));var util=require(_0x9509('0x4'));var path=require(_0x9509('0x5'));var sox=require(_0x9509('0x6'));var csv=require(_0x9509('0x7'));var ejs=require(_0x9509('0x8'));var fs=require('fs');var fs_extra=require(_0x9509('0x9'));var _=require(_0x9509('0xa'));var squel=require(_0x9509('0xb'));var crypto=require('crypto');var jsforce=require(_0x9509('0xc'));var deskjs=require(_0x9509('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9509('0xe'));var Papa=require(_0x9509('0xf'));var Redis=require(_0x9509('0x10'));var authService=require(_0x9509('0x11'));var qs=require(_0x9509('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9509('0x13'));var logger=require(_0x9509('0x14'))(_0x9509('0x15'));var utils=require(_0x9509('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9509('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x997bbc,_0xa0cacb){_0xa0cacb=_0xa0cacb||0xcc;return function(_0x332a22){if(_0x332a22){return _0x997bbc[_0x9509('0x18')](_0xa0cacb);}return _0x997bbc[_0x9509('0x19')](_0xa0cacb)[_0x9509('0x1a')]();};}function respondWithResult(_0x5831c9,_0x223e97){_0x223e97=_0x223e97||0xc8;return function(_0x2c0afc){if(_0x2c0afc){return _0x5831c9['status'](_0x223e97)[_0x9509('0x1b')](_0x2c0afc);}};}function respondWithFilteredResult(_0x2cd218,_0x45017a){return function(_0x107b63){if(_0x107b63){var _0x11785c=typeof _0x45017a[_0x9509('0x1c')]===_0x9509('0x1d')&&typeof _0x45017a[_0x9509('0x1e')]===_0x9509('0x1d');var _0x4b0d54=_0x107b63[_0x9509('0x1f')];var _0x133017=_0x11785c?0x0:_0x45017a[_0x9509('0x1c')];var _0x1bfb7c=_0x11785c?_0x107b63['count']:_0x45017a[_0x9509('0x1c')]+_0x45017a[_0x9509('0x1e')];var _0x4f0ab0;if(_0x1bfb7c>=_0x4b0d54){_0x1bfb7c=_0x4b0d54;_0x4f0ab0=0xc8;}else{_0x4f0ab0=0xce;}_0x2cd218[_0x9509('0x19')](_0x4f0ab0);return _0x2cd218[_0x9509('0x20')]('Content-Range',_0x133017+'-'+_0x1bfb7c+'/'+_0x4b0d54)['json'](_0x107b63);}return null;};}function patchUpdates(_0x367a29){return function(_0x3a7757){try{jsonpatch[_0x9509('0x21')](_0x3a7757,_0x367a29,!![]);}catch(_0x44d868){return BPromise[_0x9509('0x22')](_0x44d868);}return _0x3a7757[_0x9509('0x23')]();};}function saveUpdates(_0x4bd4ef,_0x1fe5aa){return function(_0x4cbb9d){if(_0x4cbb9d){return _0x4cbb9d['update'](_0x4bd4ef)[_0x9509('0x24')](function(_0x3254db){return _0x3254db;});}return null;};}function removeEntity(_0x4f46c6,_0x3dd39c){return function(_0x22f3f6){if(_0x22f3f6){return _0x22f3f6[_0x9509('0x25')]()['then'](function(){_0x4f46c6[_0x9509('0x19')](0xcc)[_0x9509('0x1a')]();});}};}function handleEntityNotFound(_0x718c24,_0xccbcd7){return function(_0x38b343){if(!_0x38b343){_0x718c24['sendStatus'](0x194);}return _0x38b343;};}function handleError(_0x32f11d,_0x1bec9c){_0x1bec9c=_0x1bec9c||0x1f4;return function(_0x36d0bf){logger['error'](_0x36d0bf['stack']);if(_0x36d0bf[_0x9509('0x26')]){delete _0x36d0bf[_0x9509('0x26')];}_0x32f11d[_0x9509('0x19')](_0x1bec9c)[_0x9509('0x27')](_0x36d0bf);};}exports[_0x9509('0x28')]=function(_0x3137e1,_0x7a74b5){var _0x10e902={},_0x4696c1={},_0x4ae1b4={'count':0x0,'rows':[]};var _0x4a5f88=_['map'](db['VtigerAccount'][_0x9509('0x29')],function(_0x1686b3){return{'name':_0x1686b3[_0x9509('0x2a')],'type':_0x1686b3['type'][_0x9509('0x2b')]};});_0x4696c1[_0x9509('0x2c')]=_[_0x9509('0x2d')](_0x4a5f88,_0x9509('0x26'));_0x4696c1['query']=_[_0x9509('0x2e')](_0x3137e1[_0x9509('0x2f')]);_0x4696c1['filters']=_[_0x9509('0x30')](_0x4696c1[_0x9509('0x2c')],_0x4696c1[_0x9509('0x2f')]);_0x10e902[_0x9509('0x31')]=_[_0x9509('0x30')](_0x4696c1['model'],qs['fields'](_0x3137e1['query'][_0x9509('0x32')]));_0x10e902[_0x9509('0x31')]=_0x10e902[_0x9509('0x31')][_0x9509('0x33')]?_0x10e902['attributes']:_0x4696c1[_0x9509('0x2c')];if(!_0x3137e1[_0x9509('0x2f')][_0x9509('0x34')]('nolimit')){_0x10e902[_0x9509('0x1e')]=qs[_0x9509('0x1e')](_0x3137e1['query'][_0x9509('0x1e')]);_0x10e902[_0x9509('0x1c')]=qs[_0x9509('0x1c')](_0x3137e1['query'][_0x9509('0x1c')]);}_0x10e902[_0x9509('0x35')]=qs[_0x9509('0x36')](_0x3137e1['query'][_0x9509('0x36')]);_0x10e902[_0x9509('0x37')]=qs['filters'](_[_0x9509('0x38')](_0x3137e1[_0x9509('0x2f')],_0x4696c1[_0x9509('0x39')]),_0x4a5f88);if(_0x3137e1[_0x9509('0x2f')][_0x9509('0x3a')]){_0x10e902[_0x9509('0x37')]=_[_0x9509('0x3b')](_0x10e902['where'],{'$or':_['map'](_0x4a5f88,function(_0x5af9c0){if(_0x5af9c0[_0x9509('0x3c')]!==_0x9509('0x3d')){var _0x50cd08={};_0x50cd08[_0x5af9c0[_0x9509('0x26')]]={'$like':'%'+_0x3137e1[_0x9509('0x2f')][_0x9509('0x3a')]+'%'};return _0x50cd08;}})});}_0x10e902=_[_0x9509('0x3b')]({},_0x10e902,_0x3137e1[_0x9509('0x3e')]);var _0x330d8a={'where':_0x10e902['where']};return db[_0x9509('0x3f')][_0x9509('0x1f')](_0x330d8a)[_0x9509('0x24')](function(_0x131039){_0x4ae1b4[_0x9509('0x1f')]=_0x131039;if(_0x3137e1[_0x9509('0x2f')][_0x9509('0x40')]){_0x10e902['include']=[{'all':!![]}];}return db[_0x9509('0x3f')]['findAll'](_0x10e902);})[_0x9509('0x24')](function(_0x239e5e){_0x4ae1b4['rows']=_0x239e5e;return _0x4ae1b4;})[_0x9509('0x24')](respondWithFilteredResult(_0x7a74b5,_0x10e902))[_0x9509('0x41')](handleError(_0x7a74b5,null));};exports[_0x9509('0x42')]=function(_0x3dc4bf,_0x233fa9){var _0x290d2c={'raw':![],'where':{'id':_0x3dc4bf[_0x9509('0x43')]['id']}},_0x9d31bc={};_0x9d31bc[_0x9509('0x2c')]=_[_0x9509('0x2e')](db[_0x9509('0x3f')]['rawAttributes']);_0x9d31bc[_0x9509('0x2f')]=_[_0x9509('0x2e')](_0x3dc4bf[_0x9509('0x2f')]);_0x9d31bc[_0x9509('0x39')]=_[_0x9509('0x30')](_0x9d31bc['model'],_0x9d31bc[_0x9509('0x2f')]);_0x290d2c[_0x9509('0x31')]=_[_0x9509('0x30')](_0x9d31bc[_0x9509('0x2c')],qs[_0x9509('0x32')](_0x3dc4bf[_0x9509('0x2f')][_0x9509('0x32')]));_0x290d2c[_0x9509('0x31')]=_0x290d2c[_0x9509('0x31')][_0x9509('0x33')]?_0x290d2c[_0x9509('0x31')]:_0x9d31bc[_0x9509('0x2c')];if(_0x3dc4bf[_0x9509('0x2f')]['includeAll']){_0x290d2c[_0x9509('0x44')]=[{'all':!![]}];}_0x290d2c=_[_0x9509('0x3b')]({},_0x290d2c,_0x3dc4bf[_0x9509('0x3e')]);return db[_0x9509('0x3f')]['find'](_0x290d2c)[_0x9509('0x24')](handleEntityNotFound(_0x233fa9,null))[_0x9509('0x24')](respondWithResult(_0x233fa9,null))['catch'](handleError(_0x233fa9,null));};exports[_0x9509('0x45')]=function(_0x5af292,_0x5dacc7){return db['VtigerAccount'][_0x9509('0x45')](_0x5af292[_0x9509('0x46')],{})[_0x9509('0x24')](respondWithResult(_0x5dacc7,0xc9))[_0x9509('0x41')](handleError(_0x5dacc7,null));};exports[_0x9509('0x47')]=function(_0x15a6d7,_0x526162){if(_0x15a6d7[_0x9509('0x46')]['id']){delete _0x15a6d7[_0x9509('0x46')]['id'];}return db['VtigerAccount'][_0x9509('0x48')]({'where':{'id':_0x15a6d7[_0x9509('0x43')]['id']}})['then'](handleEntityNotFound(_0x526162,null))[_0x9509('0x24')](saveUpdates(_0x15a6d7[_0x9509('0x46')],null))[_0x9509('0x24')](respondWithResult(_0x526162,null))[_0x9509('0x41')](handleError(_0x526162,null));};exports['destroy']=function(_0x2379bc,_0x5b6c95){return db[_0x9509('0x3f')][_0x9509('0x48')]({'where':{'id':_0x2379bc[_0x9509('0x43')]['id']}})['then'](handleEntityNotFound(_0x5b6c95,null))[_0x9509('0x24')](removeEntity(_0x5b6c95,null))[_0x9509('0x41')](handleError(_0x5b6c95,null));};exports[_0x9509('0x49')]=function(_0x1784ef,_0x4c3d86,_0x39039d){var _0x2df9bb={};var _0x223cea={};var _0x23af59;var _0x3ee825;return db[_0x9509('0x3f')][_0x9509('0x4a')]({'where':{'id':_0x1784ef[_0x9509('0x43')]['id']}})[_0x9509('0x24')](handleEntityNotFound(_0x4c3d86,null))[_0x9509('0x24')](function(_0x3cb99a){if(_0x3cb99a){_0x23af59=_0x3cb99a;_0x223cea[_0x9509('0x2c')]=_[_0x9509('0x2e')](db[_0x9509('0x4b')][_0x9509('0x29')]);_0x223cea[_0x9509('0x2f')]=_[_0x9509('0x2e')](_0x1784ef[_0x9509('0x2f')]);_0x223cea[_0x9509('0x39')]=_[_0x9509('0x30')](_0x223cea[_0x9509('0x2c')],_0x223cea[_0x9509('0x2f')]);_0x2df9bb['attributes']=_[_0x9509('0x30')](_0x223cea[_0x9509('0x2c')],qs['fields'](_0x1784ef[_0x9509('0x2f')][_0x9509('0x32')]));_0x2df9bb[_0x9509('0x31')]=_0x2df9bb[_0x9509('0x31')][_0x9509('0x33')]?_0x2df9bb[_0x9509('0x31')]:_0x223cea[_0x9509('0x2c')];_0x2df9bb[_0x9509('0x35')]=qs[_0x9509('0x36')](_0x1784ef[_0x9509('0x2f')][_0x9509('0x36')]);_0x2df9bb[_0x9509('0x37')]=qs['filters'](_[_0x9509('0x38')](_0x1784ef[_0x9509('0x2f')],_0x223cea[_0x9509('0x39')]));if(_0x1784ef[_0x9509('0x2f')][_0x9509('0x3a')]){_0x2df9bb['where']=_['merge'](_0x2df9bb[_0x9509('0x37')],{'$or':_[_0x9509('0x2d')](_0x2df9bb[_0x9509('0x31')],function(_0x33e014){var _0x695933={};_0x695933[_0x33e014]={'$like':'%'+_0x1784ef[_0x9509('0x2f')][_0x9509('0x3a')]+'%'};return _0x695933;})});}_0x2df9bb=_[_0x9509('0x3b')]({},_0x2df9bb,_0x1784ef[_0x9509('0x3e')]);return _0x23af59[_0x9509('0x49')](_0x2df9bb);}})[_0x9509('0x24')](function(_0xeff1a6){if(_0xeff1a6){_0x3ee825=_0xeff1a6[_0x9509('0x33')];if(!_0x1784ef[_0x9509('0x2f')][_0x9509('0x34')](_0x9509('0x4c'))){_0x2df9bb[_0x9509('0x1e')]=qs[_0x9509('0x1e')](_0x1784ef[_0x9509('0x2f')][_0x9509('0x1e')]);_0x2df9bb[_0x9509('0x1c')]=qs[_0x9509('0x1c')](_0x1784ef[_0x9509('0x2f')]['offset']);}return _0x23af59[_0x9509('0x49')](_0x2df9bb);}})[_0x9509('0x24')](function(_0x4647b8){if(_0x4647b8){return _0x4647b8?{'count':_0x3ee825,'rows':_0x4647b8}:null;}})[_0x9509('0x24')](respondWithResult(_0x4c3d86,null))[_0x9509('0x41')](handleError(_0x4c3d86,null));};exports['addConfiguration']=function(_0x23bde4,_0x2c0ad2,_0x1f6a8b){if(_0x23bde4[_0x9509('0x46')]['id']){delete _0x23bde4['body']['id'];}return db[_0x9509('0x3f')][_0x9509('0x4a')]({'where':{'id':_0x23bde4['params']['id']}})[_0x9509('0x24')](handleEntityNotFound(_0x2c0ad2,null))[_0x9509('0x24')](function(_0x53af2d){if(_0x53af2d){_0x23bde4[_0x9509('0x46')][_0x9509('0x4d')]=_0x53af2d['id'];_0x23bde4[_0x9509('0x46')][_0x9509('0x4e')]=integrations[_0x9509('0x4f')](_0x23bde4[_0x9509('0x46')][_0x9509('0x50')],_0x23bde4['body']['type']);_0x23bde4[_0x9509('0x46')][_0x9509('0x51')]=integrations[_0x9509('0x52')](_0x23bde4[_0x9509('0x46')][_0x9509('0x50')],_0x23bde4[_0x9509('0x46')][_0x9509('0x3c')]);return db[_0x9509('0x4b')]['create'](_0x23bde4[_0x9509('0x46')],{'include':[{'model':db[_0x9509('0x53')],'as':_0x9509('0x4e')},{'model':db[_0x9509('0x53')],'as':_0x9509('0x51')}]});}return null;})[_0x9509('0x24')](respondWithResult(_0x2c0ad2,null))['catch'](handleError(_0x2c0ad2,null));};var md5=require('md5');exports[_0x9509('0x54')]=function(_0xd16ae7,_0x30542e,_0x3997d3){var _0x36732d=null;var _0x3c9452=null;var _0x3f61b9=null;var _0x3094b4=null;var _0x58d125='';return db[_0x9509('0x3f')][_0x9509('0x4a')]({'where':{'id':_0xd16ae7['params']['id']},'attributes':['id',_0x9509('0x26'),_0x9509('0x55'),_0x9509('0x56'),_0x9509('0x57'),_0x9509('0x58'),_0x9509('0x59'),_0x9509('0x5a')]})[_0x9509('0x24')](handleEntityNotFound(_0x30542e,null))['then'](function(_0x590210){if(_0x590210){_0x36732d=_0x590210[_0x9509('0x55')];_0x3c9452=_0x590210['accessKey'];_0x3f61b9=_0x590210[_0x9509('0x57')];_0x58d125=_0x590210[_0x9509('0x58')];var _0x2904ba=_0x58d125[_0x9509('0x5b')](-0x1);if(_0x2904ba==='/'){_0x58d125=_0x58d125['substring'](0x0,_0x58d125[_0x9509('0x5c')](_0x2904ba));}_0x3094b4=util[_0x9509('0x5d')](_0x9509('0x5e'),_0x58d125);var _0x25d815={'method':_0x9509('0x5f'),'uri':_0x3094b4,'qs':{'operation':'getchallenge','username':_0x590210[_0x9509('0x55')]},'json':!![]};return rp(_0x25d815);}})[_0x9509('0x24')](function(_0x512d0f){if(_0x512d0f[_0x9509('0x60')]){var _0x526328={'method':_0x9509('0x61'),'uri':_0x3094b4,'form':{'operation':_0x9509('0x62'),'username':_0x36732d,'accessKey':md5(_0x512d0f[_0x9509('0x63')]['token']+_0x3c9452)},'json':!![]};return rp(_0x526328);}})['then'](function(_0x448359){if(_0x448359['success']){var _0x221595={'method':_0x9509('0x5f'),'uri':_0x3094b4,'qs':{'operation':_0x9509('0x64'),'username':_0x36732d,'sessionName':_0x448359['result']['sessionName'],'elementType':_0x3f61b9},'json':!![]};return rp(_0x221595);}})[_0x9509('0x24')](function(_0x325e89){if(_0x325e89[_0x9509('0x60')]){var _0x3498e9=[_0x9509('0x65'),_0x9509('0x66'),'owner'];_[_0x9509('0x67')](_0x325e89[_0x9509('0x63')][_0x9509('0x32')],function(_0x24c9c1){return _0x3498e9[_0x9509('0x68')](_0x24c9c1[_0x9509('0x3c')][_0x9509('0x26')]);});_[_0x9509('0x67')](_0x325e89['result'][_0x9509('0x32')],function(_0x267251){return _0x267251[_0x9509('0x69')]===_0x9509('0x6a');});return{'count':_0x325e89[_0x9509('0x63')]['fields'][_0x9509('0x33')],'rows':_[_0x9509('0x2d')](_0x325e89[_0x9509('0x63')]['fields'],function(_0x1045f2){return{'id':_0x1045f2[_0x9509('0x26')],'name':_0x1045f2[_0x9509('0x6b')],'custom':_[_0x9509('0x6c')](_0x1045f2[_0x9509('0x26')],_0x9509('0x6d'))?!![]:![],'options':_0x1045f2[_0x9509('0x3c')][_0x9509('0x26')]==='picklist'&&_0x1045f2['type'][_0x9509('0x6e')][_0x9509('0x33')]>0x0?_[_0x9509('0x2d')](_0x1045f2[_0x9509('0x3c')][_0x9509('0x6e')],function(_0x4255eb){return{'name':_0x4255eb[_0x9509('0x6b')],'value':_0x4255eb[_0x9509('0x6f')]};}):[]};})};}})[_0x9509('0x24')](respondWithResult(_0x30542e,null))['catch'](function(_0x4dfba1){console[_0x9509('0x70')](_0x9509('0x71')+_0x4dfba1);var _0x5a5753=_0xd16ae7[_0x9509('0x2f')][_0x9509('0x72')]?0x1f4:_0x4dfba1[_0x9509('0x73')]||0x1f4;logger[_0x9509('0x74')](_0x9509('0x75'),'getFields',_0x5a5753,JSON[_0x9509('0x76')](_0x4dfba1));delete _0x4dfba1['name'];if(_0x5a5753===0x191){_0x5a5753=0x190;}_0x30542e[_0x9509('0x19')](_0x5a5753)[_0x9509('0x27')](_0xd16ae7[_0x9509('0x2f')][_0x9509('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x4dfba1[_0x9509('0x73')]}:_0x4dfba1);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index fecac58..802ee02 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 _0x8b6f=['moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x4a03bd,_0x55bed6){var _0x560574=function(_0x1e7a85){while(--_0x1e7a85){_0x4a03bd['push'](_0x4a03bd['shift']());}};_0x560574(++_0x55bed6);}(_0x8b6f,0x13e));var _0xf8b6=function(_0x27fdcc,_0x421cb5){_0x27fdcc=_0x27fdcc-0x0;var _0x17c2de=_0x8b6f[_0x27fdcc];return _0x17c2de;};'use strict';var _=require(_0xf8b6('0x0'));var util=require(_0xf8b6('0x1'));var logger=require(_0xf8b6('0x2'))(_0xf8b6('0x3'));var moment=require(_0xf8b6('0x4'));var BPromise=require(_0xf8b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf8b6('0x7'));var attributes=require(_0xf8b6('0x8'));var integrations=require(_0xf8b6('0x9'));module[_0xf8b6('0xa')]=function(_0x184f42,_0x56c73b){return _0x184f42[_0xf8b6('0xb')](_0xf8b6('0xc'),attributes,{'tableName':_0xf8b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c61=['rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','int_vtiger_accounts','api','moment','request-promise'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x8c61,0x9f));var _0x18c6=function(_0x3c0346,_0x45278e){_0x3c0346=_0x3c0346-0x0;var _0x426afc=_0x8c61[_0x3c0346];return _0x426afc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x18c6('0x0'));var moment=require(_0x18c6('0x1'));var BPromise=require('bluebird');var rp=require(_0x18c6('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18c6('0x3'));var config=require(_0x18c6('0x4'));var attributes=require(_0x18c6('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x18c6('0x6')]=function(_0x2ec26d,_0xb8b561){return _0x2ec26d[_0x18c6('0x7')]('VtigerAccount',attributes,{'tableName':_0x18c6('0x8'),'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 3fef300..43de9e4 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount'];(function(_0x475acf,_0x1e9c7d){var _0x234bc8=function(_0x418c07){while(--_0x418c07){_0x475acf['push'](_0x475acf['shift']());}};_0x234bc8(++_0x1e9c7d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetVtigerAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowVtigerAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0xed3c=['catch','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetVtigerAccount','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xed3c,0x1a6));var _0xced3=function(_0x5159fd,_0x4b760b){_0x5159fd=_0x5159fd-0x0;var _0x409bae=_0xed3c[_0x5159fd];return _0x409bae;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4795cd,_0x510164,_0x5ca701){return new BPromise(function(_0x851bd3,_0x5f2f90){return client['request'](_0x4795cd,_0x5ca701)['then'](function(_0x19a727){logger[_0xced3('0xb')](_0xced3('0xc'),_0x510164,_0xced3('0xd'));logger[_0xced3('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x510164,_0xced3('0xd'),JSON[_0xced3('0xf')](_0x19a727));if(_0x19a727[_0xced3('0x10')]){if(_0x19a727['error'][_0xced3('0x11')]===0x1f4){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);return _0x5f2f90(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}logger['error'](_0xced3('0xc'),_0x510164,_0x19a727['error'][_0xced3('0x12')]);return _0x851bd3(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}else{logger[_0xced3('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x510164,_0xced3('0xd'));_0x851bd3(_0x19a727[_0xced3('0x13')]['message']);}})[_0xced3('0x14')](function(_0x37e2d5){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x37e2d5);_0x5f2f90(_0x37e2d5);});});}exports['GetVtigerAccount']=function(_0x4569af){var _0x4a3afe=this;return new Promise(function(_0x353580,_0x4480a6){return db[_0xced3('0x15')][_0xced3('0x16')]({'raw':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x4569af[_0xced3('0x17')]?_0x4569af['options']['attributes']||null:null,'limit':_0x4569af['options']?_0x4569af[_0xced3('0x17')][_0xced3('0x1a')]||null:null,'include':_0x4569af[_0xced3('0x17')]?_0x4569af['options'][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x4569af['options']['include'],function(_0x3adf14){return{'model':db[_0x3adf14[_0xced3('0x1d')]],'as':_0x3adf14['as'],'attributes':_0x3adf14[_0xced3('0x1e')],'include':_0x3adf14[_0xced3('0x1b')]?_['map'](_0x3adf14[_0xced3('0x1b')],function(_0x23f92b){return{'model':db[_0x23f92b['model']],'as':_0x23f92b['as'],'attributes':_0x23f92b[_0xced3('0x1e')],'include':_0x23f92b['include']?_[_0xced3('0x1c')](_0x23f92b[_0xced3('0x1b')],function(_0x3b728d){return{'model':db[_0x3b728d[_0xced3('0x1d')]],'as':_0x3b728d['as'],'attributes':_0x3b728d[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5454c0){logger[_0xced3('0xb')]('GetVtigerAccount',_0x4569af);logger[_0xced3('0xe')](_0xced3('0x1f'),_0x4569af,JSON['stringify'](_0x5454c0));_0x353580(_0x5454c0);})[_0xced3('0x14')](function(_0x4024fa){logger[_0xced3('0x10')](_0xced3('0x1f'),_0x4024fa[_0xced3('0x12')],_0x4569af);_0x4480a6(_0x4a3afe[_0xced3('0x10')](0x1f4,_0x4024fa[_0xced3('0x12')]));});});};exports[_0xced3('0x20')]=function(_0x116cc7){var _0x559b8e=this;return new Promise(function(_0xa78899,_0x1b8baa){return db[_0xced3('0x15')][_0xced3('0x21')]({'raw':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1e')]||null:null,'include':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')],function(_0xcd0fe3){return{'model':db[_0xcd0fe3[_0xced3('0x1d')]],'as':_0xcd0fe3['as'],'attributes':_0xcd0fe3['attributes'],'include':_0xcd0fe3[_0xced3('0x1b')]?_['map'](_0xcd0fe3[_0xced3('0x1b')],function(_0x28f674){return{'model':db[_0x28f674[_0xced3('0x1d')]],'as':_0x28f674['as'],'attributes':_0x28f674[_0xced3('0x1e')],'include':_0x28f674[_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x28f674[_0xced3('0x1b')],function(_0x340be1){return{'model':db[_0x340be1[_0xced3('0x1d')]],'as':_0x340be1['as'],'attributes':_0x340be1[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x342c11){logger[_0xced3('0xb')]('ShowVtigerAccount',_0x116cc7);logger[_0xced3('0xe')](_0xced3('0x20'),_0x116cc7,JSON[_0xced3('0xf')](_0x342c11));_0xa78899(_0x342c11);})['catch'](function(_0x59c3aa){logger[_0xced3('0x10')]('ShowVtigerAccount',_0x59c3aa[_0xced3('0x12')],_0x116cc7);_0x1b8baa(_0x559b8e[_0xced3('0x10')](0x1f4,_0x59c3aa['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8be357b..e51bd79 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 _0x2fed=['index','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x4712b3,_0x3948b0){var _0x304c94=function(_0x56f0f6){while(--_0x56f0f6){_0x4712b3['push'](_0x4712b3['shift']());}};_0x304c94(++_0x3948b0);}(_0x2fed,0x199));var _0xd2fe=function(_0x270da4,_0x3a4c57){_0x270da4=_0x270da4-0x0;var _0x2d4290=_0x2fed[_0x270da4];return _0x2d4290;};'use strict';var multer=require('multer');var util=require(_0xd2fe('0x0'));var path=require(_0xd2fe('0x1'));var timeout=require(_0xd2fe('0x2'));var express=require(_0xd2fe('0x3'));var router=express[_0xd2fe('0x4')]();var fs_extra=require(_0xd2fe('0x5'));var auth=require(_0xd2fe('0x6'));var interaction=require(_0xd2fe('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x9')]);router[_0xd2fe('0xa')](_0xd2fe('0xb'),auth[_0xd2fe('0x8')](),controller['show']);router[_0xd2fe('0xa')](_0xd2fe('0xc'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0xd')]);router[_0xd2fe('0xa')](_0xd2fe('0xe'),auth['isAuthenticated'](),controller[_0xd2fe('0xf')]);router[_0xd2fe('0xa')](_0xd2fe('0x10'),auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x11')]);router['post']('/',auth[_0xd2fe('0x8')](),controller[_0xd2fe('0x12')]);router[_0xd2fe('0x13')](_0xd2fe('0xb'),auth[_0xd2fe('0x8')](),controller['update']);router['delete'](_0xd2fe('0xb'),auth['isAuthenticated'](),controller[_0xd2fe('0x14')]);module[_0xd2fe('0x15')]=router; \ No newline at end of file +var _0x9479=['../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x23ef4b,_0x8808f6){var _0x55f394=function(_0xba9cfe){while(--_0xba9cfe){_0x23ef4b['push'](_0x23ef4b['shift']());}};_0x55f394(++_0x8808f6);}(_0x9479,0x165));var _0x9947=function(_0x18eee3,_0x2a9d6e){_0x18eee3=_0x18eee3-0x0;var _0xfdbb31=_0x9479[_0x18eee3];return _0xfdbb31;};'use strict';var multer=require(_0x9947('0x0'));var util=require(_0x9947('0x1'));var path=require(_0x9947('0x2'));var timeout=require('connect-timeout');var express=require(_0x9947('0x3'));var router=express[_0x9947('0x4')]();var fs_extra=require(_0x9947('0x5'));var auth=require(_0x9947('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9947('0x7'));var controller=require(_0x9947('0x8'));router['get']('/',auth[_0x9947('0x9')](),controller[_0x9947('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9947('0xb')]);router[_0x9947('0xc')](_0x9947('0xd'),auth[_0x9947('0x9')](),controller[_0x9947('0xe')]);router[_0x9947('0xc')]('/:id/subjects',auth[_0x9947('0x9')](),controller[_0x9947('0xf')]);router[_0x9947('0xc')](_0x9947('0x10'),auth[_0x9947('0x9')](),controller[_0x9947('0x11')]);router[_0x9947('0x12')]('/',auth[_0x9947('0x9')](),controller[_0x9947('0x13')]);router[_0x9947('0x14')](_0x9947('0x15'),auth[_0x9947('0x9')](),controller[_0x9947('0x16')]);router[_0x9947('0x17')]('/:id',auth[_0x9947('0x9')](),controller[_0x9947('0x18')]);module[_0x9947('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index d0af872..49e6ec4 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 _0xb9f1=['exports','STRING','sequelize'];(function(_0x3bb168,_0x28c4fd){var _0x1a0a3c=function(_0x38ebb1){while(--_0x38ebb1){_0x3bb168['push'](_0x3bb168['shift']());}};_0x1a0a3c(++_0x28c4fd);}(_0xb9f1,0x1c1));var _0x1b9f=function(_0x5496d9,_0x589166){_0x5496d9=_0x5496d9-0x0;var _0x111079=_0xb9f1[_0x5496d9];return _0x111079;};'use strict';var Sequelize=require(_0x1b9f('0x0'));module[_0x1b9f('0x1')]={'name':{'type':Sequelize[_0x1b9f('0x2')]},'description':{'type':Sequelize[_0x1b9f('0x2')]}}; \ No newline at end of file +var _0xca3c=['STRING','sequelize'];(function(_0x56e8ed,_0x55fb0e){var _0x32a0ad=function(_0x3c9550){while(--_0x3c9550){_0x56e8ed['push'](_0x56e8ed['shift']());}};_0x32a0ad(++_0x55fb0e);}(_0xca3c,0x7f));var _0xcca3=function(_0x515ef0,_0x428924){_0x515ef0=_0x515ef0-0x0;var _0x23666b=_0xca3c[_0x515ef0];return _0x23666b;};'use strict';var Sequelize=require(_0xcca3('0x0'));module['exports']={'name':{'type':Sequelize[_0xcca3('0x1')]},'description':{'type':Sequelize[_0xcca3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index cd15a14..5919cbb 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 _0x77ed=['fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','VtigerConfiguration','fieldName','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','find','create','body','params','getFields','findOne','keys','nolimit','getSubjects','VtigerField','getDescriptions','eml-format','rimraf'];(function(_0x30b192,_0x4ae829){var _0xfd98bd=function(_0xff8039){while(--_0xff8039){_0x30b192['push'](_0x30b192['shift']());}};_0xfd98bd(++_0x4ae829);}(_0x77ed,0x1ba));var _0xd77e=function(_0x261213,_0x2f3fdb){_0x261213=_0x261213-0x0;var _0x4a3376=_0x77ed[_0x261213];return _0x4a3376;};'use strict';var emlformat=require(_0xd77e('0x0'));var rimraf=require(_0xd77e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd77e('0x2'));var rp=require(_0xd77e('0x3'));var moment=require(_0xd77e('0x4'));var BPromise=require(_0xd77e('0x5'));var Mustache=require(_0xd77e('0x6'));var util=require(_0xd77e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd77e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd77e('0x9'));var deskjs=require(_0xd77e('0xa'));var toCsv=require(_0xd77e('0xb'));var querystring=require(_0xd77e('0xc'));var Papa=require('papaparse');var Redis=require(_0xd77e('0xd'));var authService=require(_0xd77e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd77e('0xf'));var hardwareService=require(_0xd77e('0x10'));var logger=require(_0xd77e('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd77e('0x12'))['db'];function respondWithStatusCode(_0x20023a,_0x3a5e6a){_0x3a5e6a=_0x3a5e6a||0xcc;return function(_0x4a6a31){if(_0x4a6a31){return _0x20023a[_0xd77e('0x13')](_0x3a5e6a);}return _0x20023a[_0xd77e('0x14')](_0x3a5e6a)[_0xd77e('0x15')]();};}function respondWithResult(_0x49bd87,_0xde02a7){_0xde02a7=_0xde02a7||0xc8;return function(_0x349a05){if(_0x349a05){return _0x49bd87[_0xd77e('0x14')](_0xde02a7)[_0xd77e('0x16')](_0x349a05);}};}function respondWithFilteredResult(_0x1de452,_0x3ead66){return function(_0x3e8f69){if(_0x3e8f69){var _0x21291c=typeof _0x3ead66[_0xd77e('0x17')]===_0xd77e('0x18')&&typeof _0x3ead66[_0xd77e('0x19')]===_0xd77e('0x18');var _0x5bea9e=_0x3e8f69[_0xd77e('0x1a')];var _0x1b5073=_0x21291c?0x0:_0x3ead66['offset'];var _0x3496f0=_0x21291c?_0x3e8f69[_0xd77e('0x1a')]:_0x3ead66['offset']+_0x3ead66[_0xd77e('0x19')];var _0x79e5e;if(_0x3496f0>=_0x5bea9e){_0x3496f0=_0x5bea9e;_0x79e5e=0xc8;}else{_0x79e5e=0xce;}_0x1de452[_0xd77e('0x14')](_0x79e5e);return _0x1de452['set'](_0xd77e('0x1b'),_0x1b5073+'-'+_0x3496f0+'/'+_0x5bea9e)[_0xd77e('0x16')](_0x3e8f69);}return null;};}function patchUpdates(_0xfe8f15){return function(_0x88b05b){try{jsonpatch[_0xd77e('0x1c')](_0x88b05b,_0xfe8f15,!![]);}catch(_0x2e4bbc){return BPromise['reject'](_0x2e4bbc);}return _0x88b05b[_0xd77e('0x1d')]();};}function saveUpdates(_0x5a3ab6,_0x326556){return function(_0x4642d9){if(_0x4642d9){return _0x4642d9[_0xd77e('0x1e')](_0x5a3ab6)[_0xd77e('0x1f')](function(_0x5a143f){return _0x5a143f;});}return null;};}function removeEntity(_0x5e124d,_0x2b4c8f){return function(_0x2b47d3){if(_0x2b47d3){return _0x2b47d3[_0xd77e('0x20')]()[_0xd77e('0x1f')](function(){_0x5e124d[_0xd77e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35140,_0x492ea1){return function(_0x1a3b59){if(!_0x1a3b59){_0x35140[_0xd77e('0x13')](0x194);}return _0x1a3b59;};}function handleError(_0x1aef57,_0x436f24){_0x436f24=_0x436f24||0x1f4;return function(_0x3564ed){logger[_0xd77e('0x21')](_0x3564ed[_0xd77e('0x22')]);if(_0x3564ed['name']){delete _0x3564ed['name'];}_0x1aef57[_0xd77e('0x14')](_0x436f24)[_0xd77e('0x23')](_0x3564ed);};}exports[_0xd77e('0x24')]=function(_0x2c1d00,_0x1927e1){var _0x2fe3ff={},_0xc5c3ac={},_0x41c71a={'count':0x0,'rows':[]};var _0x25aeb7=_[_0xd77e('0x25')](db[_0xd77e('0x26')]['rawAttributes'],function(_0x2744f9){return{'name':_0x2744f9[_0xd77e('0x27')],'type':_0x2744f9['type']['key']};});_0xc5c3ac[_0xd77e('0x28')]=_['map'](_0x25aeb7,_0xd77e('0x29'));_0xc5c3ac[_0xd77e('0x2a')]=_['keys'](_0x2c1d00[_0xd77e('0x2a')]);_0xc5c3ac[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0xc5c3ac[_0xd77e('0x28')],_0xc5c3ac[_0xd77e('0x2a')]);_0x2fe3ff['attributes']=_[_0xd77e('0x2c')](_0xc5c3ac['model'],qs['fields'](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0x2fe3ff[_0xd77e('0x2e')]=_0x2fe3ff[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x2fe3ff['attributes']:_0xc5c3ac[_0xd77e('0x28')];if(!_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x30')]('nolimit')){_0x2fe3ff[_0xd77e('0x19')]=qs[_0xd77e('0x19')](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x19')]);_0x2fe3ff[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x17')]);}_0x2fe3ff[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x32')]);_0x2fe3ff[_0xd77e('0x33')]=qs[_0xd77e('0x2b')](_[_0xd77e('0x34')](_0x2c1d00[_0xd77e('0x2a')],_0xc5c3ac[_0xd77e('0x2b')]),_0x25aeb7);if(_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x35')]){_0x2fe3ff[_0xd77e('0x33')]=_[_0xd77e('0x36')](_0x2fe3ff[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0x25aeb7,function(_0x435ae9){if(_0x435ae9[_0xd77e('0x37')]!==_0xd77e('0x38')){var _0x55997={};_0x55997[_0x435ae9['name']]={'$like':'%'+_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x55997;}})});}_0x2fe3ff=_[_0xd77e('0x36')]({},_0x2fe3ff,_0x2c1d00[_0xd77e('0x39')]);var _0x8db31f={'where':_0x2fe3ff[_0xd77e('0x33')]};return db[_0xd77e('0x26')][_0xd77e('0x1a')](_0x8db31f)[_0xd77e('0x1f')](function(_0x1c3d6d){_0x41c71a['count']=_0x1c3d6d;if(_0x2c1d00[_0xd77e('0x2a')][_0xd77e('0x3a')]){_0x2fe3ff['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0xd77e('0x3b')](_0x2fe3ff);})[_0xd77e('0x1f')](function(_0x506a07){_0x41c71a['rows']=_0x506a07;return _0x41c71a;})['then'](respondWithFilteredResult(_0x1927e1,_0x2fe3ff))[_0xd77e('0x3c')](handleError(_0x1927e1,null));};exports['show']=function(_0x102e03,_0x129083){var _0x4ee48f={'raw':![],'where':{'id':_0x102e03['params']['id']}},_0x45d86c={};_0x45d86c[_0xd77e('0x28')]=_['keys'](db[_0xd77e('0x26')][_0xd77e('0x3d')]);_0x45d86c['query']=_['keys'](_0x102e03[_0xd77e('0x2a')]);_0x45d86c[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0x45d86c[_0xd77e('0x28')],_0x45d86c[_0xd77e('0x2a')]);_0x4ee48f['attributes']=_['intersection'](_0x45d86c[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x102e03[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0x4ee48f[_0xd77e('0x2e')]=_0x4ee48f[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x4ee48f['attributes']:_0x45d86c[_0xd77e('0x28')];if(_0x102e03[_0xd77e('0x2a')][_0xd77e('0x3a')]){_0x4ee48f[_0xd77e('0x3e')]=[{'all':!![]}];}_0x4ee48f=_[_0xd77e('0x36')]({},_0x4ee48f,_0x102e03[_0xd77e('0x39')]);return db['VtigerConfiguration'][_0xd77e('0x3f')](_0x4ee48f)[_0xd77e('0x1f')](handleEntityNotFound(_0x129083,null))[_0xd77e('0x1f')](respondWithResult(_0x129083,null))[_0xd77e('0x3c')](handleError(_0x129083,null));};exports[_0xd77e('0x40')]=function(_0x3d60a9,_0x4932d7){return db['VtigerConfiguration'][_0xd77e('0x40')](_0x3d60a9['body'],{})[_0xd77e('0x1f')](respondWithResult(_0x4932d7,0xc9))[_0xd77e('0x3c')](handleError(_0x4932d7,null));};exports['update']=function(_0x2e45cd,_0x818e5f){if(_0x2e45cd['body']['id']){delete _0x2e45cd[_0xd77e('0x41')]['id'];}return db[_0xd77e('0x26')]['find']({'where':{'id':_0x2e45cd[_0xd77e('0x42')]['id']}})[_0xd77e('0x1f')](handleEntityNotFound(_0x818e5f,null))['then'](saveUpdates(_0x2e45cd['body'],null))['then'](respondWithResult(_0x818e5f,null))[_0xd77e('0x3c')](handleError(_0x818e5f,null));};exports[_0xd77e('0x20')]=function(_0x4daacf,_0x54fbc3){return db['VtigerConfiguration'][_0xd77e('0x3f')]({'where':{'id':_0x4daacf[_0xd77e('0x42')]['id']}})[_0xd77e('0x1f')](handleEntityNotFound(_0x54fbc3,null))[_0xd77e('0x1f')](removeEntity(_0x54fbc3,null))[_0xd77e('0x3c')](handleError(_0x54fbc3,null));};exports[_0xd77e('0x43')]=function(_0x46b5dd,_0x5561f1,_0x8c679c){var _0x20c07f={};var _0x29533c={};var _0x104946;var _0x2cf586;return db[_0xd77e('0x26')][_0xd77e('0x44')]({'where':{'id':_0x46b5dd['params']['id']}})[_0xd77e('0x1f')](handleEntityNotFound(_0x5561f1,null))[_0xd77e('0x1f')](function(_0xbb1580){if(_0xbb1580){_0x104946=_0xbb1580;_0x29533c[_0xd77e('0x28')]=_[_0xd77e('0x45')](db['VtigerField'][_0xd77e('0x3d')]);_0x29533c[_0xd77e('0x2a')]=_[_0xd77e('0x45')](_0x46b5dd['query']);_0x29533c[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0x29533c[_0xd77e('0x28')],_0x29533c['query']);_0x20c07f[_0xd77e('0x2e')]=_['intersection'](_0x29533c[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x46b5dd[_0xd77e('0x2a')]['fields']));_0x20c07f[_0xd77e('0x2e')]=_0x20c07f[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x20c07f[_0xd77e('0x2e')]:_0x29533c[_0xd77e('0x28')];_0x20c07f[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x46b5dd[_0xd77e('0x2a')]['sort']);_0x20c07f['where']=qs['filters'](_[_0xd77e('0x34')](_0x46b5dd['query'],_0x29533c[_0xd77e('0x2b')]));if(_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x35')]){_0x20c07f[_0xd77e('0x33')]=_['merge'](_0x20c07f[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0x20c07f[_0xd77e('0x2e')],function(_0x36e4ab){var _0x2d31ee={};_0x2d31ee[_0x36e4ab]={'$like':'%'+_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x2d31ee;})});}_0x20c07f=_[_0xd77e('0x36')]({},_0x20c07f,_0x46b5dd[_0xd77e('0x39')]);return _0x104946['getFields'](_0x20c07f);}})[_0xd77e('0x1f')](function(_0x26b822){if(_0x26b822){_0x2cf586=_0x26b822[_0xd77e('0x2f')];if(!_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x30')](_0xd77e('0x46'))){_0x20c07f[_0xd77e('0x19')]=qs[_0xd77e('0x19')](_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x19')]);_0x20c07f[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x46b5dd[_0xd77e('0x2a')][_0xd77e('0x17')]);}return _0x104946[_0xd77e('0x43')](_0x20c07f);}})[_0xd77e('0x1f')](function(_0x2ff8c8){if(_0x2ff8c8){return _0x2ff8c8?{'count':_0x2cf586,'rows':_0x2ff8c8}:null;}})[_0xd77e('0x1f')](respondWithResult(_0x5561f1,null))[_0xd77e('0x3c')](handleError(_0x5561f1,null));};exports[_0xd77e('0x47')]=function(_0x48c37e,_0x15090f,_0x3a9062){var _0x5a743a={};var _0x14db24={};var _0x44372b;var _0x24a16e;return db[_0xd77e('0x26')][_0xd77e('0x44')]({'where':{'id':_0x48c37e[_0xd77e('0x42')]['id']}})['then'](handleEntityNotFound(_0x15090f,null))[_0xd77e('0x1f')](function(_0x14c038){if(_0x14c038){_0x44372b=_0x14c038;_0x14db24[_0xd77e('0x28')]=_['keys'](db[_0xd77e('0x48')]['rawAttributes']);_0x14db24[_0xd77e('0x2a')]=_[_0xd77e('0x45')](_0x48c37e[_0xd77e('0x2a')]);_0x14db24[_0xd77e('0x2b')]=_[_0xd77e('0x2c')](_0x14db24[_0xd77e('0x28')],_0x14db24['query']);_0x5a743a['attributes']=_['intersection'](_0x14db24[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0x5a743a[_0xd77e('0x2e')]=_0x5a743a[_0xd77e('0x2e')][_0xd77e('0x2f')]?_0x5a743a[_0xd77e('0x2e')]:_0x14db24[_0xd77e('0x28')];_0x5a743a[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x48c37e['query'][_0xd77e('0x32')]);_0x5a743a[_0xd77e('0x33')]=qs[_0xd77e('0x2b')](_[_0xd77e('0x34')](_0x48c37e[_0xd77e('0x2a')],_0x14db24[_0xd77e('0x2b')]));if(_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x35')]){_0x5a743a[_0xd77e('0x33')]=_['merge'](_0x5a743a[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0x5a743a[_0xd77e('0x2e')],function(_0x4963f9){var _0x121959={};_0x121959[_0x4963f9]={'$like':'%'+_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x121959;})});}_0x5a743a=_[_0xd77e('0x36')]({},_0x5a743a,_0x48c37e[_0xd77e('0x39')]);return _0x44372b['getSubjects'](_0x5a743a);}})['then'](function(_0x1011c3){if(_0x1011c3){_0x24a16e=_0x1011c3['length'];if(!_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x30')]('nolimit')){_0x5a743a[_0xd77e('0x19')]=qs['limit'](_0x48c37e[_0xd77e('0x2a')][_0xd77e('0x19')]);_0x5a743a[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x48c37e['query']['offset']);}return _0x44372b[_0xd77e('0x47')](_0x5a743a);}})[_0xd77e('0x1f')](function(_0x407b89){if(_0x407b89){return _0x407b89?{'count':_0x24a16e,'rows':_0x407b89}:null;}})[_0xd77e('0x1f')](respondWithResult(_0x15090f,null))[_0xd77e('0x3c')](handleError(_0x15090f,null));};exports['getDescriptions']=function(_0x37bf00,_0x3df02c,_0x484dd2){var _0xa3b66c={};var _0x114ad7={};var _0x29f300;var _0x355cc9;return db[_0xd77e('0x26')][_0xd77e('0x44')]({'where':{'id':_0x37bf00[_0xd77e('0x42')]['id']}})['then'](handleEntityNotFound(_0x3df02c,null))[_0xd77e('0x1f')](function(_0x424402){if(_0x424402){_0x29f300=_0x424402;_0x114ad7[_0xd77e('0x28')]=_[_0xd77e('0x45')](db[_0xd77e('0x48')][_0xd77e('0x3d')]);_0x114ad7[_0xd77e('0x2a')]=_['keys'](_0x37bf00['query']);_0x114ad7['filters']=_[_0xd77e('0x2c')](_0x114ad7[_0xd77e('0x28')],_0x114ad7[_0xd77e('0x2a')]);_0xa3b66c[_0xd77e('0x2e')]=_[_0xd77e('0x2c')](_0x114ad7[_0xd77e('0x28')],qs[_0xd77e('0x2d')](_0x37bf00[_0xd77e('0x2a')][_0xd77e('0x2d')]));_0xa3b66c[_0xd77e('0x2e')]=_0xa3b66c['attributes'][_0xd77e('0x2f')]?_0xa3b66c[_0xd77e('0x2e')]:_0x114ad7[_0xd77e('0x28')];_0xa3b66c[_0xd77e('0x31')]=qs[_0xd77e('0x32')](_0x37bf00[_0xd77e('0x2a')]['sort']);_0xa3b66c[_0xd77e('0x33')]=qs[_0xd77e('0x2b')](_[_0xd77e('0x34')](_0x37bf00[_0xd77e('0x2a')],_0x114ad7[_0xd77e('0x2b')]));if(_0x37bf00[_0xd77e('0x2a')][_0xd77e('0x35')]){_0xa3b66c[_0xd77e('0x33')]=_[_0xd77e('0x36')](_0xa3b66c[_0xd77e('0x33')],{'$or':_[_0xd77e('0x25')](_0xa3b66c['attributes'],function(_0x2b60e0){var _0x1ddf9d={};_0x1ddf9d[_0x2b60e0]={'$like':'%'+_0x37bf00[_0xd77e('0x2a')][_0xd77e('0x35')]+'%'};return _0x1ddf9d;})});}_0xa3b66c=_['merge']({},_0xa3b66c,_0x37bf00['options']);return _0x29f300[_0xd77e('0x49')](_0xa3b66c);}})[_0xd77e('0x1f')](function(_0x4570f5){if(_0x4570f5){_0x355cc9=_0x4570f5['length'];if(!_0x37bf00[_0xd77e('0x2a')]['hasOwnProperty'](_0xd77e('0x46'))){_0xa3b66c[_0xd77e('0x19')]=qs[_0xd77e('0x19')](_0x37bf00['query'][_0xd77e('0x19')]);_0xa3b66c[_0xd77e('0x17')]=qs[_0xd77e('0x17')](_0x37bf00['query'][_0xd77e('0x17')]);}return _0x29f300[_0xd77e('0x49')](_0xa3b66c);}})[_0xd77e('0x1f')](function(_0x97b5a2){if(_0x97b5a2){return _0x97b5a2?{'count':_0x355cc9,'rows':_0x97b5a2}:null;}})[_0xd77e('0x1f')](respondWithResult(_0x3df02c,null))[_0xd77e('0x3c')](handleError(_0x3df02c,null));}; \ No newline at end of file +var _0xb549=['pick','filter','where','merge','options','includeAll','include','findAll','catch','show','keys','rawAttributes','create','body','find','params','getFields','findOne','VtigerField','order','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerConfiguration','fieldName','type','query','intersection','model','attributes','fields','length','sort','filters'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb549,0x164));var _0x9b54=function(_0x23c09e,_0x3f5baf){_0x23c09e=_0x23c09e-0x0;var _0x170472=_0xb549[_0x23c09e];return _0x170472;};'use strict';var emlformat=require(_0x9b54('0x0'));var rimraf=require(_0x9b54('0x1'));var zipdir=require(_0x9b54('0x2'));var jsonpatch=require(_0x9b54('0x3'));var rp=require(_0x9b54('0x4'));var moment=require(_0x9b54('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9b54('0x6'));var util=require(_0x9b54('0x7'));var path=require(_0x9b54('0x8'));var sox=require(_0x9b54('0x9'));var csv=require(_0x9b54('0xa'));var ejs=require(_0x9b54('0xb'));var fs=require('fs');var fs_extra=require(_0x9b54('0xc'));var _=require(_0x9b54('0xd'));var squel=require(_0x9b54('0xe'));var crypto=require(_0x9b54('0xf'));var jsforce=require(_0x9b54('0x10'));var deskjs=require(_0x9b54('0x11'));var toCsv=require(_0x9b54('0xa'));var querystring=require(_0x9b54('0x12'));var Papa=require(_0x9b54('0x13'));var Redis=require(_0x9b54('0x14'));var authService=require(_0x9b54('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9b54('0x16'));var hardwareService=require(_0x9b54('0x17'));var logger=require(_0x9b54('0x18'))(_0x9b54('0x19'));var utils=require(_0x9b54('0x1a'));var config=require(_0x9b54('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296945,_0x125e16){_0x125e16=_0x125e16||0xcc;return function(_0x2315d1){if(_0x2315d1){return _0x296945[_0x9b54('0x1c')](_0x125e16);}return _0x296945['status'](_0x125e16)[_0x9b54('0x1d')]();};}function respondWithResult(_0x530333,_0x545296){_0x545296=_0x545296||0xc8;return function(_0xacda27){if(_0xacda27){return _0x530333['status'](_0x545296)[_0x9b54('0x1e')](_0xacda27);}};}function respondWithFilteredResult(_0x2e8072,_0x1458aa){return function(_0x1173ae){if(_0x1173ae){var _0x70729b=typeof _0x1458aa[_0x9b54('0x1f')]===_0x9b54('0x20')&&typeof _0x1458aa[_0x9b54('0x21')]===_0x9b54('0x20');var _0x57d093=_0x1173ae[_0x9b54('0x22')];var _0x4751dd=_0x70729b?0x0:_0x1458aa[_0x9b54('0x1f')];var _0x2fcdd4=_0x70729b?_0x1173ae[_0x9b54('0x22')]:_0x1458aa['offset']+_0x1458aa[_0x9b54('0x21')];var _0x8cc81e;if(_0x2fcdd4>=_0x57d093){_0x2fcdd4=_0x57d093;_0x8cc81e=0xc8;}else{_0x8cc81e=0xce;}_0x2e8072[_0x9b54('0x23')](_0x8cc81e);return _0x2e8072[_0x9b54('0x24')]('Content-Range',_0x4751dd+'-'+_0x2fcdd4+'/'+_0x57d093)[_0x9b54('0x1e')](_0x1173ae);}return null;};}function patchUpdates(_0x93c7d2){return function(_0x1416fa){try{jsonpatch[_0x9b54('0x25')](_0x1416fa,_0x93c7d2,!![]);}catch(_0x5225f6){return BPromise[_0x9b54('0x26')](_0x5225f6);}return _0x1416fa[_0x9b54('0x27')]();};}function saveUpdates(_0x4fa934,_0x815b86){return function(_0x2efe8b){if(_0x2efe8b){return _0x2efe8b[_0x9b54('0x28')](_0x4fa934)[_0x9b54('0x29')](function(_0x294b4b){return _0x294b4b;});}return null;};}function removeEntity(_0x581a7b,_0x385ae8){return function(_0x512291){if(_0x512291){return _0x512291[_0x9b54('0x2a')]()[_0x9b54('0x29')](function(){_0x581a7b['status'](0xcc)[_0x9b54('0x1d')]();});}};}function handleEntityNotFound(_0x3bb32d,_0x26e3ad){return function(_0x1a1dd3){if(!_0x1a1dd3){_0x3bb32d[_0x9b54('0x1c')](0x194);}return _0x1a1dd3;};}function handleError(_0x16439a,_0x2c57cf){_0x2c57cf=_0x2c57cf||0x1f4;return function(_0xa01ee3){logger['error'](_0xa01ee3[_0x9b54('0x2b')]);if(_0xa01ee3[_0x9b54('0x2c')]){delete _0xa01ee3['name'];}_0x16439a[_0x9b54('0x23')](_0x2c57cf)[_0x9b54('0x2d')](_0xa01ee3);};}exports[_0x9b54('0x2e')]=function(_0x4fa54b,_0x2404ab){var _0x1090b3={},_0x5cbfe9={},_0x2cb3ea={'count':0x0,'rows':[]};var _0x3c9491=_[_0x9b54('0x2f')](db[_0x9b54('0x30')]['rawAttributes'],function(_0x3e1a2d){return{'name':_0x3e1a2d[_0x9b54('0x31')],'type':_0x3e1a2d[_0x9b54('0x32')]['key']};});_0x5cbfe9['model']=_[_0x9b54('0x2f')](_0x3c9491,_0x9b54('0x2c'));_0x5cbfe9[_0x9b54('0x33')]=_['keys'](_0x4fa54b[_0x9b54('0x33')]);_0x5cbfe9['filters']=_[_0x9b54('0x34')](_0x5cbfe9[_0x9b54('0x35')],_0x5cbfe9['query']);_0x1090b3[_0x9b54('0x36')]=_['intersection'](_0x5cbfe9[_0x9b54('0x35')],qs[_0x9b54('0x37')](_0x4fa54b['query'][_0x9b54('0x37')]));_0x1090b3[_0x9b54('0x36')]=_0x1090b3[_0x9b54('0x36')][_0x9b54('0x38')]?_0x1090b3[_0x9b54('0x36')]:_0x5cbfe9[_0x9b54('0x35')];if(!_0x4fa54b[_0x9b54('0x33')]['hasOwnProperty']('nolimit')){_0x1090b3[_0x9b54('0x21')]=qs[_0x9b54('0x21')](_0x4fa54b[_0x9b54('0x33')][_0x9b54('0x21')]);_0x1090b3['offset']=qs[_0x9b54('0x1f')](_0x4fa54b[_0x9b54('0x33')][_0x9b54('0x1f')]);}_0x1090b3['order']=qs['sort'](_0x4fa54b['query'][_0x9b54('0x39')]);_0x1090b3['where']=qs[_0x9b54('0x3a')](_[_0x9b54('0x3b')](_0x4fa54b[_0x9b54('0x33')],_0x5cbfe9['filters']),_0x3c9491);if(_0x4fa54b[_0x9b54('0x33')][_0x9b54('0x3c')]){_0x1090b3[_0x9b54('0x3d')]=_[_0x9b54('0x3e')](_0x1090b3[_0x9b54('0x3d')],{'$or':_[_0x9b54('0x2f')](_0x3c9491,function(_0x3fc3cd){if(_0x3fc3cd[_0x9b54('0x32')]!=='VIRTUAL'){var _0x351f7b={};_0x351f7b[_0x3fc3cd[_0x9b54('0x2c')]]={'$like':'%'+_0x4fa54b['query'][_0x9b54('0x3c')]+'%'};return _0x351f7b;}})});}_0x1090b3=_[_0x9b54('0x3e')]({},_0x1090b3,_0x4fa54b[_0x9b54('0x3f')]);var _0x321f18={'where':_0x1090b3[_0x9b54('0x3d')]};return db[_0x9b54('0x30')][_0x9b54('0x22')](_0x321f18)[_0x9b54('0x29')](function(_0x409388){_0x2cb3ea[_0x9b54('0x22')]=_0x409388;if(_0x4fa54b[_0x9b54('0x33')][_0x9b54('0x40')]){_0x1090b3[_0x9b54('0x41')]=[{'all':!![]}];}return db[_0x9b54('0x30')][_0x9b54('0x42')](_0x1090b3);})[_0x9b54('0x29')](function(_0x137dfc){_0x2cb3ea['rows']=_0x137dfc;return _0x2cb3ea;})[_0x9b54('0x29')](respondWithFilteredResult(_0x2404ab,_0x1090b3))[_0x9b54('0x43')](handleError(_0x2404ab,null));};exports[_0x9b54('0x44')]=function(_0xd56d6e,_0x575dfd){var _0x26dd53={'raw':![],'where':{'id':_0xd56d6e['params']['id']}},_0x3525d={};_0x3525d['model']=_[_0x9b54('0x45')](db[_0x9b54('0x30')][_0x9b54('0x46')]);_0x3525d[_0x9b54('0x33')]=_[_0x9b54('0x45')](_0xd56d6e[_0x9b54('0x33')]);_0x3525d[_0x9b54('0x3a')]=_[_0x9b54('0x34')](_0x3525d[_0x9b54('0x35')],_0x3525d[_0x9b54('0x33')]);_0x26dd53[_0x9b54('0x36')]=_[_0x9b54('0x34')](_0x3525d[_0x9b54('0x35')],qs[_0x9b54('0x37')](_0xd56d6e[_0x9b54('0x33')][_0x9b54('0x37')]));_0x26dd53[_0x9b54('0x36')]=_0x26dd53[_0x9b54('0x36')][_0x9b54('0x38')]?_0x26dd53[_0x9b54('0x36')]:_0x3525d['model'];if(_0xd56d6e[_0x9b54('0x33')]['includeAll']){_0x26dd53[_0x9b54('0x41')]=[{'all':!![]}];}_0x26dd53=_[_0x9b54('0x3e')]({},_0x26dd53,_0xd56d6e[_0x9b54('0x3f')]);return db[_0x9b54('0x30')]['find'](_0x26dd53)[_0x9b54('0x29')](handleEntityNotFound(_0x575dfd,null))[_0x9b54('0x29')](respondWithResult(_0x575dfd,null))[_0x9b54('0x43')](handleError(_0x575dfd,null));};exports[_0x9b54('0x47')]=function(_0x5b8992,_0xdbc9d4){return db[_0x9b54('0x30')][_0x9b54('0x47')](_0x5b8992[_0x9b54('0x48')],{})[_0x9b54('0x29')](respondWithResult(_0xdbc9d4,0xc9))[_0x9b54('0x43')](handleError(_0xdbc9d4,null));};exports['update']=function(_0x212af6,_0x192d37){if(_0x212af6[_0x9b54('0x48')]['id']){delete _0x212af6[_0x9b54('0x48')]['id'];}return db[_0x9b54('0x30')]['find']({'where':{'id':_0x212af6['params']['id']}})['then'](handleEntityNotFound(_0x192d37,null))['then'](saveUpdates(_0x212af6[_0x9b54('0x48')],null))[_0x9b54('0x29')](respondWithResult(_0x192d37,null))['catch'](handleError(_0x192d37,null));};exports[_0x9b54('0x2a')]=function(_0x4fc7bc,_0xa6b9e9){return db[_0x9b54('0x30')][_0x9b54('0x49')]({'where':{'id':_0x4fc7bc[_0x9b54('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa6b9e9,null))['then'](removeEntity(_0xa6b9e9,null))[_0x9b54('0x43')](handleError(_0xa6b9e9,null));};exports[_0x9b54('0x4b')]=function(_0x647242,_0x420e83,_0x5df240){var _0x2e45f1={};var _0x41d259={};var _0x247b52;var _0x368b30;return db['VtigerConfiguration'][_0x9b54('0x4c')]({'where':{'id':_0x647242[_0x9b54('0x4a')]['id']}})[_0x9b54('0x29')](handleEntityNotFound(_0x420e83,null))[_0x9b54('0x29')](function(_0x4558db){if(_0x4558db){_0x247b52=_0x4558db;_0x41d259[_0x9b54('0x35')]=_[_0x9b54('0x45')](db[_0x9b54('0x4d')][_0x9b54('0x46')]);_0x41d259[_0x9b54('0x33')]=_[_0x9b54('0x45')](_0x647242[_0x9b54('0x33')]);_0x41d259[_0x9b54('0x3a')]=_[_0x9b54('0x34')](_0x41d259[_0x9b54('0x35')],_0x41d259[_0x9b54('0x33')]);_0x2e45f1['attributes']=_[_0x9b54('0x34')](_0x41d259[_0x9b54('0x35')],qs[_0x9b54('0x37')](_0x647242[_0x9b54('0x33')]['fields']));_0x2e45f1['attributes']=_0x2e45f1[_0x9b54('0x36')]['length']?_0x2e45f1[_0x9b54('0x36')]:_0x41d259['model'];_0x2e45f1[_0x9b54('0x4e')]=qs[_0x9b54('0x39')](_0x647242[_0x9b54('0x33')]['sort']);_0x2e45f1[_0x9b54('0x3d')]=qs['filters'](_[_0x9b54('0x3b')](_0x647242[_0x9b54('0x33')],_0x41d259[_0x9b54('0x3a')]));if(_0x647242['query'][_0x9b54('0x3c')]){_0x2e45f1['where']=_[_0x9b54('0x3e')](_0x2e45f1[_0x9b54('0x3d')],{'$or':_[_0x9b54('0x2f')](_0x2e45f1['attributes'],function(_0x585ea4){var _0x4b4c33={};_0x4b4c33[_0x585ea4]={'$like':'%'+_0x647242[_0x9b54('0x33')]['filter']+'%'};return _0x4b4c33;})});}_0x2e45f1=_[_0x9b54('0x3e')]({},_0x2e45f1,_0x647242[_0x9b54('0x3f')]);return _0x247b52[_0x9b54('0x4b')](_0x2e45f1);}})[_0x9b54('0x29')](function(_0x67aded){if(_0x67aded){_0x368b30=_0x67aded[_0x9b54('0x38')];if(!_0x647242[_0x9b54('0x33')][_0x9b54('0x4f')](_0x9b54('0x50'))){_0x2e45f1[_0x9b54('0x21')]=qs[_0x9b54('0x21')](_0x647242[_0x9b54('0x33')][_0x9b54('0x21')]);_0x2e45f1[_0x9b54('0x1f')]=qs[_0x9b54('0x1f')](_0x647242['query'][_0x9b54('0x1f')]);}return _0x247b52[_0x9b54('0x4b')](_0x2e45f1);}})[_0x9b54('0x29')](function(_0xdbdde7){if(_0xdbdde7){return _0xdbdde7?{'count':_0x368b30,'rows':_0xdbdde7}:null;}})[_0x9b54('0x29')](respondWithResult(_0x420e83,null))[_0x9b54('0x43')](handleError(_0x420e83,null));};exports[_0x9b54('0x51')]=function(_0x5f178e,_0xce9125,_0x43526a){var _0x120ea3={};var _0x2aa357={};var _0x53dcd7;var _0x443496;return db['VtigerConfiguration'][_0x9b54('0x4c')]({'where':{'id':_0x5f178e['params']['id']}})[_0x9b54('0x29')](handleEntityNotFound(_0xce9125,null))['then'](function(_0x49ac9c){if(_0x49ac9c){_0x53dcd7=_0x49ac9c;_0x2aa357['model']=_['keys'](db[_0x9b54('0x4d')]['rawAttributes']);_0x2aa357[_0x9b54('0x33')]=_[_0x9b54('0x45')](_0x5f178e[_0x9b54('0x33')]);_0x2aa357[_0x9b54('0x3a')]=_[_0x9b54('0x34')](_0x2aa357[_0x9b54('0x35')],_0x2aa357[_0x9b54('0x33')]);_0x120ea3['attributes']=_[_0x9b54('0x34')](_0x2aa357['model'],qs[_0x9b54('0x37')](_0x5f178e[_0x9b54('0x33')][_0x9b54('0x37')]));_0x120ea3['attributes']=_0x120ea3[_0x9b54('0x36')][_0x9b54('0x38')]?_0x120ea3[_0x9b54('0x36')]:_0x2aa357[_0x9b54('0x35')];_0x120ea3[_0x9b54('0x4e')]=qs[_0x9b54('0x39')](_0x5f178e[_0x9b54('0x33')][_0x9b54('0x39')]);_0x120ea3[_0x9b54('0x3d')]=qs['filters'](_[_0x9b54('0x3b')](_0x5f178e[_0x9b54('0x33')],_0x2aa357[_0x9b54('0x3a')]));if(_0x5f178e[_0x9b54('0x33')][_0x9b54('0x3c')]){_0x120ea3[_0x9b54('0x3d')]=_[_0x9b54('0x3e')](_0x120ea3[_0x9b54('0x3d')],{'$or':_[_0x9b54('0x2f')](_0x120ea3['attributes'],function(_0xbd76b9){var _0x201ecd={};_0x201ecd[_0xbd76b9]={'$like':'%'+_0x5f178e[_0x9b54('0x33')][_0x9b54('0x3c')]+'%'};return _0x201ecd;})});}_0x120ea3=_[_0x9b54('0x3e')]({},_0x120ea3,_0x5f178e[_0x9b54('0x3f')]);return _0x53dcd7[_0x9b54('0x51')](_0x120ea3);}})[_0x9b54('0x29')](function(_0x375e86){if(_0x375e86){_0x443496=_0x375e86[_0x9b54('0x38')];if(!_0x5f178e[_0x9b54('0x33')]['hasOwnProperty']('nolimit')){_0x120ea3[_0x9b54('0x21')]=qs['limit'](_0x5f178e[_0x9b54('0x33')]['limit']);_0x120ea3[_0x9b54('0x1f')]=qs[_0x9b54('0x1f')](_0x5f178e[_0x9b54('0x33')][_0x9b54('0x1f')]);}return _0x53dcd7[_0x9b54('0x51')](_0x120ea3);}})[_0x9b54('0x29')](function(_0x5358b7){if(_0x5358b7){return _0x5358b7?{'count':_0x443496,'rows':_0x5358b7}:null;}})[_0x9b54('0x29')](respondWithResult(_0xce9125,null))[_0x9b54('0x43')](handleError(_0xce9125,null));};exports[_0x9b54('0x52')]=function(_0x5c4110,_0xa7aaae,_0x1b6384){var _0x49b2e={};var _0x36335b={};var _0x4b5151;var _0x4cfcb1;return db[_0x9b54('0x30')][_0x9b54('0x4c')]({'where':{'id':_0x5c4110[_0x9b54('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa7aaae,null))['then'](function(_0x9d7d2e){if(_0x9d7d2e){_0x4b5151=_0x9d7d2e;_0x36335b['model']=_[_0x9b54('0x45')](db['VtigerField']['rawAttributes']);_0x36335b[_0x9b54('0x33')]=_['keys'](_0x5c4110[_0x9b54('0x33')]);_0x36335b[_0x9b54('0x3a')]=_[_0x9b54('0x34')](_0x36335b[_0x9b54('0x35')],_0x36335b[_0x9b54('0x33')]);_0x49b2e[_0x9b54('0x36')]=_['intersection'](_0x36335b[_0x9b54('0x35')],qs[_0x9b54('0x37')](_0x5c4110[_0x9b54('0x33')][_0x9b54('0x37')]));_0x49b2e[_0x9b54('0x36')]=_0x49b2e[_0x9b54('0x36')]['length']?_0x49b2e[_0x9b54('0x36')]:_0x36335b[_0x9b54('0x35')];_0x49b2e[_0x9b54('0x4e')]=qs['sort'](_0x5c4110[_0x9b54('0x33')]['sort']);_0x49b2e[_0x9b54('0x3d')]=qs[_0x9b54('0x3a')](_['pick'](_0x5c4110[_0x9b54('0x33')],_0x36335b[_0x9b54('0x3a')]));if(_0x5c4110[_0x9b54('0x33')]['filter']){_0x49b2e[_0x9b54('0x3d')]=_['merge'](_0x49b2e[_0x9b54('0x3d')],{'$or':_[_0x9b54('0x2f')](_0x49b2e[_0x9b54('0x36')],function(_0x285291){var _0x109f7e={};_0x109f7e[_0x285291]={'$like':'%'+_0x5c4110[_0x9b54('0x33')][_0x9b54('0x3c')]+'%'};return _0x109f7e;})});}_0x49b2e=_[_0x9b54('0x3e')]({},_0x49b2e,_0x5c4110['options']);return _0x4b5151[_0x9b54('0x52')](_0x49b2e);}})[_0x9b54('0x29')](function(_0x5cc267){if(_0x5cc267){_0x4cfcb1=_0x5cc267['length'];if(!_0x5c4110[_0x9b54('0x33')]['hasOwnProperty'](_0x9b54('0x50'))){_0x49b2e[_0x9b54('0x21')]=qs[_0x9b54('0x21')](_0x5c4110[_0x9b54('0x33')][_0x9b54('0x21')]);_0x49b2e[_0x9b54('0x1f')]=qs['offset'](_0x5c4110['query']['offset']);}return _0x4b5151['getDescriptions'](_0x49b2e);}})[_0x9b54('0x29')](function(_0x5cae60){if(_0x5cae60){return _0x5cae60?{'count':_0x4cfcb1,'rows':_0x5cae60}:null;}})[_0x9b54('0x29')](respondWithResult(_0xa7aaae,null))[_0x9b54('0x43')](handleError(_0xa7aaae,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7ffa72c..95c875e 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 _0x37be=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37be,0xaa));var _0xe37b=function(_0x3f2a35,_0x484454){_0x3f2a35=_0x3f2a35-0x0;var _0x151f63=_0x37be[_0x3f2a35];return _0x151f63;};'use strict';var _=require(_0xe37b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe37b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe37b('0x2'));var fs=require('fs');var path=require(_0xe37b('0x3'));var rimraf=require(_0xe37b('0x4'));var config=require(_0xe37b('0x5'));var attributes=require(_0xe37b('0x6'));module[_0xe37b('0x7')]=function(_0x39dc32,_0x5ae9b8){return _0x39dc32[_0xe37b('0x8')](_0xe37b('0x9'),attributes,{'tableName':_0xe37b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa666=['request-promise','path','../../config/environment','define','util','../../config/logger','api','moment','bluebird'];(function(_0x5925c3,_0x5d37ca){var _0x2fc403=function(_0x41be22){while(--_0x41be22){_0x5925c3['push'](_0x5925c3['shift']());}};_0x2fc403(++_0x5d37ca);}(_0xa666,0x148));var _0x6a66=function(_0x405ee8,_0x3122c8){_0x405ee8=_0x405ee8-0x0;var _0x3fbe8b=_0xa666[_0x405ee8];return _0x3fbe8b;};'use strict';var _=require('lodash');var util=require(_0x6a66('0x0'));var logger=require(_0x6a66('0x1'))(_0x6a66('0x2'));var moment=require(_0x6a66('0x3'));var BPromise=require(_0x6a66('0x4'));var rp=require(_0x6a66('0x5'));var fs=require('fs');var path=require(_0x6a66('0x6'));var rimraf=require('rimraf');var config=require(_0x6a66('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x1da352,_0xbba66b){return _0x1da352[_0x6a66('0x8')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 14ca9ec..0629c0d 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 _0xa576=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4e6375,_0x3156c5){var _0x443f68=function(_0x527db6){while(--_0x527db6){_0x4e6375['push'](_0x4e6375['shift']());}};_0x443f68(++_0x3156c5);}(_0xa576,0x151));var _0x6a57=function(_0x117871,_0x4b52b7){_0x117871=_0x117871-0x0;var _0x6cd12=_0xa576[_0x117871];return _0x6cd12;};'use strict';var _=require(_0x6a57('0x0'));var util=require('util');var moment=require(_0x6a57('0x1'));var BPromise=require(_0x6a57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a57('0x3'));var db=require(_0x6a57('0x4'))['db'];var utils=require(_0x6a57('0x5'));var logger=require(_0x6a57('0x6'))(_0x6a57('0x7'));var config=require(_0x6a57('0x8'));var jayson=require(_0x6a57('0x9'));var client=jayson[_0x6a57('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b0f0,_0x1d2e51,_0x5a8a5f){return new BPromise(function(_0x524872,_0x50f7ab){return client[_0x6a57('0xb')](_0x31b0f0,_0x5a8a5f)[_0x6a57('0xc')](function(_0x561785){logger[_0x6a57('0xd')](_0x6a57('0xe'),_0x1d2e51,'request\x20sent');logger[_0x6a57('0xf')](_0x6a57('0x10'),_0x1d2e51,_0x6a57('0x11'),JSON[_0x6a57('0x12')](_0x561785));if(_0x561785[_0x6a57('0x13')]){if(_0x561785[_0x6a57('0x13')][_0x6a57('0x14')]===0x1f4){logger['error'](_0x6a57('0xe'),_0x1d2e51,_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);return _0x50f7ab(_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);}logger[_0x6a57('0x13')](_0x6a57('0xe'),_0x1d2e51,_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);return _0x524872(_0x561785[_0x6a57('0x13')][_0x6a57('0x15')]);}else{logger[_0x6a57('0xd')](_0x6a57('0xe'),_0x1d2e51,_0x6a57('0x11'));_0x524872(_0x561785[_0x6a57('0x16')][_0x6a57('0x15')]);}})[_0x6a57('0x17')](function(_0x2cc02e){logger[_0x6a57('0x13')](_0x6a57('0xe'),_0x1d2e51,_0x2cc02e);_0x50f7ab(_0x2cc02e);});});} \ No newline at end of file +var _0xc369=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0xc369,0x1e7));var _0x9c36=function(_0x263abf,_0x3d1481){_0x263abf=_0x263abf-0x0;var _0x24dff2=_0xc369[_0x263abf];return _0x24dff2;};'use strict';var _=require(_0x9c36('0x0'));var util=require(_0x9c36('0x1'));var moment=require(_0x9c36('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c36('0x3'));var fs=require('fs');var Redis=require(_0x9c36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c36('0x5'));var logger=require('../../config/logger')(_0x9c36('0x6'));var config=require(_0x9c36('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9c36('0x8')][_0x9c36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3310bb,_0xc04b1e,_0x323f0c){return new BPromise(function(_0x2704c2,_0x4160a4){return client[_0x9c36('0xa')](_0x3310bb,_0x323f0c)[_0x9c36('0xb')](function(_0xe4383d){logger['info'](_0x9c36('0xc'),_0xc04b1e,_0x9c36('0xd'));logger[_0x9c36('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xc04b1e,_0x9c36('0xd'),JSON[_0x9c36('0xf')](_0xe4383d));if(_0xe4383d[_0x9c36('0x10')]){if(_0xe4383d[_0x9c36('0x10')][_0x9c36('0x11')]===0x1f4){logger[_0x9c36('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xc04b1e,_0xe4383d[_0x9c36('0x10')][_0x9c36('0x12')]);return _0x4160a4(_0xe4383d['error'][_0x9c36('0x12')]);}logger[_0x9c36('0x10')](_0x9c36('0xc'),_0xc04b1e,_0xe4383d[_0x9c36('0x10')][_0x9c36('0x12')]);return _0x2704c2(_0xe4383d[_0x9c36('0x10')][_0x9c36('0x12')]);}else{logger[_0x9c36('0x13')](_0x9c36('0xc'),_0xc04b1e,'request\x20sent');_0x2704c2(_0xe4383d[_0x9c36('0x14')][_0x9c36('0x12')]);}})[_0x9c36('0x15')](function(_0x42d7b0){logger[_0x9c36('0x10')](_0x9c36('0xc'),_0xc04b1e,_0x42d7b0);_0x4160a4(_0x42d7b0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0611a05..1373772 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 _0x5c56=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x36a073,_0x2ce3ce){var _0xc9762b=function(_0x416bfe){while(--_0x416bfe){_0x36a073['push'](_0x36a073['shift']());}};_0xc9762b(++_0x2ce3ce);}(_0x5c56,0x1bd));var _0x65c5=function(_0x464a17,_0x463917){_0x464a17=_0x464a17-0x0;var _0x236b0e=_0x5c56[_0x464a17];return _0x236b0e;};'use strict';var multer=require(_0x65c5('0x0'));var util=require(_0x65c5('0x1'));var path=require('path');var timeout=require(_0x65c5('0x2'));var express=require('express');var router=express[_0x65c5('0x3')]();var fs_extra=require(_0x65c5('0x4'));var auth=require(_0x65c5('0x5'));var interaction=require(_0x65c5('0x6'));var config=require(_0x65c5('0x7'));var controller=require('./intVtigerField.controller');router[_0x65c5('0x8')]('/',auth[_0x65c5('0x9')](),controller[_0x65c5('0xa')]);router['get'](_0x65c5('0xb'),auth[_0x65c5('0x9')](),controller[_0x65c5('0xc')]);router[_0x65c5('0xd')]('/',auth[_0x65c5('0x9')](),controller['create']);router[_0x65c5('0xe')](_0x65c5('0xb'),auth[_0x65c5('0x9')](),controller[_0x65c5('0xf')]);router['delete'](_0x65c5('0xb'),auth[_0x65c5('0x9')](),controller[_0x65c5('0x10')]);module[_0x65c5('0x11')]=router; \ No newline at end of file +var _0x18ae=['isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get'];(function(_0x46a8e2,_0x67340a){var _0x15555d=function(_0x42a331){while(--_0x42a331){_0x46a8e2['push'](_0x46a8e2['shift']());}};_0x15555d(++_0x67340a);}(_0x18ae,0x1a1));var _0xe18a=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x18ae[_0x4147ff];return _0x1e71e6;};'use strict';var multer=require(_0xe18a('0x0'));var util=require(_0xe18a('0x1'));var path=require(_0xe18a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe18a('0x3'));var router=express[_0xe18a('0x4')]();var fs_extra=require(_0xe18a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe18a('0x6'));var controller=require('./intVtigerField.controller');router[_0xe18a('0x7')]('/',auth[_0xe18a('0x8')](),controller[_0xe18a('0x9')]);router[_0xe18a('0x7')](_0xe18a('0xa'),auth[_0xe18a('0x8')](),controller[_0xe18a('0xb')]);router[_0xe18a('0xc')]('/',auth[_0xe18a('0x8')](),controller['create']);router[_0xe18a('0xd')](_0xe18a('0xa'),auth[_0xe18a('0x8')](),controller[_0xe18a('0xe')]);router['delete'](_0xe18a('0xa'),auth['isAuthenticated'](),controller[_0xe18a('0xf')]);module[_0xe18a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 5c46349..848a55d 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 _0x8b29=['keyValue','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x26f375,_0x411d4e){var _0x3613f9=function(_0x481889){while(--_0x481889){_0x26f375['push'](_0x26f375['shift']());}};_0x3613f9(++_0x411d4e);}(_0x8b29,0x198));var _0x98b2=function(_0x4df01a,_0x44d9e1){_0x4df01a=_0x4df01a-0x0;var _0x528594=_0x8b29[_0x4df01a];return _0x528594;};'use strict';var Sequelize=require('sequelize');module[_0x98b2('0x0')]={'type':{'type':Sequelize[_0x98b2('0x1')](_0x98b2('0x2'),_0x98b2('0x3'),_0x98b2('0x4'),_0x98b2('0x5'),'picklist'),'defaultValue':_0x98b2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x98b2('0x2'),_0x98b2('0x3'),_0x98b2('0x4'))},'keyContent':{'type':Sequelize[_0x98b2('0x6')]},'idField':{'type':Sequelize[_0x98b2('0x6')]},'nameField':{'type':Sequelize[_0x98b2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98b2('0x6')]}}; \ No newline at end of file +var _0xc4b4=['exports','string','customVariable','keyValue','picklist','STRING','variable','sequelize'];(function(_0x15e955,_0x1a54b2){var _0x1bf344=function(_0x2e0996){while(--_0x2e0996){_0x15e955['push'](_0x15e955['shift']());}};_0x1bf344(++_0x1a54b2);}(_0xc4b4,0xd7));var _0x4c4b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc4b4[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x4c4b('0x0'));module[_0x4c4b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4c4b('0x2'),'variable',_0x4c4b('0x3'),_0x4c4b('0x4'),_0x4c4b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4c4b('0x6')]},'key':{'type':Sequelize[_0x4c4b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4c4b('0x2'),_0x4c4b('0x7'),_0x4c4b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4c4b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 423150d..486c200 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 _0x8148=['rows','catch','params','keys','options','create','body','update','find','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','destroy','then','end','error','name','send','index','VtigerField','rawAttributes','type','model','map','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x516856,_0x356418){var _0x3a4fcf=function(_0x447d01){while(--_0x447d01){_0x516856['push'](_0x516856['shift']());}};_0x3a4fcf(++_0x356418);}(_0x8148,0x121));var _0x8814=function(_0x28d89a,_0x31dd9a){_0x28d89a=_0x28d89a-0x0;var _0x111f8e=_0x8148[_0x28d89a];return _0x111f8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8814('0x0'));var zipdir=require(_0x8814('0x1'));var jsonpatch=require(_0x8814('0x2'));var rp=require('request-promise');var moment=require(_0x8814('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8814('0x4'));var sox=require('sox');var csv=require(_0x8814('0x5'));var ejs=require(_0x8814('0x6'));var fs=require('fs');var fs_extra=require(_0x8814('0x7'));var _=require(_0x8814('0x8'));var squel=require(_0x8814('0x9'));var crypto=require(_0x8814('0xa'));var jsforce=require(_0x8814('0xb'));var deskjs=require(_0x8814('0xc'));var toCsv=require(_0x8814('0x5'));var querystring=require(_0x8814('0xd'));var Papa=require(_0x8814('0xe'));var Redis=require(_0x8814('0xf'));var authService=require(_0x8814('0x10'));var qs=require(_0x8814('0x11'));var as=require(_0x8814('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8814('0x13'))(_0x8814('0x14'));var utils=require('../../config/utils');var config=require(_0x8814('0x15'));var licenseUtil=require(_0x8814('0x16'));var db=require(_0x8814('0x17'))['db'];function respondWithStatusCode(_0x1d52c2,_0x31ee1c){_0x31ee1c=_0x31ee1c||0xcc;return function(_0x3b3eaa){if(_0x3b3eaa){return _0x1d52c2[_0x8814('0x18')](_0x31ee1c);}return _0x1d52c2[_0x8814('0x19')](_0x31ee1c)['end']();};}function respondWithResult(_0x512767,_0x313569){_0x313569=_0x313569||0xc8;return function(_0x6d8129){if(_0x6d8129){return _0x512767[_0x8814('0x19')](_0x313569)[_0x8814('0x1a')](_0x6d8129);}};}function respondWithFilteredResult(_0xd8329d,_0x400201){return function(_0x4ec606){if(_0x4ec606){var _0x2fb00b=typeof _0x400201[_0x8814('0x1b')]===_0x8814('0x1c')&&typeof _0x400201['limit']===_0x8814('0x1c');var _0x4edd86=_0x4ec606[_0x8814('0x1d')];var _0xa68a8=_0x2fb00b?0x0:_0x400201[_0x8814('0x1b')];var _0x8659ea=_0x2fb00b?_0x4ec606[_0x8814('0x1d')]:_0x400201[_0x8814('0x1b')]+_0x400201[_0x8814('0x1e')];var _0x160c13;if(_0x8659ea>=_0x4edd86){_0x8659ea=_0x4edd86;_0x160c13=0xc8;}else{_0x160c13=0xce;}_0xd8329d[_0x8814('0x19')](_0x160c13);return _0xd8329d[_0x8814('0x1f')]('Content-Range',_0xa68a8+'-'+_0x8659ea+'/'+_0x4edd86)['json'](_0x4ec606);}return null;};}function patchUpdates(_0x3bf2a9){return function(_0x149578){try{jsonpatch['apply'](_0x149578,_0x3bf2a9,!![]);}catch(_0x4dac6d){return BPromise[_0x8814('0x20')](_0x4dac6d);}return _0x149578[_0x8814('0x21')]();};}function saveUpdates(_0x5001fd,_0x5702e8){return function(_0x1183a8){if(_0x1183a8){return _0x1183a8['update'](_0x5001fd)['then'](function(_0x1f03ac){return _0x1f03ac;});}return null;};}function removeEntity(_0xf5480d,_0x43f0ec){return function(_0x20220e){if(_0x20220e){return _0x20220e[_0x8814('0x22')]()[_0x8814('0x23')](function(){_0xf5480d[_0x8814('0x19')](0xcc)[_0x8814('0x24')]();});}};}function handleEntityNotFound(_0x390b56,_0x358907){return function(_0xc3eaef){if(!_0xc3eaef){_0x390b56[_0x8814('0x18')](0x194);}return _0xc3eaef;};}function handleError(_0x2b2c0a,_0x26843e){_0x26843e=_0x26843e||0x1f4;return function(_0x25bce9){logger[_0x8814('0x25')](_0x25bce9['stack']);if(_0x25bce9[_0x8814('0x26')]){delete _0x25bce9[_0x8814('0x26')];}_0x2b2c0a[_0x8814('0x19')](_0x26843e)[_0x8814('0x27')](_0x25bce9);};}exports[_0x8814('0x28')]=function(_0x2c3bbc,_0x4212a1){var _0x96a13={},_0x548bae={},_0x284a93={'count':0x0,'rows':[]};var _0x17df4e=_['map'](db[_0x8814('0x29')][_0x8814('0x2a')],function(_0x1c5244){return{'name':_0x1c5244['fieldName'],'type':_0x1c5244[_0x8814('0x2b')]['key']};});_0x548bae[_0x8814('0x2c')]=_[_0x8814('0x2d')](_0x17df4e,_0x8814('0x26'));_0x548bae['query']=_['keys'](_0x2c3bbc[_0x8814('0x2e')]);_0x548bae['filters']=_[_0x8814('0x2f')](_0x548bae[_0x8814('0x2c')],_0x548bae[_0x8814('0x2e')]);_0x96a13[_0x8814('0x30')]=_[_0x8814('0x2f')](_0x548bae[_0x8814('0x2c')],qs['fields'](_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x31')]));_0x96a13['attributes']=_0x96a13[_0x8814('0x30')]['length']?_0x96a13['attributes']:_0x548bae[_0x8814('0x2c')];if(!_0x2c3bbc[_0x8814('0x2e')]['hasOwnProperty'](_0x8814('0x32'))){_0x96a13[_0x8814('0x1e')]=qs[_0x8814('0x1e')](_0x2c3bbc['query'][_0x8814('0x1e')]);_0x96a13[_0x8814('0x1b')]=qs[_0x8814('0x1b')](_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x1b')]);}_0x96a13[_0x8814('0x33')]=qs['sort'](_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x34')]);_0x96a13['where']=qs[_0x8814('0x35')](_[_0x8814('0x36')](_0x2c3bbc['query'],_0x548bae[_0x8814('0x35')]),_0x17df4e);if(_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x37')]){_0x96a13[_0x8814('0x38')]=_[_0x8814('0x39')](_0x96a13[_0x8814('0x38')],{'$or':_[_0x8814('0x2d')](_0x17df4e,function(_0x50941d){if(_0x50941d[_0x8814('0x2b')]!==_0x8814('0x3a')){var _0x301fec={};_0x301fec[_0x50941d[_0x8814('0x26')]]={'$like':'%'+_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x37')]+'%'};return _0x301fec;}})});}_0x96a13=_[_0x8814('0x39')]({},_0x96a13,_0x2c3bbc['options']);var _0x507876={'where':_0x96a13[_0x8814('0x38')]};return db[_0x8814('0x29')][_0x8814('0x1d')](_0x507876)[_0x8814('0x23')](function(_0x56bf62){_0x284a93[_0x8814('0x1d')]=_0x56bf62;if(_0x2c3bbc[_0x8814('0x2e')][_0x8814('0x3b')]){_0x96a13[_0x8814('0x3c')]=[{'all':!![]}];}return db[_0x8814('0x29')]['findAll'](_0x96a13);})[_0x8814('0x23')](function(_0x52a1c0){_0x284a93[_0x8814('0x3d')]=_0x52a1c0;return _0x284a93;})[_0x8814('0x23')](respondWithFilteredResult(_0x4212a1,_0x96a13))[_0x8814('0x3e')](handleError(_0x4212a1,null));};exports['show']=function(_0x2ff68,_0x2c7024){var _0x43fb16={'raw':!![],'where':{'id':_0x2ff68[_0x8814('0x3f')]['id']}},_0x4d6730={};_0x4d6730[_0x8814('0x2c')]=_[_0x8814('0x40')](db[_0x8814('0x29')][_0x8814('0x2a')]);_0x4d6730[_0x8814('0x2e')]=_[_0x8814('0x40')](_0x2ff68[_0x8814('0x2e')]);_0x4d6730[_0x8814('0x35')]=_[_0x8814('0x2f')](_0x4d6730[_0x8814('0x2c')],_0x4d6730['query']);_0x43fb16[_0x8814('0x30')]=_[_0x8814('0x2f')](_0x4d6730[_0x8814('0x2c')],qs['fields'](_0x2ff68[_0x8814('0x2e')][_0x8814('0x31')]));_0x43fb16[_0x8814('0x30')]=_0x43fb16['attributes']['length']?_0x43fb16[_0x8814('0x30')]:_0x4d6730[_0x8814('0x2c')];if(_0x2ff68['query'][_0x8814('0x3b')]){_0x43fb16[_0x8814('0x3c')]=[{'all':!![]}];}_0x43fb16=_[_0x8814('0x39')]({},_0x43fb16,_0x2ff68[_0x8814('0x41')]);return db[_0x8814('0x29')]['find'](_0x43fb16)[_0x8814('0x23')](handleEntityNotFound(_0x2c7024,null))['then'](respondWithResult(_0x2c7024,null))[_0x8814('0x3e')](handleError(_0x2c7024,null));};exports[_0x8814('0x42')]=function(_0xa07635,_0x2192a0){return db['VtigerField'][_0x8814('0x42')](_0xa07635[_0x8814('0x43')],{})[_0x8814('0x23')](respondWithResult(_0x2192a0,0xc9))['catch'](handleError(_0x2192a0,null));};exports[_0x8814('0x44')]=function(_0x281781,_0x4948f7){if(_0x281781[_0x8814('0x43')]['id']){delete _0x281781[_0x8814('0x43')]['id'];}return db[_0x8814('0x29')]['find']({'where':{'id':_0x281781[_0x8814('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4948f7,null))[_0x8814('0x23')](saveUpdates(_0x281781[_0x8814('0x43')],null))[_0x8814('0x23')](respondWithResult(_0x4948f7,null))[_0x8814('0x3e')](handleError(_0x4948f7,null));};exports[_0x8814('0x22')]=function(_0x19be42,_0x1c48af){return db['VtigerField'][_0x8814('0x45')]({'where':{'id':_0x19be42[_0x8814('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1c48af,null))[_0x8814('0x23')](removeEntity(_0x1c48af,null))['catch'](handleError(_0x1c48af,null));}; \ No newline at end of file +var _0xfed2=['name','index','VtigerField','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','intersection','create','body','update','find','params','rimraf','zip-dir','fast-json-patch','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/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x3c7eef,_0x589a1d){var _0x132e8e=function(_0xb52bb){while(--_0xb52bb){_0x3c7eef['push'](_0x3c7eef['shift']());}};_0x132e8e(++_0x589a1d);}(_0xfed2,0x141));var _0x2fed=function(_0x1be1ac,_0x378236){_0x1be1ac=_0x1be1ac-0x0;var _0x379698=_0xfed2[_0x1be1ac];return _0x379698;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2fed('0x0'));var zipdir=require(_0x2fed('0x1'));var jsonpatch=require(_0x2fed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2fed('0x3'));var util=require(_0x2fed('0x4'));var path=require(_0x2fed('0x5'));var sox=require(_0x2fed('0x6'));var csv=require(_0x2fed('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fed('0x8'));var _=require(_0x2fed('0x9'));var squel=require(_0x2fed('0xa'));var crypto=require('crypto');var jsforce=require(_0x2fed('0xb'));var deskjs=require(_0x2fed('0xc'));var toCsv=require(_0x2fed('0x7'));var querystring=require(_0x2fed('0xd'));var Papa=require(_0x2fed('0xe'));var Redis=require(_0x2fed('0xf'));var authService=require(_0x2fed('0x10'));var qs=require(_0x2fed('0x11'));var as=require(_0x2fed('0x12'));var hardwareService=require(_0x2fed('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2fed('0x14'));var licenseUtil=require(_0x2fed('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x415d51,_0x15d123){_0x15d123=_0x15d123||0xcc;return function(_0x19bf43){if(_0x19bf43){return _0x415d51[_0x2fed('0x16')](_0x15d123);}return _0x415d51[_0x2fed('0x17')](_0x15d123)[_0x2fed('0x18')]();};}function respondWithResult(_0x503791,_0x1fba26){_0x1fba26=_0x1fba26||0xc8;return function(_0x3865e1){if(_0x3865e1){return _0x503791['status'](_0x1fba26)[_0x2fed('0x19')](_0x3865e1);}};}function respondWithFilteredResult(_0x30472a,_0x5e2c19){return function(_0x11c958){if(_0x11c958){var _0x435daf=typeof _0x5e2c19['offset']===_0x2fed('0x1a')&&typeof _0x5e2c19['limit']===_0x2fed('0x1a');var _0x442073=_0x11c958[_0x2fed('0x1b')];var _0xa3dfe2=_0x435daf?0x0:_0x5e2c19['offset'];var _0x324505=_0x435daf?_0x11c958['count']:_0x5e2c19[_0x2fed('0x1c')]+_0x5e2c19[_0x2fed('0x1d')];var _0x1b0b60;if(_0x324505>=_0x442073){_0x324505=_0x442073;_0x1b0b60=0xc8;}else{_0x1b0b60=0xce;}_0x30472a[_0x2fed('0x17')](_0x1b0b60);return _0x30472a[_0x2fed('0x1e')](_0x2fed('0x1f'),_0xa3dfe2+'-'+_0x324505+'/'+_0x442073)[_0x2fed('0x19')](_0x11c958);}return null;};}function patchUpdates(_0xdb584c){return function(_0x238f9a){try{jsonpatch[_0x2fed('0x20')](_0x238f9a,_0xdb584c,!![]);}catch(_0x344b83){return BPromise[_0x2fed('0x21')](_0x344b83);}return _0x238f9a[_0x2fed('0x22')]();};}function saveUpdates(_0x123a20,_0x21ae46){return function(_0x2ddc76){if(_0x2ddc76){return _0x2ddc76['update'](_0x123a20)[_0x2fed('0x23')](function(_0x34729b){return _0x34729b;});}return null;};}function removeEntity(_0x59ab2f,_0x59c526){return function(_0x47d559){if(_0x47d559){return _0x47d559[_0x2fed('0x24')]()[_0x2fed('0x23')](function(){_0x59ab2f[_0x2fed('0x17')](0xcc)[_0x2fed('0x18')]();});}};}function handleEntityNotFound(_0x42267f,_0x7a6512){return function(_0x546c80){if(!_0x546c80){_0x42267f['sendStatus'](0x194);}return _0x546c80;};}function handleError(_0x2fe215,_0x31793b){_0x31793b=_0x31793b||0x1f4;return function(_0x34c52c){logger[_0x2fed('0x25')](_0x34c52c[_0x2fed('0x26')]);if(_0x34c52c[_0x2fed('0x27')]){delete _0x34c52c['name'];}_0x2fe215[_0x2fed('0x17')](_0x31793b)['send'](_0x34c52c);};}exports[_0x2fed('0x28')]=function(_0x10d1d7,_0x36d0f8){var _0x478d5f={},_0x161f94={},_0x556e63={'count':0x0,'rows':[]};var _0xed13a2=_['map'](db[_0x2fed('0x29')][_0x2fed('0x2a')],function(_0x200f52){return{'name':_0x200f52[_0x2fed('0x2b')],'type':_0x200f52['type'][_0x2fed('0x2c')]};});_0x161f94['model']=_[_0x2fed('0x2d')](_0xed13a2,_0x2fed('0x27'));_0x161f94[_0x2fed('0x2e')]=_[_0x2fed('0x2f')](_0x10d1d7['query']);_0x161f94[_0x2fed('0x30')]=_['intersection'](_0x161f94[_0x2fed('0x31')],_0x161f94[_0x2fed('0x2e')]);_0x478d5f[_0x2fed('0x32')]=_['intersection'](_0x161f94[_0x2fed('0x31')],qs[_0x2fed('0x33')](_0x10d1d7[_0x2fed('0x2e')][_0x2fed('0x33')]));_0x478d5f[_0x2fed('0x32')]=_0x478d5f[_0x2fed('0x32')][_0x2fed('0x34')]?_0x478d5f[_0x2fed('0x32')]:_0x161f94[_0x2fed('0x31')];if(!_0x10d1d7['query']['hasOwnProperty']('nolimit')){_0x478d5f[_0x2fed('0x1d')]=qs[_0x2fed('0x1d')](_0x10d1d7[_0x2fed('0x2e')][_0x2fed('0x1d')]);_0x478d5f['offset']=qs[_0x2fed('0x1c')](_0x10d1d7[_0x2fed('0x2e')]['offset']);}_0x478d5f[_0x2fed('0x35')]=qs[_0x2fed('0x36')](_0x10d1d7['query'][_0x2fed('0x36')]);_0x478d5f[_0x2fed('0x37')]=qs[_0x2fed('0x30')](_[_0x2fed('0x38')](_0x10d1d7[_0x2fed('0x2e')],_0x161f94[_0x2fed('0x30')]),_0xed13a2);if(_0x10d1d7['query'][_0x2fed('0x39')]){_0x478d5f[_0x2fed('0x37')]=_['merge'](_0x478d5f[_0x2fed('0x37')],{'$or':_['map'](_0xed13a2,function(_0x16e75f){if(_0x16e75f['type']!==_0x2fed('0x3a')){var _0x49a586={};_0x49a586[_0x16e75f[_0x2fed('0x27')]]={'$like':'%'+_0x10d1d7[_0x2fed('0x2e')][_0x2fed('0x39')]+'%'};return _0x49a586;}})});}_0x478d5f=_[_0x2fed('0x3b')]({},_0x478d5f,_0x10d1d7[_0x2fed('0x3c')]);var _0x22ad63={'where':_0x478d5f[_0x2fed('0x37')]};return db['VtigerField'][_0x2fed('0x1b')](_0x22ad63)[_0x2fed('0x23')](function(_0x5c31bf){_0x556e63[_0x2fed('0x1b')]=_0x5c31bf;if(_0x10d1d7[_0x2fed('0x2e')][_0x2fed('0x3d')]){_0x478d5f[_0x2fed('0x3e')]=[{'all':!![]}];}return db[_0x2fed('0x29')][_0x2fed('0x3f')](_0x478d5f);})[_0x2fed('0x23')](function(_0x307866){_0x556e63['rows']=_0x307866;return _0x556e63;})[_0x2fed('0x23')](respondWithFilteredResult(_0x36d0f8,_0x478d5f))[_0x2fed('0x40')](handleError(_0x36d0f8,null));};exports[_0x2fed('0x41')]=function(_0x33476e,_0x5b0c65){var _0xbd3196={'raw':!![],'where':{'id':_0x33476e['params']['id']}},_0x6f6646={};_0x6f6646[_0x2fed('0x31')]=_['keys'](db[_0x2fed('0x29')][_0x2fed('0x2a')]);_0x6f6646['query']=_['keys'](_0x33476e[_0x2fed('0x2e')]);_0x6f6646[_0x2fed('0x30')]=_[_0x2fed('0x42')](_0x6f6646['model'],_0x6f6646[_0x2fed('0x2e')]);_0xbd3196[_0x2fed('0x32')]=_[_0x2fed('0x42')](_0x6f6646['model'],qs[_0x2fed('0x33')](_0x33476e[_0x2fed('0x2e')][_0x2fed('0x33')]));_0xbd3196['attributes']=_0xbd3196[_0x2fed('0x32')]['length']?_0xbd3196[_0x2fed('0x32')]:_0x6f6646[_0x2fed('0x31')];if(_0x33476e['query'][_0x2fed('0x3d')]){_0xbd3196[_0x2fed('0x3e')]=[{'all':!![]}];}_0xbd3196=_[_0x2fed('0x3b')]({},_0xbd3196,_0x33476e['options']);return db['VtigerField']['find'](_0xbd3196)[_0x2fed('0x23')](handleEntityNotFound(_0x5b0c65,null))['then'](respondWithResult(_0x5b0c65,null))['catch'](handleError(_0x5b0c65,null));};exports[_0x2fed('0x43')]=function(_0x1539b2,_0x254adb){return db['VtigerField']['create'](_0x1539b2[_0x2fed('0x44')],{})[_0x2fed('0x23')](respondWithResult(_0x254adb,0xc9))[_0x2fed('0x40')](handleError(_0x254adb,null));};exports[_0x2fed('0x45')]=function(_0x15f251,_0xf88fe){if(_0x15f251[_0x2fed('0x44')]['id']){delete _0x15f251[_0x2fed('0x44')]['id'];}return db['VtigerField'][_0x2fed('0x46')]({'where':{'id':_0x15f251[_0x2fed('0x47')]['id']}})[_0x2fed('0x23')](handleEntityNotFound(_0xf88fe,null))[_0x2fed('0x23')](saveUpdates(_0x15f251['body'],null))['then'](respondWithResult(_0xf88fe,null))['catch'](handleError(_0xf88fe,null));};exports[_0x2fed('0x24')]=function(_0x152013,_0x5477df){return db[_0x2fed('0x29')][_0x2fed('0x46')]({'where':{'id':_0x152013[_0x2fed('0x47')]['id']}})['then'](handleEntityNotFound(_0x5477df,null))['then'](removeEntity(_0x5477df,null))[_0x2fed('0x40')](handleError(_0x5477df,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4d4432e..ed43cfe 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 _0x1280=['path','rimraf','../../config/environment','exports','define','VtigerField','vtiger_unique_index','lodash','util','moment','bluebird'];(function(_0x5d8324,_0x3a353a){var _0x1c5903=function(_0x10d46a){while(--_0x10d46a){_0x5d8324['push'](_0x5d8324['shift']());}};_0x1c5903(++_0x3a353a);}(_0x1280,0x13b));var _0x0128=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1280[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x0128('0x0'));var util=require(_0x0128('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0128('0x2'));var BPromise=require(_0x0128('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0128('0x4'));var rimraf=require(_0x0128('0x5'));var config=require(_0x0128('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x0128('0x7')]=function(_0x2412e9,_0x136935){return _0x2412e9[_0x0128('0x8')](_0x0128('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x0128('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5c0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','lodash','../../config/logger','api'];(function(_0x11fd18,_0x4ce1a0){var _0x57fea3=function(_0x177faf){while(--_0x177faf){_0x11fd18['push'](_0x11fd18['shift']());}};_0x57fea3(++_0x4ce1a0);}(_0xe5c0,0x174));var _0x0e5c=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0xe5c0[_0x3bb63a];return _0x3b822a;};'use strict';var _=require(_0x0e5c('0x0'));var util=require('util');var logger=require(_0x0e5c('0x1'))(_0x0e5c('0x2'));var moment=require(_0x0e5c('0x3'));var BPromise=require(_0x0e5c('0x4'));var rp=require(_0x0e5c('0x5'));var fs=require('fs');var path=require(_0x0e5c('0x6'));var rimraf=require(_0x0e5c('0x7'));var config=require(_0x0e5c('0x8'));var attributes=require(_0x0e5c('0x9'));module[_0x0e5c('0xa')]=function(_0x571cae,_0x228310){return _0x571cae[_0x0e5c('0xb')](_0x0e5c('0xc'),attributes,{'tableName':_0x0e5c('0xd'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0e5c('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 7734b0d..faffe80 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 _0x04f4=['request','then','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x04f4,0xfc));var _0x404f=function(_0xefd94d,_0x26969e){_0xefd94d=_0xefd94d-0x0;var _0x2c771d=_0x04f4[_0xefd94d];return _0x2c771d;};'use strict';var _=require('lodash');var util=require(_0x404f('0x0'));var moment=require(_0x404f('0x1'));var BPromise=require(_0x404f('0x2'));var rs=require(_0x404f('0x3'));var fs=require('fs');var Redis=require(_0x404f('0x4'));var db=require(_0x404f('0x5'))['db'];var utils=require(_0x404f('0x6'));var logger=require(_0x404f('0x7'))('rpc');var config=require(_0x404f('0x8'));var jayson=require(_0x404f('0x9'));var client=jayson[_0x404f('0xa')][_0x404f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x489c4d,_0x7ec322,_0x279cdc){return new BPromise(function(_0x211763,_0x409f9c){return client[_0x404f('0xc')](_0x489c4d,_0x279cdc)[_0x404f('0xd')](function(_0x1fad13){logger['info'](_0x404f('0xe'),_0x7ec322,'request\x20sent');logger['debug'](_0x404f('0xf'),_0x7ec322,_0x404f('0x10'),JSON['stringify'](_0x1fad13));if(_0x1fad13[_0x404f('0x11')]){if(_0x1fad13[_0x404f('0x11')][_0x404f('0x12')]===0x1f4){logger['error'](_0x404f('0xe'),_0x7ec322,_0x1fad13[_0x404f('0x11')][_0x404f('0x13')]);return _0x409f9c(_0x1fad13[_0x404f('0x11')][_0x404f('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x7ec322,_0x1fad13[_0x404f('0x11')][_0x404f('0x13')]);return _0x211763(_0x1fad13['error']['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x7ec322,'request\x20sent');_0x211763(_0x1fad13[_0x404f('0x14')][_0x404f('0x13')]);}})[_0x404f('0x15')](function(_0x26153b){logger[_0x404f('0x11')](_0x404f('0xe'),_0x7ec322,_0x26153b);_0x409f9c(_0x26153b);});});} \ No newline at end of file +var _0xf04c=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf04c,0x16f));var _0xcf04=function(_0x5cd85e,_0x2c35fb){_0x5cd85e=_0x5cd85e-0x0;var _0x379b79=_0xf04c[_0x5cd85e];return _0x379b79;};'use strict';var _=require(_0xcf04('0x0'));var util=require(_0xcf04('0x1'));var moment=require(_0xcf04('0x2'));var BPromise=require(_0xcf04('0x3'));var rs=require(_0xcf04('0x4'));var fs=require('fs');var Redis=require(_0xcf04('0x5'));var db=require(_0xcf04('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf04('0x7'))(_0xcf04('0x8'));var config=require(_0xcf04('0x9'));var jayson=require(_0xcf04('0xa'));var client=jayson['client'][_0xcf04('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a0ee6,_0x4a0a9d,_0xe3c15e){return new BPromise(function(_0xd2be30,_0xb2e70e){return client[_0xcf04('0xc')](_0x4a0ee6,_0xe3c15e)[_0xcf04('0xd')](function(_0x2a8837){logger['info'](_0xcf04('0xe'),_0x4a0a9d,_0xcf04('0xf'));logger['debug'](_0xcf04('0x10'),_0x4a0a9d,_0xcf04('0xf'),JSON[_0xcf04('0x11')](_0x2a8837));if(_0x2a8837[_0xcf04('0x12')]){if(_0x2a8837[_0xcf04('0x12')][_0xcf04('0x13')]===0x1f4){logger[_0xcf04('0x12')](_0xcf04('0xe'),_0x4a0a9d,_0x2a8837[_0xcf04('0x12')][_0xcf04('0x14')]);return _0xb2e70e(_0x2a8837[_0xcf04('0x12')][_0xcf04('0x14')]);}logger['error'](_0xcf04('0xe'),_0x4a0a9d,_0x2a8837['error'][_0xcf04('0x14')]);return _0xd2be30(_0x2a8837[_0xcf04('0x12')][_0xcf04('0x14')]);}else{logger[_0xcf04('0x15')](_0xcf04('0xe'),_0x4a0a9d,_0xcf04('0xf'));_0xd2be30(_0x2a8837[_0xcf04('0x16')][_0xcf04('0x14')]);}})[_0xcf04('0x17')](function(_0x4247db){logger[_0xcf04('0x12')]('VtigerField,\x20%s,\x20%s',_0x4a0a9d,_0x4247db);_0xb2e70e(_0x4247db);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3019c5f..f84dedc 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 _0xf22e=['/:id/fields','post','create','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf22e,0x94));var _0xef22=function(_0x5a1071,_0x331154){_0x5a1071=_0x5a1071-0x0;var _0x57b6fb=_0xf22e[_0x5a1071];return _0x57b6fb;};'use strict';var multer=require('multer');var util=require(_0xef22('0x0'));var path=require(_0xef22('0x1'));var timeout=require(_0xef22('0x2'));var express=require(_0xef22('0x3'));var router=express[_0xef22('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef22('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xef22('0x6')]('/',auth['isAuthenticated'](),controller[_0xef22('0x7')]);router['get'](_0xef22('0x8'),auth[_0xef22('0x9')](),controller[_0xef22('0xa')]);router[_0xef22('0x6')](_0xef22('0xb'),auth[_0xef22('0x9')](),controller['getConfigurations']);router['get'](_0xef22('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xef22('0xd')]('/',auth['isAuthenticated'](),controller[_0xef22('0xe')]);router['post'](_0xef22('0xb'),auth[_0xef22('0x9')](),controller[_0xef22('0xf')]);router[_0xef22('0x10')](_0xef22('0x8'),auth[_0xef22('0x9')](),controller[_0xef22('0x11')]);router[_0xef22('0x12')]('/:id',auth[_0xef22('0x9')](),controller['destroy']);module[_0xef22('0x13')]=router; \ No newline at end of file +var _0xe933=['show','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x5b5842,_0x2f2eff){var _0x3f9ddc=function(_0x3a8005){while(--_0x3a8005){_0x5b5842['push'](_0x5b5842['shift']());}};_0x3f9ddc(++_0x2f2eff);}(_0xe933,0x9f));var _0x3e93=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe933[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x3e93('0x0'));var util=require('util');var path=require(_0x3e93('0x1'));var timeout=require(_0x3e93('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e93('0x3'));var auth=require(_0x3e93('0x4'));var interaction=require(_0x3e93('0x5'));var config=require(_0x3e93('0x6'));var controller=require(_0x3e93('0x7'));router[_0x3e93('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e93('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3e93('0x9')]);router[_0x3e93('0x8')]('/:id/configurations',auth[_0x3e93('0xa')](),controller[_0x3e93('0xb')]);router['get'](_0x3e93('0xc'),auth['isAuthenticated'](),controller[_0x3e93('0xd')]);router['post']('/',auth[_0x3e93('0xa')](),controller[_0x3e93('0xe')]);router[_0x3e93('0xf')](_0x3e93('0x10'),auth[_0x3e93('0xa')](),controller[_0x3e93('0x11')]);router[_0x3e93('0x12')]('/:id',auth[_0x3e93('0xa')](),controller[_0x3e93('0x13')]);router['delete']('/:id',auth[_0x3e93('0xa')](),controller['destroy']);module[_0x3e93('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ef8507e..f215bc1 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 _0x044a=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','password','token'];(function(_0x38e63e,_0x2a45fc){var _0x5df16f=function(_0x3ed5ef){while(--_0x3ed5ef){_0x38e63e['push'](_0x38e63e['shift']());}};_0x5df16f(++_0x2a45fc);}(_0x044a,0x173));var _0xa044=function(_0x295fd2,_0x21d77f){_0x295fd2=_0x295fd2-0x0;var _0x3ec8d1=_0x044a[_0x295fd2];return _0x3ec8d1;};'use strict';var Sequelize=require(_0xa044('0x0'));module[_0xa044('0x1')]={'name':{'type':Sequelize[_0xa044('0x2')]},'description':{'type':Sequelize[_0xa044('0x2')]},'username':{'type':Sequelize[_0xa044('0x2')],'unique':_0xa044('0x3')},'password':{'type':Sequelize[_0xa044('0x2')]},'token':{'type':Sequelize[_0xa044('0x2')]},'remoteUri':{'type':Sequelize[_0xa044('0x2')],'unique':_0xa044('0x4')},'authType':{'type':Sequelize['ENUM'](_0xa044('0x5'),_0xa044('0x6')),'defaultValue':_0xa044('0x5')},'serverUrl':{'type':Sequelize[_0xa044('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa044('0x7'),_0xa044('0x8')),'defaultValue':_0xa044('0x7')}}; \ No newline at end of file +var _0x82d8=['password','token','integrationTab','sequelize','STRING','username','ENUM'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x82d8,0xff));var _0x882d=function(_0x2d135e,_0x195eee){_0x2d135e=_0x2d135e-0x0;var _0x3a805b=_0x82d8[_0x2d135e];return _0x3a805b;};'use strict';var Sequelize=require(_0x882d('0x0'));module['exports']={'name':{'type':Sequelize[_0x882d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x882d('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x882d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x882d('0x3')](_0x882d('0x4'),_0x882d('0x5')),'defaultValue':_0x882d('0x4')},'serverUrl':{'type':Sequelize[_0x882d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x882d('0x3')](_0x882d('0x6'),'newTab'),'defaultValue':_0x882d('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bc6f88d..5f3d924 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 _0xe605=['password','token','authType','remoteUri','slice','GET','format','headers','Basic\x20%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','ZendeskAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','rawAttributes','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username'];(function(_0x4f6037,_0x8e0a90){var _0x2542e2=function(_0x25528f){while(--_0x25528f){_0x4f6037['push'](_0x4f6037['shift']());}};_0x2542e2(++_0x8e0a90);}(_0xe605,0x92));var _0x5e60=function(_0xde4a94,_0x78888f){_0xde4a94=_0xde4a94-0x0;var _0xe4d81e=_0xe605[_0xde4a94];return _0xe4d81e;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5e60('0x19'));function respondWithStatusCode(_0x178782,_0x1f4e14){_0x1f4e14=_0x1f4e14||0xcc;return function(_0xe039de){if(_0xe039de){return _0x178782[_0x5e60('0x1a')](_0x1f4e14);}return _0x178782[_0x5e60('0x1b')](_0x1f4e14)['end']();};}function respondWithResult(_0x209adb,_0x45304f){_0x45304f=_0x45304f||0xc8;return function(_0x21e3c8){if(_0x21e3c8){return _0x209adb[_0x5e60('0x1b')](_0x45304f)['json'](_0x21e3c8);}};}function respondWithFilteredResult(_0x20af5f,_0x529ffe){return function(_0x1ffd77){if(_0x1ffd77){var _0x3bc7d8=typeof _0x529ffe['offset']===_0x5e60('0x1c')&&typeof _0x529ffe[_0x5e60('0x1d')]===_0x5e60('0x1c');var _0x43045a=_0x1ffd77['count'];var _0xdd0a71=_0x3bc7d8?0x0:_0x529ffe[_0x5e60('0x1e')];var _0x52cc15=_0x3bc7d8?_0x1ffd77[_0x5e60('0x1f')]:_0x529ffe[_0x5e60('0x1e')]+_0x529ffe[_0x5e60('0x1d')];var _0x311fef;if(_0x52cc15>=_0x43045a){_0x52cc15=_0x43045a;_0x311fef=0xc8;}else{_0x311fef=0xce;}_0x20af5f[_0x5e60('0x1b')](_0x311fef);return _0x20af5f[_0x5e60('0x20')](_0x5e60('0x21'),_0xdd0a71+'-'+_0x52cc15+'/'+_0x43045a)[_0x5e60('0x22')](_0x1ffd77);}return null;};}function patchUpdates(_0x3282e4){return function(_0x45f1a6){try{jsonpatch[_0x5e60('0x23')](_0x45f1a6,_0x3282e4,!![]);}catch(_0x578437){return BPromise[_0x5e60('0x24')](_0x578437);}return _0x45f1a6['save']();};}function saveUpdates(_0x376069,_0x1a44e5){return function(_0x2b0bae){if(_0x2b0bae){return _0x2b0bae[_0x5e60('0x25')](_0x376069)[_0x5e60('0x26')](function(_0x2a499e){return _0x2a499e;});}return null;};}function removeEntity(_0x2636f1,_0x5d2c03){return function(_0x18d527){if(_0x18d527){return _0x18d527[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2636f1['status'](0xcc)[_0x5e60('0x28')]();});}};}function handleEntityNotFound(_0x56e3a5,_0x2d8aac){return function(_0x153459){if(!_0x153459){_0x56e3a5['sendStatus'](0x194);}return _0x153459;};}function handleError(_0x3bedea,_0x5712f7){_0x5712f7=_0x5712f7||0x1f4;return function(_0x23d187){logger[_0x5e60('0x29')](_0x23d187['stack']);if(_0x23d187[_0x5e60('0x2a')]){delete _0x23d187[_0x5e60('0x2a')];}_0x3bedea['status'](_0x5712f7)[_0x5e60('0x2b')](_0x23d187);};}exports[_0x5e60('0x2c')]=function(_0x52c97c,_0x5431a8){var _0x52f668={},_0xf25956={},_0x235cc7={'count':0x0,'rows':[]};var _0x2e8e9e=_[_0x5e60('0x2d')](db[_0x5e60('0x2e')]['rawAttributes'],function(_0x168ce6){return{'name':_0x168ce6[_0x5e60('0x2f')],'type':_0x168ce6['type'][_0x5e60('0x30')]};});_0xf25956['model']=_['map'](_0x2e8e9e,_0x5e60('0x2a'));_0xf25956[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x52c97c[_0x5e60('0x31')]);_0xf25956[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0xf25956[_0x5e60('0x35')],_0xf25956[_0x5e60('0x31')]);_0x52f668[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0xf25956['model'],qs[_0x5e60('0x37')](_0x52c97c['query']['fields']));_0x52f668[_0x5e60('0x36')]=_0x52f668[_0x5e60('0x36')]['length']?_0x52f668[_0x5e60('0x36')]:_0xf25956['model'];if(!_0x52c97c[_0x5e60('0x31')][_0x5e60('0x38')](_0x5e60('0x39'))){_0x52f668[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x52f668[_0x5e60('0x1e')]=qs['offset'](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x1e')]);}_0x52f668[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x52f668[_0x5e60('0x3c')]=qs['filters'](_[_0x5e60('0x3d')](_0x52c97c[_0x5e60('0x31')],_0xf25956['filters']),_0x2e8e9e);if(_0x52c97c['query'][_0x5e60('0x3e')]){_0x52f668[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x52f668[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x2e8e9e,function(_0x4d2cd0){if(_0x4d2cd0[_0x5e60('0x40')]!==_0x5e60('0x41')){var _0x415208={};_0x415208[_0x4d2cd0[_0x5e60('0x2a')]]={'$like':'%'+_0x52c97c[_0x5e60('0x31')][_0x5e60('0x3e')]+'%'};return _0x415208;}})});}_0x52f668=_[_0x5e60('0x3f')]({},_0x52f668,_0x52c97c['options']);var _0x401bf1={'where':_0x52f668[_0x5e60('0x3c')]};return db['ZendeskAccount']['count'](_0x401bf1)['then'](function(_0x15a97b){_0x235cc7[_0x5e60('0x1f')]=_0x15a97b;if(_0x52c97c[_0x5e60('0x31')][_0x5e60('0x42')]){_0x52f668['include']=[{'all':!![]}];}return db[_0x5e60('0x2e')][_0x5e60('0x43')](_0x52f668);})['then'](function(_0x5bda22){_0x235cc7[_0x5e60('0x44')]=_0x5bda22;return _0x235cc7;})[_0x5e60('0x26')](respondWithFilteredResult(_0x5431a8,_0x52f668))[_0x5e60('0x45')](handleError(_0x5431a8,null));};exports[_0x5e60('0x46')]=function(_0x39ab09,_0x3899ae){var _0x2522d2={'raw':![],'where':{'id':_0x39ab09[_0x5e60('0x47')]['id']}},_0x2812e1={};_0x2812e1['model']=_[_0x5e60('0x32')](db[_0x5e60('0x2e')]['rawAttributes']);_0x2812e1[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x39ab09[_0x5e60('0x31')]);_0x2812e1[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2812e1['model'],_0x2812e1[_0x5e60('0x31')]);_0x2522d2[_0x5e60('0x36')]=_[_0x5e60('0x34')](_0x2812e1[_0x5e60('0x35')],qs['fields'](_0x39ab09['query']['fields']));_0x2522d2[_0x5e60('0x36')]=_0x2522d2[_0x5e60('0x36')][_0x5e60('0x48')]?_0x2522d2[_0x5e60('0x36')]:_0x2812e1[_0x5e60('0x35')];if(_0x39ab09[_0x5e60('0x31')]['includeAll']){_0x2522d2[_0x5e60('0x49')]=[{'all':!![]}];}_0x2522d2=_[_0x5e60('0x3f')]({},_0x2522d2,_0x39ab09[_0x5e60('0x4a')]);return db[_0x5e60('0x2e')][_0x5e60('0x4b')](_0x2522d2)[_0x5e60('0x26')](handleEntityNotFound(_0x3899ae,null))[_0x5e60('0x26')](respondWithResult(_0x3899ae,null))['catch'](handleError(_0x3899ae,null));};exports[_0x5e60('0x4c')]=function(_0x3ed45d,_0x21a116){return db[_0x5e60('0x2e')][_0x5e60('0x4c')](_0x3ed45d[_0x5e60('0x4d')],{})[_0x5e60('0x26')](respondWithResult(_0x21a116,0xc9))[_0x5e60('0x45')](handleError(_0x21a116,null));};exports[_0x5e60('0x25')]=function(_0x350d6d,_0xe5e675){if(_0x350d6d[_0x5e60('0x4d')]['id']){delete _0x350d6d[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x350d6d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0xe5e675,null))[_0x5e60('0x26')](saveUpdates(_0x350d6d['body'],null))['then'](respondWithResult(_0xe5e675,null))[_0x5e60('0x45')](handleError(_0xe5e675,null));};exports['destroy']=function(_0x3525d,_0x1d247e){return db[_0x5e60('0x2e')][_0x5e60('0x4b')]({'where':{'id':_0x3525d[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x1d247e,null))['then'](removeEntity(_0x1d247e,null))['catch'](handleError(_0x1d247e,null));};exports[_0x5e60('0x4e')]=function(_0x1e4e41,_0x457c37,_0x4a2d67){var _0x594068={};var _0x31ced8={};var _0x46f3ba;var _0x179cc6;return db['ZendeskAccount'][_0x5e60('0x4f')]({'where':{'id':_0x1e4e41[_0x5e60('0x47')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x457c37,null))[_0x5e60('0x26')](function(_0x17d002){if(_0x17d002){_0x46f3ba=_0x17d002;_0x31ced8[_0x5e60('0x35')]=_['keys'](db[_0x5e60('0x50')][_0x5e60('0x51')]);_0x31ced8['query']=_[_0x5e60('0x32')](_0x1e4e41[_0x5e60('0x31')]);_0x31ced8[_0x5e60('0x33')]=_['intersection'](_0x31ced8[_0x5e60('0x35')],_0x31ced8[_0x5e60('0x31')]);_0x594068['attributes']=_[_0x5e60('0x34')](_0x31ced8[_0x5e60('0x35')],qs[_0x5e60('0x37')](_0x1e4e41[_0x5e60('0x31')]['fields']));_0x594068[_0x5e60('0x36')]=_0x594068[_0x5e60('0x36')]['length']?_0x594068[_0x5e60('0x36')]:_0x31ced8['model'];_0x594068[_0x5e60('0x3a')]=qs['sort'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x3b')]);_0x594068['where']=qs[_0x5e60('0x33')](_['pick'](_0x1e4e41[_0x5e60('0x31')],_0x31ced8['filters']));if(_0x1e4e41[_0x5e60('0x31')]['filter']){_0x594068[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x594068[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2d')](_0x594068[_0x5e60('0x36')],function(_0x2b8343){var _0x3d1e35={};_0x3d1e35[_0x2b8343]={'$like':'%'+_0x1e4e41['query'][_0x5e60('0x3e')]+'%'};return _0x3d1e35;})});}_0x594068=_[_0x5e60('0x3f')]({},_0x594068,_0x1e4e41[_0x5e60('0x4a')]);return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0x35aad7){if(_0x35aad7){_0x179cc6=_0x35aad7['length'];if(!_0x1e4e41['query']['hasOwnProperty'](_0x5e60('0x39'))){_0x594068[_0x5e60('0x1d')]=qs['limit'](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1d')]);_0x594068['offset']=qs[_0x5e60('0x1e')](_0x1e4e41[_0x5e60('0x31')][_0x5e60('0x1e')]);}return _0x46f3ba[_0x5e60('0x4e')](_0x594068);}})[_0x5e60('0x26')](function(_0xcd2232){if(_0xcd2232){return _0xcd2232?{'count':_0x179cc6,'rows':_0xcd2232}:null;}})[_0x5e60('0x26')](respondWithResult(_0x457c37,null))[_0x5e60('0x45')](handleError(_0x457c37,null));};exports[_0x5e60('0x52')]=function(_0x406c3a,_0x157aad,_0x15921d){if(_0x406c3a[_0x5e60('0x4d')]['id']){delete _0x406c3a[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2e')][_0x5e60('0x4f')]({'where':{'id':_0x406c3a[_0x5e60('0x47')]['id']}})['then'](handleEntityNotFound(_0x157aad,null))[_0x5e60('0x26')](function(_0x1706d6){if(_0x1706d6){_0x406c3a[_0x5e60('0x4d')]['AccountId']=_0x1706d6['id'];_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x53')]=integrations['getSubjects'](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a['body'][_0x5e60('0x40')]);_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x55')]=integrations[_0x5e60('0x56')](_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x54')],_0x406c3a[_0x5e60('0x4d')][_0x5e60('0x40')]);return db[_0x5e60('0x50')]['create'](_0x406c3a[_0x5e60('0x4d')],{'include':[{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x53')},{'model':db['ZendeskField'],'as':_0x5e60('0x55')}]});}return null;})[_0x5e60('0x26')](respondWithResult(_0x157aad,null))[_0x5e60('0x45')](handleError(_0x157aad,null));};exports[_0x5e60('0x58')]=function(_0x3e85fe,_0x559f8c,_0x4560e1){var _0x213c7e='';return db[_0x5e60('0x2e')]['findOne']({'where':{'id':_0x3e85fe['params']['id']},'attributes':['id',_0x5e60('0x59'),_0x5e60('0x5a'),_0x5e60('0x5b'),_0x5e60('0x5c'),_0x5e60('0x5d')]})[_0x5e60('0x26')](handleEntityNotFound(_0x559f8c,null))[_0x5e60('0x26')](function(_0x563e69){if(_0x563e69){_0x213c7e=_0x563e69[_0x5e60('0x5d')];var _0x199edd=_0x213c7e[_0x5e60('0x5e')](-0x1);if(_0x199edd==='/'){_0x213c7e=_0x213c7e['substring'](0x0,_0x213c7e['lastIndexOf'](_0x199edd));}var _0x447bd3={'method':_0x5e60('0x5f'),'uri':util[_0x5e60('0x60')]('%s/%s',_0x213c7e,'ticket_fields'),'json':!![]};switch(_0x563e69[_0x5e60('0x5c')]){case _0x5e60('0x5a'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5a')]))[_0x5e60('0x63')](_0x5e60('0x64')))};break;case _0x5e60('0x5b'):_0x447bd3[_0x5e60('0x61')]={'Authorization':util[_0x5e60('0x60')](_0x5e60('0x62'),new Buffer(util[_0x5e60('0x60')]('%s/token:%s',_0x563e69[_0x5e60('0x59')],_0x563e69[_0x5e60('0x5b')]))['toString'](_0x5e60('0x64')))};break;default:throw new db[(_0x5e60('0x65'))]['ValidationError'](_0x5e60('0x66'));}return rp(_0x447bd3);}})[_0x5e60('0x26')](function(_0x391505){if(_0x391505){var _0x1b4aee=[_0x5e60('0x67'),_0x5e60('0x68'),'group',_0x5e60('0x69')];_[_0x5e60('0x6a')](_0x391505[_0x5e60('0x6b')],function(_0x222d94){return _0x1b4aee[_0x5e60('0x6c')](_0x222d94[_0x5e60('0x40')]);});return{'count':_0x391505[_0x5e60('0x6b')][_0x5e60('0x48')],'rows':_[_0x5e60('0x2d')](_0x391505['ticket_fields'],function(_0x10b77b){return{'id':_0x10b77b['id'],'name':_0x10b77b[_0x5e60('0x6d')]>0x7?_0x10b77b[_0x5e60('0x6e')]:_0x10b77b[_0x5e60('0x40')],'custom':_0x10b77b[_0x5e60('0x6d')]>0x7?!![]:![],'options':_0x10b77b[_0x5e60('0x6f')]?_0x10b77b[_0x5e60('0x6f')]:_0x10b77b[_0x5e60('0x70')]?_0x10b77b[_0x5e60('0x70')]:[]};})};}})[_0x5e60('0x26')](respondWithResult(_0x559f8c,null))['catch'](function(_0x5ab78f){var _0x5d2839=_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?0x1f4:_0x5ab78f[_0x5e60('0x72')]||0x1f4;logger[_0x5e60('0x29')](_0x5e60('0x73'),_0x5e60('0x58'),_0x5d2839,JSON[_0x5e60('0x74')](_0x5ab78f));delete _0x5ab78f[_0x5e60('0x2a')];if(_0x5d2839===0x191){_0x5d2839=0x190;}_0x559f8c[_0x5e60('0x1b')](_0x5d2839)['send'](_0x3e85fe[_0x5e60('0x31')][_0x5e60('0x71')]?{'message':_0x5e60('0x75'),'statusCode':_0x5ab78f['statusCode']}:_0x5ab78f);});}; \ No newline at end of file +var _0x750a=['crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','then','error','name','index','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','rows','catch','show','params','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','substring','lastIndexOf','GET','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','token','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','title','position','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x750a,0x140));var _0xa750=function(_0x50eba8,_0x175ae4){_0x50eba8=_0x50eba8-0x0;var _0x52615b=_0x750a[_0x50eba8];return _0x52615b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa750('0x15'));function respondWithStatusCode(_0x1c5657,_0x344c67){_0x344c67=_0x344c67||0xcc;return function(_0x567c51){if(_0x567c51){return _0x1c5657[_0xa750('0x16')](_0x344c67);}return _0x1c5657[_0xa750('0x17')](_0x344c67)[_0xa750('0x18')]();};}function respondWithResult(_0x24e48a,_0xa66181){_0xa66181=_0xa66181||0xc8;return function(_0x339329){if(_0x339329){return _0x24e48a['status'](_0xa66181)[_0xa750('0x19')](_0x339329);}};}function respondWithFilteredResult(_0x8488ea,_0x290d46){return function(_0x49fe3b){if(_0x49fe3b){var _0x337095=typeof _0x290d46[_0xa750('0x1a')]==='undefined'&&typeof _0x290d46['limit']===_0xa750('0x1b');var _0x5b1e6b=_0x49fe3b[_0xa750('0x1c')];var _0x1bde87=_0x337095?0x0:_0x290d46['offset'];var _0x36dcca=_0x337095?_0x49fe3b['count']:_0x290d46['offset']+_0x290d46[_0xa750('0x1d')];var _0x5d0935;if(_0x36dcca>=_0x5b1e6b){_0x36dcca=_0x5b1e6b;_0x5d0935=0xc8;}else{_0x5d0935=0xce;}_0x8488ea[_0xa750('0x17')](_0x5d0935);return _0x8488ea['set'](_0xa750('0x1e'),_0x1bde87+'-'+_0x36dcca+'/'+_0x5b1e6b)['json'](_0x49fe3b);}return null;};}function patchUpdates(_0x3dc7f1){return function(_0x500922){try{jsonpatch[_0xa750('0x1f')](_0x500922,_0x3dc7f1,!![]);}catch(_0x4d1939){return BPromise['reject'](_0x4d1939);}return _0x500922[_0xa750('0x20')]();};}function saveUpdates(_0x52da84,_0x216fbf){return function(_0x5a9d96){if(_0x5a9d96){return _0x5a9d96['update'](_0x52da84)['then'](function(_0x5d758e){return _0x5d758e;});}return null;};}function removeEntity(_0x15d72f,_0x2ec6c4){return function(_0x2c43ef){if(_0x2c43ef){return _0x2c43ef[_0xa750('0x21')]()[_0xa750('0x22')](function(){_0x15d72f[_0xa750('0x17')](0xcc)[_0xa750('0x18')]();});}};}function handleEntityNotFound(_0x7e22ad,_0x3d52b3){return function(_0x94697a){if(!_0x94697a){_0x7e22ad[_0xa750('0x16')](0x194);}return _0x94697a;};}function handleError(_0x27a5eb,_0x31ea63){_0x31ea63=_0x31ea63||0x1f4;return function(_0x3f7d6d){logger[_0xa750('0x23')](_0x3f7d6d['stack']);if(_0x3f7d6d[_0xa750('0x24')]){delete _0x3f7d6d[_0xa750('0x24')];}_0x27a5eb[_0xa750('0x17')](_0x31ea63)['send'](_0x3f7d6d);};}exports[_0xa750('0x25')]=function(_0x6ade2b,_0x3270e3){var _0x1223d2={},_0x579f1c={},_0x297eef={'count':0x0,'rows':[]};var _0x34d5e9=_[_0xa750('0x26')](db[_0xa750('0x27')][_0xa750('0x28')],function(_0x59ab33){return{'name':_0x59ab33[_0xa750('0x29')],'type':_0x59ab33['type'][_0xa750('0x2a')]};});_0x579f1c[_0xa750('0x2b')]=_['map'](_0x34d5e9,_0xa750('0x24'));_0x579f1c[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0x6ade2b[_0xa750('0x2c')]);_0x579f1c[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x579f1c[_0xa750('0x2b')],_0x579f1c[_0xa750('0x2c')]);_0x1223d2['attributes']=_[_0xa750('0x2f')](_0x579f1c['model'],qs[_0xa750('0x30')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x30')]));_0x1223d2[_0xa750('0x31')]=_0x1223d2['attributes'][_0xa750('0x32')]?_0x1223d2[_0xa750('0x31')]:_0x579f1c['model'];if(!_0x6ade2b[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x1223d2[_0xa750('0x1d')]=qs['limit'](_0x6ade2b[_0xa750('0x2c')]['limit']);_0x1223d2['offset']=qs[_0xa750('0x1a')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x1a')]);}_0x1223d2['order']=qs[_0xa750('0x35')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x35')]);_0x1223d2['where']=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x6ade2b[_0xa750('0x2c')],_0x579f1c['filters']),_0x34d5e9);if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x37')]){_0x1223d2[_0xa750('0x38')]=_['merge'](_0x1223d2[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x34d5e9,function(_0x1e579b){if(_0x1e579b[_0xa750('0x39')]!=='VIRTUAL'){var _0x4dc0b8={};_0x4dc0b8[_0x1e579b[_0xa750('0x24')]]={'$like':'%'+_0x6ade2b[_0xa750('0x2c')]['filter']+'%'};return _0x4dc0b8;}})});}_0x1223d2=_[_0xa750('0x3a')]({},_0x1223d2,_0x6ade2b[_0xa750('0x3b')]);var _0x15d35a={'where':_0x1223d2[_0xa750('0x38')]};return db[_0xa750('0x27')]['count'](_0x15d35a)[_0xa750('0x22')](function(_0x2b33e0){_0x297eef[_0xa750('0x1c')]=_0x2b33e0;if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x3c')]){_0x1223d2[_0xa750('0x3d')]=[{'all':!![]}];}return db[_0xa750('0x27')]['findAll'](_0x1223d2);})[_0xa750('0x22')](function(_0x5e9ffb){_0x297eef[_0xa750('0x3e')]=_0x5e9ffb;return _0x297eef;})['then'](respondWithFilteredResult(_0x3270e3,_0x1223d2))[_0xa750('0x3f')](handleError(_0x3270e3,null));};exports[_0xa750('0x40')]=function(_0xf9fd5f,_0x1be24e){var _0x430d60={'raw':![],'where':{'id':_0xf9fd5f[_0xa750('0x41')]['id']}},_0xe27272={};_0xe27272[_0xa750('0x2b')]=_[_0xa750('0x2d')](db[_0xa750('0x27')][_0xa750('0x28')]);_0xe27272[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0xf9fd5f[_0xa750('0x2c')]);_0xe27272[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0xe27272[_0xa750('0x2b')],_0xe27272[_0xa750('0x2c')]);_0x430d60[_0xa750('0x31')]=_[_0xa750('0x2f')](_0xe27272['model'],qs[_0xa750('0x30')](_0xf9fd5f[_0xa750('0x2c')][_0xa750('0x30')]));_0x430d60[_0xa750('0x31')]=_0x430d60[_0xa750('0x31')][_0xa750('0x32')]?_0x430d60[_0xa750('0x31')]:_0xe27272[_0xa750('0x2b')];if(_0xf9fd5f[_0xa750('0x2c')]['includeAll']){_0x430d60[_0xa750('0x3d')]=[{'all':!![]}];}_0x430d60=_[_0xa750('0x3a')]({},_0x430d60,_0xf9fd5f['options']);return db[_0xa750('0x27')][_0xa750('0x42')](_0x430d60)[_0xa750('0x22')](handleEntityNotFound(_0x1be24e,null))[_0xa750('0x22')](respondWithResult(_0x1be24e,null))[_0xa750('0x3f')](handleError(_0x1be24e,null));};exports[_0xa750('0x43')]=function(_0x5e7a95,_0x278c22){return db[_0xa750('0x27')][_0xa750('0x43')](_0x5e7a95['body'],{})[_0xa750('0x22')](respondWithResult(_0x278c22,0xc9))[_0xa750('0x3f')](handleError(_0x278c22,null));};exports['update']=function(_0x93e49f,_0x2397e1){if(_0x93e49f[_0xa750('0x44')]['id']){delete _0x93e49f['body']['id'];}return db[_0xa750('0x27')][_0xa750('0x42')]({'where':{'id':_0x93e49f[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0x2397e1,null))['then'](saveUpdates(_0x93e49f[_0xa750('0x44')],null))[_0xa750('0x22')](respondWithResult(_0x2397e1,null))[_0xa750('0x3f')](handleError(_0x2397e1,null));};exports[_0xa750('0x21')]=function(_0x4ce363,_0x203f2a){return db[_0xa750('0x27')]['find']({'where':{'id':_0x4ce363[_0xa750('0x41')]['id']}})['then'](handleEntityNotFound(_0x203f2a,null))[_0xa750('0x22')](removeEntity(_0x203f2a,null))[_0xa750('0x3f')](handleError(_0x203f2a,null));};exports['getConfigurations']=function(_0x47e93c,_0x58eba1,_0x232da4){var _0x401125={};var _0x4ea12b={};var _0xe88dc;var _0x1a79a9;return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x47e93c['params']['id']}})['then'](handleEntityNotFound(_0x58eba1,null))['then'](function(_0x3c34d4){if(_0x3c34d4){_0xe88dc=_0x3c34d4;_0x4ea12b['model']=_[_0xa750('0x2d')](db[_0xa750('0x45')]['rawAttributes']);_0x4ea12b[_0xa750('0x2c')]=_['keys'](_0x47e93c[_0xa750('0x2c')]);_0x4ea12b['filters']=_['intersection'](_0x4ea12b['model'],_0x4ea12b['query']);_0x401125[_0xa750('0x31')]=_[_0xa750('0x2f')](_0x4ea12b['model'],qs['fields'](_0x47e93c['query'][_0xa750('0x30')]));_0x401125[_0xa750('0x31')]=_0x401125[_0xa750('0x31')][_0xa750('0x32')]?_0x401125[_0xa750('0x31')]:_0x4ea12b[_0xa750('0x2b')];_0x401125['order']=qs['sort'](_0x47e93c[_0xa750('0x2c')][_0xa750('0x35')]);_0x401125[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x47e93c['query'],_0x4ea12b[_0xa750('0x2e')]));if(_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]){_0x401125[_0xa750('0x38')]=_[_0xa750('0x3a')](_0x401125[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x401125[_0xa750('0x31')],function(_0x5e78f1){var _0x2aa1d6={};_0x2aa1d6[_0x5e78f1]={'$like':'%'+_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]+'%'};return _0x2aa1d6;})});}_0x401125=_[_0xa750('0x3a')]({},_0x401125,_0x47e93c[_0xa750('0x3b')]);return _0xe88dc['getConfigurations'](_0x401125);}})[_0xa750('0x22')](function(_0x25248f){if(_0x25248f){_0x1a79a9=_0x25248f[_0xa750('0x32')];if(!_0x47e93c[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x401125[_0xa750('0x1d')]=qs[_0xa750('0x1d')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1d')]);_0x401125[_0xa750('0x1a')]=qs[_0xa750('0x1a')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1a')]);}return _0xe88dc[_0xa750('0x46')](_0x401125);}})[_0xa750('0x22')](function(_0x49e132){if(_0x49e132){return _0x49e132?{'count':_0x1a79a9,'rows':_0x49e132}:null;}})[_0xa750('0x22')](respondWithResult(_0x58eba1,null))['catch'](handleError(_0x58eba1,null));};exports[_0xa750('0x47')]=function(_0x2d488d,_0xbe7451,_0x5845c5){if(_0x2d488d[_0xa750('0x44')]['id']){delete _0x2d488d[_0xa750('0x44')]['id'];}return db[_0xa750('0x27')][_0xa750('0x48')]({'where':{'id':_0x2d488d[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0xbe7451,null))['then'](function(_0x3001d7){if(_0x3001d7){_0x2d488d[_0xa750('0x44')]['AccountId']=_0x3001d7['id'];_0x2d488d[_0xa750('0x44')][_0xa750('0x49')]=integrations[_0xa750('0x4a')](_0x2d488d[_0xa750('0x44')][_0xa750('0x4b')],_0x2d488d[_0xa750('0x44')][_0xa750('0x39')]);_0x2d488d[_0xa750('0x44')][_0xa750('0x4c')]=integrations[_0xa750('0x4d')](_0x2d488d[_0xa750('0x44')]['channel'],_0x2d488d['body'][_0xa750('0x39')]);return db[_0xa750('0x45')][_0xa750('0x43')](_0x2d488d[_0xa750('0x44')],{'include':[{'model':db['ZendeskField'],'as':_0xa750('0x49')},{'model':db[_0xa750('0x4e')],'as':_0xa750('0x4c')}]});}return null;})[_0xa750('0x22')](respondWithResult(_0xbe7451,null))[_0xa750('0x3f')](handleError(_0xbe7451,null));};exports[_0xa750('0x4f')]=function(_0x17b25e,_0x5d883d,_0x1dcc15){var _0x2783b9='';return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x17b25e['params']['id']},'attributes':['id',_0xa750('0x50'),'password','token',_0xa750('0x51'),_0xa750('0x52')]})[_0xa750('0x22')](handleEntityNotFound(_0x5d883d,null))[_0xa750('0x22')](function(_0x292dab){if(_0x292dab){_0x2783b9=_0x292dab['remoteUri'];var _0x3ac9a2=_0x2783b9[_0xa750('0x53')](-0x1);if(_0x3ac9a2==='/'){_0x2783b9=_0x2783b9[_0xa750('0x54')](0x0,_0x2783b9[_0xa750('0x55')](_0x3ac9a2));}var _0x439dce={'method':_0xa750('0x56'),'uri':util['format']('%s/%s',_0x2783b9,_0xa750('0x57')),'json':!![]};switch(_0x292dab[_0xa750('0x51')]){case _0xa750('0x58'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util[_0xa750('0x5a')](_0xa750('0x5c'),_0x292dab['username'],_0x292dab[_0xa750('0x58')]))['toString']('base64'))};break;case _0xa750('0x5d'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util['format'](_0xa750('0x5e'),_0x292dab[_0xa750('0x50')],_0x292dab[_0xa750('0x5d')]))[_0xa750('0x5f')]('base64'))};break;default:throw new db[(_0xa750('0x60'))][(_0xa750('0x61'))](_0xa750('0x62'));}return rp(_0x439dce);}})[_0xa750('0x22')](function(_0x332862){if(_0x332862){var _0x14de1b=[_0xa750('0x63'),_0xa750('0x64'),'group','assignee'];_[_0xa750('0x65')](_0x332862['ticket_fields'],function(_0x2c4114){return _0x14de1b[_0xa750('0x66')](_0x2c4114['type']);});return{'count':_0x332862[_0xa750('0x57')]['length'],'rows':_[_0xa750('0x26')](_0x332862[_0xa750('0x57')],function(_0x77110){return{'id':_0x77110['id'],'name':_0x77110['position']>0x7?_0x77110[_0xa750('0x67')]:_0x77110[_0xa750('0x39')],'custom':_0x77110[_0xa750('0x68')]>0x7?!![]:![],'options':_0x77110[_0xa750('0x69')]?_0x77110['system_field_options']:_0x77110['custom_field_options']?_0x77110['custom_field_options']:[]};})};}})[_0xa750('0x22')](respondWithResult(_0x5d883d,null))[_0xa750('0x3f')](function(_0x5387dc){var _0x12cae9=_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?0x1f4:_0x5387dc[_0xa750('0x6b')]||0x1f4;logger[_0xa750('0x23')](_0xa750('0x6c'),'getFields',_0x12cae9,JSON[_0xa750('0x6d')](_0x5387dc));delete _0x5387dc[_0xa750('0x24')];if(_0x12cae9===0x191){_0x12cae9=0x190;}_0x5d883d[_0xa750('0x17')](_0x12cae9)['send'](_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?{'message':_0xa750('0x6e'),'statusCode':_0x5387dc[_0xa750('0x6b')]}:_0x5387dc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b1dabcc..489abc0 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 _0x0b6c=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','moment'];(function(_0x35cdfe,_0x24804c){var _0x253b4e=function(_0x48d852){while(--_0x48d852){_0x35cdfe['push'](_0x35cdfe['shift']());}};_0x253b4e(++_0x24804c);}(_0x0b6c,0xc2));var _0xc0b6=function(_0x166e0d,_0x24b32c){_0x166e0d=_0x166e0d-0x0;var _0x3473f2=_0x0b6c[_0x166e0d];return _0x3473f2;};'use strict';var _=require(_0xc0b6('0x0'));var util=require(_0xc0b6('0x1'));var logger=require(_0xc0b6('0x2'))('api');var moment=require(_0xc0b6('0x3'));var BPromise=require(_0xc0b6('0x4'));var rp=require(_0xc0b6('0x5'));var fs=require('fs');var path=require(_0xc0b6('0x6'));var rimraf=require(_0xc0b6('0x7'));var config=require('../../config/environment');var attributes=require(_0xc0b6('0x8'));var integrations=require(_0xc0b6('0x9'));module[_0xc0b6('0xa')]=function(_0x4ebc88,_0x1e759c){return _0x4ebc88['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4870=['define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','./intZendeskAccount.attributes'];(function(_0x5e518a,_0x1fafaf){var _0x1cea1a=function(_0x258ca8){while(--_0x258ca8){_0x5e518a['push'](_0x5e518a['shift']());}};_0x1cea1a(++_0x1fafaf);}(_0x4870,0x8f));var _0x0487=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x4870[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x0487('0x0'));var util=require(_0x0487('0x1'));var logger=require(_0x0487('0x2'))(_0x0487('0x3'));var moment=require(_0x0487('0x4'));var BPromise=require('bluebird');var rp=require(_0x0487('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0487('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2a34d3,_0x2aaf49){return _0x2a34d3[_0x0487('0x7')](_0x0487('0x8'),attributes,{'tableName':_0x0487('0x9'),'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 97eee57..7dac07e 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 _0xc37e=['ZendeskAccount','options','raw','where','limit','include','model','attributes','map','then','catch','find','ShowZendeskAccount','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetZendeskAccount'];(function(_0x262132,_0x12e5b6){var _0x2818ee=function(_0x244725){while(--_0x244725){_0x262132['push'](_0x262132['shift']());}};_0x2818ee(++_0x12e5b6);}(_0xc37e,0xfd));var _0xec37=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc37e[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xec37('0x0'));var rs=require(_0xec37('0x1'));var fs=require('fs');var Redis=require(_0xec37('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec37('0x3'))(_0xec37('0x4'));var config=require(_0xec37('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xec37('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd8eb99,_0x2cac61,_0xe53c2e){return new BPromise(function(_0xa923cb,_0xaa5203){return client[_0xec37('0x7')](_0xd8eb99,_0xe53c2e)['then'](function(_0x4382bd){logger['info'](_0xec37('0x8'),_0x2cac61,_0xec37('0x9'));logger[_0xec37('0xa')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2cac61,_0xec37('0x9'),JSON[_0xec37('0xb')](_0x4382bd));if(_0x4382bd[_0xec37('0xc')]){if(_0x4382bd[_0xec37('0xc')][_0xec37('0xd')]===0x1f4){logger[_0xec37('0xc')](_0xec37('0x8'),_0x2cac61,_0x4382bd[_0xec37('0xc')]['message']);return _0xaa5203(_0x4382bd['error']['message']);}logger[_0xec37('0xc')](_0xec37('0x8'),_0x2cac61,_0x4382bd['error']['message']);return _0xa923cb(_0x4382bd['error'][_0xec37('0xe')]);}else{logger[_0xec37('0xf')](_0xec37('0x8'),_0x2cac61,_0xec37('0x9'));_0xa923cb(_0x4382bd['result']['message']);}})['catch'](function(_0x14619a){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2cac61,_0x14619a);_0xaa5203(_0x14619a);});});}exports[_0xec37('0x10')]=function(_0x3d5084){var _0x5f315f=this;return new Promise(function(_0x3969dd,_0x1eb4a9){return db[_0xec37('0x11')]['findAll']({'raw':_0x3d5084[_0xec37('0x12')]?_0x3d5084['options'][_0xec37('0x13')]===undefined?!![]:![]:!![],'where':_0x3d5084[_0xec37('0x12')]?_0x3d5084[_0xec37('0x12')][_0xec37('0x14')]||null:null,'attributes':_0x3d5084['options']?_0x3d5084[_0xec37('0x12')]['attributes']||null:null,'limit':_0x3d5084[_0xec37('0x12')]?_0x3d5084['options'][_0xec37('0x15')]||null:null,'include':_0x3d5084[_0xec37('0x12')]?_0x3d5084['options'][_0xec37('0x16')]?_['map'](_0x3d5084[_0xec37('0x12')][_0xec37('0x16')],function(_0x13147a){return{'model':db[_0x13147a[_0xec37('0x17')]],'as':_0x13147a['as'],'attributes':_0x13147a[_0xec37('0x18')],'include':_0x13147a[_0xec37('0x16')]?_[_0xec37('0x19')](_0x13147a['include'],function(_0x22728a){return{'model':db[_0x22728a[_0xec37('0x17')]],'as':_0x22728a['as'],'attributes':_0x22728a[_0xec37('0x18')],'include':_0x22728a[_0xec37('0x16')]?_['map'](_0x22728a[_0xec37('0x16')],function(_0x25b3d1){return{'model':db[_0x25b3d1[_0xec37('0x17')]],'as':_0x25b3d1['as'],'attributes':_0x25b3d1[_0xec37('0x18')]};}):[]};}):[]};}):[]:[]})[_0xec37('0x1a')](function(_0x553562){logger[_0xec37('0xf')](_0xec37('0x10'),_0x3d5084);logger['debug'](_0xec37('0x10'),_0x3d5084,JSON[_0xec37('0xb')](_0x553562));_0x3969dd(_0x553562);})[_0xec37('0x1b')](function(_0x4e6389){logger[_0xec37('0xc')]('GetZendeskAccount',_0x4e6389[_0xec37('0xe')],_0x3d5084);_0x1eb4a9(_0x5f315f['error'](0x1f4,_0x4e6389['message']));});});};exports['ShowZendeskAccount']=function(_0x5e4da0){var _0x401155=this;return new Promise(function(_0x2b98de,_0x5dff3b){return db[_0xec37('0x11')][_0xec37('0x1c')]({'raw':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')][_0xec37('0x13')]===undefined?!![]:![]:!![],'where':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')]['where']||null:null,'attributes':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')][_0xec37('0x18')]||null:null,'include':_0x5e4da0[_0xec37('0x12')]?_0x5e4da0[_0xec37('0x12')][_0xec37('0x16')]?_[_0xec37('0x19')](_0x5e4da0[_0xec37('0x12')][_0xec37('0x16')],function(_0x4068e8){return{'model':db[_0x4068e8['model']],'as':_0x4068e8['as'],'attributes':_0x4068e8['attributes'],'include':_0x4068e8['include']?_['map'](_0x4068e8[_0xec37('0x16')],function(_0x4d825b){return{'model':db[_0x4d825b[_0xec37('0x17')]],'as':_0x4d825b['as'],'attributes':_0x4d825b[_0xec37('0x18')],'include':_0x4d825b[_0xec37('0x16')]?_['map'](_0x4d825b[_0xec37('0x16')],function(_0x2e40ce){return{'model':db[_0x2e40ce[_0xec37('0x17')]],'as':_0x2e40ce['as'],'attributes':_0x2e40ce[_0xec37('0x18')]};}):[]};}):[]};}):[]:[]})[_0xec37('0x1a')](function(_0x2cb10c){logger[_0xec37('0xf')](_0xec37('0x1d'),_0x5e4da0);logger[_0xec37('0xa')]('ShowZendeskAccount',_0x5e4da0,JSON[_0xec37('0xb')](_0x2cb10c));_0x2b98de(_0x2cb10c);})[_0xec37('0x1b')](function(_0x36c9e8){logger[_0xec37('0xc')](_0xec37('0x1d'),_0x36c9e8[_0xec37('0xe')],_0x5e4da0);_0x5dff3b(_0x401155[_0xec37('0xc')](0x1f4,_0x36c9e8[_0xec37('0xe')]));});});}; \ No newline at end of file +var _0xe590=['../../config/environment','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','attributes','include','map','model','then','debug','ShowZendeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x25981c,_0x5598e0){var _0x3741c3=function(_0x1587ce){while(--_0x1587ce){_0x25981c['push'](_0x25981c['shift']());}};_0x3741c3(++_0x5598e0);}(_0xe590,0x198));var _0x0e59=function(_0x387060,_0x488694){_0x387060=_0x387060-0x0;var _0x45db0b=_0xe590[_0x387060];return _0x45db0b;};'use strict';var _=require(_0x0e59('0x0'));var util=require(_0x0e59('0x1'));var moment=require(_0x0e59('0x2'));var BPromise=require(_0x0e59('0x3'));var rs=require(_0x0e59('0x4'));var fs=require('fs');var Redis=require(_0x0e59('0x5'));var db=require(_0x0e59('0x6'))['db'];var utils=require(_0x0e59('0x7'));var logger=require(_0x0e59('0x8'))(_0x0e59('0x9'));var config=require(_0x0e59('0xa'));var jayson=require(_0x0e59('0xb'));var client=jayson[_0x0e59('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe20d45,_0x3da0ff,_0x592ae3){return new BPromise(function(_0xc234b4,_0x25c75e){return client[_0x0e59('0xd')](_0xe20d45,_0x592ae3)['then'](function(_0x4c9bce){logger[_0x0e59('0xe')](_0x0e59('0xf'),_0x3da0ff,_0x0e59('0x10'));logger['debug'](_0x0e59('0x11'),_0x3da0ff,_0x0e59('0x10'),JSON[_0x0e59('0x12')](_0x4c9bce));if(_0x4c9bce[_0x0e59('0x13')]){if(_0x4c9bce[_0x0e59('0x13')][_0x0e59('0x14')]===0x1f4){logger[_0x0e59('0x13')](_0x0e59('0xf'),_0x3da0ff,_0x4c9bce[_0x0e59('0x13')]['message']);return _0x25c75e(_0x4c9bce[_0x0e59('0x13')][_0x0e59('0x15')]);}logger[_0x0e59('0x13')](_0x0e59('0xf'),_0x3da0ff,_0x4c9bce[_0x0e59('0x13')]['message']);return _0xc234b4(_0x4c9bce[_0x0e59('0x13')][_0x0e59('0x15')]);}else{logger[_0x0e59('0xe')](_0x0e59('0xf'),_0x3da0ff,_0x0e59('0x10'));_0xc234b4(_0x4c9bce[_0x0e59('0x16')][_0x0e59('0x15')]);}})[_0x0e59('0x17')](function(_0x13aa73){logger['error'](_0x0e59('0xf'),_0x3da0ff,_0x13aa73);_0x25c75e(_0x13aa73);});});}exports[_0x0e59('0x18')]=function(_0x59d5c8){var _0x652e99=this;return new Promise(function(_0x3d6d7e,_0x2ecb98){return db[_0x0e59('0x19')][_0x0e59('0x1a')]({'raw':_0x59d5c8[_0x0e59('0x1b')]?_0x59d5c8[_0x0e59('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x59d5c8[_0x0e59('0x1b')]?_0x59d5c8[_0x0e59('0x1b')]['where']||null:null,'attributes':_0x59d5c8[_0x0e59('0x1b')]?_0x59d5c8[_0x0e59('0x1b')][_0x0e59('0x1c')]||null:null,'limit':_0x59d5c8[_0x0e59('0x1b')]?_0x59d5c8[_0x0e59('0x1b')]['limit']||null:null,'include':_0x59d5c8[_0x0e59('0x1b')]?_0x59d5c8[_0x0e59('0x1b')][_0x0e59('0x1d')]?_[_0x0e59('0x1e')](_0x59d5c8[_0x0e59('0x1b')][_0x0e59('0x1d')],function(_0x293794){return{'model':db[_0x293794[_0x0e59('0x1f')]],'as':_0x293794['as'],'attributes':_0x293794['attributes'],'include':_0x293794['include']?_[_0x0e59('0x1e')](_0x293794[_0x0e59('0x1d')],function(_0x56e714){return{'model':db[_0x56e714['model']],'as':_0x56e714['as'],'attributes':_0x56e714[_0x0e59('0x1c')],'include':_0x56e714['include']?_[_0x0e59('0x1e')](_0x56e714[_0x0e59('0x1d')],function(_0x509cf8){return{'model':db[_0x509cf8[_0x0e59('0x1f')]],'as':_0x509cf8['as'],'attributes':_0x509cf8[_0x0e59('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0e59('0x20')](function(_0x1cac32){logger[_0x0e59('0xe')]('GetZendeskAccount',_0x59d5c8);logger[_0x0e59('0x21')](_0x0e59('0x18'),_0x59d5c8,JSON[_0x0e59('0x12')](_0x1cac32));_0x3d6d7e(_0x1cac32);})[_0x0e59('0x17')](function(_0x309dc3){logger[_0x0e59('0x13')](_0x0e59('0x18'),_0x309dc3[_0x0e59('0x15')],_0x59d5c8);_0x2ecb98(_0x652e99[_0x0e59('0x13')](0x1f4,_0x309dc3[_0x0e59('0x15')]));});});};exports[_0x0e59('0x22')]=function(_0x365b85){var _0x4cbb73=this;return new Promise(function(_0x32a1e1,_0x4d7da2){return db[_0x0e59('0x19')][_0x0e59('0x23')]({'raw':_0x365b85[_0x0e59('0x1b')]?_0x365b85['options'][_0x0e59('0x24')]===undefined?!![]:![]:!![],'where':_0x365b85[_0x0e59('0x1b')]?_0x365b85[_0x0e59('0x1b')][_0x0e59('0x25')]||null:null,'attributes':_0x365b85[_0x0e59('0x1b')]?_0x365b85['options']['attributes']||null:null,'include':_0x365b85[_0x0e59('0x1b')]?_0x365b85[_0x0e59('0x1b')][_0x0e59('0x1d')]?_[_0x0e59('0x1e')](_0x365b85['options'][_0x0e59('0x1d')],function(_0x570adf){return{'model':db[_0x570adf[_0x0e59('0x1f')]],'as':_0x570adf['as'],'attributes':_0x570adf[_0x0e59('0x1c')],'include':_0x570adf[_0x0e59('0x1d')]?_[_0x0e59('0x1e')](_0x570adf['include'],function(_0x51da15){return{'model':db[_0x51da15[_0x0e59('0x1f')]],'as':_0x51da15['as'],'attributes':_0x51da15[_0x0e59('0x1c')],'include':_0x51da15['include']?_[_0x0e59('0x1e')](_0x51da15[_0x0e59('0x1d')],function(_0x410bd5){return{'model':db[_0x410bd5['model']],'as':_0x410bd5['as'],'attributes':_0x410bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e59('0x20')](function(_0x395d9e){logger[_0x0e59('0xe')](_0x0e59('0x22'),_0x365b85);logger[_0x0e59('0x21')](_0x0e59('0x22'),_0x365b85,JSON[_0x0e59('0x12')](_0x395d9e));_0x32a1e1(_0x395d9e);})[_0x0e59('0x17')](function(_0x4466f9){logger[_0x0e59('0x13')](_0x0e59('0x22'),_0x4466f9[_0x0e59('0x15')],_0x365b85);_0x4d7da2(_0x4cbb73[_0x0e59('0x13')](0x1f4,_0x4466f9[_0x0e59('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9e416e0..7db8b7e 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 _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4436db,_0x5a5071){var _0x33a369=function(_0x4ebd7b){while(--_0x4ebd7b){_0x4436db['push'](_0x4436db['shift']());}};_0x33a369(++_0x5a5071);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xe5b5[_0x45ae0d];return _0x371826;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file +var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x5a6dbd,_0x41d8b8){var _0xe6b141=function(_0x434afd){while(--_0x434afd){_0x5a6dbd['push'](_0x5a6dbd['shift']());}};_0xe6b141(++_0x41d8b8);}(_0x750a,0x140));var _0xa750=function(_0x5169a6,_0x207871){_0x5169a6=_0x5169a6-0x0;var _0x569b9c=_0x750a[_0x5169a6];return _0x569b9c;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('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 517cea1..46fb007 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 _0x2ad1=['STRING'];(function(_0x41b28c,_0x3d26b2){var _0x549070=function(_0x5e85e1){while(--_0x5e85e1){_0x41b28c['push'](_0x41b28c['shift']());}};_0x549070(++_0x3d26b2);}(_0x2ad1,0xf0));var _0x12ad=function(_0x4debd8,_0x5dea9e){_0x4debd8=_0x4debd8-0x0;var _0x2ab3c6=_0x2ad1[_0x4debd8];return _0x2ab3c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x12ad('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x12cf=['exports','STRING','sequelize'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0x12cf,0x170));var _0xf12c=function(_0x1ae474,_0x30163d){_0x1ae474=_0x1ae474-0x0;var _0x50d1ff=_0x12cf[_0x1ae474];return _0x50d1ff;};'use strict';var Sequelize=require(_0xf12c('0x0'));module[_0xf12c('0x1')]={'name':{'type':Sequelize[_0xf12c('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 b146a89..e4451f7 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 _0x351f=['fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','count','set','json','apply','save','update','then','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','rows','catch','show','include','options','find','create','body','params','getFields','intersection','pick','hasOwnProperty','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0x351f,0x187));var _0xf351=function(_0x244786,_0x310db4){_0x244786=_0x244786-0x0;var _0x3351c5=_0x351f[_0x244786];return _0x3351c5;};'use strict';var emlformat=require(_0xf351('0x0'));var rimraf=require(_0xf351('0x1'));var zipdir=require(_0xf351('0x2'));var jsonpatch=require(_0xf351('0x3'));var rp=require('request-promise');var moment=require(_0xf351('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf351('0x5'));var util=require(_0xf351('0x6'));var path=require(_0xf351('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf351('0x8'));var fs=require('fs');var fs_extra=require(_0xf351('0x9'));var _=require('lodash');var squel=require(_0xf351('0xa'));var crypto=require(_0xf351('0xb'));var jsforce=require(_0xf351('0xc'));var deskjs=require(_0xf351('0xd'));var toCsv=require(_0xf351('0xe'));var querystring=require('querystring');var Papa=require(_0xf351('0xf'));var Redis=require(_0xf351('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf351('0x11'));var as=require(_0xf351('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf351('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf351('0x14'));var db=require(_0xf351('0x15'))['db'];function respondWithStatusCode(_0x270480,_0x28606e){_0x28606e=_0x28606e||0xcc;return function(_0x1b7f8e){if(_0x1b7f8e){return _0x270480[_0xf351('0x16')](_0x28606e);}return _0x270480['status'](_0x28606e)[_0xf351('0x17')]();};}function respondWithResult(_0x2b149e,_0x2ae8a0){_0x2ae8a0=_0x2ae8a0||0xc8;return function(_0x132fe8){if(_0x132fe8){return _0x2b149e[_0xf351('0x18')](_0x2ae8a0)['json'](_0x132fe8);}};}function respondWithFilteredResult(_0x3ae9aa,_0x502689){return function(_0xa3a96a){if(_0xa3a96a){var _0x2c7452=typeof _0x502689[_0xf351('0x19')]==='undefined'&&typeof _0x502689[_0xf351('0x1a')]==='undefined';var _0x2c553a=_0xa3a96a[_0xf351('0x1b')];var _0x4c6948=_0x2c7452?0x0:_0x502689['offset'];var _0x41e465=_0x2c7452?_0xa3a96a['count']:_0x502689[_0xf351('0x19')]+_0x502689[_0xf351('0x1a')];var _0x4eb663;if(_0x41e465>=_0x2c553a){_0x41e465=_0x2c553a;_0x4eb663=0xc8;}else{_0x4eb663=0xce;}_0x3ae9aa[_0xf351('0x18')](_0x4eb663);return _0x3ae9aa[_0xf351('0x1c')]('Content-Range',_0x4c6948+'-'+_0x41e465+'/'+_0x2c553a)[_0xf351('0x1d')](_0xa3a96a);}return null;};}function patchUpdates(_0x2073d0){return function(_0x26db61){try{jsonpatch[_0xf351('0x1e')](_0x26db61,_0x2073d0,!![]);}catch(_0x1efd98){return BPromise['reject'](_0x1efd98);}return _0x26db61[_0xf351('0x1f')]();};}function saveUpdates(_0x3eaf4c,_0x4681e4){return function(_0x319f0d){if(_0x319f0d){return _0x319f0d[_0xf351('0x20')](_0x3eaf4c)[_0xf351('0x21')](function(_0x13473f){return _0x13473f;});}return null;};}function removeEntity(_0x2c5d80,_0x5204f4){return function(_0x5438c5){if(_0x5438c5){return _0x5438c5[_0xf351('0x22')]()[_0xf351('0x21')](function(){_0x2c5d80[_0xf351('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee052,_0x1dcf96){return function(_0x38a2db){if(!_0x38a2db){_0xee052['sendStatus'](0x194);}return _0x38a2db;};}function handleError(_0x4f8583,_0x350d94){_0x350d94=_0x350d94||0x1f4;return function(_0x1ea9bf){logger[_0xf351('0x23')](_0x1ea9bf[_0xf351('0x24')]);if(_0x1ea9bf[_0xf351('0x25')]){delete _0x1ea9bf[_0xf351('0x25')];}_0x4f8583[_0xf351('0x18')](_0x350d94)['send'](_0x1ea9bf);};}exports[_0xf351('0x26')]=function(_0x4903b7,_0x525122){var _0x150a0c={},_0x5781e0={},_0x1036c5={'count':0x0,'rows':[]};var _0x42012d=_[_0xf351('0x27')](db[_0xf351('0x28')][_0xf351('0x29')],function(_0x933ecf){return{'name':_0x933ecf[_0xf351('0x2a')],'type':_0x933ecf['type']['key']};});_0x5781e0[_0xf351('0x2b')]=_[_0xf351('0x27')](_0x42012d,'name');_0x5781e0[_0xf351('0x2c')]=_[_0xf351('0x2d')](_0x4903b7[_0xf351('0x2c')]);_0x5781e0[_0xf351('0x2e')]=_['intersection'](_0x5781e0[_0xf351('0x2b')],_0x5781e0['query']);_0x150a0c[_0xf351('0x2f')]=_['intersection'](_0x5781e0[_0xf351('0x2b')],qs['fields'](_0x4903b7[_0xf351('0x2c')][_0xf351('0x30')]));_0x150a0c[_0xf351('0x2f')]=_0x150a0c[_0xf351('0x2f')][_0xf351('0x31')]?_0x150a0c[_0xf351('0x2f')]:_0x5781e0['model'];if(!_0x4903b7[_0xf351('0x2c')]['hasOwnProperty'](_0xf351('0x32'))){_0x150a0c[_0xf351('0x1a')]=qs[_0xf351('0x1a')](_0x4903b7[_0xf351('0x2c')][_0xf351('0x1a')]);_0x150a0c[_0xf351('0x19')]=qs['offset'](_0x4903b7[_0xf351('0x2c')][_0xf351('0x19')]);}_0x150a0c[_0xf351('0x33')]=qs[_0xf351('0x34')](_0x4903b7['query'][_0xf351('0x34')]);_0x150a0c[_0xf351('0x35')]=qs[_0xf351('0x2e')](_['pick'](_0x4903b7['query'],_0x5781e0[_0xf351('0x2e')]),_0x42012d);if(_0x4903b7['query']['filter']){_0x150a0c[_0xf351('0x35')]=_[_0xf351('0x36')](_0x150a0c['where'],{'$or':_['map'](_0x42012d,function(_0x2d956c){if(_0x2d956c[_0xf351('0x37')]!==_0xf351('0x38')){var _0x6b6962={};_0x6b6962[_0x2d956c[_0xf351('0x25')]]={'$like':'%'+_0x4903b7[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0x6b6962;}})});}_0x150a0c=_[_0xf351('0x36')]({},_0x150a0c,_0x4903b7['options']);var _0x57a18c={'where':_0x150a0c[_0xf351('0x35')]};return db[_0xf351('0x28')][_0xf351('0x1b')](_0x57a18c)[_0xf351('0x21')](function(_0x331ca8){_0x1036c5[_0xf351('0x1b')]=_0x331ca8;if(_0x4903b7[_0xf351('0x2c')][_0xf351('0x3a')]){_0x150a0c['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x150a0c);})[_0xf351('0x21')](function(_0x30c2e8){_0x1036c5[_0xf351('0x3b')]=_0x30c2e8;return _0x1036c5;})[_0xf351('0x21')](respondWithFilteredResult(_0x525122,_0x150a0c))[_0xf351('0x3c')](handleError(_0x525122,null));};exports[_0xf351('0x3d')]=function(_0xa33927,_0x2dece7){var _0x4e7dff={'raw':![],'where':{'id':_0xa33927['params']['id']}},_0x2de5ce={};_0x2de5ce[_0xf351('0x2b')]=_[_0xf351('0x2d')](db['ZendeskConfiguration'][_0xf351('0x29')]);_0x2de5ce[_0xf351('0x2c')]=_[_0xf351('0x2d')](_0xa33927['query']);_0x2de5ce[_0xf351('0x2e')]=_['intersection'](_0x2de5ce['model'],_0x2de5ce[_0xf351('0x2c')]);_0x4e7dff[_0xf351('0x2f')]=_['intersection'](_0x2de5ce[_0xf351('0x2b')],qs[_0xf351('0x30')](_0xa33927[_0xf351('0x2c')][_0xf351('0x30')]));_0x4e7dff[_0xf351('0x2f')]=_0x4e7dff['attributes'][_0xf351('0x31')]?_0x4e7dff[_0xf351('0x2f')]:_0x2de5ce['model'];if(_0xa33927[_0xf351('0x2c')][_0xf351('0x3a')]){_0x4e7dff[_0xf351('0x3e')]=[{'all':!![]}];}_0x4e7dff=_['merge']({},_0x4e7dff,_0xa33927[_0xf351('0x3f')]);return db['ZendeskConfiguration'][_0xf351('0x40')](_0x4e7dff)[_0xf351('0x21')](handleEntityNotFound(_0x2dece7,null))['then'](respondWithResult(_0x2dece7,null))[_0xf351('0x3c')](handleError(_0x2dece7,null));};exports[_0xf351('0x41')]=function(_0x167298,_0x27eb6e){return db[_0xf351('0x28')][_0xf351('0x41')](_0x167298[_0xf351('0x42')],{})[_0xf351('0x21')](respondWithResult(_0x27eb6e,0xc9))[_0xf351('0x3c')](handleError(_0x27eb6e,null));};exports[_0xf351('0x20')]=function(_0x4e6e87,_0xa9414d){if(_0x4e6e87[_0xf351('0x42')]['id']){delete _0x4e6e87['body']['id'];}return db['ZendeskConfiguration'][_0xf351('0x40')]({'where':{'id':_0x4e6e87[_0xf351('0x43')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0xa9414d,null))[_0xf351('0x21')](saveUpdates(_0x4e6e87[_0xf351('0x42')],null))['then'](respondWithResult(_0xa9414d,null))[_0xf351('0x3c')](handleError(_0xa9414d,null));};exports[_0xf351('0x22')]=function(_0x16ebe4,_0x1bc4cb){return db[_0xf351('0x28')][_0xf351('0x40')]({'where':{'id':_0x16ebe4[_0xf351('0x43')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x1bc4cb,null))['then'](removeEntity(_0x1bc4cb,null))[_0xf351('0x3c')](handleError(_0x1bc4cb,null));};exports[_0xf351('0x44')]=function(_0x225497,_0x1d5ac8,_0x2f2692){var _0x18b386={};var _0x3df1dd={};var _0x249a73;var _0x51631c;return db[_0xf351('0x28')]['findOne']({'where':{'id':_0x225497['params']['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x1d5ac8,null))[_0xf351('0x21')](function(_0x5cec07){if(_0x5cec07){_0x249a73=_0x5cec07;_0x3df1dd[_0xf351('0x2b')]=_['keys'](db['ZendeskField'][_0xf351('0x29')]);_0x3df1dd[_0xf351('0x2c')]=_[_0xf351('0x2d')](_0x225497[_0xf351('0x2c')]);_0x3df1dd[_0xf351('0x2e')]=_[_0xf351('0x45')](_0x3df1dd['model'],_0x3df1dd['query']);_0x18b386['attributes']=_[_0xf351('0x45')](_0x3df1dd['model'],qs[_0xf351('0x30')](_0x225497[_0xf351('0x2c')][_0xf351('0x30')]));_0x18b386[_0xf351('0x2f')]=_0x18b386[_0xf351('0x2f')][_0xf351('0x31')]?_0x18b386[_0xf351('0x2f')]:_0x3df1dd[_0xf351('0x2b')];_0x18b386[_0xf351('0x33')]=qs[_0xf351('0x34')](_0x225497[_0xf351('0x2c')][_0xf351('0x34')]);_0x18b386['where']=qs[_0xf351('0x2e')](_[_0xf351('0x46')](_0x225497[_0xf351('0x2c')],_0x3df1dd[_0xf351('0x2e')]));if(_0x225497['query']['filter']){_0x18b386[_0xf351('0x35')]=_[_0xf351('0x36')](_0x18b386[_0xf351('0x35')],{'$or':_[_0xf351('0x27')](_0x18b386[_0xf351('0x2f')],function(_0x3ff0ae){var _0x207741={};_0x207741[_0x3ff0ae]={'$like':'%'+_0x225497[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0x207741;})});}_0x18b386=_[_0xf351('0x36')]({},_0x18b386,_0x225497[_0xf351('0x3f')]);return _0x249a73['getFields'](_0x18b386);}})['then'](function(_0x1c20ac){if(_0x1c20ac){_0x51631c=_0x1c20ac[_0xf351('0x31')];if(!_0x225497['query'][_0xf351('0x47')](_0xf351('0x32'))){_0x18b386['limit']=qs['limit'](_0x225497[_0xf351('0x2c')][_0xf351('0x1a')]);_0x18b386['offset']=qs[_0xf351('0x19')](_0x225497['query'][_0xf351('0x19')]);}return _0x249a73[_0xf351('0x44')](_0x18b386);}})[_0xf351('0x21')](function(_0x35283b){if(_0x35283b){return _0x35283b?{'count':_0x51631c,'rows':_0x35283b}:null;}})[_0xf351('0x21')](respondWithResult(_0x1d5ac8,null))['catch'](handleError(_0x1d5ac8,null));};exports[_0xf351('0x48')]=function(_0x2c46c7,_0x52dedf,_0xddbba){var _0x138a61={};var _0x27cbfe={};var _0x165549;var _0x4a6d98;return db['ZendeskConfiguration'][_0xf351('0x49')]({'where':{'id':_0x2c46c7[_0xf351('0x43')]['id']}})['then'](handleEntityNotFound(_0x52dedf,null))[_0xf351('0x21')](function(_0x389c21){if(_0x389c21){_0x165549=_0x389c21;_0x27cbfe['model']=_[_0xf351('0x2d')](db[_0xf351('0x4a')][_0xf351('0x29')]);_0x27cbfe['query']=_[_0xf351('0x2d')](_0x2c46c7[_0xf351('0x2c')]);_0x27cbfe[_0xf351('0x2e')]=_[_0xf351('0x45')](_0x27cbfe[_0xf351('0x2b')],_0x27cbfe['query']);_0x138a61[_0xf351('0x2f')]=_[_0xf351('0x45')](_0x27cbfe['model'],qs['fields'](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x30')]));_0x138a61[_0xf351('0x2f')]=_0x138a61[_0xf351('0x2f')][_0xf351('0x31')]?_0x138a61[_0xf351('0x2f')]:_0x27cbfe[_0xf351('0x2b')];_0x138a61['order']=qs[_0xf351('0x34')](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x34')]);_0x138a61[_0xf351('0x35')]=qs['filters'](_[_0xf351('0x46')](_0x2c46c7['query'],_0x27cbfe[_0xf351('0x2e')]));if(_0x2c46c7[_0xf351('0x2c')][_0xf351('0x39')]){_0x138a61[_0xf351('0x35')]=_[_0xf351('0x36')](_0x138a61[_0xf351('0x35')],{'$or':_['map'](_0x138a61[_0xf351('0x2f')],function(_0x456786){var _0x298a8d={};_0x298a8d[_0x456786]={'$like':'%'+_0x2c46c7[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0x298a8d;})});}_0x138a61=_[_0xf351('0x36')]({},_0x138a61,_0x2c46c7[_0xf351('0x3f')]);return _0x165549[_0xf351('0x48')](_0x138a61);}})[_0xf351('0x21')](function(_0x5bd35f){if(_0x5bd35f){_0x4a6d98=_0x5bd35f[_0xf351('0x31')];if(!_0x2c46c7[_0xf351('0x2c')][_0xf351('0x47')](_0xf351('0x32'))){_0x138a61[_0xf351('0x1a')]=qs[_0xf351('0x1a')](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x1a')]);_0x138a61['offset']=qs[_0xf351('0x19')](_0x2c46c7[_0xf351('0x2c')][_0xf351('0x19')]);}return _0x165549['getSubjects'](_0x138a61);}})['then'](function(_0x35dbf9){if(_0x35dbf9){return _0x35dbf9?{'count':_0x4a6d98,'rows':_0x35dbf9}:null;}})['then'](respondWithResult(_0x52dedf,null))[_0xf351('0x3c')](handleError(_0x52dedf,null));};exports['getDescriptions']=function(_0x51c93e,_0x36a3c3,_0x2b9ab9){var _0x330ec8={};var _0x44a1e9={};var _0x24fe6c;var _0x5b422c;return db[_0xf351('0x28')][_0xf351('0x49')]({'where':{'id':_0x51c93e[_0xf351('0x43')]['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x36a3c3,null))[_0xf351('0x21')](function(_0xae25de){if(_0xae25de){_0x24fe6c=_0xae25de;_0x44a1e9[_0xf351('0x2b')]=_[_0xf351('0x2d')](db['ZendeskField']['rawAttributes']);_0x44a1e9[_0xf351('0x2c')]=_['keys'](_0x51c93e['query']);_0x44a1e9['filters']=_[_0xf351('0x45')](_0x44a1e9[_0xf351('0x2b')],_0x44a1e9[_0xf351('0x2c')]);_0x330ec8[_0xf351('0x2f')]=_[_0xf351('0x45')](_0x44a1e9[_0xf351('0x2b')],qs[_0xf351('0x30')](_0x51c93e[_0xf351('0x2c')][_0xf351('0x30')]));_0x330ec8[_0xf351('0x2f')]=_0x330ec8['attributes'][_0xf351('0x31')]?_0x330ec8[_0xf351('0x2f')]:_0x44a1e9[_0xf351('0x2b')];_0x330ec8[_0xf351('0x33')]=qs[_0xf351('0x34')](_0x51c93e[_0xf351('0x2c')][_0xf351('0x34')]);_0x330ec8[_0xf351('0x35')]=qs[_0xf351('0x2e')](_[_0xf351('0x46')](_0x51c93e['query'],_0x44a1e9['filters']));if(_0x51c93e[_0xf351('0x2c')][_0xf351('0x39')]){_0x330ec8[_0xf351('0x35')]=_[_0xf351('0x36')](_0x330ec8[_0xf351('0x35')],{'$or':_['map'](_0x330ec8[_0xf351('0x2f')],function(_0xa258c8){var _0x243a6e={};_0x243a6e[_0xa258c8]={'$like':'%'+_0x51c93e['query']['filter']+'%'};return _0x243a6e;})});}_0x330ec8=_['merge']({},_0x330ec8,_0x51c93e[_0xf351('0x3f')]);return _0x24fe6c[_0xf351('0x4b')](_0x330ec8);}})[_0xf351('0x21')](function(_0x734393){if(_0x734393){_0x5b422c=_0x734393[_0xf351('0x31')];if(!_0x51c93e[_0xf351('0x2c')][_0xf351('0x47')]('nolimit')){_0x330ec8['limit']=qs['limit'](_0x51c93e[_0xf351('0x2c')][_0xf351('0x1a')]);_0x330ec8[_0xf351('0x19')]=qs[_0xf351('0x19')](_0x51c93e[_0xf351('0x2c')][_0xf351('0x19')]);}return _0x24fe6c['getDescriptions'](_0x330ec8);}})[_0xf351('0x21')](function(_0x16cc0e){if(_0x16cc0e){return _0x16cc0e?{'count':_0x5b422c,'rows':_0x16cc0e}:null;}})['then'](respondWithResult(_0x36a3c3,null))[_0xf351('0x3c')](handleError(_0x36a3c3,null));};exports[_0xf351('0x4c')]=function(_0x3b719e,_0x20a2be,_0x2b8098){var _0x20ff02={};var _0x329fef={};var _0x32ea89;var _0x171dbb;return db['ZendeskConfiguration'][_0xf351('0x49')]({'where':{'id':_0x3b719e[_0xf351('0x43')]['id']}})['then'](handleEntityNotFound(_0x20a2be,null))['then'](function(_0x4e3b04){if(_0x4e3b04){_0x32ea89=_0x4e3b04;_0x329fef['model']=_['keys'](db[_0xf351('0x4d')]['rawAttributes']);_0x329fef['query']=_['keys'](_0x3b719e[_0xf351('0x2c')]);_0x329fef[_0xf351('0x2e')]=_[_0xf351('0x45')](_0x329fef['model'],_0x329fef[_0xf351('0x2c')]);_0x20ff02[_0xf351('0x2f')]=_[_0xf351('0x45')](_0x329fef[_0xf351('0x2b')],qs[_0xf351('0x30')](_0x3b719e['query']['fields']));_0x20ff02[_0xf351('0x2f')]=_0x20ff02[_0xf351('0x2f')]['length']?_0x20ff02[_0xf351('0x2f')]:_0x329fef[_0xf351('0x2b')];_0x20ff02['order']=qs[_0xf351('0x34')](_0x3b719e[_0xf351('0x2c')][_0xf351('0x34')]);_0x20ff02[_0xf351('0x35')]=qs['filters'](_[_0xf351('0x46')](_0x3b719e['query'],_0x329fef[_0xf351('0x2e')]));if(_0x3b719e[_0xf351('0x2c')][_0xf351('0x39')]){_0x20ff02['where']=_['merge'](_0x20ff02[_0xf351('0x35')],{'$or':_[_0xf351('0x27')](_0x20ff02[_0xf351('0x2f')],function(_0x149a9){var _0xf0b9f2={};_0xf0b9f2[_0x149a9]={'$like':'%'+_0x3b719e[_0xf351('0x2c')][_0xf351('0x39')]+'%'};return _0xf0b9f2;})});}_0x20ff02=_['merge']({},_0x20ff02,_0x3b719e[_0xf351('0x3f')]);return _0x32ea89['getTags'](_0x20ff02);}})['then'](function(_0x2fc86a){if(_0x2fc86a){_0x171dbb=_0x2fc86a[_0xf351('0x31')];if(!_0x3b719e['query'][_0xf351('0x47')](_0xf351('0x32'))){_0x20ff02['limit']=qs[_0xf351('0x1a')](_0x3b719e[_0xf351('0x2c')]['limit']);_0x20ff02[_0xf351('0x19')]=qs[_0xf351('0x19')](_0x3b719e[_0xf351('0x2c')][_0xf351('0x19')]);}return _0x32ea89[_0xf351('0x4c')](_0x20ff02);}})[_0xf351('0x21')](function(_0x3b96d8){if(_0x3b96d8){return _0x3b96d8?{'count':_0x171dbb,'rows':_0x3b96d8}:null;}})[_0xf351('0x21')](respondWithResult(_0x20a2be,null))['catch'](handleError(_0x20a2be,null));};exports['setTags']=function(_0x226792,_0x5da339,_0x3b8616){if(_0x226792[_0xf351('0x42')]['id']){delete _0x226792[_0xf351('0x42')]['id'];}return db[_0xf351('0x28')]['findOne']({'where':{'id':_0x226792['params']['id']}})[_0xf351('0x21')](handleEntityNotFound(_0x5da339,null))[_0xf351('0x21')](function(_0x8664a1){if(_0x8664a1){return _0x8664a1[_0xf351('0x4e')](_0x226792['body'][_0xf351('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x5da339,null))['catch'](handleError(_0x5da339,null));}; \ No newline at end of file +var _0x2eb1=['sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','index','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','ZendeskConfiguration','includeAll','include','catch','show','params','length','find','create','body','getFields','ZendeskField','order','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb'];(function(_0x42211c,_0x47fd90){var _0x36809e=function(_0x46255d){while(--_0x46255d){_0x42211c['push'](_0x42211c['shift']());}};_0x36809e(++_0x47fd90);}(_0x2eb1,0xd0));var _0x12eb=function(_0x66cf2c,_0x5b406e){_0x66cf2c=_0x66cf2c-0x0;var _0x2c2760=_0x2eb1[_0x66cf2c];return _0x2c2760;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12eb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12eb('0x1'));var rp=require(_0x12eb('0x2'));var moment=require(_0x12eb('0x3'));var BPromise=require(_0x12eb('0x4'));var Mustache=require(_0x12eb('0x5'));var util=require(_0x12eb('0x6'));var path=require(_0x12eb('0x7'));var sox=require(_0x12eb('0x8'));var csv=require(_0x12eb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x12eb('0xa'));var _=require('lodash');var squel=require(_0x12eb('0xb'));var crypto=require('crypto');var jsforce=require(_0x12eb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x12eb('0x9'));var querystring=require('querystring');var Papa=require(_0x12eb('0xd'));var Redis=require(_0x12eb('0xe'));var authService=require(_0x12eb('0xf'));var qs=require(_0x12eb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12eb('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x12eb('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x12eb('0x13'))['db'];function respondWithStatusCode(_0xcf6c37,_0x5f3f92){_0x5f3f92=_0x5f3f92||0xcc;return function(_0x5e2d52){if(_0x5e2d52){return _0xcf6c37[_0x12eb('0x14')](_0x5f3f92);}return _0xcf6c37['status'](_0x5f3f92)['end']();};}function respondWithResult(_0x10e732,_0x2bc2dd){_0x2bc2dd=_0x2bc2dd||0xc8;return function(_0x4ce879){if(_0x4ce879){return _0x10e732[_0x12eb('0x15')](_0x2bc2dd)[_0x12eb('0x16')](_0x4ce879);}};}function respondWithFilteredResult(_0xfc063d,_0x2a453a){return function(_0x5b3592){if(_0x5b3592){var _0x170176=typeof _0x2a453a[_0x12eb('0x17')]==='undefined'&&typeof _0x2a453a[_0x12eb('0x18')]==='undefined';var _0x47bb03=_0x5b3592['count'];var _0x18abb2=_0x170176?0x0:_0x2a453a[_0x12eb('0x17')];var _0x44043f=_0x170176?_0x5b3592[_0x12eb('0x19')]:_0x2a453a[_0x12eb('0x17')]+_0x2a453a['limit'];var _0x38cde1;if(_0x44043f>=_0x47bb03){_0x44043f=_0x47bb03;_0x38cde1=0xc8;}else{_0x38cde1=0xce;}_0xfc063d[_0x12eb('0x15')](_0x38cde1);return _0xfc063d[_0x12eb('0x1a')](_0x12eb('0x1b'),_0x18abb2+'-'+_0x44043f+'/'+_0x47bb03)[_0x12eb('0x16')](_0x5b3592);}return null;};}function patchUpdates(_0x44b520){return function(_0x252173){try{jsonpatch['apply'](_0x252173,_0x44b520,!![]);}catch(_0x6a5e0d){return BPromise[_0x12eb('0x1c')](_0x6a5e0d);}return _0x252173[_0x12eb('0x1d')]();};}function saveUpdates(_0x24ed4d,_0x12226a){return function(_0x2b55ac){if(_0x2b55ac){return _0x2b55ac[_0x12eb('0x1e')](_0x24ed4d)[_0x12eb('0x1f')](function(_0x3de940){return _0x3de940;});}return null;};}function removeEntity(_0x4c0b4b,_0x452fd8){return function(_0x46b357){if(_0x46b357){return _0x46b357[_0x12eb('0x20')]()[_0x12eb('0x1f')](function(){_0x4c0b4b[_0x12eb('0x15')](0xcc)[_0x12eb('0x21')]();});}};}function handleEntityNotFound(_0x438d10,_0x3f1acb){return function(_0x285e63){if(!_0x285e63){_0x438d10[_0x12eb('0x14')](0x194);}return _0x285e63;};}function handleError(_0x40d1ef,_0x268a51){_0x268a51=_0x268a51||0x1f4;return function(_0x4a8185){logger[_0x12eb('0x22')](_0x4a8185['stack']);if(_0x4a8185[_0x12eb('0x23')]){delete _0x4a8185[_0x12eb('0x23')];}_0x40d1ef[_0x12eb('0x15')](_0x268a51)['send'](_0x4a8185);};}exports[_0x12eb('0x24')]=function(_0x184173,_0x40273f){var _0x216d1b={},_0x2f2134={},_0xa1bc02={'count':0x0,'rows':[]};var _0x27962e=_['map'](db['ZendeskConfiguration'][_0x12eb('0x25')],function(_0x516b14){return{'name':_0x516b14['fieldName'],'type':_0x516b14[_0x12eb('0x26')][_0x12eb('0x27')]};});_0x2f2134[_0x12eb('0x28')]=_['map'](_0x27962e,_0x12eb('0x23'));_0x2f2134['query']=_[_0x12eb('0x29')](_0x184173[_0x12eb('0x2a')]);_0x2f2134[_0x12eb('0x2b')]=_['intersection'](_0x2f2134['model'],_0x2f2134[_0x12eb('0x2a')]);_0x216d1b[_0x12eb('0x2c')]=_[_0x12eb('0x2d')](_0x2f2134[_0x12eb('0x28')],qs[_0x12eb('0x2e')](_0x184173[_0x12eb('0x2a')][_0x12eb('0x2e')]));_0x216d1b[_0x12eb('0x2c')]=_0x216d1b['attributes']['length']?_0x216d1b[_0x12eb('0x2c')]:_0x2f2134[_0x12eb('0x28')];if(!_0x184173[_0x12eb('0x2a')][_0x12eb('0x2f')](_0x12eb('0x30'))){_0x216d1b[_0x12eb('0x18')]=qs[_0x12eb('0x18')](_0x184173[_0x12eb('0x2a')][_0x12eb('0x18')]);_0x216d1b[_0x12eb('0x17')]=qs[_0x12eb('0x17')](_0x184173[_0x12eb('0x2a')][_0x12eb('0x17')]);}_0x216d1b['order']=qs[_0x12eb('0x31')](_0x184173[_0x12eb('0x2a')][_0x12eb('0x31')]);_0x216d1b[_0x12eb('0x32')]=qs[_0x12eb('0x2b')](_[_0x12eb('0x33')](_0x184173['query'],_0x2f2134['filters']),_0x27962e);if(_0x184173[_0x12eb('0x2a')][_0x12eb('0x34')]){_0x216d1b[_0x12eb('0x32')]=_[_0x12eb('0x35')](_0x216d1b[_0x12eb('0x32')],{'$or':_[_0x12eb('0x36')](_0x27962e,function(_0x158d41){if(_0x158d41['type']!=='VIRTUAL'){var _0x48eea4={};_0x48eea4[_0x158d41[_0x12eb('0x23')]]={'$like':'%'+_0x184173[_0x12eb('0x2a')]['filter']+'%'};return _0x48eea4;}})});}_0x216d1b=_[_0x12eb('0x35')]({},_0x216d1b,_0x184173[_0x12eb('0x37')]);var _0x30f626={'where':_0x216d1b[_0x12eb('0x32')]};return db[_0x12eb('0x38')][_0x12eb('0x19')](_0x30f626)['then'](function(_0x2bf1bc){_0xa1bc02[_0x12eb('0x19')]=_0x2bf1bc;if(_0x184173[_0x12eb('0x2a')][_0x12eb('0x39')]){_0x216d1b[_0x12eb('0x3a')]=[{'all':!![]}];}return db[_0x12eb('0x38')]['findAll'](_0x216d1b);})[_0x12eb('0x1f')](function(_0x411f0e){_0xa1bc02['rows']=_0x411f0e;return _0xa1bc02;})['then'](respondWithFilteredResult(_0x40273f,_0x216d1b))[_0x12eb('0x3b')](handleError(_0x40273f,null));};exports[_0x12eb('0x3c')]=function(_0x350b9f,_0x3ab394){var _0x5bbeb5={'raw':![],'where':{'id':_0x350b9f[_0x12eb('0x3d')]['id']}},_0x43df80={};_0x43df80['model']=_[_0x12eb('0x29')](db['ZendeskConfiguration'][_0x12eb('0x25')]);_0x43df80['query']=_[_0x12eb('0x29')](_0x350b9f[_0x12eb('0x2a')]);_0x43df80[_0x12eb('0x2b')]=_[_0x12eb('0x2d')](_0x43df80[_0x12eb('0x28')],_0x43df80[_0x12eb('0x2a')]);_0x5bbeb5[_0x12eb('0x2c')]=_[_0x12eb('0x2d')](_0x43df80['model'],qs[_0x12eb('0x2e')](_0x350b9f[_0x12eb('0x2a')][_0x12eb('0x2e')]));_0x5bbeb5[_0x12eb('0x2c')]=_0x5bbeb5[_0x12eb('0x2c')][_0x12eb('0x3e')]?_0x5bbeb5[_0x12eb('0x2c')]:_0x43df80[_0x12eb('0x28')];if(_0x350b9f[_0x12eb('0x2a')]['includeAll']){_0x5bbeb5[_0x12eb('0x3a')]=[{'all':!![]}];}_0x5bbeb5=_[_0x12eb('0x35')]({},_0x5bbeb5,_0x350b9f[_0x12eb('0x37')]);return db['ZendeskConfiguration'][_0x12eb('0x3f')](_0x5bbeb5)[_0x12eb('0x1f')](handleEntityNotFound(_0x3ab394,null))[_0x12eb('0x1f')](respondWithResult(_0x3ab394,null))[_0x12eb('0x3b')](handleError(_0x3ab394,null));};exports['create']=function(_0x3ea2a7,_0x4554e3){return db[_0x12eb('0x38')][_0x12eb('0x40')](_0x3ea2a7['body'],{})[_0x12eb('0x1f')](respondWithResult(_0x4554e3,0xc9))[_0x12eb('0x3b')](handleError(_0x4554e3,null));};exports[_0x12eb('0x1e')]=function(_0x61a791,_0x30e0bd){if(_0x61a791[_0x12eb('0x41')]['id']){delete _0x61a791['body']['id'];}return db[_0x12eb('0x38')]['find']({'where':{'id':_0x61a791['params']['id']}})[_0x12eb('0x1f')](handleEntityNotFound(_0x30e0bd,null))['then'](saveUpdates(_0x61a791[_0x12eb('0x41')],null))[_0x12eb('0x1f')](respondWithResult(_0x30e0bd,null))['catch'](handleError(_0x30e0bd,null));};exports[_0x12eb('0x20')]=function(_0x5109ba,_0x1d06c0){return db['ZendeskConfiguration'][_0x12eb('0x3f')]({'where':{'id':_0x5109ba[_0x12eb('0x3d')]['id']}})[_0x12eb('0x1f')](handleEntityNotFound(_0x1d06c0,null))[_0x12eb('0x1f')](removeEntity(_0x1d06c0,null))['catch'](handleError(_0x1d06c0,null));};exports[_0x12eb('0x42')]=function(_0x3770c2,_0x59a2bf,_0x48850b){var _0x2998d5={};var _0x1694d1={};var _0x4b4a4e;var _0x4620c7;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3770c2['params']['id']}})[_0x12eb('0x1f')](handleEntityNotFound(_0x59a2bf,null))[_0x12eb('0x1f')](function(_0x51ef9f){if(_0x51ef9f){_0x4b4a4e=_0x51ef9f;_0x1694d1['model']=_[_0x12eb('0x29')](db[_0x12eb('0x43')][_0x12eb('0x25')]);_0x1694d1[_0x12eb('0x2a')]=_[_0x12eb('0x29')](_0x3770c2['query']);_0x1694d1[_0x12eb('0x2b')]=_['intersection'](_0x1694d1[_0x12eb('0x28')],_0x1694d1['query']);_0x2998d5['attributes']=_[_0x12eb('0x2d')](_0x1694d1[_0x12eb('0x28')],qs[_0x12eb('0x2e')](_0x3770c2['query'][_0x12eb('0x2e')]));_0x2998d5[_0x12eb('0x2c')]=_0x2998d5['attributes'][_0x12eb('0x3e')]?_0x2998d5[_0x12eb('0x2c')]:_0x1694d1['model'];_0x2998d5[_0x12eb('0x44')]=qs[_0x12eb('0x31')](_0x3770c2['query'][_0x12eb('0x31')]);_0x2998d5[_0x12eb('0x32')]=qs['filters'](_[_0x12eb('0x33')](_0x3770c2['query'],_0x1694d1['filters']));if(_0x3770c2[_0x12eb('0x2a')][_0x12eb('0x34')]){_0x2998d5[_0x12eb('0x32')]=_[_0x12eb('0x35')](_0x2998d5[_0x12eb('0x32')],{'$or':_['map'](_0x2998d5[_0x12eb('0x2c')],function(_0x6f1809){var _0x47a41e={};_0x47a41e[_0x6f1809]={'$like':'%'+_0x3770c2[_0x12eb('0x2a')][_0x12eb('0x34')]+'%'};return _0x47a41e;})});}_0x2998d5=_[_0x12eb('0x35')]({},_0x2998d5,_0x3770c2['options']);return _0x4b4a4e[_0x12eb('0x42')](_0x2998d5);}})[_0x12eb('0x1f')](function(_0x4d1a62){if(_0x4d1a62){_0x4620c7=_0x4d1a62[_0x12eb('0x3e')];if(!_0x3770c2[_0x12eb('0x2a')][_0x12eb('0x2f')](_0x12eb('0x30'))){_0x2998d5[_0x12eb('0x18')]=qs[_0x12eb('0x18')](_0x3770c2[_0x12eb('0x2a')][_0x12eb('0x18')]);_0x2998d5[_0x12eb('0x17')]=qs['offset'](_0x3770c2['query'][_0x12eb('0x17')]);}return _0x4b4a4e[_0x12eb('0x42')](_0x2998d5);}})[_0x12eb('0x1f')](function(_0x2d2096){if(_0x2d2096){return _0x2d2096?{'count':_0x4620c7,'rows':_0x2d2096}:null;}})[_0x12eb('0x1f')](respondWithResult(_0x59a2bf,null))['catch'](handleError(_0x59a2bf,null));};exports[_0x12eb('0x45')]=function(_0x52f7dd,_0x54fd2a,_0x58eedf){var _0x4ae9db={};var _0x897916={};var _0x4623d0;var _0x225d81;return db[_0x12eb('0x38')][_0x12eb('0x46')]({'where':{'id':_0x52f7dd[_0x12eb('0x3d')]['id']}})[_0x12eb('0x1f')](handleEntityNotFound(_0x54fd2a,null))[_0x12eb('0x1f')](function(_0x2e51b3){if(_0x2e51b3){_0x4623d0=_0x2e51b3;_0x897916[_0x12eb('0x28')]=_[_0x12eb('0x29')](db[_0x12eb('0x43')][_0x12eb('0x25')]);_0x897916[_0x12eb('0x2a')]=_[_0x12eb('0x29')](_0x52f7dd[_0x12eb('0x2a')]);_0x897916[_0x12eb('0x2b')]=_[_0x12eb('0x2d')](_0x897916[_0x12eb('0x28')],_0x897916[_0x12eb('0x2a')]);_0x4ae9db['attributes']=_[_0x12eb('0x2d')](_0x897916['model'],qs['fields'](_0x52f7dd['query']['fields']));_0x4ae9db['attributes']=_0x4ae9db['attributes'][_0x12eb('0x3e')]?_0x4ae9db['attributes']:_0x897916[_0x12eb('0x28')];_0x4ae9db[_0x12eb('0x44')]=qs['sort'](_0x52f7dd[_0x12eb('0x2a')][_0x12eb('0x31')]);_0x4ae9db[_0x12eb('0x32')]=qs[_0x12eb('0x2b')](_[_0x12eb('0x33')](_0x52f7dd[_0x12eb('0x2a')],_0x897916[_0x12eb('0x2b')]));if(_0x52f7dd[_0x12eb('0x2a')][_0x12eb('0x34')]){_0x4ae9db[_0x12eb('0x32')]=_[_0x12eb('0x35')](_0x4ae9db['where'],{'$or':_['map'](_0x4ae9db[_0x12eb('0x2c')],function(_0x81131b){var _0x5b2308={};_0x5b2308[_0x81131b]={'$like':'%'+_0x52f7dd[_0x12eb('0x2a')]['filter']+'%'};return _0x5b2308;})});}_0x4ae9db=_[_0x12eb('0x35')]({},_0x4ae9db,_0x52f7dd[_0x12eb('0x37')]);return _0x4623d0[_0x12eb('0x45')](_0x4ae9db);}})['then'](function(_0x438d97){if(_0x438d97){_0x225d81=_0x438d97[_0x12eb('0x3e')];if(!_0x52f7dd[_0x12eb('0x2a')]['hasOwnProperty']('nolimit')){_0x4ae9db[_0x12eb('0x18')]=qs['limit'](_0x52f7dd[_0x12eb('0x2a')][_0x12eb('0x18')]);_0x4ae9db[_0x12eb('0x17')]=qs[_0x12eb('0x17')](_0x52f7dd[_0x12eb('0x2a')]['offset']);}return _0x4623d0[_0x12eb('0x45')](_0x4ae9db);}})[_0x12eb('0x1f')](function(_0x325d5f){if(_0x325d5f){return _0x325d5f?{'count':_0x225d81,'rows':_0x325d5f}:null;}})[_0x12eb('0x1f')](respondWithResult(_0x54fd2a,null))[_0x12eb('0x3b')](handleError(_0x54fd2a,null));};exports[_0x12eb('0x47')]=function(_0x4ee9a7,_0x23d459,_0x555342){var _0x48836c={};var _0x5e085b={};var _0x1db961;var _0x5d0053;return db['ZendeskConfiguration'][_0x12eb('0x46')]({'where':{'id':_0x4ee9a7['params']['id']}})['then'](handleEntityNotFound(_0x23d459,null))['then'](function(_0x3625ea){if(_0x3625ea){_0x1db961=_0x3625ea;_0x5e085b[_0x12eb('0x28')]=_[_0x12eb('0x29')](db[_0x12eb('0x43')][_0x12eb('0x25')]);_0x5e085b[_0x12eb('0x2a')]=_[_0x12eb('0x29')](_0x4ee9a7[_0x12eb('0x2a')]);_0x5e085b['filters']=_[_0x12eb('0x2d')](_0x5e085b['model'],_0x5e085b[_0x12eb('0x2a')]);_0x48836c['attributes']=_[_0x12eb('0x2d')](_0x5e085b[_0x12eb('0x28')],qs[_0x12eb('0x2e')](_0x4ee9a7[_0x12eb('0x2a')][_0x12eb('0x2e')]));_0x48836c['attributes']=_0x48836c[_0x12eb('0x2c')][_0x12eb('0x3e')]?_0x48836c[_0x12eb('0x2c')]:_0x5e085b[_0x12eb('0x28')];_0x48836c[_0x12eb('0x44')]=qs[_0x12eb('0x31')](_0x4ee9a7[_0x12eb('0x2a')]['sort']);_0x48836c['where']=qs['filters'](_[_0x12eb('0x33')](_0x4ee9a7[_0x12eb('0x2a')],_0x5e085b[_0x12eb('0x2b')]));if(_0x4ee9a7[_0x12eb('0x2a')][_0x12eb('0x34')]){_0x48836c[_0x12eb('0x32')]=_['merge'](_0x48836c[_0x12eb('0x32')],{'$or':_[_0x12eb('0x36')](_0x48836c['attributes'],function(_0x43d02c){var _0x4b3c55={};_0x4b3c55[_0x43d02c]={'$like':'%'+_0x4ee9a7[_0x12eb('0x2a')][_0x12eb('0x34')]+'%'};return _0x4b3c55;})});}_0x48836c=_['merge']({},_0x48836c,_0x4ee9a7[_0x12eb('0x37')]);return _0x1db961['getDescriptions'](_0x48836c);}})[_0x12eb('0x1f')](function(_0x307bda){if(_0x307bda){_0x5d0053=_0x307bda[_0x12eb('0x3e')];if(!_0x4ee9a7['query'][_0x12eb('0x2f')]('nolimit')){_0x48836c[_0x12eb('0x18')]=qs[_0x12eb('0x18')](_0x4ee9a7[_0x12eb('0x2a')][_0x12eb('0x18')]);_0x48836c[_0x12eb('0x17')]=qs['offset'](_0x4ee9a7[_0x12eb('0x2a')]['offset']);}return _0x1db961[_0x12eb('0x47')](_0x48836c);}})[_0x12eb('0x1f')](function(_0xc5e20){if(_0xc5e20){return _0xc5e20?{'count':_0x5d0053,'rows':_0xc5e20}:null;}})[_0x12eb('0x1f')](respondWithResult(_0x23d459,null))['catch'](handleError(_0x23d459,null));};exports[_0x12eb('0x48')]=function(_0x5206c7,_0x25dce8,_0x2b414c){var _0x159be1={};var _0x1b4fe1={};var _0x19a8ce;var _0x4e5914;return db[_0x12eb('0x38')][_0x12eb('0x46')]({'where':{'id':_0x5206c7[_0x12eb('0x3d')]['id']}})[_0x12eb('0x1f')](handleEntityNotFound(_0x25dce8,null))[_0x12eb('0x1f')](function(_0x1ba475){if(_0x1ba475){_0x19a8ce=_0x1ba475;_0x1b4fe1['model']=_['keys'](db[_0x12eb('0x49')][_0x12eb('0x25')]);_0x1b4fe1['query']=_[_0x12eb('0x29')](_0x5206c7[_0x12eb('0x2a')]);_0x1b4fe1[_0x12eb('0x2b')]=_[_0x12eb('0x2d')](_0x1b4fe1[_0x12eb('0x28')],_0x1b4fe1[_0x12eb('0x2a')]);_0x159be1[_0x12eb('0x2c')]=_[_0x12eb('0x2d')](_0x1b4fe1[_0x12eb('0x28')],qs[_0x12eb('0x2e')](_0x5206c7['query'][_0x12eb('0x2e')]));_0x159be1[_0x12eb('0x2c')]=_0x159be1[_0x12eb('0x2c')][_0x12eb('0x3e')]?_0x159be1[_0x12eb('0x2c')]:_0x1b4fe1[_0x12eb('0x28')];_0x159be1['order']=qs[_0x12eb('0x31')](_0x5206c7[_0x12eb('0x2a')][_0x12eb('0x31')]);_0x159be1[_0x12eb('0x32')]=qs[_0x12eb('0x2b')](_[_0x12eb('0x33')](_0x5206c7['query'],_0x1b4fe1[_0x12eb('0x2b')]));if(_0x5206c7[_0x12eb('0x2a')]['filter']){_0x159be1[_0x12eb('0x32')]=_['merge'](_0x159be1['where'],{'$or':_[_0x12eb('0x36')](_0x159be1['attributes'],function(_0x5ec619){var _0x31b92b={};_0x31b92b[_0x5ec619]={'$like':'%'+_0x5206c7[_0x12eb('0x2a')]['filter']+'%'};return _0x31b92b;})});}_0x159be1=_[_0x12eb('0x35')]({},_0x159be1,_0x5206c7[_0x12eb('0x37')]);return _0x19a8ce['getTags'](_0x159be1);}})[_0x12eb('0x1f')](function(_0x214b3a){if(_0x214b3a){_0x4e5914=_0x214b3a[_0x12eb('0x3e')];if(!_0x5206c7[_0x12eb('0x2a')]['hasOwnProperty']('nolimit')){_0x159be1[_0x12eb('0x18')]=qs[_0x12eb('0x18')](_0x5206c7['query'][_0x12eb('0x18')]);_0x159be1[_0x12eb('0x17')]=qs[_0x12eb('0x17')](_0x5206c7['query'][_0x12eb('0x17')]);}return _0x19a8ce[_0x12eb('0x48')](_0x159be1);}})[_0x12eb('0x1f')](function(_0x569fff){if(_0x569fff){return _0x569fff?{'count':_0x4e5914,'rows':_0x569fff}:null;}})[_0x12eb('0x1f')](respondWithResult(_0x25dce8,null))['catch'](handleError(_0x25dce8,null));};exports['setTags']=function(_0x9dd522,_0xa4a9ef,_0x50d3df){if(_0x9dd522[_0x12eb('0x41')]['id']){delete _0x9dd522['body']['id'];}return db[_0x12eb('0x38')][_0x12eb('0x46')]({'where':{'id':_0x9dd522[_0x12eb('0x3d')]['id']}})[_0x12eb('0x1f')](handleEntityNotFound(_0xa4a9ef,null))['then'](function(_0x356feb){if(_0x356feb){return _0x356feb[_0x12eb('0x4a')](_0x9dd522[_0x12eb('0x41')][_0x12eb('0x4b')]||[]);}return null;})[_0x12eb('0x1f')](respondWithResult(_0xa4a9ef,null))[_0x12eb('0x3b')](handleError(_0xa4a9ef,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5aa92ff..85d7e23 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 _0xb78e=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x39bab2,_0x3e46e2){var _0x56c8b0=function(_0x48f68c){while(--_0x48f68c){_0x39bab2['push'](_0x39bab2['shift']());}};_0x56c8b0(++_0x3e46e2);}(_0xb78e,0x1c9));var _0xeb78=function(_0x16cadb,_0x2c2293){_0x16cadb=_0x16cadb-0x0;var _0x14f8b1=_0xb78e[_0x16cadb];return _0x14f8b1;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var logger=require('../../config/logger')(_0xeb78('0x2'));var moment=require(_0xeb78('0x3'));var BPromise=require(_0xeb78('0x4'));var rp=require(_0xeb78('0x5'));var fs=require('fs');var path=require(_0xeb78('0x6'));var rimraf=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var attributes=require(_0xeb78('0x9'));module['exports']=function(_0x3c35e7,_0x17a736){return _0x3c35e7[_0xeb78('0xa')](_0xeb78('0xb'),attributes,{'tableName':_0xeb78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7708=['../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','rimraf'];(function(_0x507d01,_0x58626d){var _0x308468=function(_0xe27311){while(--_0xe27311){_0x507d01['push'](_0x507d01['shift']());}};_0x308468(++_0x58626d);}(_0x7708,0x188));var _0x8770=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x7708[_0x45fe9c];return _0x233d48;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('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(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index a355297..a94f9f3 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 _0xde0d=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x19ac89,_0x2d5b73){var _0x375966=function(_0x12bc3b){while(--_0x12bc3b){_0x19ac89['push'](_0x19ac89['shift']());}};_0x375966(++_0x2d5b73);}(_0xde0d,0x13a));var _0xdde0=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xde0d[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xdde0('0x0'));var util=require(_0xdde0('0x1'));var moment=require(_0xdde0('0x2'));var BPromise=require(_0xdde0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdde0('0x4'));var db=require(_0xdde0('0x5'))['db'];var utils=require(_0xdde0('0x6'));var logger=require(_0xdde0('0x7'))(_0xdde0('0x8'));var config=require(_0xdde0('0x9'));var jayson=require(_0xdde0('0xa'));var client=jayson[_0xdde0('0xb')][_0xdde0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52ba63,_0x20be96,_0xdc75bc){return new BPromise(function(_0x4f63fd,_0x1ff520){return client[_0xdde0('0xd')](_0x52ba63,_0xdc75bc)['then'](function(_0x49a839){logger[_0xdde0('0xe')](_0xdde0('0xf'),_0x20be96,'request\x20sent');logger[_0xdde0('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20be96,'request\x20sent',JSON[_0xdde0('0x11')](_0x49a839));if(_0x49a839[_0xdde0('0x12')]){if(_0x49a839[_0xdde0('0x12')][_0xdde0('0x13')]===0x1f4){logger[_0xdde0('0x12')](_0xdde0('0xf'),_0x20be96,_0x49a839[_0xdde0('0x12')][_0xdde0('0x14')]);return _0x1ff520(_0x49a839[_0xdde0('0x12')]['message']);}logger['error'](_0xdde0('0xf'),_0x20be96,_0x49a839[_0xdde0('0x12')]['message']);return _0x4f63fd(_0x49a839['error'][_0xdde0('0x14')]);}else{logger['info'](_0xdde0('0xf'),_0x20be96,_0xdde0('0x15'));_0x4f63fd(_0x49a839[_0xdde0('0x16')][_0xdde0('0x14')]);}})[_0xdde0('0x17')](function(_0x391557){logger[_0xdde0('0x12')](_0xdde0('0xf'),_0x20be96,_0x391557);_0x1ff520(_0x391557);});});} \ No newline at end of file +var _0x8c67=['bluebird','ioredis','../../mysqldb','rpc','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0x8c67,0x98));var _0x78c6=function(_0x217c54,_0x3ed4ec){_0x217c54=_0x217c54-0x0;var _0x3869d6=_0x8c67[_0x217c54];return _0x3869d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78c6('0x0'));var BPromise=require(_0x78c6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78c6('0x2'));var db=require(_0x78c6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x78c6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x78c6('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587312,_0x368c1b,_0x1b5e2b){return new BPromise(function(_0x5a1dd5,_0x23a881){return client['request'](_0x587312,_0x1b5e2b)[_0x78c6('0x6')](function(_0x443a89){logger[_0x78c6('0x7')](_0x78c6('0x8'),_0x368c1b,_0x78c6('0x9'));logger[_0x78c6('0xa')](_0x78c6('0xb'),_0x368c1b,_0x78c6('0x9'),JSON['stringify'](_0x443a89));if(_0x443a89[_0x78c6('0xc')]){if(_0x443a89[_0x78c6('0xc')][_0x78c6('0xd')]===0x1f4){logger['error'](_0x78c6('0x8'),_0x368c1b,_0x443a89[_0x78c6('0xc')][_0x78c6('0xe')]);return _0x23a881(_0x443a89[_0x78c6('0xc')][_0x78c6('0xe')]);}logger['error'](_0x78c6('0x8'),_0x368c1b,_0x443a89[_0x78c6('0xc')][_0x78c6('0xe')]);return _0x5a1dd5(_0x443a89['error'][_0x78c6('0xe')]);}else{logger[_0x78c6('0x7')](_0x78c6('0x8'),_0x368c1b,_0x78c6('0x9'));_0x5a1dd5(_0x443a89[_0x78c6('0xf')][_0x78c6('0xe')]);}})[_0x78c6('0x10')](function(_0x3dff06){logger[_0x78c6('0xc')](_0x78c6('0x8'),_0x368c1b,_0x3dff06);_0x23a881(_0x3dff06);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 67690c9..fb30bda 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 _0x8387=['delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','show','create','/:id','update'];(function(_0x33010a,_0x299780){var _0x2a675f=function(_0x272b41){while(--_0x272b41){_0x33010a['push'](_0x33010a['shift']());}};_0x2a675f(++_0x299780);}(_0x8387,0x158));var _0x7838=function(_0x4360ce,_0xa1d8f4){_0x4360ce=_0x4360ce-0x0;var _0x47518=_0x8387[_0x4360ce];return _0x47518;};'use strict';var multer=require(_0x7838('0x0'));var util=require(_0x7838('0x1'));var path=require(_0x7838('0x2'));var timeout=require(_0x7838('0x3'));var express=require(_0x7838('0x4'));var router=express[_0x7838('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7838('0x6'));var interaction=require(_0x7838('0x7'));var config=require(_0x7838('0x8'));var controller=require(_0x7838('0x9'));router[_0x7838('0xa')]('/',auth['isAuthenticated'](),controller[_0x7838('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7838('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7838('0xd')]);router['put'](_0x7838('0xe'),auth['isAuthenticated'](),controller[_0x7838('0xf')]);router[_0x7838('0x10')](_0x7838('0xe'),auth[_0x7838('0x11')](),controller[_0x7838('0x12')]);module[_0x7838('0x13')]=router; \ No newline at end of file +var _0x3af2=['isAuthenticated','index','/:id','show','post','create','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x42c019,_0xd80ed3){var _0x1387f8=function(_0x452ecb){while(--_0x452ecb){_0x42c019['push'](_0x42c019['shift']());}};_0x1387f8(++_0xd80ed3);}(_0x3af2,0x67));var _0x23af=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x3af2[_0x274dd7];return _0x148829;};'use strict';var multer=require('multer');var util=require(_0x23af('0x0'));var path=require(_0x23af('0x1'));var timeout=require(_0x23af('0x2'));var express=require(_0x23af('0x3'));var router=express[_0x23af('0x4')]();var fs_extra=require(_0x23af('0x5'));var auth=require(_0x23af('0x6'));var interaction=require(_0x23af('0x7'));var config=require(_0x23af('0x8'));var controller=require(_0x23af('0x9'));router[_0x23af('0xa')]('/',auth[_0x23af('0xb')](),controller[_0x23af('0xc')]);router[_0x23af('0xa')](_0x23af('0xd'),auth['isAuthenticated'](),controller[_0x23af('0xe')]);router[_0x23af('0xf')]('/',auth[_0x23af('0xb')](),controller[_0x23af('0x10')]);router['put'](_0x23af('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x23af('0x11')](_0x23af('0xd'),auth[_0x23af('0xb')](),controller['destroy']);module[_0x23af('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a5f859d..0046b10 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 _0x0983=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0983,0x1a5));var _0x3098=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x0983[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x3098('0x0'));module[_0x3098('0x1')]={'type':{'type':Sequelize[_0x3098('0x2')](_0x3098('0x3'),_0x3098('0x4'),_0x3098('0x5'),_0x3098('0x6'),_0x3098('0x7')),'defaultValue':_0x3098('0x3')},'content':{'type':Sequelize[_0x3098('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3098('0x2')]('string','variable',_0x3098('0x5'))},'keyContent':{'type':Sequelize[_0x3098('0x8')]},'idField':{'type':Sequelize[_0x3098('0x8')]},'nameField':{'type':Sequelize[_0x3098('0x8')]},'customField':{'type':Sequelize[_0x3098('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x12d4=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x12d4,0x195));var _0x412d=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x12d4[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0x412d('0x0'));module[_0x412d('0x1')]={'type':{'type':Sequelize[_0x412d('0x2')](_0x412d('0x3'),_0x412d('0x4'),_0x412d('0x5'),_0x412d('0x6'),_0x412d('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x412d('0x8')]},'key':{'type':Sequelize[_0x412d('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x412d('0x4'),_0x412d('0x5'))},'keyContent':{'type':Sequelize[_0x412d('0x8')]},'idField':{'type':Sequelize[_0x412d('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x412d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x412d('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f010677..c4fd8c2 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 _0x5d25=['api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x3e013e,_0x4adb91){var _0x385690=function(_0x2ec9a9){while(--_0x2ec9a9){_0x3e013e['push'](_0x3e013e['shift']());}};_0x385690(++_0x4adb91);}(_0x5d25,0x103));var _0x55d2=function(_0x3583b0,_0x590ed5){_0x3583b0=_0x3583b0-0x0;var _0x48a67f=_0x5d25[_0x3583b0];return _0x48a67f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55d2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d2('0x1'));var rp=require(_0x55d2('0x2'));var moment=require(_0x55d2('0x3'));var BPromise=require(_0x55d2('0x4'));var Mustache=require(_0x55d2('0x5'));var util=require('util');var path=require(_0x55d2('0x6'));var sox=require('sox');var csv=require(_0x55d2('0x7'));var ejs=require(_0x55d2('0x8'));var fs=require('fs');var fs_extra=require(_0x55d2('0x9'));var _=require(_0x55d2('0xa'));var squel=require(_0x55d2('0xb'));var crypto=require(_0x55d2('0xc'));var jsforce=require(_0x55d2('0xd'));var deskjs=require(_0x55d2('0xe'));var toCsv=require(_0x55d2('0x7'));var querystring=require(_0x55d2('0xf'));var Papa=require(_0x55d2('0x10'));var Redis=require('ioredis');var authService=require(_0x55d2('0x11'));var qs=require(_0x55d2('0x12'));var as=require(_0x55d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55d2('0x14'))(_0x55d2('0x15'));var utils=require(_0x55d2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x55d2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369b52,_0x5c2321){_0x5c2321=_0x5c2321||0xcc;return function(_0xb5b67e){if(_0xb5b67e){return _0x369b52[_0x55d2('0x18')](_0x5c2321);}return _0x369b52[_0x55d2('0x19')](_0x5c2321)['end']();};}function respondWithResult(_0x5cd05b,_0x3b4fe7){_0x3b4fe7=_0x3b4fe7||0xc8;return function(_0x1f6d11){if(_0x1f6d11){return _0x5cd05b[_0x55d2('0x19')](_0x3b4fe7)[_0x55d2('0x1a')](_0x1f6d11);}};}function respondWithFilteredResult(_0x9457ba,_0x4bbd08){return function(_0x2ba0fb){if(_0x2ba0fb){var _0x47f4c4=typeof _0x4bbd08[_0x55d2('0x1b')]===_0x55d2('0x1c')&&typeof _0x4bbd08[_0x55d2('0x1d')]===_0x55d2('0x1c');var _0x2b2909=_0x2ba0fb['count'];var _0x20f73b=_0x47f4c4?0x0:_0x4bbd08['offset'];var _0x21385c=_0x47f4c4?_0x2ba0fb[_0x55d2('0x1e')]:_0x4bbd08[_0x55d2('0x1b')]+_0x4bbd08[_0x55d2('0x1d')];var _0xb381b8;if(_0x21385c>=_0x2b2909){_0x21385c=_0x2b2909;_0xb381b8=0xc8;}else{_0xb381b8=0xce;}_0x9457ba[_0x55d2('0x19')](_0xb381b8);return _0x9457ba[_0x55d2('0x1f')](_0x55d2('0x20'),_0x20f73b+'-'+_0x21385c+'/'+_0x2b2909)[_0x55d2('0x1a')](_0x2ba0fb);}return null;};}function patchUpdates(_0x2e6cae){return function(_0x5d9487){try{jsonpatch[_0x55d2('0x21')](_0x5d9487,_0x2e6cae,!![]);}catch(_0x5ccaf1){return BPromise['reject'](_0x5ccaf1);}return _0x5d9487['save']();};}function saveUpdates(_0x14e5cf,_0x374460){return function(_0x30f4b2){if(_0x30f4b2){return _0x30f4b2[_0x55d2('0x22')](_0x14e5cf)[_0x55d2('0x23')](function(_0x2904c1){return _0x2904c1;});}return null;};}function removeEntity(_0x276875,_0x593120){return function(_0x4cc06e){if(_0x4cc06e){return _0x4cc06e['destroy']()[_0x55d2('0x23')](function(){_0x276875['status'](0xcc)[_0x55d2('0x24')]();});}};}function handleEntityNotFound(_0x4eaa63,_0x4aa36b){return function(_0x1a0a16){if(!_0x1a0a16){_0x4eaa63[_0x55d2('0x18')](0x194);}return _0x1a0a16;};}function handleError(_0x28efa0,_0x2339bd){_0x2339bd=_0x2339bd||0x1f4;return function(_0x300c02){logger[_0x55d2('0x25')](_0x300c02['stack']);if(_0x300c02['name']){delete _0x300c02[_0x55d2('0x26')];}_0x28efa0[_0x55d2('0x19')](_0x2339bd)[_0x55d2('0x27')](_0x300c02);};}exports[_0x55d2('0x28')]=function(_0x461352,_0x29571d){var _0x1aa12c={},_0xab0b82={},_0x39f2e7={'count':0x0,'rows':[]};var _0x46b849=_['map'](db[_0x55d2('0x29')][_0x55d2('0x2a')],function(_0x46e0b2){return{'name':_0x46e0b2[_0x55d2('0x2b')],'type':_0x46e0b2[_0x55d2('0x2c')][_0x55d2('0x2d')]};});_0xab0b82['model']=_['map'](_0x46b849,_0x55d2('0x26'));_0xab0b82['query']=_[_0x55d2('0x2e')](_0x461352[_0x55d2('0x2f')]);_0xab0b82[_0x55d2('0x30')]=_[_0x55d2('0x31')](_0xab0b82['model'],_0xab0b82['query']);_0x1aa12c[_0x55d2('0x32')]=_['intersection'](_0xab0b82[_0x55d2('0x33')],qs['fields'](_0x461352[_0x55d2('0x2f')][_0x55d2('0x34')]));_0x1aa12c[_0x55d2('0x32')]=_0x1aa12c[_0x55d2('0x32')]['length']?_0x1aa12c[_0x55d2('0x32')]:_0xab0b82[_0x55d2('0x33')];if(!_0x461352[_0x55d2('0x2f')]['hasOwnProperty'](_0x55d2('0x35'))){_0x1aa12c[_0x55d2('0x1d')]=qs[_0x55d2('0x1d')](_0x461352[_0x55d2('0x2f')][_0x55d2('0x1d')]);_0x1aa12c[_0x55d2('0x1b')]=qs[_0x55d2('0x1b')](_0x461352[_0x55d2('0x2f')][_0x55d2('0x1b')]);}_0x1aa12c['order']=qs['sort'](_0x461352[_0x55d2('0x2f')]['sort']);_0x1aa12c[_0x55d2('0x36')]=qs[_0x55d2('0x30')](_['pick'](_0x461352[_0x55d2('0x2f')],_0xab0b82[_0x55d2('0x30')]),_0x46b849);if(_0x461352[_0x55d2('0x2f')][_0x55d2('0x37')]){_0x1aa12c[_0x55d2('0x36')]=_['merge'](_0x1aa12c[_0x55d2('0x36')],{'$or':_['map'](_0x46b849,function(_0x45cee2){if(_0x45cee2[_0x55d2('0x2c')]!==_0x55d2('0x38')){var _0x4bf190={};_0x4bf190[_0x45cee2[_0x55d2('0x26')]]={'$like':'%'+_0x461352['query']['filter']+'%'};return _0x4bf190;}})});}_0x1aa12c=_[_0x55d2('0x39')]({},_0x1aa12c,_0x461352[_0x55d2('0x3a')]);var _0x4a0fa4={'where':_0x1aa12c[_0x55d2('0x36')]};return db[_0x55d2('0x29')][_0x55d2('0x1e')](_0x4a0fa4)[_0x55d2('0x23')](function(_0x2ccdfa){_0x39f2e7[_0x55d2('0x1e')]=_0x2ccdfa;if(_0x461352[_0x55d2('0x2f')][_0x55d2('0x3b')]){_0x1aa12c[_0x55d2('0x3c')]=[{'all':!![]}];}return db[_0x55d2('0x29')][_0x55d2('0x3d')](_0x1aa12c);})[_0x55d2('0x23')](function(_0x1df5dd){_0x39f2e7[_0x55d2('0x3e')]=_0x1df5dd;return _0x39f2e7;})[_0x55d2('0x23')](respondWithFilteredResult(_0x29571d,_0x1aa12c))[_0x55d2('0x3f')](handleError(_0x29571d,null));};exports[_0x55d2('0x40')]=function(_0x3be8cd,_0x42b969){var _0x101f00={'raw':!![],'where':{'id':_0x3be8cd[_0x55d2('0x41')]['id']}},_0x5d260b={};_0x5d260b[_0x55d2('0x33')]=_[_0x55d2('0x2e')](db['ZendeskField'][_0x55d2('0x2a')]);_0x5d260b[_0x55d2('0x2f')]=_[_0x55d2('0x2e')](_0x3be8cd[_0x55d2('0x2f')]);_0x5d260b[_0x55d2('0x30')]=_[_0x55d2('0x31')](_0x5d260b['model'],_0x5d260b[_0x55d2('0x2f')]);_0x101f00[_0x55d2('0x32')]=_[_0x55d2('0x31')](_0x5d260b[_0x55d2('0x33')],qs[_0x55d2('0x34')](_0x3be8cd[_0x55d2('0x2f')][_0x55d2('0x34')]));_0x101f00[_0x55d2('0x32')]=_0x101f00[_0x55d2('0x32')]['length']?_0x101f00[_0x55d2('0x32')]:_0x5d260b['model'];if(_0x3be8cd['query'][_0x55d2('0x3b')]){_0x101f00[_0x55d2('0x3c')]=[{'all':!![]}];}_0x101f00=_[_0x55d2('0x39')]({},_0x101f00,_0x3be8cd[_0x55d2('0x3a')]);return db[_0x55d2('0x29')]['find'](_0x101f00)[_0x55d2('0x23')](handleEntityNotFound(_0x42b969,null))[_0x55d2('0x23')](respondWithResult(_0x42b969,null))[_0x55d2('0x3f')](handleError(_0x42b969,null));};exports['create']=function(_0x5ed333,_0x302230){return db[_0x55d2('0x29')][_0x55d2('0x42')](_0x5ed333[_0x55d2('0x43')],{})[_0x55d2('0x23')](respondWithResult(_0x302230,0xc9))['catch'](handleError(_0x302230,null));};exports[_0x55d2('0x22')]=function(_0x609df9,_0x21cfba){if(_0x609df9[_0x55d2('0x43')]['id']){delete _0x609df9['body']['id'];}return db[_0x55d2('0x29')][_0x55d2('0x44')]({'where':{'id':_0x609df9['params']['id']}})[_0x55d2('0x23')](handleEntityNotFound(_0x21cfba,null))['then'](saveUpdates(_0x609df9[_0x55d2('0x43')],null))[_0x55d2('0x23')](respondWithResult(_0x21cfba,null))['catch'](handleError(_0x21cfba,null));};exports[_0x55d2('0x45')]=function(_0x3dd8cc,_0x15fc5d){return db[_0x55d2('0x29')][_0x55d2('0x44')]({'where':{'id':_0x3dd8cc[_0x55d2('0x41')]['id']}})['then'](handleEntityNotFound(_0x15fc5d,null))['then'](removeEntity(_0x15fc5d,null))[_0x55d2('0x3f')](handleError(_0x15fc5d,null));}; \ No newline at end of file +var _0x7747=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','ZendeskField','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x4b9464,_0xc0b9cc){var _0x29dfdf=function(_0x705cce){while(--_0x705cce){_0x4b9464['push'](_0x4b9464['shift']());}};_0x29dfdf(++_0xc0b9cc);}(_0x7747,0xc5));var _0x7774=function(_0x3970d9,_0x43e60d){_0x3970d9=_0x3970d9-0x0;var _0x42ff83=_0x7747[_0x3970d9];return _0x42ff83;};'use strict';var emlformat=require(_0x7774('0x0'));var rimraf=require(_0x7774('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7774('0x2'));var rp=require('request-promise');var moment=require(_0x7774('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7774('0x4'));var util=require(_0x7774('0x5'));var path=require('path');var sox=require(_0x7774('0x6'));var csv=require('to-csv');var ejs=require(_0x7774('0x7'));var fs=require('fs');var fs_extra=require(_0x7774('0x8'));var _=require('lodash');var squel=require(_0x7774('0x9'));var crypto=require('crypto');var jsforce=require(_0x7774('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7774('0xb'));var querystring=require(_0x7774('0xc'));var Papa=require('papaparse');var Redis=require(_0x7774('0xd'));var authService=require(_0x7774('0xe'));var qs=require(_0x7774('0xf'));var as=require(_0x7774('0x10'));var hardwareService=require(_0x7774('0x11'));var logger=require(_0x7774('0x12'))(_0x7774('0x13'));var utils=require(_0x7774('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7774('0x15'));var db=require(_0x7774('0x16'))['db'];function respondWithStatusCode(_0x4be5a8,_0x37d23e){_0x37d23e=_0x37d23e||0xcc;return function(_0x21b2cf){if(_0x21b2cf){return _0x4be5a8[_0x7774('0x17')](_0x37d23e);}return _0x4be5a8[_0x7774('0x18')](_0x37d23e)['end']();};}function respondWithResult(_0x289a25,_0x5ee298){_0x5ee298=_0x5ee298||0xc8;return function(_0x2ed894){if(_0x2ed894){return _0x289a25['status'](_0x5ee298)[_0x7774('0x19')](_0x2ed894);}};}function respondWithFilteredResult(_0x4e1971,_0x116cad){return function(_0x1e4c9f){if(_0x1e4c9f){var _0x2c9dea=typeof _0x116cad[_0x7774('0x1a')]===_0x7774('0x1b')&&typeof _0x116cad[_0x7774('0x1c')]==='undefined';var _0x5e1791=_0x1e4c9f['count'];var _0x1938c1=_0x2c9dea?0x0:_0x116cad[_0x7774('0x1a')];var _0xba08c5=_0x2c9dea?_0x1e4c9f[_0x7774('0x1d')]:_0x116cad[_0x7774('0x1a')]+_0x116cad['limit'];var _0xce7d51;if(_0xba08c5>=_0x5e1791){_0xba08c5=_0x5e1791;_0xce7d51=0xc8;}else{_0xce7d51=0xce;}_0x4e1971[_0x7774('0x18')](_0xce7d51);return _0x4e1971[_0x7774('0x1e')](_0x7774('0x1f'),_0x1938c1+'-'+_0xba08c5+'/'+_0x5e1791)[_0x7774('0x19')](_0x1e4c9f);}return null;};}function patchUpdates(_0x13c50f){return function(_0xad20fe){try{jsonpatch['apply'](_0xad20fe,_0x13c50f,!![]);}catch(_0x4a4700){return BPromise['reject'](_0x4a4700);}return _0xad20fe[_0x7774('0x20')]();};}function saveUpdates(_0xa80a4a,_0x2f0b92){return function(_0x1c96fc){if(_0x1c96fc){return _0x1c96fc['update'](_0xa80a4a)[_0x7774('0x21')](function(_0x146371){return _0x146371;});}return null;};}function removeEntity(_0x256d07,_0x27de44){return function(_0xe88d7){if(_0xe88d7){return _0xe88d7[_0x7774('0x22')]()[_0x7774('0x21')](function(){_0x256d07[_0x7774('0x18')](0xcc)[_0x7774('0x23')]();});}};}function handleEntityNotFound(_0x37f912,_0x53da3f){return function(_0x5a1b06){if(!_0x5a1b06){_0x37f912[_0x7774('0x17')](0x194);}return _0x5a1b06;};}function handleError(_0x56710a,_0x48fbe5){_0x48fbe5=_0x48fbe5||0x1f4;return function(_0x176f51){logger[_0x7774('0x24')](_0x176f51[_0x7774('0x25')]);if(_0x176f51[_0x7774('0x26')]){delete _0x176f51[_0x7774('0x26')];}_0x56710a['status'](_0x48fbe5)['send'](_0x176f51);};}exports[_0x7774('0x27')]=function(_0x3e0aeb,_0x185abf){var _0x379d69={},_0x42acc2={},_0x36f078={'count':0x0,'rows':[]};var _0x5a8af2=_[_0x7774('0x28')](db['ZendeskField'][_0x7774('0x29')],function(_0x22c99a){return{'name':_0x22c99a[_0x7774('0x2a')],'type':_0x22c99a[_0x7774('0x2b')][_0x7774('0x2c')]};});_0x42acc2[_0x7774('0x2d')]=_['map'](_0x5a8af2,_0x7774('0x26'));_0x42acc2['query']=_[_0x7774('0x2e')](_0x3e0aeb['query']);_0x42acc2[_0x7774('0x2f')]=_[_0x7774('0x30')](_0x42acc2[_0x7774('0x2d')],_0x42acc2['query']);_0x379d69[_0x7774('0x31')]=_['intersection'](_0x42acc2[_0x7774('0x2d')],qs[_0x7774('0x32')](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x32')]));_0x379d69[_0x7774('0x31')]=_0x379d69['attributes'][_0x7774('0x34')]?_0x379d69[_0x7774('0x31')]:_0x42acc2[_0x7774('0x2d')];if(!_0x3e0aeb['query'][_0x7774('0x35')](_0x7774('0x36'))){_0x379d69[_0x7774('0x1c')]=qs['limit'](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x1c')]);_0x379d69[_0x7774('0x1a')]=qs[_0x7774('0x1a')](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x1a')]);}_0x379d69['order']=qs[_0x7774('0x37')](_0x3e0aeb[_0x7774('0x33')][_0x7774('0x37')]);_0x379d69[_0x7774('0x38')]=qs[_0x7774('0x2f')](_[_0x7774('0x39')](_0x3e0aeb[_0x7774('0x33')],_0x42acc2['filters']),_0x5a8af2);if(_0x3e0aeb['query'][_0x7774('0x3a')]){_0x379d69[_0x7774('0x38')]=_['merge'](_0x379d69[_0x7774('0x38')],{'$or':_[_0x7774('0x28')](_0x5a8af2,function(_0x2b0ab0){if(_0x2b0ab0[_0x7774('0x2b')]!=='VIRTUAL'){var _0x1e82cb={};_0x1e82cb[_0x2b0ab0['name']]={'$like':'%'+_0x3e0aeb[_0x7774('0x33')][_0x7774('0x3a')]+'%'};return _0x1e82cb;}})});}_0x379d69=_[_0x7774('0x3b')]({},_0x379d69,_0x3e0aeb['options']);var _0x297c6b={'where':_0x379d69['where']};return db[_0x7774('0x3c')][_0x7774('0x1d')](_0x297c6b)['then'](function(_0x2785ff){_0x36f078[_0x7774('0x1d')]=_0x2785ff;if(_0x3e0aeb[_0x7774('0x33')][_0x7774('0x3d')]){_0x379d69[_0x7774('0x3e')]=[{'all':!![]}];}return db[_0x7774('0x3c')][_0x7774('0x3f')](_0x379d69);})['then'](function(_0x5e0f95){_0x36f078[_0x7774('0x40')]=_0x5e0f95;return _0x36f078;})['then'](respondWithFilteredResult(_0x185abf,_0x379d69))[_0x7774('0x41')](handleError(_0x185abf,null));};exports[_0x7774('0x42')]=function(_0x1f6edd,_0x5a1632){var _0x1b9fec={'raw':!![],'where':{'id':_0x1f6edd[_0x7774('0x43')]['id']}},_0x7b6333={};_0x7b6333['model']=_[_0x7774('0x2e')](db[_0x7774('0x3c')][_0x7774('0x29')]);_0x7b6333['query']=_[_0x7774('0x2e')](_0x1f6edd[_0x7774('0x33')]);_0x7b6333['filters']=_[_0x7774('0x30')](_0x7b6333['model'],_0x7b6333[_0x7774('0x33')]);_0x1b9fec[_0x7774('0x31')]=_[_0x7774('0x30')](_0x7b6333[_0x7774('0x2d')],qs[_0x7774('0x32')](_0x1f6edd[_0x7774('0x33')][_0x7774('0x32')]));_0x1b9fec['attributes']=_0x1b9fec[_0x7774('0x31')]['length']?_0x1b9fec[_0x7774('0x31')]:_0x7b6333[_0x7774('0x2d')];if(_0x1f6edd[_0x7774('0x33')][_0x7774('0x3d')]){_0x1b9fec[_0x7774('0x3e')]=[{'all':!![]}];}_0x1b9fec=_[_0x7774('0x3b')]({},_0x1b9fec,_0x1f6edd[_0x7774('0x44')]);return db[_0x7774('0x3c')][_0x7774('0x45')](_0x1b9fec)[_0x7774('0x21')](handleEntityNotFound(_0x5a1632,null))[_0x7774('0x21')](respondWithResult(_0x5a1632,null))[_0x7774('0x41')](handleError(_0x5a1632,null));};exports[_0x7774('0x46')]=function(_0x3d432d,_0xf44eb3){return db[_0x7774('0x3c')][_0x7774('0x46')](_0x3d432d[_0x7774('0x47')],{})['then'](respondWithResult(_0xf44eb3,0xc9))[_0x7774('0x41')](handleError(_0xf44eb3,null));};exports[_0x7774('0x48')]=function(_0x257159,_0x51640b){if(_0x257159[_0x7774('0x47')]['id']){delete _0x257159[_0x7774('0x47')]['id'];}return db[_0x7774('0x3c')][_0x7774('0x45')]({'where':{'id':_0x257159['params']['id']}})[_0x7774('0x21')](handleEntityNotFound(_0x51640b,null))[_0x7774('0x21')](saveUpdates(_0x257159[_0x7774('0x47')],null))[_0x7774('0x21')](respondWithResult(_0x51640b,null))[_0x7774('0x41')](handleError(_0x51640b,null));};exports[_0x7774('0x22')]=function(_0xc2743,_0x5005b5){return db[_0x7774('0x3c')][_0x7774('0x45')]({'where':{'id':_0xc2743[_0x7774('0x43')]['id']}})['then'](handleEntityNotFound(_0x5005b5,null))['then'](removeEntity(_0x5005b5,null))['catch'](handleError(_0x5005b5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 120f1c6..83a7654 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 _0x49d1=['moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','api'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x49d1,0x1ab));var _0x149d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x49d1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x149d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x149d('0x1'));var moment=require(_0x149d('0x2'));var BPromise=require(_0x149d('0x3'));var rp=require(_0x149d('0x4'));var fs=require('fs');var path=require(_0x149d('0x5'));var rimraf=require('rimraf');var config=require(_0x149d('0x6'));var attributes=require(_0x149d('0x7'));module['exports']=function(_0x504b55,_0x1fa6c8){return _0x504b55[_0x149d('0x8')](_0x149d('0x9'),attributes,{'tableName':_0x149d('0xa'),'paranoid':![],'indexes':[{'name':_0x149d('0xb'),'fields':['idField',_0x149d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7df3=['exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZendeskField.attributes'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7df3,0x1c8));var _0x37df=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7df3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var logger=require(_0x37df('0x2'))(_0x37df('0x3'));var moment=require(_0x37df('0x4'));var BPromise=require(_0x37df('0x5'));var rp=require(_0x37df('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37df('0x7'));var config=require('../../config/environment');var attributes=require(_0x37df('0x8'));module[_0x37df('0x9')]=function(_0x2418e8,_0x4cc7aa){return _0x2418e8[_0x37df('0xa')](_0x37df('0xb'),attributes,{'tableName':_0x37df('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x37df('0xd'),_0x37df('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 49e7578..2300f5d 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 _0x55d2=['stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x4d2938,_0x332d65){var _0x5e7d9b=function(_0x135e24){while(--_0x135e24){_0x4d2938['push'](_0x4d2938['shift']());}};_0x5e7d9b(++_0x332d65);}(_0x55d2,0x70));var _0x255d=function(_0x1a8207,_0x576621){_0x1a8207=_0x1a8207-0x0;var _0x4bc774=_0x55d2[_0x1a8207];return _0x4bc774;};'use strict';var _=require(_0x255d('0x0'));var util=require(_0x255d('0x1'));var moment=require(_0x255d('0x2'));var BPromise=require(_0x255d('0x3'));var rs=require(_0x255d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x255d('0x5'))(_0x255d('0x6'));var config=require('../../config/environment');var jayson=require(_0x255d('0x7'));var client=jayson[_0x255d('0x8')][_0x255d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336087,_0x532067,_0x2de9c3){return new BPromise(function(_0x14f479,_0x187070){return client[_0x255d('0xa')](_0x336087,_0x2de9c3)['then'](function(_0x624577){logger[_0x255d('0xb')]('ZendeskField,\x20%s,\x20%s',_0x532067,_0x255d('0xc'));logger[_0x255d('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x532067,'request\x20sent',JSON[_0x255d('0xe')](_0x624577));if(_0x624577[_0x255d('0xf')]){if(_0x624577[_0x255d('0xf')][_0x255d('0x10')]===0x1f4){logger[_0x255d('0xf')](_0x255d('0x11'),_0x532067,_0x624577[_0x255d('0xf')]['message']);return _0x187070(_0x624577[_0x255d('0xf')][_0x255d('0x12')]);}logger[_0x255d('0xf')]('ZendeskField,\x20%s,\x20%s',_0x532067,_0x624577[_0x255d('0xf')]['message']);return _0x14f479(_0x624577[_0x255d('0xf')][_0x255d('0x12')]);}else{logger[_0x255d('0xb')](_0x255d('0x11'),_0x532067,'request\x20sent');_0x14f479(_0x624577[_0x255d('0x13')]['message']);}})[_0x255d('0x14')](function(_0x56909d){logger[_0x255d('0xf')]('ZendeskField,\x20%s,\x20%s',_0x532067,_0x56909d);_0x187070(_0x56909d);});});} \ No newline at end of file +var _0xd576=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4245ad,_0x109fa6){var _0x37100c=function(_0x83a41f){while(--_0x83a41f){_0x4245ad['push'](_0x4245ad['shift']());}};_0x37100c(++_0x109fa6);}(_0xd576,0xd2));var _0x6d57=function(_0x7677eb,_0x59ba67){_0x7677eb=_0x7677eb-0x0;var _0x523039=_0xd576[_0x7677eb];return _0x523039;};'use strict';var _=require('lodash');var util=require(_0x6d57('0x0'));var moment=require(_0x6d57('0x1'));var BPromise=require(_0x6d57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d57('0x3'));var db=require(_0x6d57('0x4'))['db'];var utils=require(_0x6d57('0x5'));var logger=require(_0x6d57('0x6'))(_0x6d57('0x7'));var config=require(_0x6d57('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d57('0x9')][_0x6d57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32380c,_0x29f977,_0x47db63){return new BPromise(function(_0x327f9c,_0x4ba792){return client[_0x6d57('0xb')](_0x32380c,_0x47db63)[_0x6d57('0xc')](function(_0x59267f){logger[_0x6d57('0xd')](_0x6d57('0xe'),_0x29f977,_0x6d57('0xf'));logger[_0x6d57('0x10')](_0x6d57('0x11'),_0x29f977,_0x6d57('0xf'),JSON[_0x6d57('0x12')](_0x59267f));if(_0x59267f[_0x6d57('0x13')]){if(_0x59267f[_0x6d57('0x13')][_0x6d57('0x14')]===0x1f4){logger[_0x6d57('0x13')](_0x6d57('0xe'),_0x29f977,_0x59267f[_0x6d57('0x13')]['message']);return _0x4ba792(_0x59267f[_0x6d57('0x13')][_0x6d57('0x15')]);}logger['error'](_0x6d57('0xe'),_0x29f977,_0x59267f[_0x6d57('0x13')][_0x6d57('0x15')]);return _0x327f9c(_0x59267f[_0x6d57('0x13')][_0x6d57('0x15')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x29f977,_0x6d57('0xf'));_0x327f9c(_0x59267f[_0x6d57('0x16')][_0x6d57('0x15')]);}})[_0x6d57('0x17')](function(_0x3cb6d6){logger[_0x6d57('0x13')](_0x6d57('0xe'),_0x29f977,_0x3cb6d6);_0x4ba792(_0x3cb6d6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 076b46b..8c2e4e8 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 _0xaa30=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x126b00,_0x5bd297){var _0xa6bd2d=function(_0xe1c709){while(--_0xe1c709){_0x126b00['push'](_0x126b00['shift']());}};_0xa6bd2d(++_0x5bd297);}(_0xaa30,0x1c3));var _0x0aa3=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xaa30[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0aa3('0x0'));var util=require(_0x0aa3('0x1'));var path=require(_0x0aa3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0aa3('0x3'));var router=express['Router']();var fs_extra=require(_0x0aa3('0x4'));var auth=require(_0x0aa3('0x5'));var interaction=require(_0x0aa3('0x6'));var config=require(_0x0aa3('0x7'));var controller=require(_0x0aa3('0x8'));router[_0x0aa3('0x9')]('/',auth[_0x0aa3('0xa')](),controller[_0x0aa3('0xb')]);router[_0x0aa3('0x9')](_0x0aa3('0xc'),auth[_0x0aa3('0xa')](),controller['show']);router[_0x0aa3('0x9')](_0x0aa3('0xd'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0xe')]);router['get']('/:id/fields',auth[_0x0aa3('0xa')](),controller[_0x0aa3('0xf')]);router[_0x0aa3('0x10')]('/',auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x11')]);router[_0x0aa3('0x10')](_0x0aa3('0xd'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x12')]);router[_0x0aa3('0x13')](_0x0aa3('0xc'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x14')]);router[_0x0aa3('0x15')](_0x0aa3('0xc'),auth[_0x0aa3('0xa')](),controller[_0x0aa3('0x16')]);module['exports']=router; \ No newline at end of file +var _0xbbb1=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0xbbb1,0x11e));var _0x1bbb=function(_0x1f3408,_0x42ebc6){_0x1f3408=_0x1f3408-0x0;var _0x2e897e=_0xbbb1[_0x1f3408];return _0x2e897e;};'use strict';var multer=require('multer');var util=require(_0x1bbb('0x0'));var path=require(_0x1bbb('0x1'));var timeout=require(_0x1bbb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1bbb('0x3'));var auth=require(_0x1bbb('0x4'));var interaction=require(_0x1bbb('0x5'));var config=require(_0x1bbb('0x6'));var controller=require(_0x1bbb('0x7'));router[_0x1bbb('0x8')]('/',auth[_0x1bbb('0x9')](),controller[_0x1bbb('0xa')]);router[_0x1bbb('0x8')]('/:id',auth[_0x1bbb('0x9')](),controller[_0x1bbb('0xb')]);router['get'](_0x1bbb('0xc'),auth[_0x1bbb('0x9')](),controller[_0x1bbb('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x1bbb('0xe')]('/',auth['isAuthenticated'](),controller[_0x1bbb('0xf')]);router['post'](_0x1bbb('0xc'),auth[_0x1bbb('0x9')](),controller[_0x1bbb('0x10')]);router[_0x1bbb('0x11')](_0x1bbb('0x12'),auth[_0x1bbb('0x9')](),controller[_0x1bbb('0x13')]);router[_0x1bbb('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x1bbb('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 7a06b35..d11921d 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['exports','STRING','sequelize'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x153f,0x15b));var _0xf153=function(_0x21d350,_0x2ee05d){_0x21d350=_0x21d350-0x0;var _0x4545a8=_0x153f[_0x21d350];return _0x4545a8;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0x00bb=['STRING','sequelize','exports'];(function(_0x2d29bd,_0x287528){var _0x567045=function(_0x35edf6){while(--_0x35edf6){_0x2d29bd['push'](_0x2d29bd['shift']());}};_0x567045(++_0x287528);}(_0x00bb,0x1d8));var _0xb00b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x00bb[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f057db2..a8eed2e 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 _0x325f=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','rows','catch','show','keys','ZohoAccount','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','pick','nolimit','addConfiguration','AccountId','Descriptions','getDescriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','refreshToken','zoho.eu','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','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','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','update'];(function(_0x40c3b,_0x320f73){var _0x118c58=function(_0x13dad9){while(--_0x13dad9){_0x40c3b['push'](_0x40c3b['shift']());}};_0x118c58(++_0x320f73);}(_0x325f,0x161));var _0xf325=function(_0x4fcbc4,_0x43f789){_0x4fcbc4=_0x4fcbc4-0x0;var _0x2a2c23=_0x325f[_0x4fcbc4];return _0x2a2c23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf325('0x0'));var zipdir=require(_0xf325('0x1'));var jsonpatch=require(_0xf325('0x2'));var rp=require(_0xf325('0x3'));var moment=require(_0xf325('0x4'));var BPromise=require(_0xf325('0x5'));var Mustache=require(_0xf325('0x6'));var util=require(_0xf325('0x7'));var path=require(_0xf325('0x8'));var sox=require(_0xf325('0x9'));var csv=require(_0xf325('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf325('0xb'));var _=require(_0xf325('0xc'));var squel=require(_0xf325('0xd'));var crypto=require('crypto');var jsforce=require(_0xf325('0xe'));var deskjs=require(_0xf325('0xf'));var toCsv=require(_0xf325('0xa'));var querystring=require(_0xf325('0x10'));var Papa=require(_0xf325('0x11'));var Redis=require(_0xf325('0x12'));var authService=require(_0xf325('0x13'));var qs=require(_0xf325('0x14'));var as=require(_0xf325('0x15'));var hardwareService=require(_0xf325('0x16'));var logger=require(_0xf325('0x17'))(_0xf325('0x18'));var utils=require(_0xf325('0x19'));var config=require(_0xf325('0x1a'));var licenseUtil=require(_0xf325('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf325('0x1c'));function respondWithStatusCode(_0x3807aa,_0x18614c){_0x18614c=_0x18614c||0xcc;return function(_0x1c9ec1){if(_0x1c9ec1){return _0x3807aa[_0xf325('0x1d')](_0x18614c);}return _0x3807aa['status'](_0x18614c)[_0xf325('0x1e')]();};}function respondWithResult(_0x47d0b5,_0x42942a){_0x42942a=_0x42942a||0xc8;return function(_0x5a587d){if(_0x5a587d){return _0x47d0b5[_0xf325('0x1f')](_0x42942a)[_0xf325('0x20')](_0x5a587d);}};}function respondWithFilteredResult(_0x4b36da,_0x340c06){return function(_0x1d285b){if(_0x1d285b){var _0x2bb335=typeof _0x340c06[_0xf325('0x21')]===_0xf325('0x22')&&typeof _0x340c06['limit']===_0xf325('0x22');var _0x28d7ef=_0x1d285b[_0xf325('0x23')];var _0x1bcde2=_0x2bb335?0x0:_0x340c06[_0xf325('0x21')];var _0x50de34=_0x2bb335?_0x1d285b['count']:_0x340c06[_0xf325('0x21')]+_0x340c06[_0xf325('0x24')];var _0x58a861;if(_0x50de34>=_0x28d7ef){_0x50de34=_0x28d7ef;_0x58a861=0xc8;}else{_0x58a861=0xce;}_0x4b36da['status'](_0x58a861);return _0x4b36da['set']('Content-Range',_0x1bcde2+'-'+_0x50de34+'/'+_0x28d7ef)[_0xf325('0x20')](_0x1d285b);}return null;};}function patchUpdates(_0xc2997){return function(_0x283956){try{jsonpatch[_0xf325('0x25')](_0x283956,_0xc2997,!![]);}catch(_0x174700){return BPromise['reject'](_0x174700);}return _0x283956[_0xf325('0x26')]();};}function saveUpdates(_0xa8d38b,_0x216870){return function(_0x2aa4cf){if(_0x2aa4cf){return _0x2aa4cf[_0xf325('0x27')](_0xa8d38b)[_0xf325('0x28')](function(_0x31dd17){return _0x31dd17;});}return null;};}function removeEntity(_0x274d70,_0x455e41){return function(_0x167e19){if(_0x167e19){return _0x167e19[_0xf325('0x29')]()[_0xf325('0x28')](function(){_0x274d70[_0xf325('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ceedf,_0x48d505){return function(_0x263b4c){if(!_0x263b4c){_0x5ceedf['sendStatus'](0x194);}return _0x263b4c;};}function handleError(_0x4782db,_0x57776e){_0x57776e=_0x57776e||0x1f4;return function(_0x5de7e1){logger[_0xf325('0x2a')](_0x5de7e1[_0xf325('0x2b')]);if(_0x5de7e1[_0xf325('0x2c')]){delete _0x5de7e1['name'];}_0x4782db[_0xf325('0x1f')](_0x57776e)[_0xf325('0x2d')](_0x5de7e1);};}exports[_0xf325('0x2e')]=function(_0x33ca91,_0x4ace9a){var _0x34b17b={},_0x2aa3bd={},_0x165c0e={'count':0x0,'rows':[]};var _0x7855af=_[_0xf325('0x2f')](db['ZohoAccount'][_0xf325('0x30')],function(_0x563d6d){return{'name':_0x563d6d[_0xf325('0x31')],'type':_0x563d6d[_0xf325('0x32')][_0xf325('0x33')]};});_0x2aa3bd[_0xf325('0x34')]=_[_0xf325('0x2f')](_0x7855af,'name');_0x2aa3bd['query']=_['keys'](_0x33ca91[_0xf325('0x35')]);_0x2aa3bd[_0xf325('0x36')]=_[_0xf325('0x37')](_0x2aa3bd[_0xf325('0x34')],_0x2aa3bd[_0xf325('0x35')]);_0x34b17b[_0xf325('0x38')]=_[_0xf325('0x37')](_0x2aa3bd[_0xf325('0x34')],qs[_0xf325('0x39')](_0x33ca91[_0xf325('0x35')]['fields']));_0x34b17b[_0xf325('0x38')]=_0x34b17b[_0xf325('0x38')][_0xf325('0x3a')]?_0x34b17b[_0xf325('0x38')]:_0x2aa3bd[_0xf325('0x34')];if(!_0x33ca91[_0xf325('0x35')][_0xf325('0x3b')]('nolimit')){_0x34b17b[_0xf325('0x24')]=qs['limit'](_0x33ca91['query'][_0xf325('0x24')]);_0x34b17b[_0xf325('0x21')]=qs[_0xf325('0x21')](_0x33ca91[_0xf325('0x35')][_0xf325('0x21')]);}_0x34b17b['order']=qs[_0xf325('0x3c')](_0x33ca91[_0xf325('0x35')][_0xf325('0x3c')]);_0x34b17b[_0xf325('0x3d')]=qs[_0xf325('0x36')](_['pick'](_0x33ca91[_0xf325('0x35')],_0x2aa3bd[_0xf325('0x36')]),_0x7855af);if(_0x33ca91['query'][_0xf325('0x3e')]){_0x34b17b[_0xf325('0x3d')]=_[_0xf325('0x3f')](_0x34b17b['where'],{'$or':_[_0xf325('0x2f')](_0x7855af,function(_0x38f030){if(_0x38f030[_0xf325('0x32')]!=='VIRTUAL'){var _0x3059aa={};_0x3059aa[_0x38f030[_0xf325('0x2c')]]={'$like':'%'+_0x33ca91[_0xf325('0x35')][_0xf325('0x3e')]+'%'};return _0x3059aa;}})});}_0x34b17b=_[_0xf325('0x3f')]({},_0x34b17b,_0x33ca91[_0xf325('0x40')]);var _0x2cc616={'where':_0x34b17b[_0xf325('0x3d')]};return db['ZohoAccount'][_0xf325('0x23')](_0x2cc616)[_0xf325('0x28')](function(_0x13da5b){_0x165c0e[_0xf325('0x23')]=_0x13da5b;if(_0x33ca91[_0xf325('0x35')][_0xf325('0x41')]){_0x34b17b[_0xf325('0x42')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x34b17b);})[_0xf325('0x28')](function(_0x1132cc){_0x165c0e[_0xf325('0x43')]=_0x1132cc;return _0x165c0e;})[_0xf325('0x28')](respondWithFilteredResult(_0x4ace9a,_0x34b17b))[_0xf325('0x44')](handleError(_0x4ace9a,null));};exports[_0xf325('0x45')]=function(_0x41c900,_0x3c0b63){var _0x2dd9e8={'raw':![],'where':{'id':_0x41c900['params']['id']}},_0x2e185c={};_0x2e185c[_0xf325('0x34')]=_[_0xf325('0x46')](db[_0xf325('0x47')][_0xf325('0x30')]);_0x2e185c[_0xf325('0x35')]=_[_0xf325('0x46')](_0x41c900[_0xf325('0x35')]);_0x2e185c[_0xf325('0x36')]=_['intersection'](_0x2e185c[_0xf325('0x34')],_0x2e185c[_0xf325('0x35')]);_0x2dd9e8[_0xf325('0x38')]=_[_0xf325('0x37')](_0x2e185c['model'],qs['fields'](_0x41c900[_0xf325('0x35')]['fields']));_0x2dd9e8['attributes']=_0x2dd9e8['attributes'][_0xf325('0x3a')]?_0x2dd9e8[_0xf325('0x38')]:_0x2e185c[_0xf325('0x34')];if(_0x41c900[_0xf325('0x35')][_0xf325('0x41')]){_0x2dd9e8[_0xf325('0x42')]=[{'all':!![]}];}_0x2dd9e8=_[_0xf325('0x3f')]({},_0x2dd9e8,_0x41c900['options']);return db[_0xf325('0x47')]['find'](_0x2dd9e8)[_0xf325('0x28')](handleEntityNotFound(_0x3c0b63,null))['then'](respondWithResult(_0x3c0b63,null))[_0xf325('0x44')](handleError(_0x3c0b63,null));};exports[_0xf325('0x48')]=function(_0x583a17,_0x3a1346){return db[_0xf325('0x47')][_0xf325('0x48')](_0x583a17[_0xf325('0x49')],{})[_0xf325('0x28')](respondWithResult(_0x3a1346,0xc9))[_0xf325('0x44')](handleError(_0x3a1346,null));};exports[_0xf325('0x27')]=function(_0x4d8050,_0x49ff98){if(_0x4d8050[_0xf325('0x49')]['id']){delete _0x4d8050[_0xf325('0x49')]['id'];}return db[_0xf325('0x47')][_0xf325('0x4a')]({'where':{'id':_0x4d8050[_0xf325('0x4b')]['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x49ff98,null))[_0xf325('0x28')](saveUpdates(_0x4d8050['body'],null))[_0xf325('0x28')](respondWithResult(_0x49ff98,null))['catch'](handleError(_0x49ff98,null));};exports[_0xf325('0x29')]=function(_0x50b502,_0x191067){return db[_0xf325('0x47')][_0xf325('0x4a')]({'where':{'id':_0x50b502[_0xf325('0x4b')]['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x191067,null))[_0xf325('0x28')](removeEntity(_0x191067,null))['catch'](handleError(_0x191067,null));};exports[_0xf325('0x4c')]=function(_0x2d43e2,_0x3ff9df,_0x1c3547){var _0x15dc71={};var _0x23065f={};var _0x51bb3d;var _0x2fe2d0;return db[_0xf325('0x47')][_0xf325('0x4d')]({'where':{'id':_0x2d43e2[_0xf325('0x4b')]['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x3ff9df,null))[_0xf325('0x28')](function(_0x5801a6){if(_0x5801a6){_0x51bb3d=_0x5801a6;_0x23065f[_0xf325('0x34')]=_[_0xf325('0x46')](db[_0xf325('0x4e')][_0xf325('0x30')]);_0x23065f[_0xf325('0x35')]=_[_0xf325('0x46')](_0x2d43e2[_0xf325('0x35')]);_0x23065f[_0xf325('0x36')]=_['intersection'](_0x23065f[_0xf325('0x34')],_0x23065f['query']);_0x15dc71['attributes']=_[_0xf325('0x37')](_0x23065f[_0xf325('0x34')],qs[_0xf325('0x39')](_0x2d43e2[_0xf325('0x35')][_0xf325('0x39')]));_0x15dc71['attributes']=_0x15dc71[_0xf325('0x38')][_0xf325('0x3a')]?_0x15dc71[_0xf325('0x38')]:_0x23065f['model'];_0x15dc71['order']=qs[_0xf325('0x3c')](_0x2d43e2[_0xf325('0x35')][_0xf325('0x3c')]);_0x15dc71[_0xf325('0x3d')]=qs[_0xf325('0x36')](_[_0xf325('0x4f')](_0x2d43e2[_0xf325('0x35')],_0x23065f['filters']));if(_0x2d43e2[_0xf325('0x35')][_0xf325('0x3e')]){_0x15dc71['where']=_['merge'](_0x15dc71['where'],{'$or':_['map'](_0x15dc71[_0xf325('0x38')],function(_0x2332e0){var _0x2aaae9={};_0x2aaae9[_0x2332e0]={'$like':'%'+_0x2d43e2[_0xf325('0x35')][_0xf325('0x3e')]+'%'};return _0x2aaae9;})});}_0x15dc71=_[_0xf325('0x3f')]({},_0x15dc71,_0x2d43e2['options']);return _0x51bb3d[_0xf325('0x4c')](_0x15dc71);}})[_0xf325('0x28')](function(_0x1f9b74){if(_0x1f9b74){_0x2fe2d0=_0x1f9b74['length'];if(!_0x2d43e2[_0xf325('0x35')][_0xf325('0x3b')](_0xf325('0x50'))){_0x15dc71['limit']=qs[_0xf325('0x24')](_0x2d43e2[_0xf325('0x35')][_0xf325('0x24')]);_0x15dc71[_0xf325('0x21')]=qs[_0xf325('0x21')](_0x2d43e2['query'][_0xf325('0x21')]);}return _0x51bb3d[_0xf325('0x4c')](_0x15dc71);}})[_0xf325('0x28')](function(_0x5dcc19){if(_0x5dcc19){return _0x5dcc19?{'count':_0x2fe2d0,'rows':_0x5dcc19}:null;}})[_0xf325('0x28')](respondWithResult(_0x3ff9df,null))[_0xf325('0x44')](handleError(_0x3ff9df,null));};exports[_0xf325('0x51')]=function(_0x1b1a05,_0x3b0f88,_0x575de1){if(_0x1b1a05[_0xf325('0x49')]['id']){delete _0x1b1a05['body']['id'];}return db[_0xf325('0x47')]['findOne']({'where':{'id':_0x1b1a05['params']['id']}})[_0xf325('0x28')](handleEntityNotFound(_0x3b0f88,null))[_0xf325('0x28')](function(_0x191869){if(_0x191869){_0x1b1a05[_0xf325('0x49')][_0xf325('0x52')]=_0x191869['id'];_0x1b1a05[_0xf325('0x49')]['Subjects']=integrations['getSubjects'](_0x1b1a05[_0xf325('0x49')]['channel'],_0x1b1a05[_0xf325('0x49')][_0xf325('0x32')]);_0x1b1a05[_0xf325('0x49')][_0xf325('0x53')]=integrations[_0xf325('0x54')](_0x1b1a05['body'][_0xf325('0x55')],_0x1b1a05[_0xf325('0x49')][_0xf325('0x32')]);return db['ZohoConfiguration'][_0xf325('0x48')](_0x1b1a05[_0xf325('0x49')],{'include':[{'model':db[_0xf325('0x56')],'as':_0xf325('0x57')},{'model':db[_0xf325('0x56')],'as':_0xf325('0x53')}]});}return null;})[_0xf325('0x28')](respondWithResult(_0x3b0f88,null))[_0xf325('0x44')](handleError(_0x3b0f88,null));};function getAccessToken(_0x32eb36){return new Promise(function(_0x40af6a,_0x39db1f){var _0x40fcdd;switch(_0x32eb36[_0xf325('0x58')]){case'US':_0x40fcdd=_0xf325('0x59');break;case'AU':_0x40fcdd=_0xf325('0x5a');break;case'EU':_0x40fcdd='https://accounts.zoho.eu';break;case'IN':_0x40fcdd='https://accounts.zoho.in';break;case'CN':_0x40fcdd=_0xf325('0x5b');break;default:_0x40fcdd=_0xf325('0x5c');break;}var _0x1438a2={'method':_0xf325('0x5d'),'uri':_0x40fcdd+'/oauth/v2/token','qs':{'refresh_token':_0x32eb36['refreshToken'],'client_id':_0x32eb36['clientId'],'client_secret':_0x32eb36['clientSecret'],'grant_type':_0xf325('0x5e')},'json':!![]};return rp(_0x1438a2)[_0xf325('0x28')](function(_0x11ff70){if(_0x11ff70[_0xf325('0x5f')]){_0x40af6a(_0x11ff70['access_token']);}else{_0x39db1f(_0xf325('0x60'));}})[_0xf325('0x44')](function(_0x141d18){_0x39db1f(_0x141d18);});});}exports[_0xf325('0x61')]=function(_0x45ee29,_0x5aac23,_0x1a6c22){var _0x3c6bbb,_0x3eea3c,_0x25f73c,_0x312d37,_0x25622b;return db[_0xf325('0x47')][_0xf325('0x4d')]({'where':{'id':_0x45ee29[_0xf325('0x4b')]['id']},'attributes':['id',_0xf325('0x62'),'zone','clientId',_0xf325('0x63'),_0xf325('0x64'),_0xf325('0x65'),_0xf325('0x66')]})['then'](handleEntityNotFound(_0x5aac23,null))[_0xf325('0x28')](function(_0x83f506){_0x25622b=_0x83f506;_0x3c6bbb=_0x25622b['host'];_0x3eea3c=_0x3c6bbb===_0xf325('0x67')?'eu':'com';_0x25f73c=_0x25622b[_0xf325('0x64')];var _0x210372=_0x25f73c['slice'](-0x1);if(_0x210372==='/'||_0x210372==='\x5c'||_0x210372===':'){_0x25f73c=_0x25f73c['substring'](0x0,_0x25f73c[_0xf325('0x68')](_0x210372));}if(!_0x25622b[_0xf325('0x66')]){throw new Error(_0xf325('0x69'));}return getAccessToken(_0x25622b);})['then'](function(_0x5b56a3){if(_0x5b56a3){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3eea3c),'qs':{'module':_0xf325('0x6a')},'headers':{'Authorization':_0xf325('0x6b')+_0x5b56a3},'json':!![]});}})[_0xf325('0x28')](function(_0x2eba7d){if(_0x2eba7d){if(_0x2eba7d[_0xf325('0x6c')]&&_0x2eba7d[_0xf325('0x6c')][_0xf325('0x2a')]){throw new Error(_0x2eba7d[_0xf325('0x6c')][_0xf325('0x2a')][_0xf325('0x6d')]);}var _0x3a1223=[];var _0x485791=[];var _0x41339b=[_0xf325('0x6e'),_0xf325('0x6f'),_0xf325('0x70'),_0xf325('0x71'),_0xf325('0x72'),_0xf325('0x73'),_0xf325('0x74'),_0xf325('0x75')];_0x485791=_[_0xf325('0x76')](_0x2eba7d[_0xf325('0x39')],function(_0x231f40){return _0x41339b[_0xf325('0x77')](_0x231f40[_0xf325('0x78')]);});for(var _0x41463f=0x0;_0x41463f<_0x485791['length'];_0x41463f++){if(_0x485791[_0x41463f]['system_mandatory']===![]){_0x3a1223[_0xf325('0x79')]({'id':_0x485791[_0x41463f]['id'],'name':_0x485791[_0x41463f]['display_label'],'custom':_0x485791[_0x41463f][_0xf325('0x7a')],'options':_0x485791[_0x41463f][_0xf325('0x7b')]===_0xf325('0x7c')&&_0x485791[_0x41463f][_0xf325('0x7d')][_0xf325('0x3a')]>-0x1?_[_0xf325('0x2f')](_0x485791[_0x41463f][_0xf325('0x7d')],function(_0x43f85b){return{'name':_0x43f85b,'value':_0x43f85b};}):[]});}}return{'count':_0x3a1223[_0xf325('0x3a')],'rows':_0x3a1223};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5aac23,null))[_0xf325('0x44')](function(_0x5a9f46){var _0x3b9bf0=_0x45ee29['query'][_0xf325('0x7e')]?0x1f4:_0x5a9f46[_0xf325('0x7f')]||0x1f4;logger[_0xf325('0x2a')](_0xf325('0x80'),_0xf325('0x61'),_0x3b9bf0,JSON[_0xf325('0x81')](_0x5a9f46));delete _0x5a9f46['name'];if(_0x3b9bf0===0x191){_0x3b9bf0=0x190;}_0x5aac23[_0xf325('0x1f')](_0x3b9bf0)[_0xf325('0x2d')](_0x45ee29[_0xf325('0x35')]['test']?{'message':_0xf325('0x82'),'statusCode':_0x5a9f46[_0xf325('0x7f')]}:_0x5a9f46);});}; \ No newline at end of file +var _0xfe73=['Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','data_type','picklist','pick_list_values','statusCode','send','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','set','json','apply','reject','then','destroy','error','stack','name','index','ZohoAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','pick','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject'];(function(_0x5213b3,_0x147fe3){var _0x4eeceb=function(_0x45642d){while(--_0x45642d){_0x5213b3['push'](_0x5213b3['shift']());}};_0x4eeceb(++_0x147fe3);}(_0xfe73,0x8a));var _0x3fe7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfe73[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fe7('0x0'));var zipdir=require(_0x3fe7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fe7('0x2'));var moment=require('moment');var BPromise=require(_0x3fe7('0x3'));var Mustache=require('mustache');var util=require(_0x3fe7('0x4'));var path=require(_0x3fe7('0x5'));var sox=require(_0x3fe7('0x6'));var csv=require(_0x3fe7('0x7'));var ejs=require(_0x3fe7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fe7('0x9'));var squel=require(_0x3fe7('0xa'));var crypto=require(_0x3fe7('0xb'));var jsforce=require(_0x3fe7('0xc'));var deskjs=require(_0x3fe7('0xd'));var toCsv=require(_0x3fe7('0x7'));var querystring=require(_0x3fe7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3fe7('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fe7('0x10'));var logger=require(_0x3fe7('0x11'))(_0x3fe7('0x12'));var utils=require(_0x3fe7('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3fe7('0x14'))['db'];var integrations=require(_0x3fe7('0x15'));function respondWithStatusCode(_0x44bb8e,_0x4a1322){_0x4a1322=_0x4a1322||0xcc;return function(_0x3f1194){if(_0x3f1194){return _0x44bb8e['sendStatus'](_0x4a1322);}return _0x44bb8e['status'](_0x4a1322)['end']();};}function respondWithResult(_0x5742eb,_0xe2c7f0){_0xe2c7f0=_0xe2c7f0||0xc8;return function(_0x5d4157){if(_0x5d4157){return _0x5742eb[_0x3fe7('0x16')](_0xe2c7f0)['json'](_0x5d4157);}};}function respondWithFilteredResult(_0x65898d,_0x4ec8a7){return function(_0x2805ce){if(_0x2805ce){var _0x4ba6a6=typeof _0x4ec8a7['offset']===_0x3fe7('0x17')&&typeof _0x4ec8a7[_0x3fe7('0x18')]===_0x3fe7('0x17');var _0x539517=_0x2805ce[_0x3fe7('0x19')];var _0x46ce34=_0x4ba6a6?0x0:_0x4ec8a7[_0x3fe7('0x1a')];var _0x322fd4=_0x4ba6a6?_0x2805ce[_0x3fe7('0x19')]:_0x4ec8a7[_0x3fe7('0x1a')]+_0x4ec8a7[_0x3fe7('0x18')];var _0x10fa94;if(_0x322fd4>=_0x539517){_0x322fd4=_0x539517;_0x10fa94=0xc8;}else{_0x10fa94=0xce;}_0x65898d[_0x3fe7('0x16')](_0x10fa94);return _0x65898d[_0x3fe7('0x1b')]('Content-Range',_0x46ce34+'-'+_0x322fd4+'/'+_0x539517)[_0x3fe7('0x1c')](_0x2805ce);}return null;};}function patchUpdates(_0x300b35){return function(_0x300681){try{jsonpatch[_0x3fe7('0x1d')](_0x300681,_0x300b35,!![]);}catch(_0x5ab3ed){return BPromise[_0x3fe7('0x1e')](_0x5ab3ed);}return _0x300681['save']();};}function saveUpdates(_0x3a347e,_0x285284){return function(_0x28a461){if(_0x28a461){return _0x28a461['update'](_0x3a347e)[_0x3fe7('0x1f')](function(_0x26dc1d){return _0x26dc1d;});}return null;};}function removeEntity(_0xf6ba75,_0x5dcbca){return function(_0x4ee970){if(_0x4ee970){return _0x4ee970[_0x3fe7('0x20')]()['then'](function(){_0xf6ba75[_0x3fe7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f27c,_0x51112b){return function(_0x31c351){if(!_0x31c351){_0x42f27c['sendStatus'](0x194);}return _0x31c351;};}function handleError(_0x178a72,_0x377204){_0x377204=_0x377204||0x1f4;return function(_0x33c8d7){logger[_0x3fe7('0x21')](_0x33c8d7[_0x3fe7('0x22')]);if(_0x33c8d7[_0x3fe7('0x23')]){delete _0x33c8d7['name'];}_0x178a72['status'](_0x377204)['send'](_0x33c8d7);};}exports[_0x3fe7('0x24')]=function(_0x43cfaa,_0x5ddeff){var _0x385401={},_0x278625={},_0x144adb={'count':0x0,'rows':[]};var _0x356d94=_['map'](db[_0x3fe7('0x25')]['rawAttributes'],function(_0x4d8018){return{'name':_0x4d8018[_0x3fe7('0x26')],'type':_0x4d8018[_0x3fe7('0x27')][_0x3fe7('0x28')]};});_0x278625[_0x3fe7('0x29')]=_[_0x3fe7('0x2a')](_0x356d94,_0x3fe7('0x23'));_0x278625[_0x3fe7('0x2b')]=_[_0x3fe7('0x2c')](_0x43cfaa[_0x3fe7('0x2b')]);_0x278625[_0x3fe7('0x2d')]=_[_0x3fe7('0x2e')](_0x278625[_0x3fe7('0x29')],_0x278625[_0x3fe7('0x2b')]);_0x385401[_0x3fe7('0x2f')]=_[_0x3fe7('0x2e')](_0x278625['model'],qs[_0x3fe7('0x30')](_0x43cfaa['query']['fields']));_0x385401['attributes']=_0x385401[_0x3fe7('0x2f')][_0x3fe7('0x31')]?_0x385401[_0x3fe7('0x2f')]:_0x278625['model'];if(!_0x43cfaa[_0x3fe7('0x2b')]['hasOwnProperty'](_0x3fe7('0x32'))){_0x385401[_0x3fe7('0x18')]=qs[_0x3fe7('0x18')](_0x43cfaa[_0x3fe7('0x2b')]['limit']);_0x385401[_0x3fe7('0x1a')]=qs[_0x3fe7('0x1a')](_0x43cfaa[_0x3fe7('0x2b')][_0x3fe7('0x1a')]);}_0x385401[_0x3fe7('0x33')]=qs[_0x3fe7('0x34')](_0x43cfaa[_0x3fe7('0x2b')][_0x3fe7('0x34')]);_0x385401[_0x3fe7('0x35')]=qs[_0x3fe7('0x2d')](_['pick'](_0x43cfaa[_0x3fe7('0x2b')],_0x278625[_0x3fe7('0x2d')]),_0x356d94);if(_0x43cfaa[_0x3fe7('0x2b')]['filter']){_0x385401[_0x3fe7('0x35')]=_['merge'](_0x385401['where'],{'$or':_['map'](_0x356d94,function(_0x3e06a3){if(_0x3e06a3[_0x3fe7('0x27')]!==_0x3fe7('0x36')){var _0x1990d9={};_0x1990d9[_0x3e06a3[_0x3fe7('0x23')]]={'$like':'%'+_0x43cfaa['query'][_0x3fe7('0x37')]+'%'};return _0x1990d9;}})});}_0x385401=_[_0x3fe7('0x38')]({},_0x385401,_0x43cfaa[_0x3fe7('0x39')]);var _0x3333f8={'where':_0x385401['where']};return db[_0x3fe7('0x25')]['count'](_0x3333f8)[_0x3fe7('0x1f')](function(_0x378b69){_0x144adb['count']=_0x378b69;if(_0x43cfaa[_0x3fe7('0x2b')][_0x3fe7('0x3a')]){_0x385401[_0x3fe7('0x3b')]=[{'all':!![]}];}return db[_0x3fe7('0x25')][_0x3fe7('0x3c')](_0x385401);})[_0x3fe7('0x1f')](function(_0x88612b){_0x144adb[_0x3fe7('0x3d')]=_0x88612b;return _0x144adb;})[_0x3fe7('0x1f')](respondWithFilteredResult(_0x5ddeff,_0x385401))[_0x3fe7('0x3e')](handleError(_0x5ddeff,null));};exports[_0x3fe7('0x3f')]=function(_0x213235,_0x58f0c7){var _0x1be9b9={'raw':![],'where':{'id':_0x213235[_0x3fe7('0x40')]['id']}},_0x52b426={};_0x52b426['model']=_[_0x3fe7('0x2c')](db[_0x3fe7('0x25')][_0x3fe7('0x41')]);_0x52b426[_0x3fe7('0x2b')]=_['keys'](_0x213235[_0x3fe7('0x2b')]);_0x52b426[_0x3fe7('0x2d')]=_[_0x3fe7('0x2e')](_0x52b426[_0x3fe7('0x29')],_0x52b426['query']);_0x1be9b9['attributes']=_['intersection'](_0x52b426['model'],qs[_0x3fe7('0x30')](_0x213235['query'][_0x3fe7('0x30')]));_0x1be9b9[_0x3fe7('0x2f')]=_0x1be9b9['attributes'][_0x3fe7('0x31')]?_0x1be9b9[_0x3fe7('0x2f')]:_0x52b426[_0x3fe7('0x29')];if(_0x213235[_0x3fe7('0x2b')][_0x3fe7('0x3a')]){_0x1be9b9[_0x3fe7('0x3b')]=[{'all':!![]}];}_0x1be9b9=_['merge']({},_0x1be9b9,_0x213235[_0x3fe7('0x39')]);return db[_0x3fe7('0x25')][_0x3fe7('0x42')](_0x1be9b9)[_0x3fe7('0x1f')](handleEntityNotFound(_0x58f0c7,null))[_0x3fe7('0x1f')](respondWithResult(_0x58f0c7,null))['catch'](handleError(_0x58f0c7,null));};exports[_0x3fe7('0x43')]=function(_0x2b627e,_0x1163f1){return db[_0x3fe7('0x25')]['create'](_0x2b627e['body'],{})[_0x3fe7('0x1f')](respondWithResult(_0x1163f1,0xc9))[_0x3fe7('0x3e')](handleError(_0x1163f1,null));};exports['update']=function(_0x3bf3ea,_0x2d2fe4){if(_0x3bf3ea[_0x3fe7('0x44')]['id']){delete _0x3bf3ea[_0x3fe7('0x44')]['id'];}return db[_0x3fe7('0x25')][_0x3fe7('0x42')]({'where':{'id':_0x3bf3ea[_0x3fe7('0x40')]['id']}})[_0x3fe7('0x1f')](handleEntityNotFound(_0x2d2fe4,null))[_0x3fe7('0x1f')](saveUpdates(_0x3bf3ea['body'],null))['then'](respondWithResult(_0x2d2fe4,null))[_0x3fe7('0x3e')](handleError(_0x2d2fe4,null));};exports[_0x3fe7('0x20')]=function(_0x11adba,_0x131e88){return db['ZohoAccount']['find']({'where':{'id':_0x11adba[_0x3fe7('0x40')]['id']}})['then'](handleEntityNotFound(_0x131e88,null))[_0x3fe7('0x1f')](removeEntity(_0x131e88,null))[_0x3fe7('0x3e')](handleError(_0x131e88,null));};exports[_0x3fe7('0x45')]=function(_0x2a097d,_0x467b33,_0xc09ac7){var _0x5dd060={};var _0x2eba2b={};var _0x380245;var _0x54a538;return db[_0x3fe7('0x25')]['findOne']({'where':{'id':_0x2a097d[_0x3fe7('0x40')]['id']}})[_0x3fe7('0x1f')](handleEntityNotFound(_0x467b33,null))['then'](function(_0x2bab9a){if(_0x2bab9a){_0x380245=_0x2bab9a;_0x2eba2b[_0x3fe7('0x29')]=_[_0x3fe7('0x2c')](db['ZohoConfiguration'][_0x3fe7('0x41')]);_0x2eba2b[_0x3fe7('0x2b')]=_['keys'](_0x2a097d[_0x3fe7('0x2b')]);_0x2eba2b['filters']=_[_0x3fe7('0x2e')](_0x2eba2b[_0x3fe7('0x29')],_0x2eba2b[_0x3fe7('0x2b')]);_0x5dd060['attributes']=_[_0x3fe7('0x2e')](_0x2eba2b[_0x3fe7('0x29')],qs[_0x3fe7('0x30')](_0x2a097d[_0x3fe7('0x2b')]['fields']));_0x5dd060['attributes']=_0x5dd060['attributes']['length']?_0x5dd060[_0x3fe7('0x2f')]:_0x2eba2b['model'];_0x5dd060['order']=qs[_0x3fe7('0x34')](_0x2a097d[_0x3fe7('0x2b')]['sort']);_0x5dd060[_0x3fe7('0x35')]=qs[_0x3fe7('0x2d')](_[_0x3fe7('0x46')](_0x2a097d[_0x3fe7('0x2b')],_0x2eba2b[_0x3fe7('0x2d')]));if(_0x2a097d[_0x3fe7('0x2b')][_0x3fe7('0x37')]){_0x5dd060[_0x3fe7('0x35')]=_[_0x3fe7('0x38')](_0x5dd060[_0x3fe7('0x35')],{'$or':_[_0x3fe7('0x2a')](_0x5dd060['attributes'],function(_0x37a267){var _0x2bd48b={};_0x2bd48b[_0x37a267]={'$like':'%'+_0x2a097d[_0x3fe7('0x2b')][_0x3fe7('0x37')]+'%'};return _0x2bd48b;})});}_0x5dd060=_[_0x3fe7('0x38')]({},_0x5dd060,_0x2a097d['options']);return _0x380245['getConfigurations'](_0x5dd060);}})[_0x3fe7('0x1f')](function(_0x5e4ccd){if(_0x5e4ccd){_0x54a538=_0x5e4ccd['length'];if(!_0x2a097d[_0x3fe7('0x2b')]['hasOwnProperty']('nolimit')){_0x5dd060[_0x3fe7('0x18')]=qs['limit'](_0x2a097d[_0x3fe7('0x2b')][_0x3fe7('0x18')]);_0x5dd060[_0x3fe7('0x1a')]=qs[_0x3fe7('0x1a')](_0x2a097d[_0x3fe7('0x2b')]['offset']);}return _0x380245[_0x3fe7('0x45')](_0x5dd060);}})[_0x3fe7('0x1f')](function(_0x26929c){if(_0x26929c){return _0x26929c?{'count':_0x54a538,'rows':_0x26929c}:null;}})[_0x3fe7('0x1f')](respondWithResult(_0x467b33,null))[_0x3fe7('0x3e')](handleError(_0x467b33,null));};exports[_0x3fe7('0x47')]=function(_0x4415b4,_0x13ecc4,_0xcba321){if(_0x4415b4[_0x3fe7('0x44')]['id']){delete _0x4415b4[_0x3fe7('0x44')]['id'];}return db[_0x3fe7('0x25')][_0x3fe7('0x48')]({'where':{'id':_0x4415b4[_0x3fe7('0x40')]['id']}})['then'](handleEntityNotFound(_0x13ecc4,null))[_0x3fe7('0x1f')](function(_0x43ceb6){if(_0x43ceb6){_0x4415b4[_0x3fe7('0x44')]['AccountId']=_0x43ceb6['id'];_0x4415b4[_0x3fe7('0x44')][_0x3fe7('0x49')]=integrations[_0x3fe7('0x4a')](_0x4415b4[_0x3fe7('0x44')]['channel'],_0x4415b4[_0x3fe7('0x44')][_0x3fe7('0x27')]);_0x4415b4[_0x3fe7('0x44')][_0x3fe7('0x4b')]=integrations[_0x3fe7('0x4c')](_0x4415b4[_0x3fe7('0x44')][_0x3fe7('0x4d')],_0x4415b4[_0x3fe7('0x44')]['type']);return db[_0x3fe7('0x4e')][_0x3fe7('0x43')](_0x4415b4[_0x3fe7('0x44')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x3fe7('0x4b')}]});}return null;})[_0x3fe7('0x1f')](respondWithResult(_0x13ecc4,null))['catch'](handleError(_0x13ecc4,null));};function getAccessToken(_0x592c67){return new Promise(function(_0x46c4e0,_0x223953){var _0x1194a5;switch(_0x592c67[_0x3fe7('0x4f')]){case'US':_0x1194a5=_0x3fe7('0x50');break;case'AU':_0x1194a5=_0x3fe7('0x51');break;case'EU':_0x1194a5=_0x3fe7('0x52');break;case'IN':_0x1194a5=_0x3fe7('0x53');break;case'CN':_0x1194a5='https://accounts.zoho.com.cn';break;default:_0x1194a5=_0x3fe7('0x52');break;}var _0x935bcd={'method':_0x3fe7('0x54'),'uri':_0x1194a5+_0x3fe7('0x55'),'qs':{'refresh_token':_0x592c67['refreshToken'],'client_id':_0x592c67[_0x3fe7('0x56')],'client_secret':_0x592c67[_0x3fe7('0x57')],'grant_type':_0x3fe7('0x58')},'json':!![]};return rp(_0x935bcd)[_0x3fe7('0x1f')](function(_0x5aae3c){if(_0x5aae3c[_0x3fe7('0x59')]){_0x46c4e0(_0x5aae3c[_0x3fe7('0x59')]);}else{_0x223953(_0x3fe7('0x5a'));}})['catch'](function(_0x216eb4){_0x223953(_0x216eb4);});});}exports[_0x3fe7('0x5b')]=function(_0x5e0a62,_0xf7bbb5,_0x2202b5){var _0x4bb0b4,_0x5251ba,_0x424475,_0x1e4a5a,_0x3ca45c;return db[_0x3fe7('0x25')]['findOne']({'where':{'id':_0x5e0a62[_0x3fe7('0x40')]['id']},'attributes':['id',_0x3fe7('0x5c'),'zone','clientId',_0x3fe7('0x57'),_0x3fe7('0x5d'),_0x3fe7('0x5e'),_0x3fe7('0x5f')]})['then'](handleEntityNotFound(_0xf7bbb5,null))[_0x3fe7('0x1f')](function(_0x47209b){_0x3ca45c=_0x47209b;_0x4bb0b4=_0x3ca45c[_0x3fe7('0x5c')];_0x5251ba=_0x4bb0b4==='zoho.eu'?'eu':_0x3fe7('0x60');_0x424475=_0x3ca45c[_0x3fe7('0x5d')];var _0x5d6d1e=_0x424475['slice'](-0x1);if(_0x5d6d1e==='/'||_0x5d6d1e==='\x5c'||_0x5d6d1e===':'){_0x424475=_0x424475['substring'](0x0,_0x424475[_0x3fe7('0x61')](_0x5d6d1e));}if(!_0x3ca45c[_0x3fe7('0x5f')]){throw new Error(_0x3fe7('0x62'));}return getAccessToken(_0x3ca45c);})[_0x3fe7('0x1f')](function(_0x4f4a65){if(_0x4f4a65){return rp({'method':_0x3fe7('0x63'),'uri':util['format'](_0x3fe7('0x64'),_0x5251ba),'qs':{'module':_0x3fe7('0x65')},'headers':{'Authorization':_0x3fe7('0x66')+_0x4f4a65},'json':!![]});}})['then'](function(_0x4869d0){if(_0x4869d0){if(_0x4869d0[_0x3fe7('0x67')]&&_0x4869d0[_0x3fe7('0x67')][_0x3fe7('0x21')]){throw new Error(_0x4869d0[_0x3fe7('0x67')][_0x3fe7('0x21')]['message']);}var _0x495753=[];var _0x1b36d7=[];var _0x256c80=[_0x3fe7('0x68'),_0x3fe7('0x69'),_0x3fe7('0x6a'),_0x3fe7('0x6b'),'Call_Duration',_0x3fe7('0x6c'),_0x3fe7('0x6d'),_0x3fe7('0x6e')];_0x1b36d7=_[_0x3fe7('0x6f')](_0x4869d0['fields'],function(_0x2987ba){return _0x256c80[_0x3fe7('0x70')](_0x2987ba['api_name']);});for(var _0x35161b=0x0;_0x35161b<_0x1b36d7[_0x3fe7('0x31')];_0x35161b++){if(_0x1b36d7[_0x35161b][_0x3fe7('0x71')]===![]){_0x495753[_0x3fe7('0x72')]({'id':_0x1b36d7[_0x35161b]['id'],'name':_0x1b36d7[_0x35161b]['display_label'],'custom':_0x1b36d7[_0x35161b]['custom_field'],'options':_0x1b36d7[_0x35161b][_0x3fe7('0x73')]===_0x3fe7('0x74')&&_0x1b36d7[_0x35161b][_0x3fe7('0x75')]['length']>-0x1?_[_0x3fe7('0x2a')](_0x1b36d7[_0x35161b][_0x3fe7('0x75')],function(_0x596d60){return{'name':_0x596d60,'value':_0x596d60};}):[]});}}return{'count':_0x495753[_0x3fe7('0x31')],'rows':_0x495753};}else{return{'count':0x0,'rows':[]};}})[_0x3fe7('0x1f')](respondWithResult(_0xf7bbb5,null))[_0x3fe7('0x3e')](function(_0x3596e7){var _0x3d8338=_0x5e0a62[_0x3fe7('0x2b')]['test']?0x1f4:_0x3596e7[_0x3fe7('0x76')]||0x1f4;logger[_0x3fe7('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x3fe7('0x5b'),_0x3d8338,JSON['stringify'](_0x3596e7));delete _0x3596e7[_0x3fe7('0x23')];if(_0x3d8338===0x191){_0x3d8338=0x190;}_0xf7bbb5[_0x3fe7('0x16')](_0x3d8338)[_0x3fe7('0x77')](_0x5e0a62[_0x3fe7('0x2b')][_0x3fe7('0x78')]?{'message':_0x3fe7('0x79'),'statusCode':_0x3596e7[_0x3fe7('0x76')]}:_0x3596e7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3809cea..5082e4b 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 _0x92e4=['POST','/oauth/v2/token','catch','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','serverUrl','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','code','https://accounts.zoho.com'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x92e4,0x1bb));var _0x492e=function(_0x51e035,_0x21d027){_0x51e035=_0x51e035-0x0;var _0xdbd9fc=_0x92e4[_0x51e035];return _0xdbd9fc;};'use strict';var _=require(_0x492e('0x0'));var util=require(_0x492e('0x1'));var logger=require(_0x492e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x492e('0x3'));var rp=require(_0x492e('0x4'));var fs=require('fs');var path=require(_0x492e('0x5'));var rimraf=require(_0x492e('0x6'));var config=require(_0x492e('0x7'));var attributes=require(_0x492e('0x8'));var integrations=require(_0x492e('0x9'));module['exports']=function(_0x5c69f6,_0x47f147){return _0x5c69f6[_0x492e('0xa')](_0x492e('0xb'),attributes,{'tableName':_0x492e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51782c,_0x2d4d3a,_0x5c114e){if(_0x51782c[_0x492e('0xd')](_0x492e('0xe'))||_0x51782c[_0x492e('0xd')]('serverUrl')||_0x51782c[_0x492e('0xd')](_0x492e('0xf'))||_0x51782c[_0x492e('0xd')](_0x492e('0x10'))||_0x51782c['changed']('code')||_0x51782c['changed'](_0x492e('0x11'))){var _0x36a0d5,_0x39d770;_0x36a0d5=_0x51782c['serverUrl'];var _0x304600=_0x36a0d5[_0x492e('0x12')](-0x1);if(_0x304600==='/'||_0x304600==='\x5c'||_0x304600===':'){_0x36a0d5=_0x36a0d5[_0x492e('0x13')](0x0,_0x36a0d5[_0x492e('0x14')](_0x304600));}switch(_0x51782c[_0x492e('0xe')]){case'US':_0x39d770='https://accounts.zoho.com';break;case'AU':_0x39d770=_0x492e('0x15');break;case'IN':_0x39d770=_0x492e('0x16');break;case'CN':_0x39d770=_0x492e('0x17');break;default:_0x39d770=_0x492e('0x18');break;}var _0x53c5b2={'method':'POST','uri':_0x39d770+'/oauth/v2/token','form':{'grant_type':_0x492e('0x19'),'client_id':_0x51782c[_0x492e('0xf')],'client_secret':_0x51782c[_0x492e('0x10')],'redirect_uri':_0x51782c[_0x492e('0x1a')],'code':_0x51782c['code']},'headers':{'Content-Type':_0x492e('0x1b')}};return rp(_0x53c5b2)[_0x492e('0x1c')](function(_0x1ed9d1){var _0x4b9e8e=JSON[_0x492e('0x1d')](_0x1ed9d1);if(_0x4b9e8e['refresh_token']){_0x51782c[_0x492e('0x1e')]=_0x4b9e8e[_0x492e('0x1f')];logger[_0x492e('0x20')](util[_0x492e('0x21')](_0x492e('0x22'),_0x51782c[_0x492e('0x23')],_0x51782c['id']));}else{logger[_0x492e('0x24')](util['format'](_0x492e('0x25'),_0x51782c[_0x492e('0x23')],_0x51782c['id']),util['inspect'](_0x4b9e8e,{'showHidden':![],'depth':null}));}return _0x5c114e(null,_0x2d4d3a);})['catch'](function(_0x527c7c){logger['error'](util['format'](_0x492e('0x25'),_0x51782c[_0x492e('0x23')],_0x51782c['id']),util[_0x492e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5c114e(_0x527c7c);});}else{return _0x5c114e(null,_0x2d4d3a);}},'beforeUpdate':function(_0x294f34,_0x35309c,_0x40911f){if(_0x294f34[_0x492e('0xd')](_0x492e('0xe'))||_0x294f34[_0x492e('0xd')](_0x492e('0x1a'))||_0x294f34['changed'](_0x492e('0xf'))||_0x294f34[_0x492e('0xd')](_0x492e('0x10'))||_0x294f34['changed'](_0x492e('0x27'))||_0x294f34[_0x492e('0xd')](_0x492e('0x11'))){var _0xfae1a4,_0x597718;_0xfae1a4=_0x294f34[_0x492e('0x1a')];var _0x3f562d=_0xfae1a4[_0x492e('0x12')](-0x1);if(_0x3f562d==='/'||_0x3f562d==='\x5c'||_0x3f562d===':'){_0xfae1a4=_0xfae1a4[_0x492e('0x13')](0x0,_0xfae1a4['lastIndexOf'](_0x3f562d));}switch(_0x294f34[_0x492e('0xe')]){case'US':_0x597718=_0x492e('0x28');break;case'AU':_0x597718=_0x492e('0x15');break;case'IN':_0x597718='https://accounts.zoho.in';break;case'CN':_0x597718=_0x492e('0x17');break;default:_0x597718=_0x492e('0x18');break;}var _0x3c4c2d={'method':_0x492e('0x29'),'uri':_0x597718+_0x492e('0x2a'),'form':{'grant_type':_0x492e('0x19'),'client_id':_0x294f34[_0x492e('0xf')],'client_secret':_0x294f34[_0x492e('0x10')],'redirect_uri':_0x294f34['serverUrl'],'code':_0x294f34[_0x492e('0x27')]},'headers':{'Content-Type':_0x492e('0x1b')}};return rp(_0x3c4c2d)[_0x492e('0x1c')](function(_0x1dbb63){var _0x19b464=JSON[_0x492e('0x1d')](_0x1dbb63);if(_0x19b464['refresh_token']){_0x294f34[_0x492e('0x1e')]=_0x19b464[_0x492e('0x1f')];logger[_0x492e('0x20')](util[_0x492e('0x21')](_0x492e('0x22'),_0x294f34[_0x492e('0x23')],_0x294f34['id']));}else{logger[_0x492e('0x24')](util[_0x492e('0x21')](_0x492e('0x25'),_0x294f34[_0x492e('0x23')],_0x294f34['id']),util[_0x492e('0x26')](_0x19b464,{'showHidden':![],'depth':null}));}return _0x40911f(null,_0x35309c);})[_0x492e('0x2b')](function(_0x507ea7){logger[_0x492e('0x24')](util[_0x492e('0x21')](_0x492e('0x25'),_0x294f34[_0x492e('0x23')],_0x294f34['id']),util[_0x492e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x40911f(_0x507ea7);});}else{return _0x40911f(null,_0x35309c);}}}});}; \ No newline at end of file +var _0x8452=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','application/x-www-form-urlencoded','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4d3543,_0x32d008){var _0x3d4d5b=function(_0x22dc2d){while(--_0x22dc2d){_0x4d3543['push'](_0x4d3543['shift']());}};_0x3d4d5b(++_0x32d008);}(_0x8452,0x123));var _0x2845=function(_0x3a04c6,_0x12a482){_0x3a04c6=_0x3a04c6-0x0;var _0xf4131a=_0x8452[_0x3a04c6];return _0xf4131a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2845('0x0'))(_0x2845('0x1'));var moment=require(_0x2845('0x2'));var BPromise=require(_0x2845('0x3'));var rp=require(_0x2845('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2845('0x5'));var config=require(_0x2845('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x2845('0x7'));module[_0x2845('0x8')]=function(_0x22f5b9,_0x306c70){return _0x22f5b9[_0x2845('0x9')](_0x2845('0xa'),attributes,{'tableName':_0x2845('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2db6fa,_0x2b1ba8,_0x14f356){if(_0x2db6fa[_0x2845('0xc')](_0x2845('0xd'))||_0x2db6fa['changed'](_0x2845('0xe'))||_0x2db6fa['changed'](_0x2845('0xf'))||_0x2db6fa['changed']('clientSecret')||_0x2db6fa[_0x2845('0xc')](_0x2845('0x10'))||_0x2db6fa[_0x2845('0xc')]('host')){var _0x2ae25a,_0x2af7c7;_0x2ae25a=_0x2db6fa[_0x2845('0xe')];var _0x2ce3cd=_0x2ae25a[_0x2845('0x11')](-0x1);if(_0x2ce3cd==='/'||_0x2ce3cd==='\x5c'||_0x2ce3cd===':'){_0x2ae25a=_0x2ae25a[_0x2845('0x12')](0x0,_0x2ae25a[_0x2845('0x13')](_0x2ce3cd));}switch(_0x2db6fa[_0x2845('0xd')]){case'US':_0x2af7c7=_0x2845('0x14');break;case'AU':_0x2af7c7=_0x2845('0x15');break;case'IN':_0x2af7c7=_0x2845('0x16');break;case'CN':_0x2af7c7=_0x2845('0x17');break;default:_0x2af7c7=_0x2845('0x18');break;}var _0x49df0f={'method':_0x2845('0x19'),'uri':_0x2af7c7+_0x2845('0x1a'),'form':{'grant_type':_0x2845('0x1b'),'client_id':_0x2db6fa[_0x2845('0xf')],'client_secret':_0x2db6fa[_0x2845('0x1c')],'redirect_uri':_0x2db6fa['serverUrl'],'code':_0x2db6fa[_0x2845('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x49df0f)[_0x2845('0x1d')](function(_0x5dddf5){var _0x4a14ed=JSON[_0x2845('0x1e')](_0x5dddf5);if(_0x4a14ed[_0x2845('0x1f')]){_0x2db6fa[_0x2845('0x20')]=_0x4a14ed[_0x2845('0x1f')];logger[_0x2845('0x21')](util[_0x2845('0x22')](_0x2845('0x23'),_0x2db6fa[_0x2845('0x24')],_0x2db6fa['id']));}else{logger[_0x2845('0x25')](util[_0x2845('0x22')](_0x2845('0x26'),_0x2db6fa['name'],_0x2db6fa['id']),util[_0x2845('0x27')](_0x4a14ed,{'showHidden':![],'depth':null}));}return _0x14f356(null,_0x2b1ba8);})[_0x2845('0x28')](function(_0x597520){logger[_0x2845('0x25')](util[_0x2845('0x22')](_0x2845('0x26'),_0x2db6fa[_0x2845('0x24')],_0x2db6fa['id']),util[_0x2845('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x14f356(_0x597520);});}else{return _0x14f356(null,_0x2b1ba8);}},'beforeUpdate':function(_0xe0944c,_0x5edff6,_0x1ddf4b){if(_0xe0944c['changed']('zone')||_0xe0944c['changed']('serverUrl')||_0xe0944c[_0x2845('0xc')](_0x2845('0xf'))||_0xe0944c[_0x2845('0xc')]('clientSecret')||_0xe0944c[_0x2845('0xc')](_0x2845('0x10'))||_0xe0944c['changed'](_0x2845('0x29'))){var _0x2acfb6,_0x14bd19;_0x2acfb6=_0xe0944c[_0x2845('0xe')];var _0x339a29=_0x2acfb6[_0x2845('0x11')](-0x1);if(_0x339a29==='/'||_0x339a29==='\x5c'||_0x339a29===':'){_0x2acfb6=_0x2acfb6['substring'](0x0,_0x2acfb6['lastIndexOf'](_0x339a29));}switch(_0xe0944c[_0x2845('0xd')]){case'US':_0x14bd19=_0x2845('0x14');break;case'AU':_0x14bd19=_0x2845('0x15');break;case'IN':_0x14bd19=_0x2845('0x16');break;case'CN':_0x14bd19=_0x2845('0x17');break;default:_0x14bd19='https://accounts.zoho.eu';break;}var _0x5cd68d={'method':_0x2845('0x19'),'uri':_0x14bd19+_0x2845('0x1a'),'form':{'grant_type':_0x2845('0x1b'),'client_id':_0xe0944c[_0x2845('0xf')],'client_secret':_0xe0944c[_0x2845('0x1c')],'redirect_uri':_0xe0944c['serverUrl'],'code':_0xe0944c[_0x2845('0x10')]},'headers':{'Content-Type':_0x2845('0x2a')}};return rp(_0x5cd68d)['then'](function(_0x422626){var _0x51e8bb=JSON[_0x2845('0x1e')](_0x422626);if(_0x51e8bb['refresh_token']){_0xe0944c[_0x2845('0x20')]=_0x51e8bb[_0x2845('0x1f')];logger[_0x2845('0x21')](util[_0x2845('0x22')](_0x2845('0x23'),_0xe0944c['name'],_0xe0944c['id']));}else{logger[_0x2845('0x25')](util['format'](_0x2845('0x26'),_0xe0944c['name'],_0xe0944c['id']),util[_0x2845('0x27')](_0x51e8bb,{'showHidden':![],'depth':null}));}return _0x1ddf4b(null,_0x5edff6);})[_0x2845('0x28')](function(_0x3167f5){logger[_0x2845('0x25')](util['format'](_0x2845('0x26'),_0xe0944c[_0x2845('0x24')],_0xe0944c['id']),util[_0x2845('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x1ddf4b(_0x3167f5);});}else{return _0x1ddf4b(null,_0x5edff6);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ec17ec5..97a1d69 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 _0x9e2e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetZohoAccount','findAll','options','where','attributes','include','map','model','info','debug','ShowZohoAccount','ZohoAccount','find','lodash','util','moment'];(function(_0x286e80,_0x625296){var _0x29b719=function(_0x549be3){while(--_0x549be3){_0x286e80['push'](_0x286e80['shift']());}};_0x29b719(++_0x625296);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x32291f,_0x80bff6){_0x32291f=_0x32291f-0x0;var _0x238609=_0x9e2e[_0x32291f];return _0x238609;};'use strict';var _=require(_0xe9e2('0x0'));var util=require(_0xe9e2('0x1'));var moment=require(_0xe9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9e2('0x4'));var logger=require(_0xe9e2('0x5'))(_0xe9e2('0x6'));var config=require(_0xe9e2('0x7'));var jayson=require(_0xe9e2('0x8'));var client=jayson[_0xe9e2('0x9')][_0xe9e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca0aa,_0x118600,_0x4f1ef7){return new BPromise(function(_0x2bec58,_0x1ade12){return client['request'](_0x5ca0aa,_0x4f1ef7)[_0xe9e2('0xb')](function(_0x48882a){logger['info'](_0xe9e2('0xc'),_0x118600,_0xe9e2('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x118600,_0xe9e2('0xd'),JSON[_0xe9e2('0xe')](_0x48882a));if(_0x48882a[_0xe9e2('0xf')]){if(_0x48882a[_0xe9e2('0xf')]['code']===0x1f4){logger['error'](_0xe9e2('0xc'),_0x118600,_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);return _0x1ade12(_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);}logger[_0xe9e2('0xf')](_0xe9e2('0xc'),_0x118600,_0x48882a[_0xe9e2('0xf')][_0xe9e2('0x10')]);return _0x2bec58(_0x48882a[_0xe9e2('0xf')]['message']);}else{logger['info'](_0xe9e2('0xc'),_0x118600,'request\x20sent');_0x2bec58(_0x48882a['result'][_0xe9e2('0x10')]);}})[_0xe9e2('0x11')](function(_0x3550ce){logger[_0xe9e2('0xf')](_0xe9e2('0xc'),_0x118600,_0x3550ce);_0x1ade12(_0x3550ce);});});}exports[_0xe9e2('0x12')]=function(_0x5f3fc8){var _0xdf6f78=this;return new Promise(function(_0x2094fc,_0x3b6637){return db['ZohoAccount'][_0xe9e2('0x13')]({'raw':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x15')]||null:null,'attributes':_0x5f3fc8['options']?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x16')]||null:null,'limit':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')]['limit']||null:null,'include':_0x5f3fc8[_0xe9e2('0x14')]?_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x5f3fc8[_0xe9e2('0x14')][_0xe9e2('0x17')],function(_0x26ce3d){return{'model':db[_0x26ce3d[_0xe9e2('0x19')]],'as':_0x26ce3d['as'],'attributes':_0x26ce3d[_0xe9e2('0x16')],'include':_0x26ce3d[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x26ce3d[_0xe9e2('0x17')],function(_0x2a3d69){return{'model':db[_0x2a3d69[_0xe9e2('0x19')]],'as':_0x2a3d69['as'],'attributes':_0x2a3d69[_0xe9e2('0x16')],'include':_0x2a3d69[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x2a3d69['include'],function(_0x43445d){return{'model':db[_0x43445d[_0xe9e2('0x19')]],'as':_0x43445d['as'],'attributes':_0x43445d[_0xe9e2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe9e2('0xb')](function(_0x57254c){logger[_0xe9e2('0x1a')](_0xe9e2('0x12'),_0x5f3fc8);logger[_0xe9e2('0x1b')](_0xe9e2('0x12'),_0x5f3fc8,JSON[_0xe9e2('0xe')](_0x57254c));_0x2094fc(_0x57254c);})['catch'](function(_0x4cf43f){logger[_0xe9e2('0xf')](_0xe9e2('0x12'),_0x4cf43f[_0xe9e2('0x10')],_0x5f3fc8);_0x3b6637(_0xdf6f78[_0xe9e2('0xf')](0x1f4,_0x4cf43f[_0xe9e2('0x10')]));});});};exports[_0xe9e2('0x1c')]=function(_0x5da7b3){var _0x29d238=this;return new Promise(function(_0x546961,_0x227b7e){return db[_0xe9e2('0x1d')][_0xe9e2('0x1e')]({'raw':_0x5da7b3[_0xe9e2('0x14')]?_0x5da7b3[_0xe9e2('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5da7b3['options']?_0x5da7b3[_0xe9e2('0x14')][_0xe9e2('0x15')]||null:null,'attributes':_0x5da7b3['options']?_0x5da7b3[_0xe9e2('0x14')][_0xe9e2('0x16')]||null:null,'include':_0x5da7b3[_0xe9e2('0x14')]?_0x5da7b3['options'][_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x5da7b3[_0xe9e2('0x14')][_0xe9e2('0x17')],function(_0x573038){return{'model':db[_0x573038[_0xe9e2('0x19')]],'as':_0x573038['as'],'attributes':_0x573038[_0xe9e2('0x16')],'include':_0x573038[_0xe9e2('0x17')]?_['map'](_0x573038['include'],function(_0x3f66ab){return{'model':db[_0x3f66ab[_0xe9e2('0x19')]],'as':_0x3f66ab['as'],'attributes':_0x3f66ab[_0xe9e2('0x16')],'include':_0x3f66ab[_0xe9e2('0x17')]?_[_0xe9e2('0x18')](_0x3f66ab[_0xe9e2('0x17')],function(_0x2fa4aa){return{'model':db[_0x2fa4aa['model']],'as':_0x2fa4aa['as'],'attributes':_0x2fa4aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9e2('0xb')](function(_0x4b3184){logger[_0xe9e2('0x1a')](_0xe9e2('0x1c'),_0x5da7b3);logger['debug'](_0xe9e2('0x1c'),_0x5da7b3,JSON[_0xe9e2('0xe')](_0x4b3184));_0x546961(_0x4b3184);})['catch'](function(_0x13a916){logger[_0xe9e2('0xf')]('ShowZohoAccount',_0x13a916['message'],_0x5da7b3);_0x227b7e(_0x29d238[_0xe9e2('0xf')](0x1f4,_0x13a916[_0xe9e2('0x10')]));});});}; \ No newline at end of file +var _0x9123=['info','request\x20sent','debug','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x4d54ae,_0x3b4a42){var _0x4e1508=function(_0xc88bc3){while(--_0xc88bc3){_0x4d54ae['push'](_0x4d54ae['shift']());}};_0x4e1508(++_0x3b4a42);}(_0x9123,0x140));var _0x3912=function(_0x4cb30c,_0x290d5c){_0x4cb30c=_0x4cb30c-0x0;var _0x2c7bf2=_0x9123[_0x4cb30c];return _0x2c7bf2;};'use strict';var _=require(_0x3912('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3912('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3912('0x2'))['db'];var utils=require(_0x3912('0x3'));var logger=require(_0x3912('0x4'))(_0x3912('0x5'));var config=require('../../config/environment');var jayson=require(_0x3912('0x6'));var client=jayson[_0x3912('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea5cf,_0x2b3ac0,_0x2d75b6){return new BPromise(function(_0x2325d0,_0x51fb5b){return client[_0x3912('0x8')](_0x4ea5cf,_0x2d75b6)[_0x3912('0x9')](function(_0x2f5910){logger[_0x3912('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));logger[_0x3912('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'),JSON[_0x3912('0xd')](_0x2f5910));if(_0x2f5910[_0x3912('0xe')]){if(_0x2f5910[_0x3912('0xe')][_0x3912('0xf')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2b3ac0,_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);return _0x51fb5b(_0x2f5910[_0x3912('0xe')]['message']);}logger[_0x3912('0xe')](_0x3912('0x11'),_0x2b3ac0,_0x2f5910['error'][_0x3912('0x10')]);return _0x2325d0(_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);}else{logger[_0x3912('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));_0x2325d0(_0x2f5910[_0x3912('0x12')][_0x3912('0x10')]);}})[_0x3912('0x13')](function(_0x4658b6){logger['error'](_0x3912('0x11'),_0x2b3ac0,_0x4658b6);_0x51fb5b(_0x4658b6);});});}exports[_0x3912('0x14')]=function(_0x2e4649){var _0x8a1a68=this;return new Promise(function(_0x2b48b1,_0x59e28a){return db[_0x3912('0x15')][_0x3912('0x16')]({'raw':_0x2e4649[_0x3912('0x17')]?_0x2e4649['options'][_0x3912('0x18')]===undefined?!![]:![]:!![],'where':_0x2e4649[_0x3912('0x17')]?_0x2e4649[_0x3912('0x17')][_0x3912('0x19')]||null:null,'attributes':_0x2e4649[_0x3912('0x17')]?_0x2e4649[_0x3912('0x17')][_0x3912('0x1a')]||null:null,'limit':_0x2e4649['options']?_0x2e4649['options'][_0x3912('0x1b')]||null:null,'include':_0x2e4649[_0x3912('0x17')]?_0x2e4649[_0x3912('0x17')][_0x3912('0x1c')]?_[_0x3912('0x1d')](_0x2e4649[_0x3912('0x17')][_0x3912('0x1c')],function(_0x40f601){return{'model':db[_0x40f601[_0x3912('0x1e')]],'as':_0x40f601['as'],'attributes':_0x40f601['attributes'],'include':_0x40f601[_0x3912('0x1c')]?_[_0x3912('0x1d')](_0x40f601['include'],function(_0x2af8cf){return{'model':db[_0x2af8cf[_0x3912('0x1e')]],'as':_0x2af8cf['as'],'attributes':_0x2af8cf[_0x3912('0x1a')],'include':_0x2af8cf[_0x3912('0x1c')]?_['map'](_0x2af8cf['include'],function(_0x426907){return{'model':db[_0x426907[_0x3912('0x1e')]],'as':_0x426907['as'],'attributes':_0x426907[_0x3912('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3912('0x9')](function(_0x43f9de){logger[_0x3912('0xa')](_0x3912('0x14'),_0x2e4649);logger[_0x3912('0xc')](_0x3912('0x14'),_0x2e4649,JSON[_0x3912('0xd')](_0x43f9de));_0x2b48b1(_0x43f9de);})['catch'](function(_0x5b0729){logger[_0x3912('0xe')](_0x3912('0x14'),_0x5b0729['message'],_0x2e4649);_0x59e28a(_0x8a1a68['error'](0x1f4,_0x5b0729[_0x3912('0x10')]));});});};exports[_0x3912('0x1f')]=function(_0x26c49c){var _0x596d45=this;return new Promise(function(_0x3da782,_0x38fd42){return db[_0x3912('0x15')][_0x3912('0x20')]({'raw':_0x26c49c[_0x3912('0x17')]?_0x26c49c[_0x3912('0x17')][_0x3912('0x18')]===undefined?!![]:![]:!![],'where':_0x26c49c[_0x3912('0x17')]?_0x26c49c['options'][_0x3912('0x19')]||null:null,'attributes':_0x26c49c[_0x3912('0x17')]?_0x26c49c['options'][_0x3912('0x1a')]||null:null,'include':_0x26c49c['options']?_0x26c49c[_0x3912('0x17')]['include']?_['map'](_0x26c49c[_0x3912('0x17')]['include'],function(_0x35d644){return{'model':db[_0x35d644['model']],'as':_0x35d644['as'],'attributes':_0x35d644[_0x3912('0x1a')],'include':_0x35d644[_0x3912('0x1c')]?_['map'](_0x35d644[_0x3912('0x1c')],function(_0x444122){return{'model':db[_0x444122[_0x3912('0x1e')]],'as':_0x444122['as'],'attributes':_0x444122['attributes'],'include':_0x444122[_0x3912('0x1c')]?_['map'](_0x444122[_0x3912('0x1c')],function(_0x551bd1){return{'model':db[_0x551bd1[_0x3912('0x1e')]],'as':_0x551bd1['as'],'attributes':_0x551bd1[_0x3912('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3912('0x9')](function(_0x246479){logger[_0x3912('0xa')](_0x3912('0x1f'),_0x26c49c);logger[_0x3912('0xc')]('ShowZohoAccount',_0x26c49c,JSON['stringify'](_0x246479));_0x3da782(_0x246479);})['catch'](function(_0x2f2807){logger[_0x3912('0xe')](_0x3912('0x1f'),_0x2f2807[_0x3912('0x10')],_0x26c49c);_0x38fd42(_0x596d45[_0x3912('0xe')](0x1f4,_0x2f2807[_0x3912('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 57a5386..f482f9d 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 _0x980b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','exports','multer','path'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x980b,0x140));var _0xb980=function(_0x24a8e1,_0x549bd5){_0x24a8e1=_0x24a8e1-0x0;var _0x264874=_0x980b[_0x24a8e1];return _0x264874;};'use strict';var multer=require(_0xb980('0x0'));var util=require('util');var path=require(_0xb980('0x1'));var timeout=require(_0xb980('0x2'));var express=require('express');var router=express[_0xb980('0x3')]();var fs_extra=require(_0xb980('0x4'));var auth=require(_0xb980('0x5'));var interaction=require(_0xb980('0x6'));var config=require(_0xb980('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xb980('0x8')]('/',auth[_0xb980('0x9')](),controller[_0xb980('0xa')]);router[_0xb980('0x8')](_0xb980('0xb'),auth[_0xb980('0x9')](),controller[_0xb980('0xc')]);router[_0xb980('0x8')](_0xb980('0xd'),auth[_0xb980('0x9')](),controller[_0xb980('0xe')]);router['get'](_0xb980('0xf'),auth[_0xb980('0x9')](),controller[_0xb980('0x10')]);router['get'](_0xb980('0x11'),auth[_0xb980('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xb980('0x9')](),controller[_0xb980('0x12')]);router[_0xb980('0x13')]('/:id',auth[_0xb980('0x9')](),controller[_0xb980('0x14')]);router[_0xb980('0x15')](_0xb980('0xb'),auth[_0xb980('0x9')](),controller['destroy']);module[_0xb980('0x16')]=router; \ No newline at end of file +var _0x70d9=['exports','multer','path','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','destroy'];(function(_0x598b6f,_0x55690f){var _0x40959f=function(_0x5b23af){while(--_0x5b23af){_0x598b6f['push'](_0x598b6f['shift']());}};_0x40959f(++_0x55690f);}(_0x70d9,0x119));var _0x970d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x70d9[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x970d('0x0'));var util=require('util');var path=require(_0x970d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x970d('0x2'));var auth=require(_0x970d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x970d('0x4'));var controller=require(_0x970d('0x5'));router[_0x970d('0x6')]('/',auth['isAuthenticated'](),controller[_0x970d('0x7')]);router[_0x970d('0x6')](_0x970d('0x8'),auth[_0x970d('0x9')](),controller[_0x970d('0xa')]);router[_0x970d('0x6')](_0x970d('0xb'),auth[_0x970d('0x9')](),controller['getFields']);router['get'](_0x970d('0xc'),auth[_0x970d('0x9')](),controller[_0x970d('0xd')]);router[_0x970d('0x6')](_0x970d('0xe'),auth[_0x970d('0x9')](),controller[_0x970d('0xf')]);router['post']('/',auth[_0x970d('0x9')](),controller[_0x970d('0x10')]);router['put'](_0x970d('0x8'),auth[_0x970d('0x9')](),controller[_0x970d('0x11')]);router['delete'](_0x970d('0x8'),auth[_0x970d('0x9')](),controller[_0x970d('0x12')]);module[_0x970d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 31a1e88..84c72c8 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 _0x113e=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x1cd40d,_0x3d408b){var _0x2d3ebc=function(_0x173d53){while(--_0x173d53){_0x1cd40d['push'](_0x1cd40d['shift']());}};_0x2d3ebc(++_0x3d408b);}(_0x113e,0xe5));var _0xe113=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x113e[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xe113('0x0'));module[_0xe113('0x1')]={'name':{'type':Sequelize[_0xe113('0x2')]},'moduleCreate':{'type':Sequelize[_0xe113('0x3')](_0xe113('0x4'),_0xe113('0x5'),_0xe113('0x6')),'defaultValue':_0xe113('0x4')},'moduleSearch':{'type':Sequelize[_0xe113('0x3')](_0xe113('0x7'),_0xe113('0x5'),_0xe113('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe113('0x2')]}}; \ No newline at end of file +var _0x8a06=['STRING','contact','nothing','lead','ENUM','contact_lead','sequelize','exports'];(function(_0x426070,_0x23f111){var _0x3e449c=function(_0x35c9f9){while(--_0x35c9f9){_0x426070['push'](_0x426070['shift']());}};_0x3e449c(++_0x23f111);}(_0x8a06,0x1c6));var _0x68a0=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x8a06[_0x210718];return _0x541bfc;};'use strict';var Sequelize=require(_0x68a0('0x0'));module[_0x68a0('0x1')]={'name':{'type':Sequelize[_0x68a0('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x68a0('0x3'),_0x68a0('0x4')),'defaultValue':_0x68a0('0x5')},'moduleSearch':{'type':Sequelize[_0x68a0('0x6')](_0x68a0('0x7'),_0x68a0('0x3'),'lead'),'defaultValue':_0x68a0('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index cd66080..dd5feae 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 _0x5d80=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','index','map','ZohoConfiguration','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','findOne','ZohoField','order','filter','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x71b9ce,_0xb04066){var _0x49b2c1=function(_0x210908){while(--_0x210908){_0x71b9ce['push'](_0x71b9ce['shift']());}};_0x49b2c1(++_0xb04066);}(_0x5d80,0x1a4));var _0x05d8=function(_0x217cc1,_0x591a7f){_0x217cc1=_0x217cc1-0x0;var _0x2f8527=_0x5d80[_0x217cc1];return _0x2f8527;};'use strict';var emlformat=require(_0x05d8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x05d8('0x1'));var rp=require('request-promise');var moment=require(_0x05d8('0x2'));var BPromise=require(_0x05d8('0x3'));var Mustache=require('mustache');var util=require(_0x05d8('0x4'));var path=require('path');var sox=require(_0x05d8('0x5'));var csv=require('to-csv');var ejs=require(_0x05d8('0x6'));var fs=require('fs');var fs_extra=require(_0x05d8('0x7'));var _=require(_0x05d8('0x8'));var squel=require(_0x05d8('0x9'));var crypto=require('crypto');var jsforce=require(_0x05d8('0xa'));var deskjs=require(_0x05d8('0xb'));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('../../components/parsers/qs');var as=require(_0x05d8('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05d8('0xd'));var utils=require('../../config/utils');var config=require(_0x05d8('0xe'));var licenseUtil=require(_0x05d8('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8df3b7,_0x3a69f2){_0x3a69f2=_0x3a69f2||0xcc;return function(_0xfe9491){if(_0xfe9491){return _0x8df3b7['sendStatus'](_0x3a69f2);}return _0x8df3b7[_0x05d8('0x10')](_0x3a69f2)[_0x05d8('0x11')]();};}function respondWithResult(_0x273c0f,_0x221daa){_0x221daa=_0x221daa||0xc8;return function(_0xbf0bc4){if(_0xbf0bc4){return _0x273c0f[_0x05d8('0x10')](_0x221daa)[_0x05d8('0x12')](_0xbf0bc4);}};}function respondWithFilteredResult(_0x5e1bbb,_0x3a4808){return function(_0x1dc47c){if(_0x1dc47c){var _0x639502=typeof _0x3a4808['offset']===_0x05d8('0x13')&&typeof _0x3a4808[_0x05d8('0x14')]===_0x05d8('0x13');var _0x51674f=_0x1dc47c['count'];var _0x2c7c3f=_0x639502?0x0:_0x3a4808[_0x05d8('0x15')];var _0xf00369=_0x639502?_0x1dc47c[_0x05d8('0x16')]:_0x3a4808[_0x05d8('0x15')]+_0x3a4808[_0x05d8('0x14')];var _0x306b21;if(_0xf00369>=_0x51674f){_0xf00369=_0x51674f;_0x306b21=0xc8;}else{_0x306b21=0xce;}_0x5e1bbb['status'](_0x306b21);return _0x5e1bbb[_0x05d8('0x17')](_0x05d8('0x18'),_0x2c7c3f+'-'+_0xf00369+'/'+_0x51674f)[_0x05d8('0x12')](_0x1dc47c);}return null;};}function patchUpdates(_0x51b3e0){return function(_0x3a6851){try{jsonpatch[_0x05d8('0x19')](_0x3a6851,_0x51b3e0,!![]);}catch(_0x1adc2a){return BPromise[_0x05d8('0x1a')](_0x1adc2a);}return _0x3a6851[_0x05d8('0x1b')]();};}function saveUpdates(_0x56520f,_0xac30a3){return function(_0x4e1dda){if(_0x4e1dda){return _0x4e1dda[_0x05d8('0x1c')](_0x56520f)[_0x05d8('0x1d')](function(_0x5c6962){return _0x5c6962;});}return null;};}function removeEntity(_0x324bc8,_0x364335){return function(_0x463c03){if(_0x463c03){return _0x463c03[_0x05d8('0x1e')]()['then'](function(){_0x324bc8['status'](0xcc)[_0x05d8('0x11')]();});}};}function handleEntityNotFound(_0x333112,_0x31e712){return function(_0x3d147a){if(!_0x3d147a){_0x333112[_0x05d8('0x1f')](0x194);}return _0x3d147a;};}function handleError(_0x52f874,_0x3e2edb){_0x3e2edb=_0x3e2edb||0x1f4;return function(_0x154f4f){logger['error'](_0x154f4f[_0x05d8('0x20')]);if(_0x154f4f['name']){delete _0x154f4f['name'];}_0x52f874[_0x05d8('0x10')](_0x3e2edb)['send'](_0x154f4f);};}exports[_0x05d8('0x21')]=function(_0x2e7f93,_0x43a6ba){var _0x51ebbb={},_0x422c8e={},_0x702124={'count':0x0,'rows':[]};var _0x355d28=_[_0x05d8('0x22')](db[_0x05d8('0x23')][_0x05d8('0x24')],function(_0x120ff1){return{'name':_0x120ff1['fieldName'],'type':_0x120ff1[_0x05d8('0x25')][_0x05d8('0x26')]};});_0x422c8e[_0x05d8('0x27')]=_[_0x05d8('0x22')](_0x355d28,_0x05d8('0x28'));_0x422c8e[_0x05d8('0x29')]=_[_0x05d8('0x2a')](_0x2e7f93['query']);_0x422c8e[_0x05d8('0x2b')]=_[_0x05d8('0x2c')](_0x422c8e[_0x05d8('0x27')],_0x422c8e[_0x05d8('0x29')]);_0x51ebbb[_0x05d8('0x2d')]=_['intersection'](_0x422c8e[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x2e7f93['query']['fields']));_0x51ebbb[_0x05d8('0x2d')]=_0x51ebbb[_0x05d8('0x2d')]['length']?_0x51ebbb[_0x05d8('0x2d')]:_0x422c8e[_0x05d8('0x27')];if(!_0x2e7f93['query'][_0x05d8('0x2f')](_0x05d8('0x30'))){_0x51ebbb['limit']=qs['limit'](_0x2e7f93[_0x05d8('0x29')]['limit']);_0x51ebbb[_0x05d8('0x15')]=qs[_0x05d8('0x15')](_0x2e7f93[_0x05d8('0x29')][_0x05d8('0x15')]);}_0x51ebbb['order']=qs[_0x05d8('0x31')](_0x2e7f93['query'][_0x05d8('0x31')]);_0x51ebbb['where']=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x2e7f93[_0x05d8('0x29')],_0x422c8e[_0x05d8('0x2b')]),_0x355d28);if(_0x2e7f93[_0x05d8('0x29')]['filter']){_0x51ebbb['where']=_[_0x05d8('0x33')](_0x51ebbb[_0x05d8('0x34')],{'$or':_[_0x05d8('0x22')](_0x355d28,function(_0x421dc4){if(_0x421dc4[_0x05d8('0x25')]!==_0x05d8('0x35')){var _0x47b079={};_0x47b079[_0x421dc4[_0x05d8('0x28')]]={'$like':'%'+_0x2e7f93['query']['filter']+'%'};return _0x47b079;}})});}_0x51ebbb=_['merge']({},_0x51ebbb,_0x2e7f93['options']);var _0x3265ff={'where':_0x51ebbb['where']};return db[_0x05d8('0x23')][_0x05d8('0x16')](_0x3265ff)['then'](function(_0x179af1){_0x702124[_0x05d8('0x16')]=_0x179af1;if(_0x2e7f93['query'][_0x05d8('0x36')]){_0x51ebbb[_0x05d8('0x37')]=[{'all':!![]}];}return db[_0x05d8('0x23')]['findAll'](_0x51ebbb);})['then'](function(_0x2946c3){_0x702124[_0x05d8('0x38')]=_0x2946c3;return _0x702124;})[_0x05d8('0x1d')](respondWithFilteredResult(_0x43a6ba,_0x51ebbb))[_0x05d8('0x39')](handleError(_0x43a6ba,null));};exports[_0x05d8('0x3a')]=function(_0x225ec2,_0x38ebbd){var _0x46d8b6={'raw':![],'where':{'id':_0x225ec2[_0x05d8('0x3b')]['id']}},_0x42e012={};_0x42e012[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db[_0x05d8('0x23')][_0x05d8('0x24')]);_0x42e012[_0x05d8('0x29')]=_[_0x05d8('0x2a')](_0x225ec2[_0x05d8('0x29')]);_0x42e012[_0x05d8('0x2b')]=_[_0x05d8('0x2c')](_0x42e012[_0x05d8('0x27')],_0x42e012[_0x05d8('0x29')]);_0x46d8b6['attributes']=_[_0x05d8('0x2c')](_0x42e012[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x225ec2[_0x05d8('0x29')][_0x05d8('0x2e')]));_0x46d8b6[_0x05d8('0x2d')]=_0x46d8b6['attributes'][_0x05d8('0x3c')]?_0x46d8b6['attributes']:_0x42e012[_0x05d8('0x27')];if(_0x225ec2['query'][_0x05d8('0x36')]){_0x46d8b6[_0x05d8('0x37')]=[{'all':!![]}];}_0x46d8b6=_['merge']({},_0x46d8b6,_0x225ec2[_0x05d8('0x3d')]);return db['ZohoConfiguration'][_0x05d8('0x3e')](_0x46d8b6)[_0x05d8('0x1d')](handleEntityNotFound(_0x38ebbd,null))[_0x05d8('0x1d')](respondWithResult(_0x38ebbd,null))['catch'](handleError(_0x38ebbd,null));};exports['create']=function(_0x27e7e5,_0x5225ce){return db[_0x05d8('0x23')][_0x05d8('0x3f')](_0x27e7e5['body'],{})[_0x05d8('0x1d')](respondWithResult(_0x5225ce,0xc9))[_0x05d8('0x39')](handleError(_0x5225ce,null));};exports['update']=function(_0x49bdea,_0x4087b8){if(_0x49bdea[_0x05d8('0x40')]['id']){delete _0x49bdea['body']['id'];}return db[_0x05d8('0x23')][_0x05d8('0x3e')]({'where':{'id':_0x49bdea[_0x05d8('0x3b')]['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x4087b8,null))[_0x05d8('0x1d')](saveUpdates(_0x49bdea[_0x05d8('0x40')],null))[_0x05d8('0x1d')](respondWithResult(_0x4087b8,null))[_0x05d8('0x39')](handleError(_0x4087b8,null));};exports[_0x05d8('0x1e')]=function(_0x2992b4,_0x5273c6){return db[_0x05d8('0x23')][_0x05d8('0x3e')]({'where':{'id':_0x2992b4['params']['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x5273c6,null))[_0x05d8('0x1d')](removeEntity(_0x5273c6,null))[_0x05d8('0x39')](handleError(_0x5273c6,null));};exports['getFields']=function(_0x290a83,_0x14dcce,_0x5c64e5){var _0x2f02a8={};var _0xe3950b={};var _0x166c46;var _0x3259ba;return db[_0x05d8('0x23')][_0x05d8('0x41')]({'where':{'id':_0x290a83[_0x05d8('0x3b')]['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x14dcce,null))[_0x05d8('0x1d')](function(_0x344be3){if(_0x344be3){_0x166c46=_0x344be3;_0xe3950b[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db[_0x05d8('0x42')][_0x05d8('0x24')]);_0xe3950b[_0x05d8('0x29')]=_['keys'](_0x290a83[_0x05d8('0x29')]);_0xe3950b['filters']=_[_0x05d8('0x2c')](_0xe3950b[_0x05d8('0x27')],_0xe3950b[_0x05d8('0x29')]);_0x2f02a8[_0x05d8('0x2d')]=_[_0x05d8('0x2c')](_0xe3950b[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x290a83[_0x05d8('0x29')]['fields']));_0x2f02a8[_0x05d8('0x2d')]=_0x2f02a8['attributes'][_0x05d8('0x3c')]?_0x2f02a8['attributes']:_0xe3950b[_0x05d8('0x27')];_0x2f02a8[_0x05d8('0x43')]=qs[_0x05d8('0x31')](_0x290a83[_0x05d8('0x29')]['sort']);_0x2f02a8[_0x05d8('0x34')]=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x290a83[_0x05d8('0x29')],_0xe3950b[_0x05d8('0x2b')]));if(_0x290a83['query'][_0x05d8('0x44')]){_0x2f02a8[_0x05d8('0x34')]=_[_0x05d8('0x33')](_0x2f02a8['where'],{'$or':_[_0x05d8('0x22')](_0x2f02a8[_0x05d8('0x2d')],function(_0x2ab906){var _0x35b812={};_0x35b812[_0x2ab906]={'$like':'%'+_0x290a83[_0x05d8('0x29')]['filter']+'%'};return _0x35b812;})});}_0x2f02a8=_[_0x05d8('0x33')]({},_0x2f02a8,_0x290a83[_0x05d8('0x3d')]);return _0x166c46[_0x05d8('0x45')](_0x2f02a8);}})[_0x05d8('0x1d')](function(_0x9ca874){if(_0x9ca874){_0x3259ba=_0x9ca874[_0x05d8('0x3c')];if(!_0x290a83[_0x05d8('0x29')][_0x05d8('0x2f')](_0x05d8('0x30'))){_0x2f02a8['limit']=qs[_0x05d8('0x14')](_0x290a83[_0x05d8('0x29')][_0x05d8('0x14')]);_0x2f02a8['offset']=qs[_0x05d8('0x15')](_0x290a83[_0x05d8('0x29')][_0x05d8('0x15')]);}return _0x166c46['getFields'](_0x2f02a8);}})[_0x05d8('0x1d')](function(_0x568cd5){if(_0x568cd5){return _0x568cd5?{'count':_0x3259ba,'rows':_0x568cd5}:null;}})['then'](respondWithResult(_0x14dcce,null))[_0x05d8('0x39')](handleError(_0x14dcce,null));};exports['getSubjects']=function(_0x2f085e,_0x11f9d5,_0x4c13e5){var _0x3d1afc={};var _0x5103d6={};var _0x11bab6;var _0x3f690d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2f085e[_0x05d8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x11f9d5,null))[_0x05d8('0x1d')](function(_0x1f6b87){if(_0x1f6b87){_0x11bab6=_0x1f6b87;_0x5103d6[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db['ZohoField']['rawAttributes']);_0x5103d6[_0x05d8('0x29')]=_['keys'](_0x2f085e[_0x05d8('0x29')]);_0x5103d6[_0x05d8('0x2b')]=_[_0x05d8('0x2c')](_0x5103d6[_0x05d8('0x27')],_0x5103d6[_0x05d8('0x29')]);_0x3d1afc[_0x05d8('0x2d')]=_[_0x05d8('0x2c')](_0x5103d6[_0x05d8('0x27')],qs['fields'](_0x2f085e[_0x05d8('0x29')]['fields']));_0x3d1afc['attributes']=_0x3d1afc[_0x05d8('0x2d')][_0x05d8('0x3c')]?_0x3d1afc[_0x05d8('0x2d')]:_0x5103d6[_0x05d8('0x27')];_0x3d1afc[_0x05d8('0x43')]=qs[_0x05d8('0x31')](_0x2f085e[_0x05d8('0x29')][_0x05d8('0x31')]);_0x3d1afc[_0x05d8('0x34')]=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x2f085e[_0x05d8('0x29')],_0x5103d6[_0x05d8('0x2b')]));if(_0x2f085e[_0x05d8('0x29')][_0x05d8('0x44')]){_0x3d1afc[_0x05d8('0x34')]=_['merge'](_0x3d1afc[_0x05d8('0x34')],{'$or':_['map'](_0x3d1afc[_0x05d8('0x2d')],function(_0x516df3){var _0x15e4b1={};_0x15e4b1[_0x516df3]={'$like':'%'+_0x2f085e[_0x05d8('0x29')][_0x05d8('0x44')]+'%'};return _0x15e4b1;})});}_0x3d1afc=_[_0x05d8('0x33')]({},_0x3d1afc,_0x2f085e['options']);return _0x11bab6[_0x05d8('0x46')](_0x3d1afc);}})['then'](function(_0x5a71f3){if(_0x5a71f3){_0x3f690d=_0x5a71f3[_0x05d8('0x3c')];if(!_0x2f085e[_0x05d8('0x29')][_0x05d8('0x2f')](_0x05d8('0x30'))){_0x3d1afc['limit']=qs[_0x05d8('0x14')](_0x2f085e['query'][_0x05d8('0x14')]);_0x3d1afc[_0x05d8('0x15')]=qs['offset'](_0x2f085e[_0x05d8('0x29')][_0x05d8('0x15')]);}return _0x11bab6[_0x05d8('0x46')](_0x3d1afc);}})['then'](function(_0x320020){if(_0x320020){return _0x320020?{'count':_0x3f690d,'rows':_0x320020}:null;}})[_0x05d8('0x1d')](respondWithResult(_0x11f9d5,null))[_0x05d8('0x39')](handleError(_0x11f9d5,null));};exports['getDescriptions']=function(_0x10e685,_0x311d32,_0x34ef0f){var _0xcf4393={};var _0x5d934f={};var _0x1825d7;var _0x42faa3;return db['ZohoConfiguration'][_0x05d8('0x41')]({'where':{'id':_0x10e685[_0x05d8('0x3b')]['id']}})[_0x05d8('0x1d')](handleEntityNotFound(_0x311d32,null))[_0x05d8('0x1d')](function(_0x526829){if(_0x526829){_0x1825d7=_0x526829;_0x5d934f[_0x05d8('0x27')]=_[_0x05d8('0x2a')](db[_0x05d8('0x42')][_0x05d8('0x24')]);_0x5d934f['query']=_[_0x05d8('0x2a')](_0x10e685[_0x05d8('0x29')]);_0x5d934f[_0x05d8('0x2b')]=_['intersection'](_0x5d934f[_0x05d8('0x27')],_0x5d934f[_0x05d8('0x29')]);_0xcf4393[_0x05d8('0x2d')]=_[_0x05d8('0x2c')](_0x5d934f[_0x05d8('0x27')],qs[_0x05d8('0x2e')](_0x10e685[_0x05d8('0x29')][_0x05d8('0x2e')]));_0xcf4393[_0x05d8('0x2d')]=_0xcf4393[_0x05d8('0x2d')][_0x05d8('0x3c')]?_0xcf4393[_0x05d8('0x2d')]:_0x5d934f[_0x05d8('0x27')];_0xcf4393[_0x05d8('0x43')]=qs[_0x05d8('0x31')](_0x10e685[_0x05d8('0x29')][_0x05d8('0x31')]);_0xcf4393[_0x05d8('0x34')]=qs[_0x05d8('0x2b')](_[_0x05d8('0x32')](_0x10e685['query'],_0x5d934f[_0x05d8('0x2b')]));if(_0x10e685['query'][_0x05d8('0x44')]){_0xcf4393[_0x05d8('0x34')]=_[_0x05d8('0x33')](_0xcf4393[_0x05d8('0x34')],{'$or':_[_0x05d8('0x22')](_0xcf4393[_0x05d8('0x2d')],function(_0x5a0709){var _0x4130cd={};_0x4130cd[_0x5a0709]={'$like':'%'+_0x10e685[_0x05d8('0x29')][_0x05d8('0x44')]+'%'};return _0x4130cd;})});}_0xcf4393=_[_0x05d8('0x33')]({},_0xcf4393,_0x10e685[_0x05d8('0x3d')]);return _0x1825d7['getDescriptions'](_0xcf4393);}})[_0x05d8('0x1d')](function(_0x323c7e){if(_0x323c7e){_0x42faa3=_0x323c7e[_0x05d8('0x3c')];if(!_0x10e685[_0x05d8('0x29')][_0x05d8('0x2f')]('nolimit')){_0xcf4393[_0x05d8('0x14')]=qs[_0x05d8('0x14')](_0x10e685[_0x05d8('0x29')][_0x05d8('0x14')]);_0xcf4393['offset']=qs['offset'](_0x10e685[_0x05d8('0x29')][_0x05d8('0x15')]);}return _0x1825d7[_0x05d8('0x47')](_0xcf4393);}})[_0x05d8('0x1d')](function(_0x841188){if(_0x841188){return _0x841188?{'count':_0x42faa3,'rows':_0x841188}:null;}})[_0x05d8('0x1d')](respondWithResult(_0x311d32,null))['catch'](handleError(_0x311d32,null));}; \ No newline at end of file +var _0x2588=['path','sox','to-csv','ejs','fs-extra','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','getSubjects','ZohoField','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x123c45,_0xdfb640){var _0x1fa37d=function(_0x12cce2){while(--_0x12cce2){_0x123c45['push'](_0x123c45['shift']());}};_0x1fa37d(++_0xdfb640);}(_0x2588,0x139));var _0x8258=function(_0xda2972,_0x55d9c1){_0xda2972=_0xda2972-0x0;var _0x803ee1=_0x2588[_0xda2972];return _0x803ee1;};'use strict';var emlformat=require(_0x8258('0x0'));var rimraf=require(_0x8258('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8258('0x2'));var rp=require(_0x8258('0x3'));var moment=require(_0x8258('0x4'));var BPromise=require(_0x8258('0x5'));var Mustache=require('mustache');var util=require(_0x8258('0x6'));var path=require(_0x8258('0x7'));var sox=require(_0x8258('0x8'));var csv=require(_0x8258('0x9'));var ejs=require(_0x8258('0xa'));var fs=require('fs');var fs_extra=require(_0x8258('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8258('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8258('0x9'));var querystring=require(_0x8258('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8258('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8258('0xf'));var hardwareService=require(_0x8258('0x10'));var logger=require(_0x8258('0x11'))(_0x8258('0x12'));var utils=require(_0x8258('0x13'));var config=require(_0x8258('0x14'));var licenseUtil=require(_0x8258('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13dede,_0x2926a6){_0x2926a6=_0x2926a6||0xcc;return function(_0x2530dd){if(_0x2530dd){return _0x13dede[_0x8258('0x16')](_0x2926a6);}return _0x13dede[_0x8258('0x17')](_0x2926a6)['end']();};}function respondWithResult(_0x1607b9,_0x3444eb){_0x3444eb=_0x3444eb||0xc8;return function(_0x2d11c8){if(_0x2d11c8){return _0x1607b9[_0x8258('0x17')](_0x3444eb)[_0x8258('0x18')](_0x2d11c8);}};}function respondWithFilteredResult(_0x43465e,_0xc1988){return function(_0x58dfb6){if(_0x58dfb6){var _0xd32382=typeof _0xc1988['offset']===_0x8258('0x19')&&typeof _0xc1988[_0x8258('0x1a')]==='undefined';var _0x2f56c9=_0x58dfb6[_0x8258('0x1b')];var _0x36c7a9=_0xd32382?0x0:_0xc1988[_0x8258('0x1c')];var _0x317d91=_0xd32382?_0x58dfb6[_0x8258('0x1b')]:_0xc1988[_0x8258('0x1c')]+_0xc1988['limit'];var _0x5d9b07;if(_0x317d91>=_0x2f56c9){_0x317d91=_0x2f56c9;_0x5d9b07=0xc8;}else{_0x5d9b07=0xce;}_0x43465e[_0x8258('0x17')](_0x5d9b07);return _0x43465e[_0x8258('0x1d')](_0x8258('0x1e'),_0x36c7a9+'-'+_0x317d91+'/'+_0x2f56c9)[_0x8258('0x18')](_0x58dfb6);}return null;};}function patchUpdates(_0xd3790a){return function(_0xaf0463){try{jsonpatch[_0x8258('0x1f')](_0xaf0463,_0xd3790a,!![]);}catch(_0x1d822c){return BPromise[_0x8258('0x20')](_0x1d822c);}return _0xaf0463[_0x8258('0x21')]();};}function saveUpdates(_0x1dc41f,_0x5bdbf4){return function(_0x517d1e){if(_0x517d1e){return _0x517d1e[_0x8258('0x22')](_0x1dc41f)['then'](function(_0x2a2c0d){return _0x2a2c0d;});}return null;};}function removeEntity(_0x163510,_0x210568){return function(_0x57a13a){if(_0x57a13a){return _0x57a13a[_0x8258('0x23')]()[_0x8258('0x24')](function(){_0x163510['status'](0xcc)[_0x8258('0x25')]();});}};}function handleEntityNotFound(_0x213c68,_0x5ce406){return function(_0x4969c8){if(!_0x4969c8){_0x213c68[_0x8258('0x16')](0x194);}return _0x4969c8;};}function handleError(_0x409704,_0x34322f){_0x34322f=_0x34322f||0x1f4;return function(_0x22699a){logger[_0x8258('0x26')](_0x22699a['stack']);if(_0x22699a[_0x8258('0x27')]){delete _0x22699a['name'];}_0x409704['status'](_0x34322f)[_0x8258('0x28')](_0x22699a);};}exports[_0x8258('0x29')]=function(_0x253c5f,_0x49da04){var _0x31cc07={},_0xa4eb2a={},_0x491d06={'count':0x0,'rows':[]};var _0x100f15=_[_0x8258('0x2a')](db[_0x8258('0x2b')][_0x8258('0x2c')],function(_0x1184a9){return{'name':_0x1184a9[_0x8258('0x2d')],'type':_0x1184a9[_0x8258('0x2e')][_0x8258('0x2f')]};});_0xa4eb2a[_0x8258('0x30')]=_[_0x8258('0x2a')](_0x100f15,_0x8258('0x27'));_0xa4eb2a[_0x8258('0x31')]=_[_0x8258('0x32')](_0x253c5f[_0x8258('0x31')]);_0xa4eb2a[_0x8258('0x33')]=_[_0x8258('0x34')](_0xa4eb2a[_0x8258('0x30')],_0xa4eb2a['query']);_0x31cc07[_0x8258('0x35')]=_[_0x8258('0x34')](_0xa4eb2a[_0x8258('0x30')],qs[_0x8258('0x36')](_0x253c5f['query']['fields']));_0x31cc07[_0x8258('0x35')]=_0x31cc07[_0x8258('0x35')]['length']?_0x31cc07[_0x8258('0x35')]:_0xa4eb2a['model'];if(!_0x253c5f[_0x8258('0x31')][_0x8258('0x37')](_0x8258('0x38'))){_0x31cc07[_0x8258('0x1a')]=qs[_0x8258('0x1a')](_0x253c5f[_0x8258('0x31')][_0x8258('0x1a')]);_0x31cc07[_0x8258('0x1c')]=qs['offset'](_0x253c5f[_0x8258('0x31')][_0x8258('0x1c')]);}_0x31cc07[_0x8258('0x39')]=qs[_0x8258('0x3a')](_0x253c5f[_0x8258('0x31')][_0x8258('0x3a')]);_0x31cc07['where']=qs['filters'](_[_0x8258('0x3b')](_0x253c5f['query'],_0xa4eb2a['filters']),_0x100f15);if(_0x253c5f[_0x8258('0x31')][_0x8258('0x3c')]){_0x31cc07[_0x8258('0x3d')]=_[_0x8258('0x3e')](_0x31cc07[_0x8258('0x3d')],{'$or':_[_0x8258('0x2a')](_0x100f15,function(_0x26849d){if(_0x26849d[_0x8258('0x2e')]!=='VIRTUAL'){var _0x221492={};_0x221492[_0x26849d[_0x8258('0x27')]]={'$like':'%'+_0x253c5f[_0x8258('0x31')]['filter']+'%'};return _0x221492;}})});}_0x31cc07=_[_0x8258('0x3e')]({},_0x31cc07,_0x253c5f[_0x8258('0x3f')]);var _0x21ea80={'where':_0x31cc07[_0x8258('0x3d')]};return db[_0x8258('0x2b')][_0x8258('0x1b')](_0x21ea80)['then'](function(_0x103544){_0x491d06[_0x8258('0x1b')]=_0x103544;if(_0x253c5f['query'][_0x8258('0x40')]){_0x31cc07[_0x8258('0x41')]=[{'all':!![]}];}return db[_0x8258('0x2b')][_0x8258('0x42')](_0x31cc07);})[_0x8258('0x24')](function(_0x2181ea){_0x491d06[_0x8258('0x43')]=_0x2181ea;return _0x491d06;})[_0x8258('0x24')](respondWithFilteredResult(_0x49da04,_0x31cc07))[_0x8258('0x44')](handleError(_0x49da04,null));};exports[_0x8258('0x45')]=function(_0xd89ac0,_0x4917a2){var _0x31256e={'raw':![],'where':{'id':_0xd89ac0[_0x8258('0x46')]['id']}},_0x4dcf78={};_0x4dcf78[_0x8258('0x30')]=_[_0x8258('0x32')](db[_0x8258('0x2b')][_0x8258('0x2c')]);_0x4dcf78[_0x8258('0x31')]=_[_0x8258('0x32')](_0xd89ac0['query']);_0x4dcf78[_0x8258('0x33')]=_[_0x8258('0x34')](_0x4dcf78['model'],_0x4dcf78[_0x8258('0x31')]);_0x31256e[_0x8258('0x35')]=_['intersection'](_0x4dcf78['model'],qs[_0x8258('0x36')](_0xd89ac0[_0x8258('0x31')][_0x8258('0x36')]));_0x31256e['attributes']=_0x31256e['attributes'][_0x8258('0x47')]?_0x31256e[_0x8258('0x35')]:_0x4dcf78[_0x8258('0x30')];if(_0xd89ac0[_0x8258('0x31')][_0x8258('0x40')]){_0x31256e[_0x8258('0x41')]=[{'all':!![]}];}_0x31256e=_['merge']({},_0x31256e,_0xd89ac0[_0x8258('0x3f')]);return db[_0x8258('0x2b')][_0x8258('0x48')](_0x31256e)['then'](handleEntityNotFound(_0x4917a2,null))['then'](respondWithResult(_0x4917a2,null))[_0x8258('0x44')](handleError(_0x4917a2,null));};exports[_0x8258('0x49')]=function(_0x36e7f3,_0x55da5f){return db[_0x8258('0x2b')][_0x8258('0x49')](_0x36e7f3[_0x8258('0x4a')],{})[_0x8258('0x24')](respondWithResult(_0x55da5f,0xc9))['catch'](handleError(_0x55da5f,null));};exports[_0x8258('0x22')]=function(_0x23ec75,_0x1781fe){if(_0x23ec75[_0x8258('0x4a')]['id']){delete _0x23ec75[_0x8258('0x4a')]['id'];}return db[_0x8258('0x2b')]['find']({'where':{'id':_0x23ec75[_0x8258('0x46')]['id']}})['then'](handleEntityNotFound(_0x1781fe,null))[_0x8258('0x24')](saveUpdates(_0x23ec75['body'],null))[_0x8258('0x24')](respondWithResult(_0x1781fe,null))[_0x8258('0x44')](handleError(_0x1781fe,null));};exports[_0x8258('0x23')]=function(_0x447bf0,_0x1e88d9){return db[_0x8258('0x2b')][_0x8258('0x48')]({'where':{'id':_0x447bf0['params']['id']}})[_0x8258('0x24')](handleEntityNotFound(_0x1e88d9,null))[_0x8258('0x24')](removeEntity(_0x1e88d9,null))[_0x8258('0x44')](handleError(_0x1e88d9,null));};exports[_0x8258('0x4b')]=function(_0x321929,_0x306607,_0x528503){var _0x391c4f={};var _0x36fa14={};var _0x48c9e3;var _0x1dfa93;return db[_0x8258('0x2b')]['findOne']({'where':{'id':_0x321929[_0x8258('0x46')]['id']}})[_0x8258('0x24')](handleEntityNotFound(_0x306607,null))[_0x8258('0x24')](function(_0x1c6c49){if(_0x1c6c49){_0x48c9e3=_0x1c6c49;_0x36fa14[_0x8258('0x30')]=_[_0x8258('0x32')](db['ZohoField'][_0x8258('0x2c')]);_0x36fa14[_0x8258('0x31')]=_[_0x8258('0x32')](_0x321929['query']);_0x36fa14[_0x8258('0x33')]=_['intersection'](_0x36fa14[_0x8258('0x30')],_0x36fa14[_0x8258('0x31')]);_0x391c4f['attributes']=_['intersection'](_0x36fa14[_0x8258('0x30')],qs[_0x8258('0x36')](_0x321929[_0x8258('0x31')]['fields']));_0x391c4f[_0x8258('0x35')]=_0x391c4f[_0x8258('0x35')][_0x8258('0x47')]?_0x391c4f[_0x8258('0x35')]:_0x36fa14[_0x8258('0x30')];_0x391c4f[_0x8258('0x39')]=qs['sort'](_0x321929[_0x8258('0x31')][_0x8258('0x3a')]);_0x391c4f[_0x8258('0x3d')]=qs[_0x8258('0x33')](_[_0x8258('0x3b')](_0x321929[_0x8258('0x31')],_0x36fa14[_0x8258('0x33')]));if(_0x321929[_0x8258('0x31')][_0x8258('0x3c')]){_0x391c4f[_0x8258('0x3d')]=_[_0x8258('0x3e')](_0x391c4f[_0x8258('0x3d')],{'$or':_[_0x8258('0x2a')](_0x391c4f[_0x8258('0x35')],function(_0x4e7e38){var _0x50b732={};_0x50b732[_0x4e7e38]={'$like':'%'+_0x321929[_0x8258('0x31')]['filter']+'%'};return _0x50b732;})});}_0x391c4f=_[_0x8258('0x3e')]({},_0x391c4f,_0x321929['options']);return _0x48c9e3['getFields'](_0x391c4f);}})[_0x8258('0x24')](function(_0x1ebb12){if(_0x1ebb12){_0x1dfa93=_0x1ebb12[_0x8258('0x47')];if(!_0x321929['query'][_0x8258('0x37')](_0x8258('0x38'))){_0x391c4f[_0x8258('0x1a')]=qs[_0x8258('0x1a')](_0x321929['query']['limit']);_0x391c4f['offset']=qs[_0x8258('0x1c')](_0x321929[_0x8258('0x31')][_0x8258('0x1c')]);}return _0x48c9e3['getFields'](_0x391c4f);}})[_0x8258('0x24')](function(_0x490347){if(_0x490347){return _0x490347?{'count':_0x1dfa93,'rows':_0x490347}:null;}})[_0x8258('0x24')](respondWithResult(_0x306607,null))[_0x8258('0x44')](handleError(_0x306607,null));};exports[_0x8258('0x4c')]=function(_0x45be75,_0xe2a091,_0x163596){var _0x591e02={};var _0xfd3583={};var _0x3a10bf;var _0x1601f8;return db[_0x8258('0x2b')]['findOne']({'where':{'id':_0x45be75[_0x8258('0x46')]['id']}})[_0x8258('0x24')](handleEntityNotFound(_0xe2a091,null))[_0x8258('0x24')](function(_0x59a050){if(_0x59a050){_0x3a10bf=_0x59a050;_0xfd3583[_0x8258('0x30')]=_['keys'](db[_0x8258('0x4d')][_0x8258('0x2c')]);_0xfd3583[_0x8258('0x31')]=_[_0x8258('0x32')](_0x45be75['query']);_0xfd3583[_0x8258('0x33')]=_[_0x8258('0x34')](_0xfd3583[_0x8258('0x30')],_0xfd3583['query']);_0x591e02[_0x8258('0x35')]=_[_0x8258('0x34')](_0xfd3583[_0x8258('0x30')],qs['fields'](_0x45be75[_0x8258('0x31')][_0x8258('0x36')]));_0x591e02['attributes']=_0x591e02[_0x8258('0x35')]['length']?_0x591e02[_0x8258('0x35')]:_0xfd3583[_0x8258('0x30')];_0x591e02[_0x8258('0x39')]=qs[_0x8258('0x3a')](_0x45be75[_0x8258('0x31')][_0x8258('0x3a')]);_0x591e02['where']=qs['filters'](_[_0x8258('0x3b')](_0x45be75[_0x8258('0x31')],_0xfd3583[_0x8258('0x33')]));if(_0x45be75[_0x8258('0x31')]['filter']){_0x591e02['where']=_['merge'](_0x591e02[_0x8258('0x3d')],{'$or':_[_0x8258('0x2a')](_0x591e02[_0x8258('0x35')],function(_0x20f9d7){var _0x235033={};_0x235033[_0x20f9d7]={'$like':'%'+_0x45be75[_0x8258('0x31')][_0x8258('0x3c')]+'%'};return _0x235033;})});}_0x591e02=_[_0x8258('0x3e')]({},_0x591e02,_0x45be75['options']);return _0x3a10bf['getSubjects'](_0x591e02);}})[_0x8258('0x24')](function(_0x54b2ac){if(_0x54b2ac){_0x1601f8=_0x54b2ac[_0x8258('0x47')];if(!_0x45be75['query']['hasOwnProperty'](_0x8258('0x38'))){_0x591e02['limit']=qs['limit'](_0x45be75[_0x8258('0x31')][_0x8258('0x1a')]);_0x591e02[_0x8258('0x1c')]=qs[_0x8258('0x1c')](_0x45be75[_0x8258('0x31')][_0x8258('0x1c')]);}return _0x3a10bf['getSubjects'](_0x591e02);}})[_0x8258('0x24')](function(_0x4184ed){if(_0x4184ed){return _0x4184ed?{'count':_0x1601f8,'rows':_0x4184ed}:null;}})[_0x8258('0x24')](respondWithResult(_0xe2a091,null))[_0x8258('0x44')](handleError(_0xe2a091,null));};exports['getDescriptions']=function(_0x25fb32,_0x14bc4d,_0x1987a9){var _0x3b9fb1={};var _0x592588={};var _0xca55f2;var _0x30f0b4;return db[_0x8258('0x2b')][_0x8258('0x4e')]({'where':{'id':_0x25fb32[_0x8258('0x46')]['id']}})[_0x8258('0x24')](handleEntityNotFound(_0x14bc4d,null))['then'](function(_0x3e7a17){if(_0x3e7a17){_0xca55f2=_0x3e7a17;_0x592588[_0x8258('0x30')]=_[_0x8258('0x32')](db[_0x8258('0x4d')][_0x8258('0x2c')]);_0x592588[_0x8258('0x31')]=_[_0x8258('0x32')](_0x25fb32[_0x8258('0x31')]);_0x592588[_0x8258('0x33')]=_['intersection'](_0x592588[_0x8258('0x30')],_0x592588[_0x8258('0x31')]);_0x3b9fb1[_0x8258('0x35')]=_[_0x8258('0x34')](_0x592588['model'],qs['fields'](_0x25fb32[_0x8258('0x31')]['fields']));_0x3b9fb1['attributes']=_0x3b9fb1['attributes']['length']?_0x3b9fb1[_0x8258('0x35')]:_0x592588[_0x8258('0x30')];_0x3b9fb1[_0x8258('0x39')]=qs[_0x8258('0x3a')](_0x25fb32[_0x8258('0x31')]['sort']);_0x3b9fb1['where']=qs[_0x8258('0x33')](_[_0x8258('0x3b')](_0x25fb32['query'],_0x592588[_0x8258('0x33')]));if(_0x25fb32[_0x8258('0x31')][_0x8258('0x3c')]){_0x3b9fb1['where']=_[_0x8258('0x3e')](_0x3b9fb1[_0x8258('0x3d')],{'$or':_['map'](_0x3b9fb1[_0x8258('0x35')],function(_0x3561a2){var _0x543d1f={};_0x543d1f[_0x3561a2]={'$like':'%'+_0x25fb32[_0x8258('0x31')][_0x8258('0x3c')]+'%'};return _0x543d1f;})});}_0x3b9fb1=_[_0x8258('0x3e')]({},_0x3b9fb1,_0x25fb32[_0x8258('0x3f')]);return _0xca55f2[_0x8258('0x4f')](_0x3b9fb1);}})['then'](function(_0x2489b5){if(_0x2489b5){_0x30f0b4=_0x2489b5[_0x8258('0x47')];if(!_0x25fb32[_0x8258('0x31')][_0x8258('0x37')](_0x8258('0x38'))){_0x3b9fb1[_0x8258('0x1a')]=qs[_0x8258('0x1a')](_0x25fb32['query'][_0x8258('0x1a')]);_0x3b9fb1[_0x8258('0x1c')]=qs[_0x8258('0x1c')](_0x25fb32[_0x8258('0x31')][_0x8258('0x1c')]);}return _0xca55f2['getDescriptions'](_0x3b9fb1);}})[_0x8258('0x24')](function(_0x15b928){if(_0x15b928){return _0x15b928?{'count':_0x30f0b4,'rows':_0x15b928}:null;}})[_0x8258('0x24')](respondWithResult(_0x14bc4d,null))[_0x8258('0x44')](handleError(_0x14bc4d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 67f25d7..aba4606 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 _0x3dc3=['../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x3dc3,0x6c));var _0x33dc=function(_0x33daeb,_0x2c5f4b){_0x33daeb=_0x33daeb-0x0;var _0xaa5215=_0x3dc3[_0x33daeb];return _0xaa5215;};'use strict';var _=require(_0x33dc('0x0'));var util=require(_0x33dc('0x1'));var logger=require(_0x33dc('0x2'))(_0x33dc('0x3'));var moment=require(_0x33dc('0x4'));var BPromise=require(_0x33dc('0x5'));var rp=require(_0x33dc('0x6'));var fs=require('fs');var path=require(_0x33dc('0x7'));var rimraf=require(_0x33dc('0x8'));var config=require(_0x33dc('0x9'));var attributes=require(_0x33dc('0xa'));module[_0x33dc('0xb')]=function(_0x4458e1,_0x35e0e8){return _0x4458e1[_0x33dc('0xc')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c37=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x31ed98,_0xe63469){var _0x5e4ef1=function(_0x101f0f){while(--_0x101f0f){_0x31ed98['push'](_0x31ed98['shift']());}};_0x5e4ef1(++_0xe63469);}(_0x6c37,0x180));var _0x76c3=function(_0x5dda79,_0x5b35f1){_0x5dda79=_0x5dda79-0x0;var _0x1c1707=_0x6c37[_0x5dda79];return _0x1c1707;};'use strict';var _=require(_0x76c3('0x0'));var util=require(_0x76c3('0x1'));var logger=require(_0x76c3('0x2'))(_0x76c3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x76c3('0x4'));var fs=require('fs');var path=require(_0x76c3('0x5'));var rimraf=require(_0x76c3('0x6'));var config=require(_0x76c3('0x7'));var attributes=require(_0x76c3('0x8'));module['exports']=function(_0x1adca1,_0x4f0be9){return _0x1adca1['define'](_0x76c3('0x9'),attributes,{'tableName':_0x76c3('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 faa85b5..7b1eaef 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 _0x66a0=['jayson/promise','client','http','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b9ddf,_0x32e7f5){var _0x5f4baa=function(_0x537180){while(--_0x537180){_0x1b9ddf['push'](_0x1b9ddf['shift']());}};_0x5f4baa(++_0x32e7f5);}(_0x66a0,0x17e));var _0x066a=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x66a0[_0x3a6e4b];return _0x36572d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x066a('0x0'));var BPromise=require(_0x066a('0x1'));var rs=require(_0x066a('0x2'));var fs=require('fs');var Redis=require(_0x066a('0x3'));var db=require(_0x066a('0x4'))['db'];var utils=require(_0x066a('0x5'));var logger=require(_0x066a('0x6'))(_0x066a('0x7'));var config=require(_0x066a('0x8'));var jayson=require(_0x066a('0x9'));var client=jayson[_0x066a('0xa')][_0x066a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52134b,_0xb50bbe,_0x1224ee){return new BPromise(function(_0x34f8b5,_0x123c10){return client[_0x066a('0xc')](_0x52134b,_0x1224ee)[_0x066a('0xd')](function(_0x1e4ea8){logger[_0x066a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x066a('0xf'));logger['debug'](_0x066a('0x10'),_0xb50bbe,_0x066a('0xf'),JSON[_0x066a('0x11')](_0x1e4ea8));if(_0x1e4ea8[_0x066a('0x12')]){if(_0x1e4ea8['error'][_0x066a('0x13')]===0x1f4){logger[_0x066a('0x12')](_0x066a('0x14'),_0xb50bbe,_0x1e4ea8[_0x066a('0x12')][_0x066a('0x15')]);return _0x123c10(_0x1e4ea8[_0x066a('0x12')]['message']);}logger[_0x066a('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x1e4ea8[_0x066a('0x12')][_0x066a('0x15')]);return _0x34f8b5(_0x1e4ea8[_0x066a('0x12')][_0x066a('0x15')]);}else{logger[_0x066a('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x066a('0xf'));_0x34f8b5(_0x1e4ea8['result'][_0x066a('0x15')]);}})[_0x066a('0x16')](function(_0x5e8a25){logger[_0x066a('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xb50bbe,_0x5e8a25);_0x123c10(_0x5e8a25);});});} \ No newline at end of file +var _0x6b6c=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x6b6c,0x1c7));var _0xc6b6=function(_0x2fbbff,_0x51d40a){_0x2fbbff=_0x2fbbff-0x0;var _0x426f85=_0x6b6c[_0x2fbbff];return _0x426f85;};'use strict';var _=require(_0xc6b6('0x0'));var util=require(_0xc6b6('0x1'));var moment=require('moment');var BPromise=require(_0xc6b6('0x2'));var rs=require(_0xc6b6('0x3'));var fs=require('fs');var Redis=require(_0xc6b6('0x4'));var db=require(_0xc6b6('0x5'))['db'];var utils=require(_0xc6b6('0x6'));var logger=require(_0xc6b6('0x7'))(_0xc6b6('0x8'));var config=require(_0xc6b6('0x9'));var jayson=require(_0xc6b6('0xa'));var client=jayson[_0xc6b6('0xb')][_0xc6b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x241701,_0x59bc5d,_0x2eeee9){return new BPromise(function(_0x245e19,_0x6ab564){return client[_0xc6b6('0xd')](_0x241701,_0x2eeee9)[_0xc6b6('0xe')](function(_0x16e489){logger[_0xc6b6('0xf')](_0xc6b6('0x10'),_0x59bc5d,_0xc6b6('0x11'));logger[_0xc6b6('0x12')](_0xc6b6('0x13'),_0x59bc5d,_0xc6b6('0x11'),JSON[_0xc6b6('0x14')](_0x16e489));if(_0x16e489[_0xc6b6('0x15')]){if(_0x16e489['error'][_0xc6b6('0x16')]===0x1f4){logger[_0xc6b6('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x59bc5d,_0x16e489[_0xc6b6('0x15')][_0xc6b6('0x17')]);return _0x6ab564(_0x16e489['error'][_0xc6b6('0x17')]);}logger[_0xc6b6('0x15')](_0xc6b6('0x10'),_0x59bc5d,_0x16e489['error'][_0xc6b6('0x17')]);return _0x245e19(_0x16e489[_0xc6b6('0x15')][_0xc6b6('0x17')]);}else{logger[_0xc6b6('0xf')](_0xc6b6('0x10'),_0x59bc5d,'request\x20sent');_0x245e19(_0x16e489[_0xc6b6('0x18')][_0xc6b6('0x17')]);}})['catch'](function(_0x4f427f){logger[_0xc6b6('0x15')](_0xc6b6('0x10'),_0x59bc5d,_0x4f427f);_0x6ab564(_0x4f427f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 6ad903e..7df6fef 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 _0x705f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0x705f,0x1a4));var _0xf705=function(_0x76bd2,_0x487abe){_0x76bd2=_0x76bd2-0x0;var _0x2e50f3=_0x705f[_0x76bd2];return _0x2e50f3;};'use strict';var multer=require(_0xf705('0x0'));var util=require('util');var path=require(_0xf705('0x1'));var timeout=require(_0xf705('0x2'));var express=require(_0xf705('0x3'));var router=express[_0xf705('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf705('0x5'));var interaction=require(_0xf705('0x6'));var config=require(_0xf705('0x7'));var controller=require(_0xf705('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf705('0x9')]);router[_0xf705('0xa')](_0xf705('0xb'),auth[_0xf705('0xc')](),controller[_0xf705('0xd')]);router[_0xf705('0xe')]('/',auth[_0xf705('0xc')](),controller[_0xf705('0xf')]);router[_0xf705('0x10')]('/:id',auth[_0xf705('0xc')](),controller[_0xf705('0x11')]);router['delete'](_0xf705('0xb'),auth[_0xf705('0xc')](),controller[_0xf705('0x12')]);module[_0xf705('0x13')]=router; \ No newline at end of file +var _0x22d1=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','util'];(function(_0x455c95,_0x15407c){var _0x2ba1a6=function(_0x17eb1f){while(--_0x17eb1f){_0x455c95['push'](_0x455c95['shift']());}};_0x2ba1a6(++_0x15407c);}(_0x22d1,0xf6));var _0x122d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x22d1[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x122d('0x0'));var path=require(_0x122d('0x1'));var timeout=require('connect-timeout');var express=require(_0x122d('0x2'));var router=express[_0x122d('0x3')]();var fs_extra=require(_0x122d('0x4'));var auth=require(_0x122d('0x5'));var interaction=require(_0x122d('0x6'));var config=require(_0x122d('0x7'));var controller=require(_0x122d('0x8'));router[_0x122d('0x9')]('/',auth['isAuthenticated'](),controller[_0x122d('0xa')]);router[_0x122d('0x9')](_0x122d('0xb'),auth[_0x122d('0xc')](),controller[_0x122d('0xd')]);router[_0x122d('0xe')]('/',auth['isAuthenticated'](),controller[_0x122d('0xf')]);router[_0x122d('0x10')](_0x122d('0xb'),auth['isAuthenticated'](),controller[_0x122d('0x11')]);router['delete'](_0x122d('0xb'),auth[_0x122d('0xc')](),controller['destroy']);module[_0x122d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 76d44a6..368ec91 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 _0x4894=['variable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x21f144,_0x5598d3){var _0x311a30=function(_0x1a927d){while(--_0x1a927d){_0x21f144['push'](_0x21f144['shift']());}};_0x311a30(++_0x5598d3);}(_0x4894,0x153));var _0x4489=function(_0x1554eb,_0x42d2d0){_0x1554eb=_0x1554eb-0x0;var _0x3fd1eb=_0x4894[_0x1554eb];return _0x3fd1eb;};'use strict';var Sequelize=require(_0x4489('0x0'));module[_0x4489('0x1')]={'type':{'type':Sequelize[_0x4489('0x2')](_0x4489('0x3'),_0x4489('0x4'),'customVariable','keyValue',_0x4489('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4489('0x6')]},'key':{'type':Sequelize[_0x4489('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4489('0x3'),_0x4489('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4489('0x6')]},'idField':{'type':Sequelize[_0x4489('0x6')]},'nameField':{'type':Sequelize[_0x4489('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4489('0x6')]}}; \ No newline at end of file +var _0xe165=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x46a8a3,_0x30bdc5){var _0x26f42e=function(_0x770c5a){while(--_0x770c5a){_0x46a8a3['push'](_0x46a8a3['shift']());}};_0x26f42e(++_0x30bdc5);}(_0xe165,0x163));var _0x5e16=function(_0x13b8b5,_0x297054){_0x13b8b5=_0x13b8b5-0x0;var _0x3f4873=_0xe165[_0x13b8b5];return _0x3f4873;};'use strict';var Sequelize=require(_0x5e16('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5e16('0x1'),_0x5e16('0x2'),_0x5e16('0x3'),_0x5e16('0x4'),_0x5e16('0x5')),'defaultValue':_0x5e16('0x1')},'content':{'type':Sequelize[_0x5e16('0x6')]},'key':{'type':Sequelize[_0x5e16('0x6')]},'keyType':{'type':Sequelize[_0x5e16('0x7')](_0x5e16('0x1'),_0x5e16('0x2'),_0x5e16('0x3'))},'keyContent':{'type':Sequelize[_0x5e16('0x6')]},'idField':{'type':Sequelize[_0x5e16('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5e16('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a59d304..cea7bf2 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 _0xa039=['end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','ZohoField','includeAll','include','findAll','rows','catch','params','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x1c1dc6,_0x1b61dc){var _0x15c4f5=function(_0xf736e7){while(--_0xf736e7){_0x1c1dc6['push'](_0x1c1dc6['shift']());}};_0x15c4f5(++_0x1b61dc);}(_0xa039,0x1c4));var _0x9a03=function(_0x2cf08,_0x3149fb){_0x2cf08=_0x2cf08-0x0;var _0x27cce0=_0xa039[_0x2cf08];return _0x27cce0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a03('0x1'));var rp=require(_0x9a03('0x2'));var moment=require(_0x9a03('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9a03('0x4'));var util=require(_0x9a03('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a03('0x6'));var fs=require('fs');var fs_extra=require(_0x9a03('0x7'));var _=require('lodash');var squel=require(_0x9a03('0x8'));var crypto=require(_0x9a03('0x9'));var jsforce=require(_0x9a03('0xa'));var deskjs=require(_0x9a03('0xb'));var toCsv=require(_0x9a03('0xc'));var querystring=require(_0x9a03('0xd'));var Papa=require(_0x9a03('0xe'));var Redis=require(_0x9a03('0xf'));var authService=require(_0x9a03('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a03('0x11'));var logger=require(_0x9a03('0x12'))(_0x9a03('0x13'));var utils=require(_0x9a03('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a03('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x198c5f,_0x96a876){_0x96a876=_0x96a876||0xcc;return function(_0x333e91){if(_0x333e91){return _0x198c5f[_0x9a03('0x16')](_0x96a876);}return _0x198c5f[_0x9a03('0x17')](_0x96a876)[_0x9a03('0x18')]();};}function respondWithResult(_0x318417,_0x217ae4){_0x217ae4=_0x217ae4||0xc8;return function(_0x3401f7){if(_0x3401f7){return _0x318417['status'](_0x217ae4)[_0x9a03('0x19')](_0x3401f7);}};}function respondWithFilteredResult(_0x383525,_0x2787b2){return function(_0x59aede){if(_0x59aede){var _0x39907c=typeof _0x2787b2[_0x9a03('0x1a')]===_0x9a03('0x1b')&&typeof _0x2787b2[_0x9a03('0x1c')]==='undefined';var _0xf1858c=_0x59aede[_0x9a03('0x1d')];var _0xdef92a=_0x39907c?0x0:_0x2787b2['offset'];var _0x5a16cb=_0x39907c?_0x59aede[_0x9a03('0x1d')]:_0x2787b2[_0x9a03('0x1a')]+_0x2787b2[_0x9a03('0x1c')];var _0x3ab363;if(_0x5a16cb>=_0xf1858c){_0x5a16cb=_0xf1858c;_0x3ab363=0xc8;}else{_0x3ab363=0xce;}_0x383525[_0x9a03('0x17')](_0x3ab363);return _0x383525[_0x9a03('0x1e')]('Content-Range',_0xdef92a+'-'+_0x5a16cb+'/'+_0xf1858c)[_0x9a03('0x19')](_0x59aede);}return null;};}function patchUpdates(_0x59de5b){return function(_0x1de96e){try{jsonpatch[_0x9a03('0x1f')](_0x1de96e,_0x59de5b,!![]);}catch(_0x59d231){return BPromise['reject'](_0x59d231);}return _0x1de96e[_0x9a03('0x20')]();};}function saveUpdates(_0x3657bb,_0x552f88){return function(_0x6e2d5a){if(_0x6e2d5a){return _0x6e2d5a[_0x9a03('0x21')](_0x3657bb)['then'](function(_0x596326){return _0x596326;});}return null;};}function removeEntity(_0x13d0fa,_0x166d1f){return function(_0x4b6d25){if(_0x4b6d25){return _0x4b6d25[_0x9a03('0x22')]()[_0x9a03('0x23')](function(){_0x13d0fa[_0x9a03('0x17')](0xcc)[_0x9a03('0x18')]();});}};}function handleEntityNotFound(_0x3000f7,_0x532f9c){return function(_0x2e641a){if(!_0x2e641a){_0x3000f7[_0x9a03('0x16')](0x194);}return _0x2e641a;};}function handleError(_0x5e52a7,_0x1ed8b4){_0x1ed8b4=_0x1ed8b4||0x1f4;return function(_0x313090){logger['error'](_0x313090['stack']);if(_0x313090[_0x9a03('0x24')]){delete _0x313090[_0x9a03('0x24')];}_0x5e52a7[_0x9a03('0x17')](_0x1ed8b4)['send'](_0x313090);};}exports[_0x9a03('0x25')]=function(_0x4681cc,_0x8d96fc){var _0x372102={},_0x29c5fb={},_0x20c9b0={'count':0x0,'rows':[]};var _0x24808b=_[_0x9a03('0x26')](db['ZohoField'][_0x9a03('0x27')],function(_0x16bb23){return{'name':_0x16bb23[_0x9a03('0x28')],'type':_0x16bb23[_0x9a03('0x29')]['key']};});_0x29c5fb[_0x9a03('0x2a')]=_[_0x9a03('0x26')](_0x24808b,_0x9a03('0x24'));_0x29c5fb['query']=_[_0x9a03('0x2b')](_0x4681cc[_0x9a03('0x2c')]);_0x29c5fb[_0x9a03('0x2d')]=_[_0x9a03('0x2e')](_0x29c5fb[_0x9a03('0x2a')],_0x29c5fb['query']);_0x372102[_0x9a03('0x2f')]=_[_0x9a03('0x2e')](_0x29c5fb[_0x9a03('0x2a')],qs[_0x9a03('0x30')](_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x30')]));_0x372102['attributes']=_0x372102['attributes'][_0x9a03('0x31')]?_0x372102[_0x9a03('0x2f')]:_0x29c5fb[_0x9a03('0x2a')];if(!_0x4681cc[_0x9a03('0x2c')]['hasOwnProperty'](_0x9a03('0x32'))){_0x372102[_0x9a03('0x1c')]=qs[_0x9a03('0x1c')](_0x4681cc[_0x9a03('0x2c')]['limit']);_0x372102[_0x9a03('0x1a')]=qs[_0x9a03('0x1a')](_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x1a')]);}_0x372102[_0x9a03('0x33')]=qs[_0x9a03('0x34')](_0x4681cc['query'][_0x9a03('0x34')]);_0x372102['where']=qs[_0x9a03('0x2d')](_[_0x9a03('0x35')](_0x4681cc[_0x9a03('0x2c')],_0x29c5fb[_0x9a03('0x2d')]),_0x24808b);if(_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x36')]){_0x372102['where']=_[_0x9a03('0x37')](_0x372102['where'],{'$or':_[_0x9a03('0x26')](_0x24808b,function(_0x27c81d){if(_0x27c81d['type']!==_0x9a03('0x38')){var _0xa6fc52={};_0xa6fc52[_0x27c81d[_0x9a03('0x24')]]={'$like':'%'+_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x36')]+'%'};return _0xa6fc52;}})});}_0x372102=_[_0x9a03('0x37')]({},_0x372102,_0x4681cc[_0x9a03('0x39')]);var _0x41fd44={'where':_0x372102[_0x9a03('0x3a')]};return db[_0x9a03('0x3b')][_0x9a03('0x1d')](_0x41fd44)['then'](function(_0x5579bf){_0x20c9b0[_0x9a03('0x1d')]=_0x5579bf;if(_0x4681cc[_0x9a03('0x2c')][_0x9a03('0x3c')]){_0x372102[_0x9a03('0x3d')]=[{'all':!![]}];}return db[_0x9a03('0x3b')][_0x9a03('0x3e')](_0x372102);})[_0x9a03('0x23')](function(_0x2563e8){_0x20c9b0[_0x9a03('0x3f')]=_0x2563e8;return _0x20c9b0;})[_0x9a03('0x23')](respondWithFilteredResult(_0x8d96fc,_0x372102))[_0x9a03('0x40')](handleError(_0x8d96fc,null));};exports['show']=function(_0x1c550a,_0x2d6481){var _0x2d4a2a={'raw':!![],'where':{'id':_0x1c550a[_0x9a03('0x41')]['id']}},_0x4363ad={};_0x4363ad[_0x9a03('0x2a')]=_[_0x9a03('0x2b')](db['ZohoField'][_0x9a03('0x27')]);_0x4363ad[_0x9a03('0x2c')]=_['keys'](_0x1c550a[_0x9a03('0x2c')]);_0x4363ad[_0x9a03('0x2d')]=_[_0x9a03('0x2e')](_0x4363ad['model'],_0x4363ad[_0x9a03('0x2c')]);_0x2d4a2a[_0x9a03('0x2f')]=_[_0x9a03('0x2e')](_0x4363ad[_0x9a03('0x2a')],qs[_0x9a03('0x30')](_0x1c550a['query']['fields']));_0x2d4a2a[_0x9a03('0x2f')]=_0x2d4a2a[_0x9a03('0x2f')]['length']?_0x2d4a2a['attributes']:_0x4363ad['model'];if(_0x1c550a[_0x9a03('0x2c')]['includeAll']){_0x2d4a2a[_0x9a03('0x3d')]=[{'all':!![]}];}_0x2d4a2a=_[_0x9a03('0x37')]({},_0x2d4a2a,_0x1c550a[_0x9a03('0x39')]);return db['ZohoField']['find'](_0x2d4a2a)[_0x9a03('0x23')](handleEntityNotFound(_0x2d6481,null))[_0x9a03('0x23')](respondWithResult(_0x2d6481,null))[_0x9a03('0x40')](handleError(_0x2d6481,null));};exports['create']=function(_0x136731,_0x3de6f3){return db[_0x9a03('0x3b')][_0x9a03('0x42')](_0x136731[_0x9a03('0x43')],{})[_0x9a03('0x23')](respondWithResult(_0x3de6f3,0xc9))[_0x9a03('0x40')](handleError(_0x3de6f3,null));};exports[_0x9a03('0x21')]=function(_0x101ddc,_0x4baf1d){if(_0x101ddc[_0x9a03('0x43')]['id']){delete _0x101ddc[_0x9a03('0x43')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x101ddc[_0x9a03('0x41')]['id']}})[_0x9a03('0x23')](handleEntityNotFound(_0x4baf1d,null))[_0x9a03('0x23')](saveUpdates(_0x101ddc['body'],null))[_0x9a03('0x23')](respondWithResult(_0x4baf1d,null))['catch'](handleError(_0x4baf1d,null));};exports[_0x9a03('0x22')]=function(_0x4acd71,_0x16bd8d){return db[_0x9a03('0x3b')]['find']({'where':{'id':_0x4acd71[_0x9a03('0x41')]['id']}})[_0x9a03('0x23')](handleEntityNotFound(_0x16bd8d,null))[_0x9a03('0x23')](removeEntity(_0x16bd8d,null))[_0x9a03('0x40')](handleError(_0x16bd8d,null));}; \ No newline at end of file +var _0x8c3c=['sort','pick','filter','where','VIRTUAL','merge','options','ZohoField','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','order'];(function(_0x2474ff,_0x5e1bca){var _0x415465=function(_0x55bf19){while(--_0x55bf19){_0x2474ff['push'](_0x2474ff['shift']());}};_0x415465(++_0x5e1bca);}(_0x8c3c,0x142));var _0xc8c3=function(_0x4b4d75,_0x20f3f7){_0x4b4d75=_0x4b4d75-0x0;var _0x3f2827=_0x8c3c[_0x4b4d75];return _0x3f2827;};'use strict';var emlformat=require(_0xc8c3('0x0'));var rimraf=require(_0xc8c3('0x1'));var zipdir=require(_0xc8c3('0x2'));var jsonpatch=require(_0xc8c3('0x3'));var rp=require('request-promise');var moment=require(_0xc8c3('0x4'));var BPromise=require(_0xc8c3('0x5'));var Mustache=require('mustache');var util=require(_0xc8c3('0x6'));var path=require(_0xc8c3('0x7'));var sox=require(_0xc8c3('0x8'));var csv=require('to-csv');var ejs=require(_0xc8c3('0x9'));var fs=require('fs');var fs_extra=require(_0xc8c3('0xa'));var _=require('lodash');var squel=require(_0xc8c3('0xb'));var crypto=require(_0xc8c3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc8c3('0xd'));var toCsv=require(_0xc8c3('0xe'));var querystring=require(_0xc8c3('0xf'));var Papa=require(_0xc8c3('0x10'));var Redis=require(_0xc8c3('0x11'));var authService=require(_0xc8c3('0x12'));var qs=require(_0xc8c3('0x13'));var as=require(_0xc8c3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8c3('0x15'))(_0xc8c3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc8c3('0x17'));var db=require(_0xc8c3('0x18'))['db'];function respondWithStatusCode(_0x29a2ba,_0x4f3757){_0x4f3757=_0x4f3757||0xcc;return function(_0x3497fd){if(_0x3497fd){return _0x29a2ba[_0xc8c3('0x19')](_0x4f3757);}return _0x29a2ba[_0xc8c3('0x1a')](_0x4f3757)[_0xc8c3('0x1b')]();};}function respondWithResult(_0x1a151e,_0x43b56f){_0x43b56f=_0x43b56f||0xc8;return function(_0xac8670){if(_0xac8670){return _0x1a151e['status'](_0x43b56f)[_0xc8c3('0x1c')](_0xac8670);}};}function respondWithFilteredResult(_0xeaeb71,_0x4c0b74){return function(_0x42b703){if(_0x42b703){var _0x1e8b47=typeof _0x4c0b74[_0xc8c3('0x1d')]===_0xc8c3('0x1e')&&typeof _0x4c0b74[_0xc8c3('0x1f')]===_0xc8c3('0x1e');var _0xbc7df9=_0x42b703[_0xc8c3('0x20')];var _0x1bfec0=_0x1e8b47?0x0:_0x4c0b74[_0xc8c3('0x1d')];var _0x4bf669=_0x1e8b47?_0x42b703['count']:_0x4c0b74[_0xc8c3('0x1d')]+_0x4c0b74[_0xc8c3('0x1f')];var _0x31f2a5;if(_0x4bf669>=_0xbc7df9){_0x4bf669=_0xbc7df9;_0x31f2a5=0xc8;}else{_0x31f2a5=0xce;}_0xeaeb71['status'](_0x31f2a5);return _0xeaeb71[_0xc8c3('0x21')](_0xc8c3('0x22'),_0x1bfec0+'-'+_0x4bf669+'/'+_0xbc7df9)[_0xc8c3('0x1c')](_0x42b703);}return null;};}function patchUpdates(_0xfcf8ea){return function(_0x5a984e){try{jsonpatch[_0xc8c3('0x23')](_0x5a984e,_0xfcf8ea,!![]);}catch(_0x1925b8){return BPromise[_0xc8c3('0x24')](_0x1925b8);}return _0x5a984e[_0xc8c3('0x25')]();};}function saveUpdates(_0x1dea53,_0x4d4d50){return function(_0x55ed4b){if(_0x55ed4b){return _0x55ed4b['update'](_0x1dea53)[_0xc8c3('0x26')](function(_0x542bc8){return _0x542bc8;});}return null;};}function removeEntity(_0x23bc30,_0x2da6f7){return function(_0x26ba44){if(_0x26ba44){return _0x26ba44[_0xc8c3('0x27')]()['then'](function(){_0x23bc30['status'](0xcc)[_0xc8c3('0x1b')]();});}};}function handleEntityNotFound(_0x384630,_0x55b825){return function(_0x45d53c){if(!_0x45d53c){_0x384630[_0xc8c3('0x19')](0x194);}return _0x45d53c;};}function handleError(_0x3037ad,_0x1512b4){_0x1512b4=_0x1512b4||0x1f4;return function(_0xfeea42){logger[_0xc8c3('0x28')](_0xfeea42[_0xc8c3('0x29')]);if(_0xfeea42[_0xc8c3('0x2a')]){delete _0xfeea42[_0xc8c3('0x2a')];}_0x3037ad[_0xc8c3('0x1a')](_0x1512b4)[_0xc8c3('0x2b')](_0xfeea42);};}exports[_0xc8c3('0x2c')]=function(_0x51f156,_0x1b7ccb){var _0x790073={},_0x452f55={},_0x1f7c2b={'count':0x0,'rows':[]};var _0x306c0d=_['map'](db['ZohoField']['rawAttributes'],function(_0x180ff3){return{'name':_0x180ff3[_0xc8c3('0x2d')],'type':_0x180ff3[_0xc8c3('0x2e')][_0xc8c3('0x2f')]};});_0x452f55[_0xc8c3('0x30')]=_[_0xc8c3('0x31')](_0x306c0d,_0xc8c3('0x2a'));_0x452f55[_0xc8c3('0x32')]=_[_0xc8c3('0x33')](_0x51f156['query']);_0x452f55[_0xc8c3('0x34')]=_[_0xc8c3('0x35')](_0x452f55[_0xc8c3('0x30')],_0x452f55[_0xc8c3('0x32')]);_0x790073['attributes']=_[_0xc8c3('0x35')](_0x452f55[_0xc8c3('0x30')],qs[_0xc8c3('0x36')](_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x36')]));_0x790073['attributes']=_0x790073['attributes'][_0xc8c3('0x37')]?_0x790073[_0xc8c3('0x38')]:_0x452f55[_0xc8c3('0x30')];if(!_0x51f156[_0xc8c3('0x32')]['hasOwnProperty']('nolimit')){_0x790073['limit']=qs[_0xc8c3('0x1f')](_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x1f')]);_0x790073[_0xc8c3('0x1d')]=qs[_0xc8c3('0x1d')](_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x1d')]);}_0x790073[_0xc8c3('0x39')]=qs['sort'](_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x3a')]);_0x790073['where']=qs[_0xc8c3('0x34')](_[_0xc8c3('0x3b')](_0x51f156[_0xc8c3('0x32')],_0x452f55[_0xc8c3('0x34')]),_0x306c0d);if(_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x3c')]){_0x790073[_0xc8c3('0x3d')]=_['merge'](_0x790073['where'],{'$or':_[_0xc8c3('0x31')](_0x306c0d,function(_0x5647c6){if(_0x5647c6[_0xc8c3('0x2e')]!==_0xc8c3('0x3e')){var _0x28ea9c={};_0x28ea9c[_0x5647c6[_0xc8c3('0x2a')]]={'$like':'%'+_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x3c')]+'%'};return _0x28ea9c;}})});}_0x790073=_[_0xc8c3('0x3f')]({},_0x790073,_0x51f156[_0xc8c3('0x40')]);var _0x2f1456={'where':_0x790073[_0xc8c3('0x3d')]};return db[_0xc8c3('0x41')]['count'](_0x2f1456)[_0xc8c3('0x26')](function(_0x3e022c){_0x1f7c2b[_0xc8c3('0x20')]=_0x3e022c;if(_0x51f156[_0xc8c3('0x32')][_0xc8c3('0x42')]){_0x790073[_0xc8c3('0x43')]=[{'all':!![]}];}return db[_0xc8c3('0x41')][_0xc8c3('0x44')](_0x790073);})[_0xc8c3('0x26')](function(_0x222014){_0x1f7c2b['rows']=_0x222014;return _0x1f7c2b;})[_0xc8c3('0x26')](respondWithFilteredResult(_0x1b7ccb,_0x790073))[_0xc8c3('0x45')](handleError(_0x1b7ccb,null));};exports[_0xc8c3('0x46')]=function(_0x124b38,_0x35c92d){var _0x1d6a7c={'raw':!![],'where':{'id':_0x124b38[_0xc8c3('0x47')]['id']}},_0x5f31a9={};_0x5f31a9[_0xc8c3('0x30')]=_['keys'](db[_0xc8c3('0x41')][_0xc8c3('0x48')]);_0x5f31a9[_0xc8c3('0x32')]=_['keys'](_0x124b38[_0xc8c3('0x32')]);_0x5f31a9[_0xc8c3('0x34')]=_['intersection'](_0x5f31a9[_0xc8c3('0x30')],_0x5f31a9[_0xc8c3('0x32')]);_0x1d6a7c[_0xc8c3('0x38')]=_[_0xc8c3('0x35')](_0x5f31a9[_0xc8c3('0x30')],qs[_0xc8c3('0x36')](_0x124b38['query'][_0xc8c3('0x36')]));_0x1d6a7c[_0xc8c3('0x38')]=_0x1d6a7c[_0xc8c3('0x38')][_0xc8c3('0x37')]?_0x1d6a7c['attributes']:_0x5f31a9[_0xc8c3('0x30')];if(_0x124b38['query'][_0xc8c3('0x42')]){_0x1d6a7c['include']=[{'all':!![]}];}_0x1d6a7c=_[_0xc8c3('0x3f')]({},_0x1d6a7c,_0x124b38[_0xc8c3('0x40')]);return db[_0xc8c3('0x41')]['find'](_0x1d6a7c)[_0xc8c3('0x26')](handleEntityNotFound(_0x35c92d,null))[_0xc8c3('0x26')](respondWithResult(_0x35c92d,null))[_0xc8c3('0x45')](handleError(_0x35c92d,null));};exports[_0xc8c3('0x49')]=function(_0x243d8f,_0x13a11d){return db[_0xc8c3('0x41')][_0xc8c3('0x49')](_0x243d8f[_0xc8c3('0x4a')],{})[_0xc8c3('0x26')](respondWithResult(_0x13a11d,0xc9))[_0xc8c3('0x45')](handleError(_0x13a11d,null));};exports['update']=function(_0x35f9d1,_0x1e46aa){if(_0x35f9d1[_0xc8c3('0x4a')]['id']){delete _0x35f9d1[_0xc8c3('0x4a')]['id'];}return db[_0xc8c3('0x41')][_0xc8c3('0x4b')]({'where':{'id':_0x35f9d1['params']['id']}})['then'](handleEntityNotFound(_0x1e46aa,null))['then'](saveUpdates(_0x35f9d1[_0xc8c3('0x4a')],null))[_0xc8c3('0x26')](respondWithResult(_0x1e46aa,null))['catch'](handleError(_0x1e46aa,null));};exports[_0xc8c3('0x27')]=function(_0x24c36d,_0x384407){return db[_0xc8c3('0x41')][_0xc8c3('0x4b')]({'where':{'id':_0x24c36d[_0xc8c3('0x47')]['id']}})[_0xc8c3('0x26')](handleEntityNotFound(_0x384407,null))[_0xc8c3('0x26')](removeEntity(_0x384407,null))[_0xc8c3('0x45')](handleError(_0x384407,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1f98a0c..a9b9422 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 _0x6050=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','zoho_unique_index','idField','FieldId','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6050,0x196));var _0x0605=function(_0x2814c8,_0x4e9211){_0x2814c8=_0x2814c8-0x0;var _0x34be58=_0x6050[_0x2814c8];return _0x34be58;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0605('0x9'),'fields':[_0x0605('0xa'),_0x0605('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x2a07,0x74));var _0x72a0=function(_0x4186fa,_0x26a01c){_0x4186fa=_0x4186fa-0x0;var _0x136990=_0x2a07[_0x4186fa];return _0x136990;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xf'),_0x72a0('0x10')],'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 e15d744..804c1d9 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 _0x0f2b=['util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x0f2b,0x1f3));var _0xb0f2=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x0f2b[_0x53b8e0];return _0x10630c;};'use strict';var _=require(_0xb0f2('0x0'));var util=require(_0xb0f2('0x1'));var moment=require(_0xb0f2('0x2'));var BPromise=require(_0xb0f2('0x3'));var rs=require(_0xb0f2('0x4'));var fs=require('fs');var Redis=require(_0xb0f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb0f2('0x6'));var config=require(_0xb0f2('0x7'));var jayson=require(_0xb0f2('0x8'));var client=jayson['client'][_0xb0f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f0bf8,_0x20d6e9,_0xbd3792){return new BPromise(function(_0x2f901b,_0x59ac8a){return client['request'](_0x1f0bf8,_0xbd3792)['then'](function(_0x1568d8){logger[_0xb0f2('0xa')](_0xb0f2('0xb'),_0x20d6e9,'request\x20sent');logger[_0xb0f2('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x20d6e9,_0xb0f2('0xd'),JSON[_0xb0f2('0xe')](_0x1568d8));if(_0x1568d8['error']){if(_0x1568d8['error'][_0xb0f2('0xf')]===0x1f4){logger[_0xb0f2('0x10')]('ZohoField,\x20%s,\x20%s',_0x20d6e9,_0x1568d8['error'][_0xb0f2('0x11')]);return _0x59ac8a(_0x1568d8[_0xb0f2('0x10')][_0xb0f2('0x11')]);}logger[_0xb0f2('0x10')](_0xb0f2('0xb'),_0x20d6e9,_0x1568d8[_0xb0f2('0x10')][_0xb0f2('0x11')]);return _0x2f901b(_0x1568d8[_0xb0f2('0x10')][_0xb0f2('0x11')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x20d6e9,_0xb0f2('0xd'));_0x2f901b(_0x1568d8[_0xb0f2('0x12')][_0xb0f2('0x11')]);}})[_0xb0f2('0x13')](function(_0xf53672){logger['error'](_0xb0f2('0xb'),_0x20d6e9,_0xf53672);_0x59ac8a(_0xf53672);});});} \ No newline at end of file +var _0x5a25=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4100c0,_0x5289f2){var _0x4df2bc=function(_0x1aaf2d){while(--_0x1aaf2d){_0x4100c0['push'](_0x4100c0['shift']());}};_0x4df2bc(++_0x5289f2);}(_0x5a25,0x159));var _0x55a2=function(_0x55738f,_0x595b6f){_0x55738f=_0x55738f-0x0;var _0x5f40b8=_0x5a25[_0x55738f];return _0x5f40b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x55a2('0x0'));var rs=require(_0x55a2('0x1'));var fs=require('fs');var Redis=require(_0x55a2('0x2'));var db=require(_0x55a2('0x3'))['db'];var utils=require(_0x55a2('0x4'));var logger=require(_0x55a2('0x5'))('rpc');var config=require(_0x55a2('0x6'));var jayson=require(_0x55a2('0x7'));var client=jayson[_0x55a2('0x8')][_0x55a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c5b74,_0x315d67,_0x4de682){return new BPromise(function(_0x158911,_0x13871c){return client['request'](_0x4c5b74,_0x4de682)[_0x55a2('0xa')](function(_0x5333f1){logger[_0x55a2('0xb')](_0x55a2('0xc'),_0x315d67,_0x55a2('0xd'));logger[_0x55a2('0xe')](_0x55a2('0xf'),_0x315d67,_0x55a2('0xd'),JSON[_0x55a2('0x10')](_0x5333f1));if(_0x5333f1['error']){if(_0x5333f1['error'][_0x55a2('0x11')]===0x1f4){logger[_0x55a2('0x12')](_0x55a2('0xc'),_0x315d67,_0x5333f1[_0x55a2('0x12')][_0x55a2('0x13')]);return _0x13871c(_0x5333f1['error'][_0x55a2('0x13')]);}logger[_0x55a2('0x12')](_0x55a2('0xc'),_0x315d67,_0x5333f1['error']['message']);return _0x158911(_0x5333f1['error'][_0x55a2('0x13')]);}else{logger['info'](_0x55a2('0xc'),_0x315d67,_0x55a2('0xd'));_0x158911(_0x5333f1[_0x55a2('0x14')][_0x55a2('0x13')]);}})['catch'](function(_0x5ce8ca){logger[_0x55a2('0x12')](_0x55a2('0xc'),_0x315d67,_0x5ce8ca);_0x13871c(_0x5ce8ca);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b0fe4fb..7e4bfd5 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x326ed8,_0x4e7b88){var _0x4dcc87=function(_0xadff40){while(--_0xadff40){_0x326ed8['push'](_0x326ed8['shift']());}};_0x4dcc87(++_0x4e7b88);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe93671,_0x4f4700){var _0x1af5f9=function(_0x360249){while(--_0x360249){_0xe93671['push'](_0xe93671['shift']());}};_0x1af5f9(++_0x4f4700);}(_0xedd9,0xfc));var _0x9edd=function(_0x11f12c,_0x1a2d09){_0x11f12c=_0x11f12c-0x0;var _0x1400eb=_0xedd9[_0x11f12c];return _0x1400eb;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1e4b526..f07e83a 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 _0xc8fc=['state','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x569505,_0x218f9b){var _0x38d6d6=function(_0x34c3c6){while(--_0x34c3c6){_0x569505['push'](_0x569505['shift']());}};_0x38d6d6(++_0x218f9b);}(_0xc8fc,0x78));var _0xcc8f=function(_0x4936d5,_0xae666f){_0x4936d5=_0x4936d5-0x0;var _0x5abe4e=_0xc8fc[_0x4936d5];return _0x5abe4e;};'use strict';var Sequelize=require('sequelize');module[_0xcc8f('0x0')]={'name':{'type':Sequelize[_0xcc8f('0x1')],'allowNull':![],'unique':_0xcc8f('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcc8f('0x2')},'main':{'type':Sequelize[_0xcc8f('0x1')],'defaultValue':_0xcc8f('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xcc8f('0x1')]},'type':{'type':Sequelize[_0xcc8f('0x1')]},'size':{'type':Sequelize[_0xcc8f('0x4')]},'active':{'type':Sequelize[_0xcc8f('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xcc8f('0x1')]},'state':{'type':Sequelize[_0xcc8f('0x1')],'unique':_0xcc8f('0x6')},'description':{'type':Sequelize[_0xcc8f('0x1')]},'title':{'type':Sequelize[_0xcc8f('0x1')]},'remoteUri':{'type':Sequelize[_0xcc8f('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xea75=['state','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x43d42a,_0x18a244){var _0x690e67=function(_0x58045c){while(--_0x58045c){_0x43d42a['push'](_0x43d42a['shift']());}};_0x690e67(++_0x18a244);}(_0xea75,0xe5));var _0x5ea7=function(_0x946a14,_0x3e466f){_0x946a14=_0x946a14-0x0;var _0x5d02d7=_0xea75[_0x946a14];return _0x5d02d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5ea7('0x0')],'allowNull':![],'unique':_0x5ea7('0x1')},'version':{'type':Sequelize[_0x5ea7('0x0')],'allowNull':![],'unique':_0x5ea7('0x1')},'main':{'type':Sequelize[_0x5ea7('0x0')],'defaultValue':_0x5ea7('0x2')},'filename':{'type':Sequelize[_0x5ea7('0x0')]},'path':{'type':Sequelize[_0x5ea7('0x0')]},'type':{'type':Sequelize[_0x5ea7('0x0')]},'size':{'type':Sequelize[_0x5ea7('0x3')]},'active':{'type':Sequelize[_0x5ea7('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x5ea7('0x0')]},'logo':{'type':Sequelize[_0x5ea7('0x0')]},'state':{'type':Sequelize[_0x5ea7('0x0')],'unique':_0x5ea7('0x5')},'description':{'type':Sequelize[_0x5ea7('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5ea7('0x0')]},'link':{'type':Sequelize[_0x5ea7('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 13019b4..7e5b160 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 _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5496,0x175));var _0x6549=function(_0x4f20c4,_0x38d30f){_0x4f20c4=_0x4f20c4-0x0;var _0x4db545=_0x5496[_0x4f20c4];return _0x4db545;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x5496,0x175));var _0x6549=function(_0x4f5ad7,_0x55f019){_0x4f5ad7=_0x4f5ad7-0x0;var _0x365c5b=_0x5496[_0x4f5ad7];return _0x365c5b;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b3ffc2d..5715bd2 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 _0x873a=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Integration','integrations','lodash'];(function(_0x2853b7,_0x4847f4){var _0x467271=function(_0x26b57e){while(--_0x26b57e){_0x2853b7['push'](_0x2853b7['shift']());}};_0x467271(++_0x4847f4);}(_0x873a,0x113));var _0xa873=function(_0x4a8ac4,_0x13d48e){_0x4a8ac4=_0x4a8ac4-0x0;var _0x1e7e12=_0x873a[_0x4a8ac4];return _0x1e7e12;};'use strict';var _=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var logger=require(_0xa873('0x2'))(_0xa873('0x3'));var moment=require(_0xa873('0x4'));var BPromise=require(_0xa873('0x5'));var rp=require(_0xa873('0x6'));var fs=require('fs');var path=require(_0xa873('0x7'));var rimraf=require('rimraf');var config=require(_0xa873('0x8'));var attributes=require('./integration.attributes');module[_0xa873('0x9')]=function(_0x974f7e,_0x2e45d0){return _0x974f7e['define'](_0xa873('0xa'),attributes,{'tableName':_0xa873('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e8d=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5e82a2,_0x46a18f){var _0x41eb55=function(_0x421558){while(--_0x421558){_0x5e82a2['push'](_0x5e82a2['shift']());}};_0x41eb55(++_0x46a18f);}(_0x4e8d,0x10f));var _0xd4e8=function(_0x494217,_0x499db3){_0x494217=_0x494217-0x0;var _0x2980b4=_0x4e8d[_0x494217];return _0x2980b4;};'use strict';var _=require(_0xd4e8('0x0'));var util=require(_0xd4e8('0x1'));var logger=require(_0xd4e8('0x2'))(_0xd4e8('0x3'));var moment=require(_0xd4e8('0x4'));var BPromise=require(_0xd4e8('0x5'));var rp=require(_0xd4e8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd4e8('0x7'));var config=require(_0xd4e8('0x8'));var attributes=require(_0xd4e8('0x9'));module[_0xd4e8('0xa')]=function(_0x4f85c0,_0x4be705){return _0x4f85c0[_0xd4e8('0xb')](_0xd4e8('0xc'),attributes,{'tableName':_0xd4e8('0xd'),'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 421c872..f1c448c 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3f4cc1,_0x56b92b){var _0x57d476=function(_0x369f3b){while(--_0x369f3b){_0x3f4cc1['push'](_0x3f4cc1['shift']());}};_0x57d476(++_0x56b92b);}(_0x2542,0x169));var _0x2254=function(_0x12c026,_0x42aaf4){_0x12c026=_0x12c026-0x0;var _0x5737a8=_0x2542[_0x12c026];return _0x5737a8;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x310d08,_0x52b280){var _0x305029=function(_0x3d9729){while(--_0x3d9729){_0x310d08['push'](_0x310d08['shift']());}};_0x305029(++_0x52b280);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 60931dd..d5a44d5 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x21e8ec,_0x2aa0ad){var _0x5028f5=function(_0x24d88){while(--_0x24d88){_0x21e8ec['push'](_0x21e8ec['shift']());}};_0x5028f5(++_0x2aa0ad);}(_0x2ef3,0xba));var _0x32ef=function(_0x5150ba,_0x24094a){_0x5150ba=_0x5150ba-0x0;var _0x597057=_0x2ef3[_0x5150ba];return _0x597057;};'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('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x4f6344,_0xfcf32b){var _0x3a7cb3=function(_0x4c76f1){while(--_0x4c76f1){_0x4f6344['push'](_0x4f6344['shift']());}};_0x3a7cb3(++_0xfcf32b);}(_0x524e,0x15e));var _0xe524=function(_0xd4a7ce,_0x249b0d){_0xd4a7ce=_0xd4a7ce-0x0;var _0x1ed22c=_0x524e[_0xd4a7ce];return _0x1ed22c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index bd067f7..ee5d8e3 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 _0xc81e=['SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x332c9a,_0x5de27d){var _0x26973c=function(_0x223037){while(--_0x223037){_0x332c9a['push'](_0x332c9a['shift']());}};_0x26973c(++_0x5de27d);}(_0xc81e,0xca));var _0xec81=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xc81e[_0x7feb90];return _0x3c5b33;};'use strict';var Sequelize=require('sequelize');module[_0xec81('0x0')]={'integration':{'type':Sequelize[_0xec81('0x1')]},'eventChannel':{'type':Sequelize[_0xec81('0x1')]},'exitStatus':{'type':Sequelize[_0xec81('0x1')]},'ticketId':{'type':Sequelize[_0xec81('0x1')]},'integrationId':{'type':Sequelize[_0xec81('0x2')]},'contacts':{'type':Sequelize[_0xec81('0x1')]},'uniqueid':{'type':Sequelize[_0xec81('0x1')]},'calleridnum':{'type':Sequelize[_0xec81('0x1')]},'calleridname':{'type':Sequelize[_0xec81('0x1')]},'queue':{'type':Sequelize[_0xec81('0x1')]},'interface':{'type':Sequelize[_0xec81('0x1')]},'membername':{'type':Sequelize[_0xec81('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xec81('0x3')]},'holdtime':{'type':Sequelize[_0xec81('0x2')]},'agentcomplete':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xec81('0x3')]},'talktime':{'type':Sequelize[_0xec81('0x2')]},'agentacw':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xec81('0x2')]},'reason':{'type':Sequelize[_0xec81('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xec81('0x3')]},'agentdump':{'type':Sequelize[_0xec81('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xec81('0x1')]},'channel':{'type':Sequelize[_0xec81('0x1')]},'channelstate':{'type':Sequelize[_0xec81('0x2')]},'channelstatedesc':{'type':Sequelize[_0xec81('0x1')]},'connectedlinenum':{'type':Sequelize[_0xec81('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xec81('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xec81('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xec81('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xec81('0x1')]},'destcalleridnum':{'type':Sequelize[_0xec81('0x1')]},'destcalleridname':{'type':Sequelize[_0xec81('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xec81('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xec81('0x1')]},'destlanguage':{'type':Sequelize[_0xec81('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xec81('0x1')]},'destexten':{'type':Sequelize[_0xec81('0x1')]},'destpriority':{'type':Sequelize[_0xec81('0x1')]},'destuniqueid':{'type':Sequelize[_0xec81('0x1')]},'messageId':{'type':Sequelize[_0xec81('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xec81('0x1')]},'from':{'type':Sequelize[_0xec81('0x1')]},'to':{'type':Sequelize[_0xec81('0x1')]},'cc':{'type':Sequelize[_0xec81('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xec81('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xec81('0x6')](_0xec81('0x7'),_0xec81('0x8'),_0xec81('0x9'),_0xec81('0xa'))},'url':{'type':Sequelize[_0xec81('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xec81('0x1')]},'projectId':{'type':Sequelize[_0xec81('0x2')]}}; \ No newline at end of file +var _0x01c9=['TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x181d19,_0x46822d){var _0x227c31=function(_0x6cf3fa){while(--_0x6cf3fa){_0x181d19['push'](_0x181d19['shift']());}};_0x227c31(++_0x46822d);}(_0x01c9,0x170));var _0x901c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x01c9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x901c('0x0'));module[_0x901c('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x901c('0x2')]},'exitStatus':{'type':Sequelize[_0x901c('0x2')]},'ticketId':{'type':Sequelize[_0x901c('0x2')]},'integrationId':{'type':Sequelize[_0x901c('0x3')]},'contacts':{'type':Sequelize[_0x901c('0x2')]},'uniqueid':{'type':Sequelize[_0x901c('0x2')]},'calleridnum':{'type':Sequelize[_0x901c('0x2')]},'calleridname':{'type':Sequelize[_0x901c('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x901c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x901c('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x901c('0x3')]},'agentcomplete':{'type':Sequelize[_0x901c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x901c('0x3')]},'agentacw':{'type':Sequelize[_0x901c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x901c('0x3')]},'reason':{'type':Sequelize[_0x901c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x901c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x901c('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x901c('0x4')]},'lastevent':{'type':Sequelize[_0x901c('0x2')]},'channel':{'type':Sequelize[_0x901c('0x2')]},'channelstate':{'type':Sequelize[_0x901c('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x901c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x901c('0x2')]},'accountcode':{'type':Sequelize[_0x901c('0x2')]},'context':{'type':Sequelize[_0x901c('0x2')]},'exten':{'type':Sequelize[_0x901c('0x2')]},'priority':{'type':Sequelize[_0x901c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x901c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x901c('0x2')]},'destcalleridname':{'type':Sequelize[_0x901c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x901c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x901c('0x2')]},'destlanguage':{'type':Sequelize[_0x901c('0x2')]},'destaccountcode':{'type':Sequelize[_0x901c('0x2')]},'destcontext':{'type':Sequelize[_0x901c('0x2')]},'destexten':{'type':Sequelize[_0x901c('0x2')]},'destpriority':{'type':Sequelize[_0x901c('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x901c('0x2')]},'inReplyTo':{'type':Sequelize[_0x901c('0x2')]},'subject':{'type':Sequelize[_0x901c('0x2')]},'from':{'type':Sequelize[_0x901c('0x2')]},'to':{'type':Sequelize[_0x901c('0x2')]},'cc':{'type':Sequelize[_0x901c('0x2')]},'attachment':{'type':Sequelize[_0x901c('0x6')]},'html':{'type':Sequelize[_0x901c('0x6')]},'text':{'type':Sequelize[_0x901c('0x6')]},'status':{'type':Sequelize['ENUM'](_0x901c('0x7'),_0x901c('0x8'),_0x901c('0x9'),_0x901c('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x901c('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 80f1ac4..0d6b753 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 _0x9f73=['filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','limit','count','status','set','update','then','destroy','sendStatus','error','send','index','map','IntegrationReport','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9f73,0x132));var _0x39f7=function(_0x1b9e5a,_0x278990){_0x1b9e5a=_0x1b9e5a-0x0;var _0x596038=_0x9f73[_0x1b9e5a];return _0x596038;};'use strict';var emlformat=require(_0x39f7('0x0'));var rimraf=require(_0x39f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39f7('0x2'));var rp=require(_0x39f7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x39f7('0x4'));var util=require(_0x39f7('0x5'));var path=require(_0x39f7('0x6'));var sox=require(_0x39f7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39f7('0x8'));var _=require(_0x39f7('0x9'));var squel=require(_0x39f7('0xa'));var crypto=require('crypto');var jsforce=require(_0x39f7('0xb'));var deskjs=require(_0x39f7('0xc'));var toCsv=require(_0x39f7('0xd'));var querystring=require(_0x39f7('0xe'));var Papa=require('papaparse');var Redis=require(_0x39f7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x39f7('0x10'));var as=require(_0x39f7('0x11'));var hardwareService=require(_0x39f7('0x12'));var logger=require(_0x39f7('0x13'))(_0x39f7('0x14'));var utils=require(_0x39f7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x39f7('0x16'));var db=require(_0x39f7('0x17'))['db'];function respondWithStatusCode(_0x1b69ad,_0xd82f6e){_0xd82f6e=_0xd82f6e||0xcc;return function(_0x14c20d){if(_0x14c20d){return _0x1b69ad['sendStatus'](_0xd82f6e);}return _0x1b69ad['status'](_0xd82f6e)[_0x39f7('0x18')]();};}function respondWithResult(_0x356229,_0x1616ad){_0x1616ad=_0x1616ad||0xc8;return function(_0x24fc15){if(_0x24fc15){return _0x356229['status'](_0x1616ad)[_0x39f7('0x19')](_0x24fc15);}};}function respondWithFilteredResult(_0x2fe2e0,_0x33930e){return function(_0x10e5b1){if(_0x10e5b1){var _0x4fb2c3=typeof _0x33930e[_0x39f7('0x1a')]==='undefined'&&typeof _0x33930e[_0x39f7('0x1b')]==='undefined';var _0x484569=_0x10e5b1['count'];var _0x5035fa=_0x4fb2c3?0x0:_0x33930e['offset'];var _0x7d5d48=_0x4fb2c3?_0x10e5b1[_0x39f7('0x1c')]:_0x33930e[_0x39f7('0x1a')]+_0x33930e[_0x39f7('0x1b')];var _0x38b8df;if(_0x7d5d48>=_0x484569){_0x7d5d48=_0x484569;_0x38b8df=0xc8;}else{_0x38b8df=0xce;}_0x2fe2e0[_0x39f7('0x1d')](_0x38b8df);return _0x2fe2e0[_0x39f7('0x1e')]('Content-Range',_0x5035fa+'-'+_0x7d5d48+'/'+_0x484569)['json'](_0x10e5b1);}return null;};}function patchUpdates(_0xf596e7){return function(_0x577d1f){try{jsonpatch['apply'](_0x577d1f,_0xf596e7,!![]);}catch(_0x309ccf){return BPromise['reject'](_0x309ccf);}return _0x577d1f['save']();};}function saveUpdates(_0x414fc4,_0x500c8b){return function(_0x4f09cc){if(_0x4f09cc){return _0x4f09cc[_0x39f7('0x1f')](_0x414fc4)[_0x39f7('0x20')](function(_0x2ad285){return _0x2ad285;});}return null;};}function removeEntity(_0x1edb2f,_0x423de9){return function(_0x52994d){if(_0x52994d){return _0x52994d[_0x39f7('0x21')]()['then'](function(){_0x1edb2f[_0x39f7('0x1d')](0xcc)[_0x39f7('0x18')]();});}};}function handleEntityNotFound(_0x1f1fbd,_0x15bf1b){return function(_0x3396d7){if(!_0x3396d7){_0x1f1fbd[_0x39f7('0x22')](0x194);}return _0x3396d7;};}function handleError(_0xccd9e1,_0x4989ef){_0x4989ef=_0x4989ef||0x1f4;return function(_0x1ce6f3){logger[_0x39f7('0x23')](_0x1ce6f3['stack']);if(_0x1ce6f3['name']){delete _0x1ce6f3['name'];}_0xccd9e1[_0x39f7('0x1d')](_0x4989ef)[_0x39f7('0x24')](_0x1ce6f3);};}exports[_0x39f7('0x25')]=function(_0x34564c,_0x91df39){var _0x5ae41e={},_0x46d6ab={},_0x84aa4a={'count':0x0,'rows':[]};var _0x1cd9b8=_[_0x39f7('0x26')](db[_0x39f7('0x27')]['rawAttributes'],function(_0x4c5b68){return{'name':_0x4c5b68['fieldName'],'type':_0x4c5b68[_0x39f7('0x28')][_0x39f7('0x29')]};});_0x46d6ab[_0x39f7('0x2a')]=_[_0x39f7('0x26')](_0x1cd9b8,_0x39f7('0x2b'));_0x46d6ab['query']=_[_0x39f7('0x2c')](_0x34564c[_0x39f7('0x2d')]);_0x46d6ab['filters']=_[_0x39f7('0x2e')](_0x46d6ab[_0x39f7('0x2a')],_0x46d6ab[_0x39f7('0x2d')]);_0x5ae41e[_0x39f7('0x2f')]=_[_0x39f7('0x2e')](_0x46d6ab[_0x39f7('0x2a')],qs[_0x39f7('0x30')](_0x34564c['query'][_0x39f7('0x30')]));_0x5ae41e[_0x39f7('0x2f')]=_0x5ae41e[_0x39f7('0x2f')][_0x39f7('0x31')]?_0x5ae41e['attributes']:_0x46d6ab[_0x39f7('0x2a')];if(!_0x34564c['query'][_0x39f7('0x32')](_0x39f7('0x33'))){_0x5ae41e[_0x39f7('0x1b')]=qs['limit'](_0x34564c['query']['limit']);_0x5ae41e[_0x39f7('0x1a')]=qs[_0x39f7('0x1a')](_0x34564c[_0x39f7('0x2d')][_0x39f7('0x1a')]);}_0x5ae41e[_0x39f7('0x34')]=qs[_0x39f7('0x35')](_0x34564c[_0x39f7('0x2d')][_0x39f7('0x35')]);_0x5ae41e['where']=qs[_0x39f7('0x36')](_[_0x39f7('0x37')](_0x34564c['query'],_0x46d6ab[_0x39f7('0x36')]),_0x1cd9b8);if(_0x34564c[_0x39f7('0x2d')]['filter']){_0x5ae41e['where']=_[_0x39f7('0x38')](_0x5ae41e[_0x39f7('0x39')],{'$or':_[_0x39f7('0x26')](_0x1cd9b8,function(_0xe62bf7){if(_0xe62bf7[_0x39f7('0x28')]!==_0x39f7('0x3a')){var _0x489ba9={};_0x489ba9[_0xe62bf7[_0x39f7('0x2b')]]={'$like':'%'+_0x34564c[_0x39f7('0x2d')][_0x39f7('0x3b')]+'%'};return _0x489ba9;}})});}_0x5ae41e=_[_0x39f7('0x38')]({},_0x5ae41e,_0x34564c[_0x39f7('0x3c')]);var _0x36fa8c={'where':_0x5ae41e['where']};return db[_0x39f7('0x27')][_0x39f7('0x1c')](_0x36fa8c)[_0x39f7('0x20')](function(_0x3642a7){_0x84aa4a[_0x39f7('0x1c')]=_0x3642a7;if(_0x34564c[_0x39f7('0x2d')][_0x39f7('0x3d')]){_0x5ae41e[_0x39f7('0x3e')]=[{'all':!![]}];}return db[_0x39f7('0x27')][_0x39f7('0x3f')](_0x5ae41e);})['then'](function(_0x5c097f){_0x84aa4a['rows']=_0x5c097f;return _0x84aa4a;})[_0x39f7('0x20')](respondWithFilteredResult(_0x91df39,_0x5ae41e))[_0x39f7('0x40')](handleError(_0x91df39,null));};exports[_0x39f7('0x41')]=function(_0x40f36a,_0x4f28ab){var _0x567621={'raw':![],'where':{'id':_0x40f36a[_0x39f7('0x42')]['id']}},_0x414991={};_0x414991[_0x39f7('0x2a')]=_[_0x39f7('0x2c')](db['IntegrationReport'][_0x39f7('0x43')]);_0x414991[_0x39f7('0x2d')]=_['keys'](_0x40f36a[_0x39f7('0x2d')]);_0x414991[_0x39f7('0x36')]=_[_0x39f7('0x2e')](_0x414991[_0x39f7('0x2a')],_0x414991[_0x39f7('0x2d')]);_0x567621['attributes']=_['intersection'](_0x414991[_0x39f7('0x2a')],qs[_0x39f7('0x30')](_0x40f36a['query']['fields']));_0x567621[_0x39f7('0x2f')]=_0x567621[_0x39f7('0x2f')][_0x39f7('0x31')]?_0x567621[_0x39f7('0x2f')]:_0x414991[_0x39f7('0x2a')];if(_0x40f36a[_0x39f7('0x2d')][_0x39f7('0x3d')]){_0x567621[_0x39f7('0x3e')]=[{'all':!![]}];}_0x567621=_[_0x39f7('0x38')]({},_0x567621,_0x40f36a[_0x39f7('0x3c')]);return db['IntegrationReport'][_0x39f7('0x44')](_0x567621)[_0x39f7('0x20')](handleEntityNotFound(_0x4f28ab,null))['then'](respondWithResult(_0x4f28ab,null))['catch'](handleError(_0x4f28ab,null));};exports['create']=function(_0x422835,_0xd8c2dc){return db[_0x39f7('0x27')][_0x39f7('0x45')](_0x422835[_0x39f7('0x46')],{})[_0x39f7('0x20')](respondWithResult(_0xd8c2dc,0xc9))[_0x39f7('0x40')](handleError(_0xd8c2dc,null));};exports[_0x39f7('0x1f')]=function(_0xba1157,_0x2d5e81){if(_0xba1157['body']['id']){delete _0xba1157['body']['id'];}return db[_0x39f7('0x27')][_0x39f7('0x44')]({'where':{'id':_0xba1157[_0x39f7('0x42')]['id']}})[_0x39f7('0x20')](handleEntityNotFound(_0x2d5e81,null))['then'](saveUpdates(_0xba1157[_0x39f7('0x46')],null))[_0x39f7('0x20')](respondWithResult(_0x2d5e81,null))[_0x39f7('0x40')](handleError(_0x2d5e81,null));};exports[_0x39f7('0x21')]=function(_0x41af86,_0x95fdb6){return db[_0x39f7('0x27')][_0x39f7('0x44')]({'where':{'id':_0x41af86[_0x39f7('0x42')]['id']}})['then'](handleEntityNotFound(_0x95fdb6,null))['then'](removeEntity(_0x95fdb6,null))[_0x39f7('0x40')](handleError(_0x95fdb6,null));};exports[_0x39f7('0x47')]=function(_0x533773,_0x44d0d2){return db[_0x39f7('0x27')]['describe']()[_0x39f7('0x20')](respondWithResult(_0x44d0d2,null))[_0x39f7('0x40')](handleError(_0x44d0d2,null));}; \ No newline at end of file +var _0xb5da=['crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','eml-format','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel'];(function(_0x4601a7,_0x5edef5){var _0x87d4fc=function(_0x469dc2){while(--_0x469dc2){_0x4601a7['push'](_0x4601a7['shift']());}};_0x87d4fc(++_0x5edef5);}(_0xb5da,0x1ef));var _0xab5d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb5da[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xab5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab5d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab5d('0x2'));var Mustache=require(_0xab5d('0x3'));var util=require(_0xab5d('0x4'));var path=require('path');var sox=require(_0xab5d('0x5'));var csv=require(_0xab5d('0x6'));var ejs=require(_0xab5d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab5d('0x8'));var crypto=require(_0xab5d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xab5d('0x6'));var querystring=require(_0xab5d('0xa'));var Papa=require(_0xab5d('0xb'));var Redis=require(_0xab5d('0xc'));var authService=require(_0xab5d('0xd'));var qs=require(_0xab5d('0xe'));var as=require(_0xab5d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab5d('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xab5d('0x11'));var licenseUtil=require(_0xab5d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c29a1,_0x40157f){_0x40157f=_0x40157f||0xcc;return function(_0xa44708){if(_0xa44708){return _0x3c29a1[_0xab5d('0x13')](_0x40157f);}return _0x3c29a1[_0xab5d('0x14')](_0x40157f)[_0xab5d('0x15')]();};}function respondWithResult(_0x21069f,_0x53356c){_0x53356c=_0x53356c||0xc8;return function(_0x1bfcd5){if(_0x1bfcd5){return _0x21069f['status'](_0x53356c)['json'](_0x1bfcd5);}};}function respondWithFilteredResult(_0x1490cd,_0x5aa747){return function(_0x67f49a){if(_0x67f49a){var _0x58dc16=typeof _0x5aa747[_0xab5d('0x16')]===_0xab5d('0x17')&&typeof _0x5aa747[_0xab5d('0x18')]===_0xab5d('0x17');var _0x1c74b9=_0x67f49a[_0xab5d('0x19')];var _0x582901=_0x58dc16?0x0:_0x5aa747[_0xab5d('0x16')];var _0x32e5f7=_0x58dc16?_0x67f49a[_0xab5d('0x19')]:_0x5aa747[_0xab5d('0x16')]+_0x5aa747[_0xab5d('0x18')];var _0x48a28e;if(_0x32e5f7>=_0x1c74b9){_0x32e5f7=_0x1c74b9;_0x48a28e=0xc8;}else{_0x48a28e=0xce;}_0x1490cd[_0xab5d('0x14')](_0x48a28e);return _0x1490cd[_0xab5d('0x1a')](_0xab5d('0x1b'),_0x582901+'-'+_0x32e5f7+'/'+_0x1c74b9)[_0xab5d('0x1c')](_0x67f49a);}return null;};}function patchUpdates(_0x155023){return function(_0x58b291){try{jsonpatch['apply'](_0x58b291,_0x155023,!![]);}catch(_0x562167){return BPromise['reject'](_0x562167);}return _0x58b291[_0xab5d('0x1d')]();};}function saveUpdates(_0x2ee38a,_0x11bc54){return function(_0x162c3c){if(_0x162c3c){return _0x162c3c['update'](_0x2ee38a)[_0xab5d('0x1e')](function(_0x251173){return _0x251173;});}return null;};}function removeEntity(_0x550c9a,_0x69e688){return function(_0x21e719){if(_0x21e719){return _0x21e719[_0xab5d('0x1f')]()[_0xab5d('0x1e')](function(){_0x550c9a[_0xab5d('0x14')](0xcc)[_0xab5d('0x15')]();});}};}function handleEntityNotFound(_0x931824,_0x3d9b5e){return function(_0x8e60ac){if(!_0x8e60ac){_0x931824['sendStatus'](0x194);}return _0x8e60ac;};}function handleError(_0x4cc479,_0x3ddc12){_0x3ddc12=_0x3ddc12||0x1f4;return function(_0x2d3525){logger[_0xab5d('0x20')](_0x2d3525[_0xab5d('0x21')]);if(_0x2d3525[_0xab5d('0x22')]){delete _0x2d3525[_0xab5d('0x22')];}_0x4cc479['status'](_0x3ddc12)[_0xab5d('0x23')](_0x2d3525);};}exports[_0xab5d('0x24')]=function(_0x4c3095,_0x57cacf){var _0x55f1f4={},_0x482e71={},_0x38b02b={'count':0x0,'rows':[]};var _0x2b89ec=_['map'](db[_0xab5d('0x25')][_0xab5d('0x26')],function(_0x598fdb){return{'name':_0x598fdb[_0xab5d('0x27')],'type':_0x598fdb[_0xab5d('0x28')][_0xab5d('0x29')]};});_0x482e71[_0xab5d('0x2a')]=_[_0xab5d('0x2b')](_0x2b89ec,_0xab5d('0x22'));_0x482e71[_0xab5d('0x2c')]=_[_0xab5d('0x2d')](_0x4c3095[_0xab5d('0x2c')]);_0x482e71[_0xab5d('0x2e')]=_[_0xab5d('0x2f')](_0x482e71[_0xab5d('0x2a')],_0x482e71['query']);_0x55f1f4[_0xab5d('0x30')]=_[_0xab5d('0x2f')](_0x482e71[_0xab5d('0x2a')],qs[_0xab5d('0x31')](_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x31')]));_0x55f1f4[_0xab5d('0x30')]=_0x55f1f4[_0xab5d('0x30')][_0xab5d('0x32')]?_0x55f1f4[_0xab5d('0x30')]:_0x482e71['model'];if(!_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x33')](_0xab5d('0x34'))){_0x55f1f4['limit']=qs['limit'](_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x18')]);_0x55f1f4[_0xab5d('0x16')]=qs[_0xab5d('0x16')](_0x4c3095[_0xab5d('0x2c')]['offset']);}_0x55f1f4['order']=qs[_0xab5d('0x35')](_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x35')]);_0x55f1f4[_0xab5d('0x36')]=qs[_0xab5d('0x2e')](_[_0xab5d('0x37')](_0x4c3095[_0xab5d('0x2c')],_0x482e71[_0xab5d('0x2e')]),_0x2b89ec);if(_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x38')]){_0x55f1f4[_0xab5d('0x36')]=_['merge'](_0x55f1f4['where'],{'$or':_['map'](_0x2b89ec,function(_0x1fa60e){if(_0x1fa60e[_0xab5d('0x28')]!==_0xab5d('0x39')){var _0x871a8d={};_0x871a8d[_0x1fa60e[_0xab5d('0x22')]]={'$like':'%'+_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x38')]+'%'};return _0x871a8d;}})});}_0x55f1f4=_[_0xab5d('0x3a')]({},_0x55f1f4,_0x4c3095[_0xab5d('0x3b')]);var _0x530b71={'where':_0x55f1f4[_0xab5d('0x36')]};return db[_0xab5d('0x25')][_0xab5d('0x19')](_0x530b71)[_0xab5d('0x1e')](function(_0x48cede){_0x38b02b[_0xab5d('0x19')]=_0x48cede;if(_0x4c3095[_0xab5d('0x2c')][_0xab5d('0x3c')]){_0x55f1f4[_0xab5d('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0xab5d('0x3e')](_0x55f1f4);})['then'](function(_0x4e2490){_0x38b02b[_0xab5d('0x3f')]=_0x4e2490;return _0x38b02b;})[_0xab5d('0x1e')](respondWithFilteredResult(_0x57cacf,_0x55f1f4))['catch'](handleError(_0x57cacf,null));};exports[_0xab5d('0x40')]=function(_0x342592,_0x2f9332){var _0x2552a8={'raw':![],'where':{'id':_0x342592[_0xab5d('0x41')]['id']}},_0x4a348c={};_0x4a348c['model']=_[_0xab5d('0x2d')](db[_0xab5d('0x25')][_0xab5d('0x26')]);_0x4a348c[_0xab5d('0x2c')]=_[_0xab5d('0x2d')](_0x342592['query']);_0x4a348c[_0xab5d('0x2e')]=_[_0xab5d('0x2f')](_0x4a348c['model'],_0x4a348c[_0xab5d('0x2c')]);_0x2552a8[_0xab5d('0x30')]=_[_0xab5d('0x2f')](_0x4a348c[_0xab5d('0x2a')],qs[_0xab5d('0x31')](_0x342592[_0xab5d('0x2c')][_0xab5d('0x31')]));_0x2552a8['attributes']=_0x2552a8[_0xab5d('0x30')][_0xab5d('0x32')]?_0x2552a8[_0xab5d('0x30')]:_0x4a348c[_0xab5d('0x2a')];if(_0x342592[_0xab5d('0x2c')]['includeAll']){_0x2552a8[_0xab5d('0x3d')]=[{'all':!![]}];}_0x2552a8=_[_0xab5d('0x3a')]({},_0x2552a8,_0x342592[_0xab5d('0x3b')]);return db[_0xab5d('0x25')][_0xab5d('0x42')](_0x2552a8)[_0xab5d('0x1e')](handleEntityNotFound(_0x2f9332,null))[_0xab5d('0x1e')](respondWithResult(_0x2f9332,null))[_0xab5d('0x43')](handleError(_0x2f9332,null));};exports['create']=function(_0x80bcbd,_0x16a680){return db[_0xab5d('0x25')][_0xab5d('0x44')](_0x80bcbd[_0xab5d('0x45')],{})[_0xab5d('0x1e')](respondWithResult(_0x16a680,0xc9))[_0xab5d('0x43')](handleError(_0x16a680,null));};exports[_0xab5d('0x46')]=function(_0x2d57ca,_0x49ec48){if(_0x2d57ca[_0xab5d('0x45')]['id']){delete _0x2d57ca[_0xab5d('0x45')]['id'];}return db[_0xab5d('0x25')][_0xab5d('0x42')]({'where':{'id':_0x2d57ca['params']['id']}})[_0xab5d('0x1e')](handleEntityNotFound(_0x49ec48,null))[_0xab5d('0x1e')](saveUpdates(_0x2d57ca[_0xab5d('0x45')],null))['then'](respondWithResult(_0x49ec48,null))['catch'](handleError(_0x49ec48,null));};exports[_0xab5d('0x1f')]=function(_0x16f484,_0x73549a){return db[_0xab5d('0x25')]['find']({'where':{'id':_0x16f484[_0xab5d('0x41')]['id']}})[_0xab5d('0x1e')](handleEntityNotFound(_0x73549a,null))[_0xab5d('0x1e')](removeEntity(_0x73549a,null))['catch'](handleError(_0x73549a,null));};exports[_0xab5d('0x47')]=function(_0x148cf3,_0x592d52){return db[_0xab5d('0x25')][_0xab5d('0x47')]()[_0xab5d('0x1e')](respondWithResult(_0x592d52,null))['catch'](handleError(_0x592d52,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3a09eed..37a0bea 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 _0x1534=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash'];(function(_0x360ea1,_0x16249a){var _0x4ce845=function(_0x4a5a9a){while(--_0x4a5a9a){_0x360ea1['push'](_0x360ea1['shift']());}};_0x4ce845(++_0x16249a);}(_0x1534,0xb3));var _0x4153=function(_0x5cfce3,_0x326c9b){_0x5cfce3=_0x5cfce3-0x0;var _0x5bc798=_0x1534[_0x5cfce3];return _0x5bc798;};'use strict';var _=require(_0x4153('0x0'));var util=require(_0x4153('0x1'));var logger=require(_0x4153('0x2'))('api');var moment=require(_0x4153('0x3'));var BPromise=require(_0x4153('0x4'));var rp=require(_0x4153('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4153('0x6'));var config=require(_0x4153('0x7'));var attributes=require(_0x4153('0x8'));module[_0x4153('0x9')]=function(_0x44592c,_0x60074f){return _0x44592c[_0x4153('0xa')]('IntegrationReport',attributes,{'tableName':_0x4153('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1dd=['request-promise','path','../../config/environment','./integrationReport.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x1880e7,_0x266ea3){var _0x5d40b4=function(_0x56912a){while(--_0x56912a){_0x1880e7['push'](_0x1880e7['shift']());}};_0x5d40b4(++_0x266ea3);}(_0xe1dd,0xaf));var _0xde1d=function(_0x26a295,_0x66183a){_0x26a295=_0x26a295-0x0;var _0x2d5436=_0xe1dd[_0x26a295];return _0x2d5436;};'use strict';var _=require(_0xde1d('0x0'));var util=require(_0xde1d('0x1'));var logger=require(_0xde1d('0x2'))(_0xde1d('0x3'));var moment=require(_0xde1d('0x4'));var BPromise=require('bluebird');var rp=require(_0xde1d('0x5'));var fs=require('fs');var path=require(_0xde1d('0x6'));var rimraf=require('rimraf');var config=require(_0xde1d('0x7'));var attributes=require(_0xde1d('0x8'));module['exports']=function(_0x576732,_0x4b88b8){return _0x576732[_0xde1d('0x9')]('IntegrationReport',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 1129c0c..517c280 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 _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20b943,_0x4f6465){var _0x240006=function(_0x24e3cc){while(--_0x24e3cc){_0x20b943['push'](_0x20b943['shift']());}};_0x240006(++_0x4f6465);}(_0x326f,0xd1));var _0xf326=function(_0x2395ce,_0x14a9f8){_0x2395ce=_0x2395ce-0x0;var _0x13eed1=_0x326f[_0x2395ce];return _0x13eed1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0xf494,0x1c6));var _0x4f49=function(_0x1ec737,_0x4a36f0){_0x1ec737=_0x1ec737-0x0;var _0x2cf24a=_0xf494[_0x1ec737];return _0x2cf24a;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9fb0034..faffc0c 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 _0x9a96=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports'];(function(_0x5bb31e,_0x30ceb9){var _0x24c927=function(_0x1e2a96){while(--_0x1e2a96){_0x5bb31e['push'](_0x5bb31e['shift']());}};_0x24c927(++_0x30ceb9);}(_0x9a96,0xd0));var _0x69a9=function(_0x53ffac,_0x2fc915){_0x53ffac=_0x53ffac-0x0;var _0x4306da=_0x9a96[_0x53ffac];return _0x4306da;};'use strict';var multer=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var path=require(_0x69a9('0x2'));var timeout=require(_0x69a9('0x3'));var express=require(_0x69a9('0x4'));var router=express[_0x69a9('0x5')]();var fs_extra=require(_0x69a9('0x6'));var auth=require(_0x69a9('0x7'));var interaction=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var controller=require(_0x69a9('0xa'));router[_0x69a9('0xb')]('/',auth['isAuthenticated'](),controller[_0x69a9('0xc')]);router[_0x69a9('0xb')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['show']);router[_0x69a9('0xb')](_0x69a9('0xf'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x10')]);router[_0x69a9('0x11')]('/',auth[_0x69a9('0xe')](),controller[_0x69a9('0x12')]);router['post'](_0x69a9('0xf'),auth['isAuthenticated'](),controller[_0x69a9('0x13')]);router[_0x69a9('0x11')](_0x69a9('0x14'),auth['isAuthenticated'](),controller[_0x69a9('0x15')]);router[_0x69a9('0x16')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x17')]);router[_0x69a9('0x18')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller['destroy']);module[_0x69a9('0x19')]=router; \ No newline at end of file +var _0xd8a5=['./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x400672,_0x243a7e){var _0x27ed65=function(_0x350ca9){while(--_0x350ca9){_0x400672['push'](_0x400672['shift']());}};_0x27ed65(++_0x243a7e);}(_0xd8a5,0x160));var _0x5d8a=function(_0x54b50d,_0x75ea63){_0x54b50d=_0x54b50d-0x0;var _0x178021=_0xd8a5[_0x54b50d];return _0x178021;};'use strict';var multer=require(_0x5d8a('0x0'));var util=require('util');var path=require(_0x5d8a('0x1'));var timeout=require(_0x5d8a('0x2'));var express=require('express');var router=express[_0x5d8a('0x3')]();var fs_extra=require(_0x5d8a('0x4'));var auth=require(_0x5d8a('0x5'));var interaction=require(_0x5d8a('0x6'));var config=require(_0x5d8a('0x7'));var controller=require(_0x5d8a('0x8'));router[_0x5d8a('0x9')]('/',auth[_0x5d8a('0xa')](),controller[_0x5d8a('0xb')]);router[_0x5d8a('0x9')](_0x5d8a('0xc'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0xd')]);router['get'](_0x5d8a('0xe'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0xf')]);router[_0x5d8a('0x10')]('/',auth[_0x5d8a('0xa')](),controller['create']);router[_0x5d8a('0x10')](_0x5d8a('0xe'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0x11')]);router['post'](_0x5d8a('0x12'),auth[_0x5d8a('0xa')](),controller['addIntervals']);router[_0x5d8a('0x13')](_0x5d8a('0xc'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0x14')]);router[_0x5d8a('0x15')](_0x5d8a('0xc'),auth[_0x5d8a('0xa')](),controller[_0x5d8a('0x16')]);module[_0x5d8a('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d7b9b82..ad122e2 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 _0x58ed=['exports','STRING'];(function(_0x4f17b3,_0x348196){var _0x4f5726=function(_0x1a9d0c){while(--_0x1a9d0c){_0x4f17b3['push'](_0x4f17b3['shift']());}};_0x4f5726(++_0x348196);}(_0x58ed,0x18c));var _0xd58e=function(_0xb783f0,_0x2d28c4){_0xb783f0=_0xb783f0-0x0;var _0x17f9a2=_0x58ed[_0xb783f0];return _0x17f9a2;};'use strict';var Sequelize=require('sequelize');module[_0xd58e('0x0')]={'name':{'type':Sequelize[_0xd58e('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd58e('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x9721=['STRING','sequelize','exports'];(function(_0x5229bb,_0x4b17f5){var _0x15db9b=function(_0x2fb343){while(--_0x2fb343){_0x5229bb['push'](_0x5229bb['shift']());}};_0x15db9b(++_0x4b17f5);}(_0x9721,0x85));var _0x1972=function(_0x2cb5e0,_0x1d1f21){_0x2cb5e0=_0x2cb5e0-0x0;var _0x10e931=_0x9721[_0x2cb5e0];return _0x10e931;};'use strict';var Sequelize=require(_0x1972('0x0'));module[_0x1972('0x1')]={'name':{'type':Sequelize[_0x1972('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1972('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 85bbf8c..6d6ce3f 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 _0x3e14=['Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Interval','include','findAll','rows','params','keys','includeAll','find','catch','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','body','create','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x5e480c,_0x530a79){var _0x42db51=function(_0xe56849){while(--_0xe56849){_0x5e480c['push'](_0x5e480c['shift']());}};_0x42db51(++_0x530a79);}(_0x3e14,0xe8));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x43e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x43e1('0x2'));var BPromise=require(_0x43e1('0x3'));var Mustache=require('mustache');var util=require(_0x43e1('0x4'));var path=require(_0x43e1('0x5'));var sox=require(_0x43e1('0x6'));var csv=require(_0x43e1('0x7'));var ejs=require(_0x43e1('0x8'));var fs=require('fs');var fs_extra=require(_0x43e1('0x9'));var _=require(_0x43e1('0xa'));var squel=require(_0x43e1('0xb'));var crypto=require(_0x43e1('0xc'));var jsforce=require(_0x43e1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x43e1('0x7'));var querystring=require('querystring');var Papa=require(_0x43e1('0xe'));var Redis=require(_0x43e1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x43e1('0x10'));var as=require(_0x43e1('0x11'));var hardwareService=require(_0x43e1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x43e1('0x13'));var config=require(_0x43e1('0x14'));var licenseUtil=require(_0x43e1('0x15'));var db=require(_0x43e1('0x16'))['db'];var extensions=require(_0x43e1('0x17'));function respondWithStatusCode(_0x8f57b5,_0x17267d){_0x17267d=_0x17267d||0xcc;return function(_0x2ea2a7){if(_0x2ea2a7){return _0x8f57b5[_0x43e1('0x18')](_0x17267d);}return _0x8f57b5[_0x43e1('0x19')](_0x17267d)[_0x43e1('0x1a')]();};}function respondWithResult(_0x364cb3,_0x4c4840){_0x4c4840=_0x4c4840||0xc8;return function(_0x2ca99e){if(_0x2ca99e){return _0x364cb3['status'](_0x4c4840)[_0x43e1('0x1b')](_0x2ca99e);}};}function respondWithFilteredResult(_0x33b89b,_0x209f54){return function(_0x3db610){if(_0x3db610){var _0x270e2f=typeof _0x209f54[_0x43e1('0x1c')]===_0x43e1('0x1d')&&typeof _0x209f54[_0x43e1('0x1e')]===_0x43e1('0x1d');var _0x4fa4b9=_0x3db610[_0x43e1('0x1f')];var _0x49c25d=_0x270e2f?0x0:_0x209f54['offset'];var _0x197cba=_0x270e2f?_0x3db610[_0x43e1('0x1f')]:_0x209f54[_0x43e1('0x1c')]+_0x209f54[_0x43e1('0x1e')];var _0xeba4fa;if(_0x197cba>=_0x4fa4b9){_0x197cba=_0x4fa4b9;_0xeba4fa=0xc8;}else{_0xeba4fa=0xce;}_0x33b89b[_0x43e1('0x19')](_0xeba4fa);return _0x33b89b[_0x43e1('0x20')](_0x43e1('0x21'),_0x49c25d+'-'+_0x197cba+'/'+_0x4fa4b9)['json'](_0x3db610);}return null;};}function patchUpdates(_0x214548){return function(_0x22b8af){try{jsonpatch[_0x43e1('0x22')](_0x22b8af,_0x214548,!![]);}catch(_0x3cdc17){return BPromise[_0x43e1('0x23')](_0x3cdc17);}return _0x22b8af[_0x43e1('0x24')]();};}function saveUpdates(_0x123cbb,_0x190525){return function(_0x4d8292){if(_0x4d8292){return _0x4d8292[_0x43e1('0x25')](_0x123cbb)[_0x43e1('0x26')](function(_0x23ee91){return _0x23ee91;});}return null;};}function removeEntity(_0x2ddbc4,_0x4098bd){return function(_0x1b047b){if(_0x1b047b){return _0x1b047b[_0x43e1('0x27')]()[_0x43e1('0x26')](function(){var _0x51c321=_0x1b047b[_0x43e1('0x28')]({'plain':!![]});var _0x27ada7=_0x43e1('0x29');return db[_0x43e1('0x2a')][_0x43e1('0x27')]({'where':{'type':_0x27ada7,'resourceId':_0x51c321['id']}})[_0x43e1('0x26')](function(){return _0x1b047b;});})[_0x43e1('0x26')](function(){_0x2ddbc4[_0x43e1('0x19')](0xcc)[_0x43e1('0x1a')]();});}};}function handleEntityNotFound(_0x34d117,_0x2517b3){return function(_0x848847){if(!_0x848847){_0x34d117['sendStatus'](0x194);}return _0x848847;};}function handleError(_0x1c227a,_0x4cd5e9){_0x4cd5e9=_0x4cd5e9||0x1f4;return function(_0x3a6857){logger[_0x43e1('0x2b')](_0x3a6857[_0x43e1('0x2c')]);if(_0x3a6857['name']){delete _0x3a6857[_0x43e1('0x2d')];}_0x1c227a['status'](_0x4cd5e9)[_0x43e1('0x2e')](_0x3a6857);};}exports[_0x43e1('0x2f')]=function(_0xa853fe,_0x18b850){var _0xe98ae7={},_0x4def49={},_0x43c534={'count':0x0,'rows':[]};var _0x1e68fa=_[_0x43e1('0x30')](db['Interval'][_0x43e1('0x31')],function(_0x1196c5){return{'name':_0x1196c5[_0x43e1('0x32')],'type':_0x1196c5[_0x43e1('0x33')]['key']};});_0x4def49['model']=_[_0x43e1('0x30')](_0x1e68fa,_0x43e1('0x2d'));_0x4def49['query']=_['keys'](_0xa853fe[_0x43e1('0x34')]);_0x4def49[_0x43e1('0x35')]=_['intersection'](_0x4def49[_0x43e1('0x36')],_0x4def49[_0x43e1('0x34')]);_0xe98ae7[_0x43e1('0x37')]=_[_0x43e1('0x38')](_0x4def49[_0x43e1('0x36')],qs['fields'](_0xa853fe['query'][_0x43e1('0x39')]));_0xe98ae7[_0x43e1('0x37')]=_0xe98ae7[_0x43e1('0x37')][_0x43e1('0x3a')]?_0xe98ae7[_0x43e1('0x37')]:_0x4def49[_0x43e1('0x36')];if(!_0xa853fe[_0x43e1('0x34')]['hasOwnProperty'](_0x43e1('0x3b'))){_0xe98ae7[_0x43e1('0x1e')]=qs[_0x43e1('0x1e')](_0xa853fe[_0x43e1('0x34')][_0x43e1('0x1e')]);_0xe98ae7[_0x43e1('0x1c')]=qs[_0x43e1('0x1c')](_0xa853fe[_0x43e1('0x34')][_0x43e1('0x1c')]);}_0xe98ae7[_0x43e1('0x3c')]=qs[_0x43e1('0x3d')](_0xa853fe[_0x43e1('0x34')][_0x43e1('0x3d')]);_0xe98ae7['where']=qs[_0x43e1('0x35')](_[_0x43e1('0x3e')](_0xa853fe[_0x43e1('0x34')],_0x4def49[_0x43e1('0x35')]),_0x1e68fa);if(_0xa853fe[_0x43e1('0x34')][_0x43e1('0x3f')]){_0xe98ae7[_0x43e1('0x40')]=_[_0x43e1('0x41')](_0xe98ae7[_0x43e1('0x40')],{'$or':_[_0x43e1('0x30')](_0x1e68fa,function(_0x6a9bd6){if(_0x6a9bd6['type']!==_0x43e1('0x42')){var _0x280c17={};_0x280c17[_0x6a9bd6[_0x43e1('0x2d')]]={'$like':'%'+_0xa853fe[_0x43e1('0x34')]['filter']+'%'};return _0x280c17;}})});}_0xe98ae7=_[_0x43e1('0x41')]({},_0xe98ae7,_0xa853fe[_0x43e1('0x43')]);var _0x5074f4={'where':_0xe98ae7[_0x43e1('0x40')]};return db[_0x43e1('0x44')][_0x43e1('0x1f')](_0x5074f4)[_0x43e1('0x26')](function(_0x225ef3){_0x43c534['count']=_0x225ef3;if(_0xa853fe[_0x43e1('0x34')]['includeAll']){_0xe98ae7[_0x43e1('0x45')]=[{'all':!![]}];}return db[_0x43e1('0x44')][_0x43e1('0x46')](_0xe98ae7);})[_0x43e1('0x26')](function(_0xef2418){_0x43c534[_0x43e1('0x47')]=_0xef2418;return _0x43c534;})[_0x43e1('0x26')](respondWithFilteredResult(_0x18b850,_0xe98ae7))['catch'](handleError(_0x18b850,null));};exports['show']=function(_0x17fa08,_0x4fc07f){var _0x5637a2={'raw':!![],'where':{'id':_0x17fa08[_0x43e1('0x48')]['id']}},_0x5f1e5b={};_0x5f1e5b[_0x43e1('0x36')]=_['keys'](db[_0x43e1('0x44')][_0x43e1('0x31')]);_0x5f1e5b[_0x43e1('0x34')]=_[_0x43e1('0x49')](_0x17fa08[_0x43e1('0x34')]);_0x5f1e5b[_0x43e1('0x35')]=_['intersection'](_0x5f1e5b[_0x43e1('0x36')],_0x5f1e5b[_0x43e1('0x34')]);_0x5637a2[_0x43e1('0x37')]=_[_0x43e1('0x38')](_0x5f1e5b[_0x43e1('0x36')],qs[_0x43e1('0x39')](_0x17fa08['query'][_0x43e1('0x39')]));_0x5637a2['attributes']=_0x5637a2[_0x43e1('0x37')][_0x43e1('0x3a')]?_0x5637a2['attributes']:_0x5f1e5b['model'];if(_0x17fa08[_0x43e1('0x34')][_0x43e1('0x4a')]){_0x5637a2[_0x43e1('0x45')]=[{'all':!![]}];}_0x5637a2=_['merge']({},_0x5637a2,_0x17fa08[_0x43e1('0x43')]);return db[_0x43e1('0x44')][_0x43e1('0x4b')](_0x5637a2)[_0x43e1('0x26')](handleEntityNotFound(_0x4fc07f,null))[_0x43e1('0x26')](respondWithResult(_0x4fc07f,null))[_0x43e1('0x4c')](handleError(_0x4fc07f,null));};exports['create']=function(_0x47e34e,_0x1759a1){return db[_0x43e1('0x44')]['create'](_0x47e34e['body'],{})[_0x43e1('0x26')](function(_0x549818){var _0x5d8a2e=_0x47e34e[_0x43e1('0x4d')]['get']({'plain':!![]});if(!_0x5d8a2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d8a2e[_0x43e1('0x4e')]===_0x43e1('0x4d')){var _0x323c24=_0x549818[_0x43e1('0x28')]({'plain':!![]});var _0x52915c=_0x43e1('0x29');return db[_0x43e1('0x4f')][_0x43e1('0x4b')]({'where':{'name':_0x52915c,'userProfileId':_0x5d8a2e['userProfileId']},'raw':!![]})['then'](function(_0xcbfec0){if(_0xcbfec0&&_0xcbfec0[_0x43e1('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x323c24[_0x43e1('0x2d')],'resourceId':_0x323c24['id'],'type':_0xcbfec0[_0x43e1('0x2d')],'sectionId':_0xcbfec0['id']},{})[_0x43e1('0x26')](function(){return _0x549818;});}else{return _0x549818;}})[_0x43e1('0x4c')](function(_0x587115){logger[_0x43e1('0x2b')](_0x43e1('0x51'),_0x587115);throw _0x587115;});}return _0x549818;})[_0x43e1('0x26')](respondWithResult(_0x1759a1,0xc9))[_0x43e1('0x4c')](handleError(_0x1759a1,null));};exports[_0x43e1('0x25')]=function(_0x577e56,_0xf564c4){if(_0x577e56['body']['id']){delete _0x577e56['body']['id'];}return db[_0x43e1('0x44')][_0x43e1('0x4b')]({'where':{'id':_0x577e56[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0xf564c4,null))[_0x43e1('0x26')](saveUpdates(_0x577e56['body'],null))[_0x43e1('0x26')](respondWithResult(_0xf564c4,null))['catch'](handleError(_0xf564c4,null));};exports['destroy']=function(_0x4895e0,_0x20e021){return db[_0x43e1('0x44')][_0x43e1('0x4b')]({'where':{'id':_0x4895e0[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x20e021,null))[_0x43e1('0x26')](removeEntity(_0x20e021,null))[_0x43e1('0x4c')](handleError(_0x20e021,null));};exports[_0x43e1('0x52')]=function(_0x4be4c0,_0x40d497,_0x292ed1){if(_0x4be4c0['body']['id']){delete _0x4be4c0[_0x43e1('0x53')]['id'];}return db[_0x43e1('0x44')][_0x43e1('0x4b')]({'where':{'id':_0x4be4c0[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x40d497,null))[_0x43e1('0x26')](function(_0x2f9083){if(_0x2f9083){_0x4be4c0['body']['IntervalId']=_0x2f9083['id'];return db[_0x43e1('0x44')][_0x43e1('0x54')](_0x4be4c0[_0x43e1('0x53')]);}})[_0x43e1('0x26')](respondWithResult(_0x40d497,null))[_0x43e1('0x4c')](handleError(_0x40d497,null));};exports[_0x43e1('0x55')]=function(_0x5229bf,_0x4a5ced,_0x4f8645){var _0x36ffaf={};var _0x5afcc1={};var _0x233f8c;var _0x3fca99;return db[_0x43e1('0x44')][_0x43e1('0x56')]({'where':{'id':_0x5229bf[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x4a5ced,null))['then'](function(_0x1b5551){if(_0x1b5551){_0x233f8c=_0x1b5551;_0x5afcc1[_0x43e1('0x36')]=_['keys'](db[_0x43e1('0x44')][_0x43e1('0x31')]);_0x5afcc1[_0x43e1('0x34')]=_[_0x43e1('0x49')](_0x5229bf[_0x43e1('0x34')]);_0x5afcc1[_0x43e1('0x35')]=_[_0x43e1('0x38')](_0x5afcc1[_0x43e1('0x36')],_0x5afcc1[_0x43e1('0x34')]);_0x36ffaf[_0x43e1('0x37')]=_[_0x43e1('0x38')](_0x5afcc1[_0x43e1('0x36')],qs[_0x43e1('0x39')](_0x5229bf[_0x43e1('0x34')][_0x43e1('0x39')]));_0x36ffaf['attributes']=_0x36ffaf[_0x43e1('0x37')][_0x43e1('0x3a')]?_0x36ffaf[_0x43e1('0x37')]:_0x5afcc1[_0x43e1('0x36')];_0x36ffaf['order']=qs[_0x43e1('0x3d')](_0x5229bf[_0x43e1('0x34')][_0x43e1('0x3d')]);_0x36ffaf[_0x43e1('0x40')]=qs[_0x43e1('0x35')](_['pick'](_0x5229bf['query'],_0x5afcc1[_0x43e1('0x35')]));if(_0x5229bf[_0x43e1('0x34')][_0x43e1('0x3f')]){_0x36ffaf[_0x43e1('0x40')]=_[_0x43e1('0x41')](_0x36ffaf[_0x43e1('0x40')],{'$or':_[_0x43e1('0x30')](_0x36ffaf[_0x43e1('0x37')],function(_0x278bf5){var _0x7d371={};_0x7d371[_0x278bf5]={'$like':'%'+_0x5229bf['query']['filter']+'%'};return _0x7d371;})});}_0x36ffaf=_['merge']({},_0x36ffaf,_0x5229bf['options']);return _0x233f8c['getIntervals'](_0x36ffaf);}})[_0x43e1('0x26')](function(_0x1ff74b){if(_0x1ff74b){_0x3fca99=_0x1ff74b[_0x43e1('0x3a')];if(!_0x5229bf[_0x43e1('0x34')]['hasOwnProperty'](_0x43e1('0x3b'))){_0x36ffaf[_0x43e1('0x1e')]=qs['limit'](_0x5229bf[_0x43e1('0x34')][_0x43e1('0x1e')]);_0x36ffaf[_0x43e1('0x1c')]=qs[_0x43e1('0x1c')](_0x5229bf['query'][_0x43e1('0x1c')]);}return _0x233f8c[_0x43e1('0x55')](_0x36ffaf);}})[_0x43e1('0x26')](function(_0x40aa62){if(_0x40aa62){return _0x40aa62?{'count':_0x3fca99,'rows':_0x40aa62}:null;}})[_0x43e1('0x26')](respondWithResult(_0x4a5ced,null))[_0x43e1('0x4c')](handleError(_0x4a5ced,null));};exports[_0x43e1('0x57')]=function(_0x397d58,_0x21a93c,_0x5a76da){return db['Interval']['findOne']({'where':{'id':_0x397d58[_0x43e1('0x48')]['id']}})[_0x43e1('0x26')](handleEntityNotFound(_0x21a93c,null))[_0x43e1('0x26')](function(_0x554984){if(_0x554984){return db[_0x43e1('0x58')][_0x43e1('0x59')](function(_0x15a24f){return db['Interval'][_0x43e1('0x27')]({'where':{'IntervalId':_0x397d58[_0x43e1('0x48')]['id']},'transaction':_0x15a24f})[_0x43e1('0x26')](function(_0x414cb6){var _0xd12765=_[_0x43e1('0x30')](_0x397d58['body'],function(_0x5b0658){delete _0x5b0658['id'];_0x5b0658[_0x43e1('0x5a')]=_0x397d58[_0x43e1('0x48')]['id'];return _0x5b0658;});return db[_0x43e1('0x44')]['bulkCreate'](_0xd12765,{'transaction':_0x15a24f});});})['then'](function(){return db['Interval'][_0x43e1('0x46')]({'where':{'IntervalId':_0x397d58[_0x43e1('0x48')]['id']}});});}})['then'](respondWithResult(_0x21a93c,null))['catch'](handleError(_0x21a93c,null));}; \ No newline at end of file +var _0x9f24=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addInterval','getIntervals','nolimit','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','create'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x9f24,0x6b));var _0x49f2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9f24[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x49f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49f2('0x1'));var jsonpatch=require(_0x49f2('0x2'));var rp=require(_0x49f2('0x3'));var moment=require(_0x49f2('0x4'));var BPromise=require(_0x49f2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49f2('0x6'));var sox=require(_0x49f2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49f2('0x8'));var _=require(_0x49f2('0x9'));var squel=require(_0x49f2('0xa'));var crypto=require(_0x49f2('0xb'));var jsforce=require(_0x49f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49f2('0xd'));var Papa=require(_0x49f2('0xe'));var Redis=require(_0x49f2('0xf'));var authService=require(_0x49f2('0x10'));var qs=require(_0x49f2('0x11'));var as=require(_0x49f2('0x12'));var hardwareService=require(_0x49f2('0x13'));var logger=require(_0x49f2('0x14'))(_0x49f2('0x15'));var utils=require('../../config/utils');var config=require(_0x49f2('0x16'));var licenseUtil=require(_0x49f2('0x17'));var db=require(_0x49f2('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x5c22b0,_0x20496f){_0x20496f=_0x20496f||0xcc;return function(_0x2885ce){if(_0x2885ce){return _0x5c22b0[_0x49f2('0x19')](_0x20496f);}return _0x5c22b0[_0x49f2('0x1a')](_0x20496f)[_0x49f2('0x1b')]();};}function respondWithResult(_0x1b9ed5,_0x1d6ac2){_0x1d6ac2=_0x1d6ac2||0xc8;return function(_0x250ab8){if(_0x250ab8){return _0x1b9ed5[_0x49f2('0x1a')](_0x1d6ac2)[_0x49f2('0x1c')](_0x250ab8);}};}function respondWithFilteredResult(_0xb7fc11,_0x5860db){return function(_0x93ab11){if(_0x93ab11){var _0x196f05=typeof _0x5860db[_0x49f2('0x1d')]===_0x49f2('0x1e')&&typeof _0x5860db['limit']===_0x49f2('0x1e');var _0x163f8c=_0x93ab11[_0x49f2('0x1f')];var _0x2fc476=_0x196f05?0x0:_0x5860db[_0x49f2('0x1d')];var _0x13be90=_0x196f05?_0x93ab11[_0x49f2('0x1f')]:_0x5860db[_0x49f2('0x1d')]+_0x5860db[_0x49f2('0x20')];var _0x274ff7;if(_0x13be90>=_0x163f8c){_0x13be90=_0x163f8c;_0x274ff7=0xc8;}else{_0x274ff7=0xce;}_0xb7fc11[_0x49f2('0x1a')](_0x274ff7);return _0xb7fc11[_0x49f2('0x21')](_0x49f2('0x22'),_0x2fc476+'-'+_0x13be90+'/'+_0x163f8c)['json'](_0x93ab11);}return null;};}function patchUpdates(_0x232a90){return function(_0x2cdc49){try{jsonpatch[_0x49f2('0x23')](_0x2cdc49,_0x232a90,!![]);}catch(_0x4a0b31){return BPromise[_0x49f2('0x24')](_0x4a0b31);}return _0x2cdc49[_0x49f2('0x25')]();};}function saveUpdates(_0x4c9d3c,_0x357ac7){return function(_0x444937){if(_0x444937){return _0x444937[_0x49f2('0x26')](_0x4c9d3c)[_0x49f2('0x27')](function(_0x2d5b93){return _0x2d5b93;});}return null;};}function removeEntity(_0x4265b9,_0x3b538c){return function(_0x3a74ab){if(_0x3a74ab){return _0x3a74ab['destroy']()[_0x49f2('0x27')](function(){var _0x17065d=_0x3a74ab[_0x49f2('0x28')]({'plain':!![]});var _0x18d83f=_0x49f2('0x29');return db[_0x49f2('0x2a')]['destroy']({'where':{'type':_0x18d83f,'resourceId':_0x17065d['id']}})['then'](function(){return _0x3a74ab;});})['then'](function(){_0x4265b9[_0x49f2('0x1a')](0xcc)[_0x49f2('0x1b')]();});}};}function handleEntityNotFound(_0x8c9f8c,_0x2aaeff){return function(_0x19bf38){if(!_0x19bf38){_0x8c9f8c[_0x49f2('0x19')](0x194);}return _0x19bf38;};}function handleError(_0x42b274,_0x40bb53){_0x40bb53=_0x40bb53||0x1f4;return function(_0xa7c3e3){logger['error'](_0xa7c3e3['stack']);if(_0xa7c3e3[_0x49f2('0x2b')]){delete _0xa7c3e3[_0x49f2('0x2b')];}_0x42b274[_0x49f2('0x1a')](_0x40bb53)[_0x49f2('0x2c')](_0xa7c3e3);};}exports[_0x49f2('0x2d')]=function(_0x568d36,_0x393df8){var _0x50a077={},_0x1a85e7={},_0x1991dc={'count':0x0,'rows':[]};var _0x4a71c5=_[_0x49f2('0x2e')](db[_0x49f2('0x2f')][_0x49f2('0x30')],function(_0x191874){return{'name':_0x191874['fieldName'],'type':_0x191874[_0x49f2('0x31')][_0x49f2('0x32')]};});_0x1a85e7[_0x49f2('0x33')]=_[_0x49f2('0x2e')](_0x4a71c5,_0x49f2('0x2b'));_0x1a85e7[_0x49f2('0x34')]=_[_0x49f2('0x35')](_0x568d36[_0x49f2('0x34')]);_0x1a85e7[_0x49f2('0x36')]=_['intersection'](_0x1a85e7[_0x49f2('0x33')],_0x1a85e7[_0x49f2('0x34')]);_0x50a077['attributes']=_['intersection'](_0x1a85e7[_0x49f2('0x33')],qs['fields'](_0x568d36[_0x49f2('0x34')][_0x49f2('0x37')]));_0x50a077[_0x49f2('0x38')]=_0x50a077[_0x49f2('0x38')][_0x49f2('0x39')]?_0x50a077[_0x49f2('0x38')]:_0x1a85e7[_0x49f2('0x33')];if(!_0x568d36[_0x49f2('0x34')][_0x49f2('0x3a')]('nolimit')){_0x50a077[_0x49f2('0x20')]=qs['limit'](_0x568d36['query'][_0x49f2('0x20')]);_0x50a077['offset']=qs[_0x49f2('0x1d')](_0x568d36[_0x49f2('0x34')][_0x49f2('0x1d')]);}_0x50a077[_0x49f2('0x3b')]=qs[_0x49f2('0x3c')](_0x568d36[_0x49f2('0x34')][_0x49f2('0x3c')]);_0x50a077[_0x49f2('0x3d')]=qs[_0x49f2('0x36')](_[_0x49f2('0x3e')](_0x568d36[_0x49f2('0x34')],_0x1a85e7[_0x49f2('0x36')]),_0x4a71c5);if(_0x568d36[_0x49f2('0x34')][_0x49f2('0x3f')]){_0x50a077['where']=_[_0x49f2('0x40')](_0x50a077[_0x49f2('0x3d')],{'$or':_[_0x49f2('0x2e')](_0x4a71c5,function(_0x3d1229){if(_0x3d1229['type']!==_0x49f2('0x41')){var _0xe1c6f6={};_0xe1c6f6[_0x3d1229[_0x49f2('0x2b')]]={'$like':'%'+_0x568d36['query'][_0x49f2('0x3f')]+'%'};return _0xe1c6f6;}})});}_0x50a077=_[_0x49f2('0x40')]({},_0x50a077,_0x568d36[_0x49f2('0x42')]);var _0x4a4b9e={'where':_0x50a077['where']};return db[_0x49f2('0x2f')][_0x49f2('0x1f')](_0x4a4b9e)[_0x49f2('0x27')](function(_0x4d63db){_0x1991dc['count']=_0x4d63db;if(_0x568d36[_0x49f2('0x34')][_0x49f2('0x43')]){_0x50a077[_0x49f2('0x44')]=[{'all':!![]}];}return db[_0x49f2('0x2f')][_0x49f2('0x45')](_0x50a077);})[_0x49f2('0x27')](function(_0x20a9a5){_0x1991dc['rows']=_0x20a9a5;return _0x1991dc;})[_0x49f2('0x27')](respondWithFilteredResult(_0x393df8,_0x50a077))[_0x49f2('0x46')](handleError(_0x393df8,null));};exports[_0x49f2('0x47')]=function(_0x3c0771,_0x2f58ff){var _0x25e176={'raw':!![],'where':{'id':_0x3c0771[_0x49f2('0x48')]['id']}},_0x309d21={};_0x309d21[_0x49f2('0x33')]=_[_0x49f2('0x35')](db['Interval'][_0x49f2('0x30')]);_0x309d21[_0x49f2('0x34')]=_[_0x49f2('0x35')](_0x3c0771[_0x49f2('0x34')]);_0x309d21[_0x49f2('0x36')]=_[_0x49f2('0x49')](_0x309d21[_0x49f2('0x33')],_0x309d21[_0x49f2('0x34')]);_0x25e176['attributes']=_[_0x49f2('0x49')](_0x309d21['model'],qs['fields'](_0x3c0771[_0x49f2('0x34')]['fields']));_0x25e176[_0x49f2('0x38')]=_0x25e176[_0x49f2('0x38')]['length']?_0x25e176[_0x49f2('0x38')]:_0x309d21[_0x49f2('0x33')];if(_0x3c0771[_0x49f2('0x34')][_0x49f2('0x43')]){_0x25e176[_0x49f2('0x44')]=[{'all':!![]}];}_0x25e176=_[_0x49f2('0x40')]({},_0x25e176,_0x3c0771[_0x49f2('0x42')]);return db['Interval']['find'](_0x25e176)[_0x49f2('0x27')](handleEntityNotFound(_0x2f58ff,null))['then'](respondWithResult(_0x2f58ff,null))[_0x49f2('0x46')](handleError(_0x2f58ff,null));};exports[_0x49f2('0x4a')]=function(_0x2f3bce,_0x3f8996){return db['Interval'][_0x49f2('0x4a')](_0x2f3bce['body'],{})['then'](function(_0x14507f){var _0x2a91c7=_0x2f3bce['user'][_0x49f2('0x28')]({'plain':!![]});if(!_0x2a91c7)throw new Error(_0x49f2('0x4b'));if(_0x2a91c7['role']==='user'){var _0x153262=_0x14507f[_0x49f2('0x28')]({'plain':!![]});var _0x21ec4c='Intervals';return db[_0x49f2('0x4c')][_0x49f2('0x4d')]({'where':{'name':_0x21ec4c,'userProfileId':_0x2a91c7['userProfileId']},'raw':!![]})[_0x49f2('0x27')](function(_0x317c12){if(_0x317c12&&_0x317c12[_0x49f2('0x4e')]===0x0){return db[_0x49f2('0x2a')][_0x49f2('0x4a')]({'name':_0x153262[_0x49f2('0x2b')],'resourceId':_0x153262['id'],'type':_0x317c12[_0x49f2('0x2b')],'sectionId':_0x317c12['id']},{})[_0x49f2('0x27')](function(){return _0x14507f;});}else{return _0x14507f;}})['catch'](function(_0x8c1e86){logger[_0x49f2('0x4f')](_0x49f2('0x50'),_0x8c1e86);throw _0x8c1e86;});}return _0x14507f;})[_0x49f2('0x27')](respondWithResult(_0x3f8996,0xc9))[_0x49f2('0x46')](handleError(_0x3f8996,null));};exports['update']=function(_0xf4e61e,_0x30014a){if(_0xf4e61e[_0x49f2('0x51')]['id']){delete _0xf4e61e[_0x49f2('0x51')]['id'];}return db[_0x49f2('0x2f')][_0x49f2('0x4d')]({'where':{'id':_0xf4e61e[_0x49f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x30014a,null))['then'](saveUpdates(_0xf4e61e[_0x49f2('0x51')],null))[_0x49f2('0x27')](respondWithResult(_0x30014a,null))[_0x49f2('0x46')](handleError(_0x30014a,null));};exports[_0x49f2('0x52')]=function(_0x1e5e58,_0x20e765){return db[_0x49f2('0x2f')]['find']({'where':{'id':_0x1e5e58[_0x49f2('0x48')]['id']}})[_0x49f2('0x27')](handleEntityNotFound(_0x20e765,null))[_0x49f2('0x27')](removeEntity(_0x20e765,null))[_0x49f2('0x46')](handleError(_0x20e765,null));};exports[_0x49f2('0x53')]=function(_0x166261,_0x128682,_0x41a5b9){if(_0x166261[_0x49f2('0x51')]['id']){delete _0x166261[_0x49f2('0x51')]['id'];}return db[_0x49f2('0x2f')][_0x49f2('0x4d')]({'where':{'id':_0x166261[_0x49f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x128682,null))[_0x49f2('0x27')](function(_0x10331c){if(_0x10331c){_0x166261['body']['IntervalId']=_0x10331c['id'];return db['Interval']['create'](_0x166261[_0x49f2('0x51')]);}})['then'](respondWithResult(_0x128682,null))[_0x49f2('0x46')](handleError(_0x128682,null));};exports[_0x49f2('0x54')]=function(_0x3d8bc4,_0x1d33f8,_0x16eb42){var _0x93a257={};var _0x58d67c={};var _0x3e1f20;var _0x474577;return db[_0x49f2('0x2f')]['findOne']({'where':{'id':_0x3d8bc4[_0x49f2('0x48')]['id']}})[_0x49f2('0x27')](handleEntityNotFound(_0x1d33f8,null))[_0x49f2('0x27')](function(_0x546147){if(_0x546147){_0x3e1f20=_0x546147;_0x58d67c[_0x49f2('0x33')]=_['keys'](db[_0x49f2('0x2f')][_0x49f2('0x30')]);_0x58d67c[_0x49f2('0x34')]=_['keys'](_0x3d8bc4[_0x49f2('0x34')]);_0x58d67c['filters']=_['intersection'](_0x58d67c['model'],_0x58d67c['query']);_0x93a257[_0x49f2('0x38')]=_[_0x49f2('0x49')](_0x58d67c[_0x49f2('0x33')],qs[_0x49f2('0x37')](_0x3d8bc4[_0x49f2('0x34')]['fields']));_0x93a257[_0x49f2('0x38')]=_0x93a257[_0x49f2('0x38')][_0x49f2('0x39')]?_0x93a257[_0x49f2('0x38')]:_0x58d67c[_0x49f2('0x33')];_0x93a257[_0x49f2('0x3b')]=qs[_0x49f2('0x3c')](_0x3d8bc4[_0x49f2('0x34')][_0x49f2('0x3c')]);_0x93a257[_0x49f2('0x3d')]=qs[_0x49f2('0x36')](_['pick'](_0x3d8bc4[_0x49f2('0x34')],_0x58d67c[_0x49f2('0x36')]));if(_0x3d8bc4[_0x49f2('0x34')][_0x49f2('0x3f')]){_0x93a257['where']=_['merge'](_0x93a257['where'],{'$or':_[_0x49f2('0x2e')](_0x93a257[_0x49f2('0x38')],function(_0x7f1d80){var _0xc281c4={};_0xc281c4[_0x7f1d80]={'$like':'%'+_0x3d8bc4[_0x49f2('0x34')][_0x49f2('0x3f')]+'%'};return _0xc281c4;})});}_0x93a257=_['merge']({},_0x93a257,_0x3d8bc4[_0x49f2('0x42')]);return _0x3e1f20[_0x49f2('0x54')](_0x93a257);}})[_0x49f2('0x27')](function(_0x5052a2){if(_0x5052a2){_0x474577=_0x5052a2[_0x49f2('0x39')];if(!_0x3d8bc4[_0x49f2('0x34')]['hasOwnProperty'](_0x49f2('0x55'))){_0x93a257['limit']=qs['limit'](_0x3d8bc4['query'][_0x49f2('0x20')]);_0x93a257[_0x49f2('0x1d')]=qs['offset'](_0x3d8bc4[_0x49f2('0x34')][_0x49f2('0x1d')]);}return _0x3e1f20['getIntervals'](_0x93a257);}})['then'](function(_0x23d54e){if(_0x23d54e){return _0x23d54e?{'count':_0x474577,'rows':_0x23d54e}:null;}})['then'](respondWithResult(_0x1d33f8,null))[_0x49f2('0x46')](handleError(_0x1d33f8,null));};exports['addIntervals']=function(_0x143edf,_0x42815c,_0x2e9a10){return db[_0x49f2('0x2f')][_0x49f2('0x56')]({'where':{'id':_0x143edf['params']['id']}})[_0x49f2('0x27')](handleEntityNotFound(_0x42815c,null))[_0x49f2('0x27')](function(_0x145218){if(_0x145218){return db[_0x49f2('0x57')][_0x49f2('0x58')](function(_0x53335e){return db['Interval'][_0x49f2('0x52')]({'where':{'IntervalId':_0x143edf[_0x49f2('0x48')]['id']},'transaction':_0x53335e})[_0x49f2('0x27')](function(_0x251ca1){var _0x38d001=_[_0x49f2('0x2e')](_0x143edf['body'],function(_0x591ad5){delete _0x591ad5['id'];_0x591ad5[_0x49f2('0x59')]=_0x143edf[_0x49f2('0x48')]['id'];return _0x591ad5;});return db[_0x49f2('0x2f')][_0x49f2('0x5a')](_0x38d001,{'transaction':_0x53335e});});})[_0x49f2('0x27')](function(){return db[_0x49f2('0x2f')][_0x49f2('0x45')]({'where':{'IntervalId':_0x143edf[_0x49f2('0x48')]['id']}});});}})[_0x49f2('0x27')](respondWithResult(_0x42815c,null))[_0x49f2('0x46')](handleError(_0x42815c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3935e10..5d0224d 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 _0x534e=['request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x27c581,_0x32a779){var _0xf94f08=function(_0x56c34a){while(--_0x56c34a){_0x27c581['push'](_0x27c581['shift']());}};_0xf94f08(++_0x32a779);}(_0x534e,0x1c8));var _0xe534=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x534e[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0xe534('0x0'));var util=require(_0xe534('0x1'));var logger=require(_0xe534('0x2'))(_0xe534('0x3'));var moment=require(_0xe534('0x4'));var BPromise=require(_0xe534('0x5'));var rp=require(_0xe534('0x6'));var fs=require('fs');var path=require(_0xe534('0x7'));var rimraf=require(_0xe534('0x8'));var config=require(_0xe534('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0xe534('0xa'));module[_0xe534('0xb')]=function(_0x37cccd,_0x5e71b1){return _0x37cccd[_0xe534('0xc')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3aa940,_0x3a5874){extensions['rewrite'](_0x37cccd,_0x3aa940);},'afterBulkCreate':function(_0x3a1fc0,_0x57048c,_0x37d451){_0x37d451();extensions[_0xe534('0xd')](_0x37cccd,_0x3a1fc0[0x0]);},'afterUpdate':function(_0x1b4c5d,_0x4a39c5){extensions[_0xe534('0xd')](_0x37cccd,_0x1b4c5d);},'afterDestroy':function(_0x303d91,_0x1714c9){extensions['rewrite'](_0x37cccd,_0x303d91);}}});}; \ No newline at end of file +var _0x9b96=['exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9b96,0x9e));var _0x69b9=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x9b96[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x69b9('0x0'));var util=require(_0x69b9('0x1'));var logger=require(_0x69b9('0x2'))(_0x69b9('0x3'));var moment=require(_0x69b9('0x4'));var BPromise=require(_0x69b9('0x5'));var rp=require(_0x69b9('0x6'));var fs=require('fs');var path=require(_0x69b9('0x7'));var rimraf=require(_0x69b9('0x8'));var config=require(_0x69b9('0x9'));var attributes=require(_0x69b9('0xa'));var extensions=require(_0x69b9('0xb'));module[_0x69b9('0xc')]=function(_0x158bdb,_0x2f5f3d){return _0x158bdb[_0x69b9('0xd')](_0x69b9('0xe'),attributes,{'tableName':_0x69b9('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43fe8c,_0x58cae3){extensions[_0x69b9('0x10')](_0x158bdb,_0x43fe8c);},'afterBulkCreate':function(_0x1f889f,_0x159248,_0x55517c){_0x55517c();extensions['rewrite'](_0x158bdb,_0x1f889f[0x0]);},'afterUpdate':function(_0x215db2,_0x1dc74e){extensions[_0x69b9('0x10')](_0x158bdb,_0x215db2);},'afterDestroy':function(_0x5c0c9d,_0x2ea769){extensions['rewrite'](_0x158bdb,_0x5c0c9d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a639988..06a4b74 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 63cf475..b29a358 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x1fea01,_0x59ec97){var _0x45de5d=function(_0x1747bb){while(--_0x1747bb){_0x1fea01['push'](_0x1fea01['shift']());}};_0x45de5d(++_0x59ec97);}(_0xadb5,0xad));var _0x5adb=function(_0xb33b37,_0x9ef33a){_0xb33b37=_0xb33b37-0x0;var _0x402dd4=_0xadb5[_0xb33b37];return _0x402dd4;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4a6a17,_0x4b90ab){var _0x26d460=function(_0x3a0100){while(--_0x3a0100){_0x4a6a17['push'](_0x4a6a17['shift']());}};_0x26d460(++_0x4b90ab);}(_0xadb5,0xad));var _0x5adb=function(_0x38591e,_0x3126fb){_0x38591e=_0x38591e-0x0;var _0x8742b2=_0xadb5[_0x38591e];return _0x8742b2;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8f606e5..efbf64e 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 _0xee8c=['status','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','3eAmWpBVP0','key','summary','Report','description','issuetype','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','stringify','request','setEncoding','utf8','data','end'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0xee8c,0xb0));var _0xcee8=function(_0x2697a7,_0x36d1e3){_0x2697a7=_0x2697a7-0x0;var _0x18b624=_0xee8c[_0x2697a7];return _0x18b624;};'use strict';var BPromise=require('bluebird');var https=require(_0xcee8('0x0'));var logger=require(_0xcee8('0x1'))(_0xcee8('0x2'));var USERNAME='support';var PASSWORD=_0xcee8('0x3');function openIssue(_0x46cae6,_0x228b1f){var _0x4b7528={'fields':{'project':{'key':_0x46cae6[_0xcee8('0x4')]||'MOTGUI'},'summary':(_0x46cae6[_0xcee8('0x5')]||_0xcee8('0x6'))+'\x20from\x20'+_0x46cae6['ip'],'description':_0x46cae6[_0xcee8('0x7')]||JSON['stringify'](_0x46cae6),'issuetype':{'name':_0x46cae6[_0xcee8('0x8')]||'Bug'}}};_0x4b7528['fields'][_0xcee8('0x9')]=_0x46cae6[_0xcee8('0xa')];_0x4b7528[_0xcee8('0xb')][_0xcee8('0xc')]=_0x46cae6['oldToken'];_0x4b7528['fields'][_0xcee8('0xd')]=_0x46cae6[_0xcee8('0xe')];_0x4b7528[_0xcee8('0xb')][_0xcee8('0xf')]=_0x46cae6['name'];_0x4b7528[_0xcee8('0xb')][_0xcee8('0x10')]=_0x46cae6[_0xcee8('0x11')];_0x4b7528[_0xcee8('0xb')][_0xcee8('0x12')]=_0x46cae6['ip'];var _0x37b48a={'host':_0xcee8('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xcee8('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xcee8('0x15'),'Authorization':_0xcee8('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x2631af=JSON[_0xcee8('0x17')](_0x4b7528);var _0x142dc0=https[_0xcee8('0x18')](_0x37b48a,function(_0x4d34c5){_0x4d34c5[_0xcee8('0x19')](_0xcee8('0x1a'));var _0x1c50a6='';_0x4d34c5['on'](_0xcee8('0x1b'),function(_0x40b2e7){_0x1c50a6+=_0x40b2e7;});_0x4d34c5['on'](_0xcee8('0x1c'),function(){if(_0x228b1f){return _0x228b1f[_0xcee8('0x1d')](_0x4d34c5['statusCode'])['json'](JSON['parse'](_0x1c50a6));}});});_0x142dc0['on'](_0xcee8('0x1e'),function(_0x11fa32){if(_0x228b1f){return _0x228b1f[_0xcee8('0x1d')](0x1f4)[_0xcee8('0x1f')]({'errors':[{'message':_0xcee8('0x20'),'type':_0xcee8('0x21')}]});}});_0x142dc0['write'](_0x2631af);_0x142dc0[_0xcee8('0x1c')]();}exports[_0xcee8('0x22')]=openIssue;exports['send']=function(_0x3a09b6,_0xd739de){_0x3a09b6[_0xcee8('0x23')]['ip']=_0x3a09b6[_0xcee8('0x24')][_0xcee8('0x25')]||_0x3a09b6[_0xcee8('0x26')][_0xcee8('0x27')]||_0x3a09b6[_0xcee8('0x28')][_0xcee8('0x27')]||_0x3a09b6[_0xcee8('0x26')][_0xcee8('0x28')][_0xcee8('0x27')];return openIssue(_0x3a09b6[_0xcee8('0x23')],_0xd739de);}; \ No newline at end of file +var _0xfcbe=['api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','customfield_11502','newToken','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','data','end','status','statusCode','json','parse'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0xfcbe,0xbe));var _0xefcb=function(_0x3cc70c,_0x2ffae7){_0x3cc70c=_0x3cc70c-0x0;var _0x32a978=_0xfcbe[_0x3cc70c];return _0x32a978;};'use strict';var BPromise=require(_0xefcb('0x0'));var https=require(_0xefcb('0x1'));var logger=require(_0xefcb('0x2'))(_0xefcb('0x3'));var USERNAME=_0xefcb('0x4');var PASSWORD=_0xefcb('0x5');function openIssue(_0x2b1a70,_0x4411dd){var _0x468b3f={'fields':{'project':{'key':_0x2b1a70[_0xefcb('0x6')]||_0xefcb('0x7')},'summary':(_0x2b1a70[_0xefcb('0x8')]||_0xefcb('0x9'))+_0xefcb('0xa')+_0x2b1a70['ip'],'description':_0x2b1a70[_0xefcb('0xb')]||JSON[_0xefcb('0xc')](_0x2b1a70),'issuetype':{'name':_0x2b1a70['issuetype']||_0xefcb('0xd')}}};_0x468b3f[_0xefcb('0xe')]['customfield_11500']=_0x2b1a70[_0xefcb('0xf')];_0x468b3f[_0xefcb('0xe')][_0xefcb('0x10')]=_0x2b1a70['oldToken'];_0x468b3f[_0xefcb('0xe')][_0xefcb('0x11')]=_0x2b1a70[_0xefcb('0x12')];_0x468b3f[_0xefcb('0xe')]['customfield_11503']=_0x2b1a70[_0xefcb('0x13')];_0x468b3f[_0xefcb('0xe')]['customfield_11504']=_0x2b1a70[_0xefcb('0x14')];_0x468b3f['fields']['customfield_10102']=_0x2b1a70['ip'];var _0x48b946={'host':_0xefcb('0x15'),'port':0x1bb,'path':_0xefcb('0x16'),'method':_0xefcb('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xefcb('0x18'),'Authorization':_0xefcb('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xefcb('0x1a'))}};var _0x16bb81=JSON['stringify'](_0x468b3f);var _0xdc60e4=https[_0xefcb('0x1b')](_0x48b946,function(_0x1637b7){_0x1637b7[_0xefcb('0x1c')]('utf8');var _0x303a97='';_0x1637b7['on'](_0xefcb('0x1d'),function(_0x40dcf7){_0x303a97+=_0x40dcf7;});_0x1637b7['on'](_0xefcb('0x1e'),function(){if(_0x4411dd){return _0x4411dd[_0xefcb('0x1f')](_0x1637b7[_0xefcb('0x20')])[_0xefcb('0x21')](JSON[_0xefcb('0x22')](_0x303a97));}});});_0xdc60e4['on']('error',function(_0x2dbf59){if(_0x4411dd){return _0x4411dd['status'](0x1f4)[_0xefcb('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xefcb('0x23')}]});}});_0xdc60e4[_0xefcb('0x24')](_0x16bb81);_0xdc60e4[_0xefcb('0x1e')]();}exports[_0xefcb('0x25')]=openIssue;exports[_0xefcb('0x26')]=function(_0x1d4057,_0x28fbc5){_0x1d4057[_0xefcb('0x27')]['ip']=_0x1d4057[_0xefcb('0x28')][_0xefcb('0x29')]||_0x1d4057[_0xefcb('0x2a')][_0xefcb('0x2b')]||_0x1d4057[_0xefcb('0x2c')][_0xefcb('0x2b')]||_0x1d4057[_0xefcb('0x2a')]['socket'][_0xefcb('0x2b')];return openIssue(_0x1d4057['body'],_0x28fbc5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2da8cad..6630dc5 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 _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x142233,_0x3a4cec){var _0x33017a=function(_0x368f38){while(--_0x368f38){_0x142233['push'](_0x142233['shift']());}};_0x33017a(++_0x3a4cec);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb8b50,_0x9304f3){_0xb8b50=_0xb8b50-0x0;var _0x52ec84=_0x9bde[_0xb8b50];return _0x52ec84;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb903=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','isAuthenticated','describe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xc3cfc8,_0x44b3ad){var _0x2725cd=function(_0x562497){while(--_0x562497){_0xc3cfc8['push'](_0xc3cfc8['shift']());}};_0x2725cd(++_0x44b3ad);}(_0xb903,0x185));var _0x3b90=function(_0x12c69c,_0x3e51a7){_0x12c69c=_0x12c69c-0x0;var _0x50417e=_0xb903[_0x12c69c];return _0x50417e;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/describe',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b90('0xe'),auth[_0x3b90('0xc')](),controller['update']);router[_0x3b90('0xf')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x10')]);module[_0x3b90('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 82ef384..dc52e92 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x35ba50,_0x4d4411){_0x35ba50=_0x35ba50-0x0;var _0x1de1e1=_0x7a54[_0x35ba50];return _0x1de1e1;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x2b3f11,_0x288d3a){_0x2b3f11=_0x2b3f11-0x0;var _0x3494cc=_0x7a54[_0x2b3f11];return _0x3494cc;};'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 8287c5e..ec5fc9d 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 _0x41ec=['merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','JscriptyAnswerReport','include','create','body','find','describe','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x1c20bc,_0xfad293){var _0x1f2917=function(_0x36f9ab){while(--_0x36f9ab){_0x1c20bc['push'](_0x1c20bc['shift']());}};_0x1f2917(++_0xfad293);}(_0x41ec,0x143));var _0xc41e=function(_0x2a0f64,_0x5520a6){_0x2a0f64=_0x2a0f64-0x0;var _0x2a1c1f=_0x41ec[_0x2a0f64];return _0x2a1c1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc41e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc41e('0x1'));var rp=require(_0xc41e('0x2'));var moment=require('moment');var BPromise=require(_0xc41e('0x3'));var Mustache=require(_0xc41e('0x4'));var util=require(_0xc41e('0x5'));var path=require(_0xc41e('0x6'));var sox=require(_0xc41e('0x7'));var csv=require(_0xc41e('0x8'));var ejs=require(_0xc41e('0x9'));var fs=require('fs');var fs_extra=require(_0xc41e('0xa'));var _=require(_0xc41e('0xb'));var squel=require(_0xc41e('0xc'));var crypto=require(_0xc41e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc41e('0xe'));var toCsv=require(_0xc41e('0x8'));var querystring=require(_0xc41e('0xf'));var Papa=require(_0xc41e('0x10'));var Redis=require(_0xc41e('0x11'));var authService=require(_0xc41e('0x12'));var qs=require(_0xc41e('0x13'));var as=require(_0xc41e('0x14'));var hardwareService=require(_0xc41e('0x15'));var logger=require(_0xc41e('0x16'))(_0xc41e('0x17'));var utils=require('../../config/utils');var config=require(_0xc41e('0x18'));var licenseUtil=require(_0xc41e('0x19'));var db=require(_0xc41e('0x1a'))['db'];function respondWithStatusCode(_0x3d7280,_0x11a117){_0x11a117=_0x11a117||0xcc;return function(_0x433ca9){if(_0x433ca9){return _0x3d7280[_0xc41e('0x1b')](_0x11a117);}return _0x3d7280[_0xc41e('0x1c')](_0x11a117)['end']();};}function respondWithResult(_0x3b3900,_0x6b614a){_0x6b614a=_0x6b614a||0xc8;return function(_0xcd58a0){if(_0xcd58a0){return _0x3b3900[_0xc41e('0x1c')](_0x6b614a)['json'](_0xcd58a0);}};}function respondWithFilteredResult(_0x5c705e,_0x4f960d){return function(_0x28eb53){if(_0x28eb53){var _0x4293a5=typeof _0x4f960d['offset']===_0xc41e('0x1d')&&typeof _0x4f960d[_0xc41e('0x1e')]==='undefined';var _0x4e7aa3=_0x28eb53[_0xc41e('0x1f')];var _0x5c0517=_0x4293a5?0x0:_0x4f960d[_0xc41e('0x20')];var _0x23c9b6=_0x4293a5?_0x28eb53['count']:_0x4f960d[_0xc41e('0x20')]+_0x4f960d[_0xc41e('0x1e')];var _0xee0f01;if(_0x23c9b6>=_0x4e7aa3){_0x23c9b6=_0x4e7aa3;_0xee0f01=0xc8;}else{_0xee0f01=0xce;}_0x5c705e[_0xc41e('0x1c')](_0xee0f01);return _0x5c705e[_0xc41e('0x21')](_0xc41e('0x22'),_0x5c0517+'-'+_0x23c9b6+'/'+_0x4e7aa3)[_0xc41e('0x23')](_0x28eb53);}return null;};}function patchUpdates(_0x57e0c4){return function(_0x239c25){try{jsonpatch[_0xc41e('0x24')](_0x239c25,_0x57e0c4,!![]);}catch(_0x3f26d5){return BPromise['reject'](_0x3f26d5);}return _0x239c25[_0xc41e('0x25')]();};}function saveUpdates(_0x408d27,_0x814a72){return function(_0x490cc3){if(_0x490cc3){return _0x490cc3[_0xc41e('0x26')](_0x408d27)[_0xc41e('0x27')](function(_0x602bd7){return _0x602bd7;});}return null;};}function removeEntity(_0x4adaad,_0x5a06dd){return function(_0x4c20b1){if(_0x4c20b1){return _0x4c20b1[_0xc41e('0x28')]()[_0xc41e('0x27')](function(){_0x4adaad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3e0d,_0x1c33a6){return function(_0x1ad4c7){if(!_0x1ad4c7){_0x5a3e0d[_0xc41e('0x1b')](0x194);}return _0x1ad4c7;};}function handleError(_0x467672,_0x1c6a2a){_0x1c6a2a=_0x1c6a2a||0x1f4;return function(_0x580b9e){logger[_0xc41e('0x29')](_0x580b9e[_0xc41e('0x2a')]);if(_0x580b9e[_0xc41e('0x2b')]){delete _0x580b9e['name'];}_0x467672[_0xc41e('0x1c')](_0x1c6a2a)[_0xc41e('0x2c')](_0x580b9e);};}exports['index']=function(_0x25b319,_0x12536e){var _0x5c2c62={},_0xcb3a15={},_0x2fa98a={'count':0x0,'rows':[]};var _0x17246e=_[_0xc41e('0x2d')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x541ac4){return{'name':_0x541ac4[_0xc41e('0x2e')],'type':_0x541ac4[_0xc41e('0x2f')][_0xc41e('0x30')]};});_0xcb3a15[_0xc41e('0x31')]=_[_0xc41e('0x2d')](_0x17246e,_0xc41e('0x2b'));_0xcb3a15[_0xc41e('0x32')]=_['keys'](_0x25b319[_0xc41e('0x32')]);_0xcb3a15[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0xcb3a15['model'],_0xcb3a15[_0xc41e('0x32')]);_0x5c2c62['attributes']=_[_0xc41e('0x34')](_0xcb3a15[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x25b319[_0xc41e('0x32')]['fields']));_0x5c2c62['attributes']=_0x5c2c62[_0xc41e('0x36')][_0xc41e('0x37')]?_0x5c2c62[_0xc41e('0x36')]:_0xcb3a15[_0xc41e('0x31')];if(!_0x25b319[_0xc41e('0x32')][_0xc41e('0x38')]('nolimit')){_0x5c2c62[_0xc41e('0x1e')]=qs[_0xc41e('0x1e')](_0x25b319[_0xc41e('0x32')]['limit']);_0x5c2c62[_0xc41e('0x20')]=qs[_0xc41e('0x20')](_0x25b319['query'][_0xc41e('0x20')]);}_0x5c2c62[_0xc41e('0x39')]=qs[_0xc41e('0x3a')](_0x25b319[_0xc41e('0x32')][_0xc41e('0x3a')]);_0x5c2c62['where']=qs['filters'](_[_0xc41e('0x3b')](_0x25b319[_0xc41e('0x32')],_0xcb3a15[_0xc41e('0x33')]),_0x17246e);if(_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]){_0x5c2c62[_0xc41e('0x3d')]=_[_0xc41e('0x3e')](_0x5c2c62[_0xc41e('0x3d')],{'$or':_[_0xc41e('0x2d')](_0x17246e,function(_0x4de59a){if(_0x4de59a['type']!==_0xc41e('0x3f')){var _0xfd6ff6={};_0xfd6ff6[_0x4de59a[_0xc41e('0x2b')]]={'$like':'%'+_0x25b319[_0xc41e('0x32')][_0xc41e('0x3c')]+'%'};return _0xfd6ff6;}})});}_0x5c2c62=_[_0xc41e('0x3e')]({},_0x5c2c62,_0x25b319[_0xc41e('0x40')]);var _0x150f30={'where':_0x5c2c62['where']};return db['JscriptyAnswerReport'][_0xc41e('0x1f')](_0x150f30)[_0xc41e('0x27')](function(_0x10cfed){_0x2fa98a['count']=_0x10cfed;if(_0x25b319['query'][_0xc41e('0x41')]){_0x5c2c62['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x5c2c62);})['then'](function(_0x3c30e2){_0x2fa98a[_0xc41e('0x42')]=_0x3c30e2;return _0x2fa98a;})[_0xc41e('0x27')](respondWithFilteredResult(_0x12536e,_0x5c2c62))[_0xc41e('0x43')](handleError(_0x12536e,null));};exports[_0xc41e('0x44')]=function(_0x206aa1,_0x4bb1f6){var _0x28d15d={'raw':!![],'where':{'id':_0x206aa1[_0xc41e('0x45')]['id']}},_0x1a3e67={};_0x1a3e67[_0xc41e('0x31')]=_[_0xc41e('0x46')](db[_0xc41e('0x47')]['rawAttributes']);_0x1a3e67[_0xc41e('0x32')]=_[_0xc41e('0x46')](_0x206aa1['query']);_0x1a3e67[_0xc41e('0x33')]=_[_0xc41e('0x34')](_0x1a3e67['model'],_0x1a3e67[_0xc41e('0x32')]);_0x28d15d['attributes']=_[_0xc41e('0x34')](_0x1a3e67[_0xc41e('0x31')],qs[_0xc41e('0x35')](_0x206aa1['query'][_0xc41e('0x35')]));_0x28d15d[_0xc41e('0x36')]=_0x28d15d['attributes']['length']?_0x28d15d['attributes']:_0x1a3e67['model'];if(_0x206aa1[_0xc41e('0x32')]['includeAll']){_0x28d15d[_0xc41e('0x48')]=[{'all':!![]}];}_0x28d15d=_['merge']({},_0x28d15d,_0x206aa1['options']);return db[_0xc41e('0x47')]['find'](_0x28d15d)[_0xc41e('0x27')](handleEntityNotFound(_0x4bb1f6,null))[_0xc41e('0x27')](respondWithResult(_0x4bb1f6,null))[_0xc41e('0x43')](handleError(_0x4bb1f6,null));};exports[_0xc41e('0x49')]=function(_0x46aef6,_0x31b393){return db[_0xc41e('0x47')][_0xc41e('0x49')](_0x46aef6[_0xc41e('0x4a')],{})[_0xc41e('0x27')](respondWithResult(_0x31b393,0xc9))[_0xc41e('0x43')](handleError(_0x31b393,null));};exports['update']=function(_0x4b67d4,_0x1cdf49){if(_0x4b67d4[_0xc41e('0x4a')]['id']){delete _0x4b67d4[_0xc41e('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0xc41e('0x4b')]({'where':{'id':_0x4b67d4[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x1cdf49,null))[_0xc41e('0x27')](saveUpdates(_0x4b67d4[_0xc41e('0x4a')],null))[_0xc41e('0x27')](respondWithResult(_0x1cdf49,null))[_0xc41e('0x43')](handleError(_0x1cdf49,null));};exports['destroy']=function(_0x3c867a,_0x317eba){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3c867a[_0xc41e('0x45')]['id']}})[_0xc41e('0x27')](handleEntityNotFound(_0x317eba,null))[_0xc41e('0x27')](removeEntity(_0x317eba,null))[_0xc41e('0x43')](handleError(_0x317eba,null));};exports[_0xc41e('0x4c')]=function(_0x53a799,_0x576831){return db[_0xc41e('0x47')]['describe']()[_0xc41e('0x27')](respondWithResult(_0x576831,null))['catch'](handleError(_0x576831,null));}; \ No newline at end of file +var _0x1696=['count','limit','Content-Range','apply','reject','save','update','then','end','error','send','map','JscriptyAnswerReport','fieldName','type','model','keys','attributes','intersection','fields','hasOwnProperty','nolimit','query','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','include','rows','show','length','includeAll','find','catch','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset'];(function(_0x51380e,_0x55b897){var _0x2ed390=function(_0x217cfe){while(--_0x217cfe){_0x51380e['push'](_0x51380e['shift']());}};_0x2ed390(++_0x55b897);}(_0x1696,0x79));var _0x6169=function(_0xb1b8a3,_0x3b5516){_0xb1b8a3=_0xb1b8a3-0x0;var _0xa48935=_0x1696[_0xb1b8a3];return _0xa48935;};'use strict';var emlformat=require(_0x6169('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6169('0x1'));var jsonpatch=require(_0x6169('0x2'));var rp=require(_0x6169('0x3'));var moment=require(_0x6169('0x4'));var BPromise=require(_0x6169('0x5'));var Mustache=require(_0x6169('0x6'));var util=require(_0x6169('0x7'));var path=require(_0x6169('0x8'));var sox=require(_0x6169('0x9'));var csv=require('to-csv');var ejs=require(_0x6169('0xa'));var fs=require('fs');var fs_extra=require(_0x6169('0xb'));var _=require(_0x6169('0xc'));var squel=require(_0x6169('0xd'));var crypto=require(_0x6169('0xe'));var jsforce=require(_0x6169('0xf'));var deskjs=require(_0x6169('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6169('0x11'));var Papa=require('papaparse');var Redis=require(_0x6169('0x12'));var authService=require(_0x6169('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6169('0x14'));var hardwareService=require(_0x6169('0x15'));var logger=require(_0x6169('0x16'))(_0x6169('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6169('0x18'));var db=require(_0x6169('0x19'))['db'];function respondWithStatusCode(_0x5f342e,_0x9288c4){_0x9288c4=_0x9288c4||0xcc;return function(_0x2d6570){if(_0x2d6570){return _0x5f342e[_0x6169('0x1a')](_0x9288c4);}return _0x5f342e['status'](_0x9288c4)['end']();};}function respondWithResult(_0x4ba7bf,_0x2829cf){_0x2829cf=_0x2829cf||0xc8;return function(_0x2171d1){if(_0x2171d1){return _0x4ba7bf[_0x6169('0x1b')](_0x2829cf)[_0x6169('0x1c')](_0x2171d1);}};}function respondWithFilteredResult(_0x3ffa76,_0x5837d8){return function(_0x461294){if(_0x461294){var _0x3e2eb4=typeof _0x5837d8['offset']===_0x6169('0x1d')&&typeof _0x5837d8['limit']===_0x6169('0x1d');var _0x1e3b4e=_0x461294['count'];var _0xdfe11e=_0x3e2eb4?0x0:_0x5837d8[_0x6169('0x1e')];var _0xd47fea=_0x3e2eb4?_0x461294[_0x6169('0x1f')]:_0x5837d8[_0x6169('0x1e')]+_0x5837d8[_0x6169('0x20')];var _0x2b2e20;if(_0xd47fea>=_0x1e3b4e){_0xd47fea=_0x1e3b4e;_0x2b2e20=0xc8;}else{_0x2b2e20=0xce;}_0x3ffa76['status'](_0x2b2e20);return _0x3ffa76['set'](_0x6169('0x21'),_0xdfe11e+'-'+_0xd47fea+'/'+_0x1e3b4e)[_0x6169('0x1c')](_0x461294);}return null;};}function patchUpdates(_0x486186){return function(_0x34675a){try{jsonpatch[_0x6169('0x22')](_0x34675a,_0x486186,!![]);}catch(_0x2f3ef3){return BPromise[_0x6169('0x23')](_0x2f3ef3);}return _0x34675a[_0x6169('0x24')]();};}function saveUpdates(_0x51598d,_0x2506bb){return function(_0x5579b9){if(_0x5579b9){return _0x5579b9[_0x6169('0x25')](_0x51598d)[_0x6169('0x26')](function(_0x13e390){return _0x13e390;});}return null;};}function removeEntity(_0x4b35ca,_0x3b0e8a){return function(_0x1f90aa){if(_0x1f90aa){return _0x1f90aa['destroy']()['then'](function(){_0x4b35ca[_0x6169('0x1b')](0xcc)[_0x6169('0x27')]();});}};}function handleEntityNotFound(_0x3e706c,_0x20b40c){return function(_0x1b207e){if(!_0x1b207e){_0x3e706c[_0x6169('0x1a')](0x194);}return _0x1b207e;};}function handleError(_0x647f57,_0x3010f7){_0x3010f7=_0x3010f7||0x1f4;return function(_0x5f2e3b){logger[_0x6169('0x28')](_0x5f2e3b['stack']);if(_0x5f2e3b['name']){delete _0x5f2e3b['name'];}_0x647f57['status'](_0x3010f7)[_0x6169('0x29')](_0x5f2e3b);};}exports['index']=function(_0x4466f3,_0x136d11){var _0x15bef9={},_0x512977={},_0x51e2ea={'count':0x0,'rows':[]};var _0x544dcc=_[_0x6169('0x2a')](db[_0x6169('0x2b')]['rawAttributes'],function(_0x4c6036){return{'name':_0x4c6036[_0x6169('0x2c')],'type':_0x4c6036[_0x6169('0x2d')]['key']};});_0x512977[_0x6169('0x2e')]=_[_0x6169('0x2a')](_0x544dcc,'name');_0x512977['query']=_[_0x6169('0x2f')](_0x4466f3['query']);_0x512977['filters']=_['intersection'](_0x512977[_0x6169('0x2e')],_0x512977['query']);_0x15bef9[_0x6169('0x30')]=_[_0x6169('0x31')](_0x512977['model'],qs[_0x6169('0x32')](_0x4466f3['query'][_0x6169('0x32')]));_0x15bef9[_0x6169('0x30')]=_0x15bef9[_0x6169('0x30')]['length']?_0x15bef9['attributes']:_0x512977['model'];if(!_0x4466f3['query'][_0x6169('0x33')](_0x6169('0x34'))){_0x15bef9['limit']=qs[_0x6169('0x20')](_0x4466f3[_0x6169('0x35')][_0x6169('0x20')]);_0x15bef9['offset']=qs[_0x6169('0x1e')](_0x4466f3[_0x6169('0x35')][_0x6169('0x1e')]);}_0x15bef9[_0x6169('0x36')]=qs[_0x6169('0x37')](_0x4466f3[_0x6169('0x35')][_0x6169('0x37')]);_0x15bef9[_0x6169('0x38')]=qs[_0x6169('0x39')](_[_0x6169('0x3a')](_0x4466f3[_0x6169('0x35')],_0x512977['filters']),_0x544dcc);if(_0x4466f3[_0x6169('0x35')][_0x6169('0x3b')]){_0x15bef9['where']=_[_0x6169('0x3c')](_0x15bef9[_0x6169('0x38')],{'$or':_[_0x6169('0x2a')](_0x544dcc,function(_0xdfce5f){if(_0xdfce5f[_0x6169('0x2d')]!==_0x6169('0x3d')){var _0x388ca5={};_0x388ca5[_0xdfce5f[_0x6169('0x3e')]]={'$like':'%'+_0x4466f3[_0x6169('0x35')]['filter']+'%'};return _0x388ca5;}})});}_0x15bef9=_[_0x6169('0x3c')]({},_0x15bef9,_0x4466f3[_0x6169('0x3f')]);var _0x273730={'where':_0x15bef9['where']};return db[_0x6169('0x2b')][_0x6169('0x1f')](_0x273730)['then'](function(_0x3026d7){_0x51e2ea['count']=_0x3026d7;if(_0x4466f3[_0x6169('0x35')]['includeAll']){_0x15bef9[_0x6169('0x40')]=[{'all':!![]}];}return db[_0x6169('0x2b')]['findAll'](_0x15bef9);})[_0x6169('0x26')](function(_0x4969e3){_0x51e2ea[_0x6169('0x41')]=_0x4969e3;return _0x51e2ea;})[_0x6169('0x26')](respondWithFilteredResult(_0x136d11,_0x15bef9))['catch'](handleError(_0x136d11,null));};exports[_0x6169('0x42')]=function(_0x4b07e8,_0x34ad06){var _0x545863={'raw':!![],'where':{'id':_0x4b07e8['params']['id']}},_0x1a7849={};_0x1a7849['model']=_[_0x6169('0x2f')](db[_0x6169('0x2b')]['rawAttributes']);_0x1a7849[_0x6169('0x35')]=_['keys'](_0x4b07e8[_0x6169('0x35')]);_0x1a7849[_0x6169('0x39')]=_['intersection'](_0x1a7849[_0x6169('0x2e')],_0x1a7849['query']);_0x545863['attributes']=_[_0x6169('0x31')](_0x1a7849[_0x6169('0x2e')],qs['fields'](_0x4b07e8[_0x6169('0x35')]['fields']));_0x545863[_0x6169('0x30')]=_0x545863[_0x6169('0x30')][_0x6169('0x43')]?_0x545863['attributes']:_0x1a7849[_0x6169('0x2e')];if(_0x4b07e8[_0x6169('0x35')][_0x6169('0x44')]){_0x545863[_0x6169('0x40')]=[{'all':!![]}];}_0x545863=_[_0x6169('0x3c')]({},_0x545863,_0x4b07e8[_0x6169('0x3f')]);return db['JscriptyAnswerReport'][_0x6169('0x45')](_0x545863)[_0x6169('0x26')](handleEntityNotFound(_0x34ad06,null))[_0x6169('0x26')](respondWithResult(_0x34ad06,null))[_0x6169('0x46')](handleError(_0x34ad06,null));};exports[_0x6169('0x47')]=function(_0x4d004e,_0x4ab194){return db[_0x6169('0x2b')][_0x6169('0x47')](_0x4d004e[_0x6169('0x48')],{})[_0x6169('0x26')](respondWithResult(_0x4ab194,0xc9))[_0x6169('0x46')](handleError(_0x4ab194,null));};exports[_0x6169('0x25')]=function(_0x11bc4b,_0xcffe00){if(_0x11bc4b[_0x6169('0x48')]['id']){delete _0x11bc4b[_0x6169('0x48')]['id'];}return db[_0x6169('0x2b')]['find']({'where':{'id':_0x11bc4b[_0x6169('0x49')]['id']}})['then'](handleEntityNotFound(_0xcffe00,null))[_0x6169('0x26')](saveUpdates(_0x11bc4b[_0x6169('0x48')],null))['then'](respondWithResult(_0xcffe00,null))[_0x6169('0x46')](handleError(_0xcffe00,null));};exports[_0x6169('0x4a')]=function(_0x291a5b,_0x1dd004){return db['JscriptyAnswerReport'][_0x6169('0x45')]({'where':{'id':_0x291a5b['params']['id']}})[_0x6169('0x26')](handleEntityNotFound(_0x1dd004,null))[_0x6169('0x26')](removeEntity(_0x1dd004,null))[_0x6169('0x46')](handleError(_0x1dd004,null));};exports[_0x6169('0x4b')]=function(_0x38c8cd,_0x559522){return db[_0x6169('0x2b')]['describe']()[_0x6169('0x26')](respondWithResult(_0x559522,null))[_0x6169('0x46')](handleError(_0x559522,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b320056..8403eb5 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 _0x728e=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3fa4bd,_0x14a72d){var _0x358c95=function(_0x55c7fc){while(--_0x55c7fc){_0x3fa4bd['push'](_0x3fa4bd['shift']());}};_0x358c95(++_0x14a72d);}(_0x728e,0x18b));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe728('0x0'));var util=require(_0xe728('0x1'));var logger=require(_0xe728('0x2'))(_0xe728('0x3'));var moment=require(_0xe728('0x4'));var BPromise=require(_0xe728('0x5'));var rp=require(_0xe728('0x6'));var fs=require('fs');var path=require(_0xe728('0x7'));var rimraf=require(_0xe728('0x8'));var config=require(_0xe728('0x9'));var attributes=require(_0xe728('0xa'));module[_0xe728('0xb')]=function(_0x4c68f7,_0x224436){return _0x4c68f7[_0xe728('0xc')](_0xe728('0xd'),attributes,{'tableName':_0xe728('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a7e=['request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','moment','bluebird'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x7a7e,0x74));var _0xe7a7=function(_0x236deb,_0x2f4aef){_0x236deb=_0x236deb-0x0;var _0xa7d4e2=_0x7a7e[_0x236deb];return _0xa7d4e2;};'use strict';var _=require(_0xe7a7('0x0'));var util=require(_0xe7a7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe7a7('0x2'));var BPromise=require(_0xe7a7('0x3'));var rp=require(_0xe7a7('0x4'));var fs=require('fs');var path=require(_0xe7a7('0x5'));var rimraf=require(_0xe7a7('0x6'));var config=require(_0xe7a7('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xe7a7('0x8')]=function(_0x479774,_0x4087f5){return _0x479774[_0xe7a7('0x9')](_0xe7a7('0xa'),attributes,{'tableName':_0xe7a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 648876e..3bace2f 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 _0xd6b6=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23eec5,_0xd1c4c1){var _0x304f22=function(_0x14d632){while(--_0x14d632){_0x23eec5['push'](_0x23eec5['shift']());}};_0x304f22(++_0xd1c4c1);}(_0xd6b6,0x189));var _0x6d6b=function(_0x146e4d,_0x1b35a6){_0x146e4d=_0x146e4d-0x0;var _0x461885=_0xd6b6[_0x146e4d];return _0x461885;};'use strict';var _=require(_0x6d6b('0x0'));var util=require('util');var moment=require(_0x6d6b('0x1'));var BPromise=require(_0x6d6b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6b('0x3'));var db=require(_0x6d6b('0x4'))['db'];var utils=require(_0x6d6b('0x5'));var logger=require(_0x6d6b('0x6'))('rpc');var config=require(_0x6d6b('0x7'));var jayson=require(_0x6d6b('0x8'));var client=jayson[_0x6d6b('0x9')][_0x6d6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4236d1,_0x4a24bd,_0x1f7a7f){return new BPromise(function(_0x312aa8,_0x52c008){return client[_0x6d6b('0xb')](_0x4236d1,_0x1f7a7f)[_0x6d6b('0xc')](function(_0x2f1008){logger[_0x6d6b('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a24bd,'request\x20sent');logger['debug'](_0x6d6b('0xe'),_0x4a24bd,_0x6d6b('0xf'),JSON['stringify'](_0x2f1008));if(_0x2f1008['error']){if(_0x2f1008[_0x6d6b('0x10')]['code']===0x1f4){logger['error'](_0x6d6b('0x11'),_0x4a24bd,_0x2f1008[_0x6d6b('0x10')][_0x6d6b('0x12')]);return _0x52c008(_0x2f1008[_0x6d6b('0x10')][_0x6d6b('0x12')]);}logger[_0x6d6b('0x10')](_0x6d6b('0x11'),_0x4a24bd,_0x2f1008[_0x6d6b('0x10')]['message']);return _0x312aa8(_0x2f1008[_0x6d6b('0x10')][_0x6d6b('0x12')]);}else{logger['info'](_0x6d6b('0x11'),_0x4a24bd,_0x6d6b('0xf'));_0x312aa8(_0x2f1008[_0x6d6b('0x13')][_0x6d6b('0x12')]);}})['catch'](function(_0x585809){logger['error'](_0x6d6b('0x11'),_0x4a24bd,_0x585809);_0x52c008(_0x585809);});});} \ No newline at end of file +var _0x131d=['code','message','error','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44e75a,_0x1a0a06){var _0x261782=function(_0x3686b5){while(--_0x3686b5){_0x44e75a['push'](_0x44e75a['shift']());}};_0x261782(++_0x1a0a06);}(_0x131d,0x1bb));var _0xd131=function(_0x57ff6e,_0x5135ac){_0x57ff6e=_0x57ff6e-0x0;var _0x18420d=_0x131d[_0x57ff6e];return _0x18420d;};'use strict';var _=require(_0xd131('0x0'));var util=require(_0xd131('0x1'));var moment=require(_0xd131('0x2'));var BPromise=require('bluebird');var rs=require(_0xd131('0x3'));var fs=require('fs');var Redis=require(_0xd131('0x4'));var db=require(_0xd131('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd131('0x6'))(_0xd131('0x7'));var config=require(_0xd131('0x8'));var jayson=require(_0xd131('0x9'));var client=jayson['client'][_0xd131('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b0441,_0x3c6614,_0x2d7f5a){return new BPromise(function(_0x50d61b,_0x3035da){return client['request'](_0x4b0441,_0x2d7f5a)[_0xd131('0xb')](function(_0x2b61e3){logger[_0xd131('0xc')](_0xd131('0xd'),_0x3c6614,'request\x20sent');logger[_0xd131('0xe')](_0xd131('0xf'),_0x3c6614,'request\x20sent',JSON[_0xd131('0x10')](_0x2b61e3));if(_0x2b61e3['error']){if(_0x2b61e3['error'][_0xd131('0x11')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3c6614,_0x2b61e3['error'][_0xd131('0x12')]);return _0x3035da(_0x2b61e3[_0xd131('0x13')][_0xd131('0x12')]);}logger[_0xd131('0x13')](_0xd131('0xd'),_0x3c6614,_0x2b61e3[_0xd131('0x13')][_0xd131('0x12')]);return _0x50d61b(_0x2b61e3[_0xd131('0x13')][_0xd131('0x12')]);}else{logger[_0xd131('0xc')](_0xd131('0xd'),_0x3c6614,'request\x20sent');_0x50d61b(_0x2b61e3['result'][_0xd131('0x12')]);}})['catch'](function(_0x35151c){logger['error'](_0xd131('0xd'),_0x3c6614,_0x35151c);_0x3035da(_0x35151c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9281d91..571a323 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 _0x2513=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','update','delete','/:id','multer','util'];(function(_0x2daebc,_0x23a680){var _0x1594d8=function(_0x521b01){while(--_0x521b01){_0x2daebc['push'](_0x2daebc['shift']());}};_0x1594d8(++_0x23a680);}(_0x2513,0x1c6));var _0x3251=function(_0x26ee05,_0x5a2bb4){_0x26ee05=_0x26ee05-0x0;var _0x1042ad=_0x2513[_0x26ee05];return _0x1042ad;};'use strict';var multer=require(_0x3251('0x0'));var util=require(_0x3251('0x1'));var path=require('path');var timeout=require(_0x3251('0x2'));var express=require('express');var router=express[_0x3251('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3251('0x4'));var interaction=require(_0x3251('0x5'));var config=require(_0x3251('0x6'));var controller=require(_0x3251('0x7'));router[_0x3251('0x8')]('/',auth[_0x3251('0x9')](),controller[_0x3251('0xa')]);router[_0x3251('0x8')]('/:id',auth[_0x3251('0x9')](),controller[_0x3251('0xb')]);router['get'](_0x3251('0xc'),auth['isAuthenticated'](),controller['getSessions']);router[_0x3251('0x8')](_0x3251('0xd'),auth[_0x3251('0x9')](),controller[_0x3251('0xe')]);router[_0x3251('0x8')](_0x3251('0xf'),auth[_0x3251('0x9')](),timeout(_0x3251('0x10')),controller[_0x3251('0x11')]);router[_0x3251('0x12')]('/',auth[_0x3251('0x9')](),controller['create']);router[_0x3251('0x12')](_0x3251('0x13'),auth[_0x3251('0x9')](),controller[_0x3251('0x14')]);router['put']('/:id',auth[_0x3251('0x9')](),controller[_0x3251('0x15')]);router[_0x3251('0x16')](_0x3251('0x17'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0b71=['isAuthenticated','get','/:id/sessions','/:id/answers','/:id/summary','30s','getSummary','post','clone','put','update','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','/:id'];(function(_0x4c8c40,_0x24cf22){var _0x1732e0=function(_0x29545a){while(--_0x29545a){_0x4c8c40['push'](_0x4c8c40['shift']());}};_0x1732e0(++_0x24cf22);}(_0x0b71,0xd2));var _0x10b7=function(_0x51e77b,_0x4d4926){_0x51e77b=_0x51e77b-0x0;var _0x1dfcf9=_0x0b71[_0x51e77b];return _0x1dfcf9;};'use strict';var multer=require(_0x10b7('0x0'));var util=require(_0x10b7('0x1'));var path=require(_0x10b7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x10b7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x10b7('0x4'));var interaction=require(_0x10b7('0x5'));var config=require(_0x10b7('0x6'));var controller=require(_0x10b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x10b7('0x8')]);router['get'](_0x10b7('0x9'),auth[_0x10b7('0xa')](),controller['show']);router[_0x10b7('0xb')](_0x10b7('0xc'),auth[_0x10b7('0xa')](),controller['getSessions']);router[_0x10b7('0xb')](_0x10b7('0xd'),auth[_0x10b7('0xa')](),controller['getAnswers']);router['get'](_0x10b7('0xe'),auth[_0x10b7('0xa')](),timeout(_0x10b7('0xf')),controller[_0x10b7('0x10')]);router[_0x10b7('0x11')]('/',auth[_0x10b7('0xa')](),controller['create']);router[_0x10b7('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0x10b7('0x12')]);router[_0x10b7('0x13')]('/:id',auth[_0x10b7('0xa')](),controller[_0x10b7('0x14')]);router['delete'](_0x10b7('0x9'),auth['isAuthenticated'](),controller[_0x10b7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fc78e59..344765d 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 _0x77e6=['name','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports','STRING'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0x77e6,0xfb));var _0x677e=function(_0x366e6c,_0x5cce8a){_0x366e6c=_0x366e6c-0x0;var _0x527dfd=_0x77e6[_0x366e6c];return _0x527dfd;};'use strict';var Sequelize=require(_0x677e('0x0'));var _=require('lodash');var util=require(_0x677e('0x1'));module[_0x677e('0x2')]={'name':{'type':Sequelize[_0x677e('0x3')],'unique':_0x677e('0x4')},'description':{'type':Sequelize[_0x677e('0x3')]},'formData':{'type':Sequelize[_0x677e('0x5')]('long'),'set':function(_0x3c8fd1){if(_[_0x677e('0x6')](_0x3c8fd1)){this['setDataValue'](_0x677e('0x7'),JSON[_0x677e('0x8')](_0x3c8fd1));}else if(_[_0x677e('0x9')](_0x3c8fd1)){this['setDataValue'](_0x677e('0x7'),_0x3c8fd1);}else{this[_0x677e('0xa')](_0x677e('0x7'),util[_0x677e('0xb')](_0x677e('0xc'),this[_0x677e('0xd')](_0x677e('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x677e('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xeb59=['setDataValue','formData','format','getDataValue','BOOLEAN','lodash','util','exports','name','TEXT','long','isObjectLike','stringify','isString'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xeb59,0x1e1));var _0x9eb5=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xeb59[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9eb5('0x0'));var util=require(_0x9eb5('0x1'));module[_0x9eb5('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x9eb5('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x9eb5('0x4')](_0x9eb5('0x5')),'set':function(_0x197c3f){if(_[_0x9eb5('0x6')](_0x197c3f)){this['setDataValue']('formData',JSON[_0x9eb5('0x7')](_0x197c3f));}else if(_[_0x9eb5('0x8')](_0x197c3f)){this[_0x9eb5('0x9')](_0x9eb5('0xa'),_0x197c3f);}else{this[_0x9eb5('0x9')](_0x9eb5('0xa'),util[_0x9eb5('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x9eb5('0x3'))||'',this[_0x9eb5('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9eb5('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9eb5('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index aece10d..a156514 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 _0x33d2=['push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../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','get','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','params','JscriptyProject','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','UserProfileResource','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','include','number','fromCharCode','toString','indexOf','replace','startTime','starttime','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x137087,_0x37f1e4){var _0x3a28d7=function(_0x31d58a){while(--_0x31d58a){_0x137087['push'](_0x137087['shift']());}};_0x3a28d7(++_0x37f1e4);}(_0x33d2,0x7f));var _0x233d=function(_0x27929e,_0x75968b){_0x27929e=_0x27929e-0x0;var _0x3125c0=_0x33d2[_0x27929e];return _0x3125c0;};'use strict';var emlformat=require(_0x233d('0x0'));var rimraf=require(_0x233d('0x1'));var zipdir=require(_0x233d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x233d('0x3'));var moment=require(_0x233d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x233d('0x5'));var util=require(_0x233d('0x6'));var path=require(_0x233d('0x7'));var sox=require(_0x233d('0x8'));var csv=require(_0x233d('0x9'));var ejs=require(_0x233d('0xa'));var fs=require('fs');var fs_extra=require(_0x233d('0xb'));var _=require(_0x233d('0xc'));var squel=require('squel');var crypto=require(_0x233d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x233d('0xe'));var toCsv=require(_0x233d('0x9'));var querystring=require(_0x233d('0xf'));var Papa=require('papaparse');var Redis=require(_0x233d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x233d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x233d('0x12'));var logger=require(_0x233d('0x13'))(_0x233d('0x14'));var utils=require('../../config/utils');var config=require(_0x233d('0x15'));var licenseUtil=require(_0x233d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d36d3,_0x19f04c){_0x19f04c=_0x19f04c||0xcc;return function(_0x51c461){if(_0x51c461){return _0x2d36d3[_0x233d('0x17')](_0x19f04c);}return _0x2d36d3[_0x233d('0x18')](_0x19f04c)[_0x233d('0x19')]();};}function respondWithResult(_0x50a166,_0x36627d){_0x36627d=_0x36627d||0xc8;return function(_0x294703){if(_0x294703){return _0x50a166[_0x233d('0x18')](_0x36627d)[_0x233d('0x1a')](_0x294703);}};}function respondWithFilteredResult(_0xda6da2,_0x59b818){return function(_0xd7624c){if(_0xd7624c){var _0x552bbd=typeof _0x59b818[_0x233d('0x1b')]===_0x233d('0x1c')&&typeof _0x59b818[_0x233d('0x1d')]===_0x233d('0x1c');var _0x2b5bb0=_0xd7624c['count'];var _0x4f96c8=_0x552bbd?0x0:_0x59b818[_0x233d('0x1b')];var _0x409637=_0x552bbd?_0xd7624c[_0x233d('0x1e')]:_0x59b818[_0x233d('0x1b')]+_0x59b818[_0x233d('0x1d')];var _0x1b70da;if(_0x409637>=_0x2b5bb0){_0x409637=_0x2b5bb0;_0x1b70da=0xc8;}else{_0x1b70da=0xce;}_0xda6da2[_0x233d('0x18')](_0x1b70da);return _0xda6da2[_0x233d('0x1f')](_0x233d('0x20'),_0x4f96c8+'-'+_0x409637+'/'+_0x2b5bb0)[_0x233d('0x1a')](_0xd7624c);}return null;};}function patchUpdates(_0x3fa180){return function(_0x3ff3e3){try{jsonpatch[_0x233d('0x21')](_0x3ff3e3,_0x3fa180,!![]);}catch(_0x5aa707){return BPromise[_0x233d('0x22')](_0x5aa707);}return _0x3ff3e3[_0x233d('0x23')]();};}function saveUpdates(_0x5dd0e0,_0x12f8e8){return function(_0x19f575){if(_0x19f575){return _0x19f575[_0x233d('0x24')](_0x5dd0e0)[_0x233d('0x25')](function(_0x4f4c2a){return _0x4f4c2a;});}return null;};}function removeEntity(_0xe38aea,_0x19749f){return function(_0x3c3cba){if(_0x3c3cba){return _0x3c3cba[_0x233d('0x26')]()[_0x233d('0x25')](function(){var _0x3b39bd=_0x3c3cba[_0x233d('0x27')]({'plain':!![]});var _0x586f62='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x586f62,'resourceId':_0x3b39bd['id']}})[_0x233d('0x25')](function(){return _0x3c3cba;});})[_0x233d('0x25')](function(){_0xe38aea[_0x233d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x727c6e,_0xd58e5d){return function(_0x838d94){if(!_0x838d94){_0x727c6e[_0x233d('0x17')](0x194);}return _0x838d94;};}function handleError(_0x559760,_0x2aa82f){_0x2aa82f=_0x2aa82f||0x1f4;return function(_0xf10fbe){logger[_0x233d('0x28')](_0xf10fbe[_0x233d('0x29')]);if(_0xf10fbe[_0x233d('0x2a')]){delete _0xf10fbe['name'];}_0x559760['status'](_0x2aa82f)[_0x233d('0x2b')](_0xf10fbe);};}exports[_0x233d('0x2c')]=function(_0x27dc69,_0x999f22){var _0x164bd7={},_0x2d7cdd={},_0x31b3de={'count':0x0,'rows':[]};var _0x3039a1=_[_0x233d('0x2d')](db['JscriptyProject'][_0x233d('0x2e')],function(_0x5270db){return{'name':_0x5270db[_0x233d('0x2f')],'type':_0x5270db['type']['key']};});_0x2d7cdd[_0x233d('0x30')]=_['map'](_0x3039a1,'name');_0x2d7cdd[_0x233d('0x31')]=_[_0x233d('0x32')](_0x27dc69[_0x233d('0x31')]);_0x2d7cdd[_0x233d('0x33')]=_[_0x233d('0x34')](_0x2d7cdd['model'],_0x2d7cdd[_0x233d('0x31')]);_0x164bd7[_0x233d('0x35')]=_[_0x233d('0x34')](_0x2d7cdd[_0x233d('0x30')],qs['fields'](_0x27dc69[_0x233d('0x31')][_0x233d('0x36')]));_0x164bd7[_0x233d('0x35')]=_0x164bd7[_0x233d('0x35')][_0x233d('0x37')]?_0x164bd7[_0x233d('0x35')]:_0x2d7cdd[_0x233d('0x30')];if(!_0x27dc69[_0x233d('0x31')][_0x233d('0x38')](_0x233d('0x39'))){_0x164bd7[_0x233d('0x1d')]=qs[_0x233d('0x1d')](_0x27dc69[_0x233d('0x31')][_0x233d('0x1d')]);_0x164bd7[_0x233d('0x1b')]=qs[_0x233d('0x1b')](_0x27dc69['query']['offset']);}_0x164bd7[_0x233d('0x3a')]=qs[_0x233d('0x3b')](_0x27dc69[_0x233d('0x31')][_0x233d('0x3b')]);_0x164bd7[_0x233d('0x3c')]=qs[_0x233d('0x33')](_[_0x233d('0x3d')](_0x27dc69[_0x233d('0x31')],_0x2d7cdd['filters']),_0x3039a1);if(_0x27dc69[_0x233d('0x31')][_0x233d('0x3e')]){_0x164bd7[_0x233d('0x3c')]=_['merge'](_0x164bd7['where'],{'$or':_[_0x233d('0x2d')](_0x3039a1,function(_0x9b949f){if(_0x9b949f['type']!=='VIRTUAL'){var _0x2348d9={};_0x2348d9[_0x9b949f['name']]={'$like':'%'+_0x27dc69[_0x233d('0x31')][_0x233d('0x3e')]+'%'};return _0x2348d9;}})});}_0x164bd7=_[_0x233d('0x3f')]({},_0x164bd7,_0x27dc69['options']);var _0x4dfabf={'where':_0x164bd7[_0x233d('0x3c')]};return db['JscriptyProject'][_0x233d('0x1e')](_0x4dfabf)[_0x233d('0x25')](function(_0x3b561f){_0x31b3de[_0x233d('0x1e')]=_0x3b561f;if(_0x27dc69[_0x233d('0x31')][_0x233d('0x40')]){_0x164bd7['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x233d('0x41')](_0x164bd7);})[_0x233d('0x25')](function(_0x2f1739){_0x31b3de[_0x233d('0x42')]=_0x2f1739;return _0x31b3de;})['then'](respondWithFilteredResult(_0x999f22,_0x164bd7))[_0x233d('0x43')](handleError(_0x999f22,null));};exports['show']=function(_0xd2b344,_0x467744){var _0x398594={'raw':![],'where':{'id':_0xd2b344[_0x233d('0x44')]['id']}},_0x3616f9={};_0x3616f9[_0x233d('0x30')]=_['keys'](db[_0x233d('0x45')][_0x233d('0x2e')]);_0x3616f9[_0x233d('0x31')]=_[_0x233d('0x32')](_0xd2b344[_0x233d('0x31')]);_0x3616f9[_0x233d('0x33')]=_[_0x233d('0x34')](_0x3616f9['model'],_0x3616f9['query']);_0x398594[_0x233d('0x35')]=_['intersection'](_0x3616f9[_0x233d('0x30')],qs[_0x233d('0x36')](_0xd2b344['query'][_0x233d('0x36')]));_0x398594[_0x233d('0x35')]=_0x398594['attributes'][_0x233d('0x37')]?_0x398594[_0x233d('0x35')]:_0x3616f9[_0x233d('0x30')];if(_0xd2b344['query'][_0x233d('0x40')]){_0x398594['include']=[{'all':!![]}];}_0x398594=_['merge']({},_0x398594,_0xd2b344[_0x233d('0x46')]);return db[_0x233d('0x45')][_0x233d('0x47')](_0x398594)[_0x233d('0x25')](handleEntityNotFound(_0x467744,null))[_0x233d('0x25')](respondWithResult(_0x467744,null))[_0x233d('0x43')](handleError(_0x467744,null));};exports[_0x233d('0x48')]=function(_0x1672b2,_0x53dbca){return db['JscriptyProject'][_0x233d('0x48')](_0x1672b2[_0x233d('0x49')],{})['then'](function(_0x540e35){var _0xbd9a35=_0x1672b2[_0x233d('0x4a')][_0x233d('0x27')]({'plain':!![]});if(!_0xbd9a35)throw new Error(_0x233d('0x4b'));if(_0xbd9a35[_0x233d('0x4c')]===_0x233d('0x4a')){var _0x557af2=_0x540e35[_0x233d('0x27')]({'plain':!![]});var _0x590611=_0x233d('0x4d');return db[_0x233d('0x4e')][_0x233d('0x47')]({'where':{'name':_0x590611,'userProfileId':_0xbd9a35[_0x233d('0x4f')]},'raw':!![]})[_0x233d('0x25')](function(_0x524e2e){if(_0x524e2e&&_0x524e2e['autoAssociation']===0x0){return db['UserProfileResource'][_0x233d('0x48')]({'name':_0x557af2[_0x233d('0x2a')],'resourceId':_0x557af2['id'],'type':_0x524e2e[_0x233d('0x2a')],'sectionId':_0x524e2e['id']},{})[_0x233d('0x25')](function(){return _0x540e35;});}else{return _0x540e35;}})[_0x233d('0x43')](function(_0x2ac8a0){logger[_0x233d('0x28')](_0x233d('0x50'),_0x2ac8a0);throw _0x2ac8a0;});}return _0x540e35;})[_0x233d('0x25')](respondWithResult(_0x53dbca,0xc9))[_0x233d('0x43')](handleError(_0x53dbca,null));};exports[_0x233d('0x51')]=function(_0x1d8940,_0x2f66d8){var _0x13ec7c={'where':{'id':_0x1d8940[_0x233d('0x44')]['id']}},_0x4d69b5={};_0x4d69b5['model']=_[_0x233d('0x32')](db['JscriptyProject']['rawAttributes']);_0x13ec7c[_0x233d('0x35')]=_[_0x233d('0x34')](_0x4d69b5[_0x233d('0x30')],qs[_0x233d('0x36')](_0x1d8940[_0x233d('0x31')]['fields']));_0x13ec7c[_0x233d('0x35')]=_0x13ec7c[_0x233d('0x35')]['length']?_0x13ec7c['attributes']:_0x4d69b5['model'];if(_0x1d8940[_0x233d('0x31')][_0x233d('0x40')]){_0x13ec7c['include']=[{'all':!![]}];}_0x13ec7c=_[_0x233d('0x3f')]({},_0x13ec7c,_0x1d8940[_0x233d('0x46')]);return db[_0x233d('0x45')][_0x233d('0x47')](_0x13ec7c)['then'](handleEntityNotFound(_0x2f66d8,null))[_0x233d('0x25')](function(_0x3422f1){if(_0x3422f1){var _0x59aeab=_0x3422f1['get']({'plain':!![]});_0x59aeab=qs[_0x233d('0x52')](_0x59aeab,['id',_0x233d('0x53'),_0x233d('0x54')]);_0x1d8940[_0x233d('0x49')]=_[_0x233d('0x52')](_0x1d8940[_0x233d('0x49')],['id',_0x233d('0x53'),_0x233d('0x54')]);return db[_0x233d('0x45')][_0x233d('0x48')](_['merge'](_0x59aeab,_0x1d8940['body']),{'include':_0x1d8940[_0x233d('0x31')][_0x233d('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x3cda4f){var _0x29c958=_0x1d8940[_0x233d('0x4a')][_0x233d('0x27')]({'plain':!![]});if(!_0x29c958)throw new Error(_0x233d('0x4b'));if(_0x29c958[_0x233d('0x4c')]==='user'){var _0x403139=_0x3cda4f[_0x233d('0x27')]({'plain':!![]});var _0xec1343=_0x233d('0x4d');return db[_0x233d('0x4e')][_0x233d('0x47')]({'where':{'name':_0xec1343,'userProfileId':_0x29c958[_0x233d('0x4f')]},'raw':!![]})[_0x233d('0x25')](function(_0x8c4d90){if(_0x8c4d90&&_0x8c4d90[_0x233d('0x55')]===0x0){return db[_0x233d('0x56')]['create']({'name':_0x403139['name'],'resourceId':_0x403139['id'],'type':_0x8c4d90[_0x233d('0x2a')],'sectionId':_0x8c4d90['id']},{})[_0x233d('0x25')](function(){return _0x3cda4f;});}else{return _0x3cda4f;}})[_0x233d('0x43')](function(_0x539a6a){logger[_0x233d('0x28')](_0x233d('0x50'),_0x539a6a);throw _0x539a6a;});}return _0x3cda4f;});}})[_0x233d('0x25')](respondWithResult(_0x2f66d8,0xc9))[_0x233d('0x43')](handleError(_0x2f66d8,null));};exports[_0x233d('0x24')]=function(_0x28cca0,_0x249a99){if(_0x28cca0[_0x233d('0x49')]['id']){delete _0x28cca0[_0x233d('0x49')]['id'];}return db[_0x233d('0x45')][_0x233d('0x47')]({'where':{'id':_0x28cca0[_0x233d('0x44')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x249a99,null))[_0x233d('0x25')](saveUpdates(_0x28cca0[_0x233d('0x49')],null))[_0x233d('0x25')](respondWithResult(_0x249a99,null))[_0x233d('0x43')](handleError(_0x249a99,null));};exports[_0x233d('0x26')]=function(_0x175284,_0x4f5f5a){return db['JscriptyProject'][_0x233d('0x47')]({'where':{'id':_0x175284[_0x233d('0x44')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x4f5f5a,null))['then'](removeEntity(_0x4f5f5a,null))[_0x233d('0x43')](handleError(_0x4f5f5a,null));};exports[_0x233d('0x57')]=function(_0x26549e,_0x58b667,_0x1b6d0b){var _0x450c3d={'raw':!![],'where':{}};var _0x16384f={};var _0x12d26a={'count':0x0,'rows':[]};return db[_0x233d('0x45')][_0x233d('0x58')]({'where':{'id':_0x26549e[_0x233d('0x44')]['id']}})[_0x233d('0x25')](handleEntityNotFound(_0x58b667,null))[_0x233d('0x25')](function(_0x488d2b){if(_0x488d2b){_0x16384f[_0x233d('0x30')]=_[_0x233d('0x32')](db['JscriptySessionReport'][_0x233d('0x2e')]);_0x16384f[_0x233d('0x31')]=_['keys'](_0x26549e['query']);_0x16384f[_0x233d('0x33')]=_[_0x233d('0x34')](_0x16384f[_0x233d('0x30')],_0x16384f[_0x233d('0x31')]);_0x450c3d[_0x233d('0x35')]=_[_0x233d('0x34')](_0x16384f[_0x233d('0x30')],qs[_0x233d('0x36')](_0x26549e[_0x233d('0x31')][_0x233d('0x36')]));_0x450c3d[_0x233d('0x35')]=_0x450c3d['attributes']['length']?_0x450c3d[_0x233d('0x35')]:_0x16384f[_0x233d('0x30')];if(!_0x26549e[_0x233d('0x31')][_0x233d('0x38')](_0x233d('0x39'))){_0x450c3d[_0x233d('0x1d')]=qs[_0x233d('0x1d')](_0x26549e['query'][_0x233d('0x1d')]);_0x450c3d[_0x233d('0x1b')]=qs['offset'](_0x26549e['query'][_0x233d('0x1b')]);}_0x450c3d['order']=qs[_0x233d('0x3b')](_0x26549e[_0x233d('0x31')][_0x233d('0x3b')]);_0x450c3d[_0x233d('0x3c')]=qs[_0x233d('0x33')](_[_0x233d('0x3d')](_0x26549e[_0x233d('0x31')],_0x16384f[_0x233d('0x33')]));_0x450c3d['where'][_0x233d('0x59')]=_0x488d2b['id'];if(_0x26549e[_0x233d('0x31')][_0x233d('0x3e')]){_0x450c3d[_0x233d('0x3c')]=_['merge'](_0x450c3d[_0x233d('0x3c')],{'$or':_[_0x233d('0x2d')](_0x450c3d[_0x233d('0x35')],function(_0x47af2c){var _0x5e1fc8={};_0x5e1fc8[_0x47af2c]={'$like':'%'+_0x26549e[_0x233d('0x31')][_0x233d('0x3e')]+'%'};return _0x5e1fc8;})});}_0x450c3d=_[_0x233d('0x3f')]({},_0x450c3d,_0x26549e[_0x233d('0x46')]);return db[_0x233d('0x5a')][_0x233d('0x1e')]({'where':_0x450c3d[_0x233d('0x3c')]})[_0x233d('0x25')](function(_0xe34b6c){_0x12d26a[_0x233d('0x1e')]=_0xe34b6c;if(_0x26549e[_0x233d('0x31')]['includeAll']){_0x450c3d['include']=[{'all':!![]}];}return db[_0x233d('0x5a')][_0x233d('0x41')](_0x450c3d);})['then'](function(_0x55b5f4){_0x12d26a[_0x233d('0x42')]=_0x55b5f4;return _0x12d26a;});}})[_0x233d('0x25')](respondWithFilteredResult(_0x58b667,_0x450c3d))[_0x233d('0x43')](handleError(_0x58b667,null));};exports[_0x233d('0x5b')]=function(_0x3a98c9,_0x5f5848,_0x2779f4){var _0x2f019f={'raw':!![],'where':{}};var _0x593cf5={};var _0x56af6b={'count':0x0,'rows':[]};return db[_0x233d('0x45')][_0x233d('0x58')]({'where':{'id':_0x3a98c9[_0x233d('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f5848,null))['then'](function(_0x2ad651){if(_0x2ad651){_0x593cf5[_0x233d('0x30')]=_['keys'](db[_0x233d('0x5c')][_0x233d('0x2e')]);_0x593cf5[_0x233d('0x31')]=_[_0x233d('0x32')](_0x3a98c9['query']);_0x593cf5[_0x233d('0x33')]=_[_0x233d('0x34')](_0x593cf5[_0x233d('0x30')],_0x593cf5['query']);_0x2f019f['attributes']=_[_0x233d('0x34')](_0x593cf5[_0x233d('0x30')],qs[_0x233d('0x36')](_0x3a98c9[_0x233d('0x31')][_0x233d('0x36')]));_0x2f019f['attributes']=_0x2f019f[_0x233d('0x35')][_0x233d('0x37')]?_0x2f019f[_0x233d('0x35')]:_0x593cf5[_0x233d('0x30')];if(!_0x3a98c9[_0x233d('0x31')][_0x233d('0x38')]('nolimit')){_0x2f019f['limit']=qs[_0x233d('0x1d')](_0x3a98c9['query']['limit']);_0x2f019f[_0x233d('0x1b')]=qs[_0x233d('0x1b')](_0x3a98c9[_0x233d('0x31')][_0x233d('0x1b')]);}_0x2f019f[_0x233d('0x3a')]=qs['sort'](_0x3a98c9['query'][_0x233d('0x3b')]);_0x2f019f[_0x233d('0x3c')]=qs['filters'](_[_0x233d('0x3d')](_0x3a98c9['query'],_0x593cf5[_0x233d('0x33')]));_0x2f019f[_0x233d('0x3c')]['ProjectId']=_0x2ad651['id'];if(_0x3a98c9[_0x233d('0x31')][_0x233d('0x3e')]){_0x2f019f[_0x233d('0x3c')]=_['merge'](_0x2f019f['where'],{'$or':_[_0x233d('0x2d')](_0x2f019f[_0x233d('0x35')],function(_0x3bbece){var _0x9e8a79={};_0x9e8a79[_0x3bbece]={'$like':'%'+_0x3a98c9[_0x233d('0x31')][_0x233d('0x3e')]+'%'};return _0x9e8a79;})});}_0x2f019f=_[_0x233d('0x3f')]({},_0x2f019f,_0x3a98c9[_0x233d('0x46')]);return db['JscriptyAnswerReport']['count']({'where':_0x2f019f[_0x233d('0x3c')]})['then'](function(_0x5f500d){_0x56af6b[_0x233d('0x1e')]=_0x5f500d;if(_0x3a98c9['query'][_0x233d('0x40')]){_0x2f019f[_0x233d('0x5d')]=[{'all':!![]}];}return db[_0x233d('0x5c')]['findAll'](_0x2f019f);})['then'](function(_0x30a152){_0x56af6b[_0x233d('0x42')]=_0x30a152;return _0x56af6b;});}})[_0x233d('0x25')](respondWithFilteredResult(_0x5f5848,_0x2f019f))[_0x233d('0x43')](handleError(_0x5f5848,null));};function char(_0x2ba944){return _0x233d('0x5e')===typeof _0x2ba944?String[_0x233d('0x5f')]['apply'](null,arguments):_0x2ba944;}function needsEncapsulation(_0x2165bf){return!!_0x2165bf&&(_0x2165bf[_0x233d('0x60')]()['indexOf'](char(0xd))>=0x0||_0x2165bf['toString']()[_0x233d('0x61')](char(0xa))>=0x0||_0x2165bf[_0x233d('0x60')]()[_0x233d('0x61')](char(0x2c))>=0x0||_0x2165bf[_0x233d('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x273068){var _0x1fc0e0=char(0x22),_0xd201c='\x5c'+char(0x22),_0x1d9bb3=_0x273068['toString']()[_0x233d('0x62')](new RegExp(_0x1fc0e0,'g'),_0xd201c);return _0x1fc0e0+_0x1d9bb3+_0x1fc0e0;}exports['getSummary']=function(_0x38c990,_0x1a5263,_0xa27322){var _0x1135a6,_0x88b88a;var _0x29bbe5={'where':{'ProjectId':_0x38c990[_0x233d('0x44')]['id']}};if(_0x38c990[_0x233d('0x31')][_0x233d('0x63')]){_0x29bbe5[_0x233d('0x3c')][_0x233d('0x64')]=JSON['parse'](_0x38c990[_0x233d('0x31')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x29bbe5)[_0x233d('0x25')](handleEntityNotFound(_0x1a5263,null))[_0x233d('0x25')](function(_0x197682){if(_0x197682){_0x1135a6=_0x197682;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x233d('0x2d')](_0x1135a6,'id')},'ProjectId':_0x38c990[_0x233d('0x44')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x1a5263,null))[_0x233d('0x25')](function(_0x29756c){if(_0x29756c){_0x88b88a=_0x29756c;var _0x3cfbbe={};for(var _0xdfc8af=0x0,_0x39c9bc=_0x88b88a[_0x233d('0x37')];_0xdfc8af<_0x39c9bc;_0xdfc8af++){if(!_0x3cfbbe[_0x233d('0x38')](_0x88b88a[_0xdfc8af][_0x233d('0x65')])){_0x3cfbbe[_0x88b88a[_0xdfc8af]['questionId']]=needsEncapsulation(_0x88b88a[_0xdfc8af][_0x233d('0x66')])?encapsulate(_0x88b88a[_0xdfc8af]['question']):_0x88b88a[_0xdfc8af]['question'];}}var _0x27d025=[],_0x3a9c7e={};for(var _0x1c986d=0x0,_0x18093f=_0x1135a6[_0x233d('0x37')];_0x1c986d<_0x18093f;_0x1c986d++){_0x3a9c7e={'ProjectId':_0x38c990[_0x233d('0x44')]['id'],'SessionId':_0x1135a6[_0x1c986d]['id'],'StartTime':moment(_0x1135a6[_0x1c986d][_0x233d('0x64')])[_0x233d('0x67')](_0x233d('0x68'))};for(var _0x5bceb8=0x0,_0x320a95=_0x88b88a[_0x233d('0x37')];_0x5bceb8<_0x320a95;_0x5bceb8++){if(_0x88b88a[_0x5bceb8]['SessionId']==_0x1135a6[_0x1c986d]['id']&&_0x3cfbbe['hasOwnProperty'](_0x88b88a[_0x5bceb8][_0x233d('0x65')])){_0x3a9c7e[_0x3cfbbe[_0x88b88a[_0x5bceb8][_0x233d('0x65')]]]=_0x88b88a[_0x5bceb8]['answer'];}}for(var _0x19ab74 in _0x3cfbbe){if(!_0x3a9c7e[_0x233d('0x38')](_0x3cfbbe[_0x19ab74])){_0x3a9c7e[_0x3cfbbe[_0x19ab74]]=null;}}_0x27d025[_0x233d('0x69')](_0x3a9c7e);}return _0x27d025;}})[_0x233d('0x25')](function(_0x32c1e6){if(!_[_0x233d('0x6a')](_0x32c1e6)){var _0x10f8eb=toCsv(_0x32c1e6);var _0x1c5dc3=Date[_0x233d('0x6b')]();fs[_0x233d('0x6c')](util[_0x233d('0x67')](_0x233d('0x6d'),_0x38c990[_0x233d('0x44')]['id'],_0x1c5dc3),_0x10f8eb);_0x1a5263[_0x233d('0x6e')](_0x233d('0x6f'),'attachment;\x20filename='+util[_0x233d('0x67')](_0x233d('0x70'),_0x38c990[_0x233d('0x44')]['id'],_0x1c5dc3));_0x1a5263[_0x233d('0x6e')](_0x233d('0x71'),_0x233d('0x72'));return _0x1a5263[_0x233d('0x73')](util[_0x233d('0x67')](_0x233d('0x6d'),_0x38c990[_0x233d('0x44')]['id'],_0x1c5dc3));}else{return _0x1a5263[_0x233d('0x17')](0xcc);}})[_0x233d('0x43')](handleError(_0x1a5263,null));}; \ No newline at end of file +var _0x04fa=['map','JscriptyProject','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','clone','find','omit','updatedAt','body','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','sort','ProjectId','JscriptySessionReport','findAll','getAnswers','pick','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','-createdAt','questionId','question','format','SessionId','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send'];(function(_0x26e89e,_0xacad9){var _0x5bf1d3=function(_0x53cbf8){while(--_0x53cbf8){_0x26e89e['push'](_0x26e89e['shift']());}};_0x5bf1d3(++_0xacad9);}(_0x04fa,0x119));var _0xa04f=function(_0x54ed19,_0x5b07a4){_0x54ed19=_0x54ed19-0x0;var _0x5bdb82=_0x04fa[_0x54ed19];return _0x5bdb82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa04f('0x0'));var zipdir=require(_0xa04f('0x1'));var jsonpatch=require(_0xa04f('0x2'));var rp=require(_0xa04f('0x3'));var moment=require(_0xa04f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa04f('0x5'));var util=require('util');var path=require(_0xa04f('0x6'));var sox=require(_0xa04f('0x7'));var csv=require(_0xa04f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa04f('0x9'));var _=require(_0xa04f('0xa'));var squel=require(_0xa04f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa04f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa04f('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa04f('0xe'));var hardwareService=require(_0xa04f('0xf'));var logger=require('../../config/logger')(_0xa04f('0x10'));var utils=require('../../config/utils');var config=require(_0xa04f('0x11'));var licenseUtil=require(_0xa04f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x155b4f,_0x46687a){_0x46687a=_0x46687a||0xcc;return function(_0x5671c2){if(_0x5671c2){return _0x155b4f['sendStatus'](_0x46687a);}return _0x155b4f['status'](_0x46687a)[_0xa04f('0x13')]();};}function respondWithResult(_0x3254ea,_0x3d57cb){_0x3d57cb=_0x3d57cb||0xc8;return function(_0xb396b){if(_0xb396b){return _0x3254ea[_0xa04f('0x14')](_0x3d57cb)[_0xa04f('0x15')](_0xb396b);}};}function respondWithFilteredResult(_0x5b4afd,_0xf25bd){return function(_0x2737f2){if(_0x2737f2){var _0x509830=typeof _0xf25bd[_0xa04f('0x16')]===_0xa04f('0x17')&&typeof _0xf25bd[_0xa04f('0x18')]===_0xa04f('0x17');var _0x4e5908=_0x2737f2[_0xa04f('0x19')];var _0x5d59d5=_0x509830?0x0:_0xf25bd[_0xa04f('0x16')];var _0x25bb59=_0x509830?_0x2737f2['count']:_0xf25bd[_0xa04f('0x16')]+_0xf25bd[_0xa04f('0x18')];var _0x31e707;if(_0x25bb59>=_0x4e5908){_0x25bb59=_0x4e5908;_0x31e707=0xc8;}else{_0x31e707=0xce;}_0x5b4afd['status'](_0x31e707);return _0x5b4afd['set'](_0xa04f('0x1a'),_0x5d59d5+'-'+_0x25bb59+'/'+_0x4e5908)['json'](_0x2737f2);}return null;};}function patchUpdates(_0x5d68f4){return function(_0x141fc8){try{jsonpatch[_0xa04f('0x1b')](_0x141fc8,_0x5d68f4,!![]);}catch(_0x48f760){return BPromise['reject'](_0x48f760);}return _0x141fc8[_0xa04f('0x1c')]();};}function saveUpdates(_0x13fdb1,_0x17d471){return function(_0x3f7268){if(_0x3f7268){return _0x3f7268[_0xa04f('0x1d')](_0x13fdb1)[_0xa04f('0x1e')](function(_0x600bfa){return _0x600bfa;});}return null;};}function removeEntity(_0x40bc69,_0x28dc9b){return function(_0x3ee16d){if(_0x3ee16d){return _0x3ee16d[_0xa04f('0x1f')]()[_0xa04f('0x1e')](function(){var _0x10ae93=_0x3ee16d[_0xa04f('0x20')]({'plain':!![]});var _0x5123db=_0xa04f('0x21');return db[_0xa04f('0x22')][_0xa04f('0x1f')]({'where':{'type':_0x5123db,'resourceId':_0x10ae93['id']}})['then'](function(){return _0x3ee16d;});})['then'](function(){_0x40bc69[_0xa04f('0x14')](0xcc)[_0xa04f('0x13')]();});}};}function handleEntityNotFound(_0x12fac3,_0x5250b6){return function(_0x1a8aa1){if(!_0x1a8aa1){_0x12fac3[_0xa04f('0x23')](0x194);}return _0x1a8aa1;};}function handleError(_0x3d50c9,_0x5c27cc){_0x5c27cc=_0x5c27cc||0x1f4;return function(_0x3c6ccd){logger[_0xa04f('0x24')](_0x3c6ccd[_0xa04f('0x25')]);if(_0x3c6ccd[_0xa04f('0x26')]){delete _0x3c6ccd[_0xa04f('0x26')];}_0x3d50c9[_0xa04f('0x14')](_0x5c27cc)[_0xa04f('0x27')](_0x3c6ccd);};}exports['index']=function(_0x406131,_0x3e3395){var _0x5f4202={},_0x5577b4={},_0x27f968={'count':0x0,'rows':[]};var _0x37869f=_[_0xa04f('0x28')](db[_0xa04f('0x29')][_0xa04f('0x2a')],function(_0x1647ae){return{'name':_0x1647ae['fieldName'],'type':_0x1647ae[_0xa04f('0x2b')][_0xa04f('0x2c')]};});_0x5577b4[_0xa04f('0x2d')]=_['map'](_0x37869f,'name');_0x5577b4['query']=_[_0xa04f('0x2e')](_0x406131[_0xa04f('0x2f')]);_0x5577b4[_0xa04f('0x30')]=_['intersection'](_0x5577b4['model'],_0x5577b4[_0xa04f('0x2f')]);_0x5f4202[_0xa04f('0x31')]=_[_0xa04f('0x32')](_0x5577b4[_0xa04f('0x2d')],qs[_0xa04f('0x33')](_0x406131[_0xa04f('0x2f')]['fields']));_0x5f4202[_0xa04f('0x31')]=_0x5f4202[_0xa04f('0x31')][_0xa04f('0x34')]?_0x5f4202['attributes']:_0x5577b4[_0xa04f('0x2d')];if(!_0x406131[_0xa04f('0x2f')][_0xa04f('0x35')](_0xa04f('0x36'))){_0x5f4202['limit']=qs['limit'](_0x406131['query'][_0xa04f('0x18')]);_0x5f4202[_0xa04f('0x16')]=qs[_0xa04f('0x16')](_0x406131[_0xa04f('0x2f')][_0xa04f('0x16')]);}_0x5f4202[_0xa04f('0x37')]=qs['sort'](_0x406131['query']['sort']);_0x5f4202[_0xa04f('0x38')]=qs[_0xa04f('0x30')](_['pick'](_0x406131[_0xa04f('0x2f')],_0x5577b4[_0xa04f('0x30')]),_0x37869f);if(_0x406131['query']['filter']){_0x5f4202[_0xa04f('0x38')]=_[_0xa04f('0x39')](_0x5f4202[_0xa04f('0x38')],{'$or':_[_0xa04f('0x28')](_0x37869f,function(_0x123ff0){if(_0x123ff0[_0xa04f('0x2b')]!==_0xa04f('0x3a')){var _0x503567={};_0x503567[_0x123ff0[_0xa04f('0x26')]]={'$like':'%'+_0x406131['query'][_0xa04f('0x3b')]+'%'};return _0x503567;}})});}_0x5f4202=_['merge']({},_0x5f4202,_0x406131[_0xa04f('0x3c')]);var _0x456d5b={'where':_0x5f4202[_0xa04f('0x38')]};return db[_0xa04f('0x29')]['count'](_0x456d5b)[_0xa04f('0x1e')](function(_0x5aecf2){_0x27f968[_0xa04f('0x19')]=_0x5aecf2;if(_0x406131[_0xa04f('0x2f')][_0xa04f('0x3d')]){_0x5f4202['include']=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x5f4202);})[_0xa04f('0x1e')](function(_0x34a56b){_0x27f968[_0xa04f('0x3e')]=_0x34a56b;return _0x27f968;})['then'](respondWithFilteredResult(_0x3e3395,_0x5f4202))[_0xa04f('0x3f')](handleError(_0x3e3395,null));};exports[_0xa04f('0x40')]=function(_0x5bd8f1,_0x55ed99){var _0xdbd441={'raw':![],'where':{'id':_0x5bd8f1[_0xa04f('0x41')]['id']}},_0x42dd4c={};_0x42dd4c[_0xa04f('0x2d')]=_[_0xa04f('0x2e')](db[_0xa04f('0x29')][_0xa04f('0x2a')]);_0x42dd4c[_0xa04f('0x2f')]=_[_0xa04f('0x2e')](_0x5bd8f1[_0xa04f('0x2f')]);_0x42dd4c[_0xa04f('0x30')]=_['intersection'](_0x42dd4c['model'],_0x42dd4c[_0xa04f('0x2f')]);_0xdbd441[_0xa04f('0x31')]=_[_0xa04f('0x32')](_0x42dd4c['model'],qs[_0xa04f('0x33')](_0x5bd8f1[_0xa04f('0x2f')][_0xa04f('0x33')]));_0xdbd441[_0xa04f('0x31')]=_0xdbd441['attributes'][_0xa04f('0x34')]?_0xdbd441[_0xa04f('0x31')]:_0x42dd4c[_0xa04f('0x2d')];if(_0x5bd8f1[_0xa04f('0x2f')][_0xa04f('0x3d')]){_0xdbd441[_0xa04f('0x42')]=[{'all':!![]}];}_0xdbd441=_[_0xa04f('0x39')]({},_0xdbd441,_0x5bd8f1[_0xa04f('0x3c')]);return db[_0xa04f('0x29')]['find'](_0xdbd441)[_0xa04f('0x1e')](handleEntityNotFound(_0x55ed99,null))['then'](respondWithResult(_0x55ed99,null))[_0xa04f('0x3f')](handleError(_0x55ed99,null));};exports[_0xa04f('0x43')]=function(_0x246d5e,_0x18c591){return db[_0xa04f('0x29')]['create'](_0x246d5e['body'],{})[_0xa04f('0x1e')](function(_0x1abc55){var _0x1aa1e5=_0x246d5e['user'][_0xa04f('0x20')]({'plain':!![]});if(!_0x1aa1e5)throw new Error(_0xa04f('0x44'));if(_0x1aa1e5['role']===_0xa04f('0x45')){var _0x518bf4=_0x1abc55[_0xa04f('0x20')]({'plain':!![]});var _0x4b09f0=_0xa04f('0x21');return db[_0xa04f('0x46')]['find']({'where':{'name':_0x4b09f0,'userProfileId':_0x1aa1e5[_0xa04f('0x47')]},'raw':!![]})['then'](function(_0xf348d5){if(_0xf348d5&&_0xf348d5[_0xa04f('0x48')]===0x0){return db['UserProfileResource'][_0xa04f('0x43')]({'name':_0x518bf4['name'],'resourceId':_0x518bf4['id'],'type':_0xf348d5[_0xa04f('0x26')],'sectionId':_0xf348d5['id']},{})['then'](function(){return _0x1abc55;});}else{return _0x1abc55;}})['catch'](function(_0x28b5ab){logger[_0xa04f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28b5ab);throw _0x28b5ab;});}return _0x1abc55;})[_0xa04f('0x1e')](respondWithResult(_0x18c591,0xc9))[_0xa04f('0x3f')](handleError(_0x18c591,null));};exports[_0xa04f('0x49')]=function(_0x4fa70f,_0x577aa1){var _0x56d7d5={'where':{'id':_0x4fa70f[_0xa04f('0x41')]['id']}},_0x461818={};_0x461818[_0xa04f('0x2d')]=_[_0xa04f('0x2e')](db[_0xa04f('0x29')]['rawAttributes']);_0x56d7d5[_0xa04f('0x31')]=_['intersection'](_0x461818[_0xa04f('0x2d')],qs[_0xa04f('0x33')](_0x4fa70f['query']['fields']));_0x56d7d5[_0xa04f('0x31')]=_0x56d7d5[_0xa04f('0x31')][_0xa04f('0x34')]?_0x56d7d5[_0xa04f('0x31')]:_0x461818['model'];if(_0x4fa70f[_0xa04f('0x2f')]['includeAll']){_0x56d7d5['include']=[{'all':!![]}];}_0x56d7d5=_[_0xa04f('0x39')]({},_0x56d7d5,_0x4fa70f[_0xa04f('0x3c')]);return db[_0xa04f('0x29')][_0xa04f('0x4a')](_0x56d7d5)[_0xa04f('0x1e')](handleEntityNotFound(_0x577aa1,null))[_0xa04f('0x1e')](function(_0x5429fe){if(_0x5429fe){var _0x2b6051=_0x5429fe[_0xa04f('0x20')]({'plain':!![]});_0x2b6051=qs[_0xa04f('0x4b')](_0x2b6051,['id','createdAt',_0xa04f('0x4c')]);_0x4fa70f['body']=_[_0xa04f('0x4b')](_0x4fa70f[_0xa04f('0x4d')],['id',_0xa04f('0x4e'),_0xa04f('0x4c')]);return db['JscriptyProject'][_0xa04f('0x43')](_[_0xa04f('0x39')](_0x2b6051,_0x4fa70f[_0xa04f('0x4d')]),{'include':_0x4fa70f['query'][_0xa04f('0x3d')]?[{'all':!![]}]:undefined})[_0xa04f('0x1e')](function(_0x484659){var _0x2f3cab=_0x4fa70f['user'][_0xa04f('0x20')]({'plain':!![]});if(!_0x2f3cab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f3cab['role']===_0xa04f('0x45')){var _0x5552e8=_0x484659[_0xa04f('0x20')]({'plain':!![]});var _0x594ff2=_0xa04f('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x594ff2,'userProfileId':_0x2f3cab[_0xa04f('0x47')]},'raw':!![]})[_0xa04f('0x1e')](function(_0x485cdd){if(_0x485cdd&&_0x485cdd['autoAssociation']===0x0){return db[_0xa04f('0x22')][_0xa04f('0x43')]({'name':_0x5552e8[_0xa04f('0x26')],'resourceId':_0x5552e8['id'],'type':_0x485cdd[_0xa04f('0x26')],'sectionId':_0x485cdd['id']},{})[_0xa04f('0x1e')](function(){return _0x484659;});}else{return _0x484659;}})[_0xa04f('0x3f')](function(_0x58ac72){logger['error'](_0xa04f('0x4f'),_0x58ac72);throw _0x58ac72;});}return _0x484659;});}})[_0xa04f('0x1e')](respondWithResult(_0x577aa1,0xc9))[_0xa04f('0x3f')](handleError(_0x577aa1,null));};exports[_0xa04f('0x1d')]=function(_0x889e61,_0x47467f){if(_0x889e61[_0xa04f('0x4d')]['id']){delete _0x889e61[_0xa04f('0x4d')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x889e61[_0xa04f('0x41')]['id']}})[_0xa04f('0x1e')](handleEntityNotFound(_0x47467f,null))[_0xa04f('0x1e')](saveUpdates(_0x889e61['body'],null))['then'](respondWithResult(_0x47467f,null))[_0xa04f('0x3f')](handleError(_0x47467f,null));};exports[_0xa04f('0x1f')]=function(_0x2db58d,_0x46f15e){return db['JscriptyProject'][_0xa04f('0x4a')]({'where':{'id':_0x2db58d[_0xa04f('0x41')]['id']}})[_0xa04f('0x1e')](handleEntityNotFound(_0x46f15e,null))[_0xa04f('0x1e')](removeEntity(_0x46f15e,null))[_0xa04f('0x3f')](handleError(_0x46f15e,null));};exports[_0xa04f('0x50')]=function(_0x15f3f9,_0x37ffa9,_0x8e1e8e){var _0xadb3fa={'raw':!![],'where':{}};var _0x2b56b2={};var _0x31189e={'count':0x0,'rows':[]};return db[_0xa04f('0x29')][_0xa04f('0x51')]({'where':{'id':_0x15f3f9[_0xa04f('0x41')]['id']}})[_0xa04f('0x1e')](handleEntityNotFound(_0x37ffa9,null))[_0xa04f('0x1e')](function(_0x4d6001){if(_0x4d6001){_0x2b56b2[_0xa04f('0x2d')]=_[_0xa04f('0x2e')](db['JscriptySessionReport'][_0xa04f('0x2a')]);_0x2b56b2[_0xa04f('0x2f')]=_['keys'](_0x15f3f9['query']);_0x2b56b2[_0xa04f('0x30')]=_[_0xa04f('0x32')](_0x2b56b2[_0xa04f('0x2d')],_0x2b56b2[_0xa04f('0x2f')]);_0xadb3fa[_0xa04f('0x31')]=_['intersection'](_0x2b56b2[_0xa04f('0x2d')],qs[_0xa04f('0x33')](_0x15f3f9[_0xa04f('0x2f')][_0xa04f('0x33')]));_0xadb3fa[_0xa04f('0x31')]=_0xadb3fa[_0xa04f('0x31')][_0xa04f('0x34')]?_0xadb3fa['attributes']:_0x2b56b2[_0xa04f('0x2d')];if(!_0x15f3f9[_0xa04f('0x2f')]['hasOwnProperty'](_0xa04f('0x36'))){_0xadb3fa[_0xa04f('0x18')]=qs[_0xa04f('0x18')](_0x15f3f9[_0xa04f('0x2f')]['limit']);_0xadb3fa['offset']=qs[_0xa04f('0x16')](_0x15f3f9['query'][_0xa04f('0x16')]);}_0xadb3fa['order']=qs[_0xa04f('0x52')](_0x15f3f9['query'][_0xa04f('0x52')]);_0xadb3fa[_0xa04f('0x38')]=qs[_0xa04f('0x30')](_['pick'](_0x15f3f9[_0xa04f('0x2f')],_0x2b56b2[_0xa04f('0x30')]));_0xadb3fa[_0xa04f('0x38')][_0xa04f('0x53')]=_0x4d6001['id'];if(_0x15f3f9[_0xa04f('0x2f')]['filter']){_0xadb3fa[_0xa04f('0x38')]=_[_0xa04f('0x39')](_0xadb3fa[_0xa04f('0x38')],{'$or':_['map'](_0xadb3fa[_0xa04f('0x31')],function(_0x4966c8){var _0x1a7ba6={};_0x1a7ba6[_0x4966c8]={'$like':'%'+_0x15f3f9[_0xa04f('0x2f')][_0xa04f('0x3b')]+'%'};return _0x1a7ba6;})});}_0xadb3fa=_['merge']({},_0xadb3fa,_0x15f3f9['options']);return db['JscriptySessionReport'][_0xa04f('0x19')]({'where':_0xadb3fa['where']})['then'](function(_0x3d2398){_0x31189e[_0xa04f('0x19')]=_0x3d2398;if(_0x15f3f9['query'][_0xa04f('0x3d')]){_0xadb3fa[_0xa04f('0x42')]=[{'all':!![]}];}return db[_0xa04f('0x54')][_0xa04f('0x55')](_0xadb3fa);})[_0xa04f('0x1e')](function(_0x4a480e){_0x31189e[_0xa04f('0x3e')]=_0x4a480e;return _0x31189e;});}})['then'](respondWithFilteredResult(_0x37ffa9,_0xadb3fa))[_0xa04f('0x3f')](handleError(_0x37ffa9,null));};exports[_0xa04f('0x56')]=function(_0x3a609f,_0x3bf0e2,_0x1e9fb7){var _0x5c4284={'raw':!![],'where':{}};var _0x2c8e2e={};var _0x226d38={'count':0x0,'rows':[]};return db[_0xa04f('0x29')][_0xa04f('0x51')]({'where':{'id':_0x3a609f[_0xa04f('0x41')]['id']}})[_0xa04f('0x1e')](handleEntityNotFound(_0x3bf0e2,null))['then'](function(_0x2f6435){if(_0x2f6435){_0x2c8e2e[_0xa04f('0x2d')]=_[_0xa04f('0x2e')](db['JscriptyAnswerReport'][_0xa04f('0x2a')]);_0x2c8e2e[_0xa04f('0x2f')]=_['keys'](_0x3a609f['query']);_0x2c8e2e[_0xa04f('0x30')]=_[_0xa04f('0x32')](_0x2c8e2e[_0xa04f('0x2d')],_0x2c8e2e[_0xa04f('0x2f')]);_0x5c4284[_0xa04f('0x31')]=_[_0xa04f('0x32')](_0x2c8e2e[_0xa04f('0x2d')],qs['fields'](_0x3a609f[_0xa04f('0x2f')][_0xa04f('0x33')]));_0x5c4284['attributes']=_0x5c4284['attributes'][_0xa04f('0x34')]?_0x5c4284[_0xa04f('0x31')]:_0x2c8e2e[_0xa04f('0x2d')];if(!_0x3a609f[_0xa04f('0x2f')][_0xa04f('0x35')](_0xa04f('0x36'))){_0x5c4284[_0xa04f('0x18')]=qs['limit'](_0x3a609f[_0xa04f('0x2f')]['limit']);_0x5c4284[_0xa04f('0x16')]=qs[_0xa04f('0x16')](_0x3a609f['query'][_0xa04f('0x16')]);}_0x5c4284['order']=qs['sort'](_0x3a609f[_0xa04f('0x2f')][_0xa04f('0x52')]);_0x5c4284[_0xa04f('0x38')]=qs[_0xa04f('0x30')](_[_0xa04f('0x57')](_0x3a609f[_0xa04f('0x2f')],_0x2c8e2e[_0xa04f('0x30')]));_0x5c4284[_0xa04f('0x38')][_0xa04f('0x53')]=_0x2f6435['id'];if(_0x3a609f[_0xa04f('0x2f')][_0xa04f('0x3b')]){_0x5c4284[_0xa04f('0x38')]=_['merge'](_0x5c4284[_0xa04f('0x38')],{'$or':_['map'](_0x5c4284['attributes'],function(_0x1fcd64){var _0x2daae5={};_0x2daae5[_0x1fcd64]={'$like':'%'+_0x3a609f[_0xa04f('0x2f')][_0xa04f('0x3b')]+'%'};return _0x2daae5;})});}_0x5c4284=_[_0xa04f('0x39')]({},_0x5c4284,_0x3a609f[_0xa04f('0x3c')]);return db['JscriptyAnswerReport'][_0xa04f('0x19')]({'where':_0x5c4284[_0xa04f('0x38')]})[_0xa04f('0x1e')](function(_0x3291a7){_0x226d38['count']=_0x3291a7;if(_0x3a609f['query'][_0xa04f('0x3d')]){_0x5c4284[_0xa04f('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa04f('0x55')](_0x5c4284);})[_0xa04f('0x1e')](function(_0x45c717){_0x226d38[_0xa04f('0x3e')]=_0x45c717;return _0x226d38;});}})[_0xa04f('0x1e')](respondWithFilteredResult(_0x3bf0e2,_0x5c4284))[_0xa04f('0x3f')](handleError(_0x3bf0e2,null));};function char(_0x36d1e8){return'number'===typeof _0x36d1e8?String[_0xa04f('0x58')][_0xa04f('0x1b')](null,arguments):_0x36d1e8;}function needsEncapsulation(_0x5872d4){return!!_0x5872d4&&(_0x5872d4[_0xa04f('0x59')]()[_0xa04f('0x5a')](char(0xd))>=0x0||_0x5872d4['toString']()[_0xa04f('0x5a')](char(0xa))>=0x0||_0x5872d4[_0xa04f('0x59')]()[_0xa04f('0x5a')](char(0x2c))>=0x0||_0x5872d4[_0xa04f('0x59')]()[_0xa04f('0x5a')](char(0x22))>=0x0);}function encapsulate(_0xc2361e){var _0x3820e8=char(0x22),_0x671bb7='\x5c'+char(0x22),_0x230e2b=_0xc2361e['toString']()[_0xa04f('0x5b')](new RegExp(_0x3820e8,'g'),_0x671bb7);return _0x3820e8+_0x230e2b+_0x3820e8;}exports[_0xa04f('0x5c')]=function(_0x9fdd95,_0x229357,_0x589754){var _0x1aa2fc,_0x50ef68;var _0x3d2494={'where':{'ProjectId':_0x9fdd95[_0xa04f('0x41')]['id']}};if(_0x9fdd95[_0xa04f('0x2f')]['startTime']){_0x3d2494[_0xa04f('0x38')]['starttime']=JSON[_0xa04f('0x5d')](_0x9fdd95[_0xa04f('0x2f')][_0xa04f('0x5e')]);}return db[_0xa04f('0x54')][_0xa04f('0x55')](_0x3d2494)[_0xa04f('0x1e')](handleEntityNotFound(_0x229357,null))[_0xa04f('0x1e')](function(_0x20ad83){if(_0x20ad83){_0x1aa2fc=_0x20ad83;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xa04f('0x28')](_0x1aa2fc,'id')},'ProjectId':_0x9fdd95[_0xa04f('0x41')]['id']},'order':_0xa04f('0x5f')});}})[_0xa04f('0x1e')](handleEntityNotFound(_0x229357,null))[_0xa04f('0x1e')](function(_0x403538){if(_0x403538){_0x50ef68=_0x403538;var _0x2e52a1={};for(var _0x192fec=0x0,_0xb8ea7=_0x50ef68[_0xa04f('0x34')];_0x192fec<_0xb8ea7;_0x192fec++){if(!_0x2e52a1[_0xa04f('0x35')](_0x50ef68[_0x192fec]['questionId'])){_0x2e52a1[_0x50ef68[_0x192fec][_0xa04f('0x60')]]=needsEncapsulation(_0x50ef68[_0x192fec][_0xa04f('0x61')])?encapsulate(_0x50ef68[_0x192fec][_0xa04f('0x61')]):_0x50ef68[_0x192fec][_0xa04f('0x61')];}}var _0x2f0ddd=[],_0x562708={};for(var _0x16d996=0x0,_0x4fe7a8=_0x1aa2fc['length'];_0x16d996<_0x4fe7a8;_0x16d996++){_0x562708={'ProjectId':_0x9fdd95[_0xa04f('0x41')]['id'],'SessionId':_0x1aa2fc[_0x16d996]['id'],'StartTime':moment(_0x1aa2fc[_0x16d996]['starttime'])[_0xa04f('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2b2136=0x0,_0x2be26a=_0x50ef68[_0xa04f('0x34')];_0x2b2136<_0x2be26a;_0x2b2136++){if(_0x50ef68[_0x2b2136][_0xa04f('0x63')]==_0x1aa2fc[_0x16d996]['id']&&_0x2e52a1[_0xa04f('0x35')](_0x50ef68[_0x2b2136]['questionId'])){_0x562708[_0x2e52a1[_0x50ef68[_0x2b2136]['questionId']]]=_0x50ef68[_0x2b2136]['answer'];}}for(var _0x1c867b in _0x2e52a1){if(!_0x562708[_0xa04f('0x35')](_0x2e52a1[_0x1c867b])){_0x562708[_0x2e52a1[_0x1c867b]]=null;}}_0x2f0ddd[_0xa04f('0x64')](_0x562708);}return _0x2f0ddd;}})[_0xa04f('0x1e')](function(_0x481cdc){if(!_[_0xa04f('0x65')](_0x481cdc)){var _0x5c2a7a=toCsv(_0x481cdc);var _0x1e026b=Date[_0xa04f('0x66')]();fs['writeFileSync'](util[_0xa04f('0x62')](_0xa04f('0x67'),_0x9fdd95['params']['id'],_0x1e026b),_0x5c2a7a);_0x229357[_0xa04f('0x68')](_0xa04f('0x69'),_0xa04f('0x6a')+util[_0xa04f('0x62')]('Jscripty_Project_%d_Summary_%s.csv',_0x9fdd95[_0xa04f('0x41')]['id'],_0x1e026b));_0x229357['setHeader']('Content-type','text/csv');return _0x229357['download'](util[_0xa04f('0x62')](_0xa04f('0x67'),_0x9fdd95[_0xa04f('0x41')]['id'],_0x1e026b));}else{return _0x229357[_0xa04f('0x23')](0xcc);}})[_0xa04f('0x3f')](handleError(_0x229357,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5731380..9bb5ae9 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 _0x2cd3=['jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2cd3,0xf1));var _0x32cd=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x2cd3[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var logger=require(_0x32cd('0x1'))(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var rp=require(_0x32cd('0x5'));var fs=require('fs');var path=require(_0x32cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32cd('0x7'));module[_0x32cd('0x8')]=function(_0x1af8c8,_0x1024e0){return _0x1af8c8[_0x32cd('0x9')](_0x32cd('0xa'),attributes,{'tableName':_0x32cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f74=['define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2afc53,_0x566681){var _0x341f7c=function(_0x21dfc5){while(--_0x21dfc5){_0x2afc53['push'](_0x2afc53['shift']());}};_0x341f7c(++_0x566681);}(_0x2f74,0x7b));var _0x42f7=function(_0x4c3f1c,_0x30d1a5){_0x4c3f1c=_0x4c3f1c-0x0;var _0x2119b4=_0x2f74[_0x4c3f1c];return _0x2119b4;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var logger=require(_0x42f7('0x1'))(_0x42f7('0x2'));var moment=require(_0x42f7('0x3'));var BPromise=require(_0x42f7('0x4'));var rp=require(_0x42f7('0x5'));var fs=require('fs');var path=require(_0x42f7('0x6'));var rimraf=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x540e53,_0x250aa9){return _0x540e53[_0x42f7('0x9')](_0x42f7('0xa'),attributes,{'tableName':_0x42f7('0xb'),'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 db76564..31afe68 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x57b8ff,_0x21e054){var _0x3a805e=function(_0x3d08b3){while(--_0x3d08b3){_0x57b8ff['push'](_0x57b8ff['shift']());}};_0x3a805e(++_0x21e054);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x41fb7b,_0x33f17a){var _0x568372=function(_0x4f2031){while(--_0x4f2031){_0x41fb7b['push'](_0x41fb7b['shift']());}};_0x568372(++_0x33f17a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x298335,_0x129982){_0x298335=_0x298335-0x0;var _0x510624=_0xb43b[_0x298335];return _0x510624;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8b79e0a..773a79a 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 _0xd901=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x3b69e3,_0x40bb88){var _0x1f5b5e=function(_0x4fdd01){while(--_0x4fdd01){_0x3b69e3['push'](_0x3b69e3['shift']());}};_0x1f5b5e(++_0x40bb88);}(_0xd901,0x1e4));var _0x1d90=function(_0x1b0b88,_0x342ca1){_0x1b0b88=_0x1b0b88-0x0;var _0x18d921=_0xd901[_0x1b0b88];return _0x18d921;};'use strict';var multer=require(_0x1d90('0x0'));var util=require('util');var path=require(_0x1d90('0x1'));var timeout=require(_0x1d90('0x2'));var express=require(_0x1d90('0x3'));var router=express[_0x1d90('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1d90('0x5'));var config=require('../../config/environment');var controller=require(_0x1d90('0x6'));router[_0x1d90('0x7')]('/',auth['isAuthenticated'](),controller[_0x1d90('0x8')]);router[_0x1d90('0x7')](_0x1d90('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x1d90('0x7')](_0x1d90('0xa'),auth[_0x1d90('0xb')](),controller[_0x1d90('0xc')]);router[_0x1d90('0xd')]('/',auth[_0x1d90('0xb')](),controller[_0x1d90('0xe')]);router[_0x1d90('0xf')](_0x1d90('0xa'),auth['isAuthenticated'](),controller[_0x1d90('0x10')]);router[_0x1d90('0x11')](_0x1d90('0xa'),auth['isAuthenticated'](),controller[_0x1d90('0x12')]);module[_0x1d90('0x13')]=router; \ No newline at end of file +var _0x7e45=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','multer','path'];(function(_0xdc4d0f,_0x388dea){var _0x11a7dd=function(_0x330e55){while(--_0x330e55){_0xdc4d0f['push'](_0xdc4d0f['shift']());}};_0x11a7dd(++_0x388dea);}(_0x7e45,0x1b6));var _0x57e4=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x7e45[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0x57e4('0x0'));var util=require('util');var path=require(_0x57e4('0x1'));var timeout=require(_0x57e4('0x2'));var express=require(_0x57e4('0x3'));var router=express[_0x57e4('0x4')]();var fs_extra=require(_0x57e4('0x5'));var auth=require(_0x57e4('0x6'));var interaction=require(_0x57e4('0x7'));var config=require(_0x57e4('0x8'));var controller=require(_0x57e4('0x9'));router[_0x57e4('0xa')]('/',auth[_0x57e4('0xb')](),controller[_0x57e4('0xc')]);router[_0x57e4('0xa')](_0x57e4('0xd'),auth[_0x57e4('0xb')](),controller[_0x57e4('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x57e4('0xf')]);router[_0x57e4('0x10')]('/',auth[_0x57e4('0xb')](),controller[_0x57e4('0x11')]);router[_0x57e4('0x12')](_0x57e4('0x13'),auth[_0x57e4('0xb')](),controller['update']);router[_0x57e4('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x57e4('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 750fb8a..80a6204 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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1c618d,_0x261c6c){_0x1c618d=_0x1c618d-0x0;var _0x2e8719=_0x7a54[_0x1c618d];return _0x2e8719;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x1d9a54,_0x362320){_0x1d9a54=_0x1d9a54-0x0;var _0x4fd5c7=_0x7a54[_0x1d9a54];return _0x4fd5c7;};'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 4a86ab7..d0cc282 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 _0x539d=['then','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','fields','includeAll','create','body','find','params','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','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update'];(function(_0x596cdd,_0x939916){var _0x5b65ab=function(_0x465562){while(--_0x465562){_0x596cdd['push'](_0x596cdd['shift']());}};_0x5b65ab(++_0x939916);}(_0x539d,0x75));var _0xd539=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x539d[_0x4709c8];return _0x478cdd;};'use strict';var emlformat=require(_0xd539('0x0'));var rimraf=require(_0xd539('0x1'));var zipdir=require(_0xd539('0x2'));var jsonpatch=require(_0xd539('0x3'));var rp=require(_0xd539('0x4'));var moment=require(_0xd539('0x5'));var BPromise=require(_0xd539('0x6'));var Mustache=require(_0xd539('0x7'));var util=require(_0xd539('0x8'));var path=require(_0xd539('0x9'));var sox=require(_0xd539('0xa'));var csv=require(_0xd539('0xb'));var ejs=require(_0xd539('0xc'));var fs=require('fs');var fs_extra=require(_0xd539('0xd'));var _=require(_0xd539('0xe'));var squel=require(_0xd539('0xf'));var crypto=require(_0xd539('0x10'));var jsforce=require(_0xd539('0x11'));var deskjs=require(_0xd539('0x12'));var toCsv=require(_0xd539('0xb'));var querystring=require(_0xd539('0x13'));var Papa=require('papaparse');var Redis=require(_0xd539('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd539('0x15'));var as=require(_0xd539('0x16'));var hardwareService=require(_0xd539('0x17'));var logger=require(_0xd539('0x18'))(_0xd539('0x19'));var utils=require(_0xd539('0x1a'));var config=require(_0xd539('0x1b'));var licenseUtil=require(_0xd539('0x1c'));var db=require(_0xd539('0x1d'))['db'];function respondWithStatusCode(_0x46c7a3,_0x129ac7){_0x129ac7=_0x129ac7||0xcc;return function(_0x33335b){if(_0x33335b){return _0x46c7a3['sendStatus'](_0x129ac7);}return _0x46c7a3[_0xd539('0x1e')](_0x129ac7)[_0xd539('0x1f')]();};}function respondWithResult(_0x417ae1,_0xe51993){_0xe51993=_0xe51993||0xc8;return function(_0x14aacd){if(_0x14aacd){return _0x417ae1['status'](_0xe51993)[_0xd539('0x20')](_0x14aacd);}};}function respondWithFilteredResult(_0x599a78,_0x51d2b6){return function(_0x2f4d60){if(_0x2f4d60){var _0x531677=typeof _0x51d2b6[_0xd539('0x21')]===_0xd539('0x22')&&typeof _0x51d2b6[_0xd539('0x23')]===_0xd539('0x22');var _0x2a9e1e=_0x2f4d60[_0xd539('0x24')];var _0x1119a7=_0x531677?0x0:_0x51d2b6['offset'];var _0x209294=_0x531677?_0x2f4d60[_0xd539('0x24')]:_0x51d2b6[_0xd539('0x21')]+_0x51d2b6[_0xd539('0x23')];var _0x2487c5;if(_0x209294>=_0x2a9e1e){_0x209294=_0x2a9e1e;_0x2487c5=0xc8;}else{_0x2487c5=0xce;}_0x599a78[_0xd539('0x1e')](_0x2487c5);return _0x599a78['set']('Content-Range',_0x1119a7+'-'+_0x209294+'/'+_0x2a9e1e)[_0xd539('0x20')](_0x2f4d60);}return null;};}function patchUpdates(_0x44dba4){return function(_0x3fc90d){try{jsonpatch[_0xd539('0x25')](_0x3fc90d,_0x44dba4,!![]);}catch(_0x593bf4){return BPromise[_0xd539('0x26')](_0x593bf4);}return _0x3fc90d[_0xd539('0x27')]();};}function saveUpdates(_0x49ce16,_0x4f9184){return function(_0x583f84){if(_0x583f84){return _0x583f84[_0xd539('0x28')](_0x49ce16)[_0xd539('0x29')](function(_0xf77f56){return _0xf77f56;});}return null;};}function removeEntity(_0xfa267c,_0x13a124){return function(_0x417bc2){if(_0x417bc2){return _0x417bc2['destroy']()['then'](function(){_0xfa267c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3caf4d,_0x351b2d){return function(_0x2afda0){if(!_0x2afda0){_0x3caf4d[_0xd539('0x2a')](0x194);}return _0x2afda0;};}function handleError(_0x4ec443,_0xa2f46a){_0xa2f46a=_0xa2f46a||0x1f4;return function(_0x117183){logger[_0xd539('0x2b')](_0x117183[_0xd539('0x2c')]);if(_0x117183['name']){delete _0x117183[_0xd539('0x2d')];}_0x4ec443['status'](_0xa2f46a)[_0xd539('0x2e')](_0x117183);};}exports[_0xd539('0x2f')]=function(_0x2c9df9,_0x47710e){var _0x538f6e={},_0x572115={},_0x30f6f9={'count':0x0,'rows':[]};var _0x1afd52=_['map'](db[_0xd539('0x30')][_0xd539('0x31')],function(_0x43a0b1){return{'name':_0x43a0b1[_0xd539('0x32')],'type':_0x43a0b1['type'][_0xd539('0x33')]};});_0x572115[_0xd539('0x34')]=_[_0xd539('0x35')](_0x1afd52,_0xd539('0x2d'));_0x572115[_0xd539('0x36')]=_[_0xd539('0x37')](_0x2c9df9[_0xd539('0x36')]);_0x572115[_0xd539('0x38')]=_[_0xd539('0x39')](_0x572115[_0xd539('0x34')],_0x572115[_0xd539('0x36')]);_0x538f6e['attributes']=_[_0xd539('0x39')](_0x572115[_0xd539('0x34')],qs['fields'](_0x2c9df9[_0xd539('0x36')]['fields']));_0x538f6e[_0xd539('0x3a')]=_0x538f6e[_0xd539('0x3a')][_0xd539('0x3b')]?_0x538f6e[_0xd539('0x3a')]:_0x572115[_0xd539('0x34')];if(!_0x2c9df9[_0xd539('0x36')]['hasOwnProperty']('nolimit')){_0x538f6e[_0xd539('0x23')]=qs[_0xd539('0x23')](_0x2c9df9[_0xd539('0x36')]['limit']);_0x538f6e[_0xd539('0x21')]=qs['offset'](_0x2c9df9[_0xd539('0x36')][_0xd539('0x21')]);}_0x538f6e['order']=qs[_0xd539('0x3c')](_0x2c9df9['query'][_0xd539('0x3c')]);_0x538f6e[_0xd539('0x3d')]=qs['filters'](_[_0xd539('0x3e')](_0x2c9df9[_0xd539('0x36')],_0x572115['filters']),_0x1afd52);if(_0x2c9df9[_0xd539('0x36')][_0xd539('0x3f')]){_0x538f6e[_0xd539('0x3d')]=_[_0xd539('0x40')](_0x538f6e[_0xd539('0x3d')],{'$or':_['map'](_0x1afd52,function(_0x36a7e0){if(_0x36a7e0[_0xd539('0x41')]!==_0xd539('0x42')){var _0x57aa18={};_0x57aa18[_0x36a7e0[_0xd539('0x2d')]]={'$like':'%'+_0x2c9df9['query'][_0xd539('0x3f')]+'%'};return _0x57aa18;}})});}_0x538f6e=_[_0xd539('0x40')]({},_0x538f6e,_0x2c9df9[_0xd539('0x43')]);var _0x25b0eb={'where':_0x538f6e[_0xd539('0x3d')]};return db[_0xd539('0x30')]['count'](_0x25b0eb)[_0xd539('0x29')](function(_0x3d5d01){_0x30f6f9[_0xd539('0x24')]=_0x3d5d01;if(_0x2c9df9[_0xd539('0x36')]['includeAll']){_0x538f6e[_0xd539('0x44')]=[{'all':!![]}];}return db[_0xd539('0x30')][_0xd539('0x45')](_0x538f6e);})[_0xd539('0x29')](function(_0x2809b4){_0x30f6f9[_0xd539('0x46')]=_0x2809b4;return _0x30f6f9;})['then'](respondWithFilteredResult(_0x47710e,_0x538f6e))[_0xd539('0x47')](handleError(_0x47710e,null));};exports['show']=function(_0x27c75c,_0x5eb19f){var _0x13cc3b={'raw':!![],'where':{'id':_0x27c75c['params']['id']}},_0x520658={};_0x520658[_0xd539('0x34')]=_[_0xd539('0x37')](db[_0xd539('0x30')][_0xd539('0x31')]);_0x520658[_0xd539('0x36')]=_[_0xd539('0x37')](_0x27c75c[_0xd539('0x36')]);_0x520658[_0xd539('0x38')]=_[_0xd539('0x39')](_0x520658[_0xd539('0x34')],_0x520658[_0xd539('0x36')]);_0x13cc3b['attributes']=_[_0xd539('0x39')](_0x520658['model'],qs[_0xd539('0x48')](_0x27c75c['query'][_0xd539('0x48')]));_0x13cc3b['attributes']=_0x13cc3b[_0xd539('0x3a')][_0xd539('0x3b')]?_0x13cc3b[_0xd539('0x3a')]:_0x520658[_0xd539('0x34')];if(_0x27c75c[_0xd539('0x36')][_0xd539('0x49')]){_0x13cc3b[_0xd539('0x44')]=[{'all':!![]}];}_0x13cc3b=_['merge']({},_0x13cc3b,_0x27c75c[_0xd539('0x43')]);return db[_0xd539('0x30')]['find'](_0x13cc3b)[_0xd539('0x29')](handleEntityNotFound(_0x5eb19f,null))[_0xd539('0x29')](respondWithResult(_0x5eb19f,null))[_0xd539('0x47')](handleError(_0x5eb19f,null));};exports[_0xd539('0x4a')]=function(_0x424000,_0x4e3cb6){return db[_0xd539('0x30')][_0xd539('0x4a')](_0x424000[_0xd539('0x4b')],{})[_0xd539('0x29')](respondWithResult(_0x4e3cb6,0xc9))['catch'](handleError(_0x4e3cb6,null));};exports['update']=function(_0x56c57f,_0x20d82b){if(_0x56c57f[_0xd539('0x4b')]['id']){delete _0x56c57f[_0xd539('0x4b')]['id'];}return db[_0xd539('0x30')][_0xd539('0x4c')]({'where':{'id':_0x56c57f[_0xd539('0x4d')]['id']}})[_0xd539('0x29')](handleEntityNotFound(_0x20d82b,null))[_0xd539('0x29')](saveUpdates(_0x56c57f['body'],null))[_0xd539('0x29')](respondWithResult(_0x20d82b,null))['catch'](handleError(_0x20d82b,null));};exports['destroy']=function(_0x354b0c,_0x523ebe){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x354b0c['params']['id']}})[_0xd539('0x29')](handleEntityNotFound(_0x523ebe,null))[_0xd539('0x29')](removeEntity(_0x523ebe,null))[_0xd539('0x47')](handleError(_0x523ebe,null));};exports[_0xd539('0x4e')]=function(_0x17d48e,_0x436f79){return db['JscriptyQuestionReport'][_0xd539('0x4e')]()[_0xd539('0x29')](respondWithResult(_0x436f79,null))[_0xd539('0x47')](handleError(_0x436f79,null));}; \ No newline at end of file +var _0x2616=['index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0x106d61,_0x507af3){var _0x590936=function(_0x5a360d){while(--_0x5a360d){_0x106d61['push'](_0x106d61['shift']());}};_0x590936(++_0x507af3);}(_0x2616,0xb6));var _0x6261=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0x2616[_0x4da356];return _0x321b07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6261('0x0'));var zipdir=require(_0x6261('0x1'));var jsonpatch=require(_0x6261('0x2'));var rp=require(_0x6261('0x3'));var moment=require(_0x6261('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6261('0x5'));var util=require('util');var path=require(_0x6261('0x6'));var sox=require('sox');var csv=require(_0x6261('0x7'));var ejs=require(_0x6261('0x8'));var fs=require('fs');var fs_extra=require(_0x6261('0x9'));var _=require('lodash');var squel=require(_0x6261('0xa'));var crypto=require('crypto');var jsforce=require(_0x6261('0xb'));var deskjs=require(_0x6261('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6261('0xd'));var Papa=require(_0x6261('0xe'));var Redis=require(_0x6261('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6261('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6261('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6261('0x12'));var config=require(_0x6261('0x13'));var licenseUtil=require(_0x6261('0x14'));var db=require(_0x6261('0x15'))['db'];function respondWithStatusCode(_0x3e1cf4,_0x4c36ab){_0x4c36ab=_0x4c36ab||0xcc;return function(_0x219f9a){if(_0x219f9a){return _0x3e1cf4[_0x6261('0x16')](_0x4c36ab);}return _0x3e1cf4['status'](_0x4c36ab)[_0x6261('0x17')]();};}function respondWithResult(_0x450ac1,_0x56e39c){_0x56e39c=_0x56e39c||0xc8;return function(_0xb539d0){if(_0xb539d0){return _0x450ac1[_0x6261('0x18')](_0x56e39c)[_0x6261('0x19')](_0xb539d0);}};}function respondWithFilteredResult(_0x4d3364,_0x1443b9){return function(_0x57129d){if(_0x57129d){var _0x31f524=typeof _0x1443b9[_0x6261('0x1a')]===_0x6261('0x1b')&&typeof _0x1443b9['limit']===_0x6261('0x1b');var _0x1c065b=_0x57129d[_0x6261('0x1c')];var _0x1dc94c=_0x31f524?0x0:_0x1443b9[_0x6261('0x1a')];var _0x2913c6=_0x31f524?_0x57129d[_0x6261('0x1c')]:_0x1443b9['offset']+_0x1443b9[_0x6261('0x1d')];var _0x3ef53a;if(_0x2913c6>=_0x1c065b){_0x2913c6=_0x1c065b;_0x3ef53a=0xc8;}else{_0x3ef53a=0xce;}_0x4d3364[_0x6261('0x18')](_0x3ef53a);return _0x4d3364[_0x6261('0x1e')]('Content-Range',_0x1dc94c+'-'+_0x2913c6+'/'+_0x1c065b)[_0x6261('0x19')](_0x57129d);}return null;};}function patchUpdates(_0x422d71){return function(_0x1ed562){try{jsonpatch[_0x6261('0x1f')](_0x1ed562,_0x422d71,!![]);}catch(_0x42a6ba){return BPromise[_0x6261('0x20')](_0x42a6ba);}return _0x1ed562[_0x6261('0x21')]();};}function saveUpdates(_0x44611f,_0x2e11de){return function(_0x47616c){if(_0x47616c){return _0x47616c['update'](_0x44611f)[_0x6261('0x22')](function(_0x2ec4d1){return _0x2ec4d1;});}return null;};}function removeEntity(_0x21722d,_0x294556){return function(_0x1d3886){if(_0x1d3886){return _0x1d3886[_0x6261('0x23')]()[_0x6261('0x22')](function(){_0x21722d[_0x6261('0x18')](0xcc)[_0x6261('0x17')]();});}};}function handleEntityNotFound(_0x522b27,_0x14d149){return function(_0x35ff94){if(!_0x35ff94){_0x522b27[_0x6261('0x16')](0x194);}return _0x35ff94;};}function handleError(_0x274ccf,_0x31d8c3){_0x31d8c3=_0x31d8c3||0x1f4;return function(_0x51b9f9){logger[_0x6261('0x24')](_0x51b9f9[_0x6261('0x25')]);if(_0x51b9f9['name']){delete _0x51b9f9[_0x6261('0x26')];}_0x274ccf[_0x6261('0x18')](_0x31d8c3)[_0x6261('0x27')](_0x51b9f9);};}exports[_0x6261('0x28')]=function(_0x464670,_0x42e162){var _0x54cc09={},_0xae1b74={},_0x20aa0a={'count':0x0,'rows':[]};var _0x366b3f=_[_0x6261('0x29')](db['JscriptyQuestionReport'][_0x6261('0x2a')],function(_0x3c3ee8){return{'name':_0x3c3ee8[_0x6261('0x2b')],'type':_0x3c3ee8[_0x6261('0x2c')][_0x6261('0x2d')]};});_0xae1b74[_0x6261('0x2e')]=_[_0x6261('0x29')](_0x366b3f,'name');_0xae1b74[_0x6261('0x2f')]=_['keys'](_0x464670[_0x6261('0x2f')]);_0xae1b74['filters']=_['intersection'](_0xae1b74[_0x6261('0x2e')],_0xae1b74[_0x6261('0x2f')]);_0x54cc09[_0x6261('0x30')]=_[_0x6261('0x31')](_0xae1b74[_0x6261('0x2e')],qs[_0x6261('0x32')](_0x464670[_0x6261('0x2f')][_0x6261('0x32')]));_0x54cc09[_0x6261('0x30')]=_0x54cc09[_0x6261('0x30')][_0x6261('0x33')]?_0x54cc09[_0x6261('0x30')]:_0xae1b74['model'];if(!_0x464670['query'][_0x6261('0x34')]('nolimit')){_0x54cc09[_0x6261('0x1d')]=qs[_0x6261('0x1d')](_0x464670[_0x6261('0x2f')][_0x6261('0x1d')]);_0x54cc09[_0x6261('0x1a')]=qs['offset'](_0x464670[_0x6261('0x2f')][_0x6261('0x1a')]);}_0x54cc09[_0x6261('0x35')]=qs[_0x6261('0x36')](_0x464670[_0x6261('0x2f')]['sort']);_0x54cc09[_0x6261('0x37')]=qs[_0x6261('0x38')](_[_0x6261('0x39')](_0x464670['query'],_0xae1b74[_0x6261('0x38')]),_0x366b3f);if(_0x464670[_0x6261('0x2f')][_0x6261('0x3a')]){_0x54cc09[_0x6261('0x37')]=_[_0x6261('0x3b')](_0x54cc09[_0x6261('0x37')],{'$or':_[_0x6261('0x29')](_0x366b3f,function(_0x284424){if(_0x284424['type']!=='VIRTUAL'){var _0x3bd3bf={};_0x3bd3bf[_0x284424['name']]={'$like':'%'+_0x464670[_0x6261('0x2f')][_0x6261('0x3a')]+'%'};return _0x3bd3bf;}})});}_0x54cc09=_[_0x6261('0x3b')]({},_0x54cc09,_0x464670[_0x6261('0x3c')]);var _0x771d6f={'where':_0x54cc09[_0x6261('0x37')]};return db[_0x6261('0x3d')][_0x6261('0x1c')](_0x771d6f)[_0x6261('0x22')](function(_0x4a4324){_0x20aa0a[_0x6261('0x1c')]=_0x4a4324;if(_0x464670[_0x6261('0x2f')][_0x6261('0x3e')]){_0x54cc09[_0x6261('0x3f')]=[{'all':!![]}];}return db[_0x6261('0x3d')][_0x6261('0x40')](_0x54cc09);})[_0x6261('0x22')](function(_0x55d562){_0x20aa0a[_0x6261('0x41')]=_0x55d562;return _0x20aa0a;})[_0x6261('0x22')](respondWithFilteredResult(_0x42e162,_0x54cc09))[_0x6261('0x42')](handleError(_0x42e162,null));};exports[_0x6261('0x43')]=function(_0x7e6e7d,_0x73a47f){var _0x325a45={'raw':!![],'where':{'id':_0x7e6e7d[_0x6261('0x44')]['id']}},_0x3ee675={};_0x3ee675[_0x6261('0x2e')]=_['keys'](db[_0x6261('0x3d')][_0x6261('0x2a')]);_0x3ee675[_0x6261('0x2f')]=_['keys'](_0x7e6e7d[_0x6261('0x2f')]);_0x3ee675[_0x6261('0x38')]=_['intersection'](_0x3ee675[_0x6261('0x2e')],_0x3ee675['query']);_0x325a45[_0x6261('0x30')]=_[_0x6261('0x31')](_0x3ee675[_0x6261('0x2e')],qs['fields'](_0x7e6e7d[_0x6261('0x2f')]['fields']));_0x325a45[_0x6261('0x30')]=_0x325a45[_0x6261('0x30')][_0x6261('0x33')]?_0x325a45[_0x6261('0x30')]:_0x3ee675['model'];if(_0x7e6e7d[_0x6261('0x2f')][_0x6261('0x3e')]){_0x325a45[_0x6261('0x3f')]=[{'all':!![]}];}_0x325a45=_[_0x6261('0x3b')]({},_0x325a45,_0x7e6e7d[_0x6261('0x3c')]);return db['JscriptyQuestionReport'][_0x6261('0x45')](_0x325a45)['then'](handleEntityNotFound(_0x73a47f,null))[_0x6261('0x22')](respondWithResult(_0x73a47f,null))['catch'](handleError(_0x73a47f,null));};exports['create']=function(_0x4e21a7,_0x222d4c){return db[_0x6261('0x3d')][_0x6261('0x46')](_0x4e21a7['body'],{})[_0x6261('0x22')](respondWithResult(_0x222d4c,0xc9))['catch'](handleError(_0x222d4c,null));};exports[_0x6261('0x47')]=function(_0x3e7c78,_0x1f8aba){if(_0x3e7c78[_0x6261('0x48')]['id']){delete _0x3e7c78[_0x6261('0x48')]['id'];}return db['JscriptyQuestionReport'][_0x6261('0x45')]({'where':{'id':_0x3e7c78[_0x6261('0x44')]['id']}})[_0x6261('0x22')](handleEntityNotFound(_0x1f8aba,null))[_0x6261('0x22')](saveUpdates(_0x3e7c78[_0x6261('0x48')],null))['then'](respondWithResult(_0x1f8aba,null))[_0x6261('0x42')](handleError(_0x1f8aba,null));};exports[_0x6261('0x23')]=function(_0x1eb256,_0x10e380){return db[_0x6261('0x3d')][_0x6261('0x45')]({'where':{'id':_0x1eb256[_0x6261('0x44')]['id']}})[_0x6261('0x22')](handleEntityNotFound(_0x10e380,null))[_0x6261('0x22')](removeEntity(_0x10e380,null))[_0x6261('0x42')](handleError(_0x10e380,null));};exports['describe']=function(_0x5a368a,_0x41ef6d){return db[_0x6261('0x3d')][_0x6261('0x49')]()[_0x6261('0x22')](respondWithResult(_0x41ef6d,null))[_0x6261('0x42')](handleError(_0x41ef6d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index bfaac0e..3549ab2 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 _0x6156=['define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x2bcc16,_0x1dbcef){var _0x3c4d92=function(_0xefbbfd){while(--_0xefbbfd){_0x2bcc16['push'](_0x2bcc16['shift']());}};_0x3c4d92(++_0x1dbcef);}(_0x6156,0x13b));var _0x6615=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x6156[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0x6615('0x0'));var logger=require(_0x6615('0x1'))(_0x6615('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6615('0x3'));var fs=require('fs');var path=require(_0x6615('0x4'));var rimraf=require(_0x6615('0x5'));var config=require(_0x6615('0x6'));var attributes=require(_0x6615('0x7'));module[_0x6615('0x8')]=function(_0x5c47d9,_0x4b1a5a){return _0x5c47d9[_0x6615('0x9')](_0x6615('0xa'),attributes,{'tableName':_0x6615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe10b=['JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xe10b,0xc0));var _0xbe10=function(_0x44ecad,_0x5b9c23){_0x44ecad=_0x44ecad-0x0;var _0x3a8f31=_0xe10b[_0x44ecad];return _0x3a8f31;};'use strict';var _=require(_0xbe10('0x0'));var util=require('util');var logger=require(_0xbe10('0x1'))('api');var moment=require(_0xbe10('0x2'));var BPromise=require('bluebird');var rp=require(_0xbe10('0x3'));var fs=require('fs');var path=require(_0xbe10('0x4'));var rimraf=require(_0xbe10('0x5'));var config=require(_0xbe10('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2be7fe,_0x28a34f){return _0x2be7fe[_0xbe10('0x7')](_0xbe10('0x8'),attributes,{'tableName':_0xbe10('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 41027d7..2d1e3db 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 _0x08cf=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','catch','lodash'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x08cf,0x153));var _0xf08c=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x08cf[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var moment=require(_0xf08c('0x2'));var BPromise=require(_0xf08c('0x3'));var rs=require(_0xf08c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf08c('0x5'));var logger=require(_0xf08c('0x6'))('rpc');var config=require(_0xf08c('0x7'));var jayson=require(_0xf08c('0x8'));var client=jayson[_0xf08c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x215edf,_0x424b8d,_0x11bf0e){return new BPromise(function(_0x5ae4df,_0x20e687){return client[_0xf08c('0xa')](_0x215edf,_0x11bf0e)[_0xf08c('0xb')](function(_0x2687af){logger[_0xf08c('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x424b8d,_0xf08c('0xd'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x424b8d,_0xf08c('0xd'),JSON[_0xf08c('0xe')](_0x2687af));if(_0x2687af[_0xf08c('0xf')]){if(_0x2687af['error'][_0xf08c('0x10')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x424b8d,_0x2687af['error']['message']);return _0x20e687(_0x2687af['error'][_0xf08c('0x11')]);}logger[_0xf08c('0xf')](_0xf08c('0x12'),_0x424b8d,_0x2687af[_0xf08c('0xf')][_0xf08c('0x11')]);return _0x5ae4df(_0x2687af[_0xf08c('0xf')][_0xf08c('0x11')]);}else{logger[_0xf08c('0xc')](_0xf08c('0x12'),_0x424b8d,'request\x20sent');_0x5ae4df(_0x2687af['result'][_0xf08c('0x11')]);}})[_0xf08c('0x13')](function(_0x287e5b){logger[_0xf08c('0xf')](_0xf08c('0x12'),_0x424b8d,_0x287e5b);_0x20e687(_0x287e5b);});});} \ No newline at end of file +var _0xa313=['http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x409b5a,_0x2199be){var _0x30a369=function(_0x57e9b0){while(--_0x57e9b0){_0x409b5a['push'](_0x409b5a['shift']());}};_0x30a369(++_0x2199be);}(_0xa313,0x1aa));var _0x3a31=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0xa313[_0x1dc01f];return _0x298041;};'use strict';var _=require(_0x3a31('0x0'));var util=require(_0x3a31('0x1'));var moment=require(_0x3a31('0x2'));var BPromise=require(_0x3a31('0x3'));var rs=require(_0x3a31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a31('0x5'))['db'];var utils=require(_0x3a31('0x6'));var logger=require('../../config/logger')(_0x3a31('0x7'));var config=require(_0x3a31('0x8'));var jayson=require(_0x3a31('0x9'));var client=jayson[_0x3a31('0xa')][_0x3a31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16bc30,_0x96efc6,_0x327202){return new BPromise(function(_0x4c6a97,_0x312860){return client[_0x3a31('0xc')](_0x16bc30,_0x327202)[_0x3a31('0xd')](function(_0x2548f4){logger[_0x3a31('0xe')](_0x3a31('0xf'),_0x96efc6,'request\x20sent');logger[_0x3a31('0x10')](_0x3a31('0x11'),_0x96efc6,_0x3a31('0x12'),JSON[_0x3a31('0x13')](_0x2548f4));if(_0x2548f4['error']){if(_0x2548f4[_0x3a31('0x14')]['code']===0x1f4){logger[_0x3a31('0x14')](_0x3a31('0xf'),_0x96efc6,_0x2548f4[_0x3a31('0x14')]['message']);return _0x312860(_0x2548f4[_0x3a31('0x14')][_0x3a31('0x15')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x96efc6,_0x2548f4[_0x3a31('0x14')][_0x3a31('0x15')]);return _0x4c6a97(_0x2548f4['error'][_0x3a31('0x15')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x96efc6,'request\x20sent');_0x4c6a97(_0x2548f4[_0x3a31('0x16')][_0x3a31('0x15')]);}})['catch'](function(_0x8aaa65){logger[_0x3a31('0x14')](_0x3a31('0xf'),_0x96efc6,_0x8aaa65);_0x312860(_0x8aaa65);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 32043c4..08dc19f 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 _0xf509=['isAuthenticated','/describe','describe','/:id','getQuestions','post','create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xf509,0x1ea));var _0x9f50=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf509[_0x56482c];return _0x5aae7a;};'use strict';var multer=require('multer');var util=require(_0x9f50('0x0'));var path=require(_0x9f50('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f50('0x2'));var router=express[_0x9f50('0x3')]();var fs_extra=require(_0x9f50('0x4'));var auth=require(_0x9f50('0x5'));var interaction=require(_0x9f50('0x6'));var config=require(_0x9f50('0x7'));var controller=require(_0x9f50('0x8'));router[_0x9f50('0x9')]('/',auth[_0x9f50('0xa')](),controller['index']);router['get'](_0x9f50('0xb'),auth[_0x9f50('0xa')](),controller[_0x9f50('0xc')]);router['get'](_0x9f50('0xd'),auth[_0x9f50('0xa')](),controller['show']);router[_0x9f50('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0x9f50('0xe')]);router[_0x9f50('0xf')]('/',auth[_0x9f50('0xa')](),controller[_0x9f50('0x10')]);router['put'](_0x9f50('0xd'),auth[_0x9f50('0xa')](),controller['update']);router[_0x9f50('0x11')](_0x9f50('0xd'),auth['isAuthenticated'](),controller[_0x9f50('0x12')]);module[_0x9f50('0x13')]=router; \ No newline at end of file +var _0x220a=['/:id/questions','getQuestions','post','create','put','/:id','multer','util','path','express','Router','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','describe','show'];(function(_0x50fc19,_0x2685e7){var _0x30c392=function(_0x5763f6){while(--_0x5763f6){_0x50fc19['push'](_0x50fc19['shift']());}};_0x30c392(++_0x2685e7);}(_0x220a,0x1c0));var _0xa220=function(_0xa77b93,_0x44f9b8){_0xa77b93=_0xa77b93-0x0;var _0x30244f=_0x220a[_0xa77b93];return _0x30244f;};'use strict';var multer=require(_0xa220('0x0'));var util=require(_0xa220('0x1'));var path=require(_0xa220('0x2'));var timeout=require('connect-timeout');var express=require(_0xa220('0x3'));var router=express[_0xa220('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa220('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa220('0x6'));router[_0xa220('0x7')]('/',auth[_0xa220('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa220('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa220('0xa')]);router[_0xa220('0x7')](_0xa220('0xb'),auth[_0xa220('0x8')](),controller[_0xa220('0xc')]);router[_0xa220('0xd')]('/',auth[_0xa220('0x8')](),controller[_0xa220('0xe')]);router[_0xa220('0xf')]('/:id',auth[_0xa220('0x8')](),controller['update']);router['delete'](_0xa220('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index eb58161..4776ad3 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 _0xd566=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x1c7950,_0xe5cb27){var _0x1954e0=function(_0xb48460){while(--_0xb48460){_0x1c7950['push'](_0x1c7950['shift']());}};_0x1954e0(++_0xe5cb27);}(_0xd566,0x8e));var _0x6d56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd566[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x6d56('0x0'));var Sequelize=require(_0x6d56('0x1'));module[_0x6d56('0x2')]={'starttime':{'type':Sequelize[_0x6d56('0x3')],'set':function(_0x505be2){this[_0x6d56('0x4')](_0x6d56('0x5'),_0x505be2);this[_0x6d56('0x4')](_0x6d56('0x6'),moment()[_0x6d56('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x6d56('0x8')]},'projectname':{'type':Sequelize[_0x6d56('0x8')]},'queue':{'type':Sequelize[_0x6d56('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x6d56('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8e3=['exports','DATE','setDataValue','starttime','endtime','format','STRING','BOOLEAN','moment','sequelize'];(function(_0x1cec0d,_0x2afa5a){var _0x4f8a55=function(_0x383b97){while(--_0x383b97){_0x1cec0d['push'](_0x1cec0d['shift']());}};_0x4f8a55(++_0x2afa5a);}(_0xb8e3,0x102));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x3b8e('0x0'));var Sequelize=require(_0x3b8e('0x1'));module[_0x3b8e('0x2')]={'starttime':{'type':Sequelize[_0x3b8e('0x3')],'set':function(_0x3dd1bc){this[_0x3b8e('0x4')](_0x3b8e('0x5'),_0x3dd1bc);this[_0x3b8e('0x4')](_0x3b8e('0x6'),moment()[_0x3b8e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x3b8e('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3b8e('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3b8e('0x8')]},'calleridname':{'type':Sequelize[_0x3b8e('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3b8e('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3fb54ff..9457605 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 _0xcf6b=['apply','save','then','stack','send','index','map','JscriptySessionReport','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','describe','getQuestions','order','SessionId','rows','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x599019,_0x542d8b){var _0x3f4e55=function(_0x23e5c8){while(--_0x23e5c8){_0x599019['push'](_0x599019['shift']());}};_0x3f4e55(++_0x542d8b);}(_0xcf6b,0x113));var _0xbcf6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcf6b[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcf6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcf6('0x1'));var rp=require(_0xbcf6('0x2'));var moment=require(_0xbcf6('0x3'));var BPromise=require(_0xbcf6('0x4'));var Mustache=require(_0xbcf6('0x5'));var util=require(_0xbcf6('0x6'));var path=require(_0xbcf6('0x7'));var sox=require(_0xbcf6('0x8'));var csv=require(_0xbcf6('0x9'));var ejs=require(_0xbcf6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbcf6('0xb'));var crypto=require(_0xbcf6('0xc'));var jsforce=require(_0xbcf6('0xd'));var deskjs=require(_0xbcf6('0xe'));var toCsv=require(_0xbcf6('0x9'));var querystring=require('querystring');var Papa=require(_0xbcf6('0xf'));var Redis=require(_0xbcf6('0x10'));var authService=require(_0xbcf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcf6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcf6('0x13'))(_0xbcf6('0x14'));var utils=require(_0xbcf6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbcf6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d40bc,_0x77d590){_0x77d590=_0x77d590||0xcc;return function(_0x63ef14){if(_0x63ef14){return _0x3d40bc[_0xbcf6('0x17')](_0x77d590);}return _0x3d40bc[_0xbcf6('0x18')](_0x77d590)[_0xbcf6('0x19')]();};}function respondWithResult(_0x1a21ff,_0x594176){_0x594176=_0x594176||0xc8;return function(_0x17f80b){if(_0x17f80b){return _0x1a21ff[_0xbcf6('0x18')](_0x594176)['json'](_0x17f80b);}};}function respondWithFilteredResult(_0x36ca5e,_0x5b7a70){return function(_0x291a72){if(_0x291a72){var _0x8b022a=typeof _0x5b7a70[_0xbcf6('0x1a')]===_0xbcf6('0x1b')&&typeof _0x5b7a70[_0xbcf6('0x1c')]===_0xbcf6('0x1b');var _0x4f1e31=_0x291a72[_0xbcf6('0x1d')];var _0x2da3a7=_0x8b022a?0x0:_0x5b7a70[_0xbcf6('0x1a')];var _0x4fa69d=_0x8b022a?_0x291a72[_0xbcf6('0x1d')]:_0x5b7a70[_0xbcf6('0x1a')]+_0x5b7a70[_0xbcf6('0x1c')];var _0x2ba262;if(_0x4fa69d>=_0x4f1e31){_0x4fa69d=_0x4f1e31;_0x2ba262=0xc8;}else{_0x2ba262=0xce;}_0x36ca5e[_0xbcf6('0x18')](_0x2ba262);return _0x36ca5e[_0xbcf6('0x1e')](_0xbcf6('0x1f'),_0x2da3a7+'-'+_0x4fa69d+'/'+_0x4f1e31)[_0xbcf6('0x20')](_0x291a72);}return null;};}function patchUpdates(_0x43c2ad){return function(_0x31e977){try{jsonpatch[_0xbcf6('0x21')](_0x31e977,_0x43c2ad,!![]);}catch(_0xb92f52){return BPromise['reject'](_0xb92f52);}return _0x31e977[_0xbcf6('0x22')]();};}function saveUpdates(_0x1ad9f4,_0x5b9ea8){return function(_0x129c03){if(_0x129c03){return _0x129c03['update'](_0x1ad9f4)[_0xbcf6('0x23')](function(_0x582b93){return _0x582b93;});}return null;};}function removeEntity(_0x22b764,_0x1eebb7){return function(_0x5e1566){if(_0x5e1566){return _0x5e1566['destroy']()[_0xbcf6('0x23')](function(){_0x22b764[_0xbcf6('0x18')](0xcc)[_0xbcf6('0x19')]();});}};}function handleEntityNotFound(_0x268441,_0x39971f){return function(_0xbff69c){if(!_0xbff69c){_0x268441['sendStatus'](0x194);}return _0xbff69c;};}function handleError(_0x1ee97f,_0x2312ea){_0x2312ea=_0x2312ea||0x1f4;return function(_0x550fef){logger['error'](_0x550fef[_0xbcf6('0x24')]);if(_0x550fef['name']){delete _0x550fef['name'];}_0x1ee97f['status'](_0x2312ea)[_0xbcf6('0x25')](_0x550fef);};}exports[_0xbcf6('0x26')]=function(_0x15c5cd,_0x237791){var _0x15625f={},_0x46d93f={},_0x536cf6={'count':0x0,'rows':[]};var _0x2f4747=_[_0xbcf6('0x27')](db[_0xbcf6('0x28')]['rawAttributes'],function(_0x1adc76){return{'name':_0x1adc76[_0xbcf6('0x29')],'type':_0x1adc76[_0xbcf6('0x2a')]['key']};});_0x46d93f[_0xbcf6('0x2b')]=_[_0xbcf6('0x27')](_0x2f4747,_0xbcf6('0x2c'));_0x46d93f[_0xbcf6('0x2d')]=_[_0xbcf6('0x2e')](_0x15c5cd['query']);_0x46d93f[_0xbcf6('0x2f')]=_[_0xbcf6('0x30')](_0x46d93f[_0xbcf6('0x2b')],_0x46d93f[_0xbcf6('0x2d')]);_0x15625f[_0xbcf6('0x31')]=_[_0xbcf6('0x30')](_0x46d93f[_0xbcf6('0x2b')],qs['fields'](_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x32')]));_0x15625f[_0xbcf6('0x31')]=_0x15625f['attributes'][_0xbcf6('0x33')]?_0x15625f[_0xbcf6('0x31')]:_0x46d93f['model'];if(!_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x34')](_0xbcf6('0x35'))){_0x15625f[_0xbcf6('0x1c')]=qs[_0xbcf6('0x1c')](_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x1c')]);_0x15625f[_0xbcf6('0x1a')]=qs[_0xbcf6('0x1a')](_0x15c5cd['query'][_0xbcf6('0x1a')]);}_0x15625f['order']=qs[_0xbcf6('0x36')](_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x36')]);_0x15625f[_0xbcf6('0x37')]=qs[_0xbcf6('0x2f')](_[_0xbcf6('0x38')](_0x15c5cd[_0xbcf6('0x2d')],_0x46d93f[_0xbcf6('0x2f')]),_0x2f4747);if(_0x15c5cd['query'][_0xbcf6('0x39')]){_0x15625f[_0xbcf6('0x37')]=_[_0xbcf6('0x3a')](_0x15625f['where'],{'$or':_[_0xbcf6('0x27')](_0x2f4747,function(_0x1fe436){if(_0x1fe436[_0xbcf6('0x2a')]!==_0xbcf6('0x3b')){var _0x1b48a4={};_0x1b48a4[_0x1fe436[_0xbcf6('0x2c')]]={'$like':'%'+_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x39')]+'%'};return _0x1b48a4;}})});}_0x15625f=_[_0xbcf6('0x3a')]({},_0x15625f,_0x15c5cd[_0xbcf6('0x3c')]);var _0x5b69cc={'where':_0x15625f[_0xbcf6('0x37')]};return db[_0xbcf6('0x28')][_0xbcf6('0x1d')](_0x5b69cc)[_0xbcf6('0x23')](function(_0x3598f8){_0x536cf6['count']=_0x3598f8;if(_0x15c5cd[_0xbcf6('0x2d')][_0xbcf6('0x3d')]){_0x15625f[_0xbcf6('0x3e')]=[{'all':!![]}];}return db[_0xbcf6('0x28')][_0xbcf6('0x3f')](_0x15625f);})[_0xbcf6('0x23')](function(_0xee0d0b){_0x536cf6['rows']=_0xee0d0b;return _0x536cf6;})[_0xbcf6('0x23')](respondWithFilteredResult(_0x237791,_0x15625f))[_0xbcf6('0x40')](handleError(_0x237791,null));};exports[_0xbcf6('0x41')]=function(_0x4941d3,_0x529f49){var _0x3ae6e5={'raw':!![],'where':{'id':_0x4941d3[_0xbcf6('0x42')]['id']}},_0x360bfe={};_0x360bfe['model']=_[_0xbcf6('0x2e')](db[_0xbcf6('0x28')][_0xbcf6('0x43')]);_0x360bfe[_0xbcf6('0x2d')]=_[_0xbcf6('0x2e')](_0x4941d3[_0xbcf6('0x2d')]);_0x360bfe[_0xbcf6('0x2f')]=_['intersection'](_0x360bfe[_0xbcf6('0x2b')],_0x360bfe[_0xbcf6('0x2d')]);_0x3ae6e5[_0xbcf6('0x31')]=_['intersection'](_0x360bfe[_0xbcf6('0x2b')],qs[_0xbcf6('0x32')](_0x4941d3[_0xbcf6('0x2d')]['fields']));_0x3ae6e5['attributes']=_0x3ae6e5['attributes']['length']?_0x3ae6e5[_0xbcf6('0x31')]:_0x360bfe[_0xbcf6('0x2b')];if(_0x4941d3[_0xbcf6('0x2d')][_0xbcf6('0x3d')]){_0x3ae6e5['include']=[{'all':!![]}];}_0x3ae6e5=_[_0xbcf6('0x3a')]({},_0x3ae6e5,_0x4941d3[_0xbcf6('0x3c')]);return db[_0xbcf6('0x28')]['find'](_0x3ae6e5)['then'](handleEntityNotFound(_0x529f49,null))[_0xbcf6('0x23')](respondWithResult(_0x529f49,null))[_0xbcf6('0x40')](handleError(_0x529f49,null));};exports[_0xbcf6('0x44')]=function(_0x355c39,_0x30a6e5){return db[_0xbcf6('0x28')][_0xbcf6('0x44')](_0x355c39['body'],{})['then'](respondWithResult(_0x30a6e5,0xc9))[_0xbcf6('0x40')](handleError(_0x30a6e5,null));};exports['update']=function(_0x509f2c,_0x282109){if(_0x509f2c['body']['id']){delete _0x509f2c[_0xbcf6('0x45')]['id'];}return db[_0xbcf6('0x28')][_0xbcf6('0x46')]({'where':{'id':_0x509f2c[_0xbcf6('0x42')]['id']}})[_0xbcf6('0x23')](handleEntityNotFound(_0x282109,null))['then'](saveUpdates(_0x509f2c[_0xbcf6('0x45')],null))[_0xbcf6('0x23')](respondWithResult(_0x282109,null))[_0xbcf6('0x40')](handleError(_0x282109,null));};exports[_0xbcf6('0x47')]=function(_0x3d0bef,_0xa5af92){return db[_0xbcf6('0x28')][_0xbcf6('0x46')]({'where':{'id':_0x3d0bef[_0xbcf6('0x42')]['id']}})[_0xbcf6('0x23')](handleEntityNotFound(_0xa5af92,null))[_0xbcf6('0x23')](removeEntity(_0xa5af92,null))[_0xbcf6('0x40')](handleError(_0xa5af92,null));};exports['describe']=function(_0x5b22fe,_0x53eb2a){return db[_0xbcf6('0x28')][_0xbcf6('0x48')]()[_0xbcf6('0x23')](respondWithResult(_0x53eb2a,null))[_0xbcf6('0x40')](handleError(_0x53eb2a,null));};exports[_0xbcf6('0x49')]=function(_0x285242,_0x39a521,_0x2b70af){var _0x29dae3={'raw':!![],'where':{}};var _0x593027={};var _0x12323b={'count':0x0,'rows':[]};return db[_0xbcf6('0x28')]['findOne']({'where':{'id':_0x285242[_0xbcf6('0x42')]['id']}})[_0xbcf6('0x23')](handleEntityNotFound(_0x39a521,null))['then'](function(_0x36626c){if(_0x36626c){_0x593027[_0xbcf6('0x2b')]=_[_0xbcf6('0x2e')](db['JscriptyQuestionReport']['rawAttributes']);_0x593027['query']=_['keys'](_0x285242[_0xbcf6('0x2d')]);_0x593027[_0xbcf6('0x2f')]=_[_0xbcf6('0x30')](_0x593027[_0xbcf6('0x2b')],_0x593027['query']);_0x29dae3['attributes']=_[_0xbcf6('0x30')](_0x593027[_0xbcf6('0x2b')],qs[_0xbcf6('0x32')](_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x32')]));_0x29dae3[_0xbcf6('0x31')]=_0x29dae3['attributes'][_0xbcf6('0x33')]?_0x29dae3[_0xbcf6('0x31')]:_0x593027[_0xbcf6('0x2b')];if(!_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x34')](_0xbcf6('0x35'))){_0x29dae3[_0xbcf6('0x1c')]=qs[_0xbcf6('0x1c')](_0x285242['query']['limit']);_0x29dae3[_0xbcf6('0x1a')]=qs[_0xbcf6('0x1a')](_0x285242['query'][_0xbcf6('0x1a')]);}_0x29dae3[_0xbcf6('0x4a')]=qs['sort'](_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x36')]);_0x29dae3['where']=qs[_0xbcf6('0x2f')](_[_0xbcf6('0x38')](_0x285242[_0xbcf6('0x2d')],_0x593027[_0xbcf6('0x2f')]));_0x29dae3[_0xbcf6('0x37')][_0xbcf6('0x4b')]=_0x36626c['id'];if(_0x285242[_0xbcf6('0x2d')][_0xbcf6('0x39')]){_0x29dae3['where']=_[_0xbcf6('0x3a')](_0x29dae3[_0xbcf6('0x37')],{'$or':_[_0xbcf6('0x27')](_0x29dae3[_0xbcf6('0x31')],function(_0x5ca194){var _0x3f0b3a={};_0x3f0b3a[_0x5ca194]={'$like':'%'+_0x285242['query'][_0xbcf6('0x39')]+'%'};return _0x3f0b3a;})});}_0x29dae3=_[_0xbcf6('0x3a')]({},_0x29dae3,_0x285242[_0xbcf6('0x3c')]);return db['JscriptyQuestionReport'][_0xbcf6('0x1d')]({'where':_0x29dae3[_0xbcf6('0x37')]})[_0xbcf6('0x23')](function(_0x2154ca){_0x12323b[_0xbcf6('0x1d')]=_0x2154ca;if(_0x285242['query'][_0xbcf6('0x3d')]){_0x29dae3[_0xbcf6('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbcf6('0x3f')](_0x29dae3);})[_0xbcf6('0x23')](function(_0x4ed60c){_0x12323b[_0xbcf6('0x4c')]=_0x4ed60c;return _0x12323b;});}})[_0xbcf6('0x23')](respondWithFilteredResult(_0x39a521,_0x29dae3))[_0xbcf6('0x40')](handleError(_0x39a521,null));}; \ No newline at end of file +var _0x191c=['JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','describe','getQuestions','findOne','nolimit','SessionId'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x191c,0xe8));var _0xc191=function(_0x428edb,_0x3f0f0d){_0x428edb=_0x428edb-0x0;var _0x12f21a=_0x191c[_0x428edb];return _0x12f21a;};'use strict';var emlformat=require(_0xc191('0x0'));var rimraf=require(_0xc191('0x1'));var zipdir=require(_0xc191('0x2'));var jsonpatch=require(_0xc191('0x3'));var rp=require(_0xc191('0x4'));var moment=require(_0xc191('0x5'));var BPromise=require(_0xc191('0x6'));var Mustache=require(_0xc191('0x7'));var util=require(_0xc191('0x8'));var path=require('path');var sox=require(_0xc191('0x9'));var csv=require(_0xc191('0xa'));var ejs=require(_0xc191('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc191('0xc'));var squel=require('squel');var crypto=require(_0xc191('0xd'));var jsforce=require(_0xc191('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc191('0xa'));var querystring=require(_0xc191('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc191('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc191('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc191('0x12'));var db=require(_0xc191('0x13'))['db'];function respondWithStatusCode(_0x15befe,_0x31ad10){_0x31ad10=_0x31ad10||0xcc;return function(_0x5e6fe9){if(_0x5e6fe9){return _0x15befe['sendStatus'](_0x31ad10);}return _0x15befe[_0xc191('0x14')](_0x31ad10)[_0xc191('0x15')]();};}function respondWithResult(_0x5f575e,_0x2f2aa4){_0x2f2aa4=_0x2f2aa4||0xc8;return function(_0x58657b){if(_0x58657b){return _0x5f575e['status'](_0x2f2aa4)[_0xc191('0x16')](_0x58657b);}};}function respondWithFilteredResult(_0x4d6abb,_0x1e66ae){return function(_0x6d9a7e){if(_0x6d9a7e){var _0x347094=typeof _0x1e66ae['offset']===_0xc191('0x17')&&typeof _0x1e66ae[_0xc191('0x18')]===_0xc191('0x17');var _0x375f9b=_0x6d9a7e['count'];var _0x112f16=_0x347094?0x0:_0x1e66ae[_0xc191('0x19')];var _0x362c4f=_0x347094?_0x6d9a7e[_0xc191('0x1a')]:_0x1e66ae[_0xc191('0x19')]+_0x1e66ae['limit'];var _0x5c2bcb;if(_0x362c4f>=_0x375f9b){_0x362c4f=_0x375f9b;_0x5c2bcb=0xc8;}else{_0x5c2bcb=0xce;}_0x4d6abb[_0xc191('0x14')](_0x5c2bcb);return _0x4d6abb[_0xc191('0x1b')](_0xc191('0x1c'),_0x112f16+'-'+_0x362c4f+'/'+_0x375f9b)[_0xc191('0x16')](_0x6d9a7e);}return null;};}function patchUpdates(_0x40bfd2){return function(_0x32ffab){try{jsonpatch[_0xc191('0x1d')](_0x32ffab,_0x40bfd2,!![]);}catch(_0x3758d6){return BPromise[_0xc191('0x1e')](_0x3758d6);}return _0x32ffab[_0xc191('0x1f')]();};}function saveUpdates(_0x380f51,_0x4bfb5c){return function(_0x279af0){if(_0x279af0){return _0x279af0[_0xc191('0x20')](_0x380f51)[_0xc191('0x21')](function(_0xe34d4d){return _0xe34d4d;});}return null;};}function removeEntity(_0x1e6ce2,_0x36fcf5){return function(_0x5ca9eb){if(_0x5ca9eb){return _0x5ca9eb[_0xc191('0x22')]()[_0xc191('0x21')](function(){_0x1e6ce2['status'](0xcc)[_0xc191('0x15')]();});}};}function handleEntityNotFound(_0x4ff3c4,_0x1762d1){return function(_0x556e52){if(!_0x556e52){_0x4ff3c4[_0xc191('0x23')](0x194);}return _0x556e52;};}function handleError(_0x455b62,_0x2e04f4){_0x2e04f4=_0x2e04f4||0x1f4;return function(_0x58272e){logger[_0xc191('0x24')](_0x58272e['stack']);if(_0x58272e[_0xc191('0x25')]){delete _0x58272e[_0xc191('0x25')];}_0x455b62[_0xc191('0x14')](_0x2e04f4)[_0xc191('0x26')](_0x58272e);};}exports['index']=function(_0x2a000f,_0x3d4c55){var _0x2c096b={},_0x3d272b={},_0x29c9e2={'count':0x0,'rows':[]};var _0x373380=_[_0xc191('0x27')](db[_0xc191('0x28')][_0xc191('0x29')],function(_0x523f89){return{'name':_0x523f89[_0xc191('0x2a')],'type':_0x523f89[_0xc191('0x2b')]['key']};});_0x3d272b['model']=_[_0xc191('0x27')](_0x373380,'name');_0x3d272b[_0xc191('0x2c')]=_['keys'](_0x2a000f[_0xc191('0x2c')]);_0x3d272b[_0xc191('0x2d')]=_[_0xc191('0x2e')](_0x3d272b[_0xc191('0x2f')],_0x3d272b['query']);_0x2c096b[_0xc191('0x30')]=_[_0xc191('0x2e')](_0x3d272b[_0xc191('0x2f')],qs[_0xc191('0x31')](_0x2a000f[_0xc191('0x2c')][_0xc191('0x31')]));_0x2c096b[_0xc191('0x30')]=_0x2c096b['attributes'][_0xc191('0x32')]?_0x2c096b[_0xc191('0x30')]:_0x3d272b['model'];if(!_0x2a000f[_0xc191('0x2c')][_0xc191('0x33')]('nolimit')){_0x2c096b[_0xc191('0x18')]=qs['limit'](_0x2a000f[_0xc191('0x2c')][_0xc191('0x18')]);_0x2c096b[_0xc191('0x19')]=qs[_0xc191('0x19')](_0x2a000f[_0xc191('0x2c')][_0xc191('0x19')]);}_0x2c096b[_0xc191('0x34')]=qs[_0xc191('0x35')](_0x2a000f[_0xc191('0x2c')][_0xc191('0x35')]);_0x2c096b[_0xc191('0x36')]=qs[_0xc191('0x2d')](_[_0xc191('0x37')](_0x2a000f['query'],_0x3d272b[_0xc191('0x2d')]),_0x373380);if(_0x2a000f[_0xc191('0x2c')][_0xc191('0x38')]){_0x2c096b[_0xc191('0x36')]=_[_0xc191('0x39')](_0x2c096b['where'],{'$or':_[_0xc191('0x27')](_0x373380,function(_0x23d46a){if(_0x23d46a[_0xc191('0x2b')]!==_0xc191('0x3a')){var _0x13e2eb={};_0x13e2eb[_0x23d46a[_0xc191('0x25')]]={'$like':'%'+_0x2a000f[_0xc191('0x2c')][_0xc191('0x38')]+'%'};return _0x13e2eb;}})});}_0x2c096b=_[_0xc191('0x39')]({},_0x2c096b,_0x2a000f['options']);var _0x48d423={'where':_0x2c096b[_0xc191('0x36')]};return db[_0xc191('0x28')][_0xc191('0x1a')](_0x48d423)[_0xc191('0x21')](function(_0xaf1455){_0x29c9e2['count']=_0xaf1455;if(_0x2a000f[_0xc191('0x2c')][_0xc191('0x3b')]){_0x2c096b['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc191('0x3c')](_0x2c096b);})['then'](function(_0x5b7d3c){_0x29c9e2[_0xc191('0x3d')]=_0x5b7d3c;return _0x29c9e2;})[_0xc191('0x21')](respondWithFilteredResult(_0x3d4c55,_0x2c096b))[_0xc191('0x3e')](handleError(_0x3d4c55,null));};exports[_0xc191('0x3f')]=function(_0x3dce48,_0x46f130){var _0x2d8765={'raw':!![],'where':{'id':_0x3dce48[_0xc191('0x40')]['id']}},_0x37f51e={};_0x37f51e[_0xc191('0x2f')]=_[_0xc191('0x41')](db[_0xc191('0x28')]['rawAttributes']);_0x37f51e[_0xc191('0x2c')]=_[_0xc191('0x41')](_0x3dce48['query']);_0x37f51e[_0xc191('0x2d')]=_['intersection'](_0x37f51e[_0xc191('0x2f')],_0x37f51e[_0xc191('0x2c')]);_0x2d8765[_0xc191('0x30')]=_[_0xc191('0x2e')](_0x37f51e[_0xc191('0x2f')],qs[_0xc191('0x31')](_0x3dce48[_0xc191('0x2c')][_0xc191('0x31')]));_0x2d8765[_0xc191('0x30')]=_0x2d8765[_0xc191('0x30')]['length']?_0x2d8765[_0xc191('0x30')]:_0x37f51e[_0xc191('0x2f')];if(_0x3dce48['query'][_0xc191('0x3b')]){_0x2d8765[_0xc191('0x42')]=[{'all':!![]}];}_0x2d8765=_[_0xc191('0x39')]({},_0x2d8765,_0x3dce48[_0xc191('0x43')]);return db[_0xc191('0x28')][_0xc191('0x44')](_0x2d8765)[_0xc191('0x21')](handleEntityNotFound(_0x46f130,null))['then'](respondWithResult(_0x46f130,null))[_0xc191('0x3e')](handleError(_0x46f130,null));};exports[_0xc191('0x45')]=function(_0x1076e1,_0x41b650){return db[_0xc191('0x28')][_0xc191('0x45')](_0x1076e1[_0xc191('0x46')],{})['then'](respondWithResult(_0x41b650,0xc9))['catch'](handleError(_0x41b650,null));};exports[_0xc191('0x20')]=function(_0x42f5a3,_0x2cbd38){if(_0x42f5a3[_0xc191('0x46')]['id']){delete _0x42f5a3['body']['id'];}return db['JscriptySessionReport'][_0xc191('0x44')]({'where':{'id':_0x42f5a3['params']['id']}})[_0xc191('0x21')](handleEntityNotFound(_0x2cbd38,null))[_0xc191('0x21')](saveUpdates(_0x42f5a3[_0xc191('0x46')],null))['then'](respondWithResult(_0x2cbd38,null))[_0xc191('0x3e')](handleError(_0x2cbd38,null));};exports['destroy']=function(_0x597644,_0x1952fb){return db['JscriptySessionReport'][_0xc191('0x44')]({'where':{'id':_0x597644[_0xc191('0x40')]['id']}})['then'](handleEntityNotFound(_0x1952fb,null))[_0xc191('0x21')](removeEntity(_0x1952fb,null))[_0xc191('0x3e')](handleError(_0x1952fb,null));};exports[_0xc191('0x47')]=function(_0xe779c5,_0x3dff46){return db[_0xc191('0x28')]['describe']()[_0xc191('0x21')](respondWithResult(_0x3dff46,null))[_0xc191('0x3e')](handleError(_0x3dff46,null));};exports[_0xc191('0x48')]=function(_0x248b47,_0x463277,_0x24777c){var _0x1cddb2={'raw':!![],'where':{}};var _0x10742d={};var _0x53b3dc={'count':0x0,'rows':[]};return db[_0xc191('0x28')][_0xc191('0x49')]({'where':{'id':_0x248b47[_0xc191('0x40')]['id']}})[_0xc191('0x21')](handleEntityNotFound(_0x463277,null))[_0xc191('0x21')](function(_0x52c85c){if(_0x52c85c){_0x10742d[_0xc191('0x2f')]=_[_0xc191('0x41')](db['JscriptyQuestionReport'][_0xc191('0x29')]);_0x10742d['query']=_[_0xc191('0x41')](_0x248b47[_0xc191('0x2c')]);_0x10742d[_0xc191('0x2d')]=_[_0xc191('0x2e')](_0x10742d[_0xc191('0x2f')],_0x10742d['query']);_0x1cddb2[_0xc191('0x30')]=_[_0xc191('0x2e')](_0x10742d['model'],qs[_0xc191('0x31')](_0x248b47['query']['fields']));_0x1cddb2[_0xc191('0x30')]=_0x1cddb2['attributes'][_0xc191('0x32')]?_0x1cddb2[_0xc191('0x30')]:_0x10742d[_0xc191('0x2f')];if(!_0x248b47[_0xc191('0x2c')][_0xc191('0x33')](_0xc191('0x4a'))){_0x1cddb2[_0xc191('0x18')]=qs[_0xc191('0x18')](_0x248b47[_0xc191('0x2c')]['limit']);_0x1cddb2[_0xc191('0x19')]=qs[_0xc191('0x19')](_0x248b47[_0xc191('0x2c')][_0xc191('0x19')]);}_0x1cddb2[_0xc191('0x34')]=qs[_0xc191('0x35')](_0x248b47[_0xc191('0x2c')][_0xc191('0x35')]);_0x1cddb2['where']=qs[_0xc191('0x2d')](_['pick'](_0x248b47['query'],_0x10742d['filters']));_0x1cddb2[_0xc191('0x36')][_0xc191('0x4b')]=_0x52c85c['id'];if(_0x248b47[_0xc191('0x2c')][_0xc191('0x38')]){_0x1cddb2[_0xc191('0x36')]=_[_0xc191('0x39')](_0x1cddb2[_0xc191('0x36')],{'$or':_[_0xc191('0x27')](_0x1cddb2[_0xc191('0x30')],function(_0x112b0f){var _0x320b01={};_0x320b01[_0x112b0f]={'$like':'%'+_0x248b47[_0xc191('0x2c')][_0xc191('0x38')]+'%'};return _0x320b01;})});}_0x1cddb2=_[_0xc191('0x39')]({},_0x1cddb2,_0x248b47[_0xc191('0x43')]);return db[_0xc191('0x4c')][_0xc191('0x1a')]({'where':_0x1cddb2['where']})['then'](function(_0x44567e){_0x53b3dc[_0xc191('0x1a')]=_0x44567e;if(_0x248b47[_0xc191('0x2c')]['includeAll']){_0x1cddb2[_0xc191('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc191('0x3c')](_0x1cddb2);})[_0xc191('0x21')](function(_0x8ec503){_0x53b3dc[_0xc191('0x3d')]=_0x8ec503;return _0x53b3dc;});}})['then'](respondWithFilteredResult(_0x463277,_0x1cddb2))[_0xc191('0x3e')](handleError(_0x463277,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 34e9b8e..9e3f138 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 _0x1883=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c568e,_0x47fcc3){var _0x5cd62c=function(_0x519739){while(--_0x519739){_0x5c568e['push'](_0x5c568e['shift']());}};_0x5cd62c(++_0x47fcc3);}(_0x1883,0xab));var _0x3188=function(_0x5473a5,_0x38fc6b){_0x5473a5=_0x5473a5-0x0;var _0x58be1f=_0x1883[_0x5473a5];return _0x58be1f;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3831=['define','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptySessionReport.attributes'];(function(_0x3c629a,_0x5e26b7){var _0x27f951=function(_0x1a57f8){while(--_0x1a57f8){_0x3c629a['push'](_0x3c629a['shift']());}};_0x27f951(++_0x5e26b7);}(_0x3831,0x14c));var _0x1383=function(_0x5621e8,_0x257e0d){_0x5621e8=_0x5621e8-0x0;var _0x20d8a7=_0x3831[_0x5621e8];return _0x20d8a7;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var logger=require(_0x1383('0x1'))(_0x1383('0x2'));var moment=require(_0x1383('0x3'));var BPromise=require(_0x1383('0x4'));var rp=require(_0x1383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1383('0x6'));var config=require('../../config/environment');var attributes=require(_0x1383('0x7'));module['exports']=function(_0x5b64b1,_0x5eb4d8){return _0x5b64b1[_0x1383('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x1383('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e651799..5156bcf 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 _0x7ee1=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1bd230,_0x1da01e){var _0x19a3e3=function(_0x3cb9fa){while(--_0x3cb9fa){_0x1bd230['push'](_0x1bd230['shift']());}};_0x19a3e3(++_0x1da01e);}(_0x7ee1,0x8d));var _0x17ee=function(_0x552cd5,_0x4f0b16){_0x552cd5=_0x552cd5-0x0;var _0x2e519f=_0x7ee1[_0x552cd5];return _0x2e519f;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 309d322..d79f0c4 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 _0x60b8=['get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','connect-timeout','express','fs-extra','../../config/environment','./license.controller'];(function(_0x3397af,_0x2c8c5){var _0x229013=function(_0x4e9460){while(--_0x4e9460){_0x3397af['push'](_0x3397af['shift']());}};_0x229013(++_0x2c8c5);}(_0x60b8,0x1d6));var _0x860b=function(_0x5b4d63,_0x369c30){_0x5b4d63=_0x5b4d63-0x0;var _0xf23789=_0x60b8[_0x5b4d63];return _0xf23789;};'use strict';var multer=require('multer');var util=require(_0x860b('0x0'));var path=require('path');var timeout=require(_0x860b('0x1'));var express=require(_0x860b('0x2'));var router=express['Router']();var fs_extra=require(_0x860b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x860b('0x4'));var controller=require(_0x860b('0x5'));router[_0x860b('0x6')]('/',controller['index']);router[_0x860b('0x7')](_0x860b('0x8'),auth[_0x860b('0x9')](),controller[_0x860b('0xa')]);router['get'](_0x860b('0xb'),auth[_0x860b('0x9')](),controller[_0x860b('0xc')]);module[_0x860b('0xd')]=router; \ No newline at end of file +var _0x9fee=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file'];(function(_0x559216,_0xa7d2e9){var _0x552169=function(_0x2ceecb){while(--_0x2ceecb){_0x559216['push'](_0x559216['shift']());}};_0x552169(++_0xa7d2e9);}(_0x9fee,0x1d0));var _0xe9fe=function(_0xfbc692,_0x52f83a){_0xfbc692=_0xfbc692-0x0;var _0x3f2f75=_0x9fee[_0xfbc692];return _0x3f2f75;};'use strict';var multer=require(_0xe9fe('0x0'));var util=require(_0xe9fe('0x1'));var path=require(_0xe9fe('0x2'));var timeout=require(_0xe9fe('0x3'));var express=require('express');var router=express[_0xe9fe('0x4')]();var fs_extra=require(_0xe9fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe9fe('0x6'));var config=require(_0xe9fe('0x7'));var controller=require(_0xe9fe('0x8'));router[_0xe9fe('0x9')]('/',controller[_0xe9fe('0xa')]);router[_0xe9fe('0xb')](_0xe9fe('0xc'),auth[_0xe9fe('0xd')](),controller[_0xe9fe('0xe')]);router[_0xe9fe('0x9')](_0xe9fe('0xf'),auth[_0xe9fe('0xd')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d314889..9762caf 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 _0x4094=['STRING','INTEGER','sequelize'];(function(_0x5fe3f2,_0x18d44e){var _0x5e26dc=function(_0x15b9cd){while(--_0x15b9cd){_0x5fe3f2['push'](_0x5fe3f2['shift']());}};_0x5e26dc(++_0x18d44e);}(_0x4094,0xd4));var _0x4409=function(_0x1cb35f,_0x3b9b71){_0x1cb35f=_0x1cb35f-0x0;var _0x2a26ce=_0x4094[_0x1cb35f];return _0x2a26ce;};'use strict';var Sequelize=require(_0x4409('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x4409('0x1')]},'data2':{'type':Sequelize[_0x4409('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x4409('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ff0=['INTEGER','exports','TEXT','STRING'];(function(_0x577d42,_0x3b3069){var _0x3ade05=function(_0x16518e){while(--_0x16518e){_0x577d42['push'](_0x577d42['shift']());}};_0x3ade05(++_0x3b3069);}(_0x7ff0,0x1c1));var _0x07ff=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x7ff0[_0x2b1551];return _0x2fc2a1;};'use strict';var Sequelize=require('sequelize');module[_0x07ff('0x0')]={'license':{'type':Sequelize[_0x07ff('0x1')]},'data1':{'type':Sequelize[_0x07ff('0x2')]},'data2':{'type':Sequelize[_0x07ff('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x07ff('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 080910d..acdeace 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 _0xbc49=['crypto','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','model','License','rawAttributes','query','keys','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','demo','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xbc49,0x11b));var _0x9bc4=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0xbc49[_0x3fa7d3];return _0x4c51bd;};'use strict';var emlformat=require(_0x9bc4('0x0'));var rimraf=require(_0x9bc4('0x1'));var zipdir=require(_0x9bc4('0x2'));var jsonpatch=require(_0x9bc4('0x3'));var rp=require(_0x9bc4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9bc4('0x5'));var util=require(_0x9bc4('0x6'));var path=require(_0x9bc4('0x7'));var sox=require(_0x9bc4('0x8'));var csv=require(_0x9bc4('0x9'));var ejs=require(_0x9bc4('0xa'));var fs=require('fs');var fs_extra=require(_0x9bc4('0xb'));var _=require(_0x9bc4('0xc'));var squel=require('squel');var crypto=require(_0x9bc4('0xd'));var jsforce=require(_0x9bc4('0xe'));var deskjs=require(_0x9bc4('0xf'));var toCsv=require(_0x9bc4('0x9'));var querystring=require(_0x9bc4('0x10'));var Papa=require(_0x9bc4('0x11'));var Redis=require(_0x9bc4('0x12'));var authService=require(_0x9bc4('0x13'));var qs=require(_0x9bc4('0x14'));var as=require(_0x9bc4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9bc4('0x16'))(_0x9bc4('0x17'));var utils=require(_0x9bc4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9bc4('0x19'));var db=require(_0x9bc4('0x1a'))['db'];function respondWithStatusCode(_0x510599,_0xe917dc){_0xe917dc=_0xe917dc||0xcc;return function(_0x3ebd10){if(_0x3ebd10){return _0x510599[_0x9bc4('0x1b')](_0xe917dc);}return _0x510599['status'](_0xe917dc)[_0x9bc4('0x1c')]();};}function respondWithResult(_0x2661f8,_0x315595){_0x315595=_0x315595||0xc8;return function(_0xbfde78){if(_0xbfde78){return _0x2661f8[_0x9bc4('0x1d')](_0x315595)[_0x9bc4('0x1e')](_0xbfde78);}};}function respondWithFilteredResult(_0x5855b1,_0x5412a5){return function(_0x58ad1a){if(_0x58ad1a){var _0x5e9067=typeof _0x5412a5[_0x9bc4('0x1f')]===_0x9bc4('0x20')&&typeof _0x5412a5[_0x9bc4('0x21')]===_0x9bc4('0x20');var _0x530e17=_0x58ad1a['count'];var _0x366171=_0x5e9067?0x0:_0x5412a5[_0x9bc4('0x1f')];var _0x15a840=_0x5e9067?_0x58ad1a[_0x9bc4('0x22')]:_0x5412a5[_0x9bc4('0x1f')]+_0x5412a5[_0x9bc4('0x21')];var _0x7bcc07;if(_0x15a840>=_0x530e17){_0x15a840=_0x530e17;_0x7bcc07=0xc8;}else{_0x7bcc07=0xce;}_0x5855b1[_0x9bc4('0x1d')](_0x7bcc07);return _0x5855b1[_0x9bc4('0x23')](_0x9bc4('0x24'),_0x366171+'-'+_0x15a840+'/'+_0x530e17)[_0x9bc4('0x1e')](_0x58ad1a);}return null;};}function patchUpdates(_0x5b05c4){return function(_0x2b512f){try{jsonpatch[_0x9bc4('0x25')](_0x2b512f,_0x5b05c4,!![]);}catch(_0x18cf53){return BPromise['reject'](_0x18cf53);}return _0x2b512f[_0x9bc4('0x26')]();};}function saveUpdates(_0x25b525,_0xfaeed9){return function(_0x154959){if(_0x154959){return _0x154959[_0x9bc4('0x27')](_0x25b525)[_0x9bc4('0x28')](function(_0x12e7dc){return _0x12e7dc;});}return null;};}function removeEntity(_0x3fcaba,_0x5c1e27){return function(_0x8095c4){if(_0x8095c4){return _0x8095c4[_0x9bc4('0x29')]()[_0x9bc4('0x28')](function(){_0x3fcaba[_0x9bc4('0x1d')](0xcc)[_0x9bc4('0x1c')]();});}};}function handleEntityNotFound(_0x15bdb8,_0x6e20d9){return function(_0x38320f){if(!_0x38320f){_0x15bdb8[_0x9bc4('0x1b')](0x194);}return _0x38320f;};}function handleError(_0x2c561f,_0x3253c3){_0x3253c3=_0x3253c3||0x1f4;return function(_0x524123){logger[_0x9bc4('0x2a')](_0x524123[_0x9bc4('0x2b')]);if(_0x524123[_0x9bc4('0x2c')]){delete _0x524123[_0x9bc4('0x2c')];}_0x2c561f[_0x9bc4('0x1d')](_0x3253c3)[_0x9bc4('0x2d')](_0x524123);};}var utilLicense=require(_0x9bc4('0x19'));exports['index']=function(_0x58f7f9,_0x23bf5d){var _0x4b2fb6={'raw':!![],'where':{'id':0x1}},_0x3dd15f={};_0x3dd15f[_0x9bc4('0x2e')]=_['keys'](db[_0x9bc4('0x2f')][_0x9bc4('0x30')]);_0x3dd15f[_0x9bc4('0x31')]=_[_0x9bc4('0x32')](_0x58f7f9[_0x9bc4('0x31')]);_0x3dd15f[_0x9bc4('0x33')]=_['intersection'](_0x3dd15f[_0x9bc4('0x2e')],_0x3dd15f['query']);_0x4b2fb6[_0x9bc4('0x34')]=_[_0x9bc4('0x35')](_0x3dd15f[_0x9bc4('0x2e')],qs[_0x9bc4('0x36')](_0x58f7f9[_0x9bc4('0x31')][_0x9bc4('0x36')]));_0x4b2fb6[_0x9bc4('0x34')]=_0x4b2fb6['attributes'][_0x9bc4('0x37')]?_0x4b2fb6['attributes']:_0x3dd15f[_0x9bc4('0x2e')];_0x4b2fb6=_[_0x9bc4('0x38')]({},_0x4b2fb6,_0x58f7f9[_0x9bc4('0x39')]);return utilLicense[_0x9bc4('0x3a')](_0x4b2fb6)['then'](respondWithResult(_0x23bf5d,null))[_0x9bc4('0x3b')](handleError(_0x23bf5d,null));};exports['update']=function(_0x5f351e,_0x132f60){if(_0x5f351e[_0x9bc4('0x3c')]['id']){delete _0x5f351e[_0x9bc4('0x3c')]['id'];}return db[_0x9bc4('0x2f')][_0x9bc4('0x3d')]({'where':{'id':_0x5f351e[_0x9bc4('0x3e')]['id']}})[_0x9bc4('0x28')](handleEntityNotFound(_0x132f60,null))[_0x9bc4('0x28')](function(_0x502d80){var _0x4a01a2=_0x502d80['get']({'plain':!![]});return utilLicense[_0x9bc4('0x3f')](_0x4a01a2,_0x5f351e[_0x9bc4('0x3c')]['key']);})['then'](function(_0xd45463){if(!_0xd45463[_0x9bc4('0x40')]){return saveUpdates(_0x5f351e[_0x9bc4('0x3c')],null);}return _0xd45463;})[_0x9bc4('0x28')](respondWithResult(_0x132f60,null))['catch'](handleError(_0x132f60,null));};exports['downloadLogFile']=function(_0x3fee95,_0x321686){var _0x3ac60b=_0x9bc4('0x41');var _0x32e13e=path[_0x9bc4('0x42')]('/var',_0x9bc4('0x43'),_0x9bc4('0x44'),_0x3ac60b);_0x321686[_0x9bc4('0x45')](_0x9bc4('0x46'),_0x9bc4('0x47')+_0x3ac60b);_0x321686[_0x9bc4('0x23')](_0x9bc4('0x48'),_0x9bc4('0x49'));_0x321686['download'](_0x32e13e);}; \ No newline at end of file +var _0xcec8=['demo','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','sendStatus','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','catch','body','find','params','get','checkLicense'];(function(_0x1ed579,_0x206ebc){var _0x793273=function(_0x56c373){while(--_0x56c373){_0x1ed579['push'](_0x1ed579['shift']());}};_0x793273(++_0x206ebc);}(_0xcec8,0xd5));var _0x8cec=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0xcec8[_0x56fe98];return _0x212f4f;};'use strict';var emlformat=require(_0x8cec('0x0'));var rimraf=require(_0x8cec('0x1'));var zipdir=require(_0x8cec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cec('0x3'));var moment=require('moment');var BPromise=require(_0x8cec('0x4'));var Mustache=require(_0x8cec('0x5'));var util=require('util');var path=require(_0x8cec('0x6'));var sox=require(_0x8cec('0x7'));var csv=require(_0x8cec('0x8'));var ejs=require(_0x8cec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cec('0xa'));var squel=require(_0x8cec('0xb'));var crypto=require('crypto');var jsforce=require(_0x8cec('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8cec('0x8'));var querystring=require(_0x8cec('0xd'));var Papa=require(_0x8cec('0xe'));var Redis=require('ioredis');var authService=require(_0x8cec('0xf'));var qs=require(_0x8cec('0x10'));var as=require(_0x8cec('0x11'));var hardwareService=require(_0x8cec('0x12'));var logger=require(_0x8cec('0x13'))(_0x8cec('0x14'));var utils=require('../../config/utils');var config=require(_0x8cec('0x15'));var licenseUtil=require(_0x8cec('0x16'));var db=require(_0x8cec('0x17'))['db'];function respondWithStatusCode(_0x55635d,_0xf20452){_0xf20452=_0xf20452||0xcc;return function(_0x55608d){if(_0x55608d){return _0x55635d['sendStatus'](_0xf20452);}return _0x55635d['status'](_0xf20452)['end']();};}function respondWithResult(_0xcef99c,_0x24044a){_0x24044a=_0x24044a||0xc8;return function(_0xc2bcfa){if(_0xc2bcfa){return _0xcef99c[_0x8cec('0x18')](_0x24044a)['json'](_0xc2bcfa);}};}function respondWithFilteredResult(_0x1c45a5,_0x423696){return function(_0x9b5985){if(_0x9b5985){var _0xda9c5b=typeof _0x423696[_0x8cec('0x19')]===_0x8cec('0x1a')&&typeof _0x423696[_0x8cec('0x1b')]===_0x8cec('0x1a');var _0x58f0b3=_0x9b5985[_0x8cec('0x1c')];var _0x47d190=_0xda9c5b?0x0:_0x423696[_0x8cec('0x19')];var _0x1ce55c=_0xda9c5b?_0x9b5985[_0x8cec('0x1c')]:_0x423696[_0x8cec('0x19')]+_0x423696[_0x8cec('0x1b')];var _0x263b48;if(_0x1ce55c>=_0x58f0b3){_0x1ce55c=_0x58f0b3;_0x263b48=0xc8;}else{_0x263b48=0xce;}_0x1c45a5[_0x8cec('0x18')](_0x263b48);return _0x1c45a5[_0x8cec('0x1d')](_0x8cec('0x1e'),_0x47d190+'-'+_0x1ce55c+'/'+_0x58f0b3)[_0x8cec('0x1f')](_0x9b5985);}return null;};}function patchUpdates(_0x48bd2e){return function(_0x2d056c){try{jsonpatch['apply'](_0x2d056c,_0x48bd2e,!![]);}catch(_0x35ecf4){return BPromise['reject'](_0x35ecf4);}return _0x2d056c[_0x8cec('0x20')]();};}function saveUpdates(_0x6968ff,_0xfeb663){return function(_0x4af58e){if(_0x4af58e){return _0x4af58e[_0x8cec('0x21')](_0x6968ff)[_0x8cec('0x22')](function(_0x5eec72){return _0x5eec72;});}return null;};}function removeEntity(_0x5c4e0f,_0x15d6de){return function(_0xf728c5){if(_0xf728c5){return _0xf728c5['destroy']()['then'](function(){_0x5c4e0f[_0x8cec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358333,_0x41c6d0){return function(_0x55e9b8){if(!_0x55e9b8){_0x358333[_0x8cec('0x23')](0x194);}return _0x55e9b8;};}function handleError(_0x4da4b3,_0x8edf68){_0x8edf68=_0x8edf68||0x1f4;return function(_0x3f1dd8){logger[_0x8cec('0x24')](_0x3f1dd8[_0x8cec('0x25')]);if(_0x3f1dd8[_0x8cec('0x26')]){delete _0x3f1dd8[_0x8cec('0x26')];}_0x4da4b3[_0x8cec('0x18')](_0x8edf68)[_0x8cec('0x27')](_0x3f1dd8);};}var utilLicense=require(_0x8cec('0x16'));exports[_0x8cec('0x28')]=function(_0x119d70,_0x1e6c4c){var _0x11139a={'raw':!![],'where':{'id':0x1}},_0x524ecf={};_0x524ecf[_0x8cec('0x29')]=_[_0x8cec('0x2a')](db[_0x8cec('0x2b')][_0x8cec('0x2c')]);_0x524ecf[_0x8cec('0x2d')]=_['keys'](_0x119d70['query']);_0x524ecf[_0x8cec('0x2e')]=_[_0x8cec('0x2f')](_0x524ecf['model'],_0x524ecf['query']);_0x11139a[_0x8cec('0x30')]=_[_0x8cec('0x2f')](_0x524ecf[_0x8cec('0x29')],qs[_0x8cec('0x31')](_0x119d70[_0x8cec('0x2d')][_0x8cec('0x31')]));_0x11139a[_0x8cec('0x30')]=_0x11139a[_0x8cec('0x30')][_0x8cec('0x32')]?_0x11139a[_0x8cec('0x30')]:_0x524ecf[_0x8cec('0x29')];_0x11139a=_[_0x8cec('0x33')]({},_0x11139a,_0x119d70[_0x8cec('0x34')]);return utilLicense['getLicense'](_0x11139a)['then'](respondWithResult(_0x1e6c4c,null))[_0x8cec('0x35')](handleError(_0x1e6c4c,null));};exports[_0x8cec('0x21')]=function(_0x25ff5d,_0x1e5faa){if(_0x25ff5d[_0x8cec('0x36')]['id']){delete _0x25ff5d['body']['id'];}return db[_0x8cec('0x2b')][_0x8cec('0x37')]({'where':{'id':_0x25ff5d[_0x8cec('0x38')]['id']}})[_0x8cec('0x22')](handleEntityNotFound(_0x1e5faa,null))[_0x8cec('0x22')](function(_0x5dc270){var _0x4e0e47=_0x5dc270[_0x8cec('0x39')]({'plain':!![]});return utilLicense[_0x8cec('0x3a')](_0x4e0e47,_0x25ff5d['body']['key']);})[_0x8cec('0x22')](function(_0x1ed4d5){if(!_0x1ed4d5[_0x8cec('0x3b')]){return saveUpdates(_0x25ff5d[_0x8cec('0x36')],null);}return _0x1ed4d5;})[_0x8cec('0x22')](respondWithResult(_0x1e5faa,null))['catch'](handleError(_0x1e5faa,null));};exports['downloadLogFile']=function(_0x4e8d9d,_0x495aa1){var _0x596e1f='license-info.log';var _0x5dd927=path[_0x8cec('0x3c')](_0x8cec('0x3d'),_0x8cec('0x3e'),'xcally',_0x596e1f);_0x495aa1[_0x8cec('0x3f')](_0x8cec('0x40'),_0x8cec('0x41')+_0x596e1f);_0x495aa1[_0x8cec('0x1d')]('Content-Type',_0x8cec('0x42'));_0x495aa1[_0x8cec('0x43')](_0x5dd927);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2f4bc9a..c12698c 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 _0x73c0=['moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','util','../../config/logger','api'];(function(_0x515713,_0x38f39c){var _0x9a7337=function(_0x131519){while(--_0x131519){_0x515713['push'](_0x515713['shift']());}};_0x9a7337(++_0x38f39c);}(_0x73c0,0x171));var _0x073c=function(_0x38f7c5,_0x252608){_0x38f7c5=_0x38f7c5-0x0;var _0x216879=_0x73c0[_0x38f7c5];return _0x216879;};'use strict';var _=require('lodash');var util=require(_0x073c('0x0'));var logger=require(_0x073c('0x1'))(_0x073c('0x2'));var moment=require(_0x073c('0x3'));var BPromise=require(_0x073c('0x4'));var rp=require(_0x073c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x073c('0x6'));var config=require(_0x073c('0x7'));var attributes=require(_0x073c('0x8'));module[_0x073c('0x9')]=function(_0x9de3ce,_0x275dc7){return _0x9de3ce[_0x073c('0xa')](_0x073c('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfda3=['path','rimraf','../../config/environment','exports','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5cdcd0,_0x2721ec){var _0x4864c1=function(_0x503a3b){while(--_0x503a3b){_0x5cdcd0['push'](_0x5cdcd0['shift']());}};_0x4864c1(++_0x2721ec);}(_0xfda3,0x125));var _0x3fda=function(_0x2171d4,_0x3d54d9){_0x2171d4=_0x2171d4-0x0;var _0x100800=_0xfda3[_0x2171d4];return _0x100800;};'use strict';var _=require('lodash');var util=require(_0x3fda('0x0'));var logger=require(_0x3fda('0x1'))(_0x3fda('0x2'));var moment=require(_0x3fda('0x3'));var BPromise=require(_0x3fda('0x4'));var rp=require(_0x3fda('0x5'));var fs=require('fs');var path=require(_0x3fda('0x6'));var rimraf=require(_0x3fda('0x7'));var config=require(_0x3fda('0x8'));var attributes=require('./license.attributes');module[_0x3fda('0x9')]=function(_0x71156f,_0x7dc1c9){return _0x71156f[_0x3fda('0xa')](_0x3fda('0xb'),attributes,{'tableName':_0x3fda('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 d79904d..ff4a3c1 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 _0x02bd=['../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1bcb17,_0x492d13){var _0x21432d=function(_0x11b25a){while(--_0x11b25a){_0x1bcb17['push'](_0x1bcb17['shift']());}};_0x21432d(++_0x492d13);}(_0x02bd,0x116));var _0xd02b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x02bd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd02b('0x0'));var util=require(_0xd02b('0x1'));var moment=require(_0xd02b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd02b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd02b('0x4'))['db'];var utils=require(_0xd02b('0x5'));var logger=require(_0xd02b('0x6'))('rpc');var config=require(_0xd02b('0x7'));var jayson=require(_0xd02b('0x8'));var client=jayson[_0xd02b('0x9')][_0xd02b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x223127,_0x28defd,_0x5898c2){return new BPromise(function(_0x686967,_0x17d375){return client[_0xd02b('0xb')](_0x223127,_0x5898c2)['then'](function(_0x4c37ea){logger[_0xd02b('0xc')](_0xd02b('0xd'),_0x28defd,_0xd02b('0xe'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x28defd,_0xd02b('0xe'),JSON['stringify'](_0x4c37ea));if(_0x4c37ea[_0xd02b('0xf')]){if(_0x4c37ea[_0xd02b('0xf')]['code']===0x1f4){logger[_0xd02b('0xf')]('License,\x20%s,\x20%s',_0x28defd,_0x4c37ea[_0xd02b('0xf')]['message']);return _0x17d375(_0x4c37ea[_0xd02b('0xf')][_0xd02b('0x10')]);}logger[_0xd02b('0xf')]('License,\x20%s,\x20%s',_0x28defd,_0x4c37ea[_0xd02b('0xf')]['message']);return _0x686967(_0x4c37ea['error'][_0xd02b('0x10')]);}else{logger['info'](_0xd02b('0xd'),_0x28defd,'request\x20sent');_0x686967(_0x4c37ea[_0xd02b('0x11')]['message']);}})[_0xd02b('0x12')](function(_0x2f1f9c){logger['error']('License,\x20%s,\x20%s',_0x28defd,_0x2f1f9c);_0x17d375(_0x2f1f9c);});});} \ No newline at end of file +var _0xf2bf=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x49f03f,_0x280f41){var _0x2794c4=function(_0x43df64){while(--_0x43df64){_0x49f03f['push'](_0x49f03f['shift']());}};_0x2794c4(++_0x280f41);}(_0xf2bf,0x17b));var _0xff2b=function(_0x292bab,_0x4eb300){_0x292bab=_0x292bab-0x0;var _0x18b22a=_0xf2bf[_0x292bab];return _0x18b22a;};'use strict';var _=require(_0xff2b('0x0'));var util=require(_0xff2b('0x1'));var moment=require(_0xff2b('0x2'));var BPromise=require(_0xff2b('0x3'));var rs=require(_0xff2b('0x4'));var fs=require('fs');var Redis=require(_0xff2b('0x5'));var db=require(_0xff2b('0x6'))['db'];var utils=require(_0xff2b('0x7'));var logger=require(_0xff2b('0x8'))(_0xff2b('0x9'));var config=require(_0xff2b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xff2b('0xb')][_0xff2b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1856cf,_0x824740,_0x276677){return new BPromise(function(_0x55cd67,_0x4234fc){return client[_0xff2b('0xd')](_0x1856cf,_0x276677)[_0xff2b('0xe')](function(_0x362125){logger['info'](_0xff2b('0xf'),_0x824740,_0xff2b('0x10'));logger[_0xff2b('0x11')](_0xff2b('0x12'),_0x824740,_0xff2b('0x10'),JSON['stringify'](_0x362125));if(_0x362125[_0xff2b('0x13')]){if(_0x362125['error'][_0xff2b('0x14')]===0x1f4){logger[_0xff2b('0x13')]('License,\x20%s,\x20%s',_0x824740,_0x362125[_0xff2b('0x13')][_0xff2b('0x15')]);return _0x4234fc(_0x362125['error'][_0xff2b('0x15')]);}logger[_0xff2b('0x13')](_0xff2b('0xf'),_0x824740,_0x362125['error']['message']);return _0x55cd67(_0x362125['error'][_0xff2b('0x15')]);}else{logger[_0xff2b('0x16')](_0xff2b('0xf'),_0x824740,_0xff2b('0x10'));_0x55cd67(_0x362125[_0xff2b('0x17')]['message']);}})[_0xff2b('0x18')](function(_0x11998f){logger[_0xff2b('0x13')]('License,\x20%s,\x20%s',_0x824740,_0x11998f);_0x4234fc(_0x11998f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0c664fa..1f8eee1 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 _0xe2b2=['/:id/users','getAgents','post','/:id/canned_answers','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','addAgents','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp'];(function(_0x9e3ad3,_0x362185){var _0x5cf34c=function(_0x59aeb8){while(--_0x59aeb8){_0x9e3ad3['push'](_0x9e3ad3['shift']());}};_0x5cf34c(++_0x362185);}(_0xe2b2,0x1e1));var _0x2e2b=function(_0x5c8439,_0x25be06){_0x5c8439=_0x5c8439-0x0;var _0x30f3ec=_0xe2b2[_0x5c8439];return _0x30f3ec;};'use strict';var multer=require(_0x2e2b('0x0'));var util=require(_0x2e2b('0x1'));var path=require('path');var timeout=require(_0x2e2b('0x2'));var express=require(_0x2e2b('0x3'));var router=express['Router']();var fs_extra=require(_0x2e2b('0x4'));var auth=require(_0x2e2b('0x5'));var interaction=require(_0x2e2b('0x6'));var config=require(_0x2e2b('0x7'));var controller=require('./mailAccount.controller');router[_0x2e2b('0x8')]('/',auth['isAuthenticated'](),controller[_0x2e2b('0x9')]);router[_0x2e2b('0x8')](_0x2e2b('0xa'),auth['isAuthenticated'](),controller[_0x2e2b('0xb')]);router[_0x2e2b('0x8')](_0x2e2b('0xc'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0xe')]);router['get'](_0x2e2b('0xf'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x10')]);router['get']('/:id/canned_answers',auth[_0x2e2b('0xd')](),controller['getAnswers']);router[_0x2e2b('0x8')]('/:id/in_servers',auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x11')]);router[_0x2e2b('0x8')]('/:id/out_servers',auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x12')]);router[_0x2e2b('0x8')](_0x2e2b('0x13'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x14')]);router['get'](_0x2e2b('0x15'),auth[_0x2e2b('0xd')](),controller['getApplications']);router['get'](_0x2e2b('0x16'),auth[_0x2e2b('0xd')](),controller['getMessages']);router['get'](_0x2e2b('0x17'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x18')]);router['get'](_0x2e2b('0x19'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x1a')]);router[_0x2e2b('0x1b')](_0x2e2b('0xf'),auth[_0x2e2b('0xd')](),controller['addDisposition']);router[_0x2e2b('0x1b')](_0x2e2b('0x1c'),auth[_0x2e2b('0xd')](),controller['addAnswer']);router[_0x2e2b('0x1b')]('/',auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x1d')]);router[_0x2e2b('0x1b')](_0x2e2b('0x1e'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x1f')]);router[_0x2e2b('0x1b')](_0x2e2b('0x20'),auth['isAuthenticated'](),controller[_0x2e2b('0x21')]);router[_0x2e2b('0x1b')](_0x2e2b('0x13'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x22')]);router['post'](_0x2e2b('0x15'),auth[_0x2e2b('0xd')](),controller['addApplications']);router['post'](_0x2e2b('0x23'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x24')]);router[_0x2e2b('0x1b')](_0x2e2b('0x19'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x25')]);router['put'](_0x2e2b('0xc'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x26')]);router['delete'](_0x2e2b('0xf'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x27')]);router[_0x2e2b('0x28')](_0x2e2b('0x1c'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x29')]);router[_0x2e2b('0x28')](_0x2e2b('0x1e'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x2a')]);router[_0x2e2b('0x28')](_0x2e2b('0x20'),auth[_0x2e2b('0xd')](),controller[_0x2e2b('0x2b')]);router[_0x2e2b('0x28')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2e2b('0x28')]('/:id/users',auth['isAuthenticated'](),controller[_0x2e2b('0x2c')]);module[_0x2e2b('0x2d')]=router; \ No newline at end of file +var _0xe95b=['/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addInteraction','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','path','express','Router','../../components/interaction/service','./mailAccount.controller','get','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','getAnswers'];(function(_0x2875ee,_0x4d2063){var _0x4c747d=function(_0x47cb50){while(--_0x47cb50){_0x2875ee['push'](_0x2875ee['shift']());}};_0x4c747d(++_0x4d2063);}(_0xe95b,0xee));var _0xbe95=function(_0xc4c26,_0x2aee86){_0xc4c26=_0xc4c26-0x0;var _0x5ba09a=_0xe95b[_0xc4c26];return _0x5ba09a;};'use strict';var multer=require(_0xbe95('0x0'));var util=require('util');var path=require(_0xbe95('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe95('0x2'));var router=express[_0xbe95('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbe95('0x4'));var config=require('../../config/environment');var controller=require(_0xbe95('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbe95('0x6')](_0xbe95('0x7'),auth['isAuthenticated'](),controller[_0xbe95('0x8')]);router[_0xbe95('0x6')](_0xbe95('0x9'),auth[_0xbe95('0xa')](),controller['show']);router[_0xbe95('0x6')](_0xbe95('0xb'),auth['isAuthenticated'](),controller[_0xbe95('0xc')]);router[_0xbe95('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbe95('0xd')]);router[_0xbe95('0x6')](_0xbe95('0xe'),auth[_0xbe95('0xa')](),controller[_0xbe95('0xf')]);router[_0xbe95('0x6')](_0xbe95('0x10'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x11')]);router[_0xbe95('0x6')](_0xbe95('0x12'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x13')]);router[_0xbe95('0x6')](_0xbe95('0x14'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x15')]);router[_0xbe95('0x6')](_0xbe95('0x16'),auth[_0xbe95('0xa')](),controller['getMessages']);router[_0xbe95('0x6')]('/:id/verify',auth[_0xbe95('0xa')](),controller[_0xbe95('0x17')]);router[_0xbe95('0x6')](_0xbe95('0x18'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x19')]);router[_0xbe95('0x1a')](_0xbe95('0xb'),auth['isAuthenticated'](),controller[_0xbe95('0x1b')]);router[_0xbe95('0x1a')]('/:id/canned_answers',auth[_0xbe95('0xa')](),controller[_0xbe95('0x1c')]);router[_0xbe95('0x1a')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe95('0x1a')](_0xbe95('0xe'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x1d')]);router[_0xbe95('0x1a')](_0xbe95('0x10'),auth[_0xbe95('0xa')](),controller['addSmtp']);router[_0xbe95('0x1a')](_0xbe95('0x12'),auth['isAuthenticated'](),controller[_0xbe95('0x1e')]);router[_0xbe95('0x1a')](_0xbe95('0x14'),auth[_0xbe95('0xa')](),controller['addApplications']);router[_0xbe95('0x1a')](_0xbe95('0x1f'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x20')]);router[_0xbe95('0x1a')](_0xbe95('0x18'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x21')]);router['put']('/:id',auth[_0xbe95('0xa')](),controller[_0xbe95('0x22')]);router[_0xbe95('0x23')](_0xbe95('0xb'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x24')]);router['delete']('/:id/canned_answers',auth[_0xbe95('0xa')](),controller[_0xbe95('0x25')]);router['delete'](_0xbe95('0xe'),auth[_0xbe95('0xa')](),controller[_0xbe95('0x26')]);router[_0xbe95('0x23')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xbe95('0x27')]);router[_0xbe95('0x23')](_0xbe95('0x9'),auth['isAuthenticated'](),controller[_0xbe95('0x28')]);router['delete'](_0xbe95('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xbe95('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 41d0f5b..fa8fe78 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 _0x3f7c=['custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','outlook365','getDataValue','provider'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f7c,0x91));var _0xc3f7=function(_0x1ac0fa,_0x5ca1dc){_0x1ac0fa=_0x1ac0fa-0x0;var _0x150a14=_0x3f7c[_0x1ac0fa];return _0x150a14;};'use strict';var Sequelize=require(_0xc3f7('0x0'));module[_0xc3f7('0x1')]={'description':{'type':Sequelize[_0xc3f7('0x2')]},'name':{'type':Sequelize[_0xc3f7('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xc3f7('0x4')]},'markAsUnread':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc3f7('0x2')],'allowNull':![],'defaultValue':_0xc3f7('0x5')},'fontSize':{'type':Sequelize[_0xc3f7('0x6')](0x2)[_0xc3f7('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc3f7('0x4')],'defaultValue':function(){return _0xc3f7('0x8');}},'notificationSound':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc3f7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc3f7('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc3f7('0x6')],'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[_0xc3f7('0x3')],'defaultValue':![],'comment':_0xc3f7('0x9'),'set':function(_0x72eaff){if(!_0x72eaff)this[_0xc3f7('0xa')]('mandatoryDispositionPauseId',null);this[_0xc3f7('0xa')](_0xc3f7('0xb'),_0x72eaff);}},'provider':{'type':Sequelize[_0xc3f7('0xc')]('gmail',_0xc3f7('0xd'),'yahoo',_0xc3f7('0xe')),'defaultValue':null,'get':function(){if(!this[_0xc3f7('0xf')](_0xc3f7('0x10')))return _0xc3f7('0x11');return this[_0xc3f7('0xf')](_0xc3f7('0x10'));},'set':function(_0x59b36c){if(_0x59b36c==='custom')_0x59b36c=null;return this[_0xc3f7('0xa')](_0xc3f7('0x10'),_0x59b36c);}}}; \ No newline at end of file +var _0xfd22=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN'];(function(_0x38dd20,_0x5de06d){var _0x3d4ec8=function(_0x14964c){while(--_0x14964c){_0x38dd20['push'](_0x38dd20['shift']());}};_0x3d4ec8(++_0x5de06d);}(_0xfd22,0xac));var _0x2fd2=function(_0x1d8e9a,_0x28692d){_0x1d8e9a=_0x1d8e9a-0x0;var _0x3af33f=_0xfd22[_0x1d8e9a];return _0x3af33f;};'use strict';var Sequelize=require(_0x2fd2('0x0'));module[_0x2fd2('0x1')]={'description':{'type':Sequelize[_0x2fd2('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2fd2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2fd2('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x2fd2('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2fd2('0x2')],'allowNull':![],'defaultValue':_0x2fd2('0x5')},'fontSize':{'type':Sequelize[_0x2fd2('0x6')](0x2)[_0x2fd2('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2fd2('0x8');}},'notificationSound':{'type':Sequelize[_0x2fd2('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2fd2('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2fd2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2fd2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2fd2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2fd2('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2fd2('0x3')],'defaultValue':![],'comment':_0x2fd2('0xa'),'set':function(_0x40ad22){if(!_0x40ad22)this[_0x2fd2('0xb')](_0x2fd2('0xc'),null);this['setDataValue'](_0x2fd2('0xd'),_0x40ad22);}},'provider':{'type':Sequelize[_0x2fd2('0xe')](_0x2fd2('0xf'),_0x2fd2('0x10'),_0x2fd2('0x11'),_0x2fd2('0x12')),'defaultValue':null,'get':function(){if(!this[_0x2fd2('0x13')]('provider'))return _0x2fd2('0x14');return this['getDataValue'](_0x2fd2('0x15'));},'set':function(_0x15891b){if(_0x15891b===_0x2fd2('0x14'))_0x15891b=null;return this[_0x2fd2('0xb')](_0x2fd2('0x15'),_0x15891b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 35eda85..8f08eaa 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 _0x0dea=['nolimit','removeAnswers','email','ListId','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','CmContact','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List','defaults','subject','out','messageId','Interaction','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','bluebird','util','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','stack','name','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','MailServerIn','keys','rawAttributes','include','find','catch','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer'];(function(_0x51a710,_0x5ce2a3){var _0x58e717=function(_0x40e436){while(--_0x40e436){_0x51a710['push'](_0x51a710['shift']());}};_0x58e717(++_0x5ce2a3);}(_0x0dea,0x10b));var _0xa0de=function(_0x38894d,_0x1883d8){_0x38894d=_0x38894d-0x0;var _0x5614fe=_0x0dea[_0x38894d];return _0x5614fe;};'use strict';var moment=require('moment');var BPromise=require(_0xa0de('0x0'));var util=require(_0xa0de('0x1'));var path=require('path');var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xa0de('0x2'));var logger=require('../../config/logger')(_0xa0de('0x3'));var config=require(_0xa0de('0x4'));var db=require(_0xa0de('0x5'))['db'];config[_0xa0de('0x6')]=_['defaults'](config[_0xa0de('0x6')],{'host':_0xa0de('0x7'),'port':0x18eb});var socket=require(_0xa0de('0x8'))(new Redis(config[_0xa0de('0x6')]));require('./mailAccount.socket')[_0xa0de('0x9')](socket);var jayson=require(_0xa0de('0xa'));var client=jayson[_0xa0de('0xb')][_0xa0de('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x11bb9d,_0x49c71a,_0x52a3dd,_0x4e9551){return new BPromise(function(_0x2a23f9,_0x548d7a){var _0x36957e=_0x4e9551||client;return _0x36957e['request'](_0x11bb9d,_0x52a3dd)['then'](function(_0x35ae44){logger[_0xa0de('0xd')](_0xa0de('0xe'),_0x49c71a,_0xa0de('0xf'));logger[_0xa0de('0x10')](_0xa0de('0x11'),_0x49c71a,'request\x20sent',JSON[_0xa0de('0x12')](_0x35ae44));if(_0x35ae44[_0xa0de('0x13')]){if(_0x35ae44[_0xa0de('0x13')]['code']===0x1f4){logger[_0xa0de('0x13')](_0xa0de('0xe'),_0x49c71a,_0x35ae44[_0xa0de('0x13')][_0xa0de('0x14')]);return _0x548d7a(_0x35ae44[_0xa0de('0x13')][_0xa0de('0x14')]);}logger[_0xa0de('0x13')]('MailAccount,\x20%s,\x20%s',_0x49c71a,_0x35ae44[_0xa0de('0x13')]['message']);return _0x2a23f9(_0x35ae44[_0xa0de('0x13')][_0xa0de('0x14')]);}else{logger['info'](_0xa0de('0xe'),_0x49c71a,'request\x20sent');_0x2a23f9(_0x35ae44['result'][_0xa0de('0x14')]);}})['catch'](function(_0x276f92){logger[_0xa0de('0x13')]('MailAccount,\x20%s,\x20%s',_0x49c71a,_0x276f92);_0x548d7a(_0x276f92);});});}function respondWithStatusCode(_0x1c139e,_0xe11813){_0xe11813=_0xe11813||0xcc;return function(_0xc957d3){if(_0xc957d3){return _0x1c139e[_0xa0de('0x15')](_0xe11813);}return _0x1c139e[_0xa0de('0x16')](_0xe11813)[_0xa0de('0x17')]();};}function respondWithResult(_0x3b185f,_0x29159c){_0x29159c=_0x29159c||0xc8;return function(_0x54b17a){if(_0x54b17a){return _0x3b185f[_0xa0de('0x16')](_0x29159c)[_0xa0de('0x18')](_0x54b17a);}};}function respondWithFilteredResult(_0x5a6450,_0xffb03a){return function(_0x13a379){if(_0x13a379){var _0x2cf4bb=typeof _0xffb03a[_0xa0de('0x19')]===_0xa0de('0x1a')&&typeof _0xffb03a[_0xa0de('0x1b')]===_0xa0de('0x1a');var _0x134114=_0x13a379[_0xa0de('0x1c')];var _0x50408e=_0x2cf4bb?0x0:_0xffb03a[_0xa0de('0x19')];var _0x18a783=_0x2cf4bb?_0x13a379[_0xa0de('0x1c')]:_0xffb03a[_0xa0de('0x19')]+_0xffb03a[_0xa0de('0x1b')];var _0xb4f83;if(_0x18a783>=_0x134114){_0x18a783=_0x134114;_0xb4f83=0xc8;}else{_0xb4f83=0xce;}_0x5a6450[_0xa0de('0x16')](_0xb4f83);return _0x5a6450[_0xa0de('0x1d')]('Content-Range',_0x50408e+'-'+_0x18a783+'/'+_0x134114)['json'](_0x13a379);}return null;};}function saveUpdates(_0x588e13){return function(_0x3c24de){if(_0x3c24de){return _0x3c24de[_0xa0de('0x1e')](_0x588e13)[_0xa0de('0x1f')](function(_0x36646e){return _0x36646e;});}return null;};}function removeEntity(_0x199214){return function(_0x2155a7){if(_0x2155a7){return _0x2155a7[_0xa0de('0x20')]()[_0xa0de('0x1f')](function(){var _0x193149=_0x2155a7[_0xa0de('0x21')]({'plain':!![]});var _0x5d5aa2='MailAccounts';return db[_0xa0de('0x22')][_0xa0de('0x20')]({'where':{'type':_0x5d5aa2,'resourceId':_0x193149['id']}})[_0xa0de('0x1f')](function(){return _0x2155a7;});})[_0xa0de('0x1f')](function(){_0x199214['status'](0xcc)[_0xa0de('0x17')]();});}};}function handleEntityNotFound(_0x1d416b){return function(_0x1a07fc){if(!_0x1a07fc){_0x1d416b[_0xa0de('0x15')](0x194);}return _0x1a07fc;};}function handleError(_0x2d3b1a,_0x3af2e2){_0x3af2e2=_0x3af2e2||0x1f4;return function(_0x426e46){logger[_0xa0de('0x13')](_0x426e46[_0xa0de('0x23')]);if(_0x426e46['name']){delete _0x426e46[_0xa0de('0x24')];}_0x2d3b1a['status'](_0x3af2e2)['send'](_0x426e46);};}function getImapHost(_0x227a0d){switch(_0x227a0d){case _0xa0de('0x25'):return'imap.gmail.com';case'yahoo':return _0xa0de('0x26');case _0xa0de('0x27'):return _0xa0de('0x28');case _0xa0de('0x29'):return _0xa0de('0x2a');}throw new Error(_0xa0de('0x2b'),_0x227a0d);}function getSmtpHost(_0x1f824a){switch(_0x1f824a){case _0xa0de('0x25'):return _0xa0de('0x2c');case'yahoo':return _0xa0de('0x2d');case'hotmail':return'smtp-mail.outlook.com';case _0xa0de('0x29'):return _0xa0de('0x2e');}throw new Error(_0xa0de('0x2b'),_0x1f824a);}function getAuthenticationOptions(_0x276a2d,_0x341fcd){var _0x21dd8a={};var _0x42850d={};if(_0x276a2d){_0x21dd8a[_0xa0de('0x2f')]=_0x42850d['user']=_0x341fcd[_0xa0de('0x30')];_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=_0x341fcd[_0xa0de('0x31')];if(_0x341fcd[_0xa0de('0x33')]){_0x21dd8a[_0xa0de('0x33')]=_0x42850d[_0xa0de('0x33')]=!![];_0x21dd8a[_0xa0de('0x34')]=_0x42850d[_0xa0de('0x34')]=_0x341fcd[_0xa0de('0x34')];_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=null;}else{_0x21dd8a[_0xa0de('0x34')]=_0x42850d[_0xa0de('0x34')]=null;}_0x21dd8a[_0xa0de('0x35')]=getImapHost(_0x276a2d);_0x21dd8a[_0xa0de('0x36')]=0x3e1;_0x42850d[_0xa0de('0x35')]=getSmtpHost(_0x276a2d);_0x42850d[_0xa0de('0x36')]=0x24b;_0x42850d['secure']=![];_0x21dd8a[_0xa0de('0x37')]=_0x42850d['service']=null;}else{if(_0x341fcd[_0xa0de('0x38')]){_0x21dd8a[_0xa0de('0x2f')]=_0x42850d[_0xa0de('0x2f')]=_0x341fcd['username'];_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=_0x341fcd[_0xa0de('0x31')];}else{_0x21dd8a[_0xa0de('0x38')]=_0x42850d[_0xa0de('0x38')]=![];_0x21dd8a[_0xa0de('0x2f')]=_0x42850d[_0xa0de('0x2f')]=null;_0x21dd8a[_0xa0de('0x31')]=_0x42850d[_0xa0de('0x32')]=null;}_0x21dd8a[_0xa0de('0x35')]=_0x341fcd['Imap'][_0xa0de('0x35')];_0x21dd8a[_0xa0de('0x36')]=_0x341fcd[_0xa0de('0x39')][_0xa0de('0x36')];_0x42850d[_0xa0de('0x35')]=_0x341fcd['Smtp'][_0xa0de('0x35')];_0x42850d[_0xa0de('0x36')]=_0x341fcd[_0xa0de('0x3a')][_0xa0de('0x36')];}return{'Imap':_0x21dd8a,'Smtp':_0x42850d};}exports['index']=function(_0x5d9ef0,_0x2978f7){var _0x3ca82a={'include':[{'model':db['MailServerIn'],'as':_0xa0de('0x39')},{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x3c')],'as':_0xa0de('0x3d')}]},_0x2e8587={},_0x50f9b4={'count':0x0,'rows':[]};var _0x596d7f=_['map'](db[_0xa0de('0x3e')]['rawAttributes'],function(_0x4f2ae4){return{'name':_0x4f2ae4[_0xa0de('0x3f')],'type':_0x4f2ae4[_0xa0de('0x40')][_0xa0de('0x41')]};});_0x2e8587['model']=_[_0xa0de('0x42')](_0x596d7f,_0xa0de('0x24'));_0x2e8587[_0xa0de('0x43')]=_['keys'](_0x5d9ef0[_0xa0de('0x43')]);_0x2e8587[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x2e8587['model'],_0x2e8587['query']);_0x3ca82a[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x2e8587[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x5d9ef0['query']['fields']));_0x3ca82a['attributes']=_0x3ca82a[_0xa0de('0x46')][_0xa0de('0x49')]?_0x3ca82a[_0xa0de('0x46')]:_0x2e8587[_0xa0de('0x47')];if(!_0x5d9ef0[_0xa0de('0x43')]['hasOwnProperty']('nolimit')){_0x3ca82a['limit']=qs[_0xa0de('0x1b')](_0x5d9ef0['query'][_0xa0de('0x1b')]);_0x3ca82a['offset']=qs[_0xa0de('0x19')](_0x5d9ef0[_0xa0de('0x43')]['offset']);}_0x3ca82a[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x3ca82a[_0xa0de('0x4c')]=qs['filters'](_[_0xa0de('0x4d')](_0x5d9ef0['query'],_0x2e8587[_0xa0de('0x44')]),_0x596d7f);if(_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x3ca82a[_0xa0de('0x4c')]=_['merge'](_0x3ca82a[_0xa0de('0x4c')],{'$or':_[_0xa0de('0x42')](_0x596d7f,function(_0x5e076d){if(_0x5e076d['type']!=='VIRTUAL'){var _0x2cb9f8={};_0x2cb9f8[_0x5e076d[_0xa0de('0x24')]]={'$like':'%'+_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x2cb9f8;}})});}_0x3ca82a=_[_0xa0de('0x4f')]({},_0x3ca82a,_0x5d9ef0[_0xa0de('0x50')]);var _0x57f105={'where':_0x3ca82a['where']};return db[_0xa0de('0x3e')][_0xa0de('0x1c')](_0x57f105)[_0xa0de('0x1f')](function(_0x2bbd9b){_0x50f9b4[_0xa0de('0x1c')]=_0x2bbd9b;if(_0x5d9ef0[_0xa0de('0x43')][_0xa0de('0x51')]){_0x3ca82a['include']=[{'all':!![]}];}return db[_0xa0de('0x3e')][_0xa0de('0x52')](_0x3ca82a);})[_0xa0de('0x1f')](function(_0x30bed5){_0x50f9b4[_0xa0de('0x53')]=_0x30bed5;return _0x50f9b4;})['then'](respondWithFilteredResult(_0x2978f7,_0x3ca82a))['catch'](handleError(_0x2978f7,null));};exports[_0xa0de('0x54')]=function(_0x1d1c14,_0x24f6df){var _0x11afa9={'raw':![],'where':{'id':_0x1d1c14[_0xa0de('0x55')]['id']},'include':[{'model':db[_0xa0de('0x56')],'as':_0xa0de('0x39')},{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x3c')],'as':_0xa0de('0x3d')}]},_0x5bfac0={};_0x5bfac0[_0xa0de('0x47')]=_[_0xa0de('0x57')](db['MailAccount'][_0xa0de('0x58')]);_0x5bfac0[_0xa0de('0x43')]=_['keys'](_0x1d1c14[_0xa0de('0x43')]);_0x5bfac0[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x5bfac0[_0xa0de('0x47')],_0x5bfac0['query']);_0x11afa9[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x5bfac0[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x1d1c14['query'][_0xa0de('0x48')]));_0x11afa9[_0xa0de('0x46')]=_0x11afa9[_0xa0de('0x46')][_0xa0de('0x49')]?_0x11afa9[_0xa0de('0x46')]:_0x5bfac0['model'];if(_0x1d1c14[_0xa0de('0x43')][_0xa0de('0x51')]){_0x11afa9[_0xa0de('0x59')]=[{'all':!![]}];}_0x11afa9=_[_0xa0de('0x4f')]({},_0x11afa9,_0x1d1c14[_0xa0de('0x50')]);return db[_0xa0de('0x3e')][_0xa0de('0x5a')](_0x11afa9)[_0xa0de('0x1f')](handleEntityNotFound(_0x24f6df,null))[_0xa0de('0x1f')](respondWithResult(_0x24f6df,null))[_0xa0de('0x5b')](handleError(_0x24f6df,null));};exports[_0xa0de('0x1e')]=function(_0x3b4d20,_0x4d5489){if(_0x3b4d20[_0xa0de('0x5c')]['id']){delete _0x3b4d20['body']['id'];}var _0x4d8603=_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x5d')]===_0xa0de('0x5e')?null:_0x3b4d20['body'][_0xa0de('0x5d')];var _0x425c4e=_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')]||{};var _0x1cfdd4=_0x3b4d20[_0xa0de('0x5c')]['Smtp']||{};if(_0x4d8603){_0x425c4e[_0xa0de('0x35')]=getImapHost(_0x4d8603);_0x425c4e[_0xa0de('0x36')]=0x3e1;_0x1cfdd4['host']=getSmtpHost(_0x4d8603);_0x1cfdd4[_0xa0de('0x36')]=0x24b;_0x1cfdd4[_0xa0de('0x5f')]=![];}if(_0x1cfdd4['modernAuthentication']){_0x1cfdd4[_0xa0de('0x5f')]=![];}else{_0x1cfdd4[_0xa0de('0x34')]=null;}if(!_0x425c4e[_0xa0de('0x33')])_0x425c4e['CloudProviderId']=null;_0x3b4d20[_0xa0de('0x5c')]['Imap']=_0x425c4e;_0x3b4d20['body'][_0xa0de('0x3a')]=_0x1cfdd4;return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x3b4d20[_0xa0de('0x55')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xa0de('0x39')},{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xa0de('0x1f')](handleEntityNotFound(_0x4d5489,null))[_0xa0de('0x1f')](function(_0x5940f6){if(!_0x5940f6)throw new Error(_0xa0de('0x60'));if(_0x5940f6[_0xa0de('0x37')])delete _0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')];return _0x5940f6;})[_0xa0de('0x1f')](saveUpdates(_0x3b4d20[_0xa0de('0x5c')],null))['then'](function(_0x4322fe){if(!_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')])return _0x4322fe;return db[_0xa0de('0x56')][_0xa0de('0x1e')](_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x39')],{'where':{'MailAccountId':_0x4322fe['id']}})['then'](function(){return _0x4322fe;});})[_0xa0de('0x1f')](function(_0x4b245d){if(!_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x3a')])return _0x4b245d;return db[_0xa0de('0x3b')][_0xa0de('0x1e')](_0x3b4d20[_0xa0de('0x5c')][_0xa0de('0x3a')],{'where':{'MailAccountId':_0x4b245d['id']}})[_0xa0de('0x1f')](function(){return _0x4b245d;});})[_0xa0de('0x1f')](respondWithResult(_0x4d5489,null))[_0xa0de('0x5b')](handleError(_0x4d5489,null));};exports[_0xa0de('0x61')]=function(_0x276df6,_0x34d7af){return db[_0xa0de('0x3e')][_0xa0de('0x61')]()[_0xa0de('0x1f')](respondWithResult(_0x34d7af,null))[_0xa0de('0x5b')](handleError(_0x34d7af,null));};exports[_0xa0de('0x62')]=function(_0x362acf,_0x1c4ea8){if(_0x362acf[_0xa0de('0x5c')]['id']){delete _0x362acf[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x362acf[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1c4ea8,null))[_0xa0de('0x1f')](function(_0x211a4f){if(_0x211a4f){_0x362acf[_0xa0de('0x5c')][_0xa0de('0x63')]=_0x211a4f['id'];return db[_0xa0de('0x64')][_0xa0de('0x65')](_0x362acf[_0xa0de('0x5c')]);}})[_0xa0de('0x1f')](respondWithResult(_0x1c4ea8,null))[_0xa0de('0x5b')](handleError(_0x1c4ea8,null));};exports[_0xa0de('0x66')]=function(_0x31a66a,_0x5a9197){var _0x1194ef={'raw':![],'where':{}};var _0x12ce87={};var _0x592da8={'count':0x0,'rows':[]};return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x31a66a[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x5a9197,null))[_0xa0de('0x1f')](function(_0xd963b4){if(_0xd963b4){_0x12ce87[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0x64')][_0xa0de('0x58')]);_0x12ce87[_0xa0de('0x43')]=_['keys'](_0x31a66a[_0xa0de('0x43')]);_0x12ce87['filters']=_[_0xa0de('0x45')](_0x12ce87[_0xa0de('0x47')],_0x12ce87[_0xa0de('0x43')]);_0x1194ef[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x12ce87['model'],qs[_0xa0de('0x48')](_0x31a66a['query']['fields']));_0x1194ef['attributes']=_0x1194ef[_0xa0de('0x46')][_0xa0de('0x49')]?_0x1194ef[_0xa0de('0x46')]:_0x12ce87['model'];if(!_0x31a66a[_0xa0de('0x43')][_0xa0de('0x68')]('nolimit')){_0x1194ef[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x31a66a[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x1194ef[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x31a66a[_0xa0de('0x43')][_0xa0de('0x19')]);}_0x1194ef[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x31a66a[_0xa0de('0x43')]['sort']);_0x1194ef[_0xa0de('0x4c')]=qs[_0xa0de('0x44')](_[_0xa0de('0x4d')](_0x31a66a['query'],_0x12ce87[_0xa0de('0x44')]));_0x1194ef['where'][_0xa0de('0x63')]=_0xd963b4['id'];if(_0x31a66a['query']['filter']){_0x1194ef[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x1194ef['where'],{'$or':_[_0xa0de('0x42')](_0x1194ef[_0xa0de('0x46')],function(_0x25813b){var _0x952aa4={};_0x952aa4[_0x25813b]={'$like':'%'+_0x31a66a[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x952aa4;})});}_0x1194ef=_[_0xa0de('0x4f')]({},_0x1194ef,_0x31a66a['options']);return db['Disposition']['count']({'where':_0x1194ef[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x1c2607){_0x592da8[_0xa0de('0x1c')]=_0x1c2607;if(_0x31a66a[_0xa0de('0x43')]['includeAll']){_0x1194ef[_0xa0de('0x59')]=[{'all':!![]}];}return db[_0xa0de('0x64')][_0xa0de('0x52')](_0x1194ef);})['then'](function(_0x593187){_0x592da8[_0xa0de('0x53')]=_0x593187;return _0x592da8;});}})['then'](respondWithFilteredResult(_0x5a9197,_0x1194ef))['catch'](handleError(_0x5a9197,null));};exports[_0xa0de('0x69')]=function(_0xe85da9,_0x1664b9){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0xe85da9[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1664b9,null))['then'](function(_0x5d754a){if(_0x5d754a){return _0x5d754a['removeDispositions'](_0xe85da9[_0xa0de('0x43')][_0xa0de('0x6a')]);}})['then'](respondWithStatusCode(_0x1664b9,null))['catch'](handleError(_0x1664b9,null));};exports[_0xa0de('0x6b')]=function(_0x4b007b,_0x10786c){if(_0x4b007b['body']['id']){delete _0x4b007b[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x4b007b[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x10786c,null))[_0xa0de('0x1f')](function(_0x1e8334){if(_0x1e8334){_0x4b007b[_0xa0de('0x5c')]['MailAccountId']=_0x1e8334['id'];return db[_0xa0de('0x6c')][_0xa0de('0x65')](_0x4b007b['body']);}})[_0xa0de('0x1f')](respondWithResult(_0x10786c,null))[_0xa0de('0x5b')](handleError(_0x10786c,null));};exports['getAnswers']=function(_0x1c6a22,_0x2195ce){var _0x48620d={'raw':![],'where':{}};var _0x3deda4={};var _0xb7bc6b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1c6a22[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x2195ce,null))[_0xa0de('0x1f')](function(_0x3c4ea9){if(_0x3c4ea9){_0x3deda4[_0xa0de('0x47')]=_[_0xa0de('0x57')](db['CannedAnswer'][_0xa0de('0x58')]);_0x3deda4[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x1c6a22[_0xa0de('0x43')]);_0x3deda4[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x3deda4[_0xa0de('0x47')],_0x3deda4[_0xa0de('0x43')]);_0x48620d['attributes']=_[_0xa0de('0x45')](_0x3deda4[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x48')]));_0x48620d[_0xa0de('0x46')]=_0x48620d['attributes'][_0xa0de('0x49')]?_0x48620d[_0xa0de('0x46')]:_0x3deda4[_0xa0de('0x47')];if(!_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x68')](_0xa0de('0x6d'))){_0x48620d[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x1c6a22[_0xa0de('0x43')]['limit']);_0x48620d[_0xa0de('0x19')]=qs['offset'](_0x1c6a22['query'][_0xa0de('0x19')]);}_0x48620d[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x1c6a22['query'][_0xa0de('0x4b')]);_0x48620d['where']=qs[_0xa0de('0x44')](_[_0xa0de('0x4d')](_0x1c6a22['query'],_0x3deda4[_0xa0de('0x44')]));_0x48620d[_0xa0de('0x4c')][_0xa0de('0x63')]=_0x3c4ea9['id'];if(_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x48620d[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x48620d['where'],{'$or':_[_0xa0de('0x42')](_0x48620d[_0xa0de('0x46')],function(_0x48c9ef){var _0x227ba7={};_0x227ba7[_0x48c9ef]={'$like':'%'+_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x227ba7;})});}_0x48620d=_[_0xa0de('0x4f')]({},_0x48620d,_0x1c6a22[_0xa0de('0x50')]);return db['CannedAnswer']['count']({'where':_0x48620d[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x5922aa){_0xb7bc6b[_0xa0de('0x1c')]=_0x5922aa;if(_0x1c6a22[_0xa0de('0x43')][_0xa0de('0x51')]){_0x48620d[_0xa0de('0x59')]=[{'all':!![]}];}return db[_0xa0de('0x6c')][_0xa0de('0x52')](_0x48620d);})[_0xa0de('0x1f')](function(_0x58d8b1){_0xb7bc6b[_0xa0de('0x53')]=_0x58d8b1;return _0xb7bc6b;});}})['then'](respondWithFilteredResult(_0x2195ce,_0x48620d))['catch'](handleError(_0x2195ce,null));};exports['removeAnswers']=function(_0x1b1900,_0xaf40fd){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x1b1900[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0xaf40fd,null))[_0xa0de('0x1f')](function(_0x563159){if(_0x563159){return _0x563159[_0xa0de('0x6e')](_0x1b1900[_0xa0de('0x43')]['ids']);}})[_0xa0de('0x1f')](respondWithStatusCode(_0xaf40fd,null))[_0xa0de('0x5b')](handleError(_0xaf40fd,null));};exports[_0xa0de('0x65')]=function(_0x60a866,_0x1a3a14){var _0x9c7746={'name':_0x60a866[_0xa0de('0x5c')][_0xa0de('0x24')],'key':_0x60a866['body'][_0xa0de('0x41')],'provider':_0x60a866[_0xa0de('0x5c')][_0xa0de('0x5d')]===_0xa0de('0x5e')?null:_0x60a866['body'][_0xa0de('0x5d')],'email':_0x60a866['body'][_0xa0de('0x6f')],'ListId':_0x60a866['body'][_0xa0de('0x70')],'active':!_['isNil'](_0x60a866[_0xa0de('0x5c')]['active'])?_0x60a866[_0xa0de('0x5c')][_0xa0de('0x71')]:!![],'description':_0x60a866[_0xa0de('0x5c')]['description']||null};var _0x538ebf=getAuthenticationOptions(_0x9c7746[_0xa0de('0x5d')],_0x60a866[_0xa0de('0x5c')]);_0x9c7746[_0xa0de('0x39')]=_0x538ebf[_0xa0de('0x39')];_0x9c7746[_0xa0de('0x3a')]=_0x538ebf[_0xa0de('0x3a')];return db['MailAccount'][_0xa0de('0x65')](_0x9c7746,{'include':[{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a')},{'model':db[_0xa0de('0x56')],'as':_0xa0de('0x39')}]})[_0xa0de('0x1f')](function(_0x5dc8f5){var _0x3b14c6=_0x60a866[_0xa0de('0x2f')]['get']({'plain':!![]});if(!_0x3b14c6)throw new Error(_0xa0de('0x72'));if(_0x3b14c6['role']===_0xa0de('0x2f')){var _0x4707d1=_0x5dc8f5[_0xa0de('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xa0de('0x5a')]({'where':{'name':_0xa0de('0x73'),'userProfileId':_0x3b14c6[_0xa0de('0x74')]},'raw':!![]})[_0xa0de('0x1f')](function(_0x50bfbb){if(_0x50bfbb&&_0x50bfbb[_0xa0de('0x75')]===0x0){return db[_0xa0de('0x22')][_0xa0de('0x65')]({'name':_0x4707d1[_0xa0de('0x24')],'resourceId':_0x4707d1['id'],'type':_0x50bfbb['name'],'sectionId':_0x50bfbb['id']},{})[_0xa0de('0x1f')](function(){return _0x5dc8f5;});}else{return _0x5dc8f5;}})[_0xa0de('0x5b')](function(_0x388ebc){logger['error'](_0xa0de('0x76'),_0x388ebc);throw _0x388ebc;});}return _0x5dc8f5;})[_0xa0de('0x1f')](respondWithResult(_0x1a3a14,0xc9))[_0xa0de('0x5b')](handleError(_0x1a3a14,null));};exports[_0xa0de('0x77')]=function(_0x422ae8,_0x3d8213){return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x422ae8[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x3d8213,null))[_0xa0de('0x1f')](function(_0x507d9d){if(_0x507d9d){return _0x507d9d[_0xa0de('0x77')]();}return null;})[_0xa0de('0x1f')](respondWithResult(_0x3d8213,null))[_0xa0de('0x5b')](handleError(_0x3d8213,null));};exports['addImap']=function(_0x111a5b,_0x5494e4){if(_0x111a5b[_0xa0de('0x5c')]['id']){delete _0x111a5b[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x111a5b[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x5494e4,null))[_0xa0de('0x1f')](function(_0x234d01){if(_0x234d01){_0x111a5b[_0xa0de('0x5c')]['MailAccountId']=_0x234d01['id'];return db[_0xa0de('0x56')][_0xa0de('0x65')](_0x111a5b[_0xa0de('0x5c')]);}})['then'](respondWithResult(_0x5494e4,null))[_0xa0de('0x5b')](handleError(_0x5494e4,null));};exports['removeImap']=function(_0x54eeb2,_0x44099a){return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x54eeb2[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x44099a,null))[_0xa0de('0x1f')](function(_0x57d0e6){if(_0x57d0e6){return _0x57d0e6[_0xa0de('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x44099a,null))[_0xa0de('0x5b')](handleError(_0x44099a,null));};exports[_0xa0de('0x79')]=function(_0x2a707d,_0x47662e){return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x2a707d[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x47662e,null))[_0xa0de('0x1f')](function(_0x23d3d2){if(_0x23d3d2){return _0x23d3d2[_0xa0de('0x79')]();}return null;})[_0xa0de('0x1f')](respondWithResult(_0x47662e,null))['catch'](handleError(_0x47662e,null));};exports[_0xa0de('0x7a')]=function(_0x115a4a,_0x3e2267){if(_0x115a4a[_0xa0de('0x5c')]['id']){delete _0x115a4a[_0xa0de('0x5c')]['id'];}return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x115a4a['params']['id']}})['then'](handleEntityNotFound(_0x3e2267,null))['then'](function(_0x290879){if(_0x290879){_0x115a4a[_0xa0de('0x5c')]['MailAccountId']=_0x290879['id'];return db[_0xa0de('0x3b')][_0xa0de('0x65')](_0x115a4a[_0xa0de('0x5c')]);}})['then'](respondWithResult(_0x3e2267,null))[_0xa0de('0x5b')](handleError(_0x3e2267,null));};exports['removeSmtp']=function(_0x94013,_0x17cbde){return db['MailAccount']['findOne']({'where':{'id':_0x94013[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x17cbde,null))['then'](function(_0xd4c399){if(_0xd4c399){return _0xd4c399[_0xa0de('0x7b')](null);}return null;})['then'](respondWithStatusCode(_0x17cbde,null))[_0xa0de('0x5b')](handleError(_0x17cbde,null));};exports['addInteraction']=function(_0x206a1a,_0x132f6e){return db['MailInteraction']['find']({'where':{'id':_0x206a1a[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x132f6e,null))[_0xa0de('0x1f')](function(_0x57ccd7){if(_0x57ccd7){return _0x57ccd7['addInteraction'](_0x206a1a[_0xa0de('0x5c')]['ids'],_['omit'](_0x206a1a[_0xa0de('0x5c')],[_0xa0de('0x6a'),'id'])||{});}})[_0xa0de('0x1f')](respondWithResult(_0x132f6e,null))[_0xa0de('0x5b')](handleError(_0x132f6e,null));};exports['getInteractions']=function(_0x5397aa,_0xdc26f4){var _0x26a963={'raw':![],'where':{}};var _0xef57d0={};var _0x31da28={'count':0x0,'rows':[]};return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x5397aa[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0xdc26f4,null))['then'](function(_0x24c7e5){if(_0x24c7e5){_0xef57d0['model']=_[_0xa0de('0x57')](db[_0xa0de('0x7c')]['rawAttributes']);_0xef57d0[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x5397aa[_0xa0de('0x43')]);_0xef57d0[_0xa0de('0x44')]=_['intersection'](_0xef57d0[_0xa0de('0x47')],_0xef57d0[_0xa0de('0x43')]);_0x26a963['attributes']=_['intersection'](_0xef57d0[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x5397aa[_0xa0de('0x43')][_0xa0de('0x48')]));_0x26a963[_0xa0de('0x46')]=_0x26a963[_0xa0de('0x46')][_0xa0de('0x49')]?_0x26a963[_0xa0de('0x46')]:_0xef57d0[_0xa0de('0x47')];if(!_0x5397aa[_0xa0de('0x43')]['hasOwnProperty'](_0xa0de('0x6d'))){_0x26a963[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x5397aa[_0xa0de('0x43')]['limit']);_0x26a963[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x5397aa[_0xa0de('0x43')][_0xa0de('0x19')]);}_0x26a963[_0xa0de('0x4a')]=qs['sort'](_0x5397aa[_0xa0de('0x43')]['sort']);_0x26a963['where']=qs[_0xa0de('0x44')](_['pick'](_0x5397aa[_0xa0de('0x43')],_0xef57d0[_0xa0de('0x44')]));_0x26a963[_0xa0de('0x4c')]['MailAccountId']=_0x24c7e5['id'];if(_0x5397aa['query'][_0xa0de('0x4e')]){_0x26a963[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x26a963[_0xa0de('0x4c')],{'$or':_['map'](_0x26a963[_0xa0de('0x46')],function(_0x4069cc){var _0x4fad84={};_0x4fad84[_0x4069cc]={'$like':'%'+_0x5397aa[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x4fad84;})});}_0x26a963=_[_0xa0de('0x4f')]({},_0x26a963,_0x5397aa[_0xa0de('0x50')]);return db[_0xa0de('0x7c')]['count']({'where':_0x26a963[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x1e1025){_0x31da28['count']=_0x1e1025;if(_0x5397aa[_0xa0de('0x43')][_0xa0de('0x51')]){_0x26a963[_0xa0de('0x59')]=[{'model':db[_0xa0de('0x7d')],'as':_0xa0de('0x7e'),'required':![]},{'model':db['User'],'as':_0xa0de('0x7f'),'attributes':['name','fullname',_0xa0de('0x80')],'required':![]},{'model':db[_0xa0de('0x81')],'as':'Tags','attributes':['id','name',_0xa0de('0x82')],'where':_0x5397aa[_0xa0de('0x43')][_0xa0de('0x83')]?{'id':_0x5397aa[_0xa0de('0x43')][_0xa0de('0x83')]}:undefined,'required':_0x5397aa[_0xa0de('0x43')]['tag']?!![]:![]}];}return db[_0xa0de('0x7c')]['findAll'](_0x26a963);})[_0xa0de('0x1f')](function(_0x2f43dd){_0x31da28[_0xa0de('0x53')]=_0x2f43dd;return _0x31da28;});}})[_0xa0de('0x1f')](respondWithFilteredResult(_0xdc26f4,_0x26a963))[_0xa0de('0x5b')](handleError(_0xdc26f4,null));};exports[_0xa0de('0x84')]=function addApplications(_0x2cfbec,_0x191cbc){var _0x19147d=_0x2cfbec['params']['id'];var _0x282316=_0x2cfbec[_0xa0de('0x5c')];var _0x540855=0xc8;var _0x2a3ca7=null;return db[_0xa0de('0x85')][_0xa0de('0x86')]({'isolationLevel':db['sequelize'][_0xa0de('0x87')][_0xa0de('0x88')][_0xa0de('0x89')]},function(_0x473c8f){return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x19147d},'transaction':_0x473c8f})[_0xa0de('0x1f')](function(_0x42952c){if(_0x42952c){return db[_0xa0de('0x8a')][_0xa0de('0x20')]({'where':{'MailAccountId':_0x19147d},'transaction':_0x473c8f})[_0xa0de('0x1f')](function(){var _0x36bddd=_[_0xa0de('0x42')](_0x282316,function(_0x503ce3){_0x503ce3[_0xa0de('0x63')]=_0x19147d;return _0x503ce3;});return db['MailApplication'][_0xa0de('0x8b')](_0x36bddd,{'transaction':_0x473c8f});});}else{_0x540855=0x194;_0x2a3ca7=[];}});})[_0xa0de('0x1f')](function(){if(_0x540855!==0x194){return db[_0xa0de('0x8a')][_0xa0de('0x8c')]({'where':{'MailAccountId':_0x19147d},'order':_0xa0de('0x8d')})[_0xa0de('0x1f')](function(_0x105eee){_0x2a3ca7=_0x105eee;});}})[_0xa0de('0x5b')](function(_0x19c70b){_0x540855=0x1f4;logger[_0xa0de('0x13')](_0x19c70b[_0xa0de('0x23')]);if(_0x19c70b[_0xa0de('0x24')]){delete _0x19c70b[_0xa0de('0x24')];}_0x2a3ca7=_0x19c70b;})[_0xa0de('0x8e')](function(){if(_0x2a3ca7===null){_0x191cbc[_0xa0de('0x15')](_0x540855);}else{if(_0x540855===0x1f4){_0x191cbc[_0xa0de('0x16')](_0x540855)[_0xa0de('0x8f')](_0x2a3ca7);}else{_0x191cbc[_0xa0de('0x16')](_0x540855)[_0xa0de('0x18')](_0x2a3ca7);}}});};exports['getApplications']=function(_0x4317af,_0x1537bd){var _0x24437b={};var _0x1e4759={};var _0x2fcd7f;var _0x19f25f;return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x4317af[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1537bd,null))[_0xa0de('0x1f')](function(_0x436f13){if(_0x436f13){_0x2fcd7f=_0x436f13;_0x1e4759[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0x8a')]['rawAttributes']);_0x1e4759[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x4317af[_0xa0de('0x43')]);_0x1e4759[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x1e4759[_0xa0de('0x47')],_0x1e4759[_0xa0de('0x43')]);_0x24437b[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x1e4759[_0xa0de('0x47')],qs['fields'](_0x4317af['query'][_0xa0de('0x48')]));_0x24437b[_0xa0de('0x46')]=_0x24437b['attributes']['length']?_0x24437b['attributes']:_0x1e4759[_0xa0de('0x47')];_0x24437b[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x4317af[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x24437b['where']=qs['filters'](_[_0xa0de('0x4d')](_0x4317af[_0xa0de('0x43')],_0x1e4759[_0xa0de('0x44')]));if(_0x4317af[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x24437b[_0xa0de('0x4c')]=_['merge'](_0x24437b[_0xa0de('0x4c')],{'$or':_[_0xa0de('0x42')](_0x24437b[_0xa0de('0x46')],function(_0x5830f6){var _0x2a243e={};_0x2a243e[_0x5830f6]={'$like':'%'+_0x4317af['query'][_0xa0de('0x4e')]+'%'};return _0x2a243e;})});}_0x24437b=_[_0xa0de('0x4f')]({},_0x24437b,_0x4317af['options']);return _0x2fcd7f[_0xa0de('0x90')](_0x24437b);}})[_0xa0de('0x1f')](function(_0x4dbc4c){if(_0x4dbc4c){_0x19f25f=_0x4dbc4c[_0xa0de('0x49')];if(!_0x4317af[_0xa0de('0x43')]['hasOwnProperty'](_0xa0de('0x6d'))){_0x24437b['limit']=qs[_0xa0de('0x1b')](_0x4317af[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x24437b[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x4317af[_0xa0de('0x43')][_0xa0de('0x19')]);}return _0x2fcd7f[_0xa0de('0x90')](_0x24437b);}})[_0xa0de('0x1f')](function(_0x33f918){if(_0x33f918){return _0x33f918?{'count':_0x19f25f,'rows':_0x33f918}:null;}})[_0xa0de('0x1f')](respondWithResult(_0x1537bd,null))[_0xa0de('0x5b')](handleError(_0x1537bd,null));};exports[_0xa0de('0x91')]=function(_0x23821d,_0x4c3e11){var _0x3a90dd={'raw':!![],'where':{}};var _0x2e6858={};var _0x2a59ef={'count':0x0,'rows':[]};return db[_0xa0de('0x3e')]['findOne']({'where':{'id':_0x23821d[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x4c3e11,null))['then'](function(_0xf5f591){if(_0xf5f591){_0x2e6858[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0x92')]['rawAttributes']);_0x2e6858[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x23821d[_0xa0de('0x43')]);_0x2e6858[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x2e6858[_0xa0de('0x47')],_0x2e6858['query']);_0x3a90dd[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x2e6858['model'],qs[_0xa0de('0x48')](_0x23821d[_0xa0de('0x43')][_0xa0de('0x48')]));_0x3a90dd[_0xa0de('0x46')]=_0x3a90dd['attributes'][_0xa0de('0x49')]?_0x3a90dd['attributes']:_0x2e6858[_0xa0de('0x47')];if(!_0x23821d[_0xa0de('0x43')][_0xa0de('0x68')](_0xa0de('0x6d'))){_0x3a90dd[_0xa0de('0x1b')]=qs[_0xa0de('0x1b')](_0x23821d[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x3a90dd[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x23821d['query'][_0xa0de('0x19')]);}_0x3a90dd[_0xa0de('0x4a')]=qs['sort'](_0x23821d[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x3a90dd['where']=qs['filters'](_[_0xa0de('0x4d')](_0x23821d[_0xa0de('0x43')],_0x2e6858[_0xa0de('0x44')]));_0x3a90dd[_0xa0de('0x4c')]['MailAccountId']=_0xf5f591['id'];if(_0x23821d['query'][_0xa0de('0x4e')]){_0x3a90dd['where']=_[_0xa0de('0x4f')](_0x3a90dd['where'],{'$or':_['map'](_0x3a90dd[_0xa0de('0x46')],function(_0x42bdec){var _0x38d9ca={};_0x38d9ca[_0x42bdec]={'$like':'%'+_0x23821d[_0xa0de('0x43')][_0xa0de('0x4e')]+'%'};return _0x38d9ca;})});}if(_0x23821d['query'][_0xa0de('0x93')]){var _0x5a24a2=_0x23821d[_0xa0de('0x43')][_0xa0de('0x93')][_0xa0de('0x94')](',');var _0x337969={};_0x337969[_0x5a24a2[0x0]]={'$gte':moment(_0x5a24a2[0x1])[_0xa0de('0x95')](_0xa0de('0x96'))};_0x3a90dd[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x3a90dd[_0xa0de('0x4c')],_0x337969);}_0x3a90dd=_[_0xa0de('0x4f')]({},_0x3a90dd,_0x23821d['options']);return db[_0xa0de('0x92')][_0xa0de('0x1c')]({'where':_0x3a90dd[_0xa0de('0x4c')]})[_0xa0de('0x1f')](function(_0x1e77b3){_0x2a59ef[_0xa0de('0x1c')]=_0x1e77b3;if(_0x23821d[_0xa0de('0x43')][_0xa0de('0x51')]){_0x3a90dd[_0xa0de('0x59')]=[{'all':!![]}];}return db[_0xa0de('0x92')]['findAll'](_0x3a90dd);})[_0xa0de('0x1f')](function(_0x5c80b1){if(_0x23821d[_0xa0de('0x43')][_0xa0de('0x97')]===_0xa0de('0x98')){for(var _0xd36fc5=0x0;_0xd36fc5<_0x5c80b1[_0xa0de('0x49')];_0xd36fc5++){_0x5c80b1[_0xd36fc5][_0xa0de('0x5c')]=juice(_0x5c80b1[_0xd36fc5][_0xa0de('0x5c')]);}}_0x2a59ef[_0xa0de('0x53')]=_0x5c80b1;return _0x2a59ef;});}})[_0xa0de('0x1f')](respondWithFilteredResult(_0x4c3e11,_0x3a90dd))[_0xa0de('0x5b')](handleError(_0x4c3e11,null));};exports[_0xa0de('0x8f')]=function(_0x2254d8,_0x4c88a6){var _0x180d73,_0x22b414={},_0x1d2e9b;if(_0x2254d8[_0xa0de('0x5c')]['to']){_0x1d2e9b=_0x2254d8[_0xa0de('0x5c')]['to'][_0xa0de('0x94')](',')[0x0];}return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x2254d8['params']['id']},'include':[{'model':db[_0xa0de('0x99')],'as':'List','include':[{'model':db[_0xa0de('0x7d')],'as':_0xa0de('0x9a'),'where':{'email':_0x1d2e9b},'limit':0x1,'order':[[_0xa0de('0x9b'),'DESC']]}]},{'model':db[_0xa0de('0x3b')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa0de('0x9c')],'as':_0xa0de('0x9c'),'raw':!![]}]}]})[_0xa0de('0x1f')](handleEntityNotFound(_0x4c88a6,null))[_0xa0de('0x1f')](function(_0x5992ef){if(!_0x5992ef)return;_0x180d73=_0x5992ef;if(!_0x5992ef[_0xa0de('0x3a')])throw new Error(_0xa0de('0x9d'));if(_[_0xa0de('0x9e')](_0x2254d8[_0xa0de('0x5c')][_0xa0de('0x9f')])){_0x2254d8[_0xa0de('0x5c')][_0xa0de('0x9f')]=util[_0xa0de('0x95')](_0xa0de('0xa0'),_0x5992ef[_0xa0de('0x24')],_0x5992ef[_0xa0de('0x6f')]||_0x5992ef['Smtp'][_0xa0de('0x2f')]);}if(_0x2254d8[_0xa0de('0x5c')]['attachments']&&_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xa0de('0x49')]){for(var _0xea9eb9=0x0;_0xea9eb9<_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xa0de('0x49')];_0xea9eb9+=0x1){_0x2254d8['body'][_0xa0de('0xa1')][_0xea9eb9]={'filename':_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xea9eb9]['name'],'path':path[_0xa0de('0xa2')](config[_0xa0de('0xa3')],_0xa0de('0xa4'),_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xa1')][_0xea9eb9][_0xa0de('0xa5')])};}}var _0x4fd2d8=_0x5992ef['getSmtpOptions']();return respondWithRpcPromise(_0xa0de('0xa6'),_0xa0de('0xa7'),{'account':_0x4fd2d8,'message':_0x2254d8[_0xa0de('0x5c')]});})['then'](function(_0x468651){if(!_0x468651)return;_0x22b414=_0x468651;if(!_0x180d73[_0xa0de('0xa8')])throw new Error('List\x20not\x20found');if(_0x180d73[_0xa0de('0xa8')][_0xa0de('0x9a')][_0xa0de('0x49')])return _0x180d73[_0xa0de('0xa8')]['Contacts'][0x0];return db[_0xa0de('0x7d')][_0xa0de('0x65')](_[_0xa0de('0xa9')](_0x2254d8['body'],{'firstName':_0x2254d8[_0xa0de('0x5c')]['to'],'email':_0x2254d8[_0xa0de('0x5c')]['to'],'phone':_0x2254d8['body']['to'],'ListId':_0x180d73[_0xa0de('0x70')]}));})['then'](function(_0x460bd1){if(!_0x460bd1)return;var _0x2c8083={'UserId':_0x2254d8['user']['id'],'ContactId':_0x460bd1['id'],'MailAccountId':_0x180d73['id'],'inReplyTo':_0x22b414['messageId'],'to':_0x2254d8[_0xa0de('0x5c')][_0xa0de('0x9f')],'cc':_0x2254d8[_0xa0de('0x5c')]['cc'],'subject':_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xaa')],'attach':_0x2254d8[_0xa0de('0x5c')]['attach'],'firstMsgDirection':_0xa0de('0xab'),'lastMsgAt':moment()['format'](_0xa0de('0x96')),'lastMsgDirection':_0xa0de('0xab'),'Messages':[_[_0xa0de('0x4f')](_0x2254d8['body'],{'messageId':_0x22b414[_0xa0de('0xac')],'sentAt':moment()['format'](_0xa0de('0x96')),'read':!![],'MailAccountId':_0x180d73['id'],'UserId':_0x2254d8['user']['id'],'ContactId':_0x460bd1['id']})]};if(_0x2254d8[_0xa0de('0x5c')]['Interaction']){_0x2c8083=_[_0xa0de('0x4f')](_0x2c8083,_0x2254d8[_0xa0de('0x5c')][_0xa0de('0xad')]);}return db[_0xa0de('0x7c')][_0xa0de('0x65')](_0x2c8083,{'include':[{'model':db[_0xa0de('0x92')],'as':'Messages'}]});})[_0xa0de('0x1f')](respondWithResult(_0x4c88a6,null))[_0xa0de('0x5b')](handleError(_0x4c88a6,null));};exports[_0xa0de('0xae')]=function(_0x24f424,_0x5176fc){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x24f424[_0xa0de('0x55')]['id']},'include':[{'model':db[_0xa0de('0x3b')],'as':_0xa0de('0x3a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa0de('0x9c'),'raw':!![]}]}]})[_0xa0de('0x1f')](handleEntityNotFound(_0x5176fc,null))[_0xa0de('0x1f')](function(_0x3bd308){if(!_0x3bd308['Smtp'])return;var _0x15d218=_0x3bd308[_0xa0de('0xaf')]();return respondWithRpcPromise(_0xa0de('0xb0'),_0xa0de('0xae'),{'account':_0x15d218});})[_0xa0de('0x1f')](respondWithResult(_0x5176fc,null))[_0xa0de('0x5b')](handleError(_0x5176fc,null));};exports[_0xa0de('0x20')]=function(_0xf95408,_0x5e9db1){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0xf95408[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x5e9db1,null))[_0xa0de('0x1f')](function(_0x1e995b){if(_0x1e995b&&_0x1e995b['service']){throw new db[(_0xa0de('0xb1'))][(_0xa0de('0xb2'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1e995b;})[_0xa0de('0x1f')](removeEntity(_0x5e9db1,null))[_0xa0de('0x5b')](handleError(_0x5e9db1,null));};exports[_0xa0de('0xb3')]=function(_0x365664,_0x1fcead){return db[_0xa0de('0x3e')][_0xa0de('0x5a')]({'where':{'id':_0x365664[_0xa0de('0x55')]['id']}})['then'](handleEntityNotFound(_0x1fcead,null))['then'](function(_0x15b95c){if(_0x15b95c){return _0x15b95c[_0xa0de('0xb3')](_0x365664['body'][_0xa0de('0x6a')],_['omit'](_0x365664[_0xa0de('0x5c')],[_0xa0de('0x6a'),'id'])||{})[_0xa0de('0xb4')](function(_0x57f161){for(var _0x40ddc8=0x0;_0x40ddc8<_0x365664[_0xa0de('0x5c')][_0xa0de('0x6a')]['length'];_0x40ddc8+=0x1){socket[_0xa0de('0xb5')](_0xa0de('0xb6'),{'UserId':Number(_0x365664[_0xa0de('0x5c')][_0xa0de('0x6a')][_0x40ddc8]),'MailAccountId':Number(_0x365664['params']['id'])});}return _0x57f161;});}})[_0xa0de('0x1f')](respondWithResult(_0x1fcead,null))['catch'](handleError(_0x1fcead,null));};exports[_0xa0de('0xb7')]=function(_0x407a35,_0x21bde3){return db[_0xa0de('0x3e')]['find']({'where':{'id':_0x407a35[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x21bde3,null))[_0xa0de('0x1f')](function(_0x368b9a){if(_0x368b9a){return _0x368b9a[_0xa0de('0xb7')](_0x407a35[_0xa0de('0x43')]['ids'])[_0xa0de('0x1f')](function(){if(_[_0xa0de('0xb8')](_0x407a35[_0xa0de('0x43')]['ids'])){for(var _0x106998=0x0;_0x106998<_0x407a35[_0xa0de('0x43')][_0xa0de('0x6a')][_0xa0de('0x49')];_0x106998+=0x1){socket[_0xa0de('0xb5')](_0xa0de('0xb9'),{'UserId':Number(_0x407a35[_0xa0de('0x43')][_0xa0de('0x6a')][_0x106998]),'MailAccountId':Number(_0x407a35[_0xa0de('0x55')]['id'])});}}else{socket[_0xa0de('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x407a35[_0xa0de('0x43')]['ids']),'MailAccountId':Number(_0x407a35[_0xa0de('0x55')]['id'])});}});}})[_0xa0de('0x1f')](respondWithStatusCode(_0x21bde3,null))['catch'](handleError(_0x21bde3,null));};exports[_0xa0de('0xba')]=function(_0x31cb82,_0x1e4834){var _0x3fd7f6={};var _0x470c1b={};var _0x3edef5;var _0x2ee0a2;return db[_0xa0de('0x3e')][_0xa0de('0x67')]({'where':{'id':_0x31cb82[_0xa0de('0x55')]['id']}})[_0xa0de('0x1f')](handleEntityNotFound(_0x1e4834,null))['then'](function(_0x22ae58){if(_0x22ae58){_0x3edef5=_0x22ae58;_0x470c1b[_0xa0de('0x47')]=_[_0xa0de('0x57')](db[_0xa0de('0xbb')]['rawAttributes']);_0x470c1b[_0xa0de('0x43')]=_[_0xa0de('0x57')](_0x31cb82[_0xa0de('0x43')]);_0x470c1b[_0xa0de('0x44')]=_[_0xa0de('0x45')](_0x470c1b['model'],_0x470c1b[_0xa0de('0x43')]);_0x3fd7f6[_0xa0de('0x46')]=_[_0xa0de('0x45')](_0x470c1b[_0xa0de('0x47')],qs[_0xa0de('0x48')](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x48')]));_0x3fd7f6[_0xa0de('0x46')]=_0x3fd7f6[_0xa0de('0x46')]['length']?_0x3fd7f6[_0xa0de('0x46')]:_0x470c1b['model'];_0x3fd7f6[_0xa0de('0x4a')]=qs[_0xa0de('0x4b')](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x4b')]);_0x3fd7f6[_0xa0de('0x4c')]=qs[_0xa0de('0x44')](_['pick'](_0x31cb82[_0xa0de('0x43')],_0x470c1b[_0xa0de('0x44')]));if(_0x31cb82[_0xa0de('0x43')][_0xa0de('0x4e')]){_0x3fd7f6[_0xa0de('0x4c')]=_[_0xa0de('0x4f')](_0x3fd7f6[_0xa0de('0x4c')],{'$or':_['map'](_0x3fd7f6[_0xa0de('0x46')],function(_0x26e4ea){var _0x20d581={};_0x20d581[_0x26e4ea]={'$like':'%'+_0x31cb82[_0xa0de('0x43')]['filter']+'%'};return _0x20d581;})});}_0x3fd7f6=_['merge']({},_0x3fd7f6,_0x31cb82[_0xa0de('0x50')]);return _0x3edef5['getAgents'](_0x3fd7f6);}})[_0xa0de('0x1f')](function(_0x1cba1c){if(_0x1cba1c){_0x2ee0a2=_0x1cba1c['length'];if(!_0x31cb82[_0xa0de('0x43')][_0xa0de('0x68')](_0xa0de('0x6d'))){_0x3fd7f6[_0xa0de('0x1b')]=qs['limit'](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x1b')]);_0x3fd7f6[_0xa0de('0x19')]=qs[_0xa0de('0x19')](_0x31cb82[_0xa0de('0x43')][_0xa0de('0x19')]);}return _0x3edef5[_0xa0de('0xba')](_0x3fd7f6);}})[_0xa0de('0x1f')](function(_0x1dc7b6){if(_0x1dc7b6){return _0x1dc7b6?{'count':_0x2ee0a2,'rows':_0x1dc7b6}:null;}})['then'](respondWithResult(_0x1e4834,null))[_0xa0de('0x5b')](handleError(_0x1e4834,null));}; \ No newline at end of file +var _0x9c3e=['rawAttributes','include','body','custom','find','MailServerOut','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','provider','email','ListId','isNil','active','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','internal','Tag','tag','sequelize','transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','priority','finally','send','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','gmail','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','secure','service','authentication','Imap','port','Smtp','MailServerIn','Pause','map','MailAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','findAll','rows','show','params'];(function(_0x2ecb2f,_0x92006b){var _0x4921a1=function(_0x591741){while(--_0x591741){_0x2ecb2f['push'](_0x2ecb2f['shift']());}};_0x4921a1(++_0x92006b);}(_0x9c3e,0x1d4));var _0xe9c3=function(_0x35ef88,_0x2c2091){_0x35ef88=_0x35ef88-0x0;var _0x41e044=_0x9c3e[_0x35ef88];return _0x41e044;};'use strict';var moment=require(_0xe9c3('0x0'));var BPromise=require(_0xe9c3('0x1'));var util=require(_0xe9c3('0x2'));var path=require(_0xe9c3('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0xe9c3('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xe9c3('0x5'))(_0xe9c3('0x6'));var config=require(_0xe9c3('0x7'));var db=require(_0xe9c3('0x8'))['db'];config[_0xe9c3('0x9')]=_[_0xe9c3('0xa')](config[_0xe9c3('0x9')],{'host':_0xe9c3('0xb'),'port':0x18eb});var socket=require(_0xe9c3('0xc'))(new Redis(config[_0xe9c3('0x9')]));require(_0xe9c3('0xd'))[_0xe9c3('0xe')](socket);var jayson=require(_0xe9c3('0xf'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x6482a3,_0x4d63c2,_0x43c4ce,_0x5883e3){return new BPromise(function(_0x42ae1f,_0x55ccab){var _0x137668=_0x5883e3||client;return _0x137668[_0xe9c3('0x10')](_0x6482a3,_0x43c4ce)[_0xe9c3('0x11')](function(_0x4b1d38){logger[_0xe9c3('0x12')](_0xe9c3('0x13'),_0x4d63c2,'request\x20sent');logger[_0xe9c3('0x14')](_0xe9c3('0x15'),_0x4d63c2,_0xe9c3('0x16'),JSON['stringify'](_0x4b1d38));if(_0x4b1d38[_0xe9c3('0x17')]){if(_0x4b1d38[_0xe9c3('0x17')][_0xe9c3('0x18')]===0x1f4){logger[_0xe9c3('0x17')](_0xe9c3('0x13'),_0x4d63c2,_0x4b1d38[_0xe9c3('0x17')][_0xe9c3('0x19')]);return _0x55ccab(_0x4b1d38[_0xe9c3('0x17')][_0xe9c3('0x19')]);}logger[_0xe9c3('0x17')]('MailAccount,\x20%s,\x20%s',_0x4d63c2,_0x4b1d38[_0xe9c3('0x17')][_0xe9c3('0x19')]);return _0x42ae1f(_0x4b1d38[_0xe9c3('0x17')][_0xe9c3('0x19')]);}else{logger[_0xe9c3('0x12')]('MailAccount,\x20%s,\x20%s',_0x4d63c2,_0xe9c3('0x16'));_0x42ae1f(_0x4b1d38[_0xe9c3('0x1a')][_0xe9c3('0x19')]);}})[_0xe9c3('0x1b')](function(_0x3db5d2){logger[_0xe9c3('0x17')](_0xe9c3('0x13'),_0x4d63c2,_0x3db5d2);_0x55ccab(_0x3db5d2);});});}function respondWithStatusCode(_0x3f8200,_0x4f4b0d){_0x4f4b0d=_0x4f4b0d||0xcc;return function(_0x492263){if(_0x492263){return _0x3f8200[_0xe9c3('0x1c')](_0x4f4b0d);}return _0x3f8200[_0xe9c3('0x1d')](_0x4f4b0d)[_0xe9c3('0x1e')]();};}function respondWithResult(_0x213481,_0x588f58){_0x588f58=_0x588f58||0xc8;return function(_0x370df6){if(_0x370df6){return _0x213481[_0xe9c3('0x1d')](_0x588f58)[_0xe9c3('0x1f')](_0x370df6);}};}function respondWithFilteredResult(_0x7522f9,_0x45cbc8){return function(_0x21815b){if(_0x21815b){var _0x3071c1=typeof _0x45cbc8[_0xe9c3('0x20')]===_0xe9c3('0x21')&&typeof _0x45cbc8[_0xe9c3('0x22')]===_0xe9c3('0x21');var _0x7b803=_0x21815b[_0xe9c3('0x23')];var _0x48ff36=_0x3071c1?0x0:_0x45cbc8[_0xe9c3('0x20')];var _0x51dd07=_0x3071c1?_0x21815b['count']:_0x45cbc8[_0xe9c3('0x20')]+_0x45cbc8[_0xe9c3('0x22')];var _0x31ff03;if(_0x51dd07>=_0x7b803){_0x51dd07=_0x7b803;_0x31ff03=0xc8;}else{_0x31ff03=0xce;}_0x7522f9[_0xe9c3('0x1d')](_0x31ff03);return _0x7522f9[_0xe9c3('0x24')](_0xe9c3('0x25'),_0x48ff36+'-'+_0x51dd07+'/'+_0x7b803)[_0xe9c3('0x1f')](_0x21815b);}return null;};}function saveUpdates(_0x2b070d){return function(_0x1a1d9d){if(_0x1a1d9d){return _0x1a1d9d[_0xe9c3('0x26')](_0x2b070d)['then'](function(_0x244159){return _0x244159;});}return null;};}function removeEntity(_0x426464){return function(_0x49b840){if(_0x49b840){return _0x49b840[_0xe9c3('0x27')]()[_0xe9c3('0x11')](function(){var _0x143b33=_0x49b840[_0xe9c3('0x28')]({'plain':!![]});var _0x35ca97=_0xe9c3('0x29');return db[_0xe9c3('0x2a')][_0xe9c3('0x27')]({'where':{'type':_0x35ca97,'resourceId':_0x143b33['id']}})[_0xe9c3('0x11')](function(){return _0x49b840;});})[_0xe9c3('0x11')](function(){_0x426464[_0xe9c3('0x1d')](0xcc)[_0xe9c3('0x1e')]();});}};}function handleEntityNotFound(_0x3e42da){return function(_0x1f115a){if(!_0x1f115a){_0x3e42da['sendStatus'](0x194);}return _0x1f115a;};}function handleError(_0x58c234,_0x460a3d){_0x460a3d=_0x460a3d||0x1f4;return function(_0x56dc03){logger[_0xe9c3('0x17')](_0x56dc03[_0xe9c3('0x2b')]);if(_0x56dc03[_0xe9c3('0x2c')]){delete _0x56dc03[_0xe9c3('0x2c')];}_0x58c234['status'](_0x460a3d)['send'](_0x56dc03);};}function getImapHost(_0x102b11){switch(_0x102b11){case'gmail':return _0xe9c3('0x2d');case _0xe9c3('0x2e'):return _0xe9c3('0x2f');case _0xe9c3('0x30'):return _0xe9c3('0x31');case'outlook365':return _0xe9c3('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x102b11);}function getSmtpHost(_0x5f13a2){switch(_0x5f13a2){case _0xe9c3('0x33'):return'smtp.gmail.com';case _0xe9c3('0x2e'):return _0xe9c3('0x34');case _0xe9c3('0x30'):return'smtp-mail.outlook.com';case _0xe9c3('0x35'):return _0xe9c3('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5f13a2);}function getAuthenticationOptions(_0x3ce2cc,_0x1936a1){var _0x5ec26a={};var _0x27de6a={};if(_0x3ce2cc){_0x5ec26a[_0xe9c3('0x37')]=_0x27de6a['user']=_0x1936a1[_0xe9c3('0x38')];_0x5ec26a[_0xe9c3('0x39')]=_0x27de6a[_0xe9c3('0x3a')]=_0x1936a1['password'];if(_0x1936a1[_0xe9c3('0x3b')]){_0x5ec26a[_0xe9c3('0x3b')]=_0x27de6a[_0xe9c3('0x3b')]=!![];_0x5ec26a[_0xe9c3('0x3c')]=_0x27de6a[_0xe9c3('0x3c')]=_0x1936a1[_0xe9c3('0x3c')];_0x5ec26a[_0xe9c3('0x39')]=_0x27de6a['pass']=null;}else{_0x5ec26a[_0xe9c3('0x3c')]=_0x27de6a[_0xe9c3('0x3c')]=null;}_0x5ec26a[_0xe9c3('0x3d')]=getImapHost(_0x3ce2cc);_0x5ec26a['port']=0x3e1;_0x27de6a[_0xe9c3('0x3d')]=getSmtpHost(_0x3ce2cc);_0x27de6a['port']=0x24b;_0x27de6a[_0xe9c3('0x3e')]=![];_0x5ec26a['service']=_0x27de6a[_0xe9c3('0x3f')]=null;}else{if(_0x1936a1[_0xe9c3('0x40')]){_0x5ec26a['user']=_0x27de6a[_0xe9c3('0x37')]=_0x1936a1['username'];_0x5ec26a[_0xe9c3('0x39')]=_0x27de6a['pass']=_0x1936a1[_0xe9c3('0x39')];}else{_0x5ec26a[_0xe9c3('0x40')]=_0x27de6a[_0xe9c3('0x40')]=![];_0x5ec26a[_0xe9c3('0x37')]=_0x27de6a['user']=null;_0x5ec26a['password']=_0x27de6a['pass']=null;}_0x5ec26a['host']=_0x1936a1[_0xe9c3('0x41')][_0xe9c3('0x3d')];_0x5ec26a[_0xe9c3('0x42')]=_0x1936a1['Imap'][_0xe9c3('0x42')];_0x27de6a[_0xe9c3('0x3d')]=_0x1936a1[_0xe9c3('0x43')][_0xe9c3('0x3d')];_0x27de6a[_0xe9c3('0x42')]=_0x1936a1[_0xe9c3('0x43')][_0xe9c3('0x42')];}return{'Imap':_0x5ec26a,'Smtp':_0x27de6a};}exports['index']=function(_0x409600,_0x208346){var _0x126cf8={'include':[{'model':db[_0xe9c3('0x44')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xe9c3('0x45')],'as':'mandatoryDispositionPause'}]},_0x29ba7e={},_0x2fb223={'count':0x0,'rows':[]};var _0x5f3127=_[_0xe9c3('0x46')](db[_0xe9c3('0x47')]['rawAttributes'],function(_0x195702){return{'name':_0x195702[_0xe9c3('0x48')],'type':_0x195702[_0xe9c3('0x49')][_0xe9c3('0x4a')]};});_0x29ba7e[_0xe9c3('0x4b')]=_['map'](_0x5f3127,_0xe9c3('0x2c'));_0x29ba7e['query']=_[_0xe9c3('0x4c')](_0x409600[_0xe9c3('0x4d')]);_0x29ba7e[_0xe9c3('0x4e')]=_[_0xe9c3('0x4f')](_0x29ba7e['model'],_0x29ba7e['query']);_0x126cf8[_0xe9c3('0x50')]=_[_0xe9c3('0x4f')](_0x29ba7e[_0xe9c3('0x4b')],qs[_0xe9c3('0x51')](_0x409600['query'][_0xe9c3('0x51')]));_0x126cf8['attributes']=_0x126cf8[_0xe9c3('0x50')]['length']?_0x126cf8['attributes']:_0x29ba7e[_0xe9c3('0x4b')];if(!_0x409600[_0xe9c3('0x4d')][_0xe9c3('0x52')](_0xe9c3('0x53'))){_0x126cf8[_0xe9c3('0x22')]=qs['limit'](_0x409600[_0xe9c3('0x4d')]['limit']);_0x126cf8[_0xe9c3('0x20')]=qs[_0xe9c3('0x20')](_0x409600[_0xe9c3('0x4d')][_0xe9c3('0x20')]);}_0x126cf8[_0xe9c3('0x54')]=qs[_0xe9c3('0x55')](_0x409600['query']['sort']);_0x126cf8['where']=qs['filters'](_[_0xe9c3('0x56')](_0x409600['query'],_0x29ba7e['filters']),_0x5f3127);if(_0x409600['query'][_0xe9c3('0x57')]){_0x126cf8['where']=_[_0xe9c3('0x58')](_0x126cf8[_0xe9c3('0x59')],{'$or':_[_0xe9c3('0x46')](_0x5f3127,function(_0x10d858){if(_0x10d858[_0xe9c3('0x49')]!=='VIRTUAL'){var _0x30504a={};_0x30504a[_0x10d858[_0xe9c3('0x2c')]]={'$like':'%'+_0x409600[_0xe9c3('0x4d')]['filter']+'%'};return _0x30504a;}})});}_0x126cf8=_[_0xe9c3('0x58')]({},_0x126cf8,_0x409600[_0xe9c3('0x5a')]);var _0x1805dc={'where':_0x126cf8['where']};return db[_0xe9c3('0x47')][_0xe9c3('0x23')](_0x1805dc)[_0xe9c3('0x11')](function(_0x18f621){_0x2fb223[_0xe9c3('0x23')]=_0x18f621;if(_0x409600[_0xe9c3('0x4d')][_0xe9c3('0x5b')]){_0x126cf8['include']=[{'all':!![]}];}return db['MailAccount'][_0xe9c3('0x5c')](_0x126cf8);})['then'](function(_0x2ed989){_0x2fb223[_0xe9c3('0x5d')]=_0x2ed989;return _0x2fb223;})[_0xe9c3('0x11')](respondWithFilteredResult(_0x208346,_0x126cf8))[_0xe9c3('0x1b')](handleError(_0x208346,null));};exports[_0xe9c3('0x5e')]=function(_0x4a52ab,_0x2deefd){var _0x8e8e13={'raw':![],'where':{'id':_0x4a52ab[_0xe9c3('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xe9c3('0x41')},{'model':db['MailServerOut'],'as':_0xe9c3('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x55b54d={};_0x55b54d[_0xe9c3('0x4b')]=_['keys'](db[_0xe9c3('0x47')][_0xe9c3('0x60')]);_0x55b54d[_0xe9c3('0x4d')]=_[_0xe9c3('0x4c')](_0x4a52ab['query']);_0x55b54d['filters']=_[_0xe9c3('0x4f')](_0x55b54d[_0xe9c3('0x4b')],_0x55b54d['query']);_0x8e8e13['attributes']=_[_0xe9c3('0x4f')](_0x55b54d[_0xe9c3('0x4b')],qs['fields'](_0x4a52ab['query'][_0xe9c3('0x51')]));_0x8e8e13[_0xe9c3('0x50')]=_0x8e8e13['attributes']['length']?_0x8e8e13[_0xe9c3('0x50')]:_0x55b54d[_0xe9c3('0x4b')];if(_0x4a52ab[_0xe9c3('0x4d')][_0xe9c3('0x5b')]){_0x8e8e13[_0xe9c3('0x61')]=[{'all':!![]}];}_0x8e8e13=_[_0xe9c3('0x58')]({},_0x8e8e13,_0x4a52ab[_0xe9c3('0x5a')]);return db['MailAccount']['find'](_0x8e8e13)[_0xe9c3('0x11')](handleEntityNotFound(_0x2deefd,null))['then'](respondWithResult(_0x2deefd,null))[_0xe9c3('0x1b')](handleError(_0x2deefd,null));};exports[_0xe9c3('0x26')]=function(_0x21b987,_0x3b6c3c){if(_0x21b987[_0xe9c3('0x62')]['id']){delete _0x21b987['body']['id'];}var _0x521f27=_0x21b987[_0xe9c3('0x62')]['provider']===_0xe9c3('0x63')?null:_0x21b987[_0xe9c3('0x62')]['provider'];var _0x5a9ae7=_0x21b987['body'][_0xe9c3('0x41')]||{};var _0x5941ec=_0x21b987['body'][_0xe9c3('0x43')]||{};if(_0x521f27){_0x5a9ae7[_0xe9c3('0x3d')]=getImapHost(_0x521f27);_0x5a9ae7[_0xe9c3('0x42')]=0x3e1;_0x5941ec[_0xe9c3('0x3d')]=getSmtpHost(_0x521f27);_0x5941ec[_0xe9c3('0x42')]=0x24b;_0x5941ec['secure']=![];}if(_0x5941ec[_0xe9c3('0x3b')]){_0x5941ec['secure']=![];}else{_0x5941ec[_0xe9c3('0x3c')]=null;}if(!_0x5a9ae7[_0xe9c3('0x3b')])_0x5a9ae7[_0xe9c3('0x3c')]=null;_0x21b987[_0xe9c3('0x62')][_0xe9c3('0x41')]=_0x5a9ae7;_0x21b987['body'][_0xe9c3('0x43')]=_0x5941ec;return db['MailAccount'][_0xe9c3('0x64')]({'where':{'id':_0x21b987[_0xe9c3('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xe9c3('0x65')],'as':_0xe9c3('0x43')},{'model':db['Pause'],'as':_0xe9c3('0x66')}]})[_0xe9c3('0x11')](handleEntityNotFound(_0x3b6c3c,null))[_0xe9c3('0x11')](function(_0x177e23){if(!_0x177e23)throw new Error(_0xe9c3('0x67'));if(_0x177e23[_0xe9c3('0x3f')])delete _0x21b987[_0xe9c3('0x62')][_0xe9c3('0x41')];return _0x177e23;})['then'](saveUpdates(_0x21b987['body'],null))[_0xe9c3('0x11')](function(_0x5622e6){if(!_0x21b987[_0xe9c3('0x62')][_0xe9c3('0x41')])return _0x5622e6;return db[_0xe9c3('0x44')][_0xe9c3('0x26')](_0x21b987[_0xe9c3('0x62')][_0xe9c3('0x41')],{'where':{'MailAccountId':_0x5622e6['id']}})['then'](function(){return _0x5622e6;});})['then'](function(_0x34645d){if(!_0x21b987[_0xe9c3('0x62')][_0xe9c3('0x43')])return _0x34645d;return db['MailServerOut'][_0xe9c3('0x26')](_0x21b987[_0xe9c3('0x62')]['Smtp'],{'where':{'MailAccountId':_0x34645d['id']}})['then'](function(){return _0x34645d;});})[_0xe9c3('0x11')](respondWithResult(_0x3b6c3c,null))['catch'](handleError(_0x3b6c3c,null));};exports[_0xe9c3('0x68')]=function(_0x34d936,_0x49e4cf){return db['MailAccount'][_0xe9c3('0x68')]()[_0xe9c3('0x11')](respondWithResult(_0x49e4cf,null))[_0xe9c3('0x1b')](handleError(_0x49e4cf,null));};exports['addDisposition']=function(_0xf14a19,_0x5833fc){if(_0xf14a19[_0xe9c3('0x62')]['id']){delete _0xf14a19[_0xe9c3('0x62')]['id'];}return db[_0xe9c3('0x47')][_0xe9c3('0x64')]({'where':{'id':_0xf14a19[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x5833fc,null))[_0xe9c3('0x11')](function(_0x25d6fd){if(_0x25d6fd){_0xf14a19[_0xe9c3('0x62')][_0xe9c3('0x69')]=_0x25d6fd['id'];return db[_0xe9c3('0x6a')][_0xe9c3('0x6b')](_0xf14a19['body']);}})['then'](respondWithResult(_0x5833fc,null))[_0xe9c3('0x1b')](handleError(_0x5833fc,null));};exports['getDispositions']=function(_0x5c6ec2,_0x58b380){var _0x5984d1={'raw':![],'where':{}};var _0x3a7db2={};var _0x48ab25={'count':0x0,'rows':[]};return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x5c6ec2[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x58b380,null))[_0xe9c3('0x11')](function(_0x5e0029){if(_0x5e0029){_0x3a7db2[_0xe9c3('0x4b')]=_[_0xe9c3('0x4c')](db[_0xe9c3('0x6a')][_0xe9c3('0x60')]);_0x3a7db2['query']=_[_0xe9c3('0x4c')](_0x5c6ec2[_0xe9c3('0x4d')]);_0x3a7db2[_0xe9c3('0x4e')]=_['intersection'](_0x3a7db2[_0xe9c3('0x4b')],_0x3a7db2[_0xe9c3('0x4d')]);_0x5984d1['attributes']=_['intersection'](_0x3a7db2['model'],qs[_0xe9c3('0x51')](_0x5c6ec2[_0xe9c3('0x4d')][_0xe9c3('0x51')]));_0x5984d1['attributes']=_0x5984d1[_0xe9c3('0x50')][_0xe9c3('0x6d')]?_0x5984d1[_0xe9c3('0x50')]:_0x3a7db2['model'];if(!_0x5c6ec2[_0xe9c3('0x4d')][_0xe9c3('0x52')]('nolimit')){_0x5984d1[_0xe9c3('0x22')]=qs[_0xe9c3('0x22')](_0x5c6ec2[_0xe9c3('0x4d')][_0xe9c3('0x22')]);_0x5984d1[_0xe9c3('0x20')]=qs[_0xe9c3('0x20')](_0x5c6ec2[_0xe9c3('0x4d')]['offset']);}_0x5984d1[_0xe9c3('0x54')]=qs[_0xe9c3('0x55')](_0x5c6ec2[_0xe9c3('0x4d')][_0xe9c3('0x55')]);_0x5984d1[_0xe9c3('0x59')]=qs[_0xe9c3('0x4e')](_[_0xe9c3('0x56')](_0x5c6ec2[_0xe9c3('0x4d')],_0x3a7db2[_0xe9c3('0x4e')]));_0x5984d1[_0xe9c3('0x59')]['MailAccountId']=_0x5e0029['id'];if(_0x5c6ec2[_0xe9c3('0x4d')][_0xe9c3('0x57')]){_0x5984d1['where']=_[_0xe9c3('0x58')](_0x5984d1['where'],{'$or':_[_0xe9c3('0x46')](_0x5984d1[_0xe9c3('0x50')],function(_0x281879){var _0x212469={};_0x212469[_0x281879]={'$like':'%'+_0x5c6ec2[_0xe9c3('0x4d')][_0xe9c3('0x57')]+'%'};return _0x212469;})});}_0x5984d1=_['merge']({},_0x5984d1,_0x5c6ec2['options']);return db[_0xe9c3('0x6a')][_0xe9c3('0x23')]({'where':_0x5984d1[_0xe9c3('0x59')]})[_0xe9c3('0x11')](function(_0x3851b6){_0x48ab25['count']=_0x3851b6;if(_0x5c6ec2[_0xe9c3('0x4d')]['includeAll']){_0x5984d1[_0xe9c3('0x61')]=[{'all':!![]}];}return db[_0xe9c3('0x6a')][_0xe9c3('0x5c')](_0x5984d1);})[_0xe9c3('0x11')](function(_0x1e215e){_0x48ab25[_0xe9c3('0x5d')]=_0x1e215e;return _0x48ab25;});}})[_0xe9c3('0x11')](respondWithFilteredResult(_0x58b380,_0x5984d1))[_0xe9c3('0x1b')](handleError(_0x58b380,null));};exports[_0xe9c3('0x6e')]=function(_0xfc8319,_0x1dd9fd){return db[_0xe9c3('0x47')][_0xe9c3('0x64')]({'where':{'id':_0xfc8319['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x1dd9fd,null))[_0xe9c3('0x11')](function(_0x43c6f8){if(_0x43c6f8){return _0x43c6f8[_0xe9c3('0x6e')](_0xfc8319[_0xe9c3('0x4d')][_0xe9c3('0x6f')]);}})[_0xe9c3('0x11')](respondWithStatusCode(_0x1dd9fd,null))[_0xe9c3('0x1b')](handleError(_0x1dd9fd,null));};exports[_0xe9c3('0x70')]=function(_0x569aa8,_0x1863f1){if(_0x569aa8[_0xe9c3('0x62')]['id']){delete _0x569aa8['body']['id'];}return db[_0xe9c3('0x47')]['find']({'where':{'id':_0x569aa8[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x1863f1,null))[_0xe9c3('0x11')](function(_0x3f6aaf){if(_0x3f6aaf){_0x569aa8[_0xe9c3('0x62')][_0xe9c3('0x69')]=_0x3f6aaf['id'];return db[_0xe9c3('0x71')][_0xe9c3('0x6b')](_0x569aa8[_0xe9c3('0x62')]);}})['then'](respondWithResult(_0x1863f1,null))[_0xe9c3('0x1b')](handleError(_0x1863f1,null));};exports[_0xe9c3('0x72')]=function(_0x41426a,_0x202959){var _0x2d5e2e={'raw':![],'where':{}};var _0x1267da={};var _0x482c76={'count':0x0,'rows':[]};return db[_0xe9c3('0x47')]['findOne']({'where':{'id':_0x41426a[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x202959,null))[_0xe9c3('0x11')](function(_0x5ea684){if(_0x5ea684){_0x1267da[_0xe9c3('0x4b')]=_[_0xe9c3('0x4c')](db[_0xe9c3('0x71')][_0xe9c3('0x60')]);_0x1267da[_0xe9c3('0x4d')]=_[_0xe9c3('0x4c')](_0x41426a[_0xe9c3('0x4d')]);_0x1267da['filters']=_[_0xe9c3('0x4f')](_0x1267da['model'],_0x1267da['query']);_0x2d5e2e[_0xe9c3('0x50')]=_['intersection'](_0x1267da['model'],qs[_0xe9c3('0x51')](_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x51')]));_0x2d5e2e['attributes']=_0x2d5e2e['attributes'][_0xe9c3('0x6d')]?_0x2d5e2e[_0xe9c3('0x50')]:_0x1267da[_0xe9c3('0x4b')];if(!_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x52')](_0xe9c3('0x53'))){_0x2d5e2e['limit']=qs['limit'](_0x41426a['query'][_0xe9c3('0x22')]);_0x2d5e2e[_0xe9c3('0x20')]=qs[_0xe9c3('0x20')](_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x20')]);}_0x2d5e2e['order']=qs['sort'](_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x55')]);_0x2d5e2e[_0xe9c3('0x59')]=qs['filters'](_[_0xe9c3('0x56')](_0x41426a['query'],_0x1267da['filters']));_0x2d5e2e[_0xe9c3('0x59')][_0xe9c3('0x69')]=_0x5ea684['id'];if(_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x57')]){_0x2d5e2e[_0xe9c3('0x59')]=_[_0xe9c3('0x58')](_0x2d5e2e[_0xe9c3('0x59')],{'$or':_[_0xe9c3('0x46')](_0x2d5e2e[_0xe9c3('0x50')],function(_0x5ab075){var _0x53c969={};_0x53c969[_0x5ab075]={'$like':'%'+_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x57')]+'%'};return _0x53c969;})});}_0x2d5e2e=_[_0xe9c3('0x58')]({},_0x2d5e2e,_0x41426a[_0xe9c3('0x5a')]);return db['CannedAnswer']['count']({'where':_0x2d5e2e[_0xe9c3('0x59')]})['then'](function(_0x4e83fa){_0x482c76[_0xe9c3('0x23')]=_0x4e83fa;if(_0x41426a[_0xe9c3('0x4d')][_0xe9c3('0x5b')]){_0x2d5e2e['include']=[{'all':!![]}];}return db[_0xe9c3('0x71')][_0xe9c3('0x5c')](_0x2d5e2e);})[_0xe9c3('0x11')](function(_0x361869){_0x482c76[_0xe9c3('0x5d')]=_0x361869;return _0x482c76;});}})['then'](respondWithFilteredResult(_0x202959,_0x2d5e2e))[_0xe9c3('0x1b')](handleError(_0x202959,null));};exports['removeAnswers']=function(_0xb29aed,_0x27d3a6){return db[_0xe9c3('0x47')]['find']({'where':{'id':_0xb29aed[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x27d3a6,null))[_0xe9c3('0x11')](function(_0x242f2e){if(_0x242f2e){return _0x242f2e[_0xe9c3('0x73')](_0xb29aed[_0xe9c3('0x4d')][_0xe9c3('0x6f')]);}})['then'](respondWithStatusCode(_0x27d3a6,null))[_0xe9c3('0x1b')](handleError(_0x27d3a6,null));};exports['create']=function(_0xbec310,_0x54ca96){var _0x1667c5={'name':_0xbec310[_0xe9c3('0x62')]['name'],'key':_0xbec310['body'][_0xe9c3('0x4a')],'provider':_0xbec310[_0xe9c3('0x62')][_0xe9c3('0x74')]===_0xe9c3('0x63')?null:_0xbec310[_0xe9c3('0x62')][_0xe9c3('0x74')],'email':_0xbec310['body'][_0xe9c3('0x75')],'ListId':_0xbec310[_0xe9c3('0x62')][_0xe9c3('0x76')],'active':!_[_0xe9c3('0x77')](_0xbec310[_0xe9c3('0x62')][_0xe9c3('0x78')])?_0xbec310['body'][_0xe9c3('0x78')]:!![],'description':_0xbec310['body']['description']||null};var _0x51a676=getAuthenticationOptions(_0x1667c5[_0xe9c3('0x74')],_0xbec310['body']);_0x1667c5[_0xe9c3('0x41')]=_0x51a676['Imap'];_0x1667c5[_0xe9c3('0x43')]=_0x51a676[_0xe9c3('0x43')];return db[_0xe9c3('0x47')][_0xe9c3('0x6b')](_0x1667c5,{'include':[{'model':db['MailServerOut'],'as':_0xe9c3('0x43')},{'model':db[_0xe9c3('0x44')],'as':_0xe9c3('0x41')}]})[_0xe9c3('0x11')](function(_0x3a0d36){var _0x491851=_0xbec310['user'][_0xe9c3('0x28')]({'plain':!![]});if(!_0x491851)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x491851[_0xe9c3('0x79')]===_0xe9c3('0x37')){var _0x39938a=_0x3a0d36[_0xe9c3('0x28')]({'plain':!![]});return db[_0xe9c3('0x7a')][_0xe9c3('0x64')]({'where':{'name':_0xe9c3('0x29'),'userProfileId':_0x491851[_0xe9c3('0x7b')]},'raw':!![]})['then'](function(_0x1c8fcf){if(_0x1c8fcf&&_0x1c8fcf['autoAssociation']===0x0){return db['UserProfileResource'][_0xe9c3('0x6b')]({'name':_0x39938a[_0xe9c3('0x2c')],'resourceId':_0x39938a['id'],'type':_0x1c8fcf[_0xe9c3('0x2c')],'sectionId':_0x1c8fcf['id']},{})['then'](function(){return _0x3a0d36;});}else{return _0x3a0d36;}})[_0xe9c3('0x1b')](function(_0x58edb4){logger[_0xe9c3('0x17')](_0xe9c3('0x7c'),_0x58edb4);throw _0x58edb4;});}return _0x3a0d36;})[_0xe9c3('0x11')](respondWithResult(_0x54ca96,0xc9))[_0xe9c3('0x1b')](handleError(_0x54ca96,null));};exports[_0xe9c3('0x7d')]=function(_0x16a987,_0x857aea){return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x16a987[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x857aea,null))['then'](function(_0x2007f7){if(_0x2007f7){return _0x2007f7[_0xe9c3('0x7d')]();}return null;})['then'](respondWithResult(_0x857aea,null))[_0xe9c3('0x1b')](handleError(_0x857aea,null));};exports[_0xe9c3('0x7e')]=function(_0x2dc795,_0x423a2e){if(_0x2dc795[_0xe9c3('0x62')]['id']){delete _0x2dc795[_0xe9c3('0x62')]['id'];}return db[_0xe9c3('0x47')]['find']({'where':{'id':_0x2dc795['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x423a2e,null))[_0xe9c3('0x11')](function(_0x3bb8cc){if(_0x3bb8cc){_0x2dc795['body'][_0xe9c3('0x69')]=_0x3bb8cc['id'];return db[_0xe9c3('0x44')]['create'](_0x2dc795[_0xe9c3('0x62')]);}})[_0xe9c3('0x11')](respondWithResult(_0x423a2e,null))['catch'](handleError(_0x423a2e,null));};exports[_0xe9c3('0x7f')]=function(_0x18c283,_0x590061){return db['MailAccount'][_0xe9c3('0x6c')]({'where':{'id':_0x18c283[_0xe9c3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x590061,null))[_0xe9c3('0x11')](function(_0x8c9ef0){if(_0x8c9ef0){return _0x8c9ef0[_0xe9c3('0x80')](null);}return null;})[_0xe9c3('0x11')](respondWithStatusCode(_0x590061,null))[_0xe9c3('0x1b')](handleError(_0x590061,null));};exports[_0xe9c3('0x81')]=function(_0x2330b4,_0x653c7c){return db['MailAccount']['findOne']({'where':{'id':_0x2330b4['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x653c7c,null))[_0xe9c3('0x11')](function(_0x4b8841){if(_0x4b8841){return _0x4b8841[_0xe9c3('0x81')]();}return null;})[_0xe9c3('0x11')](respondWithResult(_0x653c7c,null))[_0xe9c3('0x1b')](handleError(_0x653c7c,null));};exports[_0xe9c3('0x82')]=function(_0x3b38a3,_0x3427c5){if(_0x3b38a3['body']['id']){delete _0x3b38a3[_0xe9c3('0x62')]['id'];}return db['MailAccount'][_0xe9c3('0x64')]({'where':{'id':_0x3b38a3['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x3427c5,null))[_0xe9c3('0x11')](function(_0x12be3e){if(_0x12be3e){_0x3b38a3[_0xe9c3('0x62')][_0xe9c3('0x69')]=_0x12be3e['id'];return db[_0xe9c3('0x65')][_0xe9c3('0x6b')](_0x3b38a3[_0xe9c3('0x62')]);}})[_0xe9c3('0x11')](respondWithResult(_0x3427c5,null))[_0xe9c3('0x1b')](handleError(_0x3427c5,null));};exports[_0xe9c3('0x83')]=function(_0x1f6789,_0x3b1d72){return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x1f6789[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x3b1d72,null))[_0xe9c3('0x11')](function(_0x2d9521){if(_0x2d9521){return _0x2d9521[_0xe9c3('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x3b1d72,null))[_0xe9c3('0x1b')](handleError(_0x3b1d72,null));};exports['addInteraction']=function(_0x3565dd,_0x1be2bc){return db['MailInteraction'][_0xe9c3('0x64')]({'where':{'id':_0x3565dd['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x1be2bc,null))['then'](function(_0x25fc74){if(_0x25fc74){return _0x25fc74[_0xe9c3('0x85')](_0x3565dd[_0xe9c3('0x62')]['ids'],_[_0xe9c3('0x86')](_0x3565dd[_0xe9c3('0x62')],[_0xe9c3('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x1be2bc,null))['catch'](handleError(_0x1be2bc,null));};exports[_0xe9c3('0x87')]=function(_0x10ecbd,_0x347318){var _0x3bb7d6={'raw':![],'where':{}};var _0x541f5f={};var _0x31d9c2={'count':0x0,'rows':[]};return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x10ecbd[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x347318,null))[_0xe9c3('0x11')](function(_0xf14ded){if(_0xf14ded){_0x541f5f[_0xe9c3('0x4b')]=_[_0xe9c3('0x4c')](db[_0xe9c3('0x88')][_0xe9c3('0x60')]);_0x541f5f[_0xe9c3('0x4d')]=_[_0xe9c3('0x4c')](_0x10ecbd['query']);_0x541f5f[_0xe9c3('0x4e')]=_[_0xe9c3('0x4f')](_0x541f5f['model'],_0x541f5f[_0xe9c3('0x4d')]);_0x3bb7d6[_0xe9c3('0x50')]=_[_0xe9c3('0x4f')](_0x541f5f[_0xe9c3('0x4b')],qs[_0xe9c3('0x51')](_0x10ecbd['query'][_0xe9c3('0x51')]));_0x3bb7d6[_0xe9c3('0x50')]=_0x3bb7d6[_0xe9c3('0x50')]['length']?_0x3bb7d6['attributes']:_0x541f5f[_0xe9c3('0x4b')];if(!_0x10ecbd[_0xe9c3('0x4d')][_0xe9c3('0x52')](_0xe9c3('0x53'))){_0x3bb7d6[_0xe9c3('0x22')]=qs[_0xe9c3('0x22')](_0x10ecbd['query'][_0xe9c3('0x22')]);_0x3bb7d6['offset']=qs['offset'](_0x10ecbd[_0xe9c3('0x4d')][_0xe9c3('0x20')]);}_0x3bb7d6[_0xe9c3('0x54')]=qs[_0xe9c3('0x55')](_0x10ecbd['query']['sort']);_0x3bb7d6[_0xe9c3('0x59')]=qs[_0xe9c3('0x4e')](_[_0xe9c3('0x56')](_0x10ecbd[_0xe9c3('0x4d')],_0x541f5f[_0xe9c3('0x4e')]));_0x3bb7d6[_0xe9c3('0x59')][_0xe9c3('0x69')]=_0xf14ded['id'];if(_0x10ecbd[_0xe9c3('0x4d')]['filter']){_0x3bb7d6[_0xe9c3('0x59')]=_[_0xe9c3('0x58')](_0x3bb7d6[_0xe9c3('0x59')],{'$or':_[_0xe9c3('0x46')](_0x3bb7d6['attributes'],function(_0x1261a2){var _0x215813={};_0x215813[_0x1261a2]={'$like':'%'+_0x10ecbd[_0xe9c3('0x4d')][_0xe9c3('0x57')]+'%'};return _0x215813;})});}_0x3bb7d6=_['merge']({},_0x3bb7d6,_0x10ecbd['options']);return db['MailInteraction'][_0xe9c3('0x23')]({'where':_0x3bb7d6[_0xe9c3('0x59')]})[_0xe9c3('0x11')](function(_0x241cd8){_0x31d9c2[_0xe9c3('0x23')]=_0x241cd8;if(_0x10ecbd['query'][_0xe9c3('0x5b')]){_0x3bb7d6['include']=[{'model':db[_0xe9c3('0x89')],'as':_0xe9c3('0x8a'),'required':![]},{'model':db[_0xe9c3('0x8b')],'as':_0xe9c3('0x8c'),'attributes':[_0xe9c3('0x2c'),'fullname',_0xe9c3('0x8d')],'required':![]},{'model':db[_0xe9c3('0x8e')],'as':'Tags','attributes':['id','name','color'],'where':_0x10ecbd['query'][_0xe9c3('0x8f')]?{'id':_0x10ecbd[_0xe9c3('0x4d')][_0xe9c3('0x8f')]}:undefined,'required':_0x10ecbd[_0xe9c3('0x4d')][_0xe9c3('0x8f')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x3bb7d6);})['then'](function(_0x422e82){_0x31d9c2[_0xe9c3('0x5d')]=_0x422e82;return _0x31d9c2;});}})[_0xe9c3('0x11')](respondWithFilteredResult(_0x347318,_0x3bb7d6))[_0xe9c3('0x1b')](handleError(_0x347318,null));};exports['addApplications']=function addApplications(_0x35b92e,_0x3f3ac5){var _0xa8ec3d=_0x35b92e[_0xe9c3('0x5f')]['id'];var _0x5e9d20=_0x35b92e['body'];var _0x14781f=0xc8;var _0x3e5eba=null;return db[_0xe9c3('0x90')][_0xe9c3('0x91')]({'isolationLevel':db[_0xe9c3('0x90')]['Transaction'][_0xe9c3('0x92')]['READ_COMMITTED']},function(_0x5df63b){return db['MailAccount'][_0xe9c3('0x6c')]({'where':{'id':_0xa8ec3d},'transaction':_0x5df63b})[_0xe9c3('0x11')](function(_0x48bc37){if(_0x48bc37){return db[_0xe9c3('0x93')]['destroy']({'where':{'MailAccountId':_0xa8ec3d},'transaction':_0x5df63b})[_0xe9c3('0x11')](function(){var _0x1454ed=_['map'](_0x5e9d20,function(_0x25d6a4){_0x25d6a4[_0xe9c3('0x69')]=_0xa8ec3d;return _0x25d6a4;});return db[_0xe9c3('0x93')][_0xe9c3('0x94')](_0x1454ed,{'transaction':_0x5df63b});});}else{_0x14781f=0x194;_0x3e5eba=[];}});})['then'](function(){if(_0x14781f!==0x194){return db[_0xe9c3('0x93')]['findAndCountAll']({'where':{'MailAccountId':_0xa8ec3d},'order':_0xe9c3('0x95')})[_0xe9c3('0x11')](function(_0x1fe0c3){_0x3e5eba=_0x1fe0c3;});}})[_0xe9c3('0x1b')](function(_0x49cbd6){_0x14781f=0x1f4;logger[_0xe9c3('0x17')](_0x49cbd6[_0xe9c3('0x2b')]);if(_0x49cbd6[_0xe9c3('0x2c')]){delete _0x49cbd6[_0xe9c3('0x2c')];}_0x3e5eba=_0x49cbd6;})[_0xe9c3('0x96')](function(){if(_0x3e5eba===null){_0x3f3ac5[_0xe9c3('0x1c')](_0x14781f);}else{if(_0x14781f===0x1f4){_0x3f3ac5[_0xe9c3('0x1d')](_0x14781f)[_0xe9c3('0x97')](_0x3e5eba);}else{_0x3f3ac5[_0xe9c3('0x1d')](_0x14781f)[_0xe9c3('0x1f')](_0x3e5eba);}}});};exports[_0xe9c3('0x98')]=function(_0x20b6e6,_0x5f1c46){var _0x5eb2f1={};var _0x2994e0={};var _0x56bd3f;var _0x43bd9d;return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x20b6e6[_0xe9c3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5f1c46,null))[_0xe9c3('0x11')](function(_0x307356){if(_0x307356){_0x56bd3f=_0x307356;_0x2994e0[_0xe9c3('0x4b')]=_[_0xe9c3('0x4c')](db[_0xe9c3('0x93')][_0xe9c3('0x60')]);_0x2994e0['query']=_[_0xe9c3('0x4c')](_0x20b6e6[_0xe9c3('0x4d')]);_0x2994e0['filters']=_[_0xe9c3('0x4f')](_0x2994e0[_0xe9c3('0x4b')],_0x2994e0[_0xe9c3('0x4d')]);_0x5eb2f1[_0xe9c3('0x50')]=_[_0xe9c3('0x4f')](_0x2994e0[_0xe9c3('0x4b')],qs[_0xe9c3('0x51')](_0x20b6e6[_0xe9c3('0x4d')][_0xe9c3('0x51')]));_0x5eb2f1[_0xe9c3('0x50')]=_0x5eb2f1[_0xe9c3('0x50')][_0xe9c3('0x6d')]?_0x5eb2f1[_0xe9c3('0x50')]:_0x2994e0[_0xe9c3('0x4b')];_0x5eb2f1[_0xe9c3('0x54')]=qs[_0xe9c3('0x55')](_0x20b6e6[_0xe9c3('0x4d')][_0xe9c3('0x55')]);_0x5eb2f1[_0xe9c3('0x59')]=qs['filters'](_['pick'](_0x20b6e6[_0xe9c3('0x4d')],_0x2994e0['filters']));if(_0x20b6e6[_0xe9c3('0x4d')][_0xe9c3('0x57')]){_0x5eb2f1[_0xe9c3('0x59')]=_[_0xe9c3('0x58')](_0x5eb2f1['where'],{'$or':_[_0xe9c3('0x46')](_0x5eb2f1[_0xe9c3('0x50')],function(_0x2ef3d5){var _0x142940={};_0x142940[_0x2ef3d5]={'$like':'%'+_0x20b6e6[_0xe9c3('0x4d')][_0xe9c3('0x57')]+'%'};return _0x142940;})});}_0x5eb2f1=_['merge']({},_0x5eb2f1,_0x20b6e6['options']);return _0x56bd3f[_0xe9c3('0x98')](_0x5eb2f1);}})[_0xe9c3('0x11')](function(_0x389f9d){if(_0x389f9d){_0x43bd9d=_0x389f9d['length'];if(!_0x20b6e6[_0xe9c3('0x4d')][_0xe9c3('0x52')]('nolimit')){_0x5eb2f1[_0xe9c3('0x22')]=qs[_0xe9c3('0x22')](_0x20b6e6[_0xe9c3('0x4d')]['limit']);_0x5eb2f1[_0xe9c3('0x20')]=qs[_0xe9c3('0x20')](_0x20b6e6[_0xe9c3('0x4d')][_0xe9c3('0x20')]);}return _0x56bd3f[_0xe9c3('0x98')](_0x5eb2f1);}})[_0xe9c3('0x11')](function(_0x23c47e){if(_0x23c47e){return _0x23c47e?{'count':_0x43bd9d,'rows':_0x23c47e}:null;}})[_0xe9c3('0x11')](respondWithResult(_0x5f1c46,null))[_0xe9c3('0x1b')](handleError(_0x5f1c46,null));};exports[_0xe9c3('0x99')]=function(_0x133842,_0x133e93){var _0x2c0011={'raw':!![],'where':{}};var _0x1613d6={};var _0x34b122={'count':0x0,'rows':[]};return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x133842[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x133e93,null))[_0xe9c3('0x11')](function(_0x5abe65){if(_0x5abe65){_0x1613d6[_0xe9c3('0x4b')]=_[_0xe9c3('0x4c')](db[_0xe9c3('0x9a')][_0xe9c3('0x60')]);_0x1613d6['query']=_[_0xe9c3('0x4c')](_0x133842[_0xe9c3('0x4d')]);_0x1613d6[_0xe9c3('0x4e')]=_[_0xe9c3('0x4f')](_0x1613d6[_0xe9c3('0x4b')],_0x1613d6[_0xe9c3('0x4d')]);_0x2c0011[_0xe9c3('0x50')]=_[_0xe9c3('0x4f')](_0x1613d6[_0xe9c3('0x4b')],qs['fields'](_0x133842[_0xe9c3('0x4d')][_0xe9c3('0x51')]));_0x2c0011['attributes']=_0x2c0011[_0xe9c3('0x50')][_0xe9c3('0x6d')]?_0x2c0011['attributes']:_0x1613d6[_0xe9c3('0x4b')];if(!_0x133842[_0xe9c3('0x4d')][_0xe9c3('0x52')](_0xe9c3('0x53'))){_0x2c0011[_0xe9c3('0x22')]=qs[_0xe9c3('0x22')](_0x133842['query'][_0xe9c3('0x22')]);_0x2c0011[_0xe9c3('0x20')]=qs[_0xe9c3('0x20')](_0x133842[_0xe9c3('0x4d')]['offset']);}_0x2c0011['order']=qs[_0xe9c3('0x55')](_0x133842['query'][_0xe9c3('0x55')]);_0x2c0011[_0xe9c3('0x59')]=qs[_0xe9c3('0x4e')](_['pick'](_0x133842['query'],_0x1613d6['filters']));_0x2c0011[_0xe9c3('0x59')]['MailAccountId']=_0x5abe65['id'];if(_0x133842['query'][_0xe9c3('0x57')]){_0x2c0011[_0xe9c3('0x59')]=_[_0xe9c3('0x58')](_0x2c0011[_0xe9c3('0x59')],{'$or':_[_0xe9c3('0x46')](_0x2c0011['attributes'],function(_0x2c0406){var _0x839d12={};_0x839d12[_0x2c0406]={'$like':'%'+_0x133842[_0xe9c3('0x4d')]['filter']+'%'};return _0x839d12;})});}if(_0x133842[_0xe9c3('0x4d')]['$gte']){var _0x184f2e=_0x133842[_0xe9c3('0x4d')][_0xe9c3('0x9b')]['split'](',');var _0x42f714={};_0x42f714[_0x184f2e[0x0]]={'$gte':moment(_0x184f2e[0x1])[_0xe9c3('0x9c')](_0xe9c3('0x9d'))};_0x2c0011[_0xe9c3('0x59')]=_[_0xe9c3('0x58')](_0x2c0011[_0xe9c3('0x59')],_0x42f714);}_0x2c0011=_[_0xe9c3('0x58')]({},_0x2c0011,_0x133842[_0xe9c3('0x5a')]);return db[_0xe9c3('0x9a')][_0xe9c3('0x23')]({'where':_0x2c0011[_0xe9c3('0x59')]})[_0xe9c3('0x11')](function(_0x402a4d){_0x34b122['count']=_0x402a4d;if(_0x133842['query']['includeAll']){_0x2c0011[_0xe9c3('0x61')]=[{'all':!![]}];}return db['MailMessage'][_0xe9c3('0x5c')](_0x2c0011);})[_0xe9c3('0x11')](function(_0x5ca4f3){if(_0x133842[_0xe9c3('0x4d')][_0xe9c3('0x9e')]==='true'){for(var _0x30bfa6=0x0;_0x30bfa6<_0x5ca4f3['length'];_0x30bfa6++){_0x5ca4f3[_0x30bfa6][_0xe9c3('0x62')]=juice(_0x5ca4f3[_0x30bfa6][_0xe9c3('0x62')]);}}_0x34b122[_0xe9c3('0x5d')]=_0x5ca4f3;return _0x34b122;});}})[_0xe9c3('0x11')](respondWithFilteredResult(_0x133e93,_0x2c0011))['catch'](handleError(_0x133e93,null));};exports[_0xe9c3('0x97')]=function(_0x4ece5a,_0x2397ee){var _0x42587d,_0x505b34={},_0x1cdadb;if(_0x4ece5a['body']['to']){_0x1cdadb=_0x4ece5a[_0xe9c3('0x62')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x4ece5a['params']['id']},'include':[{'model':db['CmList'],'as':_0xe9c3('0x9f'),'include':[{'model':db[_0xe9c3('0x89')],'as':_0xe9c3('0xa0'),'where':{'email':_0x1cdadb},'limit':0x1,'order':[[_0xe9c3('0xa1'),_0xe9c3('0xa2')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe9c3('0xa3')],'as':_0xe9c3('0xa3'),'raw':!![]}]}]})[_0xe9c3('0x11')](handleEntityNotFound(_0x2397ee,null))[_0xe9c3('0x11')](function(_0x30842f){if(!_0x30842f)return;_0x42587d=_0x30842f;if(!_0x30842f['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x4ece5a[_0xe9c3('0x62')]['from'])){_0x4ece5a['body'][_0xe9c3('0xa4')]=util[_0xe9c3('0x9c')](_0xe9c3('0xa5'),_0x30842f['name'],_0x30842f[_0xe9c3('0x75')]||_0x30842f[_0xe9c3('0x43')][_0xe9c3('0x37')]);}if(_0x4ece5a[_0xe9c3('0x62')][_0xe9c3('0xa6')]&&_0x4ece5a[_0xe9c3('0x62')][_0xe9c3('0xa6')]['length']){for(var _0x151ffa=0x0;_0x151ffa<_0x4ece5a['body'][_0xe9c3('0xa6')][_0xe9c3('0x6d')];_0x151ffa+=0x1){_0x4ece5a[_0xe9c3('0x62')][_0xe9c3('0xa6')][_0x151ffa]={'filename':_0x4ece5a['body'][_0xe9c3('0xa6')][_0x151ffa][_0xe9c3('0x2c')],'path':path[_0xe9c3('0xa7')](config['root'],_0xe9c3('0xa8'),_0x4ece5a[_0xe9c3('0x62')][_0xe9c3('0xa6')][_0x151ffa][_0xe9c3('0xa9')])};}}var _0x14db76=_0x30842f[_0xe9c3('0xaa')]();return respondWithRpcPromise('SendMail',_0xe9c3('0xab'),{'account':_0x14db76,'message':_0x4ece5a[_0xe9c3('0x62')]});})['then'](function(_0x299e8b){if(!_0x299e8b)return;_0x505b34=_0x299e8b;if(!_0x42587d[_0xe9c3('0x9f')])throw new Error(_0xe9c3('0xac'));if(_0x42587d[_0xe9c3('0x9f')][_0xe9c3('0xa0')]['length'])return _0x42587d[_0xe9c3('0x9f')][_0xe9c3('0xa0')][0x0];return db[_0xe9c3('0x89')][_0xe9c3('0x6b')](_['defaults'](_0x4ece5a[_0xe9c3('0x62')],{'firstName':_0x4ece5a['body']['to'],'email':_0x4ece5a[_0xe9c3('0x62')]['to'],'phone':_0x4ece5a[_0xe9c3('0x62')]['to'],'ListId':_0x42587d[_0xe9c3('0x76')]}));})['then'](function(_0x31382a){if(!_0x31382a)return;var _0x31ec6b={'UserId':_0x4ece5a['user']['id'],'ContactId':_0x31382a['id'],'MailAccountId':_0x42587d['id'],'inReplyTo':_0x505b34[_0xe9c3('0xad')],'to':_0x4ece5a[_0xe9c3('0x62')]['from'],'cc':_0x4ece5a[_0xe9c3('0x62')]['cc'],'subject':_0x4ece5a[_0xe9c3('0x62')][_0xe9c3('0xae')],'attach':_0x4ece5a[_0xe9c3('0x62')][_0xe9c3('0xaf')],'firstMsgDirection':_0xe9c3('0xb0'),'lastMsgAt':moment()[_0xe9c3('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xe9c3('0xb0'),'Messages':[_[_0xe9c3('0x58')](_0x4ece5a[_0xe9c3('0x62')],{'messageId':_0x505b34[_0xe9c3('0xad')],'sentAt':moment()[_0xe9c3('0x9c')](_0xe9c3('0x9d')),'read':!![],'MailAccountId':_0x42587d['id'],'UserId':_0x4ece5a[_0xe9c3('0x37')]['id'],'ContactId':_0x31382a['id']})]};if(_0x4ece5a['body'][_0xe9c3('0xb1')]){_0x31ec6b=_[_0xe9c3('0x58')](_0x31ec6b,_0x4ece5a['body'][_0xe9c3('0xb1')]);}return db[_0xe9c3('0x88')][_0xe9c3('0x6b')](_0x31ec6b,{'include':[{'model':db['MailMessage'],'as':_0xe9c3('0xb2')}]});})[_0xe9c3('0x11')](respondWithResult(_0x2397ee,null))[_0xe9c3('0x1b')](handleError(_0x2397ee,null));};exports[_0xe9c3('0xb3')]=function(_0x46b0d2,_0x419400){return db[_0xe9c3('0x47')]['find']({'where':{'id':_0x46b0d2[_0xe9c3('0x5f')]['id']},'include':[{'model':db[_0xe9c3('0x65')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe9c3('0xa3')],'as':_0xe9c3('0xa3'),'raw':!![]}]}]})[_0xe9c3('0x11')](handleEntityNotFound(_0x419400,null))[_0xe9c3('0x11')](function(_0x2930cd){if(!_0x2930cd[_0xe9c3('0x43')])return;var _0x15d4d1=_0x2930cd[_0xe9c3('0xaa')]();return respondWithRpcPromise('VerifySmtp',_0xe9c3('0xb3'),{'account':_0x15d4d1});})[_0xe9c3('0x11')](respondWithResult(_0x419400,null))[_0xe9c3('0x1b')](handleError(_0x419400,null));};exports[_0xe9c3('0x27')]=function(_0x3484e7,_0x38d496){return db['MailAccount'][_0xe9c3('0x64')]({'where':{'id':_0x3484e7[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x38d496,null))[_0xe9c3('0x11')](function(_0x545e5b){if(_0x545e5b&&_0x545e5b[_0xe9c3('0x3f')]){throw new db[(_0xe9c3('0xb4'))]['ValidationError'](_0xe9c3('0xb5'));}return _0x545e5b;})[_0xe9c3('0x11')](removeEntity(_0x38d496,null))['catch'](handleError(_0x38d496,null));};exports[_0xe9c3('0xb6')]=function(_0x1b3208,_0x2d4a09){return db[_0xe9c3('0x47')]['find']({'where':{'id':_0x1b3208['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x2d4a09,null))[_0xe9c3('0x11')](function(_0x2ee655){if(_0x2ee655){return _0x2ee655['addAgents'](_0x1b3208[_0xe9c3('0x62')][_0xe9c3('0x6f')],_['omit'](_0x1b3208[_0xe9c3('0x62')],[_0xe9c3('0x6f'),'id'])||{})[_0xe9c3('0xb7')](function(_0x12ec9b){for(var _0x22e7fe=0x0;_0x22e7fe<_0x1b3208[_0xe9c3('0x62')]['ids']['length'];_0x22e7fe+=0x1){socket[_0xe9c3('0xb8')]('userMailAccount:save',{'UserId':Number(_0x1b3208[_0xe9c3('0x62')]['ids'][_0x22e7fe]),'MailAccountId':Number(_0x1b3208[_0xe9c3('0x5f')]['id'])});}return _0x12ec9b;});}})['then'](respondWithResult(_0x2d4a09,null))[_0xe9c3('0x1b')](handleError(_0x2d4a09,null));};exports[_0xe9c3('0xb9')]=function(_0x17338a,_0x296053){return db[_0xe9c3('0x47')][_0xe9c3('0x64')]({'where':{'id':_0x17338a[_0xe9c3('0x5f')]['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x296053,null))[_0xe9c3('0x11')](function(_0x3a73c4){if(_0x3a73c4){return _0x3a73c4[_0xe9c3('0xb9')](_0x17338a[_0xe9c3('0x4d')][_0xe9c3('0x6f')])[_0xe9c3('0x11')](function(){if(_['isArray'](_0x17338a[_0xe9c3('0x4d')]['ids'])){for(var _0x18120e=0x0;_0x18120e<_0x17338a[_0xe9c3('0x4d')][_0xe9c3('0x6f')][_0xe9c3('0x6d')];_0x18120e+=0x1){socket['emit'](_0xe9c3('0xba'),{'UserId':Number(_0x17338a['query'][_0xe9c3('0x6f')][_0x18120e]),'MailAccountId':Number(_0x17338a[_0xe9c3('0x5f')]['id'])});}}else{socket[_0xe9c3('0xb8')](_0xe9c3('0xba'),{'UserId':Number(_0x17338a['query'][_0xe9c3('0x6f')]),'MailAccountId':Number(_0x17338a[_0xe9c3('0x5f')]['id'])});}});}})[_0xe9c3('0x11')](respondWithStatusCode(_0x296053,null))[_0xe9c3('0x1b')](handleError(_0x296053,null));};exports[_0xe9c3('0xbb')]=function(_0x569914,_0x11167c){var _0x539849={};var _0x48473a={};var _0x13953c;var _0x168f32;return db[_0xe9c3('0x47')][_0xe9c3('0x6c')]({'where':{'id':_0x569914['params']['id']}})[_0xe9c3('0x11')](handleEntityNotFound(_0x11167c,null))['then'](function(_0x5540cf){if(_0x5540cf){_0x13953c=_0x5540cf;_0x48473a['model']=_[_0xe9c3('0x4c')](db[_0xe9c3('0x8b')][_0xe9c3('0x60')]);_0x48473a['query']=_[_0xe9c3('0x4c')](_0x569914[_0xe9c3('0x4d')]);_0x48473a[_0xe9c3('0x4e')]=_['intersection'](_0x48473a['model'],_0x48473a[_0xe9c3('0x4d')]);_0x539849[_0xe9c3('0x50')]=_['intersection'](_0x48473a[_0xe9c3('0x4b')],qs[_0xe9c3('0x51')](_0x569914[_0xe9c3('0x4d')][_0xe9c3('0x51')]));_0x539849[_0xe9c3('0x50')]=_0x539849[_0xe9c3('0x50')]['length']?_0x539849[_0xe9c3('0x50')]:_0x48473a[_0xe9c3('0x4b')];_0x539849[_0xe9c3('0x54')]=qs[_0xe9c3('0x55')](_0x569914[_0xe9c3('0x4d')][_0xe9c3('0x55')]);_0x539849[_0xe9c3('0x59')]=qs[_0xe9c3('0x4e')](_[_0xe9c3('0x56')](_0x569914[_0xe9c3('0x4d')],_0x48473a[_0xe9c3('0x4e')]));if(_0x569914[_0xe9c3('0x4d')][_0xe9c3('0x57')]){_0x539849[_0xe9c3('0x59')]=_[_0xe9c3('0x58')](_0x539849[_0xe9c3('0x59')],{'$or':_[_0xe9c3('0x46')](_0x539849['attributes'],function(_0x183c08){var _0x114a44={};_0x114a44[_0x183c08]={'$like':'%'+_0x569914[_0xe9c3('0x4d')]['filter']+'%'};return _0x114a44;})});}_0x539849=_[_0xe9c3('0x58')]({},_0x539849,_0x569914[_0xe9c3('0x5a')]);return _0x13953c['getAgents'](_0x539849);}})[_0xe9c3('0x11')](function(_0x38ebe2){if(_0x38ebe2){_0x168f32=_0x38ebe2[_0xe9c3('0x6d')];if(!_0x569914[_0xe9c3('0x4d')][_0xe9c3('0x52')]('nolimit')){_0x539849[_0xe9c3('0x22')]=qs[_0xe9c3('0x22')](_0x569914[_0xe9c3('0x4d')]['limit']);_0x539849['offset']=qs[_0xe9c3('0x20')](_0x569914[_0xe9c3('0x4d')]['offset']);}return _0x13953c[_0xe9c3('0xbb')](_0x539849);}})['then'](function(_0x49d997){if(_0x49d997){return _0x49d997?{'count':_0x168f32,'rows':_0x49d997}:null;}})[_0xe9c3('0x11')](respondWithResult(_0x11167c,null))[_0xe9c3('0x1b')](handleError(_0x11167c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2ea297f..fa9d5f7 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 _0x3d41=['../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3d41,0xea));var _0x13d4=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0x3d41[_0x3dc538];return _0x72c2fd;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x13d4('0x0'))['db'][_0x13d4('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x13d4('0x2')](0x0);var events={'afterCreate':_0x13d4('0x3'),'afterUpdate':_0x13d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bfcac){return function(_0x1162f2,_0x2c05f1,_0x52bd3e){MailAccountEvents[_0x13d4('0x5')](_0x4bfcac+':'+_0x1162f2['id'],_0x1162f2);MailAccountEvents[_0x13d4('0x5')](_0x4bfcac,_0x1162f2);_0x52bd3e(null);};}for(var e in events){if(events[_0x13d4('0x6')](e)){var event=events[e];MailAccount[_0x13d4('0x7')](e,emitEvent(event));}}module[_0x13d4('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x544f=['../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x6bf553,_0x59e37d){var _0x1e25e4=function(_0x326b61){while(--_0x326b61){_0x6bf553['push'](_0x6bf553['shift']());}};_0x1e25e4(++_0x59e37d);}(_0x544f,0x104));var _0xf544=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x544f[_0xa60623];return _0x4a6487;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xf544('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf544('0x1')](0x0);var events={'afterCreate':_0xf544('0x2'),'afterUpdate':_0xf544('0x3'),'afterDestroy':'remove'};function emitEvent(_0x21cfa3){return function(_0x8f64a3,_0x3f3361,_0x4d56cd){MailAccountEvents[_0xf544('0x4')](_0x21cfa3+':'+_0x8f64a3['id'],_0x8f64a3);MailAccountEvents[_0xf544('0x4')](_0x21cfa3,_0x8f64a3);_0x4d56cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](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 490dff0..29c3061 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 _0x0fd6=['authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user','data5','auth','exports','define','custom','service','provider','host','Smtp','port','secure'];(function(_0x1b246e,_0x290280){var _0x8cfa0a=function(_0x57ccee){while(--_0x57ccee){_0x1b246e['push'](_0x1b246e['shift']());}};_0x8cfa0a(++_0x290280);}(_0x0fd6,0x123));var _0x60fd=function(_0x3f4c4e,_0x19f5aa){_0x3f4c4e=_0x3f4c4e-0x0;var _0x5cc5bd=_0x0fd6[_0x3f4c4e];return _0x5cc5bd;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x60fd('0x0')]=function(_0x244cd9){return _0x244cd9[_0x60fd('0x1')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x8570f9=this;var _0x1b28f3={'id':_0x8570f9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8570f9['provider']!==_0x60fd('0x2')){_0x1b28f3[_0x60fd('0x3')]=_0x8570f9[_0x60fd('0x4')];}else{_0x1b28f3[_0x60fd('0x5')]=_0x8570f9[_0x60fd('0x6')]['host'];_0x1b28f3[_0x60fd('0x7')]=_0x8570f9[_0x60fd('0x6')][_0x60fd('0x7')];_0x1b28f3['secure']=_0x8570f9[_0x60fd('0x6')][_0x60fd('0x8')];}if(_0x8570f9['Smtp'][_0x60fd('0x9')]){if(_0x8570f9['Smtp']['modernAuthentication']){if(!_0x8570f9[_0x60fd('0x6')][_0x60fd('0xa')])throw new Error(_0x60fd('0xb'));_0x1b28f3['auth']={'type':'OAuth2','user':_0x8570f9[_0x60fd('0x6')][_0x60fd('0xc')],'accessToken':_0x8570f9[_0x60fd('0x6')]['CloudProvider'][_0x60fd('0xd')]};}else{_0x1b28f3[_0x60fd('0xe')]={'user':_0x8570f9['Smtp']['user'],'pass':_0x8570f9[_0x60fd('0x6')]['pass']};}}return _0x1b28f3;}}});}; \ No newline at end of file +var _0xbfc7=['mail_accounts','custom','service','Smtp','host','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount'];(function(_0x1ade09,_0x136009){var _0x536936=function(_0x1c003c){while(--_0x1c003c){_0x1ade09['push'](_0x1ade09['shift']());}};_0x536936(++_0x136009);}(_0xbfc7,0x19b));var _0x7bfc=function(_0x44de0f,_0x5bc8ed){_0x44de0f=_0x44de0f-0x0;var _0x56092d=_0xbfc7[_0x44de0f];return _0x56092d;};'use strict';var attributes=require(_0x7bfc('0x0'));module[_0x7bfc('0x1')]=function(_0x1bb1fc){return _0x1bb1fc['define'](_0x7bfc('0x2'),attributes,{'tableName':_0x7bfc('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x31a967=this;var _0x4ff317={'id':_0x31a967['id'],'tls':{'rejectUnauthorized':![]}};if(_0x31a967['provider']!==_0x7bfc('0x4')){_0x4ff317[_0x7bfc('0x5')]=_0x31a967['provider'];}else{_0x4ff317['host']=_0x31a967[_0x7bfc('0x6')][_0x7bfc('0x7')];_0x4ff317['port']=_0x31a967['Smtp']['port'];_0x4ff317['secure']=_0x31a967[_0x7bfc('0x6')][_0x7bfc('0x8')];}if(_0x31a967[_0x7bfc('0x6')][_0x7bfc('0x9')]){if(_0x31a967[_0x7bfc('0x6')][_0x7bfc('0xa')]){if(!_0x31a967['Smtp'][_0x7bfc('0xb')])throw new Error(_0x7bfc('0xc'));_0x4ff317[_0x7bfc('0xd')]={'type':_0x7bfc('0xe'),'user':_0x31a967[_0x7bfc('0x6')][_0x7bfc('0xf')],'accessToken':_0x31a967[_0x7bfc('0x6')][_0x7bfc('0xb')][_0x7bfc('0x10')]};}else{_0x4ff317[_0x7bfc('0xd')]={'user':_0x31a967[_0x7bfc('0x6')]['user'],'pass':_0x31a967[_0x7bfc('0x6')][_0x7bfc('0x11')]};}}return _0x4ff317;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index cc9bae4..20eaffb 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 _0x2542=['MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','push','length','*,*,*,*','Contacts','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','Applications'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0x2542,0x169));var _0x2254=function(_0x1ca2f2,_0x2193b7){_0x1ca2f2=_0x1ca2f2-0x0;var _0x89924f=_0x2542[_0x1ca2f2];return _0x89924f;};'use strict';var _=require(_0x2254('0x0'));var moment=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var rs=require(_0x2254('0x3'));var Redis=require('ioredis');var db=require(_0x2254('0x4'))['db'];var logger=require('../../config/logger')(_0x2254('0x5'));var config=require(_0x2254('0x6'));var jayson=require(_0x2254('0x7'));var client=jayson[_0x2254('0x8')][_0x2254('0x9')]({'port':0x232c});config['redis']=_[_0x2254('0xa')](config[_0x2254('0xb')],{'host':_0x2254('0xc'),'port':0x18eb});var socket=require(_0x2254('0xd'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xe'))[_0x2254('0xf')](socket);function respondWithRpcPromise(_0xbf1c18,_0xb395da,_0x1ae415){return new BPromise(function(_0x38fb2b,_0x5b1ab9){return client[_0x2254('0x10')](_0xbf1c18,_0x1ae415)[_0x2254('0x11')](function(_0x506abe){logger[_0x2254('0x12')]('MailAccount,\x20%s,\x20%s',_0xb395da,'request\x20sent');logger[_0x2254('0x13')](_0x2254('0x14'),_0xb395da,_0x2254('0x15'),JSON[_0x2254('0x16')](_0x506abe));if(_0x506abe[_0x2254('0x17')]){if(_0x506abe[_0x2254('0x17')]['code']===0x1f4){logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe['error'][_0x2254('0x19')]);return _0x5b1ab9(_0x506abe[_0x2254('0x17')][_0x2254('0x19')]);}logger[_0x2254('0x17')](_0x2254('0x18'),_0xb395da,_0x506abe[_0x2254('0x17')]['message']);return _0x38fb2b(_0x506abe[_0x2254('0x17')]['message']);}else{logger[_0x2254('0x12')](_0x2254('0x18'),_0xb395da,_0x2254('0x15'));_0x38fb2b(_0x506abe[_0x2254('0x1a')][_0x2254('0x19')]);}})[_0x2254('0x1b')](function(_0x497724){logger['error']('MailAccount,\x20%s,\x20%s',_0xb395da,_0x497724);_0x5b1ab9(_0x497724);});});}exports[_0x2254('0x1c')]=function(_0x3a79f8){var _0x3c3a98=this;return new Promise(function(_0x1f1163,_0x2801d9){return db[_0x2254('0x1d')]['findAll']({'raw':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a79f8['options']?_0x3a79f8['options']['where']||null:null,'attributes':_0x3a79f8[_0x2254('0x1e')]?_0x3a79f8[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'limit':_0x3a79f8['options']?_0x3a79f8['options']['limit']||null:null,'include':_0x3a79f8['options']?_0x3a79f8['options']['include']?_[_0x2254('0x21')](_0x3a79f8[_0x2254('0x1e')][_0x2254('0x22')],function(_0x265467){return{'model':db[_0x265467[_0x2254('0x23')]],'as':_0x265467['as'],'attributes':_0x265467[_0x2254('0x20')],'include':_0x265467['include']?_['map'](_0x265467[_0x2254('0x22')],function(_0x4f6877){return{'model':db[_0x4f6877[_0x2254('0x23')]],'as':_0x4f6877['as'],'attributes':_0x4f6877[_0x2254('0x20')],'include':_0x4f6877[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4f6877[_0x2254('0x22')],function(_0x482688){return{'model':db[_0x482688[_0x2254('0x23')]],'as':_0x482688['as'],'attributes':_0x482688[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x37af8b){logger[_0x2254('0x12')](_0x2254('0x1c'),_0x3a79f8);logger[_0x2254('0x13')](_0x2254('0x1c'),_0x3a79f8,JSON[_0x2254('0x16')](_0x37af8b));_0x1f1163(_0x37af8b);})[_0x2254('0x1b')](function(_0x21c641){logger[_0x2254('0x17')](_0x2254('0x1c'),_0x21c641[_0x2254('0x19')],_0x3a79f8);_0x2801d9(_0x3c3a98[_0x2254('0x17')](0x1f4,_0x21c641[_0x2254('0x19')]));});});};exports[_0x2254('0x24')]=function(_0x291894){var _0x2f32f8=this;return new Promise(function(_0x4e3658,_0xe29526){return db[_0x2254('0x1d')][_0x2254('0x25')]({'raw':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x1f')]===undefined?!![]:![]:!![],'where':_0x291894[_0x2254('0x1e')]?_0x291894[_0x2254('0x1e')][_0x2254('0x26')]||null:null,'attributes':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x20')]||null:null,'include':_0x291894['options']?_0x291894[_0x2254('0x1e')][_0x2254('0x22')]?_[_0x2254('0x21')](_0x291894[_0x2254('0x1e')]['include'],function(_0x4a2df0){return{'model':db[_0x4a2df0[_0x2254('0x23')]],'as':_0x4a2df0['as'],'attributes':_0x4a2df0['attributes'],'include':_0x4a2df0[_0x2254('0x22')]?_[_0x2254('0x21')](_0x4a2df0[_0x2254('0x22')],function(_0x141ddc){return{'model':db[_0x141ddc[_0x2254('0x23')]],'as':_0x141ddc['as'],'attributes':_0x141ddc[_0x2254('0x20')],'include':_0x141ddc[_0x2254('0x22')]?_['map'](_0x141ddc[_0x2254('0x22')],function(_0x192e9f){return{'model':db[_0x192e9f[_0x2254('0x23')]],'as':_0x192e9f['as'],'attributes':_0x192e9f[_0x2254('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2254('0x11')](function(_0x3f6007){if(_0x291894[_0x2254('0x1e')][_0x2254('0x27')]===!![])_0x3f6007[_0x2254('0x28')](_0x2254('0x29'),_0x3f6007['getSmtpOptions']());logger[_0x2254('0x12')](_0x2254('0x24'),_0x291894);logger[_0x2254('0x13')](_0x2254('0x24'),_0x291894,JSON['stringify'](_0x3f6007));_0x4e3658(_0x3f6007);})[_0x2254('0x1b')](function(_0x160fec){logger[_0x2254('0x17')](_0x2254('0x24'),_0x160fec[_0x2254('0x19')],_0x291894);_0xe29526(_0x2f32f8[_0x2254('0x17')](0x1f4,_0x160fec[_0x2254('0x19')]));});});};exports[_0x2254('0x2a')]=function(_0x4db9a8){var _0x362ad1=this;return new Promise(function(_0x5c15d7,_0x1df9c3){var _0x19b580={'body':_0x4db9a8[_0x2254('0x2b')],'channel':_0x2254('0x2c')};var _0x460bb3=_[_0x2254('0x2d')](_[_0x2254('0x2e')](db['CmContact'][_0x2254('0x2f')]),[_0x2254('0x30'),_0x2254('0x31'),_0x2254('0x32'),_0x2254('0x33')]);var _0x57cda2=![];if(_0x4db9a8[_0x2254('0x2b')]['id']){delete _0x4db9a8[_0x2254('0x2b')]['id'];}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')])){return _0x1df9c3(_0x362ad1['error'](0x1f4,_0x2254('0x36')));}if(_['isNil'](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')])||_0x4db9a8[_0x2254('0x2b')][_0x2254('0x2b')]===''){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x37')));}if(_[_0x2254('0x34')](_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x39')+_0x460bb3));}if(!_[_0x2254('0x3a')](_0x460bb3,_0x4db9a8[_0x2254('0x2b')]['mapKey'])){return _0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x2254('0x3b')+_0x460bb3));}var _0x2c5609={};_0x2c5609[_0x4db9a8['body'][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x1d')][_0x2254('0x25')]({'where':{'id':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x3d')],'as':_0x2254('0x3e'),'include':[{'model':db[_0x2254('0x3f')],'as':'Contacts','where':_0x2c5609,'limit':0x1,'order':[[_0x2254('0x31'),_0x2254('0x40')]]}]},{'model':db[_0x2254('0x41')],'as':_0x2254('0x42')},{'model':db[_0x2254('0x43')],'as':_0x2254('0x44'),'include':[{'model':db[_0x2254('0x45')],'as':_0x2254('0x45')}]}]})[_0x2254('0x11')](function(_0xa103ea){if(_0xa103ea&&_0xa103ea['List']){var _0x36b977=_0xa103ea[_0x2254('0x46')]({'plain':!![]});_0x19b580['account']=_[_0x2254('0x47')](_0x36b977,[_0x2254('0x42'),_0x2254('0x3e')]);_0x19b580[_0x2254('0x3c')]['smtpOptions']=_0xa103ea[_0x2254('0x48')]();_0x19b580[_0x2254('0x49')]=_0x36b977['Applications'];_0x19b580[_0x2254('0x4a')]=_0x36b977[_0x2254('0x3e')];_0x19b580[_0x2254('0x49')]=_[_0x2254('0x4b')](_0x19b580['applications'],[_0x2254('0x4c')],[_0x2254('0x4d')]);if(_0x19b580[_0x2254('0x3c')]&&_0x19b580['account']['autoclose']){_0x19b580[_0x2254('0x49')][_0x2254('0x4e')]({'id':0x0,'priority':_0x19b580['applications'][_0x2254('0x4f')]+0x1,'app':'close','appdata':'autoclose','interval':_0x2254('0x50')});}if(_0x19b580[_0x2254('0x3c')][_0x2254('0x42')]){delete _0x19b580[_0x2254('0x3c')][_0x2254('0x42')];}if(_0x19b580['account']['List']){delete _0x19b580[_0x2254('0x3c')]['List'];}if(_0x36b977[_0x2254('0x3e')][_0x2254('0x51')][_0x2254('0x4f')]){return _0x36b977[_0x2254('0x3e')]['Contacts'][0x0];}var _0xd5fb20=_[_0x2254('0xa')](_0x4db9a8['body'],{'firstName':_0x4db9a8['body'][_0x2254('0x35')],'ListId':_0x36b977['ListId']});_0xd5fb20[_0x4db9a8[_0x2254('0x2b')][_0x2254('0x38')]]=_0x4db9a8[_0x2254('0x2b')][_0x2254('0x35')];return db[_0x2254('0x3f')]['create'](_0xd5fb20);}else{throw new Error('List\x20not\x20found');}})[_0x2254('0x11')](function(_0x5b1bd8){_0x19b580[_0x2254('0x52')]=_0x5b1bd8;if(_0x5b1bd8){if(!_0x4db9a8['body']['message']['messageId']){_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')]=rs[_0x2254('0x54')]()+'\x20'+_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')];}var _0x25137c={'ContactId':_0x5b1bd8['id'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x53')],'to':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'lastMsgAt':moment()[_0x2254('0x56')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2254('0x25')]({'where':{'closed':![],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id']},'include':[{'model':db[_0x2254('0x57')],'as':_0x2254('0x58'),'attributes':[_0x2254('0x53')],'where':{'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x59')]}}]})[_0x2254('0x11')](function(_0x4a7d36){if(_0x4a7d36){return[_0x4a7d36,![]];}return db['MailInteraction'][_0x2254('0x5a')](_0x25137c)['then'](function(_0x294931){return[_0x294931,!![]];});});}else{throw new Error(_0x2254('0x5b'));}})['spread'](function(_0x3c091e,_0x1b154f){if(_0x3c091e){_0x57cda2=_0x1b154f;if(!_0x1b154f){return _0x3c091e['update']({'inReplyTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['messageId'],'to':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x35')],'cc':_0x4db9a8['body']['message']['cc'],'subject':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x5c')],'attach':_0x3c091e['attach']?_0x3c091e[_0x2254('0x55')]:_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x2254('0x5d')),'lastMsgAt':moment()['format'](_0x2254('0x5d')),'lastMsgDirection':'in'});}else{return _0x3c091e;}}})[_0x2254('0x11')](function(_0x5ed07f){_0x19b580[_0x2254('0x5e')]=_0x5ed07f[_0x2254('0x46')]({'plain':!![]});_0x19b580['interaction'][_0x2254('0x5f')]=_0x57cda2;return db[_0x2254('0x57')][_0x2254('0x5a')]({'body':_0x4db9a8[_0x2254('0x2b')]['body'],'MailAccountId':_0x4db9a8[_0x2254('0x3c')]['id'],'MailInteractionId':_0x5ed07f['id'],'direction':'in','ContactId':_0x19b580[_0x2254('0x52')]['id'],'messageId':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x53')],'from':_0x4db9a8['body'][_0x2254('0x19')]['from'],'to':_0x4db9a8[_0x2254('0x2b')]['message']['to'],'cc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['cc'],'subject':_0x4db9a8['body'][_0x2254('0x19')]['subject'],'attach':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x55')],'Attachments':_0x4db9a8['body'][_0x2254('0x19')]['attachments'],'originTo':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['originTo'],'originCc':_0x4db9a8['body'][_0x2254('0x19')][_0x2254('0x60')],'bcc':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')]['bcc'],'ChatWebsiteId':_0x4db9a8[_0x2254('0x2b')][_0x2254('0x19')][_0x2254('0x61')]||null,'originChannel':_0x4db9a8[_0x2254('0x2b')]['message'][_0x2254('0x62')]||_0x2254('0x63'),'ChatOfflineMessageId':_0x4db9a8['body'][_0x2254('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2254('0x64')],'as':'Attachments'}]});})['then'](function(_0x4efb07){_0x19b580[_0x2254('0x19')]=_0x4efb07;if(_0x19b580['interaction'][_0x2254('0x65')]){return db[_0x2254('0x66')]['find']({'attributes':['id',_0x2254('0x67')],'where':{'id':_0x19b580[_0x2254('0x5e')][_0x2254('0x65')]}})[_0x2254('0x11')](function(_0x259e10){if(_0x259e10){_0x19b580[_0x2254('0x49')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x259e10[_0x2254('0x67')]+','+(_0x19b580[_0x2254('0x3c')][_0x2254('0x68')]||0xa),'interval':_0x2254('0x50')});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);});}return respondWithRpcPromise(_0x2254('0x69'),_0x2254('0x6a'),_0x19b580);})[_0x2254('0x11')](function(_0x39b95b){_0x5c15d7(_0x39b95b);})['catch'](function(_0x25eb17){_0x1df9c3(_0x362ad1[_0x2254('0x17')](0x1f4,_0x25eb17['message']));});});}; \ No newline at end of file +var _0x524e=['ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','CloudProvider','get','Applications','applications','orderBy','priority','asc','autoclose','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','bcc'];(function(_0x540c49,_0x3e88d9){var _0x390f69=function(_0x4cdf60){while(--_0x4cdf60){_0x540c49['push'](_0x540c49['shift']());}};_0x390f69(++_0x3e88d9);}(_0x524e,0x15e));var _0xe524=function(_0x58770c,_0x10cec1){_0x58770c=_0x58770c-0x0;var _0x2dc542=_0x524e[_0x58770c];return _0x2dc542;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xe524('0x0'));var rs=require(_0xe524('0x1'));var Redis=require(_0xe524('0x2'));var db=require(_0xe524('0x3'))['db'];var logger=require(_0xe524('0x4'))(_0xe524('0x5'));var config=require(_0xe524('0x6'));var jayson=require(_0xe524('0x7'));var client=jayson[_0xe524('0x8')][_0xe524('0x9')]({'port':0x232c});config['redis']=_[_0xe524('0xa')](config[_0xe524('0xb')],{'host':_0xe524('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xd'))[_0xe524('0xe')](socket);function respondWithRpcPromise(_0x1f36e5,_0x991924,_0x4082b1){return new BPromise(function(_0x1a08e2,_0xb3eb9f){return client[_0xe524('0xf')](_0x1f36e5,_0x4082b1)[_0xe524('0x10')](function(_0x1e4459){logger[_0xe524('0x11')](_0xe524('0x12'),_0x991924,_0xe524('0x13'));logger[_0xe524('0x14')](_0xe524('0x15'),_0x991924,'request\x20sent',JSON['stringify'](_0x1e4459));if(_0x1e4459[_0xe524('0x16')]){if(_0x1e4459[_0xe524('0x16')][_0xe524('0x17')]===0x1f4){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x1e4459['error'][_0xe524('0x18')]);return _0xb3eb9f(_0x1e4459['error'][_0xe524('0x18')]);}logger[_0xe524('0x16')]('MailAccount,\x20%s,\x20%s',_0x991924,_0x1e4459[_0xe524('0x16')]['message']);return _0x1a08e2(_0x1e4459[_0xe524('0x16')]['message']);}else{logger[_0xe524('0x11')]('MailAccount,\x20%s,\x20%s',_0x991924,'request\x20sent');_0x1a08e2(_0x1e4459['result'][_0xe524('0x18')]);}})['catch'](function(_0x11b2a1){logger[_0xe524('0x16')](_0xe524('0x12'),_0x991924,_0x11b2a1);_0xb3eb9f(_0x11b2a1);});});}exports[_0xe524('0x19')]=function(_0x5d7b17){var _0x1fd93a=this;return new Promise(function(_0x3ccb3f,_0x49d104){return db[_0xe524('0x1a')][_0xe524('0x1b')]({'raw':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17['options'][_0xe524('0x1f')]||null:null,'limit':_0x5d7b17['options']?_0x5d7b17['options'][_0xe524('0x20')]||null:null,'include':_0x5d7b17[_0xe524('0x1c')]?_0x5d7b17[_0xe524('0x1c')][_0xe524('0x21')]?_['map'](_0x5d7b17[_0xe524('0x1c')]['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x22')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1f')],'include':_0x17e245[_0xe524('0x21')]?_[_0xe524('0x23')](_0x17e245[_0xe524('0x21')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes'],'include':_0x2141db[_0xe524('0x21')]?_[_0xe524('0x23')](_0x2141db[_0xe524('0x21')],function(_0x109a96){return{'model':db[_0x109a96[_0xe524('0x22')]],'as':_0x109a96['as'],'attributes':_0x109a96['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1ff){logger[_0xe524('0x11')](_0xe524('0x19'),_0x5d7b17);logger[_0xe524('0x14')](_0xe524('0x19'),_0x5d7b17,JSON['stringify'](_0x4b1ff));_0x3ccb3f(_0x4b1ff);})[_0xe524('0x24')](function(_0x9a7e98){logger['error']('GetMailAccount',_0x9a7e98[_0xe524('0x18')],_0x5d7b17);_0x49d104(_0x1fd93a[_0xe524('0x16')](0x1f4,_0x9a7e98['message']));});});};exports[_0xe524('0x25')]=function(_0x535354){var _0x3fec06=this;return new Promise(function(_0x54af2a,_0x315e56){return db[_0xe524('0x1a')][_0xe524('0x26')]({'raw':_0x535354['options']?_0x535354[_0xe524('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x535354[_0xe524('0x1c')]?_0x535354[_0xe524('0x1c')][_0xe524('0x1e')]||null:null,'attributes':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x1f')]||null:null,'include':_0x535354['options']?_0x535354[_0xe524('0x1c')][_0xe524('0x21')]?_[_0xe524('0x23')](_0x535354[_0xe524('0x1c')]['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x22')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1f')],'include':_0x415450[_0xe524('0x21')]?_[_0xe524('0x23')](_0x415450[_0xe524('0x21')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x22')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes'],'include':_0x2741e8[_0xe524('0x21')]?_['map'](_0x2741e8[_0xe524('0x21')],function(_0x53eeee){return{'model':db[_0x53eeee['model']],'as':_0x53eeee['as'],'attributes':_0x53eeee[_0xe524('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c3aae){if(_0x535354[_0xe524('0x1c')][_0xe524('0x27')]===!![])_0x1c3aae[_0xe524('0x28')](_0xe524('0x29'),_0x1c3aae[_0xe524('0x2a')]());logger[_0xe524('0x11')](_0xe524('0x25'),_0x535354);logger['debug'](_0xe524('0x25'),_0x535354,JSON[_0xe524('0x2b')](_0x1c3aae));_0x54af2a(_0x1c3aae);})[_0xe524('0x24')](function(_0x3fd023){logger[_0xe524('0x16')](_0xe524('0x25'),_0x3fd023[_0xe524('0x18')],_0x535354);_0x315e56(_0x3fec06[_0xe524('0x16')](0x1f4,_0x3fd023['message']));});});};exports[_0xe524('0x2c')]=function(_0x849307){var _0x2e4a13=this;return new Promise(function(_0x59781b,_0x238673){var _0x5213ed={'body':_0x849307[_0xe524('0x2d')],'channel':_0xe524('0x2e')};var _0x43c314=_[_0xe524('0x2f')](_[_0xe524('0x30')](db[_0xe524('0x31')][_0xe524('0x32')]),['createdAt',_0xe524('0x33'),_0xe524('0x34'),_0xe524('0x35')]);var _0x376505=![];if(_0x849307[_0xe524('0x2d')]['id']){delete _0x849307[_0xe524('0x2d')]['id'];}if(_['isNil'](_0x849307[_0xe524('0x2d')][_0xe524('0x36')])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe524('0x37')](_0x849307['body']['body'])||_0x849307[_0xe524('0x2d')][_0xe524('0x2d')]===''){return _0x238673(_0x2e4a13['error'](0x1f4,_0xe524('0x38')));}if(_[_0xe524('0x37')](_0x849307[_0xe524('0x2d')][_0xe524('0x39')])){return _0x238673(_0x2e4a13['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}if(!_[_0xe524('0x3a')](_0x43c314,_0x849307[_0xe524('0x2d')]['mapKey'])){return _0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43c314));}var _0x472519={};_0x472519[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x1a')][_0xe524('0x26')]({'where':{'id':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db[_0xe524('0x3c')],'as':_0xe524('0x3d'),'include':[{'model':db[_0xe524('0x31')],'as':_0xe524('0x3e'),'where':_0x472519,'limit':0x1,'order':[[_0xe524('0x33'),_0xe524('0x3f')]]}]},{'model':db[_0xe524('0x40')],'as':'Applications'},{'model':db[_0xe524('0x41')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xe524('0x42')}]}]})['then'](function(_0x232cf0){if(_0x232cf0&&_0x232cf0[_0xe524('0x3d')]){var _0x561107=_0x232cf0[_0xe524('0x43')]({'plain':!![]});_0x5213ed['account']=_['omit'](_0x561107,[_0xe524('0x44'),_0xe524('0x3d')]);_0x5213ed[_0xe524('0x3b')]['smtpOptions']=_0x232cf0['getSmtpOptions']();_0x5213ed['applications']=_0x561107['Applications'];_0x5213ed['list']=_0x561107['List'];_0x5213ed[_0xe524('0x45')]=_[_0xe524('0x46')](_0x5213ed['applications'],[_0xe524('0x47')],[_0xe524('0x48')]);if(_0x5213ed[_0xe524('0x3b')]&&_0x5213ed[_0xe524('0x3b')][_0xe524('0x49')]){_0x5213ed['applications'][_0xe524('0x4a')]({'id':0x0,'priority':_0x5213ed[_0xe524('0x45')][_0xe524('0x4b')]+0x1,'app':'close','appdata':_0xe524('0x49'),'interval':'*,*,*,*'});}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x44')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x44')];}if(_0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')]){delete _0x5213ed[_0xe524('0x3b')][_0xe524('0x3d')];}if(_0x561107[_0xe524('0x3d')][_0xe524('0x3e')][_0xe524('0x4b')]){return _0x561107[_0xe524('0x3d')]['Contacts'][0x0];}var _0x4dac0f=_['defaults'](_0x849307[_0xe524('0x2d')],{'firstName':_0x849307[_0xe524('0x2d')][_0xe524('0x36')],'ListId':_0x561107[_0xe524('0x35')]});_0x4dac0f[_0x849307[_0xe524('0x2d')][_0xe524('0x39')]]=_0x849307[_0xe524('0x2d')][_0xe524('0x36')];return db[_0xe524('0x31')][_0xe524('0x4c')](_0x4dac0f);}else{throw new Error(_0xe524('0x4d'));}})['then'](function(_0x5012fc){_0x5213ed[_0xe524('0x4e')]=_0x5012fc;if(_0x5012fc){if(!_0x849307['body']['message']['messageId']){_0x849307['body'][_0xe524('0x18')][_0xe524('0x4f')]=rs[_0xe524('0x50')]()+'\x20'+_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x36')];}var _0x244f08={'ContactId':_0x5012fc['id'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'inReplyTo':_0x849307[_0xe524('0x2d')]['message']['messageId'],'to':_0x849307['body'][_0xe524('0x18')]['from'],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307['body']['message'][_0xe524('0x52')],'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'};return db[_0xe524('0x55')][_0xe524('0x26')]({'where':{'closed':![],'MailAccountId':_0x849307[_0xe524('0x3b')]['id']},'include':[{'model':db['MailMessage'],'as':_0xe524('0x56'),'attributes':[_0xe524('0x4f')],'where':{'messageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x57')]}}]})[_0xe524('0x10')](function(_0x3bd9f9){if(_0x3bd9f9){return[_0x3bd9f9,![]];}return db['MailInteraction']['create'](_0x244f08)[_0xe524('0x10')](function(_0x35cbe9){return[_0x35cbe9,!![]];});});}else{throw new Error(_0xe524('0x58'));}})[_0xe524('0x59')](function(_0x139a0a,_0x4c6869){if(_0x139a0a){_0x376505=_0x4c6869;if(!_0x4c6869){return _0x139a0a[_0xe524('0x5a')]({'inReplyTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x36')],'cc':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['subject'],'attach':_0x139a0a[_0xe524('0x52')]?_0x139a0a[_0xe524('0x52')]:_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x52')],'substatus':null,'substatusAt':moment()['format'](_0xe524('0x54')),'lastMsgAt':moment()[_0xe524('0x53')](_0xe524('0x54')),'lastMsgDirection':'in'});}else{return _0x139a0a;}}})[_0xe524('0x10')](function(_0x387c4b){_0x5213ed[_0xe524('0x5b')]=_0x387c4b[_0xe524('0x43')]({'plain':!![]});_0x5213ed['interaction'][_0xe524('0x5c')]=_0x376505;return db[_0xe524('0x5d')][_0xe524('0x4c')]({'body':_0x849307[_0xe524('0x2d')]['body'],'MailAccountId':_0x849307[_0xe524('0x3b')]['id'],'MailInteractionId':_0x387c4b['id'],'direction':'in','ContactId':_0x5213ed['contact']['id'],'messageId':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x4f')],'from':_0x849307['body'][_0xe524('0x18')][_0xe524('0x36')],'to':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['to'],'cc':_0x849307[_0xe524('0x2d')]['message']['cc'],'subject':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x51')],'attach':_0x849307[_0xe524('0x2d')][_0xe524('0x18')]['attach'],'Attachments':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5e')],'originTo':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x5f')],'originCc':_0x849307['body'][_0xe524('0x18')][_0xe524('0x60')],'bcc':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x61')],'ChatWebsiteId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x62')]||null,'originChannel':_0x849307[_0xe524('0x2d')][_0xe524('0x18')][_0xe524('0x63')]||_0xe524('0x64'),'ChatOfflineMessageId':_0x849307[_0xe524('0x2d')]['message'][_0xe524('0x65')]||null},{'include':[{'model':db[_0xe524('0x66')],'as':_0xe524('0x67')}]});})[_0xe524('0x10')](function(_0x19b28a){_0x5213ed[_0xe524('0x18')]=_0x19b28a;if(_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]){return db[_0xe524('0x69')][_0xe524('0x26')]({'attributes':['id',_0xe524('0x6a')],'where':{'id':_0x5213ed[_0xe524('0x5b')][_0xe524('0x68')]}})[_0xe524('0x10')](function(_0x23425c){if(_0x23425c){_0x5213ed['applications'][_0xe524('0x6b')]({'id':0x0,'priority':0x0,'app':_0xe524('0x6c'),'appdata':_0x23425c[_0xe524('0x6a')]+','+(_0x5213ed['account'][_0xe524('0x6d')]||0xa),'interval':_0xe524('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x5213ed);});}return respondWithRpcPromise(_0xe524('0x6f'),'startRouting',_0x5213ed);})[_0xe524('0x10')](function(_0x5a6a07){_0x59781b(_0x5a6a07);})[_0xe524('0x24')](function(_0x1ed60b){_0x238673(_0x2e4a13[_0xe524('0x16')](0x1f4,_0x1ed60b[_0xe524('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b1576bb..3decb80 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 _0xbf31=['remove','update','emit','removeListener','mailAccount:','./mailAccount.events','save'];(function(_0x5d4eb3,_0x2311ad){var _0xfd2513=function(_0x1aae2e){while(--_0x1aae2e){_0x5d4eb3['push'](_0x5d4eb3['shift']());}};_0xfd2513(++_0x2311ad);}(_0xbf31,0xbb));var _0x1bf3=function(_0x53dc13,_0x57fa2a){_0x53dc13=_0x53dc13-0x0;var _0x41fdb1=_0xbf31[_0x53dc13];return _0x41fdb1;};'use strict';var MailAccountEvents=require(_0x1bf3('0x0'));var events=[_0x1bf3('0x1'),_0x1bf3('0x2'),_0x1bf3('0x3')];function createListener(_0x5d273a,_0x39c2ac){return function(_0x4563f6){_0x39c2ac[_0x1bf3('0x4')](_0x5d273a,_0x4563f6);};}function removeListener(_0x3eadd6,_0x54ba2f){return function(){MailAccountEvents[_0x1bf3('0x5')](_0x3eadd6,_0x54ba2f);};}exports['register']=function(_0x739cf){for(var _0xebf36c=0x0,_0x157686=events['length'];_0xebf36c<_0x157686;_0xebf36c++){var _0x37cb13=events[_0xebf36c];var _0x4ace18=createListener(_0x1bf3('0x6')+_0x37cb13,_0x739cf);MailAccountEvents['on'](_0x37cb13,_0x4ace18);}}; \ No newline at end of file +var _0x3a31=['register','length','mailAccount:','./mailAccount.events','remove','emit','removeListener'];(function(_0x581aae,_0x2b18ee){var _0x539df2=function(_0xbbcb64){while(--_0xbbcb64){_0x581aae['push'](_0x581aae['shift']());}};_0x539df2(++_0x2b18ee);}(_0x3a31,0x7a));var _0x13a3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3a31[_0x2dafbe];return _0x58a45a;};'use strict';var MailAccountEvents=require(_0x13a3('0x0'));var events=['save',_0x13a3('0x1'),'update'];function createListener(_0x1c2dcb,_0x2bf69b){return function(_0x1d6dc2){_0x2bf69b[_0x13a3('0x2')](_0x1c2dcb,_0x1d6dc2);};}function removeListener(_0x1e110c,_0x5dc9de){return function(){MailAccountEvents[_0x13a3('0x3')](_0x1e110c,_0x5dc9de);};}exports[_0x13a3('0x4')]=function(_0x4216d8){for(var _0x301b54=0x0,_0x4a73db=events[_0x13a3('0x5')];_0x301b54<_0x4a73db;_0x301b54++){var _0x2ef007=events[_0x301b54];var _0x2e91da=createListener(_0x13a3('0x6')+_0x2ef007,_0x4216d8);MailAccountEvents['on'](_0x2ef007,_0x2e91da);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e940a8e..a3d0524 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 _0xd7bc=['update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put'];(function(_0x38bb02,_0x4918b2){var _0xd872c4=function(_0x35e0dc){while(--_0x35e0dc){_0x38bb02['push'](_0x38bb02['shift']());}};_0xd872c4(++_0x4918b2);}(_0xd7bc,0x13f));var _0xcd7b=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0xd7bc[_0x270a54];return _0x4d07d0;};'use strict';var multer=require(_0xcd7b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd7b('0x1'));var router=express[_0xcd7b('0x2')]();var fs_extra=require(_0xcd7b('0x3'));var auth=require(_0xcd7b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd7b('0x5'));var controller=require(_0xcd7b('0x6'));router[_0xcd7b('0x7')](_0xcd7b('0x8'),auth[_0xcd7b('0x9')](),controller['show']);router[_0xcd7b('0xa')](_0xcd7b('0x8'),auth[_0xcd7b('0x9')](),controller[_0xcd7b('0xb')]);router[_0xcd7b('0xc')]('/:id',auth[_0xcd7b('0x9')](),controller[_0xcd7b('0xd')]);module[_0xcd7b('0xe')]=router; \ No newline at end of file +var _0x7af3=['update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id'];(function(_0x483c16,_0x5509f6){var _0x848da3=function(_0x1dd808){while(--_0x1dd808){_0x483c16['push'](_0x483c16['shift']());}};_0x848da3(++_0x5509f6);}(_0x7af3,0xd4));var _0x37af=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7af3[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0x37af('0x0'));var path=require(_0x37af('0x1'));var timeout=require(_0x37af('0x2'));var express=require(_0x37af('0x3'));var router=express[_0x37af('0x4')]();var fs_extra=require(_0x37af('0x5'));var auth=require(_0x37af('0x6'));var interaction=require(_0x37af('0x7'));var config=require(_0x37af('0x8'));var controller=require('./mailApplication.controller');router[_0x37af('0x9')]('/:id',auth[_0x37af('0xa')](),controller[_0x37af('0xb')]);router['put'](_0x37af('0xc'),auth['isAuthenticated'](),controller[_0x37af('0xd')]);router['delete'](_0x37af('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x37af('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 b9b748c..4e7d823 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 _0x0e1a=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x2cb4f4,_0x51dc79){var _0x165f91=function(_0x17b00f){while(--_0x17b00f){_0x2cb4f4['push'](_0x2cb4f4['shift']());}};_0x165f91(++_0x51dc79);}(_0x0e1a,0x11f));var _0xa0e1=function(_0x122296,_0x15efed){_0x122296=_0x122296-0x0;var _0x43efc2=_0x0e1a[_0x122296];return _0x43efc2;};'use strict';var Sequelize=require(_0xa0e1('0x0'));module[_0xa0e1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa0e1('0x2')},'appdata':{'type':Sequelize[_0xa0e1('0x3')]()},'description':{'type':Sequelize[_0xa0e1('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa0e1('0x5')}}; \ No newline at end of file +var _0x462a=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x201796,_0x21e5fc){var _0x2c781a=function(_0x54f9d3){while(--_0x54f9d3){_0x201796['push'](_0x201796['shift']());}};_0x2c781a(++_0x21e5fc);}(_0x462a,0x91));var _0xa462=function(_0x565292,_0x57eb92){_0x565292=_0x565292-0x0;var _0x521b61=_0x462a[_0x565292];return _0x521b61;};'use strict';var Sequelize=require(_0xa462('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa462('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa462('0x2')],'allowNull':![],'defaultValue':_0xa462('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa462('0x2')]},'interval':{'type':Sequelize[_0xa462('0x2')],'defaultValue':_0xa462('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8464612..3ad6473 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x87c8fe,_0x344255){var _0x4c9c58=function(_0x6adadf){while(--_0x6adadf){_0x87c8fe['push'](_0x87c8fe['shift']());}};_0x4c9c58(++_0x344255);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xcb91[_0x4be8ba];return _0x1af822;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x565a37,_0x3e26b7){var _0x2a60e2=function(_0x3b4c77){while(--_0x3b4c77){_0x565a37['push'](_0x565a37['shift']());}};_0x2a60e2(++_0x3e26b7);}(_0x54ef,0x112));var _0xf54e=function(_0x1dc124,_0x32cef6){_0x1dc124=_0x1dc124-0x0;var _0x29740d=_0x54ef[_0x1dc124];return _0x29740d;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4309a6e..4fd6732 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 _0xea0b=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','../../config/logger','bluebird','request-promise'];(function(_0x45fa47,_0x14781d){var _0x247a41=function(_0x16e4f6){while(--_0x16e4f6){_0x45fa47['push'](_0x45fa47['shift']());}};_0x247a41(++_0x14781d);}(_0xea0b,0xe0));var _0xbea0=function(_0x4cbc15,_0x10f442){_0x4cbc15=_0x4cbc15-0x0;var _0x4452c9=_0xea0b[_0x4cbc15];return _0x4452c9;};'use strict';var _=require(_0xbea0('0x0'));var util=require('util');var logger=require(_0xbea0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbea0('0x2'));var rp=require(_0xbea0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbea0('0x4'));var config=require(_0xbea0('0x5'));var attributes=require(_0xbea0('0x6'));module[_0xbea0('0x7')]=function(_0x488345,_0x38d616){return _0x488345[_0xbea0('0x8')](_0xbea0('0x9'),attributes,{'tableName':_0xbea0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbea0('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x058b=['../../config/environment','./mailApplication.attributes','define','mail_applications','lodash','api','moment','bluebird','request-promise','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x058b,0x11c));var _0xb058=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x058b[_0x236c89];return _0x3b2a15;};'use strict';var _=require(_0xb058('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb058('0x1'));var moment=require(_0xb058('0x2'));var BPromise=require(_0xb058('0x3'));var rp=require(_0xb058('0x4'));var fs=require('fs');var path=require(_0xb058('0x5'));var rimraf=require('rimraf');var config=require(_0xb058('0x6'));var attributes=require(_0xb058('0x7'));module['exports']=function(_0x41966e,_0x29a3f8){return _0x41966e[_0xb058('0x8')]('MailApplication',attributes,{'tableName':_0xb058('0x9'),'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 c29855a..230a75d 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 _0x6f89=['../../config/utils','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x2e3a6a,_0x4eeb24){var _0x463cef=function(_0x3c2e85){while(--_0x3c2e85){_0x2e3a6a['push'](_0x2e3a6a['shift']());}};_0x463cef(++_0x4eeb24);}(_0x6f89,0x1d8));var _0x96f8=function(_0x48b8ba,_0x4d1bb9){_0x48b8ba=_0x48b8ba-0x0;var _0x7c4e05=_0x6f89[_0x48b8ba];return _0x7c4e05;};'use strict';var _=require(_0x96f8('0x0'));var util=require(_0x96f8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x96f8('0x2'));var fs=require('fs');var Redis=require(_0x96f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96f8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x96f8('0x5'));var jayson=require(_0x96f8('0x6'));var client=jayson[_0x96f8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae0b3,_0x58301d,_0x3b5e15){return new BPromise(function(_0x4dc734,_0x2122f5){return client[_0x96f8('0x8')](_0x5ae0b3,_0x3b5e15)[_0x96f8('0x9')](function(_0x4bdf69){logger[_0x96f8('0xa')](_0x96f8('0xb'),_0x58301d,_0x96f8('0xc'));logger[_0x96f8('0xd')](_0x96f8('0xe'),_0x58301d,'request\x20sent',JSON[_0x96f8('0xf')](_0x4bdf69));if(_0x4bdf69[_0x96f8('0x10')]){if(_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x11')]===0x1f4){logger[_0x96f8('0x10')](_0x96f8('0xb'),_0x58301d,_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x12')]);return _0x2122f5(_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x12')]);}logger['error'](_0x96f8('0xb'),_0x58301d,_0x4bdf69[_0x96f8('0x10')][_0x96f8('0x12')]);return _0x4dc734(_0x4bdf69['error']['message']);}else{logger[_0x96f8('0xa')](_0x96f8('0xb'),_0x58301d,_0x96f8('0xc'));_0x4dc734(_0x4bdf69[_0x96f8('0x13')]['message']);}})[_0x96f8('0x14')](function(_0x1c3641){logger[_0x96f8('0x10')]('MailApplication,\x20%s,\x20%s',_0x58301d,_0x1c3641);_0x2122f5(_0x1c3641);});});}exports[_0x96f8('0x15')]=function(_0x40eccb){var _0x4ede5a=this;return new Promise(function(_0x5bcee2,_0x41d300){return db[_0x96f8('0x16')][_0x96f8('0x17')](_0x40eccb['body'],{'raw':_0x40eccb[_0x96f8('0x18')]?_0x40eccb[_0x96f8('0x18')][_0x96f8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40eccb['options']?_0x40eccb[_0x96f8('0x18')]['where']||null:null,'attributes':_0x40eccb[_0x96f8('0x18')]?_0x40eccb[_0x96f8('0x18')][_0x96f8('0x1a')]||null:null,'limit':_0x40eccb['options']?_0x40eccb['options'][_0x96f8('0x1b')]||null:null})[_0x96f8('0x9')](function(_0x2ac61c){logger['info']('UpdateMailApplication',_0x40eccb);logger[_0x96f8('0xd')](_0x96f8('0x15'),_0x40eccb,JSON[_0x96f8('0xf')](_0x2ac61c));_0x5bcee2(_0x2ac61c);})[_0x96f8('0x14')](function(_0xf682bc){logger[_0x96f8('0x10')](_0x96f8('0x15'),_0xf682bc[_0x96f8('0x12')],_0x40eccb);_0x41d300(_0x4ede5a['error'](0x1f4,_0xf682bc[_0x96f8('0x12')]));});});}; \ No newline at end of file +var _0xdf47=['attributes','UpdateMailApplication','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','update','body','options','raw','where'];(function(_0x2086bb,_0x27d943){var _0x569238=function(_0x42a1ad){while(--_0x42a1ad){_0x2086bb['push'](_0x2086bb['shift']());}};_0x569238(++_0x27d943);}(_0xdf47,0x77));var _0x7df4=function(_0x2b78e0,_0xaf5738){_0x2b78e0=_0x2b78e0-0x0;var _0x22815e=_0xdf47[_0x2b78e0];return _0x22815e;};'use strict';var _=require('lodash');var util=require(_0x7df4('0x0'));var moment=require(_0x7df4('0x1'));var BPromise=require(_0x7df4('0x2'));var rs=require(_0x7df4('0x3'));var fs=require('fs');var Redis=require(_0x7df4('0x4'));var db=require(_0x7df4('0x5'))['db'];var utils=require(_0x7df4('0x6'));var logger=require(_0x7df4('0x7'))(_0x7df4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7df4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5164a9,_0x2505c3,_0x2c1828){return new BPromise(function(_0xb37242,_0x12c24e){return client[_0x7df4('0xa')](_0x5164a9,_0x2c1828)[_0x7df4('0xb')](function(_0x553f2b){logger[_0x7df4('0xc')](_0x7df4('0xd'),_0x2505c3,'request\x20sent');logger[_0x7df4('0xe')](_0x7df4('0xf'),_0x2505c3,_0x7df4('0x10'),JSON['stringify'](_0x553f2b));if(_0x553f2b[_0x7df4('0x11')]){if(_0x553f2b[_0x7df4('0x11')][_0x7df4('0x12')]===0x1f4){logger[_0x7df4('0x11')](_0x7df4('0xd'),_0x2505c3,_0x553f2b[_0x7df4('0x11')][_0x7df4('0x13')]);return _0x12c24e(_0x553f2b[_0x7df4('0x11')]['message']);}logger[_0x7df4('0x11')]('MailApplication,\x20%s,\x20%s',_0x2505c3,_0x553f2b['error'][_0x7df4('0x13')]);return _0xb37242(_0x553f2b[_0x7df4('0x11')][_0x7df4('0x13')]);}else{logger[_0x7df4('0xc')](_0x7df4('0xd'),_0x2505c3,'request\x20sent');_0xb37242(_0x553f2b['result'][_0x7df4('0x13')]);}})[_0x7df4('0x14')](function(_0x164428){logger['error']('MailApplication,\x20%s,\x20%s',_0x2505c3,_0x164428);_0x12c24e(_0x164428);});});}exports['UpdateMailApplication']=function(_0xffb5f3){var _0x3b8c5b=this;return new Promise(function(_0x21a9b9,_0x43da1a){return db['MailApplication'][_0x7df4('0x15')](_0xffb5f3[_0x7df4('0x16')],{'raw':_0xffb5f3[_0x7df4('0x17')]?_0xffb5f3['options'][_0x7df4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xffb5f3[_0x7df4('0x17')]?_0xffb5f3[_0x7df4('0x17')][_0x7df4('0x19')]||null:null,'attributes':_0xffb5f3[_0x7df4('0x17')]?_0xffb5f3[_0x7df4('0x17')][_0x7df4('0x1a')]||null:null,'limit':_0xffb5f3['options']?_0xffb5f3[_0x7df4('0x17')]['limit']||null:null})[_0x7df4('0xb')](function(_0x22d1e4){logger['info'](_0x7df4('0x1b'),_0xffb5f3);logger[_0x7df4('0xe')](_0x7df4('0x1b'),_0xffb5f3,JSON[_0x7df4('0x1c')](_0x22d1e4));_0x21a9b9(_0x22d1e4);})[_0x7df4('0x14')](function(_0x2ec920){logger[_0x7df4('0x11')](_0x7df4('0x1b'),_0x2ec920['message'],_0xffb5f3);_0x43da1a(_0x3b8c5b[_0x7df4('0x11')](0x1f4,_0x2ec920[_0x7df4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index be88b89..41672cd 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 _0x808f=['destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','mailinteraction:update','delete','mailinteraction:destroy'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x808f,0x6b));var _0xf808=function(_0x5525b4,_0x4f6596){_0x5525b4=_0x5525b4-0x0;var _0x5827c7=_0x808f[_0x5525b4];return _0x5827c7;};'use strict';var express=require(_0xf808('0x0'));var router=express[_0xf808('0x1')]();var auth=require(_0xf808('0x2'));var interaction=require(_0xf808('0x3'));var controller=require('./mailInteraction.controller');router[_0xf808('0x4')]('/',auth[_0xf808('0x5')](),controller[_0xf808('0x6')]);router[_0xf808('0x4')](_0xf808('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf808('0x8'),auth['isAuthenticated'](),controller[_0xf808('0x9')]);router[_0xf808('0x4')]('/:id/messages',auth[_0xf808('0x5')](),controller[_0xf808('0xa')]);router['get'](_0xf808('0xb'),auth[_0xf808('0x5')](),controller[_0xf808('0xc')]);router[_0xf808('0xd')]('/',auth[_0xf808('0x5')](),controller[_0xf808('0xe')]);router[_0xf808('0xd')](_0xf808('0xf'),auth[_0xf808('0x5')](),controller['addMessage']);router[_0xf808('0xd')](_0xf808('0x10'),auth['isAuthenticated'](),interaction[_0xf808('0x11')](_0xf808('0x12'),_0xf808('0x13')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xf808('0x12'),_0xf808('0x14')),controller['update']);router[_0xf808('0x15')](_0xf808('0x8'),auth[_0xf808('0x5')](),interaction[_0xf808('0x11')](_0xf808('0x12'),_0xf808('0x16')),controller[_0xf808('0x17')]);router['delete'](_0xf808('0x10'),auth[_0xf808('0x5')](),controller[_0xf808('0x18')]);module[_0xf808('0x19')]=router; \ No newline at end of file +var _0x832a=['removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','destroy','delete'];(function(_0x23678d,_0x2da727){var _0x5e743b=function(_0x170f41){while(--_0x170f41){_0x23678d['push'](_0x23678d['shift']());}};_0x5e743b(++_0x2da727);}(_0x832a,0x115));var _0xa832=function(_0xd6f6f5,_0x1b2345){_0xd6f6f5=_0xd6f6f5-0x0;var _0xe61908=_0x832a[_0xd6f6f5];return _0xe61908;};'use strict';var express=require(_0xa832('0x0'));var router=express['Router']();var auth=require(_0xa832('0x1'));var interaction=require(_0xa832('0x2'));var controller=require(_0xa832('0x3'));router[_0xa832('0x4')]('/',auth['isAuthenticated'](),controller[_0xa832('0x5')]);router[_0xa832('0x4')]('/describe',auth[_0xa832('0x6')](),controller['describe']);router[_0xa832('0x4')](_0xa832('0x7'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa832('0x8'),auth['isAuthenticated'](),controller[_0xa832('0x9')]);router['get'](_0xa832('0xa'),auth[_0xa832('0x6')](),controller['download']);router[_0xa832('0xb')]('/',auth[_0xa832('0x6')](),controller[_0xa832('0xc')]);router[_0xa832('0xb')]('/:id/messages',auth[_0xa832('0x6')](),controller[_0xa832('0xd')]);router[_0xa832('0xb')](_0xa832('0xe'),auth[_0xa832('0x6')](),interaction[_0xa832('0xf')](_0xa832('0x10'),_0xa832('0x11')),controller['addTags']);router[_0xa832('0x12')](_0xa832('0x7'),auth[_0xa832('0x6')](),interaction['tracked'](_0xa832('0x10'),_0xa832('0x13')),controller[_0xa832('0x14')]);router['delete'](_0xa832('0x7'),auth['isAuthenticated'](),interaction[_0xa832('0xf')]('mail','mailinteraction:destroy'),controller[_0xa832('0x15')]);router[_0xa832('0x16')](_0xa832('0xe'),auth[_0xa832('0x6')](),controller[_0xa832('0x17')]);module[_0xa832('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3327b55..f797c3f 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 _0xfbc6=['TEXT','DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x4794a1,_0x1ae822){var _0x111a41=function(_0x3819c5){while(--_0x3819c5){_0x4794a1['push'](_0x4794a1['shift']());}};_0x111a41(++_0x1ae822);}(_0xfbc6,0x13c));var _0x6fbc=function(_0x5f0c5f,_0x1a58ae){_0x5f0c5f=_0x5f0c5f-0x0;var _0x2112e3=_0xfbc6[_0x5f0c5f];return _0x2112e3;};'use strict';var Sequelize=require(_0x6fbc('0x0'));var iconv=require('iconv');module[_0x6fbc('0x1')]={'closed':{'type':Sequelize[_0x6fbc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6fbc('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6fbc('0x3')]},'note':{'type':Sequelize[_0x6fbc('0x3')]},'inReplyTo':{'type':Sequelize[_0x6fbc('0x3')](0x1fe)},'to':{'type':Sequelize[_0x6fbc('0x3')]},'cc':{'type':Sequelize[_0x6fbc('0x4')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6fbc('0x5')]},'substatus':{'type':Sequelize[_0x6fbc('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x6fbc('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x6fbc('0x6')]('in',_0x6fbc('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6fbc('0x6')]('in',_0x6fbc('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6fbc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xce29=['STRING','TEXT','long','out','ENUM','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x203387,_0x25ee77){var _0x358e6b=function(_0xf5b2ff){while(--_0xf5b2ff){_0x203387['push'](_0x203387['shift']());}};_0x358e6b(++_0x25ee77);}(_0xce29,0x159));var _0x9ce2=function(_0x211116,_0x2c5740){_0x211116=_0x211116-0x0;var _0x5ccc07=_0xce29[_0x211116];return _0x5ccc07;};'use strict';var Sequelize=require(_0x9ce2('0x0'));var iconv=require(_0x9ce2('0x1'));module[_0x9ce2('0x2')]={'closed':{'type':Sequelize[_0x9ce2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ce2('0x4')]},'disposition':{'type':Sequelize[_0x9ce2('0x5')]},'secondDisposition':{'type':Sequelize[_0x9ce2('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x9ce2('0x5')](0x1fe)},'to':{'type':Sequelize[_0x9ce2('0x5')]},'cc':{'type':Sequelize[_0x9ce2('0x6')](_0x9ce2('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x9ce2('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9ce2('0x4')]},'substatus':{'type':Sequelize[_0x9ce2('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x9ce2('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9ce2('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9ce2('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9ce2('0x9')]('in',_0x9ce2('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 3579ba6..a7abeba 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 _0xe574=['attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','createdAt','get','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','plainBody','-id','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','map','MailInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','compact','isEmpty','MailAccountId','where','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','all','rows','show','params','options','create','body','describe','addMessage','ids','getMessages','MailInteractionId','format','inlineCss','true','addTags','setTags','omit','Tag','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp'];(function(_0x570af6,_0x2cc5b9){var _0x222bd6=function(_0x25ad3e){while(--_0x25ad3e){_0x570af6['push'](_0x570af6['shift']());}};_0x222bd6(++_0x2cc5b9);}(_0xe574,0x100));var _0x4e57=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe574[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x4e57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e57('0x1'));var moment=require(_0x4e57('0x2'));var BPromise=require(_0x4e57('0x3'));var util=require(_0x4e57('0x4'));var path=require(_0x4e57('0x5'));var fs=require('fs');var _=require(_0x4e57('0x6'));var squel=require(_0x4e57('0x7'));var juice=require(_0x4e57('0x8'));var Redis=require(_0x4e57('0x9'));var qs=require(_0x4e57('0xa'));var as=require(_0x4e57('0xb'));var logger=require(_0x4e57('0xc'))('api');var config=require('../../config/environment');var db=require(_0x4e57('0xd'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0x4e57('0xe')](config[_0x4e57('0xf')],{'host':_0x4e57('0x10'),'port':0x18eb});var socket=require(_0x4e57('0x11'))(new Redis(config[_0x4e57('0xf')]));require('./mailInteraction.socket')[_0x4e57('0x12')](socket);function respondWithStatusCode(_0x2dbdd5,_0x3393ce){_0x3393ce=_0x3393ce||0xcc;return function(_0x1e9cf8){if(_0x1e9cf8){return _0x2dbdd5[_0x4e57('0x13')](_0x3393ce);}return _0x2dbdd5[_0x4e57('0x14')](_0x3393ce)[_0x4e57('0x15')]();};}function respondWithResult(_0x21db21,_0xed8cbc){_0xed8cbc=_0xed8cbc||0xc8;return function(_0x40c8c8){if(_0x40c8c8){return _0x21db21[_0x4e57('0x14')](_0xed8cbc)[_0x4e57('0x16')](_0x40c8c8);}};}function respondWithFilteredResult(_0x1e3361,_0x1c1e8b){return function(_0x28f876){if(_0x28f876){var _0x2e9fa8=typeof _0x1c1e8b['offset']===_0x4e57('0x17')&&typeof _0x1c1e8b['limit']===_0x4e57('0x17');var _0x4af0a6=_0x28f876[_0x4e57('0x18')];var _0x214957=_0x2e9fa8?0x0:_0x1c1e8b['offset'];var _0x295d5f=_0x2e9fa8?_0x28f876[_0x4e57('0x18')]:_0x1c1e8b[_0x4e57('0x19')]+_0x1c1e8b[_0x4e57('0x1a')];var _0x5377cf;if(_0x295d5f>=_0x4af0a6){_0x295d5f=_0x4af0a6;_0x5377cf=0xc8;}else{_0x5377cf=0xce;}_0x1e3361[_0x4e57('0x14')](_0x5377cf);return _0x1e3361[_0x4e57('0x1b')](_0x4e57('0x1c'),_0x214957+'-'+_0x295d5f+'/'+_0x4af0a6)[_0x4e57('0x16')](_0x28f876);}return null;};}function saveUpdates(_0x1acce1){return function(_0x5b8760){if(_0x5b8760){return _0x5b8760[_0x4e57('0x1d')](_0x1acce1)[_0x4e57('0x1e')](function(_0x7cf030){return _0x7cf030;});}return null;};}function removeEntity(_0x43e77f){return function(_0x49c9cc){if(_0x49c9cc){return _0x49c9cc[_0x4e57('0x1f')]()['then'](function(){_0x43e77f[_0x4e57('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4586b3){return function(_0x4251e6){if(!_0x4251e6){_0x4586b3[_0x4e57('0x13')](0x194);}return _0x4251e6;};}function handleError(_0x43c9a7,_0x45f9cd){_0x45f9cd=_0x45f9cd||0x1f4;return function(_0x595bba){logger['error'](_0x595bba[_0x4e57('0x20')]);if(_0x595bba['name']){delete _0x595bba[_0x4e57('0x21')];}_0x43c9a7['status'](_0x45f9cd)[_0x4e57('0x22')](_0x595bba);};}function getInteractionUsers(_0x352051,_0x38bcaa){return new BPromise(function(_0x2477f8,_0x29df93){try{if(_0x38bcaa[_0x352051['id']]){_0x352051[_0x4e57('0x23')]=_['map'](_0x38bcaa[_0x352051['id']],function(_0x417105){return{'id':_0x417105['id'],'fullname':_0x417105[_0x4e57('0x24')]};});}}catch(_0x503eaa){_0x29df93(_0x503eaa);}_0x2477f8(_0x352051);});}function getInteractionTags(_0x36b415,_0x3001b7){return new BPromise(function(_0x24b9b5,_0x2ccc1f){try{if(_0x36b415[_0x4e57('0x25')]){_0x36b415[_0x4e57('0x26')]=[];_0x36b415[_0x4e57('0x25')]['split'](',')[_0x4e57('0x27')](function(_0x431794){_0x36b415[_0x4e57('0x26')][_0x4e57('0x28')](_0x3001b7[_0x431794]);});}delete _0x36b415[_0x4e57('0x25')];}catch(_0x5d55b9){_0x2ccc1f(_0x5d55b9);}_0x24b9b5(_0x36b415);});}function getLastMessageText(_0x56238e){return new BPromise(function(_0x1735ba,_0x59dd4e){return db[_0x4e57('0x29')][_0x4e57('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x56238e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4e57('0x2b')],'order':_0x4e57('0x2c'),'raw':!![]})[_0x4e57('0x1e')](function(_0x2540f7){if(_0x2540f7&&_0x2540f7[_0x4e57('0x2b')]){_0x56238e['lastMsgText']=_[_0x4e57('0x2d')](_0x2540f7[_0x4e57('0x2b')]);}_0x1735ba(_0x56238e);})['catch'](function(_0x149397){_0x59dd4e(_0x149397);});});}function updateMailInteraction(_0x486f33,_0x4d5817,_0x2e8916,_0x431c23){return new BPromise(function(_0x248ce2,_0x53d39b){return getInteractionUsers(_0x486f33,_0x2e8916)[_0x4e57('0x1e')](function(_0x581db8){return getInteractionTags(_0x581db8,_0x4d5817);})[_0x4e57('0x1e')](function(_0x1b2042){return getStateInteraction(_0x1b2042);})[_0x4e57('0x1e')](function(_0x5a3da5){if(_0x431c23){_0x248ce2(getLastMessageText(_0x5a3da5));}else{_0x248ce2(_0x5a3da5);}})[_0x4e57('0x2e')](function(_0x165df9){_0x53d39b(_0x165df9);});});}function getStateInteraction(_0x2773ee){return new BPromise(function(_0x407c94){_0x2773ee[_0x4e57('0x2f')]=0x0;_0x2773ee[_0x4e57('0x30')]=0x0;_0x2773ee[_0x4e57('0x31')]=0x0;_0x2773ee[_0x4e57('0x32')]=0x0;_0x2773ee[_0x4e57('0x33')]=0x0;if(!_0x2773ee[_0x4e57('0x34')]&&!_0x2773ee[_0x4e57('0x35')]){_0x2773ee['waiting']+=0x1;}if(!_0x2773ee[_0x4e57('0x34')]&&_0x2773ee['UserId']){_0x2773ee[_0x4e57('0x30')]+=0x1;if(_0x2773ee[_0x4e57('0x2f')]){_0x2773ee[_0x4e57('0x2f')]-=0x1;}}if(_0x2773ee[_0x4e57('0x34')]&&_0x2773ee['UserId']){_0x2773ee['answered']+=0x1;if(_0x2773ee[_0x4e57('0x30')]){_0x2773ee[_0x4e57('0x30')]-=0x1;}}if(_0x2773ee[_0x4e57('0x34')]&&!_0x2773ee[_0x4e57('0x35')]){_0x2773ee[_0x4e57('0x32')]+=0x1;if(_0x2773ee[_0x4e57('0x2f')]){_0x2773ee[_0x4e57('0x2f')]-=0x1;}}_0x2773ee[_0x4e57('0x33')]+=0x1;_0x407c94(_0x2773ee);});}exports[_0x4e57('0x36')]=function(_0x4ac448,_0x4231eb){var _0x5af6fc={},_0x118f50={},_0x1c976a={'count':0x0,'rows':[]};var _0x526ea6=_[_0x4e57('0x37')](db[_0x4e57('0x38')][_0x4e57('0x39')],function(_0x1a043e){return{'name':_0x1a043e[_0x4e57('0x3a')],'type':_0x1a043e[_0x4e57('0x3b')][_0x4e57('0x3c')]};});_0x118f50['model']=_[_0x4e57('0x37')](_0x526ea6,_0x4e57('0x21'));_0x118f50['query']=_[_0x4e57('0x3d')](_0x4ac448[_0x4e57('0x3e')]);_0x118f50[_0x4e57('0x3f')]=_[_0x4e57('0x40')](_0x118f50[_0x4e57('0x41')],_0x118f50[_0x4e57('0x3e')]);_0x5af6fc['attributes']=_[_0x4e57('0x40')](_0x118f50[_0x4e57('0x41')],qs[_0x4e57('0x42')](_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x42')]));_0x5af6fc[_0x4e57('0x43')]=_0x5af6fc[_0x4e57('0x43')]['length']?_0x5af6fc[_0x4e57('0x43')]:_0x118f50[_0x4e57('0x41')];if(!_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x44')](_0x4e57('0x45'))){_0x5af6fc['limit']=qs[_0x4e57('0x1a')](_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x1a')]);_0x5af6fc[_0x4e57('0x19')]=qs[_0x4e57('0x19')](_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x19')]);}_0x5af6fc[_0x4e57('0x46')]=qs[_0x4e57('0x47')](_0x4ac448[_0x4e57('0x3e')]['sort']);_0x5af6fc['where']=qs['filters'](_[_0x4e57('0x48')](_0x4ac448[_0x4e57('0x3e')],_0x118f50[_0x4e57('0x3f')]),_0x526ea6);var _0x206618=[];var _0x3f2029=squel[_0x4e57('0x49')]()[_0x4e57('0x4a')]('id')[_0x4e57('0x4a')](_0x4e57('0x21'))[_0x4e57('0x4a')](_0x4e57('0x4b'))[_0x4e57('0x4c')](_0x4e57('0x4d'));var _0x4954a3=squel[_0x4e57('0x49')]()[_0x4e57('0x4a')](_0x4e57('0x4e'))[_0x4e57('0x4a')](_0x4e57('0x4f'))[_0x4e57('0x4a')]('ui.MailInteractionId')[_0x4e57('0x4c')](_0x4e57('0x50'),'ui')[_0x4e57('0x51')](_0x4e57('0x52'),'u',_0x4e57('0x53'));var _0x3bacfb=squel[_0x4e57('0x49')]()[_0x4e57('0x4c')]('mail_interactions','i')[_0x4e57('0x51')]('cm_contacts','c',_0x4e57('0x54'))[_0x4e57('0x51')](_0x4e57('0x52'),'o','o.id\x20=\x20i.UserId')[_0x4e57('0x51')]('mail_accounts','a',_0x4e57('0x55'))[_0x4e57('0x51')](_0x4e57('0x56'),'me',_0x4e57('0x57'))[_0x4e57('0x51')](_0x4e57('0x58'),'it',_0x4e57('0x59'))['left_join']('tools_tags','t',_0x4e57('0x5a'));var _0x2e6a8f=squel[_0x4e57('0x5b')]();var _0x487bd7=[];var _0x4738fa=squel[_0x4e57('0x5b')]();var _0x1a54a2;if(_0x4ac448[_0x4e57('0x3e')]['search']){_0x1a54a2=as[_0x4e57('0x5c')](_0x4ac448['query']['search']);var _0xc1c632=_0x1a54a2[_0x4e57('0x5d')];for(var _0x36a84a=0x0;_0x36a84a<_0x1a54a2[_0x4e57('0x5e')][_0x4e57('0x5f')];_0x36a84a++){var _0x30588c=_0x1a54a2[_0x4e57('0x5e')][_0x36a84a];var _0x1c0e45='i';var _0x279383=_[_0x4e57('0x60')](_0x526ea6,[_0x4e57('0x21'),_0x30588c[_0x4e57('0x4a')]]);if(!_0x279383){switch(_0x30588c[_0x4e57('0x4a')]){case'unreadMessages':if(_0x30588c[_0x4e57('0x61')]==0x1){_0x3bacfb[_0x4e57('0x62')]('`'+_0x30588c[_0x4e57('0x4a')]+'`\x20=\x200');}else{_0x3bacfb[_0x4e57('0x62')]('`'+_0x30588c[_0x4e57('0x4a')]+_0x4e57('0x63'));}break;case _0x4e57('0x64'):if(_0x30588c[_0x4e57('0x65')]===_0x4e57('0x66')){if(_0x30588c[_0x4e57('0x61')][_0x4e57('0x67')]('\x20')[_0x4e57('0x5f')]>0x1){_0x2e6a8f[_0xc1c632]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4e57('0x68')](_0x30588c[_0x4e57('0x61')]),null);}else{var _0x18a28e='%'+_0x30588c[_0x4e57('0x61')]+'%';_0x2e6a8f[_0xc1c632](_0x4e57('0x69'),_0x18a28e,_0x18a28e,_0x18a28e);}}else{_0x279383=_[_0x4e57('0x60')](_0x526ea6,['name',_0x4e57('0x6a')]);_0x30588c[_0x4e57('0x4a')]=_0x4e57('0x6a');_0x56aab9=as[_0x4e57('0x6b')](_0x1c0e45,_0x279383[_0x4e57('0x3b')],_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x6d')],_0x56aab9['value'][_0x4e57('0x15')]);}break;case'Tag':var _0x44b5f6=_0x30588c[_0x4e57('0x61')][_0x4e57('0x67')](',')['map'](function(_0x59f1c2){return Number(_0x59f1c2);});_0x44b5f6[_0x4e57('0x27')](function(_0x5b6422){_0x4738fa['or'](_0x4e57('0x6e'),'%,'+_0x5b6422+',%');});_0x487bd7=_[_0x4e57('0x6f')](_0x487bd7,_0x44b5f6);break;case'User':if(_0x30588c[_0x4e57('0x65')]===_0x4e57('0x66')){_0x2e6a8f[_0xc1c632]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x30588c[_0x4e57('0x61')]+'%',null);}else{_0x279383=_[_0x4e57('0x60')](_0x526ea6,['name',_0x4e57('0x35')]);_0x30588c[_0x4e57('0x4a')]=_0x4e57('0x35');_0x56aab9=as[_0x4e57('0x6b')](_0x1c0e45,_0x279383[_0x4e57('0x3b')],_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9['value'][_0x4e57('0x6d')],_0x56aab9['value']['end']);}break;case'plainBody':_0x56aab9=as['buildExpression']('me',null,_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x6d')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x15')]);break;}}else{var _0x56aab9=as[_0x4e57('0x6b')](_0x1c0e45,_0x279383[_0x4e57('0x3b')],_0x30588c);_0x2e6a8f[_0xc1c632](_0x56aab9[_0x4e57('0x6c')],_0x56aab9[_0x4e57('0x61')][_0x4e57('0x6d')],_0x56aab9['value'][_0x4e57('0x15')]);}}}else{var _0x25b123=_(_0x4ac448[_0x4e57('0x3e')])[_0x4e57('0x3d')]()[_0x4e57('0x37')](function(_0x2a57e6){return _['some'](_0x526ea6,[_0x4e57('0x21'),_0x2a57e6])?_0x2a57e6:undefined;})[_0x4e57('0x70')]()['value']();if(!_[_0x4e57('0x71')](_0x25b123)){_0x25b123[_0x4e57('0x27')](function(_0x3ddaf8){if(_0x3ddaf8===_0x4e57('0x72')){_0x3bacfb[_0x4e57('0x73')]('i.MailAccountId\x20IN\x20?',[][_0x4e57('0x74')](_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8]));}else if(_0x3ddaf8==='createdAt'){var _0x2d5d11=JSON[_0x4e57('0x75')](_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8])[_0x4e57('0x76')];var _0x38e08a=JSON[_0x4e57('0x75')](_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8])[_0x4e57('0x77')];_0x3bacfb[_0x4e57('0x73')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2d5d11,_0x38e08a);}else{if(_0x4ac448[_0x4e57('0x3e')][_0x3ddaf8]===_0x4e57('0x78')){_0x3bacfb[_0x4e57('0x73')]('i.'+_0x3ddaf8+_0x4e57('0x79'));}else{_0x3bacfb[_0x4e57('0x73')]('i.'+_0x3ddaf8+_0x4e57('0x7a'),_0x4ac448['query'][_0x3ddaf8]);}}});}if(_0x4ac448[_0x4e57('0x3e')]['read']){if(_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x7b')]==0x1){_0x3bacfb['having'](_0x4e57('0x7c'));}else{_0x3bacfb['having'](_0x4e57('0x7d'));}}if(_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x7e')]){_0x487bd7=_[_0x4e57('0x7f')](_0x4ac448['query'][_0x4e57('0x7e')])?_0x4ac448[_0x4e57('0x3e')][_0x4e57('0x7e')]:new Array(_0x4ac448[_0x4e57('0x3e')]['tag']);_0x487bd7[_0x4e57('0x27')](function(_0x481f4f){_0x4738fa['or'](_0x4e57('0x6e'),'%,'+_0x481f4f+',%');});}if(_0x4ac448['query'][_0x4e57('0x80')]){var _0x19a8d2=_0x4ac448['query'][_0x4e57('0x80')][_0x4e57('0x81')]('\x5c','\x5c\x5c')[_0x4e57('0x81')](/'/g,'\x27\x27');if(qs[_0x4e57('0x82')](_0x19a8d2)){_0x2e6a8f['or'](_0x4e57('0x83'),_0x19a8d2+'%');}else if(qs['isEmail'](_0x19a8d2)){_0x2e6a8f['or'](_0x4e57('0x84'),_0x19a8d2+'%');}else{_0x2e6a8f['or'](_0x4e57('0x85'),qs[_0x4e57('0x68')](_0x19a8d2))['or'](_0x4e57('0x86'),qs[_0x4e57('0x68')](_0x19a8d2));}}}_0x3bacfb[_0x4e57('0x73')](_0x2e6a8f);_0x3bacfb[_0x4e57('0x87')](_0x4e57('0x88'));var _0x1d03ab={'type':db[_0x4e57('0x89')][_0x4e57('0x8a')][_0x4e57('0x8b')],'raw':!![]};var _0x605bfe=_0x3bacfb[_0x4e57('0x8c')]();_0x605bfe[_0x4e57('0x4a')](_0x4e57('0x88'));_0x605bfe[_0x4e57('0x4a')](_0x4e57('0x8d'),_0x4e57('0x8e'));if(_0x5af6fc[_0x4e57('0x46')]){_0x5af6fc[_0x4e57('0x46')][_0x4e57('0x27')](function(_0x4c48af){var _0x56cc80=_0x4c48af[0x0]===_0x4e57('0x8f')?_0x4c48af[0x0]:'i.'+_0x4c48af[0x0];_0x3bacfb[_0x4e57('0x46')](_0x56cc80,_0x4c48af[0x1]===_0x4e57('0x90')?![]:!![]);});}if(!_[_0x4e57('0x71')](_0x487bd7)){_0x3bacfb[_0x4e57('0x62')](_0x4738fa);_0x605bfe[_0x4e57('0x73')](_0x4e57('0x91'),_0x487bd7);}BPromise[_0x4e57('0x92')]()[_0x4e57('0x1e')](function(){if(!_0x1a54a2){if(_0x4ac448[_0x4e57('0x3e')]['MailAccountId'])return;_0x605bfe['where'](_0x4e57('0x93'));_0x3bacfb[_0x4e57('0x73')](_0x4e57('0x93'));return;}if(_0x4ac448[_0x4e57('0x94')][_0x4e57('0x95')]!==_0x4e57('0x96'))return;return _0x4ac448['user'][_0x4e57('0x97')]({'attributes':['id'],'raw':!![]})[_0x4e57('0x1e')](function(_0x1ddb8b){if(_[_0x4e57('0x71')](_0x1ddb8b)){_0x605bfe[_0x4e57('0x73')](_0x4e57('0x98'));_0x3bacfb['where'](_0x4e57('0x98'));}else{_0x605bfe[_0x4e57('0x73')](_0x4e57('0x99'),_[_0x4e57('0x37')](_0x1ddb8b,'id'));_0x3bacfb[_0x4e57('0x73')](_0x4e57('0x99'),_[_0x4e57('0x37')](_0x1ddb8b,'id'));}});})[_0x4e57('0x1e')](function(){if(_0x4ac448[_0x4e57('0x94')][_0x4e57('0x95')]===_0x4e57('0x96')&&!_0x1a54a2&&!_0x4ac448['query'][_0x4e57('0x72')])return[];return db['sequelize'][_0x4e57('0x3e')](_0x605bfe[_0x4e57('0x9a')](),_0x1d03ab);})['then'](function(_0x19b419){_0x1c976a[_0x4e57('0x18')]=_0x19b419[_0x4e57('0x5f')];if(_0x1c976a[_0x4e57('0x18')]===0x0)return[];return db[_0x4e57('0x9b')][_0x4e57('0x3e')](_0x3f2029['toString'](),_0x1d03ab)['then'](function(_0x5013d2){_0x206618=_[_0x4e57('0x9c')](_0x5013d2,'id');_0x1d03ab=_[_0x4e57('0x9d')](_0x1d03ab,{'model':db[_0x4e57('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ac448[_0x4e57('0x3e')]['fields']){_0x5af6fc[_0x4e57('0x43')][_0x4e57('0x27')](function(_0x4c3a38){_0x3bacfb[_0x4e57('0x4a')]('i.'+_0x4c3a38);});}else{_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0x8d'),_0x4e57('0x8e'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0x9e'),_0x4e57('0x9f'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa0'),_0x4e57('0xa1'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa2'),_0x4e57('0x8f'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0x88'));_0x3bacfb['field'](_0x4e57('0xa3'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa4'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa5'));_0x3bacfb[_0x4e57('0x4a')]('i.closedAt');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa6'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa7'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa8'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xa9'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xaa'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xab'));_0x3bacfb[_0x4e57('0x4a')]('i.thirdDisposition');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xac'));_0x3bacfb['field'](_0x4e57('0xad'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xae'));_0x3bacfb['field'](_0x4e57('0xaf'));_0x3bacfb[_0x4e57('0x4a')]('i.UserId');_0x3bacfb['field'](_0x4e57('0xb0'),'Contact.firstName');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb1'),'Contact.lastName');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb2'),'Contact.email');_0x3bacfb['field'](_0x4e57('0xb3'),_0x4e57('0xb4'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb5'),_0x4e57('0xb6'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb7'),_0x4e57('0xb8'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xb9'),_0x4e57('0xba'));_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xbb'),'Owner.internal');_0x3bacfb[_0x4e57('0x4a')](_0x4e57('0xbc'),_0x4e57('0x25'));}if(_0x5af6fc[_0x4e57('0x1a')])_0x3bacfb[_0x4e57('0x1a')](_0x5af6fc[_0x4e57('0x1a')]);if(_0x5af6fc['offset'])_0x3bacfb[_0x4e57('0x19')](_0x5af6fc[_0x4e57('0x19')]);return db[_0x4e57('0x9b')][_0x4e57('0x3e')](_0x3bacfb[_0x4e57('0x9a')](),_0x1d03ab);})[_0x4e57('0x1e')](function(_0x1b4fc4){if(_0x1b4fc4[_0x4e57('0x5f')]>0x0)_0x4954a3[_0x4e57('0x73')](_0x4e57('0xbd'),_[_0x4e57('0x37')](_0x1b4fc4,'id'));return db[_0x4e57('0x9b')][_0x4e57('0x3e')](_0x4954a3['toString'](),_0x1d03ab)[_0x4e57('0x1e')](function(_0x2f2c35){var _0x274627=_[_0x4e57('0xbe')](_0x2f2c35,'MailInteractionId');var _0x4d3dee=[];return db[_0x4e57('0xbf')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0x4e57('0x1e')](function(_0x1eaecb){var _0x415ef1=_0x1eaecb['enableEmailPreview'];_0x1b4fc4[_0x4e57('0x27')](function(_0x3de2d8){_0x4d3dee[_0x4e57('0x28')](updateMailInteraction(_0x3de2d8,_0x206618,_0x274627,_0x415ef1));});return BPromise[_0x4e57('0xc0')](_0x4d3dee);});});});})['then'](function(_0x1ba46d){_0x1c976a[_0x4e57('0xc1')]=_0x1ba46d;return _0x1c976a;})[_0x4e57('0x1e')](respondWithFilteredResult(_0x4231eb,_0x5af6fc))[_0x4e57('0x2e')](handleError(_0x4231eb,null));};exports[_0x4e57('0xc2')]=function(_0x496506,_0x1faaeb){var _0x1dbece={'raw':![],'where':{'id':_0x496506[_0x4e57('0xc3')]['id']}},_0x17d3b6={};_0x17d3b6[_0x4e57('0x41')]=_[_0x4e57('0x3d')](db[_0x4e57('0x38')][_0x4e57('0x39')]);_0x17d3b6[_0x4e57('0x3e')]=_['keys'](_0x496506['query']);_0x17d3b6[_0x4e57('0x3f')]=_['intersection'](_0x17d3b6[_0x4e57('0x41')],_0x17d3b6[_0x4e57('0x3e')]);_0x1dbece[_0x4e57('0x43')]=_[_0x4e57('0x40')](_0x17d3b6['model'],qs[_0x4e57('0x42')](_0x496506[_0x4e57('0x3e')]['fields']));_0x1dbece['attributes']=_0x1dbece[_0x4e57('0x43')][_0x4e57('0x5f')]?_0x1dbece[_0x4e57('0x43')]:_0x17d3b6[_0x4e57('0x41')];if(_0x496506[_0x4e57('0x3e')]['includeAll']){_0x1dbece['include']=[{'all':!![]}];}_0x1dbece=_[_0x4e57('0x9d')]({},_0x1dbece,_0x496506[_0x4e57('0xc4')]);return db[_0x4e57('0x38')]['find'](_0x1dbece)['then'](handleEntityNotFound(_0x1faaeb,null))[_0x4e57('0x1e')](respondWithResult(_0x1faaeb,null))['catch'](handleError(_0x1faaeb,null));};exports['create']=function(_0x20028d,_0x3f0f97){return db[_0x4e57('0x38')][_0x4e57('0xc5')](_0x20028d['body'],{})[_0x4e57('0x1e')](respondWithResult(_0x3f0f97,0xc9))['catch'](handleError(_0x3f0f97,null));};exports[_0x4e57('0x1d')]=function(_0x109404,_0x1d49d1){if(_0x109404[_0x4e57('0xc6')]['id']){delete _0x109404['body']['id'];}return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x109404[_0x4e57('0xc3')]['id']}})[_0x4e57('0x1e')](handleEntityNotFound(_0x1d49d1,null))[_0x4e57('0x1e')](saveUpdates(_0x109404[_0x4e57('0xc6')],null))['then'](respondWithResult(_0x1d49d1,null))['catch'](handleError(_0x1d49d1,null));};exports['destroy']=function(_0x4104f0,_0x564b40){return db['MailInteraction'][_0x4e57('0x60')]({'where':{'id':_0x4104f0[_0x4e57('0xc3')]['id']}})['then'](handleEntityNotFound(_0x564b40,null))[_0x4e57('0x1e')](removeEntity(_0x564b40,null))[_0x4e57('0x2e')](handleError(_0x564b40,null));};exports[_0x4e57('0xc7')]=function(_0x3b1153,_0x9c1a61){return db[_0x4e57('0x38')][_0x4e57('0xc7')]()[_0x4e57('0x1e')](respondWithResult(_0x9c1a61,null))['catch'](handleError(_0x9c1a61,null));};exports[_0x4e57('0xc8')]=function(_0x18ba79,_0x7ed2b4){return db['MailMessage'][_0x4e57('0x60')]({'where':{'id':_0x18ba79['params']['id']}})[_0x4e57('0x1e')](handleEntityNotFound(_0x7ed2b4,null))[_0x4e57('0x1e')](function(_0x292314){if(_0x292314){return _0x292314['addMessage'](_0x18ba79[_0x4e57('0xc6')]['ids'],_['omit'](_0x18ba79[_0x4e57('0xc6')],[_0x4e57('0xc9'),'id'])||{});}})[_0x4e57('0x1e')](respondWithResult(_0x7ed2b4,null))[_0x4e57('0x2e')](handleError(_0x7ed2b4,null));};exports[_0x4e57('0xca')]=function(_0x506dac,_0x4b1b24){var _0x1d415a={'raw':![],'where':{}};var _0x7d3cbd={};var _0x4f2379={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4e57('0x2a')]({'where':{'id':_0x506dac['params']['id']}})[_0x4e57('0x1e')](handleEntityNotFound(_0x4b1b24,null))[_0x4e57('0x1e')](function(_0xc8b69f){if(_0xc8b69f){_0x7d3cbd[_0x4e57('0x41')]=_[_0x4e57('0x3d')](db[_0x4e57('0x29')]['rawAttributes']);_0x7d3cbd['query']=_['keys'](_0x506dac['query']);_0x7d3cbd[_0x4e57('0x3f')]=_[_0x4e57('0x40')](_0x7d3cbd[_0x4e57('0x41')],_0x7d3cbd['query']);_0x1d415a[_0x4e57('0x43')]=_[_0x4e57('0x40')](_0x7d3cbd[_0x4e57('0x41')],qs[_0x4e57('0x42')](_0x506dac[_0x4e57('0x3e')][_0x4e57('0x42')]));_0x1d415a[_0x4e57('0x43')]=_0x1d415a['attributes'][_0x4e57('0x5f')]?_0x1d415a[_0x4e57('0x43')]:_0x7d3cbd[_0x4e57('0x41')];if(!_0x506dac[_0x4e57('0x3e')][_0x4e57('0x44')](_0x4e57('0x45'))){_0x1d415a[_0x4e57('0x1a')]=qs['limit'](_0x506dac[_0x4e57('0x3e')]['limit']);_0x1d415a[_0x4e57('0x19')]=qs['offset'](_0x506dac[_0x4e57('0x3e')][_0x4e57('0x19')]);}_0x1d415a['order']=qs[_0x4e57('0x47')](_0x506dac[_0x4e57('0x3e')][_0x4e57('0x47')]);_0x1d415a['where']=qs[_0x4e57('0x3f')](_[_0x4e57('0x48')](_0x506dac[_0x4e57('0x3e')],_0x7d3cbd['filters']));_0x1d415a[_0x4e57('0x73')][_0x4e57('0xcb')]=_0xc8b69f['id'];if(_0x506dac['query']['filter']){_0x1d415a[_0x4e57('0x73')]=_[_0x4e57('0x9d')](_0x1d415a[_0x4e57('0x73')],{'$or':_[_0x4e57('0x37')](_0x1d415a[_0x4e57('0x43')],function(_0x27b852){var _0x387c83={};_0x387c83[_0x27b852]={'$like':'%'+_0x506dac[_0x4e57('0x3e')][_0x4e57('0x80')]+'%'};return _0x387c83;})});}if(_0x506dac[_0x4e57('0x3e')]['$gte']){var _0x2d2b11=_0x506dac['query']['$gte']['split'](',');var _0x16782e={};_0x16782e[_0x2d2b11[0x0]]={'$gte':moment(_0x2d2b11[0x1])[_0x4e57('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d415a[_0x4e57('0x73')]=_[_0x4e57('0x9d')](_0x1d415a[_0x4e57('0x73')],_0x16782e);}_0x1d415a=_[_0x4e57('0x9d')]({},_0x1d415a,_0x506dac[_0x4e57('0xc4')]);return db[_0x4e57('0x29')][_0x4e57('0x18')]({'where':_0x1d415a[_0x4e57('0x73')]})[_0x4e57('0x1e')](function(_0xf2eb2b){_0x4f2379[_0x4e57('0x18')]=_0xf2eb2b;if(_0x506dac[_0x4e57('0x3e')]['includeAll']){_0x1d415a['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1d415a);})[_0x4e57('0x1e')](function(_0x4b4cc2){if(_0x506dac['query'][_0x4e57('0xcd')]===_0x4e57('0xce')){for(var _0x487df9=0x0;_0x487df9<_0x4b4cc2[_0x4e57('0x5f')];_0x487df9++){_0x4b4cc2[_0x487df9][_0x4e57('0xc6')]=juice(_0x4b4cc2[_0x487df9]['body']);}}_0x4f2379[_0x4e57('0xc1')]=_0x4b4cc2;return _0x4f2379;});}})[_0x4e57('0x1e')](respondWithFilteredResult(_0x4b1b24,_0x1d415a))['catch'](handleError(_0x4b1b24,null));};exports[_0x4e57('0xcf')]=function(_0x281249,_0x4e016d){return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x281249[_0x4e57('0xc3')]['id']}})['then'](handleEntityNotFound(_0x4e016d,null))['then'](function(_0x1f8f03){if(_0x1f8f03){return _0x1f8f03[_0x4e57('0xd0')](_0x281249[_0x4e57('0xc6')][_0x4e57('0xc9')],_[_0x4e57('0xd1')](_0x281249['body'],[_0x4e57('0xc9'),'id'])||{})['spread'](function(){return db[_0x4e57('0xd2')][_0x4e57('0xd3')]({'attributes':['id',_0x4e57('0x21'),_0x4e57('0x4b')],'where':{'id':_0x281249[_0x4e57('0xc6')]['ids']}});})[_0x4e57('0x1e')](function(_0x1c70de){socket[_0x4e57('0xd4')](_0x4e57('0xd5'),{'id':Number(_0x281249[_0x4e57('0xc3')]['id']),'tags':_0x1c70de||[]});return{'id':Number(_0x281249[_0x4e57('0xc3')]['id']),'tags':_0x1c70de||[]};});}})[_0x4e57('0x1e')](respondWithResult(_0x4e016d,null))['catch'](handleError(_0x4e016d,null));};exports[_0x4e57('0xd6')]=function(_0x312906,_0x329d08){return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x312906['params']['id']}})['then'](handleEntityNotFound(_0x329d08,null))[_0x4e57('0x1e')](function(_0x3fbc1e){if(_0x3fbc1e){return _0x3fbc1e[_0x4e57('0xd6')](_0x312906[_0x4e57('0x3e')]['ids']);}})[_0x4e57('0x1e')](respondWithStatusCode(_0x329d08,null))[_0x4e57('0x2e')](handleError(_0x329d08,null));};exports[_0x4e57('0xd7')]=function(_0x4ebdef,_0x11c5a0){var _0x743376=moment()[_0x4e57('0xd8')]()[_0x4e57('0x9a')]();var _0x47717f=path[_0x4e57('0xd9')](config[_0x4e57('0xda')],_0x4e57('0xdb'),_0x4e57('0xdc'),_0x4e57('0xdd'));var _0x22cc12=path[_0x4e57('0xd9')](config[_0x4e57('0xda')],_0x4e57('0xdb'),_0x4e57('0xdc'),_0x4e57('0xde'));var _0x162a05=path[_0x4e57('0xd9')](_0x47717f,_0x743376);var _0x5b83b2=util[_0x4e57('0xcc')](_0x4e57('0xdf'),_0x4ebdef[_0x4e57('0xc3')]['id'],_0x743376);var _0x13a847=path[_0x4e57('0xd9')](_0x47717f,_0x5b83b2);var _0x136656=[];if(_0x4ebdef[_0x4e57('0x3e')][_0x4e57('0xde')]){_0x136656[_0x4e57('0x28')]({'model':db[_0x4e57('0xe0')],'as':_0x4e57('0xe1'),'raw':!![]});}var _0x3ac4db=[{'model':db[_0x4e57('0x29')],'as':_0x4e57('0xe2'),'attributes':['id',_0x4e57('0xc6'),_0x4e57('0x4c'),'to','cc',_0x4e57('0xe3'),'subject',_0x4e57('0xe4')],'where':{'secret':![]},'order':qs[_0x4e57('0x47')]('id'),'include':_0x136656}];return db[_0x4e57('0x38')][_0x4e57('0x60')]({'where':{'id':_0x4ebdef[_0x4e57('0xc3')]['id']},'include':_0x3ac4db})['then'](handleEntityNotFound(_0x11c5a0,null))['then'](function(_0x408437){if(_0x408437&&_0x408437[_0x4e57('0xe2')]){var _0x199d3d=_0x408437[_0x4e57('0xe5')]({'plain':!![]});fs['mkdirSync'](_0x162a05);return BPromise[_0x4e57('0xe6')](_0x199d3d[_0x4e57('0xe2')],function(_0x5c2bab,_0x304b8f){var _0x49be82={'from':_0x5c2bab[_0x4e57('0x4c')],'to':_0x5c2bab['to'],'subject':_0x5c2bab[_0x4e57('0xe7')],'html':htmlEntities['decode'](_0x5c2bab[_0x4e57('0xc6')]),'headers':{'Date':moment(_0x5c2bab[_0x4e57('0xe4')])[_0x4e57('0xcc')](_0x4e57('0xe8'))},'attachments':[]};if(_0x5c2bab['cc']){_0x49be82[_0x4e57('0xe9')]['Cc']=_0x5c2bab['cc'];}if(_0x5c2bab['bcc']){_0x49be82[_0x4e57('0xe9')]['Bcc']=_0x5c2bab[_0x4e57('0xe3')];}return new BPromise(function(_0x1110b1,_0xaedcc2){if(_0x5c2bab[_0x4e57('0xe1')]){for(var _0x1625d1=0x0;_0x1625d1<_0x5c2bab['Attachments'][_0x4e57('0x5f')];_0x1625d1++){var _0x1d548a=_0x5c2bab['Attachments'][_0x1625d1];var _0xcb2f07=path[_0x4e57('0xd9')](_0x22cc12,_0x1d548a[_0x4e57('0xea')]);if(fs[_0x4e57('0xeb')](_0xcb2f07)){_0x49be82[_0x4e57('0xde')]['push']({'name':_0x1d548a[_0x4e57('0x21')],'contentType':_0x1d548a[_0x4e57('0x3b')],'data':fs[_0x4e57('0xec')](_0xcb2f07)});}}}emlformat['build'](_0x49be82,function(_0x25459a,_0x112270){if(_0x25459a)return _0xaedcc2(_0x25459a);fs[_0x4e57('0xed')](path['join'](_0x162a05,util[_0x4e57('0xcc')]('message%d.eml',_0x304b8f)),_0x112270);return _0x1110b1(_0x112270);});});})['then'](function(){return new BPromise(function(_0x4a39a6,_0x47ef2f){zipdir(_0x162a05,{'saveTo':_0x13a847},function(_0x2d7b7f,_0xf8dac1){if(_0x2d7b7f)return _0x47ef2f(_0x2d7b7f);return _0x4a39a6(_0xf8dac1);});})[_0x4e57('0x1e')](function(){return new BPromise(function(_0x5d9378,_0x4f2572){rimraf(_0x162a05,function(_0x51d470){if(_0x51d470)_0x4f2572(_0x51d470);return _0x5d9378();});});})[_0x4e57('0x1e')](function(){return _0x11c5a0[_0x4e57('0xd7')](_0x13a847,_0x5b83b2,function(_0x1b4772){if(!_0x1b4772)fs[_0x4e57('0xee')](_0x13a847);});});});}else{return _0x11c5a0['sendStatus'](0xc8);}})[_0x4e57('0x2e')](handleError(_0x11c5a0,null));}; \ No newline at end of file +var _0x8c46=['ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','keys','some','compact','isEmpty','MailAccountId','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','rows','show','params','rawAttributes','includeAll','create','body','describe','addMessage','ids','omit','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','inlineCss','true','setTags','spread','emit','removeTags','unix','root','server','files','tmp','join','attachments','format','Attachment','Attachments','bcc','createdAt','Messages','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','moment','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','MailInteraction','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','having','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c46,0x171));var _0x68c4=function(_0x2e5e9f,_0x56933f){_0x2e5e9f=_0x2e5e9f-0x0;var _0x45036b=_0x8c46[_0x2e5e9f];return _0x45036b;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x68c4('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x68c4('0x2'));var fs=require('fs');var _=require(_0x68c4('0x3'));var squel=require(_0x68c4('0x4'));var juice=require(_0x68c4('0x5'));var Redis=require(_0x68c4('0x6'));var qs=require(_0x68c4('0x7'));var as=require(_0x68c4('0x8'));var logger=require(_0x68c4('0x9'))(_0x68c4('0xa'));var config=require(_0x68c4('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x68c4('0xc'));config[_0x68c4('0xd')]=_[_0x68c4('0xe')](config['redis'],{'host':_0x68c4('0xf'),'port':0x18eb});var socket=require(_0x68c4('0x10'))(new Redis(config[_0x68c4('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3f44f0,_0x2a8c08){_0x2a8c08=_0x2a8c08||0xcc;return function(_0x50b161){if(_0x50b161){return _0x3f44f0['sendStatus'](_0x2a8c08);}return _0x3f44f0[_0x68c4('0x11')](_0x2a8c08)[_0x68c4('0x12')]();};}function respondWithResult(_0x2796c8,_0x48783b){_0x48783b=_0x48783b||0xc8;return function(_0x3a432a){if(_0x3a432a){return _0x2796c8[_0x68c4('0x11')](_0x48783b)[_0x68c4('0x13')](_0x3a432a);}};}function respondWithFilteredResult(_0x56e361,_0x11eb66){return function(_0x14919c){if(_0x14919c){var _0x5e1341=typeof _0x11eb66['offset']===_0x68c4('0x14')&&typeof _0x11eb66[_0x68c4('0x15')]==='undefined';var _0xc25f7b=_0x14919c['count'];var _0x1a7045=_0x5e1341?0x0:_0x11eb66['offset'];var _0x5497bf=_0x5e1341?_0x14919c[_0x68c4('0x16')]:_0x11eb66[_0x68c4('0x17')]+_0x11eb66['limit'];var _0x2d6c1b;if(_0x5497bf>=_0xc25f7b){_0x5497bf=_0xc25f7b;_0x2d6c1b=0xc8;}else{_0x2d6c1b=0xce;}_0x56e361[_0x68c4('0x11')](_0x2d6c1b);return _0x56e361[_0x68c4('0x18')](_0x68c4('0x19'),_0x1a7045+'-'+_0x5497bf+'/'+_0xc25f7b)[_0x68c4('0x13')](_0x14919c);}return null;};}function saveUpdates(_0x10f0a7){return function(_0x334e40){if(_0x334e40){return _0x334e40[_0x68c4('0x1a')](_0x10f0a7)[_0x68c4('0x1b')](function(_0x3befda){return _0x3befda;});}return null;};}function removeEntity(_0x29cb55){return function(_0x58f87d){if(_0x58f87d){return _0x58f87d[_0x68c4('0x1c')]()['then'](function(){_0x29cb55['status'](0xcc)[_0x68c4('0x12')]();});}};}function handleEntityNotFound(_0x1355f1){return function(_0x154897){if(!_0x154897){_0x1355f1[_0x68c4('0x1d')](0x194);}return _0x154897;};}function handleError(_0x5b8135,_0x35e865){_0x35e865=_0x35e865||0x1f4;return function(_0x310bc6){logger['error'](_0x310bc6[_0x68c4('0x1e')]);if(_0x310bc6[_0x68c4('0x1f')]){delete _0x310bc6[_0x68c4('0x1f')];}_0x5b8135[_0x68c4('0x11')](_0x35e865)[_0x68c4('0x20')](_0x310bc6);};}function getInteractionUsers(_0x20e78b,_0x37e9a9){return new BPromise(function(_0x505db4,_0x2ff4a5){try{if(_0x37e9a9[_0x20e78b['id']]){_0x20e78b['Users']=_[_0x68c4('0x21')](_0x37e9a9[_0x20e78b['id']],function(_0x10c67e){return{'id':_0x10c67e['id'],'fullname':_0x10c67e[_0x68c4('0x22')]};});}}catch(_0x4f9d32){_0x2ff4a5(_0x4f9d32);}_0x505db4(_0x20e78b);});}function getInteractionTags(_0x1e14db,_0x126064){return new BPromise(function(_0x496f4d,_0x31e177){try{if(_0x1e14db[_0x68c4('0x23')]){_0x1e14db[_0x68c4('0x24')]=[];_0x1e14db[_0x68c4('0x23')]['split'](',')[_0x68c4('0x25')](function(_0x4b4634){_0x1e14db[_0x68c4('0x24')][_0x68c4('0x26')](_0x126064[_0x4b4634]);});}delete _0x1e14db['TagIds'];}catch(_0x2847d1){_0x31e177(_0x2847d1);}_0x496f4d(_0x1e14db);});}function getLastMessageText(_0x3a5627){return new BPromise(function(_0x48e4bd,_0x29ef9d){return db[_0x68c4('0x27')][_0x68c4('0x28')]({'where':{'$and':[{'MailInteractionId':_0x3a5627['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x68c4('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x68c4('0x2a')],'order':_0x68c4('0x2b'),'raw':!![]})[_0x68c4('0x1b')](function(_0x319de8){if(_0x319de8&&_0x319de8[_0x68c4('0x2a')]){_0x3a5627[_0x68c4('0x2c')]=_[_0x68c4('0x2d')](_0x319de8[_0x68c4('0x2a')]);}_0x48e4bd(_0x3a5627);})[_0x68c4('0x2e')](function(_0x1ad882){_0x29ef9d(_0x1ad882);});});}function updateMailInteraction(_0x3ce082,_0x3a3a75,_0x33fcc7,_0x106d6e){return new BPromise(function(_0x4837b4,_0x1299fc){return getInteractionUsers(_0x3ce082,_0x33fcc7)[_0x68c4('0x1b')](function(_0x25eeea){return getInteractionTags(_0x25eeea,_0x3a3a75);})[_0x68c4('0x1b')](function(_0x352db9){return getStateInteraction(_0x352db9);})['then'](function(_0x32fef0){if(_0x106d6e){_0x4837b4(getLastMessageText(_0x32fef0));}else{_0x4837b4(_0x32fef0);}})['catch'](function(_0x586e9c){_0x1299fc(_0x586e9c);});});}function getStateInteraction(_0x4dcd5b){return new BPromise(function(_0xb86553){_0x4dcd5b[_0x68c4('0x2f')]=0x0;_0x4dcd5b[_0x68c4('0x30')]=0x0;_0x4dcd5b[_0x68c4('0x31')]=0x0;_0x4dcd5b['unmanaged']=0x0;_0x4dcd5b[_0x68c4('0x32')]=0x0;if(!_0x4dcd5b[_0x68c4('0x33')]&&!_0x4dcd5b[_0x68c4('0x34')]){_0x4dcd5b['waiting']+=0x1;}if(!_0x4dcd5b[_0x68c4('0x33')]&&_0x4dcd5b[_0x68c4('0x34')]){_0x4dcd5b[_0x68c4('0x30')]+=0x1;if(_0x4dcd5b[_0x68c4('0x2f')]){_0x4dcd5b[_0x68c4('0x2f')]-=0x1;}}if(_0x4dcd5b[_0x68c4('0x33')]&&_0x4dcd5b[_0x68c4('0x34')]){_0x4dcd5b[_0x68c4('0x31')]+=0x1;if(_0x4dcd5b[_0x68c4('0x30')]){_0x4dcd5b[_0x68c4('0x30')]-=0x1;}}if(_0x4dcd5b['closed']&&!_0x4dcd5b['UserId']){_0x4dcd5b[_0x68c4('0x35')]+=0x1;if(_0x4dcd5b[_0x68c4('0x2f')]){_0x4dcd5b[_0x68c4('0x2f')]-=0x1;}}_0x4dcd5b[_0x68c4('0x32')]+=0x1;_0xb86553(_0x4dcd5b);});}exports[_0x68c4('0x36')]=function(_0x13386d,_0x49cc23){var _0x199645={},_0x2cd597={},_0x3f6d18={'count':0x0,'rows':[]};var _0xe8cc5b=_[_0x68c4('0x21')](db[_0x68c4('0x37')]['rawAttributes'],function(_0x5c78fb){return{'name':_0x5c78fb[_0x68c4('0x38')],'type':_0x5c78fb[_0x68c4('0x39')][_0x68c4('0x3a')]};});_0x2cd597[_0x68c4('0x3b')]=_['map'](_0xe8cc5b,_0x68c4('0x1f'));_0x2cd597[_0x68c4('0x3c')]=_['keys'](_0x13386d['query']);_0x2cd597['filters']=_[_0x68c4('0x3d')](_0x2cd597['model'],_0x2cd597[_0x68c4('0x3c')]);_0x199645['attributes']=_[_0x68c4('0x3d')](_0x2cd597[_0x68c4('0x3b')],qs[_0x68c4('0x3e')](_0x13386d[_0x68c4('0x3c')]['fields']));_0x199645[_0x68c4('0x3f')]=_0x199645[_0x68c4('0x3f')][_0x68c4('0x40')]?_0x199645[_0x68c4('0x3f')]:_0x2cd597['model'];if(!_0x13386d[_0x68c4('0x3c')][_0x68c4('0x41')](_0x68c4('0x42'))){_0x199645[_0x68c4('0x15')]=qs[_0x68c4('0x15')](_0x13386d['query']['limit']);_0x199645['offset']=qs[_0x68c4('0x17')](_0x13386d[_0x68c4('0x3c')][_0x68c4('0x17')]);}_0x199645[_0x68c4('0x43')]=qs['sort'](_0x13386d[_0x68c4('0x3c')][_0x68c4('0x44')]);_0x199645[_0x68c4('0x45')]=qs[_0x68c4('0x46')](_[_0x68c4('0x47')](_0x13386d[_0x68c4('0x3c')],_0x2cd597[_0x68c4('0x46')]),_0xe8cc5b);var _0x5b8209=[];var _0x469f99=squel[_0x68c4('0x48')]()[_0x68c4('0x49')]('id')['field'](_0x68c4('0x1f'))['field'](_0x68c4('0x4a'))[_0x68c4('0x4b')](_0x68c4('0x4c'));var _0x984082=squel['select']()[_0x68c4('0x49')]('u.id')[_0x68c4('0x49')](_0x68c4('0x4d'))['field'](_0x68c4('0x4e'))[_0x68c4('0x4b')](_0x68c4('0x4f'),'ui')[_0x68c4('0x50')](_0x68c4('0x51'),'u',_0x68c4('0x52'));var _0x519ddb=squel[_0x68c4('0x48')]()[_0x68c4('0x4b')](_0x68c4('0x53'),'i')[_0x68c4('0x50')]('cm_contacts','c',_0x68c4('0x54'))[_0x68c4('0x50')](_0x68c4('0x51'),'o',_0x68c4('0x55'))[_0x68c4('0x50')](_0x68c4('0x56'),'a','a.id\x20=\x20i.MailAccountId')[_0x68c4('0x50')](_0x68c4('0x57'),'me',_0x68c4('0x58'))['left_join'](_0x68c4('0x59'),'it',_0x68c4('0x5a'))['left_join']('tools_tags','t',_0x68c4('0x5b'));var _0x1e412f=squel[_0x68c4('0x5c')]();var _0x31eda2=[];var _0x395f29=squel[_0x68c4('0x5c')]();var _0x2b5615;if(_0x13386d[_0x68c4('0x3c')]['search']){_0x2b5615=as[_0x68c4('0x5d')](_0x13386d['query']['search']);var _0x4e1352=_0x2b5615[_0x68c4('0x5e')];for(var _0x117408=0x0;_0x117408<_0x2b5615[_0x68c4('0x5f')]['length'];_0x117408++){var _0x39b3c2=_0x2b5615[_0x68c4('0x5f')][_0x117408];var _0x55466b='i';var _0x35faf1=_['find'](_0xe8cc5b,[_0x68c4('0x1f'),_0x39b3c2['field']]);if(!_0x35faf1){switch(_0x39b3c2[_0x68c4('0x49')]){case _0x68c4('0x60'):if(_0x39b3c2['value']==0x1){_0x519ddb[_0x68c4('0x61')]('`'+_0x39b3c2[_0x68c4('0x49')]+'`\x20=\x200');}else{_0x519ddb[_0x68c4('0x61')]('`'+_0x39b3c2[_0x68c4('0x49')]+'`\x20>\x200');}break;case _0x68c4('0x62'):if(_0x39b3c2[_0x68c4('0x63')]===_0x68c4('0x64')){if(_0x39b3c2[_0x68c4('0x65')][_0x68c4('0x66')]('\x20')[_0x68c4('0x40')]>0x1){_0x1e412f[_0x4e1352](_0x68c4('0x67'),qs[_0x68c4('0x68')](_0x39b3c2[_0x68c4('0x65')]),null);}else{var _0x52aa52='%'+_0x39b3c2[_0x68c4('0x65')]+'%';_0x1e412f[_0x4e1352](_0x68c4('0x69'),_0x52aa52,_0x52aa52,_0x52aa52);}}else{_0x35faf1=_[_0x68c4('0x6a')](_0xe8cc5b,[_0x68c4('0x1f'),_0x68c4('0x6b')]);_0x39b3c2[_0x68c4('0x49')]=_0x68c4('0x6b');_0x490bed=as['buildExpression'](_0x55466b,_0x35faf1['type'],_0x39b3c2);_0x1e412f[_0x4e1352](_0x490bed[_0x68c4('0x6c')],_0x490bed[_0x68c4('0x65')]['start'],_0x490bed[_0x68c4('0x65')][_0x68c4('0x12')]);}break;case _0x68c4('0x6d'):var _0x1bde7a=_0x39b3c2[_0x68c4('0x65')][_0x68c4('0x66')](',')['map'](function(_0x452b25){return Number(_0x452b25);});_0x1bde7a[_0x68c4('0x25')](function(_0xce205c){_0x395f29['or'](_0x68c4('0x6e'),'%,'+_0xce205c+',%');});_0x31eda2=_[_0x68c4('0x6f')](_0x31eda2,_0x1bde7a);break;case'User':if(_0x39b3c2['operator']===_0x68c4('0x64')){_0x1e412f[_0x4e1352](_0x68c4('0x70'),'%'+_0x39b3c2[_0x68c4('0x65')]+'%',null);}else{_0x35faf1=_[_0x68c4('0x6a')](_0xe8cc5b,[_0x68c4('0x1f'),'UserId']);_0x39b3c2[_0x68c4('0x49')]=_0x68c4('0x34');_0x490bed=as[_0x68c4('0x71')](_0x55466b,_0x35faf1[_0x68c4('0x39')],_0x39b3c2);_0x1e412f[_0x4e1352](_0x490bed[_0x68c4('0x6c')],_0x490bed[_0x68c4('0x65')][_0x68c4('0x72')],_0x490bed[_0x68c4('0x65')][_0x68c4('0x12')]);}break;case _0x68c4('0x2a'):_0x490bed=as['buildExpression']('me',null,_0x39b3c2);_0x1e412f[_0x4e1352](_0x490bed[_0x68c4('0x6c')],_0x490bed['value'][_0x68c4('0x72')],_0x490bed[_0x68c4('0x65')][_0x68c4('0x12')]);break;}}else{var _0x490bed=as[_0x68c4('0x71')](_0x55466b,_0x35faf1['type'],_0x39b3c2);_0x1e412f[_0x4e1352](_0x490bed[_0x68c4('0x6c')],_0x490bed[_0x68c4('0x65')][_0x68c4('0x72')],_0x490bed[_0x68c4('0x65')][_0x68c4('0x12')]);}}}else{var _0x4a3d74=_(_0x13386d[_0x68c4('0x3c')])[_0x68c4('0x73')]()[_0x68c4('0x21')](function(_0x8e291){return _[_0x68c4('0x74')](_0xe8cc5b,['name',_0x8e291])?_0x8e291:undefined;})[_0x68c4('0x75')]()[_0x68c4('0x65')]();if(!_[_0x68c4('0x76')](_0x4a3d74)){_0x4a3d74['forEach'](function(_0x46f828){if(_0x46f828===_0x68c4('0x77')){_0x519ddb[_0x68c4('0x45')]('i.MailAccountId\x20IN\x20?',[][_0x68c4('0x78')](_0x13386d['query'][_0x46f828]));}else if(_0x46f828==='createdAt'){var _0x43af21=JSON[_0x68c4('0x79')](_0x13386d[_0x68c4('0x3c')][_0x46f828])['$gte'];var _0x5b5353=JSON[_0x68c4('0x79')](_0x13386d[_0x68c4('0x3c')][_0x46f828])['$lte'];_0x519ddb[_0x68c4('0x45')](_0x68c4('0x7a'),_0x43af21,_0x5b5353);}else{if(_0x13386d['query'][_0x46f828]==='null'){_0x519ddb[_0x68c4('0x45')]('i.'+_0x46f828+_0x68c4('0x7b'));}else{_0x519ddb[_0x68c4('0x45')]('i.'+_0x46f828+_0x68c4('0x7c'),_0x13386d['query'][_0x46f828]);}}});}if(_0x13386d[_0x68c4('0x3c')]['read']){if(_0x13386d[_0x68c4('0x3c')][_0x68c4('0x7d')]==0x1){_0x519ddb[_0x68c4('0x61')](_0x68c4('0x7e'));}else{_0x519ddb[_0x68c4('0x61')](_0x68c4('0x7f'));}}if(_0x13386d[_0x68c4('0x3c')][_0x68c4('0x80')]){_0x31eda2=_['isArray'](_0x13386d[_0x68c4('0x3c')]['tag'])?_0x13386d[_0x68c4('0x3c')][_0x68c4('0x80')]:new Array(_0x13386d[_0x68c4('0x3c')][_0x68c4('0x80')]);_0x31eda2[_0x68c4('0x25')](function(_0x39c3e8){_0x395f29['or'](_0x68c4('0x6e'),'%,'+_0x39c3e8+',%');});}if(_0x13386d[_0x68c4('0x3c')][_0x68c4('0x81')]){var _0x227358=_0x13386d[_0x68c4('0x3c')][_0x68c4('0x81')][_0x68c4('0x82')]('\x5c','\x5c\x5c')[_0x68c4('0x82')](/'/g,'\x27\x27');if(qs[_0x68c4('0x83')](_0x227358)){_0x1e412f['or'](_0x68c4('0x84'),_0x227358+'%');}else if(qs[_0x68c4('0x85')](_0x227358)){_0x1e412f['or'](_0x68c4('0x86'),_0x227358+'%');}else{_0x1e412f['or'](_0x68c4('0x87'),qs[_0x68c4('0x68')](_0x227358))['or'](_0x68c4('0x88'),qs[_0x68c4('0x68')](_0x227358));}}}_0x519ddb[_0x68c4('0x45')](_0x1e412f);_0x519ddb[_0x68c4('0x89')](_0x68c4('0x8a'));var _0x5c75cd={'type':db[_0x68c4('0x8b')][_0x68c4('0x8c')]['SELECT'],'raw':!![]};var _0x28b130=_0x519ddb[_0x68c4('0x8d')]();_0x28b130['field'](_0x68c4('0x8a'));_0x28b130[_0x68c4('0x49')](_0x68c4('0x8e'),_0x68c4('0x60'));if(_0x199645[_0x68c4('0x43')]){_0x199645[_0x68c4('0x43')][_0x68c4('0x25')](function(_0x497956){var _0x15e681=_0x497956[0x0]===_0x68c4('0x8f')?_0x497956[0x0]:'i.'+_0x497956[0x0];_0x519ddb[_0x68c4('0x43')](_0x15e681,_0x497956[0x1]===_0x68c4('0x90')?![]:!![]);});}if(!_[_0x68c4('0x76')](_0x31eda2)){_0x519ddb['having'](_0x395f29);_0x28b130['where'](_0x68c4('0x91'),_0x31eda2);}BPromise[_0x68c4('0x92')]()[_0x68c4('0x1b')](function(){if(!_0x2b5615){if(_0x13386d[_0x68c4('0x3c')][_0x68c4('0x77')])return;_0x28b130[_0x68c4('0x45')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x519ddb[_0x68c4('0x45')](_0x68c4('0x93'));return;}if(_0x13386d['user'][_0x68c4('0x94')]!==_0x68c4('0x95'))return;return _0x13386d[_0x68c4('0x96')][_0x68c4('0x97')]({'attributes':['id'],'raw':!![]})[_0x68c4('0x1b')](function(_0x3aebef){if(_[_0x68c4('0x76')](_0x3aebef)){_0x28b130[_0x68c4('0x45')](_0x68c4('0x98'));_0x519ddb[_0x68c4('0x45')](_0x68c4('0x98'));}else{_0x28b130[_0x68c4('0x45')](_0x68c4('0x99'),_[_0x68c4('0x21')](_0x3aebef,'id'));_0x519ddb[_0x68c4('0x45')]('i.MailAccountId\x20IN\x20?',_[_0x68c4('0x21')](_0x3aebef,'id'));}});})[_0x68c4('0x1b')](function(){if(_0x13386d[_0x68c4('0x96')]['role']==='agent'&&!_0x2b5615&&!_0x13386d[_0x68c4('0x3c')][_0x68c4('0x77')])return[];return db['sequelize'][_0x68c4('0x3c')](_0x28b130[_0x68c4('0x9a')](),_0x5c75cd);})[_0x68c4('0x1b')](function(_0x141acd){_0x3f6d18['count']=_0x141acd[_0x68c4('0x40')];if(_0x3f6d18[_0x68c4('0x16')]===0x0)return[];return db[_0x68c4('0x9b')][_0x68c4('0x3c')](_0x469f99['toString'](),_0x5c75cd)[_0x68c4('0x1b')](function(_0x1c7475){_0x5b8209=_[_0x68c4('0x9c')](_0x1c7475,'id');_0x5c75cd=_[_0x68c4('0x9d')](_0x5c75cd,{'model':db[_0x68c4('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13386d[_0x68c4('0x3c')][_0x68c4('0x3e')]){_0x199645[_0x68c4('0x3f')]['forEach'](function(_0x5cbe63){_0x519ddb[_0x68c4('0x49')]('i.'+_0x5cbe63);});}else{_0x519ddb[_0x68c4('0x49')](_0x68c4('0x8e'),_0x68c4('0x60'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0x9e'),_0x68c4('0x9f'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa0'),_0x68c4('0xa1'));_0x519ddb['field'](_0x68c4('0xa2'),_0x68c4('0x8f'));_0x519ddb['field'](_0x68c4('0x8a'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa3'));_0x519ddb['field'](_0x68c4('0xa4'));_0x519ddb[_0x68c4('0x49')]('i.closed');_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa5'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa6'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa7'));_0x519ddb[_0x68c4('0x49')]('i.lastMsgDirection');_0x519ddb[_0x68c4('0x49')]('i.subject');_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa8'));_0x519ddb[_0x68c4('0x49')]('i.secondDisposition');_0x519ddb[_0x68c4('0x49')](_0x68c4('0xa9'));_0x519ddb['field'](_0x68c4('0xaa'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xab'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xac'));_0x519ddb['field'](_0x68c4('0xad'));_0x519ddb[_0x68c4('0x49')]('i.UserId');_0x519ddb[_0x68c4('0x49')](_0x68c4('0xae'),_0x68c4('0xaf'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xb0'),'Contact.lastName');_0x519ddb[_0x68c4('0x49')](_0x68c4('0xb1'),_0x68c4('0xb2'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xb3'),'Contact.phone');_0x519ddb['field'](_0x68c4('0xb4'),'Contact.mobile');_0x519ddb[_0x68c4('0x49')](_0x68c4('0xb5'),_0x68c4('0xb6'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xb7'),_0x68c4('0xb8'));_0x519ddb[_0x68c4('0x49')](_0x68c4('0xb9'),_0x68c4('0xba'));_0x519ddb['field'](_0x68c4('0xbb'),_0x68c4('0x23'));}if(_0x199645[_0x68c4('0x15')])_0x519ddb[_0x68c4('0x15')](_0x199645[_0x68c4('0x15')]);if(_0x199645['offset'])_0x519ddb['offset'](_0x199645[_0x68c4('0x17')]);return db[_0x68c4('0x9b')][_0x68c4('0x3c')](_0x519ddb[_0x68c4('0x9a')](),_0x5c75cd);})[_0x68c4('0x1b')](function(_0xdca4c0){if(_0xdca4c0[_0x68c4('0x40')]>0x0)_0x984082[_0x68c4('0x45')](_0x68c4('0xbc'),_['map'](_0xdca4c0,'id'));return db[_0x68c4('0x9b')][_0x68c4('0x3c')](_0x984082[_0x68c4('0x9a')](),_0x5c75cd)[_0x68c4('0x1b')](function(_0xe647ec){var _0x1aea35=_['groupBy'](_0xe647ec,_0x68c4('0xbd'));var _0xa63e5b=[];return db[_0x68c4('0xbe')][_0x68c4('0x28')]({'attributes':[_0x68c4('0xbf')],'raw':!![]})[_0x68c4('0x1b')](function(_0x2798a8){var _0x3d3d64=_0x2798a8[_0x68c4('0xbf')];_0xdca4c0[_0x68c4('0x25')](function(_0x1af896){_0xa63e5b[_0x68c4('0x26')](updateMailInteraction(_0x1af896,_0x5b8209,_0x1aea35,_0x3d3d64));});return BPromise['all'](_0xa63e5b);});});});})[_0x68c4('0x1b')](function(_0x20ff8a){_0x3f6d18[_0x68c4('0xc0')]=_0x20ff8a;return _0x3f6d18;})[_0x68c4('0x1b')](respondWithFilteredResult(_0x49cc23,_0x199645))[_0x68c4('0x2e')](handleError(_0x49cc23,null));};exports[_0x68c4('0xc1')]=function(_0x42c4f1,_0x340b8a){var _0x24072f={'raw':![],'where':{'id':_0x42c4f1[_0x68c4('0xc2')]['id']}},_0x453de3={};_0x453de3[_0x68c4('0x3b')]=_[_0x68c4('0x73')](db['MailInteraction'][_0x68c4('0xc3')]);_0x453de3[_0x68c4('0x3c')]=_['keys'](_0x42c4f1[_0x68c4('0x3c')]);_0x453de3[_0x68c4('0x46')]=_[_0x68c4('0x3d')](_0x453de3[_0x68c4('0x3b')],_0x453de3[_0x68c4('0x3c')]);_0x24072f[_0x68c4('0x3f')]=_[_0x68c4('0x3d')](_0x453de3[_0x68c4('0x3b')],qs['fields'](_0x42c4f1[_0x68c4('0x3c')]['fields']));_0x24072f[_0x68c4('0x3f')]=_0x24072f[_0x68c4('0x3f')][_0x68c4('0x40')]?_0x24072f['attributes']:_0x453de3[_0x68c4('0x3b')];if(_0x42c4f1[_0x68c4('0x3c')][_0x68c4('0xc4')]){_0x24072f['include']=[{'all':!![]}];}_0x24072f=_[_0x68c4('0x9d')]({},_0x24072f,_0x42c4f1['options']);return db[_0x68c4('0x37')][_0x68c4('0x6a')](_0x24072f)[_0x68c4('0x1b')](handleEntityNotFound(_0x340b8a,null))['then'](respondWithResult(_0x340b8a,null))[_0x68c4('0x2e')](handleError(_0x340b8a,null));};exports[_0x68c4('0xc5')]=function(_0x45adf4,_0x39a536){return db[_0x68c4('0x37')][_0x68c4('0xc5')](_0x45adf4['body'],{})[_0x68c4('0x1b')](respondWithResult(_0x39a536,0xc9))['catch'](handleError(_0x39a536,null));};exports[_0x68c4('0x1a')]=function(_0x509843,_0x2e005d){if(_0x509843['body']['id']){delete _0x509843[_0x68c4('0xc6')]['id'];}return db['MailInteraction'][_0x68c4('0x6a')]({'where':{'id':_0x509843[_0x68c4('0xc2')]['id']}})[_0x68c4('0x1b')](handleEntityNotFound(_0x2e005d,null))['then'](saveUpdates(_0x509843[_0x68c4('0xc6')],null))[_0x68c4('0x1b')](respondWithResult(_0x2e005d,null))[_0x68c4('0x2e')](handleError(_0x2e005d,null));};exports[_0x68c4('0x1c')]=function(_0x5be719,_0xb9a133){return db[_0x68c4('0x37')][_0x68c4('0x6a')]({'where':{'id':_0x5be719[_0x68c4('0xc2')]['id']}})[_0x68c4('0x1b')](handleEntityNotFound(_0xb9a133,null))[_0x68c4('0x1b')](removeEntity(_0xb9a133,null))[_0x68c4('0x2e')](handleError(_0xb9a133,null));};exports['describe']=function(_0x20bcf5,_0x4b0d49){return db[_0x68c4('0x37')][_0x68c4('0xc7')]()['then'](respondWithResult(_0x4b0d49,null))[_0x68c4('0x2e')](handleError(_0x4b0d49,null));};exports[_0x68c4('0xc8')]=function(_0x16809d,_0x245e3e){return db[_0x68c4('0x27')][_0x68c4('0x6a')]({'where':{'id':_0x16809d['params']['id']}})[_0x68c4('0x1b')](handleEntityNotFound(_0x245e3e,null))['then'](function(_0x1f90a6){if(_0x1f90a6){return _0x1f90a6[_0x68c4('0xc8')](_0x16809d['body'][_0x68c4('0xc9')],_[_0x68c4('0xca')](_0x16809d[_0x68c4('0xc6')],[_0x68c4('0xc9'),'id'])||{});}})[_0x68c4('0x1b')](respondWithResult(_0x245e3e,null))[_0x68c4('0x2e')](handleError(_0x245e3e,null));};exports['getMessages']=function(_0xa1d682,_0x1970cb){var _0x464aab={'raw':![],'where':{}};var _0x132b7d={};var _0xd4c206={'count':0x0,'rows':[]};return db[_0x68c4('0x37')][_0x68c4('0x28')]({'where':{'id':_0xa1d682['params']['id']}})[_0x68c4('0x1b')](handleEntityNotFound(_0x1970cb,null))[_0x68c4('0x1b')](function(_0x2a01ad){if(_0x2a01ad){_0x132b7d[_0x68c4('0x3b')]=_[_0x68c4('0x73')](db[_0x68c4('0x27')][_0x68c4('0xc3')]);_0x132b7d[_0x68c4('0x3c')]=_[_0x68c4('0x73')](_0xa1d682[_0x68c4('0x3c')]);_0x132b7d[_0x68c4('0x46')]=_[_0x68c4('0x3d')](_0x132b7d[_0x68c4('0x3b')],_0x132b7d[_0x68c4('0x3c')]);_0x464aab[_0x68c4('0x3f')]=_[_0x68c4('0x3d')](_0x132b7d[_0x68c4('0x3b')],qs[_0x68c4('0x3e')](_0xa1d682[_0x68c4('0x3c')][_0x68c4('0x3e')]));_0x464aab[_0x68c4('0x3f')]=_0x464aab[_0x68c4('0x3f')][_0x68c4('0x40')]?_0x464aab[_0x68c4('0x3f')]:_0x132b7d['model'];if(!_0xa1d682[_0x68c4('0x3c')][_0x68c4('0x41')]('nolimit')){_0x464aab[_0x68c4('0x15')]=qs[_0x68c4('0x15')](_0xa1d682['query'][_0x68c4('0x15')]);_0x464aab['offset']=qs[_0x68c4('0x17')](_0xa1d682[_0x68c4('0x3c')][_0x68c4('0x17')]);}_0x464aab['order']=qs['sort'](_0xa1d682[_0x68c4('0x3c')][_0x68c4('0x44')]);_0x464aab['where']=qs['filters'](_[_0x68c4('0x47')](_0xa1d682[_0x68c4('0x3c')],_0x132b7d['filters']));_0x464aab[_0x68c4('0x45')][_0x68c4('0xbd')]=_0x2a01ad['id'];if(_0xa1d682[_0x68c4('0x3c')][_0x68c4('0x81')]){_0x464aab[_0x68c4('0x45')]=_[_0x68c4('0x9d')](_0x464aab[_0x68c4('0x45')],{'$or':_['map'](_0x464aab['attributes'],function(_0x541297){var _0x49e06b={};_0x49e06b[_0x541297]={'$like':'%'+_0xa1d682[_0x68c4('0x3c')][_0x68c4('0x81')]+'%'};return _0x49e06b;})});}if(_0xa1d682[_0x68c4('0x3c')][_0x68c4('0xcb')]){var _0x2d2c04=_0xa1d682[_0x68c4('0x3c')][_0x68c4('0xcb')][_0x68c4('0x66')](',');var _0x207bae={};_0x207bae[_0x2d2c04[0x0]]={'$gte':moment(_0x2d2c04[0x1])['format'](_0x68c4('0xcc'))};_0x464aab['where']=_[_0x68c4('0x9d')](_0x464aab[_0x68c4('0x45')],_0x207bae);}_0x464aab=_[_0x68c4('0x9d')]({},_0x464aab,_0xa1d682[_0x68c4('0xcd')]);return db[_0x68c4('0x27')]['count']({'where':_0x464aab[_0x68c4('0x45')]})['then'](function(_0x441037){_0xd4c206['count']=_0x441037;if(_0xa1d682[_0x68c4('0x3c')][_0x68c4('0xc4')]){_0x464aab[_0x68c4('0xce')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x464aab);})['then'](function(_0x2d58a9){if(_0xa1d682['query'][_0x68c4('0xcf')]===_0x68c4('0xd0')){for(var _0x1a1c13=0x0;_0x1a1c13<_0x2d58a9[_0x68c4('0x40')];_0x1a1c13++){_0x2d58a9[_0x1a1c13][_0x68c4('0xc6')]=juice(_0x2d58a9[_0x1a1c13][_0x68c4('0xc6')]);}}_0xd4c206[_0x68c4('0xc0')]=_0x2d58a9;return _0xd4c206;});}})[_0x68c4('0x1b')](respondWithFilteredResult(_0x1970cb,_0x464aab))[_0x68c4('0x2e')](handleError(_0x1970cb,null));};exports['addTags']=function(_0x94d8b2,_0x4087ad){return db[_0x68c4('0x37')]['find']({'where':{'id':_0x94d8b2['params']['id']}})[_0x68c4('0x1b')](handleEntityNotFound(_0x4087ad,null))[_0x68c4('0x1b')](function(_0x4854e1){if(_0x4854e1){return _0x4854e1[_0x68c4('0xd1')](_0x94d8b2[_0x68c4('0xc6')]['ids'],_[_0x68c4('0xca')](_0x94d8b2['body'],[_0x68c4('0xc9'),'id'])||{})[_0x68c4('0xd2')](function(){return db[_0x68c4('0x6d')]['findAll']({'attributes':['id',_0x68c4('0x1f'),_0x68c4('0x4a')],'where':{'id':_0x94d8b2[_0x68c4('0xc6')][_0x68c4('0xc9')]}});})[_0x68c4('0x1b')](function(_0x550791){socket[_0x68c4('0xd3')]('mailInteractionTags:save',{'id':Number(_0x94d8b2[_0x68c4('0xc2')]['id']),'tags':_0x550791||[]});return{'id':Number(_0x94d8b2[_0x68c4('0xc2')]['id']),'tags':_0x550791||[]};});}})[_0x68c4('0x1b')](respondWithResult(_0x4087ad,null))[_0x68c4('0x2e')](handleError(_0x4087ad,null));};exports[_0x68c4('0xd4')]=function(_0x5b4ada,_0x585214){return db[_0x68c4('0x37')][_0x68c4('0x6a')]({'where':{'id':_0x5b4ada[_0x68c4('0xc2')]['id']}})[_0x68c4('0x1b')](handleEntityNotFound(_0x585214,null))[_0x68c4('0x1b')](function(_0x5024d1){if(_0x5024d1){return _0x5024d1['removeTags'](_0x5b4ada[_0x68c4('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x585214,null))[_0x68c4('0x2e')](handleError(_0x585214,null));};exports['download']=function(_0x3bb370,_0xdd470){var _0x572772=moment()[_0x68c4('0xd5')]()[_0x68c4('0x9a')]();var _0x13cf3a=path['join'](config[_0x68c4('0xd6')],_0x68c4('0xd7'),_0x68c4('0xd8'),_0x68c4('0xd9'));var _0x169611=path[_0x68c4('0xda')](config['root'],_0x68c4('0xd7'),_0x68c4('0xd8'),_0x68c4('0xdb'));var _0x3c28de=path[_0x68c4('0xda')](_0x13cf3a,_0x572772);var _0x11db0e=util[_0x68c4('0xdc')]('transcript-%d-%s.zip',_0x3bb370[_0x68c4('0xc2')]['id'],_0x572772);var _0x3877d4=path[_0x68c4('0xda')](_0x13cf3a,_0x11db0e);var _0x155503=[];if(_0x3bb370[_0x68c4('0x3c')][_0x68c4('0xdb')]){_0x155503[_0x68c4('0x26')]({'model':db[_0x68c4('0xdd')],'as':_0x68c4('0xde'),'raw':!![]});}var _0x38699e=[{'model':db[_0x68c4('0x27')],'as':'Messages','attributes':['id',_0x68c4('0xc6'),_0x68c4('0x4b'),'to','cc',_0x68c4('0xdf'),'subject',_0x68c4('0xe0')],'where':{'secret':![]},'order':qs[_0x68c4('0x44')]('id'),'include':_0x155503}];return db['MailInteraction'][_0x68c4('0x6a')]({'where':{'id':_0x3bb370[_0x68c4('0xc2')]['id']},'include':_0x38699e})[_0x68c4('0x1b')](handleEntityNotFound(_0xdd470,null))[_0x68c4('0x1b')](function(_0x4642cc){if(_0x4642cc&&_0x4642cc[_0x68c4('0xe1')]){var _0x584fbf=_0x4642cc[_0x68c4('0xe2')]({'plain':!![]});fs[_0x68c4('0xe3')](_0x3c28de);return BPromise['each'](_0x584fbf['Messages'],function(_0x28dcc4,_0xffc880){var _0x80a240={'from':_0x28dcc4[_0x68c4('0x4b')],'to':_0x28dcc4['to'],'subject':_0x28dcc4['subject'],'html':htmlEntities['decode'](_0x28dcc4['body']),'headers':{'Date':moment(_0x28dcc4[_0x68c4('0xe0')])['format'](_0x68c4('0xe4'))},'attachments':[]};if(_0x28dcc4['cc']){_0x80a240[_0x68c4('0xe5')]['Cc']=_0x28dcc4['cc'];}if(_0x28dcc4[_0x68c4('0xdf')]){_0x80a240[_0x68c4('0xe5')][_0x68c4('0xe6')]=_0x28dcc4['bcc'];}return new BPromise(function(_0xfe4060,_0x44b21c){if(_0x28dcc4[_0x68c4('0xde')]){for(var _0x5b49bf=0x0;_0x5b49bf<_0x28dcc4[_0x68c4('0xde')][_0x68c4('0x40')];_0x5b49bf++){var _0x32e3ab=_0x28dcc4[_0x68c4('0xde')][_0x5b49bf];var _0x433d01=path[_0x68c4('0xda')](_0x169611,_0x32e3ab[_0x68c4('0xe7')]);if(fs[_0x68c4('0xe8')](_0x433d01)){_0x80a240[_0x68c4('0xdb')][_0x68c4('0x26')]({'name':_0x32e3ab['name'],'contentType':_0x32e3ab[_0x68c4('0x39')],'data':fs[_0x68c4('0xe9')](_0x433d01)});}}}emlformat['build'](_0x80a240,function(_0x55e5c4,_0x29ad0e){if(_0x55e5c4)return _0x44b21c(_0x55e5c4);fs[_0x68c4('0xea')](path['join'](_0x3c28de,util[_0x68c4('0xdc')](_0x68c4('0xeb'),_0xffc880)),_0x29ad0e);return _0xfe4060(_0x29ad0e);});});})['then'](function(){return new BPromise(function(_0x3457bb,_0x1f00c5){zipdir(_0x3c28de,{'saveTo':_0x3877d4},function(_0x2616c3,_0x2501eb){if(_0x2616c3)return _0x1f00c5(_0x2616c3);return _0x3457bb(_0x2501eb);});})['then'](function(){return new BPromise(function(_0x55ea79,_0x5ce1aa){rimraf(_0x3c28de,function(_0x52a09c){if(_0x52a09c)_0x5ce1aa(_0x52a09c);return _0x55ea79();});});})[_0x68c4('0x1b')](function(){return _0xdd470[_0x68c4('0xec')](_0x3877d4,_0x11db0e,function(_0x405f02){if(!_0x405f02)fs[_0x68c4('0xed')](_0x3877d4);});});});}else{return _0xdd470[_0x68c4('0x1d')](0xc8);}})[_0x68c4('0x2e')](handleError(_0xdd470,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a920ec4..77e7039 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 _0x3fe6=['getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove'];(function(_0x386d15,_0x165f56){var _0x240e80=function(_0xa51117){while(--_0xa51117){_0x386d15['push'](_0x386d15['shift']());}};_0x240e80(++_0x165f56);}(_0x3fe6,0x1a1));var _0x63fe=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x3fe6[_0x2bb66c];return _0x1e0f98;};'use strict';var EventEmitter=require(_0x63fe('0x0'));var MailInteraction=require(_0x63fe('0x1'))['db'][_0x63fe('0x2')];var MailMessage=require(_0x63fe('0x1'))['db'][_0x63fe('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x63fe('0x4')](0x0);var events={'afterCreate':_0x63fe('0x5'),'afterUpdate':_0x63fe('0x6'),'afterDestroy':_0x63fe('0x7')};function emitEvent(_0x3e8024){return function(_0x2c40f6,_0x594a72,_0x20c0f5){_0x2c40f6[_0x63fe('0x8')]({'attributes':['id'],'raw':!![]})[_0x63fe('0x9')](function(_0x29055a){_0x2c40f6[_0x63fe('0xa')](_0x63fe('0xb'),_0x29055a[_0x63fe('0xc')](function(_0x3840d6){return{'id':_0x3840d6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2c40f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x63fe('0x9')](function(_0x1a3f28){_0x2c40f6[_0x63fe('0xa')](_0x63fe('0xd'),_0x1a3f28['length']);MailInteractionEvents[_0x63fe('0xe')](_0x3e8024+':'+_0x2c40f6['id'],_0x2c40f6);MailInteractionEvents[_0x63fe('0xe')](_0x3e8024,_0x2c40f6);_0x20c0f5(null);})[_0x63fe('0xf')](_0x20c0f5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x63fe('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x51a6=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save','remove','getUsers'];(function(_0x1912cf,_0x40c457){var _0x40ecad=function(_0xcb4086){while(--_0xcb4086){_0x1912cf['push'](_0x1912cf['shift']());}};_0x40ecad(++_0x40c457);}(_0x51a6,0x1e6));var _0x651a=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0x51a6[_0x5869f5];return _0x6beba1;};'use strict';var EventEmitter=require(_0x651a('0x0'));var MailInteraction=require(_0x651a('0x1'))['db'][_0x651a('0x2')];var MailMessage=require(_0x651a('0x1'))['db'][_0x651a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x651a('0x4'),'afterUpdate':'update','afterDestroy':_0x651a('0x5')};function emitEvent(_0x4c9ac5){return function(_0x4c0ab2,_0xaeb9ff,_0x1e2fb8){_0x4c0ab2[_0x651a('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c1ded){_0x4c0ab2[_0x651a('0x7')](_0x651a('0x8'),_0x2c1ded[_0x651a('0x9')](function(_0x2c0cb1){return{'id':_0x2c0cb1['id']};}));return MailMessage[_0x651a('0xa')]({'where':{'MailInteractionId':_0x4c0ab2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x47f043){_0x4c0ab2[_0x651a('0x7')](_0x651a('0xb'),_0x47f043[_0x651a('0xc')]);MailInteractionEvents[_0x651a('0xd')](_0x4c9ac5+':'+_0x4c0ab2['id'],_0x4c0ab2);MailInteractionEvents[_0x651a('0xd')](_0x4c9ac5,_0x4c0ab2);_0x1e2fb8(null);})['catch'](_0x1e2fb8(null));};}for(var e in events){if(events[_0x651a('0xe')](e)){var event=events[e];MailInteraction[_0x651a('0xf')](e,emitEvent(event));}}module[_0x651a('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c723aa6..0825daf 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 _0xa3f5=['changed','substatusAt','models','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x486f13,_0x31944b){var _0x490f0b=function(_0x547440){while(--_0x547440){_0x486f13['push'](_0x486f13['shift']());}};_0x490f0b(++_0x31944b);}(_0xa3f5,0x6e));var _0x5a3f=function(_0x27bc9d,_0x22788a){_0x27bc9d=_0x27bc9d-0x0;var _0x405866=_0xa3f5[_0x27bc9d];return _0x405866;};'use strict';var _=require(_0x5a3f('0x0'));var util=require(_0x5a3f('0x1'));var logger=require(_0x5a3f('0x2'))(_0x5a3f('0x3'));var moment=require(_0x5a3f('0x4'));var BPromise=require(_0x5a3f('0x5'));var rp=require(_0x5a3f('0x6'));var fs=require('fs');var path=require(_0x5a3f('0x7'));var rimraf=require(_0x5a3f('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a3f('0x9'));module[_0x5a3f('0xa')]=function(_0x272dec,_0x332376){return _0x272dec[_0x5a3f('0xb')](_0x5a3f('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x5a3f('0xd'),'fields':['subject','to'],'type':_0x5a3f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20054d,_0x413846,_0x33bad4){if(_0x20054d[_0x5a3f('0xf')]){_0x20054d['substatusAt']=moment()[_0x5a3f('0x10')](_0x5a3f('0x11'));}if(_0x20054d[_0x5a3f('0x12')]){_0x20054d[_0x5a3f('0x13')]=moment()[_0x5a3f('0x10')](_0x5a3f('0x11'));}_0x33bad4(null,_0x413846);},'beforeUpdate':function(_0x59352e,_0xdec304,_0x43c2c7){if(_0x59352e[_0x5a3f('0x14')](_0x5a3f('0xf'))){_0x59352e[_0x5a3f('0x15')]=_0x59352e[_0x5a3f('0xf')]?moment()[_0x5a3f('0x10')](_0x5a3f('0x11')):null;}if(_0x59352e['changed'](_0x5a3f('0x12'))){_0x59352e['closedAt']=moment()[_0x5a3f('0x10')](_0x5a3f('0x11'));_0x59352e['substatus']=null;_0x59352e[_0x5a3f('0x15')]=null;}_0x43c2c7(null,_0x59352e);},'afterUpdate':function(_0x574f16,_0x1ec38f,_0x26d3ee){var _0x4b04d9=_0x272dec[_0x5a3f('0x16')];var _0x22e2fc=_0x574f16['get']({'plain':!![]});if(_0x22e2fc[_0x5a3f('0x12')]){return _0x4b04d9['MailMessage'][_0x5a3f('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x22e2fc['id']}})[_0x5a3f('0x18')](function(){_0x26d3ee();})['catch'](function(_0x11f399){_0x26d3ee(_0x11f399);});}else{_0x26d3ee();}}},'charset':'utf8mb4','collate':_0x5a3f('0x19')});}; \ No newline at end of file +var _0x881d=['define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','closed','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','models','update','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports'];(function(_0x582c98,_0x53b3a0){var _0x593449=function(_0x39834c){while(--_0x39834c){_0x582c98['push'](_0x582c98['shift']());}};_0x593449(++_0x53b3a0);}(_0x881d,0x1c0));var _0xd881=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x881d[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xd881('0x0'));var util=require('util');var logger=require(_0xd881('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd881('0x2'));var fs=require('fs');var path=require(_0xd881('0x3'));var rimraf=require(_0xd881('0x4'));var config=require(_0xd881('0x5'));var attributes=require(_0xd881('0x6'));module[_0xd881('0x7')]=function(_0x4eadbc,_0x2f5491){return _0x4eadbc[_0xd881('0x8')]('MailInteraction',attributes,{'tableName':_0xd881('0x9'),'paranoid':![],'indexes':[{'name':_0xd881('0xa'),'fields':['subject','to'],'type':_0xd881('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe03fd3,_0x2a8fc6,_0x2a688c){if(_0xe03fd3[_0xd881('0xc')]){_0xe03fd3[_0xd881('0xd')]=moment()[_0xd881('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xe03fd3[_0xd881('0xf')]){_0xe03fd3['closedAt']=moment()[_0xd881('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2a688c(null,_0x2a8fc6);},'beforeUpdate':function(_0x324db8,_0x1e89c7,_0x2d3104){if(_0x324db8['changed'](_0xd881('0xc'))){_0x324db8[_0xd881('0xd')]=_0x324db8[_0xd881('0xc')]?moment()[_0xd881('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x324db8[_0xd881('0x10')](_0xd881('0xf'))){_0x324db8[_0xd881('0x11')]=moment()['format'](_0xd881('0x12'));_0x324db8[_0xd881('0xc')]=null;_0x324db8[_0xd881('0xd')]=null;}_0x2d3104(null,_0x324db8);},'afterUpdate':function(_0x5ef04e,_0x4047db,_0x1235f4){var _0x2da3e0=_0x4eadbc[_0xd881('0x13')];var _0x9ccaa6=_0x5ef04e['get']({'plain':!![]});if(_0x9ccaa6[_0xd881('0xf')]){return _0x2da3e0['MailMessage'][_0xd881('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x9ccaa6['id']}})[_0xd881('0x15')](function(){_0x1235f4();})[_0xd881('0x16')](function(_0x344cef){_0x1235f4(_0x344cef);});}else{_0x1235f4();}}},'charset':'utf8mb4','collate':_0xd881('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9f878f0..a3a6173 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 _0x66ae=['limit','UpdateMailInteraction','stringify','AddTagsToMailInteraction','MailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','update','body','options','raw','where','attributes'];(function(_0x48b25b,_0x3339f6){var _0x1cec56=function(_0x27a37b){while(--_0x27a37b){_0x48b25b['push'](_0x48b25b['shift']());}};_0x1cec56(++_0x3339f6);}(_0x66ae,0x117));var _0xe66a=function(_0x370895,_0x5670fd){_0x370895=_0x370895-0x0;var _0x468589=_0x66ae[_0x370895];return _0x468589;};'use strict';var _=require(_0xe66a('0x0'));var util=require(_0xe66a('0x1'));var moment=require(_0xe66a('0x2'));var BPromise=require(_0xe66a('0x3'));var rs=require(_0xe66a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require(_0xe66a('0x7'))(_0xe66a('0x8'));var config=require(_0xe66a('0x9'));var jayson=require(_0xe66a('0xa'));var client=jayson[_0xe66a('0xb')][_0xe66a('0xc')]({'port':0x232a});config[_0xe66a('0xd')]=_[_0xe66a('0xe')](config[_0xe66a('0xd')],{'host':_0xe66a('0xf'),'port':0x18eb});var socket=require(_0xe66a('0x10'))(new Redis(config[_0xe66a('0xd')]));require(_0xe66a('0x11'))[_0xe66a('0x12')](socket);function respondWithRpcPromise(_0x43e183,_0x53c49e,_0x16657e){return new BPromise(function(_0x493509,_0x5c8ec9){return client[_0xe66a('0x13')](_0x43e183,_0x16657e)[_0xe66a('0x14')](function(_0x4d22d0){logger[_0xe66a('0x15')]('MailInteraction,\x20%s,\x20%s',_0x53c49e,_0xe66a('0x16'));logger[_0xe66a('0x17')](_0xe66a('0x18'),_0x53c49e,'request\x20sent',JSON['stringify'](_0x4d22d0));if(_0x4d22d0[_0xe66a('0x19')]){if(_0x4d22d0[_0xe66a('0x19')][_0xe66a('0x1a')]===0x1f4){logger['error'](_0xe66a('0x1b'),_0x53c49e,_0x4d22d0[_0xe66a('0x19')][_0xe66a('0x1c')]);return _0x5c8ec9(_0x4d22d0[_0xe66a('0x19')][_0xe66a('0x1c')]);}logger[_0xe66a('0x19')](_0xe66a('0x1b'),_0x53c49e,_0x4d22d0[_0xe66a('0x19')]['message']);return _0x493509(_0x4d22d0['error'][_0xe66a('0x1c')]);}else{logger[_0xe66a('0x15')](_0xe66a('0x1b'),_0x53c49e,_0xe66a('0x16'));_0x493509(_0x4d22d0['result'][_0xe66a('0x1c')]);}})[_0xe66a('0x1d')](function(_0x19ed83){logger[_0xe66a('0x19')](_0xe66a('0x1b'),_0x53c49e,_0x19ed83);_0x5c8ec9(_0x19ed83);});});}exports['UpdateMailInteraction']=function(_0x10504b){var _0x19fb28=this;return new Promise(function(_0x24f936,_0x316ca9){return db['MailInteraction'][_0xe66a('0x1e')](_0x10504b[_0xe66a('0x1f')],{'raw':_0x10504b[_0xe66a('0x20')]?_0x10504b['options'][_0xe66a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10504b[_0xe66a('0x20')]?_0x10504b[_0xe66a('0x20')][_0xe66a('0x22')]||null:null,'attributes':_0x10504b['options']?_0x10504b[_0xe66a('0x20')][_0xe66a('0x23')]||null:null,'limit':_0x10504b[_0xe66a('0x20')]?_0x10504b[_0xe66a('0x20')][_0xe66a('0x24')]||null:null})[_0xe66a('0x14')](function(_0x2c74f0){logger[_0xe66a('0x15')](_0xe66a('0x25'),_0x10504b);logger[_0xe66a('0x17')](_0xe66a('0x25'),_0x10504b,JSON[_0xe66a('0x26')](_0x2c74f0));_0x24f936(_0x2c74f0);})[_0xe66a('0x1d')](function(_0x42b2d4){logger['error'](_0xe66a('0x25'),_0x42b2d4[_0xe66a('0x1c')],_0x10504b);_0x316ca9(_0x19fb28[_0xe66a('0x19')](0x1f4,_0x42b2d4[_0xe66a('0x1c')]));});});};exports[_0xe66a('0x27')]=function(_0x2e3995){return new Promise(function(_0x5c23cd,_0x3ec87d){return db[_0xe66a('0x28')]['find']({'where':_0x2e3995[_0xe66a('0x20')]?_0x2e3995[_0xe66a('0x20')]['where']||null:null})['then'](function(_0x318686){if(_0x318686){return _0x318686[_0xe66a('0x29')](_0x2e3995[_0xe66a('0x1f')]['ids'],_['omit'](_0x2e3995[_0xe66a('0x1f')],[_0xe66a('0x2a'),'id'])||{});}})[_0xe66a('0x2b')](function(_0x54f039){logger[_0xe66a('0x15')](_0xe66a('0x2c'),_0x2e3995);logger[_0xe66a('0x17')]('AddTags',_0x2e3995,JSON['stringify'](_0x54f039));_0x5c23cd(_0x54f039);})[_0xe66a('0x1d')](function(_0x3e34e0){logger[_0xe66a('0x19')](_0xe66a('0x2c'),_0x3e34e0['message'],_0x2e3995);_0x3ec87d(_this['error'](0x1f4,_0x3e34e0[_0xe66a('0x1c')]));});});}; \ No newline at end of file +var _0xb366=['stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb366,0xa4));var _0x6b36=function(_0x4d282a,_0x3204e4){_0x4d282a=_0x4d282a-0x0;var _0x4fce00=_0xb366[_0x4d282a];return _0x4fce00;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var moment=require(_0x6b36('0x1'));var BPromise=require(_0x6b36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b36('0x3'));var db=require(_0x6b36('0x4'))['db'];var utils=require(_0x6b36('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b36('0x6'));var client=jayson[_0x6b36('0x7')]['http']({'port':0x232a});config[_0x6b36('0x8')]=_['defaults'](config['redis'],{'host':_0x6b36('0x9'),'port':0x18eb});var socket=require(_0x6b36('0xa'))(new Redis(config[_0x6b36('0x8')]));require(_0x6b36('0xb'))['register'](socket);function respondWithRpcPromise(_0x171558,_0x22804e,_0x4d1437){return new BPromise(function(_0x32bbb5,_0x567985){return client[_0x6b36('0xc')](_0x171558,_0x4d1437)[_0x6b36('0xd')](function(_0x46eaa8){logger[_0x6b36('0xe')](_0x6b36('0xf'),_0x22804e,_0x6b36('0x10'));logger['debug'](_0x6b36('0x11'),_0x22804e,_0x6b36('0x10'),JSON['stringify'](_0x46eaa8));if(_0x46eaa8[_0x6b36('0x12')]){if(_0x46eaa8['error'][_0x6b36('0x13')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x22804e,_0x46eaa8['error'][_0x6b36('0x14')]);return _0x567985(_0x46eaa8[_0x6b36('0x12')][_0x6b36('0x14')]);}logger['error'](_0x6b36('0xf'),_0x22804e,_0x46eaa8['error'][_0x6b36('0x14')]);return _0x32bbb5(_0x46eaa8[_0x6b36('0x12')][_0x6b36('0x14')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x22804e,_0x6b36('0x10'));_0x32bbb5(_0x46eaa8['result'][_0x6b36('0x14')]);}})[_0x6b36('0x15')](function(_0x5ad465){logger[_0x6b36('0x12')]('MailInteraction,\x20%s,\x20%s',_0x22804e,_0x5ad465);_0x567985(_0x5ad465);});});}exports[_0x6b36('0x16')]=function(_0x489a1a){var _0x317ab3=this;return new Promise(function(_0x2e2f3e,_0xda25fd){return db[_0x6b36('0x17')][_0x6b36('0x18')](_0x489a1a[_0x6b36('0x19')],{'raw':_0x489a1a[_0x6b36('0x1a')]?_0x489a1a[_0x6b36('0x1a')][_0x6b36('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x489a1a[_0x6b36('0x1a')]?_0x489a1a[_0x6b36('0x1a')][_0x6b36('0x1c')]||null:null,'attributes':_0x489a1a['options']?_0x489a1a[_0x6b36('0x1a')][_0x6b36('0x1d')]||null:null,'limit':_0x489a1a['options']?_0x489a1a[_0x6b36('0x1a')]['limit']||null:null})[_0x6b36('0xd')](function(_0x5b0490){logger['info']('UpdateMailInteraction',_0x489a1a);logger[_0x6b36('0x1e')](_0x6b36('0x16'),_0x489a1a,JSON[_0x6b36('0x1f')](_0x5b0490));_0x2e2f3e(_0x5b0490);})[_0x6b36('0x15')](function(_0x2d1af7){logger[_0x6b36('0x12')](_0x6b36('0x16'),_0x2d1af7[_0x6b36('0x14')],_0x489a1a);_0xda25fd(_0x317ab3['error'](0x1f4,_0x2d1af7[_0x6b36('0x14')]));});});};exports[_0x6b36('0x20')]=function(_0x5975f9){return new Promise(function(_0x10b97b,_0x432637){return db['MailInteraction'][_0x6b36('0x21')]({'where':_0x5975f9[_0x6b36('0x1a')]?_0x5975f9[_0x6b36('0x1a')][_0x6b36('0x1c')]||null:null})[_0x6b36('0xd')](function(_0x44d4d7){if(_0x44d4d7){return _0x44d4d7[_0x6b36('0x22')](_0x5975f9[_0x6b36('0x19')][_0x6b36('0x23')],_[_0x6b36('0x24')](_0x5975f9['body'],[_0x6b36('0x23'),'id'])||{});}})[_0x6b36('0x25')](function(_0x18f1c9){logger[_0x6b36('0xe')]('AddTags',_0x5975f9);logger['debug'](_0x6b36('0x26'),_0x5975f9,JSON['stringify'](_0x18f1c9));_0x10b97b(_0x18f1c9);})[_0x6b36('0x15')](function(_0x1dc1d7){logger[_0x6b36('0x12')](_0x6b36('0x26'),_0x1dc1d7[_0x6b36('0x14')],_0x5975f9);_0x432637(_this[_0x6b36('0x12')](0x1f4,_0x1dc1d7[_0x6b36('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 2fa66fa..b770a50 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 _0x86a3=['emit','removeListener','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x5a1e60,_0x9201e1){var _0x53c6fd=function(_0x4a2f74){while(--_0x4a2f74){_0x5a1e60['push'](_0x5a1e60['shift']());}};_0x53c6fd(++_0x9201e1);}(_0x86a3,0xb1));var _0x386a=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x86a3[_0x1dd532];return _0x3732aa;};'use strict';var MailInteractionEvents=require(_0x386a('0x0'));var events=[_0x386a('0x1'),'remove',_0x386a('0x2')];function createListener(_0x4934b5,_0x5c278a){return function(_0x44014b){_0x5c278a[_0x386a('0x3')](_0x4934b5,_0x44014b);};}function removeListener(_0x2d43bd,_0x5d537e){return function(){MailInteractionEvents[_0x386a('0x4')](_0x2d43bd,_0x5d537e);};}exports['register']=function(_0xd6606f){for(var _0x10390b=0x0,_0x218b94=events['length'];_0x10390b<_0x218b94;_0x10390b++){var _0x30aa1d=events[_0x10390b];var _0x3bef2f=createListener(_0x386a('0x5')+_0x30aa1d,_0xd6606f);MailInteractionEvents['on'](_0x30aa1d,_0x3bef2f);}}; \ No newline at end of file +var _0x7d1b=['length','./mailInteraction.events','save','removeListener','register'];(function(_0x3c7c4b,_0x394429){var _0x2875a0=function(_0x54330f){while(--_0x54330f){_0x3c7c4b['push'](_0x3c7c4b['shift']());}};_0x2875a0(++_0x394429);}(_0x7d1b,0x1cd));var _0xb7d1=function(_0x419a45,_0x34b2b1){_0x419a45=_0x419a45-0x0;var _0x13d057=_0x7d1b[_0x419a45];return _0x13d057;};'use strict';var MailInteractionEvents=require(_0xb7d1('0x0'));var events=[_0xb7d1('0x1'),'remove','update'];function createListener(_0x193d22,_0x25de61){return function(_0x5a014c){_0x25de61['emit'](_0x193d22,_0x5a014c);};}function removeListener(_0x5f246b,_0x1ba390){return function(){MailInteractionEvents[_0xb7d1('0x2')](_0x5f246b,_0x1ba390);};}exports[_0xb7d1('0x3')]=function(_0x311139){for(var _0x47f6eb=0x0,_0x5b057c=events[_0xb7d1('0x4')];_0x47f6eb<_0x5b057c;_0x47f6eb++){var _0x49b2ac=events[_0x47f6eb];var _0x4046a5=createListener('mailInteraction:'+_0x49b2ac,_0x311139);MailInteractionEvents['on'](_0x49b2ac,_0x4046a5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 00c43bc..a098ae4 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 _0x7c21=['/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','update','put'];(function(_0x57bd50,_0x3ccd59){var _0x1034c0=function(_0x221946){while(--_0x221946){_0x57bd50['push'](_0x57bd50['shift']());}};_0x1034c0(++_0x3ccd59);}(_0x7c21,0x1e2));var _0x17c2=function(_0x39c140,_0x3e9bd9){_0x39c140=_0x39c140-0x0;var _0x1ee589=_0x7c21[_0x39c140];return _0x1ee589;};'use strict';var multer=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var path=require(_0x17c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x17c2('0x3'));var router=express[_0x17c2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x17c2('0x5'));var interaction=require(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var controller=require(_0x17c2('0x8'));router['get']('/',auth[_0x17c2('0x9')](),controller['index']);router['get'](_0x17c2('0xa'),auth[_0x17c2('0x9')](),controller[_0x17c2('0xb')]);router[_0x17c2('0xc')](_0x17c2('0xd'),auth[_0x17c2('0x9')](),controller[_0x17c2('0xe')]);router['get'](_0x17c2('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x17c2('0x10')]('/',auth['isAuthenticated'](),interaction[_0x17c2('0x11')](_0x17c2('0x12'),_0x17c2('0x13')),controller['create']);router['put'](_0x17c2('0xd'),auth['isAuthenticated'](),controller[_0x17c2('0x14')]);router[_0x17c2('0x15')](_0x17c2('0x16'),auth[_0x17c2('0x9')](),controller['accept']);router[_0x17c2('0x15')](_0x17c2('0x17'),auth[_0x17c2('0x9')](),controller[_0x17c2('0x18')]);router[_0x17c2('0x19')]('/:id',auth[_0x17c2('0x9')](),controller[_0x17c2('0x1a')]);module[_0x17c2('0x1b')]=router; \ No newline at end of file +var _0xd110=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','/:id','isAuthenticated','post','tracked','mail','create','put','update','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0xc2be36,_0x5a47fc){var _0x4c177d=function(_0x164ff){while(--_0x164ff){_0xc2be36['push'](_0xc2be36['shift']());}};_0x4c177d(++_0x5a47fc);}(_0xd110,0x1e8));var _0x0d11=function(_0x27d4f2,_0x580c67){_0x27d4f2=_0x27d4f2-0x0;var _0x2e6529=_0xd110[_0x27d4f2];return _0x2e6529;};'use strict';var multer=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var path=require(_0x0d11('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d11('0x3'));var router=express[_0x0d11('0x4')]();var fs_extra=require(_0x0d11('0x5'));var auth=require(_0x0d11('0x6'));var interaction=require(_0x0d11('0x7'));var config=require(_0x0d11('0x8'));var controller=require(_0x0d11('0x9'));router[_0x0d11('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d11('0xb')]);router['get'](_0x0d11('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0d11('0xa')](_0x0d11('0xd'),auth[_0x0d11('0xe')](),controller['show']);router[_0x0d11('0xa')]('/:id/download',auth[_0x0d11('0xe')](),controller['download']);router[_0x0d11('0xf')]('/',auth[_0x0d11('0xe')](),interaction[_0x0d11('0x10')](_0x0d11('0x11'),'mailmessage:create'),controller[_0x0d11('0x12')]);router[_0x0d11('0x13')]('/:id',auth[_0x0d11('0xe')](),controller[_0x0d11('0x14')]);router[_0x0d11('0x13')]('/:id/accept',auth[_0x0d11('0xe')](),controller[_0x0d11('0x15')]);router['put'](_0x0d11('0x16'),auth[_0x0d11('0xe')](),controller[_0x0d11('0x17')]);router[_0x0d11('0x18')](_0x0d11('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d11('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fd783d1..6a070e6 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 _0xb954=['DATE','BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT','medium','ENUM','out','STRING','long'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xb954,0x115));var _0x4b95=function(_0x25f8e8,_0x519d8e){_0x25f8e8=_0x25f8e8-0x0;var _0x1df02c=_0xb954[_0x25f8e8];return _0x1df02c;};'use strict';var Sequelize=require(_0x4b95('0x0'));var _=require(_0x4b95('0x1'));module[_0x4b95('0x2')]={'body':{'type':Sequelize[_0x4b95('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x4b95('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b95('0x5')]('in',_0x4b95('0x6')),'defaultValue':_0x4b95('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4b95('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'cc':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'bcc':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'subject':{'type':Sequelize[_0x4b95('0x3')]},'sentAt':{'type':Sequelize[_0x4b95('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4b95('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4b95('0x9')]},'originTo':{'type':Sequelize[_0x4b95('0x3')]('long')},'originCc':{'type':Sequelize[_0x4b95('0x3')](_0x4b95('0x8'))},'originChannel':{'type':Sequelize['ENUM'](_0x4b95('0xb'),_0x4b95('0xc')),'defaultValue':_0x4b95('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xe721=['long','DATE','INTEGER','BOOLEAN','ENUM','Email','Chat','sequelize','lodash','exports','TEXT','medium','out','STRING'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe721,0x1f1));var _0x1e72=function(_0x56dc20,_0x3651dc){_0x56dc20=_0x56dc20-0x0;var _0x7be234=_0xe721[_0x56dc20];return _0x7be234;};'use strict';var Sequelize=require(_0x1e72('0x0'));var _=require(_0x1e72('0x1'));module[_0x1e72('0x2')]={'body':{'type':Sequelize[_0x1e72('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x1e72('0x3')](_0x1e72('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x1e72('0x5')),'defaultValue':_0x1e72('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1e72('0x6')](0x1fe)},'from':{'type':Sequelize[_0x1e72('0x6')]},'to':{'type':Sequelize['TEXT'](_0x1e72('0x7'))},'cc':{'type':Sequelize['TEXT'](_0x1e72('0x7'))},'bcc':{'type':Sequelize[_0x1e72('0x3')](_0x1e72('0x7'))},'subject':{'type':Sequelize[_0x1e72('0x3')]},'sentAt':{'type':Sequelize[_0x1e72('0x8')]},'attach':{'type':Sequelize[_0x1e72('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1e72('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1e72('0x8')]},'originTo':{'type':Sequelize[_0x1e72('0x3')](_0x1e72('0x7'))},'originCc':{'type':Sequelize[_0x1e72('0x3')](_0x1e72('0x7'))},'originChannel':{'type':Sequelize[_0x1e72('0xb')](_0x1e72('0xc'),_0x1e72('0xd')),'defaultValue':_0x1e72('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index a2deaf9..dd87792 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 _0x86e1=['getSmtpOptions','attachments','root','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','event','rejectmessage','toString','join','server','files','tmp','from','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','readFileSync','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','merge','VIRTUAL','options','findAll','show','params','keys','includeAll','include','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','Smtp','CloudProvider'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x86e1,0x180));var _0x186e=function(_0x284c1e,_0x5b7587){_0x284c1e=_0x284c1e-0x0;var _0x5a41a9=_0x86e1[_0x284c1e];return _0x5a41a9;};'use strict';var emlformat=require('eml-format');var moment=require(_0x186e('0x0'));var BPromise=require(_0x186e('0x1'));var util=require(_0x186e('0x2'));var path=require(_0x186e('0x3'));var fs=require('fs');var _=require(_0x186e('0x4'));var Redis=require(_0x186e('0x5'));var htmlToText=require(_0x186e('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x186e('0x7'));var interaction_log=require(_0x186e('0x8'))('mail-interactions');var config=require(_0x186e('0x9'));var db=require(_0x186e('0xa'))['db'];config[_0x186e('0xb')]=_[_0x186e('0xc')](config[_0x186e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x186e('0xd'))(new Redis(config[_0x186e('0xb')]));var htmlEntities=require(_0x186e('0xe'));require(_0x186e('0xf'))[_0x186e('0x10')](socket);var jayson=require(_0x186e('0x11'));var client=jayson['client'][_0x186e('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x186e('0x12')]({'port':0x232b});var client9002=jayson['client'][_0x186e('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x234ff5,_0x2163d6,_0x490efa,_0x17bbc7){return new BPromise(function(_0x2f2641,_0x1c40f8){var _0x191760=_0x17bbc7||client;return _0x191760[_0x186e('0x13')](_0x234ff5,_0x490efa)[_0x186e('0x14')](function(_0x3e260c){logger['info'](_0x186e('0x15'),_0x2163d6,_0x186e('0x16'));logger['debug'](_0x186e('0x17'),_0x2163d6,_0x186e('0x16'),JSON[_0x186e('0x18')](_0x3e260c));if(_0x3e260c[_0x186e('0x19')]){if(_0x3e260c['error'][_0x186e('0x1a')]===0x1f4){logger[_0x186e('0x19')](_0x186e('0x15'),_0x2163d6,_0x3e260c[_0x186e('0x19')]['message']);return _0x1c40f8(_0x3e260c[_0x186e('0x19')][_0x186e('0x1b')]);}logger[_0x186e('0x19')](_0x186e('0x15'),_0x2163d6,_0x3e260c['error'][_0x186e('0x1b')]);return _0x2f2641(_0x3e260c['error'][_0x186e('0x1b')]);}else{logger[_0x186e('0x1c')]('MailMessage,\x20%s,\x20%s',_0x2163d6,_0x186e('0x16'));_0x2f2641(_0x3e260c[_0x186e('0x1d')][_0x186e('0x1b')]);}})[_0x186e('0x1e')](function(_0x301166){logger[_0x186e('0x19')](_0x186e('0x15'),_0x2163d6,_0x301166);_0x1c40f8(_0x301166);});});}function respondWithResult(_0x33df18,_0x2a6865){_0x2a6865=_0x2a6865||0xc8;return function(_0x3ea4d5){if(_0x3ea4d5){return _0x33df18[_0x186e('0x1f')](_0x2a6865)[_0x186e('0x20')](_0x3ea4d5);}};}function respondWithFilteredResult(_0x5c48d6,_0x48a074){return function(_0x9334f4){if(_0x9334f4){var _0x5ec3b5=typeof _0x48a074[_0x186e('0x21')]===_0x186e('0x22')&&typeof _0x48a074[_0x186e('0x23')]===_0x186e('0x22');var _0x2dbd1a=_0x9334f4[_0x186e('0x24')];var _0x4df50d=_0x5ec3b5?0x0:_0x48a074[_0x186e('0x21')];var _0x1e97d8=_0x5ec3b5?_0x9334f4[_0x186e('0x24')]:_0x48a074['offset']+_0x48a074[_0x186e('0x23')];var _0x30471e;if(_0x1e97d8>=_0x2dbd1a){_0x1e97d8=_0x2dbd1a;_0x30471e=0xc8;}else{_0x30471e=0xce;}_0x5c48d6['status'](_0x30471e);return _0x5c48d6[_0x186e('0x25')](_0x186e('0x26'),_0x4df50d+'-'+_0x1e97d8+'/'+_0x2dbd1a)[_0x186e('0x20')](_0x9334f4);}return null;};}function saveUpdates(_0x224bf7){return function(_0x10d8aa){if(_0x10d8aa){return _0x10d8aa[_0x186e('0x27')](_0x224bf7)[_0x186e('0x14')](function(_0x5200aa){return _0x5200aa;});}return null;};}function removeEntity(_0x55b497){return function(_0x5f01f5){if(_0x5f01f5){return _0x5f01f5[_0x186e('0x28')]()[_0x186e('0x14')](function(){_0x55b497[_0x186e('0x1f')](0xcc)[_0x186e('0x29')]();});}};}function handleEntityNotFound(_0xac018b){return function(_0x23047c){if(!_0x23047c){_0xac018b[_0x186e('0x2a')](0x194);}return _0x23047c;};}function handleError(_0x599e8e,_0x2ac08c){_0x2ac08c=_0x2ac08c||0x1f4;return function(_0x9f0dcd){logger[_0x186e('0x19')](_0x9f0dcd[_0x186e('0x2b')]);if(_0x9f0dcd[_0x186e('0x2c')]){delete _0x9f0dcd[_0x186e('0x2c')];}_0x599e8e[_0x186e('0x1f')](_0x2ac08c)[_0x186e('0x2d')](_0x9f0dcd);};}exports[_0x186e('0x2e')]=function(_0x4bd334,_0x2ee3a5){var _0x2b6b7a={},_0x5abaea={},_0x3158ea={'count':0x0,'rows':[]};var _0x5b5201=_[_0x186e('0x2f')](db[_0x186e('0x30')][_0x186e('0x31')],function(_0x3fe43a){return{'name':_0x3fe43a[_0x186e('0x32')],'type':_0x3fe43a[_0x186e('0x33')][_0x186e('0x34')]};});_0x5abaea['model']=_[_0x186e('0x2f')](_0x5b5201,_0x186e('0x2c'));_0x5abaea[_0x186e('0x35')]=_['keys'](_0x4bd334[_0x186e('0x35')]);_0x5abaea[_0x186e('0x36')]=_[_0x186e('0x37')](_0x5abaea[_0x186e('0x38')],_0x5abaea[_0x186e('0x35')]);_0x2b6b7a[_0x186e('0x39')]=_[_0x186e('0x37')](_0x5abaea['model'],qs['fields'](_0x4bd334[_0x186e('0x35')][_0x186e('0x3a')]));_0x2b6b7a[_0x186e('0x39')]=_0x2b6b7a[_0x186e('0x39')][_0x186e('0x3b')]?_0x2b6b7a[_0x186e('0x39')]:_0x5abaea[_0x186e('0x38')];if(!_0x4bd334[_0x186e('0x35')]['hasOwnProperty']('nolimit')){_0x2b6b7a[_0x186e('0x23')]=qs['limit'](_0x4bd334[_0x186e('0x35')][_0x186e('0x23')]);_0x2b6b7a[_0x186e('0x21')]=qs[_0x186e('0x21')](_0x4bd334[_0x186e('0x35')][_0x186e('0x21')]);}_0x2b6b7a[_0x186e('0x3c')]=qs[_0x186e('0x3d')](_0x4bd334[_0x186e('0x35')][_0x186e('0x3d')]);_0x2b6b7a['where']=qs[_0x186e('0x36')](_[_0x186e('0x3e')](_0x4bd334[_0x186e('0x35')],_0x5abaea['filters']),_0x5b5201);if(_0x4bd334[_0x186e('0x35')][_0x186e('0x3f')]){_0x2b6b7a['where']=_[_0x186e('0x40')](_0x2b6b7a['where'],{'$or':_['map'](_0x5b5201,function(_0x1bfef7){if(_0x1bfef7[_0x186e('0x33')]!==_0x186e('0x41')){var _0x835479={};_0x835479[_0x1bfef7[_0x186e('0x2c')]]={'$like':'%'+_0x4bd334[_0x186e('0x35')][_0x186e('0x3f')]+'%'};return _0x835479;}})});}_0x2b6b7a=_[_0x186e('0x40')]({},_0x2b6b7a,_0x4bd334[_0x186e('0x42')]);var _0x4746a3={'where':_0x2b6b7a['where']};return db[_0x186e('0x30')][_0x186e('0x24')](_0x4746a3)['then'](function(_0x5ed296){_0x3158ea[_0x186e('0x24')]=_0x5ed296;if(_0x4bd334[_0x186e('0x35')]['includeAll']){_0x2b6b7a['include']=[{'all':!![]}];}return db[_0x186e('0x30')][_0x186e('0x43')](_0x2b6b7a);})[_0x186e('0x14')](function(_0xd97bd0){_0x3158ea['rows']=_0xd97bd0;return _0x3158ea;})[_0x186e('0x14')](respondWithFilteredResult(_0x2ee3a5,_0x2b6b7a))[_0x186e('0x1e')](handleError(_0x2ee3a5,null));};exports[_0x186e('0x44')]=function(_0x3aadd5,_0x13a647){var _0x25a259={'raw':!![],'where':{'id':_0x3aadd5[_0x186e('0x45')]['id']}},_0x498702={};_0x498702[_0x186e('0x38')]=_[_0x186e('0x46')](db['MailMessage'][_0x186e('0x31')]);_0x498702['query']=_[_0x186e('0x46')](_0x3aadd5[_0x186e('0x35')]);_0x498702[_0x186e('0x36')]=_[_0x186e('0x37')](_0x498702[_0x186e('0x38')],_0x498702[_0x186e('0x35')]);_0x25a259[_0x186e('0x39')]=_[_0x186e('0x37')](_0x498702['model'],qs[_0x186e('0x3a')](_0x3aadd5[_0x186e('0x35')][_0x186e('0x3a')]));_0x25a259[_0x186e('0x39')]=_0x25a259[_0x186e('0x39')][_0x186e('0x3b')]?_0x25a259[_0x186e('0x39')]:_0x498702[_0x186e('0x38')];if(_0x3aadd5[_0x186e('0x35')][_0x186e('0x47')]){_0x25a259[_0x186e('0x48')]=[{'all':!![]}];}_0x25a259=_[_0x186e('0x40')]({},_0x25a259,_0x3aadd5[_0x186e('0x42')]);return db[_0x186e('0x30')]['find'](_0x25a259)['then'](handleEntityNotFound(_0x13a647,null))[_0x186e('0x14')](respondWithResult(_0x13a647,null))[_0x186e('0x1e')](handleError(_0x13a647,null));};exports[_0x186e('0x27')]=function(_0xfb05d8,_0x3ee62e){if(_0xfb05d8[_0x186e('0x49')]['id']){delete _0xfb05d8[_0x186e('0x49')]['id'];}return db[_0x186e('0x30')]['find']({'where':{'id':_0xfb05d8['params']['id']}})[_0x186e('0x14')](handleEntityNotFound(_0x3ee62e,null))['then'](saveUpdates(_0xfb05d8[_0x186e('0x49')],null))[_0x186e('0x14')](respondWithResult(_0x3ee62e,null))[_0x186e('0x1e')](handleError(_0x3ee62e,null));};exports['destroy']=function(_0x29876c,_0x582370){return db[_0x186e('0x30')][_0x186e('0x4a')]({'where':{'id':_0x29876c[_0x186e('0x45')]['id']}})[_0x186e('0x14')](handleEntityNotFound(_0x582370,null))[_0x186e('0x14')](removeEntity(_0x582370,null))[_0x186e('0x1e')](handleError(_0x582370,null));};exports[_0x186e('0x4b')]=function(_0x658b43,_0x169b38){return db[_0x186e('0x30')][_0x186e('0x4b')]()[_0x186e('0x14')](respondWithResult(_0x169b38,null))[_0x186e('0x1e')](handleError(_0x169b38,null));};exports['create']=function(_0x333340,_0x576abb){return db[_0x186e('0x30')][_0x186e('0x4c')](_0x333340[_0x186e('0x49')])[_0x186e('0x14')](function(_0x158b5c){if(_0x158b5c){if(_0x158b5c[_0x186e('0x4d')]===_0x186e('0x4e')&&!_0x158b5c[_0x186e('0x4f')]){var _0x472c82,_0x145fa5,_0x1d7c10;if(_0x333340[_0x186e('0x49')]['to']){_0x145fa5=_0x333340['body']['to'][_0x186e('0x50')](',')[0x0];}return db[_0x186e('0x51')][_0x186e('0x52')]({'where':{'id':_0x158b5c[_0x186e('0x53')]},'include':[{'model':db[_0x186e('0x54')],'as':'List','include':[{'model':db[_0x186e('0x55')],'as':_0x186e('0x56'),'where':{'email':_0x145fa5},'limit':0x1,'order':[['updatedAt',_0x186e('0x57')]]}]},{'model':db['MailServerOut'],'as':_0x186e('0x58'),'raw':!![],'include':[{'model':db[_0x186e('0x59')],'as':_0x186e('0x59'),'raw':!![]}]}]})['then'](function(_0x42f7e3){_0x472c82=_0x42f7e3;if(!_0x472c82||!_0x472c82[_0x186e('0x58')])return;var _0x5cb476=_0x472c82[_0x186e('0x5a')]();if(_0x333340[_0x186e('0x49')][_0x186e('0x5b')]&&_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x186e('0x3b')]){for(var _0x431cd2=0x0;_0x431cd2<_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x186e('0x3b')];_0x431cd2+=0x1){_0x333340[_0x186e('0x49')]['attachments'][_0x431cd2]={'filename':_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x431cd2]['name'],'path':path['join'](config[_0x186e('0x5c')],'server/files/attachments',_0x333340[_0x186e('0x49')][_0x186e('0x5b')][_0x431cd2][_0x186e('0x5d')])};}}_0x1d7c10={'account':_0x5cb476,'message':_0x333340[_0x186e('0x49')]};return;})[_0x186e('0x14')](function(){if(_0x472c82[_0x186e('0x5e')]){if(_0x472c82[_0x186e('0x5e')][_0x186e('0x56')][_0x186e('0x3b')]){return _0x472c82['List'][_0x186e('0x56')][0x0];}else{return db[_0x186e('0x55')][_0x186e('0x4c')](_[_0x186e('0xc')](_0x333340['body'],{'firstName':_0x333340[_0x186e('0x49')]['to'],'email':_0x333340['body']['to'],'phone':_0x333340[_0x186e('0x49')]['to'],'ListId':_0x472c82[_0x186e('0x5f')]}));}}else{throw new Error(_0x186e('0x60'));}})[_0x186e('0x14')](function(){if(_0x1d7c10){return respondWithRpcPromise(_0x186e('0x61'),_0x186e('0x62'),_0x1d7c10,client9003)['then'](function(_0x25034a){return _0x158b5c[_0x186e('0x27')]({'read':!![],'messageId':_0x25034a[_0x186e('0x63')],'sentAt':moment()[_0x186e('0x64')](_0x186e('0x65'))});})['catch'](function(_0x3acb6e){logger['error']('%s',JSON[_0x186e('0x18')](_0x3acb6e));return _0x158b5c;});}return _0x158b5c;});}return _0x158b5c;}})[_0x186e('0x14')](respondWithResult(_0x576abb,0xc9))['catch'](handleError(_0x576abb,null));};exports[_0x186e('0x66')]=function(_0x51b802,_0x54df9c){var _0xb39ace={'agent':{},'channel':'mail'};if(_0x51b802[_0x186e('0x49')]['id']){delete _0x51b802[_0x186e('0x49')]['id'];}_0x51b802['body']['read']=!![];_0x51b802[_0x186e('0x49')]['readAt']=moment()[_0x186e('0x64')](_0x186e('0x65'));_0x51b802[_0x186e('0x49')]['UserId']=_0x51b802[_0x186e('0x49')][_0x186e('0x67')]||_0x51b802[_0x186e('0x68')]['id'];_0xb39ace[_0x186e('0x69')]['id']=_0x51b802[_0x186e('0x49')][_0x186e('0x67')];return db['MailMessage'][_0x186e('0x4a')]({'where':{'id':_0x51b802[_0x186e('0x45')]['id'],'UserId':null}})[_0x186e('0x14')](handleEntityNotFound(_0x54df9c,null))[_0x186e('0x14')](saveUpdates(_0x51b802[_0x186e('0x49')],null))[_0x186e('0x14')](function(_0x14aab6){if(_0x14aab6){_0xb39ace[_0x186e('0x1b')]=_0x14aab6[_0x186e('0x6a')]({'plain':!![]});return db[_0x186e('0x6b')][_0x186e('0x4a')]({'where':{'id':_0x14aab6[_0x186e('0x6c')]}});}return null;})[_0x186e('0x14')](handleEntityNotFound(_0x54df9c,null))['then'](function(_0x438acb){if(_0x438acb){return _0x438acb[_0x186e('0x27')]({'UserId':_0x51b802[_0x186e('0x49')][_0x186e('0x67')],'read1stAt':_[_0x186e('0x6d')](_0x438acb[_0x186e('0x6e')])?moment()[_0x186e('0x64')](_0x186e('0x65')):undefined});}return null;})[_0x186e('0x14')](function(_0x69f9d6){if(_0x69f9d6){_0xb39ace[_0x186e('0x6f')]=_0x69f9d6[_0x186e('0x6a')]({'plain':!![]});interaction_log[_0x186e('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51b802[_0x186e('0x68')]['id'],_0x51b802[_0x186e('0x68')][_0x186e('0x2c')],_0x51b802[_0x186e('0x68')][_0x186e('0x70')],_0xb39ace[_0x186e('0x6f')]['id'],_0x51b802[_0x186e('0x49')]?JSON[_0x186e('0x18')](_0x51b802['body']):_0x186e('0x71'));return respondWithRpcPromise(_0x186e('0x72'),_0x186e('0x73'),_0xb39ace);}return null;})[_0x186e('0x14')](function(_0x4650c4){var _0x61b9ef=_0x186e('0x74')+_0x4650c4[_0x186e('0x1b')][_0x186e('0x75')];return db[_0x186e('0x76')][_0x186e('0x35')](_0x61b9ef,{'type':db[_0x186e('0x77')][_0x186e('0x78')][_0x186e('0x79')],'raw':!![]})[_0x186e('0x14')](function(_0x266fa6){return _0x266fa6;});})[_0x186e('0x14')](function(_0x591af3){if(_0x591af3){_0xb39ace[_0x186e('0x1b')][_0x186e('0x7a')]=_0x591af3[0x0];if(!_0x51b802[_0x186e('0x49')][_0x186e('0x67')])return;return db[_0x186e('0x7b')]['find']({'where':{'id':_0x51b802['body']['UserId'],'role':_0x186e('0x69')},'attributes':['id',_0x186e('0x2c'),_0x186e('0x7c'),'email',_0x186e('0x7d')],'raw':!![]});}return null;})[_0x186e('0x14')](function(_0x3ef2df){if(!_0x3ef2df)return null;_0xb39ace[_0x186e('0x1b')][_0x186e('0x69')]=_0x3ef2df;return _0xb39ace;})[_0x186e('0x14')](function(_0x3beb5b){if(_0x3beb5b){if(_0x51b802['body'][_0x186e('0x7e')]){_0xb39ace[_0x186e('0x1b')][_0x186e('0x7f')]=util[_0x186e('0x64')](_0x186e('0x80'),_0x51b802[_0x186e('0x68')][_0x186e('0x2c')]);_0xb39ace['message'][_0x186e('0x81')]=_0xb39ace[_0x186e('0x81')];_0xb39ace[_0x186e('0x1b')][_0x186e('0x82')]=_0xb39ace[_0x186e('0x81')];_0xb39ace[_0x186e('0x1b')]['event']=_0x186e('0x66');_0xb39ace['message']['body']=htmlToText[_0x186e('0x83')](_0xb39ace['message'][_0x186e('0x49')]);return respondWithRpcPromise(_0x186e('0x84'),_0x186e('0x84'),{'event':_0x186e('0x85'),'message':_0xb39ace['message']},client9002)[_0x186e('0x14')](function(){return _0xb39ace;});}return _0xb39ace;}return null;})[_0x186e('0x14')](respondWithResult(_0x54df9c,null))[_0x186e('0x1e')](handleError(_0x54df9c,null));};exports[_0x186e('0x86')]=function(_0x4649d4,_0x3f3f1f){var _0x400a96={'agent':{},'channel':_0x186e('0x87')};if(_0x4649d4[_0x186e('0x49')]['id']){delete _0x4649d4[_0x186e('0x49')]['id'];}_0x4649d4[_0x186e('0x49')][_0x186e('0x67')]=_0x4649d4[_0x186e('0x49')][_0x186e('0x67')]||_0x4649d4[_0x186e('0x68')]['id'];_0x400a96['agent']['id']=_0x4649d4['body']['UserId'];return db[_0x186e('0x30')][_0x186e('0x4a')]({'where':{'id':_0x4649d4[_0x186e('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3f3f1f,null))[_0x186e('0x14')](function(_0xc3005a){if(_0xc3005a){_0x400a96['message']=_0xc3005a[_0x186e('0x6a')]({'plain':!![]});return db[_0x186e('0x6b')][_0x186e('0x4a')]({'where':{'id':_0xc3005a['MailInteractionId']}});}return null;})[_0x186e('0x14')](handleEntityNotFound(_0x3f3f1f,null))['then'](function(_0x1bf97f){if(_0x1bf97f){_0x400a96[_0x186e('0x6f')]=_0x1bf97f['get']({'plain':!![]});interaction_log[_0x186e('0x1c')](_0x186e('0x88'),_0x4649d4['user']['id'],_0x4649d4[_0x186e('0x68')][_0x186e('0x2c')],_0x4649d4[_0x186e('0x68')][_0x186e('0x70')],_0x400a96[_0x186e('0x6f')]['id'],_0x4649d4['body']?JSON[_0x186e('0x18')](_0x4649d4[_0x186e('0x49')]):'null');return respondWithRpcPromise('RejectMessage',_0x186e('0x89'),_0x400a96);}return null;})[_0x186e('0x14')](function(_0x532f90){var _0x1d3c1f=_0x186e('0x74')+_0x532f90[_0x186e('0x1b')][_0x186e('0x75')];return db[_0x186e('0x76')]['query'](_0x1d3c1f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x186e('0x14')](function(_0x3a9827){return _0x3a9827;});})[_0x186e('0x14')](function(_0x5164f1){if(_0x5164f1){_0x400a96[_0x186e('0x1b')][_0x186e('0x7a')]=_0x5164f1[0x0];if(!_0x4649d4['body']['UserId'])return;return db[_0x186e('0x7b')][_0x186e('0x4a')]({'where':{'id':_0x4649d4[_0x186e('0x49')]['UserId'],'role':_0x186e('0x69')},'attributes':['id',_0x186e('0x2c'),'fullname',_0x186e('0x8a'),_0x186e('0x7d')],'raw':!![]});}return null;})[_0x186e('0x14')](function(_0xc104e2){if(!_0xc104e2)return null;_0x400a96[_0x186e('0x1b')][_0x186e('0x69')]=_0xc104e2;return _0x400a96;})['then'](function(_0x27c73a){if(_0x27c73a){_0x27c73a[_0x186e('0x1b')][_0x186e('0x7f')]=util[_0x186e('0x64')](_0x186e('0x80'),_0x4649d4[_0x186e('0x68')]['name']);_0x27c73a['message']['channel']=_0x400a96[_0x186e('0x81')];_0x27c73a[_0x186e('0x1b')][_0x186e('0x82')]=_0x400a96[_0x186e('0x81')];_0x27c73a[_0x186e('0x1b')][_0x186e('0x8b')]='reject';_0x27c73a[_0x186e('0x1b')]['body']=htmlToText[_0x186e('0x83')](_0x400a96['message'][_0x186e('0x49')]);respondWithRpcPromise(_0x186e('0x84'),_0x186e('0x84'),{'event':_0x186e('0x8c'),'message':_0x27c73a['message']},client9002);return _0x400a96;}return null;})['then'](respondWithResult(_0x3f3f1f,null))[_0x186e('0x1e')](handleError(_0x3f3f1f,null));};exports['download']=function(_0x1b379c,_0x4baeb3){var _0x56c003=moment()['unix']()[_0x186e('0x8d')]();var _0x587257=path[_0x186e('0x8e')](config[_0x186e('0x5c')],_0x186e('0x8f'),_0x186e('0x90'),_0x186e('0x91'));var _0x1b59fa=path[_0x186e('0x8e')](config[_0x186e('0x5c')],_0x186e('0x8f'),_0x186e('0x90'),'attachments');var _0x2c9cd8=util['format']('message-%s.eml',_0x56c003);return db['MailMessage'][_0x186e('0x4a')]({'where':{'id':_0x1b379c[_0x186e('0x45')]['id']},'attributes':['id',_0x186e('0x49'),_0x186e('0x92'),'to','cc','bcc','subject',_0x186e('0x93')],'include':_0x1b379c[_0x186e('0x35')]['attachments']?[{'model':db[_0x186e('0x94')],'as':'Attachments'}]:undefined})[_0x186e('0x14')](handleEntityNotFound(_0x4baeb3,null))['then'](function(_0x36a9fe){if(_0x36a9fe){var _0x682ea=_0x36a9fe;var _0x343acf={'from':_0x682ea[_0x186e('0x92')],'to':_0x682ea['to'],'subject':_0x682ea['subject'],'html':htmlEntities['decode'](_0x682ea[_0x186e('0x49')]),'headers':{'Date':moment(_0x682ea[_0x186e('0x93')])[_0x186e('0x64')](_0x186e('0x95'))},'attachments':[]};if(_0x36a9fe['cc']){_0x343acf[_0x186e('0x96')]['Cc']=_0x36a9fe['cc'];}if(_0x36a9fe[_0x186e('0x97')]){_0x343acf[_0x186e('0x96')][_0x186e('0x98')]=_0x36a9fe[_0x186e('0x97')];}return new BPromise(function(_0x42a603,_0x3430ce){if(_0x36a9fe[_0x186e('0x99')]){for(var _0x23316d=0x0;_0x23316d<_0x36a9fe['Attachments']['length'];_0x23316d++){var _0x7630e4=_0x36a9fe[_0x186e('0x99')][_0x23316d];var _0x34b0bb=path[_0x186e('0x8e')](_0x1b59fa,_0x7630e4['basename']);if(fs[_0x186e('0x9a')](_0x34b0bb)){_0x343acf[_0x186e('0x5b')]['push']({'name':_0x7630e4[_0x186e('0x2c')],'contentType':_0x7630e4[_0x186e('0x33')],'data':fs[_0x186e('0x9b')](_0x34b0bb)});}}}emlformat['build'](_0x343acf,function(_0x463b8a,_0x572163){if(_0x463b8a)return _0x3430ce(_0x463b8a);fs['writeFileSync'](path[_0x186e('0x8e')](_0x587257,_0x2c9cd8),_0x572163);return _0x42a603(_0x572163);});});}})[_0x186e('0x14')](function(_0x2ef61c){if(_0x2ef61c){return _0x4baeb3[_0x186e('0x9c')](path['join'](_0x587257,_0x2c9cd8),_0x2c9cd8,function(_0x7a6c1a){if(!_0x7a6c1a)fs[_0x186e('0x9d')](path[_0x186e('0x8e')](_0x587257,_0x2c9cd8));});}})[_0x186e('0x1e')](handleError(_0x4baeb3,null));}; \ No newline at end of file +var _0xd647=['motionChannel','event','accept','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','Sequelize','User','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','offset','limit','undefined','count','set','json','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','show','params','includeAll','merge','find','update','destroy','describe','body','direction','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','CloudProvider','getSmtpOptions','attachments','join','basename','create','ListId','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','readAt','UserId','user','agent','MailInteraction','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel'];(function(_0x4972ba,_0x3c1e52){var _0x295476=function(_0x535a9e){while(--_0x535a9e){_0x4972ba['push'](_0x4972ba['shift']());}};_0x295476(++_0x3c1e52);}(_0xd647,0xb8));var _0x7d64=function(_0x4d7241,_0x32aa1f){_0x4d7241=_0x4d7241-0x0;var _0x59d9e2=_0xd647[_0x4d7241];return _0x59d9e2;};'use strict';var emlformat=require(_0x7d64('0x0'));var moment=require(_0x7d64('0x1'));var BPromise=require(_0x7d64('0x2'));var util=require('util');var path=require(_0x7d64('0x3'));var fs=require('fs');var _=require(_0x7d64('0x4'));var Redis=require(_0x7d64('0x5'));var htmlToText=require(_0x7d64('0x6'));var qs=require(_0x7d64('0x7'));var logger=require(_0x7d64('0x8'))(_0x7d64('0x9'));var interaction_log=require(_0x7d64('0x8'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x7d64('0xa'))['db'];config[_0x7d64('0xb')]=_['defaults'](config[_0x7d64('0xb')],{'host':_0x7d64('0xc'),'port':0x18eb});var socket=require(_0x7d64('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x7d64('0xe'));require(_0x7d64('0xf'))[_0x7d64('0x10')](socket);var jayson=require(_0x7d64('0x11'));var client=jayson[_0x7d64('0x12')][_0x7d64('0x13')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x7d64('0x12')][_0x7d64('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x3db734,_0x34b917,_0x2ed0aa,_0x32c2c2){return new BPromise(function(_0x250f04,_0x10c586){var _0x1be0fb=_0x32c2c2||client;return _0x1be0fb[_0x7d64('0x14')](_0x3db734,_0x2ed0aa)[_0x7d64('0x15')](function(_0x5cd18e){logger[_0x7d64('0x16')](_0x7d64('0x17'),_0x34b917,'request\x20sent');logger['debug'](_0x7d64('0x18'),_0x34b917,_0x7d64('0x19'),JSON[_0x7d64('0x1a')](_0x5cd18e));if(_0x5cd18e[_0x7d64('0x1b')]){if(_0x5cd18e[_0x7d64('0x1b')]['code']===0x1f4){logger[_0x7d64('0x1b')](_0x7d64('0x17'),_0x34b917,_0x5cd18e['error'][_0x7d64('0x1c')]);return _0x10c586(_0x5cd18e[_0x7d64('0x1b')][_0x7d64('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x34b917,_0x5cd18e[_0x7d64('0x1b')][_0x7d64('0x1c')]);return _0x250f04(_0x5cd18e['error'][_0x7d64('0x1c')]);}else{logger[_0x7d64('0x16')](_0x7d64('0x17'),_0x34b917,_0x7d64('0x19'));_0x250f04(_0x5cd18e['result'][_0x7d64('0x1c')]);}})[_0x7d64('0x1d')](function(_0x2db5df){logger['error'](_0x7d64('0x17'),_0x34b917,_0x2db5df);_0x10c586(_0x2db5df);});});}function respondWithResult(_0x2cbf33,_0x293098){_0x293098=_0x293098||0xc8;return function(_0x1027c2){if(_0x1027c2){return _0x2cbf33[_0x7d64('0x1e')](_0x293098)['json'](_0x1027c2);}};}function respondWithFilteredResult(_0x37f69c,_0x119397){return function(_0x2e7b1d){if(_0x2e7b1d){var _0x8c877=typeof _0x119397[_0x7d64('0x1f')]==='undefined'&&typeof _0x119397[_0x7d64('0x20')]===_0x7d64('0x21');var _0x3bb94d=_0x2e7b1d[_0x7d64('0x22')];var _0x3f81cb=_0x8c877?0x0:_0x119397[_0x7d64('0x1f')];var _0x3929d0=_0x8c877?_0x2e7b1d['count']:_0x119397['offset']+_0x119397[_0x7d64('0x20')];var _0x1705b4;if(_0x3929d0>=_0x3bb94d){_0x3929d0=_0x3bb94d;_0x1705b4=0xc8;}else{_0x1705b4=0xce;}_0x37f69c[_0x7d64('0x1e')](_0x1705b4);return _0x37f69c[_0x7d64('0x23')]('Content-Range',_0x3f81cb+'-'+_0x3929d0+'/'+_0x3bb94d)[_0x7d64('0x24')](_0x2e7b1d);}return null;};}function saveUpdates(_0x52f6de){return function(_0x41542b){if(_0x41542b){return _0x41542b['update'](_0x52f6de)[_0x7d64('0x15')](function(_0x4d106f){return _0x4d106f;});}return null;};}function removeEntity(_0x3c459f){return function(_0x1597fa){if(_0x1597fa){return _0x1597fa['destroy']()[_0x7d64('0x15')](function(){_0x3c459f[_0x7d64('0x1e')](0xcc)[_0x7d64('0x25')]();});}};}function handleEntityNotFound(_0x21c8f6){return function(_0x3c3979){if(!_0x3c3979){_0x21c8f6[_0x7d64('0x26')](0x194);}return _0x3c3979;};}function handleError(_0x59296f,_0x368d93){_0x368d93=_0x368d93||0x1f4;return function(_0x3512fc){logger[_0x7d64('0x1b')](_0x3512fc[_0x7d64('0x27')]);if(_0x3512fc[_0x7d64('0x28')]){delete _0x3512fc['name'];}_0x59296f[_0x7d64('0x1e')](_0x368d93)[_0x7d64('0x29')](_0x3512fc);};}exports['index']=function(_0x9df5f7,_0x49d16c){var _0x186722={},_0x1c65cf={},_0x336b2d={'count':0x0,'rows':[]};var _0x25107f=_[_0x7d64('0x2a')](db[_0x7d64('0x2b')][_0x7d64('0x2c')],function(_0x5c7405){return{'name':_0x5c7405['fieldName'],'type':_0x5c7405['type'][_0x7d64('0x2d')]};});_0x1c65cf[_0x7d64('0x2e')]=_[_0x7d64('0x2a')](_0x25107f,_0x7d64('0x28'));_0x1c65cf['query']=_[_0x7d64('0x2f')](_0x9df5f7[_0x7d64('0x30')]);_0x1c65cf[_0x7d64('0x31')]=_[_0x7d64('0x32')](_0x1c65cf['model'],_0x1c65cf[_0x7d64('0x30')]);_0x186722['attributes']=_['intersection'](_0x1c65cf[_0x7d64('0x2e')],qs[_0x7d64('0x33')](_0x9df5f7[_0x7d64('0x30')][_0x7d64('0x33')]));_0x186722[_0x7d64('0x34')]=_0x186722[_0x7d64('0x34')][_0x7d64('0x35')]?_0x186722[_0x7d64('0x34')]:_0x1c65cf[_0x7d64('0x2e')];if(!_0x9df5f7[_0x7d64('0x30')][_0x7d64('0x36')]('nolimit')){_0x186722[_0x7d64('0x20')]=qs['limit'](_0x9df5f7['query'][_0x7d64('0x20')]);_0x186722['offset']=qs[_0x7d64('0x1f')](_0x9df5f7[_0x7d64('0x30')]['offset']);}_0x186722[_0x7d64('0x37')]=qs[_0x7d64('0x38')](_0x9df5f7['query'][_0x7d64('0x38')]);_0x186722[_0x7d64('0x39')]=qs[_0x7d64('0x31')](_[_0x7d64('0x3a')](_0x9df5f7[_0x7d64('0x30')],_0x1c65cf[_0x7d64('0x31')]),_0x25107f);if(_0x9df5f7['query'][_0x7d64('0x3b')]){_0x186722['where']=_['merge'](_0x186722[_0x7d64('0x39')],{'$or':_['map'](_0x25107f,function(_0x250531){if(_0x250531[_0x7d64('0x3c')]!==_0x7d64('0x3d')){var _0x135151={};_0x135151[_0x250531[_0x7d64('0x28')]]={'$like':'%'+_0x9df5f7['query'][_0x7d64('0x3b')]+'%'};return _0x135151;}})});}_0x186722=_['merge']({},_0x186722,_0x9df5f7[_0x7d64('0x3e')]);var _0x4af5a4={'where':_0x186722['where']};return db[_0x7d64('0x2b')]['count'](_0x4af5a4)[_0x7d64('0x15')](function(_0x3c5508){_0x336b2d[_0x7d64('0x22')]=_0x3c5508;if(_0x9df5f7['query']['includeAll']){_0x186722[_0x7d64('0x3f')]=[{'all':!![]}];}return db[_0x7d64('0x2b')][_0x7d64('0x40')](_0x186722);})['then'](function(_0x10e317){_0x336b2d['rows']=_0x10e317;return _0x336b2d;})['then'](respondWithFilteredResult(_0x49d16c,_0x186722))[_0x7d64('0x1d')](handleError(_0x49d16c,null));};exports[_0x7d64('0x41')]=function(_0x143cc5,_0x8f506c){var _0x2fb4ee={'raw':!![],'where':{'id':_0x143cc5[_0x7d64('0x42')]['id']}},_0x46c151={};_0x46c151[_0x7d64('0x2e')]=_[_0x7d64('0x2f')](db['MailMessage']['rawAttributes']);_0x46c151[_0x7d64('0x30')]=_[_0x7d64('0x2f')](_0x143cc5['query']);_0x46c151[_0x7d64('0x31')]=_[_0x7d64('0x32')](_0x46c151[_0x7d64('0x2e')],_0x46c151[_0x7d64('0x30')]);_0x2fb4ee[_0x7d64('0x34')]=_[_0x7d64('0x32')](_0x46c151[_0x7d64('0x2e')],qs[_0x7d64('0x33')](_0x143cc5[_0x7d64('0x30')]['fields']));_0x2fb4ee[_0x7d64('0x34')]=_0x2fb4ee[_0x7d64('0x34')]['length']?_0x2fb4ee[_0x7d64('0x34')]:_0x46c151[_0x7d64('0x2e')];if(_0x143cc5[_0x7d64('0x30')][_0x7d64('0x43')]){_0x2fb4ee[_0x7d64('0x3f')]=[{'all':!![]}];}_0x2fb4ee=_[_0x7d64('0x44')]({},_0x2fb4ee,_0x143cc5[_0x7d64('0x3e')]);return db[_0x7d64('0x2b')][_0x7d64('0x45')](_0x2fb4ee)[_0x7d64('0x15')](handleEntityNotFound(_0x8f506c,null))[_0x7d64('0x15')](respondWithResult(_0x8f506c,null))[_0x7d64('0x1d')](handleError(_0x8f506c,null));};exports[_0x7d64('0x46')]=function(_0x55df46,_0x348481){if(_0x55df46['body']['id']){delete _0x55df46['body']['id'];}return db[_0x7d64('0x2b')]['find']({'where':{'id':_0x55df46['params']['id']}})['then'](handleEntityNotFound(_0x348481,null))['then'](saveUpdates(_0x55df46['body'],null))['then'](respondWithResult(_0x348481,null))['catch'](handleError(_0x348481,null));};exports[_0x7d64('0x47')]=function(_0x2ed4cd,_0x34b031){return db['MailMessage'][_0x7d64('0x45')]({'where':{'id':_0x2ed4cd[_0x7d64('0x42')]['id']}})['then'](handleEntityNotFound(_0x34b031,null))[_0x7d64('0x15')](removeEntity(_0x34b031,null))[_0x7d64('0x1d')](handleError(_0x34b031,null));};exports[_0x7d64('0x48')]=function(_0xdfd3de,_0x2549fd){return db[_0x7d64('0x2b')][_0x7d64('0x48')]()['then'](respondWithResult(_0x2549fd,null))[_0x7d64('0x1d')](handleError(_0x2549fd,null));};exports['create']=function(_0x372b1a,_0x12bbaf){return db['MailMessage']['create'](_0x372b1a[_0x7d64('0x49')])[_0x7d64('0x15')](function(_0x3a0d6b){if(_0x3a0d6b){if(_0x3a0d6b[_0x7d64('0x4a')]==='out'&&!_0x3a0d6b[_0x7d64('0x4b')]){var _0x455b8e,_0x197812,_0x5754fc;if(_0x372b1a['body']['to']){_0x197812=_0x372b1a[_0x7d64('0x49')]['to']['split'](',')[0x0];}return db[_0x7d64('0x4c')][_0x7d64('0x4d')]({'where':{'id':_0x3a0d6b['MailAccountId']},'include':[{'model':db[_0x7d64('0x4e')],'as':_0x7d64('0x4f'),'include':[{'model':db[_0x7d64('0x50')],'as':_0x7d64('0x51'),'where':{'email':_0x197812},'limit':0x1,'order':[[_0x7d64('0x52'),'DESC']]}]},{'model':db[_0x7d64('0x53')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7d64('0x54')],'as':_0x7d64('0x54'),'raw':!![]}]}]})[_0x7d64('0x15')](function(_0x354d58){_0x455b8e=_0x354d58;if(!_0x455b8e||!_0x455b8e['Smtp'])return;var _0x49cdae=_0x455b8e[_0x7d64('0x55')]();if(_0x372b1a[_0x7d64('0x49')][_0x7d64('0x56')]&&_0x372b1a[_0x7d64('0x49')][_0x7d64('0x56')][_0x7d64('0x35')]){for(var _0x57e970=0x0;_0x57e970<_0x372b1a[_0x7d64('0x49')][_0x7d64('0x56')][_0x7d64('0x35')];_0x57e970+=0x1){_0x372b1a['body'][_0x7d64('0x56')][_0x57e970]={'filename':_0x372b1a[_0x7d64('0x49')][_0x7d64('0x56')][_0x57e970][_0x7d64('0x28')],'path':path[_0x7d64('0x57')](config['root'],'server/files/attachments',_0x372b1a['body'][_0x7d64('0x56')][_0x57e970][_0x7d64('0x58')])};}}_0x5754fc={'account':_0x49cdae,'message':_0x372b1a['body']};return;})[_0x7d64('0x15')](function(){if(_0x455b8e[_0x7d64('0x4f')]){if(_0x455b8e[_0x7d64('0x4f')][_0x7d64('0x51')][_0x7d64('0x35')]){return _0x455b8e['List'][_0x7d64('0x51')][0x0];}else{return db[_0x7d64('0x50')][_0x7d64('0x59')](_['defaults'](_0x372b1a['body'],{'firstName':_0x372b1a[_0x7d64('0x49')]['to'],'email':_0x372b1a[_0x7d64('0x49')]['to'],'phone':_0x372b1a['body']['to'],'ListId':_0x455b8e[_0x7d64('0x5a')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x7d64('0x15')](function(){if(_0x5754fc){return respondWithRpcPromise('SendMail',_0x7d64('0x5b'),_0x5754fc,client9003)[_0x7d64('0x15')](function(_0x4c497b){return _0x3a0d6b[_0x7d64('0x46')]({'read':!![],'messageId':_0x4c497b[_0x7d64('0x5c')],'sentAt':moment()[_0x7d64('0x5d')](_0x7d64('0x5e'))});})['catch'](function(_0x2baf02){logger[_0x7d64('0x1b')]('%s',JSON[_0x7d64('0x1a')](_0x2baf02));return _0x3a0d6b;});}return _0x3a0d6b;});}return _0x3a0d6b;}})[_0x7d64('0x15')](respondWithResult(_0x12bbaf,0xc9))[_0x7d64('0x1d')](handleError(_0x12bbaf,null));};exports['accept']=function(_0x285526,_0x834ddb){var _0x23a92a={'agent':{},'channel':'mail'};if(_0x285526['body']['id']){delete _0x285526[_0x7d64('0x49')]['id'];}_0x285526[_0x7d64('0x49')][_0x7d64('0x5f')]=!![];_0x285526['body'][_0x7d64('0x60')]=moment()['format'](_0x7d64('0x5e'));_0x285526[_0x7d64('0x49')][_0x7d64('0x61')]=_0x285526[_0x7d64('0x49')][_0x7d64('0x61')]||_0x285526[_0x7d64('0x62')]['id'];_0x23a92a[_0x7d64('0x63')]['id']=_0x285526[_0x7d64('0x49')][_0x7d64('0x61')];return db['MailMessage']['find']({'where':{'id':_0x285526['params']['id'],'UserId':null}})[_0x7d64('0x15')](handleEntityNotFound(_0x834ddb,null))['then'](saveUpdates(_0x285526[_0x7d64('0x49')],null))[_0x7d64('0x15')](function(_0x556f99){if(_0x556f99){_0x23a92a[_0x7d64('0x1c')]=_0x556f99['get']({'plain':!![]});return db[_0x7d64('0x64')]['find']({'where':{'id':_0x556f99['MailInteractionId']}});}return null;})[_0x7d64('0x15')](handleEntityNotFound(_0x834ddb,null))[_0x7d64('0x15')](function(_0x4e5489){if(_0x4e5489){return _0x4e5489[_0x7d64('0x46')]({'UserId':_0x285526['body']['UserId'],'read1stAt':_['isNil'](_0x4e5489[_0x7d64('0x65')])?moment()[_0x7d64('0x5d')](_0x7d64('0x5e')):undefined});}return null;})['then'](function(_0x182d2d){if(_0x182d2d){_0x23a92a[_0x7d64('0x66')]=_0x182d2d[_0x7d64('0x67')]({'plain':!![]});interaction_log[_0x7d64('0x16')](_0x7d64('0x68'),_0x285526[_0x7d64('0x62')]['id'],_0x285526[_0x7d64('0x62')][_0x7d64('0x28')],_0x285526[_0x7d64('0x62')][_0x7d64('0x69')],_0x23a92a['interaction']['id'],_0x285526[_0x7d64('0x49')]?JSON[_0x7d64('0x1a')](_0x285526['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x23a92a);}return null;})[_0x7d64('0x15')](function(_0x84e1b8){var _0x4d0f27=_0x7d64('0x6a')+_0x84e1b8['message'][_0x7d64('0x6b')];return db[_0x7d64('0x6c')][_0x7d64('0x30')](_0x4d0f27,{'type':db['Sequelize'][_0x7d64('0x6d')][_0x7d64('0x6e')],'raw':!![]})['then'](function(_0x6c95ca){return _0x6c95ca;});})['then'](function(_0x2cc92c){if(_0x2cc92c){_0x23a92a[_0x7d64('0x1c')][_0x7d64('0x6f')]=_0x2cc92c[0x0];if(!_0x285526[_0x7d64('0x49')]['UserId'])return;return db['User']['find']({'where':{'id':_0x285526[_0x7d64('0x49')][_0x7d64('0x61')],'role':_0x7d64('0x63')},'attributes':['id',_0x7d64('0x28'),_0x7d64('0x70'),_0x7d64('0x71'),_0x7d64('0x72')],'raw':!![]});}return null;})[_0x7d64('0x15')](function(_0x156b38){if(!_0x156b38)return null;_0x23a92a[_0x7d64('0x1c')]['agent']=_0x156b38;return _0x23a92a;})[_0x7d64('0x15')](function(_0x27eb8a){if(_0x27eb8a){if(_0x285526[_0x7d64('0x49')]['manual']){_0x23a92a[_0x7d64('0x1c')][_0x7d64('0x73')]=util[_0x7d64('0x5d')](_0x7d64('0x74'),_0x285526[_0x7d64('0x62')][_0x7d64('0x28')]);_0x23a92a[_0x7d64('0x1c')]['channel']=_0x23a92a[_0x7d64('0x75')];_0x23a92a[_0x7d64('0x1c')][_0x7d64('0x76')]=_0x23a92a[_0x7d64('0x75')];_0x23a92a['message'][_0x7d64('0x77')]=_0x7d64('0x78');_0x23a92a[_0x7d64('0x1c')][_0x7d64('0x49')]=htmlToText[_0x7d64('0x79')](_0x23a92a['message'][_0x7d64('0x49')]);return respondWithRpcPromise(_0x7d64('0x7a'),_0x7d64('0x7a'),{'event':'acceptmessage','message':_0x23a92a[_0x7d64('0x1c')]},client9002)[_0x7d64('0x15')](function(){return _0x23a92a;});}return _0x23a92a;}return null;})[_0x7d64('0x15')](respondWithResult(_0x834ddb,null))['catch'](handleError(_0x834ddb,null));};exports[_0x7d64('0x7b')]=function(_0x1a308e,_0x2d138c){var _0x152bc9={'agent':{},'channel':'mail'};if(_0x1a308e[_0x7d64('0x49')]['id']){delete _0x1a308e['body']['id'];}_0x1a308e[_0x7d64('0x49')]['UserId']=_0x1a308e[_0x7d64('0x49')][_0x7d64('0x61')]||_0x1a308e[_0x7d64('0x62')]['id'];_0x152bc9[_0x7d64('0x63')]['id']=_0x1a308e[_0x7d64('0x49')][_0x7d64('0x61')];return db['MailMessage']['find']({'where':{'id':_0x1a308e[_0x7d64('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d138c,null))['then'](function(_0x29ee99){if(_0x29ee99){_0x152bc9[_0x7d64('0x1c')]=_0x29ee99[_0x7d64('0x67')]({'plain':!![]});return db[_0x7d64('0x64')]['find']({'where':{'id':_0x29ee99['MailInteractionId']}});}return null;})[_0x7d64('0x15')](handleEntityNotFound(_0x2d138c,null))[_0x7d64('0x15')](function(_0x2cb594){if(_0x2cb594){_0x152bc9[_0x7d64('0x66')]=_0x2cb594[_0x7d64('0x67')]({'plain':!![]});interaction_log[_0x7d64('0x16')](_0x7d64('0x7c'),_0x1a308e[_0x7d64('0x62')]['id'],_0x1a308e['user'][_0x7d64('0x28')],_0x1a308e[_0x7d64('0x62')]['role'],_0x152bc9[_0x7d64('0x66')]['id'],_0x1a308e[_0x7d64('0x49')]?JSON[_0x7d64('0x1a')](_0x1a308e[_0x7d64('0x49')]):_0x7d64('0x7d'));return respondWithRpcPromise('RejectMessage',_0x7d64('0x7e'),_0x152bc9);}return null;})[_0x7d64('0x15')](function(_0x47ccb1){var _0x575ccb=_0x7d64('0x6a')+_0x47ccb1[_0x7d64('0x1c')]['ContactId'];return db[_0x7d64('0x6c')][_0x7d64('0x30')](_0x575ccb,{'type':db[_0x7d64('0x7f')]['QueryTypes'][_0x7d64('0x6e')],'raw':!![]})[_0x7d64('0x15')](function(_0x1bd28a){return _0x1bd28a;});})[_0x7d64('0x15')](function(_0x312b76){if(_0x312b76){_0x152bc9['message'][_0x7d64('0x6f')]=_0x312b76[0x0];if(!_0x1a308e['body'][_0x7d64('0x61')])return;return db[_0x7d64('0x80')]['find']({'where':{'id':_0x1a308e[_0x7d64('0x49')][_0x7d64('0x61')],'role':_0x7d64('0x63')},'attributes':['id',_0x7d64('0x28'),_0x7d64('0x70'),_0x7d64('0x71'),_0x7d64('0x72')],'raw':!![]});}return null;})[_0x7d64('0x15')](function(_0x910eb9){if(!_0x910eb9)return null;_0x152bc9[_0x7d64('0x1c')]['agent']=_0x910eb9;return _0x152bc9;})[_0x7d64('0x15')](function(_0x42a742){if(_0x42a742){_0x42a742['message'][_0x7d64('0x73')]=util[_0x7d64('0x5d')](_0x7d64('0x74'),_0x1a308e[_0x7d64('0x62')][_0x7d64('0x28')]);_0x42a742[_0x7d64('0x1c')][_0x7d64('0x75')]=_0x152bc9[_0x7d64('0x75')];_0x42a742['message'][_0x7d64('0x76')]=_0x152bc9['channel'];_0x42a742[_0x7d64('0x1c')][_0x7d64('0x77')]=_0x7d64('0x7b');_0x42a742[_0x7d64('0x1c')][_0x7d64('0x49')]=htmlToText['fromString'](_0x152bc9[_0x7d64('0x1c')]['body']);respondWithRpcPromise(_0x7d64('0x7a'),_0x7d64('0x7a'),{'event':_0x7d64('0x81'),'message':_0x42a742[_0x7d64('0x1c')]},client9002);return _0x152bc9;}return null;})[_0x7d64('0x15')](respondWithResult(_0x2d138c,null))['catch'](handleError(_0x2d138c,null));};exports[_0x7d64('0x82')]=function(_0x25d68a,_0x5778b4){var _0x14ba04=moment()[_0x7d64('0x83')]()[_0x7d64('0x84')]();var _0x4b40d6=path[_0x7d64('0x57')](config[_0x7d64('0x85')],_0x7d64('0x86'),_0x7d64('0x87'),_0x7d64('0x88'));var _0x406940=path[_0x7d64('0x57')](config['root'],_0x7d64('0x86'),_0x7d64('0x87'),'attachments');var _0x3ffb7f=util[_0x7d64('0x5d')](_0x7d64('0x89'),_0x14ba04);return db['MailMessage'][_0x7d64('0x45')]({'where':{'id':_0x25d68a[_0x7d64('0x42')]['id']},'attributes':['id',_0x7d64('0x49'),'from','to','cc','bcc',_0x7d64('0x8a'),_0x7d64('0x8b')],'include':_0x25d68a[_0x7d64('0x30')]['attachments']?[{'model':db[_0x7d64('0x8c')],'as':_0x7d64('0x8d')}]:undefined})[_0x7d64('0x15')](handleEntityNotFound(_0x5778b4,null))[_0x7d64('0x15')](function(_0x462216){if(_0x462216){var _0x56c201=_0x462216;var _0x493fd5={'from':_0x56c201[_0x7d64('0x8e')],'to':_0x56c201['to'],'subject':_0x56c201['subject'],'html':htmlEntities[_0x7d64('0x8f')](_0x56c201[_0x7d64('0x49')]),'headers':{'Date':moment(_0x56c201[_0x7d64('0x8b')])[_0x7d64('0x5d')](_0x7d64('0x90'))},'attachments':[]};if(_0x462216['cc']){_0x493fd5['headers']['Cc']=_0x462216['cc'];}if(_0x462216['bcc']){_0x493fd5['headers'][_0x7d64('0x91')]=_0x462216['bcc'];}return new BPromise(function(_0x4f8112,_0x760114){if(_0x462216[_0x7d64('0x8d')]){for(var _0x2b7d70=0x0;_0x2b7d70<_0x462216[_0x7d64('0x8d')]['length'];_0x2b7d70++){var _0x1716f4=_0x462216['Attachments'][_0x2b7d70];var _0x440b67=path[_0x7d64('0x57')](_0x406940,_0x1716f4[_0x7d64('0x58')]);if(fs[_0x7d64('0x92')](_0x440b67)){_0x493fd5[_0x7d64('0x56')][_0x7d64('0x93')]({'name':_0x1716f4['name'],'contentType':_0x1716f4[_0x7d64('0x3c')],'data':fs[_0x7d64('0x94')](_0x440b67)});}}}emlformat[_0x7d64('0x95')](_0x493fd5,function(_0x1c9d52,_0x5827e9){if(_0x1c9d52)return _0x760114(_0x1c9d52);fs['writeFileSync'](path['join'](_0x4b40d6,_0x3ffb7f),_0x5827e9);return _0x4f8112(_0x5827e9);});});}})[_0x7d64('0x15')](function(_0x4f5600){if(_0x4f5600){return _0x5778b4[_0x7d64('0x82')](path[_0x7d64('0x57')](_0x4b40d6,_0x3ffb7f),_0x3ffb7f,function(_0x1dc869){if(!_0x1dc869)fs[_0x7d64('0x96')](path[_0x7d64('0x57')](_0x4b40d6,_0x3ffb7f));});}})[_0x7d64('0x1d')](handleError(_0x5778b4,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index bdb90fa..d1ac2af 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 _0xcad6=['remove','emit','hook','exports','events','../../mysqldb','save','update'];(function(_0x11717d,_0x2a0cd2){var _0x20a355=function(_0x4563c8){while(--_0x4563c8){_0x11717d['push'](_0x11717d['shift']());}};_0x20a355(++_0x2a0cd2);}(_0xcad6,0x13c));var _0x6cad=function(_0x14d894,_0x44a207){_0x14d894=_0x14d894-0x0;var _0xcf56ac=_0xcad6[_0x14d894];return _0xcf56ac;};'use strict';var EventEmitter=require(_0x6cad('0x0'));var MailMessage=require(_0x6cad('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cad('0x2'),'afterUpdate':_0x6cad('0x3'),'afterDestroy':_0x6cad('0x4')};function emitEvent(_0x39d0db){return function(_0x2ab689,_0x126103,_0x3fff04){MailMessageEvents[_0x6cad('0x5')](_0x39d0db+':'+_0x2ab689['id'],_0x2ab689);MailMessageEvents['emit'](_0x39d0db,_0x2ab689);_0x3fff04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x6cad('0x6')](e,emitEvent(event));}}module[_0x6cad('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xa094=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x17c1cb,_0x5abf00){var _0x586e4c=function(_0x409e7c){while(--_0x409e7c){_0x17c1cb['push'](_0x17c1cb['shift']());}};_0x586e4c(++_0x5abf00);}(_0xa094,0xaf));var _0x4a09=function(_0x127a1a,_0x484489){_0x127a1a=_0x127a1a-0x0;var _0x2d9daa=_0xa094[_0x127a1a];return _0x2d9daa;};'use strict';var EventEmitter=require(_0x4a09('0x0'));var MailMessage=require(_0x4a09('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4a09('0x2')](0x0);var events={'afterCreate':_0x4a09('0x3'),'afterUpdate':_0x4a09('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf9b264){return function(_0x5a41c6,_0x2fcc90,_0x2f2e7c){MailMessageEvents[_0x4a09('0x5')](_0xf9b264+':'+_0x5a41c6['id'],_0x5a41c6);MailMessageEvents[_0x4a09('0x5')](_0xf9b264,_0x5a41c6);_0x2f2e7c(null);};}for(var e in events){if(events[_0x4a09('0x6')](e)){var event=events[e];MailMessage[_0x4a09('0x7')](e,emitEvent(event));}}module[_0x4a09('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b270b2d..09c1a31 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 _0x5d9c=['../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x498ab9,_0x239846){var _0x301028=function(_0x2eed03){while(--_0x2eed03){_0x498ab9['push'](_0x498ab9['shift']());}};_0x301028(++_0x239846);}(_0x5d9c,0xde));var _0xc5d9=function(_0x23b55d,_0x12ec69){_0x23b55d=_0x23b55d-0x0;var _0x5d1109=_0x5d9c[_0x23b55d];return _0x5d1109;};'use strict';var _=require(_0xc5d9('0x0'));var util=require(_0xc5d9('0x1'));var logger=require('../../config/logger')(_0xc5d9('0x2'));var moment=require(_0xc5d9('0x3'));var BPromise=require(_0xc5d9('0x4'));var rp=require(_0xc5d9('0x5'));var htmlToText=require(_0xc5d9('0x6'));var fs=require('fs');var path=require(_0xc5d9('0x7'));var rimraf=require(_0xc5d9('0x8'));var config=require(_0xc5d9('0x9'));var attributes=require(_0xc5d9('0xa'));module[_0xc5d9('0xb')]=function(_0x4a84ef,_0x37d54e){return _0x4a84ef[_0xc5d9('0xc')]('MailMessage',attributes,{'tableName':_0xc5d9('0xd'),'paranoid':![],'indexes':[{'name':_0xc5d9('0xe'),'fields':[_0xc5d9('0xe')]},{'name':_0xc5d9('0xf'),'fields':['plainBody',_0xc5d9('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a367e,_0x5da7cd,_0x128476){if(_0x3a367e[_0xc5d9('0x11')]){_0x3a367e[_0xc5d9('0x12')]=htmlToText[_0xc5d9('0x13')](_0x3a367e[_0xc5d9('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x128476(null,_0x5da7cd);},'afterCreate':function(_0x5c103a,_0x4b10db,_0x201cbd){var _0x2b4706=_0x4a84ef[_0xc5d9('0x14')];var _0x31490a=_0x5c103a['get']({'plain':!![]});if(_0x31490a[_0xc5d9('0x15')]['toLowerCase']()==='in'||_0x31490a[_0xc5d9('0x15')][_0xc5d9('0x16')]()===_0xc5d9('0x17')&&!_0x31490a[_0xc5d9('0x18')]&&!_[_0xc5d9('0x19')](_0x31490a['UserId'])){_0x2b4706[_0xc5d9('0x1a')][_0xc5d9('0x1b')]({'where':{'id':_0x31490a[_0xc5d9('0x1c')]}})[_0xc5d9('0x1d')](function(_0xf67838){if(_0xf67838){_0xf67838[_0xc5d9('0x1e')]({'lastMsgAt':_0x31490a['createdAt'],'lastMsgDirection':_0x31490a[_0xc5d9('0x15')][_0xc5d9('0x16')]()});}})['catch'](function(_0x5b08b2){console[_0xc5d9('0x1f')](_0x5b08b2);});}_0x201cbd();}},'charset':_0xc5d9('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x542f=['messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x542f,0x75));var _0xf542=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x542f[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0xf542('0x0'));var util=require(_0xf542('0x1'));var logger=require('../../config/logger')(_0xf542('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf542('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xf542('0x4'));var config=require(_0xf542('0x5'));var attributes=require(_0xf542('0x6'));module[_0xf542('0x7')]=function(_0x5855bd,_0x8211c9){return _0x5855bd[_0xf542('0x8')](_0xf542('0x9'),attributes,{'tableName':_0xf542('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xf542('0xb')]},{'name':_0xf542('0xc'),'fields':[_0xf542('0xd'),'subject'],'type':_0xf542('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x503e47,_0x5bef32,_0x1e9fc5){if(_0x503e47[_0xf542('0xf')]){_0x503e47['plainBody']=htmlToText[_0xf542('0x10')](_0x503e47['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1e9fc5(null,_0x5bef32);},'afterCreate':function(_0x23b1be,_0x2da553,_0x30ce7e){var _0x5d7165=_0x5855bd[_0xf542('0x11')];var _0x18168c=_0x23b1be[_0xf542('0x12')]({'plain':!![]});if(_0x18168c[_0xf542('0x13')]['toLowerCase']()==='in'||_0x18168c[_0xf542('0x13')][_0xf542('0x14')]()===_0xf542('0x15')&&!_0x18168c[_0xf542('0x16')]&&!_[_0xf542('0x17')](_0x18168c[_0xf542('0x18')])){_0x5d7165['MailInteraction'][_0xf542('0x19')]({'where':{'id':_0x18168c['MailInteractionId']}})[_0xf542('0x1a')](function(_0x5ad288){if(_0x5ad288){_0x5ad288[_0xf542('0x1b')]({'lastMsgAt':_0x18168c[_0xf542('0x1c')],'lastMsgDirection':_0x18168c['direction'][_0xf542('0x14')]()});}})[_0xf542('0x1d')](function(_0x24bf26){console[_0xf542('0x1e')](_0x24bf26);});}_0x30ce7e();}},'charset':'utf8mb4','collate':_0xf542('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 49bdf41..74ec6fb 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 _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xed22fb,_0xe4034d){var _0xf02612=function(_0x3fe620){while(--_0x3fe620){_0xed22fb['push'](_0xed22fb['shift']());}};_0xf02612(++_0xe4034d);}(_0x1893,0xa2));var _0x3189=function(_0x19a2eb,_0x2df439){_0x19a2eb=_0x19a2eb-0x0;var _0x3c8514=_0x1893[_0x19a2eb];return _0x3c8514;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file +var _0xd4f4=['CreateMailMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1082ab,_0x38b2ff){var _0x3d261c=function(_0x270a2a){while(--_0x270a2a){_0x1082ab['push'](_0x1082ab['shift']());}};_0x3d261c(++_0x38b2ff);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x452883,_0x2eec1a){_0x452883=_0x452883-0x0;var _0x5a67a1=_0xd4f4[_0x452883];return _0x5a67a1;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4d4f('0xb')]=_[_0x4d4f('0xc')](config[_0x4d4f('0xb')],{'host':_0x4d4f('0xd'),'port':0x18eb});var socket=require(_0x4d4f('0xe'))(new Redis(config[_0x4d4f('0xb')]));require(_0x4d4f('0xf'))[_0x4d4f('0x10')](socket);function respondWithRpcPromise(_0x385597,_0xba5200,_0x20db50){return new BPromise(function(_0x88b592,_0x128d39){return client[_0x4d4f('0x11')](_0x385597,_0x20db50)[_0x4d4f('0x12')](function(_0x28fb3e){logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0xba5200,_0x4d4f('0x15'),JSON[_0x4d4f('0x16')](_0x28fb3e));if(_0x28fb3e['error']){if(_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x18')]===0x1f4){logger[_0x4d4f('0x17')]('MailMessage,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x128d39(_0x28fb3e[_0x4d4f('0x17')]['message']);}logger[_0x4d4f('0x17')]('MailMessage,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x88b592(_0x28fb3e[_0x4d4f('0x17')]['message']);}else{logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');_0x88b592(_0x28fb3e['result']['message']);}})['catch'](function(_0x5eebec){logger[_0x4d4f('0x17')](_0x4d4f('0x14'),_0xba5200,_0x5eebec);_0x128d39(_0x5eebec);});});}exports[_0x4d4f('0x1a')]=function(_0x3566a5){var _0x5d7b1f=this;return new Promise(function(_0x5b2863,_0x1e1ae2){return db['MailMessage'][_0x4d4f('0x1b')](_0x3566a5[_0x4d4f('0x1c')],{'raw':_0x3566a5[_0x4d4f('0x1d')]?_0x3566a5[_0x4d4f('0x1d')][_0x4d4f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x570520){logger[_0x4d4f('0x13')]('CreateMailMessage',_0x3566a5);logger[_0x4d4f('0x1f')](_0x4d4f('0x1a'),_0x3566a5,JSON[_0x4d4f('0x16')](_0x570520));_0x5b2863(_0x570520);})[_0x4d4f('0x20')](function(_0xf3f7a4){logger['error'](_0x4d4f('0x1a'),_0xf3f7a4[_0x4d4f('0x19')],_0x3566a5);_0x1e1ae2(_0x5d7b1f[_0x4d4f('0x17')](0x1f4,_0xf3f7a4[_0x4d4f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5fd43b1..498155f 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 _0x98fc=['remove','update','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x402b4b,_0x46a6c2){var _0x4ec558=function(_0x3dd09f){while(--_0x3dd09f){_0x402b4b['push'](_0x402b4b['shift']());}};_0x4ec558(++_0x46a6c2);}(_0x98fc,0x156));var _0xc98f=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x98fc[_0x3cec45];return _0x51d691;};'use strict';var MailMessageEvents=require(_0xc98f('0x0'));var events=[_0xc98f('0x1'),_0xc98f('0x2'),_0xc98f('0x3')];function createListener(_0x95aeea,_0x5af26a){return function(_0xf22d8e){_0x5af26a['emit'](_0x95aeea,_0xf22d8e);};}function removeListener(_0x15f9da,_0x5c0de6){return function(){MailMessageEvents[_0xc98f('0x4')](_0x15f9da,_0x5c0de6);};}exports[_0xc98f('0x5')]=function(_0x184990){for(var _0x45d113=0x0,_0x3237e1=events[_0xc98f('0x6')];_0x45d113<_0x3237e1;_0x45d113++){var _0x28f276=events[_0x45d113];var _0x191b3f=createListener(_0xc98f('0x7')+_0x28f276,_0x184990);MailMessageEvents['on'](_0x28f276,_0x191b3f);}}; \ No newline at end of file +var _0x4764=['save','remove','update','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x3ff007,_0x23a436){var _0x5ae853=function(_0x1233a3){while(--_0x1233a3){_0x3ff007['push'](_0x3ff007['shift']());}};_0x5ae853(++_0x23a436);}(_0x4764,0x14f));var _0x4476=function(_0xe1ff3,_0x1f3531){_0xe1ff3=_0xe1ff3-0x0;var _0x2e1625=_0x4764[_0xe1ff3];return _0x2e1625;};'use strict';var MailMessageEvents=require(_0x4476('0x0'));var events=[_0x4476('0x1'),_0x4476('0x2'),_0x4476('0x3')];function createListener(_0x4b7ab3,_0x2f80ec){return function(_0x2b8d78){_0x2f80ec['emit'](_0x4b7ab3,_0x2b8d78);};}function removeListener(_0x216810,_0x1bf5ad){return function(){MailMessageEvents[_0x4476('0x4')](_0x216810,_0x1bf5ad);};}exports[_0x4476('0x5')]=function(_0x329b0e){for(var _0x202d48=0x0,_0x52c0cb=events[_0x4476('0x6')];_0x202d48<_0x52c0cb;_0x202d48++){var _0x8a5130=events[_0x202d48];var _0x5c0002=createListener(_0x4476('0x7')+_0x8a5130,_0x329b0e);MailMessageEvents['on'](_0x8a5130,_0x5c0002);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6874f0f..d376991 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 _0x0770=['./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','delete','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x4f0968,_0xe7d989){var _0x1abf00=function(_0x23071c){while(--_0x23071c){_0x4f0968['push'](_0x4f0968['shift']());}};_0x1abf00(++_0xe7d989);}(_0x0770,0x1d4));var _0x0077=function(_0xda127b,_0x3792b4){_0xda127b=_0xda127b-0x0;var _0x4f9ddb=_0x0770[_0xda127b];return _0x4f9ddb;};'use strict';var multer=require(_0x0077('0x0'));var util=require(_0x0077('0x1'));var path=require(_0x0077('0x2'));var timeout=require(_0x0077('0x3'));var express=require(_0x0077('0x4'));var router=express['Router']();var fs_extra=require(_0x0077('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0077('0x6'));var controller=require(_0x0077('0x7'));router['get']('/',auth[_0x0077('0x8')](),controller['index']);router[_0x0077('0x9')](_0x0077('0xa'),auth[_0x0077('0x8')](),controller[_0x0077('0xb')]);router['get'](_0x0077('0xc'),auth['isAuthenticated'](),controller[_0x0077('0xd')]);router[_0x0077('0x9')]('/:id/members',auth[_0x0077('0x8')](),controller[_0x0077('0xe')]);router[_0x0077('0x9')](_0x0077('0xf'),auth['isAuthenticated'](),controller[_0x0077('0x10')]);router[_0x0077('0x9')](_0x0077('0x11'),auth[_0x0077('0x8')](),controller[_0x0077('0x12')]);router[_0x0077('0x13')]('/',auth[_0x0077('0x8')](),controller['create']);router[_0x0077('0x13')]('/:id/teams',auth[_0x0077('0x8')](),controller['addTeams']);router[_0x0077('0x13')](_0x0077('0x11'),auth[_0x0077('0x8')](),controller[_0x0077('0x14')]);router[_0x0077('0x15')](_0x0077('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0077('0x16')]('/:id',auth[_0x0077('0x8')](),controller['destroy']);router['delete'](_0x0077('0xf'),auth[_0x0077('0x8')](),controller[_0x0077('0x17')]);router[_0x0077('0x16')](_0x0077('0x11'),auth[_0x0077('0x8')](),controller['removeAgents']);module[_0x0077('0x18')]=router; \ No newline at end of file +var _0x4379=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x4379,0x15d));var _0x9437=function(_0x8626f,_0x58901f){_0x8626f=_0x8626f-0x0;var _0x557402=_0x4379[_0x8626f];return _0x557402;};'use strict';var multer=require(_0x9437('0x0'));var util=require('util');var path=require(_0x9437('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9437('0x2')]();var fs_extra=require(_0x9437('0x3'));var auth=require(_0x9437('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x9437('0x5')]('/',auth[_0x9437('0x6')](),controller[_0x9437('0x7')]);router[_0x9437('0x5')](_0x9437('0x8'),auth[_0x9437('0x6')](),controller[_0x9437('0x9')]);router['get'](_0x9437('0xa'),auth[_0x9437('0x6')](),controller[_0x9437('0xb')]);router[_0x9437('0x5')](_0x9437('0xc'),auth[_0x9437('0x6')](),controller[_0x9437('0xd')]);router['get'](_0x9437('0xe'),auth[_0x9437('0x6')](),controller[_0x9437('0xf')]);router['get'](_0x9437('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9437('0x11')]('/',auth[_0x9437('0x6')](),controller[_0x9437('0x12')]);router[_0x9437('0x11')]('/:id/teams',auth[_0x9437('0x6')](),controller[_0x9437('0x13')]);router[_0x9437('0x11')](_0x9437('0x10'),auth[_0x9437('0x6')](),controller[_0x9437('0x14')]);router[_0x9437('0x15')](_0x9437('0xa'),auth[_0x9437('0x6')](),controller['update']);router[_0x9437('0x16')](_0x9437('0xa'),auth['isAuthenticated'](),controller[_0x9437('0x17')]);router[_0x9437('0x16')]('/:id/teams',auth[_0x9437('0x6')](),controller[_0x9437('0x18')]);router[_0x9437('0x16')](_0x9437('0x10'),auth[_0x9437('0x6')](),controller[_0x9437('0x19')]);module[_0x9437('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ff7990b..8c5f32c 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 _0x9ca9=['exports','rrmemory','beepall','roundrobin'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x9ca9,0xa8));var _0x99ca=function(_0x487b43,_0x210e39){_0x487b43=_0x487b43-0x0;var _0x822e7=_0x9ca9[_0x487b43];return _0x822e7;};'use strict';var Sequelize=require('sequelize');module[_0x99ca('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x99ca('0x1'),_0x99ca('0x2'),_0x99ca('0x3'))}}; \ No newline at end of file +var _0x31a7=['STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0x31a7,0x122));var _0x731a=function(_0x1db7a9,_0x4c4fc7){_0x1db7a9=_0x1db7a9-0x0;var _0x496ca1=_0x31a7[_0x1db7a9];return _0x496ca1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x731a('0x0')],'unique':_0x731a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x731a('0x0')]},'timeout':{'type':Sequelize[_0x731a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x731a('0x3')](_0x731a('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 69e2abb..962b5fb 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 _0x3eed=['includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','MailQueues','destroy','end','sendStatus','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','nolimit','sort','where','filter','merge','includeAll','findAll','catch','show','params','length','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','hasOwnProperty','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','createdAt','rows','format','SIP','mailPause','updatedAt','getTeams','Team','fields','ids','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId'];(function(_0x37eb5c,_0x477cc0){var _0x243e31=function(_0x2ebb5a){while(--_0x2ebb5a){_0x37eb5c['push'](_0x37eb5c['shift']());}};_0x243e31(++_0x477cc0);}(_0x3eed,0x1b9));var _0xd3ee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3eed[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3ee('0x1'));var rp=require('request-promise');var moment=require(_0xd3ee('0x2'));var BPromise=require(_0xd3ee('0x3'));var Mustache=require(_0xd3ee('0x4'));var util=require(_0xd3ee('0x5'));var path=require(_0xd3ee('0x6'));var sox=require('sox');var csv=require(_0xd3ee('0x7'));var ejs=require(_0xd3ee('0x8'));var fs=require('fs');var fs_extra=require(_0xd3ee('0x9'));var _=require('lodash');var squel=require(_0xd3ee('0xa'));var crypto=require(_0xd3ee('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd3ee('0x7'));var querystring=require(_0xd3ee('0xc'));var Papa=require('papaparse');var Redis=require(_0xd3ee('0xd'));var authService=require(_0xd3ee('0xe'));var qs=require(_0xd3ee('0xf'));var as=require(_0xd3ee('0x10'));var hardwareService=require(_0xd3ee('0x11'));var logger=require('../../config/logger')(_0xd3ee('0x12'));var utils=require(_0xd3ee('0x13'));var config=require(_0xd3ee('0x14'));var licenseUtil=require(_0xd3ee('0x15'));var db=require(_0xd3ee('0x16'))['db'];config[_0xd3ee('0x17')]=_[_0xd3ee('0x18')](config[_0xd3ee('0x17')],{'host':_0xd3ee('0x19'),'port':0x18eb});var socket=require(_0xd3ee('0x1a'))(new Redis(config['redis']));require(_0xd3ee('0x1b'))[_0xd3ee('0x1c')](socket);function respondWithStatusCode(_0x3fdd6b,_0x465a7f){_0x465a7f=_0x465a7f||0xcc;return function(_0x11e5df){if(_0x11e5df){return _0x3fdd6b['sendStatus'](_0x465a7f);}return _0x3fdd6b[_0xd3ee('0x1d')](_0x465a7f)['end']();};}function respondWithResult(_0x4f8490,_0x460cdc){_0x460cdc=_0x460cdc||0xc8;return function(_0x637b82){if(_0x637b82){return _0x4f8490['status'](_0x460cdc)[_0xd3ee('0x1e')](_0x637b82);}};}function respondWithFilteredResult(_0x283b40,_0x3bef4e){return function(_0x1d4d09){if(_0x1d4d09){var _0x57ece8=typeof _0x3bef4e[_0xd3ee('0x1f')]==='undefined'&&typeof _0x3bef4e['limit']===_0xd3ee('0x20');var _0x4ba9c6=_0x1d4d09['count'];var _0x37cd7a=_0x57ece8?0x0:_0x3bef4e[_0xd3ee('0x1f')];var _0x484a93=_0x57ece8?_0x1d4d09[_0xd3ee('0x21')]:_0x3bef4e[_0xd3ee('0x1f')]+_0x3bef4e[_0xd3ee('0x22')];var _0x1d1542;if(_0x484a93>=_0x4ba9c6){_0x484a93=_0x4ba9c6;_0x1d1542=0xc8;}else{_0x1d1542=0xce;}_0x283b40['status'](_0x1d1542);return _0x283b40[_0xd3ee('0x23')](_0xd3ee('0x24'),_0x37cd7a+'-'+_0x484a93+'/'+_0x4ba9c6)[_0xd3ee('0x1e')](_0x1d4d09);}return null;};}function patchUpdates(_0x4a76fa){return function(_0x2e599f){try{jsonpatch[_0xd3ee('0x25')](_0x2e599f,_0x4a76fa,!![]);}catch(_0x51d79a){return BPromise[_0xd3ee('0x26')](_0x51d79a);}return _0x2e599f[_0xd3ee('0x27')]();};}function saveUpdates(_0x3b3f0f,_0x10ffd0){return function(_0x4c4aa4){if(_0x4c4aa4){return _0x4c4aa4[_0xd3ee('0x28')](_0x3b3f0f)[_0xd3ee('0x29')](function(_0x3f849a){return _0x3f849a;});}return null;};}function removeEntity(_0x353670,_0x5677a){return function(_0x221e7e){if(_0x221e7e){return _0x221e7e['destroy']()[_0xd3ee('0x29')](function(){var _0x26af5e=_0x221e7e['get']({'plain':!![]});var _0x42d221=_0xd3ee('0x2a');return db['UserProfileResource'][_0xd3ee('0x2b')]({'where':{'type':_0x42d221,'resourceId':_0x26af5e['id']}})['then'](function(){return _0x221e7e;});})[_0xd3ee('0x29')](function(){_0x353670[_0xd3ee('0x1d')](0xcc)[_0xd3ee('0x2c')]();});}};}function handleEntityNotFound(_0x3c2682,_0x5114d0){return function(_0x43367e){if(!_0x43367e){_0x3c2682[_0xd3ee('0x2d')](0x194);}return _0x43367e;};}function handleError(_0x1021c4,_0x23ecec){_0x23ecec=_0x23ecec||0x1f4;return function(_0x73dd01){logger['error'](_0x73dd01[_0xd3ee('0x2e')]);if(_0x73dd01[_0xd3ee('0x2f')]){delete _0x73dd01['name'];}_0x1021c4[_0xd3ee('0x1d')](_0x23ecec)[_0xd3ee('0x30')](_0x73dd01);};}exports[_0xd3ee('0x31')]=function(_0x2c6bfb,_0x4ccc31){var _0x36a9f7={},_0x1c9f6f={},_0x63aa20={'count':0x0,'rows':[]};var _0x3925b6=_['map'](db[_0xd3ee('0x32')][_0xd3ee('0x33')],function(_0x123e47){return{'name':_0x123e47[_0xd3ee('0x34')],'type':_0x123e47[_0xd3ee('0x35')][_0xd3ee('0x36')]};});_0x1c9f6f[_0xd3ee('0x37')]=_[_0xd3ee('0x38')](_0x3925b6,_0xd3ee('0x2f'));_0x1c9f6f[_0xd3ee('0x39')]=_[_0xd3ee('0x3a')](_0x2c6bfb[_0xd3ee('0x39')]);_0x1c9f6f[_0xd3ee('0x3b')]=_[_0xd3ee('0x3c')](_0x1c9f6f[_0xd3ee('0x37')],_0x1c9f6f[_0xd3ee('0x39')]);_0x36a9f7[_0xd3ee('0x3d')]=_['intersection'](_0x1c9f6f[_0xd3ee('0x37')],qs['fields'](_0x2c6bfb[_0xd3ee('0x39')]['fields']));_0x36a9f7[_0xd3ee('0x3d')]=_0x36a9f7[_0xd3ee('0x3d')]['length']?_0x36a9f7['attributes']:_0x1c9f6f['model'];if(!_0x2c6bfb[_0xd3ee('0x39')]['hasOwnProperty'](_0xd3ee('0x3e'))){_0x36a9f7[_0xd3ee('0x22')]=qs[_0xd3ee('0x22')](_0x2c6bfb['query'][_0xd3ee('0x22')]);_0x36a9f7['offset']=qs['offset'](_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x1f')]);}_0x36a9f7['order']=qs['sort'](_0x2c6bfb['query'][_0xd3ee('0x3f')]);_0x36a9f7[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_['pick'](_0x2c6bfb[_0xd3ee('0x39')],_0x1c9f6f[_0xd3ee('0x3b')]),_0x3925b6);if(_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x41')]){_0x36a9f7[_0xd3ee('0x40')]=_[_0xd3ee('0x42')](_0x36a9f7['where'],{'$or':_[_0xd3ee('0x38')](_0x3925b6,function(_0x56a3a8){if(_0x56a3a8['type']!=='VIRTUAL'){var _0x270d42={};_0x270d42[_0x56a3a8[_0xd3ee('0x2f')]]={'$like':'%'+_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x41')]+'%'};return _0x270d42;}})});}_0x36a9f7=_[_0xd3ee('0x42')]({},_0x36a9f7,_0x2c6bfb['options']);var _0x270227={'where':_0x36a9f7[_0xd3ee('0x40')]};return db['MailQueue'][_0xd3ee('0x21')](_0x270227)['then'](function(_0x57059f){_0x63aa20[_0xd3ee('0x21')]=_0x57059f;if(_0x2c6bfb[_0xd3ee('0x39')][_0xd3ee('0x43')]){_0x36a9f7['include']=[{'all':!![]}];}return db[_0xd3ee('0x32')][_0xd3ee('0x44')](_0x36a9f7);})[_0xd3ee('0x29')](function(_0x5dc3a3){_0x63aa20['rows']=_0x5dc3a3;return _0x63aa20;})[_0xd3ee('0x29')](respondWithFilteredResult(_0x4ccc31,_0x36a9f7))[_0xd3ee('0x45')](handleError(_0x4ccc31,null));};exports[_0xd3ee('0x46')]=function(_0x46b5de,_0x3885f9){var _0x20b7f9={'raw':!![],'where':{'id':_0x46b5de[_0xd3ee('0x47')]['id']}},_0x362dad={};_0x362dad[_0xd3ee('0x37')]=_[_0xd3ee('0x3a')](db[_0xd3ee('0x32')][_0xd3ee('0x33')]);_0x362dad[_0xd3ee('0x39')]=_[_0xd3ee('0x3a')](_0x46b5de['query']);_0x362dad['filters']=_[_0xd3ee('0x3c')](_0x362dad[_0xd3ee('0x37')],_0x362dad['query']);_0x20b7f9[_0xd3ee('0x3d')]=_['intersection'](_0x362dad[_0xd3ee('0x37')],qs['fields'](_0x46b5de[_0xd3ee('0x39')]['fields']));_0x20b7f9[_0xd3ee('0x3d')]=_0x20b7f9[_0xd3ee('0x3d')][_0xd3ee('0x48')]?_0x20b7f9[_0xd3ee('0x3d')]:_0x362dad[_0xd3ee('0x37')];if(_0x46b5de['query'][_0xd3ee('0x43')]){_0x20b7f9[_0xd3ee('0x49')]=[{'all':!![]}];}_0x20b7f9=_[_0xd3ee('0x42')]({},_0x20b7f9,_0x46b5de[_0xd3ee('0x4a')]);return db[_0xd3ee('0x32')][_0xd3ee('0x4b')](_0x20b7f9)[_0xd3ee('0x29')](handleEntityNotFound(_0x3885f9,null))[_0xd3ee('0x29')](respondWithResult(_0x3885f9,null))['catch'](handleError(_0x3885f9,null));};exports['create']=function(_0x2c665d,_0x794605){return db[_0xd3ee('0x32')][_0xd3ee('0x4c')](_0x2c665d[_0xd3ee('0x4d')],{})[_0xd3ee('0x29')](function(_0x46b14c){var _0x4cb82e=_0x2c665d[_0xd3ee('0x4e')][_0xd3ee('0x4f')]({'plain':!![]});if(!_0x4cb82e)throw new Error(_0xd3ee('0x50'));if(_0x4cb82e[_0xd3ee('0x51')]===_0xd3ee('0x4e')){var _0xf82f7b=_0x46b14c[_0xd3ee('0x4f')]({'plain':!![]});var _0x8e598f=_0xd3ee('0x2a');return db['UserProfileSection'][_0xd3ee('0x4b')]({'where':{'name':_0x8e598f,'userProfileId':_0x4cb82e[_0xd3ee('0x52')]},'raw':!![]})['then'](function(_0x3069bd){if(_0x3069bd&&_0x3069bd[_0xd3ee('0x53')]===0x0){return db[_0xd3ee('0x54')]['create']({'name':_0xf82f7b['name'],'resourceId':_0xf82f7b['id'],'type':_0x3069bd['name'],'sectionId':_0x3069bd['id']},{})[_0xd3ee('0x29')](function(){return _0x46b14c;});}else{return _0x46b14c;}})[_0xd3ee('0x45')](function(_0x1de47f){logger[_0xd3ee('0x55')](_0xd3ee('0x56'),_0x1de47f);throw _0x1de47f;});}return _0x46b14c;})[_0xd3ee('0x29')](respondWithResult(_0x794605,0xc9))[_0xd3ee('0x45')](handleError(_0x794605,null));};exports[_0xd3ee('0x28')]=function(_0x4ff37b,_0x5853a7){if(_0x4ff37b[_0xd3ee('0x4d')]['id']){delete _0x4ff37b[_0xd3ee('0x4d')]['id'];}return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x4ff37b[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x5853a7,null))[_0xd3ee('0x29')](saveUpdates(_0x4ff37b[_0xd3ee('0x4d')],null))[_0xd3ee('0x29')](respondWithResult(_0x5853a7,null))['catch'](handleError(_0x5853a7,null));};exports[_0xd3ee('0x2b')]=function(_0x1dcc5,_0x219d7d){return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x1dcc5[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x219d7d,null))[_0xd3ee('0x29')](removeEntity(_0x219d7d,null))[_0xd3ee('0x45')](handleError(_0x219d7d,null));};exports[_0xd3ee('0x57')]=function(_0x3b714a,_0x31906c){return db[_0xd3ee('0x32')][_0xd3ee('0x57')]()[_0xd3ee('0x29')](respondWithResult(_0x31906c,null))[_0xd3ee('0x45')](handleError(_0x31906c,null));};exports['getMembers']=function(_0x15ec1b,_0x4bf608,_0x13b2e7){var _0x21eb92={'raw':!![],'where':{}},_0x1d1b66={},_0x46e315;return db['MailQueue'][_0xd3ee('0x58')]({'where':{'id':_0x15ec1b[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x4bf608,null))[_0xd3ee('0x29')](function(_0x30efa3){if(_0x30efa3){_0x46e315=_0x30efa3[_0xd3ee('0x4f')]({'plain':!![]});_0x1d1b66[_0xd3ee('0x37')]=_[_0xd3ee('0x3a')](db[_0xd3ee('0x59')]['rawAttributes']);_0x1d1b66['query']=_[_0xd3ee('0x3a')](_0x15ec1b[_0xd3ee('0x39')]);_0x1d1b66[_0xd3ee('0x3b')]=_['intersection'](_0x1d1b66[_0xd3ee('0x37')],_0x1d1b66[_0xd3ee('0x39')]);_0x21eb92[_0xd3ee('0x3d')]=_['intersection'](_0x1d1b66[_0xd3ee('0x37')],qs['fields'](_0x15ec1b['query']['fields']));_0x21eb92[_0xd3ee('0x3d')]=_0x21eb92['attributes']['length']?_0x21eb92[_0xd3ee('0x3d')]:_0x1d1b66[_0xd3ee('0x37')];if(!_0x15ec1b[_0xd3ee('0x39')][_0xd3ee('0x5a')](_0xd3ee('0x3e'))){_0x21eb92['limit']=qs['limit'](_0x15ec1b[_0xd3ee('0x39')]['limit']);_0x21eb92[_0xd3ee('0x1f')]=qs[_0xd3ee('0x1f')](_0x15ec1b[_0xd3ee('0x39')][_0xd3ee('0x1f')]);}_0x21eb92[_0xd3ee('0x5b')]=qs['sort'](_0x15ec1b[_0xd3ee('0x39')]['sort']);_0x21eb92[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_[_0xd3ee('0x5c')](_0x15ec1b[_0xd3ee('0x39')],_0x1d1b66[_0xd3ee('0x3b')]));_0x21eb92[_0xd3ee('0x40')][_0xd3ee('0x5d')]=_0x30efa3['id'];if(_0x15ec1b[_0xd3ee('0x39')]['filter']){_0x21eb92['where']=_[_0xd3ee('0x42')](_0x21eb92[_0xd3ee('0x40')],{'$or':_[_0xd3ee('0x38')](_0x21eb92[_0xd3ee('0x3d')],function(_0x261ce6){var _0x464193={};_0x464193[_0x261ce6]={'$like':'%'+_0x15ec1b['query'][_0xd3ee('0x41')]+'%'};return _0x464193;})});}_0x21eb92=_[_0xd3ee('0x42')]({},_0x21eb92,_0x15ec1b[_0xd3ee('0x4a')]);return db[_0xd3ee('0x59')][_0xd3ee('0x44')](_0x21eb92);}})[_0xd3ee('0x29')](function(_0x4b1e38){if(_0x4b1e38){return db[_0xd3ee('0x5e')][_0xd3ee('0x5f')]({'where':{'id':_[_0xd3ee('0x38')](_0x4b1e38,_0xd3ee('0x60')),'role':_0xd3ee('0x61')},'attributes':['id',_0xd3ee('0x2f'),'mailPause','updatedAt',_0xd3ee('0x62')]});}})[_0xd3ee('0x29')](function(_0x17d382){if(_0x17d382){return{'count':_0x17d382[_0xd3ee('0x21')],'rows':_[_0xd3ee('0x38')](_0x17d382[_0xd3ee('0x63')],function(_0x11de08){return{'membername':_0x11de08[_0xd3ee('0x2f')],'UserId':_0x11de08['id'],'queue_name':_0x46e315['name'],'MailQueueId':_0x46e315['id'],'interface':util[_0xd3ee('0x64')]('%s/%s',_0xd3ee('0x65'),_0x11de08[_0xd3ee('0x2f')]),'penalty':0x0,'paused':_0x11de08[_0xd3ee('0x66')],'createdAt':_0x11de08['createdAt'],'updatedAt':_0x11de08[_0xd3ee('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd3ee('0x29')](respondWithFilteredResult(_0x4bf608,_0x21eb92))[_0xd3ee('0x45')](handleError(_0x4bf608,null));};exports[_0xd3ee('0x68')]=function(_0x3429c7,_0x108032,_0x31acb8){var _0x4470b7={};var _0x2003e2={};var _0x1dc952;var _0x1a9baf;return db[_0xd3ee('0x32')]['findOne']({'where':{'id':_0x3429c7['params']['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x108032,null))['then'](function(_0x41c18e){if(_0x41c18e){_0x1dc952=_0x41c18e;_0x2003e2[_0xd3ee('0x37')]=_['keys'](db[_0xd3ee('0x69')]['rawAttributes']);_0x2003e2['query']=_[_0xd3ee('0x3a')](_0x3429c7['query']);_0x2003e2['filters']=_[_0xd3ee('0x3c')](_0x2003e2[_0xd3ee('0x37')],_0x2003e2[_0xd3ee('0x39')]);_0x4470b7[_0xd3ee('0x3d')]=_[_0xd3ee('0x3c')](_0x2003e2[_0xd3ee('0x37')],qs['fields'](_0x3429c7['query'][_0xd3ee('0x6a')]));_0x4470b7[_0xd3ee('0x3d')]=_0x4470b7[_0xd3ee('0x3d')][_0xd3ee('0x48')]?_0x4470b7['attributes']:_0x2003e2['model'];_0x4470b7[_0xd3ee('0x5b')]=qs[_0xd3ee('0x3f')](_0x3429c7[_0xd3ee('0x39')][_0xd3ee('0x3f')]);_0x4470b7[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_[_0xd3ee('0x5c')](_0x3429c7[_0xd3ee('0x39')],_0x2003e2['filters']));if(_0x3429c7['query']['filter']){_0x4470b7[_0xd3ee('0x40')]=_[_0xd3ee('0x42')](_0x4470b7[_0xd3ee('0x40')],{'$or':_[_0xd3ee('0x38')](_0x4470b7['attributes'],function(_0x22942d){var _0x475171={};_0x475171[_0x22942d]={'$like':'%'+_0x3429c7[_0xd3ee('0x39')][_0xd3ee('0x41')]+'%'};return _0x475171;})});}_0x4470b7=_[_0xd3ee('0x42')]({},_0x4470b7,_0x3429c7[_0xd3ee('0x4a')]);return _0x1dc952[_0xd3ee('0x68')](_0x4470b7);}})['then'](function(_0x28a896){if(_0x28a896){_0x1a9baf=_0x28a896['length'];if(!_0x3429c7['query']['hasOwnProperty'](_0xd3ee('0x3e'))){_0x4470b7[_0xd3ee('0x22')]=qs[_0xd3ee('0x22')](_0x3429c7['query'][_0xd3ee('0x22')]);_0x4470b7[_0xd3ee('0x1f')]=qs[_0xd3ee('0x1f')](_0x3429c7[_0xd3ee('0x39')][_0xd3ee('0x1f')]);}return _0x1dc952[_0xd3ee('0x68')](_0x4470b7);}})[_0xd3ee('0x29')](function(_0x9031d8){if(_0x9031d8){return _0x9031d8?{'count':_0x1a9baf,'rows':_0x9031d8}:null;}})['then'](respondWithResult(_0x108032,null))['catch'](handleError(_0x108032,null));};exports['addTeams']=function(_0x99a44a,_0x522d73,_0x4f4cb0){var _0x54b77e=_0x99a44a[_0xd3ee('0x4d')][_0xd3ee('0x6b')];return db[_0xd3ee('0x69')][_0xd3ee('0x44')]({'where':{'id':_0x54b77e},'attributes':['id'],'include':[{'model':db[_0xd3ee('0x5e')],'as':'Agents','attributes':['id',_0xd3ee('0x2f'),'online','voicePause',_0xd3ee('0x6c')],'raw':!![]}]})[_0xd3ee('0x29')](function(_0x3384ce){if(_0x3384ce){var _0x155e1f=_[_0xd3ee('0x6d')](_0x3384ce,function(_0x46ebd3){var _0x13afce=_0x46ebd3[_0xd3ee('0x4f')]({'plain':!![]});return _0x13afce[_0xd3ee('0x6e')];});return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x99a44a[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](function(_0x827833){return db[_0xd3ee('0x6f')][_0xd3ee('0x70')](function(_0x41157b){return _0x827833['addTeams'](_0x54b77e,{'transaction':_0x41157b})[_0xd3ee('0x29')](function(){return BPromise[_0xd3ee('0x71')](_0x155e1f,function(_0x38ca86){return db[_0xd3ee('0x59')][_0xd3ee('0x72')]({'where':{'UserId':_0x38ca86['id'],'MailQueueId':_0x99a44a[_0xd3ee('0x47')]['id']},'transaction':_0x41157b});});})[_0xd3ee('0x29')](function(){_0x155e1f[_0xd3ee('0x73')](function(_0x5127e1){socket[_0xd3ee('0x74')](_0xd3ee('0x75'),{'UserId':_0x5127e1['id'],'MailQueueId':_0x827833['id']});});});});});}})['then'](respondWithStatusCode(_0x522d73,null))[_0xd3ee('0x45')](handleError(_0x522d73,null));};exports[_0xd3ee('0x76')]=function(_0xc301fb,_0x4f958d,_0x21e189){return db[_0xd3ee('0x69')]['findAll']({'where':{'id':_0xc301fb[_0xd3ee('0x39')][_0xd3ee('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xd3ee('0x5e')],'as':_0xd3ee('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4f958d,null))[_0xd3ee('0x29')](function(_0x3130e2){var _0x13db3d=_[_0xd3ee('0x38')](_0x3130e2,'id');var _0xf2854b=[];var _0x2914bb=[];var _0x3974c3=squel[_0xd3ee('0x77')]();_0x3974c3[_0xd3ee('0x78')](_0xd3ee('0x79'))[_0xd3ee('0x7a')](_0xd3ee('0x7b'),'tq')['join'](_0xd3ee('0x7c'),'ut',_0xd3ee('0x7d'))[_0xd3ee('0x40')]('MailQueueId\x20=\x20?',_0xc301fb['params']['id']);for(var _0x1e4a56=0x0;_0x1e4a56<_0x3130e2[_0xd3ee('0x48')];_0x1e4a56+=0x1){let _0x23b8c3=_0x3130e2[_0x1e4a56];for(var _0x23e862=0x0;_0x23e862<_0x23b8c3[_0xd3ee('0x6e')][_0xd3ee('0x48')];_0x23e862+=0x1){let _0x5c8eaf=_0x23b8c3[_0xd3ee('0x6e')][_0x23e862];var _0x34d875=_0x3974c3['clone']();_0x34d875[_0xd3ee('0x40')](_0xd3ee('0x7e'),_0x5c8eaf['id']);_0x2914bb['push'](db['sequelize'][_0xd3ee('0x39')](_0x34d875[_0xd3ee('0x7f')](),{'type':db['sequelize'][_0xd3ee('0x80')]['SELECT']})[_0xd3ee('0x29')](function(_0xfe5084){if(_0xfe5084['length']===0x1){return _0x5c8eaf['id'];}else{var _0x2f462a=_[_0xd3ee('0x81')](_[_0xd3ee('0x38')](_0xfe5084,_0xd3ee('0x82')),function(_0x3e605a){return _[_0xd3ee('0x83')](_0x13db3d,_0x3e605a);});if(_0x2f462a){return _0x5c8eaf['id'];}}}));}}return BPromise[_0xd3ee('0x84')](_0x2914bb)[_0xd3ee('0x29')](function(_0x43719f){_0xf2854b=_(_0xf2854b)[_0xd3ee('0x85')](_0x43719f)[_0xd3ee('0x86')]()[_0xd3ee('0x87')]();return db['MailQueue'][_0xd3ee('0x4b')]({'where':{'id':_0xc301fb[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](function(_0x8fa8ec){return db[_0xd3ee('0x6f')][_0xd3ee('0x70')](function(_0x201b6d){return _0x8fa8ec[_0xd3ee('0x76')](_0xc301fb[_0xd3ee('0x39')][_0xd3ee('0x6b')],{'transaction':_0x201b6d})[_0xd3ee('0x29')](function(){if(!_[_0xd3ee('0x88')](_0xf2854b)){return _0x8fa8ec['removeAgents'](_0xf2854b,{'transaction':_0x201b6d});}})[_0xd3ee('0x29')](function(){_0xf2854b[_0xd3ee('0x73')](function(_0x25686a){socket[_0xd3ee('0x74')](_0xd3ee('0x89'),{'UserId':_0x25686a,'MailQueueId':_0x8fa8ec['id']});});});});});});})[_0xd3ee('0x29')](respondWithStatusCode(_0x4f958d,null))[_0xd3ee('0x45')](handleError(_0x4f958d,null));};exports['addAgents']=function(_0x35d804,_0x2d284f,_0x31ebf8){return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x35d804[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x2d284f,null))[_0xd3ee('0x29')](function(_0x1bdf65){if(_0x1bdf65){return _0x1bdf65[_0xd3ee('0x8a')](_0x35d804[_0xd3ee('0x4d')][_0xd3ee('0x6b')],_[_0xd3ee('0x8b')](_0x35d804[_0xd3ee('0x4d')],['ids','id'])||{})[_0xd3ee('0x8c')](function(_0x433e7e){for(var _0xf0d297=0x0;_0xf0d297<_0x35d804[_0xd3ee('0x4d')][_0xd3ee('0x6b')][_0xd3ee('0x48')];_0xf0d297+=0x1){socket[_0xd3ee('0x74')](_0xd3ee('0x75'),{'UserId':Number(_0x35d804[_0xd3ee('0x4d')][_0xd3ee('0x6b')][_0xf0d297]),'MailQueueId':Number(_0x35d804[_0xd3ee('0x47')]['id'])});}return _0x433e7e;});}})[_0xd3ee('0x29')](respondWithResult(_0x2d284f,null))[_0xd3ee('0x45')](handleError(_0x2d284f,null));};exports['removeAgents']=function(_0x46d30f,_0x258713,_0x1a8ccd){return db[_0xd3ee('0x32')][_0xd3ee('0x4b')]({'where':{'id':_0x46d30f[_0xd3ee('0x47')]['id']}})[_0xd3ee('0x29')](handleEntityNotFound(_0x258713,null))[_0xd3ee('0x29')](function(_0x289775){if(_0x289775){return _0x289775['removeAgents'](_0x46d30f[_0xd3ee('0x39')]['ids'])[_0xd3ee('0x29')](function(){if(_[_0xd3ee('0x8d')](_0x46d30f['query']['ids'])){for(var _0x14d1bd=0x0;_0x14d1bd<_0x46d30f['query'][_0xd3ee('0x6b')][_0xd3ee('0x48')];_0x14d1bd+=0x1){socket[_0xd3ee('0x74')]('userMailQueue:remove',{'UserId':Number(_0x46d30f[_0xd3ee('0x39')][_0xd3ee('0x6b')][_0x14d1bd]),'MailQueueId':Number(_0x46d30f[_0xd3ee('0x47')]['id'])});}}else{socket['emit'](_0xd3ee('0x89'),{'UserId':Number(_0x46d30f[_0xd3ee('0x39')][_0xd3ee('0x6b')]),'MailQueueId':Number(_0x46d30f[_0xd3ee('0x47')]['id'])});}});}})[_0xd3ee('0x29')](respondWithStatusCode(_0x258713,null))[_0xd3ee('0x45')](handleError(_0x258713,null));};exports[_0xd3ee('0x8e')]=function(_0x466444,_0x576e1d,_0x32a300){var _0xc5c043={};var _0x38d8ee={};var _0x4a46a6;var _0x524ffd;return db[_0xd3ee('0x32')][_0xd3ee('0x58')]({'where':{'id':_0x466444[_0xd3ee('0x47')]['id']}})['then'](handleEntityNotFound(_0x576e1d,null))[_0xd3ee('0x29')](function(_0x397484){if(_0x397484){_0x4a46a6=_0x397484;_0x38d8ee[_0xd3ee('0x37')]=_[_0xd3ee('0x3a')](db[_0xd3ee('0x5e')][_0xd3ee('0x33')]);_0x38d8ee[_0xd3ee('0x39')]=_[_0xd3ee('0x3a')](_0x466444[_0xd3ee('0x39')]);_0x38d8ee[_0xd3ee('0x3b')]=_['intersection'](_0x38d8ee[_0xd3ee('0x37')],_0x38d8ee[_0xd3ee('0x39')]);_0xc5c043[_0xd3ee('0x3d')]=_[_0xd3ee('0x3c')](_0x38d8ee['model'],qs[_0xd3ee('0x6a')](_0x466444['query'][_0xd3ee('0x6a')]));_0xc5c043[_0xd3ee('0x3d')]=_0xc5c043[_0xd3ee('0x3d')][_0xd3ee('0x48')]?_0xc5c043[_0xd3ee('0x3d')]:_0x38d8ee['model'];_0xc5c043[_0xd3ee('0x5b')]=qs[_0xd3ee('0x3f')](_0x466444[_0xd3ee('0x39')][_0xd3ee('0x3f')]);_0xc5c043[_0xd3ee('0x40')]=qs[_0xd3ee('0x3b')](_[_0xd3ee('0x5c')](_0x466444[_0xd3ee('0x39')],_0x38d8ee[_0xd3ee('0x3b')]));if(_0x466444[_0xd3ee('0x39')][_0xd3ee('0x41')]){_0xc5c043['where']=_[_0xd3ee('0x42')](_0xc5c043['where'],{'$or':_[_0xd3ee('0x38')](_0xc5c043[_0xd3ee('0x3d')],function(_0x2400ad){var _0x554d0f={};_0x554d0f[_0x2400ad]={'$like':'%'+_0x466444[_0xd3ee('0x39')][_0xd3ee('0x41')]+'%'};return _0x554d0f;})});}_0xc5c043=_['merge']({},_0xc5c043,_0x466444[_0xd3ee('0x4a')]);return _0x4a46a6[_0xd3ee('0x8e')](_0xc5c043);}})[_0xd3ee('0x29')](function(_0x401ff3){if(_0x401ff3){_0x524ffd=_0x401ff3[_0xd3ee('0x48')];if(!_0x466444[_0xd3ee('0x39')]['hasOwnProperty'](_0xd3ee('0x3e'))){_0xc5c043['limit']=qs[_0xd3ee('0x22')](_0x466444[_0xd3ee('0x39')][_0xd3ee('0x22')]);_0xc5c043[_0xd3ee('0x1f')]=qs[_0xd3ee('0x1f')](_0x466444['query']['offset']);}return _0x4a46a6[_0xd3ee('0x8e')](_0xc5c043);}})['then'](function(_0x45416c){if(_0x45416c){return _0x45416c?{'count':_0x524ffd,'rows':_0x45416c}:null;}})[_0xd3ee('0x29')](respondWithResult(_0x576e1d,null))['catch'](handleError(_0x576e1d,null));}; \ No newline at end of file +var _0xa1bb=['ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','transaction','removeAgents','userMailQueue:remove','addAgents','spread','isArray','User','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','catch','show','rawAttributes','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','order','pick','MailQueueId','findAndCountAll','mailPause','updatedAt','rows','SIP','getTeams','Team','ids','Agents','voicePause','interface','sequelize','addTeams','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xa1bb,0x9b));var _0xba1b=function(_0x175cd1,_0x5dd9f8){_0x175cd1=_0x175cd1-0x0;var _0x3ff513=_0xa1bb[_0x175cd1];return _0x3ff513;};'use strict';var emlformat=require(_0xba1b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba1b('0x1'));var rp=require(_0xba1b('0x2'));var moment=require(_0xba1b('0x3'));var BPromise=require(_0xba1b('0x4'));var Mustache=require(_0xba1b('0x5'));var util=require(_0xba1b('0x6'));var path=require(_0xba1b('0x7'));var sox=require(_0xba1b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba1b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xba1b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xba1b('0xb'));var toCsv=require(_0xba1b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba1b('0xd'));var authService=require(_0xba1b('0xe'));var qs=require(_0xba1b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba1b('0x10'));var logger=require(_0xba1b('0x11'))(_0xba1b('0x12'));var utils=require(_0xba1b('0x13'));var config=require(_0xba1b('0x14'));var licenseUtil=require(_0xba1b('0x15'));var db=require(_0xba1b('0x16'))['db'];config[_0xba1b('0x17')]=_['defaults'](config[_0xba1b('0x17')],{'host':_0xba1b('0x18'),'port':0x18eb});var socket=require(_0xba1b('0x19'))(new Redis(config[_0xba1b('0x17')]));require(_0xba1b('0x1a'))[_0xba1b('0x1b')](socket);function respondWithStatusCode(_0x417274,_0xb11313){_0xb11313=_0xb11313||0xcc;return function(_0x4ee2a3){if(_0x4ee2a3){return _0x417274[_0xba1b('0x1c')](_0xb11313);}return _0x417274['status'](_0xb11313)[_0xba1b('0x1d')]();};}function respondWithResult(_0x24397f,_0x17da05){_0x17da05=_0x17da05||0xc8;return function(_0x1dbde1){if(_0x1dbde1){return _0x24397f[_0xba1b('0x1e')](_0x17da05)[_0xba1b('0x1f')](_0x1dbde1);}};}function respondWithFilteredResult(_0x487867,_0x29f578){return function(_0x3d2cf6){if(_0x3d2cf6){var _0x50f421=typeof _0x29f578['offset']===_0xba1b('0x20')&&typeof _0x29f578[_0xba1b('0x21')]===_0xba1b('0x20');var _0x4c9b1f=_0x3d2cf6['count'];var _0x252bf0=_0x50f421?0x0:_0x29f578['offset'];var _0xab1997=_0x50f421?_0x3d2cf6[_0xba1b('0x22')]:_0x29f578[_0xba1b('0x23')]+_0x29f578['limit'];var _0x545a9d;if(_0xab1997>=_0x4c9b1f){_0xab1997=_0x4c9b1f;_0x545a9d=0xc8;}else{_0x545a9d=0xce;}_0x487867[_0xba1b('0x1e')](_0x545a9d);return _0x487867[_0xba1b('0x24')](_0xba1b('0x25'),_0x252bf0+'-'+_0xab1997+'/'+_0x4c9b1f)[_0xba1b('0x1f')](_0x3d2cf6);}return null;};}function patchUpdates(_0x452883){return function(_0x5cdaea){try{jsonpatch[_0xba1b('0x26')](_0x5cdaea,_0x452883,!![]);}catch(_0x2241af){return BPromise['reject'](_0x2241af);}return _0x5cdaea[_0xba1b('0x27')]();};}function saveUpdates(_0x1799f9,_0x2e44bd){return function(_0x504748){if(_0x504748){return _0x504748[_0xba1b('0x28')](_0x1799f9)[_0xba1b('0x29')](function(_0x7a7bb0){return _0x7a7bb0;});}return null;};}function removeEntity(_0x4cd385,_0x5ec0f4){return function(_0x4a0dd8){if(_0x4a0dd8){return _0x4a0dd8[_0xba1b('0x2a')]()['then'](function(){var _0x5c7363=_0x4a0dd8[_0xba1b('0x2b')]({'plain':!![]});var _0x5c2781='MailQueues';return db[_0xba1b('0x2c')][_0xba1b('0x2a')]({'where':{'type':_0x5c2781,'resourceId':_0x5c7363['id']}})[_0xba1b('0x29')](function(){return _0x4a0dd8;});})[_0xba1b('0x29')](function(){_0x4cd385['status'](0xcc)[_0xba1b('0x1d')]();});}};}function handleEntityNotFound(_0x3b113a,_0x3f3b79){return function(_0x3f45f5){if(!_0x3f45f5){_0x3b113a['sendStatus'](0x194);}return _0x3f45f5;};}function handleError(_0x1a5450,_0x2b789b){_0x2b789b=_0x2b789b||0x1f4;return function(_0x398981){logger[_0xba1b('0x2d')](_0x398981[_0xba1b('0x2e')]);if(_0x398981[_0xba1b('0x2f')]){delete _0x398981[_0xba1b('0x2f')];}_0x1a5450[_0xba1b('0x1e')](_0x2b789b)[_0xba1b('0x30')](_0x398981);};}exports['index']=function(_0x1d20e0,_0x48797a){var _0x2dd260={},_0x19361d={},_0x3b86be={'count':0x0,'rows':[]};var _0x18b024=_[_0xba1b('0x31')](db['MailQueue']['rawAttributes'],function(_0x3f77fc){return{'name':_0x3f77fc[_0xba1b('0x32')],'type':_0x3f77fc[_0xba1b('0x33')][_0xba1b('0x34')]};});_0x19361d[_0xba1b('0x35')]=_['map'](_0x18b024,_0xba1b('0x2f'));_0x19361d['query']=_['keys'](_0x1d20e0['query']);_0x19361d[_0xba1b('0x36')]=_['intersection'](_0x19361d[_0xba1b('0x35')],_0x19361d['query']);_0x2dd260[_0xba1b('0x37')]=_[_0xba1b('0x38')](_0x19361d['model'],qs[_0xba1b('0x39')](_0x1d20e0[_0xba1b('0x3a')]['fields']));_0x2dd260['attributes']=_0x2dd260[_0xba1b('0x37')][_0xba1b('0x3b')]?_0x2dd260[_0xba1b('0x37')]:_0x19361d[_0xba1b('0x35')];if(!_0x1d20e0[_0xba1b('0x3a')][_0xba1b('0x3c')](_0xba1b('0x3d'))){_0x2dd260[_0xba1b('0x21')]=qs['limit'](_0x1d20e0[_0xba1b('0x3a')][_0xba1b('0x21')]);_0x2dd260[_0xba1b('0x23')]=qs[_0xba1b('0x23')](_0x1d20e0[_0xba1b('0x3a')][_0xba1b('0x23')]);}_0x2dd260['order']=qs[_0xba1b('0x3e')](_0x1d20e0[_0xba1b('0x3a')][_0xba1b('0x3e')]);_0x2dd260[_0xba1b('0x3f')]=qs['filters'](_['pick'](_0x1d20e0[_0xba1b('0x3a')],_0x19361d[_0xba1b('0x36')]),_0x18b024);if(_0x1d20e0[_0xba1b('0x3a')][_0xba1b('0x40')]){_0x2dd260[_0xba1b('0x3f')]=_[_0xba1b('0x41')](_0x2dd260['where'],{'$or':_[_0xba1b('0x31')](_0x18b024,function(_0x3288da){if(_0x3288da[_0xba1b('0x33')]!==_0xba1b('0x42')){var _0x4b6d83={};_0x4b6d83[_0x3288da['name']]={'$like':'%'+_0x1d20e0['query'][_0xba1b('0x40')]+'%'};return _0x4b6d83;}})});}_0x2dd260=_['merge']({},_0x2dd260,_0x1d20e0[_0xba1b('0x43')]);var _0x4ea9af={'where':_0x2dd260[_0xba1b('0x3f')]};return db[_0xba1b('0x44')][_0xba1b('0x22')](_0x4ea9af)[_0xba1b('0x29')](function(_0x29892b){_0x3b86be[_0xba1b('0x22')]=_0x29892b;if(_0x1d20e0['query'][_0xba1b('0x45')]){_0x2dd260[_0xba1b('0x46')]=[{'all':!![]}];}return db[_0xba1b('0x44')][_0xba1b('0x47')](_0x2dd260);})[_0xba1b('0x29')](function(_0x34326b){_0x3b86be['rows']=_0x34326b;return _0x3b86be;})['then'](respondWithFilteredResult(_0x48797a,_0x2dd260))[_0xba1b('0x48')](handleError(_0x48797a,null));};exports[_0xba1b('0x49')]=function(_0x291ceb,_0x3a13ad){var _0x2bcc6e={'raw':!![],'where':{'id':_0x291ceb['params']['id']}},_0x50061a={};_0x50061a[_0xba1b('0x35')]=_['keys'](db[_0xba1b('0x44')][_0xba1b('0x4a')]);_0x50061a['query']=_[_0xba1b('0x4b')](_0x291ceb[_0xba1b('0x3a')]);_0x50061a[_0xba1b('0x36')]=_[_0xba1b('0x38')](_0x50061a[_0xba1b('0x35')],_0x50061a[_0xba1b('0x3a')]);_0x2bcc6e[_0xba1b('0x37')]=_['intersection'](_0x50061a[_0xba1b('0x35')],qs[_0xba1b('0x39')](_0x291ceb[_0xba1b('0x3a')][_0xba1b('0x39')]));_0x2bcc6e[_0xba1b('0x37')]=_0x2bcc6e['attributes'][_0xba1b('0x3b')]?_0x2bcc6e['attributes']:_0x50061a['model'];if(_0x291ceb[_0xba1b('0x3a')]['includeAll']){_0x2bcc6e[_0xba1b('0x46')]=[{'all':!![]}];}_0x2bcc6e=_[_0xba1b('0x41')]({},_0x2bcc6e,_0x291ceb[_0xba1b('0x43')]);return db['MailQueue']['find'](_0x2bcc6e)[_0xba1b('0x29')](handleEntityNotFound(_0x3a13ad,null))[_0xba1b('0x29')](respondWithResult(_0x3a13ad,null))[_0xba1b('0x48')](handleError(_0x3a13ad,null));};exports[_0xba1b('0x4c')]=function(_0x1f2e41,_0x3cacfe){return db[_0xba1b('0x44')][_0xba1b('0x4c')](_0x1f2e41[_0xba1b('0x4d')],{})[_0xba1b('0x29')](function(_0x380d19){var _0x16895b=_0x1f2e41['user'][_0xba1b('0x2b')]({'plain':!![]});if(!_0x16895b)throw new Error(_0xba1b('0x4e'));if(_0x16895b[_0xba1b('0x4f')]===_0xba1b('0x50')){var _0x3a3711=_0x380d19[_0xba1b('0x2b')]({'plain':!![]});var _0x363d50=_0xba1b('0x51');return db[_0xba1b('0x52')][_0xba1b('0x53')]({'where':{'name':_0x363d50,'userProfileId':_0x16895b[_0xba1b('0x54')]},'raw':!![]})[_0xba1b('0x29')](function(_0x412e7b){if(_0x412e7b&&_0x412e7b[_0xba1b('0x55')]===0x0){return db[_0xba1b('0x2c')][_0xba1b('0x4c')]({'name':_0x3a3711['name'],'resourceId':_0x3a3711['id'],'type':_0x412e7b[_0xba1b('0x2f')],'sectionId':_0x412e7b['id']},{})['then'](function(){return _0x380d19;});}else{return _0x380d19;}})[_0xba1b('0x48')](function(_0x3bf2fa){logger[_0xba1b('0x2d')](_0xba1b('0x56'),_0x3bf2fa);throw _0x3bf2fa;});}return _0x380d19;})['then'](respondWithResult(_0x3cacfe,0xc9))[_0xba1b('0x48')](handleError(_0x3cacfe,null));};exports[_0xba1b('0x28')]=function(_0x4bd209,_0x3c8245){if(_0x4bd209[_0xba1b('0x4d')]['id']){delete _0x4bd209[_0xba1b('0x4d')]['id'];}return db[_0xba1b('0x44')][_0xba1b('0x53')]({'where':{'id':_0x4bd209[_0xba1b('0x57')]['id']}})[_0xba1b('0x29')](handleEntityNotFound(_0x3c8245,null))[_0xba1b('0x29')](saveUpdates(_0x4bd209[_0xba1b('0x4d')],null))[_0xba1b('0x29')](respondWithResult(_0x3c8245,null))[_0xba1b('0x48')](handleError(_0x3c8245,null));};exports['destroy']=function(_0x129227,_0x10c26a){return db[_0xba1b('0x44')]['find']({'where':{'id':_0x129227[_0xba1b('0x57')]['id']}})['then'](handleEntityNotFound(_0x10c26a,null))[_0xba1b('0x29')](removeEntity(_0x10c26a,null))[_0xba1b('0x48')](handleError(_0x10c26a,null));};exports[_0xba1b('0x58')]=function(_0x14f9f4,_0x3e1027){return db[_0xba1b('0x44')]['describe']()[_0xba1b('0x29')](respondWithResult(_0x3e1027,null))[_0xba1b('0x48')](handleError(_0x3e1027,null));};exports['getMembers']=function(_0x8d67a,_0xbc1a20,_0x2ad151){var _0x76bcc7={'raw':!![],'where':{}},_0x453527={},_0x52ed35;return db[_0xba1b('0x44')][_0xba1b('0x59')]({'where':{'id':_0x8d67a[_0xba1b('0x57')]['id']}})[_0xba1b('0x29')](handleEntityNotFound(_0xbc1a20,null))[_0xba1b('0x29')](function(_0x514db4){if(_0x514db4){_0x52ed35=_0x514db4[_0xba1b('0x2b')]({'plain':!![]});_0x453527[_0xba1b('0x35')]=_[_0xba1b('0x4b')](db[_0xba1b('0x5a')]['rawAttributes']);_0x453527[_0xba1b('0x3a')]=_[_0xba1b('0x4b')](_0x8d67a[_0xba1b('0x3a')]);_0x453527[_0xba1b('0x36')]=_[_0xba1b('0x38')](_0x453527[_0xba1b('0x35')],_0x453527[_0xba1b('0x3a')]);_0x76bcc7[_0xba1b('0x37')]=_['intersection'](_0x453527[_0xba1b('0x35')],qs[_0xba1b('0x39')](_0x8d67a[_0xba1b('0x3a')][_0xba1b('0x39')]));_0x76bcc7[_0xba1b('0x37')]=_0x76bcc7[_0xba1b('0x37')][_0xba1b('0x3b')]?_0x76bcc7[_0xba1b('0x37')]:_0x453527['model'];if(!_0x8d67a['query'][_0xba1b('0x3c')](_0xba1b('0x3d'))){_0x76bcc7[_0xba1b('0x21')]=qs[_0xba1b('0x21')](_0x8d67a[_0xba1b('0x3a')][_0xba1b('0x21')]);_0x76bcc7[_0xba1b('0x23')]=qs['offset'](_0x8d67a['query'][_0xba1b('0x23')]);}_0x76bcc7[_0xba1b('0x5b')]=qs[_0xba1b('0x3e')](_0x8d67a[_0xba1b('0x3a')][_0xba1b('0x3e')]);_0x76bcc7[_0xba1b('0x3f')]=qs[_0xba1b('0x36')](_[_0xba1b('0x5c')](_0x8d67a[_0xba1b('0x3a')],_0x453527[_0xba1b('0x36')]));_0x76bcc7['where'][_0xba1b('0x5d')]=_0x514db4['id'];if(_0x8d67a[_0xba1b('0x3a')][_0xba1b('0x40')]){_0x76bcc7['where']=_[_0xba1b('0x41')](_0x76bcc7[_0xba1b('0x3f')],{'$or':_[_0xba1b('0x31')](_0x76bcc7[_0xba1b('0x37')],function(_0x15f3e9){var _0x406d6c={};_0x406d6c[_0x15f3e9]={'$like':'%'+_0x8d67a[_0xba1b('0x3a')][_0xba1b('0x40')]+'%'};return _0x406d6c;})});}_0x76bcc7=_['merge']({},_0x76bcc7,_0x8d67a[_0xba1b('0x43')]);return db[_0xba1b('0x5a')][_0xba1b('0x47')](_0x76bcc7);}})['then'](function(_0x4b7b4e){if(_0x4b7b4e){return db['User'][_0xba1b('0x5e')]({'where':{'id':_[_0xba1b('0x31')](_0x4b7b4e,'UserId'),'role':'agent'},'attributes':['id',_0xba1b('0x2f'),_0xba1b('0x5f'),_0xba1b('0x60'),'createdAt']});}})['then'](function(_0x214177){if(_0x214177){return{'count':_0x214177[_0xba1b('0x22')],'rows':_[_0xba1b('0x31')](_0x214177[_0xba1b('0x61')],function(_0x40b544){return{'membername':_0x40b544['name'],'UserId':_0x40b544['id'],'queue_name':_0x52ed35[_0xba1b('0x2f')],'MailQueueId':_0x52ed35['id'],'interface':util['format']('%s/%s',_0xba1b('0x62'),_0x40b544[_0xba1b('0x2f')]),'penalty':0x0,'paused':_0x40b544['mailPause'],'createdAt':_0x40b544['createdAt'],'updatedAt':_0x40b544['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xba1b('0x29')](respondWithFilteredResult(_0xbc1a20,_0x76bcc7))[_0xba1b('0x48')](handleError(_0xbc1a20,null));};exports[_0xba1b('0x63')]=function(_0x3dd10d,_0x5515c4,_0x318fcf){var _0x49e3de={};var _0x174171={};var _0x252f13;var _0x49229f;return db[_0xba1b('0x44')][_0xba1b('0x59')]({'where':{'id':_0x3dd10d[_0xba1b('0x57')]['id']}})[_0xba1b('0x29')](handleEntityNotFound(_0x5515c4,null))[_0xba1b('0x29')](function(_0x337b34){if(_0x337b34){_0x252f13=_0x337b34;_0x174171[_0xba1b('0x35')]=_['keys'](db[_0xba1b('0x64')][_0xba1b('0x4a')]);_0x174171[_0xba1b('0x3a')]=_['keys'](_0x3dd10d[_0xba1b('0x3a')]);_0x174171[_0xba1b('0x36')]=_[_0xba1b('0x38')](_0x174171[_0xba1b('0x35')],_0x174171[_0xba1b('0x3a')]);_0x49e3de[_0xba1b('0x37')]=_[_0xba1b('0x38')](_0x174171[_0xba1b('0x35')],qs[_0xba1b('0x39')](_0x3dd10d[_0xba1b('0x3a')]['fields']));_0x49e3de['attributes']=_0x49e3de[_0xba1b('0x37')][_0xba1b('0x3b')]?_0x49e3de[_0xba1b('0x37')]:_0x174171[_0xba1b('0x35')];_0x49e3de['order']=qs['sort'](_0x3dd10d[_0xba1b('0x3a')]['sort']);_0x49e3de['where']=qs['filters'](_[_0xba1b('0x5c')](_0x3dd10d[_0xba1b('0x3a')],_0x174171[_0xba1b('0x36')]));if(_0x3dd10d['query'][_0xba1b('0x40')]){_0x49e3de[_0xba1b('0x3f')]=_[_0xba1b('0x41')](_0x49e3de[_0xba1b('0x3f')],{'$or':_[_0xba1b('0x31')](_0x49e3de['attributes'],function(_0x6ea82a){var _0xea54ad={};_0xea54ad[_0x6ea82a]={'$like':'%'+_0x3dd10d[_0xba1b('0x3a')][_0xba1b('0x40')]+'%'};return _0xea54ad;})});}_0x49e3de=_[_0xba1b('0x41')]({},_0x49e3de,_0x3dd10d[_0xba1b('0x43')]);return _0x252f13[_0xba1b('0x63')](_0x49e3de);}})['then'](function(_0x1bcc8e){if(_0x1bcc8e){_0x49229f=_0x1bcc8e[_0xba1b('0x3b')];if(!_0x3dd10d[_0xba1b('0x3a')][_0xba1b('0x3c')](_0xba1b('0x3d'))){_0x49e3de['limit']=qs[_0xba1b('0x21')](_0x3dd10d['query'][_0xba1b('0x21')]);_0x49e3de[_0xba1b('0x23')]=qs['offset'](_0x3dd10d[_0xba1b('0x3a')][_0xba1b('0x23')]);}return _0x252f13[_0xba1b('0x63')](_0x49e3de);}})[_0xba1b('0x29')](function(_0x25c822){if(_0x25c822){return _0x25c822?{'count':_0x49229f,'rows':_0x25c822}:null;}})[_0xba1b('0x29')](respondWithResult(_0x5515c4,null))[_0xba1b('0x48')](handleError(_0x5515c4,null));};exports['addTeams']=function(_0x3c7328,_0x527973,_0x266491){var _0x524019=_0x3c7328[_0xba1b('0x4d')][_0xba1b('0x65')];return db[_0xba1b('0x64')][_0xba1b('0x47')]({'where':{'id':_0x524019},'attributes':['id'],'include':[{'model':db['User'],'as':_0xba1b('0x66'),'attributes':['id',_0xba1b('0x2f'),'online',_0xba1b('0x67'),_0xba1b('0x68')],'raw':!![]}]})[_0xba1b('0x29')](function(_0x26072c){if(_0x26072c){var _0x57a6ee=_['flatMap'](_0x26072c,function(_0x4dd59f){var _0x3320a2=_0x4dd59f[_0xba1b('0x2b')]({'plain':!![]});return _0x3320a2[_0xba1b('0x66')];});return db[_0xba1b('0x44')][_0xba1b('0x53')]({'where':{'id':_0x3c7328['params']['id']}})[_0xba1b('0x29')](function(_0x7ba601){return db[_0xba1b('0x69')]['transaction'](function(_0x19100a){return _0x7ba601[_0xba1b('0x6a')](_0x524019,{'transaction':_0x19100a})['then'](function(){return BPromise[_0xba1b('0x6b')](_0x57a6ee,function(_0x3b58e0){return db[_0xba1b('0x5a')]['findOrCreate']({'where':{'UserId':_0x3b58e0['id'],'MailQueueId':_0x3c7328[_0xba1b('0x57')]['id']},'transaction':_0x19100a});});})[_0xba1b('0x29')](function(){_0x57a6ee[_0xba1b('0x6c')](function(_0x4b2fa3){socket[_0xba1b('0x6d')](_0xba1b('0x6e'),{'UserId':_0x4b2fa3['id'],'MailQueueId':_0x7ba601['id']});});});});});}})[_0xba1b('0x29')](respondWithStatusCode(_0x527973,null))['catch'](handleError(_0x527973,null));};exports[_0xba1b('0x6f')]=function(_0x324ffa,_0x4b7a01,_0x5f0a49){return db['Team'][_0xba1b('0x47')]({'where':{'id':_0x324ffa[_0xba1b('0x3a')][_0xba1b('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xba1b('0x29')](handleEntityNotFound(_0x4b7a01,null))[_0xba1b('0x29')](function(_0x19dad9){var _0x1db6e5=_['map'](_0x19dad9,'id');var _0x297c65=[];var _0x299e43=[];var _0x537106=squel[_0xba1b('0x70')]();_0x537106[_0xba1b('0x71')](_0xba1b('0x72'))['from']('team_has_mail_queues','tq')['join']('user_has_teams','ut',_0xba1b('0x73'))['where'](_0xba1b('0x74'),_0x324ffa['params']['id']);for(var _0x5800a4=0x0;_0x5800a4<_0x19dad9['length'];_0x5800a4+=0x1){let _0x4c824c=_0x19dad9[_0x5800a4];for(var _0x55f38d=0x0;_0x55f38d<_0x4c824c['Agents'][_0xba1b('0x3b')];_0x55f38d+=0x1){let _0x4b344d=_0x4c824c[_0xba1b('0x66')][_0x55f38d];var _0x1a2a02=_0x537106[_0xba1b('0x75')]();_0x1a2a02[_0xba1b('0x3f')](_0xba1b('0x76'),_0x4b344d['id']);_0x299e43[_0xba1b('0x77')](db[_0xba1b('0x69')][_0xba1b('0x3a')](_0x1a2a02['toString'](),{'type':db[_0xba1b('0x69')]['QueryTypes'][_0xba1b('0x78')]})['then'](function(_0x3cfba9){if(_0x3cfba9[_0xba1b('0x3b')]===0x1){return _0x4b344d['id'];}else{var _0x1a6fe3=_[_0xba1b('0x79')](_[_0xba1b('0x31')](_0x3cfba9,_0xba1b('0x7a')),function(_0x43fdd0){return _[_0xba1b('0x7b')](_0x1db6e5,_0x43fdd0);});if(_0x1a6fe3){return _0x4b344d['id'];}}}));}}return BPromise[_0xba1b('0x7c')](_0x299e43)['then'](function(_0x95977){_0x297c65=_(_0x297c65)[_0xba1b('0x7d')](_0x95977)[_0xba1b('0x7e')]()['value']();return db[_0xba1b('0x44')][_0xba1b('0x53')]({'where':{'id':_0x324ffa['params']['id']}})[_0xba1b('0x29')](function(_0x2f3f7e){return db[_0xba1b('0x69')][_0xba1b('0x7f')](function(_0x215c63){return _0x2f3f7e[_0xba1b('0x6f')](_0x324ffa[_0xba1b('0x3a')][_0xba1b('0x65')],{'transaction':_0x215c63})['then'](function(){if(!_['isEmpty'](_0x297c65)){return _0x2f3f7e[_0xba1b('0x80')](_0x297c65,{'transaction':_0x215c63});}})['then'](function(){_0x297c65[_0xba1b('0x6c')](function(_0xf6cdda){socket[_0xba1b('0x6d')](_0xba1b('0x81'),{'UserId':_0xf6cdda,'MailQueueId':_0x2f3f7e['id']});});});});});});})['then'](respondWithStatusCode(_0x4b7a01,null))[_0xba1b('0x48')](handleError(_0x4b7a01,null));};exports[_0xba1b('0x82')]=function(_0x84d0b2,_0x11717f,_0x203877){return db[_0xba1b('0x44')][_0xba1b('0x53')]({'where':{'id':_0x84d0b2[_0xba1b('0x57')]['id']}})[_0xba1b('0x29')](handleEntityNotFound(_0x11717f,null))[_0xba1b('0x29')](function(_0x49ace2){if(_0x49ace2){return _0x49ace2[_0xba1b('0x82')](_0x84d0b2[_0xba1b('0x4d')][_0xba1b('0x65')],_['omit'](_0x84d0b2[_0xba1b('0x4d')],[_0xba1b('0x65'),'id'])||{})[_0xba1b('0x83')](function(_0x5df8bb){for(var _0xa89f3e=0x0;_0xa89f3e<_0x84d0b2[_0xba1b('0x4d')]['ids'][_0xba1b('0x3b')];_0xa89f3e+=0x1){socket[_0xba1b('0x6d')](_0xba1b('0x6e'),{'UserId':Number(_0x84d0b2[_0xba1b('0x4d')][_0xba1b('0x65')][_0xa89f3e]),'MailQueueId':Number(_0x84d0b2[_0xba1b('0x57')]['id'])});}return _0x5df8bb;});}})[_0xba1b('0x29')](respondWithResult(_0x11717f,null))[_0xba1b('0x48')](handleError(_0x11717f,null));};exports[_0xba1b('0x80')]=function(_0x2f172d,_0x333300,_0x1b5261){return db[_0xba1b('0x44')][_0xba1b('0x53')]({'where':{'id':_0x2f172d[_0xba1b('0x57')]['id']}})['then'](handleEntityNotFound(_0x333300,null))[_0xba1b('0x29')](function(_0x5d8464){if(_0x5d8464){return _0x5d8464[_0xba1b('0x80')](_0x2f172d[_0xba1b('0x3a')][_0xba1b('0x65')])[_0xba1b('0x29')](function(){if(_[_0xba1b('0x84')](_0x2f172d[_0xba1b('0x3a')][_0xba1b('0x65')])){for(var _0x245fcc=0x0;_0x245fcc<_0x2f172d[_0xba1b('0x3a')][_0xba1b('0x65')][_0xba1b('0x3b')];_0x245fcc+=0x1){socket[_0xba1b('0x6d')](_0xba1b('0x81'),{'UserId':Number(_0x2f172d[_0xba1b('0x3a')][_0xba1b('0x65')][_0x245fcc]),'MailQueueId':Number(_0x2f172d[_0xba1b('0x57')]['id'])});}}else{socket[_0xba1b('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x2f172d['query']['ids']),'MailQueueId':Number(_0x2f172d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x333300,null))[_0xba1b('0x48')](handleError(_0x333300,null));};exports['getAgents']=function(_0x4803b1,_0xdf0602,_0x2a3a03){var _0x1447b1={};var _0x1b8f87={};var _0x5634ec;var _0x30793e;return db[_0xba1b('0x44')]['findOne']({'where':{'id':_0x4803b1[_0xba1b('0x57')]['id']}})[_0xba1b('0x29')](handleEntityNotFound(_0xdf0602,null))[_0xba1b('0x29')](function(_0x490562){if(_0x490562){_0x5634ec=_0x490562;_0x1b8f87[_0xba1b('0x35')]=_[_0xba1b('0x4b')](db[_0xba1b('0x85')][_0xba1b('0x4a')]);_0x1b8f87[_0xba1b('0x3a')]=_[_0xba1b('0x4b')](_0x4803b1[_0xba1b('0x3a')]);_0x1b8f87[_0xba1b('0x36')]=_[_0xba1b('0x38')](_0x1b8f87[_0xba1b('0x35')],_0x1b8f87[_0xba1b('0x3a')]);_0x1447b1[_0xba1b('0x37')]=_['intersection'](_0x1b8f87[_0xba1b('0x35')],qs[_0xba1b('0x39')](_0x4803b1[_0xba1b('0x3a')]['fields']));_0x1447b1[_0xba1b('0x37')]=_0x1447b1[_0xba1b('0x37')][_0xba1b('0x3b')]?_0x1447b1[_0xba1b('0x37')]:_0x1b8f87[_0xba1b('0x35')];_0x1447b1[_0xba1b('0x5b')]=qs[_0xba1b('0x3e')](_0x4803b1[_0xba1b('0x3a')][_0xba1b('0x3e')]);_0x1447b1[_0xba1b('0x3f')]=qs[_0xba1b('0x36')](_[_0xba1b('0x5c')](_0x4803b1[_0xba1b('0x3a')],_0x1b8f87[_0xba1b('0x36')]));if(_0x4803b1[_0xba1b('0x3a')][_0xba1b('0x40')]){_0x1447b1['where']=_['merge'](_0x1447b1['where'],{'$or':_[_0xba1b('0x31')](_0x1447b1['attributes'],function(_0xef3234){var _0x1ef1be={};_0x1ef1be[_0xef3234]={'$like':'%'+_0x4803b1[_0xba1b('0x3a')][_0xba1b('0x40')]+'%'};return _0x1ef1be;})});}_0x1447b1=_[_0xba1b('0x41')]({},_0x1447b1,_0x4803b1[_0xba1b('0x43')]);return _0x5634ec[_0xba1b('0x86')](_0x1447b1);}})[_0xba1b('0x29')](function(_0x2df394){if(_0x2df394){_0x30793e=_0x2df394[_0xba1b('0x3b')];if(!_0x4803b1[_0xba1b('0x3a')][_0xba1b('0x3c')](_0xba1b('0x3d'))){_0x1447b1[_0xba1b('0x21')]=qs['limit'](_0x4803b1[_0xba1b('0x3a')][_0xba1b('0x21')]);_0x1447b1[_0xba1b('0x23')]=qs[_0xba1b('0x23')](_0x4803b1['query'][_0xba1b('0x23')]);}return _0x5634ec[_0xba1b('0x86')](_0x1447b1);}})[_0xba1b('0x29')](function(_0xeb1deb){if(_0xeb1deb){return _0xeb1deb?{'count':_0x30793e,'rows':_0xeb1deb}:null;}})[_0xba1b('0x29')](respondWithResult(_0xdf0602,null))[_0xba1b('0x48')](handleError(_0xdf0602,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index cadbfda..be6f131 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 _0xe26d=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xe26d,0x11d));var _0xde26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe26d[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xde26('0x0'));var MailQueue=require(_0xde26('0x1'))['db'][_0xde26('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xde26('0x3')](0x0);var events={'afterCreate':_0xde26('0x4'),'afterUpdate':'update','afterDestroy':_0xde26('0x5')};function emitEvent(_0x5e7597){return function(_0x3f5571,_0x46feeb,_0x199ec7){MailQueueEvents[_0xde26('0x6')](_0x5e7597+':'+_0x3f5571['id'],_0x3f5571);MailQueueEvents[_0xde26('0x6')](_0x5e7597,_0x3f5571);_0x199ec7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xde26('0x7')](e,emitEvent(event));}}module[_0xde26('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x6cda=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x2326ae,_0x30cafb){var _0x26af09=function(_0x4683f5){while(--_0x4683f5){_0x2326ae['push'](_0x2326ae['shift']());}};_0x26af09(++_0x30cafb);}(_0x6cda,0x74));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa6cd('0x0'));var MailQueue=require(_0xa6cd('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa6cd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6cd('0x3'),'afterDestroy':_0xa6cd('0x4')};function emitEvent(_0x563b54){return function(_0x18c23f,_0x260fcf,_0x5d2c92){MailQueueEvents[_0xa6cd('0x5')](_0x563b54+':'+_0x18c23f['id'],_0x18c23f);MailQueueEvents['emit'](_0x563b54,_0x18c23f);_0x5d2c92(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xa6cd('0x6')](e,emitEvent(event));}}module[_0xa6cd('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 412ccf4..b467133 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 _0xd25d=['MailQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x2582f1,_0x5210fd){var _0x2a2252=function(_0x5e6871){while(--_0x5e6871){_0x2582f1['push'](_0x2582f1['shift']());}};_0x2a2252(++_0x5210fd);}(_0xd25d,0x18d));var _0xdd25=function(_0x206049,_0x29d6fb){_0x206049=_0x206049-0x0;var _0x56161a=_0xd25d[_0x206049];return _0x56161a;};'use strict';var _=require(_0xdd25('0x0'));var util=require('util');var logger=require(_0xdd25('0x1'))(_0xdd25('0x2'));var moment=require(_0xdd25('0x3'));var BPromise=require(_0xdd25('0x4'));var rp=require(_0xdd25('0x5'));var fs=require('fs');var path=require(_0xdd25('0x6'));var rimraf=require(_0xdd25('0x7'));var config=require(_0xdd25('0x8'));var attributes=require(_0xdd25('0x9'));module[_0xdd25('0xa')]=function(_0x2915c5,_0xe2197b){return _0x2915c5['define'](_0xdd25('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85d5=['request-promise','path','rimraf','exports','define','MailQueue','lodash','util','../../config/logger'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x85d5,0xa8));var _0x585d=function(_0x411d5f,_0x29ac7a){_0x411d5f=_0x411d5f-0x0;var _0x57f439=_0x85d5[_0x411d5f];return _0x57f439;};'use strict';var _=require(_0x585d('0x0'));var util=require(_0x585d('0x1'));var logger=require(_0x585d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x585d('0x3'));var fs=require('fs');var path=require(_0x585d('0x4'));var rimraf=require(_0x585d('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x585d('0x6')]=function(_0x32b5fe,_0x30172a){return _0x32b5fe[_0x585d('0x7')](_0x585d('0x8'),attributes,{'tableName':'mail_queues','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 65845b5..cbf379f 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 _0x292b=['then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailQueue','findAll','options','raw','attributes','limit','include','map','model','MailQueue','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x36d20f,_0x133196){var _0x324a71=function(_0x2153b3){while(--_0x2153b3){_0x36d20f['push'](_0x36d20f['shift']());}};_0x324a71(++_0x133196);}(_0x292b,0x64));var _0xb292=function(_0x21c09f,_0x6ce866){_0x21c09f=_0x21c09f-0x0;var _0x164d58=_0x292b[_0x21c09f];return _0x164d58;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var moment=require(_0xb292('0x2'));var BPromise=require(_0xb292('0x3'));var rs=require(_0xb292('0x4'));var fs=require('fs');var Redis=require(_0xb292('0x5'));var db=require(_0xb292('0x6'))['db'];var utils=require(_0xb292('0x7'));var logger=require(_0xb292('0x8'))(_0xb292('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb292('0xa')]({'port':0x232a});config[_0xb292('0xb')]=_[_0xb292('0xc')](config['redis'],{'host':_0xb292('0xd'),'port':0x18eb});var socket=require(_0xb292('0xe'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xb292('0xf')](socket);function respondWithRpcPromise(_0xa30857,_0x36be8a,_0x5b4b7a){return new BPromise(function(_0x36517c,_0x3e4ac2){return client[_0xb292('0x10')](_0xa30857,_0x5b4b7a)[_0xb292('0x11')](function(_0x537d8b){logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,_0xb292('0x14'));logger[_0xb292('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x36be8a,_0xb292('0x14'),JSON[_0xb292('0x16')](_0x537d8b));if(_0x537d8b['error']){if(_0x537d8b['error']['code']===0x1f4){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x3e4ac2(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}logger[_0xb292('0x17')]('MailQueue,\x20%s,\x20%s',_0x36be8a,_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);return _0x36517c(_0x537d8b[_0xb292('0x17')][_0xb292('0x18')]);}else{logger[_0xb292('0x12')](_0xb292('0x13'),_0x36be8a,'request\x20sent');_0x36517c(_0x537d8b[_0xb292('0x19')][_0xb292('0x18')]);}})[_0xb292('0x1a')](function(_0x3ad738){logger[_0xb292('0x17')](_0xb292('0x13'),_0x36be8a,_0x3ad738);_0x3e4ac2(_0x3ad738);});});}exports[_0xb292('0x1b')]=function(_0x50e400){var _0x3a56eb=this;return new Promise(function(_0x336785,_0x4437d6){return db['MailQueue'][_0xb292('0x1c')]({'raw':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x50e400['options']?_0x50e400[_0xb292('0x1d')]['where']||null:null,'attributes':_0x50e400[_0xb292('0x1d')]?_0x50e400['options'][_0xb292('0x1f')]||null:null,'limit':_0x50e400['options']?_0x50e400[_0xb292('0x1d')][_0xb292('0x20')]||null:null,'include':_0x50e400[_0xb292('0x1d')]?_0x50e400[_0xb292('0x1d')][_0xb292('0x21')]?_[_0xb292('0x22')](_0x50e400['options']['include'],function(_0x5537ee){return{'model':db[_0x5537ee['model']],'as':_0x5537ee['as'],'attributes':_0x5537ee[_0xb292('0x1f')],'include':_0x5537ee[_0xb292('0x21')]?_[_0xb292('0x22')](_0x5537ee['include'],function(_0x4a1575){return{'model':db[_0x4a1575[_0xb292('0x23')]],'as':_0x4a1575['as'],'attributes':_0x4a1575[_0xb292('0x1f')],'include':_0x4a1575['include']?_['map'](_0x4a1575[_0xb292('0x21')],function(_0xde939c){return{'model':db[_0xde939c[_0xb292('0x23')]],'as':_0xde939c['as'],'attributes':_0xde939c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x5e5a29){logger[_0xb292('0x12')](_0xb292('0x1b'),_0x50e400);logger[_0xb292('0x15')](_0xb292('0x1b'),_0x50e400,JSON[_0xb292('0x16')](_0x5e5a29));_0x336785(_0x5e5a29);})[_0xb292('0x1a')](function(_0xe01a3b){logger['error'](_0xb292('0x1b'),_0xe01a3b[_0xb292('0x18')],_0x50e400);_0x4437d6(_0x3a56eb[_0xb292('0x17')](0x1f4,_0xe01a3b[_0xb292('0x18')]));});});};exports['ShowMailQueue']=function(_0x234fdc){var _0x110384=this;return new Promise(function(_0x444dc0,_0x33b8cf){return db[_0xb292('0x24')][_0xb292('0x25')]({'raw':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1e')]===undefined?!![]:![]:!![],'where':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')]['where']||null:null,'attributes':_0x234fdc[_0xb292('0x1d')]?_0x234fdc[_0xb292('0x1d')][_0xb292('0x1f')]||null:null,'include':_0x234fdc[_0xb292('0x1d')]?_0x234fdc['options']['include']?_[_0xb292('0x22')](_0x234fdc[_0xb292('0x1d')][_0xb292('0x21')],function(_0x7c58e3){return{'model':db[_0x7c58e3['model']],'as':_0x7c58e3['as'],'attributes':_0x7c58e3['attributes'],'include':_0x7c58e3[_0xb292('0x21')]?_[_0xb292('0x22')](_0x7c58e3[_0xb292('0x21')],function(_0xd1f9ae){return{'model':db[_0xd1f9ae[_0xb292('0x23')]],'as':_0xd1f9ae['as'],'attributes':_0xd1f9ae['attributes'],'include':_0xd1f9ae[_0xb292('0x21')]?_[_0xb292('0x22')](_0xd1f9ae[_0xb292('0x21')],function(_0x335d9c){return{'model':db[_0x335d9c[_0xb292('0x23')]],'as':_0x335d9c['as'],'attributes':_0x335d9c[_0xb292('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb292('0x11')](function(_0x1907e1){logger[_0xb292('0x12')](_0xb292('0x26'),_0x234fdc);logger[_0xb292('0x15')](_0xb292('0x26'),_0x234fdc,JSON[_0xb292('0x16')](_0x1907e1));_0x444dc0(_0x1907e1);})['catch'](function(_0x40d82c){logger[_0xb292('0x17')](_0xb292('0x26'),_0x40d82c[_0xb292('0x18')],_0x234fdc);_0x33b8cf(_0x110384[_0xb292('0x17')](0x1f4,_0x40d82c['message']));});});}; \ No newline at end of file +var _0xecee=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueue','findAll','options','where','attributes','limit','include','map','model','GetMailQueue','debug','ShowMailQueue','find','raw','lodash','util','moment','bluebird','../../config/utils','rpc'];(function(_0x1c7edb,_0x31abc8){var _0x2d96b1=function(_0x487734){while(--_0x487734){_0x1c7edb['push'](_0x1c7edb['shift']());}};_0x2d96b1(++_0x31abc8);}(_0xecee,0x1a7));var _0xeece=function(_0x1b8b85,_0x385eed){_0x1b8b85=_0x1b8b85-0x0;var _0xc6c7ae=_0xecee[_0x1b8b85];return _0xc6c7ae;};'use strict';var _=require(_0xeece('0x0'));var util=require(_0xeece('0x1'));var moment=require(_0xeece('0x2'));var BPromise=require(_0xeece('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeece('0x4'));var logger=require('../../config/logger')(_0xeece('0x5'));var config=require('../../config/environment');var jayson=require(_0xeece('0x6'));var client=jayson[_0xeece('0x7')]['http']({'port':0x232a});config[_0xeece('0x8')]=_[_0xeece('0x9')](config['redis'],{'host':_0xeece('0xa'),'port':0x18eb});var socket=require(_0xeece('0xb'))(new Redis(config[_0xeece('0x8')]));require(_0xeece('0xc'))[_0xeece('0xd')](socket);function respondWithRpcPromise(_0x2f449f,_0x3ffe77,_0x58e670){return new BPromise(function(_0x54e734,_0x328b8a){return client[_0xeece('0xe')](_0x2f449f,_0x58e670)[_0xeece('0xf')](function(_0x5a5633){logger[_0xeece('0x10')](_0xeece('0x11'),_0x3ffe77,_0xeece('0x12'));logger['debug'](_0xeece('0x13'),_0x3ffe77,'request\x20sent',JSON[_0xeece('0x14')](_0x5a5633));if(_0x5a5633[_0xeece('0x15')]){if(_0x5a5633[_0xeece('0x15')]['code']===0x1f4){logger[_0xeece('0x15')](_0xeece('0x11'),_0x3ffe77,_0x5a5633[_0xeece('0x15')][_0xeece('0x16')]);return _0x328b8a(_0x5a5633[_0xeece('0x15')]['message']);}logger[_0xeece('0x15')]('MailQueue,\x20%s,\x20%s',_0x3ffe77,_0x5a5633['error'][_0xeece('0x16')]);return _0x54e734(_0x5a5633[_0xeece('0x15')][_0xeece('0x16')]);}else{logger[_0xeece('0x10')](_0xeece('0x11'),_0x3ffe77,_0xeece('0x12'));_0x54e734(_0x5a5633[_0xeece('0x17')][_0xeece('0x16')]);}})[_0xeece('0x18')](function(_0x2883db){logger[_0xeece('0x15')](_0xeece('0x11'),_0x3ffe77,_0x2883db);_0x328b8a(_0x2883db);});});}exports['GetMailQueue']=function(_0x35cd4b){var _0xff34f8=this;return new Promise(function(_0x12c643,_0x4387b2){return db[_0xeece('0x19')][_0xeece('0x1a')]({'raw':_0x35cd4b[_0xeece('0x1b')]?_0x35cd4b[_0xeece('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x35cd4b[_0xeece('0x1b')]?_0x35cd4b[_0xeece('0x1b')][_0xeece('0x1c')]||null:null,'attributes':_0x35cd4b[_0xeece('0x1b')]?_0x35cd4b[_0xeece('0x1b')][_0xeece('0x1d')]||null:null,'limit':_0x35cd4b[_0xeece('0x1b')]?_0x35cd4b[_0xeece('0x1b')][_0xeece('0x1e')]||null:null,'include':_0x35cd4b[_0xeece('0x1b')]?_0x35cd4b[_0xeece('0x1b')][_0xeece('0x1f')]?_[_0xeece('0x20')](_0x35cd4b[_0xeece('0x1b')][_0xeece('0x1f')],function(_0x4db8e6){return{'model':db[_0x4db8e6[_0xeece('0x21')]],'as':_0x4db8e6['as'],'attributes':_0x4db8e6[_0xeece('0x1d')],'include':_0x4db8e6['include']?_[_0xeece('0x20')](_0x4db8e6[_0xeece('0x1f')],function(_0x5afc9a){return{'model':db[_0x5afc9a['model']],'as':_0x5afc9a['as'],'attributes':_0x5afc9a[_0xeece('0x1d')],'include':_0x5afc9a[_0xeece('0x1f')]?_[_0xeece('0x20')](_0x5afc9a[_0xeece('0x1f')],function(_0x29fd26){return{'model':db[_0x29fd26[_0xeece('0x21')]],'as':_0x29fd26['as'],'attributes':_0x29fd26[_0xeece('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ac0ef){logger[_0xeece('0x10')](_0xeece('0x22'),_0x35cd4b);logger[_0xeece('0x23')](_0xeece('0x22'),_0x35cd4b,JSON[_0xeece('0x14')](_0x1ac0ef));_0x12c643(_0x1ac0ef);})['catch'](function(_0x365336){logger[_0xeece('0x15')](_0xeece('0x22'),_0x365336[_0xeece('0x16')],_0x35cd4b);_0x4387b2(_0xff34f8[_0xeece('0x15')](0x1f4,_0x365336[_0xeece('0x16')]));});});};exports[_0xeece('0x24')]=function(_0x4e353a){var _0x3e61fe=this;return new Promise(function(_0x20b8a5,_0x34b149){return db['MailQueue'][_0xeece('0x25')]({'raw':_0x4e353a[_0xeece('0x1b')]?_0x4e353a[_0xeece('0x1b')][_0xeece('0x26')]===undefined?!![]:![]:!![],'where':_0x4e353a[_0xeece('0x1b')]?_0x4e353a[_0xeece('0x1b')][_0xeece('0x1c')]||null:null,'attributes':_0x4e353a['options']?_0x4e353a['options'][_0xeece('0x1d')]||null:null,'include':_0x4e353a[_0xeece('0x1b')]?_0x4e353a['options'][_0xeece('0x1f')]?_[_0xeece('0x20')](_0x4e353a[_0xeece('0x1b')][_0xeece('0x1f')],function(_0x368409){return{'model':db[_0x368409[_0xeece('0x21')]],'as':_0x368409['as'],'attributes':_0x368409[_0xeece('0x1d')],'include':_0x368409[_0xeece('0x1f')]?_['map'](_0x368409['include'],function(_0x278cba){return{'model':db[_0x278cba['model']],'as':_0x278cba['as'],'attributes':_0x278cba[_0xeece('0x1d')],'include':_0x278cba['include']?_[_0xeece('0x20')](_0x278cba['include'],function(_0x3d2242){return{'model':db[_0x3d2242['model']],'as':_0x3d2242['as'],'attributes':_0x3d2242[_0xeece('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4100a0){logger[_0xeece('0x10')](_0xeece('0x24'),_0x4e353a);logger['debug'](_0xeece('0x24'),_0x4e353a,JSON[_0xeece('0x14')](_0x4100a0));_0x20b8a5(_0x4100a0);})[_0xeece('0x18')](function(_0x548c7a){logger[_0xeece('0x15')](_0xeece('0x24'),_0x548c7a['message'],_0x4e353a);_0x34b149(_0x3e61fe[_0xeece('0x15')](0x1f4,_0x548c7a[_0xeece('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index beda90e..1086716 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 _0xbbec=['removeListener','register','mailQueue:','./mailQueue.events','remove','emit'];(function(_0x5b2507,_0x480601){var _0x35b4d2=function(_0x1b2c69){while(--_0x1b2c69){_0x5b2507['push'](_0x5b2507['shift']());}};_0x35b4d2(++_0x480601);}(_0xbbec,0x7b));var _0xcbbe=function(_0x3659ce,_0x35f715){_0x3659ce=_0x3659ce-0x0;var _0x26bf29=_0xbbec[_0x3659ce];return _0x26bf29;};'use strict';var MailQueueEvents=require(_0xcbbe('0x0'));var events=['save',_0xcbbe('0x1'),'update'];function createListener(_0x2e2a6c,_0x204af5){return function(_0x1c4354){_0x204af5[_0xcbbe('0x2')](_0x2e2a6c,_0x1c4354);};}function removeListener(_0x4e53a7,_0x13c2aa){return function(){MailQueueEvents[_0xcbbe('0x3')](_0x4e53a7,_0x13c2aa);};}exports[_0xcbbe('0x4')]=function(_0x444a06){for(var _0x4aee98=0x0,_0x4b89bb=events['length'];_0x4aee98<_0x4b89bb;_0x4aee98++){var _0x477274=events[_0x4aee98];var _0x1d23d5=createListener(_0xcbbe('0x5')+_0x477274,_0x444a06);MailQueueEvents['on'](_0x477274,_0x1d23d5);}}; \ No newline at end of file +var _0xebb1=['save','remove','update','emit','removeListener','register','mailQueue:'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xebb1,0x1e3));var _0x1ebb=function(_0x56f5f2,_0x448e74){_0x56f5f2=_0x56f5f2-0x0;var _0x21da01=_0xebb1[_0x56f5f2];return _0x21da01;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x1ebb('0x0'),_0x1ebb('0x1'),_0x1ebb('0x2')];function createListener(_0x2db068,_0x3f5e50){return function(_0x19735f){_0x3f5e50[_0x1ebb('0x3')](_0x2db068,_0x19735f);};}function removeListener(_0x10a84c,_0x146501){return function(){MailQueueEvents[_0x1ebb('0x4')](_0x10a84c,_0x146501);};}exports[_0x1ebb('0x5')]=function(_0x58d76b){for(var _0x3628f2=0x0,_0x2d3115=events['length'];_0x3628f2<_0x2d3115;_0x3628f2++){var _0x5f4f64=events[_0x3628f2];var _0x5da402=createListener(_0x1ebb('0x6')+_0x5f4f64,_0x58d76b);MailQueueEvents['on'](_0x5f4f64,_0x5da402);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ee70264..bf7d0f0 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 _0x87e1=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x87e1,0x185));var _0x187e=function(_0x2a91f8,_0x449a8b){_0x2a91f8=_0x2a91f8-0x0;var _0x8e0541=_0x87e1[_0x2a91f8];return _0x8e0541;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x187e('0x0'));var express=require(_0x187e('0x1'));var router=express['Router']();var fs_extra=require(_0x187e('0x2'));var auth=require(_0x187e('0x3'));var interaction=require(_0x187e('0x4'));var config=require('../../config/environment');var controller=require(_0x187e('0x5'));router[_0x187e('0x6')]('/',auth[_0x187e('0x7')](),controller[_0x187e('0x8')]);router[_0x187e('0x6')](_0x187e('0x9'),auth['isAuthenticated'](),controller[_0x187e('0xa')]);router[_0x187e('0x6')]('/:id',auth[_0x187e('0x7')](),controller[_0x187e('0xb')]);router['post']('/',auth[_0x187e('0x7')](),controller[_0x187e('0xc')]);router[_0x187e('0xd')](_0x187e('0xe'),auth[_0x187e('0x7')](),controller[_0x187e('0xf')]);router[_0x187e('0x10')]('/:id',auth[_0x187e('0x7')](),controller[_0x187e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2837=['multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x6cbff6,_0x3b59f8){var _0x390e52=function(_0xff24a){while(--_0xff24a){_0x6cbff6['push'](_0x6cbff6['shift']());}};_0x390e52(++_0x3b59f8);}(_0x2837,0x1a4));var _0x7283=function(_0x313c8c,_0x5d70ad){_0x313c8c=_0x313c8c-0x0;var _0x4c0249=_0x2837[_0x313c8c];return _0x4c0249;};'use strict';var multer=require(_0x7283('0x0'));var util=require('util');var path=require(_0x7283('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7283('0x2')]();var fs_extra=require(_0x7283('0x3'));var auth=require(_0x7283('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7283('0x5'));var controller=require(_0x7283('0x6'));router[_0x7283('0x7')]('/',auth['isAuthenticated'](),controller[_0x7283('0x8')]);router['get'](_0x7283('0x9'),auth['isAuthenticated'](),controller[_0x7283('0xa')]);router['get'](_0x7283('0xb'),auth[_0x7283('0xc')](),controller['show']);router[_0x7283('0xd')]('/',auth['isAuthenticated'](),controller[_0x7283('0xe')]);router[_0x7283('0xf')](_0x7283('0xb'),auth['isAuthenticated'](),controller[_0x7283('0x10')]);router[_0x7283('0x11')](_0x7283('0xb'),auth[_0x7283('0xc')](),controller[_0x7283('0x12')]);module[_0x7283('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 5db87af..13aadd5 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 _0x6eb0=['DATE','moment','sequelize','exports','STRING'];(function(_0x4334ce,_0x3e72b9){var _0x5c03d1=function(_0x59a0f1){while(--_0x59a0f1){_0x4334ce['push'](_0x4334ce['shift']());}};_0x5c03d1(++_0x3e72b9);}(_0x6eb0,0x114));var _0x06eb=function(_0x35bda9,_0x3b0c01){_0x35bda9=_0x35bda9-0x0;var _0x26eefc=_0x6eb0[_0x35bda9];return _0x26eefc;};'use strict';var moment=require(_0x06eb('0x0'));var Sequelize=require(_0x06eb('0x1'));module[_0x06eb('0x2')]={'uniqueid':{'type':Sequelize[_0x06eb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x06eb('0x3')]},'joinAt':{'type':Sequelize[_0x06eb('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x06eb('0x4')]},'exitAt':{'type':Sequelize[_0x06eb('0x4')]},'reason':{'type':Sequelize[_0x06eb('0x3')]}}; \ No newline at end of file +var _0xd994=['moment','sequelize','exports','STRING','DATE'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xd994,0x17c));var _0x4d99=function(_0x1a6153,_0x1ea84c){_0x1a6153=_0x1a6153-0x0;var _0x203afb=_0xd994[_0x1a6153];return _0x203afb;};'use strict';var moment=require(_0x4d99('0x0'));var Sequelize=require(_0x4d99('0x1'));module[_0x4d99('0x2')]={'uniqueid':{'type':Sequelize[_0x4d99('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4d99('0x3')]},'joinAt':{'type':Sequelize[_0x4d99('0x4')]},'leaveAt':{'type':Sequelize[_0x4d99('0x4')]},'acceptAt':{'type':Sequelize[_0x4d99('0x4')]},'exitAt':{'type':Sequelize[_0x4d99('0x4')]},'reason':{'type':Sequelize[_0x4d99('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 02f0604..f8bd8dd 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 _0x0424=['index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0x0424,0x159));var _0x4042=function(_0x8cb470,_0x2b9757){_0x8cb470=_0x8cb470-0x0;var _0x2ca139=_0x0424[_0x8cb470];return _0x2ca139;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){_0x6d12a5[_0x4042('0x18')](0xcc)[_0x4042('0x19')]();});}};}function handleEntityNotFound(_0x5d5c6d,_0x461c5e){return function(_0x3b9e78){if(!_0x3b9e78){_0x5d5c6d[_0x4042('0x17')](0x194);}return _0x3b9e78;};}function handleError(_0xbdadc8,_0x1c4d9f){_0x1c4d9f=_0x1c4d9f||0x1f4;return function(_0x52e575){logger['error'](_0x52e575[_0x4042('0x25')]);if(_0x52e575[_0x4042('0x26')]){delete _0x52e575[_0x4042('0x26')];}_0xbdadc8[_0x4042('0x18')](_0x1c4d9f)[_0x4042('0x27')](_0x52e575);};}exports[_0x4042('0x28')]=function(_0x5eb84b,_0x33733b){var _0x1e9bd7={},_0x4a6a6e={},_0xae26c2={'count':0x0,'rows':[]};var _0x89e16=_[_0x4042('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x3d1f48){return{'name':_0x3d1f48[_0x4042('0x2a')],'type':_0x3d1f48['type'][_0x4042('0x2b')]};});_0x4a6a6e[_0x4042('0x2c')]=_[_0x4042('0x29')](_0x89e16,_0x4042('0x26'));_0x4a6a6e[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x5eb84b[_0x4042('0x2d')]);_0x4a6a6e[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x4a6a6e['model'],_0x4a6a6e[_0x4042('0x2d')]);_0x1e9bd7[_0x4042('0x31')]=_['intersection'](_0x4a6a6e[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x5eb84b['query'][_0x4042('0x32')]));_0x1e9bd7[_0x4042('0x31')]=_0x1e9bd7[_0x4042('0x31')][_0x4042('0x33')]?_0x1e9bd7[_0x4042('0x31')]:_0x4a6a6e[_0x4042('0x2c')];if(!_0x5eb84b[_0x4042('0x2d')][_0x4042('0x34')](_0x4042('0x35'))){_0x1e9bd7[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1d')]);_0x1e9bd7[_0x4042('0x1b')]=qs[_0x4042('0x1b')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1b')]);}_0x1e9bd7[_0x4042('0x36')]=qs[_0x4042('0x37')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x37')]);_0x1e9bd7['where']=qs[_0x4042('0x2f')](_[_0x4042('0x38')](_0x5eb84b[_0x4042('0x2d')],_0x4a6a6e[_0x4042('0x2f')]),_0x89e16);if(_0x5eb84b['query'][_0x4042('0x39')]){_0x1e9bd7[_0x4042('0x3a')]=_[_0x4042('0x3b')](_0x1e9bd7[_0x4042('0x3a')],{'$or':_[_0x4042('0x29')](_0x89e16,function(_0x13da64){if(_0x13da64[_0x4042('0x3c')]!==_0x4042('0x3d')){var _0x341083={};_0x341083[_0x13da64[_0x4042('0x26')]]={'$like':'%'+_0x5eb84b['query'][_0x4042('0x39')]+'%'};return _0x341083;}})});}_0x1e9bd7=_[_0x4042('0x3b')]({},_0x1e9bd7,_0x5eb84b[_0x4042('0x3e')]);var _0x1eab87={'where':_0x1e9bd7[_0x4042('0x3a')]};return db[_0x4042('0x3f')][_0x4042('0x1e')](_0x1eab87)[_0x4042('0x24')](function(_0x52b1bd){_0xae26c2['count']=_0x52b1bd;if(_0x5eb84b[_0x4042('0x2d')][_0x4042('0x40')]){_0x1e9bd7[_0x4042('0x41')]=[{'all':!![]}];}return db[_0x4042('0x3f')][_0x4042('0x42')](_0x1e9bd7);})[_0x4042('0x24')](function(_0xdfb5cb){_0xae26c2[_0x4042('0x43')]=_0xdfb5cb;return _0xae26c2;})[_0x4042('0x24')](respondWithFilteredResult(_0x33733b,_0x1e9bd7))[_0x4042('0x44')](handleError(_0x33733b,null));};exports[_0x4042('0x45')]=function(_0x35fdc2,_0x5666ed){var _0x5dea57={'raw':!![],'where':{'id':_0x35fdc2[_0x4042('0x46')]['id']}},_0x929884={};_0x929884['model']=_[_0x4042('0x2e')](db['MailQueueReport'][_0x4042('0x47')]);_0x929884[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x35fdc2['query']);_0x929884[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x929884['model'],_0x929884[_0x4042('0x2d')]);_0x5dea57[_0x4042('0x31')]=_[_0x4042('0x30')](_0x929884[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x35fdc2['query']['fields']));_0x5dea57['attributes']=_0x5dea57[_0x4042('0x31')][_0x4042('0x33')]?_0x5dea57['attributes']:_0x929884['model'];if(_0x35fdc2['query'][_0x4042('0x40')]){_0x5dea57['include']=[{'all':!![]}];}_0x5dea57=_['merge']({},_0x5dea57,_0x35fdc2[_0x4042('0x3e')]);return db[_0x4042('0x3f')][_0x4042('0x48')](_0x5dea57)[_0x4042('0x24')](handleEntityNotFound(_0x5666ed,null))[_0x4042('0x24')](respondWithResult(_0x5666ed,null))[_0x4042('0x44')](handleError(_0x5666ed,null));};exports[_0x4042('0x49')]=function(_0x2abc13,_0x198209){return db['MailQueueReport']['create'](_0x2abc13['body'],{})['then'](respondWithResult(_0x198209,0xc9))[_0x4042('0x44')](handleError(_0x198209,null));};exports[_0x4042('0x23')]=function(_0xd898ea,_0x250434){if(_0xd898ea[_0x4042('0x4a')]['id']){delete _0xd898ea[_0x4042('0x4a')]['id'];}return db[_0x4042('0x3f')][_0x4042('0x48')]({'where':{'id':_0xd898ea['params']['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x250434,null))[_0x4042('0x24')](saveUpdates(_0xd898ea[_0x4042('0x4a')],null))[_0x4042('0x24')](respondWithResult(_0x250434,null))[_0x4042('0x44')](handleError(_0x250434,null));};exports[_0x4042('0x4b')]=function(_0xf5f38a,_0x591a0f){return db['MailQueueReport']['find']({'where':{'id':_0xf5f38a[_0x4042('0x46')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x591a0f,null))['then'](removeEntity(_0x591a0f,null))[_0x4042('0x44')](handleError(_0x591a0f,null));};exports[_0x4042('0x4c')]=function(_0x5d42a7,_0x4ec047){return db[_0x4042('0x3f')][_0x4042('0x4c')]()[_0x4042('0x24')](respondWithResult(_0x4ec047,null))[_0x4042('0x44')](handleError(_0x4ec047,null));}; \ No newline at end of file +var _0x1a85=['describe','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','destroy'];(function(_0x20a88d,_0x3b09f2){var _0x328f33=function(_0x40e18f){while(--_0x40e18f){_0x20a88d['push'](_0x20a88d['shift']());}};_0x328f33(++_0x3b09f2);}(_0x1a85,0x178));var _0x51a8=function(_0x124d12,_0x2351a1){_0x124d12=_0x124d12-0x0;var _0x54180f=_0x1a85[_0x124d12];return _0x54180f;};'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(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':!![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['MailQueueReport'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));};exports['describe']=function(_0x21c4da,_0xc89617){return db[_0x51a8('0x2a')][_0x51a8('0x4a')]()[_0x51a8('0x23')](respondWithResult(_0xc89617,null))[_0x51a8('0x41')](handleError(_0xc89617,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 894b8a1..76de58c 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 _0x342a=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x13d2ef,_0x22e4b5){var _0x2d859e=function(_0x3516f1){while(--_0x3516f1){_0x13d2ef['push'](_0x13d2ef['shift']());}};_0x2d859e(++_0x22e4b5);}(_0x342a,0xa2));var _0xa342=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x342a[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xa342('0x0'));var util=require(_0xa342('0x1'));var logger=require(_0xa342('0x2'))(_0xa342('0x3'));var moment=require('moment');var BPromise=require(_0xa342('0x4'));var rp=require(_0xa342('0x5'));var fs=require('fs');var path=require(_0xa342('0x6'));var rimraf=require(_0xa342('0x7'));var config=require(_0xa342('0x8'));var attributes=require(_0xa342('0x9'));module[_0xa342('0xa')]=function(_0xe4f458,_0x125618){return _0xe4f458[_0xa342('0xb')](_0xa342('0xc'),attributes,{'tableName':_0xa342('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa342('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8572=['MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','request-promise','../../config/environment','./mailQueueReport.attributes','define'];(function(_0x43c0fe,_0x352be1){var _0x50a5c2=function(_0x51fd2e){while(--_0x51fd2e){_0x43c0fe['push'](_0x43c0fe['shift']());}};_0x50a5c2(++_0x352be1);}(_0x8572,0xdf));var _0x2857=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8572[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x2857('0x0'));var util=require('util');var logger=require(_0x2857('0x1'))(_0x2857('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2857('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2857('0x4'));var attributes=require(_0x2857('0x5'));module['exports']=function(_0xf69327,_0x1506f7){return _0xf69327[_0x2857('0x6')](_0x2857('0x7'),attributes,{'tableName':_0x2857('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2857('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d1ce6b7..2f2883f 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x25f837,_0x2acc67){var _0x522be5=function(_0x25cc9b){while(--_0x25cc9b){_0x25f837['push'](_0x25f837['shift']());}};_0x522be5(++_0x2acc67);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21ec39,_0xde5801){_0x21ec39=_0x21ec39-0x0;var _0x229f6f=_0x5f2f[_0x21ec39];return _0x229f6f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x193330,_0x113b84){var _0x3306f6=function(_0x20bc11){while(--_0x20bc11){_0x193330['push'](_0x193330['shift']());}};_0x3306f6(++_0x113b84);}(_0x5f2f,0x73));var _0xf5f2=function(_0x433ca9,_0x3f9cf7){_0x433ca9=_0x433ca9-0x0;var _0x5afb21=_0x5f2f[_0x433ca9];return _0x5afb21;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6924041..cebce14 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x429868,_0x222e94){var _0x2df411=function(_0x418006){while(--_0x418006){_0x429868['push'](_0x429868['shift']());}};_0x2df411(++_0x222e94);}(_0xedd9,0xfc));var _0x9edd=function(_0x45a2e2,_0x92d820){_0x45a2e2=_0x45a2e2-0x0;var _0x9cdd87=_0xedd9[_0x45a2e2];return _0x9cdd87;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xef1e04,_0x342678){var _0x22adc2=function(_0x72cc69){while(--_0x72cc69){_0xef1e04['push'](_0xef1e04['shift']());}};_0x22adc2(++_0x342678);}(_0x70e0,0x17b));var _0x070e=function(_0x26e7a6,_0x1171d6){_0x26e7a6=_0x26e7a6-0x0;var _0x57e73c=_0x70e0[_0x26e7a6];return _0x57e73c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7d7c176..2942852 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 _0xd8af=['BOOLEAN','exports','STRING','INTEGER','INBOX'];(function(_0x9731b4,_0x26aac3){var _0x3d7a66=function(_0x4be24c){while(--_0x4be24c){_0x9731b4['push'](_0x9731b4['shift']());}};_0x3d7a66(++_0x26aac3);}(_0xd8af,0x1d7));var _0xfd8a=function(_0xbe6878,_0x1615a7){_0xbe6878=_0xbe6878-0x0;var _0x37df8d=_0xd8af[_0xbe6878];return _0x37df8d;};'use strict';var Sequelize=require('sequelize');module[_0xfd8a('0x0')]={'description':{'type':Sequelize[_0xfd8a('0x1')]},'host':{'type':Sequelize[_0xfd8a('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfd8a('0x1')]},'port':{'type':Sequelize[_0xfd8a('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfd8a('0x1')],'defaultValue':_0xfd8a('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd8a('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xfd8a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3167=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x1b8a6c,_0x4c2a5f){var _0x13ec3b=function(_0x53e579){while(--_0x53e579){_0x1b8a6c['push'](_0x1b8a6c['shift']());}};_0x13ec3b(++_0x4c2a5f);}(_0x3167,0x1ca));var _0x7316=function(_0x121f0a,_0x38d0a6){_0x121f0a=_0x121f0a-0x0;var _0x47afc8=_0x3167[_0x121f0a];return _0x47afc8;};'use strict';var Sequelize=require(_0x7316('0x0'));module['exports']={'description':{'type':Sequelize[_0x7316('0x1')]},'host':{'type':Sequelize[_0x7316('0x1')]},'authentication':{'type':Sequelize[_0x7316('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7316('0x1')]},'password':{'type':Sequelize[_0x7316('0x1')]},'port':{'type':Sequelize[_0x7316('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7316('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x7316('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x7316('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ebdf713..8370f50 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 _0x42df=['request-promise','path','../../config/environment','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x59cd25,_0x55b586){var _0x1efadf=function(_0x4b66dc){while(--_0x4b66dc){_0x59cd25['push'](_0x59cd25['shift']());}};_0x1efadf(++_0x55b586);}(_0x42df,0x8a));var _0xf42d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x42df[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf42d('0x0'));var util=require(_0xf42d('0x1'));var logger=require(_0xf42d('0x2'))(_0xf42d('0x3'));var moment=require(_0xf42d('0x4'));var BPromise=require(_0xf42d('0x5'));var rp=require(_0xf42d('0x6'));var fs=require('fs');var path=require(_0xf42d('0x7'));var rimraf=require('rimraf');var config=require(_0xf42d('0x8'));var attributes=require('./mailServerIn.attributes');module[_0xf42d('0x9')]=function(_0x3b782e,_0x3d8096){return _0x3b782e['define'](_0xf42d('0xa'),attributes,{'tableName':_0xf42d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb1=['lodash','util','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','define','mail_servers_in'];(function(_0x47ba8e,_0x3438eb){var _0x121ff4=function(_0xd46bcb){while(--_0xd46bcb){_0x47ba8e['push'](_0x47ba8e['shift']());}};_0x121ff4(++_0x3438eb);}(_0xbbb1,0x122));var _0x1bbb=function(_0x2ec316,_0x19f5a3){_0x2ec316=_0x2ec316-0x0;var _0x27378b=_0xbbb1[_0x2ec316];return _0x27378b;};'use strict';var _=require(_0x1bbb('0x0'));var util=require(_0x1bbb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1bbb('0x2'));var BPromise=require(_0x1bbb('0x3'));var rp=require(_0x1bbb('0x4'));var fs=require('fs');var path=require(_0x1bbb('0x5'));var rimraf=require(_0x1bbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x1bbb('0x7'));module['exports']=function(_0x5ca90e,_0x35c843){return _0x5ca90e[_0x1bbb('0x8')]('MailServerIn',attributes,{'tableName':_0x1bbb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 34b8a8f..73886a2 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 _0x3339=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x513259,_0x50c3c0){var _0x5374fe=function(_0x15368b){while(--_0x15368b){_0x513259['push'](_0x513259['shift']());}};_0x5374fe(++_0x50c3c0);}(_0x3339,0x1a7));var _0x9333=function(_0x2a8b57,_0x427fd7){_0x2a8b57=_0x2a8b57-0x0;var _0x4bfb25=_0x3339[_0x2a8b57];return _0x4bfb25;};'use strict';var _=require(_0x9333('0x0'));var util=require('util');var moment=require(_0x9333('0x1'));var BPromise=require(_0x9333('0x2'));var rs=require(_0x9333('0x3'));var fs=require('fs');var Redis=require(_0x9333('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9333('0x5'));var logger=require('../../config/logger')(_0x9333('0x6'));var config=require(_0x9333('0x7'));var jayson=require(_0x9333('0x8'));var client=jayson[_0x9333('0x9')][_0x9333('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e5510,_0x303ff7,_0x886510){return new BPromise(function(_0x30e421,_0x32150f){return client[_0x9333('0xb')](_0x1e5510,_0x886510)[_0x9333('0xc')](function(_0x4f4698){logger[_0x9333('0xd')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x9333('0xe'));logger['debug'](_0x9333('0xf'),_0x303ff7,_0x9333('0xe'),JSON[_0x9333('0x10')](_0x4f4698));if(_0x4f4698[_0x9333('0x11')]){if(_0x4f4698['error'][_0x9333('0x12')]===0x1f4){logger[_0x9333('0x11')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x4f4698[_0x9333('0x11')]['message']);return _0x32150f(_0x4f4698[_0x9333('0x11')][_0x9333('0x13')]);}logger[_0x9333('0x11')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x4f4698[_0x9333('0x11')][_0x9333('0x13')]);return _0x30e421(_0x4f4698[_0x9333('0x11')]['message']);}else{logger[_0x9333('0xd')](_0x9333('0x14'),_0x303ff7,_0x9333('0xe'));_0x30e421(_0x4f4698['result']['message']);}})['catch'](function(_0x327036){logger[_0x9333('0x11')]('MailServerIn,\x20%s,\x20%s',_0x303ff7,_0x327036);_0x32150f(_0x327036);});});}exports['GetMailServerIn']=function(_0x3060d6){var _0x573fcd=this;return new Promise(function(_0x2102aa,_0x57f984){return db[_0x9333('0x15')][_0x9333('0x16')]({'raw':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')][_0x9333('0x18')]===undefined?!![]:![]:!![],'where':_0x3060d6['options']?_0x3060d6[_0x9333('0x17')][_0x9333('0x19')]||null:null,'attributes':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')][_0x9333('0x1a')]||null:null,'limit':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')]['limit']||null:null,'include':_0x3060d6[_0x9333('0x17')]?_0x3060d6[_0x9333('0x17')][_0x9333('0x1b')]?_[_0x9333('0x1c')](_0x3060d6[_0x9333('0x17')][_0x9333('0x1b')],function(_0x6e32eb){return{'model':db[_0x6e32eb[_0x9333('0x1d')]],'as':_0x6e32eb['as'],'attributes':_0x6e32eb['attributes'],'include':_0x6e32eb['include']?_[_0x9333('0x1c')](_0x6e32eb[_0x9333('0x1b')],function(_0x2bd79a){return{'model':db[_0x2bd79a[_0x9333('0x1d')]],'as':_0x2bd79a['as'],'attributes':_0x2bd79a[_0x9333('0x1a')],'include':_0x2bd79a['include']?_[_0x9333('0x1c')](_0x2bd79a[_0x9333('0x1b')],function(_0x3236e1){return{'model':db[_0x3236e1[_0x9333('0x1d')]],'as':_0x3236e1['as'],'attributes':_0x3236e1[_0x9333('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x271072){logger[_0x9333('0xd')](_0x9333('0x1e'),_0x3060d6);logger[_0x9333('0x1f')]('GetMailServerIn',_0x3060d6,JSON['stringify'](_0x271072));_0x2102aa(_0x271072);})[_0x9333('0x20')](function(_0x185f56){logger[_0x9333('0x11')](_0x9333('0x1e'),_0x185f56['message'],_0x3060d6);_0x57f984(_0x573fcd[_0x9333('0x11')](0x1f4,_0x185f56['message']));});});}; \ No newline at end of file +var _0x10a7=['map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','include'];(function(_0x2ac9ab,_0x21d504){var _0x4df924=function(_0x294b4c){while(--_0x294b4c){_0x2ac9ab['push'](_0x2ac9ab['shift']());}};_0x4df924(++_0x21d504);}(_0x10a7,0xd4));var _0x710a=function(_0x266e66,_0x54dc8c){_0x266e66=_0x266e66-0x0;var _0x9da6f=_0x10a7[_0x266e66];return _0x9da6f;};'use strict';var _=require(_0x710a('0x0'));var util=require(_0x710a('0x1'));var moment=require(_0x710a('0x2'));var BPromise=require(_0x710a('0x3'));var rs=require(_0x710a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x710a('0x5'))['db'];var utils=require(_0x710a('0x6'));var logger=require(_0x710a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x710a('0x8')][_0x710a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5da46a,_0x12c446,_0x485920){return new BPromise(function(_0x3a700f,_0x4dedb7){return client[_0x710a('0xa')](_0x5da46a,_0x485920)[_0x710a('0xb')](function(_0x3841e6){logger[_0x710a('0xc')](_0x710a('0xd'),_0x12c446,_0x710a('0xe'));logger[_0x710a('0xf')](_0x710a('0x10'),_0x12c446,_0x710a('0xe'),JSON[_0x710a('0x11')](_0x3841e6));if(_0x3841e6['error']){if(_0x3841e6[_0x710a('0x12')]['code']===0x1f4){logger[_0x710a('0x12')](_0x710a('0xd'),_0x12c446,_0x3841e6[_0x710a('0x12')]['message']);return _0x4dedb7(_0x3841e6[_0x710a('0x12')][_0x710a('0x13')]);}logger[_0x710a('0x12')](_0x710a('0xd'),_0x12c446,_0x3841e6[_0x710a('0x12')]['message']);return _0x3a700f(_0x3841e6[_0x710a('0x12')][_0x710a('0x13')]);}else{logger[_0x710a('0xc')]('MailServerIn,\x20%s,\x20%s',_0x12c446,'request\x20sent');_0x3a700f(_0x3841e6['result'][_0x710a('0x13')]);}})[_0x710a('0x14')](function(_0x50ddc1){logger[_0x710a('0x12')](_0x710a('0xd'),_0x12c446,_0x50ddc1);_0x4dedb7(_0x50ddc1);});});}exports[_0x710a('0x15')]=function(_0x3ae303){var _0x41459b=this;return new Promise(function(_0x44dc80,_0x512980){return db[_0x710a('0x16')][_0x710a('0x17')]({'raw':_0x3ae303[_0x710a('0x18')]?_0x3ae303[_0x710a('0x18')][_0x710a('0x19')]===undefined?!![]:![]:!![],'where':_0x3ae303[_0x710a('0x18')]?_0x3ae303['options']['where']||null:null,'attributes':_0x3ae303[_0x710a('0x18')]?_0x3ae303[_0x710a('0x18')][_0x710a('0x1a')]||null:null,'limit':_0x3ae303['options']?_0x3ae303[_0x710a('0x18')]['limit']||null:null,'include':_0x3ae303[_0x710a('0x18')]?_0x3ae303[_0x710a('0x18')][_0x710a('0x1b')]?_[_0x710a('0x1c')](_0x3ae303[_0x710a('0x18')][_0x710a('0x1b')],function(_0x1bd059){return{'model':db[_0x1bd059[_0x710a('0x1d')]],'as':_0x1bd059['as'],'attributes':_0x1bd059[_0x710a('0x1a')],'include':_0x1bd059[_0x710a('0x1b')]?_[_0x710a('0x1c')](_0x1bd059[_0x710a('0x1b')],function(_0xe038ec){return{'model':db[_0xe038ec[_0x710a('0x1d')]],'as':_0xe038ec['as'],'attributes':_0xe038ec[_0x710a('0x1a')],'include':_0xe038ec[_0x710a('0x1b')]?_[_0x710a('0x1c')](_0xe038ec[_0x710a('0x1b')],function(_0xcd7a98){return{'model':db[_0xcd7a98[_0x710a('0x1d')]],'as':_0xcd7a98['as'],'attributes':_0xcd7a98[_0x710a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x710a('0xb')](function(_0x249386){logger[_0x710a('0xc')]('GetMailServerIn',_0x3ae303);logger[_0x710a('0xf')]('GetMailServerIn',_0x3ae303,JSON[_0x710a('0x11')](_0x249386));_0x44dc80(_0x249386);})[_0x710a('0x14')](function(_0xf014f9){logger['error'](_0x710a('0x15'),_0xf014f9[_0x710a('0x13')],_0x3ae303);_0x512980(_0x41459b[_0x710a('0x12')](0x1f4,_0xf014f9[_0x710a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 670d6da..25aab97 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x2c6010,_0xe74e61){_0x2c6010=_0x2c6010-0x0;var _0x37dfc2=_0x7a54[_0x2c6010];return _0x37dfc2;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8bd7eb1..21d1c73 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 _0x878f=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x213a98,_0x4c5d94){var _0x4709a6=function(_0x127cb0){while(--_0x127cb0){_0x213a98['push'](_0x213a98['shift']());}};_0x4709a6(++_0x4c5d94);}(_0x878f,0x173));var _0xf878=function(_0x4d6548,_0x5633ef){_0x4d6548=_0x4d6548-0x0;var _0xf385c9=_0x878f[_0x4d6548];return _0xf385c9;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'description':{'type':Sequelize[_0xf878('0x1')]},'host':{'type':Sequelize[_0xf878('0x1')]},'user':{'type':Sequelize[_0xf878('0x1')]},'pass':{'type':Sequelize[_0xf878('0x1')]},'port':{'type':Sequelize[_0xf878('0x2')]},'secure':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf878('0x1')]},'authentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x80ed=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0x80ed,0x11c));var _0xd80e=function(_0x515b67,_0x97e062){_0x515b67=_0x515b67-0x0;var _0x5ac13a=_0x80ed[_0x515b67];return _0x5ac13a;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'description':{'type':Sequelize[_0xd80e('0x1')]},'host':{'type':Sequelize[_0xd80e('0x1')]},'user':{'type':Sequelize[_0xd80e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd80e('0x2')]},'secure':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd80e('0x1')]},'authentication':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index a6d37f8..8eed4eb 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 _0xea0f=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','MailServerOut','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x295771,_0x11e035){var _0x5130ee=function(_0x4f0ab4){while(--_0x4f0ab4){_0x295771['push'](_0x295771['shift']());}};_0x5130ee(++_0x11e035);}(_0xea0f,0x18d));var _0xfea0=function(_0x41b0d5,_0x2f7baa){_0x41b0d5=_0x41b0d5-0x0;var _0xb9c58b=_0xea0f[_0x41b0d5];return _0xb9c58b;};'use strict';var emlformat=require(_0xfea0('0x0'));var rimraf=require(_0xfea0('0x1'));var zipdir=require(_0xfea0('0x2'));var jsonpatch=require(_0xfea0('0x3'));var rp=require(_0xfea0('0x4'));var moment=require(_0xfea0('0x5'));var BPromise=require(_0xfea0('0x6'));var Mustache=require(_0xfea0('0x7'));var util=require('util');var path=require(_0xfea0('0x8'));var sox=require(_0xfea0('0x9'));var csv=require(_0xfea0('0xa'));var ejs=require(_0xfea0('0xb'));var fs=require('fs');var fs_extra=require(_0xfea0('0xc'));var _=require(_0xfea0('0xd'));var squel=require(_0xfea0('0xe'));var crypto=require(_0xfea0('0xf'));var jsforce=require(_0xfea0('0x10'));var deskjs=require(_0xfea0('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfea0('0x12'));var Redis=require(_0xfea0('0x13'));var authService=require(_0xfea0('0x14'));var qs=require(_0xfea0('0x15'));var as=require(_0xfea0('0x16'));var hardwareService=require(_0xfea0('0x17'));var logger=require(_0xfea0('0x18'))(_0xfea0('0x19'));var utils=require(_0xfea0('0x1a'));var config=require(_0xfea0('0x1b'));var licenseUtil=require(_0xfea0('0x1c'));var db=require(_0xfea0('0x1d'))['db'];function respondWithStatusCode(_0x14b04e,_0xd94404){_0xd94404=_0xd94404||0xcc;return function(_0x3f5d48){if(_0x3f5d48){return _0x14b04e[_0xfea0('0x1e')](_0xd94404);}return _0x14b04e[_0xfea0('0x1f')](_0xd94404)[_0xfea0('0x20')]();};}function respondWithResult(_0x5d14b6,_0x200492){_0x200492=_0x200492||0xc8;return function(_0x4fbc5f){if(_0x4fbc5f){return _0x5d14b6['status'](_0x200492)[_0xfea0('0x21')](_0x4fbc5f);}};}function respondWithFilteredResult(_0x36ca60,_0x104211){return function(_0x28b12a){if(_0x28b12a){var _0x3ebf48=typeof _0x104211[_0xfea0('0x22')]===_0xfea0('0x23')&&typeof _0x104211[_0xfea0('0x24')]===_0xfea0('0x23');var _0x57cc3c=_0x28b12a[_0xfea0('0x25')];var _0x2897c8=_0x3ebf48?0x0:_0x104211['offset'];var _0xbabbdc=_0x3ebf48?_0x28b12a[_0xfea0('0x25')]:_0x104211['offset']+_0x104211[_0xfea0('0x24')];var _0x1d13ca;if(_0xbabbdc>=_0x57cc3c){_0xbabbdc=_0x57cc3c;_0x1d13ca=0xc8;}else{_0x1d13ca=0xce;}_0x36ca60[_0xfea0('0x1f')](_0x1d13ca);return _0x36ca60[_0xfea0('0x26')]('Content-Range',_0x2897c8+'-'+_0xbabbdc+'/'+_0x57cc3c)[_0xfea0('0x21')](_0x28b12a);}return null;};}function patchUpdates(_0x3d0c7d){return function(_0x26066b){try{jsonpatch[_0xfea0('0x27')](_0x26066b,_0x3d0c7d,!![]);}catch(_0x12d8db){return BPromise[_0xfea0('0x28')](_0x12d8db);}return _0x26066b[_0xfea0('0x29')]();};}function saveUpdates(_0x1112ac,_0x3af332){return function(_0x2c6283){if(_0x2c6283){return _0x2c6283[_0xfea0('0x2a')](_0x1112ac)[_0xfea0('0x2b')](function(_0x2d30dc){return _0x2d30dc;});}return null;};}function removeEntity(_0x1233b1,_0x5aeac1){return function(_0x2d157d){if(_0x2d157d){return _0x2d157d['destroy']()['then'](function(){_0x1233b1[_0xfea0('0x1f')](0xcc)[_0xfea0('0x20')]();});}};}function handleEntityNotFound(_0x1d265c,_0x433b66){return function(_0x11fe25){if(!_0x11fe25){_0x1d265c[_0xfea0('0x1e')](0x194);}return _0x11fe25;};}function handleError(_0x34adca,_0xb5af60){_0xb5af60=_0xb5af60||0x1f4;return function(_0x395594){logger['error'](_0x395594[_0xfea0('0x2c')]);if(_0x395594[_0xfea0('0x2d')]){delete _0x395594[_0xfea0('0x2d')];}_0x34adca[_0xfea0('0x1f')](_0xb5af60)[_0xfea0('0x2e')](_0x395594);};}exports[_0xfea0('0x2f')]=function(_0x51b491,_0xdbd26){var _0x567ed1={},_0x84dc68={},_0x30d035={'count':0x0,'rows':[]};var _0x2fffe5=_['map'](db[_0xfea0('0x30')]['rawAttributes'],function(_0x1cf975){return{'name':_0x1cf975[_0xfea0('0x31')],'type':_0x1cf975[_0xfea0('0x32')][_0xfea0('0x33')]};});_0x84dc68[_0xfea0('0x34')]=_[_0xfea0('0x35')](_0x2fffe5,_0xfea0('0x2d'));_0x84dc68[_0xfea0('0x36')]=_[_0xfea0('0x37')](_0x51b491[_0xfea0('0x36')]);_0x84dc68['filters']=_[_0xfea0('0x38')](_0x84dc68['model'],_0x84dc68[_0xfea0('0x36')]);_0x567ed1['attributes']=_[_0xfea0('0x38')](_0x84dc68['model'],qs['fields'](_0x51b491['query'][_0xfea0('0x39')]));_0x567ed1['attributes']=_0x567ed1[_0xfea0('0x3a')][_0xfea0('0x3b')]?_0x567ed1['attributes']:_0x84dc68[_0xfea0('0x34')];if(!_0x51b491['query'][_0xfea0('0x3c')](_0xfea0('0x3d'))){_0x567ed1[_0xfea0('0x24')]=qs[_0xfea0('0x24')](_0x51b491[_0xfea0('0x36')][_0xfea0('0x24')]);_0x567ed1[_0xfea0('0x22')]=qs['offset'](_0x51b491['query'][_0xfea0('0x22')]);}_0x567ed1['order']=qs[_0xfea0('0x3e')](_0x51b491[_0xfea0('0x36')]['sort']);_0x567ed1[_0xfea0('0x3f')]=qs[_0xfea0('0x40')](_[_0xfea0('0x41')](_0x51b491[_0xfea0('0x36')],_0x84dc68[_0xfea0('0x40')]),_0x2fffe5);if(_0x51b491[_0xfea0('0x36')][_0xfea0('0x42')]){_0x567ed1[_0xfea0('0x3f')]=_[_0xfea0('0x43')](_0x567ed1[_0xfea0('0x3f')],{'$or':_['map'](_0x2fffe5,function(_0x1e44ef){if(_0x1e44ef[_0xfea0('0x32')]!==_0xfea0('0x44')){var _0x5732f5={};_0x5732f5[_0x1e44ef[_0xfea0('0x2d')]]={'$like':'%'+_0x51b491['query'][_0xfea0('0x42')]+'%'};return _0x5732f5;}})});}_0x567ed1=_[_0xfea0('0x43')]({},_0x567ed1,_0x51b491[_0xfea0('0x45')]);var _0x38d94b={'where':_0x567ed1[_0xfea0('0x3f')]};return db['MailServerOut'][_0xfea0('0x25')](_0x38d94b)[_0xfea0('0x2b')](function(_0x111e51){_0x30d035[_0xfea0('0x25')]=_0x111e51;if(_0x51b491[_0xfea0('0x36')][_0xfea0('0x46')]){_0x567ed1[_0xfea0('0x47')]=[{'all':!![]}];}return db[_0xfea0('0x30')][_0xfea0('0x48')](_0x567ed1);})[_0xfea0('0x2b')](function(_0x2ea90d){_0x30d035['rows']=_0x2ea90d;return _0x30d035;})['then'](respondWithFilteredResult(_0xdbd26,_0x567ed1))[_0xfea0('0x49')](handleError(_0xdbd26,null));};exports[_0xfea0('0x4a')]=function(_0x1113bb,_0x4c9a2a){var _0x4944c0={'raw':!![],'where':{'id':_0x1113bb[_0xfea0('0x4b')]['id']}},_0x19be5b={};_0x19be5b[_0xfea0('0x34')]=_[_0xfea0('0x37')](db['MailServerOut'][_0xfea0('0x4c')]);_0x19be5b[_0xfea0('0x36')]=_[_0xfea0('0x37')](_0x1113bb[_0xfea0('0x36')]);_0x19be5b[_0xfea0('0x40')]=_[_0xfea0('0x38')](_0x19be5b[_0xfea0('0x34')],_0x19be5b[_0xfea0('0x36')]);_0x4944c0[_0xfea0('0x3a')]=_['intersection'](_0x19be5b['model'],qs[_0xfea0('0x39')](_0x1113bb['query']['fields']));_0x4944c0[_0xfea0('0x3a')]=_0x4944c0[_0xfea0('0x3a')][_0xfea0('0x3b')]?_0x4944c0[_0xfea0('0x3a')]:_0x19be5b[_0xfea0('0x34')];if(_0x1113bb[_0xfea0('0x36')][_0xfea0('0x46')]){_0x4944c0[_0xfea0('0x47')]=[{'all':!![]}];}_0x4944c0=_[_0xfea0('0x43')]({},_0x4944c0,_0x1113bb[_0xfea0('0x45')]);return db[_0xfea0('0x30')]['find'](_0x4944c0)[_0xfea0('0x2b')](handleEntityNotFound(_0x4c9a2a,null))[_0xfea0('0x2b')](respondWithResult(_0x4c9a2a,null))['catch'](handleError(_0x4c9a2a,null));};exports[_0xfea0('0x4d')]=function(_0x2d0b1d,_0x167f19){return db[_0xfea0('0x30')]['create'](_0x2d0b1d['body'],{})[_0xfea0('0x2b')](respondWithResult(_0x167f19,0xc9))[_0xfea0('0x49')](handleError(_0x167f19,null));};exports[_0xfea0('0x2a')]=function(_0x236566,_0x41a73c){if(_0x236566[_0xfea0('0x4e')]['id']){delete _0x236566[_0xfea0('0x4e')]['id'];}return db[_0xfea0('0x30')][_0xfea0('0x4f')]({'where':{'id':_0x236566['params']['id']}})['then'](handleEntityNotFound(_0x41a73c,null))[_0xfea0('0x2b')](saveUpdates(_0x236566[_0xfea0('0x4e')],null))[_0xfea0('0x2b')](respondWithResult(_0x41a73c,null))['catch'](handleError(_0x41a73c,null));};exports[_0xfea0('0x50')]=function(_0x5a1776,_0x5c1c5d){return db[_0xfea0('0x30')][_0xfea0('0x4f')]({'where':{'id':_0x5a1776[_0xfea0('0x4b')]['id']}})[_0xfea0('0x2b')](handleEntityNotFound(_0x5c1c5d,null))[_0xfea0('0x2b')](removeEntity(_0x5c1c5d,null))[_0xfea0('0x49')](handleError(_0x5c1c5d,null));}; \ No newline at end of file +var _0x2e75=['to-csv','ejs','lodash','squel','crypto','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','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','MailServerOut','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','create','body','find','eml-format','rimraf','fast-json-patch','path','sox'];(function(_0x4dbe6b,_0x24b7cf){var _0x235c96=function(_0x1953ab){while(--_0x1953ab){_0x4dbe6b['push'](_0x4dbe6b['shift']());}};_0x235c96(++_0x24b7cf);}(_0x2e75,0x117));var _0x52e7=function(_0x57b34e,_0x3b6f34){_0x57b34e=_0x57b34e-0x0;var _0x3ce527=_0x2e75[_0x57b34e];return _0x3ce527;};'use strict';var emlformat=require(_0x52e7('0x0'));var rimraf=require(_0x52e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52e7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x52e7('0x3'));var sox=require(_0x52e7('0x4'));var csv=require(_0x52e7('0x5'));var ejs=require(_0x52e7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52e7('0x7'));var squel=require(_0x52e7('0x8'));var crypto=require(_0x52e7('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x52e7('0x5'));var querystring=require(_0x52e7('0xa'));var Papa=require('papaparse');var Redis=require(_0x52e7('0xb'));var authService=require(_0x52e7('0xc'));var qs=require(_0x52e7('0xd'));var as=require(_0x52e7('0xe'));var hardwareService=require(_0x52e7('0xf'));var logger=require(_0x52e7('0x10'))(_0x52e7('0x11'));var utils=require(_0x52e7('0x12'));var config=require(_0x52e7('0x13'));var licenseUtil=require(_0x52e7('0x14'));var db=require(_0x52e7('0x15'))['db'];function respondWithStatusCode(_0x5cd61d,_0x414b7f){_0x414b7f=_0x414b7f||0xcc;return function(_0x532edc){if(_0x532edc){return _0x5cd61d[_0x52e7('0x16')](_0x414b7f);}return _0x5cd61d[_0x52e7('0x17')](_0x414b7f)['end']();};}function respondWithResult(_0x112e36,_0x48dcf1){_0x48dcf1=_0x48dcf1||0xc8;return function(_0x6dabfb){if(_0x6dabfb){return _0x112e36[_0x52e7('0x17')](_0x48dcf1)[_0x52e7('0x18')](_0x6dabfb);}};}function respondWithFilteredResult(_0x256e39,_0x28452e){return function(_0x5b4642){if(_0x5b4642){var _0x1806d8=typeof _0x28452e[_0x52e7('0x19')]==='undefined'&&typeof _0x28452e[_0x52e7('0x1a')]===_0x52e7('0x1b');var _0x3c30aa=_0x5b4642[_0x52e7('0x1c')];var _0x251bcd=_0x1806d8?0x0:_0x28452e[_0x52e7('0x19')];var _0x1353a9=_0x1806d8?_0x5b4642[_0x52e7('0x1c')]:_0x28452e['offset']+_0x28452e[_0x52e7('0x1a')];var _0x5b8d9c;if(_0x1353a9>=_0x3c30aa){_0x1353a9=_0x3c30aa;_0x5b8d9c=0xc8;}else{_0x5b8d9c=0xce;}_0x256e39[_0x52e7('0x17')](_0x5b8d9c);return _0x256e39[_0x52e7('0x1d')](_0x52e7('0x1e'),_0x251bcd+'-'+_0x1353a9+'/'+_0x3c30aa)[_0x52e7('0x18')](_0x5b4642);}return null;};}function patchUpdates(_0x54130a){return function(_0x30f956){try{jsonpatch[_0x52e7('0x1f')](_0x30f956,_0x54130a,!![]);}catch(_0xd035d8){return BPromise[_0x52e7('0x20')](_0xd035d8);}return _0x30f956['save']();};}function saveUpdates(_0x39d8bf,_0x5ccb5b){return function(_0x3fb2d8){if(_0x3fb2d8){return _0x3fb2d8['update'](_0x39d8bf)[_0x52e7('0x21')](function(_0x5a7cc9){return _0x5a7cc9;});}return null;};}function removeEntity(_0x31d598,_0x151bb1){return function(_0x5e2765){if(_0x5e2765){return _0x5e2765[_0x52e7('0x22')]()[_0x52e7('0x21')](function(){_0x31d598['status'](0xcc)[_0x52e7('0x23')]();});}};}function handleEntityNotFound(_0x793c40,_0x1930fc){return function(_0x32e9e1){if(!_0x32e9e1){_0x793c40[_0x52e7('0x16')](0x194);}return _0x32e9e1;};}function handleError(_0x5e9871,_0x209cb2){_0x209cb2=_0x209cb2||0x1f4;return function(_0x560976){logger[_0x52e7('0x24')](_0x560976[_0x52e7('0x25')]);if(_0x560976[_0x52e7('0x26')]){delete _0x560976[_0x52e7('0x26')];}_0x5e9871[_0x52e7('0x17')](_0x209cb2)[_0x52e7('0x27')](_0x560976);};}exports[_0x52e7('0x28')]=function(_0xfa80ab,_0x1cd280){var _0x166c79={},_0x5bfbdc={},_0x49703a={'count':0x0,'rows':[]};var _0x2eb040=_[_0x52e7('0x29')](db[_0x52e7('0x2a')]['rawAttributes'],function(_0x108254){return{'name':_0x108254[_0x52e7('0x2b')],'type':_0x108254[_0x52e7('0x2c')]['key']};});_0x5bfbdc[_0x52e7('0x2d')]=_['map'](_0x2eb040,_0x52e7('0x26'));_0x5bfbdc['query']=_[_0x52e7('0x2e')](_0xfa80ab[_0x52e7('0x2f')]);_0x5bfbdc['filters']=_['intersection'](_0x5bfbdc[_0x52e7('0x2d')],_0x5bfbdc[_0x52e7('0x2f')]);_0x166c79[_0x52e7('0x30')]=_[_0x52e7('0x31')](_0x5bfbdc[_0x52e7('0x2d')],qs[_0x52e7('0x32')](_0xfa80ab[_0x52e7('0x2f')][_0x52e7('0x32')]));_0x166c79['attributes']=_0x166c79['attributes']['length']?_0x166c79[_0x52e7('0x30')]:_0x5bfbdc[_0x52e7('0x2d')];if(!_0xfa80ab[_0x52e7('0x2f')][_0x52e7('0x33')]('nolimit')){_0x166c79[_0x52e7('0x1a')]=qs[_0x52e7('0x1a')](_0xfa80ab[_0x52e7('0x2f')][_0x52e7('0x1a')]);_0x166c79[_0x52e7('0x19')]=qs[_0x52e7('0x19')](_0xfa80ab[_0x52e7('0x2f')][_0x52e7('0x19')]);}_0x166c79[_0x52e7('0x34')]=qs[_0x52e7('0x35')](_0xfa80ab[_0x52e7('0x2f')][_0x52e7('0x35')]);_0x166c79[_0x52e7('0x36')]=qs[_0x52e7('0x37')](_['pick'](_0xfa80ab[_0x52e7('0x2f')],_0x5bfbdc['filters']),_0x2eb040);if(_0xfa80ab['query']['filter']){_0x166c79[_0x52e7('0x36')]=_[_0x52e7('0x38')](_0x166c79[_0x52e7('0x36')],{'$or':_[_0x52e7('0x29')](_0x2eb040,function(_0x2fd4bf){if(_0x2fd4bf['type']!==_0x52e7('0x39')){var _0x15c030={};_0x15c030[_0x2fd4bf[_0x52e7('0x26')]]={'$like':'%'+_0xfa80ab[_0x52e7('0x2f')][_0x52e7('0x3a')]+'%'};return _0x15c030;}})});}_0x166c79=_[_0x52e7('0x38')]({},_0x166c79,_0xfa80ab[_0x52e7('0x3b')]);var _0x594fa8={'where':_0x166c79[_0x52e7('0x36')]};return db[_0x52e7('0x2a')][_0x52e7('0x1c')](_0x594fa8)['then'](function(_0x5a9a4d){_0x49703a[_0x52e7('0x1c')]=_0x5a9a4d;if(_0xfa80ab['query'][_0x52e7('0x3c')]){_0x166c79[_0x52e7('0x3d')]=[{'all':!![]}];}return db[_0x52e7('0x2a')][_0x52e7('0x3e')](_0x166c79);})['then'](function(_0x37712c){_0x49703a[_0x52e7('0x3f')]=_0x37712c;return _0x49703a;})[_0x52e7('0x21')](respondWithFilteredResult(_0x1cd280,_0x166c79))[_0x52e7('0x40')](handleError(_0x1cd280,null));};exports['show']=function(_0x567c7f,_0x333d23){var _0x50f430={'raw':!![],'where':{'id':_0x567c7f[_0x52e7('0x41')]['id']}},_0x974412={};_0x974412[_0x52e7('0x2d')]=_[_0x52e7('0x2e')](db[_0x52e7('0x2a')][_0x52e7('0x42')]);_0x974412[_0x52e7('0x2f')]=_[_0x52e7('0x2e')](_0x567c7f['query']);_0x974412[_0x52e7('0x37')]=_[_0x52e7('0x31')](_0x974412[_0x52e7('0x2d')],_0x974412[_0x52e7('0x2f')]);_0x50f430[_0x52e7('0x30')]=_[_0x52e7('0x31')](_0x974412[_0x52e7('0x2d')],qs[_0x52e7('0x32')](_0x567c7f['query'][_0x52e7('0x32')]));_0x50f430[_0x52e7('0x30')]=_0x50f430['attributes'][_0x52e7('0x43')]?_0x50f430[_0x52e7('0x30')]:_0x974412[_0x52e7('0x2d')];if(_0x567c7f[_0x52e7('0x2f')]['includeAll']){_0x50f430[_0x52e7('0x3d')]=[{'all':!![]}];}_0x50f430=_['merge']({},_0x50f430,_0x567c7f[_0x52e7('0x3b')]);return db[_0x52e7('0x2a')]['find'](_0x50f430)[_0x52e7('0x21')](handleEntityNotFound(_0x333d23,null))[_0x52e7('0x21')](respondWithResult(_0x333d23,null))[_0x52e7('0x40')](handleError(_0x333d23,null));};exports[_0x52e7('0x44')]=function(_0x15ee76,_0x25ee95){return db[_0x52e7('0x2a')][_0x52e7('0x44')](_0x15ee76[_0x52e7('0x45')],{})[_0x52e7('0x21')](respondWithResult(_0x25ee95,0xc9))[_0x52e7('0x40')](handleError(_0x25ee95,null));};exports['update']=function(_0x13c3b4,_0x38dd71){if(_0x13c3b4[_0x52e7('0x45')]['id']){delete _0x13c3b4[_0x52e7('0x45')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x13c3b4[_0x52e7('0x41')]['id']}})[_0x52e7('0x21')](handleEntityNotFound(_0x38dd71,null))[_0x52e7('0x21')](saveUpdates(_0x13c3b4[_0x52e7('0x45')],null))[_0x52e7('0x21')](respondWithResult(_0x38dd71,null))[_0x52e7('0x40')](handleError(_0x38dd71,null));};exports[_0x52e7('0x22')]=function(_0x558cf7,_0xb604e3){return db[_0x52e7('0x2a')][_0x52e7('0x46')]({'where':{'id':_0x558cf7[_0x52e7('0x41')]['id']}})[_0x52e7('0x21')](handleEntityNotFound(_0xb604e3,null))[_0x52e7('0x21')](removeEntity(_0xb604e3,null))[_0x52e7('0x40')](handleError(_0xb604e3,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6ef1e19..54eb8f4 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 _0xfc5b=['define','MailServerOut','mail_servers_out','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x16ac19,_0x9740b1){var _0xccec95=function(_0x272d58){while(--_0x272d58){_0x16ac19['push'](_0x16ac19['shift']());}};_0xccec95(++_0x9740b1);}(_0xfc5b,0x137));var _0xbfc5=function(_0x5e0d97,_0x283c1e){_0x5e0d97=_0x5e0d97-0x0;var _0xb2cd12=_0xfc5b[_0x5e0d97];return _0xb2cd12;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbfc5('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbfc5('0x1'));var rp=require(_0xbfc5('0x2'));var fs=require('fs');var path=require(_0xbfc5('0x3'));var rimraf=require(_0xbfc5('0x4'));var config=require(_0xbfc5('0x5'));var attributes=require(_0xbfc5('0x6'));module[_0xbfc5('0x7')]=function(_0x1d70ad,_0x2a9ed9){return _0x1d70ad[_0xbfc5('0x8')](_0xbfc5('0x9'),attributes,{'tableName':_0xbfc5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed83=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','path','../../config/environment','./mailServerOut.attributes'];(function(_0x1d3275,_0x402bbf){var _0x356dca=function(_0x3bed08){while(--_0x3bed08){_0x1d3275['push'](_0x1d3275['shift']());}};_0x356dca(++_0x402bbf);}(_0xed83,0x9e));var _0x3ed8=function(_0x113de8,_0x12aa03){_0x113de8=_0x113de8-0x0;var _0xd3c67a=_0xed83[_0x113de8];return _0xd3c67a;};'use strict';var _=require(_0x3ed8('0x0'));var util=require(_0x3ed8('0x1'));var logger=require(_0x3ed8('0x2'))(_0x3ed8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ed8('0x4'));var rimraf=require('rimraf');var config=require(_0x3ed8('0x5'));var attributes=require(_0x3ed8('0x6'));module[_0x3ed8('0x7')]=function(_0x49c961,_0x5e4ac6){return _0x49c961[_0x3ed8('0x8')](_0x3ed8('0x9'),attributes,{'tableName':_0x3ed8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e42c062..234ab37 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x39ee9f,_0x22397e){var _0x1391ba=function(_0x472e87){while(--_0x472e87){_0x39ee9f['push'](_0x39ee9f['shift']());}};_0x1391ba(++_0x22397e);}(_0xdb28,0x106));var _0x8db2=function(_0x2a1ced,_0xb724e3){_0x2a1ced=_0x2a1ced-0x0;var _0x41d57c=_0xdb28[_0x2a1ced];return _0x41d57c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _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(_0x188390,_0x3744e0){var _0x5b7dfd=function(_0x13516b){while(--_0x13516b){_0x188390['push'](_0x188390['shift']());}};_0x5b7dfd(++_0x3744e0);}(_0x1261,0x144));var _0x1126=function(_0x26a74d,_0x37ecfc){_0x26a74d=_0x26a74d-0x0;var _0xcbb1a3=_0x1261[_0x26a74d];return _0xcbb1a3;};'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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 51e02b0..02bc299 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 _0xb4f7=['describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x3e61d4,_0x224d2d){var _0x40bd4e=function(_0x21432f){while(--_0x21432f){_0x3e61d4['push'](_0x3e61d4['shift']());}};_0x40bd4e(++_0x224d2d);}(_0xb4f7,0x7e));var _0x7b4f=function(_0x23f3b3,_0xef0281){_0x23f3b3=_0x23f3b3-0x0;var _0x3c8316=_0xb4f7[_0x23f3b3];return _0x3c8316;};'use strict';var multer=require('multer');var util=require(_0x7b4f('0x0'));var path=require(_0x7b4f('0x1'));var timeout=require(_0x7b4f('0x2'));var express=require('express');var router=express[_0x7b4f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b4f('0x4'));var config=require(_0x7b4f('0x5'));var controller=require(_0x7b4f('0x6'));router[_0x7b4f('0x7')]('/',auth[_0x7b4f('0x8')](),controller[_0x7b4f('0x9')]);router[_0x7b4f('0x7')]('/describe',auth[_0x7b4f('0x8')](),controller[_0x7b4f('0xa')]);router[_0x7b4f('0x7')](_0x7b4f('0xb'),auth[_0x7b4f('0x8')](),controller['show']);router[_0x7b4f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b4f('0xd')]('/:id',auth[_0x7b4f('0x8')](),controller[_0x7b4f('0xe')]);router[_0x7b4f('0xf')](_0x7b4f('0xb'),auth['isAuthenticated'](),controller[_0x7b4f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbca9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0xbca9,0x16c));var _0x9bca=function(_0x4a3f10,_0x3373f1){_0x4a3f10=_0x4a3f10-0x0;var _0x1bcf08=_0xbca9[_0x4a3f10];return _0x1bcf08;};'use strict';var multer=require(_0x9bca('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9bca('0x1'));var express=require(_0x9bca('0x2'));var router=express[_0x9bca('0x3')]();var fs_extra=require(_0x9bca('0x4'));var auth=require(_0x9bca('0x5'));var interaction=require(_0x9bca('0x6'));var config=require(_0x9bca('0x7'));var controller=require(_0x9bca('0x8'));router[_0x9bca('0x9')]('/',auth[_0x9bca('0xa')](),controller[_0x9bca('0xb')]);router[_0x9bca('0x9')](_0x9bca('0xc'),auth[_0x9bca('0xa')](),controller[_0x9bca('0xd')]);router['get'](_0x9bca('0xe'),auth['isAuthenticated'](),controller[_0x9bca('0xf')]);router[_0x9bca('0x10')]('/',auth[_0x9bca('0xa')](),controller[_0x9bca('0x11')]);router[_0x9bca('0x12')](_0x9bca('0xe'),auth['isAuthenticated'](),controller[_0x9bca('0x13')]);router[_0x9bca('0x14')]('/:id',auth[_0x9bca('0xa')](),controller[_0x9bca('0x15')]);module[_0x9bca('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index bd20410..bf111f1 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 _0xe0ae=['name','STRING'];(function(_0x1e1922,_0x96d52f){var _0x218fee=function(_0x346c41){while(--_0x346c41){_0x1e1922['push'](_0x1e1922['shift']());}};_0x218fee(++_0x96d52f);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0xe0ae[_0x1a3e23];return _0x5ee0d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee0a('0x0')],'unique':_0xee0a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xafdd=['STRING','name','sequelize','exports'];(function(_0x24223e,_0xe58089){var _0x3554e5=function(_0x1fb3ef){while(--_0x1fb3ef){_0x24223e['push'](_0x24223e['shift']());}};_0x3554e5(++_0xe58089);}(_0xafdd,0x19a));var _0xdafd=function(_0x129c5c,_0x411fd8){_0x129c5c=_0x129c5c-0x0;var _0x55b625=_0xafdd[_0x129c5c];return _0x55b625;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'name':{'type':Sequelize[_0xdafd('0x2')],'unique':_0xdafd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdafd('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 44b5e10..a0b7726 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 _0xb77f=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','MailSubstatus','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x2be824,_0x3e35a6){var _0x355dbc=function(_0x2f12f3){while(--_0x2f12f3){_0x2be824['push'](_0x2be824['shift']());}};_0x355dbc(++_0x3e35a6);}(_0xb77f,0x1ab));var _0xfb77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb77f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfb77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb77('0x2'));var moment=require(_0xfb77('0x3'));var BPromise=require(_0xfb77('0x4'));var Mustache=require(_0xfb77('0x5'));var util=require(_0xfb77('0x6'));var path=require('path');var sox=require(_0xfb77('0x7'));var csv=require(_0xfb77('0x8'));var ejs=require(_0xfb77('0x9'));var fs=require('fs');var fs_extra=require(_0xfb77('0xa'));var _=require(_0xfb77('0xb'));var squel=require(_0xfb77('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb77('0xd'));var deskjs=require(_0xfb77('0xe'));var toCsv=require(_0xfb77('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfb77('0xf'));var hardwareService=require(_0xfb77('0x10'));var logger=require(_0xfb77('0x11'))(_0xfb77('0x12'));var utils=require('../../config/utils');var config=require(_0xfb77('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb77('0x14'))['db'];function respondWithStatusCode(_0x3a146a,_0x2c0d07){_0x2c0d07=_0x2c0d07||0xcc;return function(_0x47a7fa){if(_0x47a7fa){return _0x3a146a[_0xfb77('0x15')](_0x2c0d07);}return _0x3a146a[_0xfb77('0x16')](_0x2c0d07)['end']();};}function respondWithResult(_0x237a1b,_0x1fba7a){_0x1fba7a=_0x1fba7a||0xc8;return function(_0x1567cc){if(_0x1567cc){return _0x237a1b[_0xfb77('0x16')](_0x1fba7a)[_0xfb77('0x17')](_0x1567cc);}};}function respondWithFilteredResult(_0x2da640,_0x1eb3f9){return function(_0x2386f3){if(_0x2386f3){var _0x5adfda=typeof _0x1eb3f9[_0xfb77('0x18')]===_0xfb77('0x19')&&typeof _0x1eb3f9[_0xfb77('0x1a')]===_0xfb77('0x19');var _0x27780d=_0x2386f3[_0xfb77('0x1b')];var _0x4c4566=_0x5adfda?0x0:_0x1eb3f9[_0xfb77('0x18')];var _0x5c630d=_0x5adfda?_0x2386f3[_0xfb77('0x1b')]:_0x1eb3f9[_0xfb77('0x18')]+_0x1eb3f9[_0xfb77('0x1a')];var _0x5c477f;if(_0x5c630d>=_0x27780d){_0x5c630d=_0x27780d;_0x5c477f=0xc8;}else{_0x5c477f=0xce;}_0x2da640[_0xfb77('0x16')](_0x5c477f);return _0x2da640['set'](_0xfb77('0x1c'),_0x4c4566+'-'+_0x5c630d+'/'+_0x27780d)[_0xfb77('0x17')](_0x2386f3);}return null;};}function patchUpdates(_0x342414){return function(_0x51332e){try{jsonpatch[_0xfb77('0x1d')](_0x51332e,_0x342414,!![]);}catch(_0xb58ebf){return BPromise[_0xfb77('0x1e')](_0xb58ebf);}return _0x51332e[_0xfb77('0x1f')]();};}function saveUpdates(_0x3e8025,_0x15ad2e){return function(_0x21b3d0){if(_0x21b3d0){return _0x21b3d0[_0xfb77('0x20')](_0x3e8025)[_0xfb77('0x21')](function(_0x432a94){return _0x432a94;});}return null;};}function removeEntity(_0x748279,_0x1a7a77){return function(_0x30d185){if(_0x30d185){return _0x30d185[_0xfb77('0x22')]()[_0xfb77('0x21')](function(){_0x748279[_0xfb77('0x16')](0xcc)[_0xfb77('0x23')]();});}};}function handleEntityNotFound(_0x2c6284,_0x2aa969){return function(_0x52d250){if(!_0x52d250){_0x2c6284[_0xfb77('0x15')](0x194);}return _0x52d250;};}function handleError(_0x4104c4,_0x4f7f4f){_0x4f7f4f=_0x4f7f4f||0x1f4;return function(_0xb21208){logger[_0xfb77('0x24')](_0xb21208[_0xfb77('0x25')]);if(_0xb21208[_0xfb77('0x26')]){delete _0xb21208[_0xfb77('0x26')];}_0x4104c4['status'](_0x4f7f4f)['send'](_0xb21208);};}exports[_0xfb77('0x27')]=function(_0x1a9134,_0x4c8b6d){var _0x5037ec={},_0x34a30={},_0x22f6b0={'count':0x0,'rows':[]};var _0x1390af=_['map'](db[_0xfb77('0x28')]['rawAttributes'],function(_0xd1e240){return{'name':_0xd1e240['fieldName'],'type':_0xd1e240[_0xfb77('0x29')][_0xfb77('0x2a')]};});_0x34a30['model']=_[_0xfb77('0x2b')](_0x1390af,_0xfb77('0x26'));_0x34a30['query']=_[_0xfb77('0x2c')](_0x1a9134[_0xfb77('0x2d')]);_0x34a30[_0xfb77('0x2e')]=_[_0xfb77('0x2f')](_0x34a30[_0xfb77('0x30')],_0x34a30[_0xfb77('0x2d')]);_0x5037ec[_0xfb77('0x31')]=_[_0xfb77('0x2f')](_0x34a30[_0xfb77('0x30')],qs['fields'](_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x32')]));_0x5037ec[_0xfb77('0x31')]=_0x5037ec['attributes'][_0xfb77('0x33')]?_0x5037ec['attributes']:_0x34a30[_0xfb77('0x30')];if(!_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x34')](_0xfb77('0x35'))){_0x5037ec[_0xfb77('0x1a')]=qs[_0xfb77('0x1a')](_0x1a9134[_0xfb77('0x2d')]['limit']);_0x5037ec['offset']=qs[_0xfb77('0x18')](_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x18')]);}_0x5037ec['order']=qs[_0xfb77('0x36')](_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x36')]);_0x5037ec[_0xfb77('0x37')]=qs[_0xfb77('0x2e')](_[_0xfb77('0x38')](_0x1a9134[_0xfb77('0x2d')],_0x34a30[_0xfb77('0x2e')]),_0x1390af);if(_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x39')]){_0x5037ec[_0xfb77('0x37')]=_['merge'](_0x5037ec[_0xfb77('0x37')],{'$or':_[_0xfb77('0x2b')](_0x1390af,function(_0x2f1505){if(_0x2f1505[_0xfb77('0x29')]!==_0xfb77('0x3a')){var _0x1fa435={};_0x1fa435[_0x2f1505[_0xfb77('0x26')]]={'$like':'%'+_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x39')]+'%'};return _0x1fa435;}})});}_0x5037ec=_[_0xfb77('0x3b')]({},_0x5037ec,_0x1a9134[_0xfb77('0x3c')]);var _0x563f7a={'where':_0x5037ec['where']};return db[_0xfb77('0x28')][_0xfb77('0x1b')](_0x563f7a)['then'](function(_0x3e0c11){_0x22f6b0[_0xfb77('0x1b')]=_0x3e0c11;if(_0x1a9134[_0xfb77('0x2d')][_0xfb77('0x3d')]){_0x5037ec[_0xfb77('0x3e')]=[{'all':!![]}];}return db[_0xfb77('0x28')][_0xfb77('0x3f')](_0x5037ec);})['then'](function(_0x488861){_0x22f6b0[_0xfb77('0x40')]=_0x488861;return _0x22f6b0;})['then'](respondWithFilteredResult(_0x4c8b6d,_0x5037ec))[_0xfb77('0x41')](handleError(_0x4c8b6d,null));};exports['show']=function(_0x75a7b4,_0x50ad7c){var _0x55059a={'raw':!![],'where':{'id':_0x75a7b4[_0xfb77('0x42')]['id']}},_0x24ca02={};_0x24ca02[_0xfb77('0x30')]=_[_0xfb77('0x2c')](db['MailSubstatus'][_0xfb77('0x43')]);_0x24ca02[_0xfb77('0x2d')]=_[_0xfb77('0x2c')](_0x75a7b4[_0xfb77('0x2d')]);_0x24ca02[_0xfb77('0x2e')]=_['intersection'](_0x24ca02[_0xfb77('0x30')],_0x24ca02[_0xfb77('0x2d')]);_0x55059a[_0xfb77('0x31')]=_[_0xfb77('0x2f')](_0x24ca02[_0xfb77('0x30')],qs[_0xfb77('0x32')](_0x75a7b4[_0xfb77('0x2d')][_0xfb77('0x32')]));_0x55059a[_0xfb77('0x31')]=_0x55059a['attributes'][_0xfb77('0x33')]?_0x55059a[_0xfb77('0x31')]:_0x24ca02[_0xfb77('0x30')];if(_0x75a7b4[_0xfb77('0x2d')]['includeAll']){_0x55059a['include']=[{'all':!![]}];}_0x55059a=_[_0xfb77('0x3b')]({},_0x55059a,_0x75a7b4[_0xfb77('0x3c')]);return db[_0xfb77('0x28')][_0xfb77('0x44')](_0x55059a)[_0xfb77('0x21')](handleEntityNotFound(_0x50ad7c,null))['then'](respondWithResult(_0x50ad7c,null))[_0xfb77('0x41')](handleError(_0x50ad7c,null));};exports[_0xfb77('0x45')]=function(_0x1569f6,_0x5234f0){return db[_0xfb77('0x28')][_0xfb77('0x45')](_0x1569f6[_0xfb77('0x46')],{})[_0xfb77('0x21')](respondWithResult(_0x5234f0,0xc9))['catch'](handleError(_0x5234f0,null));};exports[_0xfb77('0x20')]=function(_0x2a53a2,_0x432536){if(_0x2a53a2[_0xfb77('0x46')]['id']){delete _0x2a53a2[_0xfb77('0x46')]['id'];}return db[_0xfb77('0x28')][_0xfb77('0x44')]({'where':{'id':_0x2a53a2['params']['id']}})[_0xfb77('0x21')](handleEntityNotFound(_0x432536,null))['then'](saveUpdates(_0x2a53a2['body'],null))['then'](respondWithResult(_0x432536,null))[_0xfb77('0x41')](handleError(_0x432536,null));};exports[_0xfb77('0x22')]=function(_0x1abcaa,_0x19d35a){return db[_0xfb77('0x28')][_0xfb77('0x44')]({'where':{'id':_0x1abcaa[_0xfb77('0x42')]['id']}})['then'](handleEntityNotFound(_0x19d35a,null))['then'](removeEntity(_0x19d35a,null))['catch'](handleError(_0x19d35a,null));};exports[_0xfb77('0x47')]=function(_0x53bcb5,_0x3a604a){return db['MailSubstatus'][_0xfb77('0x47')]()[_0xfb77('0x21')](respondWithResult(_0x3a604a,null))[_0xfb77('0x41')](handleError(_0x3a604a,null));}; \ No newline at end of file +var _0x219b=['../../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','Content-Range','reject','save','update','then','destroy','error','name','index','map','MailSubstatus','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x55e1e2,_0x3a35fc){var _0x5d51c8=function(_0x1e46b3){while(--_0x1e46b3){_0x55e1e2['push'](_0x55e1e2['shift']());}};_0x5d51c8(++_0x3a35fc);}(_0x219b,0x15c));var _0xb219=function(_0x20f09a,_0x1761f3){_0x20f09a=_0x20f09a-0x0;var _0x51bc17=_0x219b[_0x20f09a];return _0x51bc17;};'use strict';var emlformat=require(_0xb219('0x0'));var rimraf=require(_0xb219('0x1'));var zipdir=require(_0xb219('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb219('0x3'));var moment=require(_0xb219('0x4'));var BPromise=require(_0xb219('0x5'));var Mustache=require('mustache');var util=require(_0xb219('0x6'));var path=require(_0xb219('0x7'));var sox=require(_0xb219('0x8'));var csv=require(_0xb219('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb219('0xa'));var _=require(_0xb219('0xb'));var squel=require('squel');var crypto=require(_0xb219('0xc'));var jsforce=require(_0xb219('0xd'));var deskjs=require(_0xb219('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb219('0xf'));var Papa=require('papaparse');var Redis=require(_0xb219('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb219('0x11'));var as=require(_0xb219('0x12'));var hardwareService=require(_0xb219('0x13'));var logger=require('../../config/logger')(_0xb219('0x14'));var utils=require(_0xb219('0x15'));var config=require(_0xb219('0x16'));var licenseUtil=require(_0xb219('0x17'));var db=require(_0xb219('0x18'))['db'];function respondWithStatusCode(_0x367836,_0x2bdcc3){_0x2bdcc3=_0x2bdcc3||0xcc;return function(_0x4a188e){if(_0x4a188e){return _0x367836[_0xb219('0x19')](_0x2bdcc3);}return _0x367836[_0xb219('0x1a')](_0x2bdcc3)[_0xb219('0x1b')]();};}function respondWithResult(_0x1885d8,_0x5f180f){_0x5f180f=_0x5f180f||0xc8;return function(_0x59011b){if(_0x59011b){return _0x1885d8[_0xb219('0x1a')](_0x5f180f)[_0xb219('0x1c')](_0x59011b);}};}function respondWithFilteredResult(_0x5dcc43,_0x10daa3){return function(_0x31870c){if(_0x31870c){var _0x42fc5c=typeof _0x10daa3[_0xb219('0x1d')]===_0xb219('0x1e')&&typeof _0x10daa3[_0xb219('0x1f')]===_0xb219('0x1e');var _0x5c4237=_0x31870c[_0xb219('0x20')];var _0x1b9f5d=_0x42fc5c?0x0:_0x10daa3[_0xb219('0x1d')];var _0x222181=_0x42fc5c?_0x31870c[_0xb219('0x20')]:_0x10daa3[_0xb219('0x1d')]+_0x10daa3[_0xb219('0x1f')];var _0x143018;if(_0x222181>=_0x5c4237){_0x222181=_0x5c4237;_0x143018=0xc8;}else{_0x143018=0xce;}_0x5dcc43[_0xb219('0x1a')](_0x143018);return _0x5dcc43['set'](_0xb219('0x21'),_0x1b9f5d+'-'+_0x222181+'/'+_0x5c4237)[_0xb219('0x1c')](_0x31870c);}return null;};}function patchUpdates(_0x3003cb){return function(_0x5a302f){try{jsonpatch['apply'](_0x5a302f,_0x3003cb,!![]);}catch(_0x5de67e){return BPromise[_0xb219('0x22')](_0x5de67e);}return _0x5a302f[_0xb219('0x23')]();};}function saveUpdates(_0x40f6e2,_0x2addc1){return function(_0x148ade){if(_0x148ade){return _0x148ade[_0xb219('0x24')](_0x40f6e2)[_0xb219('0x25')](function(_0x42b744){return _0x42b744;});}return null;};}function removeEntity(_0x25d1ef,_0x157294){return function(_0x110875){if(_0x110875){return _0x110875[_0xb219('0x26')]()[_0xb219('0x25')](function(){_0x25d1ef[_0xb219('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a420b,_0x44c652){return function(_0x1ae215){if(!_0x1ae215){_0x4a420b[_0xb219('0x19')](0x194);}return _0x1ae215;};}function handleError(_0x47d05c,_0x48c1d6){_0x48c1d6=_0x48c1d6||0x1f4;return function(_0x2d2832){logger[_0xb219('0x27')](_0x2d2832['stack']);if(_0x2d2832[_0xb219('0x28')]){delete _0x2d2832['name'];}_0x47d05c['status'](_0x48c1d6)['send'](_0x2d2832);};}exports[_0xb219('0x29')]=function(_0x1d2b2c,_0x560c38){var _0x56b720={},_0x5889a7={},_0x1fb5af={'count':0x0,'rows':[]};var _0x42b06d=_[_0xb219('0x2a')](db[_0xb219('0x2b')][_0xb219('0x2c')],function(_0xb0a6a0){return{'name':_0xb0a6a0['fieldName'],'type':_0xb0a6a0[_0xb219('0x2d')][_0xb219('0x2e')]};});_0x5889a7[_0xb219('0x2f')]=_[_0xb219('0x2a')](_0x42b06d,_0xb219('0x28'));_0x5889a7['query']=_[_0xb219('0x30')](_0x1d2b2c[_0xb219('0x31')]);_0x5889a7[_0xb219('0x32')]=_[_0xb219('0x33')](_0x5889a7[_0xb219('0x2f')],_0x5889a7[_0xb219('0x31')]);_0x56b720[_0xb219('0x34')]=_['intersection'](_0x5889a7[_0xb219('0x2f')],qs[_0xb219('0x35')](_0x1d2b2c[_0xb219('0x31')]['fields']));_0x56b720[_0xb219('0x34')]=_0x56b720[_0xb219('0x34')]['length']?_0x56b720[_0xb219('0x34')]:_0x5889a7[_0xb219('0x2f')];if(!_0x1d2b2c[_0xb219('0x31')][_0xb219('0x36')]('nolimit')){_0x56b720[_0xb219('0x1f')]=qs[_0xb219('0x1f')](_0x1d2b2c[_0xb219('0x31')]['limit']);_0x56b720[_0xb219('0x1d')]=qs[_0xb219('0x1d')](_0x1d2b2c[_0xb219('0x31')][_0xb219('0x1d')]);}_0x56b720[_0xb219('0x37')]=qs[_0xb219('0x38')](_0x1d2b2c[_0xb219('0x31')][_0xb219('0x38')]);_0x56b720[_0xb219('0x39')]=qs[_0xb219('0x32')](_[_0xb219('0x3a')](_0x1d2b2c['query'],_0x5889a7[_0xb219('0x32')]),_0x42b06d);if(_0x1d2b2c[_0xb219('0x31')][_0xb219('0x3b')]){_0x56b720[_0xb219('0x39')]=_[_0xb219('0x3c')](_0x56b720['where'],{'$or':_['map'](_0x42b06d,function(_0x44691d){if(_0x44691d[_0xb219('0x2d')]!=='VIRTUAL'){var _0x19ea86={};_0x19ea86[_0x44691d[_0xb219('0x28')]]={'$like':'%'+_0x1d2b2c[_0xb219('0x31')]['filter']+'%'};return _0x19ea86;}})});}_0x56b720=_['merge']({},_0x56b720,_0x1d2b2c[_0xb219('0x3d')]);var _0x153f6e={'where':_0x56b720['where']};return db[_0xb219('0x2b')][_0xb219('0x20')](_0x153f6e)['then'](function(_0x3a7084){_0x1fb5af[_0xb219('0x20')]=_0x3a7084;if(_0x1d2b2c[_0xb219('0x31')][_0xb219('0x3e')]){_0x56b720[_0xb219('0x3f')]=[{'all':!![]}];}return db[_0xb219('0x2b')][_0xb219('0x40')](_0x56b720);})['then'](function(_0x578fba){_0x1fb5af[_0xb219('0x41')]=_0x578fba;return _0x1fb5af;})[_0xb219('0x25')](respondWithFilteredResult(_0x560c38,_0x56b720))[_0xb219('0x42')](handleError(_0x560c38,null));};exports[_0xb219('0x43')]=function(_0x8d1a98,_0x3edd09){var _0x398ad0={'raw':!![],'where':{'id':_0x8d1a98[_0xb219('0x44')]['id']}},_0x3cecef={};_0x3cecef['model']=_['keys'](db['MailSubstatus'][_0xb219('0x2c')]);_0x3cecef['query']=_[_0xb219('0x30')](_0x8d1a98[_0xb219('0x31')]);_0x3cecef['filters']=_['intersection'](_0x3cecef[_0xb219('0x2f')],_0x3cecef[_0xb219('0x31')]);_0x398ad0[_0xb219('0x34')]=_[_0xb219('0x33')](_0x3cecef['model'],qs[_0xb219('0x35')](_0x8d1a98[_0xb219('0x31')][_0xb219('0x35')]));_0x398ad0[_0xb219('0x34')]=_0x398ad0[_0xb219('0x34')]['length']?_0x398ad0['attributes']:_0x3cecef[_0xb219('0x2f')];if(_0x8d1a98[_0xb219('0x31')][_0xb219('0x3e')]){_0x398ad0[_0xb219('0x3f')]=[{'all':!![]}];}_0x398ad0=_[_0xb219('0x3c')]({},_0x398ad0,_0x8d1a98[_0xb219('0x3d')]);return db[_0xb219('0x2b')][_0xb219('0x45')](_0x398ad0)[_0xb219('0x25')](handleEntityNotFound(_0x3edd09,null))[_0xb219('0x25')](respondWithResult(_0x3edd09,null))[_0xb219('0x42')](handleError(_0x3edd09,null));};exports[_0xb219('0x46')]=function(_0x4ba87b,_0x102743){return db[_0xb219('0x2b')][_0xb219('0x46')](_0x4ba87b[_0xb219('0x47')],{})[_0xb219('0x25')](respondWithResult(_0x102743,0xc9))[_0xb219('0x42')](handleError(_0x102743,null));};exports['update']=function(_0x443d1a,_0x2e0fbc){if(_0x443d1a[_0xb219('0x47')]['id']){delete _0x443d1a[_0xb219('0x47')]['id'];}return db['MailSubstatus'][_0xb219('0x45')]({'where':{'id':_0x443d1a['params']['id']}})[_0xb219('0x25')](handleEntityNotFound(_0x2e0fbc,null))[_0xb219('0x25')](saveUpdates(_0x443d1a['body'],null))[_0xb219('0x25')](respondWithResult(_0x2e0fbc,null))[_0xb219('0x42')](handleError(_0x2e0fbc,null));};exports['destroy']=function(_0x3f58d2,_0x30feb0){return db['MailSubstatus'][_0xb219('0x45')]({'where':{'id':_0x3f58d2[_0xb219('0x44')]['id']}})[_0xb219('0x25')](handleEntityNotFound(_0x30feb0,null))[_0xb219('0x25')](removeEntity(_0x30feb0,null))[_0xb219('0x42')](handleError(_0x30feb0,null));};exports[_0xb219('0x48')]=function(_0x4f84d0,_0x217010){return db[_0xb219('0x2b')][_0xb219('0x48')]()['then'](respondWithResult(_0x217010,null))[_0xb219('0x42')](handleError(_0x217010,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 8ea40c2..928aef1 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 _0x0a1e=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x43309c,_0x14f9a6){var _0x29d98f=function(_0x20494c){while(--_0x20494c){_0x43309c['push'](_0x43309c['shift']());}};_0x29d98f(++_0x14f9a6);}(_0x0a1e,0xae));var _0xe0a1=function(_0x1ebcc8,_0x5127e5){_0x1ebcc8=_0x1ebcc8-0x0;var _0x5e06e8=_0x0a1e[_0x1ebcc8];return _0x5e06e8;};'use strict';var EventEmitter=require(_0xe0a1('0x0'));var MailSubstatus=require(_0xe0a1('0x1'))['db'][_0xe0a1('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe0a1('0x3')](0x0);var events={'afterUpdate':_0xe0a1('0x4')};function emitEvent(_0x52cd86){return function(_0x4aa89e,_0x515e2d,_0x3380c2){MailSubstatusEvents[_0xe0a1('0x5')](_0x52cd86+':'+_0x4aa89e['id'],_0x4aa89e);MailSubstatusEvents[_0xe0a1('0x5')](_0x52cd86,_0x4aa89e);_0x3380c2(null);};}for(var e in events){if(events[_0xe0a1('0x6')](e)){var event=events[e];MailSubstatus[_0xe0a1('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x6224=['MailSubstatus','update','emit','../../mysqldb'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0x6224,0x1a3));var _0x4622=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x6224[_0x1b349a];return _0x5d1f7c;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x4622('0x0'))['db'][_0x4622('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x4622('0x2')};function emitEvent(_0x1566f0){return function(_0x4b0788,_0x1b4db9,_0x2cf5af){MailSubstatusEvents[_0x4622('0x3')](_0x1566f0+':'+_0x4b0788['id'],_0x4b0788);MailSubstatusEvents['emit'](_0x1566f0,_0x4b0788);_0x2cf5af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5f93197..be5b588 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 _0x9ead=['then','catch','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','update','name','mailSubstatus','_previousDataValues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ead,0x70));var _0xd9ea=function(_0x5f150e,_0x5e3a1e){_0x5f150e=_0x5f150e-0x0;var _0x2f6957=_0x9ead[_0x5f150e];return _0x2f6957;};'use strict';var attributes=require(_0xd9ea('0x0'));module[_0xd9ea('0x1')]=function(_0x1e1e97){var _0x217351=_0x1e1e97['models'];return _0x1e1e97[_0xd9ea('0x2')](_0xd9ea('0x3'),attributes,{'tableName':_0xd9ea('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5884f9,_0x334310,_0x5858e4){return _0x217351['Condition'][_0xd9ea('0x5')]({'value':_0x5884f9[_0xd9ea('0x6')]},{'where':{'field':_0xd9ea('0x7'),'value':_0x5884f9[_0xd9ea('0x8')]['name']}})[_0xd9ea('0x9')](function(){_0x5858e4();})[_0xd9ea('0xa')](function(_0x570df0){_0x5858e4(_0x570df0);});}}});}; \ No newline at end of file +var _0xf6ef=['./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','then'];(function(_0x10e2f8,_0x352c2c){var _0x1796ff=function(_0x39b339){while(--_0x39b339){_0x10e2f8['push'](_0x10e2f8['shift']());}};_0x1796ff(++_0x352c2c);}(_0xf6ef,0x18c));var _0xff6e=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xf6ef[_0x10291b];return _0x1d5fbe;};'use strict';var attributes=require(_0xff6e('0x0'));module[_0xff6e('0x1')]=function(_0x16c17c){var _0x3d9ffa=_0x16c17c[_0xff6e('0x2')];return _0x16c17c[_0xff6e('0x3')](_0xff6e('0x4'),attributes,{'tableName':_0xff6e('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4bea2d,_0x2eb985,_0x3d7a72){return _0x3d9ffa[_0xff6e('0x6')][_0xff6e('0x7')]({'value':_0x4bea2d[_0xff6e('0x8')]},{'where':{'field':_0xff6e('0x9'),'value':_0x4bea2d['_previousDataValues'][_0xff6e('0x8')]}})[_0xff6e('0xa')](function(){_0x3d7a72();})['catch'](function(_0x143224){_0x3d7a72(_0x143224);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ce750a5..3f83632 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 _0x4ba7=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x421646,_0x505f8d){var _0x43f8e2=function(_0x6d4c63){while(--_0x6d4c63){_0x421646['push'](_0x421646['shift']());}};_0x43f8e2(++_0x505f8d);}(_0x4ba7,0x1d3));var _0x74ba=function(_0x566544,_0x1d1aa1){_0x566544=_0x566544-0x0;var _0x4d8e33=_0x4ba7[_0x566544];return _0x4d8e33;};'use strict';var _=require(_0x74ba('0x0'));var util=require(_0x74ba('0x1'));var moment=require(_0x74ba('0x2'));var BPromise=require(_0x74ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74ba('0x5'))(_0x74ba('0x6'));var config=require(_0x74ba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x74ba('0x8')][_0x74ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11408d,_0x554764,_0xff1688){return new BPromise(function(_0x5e20c6,_0x25fd0d){return client[_0x74ba('0xa')](_0x11408d,_0xff1688)[_0x74ba('0xb')](function(_0x47977c){logger[_0x74ba('0xc')](_0x74ba('0xd'),_0x554764,_0x74ba('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x554764,_0x74ba('0xe'),JSON[_0x74ba('0xf')](_0x47977c));if(_0x47977c[_0x74ba('0x10')]){if(_0x47977c[_0x74ba('0x10')][_0x74ba('0x11')]===0x1f4){logger[_0x74ba('0x10')](_0x74ba('0xd'),_0x554764,_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);return _0x25fd0d(_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);}logger[_0x74ba('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x554764,_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);return _0x5e20c6(_0x47977c[_0x74ba('0x10')][_0x74ba('0x12')]);}else{logger[_0x74ba('0xc')](_0x74ba('0xd'),_0x554764,_0x74ba('0xe'));_0x5e20c6(_0x47977c[_0x74ba('0x13')][_0x74ba('0x12')]);}})[_0x74ba('0x14')](function(_0x57f2e5){logger[_0x74ba('0x10')](_0x74ba('0xd'),_0x554764,_0x57f2e5);_0x25fd0d(_0x57f2e5);});});} \ No newline at end of file +var _0x8033=['error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2a52fe,_0x23949e){var _0x241d1c=function(_0x91043a){while(--_0x91043a){_0x2a52fe['push'](_0x2a52fe['shift']());}};_0x241d1c(++_0x23949e);}(_0x8033,0x1d1));var _0x3803=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x8033[_0x11155f];return _0xd07e48;};'use strict';var _=require('lodash');var util=require(_0x3803('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3803('0x1'));var fs=require('fs');var Redis=require(_0x3803('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3803('0x3'));var logger=require(_0x3803('0x4'))(_0x3803('0x5'));var config=require(_0x3803('0x6'));var jayson=require(_0x3803('0x7'));var client=jayson[_0x3803('0x8')][_0x3803('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2146d7,_0x4ff328,_0x24a802){return new BPromise(function(_0x39f43a,_0x4d49c8){return client[_0x3803('0xa')](_0x2146d7,_0x24a802)[_0x3803('0xb')](function(_0x938029){logger[_0x3803('0xc')](_0x3803('0xd'),_0x4ff328,'request\x20sent');logger[_0x3803('0xe')](_0x3803('0xf'),_0x4ff328,_0x3803('0x10'),JSON[_0x3803('0x11')](_0x938029));if(_0x938029[_0x3803('0x12')]){if(_0x938029['error'][_0x3803('0x13')]===0x1f4){logger[_0x3803('0x12')](_0x3803('0xd'),_0x4ff328,_0x938029[_0x3803('0x12')][_0x3803('0x14')]);return _0x4d49c8(_0x938029[_0x3803('0x12')]['message']);}logger[_0x3803('0x12')](_0x3803('0xd'),_0x4ff328,_0x938029[_0x3803('0x12')]['message']);return _0x39f43a(_0x938029[_0x3803('0x12')][_0x3803('0x14')]);}else{logger[_0x3803('0xc')](_0x3803('0xd'),_0x4ff328,_0x3803('0x10'));_0x39f43a(_0x938029[_0x3803('0x15')][_0x3803('0x14')]);}})[_0x3803('0x16')](function(_0x50098a){logger[_0x3803('0x12')](_0x3803('0xd'),_0x4ff328,_0x50098a);_0x4d49c8(_0x50098a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6530607..b0264df 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 _0x69ba=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','multer'];(function(_0x28f153,_0x4852ed){var _0x56b861=function(_0x3cbf02){while(--_0x3cbf02){_0x28f153['push'](_0x28f153['shift']());}};_0x56b861(++_0x4852ed);}(_0x69ba,0x13f));var _0xa69b=function(_0x483afd,_0x1c6414){_0x483afd=_0x483afd-0x0;var _0x2ab4e8=_0x69ba[_0x483afd];return _0x2ab4e8;};'use strict';var multer=require(_0xa69b('0x0'));var util=require(_0xa69b('0x1'));var path=require(_0xa69b('0x2'));var timeout=require(_0xa69b('0x3'));var express=require('express');var router=express[_0xa69b('0x4')]();var fs_extra=require(_0xa69b('0x5'));var auth=require(_0xa69b('0x6'));var interaction=require(_0xa69b('0x7'));var config=require('../../config/environment');var controller=require(_0xa69b('0x8'));router[_0xa69b('0x9')]('/',auth[_0xa69b('0xa')](),controller[_0xa69b('0xb')]);router[_0xa69b('0x9')](_0xa69b('0xc'),auth[_0xa69b('0xa')](),controller[_0xa69b('0xd')]);router[_0xa69b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa69b('0xe')]);router[_0xa69b('0xf')]('/',auth[_0xa69b('0xa')](),controller[_0xa69b('0x10')]);router[_0xa69b('0x11')]('/:id',auth[_0xa69b('0xa')](),controller[_0xa69b('0x12')]);router[_0xa69b('0x13')]('/:id',auth[_0xa69b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xec50=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x28b07e,_0x4f0c22){var _0x4af7f5=function(_0x4112b7){while(--_0x4112b7){_0x28b07e['push'](_0x28b07e['shift']());}};_0x4af7f5(++_0x4f0c22);}(_0xec50,0x12b));var _0x0ec5=function(_0x164c6e,_0x25abdb){_0x164c6e=_0x164c6e-0x0;var _0xe3731a=_0xec50[_0x164c6e];return _0xe3731a;};'use strict';var multer=require('multer');var util=require(_0x0ec5('0x0'));var path=require(_0x0ec5('0x1'));var timeout=require(_0x0ec5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0ec5('0x3'));var interaction=require(_0x0ec5('0x4'));var config=require('../../config/environment');var controller=require(_0x0ec5('0x5'));router[_0x0ec5('0x6')]('/',auth[_0x0ec5('0x7')](),controller[_0x0ec5('0x8')]);router['get'](_0x0ec5('0x9'),auth['isAuthenticated'](),controller[_0x0ec5('0xa')]);router[_0x0ec5('0x6')](_0x0ec5('0xb'),auth[_0x0ec5('0x7')](),controller[_0x0ec5('0xc')]);router[_0x0ec5('0xd')]('/',auth[_0x0ec5('0x7')](),controller[_0x0ec5('0xe')]);router[_0x0ec5('0xf')]('/:id',auth[_0x0ec5('0x7')](),controller[_0x0ec5('0x10')]);router[_0x0ec5('0x11')](_0x0ec5('0xb'),auth[_0x0ec5('0x7')](),controller[_0x0ec5('0x12')]);module[_0x0ec5('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2b26200..9cf7a46 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(_0x558711,_0x3de772){var _0x488714=function(_0xc5bc20){while(--_0xc5bc20){_0x558711['push'](_0x558711['shift']());}};_0x488714(++_0x3de772);}(_0xaa88,0x137));var _0x8aa8=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xaa88[_0x58fc2f];return _0x3a1312;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x46b275,_0x5caabd){var _0x162fe4=function(_0x3f9c05){while(--_0x3f9c05){_0x46b275['push'](_0x46b275['shift']());}};_0x162fe4(++_0x5caabd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x45d3b6,_0x3312c8){_0x45d3b6=_0x45d3b6-0x0;var _0x1f3b3c=_0xf4eb[_0x45d3b6];return _0x1f3b3c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 790c33f..2d9c2c2 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 _0x110e=['util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x110e,0x121));var _0xe110=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x110e[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0xe110('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe110('0x1'));var jsonpatch=require(_0xe110('0x2'));var rp=require(_0xe110('0x3'));var moment=require(_0xe110('0x4'));var BPromise=require(_0xe110('0x5'));var Mustache=require(_0xe110('0x6'));var util=require(_0xe110('0x7'));var path=require(_0xe110('0x8'));var sox=require(_0xe110('0x9'));var csv=require('to-csv');var ejs=require(_0xe110('0xa'));var fs=require('fs');var fs_extra=require(_0xe110('0xb'));var _=require(_0xe110('0xc'));var squel=require('squel');var crypto=require(_0xe110('0xd'));var jsforce=require(_0xe110('0xe'));var deskjs=require(_0xe110('0xf'));var toCsv=require(_0xe110('0x10'));var querystring=require(_0xe110('0x11'));var Papa=require(_0xe110('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe110('0x13'));var as=require(_0xe110('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe110('0x15'));var db=require(_0xe110('0x16'))['db'];function respondWithStatusCode(_0x1fd8e9,_0x5d2b12){_0x5d2b12=_0x5d2b12||0xcc;return function(_0x423c7b){if(_0x423c7b){return _0x1fd8e9['sendStatus'](_0x5d2b12);}return _0x1fd8e9[_0xe110('0x17')](_0x5d2b12)[_0xe110('0x18')]();};}function respondWithResult(_0x5d73a3,_0x466310){_0x466310=_0x466310||0xc8;return function(_0x238013){if(_0x238013){return _0x5d73a3[_0xe110('0x17')](_0x466310)[_0xe110('0x19')](_0x238013);}};}function respondWithFilteredResult(_0x16ac21,_0x58746c){return function(_0x229ece){if(_0x229ece){var _0x492e62=typeof _0x58746c[_0xe110('0x1a')]==='undefined'&&typeof _0x58746c[_0xe110('0x1b')]===_0xe110('0x1c');var _0x1a58db=_0x229ece[_0xe110('0x1d')];var _0x106490=_0x492e62?0x0:_0x58746c[_0xe110('0x1a')];var _0x118675=_0x492e62?_0x229ece[_0xe110('0x1d')]:_0x58746c['offset']+_0x58746c[_0xe110('0x1b')];var _0x4089c1;if(_0x118675>=_0x1a58db){_0x118675=_0x1a58db;_0x4089c1=0xc8;}else{_0x4089c1=0xce;}_0x16ac21['status'](_0x4089c1);return _0x16ac21['set'](_0xe110('0x1e'),_0x106490+'-'+_0x118675+'/'+_0x1a58db)[_0xe110('0x19')](_0x229ece);}return null;};}function patchUpdates(_0x4054cf){return function(_0x2db72f){try{jsonpatch[_0xe110('0x1f')](_0x2db72f,_0x4054cf,!![]);}catch(_0x1291a7){return BPromise['reject'](_0x1291a7);}return _0x2db72f[_0xe110('0x20')]();};}function saveUpdates(_0x48a594,_0x5a8447){return function(_0x129c4a){if(_0x129c4a){return _0x129c4a[_0xe110('0x21')](_0x48a594)['then'](function(_0x32e06a){return _0x32e06a;});}return null;};}function removeEntity(_0x3cfbf6,_0x1feb7b){return function(_0x34a754){if(_0x34a754){return _0x34a754[_0xe110('0x22')]()[_0xe110('0x23')](function(){_0x3cfbf6['status'](0xcc)[_0xe110('0x18')]();});}};}function handleEntityNotFound(_0x41923d,_0x3831a0){return function(_0x1a31ed){if(!_0x1a31ed){_0x41923d[_0xe110('0x24')](0x194);}return _0x1a31ed;};}function handleError(_0x3350ee,_0x30bc20){_0x30bc20=_0x30bc20||0x1f4;return function(_0x4d3e73){logger['error'](_0x4d3e73[_0xe110('0x25')]);if(_0x4d3e73['name']){delete _0x4d3e73[_0xe110('0x26')];}_0x3350ee['status'](_0x30bc20)[_0xe110('0x27')](_0x4d3e73);};}exports[_0xe110('0x28')]=function(_0x5329a7,_0x189965){var _0x59af6b={},_0x333474={},_0x37a303={'count':0x0,'rows':[]};var _0x24b8eb=_[_0xe110('0x29')](db[_0xe110('0x2a')][_0xe110('0x2b')],function(_0xe1debf){return{'name':_0xe1debf[_0xe110('0x2c')],'type':_0xe1debf['type'][_0xe110('0x2d')]};});_0x333474['model']=_[_0xe110('0x29')](_0x24b8eb,_0xe110('0x26'));_0x333474[_0xe110('0x2e')]=_[_0xe110('0x2f')](_0x5329a7[_0xe110('0x2e')]);_0x333474[_0xe110('0x30')]=_[_0xe110('0x31')](_0x333474['model'],_0x333474[_0xe110('0x2e')]);_0x59af6b[_0xe110('0x32')]=_[_0xe110('0x31')](_0x333474[_0xe110('0x33')],qs[_0xe110('0x34')](_0x5329a7[_0xe110('0x2e')][_0xe110('0x34')]));_0x59af6b[_0xe110('0x32')]=_0x59af6b[_0xe110('0x32')][_0xe110('0x35')]?_0x59af6b['attributes']:_0x333474[_0xe110('0x33')];if(!_0x5329a7['query'][_0xe110('0x36')]('nolimit')){_0x59af6b['limit']=qs[_0xe110('0x1b')](_0x5329a7[_0xe110('0x2e')][_0xe110('0x1b')]);_0x59af6b[_0xe110('0x1a')]=qs[_0xe110('0x1a')](_0x5329a7['query'][_0xe110('0x1a')]);}_0x59af6b[_0xe110('0x37')]=qs[_0xe110('0x38')](_0x5329a7[_0xe110('0x2e')][_0xe110('0x38')]);_0x59af6b[_0xe110('0x39')]=qs[_0xe110('0x30')](_['pick'](_0x5329a7[_0xe110('0x2e')],_0x333474[_0xe110('0x30')]),_0x24b8eb);if(_0x5329a7['query'][_0xe110('0x3a')]){_0x59af6b[_0xe110('0x39')]=_['merge'](_0x59af6b[_0xe110('0x39')],{'$or':_[_0xe110('0x29')](_0x24b8eb,function(_0x5720ab){if(_0x5720ab[_0xe110('0x3b')]!==_0xe110('0x3c')){var _0x550e95={};_0x550e95[_0x5720ab[_0xe110('0x26')]]={'$like':'%'+_0x5329a7[_0xe110('0x2e')][_0xe110('0x3a')]+'%'};return _0x550e95;}})});}_0x59af6b=_[_0xe110('0x3d')]({},_0x59af6b,_0x5329a7[_0xe110('0x3e')]);var _0x3a7661={'where':_0x59af6b[_0xe110('0x39')]};return db[_0xe110('0x2a')][_0xe110('0x1d')](_0x3a7661)['then'](function(_0x3db1f0){_0x37a303[_0xe110('0x1d')]=_0x3db1f0;if(_0x5329a7[_0xe110('0x2e')][_0xe110('0x3f')]){_0x59af6b['include']=[{'all':!![]}];}return db[_0xe110('0x2a')][_0xe110('0x40')](_0x59af6b);})[_0xe110('0x23')](function(_0x2d5fe3){_0x37a303[_0xe110('0x41')]=_0x2d5fe3;return _0x37a303;})[_0xe110('0x23')](respondWithFilteredResult(_0x189965,_0x59af6b))['catch'](handleError(_0x189965,null));};exports[_0xe110('0x42')]=function(_0xf28c61,_0x5d5fcb){var _0x24d1ff={'raw':!![],'where':{'id':_0xf28c61[_0xe110('0x43')]['id']}},_0x5a8e2f={};_0x5a8e2f[_0xe110('0x33')]=_[_0xe110('0x2f')](db[_0xe110('0x2a')][_0xe110('0x2b')]);_0x5a8e2f[_0xe110('0x2e')]=_[_0xe110('0x2f')](_0xf28c61['query']);_0x5a8e2f[_0xe110('0x30')]=_[_0xe110('0x31')](_0x5a8e2f[_0xe110('0x33')],_0x5a8e2f[_0xe110('0x2e')]);_0x24d1ff[_0xe110('0x32')]=_[_0xe110('0x31')](_0x5a8e2f['model'],qs[_0xe110('0x34')](_0xf28c61[_0xe110('0x2e')]['fields']));_0x24d1ff[_0xe110('0x32')]=_0x24d1ff[_0xe110('0x32')][_0xe110('0x35')]?_0x24d1ff[_0xe110('0x32')]:_0x5a8e2f[_0xe110('0x33')];if(_0xf28c61[_0xe110('0x2e')][_0xe110('0x3f')]){_0x24d1ff[_0xe110('0x44')]=[{'all':!![]}];}_0x24d1ff=_[_0xe110('0x3d')]({},_0x24d1ff,_0xf28c61[_0xe110('0x3e')]);return db[_0xe110('0x2a')]['find'](_0x24d1ff)['then'](handleEntityNotFound(_0x5d5fcb,null))[_0xe110('0x23')](respondWithResult(_0x5d5fcb,null))[_0xe110('0x45')](handleError(_0x5d5fcb,null));};exports[_0xe110('0x46')]=function(_0x32a355,_0x450cc2){return db[_0xe110('0x2a')][_0xe110('0x46')](_0x32a355[_0xe110('0x47')],{})[_0xe110('0x23')](respondWithResult(_0x450cc2,0xc9))[_0xe110('0x45')](handleError(_0x450cc2,null));};exports[_0xe110('0x21')]=function(_0x148818,_0x2d752e){if(_0x148818[_0xe110('0x47')]['id']){delete _0x148818[_0xe110('0x47')]['id'];}return db['MailTransferReport'][_0xe110('0x48')]({'where':{'id':_0x148818['params']['id']}})[_0xe110('0x23')](handleEntityNotFound(_0x2d752e,null))['then'](saveUpdates(_0x148818['body'],null))[_0xe110('0x23')](respondWithResult(_0x2d752e,null))[_0xe110('0x45')](handleError(_0x2d752e,null));};exports[_0xe110('0x22')]=function(_0x9b76e9,_0x63f296){return db['MailTransferReport'][_0xe110('0x48')]({'where':{'id':_0x9b76e9['params']['id']}})[_0xe110('0x23')](handleEntityNotFound(_0x63f296,null))[_0xe110('0x23')](removeEntity(_0x63f296,null))['catch'](handleError(_0x63f296,null));};exports[_0xe110('0x49')]=function(_0x5b8596,_0x460faa){return db[_0xe110('0x2a')][_0xe110('0x49')]()[_0xe110('0x23')](respondWithResult(_0x460faa,null))['catch'](handleError(_0x460faa,null));}; \ No newline at end of file +var _0xf226=['json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map','MailTransferReport','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','rawAttributes','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status'];(function(_0x10b60a,_0x134ed1){var _0x400090=function(_0x4c682e){while(--_0x4c682e){_0x10b60a['push'](_0x10b60a['shift']());}};_0x400090(++_0x134ed1);}(_0xf226,0x7a));var _0x6f22=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf226[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6f22('0x0'));var rimraf=require(_0x6f22('0x1'));var zipdir=require(_0x6f22('0x2'));var jsonpatch=require(_0x6f22('0x3'));var rp=require(_0x6f22('0x4'));var moment=require(_0x6f22('0x5'));var BPromise=require(_0x6f22('0x6'));var Mustache=require('mustache');var util=require(_0x6f22('0x7'));var path=require(_0x6f22('0x8'));var sox=require('sox');var csv=require(_0x6f22('0x9'));var ejs=require(_0x6f22('0xa'));var fs=require('fs');var fs_extra=require(_0x6f22('0xb'));var _=require(_0x6f22('0xc'));var squel=require(_0x6f22('0xd'));var crypto=require(_0x6f22('0xe'));var jsforce=require(_0x6f22('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6f22('0x9'));var querystring=require(_0x6f22('0x10'));var Papa=require(_0x6f22('0x11'));var Redis=require(_0x6f22('0x12'));var authService=require(_0x6f22('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6f22('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f22('0x15'))(_0x6f22('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f22('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x400da9,_0x761f5c){_0x761f5c=_0x761f5c||0xcc;return function(_0x40f207){if(_0x40f207){return _0x400da9[_0x6f22('0x18')](_0x761f5c);}return _0x400da9[_0x6f22('0x19')](_0x761f5c)['end']();};}function respondWithResult(_0x2c50fa,_0x1d1735){_0x1d1735=_0x1d1735||0xc8;return function(_0x368628){if(_0x368628){return _0x2c50fa[_0x6f22('0x19')](_0x1d1735)[_0x6f22('0x1a')](_0x368628);}};}function respondWithFilteredResult(_0x3a1e16,_0x301011){return function(_0x1b92dd){if(_0x1b92dd){var _0x108018=typeof _0x301011[_0x6f22('0x1b')]===_0x6f22('0x1c')&&typeof _0x301011[_0x6f22('0x1d')]===_0x6f22('0x1c');var _0x941df0=_0x1b92dd[_0x6f22('0x1e')];var _0x3a2c2f=_0x108018?0x0:_0x301011[_0x6f22('0x1b')];var _0x566e94=_0x108018?_0x1b92dd['count']:_0x301011[_0x6f22('0x1b')]+_0x301011[_0x6f22('0x1d')];var _0x391301;if(_0x566e94>=_0x941df0){_0x566e94=_0x941df0;_0x391301=0xc8;}else{_0x391301=0xce;}_0x3a1e16['status'](_0x391301);return _0x3a1e16[_0x6f22('0x1f')]('Content-Range',_0x3a2c2f+'-'+_0x566e94+'/'+_0x941df0)[_0x6f22('0x1a')](_0x1b92dd);}return null;};}function patchUpdates(_0x322a6c){return function(_0x422d99){try{jsonpatch[_0x6f22('0x20')](_0x422d99,_0x322a6c,!![]);}catch(_0x38bf73){return BPromise[_0x6f22('0x21')](_0x38bf73);}return _0x422d99[_0x6f22('0x22')]();};}function saveUpdates(_0x3a653a,_0x3fde6a){return function(_0x22856e){if(_0x22856e){return _0x22856e[_0x6f22('0x23')](_0x3a653a)[_0x6f22('0x24')](function(_0x17042d){return _0x17042d;});}return null;};}function removeEntity(_0x206715,_0x12dd7f){return function(_0x2e212d){if(_0x2e212d){return _0x2e212d[_0x6f22('0x25')]()[_0x6f22('0x24')](function(){_0x206715[_0x6f22('0x19')](0xcc)[_0x6f22('0x26')]();});}};}function handleEntityNotFound(_0x15b3a9,_0x1de5da){return function(_0x3cfc87){if(!_0x3cfc87){_0x15b3a9['sendStatus'](0x194);}return _0x3cfc87;};}function handleError(_0xd8c0c2,_0x30aff6){_0x30aff6=_0x30aff6||0x1f4;return function(_0x2ba584){logger[_0x6f22('0x27')](_0x2ba584['stack']);if(_0x2ba584[_0x6f22('0x28')]){delete _0x2ba584[_0x6f22('0x28')];}_0xd8c0c2[_0x6f22('0x19')](_0x30aff6)[_0x6f22('0x29')](_0x2ba584);};}exports[_0x6f22('0x2a')]=function(_0xb39054,_0x5667ae){var _0x332a54={},_0x553865={},_0x107b67={'count':0x0,'rows':[]};var _0x28bc89=_[_0x6f22('0x2b')](db[_0x6f22('0x2c')]['rawAttributes'],function(_0x2772b3){return{'name':_0x2772b3['fieldName'],'type':_0x2772b3[_0x6f22('0x2d')][_0x6f22('0x2e')]};});_0x553865[_0x6f22('0x2f')]=_[_0x6f22('0x2b')](_0x28bc89,_0x6f22('0x28'));_0x553865[_0x6f22('0x30')]=_[_0x6f22('0x31')](_0xb39054[_0x6f22('0x30')]);_0x553865[_0x6f22('0x32')]=_['intersection'](_0x553865['model'],_0x553865[_0x6f22('0x30')]);_0x332a54[_0x6f22('0x33')]=_[_0x6f22('0x34')](_0x553865[_0x6f22('0x2f')],qs[_0x6f22('0x35')](_0xb39054[_0x6f22('0x30')][_0x6f22('0x35')]));_0x332a54['attributes']=_0x332a54['attributes']['length']?_0x332a54['attributes']:_0x553865[_0x6f22('0x2f')];if(!_0xb39054['query'][_0x6f22('0x36')](_0x6f22('0x37'))){_0x332a54[_0x6f22('0x1d')]=qs['limit'](_0xb39054[_0x6f22('0x30')]['limit']);_0x332a54[_0x6f22('0x1b')]=qs[_0x6f22('0x1b')](_0xb39054[_0x6f22('0x30')][_0x6f22('0x1b')]);}_0x332a54[_0x6f22('0x38')]=qs['sort'](_0xb39054[_0x6f22('0x30')][_0x6f22('0x39')]);_0x332a54[_0x6f22('0x3a')]=qs['filters'](_['pick'](_0xb39054['query'],_0x553865['filters']),_0x28bc89);if(_0xb39054['query']['filter']){_0x332a54[_0x6f22('0x3a')]=_[_0x6f22('0x3b')](_0x332a54[_0x6f22('0x3a')],{'$or':_[_0x6f22('0x2b')](_0x28bc89,function(_0x5969e0){if(_0x5969e0[_0x6f22('0x2d')]!==_0x6f22('0x3c')){var _0x63469c={};_0x63469c[_0x5969e0[_0x6f22('0x28')]]={'$like':'%'+_0xb39054['query'][_0x6f22('0x3d')]+'%'};return _0x63469c;}})});}_0x332a54=_[_0x6f22('0x3b')]({},_0x332a54,_0xb39054[_0x6f22('0x3e')]);var _0x443873={'where':_0x332a54['where']};return db[_0x6f22('0x2c')]['count'](_0x443873)[_0x6f22('0x24')](function(_0x4aa49c){_0x107b67['count']=_0x4aa49c;if(_0xb39054[_0x6f22('0x30')][_0x6f22('0x3f')]){_0x332a54[_0x6f22('0x40')]=[{'all':!![]}];}return db[_0x6f22('0x2c')]['findAll'](_0x332a54);})['then'](function(_0x251461){_0x107b67['rows']=_0x251461;return _0x107b67;})['then'](respondWithFilteredResult(_0x5667ae,_0x332a54))[_0x6f22('0x41')](handleError(_0x5667ae,null));};exports[_0x6f22('0x42')]=function(_0x3f93bb,_0x291363){var _0x52e0ef={'raw':!![],'where':{'id':_0x3f93bb['params']['id']}},_0x2a1937={};_0x2a1937['model']=_[_0x6f22('0x31')](db[_0x6f22('0x2c')][_0x6f22('0x43')]);_0x2a1937['query']=_[_0x6f22('0x31')](_0x3f93bb[_0x6f22('0x30')]);_0x2a1937['filters']=_[_0x6f22('0x34')](_0x2a1937['model'],_0x2a1937[_0x6f22('0x30')]);_0x52e0ef[_0x6f22('0x33')]=_[_0x6f22('0x34')](_0x2a1937[_0x6f22('0x2f')],qs[_0x6f22('0x35')](_0x3f93bb['query'][_0x6f22('0x35')]));_0x52e0ef[_0x6f22('0x33')]=_0x52e0ef[_0x6f22('0x33')][_0x6f22('0x44')]?_0x52e0ef['attributes']:_0x2a1937[_0x6f22('0x2f')];if(_0x3f93bb[_0x6f22('0x30')][_0x6f22('0x3f')]){_0x52e0ef['include']=[{'all':!![]}];}_0x52e0ef=_[_0x6f22('0x3b')]({},_0x52e0ef,_0x3f93bb[_0x6f22('0x3e')]);return db[_0x6f22('0x2c')][_0x6f22('0x45')](_0x52e0ef)['then'](handleEntityNotFound(_0x291363,null))[_0x6f22('0x24')](respondWithResult(_0x291363,null))[_0x6f22('0x41')](handleError(_0x291363,null));};exports[_0x6f22('0x46')]=function(_0x38895a,_0x21e157){return db[_0x6f22('0x2c')][_0x6f22('0x46')](_0x38895a[_0x6f22('0x47')],{})[_0x6f22('0x24')](respondWithResult(_0x21e157,0xc9))[_0x6f22('0x41')](handleError(_0x21e157,null));};exports[_0x6f22('0x23')]=function(_0x12e8cf,_0xcace6d){if(_0x12e8cf['body']['id']){delete _0x12e8cf[_0x6f22('0x47')]['id'];}return db[_0x6f22('0x2c')]['find']({'where':{'id':_0x12e8cf[_0x6f22('0x48')]['id']}})['then'](handleEntityNotFound(_0xcace6d,null))[_0x6f22('0x24')](saveUpdates(_0x12e8cf[_0x6f22('0x47')],null))[_0x6f22('0x24')](respondWithResult(_0xcace6d,null))[_0x6f22('0x41')](handleError(_0xcace6d,null));};exports[_0x6f22('0x25')]=function(_0x245e82,_0xdf8c1f){return db['MailTransferReport'][_0x6f22('0x45')]({'where':{'id':_0x245e82['params']['id']}})[_0x6f22('0x24')](handleEntityNotFound(_0xdf8c1f,null))[_0x6f22('0x24')](removeEntity(_0xdf8c1f,null))[_0x6f22('0x41')](handleError(_0xdf8c1f,null));};exports[_0x6f22('0x49')]=function(_0x308f2e,_0x1d8b48){return db[_0x6f22('0x2c')][_0x6f22('0x49')]()[_0x6f22('0x24')](respondWithResult(_0x1d8b48,null))[_0x6f22('0x41')](handleError(_0x1d8b48,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 45fd7d8..e543e18 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 _0x7aa7=['uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7aa7,0xfd));var _0x77aa=function(_0x441dd0,_0xa02a45){_0x441dd0=_0x441dd0-0x0;var _0x3840a2=_0x7aa7[_0x441dd0];return _0x3840a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x77aa('0x0'))(_0x77aa('0x1'));var moment=require(_0x77aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x77aa('0x3'));var fs=require('fs');var path=require(_0x77aa('0x4'));var rimraf=require(_0x77aa('0x5'));var config=require(_0x77aa('0x6'));var attributes=require(_0x77aa('0x7'));module[_0x77aa('0x8')]=function(_0x211587,_0x4726da){return _0x211587['define'](_0x77aa('0x9'),attributes,{'tableName':_0x77aa('0xa'),'paranoid':![],'indexes':[{'name':_0x77aa('0xb'),'fields':[_0x77aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbecd=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3cc7db,_0x36b9a5){var _0x3a9d0d=function(_0xbe0ce6){while(--_0xbe0ce6){_0x3cc7db['push'](_0x3cc7db['shift']());}};_0x3a9d0d(++_0x36b9a5);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdbec('0x0'));var util=require('util');var logger=require(_0xdbec('0x1'))(_0xdbec('0x2'));var moment=require('moment');var BPromise=require(_0xdbec('0x3'));var rp=require(_0xdbec('0x4'));var fs=require('fs');var path=require(_0xdbec('0x5'));var rimraf=require(_0xdbec('0x6'));var config=require(_0xdbec('0x7'));var attributes=require(_0xdbec('0x8'));module[_0xdbec('0x9')]=function(_0x411618,_0x578a3b){return _0x411618[_0xdbec('0xa')](_0xdbec('0xb'),attributes,{'tableName':_0xdbec('0xc'),'paranoid':![],'indexes':[{'name':_0xdbec('0xd'),'fields':[_0xdbec('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 68b3019..7322eb6 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 _0x5bf2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d5100,_0x40a375){var _0x3ea212=function(_0x16baf4){while(--_0x16baf4){_0x5d5100['push'](_0x5d5100['shift']());}};_0x3ea212(++_0x40a375);}(_0x5bf2,0x1f3));var _0x25bf=function(_0x40f321,_0x3ecb2b){_0x40f321=_0x40f321-0x0;var _0xc72793=_0x5bf2[_0x40f321];return _0xc72793;};'use strict';var _=require(_0x25bf('0x0'));var util=require(_0x25bf('0x1'));var moment=require(_0x25bf('0x2'));var BPromise=require(_0x25bf('0x3'));var rs=require(_0x25bf('0x4'));var fs=require('fs');var Redis=require(_0x25bf('0x5'));var db=require(_0x25bf('0x6'))['db'];var utils=require(_0x25bf('0x7'));var logger=require(_0x25bf('0x8'))(_0x25bf('0x9'));var config=require(_0x25bf('0xa'));var jayson=require(_0x25bf('0xb'));var client=jayson['client'][_0x25bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa90862,_0x51fe15,_0x322220){return new BPromise(function(_0x49c734,_0x400b04){return client['request'](_0xa90862,_0x322220)['then'](function(_0x4ee7f2){logger[_0x25bf('0xd')](_0x25bf('0xe'),_0x51fe15,_0x25bf('0xf'));logger[_0x25bf('0x10')](_0x25bf('0x11'),_0x51fe15,_0x25bf('0xf'),JSON[_0x25bf('0x12')](_0x4ee7f2));if(_0x4ee7f2[_0x25bf('0x13')]){if(_0x4ee7f2['error'][_0x25bf('0x14')]===0x1f4){logger[_0x25bf('0x13')](_0x25bf('0xe'),_0x51fe15,_0x4ee7f2['error'][_0x25bf('0x15')]);return _0x400b04(_0x4ee7f2['error']['message']);}logger['error'](_0x25bf('0xe'),_0x51fe15,_0x4ee7f2[_0x25bf('0x13')][_0x25bf('0x15')]);return _0x49c734(_0x4ee7f2[_0x25bf('0x13')][_0x25bf('0x15')]);}else{logger[_0x25bf('0xd')](_0x25bf('0xe'),_0x51fe15,_0x25bf('0xf'));_0x49c734(_0x4ee7f2[_0x25bf('0x16')][_0x25bf('0x15')]);}})['catch'](function(_0x2d59f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x51fe15,_0x2d59f4);_0x400b04(_0x2d59f4);});});} \ No newline at end of file +var _0x5321=['info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x5321,0xc8));var _0x1532=function(_0x5190c2,_0x14a577){_0x5190c2=_0x5190c2-0x0;var _0x2c0281=_0x5321[_0x5190c2];return _0x2c0281;};'use strict';var _=require('lodash');var util=require(_0x1532('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1532('0x1'));var fs=require('fs');var Redis=require(_0x1532('0x2'));var db=require(_0x1532('0x3'))['db'];var utils=require(_0x1532('0x4'));var logger=require('../../config/logger')(_0x1532('0x5'));var config=require(_0x1532('0x6'));var jayson=require(_0x1532('0x7'));var client=jayson[_0x1532('0x8')][_0x1532('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d51b9,_0x1d9ef0,_0x4670e6){return new BPromise(function(_0x5b1c21,_0x5c7743){return client['request'](_0x5d51b9,_0x4670e6)['then'](function(_0x321fee){logger[_0x1532('0xa')](_0x1532('0xb'),_0x1d9ef0,'request\x20sent');logger[_0x1532('0xc')](_0x1532('0xd'),_0x1d9ef0,_0x1532('0xe'),JSON[_0x1532('0xf')](_0x321fee));if(_0x321fee[_0x1532('0x10')]){if(_0x321fee[_0x1532('0x10')][_0x1532('0x11')]===0x1f4){logger[_0x1532('0x10')](_0x1532('0xb'),_0x1d9ef0,_0x321fee[_0x1532('0x10')][_0x1532('0x12')]);return _0x5c7743(_0x321fee['error'][_0x1532('0x12')]);}logger[_0x1532('0x10')](_0x1532('0xb'),_0x1d9ef0,_0x321fee[_0x1532('0x10')]['message']);return _0x5b1c21(_0x321fee[_0x1532('0x10')][_0x1532('0x12')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x1d9ef0,_0x1532('0xe'));_0x5b1c21(_0x321fee[_0x1532('0x13')]['message']);}})[_0x1532('0x14')](function(_0x45ca98){logger[_0x1532('0x10')](_0x1532('0xb'),_0x1d9ef0,_0x45ca98);_0x5c7743(_0x45ca98);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 21fcc87..3f82c65 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 _0xd3cb=['index','/describe','describe','/:id','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x1189a1,_0x2d9466){var _0x248890=function(_0x43e63d){while(--_0x43e63d){_0x1189a1['push'](_0x1189a1['shift']());}};_0x248890(++_0x2d9466);}(_0xd3cb,0x11a));var _0xbd3c=function(_0x4c5743,_0x3fd3ff){_0x4c5743=_0x4c5743-0x0;var _0x1cdffb=_0xd3cb[_0x4c5743];return _0x1cdffb;};'use strict';var multer=require(_0xbd3c('0x0'));var util=require(_0xbd3c('0x1'));var path=require(_0xbd3c('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd3c('0x3'));var router=express[_0xbd3c('0x4')]();var fs_extra=require(_0xbd3c('0x5'));var auth=require(_0xbd3c('0x6'));var interaction=require(_0xbd3c('0x7'));var config=require(_0xbd3c('0x8'));var controller=require(_0xbd3c('0x9'));router[_0xbd3c('0xa')]('/',auth[_0xbd3c('0xb')](),controller[_0xbd3c('0xc')]);router[_0xbd3c('0xa')](_0xbd3c('0xd'),auth[_0xbd3c('0xb')](),controller[_0xbd3c('0xe')]);router[_0xbd3c('0xa')](_0xbd3c('0xf'),auth[_0xbd3c('0xb')](),controller['show']);router[_0xbd3c('0x10')]('/',auth[_0xbd3c('0xb')](),controller[_0xbd3c('0x11')]);router[_0xbd3c('0x12')](_0xbd3c('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbd3c('0xb')](),controller[_0xbd3c('0x13')]);module[_0xbd3c('0x14')]=router; \ No newline at end of file +var _0xba7f=['fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2e2889,_0x434047){var _0x570d4d=function(_0xc3a84d){while(--_0xc3a84d){_0x2e2889['push'](_0x2e2889['shift']());}};_0x570d4d(++_0x434047);}(_0xba7f,0x1f3));var _0xfba7=function(_0x523d9d,_0x3f800f){_0x523d9d=_0x523d9d-0x0;var _0x52dafd=_0xba7f[_0x523d9d];return _0x52dafd;};'use strict';var multer=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var path=require('path');var timeout=require(_0xfba7('0x2'));var express=require(_0xfba7('0x3'));var router=express[_0xfba7('0x4')]();var fs_extra=require(_0xfba7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfba7('0x6'));var config=require(_0xfba7('0x7'));var controller=require(_0xfba7('0x8'));router[_0xfba7('0x9')]('/',auth[_0xfba7('0xa')](),controller[_0xfba7('0xb')]);router[_0xfba7('0x9')]('/describe',auth[_0xfba7('0xa')](),controller[_0xfba7('0xc')]);router['get'](_0xfba7('0xd'),auth['isAuthenticated'](),controller[_0xfba7('0xe')]);router[_0xfba7('0xf')]('/',auth[_0xfba7('0xa')](),controller['create']);router[_0xfba7('0x10')](_0xfba7('0xd'),auth[_0xfba7('0xa')](),controller[_0xfba7('0x11')]);router[_0xfba7('0x12')](_0xfba7('0xd'),auth[_0xfba7('0xa')](),controller[_0xfba7('0x13')]);module[_0xfba7('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 04ba6d1..394decd 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 _0x9da0=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x2ffd69,_0x5d94e){var _0x1be9ae=function(_0x1371c7){while(--_0x1371c7){_0x2ffd69['push'](_0x2ffd69['shift']());}};_0x1be9ae(++_0x5d94e);}(_0x9da0,0x1f1));var _0x09da=function(_0x1beccf,_0x363c1a){_0x1beccf=_0x1beccf-0x0;var _0x688d70=_0x9da0[_0x1beccf];return _0x688d70;};'use strict';var Sequelize=require(_0x09da('0x0'));var moment=require(_0x09da('0x1'));module[_0x09da('0x2')]={'channel':{'type':Sequelize[_0x09da('0x3')]},'membername':{'type':Sequelize[_0x09da('0x3')]},'interface':{'type':Sequelize[_0x09da('0x3')]},'type':{'type':Sequelize[_0x09da('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x09da('0x4')},'duration':{'type':Sequelize[_0x09da('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x09da('0x6')],'set':function(_0x17ccf4){var _0x57b8ee=moment(_0x17ccf4);var _0x14b51e=moment(this['getDataValue']('enterAt'));var _0x1ef1b2=_0x57b8ee['diff'](_0x14b51e,_0x09da('0x7'));this[_0x09da('0x8')]('exitAt',_0x17ccf4);this[_0x09da('0x8')](_0x09da('0x9'),_0x1ef1b2>=0x0?_0x1ef1b2:null);}},'data1':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xa')},'data2':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xb')},'data3':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xc')},'data4':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xd')},'data5':{'type':Sequelize[_0x09da('0x3')],'comment':_0x09da('0xe')},'role':{'type':Sequelize[_0x09da('0x3')]},'internal':{'type':Sequelize[_0x09da('0x5')]},'uniqueid':{'type':Sequelize[_0x09da('0x3')]}}; \ No newline at end of file +var _0x23eb=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x23eb,0x75));var _0xb23e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x23eb[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xb23e('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xb23e('0x1')]},'membername':{'type':Sequelize[_0xb23e('0x1')]},'interface':{'type':Sequelize[_0xb23e('0x1')]},'type':{'type':Sequelize[_0xb23e('0x1')],'defaultValue':_0xb23e('0x2'),'comment':_0xb23e('0x3')},'duration':{'type':Sequelize[_0xb23e('0x4')]},'enterAt':{'type':Sequelize[_0xb23e('0x5')]},'exitAt':{'type':Sequelize[_0xb23e('0x5')],'set':function(_0x367451){var _0x1b5084=moment(_0x367451);var _0x13b58a=moment(this['getDataValue'](_0xb23e('0x6')));var _0x445261=_0x1b5084[_0xb23e('0x7')](_0x13b58a,_0xb23e('0x8'));this['setDataValue'](_0xb23e('0x9'),_0x367451);this['setDataValue'](_0xb23e('0xa'),_0x445261>=0x0?_0x445261:null);}},'data1':{'type':Sequelize[_0xb23e('0x1')],'comment':_0xb23e('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xb23e('0xc')},'data3':{'type':Sequelize[_0xb23e('0x1')],'comment':_0xb23e('0xd')},'data4':{'type':Sequelize[_0xb23e('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xb23e('0x1')],'comment':_0xb23e('0xe')},'role':{'type':Sequelize[_0xb23e('0x1')]},'internal':{'type':Sequelize[_0xb23e('0x4')]},'uniqueid':{'type':Sequelize[_0xb23e('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8a5154f..a35953b 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x22de09,_0x3db597){var _0x4a13dc=function(_0x2b02eb){while(--_0x2b02eb){_0x22de09['push'](_0x22de09['shift']());}};_0x4a13dc(++_0x3db597);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x55ca,0x126));var _0xa55c=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0x55ca[_0x21b762];return _0x2ea6d4;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1956cd5..65d6fe4 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 _0xa8cb=['membername','interface','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface'];(function(_0x71defb,_0x229141){var _0x109c53=function(_0x3ffc17){while(--_0x3ffc17){_0x71defb['push'](_0x71defb['shift']());}};_0x109c53(++_0x229141);}(_0xa8cb,0x1de));var _0xba8c=function(_0x4bce1c,_0x1dd853){_0x4bce1c=_0x4bce1c-0x0;var _0x2f517f=_0xa8cb[_0x4bce1c];return _0x2f517f;};'use strict';var _=require(_0xba8c('0x0'));var util=require(_0xba8c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xba8c('0x2'));var BPromise=require(_0xba8c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba8c('0x4'));var rimraf=require(_0xba8c('0x5'));var config=require(_0xba8c('0x6'));var attributes=require(_0xba8c('0x7'));module[_0xba8c('0x8')]=function(_0x5d82bb,_0x2a713f){return _0x5d82bb['define'](_0xba8c('0x9'),attributes,{'tableName':_0xba8c('0xa'),'paranoid':![],'indexes':[{'name':_0xba8c('0xb'),'fields':[_0xba8c('0xc'),_0xba8c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf740=['./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ae998,_0x3bb2a6){var _0x500cab=function(_0x51e3d6){while(--_0x51e3d6){_0x2ae998['push'](_0x2ae998['shift']());}};_0x500cab(++_0x3bb2a6);}(_0xf740,0xab));var _0x0f74=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xf740[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0x0f74('0x0'));var util=require(_0x0f74('0x1'));var logger=require(_0x0f74('0x2'))(_0x0f74('0x3'));var moment=require('moment');var BPromise=require(_0x0f74('0x4'));var rp=require(_0x0f74('0x5'));var fs=require('fs');var path=require(_0x0f74('0x6'));var rimraf=require(_0x0f74('0x7'));var config=require(_0x0f74('0x8'));var attributes=require(_0x0f74('0x9'));module[_0x0f74('0xa')]=function(_0x161372,_0x52b253){return _0x161372['define'](_0x0f74('0xb'),attributes,{'tableName':_0x0f74('0xc'),'paranoid':![],'indexes':[{'name':_0x0f74('0xd'),'fields':[_0x0f74('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 80b67a3..e981520 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 _0x2f4a=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','MemberReport','options','where','attributes','limit','include','model','map','GetMemberReport','catch','create','body','then','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x2f4a[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xa2f4('0x0'));var util=require(_0xa2f4('0x1'));var moment=require(_0xa2f4('0x2'));var BPromise=require(_0xa2f4('0x3'));var rs=require(_0xa2f4('0x4'));var fs=require('fs');var Redis=require(_0xa2f4('0x5'));var db=require(_0xa2f4('0x6'))['db'];var utils=require(_0xa2f4('0x7'));var logger=require(_0xa2f4('0x8'))(_0xa2f4('0x9'));var config=require('../../config/environment');var jayson=require(_0xa2f4('0xa'));var client=jayson[_0xa2f4('0xb')][_0xa2f4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x151045,_0x2cd086,_0x194ee8){return new BPromise(function(_0x582a36,_0x2a79d5){return client['request'](_0x151045,_0x194ee8)['then'](function(_0x53e687){logger['info'](_0xa2f4('0xd'),_0x2cd086,_0xa2f4('0xe'));logger[_0xa2f4('0xf')](_0xa2f4('0x10'),_0x2cd086,'request\x20sent',JSON[_0xa2f4('0x11')](_0x53e687));if(_0x53e687['error']){if(_0x53e687[_0xa2f4('0x12')][_0xa2f4('0x13')]===0x1f4){logger['error'](_0xa2f4('0xd'),_0x2cd086,_0x53e687['error'][_0xa2f4('0x14')]);return _0x2a79d5(_0x53e687['error'][_0xa2f4('0x14')]);}logger['error'](_0xa2f4('0xd'),_0x2cd086,_0x53e687[_0xa2f4('0x12')][_0xa2f4('0x14')]);return _0x582a36(_0x53e687[_0xa2f4('0x12')][_0xa2f4('0x14')]);}else{logger[_0xa2f4('0x15')]('MemberReport,\x20%s,\x20%s',_0x2cd086,_0xa2f4('0xe'));_0x582a36(_0x53e687[_0xa2f4('0x16')]['message']);}})['catch'](function(_0x68fe57){logger[_0xa2f4('0x12')](_0xa2f4('0xd'),_0x2cd086,_0x68fe57);_0x2a79d5(_0x68fe57);});});}exports['GetMemberReport']=function(_0x540d43){var _0x47ea46=this;return new Promise(function(_0x5a0aa3,_0x35e356){return db[_0xa2f4('0x17')]['findAll']({'raw':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')][_0xa2f4('0x19')]||null:null,'attributes':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')][_0xa2f4('0x1a')]||null:null,'limit':_0x540d43[_0xa2f4('0x18')]?_0x540d43[_0xa2f4('0x18')][_0xa2f4('0x1b')]||null:null,'include':_0x540d43[_0xa2f4('0x18')]?_0x540d43['options'][_0xa2f4('0x1c')]?_['map'](_0x540d43[_0xa2f4('0x18')]['include'],function(_0x192707){return{'model':db[_0x192707[_0xa2f4('0x1d')]],'as':_0x192707['as'],'attributes':_0x192707[_0xa2f4('0x1a')],'include':_0x192707[_0xa2f4('0x1c')]?_['map'](_0x192707[_0xa2f4('0x1c')],function(_0x5770af){return{'model':db[_0x5770af[_0xa2f4('0x1d')]],'as':_0x5770af['as'],'attributes':_0x5770af[_0xa2f4('0x1a')],'include':_0x5770af['include']?_[_0xa2f4('0x1e')](_0x5770af[_0xa2f4('0x1c')],function(_0x25c907){return{'model':db[_0x25c907[_0xa2f4('0x1d')]],'as':_0x25c907['as'],'attributes':_0x25c907[_0xa2f4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c36a9){logger[_0xa2f4('0x15')](_0xa2f4('0x1f'),_0x540d43);logger[_0xa2f4('0xf')](_0xa2f4('0x1f'),_0x540d43,JSON[_0xa2f4('0x11')](_0x2c36a9));_0x5a0aa3(_0x2c36a9);})[_0xa2f4('0x20')](function(_0xf4217d){logger[_0xa2f4('0x12')](_0xa2f4('0x1f'),_0xf4217d[_0xa2f4('0x14')],_0x540d43);_0x35e356(_0x47ea46[_0xa2f4('0x12')](0x1f4,_0xf4217d[_0xa2f4('0x14')]));});});};exports['CreateMemberReport']=function(_0x2ca758){var _0x4bfd92=this;return new Promise(function(_0x12ed15,_0x249485){return db[_0xa2f4('0x17')][_0xa2f4('0x21')](_0x2ca758[_0xa2f4('0x22')],{'raw':_0x2ca758[_0xa2f4('0x18')]?_0x2ca758[_0xa2f4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa2f4('0x23')](function(_0x218795){logger[_0xa2f4('0x15')]('CreateMemberReport',_0x2ca758);logger['debug'](_0xa2f4('0x24'),_0x2ca758,JSON[_0xa2f4('0x11')](_0x218795));_0x12ed15(_0x218795);})[_0xa2f4('0x20')](function(_0x392b62){logger['error'](_0xa2f4('0x24'),_0x392b62['message'],_0x2ca758);_0x249485(_0x4bfd92[_0xa2f4('0x12')](0x1f4,_0x392b62[_0xa2f4('0x14')]));});});};exports[_0xa2f4('0x25')]=function(_0x21342e){var _0x44e5bc=this;return new Promise(function(_0x241d7c,_0x1e4aae){return db[_0xa2f4('0x17')][_0xa2f4('0x26')](_0x21342e[_0xa2f4('0x22')],{'raw':_0x21342e[_0xa2f4('0x18')]?_0x21342e[_0xa2f4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21342e[_0xa2f4('0x18')]?_0x21342e['options'][_0xa2f4('0x19')]||null:null,'attributes':_0x21342e[_0xa2f4('0x18')]?_0x21342e[_0xa2f4('0x18')][_0xa2f4('0x1a')]||null:null,'limit':_0x21342e[_0xa2f4('0x18')]?_0x21342e[_0xa2f4('0x18')][_0xa2f4('0x1b')]||null:null})[_0xa2f4('0x23')](function(_0x573932){logger['info'](_0xa2f4('0x25'),_0x21342e);logger[_0xa2f4('0xf')](_0xa2f4('0x25'),_0x21342e,JSON[_0xa2f4('0x11')](_0x573932));_0x241d7c(_0x573932);})[_0xa2f4('0x20')](function(_0x20a003){logger[_0xa2f4('0x12')](_0xa2f4('0x25'),_0x20a003[_0xa2f4('0x14')],_0x21342e);_0x1e4aae(_0x44e5bc[_0xa2f4('0x12')](0x1f4,_0x20a003[_0xa2f4('0x14')]));});});}; \ No newline at end of file +var _0x4da5=['debug','MemberReport','create','body','CreateMemberReport','UpdateMemberReport','update','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','options','raw','where','attributes','limit','include','model','map'];(function(_0x361bd3,_0x6dd8fa){var _0x344bee=function(_0x14bb22){while(--_0x14bb22){_0x361bd3['push'](_0x361bd3['shift']());}};_0x344bee(++_0x6dd8fa);}(_0x4da5,0x1b7));var _0x54da=function(_0x1dc64c,_0x412b97){_0x1dc64c=_0x1dc64c-0x0;var _0x11f7b1=_0x4da5[_0x1dc64c];return _0x11f7b1;};'use strict';var _=require('lodash');var util=require(_0x54da('0x0'));var moment=require(_0x54da('0x1'));var BPromise=require(_0x54da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x54da('0x4'));var logger=require(_0x54da('0x5'))(_0x54da('0x6'));var config=require(_0x54da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54da('0x8')][_0x54da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x259062,_0x1b2b5c,_0x2fe7cc){return new BPromise(function(_0x30c17d,_0x1e2c78){return client['request'](_0x259062,_0x2fe7cc)[_0x54da('0xa')](function(_0x3c4e06){logger[_0x54da('0xb')]('MemberReport,\x20%s,\x20%s',_0x1b2b5c,_0x54da('0xc'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x1b2b5c,_0x54da('0xc'),JSON[_0x54da('0xd')](_0x3c4e06));if(_0x3c4e06[_0x54da('0xe')]){if(_0x3c4e06[_0x54da('0xe')][_0x54da('0xf')]===0x1f4){logger[_0x54da('0xe')](_0x54da('0x10'),_0x1b2b5c,_0x3c4e06[_0x54da('0xe')][_0x54da('0x11')]);return _0x1e2c78(_0x3c4e06[_0x54da('0xe')][_0x54da('0x11')]);}logger[_0x54da('0xe')](_0x54da('0x10'),_0x1b2b5c,_0x3c4e06['error'][_0x54da('0x11')]);return _0x30c17d(_0x3c4e06[_0x54da('0xe')][_0x54da('0x11')]);}else{logger[_0x54da('0xb')]('MemberReport,\x20%s,\x20%s',_0x1b2b5c,_0x54da('0xc'));_0x30c17d(_0x3c4e06[_0x54da('0x12')][_0x54da('0x11')]);}})[_0x54da('0x13')](function(_0x20ff93){logger[_0x54da('0xe')]('MemberReport,\x20%s,\x20%s',_0x1b2b5c,_0x20ff93);_0x1e2c78(_0x20ff93);});});}exports[_0x54da('0x14')]=function(_0x14aa08){var _0x5d242e=this;return new Promise(function(_0x2cad22,_0x3a463c){return db['MemberReport']['findAll']({'raw':_0x14aa08[_0x54da('0x15')]?_0x14aa08['options'][_0x54da('0x16')]===undefined?!![]:![]:!![],'where':_0x14aa08[_0x54da('0x15')]?_0x14aa08['options'][_0x54da('0x17')]||null:null,'attributes':_0x14aa08[_0x54da('0x15')]?_0x14aa08[_0x54da('0x15')][_0x54da('0x18')]||null:null,'limit':_0x14aa08[_0x54da('0x15')]?_0x14aa08[_0x54da('0x15')][_0x54da('0x19')]||null:null,'include':_0x14aa08[_0x54da('0x15')]?_0x14aa08[_0x54da('0x15')][_0x54da('0x1a')]?_['map'](_0x14aa08[_0x54da('0x15')][_0x54da('0x1a')],function(_0x16b09a){return{'model':db[_0x16b09a[_0x54da('0x1b')]],'as':_0x16b09a['as'],'attributes':_0x16b09a[_0x54da('0x18')],'include':_0x16b09a[_0x54da('0x1a')]?_['map'](_0x16b09a[_0x54da('0x1a')],function(_0xef179d){return{'model':db[_0xef179d[_0x54da('0x1b')]],'as':_0xef179d['as'],'attributes':_0xef179d[_0x54da('0x18')],'include':_0xef179d[_0x54da('0x1a')]?_[_0x54da('0x1c')](_0xef179d['include'],function(_0x9ea13f){return{'model':db[_0x9ea13f['model']],'as':_0x9ea13f['as'],'attributes':_0x9ea13f[_0x54da('0x18')]};}):[]};}):[]};}):[]:[]})[_0x54da('0xa')](function(_0x77024e){logger['info']('GetMemberReport',_0x14aa08);logger[_0x54da('0x1d')](_0x54da('0x14'),_0x14aa08,JSON[_0x54da('0xd')](_0x77024e));_0x2cad22(_0x77024e);})['catch'](function(_0x1f69e6){logger[_0x54da('0xe')]('GetMemberReport',_0x1f69e6[_0x54da('0x11')],_0x14aa08);_0x3a463c(_0x5d242e[_0x54da('0xe')](0x1f4,_0x1f69e6[_0x54da('0x11')]));});});};exports['CreateMemberReport']=function(_0x4d142e){var _0x21784e=this;return new Promise(function(_0x54b666,_0x20a0c6){return db[_0x54da('0x1e')][_0x54da('0x1f')](_0x4d142e[_0x54da('0x20')],{'raw':_0x4d142e[_0x54da('0x15')]?_0x4d142e[_0x54da('0x15')][_0x54da('0x16')]===undefined?!![]:![]:!![]})[_0x54da('0xa')](function(_0x56d4fc){logger[_0x54da('0xb')](_0x54da('0x21'),_0x4d142e);logger['debug']('CreateMemberReport',_0x4d142e,JSON[_0x54da('0xd')](_0x56d4fc));_0x54b666(_0x56d4fc);})[_0x54da('0x13')](function(_0x3f3847){logger[_0x54da('0xe')](_0x54da('0x21'),_0x3f3847[_0x54da('0x11')],_0x4d142e);_0x20a0c6(_0x21784e[_0x54da('0xe')](0x1f4,_0x3f3847[_0x54da('0x11')]));});});};exports[_0x54da('0x22')]=function(_0xe2afc4){var _0x10f188=this;return new Promise(function(_0x361c6f,_0x5e58d3){return db[_0x54da('0x1e')][_0x54da('0x23')](_0xe2afc4['body'],{'raw':_0xe2afc4[_0x54da('0x15')]?_0xe2afc4[_0x54da('0x15')][_0x54da('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe2afc4[_0x54da('0x15')]?_0xe2afc4[_0x54da('0x15')]['where']||null:null,'attributes':_0xe2afc4['options']?_0xe2afc4[_0x54da('0x15')]['attributes']||null:null,'limit':_0xe2afc4['options']?_0xe2afc4['options'][_0x54da('0x19')]||null:null})[_0x54da('0xa')](function(_0x19cbb4){logger[_0x54da('0xb')](_0x54da('0x22'),_0xe2afc4);logger[_0x54da('0x1d')](_0x54da('0x22'),_0xe2afc4,JSON[_0x54da('0xd')](_0x19cbb4));_0x361c6f(_0x19cbb4);})[_0x54da('0x13')](function(_0x3885aa){logger[_0x54da('0xe')](_0x54da('0x22'),_0x3885aa[_0x54da('0x11')],_0xe2afc4);_0x5e58d3(_0x10f188[_0x54da('0xe')](0x1f4,_0x3885aa[_0x54da('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 576b583..dab63f5 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 _0xb4b5=['../../components/interaction/service','./migration.controller','index','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4b5,0x159));var _0x5b4b=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0xb4b5[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require(_0x5b4b('0x0'));var util=require(_0x5b4b('0x1'));var path=require(_0x5b4b('0x2'));var timeout=require(_0x5b4b('0x3'));var express=require(_0x5b4b('0x4'));var router=express['Router']();var fs_extra=require(_0x5b4b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5b4b('0x6'));var config=require('../../config/environment');var controller=require(_0x5b4b('0x7'));router['get']('/',controller[_0x5b4b('0x8')]);module['exports']=router; \ No newline at end of file +var _0x5294=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports','multer','util','path'];(function(_0xb30c05,_0x11bfab){var _0x567ad5=function(_0x560948){while(--_0x560948){_0xb30c05['push'](_0xb30c05['shift']());}};_0x567ad5(++_0x11bfab);}(_0x5294,0x111));var _0x4529=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5294[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var path=require(_0x4529('0x2'));var timeout=require(_0x4529('0x3'));var express=require(_0x4529('0x4'));var router=express[_0x4529('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4529('0x6'));var interaction=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var controller=require('./migration.controller');router[_0x4529('0x9')]('/',controller[_0x4529('0xa')]);module[_0x4529('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 f905ba3..65d3968 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 _0xb433=['version','exports'];(function(_0x20e171,_0x37aa03){var _0x447219=function(_0xd5d07e){while(--_0xd5d07e){_0x20e171['push'](_0x20e171['shift']());}};_0x447219(++_0x37aa03);}(_0xb433,0x1db));var _0x3b43=function(_0x594dc7,_0x269225){_0x594dc7=_0x594dc7-0x0;var _0x2e287d=_0xb433[_0x594dc7];return _0x2e287d;};'use strict';var Sequelize=require('sequelize');module[_0x3b43('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x3b43('0x1')}}; \ No newline at end of file +var _0xd592=['version','exports','STRING'];(function(_0x3ef74d,_0x354f00){var _0x32ce0d=function(_0x291edb){while(--_0x291edb){_0x3ef74d['push'](_0x3ef74d['shift']());}};_0x32ce0d(++_0x354f00);}(_0xd592,0x187));var _0x2d59=function(_0x51a4a6,_0x1e67a8){_0x51a4a6=_0x51a4a6-0x0;var _0x2720c8=_0xd592[_0x51a4a6];return _0x2720c8;};'use strict';var Sequelize=require('sequelize');module[_0x2d59('0x0')]={'version':{'type':Sequelize[_0x2d59('0x1')],'unique':_0x2d59('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index cbb7ffd..2b8812b 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 _0xaa71=['send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','include','Migration','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa71,0x65));var _0x1aa7=function(_0x59273c,_0x27ed56){_0x59273c=_0x59273c-0x0;var _0x55dd5c=_0xaa71[_0x59273c];return _0x55dd5c;};'use strict';var emlformat=require(_0x1aa7('0x0'));var rimraf=require(_0x1aa7('0x1'));var zipdir=require(_0x1aa7('0x2'));var jsonpatch=require(_0x1aa7('0x3'));var rp=require(_0x1aa7('0x4'));var moment=require(_0x1aa7('0x5'));var BPromise=require(_0x1aa7('0x6'));var Mustache=require('mustache');var util=require(_0x1aa7('0x7'));var path=require(_0x1aa7('0x8'));var sox=require(_0x1aa7('0x9'));var csv=require(_0x1aa7('0xa'));var ejs=require(_0x1aa7('0xb'));var fs=require('fs');var fs_extra=require(_0x1aa7('0xc'));var _=require(_0x1aa7('0xd'));var squel=require(_0x1aa7('0xe'));var crypto=require(_0x1aa7('0xf'));var jsforce=require(_0x1aa7('0x10'));var deskjs=require(_0x1aa7('0x11'));var toCsv=require(_0x1aa7('0xa'));var querystring=require('querystring');var Papa=require(_0x1aa7('0x12'));var Redis=require(_0x1aa7('0x13'));var authService=require(_0x1aa7('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aa7('0x15'));var logger=require(_0x1aa7('0x16'))(_0x1aa7('0x17'));var utils=require('../../config/utils');var config=require(_0x1aa7('0x18'));var licenseUtil=require(_0x1aa7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46e3e2,_0x40d883){_0x40d883=_0x40d883||0xcc;return function(_0xa4aba5){if(_0xa4aba5){return _0x46e3e2[_0x1aa7('0x1a')](_0x40d883);}return _0x46e3e2['status'](_0x40d883)[_0x1aa7('0x1b')]();};}function respondWithResult(_0x345d9a,_0x2943a8){_0x2943a8=_0x2943a8||0xc8;return function(_0xe2a0a0){if(_0xe2a0a0){return _0x345d9a[_0x1aa7('0x1c')](_0x2943a8)['json'](_0xe2a0a0);}};}function respondWithFilteredResult(_0x3d6812,_0x553697){return function(_0x2b5a9c){if(_0x2b5a9c){var _0x27952d=typeof _0x553697[_0x1aa7('0x1d')]===_0x1aa7('0x1e')&&typeof _0x553697[_0x1aa7('0x1f')]==='undefined';var _0x34d586=_0x2b5a9c[_0x1aa7('0x20')];var _0x532da5=_0x27952d?0x0:_0x553697[_0x1aa7('0x1d')];var _0x14b83a=_0x27952d?_0x2b5a9c[_0x1aa7('0x20')]:_0x553697[_0x1aa7('0x1d')]+_0x553697[_0x1aa7('0x1f')];var _0x221b2a;if(_0x14b83a>=_0x34d586){_0x14b83a=_0x34d586;_0x221b2a=0xc8;}else{_0x221b2a=0xce;}_0x3d6812[_0x1aa7('0x1c')](_0x221b2a);return _0x3d6812[_0x1aa7('0x21')](_0x1aa7('0x22'),_0x532da5+'-'+_0x14b83a+'/'+_0x34d586)[_0x1aa7('0x23')](_0x2b5a9c);}return null;};}function patchUpdates(_0x14d37){return function(_0x49e9be){try{jsonpatch['apply'](_0x49e9be,_0x14d37,!![]);}catch(_0x578789){return BPromise[_0x1aa7('0x24')](_0x578789);}return _0x49e9be[_0x1aa7('0x25')]();};}function saveUpdates(_0x18766e,_0x588782){return function(_0x47d8c2){if(_0x47d8c2){return _0x47d8c2[_0x1aa7('0x26')](_0x18766e)[_0x1aa7('0x27')](function(_0x1146c1){return _0x1146c1;});}return null;};}function removeEntity(_0x50ed66,_0x4012e9){return function(_0x528321){if(_0x528321){return _0x528321[_0x1aa7('0x28')]()[_0x1aa7('0x27')](function(){_0x50ed66[_0x1aa7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c8700,_0x5b4754){return function(_0x30d69f){if(!_0x30d69f){_0x4c8700[_0x1aa7('0x1a')](0x194);}return _0x30d69f;};}function handleError(_0x1a64d0,_0x12b9de){_0x12b9de=_0x12b9de||0x1f4;return function(_0x15f981){logger[_0x1aa7('0x29')](_0x15f981[_0x1aa7('0x2a')]);if(_0x15f981['name']){delete _0x15f981['name'];}_0x1a64d0[_0x1aa7('0x1c')](_0x12b9de)[_0x1aa7('0x2b')](_0x15f981);};}exports[_0x1aa7('0x2c')]=function(_0x354729,_0x200fcd){var _0xbc4327={},_0x20666d={},_0x59d83e={'count':0x0,'rows':[]};var _0x136de1=_[_0x1aa7('0x2d')](db['Migration'][_0x1aa7('0x2e')],function(_0x3ceb2e){return{'name':_0x3ceb2e[_0x1aa7('0x2f')],'type':_0x3ceb2e[_0x1aa7('0x30')][_0x1aa7('0x31')]};});_0x20666d[_0x1aa7('0x32')]=_['map'](_0x136de1,_0x1aa7('0x33'));_0x20666d['query']=_[_0x1aa7('0x34')](_0x354729[_0x1aa7('0x35')]);_0x20666d[_0x1aa7('0x36')]=_[_0x1aa7('0x37')](_0x20666d[_0x1aa7('0x32')],_0x20666d[_0x1aa7('0x35')]);_0xbc4327['attributes']=_[_0x1aa7('0x37')](_0x20666d['model'],qs[_0x1aa7('0x38')](_0x354729[_0x1aa7('0x35')][_0x1aa7('0x38')]));_0xbc4327[_0x1aa7('0x39')]=_0xbc4327[_0x1aa7('0x39')][_0x1aa7('0x3a')]?_0xbc4327[_0x1aa7('0x39')]:_0x20666d['model'];if(!_0x354729[_0x1aa7('0x35')]['hasOwnProperty'](_0x1aa7('0x3b'))){_0xbc4327[_0x1aa7('0x1f')]=qs[_0x1aa7('0x1f')](_0x354729[_0x1aa7('0x35')]['limit']);_0xbc4327[_0x1aa7('0x1d')]=qs[_0x1aa7('0x1d')](_0x354729[_0x1aa7('0x35')][_0x1aa7('0x1d')]);}_0xbc4327[_0x1aa7('0x3c')]=qs['sort'](_0x354729[_0x1aa7('0x35')][_0x1aa7('0x3d')]);_0xbc4327[_0x1aa7('0x3e')]=qs[_0x1aa7('0x36')](_[_0x1aa7('0x3f')](_0x354729[_0x1aa7('0x35')],_0x20666d['filters']),_0x136de1);if(_0x354729[_0x1aa7('0x35')][_0x1aa7('0x40')]){_0xbc4327['where']=_['merge'](_0xbc4327[_0x1aa7('0x3e')],{'$or':_[_0x1aa7('0x2d')](_0x136de1,function(_0x2092b9){if(_0x2092b9[_0x1aa7('0x30')]!=='VIRTUAL'){var _0x25160d={};_0x25160d[_0x2092b9[_0x1aa7('0x33')]]={'$like':'%'+_0x354729['query'][_0x1aa7('0x40')]+'%'};return _0x25160d;}})});}_0xbc4327=_[_0x1aa7('0x41')]({},_0xbc4327,_0x354729[_0x1aa7('0x42')]);var _0x12703f={'where':_0xbc4327[_0x1aa7('0x3e')]};return db['Migration']['count'](_0x12703f)[_0x1aa7('0x27')](function(_0x120946){_0x59d83e[_0x1aa7('0x20')]=_0x120946;if(_0x354729[_0x1aa7('0x35')]['includeAll']){_0xbc4327[_0x1aa7('0x43')]=[{'all':!![]}];}return db[_0x1aa7('0x44')][_0x1aa7('0x45')](_0xbc4327);})[_0x1aa7('0x27')](function(_0x50740e){_0x59d83e[_0x1aa7('0x46')]=_0x50740e;return _0x59d83e;})['then'](respondWithFilteredResult(_0x200fcd,_0xbc4327))[_0x1aa7('0x47')](handleError(_0x200fcd,null));}; \ No newline at end of file +var _0x9fa3=['findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','Migration'];(function(_0x14c1f4,_0x2b30f3){var _0x5393a0=function(_0x23d668){while(--_0x23d668){_0x14c1f4['push'](_0x14c1f4['shift']());}};_0x5393a0(++_0x2b30f3);}(_0x9fa3,0x112));var _0x39fa=function(_0x463baf,_0x32d055){_0x463baf=_0x463baf-0x0;var _0x797a21=_0x9fa3[_0x463baf];return _0x797a21;};'use strict';var emlformat=require(_0x39fa('0x0'));var rimraf=require(_0x39fa('0x1'));var zipdir=require(_0x39fa('0x2'));var jsonpatch=require(_0x39fa('0x3'));var rp=require(_0x39fa('0x4'));var moment=require(_0x39fa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x39fa('0x6'));var util=require(_0x39fa('0x7'));var path=require(_0x39fa('0x8'));var sox=require(_0x39fa('0x9'));var csv=require('to-csv');var ejs=require(_0x39fa('0xa'));var fs=require('fs');var fs_extra=require(_0x39fa('0xb'));var _=require(_0x39fa('0xc'));var squel=require(_0x39fa('0xd'));var crypto=require('crypto');var jsforce=require(_0x39fa('0xe'));var deskjs=require(_0x39fa('0xf'));var toCsv=require(_0x39fa('0x10'));var querystring=require(_0x39fa('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x39fa('0x12'));var hardwareService=require(_0x39fa('0x13'));var logger=require(_0x39fa('0x14'))(_0x39fa('0x15'));var utils=require(_0x39fa('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c1374,_0x13ace8){_0x13ace8=_0x13ace8||0xcc;return function(_0x2ff369){if(_0x2ff369){return _0x4c1374[_0x39fa('0x17')](_0x13ace8);}return _0x4c1374['status'](_0x13ace8)[_0x39fa('0x18')]();};}function respondWithResult(_0x5c9bc6,_0x59b9db){_0x59b9db=_0x59b9db||0xc8;return function(_0x143877){if(_0x143877){return _0x5c9bc6[_0x39fa('0x19')](_0x59b9db)[_0x39fa('0x1a')](_0x143877);}};}function respondWithFilteredResult(_0x59bfb1,_0x2799ce){return function(_0x4a9e41){if(_0x4a9e41){var _0xe986d6=typeof _0x2799ce[_0x39fa('0x1b')]===_0x39fa('0x1c')&&typeof _0x2799ce[_0x39fa('0x1d')]==='undefined';var _0x5ba834=_0x4a9e41[_0x39fa('0x1e')];var _0x27ca8e=_0xe986d6?0x0:_0x2799ce[_0x39fa('0x1b')];var _0x19ba34=_0xe986d6?_0x4a9e41[_0x39fa('0x1e')]:_0x2799ce[_0x39fa('0x1b')]+_0x2799ce[_0x39fa('0x1d')];var _0x19fddb;if(_0x19ba34>=_0x5ba834){_0x19ba34=_0x5ba834;_0x19fddb=0xc8;}else{_0x19fddb=0xce;}_0x59bfb1[_0x39fa('0x19')](_0x19fddb);return _0x59bfb1['set'](_0x39fa('0x1f'),_0x27ca8e+'-'+_0x19ba34+'/'+_0x5ba834)['json'](_0x4a9e41);}return null;};}function patchUpdates(_0x16ed98){return function(_0x416bf8){try{jsonpatch[_0x39fa('0x20')](_0x416bf8,_0x16ed98,!![]);}catch(_0x32ad41){return BPromise[_0x39fa('0x21')](_0x32ad41);}return _0x416bf8[_0x39fa('0x22')]();};}function saveUpdates(_0x22b388,_0x213d6e){return function(_0x2fdef4){if(_0x2fdef4){return _0x2fdef4[_0x39fa('0x23')](_0x22b388)[_0x39fa('0x24')](function(_0x331e0b){return _0x331e0b;});}return null;};}function removeEntity(_0x24adc3,_0x3a5534){return function(_0x1a4141){if(_0x1a4141){return _0x1a4141['destroy']()[_0x39fa('0x24')](function(){_0x24adc3[_0x39fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea098,_0x12c70d){return function(_0xf1a95d){if(!_0xf1a95d){_0x1ea098[_0x39fa('0x17')](0x194);}return _0xf1a95d;};}function handleError(_0xe8caaa,_0x1157df){_0x1157df=_0x1157df||0x1f4;return function(_0x1cc904){logger[_0x39fa('0x25')](_0x1cc904[_0x39fa('0x26')]);if(_0x1cc904[_0x39fa('0x27')]){delete _0x1cc904[_0x39fa('0x27')];}_0xe8caaa[_0x39fa('0x19')](_0x1157df)[_0x39fa('0x28')](_0x1cc904);};}exports[_0x39fa('0x29')]=function(_0xa947d0,_0x5d5d54){var _0x30f4ac={},_0x54e053={},_0x99e030={'count':0x0,'rows':[]};var _0x297d69=_[_0x39fa('0x2a')](db['Migration'][_0x39fa('0x2b')],function(_0x534f38){return{'name':_0x534f38[_0x39fa('0x2c')],'type':_0x534f38['type'][_0x39fa('0x2d')]};});_0x54e053[_0x39fa('0x2e')]=_[_0x39fa('0x2a')](_0x297d69,_0x39fa('0x27'));_0x54e053[_0x39fa('0x2f')]=_[_0x39fa('0x30')](_0xa947d0[_0x39fa('0x2f')]);_0x54e053['filters']=_['intersection'](_0x54e053[_0x39fa('0x2e')],_0x54e053[_0x39fa('0x2f')]);_0x30f4ac[_0x39fa('0x31')]=_[_0x39fa('0x32')](_0x54e053[_0x39fa('0x2e')],qs['fields'](_0xa947d0[_0x39fa('0x2f')][_0x39fa('0x33')]));_0x30f4ac['attributes']=_0x30f4ac['attributes'][_0x39fa('0x34')]?_0x30f4ac[_0x39fa('0x31')]:_0x54e053[_0x39fa('0x2e')];if(!_0xa947d0[_0x39fa('0x2f')][_0x39fa('0x35')](_0x39fa('0x36'))){_0x30f4ac[_0x39fa('0x1d')]=qs['limit'](_0xa947d0[_0x39fa('0x2f')][_0x39fa('0x1d')]);_0x30f4ac[_0x39fa('0x1b')]=qs[_0x39fa('0x1b')](_0xa947d0[_0x39fa('0x2f')][_0x39fa('0x1b')]);}_0x30f4ac['order']=qs[_0x39fa('0x37')](_0xa947d0[_0x39fa('0x2f')][_0x39fa('0x37')]);_0x30f4ac[_0x39fa('0x38')]=qs[_0x39fa('0x39')](_[_0x39fa('0x3a')](_0xa947d0['query'],_0x54e053[_0x39fa('0x39')]),_0x297d69);if(_0xa947d0[_0x39fa('0x2f')][_0x39fa('0x3b')]){_0x30f4ac['where']=_[_0x39fa('0x3c')](_0x30f4ac[_0x39fa('0x38')],{'$or':_[_0x39fa('0x2a')](_0x297d69,function(_0x15fef6){if(_0x15fef6[_0x39fa('0x3d')]!==_0x39fa('0x3e')){var _0x47315a={};_0x47315a[_0x15fef6[_0x39fa('0x27')]]={'$like':'%'+_0xa947d0[_0x39fa('0x2f')]['filter']+'%'};return _0x47315a;}})});}_0x30f4ac=_[_0x39fa('0x3c')]({},_0x30f4ac,_0xa947d0[_0x39fa('0x3f')]);var _0x501109={'where':_0x30f4ac['where']};return db['Migration']['count'](_0x501109)['then'](function(_0x323b01){_0x99e030[_0x39fa('0x1e')]=_0x323b01;if(_0xa947d0['query']['includeAll']){_0x30f4ac[_0x39fa('0x40')]=[{'all':!![]}];}return db[_0x39fa('0x41')][_0x39fa('0x42')](_0x30f4ac);})[_0x39fa('0x24')](function(_0x4c34e7){_0x99e030[_0x39fa('0x43')]=_0x4c34e7;return _0x99e030;})['then'](respondWithFilteredResult(_0x5d5d54,_0x30f4ac))['catch'](handleError(_0x5d5d54,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b4ae021..fc72a87 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 _0x4eb6=['exports','define','Migration','migrations','../../config/logger','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x322d5f,_0x348a9d){var _0x4fec46=function(_0x2e9064){while(--_0x2e9064){_0x322d5f['push'](_0x322d5f['shift']());}};_0x4fec46(++_0x348a9d);}(_0x4eb6,0x1b2));var _0x64eb=function(_0x30c226,_0x433169){_0x30c226=_0x30c226-0x0;var _0xdfc0ec=_0x4eb6[_0x30c226];return _0xdfc0ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x64eb('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x64eb('0x1'));var fs=require('fs');var path=require(_0x64eb('0x2'));var rimraf=require(_0x64eb('0x3'));var config=require(_0x64eb('0x4'));var attributes=require(_0x64eb('0x5'));module[_0x64eb('0x6')]=function(_0x3ba88a,_0x4ff5c6){return _0x3ba88a[_0x64eb('0x7')](_0x64eb('0x8'),attributes,{'tableName':_0x64eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e1a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','Migration','migrations','util'];(function(_0x44cd28,_0x1502d9){var _0x39356e=function(_0x4dfe82){while(--_0x4dfe82){_0x44cd28['push'](_0x44cd28['shift']());}};_0x39356e(++_0x1502d9);}(_0x0e1a,0x18b));var _0xa0e1=function(_0x557e4b,_0x37d49d){_0x557e4b=_0x557e4b-0x0;var _0x4d66ef=_0x0e1a[_0x557e4b];return _0x4d66ef;};'use strict';var _=require('lodash');var util=require(_0xa0e1('0x0'));var logger=require(_0xa0e1('0x1'))(_0xa0e1('0x2'));var moment=require(_0xa0e1('0x3'));var BPromise=require(_0xa0e1('0x4'));var rp=require(_0xa0e1('0x5'));var fs=require('fs');var path=require(_0xa0e1('0x6'));var rimraf=require('rimraf');var config=require(_0xa0e1('0x7'));var attributes=require(_0xa0e1('0x8'));module[_0xa0e1('0x9')]=function(_0x4e818,_0xd834da){return _0x4e818['define'](_0xa0e1('0xa'),attributes,{'tableName':_0xa0e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 51eeaa8..3e4c0a3 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 _0x18a5=['../../config/logger','rpc','../../config/environment','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18a5,0x164));var _0x518a=function(_0x3559ca,_0x3d450c){_0x3559ca=_0x3559ca-0x0;var _0x371c97=_0x18a5[_0x3559ca];return _0x371c97;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x518a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518a('0x3'))['db'];var utils=require(_0x518a('0x4'));var logger=require(_0x518a('0x5'))(_0x518a('0x6'));var config=require(_0x518a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea311,_0x1d4199,_0x19a2df){return new BPromise(function(_0x2a5fa6,_0x8bd966){return client[_0x518a('0x8')](_0x2ea311,_0x19a2df)[_0x518a('0x9')](function(_0xb996c3){logger[_0x518a('0xa')](_0x518a('0xb'),_0x1d4199,_0x518a('0xc'));logger[_0x518a('0xd')](_0x518a('0xe'),_0x1d4199,_0x518a('0xc'),JSON[_0x518a('0xf')](_0xb996c3));if(_0xb996c3['error']){if(_0xb996c3[_0x518a('0x10')]['code']===0x1f4){logger[_0x518a('0x10')]('Migration,\x20%s,\x20%s',_0x1d4199,_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);return _0x8bd966(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}logger[_0x518a('0x10')](_0x518a('0xb'),_0x1d4199,_0xb996c3[_0x518a('0x10')]['message']);return _0x2a5fa6(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}else{logger[_0x518a('0xa')]('Migration,\x20%s,\x20%s',_0x1d4199,_0x518a('0xc'));_0x2a5fa6(_0xb996c3[_0x518a('0x12')]['message']);}})['catch'](function(_0x177882){logger['error'](_0x518a('0xb'),_0x1d4199,_0x177882);_0x8bd966(_0x177882);});});} \ No newline at end of file +var _0x63bb=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x29f757,_0x4fb6c1){var _0x1c530d=function(_0x373b7a){while(--_0x373b7a){_0x29f757['push'](_0x29f757['shift']());}};_0x1c530d(++_0x4fb6c1);}(_0x63bb,0xf8));var _0xb63b=function(_0x52de48,_0x5bc748){_0x52de48=_0x52de48-0x0;var _0x18f4c0=_0x63bb[_0x52de48];return _0x18f4c0;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var moment=require(_0xb63b('0x2'));var BPromise=require(_0xb63b('0x3'));var rs=require(_0xb63b('0x4'));var fs=require('fs');var Redis=require(_0xb63b('0x5'));var db=require(_0xb63b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb63b('0x7'));var config=require(_0xb63b('0x8'));var jayson=require(_0xb63b('0x9'));var client=jayson[_0xb63b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb1be,_0x2a27f9,_0x2aa873){return new BPromise(function(_0x544988,_0x366bda){return client[_0xb63b('0xb')](_0x3eb1be,_0x2aa873)['then'](function(_0x2d5002){logger[_0xb63b('0xc')](_0xb63b('0xd'),_0x2a27f9,_0xb63b('0xe'));logger[_0xb63b('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x2a27f9,_0xb63b('0xe'),JSON[_0xb63b('0x10')](_0x2d5002));if(_0x2d5002[_0xb63b('0x11')]){if(_0x2d5002['error']['code']===0x1f4){logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x366bda(_0x2d5002['error'][_0xb63b('0x12')]);}logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x544988(_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);}else{logger['info'](_0xb63b('0xd'),_0x2a27f9,'request\x20sent');_0x544988(_0x2d5002[_0xb63b('0x13')][_0xb63b('0x12')]);}})[_0xb63b('0x14')](function(_0x41bfc4){logger[_0xb63b('0x11')]('Migration,\x20%s,\x20%s',_0x2a27f9,_0x41bfc4);_0x366bda(_0x41bfc4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7448e70..7be01d8 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 _0xfed6=['../../config/environment','./network.controller','get','index','/:id','post','put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x8730db,_0x2c6bd0){var _0x4e9b19=function(_0x2ec15b){while(--_0x2ec15b){_0x8730db['push'](_0x8730db['shift']());}};_0x4e9b19(++_0x2c6bd0);}(_0xfed6,0x14a));var _0x6fed=function(_0x7844b9,_0x579e6a){_0x7844b9=_0x7844b9-0x0;var _0x4e9db6=_0xfed6[_0x7844b9];return _0x4e9db6;};'use strict';var multer=require(_0x6fed('0x0'));var util=require(_0x6fed('0x1'));var path=require(_0x6fed('0x2'));var timeout=require(_0x6fed('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6fed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6fed('0x5'));var config=require(_0x6fed('0x6'));var controller=require(_0x6fed('0x7'));router[_0x6fed('0x8')]('/',auth['isAuthenticated'](),controller[_0x6fed('0x9')]);router[_0x6fed('0x8')](_0x6fed('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6fed('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6fed('0xc')](_0x6fed('0xa'),auth[_0x6fed('0xd')](),controller['update']);router[_0x6fed('0xe')](_0x6fed('0xa'),auth[_0x6fed('0xd')](),controller[_0x6fed('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3b90=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x3b90,0x143));var _0x03b9=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x3b90[_0x2a67fe];return _0x57e726;};'use strict';var multer=require('multer');var util=require(_0x03b9('0x0'));var path=require(_0x03b9('0x1'));var timeout=require(_0x03b9('0x2'));var express=require(_0x03b9('0x3'));var router=express[_0x03b9('0x4')]();var fs_extra=require(_0x03b9('0x5'));var auth=require(_0x03b9('0x6'));var interaction=require(_0x03b9('0x7'));var config=require('../../config/environment');var controller=require(_0x03b9('0x8'));router['get']('/',auth[_0x03b9('0x9')](),controller[_0x03b9('0xa')]);router[_0x03b9('0xb')](_0x03b9('0xc'),auth[_0x03b9('0x9')](),controller[_0x03b9('0xd')]);router[_0x03b9('0xe')]('/',auth[_0x03b9('0x9')](),controller['create']);router['put']('/:id',auth[_0x03b9('0x9')](),controller[_0x03b9('0xf')]);router[_0x03b9('0x10')](_0x03b9('0xc'),auth['isAuthenticated'](),controller[_0x03b9('0x11')]);module[_0x03b9('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7f67aea..5086456 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 _0x59c2=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x57c3f8,_0x5635d4){var _0x4feba5=function(_0x2503b3){while(--_0x2503b3){_0x57c3f8['push'](_0x57c3f8['shift']());}};_0x4feba5(++_0x5635d4);}(_0x59c2,0xa0));var _0x259c=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0x59c2[_0x1ffff7];return _0x49d017;};'use strict';var Sequelize=require(_0x259c('0x0'));module[_0x259c('0x1')]={'type':{'type':Sequelize[_0x259c('0x2')](_0x259c('0x3'),_0x259c('0x4'),_0x259c('0x5'),'turn')},'value':{'type':Sequelize[_0x259c('0x6')]},'username':{'type':Sequelize[_0x259c('0x6')]},'password':{'type':Sequelize[_0x259c('0x6')]}}; \ No newline at end of file +var _0x4131=['externip','stun','STRING','sequelize','exports','ENUM'];(function(_0x33d80d,_0x1c1100){var _0x3875be=function(_0x5672c6){while(--_0x5672c6){_0x33d80d['push'](_0x33d80d['shift']());}};_0x3875be(++_0x1c1100);}(_0x4131,0xb1));var _0x1413=function(_0x3f8647,_0x39c233){_0x3f8647=_0x3f8647-0x0;var _0x39d095=_0x4131[_0x3f8647];return _0x39d095;};'use strict';var Sequelize=require(_0x1413('0x0'));module[_0x1413('0x1')]={'type':{'type':Sequelize[_0x1413('0x2')]('localnet',_0x1413('0x3'),_0x1413('0x4'),'turn')},'value':{'type':Sequelize[_0x1413('0x5')]},'username':{'type':Sequelize[_0x1413('0x5')]},'password':{'type':Sequelize[_0x1413('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index aa5743c..8229c52 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 _0xcc1b=['include','findAll','show','params','rawAttributes','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','sequelize','root','res_stun_monitor.so','/etc/asterisk/sip_xcally_%s.conf','TURN','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','catch','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','Network','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll'];(function(_0x547053,_0x37cc21){var _0xb00198=function(_0x5a9104){while(--_0x5a9104){_0x547053['push'](_0x547053['shift']());}};_0xb00198(++_0x37cc21);}(_0xcc1b,0x8c));var _0xbcc1=function(_0x31db33,_0x5e13f4){_0x31db33=_0x31db33-0x0;var _0x22bdab=_0xcc1b[_0x31db33];return _0x22bdab;};'use strict';var emlformat=require(_0xbcc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcc1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcc1('0x2'));var moment=require(_0xbcc1('0x3'));var BPromise=require(_0xbcc1('0x4'));var Mustache=require(_0xbcc1('0x5'));var util=require(_0xbcc1('0x6'));var path=require(_0xbcc1('0x7'));var sox=require(_0xbcc1('0x8'));var csv=require('to-csv');var ejs=require(_0xbcc1('0x9'));var fs=require('fs');var fs_extra=require(_0xbcc1('0xa'));var _=require(_0xbcc1('0xb'));var squel=require('squel');var crypto=require(_0xbcc1('0xc'));var jsforce=require(_0xbcc1('0xd'));var deskjs=require(_0xbcc1('0xe'));var toCsv=require(_0xbcc1('0xf'));var querystring=require(_0xbcc1('0x10'));var Papa=require(_0xbcc1('0x11'));var Redis=require(_0xbcc1('0x12'));var authService=require(_0xbcc1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcc1('0x14'))('api');var utils=require(_0xbcc1('0x15'));var config=require(_0xbcc1('0x16'));var licenseUtil=require(_0xbcc1('0x17'));var db=require(_0xbcc1('0x18'))['db'];var jayson=require(_0xbcc1('0x19'));var client=jayson[_0xbcc1('0x1a')][_0xbcc1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x35f66d,_0x379c92,_0x7cfa6,_0x521fa9){return new BPromise(function(_0x29d8ff,_0x45a372){var _0x35dda1=_0x521fa9||client;return _0x35dda1['request'](_0x35f66d,_0x7cfa6)[_0xbcc1('0x1c')](function(_0x15675b){logger[_0xbcc1('0x1d')]('Network,\x20%s,\x20%s',_0x379c92,_0xbcc1('0x1e'));logger['debug'](_0xbcc1('0x1f'),_0x379c92,'request\x20sent',JSON[_0xbcc1('0x20')](_0x15675b));if(_0x15675b[_0xbcc1('0x21')]){if(_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x22')]===0x1f4){logger[_0xbcc1('0x21')](_0xbcc1('0x23'),_0x379c92,_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x24')]);return _0x45a372(_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x24')]);}logger[_0xbcc1('0x21')](_0xbcc1('0x23'),_0x379c92,_0x15675b[_0xbcc1('0x21')][_0xbcc1('0x24')]);return _0x29d8ff(_0x15675b['error']['message']);}else{logger[_0xbcc1('0x1d')](_0xbcc1('0x23'),_0x379c92,_0xbcc1('0x1e'));_0x29d8ff(_0x15675b['result'][_0xbcc1('0x24')]);}})[_0xbcc1('0x25')](function(_0x19fcc5){logger[_0xbcc1('0x21')]('Network,\x20%s,\x20%s',_0x379c92,_0x19fcc5);_0x45a372(_0x19fcc5);});});}function respondWithStatusCode(_0x2dfbe4,_0x4cb32f){_0x4cb32f=_0x4cb32f||0xcc;return function(_0x364f40){if(_0x364f40){return _0x2dfbe4[_0xbcc1('0x26')](_0x4cb32f);}return _0x2dfbe4['status'](_0x4cb32f)[_0xbcc1('0x27')]();};}function respondWithResult(_0xd51ae,_0x1086e6){_0x1086e6=_0x1086e6||0xc8;return function(_0x1ffe10){if(_0x1ffe10){return _0xd51ae[_0xbcc1('0x28')](_0x1086e6)['json'](_0x1ffe10);}};}function respondWithFilteredResult(_0x1b3888,_0x10d937){return function(_0x9393e3){if(_0x9393e3){var _0x59bbc8=typeof _0x10d937[_0xbcc1('0x29')]===_0xbcc1('0x2a')&&typeof _0x10d937[_0xbcc1('0x2b')]===_0xbcc1('0x2a');var _0x1eaea4=_0x9393e3['count'];var _0x24eed2=_0x59bbc8?0x0:_0x10d937[_0xbcc1('0x29')];var _0x307dc0=_0x59bbc8?_0x9393e3['count']:_0x10d937[_0xbcc1('0x29')]+_0x10d937[_0xbcc1('0x2b')];var _0x46060e;if(_0x307dc0>=_0x1eaea4){_0x307dc0=_0x1eaea4;_0x46060e=0xc8;}else{_0x46060e=0xce;}_0x1b3888[_0xbcc1('0x28')](_0x46060e);return _0x1b3888[_0xbcc1('0x2c')](_0xbcc1('0x2d'),_0x24eed2+'-'+_0x307dc0+'/'+_0x1eaea4)[_0xbcc1('0x2e')](_0x9393e3);}return null;};}function patchUpdates(_0x1f4f74){return function(_0x221b0b){try{jsonpatch[_0xbcc1('0x2f')](_0x221b0b,_0x1f4f74,!![]);}catch(_0x2ced3a){return BPromise['reject'](_0x2ced3a);}return _0x221b0b[_0xbcc1('0x30')]();};}function saveUpdates(_0x5e73d0,_0xe306a7){return function(_0x962b68){if(_0x962b68){return _0x962b68[_0xbcc1('0x31')](_0x5e73d0)[_0xbcc1('0x1c')](function(_0xa8ebc3){return _0xa8ebc3;});}return null;};}function removeEntity(_0xba3a8,_0x8b5fb2){return function(_0x2cb733){if(_0x2cb733){return _0x2cb733[_0xbcc1('0x32')]()['then'](function(){_0xba3a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48589b,_0x304730){return function(_0x77eee7){if(!_0x77eee7){_0x48589b[_0xbcc1('0x26')](0x194);}return _0x77eee7;};}function handleError(_0x13ed4a,_0x54fee4){_0x54fee4=_0x54fee4||0x1f4;return function(_0x5001a6){logger[_0xbcc1('0x21')](_0x5001a6[_0xbcc1('0x33')]);if(_0x5001a6[_0xbcc1('0x34')]){delete _0x5001a6[_0xbcc1('0x34')];}_0x13ed4a[_0xbcc1('0x28')](_0x54fee4)[_0xbcc1('0x35')](_0x5001a6);};}exports[_0xbcc1('0x36')]=function(_0x707fc7,_0x51a07e){var _0x32c2f8={},_0x111980={},_0x12230a={'count':0x0,'rows':[]};var _0x2dbc1c=_[_0xbcc1('0x37')](db[_0xbcc1('0x38')]['rawAttributes'],function(_0x42dccc){return{'name':_0x42dccc[_0xbcc1('0x39')],'type':_0x42dccc[_0xbcc1('0x3a')][_0xbcc1('0x3b')]};});_0x111980['model']=_[_0xbcc1('0x37')](_0x2dbc1c,_0xbcc1('0x34'));_0x111980['query']=_[_0xbcc1('0x3c')](_0x707fc7[_0xbcc1('0x3d')]);_0x111980[_0xbcc1('0x3e')]=_['intersection'](_0x111980['model'],_0x111980[_0xbcc1('0x3d')]);_0x32c2f8[_0xbcc1('0x3f')]=_[_0xbcc1('0x40')](_0x111980[_0xbcc1('0x41')],qs['fields'](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x42')]));_0x32c2f8[_0xbcc1('0x3f')]=_0x32c2f8[_0xbcc1('0x3f')][_0xbcc1('0x43')]?_0x32c2f8[_0xbcc1('0x3f')]:_0x111980[_0xbcc1('0x41')];if(!_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x44')](_0xbcc1('0x45'))){_0x32c2f8[_0xbcc1('0x2b')]=qs[_0xbcc1('0x2b')](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x2b')]);_0x32c2f8[_0xbcc1('0x29')]=qs[_0xbcc1('0x29')](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x29')]);}_0x32c2f8[_0xbcc1('0x46')]=qs[_0xbcc1('0x47')](_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x47')]);_0x32c2f8[_0xbcc1('0x48')]=qs[_0xbcc1('0x3e')](_[_0xbcc1('0x49')](_0x707fc7[_0xbcc1('0x3d')],_0x111980[_0xbcc1('0x3e')]),_0x2dbc1c);if(_0x707fc7[_0xbcc1('0x3d')]['filter']){_0x32c2f8[_0xbcc1('0x48')]=_[_0xbcc1('0x4a')](_0x32c2f8[_0xbcc1('0x48')],{'$or':_[_0xbcc1('0x37')](_0x2dbc1c,function(_0x234975){if(_0x234975[_0xbcc1('0x3a')]!==_0xbcc1('0x4b')){var _0x4e3f6b={};_0x4e3f6b[_0x234975[_0xbcc1('0x34')]]={'$like':'%'+_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x4c')]+'%'};return _0x4e3f6b;}})});}_0x32c2f8=_[_0xbcc1('0x4a')]({},_0x32c2f8,_0x707fc7[_0xbcc1('0x4d')]);var _0x42f8de={'where':_0x32c2f8[_0xbcc1('0x48')]};return db[_0xbcc1('0x38')][_0xbcc1('0x4e')](_0x42f8de)[_0xbcc1('0x1c')](function(_0x55f0e2){_0x12230a['count']=_0x55f0e2;if(_0x707fc7[_0xbcc1('0x3d')][_0xbcc1('0x4f')]){_0x32c2f8[_0xbcc1('0x50')]=[{'all':!![]}];}return db[_0xbcc1('0x38')][_0xbcc1('0x51')](_0x32c2f8);})[_0xbcc1('0x1c')](function(_0xfa024b){_0x12230a['rows']=_0xfa024b;return _0x12230a;})[_0xbcc1('0x1c')](respondWithFilteredResult(_0x51a07e,_0x32c2f8))[_0xbcc1('0x25')](handleError(_0x51a07e,null));};exports[_0xbcc1('0x52')]=function(_0x57b802,_0x242a34){var _0x594199={'raw':!![],'where':{'id':_0x57b802[_0xbcc1('0x53')]['id']}},_0x359da6={};_0x359da6[_0xbcc1('0x41')]=_['keys'](db[_0xbcc1('0x38')][_0xbcc1('0x54')]);_0x359da6[_0xbcc1('0x3d')]=_[_0xbcc1('0x3c')](_0x57b802[_0xbcc1('0x3d')]);_0x359da6['filters']=_['intersection'](_0x359da6[_0xbcc1('0x41')],_0x359da6['query']);_0x594199['attributes']=_[_0xbcc1('0x40')](_0x359da6[_0xbcc1('0x41')],qs[_0xbcc1('0x42')](_0x57b802[_0xbcc1('0x3d')][_0xbcc1('0x42')]));_0x594199[_0xbcc1('0x3f')]=_0x594199[_0xbcc1('0x3f')][_0xbcc1('0x43')]?_0x594199[_0xbcc1('0x3f')]:_0x359da6[_0xbcc1('0x41')];if(_0x57b802['query']['includeAll']){_0x594199['include']=[{'all':!![]}];}_0x594199=_[_0xbcc1('0x4a')]({},_0x594199,_0x57b802['options']);return db[_0xbcc1('0x38')][_0xbcc1('0x55')](_0x594199)['then'](handleEntityNotFound(_0x242a34,null))['then'](respondWithResult(_0x242a34,null))[_0xbcc1('0x25')](handleError(_0x242a34,null));};exports[_0xbcc1('0x56')]=function(_0x58322e,_0x539bb1,_0xafd24e){var _0x2abffd;return db['sequelize'][_0xbcc1('0x57')](function(_0x3ebe57){return db[_0xbcc1('0x38')][_0xbcc1('0x56')](_0x58322e[_0xbcc1('0x58')],{'raw':!![]})[_0xbcc1('0x1c')](function(_0x26392f){_0x2abffd=_0x26392f;return db['Network'][_0xbcc1('0x51')]({'where':{'type':_0x58322e[_0xbcc1('0x58')]['type']},'raw':!![]});})['then'](function(_0x1a9980){if(_0x2abffd[_0xbcc1('0x3a')][_0xbcc1('0x59')]()==_0xbcc1('0x5a')){var _0x2ca35a=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x5d')),'utf8');var _0x260e6b=ejs[_0xbcc1('0x5e')](_0x2ca35a,{'networks':_0x1a9980||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x60'),_0x260e6b);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x2abffd[_0xbcc1('0x3a')]['toUpperCase']()=='TURN'){var _0x4f2f16=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x62')),_0xbcc1('0x63'));var _0x3d7e1b=ejs[_0xbcc1('0x5e')](_0x4f2f16,{'networks':_0x1a9980||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x64'),_0x3d7e1b);return respondWithRpcPromise(_0xbcc1('0x61'),'create',{'module':'res_stun_monitor.so'});}else{var _0x2a46de=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x65')),_0xbcc1('0x63'));var _0x4d4e02=ejs[_0xbcc1('0x5e')](_0x2a46de,{'networks':_0x1a9980||[]});fs[_0xbcc1('0x5f')](util[_0xbcc1('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x58322e[_0xbcc1('0x58')][_0xbcc1('0x3a')][_0xbcc1('0x67')]()),_0x4d4e02);return respondWithRpcPromise(_0xbcc1('0x61'),'create',{'module':_0xbcc1('0x68')});}return null;})[_0xbcc1('0x1c')](function(){return _0x2abffd;});})[_0xbcc1('0x1c')](respondWithResult(_0x539bb1,0xc9))[_0xbcc1('0x25')](handleError(_0x539bb1,null));};exports[_0xbcc1('0x31')]=function(_0x3a1494,_0xfe20d5,_0xc930fc){var _0x505b6c;return db[_0xbcc1('0x69')][_0xbcc1('0x57')](function(_0x7541fe){return db[_0xbcc1('0x38')]['find']({'where':{'id':_0x3a1494['params']['id']}})[_0xbcc1('0x1c')](handleEntityNotFound(_0xfe20d5,null))[_0xbcc1('0x1c')](saveUpdates(_0x3a1494[_0xbcc1('0x58')],null))[_0xbcc1('0x1c')](function(_0x50c327){if(_0x50c327){_0x505b6c=_0x50c327;return db[_0xbcc1('0x38')][_0xbcc1('0x51')]({'where':{'type':_0x505b6c[_0xbcc1('0x3a')]},'raw':!![]});}return null;})[_0xbcc1('0x1c')](function(_0x27e314){if(_0x505b6c[_0xbcc1('0x3a')]['toUpperCase']()==_0xbcc1('0x5a')){var _0x64f2ab=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],'server/files/templates/stun_multiple.ejs'),_0xbcc1('0x63'));var _0x4fb512=ejs[_0xbcc1('0x5e')](_0x64f2ab,{'networks':_0x27e314||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x60'),_0x4fb512);return respondWithRpcPromise('Reload',_0xbcc1('0x31'),{'module':_0xbcc1('0x6b')});}else if(_0x505b6c[_0xbcc1('0x3a')][_0xbcc1('0x59')]()=='TURN'){var _0x28a8ee=fs[_0xbcc1('0x5b')](path['join'](config['root'],_0xbcc1('0x62')),_0xbcc1('0x63'));var _0x5daaae=ejs[_0xbcc1('0x5e')](_0x28a8ee,{'networks':_0x27e314||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x64'),_0x5daaae);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x31'),{'module':_0xbcc1('0x6b')});}else{var _0x5a7bc9=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config['root'],_0xbcc1('0x65')),_0xbcc1('0x63'));var _0x3d1386=ejs[_0xbcc1('0x5e')](_0x5a7bc9,{'networks':_0x27e314||[]});fs[_0xbcc1('0x5f')](util[_0xbcc1('0x66')](_0xbcc1('0x6c'),_0x3a1494[_0xbcc1('0x58')]['type'][_0xbcc1('0x67')]()),_0x3d1386);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x31'),{'module':_0xbcc1('0x68')});}return null;})['then'](function(_0x5621b8){if(_0x5621b8){return _0x505b6c;}return null;});})[_0xbcc1('0x1c')](respondWithResult(_0xfe20d5,null))[_0xbcc1('0x25')](handleError(_0xfe20d5,null));};exports['destroy']=function(_0x4ea0a1,_0x392a6b,_0x346738){var _0x478151;return db[_0xbcc1('0x38')][_0xbcc1('0x55')]({'where':{'id':_0x4ea0a1[_0xbcc1('0x53')]['id']}})[_0xbcc1('0x1c')](function(_0x51b548){_0x478151=_0x51b548;return _0x51b548;})[_0xbcc1('0x1c')](handleEntityNotFound(_0x392a6b,null))[_0xbcc1('0x1c')](removeEntity(_0x392a6b,null))[_0xbcc1('0x1c')](function(){if(_0x478151){return db[_0xbcc1('0x38')][_0xbcc1('0x51')]({'where':{'type':_0x478151[_0xbcc1('0x3a')]},'raw':!![]});}})[_0xbcc1('0x1c')](function(_0x3b9f64){if(_0x478151['type'][_0xbcc1('0x59')]()==_0xbcc1('0x5a')){var _0x4f79b5=fs['readFileSync'](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],_0xbcc1('0x5d')),_0xbcc1('0x63'));var _0x37cfe8=ejs[_0xbcc1('0x5e')](_0x4f79b5,{'networks':_0x3b9f64||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x60'),_0x37cfe8);return respondWithRpcPromise(_0xbcc1('0x61'),'destroy',{'module':_0xbcc1('0x6b')});}else if(_0x478151[_0xbcc1('0x3a')][_0xbcc1('0x59')]()==_0xbcc1('0x6d')){var _0x20b548=fs['readFileSync'](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],_0xbcc1('0x62')),'utf8');var _0x3683f2=ejs['render'](_0x20b548,{'networks':_0x3b9f64||[]});fs[_0xbcc1('0x5f')](_0xbcc1('0x64'),_0x3683f2);return respondWithRpcPromise(_0xbcc1('0x61'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x537ac9=fs[_0xbcc1('0x5b')](path[_0xbcc1('0x5c')](config[_0xbcc1('0x6a')],'server/files/templates/network.ejs'),_0xbcc1('0x63'));var _0x9805d6=ejs[_0xbcc1('0x5e')](_0x537ac9,{'networks':_0x3b9f64||[]});fs[_0xbcc1('0x5f')](util[_0xbcc1('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x4ea0a1[_0xbcc1('0x58')][_0xbcc1('0x3a')][_0xbcc1('0x67')]()),_0x9805d6);return respondWithRpcPromise(_0xbcc1('0x61'),_0xbcc1('0x32'),{'module':'chan_sip.so'});}return null;})[_0xbcc1('0x25')](handleError(_0x392a6b,null));}; \ No newline at end of file +var _0x18ab=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','destroy','stack','name','send','map','Network','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','limit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','transaction','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','chan_sip.so','params','TURN'];(function(_0x105594,_0x2d9608){var _0x1441c2=function(_0x48bb04){while(--_0x48bb04){_0x105594['push'](_0x105594['shift']());}};_0x1441c2(++_0x2d9608);}(_0x18ab,0xd2));var _0xb18a=function(_0x34c2e6,_0xe9dfd7){_0x34c2e6=_0x34c2e6-0x0;var _0x4885b1=_0x18ab[_0x34c2e6];return _0x4885b1;};'use strict';var emlformat=require(_0xb18a('0x0'));var rimraf=require(_0xb18a('0x1'));var zipdir=require(_0xb18a('0x2'));var jsonpatch=require(_0xb18a('0x3'));var rp=require(_0xb18a('0x4'));var moment=require(_0xb18a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb18a('0x6'));var util=require(_0xb18a('0x7'));var path=require(_0xb18a('0x8'));var sox=require(_0xb18a('0x9'));var csv=require('to-csv');var ejs=require(_0xb18a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb18a('0xb'));var squel=require(_0xb18a('0xc'));var crypto=require('crypto');var jsforce=require(_0xb18a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb18a('0xe'));var querystring=require(_0xb18a('0xf'));var Papa=require(_0xb18a('0x10'));var Redis=require('ioredis');var authService=require(_0xb18a('0x11'));var qs=require(_0xb18a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb18a('0x13'));var logger=require(_0xb18a('0x14'))('api');var utils=require(_0xb18a('0x15'));var config=require(_0xb18a('0x16'));var licenseUtil=require(_0xb18a('0x17'));var db=require(_0xb18a('0x18'))['db'];var jayson=require(_0xb18a('0x19'));var client=jayson[_0xb18a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15e5d2,_0x5d73ee,_0x17d2b7,_0x51ecd8){return new BPromise(function(_0x3e64e5,_0xda94b6){var _0x2a6780=_0x51ecd8||client;return _0x2a6780['request'](_0x15e5d2,_0x17d2b7)[_0xb18a('0x1b')](function(_0x18a881){logger[_0xb18a('0x1c')](_0xb18a('0x1d'),_0x5d73ee,_0xb18a('0x1e'));logger[_0xb18a('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x5d73ee,'request\x20sent',JSON[_0xb18a('0x20')](_0x18a881));if(_0x18a881[_0xb18a('0x21')]){if(_0x18a881['error'][_0xb18a('0x22')]===0x1f4){logger[_0xb18a('0x21')](_0xb18a('0x1d'),_0x5d73ee,_0x18a881['error'][_0xb18a('0x23')]);return _0xda94b6(_0x18a881[_0xb18a('0x21')][_0xb18a('0x23')]);}logger[_0xb18a('0x21')](_0xb18a('0x1d'),_0x5d73ee,_0x18a881[_0xb18a('0x21')][_0xb18a('0x23')]);return _0x3e64e5(_0x18a881[_0xb18a('0x21')][_0xb18a('0x23')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x5d73ee,_0xb18a('0x1e'));_0x3e64e5(_0x18a881[_0xb18a('0x24')][_0xb18a('0x23')]);}})[_0xb18a('0x25')](function(_0x48f7f8){logger[_0xb18a('0x21')]('Network,\x20%s,\x20%s',_0x5d73ee,_0x48f7f8);_0xda94b6(_0x48f7f8);});});}function respondWithStatusCode(_0x1550c6,_0x23e228){_0x23e228=_0x23e228||0xcc;return function(_0x208df7){if(_0x208df7){return _0x1550c6[_0xb18a('0x26')](_0x23e228);}return _0x1550c6[_0xb18a('0x27')](_0x23e228)[_0xb18a('0x28')]();};}function respondWithResult(_0x3242fa,_0x443346){_0x443346=_0x443346||0xc8;return function(_0x567bb3){if(_0x567bb3){return _0x3242fa[_0xb18a('0x27')](_0x443346)['json'](_0x567bb3);}};}function respondWithFilteredResult(_0x33b107,_0x269766){return function(_0x349760){if(_0x349760){var _0x419237=typeof _0x269766[_0xb18a('0x29')]===_0xb18a('0x2a')&&typeof _0x269766['limit']==='undefined';var _0x217883=_0x349760[_0xb18a('0x2b')];var _0x2a83b9=_0x419237?0x0:_0x269766[_0xb18a('0x29')];var _0x5d4b52=_0x419237?_0x349760[_0xb18a('0x2b')]:_0x269766[_0xb18a('0x29')]+_0x269766['limit'];var _0x598331;if(_0x5d4b52>=_0x217883){_0x5d4b52=_0x217883;_0x598331=0xc8;}else{_0x598331=0xce;}_0x33b107[_0xb18a('0x27')](_0x598331);return _0x33b107[_0xb18a('0x2c')](_0xb18a('0x2d'),_0x2a83b9+'-'+_0x5d4b52+'/'+_0x217883)[_0xb18a('0x2e')](_0x349760);}return null;};}function patchUpdates(_0x44c4bf){return function(_0x1e6a01){try{jsonpatch['apply'](_0x1e6a01,_0x44c4bf,!![]);}catch(_0x57bd7a){return BPromise[_0xb18a('0x2f')](_0x57bd7a);}return _0x1e6a01[_0xb18a('0x30')]();};}function saveUpdates(_0xfe3b0d,_0x583b49){return function(_0x566599){if(_0x566599){return _0x566599[_0xb18a('0x31')](_0xfe3b0d)[_0xb18a('0x1b')](function(_0x3a0794){return _0x3a0794;});}return null;};}function removeEntity(_0x404fd4,_0x393a3b){return function(_0x2af8cc){if(_0x2af8cc){return _0x2af8cc[_0xb18a('0x32')]()[_0xb18a('0x1b')](function(){_0x404fd4[_0xb18a('0x27')](0xcc)[_0xb18a('0x28')]();});}};}function handleEntityNotFound(_0x1efd05,_0x11b5c6){return function(_0x3d2486){if(!_0x3d2486){_0x1efd05[_0xb18a('0x26')](0x194);}return _0x3d2486;};}function handleError(_0x1651ce,_0x571093){_0x571093=_0x571093||0x1f4;return function(_0x36c2a4){logger[_0xb18a('0x21')](_0x36c2a4[_0xb18a('0x33')]);if(_0x36c2a4[_0xb18a('0x34')]){delete _0x36c2a4[_0xb18a('0x34')];}_0x1651ce[_0xb18a('0x27')](_0x571093)[_0xb18a('0x35')](_0x36c2a4);};}exports['index']=function(_0x235082,_0x10a532){var _0x701688={},_0x392d48={},_0x90a382={'count':0x0,'rows':[]};var _0x31fa69=_[_0xb18a('0x36')](db[_0xb18a('0x37')][_0xb18a('0x38')],function(_0x412518){return{'name':_0x412518[_0xb18a('0x39')],'type':_0x412518[_0xb18a('0x3a')]['key']};});_0x392d48[_0xb18a('0x3b')]=_[_0xb18a('0x36')](_0x31fa69,_0xb18a('0x34'));_0x392d48['query']=_[_0xb18a('0x3c')](_0x235082['query']);_0x392d48[_0xb18a('0x3d')]=_[_0xb18a('0x3e')](_0x392d48[_0xb18a('0x3b')],_0x392d48['query']);_0x701688[_0xb18a('0x3f')]=_[_0xb18a('0x3e')](_0x392d48[_0xb18a('0x3b')],qs[_0xb18a('0x40')](_0x235082[_0xb18a('0x41')][_0xb18a('0x40')]));_0x701688['attributes']=_0x701688[_0xb18a('0x3f')][_0xb18a('0x42')]?_0x701688[_0xb18a('0x3f')]:_0x392d48['model'];if(!_0x235082['query']['hasOwnProperty']('nolimit')){_0x701688[_0xb18a('0x43')]=qs[_0xb18a('0x43')](_0x235082[_0xb18a('0x41')][_0xb18a('0x43')]);_0x701688['offset']=qs[_0xb18a('0x29')](_0x235082['query'][_0xb18a('0x29')]);}_0x701688['order']=qs['sort'](_0x235082[_0xb18a('0x41')][_0xb18a('0x44')]);_0x701688['where']=qs[_0xb18a('0x3d')](_[_0xb18a('0x45')](_0x235082[_0xb18a('0x41')],_0x392d48[_0xb18a('0x3d')]),_0x31fa69);if(_0x235082[_0xb18a('0x41')][_0xb18a('0x46')]){_0x701688[_0xb18a('0x47')]=_['merge'](_0x701688[_0xb18a('0x47')],{'$or':_[_0xb18a('0x36')](_0x31fa69,function(_0x42d0bb){if(_0x42d0bb[_0xb18a('0x3a')]!==_0xb18a('0x48')){var _0x415466={};_0x415466[_0x42d0bb[_0xb18a('0x34')]]={'$like':'%'+_0x235082['query'][_0xb18a('0x46')]+'%'};return _0x415466;}})});}_0x701688=_[_0xb18a('0x49')]({},_0x701688,_0x235082[_0xb18a('0x4a')]);var _0x4fd750={'where':_0x701688[_0xb18a('0x47')]};return db['Network']['count'](_0x4fd750)['then'](function(_0x389c64){_0x90a382[_0xb18a('0x2b')]=_0x389c64;if(_0x235082[_0xb18a('0x41')][_0xb18a('0x4b')]){_0x701688[_0xb18a('0x4c')]=[{'all':!![]}];}return db['Network'][_0xb18a('0x4d')](_0x701688);})['then'](function(_0x3842a){_0x90a382[_0xb18a('0x4e')]=_0x3842a;return _0x90a382;})['then'](respondWithFilteredResult(_0x10a532,_0x701688))[_0xb18a('0x25')](handleError(_0x10a532,null));};exports['show']=function(_0x2fb2f3,_0x1614be){var _0x1a3438={'raw':!![],'where':{'id':_0x2fb2f3['params']['id']}},_0x5ab728={};_0x5ab728[_0xb18a('0x3b')]=_[_0xb18a('0x3c')](db[_0xb18a('0x37')][_0xb18a('0x38')]);_0x5ab728['query']=_['keys'](_0x2fb2f3['query']);_0x5ab728['filters']=_[_0xb18a('0x3e')](_0x5ab728[_0xb18a('0x3b')],_0x5ab728[_0xb18a('0x41')]);_0x1a3438[_0xb18a('0x3f')]=_[_0xb18a('0x3e')](_0x5ab728[_0xb18a('0x3b')],qs[_0xb18a('0x40')](_0x2fb2f3[_0xb18a('0x41')][_0xb18a('0x40')]));_0x1a3438[_0xb18a('0x3f')]=_0x1a3438[_0xb18a('0x3f')][_0xb18a('0x42')]?_0x1a3438[_0xb18a('0x3f')]:_0x5ab728[_0xb18a('0x3b')];if(_0x2fb2f3[_0xb18a('0x41')][_0xb18a('0x4b')]){_0x1a3438['include']=[{'all':!![]}];}_0x1a3438=_[_0xb18a('0x49')]({},_0x1a3438,_0x2fb2f3[_0xb18a('0x4a')]);return db[_0xb18a('0x37')][_0xb18a('0x4f')](_0x1a3438)[_0xb18a('0x1b')](handleEntityNotFound(_0x1614be,null))[_0xb18a('0x1b')](respondWithResult(_0x1614be,null))['catch'](handleError(_0x1614be,null));};exports[_0xb18a('0x50')]=function(_0x1f5d56,_0x43a0e3,_0x488a29){var _0xe828aa;return db['sequelize'][_0xb18a('0x51')](function(_0x449033){return db[_0xb18a('0x37')]['create'](_0x1f5d56[_0xb18a('0x52')],{'raw':!![]})['then'](function(_0x16e380){_0xe828aa=_0x16e380;return db[_0xb18a('0x37')][_0xb18a('0x4d')]({'where':{'type':_0x1f5d56[_0xb18a('0x52')][_0xb18a('0x3a')]},'raw':!![]});})[_0xb18a('0x1b')](function(_0x41e8e3){if(_0xe828aa['type'][_0xb18a('0x53')]()==_0xb18a('0x54')){var _0x92d0d0=fs[_0xb18a('0x55')](path['join'](config[_0xb18a('0x56')],_0xb18a('0x57')),_0xb18a('0x58'));var _0x55807a=ejs[_0xb18a('0x59')](_0x92d0d0,{'networks':_0x41e8e3||[]});fs[_0xb18a('0x5a')](_0xb18a('0x5b'),_0x55807a);return respondWithRpcPromise('Reload',_0xb18a('0x50'),{'module':_0xb18a('0x5c')});}else if(_0xe828aa[_0xb18a('0x3a')]['toUpperCase']()=='TURN'){var _0x4baf68=fs[_0xb18a('0x55')](path[_0xb18a('0x5d')](config[_0xb18a('0x56')],_0xb18a('0x5e')),_0xb18a('0x58'));var _0x21b7fd=ejs[_0xb18a('0x59')](_0x4baf68,{'networks':_0x41e8e3||[]});fs[_0xb18a('0x5a')](_0xb18a('0x5f'),_0x21b7fd);return respondWithRpcPromise(_0xb18a('0x60'),'create',{'module':_0xb18a('0x5c')});}else{var _0x38f434=fs[_0xb18a('0x55')](path['join'](config['root'],_0xb18a('0x61')),_0xb18a('0x58'));var _0x49368c=ejs[_0xb18a('0x59')](_0x38f434,{'networks':_0x41e8e3||[]});fs['writeFileSync'](util[_0xb18a('0x62')](_0xb18a('0x63'),_0x1f5d56[_0xb18a('0x52')][_0xb18a('0x3a')][_0xb18a('0x64')]()),_0x49368c);return respondWithRpcPromise(_0xb18a('0x60'),_0xb18a('0x50'),{'module':'chan_sip.so'});}return null;})[_0xb18a('0x1b')](function(){return _0xe828aa;});})['then'](respondWithResult(_0x43a0e3,0xc9))[_0xb18a('0x25')](handleError(_0x43a0e3,null));};exports[_0xb18a('0x31')]=function(_0x6ea59b,_0x3af943,_0x5169d4){var _0x243c92;return db[_0xb18a('0x65')][_0xb18a('0x51')](function(_0x53af2d){return db[_0xb18a('0x37')][_0xb18a('0x4f')]({'where':{'id':_0x6ea59b['params']['id']}})['then'](handleEntityNotFound(_0x3af943,null))[_0xb18a('0x1b')](saveUpdates(_0x6ea59b[_0xb18a('0x52')],null))['then'](function(_0x3b567c){if(_0x3b567c){_0x243c92=_0x3b567c;return db[_0xb18a('0x37')][_0xb18a('0x4d')]({'where':{'type':_0x243c92['type']},'raw':!![]});}return null;})[_0xb18a('0x1b')](function(_0x5145f1){if(_0x243c92['type'][_0xb18a('0x53')]()=='STUN'){var _0x40fb02=fs[_0xb18a('0x55')](path[_0xb18a('0x5d')](config[_0xb18a('0x56')],'server/files/templates/stun_multiple.ejs'),_0xb18a('0x58'));var _0x4f9493=ejs['render'](_0x40fb02,{'networks':_0x5145f1||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4f9493);return respondWithRpcPromise(_0xb18a('0x60'),_0xb18a('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x243c92[_0xb18a('0x3a')][_0xb18a('0x53')]()=='TURN'){var _0x1bd261=fs[_0xb18a('0x55')](path[_0xb18a('0x5d')](config[_0xb18a('0x56')],_0xb18a('0x5e')),_0xb18a('0x58'));var _0x4a6437=ejs[_0xb18a('0x59')](_0x1bd261,{'networks':_0x5145f1||[]});fs['writeFileSync'](_0xb18a('0x5f'),_0x4a6437);return respondWithRpcPromise(_0xb18a('0x60'),_0xb18a('0x31'),{'module':_0xb18a('0x5c')});}else{var _0x18813f=fs[_0xb18a('0x55')](path['join'](config[_0xb18a('0x56')],_0xb18a('0x61')),_0xb18a('0x58'));var _0x4091aa=ejs[_0xb18a('0x59')](_0x18813f,{'networks':_0x5145f1||[]});fs['writeFileSync'](util[_0xb18a('0x62')](_0xb18a('0x63'),_0x6ea59b[_0xb18a('0x52')]['type'][_0xb18a('0x64')]()),_0x4091aa);return respondWithRpcPromise('Reload',_0xb18a('0x31'),{'module':_0xb18a('0x66')});}return null;})[_0xb18a('0x1b')](function(_0x366a2f){if(_0x366a2f){return _0x243c92;}return null;});})[_0xb18a('0x1b')](respondWithResult(_0x3af943,null))[_0xb18a('0x25')](handleError(_0x3af943,null));};exports[_0xb18a('0x32')]=function(_0x469729,_0x3849ba,_0x55b052){var _0x28cb5f;return db['Network'][_0xb18a('0x4f')]({'where':{'id':_0x469729[_0xb18a('0x67')]['id']}})[_0xb18a('0x1b')](function(_0x3cb649){_0x28cb5f=_0x3cb649;return _0x3cb649;})[_0xb18a('0x1b')](handleEntityNotFound(_0x3849ba,null))[_0xb18a('0x1b')](removeEntity(_0x3849ba,null))[_0xb18a('0x1b')](function(){if(_0x28cb5f){return db[_0xb18a('0x37')][_0xb18a('0x4d')]({'where':{'type':_0x28cb5f['type']},'raw':!![]});}})[_0xb18a('0x1b')](function(_0x552cdf){if(_0x28cb5f[_0xb18a('0x3a')]['toUpperCase']()==_0xb18a('0x54')){var _0x5cda88=fs['readFileSync'](path[_0xb18a('0x5d')](config['root'],_0xb18a('0x57')),_0xb18a('0x58'));var _0x520869=ejs[_0xb18a('0x59')](_0x5cda88,{'networks':_0x552cdf||[]});fs[_0xb18a('0x5a')](_0xb18a('0x5b'),_0x520869);return respondWithRpcPromise(_0xb18a('0x60'),_0xb18a('0x32'),{'module':_0xb18a('0x5c')});}else if(_0x28cb5f[_0xb18a('0x3a')][_0xb18a('0x53')]()==_0xb18a('0x68')){var _0x5b5c02=fs[_0xb18a('0x55')](path['join'](config[_0xb18a('0x56')],_0xb18a('0x5e')),_0xb18a('0x58'));var _0xfdf61b=ejs['render'](_0x5b5c02,{'networks':_0x552cdf||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xfdf61b);return respondWithRpcPromise(_0xb18a('0x60'),'destroy',{'module':_0xb18a('0x5c')});}else{var _0x420634=fs[_0xb18a('0x55')](path[_0xb18a('0x5d')](config[_0xb18a('0x56')],_0xb18a('0x61')),_0xb18a('0x58'));var _0x5ef4a6=ejs['render'](_0x420634,{'networks':_0x552cdf||[]});fs['writeFileSync'](util['format'](_0xb18a('0x63'),_0x469729['body'][_0xb18a('0x3a')][_0xb18a('0x64')]()),_0x5ef4a6);return respondWithRpcPromise(_0xb18a('0x60'),_0xb18a('0x32'),{'module':_0xb18a('0x66')});}return null;})[_0xb18a('0x25')](handleError(_0x3849ba,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a29f86b..139ddf0 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 _0x8ce3=['./network.attributes','Network','network','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24dbd2,_0x301ea6){var _0x5c6153=function(_0x2fbe33){while(--_0x2fbe33){_0x24dbd2['push'](_0x24dbd2['shift']());}};_0x5c6153(++_0x301ea6);}(_0x8ce3,0xc3));var _0x38ce=function(_0x4b2993,_0xd46430){_0x4b2993=_0x4b2993-0x0;var _0x480074=_0x8ce3[_0x4b2993];return _0x480074;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dca17,_0x1186ca){var _0x314bb1=function(_0x49f3b6){while(--_0x49f3b6){_0x2dca17['push'](_0x2dca17['shift']());}};_0x314bb1(++_0x1186ca);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),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 0ff98d0..46c35ff 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x18fe30,_0x3bfe7a){_0x18fe30=_0x18fe30-0x0;var _0x194ee9=_0x7a54[_0x18fe30];return _0x194ee9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x55a435,_0x44e932){_0x55a435=_0x55a435-0x0;var _0x1a909b=_0x7a54[_0x55a435];return _0x1a909b;};'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 bce27ce..a2ca954 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 _0xd5bc=['../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','getAgents','create','addDisposition','addAnswer','post','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','update','/:id','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5de754,_0x277417){var _0x404421=function(_0x310e7a){while(--_0x310e7a){_0x5de754['push'](_0x5de754['shift']());}};_0x404421(++_0x277417);}(_0xd5bc,0x74));var _0xcd5b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd5bc[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcd5b('0x0'));var util=require(_0xcd5b('0x1'));var path=require(_0xcd5b('0x2'));var timeout=require(_0xcd5b('0x3'));var express=require(_0xcd5b('0x4'));var router=express[_0xcd5b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd5b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd5b('0x7'));var controller=require(_0xcd5b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd5b('0x9')]);router[_0xcd5b('0xa')](_0xcd5b('0xb'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0xd')]);router[_0xcd5b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcd5b('0xe')]);router[_0xcd5b('0xa')](_0xcd5b('0xf'),auth['isAuthenticated'](),controller[_0xcd5b('0x10')]);router[_0xcd5b('0xa')]('/:id/canned_answers',auth[_0xcd5b('0xc')](),controller['getAnswers']);router['get'](_0xcd5b('0x11'),auth['isAuthenticated'](),controller[_0xcd5b('0x12')]);router[_0xcd5b('0xa')]('/:id/interactions',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x13')]);router[_0xcd5b('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xcd5b('0x14')]);router['post']('/',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x15')]);router['post'](_0xcd5b('0xf'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x16')]);router['post']('/:id/canned_answers',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x17')]);router[_0xcd5b('0x18')](_0xcd5b('0x19'),controller[_0xcd5b('0x1a')]);router['post'](_0xcd5b('0x11'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x1b')]);router[_0xcd5b('0x18')](_0xcd5b('0x1c'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x1d')]);router['post'](_0xcd5b('0x1e'),auth['isAuthenticated'](),controller[_0xcd5b('0x1f')]);router['put']('/:id',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x20')]);router['delete'](_0xcd5b('0x21'),auth['isAuthenticated'](),controller[_0xcd5b('0x22')]);router[_0xcd5b('0x23')](_0xcd5b('0xf'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x24')]);router['delete'](_0xcd5b('0x25'),auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x26')]);router['delete']('/:id/users',auth[_0xcd5b('0xc')](),controller[_0xcd5b('0x27')]);module[_0xcd5b('0x28')]=router; \ No newline at end of file +var _0x53de=['addAnswer','notify','addApplications','addAgents','/:id/send','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/users','post','create','addDisposition'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x53de,0x18c));var _0xe53d=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x53de[_0x5f519b];return _0x2461e2;};'use strict';var multer=require('multer');var util=require(_0xe53d('0x0'));var path=require(_0xe53d('0x1'));var timeout=require(_0xe53d('0x2'));var express=require(_0xe53d('0x3'));var router=express[_0xe53d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe53d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xe53d('0x6')]('/',auth[_0xe53d('0x7')](),controller[_0xe53d('0x8')]);router[_0xe53d('0x6')]('/describe',auth[_0xe53d('0x7')](),controller['describe']);router[_0xe53d('0x6')](_0xe53d('0x9'),auth[_0xe53d('0x7')](),controller[_0xe53d('0xa')]);router['get'](_0xe53d('0xb'),auth[_0xe53d('0x7')](),controller[_0xe53d('0xc')]);router[_0xe53d('0x6')]('/:id/canned_answers',auth[_0xe53d('0x7')](),controller[_0xe53d('0xd')]);router['get'](_0xe53d('0xe'),auth[_0xe53d('0x7')](),controller[_0xe53d('0xf')]);router[_0xe53d('0x6')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xe53d('0x6')](_0xe53d('0x10'),auth[_0xe53d('0x7')](),controller['getAgents']);router[_0xe53d('0x11')]('/',auth['isAuthenticated'](),controller[_0xe53d('0x12')]);router[_0xe53d('0x11')](_0xe53d('0xb'),auth[_0xe53d('0x7')](),controller[_0xe53d('0x13')]);router[_0xe53d('0x11')]('/:id/canned_answers',auth[_0xe53d('0x7')](),controller[_0xe53d('0x14')]);router['post']('/:id/notify',controller[_0xe53d('0x15')]);router[_0xe53d('0x11')](_0xe53d('0xe'),auth['isAuthenticated'](),controller[_0xe53d('0x16')]);router[_0xe53d('0x11')](_0xe53d('0x10'),auth['isAuthenticated'](),controller[_0xe53d('0x17')]);router[_0xe53d('0x11')](_0xe53d('0x18'),auth[_0xe53d('0x7')](),controller['send']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe53d('0x19')]('/:id',auth[_0xe53d('0x7')](),controller[_0xe53d('0x1a')]);router[_0xe53d('0x19')](_0xe53d('0xb'),auth[_0xe53d('0x7')](),controller[_0xe53d('0x1b')]);router[_0xe53d('0x19')](_0xe53d('0x1c'),auth['isAuthenticated'](),controller[_0xe53d('0x1d')]);router[_0xe53d('0x19')](_0xe53d('0x10'),auth[_0xe53d('0x7')](),controller[_0xe53d('0x1e')]);module[_0xe53d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 14e6aaa..0a85c69 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 _0x22e9=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x1ee81d,_0x492ff9){var _0x24e22d=function(_0x4cee2c){while(--_0x4cee2c){_0x1ee81d['push'](_0x1ee81d['shift']());}};_0x24e22d(++_0x492ff9);}(_0x22e9,0xad));var _0x922e=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0x22e9[_0x2e249d];return _0x1faa37;};'use strict';var Sequelize=require(_0x922e('0x0'));var rs=require(_0x922e('0x1'));module[_0x922e('0x2')]={'name':{'type':Sequelize[_0x922e('0x3')],'unique':_0x922e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x922e('0x3')]},'token':{'type':Sequelize[_0x922e('0x3')],'defaultValue':function(){return rs[_0x922e('0x5')]();}},'replyUri':{'type':Sequelize[_0x922e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x922e('0x3')],'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[_0x922e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x922e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x922e('0x3')]},'queueTransfer':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x922e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x922e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x922e('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x922e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x922e('0x6')],'defaultValue':![],'comment':_0x922e('0x9'),'set':function(_0x4deed4){if(!_0x4deed4)this[_0x922e('0xa')](_0x922e('0xb'),null);this[_0x922e('0xa')](_0x922e('0xc'),_0x4deed4);}}}; \ No newline at end of file +var _0xdd81=['STRING','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','sequelize','exports'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xdd81,0x116));var _0x1dd8=function(_0x1502ca,_0x29ac7e){_0x1502ca=_0x1502ca-0x0;var _0x367563=_0xdd81[_0x1502ca];return _0x367563;};'use strict';var Sequelize=require(_0x1dd8('0x0'));var rs=require('randomstring');module[_0x1dd8('0x1')]={'name':{'type':Sequelize[_0x1dd8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1dd8('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x1dd8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1dd8('0x3');}},'notificationSound':{'type':Sequelize[_0x1dd8('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1dd8('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1dd8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1dd8('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1dd8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1dd8('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1dd8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1dd8('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x1dd8('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x1dd8('0x4')],'defaultValue':![],'comment':_0x1dd8('0x7'),'set':function(_0x3cc02a){if(!_0x3cc02a)this[_0x1dd8('0x8')](_0x1dd8('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x3cc02a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f6898d6..e1e23b9 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 _0x2ce2=['name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','keys','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','create','getDispositions','hasOwnProperty','Disposition','count','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','Contacts','from','ListId','contact','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','close','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','internal','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','get','OpenchannelAccounts','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map'];(function(_0x3fe68c,_0x5cca7c){var _0x71adc0=function(_0x3a32c4){while(--_0x3a32c4){_0x3fe68c['push'](_0x3fe68c['shift']());}};_0x71adc0(++_0x5cca7c);}(_0x2ce2,0x74));var _0x22ce=function(_0x1658ad,_0x487c1f){_0x1658ad=_0x1658ad-0x0;var _0x3b1927=_0x2ce2[_0x1658ad];return _0x3b1927;};'use strict';var emlformat=require(_0x22ce('0x0'));var rimraf=require(_0x22ce('0x1'));var zipdir=require(_0x22ce('0x2'));var jsonpatch=require(_0x22ce('0x3'));var rp=require(_0x22ce('0x4'));var moment=require(_0x22ce('0x5'));var BPromise=require(_0x22ce('0x6'));var Mustache=require(_0x22ce('0x7'));var util=require(_0x22ce('0x8'));var path=require(_0x22ce('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22ce('0xa'));var _=require('lodash');var squel=require(_0x22ce('0xb'));var crypto=require(_0x22ce('0xc'));var jsforce=require(_0x22ce('0xd'));var deskjs=require(_0x22ce('0xe'));var toCsv=require(_0x22ce('0xf'));var querystring=require(_0x22ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x22ce('0x11'));var authService=require(_0x22ce('0x12'));var qs=require(_0x22ce('0x13'));var as=require(_0x22ce('0x14'));var hardwareService=require(_0x22ce('0x15'));var logger=require(_0x22ce('0x16'))(_0x22ce('0x17'));var utils=require(_0x22ce('0x18'));var config=require(_0x22ce('0x19'));var licenseUtil=require(_0x22ce('0x1a'));var db=require(_0x22ce('0x1b'))['db'];config[_0x22ce('0x1c')]=_[_0x22ce('0x1d')](config[_0x22ce('0x1c')],{'host':_0x22ce('0x1e'),'port':0x18eb});var socket=require(_0x22ce('0x1f'))(new Redis(config[_0x22ce('0x1c')]));require(_0x22ce('0x20'))[_0x22ce('0x21')](socket);var jayson=require(_0x22ce('0x22'));var client=jayson[_0x22ce('0x23')][_0x22ce('0x24')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294ea2,_0xbcda04,_0x345f2f,_0x4fc7e2){return new BPromise(function(_0x4437d6,_0x5566ee){var _0x1d0fd0=_0x4fc7e2||client;return _0x1d0fd0[_0x22ce('0x25')](_0x294ea2,_0x345f2f)['then'](function(_0x26ca5b){logger[_0x22ce('0x26')](_0x22ce('0x27'),_0xbcda04,_0x22ce('0x28'));logger[_0x22ce('0x29')](_0x22ce('0x2a'),_0xbcda04,_0x22ce('0x28'),JSON[_0x22ce('0x2b')](_0x26ca5b));if(_0x26ca5b['error']){if(_0x26ca5b[_0x22ce('0x2c')][_0x22ce('0x2d')]===0x1f4){logger['error'](_0x22ce('0x27'),_0xbcda04,_0x26ca5b[_0x22ce('0x2c')][_0x22ce('0x2e')]);return _0x5566ee(_0x26ca5b[_0x22ce('0x2c')][_0x22ce('0x2e')]);}logger[_0x22ce('0x2c')](_0x22ce('0x27'),_0xbcda04,_0x26ca5b[_0x22ce('0x2c')]['message']);return _0x4437d6(_0x26ca5b[_0x22ce('0x2c')]['message']);}else{logger[_0x22ce('0x26')](_0x22ce('0x27'),_0xbcda04,'request\x20sent');_0x4437d6(_0x26ca5b[_0x22ce('0x2f')][_0x22ce('0x2e')]);}})[_0x22ce('0x30')](function(_0x47192b){logger[_0x22ce('0x2c')](_0x22ce('0x27'),_0xbcda04,_0x47192b);_0x5566ee(_0x47192b);});});}function respondWithStatusCode(_0x5c009e,_0x2c4c8f){_0x2c4c8f=_0x2c4c8f||0xcc;return function(_0x1820d8){if(_0x1820d8){return _0x5c009e[_0x22ce('0x31')](_0x2c4c8f);}return _0x5c009e['status'](_0x2c4c8f)[_0x22ce('0x32')]();};}function respondWithResult(_0x58213e,_0x467be7){_0x467be7=_0x467be7||0xc8;return function(_0x5a826e){if(_0x5a826e){return _0x58213e[_0x22ce('0x33')](_0x467be7)[_0x22ce('0x34')](_0x5a826e);}};}function respondWithFilteredResult(_0x5f5d2a,_0x3a1f39){return function(_0x4fe2e6){if(_0x4fe2e6){var _0x143c9c=typeof _0x3a1f39[_0x22ce('0x35')]===_0x22ce('0x36')&&typeof _0x3a1f39[_0x22ce('0x37')]==='undefined';var _0x4059e1=_0x4fe2e6['count'];var _0x136e5f=_0x143c9c?0x0:_0x3a1f39['offset'];var _0x209250=_0x143c9c?_0x4fe2e6['count']:_0x3a1f39[_0x22ce('0x35')]+_0x3a1f39[_0x22ce('0x37')];var _0x3f53c2;if(_0x209250>=_0x4059e1){_0x209250=_0x4059e1;_0x3f53c2=0xc8;}else{_0x3f53c2=0xce;}_0x5f5d2a[_0x22ce('0x33')](_0x3f53c2);return _0x5f5d2a[_0x22ce('0x38')]('Content-Range',_0x136e5f+'-'+_0x209250+'/'+_0x4059e1)['json'](_0x4fe2e6);}return null;};}function patchUpdates(_0x1a13c7){return function(_0x606f7b){try{jsonpatch[_0x22ce('0x39')](_0x606f7b,_0x1a13c7,!![]);}catch(_0x9a9fc){return BPromise[_0x22ce('0x3a')](_0x9a9fc);}return _0x606f7b[_0x22ce('0x3b')]();};}function saveUpdates(_0x2b9803,_0x52b4fe){return function(_0x8a9e15){if(_0x8a9e15){return _0x8a9e15[_0x22ce('0x3c')](_0x2b9803)['then'](function(_0x15354f){return _0x15354f;});}return null;};}function removeEntity(_0x4ddbee,_0x1e3424){return function(_0x47f91b){if(_0x47f91b){return _0x47f91b[_0x22ce('0x3d')]()[_0x22ce('0x3e')](function(){var _0x1a43e8=_0x47f91b[_0x22ce('0x3f')]({'plain':!![]});var _0x1ecaba=_0x22ce('0x40');return db[_0x22ce('0x41')][_0x22ce('0x3d')]({'where':{'type':_0x1ecaba,'resourceId':_0x1a43e8['id']}})['then'](function(){return _0x47f91b;});})[_0x22ce('0x3e')](function(){_0x4ddbee[_0x22ce('0x33')](0xcc)[_0x22ce('0x32')]();});}};}function handleEntityNotFound(_0x51fc97,_0x1321db){return function(_0x2a1044){if(!_0x2a1044){_0x51fc97['sendStatus'](0x194);}return _0x2a1044;};}function handleError(_0x5372e0,_0x4020e9){_0x4020e9=_0x4020e9||0x1f4;return function(_0x420f08){logger[_0x22ce('0x2c')](_0x420f08[_0x22ce('0x42')]);if(_0x420f08['name']){delete _0x420f08['name'];}_0x5372e0[_0x22ce('0x33')](_0x4020e9)[_0x22ce('0x43')](_0x420f08);};}exports['index']=function(_0x3fa0ee,_0x2850fc){var _0x17f98c={'include':[{'model':db[_0x22ce('0x44')],'as':_0x22ce('0x45')}]},_0x9f07ab={},_0x1a0d6d={'count':0x0,'rows':[]};var _0x4f45b3=_['map'](db[_0x22ce('0x46')][_0x22ce('0x47')],function(_0x5a4aad){return{'name':_0x5a4aad[_0x22ce('0x48')],'type':_0x5a4aad[_0x22ce('0x49')][_0x22ce('0x4a')]};});_0x9f07ab[_0x22ce('0x4b')]=_[_0x22ce('0x4c')](_0x4f45b3,_0x22ce('0x4d'));_0x9f07ab['query']=_['keys'](_0x3fa0ee[_0x22ce('0x4e')]);_0x9f07ab[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x9f07ab['model'],_0x9f07ab[_0x22ce('0x4e')]);_0x17f98c[_0x22ce('0x51')]=_[_0x22ce('0x50')](_0x9f07ab[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x3fa0ee[_0x22ce('0x4e')]['fields']));_0x17f98c[_0x22ce('0x51')]=_0x17f98c['attributes'][_0x22ce('0x53')]?_0x17f98c[_0x22ce('0x51')]:_0x9f07ab[_0x22ce('0x4b')];if(!_0x3fa0ee['query']['hasOwnProperty'](_0x22ce('0x54'))){_0x17f98c[_0x22ce('0x37')]=qs[_0x22ce('0x37')](_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x37')]);_0x17f98c[_0x22ce('0x35')]=qs[_0x22ce('0x35')](_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x35')]);}_0x17f98c[_0x22ce('0x55')]=qs[_0x22ce('0x56')](_0x3fa0ee['query'][_0x22ce('0x56')]);_0x17f98c['where']=qs['filters'](_[_0x22ce('0x57')](_0x3fa0ee['query'],_0x9f07ab[_0x22ce('0x4f')]),_0x4f45b3);if(_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x17f98c[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x17f98c[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x4f45b3,function(_0x195b52){if(_0x195b52[_0x22ce('0x49')]!==_0x22ce('0x5b')){var _0x149616={};_0x149616[_0x195b52[_0x22ce('0x4d')]]={'$like':'%'+_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x149616;}})});}_0x17f98c=_[_0x22ce('0x5a')]({},_0x17f98c,_0x3fa0ee[_0x22ce('0x5c')]);var _0x34d4f3={'where':_0x17f98c[_0x22ce('0x59')]};return db['OpenchannelAccount']['count'](_0x34d4f3)[_0x22ce('0x3e')](function(_0x369e70){_0x1a0d6d['count']=_0x369e70;if(_0x3fa0ee[_0x22ce('0x4e')][_0x22ce('0x5d')]){_0x17f98c['include']=[{'all':!![]}];}return db[_0x22ce('0x46')]['findAll'](_0x17f98c);})[_0x22ce('0x3e')](function(_0x352b76){_0x1a0d6d[_0x22ce('0x5e')]=_0x352b76;return _0x1a0d6d;})[_0x22ce('0x3e')](respondWithFilteredResult(_0x2850fc,_0x17f98c))[_0x22ce('0x30')](handleError(_0x2850fc,null));};exports[_0x22ce('0x5f')]=function(_0x21fe5a,_0x59c0d0){var _0x4fc1e7={'raw':![],'where':{'id':_0x21fe5a['params']['id']},'include':[{'model':db['Pause'],'as':_0x22ce('0x45')}]},_0x4a276d={};_0x4a276d[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0x46')][_0x22ce('0x47')]);_0x4a276d[_0x22ce('0x4e')]=_['keys'](_0x21fe5a[_0x22ce('0x4e')]);_0x4a276d[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x4a276d[_0x22ce('0x4b')],_0x4a276d['query']);_0x4fc1e7[_0x22ce('0x51')]=_[_0x22ce('0x50')](_0x4a276d[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x21fe5a[_0x22ce('0x4e')]['fields']));_0x4fc1e7[_0x22ce('0x51')]=_0x4fc1e7['attributes']['length']?_0x4fc1e7[_0x22ce('0x51')]:_0x4a276d[_0x22ce('0x4b')];if(_0x21fe5a[_0x22ce('0x4e')][_0x22ce('0x5d')]){_0x4fc1e7[_0x22ce('0x61')]=[{'all':!![]}];}_0x4fc1e7=_[_0x22ce('0x5a')]({},_0x4fc1e7,_0x21fe5a[_0x22ce('0x5c')]);return db[_0x22ce('0x46')][_0x22ce('0x62')](_0x4fc1e7)[_0x22ce('0x3e')](handleEntityNotFound(_0x59c0d0,null))[_0x22ce('0x3e')](respondWithResult(_0x59c0d0,null))[_0x22ce('0x30')](handleError(_0x59c0d0,null));};exports['create']=function(_0x2a7965,_0x2f58d0){return db['OpenchannelAccount']['create'](_0x2a7965[_0x22ce('0x63')],{})['then'](function(_0x3e030e){var _0x236ec3=_0x2a7965['user'][_0x22ce('0x3f')]({'plain':!![]});if(!_0x236ec3)throw new Error(_0x22ce('0x64'));if(_0x236ec3['role']===_0x22ce('0x65')){var _0xdf609d=_0x3e030e['get']({'plain':!![]});var _0x3da212=_0x22ce('0x40');return db['UserProfileSection'][_0x22ce('0x62')]({'where':{'name':_0x3da212,'userProfileId':_0x236ec3[_0x22ce('0x66')]},'raw':!![]})[_0x22ce('0x3e')](function(_0x5d5f01){if(_0x5d5f01&&_0x5d5f01[_0x22ce('0x67')]===0x0){return db['UserProfileResource']['create']({'name':_0xdf609d['name'],'resourceId':_0xdf609d['id'],'type':_0x5d5f01[_0x22ce('0x4d')],'sectionId':_0x5d5f01['id']},{})[_0x22ce('0x3e')](function(){return _0x3e030e;});}else{return _0x3e030e;}})['catch'](function(_0x6829e4){logger['error'](_0x22ce('0x68'),_0x6829e4);throw _0x6829e4;});}return _0x3e030e;})[_0x22ce('0x3e')](respondWithResult(_0x2f58d0,0xc9))['catch'](handleError(_0x2f58d0,null));};exports[_0x22ce('0x3c')]=function(_0x4d9eaa,_0x4f99ef){if(_0x4d9eaa[_0x22ce('0x63')]['id']){delete _0x4d9eaa['body']['id'];}return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x4d9eaa[_0x22ce('0x69')]['id']},'include':[{'model':db[_0x22ce('0x44')],'as':_0x22ce('0x45')}]})[_0x22ce('0x3e')](handleEntityNotFound(_0x4f99ef,null))[_0x22ce('0x3e')](saveUpdates(_0x4d9eaa[_0x22ce('0x63')],null))['then'](respondWithResult(_0x4f99ef,null))['catch'](handleError(_0x4f99ef,null));};exports[_0x22ce('0x3d')]=function(_0x1848e2,_0x45c879){return db[_0x22ce('0x46')][_0x22ce('0x62')]({'where':{'id':_0x1848e2[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x45c879,null))[_0x22ce('0x3e')](removeEntity(_0x45c879,null))[_0x22ce('0x30')](handleError(_0x45c879,null));};exports[_0x22ce('0x6a')]=function(_0x484c4e,_0x21f165){return db[_0x22ce('0x46')][_0x22ce('0x6a')]()[_0x22ce('0x3e')](respondWithResult(_0x21f165,null))['catch'](handleError(_0x21f165,null));};exports[_0x22ce('0x6b')]=function(_0x359ea5,_0x4b184f,_0x4202f8){if(_0x359ea5[_0x22ce('0x63')]['id']){delete _0x359ea5['body']['id'];}return db[_0x22ce('0x46')][_0x22ce('0x62')]({'where':{'id':_0x359ea5[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x4b184f,null))['then'](function(_0x309693){if(_0x309693){_0x359ea5[_0x22ce('0x63')][_0x22ce('0x6c')]=_0x309693['id'];return db['Disposition'][_0x22ce('0x6d')](_0x359ea5['body']);}})['then'](respondWithResult(_0x4b184f,null))[_0x22ce('0x30')](handleError(_0x4b184f,null));};exports[_0x22ce('0x6e')]=function(_0x7e72cd,_0x163a97,_0x1d23f2){var _0x5eef07={'raw':![],'where':{}};var _0x57dfa8={};var _0x342a34={'count':0x0,'rows':[]};return db[_0x22ce('0x46')]['findOne']({'where':{'id':_0x7e72cd['params']['id']}})['then'](handleEntityNotFound(_0x163a97,null))[_0x22ce('0x3e')](function(_0x4cdf13){if(_0x4cdf13){_0x57dfa8[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db['Disposition'][_0x22ce('0x47')]);_0x57dfa8[_0x22ce('0x4e')]=_[_0x22ce('0x60')](_0x7e72cd[_0x22ce('0x4e')]);_0x57dfa8[_0x22ce('0x4f')]=_['intersection'](_0x57dfa8[_0x22ce('0x4b')],_0x57dfa8[_0x22ce('0x4e')]);_0x5eef07['attributes']=_[_0x22ce('0x50')](_0x57dfa8['model'],qs['fields'](_0x7e72cd['query'][_0x22ce('0x52')]));_0x5eef07[_0x22ce('0x51')]=_0x5eef07[_0x22ce('0x51')]['length']?_0x5eef07[_0x22ce('0x51')]:_0x57dfa8[_0x22ce('0x4b')];if(!_0x7e72cd['query'][_0x22ce('0x6f')](_0x22ce('0x54'))){_0x5eef07['limit']=qs[_0x22ce('0x37')](_0x7e72cd[_0x22ce('0x4e')]['limit']);_0x5eef07['offset']=qs[_0x22ce('0x35')](_0x7e72cd['query'][_0x22ce('0x35')]);}_0x5eef07[_0x22ce('0x55')]=qs[_0x22ce('0x56')](_0x7e72cd[_0x22ce('0x4e')]['sort']);_0x5eef07[_0x22ce('0x59')]=qs[_0x22ce('0x4f')](_[_0x22ce('0x57')](_0x7e72cd['query'],_0x57dfa8[_0x22ce('0x4f')]));_0x5eef07[_0x22ce('0x59')][_0x22ce('0x6c')]=_0x4cdf13['id'];if(_0x7e72cd[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x5eef07[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x5eef07[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x5eef07['attributes'],function(_0x2f83ec){var _0x49e5b6={};_0x49e5b6[_0x2f83ec]={'$like':'%'+_0x7e72cd[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x49e5b6;})});}_0x5eef07=_['merge']({},_0x5eef07,_0x7e72cd[_0x22ce('0x5c')]);return db[_0x22ce('0x70')][_0x22ce('0x71')]({'where':_0x5eef07[_0x22ce('0x59')]})[_0x22ce('0x3e')](function(_0x3c5dfe){_0x342a34[_0x22ce('0x71')]=_0x3c5dfe;if(_0x7e72cd['query'][_0x22ce('0x5d')]){_0x5eef07['include']=[{'all':!![]}];}return db[_0x22ce('0x70')][_0x22ce('0x72')](_0x5eef07);})['then'](function(_0x22937c){_0x342a34[_0x22ce('0x5e')]=_0x22937c;return _0x342a34;});}})['then'](respondWithFilteredResult(_0x163a97,_0x5eef07))[_0x22ce('0x30')](handleError(_0x163a97,null));};exports['removeDispositions']=function(_0x866d,_0x5610e8,_0x20e208){return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x866d[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x5610e8,null))['then'](function(_0x2c4ad4){if(_0x2c4ad4){return _0x2c4ad4[_0x22ce('0x73')](_0x866d['query'][_0x22ce('0x74')]);}})[_0x22ce('0x3e')](respondWithStatusCode(_0x5610e8,null))[_0x22ce('0x30')](handleError(_0x5610e8,null));};exports[_0x22ce('0x75')]=function(_0x597951,_0x42a542,_0x1d7764){if(_0x597951[_0x22ce('0x63')]['id']){delete _0x597951['body']['id'];}return db[_0x22ce('0x46')][_0x22ce('0x62')]({'where':{'id':_0x597951[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x42a542,null))['then'](function(_0x149f1f){if(_0x149f1f){_0x597951['body'][_0x22ce('0x6c')]=_0x149f1f['id'];return db[_0x22ce('0x76')]['create'](_0x597951[_0x22ce('0x63')]);}})[_0x22ce('0x3e')](respondWithResult(_0x42a542,null))['catch'](handleError(_0x42a542,null));};exports[_0x22ce('0x77')]=function(_0x176010,_0x8ed73,_0xf9ecf4){var _0x5e3f17={'raw':![],'where':{}};var _0x4b9345={};var _0x2764f7={'count':0x0,'rows':[]};return db[_0x22ce('0x46')][_0x22ce('0x78')]({'where':{'id':_0x176010['params']['id']}})['then'](handleEntityNotFound(_0x8ed73,null))['then'](function(_0x48cdeb){if(_0x48cdeb){_0x4b9345[_0x22ce('0x4b')]=_['keys'](db[_0x22ce('0x76')]['rawAttributes']);_0x4b9345[_0x22ce('0x4e')]=_['keys'](_0x176010[_0x22ce('0x4e')]);_0x4b9345[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x4b9345[_0x22ce('0x4b')],_0x4b9345[_0x22ce('0x4e')]);_0x5e3f17[_0x22ce('0x51')]=_['intersection'](_0x4b9345[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x176010[_0x22ce('0x4e')][_0x22ce('0x52')]));_0x5e3f17['attributes']=_0x5e3f17[_0x22ce('0x51')][_0x22ce('0x53')]?_0x5e3f17[_0x22ce('0x51')]:_0x4b9345[_0x22ce('0x4b')];if(!_0x176010[_0x22ce('0x4e')]['hasOwnProperty'](_0x22ce('0x54'))){_0x5e3f17[_0x22ce('0x37')]=qs[_0x22ce('0x37')](_0x176010['query'][_0x22ce('0x37')]);_0x5e3f17['offset']=qs[_0x22ce('0x35')](_0x176010[_0x22ce('0x4e')][_0x22ce('0x35')]);}_0x5e3f17['order']=qs[_0x22ce('0x56')](_0x176010['query']['sort']);_0x5e3f17['where']=qs[_0x22ce('0x4f')](_['pick'](_0x176010[_0x22ce('0x4e')],_0x4b9345[_0x22ce('0x4f')]));_0x5e3f17[_0x22ce('0x59')][_0x22ce('0x6c')]=_0x48cdeb['id'];if(_0x176010[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x5e3f17[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x5e3f17[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x5e3f17[_0x22ce('0x51')],function(_0x8f627a){var _0x21b7a7={};_0x21b7a7[_0x8f627a]={'$like':'%'+_0x176010[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x21b7a7;})});}_0x5e3f17=_[_0x22ce('0x5a')]({},_0x5e3f17,_0x176010[_0x22ce('0x5c')]);return db[_0x22ce('0x76')][_0x22ce('0x71')]({'where':_0x5e3f17[_0x22ce('0x59')]})[_0x22ce('0x3e')](function(_0x478557){_0x2764f7[_0x22ce('0x71')]=_0x478557;if(_0x176010[_0x22ce('0x4e')][_0x22ce('0x5d')]){_0x5e3f17[_0x22ce('0x61')]=[{'all':!![]}];}return db[_0x22ce('0x76')][_0x22ce('0x72')](_0x5e3f17);})[_0x22ce('0x3e')](function(_0x380a03){_0x2764f7['rows']=_0x380a03;return _0x2764f7;});}})[_0x22ce('0x3e')](respondWithFilteredResult(_0x8ed73,_0x5e3f17))[_0x22ce('0x30')](handleError(_0x8ed73,null));};exports[_0x22ce('0x79')]=function(_0x92f4c4,_0x55ef30,_0x43dcb4){return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x92f4c4[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x55ef30,null))[_0x22ce('0x3e')](function(_0x80f63a){if(_0x80f63a){return _0x80f63a[_0x22ce('0x79')](_0x92f4c4[_0x22ce('0x4e')][_0x22ce('0x74')]);}})[_0x22ce('0x3e')](respondWithStatusCode(_0x55ef30,null))['catch'](handleError(_0x55ef30,null));};exports[_0x22ce('0x7a')]=function(_0x209b1d,_0x50ae3a,_0x598a06){var _0xaf68d3={'body':_0x209b1d[_0x22ce('0x63')],'channel':_0x22ce('0x7b')};var _0x34c360=[];var _0x4a137b=[];var _0x2cd6be={};var _0x4311d6=![];return db[_0x22ce('0x7c')][_0x22ce('0x6a')]()['then'](function(_0x4bd580){if(!_0x4bd580){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))]('no\x20available\x20attributes');}_0x34c360=_[_0x22ce('0x7f')](_[_0x22ce('0x60')](_0x4bd580),[_0x22ce('0x80'),_0x22ce('0x81')]);_0x4a137b=_[_0x22ce('0x7f')](_[_0x22ce('0x60')](_0x4bd580),[_0x22ce('0x80'),_0x22ce('0x81'),'CompanyId','ListId']);if(_0x209b1d[_0x22ce('0x63')]['id']){delete _0x209b1d['body']['id'];}if(_[_0x22ce('0x82')](_0x209b1d['body']['from'])){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))](_0x22ce('0x83'));}if(_[_0x22ce('0x82')](_0x209b1d['body']['body'])||_0x209b1d[_0x22ce('0x63')][_0x22ce('0x63')]===''){throw new db[(_0x22ce('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x22ce('0x82')](_0x209b1d[_0x22ce('0x63')][_0x22ce('0x84')])){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))](_0x22ce('0x85')+_0x4a137b);}if(!_[_0x22ce('0x86')](_0x4a137b,_0x209b1d[_0x22ce('0x63')]['mapKey'])){throw new db[(_0x22ce('0x7d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a137b);}_0x2cd6be[_0x209b1d[_0x22ce('0x63')][_0x22ce('0x84')]]=_0x209b1d[_0x22ce('0x63')]['from'];})[_0x22ce('0x3e')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x209b1d[_0x22ce('0x69')]['id']},'include':[{'model':db[_0x22ce('0x87')],'as':_0x22ce('0x88'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2cd6be,'limit':0x1,'order':[[_0x22ce('0x81'),_0x22ce('0x89')]]}]},{'model':db[_0x22ce('0x8a')],'as':_0x22ce('0x8b')}]});})[_0x22ce('0x3e')](handleEntityNotFound(_0x50ae3a,null))[_0x22ce('0x3e')](function(_0x5070a7){if(_0x5070a7&&_0x5070a7[_0x22ce('0x88')]){_0xaf68d3[_0x22ce('0x8c')]=_0x5070a7;_0xaf68d3[_0x22ce('0x8d')]=_0x5070a7[_0x22ce('0x8b')];_0xaf68d3[_0x22ce('0x8e')]=_0x5070a7[_0x22ce('0x88')];_0xaf68d3[_0x22ce('0x8d')]=_[_0x22ce('0x8f')](_0xaf68d3[_0x22ce('0x8d')],['priority'],['asc']);if(_0xaf68d3[_0x22ce('0x8c')][_0x22ce('0x8b')]){delete _0xaf68d3[_0x22ce('0x8c')][_0x22ce('0x8b')];}if(_0xaf68d3['account']['List']&&_0xaf68d3['account'][_0x22ce('0x88')][_0x22ce('0x90')][_0x22ce('0x53')]){return _0xaf68d3[_0x22ce('0x8c')]['List']['Contacts'][0x0];}var _0x3134fa=_['defaults'](_0x209b1d[_0x22ce('0x63')],{'firstName':_0x209b1d[_0x22ce('0x63')][_0x22ce('0x91')],'ListId':_0x5070a7[_0x22ce('0x92')]});_0x3134fa[_0x209b1d[_0x22ce('0x63')][_0x22ce('0x84')]]=_0x209b1d['body'][_0x22ce('0x91')];return db['CmContact']['create'](_0x3134fa,{'fields':_0x34c360,'raw':!![]});}})['then'](handleEntityNotFound(_0x50ae3a,null))[_0x22ce('0x3e')](function(_0x358b52){_0xaf68d3[_0x22ce('0x93')]=_0x358b52;if(_0x358b52){var _0x4f25d0={'ContactId':_0x358b52['id'],'OpenchannelAccountId':_0x209b1d[_0x22ce('0x69')]['id'],'from':(_0x358b52['firstName']||'')+'\x20'+(_0x358b52['lastName']||'')};var _0x532f01={'OpenchannelAccountId':_0x209b1d[_0x22ce('0x69')]['id'],'closed':![]};if(_0x209b1d[_0x22ce('0x63')][_0x22ce('0x94')]){_0x532f01[_0x22ce('0x94')]=_0x209b1d['body']['threadId'];return db['OpenchannelInteraction'][_0x22ce('0x62')]({'where':_0x532f01})[_0x22ce('0x3e')](function(_0x54a4bb){if(_0x54a4bb){return[_0x54a4bb,![]];}_0x4f25d0[_0x22ce('0x94')]=_0x209b1d[_0x22ce('0x63')][_0x22ce('0x94')];_0x4f25d0[_0x22ce('0x95')]=_0x209b1d[_0x22ce('0x63')][_0x22ce('0x95')];return db[_0x22ce('0x96')][_0x22ce('0x6d')](_0x4f25d0)[_0x22ce('0x3e')](function(_0x1a752b){return[_0x1a752b,!![]];});});}else{_0x532f01[_0x22ce('0x94')]=null;}_0x532f01[_0x22ce('0x97')]=_0x358b52['id'];return db['OpenchannelInteraction'][_0x22ce('0x62')]({'where':_0x532f01})[_0x22ce('0x3e')](function(_0x496ee1){if(_0x496ee1){return[_0x496ee1,![]];}return db['OpenchannelInteraction']['create'](_0x4f25d0)[_0x22ce('0x3e')](function(_0x5abc00){return[_0x5abc00,!![]];});});}})[_0x22ce('0x98')](function(_0x43c7ef,_0x31b0c9){if(_0x43c7ef){_0x4311d6=_0x31b0c9;if(!_0x31b0c9){var _0x37ded3={'from':(_0xaf68d3[_0x22ce('0x93')][_0x22ce('0x99')]||'')+'\x20'+(_0xaf68d3[_0x22ce('0x93')][_0x22ce('0x9a')]||'')};if(_0x209b1d[_0x22ce('0x63')][_0x22ce('0x94')]&&_0x209b1d[_0x22ce('0x63')][_0x22ce('0x9b')]&&_0x209b1d['body'][_0x22ce('0x94')]!=_0x209b1d[_0x22ce('0x63')][_0x22ce('0x9b')]){_0x37ded3[_0x22ce('0x94')]=_0x209b1d['body'][_0x22ce('0x9b')];}return _0x43c7ef[_0x22ce('0x3c')](_0x37ded3);}else{return _0x43c7ef;}}})[_0x22ce('0x3e')](function(_0x429a4c){_0xaf68d3[_0x22ce('0x9c')]=_0x429a4c['get']({'plain':!![]});_0xaf68d3[_0x22ce('0x9c')][_0x22ce('0x9d')]=_0x4311d6;if(_0xaf68d3[_0x22ce('0x9c')][_0x22ce('0x9d')]){if(_0xaf68d3[_0x22ce('0x8c')][_0x22ce('0x9e')]){_0xaf68d3[_0x22ce('0x8d')]['push']({'id':0x0,'priority':_0xaf68d3[_0x22ce('0x8d')][_0x22ce('0x53')]+0x1,'app':_0x22ce('0x9f'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x22ce('0xa0')][_0x22ce('0x6d')]({'body':_0x209b1d[_0x22ce('0x63')][_0x22ce('0x63')],'OpenchannelAccountId':_0x209b1d[_0x22ce('0x69')]['id'],'OpenchannelInteractionId':_0x429a4c['id'],'direction':'in','ContactId':_0xaf68d3[_0x22ce('0x93')]['id'],'AttachmentId':_0x209b1d[_0x22ce('0x63')][_0x22ce('0xa1')]});})[_0x22ce('0x3e')](function(_0x57d6cd){_0xaf68d3['message']=_0x57d6cd;if(_0xaf68d3[_0x22ce('0x9c')]['UserId']){return db[_0x22ce('0xa2')][_0x22ce('0x62')]({'attributes':['id',_0x22ce('0x4d')],'where':{'id':_0xaf68d3[_0x22ce('0x9c')]['UserId']}})[_0x22ce('0x3e')](function(_0x435052){if(_0x435052){_0xaf68d3['applications'][_0x22ce('0xa3')]({'id':0x0,'priority':0x0,'app':_0x22ce('0xa4'),'appdata':_0x435052[_0x22ce('0x4d')]+','+(_0xaf68d3[_0x22ce('0x8c')][_0x22ce('0xa5')]||0xa),'interval':_0x22ce('0xa6')});_0xaf68d3['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x22ce('0xa7'),_0xaf68d3);});}return respondWithRpcPromise(_0x22ce('0xa8'),_0x22ce('0xa7'),_0xaf68d3);})[_0x22ce('0x3e')](function(_0xe2b56){respondWithRpcPromise(_0x22ce('0xa9'),_0x22ce('0xa9'),{'event':_0x22ce('0x7a'),'message':_0xe2b56},client9002);return _0xe2b56;})[_0x22ce('0x3e')](respondWithResult(_0x50ae3a,null))[_0x22ce('0x30')](handleError(_0x50ae3a,null));};exports[_0x22ce('0xaa')]=function(_0x46c18b,_0x848f04){var _0x2b2435=_0x46c18b[_0x22ce('0x69')]['id'];var _0x589146=_0x46c18b[_0x22ce('0x63')];var _0x4f1e74=0xc8;var _0x156620=null;return db['sequelize'][_0x22ce('0xab')]({'isolationLevel':db[_0x22ce('0xac')][_0x22ce('0xad')]['ISOLATION_LEVELS'][_0x22ce('0xae')]},function(_0x2865c0){return db['OpenchannelAccount'][_0x22ce('0x78')]({'where':{'id':_0x2b2435},'transaction':_0x2865c0})[_0x22ce('0x3e')](function(_0x55fba1){if(_0x55fba1){return db[_0x22ce('0x8a')][_0x22ce('0x3d')]({'where':{'OpenchannelAccountId':_0x2b2435},'transaction':_0x2865c0})[_0x22ce('0x3e')](function(){var _0x239d34=_['map'](_0x589146,function(_0x57f0a1){_0x57f0a1[_0x22ce('0x6c')]=_0x2b2435;return _0x57f0a1;});return db[_0x22ce('0x8a')]['bulkCreate'](_0x239d34,{'transaction':_0x2865c0});});}else{_0x4f1e74=0x194;_0x156620=[];}});})[_0x22ce('0x3e')](function(){if(_0x4f1e74!==0x194){return db[_0x22ce('0x8a')][_0x22ce('0xaf')]({'where':{'OpenchannelAccountId':_0x2b2435},'order':_0x22ce('0xb0')})[_0x22ce('0x3e')](function(_0x34106f){_0x156620=_0x34106f;});}})[_0x22ce('0x30')](function(_0x43ba78){_0x4f1e74=0x1f4;logger[_0x22ce('0x2c')](_0x43ba78[_0x22ce('0x42')]);if(_0x43ba78[_0x22ce('0x4d')]){delete _0x43ba78[_0x22ce('0x4d')];}_0x156620=_0x43ba78;})[_0x22ce('0xb1')](function(){if(_0x156620===null){_0x848f04[_0x22ce('0x31')](_0x4f1e74);}else{if(_0x4f1e74===0x1f4){_0x848f04[_0x22ce('0x33')](_0x4f1e74)['send'](_0x156620);}else{_0x848f04['status'](_0x4f1e74)['json'](_0x156620);}}});};exports['getApplications']=function(_0x1f4e76,_0x39be9e,_0x4d5cb3){var _0x8e5396={};var _0x1e5513={};var _0x639ab4;var _0x452e12;return db[_0x22ce('0x46')]['findOne']({'where':{'id':_0x1f4e76[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x39be9e,null))[_0x22ce('0x3e')](function(_0x5ef9b5){if(_0x5ef9b5){_0x639ab4=_0x5ef9b5;_0x1e5513[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0x8a')][_0x22ce('0x47')]);_0x1e5513[_0x22ce('0x4e')]=_[_0x22ce('0x60')](_0x1f4e76['query']);_0x1e5513[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x1e5513[_0x22ce('0x4b')],_0x1e5513[_0x22ce('0x4e')]);_0x8e5396['attributes']=_['intersection'](_0x1e5513[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0x1f4e76['query'][_0x22ce('0x52')]));_0x8e5396[_0x22ce('0x51')]=_0x8e5396[_0x22ce('0x51')][_0x22ce('0x53')]?_0x8e5396[_0x22ce('0x51')]:_0x1e5513[_0x22ce('0x4b')];_0x8e5396[_0x22ce('0x55')]=qs['sort'](_0x1f4e76[_0x22ce('0x4e')]['sort']);_0x8e5396['where']=qs[_0x22ce('0x4f')](_['pick'](_0x1f4e76[_0x22ce('0x4e')],_0x1e5513[_0x22ce('0x4f')]));if(_0x1f4e76[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x8e5396['where']=_[_0x22ce('0x5a')](_0x8e5396[_0x22ce('0x59')],{'$or':_['map'](_0x8e5396[_0x22ce('0x51')],function(_0x11ff59){var _0x54d042={};_0x54d042[_0x11ff59]={'$like':'%'+_0x1f4e76[_0x22ce('0x4e')]['filter']+'%'};return _0x54d042;})});}_0x8e5396=_[_0x22ce('0x5a')]({},_0x8e5396,_0x1f4e76[_0x22ce('0x5c')]);return _0x639ab4['getApplications'](_0x8e5396);}})[_0x22ce('0x3e')](function(_0x3413c0){if(_0x3413c0){_0x452e12=_0x3413c0[_0x22ce('0x53')];if(!_0x1f4e76[_0x22ce('0x4e')][_0x22ce('0x6f')](_0x22ce('0x54'))){_0x8e5396[_0x22ce('0x37')]=qs['limit'](_0x1f4e76['query'][_0x22ce('0x37')]);_0x8e5396[_0x22ce('0x35')]=qs['offset'](_0x1f4e76[_0x22ce('0x4e')][_0x22ce('0x35')]);}return _0x639ab4[_0x22ce('0xb2')](_0x8e5396);}})[_0x22ce('0x3e')](function(_0x2ab5a0){if(_0x2ab5a0){return _0x2ab5a0?{'count':_0x452e12,'rows':_0x2ab5a0}:null;}})['then'](respondWithResult(_0x39be9e,null))[_0x22ce('0x30')](handleError(_0x39be9e,null));};exports[_0x22ce('0xb3')]=function(_0xa1a672,_0x309327,_0xc9401a){var _0x1f441e={'raw':![],'where':{}};var _0x168b74={};var _0x4f698c={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xa1a672[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x309327,null))[_0x22ce('0x3e')](function(_0x4492d9){if(_0x4492d9){_0x168b74[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0x96')][_0x22ce('0x47')]);_0x168b74[_0x22ce('0x4e')]=_['keys'](_0xa1a672[_0x22ce('0x4e')]);_0x168b74[_0x22ce('0x4f')]=_['intersection'](_0x168b74[_0x22ce('0x4b')],_0x168b74['query']);_0x1f441e[_0x22ce('0x51')]=_['intersection'](_0x168b74[_0x22ce('0x4b')],qs[_0x22ce('0x52')](_0xa1a672['query'][_0x22ce('0x52')]));_0x1f441e[_0x22ce('0x51')]=_0x1f441e['attributes'][_0x22ce('0x53')]?_0x1f441e[_0x22ce('0x51')]:_0x168b74[_0x22ce('0x4b')];if(!_0xa1a672[_0x22ce('0x4e')]['hasOwnProperty'](_0x22ce('0x54'))){_0x1f441e['limit']=qs['limit'](_0xa1a672[_0x22ce('0x4e')][_0x22ce('0x37')]);_0x1f441e[_0x22ce('0x35')]=qs[_0x22ce('0x35')](_0xa1a672['query']['offset']);}_0x1f441e[_0x22ce('0x55')]=qs[_0x22ce('0x56')](_0xa1a672[_0x22ce('0x4e')][_0x22ce('0x56')]);_0x1f441e[_0x22ce('0x59')]=qs['filters'](_[_0x22ce('0x57')](_0xa1a672[_0x22ce('0x4e')],_0x168b74['filters']));_0x1f441e[_0x22ce('0x59')][_0x22ce('0x6c')]=_0x4492d9['id'];if(_0xa1a672[_0x22ce('0x4e')]['filter']){_0x1f441e[_0x22ce('0x59')]=_['merge'](_0x1f441e[_0x22ce('0x59')],{'$or':_[_0x22ce('0x4c')](_0x1f441e[_0x22ce('0x51')],function(_0x503842){var _0x3df6c3={};_0x3df6c3[_0x503842]={'$like':'%'+_0xa1a672[_0x22ce('0x4e')][_0x22ce('0x58')]+'%'};return _0x3df6c3;})});}_0x1f441e=_[_0x22ce('0x5a')]({},_0x1f441e,_0xa1a672['options']);return db['OpenchannelInteraction'][_0x22ce('0x71')]({'where':_0x1f441e['where']})['then'](function(_0x5a79ea){_0x4f698c[_0x22ce('0x71')]=_0x5a79ea;if(_0xa1a672['query'][_0x22ce('0x5d')]){_0x1f441e[_0x22ce('0x61')]=[{'model':db[_0x22ce('0x7c')],'as':_0x22ce('0xb4'),'required':![]},{'model':db[_0x22ce('0xa2')],'as':_0x22ce('0xb5'),'attributes':[_0x22ce('0x4d'),'fullname',_0x22ce('0xb6')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0xa1a672[_0x22ce('0x4e')][_0x22ce('0xb7')]?{'id':_0xa1a672[_0x22ce('0x4e')][_0x22ce('0xb7')]}:undefined,'required':_0xa1a672['query'][_0x22ce('0xb7')]?!![]:![]}];}return db[_0x22ce('0x96')][_0x22ce('0x72')](_0x1f441e);})[_0x22ce('0x3e')](function(_0x1e91d6){_0x4f698c[_0x22ce('0x5e')]=_0x1e91d6;return _0x4f698c;});}})[_0x22ce('0x3e')](respondWithFilteredResult(_0x309327,_0x1f441e))['catch'](handleError(_0x309327,null));};exports[_0x22ce('0xb8')]=function(_0x34da10,_0x476fa4,_0x277940){return db['OpenchannelAccount']['find']({'where':{'id':_0x34da10[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x476fa4,null))[_0x22ce('0x3e')](function(_0x54bbc5){if(_0x54bbc5){return _0x54bbc5[_0x22ce('0xb8')](_0x34da10[_0x22ce('0x63')][_0x22ce('0x74')],_['omit'](_0x34da10['body'],[_0x22ce('0x74'),'id'])||{})[_0x22ce('0x98')](function(_0x5b744f){for(var _0x134c3c=0x0;_0x134c3c<_0x34da10[_0x22ce('0x63')][_0x22ce('0x74')][_0x22ce('0x53')];_0x134c3c+=0x1){socket[_0x22ce('0xb9')](_0x22ce('0xba'),{'UserId':Number(_0x34da10[_0x22ce('0x63')][_0x22ce('0x74')][_0x134c3c]),'OpenchannelAccountId':Number(_0x34da10['params']['id'])});}return _0x5b744f;});}})['then'](respondWithResult(_0x476fa4,null))[_0x22ce('0x30')](handleError(_0x476fa4,null));};exports[_0x22ce('0xbb')]=function(_0x3af018,_0x55b9c3,_0x17096b){return db['OpenchannelAccount'][_0x22ce('0x62')]({'where':{'id':_0x3af018[_0x22ce('0x69')]['id']}})[_0x22ce('0x3e')](handleEntityNotFound(_0x55b9c3,null))[_0x22ce('0x3e')](function(_0x2b8318){if(_0x2b8318){return _0x2b8318[_0x22ce('0xbb')](_0x3af018['query']['ids'])[_0x22ce('0x3e')](function(){if(_[_0x22ce('0xbc')](_0x3af018[_0x22ce('0x4e')][_0x22ce('0x74')])){for(var _0x17d432=0x0;_0x17d432<_0x3af018[_0x22ce('0x4e')][_0x22ce('0x74')][_0x22ce('0x53')];_0x17d432+=0x1){socket[_0x22ce('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3af018['query']['ids'][_0x17d432]),'OpenchannelAccountId':Number(_0x3af018[_0x22ce('0x69')]['id'])});}}else{socket[_0x22ce('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3af018[_0x22ce('0x4e')][_0x22ce('0x74')]),'OpenchannelAccountId':Number(_0x3af018[_0x22ce('0x69')]['id'])});}});}})[_0x22ce('0x3e')](respondWithStatusCode(_0x55b9c3,null))['catch'](handleError(_0x55b9c3,null));};exports['getAgents']=function(_0x3fbe3b,_0x15b2db,_0x6acd7e){var _0x819d6d={};var _0x5281fc={};var _0x1de53b;var _0x5325b6;return db[_0x22ce('0x46')][_0x22ce('0x78')]({'where':{'id':_0x3fbe3b[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x15b2db,null))['then'](function(_0x584ca0){if(_0x584ca0){_0x1de53b=_0x584ca0;_0x5281fc[_0x22ce('0x4b')]=_[_0x22ce('0x60')](db[_0x22ce('0xa2')][_0x22ce('0x47')]);_0x5281fc[_0x22ce('0x4e')]=_['keys'](_0x3fbe3b[_0x22ce('0x4e')]);_0x5281fc[_0x22ce('0x4f')]=_[_0x22ce('0x50')](_0x5281fc[_0x22ce('0x4b')],_0x5281fc[_0x22ce('0x4e')]);_0x819d6d[_0x22ce('0x51')]=_[_0x22ce('0x50')](_0x5281fc['model'],qs[_0x22ce('0x52')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x52')]));_0x819d6d[_0x22ce('0x51')]=_0x819d6d['attributes'][_0x22ce('0x53')]?_0x819d6d[_0x22ce('0x51')]:_0x5281fc[_0x22ce('0x4b')];_0x819d6d['order']=qs[_0x22ce('0x56')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x56')]);_0x819d6d['where']=qs[_0x22ce('0x4f')](_[_0x22ce('0x57')](_0x3fbe3b[_0x22ce('0x4e')],_0x5281fc[_0x22ce('0x4f')]));if(_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x58')]){_0x819d6d[_0x22ce('0x59')]=_[_0x22ce('0x5a')](_0x819d6d['where'],{'$or':_[_0x22ce('0x4c')](_0x819d6d['attributes'],function(_0x3921df){var _0x13d77e={};_0x13d77e[_0x3921df]={'$like':'%'+_0x3fbe3b[_0x22ce('0x4e')]['filter']+'%'};return _0x13d77e;})});}_0x819d6d=_[_0x22ce('0x5a')]({},_0x819d6d,_0x3fbe3b[_0x22ce('0x5c')]);return _0x1de53b['getAgents'](_0x819d6d);}})[_0x22ce('0x3e')](function(_0x330295){if(_0x330295){_0x5325b6=_0x330295[_0x22ce('0x53')];if(!_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x6f')](_0x22ce('0x54'))){_0x819d6d[_0x22ce('0x37')]=qs[_0x22ce('0x37')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x37')]);_0x819d6d[_0x22ce('0x35')]=qs[_0x22ce('0x35')](_0x3fbe3b[_0x22ce('0x4e')][_0x22ce('0x35')]);}return _0x1de53b[_0x22ce('0xbd')](_0x819d6d);}})[_0x22ce('0x3e')](function(_0x28337a){if(_0x28337a){return _0x28337a?{'count':_0x5325b6,'rows':_0x28337a}:null;}})[_0x22ce('0x3e')](respondWithResult(_0x15b2db,null))[_0x22ce('0x30')](handleError(_0x15b2db,null));};exports[_0x22ce('0x43')]=function(_0x11442f,_0x53ee5a,_0x91ca75){var _0x47a294,_0x3754d7,_0x43c6b3;if(_[_0x22ce('0x82')](_0x11442f['body'][_0x22ce('0x63')])||_0x11442f[_0x22ce('0x63')]['body']===''){throw new db[(_0x22ce('0x7d'))][(_0x22ce('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x22ce('0x82')](_0x11442f[_0x22ce('0x63')]['to'])){}_0x47a294=_0x11442f['body']['to'];return db[_0x22ce('0x46')]['findOne']({'where':{'id':_0x11442f[_0x22ce('0x69')]['id']}})['then'](handleEntityNotFound(_0x53ee5a,null))[_0x22ce('0x3e')](function(_0x4e766d){if(_0x4e766d){return db[_0x22ce('0x46')]['find']({'where':{'id':_0x4e766d['id']},'include':[{'model':db[_0x22ce('0x87')],'as':_0x22ce('0x88'),'include':[{'model':db['CmContact'],'as':_0x22ce('0x90'),'where':{[_0x4e766d['mapKey']]:_0x47a294},'limit':0x1,'order':[[_0x22ce('0x81'),'DESC']]}]}]})[_0x22ce('0x3e')](handleEntityNotFound(_0x53ee5a,null))[_0x22ce('0x3e')](function(_0x54afa9){if(_0x54afa9&&_0x54afa9[_0x22ce('0x88')]){_0x3754d7=_0x54afa9[_0x22ce('0x3f')]({'plain':!![]});if(_0x3754d7[_0x22ce('0x88')]&&_0x3754d7[_0x22ce('0x88')][_0x22ce('0x90')][_0x22ce('0x53')]){return _0x3754d7[_0x22ce('0x88')]['Contacts'][0x0];}return db[_0x22ce('0x7c')][_0x22ce('0x6d')](_[_0x22ce('0x1d')](_0x11442f[_0x22ce('0x63')],{'firstName':_0x47a294,[_0x54afa9[_0x22ce('0x84')]]:_0x47a294,'phone':_0x47a294,'ListId':_0x3754d7[_0x22ce('0x92')]}));}})[_0x22ce('0x3e')](handleEntityNotFound(_0x53ee5a,null))[_0x22ce('0x3e')](function(_0x18bb99){if(_0x18bb99){_0x43c6b3=_0x18bb99;return db['OpenchannelInteraction'][_0x22ce('0x62')]({'where':{'ContactId':_0x43c6b3['id'],'closed':![],'OpenchannelAccountId':_0x3754d7['id']}})[_0x22ce('0x3e')](function(_0x4397a6){if(_0x4397a6){return[_0x4397a6,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x11442f[_0x22ce('0x65')]['id'],'ContactId':_0x43c6b3['id'],'OpenchannelAccountId':_0x3754d7['id'],'lastMsgDirection':_0x22ce('0xbe'),'Messages':[_[_0x22ce('0x5a')](_0x11442f['body'],{'read':![],'body':_0x11442f[_0x22ce('0x63')][_0x22ce('0x63')],'OpenchannelAccountId':_0x3754d7['id'],'UserId':_0x11442f[_0x22ce('0x65')]['id'],'ContactId':_0x43c6b3['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x22ce('0xbf')}]})[_0x22ce('0x3e')](function(_0x1d29cd){return[_0x1d29cd,!![]];});});}})[_0x22ce('0x98')](function(_0x58be84,_0x180731){if(_0x180731){return _0x58be84;}return db[_0x22ce('0xa0')][_0x22ce('0x6d')](_[_0x22ce('0x5a')](_0x11442f['body'],{'read':![],'body':_0x11442f[_0x22ce('0x63')][_0x22ce('0x63')],'OpenchannelAccountId':_0x3754d7['id'],'OpenchannelInteractionId':_0x58be84['id'],'UserId':_0x11442f['user']['id'],'ContactId':_0x43c6b3['id']}))['then'](function(_0x5665f4){_0x58be84[_0x22ce('0xc0')][_0x22ce('0xbf')]=[];_0x58be84[_0x22ce('0xc0')][_0x22ce('0xbf')]['push'](_0x5665f4['dataValues']);return _0x58be84;});});}})[_0x22ce('0x3e')](respondWithResult(_0x53ee5a,null))[_0x22ce('0x30')](handleError(_0x53ee5a,null));}; \ No newline at end of file +var _0x2af7=['addAgents','omit','spread','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','eml-format','rimraf','zip-dir','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','update','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','ListId','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','fullname','internal','Tag','Tags','tag'];(function(_0x3127f9,_0x2a6c79){var _0x16bdd1=function(_0x95a4da){while(--_0x95a4da){_0x3127f9['push'](_0x3127f9['shift']());}};_0x16bdd1(++_0x2a6c79);}(_0x2af7,0xc5));var _0x72af=function(_0x3505d5,_0x2a8605){_0x3505d5=_0x3505d5-0x0;var _0x55fc9c=_0x2af7[_0x3505d5];return _0x55fc9c;};'use strict';var emlformat=require(_0x72af('0x0'));var rimraf=require(_0x72af('0x1'));var zipdir=require(_0x72af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72af('0x3'));var path=require(_0x72af('0x4'));var sox=require(_0x72af('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72af('0x6'));var _=require(_0x72af('0x7'));var squel=require(_0x72af('0x8'));var crypto=require(_0x72af('0x9'));var jsforce=require(_0x72af('0xa'));var deskjs=require(_0x72af('0xb'));var toCsv=require(_0x72af('0xc'));var querystring=require(_0x72af('0xd'));var Papa=require(_0x72af('0xe'));var Redis=require(_0x72af('0xf'));var authService=require(_0x72af('0x10'));var qs=require(_0x72af('0x11'));var as=require(_0x72af('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72af('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x72af('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x72af('0x15')]=_[_0x72af('0x16')](config[_0x72af('0x15')],{'host':_0x72af('0x17'),'port':0x18eb});var socket=require(_0x72af('0x18'))(new Redis(config[_0x72af('0x15')]));require(_0x72af('0x19'))[_0x72af('0x1a')](socket);var jayson=require(_0x72af('0x1b'));var client=jayson[_0x72af('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0x72af('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x712fee,_0xc9a94b,_0x3f2475,_0x24bad7){return new BPromise(function(_0x15b84f,_0x163bbe){var _0xac2a47=_0x24bad7||client;return _0xac2a47['request'](_0x712fee,_0x3f2475)[_0x72af('0x1e')](function(_0xdc288){logger[_0x72af('0x1f')](_0x72af('0x20'),_0xc9a94b,'request\x20sent');logger[_0x72af('0x21')](_0x72af('0x22'),_0xc9a94b,_0x72af('0x23'),JSON['stringify'](_0xdc288));if(_0xdc288['error']){if(_0xdc288['error'][_0x72af('0x24')]===0x1f4){logger[_0x72af('0x25')](_0x72af('0x20'),_0xc9a94b,_0xdc288['error'][_0x72af('0x26')]);return _0x163bbe(_0xdc288[_0x72af('0x25')]['message']);}logger[_0x72af('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0xc9a94b,_0xdc288[_0x72af('0x25')][_0x72af('0x26')]);return _0x15b84f(_0xdc288[_0x72af('0x25')][_0x72af('0x26')]);}else{logger[_0x72af('0x1f')](_0x72af('0x20'),_0xc9a94b,_0x72af('0x23'));_0x15b84f(_0xdc288[_0x72af('0x27')][_0x72af('0x26')]);}})[_0x72af('0x28')](function(_0xe0f36c){logger[_0x72af('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0xc9a94b,_0xe0f36c);_0x163bbe(_0xe0f36c);});});}function respondWithStatusCode(_0x10a43e,_0x4b0f3a){_0x4b0f3a=_0x4b0f3a||0xcc;return function(_0x5badb9){if(_0x5badb9){return _0x10a43e[_0x72af('0x29')](_0x4b0f3a);}return _0x10a43e['status'](_0x4b0f3a)['end']();};}function respondWithResult(_0x1f24a3,_0x47a2ad){_0x47a2ad=_0x47a2ad||0xc8;return function(_0x1df4c0){if(_0x1df4c0){return _0x1f24a3[_0x72af('0x2a')](_0x47a2ad)[_0x72af('0x2b')](_0x1df4c0);}};}function respondWithFilteredResult(_0x2817da,_0x3835ab){return function(_0x91e7e){if(_0x91e7e){var _0x3a07ed=typeof _0x3835ab[_0x72af('0x2c')]===_0x72af('0x2d')&&typeof _0x3835ab[_0x72af('0x2e')]===_0x72af('0x2d');var _0x132c0c=_0x91e7e['count'];var _0x4861c9=_0x3a07ed?0x0:_0x3835ab[_0x72af('0x2c')];var _0x230651=_0x3a07ed?_0x91e7e[_0x72af('0x2f')]:_0x3835ab[_0x72af('0x2c')]+_0x3835ab[_0x72af('0x2e')];var _0xce1081;if(_0x230651>=_0x132c0c){_0x230651=_0x132c0c;_0xce1081=0xc8;}else{_0xce1081=0xce;}_0x2817da[_0x72af('0x2a')](_0xce1081);return _0x2817da[_0x72af('0x30')](_0x72af('0x31'),_0x4861c9+'-'+_0x230651+'/'+_0x132c0c)['json'](_0x91e7e);}return null;};}function patchUpdates(_0x410bf4){return function(_0x5d14bb){try{jsonpatch['apply'](_0x5d14bb,_0x410bf4,!![]);}catch(_0x7f0688){return BPromise['reject'](_0x7f0688);}return _0x5d14bb[_0x72af('0x32')]();};}function saveUpdates(_0x3edf9c,_0x15b4b1){return function(_0x572e19){if(_0x572e19){return _0x572e19['update'](_0x3edf9c)[_0x72af('0x1e')](function(_0x5a02c1){return _0x5a02c1;});}return null;};}function removeEntity(_0xd41627,_0x4cedde){return function(_0x29a846){if(_0x29a846){return _0x29a846[_0x72af('0x33')]()['then'](function(){var _0x36d994=_0x29a846[_0x72af('0x34')]({'plain':!![]});var _0x4595cd=_0x72af('0x35');return db[_0x72af('0x36')][_0x72af('0x33')]({'where':{'type':_0x4595cd,'resourceId':_0x36d994['id']}})[_0x72af('0x1e')](function(){return _0x29a846;});})[_0x72af('0x1e')](function(){_0xd41627[_0x72af('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef575,_0x37fda4){return function(_0x59f1ce){if(!_0x59f1ce){_0x3ef575[_0x72af('0x29')](0x194);}return _0x59f1ce;};}function handleError(_0x1b4112,_0x565a12){_0x565a12=_0x565a12||0x1f4;return function(_0x3f7089){logger[_0x72af('0x25')](_0x3f7089['stack']);if(_0x3f7089[_0x72af('0x37')]){delete _0x3f7089[_0x72af('0x37')];}_0x1b4112[_0x72af('0x2a')](_0x565a12)['send'](_0x3f7089);};}exports['index']=function(_0x5264e4,_0x23bb73){var _0x145ac8={'include':[{'model':db['Pause'],'as':_0x72af('0x38')}]},_0x26aa70={},_0x5b2ca5={'count':0x0,'rows':[]};var _0x67ac33=_[_0x72af('0x39')](db[_0x72af('0x3a')][_0x72af('0x3b')],function(_0x265369){return{'name':_0x265369[_0x72af('0x3c')],'type':_0x265369['type'][_0x72af('0x3d')]};});_0x26aa70['model']=_[_0x72af('0x39')](_0x67ac33,_0x72af('0x37'));_0x26aa70[_0x72af('0x3e')]=_[_0x72af('0x3f')](_0x5264e4[_0x72af('0x3e')]);_0x26aa70[_0x72af('0x40')]=_['intersection'](_0x26aa70[_0x72af('0x41')],_0x26aa70['query']);_0x145ac8[_0x72af('0x42')]=_[_0x72af('0x43')](_0x26aa70[_0x72af('0x41')],qs[_0x72af('0x44')](_0x5264e4[_0x72af('0x3e')]['fields']));_0x145ac8[_0x72af('0x42')]=_0x145ac8[_0x72af('0x42')][_0x72af('0x45')]?_0x145ac8[_0x72af('0x42')]:_0x26aa70[_0x72af('0x41')];if(!_0x5264e4[_0x72af('0x3e')][_0x72af('0x46')](_0x72af('0x47'))){_0x145ac8[_0x72af('0x2e')]=qs[_0x72af('0x2e')](_0x5264e4[_0x72af('0x3e')][_0x72af('0x2e')]);_0x145ac8['offset']=qs[_0x72af('0x2c')](_0x5264e4['query'][_0x72af('0x2c')]);}_0x145ac8['order']=qs[_0x72af('0x48')](_0x5264e4['query']['sort']);_0x145ac8[_0x72af('0x49')]=qs[_0x72af('0x40')](_['pick'](_0x5264e4[_0x72af('0x3e')],_0x26aa70['filters']),_0x67ac33);if(_0x5264e4[_0x72af('0x3e')][_0x72af('0x4a')]){_0x145ac8[_0x72af('0x49')]=_['merge'](_0x145ac8[_0x72af('0x49')],{'$or':_[_0x72af('0x39')](_0x67ac33,function(_0xbeb662){if(_0xbeb662[_0x72af('0x4b')]!==_0x72af('0x4c')){var _0x33f944={};_0x33f944[_0xbeb662[_0x72af('0x37')]]={'$like':'%'+_0x5264e4['query']['filter']+'%'};return _0x33f944;}})});}_0x145ac8=_[_0x72af('0x4d')]({},_0x145ac8,_0x5264e4[_0x72af('0x4e')]);var _0x5585ca={'where':_0x145ac8['where']};return db['OpenchannelAccount'][_0x72af('0x2f')](_0x5585ca)[_0x72af('0x1e')](function(_0x407d19){_0x5b2ca5[_0x72af('0x2f')]=_0x407d19;if(_0x5264e4[_0x72af('0x3e')][_0x72af('0x4f')]){_0x145ac8[_0x72af('0x50')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x72af('0x51')](_0x145ac8);})['then'](function(_0x5de3b1){_0x5b2ca5[_0x72af('0x52')]=_0x5de3b1;return _0x5b2ca5;})[_0x72af('0x1e')](respondWithFilteredResult(_0x23bb73,_0x145ac8))[_0x72af('0x28')](handleError(_0x23bb73,null));};exports[_0x72af('0x53')]=function(_0x1835ee,_0x11eb4e){var _0x51412b={'raw':![],'where':{'id':_0x1835ee[_0x72af('0x54')]['id']},'include':[{'model':db[_0x72af('0x55')],'as':_0x72af('0x38')}]},_0x45d4b1={};_0x45d4b1[_0x72af('0x41')]=_[_0x72af('0x3f')](db[_0x72af('0x3a')][_0x72af('0x3b')]);_0x45d4b1[_0x72af('0x3e')]=_[_0x72af('0x3f')](_0x1835ee['query']);_0x45d4b1['filters']=_[_0x72af('0x43')](_0x45d4b1[_0x72af('0x41')],_0x45d4b1[_0x72af('0x3e')]);_0x51412b['attributes']=_[_0x72af('0x43')](_0x45d4b1[_0x72af('0x41')],qs[_0x72af('0x44')](_0x1835ee[_0x72af('0x3e')][_0x72af('0x44')]));_0x51412b[_0x72af('0x42')]=_0x51412b['attributes']['length']?_0x51412b['attributes']:_0x45d4b1['model'];if(_0x1835ee[_0x72af('0x3e')][_0x72af('0x4f')]){_0x51412b['include']=[{'all':!![]}];}_0x51412b=_[_0x72af('0x4d')]({},_0x51412b,_0x1835ee[_0x72af('0x4e')]);return db[_0x72af('0x3a')]['find'](_0x51412b)[_0x72af('0x1e')](handleEntityNotFound(_0x11eb4e,null))[_0x72af('0x1e')](respondWithResult(_0x11eb4e,null))[_0x72af('0x28')](handleError(_0x11eb4e,null));};exports[_0x72af('0x56')]=function(_0x5cf3e7,_0x186df0){return db[_0x72af('0x3a')][_0x72af('0x56')](_0x5cf3e7[_0x72af('0x57')],{})['then'](function(_0xa146da){var _0x2ebd5d=_0x5cf3e7[_0x72af('0x58')]['get']({'plain':!![]});if(!_0x2ebd5d)throw new Error(_0x72af('0x59'));if(_0x2ebd5d['role']===_0x72af('0x58')){var _0x1158d5=_0xa146da['get']({'plain':!![]});var _0x262b80=_0x72af('0x35');return db['UserProfileSection'][_0x72af('0x5a')]({'where':{'name':_0x262b80,'userProfileId':_0x2ebd5d[_0x72af('0x5b')]},'raw':!![]})['then'](function(_0xebfcd6){if(_0xebfcd6&&_0xebfcd6[_0x72af('0x5c')]===0x0){return db[_0x72af('0x36')]['create']({'name':_0x1158d5[_0x72af('0x37')],'resourceId':_0x1158d5['id'],'type':_0xebfcd6[_0x72af('0x37')],'sectionId':_0xebfcd6['id']},{})[_0x72af('0x1e')](function(){return _0xa146da;});}else{return _0xa146da;}})[_0x72af('0x28')](function(_0x5de1f2){logger[_0x72af('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5de1f2);throw _0x5de1f2;});}return _0xa146da;})['then'](respondWithResult(_0x186df0,0xc9))[_0x72af('0x28')](handleError(_0x186df0,null));};exports[_0x72af('0x5d')]=function(_0x26794e,_0xe20a3a){if(_0x26794e[_0x72af('0x57')]['id']){delete _0x26794e[_0x72af('0x57')]['id'];}return db[_0x72af('0x3a')][_0x72af('0x5a')]({'where':{'id':_0x26794e['params']['id']},'include':[{'model':db[_0x72af('0x55')],'as':_0x72af('0x38')}]})[_0x72af('0x1e')](handleEntityNotFound(_0xe20a3a,null))[_0x72af('0x1e')](saveUpdates(_0x26794e['body'],null))['then'](respondWithResult(_0xe20a3a,null))['catch'](handleError(_0xe20a3a,null));};exports[_0x72af('0x33')]=function(_0x507bbe,_0x1655fd){return db['OpenchannelAccount'][_0x72af('0x5a')]({'where':{'id':_0x507bbe[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x1655fd,null))[_0x72af('0x1e')](removeEntity(_0x1655fd,null))['catch'](handleError(_0x1655fd,null));};exports[_0x72af('0x5e')]=function(_0x430127,_0x52c84a){return db['OpenchannelAccount']['describe']()[_0x72af('0x1e')](respondWithResult(_0x52c84a,null))[_0x72af('0x28')](handleError(_0x52c84a,null));};exports[_0x72af('0x5f')]=function(_0x3da987,_0x3e0b2e,_0x40be3c){if(_0x3da987['body']['id']){delete _0x3da987[_0x72af('0x57')]['id'];}return db[_0x72af('0x3a')][_0x72af('0x5a')]({'where':{'id':_0x3da987[_0x72af('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e0b2e,null))[_0x72af('0x1e')](function(_0x41011f){if(_0x41011f){_0x3da987[_0x72af('0x57')]['OpenchannelAccountId']=_0x41011f['id'];return db[_0x72af('0x60')][_0x72af('0x56')](_0x3da987[_0x72af('0x57')]);}})[_0x72af('0x1e')](respondWithResult(_0x3e0b2e,null))[_0x72af('0x28')](handleError(_0x3e0b2e,null));};exports[_0x72af('0x61')]=function(_0x295be0,_0x3074ba,_0x147943){var _0x822a32={'raw':![],'where':{}};var _0x1b9046={};var _0x44a4a2={'count':0x0,'rows':[]};return db[_0x72af('0x3a')][_0x72af('0x62')]({'where':{'id':_0x295be0['params']['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x3074ba,null))[_0x72af('0x1e')](function(_0x5ae8c7){if(_0x5ae8c7){_0x1b9046[_0x72af('0x41')]=_[_0x72af('0x3f')](db['Disposition'][_0x72af('0x3b')]);_0x1b9046['query']=_['keys'](_0x295be0[_0x72af('0x3e')]);_0x1b9046[_0x72af('0x40')]=_[_0x72af('0x43')](_0x1b9046['model'],_0x1b9046[_0x72af('0x3e')]);_0x822a32['attributes']=_[_0x72af('0x43')](_0x1b9046[_0x72af('0x41')],qs[_0x72af('0x44')](_0x295be0[_0x72af('0x3e')][_0x72af('0x44')]));_0x822a32[_0x72af('0x42')]=_0x822a32[_0x72af('0x42')][_0x72af('0x45')]?_0x822a32[_0x72af('0x42')]:_0x1b9046[_0x72af('0x41')];if(!_0x295be0[_0x72af('0x3e')][_0x72af('0x46')]('nolimit')){_0x822a32[_0x72af('0x2e')]=qs['limit'](_0x295be0[_0x72af('0x3e')][_0x72af('0x2e')]);_0x822a32[_0x72af('0x2c')]=qs[_0x72af('0x2c')](_0x295be0[_0x72af('0x3e')][_0x72af('0x2c')]);}_0x822a32[_0x72af('0x63')]=qs[_0x72af('0x48')](_0x295be0[_0x72af('0x3e')][_0x72af('0x48')]);_0x822a32['where']=qs[_0x72af('0x40')](_[_0x72af('0x64')](_0x295be0[_0x72af('0x3e')],_0x1b9046['filters']));_0x822a32[_0x72af('0x49')]['OpenchannelAccountId']=_0x5ae8c7['id'];if(_0x295be0[_0x72af('0x3e')]['filter']){_0x822a32['where']=_['merge'](_0x822a32[_0x72af('0x49')],{'$or':_[_0x72af('0x39')](_0x822a32[_0x72af('0x42')],function(_0x58453d){var _0x4dbb74={};_0x4dbb74[_0x58453d]={'$like':'%'+_0x295be0[_0x72af('0x3e')][_0x72af('0x4a')]+'%'};return _0x4dbb74;})});}_0x822a32=_[_0x72af('0x4d')]({},_0x822a32,_0x295be0[_0x72af('0x4e')]);return db[_0x72af('0x60')][_0x72af('0x2f')]({'where':_0x822a32['where']})[_0x72af('0x1e')](function(_0x53831c){_0x44a4a2[_0x72af('0x2f')]=_0x53831c;if(_0x295be0[_0x72af('0x3e')]['includeAll']){_0x822a32['include']=[{'all':!![]}];}return db[_0x72af('0x60')][_0x72af('0x51')](_0x822a32);})[_0x72af('0x1e')](function(_0x441e29){_0x44a4a2[_0x72af('0x52')]=_0x441e29;return _0x44a4a2;});}})[_0x72af('0x1e')](respondWithFilteredResult(_0x3074ba,_0x822a32))['catch'](handleError(_0x3074ba,null));};exports[_0x72af('0x65')]=function(_0x1fbe79,_0x1725ae,_0xb1453e){return db[_0x72af('0x3a')][_0x72af('0x5a')]({'where':{'id':_0x1fbe79[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x1725ae,null))['then'](function(_0x4db802){if(_0x4db802){return _0x4db802[_0x72af('0x65')](_0x1fbe79[_0x72af('0x3e')][_0x72af('0x66')]);}})[_0x72af('0x1e')](respondWithStatusCode(_0x1725ae,null))[_0x72af('0x28')](handleError(_0x1725ae,null));};exports[_0x72af('0x67')]=function(_0xc4b913,_0x1fa79c,_0x21182f){if(_0xc4b913['body']['id']){delete _0xc4b913[_0x72af('0x57')]['id'];}return db[_0x72af('0x3a')]['find']({'where':{'id':_0xc4b913[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x1fa79c,null))[_0x72af('0x1e')](function(_0x24a8f2){if(_0x24a8f2){_0xc4b913[_0x72af('0x57')][_0x72af('0x68')]=_0x24a8f2['id'];return db[_0x72af('0x69')][_0x72af('0x56')](_0xc4b913[_0x72af('0x57')]);}})[_0x72af('0x1e')](respondWithResult(_0x1fa79c,null))['catch'](handleError(_0x1fa79c,null));};exports[_0x72af('0x6a')]=function(_0x3d552e,_0x56f47c,_0x153846){var _0x1e0f2c={'raw':![],'where':{}};var _0x799c73={};var _0x361d88={'count':0x0,'rows':[]};return db[_0x72af('0x3a')][_0x72af('0x62')]({'where':{'id':_0x3d552e['params']['id']}})['then'](handleEntityNotFound(_0x56f47c,null))[_0x72af('0x1e')](function(_0x2138bc){if(_0x2138bc){_0x799c73['model']=_[_0x72af('0x3f')](db[_0x72af('0x69')][_0x72af('0x3b')]);_0x799c73[_0x72af('0x3e')]=_[_0x72af('0x3f')](_0x3d552e['query']);_0x799c73[_0x72af('0x40')]=_[_0x72af('0x43')](_0x799c73[_0x72af('0x41')],_0x799c73['query']);_0x1e0f2c[_0x72af('0x42')]=_['intersection'](_0x799c73['model'],qs[_0x72af('0x44')](_0x3d552e[_0x72af('0x3e')]['fields']));_0x1e0f2c['attributes']=_0x1e0f2c[_0x72af('0x42')]['length']?_0x1e0f2c['attributes']:_0x799c73['model'];if(!_0x3d552e['query'][_0x72af('0x46')](_0x72af('0x47'))){_0x1e0f2c[_0x72af('0x2e')]=qs[_0x72af('0x2e')](_0x3d552e['query'][_0x72af('0x2e')]);_0x1e0f2c[_0x72af('0x2c')]=qs[_0x72af('0x2c')](_0x3d552e['query'][_0x72af('0x2c')]);}_0x1e0f2c[_0x72af('0x63')]=qs[_0x72af('0x48')](_0x3d552e['query'][_0x72af('0x48')]);_0x1e0f2c[_0x72af('0x49')]=qs['filters'](_['pick'](_0x3d552e['query'],_0x799c73['filters']));_0x1e0f2c[_0x72af('0x49')][_0x72af('0x68')]=_0x2138bc['id'];if(_0x3d552e['query']['filter']){_0x1e0f2c[_0x72af('0x49')]=_['merge'](_0x1e0f2c[_0x72af('0x49')],{'$or':_[_0x72af('0x39')](_0x1e0f2c[_0x72af('0x42')],function(_0x5bf10c){var _0x3f75e9={};_0x3f75e9[_0x5bf10c]={'$like':'%'+_0x3d552e[_0x72af('0x3e')]['filter']+'%'};return _0x3f75e9;})});}_0x1e0f2c=_[_0x72af('0x4d')]({},_0x1e0f2c,_0x3d552e[_0x72af('0x4e')]);return db[_0x72af('0x69')][_0x72af('0x2f')]({'where':_0x1e0f2c[_0x72af('0x49')]})[_0x72af('0x1e')](function(_0x4399bd){_0x361d88['count']=_0x4399bd;if(_0x3d552e['query'][_0x72af('0x4f')]){_0x1e0f2c[_0x72af('0x50')]=[{'all':!![]}];}return db[_0x72af('0x69')][_0x72af('0x51')](_0x1e0f2c);})[_0x72af('0x1e')](function(_0x3ce07a){_0x361d88[_0x72af('0x52')]=_0x3ce07a;return _0x361d88;});}})[_0x72af('0x1e')](respondWithFilteredResult(_0x56f47c,_0x1e0f2c))[_0x72af('0x28')](handleError(_0x56f47c,null));};exports[_0x72af('0x6b')]=function(_0x215bad,_0x2391fe,_0x29cba9){return db['OpenchannelAccount'][_0x72af('0x5a')]({'where':{'id':_0x215bad[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x2391fe,null))[_0x72af('0x1e')](function(_0x4c9bc7){if(_0x4c9bc7){return _0x4c9bc7[_0x72af('0x6b')](_0x215bad[_0x72af('0x3e')][_0x72af('0x66')]);}})[_0x72af('0x1e')](respondWithStatusCode(_0x2391fe,null))[_0x72af('0x28')](handleError(_0x2391fe,null));};exports[_0x72af('0x6c')]=function(_0x1e1a06,_0x5105f1,_0x2f7f91){var _0x84d79d={'body':_0x1e1a06['body'],'channel':_0x72af('0x6d')};var _0x8a95f4=[];var _0x439190=[];var _0x30dcb0={};var _0x21807b=![];return db[_0x72af('0x6e')][_0x72af('0x5e')]()[_0x72af('0x1e')](function(_0x460757){if(!_0x460757){throw new db[(_0x72af('0x6f'))][(_0x72af('0x70'))](_0x72af('0x71'));}_0x8a95f4=_['difference'](_[_0x72af('0x3f')](_0x460757),[_0x72af('0x72'),'updatedAt']);_0x439190=_['difference'](_['keys'](_0x460757),[_0x72af('0x72'),_0x72af('0x73'),_0x72af('0x74'),'ListId']);if(_0x1e1a06[_0x72af('0x57')]['id']){delete _0x1e1a06[_0x72af('0x57')]['id'];}if(_[_0x72af('0x75')](_0x1e1a06[_0x72af('0x57')][_0x72af('0x76')])){throw new db[(_0x72af('0x6f'))][(_0x72af('0x70'))](_0x72af('0x77'));}if(_[_0x72af('0x75')](_0x1e1a06[_0x72af('0x57')][_0x72af('0x57')])||_0x1e1a06['body']['body']===''){throw new db['Sequelize'][(_0x72af('0x70'))](_0x72af('0x78'));}if(_[_0x72af('0x75')](_0x1e1a06['body'][_0x72af('0x79')])){throw new db[(_0x72af('0x6f'))]['ValidationError'](_0x72af('0x7a')+_0x439190);}if(!_['includes'](_0x439190,_0x1e1a06[_0x72af('0x57')][_0x72af('0x79')])){throw new db[(_0x72af('0x6f'))]['ValidationError'](_0x72af('0x7b')+_0x439190);}_0x30dcb0[_0x1e1a06[_0x72af('0x57')][_0x72af('0x79')]]=_0x1e1a06[_0x72af('0x57')][_0x72af('0x76')];})[_0x72af('0x1e')](function(){return db[_0x72af('0x3a')][_0x72af('0x5a')]({'where':{'id':_0x1e1a06[_0x72af('0x54')]['id']},'include':[{'model':db[_0x72af('0x7c')],'as':_0x72af('0x7d'),'include':[{'model':db[_0x72af('0x6e')],'as':_0x72af('0x7e'),'where':_0x30dcb0,'limit':0x1,'order':[[_0x72af('0x73'),_0x72af('0x7f')]]}]},{'model':db[_0x72af('0x80')],'as':'Applications'}]});})[_0x72af('0x1e')](handleEntityNotFound(_0x5105f1,null))['then'](function(_0x1d8302){if(_0x1d8302&&_0x1d8302['List']){_0x84d79d[_0x72af('0x81')]=_0x1d8302;_0x84d79d[_0x72af('0x82')]=_0x1d8302[_0x72af('0x83')];_0x84d79d[_0x72af('0x84')]=_0x1d8302['List'];_0x84d79d[_0x72af('0x82')]=_[_0x72af('0x85')](_0x84d79d[_0x72af('0x82')],[_0x72af('0x86')],[_0x72af('0x87')]);if(_0x84d79d['account'][_0x72af('0x83')]){delete _0x84d79d[_0x72af('0x81')][_0x72af('0x83')];}if(_0x84d79d[_0x72af('0x81')][_0x72af('0x7d')]&&_0x84d79d[_0x72af('0x81')][_0x72af('0x7d')]['Contacts']['length']){return _0x84d79d[_0x72af('0x81')][_0x72af('0x7d')][_0x72af('0x7e')][0x0];}var _0x47f77b=_[_0x72af('0x16')](_0x1e1a06[_0x72af('0x57')],{'firstName':_0x1e1a06[_0x72af('0x57')][_0x72af('0x76')],'ListId':_0x1d8302[_0x72af('0x88')]});_0x47f77b[_0x1e1a06[_0x72af('0x57')][_0x72af('0x79')]]=_0x1e1a06[_0x72af('0x57')][_0x72af('0x76')];return db[_0x72af('0x6e')]['create'](_0x47f77b,{'fields':_0x8a95f4,'raw':!![]});}})[_0x72af('0x1e')](handleEntityNotFound(_0x5105f1,null))[_0x72af('0x1e')](function(_0xc6b05b){_0x84d79d['contact']=_0xc6b05b;if(_0xc6b05b){var _0x3099ca={'ContactId':_0xc6b05b['id'],'OpenchannelAccountId':_0x1e1a06[_0x72af('0x54')]['id'],'from':(_0xc6b05b[_0x72af('0x89')]||'')+'\x20'+(_0xc6b05b['lastName']||'')};var _0x4b0ff6={'OpenchannelAccountId':_0x1e1a06[_0x72af('0x54')]['id'],'closed':![]};if(_0x1e1a06['body']['threadId']){_0x4b0ff6[_0x72af('0x8a')]=_0x1e1a06['body'][_0x72af('0x8a')];return db[_0x72af('0x8b')][_0x72af('0x5a')]({'where':_0x4b0ff6})[_0x72af('0x1e')](function(_0x459b1c){if(_0x459b1c){return[_0x459b1c,![]];}_0x3099ca['threadId']=_0x1e1a06['body']['threadId'];_0x3099ca[_0x72af('0x8c')]=_0x1e1a06['body'][_0x72af('0x8c')];return db[_0x72af('0x8b')][_0x72af('0x56')](_0x3099ca)[_0x72af('0x1e')](function(_0x3dc5a9){return[_0x3dc5a9,!![]];});});}else{_0x4b0ff6[_0x72af('0x8a')]=null;}_0x4b0ff6[_0x72af('0x8d')]=_0xc6b05b['id'];return db[_0x72af('0x8b')][_0x72af('0x5a')]({'where':_0x4b0ff6})[_0x72af('0x1e')](function(_0x183fec){if(_0x183fec){return[_0x183fec,![]];}return db[_0x72af('0x8b')][_0x72af('0x56')](_0x3099ca)['then'](function(_0x50d5ae){return[_0x50d5ae,!![]];});});}})['spread'](function(_0x4d525,_0x2dd85f){if(_0x4d525){_0x21807b=_0x2dd85f;if(!_0x2dd85f){var _0x1d5251={'from':(_0x84d79d['contact'][_0x72af('0x89')]||'')+'\x20'+(_0x84d79d[_0x72af('0x8e')][_0x72af('0x8f')]||'')};if(_0x1e1a06[_0x72af('0x57')][_0x72af('0x8a')]&&_0x1e1a06[_0x72af('0x57')][_0x72af('0x90')]&&_0x1e1a06['body'][_0x72af('0x8a')]!=_0x1e1a06[_0x72af('0x57')][_0x72af('0x90')]){_0x1d5251[_0x72af('0x8a')]=_0x1e1a06[_0x72af('0x57')][_0x72af('0x90')];}return _0x4d525[_0x72af('0x5d')](_0x1d5251);}else{return _0x4d525;}}})[_0x72af('0x1e')](function(_0x46933b){_0x84d79d[_0x72af('0x91')]=_0x46933b[_0x72af('0x34')]({'plain':!![]});_0x84d79d['interaction']['created']=_0x21807b;if(_0x84d79d[_0x72af('0x91')][_0x72af('0x92')]){if(_0x84d79d['account']['autoclose']){_0x84d79d[_0x72af('0x82')][_0x72af('0x93')]({'id':0x0,'priority':_0x84d79d['applications'][_0x72af('0x45')]+0x1,'app':_0x72af('0x94'),'appdata':_0x72af('0x95'),'interval':_0x72af('0x96')});}}return db[_0x72af('0x97')][_0x72af('0x56')]({'body':_0x1e1a06['body'][_0x72af('0x57')],'OpenchannelAccountId':_0x1e1a06[_0x72af('0x54')]['id'],'OpenchannelInteractionId':_0x46933b['id'],'direction':'in','ContactId':_0x84d79d[_0x72af('0x8e')]['id'],'AttachmentId':_0x1e1a06[_0x72af('0x57')]['AttachmentId']});})[_0x72af('0x1e')](function(_0xa54f90){_0x84d79d[_0x72af('0x26')]=_0xa54f90;if(_0x84d79d[_0x72af('0x91')]['UserId']){return db[_0x72af('0x98')][_0x72af('0x5a')]({'attributes':['id','name'],'where':{'id':_0x84d79d['interaction'][_0x72af('0x99')]}})['then'](function(_0x58f9a8){if(_0x58f9a8){_0x84d79d[_0x72af('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':_0x72af('0x9a'),'appdata':_0x58f9a8[_0x72af('0x37')]+','+(_0x84d79d[_0x72af('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0x72af('0x96')});_0x84d79d[_0x72af('0x9b')]=![];}return respondWithRpcPromise(_0x72af('0x9c'),_0x72af('0x9d'),_0x84d79d);});}return respondWithRpcPromise(_0x72af('0x9c'),_0x72af('0x9d'),_0x84d79d);})[_0x72af('0x1e')](function(_0x5be022){respondWithRpcPromise(_0x72af('0x9e'),_0x72af('0x9e'),{'event':_0x72af('0x6c'),'message':_0x5be022},client9002);return _0x5be022;})[_0x72af('0x1e')](respondWithResult(_0x5105f1,null))[_0x72af('0x28')](handleError(_0x5105f1,null));};exports[_0x72af('0x9f')]=function(_0x4e58dd,_0x145a5e){var _0x1695fd=_0x4e58dd[_0x72af('0x54')]['id'];var _0x340490=_0x4e58dd['body'];var _0x3b70b0=0xc8;var _0x4fa13c=null;return db[_0x72af('0xa0')][_0x72af('0xa1')]({'isolationLevel':db[_0x72af('0xa0')]['Transaction'][_0x72af('0xa2')][_0x72af('0xa3')]},function(_0x5d6db6){return db[_0x72af('0x3a')]['findOne']({'where':{'id':_0x1695fd},'transaction':_0x5d6db6})[_0x72af('0x1e')](function(_0x4a4588){if(_0x4a4588){return db[_0x72af('0x80')][_0x72af('0x33')]({'where':{'OpenchannelAccountId':_0x1695fd},'transaction':_0x5d6db6})[_0x72af('0x1e')](function(){var _0x57ce22=_[_0x72af('0x39')](_0x340490,function(_0x5a63d1){_0x5a63d1[_0x72af('0x68')]=_0x1695fd;return _0x5a63d1;});return db[_0x72af('0x80')]['bulkCreate'](_0x57ce22,{'transaction':_0x5d6db6});});}else{_0x3b70b0=0x194;_0x4fa13c=[];}});})[_0x72af('0x1e')](function(){if(_0x3b70b0!==0x194){return db[_0x72af('0x80')][_0x72af('0xa4')]({'where':{'OpenchannelAccountId':_0x1695fd},'order':_0x72af('0x86')})[_0x72af('0x1e')](function(_0x13e325){_0x4fa13c=_0x13e325;});}})[_0x72af('0x28')](function(_0x59c113){_0x3b70b0=0x1f4;logger['error'](_0x59c113[_0x72af('0xa5')]);if(_0x59c113['name']){delete _0x59c113[_0x72af('0x37')];}_0x4fa13c=_0x59c113;})[_0x72af('0xa6')](function(){if(_0x4fa13c===null){_0x145a5e[_0x72af('0x29')](_0x3b70b0);}else{if(_0x3b70b0===0x1f4){_0x145a5e[_0x72af('0x2a')](_0x3b70b0)['send'](_0x4fa13c);}else{_0x145a5e['status'](_0x3b70b0)[_0x72af('0x2b')](_0x4fa13c);}}});};exports['getApplications']=function(_0x6b78fd,_0x3da2d8,_0x45de1f){var _0x2a60b6={};var _0xd8603e={};var _0x3b1de2;var _0x40ead5;return db['OpenchannelAccount'][_0x72af('0x62')]({'where':{'id':_0x6b78fd['params']['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x3da2d8,null))[_0x72af('0x1e')](function(_0x13fe41){if(_0x13fe41){_0x3b1de2=_0x13fe41;_0xd8603e[_0x72af('0x41')]=_['keys'](db['OpenchannelApplication'][_0x72af('0x3b')]);_0xd8603e[_0x72af('0x3e')]=_[_0x72af('0x3f')](_0x6b78fd[_0x72af('0x3e')]);_0xd8603e[_0x72af('0x40')]=_[_0x72af('0x43')](_0xd8603e[_0x72af('0x41')],_0xd8603e[_0x72af('0x3e')]);_0x2a60b6[_0x72af('0x42')]=_[_0x72af('0x43')](_0xd8603e['model'],qs[_0x72af('0x44')](_0x6b78fd['query'][_0x72af('0x44')]));_0x2a60b6[_0x72af('0x42')]=_0x2a60b6[_0x72af('0x42')]['length']?_0x2a60b6[_0x72af('0x42')]:_0xd8603e[_0x72af('0x41')];_0x2a60b6[_0x72af('0x63')]=qs[_0x72af('0x48')](_0x6b78fd[_0x72af('0x3e')]['sort']);_0x2a60b6[_0x72af('0x49')]=qs['filters'](_[_0x72af('0x64')](_0x6b78fd['query'],_0xd8603e[_0x72af('0x40')]));if(_0x6b78fd[_0x72af('0x3e')]['filter']){_0x2a60b6[_0x72af('0x49')]=_[_0x72af('0x4d')](_0x2a60b6[_0x72af('0x49')],{'$or':_[_0x72af('0x39')](_0x2a60b6['attributes'],function(_0x2e5a81){var _0x50b544={};_0x50b544[_0x2e5a81]={'$like':'%'+_0x6b78fd[_0x72af('0x3e')]['filter']+'%'};return _0x50b544;})});}_0x2a60b6=_[_0x72af('0x4d')]({},_0x2a60b6,_0x6b78fd[_0x72af('0x4e')]);return _0x3b1de2[_0x72af('0xa7')](_0x2a60b6);}})[_0x72af('0x1e')](function(_0x3ff7b7){if(_0x3ff7b7){_0x40ead5=_0x3ff7b7[_0x72af('0x45')];if(!_0x6b78fd[_0x72af('0x3e')][_0x72af('0x46')](_0x72af('0x47'))){_0x2a60b6[_0x72af('0x2e')]=qs['limit'](_0x6b78fd[_0x72af('0x3e')]['limit']);_0x2a60b6['offset']=qs[_0x72af('0x2c')](_0x6b78fd[_0x72af('0x3e')]['offset']);}return _0x3b1de2[_0x72af('0xa7')](_0x2a60b6);}})['then'](function(_0x194e43){if(_0x194e43){return _0x194e43?{'count':_0x40ead5,'rows':_0x194e43}:null;}})['then'](respondWithResult(_0x3da2d8,null))[_0x72af('0x28')](handleError(_0x3da2d8,null));};exports['getInteractions']=function(_0x4fa5f7,_0x13a8c5,_0x47c2af){var _0x41fb86={'raw':![],'where':{}};var _0x1809b5={};var _0x1baa21={'count':0x0,'rows':[]};return db[_0x72af('0x3a')]['findOne']({'where':{'id':_0x4fa5f7[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x13a8c5,null))[_0x72af('0x1e')](function(_0x144d2c){if(_0x144d2c){_0x1809b5[_0x72af('0x41')]=_['keys'](db[_0x72af('0x8b')][_0x72af('0x3b')]);_0x1809b5[_0x72af('0x3e')]=_[_0x72af('0x3f')](_0x4fa5f7[_0x72af('0x3e')]);_0x1809b5[_0x72af('0x40')]=_[_0x72af('0x43')](_0x1809b5['model'],_0x1809b5[_0x72af('0x3e')]);_0x41fb86['attributes']=_[_0x72af('0x43')](_0x1809b5[_0x72af('0x41')],qs[_0x72af('0x44')](_0x4fa5f7[_0x72af('0x3e')]['fields']));_0x41fb86[_0x72af('0x42')]=_0x41fb86[_0x72af('0x42')]['length']?_0x41fb86[_0x72af('0x42')]:_0x1809b5[_0x72af('0x41')];if(!_0x4fa5f7[_0x72af('0x3e')]['hasOwnProperty']('nolimit')){_0x41fb86[_0x72af('0x2e')]=qs[_0x72af('0x2e')](_0x4fa5f7[_0x72af('0x3e')][_0x72af('0x2e')]);_0x41fb86['offset']=qs[_0x72af('0x2c')](_0x4fa5f7[_0x72af('0x3e')]['offset']);}_0x41fb86['order']=qs[_0x72af('0x48')](_0x4fa5f7['query'][_0x72af('0x48')]);_0x41fb86[_0x72af('0x49')]=qs['filters'](_['pick'](_0x4fa5f7['query'],_0x1809b5['filters']));_0x41fb86[_0x72af('0x49')][_0x72af('0x68')]=_0x144d2c['id'];if(_0x4fa5f7[_0x72af('0x3e')][_0x72af('0x4a')]){_0x41fb86[_0x72af('0x49')]=_[_0x72af('0x4d')](_0x41fb86[_0x72af('0x49')],{'$or':_['map'](_0x41fb86['attributes'],function(_0xcf751d){var _0x465c81={};_0x465c81[_0xcf751d]={'$like':'%'+_0x4fa5f7['query'][_0x72af('0x4a')]+'%'};return _0x465c81;})});}_0x41fb86=_[_0x72af('0x4d')]({},_0x41fb86,_0x4fa5f7['options']);return db['OpenchannelInteraction'][_0x72af('0x2f')]({'where':_0x41fb86['where']})[_0x72af('0x1e')](function(_0x3d66f9){_0x1baa21[_0x72af('0x2f')]=_0x3d66f9;if(_0x4fa5f7[_0x72af('0x3e')][_0x72af('0x4f')]){_0x41fb86[_0x72af('0x50')]=[{'model':db[_0x72af('0x6e')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x72af('0x37'),_0x72af('0xa8'),_0x72af('0xa9')],'required':![]},{'model':db[_0x72af('0xaa')],'as':_0x72af('0xab'),'attributes':['id','name','color'],'where':_0x4fa5f7[_0x72af('0x3e')][_0x72af('0xac')]?{'id':_0x4fa5f7[_0x72af('0x3e')][_0x72af('0xac')]}:undefined,'required':_0x4fa5f7[_0x72af('0x3e')][_0x72af('0xac')]?!![]:![]}];}return db[_0x72af('0x8b')][_0x72af('0x51')](_0x41fb86);})[_0x72af('0x1e')](function(_0x1f8c33){_0x1baa21[_0x72af('0x52')]=_0x1f8c33;return _0x1baa21;});}})[_0x72af('0x1e')](respondWithFilteredResult(_0x13a8c5,_0x41fb86))[_0x72af('0x28')](handleError(_0x13a8c5,null));};exports[_0x72af('0xad')]=function(_0x8188ec,_0x32e38b,_0x204952){return db['OpenchannelAccount'][_0x72af('0x5a')]({'where':{'id':_0x8188ec[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x32e38b,null))[_0x72af('0x1e')](function(_0x5dd93c){if(_0x5dd93c){return _0x5dd93c[_0x72af('0xad')](_0x8188ec[_0x72af('0x57')]['ids'],_[_0x72af('0xae')](_0x8188ec['body'],['ids','id'])||{})[_0x72af('0xaf')](function(_0xc4491d){for(var _0x1ffa6e=0x0;_0x1ffa6e<_0x8188ec['body'][_0x72af('0x66')][_0x72af('0x45')];_0x1ffa6e+=0x1){socket['emit'](_0x72af('0xb0'),{'UserId':Number(_0x8188ec[_0x72af('0x57')][_0x72af('0x66')][_0x1ffa6e]),'OpenchannelAccountId':Number(_0x8188ec['params']['id'])});}return _0xc4491d;});}})['then'](respondWithResult(_0x32e38b,null))[_0x72af('0x28')](handleError(_0x32e38b,null));};exports[_0x72af('0xb1')]=function(_0xc78485,_0x589c11,_0x54f74c){return db[_0x72af('0x3a')][_0x72af('0x5a')]({'where':{'id':_0xc78485[_0x72af('0x54')]['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x589c11,null))[_0x72af('0x1e')](function(_0x23621b){if(_0x23621b){return _0x23621b['removeAgents'](_0xc78485[_0x72af('0x3e')][_0x72af('0x66')])[_0x72af('0x1e')](function(){if(_['isArray'](_0xc78485['query'][_0x72af('0x66')])){for(var _0x570ada=0x0;_0x570ada<_0xc78485['query'][_0x72af('0x66')][_0x72af('0x45')];_0x570ada+=0x1){socket[_0x72af('0xb2')](_0x72af('0xb3'),{'UserId':Number(_0xc78485[_0x72af('0x3e')][_0x72af('0x66')][_0x570ada]),'OpenchannelAccountId':Number(_0xc78485[_0x72af('0x54')]['id'])});}}else{socket[_0x72af('0xb2')](_0x72af('0xb3'),{'UserId':Number(_0xc78485['query'][_0x72af('0x66')]),'OpenchannelAccountId':Number(_0xc78485[_0x72af('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x589c11,null))[_0x72af('0x28')](handleError(_0x589c11,null));};exports[_0x72af('0xb4')]=function(_0x3fb43f,_0x28cead,_0x3e58a9){var _0x36a57b={};var _0x36d30d={};var _0x3d2e91;var _0x2f0e3f;return db['OpenchannelAccount'][_0x72af('0x62')]({'where':{'id':_0x3fb43f['params']['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x28cead,null))[_0x72af('0x1e')](function(_0x4f0026){if(_0x4f0026){_0x3d2e91=_0x4f0026;_0x36d30d[_0x72af('0x41')]=_[_0x72af('0x3f')](db[_0x72af('0x98')][_0x72af('0x3b')]);_0x36d30d[_0x72af('0x3e')]=_[_0x72af('0x3f')](_0x3fb43f['query']);_0x36d30d[_0x72af('0x40')]=_[_0x72af('0x43')](_0x36d30d[_0x72af('0x41')],_0x36d30d['query']);_0x36a57b[_0x72af('0x42')]=_['intersection'](_0x36d30d[_0x72af('0x41')],qs['fields'](_0x3fb43f[_0x72af('0x3e')][_0x72af('0x44')]));_0x36a57b[_0x72af('0x42')]=_0x36a57b[_0x72af('0x42')][_0x72af('0x45')]?_0x36a57b[_0x72af('0x42')]:_0x36d30d['model'];_0x36a57b['order']=qs[_0x72af('0x48')](_0x3fb43f[_0x72af('0x3e')]['sort']);_0x36a57b[_0x72af('0x49')]=qs['filters'](_[_0x72af('0x64')](_0x3fb43f[_0x72af('0x3e')],_0x36d30d[_0x72af('0x40')]));if(_0x3fb43f[_0x72af('0x3e')][_0x72af('0x4a')]){_0x36a57b[_0x72af('0x49')]=_[_0x72af('0x4d')](_0x36a57b['where'],{'$or':_[_0x72af('0x39')](_0x36a57b[_0x72af('0x42')],function(_0x567a6f){var _0x4822de={};_0x4822de[_0x567a6f]={'$like':'%'+_0x3fb43f['query']['filter']+'%'};return _0x4822de;})});}_0x36a57b=_[_0x72af('0x4d')]({},_0x36a57b,_0x3fb43f['options']);return _0x3d2e91[_0x72af('0xb4')](_0x36a57b);}})[_0x72af('0x1e')](function(_0x59517b){if(_0x59517b){_0x2f0e3f=_0x59517b[_0x72af('0x45')];if(!_0x3fb43f['query'][_0x72af('0x46')](_0x72af('0x47'))){_0x36a57b[_0x72af('0x2e')]=qs[_0x72af('0x2e')](_0x3fb43f[_0x72af('0x3e')][_0x72af('0x2e')]);_0x36a57b[_0x72af('0x2c')]=qs[_0x72af('0x2c')](_0x3fb43f[_0x72af('0x3e')]['offset']);}return _0x3d2e91[_0x72af('0xb4')](_0x36a57b);}})[_0x72af('0x1e')](function(_0x22ef6e){if(_0x22ef6e){return _0x22ef6e?{'count':_0x2f0e3f,'rows':_0x22ef6e}:null;}})[_0x72af('0x1e')](respondWithResult(_0x28cead,null))[_0x72af('0x28')](handleError(_0x28cead,null));};exports[_0x72af('0xb5')]=function(_0x304b43,_0x236b87,_0x429d93){var _0xd259d4,_0x459fca,_0x36bd88;if(_[_0x72af('0x75')](_0x304b43[_0x72af('0x57')]['body'])||_0x304b43['body'][_0x72af('0x57')]===''){throw new db[(_0x72af('0x6f'))][(_0x72af('0x70'))](_0x72af('0x78'));}if(_[_0x72af('0x75')](_0x304b43['body']['to'])){}_0xd259d4=_0x304b43[_0x72af('0x57')]['to'];return db[_0x72af('0x3a')][_0x72af('0x62')]({'where':{'id':_0x304b43['params']['id']}})[_0x72af('0x1e')](handleEntityNotFound(_0x236b87,null))[_0x72af('0x1e')](function(_0x44fe19){if(_0x44fe19){return db[_0x72af('0x3a')][_0x72af('0x5a')]({'where':{'id':_0x44fe19['id']},'include':[{'model':db[_0x72af('0x7c')],'as':'List','include':[{'model':db[_0x72af('0x6e')],'as':'Contacts','where':{[_0x44fe19['mapKey']]:_0xd259d4},'limit':0x1,'order':[[_0x72af('0x73'),_0x72af('0x7f')]]}]}]})[_0x72af('0x1e')](handleEntityNotFound(_0x236b87,null))['then'](function(_0x5a5a56){if(_0x5a5a56&&_0x5a5a56['List']){_0x459fca=_0x5a5a56[_0x72af('0x34')]({'plain':!![]});if(_0x459fca[_0x72af('0x7d')]&&_0x459fca['List'][_0x72af('0x7e')]['length']){return _0x459fca['List'][_0x72af('0x7e')][0x0];}return db[_0x72af('0x6e')][_0x72af('0x56')](_[_0x72af('0x16')](_0x304b43[_0x72af('0x57')],{'firstName':_0xd259d4,[_0x5a5a56[_0x72af('0x79')]]:_0xd259d4,'phone':_0xd259d4,'ListId':_0x459fca[_0x72af('0x88')]}));}})[_0x72af('0x1e')](handleEntityNotFound(_0x236b87,null))[_0x72af('0x1e')](function(_0x4ace39){if(_0x4ace39){_0x36bd88=_0x4ace39;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x36bd88['id'],'closed':![],'OpenchannelAccountId':_0x459fca['id']}})[_0x72af('0x1e')](function(_0x3725e5){if(_0x3725e5){return[_0x3725e5,![]];}return db[_0x72af('0x8b')][_0x72af('0x56')]({'UserId':_0x304b43['user']['id'],'ContactId':_0x36bd88['id'],'OpenchannelAccountId':_0x459fca['id'],'lastMsgDirection':_0x72af('0xb6'),'Messages':[_[_0x72af('0x4d')](_0x304b43['body'],{'read':![],'body':_0x304b43['body'][_0x72af('0x57')],'OpenchannelAccountId':_0x459fca['id'],'UserId':_0x304b43[_0x72af('0x58')]['id'],'ContactId':_0x36bd88['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x345649){return[_0x345649,!![]];});});}})[_0x72af('0xaf')](function(_0x28bbee,_0x54c4c1){if(_0x54c4c1){return _0x28bbee;}return db['OpenchannelMessage'][_0x72af('0x56')](_[_0x72af('0x4d')](_0x304b43[_0x72af('0x57')],{'read':![],'body':_0x304b43[_0x72af('0x57')][_0x72af('0x57')],'OpenchannelAccountId':_0x459fca['id'],'OpenchannelInteractionId':_0x28bbee['id'],'UserId':_0x304b43['user']['id'],'ContactId':_0x36bd88['id']}))[_0x72af('0x1e')](function(_0x5ec223){_0x28bbee[_0x72af('0xb7')][_0x72af('0xb8')]=[];_0x28bbee[_0x72af('0xb7')]['Messages'][_0x72af('0x93')](_0x5ec223[_0x72af('0xb7')]);return _0x28bbee;});});}})[_0x72af('0x1e')](respondWithResult(_0x236b87,null))[_0x72af('0x28')](handleError(_0x236b87,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index c9521b4..8fe0ae6 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x324a3d,_0x89378){var _0x5f5323=function(_0x35ac36){while(--_0x35ac36){_0x324a3d['push'](_0x324a3d['shift']());}};_0x5f5323(++_0x89378);}(_0x54ef,0x112));var _0xf54e=function(_0x7c78b,_0x372311){_0x7c78b=_0x7c78b-0x0;var _0x54089d=_0x54ef[_0x7c78b];return _0x54089d;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4dba4d,_0x17d11f){var _0x2c11a6=function(_0x1b6d9c){while(--_0x1b6d9c){_0x4dba4d['push'](_0x4dba4d['shift']());}};_0x2c11a6(++_0x17d11f);}(_0x4522,0x1a0));var _0x2452=function(_0xf6998f,_0x5438d3){_0xf6998f=_0xf6998f-0x0;var _0x47ffd9=_0x4522[_0xf6998f];return _0x47ffd9;};'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 61c7586..bf4671f 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(_0x362e21,_0x4e0d72){var _0x575127=function(_0x4a009c){while(--_0x4a009c){_0x362e21['push'](_0x362e21['shift']());}};_0x575127(++_0x4e0d72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x271679,_0x8dd572){var _0x3773c1=function(_0x3fd309){while(--_0x3fd309){_0x271679['push'](_0x271679['shift']());}};_0x3773c1(++_0x8dd572);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 dfccbf2..7f0419e 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 _0x0972=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0972,0x64));var _0x2097=function(_0x2f2553,_0x3e2871){_0x2f2553=_0x2f2553-0x0;var _0x31b076=_0x0972[_0x2f2553];return _0x31b076;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});config[_0x2097('0xa')]=_['defaults'](config[_0x2097('0xa')],{'host':_0x2097('0xb'),'port':0x18eb});var socket=require(_0x2097('0xc'))(new Redis(config[_0x2097('0xa')]));require(_0x2097('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e0024,_0x3b8b76,_0x131f06){return new BPromise(function(_0x430754,_0x7baeb3){return client[_0x2097('0xe')](_0x2e0024,_0x131f06)[_0x2097('0xf')](function(_0x1d1166){logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));logger[_0x2097('0x13')](_0x2097('0x14'),_0x3b8b76,_0x2097('0x12'),JSON[_0x2097('0x15')](_0x1d1166));if(_0x1d1166[_0x2097('0x16')]){if(_0x1d1166[_0x2097('0x16')][_0x2097('0x17')]===0x1f4){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x1d1166['error'][_0x2097('0x18')]);return _0x7baeb3(_0x1d1166[_0x2097('0x16')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3b8b76,_0x1d1166[_0x2097('0x16')]['message']);return _0x430754(_0x1d1166[_0x2097('0x16')][_0x2097('0x18')]);}else{logger[_0x2097('0x10')](_0x2097('0x11'),_0x3b8b76,_0x2097('0x12'));_0x430754(_0x1d1166['result'][_0x2097('0x18')]);}})[_0x2097('0x19')](function(_0x451584){logger[_0x2097('0x16')](_0x2097('0x11'),_0x3b8b76,_0x451584);_0x7baeb3(_0x451584);});});} \ No newline at end of file +var _0xc36d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2c2c63,_0x4239f9){var _0x55cefe=function(_0x45799c){while(--_0x45799c){_0x2c2c63['push'](_0x2c2c63['shift']());}};_0x55cefe(++_0x4239f9);}(_0xc36d,0x7d));var _0xdc36=function(_0x570496,_0x26a150){_0x570496=_0x570496-0x0;var _0x1d4204=_0xc36d[_0x570496];return _0x1d4204;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var moment=require(_0xdc36('0x2'));var BPromise=require(_0xdc36('0x3'));var rs=require(_0xdc36('0x4'));var fs=require('fs');var Redis=require(_0xdc36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc36('0x6'));var logger=require(_0xdc36('0x7'))('rpc');var config=require(_0xdc36('0x8'));var jayson=require(_0xdc36('0x9'));var client=jayson[_0xdc36('0xa')][_0xdc36('0xb')]({'port':0x232a});config[_0xdc36('0xc')]=_['defaults'](config[_0xdc36('0xc')],{'host':_0xdc36('0xd'),'port':0x18eb});var socket=require(_0xdc36('0xe'))(new Redis(config[_0xdc36('0xc')]));require('./openchannelAccount.socket')[_0xdc36('0xf')](socket);function respondWithRpcPromise(_0x23956b,_0x573f8e,_0x1d0035){return new BPromise(function(_0x1cb73d,_0x2483bd){return client['request'](_0x23956b,_0x1d0035)[_0xdc36('0x10')](function(_0x18707d){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x573f8e,_0xdc36('0x11'));logger[_0xdc36('0x12')](_0xdc36('0x13'),_0x573f8e,_0xdc36('0x11'),JSON['stringify'](_0x18707d));if(_0x18707d[_0xdc36('0x14')]){if(_0x18707d[_0xdc36('0x14')][_0xdc36('0x15')]===0x1f4){logger[_0xdc36('0x14')](_0xdc36('0x16'),_0x573f8e,_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);return _0x2483bd(_0x18707d[_0xdc36('0x14')]['message']);}logger[_0xdc36('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x573f8e,_0x18707d['error']['message']);return _0x1cb73d(_0x18707d[_0xdc36('0x14')][_0xdc36('0x17')]);}else{logger['info'](_0xdc36('0x16'),_0x573f8e,_0xdc36('0x11'));_0x1cb73d(_0x18707d[_0xdc36('0x18')][_0xdc36('0x17')]);}})[_0xdc36('0x19')](function(_0x46783d){logger['error'](_0xdc36('0x16'),_0x573f8e,_0x46783d);_0x2483bd(_0x46783d);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c330214..12964a8 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 _0x195e=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x815712,_0x27a650){var _0x234dc8=function(_0x687a24){while(--_0x687a24){_0x815712['push'](_0x815712['shift']());}};_0x234dc8(++_0x27a650);}(_0x195e,0xfb));var _0xe195=function(_0x5057ce,_0x549c32){_0x5057ce=_0x5057ce-0x0;var _0x3a5581=_0x195e[_0x5057ce];return _0x3a5581;};'use strict';var OpenchannelAccountEvents=require(_0xe195('0x0'));var events=[_0xe195('0x1'),_0xe195('0x2'),_0xe195('0x3')];function createListener(_0x40fe4d,_0x3975a9){return function(_0x31ca3b){_0x3975a9[_0xe195('0x4')](_0x40fe4d,_0x31ca3b);};}function removeListener(_0x2243e9,_0x30011c){return function(){OpenchannelAccountEvents[_0xe195('0x5')](_0x2243e9,_0x30011c);};}exports[_0xe195('0x6')]=function(_0x11cc55){for(var _0x595c13=0x0,_0x2a1acc=events[_0xe195('0x7')];_0x595c13<_0x2a1acc;_0x595c13++){var _0x2ead59=events[_0x595c13];var _0x28c1a9=createListener(_0xe195('0x8')+_0x2ead59,_0x11cc55);OpenchannelAccountEvents['on'](_0x2ead59,_0x28c1a9);}}; \ No newline at end of file +var _0xc041=['./openchannelAccount.events','save','update','emit','removeListener','length','openchannelAccount:'];(function(_0x2edc14,_0x250107){var _0x34a92e=function(_0x1e74c8){while(--_0x1e74c8){_0x2edc14['push'](_0x2edc14['shift']());}};_0x34a92e(++_0x250107);}(_0xc041,0x1ea));var _0x1c04=function(_0x3366c5,_0x597f9a){_0x3366c5=_0x3366c5-0x0;var _0x18500d=_0xc041[_0x3366c5];return _0x18500d;};'use strict';var OpenchannelAccountEvents=require(_0x1c04('0x0'));var events=[_0x1c04('0x1'),'remove',_0x1c04('0x2')];function createListener(_0x5076ff,_0x11a024){return function(_0x15245e){_0x11a024[_0x1c04('0x3')](_0x5076ff,_0x15245e);};}function removeListener(_0x34577d,_0x1312d0){return function(){OpenchannelAccountEvents[_0x1c04('0x4')](_0x34577d,_0x1312d0);};}exports['register']=function(_0x2a7bb2){for(var _0x5acee0=0x0,_0x524f85=events[_0x1c04('0x5')];_0x5acee0<_0x524f85;_0x5acee0++){var _0x3613fe=events[_0x5acee0];var _0x41a0d3=createListener(_0x1c04('0x6')+_0x3613fe,_0x2a7bb2);OpenchannelAccountEvents['on'](_0x3613fe,_0x41a0d3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9635abc..09c5a87 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 _0x0f2c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','util','connect-timeout'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x0f2c,0x18a));var _0xc0f2=function(_0x4d3b42,_0x3eb19){_0x4d3b42=_0x4d3b42-0x0;var _0x5e0d42=_0x0f2c[_0x4d3b42];return _0x5e0d42;};'use strict';var multer=require('multer');var util=require(_0xc0f2('0x0'));var path=require('path');var timeout=require(_0xc0f2('0x1'));var express=require(_0xc0f2('0x2'));var router=express[_0xc0f2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc0f2('0x4'));var interaction=require(_0xc0f2('0x5'));var config=require(_0xc0f2('0x6'));var controller=require(_0xc0f2('0x7'));router[_0xc0f2('0x8')]('/',auth[_0xc0f2('0x9')](),controller[_0xc0f2('0xa')]);router[_0xc0f2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc0f2('0xb')]);router[_0xc0f2('0xc')]('/',auth['isAuthenticated'](),controller[_0xc0f2('0xd')]);router['put'](_0xc0f2('0xe'),auth[_0xc0f2('0x9')](),controller[_0xc0f2('0xf')]);router[_0xc0f2('0x10')](_0xc0f2('0xe'),auth[_0xc0f2('0x9')](),controller[_0xc0f2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3d3e=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x3d3e,0x141));var _0xe3d3=function(_0x40d49d,_0x59bcf6){_0x40d49d=_0x40d49d-0x0;var _0x49cb8e=_0x3d3e[_0x40d49d];return _0x49cb8e;};'use strict';var multer=require(_0xe3d3('0x0'));var util=require(_0xe3d3('0x1'));var path=require(_0xe3d3('0x2'));var timeout=require(_0xe3d3('0x3'));var express=require(_0xe3d3('0x4'));var router=express[_0xe3d3('0x5')]();var fs_extra=require(_0xe3d3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe3d3('0x7'));var controller=require(_0xe3d3('0x8'));router[_0xe3d3('0x9')]('/',auth[_0xe3d3('0xa')](),controller[_0xe3d3('0xb')]);router[_0xe3d3('0x9')]('/:id',auth[_0xe3d3('0xa')](),controller[_0xe3d3('0xc')]);router[_0xe3d3('0xd')]('/',auth[_0xe3d3('0xa')](),controller[_0xe3d3('0xe')]);router[_0xe3d3('0xf')](_0xe3d3('0x10'),auth[_0xe3d3('0xa')](),controller[_0xe3d3('0x11')]);router[_0xe3d3('0x12')]('/:id',auth[_0xe3d3('0xa')](),controller['destroy']);module[_0xe3d3('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9690946..bf32e4a 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 _0xd85f=['STRING','exports','noop','TEXT'];(function(_0x22af8a,_0x5cdd45){var _0x4ca03f=function(_0x32b3bb){while(--_0x32b3bb){_0x22af8a['push'](_0x22af8a['shift']());}};_0x4ca03f(++_0x5cdd45);}(_0xd85f,0xa5));var _0xfd85=function(_0x3cebf7,_0x455fac){_0x3cebf7=_0x3cebf7-0x0;var _0x2b2860=_0xd85f[_0x3cebf7];return _0x2b2860;};'use strict';var Sequelize=require('sequelize');module[_0xfd85('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd85('0x1')},'appdata':{'type':Sequelize[_0xfd85('0x2')]()},'description':{'type':Sequelize[_0xfd85('0x3')]},'interval':{'type':Sequelize[_0xfd85('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x30af=['noop','TEXT','STRING','sequelize','exports','INTEGER'];(function(_0x252911,_0x3a0aa7){var _0x4c6932=function(_0x340f79){while(--_0x340f79){_0x252911['push'](_0x252911['shift']());}};_0x4c6932(++_0x3a0aa7);}(_0x30af,0xdb));var _0xf30a=function(_0x1b68ff,_0x5e68a2){_0x1b68ff=_0x1b68ff-0x0;var _0x4b3b07=_0x30af[_0x1b68ff];return _0x4b3b07;};'use strict';var Sequelize=require(_0xf30a('0x0'));module[_0xf30a('0x1')]={'priority':{'type':Sequelize[_0xf30a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf30a('0x3')},'appdata':{'type':Sequelize[_0xf30a('0x4')]()},'description':{'type':Sequelize[_0xf30a('0x5')]},'interval':{'type':Sequelize[_0xf30a('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 886f3b9..a48db08 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 _0x6619=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','type','where','OpenchannelApplication','includeAll','include','findAll','rows','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x1729c5,_0x3e8797){var _0x5b3d6c=function(_0x5cc7b9){while(--_0x5cc7b9){_0x1729c5['push'](_0x1729c5['shift']());}};_0x5b3d6c(++_0x3e8797);}(_0x6619,0x1be));var _0x9661=function(_0x19eafc,_0x22b84a){_0x19eafc=_0x19eafc-0x0;var _0x56ff62=_0x6619[_0x19eafc];return _0x56ff62;};'use strict';var emlformat=require(_0x9661('0x0'));var rimraf=require(_0x9661('0x1'));var zipdir=require(_0x9661('0x2'));var jsonpatch=require(_0x9661('0x3'));var rp=require(_0x9661('0x4'));var moment=require('moment');var BPromise=require(_0x9661('0x5'));var Mustache=require('mustache');var util=require(_0x9661('0x6'));var path=require(_0x9661('0x7'));var sox=require('sox');var csv=require(_0x9661('0x8'));var ejs=require(_0x9661('0x9'));var fs=require('fs');var fs_extra=require(_0x9661('0xa'));var _=require(_0x9661('0xb'));var squel=require(_0x9661('0xc'));var crypto=require(_0x9661('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9661('0xe'));var toCsv=require(_0x9661('0x8'));var querystring=require(_0x9661('0xf'));var Papa=require(_0x9661('0x10'));var Redis=require('ioredis');var authService=require(_0x9661('0x11'));var qs=require(_0x9661('0x12'));var as=require(_0x9661('0x13'));var hardwareService=require(_0x9661('0x14'));var logger=require(_0x9661('0x15'))(_0x9661('0x16'));var utils=require(_0x9661('0x17'));var config=require(_0x9661('0x18'));var licenseUtil=require(_0x9661('0x19'));var db=require(_0x9661('0x1a'))['db'];function respondWithStatusCode(_0x4aff3a,_0x111944){_0x111944=_0x111944||0xcc;return function(_0x2cac04){if(_0x2cac04){return _0x4aff3a['sendStatus'](_0x111944);}return _0x4aff3a[_0x9661('0x1b')](_0x111944)['end']();};}function respondWithResult(_0x2227c4,_0x2d48a8){_0x2d48a8=_0x2d48a8||0xc8;return function(_0x4931a4){if(_0x4931a4){return _0x2227c4[_0x9661('0x1b')](_0x2d48a8)[_0x9661('0x1c')](_0x4931a4);}};}function respondWithFilteredResult(_0x5ae076,_0x110f62){return function(_0x3d06a6){if(_0x3d06a6){var _0x39d2bf=typeof _0x110f62['offset']===_0x9661('0x1d')&&typeof _0x110f62[_0x9661('0x1e')]==='undefined';var _0x5b5b81=_0x3d06a6[_0x9661('0x1f')];var _0x414eb5=_0x39d2bf?0x0:_0x110f62[_0x9661('0x20')];var _0x1d94a4=_0x39d2bf?_0x3d06a6[_0x9661('0x1f')]:_0x110f62[_0x9661('0x20')]+_0x110f62[_0x9661('0x1e')];var _0x28998e;if(_0x1d94a4>=_0x5b5b81){_0x1d94a4=_0x5b5b81;_0x28998e=0xc8;}else{_0x28998e=0xce;}_0x5ae076['status'](_0x28998e);return _0x5ae076[_0x9661('0x21')](_0x9661('0x22'),_0x414eb5+'-'+_0x1d94a4+'/'+_0x5b5b81)[_0x9661('0x1c')](_0x3d06a6);}return null;};}function patchUpdates(_0x4a37f2){return function(_0x5cd4fd){try{jsonpatch[_0x9661('0x23')](_0x5cd4fd,_0x4a37f2,!![]);}catch(_0x4e7103){return BPromise[_0x9661('0x24')](_0x4e7103);}return _0x5cd4fd[_0x9661('0x25')]();};}function saveUpdates(_0x332083,_0x2e8daa){return function(_0x3d685b){if(_0x3d685b){return _0x3d685b[_0x9661('0x26')](_0x332083)[_0x9661('0x27')](function(_0x233ed3){return _0x233ed3;});}return null;};}function removeEntity(_0x542138,_0xb88760){return function(_0x17dfb8){if(_0x17dfb8){return _0x17dfb8[_0x9661('0x28')]()[_0x9661('0x27')](function(){_0x542138[_0x9661('0x1b')](0xcc)[_0x9661('0x29')]();});}};}function handleEntityNotFound(_0x5a83ac,_0x24f87a){return function(_0x220bd0){if(!_0x220bd0){_0x5a83ac[_0x9661('0x2a')](0x194);}return _0x220bd0;};}function handleError(_0x3307ff,_0x4e7abe){_0x4e7abe=_0x4e7abe||0x1f4;return function(_0x8d63d3){logger[_0x9661('0x2b')](_0x8d63d3[_0x9661('0x2c')]);if(_0x8d63d3[_0x9661('0x2d')]){delete _0x8d63d3[_0x9661('0x2d')];}_0x3307ff[_0x9661('0x1b')](_0x4e7abe)[_0x9661('0x2e')](_0x8d63d3);};}exports[_0x9661('0x2f')]=function(_0x2eea0a,_0x53e30b){var _0xdfc324={},_0x5ac326={},_0xb6c566={'count':0x0,'rows':[]};var _0x16a48d=_[_0x9661('0x30')](db['OpenchannelApplication'][_0x9661('0x31')],function(_0xe295b3){return{'name':_0xe295b3[_0x9661('0x32')],'type':_0xe295b3['type'][_0x9661('0x33')]};});_0x5ac326[_0x9661('0x34')]=_[_0x9661('0x30')](_0x16a48d,'name');_0x5ac326[_0x9661('0x35')]=_[_0x9661('0x36')](_0x2eea0a[_0x9661('0x35')]);_0x5ac326[_0x9661('0x37')]=_[_0x9661('0x38')](_0x5ac326[_0x9661('0x34')],_0x5ac326[_0x9661('0x35')]);_0xdfc324[_0x9661('0x39')]=_[_0x9661('0x38')](_0x5ac326[_0x9661('0x34')],qs[_0x9661('0x3a')](_0x2eea0a['query']['fields']));_0xdfc324[_0x9661('0x39')]=_0xdfc324[_0x9661('0x39')][_0x9661('0x3b')]?_0xdfc324[_0x9661('0x39')]:_0x5ac326[_0x9661('0x34')];if(!_0x2eea0a['query'][_0x9661('0x3c')](_0x9661('0x3d'))){_0xdfc324[_0x9661('0x1e')]=qs[_0x9661('0x1e')](_0x2eea0a['query']['limit']);_0xdfc324[_0x9661('0x20')]=qs['offset'](_0x2eea0a[_0x9661('0x35')][_0x9661('0x20')]);}_0xdfc324[_0x9661('0x3e')]=qs['sort'](_0x2eea0a[_0x9661('0x35')]['sort']);_0xdfc324['where']=qs[_0x9661('0x37')](_[_0x9661('0x3f')](_0x2eea0a['query'],_0x5ac326[_0x9661('0x37')]),_0x16a48d);if(_0x2eea0a[_0x9661('0x35')][_0x9661('0x40')]){_0xdfc324['where']=_[_0x9661('0x41')](_0xdfc324['where'],{'$or':_['map'](_0x16a48d,function(_0x3d081d){if(_0x3d081d[_0x9661('0x42')]!=='VIRTUAL'){var _0xe62ccf={};_0xe62ccf[_0x3d081d[_0x9661('0x2d')]]={'$like':'%'+_0x2eea0a[_0x9661('0x35')][_0x9661('0x40')]+'%'};return _0xe62ccf;}})});}_0xdfc324=_[_0x9661('0x41')]({},_0xdfc324,_0x2eea0a['options']);var _0x53c2e9={'where':_0xdfc324[_0x9661('0x43')]};return db[_0x9661('0x44')]['count'](_0x53c2e9)['then'](function(_0x3dc1e3){_0xb6c566[_0x9661('0x1f')]=_0x3dc1e3;if(_0x2eea0a[_0x9661('0x35')][_0x9661('0x45')]){_0xdfc324[_0x9661('0x46')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9661('0x47')](_0xdfc324);})[_0x9661('0x27')](function(_0x1bcb3b){_0xb6c566[_0x9661('0x48')]=_0x1bcb3b;return _0xb6c566;})[_0x9661('0x27')](respondWithFilteredResult(_0x53e30b,_0xdfc324))['catch'](handleError(_0x53e30b,null));};exports['show']=function(_0x276ee1,_0x4b83f9){var _0x3dd958={'raw':!![],'where':{'id':_0x276ee1['params']['id']}},_0x1762ab={};_0x1762ab[_0x9661('0x34')]=_['keys'](db[_0x9661('0x44')]['rawAttributes']);_0x1762ab[_0x9661('0x35')]=_[_0x9661('0x36')](_0x276ee1['query']);_0x1762ab[_0x9661('0x37')]=_['intersection'](_0x1762ab[_0x9661('0x34')],_0x1762ab[_0x9661('0x35')]);_0x3dd958['attributes']=_[_0x9661('0x38')](_0x1762ab[_0x9661('0x34')],qs[_0x9661('0x3a')](_0x276ee1['query'][_0x9661('0x3a')]));_0x3dd958[_0x9661('0x39')]=_0x3dd958[_0x9661('0x39')][_0x9661('0x3b')]?_0x3dd958['attributes']:_0x1762ab[_0x9661('0x34')];if(_0x276ee1[_0x9661('0x35')][_0x9661('0x45')]){_0x3dd958[_0x9661('0x46')]=[{'all':!![]}];}_0x3dd958=_[_0x9661('0x41')]({},_0x3dd958,_0x276ee1[_0x9661('0x49')]);return db['OpenchannelApplication'][_0x9661('0x4a')](_0x3dd958)[_0x9661('0x27')](handleEntityNotFound(_0x4b83f9,null))[_0x9661('0x27')](respondWithResult(_0x4b83f9,null))[_0x9661('0x4b')](handleError(_0x4b83f9,null));};exports['create']=function(_0x958bd0,_0x5b8733){return db['OpenchannelApplication']['create'](_0x958bd0[_0x9661('0x4c')],{})['then'](respondWithResult(_0x5b8733,0xc9))['catch'](handleError(_0x5b8733,null));};exports['update']=function(_0x1f71c6,_0x4a06f3){if(_0x1f71c6['body']['id']){delete _0x1f71c6[_0x9661('0x4c')]['id'];}return db['OpenchannelApplication'][_0x9661('0x4a')]({'where':{'id':_0x1f71c6['params']['id']}})['then'](handleEntityNotFound(_0x4a06f3,null))['then'](saveUpdates(_0x1f71c6[_0x9661('0x4c')],null))['then'](respondWithResult(_0x4a06f3,null))[_0x9661('0x4b')](handleError(_0x4a06f3,null));};exports[_0x9661('0x28')]=function(_0x3d4fdd,_0x808f97){return db[_0x9661('0x44')]['find']({'where':{'id':_0x3d4fdd['params']['id']}})[_0x9661('0x27')](handleEntityNotFound(_0x808f97,null))[_0x9661('0x27')](removeEntity(_0x808f97,null))[_0x9661('0x4b')](handleError(_0x808f97,null));}; \ No newline at end of file +var _0x0fb7=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelApplication','rows','catch','show','params','length','include','create','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x136cbb,_0x2a97f9){var _0x333a69=function(_0x5dc5bb){while(--_0x5dc5bb){_0x136cbb['push'](_0x136cbb['shift']());}};_0x333a69(++_0x2a97f9);}(_0x0fb7,0x111));var _0x70fb=function(_0xcd2faa,_0x3ff70d){_0xcd2faa=_0xcd2faa-0x0;var _0x3b6e2d=_0x0fb7[_0xcd2faa];return _0x3b6e2d;};'use strict';var emlformat=require(_0x70fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x70fb('0x1'));var rp=require('request-promise');var moment=require(_0x70fb('0x2'));var BPromise=require(_0x70fb('0x3'));var Mustache=require(_0x70fb('0x4'));var util=require(_0x70fb('0x5'));var path=require(_0x70fb('0x6'));var sox=require(_0x70fb('0x7'));var csv=require(_0x70fb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70fb('0x9'));var _=require(_0x70fb('0xa'));var squel=require(_0x70fb('0xb'));var crypto=require(_0x70fb('0xc'));var jsforce=require(_0x70fb('0xd'));var deskjs=require(_0x70fb('0xe'));var toCsv=require(_0x70fb('0x8'));var querystring=require(_0x70fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x70fb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70fb('0x11'));var hardwareService=require(_0x70fb('0x12'));var logger=require('../../config/logger')(_0x70fb('0x13'));var utils=require(_0x70fb('0x14'));var config=require(_0x70fb('0x15'));var licenseUtil=require(_0x70fb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bdb7e,_0x36aa1e){_0x36aa1e=_0x36aa1e||0xcc;return function(_0x54384c){if(_0x54384c){return _0x4bdb7e[_0x70fb('0x17')](_0x36aa1e);}return _0x4bdb7e['status'](_0x36aa1e)[_0x70fb('0x18')]();};}function respondWithResult(_0x576391,_0x3c8d6f){_0x3c8d6f=_0x3c8d6f||0xc8;return function(_0x492897){if(_0x492897){return _0x576391[_0x70fb('0x19')](_0x3c8d6f)['json'](_0x492897);}};}function respondWithFilteredResult(_0x116796,_0x2bb214){return function(_0x20057b){if(_0x20057b){var _0x93644=typeof _0x2bb214['offset']==='undefined'&&typeof _0x2bb214[_0x70fb('0x1a')]===_0x70fb('0x1b');var _0x93812a=_0x20057b[_0x70fb('0x1c')];var _0x40953d=_0x93644?0x0:_0x2bb214[_0x70fb('0x1d')];var _0x57b7f8=_0x93644?_0x20057b[_0x70fb('0x1c')]:_0x2bb214[_0x70fb('0x1d')]+_0x2bb214['limit'];var _0x3829f4;if(_0x57b7f8>=_0x93812a){_0x57b7f8=_0x93812a;_0x3829f4=0xc8;}else{_0x3829f4=0xce;}_0x116796[_0x70fb('0x19')](_0x3829f4);return _0x116796[_0x70fb('0x1e')](_0x70fb('0x1f'),_0x40953d+'-'+_0x57b7f8+'/'+_0x93812a)[_0x70fb('0x20')](_0x20057b);}return null;};}function patchUpdates(_0x220e47){return function(_0x35369c){try{jsonpatch['apply'](_0x35369c,_0x220e47,!![]);}catch(_0x40130b){return BPromise['reject'](_0x40130b);}return _0x35369c[_0x70fb('0x21')]();};}function saveUpdates(_0x135d28,_0xca60a6){return function(_0xd691cb){if(_0xd691cb){return _0xd691cb[_0x70fb('0x22')](_0x135d28)['then'](function(_0x3b8bc7){return _0x3b8bc7;});}return null;};}function removeEntity(_0x31a8de,_0x5cd3b0){return function(_0x4cb952){if(_0x4cb952){return _0x4cb952[_0x70fb('0x23')]()[_0x70fb('0x24')](function(){_0x31a8de[_0x70fb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c55c9,_0xcd2398){return function(_0x12f160){if(!_0x12f160){_0x9c55c9['sendStatus'](0x194);}return _0x12f160;};}function handleError(_0x5b70b4,_0x1e1abe){_0x1e1abe=_0x1e1abe||0x1f4;return function(_0x88f071){logger['error'](_0x88f071[_0x70fb('0x25')]);if(_0x88f071[_0x70fb('0x26')]){delete _0x88f071[_0x70fb('0x26')];}_0x5b70b4[_0x70fb('0x19')](_0x1e1abe)[_0x70fb('0x27')](_0x88f071);};}exports[_0x70fb('0x28')]=function(_0x275efe,_0x3ece9d){var _0x4f157a={},_0x42b33d={},_0x165660={'count':0x0,'rows':[]};var _0x25afc6=_['map'](db['OpenchannelApplication'][_0x70fb('0x29')],function(_0x322a54){return{'name':_0x322a54[_0x70fb('0x2a')],'type':_0x322a54['type']['key']};});_0x42b33d[_0x70fb('0x2b')]=_[_0x70fb('0x2c')](_0x25afc6,'name');_0x42b33d[_0x70fb('0x2d')]=_['keys'](_0x275efe[_0x70fb('0x2d')]);_0x42b33d[_0x70fb('0x2e')]=_[_0x70fb('0x2f')](_0x42b33d[_0x70fb('0x2b')],_0x42b33d['query']);_0x4f157a[_0x70fb('0x30')]=_['intersection'](_0x42b33d[_0x70fb('0x2b')],qs[_0x70fb('0x31')](_0x275efe[_0x70fb('0x2d')][_0x70fb('0x31')]));_0x4f157a[_0x70fb('0x30')]=_0x4f157a[_0x70fb('0x30')]['length']?_0x4f157a['attributes']:_0x42b33d[_0x70fb('0x2b')];if(!_0x275efe[_0x70fb('0x2d')][_0x70fb('0x32')](_0x70fb('0x33'))){_0x4f157a[_0x70fb('0x1a')]=qs['limit'](_0x275efe[_0x70fb('0x2d')][_0x70fb('0x1a')]);_0x4f157a['offset']=qs[_0x70fb('0x1d')](_0x275efe['query'][_0x70fb('0x1d')]);}_0x4f157a['order']=qs[_0x70fb('0x34')](_0x275efe[_0x70fb('0x2d')][_0x70fb('0x34')]);_0x4f157a[_0x70fb('0x35')]=qs['filters'](_[_0x70fb('0x36')](_0x275efe[_0x70fb('0x2d')],_0x42b33d['filters']),_0x25afc6);if(_0x275efe[_0x70fb('0x2d')][_0x70fb('0x37')]){_0x4f157a['where']=_[_0x70fb('0x38')](_0x4f157a[_0x70fb('0x35')],{'$or':_['map'](_0x25afc6,function(_0x52e2af){if(_0x52e2af[_0x70fb('0x39')]!==_0x70fb('0x3a')){var _0x546504={};_0x546504[_0x52e2af[_0x70fb('0x26')]]={'$like':'%'+_0x275efe[_0x70fb('0x2d')][_0x70fb('0x37')]+'%'};return _0x546504;}})});}_0x4f157a=_['merge']({},_0x4f157a,_0x275efe[_0x70fb('0x3b')]);var _0x2b5322={'where':_0x4f157a[_0x70fb('0x35')]};return db[_0x70fb('0x3c')][_0x70fb('0x1c')](_0x2b5322)[_0x70fb('0x24')](function(_0x1b70d6){_0x165660[_0x70fb('0x1c')]=_0x1b70d6;if(_0x275efe['query']['includeAll']){_0x4f157a['include']=[{'all':!![]}];}return db[_0x70fb('0x3c')]['findAll'](_0x4f157a);})['then'](function(_0x21d7dd){_0x165660[_0x70fb('0x3d')]=_0x21d7dd;return _0x165660;})['then'](respondWithFilteredResult(_0x3ece9d,_0x4f157a))[_0x70fb('0x3e')](handleError(_0x3ece9d,null));};exports[_0x70fb('0x3f')]=function(_0x5393e2,_0x141458){var _0x22da36={'raw':!![],'where':{'id':_0x5393e2[_0x70fb('0x40')]['id']}},_0x47541b={};_0x47541b[_0x70fb('0x2b')]=_['keys'](db[_0x70fb('0x3c')][_0x70fb('0x29')]);_0x47541b[_0x70fb('0x2d')]=_['keys'](_0x5393e2[_0x70fb('0x2d')]);_0x47541b[_0x70fb('0x2e')]=_[_0x70fb('0x2f')](_0x47541b[_0x70fb('0x2b')],_0x47541b[_0x70fb('0x2d')]);_0x22da36[_0x70fb('0x30')]=_[_0x70fb('0x2f')](_0x47541b[_0x70fb('0x2b')],qs['fields'](_0x5393e2[_0x70fb('0x2d')][_0x70fb('0x31')]));_0x22da36[_0x70fb('0x30')]=_0x22da36['attributes'][_0x70fb('0x41')]?_0x22da36[_0x70fb('0x30')]:_0x47541b['model'];if(_0x5393e2[_0x70fb('0x2d')]['includeAll']){_0x22da36[_0x70fb('0x42')]=[{'all':!![]}];}_0x22da36=_[_0x70fb('0x38')]({},_0x22da36,_0x5393e2[_0x70fb('0x3b')]);return db[_0x70fb('0x3c')]['find'](_0x22da36)[_0x70fb('0x24')](handleEntityNotFound(_0x141458,null))[_0x70fb('0x24')](respondWithResult(_0x141458,null))[_0x70fb('0x3e')](handleError(_0x141458,null));};exports[_0x70fb('0x43')]=function(_0x48db22,_0x2dab19){return db['OpenchannelApplication']['create'](_0x48db22[_0x70fb('0x44')],{})[_0x70fb('0x24')](respondWithResult(_0x2dab19,0xc9))[_0x70fb('0x3e')](handleError(_0x2dab19,null));};exports[_0x70fb('0x22')]=function(_0x58c976,_0x17b45c){if(_0x58c976[_0x70fb('0x44')]['id']){delete _0x58c976[_0x70fb('0x44')]['id'];}return db['OpenchannelApplication'][_0x70fb('0x45')]({'where':{'id':_0x58c976[_0x70fb('0x40')]['id']}})[_0x70fb('0x24')](handleEntityNotFound(_0x17b45c,null))['then'](saveUpdates(_0x58c976[_0x70fb('0x44')],null))['then'](respondWithResult(_0x17b45c,null))[_0x70fb('0x3e')](handleError(_0x17b45c,null));};exports[_0x70fb('0x23')]=function(_0x3c153e,_0x4fa973){return db[_0x70fb('0x3c')][_0x70fb('0x45')]({'where':{'id':_0x3c153e[_0x70fb('0x40')]['id']}})[_0x70fb('0x24')](handleEntityNotFound(_0x4fa973,null))[_0x70fb('0x24')](removeEntity(_0x4fa973,null))[_0x70fb('0x3e')](handleError(_0x4fa973,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8cd3d00..2879ca2 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 _0x1590=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x1590,0x10e));var _0x0159=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1590[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x0159('0x0'));var util=require(_0x0159('0x1'));var logger=require(_0x0159('0x2'))(_0x0159('0x3'));var moment=require(_0x0159('0x4'));var BPromise=require(_0x0159('0x5'));var rp=require(_0x0159('0x6'));var fs=require('fs');var path=require(_0x0159('0x7'));var rimraf=require('rimraf');var config=require(_0x0159('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x0159('0x9')]=function(_0x214a46,_0x3b74ad){return _0x214a46[_0x0159('0xa')](_0x0159('0xb'),attributes,{'tableName':_0x0159('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0159('0xd'),'collate':_0x0159('0xe')});}; \ No newline at end of file +var _0xffaa=['utf8mb4_unicode_ci','lodash','util','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x532d5b,_0x4b6047){var _0x523f05=function(_0x130c20){while(--_0x130c20){_0x532d5b['push'](_0x532d5b['shift']());}};_0x523f05(++_0x4b6047);}(_0xffaa,0x1c9));var _0xaffa=function(_0x4915fe,_0x3f2d70){_0x4915fe=_0x4915fe-0x0;var _0x4e78e0=_0xffaa[_0x4915fe];return _0x4e78e0;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaffa('0x2'));var rimraf=require(_0xaffa('0x3'));var config=require(_0xaffa('0x4'));var attributes=require(_0xaffa('0x5'));module[_0xaffa('0x6')]=function(_0x23cf37,_0x3edf7a){return _0x23cf37[_0xaffa('0x7')](_0xaffa('0x8'),attributes,{'tableName':_0xaffa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaffa('0xa'),'collate':_0xaffa('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8d732bf..ae6bd3d 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 _0x0195=['options','raw','attributes','debug','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','UpdateOpenchannelApplication','OpenchannelApplication','body'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0x0195,0x13d));var _0x5019=function(_0x5edaf1,_0x5322d8){_0x5edaf1=_0x5edaf1-0x0;var _0x256476=_0x0195[_0x5edaf1];return _0x256476;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var moment=require(_0x5019('0x2'));var BPromise=require(_0x5019('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5019('0x4'))['db'];var utils=require(_0x5019('0x5'));var logger=require(_0x5019('0x6'))('rpc');var config=require(_0x5019('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5019('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45f258,_0x15ebf3,_0x4d46ca){return new BPromise(function(_0x32b2f4,_0x40faed){return client['request'](_0x45f258,_0x4d46ca)[_0x5019('0x9')](function(_0x582cf3){logger[_0x5019('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x15ebf3,_0x5019('0xb'));logger['debug'](_0x5019('0xc'),_0x15ebf3,_0x5019('0xb'),JSON[_0x5019('0xd')](_0x582cf3));if(_0x582cf3[_0x5019('0xe')]){if(_0x582cf3[_0x5019('0xe')][_0x5019('0xf')]===0x1f4){logger[_0x5019('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x15ebf3,_0x582cf3[_0x5019('0xe')][_0x5019('0x10')]);return _0x40faed(_0x582cf3[_0x5019('0xe')][_0x5019('0x10')]);}logger[_0x5019('0xe')](_0x5019('0x11'),_0x15ebf3,_0x582cf3['error'][_0x5019('0x10')]);return _0x32b2f4(_0x582cf3['error'][_0x5019('0x10')]);}else{logger[_0x5019('0xa')](_0x5019('0x11'),_0x15ebf3,_0x5019('0xb'));_0x32b2f4(_0x582cf3['result'][_0x5019('0x10')]);}})['catch'](function(_0x1534a5){logger[_0x5019('0xe')](_0x5019('0x11'),_0x15ebf3,_0x1534a5);_0x40faed(_0x1534a5);});});}exports[_0x5019('0x12')]=function(_0x42067d){var _0x54c85d=this;return new Promise(function(_0xa6adcf,_0x4058e7){return db[_0x5019('0x13')]['update'](_0x42067d[_0x5019('0x14')],{'raw':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')][_0x5019('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')]['where']||null:null,'attributes':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')][_0x5019('0x17')]||null:null,'limit':_0x42067d[_0x5019('0x15')]?_0x42067d[_0x5019('0x15')]['limit']||null:null})[_0x5019('0x9')](function(_0x5cb356){logger[_0x5019('0xa')](_0x5019('0x12'),_0x42067d);logger[_0x5019('0x18')]('UpdateOpenchannelApplication',_0x42067d,JSON[_0x5019('0xd')](_0x5cb356));_0xa6adcf(_0x5cb356);})[_0x5019('0x19')](function(_0x519db6){logger['error'](_0x5019('0x12'),_0x519db6[_0x5019('0x10')],_0x42067d);_0x4058e7(_0x54c85d[_0x5019('0xe')](0x1f4,_0x519db6[_0x5019('0x10')]));});});}; \ No newline at end of file +var _0x9d82=['catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x9d82,0x15b));var _0x29d8=function(_0x2e986a,_0x4e0078){_0x2e986a=_0x2e986a-0x0;var _0x54f21a=_0x9d82[_0x2e986a];return _0x54f21a;};'use strict';var _=require(_0x29d8('0x0'));var util=require('util');var moment=require(_0x29d8('0x1'));var BPromise=require(_0x29d8('0x2'));var rs=require(_0x29d8('0x3'));var fs=require('fs');var Redis=require(_0x29d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29d8('0x5'))(_0x29d8('0x6'));var config=require(_0x29d8('0x7'));var jayson=require(_0x29d8('0x8'));var client=jayson['client'][_0x29d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d5097,_0x2f3a5c,_0x1b2d6d){return new BPromise(function(_0x5f4cc1,_0x5c6fb6){return client['request'](_0x5d5097,_0x1b2d6d)['then'](function(_0x132be8){logger[_0x29d8('0xa')](_0x29d8('0xb'),_0x2f3a5c,_0x29d8('0xc'));logger[_0x29d8('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x2f3a5c,_0x29d8('0xc'),JSON['stringify'](_0x132be8));if(_0x132be8[_0x29d8('0xe')]){if(_0x132be8[_0x29d8('0xe')]['code']===0x1f4){logger['error'](_0x29d8('0xb'),_0x2f3a5c,_0x132be8['error']['message']);return _0x5c6fb6(_0x132be8[_0x29d8('0xe')]['message']);}logger[_0x29d8('0xe')](_0x29d8('0xb'),_0x2f3a5c,_0x132be8['error']['message']);return _0x5f4cc1(_0x132be8[_0x29d8('0xe')][_0x29d8('0xf')]);}else{logger['info'](_0x29d8('0xb'),_0x2f3a5c,_0x29d8('0xc'));_0x5f4cc1(_0x132be8[_0x29d8('0x10')][_0x29d8('0xf')]);}})[_0x29d8('0x11')](function(_0x332271){logger[_0x29d8('0xe')](_0x29d8('0xb'),_0x2f3a5c,_0x332271);_0x5c6fb6(_0x332271);});});}exports[_0x29d8('0x12')]=function(_0x58773f){var _0xbff06f=this;return new Promise(function(_0x3653b8,_0x2eaed8){return db[_0x29d8('0x13')][_0x29d8('0x14')](_0x58773f[_0x29d8('0x15')],{'raw':_0x58773f['options']?_0x58773f[_0x29d8('0x16')][_0x29d8('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58773f[_0x29d8('0x16')]?_0x58773f['options']['where']||null:null,'attributes':_0x58773f[_0x29d8('0x16')]?_0x58773f[_0x29d8('0x16')][_0x29d8('0x18')]||null:null,'limit':_0x58773f[_0x29d8('0x16')]?_0x58773f['options'][_0x29d8('0x19')]||null:null})[_0x29d8('0x1a')](function(_0x1fd30e){logger[_0x29d8('0xa')](_0x29d8('0x12'),_0x58773f);logger[_0x29d8('0xd')]('UpdateOpenchannelApplication',_0x58773f,JSON[_0x29d8('0x1b')](_0x1fd30e));_0x3653b8(_0x1fd30e);})[_0x29d8('0x11')](function(_0x4db7ba){logger[_0x29d8('0xe')](_0x29d8('0x12'),_0x4db7ba[_0x29d8('0xf')],_0x58773f);_0x2eaed8(_0xbff06f['error'](0x1f4,_0x4db7ba[_0x29d8('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index eb2787d..943c8c9 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 _0x3b92=['openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete'];(function(_0x15be4e,_0x28d775){var _0x27e898=function(_0x25b225){while(--_0x25b225){_0x15be4e['push'](_0x15be4e['shift']());}};_0x27e898(++_0x28d775);}(_0x3b92,0x85));var _0x23b9=function(_0x44cb5c,_0x4afe83){_0x44cb5c=_0x44cb5c-0x0;var _0x451357=_0x3b92[_0x44cb5c];return _0x451357;};'use strict';var multer=require(_0x23b9('0x0'));var util=require(_0x23b9('0x1'));var path=require(_0x23b9('0x2'));var timeout=require(_0x23b9('0x3'));var express=require(_0x23b9('0x4'));var router=express[_0x23b9('0x5')]();var fs_extra=require(_0x23b9('0x6'));var auth=require(_0x23b9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x23b9('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x23b9('0x9')]('/',auth[_0x23b9('0xa')](),controller[_0x23b9('0xb')]);router['get']('/describe',auth[_0x23b9('0xa')](),controller[_0x23b9('0xc')]);router[_0x23b9('0x9')](_0x23b9('0xd'),auth[_0x23b9('0xa')](),controller[_0x23b9('0xe')]);router[_0x23b9('0x9')](_0x23b9('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x23b9('0x9')](_0x23b9('0x10'),auth[_0x23b9('0xa')](),controller[_0x23b9('0x11')]);router[_0x23b9('0x12')]('/',auth[_0x23b9('0xa')](),controller['create']);router['post'](_0x23b9('0xf'),auth[_0x23b9('0xa')](),controller[_0x23b9('0x13')]);router[_0x23b9('0x12')]('/:id/tags',auth[_0x23b9('0xa')](),interaction[_0x23b9('0x14')](_0x23b9('0x15'),_0x23b9('0x16')),controller['addTags']);router[_0x23b9('0x17')]('/:id',auth[_0x23b9('0xa')](),interaction[_0x23b9('0x14')](_0x23b9('0x15'),_0x23b9('0x18')),controller[_0x23b9('0x19')]);router[_0x23b9('0x1a')](_0x23b9('0xd'),auth[_0x23b9('0xa')](),interaction[_0x23b9('0x14')](_0x23b9('0x15'),_0x23b9('0x1b')),controller[_0x23b9('0x1c')]);router[_0x23b9('0x1a')](_0x23b9('0x1d'),auth[_0x23b9('0xa')](),controller[_0x23b9('0x1e')]);module[_0x23b9('0x1f')]=router; \ No newline at end of file +var _0x17ea=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x62e05f,_0x2f5db4){var _0x44d8f0=function(_0x50b7ff){while(--_0x50b7ff){_0x62e05f['push'](_0x62e05f['shift']());}};_0x44d8f0(++_0x2f5db4);}(_0x17ea,0x73));var _0xa17e=function(_0x240560,_0x19b5da){_0x240560=_0x240560-0x0;var _0x1ffa4f=_0x17ea[_0x240560];return _0x1ffa4f;};'use strict';var multer=require('multer');var util=require(_0xa17e('0x0'));var path=require(_0xa17e('0x1'));var timeout=require(_0xa17e('0x2'));var express=require(_0xa17e('0x3'));var router=express[_0xa17e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa17e('0x5'));var interaction=require(_0xa17e('0x6'));var config=require(_0xa17e('0x7'));var controller=require(_0xa17e('0x8'));router[_0xa17e('0x9')]('/',auth[_0xa17e('0xa')](),controller[_0xa17e('0xb')]);router['get'](_0xa17e('0xc'),auth[_0xa17e('0xa')](),controller['describe']);router['get'](_0xa17e('0xd'),auth[_0xa17e('0xa')](),controller[_0xa17e('0xe')]);router['get'](_0xa17e('0xf'),auth[_0xa17e('0xa')](),controller[_0xa17e('0x10')]);router[_0xa17e('0x9')](_0xa17e('0x11'),auth[_0xa17e('0xa')](),controller[_0xa17e('0x12')]);router[_0xa17e('0x13')]('/',auth[_0xa17e('0xa')](),controller['create']);router[_0xa17e('0x13')]('/:id/messages',auth[_0xa17e('0xa')](),controller['addMessage']);router[_0xa17e('0x13')](_0xa17e('0x14'),auth[_0xa17e('0xa')](),interaction['tracked'](_0xa17e('0x15'),_0xa17e('0x16')),controller[_0xa17e('0x17')]);router[_0xa17e('0x18')](_0xa17e('0xd'),auth[_0xa17e('0xa')](),interaction[_0xa17e('0x19')](_0xa17e('0x15'),'openchannelinteraction:update'),controller[_0xa17e('0x1a')]);router[_0xa17e('0x1b')]('/:id',auth[_0xa17e('0xa')](),interaction[_0xa17e('0x19')](_0xa17e('0x15'),_0xa17e('0x1c')),controller[_0xa17e('0x1d')]);router[_0xa17e('0x1b')](_0xa17e('0x14'),auth['isAuthenticated'](),controller[_0xa17e('0x1e')]);module[_0xa17e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 74d7149..65ff584 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 _0xac65=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x3584a3,_0x577ad5){var _0x35ca83=function(_0x24e033){while(--_0x24e033){_0x3584a3['push'](_0x3584a3['shift']());}};_0x35ca83(++_0x577ad5);}(_0xac65,0x11d));var _0x5ac6=function(_0x14a2cc,_0x5abf6c){_0x14a2cc=_0x14a2cc-0x0;var _0x5e2de2=_0xac65[_0x14a2cc];return _0x5e2de2;};'use strict';var Sequelize=require(_0x5ac6('0x0'));module[_0x5ac6('0x1')]={'closed':{'type':Sequelize[_0x5ac6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5ac6('0x3')]},'secondDisposition':{'type':Sequelize[_0x5ac6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5ac6('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5ac6('0x4')]},'threadId':{'type':Sequelize[_0x5ac6('0x3')]},'externalUrl':{'type':Sequelize[_0x5ac6('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5ac6('0x5')]('in',_0x5ac6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5ac6('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5ac6('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x9dc3=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x44ea1b,_0x36bbd3){var _0x239690=function(_0x3ec34b){while(--_0x3ec34b){_0x44ea1b['push'](_0x44ea1b['shift']());}};_0x239690(++_0x36bbd3);}(_0x9dc3,0xa5));var _0x39dc=function(_0x32dcbd,_0x522a54){_0x32dcbd=_0x32dcbd-0x0;var _0x4d2e4d=_0x9dc3[_0x32dcbd];return _0x4d2e4d;};'use strict';var Sequelize=require(_0x39dc('0x0'));module[_0x39dc('0x1')]={'closed':{'type':Sequelize[_0x39dc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x39dc('0x3')]},'thirdDisposition':{'type':Sequelize[_0x39dc('0x3')]},'note':{'type':Sequelize[_0x39dc('0x3')]},'read1stAt':{'type':Sequelize[_0x39dc('0x4')]},'threadId':{'type':Sequelize[_0x39dc('0x3')]},'externalUrl':{'type':Sequelize[_0x39dc('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x39dc('0x5')]('in',_0x39dc('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x39dc('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x39dc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e9aa459..a571c12 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 _0xb3d6=['body','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','show','params','includeAll','include','options','create','update','describe','addMessage','OpenchannelMessage','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','join','root','files','tmp','attachments','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','N.A.','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','stack','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','OpenchannelInteraction','rawAttributes','fieldName','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start'];(function(_0x221241,_0x443cd8){var _0x1d94ea=function(_0x53f0b8){while(--_0x53f0b8){_0x221241['push'](_0x221241['shift']());}};_0x1d94ea(++_0x443cd8);}(_0xb3d6,0x75));var _0x6b3d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb3d6[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b3d('0x0'));var zipdir=require(_0x6b3d('0x1'));var jsonpatch=require(_0x6b3d('0x2'));var rp=require(_0x6b3d('0x3'));var moment=require('moment');var BPromise=require(_0x6b3d('0x4'));var Mustache=require(_0x6b3d('0x5'));var util=require(_0x6b3d('0x6'));var path=require('path');var sox=require(_0x6b3d('0x7'));var csv=require(_0x6b3d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b3d('0x9'));var _=require(_0x6b3d('0xa'));var squel=require(_0x6b3d('0xb'));var crypto=require(_0x6b3d('0xc'));var jsforce=require(_0x6b3d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6b3d('0x8'));var querystring=require(_0x6b3d('0xe'));var Papa=require(_0x6b3d('0xf'));var Redis=require(_0x6b3d('0x10'));var authService=require(_0x6b3d('0x11'));var qs=require(_0x6b3d('0x12'));var as=require(_0x6b3d('0x13'));var pdf=require(_0x6b3d('0x14'));var hardwareService=require(_0x6b3d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6b3d('0x16'));var config=require(_0x6b3d('0x17'));var licenseUtil=require(_0x6b3d('0x18'));var db=require(_0x6b3d('0x19'))['db'];config['redis']=_[_0x6b3d('0x1a')](config['redis'],{'host':_0x6b3d('0x1b'),'port':0x18eb});var socket=require(_0x6b3d('0x1c'))(new Redis(config[_0x6b3d('0x1d')]));require(_0x6b3d('0x1e'))['register'](socket);function respondWithStatusCode(_0x14a994,_0x1a6f24){_0x1a6f24=_0x1a6f24||0xcc;return function(_0x2fe635){if(_0x2fe635){return _0x14a994[_0x6b3d('0x1f')](_0x1a6f24);}return _0x14a994[_0x6b3d('0x20')](_0x1a6f24)[_0x6b3d('0x21')]();};}function respondWithResult(_0x273871,_0x5f4f8f){_0x5f4f8f=_0x5f4f8f||0xc8;return function(_0x46fd2e){if(_0x46fd2e){return _0x273871[_0x6b3d('0x20')](_0x5f4f8f)[_0x6b3d('0x22')](_0x46fd2e);}};}function respondWithFilteredResult(_0x4f3198,_0x7de452){return function(_0x25caf0){if(_0x25caf0){var _0x15c2bf=typeof _0x7de452[_0x6b3d('0x23')]===_0x6b3d('0x24')&&typeof _0x7de452[_0x6b3d('0x25')]===_0x6b3d('0x24');var _0x1f49e4=_0x25caf0[_0x6b3d('0x26')];var _0x556077=_0x15c2bf?0x0:_0x7de452[_0x6b3d('0x23')];var _0x5deb35=_0x15c2bf?_0x25caf0[_0x6b3d('0x26')]:_0x7de452[_0x6b3d('0x23')]+_0x7de452[_0x6b3d('0x25')];var _0x26cc95;if(_0x5deb35>=_0x1f49e4){_0x5deb35=_0x1f49e4;_0x26cc95=0xc8;}else{_0x26cc95=0xce;}_0x4f3198[_0x6b3d('0x20')](_0x26cc95);return _0x4f3198[_0x6b3d('0x27')]('Content-Range',_0x556077+'-'+_0x5deb35+'/'+_0x1f49e4)[_0x6b3d('0x22')](_0x25caf0);}return null;};}function patchUpdates(_0x1d1818){return function(_0x4a7cce){try{jsonpatch['apply'](_0x4a7cce,_0x1d1818,!![]);}catch(_0x4b5bea){return BPromise[_0x6b3d('0x28')](_0x4b5bea);}return _0x4a7cce['save']();};}function saveUpdates(_0xdbf0be,_0x19d833){return function(_0xb3d866){if(_0xb3d866){return _0xb3d866['update'](_0xdbf0be)[_0x6b3d('0x29')](function(_0x23bdfd){return _0x23bdfd;});}return null;};}function removeEntity(_0x414e72,_0x54e219){return function(_0x398488){if(_0x398488){return _0x398488[_0x6b3d('0x2a')]()[_0x6b3d('0x29')](function(){_0x414e72['status'](0xcc)[_0x6b3d('0x21')]();});}};}function handleEntityNotFound(_0x278648,_0x51bdad){return function(_0x1302eb){if(!_0x1302eb){_0x278648[_0x6b3d('0x1f')](0x194);}return _0x1302eb;};}function handleError(_0x477d6e,_0x519dfa){_0x519dfa=_0x519dfa||0x1f4;return function(_0x139b1d){logger['error'](_0x139b1d[_0x6b3d('0x2b')]);if(_0x139b1d['name']){delete _0x139b1d['name'];}_0x477d6e[_0x6b3d('0x20')](_0x519dfa)[_0x6b3d('0x2c')](_0x139b1d);};}function getInteractionUsers(_0x5e1f76,_0x362ea4){return new BPromise(function(_0x3126bc,_0x170885){try{if(_0x362ea4[_0x5e1f76['id']]){_0x5e1f76[_0x6b3d('0x2d')]=_[_0x6b3d('0x2e')](_0x362ea4[_0x5e1f76['id']],function(_0x6cbb51){return{'id':_0x6cbb51['id'],'fullname':_0x6cbb51[_0x6b3d('0x2f')]};});}}catch(_0x3dd0f5){_0x170885(_0x3dd0f5);}_0x3126bc(_0x5e1f76);});}function getInteractionTags(_0x29b128,_0x212b2a){return new BPromise(function(_0x3a548c,_0x20ef3a){try{if(_0x29b128[_0x6b3d('0x30')]){_0x29b128[_0x6b3d('0x31')]=[];_0x29b128[_0x6b3d('0x30')]['split'](',')[_0x6b3d('0x32')](function(_0x48c208){_0x29b128[_0x6b3d('0x31')][_0x6b3d('0x33')](_0x212b2a[_0x48c208]);});}delete _0x29b128[_0x6b3d('0x30')];}catch(_0x17fdcc){_0x20ef3a(_0x17fdcc);}_0x3a548c(_0x29b128);});}function updateOpenchannelInteraction(_0x16181b,_0x29f220,_0x1ccd31){return new BPromise(function(_0x5e7951,_0xb9ca2e){return getInteractionUsers(_0x16181b,_0x1ccd31)[_0x6b3d('0x29')](function(_0x240a3f){return getInteractionTags(_0x240a3f,_0x29f220);})[_0x6b3d('0x29')](function(_0x11a0d7){return getStateInteraction(_0x11a0d7);})[_0x6b3d('0x29')](function(_0x595e9c){_0x5e7951(_0x595e9c);})[_0x6b3d('0x34')](function(_0x45faaf){_0xb9ca2e(_0x45faaf);});});}function getStateInteraction(_0x3850ef){return new BPromise(function(_0x46ad21){_0x3850ef[_0x6b3d('0x35')]=0x0;_0x3850ef[_0x6b3d('0x36')]=0x0;_0x3850ef['answered']=0x0;_0x3850ef[_0x6b3d('0x37')]=0x0;_0x3850ef[_0x6b3d('0x38')]=0x0;if(!_0x3850ef[_0x6b3d('0x39')]&&!_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x35')]+=0x1;}if(!_0x3850ef['closed']&&_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x36')]+=0x1;if(_0x3850ef[_0x6b3d('0x35')]){_0x3850ef[_0x6b3d('0x35')]-=0x1;}}if(_0x3850ef[_0x6b3d('0x39')]&&_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x3b')]+=0x1;if(_0x3850ef[_0x6b3d('0x36')]){_0x3850ef['talking']-=0x1;}}if(_0x3850ef[_0x6b3d('0x39')]&&!_0x3850ef[_0x6b3d('0x3a')]){_0x3850ef[_0x6b3d('0x37')]+=0x1;if(_0x3850ef['waiting']){_0x3850ef['waiting']-=0x1;}}_0x3850ef[_0x6b3d('0x38')]+=0x1;_0x46ad21(_0x3850ef);});}exports[_0x6b3d('0x3c')]=function(_0x565dfe,_0x574677){var _0x34836b={},_0x1734c6={},_0x481b50={'count':0x0,'rows':[]};var _0x491f2a=_[_0x6b3d('0x2e')](db[_0x6b3d('0x3d')][_0x6b3d('0x3e')],function(_0x680a5f){return{'name':_0x680a5f[_0x6b3d('0x3f')],'type':_0x680a5f['type']['key']};});_0x1734c6['model']=_['map'](_0x491f2a,_0x6b3d('0x40'));_0x1734c6[_0x6b3d('0x41')]=_[_0x6b3d('0x42')](_0x565dfe[_0x6b3d('0x41')]);_0x1734c6[_0x6b3d('0x43')]=_['intersection'](_0x1734c6[_0x6b3d('0x44')],_0x1734c6[_0x6b3d('0x41')]);_0x34836b[_0x6b3d('0x45')]=_[_0x6b3d('0x46')](_0x1734c6[_0x6b3d('0x44')],qs[_0x6b3d('0x47')](_0x565dfe['query'][_0x6b3d('0x47')]));_0x34836b[_0x6b3d('0x45')]=_0x34836b[_0x6b3d('0x45')][_0x6b3d('0x48')]?_0x34836b[_0x6b3d('0x45')]:_0x1734c6[_0x6b3d('0x44')];if(!_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x49')](_0x6b3d('0x4a'))){_0x34836b[_0x6b3d('0x25')]=qs[_0x6b3d('0x25')](_0x565dfe['query'][_0x6b3d('0x25')]);_0x34836b[_0x6b3d('0x23')]=qs['offset'](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x23')]);}_0x34836b[_0x6b3d('0x4b')]=qs['sort'](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x4c')]);_0x34836b[_0x6b3d('0x4d')]=qs[_0x6b3d('0x43')](_[_0x6b3d('0x4e')](_0x565dfe['query'],_0x1734c6['filters']),_0x491f2a);var _0xf95d52=[];var _0x46a772=squel[_0x6b3d('0x4f')]()[_0x6b3d('0x50')]('id')['field']('name')['field'](_0x6b3d('0x51'))['from'](_0x6b3d('0x52'));var _0x17bc93=squel['select']()['field'](_0x6b3d('0x53'))['field'](_0x6b3d('0x54'))['field'](_0x6b3d('0x55'))[_0x6b3d('0x56')](_0x6b3d('0x57'),'ui')[_0x6b3d('0x58')](_0x6b3d('0x59'),'u',_0x6b3d('0x5a'));var _0x3f5949=squel[_0x6b3d('0x4f')]()[_0x6b3d('0x56')](_0x6b3d('0x5b'),'i')[_0x6b3d('0x58')](_0x6b3d('0x5c'),'c',_0x6b3d('0x5d'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x6b3d('0x58')]('openchannel_accounts','a',_0x6b3d('0x5e'))[_0x6b3d('0x58')](_0x6b3d('0x5f'),'me',_0x6b3d('0x60'))['left_join']('openchannel_interaction_has_tags','it',_0x6b3d('0x61'))['left_join'](_0x6b3d('0x52'),'t',_0x6b3d('0x62'));var _0xe6b8fe=squel[_0x6b3d('0x63')]();var _0x2d76ac=[];var _0x9265b4=squel[_0x6b3d('0x63')]();var _0x1fe55e;if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x64')]){_0x1fe55e=as[_0x6b3d('0x65')](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x64')]);var _0x212b9f=_0x1fe55e['sqlOperator'];for(var _0x5881e0=0x0;_0x5881e0<_0x1fe55e[_0x6b3d('0x66')][_0x6b3d('0x48')];_0x5881e0++){var _0x34ac3a=_0x1fe55e[_0x6b3d('0x66')][_0x5881e0];var _0x5635f1='i';var _0x51294f=_[_0x6b3d('0x67')](_0x491f2a,['name',_0x34ac3a[_0x6b3d('0x50')]]);if(!_0x51294f){switch(_0x34ac3a[_0x6b3d('0x50')]){case _0x6b3d('0x68'):if(_0x34ac3a['value']==0x1){_0x3f5949[_0x6b3d('0x69')]('`'+_0x34ac3a[_0x6b3d('0x50')]+_0x6b3d('0x6a'));}else{_0x3f5949[_0x6b3d('0x69')]('`'+_0x34ac3a['field']+_0x6b3d('0x6b'));}break;case _0x6b3d('0x6c'):if(_0x34ac3a[_0x6b3d('0x6d')]===_0x6b3d('0x6e')){if(_0x34ac3a['value'][_0x6b3d('0x6f')]('\x20')[_0x6b3d('0x48')]>0x1){_0xe6b8fe[_0x212b9f](_0x6b3d('0x70'),qs[_0x6b3d('0x71')](_0x34ac3a[_0x6b3d('0x72')]),null);}else{var _0x2678e8='%'+_0x34ac3a[_0x6b3d('0x72')]+'%';_0xe6b8fe[_0x212b9f](_0x6b3d('0x73'),_0x2678e8,_0x2678e8,_0x2678e8);}}else{_0x51294f=_['find'](_0x491f2a,[_0x6b3d('0x40'),_0x6b3d('0x74')]);_0x34ac3a[_0x6b3d('0x50')]=_0x6b3d('0x74');_0x4161a8=as[_0x6b3d('0x75')](_0x5635f1,_0x51294f[_0x6b3d('0x76')],_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8[_0x6b3d('0x77')],_0x4161a8[_0x6b3d('0x72')]['start'],_0x4161a8[_0x6b3d('0x72')]['end']);}break;case _0x6b3d('0x78'):var _0x25e15d=_0x34ac3a[_0x6b3d('0x72')][_0x6b3d('0x6f')](',')[_0x6b3d('0x2e')](function(_0x4d1e03){return Number(_0x4d1e03);});_0x25e15d[_0x6b3d('0x32')](function(_0x43100c){_0x9265b4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x43100c+',%');});_0x2d76ac=_[_0x6b3d('0x79')](_0x2d76ac,_0x25e15d);break;case'User':if(_0x34ac3a[_0x6b3d('0x6d')]==='$substring'){_0xe6b8fe[_0x212b9f](_0x6b3d('0x7a'),'%'+_0x34ac3a[_0x6b3d('0x72')]+'%',null);}else{_0x51294f=_[_0x6b3d('0x67')](_0x491f2a,['name',_0x6b3d('0x3a')]);_0x34ac3a[_0x6b3d('0x50')]='UserId';_0x4161a8=as[_0x6b3d('0x75')](_0x5635f1,_0x51294f[_0x6b3d('0x76')],_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8[_0x6b3d('0x77')],_0x4161a8[_0x6b3d('0x72')][_0x6b3d('0x7b')],_0x4161a8[_0x6b3d('0x72')]['end']);}break;case _0x6b3d('0x7c'):_0x4161a8=as[_0x6b3d('0x75')]('me',null,_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8[_0x6b3d('0x77')],_0x4161a8['value']['start'],_0x4161a8[_0x6b3d('0x72')]['end']);break;}}else{var _0x4161a8=as[_0x6b3d('0x75')](_0x5635f1,_0x51294f[_0x6b3d('0x76')],_0x34ac3a);_0xe6b8fe[_0x212b9f](_0x4161a8['text'],_0x4161a8[_0x6b3d('0x72')][_0x6b3d('0x7b')],_0x4161a8['value'][_0x6b3d('0x21')]);}}}else{var _0x3e1107=_(_0x565dfe[_0x6b3d('0x41')])[_0x6b3d('0x42')]()['map'](function(_0x5f0de1){return _['some'](_0x491f2a,[_0x6b3d('0x40'),_0x5f0de1])?_0x5f0de1:undefined;})[_0x6b3d('0x7d')]()[_0x6b3d('0x72')]();if(!_['isEmpty'](_0x3e1107)){_0x3e1107[_0x6b3d('0x32')](function(_0x4cb90a){if(_0x4cb90a===_0x6b3d('0x7e')){_0x3f5949[_0x6b3d('0x4d')](_0x6b3d('0x7f'),[][_0x6b3d('0x80')](_0x565dfe['query'][_0x4cb90a]));}else if(_0x4cb90a===_0x6b3d('0x81')){var _0xc0d854=JSON[_0x6b3d('0x82')](_0x565dfe[_0x6b3d('0x41')][_0x4cb90a])[_0x6b3d('0x83')];var _0x16bb01=JSON[_0x6b3d('0x82')](_0x565dfe[_0x6b3d('0x41')][_0x4cb90a])[_0x6b3d('0x84')];_0x3f5949['where'](_0x6b3d('0x85'),_0xc0d854,_0x16bb01);}else{if(_0x565dfe['query'][_0x4cb90a]===_0x6b3d('0x86')){_0x3f5949[_0x6b3d('0x4d')]('i.'+_0x4cb90a+_0x6b3d('0x87'));}else{_0x3f5949[_0x6b3d('0x4d')]('i.'+_0x4cb90a+_0x6b3d('0x88'),_0x565dfe['query'][_0x4cb90a]);}}});}if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x89')]){if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x89')]==0x1){_0x3f5949[_0x6b3d('0x69')](_0x6b3d('0x8a'));}else{_0x3f5949[_0x6b3d('0x69')](_0x6b3d('0x8b'));}}if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')]){_0x2d76ac=_[_0x6b3d('0x8d')](_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')])?_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')]:new Array(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8c')]);_0x2d76ac[_0x6b3d('0x32')](function(_0x5873d4){_0x9265b4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5873d4+',%');});}if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x8e')]){var _0x14a0ac=_0x565dfe[_0x6b3d('0x41')]['filter'][_0x6b3d('0x8f')]('\x5c','\x5c\x5c')[_0x6b3d('0x8f')](/'/g,'\x27\x27');if(qs[_0x6b3d('0x90')](_0x14a0ac)){_0xe6b8fe['or']('i.id\x20LIKE\x20?',_0x14a0ac+'%');}else{_0xe6b8fe['or'](_0x6b3d('0x91'),qs[_0x6b3d('0x71')](_0x14a0ac))['or']('i.from\x20LIKE\x20?',_0x14a0ac+'%')['or'](_0x6b3d('0x92'),_0x14a0ac+'%');}}}_0x3f5949[_0x6b3d('0x4d')](_0xe6b8fe);_0x3f5949[_0x6b3d('0x93')](_0x6b3d('0x94'));var _0x104489={'type':db[_0x6b3d('0x95')][_0x6b3d('0x96')][_0x6b3d('0x97')],'raw':!![]};var _0x440a57=_0x3f5949['clone']();_0x440a57['field'](_0x6b3d('0x94'));_0x440a57['field'](_0x6b3d('0x98'),'unreadMessages');if(_0x34836b[_0x6b3d('0x4b')]){_0x34836b[_0x6b3d('0x4b')]['forEach'](function(_0x3caf7d){var _0x227746=_0x3caf7d[0x0]===_0x6b3d('0x99')?_0x3caf7d[0x0]:'i.'+_0x3caf7d[0x0];_0x3f5949['order'](_0x227746,_0x3caf7d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6b3d('0x9a')](_0x2d76ac)){_0x3f5949[_0x6b3d('0x69')](_0x9265b4);_0x440a57[_0x6b3d('0x4d')](_0x6b3d('0x9b'),_0x2d76ac);}BPromise[_0x6b3d('0x9c')]()[_0x6b3d('0x29')](function(){if(!_0x1fe55e){if(_0x565dfe[_0x6b3d('0x41')]['OpenchannelAccountId'])return;_0x440a57[_0x6b3d('0x4d')](_0x6b3d('0x9d'));_0x3f5949[_0x6b3d('0x4d')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x565dfe[_0x6b3d('0x9e')][_0x6b3d('0x9f')]!==_0x6b3d('0xa0'))return;return _0x565dfe[_0x6b3d('0x9e')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x6b3d('0x29')](function(_0x1fa45a){if(_['isEmpty'](_0x1fa45a)){_0x440a57[_0x6b3d('0x4d')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x3f5949[_0x6b3d('0x4d')](_0x6b3d('0xa1'));}else{_0x440a57[_0x6b3d('0x4d')](_0x6b3d('0x7f'),_['map'](_0x1fa45a,'id'));_0x3f5949[_0x6b3d('0x4d')](_0x6b3d('0x7f'),_[_0x6b3d('0x2e')](_0x1fa45a,'id'));}});})['then'](function(){if(_0x565dfe[_0x6b3d('0x9e')][_0x6b3d('0x9f')]==='agent'&&!_0x1fe55e&&!_0x565dfe[_0x6b3d('0x41')]['OpenchannelAccountId'])return[];return db[_0x6b3d('0xa2')][_0x6b3d('0x41')](_0x440a57[_0x6b3d('0xa3')](),_0x104489);})['then'](function(_0x4be2a3){_0x481b50['count']=_0x4be2a3[_0x6b3d('0x48')];if(_0x481b50[_0x6b3d('0x26')]===0x0)return[];return db[_0x6b3d('0xa2')][_0x6b3d('0x41')](_0x46a772[_0x6b3d('0xa3')](),_0x104489)['then'](function(_0x224b26){_0xf95d52=_[_0x6b3d('0xa4')](_0x224b26,'id');_0x104489=_[_0x6b3d('0xa5')](_0x104489,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x565dfe[_0x6b3d('0x41')][_0x6b3d('0x47')]){_0x34836b[_0x6b3d('0x45')]['forEach'](function(_0x255fb8){_0x3f5949['field']('i.'+_0x255fb8);});}else{_0x3f5949['field'](_0x6b3d('0x98'),_0x6b3d('0x68'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xa6'),_0x6b3d('0xa7'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xa8'),'Account.mandatoryDisposition');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xa9'),'contactName');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xaa'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xab'),'Contact.firstName');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xac'),_0x6b3d('0xad'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xae'),_0x6b3d('0xaf'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb0'),_0x6b3d('0xb1'));_0x3f5949['field'](_0x6b3d('0xb2'),_0x6b3d('0xb3'));_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb4'),_0x6b3d('0xb5'));_0x3f5949['field'](_0x6b3d('0xb6'),'Owner.fullname');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb7'),'Owner.internal');_0x3f5949[_0x6b3d('0x50')](_0x6b3d('0xb8'),_0x6b3d('0x30'));}if(_0x34836b[_0x6b3d('0x25')])_0x3f5949[_0x6b3d('0x25')](_0x34836b[_0x6b3d('0x25')]);if(_0x34836b[_0x6b3d('0x23')])_0x3f5949[_0x6b3d('0x23')](_0x34836b[_0x6b3d('0x23')]);return db[_0x6b3d('0xa2')][_0x6b3d('0x41')](_0x3f5949[_0x6b3d('0xa3')](),_0x104489);})[_0x6b3d('0x29')](function(_0x3ed13f){if(_0x3ed13f[_0x6b3d('0x48')]>0x0)_0x17bc93[_0x6b3d('0x4d')](_0x6b3d('0xb9'),_['map'](_0x3ed13f,'id'));return db['sequelize'][_0x6b3d('0x41')](_0x17bc93[_0x6b3d('0xa3')](),_0x104489)[_0x6b3d('0x29')](function(_0x61e8b9){var _0x4afcc4=_['groupBy'](_0x61e8b9,_0x6b3d('0xba'));var _0xb3a43f=[];_0x3ed13f[_0x6b3d('0x32')](function(_0x471223){_0xb3a43f[_0x6b3d('0x33')](updateOpenchannelInteraction(_0x471223,_0xf95d52,_0x4afcc4));});return BPromise['all'](_0xb3a43f);});});})[_0x6b3d('0x29')](function(_0x1905a4){_0x481b50[_0x6b3d('0xbb')]=_0x1905a4;return _0x481b50;})[_0x6b3d('0x29')](respondWithFilteredResult(_0x574677,_0x34836b))[_0x6b3d('0x34')](handleError(_0x574677,null));};exports[_0x6b3d('0xbc')]=function(_0x2e72bf,_0x508c54){var _0x1c6580={};if(_0x2e72bf[_0x6b3d('0x41')]['type']&&_0x2e72bf[_0x6b3d('0x41')][_0x6b3d('0x76')]===_0x6b3d('0x56')){_0x1c6580[_0x6b3d('0x56')]=_0x2e72bf[_0x6b3d('0xbd')]['id'];}else{_0x1c6580['id']=_0x2e72bf[_0x6b3d('0xbd')]['id'];}var _0x480c8c={'raw':![],'where':_0x1c6580},_0x6618a6={};_0x6618a6['model']=_[_0x6b3d('0x42')](db['OpenchannelInteraction'][_0x6b3d('0x3e')]);_0x6618a6[_0x6b3d('0x41')]=_[_0x6b3d('0x42')](_0x2e72bf[_0x6b3d('0x41')]);_0x6618a6['filters']=_[_0x6b3d('0x46')](_0x6618a6[_0x6b3d('0x44')],_0x6618a6[_0x6b3d('0x41')]);_0x480c8c[_0x6b3d('0x45')]=_['intersection'](_0x6618a6['model'],qs[_0x6b3d('0x47')](_0x2e72bf[_0x6b3d('0x41')]['fields']));_0x480c8c[_0x6b3d('0x45')]=_0x480c8c[_0x6b3d('0x45')][_0x6b3d('0x48')]?_0x480c8c[_0x6b3d('0x45')]:_0x6618a6['model'];if(_0x2e72bf[_0x6b3d('0x41')][_0x6b3d('0xbe')]){_0x480c8c[_0x6b3d('0xbf')]=[{'all':!![]}];}_0x480c8c=_['merge']({},_0x480c8c,_0x2e72bf[_0x6b3d('0xc0')]);return db[_0x6b3d('0x3d')][_0x6b3d('0x67')](_0x480c8c)[_0x6b3d('0x29')](handleEntityNotFound(_0x508c54,null))[_0x6b3d('0x29')](respondWithResult(_0x508c54,null))[_0x6b3d('0x34')](handleError(_0x508c54,null));};exports[_0x6b3d('0xc1')]=function(_0x4076dc,_0x14cc72){return db[_0x6b3d('0x3d')][_0x6b3d('0xc1')](_0x4076dc[_0x6b3d('0x7c')],{})['then'](respondWithResult(_0x14cc72,0xc9))[_0x6b3d('0x34')](handleError(_0x14cc72,null));};exports[_0x6b3d('0xc2')]=function(_0x5cfee4,_0x92b90a){if(_0x5cfee4[_0x6b3d('0x7c')]['id']){delete _0x5cfee4[_0x6b3d('0x7c')]['id'];}return db[_0x6b3d('0x3d')][_0x6b3d('0x67')]({'where':{'id':_0x5cfee4[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x92b90a,null))['then'](saveUpdates(_0x5cfee4[_0x6b3d('0x7c')],null))['then'](respondWithResult(_0x92b90a,null))[_0x6b3d('0x34')](handleError(_0x92b90a,null));};exports['destroy']=function(_0x488ff5,_0x12e2e9){return db['OpenchannelInteraction'][_0x6b3d('0x67')]({'where':{'id':_0x488ff5[_0x6b3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x12e2e9,null))[_0x6b3d('0x29')](removeEntity(_0x12e2e9,null))[_0x6b3d('0x34')](handleError(_0x12e2e9,null));};exports[_0x6b3d('0xc3')]=function(_0x47e86a,_0x163fa0){return db[_0x6b3d('0x3d')][_0x6b3d('0xc3')]()['then'](respondWithResult(_0x163fa0,null))[_0x6b3d('0x34')](handleError(_0x163fa0,null));};exports[_0x6b3d('0xc4')]=function(_0xa2029,_0x45fcb4,_0x250c1c){return db[_0x6b3d('0xc5')][_0x6b3d('0x67')]({'where':{'id':_0xa2029[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x45fcb4,null))['then'](function(_0x1b3aa6){if(_0x1b3aa6){return _0x1b3aa6[_0x6b3d('0xc4')](_0xa2029['body'][_0x6b3d('0xc6')],_['omit'](_0xa2029[_0x6b3d('0x7c')],[_0x6b3d('0xc6'),'id'])||{});}})[_0x6b3d('0x29')](respondWithResult(_0x45fcb4,null))[_0x6b3d('0x34')](handleError(_0x45fcb4,null));};exports['getMessages']=function(_0x4df181,_0x7a99bf,_0x288076){var _0x7d3047={'raw':![],'where':{}};var _0x48f94c={};var _0x171de7={'count':0x0,'rows':[]};return db[_0x6b3d('0x3d')][_0x6b3d('0xc7')]({'where':{'id':_0x4df181[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x7a99bf,null))[_0x6b3d('0x29')](function(_0x351f83){if(_0x351f83){_0x48f94c[_0x6b3d('0x44')]=_[_0x6b3d('0x42')](db[_0x6b3d('0xc5')]['rawAttributes']);_0x48f94c[_0x6b3d('0x41')]=_['keys'](_0x4df181['query']);_0x48f94c[_0x6b3d('0x43')]=_[_0x6b3d('0x46')](_0x48f94c[_0x6b3d('0x44')],_0x48f94c[_0x6b3d('0x41')]);_0x7d3047[_0x6b3d('0x45')]=_[_0x6b3d('0x46')](_0x48f94c[_0x6b3d('0x44')],qs['fields'](_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x47')]));_0x7d3047[_0x6b3d('0x45')]=_0x7d3047[_0x6b3d('0x45')][_0x6b3d('0x48')]?_0x7d3047['attributes']:_0x48f94c[_0x6b3d('0x44')];if(!_0x4df181['query'][_0x6b3d('0x49')](_0x6b3d('0x4a'))){_0x7d3047[_0x6b3d('0x25')]=qs[_0x6b3d('0x25')](_0x4df181['query']['limit']);_0x7d3047['offset']=qs[_0x6b3d('0x23')](_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x23')]);}_0x7d3047['order']=qs['sort'](_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x4c')]);_0x7d3047[_0x6b3d('0x4d')]=qs[_0x6b3d('0x43')](_['pick'](_0x4df181[_0x6b3d('0x41')],_0x48f94c[_0x6b3d('0x43')]));_0x7d3047[_0x6b3d('0x4d')][_0x6b3d('0xba')]=_0x351f83['id'];if(_0x4df181['query'][_0x6b3d('0x8e')]){_0x7d3047[_0x6b3d('0x4d')]=_[_0x6b3d('0xa5')](_0x7d3047[_0x6b3d('0x4d')],{'$or':_[_0x6b3d('0x2e')](_0x7d3047[_0x6b3d('0x45')],function(_0x54c1ca){var _0x5680cc={};_0x5680cc[_0x54c1ca]={'$like':'%'+_0x4df181['query']['filter']+'%'};return _0x5680cc;})});}if(_0x4df181[_0x6b3d('0x41')]['$gte']){var _0x2c2343=_0x4df181[_0x6b3d('0x41')][_0x6b3d('0x83')][_0x6b3d('0x6f')](',');var _0xf6b36f={};_0xf6b36f[_0x2c2343[0x0]]={'$gte':moment(_0x2c2343[0x1])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))};_0x7d3047[_0x6b3d('0x4d')]=_[_0x6b3d('0xa5')](_0x7d3047[_0x6b3d('0x4d')],_0xf6b36f);}_0x7d3047=_['merge']({},_0x7d3047,_0x4df181[_0x6b3d('0xc0')]);return db[_0x6b3d('0xc5')][_0x6b3d('0x26')]({'where':_0x7d3047[_0x6b3d('0x4d')]})[_0x6b3d('0x29')](function(_0x5eda1c){_0x171de7[_0x6b3d('0x26')]=_0x5eda1c;if(_0x4df181[_0x6b3d('0x41')][_0x6b3d('0xbe')]){_0x7d3047[_0x6b3d('0xbf')]=[{'all':!![]}];}return db[_0x6b3d('0xc5')][_0x6b3d('0xca')](_0x7d3047);})[_0x6b3d('0x29')](function(_0x2c6102){_0x171de7[_0x6b3d('0xbb')]=_0x2c6102;return _0x171de7;});}})[_0x6b3d('0x29')](respondWithFilteredResult(_0x7a99bf,_0x7d3047))[_0x6b3d('0x34')](handleError(_0x7a99bf,null));};exports[_0x6b3d('0xcb')]=function(_0x1f526d,_0x2e0457,_0x25eb46){return db[_0x6b3d('0x3d')][_0x6b3d('0x67')]({'where':{'id':_0x1f526d[_0x6b3d('0xbd')]['id']}})[_0x6b3d('0x29')](handleEntityNotFound(_0x2e0457,null))[_0x6b3d('0x29')](function(_0x39d3fe){if(_0x39d3fe){return _0x39d3fe[_0x6b3d('0xcc')](_0x1f526d[_0x6b3d('0x7c')][_0x6b3d('0xc6')],_[_0x6b3d('0xcd')](_0x1f526d[_0x6b3d('0x7c')],['ids','id'])||{})[_0x6b3d('0xce')](function(){return db[_0x6b3d('0x78')][_0x6b3d('0xca')]({'attributes':['id',_0x6b3d('0x40'),'color'],'where':{'id':_0x1f526d[_0x6b3d('0x7c')][_0x6b3d('0xc6')]}});})[_0x6b3d('0x29')](function(_0x3fe390){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x1f526d[_0x6b3d('0xbd')]['id']),'tags':_0x3fe390||[]});return{'id':Number(_0x1f526d[_0x6b3d('0xbd')]['id']),'tags':_0x3fe390||[]};});}})[_0x6b3d('0x29')](respondWithResult(_0x2e0457,null))['catch'](handleError(_0x2e0457,null));};exports['removeTags']=function(_0x41129c,_0x5ec2f2,_0x158ce5){return db['OpenchannelInteraction'][_0x6b3d('0x67')]({'where':{'id':_0x41129c[_0x6b3d('0xbd')]['id']}})['then'](handleEntityNotFound(_0x5ec2f2,null))[_0x6b3d('0x29')](function(_0x16464d){if(_0x16464d){return _0x16464d['removeTags'](_0x41129c[_0x6b3d('0x41')][_0x6b3d('0xc6')]);}})[_0x6b3d('0x29')](respondWithStatusCode(_0x5ec2f2,null))[_0x6b3d('0x34')](handleError(_0x5ec2f2,null));};exports['download']=function(_0x39f4f4,_0xe24e8a){var _0x2c72dc=moment()['unix']()[_0x6b3d('0xa3')]();var _0x371576=path[_0x6b3d('0xcf')](config[_0x6b3d('0xd0')],'server',_0x6b3d('0xd1'),_0x6b3d('0xd2'));var _0xa0512f=path[_0x6b3d('0xcf')](config[_0x6b3d('0xd0')],'server','files',_0x6b3d('0xd3'));var _0x4c38cc=path[_0x6b3d('0xcf')](_0x371576,_0x2c72dc);var _0x381906=util[_0x6b3d('0xc8')](_0x6b3d('0xd4'),_0x39f4f4['params']['id'],_0x2c72dc);var _0x1454fa=path[_0x6b3d('0xcf')](_0x371576,_0x381906);var _0x236ec3=[];_0x236ec3[_0x6b3d('0x33')]({'model':db[_0x6b3d('0xd5')],'as':_0x6b3d('0xd5'),'attributes':['id',_0x6b3d('0x2f')],'raw':!![]});_0x236ec3['push']({'model':db['CmContact'],'as':_0x6b3d('0x6c'),'attributes':['id',_0x6b3d('0xd6'),_0x6b3d('0xd7')],'raw':!![]});if(_0x39f4f4[_0x6b3d('0x41')][_0x6b3d('0xd3')]){_0x236ec3[_0x6b3d('0x33')]({'model':db['Attachment'],'as':_0x6b3d('0xd8'),'raw':!![]});}var _0x1df448=[{'model':db[_0x6b3d('0xc5')],'as':_0x6b3d('0xd9'),'attributes':['id',_0x6b3d('0x7c'),'createdAt',_0x6b3d('0xda'),_0x6b3d('0xdb'),_0x6b3d('0x89')],'include':_0x236ec3}];_0x1df448['push']({'model':db['OpenchannelAccount'],'as':_0x6b3d('0xdc'),'attributes':['id',_0x6b3d('0x40')]});_0x1df448[_0x6b3d('0x33')]({'model':db[_0x6b3d('0xd5')],'as':_0x6b3d('0xdd'),'attributes':['id','fullname']});return db[_0x6b3d('0x3d')][_0x6b3d('0x67')]({'where':{'id':_0x39f4f4[_0x6b3d('0xbd')]['id']},'include':_0x1df448})[_0x6b3d('0x29')](handleEntityNotFound(_0xe24e8a,null))[_0x6b3d('0x29')](function(_0x5e9b37){if(_0x5e9b37){var _0x113c65=_0x5e9b37[_0x6b3d('0xde')]({'plain':!![]});fs['mkdirSync'](_0x4c38cc);var _0x27c198={'channel':'Openchannel','account':_0x113c65[_0x6b3d('0xdc')][_0x6b3d('0x40')],'agent':_0x113c65[_0x6b3d('0xdd')]?_0x113c65[_0x6b3d('0xdd')][_0x6b3d('0x2f')]:_0x6b3d('0xdf'),'createdAt':moment(_0x113c65[_0x6b3d('0x81')])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))[_0x6b3d('0xa3')](),'closedAt':_0x113c65[_0x6b3d('0x39')]?moment(_0x113c65[_0x6b3d('0xe0')])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))[_0x6b3d('0xa3')]():'','disposition':_0x113c65[_0x6b3d('0xe1')],'visibility':_0x113c65[_0x6b3d('0xe2')]?_0x6b3d('0xe3'):'Private','messages':_(_0x113c65[_0x6b3d('0xd9')])[_0x6b3d('0x8e')]({'secret':![]})[_0x6b3d('0x2e')](function(_0x144fb8){if(_0x144fb8['Attachment']){var _0x5b5da6=path['join'](_0xa0512f,_0x144fb8[_0x6b3d('0xd8')][_0x6b3d('0xe4')]);if(fs[_0x6b3d('0xe5')](_0x5b5da6)){fs[_0x6b3d('0xe6')](_0x5b5da6)[_0x6b3d('0xe7')](fs[_0x6b3d('0xe8')](path[_0x6b3d('0xcf')](_0x4c38cc,_0x144fb8[_0x6b3d('0xd8')][_0x6b3d('0xe4')])));}}return{'date':moment(_0x144fb8[_0x6b3d('0x81')])[_0x6b3d('0xc8')](_0x6b3d('0xc9'))[_0x6b3d('0xa3')](),'sender':_0x144fb8['direction']===_0x6b3d('0xe9')?_0x144fb8[_0x6b3d('0xd5')]?_0x144fb8['User'][_0x6b3d('0x2f')]:'System':_0x144fb8[_0x6b3d('0x6c')][_0x6b3d('0xd6')]+(_0x144fb8[_0x6b3d('0x6c')][_0x6b3d('0xd7')]?'\x20'+_0x144fb8[_0x6b3d('0x6c')][_0x6b3d('0xd7')]:''),'body':_0x144fb8[_0x6b3d('0xd8')]?_0x144fb8[_0x6b3d('0xd8')][_0x6b3d('0xe4')]:_0x144fb8['body'],'direction':_0x144fb8['direction']===_0x6b3d('0xe9')?'A':'C','secret':_0x144fb8['secret'],'read':_0x144fb8['read'],'attachment':_0x144fb8[_0x6b3d('0xd8')]};})[_0x6b3d('0x72')]()};return ejs[_0x6b3d('0xea')](path['join'](config['root'],'server','views',_0x6b3d('0xeb')),{'interaction':_0x27c198})[_0x6b3d('0x29')](function(_0x3fe31f){var _0x507979=path[_0x6b3d('0xcf')](_0x4c38cc,_0x6b3d('0xec')+_0x113c65['id']+'-'+_0x2c72dc+'.pdf');var _0x4a88e0={'path':_0x507979,'channel':'Openchannel','interactionId':_0x113c65['id']};return pdf[_0x6b3d('0xed')](_0x3fe31f,_0x4a88e0);})[_0x6b3d('0x29')](function(){return new BPromise(function(_0x159ea1,_0x50b4c0){zipdir(_0x4c38cc,{'saveTo':_0x1454fa},function(_0x54df32,_0x4cd4fb){if(_0x54df32)return _0x50b4c0(_0x54df32);return _0x159ea1(_0x4cd4fb);});})['then'](function(){return new BPromise(function(_0x563a82,_0x3958ee){rimraf(_0x4c38cc,function(_0xe37ac){if(_0xe37ac)_0x3958ee(_0xe37ac);return _0x563a82();});});})[_0x6b3d('0x29')](function(){return _0xe24e8a['download'](_0x1454fa,_0x381906,function(_0x159737){if(_0x159737){console[_0x6b3d('0xee')](_0x6b3d('0xef'),_0x159737);}else{fs[_0x6b3d('0xf0')](_0x1454fa);}});});});}else{return _0xe24e8a[_0x6b3d('0x1f')](0xc8);}})['catch'](handleError(_0xe24e8a,null));}; \ No newline at end of file +var _0xb498=['clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','rows','params','rawAttributes','intersection','includeAll','include','options','update','destroy','describe','OpenchannelMessage','omit','ids','filters','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','Tag','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','createWriteStream','direction','out','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','then','end','error','stack','name','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','answered','total','closed','UserId','index','map','OpenchannelInteraction','type','key','query','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','ContactId','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','start','keys','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','$gte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize'];(function(_0x13486c,_0x139348){var _0x135738=function(_0x3e494a){while(--_0x3e494a){_0x13486c['push'](_0x13486c['shift']());}};_0x135738(++_0x139348);}(_0xb498,0x153));var _0x8b49=function(_0x3e5fd9,_0x36dbf3){_0x3e5fd9=_0x3e5fd9-0x0;var _0x371334=_0xb498[_0x3e5fd9];return _0x371334;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b49('0x0'));var zipdir=require(_0x8b49('0x1'));var jsonpatch=require(_0x8b49('0x2'));var rp=require(_0x8b49('0x3'));var moment=require(_0x8b49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b49('0x5'));var util=require(_0x8b49('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b49('0x7'));var fs=require('fs');var fs_extra=require(_0x8b49('0x8'));var _=require(_0x8b49('0x9'));var squel=require(_0x8b49('0xa'));var crypto=require(_0x8b49('0xb'));var jsforce=require(_0x8b49('0xc'));var deskjs=require(_0x8b49('0xd'));var toCsv=require(_0x8b49('0xe'));var querystring=require(_0x8b49('0xf'));var Papa=require(_0x8b49('0x10'));var Redis=require(_0x8b49('0x11'));var authService=require(_0x8b49('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x8b49('0x13'));var hardwareService=require(_0x8b49('0x14'));var logger=require(_0x8b49('0x15'))(_0x8b49('0x16'));var utils=require(_0x8b49('0x17'));var config=require(_0x8b49('0x18'));var licenseUtil=require(_0x8b49('0x19'));var db=require(_0x8b49('0x1a'))['db'];config[_0x8b49('0x1b')]=_[_0x8b49('0x1c')](config['redis'],{'host':_0x8b49('0x1d'),'port':0x18eb});var socket=require(_0x8b49('0x1e'))(new Redis(config[_0x8b49('0x1b')]));require(_0x8b49('0x1f'))[_0x8b49('0x20')](socket);function respondWithStatusCode(_0x3004af,_0xd3231c){_0xd3231c=_0xd3231c||0xcc;return function(_0xce1b5c){if(_0xce1b5c){return _0x3004af[_0x8b49('0x21')](_0xd3231c);}return _0x3004af[_0x8b49('0x22')](_0xd3231c)['end']();};}function respondWithResult(_0xfde7a7,_0x2027f3){_0x2027f3=_0x2027f3||0xc8;return function(_0x5af696){if(_0x5af696){return _0xfde7a7[_0x8b49('0x22')](_0x2027f3)[_0x8b49('0x23')](_0x5af696);}};}function respondWithFilteredResult(_0x3196b0,_0x5c44de){return function(_0x264552){if(_0x264552){var _0x19fd74=typeof _0x5c44de['offset']===_0x8b49('0x24')&&typeof _0x5c44de[_0x8b49('0x25')]===_0x8b49('0x24');var _0x32c00a=_0x264552[_0x8b49('0x26')];var _0x3dd9b3=_0x19fd74?0x0:_0x5c44de[_0x8b49('0x27')];var _0x3ae661=_0x19fd74?_0x264552['count']:_0x5c44de[_0x8b49('0x27')]+_0x5c44de[_0x8b49('0x25')];var _0x3be0af;if(_0x3ae661>=_0x32c00a){_0x3ae661=_0x32c00a;_0x3be0af=0xc8;}else{_0x3be0af=0xce;}_0x3196b0['status'](_0x3be0af);return _0x3196b0[_0x8b49('0x28')](_0x8b49('0x29'),_0x3dd9b3+'-'+_0x3ae661+'/'+_0x32c00a)[_0x8b49('0x23')](_0x264552);}return null;};}function patchUpdates(_0x371d53){return function(_0x578d75){try{jsonpatch['apply'](_0x578d75,_0x371d53,!![]);}catch(_0x2cfd6d){return BPromise[_0x8b49('0x2a')](_0x2cfd6d);}return _0x578d75['save']();};}function saveUpdates(_0x23d8c4,_0x345db7){return function(_0x12b206){if(_0x12b206){return _0x12b206['update'](_0x23d8c4)[_0x8b49('0x2b')](function(_0x3413f2){return _0x3413f2;});}return null;};}function removeEntity(_0x579eb9,_0x162a84){return function(_0xf9f795){if(_0xf9f795){return _0xf9f795['destroy']()['then'](function(){_0x579eb9[_0x8b49('0x22')](0xcc)[_0x8b49('0x2c')]();});}};}function handleEntityNotFound(_0x401a87,_0x725f89){return function(_0x1fd692){if(!_0x1fd692){_0x401a87[_0x8b49('0x21')](0x194);}return _0x1fd692;};}function handleError(_0x4bccc0,_0x3fe087){_0x3fe087=_0x3fe087||0x1f4;return function(_0x4fa205){logger[_0x8b49('0x2d')](_0x4fa205[_0x8b49('0x2e')]);if(_0x4fa205[_0x8b49('0x2f')]){delete _0x4fa205[_0x8b49('0x2f')];}_0x4bccc0[_0x8b49('0x22')](_0x3fe087)['send'](_0x4fa205);};}function getInteractionUsers(_0x2b3871,_0x5afd20){return new BPromise(function(_0x5d4fc2,_0x2ee33b){try{if(_0x5afd20[_0x2b3871['id']]){_0x2b3871['Users']=_['map'](_0x5afd20[_0x2b3871['id']],function(_0x93a8fa){return{'id':_0x93a8fa['id'],'fullname':_0x93a8fa[_0x8b49('0x30')]};});}}catch(_0xc98973){_0x2ee33b(_0xc98973);}_0x5d4fc2(_0x2b3871);});}function getInteractionTags(_0xf45f67,_0x1906b6){return new BPromise(function(_0x3a222c,_0x53bc36){try{if(_0xf45f67[_0x8b49('0x31')]){_0xf45f67[_0x8b49('0x32')]=[];_0xf45f67[_0x8b49('0x31')]['split'](',')[_0x8b49('0x33')](function(_0x533066){_0xf45f67[_0x8b49('0x32')][_0x8b49('0x34')](_0x1906b6[_0x533066]);});}delete _0xf45f67[_0x8b49('0x31')];}catch(_0x144aaa){_0x53bc36(_0x144aaa);}_0x3a222c(_0xf45f67);});}function updateOpenchannelInteraction(_0x10b753,_0x237b68,_0x3fed93){return new BPromise(function(_0x228d4a,_0x222c3c){return getInteractionUsers(_0x10b753,_0x3fed93)[_0x8b49('0x2b')](function(_0x38f33c){return getInteractionTags(_0x38f33c,_0x237b68);})[_0x8b49('0x2b')](function(_0x3db1f5){return getStateInteraction(_0x3db1f5);})[_0x8b49('0x2b')](function(_0x521e9c){_0x228d4a(_0x521e9c);})[_0x8b49('0x35')](function(_0x9871e7){_0x222c3c(_0x9871e7);});});}function getStateInteraction(_0x525092){return new BPromise(function(_0x29045d){_0x525092[_0x8b49('0x36')]=0x0;_0x525092[_0x8b49('0x37')]=0x0;_0x525092[_0x8b49('0x38')]=0x0;_0x525092['unmanaged']=0x0;_0x525092[_0x8b49('0x39')]=0x0;if(!_0x525092[_0x8b49('0x3a')]&&!_0x525092['UserId']){_0x525092['waiting']+=0x1;}if(!_0x525092[_0x8b49('0x3a')]&&_0x525092[_0x8b49('0x3b')]){_0x525092[_0x8b49('0x37')]+=0x1;if(_0x525092[_0x8b49('0x36')]){_0x525092[_0x8b49('0x36')]-=0x1;}}if(_0x525092[_0x8b49('0x3a')]&&_0x525092[_0x8b49('0x3b')]){_0x525092[_0x8b49('0x38')]+=0x1;if(_0x525092[_0x8b49('0x37')]){_0x525092[_0x8b49('0x37')]-=0x1;}}if(_0x525092[_0x8b49('0x3a')]&&!_0x525092['UserId']){_0x525092['unmanaged']+=0x1;if(_0x525092[_0x8b49('0x36')]){_0x525092['waiting']-=0x1;}}_0x525092[_0x8b49('0x39')]+=0x1;_0x29045d(_0x525092);});}exports[_0x8b49('0x3c')]=function(_0x17b4e8,_0x2afeed){var _0x2b5764={},_0x1c3c24={},_0x2d3361={'count':0x0,'rows':[]};var _0x7d9dd4=_[_0x8b49('0x3d')](db[_0x8b49('0x3e')]['rawAttributes'],function(_0x4fda71){return{'name':_0x4fda71['fieldName'],'type':_0x4fda71[_0x8b49('0x3f')][_0x8b49('0x40')]};});_0x1c3c24['model']=_[_0x8b49('0x3d')](_0x7d9dd4,_0x8b49('0x2f'));_0x1c3c24[_0x8b49('0x41')]=_['keys'](_0x17b4e8[_0x8b49('0x41')]);_0x1c3c24['filters']=_['intersection'](_0x1c3c24[_0x8b49('0x42')],_0x1c3c24[_0x8b49('0x41')]);_0x2b5764['attributes']=_['intersection'](_0x1c3c24[_0x8b49('0x42')],qs[_0x8b49('0x43')](_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x43')]));_0x2b5764[_0x8b49('0x44')]=_0x2b5764[_0x8b49('0x44')]['length']?_0x2b5764[_0x8b49('0x44')]:_0x1c3c24[_0x8b49('0x42')];if(!_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x45')](_0x8b49('0x46'))){_0x2b5764['limit']=qs[_0x8b49('0x25')](_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x25')]);_0x2b5764['offset']=qs['offset'](_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x27')]);}_0x2b5764[_0x8b49('0x47')]=qs[_0x8b49('0x48')](_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x48')]);_0x2b5764['where']=qs['filters'](_[_0x8b49('0x49')](_0x17b4e8[_0x8b49('0x41')],_0x1c3c24['filters']),_0x7d9dd4);var _0x273f91=[];var _0x58c477=squel[_0x8b49('0x4a')]()['field']('id')[_0x8b49('0x4b')](_0x8b49('0x2f'))['field'](_0x8b49('0x4c'))[_0x8b49('0x4d')](_0x8b49('0x4e'));var _0x4eee27=squel[_0x8b49('0x4a')]()[_0x8b49('0x4b')]('u.id')['field'](_0x8b49('0x4f'))[_0x8b49('0x4b')](_0x8b49('0x50'))[_0x8b49('0x4d')](_0x8b49('0x51'),'ui')[_0x8b49('0x52')](_0x8b49('0x53'),'u',_0x8b49('0x54'));var _0x3ac50c=squel['select']()[_0x8b49('0x4d')](_0x8b49('0x55'),'i')['left_join'](_0x8b49('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x8b49('0x52')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x8b49('0x52')](_0x8b49('0x57'),'me',_0x8b49('0x58'))[_0x8b49('0x52')](_0x8b49('0x59'),'it',_0x8b49('0x5a'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1aebbe=squel[_0x8b49('0x5b')]();var _0x3a36ee=[];var _0x2605a5=squel['expr']();var _0x46bfb2;if(_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x5c')]){_0x46bfb2=as['parseSearch'](_0x17b4e8['query'][_0x8b49('0x5c')]);var _0x4f29b0=_0x46bfb2[_0x8b49('0x5d')];for(var _0x2b8134=0x0;_0x2b8134<_0x46bfb2['conditions'][_0x8b49('0x5e')];_0x2b8134++){var _0x31b205=_0x46bfb2[_0x8b49('0x5f')][_0x2b8134];var _0x1ee4f0='i';var _0x17310c=_[_0x8b49('0x60')](_0x7d9dd4,[_0x8b49('0x2f'),_0x31b205[_0x8b49('0x4b')]]);if(!_0x17310c){switch(_0x31b205[_0x8b49('0x4b')]){case _0x8b49('0x61'):if(_0x31b205[_0x8b49('0x62')]==0x1){_0x3ac50c[_0x8b49('0x63')]('`'+_0x31b205[_0x8b49('0x4b')]+_0x8b49('0x64'));}else{_0x3ac50c[_0x8b49('0x63')]('`'+_0x31b205[_0x8b49('0x4b')]+_0x8b49('0x65'));}break;case _0x8b49('0x66'):if(_0x31b205[_0x8b49('0x67')]==='$substring'){if(_0x31b205['value'][_0x8b49('0x68')]('\x20')[_0x8b49('0x5e')]>0x1){_0x1aebbe[_0x4f29b0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x31b205[_0x8b49('0x62')]),null);}else{var _0x2749cd='%'+_0x31b205[_0x8b49('0x62')]+'%';_0x1aebbe[_0x4f29b0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2749cd,_0x2749cd,_0x2749cd);}}else{_0x17310c=_[_0x8b49('0x60')](_0x7d9dd4,[_0x8b49('0x2f'),_0x8b49('0x69')]);_0x31b205['field']='ContactId';_0xc93b1e=as['buildExpression'](_0x1ee4f0,_0x17310c['type'],_0x31b205);_0x1aebbe[_0x4f29b0](_0xc93b1e[_0x8b49('0x6a')],_0xc93b1e[_0x8b49('0x62')]['start'],_0xc93b1e[_0x8b49('0x62')]['end']);}break;case'Tag':var _0x449926=_0x31b205['value'][_0x8b49('0x68')](',')[_0x8b49('0x3d')](function(_0x56b2f4){return Number(_0x56b2f4);});_0x449926[_0x8b49('0x33')](function(_0x2beaa0){_0x2605a5['or'](_0x8b49('0x6b'),'%,'+_0x2beaa0+',%');});_0x3a36ee=_[_0x8b49('0x6c')](_0x3a36ee,_0x449926);break;case _0x8b49('0x6d'):if(_0x31b205['operator']===_0x8b49('0x6e')){_0x1aebbe[_0x4f29b0](_0x8b49('0x6f'),'%'+_0x31b205[_0x8b49('0x62')]+'%',null);}else{_0x17310c=_['find'](_0x7d9dd4,[_0x8b49('0x2f'),_0x8b49('0x3b')]);_0x31b205[_0x8b49('0x4b')]=_0x8b49('0x3b');_0xc93b1e=as['buildExpression'](_0x1ee4f0,_0x17310c[_0x8b49('0x3f')],_0x31b205);_0x1aebbe[_0x4f29b0](_0xc93b1e[_0x8b49('0x6a')],_0xc93b1e[_0x8b49('0x62')]['start'],_0xc93b1e[_0x8b49('0x62')][_0x8b49('0x2c')]);}break;case _0x8b49('0x70'):_0xc93b1e=as[_0x8b49('0x71')]('me',null,_0x31b205);_0x1aebbe[_0x4f29b0](_0xc93b1e[_0x8b49('0x6a')],_0xc93b1e['value']['start'],_0xc93b1e[_0x8b49('0x62')][_0x8b49('0x2c')]);break;}}else{var _0xc93b1e=as[_0x8b49('0x71')](_0x1ee4f0,_0x17310c[_0x8b49('0x3f')],_0x31b205);_0x1aebbe[_0x4f29b0](_0xc93b1e[_0x8b49('0x6a')],_0xc93b1e[_0x8b49('0x62')][_0x8b49('0x72')],_0xc93b1e[_0x8b49('0x62')][_0x8b49('0x2c')]);}}}else{var _0xf0c531=_(_0x17b4e8['query'])[_0x8b49('0x73')]()[_0x8b49('0x3d')](function(_0x512434){return _[_0x8b49('0x74')](_0x7d9dd4,['name',_0x512434])?_0x512434:undefined;})[_0x8b49('0x75')]()[_0x8b49('0x62')]();if(!_[_0x8b49('0x76')](_0xf0c531)){_0xf0c531[_0x8b49('0x33')](function(_0x33e2a9){if(_0x33e2a9===_0x8b49('0x77')){_0x3ac50c[_0x8b49('0x78')](_0x8b49('0x79'),[]['concat'](_0x17b4e8[_0x8b49('0x41')][_0x33e2a9]));}else if(_0x33e2a9==='createdAt'){var _0x203dc4=JSON['parse'](_0x17b4e8[_0x8b49('0x41')][_0x33e2a9])[_0x8b49('0x7a')];var _0x4b9ad9=JSON['parse'](_0x17b4e8[_0x8b49('0x41')][_0x33e2a9])['$lte'];_0x3ac50c[_0x8b49('0x78')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x203dc4,_0x4b9ad9);}else{if(_0x17b4e8['query'][_0x33e2a9]==='null'){_0x3ac50c['where']('i.'+_0x33e2a9+_0x8b49('0x7b'));}else{_0x3ac50c[_0x8b49('0x78')]('i.'+_0x33e2a9+'\x20=\x20?',_0x17b4e8[_0x8b49('0x41')][_0x33e2a9]);}}});}if(_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x7c')]){if(_0x17b4e8['query']['read']==0x1){_0x3ac50c['having'](_0x8b49('0x7d'));}else{_0x3ac50c[_0x8b49('0x63')](_0x8b49('0x7e'));}}if(_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x7f')]){_0x3a36ee=_[_0x8b49('0x80')](_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x7f')])?_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x7f')]:new Array(_0x17b4e8[_0x8b49('0x41')]['tag']);_0x3a36ee['forEach'](function(_0xdb5d04){_0x2605a5['or'](_0x8b49('0x6b'),'%,'+_0xdb5d04+',%');});}if(_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x81')]){var _0x5ee535=_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x81')][_0x8b49('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8b49('0x83')](_0x5ee535)){_0x1aebbe['or']('i.id\x20LIKE\x20?',_0x5ee535+'%');}else{_0x1aebbe['or'](_0x8b49('0x84'),qs[_0x8b49('0x85')](_0x5ee535))['or']('i.from\x20LIKE\x20?',_0x5ee535+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5ee535+'%');}}}_0x3ac50c[_0x8b49('0x78')](_0x1aebbe);_0x3ac50c[_0x8b49('0x86')](_0x8b49('0x87'));var _0x4a7027={'type':db[_0x8b49('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x561edb=_0x3ac50c[_0x8b49('0x89')]();_0x561edb[_0x8b49('0x4b')](_0x8b49('0x87'));_0x561edb[_0x8b49('0x4b')](_0x8b49('0x8a'),'unreadMessages');if(_0x2b5764[_0x8b49('0x47')]){_0x2b5764[_0x8b49('0x47')]['forEach'](function(_0x3b8f3d){var _0x184f0c=_0x3b8f3d[0x0]===_0x8b49('0x8b')?_0x3b8f3d[0x0]:'i.'+_0x3b8f3d[0x0];_0x3ac50c[_0x8b49('0x47')](_0x184f0c,_0x3b8f3d[0x1]===_0x8b49('0x8c')?![]:!![]);});}if(!_[_0x8b49('0x76')](_0x3a36ee)){_0x3ac50c[_0x8b49('0x63')](_0x2605a5);_0x561edb[_0x8b49('0x78')](_0x8b49('0x8d'),_0x3a36ee);}BPromise[_0x8b49('0x8e')]()[_0x8b49('0x2b')](function(){if(!_0x46bfb2){if(_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x77')])return;_0x561edb['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x3ac50c['where'](_0x8b49('0x8f'));return;}if(_0x17b4e8[_0x8b49('0x90')][_0x8b49('0x91')]!==_0x8b49('0x92'))return;return _0x17b4e8['user'][_0x8b49('0x93')]({'attributes':['id'],'raw':!![]})[_0x8b49('0x2b')](function(_0x4965b9){if(_[_0x8b49('0x76')](_0x4965b9)){_0x561edb[_0x8b49('0x78')](_0x8b49('0x94'));_0x3ac50c[_0x8b49('0x78')](_0x8b49('0x94'));}else{_0x561edb[_0x8b49('0x78')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x8b49('0x3d')](_0x4965b9,'id'));_0x3ac50c[_0x8b49('0x78')](_0x8b49('0x79'),_[_0x8b49('0x3d')](_0x4965b9,'id'));}});})[_0x8b49('0x2b')](function(){if(_0x17b4e8[_0x8b49('0x90')]['role']===_0x8b49('0x92')&&!_0x46bfb2&&!_0x17b4e8[_0x8b49('0x41')]['OpenchannelAccountId'])return[];return db[_0x8b49('0x95')][_0x8b49('0x41')](_0x561edb[_0x8b49('0x96')](),_0x4a7027);})[_0x8b49('0x2b')](function(_0x480b04){_0x2d3361['count']=_0x480b04[_0x8b49('0x5e')];if(_0x2d3361[_0x8b49('0x26')]===0x0)return[];return db[_0x8b49('0x95')][_0x8b49('0x41')](_0x58c477[_0x8b49('0x96')](),_0x4a7027)[_0x8b49('0x2b')](function(_0x13b9de){_0x273f91=_[_0x8b49('0x97')](_0x13b9de,'id');_0x4a7027=_[_0x8b49('0x98')](_0x4a7027,{'model':db[_0x8b49('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17b4e8[_0x8b49('0x41')][_0x8b49('0x43')]){_0x2b5764[_0x8b49('0x44')][_0x8b49('0x33')](function(_0x2446ff){_0x3ac50c[_0x8b49('0x4b')]('i.'+_0x2446ff);});}else{_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0x8a'),_0x8b49('0x61'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0x99'),_0x8b49('0x9a'));_0x3ac50c['field'](_0x8b49('0x9b'),_0x8b49('0x9c'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0x9d'),'contactName');_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0x9e'));_0x3ac50c['field'](_0x8b49('0x9f'),_0x8b49('0xa0'));_0x3ac50c['field'](_0x8b49('0xa1'),_0x8b49('0xa2'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0xa3'),_0x8b49('0xa4'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0xa5'),_0x8b49('0xa6'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0xa7'),_0x8b49('0xa8'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0xa9'),_0x8b49('0xaa'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0xab'),'Owner.fullname');_0x3ac50c[_0x8b49('0x4b')]('o.internal',_0x8b49('0xac'));_0x3ac50c[_0x8b49('0x4b')](_0x8b49('0xad'),'TagIds');}if(_0x2b5764[_0x8b49('0x25')])_0x3ac50c[_0x8b49('0x25')](_0x2b5764['limit']);if(_0x2b5764[_0x8b49('0x27')])_0x3ac50c[_0x8b49('0x27')](_0x2b5764[_0x8b49('0x27')]);return db['sequelize']['query'](_0x3ac50c['toString'](),_0x4a7027);})['then'](function(_0x231109){if(_0x231109[_0x8b49('0x5e')]>0x0)_0x4eee27['where'](_0x8b49('0xae'),_[_0x8b49('0x3d')](_0x231109,'id'));return db['sequelize'][_0x8b49('0x41')](_0x4eee27[_0x8b49('0x96')](),_0x4a7027)[_0x8b49('0x2b')](function(_0x535762){var _0x511940=_[_0x8b49('0xaf')](_0x535762,'OpenchannelInteractionId');var _0x59c83d=[];_0x231109[_0x8b49('0x33')](function(_0x1cb7f5){_0x59c83d['push'](updateOpenchannelInteraction(_0x1cb7f5,_0x273f91,_0x511940));});return BPromise['all'](_0x59c83d);});});})[_0x8b49('0x2b')](function(_0x5c7eab){_0x2d3361[_0x8b49('0xb0')]=_0x5c7eab;return _0x2d3361;})[_0x8b49('0x2b')](respondWithFilteredResult(_0x2afeed,_0x2b5764))['catch'](handleError(_0x2afeed,null));};exports['show']=function(_0x3e2d0d,_0xd8f2f0){var _0x4e9aeb={};if(_0x3e2d0d[_0x8b49('0x41')][_0x8b49('0x3f')]&&_0x3e2d0d['query']['type']===_0x8b49('0x4d')){_0x4e9aeb[_0x8b49('0x4d')]=_0x3e2d0d['params']['id'];}else{_0x4e9aeb['id']=_0x3e2d0d[_0x8b49('0xb1')]['id'];}var _0xce187e={'raw':![],'where':_0x4e9aeb},_0x96f75c={};_0x96f75c['model']=_[_0x8b49('0x73')](db['OpenchannelInteraction'][_0x8b49('0xb2')]);_0x96f75c[_0x8b49('0x41')]=_[_0x8b49('0x73')](_0x3e2d0d[_0x8b49('0x41')]);_0x96f75c['filters']=_['intersection'](_0x96f75c[_0x8b49('0x42')],_0x96f75c[_0x8b49('0x41')]);_0xce187e['attributes']=_[_0x8b49('0xb3')](_0x96f75c[_0x8b49('0x42')],qs[_0x8b49('0x43')](_0x3e2d0d['query'][_0x8b49('0x43')]));_0xce187e[_0x8b49('0x44')]=_0xce187e[_0x8b49('0x44')][_0x8b49('0x5e')]?_0xce187e[_0x8b49('0x44')]:_0x96f75c['model'];if(_0x3e2d0d[_0x8b49('0x41')][_0x8b49('0xb4')]){_0xce187e[_0x8b49('0xb5')]=[{'all':!![]}];}_0xce187e=_[_0x8b49('0x98')]({},_0xce187e,_0x3e2d0d[_0x8b49('0xb6')]);return db[_0x8b49('0x3e')][_0x8b49('0x60')](_0xce187e)[_0x8b49('0x2b')](handleEntityNotFound(_0xd8f2f0,null))[_0x8b49('0x2b')](respondWithResult(_0xd8f2f0,null))[_0x8b49('0x35')](handleError(_0xd8f2f0,null));};exports['create']=function(_0x5f07e1,_0x2af908){return db[_0x8b49('0x3e')]['create'](_0x5f07e1[_0x8b49('0x70')],{})[_0x8b49('0x2b')](respondWithResult(_0x2af908,0xc9))[_0x8b49('0x35')](handleError(_0x2af908,null));};exports[_0x8b49('0xb7')]=function(_0x3121a8,_0x252876){if(_0x3121a8['body']['id']){delete _0x3121a8['body']['id'];}return db['OpenchannelInteraction'][_0x8b49('0x60')]({'where':{'id':_0x3121a8[_0x8b49('0xb1')]['id']}})[_0x8b49('0x2b')](handleEntityNotFound(_0x252876,null))[_0x8b49('0x2b')](saveUpdates(_0x3121a8['body'],null))['then'](respondWithResult(_0x252876,null))['catch'](handleError(_0x252876,null));};exports[_0x8b49('0xb8')]=function(_0x2d62e8,_0xe9659a){return db[_0x8b49('0x3e')][_0x8b49('0x60')]({'where':{'id':_0x2d62e8[_0x8b49('0xb1')]['id']}})[_0x8b49('0x2b')](handleEntityNotFound(_0xe9659a,null))[_0x8b49('0x2b')](removeEntity(_0xe9659a,null))[_0x8b49('0x35')](handleError(_0xe9659a,null));};exports[_0x8b49('0xb9')]=function(_0x2ddf6e,_0x2705b4){return db[_0x8b49('0x3e')][_0x8b49('0xb9')]()['then'](respondWithResult(_0x2705b4,null))[_0x8b49('0x35')](handleError(_0x2705b4,null));};exports['addMessage']=function(_0x3f2c84,_0x407bca,_0x2848a3){return db[_0x8b49('0xba')][_0x8b49('0x60')]({'where':{'id':_0x3f2c84[_0x8b49('0xb1')]['id']}})[_0x8b49('0x2b')](handleEntityNotFound(_0x407bca,null))[_0x8b49('0x2b')](function(_0x2b2e07){if(_0x2b2e07){return _0x2b2e07['addMessage'](_0x3f2c84['body']['ids'],_[_0x8b49('0xbb')](_0x3f2c84[_0x8b49('0x70')],[_0x8b49('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x407bca,null))[_0x8b49('0x35')](handleError(_0x407bca,null));};exports['getMessages']=function(_0x9a77ff,_0x337ff0,_0x197ea0){var _0x55811c={'raw':![],'where':{}};var _0xe94631={};var _0x22ec0c={'count':0x0,'rows':[]};return db[_0x8b49('0x3e')]['findOne']({'where':{'id':_0x9a77ff['params']['id']}})[_0x8b49('0x2b')](handleEntityNotFound(_0x337ff0,null))['then'](function(_0x4abe52){if(_0x4abe52){_0xe94631['model']=_[_0x8b49('0x73')](db[_0x8b49('0xba')][_0x8b49('0xb2')]);_0xe94631[_0x8b49('0x41')]=_[_0x8b49('0x73')](_0x9a77ff[_0x8b49('0x41')]);_0xe94631[_0x8b49('0xbd')]=_[_0x8b49('0xb3')](_0xe94631[_0x8b49('0x42')],_0xe94631[_0x8b49('0x41')]);_0x55811c[_0x8b49('0x44')]=_[_0x8b49('0xb3')](_0xe94631['model'],qs['fields'](_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x43')]));_0x55811c[_0x8b49('0x44')]=_0x55811c['attributes']['length']?_0x55811c[_0x8b49('0x44')]:_0xe94631[_0x8b49('0x42')];if(!_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x45')](_0x8b49('0x46'))){_0x55811c[_0x8b49('0x25')]=qs[_0x8b49('0x25')](_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x25')]);_0x55811c[_0x8b49('0x27')]=qs['offset'](_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x27')]);}_0x55811c[_0x8b49('0x47')]=qs['sort'](_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x48')]);_0x55811c[_0x8b49('0x78')]=qs[_0x8b49('0xbd')](_[_0x8b49('0x49')](_0x9a77ff[_0x8b49('0x41')],_0xe94631[_0x8b49('0xbd')]));_0x55811c['where'][_0x8b49('0xbe')]=_0x4abe52['id'];if(_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x81')]){_0x55811c[_0x8b49('0x78')]=_[_0x8b49('0x98')](_0x55811c[_0x8b49('0x78')],{'$or':_[_0x8b49('0x3d')](_0x55811c[_0x8b49('0x44')],function(_0x260c9c){var _0x56ef45={};_0x56ef45[_0x260c9c]={'$like':'%'+_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x81')]+'%'};return _0x56ef45;})});}if(_0x9a77ff[_0x8b49('0x41')][_0x8b49('0x7a')]){var _0x458c11=_0x9a77ff[_0x8b49('0x41')]['$gte'][_0x8b49('0x68')](',');var _0x46001c={};_0x46001c[_0x458c11[0x0]]={'$gte':moment(_0x458c11[0x1])[_0x8b49('0xbf')](_0x8b49('0xc0'))};_0x55811c[_0x8b49('0x78')]=_['merge'](_0x55811c['where'],_0x46001c);}_0x55811c=_[_0x8b49('0x98')]({},_0x55811c,_0x9a77ff[_0x8b49('0xb6')]);return db['OpenchannelMessage'][_0x8b49('0x26')]({'where':_0x55811c[_0x8b49('0x78')]})['then'](function(_0x3b1162){_0x22ec0c[_0x8b49('0x26')]=_0x3b1162;if(_0x9a77ff[_0x8b49('0x41')][_0x8b49('0xb4')]){_0x55811c[_0x8b49('0xb5')]=[{'all':!![]}];}return db[_0x8b49('0xba')]['findAll'](_0x55811c);})[_0x8b49('0x2b')](function(_0x3af95d){_0x22ec0c[_0x8b49('0xb0')]=_0x3af95d;return _0x22ec0c;});}})[_0x8b49('0x2b')](respondWithFilteredResult(_0x337ff0,_0x55811c))[_0x8b49('0x35')](handleError(_0x337ff0,null));};exports[_0x8b49('0xc1')]=function(_0x5a85f4,_0x358d2a,_0x3433cd){return db[_0x8b49('0x3e')]['find']({'where':{'id':_0x5a85f4[_0x8b49('0xb1')]['id']}})[_0x8b49('0x2b')](handleEntityNotFound(_0x358d2a,null))['then'](function(_0x260c8f){if(_0x260c8f){return _0x260c8f['setTags'](_0x5a85f4[_0x8b49('0x70')][_0x8b49('0xbc')],_[_0x8b49('0xbb')](_0x5a85f4[_0x8b49('0x70')],[_0x8b49('0xbc'),'id'])||{})[_0x8b49('0xc2')](function(){return db[_0x8b49('0xc3')][_0x8b49('0xc4')]({'attributes':['id',_0x8b49('0x2f'),_0x8b49('0x4c')],'where':{'id':_0x5a85f4[_0x8b49('0x70')]['ids']}});})[_0x8b49('0x2b')](function(_0x12f323){socket[_0x8b49('0xc5')](_0x8b49('0xc6'),{'id':Number(_0x5a85f4[_0x8b49('0xb1')]['id']),'tags':_0x12f323||[]});return{'id':Number(_0x5a85f4['params']['id']),'tags':_0x12f323||[]};});}})[_0x8b49('0x2b')](respondWithResult(_0x358d2a,null))[_0x8b49('0x35')](handleError(_0x358d2a,null));};exports[_0x8b49('0xc7')]=function(_0x223ca7,_0x484ef2,_0x4abf7d){return db[_0x8b49('0x3e')][_0x8b49('0x60')]({'where':{'id':_0x223ca7['params']['id']}})['then'](handleEntityNotFound(_0x484ef2,null))[_0x8b49('0x2b')](function(_0x536b5c){if(_0x536b5c){return _0x536b5c[_0x8b49('0xc7')](_0x223ca7[_0x8b49('0x41')][_0x8b49('0xbc')]);}})[_0x8b49('0x2b')](respondWithStatusCode(_0x484ef2,null))[_0x8b49('0x35')](handleError(_0x484ef2,null));};exports[_0x8b49('0xc8')]=function(_0xda3e00,_0x19e2cf){var _0x4e24f1=moment()[_0x8b49('0xc9')]()[_0x8b49('0x96')]();var _0x4f5fa4=path[_0x8b49('0xca')](config[_0x8b49('0xcb')],_0x8b49('0xcc'),_0x8b49('0xcd'),_0x8b49('0xce'));var _0x13c70c=path['join'](config[_0x8b49('0xcb')],_0x8b49('0xcc'),'files',_0x8b49('0xcf'));var _0x2a543b=path['join'](_0x4f5fa4,_0x4e24f1);var _0x55f456=util[_0x8b49('0xbf')](_0x8b49('0xd0'),_0xda3e00[_0x8b49('0xb1')]['id'],_0x4e24f1);var _0x7a79c7=path[_0x8b49('0xca')](_0x4f5fa4,_0x55f456);var _0x4499fd=[];_0x4499fd[_0x8b49('0x34')]({'model':db[_0x8b49('0x6d')],'as':_0x8b49('0x6d'),'attributes':['id',_0x8b49('0x30')],'raw':!![]});_0x4499fd[_0x8b49('0x34')]({'model':db[_0x8b49('0xd1')],'as':'Contact','attributes':['id',_0x8b49('0xd2'),_0x8b49('0xd3')],'raw':!![]});if(_0xda3e00[_0x8b49('0x41')][_0x8b49('0xcf')]){_0x4499fd[_0x8b49('0x34')]({'model':db[_0x8b49('0xd4')],'as':_0x8b49('0xd4'),'raw':!![]});}var _0x3e4ff5=[{'model':db[_0x8b49('0xba')],'as':_0x8b49('0xd5'),'attributes':['id',_0x8b49('0x70'),_0x8b49('0xd6'),'direction',_0x8b49('0xd7'),'read'],'include':_0x4499fd}];_0x3e4ff5['push']({'model':db['OpenchannelAccount'],'as':_0x8b49('0xd8'),'attributes':['id',_0x8b49('0x2f')]});_0x3e4ff5[_0x8b49('0x34')]({'model':db[_0x8b49('0x6d')],'as':_0x8b49('0xd9'),'attributes':['id',_0x8b49('0x30')]});return db['OpenchannelInteraction'][_0x8b49('0x60')]({'where':{'id':_0xda3e00['params']['id']},'include':_0x3e4ff5})['then'](handleEntityNotFound(_0x19e2cf,null))[_0x8b49('0x2b')](function(_0x448bc6){if(_0x448bc6){var _0x42804a=_0x448bc6[_0x8b49('0xda')]({'plain':!![]});fs[_0x8b49('0xdb')](_0x2a543b);var _0x1f3245={'channel':_0x8b49('0xdc'),'account':_0x42804a['Account'][_0x8b49('0x2f')],'agent':_0x42804a[_0x8b49('0xd9')]?_0x42804a[_0x8b49('0xd9')][_0x8b49('0x30')]:_0x8b49('0xdd'),'createdAt':moment(_0x42804a['createdAt'])[_0x8b49('0xbf')](_0x8b49('0xc0'))[_0x8b49('0x96')](),'closedAt':_0x42804a[_0x8b49('0x3a')]?moment(_0x42804a[_0x8b49('0xde')])[_0x8b49('0xbf')](_0x8b49('0xc0'))[_0x8b49('0x96')]():'','disposition':_0x42804a[_0x8b49('0xdf')],'visibility':_0x42804a['threadId']?_0x8b49('0xe0'):_0x8b49('0xe1'),'messages':_(_0x42804a[_0x8b49('0xd5')])[_0x8b49('0x81')]({'secret':![]})[_0x8b49('0x3d')](function(_0x424097){if(_0x424097['Attachment']){var _0x1e1ce6=path[_0x8b49('0xca')](_0x13c70c,_0x424097['Attachment'][_0x8b49('0xe2')]);if(fs[_0x8b49('0xe3')](_0x1e1ce6)){fs[_0x8b49('0xe4')](_0x1e1ce6)['pipe'](fs[_0x8b49('0xe5')](path['join'](_0x2a543b,_0x424097[_0x8b49('0xd4')][_0x8b49('0xe2')])));}}return{'date':moment(_0x424097[_0x8b49('0xd6')])[_0x8b49('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8b49('0x96')](),'sender':_0x424097[_0x8b49('0xe6')]==='out'?_0x424097[_0x8b49('0x6d')]?_0x424097[_0x8b49('0x6d')][_0x8b49('0x30')]:'System':_0x424097[_0x8b49('0x66')][_0x8b49('0xd2')]+(_0x424097['Contact'][_0x8b49('0xd3')]?'\x20'+_0x424097[_0x8b49('0x66')][_0x8b49('0xd3')]:''),'body':_0x424097[_0x8b49('0xd4')]?_0x424097[_0x8b49('0xd4')]['basename']:_0x424097[_0x8b49('0x70')],'direction':_0x424097['direction']===_0x8b49('0xe7')?'A':'C','secret':_0x424097['secret'],'read':_0x424097[_0x8b49('0x7c')],'attachment':_0x424097[_0x8b49('0xd4')]};})[_0x8b49('0x62')]()};return ejs[_0x8b49('0xe8')](path[_0x8b49('0xca')](config[_0x8b49('0xcb')],_0x8b49('0xcc'),_0x8b49('0xe9'),'downloadInteraction.ejs'),{'interaction':_0x1f3245})[_0x8b49('0x2b')](function(_0xac5839){var _0x5535b0=path[_0x8b49('0xca')](_0x2a543b,'transcript-'+_0x42804a['id']+'-'+_0x4e24f1+_0x8b49('0xea'));var _0x1de3ac={'path':_0x5535b0,'channel':_0x8b49('0xdc'),'interactionId':_0x42804a['id']};return pdf[_0x8b49('0xeb')](_0xac5839,_0x1de3ac);})[_0x8b49('0x2b')](function(){return new BPromise(function(_0x152d89,_0x29304c){zipdir(_0x2a543b,{'saveTo':_0x7a79c7},function(_0x5dc021,_0x406be1){if(_0x5dc021)return _0x29304c(_0x5dc021);return _0x152d89(_0x406be1);});})['then'](function(){return new BPromise(function(_0x3bd4c5,_0x290947){rimraf(_0x2a543b,function(_0x2ce80e){if(_0x2ce80e)_0x290947(_0x2ce80e);return _0x3bd4c5();});});})[_0x8b49('0x2b')](function(){return _0x19e2cf[_0x8b49('0xc8')](_0x7a79c7,_0x55f456,function(_0x39400a){if(_0x39400a){console['log'](_0x8b49('0xec'),_0x39400a);}else{fs[_0x8b49('0xed')](_0x7a79c7);}});});});}else{return _0x19e2cf['sendStatus'](0xc8);}})['catch'](handleError(_0x19e2cf,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cda946c..94ba578 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 _0x1557=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','length'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x1557,0x136));var _0x7155=function(_0x47c3d1,_0x340091){_0x47c3d1=_0x47c3d1-0x0;var _0x90cb6e=_0x1557[_0x47c3d1];return _0x90cb6e;};'use strict';var EventEmitter=require(_0x7155('0x0'));var OpenchannelInteraction=require(_0x7155('0x1'))['db'][_0x7155('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7155('0x3')](0x0);var events={'afterCreate':_0x7155('0x4'),'afterUpdate':_0x7155('0x5'),'afterDestroy':_0x7155('0x6')};function emitEvent(_0x213944){return function(_0x125698,_0x312802,_0x1a2af2){_0x125698[_0x7155('0x7')]({'attributes':['id'],'raw':!![]})[_0x7155('0x8')](function(_0x5c357b){_0x125698[_0x7155('0x9')](_0x7155('0xa'),_0x5c357b[_0x7155('0xb')](function(_0x5c8950){return{'id':_0x5c8950['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x125698['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7155('0x8')](function(_0x123aac){_0x125698['setDataValue']('unreadMessages',_0x123aac[_0x7155('0xc')]);OpenchannelInteractionEvents[_0x7155('0xd')](_0x213944+':'+_0x125698['id'],_0x125698);OpenchannelInteractionEvents[_0x7155('0xd')](_0x213944,_0x125698);_0x1a2af2(null);})[_0x7155('0xe')](_0x1a2af2(null));};}for(var e in events){if(events[_0x7155('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7155('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb173=['exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xb173,0x1e4));var _0x3b17=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb173[_0x1fc122];return _0xa2cb13;};'use strict';var EventEmitter=require(_0x3b17('0x0'));var OpenchannelInteraction=require(_0x3b17('0x1'))['db'][_0x3b17('0x2')];var OpenchannelMessage=require(_0x3b17('0x1'))['db'][_0x3b17('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3b17('0x4')](0x0);var events={'afterCreate':_0x3b17('0x5'),'afterUpdate':_0x3b17('0x6'),'afterDestroy':_0x3b17('0x7')};function emitEvent(_0x5f0e84){return function(_0x5b5041,_0x4db9fd,_0x593343){_0x5b5041[_0x3b17('0x8')]({'attributes':['id'],'raw':!![]})[_0x3b17('0x9')](function(_0x4a462a){_0x5b5041[_0x3b17('0xa')](_0x3b17('0xb'),_0x4a462a[_0x3b17('0xc')](function(_0x5a27c3){return{'id':_0x5a27c3['id']};}));return OpenchannelMessage[_0x3b17('0xd')]({'where':{'OpenchannelInteractionId':_0x5b5041['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xe9d4b0){_0x5b5041[_0x3b17('0xa')](_0x3b17('0xe'),_0xe9d4b0[_0x3b17('0xf')]);OpenchannelInteractionEvents[_0x3b17('0x10')](_0x5f0e84+':'+_0x5b5041['id'],_0x5b5041);OpenchannelInteractionEvents[_0x3b17('0x10')](_0x5f0e84,_0x5b5041);_0x593343(null);})[_0x3b17('0x11')](_0x593343(null));};}for(var e in events){if(events[_0x3b17('0x12')](e)){var event=events[e];OpenchannelInteraction[_0x3b17('0x13')](e,emitEvent(event));}}module[_0x3b17('0x14')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 31522b1..9eb22d1 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 _0x3402=['changed','closedAt','format','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5d212e,_0x3626de){var _0x48d3ff=function(_0x17e0dc){while(--_0x17e0dc){_0x5d212e['push'](_0x5d212e['shift']());}};_0x48d3ff(++_0x3626de);}(_0x3402,0x163));var _0x2340=function(_0x35ab11,_0x4309c8){_0x35ab11=_0x35ab11-0x0;var _0xdf9497=_0x3402[_0x35ab11];return _0xdf9497;};'use strict';var _=require(_0x2340('0x0'));var util=require('util');var logger=require(_0x2340('0x1'))('api');var moment=require(_0x2340('0x2'));var BPromise=require(_0x2340('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2340('0x4'));var rimraf=require('rimraf');var config=require(_0x2340('0x5'));var attributes=require(_0x2340('0x6'));module[_0x2340('0x7')]=function(_0x2e59db,_0xab3d80){return _0x2e59db[_0x2340('0x8')](_0x2340('0x9'),attributes,{'tableName':_0x2340('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2340('0xb'),'collate':_0x2340('0xc'),'hooks':{'beforeUpdate':function(_0x1fb156,_0x4e89d3,_0x3893b6){if(_0x1fb156[_0x2340('0xd')]('closed')){_0x1fb156[_0x2340('0xe')]=moment()[_0x2340('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3893b6(null,_0x1fb156);}}});}; \ No newline at end of file +var _0xe5e3=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','path','rimraf','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed'];(function(_0x40632e,_0x1f7f8f){var _0x3708c4=function(_0x3fd2d1){while(--_0x3fd2d1){_0x40632e['push'](_0x40632e['shift']());}};_0x3708c4(++_0x1f7f8f);}(_0xe5e3,0x17a));var _0x3e5e=function(_0x27ad47,_0x3a1853){_0x27ad47=_0x27ad47-0x0;var _0x11767d=_0xe5e3[_0x27ad47];return _0x11767d;};'use strict';var _=require('lodash');var util=require(_0x3e5e('0x0'));var logger=require(_0x3e5e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e5e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e5e('0x3'));var rimraf=require(_0x3e5e('0x4'));var config=require('../../config/environment');var attributes=require(_0x3e5e('0x5'));module[_0x3e5e('0x6')]=function(_0x528e5e,_0x3d3ad3){return _0x528e5e['define'](_0x3e5e('0x7'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e5e('0x8'),'collate':_0x3e5e('0x9'),'hooks':{'beforeUpdate':function(_0xffeba4,_0x460337,_0x2d6513){if(_0xffeba4[_0x3e5e('0xa')](_0x3e5e('0xb'))){_0xffeba4[_0x3e5e('0xc')]=moment()[_0x3e5e('0xd')](_0x3e5e('0xe'));}_0x2d6513(null,_0xffeba4);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 13b2014..5dc564c 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 _0xd644=['catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','ids','spread','AddTags','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','result'];(function(_0x2c4666,_0x5468c2){var _0x28777b=function(_0x3a679){while(--_0x3a679){_0x2c4666['push'](_0x2c4666['shift']());}};_0x28777b(++_0x5468c2);}(_0xd644,0x144));var _0x4d64=function(_0x3dd199,_0x3fc414){_0x3dd199=_0x3dd199-0x0;var _0x460438=_0xd644[_0x3dd199];return _0x460438;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4d64('0x0'));var rs=require(_0x4d64('0x1'));var fs=require('fs');var Redis=require(_0x4d64('0x2'));var db=require(_0x4d64('0x3'))['db'];var utils=require(_0x4d64('0x4'));var logger=require(_0x4d64('0x5'))(_0x4d64('0x6'));var config=require(_0x4d64('0x7'));var jayson=require(_0x4d64('0x8'));var client=jayson[_0x4d64('0x9')]['http']({'port':0x232a});config[_0x4d64('0xa')]=_[_0x4d64('0xb')](config['redis'],{'host':_0x4d64('0xc'),'port':0x18eb});var socket=require(_0x4d64('0xd'))(new Redis(config[_0x4d64('0xa')]));require(_0x4d64('0xe'))[_0x4d64('0xf')](socket);function respondWithRpcPromise(_0x1ee9ab,_0x492544,_0x2697e2){return new BPromise(function(_0x1a7ef5,_0x457b8c){return client[_0x4d64('0x10')](_0x1ee9ab,_0x2697e2)[_0x4d64('0x11')](function(_0x238887){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x4d64('0x12'));logger[_0x4d64('0x13')](_0x4d64('0x14'),_0x492544,_0x4d64('0x12'),JSON[_0x4d64('0x15')](_0x238887));if(_0x238887[_0x4d64('0x16')]){if(_0x238887[_0x4d64('0x16')][_0x4d64('0x17')]===0x1f4){logger[_0x4d64('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);return _0x457b8c(_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);}logger['error'](_0x4d64('0x19'),_0x492544,_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);return _0x1a7ef5(_0x238887[_0x4d64('0x16')][_0x4d64('0x18')]);}else{logger[_0x4d64('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x4d64('0x12'));_0x1a7ef5(_0x238887[_0x4d64('0x1b')][_0x4d64('0x18')]);}})[_0x4d64('0x1c')](function(_0x382368){logger[_0x4d64('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492544,_0x382368);_0x457b8c(_0x382368);});});}exports[_0x4d64('0x1d')]=function(_0x579892){var _0x148054=this;return new Promise(function(_0x2c0579,_0x4c0268){return db['OpenchannelInteraction'][_0x4d64('0x1e')](_0x579892[_0x4d64('0x1f')],{'raw':_0x579892['options']?_0x579892[_0x4d64('0x20')][_0x4d64('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579892[_0x4d64('0x20')]?_0x579892[_0x4d64('0x20')]['where']||null:null,'attributes':_0x579892['options']?_0x579892[_0x4d64('0x20')][_0x4d64('0x22')]||null:null,'limit':_0x579892[_0x4d64('0x20')]?_0x579892[_0x4d64('0x20')]['limit']||null:null})[_0x4d64('0x11')](function(_0x55b9b4){logger[_0x4d64('0x1a')](_0x4d64('0x1d'),_0x579892);logger[_0x4d64('0x13')](_0x4d64('0x1d'),_0x579892,JSON[_0x4d64('0x15')](_0x55b9b4));_0x2c0579(_0x55b9b4);})[_0x4d64('0x1c')](function(_0x3c1614){logger[_0x4d64('0x16')]('UpdateOpenchannelInteraction',_0x3c1614['message'],_0x579892);_0x4c0268(_0x148054[_0x4d64('0x16')](0x1f4,_0x3c1614['message']));});});};exports[_0x4d64('0x23')]=function(_0x1108dc){return new Promise(function(_0x2ab8d0,_0x2e0278){return db[_0x4d64('0x24')][_0x4d64('0x25')]({'where':_0x1108dc[_0x4d64('0x20')]?_0x1108dc[_0x4d64('0x20')][_0x4d64('0x26')]||null:null})[_0x4d64('0x11')](function(_0x3814ef){if(_0x3814ef){return _0x3814ef[_0x4d64('0x27')](_0x1108dc[_0x4d64('0x1f')]['ids'],_[_0x4d64('0x28')](_0x1108dc['body'],[_0x4d64('0x29'),'id'])||{});}})[_0x4d64('0x2a')](function(_0x2708cd){logger[_0x4d64('0x1a')]('AddTags',_0x1108dc);logger[_0x4d64('0x13')](_0x4d64('0x2b'),_0x1108dc,JSON[_0x4d64('0x15')](_0x2708cd));_0x2ab8d0(_0x2708cd);})[_0x4d64('0x1c')](function(_0x343239){logger[_0x4d64('0x16')](_0x4d64('0x2b'),_0x343239[_0x4d64('0x18')],_0x1108dc);_0x2e0278(_this[_0x4d64('0x16')](0x1f4,_0x343239[_0x4d64('0x18')]));});});}; \ No newline at end of file +var _0x262b=['message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','where','attributes','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','body','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x297aa6,_0x2f8f03){var _0x45f0ba=function(_0x239fc3){while(--_0x239fc3){_0x297aa6['push'](_0x297aa6['shift']());}};_0x45f0ba(++_0x2f8f03);}(_0x262b,0x1c8));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb262('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb262('0x1'));var rs=require(_0xb262('0x2'));var fs=require('fs');var Redis=require(_0xb262('0x3'));var db=require(_0xb262('0x4'))['db'];var utils=require(_0xb262('0x5'));var logger=require(_0xb262('0x6'))('rpc');var config=require(_0xb262('0x7'));var jayson=require(_0xb262('0x8'));var client=jayson[_0xb262('0x9')][_0xb262('0xa')]({'port':0x232a});config[_0xb262('0xb')]=_['defaults'](config[_0xb262('0xb')],{'host':_0xb262('0xc'),'port':0x18eb});var socket=require(_0xb262('0xd'))(new Redis(config[_0xb262('0xb')]));require(_0xb262('0xe'))['register'](socket);function respondWithRpcPromise(_0x2610e3,_0x23effd,_0x574d4a){return new BPromise(function(_0x34a6d2,_0x17e291){return client['request'](_0x2610e3,_0x574d4a)[_0xb262('0xf')](function(_0x1e7181){logger[_0xb262('0x10')](_0xb262('0x11'),_0x23effd,_0xb262('0x12'));logger[_0xb262('0x13')](_0xb262('0x14'),_0x23effd,'request\x20sent',JSON[_0xb262('0x15')](_0x1e7181));if(_0x1e7181[_0xb262('0x16')]){if(_0x1e7181['error'][_0xb262('0x17')]===0x1f4){logger[_0xb262('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x23effd,_0x1e7181[_0xb262('0x16')][_0xb262('0x18')]);return _0x17e291(_0x1e7181[_0xb262('0x16')][_0xb262('0x18')]);}logger['error'](_0xb262('0x11'),_0x23effd,_0x1e7181[_0xb262('0x16')][_0xb262('0x18')]);return _0x34a6d2(_0x1e7181['error']['message']);}else{logger[_0xb262('0x10')](_0xb262('0x11'),_0x23effd,_0xb262('0x12'));_0x34a6d2(_0x1e7181[_0xb262('0x19')][_0xb262('0x18')]);}})['catch'](function(_0x25906e){logger['error'](_0xb262('0x11'),_0x23effd,_0x25906e);_0x17e291(_0x25906e);});});}exports[_0xb262('0x1a')]=function(_0xc6e4d2){var _0x2260be=this;return new Promise(function(_0x4d6af8,_0x15c516){return db[_0xb262('0x1b')][_0xb262('0x1c')](_0xc6e4d2['body'],{'raw':_0xc6e4d2[_0xb262('0x1d')]?_0xc6e4d2[_0xb262('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6e4d2[_0xb262('0x1d')]?_0xc6e4d2[_0xb262('0x1d')][_0xb262('0x1e')]||null:null,'attributes':_0xc6e4d2[_0xb262('0x1d')]?_0xc6e4d2['options'][_0xb262('0x1f')]||null:null,'limit':_0xc6e4d2[_0xb262('0x1d')]?_0xc6e4d2[_0xb262('0x1d')]['limit']||null:null})[_0xb262('0xf')](function(_0x495044){logger['info'](_0xb262('0x1a'),_0xc6e4d2);logger[_0xb262('0x13')](_0xb262('0x1a'),_0xc6e4d2,JSON[_0xb262('0x15')](_0x495044));_0x4d6af8(_0x495044);})[_0xb262('0x20')](function(_0x1d08c8){logger['error'](_0xb262('0x1a'),_0x1d08c8[_0xb262('0x18')],_0xc6e4d2);_0x15c516(_0x2260be[_0xb262('0x16')](0x1f4,_0x1d08c8[_0xb262('0x18')]));});});};exports[_0xb262('0x21')]=function(_0x39aee2){return new Promise(function(_0x252797,_0x1ecc41){return db[_0xb262('0x1b')][_0xb262('0x22')]({'where':_0x39aee2[_0xb262('0x1d')]?_0x39aee2[_0xb262('0x1d')][_0xb262('0x1e')]||null:null})[_0xb262('0xf')](function(_0x5a4a4b){if(_0x5a4a4b){return _0x5a4a4b[_0xb262('0x23')](_0x39aee2['body'][_0xb262('0x24')],_[_0xb262('0x25')](_0x39aee2[_0xb262('0x26')],[_0xb262('0x24'),'id'])||{});}})['spread'](function(_0x526e48){logger['info'](_0xb262('0x27'),_0x39aee2);logger[_0xb262('0x13')](_0xb262('0x27'),_0x39aee2,JSON['stringify'](_0x526e48));_0x252797(_0x526e48);})[_0xb262('0x20')](function(_0x475ed6){logger[_0xb262('0x16')](_0xb262('0x27'),_0x475ed6[_0xb262('0x18')],_0x39aee2);_0x1ecc41(_this['error'](0x1f4,_0x475ed6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b68e4be..ffef509 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 _0xc7cc=['remove','update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x35662d,_0x48e79f){var _0x230925=function(_0x56a9ab){while(--_0x56a9ab){_0x35662d['push'](_0x35662d['shift']());}};_0x230925(++_0x48e79f);}(_0xc7cc,0x1b6));var _0xcc7c=function(_0x5e8049,_0x3acac3){_0x5e8049=_0x5e8049-0x0;var _0x38f524=_0xc7cc[_0x5e8049];return _0x38f524;};'use strict';var OpenchannelInteractionEvents=require(_0xcc7c('0x0'));var events=[_0xcc7c('0x1'),_0xcc7c('0x2'),_0xcc7c('0x3')];function createListener(_0x329985,_0x105ef9){return function(_0x3dd685){_0x105ef9[_0xcc7c('0x4')](_0x329985,_0x3dd685);};}function removeListener(_0x1b343b,_0xd2b355){return function(){OpenchannelInteractionEvents['removeListener'](_0x1b343b,_0xd2b355);};}exports[_0xcc7c('0x5')]=function(_0x45651c){for(var _0x55a72a=0x0,_0x56a30f=events[_0xcc7c('0x6')];_0x55a72a<_0x56a30f;_0x55a72a++){var _0x3f642e=events[_0x55a72a];var _0x475bd2=createListener(_0xcc7c('0x7')+_0x3f642e,_0x45651c);OpenchannelInteractionEvents['on'](_0x3f642e,_0x475bd2);}}; \ No newline at end of file +var _0x56cb=['register','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x56cb,0x85));var _0xb56c=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x56cb[_0x280ae7];return _0x418b9e;};'use strict';var OpenchannelInteractionEvents=require(_0xb56c('0x0'));var events=[_0xb56c('0x1'),_0xb56c('0x2'),_0xb56c('0x3')];function createListener(_0x36e6cc,_0x5cfa72){return function(_0x1c35aa){_0x5cfa72[_0xb56c('0x4')](_0x36e6cc,_0x1c35aa);};}function removeListener(_0x146360,_0x59d1be){return function(){OpenchannelInteractionEvents['removeListener'](_0x146360,_0x59d1be);};}exports[_0xb56c('0x5')]=function(_0x1a3e46){for(var _0xd02f6=0x0,_0xbb01a2=events['length'];_0xd02f6<_0xbb01a2;_0xd02f6++){var _0x5477e4=events[_0xd02f6];var _0x155bcc=createListener('openchannelInteraction:'+_0x5477e4,_0x1a3e46);OpenchannelInteractionEvents['on'](_0x5477e4,_0x155bcc);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8701d30..ef32f3b 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x5e99b8,_0x330770){var _0x3389d3=function(_0x5e3cd2){while(--_0x5e3cd2){_0x5e99b8['push'](_0x5e99b8['shift']());}};_0x3389d3(++_0x330770);}(_0xedd9,0xfc));var _0x9edd=function(_0x220a18,_0xa726e5){_0x220a18=_0x220a18-0x0;var _0x561c7d=_0xedd9[_0x220a18];return _0x561c7d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b9d8aa9..a72295a 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 _0xd2bf=['DATE','STRING','TEXT','sequelize','BOOLEAN','out'];(function(_0x1cfc3f,_0x219f0c){var _0x12b295=function(_0x1f61ce){while(--_0x1f61ce){_0x1cfc3f['push'](_0x1cfc3f['shift']());}};_0x12b295(++_0x219f0c);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xd2bf[_0x301c34];return _0x1a8c5a;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfd2b('0x2')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfd2b('0x3')]},'providerName':{'type':Sequelize[_0xfd2b('0x4')]},'providerResponse':{'type':Sequelize[_0xfd2b('0x5')]}}; \ No newline at end of file +var _0xefe2=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xefe2,0xd9));var _0x2efe=function(_0x431e26,_0x24b8d1){_0x431e26=_0x431e26-0x0;var _0x543da0=_0xefe2[_0x431e26];return _0x543da0;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2efe('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2efe('0x4')]('in','out'),'defaultValue':_0x2efe('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2efe('0x6')]},'providerName':{'type':Sequelize[_0x2efe('0x7')]},'providerResponse':{'type':Sequelize[_0x2efe('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e1953dd..c4c7bd9 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 _0xab9f=['map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','null','ContactId','contact','internal','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','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','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','name','send'];(function(_0xd60067,_0x54ed68){var _0xdb7f3e=function(_0x252dea){while(--_0x252dea){_0xd60067['push'](_0xd60067['shift']());}};_0xdb7f3e(++_0x54ed68);}(_0xab9f,0x1bd));var _0xfab9=function(_0x2ec073,_0x7f954a){_0x2ec073=_0x2ec073-0x0;var _0x257215=_0xab9f[_0x2ec073];return _0x257215;};'use strict';var emlformat=require(_0xfab9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfab9('0x1'));var jsonpatch=require(_0xfab9('0x2'));var rp=require(_0xfab9('0x3'));var moment=require('moment');var BPromise=require(_0xfab9('0x4'));var Mustache=require(_0xfab9('0x5'));var util=require('util');var path=require(_0xfab9('0x6'));var sox=require('sox');var csv=require(_0xfab9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfab9('0x8'));var _=require(_0xfab9('0x9'));var squel=require(_0xfab9('0xa'));var crypto=require(_0xfab9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfab9('0xc'));var toCsv=require(_0xfab9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfab9('0xd'));var authService=require(_0xfab9('0xe'));var qs=require(_0xfab9('0xf'));var as=require(_0xfab9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfab9('0x11'));var utils=require(_0xfab9('0x12'));var config=require(_0xfab9('0x13'));var licenseUtil=require(_0xfab9('0x14'));var db=require(_0xfab9('0x15'))['db'];config[_0xfab9('0x16')]=_[_0xfab9('0x17')](config[_0xfab9('0x16')],{'host':_0xfab9('0x18'),'port':0x18eb});var socket=require(_0xfab9('0x19'))(new Redis(config['redis']));require(_0xfab9('0x1a'))[_0xfab9('0x1b')](socket);var jayson=require(_0xfab9('0x1c'));var client=jayson[_0xfab9('0x1d')][_0xfab9('0x1e')]({'port':0x232c});var client9002=jayson[_0xfab9('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4213b4,_0x144fe2,_0x30a85a,_0x479db4){return new BPromise(function(_0x4ade7f,_0x27e011){var _0x5a830b=_0x479db4||client;return _0x5a830b[_0xfab9('0x1f')](_0x4213b4,_0x30a85a)[_0xfab9('0x20')](function(_0xca41e){logger[_0xfab9('0x21')](_0xfab9('0x22'),_0x144fe2,'request\x20sent');logger[_0xfab9('0x23')](_0xfab9('0x24'),_0x144fe2,_0xfab9('0x25'),JSON[_0xfab9('0x26')](_0xca41e));if(_0xca41e[_0xfab9('0x27')]){if(_0xca41e[_0xfab9('0x27')][_0xfab9('0x28')]===0x1f4){logger[_0xfab9('0x27')](_0xfab9('0x22'),_0x144fe2,_0xca41e[_0xfab9('0x27')][_0xfab9('0x29')]);return _0x27e011(_0xca41e['error'][_0xfab9('0x29')]);}logger[_0xfab9('0x27')](_0xfab9('0x22'),_0x144fe2,_0xca41e[_0xfab9('0x27')]['message']);return _0x4ade7f(_0xca41e[_0xfab9('0x27')][_0xfab9('0x29')]);}else{logger[_0xfab9('0x21')](_0xfab9('0x22'),_0x144fe2,_0xfab9('0x25'));_0x4ade7f(_0xca41e[_0xfab9('0x2a')][_0xfab9('0x29')]);}})[_0xfab9('0x2b')](function(_0x40e42e){logger[_0xfab9('0x27')](_0xfab9('0x22'),_0x144fe2,_0x40e42e);_0x27e011(_0x40e42e);});});}function respondWithStatusCode(_0x406b96,_0x276b9b){_0x276b9b=_0x276b9b||0xcc;return function(_0x33bb6a){if(_0x33bb6a){return _0x406b96[_0xfab9('0x2c')](_0x276b9b);}return _0x406b96[_0xfab9('0x2d')](_0x276b9b)['end']();};}function respondWithResult(_0x1bb377,_0x40a821){_0x40a821=_0x40a821||0xc8;return function(_0x162020){if(_0x162020){return _0x1bb377[_0xfab9('0x2d')](_0x40a821)['json'](_0x162020);}};}function respondWithFilteredResult(_0x20fe4f,_0x2a6e95){return function(_0x43f44d){if(_0x43f44d){var _0x803cfe=typeof _0x2a6e95[_0xfab9('0x2e')]===_0xfab9('0x2f')&&typeof _0x2a6e95[_0xfab9('0x30')]===_0xfab9('0x2f');var _0x1c9cb5=_0x43f44d[_0xfab9('0x31')];var _0x25aa01=_0x803cfe?0x0:_0x2a6e95[_0xfab9('0x2e')];var _0x3cc50d=_0x803cfe?_0x43f44d[_0xfab9('0x31')]:_0x2a6e95[_0xfab9('0x2e')]+_0x2a6e95[_0xfab9('0x30')];var _0x10cca4;if(_0x3cc50d>=_0x1c9cb5){_0x3cc50d=_0x1c9cb5;_0x10cca4=0xc8;}else{_0x10cca4=0xce;}_0x20fe4f[_0xfab9('0x2d')](_0x10cca4);return _0x20fe4f[_0xfab9('0x32')](_0xfab9('0x33'),_0x25aa01+'-'+_0x3cc50d+'/'+_0x1c9cb5)[_0xfab9('0x34')](_0x43f44d);}return null;};}function patchUpdates(_0x3c7761){return function(_0x1b4c47){try{jsonpatch['apply'](_0x1b4c47,_0x3c7761,!![]);}catch(_0x45a1d2){return BPromise[_0xfab9('0x35')](_0x45a1d2);}return _0x1b4c47[_0xfab9('0x36')]();};}function saveUpdates(_0x1ee945,_0x130ffc){return function(_0x42068a){if(_0x42068a){return _0x42068a[_0xfab9('0x37')](_0x1ee945)[_0xfab9('0x20')](function(_0x2d172a){return _0x2d172a;});}return null;};}function removeEntity(_0x268349,_0x44dd46){return function(_0x3ad7ff){if(_0x3ad7ff){return _0x3ad7ff[_0xfab9('0x38')]()[_0xfab9('0x20')](function(){_0x268349[_0xfab9('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b142,_0x5a7453){return function(_0x4de7c9){if(!_0x4de7c9){_0x25b142['sendStatus'](0x194);}return _0x4de7c9;};}function handleError(_0xfe4003,_0x12ceff){_0x12ceff=_0x12ceff||0x1f4;return function(_0x2b0b77){logger['error'](_0x2b0b77['stack']);if(_0x2b0b77[_0xfab9('0x39')]){delete _0x2b0b77[_0xfab9('0x39')];}_0xfe4003[_0xfab9('0x2d')](_0x12ceff)[_0xfab9('0x3a')](_0x2b0b77);};}exports['index']=function(_0x21bde8,_0x32b1c4){var _0x29c1fa={},_0x2dcc81={},_0x5360ec={'count':0x0,'rows':[]};var _0x37b11a=_[_0xfab9('0x3b')](db[_0xfab9('0x3c')][_0xfab9('0x3d')],function(_0x18eaf8){return{'name':_0x18eaf8[_0xfab9('0x3e')],'type':_0x18eaf8[_0xfab9('0x3f')][_0xfab9('0x40')]};});_0x2dcc81[_0xfab9('0x41')]=_[_0xfab9('0x3b')](_0x37b11a,_0xfab9('0x39'));_0x2dcc81[_0xfab9('0x42')]=_[_0xfab9('0x43')](_0x21bde8[_0xfab9('0x42')]);_0x2dcc81[_0xfab9('0x44')]=_[_0xfab9('0x45')](_0x2dcc81['model'],_0x2dcc81[_0xfab9('0x42')]);_0x29c1fa[_0xfab9('0x46')]=_[_0xfab9('0x45')](_0x2dcc81['model'],qs[_0xfab9('0x47')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x47')]));_0x29c1fa[_0xfab9('0x46')]=_0x29c1fa[_0xfab9('0x46')][_0xfab9('0x48')]?_0x29c1fa['attributes']:_0x2dcc81[_0xfab9('0x41')];if(!_0x21bde8[_0xfab9('0x42')][_0xfab9('0x49')]('nolimit')){_0x29c1fa[_0xfab9('0x30')]=qs[_0xfab9('0x30')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x30')]);_0x29c1fa[_0xfab9('0x2e')]=qs[_0xfab9('0x2e')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x2e')]);}_0x29c1fa[_0xfab9('0x4a')]=qs[_0xfab9('0x4b')](_0x21bde8[_0xfab9('0x42')][_0xfab9('0x4b')]);_0x29c1fa[_0xfab9('0x4c')]=qs[_0xfab9('0x44')](_[_0xfab9('0x4d')](_0x21bde8[_0xfab9('0x42')],_0x2dcc81[_0xfab9('0x44')]),_0x37b11a);if(_0x21bde8['query'][_0xfab9('0x4e')]){_0x29c1fa[_0xfab9('0x4c')]=_[_0xfab9('0x4f')](_0x29c1fa[_0xfab9('0x4c')],{'$or':_[_0xfab9('0x3b')](_0x37b11a,function(_0x469976){if(_0x469976[_0xfab9('0x3f')]!==_0xfab9('0x50')){var _0x324921={};_0x324921[_0x469976[_0xfab9('0x39')]]={'$like':'%'+_0x21bde8[_0xfab9('0x42')][_0xfab9('0x4e')]+'%'};return _0x324921;}})});}_0x29c1fa=_[_0xfab9('0x4f')]({},_0x29c1fa,_0x21bde8[_0xfab9('0x51')]);var _0x4eba38={'where':_0x29c1fa['where']};return db['OpenchannelMessage'][_0xfab9('0x31')](_0x4eba38)[_0xfab9('0x20')](function(_0x10c7f8){_0x5360ec['count']=_0x10c7f8;if(_0x21bde8[_0xfab9('0x42')][_0xfab9('0x52')]){_0x29c1fa[_0xfab9('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfab9('0x54')](_0x29c1fa);})[_0xfab9('0x20')](function(_0x4c25c3){_0x5360ec[_0xfab9('0x55')]=_0x4c25c3;return _0x5360ec;})[_0xfab9('0x20')](respondWithFilteredResult(_0x32b1c4,_0x29c1fa))[_0xfab9('0x2b')](handleError(_0x32b1c4,null));};exports['show']=function(_0x1eaa8f,_0x148119){var _0x3e848a={'raw':!![],'where':{'id':_0x1eaa8f[_0xfab9('0x56')]['id']}},_0x6dfd04={};_0x6dfd04[_0xfab9('0x41')]=_['keys'](db[_0xfab9('0x3c')][_0xfab9('0x3d')]);_0x6dfd04['query']=_['keys'](_0x1eaa8f[_0xfab9('0x42')]);_0x6dfd04[_0xfab9('0x44')]=_['intersection'](_0x6dfd04[_0xfab9('0x41')],_0x6dfd04['query']);_0x3e848a[_0xfab9('0x46')]=_[_0xfab9('0x45')](_0x6dfd04[_0xfab9('0x41')],qs[_0xfab9('0x47')](_0x1eaa8f[_0xfab9('0x42')][_0xfab9('0x47')]));_0x3e848a[_0xfab9('0x46')]=_0x3e848a['attributes'][_0xfab9('0x48')]?_0x3e848a[_0xfab9('0x46')]:_0x6dfd04['model'];if(_0x1eaa8f[_0xfab9('0x42')]['includeAll']){_0x3e848a[_0xfab9('0x53')]=[{'all':!![]}];}_0x3e848a=_[_0xfab9('0x4f')]({},_0x3e848a,_0x1eaa8f[_0xfab9('0x51')]);return db[_0xfab9('0x3c')][_0xfab9('0x57')](_0x3e848a)['then'](handleEntityNotFound(_0x148119,null))['then'](respondWithResult(_0x148119,null))[_0xfab9('0x2b')](handleError(_0x148119,null));};exports[_0xfab9('0x58')]=function(_0x122c23,_0x215df1){return db[_0xfab9('0x3c')][_0xfab9('0x58')](_0x122c23[_0xfab9('0x59')],{})[_0xfab9('0x20')](respondWithResult(_0x215df1,0xc9))[_0xfab9('0x2b')](handleError(_0x215df1,null));};exports[_0xfab9('0x37')]=function(_0x3b1f15,_0x1a6fc4){if(_0x3b1f15['body']['id']){delete _0x3b1f15[_0xfab9('0x59')]['id'];}return db[_0xfab9('0x3c')][_0xfab9('0x57')]({'where':{'id':_0x3b1f15[_0xfab9('0x56')]['id']}})[_0xfab9('0x20')](handleEntityNotFound(_0x1a6fc4,null))[_0xfab9('0x20')](saveUpdates(_0x3b1f15[_0xfab9('0x59')],null))[_0xfab9('0x20')](respondWithResult(_0x1a6fc4,null))[_0xfab9('0x2b')](handleError(_0x1a6fc4,null));};exports[_0xfab9('0x38')]=function(_0x3bc202,_0xfc22cc){return db['OpenchannelMessage']['find']({'where':{'id':_0x3bc202['params']['id']}})[_0xfab9('0x20')](handleEntityNotFound(_0xfc22cc,null))[_0xfab9('0x20')](removeEntity(_0xfc22cc,null))[_0xfab9('0x2b')](handleError(_0xfc22cc,null));};exports[_0xfab9('0x5a')]=function(_0x942a14,_0x6a1c2c){return db[_0xfab9('0x3c')][_0xfab9('0x5a')]()[_0xfab9('0x20')](respondWithResult(_0x6a1c2c,null))[_0xfab9('0x2b')](handleError(_0x6a1c2c,null));};var interaction_log=require(_0xfab9('0x5b'))('openchannel-interactions');exports[_0xfab9('0x5c')]=function(_0x14b8dc,_0x5011a0,_0x376fbf){var _0x17114b={'agent':{},'channel':_0xfab9('0x5d')};if(_0x14b8dc['body']['id']){delete _0x14b8dc[_0xfab9('0x59')]['id'];}_0x14b8dc['body'][_0xfab9('0x5e')]=!![];_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x5f')]=moment()[_0xfab9('0x60')](_0xfab9('0x61'));_0x14b8dc['body'][_0xfab9('0x62')]=_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x62')]||_0x14b8dc[_0xfab9('0x63')]['id'];_0x17114b[_0xfab9('0x64')]['id']=_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x62')];return db[_0xfab9('0x3c')]['find']({'where':{'id':_0x14b8dc['params']['id'],'UserId':null}})[_0xfab9('0x20')](handleEntityNotFound(_0x5011a0,null))[_0xfab9('0x20')](saveUpdates(_0x14b8dc[_0xfab9('0x59')],null))[_0xfab9('0x20')](function(_0x465238){if(_0x465238){_0x17114b['message']=_0x465238['get']({'plain':!![]});return db[_0xfab9('0x65')]['find']({'where':{'id':_0x465238['OpenchannelInteractionId']}});}return null;})[_0xfab9('0x20')](handleEntityNotFound(_0x5011a0,null))[_0xfab9('0x20')](function(_0x334d0b){if(_0x334d0b){return _0x334d0b[_0xfab9('0x37')]({'UserId':_0x14b8dc[_0xfab9('0x59')][_0xfab9('0x62')],'read1stAt':_['isNil'](_0x334d0b['read1stAt'])?moment()[_0xfab9('0x60')](_0xfab9('0x61')):undefined});}return null;})['then'](function(_0x266b63){if(_0x266b63){_0x17114b[_0xfab9('0x66')]=_0x266b63[_0xfab9('0x67')]({'plain':!![]});interaction_log[_0xfab9('0x21')](_0xfab9('0x68'),_0x14b8dc[_0xfab9('0x63')]['id'],_0x14b8dc[_0xfab9('0x63')]['name'],_0x14b8dc[_0xfab9('0x63')][_0xfab9('0x69')],_0x17114b['interaction']['id'],_0x14b8dc[_0xfab9('0x59')]?JSON[_0xfab9('0x26')](_0x14b8dc['body']):'null');return respondWithRpcPromise(_0xfab9('0x6a'),_0xfab9('0x6b'),_0x17114b);}return null;})[_0xfab9('0x20')](function(_0x578892){var _0x25c083=_0xfab9('0x6c')+_0x578892[_0xfab9('0x29')]['ContactId'];return db[_0xfab9('0x6d')][_0xfab9('0x42')](_0x25c083,{'type':db[_0xfab9('0x6e')][_0xfab9('0x6f')][_0xfab9('0x70')],'raw':!![]})['then'](function(_0x202136){return _0x202136;});})[_0xfab9('0x20')](function(_0x1dad5f){if(_0x1dad5f){_0x17114b[_0xfab9('0x29')]['contact']=_0x1dad5f[0x0];if(!_0x14b8dc[_0xfab9('0x59')]['UserId'])return;return db[_0xfab9('0x71')]['find']({'where':{'id':_0x14b8dc[_0xfab9('0x59')]['UserId'],'role':_0xfab9('0x64')},'attributes':['id',_0xfab9('0x39'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x3e466c){if(!_0x3e466c)return null;_0x17114b['message'][_0xfab9('0x64')]=_0x3e466c;return _0x17114b;})[_0xfab9('0x20')](function(_0x581da4){if(_0x581da4){if(_0x14b8dc[_0xfab9('0x59')]['manual']){_0x17114b[_0xfab9('0x29')]['interface']=util[_0xfab9('0x60')]('SIP/%s',_0x14b8dc[_0xfab9('0x63')][_0xfab9('0x39')]);_0x17114b[_0xfab9('0x29')][_0xfab9('0x72')]=_0x17114b[_0xfab9('0x72')];_0x17114b[_0xfab9('0x29')][_0xfab9('0x73')]=_0x17114b[_0xfab9('0x72')];_0x17114b[_0xfab9('0x29')]['event']='accept';return respondWithRpcPromise(_0xfab9('0x74'),'EventManager',{'event':_0xfab9('0x75'),'message':_0x17114b['message']},client9002)[_0xfab9('0x20')](function(){return _0x17114b;});}return _0x17114b;}return null;})[_0xfab9('0x20')](respondWithResult(_0x5011a0,null))[_0xfab9('0x2b')](handleError(_0x5011a0,null));};var interaction_log=require(_0xfab9('0x5b'))(_0xfab9('0x76'));exports[_0xfab9('0x35')]=function(_0x14de5e,_0x1f356c,_0x4f8f95){var _0x57ee69={'agent':{},'channel':'openchannel'};if(_0x14de5e[_0xfab9('0x59')]['id']){delete _0x14de5e['body']['id'];}_0x14de5e[_0xfab9('0x59')]['UserId']=_0x14de5e['body'][_0xfab9('0x62')]||_0x14de5e[_0xfab9('0x63')]['id'];_0x57ee69[_0xfab9('0x64')]['id']=_0x14de5e[_0xfab9('0x59')]['UserId'];return db[_0xfab9('0x3c')][_0xfab9('0x57')]({'where':{'id':_0x14de5e['params']['id'],'UserId':null}})[_0xfab9('0x20')](handleEntityNotFound(_0x1f356c,null))[_0xfab9('0x20')](function(_0x8ac990){if(_0x8ac990){_0x57ee69['message']=_0x8ac990[_0xfab9('0x67')]({'plain':!![]});return db[_0xfab9('0x65')][_0xfab9('0x57')]({'where':{'id':_0x8ac990[_0xfab9('0x77')]}});}return null;})[_0xfab9('0x20')](handleEntityNotFound(_0x1f356c,null))[_0xfab9('0x20')](function(_0xe18799){if(_0xe18799){_0x57ee69[_0xfab9('0x66')]=_0xe18799[_0xfab9('0x67')]({'plain':!![]});interaction_log[_0xfab9('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14de5e[_0xfab9('0x63')]['id'],_0x14de5e[_0xfab9('0x63')][_0xfab9('0x39')],_0x14de5e[_0xfab9('0x63')]['role'],_0x57ee69[_0xfab9('0x66')]['id'],_0x14de5e[_0xfab9('0x59')]?JSON[_0xfab9('0x26')](_0x14de5e[_0xfab9('0x59')]):_0xfab9('0x78'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x57ee69);}return null;})[_0xfab9('0x20')](function(_0xab7314){var _0x482521='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xab7314['message'][_0xfab9('0x79')];return db[_0xfab9('0x6d')][_0xfab9('0x42')](_0x482521,{'type':db[_0xfab9('0x6e')]['QueryTypes'][_0xfab9('0x70')],'raw':!![]})[_0xfab9('0x20')](function(_0x24b2f5){return _0x24b2f5;});})[_0xfab9('0x20')](function(_0x4fc611){if(_0x4fc611){_0x57ee69[_0xfab9('0x29')][_0xfab9('0x7a')]=_0x4fc611[0x0];if(!_0x14de5e[_0xfab9('0x59')]['UserId'])return;return db[_0xfab9('0x71')][_0xfab9('0x57')]({'where':{'id':_0x14de5e[_0xfab9('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xfab9('0x39'),'fullname','email',_0xfab9('0x7b')],'raw':!![]});}return null;})[_0xfab9('0x20')](function(_0x23cf44){if(!_0x23cf44)return null;_0x57ee69[_0xfab9('0x29')]['agent']=_0x23cf44;return _0x57ee69;})[_0xfab9('0x20')](function(_0x34017b){if(_0x34017b){_0x34017b[_0xfab9('0x29')]['interface']=util[_0xfab9('0x60')](_0xfab9('0x7c'),_0x14de5e[_0xfab9('0x63')][_0xfab9('0x39')]);_0x34017b[_0xfab9('0x29')][_0xfab9('0x72')]=_0x57ee69[_0xfab9('0x72')];_0x34017b[_0xfab9('0x29')]['motionChannel']=_0x57ee69['channel'];_0x34017b[_0xfab9('0x29')]['event']=_0xfab9('0x35');respondWithRpcPromise(_0xfab9('0x74'),_0xfab9('0x74'),{'event':_0xfab9('0x7d'),'message':_0x34017b[_0xfab9('0x29')]},client9002);return _0x57ee69;}return null;})['then'](respondWithResult(_0x1f356c,null))[_0xfab9('0x2b')](handleError(_0x1f356c,null));}; \ No newline at end of file +var _0x27fa=['model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','show','params','length','includeAll','find','create','update','body','destroy','describe','openchannel-interactions','accept','openchannel','read','format','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','role','null','rejectMessage','sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','key','query','keys','attributes','intersection'];(function(_0x137d5a,_0x2f4c51){var _0x1287a7=function(_0x4dda16){while(--_0x4dda16){_0x137d5a['push'](_0x137d5a['shift']());}};_0x1287a7(++_0x2f4c51);}(_0x27fa,0x1c3));var _0xa27f=function(_0x1e979b,_0x258668){_0x1e979b=_0x1e979b-0x0;var _0x5d4ad6=_0x27fa[_0x1e979b];return _0x5d4ad6;};'use strict';var emlformat=require(_0xa27f('0x0'));var rimraf=require(_0xa27f('0x1'));var zipdir=require(_0xa27f('0x2'));var jsonpatch=require(_0xa27f('0x3'));var rp=require(_0xa27f('0x4'));var moment=require(_0xa27f('0x5'));var BPromise=require(_0xa27f('0x6'));var Mustache=require('mustache');var util=require(_0xa27f('0x7'));var path=require(_0xa27f('0x8'));var sox=require(_0xa27f('0x9'));var csv=require(_0xa27f('0xa'));var ejs=require(_0xa27f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa27f('0xc'));var squel=require(_0xa27f('0xd'));var crypto=require(_0xa27f('0xe'));var jsforce=require(_0xa27f('0xf'));var deskjs=require(_0xa27f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa27f('0x11'));var Papa=require(_0xa27f('0x12'));var Redis=require(_0xa27f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa27f('0x14'));var as=require(_0xa27f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa27f('0x16'))('api');var utils=require(_0xa27f('0x17'));var config=require(_0xa27f('0x18'));var licenseUtil=require(_0xa27f('0x19'));var db=require('../../mysqldb')['db'];config[_0xa27f('0x1a')]=_[_0xa27f('0x1b')](config[_0xa27f('0x1a')],{'host':_0xa27f('0x1c'),'port':0x18eb});var socket=require(_0xa27f('0x1d'))(new Redis(config[_0xa27f('0x1a')]));require('./openchannelMessage.socket')[_0xa27f('0x1e')](socket);var jayson=require(_0xa27f('0x1f'));var client=jayson[_0xa27f('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xa27f('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56df4c,_0x201310,_0x4603eb,_0x543e6e){return new BPromise(function(_0x4bdc77,_0x1d096b){var _0x35e129=_0x543e6e||client;return _0x35e129[_0xa27f('0x21')](_0x56df4c,_0x4603eb)['then'](function(_0x9d1751){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x201310,'request\x20sent');logger['debug'](_0xa27f('0x22'),_0x201310,_0xa27f('0x23'),JSON[_0xa27f('0x24')](_0x9d1751));if(_0x9d1751[_0xa27f('0x25')]){if(_0x9d1751[_0xa27f('0x25')][_0xa27f('0x26')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x201310,_0x9d1751[_0xa27f('0x25')][_0xa27f('0x27')]);return _0x1d096b(_0x9d1751[_0xa27f('0x25')][_0xa27f('0x27')]);}logger[_0xa27f('0x25')](_0xa27f('0x28'),_0x201310,_0x9d1751[_0xa27f('0x25')][_0xa27f('0x27')]);return _0x4bdc77(_0x9d1751[_0xa27f('0x25')][_0xa27f('0x27')]);}else{logger[_0xa27f('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x201310,_0xa27f('0x23'));_0x4bdc77(_0x9d1751[_0xa27f('0x2a')][_0xa27f('0x27')]);}})[_0xa27f('0x2b')](function(_0x24537c){logger['error'](_0xa27f('0x28'),_0x201310,_0x24537c);_0x1d096b(_0x24537c);});});}function respondWithStatusCode(_0x484c1d,_0x45f4d8){_0x45f4d8=_0x45f4d8||0xcc;return function(_0x8e8ae8){if(_0x8e8ae8){return _0x484c1d[_0xa27f('0x2c')](_0x45f4d8);}return _0x484c1d[_0xa27f('0x2d')](_0x45f4d8)['end']();};}function respondWithResult(_0x556acd,_0x21536a){_0x21536a=_0x21536a||0xc8;return function(_0x124828){if(_0x124828){return _0x556acd[_0xa27f('0x2d')](_0x21536a)[_0xa27f('0x2e')](_0x124828);}};}function respondWithFilteredResult(_0x4e4464,_0x41d28a){return function(_0x4e513e){if(_0x4e513e){var _0x532360=typeof _0x41d28a['offset']===_0xa27f('0x2f')&&typeof _0x41d28a[_0xa27f('0x30')]==='undefined';var _0x4d4f0d=_0x4e513e[_0xa27f('0x31')];var _0x3be2b4=_0x532360?0x0:_0x41d28a['offset'];var _0x57507f=_0x532360?_0x4e513e[_0xa27f('0x31')]:_0x41d28a[_0xa27f('0x32')]+_0x41d28a[_0xa27f('0x30')];var _0x5d3f86;if(_0x57507f>=_0x4d4f0d){_0x57507f=_0x4d4f0d;_0x5d3f86=0xc8;}else{_0x5d3f86=0xce;}_0x4e4464[_0xa27f('0x2d')](_0x5d3f86);return _0x4e4464[_0xa27f('0x33')](_0xa27f('0x34'),_0x3be2b4+'-'+_0x57507f+'/'+_0x4d4f0d)[_0xa27f('0x2e')](_0x4e513e);}return null;};}function patchUpdates(_0x6028fc){return function(_0x15682b){try{jsonpatch['apply'](_0x15682b,_0x6028fc,!![]);}catch(_0x1f22d5){return BPromise[_0xa27f('0x35')](_0x1f22d5);}return _0x15682b[_0xa27f('0x36')]();};}function saveUpdates(_0x16a6b5,_0xa07513){return function(_0x105bf6){if(_0x105bf6){return _0x105bf6['update'](_0x16a6b5)['then'](function(_0x101fa4){return _0x101fa4;});}return null;};}function removeEntity(_0xbb415,_0x2fc287){return function(_0x2525cc){if(_0x2525cc){return _0x2525cc['destroy']()[_0xa27f('0x37')](function(){_0xbb415[_0xa27f('0x2d')](0xcc)[_0xa27f('0x38')]();});}};}function handleEntityNotFound(_0x48e1cf,_0x50434c){return function(_0x5ec435){if(!_0x5ec435){_0x48e1cf['sendStatus'](0x194);}return _0x5ec435;};}function handleError(_0x15289b,_0x5b5054){_0x5b5054=_0x5b5054||0x1f4;return function(_0x1ee0fc){logger['error'](_0x1ee0fc[_0xa27f('0x39')]);if(_0x1ee0fc[_0xa27f('0x3a')]){delete _0x1ee0fc[_0xa27f('0x3a')];}_0x15289b[_0xa27f('0x2d')](_0x5b5054)[_0xa27f('0x3b')](_0x1ee0fc);};}exports[_0xa27f('0x3c')]=function(_0x176aec,_0x16e8cb){var _0x4ce2c7={},_0x313eeb={},_0xf2794b={'count':0x0,'rows':[]};var _0x3099e6=_[_0xa27f('0x3d')](db[_0xa27f('0x3e')][_0xa27f('0x3f')],function(_0x27a152){return{'name':_0x27a152['fieldName'],'type':_0x27a152['type'][_0xa27f('0x40')]};});_0x313eeb['model']=_[_0xa27f('0x3d')](_0x3099e6,_0xa27f('0x3a'));_0x313eeb[_0xa27f('0x41')]=_[_0xa27f('0x42')](_0x176aec[_0xa27f('0x41')]);_0x313eeb['filters']=_['intersection'](_0x313eeb['model'],_0x313eeb[_0xa27f('0x41')]);_0x4ce2c7[_0xa27f('0x43')]=_[_0xa27f('0x44')](_0x313eeb[_0xa27f('0x45')],qs[_0xa27f('0x46')](_0x176aec[_0xa27f('0x41')][_0xa27f('0x46')]));_0x4ce2c7[_0xa27f('0x43')]=_0x4ce2c7['attributes']['length']?_0x4ce2c7[_0xa27f('0x43')]:_0x313eeb[_0xa27f('0x45')];if(!_0x176aec['query'][_0xa27f('0x47')](_0xa27f('0x48'))){_0x4ce2c7[_0xa27f('0x30')]=qs['limit'](_0x176aec[_0xa27f('0x41')][_0xa27f('0x30')]);_0x4ce2c7['offset']=qs[_0xa27f('0x32')](_0x176aec[_0xa27f('0x41')][_0xa27f('0x32')]);}_0x4ce2c7[_0xa27f('0x49')]=qs['sort'](_0x176aec[_0xa27f('0x41')][_0xa27f('0x4a')]);_0x4ce2c7[_0xa27f('0x4b')]=qs['filters'](_['pick'](_0x176aec[_0xa27f('0x41')],_0x313eeb[_0xa27f('0x4c')]),_0x3099e6);if(_0x176aec[_0xa27f('0x41')][_0xa27f('0x4d')]){_0x4ce2c7[_0xa27f('0x4b')]=_['merge'](_0x4ce2c7[_0xa27f('0x4b')],{'$or':_[_0xa27f('0x3d')](_0x3099e6,function(_0x3b5617){if(_0x3b5617['type']!=='VIRTUAL'){var _0x300773={};_0x300773[_0x3b5617[_0xa27f('0x3a')]]={'$like':'%'+_0x176aec['query'][_0xa27f('0x4d')]+'%'};return _0x300773;}})});}_0x4ce2c7=_[_0xa27f('0x4e')]({},_0x4ce2c7,_0x176aec[_0xa27f('0x4f')]);var _0x3394bb={'where':_0x4ce2c7[_0xa27f('0x4b')]};return db[_0xa27f('0x3e')][_0xa27f('0x31')](_0x3394bb)[_0xa27f('0x37')](function(_0x34a676){_0xf2794b[_0xa27f('0x31')]=_0x34a676;if(_0x176aec[_0xa27f('0x41')]['includeAll']){_0x4ce2c7[_0xa27f('0x50')]=[{'all':!![]}];}return db[_0xa27f('0x3e')]['findAll'](_0x4ce2c7);})[_0xa27f('0x37')](function(_0x3f9b2b){_0xf2794b['rows']=_0x3f9b2b;return _0xf2794b;})[_0xa27f('0x37')](respondWithFilteredResult(_0x16e8cb,_0x4ce2c7))[_0xa27f('0x2b')](handleError(_0x16e8cb,null));};exports[_0xa27f('0x51')]=function(_0x5ac2de,_0x341d92){var _0x4ea6cf={'raw':!![],'where':{'id':_0x5ac2de[_0xa27f('0x52')]['id']}},_0x5a9274={};_0x5a9274['model']=_[_0xa27f('0x42')](db[_0xa27f('0x3e')][_0xa27f('0x3f')]);_0x5a9274[_0xa27f('0x41')]=_[_0xa27f('0x42')](_0x5ac2de[_0xa27f('0x41')]);_0x5a9274[_0xa27f('0x4c')]=_[_0xa27f('0x44')](_0x5a9274[_0xa27f('0x45')],_0x5a9274[_0xa27f('0x41')]);_0x4ea6cf[_0xa27f('0x43')]=_['intersection'](_0x5a9274[_0xa27f('0x45')],qs[_0xa27f('0x46')](_0x5ac2de[_0xa27f('0x41')][_0xa27f('0x46')]));_0x4ea6cf[_0xa27f('0x43')]=_0x4ea6cf[_0xa27f('0x43')][_0xa27f('0x53')]?_0x4ea6cf[_0xa27f('0x43')]:_0x5a9274[_0xa27f('0x45')];if(_0x5ac2de[_0xa27f('0x41')][_0xa27f('0x54')]){_0x4ea6cf[_0xa27f('0x50')]=[{'all':!![]}];}_0x4ea6cf=_[_0xa27f('0x4e')]({},_0x4ea6cf,_0x5ac2de[_0xa27f('0x4f')]);return db[_0xa27f('0x3e')][_0xa27f('0x55')](_0x4ea6cf)['then'](handleEntityNotFound(_0x341d92,null))['then'](respondWithResult(_0x341d92,null))[_0xa27f('0x2b')](handleError(_0x341d92,null));};exports[_0xa27f('0x56')]=function(_0x4e1e45,_0x3c4ee3){return db['OpenchannelMessage'][_0xa27f('0x56')](_0x4e1e45['body'],{})['then'](respondWithResult(_0x3c4ee3,0xc9))[_0xa27f('0x2b')](handleError(_0x3c4ee3,null));};exports[_0xa27f('0x57')]=function(_0x18596a,_0x23fb7e){if(_0x18596a[_0xa27f('0x58')]['id']){delete _0x18596a['body']['id'];}return db[_0xa27f('0x3e')]['find']({'where':{'id':_0x18596a[_0xa27f('0x52')]['id']}})[_0xa27f('0x37')](handleEntityNotFound(_0x23fb7e,null))[_0xa27f('0x37')](saveUpdates(_0x18596a[_0xa27f('0x58')],null))[_0xa27f('0x37')](respondWithResult(_0x23fb7e,null))[_0xa27f('0x2b')](handleError(_0x23fb7e,null));};exports[_0xa27f('0x59')]=function(_0x5a4512,_0x319b80){return db[_0xa27f('0x3e')][_0xa27f('0x55')]({'where':{'id':_0x5a4512[_0xa27f('0x52')]['id']}})[_0xa27f('0x37')](handleEntityNotFound(_0x319b80,null))[_0xa27f('0x37')](removeEntity(_0x319b80,null))[_0xa27f('0x2b')](handleError(_0x319b80,null));};exports[_0xa27f('0x5a')]=function(_0x41bebe,_0x554b59){return db[_0xa27f('0x3e')][_0xa27f('0x5a')]()['then'](respondWithResult(_0x554b59,null))['catch'](handleError(_0x554b59,null));};var interaction_log=require(_0xa27f('0x16'))(_0xa27f('0x5b'));exports[_0xa27f('0x5c')]=function(_0x178e23,_0x171187,_0x512153){var _0x196d67={'agent':{},'channel':_0xa27f('0x5d')};if(_0x178e23['body']['id']){delete _0x178e23[_0xa27f('0x58')]['id'];}_0x178e23[_0xa27f('0x58')][_0xa27f('0x5e')]=!![];_0x178e23['body']['readAt']=moment()[_0xa27f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x178e23[_0xa27f('0x58')][_0xa27f('0x60')]=_0x178e23[_0xa27f('0x58')][_0xa27f('0x60')]||_0x178e23['user']['id'];_0x196d67[_0xa27f('0x61')]['id']=_0x178e23[_0xa27f('0x58')]['UserId'];return db[_0xa27f('0x3e')]['find']({'where':{'id':_0x178e23[_0xa27f('0x52')]['id'],'UserId':null}})[_0xa27f('0x37')](handleEntityNotFound(_0x171187,null))[_0xa27f('0x37')](saveUpdates(_0x178e23['body'],null))[_0xa27f('0x37')](function(_0x31a165){if(_0x31a165){_0x196d67[_0xa27f('0x27')]=_0x31a165[_0xa27f('0x62')]({'plain':!![]});return db[_0xa27f('0x63')][_0xa27f('0x55')]({'where':{'id':_0x31a165['OpenchannelInteractionId']}});}return null;})[_0xa27f('0x37')](handleEntityNotFound(_0x171187,null))['then'](function(_0x5bd33b){if(_0x5bd33b){return _0x5bd33b[_0xa27f('0x57')]({'UserId':_0x178e23[_0xa27f('0x58')][_0xa27f('0x60')],'read1stAt':_[_0xa27f('0x64')](_0x5bd33b[_0xa27f('0x65')])?moment()['format'](_0xa27f('0x66')):undefined});}return null;})[_0xa27f('0x37')](function(_0x48eef2){if(_0x48eef2){_0x196d67['interaction']=_0x48eef2[_0xa27f('0x62')]({'plain':!![]});interaction_log['info'](_0xa27f('0x67'),_0x178e23[_0xa27f('0x68')]['id'],_0x178e23[_0xa27f('0x68')][_0xa27f('0x3a')],_0x178e23[_0xa27f('0x68')]['role'],_0x196d67[_0xa27f('0x69')]['id'],_0x178e23[_0xa27f('0x58')]?JSON[_0xa27f('0x24')](_0x178e23[_0xa27f('0x58')]):'null');return respondWithRpcPromise(_0xa27f('0x6a'),'acceptMessage',_0x196d67);}return null;})[_0xa27f('0x37')](function(_0x4db2c7){var _0x204e2c=_0xa27f('0x6b')+_0x4db2c7[_0xa27f('0x27')][_0xa27f('0x6c')];return db['sequelize'][_0xa27f('0x41')](_0x204e2c,{'type':db[_0xa27f('0x6d')]['QueryTypes'][_0xa27f('0x6e')],'raw':!![]})[_0xa27f('0x37')](function(_0x4f3539){return _0x4f3539;});})['then'](function(_0x557221){if(_0x557221){_0x196d67[_0xa27f('0x27')][_0xa27f('0x6f')]=_0x557221[0x0];if(!_0x178e23['body'][_0xa27f('0x60')])return;return db[_0xa27f('0x70')][_0xa27f('0x55')]({'where':{'id':_0x178e23[_0xa27f('0x58')][_0xa27f('0x60')],'role':_0xa27f('0x61')},'attributes':['id','name',_0xa27f('0x71'),_0xa27f('0x72'),_0xa27f('0x73')],'raw':!![]});}return null;})[_0xa27f('0x37')](function(_0x28c4bc){if(!_0x28c4bc)return null;_0x196d67[_0xa27f('0x27')][_0xa27f('0x61')]=_0x28c4bc;return _0x196d67;})[_0xa27f('0x37')](function(_0x2a974f){if(_0x2a974f){if(_0x178e23[_0xa27f('0x58')][_0xa27f('0x74')]){_0x196d67[_0xa27f('0x27')][_0xa27f('0x75')]=util[_0xa27f('0x5f')](_0xa27f('0x76'),_0x178e23[_0xa27f('0x68')][_0xa27f('0x3a')]);_0x196d67[_0xa27f('0x27')][_0xa27f('0x77')]=_0x196d67[_0xa27f('0x77')];_0x196d67[_0xa27f('0x27')][_0xa27f('0x78')]=_0x196d67[_0xa27f('0x77')];_0x196d67[_0xa27f('0x27')][_0xa27f('0x79')]=_0xa27f('0x5c');return respondWithRpcPromise('EventManager',_0xa27f('0x7a'),{'event':_0xa27f('0x7b'),'message':_0x196d67['message']},client9002)[_0xa27f('0x37')](function(){return _0x196d67;});}return _0x196d67;}return null;})['then'](respondWithResult(_0x171187,null))[_0xa27f('0x2b')](handleError(_0x171187,null));};var interaction_log=require(_0xa27f('0x16'))(_0xa27f('0x5b'));exports[_0xa27f('0x35')]=function(_0x2daafb,_0x49a84e,_0x52bbe5){var _0x1c12f4={'agent':{},'channel':_0xa27f('0x5d')};if(_0x2daafb['body']['id']){delete _0x2daafb['body']['id'];}_0x2daafb['body'][_0xa27f('0x60')]=_0x2daafb[_0xa27f('0x58')][_0xa27f('0x60')]||_0x2daafb[_0xa27f('0x68')]['id'];_0x1c12f4[_0xa27f('0x61')]['id']=_0x2daafb[_0xa27f('0x58')][_0xa27f('0x60')];return db['OpenchannelMessage'][_0xa27f('0x55')]({'where':{'id':_0x2daafb[_0xa27f('0x52')]['id'],'UserId':null}})[_0xa27f('0x37')](handleEntityNotFound(_0x49a84e,null))[_0xa27f('0x37')](function(_0x41fb0d){if(_0x41fb0d){_0x1c12f4[_0xa27f('0x27')]=_0x41fb0d[_0xa27f('0x62')]({'plain':!![]});return db[_0xa27f('0x63')][_0xa27f('0x55')]({'where':{'id':_0x41fb0d[_0xa27f('0x7c')]}});}return null;})[_0xa27f('0x37')](handleEntityNotFound(_0x49a84e,null))['then'](function(_0x537787){if(_0x537787){_0x1c12f4[_0xa27f('0x69')]=_0x537787[_0xa27f('0x62')]({'plain':!![]});interaction_log[_0xa27f('0x29')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2daafb[_0xa27f('0x68')]['id'],_0x2daafb[_0xa27f('0x68')]['name'],_0x2daafb[_0xa27f('0x68')][_0xa27f('0x7d')],_0x1c12f4['interaction']['id'],_0x2daafb[_0xa27f('0x58')]?JSON[_0xa27f('0x24')](_0x2daafb[_0xa27f('0x58')]):_0xa27f('0x7e'));return respondWithRpcPromise('RejectMessage',_0xa27f('0x7f'),_0x1c12f4);}return null;})[_0xa27f('0x37')](function(_0xd6e96e){var _0xfd80a8=_0xa27f('0x6b')+_0xd6e96e[_0xa27f('0x27')][_0xa27f('0x6c')];return db[_0xa27f('0x80')][_0xa27f('0x41')](_0xfd80a8,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x3b1249){return _0x3b1249;});})[_0xa27f('0x37')](function(_0x372219){if(_0x372219){_0x1c12f4[_0xa27f('0x27')]['contact']=_0x372219[0x0];if(!_0x2daafb['body'][_0xa27f('0x60')])return;return db[_0xa27f('0x70')][_0xa27f('0x55')]({'where':{'id':_0x2daafb[_0xa27f('0x58')]['UserId'],'role':_0xa27f('0x61')},'attributes':['id','name','fullname',_0xa27f('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x197cad){if(!_0x197cad)return null;_0x1c12f4[_0xa27f('0x27')]['agent']=_0x197cad;return _0x1c12f4;})[_0xa27f('0x37')](function(_0x4c8ae2){if(_0x4c8ae2){_0x4c8ae2[_0xa27f('0x27')][_0xa27f('0x75')]=util[_0xa27f('0x5f')](_0xa27f('0x76'),_0x2daafb['user'][_0xa27f('0x3a')]);_0x4c8ae2[_0xa27f('0x27')][_0xa27f('0x77')]=_0x1c12f4[_0xa27f('0x77')];_0x4c8ae2[_0xa27f('0x27')]['motionChannel']=_0x1c12f4[_0xa27f('0x77')];_0x4c8ae2[_0xa27f('0x27')][_0xa27f('0x79')]=_0xa27f('0x35');respondWithRpcPromise(_0xa27f('0x7a'),_0xa27f('0x7a'),{'event':_0xa27f('0x81'),'message':_0x4c8ae2[_0xa27f('0x27')]},client9002);return _0x1c12f4;}return null;})[_0xa27f('0x37')](respondWithResult(_0x49a84e,null))[_0xa27f('0x2b')](handleError(_0x49a84e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6758025..20fb387 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 _0x49dc=['hasOwnProperty','hook','events','OpenchannelMessage','save','emit'];(function(_0x2c7ff6,_0x5b2555){var _0xbb1d41=function(_0xc20b37){while(--_0xc20b37){_0x2c7ff6['push'](_0x2c7ff6['shift']());}};_0xbb1d41(++_0x5b2555);}(_0x49dc,0x1ee));var _0xc49d=function(_0x853bbd,_0x1bb105){_0x853bbd=_0x853bbd-0x0;var _0x2c1a0f=_0x49dc[_0x853bbd];return _0x2c1a0f;};'use strict';var EventEmitter=require(_0xc49d('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xc49d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc49d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xca68ae){return function(_0x340be3,_0x58c368,_0x420e85){OpenchannelMessageEvents['emit'](_0xca68ae+':'+_0x340be3['id'],_0x340be3);OpenchannelMessageEvents[_0xc49d('0x3')](_0xca68ae,_0x340be3);_0x420e85(null);};}for(var e in events){if(events[_0xc49d('0x4')](e)){var event=events[e];OpenchannelMessage[_0xc49d('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xd294=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage'];(function(_0x5fae11,_0x812d2a){var _0x22695b=function(_0xae0edd){while(--_0xae0edd){_0x5fae11['push'](_0x5fae11['shift']());}};_0x22695b(++_0x812d2a);}(_0xd294,0x1c9));var _0x4d29=function(_0x31eb56,_0x1b0fc0){_0x31eb56=_0x31eb56-0x0;var _0x55b754=_0xd294[_0x31eb56];return _0x55b754;};'use strict';var EventEmitter=require(_0x4d29('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x4d29('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4d29('0x2')](0x0);var events={'afterCreate':_0x4d29('0x3'),'afterUpdate':_0x4d29('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a86ab){return function(_0x2df998,_0x4b842d,_0x54ac51){OpenchannelMessageEvents['emit'](_0x3a86ab+':'+_0x2df998['id'],_0x2df998);OpenchannelMessageEvents[_0x4d29('0x5')](_0x3a86ab,_0x2df998);_0x54ac51(null);};}for(var e in events){if(events[_0x4d29('0x6')](e)){var event=events[e];OpenchannelMessage[_0x4d29('0x7')](e,emitEvent(event));}}module[_0x4d29('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8a52949..893cb64 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 _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','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','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x34b7,0x196));var _0x734b=function(_0x158f5a,_0xaacc25){_0x158f5a=_0x158f5a-0x0;var _0xb3722e=_0x34b7[_0x158f5a];return _0xb3722e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file +var _0x757a=['find','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','threadId','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','OpenchannelInteractionId','update','createdAt','catch','error','out','secret','CmContact','describe','then'];(function(_0x38606d,_0x2e525f){var _0x15aea2=function(_0x12a5a8){while(--_0x12a5a8){_0x38606d['push'](_0x38606d['shift']());}};_0x15aea2(++_0x2e525f);}(_0x757a,0xde));var _0xa757=function(_0x1aa133,_0x516f76){_0x1aa133=_0x1aa133-0x0;var _0x1a5984=_0x757a[_0x1aa133];return _0x1a5984;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('OpenchannelMessage',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xb')],'type':_0xa757('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a3db6,_0x5aef8a,_0x89c630){var _0x2ca96f=_0x5edca8[_0xa757('0xd')];var _0x3e2c9a=_0x3a3db6[_0xa757('0xe')]({'plain':!![]});if(_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()==='in'||_0x3e2c9a['direction']['toLowerCase']()==='out'&&!_0x3e2c9a['secret']&&!_['isNil'](_0x3e2c9a[_0xa757('0x11')])){_0x2ca96f['OpenchannelInteraction']['findOne']({'where':{'id':_0x3e2c9a[_0xa757('0x12')]}})['then'](function(_0x481508){if(_0x481508){_0x481508[_0xa757('0x13')]({'lastMsgAt':_0x3e2c9a[_0xa757('0x14')],'lastMsgDirection':_0x3e2c9a[_0xa757('0xf')][_0xa757('0x10')]()});}})[_0xa757('0x15')](function(_0x31cfd2){console[_0xa757('0x16')](_0x31cfd2);});}if(_0x3e2c9a[_0xa757('0xf')]===_0xa757('0x17')&&!_0x3e2c9a[_0xa757('0x18')]){var _0x50aac1;_0x2ca96f[_0xa757('0x19')][_0xa757('0x1a')]()[_0xa757('0x1b')](function(_0x4d9f58){return _0x2ca96f['OpenchannelAccount'][_0xa757('0x1c')]({'where':{'id':_0x3e2c9a[_0xa757('0x1d')]},'include':[{'model':_0x2ca96f[_0xa757('0x1e')],'as':_0xa757('0x1f'),'where':{'id':_0x3e2c9a[_0xa757('0x12')]},'limit':0x1,'include':[{'model':_0x2ca96f[_0xa757('0x19')],'as':'Contact','attributes':_[_0xa757('0x20')](_0x4d9f58)}]}]});})['then'](function(_0x32c2a1){_0x50aac1=_0x32c2a1[_0xa757('0xe')]({'plain':!![]});if(_0x50aac1&&_0x50aac1[_0xa757('0x21')]){logger[_0xa757('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xa757('0x23')](_0xa757('0x24'),_0x3e2c9a['id'],_0x50aac1[_0xa757('0x21')]));if(_0x50aac1[_0xa757('0x1f')]&&_0x50aac1[_0xa757('0x1f')][_0xa757('0x25')]){_0x3e2c9a[_0xa757('0x26')]=_[_0xa757('0x27')](_0x50aac1[_0xa757('0x1f')][0x0],'Contact');_0x3e2c9a[_0xa757('0x28')]=_0x50aac1['Interactions'][0x0][_0xa757('0x28')];}var _0x5aef8a={'method':_0xa757('0x29'),'uri':encodeURI(_0x50aac1[_0xa757('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5aef8a[_0xa757('0x2a')]){case'GET':_0x5aef8a['qs']=_0x3e2c9a;break;case _0xa757('0x29'):_0x5aef8a[_0xa757('0xb')]=_0x3e2c9a;break;}return rp(_0x5aef8a)[_0xa757('0x1b')](function(_0x3bf7f3){logger['info'](_0xa757('0x2b'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x3e2c9a['id'],_0x50aac1['replyUri']));if(_0x3bf7f3[_0xa757('0xb')]['threadId']&&_0x3bf7f3[_0xa757('0xb')][_0xa757('0x2c')]!=_0x3e2c9a['Interaction'][_0xa757('0x2c')]){return _0x2ca96f['OpenchannelInteraction'][_0xa757('0x13')]({'threadId':_0x3bf7f3[_0xa757('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x3e2c9a[_0xa757('0x26')]['id']}});}else{return;}})['then'](function(){return _0x3a3db6[_0xa757('0x13')]({'read':!![]});})[_0xa757('0x15')](function(_0x458974){logger[_0xa757('0x16')](_0xa757('0x2b'),_0xa757('0x2d'),util[_0xa757('0x2e')](_0x458974,{'showHidden':![],'depth':null}));_0x89c630();});}else{_0x89c630();}})[_0xa757('0x2f')](function(){_0x89c630();});}else{_0x89c630();}}},'charset':_0xa757('0x30'),'collate':_0xa757('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ad7d54d..0f1e7af 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x161846,_0x2ade6d){var _0x4141c1=function(_0x70cdfb){while(--_0x70cdfb){_0x161846['push'](_0x161846['shift']());}};_0x4141c1(++_0x2ade6d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x4dfddc,_0x159aa2){var _0x45dcea=function(_0x181a3){while(--_0x181a3){_0x4dfddc['push'](_0x4dfddc['shift']());}};_0x45dcea(++_0x159aa2);}(_0x2ef3,0xba));var _0x32ef=function(_0x23fcb1,_0x36fd58){_0x23fcb1=_0x23fcb1-0x0;var _0x1b21e8=_0x2ef3[_0x23fcb1];return _0x1b21e8;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2eb36f9..4dd8d84 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 _0xfcfc=['register','length','openchannelMessage:','save','remove','update'];(function(_0xe66628,_0x579c0f){var _0x5a9678=function(_0x436f3f){while(--_0x436f3f){_0xe66628['push'](_0xe66628['shift']());}};_0x5a9678(++_0x579c0f);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x1613fb,_0x213a3d){_0x1613fb=_0x1613fb-0x0;var _0x19b2fe=_0xfcfc[_0x1613fb];return _0x19b2fe;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xcfcf('0x0'),_0xcfcf('0x1'),_0xcfcf('0x2')];function createListener(_0xf5347,_0x497abd){return function(_0x579265){_0x497abd['emit'](_0xf5347,_0x579265);};}function removeListener(_0x291517,_0x391eab){return function(){OpenchannelMessageEvents['removeListener'](_0x291517,_0x391eab);};}exports[_0xcfcf('0x3')]=function(_0x192a69){for(var _0x39cfea=0x0,_0x13d2a8=events[_0xcfcf('0x4')];_0x39cfea<_0x13d2a8;_0x39cfea++){var _0xf42453=events[_0x39cfea];var _0x50aaab=createListener(_0xcfcf('0x5')+_0xf42453,_0x192a69);OpenchannelMessageEvents['on'](_0xf42453,_0x50aaab);}}; \ No newline at end of file +var _0xff36=['remove','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x299c1c,_0x17fbeb){var _0x3a854f=function(_0x387667){while(--_0x387667){_0x299c1c['push'](_0x299c1c['shift']());}};_0x3a854f(++_0x17fbeb);}(_0xff36,0x1de));var _0x6ff3=function(_0x3471c4,_0x37039f){_0x3471c4=_0x3471c4-0x0;var _0x3a8de0=_0xff36[_0x3471c4];return _0x3a8de0;};'use strict';var OpenchannelMessageEvents=require(_0x6ff3('0x0'));var events=[_0x6ff3('0x1'),_0x6ff3('0x2'),'update'];function createListener(_0x4fd3f2,_0x5181e6){return function(_0x44b7a6){_0x5181e6[_0x6ff3('0x3')](_0x4fd3f2,_0x44b7a6);};}function removeListener(_0x462896,_0x597443){return function(){OpenchannelMessageEvents[_0x6ff3('0x4')](_0x462896,_0x597443);};}exports[_0x6ff3('0x5')]=function(_0x2e4525){for(var _0x3da5e8=0x0,_0x3ffd69=events[_0x6ff3('0x6')];_0x3da5e8<_0x3ffd69;_0x3da5e8++){var _0x272015=events[_0x3da5e8];var _0x3ae44b=createListener(_0x6ff3('0x7')+_0x272015,_0x2e4525);OpenchannelMessageEvents['on'](_0x272015,_0x3ae44b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e8f32b8..2ab3f3a 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 _0xc8e9=['update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put'];(function(_0x2c40b1,_0xb58d65){var _0x596aa9=function(_0xf363cf){while(--_0xf363cf){_0x2c40b1['push'](_0x2c40b1['shift']());}};_0x596aa9(++_0xb58d65);}(_0xc8e9,0x1b9));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c8e('0x0'));var util=require(_0x9c8e('0x1'));var path=require(_0x9c8e('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c8e('0x3'));var router=express[_0x9c8e('0x4')]();var fs_extra=require(_0x9c8e('0x5'));var auth=require(_0x9c8e('0x6'));var interaction=require(_0x9c8e('0x7'));var config=require('../../config/environment');var controller=require(_0x9c8e('0x8'));router[_0x9c8e('0x9')]('/',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0xb')]);router[_0x9c8e('0x9')](_0x9c8e('0xc'),auth['isAuthenticated'](),controller[_0x9c8e('0xd')]);router[_0x9c8e('0x9')]('/:id',auth[_0x9c8e('0xa')](),controller['show']);router['get']('/:id/members',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0xe')]);router[_0x9c8e('0x9')](_0x9c8e('0xf'),auth[_0x9c8e('0xa')](),controller['getTeams']);router[_0x9c8e('0x9')](_0x9c8e('0x10'),auth['isAuthenticated'](),controller[_0x9c8e('0x11')]);router[_0x9c8e('0x12')]('/',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x13')]);router[_0x9c8e('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9c8e('0x14')]);router[_0x9c8e('0x12')]('/:id/users',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x15')]);router[_0x9c8e('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9c8e('0x17')]);router['delete']('/:id',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x18')]);router[_0x9c8e('0x19')]('/:id/teams',auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x1a')]);router['delete'](_0x9c8e('0x10'),auth[_0x9c8e('0xa')](),controller[_0x9c8e('0x1b')]);module[_0x9c8e('0x1c')]=router; \ No newline at end of file +var _0xacba=['/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0xbdc17,_0x44ed9f){var _0x881b46=function(_0x1161ce){while(--_0x1161ce){_0xbdc17['push'](_0xbdc17['shift']());}};_0x881b46(++_0x44ed9f);}(_0xacba,0xec));var _0xaacb=function(_0x2d50e4,_0x5079cf){_0x2d50e4=_0x2d50e4-0x0;var _0x5afbf9=_0xacba[_0x2d50e4];return _0x5afbf9;};'use strict';var multer=require(_0xaacb('0x0'));var util=require(_0xaacb('0x1'));var path=require(_0xaacb('0x2'));var timeout=require(_0xaacb('0x3'));var express=require(_0xaacb('0x4'));var router=express[_0xaacb('0x5')]();var fs_extra=require(_0xaacb('0x6'));var auth=require(_0xaacb('0x7'));var interaction=require(_0xaacb('0x8'));var config=require(_0xaacb('0x9'));var controller=require('./openchannelQueue.controller');router[_0xaacb('0xa')]('/',auth['isAuthenticated'](),controller[_0xaacb('0xb')]);router[_0xaacb('0xa')](_0xaacb('0xc'),auth[_0xaacb('0xd')](),controller[_0xaacb('0xe')]);router[_0xaacb('0xa')](_0xaacb('0xf'),auth[_0xaacb('0xd')](),controller[_0xaacb('0x10')]);router[_0xaacb('0xa')](_0xaacb('0x11'),auth['isAuthenticated'](),controller[_0xaacb('0x12')]);router['get'](_0xaacb('0x13'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/users',auth[_0xaacb('0xd')](),controller[_0xaacb('0x14')]);router[_0xaacb('0x15')]('/',auth[_0xaacb('0xd')](),controller[_0xaacb('0x16')]);router[_0xaacb('0x15')]('/:id/teams',auth[_0xaacb('0xd')](),controller['addTeams']);router[_0xaacb('0x15')](_0xaacb('0x17'),auth[_0xaacb('0xd')](),controller[_0xaacb('0x18')]);router[_0xaacb('0x19')]('/:id',auth[_0xaacb('0xd')](),controller[_0xaacb('0x1a')]);router[_0xaacb('0x1b')]('/:id',auth[_0xaacb('0xd')](),controller[_0xaacb('0x1c')]);router['delete'](_0xaacb('0x13'),auth[_0xaacb('0xd')](),controller[_0xaacb('0x1d')]);router[_0xaacb('0x1b')]('/:id/users',auth[_0xaacb('0xd')](),controller['removeAgents']);module[_0xaacb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b4e0324..a9ce625 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 _0x7c59=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x22a55d,_0x4556ae){var _0x2b2f20=function(_0x21a6fc){while(--_0x21a6fc){_0x22a55d['push'](_0x22a55d['shift']());}};_0x2b2f20(++_0x4556ae);}(_0x7c59,0x195));var _0x97c5=function(_0x22eb8f,_0x31401e){_0x22eb8f=_0x22eb8f-0x0;var _0x445848=_0x7c59[_0x22eb8f];return _0x445848;};'use strict';var Sequelize=require('sequelize');module[_0x97c5('0x0')]={'name':{'type':Sequelize[_0x97c5('0x1')],'unique':_0x97c5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97c5('0x1')]},'timeout':{'type':Sequelize[_0x97c5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x97c5('0x4'),_0x97c5('0x5'),_0x97c5('0x6'))}}; \ No newline at end of file +var _0x46f7=['beepall','STRING','name','INTEGER','ENUM'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x46f7,0x7e));var _0x746f=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x46f7[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x746f('0x0')],'unique':_0x746f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x746f('0x0')]},'timeout':{'type':Sequelize[_0x746f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x746f('0x3')]('rrmemory',_0x746f('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 390d158..15ea732 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 _0x71c8=['updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','field','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueue','include','rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','describe','getMembers','findOne','UserOpenchannelQueue','findAll','UserId'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x71c8,0x1bf));var _0x871c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x71c8[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x871c('0x0'));var rimraf=require(_0x871c('0x1'));var zipdir=require(_0x871c('0x2'));var jsonpatch=require(_0x871c('0x3'));var rp=require(_0x871c('0x4'));var moment=require('moment');var BPromise=require(_0x871c('0x5'));var Mustache=require('mustache');var util=require(_0x871c('0x6'));var path=require(_0x871c('0x7'));var sox=require(_0x871c('0x8'));var csv=require('to-csv');var ejs=require(_0x871c('0x9'));var fs=require('fs');var fs_extra=require(_0x871c('0xa'));var _=require('lodash');var squel=require(_0x871c('0xb'));var crypto=require(_0x871c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x871c('0xd'));var toCsv=require(_0x871c('0xe'));var querystring=require('querystring');var Papa=require(_0x871c('0xf'));var Redis=require(_0x871c('0x10'));var authService=require(_0x871c('0x11'));var qs=require(_0x871c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x871c('0x13'));var logger=require(_0x871c('0x14'))(_0x871c('0x15'));var utils=require(_0x871c('0x16'));var config=require(_0x871c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x871c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x871c('0x19')]));require('./openchannelQueue.socket')[_0x871c('0x1a')](socket);function respondWithStatusCode(_0x4b41dc,_0x2c2dc5){_0x2c2dc5=_0x2c2dc5||0xcc;return function(_0x32cfc9){if(_0x32cfc9){return _0x4b41dc[_0x871c('0x1b')](_0x2c2dc5);}return _0x4b41dc[_0x871c('0x1c')](_0x2c2dc5)['end']();};}function respondWithResult(_0x431c48,_0x563261){_0x563261=_0x563261||0xc8;return function(_0x16f16c){if(_0x16f16c){return _0x431c48['status'](_0x563261)[_0x871c('0x1d')](_0x16f16c);}};}function respondWithFilteredResult(_0x22e990,_0x1a8424){return function(_0x27ccfe){if(_0x27ccfe){var _0x50ed12=typeof _0x1a8424[_0x871c('0x1e')]==='undefined'&&typeof _0x1a8424['limit']===_0x871c('0x1f');var _0x46f9b6=_0x27ccfe[_0x871c('0x20')];var _0x24a78f=_0x50ed12?0x0:_0x1a8424[_0x871c('0x1e')];var _0x5675ce=_0x50ed12?_0x27ccfe[_0x871c('0x20')]:_0x1a8424['offset']+_0x1a8424[_0x871c('0x21')];var _0x15917e;if(_0x5675ce>=_0x46f9b6){_0x5675ce=_0x46f9b6;_0x15917e=0xc8;}else{_0x15917e=0xce;}_0x22e990[_0x871c('0x1c')](_0x15917e);return _0x22e990[_0x871c('0x22')](_0x871c('0x23'),_0x24a78f+'-'+_0x5675ce+'/'+_0x46f9b6)[_0x871c('0x1d')](_0x27ccfe);}return null;};}function patchUpdates(_0x377aaf){return function(_0x17608f){try{jsonpatch[_0x871c('0x24')](_0x17608f,_0x377aaf,!![]);}catch(_0x53b524){return BPromise[_0x871c('0x25')](_0x53b524);}return _0x17608f['save']();};}function saveUpdates(_0x5c7f23,_0x465696){return function(_0x20dae9){if(_0x20dae9){return _0x20dae9[_0x871c('0x26')](_0x5c7f23)[_0x871c('0x27')](function(_0x5cb3ec){return _0x5cb3ec;});}return null;};}function removeEntity(_0x2ded4c,_0x514837){return function(_0xf9d185){if(_0xf9d185){return _0xf9d185[_0x871c('0x28')]()[_0x871c('0x27')](function(){var _0x48b1ea=_0xf9d185[_0x871c('0x29')]({'plain':!![]});var _0x39c257='OpenchannelQueues';return db[_0x871c('0x2a')][_0x871c('0x28')]({'where':{'type':_0x39c257,'resourceId':_0x48b1ea['id']}})['then'](function(){return _0xf9d185;});})[_0x871c('0x27')](function(){_0x2ded4c[_0x871c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51dd57,_0x106c69){return function(_0x42129e){if(!_0x42129e){_0x51dd57['sendStatus'](0x194);}return _0x42129e;};}function handleError(_0x81337d,_0x5089f7){_0x5089f7=_0x5089f7||0x1f4;return function(_0x4b0feb){logger[_0x871c('0x2b')](_0x4b0feb['stack']);if(_0x4b0feb[_0x871c('0x2c')]){delete _0x4b0feb['name'];}_0x81337d[_0x871c('0x1c')](_0x5089f7)[_0x871c('0x2d')](_0x4b0feb);};}exports['index']=function(_0x296290,_0x4ff5e8){var _0x38a4f2={},_0x4faf86={},_0x4ed527={'count':0x0,'rows':[]};var _0x232bbf=_[_0x871c('0x2e')](db['OpenchannelQueue'][_0x871c('0x2f')],function(_0x2bf121){return{'name':_0x2bf121[_0x871c('0x30')],'type':_0x2bf121['type'][_0x871c('0x31')]};});_0x4faf86[_0x871c('0x32')]=_[_0x871c('0x2e')](_0x232bbf,_0x871c('0x2c'));_0x4faf86[_0x871c('0x33')]=_[_0x871c('0x34')](_0x296290[_0x871c('0x33')]);_0x4faf86[_0x871c('0x35')]=_[_0x871c('0x36')](_0x4faf86[_0x871c('0x32')],_0x4faf86['query']);_0x38a4f2['attributes']=_[_0x871c('0x36')](_0x4faf86[_0x871c('0x32')],qs['fields'](_0x296290['query'][_0x871c('0x37')]));_0x38a4f2[_0x871c('0x38')]=_0x38a4f2[_0x871c('0x38')][_0x871c('0x39')]?_0x38a4f2[_0x871c('0x38')]:_0x4faf86[_0x871c('0x32')];if(!_0x296290[_0x871c('0x33')][_0x871c('0x3a')]('nolimit')){_0x38a4f2['limit']=qs['limit'](_0x296290[_0x871c('0x33')][_0x871c('0x21')]);_0x38a4f2[_0x871c('0x1e')]=qs['offset'](_0x296290[_0x871c('0x33')][_0x871c('0x1e')]);}_0x38a4f2[_0x871c('0x3b')]=qs[_0x871c('0x3c')](_0x296290[_0x871c('0x33')][_0x871c('0x3c')]);_0x38a4f2[_0x871c('0x3d')]=qs['filters'](_[_0x871c('0x3e')](_0x296290[_0x871c('0x33')],_0x4faf86[_0x871c('0x35')]),_0x232bbf);if(_0x296290[_0x871c('0x33')][_0x871c('0x3f')]){_0x38a4f2[_0x871c('0x3d')]=_[_0x871c('0x40')](_0x38a4f2['where'],{'$or':_['map'](_0x232bbf,function(_0x48c05e){if(_0x48c05e[_0x871c('0x41')]!==_0x871c('0x42')){var _0x1a19d9={};_0x1a19d9[_0x48c05e[_0x871c('0x2c')]]={'$like':'%'+_0x296290[_0x871c('0x33')][_0x871c('0x3f')]+'%'};return _0x1a19d9;}})});}_0x38a4f2=_[_0x871c('0x40')]({},_0x38a4f2,_0x296290[_0x871c('0x43')]);var _0x101bf5={'where':_0x38a4f2[_0x871c('0x3d')]};return db[_0x871c('0x44')][_0x871c('0x20')](_0x101bf5)[_0x871c('0x27')](function(_0x5b24fa){_0x4ed527[_0x871c('0x20')]=_0x5b24fa;if(_0x296290[_0x871c('0x33')]['includeAll']){_0x38a4f2[_0x871c('0x45')]=[{'all':!![]}];}return db[_0x871c('0x44')]['findAll'](_0x38a4f2);})[_0x871c('0x27')](function(_0x44984b){_0x4ed527[_0x871c('0x46')]=_0x44984b;return _0x4ed527;})[_0x871c('0x27')](respondWithFilteredResult(_0x4ff5e8,_0x38a4f2))['catch'](handleError(_0x4ff5e8,null));};exports['show']=function(_0x23f39c,_0x37903c){var _0x198edf={'raw':!![],'where':{'id':_0x23f39c['params']['id']}},_0x4bc537={};_0x4bc537[_0x871c('0x32')]=_['keys'](db[_0x871c('0x44')]['rawAttributes']);_0x4bc537[_0x871c('0x33')]=_[_0x871c('0x34')](_0x23f39c['query']);_0x4bc537[_0x871c('0x35')]=_['intersection'](_0x4bc537[_0x871c('0x32')],_0x4bc537['query']);_0x198edf[_0x871c('0x38')]=_[_0x871c('0x36')](_0x4bc537[_0x871c('0x32')],qs['fields'](_0x23f39c[_0x871c('0x33')]['fields']));_0x198edf[_0x871c('0x38')]=_0x198edf[_0x871c('0x38')][_0x871c('0x39')]?_0x198edf[_0x871c('0x38')]:_0x4bc537[_0x871c('0x32')];if(_0x23f39c[_0x871c('0x33')]['includeAll']){_0x198edf[_0x871c('0x45')]=[{'all':!![]}];}_0x198edf=_[_0x871c('0x40')]({},_0x198edf,_0x23f39c['options']);return db[_0x871c('0x44')][_0x871c('0x47')](_0x198edf)[_0x871c('0x27')](handleEntityNotFound(_0x37903c,null))[_0x871c('0x27')](respondWithResult(_0x37903c,null))['catch'](handleError(_0x37903c,null));};exports[_0x871c('0x48')]=function(_0x55ab86,_0x2b19cd){return db[_0x871c('0x44')]['create'](_0x55ab86[_0x871c('0x49')],{})[_0x871c('0x27')](function(_0x41074f){var _0x5bafe7=_0x55ab86[_0x871c('0x4a')][_0x871c('0x29')]({'plain':!![]});if(!_0x5bafe7)throw new Error(_0x871c('0x4b'));if(_0x5bafe7[_0x871c('0x4c')]===_0x871c('0x4a')){var _0x46c899=_0x41074f[_0x871c('0x29')]({'plain':!![]});var _0x323740=_0x871c('0x4d');return db[_0x871c('0x4e')][_0x871c('0x47')]({'where':{'name':_0x323740,'userProfileId':_0x5bafe7['userProfileId']},'raw':!![]})['then'](function(_0x1254d4){if(_0x1254d4&&_0x1254d4[_0x871c('0x4f')]===0x0){return db[_0x871c('0x2a')]['create']({'name':_0x46c899[_0x871c('0x2c')],'resourceId':_0x46c899['id'],'type':_0x1254d4[_0x871c('0x2c')],'sectionId':_0x1254d4['id']},{})[_0x871c('0x27')](function(){return _0x41074f;});}else{return _0x41074f;}})['catch'](function(_0x538185){logger['error'](_0x871c('0x50'),_0x538185);throw _0x538185;});}return _0x41074f;})[_0x871c('0x27')](respondWithResult(_0x2b19cd,0xc9))[_0x871c('0x51')](handleError(_0x2b19cd,null));};exports[_0x871c('0x26')]=function(_0x35d15a,_0x386b82){if(_0x35d15a[_0x871c('0x49')]['id']){delete _0x35d15a[_0x871c('0x49')]['id'];}return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0x35d15a[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x386b82,null))[_0x871c('0x27')](saveUpdates(_0x35d15a[_0x871c('0x49')],null))[_0x871c('0x27')](respondWithResult(_0x386b82,null))[_0x871c('0x51')](handleError(_0x386b82,null));};exports[_0x871c('0x28')]=function(_0x115f98,_0x5ee9e3){return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0x115f98['params']['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x5ee9e3,null))['then'](removeEntity(_0x5ee9e3,null))[_0x871c('0x51')](handleError(_0x5ee9e3,null));};exports[_0x871c('0x53')]=function(_0x65a50e,_0x5b1758){return db[_0x871c('0x44')][_0x871c('0x53')]()[_0x871c('0x27')](respondWithResult(_0x5b1758,null))[_0x871c('0x51')](handleError(_0x5b1758,null));};exports[_0x871c('0x54')]=function(_0x47236d,_0x3a86fb,_0x2ba3ce){var _0x177be3={'raw':!![],'where':{}},_0x40db5d={},_0x4f3eae;return db[_0x871c('0x44')][_0x871c('0x55')]({'where':{'id':_0x47236d[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x3a86fb,null))['then'](function(_0x586d11){if(_0x586d11){_0x4f3eae=_0x586d11[_0x871c('0x29')]({'plain':!![]});_0x40db5d[_0x871c('0x32')]=_[_0x871c('0x34')](db['UserOpenchannelQueue'][_0x871c('0x2f')]);_0x40db5d[_0x871c('0x33')]=_[_0x871c('0x34')](_0x47236d[_0x871c('0x33')]);_0x40db5d['filters']=_[_0x871c('0x36')](_0x40db5d['model'],_0x40db5d[_0x871c('0x33')]);_0x177be3[_0x871c('0x38')]=_[_0x871c('0x36')](_0x40db5d[_0x871c('0x32')],qs[_0x871c('0x37')](_0x47236d[_0x871c('0x33')]['fields']));_0x177be3[_0x871c('0x38')]=_0x177be3['attributes'][_0x871c('0x39')]?_0x177be3[_0x871c('0x38')]:_0x40db5d[_0x871c('0x32')];if(!_0x47236d['query'][_0x871c('0x3a')]('nolimit')){_0x177be3['limit']=qs[_0x871c('0x21')](_0x47236d[_0x871c('0x33')][_0x871c('0x21')]);_0x177be3[_0x871c('0x1e')]=qs['offset'](_0x47236d[_0x871c('0x33')][_0x871c('0x1e')]);}_0x177be3[_0x871c('0x3b')]=qs[_0x871c('0x3c')](_0x47236d[_0x871c('0x33')][_0x871c('0x3c')]);_0x177be3[_0x871c('0x3d')]=qs[_0x871c('0x35')](_[_0x871c('0x3e')](_0x47236d[_0x871c('0x33')],_0x40db5d['filters']));_0x177be3[_0x871c('0x3d')]['OpenchannelQueueId']=_0x586d11['id'];if(_0x47236d[_0x871c('0x33')][_0x871c('0x3f')]){_0x177be3[_0x871c('0x3d')]=_['merge'](_0x177be3[_0x871c('0x3d')],{'$or':_[_0x871c('0x2e')](_0x177be3[_0x871c('0x38')],function(_0x534452){var _0xf6d01f={};_0xf6d01f[_0x534452]={'$like':'%'+_0x47236d['query']['filter']+'%'};return _0xf6d01f;})});}_0x177be3=_[_0x871c('0x40')]({},_0x177be3,_0x47236d['options']);return db[_0x871c('0x56')][_0x871c('0x57')](_0x177be3);}})[_0x871c('0x27')](function(_0x463b20){if(_0x463b20){return db['User']['findAndCountAll']({'where':{'id':_[_0x871c('0x2e')](_0x463b20,_0x871c('0x58')),'role':'agent'},'attributes':['id',_0x871c('0x2c'),'openchannelPause',_0x871c('0x59'),_0x871c('0x5a')]});}})['then'](function(_0x1452a5){if(_0x1452a5){return{'count':_0x1452a5[_0x871c('0x20')],'rows':_[_0x871c('0x2e')](_0x1452a5[_0x871c('0x46')],function(_0x5542d1){return{'membername':_0x5542d1[_0x871c('0x2c')],'UserId':_0x5542d1['id'],'queue_name':_0x4f3eae[_0x871c('0x2c')],'OpenchannelQueueId':_0x4f3eae['id'],'interface':util[_0x871c('0x5b')](_0x871c('0x5c'),'SIP',_0x5542d1[_0x871c('0x2c')]),'penalty':0x0,'paused':_0x5542d1[_0x871c('0x5d')],'createdAt':_0x5542d1[_0x871c('0x5a')],'updatedAt':_0x5542d1[_0x871c('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x871c('0x27')](respondWithFilteredResult(_0x3a86fb,_0x177be3))['catch'](handleError(_0x3a86fb,null));};exports['getTeams']=function(_0x5b7bad,_0x34cecc,_0x7536a6){var _0x49e398={};var _0x45516c={};var _0x2cabcf;var _0x29381f;return db['OpenchannelQueue'][_0x871c('0x55')]({'where':{'id':_0x5b7bad[_0x871c('0x52')]['id']}})['then'](handleEntityNotFound(_0x34cecc,null))['then'](function(_0x5c3c4b){if(_0x5c3c4b){_0x2cabcf=_0x5c3c4b;_0x45516c[_0x871c('0x32')]=_[_0x871c('0x34')](db['Team']['rawAttributes']);_0x45516c[_0x871c('0x33')]=_[_0x871c('0x34')](_0x5b7bad[_0x871c('0x33')]);_0x45516c['filters']=_[_0x871c('0x36')](_0x45516c[_0x871c('0x32')],_0x45516c[_0x871c('0x33')]);_0x49e398['attributes']=_[_0x871c('0x36')](_0x45516c[_0x871c('0x32')],qs[_0x871c('0x37')](_0x5b7bad[_0x871c('0x33')][_0x871c('0x37')]));_0x49e398['attributes']=_0x49e398[_0x871c('0x38')][_0x871c('0x39')]?_0x49e398[_0x871c('0x38')]:_0x45516c['model'];_0x49e398[_0x871c('0x3b')]=qs['sort'](_0x5b7bad['query'][_0x871c('0x3c')]);_0x49e398[_0x871c('0x3d')]=qs[_0x871c('0x35')](_[_0x871c('0x3e')](_0x5b7bad[_0x871c('0x33')],_0x45516c['filters']));if(_0x5b7bad[_0x871c('0x33')][_0x871c('0x3f')]){_0x49e398[_0x871c('0x3d')]=_[_0x871c('0x40')](_0x49e398[_0x871c('0x3d')],{'$or':_[_0x871c('0x2e')](_0x49e398[_0x871c('0x38')],function(_0x2d2f28){var _0x235048={};_0x235048[_0x2d2f28]={'$like':'%'+_0x5b7bad['query']['filter']+'%'};return _0x235048;})});}_0x49e398=_[_0x871c('0x40')]({},_0x49e398,_0x5b7bad[_0x871c('0x43')]);return _0x2cabcf[_0x871c('0x5e')](_0x49e398);}})['then'](function(_0x1eacad){if(_0x1eacad){_0x29381f=_0x1eacad[_0x871c('0x39')];if(!_0x5b7bad[_0x871c('0x33')][_0x871c('0x3a')]('nolimit')){_0x49e398['limit']=qs['limit'](_0x5b7bad[_0x871c('0x33')][_0x871c('0x21')]);_0x49e398[_0x871c('0x1e')]=qs['offset'](_0x5b7bad['query']['offset']);}return _0x2cabcf[_0x871c('0x5e')](_0x49e398);}})[_0x871c('0x27')](function(_0x29f039){if(_0x29f039){return _0x29f039?{'count':_0x29381f,'rows':_0x29f039}:null;}})['then'](respondWithResult(_0x34cecc,null))[_0x871c('0x51')](handleError(_0x34cecc,null));};exports['addTeams']=function(_0x45f68b,_0x48f64e,_0x4f5097){var _0x169b6a=_0x45f68b[_0x871c('0x49')][_0x871c('0x5f')];return db[_0x871c('0x60')][_0x871c('0x57')]({'where':{'id':_0x169b6a},'attributes':['id'],'include':[{'model':db[_0x871c('0x61')],'as':_0x871c('0x62'),'attributes':['id',_0x871c('0x2c'),_0x871c('0x63'),_0x871c('0x64'),_0x871c('0x65')],'raw':!![]}]})[_0x871c('0x27')](function(_0x2f4481){if(_0x2f4481){var _0x1285b1=_[_0x871c('0x66')](_0x2f4481,function(_0x2d1f18){var _0x7fbb41=_0x2d1f18[_0x871c('0x29')]({'plain':!![]});return _0x7fbb41['Agents'];});return db[_0x871c('0x44')]['find']({'where':{'id':_0x45f68b[_0x871c('0x52')]['id']}})[_0x871c('0x27')](function(_0x4e0180){return db['sequelize'][_0x871c('0x67')](function(_0x31ecac){return _0x4e0180[_0x871c('0x68')](_0x169b6a,{'transaction':_0x31ecac})[_0x871c('0x27')](function(){return BPromise[_0x871c('0x69')](_0x1285b1,function(_0x2d4d61){return db[_0x871c('0x56')][_0x871c('0x6a')]({'where':{'UserId':_0x2d4d61['id'],'OpenchannelQueueId':_0x45f68b[_0x871c('0x52')]['id']},'transaction':_0x31ecac});});})['then'](function(){_0x1285b1[_0x871c('0x6b')](function(_0xbed52e){socket[_0x871c('0x6c')]('userOpenchannelQueue:save',{'UserId':_0xbed52e['id'],'OpenchannelQueueId':_0x4e0180['id']});});});});});}})[_0x871c('0x27')](respondWithStatusCode(_0x48f64e,null))[_0x871c('0x51')](handleError(_0x48f64e,null));};exports['removeTeams']=function(_0x1ff8d4,_0x427185,_0x1361d2){return db[_0x871c('0x60')][_0x871c('0x57')]({'where':{'id':_0x1ff8d4[_0x871c('0x33')][_0x871c('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x427185,null))['then'](function(_0x583665){var _0x5f4e7e=_[_0x871c('0x2e')](_0x583665,'id');var _0x5f1859=[];var _0x1e2c00=[];var _0x2089ab=squel['select']();_0x2089ab[_0x871c('0x6d')]('tq.TeamId')['from'](_0x871c('0x6e'),'tq')['join'](_0x871c('0x6f'),'ut',_0x871c('0x70'))[_0x871c('0x3d')](_0x871c('0x71'),_0x1ff8d4[_0x871c('0x52')]['id']);for(var _0x3dce26=0x0;_0x3dce26<_0x583665['length'];_0x3dce26+=0x1){let _0x2b08f4=_0x583665[_0x3dce26];for(var _0x333d75=0x0;_0x333d75<_0x2b08f4[_0x871c('0x62')][_0x871c('0x39')];_0x333d75+=0x1){let _0x357fb3=_0x2b08f4[_0x871c('0x62')][_0x333d75];var _0x535088=_0x2089ab['clone']();_0x535088[_0x871c('0x3d')]('ut.UserId\x20=\x20?',_0x357fb3['id']);_0x1e2c00[_0x871c('0x72')](db[_0x871c('0x73')][_0x871c('0x33')](_0x535088[_0x871c('0x74')](),{'type':db['sequelize']['QueryTypes'][_0x871c('0x75')]})[_0x871c('0x27')](function(_0x29b335){if(_0x29b335['length']===0x1){return _0x357fb3['id'];}else{var _0x2fcb62=_[_0x871c('0x76')](_[_0x871c('0x2e')](_0x29b335,'TeamId'),function(_0x521485){return _[_0x871c('0x77')](_0x5f4e7e,_0x521485);});if(_0x2fcb62){return _0x357fb3['id'];}}}));}}return BPromise[_0x871c('0x78')](_0x1e2c00)[_0x871c('0x27')](function(_0x2ef051){_0x5f1859=_(_0x5f1859)[_0x871c('0x79')](_0x2ef051)[_0x871c('0x7a')]()[_0x871c('0x7b')]();return db[_0x871c('0x44')]['find']({'where':{'id':_0x1ff8d4[_0x871c('0x52')]['id']}})['then'](function(_0x2fa050){return db[_0x871c('0x73')][_0x871c('0x67')](function(_0x204816){return _0x2fa050[_0x871c('0x7c')](_0x1ff8d4['query'][_0x871c('0x5f')],{'transaction':_0x204816})[_0x871c('0x27')](function(){if(!_[_0x871c('0x7d')](_0x5f1859)){return _0x2fa050[_0x871c('0x7e')](_0x5f1859,{'transaction':_0x204816});}})[_0x871c('0x27')](function(){_0x5f1859[_0x871c('0x6b')](function(_0x386d40){socket[_0x871c('0x6c')](_0x871c('0x7f'),{'UserId':_0x386d40,'OpenchannelQueueId':_0x2fa050['id']});});});});});});})[_0x871c('0x27')](respondWithStatusCode(_0x427185,null))[_0x871c('0x51')](handleError(_0x427185,null));};exports[_0x871c('0x80')]=function(_0x36fbda,_0x5be768,_0x270da2){return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0x36fbda[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x5be768,null))['then'](function(_0x289b0c){if(_0x289b0c){return _0x289b0c[_0x871c('0x80')](_0x36fbda['body'][_0x871c('0x5f')],_['omit'](_0x36fbda[_0x871c('0x49')],[_0x871c('0x5f'),'id'])||{})[_0x871c('0x81')](function(_0x25a9e0){for(var _0x465e0a=0x0;_0x465e0a<_0x36fbda[_0x871c('0x49')][_0x871c('0x5f')][_0x871c('0x39')];_0x465e0a+=0x1){socket[_0x871c('0x6c')](_0x871c('0x82'),{'UserId':Number(_0x36fbda[_0x871c('0x49')][_0x871c('0x5f')][_0x465e0a]),'OpenchannelQueueId':Number(_0x36fbda[_0x871c('0x52')]['id'])});}return _0x25a9e0;});}})[_0x871c('0x27')](respondWithResult(_0x5be768,null))[_0x871c('0x51')](handleError(_0x5be768,null));};exports[_0x871c('0x7e')]=function(_0xbe5d3c,_0x494a57,_0x5af200){return db[_0x871c('0x44')][_0x871c('0x47')]({'where':{'id':_0xbe5d3c[_0x871c('0x52')]['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x494a57,null))[_0x871c('0x27')](function(_0x799d4c){if(_0x799d4c){return _0x799d4c[_0x871c('0x7e')](_0xbe5d3c[_0x871c('0x33')][_0x871c('0x5f')])[_0x871c('0x27')](function(){if(_[_0x871c('0x83')](_0xbe5d3c[_0x871c('0x33')][_0x871c('0x5f')])){for(var _0xbe79af=0x0;_0xbe79af<_0xbe5d3c['query'][_0x871c('0x5f')][_0x871c('0x39')];_0xbe79af+=0x1){socket[_0x871c('0x6c')](_0x871c('0x7f'),{'UserId':Number(_0xbe5d3c[_0x871c('0x33')]['ids'][_0xbe79af]),'OpenchannelQueueId':Number(_0xbe5d3c['params']['id'])});}}else{socket[_0x871c('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0xbe5d3c['query'][_0x871c('0x5f')]),'OpenchannelQueueId':Number(_0xbe5d3c[_0x871c('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x494a57,null))[_0x871c('0x51')](handleError(_0x494a57,null));};exports[_0x871c('0x84')]=function(_0x5b66d6,_0x346831,_0x4b3452){var _0x43a703={};var _0x330403={};var _0x4b1b8a;var _0x17c40d;return db[_0x871c('0x44')][_0x871c('0x55')]({'where':{'id':_0x5b66d6['params']['id']}})[_0x871c('0x27')](handleEntityNotFound(_0x346831,null))['then'](function(_0x2cac9a){if(_0x2cac9a){_0x4b1b8a=_0x2cac9a;_0x330403[_0x871c('0x32')]=_[_0x871c('0x34')](db['User'][_0x871c('0x2f')]);_0x330403[_0x871c('0x33')]=_[_0x871c('0x34')](_0x5b66d6[_0x871c('0x33')]);_0x330403[_0x871c('0x35')]=_[_0x871c('0x36')](_0x330403[_0x871c('0x32')],_0x330403[_0x871c('0x33')]);_0x43a703[_0x871c('0x38')]=_['intersection'](_0x330403[_0x871c('0x32')],qs[_0x871c('0x37')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x37')]));_0x43a703[_0x871c('0x38')]=_0x43a703[_0x871c('0x38')][_0x871c('0x39')]?_0x43a703[_0x871c('0x38')]:_0x330403[_0x871c('0x32')];_0x43a703['order']=qs[_0x871c('0x3c')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x3c')]);_0x43a703['where']=qs[_0x871c('0x35')](_['pick'](_0x5b66d6[_0x871c('0x33')],_0x330403[_0x871c('0x35')]));if(_0x5b66d6[_0x871c('0x33')][_0x871c('0x3f')]){_0x43a703[_0x871c('0x3d')]=_[_0x871c('0x40')](_0x43a703['where'],{'$or':_[_0x871c('0x2e')](_0x43a703[_0x871c('0x38')],function(_0x26660a){var _0x3f0f41={};_0x3f0f41[_0x26660a]={'$like':'%'+_0x5b66d6[_0x871c('0x33')][_0x871c('0x3f')]+'%'};return _0x3f0f41;})});}_0x43a703=_[_0x871c('0x40')]({},_0x43a703,_0x5b66d6[_0x871c('0x43')]);return _0x4b1b8a[_0x871c('0x84')](_0x43a703);}})[_0x871c('0x27')](function(_0x45bf66){if(_0x45bf66){_0x17c40d=_0x45bf66[_0x871c('0x39')];if(!_0x5b66d6[_0x871c('0x33')][_0x871c('0x3a')](_0x871c('0x85'))){_0x43a703[_0x871c('0x21')]=qs[_0x871c('0x21')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x21')]);_0x43a703[_0x871c('0x1e')]=qs[_0x871c('0x1e')](_0x5b66d6[_0x871c('0x33')][_0x871c('0x1e')]);}return _0x4b1b8a[_0x871c('0x84')](_0x43a703);}})[_0x871c('0x27')](function(_0x4e383b){if(_0x4e383b){return _0x4e383b?{'count':_0x17c40d,'rows':_0x4e383b}:null;}})['then'](respondWithResult(_0x346831,null))[_0x871c('0x51')](handleError(_0x346831,null));}; \ No newline at end of file +var _0x6d68=['omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','OpenchannelQueue','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','options','User','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove'];(function(_0x2e1907,_0x229a70){var _0x401555=function(_0x487ac2){while(--_0x487ac2){_0x2e1907['push'](_0x2e1907['shift']());}};_0x401555(++_0x229a70);}(_0x6d68,0x93));var _0x86d6=function(_0x19b834,_0x48689b){_0x19b834=_0x19b834-0x0;var _0x14f5d8=_0x6d68[_0x19b834];return _0x14f5d8;};'use strict';var emlformat=require(_0x86d6('0x0'));var rimraf=require(_0x86d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86d6('0x2'));var rp=require('request-promise');var moment=require(_0x86d6('0x3'));var BPromise=require(_0x86d6('0x4'));var Mustache=require(_0x86d6('0x5'));var util=require(_0x86d6('0x6'));var path=require(_0x86d6('0x7'));var sox=require(_0x86d6('0x8'));var csv=require(_0x86d6('0x9'));var ejs=require(_0x86d6('0xa'));var fs=require('fs');var fs_extra=require(_0x86d6('0xb'));var _=require(_0x86d6('0xc'));var squel=require(_0x86d6('0xd'));var crypto=require(_0x86d6('0xe'));var jsforce=require(_0x86d6('0xf'));var deskjs=require(_0x86d6('0x10'));var toCsv=require(_0x86d6('0x9'));var querystring=require(_0x86d6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d6('0x12'));var qs=require(_0x86d6('0x13'));var as=require(_0x86d6('0x14'));var hardwareService=require(_0x86d6('0x15'));var logger=require(_0x86d6('0x16'))(_0x86d6('0x17'));var utils=require('../../config/utils');var config=require(_0x86d6('0x18'));var licenseUtil=require(_0x86d6('0x19'));var db=require(_0x86d6('0x1a'))['db'];config['redis']=_[_0x86d6('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x86d6('0x1c')](socket);function respondWithStatusCode(_0x2907f4,_0x1a8fb6){_0x1a8fb6=_0x1a8fb6||0xcc;return function(_0x1d8389){if(_0x1d8389){return _0x2907f4[_0x86d6('0x1d')](_0x1a8fb6);}return _0x2907f4[_0x86d6('0x1e')](_0x1a8fb6)[_0x86d6('0x1f')]();};}function respondWithResult(_0x270175,_0x41a601){_0x41a601=_0x41a601||0xc8;return function(_0x57beb8){if(_0x57beb8){return _0x270175['status'](_0x41a601)[_0x86d6('0x20')](_0x57beb8);}};}function respondWithFilteredResult(_0x521e5a,_0x2d9af2){return function(_0x4a139b){if(_0x4a139b){var _0x4f3a7d=typeof _0x2d9af2[_0x86d6('0x21')]===_0x86d6('0x22')&&typeof _0x2d9af2[_0x86d6('0x23')]===_0x86d6('0x22');var _0x1d44b1=_0x4a139b[_0x86d6('0x24')];var _0x450896=_0x4f3a7d?0x0:_0x2d9af2[_0x86d6('0x21')];var _0x424613=_0x4f3a7d?_0x4a139b[_0x86d6('0x24')]:_0x2d9af2['offset']+_0x2d9af2[_0x86d6('0x23')];var _0x2dc4a9;if(_0x424613>=_0x1d44b1){_0x424613=_0x1d44b1;_0x2dc4a9=0xc8;}else{_0x2dc4a9=0xce;}_0x521e5a[_0x86d6('0x1e')](_0x2dc4a9);return _0x521e5a[_0x86d6('0x25')](_0x86d6('0x26'),_0x450896+'-'+_0x424613+'/'+_0x1d44b1)[_0x86d6('0x20')](_0x4a139b);}return null;};}function patchUpdates(_0x47a47f){return function(_0x8e1056){try{jsonpatch[_0x86d6('0x27')](_0x8e1056,_0x47a47f,!![]);}catch(_0x252ce4){return BPromise[_0x86d6('0x28')](_0x252ce4);}return _0x8e1056[_0x86d6('0x29')]();};}function saveUpdates(_0x202bcc,_0x5e14d6){return function(_0x447bb5){if(_0x447bb5){return _0x447bb5[_0x86d6('0x2a')](_0x202bcc)[_0x86d6('0x2b')](function(_0x546010){return _0x546010;});}return null;};}function removeEntity(_0x567863,_0x1bf830){return function(_0x25bb28){if(_0x25bb28){return _0x25bb28[_0x86d6('0x2c')]()[_0x86d6('0x2b')](function(){var _0x1a0fd6=_0x25bb28[_0x86d6('0x2d')]({'plain':!![]});var _0x5b5b00=_0x86d6('0x2e');return db[_0x86d6('0x2f')][_0x86d6('0x2c')]({'where':{'type':_0x5b5b00,'resourceId':_0x1a0fd6['id']}})['then'](function(){return _0x25bb28;});})[_0x86d6('0x2b')](function(){_0x567863[_0x86d6('0x1e')](0xcc)[_0x86d6('0x1f')]();});}};}function handleEntityNotFound(_0x44502d,_0x363750){return function(_0x26095c){if(!_0x26095c){_0x44502d[_0x86d6('0x1d')](0x194);}return _0x26095c;};}function handleError(_0x1c8313,_0xc45a29){_0xc45a29=_0xc45a29||0x1f4;return function(_0x45e370){logger[_0x86d6('0x30')](_0x45e370[_0x86d6('0x31')]);if(_0x45e370['name']){delete _0x45e370[_0x86d6('0x32')];}_0x1c8313[_0x86d6('0x1e')](_0xc45a29)[_0x86d6('0x33')](_0x45e370);};}exports[_0x86d6('0x34')]=function(_0x3af869,_0x4756ad){var _0x5f51ed={},_0x678209={},_0x229a7b={'count':0x0,'rows':[]};var _0x1cf1f5=_[_0x86d6('0x35')](db['OpenchannelQueue'][_0x86d6('0x36')],function(_0x7f7dcf){return{'name':_0x7f7dcf['fieldName'],'type':_0x7f7dcf['type'][_0x86d6('0x37')]};});_0x678209[_0x86d6('0x38')]=_['map'](_0x1cf1f5,_0x86d6('0x32'));_0x678209[_0x86d6('0x39')]=_[_0x86d6('0x3a')](_0x3af869['query']);_0x678209[_0x86d6('0x3b')]=_['intersection'](_0x678209[_0x86d6('0x38')],_0x678209[_0x86d6('0x39')]);_0x5f51ed['attributes']=_[_0x86d6('0x3c')](_0x678209[_0x86d6('0x38')],qs[_0x86d6('0x3d')](_0x3af869['query'][_0x86d6('0x3d')]));_0x5f51ed[_0x86d6('0x3e')]=_0x5f51ed[_0x86d6('0x3e')][_0x86d6('0x3f')]?_0x5f51ed['attributes']:_0x678209[_0x86d6('0x38')];if(!_0x3af869[_0x86d6('0x39')]['hasOwnProperty'](_0x86d6('0x40'))){_0x5f51ed['limit']=qs[_0x86d6('0x23')](_0x3af869[_0x86d6('0x39')][_0x86d6('0x23')]);_0x5f51ed['offset']=qs[_0x86d6('0x21')](_0x3af869[_0x86d6('0x39')]['offset']);}_0x5f51ed[_0x86d6('0x41')]=qs[_0x86d6('0x42')](_0x3af869[_0x86d6('0x39')][_0x86d6('0x42')]);_0x5f51ed[_0x86d6('0x43')]=qs[_0x86d6('0x3b')](_[_0x86d6('0x44')](_0x3af869[_0x86d6('0x39')],_0x678209[_0x86d6('0x3b')]),_0x1cf1f5);if(_0x3af869[_0x86d6('0x39')][_0x86d6('0x45')]){_0x5f51ed[_0x86d6('0x43')]=_[_0x86d6('0x46')](_0x5f51ed[_0x86d6('0x43')],{'$or':_[_0x86d6('0x35')](_0x1cf1f5,function(_0xff33b){if(_0xff33b[_0x86d6('0x47')]!==_0x86d6('0x48')){var _0x5625da={};_0x5625da[_0xff33b[_0x86d6('0x32')]]={'$like':'%'+_0x3af869[_0x86d6('0x39')][_0x86d6('0x45')]+'%'};return _0x5625da;}})});}_0x5f51ed=_['merge']({},_0x5f51ed,_0x3af869['options']);var _0x45afb1={'where':_0x5f51ed[_0x86d6('0x43')]};return db[_0x86d6('0x49')][_0x86d6('0x24')](_0x45afb1)[_0x86d6('0x2b')](function(_0x27cb58){_0x229a7b[_0x86d6('0x24')]=_0x27cb58;if(_0x3af869[_0x86d6('0x39')]['includeAll']){_0x5f51ed[_0x86d6('0x4a')]=[{'all':!![]}];}return db[_0x86d6('0x49')][_0x86d6('0x4b')](_0x5f51ed);})['then'](function(_0x5b7e08){_0x229a7b[_0x86d6('0x4c')]=_0x5b7e08;return _0x229a7b;})[_0x86d6('0x2b')](respondWithFilteredResult(_0x4756ad,_0x5f51ed))[_0x86d6('0x4d')](handleError(_0x4756ad,null));};exports[_0x86d6('0x4e')]=function(_0x5defe1,_0x5c2224){var _0x181ec2={'raw':!![],'where':{'id':_0x5defe1[_0x86d6('0x4f')]['id']}},_0x588212={};_0x588212[_0x86d6('0x38')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x588212['query']=_[_0x86d6('0x3a')](_0x5defe1[_0x86d6('0x39')]);_0x588212[_0x86d6('0x3b')]=_[_0x86d6('0x3c')](_0x588212[_0x86d6('0x38')],_0x588212[_0x86d6('0x39')]);_0x181ec2[_0x86d6('0x3e')]=_[_0x86d6('0x3c')](_0x588212[_0x86d6('0x38')],qs[_0x86d6('0x3d')](_0x5defe1[_0x86d6('0x39')]['fields']));_0x181ec2[_0x86d6('0x3e')]=_0x181ec2[_0x86d6('0x3e')][_0x86d6('0x3f')]?_0x181ec2[_0x86d6('0x3e')]:_0x588212[_0x86d6('0x38')];if(_0x5defe1[_0x86d6('0x39')][_0x86d6('0x50')]){_0x181ec2[_0x86d6('0x4a')]=[{'all':!![]}];}_0x181ec2=_[_0x86d6('0x46')]({},_0x181ec2,_0x5defe1['options']);return db[_0x86d6('0x49')][_0x86d6('0x51')](_0x181ec2)[_0x86d6('0x2b')](handleEntityNotFound(_0x5c2224,null))['then'](respondWithResult(_0x5c2224,null))[_0x86d6('0x4d')](handleError(_0x5c2224,null));};exports[_0x86d6('0x52')]=function(_0x4c8902,_0x1964fa){return db[_0x86d6('0x49')][_0x86d6('0x52')](_0x4c8902[_0x86d6('0x53')],{})[_0x86d6('0x2b')](function(_0x186496){var _0x5cbd47=_0x4c8902['user'][_0x86d6('0x2d')]({'plain':!![]});if(!_0x5cbd47)throw new Error(_0x86d6('0x54'));if(_0x5cbd47[_0x86d6('0x55')]==='user'){var _0x35118b=_0x186496[_0x86d6('0x2d')]({'plain':!![]});var _0x532015=_0x86d6('0x2e');return db[_0x86d6('0x56')][_0x86d6('0x51')]({'where':{'name':_0x532015,'userProfileId':_0x5cbd47[_0x86d6('0x57')]},'raw':!![]})[_0x86d6('0x2b')](function(_0x5b28e4){if(_0x5b28e4&&_0x5b28e4[_0x86d6('0x58')]===0x0){return db[_0x86d6('0x2f')]['create']({'name':_0x35118b[_0x86d6('0x32')],'resourceId':_0x35118b['id'],'type':_0x5b28e4[_0x86d6('0x32')],'sectionId':_0x5b28e4['id']},{})[_0x86d6('0x2b')](function(){return _0x186496;});}else{return _0x186496;}})[_0x86d6('0x4d')](function(_0x3eb62d){logger[_0x86d6('0x30')](_0x86d6('0x59'),_0x3eb62d);throw _0x3eb62d;});}return _0x186496;})[_0x86d6('0x2b')](respondWithResult(_0x1964fa,0xc9))[_0x86d6('0x4d')](handleError(_0x1964fa,null));};exports['update']=function(_0x32fbf6,_0x3ca27e){if(_0x32fbf6[_0x86d6('0x53')]['id']){delete _0x32fbf6[_0x86d6('0x53')]['id'];}return db[_0x86d6('0x49')][_0x86d6('0x51')]({'where':{'id':_0x32fbf6[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x3ca27e,null))[_0x86d6('0x2b')](saveUpdates(_0x32fbf6[_0x86d6('0x53')],null))[_0x86d6('0x2b')](respondWithResult(_0x3ca27e,null))[_0x86d6('0x4d')](handleError(_0x3ca27e,null));};exports[_0x86d6('0x2c')]=function(_0x28c7a1,_0x298f4d){return db[_0x86d6('0x49')][_0x86d6('0x51')]({'where':{'id':_0x28c7a1[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x298f4d,null))['then'](removeEntity(_0x298f4d,null))['catch'](handleError(_0x298f4d,null));};exports['describe']=function(_0x5591cd,_0x2d5de5){return db[_0x86d6('0x49')][_0x86d6('0x5a')]()[_0x86d6('0x2b')](respondWithResult(_0x2d5de5,null))[_0x86d6('0x4d')](handleError(_0x2d5de5,null));};exports['getMembers']=function(_0x1f39f6,_0x123ab3,_0x5d67e4){var _0x57e9e0={'raw':!![],'where':{}},_0x56cc69={},_0x34a037;return db['OpenchannelQueue'][_0x86d6('0x5b')]({'where':{'id':_0x1f39f6[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x123ab3,null))[_0x86d6('0x2b')](function(_0x4f1d24){if(_0x4f1d24){_0x34a037=_0x4f1d24[_0x86d6('0x2d')]({'plain':!![]});_0x56cc69['model']=_['keys'](db[_0x86d6('0x5c')][_0x86d6('0x36')]);_0x56cc69[_0x86d6('0x39')]=_[_0x86d6('0x3a')](_0x1f39f6[_0x86d6('0x39')]);_0x56cc69[_0x86d6('0x3b')]=_['intersection'](_0x56cc69['model'],_0x56cc69['query']);_0x57e9e0[_0x86d6('0x3e')]=_[_0x86d6('0x3c')](_0x56cc69['model'],qs[_0x86d6('0x3d')](_0x1f39f6[_0x86d6('0x39')][_0x86d6('0x3d')]));_0x57e9e0[_0x86d6('0x3e')]=_0x57e9e0['attributes'][_0x86d6('0x3f')]?_0x57e9e0['attributes']:_0x56cc69['model'];if(!_0x1f39f6[_0x86d6('0x39')][_0x86d6('0x5d')](_0x86d6('0x40'))){_0x57e9e0[_0x86d6('0x23')]=qs[_0x86d6('0x23')](_0x1f39f6[_0x86d6('0x39')][_0x86d6('0x23')]);_0x57e9e0[_0x86d6('0x21')]=qs[_0x86d6('0x21')](_0x1f39f6[_0x86d6('0x39')][_0x86d6('0x21')]);}_0x57e9e0['order']=qs[_0x86d6('0x42')](_0x1f39f6[_0x86d6('0x39')][_0x86d6('0x42')]);_0x57e9e0['where']=qs[_0x86d6('0x3b')](_[_0x86d6('0x44')](_0x1f39f6[_0x86d6('0x39')],_0x56cc69[_0x86d6('0x3b')]));_0x57e9e0[_0x86d6('0x43')][_0x86d6('0x5e')]=_0x4f1d24['id'];if(_0x1f39f6[_0x86d6('0x39')][_0x86d6('0x45')]){_0x57e9e0[_0x86d6('0x43')]=_[_0x86d6('0x46')](_0x57e9e0['where'],{'$or':_[_0x86d6('0x35')](_0x57e9e0[_0x86d6('0x3e')],function(_0x20c095){var _0x3ba303={};_0x3ba303[_0x20c095]={'$like':'%'+_0x1f39f6['query']['filter']+'%'};return _0x3ba303;})});}_0x57e9e0=_['merge']({},_0x57e9e0,_0x1f39f6[_0x86d6('0x5f')]);return db[_0x86d6('0x5c')][_0x86d6('0x4b')](_0x57e9e0);}})['then'](function(_0x34f92e){if(_0x34f92e){return db[_0x86d6('0x60')]['findAndCountAll']({'where':{'id':_[_0x86d6('0x35')](_0x34f92e,'UserId'),'role':_0x86d6('0x61')},'attributes':['id',_0x86d6('0x32'),_0x86d6('0x62'),_0x86d6('0x63'),_0x86d6('0x64')]});}})[_0x86d6('0x2b')](function(_0xfa840a){if(_0xfa840a){return{'count':_0xfa840a[_0x86d6('0x24')],'rows':_[_0x86d6('0x35')](_0xfa840a[_0x86d6('0x4c')],function(_0x3fb14b){return{'membername':_0x3fb14b['name'],'UserId':_0x3fb14b['id'],'queue_name':_0x34a037['name'],'OpenchannelQueueId':_0x34a037['id'],'interface':util[_0x86d6('0x65')](_0x86d6('0x66'),_0x86d6('0x67'),_0x3fb14b[_0x86d6('0x32')]),'penalty':0x0,'paused':_0x3fb14b[_0x86d6('0x62')],'createdAt':_0x3fb14b['createdAt'],'updatedAt':_0x3fb14b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x86d6('0x2b')](respondWithFilteredResult(_0x123ab3,_0x57e9e0))[_0x86d6('0x4d')](handleError(_0x123ab3,null));};exports[_0x86d6('0x68')]=function(_0x186b8a,_0x4e6bae,_0x3138de){var _0x8b3edc={};var _0x5e7636={};var _0x4e071e;var _0x23c584;return db[_0x86d6('0x49')][_0x86d6('0x5b')]({'where':{'id':_0x186b8a[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x4e6bae,null))[_0x86d6('0x2b')](function(_0x26ea24){if(_0x26ea24){_0x4e071e=_0x26ea24;_0x5e7636[_0x86d6('0x38')]=_[_0x86d6('0x3a')](db[_0x86d6('0x69')][_0x86d6('0x36')]);_0x5e7636[_0x86d6('0x39')]=_[_0x86d6('0x3a')](_0x186b8a['query']);_0x5e7636[_0x86d6('0x3b')]=_[_0x86d6('0x3c')](_0x5e7636['model'],_0x5e7636[_0x86d6('0x39')]);_0x8b3edc['attributes']=_[_0x86d6('0x3c')](_0x5e7636[_0x86d6('0x38')],qs['fields'](_0x186b8a[_0x86d6('0x39')][_0x86d6('0x3d')]));_0x8b3edc['attributes']=_0x8b3edc['attributes'][_0x86d6('0x3f')]?_0x8b3edc[_0x86d6('0x3e')]:_0x5e7636['model'];_0x8b3edc[_0x86d6('0x41')]=qs[_0x86d6('0x42')](_0x186b8a['query'][_0x86d6('0x42')]);_0x8b3edc[_0x86d6('0x43')]=qs[_0x86d6('0x3b')](_['pick'](_0x186b8a['query'],_0x5e7636['filters']));if(_0x186b8a['query']['filter']){_0x8b3edc[_0x86d6('0x43')]=_[_0x86d6('0x46')](_0x8b3edc['where'],{'$or':_['map'](_0x8b3edc[_0x86d6('0x3e')],function(_0x430a26){var _0x139b18={};_0x139b18[_0x430a26]={'$like':'%'+_0x186b8a[_0x86d6('0x39')][_0x86d6('0x45')]+'%'};return _0x139b18;})});}_0x8b3edc=_[_0x86d6('0x46')]({},_0x8b3edc,_0x186b8a[_0x86d6('0x5f')]);return _0x4e071e[_0x86d6('0x68')](_0x8b3edc);}})[_0x86d6('0x2b')](function(_0x55d3c0){if(_0x55d3c0){_0x23c584=_0x55d3c0[_0x86d6('0x3f')];if(!_0x186b8a[_0x86d6('0x39')]['hasOwnProperty'](_0x86d6('0x40'))){_0x8b3edc[_0x86d6('0x23')]=qs[_0x86d6('0x23')](_0x186b8a[_0x86d6('0x39')][_0x86d6('0x23')]);_0x8b3edc[_0x86d6('0x21')]=qs[_0x86d6('0x21')](_0x186b8a['query'][_0x86d6('0x21')]);}return _0x4e071e[_0x86d6('0x68')](_0x8b3edc);}})[_0x86d6('0x2b')](function(_0x489406){if(_0x489406){return _0x489406?{'count':_0x23c584,'rows':_0x489406}:null;}})[_0x86d6('0x2b')](respondWithResult(_0x4e6bae,null))[_0x86d6('0x4d')](handleError(_0x4e6bae,null));};exports['addTeams']=function(_0x41e0cc,_0x4298d8,_0x35e494){var _0x4a522f=_0x41e0cc[_0x86d6('0x53')]['ids'];return db['Team']['findAll']({'where':{'id':_0x4a522f},'attributes':['id'],'include':[{'model':db[_0x86d6('0x60')],'as':_0x86d6('0x6a'),'attributes':['id',_0x86d6('0x32'),_0x86d6('0x6b'),_0x86d6('0x6c'),'interface'],'raw':!![]}]})[_0x86d6('0x2b')](function(_0x9b11a7){if(_0x9b11a7){var _0x41454f=_[_0x86d6('0x6d')](_0x9b11a7,function(_0x9e98d9){var _0x95d969=_0x9e98d9[_0x86d6('0x2d')]({'plain':!![]});return _0x95d969[_0x86d6('0x6a')];});return db[_0x86d6('0x49')][_0x86d6('0x51')]({'where':{'id':_0x41e0cc[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](function(_0x57ae59){return db[_0x86d6('0x6e')][_0x86d6('0x6f')](function(_0x29912d){return _0x57ae59['addTeams'](_0x4a522f,{'transaction':_0x29912d})[_0x86d6('0x2b')](function(){return BPromise[_0x86d6('0x70')](_0x41454f,function(_0xc57590){return db[_0x86d6('0x5c')]['findOrCreate']({'where':{'UserId':_0xc57590['id'],'OpenchannelQueueId':_0x41e0cc['params']['id']},'transaction':_0x29912d});});})[_0x86d6('0x2b')](function(){_0x41454f[_0x86d6('0x71')](function(_0x14455c){socket[_0x86d6('0x72')](_0x86d6('0x73'),{'UserId':_0x14455c['id'],'OpenchannelQueueId':_0x57ae59['id']});});});});});}})[_0x86d6('0x2b')](respondWithStatusCode(_0x4298d8,null))[_0x86d6('0x4d')](handleError(_0x4298d8,null));};exports[_0x86d6('0x74')]=function(_0x2c34e3,_0x58a936,_0x4dc8b0){return db['Team'][_0x86d6('0x4b')]({'where':{'id':_0x2c34e3[_0x86d6('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x86d6('0x2b')](handleEntityNotFound(_0x58a936,null))[_0x86d6('0x2b')](function(_0x2ed663){var _0x59d78c=_[_0x86d6('0x35')](_0x2ed663,'id');var _0x575b7f=[];var _0x3fd55e=[];var _0x3527d6=squel[_0x86d6('0x75')]();_0x3527d6[_0x86d6('0x76')](_0x86d6('0x77'))[_0x86d6('0x78')]('team_has_openchannel_queues','tq')[_0x86d6('0x79')](_0x86d6('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x86d6('0x43')](_0x86d6('0x7b'),_0x2c34e3[_0x86d6('0x4f')]['id']);for(var _0x527c8c=0x0;_0x527c8c<_0x2ed663[_0x86d6('0x3f')];_0x527c8c+=0x1){let _0x28d549=_0x2ed663[_0x527c8c];for(var _0x59565b=0x0;_0x59565b<_0x28d549['Agents'][_0x86d6('0x3f')];_0x59565b+=0x1){let _0x8b1c97=_0x28d549[_0x86d6('0x6a')][_0x59565b];var _0x2d9023=_0x3527d6[_0x86d6('0x7c')]();_0x2d9023[_0x86d6('0x43')](_0x86d6('0x7d'),_0x8b1c97['id']);_0x3fd55e[_0x86d6('0x7e')](db[_0x86d6('0x6e')][_0x86d6('0x39')](_0x2d9023[_0x86d6('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x86d6('0x80')]})['then'](function(_0x44496d){if(_0x44496d[_0x86d6('0x3f')]===0x1){return _0x8b1c97['id'];}else{var _0x1b6e74=_[_0x86d6('0x81')](_[_0x86d6('0x35')](_0x44496d,'TeamId'),function(_0x38e83b){return _[_0x86d6('0x82')](_0x59d78c,_0x38e83b);});if(_0x1b6e74){return _0x8b1c97['id'];}}}));}}return BPromise[_0x86d6('0x83')](_0x3fd55e)[_0x86d6('0x2b')](function(_0x4d87d2){_0x575b7f=_(_0x575b7f)[_0x86d6('0x84')](_0x4d87d2)[_0x86d6('0x85')]()[_0x86d6('0x86')]();return db[_0x86d6('0x49')][_0x86d6('0x51')]({'where':{'id':_0x2c34e3[_0x86d6('0x4f')]['id']}})['then'](function(_0x37a84c){return db[_0x86d6('0x6e')][_0x86d6('0x6f')](function(_0x1e08a0){return _0x37a84c[_0x86d6('0x74')](_0x2c34e3['query'][_0x86d6('0x87')],{'transaction':_0x1e08a0})[_0x86d6('0x2b')](function(){if(!_[_0x86d6('0x88')](_0x575b7f)){return _0x37a84c[_0x86d6('0x89')](_0x575b7f,{'transaction':_0x1e08a0});}})[_0x86d6('0x2b')](function(){_0x575b7f[_0x86d6('0x71')](function(_0x3e50ae){socket[_0x86d6('0x72')](_0x86d6('0x8a'),{'UserId':_0x3e50ae,'OpenchannelQueueId':_0x37a84c['id']});});});});});});})[_0x86d6('0x2b')](respondWithStatusCode(_0x58a936,null))[_0x86d6('0x4d')](handleError(_0x58a936,null));};exports['addAgents']=function(_0x2f8be3,_0x3082e2,_0x4094e9){return db['OpenchannelQueue']['find']({'where':{'id':_0x2f8be3['params']['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x3082e2,null))['then'](function(_0x18965f){if(_0x18965f){return _0x18965f['addAgents'](_0x2f8be3['body'][_0x86d6('0x87')],_[_0x86d6('0x8b')](_0x2f8be3[_0x86d6('0x53')],[_0x86d6('0x87'),'id'])||{})[_0x86d6('0x8c')](function(_0x1cc816){for(var _0x3efea2=0x0;_0x3efea2<_0x2f8be3['body']['ids'][_0x86d6('0x3f')];_0x3efea2+=0x1){socket[_0x86d6('0x72')](_0x86d6('0x73'),{'UserId':Number(_0x2f8be3[_0x86d6('0x53')][_0x86d6('0x87')][_0x3efea2]),'OpenchannelQueueId':Number(_0x2f8be3[_0x86d6('0x4f')]['id'])});}return _0x1cc816;});}})[_0x86d6('0x2b')](respondWithResult(_0x3082e2,null))[_0x86d6('0x4d')](handleError(_0x3082e2,null));};exports[_0x86d6('0x89')]=function(_0x22348a,_0x1a42fe,_0x4e9770){return db[_0x86d6('0x49')][_0x86d6('0x51')]({'where':{'id':_0x22348a[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x1a42fe,null))[_0x86d6('0x2b')](function(_0x835b3e){if(_0x835b3e){return _0x835b3e['removeAgents'](_0x22348a['query'][_0x86d6('0x87')])['then'](function(){if(_[_0x86d6('0x8d')](_0x22348a[_0x86d6('0x39')][_0x86d6('0x87')])){for(var _0x1efaee=0x0;_0x1efaee<_0x22348a[_0x86d6('0x39')]['ids']['length'];_0x1efaee+=0x1){socket[_0x86d6('0x72')](_0x86d6('0x8a'),{'UserId':Number(_0x22348a['query'][_0x86d6('0x87')][_0x1efaee]),'OpenchannelQueueId':Number(_0x22348a[_0x86d6('0x4f')]['id'])});}}else{socket[_0x86d6('0x72')](_0x86d6('0x8a'),{'UserId':Number(_0x22348a[_0x86d6('0x39')][_0x86d6('0x87')]),'OpenchannelQueueId':Number(_0x22348a['params']['id'])});}});}})[_0x86d6('0x2b')](respondWithStatusCode(_0x1a42fe,null))[_0x86d6('0x4d')](handleError(_0x1a42fe,null));};exports[_0x86d6('0x8e')]=function(_0x8a8367,_0x69b2ff,_0x4bd02b){var _0x9017a4={};var _0xbf63ee={};var _0x2cf82c;var _0x26842d;return db[_0x86d6('0x49')][_0x86d6('0x5b')]({'where':{'id':_0x8a8367[_0x86d6('0x4f')]['id']}})[_0x86d6('0x2b')](handleEntityNotFound(_0x69b2ff,null))[_0x86d6('0x2b')](function(_0x59b430){if(_0x59b430){_0x2cf82c=_0x59b430;_0xbf63ee[_0x86d6('0x38')]=_[_0x86d6('0x3a')](db[_0x86d6('0x60')][_0x86d6('0x36')]);_0xbf63ee[_0x86d6('0x39')]=_['keys'](_0x8a8367[_0x86d6('0x39')]);_0xbf63ee[_0x86d6('0x3b')]=_[_0x86d6('0x3c')](_0xbf63ee[_0x86d6('0x38')],_0xbf63ee[_0x86d6('0x39')]);_0x9017a4[_0x86d6('0x3e')]=_[_0x86d6('0x3c')](_0xbf63ee[_0x86d6('0x38')],qs[_0x86d6('0x3d')](_0x8a8367[_0x86d6('0x39')][_0x86d6('0x3d')]));_0x9017a4[_0x86d6('0x3e')]=_0x9017a4[_0x86d6('0x3e')]['length']?_0x9017a4[_0x86d6('0x3e')]:_0xbf63ee[_0x86d6('0x38')];_0x9017a4['order']=qs[_0x86d6('0x42')](_0x8a8367[_0x86d6('0x39')][_0x86d6('0x42')]);_0x9017a4[_0x86d6('0x43')]=qs['filters'](_['pick'](_0x8a8367[_0x86d6('0x39')],_0xbf63ee[_0x86d6('0x3b')]));if(_0x8a8367[_0x86d6('0x39')][_0x86d6('0x45')]){_0x9017a4[_0x86d6('0x43')]=_['merge'](_0x9017a4[_0x86d6('0x43')],{'$or':_[_0x86d6('0x35')](_0x9017a4['attributes'],function(_0x15f4d3){var _0x2f93dd={};_0x2f93dd[_0x15f4d3]={'$like':'%'+_0x8a8367['query'][_0x86d6('0x45')]+'%'};return _0x2f93dd;})});}_0x9017a4=_[_0x86d6('0x46')]({},_0x9017a4,_0x8a8367[_0x86d6('0x5f')]);return _0x2cf82c[_0x86d6('0x8e')](_0x9017a4);}})[_0x86d6('0x2b')](function(_0x5ce0ee){if(_0x5ce0ee){_0x26842d=_0x5ce0ee['length'];if(!_0x8a8367[_0x86d6('0x39')]['hasOwnProperty']('nolimit')){_0x9017a4[_0x86d6('0x23')]=qs[_0x86d6('0x23')](_0x8a8367[_0x86d6('0x39')]['limit']);_0x9017a4[_0x86d6('0x21')]=qs[_0x86d6('0x21')](_0x8a8367[_0x86d6('0x39')][_0x86d6('0x21')]);}return _0x2cf82c['getAgents'](_0x9017a4);}})[_0x86d6('0x2b')](function(_0x5b8a54){if(_0x5b8a54){return _0x5b8a54?{'count':_0x26842d,'rows':_0x5b8a54}:null;}})['then'](respondWithResult(_0x69b2ff,null))[_0x86d6('0x4d')](handleError(_0x69b2ff,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0a53066..98d1714 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 _0x58af=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','emit'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x58af,0x162));var _0xf58a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x58af[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xf58a('0x0'));var OpenchannelQueue=require(_0xf58a('0x1'))['db'][_0xf58a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf58a('0x3')](0x0);var events={'afterCreate':_0xf58a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31ebef){return function(_0x3891db,_0x528f9f,_0x482ce9){OpenchannelQueueEvents[_0xf58a('0x5')](_0x31ebef+':'+_0x3891db['id'],_0x3891db);OpenchannelQueueEvents[_0xf58a('0x5')](_0x31ebef,_0x3891db);_0x482ce9(null);};}for(var e in events){if(events[_0xf58a('0x6')](e)){var event=events[e];OpenchannelQueue[_0xf58a('0x7')](e,emitEvent(event));}}module[_0xf58a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6865=['save','update','emit','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x6865,0x12d));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x5686('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x5686('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5686('0x2')](0x0);var events={'afterCreate':_0x5686('0x3'),'afterUpdate':_0x5686('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43174c){return function(_0x137763,_0x384e42,_0x55732a){OpenchannelQueueEvents[_0x5686('0x5')](_0x43174c+':'+_0x137763['id'],_0x137763);OpenchannelQueueEvents['emit'](_0x43174c,_0x137763);_0x55732a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x5686('0x6')](e,emitEvent(event));}}module[_0x5686('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1bd3024..7b6d59d 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 _0x194e=['rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1e4fc2,_0x49a029){var _0x51fda0=function(_0x32c991){while(--_0x32c991){_0x1e4fc2['push'](_0x1e4fc2['shift']());}};_0x51fda0(++_0x49a029);}(_0x194e,0x14f));var _0xe194=function(_0x8b3dad,_0x5e5c9a){_0x8b3dad=_0x8b3dad-0x0;var _0x462109=_0x194e[_0x8b3dad];return _0x462109;};'use strict';var _=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var logger=require(_0xe194('0x2'))('api');var moment=require(_0xe194('0x3'));var BPromise=require('bluebird');var rp=require(_0xe194('0x4'));var fs=require('fs');var path=require(_0xe194('0x5'));var rimraf=require(_0xe194('0x6'));var config=require(_0xe194('0x7'));var attributes=require(_0xe194('0x8'));module['exports']=function(_0x1ac97b,_0x11d614){return _0x1ac97b[_0xe194('0x9')](_0xe194('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96fc=['moment','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x18a596,_0x328cda){var _0x4aae62=function(_0x46682b){while(--_0x46682b){_0x18a596['push'](_0x18a596['shift']());}};_0x4aae62(++_0x328cda);}(_0x96fc,0xe6));var _0xc96f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x96fc[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var logger=require(_0xc96f('0x2'))(_0xc96f('0x3'));var moment=require(_0xc96f('0x4'));var BPromise=require(_0xc96f('0x5'));var rp=require(_0xc96f('0x6'));var fs=require('fs');var path=require(_0xc96f('0x7'));var rimraf=require(_0xc96f('0x8'));var config=require('../../config/environment');var attributes=require(_0xc96f('0x9'));module['exports']=function(_0x474ab6,_0x535e4f){return _0x474ab6[_0xc96f('0xa')](_0xc96f('0xb'),attributes,{'tableName':_0xc96f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 89b3bd7..f16956e 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 _0xea60=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','model','include','ShowOpenchannelQueue','OpenchannelQueue','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x277dd2,_0x1cd1ce){var _0x399b6e=function(_0x31c215){while(--_0x31c215){_0x277dd2['push'](_0x277dd2['shift']());}};_0x399b6e(++_0x1cd1ce);}(_0xea60,0x19a));var _0x0ea6=function(_0x6baaf,_0x51e460){_0x6baaf=_0x6baaf-0x0;var _0x2e1351=_0xea60[_0x6baaf];return _0x2e1351;};'use strict';var _=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var moment=require(_0x0ea6('0x2'));var BPromise=require(_0x0ea6('0x3'));var rs=require(_0x0ea6('0x4'));var fs=require('fs');var Redis=require(_0x0ea6('0x5'));var db=require(_0x0ea6('0x6'))['db'];var utils=require(_0x0ea6('0x7'));var logger=require(_0x0ea6('0x8'))(_0x0ea6('0x9'));var config=require(_0x0ea6('0xa'));var jayson=require(_0x0ea6('0xb'));var client=jayson['client'][_0x0ea6('0xc')]({'port':0x232a});config['redis']=_[_0x0ea6('0xd')](config[_0x0ea6('0xe')],{'host':_0x0ea6('0xf'),'port':0x18eb});var socket=require(_0x0ea6('0x10'))(new Redis(config[_0x0ea6('0xe')]));require('./openchannelQueue.socket')[_0x0ea6('0x11')](socket);function respondWithRpcPromise(_0x1ddf3f,_0x2653d1,_0x1860aa){return new BPromise(function(_0x3b3a9c,_0x5195ef){return client[_0x0ea6('0x12')](_0x1ddf3f,_0x1860aa)[_0x0ea6('0x13')](function(_0xd593ae){logger[_0x0ea6('0x14')](_0x0ea6('0x15'),_0x2653d1,_0x0ea6('0x16'));logger[_0x0ea6('0x17')](_0x0ea6('0x18'),_0x2653d1,_0x0ea6('0x16'),JSON[_0x0ea6('0x19')](_0xd593ae));if(_0xd593ae[_0x0ea6('0x1a')]){if(_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1b')]===0x1f4){logger[_0x0ea6('0x1a')](_0x0ea6('0x15'),_0x2653d1,_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1c')]);return _0x5195ef(_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1c')]);}logger[_0x0ea6('0x1a')](_0x0ea6('0x15'),_0x2653d1,_0xd593ae[_0x0ea6('0x1a')]['message']);return _0x3b3a9c(_0xd593ae[_0x0ea6('0x1a')][_0x0ea6('0x1c')]);}else{logger[_0x0ea6('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x2653d1,_0x0ea6('0x16'));_0x3b3a9c(_0xd593ae[_0x0ea6('0x1d')][_0x0ea6('0x1c')]);}})[_0x0ea6('0x1e')](function(_0x244afd){logger[_0x0ea6('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x2653d1,_0x244afd);_0x5195ef(_0x244afd);});});}exports[_0x0ea6('0x1f')]=function(_0x489ff0){var _0x5e8dc8=this;return new Promise(function(_0x3486ce,_0x55d3c9){return db['OpenchannelQueue'][_0x0ea6('0x20')]({'raw':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0[_0x0ea6('0x21')][_0x0ea6('0x22')]===undefined?!![]:![]:!![],'where':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0[_0x0ea6('0x21')][_0x0ea6('0x23')]||null:null,'attributes':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0['options'][_0x0ea6('0x24')]||null:null,'limit':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0['options']['limit']||null:null,'include':_0x489ff0[_0x0ea6('0x21')]?_0x489ff0['options']['include']?_['map'](_0x489ff0[_0x0ea6('0x21')]['include'],function(_0x18d52f){return{'model':db[_0x18d52f[_0x0ea6('0x25')]],'as':_0x18d52f['as'],'attributes':_0x18d52f[_0x0ea6('0x24')],'include':_0x18d52f[_0x0ea6('0x26')]?_['map'](_0x18d52f[_0x0ea6('0x26')],function(_0x26b61f){return{'model':db[_0x26b61f[_0x0ea6('0x25')]],'as':_0x26b61f['as'],'attributes':_0x26b61f[_0x0ea6('0x24')],'include':_0x26b61f[_0x0ea6('0x26')]?_['map'](_0x26b61f[_0x0ea6('0x26')],function(_0x5ea7f7){return{'model':db[_0x5ea7f7['model']],'as':_0x5ea7f7['as'],'attributes':_0x5ea7f7[_0x0ea6('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0ea6('0x13')](function(_0x4d21a1){logger[_0x0ea6('0x14')](_0x0ea6('0x1f'),_0x489ff0);logger[_0x0ea6('0x17')]('GetOpenchannelQueue',_0x489ff0,JSON['stringify'](_0x4d21a1));_0x3486ce(_0x4d21a1);})[_0x0ea6('0x1e')](function(_0x2334c2){logger[_0x0ea6('0x1a')](_0x0ea6('0x1f'),_0x2334c2[_0x0ea6('0x1c')],_0x489ff0);_0x55d3c9(_0x5e8dc8[_0x0ea6('0x1a')](0x1f4,_0x2334c2[_0x0ea6('0x1c')]));});});};exports[_0x0ea6('0x27')]=function(_0x24daa3){var _0x435619=this;return new Promise(function(_0x2ad07d,_0xb60eff){return db[_0x0ea6('0x28')][_0x0ea6('0x29')]({'raw':_0x24daa3[_0x0ea6('0x21')]?_0x24daa3['options']['raw']===undefined?!![]:![]:!![],'where':_0x24daa3['options']?_0x24daa3[_0x0ea6('0x21')][_0x0ea6('0x23')]||null:null,'attributes':_0x24daa3[_0x0ea6('0x21')]?_0x24daa3['options'][_0x0ea6('0x24')]||null:null,'include':_0x24daa3[_0x0ea6('0x21')]?_0x24daa3[_0x0ea6('0x21')][_0x0ea6('0x26')]?_[_0x0ea6('0x2a')](_0x24daa3[_0x0ea6('0x21')][_0x0ea6('0x26')],function(_0x449b7f){return{'model':db[_0x449b7f[_0x0ea6('0x25')]],'as':_0x449b7f['as'],'attributes':_0x449b7f[_0x0ea6('0x24')],'include':_0x449b7f[_0x0ea6('0x26')]?_['map'](_0x449b7f[_0x0ea6('0x26')],function(_0x6ee387){return{'model':db[_0x6ee387[_0x0ea6('0x25')]],'as':_0x6ee387['as'],'attributes':_0x6ee387[_0x0ea6('0x24')],'include':_0x6ee387[_0x0ea6('0x26')]?_[_0x0ea6('0x2a')](_0x6ee387[_0x0ea6('0x26')],function(_0xad7738){return{'model':db[_0xad7738['model']],'as':_0xad7738['as'],'attributes':_0xad7738[_0x0ea6('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0ea6('0x13')](function(_0x1224c1){logger[_0x0ea6('0x14')](_0x0ea6('0x27'),_0x24daa3);logger[_0x0ea6('0x17')](_0x0ea6('0x27'),_0x24daa3,JSON[_0x0ea6('0x19')](_0x1224c1));_0x2ad07d(_0x1224c1);})[_0x0ea6('0x1e')](function(_0x5e63f1){logger['error'](_0x0ea6('0x27'),_0x5e63f1[_0x0ea6('0x1c')],_0x24daa3);_0xb60eff(_0x435619['error'](0x1f4,_0x5e63f1[_0x0ea6('0x1c')]));});});}; \ No newline at end of file +var _0x48b4=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','limit','include','map','model','attributes','stringify','find','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x2cef32,_0x430908){var _0x1cfbc5=function(_0x351a94){while(--_0x351a94){_0x2cef32['push'](_0x2cef32['shift']());}};_0x1cfbc5(++_0x430908);}(_0x48b4,0x104));var _0x448b=function(_0x32cf98,_0x26791e){_0x32cf98=_0x32cf98-0x0;var _0x361540=_0x48b4[_0x32cf98];return _0x361540;};'use strict';var _=require(_0x448b('0x0'));var util=require('util');var moment=require(_0x448b('0x1'));var BPromise=require(_0x448b('0x2'));var rs=require(_0x448b('0x3'));var fs=require('fs');var Redis=require(_0x448b('0x4'));var db=require(_0x448b('0x5'))['db'];var utils=require(_0x448b('0x6'));var logger=require(_0x448b('0x7'))(_0x448b('0x8'));var config=require(_0x448b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x448b('0xa')][_0x448b('0xb')]({'port':0x232a});config[_0x448b('0xc')]=_[_0x448b('0xd')](config[_0x448b('0xc')],{'host':_0x448b('0xe'),'port':0x18eb});var socket=require(_0x448b('0xf'))(new Redis(config[_0x448b('0xc')]));require(_0x448b('0x10'))['register'](socket);function respondWithRpcPromise(_0x127ddd,_0x4908e4,_0x3b0291){return new BPromise(function(_0x1f14f7,_0x8140a){return client['request'](_0x127ddd,_0x3b0291)[_0x448b('0x11')](function(_0x42e8c5){logger[_0x448b('0x12')](_0x448b('0x13'),_0x4908e4,_0x448b('0x14'));logger[_0x448b('0x15')](_0x448b('0x16'),_0x4908e4,_0x448b('0x14'),JSON['stringify'](_0x42e8c5));if(_0x42e8c5['error']){if(_0x42e8c5[_0x448b('0x17')][_0x448b('0x18')]===0x1f4){logger[_0x448b('0x17')](_0x448b('0x13'),_0x4908e4,_0x42e8c5[_0x448b('0x17')][_0x448b('0x19')]);return _0x8140a(_0x42e8c5[_0x448b('0x17')][_0x448b('0x19')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4908e4,_0x42e8c5[_0x448b('0x17')][_0x448b('0x19')]);return _0x1f14f7(_0x42e8c5[_0x448b('0x17')]['message']);}else{logger[_0x448b('0x12')](_0x448b('0x13'),_0x4908e4,_0x448b('0x14'));_0x1f14f7(_0x42e8c5[_0x448b('0x1a')][_0x448b('0x19')]);}})['catch'](function(_0x20910e){logger[_0x448b('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4908e4,_0x20910e);_0x8140a(_0x20910e);});});}exports[_0x448b('0x1b')]=function(_0x14d72e){var _0x269d0c=this;return new Promise(function(_0x327f71,_0x1db0a7){return db[_0x448b('0x1c')]['findAll']({'raw':_0x14d72e[_0x448b('0x1d')]?_0x14d72e[_0x448b('0x1d')][_0x448b('0x1e')]===undefined?!![]:![]:!![],'where':_0x14d72e[_0x448b('0x1d')]?_0x14d72e[_0x448b('0x1d')][_0x448b('0x1f')]||null:null,'attributes':_0x14d72e[_0x448b('0x1d')]?_0x14d72e[_0x448b('0x1d')]['attributes']||null:null,'limit':_0x14d72e[_0x448b('0x1d')]?_0x14d72e[_0x448b('0x1d')][_0x448b('0x20')]||null:null,'include':_0x14d72e[_0x448b('0x1d')]?_0x14d72e['options'][_0x448b('0x21')]?_[_0x448b('0x22')](_0x14d72e[_0x448b('0x1d')]['include'],function(_0x465606){return{'model':db[_0x465606[_0x448b('0x23')]],'as':_0x465606['as'],'attributes':_0x465606[_0x448b('0x24')],'include':_0x465606['include']?_[_0x448b('0x22')](_0x465606[_0x448b('0x21')],function(_0x2059dd){return{'model':db[_0x2059dd[_0x448b('0x23')]],'as':_0x2059dd['as'],'attributes':_0x2059dd[_0x448b('0x24')],'include':_0x2059dd[_0x448b('0x21')]?_[_0x448b('0x22')](_0x2059dd[_0x448b('0x21')],function(_0x128e3f){return{'model':db[_0x128e3f[_0x448b('0x23')]],'as':_0x128e3f['as'],'attributes':_0x128e3f[_0x448b('0x24')]};}):[]};}):[]};}):[]:[]})[_0x448b('0x11')](function(_0x3000b5){logger[_0x448b('0x12')](_0x448b('0x1b'),_0x14d72e);logger[_0x448b('0x15')](_0x448b('0x1b'),_0x14d72e,JSON[_0x448b('0x25')](_0x3000b5));_0x327f71(_0x3000b5);})['catch'](function(_0xbf3229){logger[_0x448b('0x17')](_0x448b('0x1b'),_0xbf3229['message'],_0x14d72e);_0x1db0a7(_0x269d0c[_0x448b('0x17')](0x1f4,_0xbf3229[_0x448b('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x43a67d){var _0x3677ca=this;return new Promise(function(_0x427fb9,_0x460ad0){return db[_0x448b('0x1c')][_0x448b('0x26')]({'raw':_0x43a67d[_0x448b('0x1d')]?_0x43a67d[_0x448b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x43a67d[_0x448b('0x1d')]?_0x43a67d['options'][_0x448b('0x1f')]||null:null,'attributes':_0x43a67d['options']?_0x43a67d[_0x448b('0x1d')][_0x448b('0x24')]||null:null,'include':_0x43a67d['options']?_0x43a67d[_0x448b('0x1d')][_0x448b('0x21')]?_[_0x448b('0x22')](_0x43a67d[_0x448b('0x1d')]['include'],function(_0x251845){return{'model':db[_0x251845[_0x448b('0x23')]],'as':_0x251845['as'],'attributes':_0x251845[_0x448b('0x24')],'include':_0x251845['include']?_['map'](_0x251845[_0x448b('0x21')],function(_0x29c16d){return{'model':db[_0x29c16d[_0x448b('0x23')]],'as':_0x29c16d['as'],'attributes':_0x29c16d[_0x448b('0x24')],'include':_0x29c16d[_0x448b('0x21')]?_[_0x448b('0x22')](_0x29c16d['include'],function(_0x2610d7){return{'model':db[_0x2610d7['model']],'as':_0x2610d7['as'],'attributes':_0x2610d7[_0x448b('0x24')]};}):[]};}):[]};}):[]:[]})[_0x448b('0x11')](function(_0x464388){logger[_0x448b('0x12')]('ShowOpenchannelQueue',_0x43a67d);logger[_0x448b('0x15')]('ShowOpenchannelQueue',_0x43a67d,JSON['stringify'](_0x464388));_0x427fb9(_0x464388);})['catch'](function(_0x2ecd44){logger['error'](_0x448b('0x27'),_0x2ecd44[_0x448b('0x19')],_0x43a67d);_0x460ad0(_0x3677ca[_0x448b('0x17')](0x1f4,_0x2ecd44[_0x448b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 466512e..25d4588 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 _0x220d=['removeListener','length','./openchannelQueue.events','save','emit'];(function(_0x5ad67c,_0x144860){var _0xccce2e=function(_0x2dd95c){while(--_0x2dd95c){_0x5ad67c['push'](_0x5ad67c['shift']());}};_0xccce2e(++_0x144860);}(_0x220d,0xe3));var _0xd220=function(_0x5d6b75,_0x48aa6f){_0x5d6b75=_0x5d6b75-0x0;var _0x1db122=_0x220d[_0x5d6b75];return _0x1db122;};'use strict';var OpenchannelQueueEvents=require(_0xd220('0x0'));var events=[_0xd220('0x1'),'remove','update'];function createListener(_0x295f17,_0x71b44a){return function(_0x2c3490){_0x71b44a[_0xd220('0x2')](_0x295f17,_0x2c3490);};}function removeListener(_0x2f96dc,_0x1b65aa){return function(){OpenchannelQueueEvents[_0xd220('0x3')](_0x2f96dc,_0x1b65aa);};}exports['register']=function(_0x1a51b2){for(var _0x53b411=0x0,_0x5bd0d4=events[_0xd220('0x4')];_0x53b411<_0x5bd0d4;_0x53b411++){var _0x2c30c5=events[_0x53b411];var _0x33319f=createListener('openchannelQueue:'+_0x2c30c5,_0x1a51b2);OpenchannelQueueEvents['on'](_0x2c30c5,_0x33319f);}}; \ No newline at end of file +var _0xddb4=['update','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xddb4,0x162));var _0x4ddb=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xddb4[_0x3cec8c];return _0x38032e;};'use strict';var OpenchannelQueueEvents=require(_0x4ddb('0x0'));var events=[_0x4ddb('0x1'),_0x4ddb('0x2'),_0x4ddb('0x3')];function createListener(_0x12177c,_0x15a2cc){return function(_0x31487f){_0x15a2cc['emit'](_0x12177c,_0x31487f);};}function removeListener(_0x4ee0fd,_0x36b7c3){return function(){OpenchannelQueueEvents[_0x4ddb('0x4')](_0x4ee0fd,_0x36b7c3);};}exports['register']=function(_0x53a1db){for(var _0x4b47f1=0x0,_0x320e9e=events[_0x4ddb('0x5')];_0x4b47f1<_0x320e9e;_0x4b47f1++){var _0x33ffa5=events[_0x4b47f1];var _0x4b756e=createListener(_0x4ddb('0x6')+_0x33ffa5,_0x53a1db);OpenchannelQueueEvents['on'](_0x33ffa5,_0x4b756e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a7f8d88..43c2806 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 _0xba11=['get','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xba11,0xfb));var _0x1ba1=function(_0x4648e2,_0x38b3a2){_0x4648e2=_0x4648e2-0x0;var _0x4e6005=_0xba11[_0x4648e2];return _0x4e6005;};'use strict';var multer=require('multer');var util=require(_0x1ba1('0x0'));var path=require(_0x1ba1('0x1'));var timeout=require(_0x1ba1('0x2'));var express=require(_0x1ba1('0x3'));var router=express['Router']();var fs_extra=require(_0x1ba1('0x4'));var auth=require(_0x1ba1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ba1('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0x8')]);router[_0x1ba1('0x9')]('/describe',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0xa')]);router[_0x1ba1('0x9')]('/:id',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0xb')]);router[_0x1ba1('0xc')]('/',auth[_0x1ba1('0x7')](),controller[_0x1ba1('0xd')]);router[_0x1ba1('0xe')](_0x1ba1('0xf'),auth[_0x1ba1('0x7')](),controller[_0x1ba1('0x10')]);router[_0x1ba1('0x11')](_0x1ba1('0xf'),auth[_0x1ba1('0x7')](),controller[_0x1ba1('0x12')]);module[_0x1ba1('0x13')]=router; \ No newline at end of file +var _0xfe28=['./openchannelQueueReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','util','express','fs-extra','../../config/environment'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xfe28,0x176));var _0x8fe2=function(_0x2b9e27,_0xfaa871){_0x2b9e27=_0x2b9e27-0x0;var _0x3f6ba1=_0xfe28[_0x2b9e27];return _0x3f6ba1;};'use strict';var multer=require('multer');var util=require(_0x8fe2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8fe2('0x1'));var router=express['Router']();var fs_extra=require(_0x8fe2('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8fe2('0x3'));var controller=require(_0x8fe2('0x4'));router[_0x8fe2('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8fe2('0x5')](_0x8fe2('0x6'),auth[_0x8fe2('0x7')](),controller['describe']);router['get'](_0x8fe2('0x8'),auth[_0x8fe2('0x7')](),controller[_0x8fe2('0x9')]);router[_0x8fe2('0xa')]('/',auth[_0x8fe2('0x7')](),controller[_0x8fe2('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8fe2('0xc')]);router[_0x8fe2('0xd')](_0x8fe2('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5409220..04b0ff9 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 _0xad05=['moment','sequelize','exports','STRING','DATE'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xad05,0x96));var _0x5ad0=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0xad05[_0x44474f];return _0x427d97;};'use strict';var moment=require(_0x5ad0('0x0'));var Sequelize=require(_0x5ad0('0x1'));module[_0x5ad0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5ad0('0x3')]},'joinAt':{'type':Sequelize[_0x5ad0('0x4')]},'leaveAt':{'type':Sequelize[_0x5ad0('0x4')]},'acceptAt':{'type':Sequelize[_0x5ad0('0x4')]},'exitAt':{'type':Sequelize[_0x5ad0('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb65d=['STRING','DATE','sequelize','exports'];(function(_0x2c3ea8,_0x4854a9){var _0xbb8cc2=function(_0x3d5f31){while(--_0x3d5f31){_0x2c3ea8['push'](_0x2c3ea8['shift']());}};_0xbb8cc2(++_0x4854a9);}(_0xb65d,0x7e));var _0xdb65=function(_0x47daf5,_0x2131c6){_0x47daf5=_0x47daf5-0x0;var _0x8cf4bb=_0xb65d[_0x47daf5];return _0x8cf4bb;};'use strict';var moment=require('moment');var Sequelize=require(_0xdb65('0x0'));module[_0xdb65('0x1')]={'uniqueid':{'type':Sequelize[_0xdb65('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdb65('0x2')]},'joinAt':{'type':Sequelize[_0xdb65('0x3')]},'leaveAt':{'type':Sequelize[_0xdb65('0x3')]},'acceptAt':{'type':Sequelize[_0xdb65('0x3')]},'exitAt':{'type':Sequelize[_0xdb65('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index e762f7c..10c29ac 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 _0x1832=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','catch','show','params','includeAll','options','find','create','body','update','describe','eml-format','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x493a3c,_0x424b3f){var _0x3343b4=function(_0x1228fe){while(--_0x1228fe){_0x493a3c['push'](_0x493a3c['shift']());}};_0x3343b4(++_0x424b3f);}(_0x1832,0xcd));var _0x2183=function(_0x10e147,_0x401dc5){_0x10e147=_0x10e147-0x0;var _0x3c95aa=_0x1832[_0x10e147];return _0x3c95aa;};'use strict';var emlformat=require(_0x2183('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2183('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2183('0x2'));var BPromise=require(_0x2183('0x3'));var Mustache=require(_0x2183('0x4'));var util=require(_0x2183('0x5'));var path=require(_0x2183('0x6'));var sox=require(_0x2183('0x7'));var csv=require(_0x2183('0x8'));var ejs=require(_0x2183('0x9'));var fs=require('fs');var fs_extra=require(_0x2183('0xa'));var _=require(_0x2183('0xb'));var squel=require(_0x2183('0xc'));var crypto=require(_0x2183('0xd'));var jsforce=require(_0x2183('0xe'));var deskjs=require(_0x2183('0xf'));var toCsv=require(_0x2183('0x8'));var querystring=require(_0x2183('0x10'));var Papa=require('papaparse');var Redis=require(_0x2183('0x11'));var authService=require(_0x2183('0x12'));var qs=require(_0x2183('0x13'));var as=require(_0x2183('0x14'));var hardwareService=require(_0x2183('0x15'));var logger=require(_0x2183('0x16'))(_0x2183('0x17'));var utils=require(_0x2183('0x18'));var config=require(_0x2183('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2183('0x1a'))['db'];function respondWithStatusCode(_0x2e62e6,_0x26a248){_0x26a248=_0x26a248||0xcc;return function(_0x50bedc){if(_0x50bedc){return _0x2e62e6[_0x2183('0x1b')](_0x26a248);}return _0x2e62e6[_0x2183('0x1c')](_0x26a248)[_0x2183('0x1d')]();};}function respondWithResult(_0x15babb,_0x217ee8){_0x217ee8=_0x217ee8||0xc8;return function(_0x202c1a){if(_0x202c1a){return _0x15babb[_0x2183('0x1c')](_0x217ee8)[_0x2183('0x1e')](_0x202c1a);}};}function respondWithFilteredResult(_0x3e9b83,_0x2d5abd){return function(_0x3d4722){if(_0x3d4722){var _0x3e5982=typeof _0x2d5abd[_0x2183('0x1f')]===_0x2183('0x20')&&typeof _0x2d5abd[_0x2183('0x21')]==='undefined';var _0x50bf32=_0x3d4722['count'];var _0x4407da=_0x3e5982?0x0:_0x2d5abd[_0x2183('0x1f')];var _0x3657fd=_0x3e5982?_0x3d4722[_0x2183('0x22')]:_0x2d5abd[_0x2183('0x1f')]+_0x2d5abd['limit'];var _0x3196f0;if(_0x3657fd>=_0x50bf32){_0x3657fd=_0x50bf32;_0x3196f0=0xc8;}else{_0x3196f0=0xce;}_0x3e9b83[_0x2183('0x1c')](_0x3196f0);return _0x3e9b83[_0x2183('0x23')](_0x2183('0x24'),_0x4407da+'-'+_0x3657fd+'/'+_0x50bf32)[_0x2183('0x1e')](_0x3d4722);}return null;};}function patchUpdates(_0x5723a2){return function(_0x11b7c5){try{jsonpatch['apply'](_0x11b7c5,_0x5723a2,!![]);}catch(_0x1a91a7){return BPromise[_0x2183('0x25')](_0x1a91a7);}return _0x11b7c5[_0x2183('0x26')]();};}function saveUpdates(_0xc32c4f,_0x56a9c2){return function(_0x5440f1){if(_0x5440f1){return _0x5440f1['update'](_0xc32c4f)[_0x2183('0x27')](function(_0x109637){return _0x109637;});}return null;};}function removeEntity(_0x3ed5c3,_0x148dc0){return function(_0x28aa6f){if(_0x28aa6f){return _0x28aa6f[_0x2183('0x28')]()['then'](function(){_0x3ed5c3[_0x2183('0x1c')](0xcc)[_0x2183('0x1d')]();});}};}function handleEntityNotFound(_0x3eab08,_0x4a1b52){return function(_0x2b30c4){if(!_0x2b30c4){_0x3eab08[_0x2183('0x1b')](0x194);}return _0x2b30c4;};}function handleError(_0x58f2a7,_0x1b5fe2){_0x1b5fe2=_0x1b5fe2||0x1f4;return function(_0x58f50e){logger[_0x2183('0x29')](_0x58f50e['stack']);if(_0x58f50e[_0x2183('0x2a')]){delete _0x58f50e[_0x2183('0x2a')];}_0x58f2a7[_0x2183('0x1c')](_0x1b5fe2)['send'](_0x58f50e);};}exports['index']=function(_0x54c745,_0x582540){var _0x46e6b9={},_0x29ac2a={},_0x1f174a={'count':0x0,'rows':[]};var _0x389807=_[_0x2183('0x2b')](db[_0x2183('0x2c')][_0x2183('0x2d')],function(_0x37d733){return{'name':_0x37d733[_0x2183('0x2e')],'type':_0x37d733[_0x2183('0x2f')][_0x2183('0x30')]};});_0x29ac2a[_0x2183('0x31')]=_[_0x2183('0x2b')](_0x389807,'name');_0x29ac2a['query']=_[_0x2183('0x32')](_0x54c745[_0x2183('0x33')]);_0x29ac2a[_0x2183('0x34')]=_[_0x2183('0x35')](_0x29ac2a['model'],_0x29ac2a['query']);_0x46e6b9[_0x2183('0x36')]=_[_0x2183('0x35')](_0x29ac2a[_0x2183('0x31')],qs[_0x2183('0x37')](_0x54c745['query'][_0x2183('0x37')]));_0x46e6b9['attributes']=_0x46e6b9[_0x2183('0x36')][_0x2183('0x38')]?_0x46e6b9['attributes']:_0x29ac2a[_0x2183('0x31')];if(!_0x54c745[_0x2183('0x33')][_0x2183('0x39')](_0x2183('0x3a'))){_0x46e6b9[_0x2183('0x21')]=qs[_0x2183('0x21')](_0x54c745[_0x2183('0x33')][_0x2183('0x21')]);_0x46e6b9[_0x2183('0x1f')]=qs[_0x2183('0x1f')](_0x54c745[_0x2183('0x33')][_0x2183('0x1f')]);}_0x46e6b9[_0x2183('0x3b')]=qs[_0x2183('0x3c')](_0x54c745[_0x2183('0x33')]['sort']);_0x46e6b9[_0x2183('0x3d')]=qs[_0x2183('0x34')](_[_0x2183('0x3e')](_0x54c745[_0x2183('0x33')],_0x29ac2a[_0x2183('0x34')]),_0x389807);if(_0x54c745[_0x2183('0x33')]['filter']){_0x46e6b9['where']=_[_0x2183('0x3f')](_0x46e6b9[_0x2183('0x3d')],{'$or':_['map'](_0x389807,function(_0x1728c8){if(_0x1728c8['type']!==_0x2183('0x40')){var _0x4d1dbd={};_0x4d1dbd[_0x1728c8[_0x2183('0x2a')]]={'$like':'%'+_0x54c745[_0x2183('0x33')][_0x2183('0x41')]+'%'};return _0x4d1dbd;}})});}_0x46e6b9=_[_0x2183('0x3f')]({},_0x46e6b9,_0x54c745['options']);var _0x37bd22={'where':_0x46e6b9[_0x2183('0x3d')]};return db['OpenchannelQueueReport']['count'](_0x37bd22)['then'](function(_0x4d4b3d){_0x1f174a['count']=_0x4d4b3d;if(_0x54c745[_0x2183('0x33')]['includeAll']){_0x46e6b9[_0x2183('0x42')]=[{'all':!![]}];}return db[_0x2183('0x2c')]['findAll'](_0x46e6b9);})[_0x2183('0x27')](function(_0x3b885b){_0x1f174a['rows']=_0x3b885b;return _0x1f174a;})[_0x2183('0x27')](respondWithFilteredResult(_0x582540,_0x46e6b9))[_0x2183('0x43')](handleError(_0x582540,null));};exports[_0x2183('0x44')]=function(_0x991eef,_0x32ee2a){var _0xb5587b={'raw':!![],'where':{'id':_0x991eef[_0x2183('0x45')]['id']}},_0x8e03bc={};_0x8e03bc[_0x2183('0x31')]=_[_0x2183('0x32')](db[_0x2183('0x2c')][_0x2183('0x2d')]);_0x8e03bc[_0x2183('0x33')]=_[_0x2183('0x32')](_0x991eef[_0x2183('0x33')]);_0x8e03bc[_0x2183('0x34')]=_['intersection'](_0x8e03bc[_0x2183('0x31')],_0x8e03bc[_0x2183('0x33')]);_0xb5587b[_0x2183('0x36')]=_['intersection'](_0x8e03bc['model'],qs[_0x2183('0x37')](_0x991eef[_0x2183('0x33')][_0x2183('0x37')]));_0xb5587b['attributes']=_0xb5587b[_0x2183('0x36')][_0x2183('0x38')]?_0xb5587b[_0x2183('0x36')]:_0x8e03bc['model'];if(_0x991eef[_0x2183('0x33')][_0x2183('0x46')]){_0xb5587b[_0x2183('0x42')]=[{'all':!![]}];}_0xb5587b=_[_0x2183('0x3f')]({},_0xb5587b,_0x991eef[_0x2183('0x47')]);return db['OpenchannelQueueReport'][_0x2183('0x48')](_0xb5587b)[_0x2183('0x27')](handleEntityNotFound(_0x32ee2a,null))['then'](respondWithResult(_0x32ee2a,null))[_0x2183('0x43')](handleError(_0x32ee2a,null));};exports[_0x2183('0x49')]=function(_0x5e424b,_0x4ca785){return db[_0x2183('0x2c')][_0x2183('0x49')](_0x5e424b[_0x2183('0x4a')],{})[_0x2183('0x27')](respondWithResult(_0x4ca785,0xc9))[_0x2183('0x43')](handleError(_0x4ca785,null));};exports[_0x2183('0x4b')]=function(_0x3fb16f,_0xf71730){if(_0x3fb16f['body']['id']){delete _0x3fb16f['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3fb16f[_0x2183('0x45')]['id']}})[_0x2183('0x27')](handleEntityNotFound(_0xf71730,null))[_0x2183('0x27')](saveUpdates(_0x3fb16f[_0x2183('0x4a')],null))['then'](respondWithResult(_0xf71730,null))[_0x2183('0x43')](handleError(_0xf71730,null));};exports[_0x2183('0x28')]=function(_0x10ff3b,_0x30662b){return db[_0x2183('0x2c')][_0x2183('0x48')]({'where':{'id':_0x10ff3b[_0x2183('0x45')]['id']}})[_0x2183('0x27')](handleEntityNotFound(_0x30662b,null))[_0x2183('0x27')](removeEntity(_0x30662b,null))[_0x2183('0x43')](handleError(_0x30662b,null));};exports[_0x2183('0x4c')]=function(_0x1d082c,_0x424eff){return db[_0x2183('0x2c')]['describe']()['then'](respondWithResult(_0x424eff,null))[_0x2183('0x43')](handleError(_0x424eff,null));}; \ No newline at end of file +var _0x30da=['pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x8dd419,_0x58acff){var _0x4fadf8=function(_0x47a697){while(--_0x47a697){_0x8dd419['push'](_0x8dd419['shift']());}};_0x4fadf8(++_0x58acff);}(_0x30da,0x191));var _0xa30d=function(_0xbe049f,_0x1e6870){_0xbe049f=_0xbe049f-0x0;var _0x561514=_0x30da[_0xbe049f];return _0x561514;};'use strict';var emlformat=require(_0xa30d('0x0'));var rimraf=require(_0xa30d('0x1'));var zipdir=require(_0xa30d('0x2'));var jsonpatch=require(_0xa30d('0x3'));var rp=require(_0xa30d('0x4'));var moment=require(_0xa30d('0x5'));var BPromise=require(_0xa30d('0x6'));var Mustache=require('mustache');var util=require(_0xa30d('0x7'));var path=require(_0xa30d('0x8'));var sox=require(_0xa30d('0x9'));var csv=require(_0xa30d('0xa'));var ejs=require(_0xa30d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa30d('0xc'));var squel=require(_0xa30d('0xd'));var crypto=require(_0xa30d('0xe'));var jsforce=require(_0xa30d('0xf'));var deskjs=require(_0xa30d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa30d('0x11'));var Papa=require(_0xa30d('0x12'));var Redis=require(_0xa30d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa30d('0x14'));var as=require(_0xa30d('0x15'));var hardwareService=require(_0xa30d('0x16'));var logger=require(_0xa30d('0x17'))(_0xa30d('0x18'));var utils=require(_0xa30d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa30d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f061d,_0x3b49c2){_0x3b49c2=_0x3b49c2||0xcc;return function(_0x3bac9f){if(_0x3bac9f){return _0x1f061d[_0xa30d('0x1b')](_0x3b49c2);}return _0x1f061d[_0xa30d('0x1c')](_0x3b49c2)['end']();};}function respondWithResult(_0x320be1,_0x40c4ae){_0x40c4ae=_0x40c4ae||0xc8;return function(_0x5bac0f){if(_0x5bac0f){return _0x320be1[_0xa30d('0x1c')](_0x40c4ae)[_0xa30d('0x1d')](_0x5bac0f);}};}function respondWithFilteredResult(_0x1d719e,_0x449e79){return function(_0x409068){if(_0x409068){var _0x4c349a=typeof _0x449e79[_0xa30d('0x1e')]==='undefined'&&typeof _0x449e79['limit']===_0xa30d('0x1f');var _0x91b773=_0x409068[_0xa30d('0x20')];var _0x11b058=_0x4c349a?0x0:_0x449e79[_0xa30d('0x1e')];var _0x3b7611=_0x4c349a?_0x409068[_0xa30d('0x20')]:_0x449e79['offset']+_0x449e79[_0xa30d('0x21')];var _0x10aa75;if(_0x3b7611>=_0x91b773){_0x3b7611=_0x91b773;_0x10aa75=0xc8;}else{_0x10aa75=0xce;}_0x1d719e['status'](_0x10aa75);return _0x1d719e[_0xa30d('0x22')](_0xa30d('0x23'),_0x11b058+'-'+_0x3b7611+'/'+_0x91b773)[_0xa30d('0x1d')](_0x409068);}return null;};}function patchUpdates(_0x44b905){return function(_0x4fca48){try{jsonpatch['apply'](_0x4fca48,_0x44b905,!![]);}catch(_0x3fd4ca){return BPromise[_0xa30d('0x24')](_0x3fd4ca);}return _0x4fca48[_0xa30d('0x25')]();};}function saveUpdates(_0x24f887,_0x13f623){return function(_0x5f2972){if(_0x5f2972){return _0x5f2972['update'](_0x24f887)[_0xa30d('0x26')](function(_0x1b0dbc){return _0x1b0dbc;});}return null;};}function removeEntity(_0x27a2dd,_0x1761dc){return function(_0x21ed21){if(_0x21ed21){return _0x21ed21[_0xa30d('0x27')]()[_0xa30d('0x26')](function(){_0x27a2dd[_0xa30d('0x1c')](0xcc)[_0xa30d('0x28')]();});}};}function handleEntityNotFound(_0x139c2d,_0x55a174){return function(_0x4ef71c){if(!_0x4ef71c){_0x139c2d[_0xa30d('0x1b')](0x194);}return _0x4ef71c;};}function handleError(_0x33541b,_0x44e6e3){_0x44e6e3=_0x44e6e3||0x1f4;return function(_0x5021be){logger[_0xa30d('0x29')](_0x5021be[_0xa30d('0x2a')]);if(_0x5021be[_0xa30d('0x2b')]){delete _0x5021be['name'];}_0x33541b[_0xa30d('0x1c')](_0x44e6e3)[_0xa30d('0x2c')](_0x5021be);};}exports[_0xa30d('0x2d')]=function(_0x997980,_0x14a921){var _0x41575e={},_0x22f986={},_0x1a5a4a={'count':0x0,'rows':[]};var _0x24680e=_[_0xa30d('0x2e')](db[_0xa30d('0x2f')][_0xa30d('0x30')],function(_0xfb715e){return{'name':_0xfb715e['fieldName'],'type':_0xfb715e['type']['key']};});_0x22f986[_0xa30d('0x31')]=_[_0xa30d('0x2e')](_0x24680e,'name');_0x22f986[_0xa30d('0x32')]=_[_0xa30d('0x33')](_0x997980[_0xa30d('0x32')]);_0x22f986[_0xa30d('0x34')]=_[_0xa30d('0x35')](_0x22f986[_0xa30d('0x31')],_0x22f986[_0xa30d('0x32')]);_0x41575e[_0xa30d('0x36')]=_['intersection'](_0x22f986['model'],qs[_0xa30d('0x37')](_0x997980['query'][_0xa30d('0x37')]));_0x41575e[_0xa30d('0x36')]=_0x41575e[_0xa30d('0x36')]['length']?_0x41575e[_0xa30d('0x36')]:_0x22f986[_0xa30d('0x31')];if(!_0x997980[_0xa30d('0x32')][_0xa30d('0x38')](_0xa30d('0x39'))){_0x41575e[_0xa30d('0x21')]=qs[_0xa30d('0x21')](_0x997980[_0xa30d('0x32')][_0xa30d('0x21')]);_0x41575e[_0xa30d('0x1e')]=qs[_0xa30d('0x1e')](_0x997980[_0xa30d('0x32')][_0xa30d('0x1e')]);}_0x41575e[_0xa30d('0x3a')]=qs['sort'](_0x997980[_0xa30d('0x32')][_0xa30d('0x3b')]);_0x41575e[_0xa30d('0x3c')]=qs[_0xa30d('0x34')](_[_0xa30d('0x3d')](_0x997980[_0xa30d('0x32')],_0x22f986[_0xa30d('0x34')]),_0x24680e);if(_0x997980[_0xa30d('0x32')][_0xa30d('0x3e')]){_0x41575e[_0xa30d('0x3c')]=_[_0xa30d('0x3f')](_0x41575e['where'],{'$or':_[_0xa30d('0x2e')](_0x24680e,function(_0x5ca62d){if(_0x5ca62d['type']!==_0xa30d('0x40')){var _0x5346a1={};_0x5346a1[_0x5ca62d[_0xa30d('0x2b')]]={'$like':'%'+_0x997980[_0xa30d('0x32')][_0xa30d('0x3e')]+'%'};return _0x5346a1;}})});}_0x41575e=_[_0xa30d('0x3f')]({},_0x41575e,_0x997980[_0xa30d('0x41')]);var _0x3618a5={'where':_0x41575e[_0xa30d('0x3c')]};return db[_0xa30d('0x2f')]['count'](_0x3618a5)[_0xa30d('0x26')](function(_0x5bcf94){_0x1a5a4a['count']=_0x5bcf94;if(_0x997980[_0xa30d('0x32')]['includeAll']){_0x41575e[_0xa30d('0x42')]=[{'all':!![]}];}return db[_0xa30d('0x2f')][_0xa30d('0x43')](_0x41575e);})[_0xa30d('0x26')](function(_0x37782b){_0x1a5a4a['rows']=_0x37782b;return _0x1a5a4a;})[_0xa30d('0x26')](respondWithFilteredResult(_0x14a921,_0x41575e))['catch'](handleError(_0x14a921,null));};exports[_0xa30d('0x44')]=function(_0x2b6b91,_0x5cddff){var _0x58e950={'raw':!![],'where':{'id':_0x2b6b91[_0xa30d('0x45')]['id']}},_0x2ef332={};_0x2ef332[_0xa30d('0x31')]=_[_0xa30d('0x33')](db[_0xa30d('0x2f')][_0xa30d('0x30')]);_0x2ef332['query']=_[_0xa30d('0x33')](_0x2b6b91[_0xa30d('0x32')]);_0x2ef332[_0xa30d('0x34')]=_[_0xa30d('0x35')](_0x2ef332[_0xa30d('0x31')],_0x2ef332['query']);_0x58e950[_0xa30d('0x36')]=_[_0xa30d('0x35')](_0x2ef332[_0xa30d('0x31')],qs[_0xa30d('0x37')](_0x2b6b91[_0xa30d('0x32')][_0xa30d('0x37')]));_0x58e950['attributes']=_0x58e950[_0xa30d('0x36')]['length']?_0x58e950[_0xa30d('0x36')]:_0x2ef332[_0xa30d('0x31')];if(_0x2b6b91['query'][_0xa30d('0x46')]){_0x58e950[_0xa30d('0x42')]=[{'all':!![]}];}_0x58e950=_[_0xa30d('0x3f')]({},_0x58e950,_0x2b6b91[_0xa30d('0x41')]);return db[_0xa30d('0x2f')]['find'](_0x58e950)[_0xa30d('0x26')](handleEntityNotFound(_0x5cddff,null))['then'](respondWithResult(_0x5cddff,null))[_0xa30d('0x47')](handleError(_0x5cddff,null));};exports[_0xa30d('0x48')]=function(_0x2ae175,_0xd0b3c9){return db['OpenchannelQueueReport'][_0xa30d('0x48')](_0x2ae175[_0xa30d('0x49')],{})[_0xa30d('0x26')](respondWithResult(_0xd0b3c9,0xc9))['catch'](handleError(_0xd0b3c9,null));};exports[_0xa30d('0x4a')]=function(_0x424634,_0x14f8f1){if(_0x424634[_0xa30d('0x49')]['id']){delete _0x424634[_0xa30d('0x49')]['id'];}return db[_0xa30d('0x2f')][_0xa30d('0x4b')]({'where':{'id':_0x424634[_0xa30d('0x45')]['id']}})[_0xa30d('0x26')](handleEntityNotFound(_0x14f8f1,null))[_0xa30d('0x26')](saveUpdates(_0x424634[_0xa30d('0x49')],null))[_0xa30d('0x26')](respondWithResult(_0x14f8f1,null))['catch'](handleError(_0x14f8f1,null));};exports[_0xa30d('0x27')]=function(_0x497f9d,_0x50817c){return db[_0xa30d('0x2f')]['find']({'where':{'id':_0x497f9d['params']['id']}})['then'](handleEntityNotFound(_0x50817c,null))[_0xa30d('0x26')](removeEntity(_0x50817c,null))['catch'](handleError(_0x50817c,null));};exports[_0xa30d('0x4c')]=function(_0x431368,_0x26984e){return db[_0xa30d('0x2f')]['describe']()[_0xa30d('0x26')](respondWithResult(_0x26984e,null))[_0xa30d('0x47')](handleError(_0x26984e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index cf601fb..f3c051e 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x441bce,_0x349add){var _0x5aee7f=function(_0x1f98ef){while(--_0x1f98ef){_0x441bce['push'](_0x441bce['shift']());}};_0x5aee7f(++_0x349add);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x814b,0x1a2));var _0xb814=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x814b[_0x119280];return _0x481797;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 89bdf97..893bc3f 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 _0xb78e=['rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','update','where','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x210931,_0x373fb7){var _0x535fbf=function(_0x5de7ae){while(--_0x5de7ae){_0x210931['push'](_0x210931['shift']());}};_0x535fbf(++_0x373fb7);}(_0xb78e,0x1c9));var _0xeb78=function(_0x45cc29,_0x22288d){_0x45cc29=_0x45cc29-0x0;var _0xd44e22=_0xb78e[_0x45cc29];return _0xd44e22;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateOpenchannelQueueReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2159c1){var _0x1fbf2f=this;return new Promise(function(_0x566336,_0x777ca3){return db['OpenchannelQueueReport'][_0xeb78('0x1b')](_0x2159c1[_0xeb78('0x19')],{'raw':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1['options'][_0xeb78('0x1c')]||null:null,'attributes':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['attributes']||null:null,'limit':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')][_0xeb78('0x1d')]||null:null})[_0xeb78('0xc')](function(_0x3d4a97){logger[_0xeb78('0xd')](_0xeb78('0x1e'),_0x2159c1);logger[_0xeb78('0x10')](_0xeb78('0x1e'),_0x2159c1,JSON[_0xeb78('0x12')](_0x3d4a97));_0x566336(_0x3d4a97);})[_0xeb78('0x16')](function(_0x505468){logger['error']('UpdateOpenchannelQueueReport',_0x505468[_0xeb78('0x15')],_0x2159c1);_0x777ca3(_0x1fbf2f[_0xeb78('0x13')](0x1f4,_0x505468[_0xeb78('0x15')]));});});}; \ No newline at end of file +var _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x14a0,0x8e));var _0x014a=function(_0x4b565e,_0x3ae39a){_0x4b565e=_0x4b565e-0x0;var _0x260fd2=_0x14a0[_0x4b565e];return _0x260fd2;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1a164fb..1b24685 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 _0x232c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','connect-timeout','express'];(function(_0x4420de,_0x4cc181){var _0x468454=function(_0x2bf20b){while(--_0x2bf20b){_0x4420de['push'](_0x4420de['shift']());}};_0x468454(++_0x4cc181);}(_0x232c,0x11e));var _0xc232=function(_0x45af47,_0x1de157){_0x45af47=_0x45af47-0x0;var _0x30d2cc=_0x232c[_0x45af47];return _0x30d2cc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc232('0x0'));var express=require(_0xc232('0x1'));var router=express[_0xc232('0x2')]();var fs_extra=require(_0xc232('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc232('0x4'));var config=require(_0xc232('0x5'));var controller=require(_0xc232('0x6'));router[_0xc232('0x7')]('/',auth[_0xc232('0x8')](),controller['index']);router[_0xc232('0x7')]('/describe',auth[_0xc232('0x8')](),controller[_0xc232('0x9')]);router[_0xc232('0x7')](_0xc232('0xa'),auth[_0xc232('0x8')](),controller[_0xc232('0xb')]);router[_0xc232('0xc')]('/',auth[_0xc232('0x8')](),controller[_0xc232('0xd')]);router[_0xc232('0xe')](_0xc232('0xa'),auth[_0xc232('0x8')](),controller[_0xc232('0xf')]);router[_0xc232('0x10')](_0xc232('0xa'),auth[_0xc232('0x8')](),controller['destroy']);module[_0xc232('0x11')]=router; \ No newline at end of file +var _0x32af=['show','post','create','put','update','delete','destroy','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x32af,0x80));var _0xf32a=function(_0x2eca02,_0x5eac2d){_0x2eca02=_0x2eca02-0x0;var _0x4bc60a=_0x32af[_0x2eca02];return _0x4bc60a;};'use strict';var multer=require(_0xf32a('0x0'));var util=require('util');var path=require(_0xf32a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf32a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xf32a('0x3'));var config=require(_0xf32a('0x4'));var controller=require(_0xf32a('0x5'));router[_0xf32a('0x6')]('/',auth[_0xf32a('0x7')](),controller[_0xf32a('0x8')]);router['get'](_0xf32a('0x9'),auth['isAuthenticated'](),controller[_0xf32a('0xa')]);router[_0xf32a('0x6')](_0xf32a('0xb'),auth[_0xf32a('0x7')](),controller[_0xf32a('0xc')]);router[_0xf32a('0xd')]('/',auth[_0xf32a('0x7')](),controller[_0xf32a('0xe')]);router[_0xf32a('0xf')](_0xf32a('0xb'),auth[_0xf32a('0x7')](),controller[_0xf32a('0x10')]);router[_0xf32a('0x11')](_0xf32a('0xb'),auth[_0xf32a('0x7')](),controller[_0xf32a('0x12')]);module[_0xf32a('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index dfbac37..fb1fe57 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5da8e0,_0x2007cf){var _0x1c37ad=function(_0x534f11){while(--_0x534f11){_0x5da8e0['push'](_0x5da8e0['shift']());}};_0x1c37ad(++_0x2007cf);}(_0x70e0,0x17b));var _0x070e=function(_0x397023,_0x5c5bc7){_0x397023=_0x397023-0x0;var _0x5ed0b7=_0x70e0[_0x397023];return _0x5ed0b7;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5b3883,_0x2c118b){var _0x22ec8e=function(_0x41ca55){while(--_0x41ca55){_0x5b3883['push'](_0x5b3883['shift']());}};_0x22ec8e(++_0x2c118b);}(_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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 07b7528..ba6d01e 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 _0x4124=['hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','name','index','map','OpenchannelTransferReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length'];(function(_0x5918f3,_0x561082){var _0x4eae6f=function(_0x34e5e1){while(--_0x34e5e1){_0x5918f3['push'](_0x5918f3['shift']());}};_0x4eae6f(++_0x561082);}(_0x4124,0x128));var _0x4412=function(_0x387ab7,_0x39e57c){_0x387ab7=_0x387ab7-0x0;var _0x1055ac=_0x4124[_0x387ab7];return _0x1055ac;};'use strict';var emlformat=require(_0x4412('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4412('0x1'));var jsonpatch=require(_0x4412('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4412('0x3'));var Mustache=require(_0x4412('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4412('0x5'));var csv=require(_0x4412('0x6'));var ejs=require(_0x4412('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4412('0x8'));var squel=require(_0x4412('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4412('0xa'));var toCsv=require(_0x4412('0x6'));var querystring=require(_0x4412('0xb'));var Papa=require(_0x4412('0xc'));var Redis=require('ioredis');var authService=require(_0x4412('0xd'));var qs=require(_0x4412('0xe'));var as=require(_0x4412('0xf'));var hardwareService=require(_0x4412('0x10'));var logger=require('../../config/logger')(_0x4412('0x11'));var utils=require('../../config/utils');var config=require(_0x4412('0x12'));var licenseUtil=require(_0x4412('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32472a,_0x11c299){_0x11c299=_0x11c299||0xcc;return function(_0x53cfb1){if(_0x53cfb1){return _0x32472a[_0x4412('0x14')](_0x11c299);}return _0x32472a[_0x4412('0x15')](_0x11c299)[_0x4412('0x16')]();};}function respondWithResult(_0x3cc6fc,_0x5c1a7a){_0x5c1a7a=_0x5c1a7a||0xc8;return function(_0x4f1670){if(_0x4f1670){return _0x3cc6fc[_0x4412('0x15')](_0x5c1a7a)[_0x4412('0x17')](_0x4f1670);}};}function respondWithFilteredResult(_0x5f2769,_0x1ae385){return function(_0x29b630){if(_0x29b630){var _0x5dd429=typeof _0x1ae385[_0x4412('0x18')]==='undefined'&&typeof _0x1ae385[_0x4412('0x19')]===_0x4412('0x1a');var _0x52f052=_0x29b630[_0x4412('0x1b')];var _0x5b4b09=_0x5dd429?0x0:_0x1ae385['offset'];var _0x4bb8fc=_0x5dd429?_0x29b630[_0x4412('0x1b')]:_0x1ae385['offset']+_0x1ae385['limit'];var _0x37318e;if(_0x4bb8fc>=_0x52f052){_0x4bb8fc=_0x52f052;_0x37318e=0xc8;}else{_0x37318e=0xce;}_0x5f2769[_0x4412('0x15')](_0x37318e);return _0x5f2769[_0x4412('0x1c')](_0x4412('0x1d'),_0x5b4b09+'-'+_0x4bb8fc+'/'+_0x52f052)[_0x4412('0x17')](_0x29b630);}return null;};}function patchUpdates(_0x38989f){return function(_0x3a248b){try{jsonpatch[_0x4412('0x1e')](_0x3a248b,_0x38989f,!![]);}catch(_0x41d525){return BPromise[_0x4412('0x1f')](_0x41d525);}return _0x3a248b['save']();};}function saveUpdates(_0x4a4ab3,_0x24f817){return function(_0x4ac023){if(_0x4ac023){return _0x4ac023[_0x4412('0x20')](_0x4a4ab3)['then'](function(_0x35e4a2){return _0x35e4a2;});}return null;};}function removeEntity(_0x44f81b,_0x399dd1){return function(_0x348787){if(_0x348787){return _0x348787[_0x4412('0x21')]()[_0x4412('0x22')](function(){_0x44f81b[_0x4412('0x15')](0xcc)[_0x4412('0x16')]();});}};}function handleEntityNotFound(_0x308a02,_0x569f5b){return function(_0x4ea49c){if(!_0x4ea49c){_0x308a02[_0x4412('0x14')](0x194);}return _0x4ea49c;};}function handleError(_0x74be29,_0x380fb8){_0x380fb8=_0x380fb8||0x1f4;return function(_0x4630e0){logger['error'](_0x4630e0['stack']);if(_0x4630e0[_0x4412('0x23')]){delete _0x4630e0[_0x4412('0x23')];}_0x74be29[_0x4412('0x15')](_0x380fb8)['send'](_0x4630e0);};}exports[_0x4412('0x24')]=function(_0x4db15c,_0xd06d2f){var _0xb9f6a={},_0x19d0c8={},_0x104108={'count':0x0,'rows':[]};var _0x3d0465=_[_0x4412('0x25')](db[_0x4412('0x26')]['rawAttributes'],function(_0x1285da){return{'name':_0x1285da[_0x4412('0x27')],'type':_0x1285da[_0x4412('0x28')][_0x4412('0x29')]};});_0x19d0c8['model']=_['map'](_0x3d0465,_0x4412('0x23'));_0x19d0c8[_0x4412('0x2a')]=_[_0x4412('0x2b')](_0x4db15c[_0x4412('0x2a')]);_0x19d0c8['filters']=_[_0x4412('0x2c')](_0x19d0c8[_0x4412('0x2d')],_0x19d0c8[_0x4412('0x2a')]);_0xb9f6a['attributes']=_[_0x4412('0x2c')](_0x19d0c8['model'],qs[_0x4412('0x2e')](_0x4db15c['query'][_0x4412('0x2e')]));_0xb9f6a[_0x4412('0x2f')]=_0xb9f6a['attributes'][_0x4412('0x30')]?_0xb9f6a['attributes']:_0x19d0c8[_0x4412('0x2d')];if(!_0x4db15c['query'][_0x4412('0x31')]('nolimit')){_0xb9f6a[_0x4412('0x19')]=qs['limit'](_0x4db15c[_0x4412('0x2a')]['limit']);_0xb9f6a[_0x4412('0x18')]=qs[_0x4412('0x18')](_0x4db15c[_0x4412('0x2a')]['offset']);}_0xb9f6a[_0x4412('0x32')]=qs[_0x4412('0x33')](_0x4db15c[_0x4412('0x2a')]['sort']);_0xb9f6a[_0x4412('0x34')]=qs['filters'](_[_0x4412('0x35')](_0x4db15c[_0x4412('0x2a')],_0x19d0c8[_0x4412('0x36')]),_0x3d0465);if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]){_0xb9f6a[_0x4412('0x34')]=_[_0x4412('0x38')](_0xb9f6a[_0x4412('0x34')],{'$or':_[_0x4412('0x25')](_0x3d0465,function(_0x1aca37){if(_0x1aca37[_0x4412('0x28')]!==_0x4412('0x39')){var _0x356a72={};_0x356a72[_0x1aca37[_0x4412('0x23')]]={'$like':'%'+_0x4db15c[_0x4412('0x2a')][_0x4412('0x37')]+'%'};return _0x356a72;}})});}_0xb9f6a=_[_0x4412('0x38')]({},_0xb9f6a,_0x4db15c[_0x4412('0x3a')]);var _0x58f838={'where':_0xb9f6a[_0x4412('0x34')]};return db[_0x4412('0x26')][_0x4412('0x1b')](_0x58f838)['then'](function(_0x2748d4){_0x104108['count']=_0x2748d4;if(_0x4db15c[_0x4412('0x2a')][_0x4412('0x3b')]){_0xb9f6a[_0x4412('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0xb9f6a);})[_0x4412('0x22')](function(_0xe7744b){_0x104108['rows']=_0xe7744b;return _0x104108;})[_0x4412('0x22')](respondWithFilteredResult(_0xd06d2f,_0xb9f6a))[_0x4412('0x3d')](handleError(_0xd06d2f,null));};exports[_0x4412('0x3e')]=function(_0x14ab8b,_0x12a1bb){var _0x1a8a83={'raw':!![],'where':{'id':_0x14ab8b['params']['id']}},_0x4d8b36={};_0x4d8b36[_0x4412('0x2d')]=_[_0x4412('0x2b')](db['OpenchannelTransferReport'][_0x4412('0x3f')]);_0x4d8b36['query']=_[_0x4412('0x2b')](_0x14ab8b[_0x4412('0x2a')]);_0x4d8b36[_0x4412('0x36')]=_['intersection'](_0x4d8b36[_0x4412('0x2d')],_0x4d8b36[_0x4412('0x2a')]);_0x1a8a83[_0x4412('0x2f')]=_[_0x4412('0x2c')](_0x4d8b36[_0x4412('0x2d')],qs[_0x4412('0x2e')](_0x14ab8b[_0x4412('0x2a')]['fields']));_0x1a8a83[_0x4412('0x2f')]=_0x1a8a83[_0x4412('0x2f')]['length']?_0x1a8a83[_0x4412('0x2f')]:_0x4d8b36[_0x4412('0x2d')];if(_0x14ab8b[_0x4412('0x2a')][_0x4412('0x3b')]){_0x1a8a83[_0x4412('0x3c')]=[{'all':!![]}];}_0x1a8a83=_[_0x4412('0x38')]({},_0x1a8a83,_0x14ab8b[_0x4412('0x3a')]);return db[_0x4412('0x26')][_0x4412('0x40')](_0x1a8a83)[_0x4412('0x22')](handleEntityNotFound(_0x12a1bb,null))['then'](respondWithResult(_0x12a1bb,null))[_0x4412('0x3d')](handleError(_0x12a1bb,null));};exports[_0x4412('0x41')]=function(_0x8312ac,_0x2a63b3){return db[_0x4412('0x26')]['create'](_0x8312ac[_0x4412('0x42')],{})[_0x4412('0x22')](respondWithResult(_0x2a63b3,0xc9))['catch'](handleError(_0x2a63b3,null));};exports['update']=function(_0xce3727,_0x472ac6){if(_0xce3727[_0x4412('0x42')]['id']){delete _0xce3727[_0x4412('0x42')]['id'];}return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0xce3727['params']['id']}})[_0x4412('0x22')](handleEntityNotFound(_0x472ac6,null))[_0x4412('0x22')](saveUpdates(_0xce3727['body'],null))['then'](respondWithResult(_0x472ac6,null))['catch'](handleError(_0x472ac6,null));};exports[_0x4412('0x21')]=function(_0x2d9b98,_0x44a8fd){return db[_0x4412('0x26')][_0x4412('0x40')]({'where':{'id':_0x2d9b98[_0x4412('0x43')]['id']}})['then'](handleEntityNotFound(_0x44a8fd,null))[_0x4412('0x22')](removeEntity(_0x44a8fd,null))[_0x4412('0x3d')](handleError(_0x44a8fd,null));};exports['describe']=function(_0x235e5f,_0x30df90){return db[_0x4412('0x26')][_0x4412('0x44')]()[_0x4412('0x22')](respondWithResult(_0x30df90,null))['catch'](handleError(_0x30df90,null));}; \ No newline at end of file +var _0x920e=['papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring'];(function(_0x35e06d,_0xad434c){var _0x1b7a39=function(_0x40efcb){while(--_0x40efcb){_0x35e06d['push'](_0x35e06d['shift']());}};_0x1b7a39(++_0xad434c);}(_0x920e,0x120));var _0xe920=function(_0x15cff3,_0x3658f8){_0x15cff3=_0x15cff3-0x0;var _0x4e321c=_0x920e[_0x15cff3];return _0x4e321c;};'use strict';var emlformat=require(_0xe920('0x0'));var rimraf=require(_0xe920('0x1'));var zipdir=require(_0xe920('0x2'));var jsonpatch=require(_0xe920('0x3'));var rp=require(_0xe920('0x4'));var moment=require('moment');var BPromise=require(_0xe920('0x5'));var Mustache=require(_0xe920('0x6'));var util=require(_0xe920('0x7'));var path=require(_0xe920('0x8'));var sox=require(_0xe920('0x9'));var csv=require(_0xe920('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe920('0xb'));var _=require(_0xe920('0xc'));var squel=require(_0xe920('0xd'));var crypto=require(_0xe920('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe920('0xa'));var querystring=require(_0xe920('0xf'));var Papa=require(_0xe920('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe920('0x11'));var hardwareService=require(_0xe920('0x12'));var logger=require(_0xe920('0x13'))(_0xe920('0x14'));var utils=require('../../config/utils');var config=require(_0xe920('0x15'));var licenseUtil=require(_0xe920('0x16'));var db=require(_0xe920('0x17'))['db'];function respondWithStatusCode(_0x578d84,_0x1be0bc){_0x1be0bc=_0x1be0bc||0xcc;return function(_0x2b3bd0){if(_0x2b3bd0){return _0x578d84[_0xe920('0x18')](_0x1be0bc);}return _0x578d84[_0xe920('0x19')](_0x1be0bc)['end']();};}function respondWithResult(_0x2c3add,_0x162a5e){_0x162a5e=_0x162a5e||0xc8;return function(_0x545fa0){if(_0x545fa0){return _0x2c3add[_0xe920('0x19')](_0x162a5e)[_0xe920('0x1a')](_0x545fa0);}};}function respondWithFilteredResult(_0x3a0094,_0x353a31){return function(_0x3cce7f){if(_0x3cce7f){var _0x58f3fc=typeof _0x353a31[_0xe920('0x1b')]===_0xe920('0x1c')&&typeof _0x353a31['limit']===_0xe920('0x1c');var _0x3e86ca=_0x3cce7f[_0xe920('0x1d')];var _0x4b0c8e=_0x58f3fc?0x0:_0x353a31['offset'];var _0x1f28ba=_0x58f3fc?_0x3cce7f[_0xe920('0x1d')]:_0x353a31[_0xe920('0x1b')]+_0x353a31[_0xe920('0x1e')];var _0x723eac;if(_0x1f28ba>=_0x3e86ca){_0x1f28ba=_0x3e86ca;_0x723eac=0xc8;}else{_0x723eac=0xce;}_0x3a0094['status'](_0x723eac);return _0x3a0094[_0xe920('0x1f')](_0xe920('0x20'),_0x4b0c8e+'-'+_0x1f28ba+'/'+_0x3e86ca)[_0xe920('0x1a')](_0x3cce7f);}return null;};}function patchUpdates(_0x150891){return function(_0x3ce6e5){try{jsonpatch['apply'](_0x3ce6e5,_0x150891,!![]);}catch(_0x210bcb){return BPromise[_0xe920('0x21')](_0x210bcb);}return _0x3ce6e5[_0xe920('0x22')]();};}function saveUpdates(_0x1ceaff,_0x173655){return function(_0x8a69cc){if(_0x8a69cc){return _0x8a69cc[_0xe920('0x23')](_0x1ceaff)[_0xe920('0x24')](function(_0x5988c){return _0x5988c;});}return null;};}function removeEntity(_0x29e0e9,_0x186468){return function(_0x2ebc2e){if(_0x2ebc2e){return _0x2ebc2e[_0xe920('0x25')]()[_0xe920('0x24')](function(){_0x29e0e9[_0xe920('0x19')](0xcc)[_0xe920('0x26')]();});}};}function handleEntityNotFound(_0x23c874,_0x32b46e){return function(_0x352689){if(!_0x352689){_0x23c874[_0xe920('0x18')](0x194);}return _0x352689;};}function handleError(_0x4cd5da,_0xe09caa){_0xe09caa=_0xe09caa||0x1f4;return function(_0x562757){logger[_0xe920('0x27')](_0x562757[_0xe920('0x28')]);if(_0x562757[_0xe920('0x29')]){delete _0x562757[_0xe920('0x29')];}_0x4cd5da[_0xe920('0x19')](_0xe09caa)[_0xe920('0x2a')](_0x562757);};}exports[_0xe920('0x2b')]=function(_0xb9bae,_0x21b922){var _0x16c85f={},_0x69cf7={},_0x74a38c={'count':0x0,'rows':[]};var _0x367970=_['map'](db[_0xe920('0x2c')][_0xe920('0x2d')],function(_0x27b54b){return{'name':_0x27b54b[_0xe920('0x2e')],'type':_0x27b54b['type'][_0xe920('0x2f')]};});_0x69cf7['model']=_[_0xe920('0x30')](_0x367970,'name');_0x69cf7[_0xe920('0x31')]=_['keys'](_0xb9bae['query']);_0x69cf7['filters']=_[_0xe920('0x32')](_0x69cf7['model'],_0x69cf7[_0xe920('0x31')]);_0x16c85f[_0xe920('0x33')]=_[_0xe920('0x32')](_0x69cf7[_0xe920('0x34')],qs['fields'](_0xb9bae['query'][_0xe920('0x35')]));_0x16c85f[_0xe920('0x33')]=_0x16c85f['attributes'][_0xe920('0x36')]?_0x16c85f[_0xe920('0x33')]:_0x69cf7[_0xe920('0x34')];if(!_0xb9bae[_0xe920('0x31')][_0xe920('0x37')](_0xe920('0x38'))){_0x16c85f[_0xe920('0x1e')]=qs[_0xe920('0x1e')](_0xb9bae[_0xe920('0x31')][_0xe920('0x1e')]);_0x16c85f[_0xe920('0x1b')]=qs[_0xe920('0x1b')](_0xb9bae[_0xe920('0x31')][_0xe920('0x1b')]);}_0x16c85f[_0xe920('0x39')]=qs[_0xe920('0x3a')](_0xb9bae[_0xe920('0x31')]['sort']);_0x16c85f[_0xe920('0x3b')]=qs['filters'](_[_0xe920('0x3c')](_0xb9bae['query'],_0x69cf7[_0xe920('0x3d')]),_0x367970);if(_0xb9bae[_0xe920('0x31')][_0xe920('0x3e')]){_0x16c85f[_0xe920('0x3b')]=_[_0xe920('0x3f')](_0x16c85f[_0xe920('0x3b')],{'$or':_[_0xe920('0x30')](_0x367970,function(_0x38a830){if(_0x38a830[_0xe920('0x40')]!==_0xe920('0x41')){var _0x2d7536={};_0x2d7536[_0x38a830[_0xe920('0x29')]]={'$like':'%'+_0xb9bae['query']['filter']+'%'};return _0x2d7536;}})});}_0x16c85f=_['merge']({},_0x16c85f,_0xb9bae['options']);var _0x6fd843={'where':_0x16c85f[_0xe920('0x3b')]};return db[_0xe920('0x2c')][_0xe920('0x1d')](_0x6fd843)[_0xe920('0x24')](function(_0x1849c9){_0x74a38c[_0xe920('0x1d')]=_0x1849c9;if(_0xb9bae[_0xe920('0x31')][_0xe920('0x42')]){_0x16c85f[_0xe920('0x43')]=[{'all':!![]}];}return db[_0xe920('0x2c')][_0xe920('0x44')](_0x16c85f);})[_0xe920('0x24')](function(_0x2f2786){_0x74a38c['rows']=_0x2f2786;return _0x74a38c;})[_0xe920('0x24')](respondWithFilteredResult(_0x21b922,_0x16c85f))[_0xe920('0x45')](handleError(_0x21b922,null));};exports['show']=function(_0xb99960,_0x523980){var _0x456bb8={'raw':!![],'where':{'id':_0xb99960['params']['id']}},_0x3f0eee={};_0x3f0eee[_0xe920('0x34')]=_[_0xe920('0x46')](db[_0xe920('0x2c')][_0xe920('0x2d')]);_0x3f0eee[_0xe920('0x31')]=_[_0xe920('0x46')](_0xb99960[_0xe920('0x31')]);_0x3f0eee['filters']=_[_0xe920('0x32')](_0x3f0eee[_0xe920('0x34')],_0x3f0eee[_0xe920('0x31')]);_0x456bb8[_0xe920('0x33')]=_['intersection'](_0x3f0eee[_0xe920('0x34')],qs['fields'](_0xb99960['query'][_0xe920('0x35')]));_0x456bb8[_0xe920('0x33')]=_0x456bb8['attributes'][_0xe920('0x36')]?_0x456bb8[_0xe920('0x33')]:_0x3f0eee[_0xe920('0x34')];if(_0xb99960[_0xe920('0x31')][_0xe920('0x42')]){_0x456bb8[_0xe920('0x43')]=[{'all':!![]}];}_0x456bb8=_[_0xe920('0x3f')]({},_0x456bb8,_0xb99960['options']);return db['OpenchannelTransferReport'][_0xe920('0x47')](_0x456bb8)[_0xe920('0x24')](handleEntityNotFound(_0x523980,null))[_0xe920('0x24')](respondWithResult(_0x523980,null))[_0xe920('0x45')](handleError(_0x523980,null));};exports[_0xe920('0x48')]=function(_0x578920,_0x245da2){return db[_0xe920('0x2c')][_0xe920('0x48')](_0x578920[_0xe920('0x49')],{})[_0xe920('0x24')](respondWithResult(_0x245da2,0xc9))['catch'](handleError(_0x245da2,null));};exports['update']=function(_0x2d1414,_0x252a87){if(_0x2d1414['body']['id']){delete _0x2d1414[_0xe920('0x49')]['id'];}return db['OpenchannelTransferReport'][_0xe920('0x47')]({'where':{'id':_0x2d1414[_0xe920('0x4a')]['id']}})[_0xe920('0x24')](handleEntityNotFound(_0x252a87,null))[_0xe920('0x24')](saveUpdates(_0x2d1414[_0xe920('0x49')],null))[_0xe920('0x24')](respondWithResult(_0x252a87,null))[_0xe920('0x45')](handleError(_0x252a87,null));};exports['destroy']=function(_0x30b997,_0x311c21){return db[_0xe920('0x2c')][_0xe920('0x47')]({'where':{'id':_0x30b997[_0xe920('0x4a')]['id']}})['then'](handleEntityNotFound(_0x311c21,null))[_0xe920('0x24')](removeEntity(_0x311c21,null))[_0xe920('0x45')](handleError(_0x311c21,null));};exports[_0xe920('0x4b')]=function(_0x5dce4f,_0x10f7d7){return db['OpenchannelTransferReport'][_0xe920('0x4b')]()[_0xe920('0x24')](respondWithResult(_0x10f7d7,null))[_0xe920('0x45')](handleError(_0x10f7d7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f17da63..fe95017 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 _0xf026=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','OpenchannelTransferReport'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf026,0x1af));var _0x6f02=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xf026[_0x58547b];return _0x1d3fd2;};'use strict';var _=require(_0x6f02('0x0'));var util=require(_0x6f02('0x1'));var logger=require(_0x6f02('0x2'))(_0x6f02('0x3'));var moment=require(_0x6f02('0x4'));var BPromise=require(_0x6f02('0x5'));var rp=require(_0x6f02('0x6'));var fs=require('fs');var path=require(_0x6f02('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x6f02('0x8')]=function(_0x1cfd69,_0x366b92){return _0x1cfd69[_0x6f02('0x9')](_0x6f02('0xa'),attributes,{'tableName':_0x6f02('0xb'),'paranoid':![],'indexes':[{'name':_0x6f02('0xc'),'fields':[_0x6f02('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b67=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','moment','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x40a8a1,_0x5835e0){var _0x1393e9=function(_0x1b0a47){while(--_0x1b0a47){_0x40a8a1['push'](_0x40a8a1['shift']());}};_0x1393e9(++_0x5835e0);}(_0x3b67,0x116));var _0x73b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73b6('0x0'));var util=require(_0x73b6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x73b6('0x2'));var BPromise=require('bluebird');var rp=require(_0x73b6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73b6('0x4'));var config=require(_0x73b6('0x5'));var attributes=require(_0x73b6('0x6'));module[_0x73b6('0x7')]=function(_0x2f0f06,_0x59ea11){return _0x2f0f06['define'](_0x73b6('0x8'),attributes,{'tableName':_0x73b6('0x9'),'paranoid':![],'indexes':[{'name':_0x73b6('0xa'),'fields':[_0x73b6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 043b781..37f679b 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 _0x0960=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x0960,0xc2));var _0x0096=function(_0x41686b,_0x3874af){_0x41686b=_0x41686b-0x0;var _0x19c3c5=_0x0960[_0x41686b];return _0x19c3c5;};'use strict';var _=require(_0x0096('0x0'));var util=require(_0x0096('0x1'));var moment=require('moment');var BPromise=require(_0x0096('0x2'));var rs=require(_0x0096('0x3'));var fs=require('fs');var Redis=require(_0x0096('0x4'));var db=require(_0x0096('0x5'))['db'];var utils=require(_0x0096('0x6'));var logger=require(_0x0096('0x7'))(_0x0096('0x8'));var config=require(_0x0096('0x9'));var jayson=require(_0x0096('0xa'));var client=jayson[_0x0096('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81cc41,_0x57390a,_0x1d35f1){return new BPromise(function(_0x44e168,_0x407f3a){return client['request'](_0x81cc41,_0x1d35f1)[_0x0096('0xc')](function(_0x3e97ce){logger[_0x0096('0xd')](_0x0096('0xe'),_0x57390a,'request\x20sent');logger[_0x0096('0xf')](_0x0096('0x10'),_0x57390a,'request\x20sent',JSON[_0x0096('0x11')](_0x3e97ce));if(_0x3e97ce['error']){if(_0x3e97ce[_0x0096('0x12')]['code']===0x1f4){logger[_0x0096('0x12')](_0x0096('0xe'),_0x57390a,_0x3e97ce['error'][_0x0096('0x13')]);return _0x407f3a(_0x3e97ce[_0x0096('0x12')]['message']);}logger['error'](_0x0096('0xe'),_0x57390a,_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);return _0x44e168(_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x57390a,_0x0096('0x14'));_0x44e168(_0x3e97ce['result']['message']);}})[_0x0096('0x15')](function(_0x37f0e4){logger['error'](_0x0096('0xe'),_0x57390a,_0x37f0e4);_0x407f3a(_0x37f0e4);});});} \ No newline at end of file +var _0x3baf=['http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\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','jayson/promise','client'];(function(_0x3be20a,_0x223336){var _0x7382f6=function(_0x41c98f){while(--_0x41c98f){_0x3be20a['push'](_0x3be20a['shift']());}};_0x7382f6(++_0x223336);}(_0x3baf,0xf7));var _0xf3ba=function(_0x9b01d9,_0x4802b0){_0x9b01d9=_0x9b01d9-0x0;var _0x401588=_0x3baf[_0x9b01d9];return _0x401588;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var moment=require(_0xf3ba('0x2'));var BPromise=require(_0xf3ba('0x3'));var rs=require(_0xf3ba('0x4'));var fs=require('fs');var Redis=require(_0xf3ba('0x5'));var db=require(_0xf3ba('0x6'))['db'];var utils=require(_0xf3ba('0x7'));var logger=require(_0xf3ba('0x8'))(_0xf3ba('0x9'));var config=require(_0xf3ba('0xa'));var jayson=require(_0xf3ba('0xb'));var client=jayson[_0xf3ba('0xc')][_0xf3ba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1284b7,_0x4de144,_0x579135){return new BPromise(function(_0x5ab058,_0x32f810){return client['request'](_0x1284b7,_0x579135)[_0xf3ba('0xe')](function(_0x1a2166){logger[_0xf3ba('0xf')](_0xf3ba('0x10'),_0x4de144,_0xf3ba('0x11'));logger[_0xf3ba('0x12')](_0xf3ba('0x13'),_0x4de144,_0xf3ba('0x11'),JSON[_0xf3ba('0x14')](_0x1a2166));if(_0x1a2166[_0xf3ba('0x15')]){if(_0x1a2166[_0xf3ba('0x15')][_0xf3ba('0x16')]===0x1f4){logger[_0xf3ba('0x15')](_0xf3ba('0x10'),_0x4de144,_0x1a2166[_0xf3ba('0x15')][_0xf3ba('0x17')]);return _0x32f810(_0x1a2166[_0xf3ba('0x15')][_0xf3ba('0x17')]);}logger['error'](_0xf3ba('0x10'),_0x4de144,_0x1a2166['error'][_0xf3ba('0x17')]);return _0x5ab058(_0x1a2166[_0xf3ba('0x15')][_0xf3ba('0x17')]);}else{logger[_0xf3ba('0xf')](_0xf3ba('0x10'),_0x4de144,'request\x20sent');_0x5ab058(_0x1a2166[_0xf3ba('0x18')][_0xf3ba('0x17')]);}})[_0xf3ba('0x19')](function(_0x550dd3){logger[_0xf3ba('0x15')](_0xf3ba('0x10'),_0x4de144,_0x550dd3);_0x32f810(_0x550dd3);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 00902da..d207dc1 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 _0xf869=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','put','update'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf869,0xbd));var _0x9f86=function(_0x4e1119,_0x32dc78){_0x4e1119=_0x4e1119-0x0;var _0x35f53d=_0xf869[_0x4e1119];return _0x35f53d;};'use strict';var multer=require(_0x9f86('0x0'));var util=require(_0x9f86('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f86('0x2'));var router=express[_0x9f86('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f86('0x4'));var interaction=require(_0x9f86('0x5'));var config=require(_0x9f86('0x6'));var controller=require(_0x9f86('0x7'));router['get']('/',auth[_0x9f86('0x8')](),controller[_0x9f86('0x9')]);router[_0x9f86('0xa')](_0x9f86('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9f86('0xc')]('/',auth[_0x9f86('0x8')](),controller['create']);router[_0x9f86('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9f86('0xe')]);router[_0x9f86('0xf')](_0x9f86('0xb'),auth[_0x9f86('0x8')](),controller[_0x9f86('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1d0d=['delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','update'];(function(_0x38f8fd,_0x2630c9){var _0x440f0a=function(_0x5ca5d3){while(--_0x5ca5d3){_0x38f8fd['push'](_0x38f8fd['shift']());}};_0x440f0a(++_0x2630c9);}(_0x1d0d,0x183));var _0xd1d0=function(_0x30b01a,_0x1970b1){_0x30b01a=_0x30b01a-0x0;var _0x4b6104=_0x1d0d[_0x30b01a];return _0x4b6104;};'use strict';var multer=require('multer');var util=require(_0xd1d0('0x0'));var path=require(_0xd1d0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd1d0('0x2'));var interaction=require(_0xd1d0('0x3'));var config=require(_0xd1d0('0x4'));var controller=require(_0xd1d0('0x5'));router['get']('/',auth[_0xd1d0('0x6')](),controller[_0xd1d0('0x7')]);router[_0xd1d0('0x8')](_0xd1d0('0x9'),auth[_0xd1d0('0x6')](),controller[_0xd1d0('0xa')]);router[_0xd1d0('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd1d0('0x9'),auth['isAuthenticated'](),controller[_0xd1d0('0xc')]);router[_0xd1d0('0xd')](_0xd1d0('0x9'),auth[_0xd1d0('0x6')](),controller[_0xd1d0('0xe')]);module[_0xd1d0('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2a1be5d..124f7c9 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 _0xda95=['sequelize','exports','STRING','name'];(function(_0x1b2eac,_0x2df0eb){var _0x23225c=function(_0x4be048){while(--_0x4be048){_0x1b2eac['push'](_0x1b2eac['shift']());}};_0x23225c(++_0x2df0eb);}(_0xda95,0x104));var _0x5da9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xda95[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5da9('0x0'));module[_0x5da9('0x1')]={'name':{'type':Sequelize[_0x5da9('0x2')],'unique':_0x5da9('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f26=['sequelize','exports','STRING','name'];(function(_0x5051fc,_0x32fec2){var _0x5aee49=function(_0x1c05f8){while(--_0x1c05f8){_0x5051fc['push'](_0x5051fc['shift']());}};_0x5aee49(++_0x32fec2);}(_0x9f26,0x198));var _0x69f2=function(_0x184920,_0x154b2c){_0x184920=_0x184920-0x0;var _0x22f406=_0x9f26[_0x184920];return _0x22f406;};'use strict';var Sequelize=require(_0x69f2('0x0'));module[_0x69f2('0x1')]={'name':{'type':Sequelize[_0x69f2('0x2')],'unique':_0x69f2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x69f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e27df57..ba9d57d 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 _0x407c=['undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','Pause','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','update','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/utils','../../mysqldb','status','end','json'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x407c,0x11f));var _0xc407=function(_0x1731bd,_0x4830f0){_0x1731bd=_0x1731bd-0x0;var _0x33e629=_0x407c[_0x1731bd];return _0x33e629;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc407('0x0'));var rp=require(_0xc407('0x1'));var moment=require('moment');var BPromise=require(_0xc407('0x2'));var Mustache=require(_0xc407('0x3'));var util=require('util');var path=require(_0xc407('0x4'));var sox=require(_0xc407('0x5'));var csv=require(_0xc407('0x6'));var ejs=require(_0xc407('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc407('0x8'));var squel=require(_0xc407('0x9'));var crypto=require(_0xc407('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc407('0xb'));var toCsv=require(_0xc407('0x6'));var querystring=require(_0xc407('0xc'));var Papa=require(_0xc407('0xd'));var Redis=require(_0xc407('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc407('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc407('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc407('0x11'))['db'];function respondWithStatusCode(_0x5bb6b3,_0x15ee16){_0x15ee16=_0x15ee16||0xcc;return function(_0xf33d2d){if(_0xf33d2d){return _0x5bb6b3['sendStatus'](_0x15ee16);}return _0x5bb6b3[_0xc407('0x12')](_0x15ee16)[_0xc407('0x13')]();};}function respondWithResult(_0x4b1b5d,_0xd76f66){_0xd76f66=_0xd76f66||0xc8;return function(_0x18eeeb){if(_0x18eeeb){return _0x4b1b5d['status'](_0xd76f66)[_0xc407('0x14')](_0x18eeeb);}};}function respondWithFilteredResult(_0x62908e,_0xdd8d56){return function(_0x15ed96){if(_0x15ed96){var _0x1389af=typeof _0xdd8d56['offset']===_0xc407('0x15')&&typeof _0xdd8d56['limit']===_0xc407('0x15');var _0x22aab7=_0x15ed96[_0xc407('0x16')];var _0x1eb987=_0x1389af?0x0:_0xdd8d56[_0xc407('0x17')];var _0x149239=_0x1389af?_0x15ed96[_0xc407('0x16')]:_0xdd8d56[_0xc407('0x17')]+_0xdd8d56['limit'];var _0x306ca8;if(_0x149239>=_0x22aab7){_0x149239=_0x22aab7;_0x306ca8=0xc8;}else{_0x306ca8=0xce;}_0x62908e[_0xc407('0x12')](_0x306ca8);return _0x62908e[_0xc407('0x18')](_0xc407('0x19'),_0x1eb987+'-'+_0x149239+'/'+_0x22aab7)['json'](_0x15ed96);}return null;};}function patchUpdates(_0xe1c9f8){return function(_0x1b7033){try{jsonpatch[_0xc407('0x1a')](_0x1b7033,_0xe1c9f8,!![]);}catch(_0x2a54ae){return BPromise[_0xc407('0x1b')](_0x2a54ae);}return _0x1b7033[_0xc407('0x1c')]();};}function saveUpdates(_0x587a4c,_0x9b004f){return function(_0x5b0941){if(_0x5b0941){return _0x5b0941['update'](_0x587a4c)[_0xc407('0x1d')](function(_0x66e0a2){return _0x66e0a2;});}return null;};}function removeEntity(_0x133712,_0xe2f2c0){return function(_0x52ca15){if(_0x52ca15){return _0x52ca15[_0xc407('0x1e')]()[_0xc407('0x1d')](function(){var _0x298d7d=_0x52ca15[_0xc407('0x1f')]({'plain':!![]});var _0x1197d5=_0xc407('0x20');return db[_0xc407('0x21')][_0xc407('0x1e')]({'where':{'type':_0x1197d5,'resourceId':_0x298d7d['id']}})['then'](function(){return _0x52ca15;});})[_0xc407('0x1d')](function(){_0x133712[_0xc407('0x12')](0xcc)[_0xc407('0x13')]();});}};}function handleEntityNotFound(_0x4be228,_0x3c6f18){return function(_0x48d8b6){if(!_0x48d8b6){_0x4be228['sendStatus'](0x194);}return _0x48d8b6;};}function handleError(_0xb62877,_0x5709d5){_0x5709d5=_0x5709d5||0x1f4;return function(_0x57f196){logger[_0xc407('0x22')](_0x57f196[_0xc407('0x23')]);if(_0x57f196['name']){delete _0x57f196['name'];}_0xb62877[_0xc407('0x12')](_0x5709d5)[_0xc407('0x24')](_0x57f196);};}exports['index']=function(_0x29db29,_0x28723f){var _0x1957a4={},_0x28df4d={},_0x4d424d={'count':0x0,'rows':[]};var _0x3145d5=_[_0xc407('0x25')](db['Pause'][_0xc407('0x26')],function(_0x42794f){return{'name':_0x42794f[_0xc407('0x27')],'type':_0x42794f['type']['key']};});_0x28df4d['model']=_[_0xc407('0x25')](_0x3145d5,_0xc407('0x28'));_0x28df4d[_0xc407('0x29')]=_[_0xc407('0x2a')](_0x29db29[_0xc407('0x29')]);_0x28df4d['filters']=_[_0xc407('0x2b')](_0x28df4d[_0xc407('0x2c')],_0x28df4d[_0xc407('0x29')]);_0x1957a4[_0xc407('0x2d')]=_[_0xc407('0x2b')](_0x28df4d[_0xc407('0x2c')],qs[_0xc407('0x2e')](_0x29db29[_0xc407('0x29')]['fields']));_0x1957a4['attributes']=_0x1957a4['attributes'][_0xc407('0x2f')]?_0x1957a4[_0xc407('0x2d')]:_0x28df4d[_0xc407('0x2c')];if(!_0x29db29[_0xc407('0x29')][_0xc407('0x30')](_0xc407('0x31'))){_0x1957a4[_0xc407('0x32')]=qs[_0xc407('0x32')](_0x29db29[_0xc407('0x29')][_0xc407('0x32')]);_0x1957a4[_0xc407('0x17')]=qs['offset'](_0x29db29['query'][_0xc407('0x17')]);}_0x1957a4[_0xc407('0x33')]=qs[_0xc407('0x34')](_0x29db29[_0xc407('0x29')]['sort']);_0x1957a4[_0xc407('0x35')]=qs[_0xc407('0x36')](_[_0xc407('0x37')](_0x29db29[_0xc407('0x29')],_0x28df4d['filters']),_0x3145d5);if(_0x29db29[_0xc407('0x29')][_0xc407('0x38')]){_0x1957a4[_0xc407('0x35')]=_[_0xc407('0x39')](_0x1957a4[_0xc407('0x35')],{'$or':_['map'](_0x3145d5,function(_0x2c017e){if(_0x2c017e[_0xc407('0x3a')]!==_0xc407('0x3b')){var _0x57519d={};_0x57519d[_0x2c017e[_0xc407('0x28')]]={'$like':'%'+_0x29db29['query'][_0xc407('0x38')]+'%'};return _0x57519d;}})});}_0x1957a4=_['merge']({},_0x1957a4,_0x29db29[_0xc407('0x3c')]);var _0x3b7b51={'where':_0x1957a4[_0xc407('0x35')]};return db[_0xc407('0x3d')][_0xc407('0x16')](_0x3b7b51)[_0xc407('0x1d')](function(_0x2ba4ea){_0x4d424d[_0xc407('0x16')]=_0x2ba4ea;if(_0x29db29[_0xc407('0x29')]['includeAll']){_0x1957a4[_0xc407('0x3e')]=[{'all':!![]}];}return db[_0xc407('0x3d')][_0xc407('0x3f')](_0x1957a4);})[_0xc407('0x1d')](function(_0x4f6362){_0x4d424d[_0xc407('0x40')]=_0x4f6362;return _0x4d424d;})[_0xc407('0x1d')](respondWithFilteredResult(_0x28723f,_0x1957a4))[_0xc407('0x41')](handleError(_0x28723f,null));};exports[_0xc407('0x42')]=function(_0x29ace0,_0x5a556a){var _0x7fd4fb={'raw':!![],'where':{'id':_0x29ace0[_0xc407('0x43')]['id']}},_0x5cb1cf={};_0x5cb1cf[_0xc407('0x2c')]=_[_0xc407('0x2a')](db['Pause'][_0xc407('0x26')]);_0x5cb1cf[_0xc407('0x29')]=_['keys'](_0x29ace0[_0xc407('0x29')]);_0x5cb1cf[_0xc407('0x36')]=_['intersection'](_0x5cb1cf[_0xc407('0x2c')],_0x5cb1cf['query']);_0x7fd4fb[_0xc407('0x2d')]=_[_0xc407('0x2b')](_0x5cb1cf[_0xc407('0x2c')],qs['fields'](_0x29ace0['query'][_0xc407('0x2e')]));_0x7fd4fb['attributes']=_0x7fd4fb[_0xc407('0x2d')][_0xc407('0x2f')]?_0x7fd4fb[_0xc407('0x2d')]:_0x5cb1cf['model'];if(_0x29ace0[_0xc407('0x29')][_0xc407('0x44')]){_0x7fd4fb[_0xc407('0x3e')]=[{'all':!![]}];}_0x7fd4fb=_[_0xc407('0x39')]({},_0x7fd4fb,_0x29ace0[_0xc407('0x3c')]);return db[_0xc407('0x3d')][_0xc407('0x45')](_0x7fd4fb)['then'](handleEntityNotFound(_0x5a556a,null))[_0xc407('0x1d')](respondWithResult(_0x5a556a,null))['catch'](handleError(_0x5a556a,null));};exports[_0xc407('0x46')]=function(_0x1ca2fc,_0xec1bb3){return db[_0xc407('0x3d')][_0xc407('0x46')](_0x1ca2fc[_0xc407('0x47')],{})[_0xc407('0x1d')](function(_0x51021a){var _0xd49fce=_0x1ca2fc[_0xc407('0x48')][_0xc407('0x1f')]({'plain':!![]});if(!_0xd49fce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd49fce[_0xc407('0x49')]===_0xc407('0x48')){var _0x5bd1d0=_0x51021a['get']({'plain':!![]});var _0x5d783b=_0xc407('0x20');return db[_0xc407('0x4a')][_0xc407('0x45')]({'where':{'name':_0x5d783b,'userProfileId':_0xd49fce['userProfileId']},'raw':!![]})[_0xc407('0x1d')](function(_0x2dbae2){if(_0x2dbae2&&_0x2dbae2[_0xc407('0x4b')]===0x0){return db[_0xc407('0x21')][_0xc407('0x46')]({'name':_0x5bd1d0[_0xc407('0x28')],'resourceId':_0x5bd1d0['id'],'type':_0x2dbae2[_0xc407('0x28')],'sectionId':_0x2dbae2['id']},{})[_0xc407('0x1d')](function(){return _0x51021a;});}else{return _0x51021a;}})['catch'](function(_0x436529){logger[_0xc407('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x436529);throw _0x436529;});}return _0x51021a;})['then'](respondWithResult(_0xec1bb3,0xc9))[_0xc407('0x41')](handleError(_0xec1bb3,null));};exports[_0xc407('0x4c')]=function(_0x36c111,_0x327a97){if(_0x36c111[_0xc407('0x47')]['id']){delete _0x36c111[_0xc407('0x47')]['id'];}return db['Pause'][_0xc407('0x45')]({'where':{'id':_0x36c111[_0xc407('0x43')]['id']}})['then'](handleEntityNotFound(_0x327a97,null))[_0xc407('0x1d')](saveUpdates(_0x36c111[_0xc407('0x47')],null))['then'](respondWithResult(_0x327a97,null))[_0xc407('0x41')](handleError(_0x327a97,null));};exports['destroy']=function(_0x3aa4d4,_0x5114ac){return db[_0xc407('0x3d')]['find']({'where':{'id':_0x3aa4d4[_0xc407('0x43')]['id']}})[_0xc407('0x1d')](handleEntityNotFound(_0x5114ac,null))['then'](removeEntity(_0x5114ac,null))[_0xc407('0x41')](handleError(_0x5114ac,null));}; \ No newline at end of file +var _0x3b19=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','autoAssociation','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','index','Pause','rawAttributes','model','map'];(function(_0x1e4050,_0x414f48){var _0x33890c=function(_0x4ea3e4){while(--_0x4ea3e4){_0x1e4050['push'](_0x1e4050['shift']());}};_0x33890c(++_0x414f48);}(_0x3b19,0x1e3));var _0x93b1=function(_0xaeaaff,_0x57c226){_0xaeaaff=_0xaeaaff-0x0;var _0x12168f=_0x3b19[_0xaeaaff];return _0x12168f;};'use strict';var emlformat=require(_0x93b1('0x0'));var rimraf=require(_0x93b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x93b1('0x2'));var moment=require(_0x93b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x93b1('0x4'));var util=require(_0x93b1('0x5'));var path=require(_0x93b1('0x6'));var sox=require(_0x93b1('0x7'));var csv=require(_0x93b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93b1('0x9'));var _=require(_0x93b1('0xa'));var squel=require(_0x93b1('0xb'));var crypto=require(_0x93b1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x93b1('0xd'));var toCsv=require(_0x93b1('0x8'));var querystring=require(_0x93b1('0xe'));var Papa=require(_0x93b1('0xf'));var Redis=require(_0x93b1('0x10'));var authService=require(_0x93b1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x93b1('0x12'));var hardwareService=require(_0x93b1('0x13'));var logger=require(_0x93b1('0x14'))(_0x93b1('0x15'));var utils=require('../../config/utils');var config=require(_0x93b1('0x16'));var licenseUtil=require(_0x93b1('0x17'));var db=require(_0x93b1('0x18'))['db'];function respondWithStatusCode(_0x2b4ca0,_0x3dc7be){_0x3dc7be=_0x3dc7be||0xcc;return function(_0x595218){if(_0x595218){return _0x2b4ca0[_0x93b1('0x19')](_0x3dc7be);}return _0x2b4ca0[_0x93b1('0x1a')](_0x3dc7be)[_0x93b1('0x1b')]();};}function respondWithResult(_0x165e56,_0x1a806e){_0x1a806e=_0x1a806e||0xc8;return function(_0x358869){if(_0x358869){return _0x165e56[_0x93b1('0x1a')](_0x1a806e)[_0x93b1('0x1c')](_0x358869);}};}function respondWithFilteredResult(_0xbca1e4,_0x363869){return function(_0x3d57d9){if(_0x3d57d9){var _0x4f235d=typeof _0x363869[_0x93b1('0x1d')]==='undefined'&&typeof _0x363869[_0x93b1('0x1e')]===_0x93b1('0x1f');var _0x1a988c=_0x3d57d9['count'];var _0x45a18e=_0x4f235d?0x0:_0x363869[_0x93b1('0x1d')];var _0x2e0c68=_0x4f235d?_0x3d57d9[_0x93b1('0x20')]:_0x363869[_0x93b1('0x1d')]+_0x363869['limit'];var _0x3c0c74;if(_0x2e0c68>=_0x1a988c){_0x2e0c68=_0x1a988c;_0x3c0c74=0xc8;}else{_0x3c0c74=0xce;}_0xbca1e4[_0x93b1('0x1a')](_0x3c0c74);return _0xbca1e4['set'](_0x93b1('0x21'),_0x45a18e+'-'+_0x2e0c68+'/'+_0x1a988c)['json'](_0x3d57d9);}return null;};}function patchUpdates(_0x2a7acb){return function(_0xd69887){try{jsonpatch[_0x93b1('0x22')](_0xd69887,_0x2a7acb,!![]);}catch(_0x5a53ae){return BPromise['reject'](_0x5a53ae);}return _0xd69887['save']();};}function saveUpdates(_0x54efe8,_0xba41b1){return function(_0x419505){if(_0x419505){return _0x419505[_0x93b1('0x23')](_0x54efe8)[_0x93b1('0x24')](function(_0x3ef5b8){return _0x3ef5b8;});}return null;};}function removeEntity(_0x24b101,_0x234d1d){return function(_0x559270){if(_0x559270){return _0x559270['destroy']()[_0x93b1('0x24')](function(){var _0x55c7f7=_0x559270[_0x93b1('0x25')]({'plain':!![]});var _0x4f2b15=_0x93b1('0x26');return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'type':_0x4f2b15,'resourceId':_0x55c7f7['id']}})[_0x93b1('0x24')](function(){return _0x559270;});})['then'](function(){_0x24b101['status'](0xcc)[_0x93b1('0x1b')]();});}};}function handleEntityNotFound(_0x5c7f61,_0x283204){return function(_0xc2fbbc){if(!_0xc2fbbc){_0x5c7f61[_0x93b1('0x19')](0x194);}return _0xc2fbbc;};}function handleError(_0x46639f,_0x109e36){_0x109e36=_0x109e36||0x1f4;return function(_0x4991c5){logger[_0x93b1('0x29')](_0x4991c5[_0x93b1('0x2a')]);if(_0x4991c5[_0x93b1('0x2b')]){delete _0x4991c5[_0x93b1('0x2b')];}_0x46639f[_0x93b1('0x1a')](_0x109e36)['send'](_0x4991c5);};}exports[_0x93b1('0x2c')]=function(_0x408025,_0x1eb44d){var _0x3942a0={},_0x58b245={},_0x320d68={'count':0x0,'rows':[]};var _0x2fd103=_['map'](db[_0x93b1('0x2d')][_0x93b1('0x2e')],function(_0x5a08d4){return{'name':_0x5a08d4['fieldName'],'type':_0x5a08d4['type']['key']};});_0x58b245[_0x93b1('0x2f')]=_[_0x93b1('0x30')](_0x2fd103,_0x93b1('0x2b'));_0x58b245[_0x93b1('0x31')]=_['keys'](_0x408025[_0x93b1('0x31')]);_0x58b245[_0x93b1('0x32')]=_[_0x93b1('0x33')](_0x58b245[_0x93b1('0x2f')],_0x58b245[_0x93b1('0x31')]);_0x3942a0['attributes']=_[_0x93b1('0x33')](_0x58b245[_0x93b1('0x2f')],qs[_0x93b1('0x34')](_0x408025[_0x93b1('0x31')]['fields']));_0x3942a0[_0x93b1('0x35')]=_0x3942a0[_0x93b1('0x35')][_0x93b1('0x36')]?_0x3942a0[_0x93b1('0x35')]:_0x58b245[_0x93b1('0x2f')];if(!_0x408025[_0x93b1('0x31')][_0x93b1('0x37')](_0x93b1('0x38'))){_0x3942a0[_0x93b1('0x1e')]=qs[_0x93b1('0x1e')](_0x408025[_0x93b1('0x31')][_0x93b1('0x1e')]);_0x3942a0['offset']=qs[_0x93b1('0x1d')](_0x408025['query'][_0x93b1('0x1d')]);}_0x3942a0['order']=qs[_0x93b1('0x39')](_0x408025[_0x93b1('0x31')][_0x93b1('0x39')]);_0x3942a0[_0x93b1('0x3a')]=qs[_0x93b1('0x32')](_['pick'](_0x408025[_0x93b1('0x31')],_0x58b245['filters']),_0x2fd103);if(_0x408025['query']['filter']){_0x3942a0[_0x93b1('0x3a')]=_['merge'](_0x3942a0[_0x93b1('0x3a')],{'$or':_[_0x93b1('0x30')](_0x2fd103,function(_0x2e1f22){if(_0x2e1f22['type']!=='VIRTUAL'){var _0x1be2f4={};_0x1be2f4[_0x2e1f22[_0x93b1('0x2b')]]={'$like':'%'+_0x408025[_0x93b1('0x31')][_0x93b1('0x3b')]+'%'};return _0x1be2f4;}})});}_0x3942a0=_['merge']({},_0x3942a0,_0x408025[_0x93b1('0x3c')]);var _0x5d0168={'where':_0x3942a0['where']};return db[_0x93b1('0x2d')][_0x93b1('0x20')](_0x5d0168)['then'](function(_0x2c8718){_0x320d68[_0x93b1('0x20')]=_0x2c8718;if(_0x408025[_0x93b1('0x31')][_0x93b1('0x3d')]){_0x3942a0[_0x93b1('0x3e')]=[{'all':!![]}];}return db[_0x93b1('0x2d')][_0x93b1('0x3f')](_0x3942a0);})['then'](function(_0x3bcddf){_0x320d68[_0x93b1('0x40')]=_0x3bcddf;return _0x320d68;})[_0x93b1('0x24')](respondWithFilteredResult(_0x1eb44d,_0x3942a0))[_0x93b1('0x41')](handleError(_0x1eb44d,null));};exports[_0x93b1('0x42')]=function(_0x5be942,_0x3c65a5){var _0xd9981a={'raw':!![],'where':{'id':_0x5be942[_0x93b1('0x43')]['id']}},_0x462bc6={};_0x462bc6['model']=_[_0x93b1('0x44')](db[_0x93b1('0x2d')][_0x93b1('0x2e')]);_0x462bc6[_0x93b1('0x31')]=_[_0x93b1('0x44')](_0x5be942[_0x93b1('0x31')]);_0x462bc6[_0x93b1('0x32')]=_[_0x93b1('0x33')](_0x462bc6[_0x93b1('0x2f')],_0x462bc6['query']);_0xd9981a[_0x93b1('0x35')]=_[_0x93b1('0x33')](_0x462bc6[_0x93b1('0x2f')],qs[_0x93b1('0x34')](_0x5be942[_0x93b1('0x31')][_0x93b1('0x34')]));_0xd9981a[_0x93b1('0x35')]=_0xd9981a[_0x93b1('0x35')][_0x93b1('0x36')]?_0xd9981a[_0x93b1('0x35')]:_0x462bc6[_0x93b1('0x2f')];if(_0x5be942[_0x93b1('0x31')]['includeAll']){_0xd9981a[_0x93b1('0x3e')]=[{'all':!![]}];}_0xd9981a=_['merge']({},_0xd9981a,_0x5be942[_0x93b1('0x3c')]);return db[_0x93b1('0x2d')][_0x93b1('0x45')](_0xd9981a)[_0x93b1('0x24')](handleEntityNotFound(_0x3c65a5,null))['then'](respondWithResult(_0x3c65a5,null))[_0x93b1('0x41')](handleError(_0x3c65a5,null));};exports[_0x93b1('0x46')]=function(_0x50ca85,_0x106fe2){return db['Pause'][_0x93b1('0x46')](_0x50ca85[_0x93b1('0x47')],{})[_0x93b1('0x24')](function(_0x677a6e){var _0x452cb7=_0x50ca85[_0x93b1('0x48')][_0x93b1('0x25')]({'plain':!![]});if(!_0x452cb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x452cb7[_0x93b1('0x49')]==='user'){var _0x52cc33=_0x677a6e[_0x93b1('0x25')]({'plain':!![]});var _0x2943cf=_0x93b1('0x26');return db[_0x93b1('0x4a')][_0x93b1('0x45')]({'where':{'name':_0x2943cf,'userProfileId':_0x452cb7['userProfileId']},'raw':!![]})[_0x93b1('0x24')](function(_0x1d952c){if(_0x1d952c&&_0x1d952c[_0x93b1('0x4b')]===0x0){return db['UserProfileResource'][_0x93b1('0x46')]({'name':_0x52cc33[_0x93b1('0x2b')],'resourceId':_0x52cc33['id'],'type':_0x1d952c[_0x93b1('0x2b')],'sectionId':_0x1d952c['id']},{})[_0x93b1('0x24')](function(){return _0x677a6e;});}else{return _0x677a6e;}})['catch'](function(_0x36ede6){logger[_0x93b1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36ede6);throw _0x36ede6;});}return _0x677a6e;})[_0x93b1('0x24')](respondWithResult(_0x106fe2,0xc9))[_0x93b1('0x41')](handleError(_0x106fe2,null));};exports[_0x93b1('0x23')]=function(_0x4c3e48,_0x4f7af4){if(_0x4c3e48[_0x93b1('0x47')]['id']){delete _0x4c3e48['body']['id'];}return db[_0x93b1('0x2d')][_0x93b1('0x45')]({'where':{'id':_0x4c3e48[_0x93b1('0x43')]['id']}})[_0x93b1('0x24')](handleEntityNotFound(_0x4f7af4,null))['then'](saveUpdates(_0x4c3e48['body'],null))[_0x93b1('0x24')](respondWithResult(_0x4f7af4,null))[_0x93b1('0x41')](handleError(_0x4f7af4,null));};exports[_0x93b1('0x28')]=function(_0x221a0b,_0x221e86){return db[_0x93b1('0x2d')][_0x93b1('0x45')]({'where':{'id':_0x221a0b[_0x93b1('0x43')]['id']}})[_0x93b1('0x24')](handleEntityNotFound(_0x221e86,null))[_0x93b1('0x24')](removeEntity(_0x221e86,null))['catch'](handleError(_0x221e86,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2d22506..0d4533b 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x56e93e,_0x4178e9){var _0x38b08d=function(_0x3de465){while(--_0x3de465){_0x56e93e['push'](_0x56e93e['shift']());}};_0x38b08d(++_0x4178e9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x16d5df,_0x288395){_0x16d5df=_0x16d5df-0x0;var _0x49f27a=_0x8ef6[_0x16d5df];return _0x49f27a;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 8a0849b..2faffad 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x325888,_0x163485){var _0x2edbd1=function(_0x7631b1){while(--_0x7631b1){_0x325888['push'](_0x325888['shift']());}};_0x2edbd1(++_0x163485);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0xb10b[_0x2a98e3];return _0x370a71;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1807ac,_0x5c6804){var _0xb7562b=function(_0x1727c9){while(--_0x1727c9){_0x1807ac['push'](_0x1807ac['shift']());}};_0xb7562b(++_0x5c6804);}(_0x7a54,0x106));var _0x47a5=function(_0x1b700b,_0x490c45){_0x1b700b=_0x1b700b-0x0;var _0x126890=_0x7a54[_0x1b700b];return _0x126890;};'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 c237e46..671740c 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 _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0xec6b69,_0x5dd17c){var _0x4ac162=function(_0x2631e1){while(--_0x2631e1){_0xec6b69['push'](_0xec6b69['shift']());}};_0x4ac162(++_0x5dd17c);}(_0x3140,0xaf));var _0x0314=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x3140[_0x162780];return _0x1ea2dc;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),controller[_0x0314('0xd')]);router['get'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['show']);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);var upload=multer({'storage':multer[_0x0314('0x11')]({'destination':function(_0x3a7713,_0x376da9,_0x375416){_0x375416(null,path[_0x0314('0x12')](config['root'],_0x0314('0x13')));},'filename':function(_0x2bc151,_0xd85ddf,_0x4602ec){_0xd85ddf[_0x0314('0x14')]=_0xd85ddf[_0x0314('0x14')][_0x0314('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4602ec(null,util['format'](_0x0314('0x16'),path[_0x0314('0x17')](_0xd85ddf[_0x0314('0x14')],path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])),Date[_0x0314('0x19')](),path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])));}})});router['post']('/',upload[_0x0314('0x1a')](_0x0314('0x1b')),controller[_0x0314('0x1c')]);router['post'](_0x0314('0xc'),controller['webhookPost']);router['put'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['update']);router[_0x0314('0x1d')](_0x0314('0xe'),auth['isAuthenticated'](),controller[_0x0314('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x3e74=['originalname','format','%s-%s%s','basename','now','extname','file','upload','post','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','download','diskStorage','join','root'];(function(_0x1d0dac,_0x3f4a61){var _0xfa0cbc=function(_0x3a457b){while(--_0x3a457b){_0x1d0dac['push'](_0x1d0dac['shift']());}};_0xfa0cbc(++_0x3f4a61);}(_0x3e74,0x175));var _0x43e7=function(_0x58419a,_0x3c8d86){_0x58419a=_0x58419a-0x0;var _0x3dc5a1=_0x3e74[_0x58419a];return _0x3dc5a1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['show']);router[_0x43e7('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);var upload=multer({'storage':multer[_0x43e7('0xe')]({'destination':function(_0x5c34f4,_0x2803d9,_0x513707){_0x513707(null,path[_0x43e7('0xf')](config[_0x43e7('0x10')],'server/files/plugins'));},'filename':function(_0x3eb206,_0xc960ea,_0x2718d3){_0xc960ea[_0x43e7('0x11')]=_0xc960ea['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2718d3(null,util[_0x43e7('0x12')](_0x43e7('0x13'),path[_0x43e7('0x14')](_0xc960ea['originalname'],path['extname'](_0xc960ea[_0x43e7('0x11')])),Date[_0x43e7('0x15')](),path[_0x43e7('0x16')](_0xc960ea[_0x43e7('0x11')])));}})});router['post']('/',upload['single'](_0x43e7('0x17')),controller[_0x43e7('0x18')]);router[_0x43e7('0x19')]('/webhook',controller['webhookPost']);router[_0x43e7('0x1a')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1b')]);router[_0x43e7('0x1c')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1c')]);module[_0x43e7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index be4ff7c..af52de0 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 _0x1eca=['ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x5ed918,_0x130a32){var _0x250859=function(_0x19ec58){while(--_0x19ec58){_0x5ed918['push'](_0x5ed918['shift']());}};_0x250859(++_0x130a32);}(_0x1eca,0x10f));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa1ec('0x0'));module[_0xa1ec('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa1ec('0x2')](_0xa1ec('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xa1ec('0x4')]},'path':{'type':Sequelize[_0xa1ec('0x5')],'comment':_0xa1ec('0x6')},'active':{'type':Sequelize[_0xa1ec('0x7')],'defaultValue':0x0,'comment':_0xa1ec('0x8')},'sidebar':{'type':Sequelize[_0xa1ec('0x2')](_0xa1ec('0x9'),_0xa1ec('0xa'),_0xa1ec('0xb'),'never'),'defaultValue':'always','comment':_0xa1ec('0xc')},'icon':{'type':Sequelize[_0xa1ec('0x5')]},'adminUrl':{'type':Sequelize[_0xa1ec('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xa1ec('0x5')]},'scriptPath':{'type':Sequelize[_0xa1ec('0x5')]}}; \ No newline at end of file +var _0x70b6=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x70b6,0x1a7));var _0x670b=function(_0x57d0ac,_0xf5f513){_0x57d0ac=_0x57d0ac-0x0;var _0x3adbb4=_0x70b6[_0x57d0ac];return _0x3adbb4;};'use strict';var Sequelize=require(_0x670b('0x0'));module['exports']={'name':{'type':Sequelize[_0x670b('0x1')]},'type':{'type':Sequelize['ENUM']('html',_0x670b('0x2'))},'description':{'type':Sequelize[_0x670b('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x670b('0x1')],'comment':_0x670b('0x4')},'active':{'type':Sequelize[_0x670b('0x5')],'defaultValue':0x0,'comment':_0x670b('0x6')},'sidebar':{'type':Sequelize[_0x670b('0x7')](_0x670b('0x8'),_0x670b('0x9'),_0x670b('0xa'),_0x670b('0xb')),'defaultValue':_0x670b('0xa'),'comment':_0x670b('0xc')},'icon':{'type':Sequelize[_0x670b('0x1')]},'adminUrl':{'type':Sequelize[_0x670b('0x1')]},'agentUrl':{'type':Sequelize[_0x670b('0x1')]},'scriptName':{'type':Sequelize[_0x670b('0x1')]},'scriptPath':{'type':Sequelize[_0x670b('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 686ce33..49c923b 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 _0x86b6=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','limit','count','reject','update','Plugins','UserProfileResource','destroy','then','error','name','index','map','Plugin','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','icon','icon-apps','test','plugins','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','create','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','content-type','set','endsWith','statusCode','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','%s%s','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','fs-extra','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x86b6,0x1d3));var _0x686b=function(_0x57ec65,_0x3154f3){_0x57ec65=_0x57ec65-0x0;var _0x518085=_0x86b6[_0x57ec65];return _0x518085;};'use strict';var emlformat=require(_0x686b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x686b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x686b('0x2'));var moment=require(_0x686b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x686b('0x4'));var util=require('util');var path=require(_0x686b('0x5'));var sox=require('sox');var csv=require(_0x686b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x686b('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x686b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x686b('0x9'));var toCsv=require(_0x686b('0x6'));var querystring=require('querystring');var Papa=require(_0x686b('0xa'));var extract=require(_0x686b('0xb'));var rimraf=require('rimraf');var archiver=require(_0x686b('0xc'));var Redis=require(_0x686b('0xd'));var authService=require(_0x686b('0xe'));var qs=require(_0x686b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x686b('0x10'));var logger=require(_0x686b('0x11'))(_0x686b('0x12'));var utils=require(_0x686b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x686b('0x14'));var db=require(_0x686b('0x15'))['db'];config[_0x686b('0x16')]=_[_0x686b('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x686b('0x18'))(new Redis(config[_0x686b('0x16')]));require(_0x686b('0x19'))[_0x686b('0x1a')](socket);function respondWithStatusCode(_0x2a935f,_0x246175){_0x246175=_0x246175||0xcc;return function(_0x4cb117){if(_0x4cb117){return _0x2a935f[_0x686b('0x1b')](_0x246175);}return _0x2a935f[_0x686b('0x1c')](_0x246175)['end']();};}function respondWithResult(_0xc3b884,_0x36be76){_0x36be76=_0x36be76||0xc8;return function(_0x42c9b5){if(_0x42c9b5){return _0xc3b884[_0x686b('0x1c')](_0x36be76)[_0x686b('0x1d')](_0x42c9b5);}};}function respondWithFilteredResult(_0x10e9c3,_0x2177fe){return function(_0x305c82){if(_0x305c82){var _0x47ca1e=typeof _0x2177fe[_0x686b('0x1e')]==='undefined'&&typeof _0x2177fe[_0x686b('0x1f')]==='undefined';var _0x14b657=_0x305c82[_0x686b('0x20')];var _0x2e46a1=_0x47ca1e?0x0:_0x2177fe['offset'];var _0x5a8137=_0x47ca1e?_0x305c82[_0x686b('0x20')]:_0x2177fe[_0x686b('0x1e')]+_0x2177fe[_0x686b('0x1f')];var _0x4b4da1;if(_0x5a8137>=_0x14b657){_0x5a8137=_0x14b657;_0x4b4da1=0xc8;}else{_0x4b4da1=0xce;}_0x10e9c3[_0x686b('0x1c')](_0x4b4da1);return _0x10e9c3['set']('Content-Range',_0x2e46a1+'-'+_0x5a8137+'/'+_0x14b657)['json'](_0x305c82);}return null;};}function patchUpdates(_0x1b58cc){return function(_0xa55db4){try{jsonpatch['apply'](_0xa55db4,_0x1b58cc,!![]);}catch(_0x2927c1){return BPromise[_0x686b('0x21')](_0x2927c1);}return _0xa55db4['save']();};}function saveUpdates(_0x1f3e06,_0x3b615a){return function(_0x91ce89){if(_0x91ce89){return _0x91ce89[_0x686b('0x22')](_0x1f3e06)['then'](function(_0x1e5c77){return _0x1e5c77;});}return null;};}function removeEntity(_0x1397c0,_0x2b9d49){return function(_0x4c79cf){if(_0x4c79cf){return _0x4c79cf['destroy']()['then'](function(){var _0xbb5b01=_0x4c79cf['get']({'plain':!![]});var _0x3b2b97=_0x686b('0x23');return db[_0x686b('0x24')][_0x686b('0x25')]({'where':{'type':_0x3b2b97,'resourceId':_0xbb5b01['id']}})[_0x686b('0x26')](function(){return _0x4c79cf;});})[_0x686b('0x26')](function(){_0x1397c0[_0x686b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11660d,_0x5066ec){return function(_0x378119){if(!_0x378119){_0x11660d['sendStatus'](0x194);}return _0x378119;};}function handleError(_0x3db317,_0x14cfa8){_0x14cfa8=_0x14cfa8||0x1f4;return function(_0xd5dd9){logger[_0x686b('0x27')](_0xd5dd9['stack']);if(_0xd5dd9[_0x686b('0x28')]){delete _0xd5dd9[_0x686b('0x28')];}_0x3db317[_0x686b('0x1c')](_0x14cfa8)['send'](_0xd5dd9);};}exports[_0x686b('0x29')]=function(_0x452f74,_0x14a75f){var _0x18325e={},_0x1680c3={},_0x17adc1={'count':0x0,'rows':[]};var _0x2ce95f=_[_0x686b('0x2a')](db[_0x686b('0x2b')][_0x686b('0x2c')],function(_0x4fc40a){return{'name':_0x4fc40a[_0x686b('0x2d')],'type':_0x4fc40a[_0x686b('0x2e')][_0x686b('0x2f')]};});_0x1680c3['model']=_['map'](_0x2ce95f,_0x686b('0x28'));_0x1680c3['query']=_[_0x686b('0x30')](_0x452f74[_0x686b('0x31')]);_0x1680c3['filters']=_[_0x686b('0x32')](_0x1680c3[_0x686b('0x33')],_0x1680c3[_0x686b('0x31')]);_0x18325e[_0x686b('0x34')]=_[_0x686b('0x32')](_0x1680c3[_0x686b('0x33')],qs[_0x686b('0x35')](_0x452f74[_0x686b('0x31')][_0x686b('0x35')]));_0x18325e[_0x686b('0x34')]=_0x18325e[_0x686b('0x34')][_0x686b('0x36')]?_0x18325e[_0x686b('0x34')]:_0x1680c3[_0x686b('0x33')];if(!_0x452f74['query'][_0x686b('0x37')](_0x686b('0x38'))){_0x18325e[_0x686b('0x1f')]=qs[_0x686b('0x1f')](_0x452f74['query']['limit']);_0x18325e[_0x686b('0x1e')]=qs[_0x686b('0x1e')](_0x452f74[_0x686b('0x31')][_0x686b('0x1e')]);}_0x18325e[_0x686b('0x39')]=qs[_0x686b('0x3a')](_0x452f74['query'][_0x686b('0x3a')]);_0x18325e[_0x686b('0x3b')]=qs[_0x686b('0x3c')](_[_0x686b('0x3d')](_0x452f74[_0x686b('0x31')],_0x1680c3[_0x686b('0x3c')]),_0x2ce95f);if(_0x452f74[_0x686b('0x31')][_0x686b('0x3e')]){_0x18325e[_0x686b('0x3b')]=_['merge'](_0x18325e[_0x686b('0x3b')],{'$or':_[_0x686b('0x2a')](_0x2ce95f,function(_0x3b2fb0){if(_0x3b2fb0[_0x686b('0x2e')]!==_0x686b('0x3f')){var _0xb87899={};_0xb87899[_0x3b2fb0['name']]={'$like':'%'+_0x452f74['query'][_0x686b('0x3e')]+'%'};return _0xb87899;}})});}_0x18325e=_[_0x686b('0x40')]({},_0x18325e,_0x452f74[_0x686b('0x41')]);var _0xccedbc={'where':_0x18325e[_0x686b('0x3b')]};return db[_0x686b('0x2b')][_0x686b('0x20')](_0xccedbc)[_0x686b('0x26')](function(_0x3a9b68){_0x17adc1[_0x686b('0x20')]=_0x3a9b68;if(_0x452f74[_0x686b('0x31')][_0x686b('0x42')]){_0x18325e[_0x686b('0x43')]=[{'all':!![]}];}return db[_0x686b('0x2b')][_0x686b('0x44')](_0x18325e);})['then'](function(_0x2d4477){_0x17adc1[_0x686b('0x45')]=_0x2d4477;return _0x17adc1;})[_0x686b('0x26')](respondWithFilteredResult(_0x14a75f,_0x18325e))['catch'](handleError(_0x14a75f,null));};exports[_0x686b('0x46')]=function(_0x1e9e9e,_0xc60215){var _0x52d1ee={'raw':!![],'where':{'id':_0x1e9e9e[_0x686b('0x47')]['id']}},_0x4ec732={};_0x4ec732[_0x686b('0x33')]=_[_0x686b('0x30')](db[_0x686b('0x2b')][_0x686b('0x2c')]);_0x4ec732[_0x686b('0x31')]=_['keys'](_0x1e9e9e[_0x686b('0x31')]);_0x4ec732['filters']=_['intersection'](_0x4ec732[_0x686b('0x33')],_0x4ec732['query']);_0x52d1ee[_0x686b('0x34')]=_['intersection'](_0x4ec732[_0x686b('0x33')],qs[_0x686b('0x35')](_0x1e9e9e[_0x686b('0x31')][_0x686b('0x35')]));_0x52d1ee['attributes']=_0x52d1ee['attributes'][_0x686b('0x36')]?_0x52d1ee[_0x686b('0x34')]:_0x4ec732['model'];if(_0x1e9e9e['query'][_0x686b('0x42')]){_0x52d1ee[_0x686b('0x43')]=[{'all':!![]}];}_0x52d1ee=_['merge']({},_0x52d1ee,_0x1e9e9e[_0x686b('0x41')]);return db['Plugin'][_0x686b('0x48')](_0x52d1ee)[_0x686b('0x26')](handleEntityNotFound(_0xc60215,null))[_0x686b('0x26')](respondWithResult(_0xc60215,null))[_0x686b('0x49')](handleError(_0xc60215,null));};exports[_0x686b('0x4a')]=function(_0x562f0e,_0x18f665,_0x5ebea6){return db[_0x686b('0x2b')]['find']({'where':{'id':_0x562f0e[_0x686b('0x47')]['id']},'attributes':[_0x686b('0x28'),_0x686b('0x5')],'raw':!![]})[_0x686b('0x26')](handleEntityNotFound(_0x18f665,null))[_0x686b('0x26')](function(_0x3cc86a){if(_0x3cc86a){var _0x1cfd58=path[_0x686b('0x4b')](config[_0x686b('0x4c')],_0x686b('0x4d'),util[_0x686b('0x4e')](_0x686b('0x4f'),path[_0x686b('0x50')](_0x3cc86a[_0x686b('0x5')])));var _0xa98039=fs[_0x686b('0x51')](_0x1cfd58);var _0xaeb52b=archiver('zip',{'zlib':{'level':0x9}});_0xaeb52b['on'](_0x686b('0x52'),function(_0x1bf0be){if(_0x1bf0be[_0x686b('0x53')]===_0x686b('0x54')){logger[_0x686b('0x27')](_0x1bf0be);}else{throw new db[(_0x686b('0x55'))][(_0x686b('0x56'))](_0x686b('0x57'));}});_0xaeb52b['on']('error',function(_0x4ecdeb){throw new db[(_0x686b('0x55'))]['Error'](_0x686b('0x57'));});_0xaeb52b['pipe'](_0xa98039);_0xaeb52b[_0x686b('0x58')]('**/*',{'cwd':path[_0x686b('0x4b')](config['root'],_0x686b('0x4d'),path[_0x686b('0x59')](_0x3cc86a['path'])),'ignore':[path[_0x686b('0x4b')](path[_0x686b('0x50')](_0x3cc86a['path']),_0x686b('0x5a')),path[_0x686b('0x4b')](path['basename'](_0x3cc86a[_0x686b('0x5')]),_0x686b('0x5b'))],'nodir':!![]})[_0x686b('0x5c')]();_0xa98039['on'](_0x686b('0x5d'),function(){if(!fs[_0x686b('0x5e')](_0x1cfd58)){throw new db[(_0x686b('0x55'))][(_0x686b('0x56'))]('Plugin\x20not\x20found');}return _0x18f665['download'](_0x1cfd58,util[_0x686b('0x4e')](_0x686b('0x4f'),path[_0x686b('0x50')](_0x3cc86a['path'])),function(_0x59283d){if(_0x59283d){throw new db[(_0x686b('0x55'))][(_0x686b('0x56'))](_0x686b('0x5f'));}fs['unlinkSync'](_0x1cfd58);logger[_0x686b('0x60')](_0x686b('0x61'));logger[_0x686b('0x60')](_0x686b('0x62'));});});}return null;})[_0x686b('0x49')](handleError(_0x18f665,null));};exports['upload']=function(_0x4f0081,_0x4cd4c0,_0x4e36e8){var _0x490778=path[_0x686b('0x50')](_0x4f0081[_0x686b('0x63')]['filename'],path[_0x686b('0x64')](_0x4f0081[_0x686b('0x63')][_0x686b('0x65')]));var _0x94d3db=path[_0x686b('0x4b')](config[_0x686b('0x4c')],_0x686b('0x4d'),_0x4f0081[_0x686b('0x63')][_0x686b('0x65')]);var _0xe26bbb=path['join'](config[_0x686b('0x4c')],_0x686b('0x4d'),_0x490778);logger[_0x686b('0x60')](_0x686b('0x66'),_0x94d3db);logger[_0x686b('0x60')](_0x686b('0x67'),_0xe26bbb);try{fs['chmodSync'](_0x94d3db,parseInt(_0x686b('0x68'),0x8));extract(_0x94d3db,{'dir':_0xe26bbb},function(_0x4d13ef){if(_0x4d13ef){logger[_0x686b('0x27')](_0x4d13ef);handleError(_0x4d13ef,!![]);};var _0x35b9a3=fs[_0x686b('0x69')](_0xe26bbb);if(_0x35b9a3[_0x686b('0x36')]>0x1){removeReferences(_0x94d3db,_0xe26bbb);logger[_0x686b('0x27')]('Invalid\x20plugin\x20structure');return _0x4e36e8(new Error(_0x686b('0x6a')));}var _0x48254e=fs['lstatSync'](path[_0x686b('0x4b')](_0xe26bbb,_0x35b9a3[0x0]));if(_0x48254e['isFile']()){removeReferences(_0x94d3db,_0xe26bbb);logger['error'](_0x686b('0x6a'));return _0x4e36e8(new Error(_0x686b('0x6a')));}if(_0x48254e['isDirectory']()){var _0x3cd8ff=fs[_0x686b('0x69')](path[_0x686b('0x4b')](_0xe26bbb,_0x35b9a3[0x0]));if(_0x3cd8ff[_0x686b('0x36')]===0x0){removeReferences(_0x94d3db,_0xe26bbb);logger[_0x686b('0x27')]('Invalid\x20plugin\x20structure');return _0x4e36e8(new Error(_0x686b('0x6a')));}var _0x3b6958=_0x3cd8ff[_0x686b('0x6b')](function(_0xb98b8c){return _0xb98b8c===_0x686b('0x6c');});if(!_0x3b6958){return _0x4e36e8(new Error('Plugin\x20manifest\x20missing'));}var _0x2772f5=fs[_0x686b('0x6d')](path[_0x686b('0x4b')](_0xe26bbb,_0x35b9a3[0x0],'manifest.json'));var _0x5343f3=JSON[_0x686b('0x6e')](_0x2772f5);if('undefined'==typeof _0x5343f3[_0x686b('0x28')]){return _0x4e36e8(new Error(_0x686b('0x6f')));}if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x2e')]){return _0x4e36e8(new Error(_0x686b('0x71')));}if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x72')]){return _0x4e36e8(new Error(_0x686b('0x73')));}if('undefined'==typeof _0x5343f3['parameters']){return _0x4e36e8(new Error(_0x686b('0x74')));}if(_0x5343f3[_0x686b('0x2e')]===_0x686b('0x75')){if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')]){return _0x4e36e8(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x78')]&&_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x79')]){return _0x4e36e8(new Error(_0x686b('0x7a')));}}else if(_0x5343f3[_0x686b('0x2e')]===_0x686b('0x7b')){if(_0x686b('0x70')==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x7c')]){return _0x4e36e8(new Error(_0x686b('0x7d')));}if('undefined'==typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x7e')]){return _0x4e36e8(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4e36e8(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x50acda=_0x5343f3[_0x686b('0x28')];var _0x5f5724=_0x5343f3['description'];var _0x41d426=_0x5343f3[_0x686b('0x2e')];var _0xa6f6f5=_0x5343f3['sidebar']?_0x5343f3[_0x686b('0x7f')]:'always';var _0x546c6b=_0x5343f3[_0x686b('0x80')]?_0x5343f3['icon']:_0x686b('0x81');var _0x480cbe='';var _0x421fcc='';var _0x22bf97='';var _0x345682='';var _0x3ca44a=_0x5343f3[_0x686b('0x72')];if(_0x41d426===_0x686b('0x75')){if(_0x686b('0x70')!=typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x78')]){var _0x347a2c=_0x5343f3[_0x686b('0x76')][_0x686b('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x347a2c)){_0x480cbe=path[_0x686b('0x4b')](_0x686b('0x83'),_0x490778,_0x35b9a3[0x0],_0x347a2c);}else{_0x480cbe=_0x347a2c;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x686b('0x70')!=typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')]['agent']){var _0x4f7cb7=_0x5343f3['parameters'][_0x686b('0x77')][_0x686b('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x4f7cb7)){_0x421fcc=path[_0x686b('0x4b')](_0x686b('0x83'),_0x490778,_0x35b9a3[0x0],_0x4f7cb7);}else{_0x421fcc=_0x4f7cb7;}}else{logger[_0x686b('0x60')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x41d426===_0x686b('0x7b')){_0x22bf97=_0x5343f3[_0x686b('0x76')]['scriptName'];_0x345682=_0x5343f3[_0x686b('0x76')][_0x686b('0x7e')];if('undefined'!=typeof _0x5343f3[_0x686b('0x76')][_0x686b('0x77')]){if(_0x686b('0x70')!=typeof _0x5343f3['parameters']['views'][_0x686b('0x78')]){var _0x347a2c=_0x5343f3['parameters'][_0x686b('0x77')][_0x686b('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x347a2c)){_0x480cbe=path[_0x686b('0x4b')](_0x686b('0x83'),_0x490778,_0x35b9a3[0x0],_0x347a2c);}else{_0x480cbe=_0x347a2c;}}if(_0x686b('0x70')!=typeof _0x5343f3[_0x686b('0x76')]['views'][_0x686b('0x79')]){var _0x4f7cb7=_0x5343f3[_0x686b('0x76')][_0x686b('0x77')][_0x686b('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x686b('0x82')](_0x4f7cb7)){_0x421fcc=path[_0x686b('0x4b')]('plugins',_0x490778,_0x35b9a3[0x0],_0x4f7cb7);}else{_0x421fcc=_0x4f7cb7;}}}}var _0x518f90={'name':_0x50acda,'description':_0x5f5724,'path':path[_0x686b('0x4b')](_0x490778,_0x35b9a3[0x0]),'type':_0x41d426,'sidebar':_0xa6f6f5,'icon':_0x546c6b,'adminUrl':_0x480cbe,'agentUrl':_0x421fcc,'scriptName':_0x22bf97,'scriptPath':_0x345682,'version':_0x3ca44a};removeReferences(_0x94d3db,null);return db['Plugin']['create'](_0x518f90)[_0x686b('0x26')](function(_0x5bec68){var _0x5d643={'role':_0x4f0081[_0x686b('0x84')][_0x686b('0x85')],'userProfileId':_0x4f0081['body'][_0x686b('0x86')]};if(!_0x5d643)throw new Error(_0x686b('0x87'));if(_0x5d643['role']===_0x686b('0x88')){var _0x204871=_0x5bec68[_0x686b('0x89')]({'plain':!![]});return db[_0x686b('0x8a')][_0x686b('0x48')]({'where':{'name':'Plugins','userProfileId':_0x5d643[_0x686b('0x86')]},'raw':!![]})[_0x686b('0x26')](function(_0x33caf8){if(_0x33caf8&&_0x33caf8[_0x686b('0x8b')]===0x0){return db['UserProfileResource'][_0x686b('0x8c')]({'name':_0x204871[_0x686b('0x28')],'resourceId':_0x204871['id'],'type':_0x33caf8[_0x686b('0x28')],'sectionId':_0x33caf8['id']},{})['then'](function(){return _0x5bec68;});}else{return _0x5bec68;}})['catch'](function(_0x32219d){logger[_0x686b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32219d);throw _0x32219d;});}return _0x5bec68;})[_0x686b('0x26')](respondWithResult(_0x4cd4c0,null))[_0x686b('0x49')](handleError(_0x4cd4c0,null));}});}catch(_0x5cc8fd){_0x4cd4c0[_0x686b('0x1c')](0x1f4)[_0x686b('0x8d')](_0x5cc8fd);}};function removeReferences(_0x55287a,_0x9c9f43){try{if(_0x55287a){fs[_0x686b('0x8e')](_0x55287a);logger[_0x686b('0x60')](_0x686b('0x8f'));}if(_0x9c9f43){rimraf(_0x9c9f43,function(){});logger[_0x686b('0x60')](_0x686b('0x90'));}}catch(_0x361fb0){logger[_0x686b('0x27')](_0x361fb0);}}exports[_0x686b('0x22')]=function(_0x353ec1,_0x54b3cf,_0xe00486){return db[_0x686b('0x2b')][_0x686b('0x48')]({'where':{'id':_0x353ec1[_0x686b('0x47')]['id']}})['then'](handleEntityNotFound(_0x54b3cf,null))[_0x686b('0x26')](saveUpdates(_0x353ec1[_0x686b('0x84')],null))['then'](respondWithResult(_0x54b3cf,null))[_0x686b('0x49')](handleError(_0x54b3cf,null));};exports['delete']=function(_0x4e6ca4,_0x3e4d93,_0x368454){return db[_0x686b('0x2b')]['find']({'where':{'id':_0x4e6ca4['params']['id']}})[_0x686b('0x26')](function(_0x25e56d){if(_0x25e56d){return _0x25e56d[_0x686b('0x25')]();}})['then'](function(_0x1a9c2b){rimraf(path[_0x686b('0x4b')](config[_0x686b('0x4c')],'server/files/plugins',path[_0x686b('0x59')](_0x1a9c2b[_0x686b('0x5')])),function(){});return _0x1a9c2b;})[_0x686b('0x26')](handleEntityNotFound(_0x3e4d93,null))['then'](respondWithStatusCode(_0x3e4d93,null))[_0x686b('0x49')](handleError(_0x3e4d93,null));};exports[_0x686b('0x91')]=function(_0x1c4d4c,_0x4154a7,_0x3c0c98){return BPromise['resolve']()[_0x686b('0x26')](function(){if(!_0x1c4d4c[_0x686b('0x31')][_0x686b('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1c4d4c['query']['port']){throw new Error(_0x686b('0x92'));}var _0x13a26f=_0x1c4d4c[_0x686b('0x31')][_0x686b('0x93')]?_0x1c4d4c['query']['hostname']+':'+_0x1c4d4c[_0x686b('0x31')][_0x686b('0x94')]:'http://localhost:'+_0x1c4d4c[_0x686b('0x31')][_0x686b('0x94')];var _0x58bd6e=_0x1c4d4c[_0x686b('0x31')]['json']?_0x1c4d4c[_0x686b('0x31')]['json']:!![];var _0x1f9433=_0x1c4d4c[_0x686b('0x31')][_0x686b('0x95')]?_0x1c4d4c[_0x686b('0x31')][_0x686b('0x95')]:null;var _0x2ff9f0={'method':_0x1c4d4c[_0x686b('0x96')],'uri':util[_0x686b('0x4e')]('%s%s',_0x13a26f,_0x1c4d4c[_0x686b('0x31')][_0x686b('0x5')]),'json':_0x58bd6e,'resolveWithFullResponse':!![],'encoding':_0x1f9433,'qs':_0x1c4d4c[_0x686b('0x31')]};if(_0x1c4d4c['headers']){_0x2ff9f0[_0x686b('0x97')]=_0x1c4d4c[_0x686b('0x97')];if(_0x2ff9f0[_0x686b('0x97')][_0x686b('0x98')]){delete _0x2ff9f0['headers']['content-length'];}}if(_0x2ff9f0[_0x686b('0x97')][_0x686b('0x99')]){delete _0x2ff9f0['headers']['content-type'];}return rp(_0x2ff9f0);})['then'](function(_0x5018b5){if(_0x5018b5){_0x4154a7[_0x686b('0x9a')](_0x5018b5[_0x686b('0x97')]);logger['info'](_0x5018b5[_0x686b('0x84')]);if(_[_0x686b('0x9b')](_0x1c4d4c['query'][_0x686b('0x5')],'download')&&_0x5018b5[_0x686b('0x9c')]==0x1f4){return _0x4154a7['sendStatus'](_0x5018b5[_0x686b('0x9c')]);}else{return _0x4154a7[_0x686b('0x1c')](_0x5018b5[_0x686b('0x9c')])[_0x686b('0x8d')](_0x5018b5['body']);}}else{return _0x4154a7[_0x686b('0x1b')](0xc8);}})[_0x686b('0x49')](handleError(_0x4154a7,null));};exports['webhookPost']=function(_0x1772f9,_0x561b86,_0x502054){return BPromise[_0x686b('0x9d')]()['then'](function(){if(!_0x1772f9[_0x686b('0x31')][_0x686b('0x5')]){throw new Error(_0x686b('0x9e'));}if(!_0x1772f9[_0x686b('0x31')][_0x686b('0x94')]){throw new Error(_0x686b('0x92'));}var _0x11a44c=_0x1772f9[_0x686b('0x31')]['hostname']?_0x1772f9[_0x686b('0x31')][_0x686b('0x93')]+':'+_0x1772f9[_0x686b('0x31')][_0x686b('0x94')]:_0x686b('0x9f')+_0x1772f9[_0x686b('0x31')][_0x686b('0x94')];var _0x189da7=_0x1772f9[_0x686b('0x31')]['json']?_0x1772f9[_0x686b('0x31')][_0x686b('0x1d')]:!![];var _0x25e62a=_0x1772f9[_0x686b('0x31')][_0x686b('0x95')]?_0x1772f9['query'][_0x686b('0x95')]:null;var _0x34700f={'method':_0x1772f9['method'],'uri':util[_0x686b('0x4e')](_0x686b('0xa0'),_0x11a44c,_0x1772f9[_0x686b('0x31')]['path']),'json':_0x189da7,'resolveWithFullResponse':!![],'encoding':_0x25e62a,'body':_0x1772f9[_0x686b('0x84')]};if(_0x1772f9[_0x686b('0x97')]){_0x34700f[_0x686b('0x97')]=_0x1772f9[_0x686b('0x97')];if(_0x34700f['headers'][_0x686b('0x98')]){delete _0x34700f['headers'][_0x686b('0x98')];}}if(_0x34700f[_0x686b('0x97')][_0x686b('0x99')]){delete _0x34700f[_0x686b('0x97')][_0x686b('0x99')];}return rp(_0x34700f);})[_0x686b('0x26')](function(_0x58d193){if(_0x58d193){_0x561b86['set'](_0x58d193[_0x686b('0x97')]);logger[_0x686b('0x60')](_0x58d193['body']);return _0x561b86[_0x686b('0x1c')](_0x58d193[_0x686b('0x9c')])[_0x686b('0x8d')](_0x58d193[_0x686b('0x84')]);}else{return _0x561b86[_0x686b('0x1b')](0xc8);}})[_0x686b('0x49')](handleError(_0x561b86,null));}; \ No newline at end of file +var _0x2c60=['Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','desk.js','to-csv','querystring','papaparse','archiver','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','then','get','Plugins','UserProfileResource','destroy','error','stack','name','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','download','path','join','root','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','html','plugins','agent','test','Warning:\x20agent\x20view\x20not\x20specified','admin','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2c60,0x15a));var _0x02c6=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x2c60[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x02c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x02c6('0x1'));var jsonpatch=require(_0x02c6('0x2'));var rp=require(_0x02c6('0x3'));var moment=require(_0x02c6('0x4'));var BPromise=require(_0x02c6('0x5'));var Mustache=require(_0x02c6('0x6'));var util=require(_0x02c6('0x7'));var path=require('path');var sox=require(_0x02c6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02c6('0x9'));var squel=require('squel');var crypto=require(_0x02c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x02c6('0xb'));var toCsv=require(_0x02c6('0xc'));var querystring=require(_0x02c6('0xd'));var Papa=require(_0x02c6('0xe'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x02c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02c6('0x10'));var logger=require(_0x02c6('0x11'))(_0x02c6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x02c6('0x13'))['db'];config[_0x02c6('0x14')]=_['defaults'](config[_0x02c6('0x14')],{'host':_0x02c6('0x15'),'port':0x18eb});var socket=require(_0x02c6('0x16'))(new Redis(config[_0x02c6('0x14')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x2c702b,_0x519698){_0x519698=_0x519698||0xcc;return function(_0x8e79cf){if(_0x8e79cf){return _0x2c702b[_0x02c6('0x17')](_0x519698);}return _0x2c702b[_0x02c6('0x18')](_0x519698)[_0x02c6('0x19')]();};}function respondWithResult(_0x4a4e4f,_0x5ad9ff){_0x5ad9ff=_0x5ad9ff||0xc8;return function(_0x1498f1){if(_0x1498f1){return _0x4a4e4f[_0x02c6('0x18')](_0x5ad9ff)['json'](_0x1498f1);}};}function respondWithFilteredResult(_0x126023,_0x43be00){return function(_0x41e53e){if(_0x41e53e){var _0x1649b1=typeof _0x43be00[_0x02c6('0x1a')]===_0x02c6('0x1b')&&typeof _0x43be00['limit']===_0x02c6('0x1b');var _0x276846=_0x41e53e[_0x02c6('0x1c')];var _0xa72ae5=_0x1649b1?0x0:_0x43be00[_0x02c6('0x1a')];var _0x3691e4=_0x1649b1?_0x41e53e[_0x02c6('0x1c')]:_0x43be00['offset']+_0x43be00['limit'];var _0x546bdc;if(_0x3691e4>=_0x276846){_0x3691e4=_0x276846;_0x546bdc=0xc8;}else{_0x546bdc=0xce;}_0x126023[_0x02c6('0x18')](_0x546bdc);return _0x126023[_0x02c6('0x1d')](_0x02c6('0x1e'),_0xa72ae5+'-'+_0x3691e4+'/'+_0x276846)[_0x02c6('0x1f')](_0x41e53e);}return null;};}function patchUpdates(_0x58524f){return function(_0x4ecd13){try{jsonpatch[_0x02c6('0x20')](_0x4ecd13,_0x58524f,!![]);}catch(_0x341f63){return BPromise['reject'](_0x341f63);}return _0x4ecd13[_0x02c6('0x21')]();};}function saveUpdates(_0x566167,_0x5c48e9){return function(_0x58e7d3){if(_0x58e7d3){return _0x58e7d3['update'](_0x566167)[_0x02c6('0x22')](function(_0x3a1d70){return _0x3a1d70;});}return null;};}function removeEntity(_0x259e53,_0xcd6e79){return function(_0x31f0eb){if(_0x31f0eb){return _0x31f0eb['destroy']()[_0x02c6('0x22')](function(){var _0x408e44=_0x31f0eb[_0x02c6('0x23')]({'plain':!![]});var _0x557b09=_0x02c6('0x24');return db[_0x02c6('0x25')][_0x02c6('0x26')]({'where':{'type':_0x557b09,'resourceId':_0x408e44['id']}})[_0x02c6('0x22')](function(){return _0x31f0eb;});})['then'](function(){_0x259e53[_0x02c6('0x18')](0xcc)[_0x02c6('0x19')]();});}};}function handleEntityNotFound(_0x50fbd2,_0x3a1066){return function(_0x58fabd){if(!_0x58fabd){_0x50fbd2[_0x02c6('0x17')](0x194);}return _0x58fabd;};}function handleError(_0x32deda,_0x38917b){_0x38917b=_0x38917b||0x1f4;return function(_0x14abc0){logger[_0x02c6('0x27')](_0x14abc0[_0x02c6('0x28')]);if(_0x14abc0[_0x02c6('0x29')]){delete _0x14abc0['name'];}_0x32deda['status'](_0x38917b)['send'](_0x14abc0);};}exports[_0x02c6('0x2a')]=function(_0x5d5128,_0x10cd62){var _0x4245ba={},_0x14c3ad={},_0x272212={'count':0x0,'rows':[]};var _0x11fba1=_['map'](db[_0x02c6('0x2b')][_0x02c6('0x2c')],function(_0x4dbf43){return{'name':_0x4dbf43[_0x02c6('0x2d')],'type':_0x4dbf43[_0x02c6('0x2e')][_0x02c6('0x2f')]};});_0x14c3ad[_0x02c6('0x30')]=_[_0x02c6('0x31')](_0x11fba1,_0x02c6('0x29'));_0x14c3ad[_0x02c6('0x32')]=_[_0x02c6('0x33')](_0x5d5128['query']);_0x14c3ad['filters']=_[_0x02c6('0x34')](_0x14c3ad['model'],_0x14c3ad[_0x02c6('0x32')]);_0x4245ba[_0x02c6('0x35')]=_['intersection'](_0x14c3ad[_0x02c6('0x30')],qs[_0x02c6('0x36')](_0x5d5128[_0x02c6('0x32')][_0x02c6('0x36')]));_0x4245ba[_0x02c6('0x35')]=_0x4245ba[_0x02c6('0x35')][_0x02c6('0x37')]?_0x4245ba[_0x02c6('0x35')]:_0x14c3ad[_0x02c6('0x30')];if(!_0x5d5128[_0x02c6('0x32')]['hasOwnProperty'](_0x02c6('0x38'))){_0x4245ba['limit']=qs[_0x02c6('0x39')](_0x5d5128[_0x02c6('0x32')]['limit']);_0x4245ba['offset']=qs['offset'](_0x5d5128['query'][_0x02c6('0x1a')]);}_0x4245ba[_0x02c6('0x3a')]=qs[_0x02c6('0x3b')](_0x5d5128[_0x02c6('0x32')][_0x02c6('0x3b')]);_0x4245ba[_0x02c6('0x3c')]=qs[_0x02c6('0x3d')](_[_0x02c6('0x3e')](_0x5d5128[_0x02c6('0x32')],_0x14c3ad['filters']),_0x11fba1);if(_0x5d5128['query'][_0x02c6('0x3f')]){_0x4245ba[_0x02c6('0x3c')]=_['merge'](_0x4245ba['where'],{'$or':_[_0x02c6('0x31')](_0x11fba1,function(_0x5cebf8){if(_0x5cebf8['type']!=='VIRTUAL'){var _0x2b9e20={};_0x2b9e20[_0x5cebf8[_0x02c6('0x29')]]={'$like':'%'+_0x5d5128[_0x02c6('0x32')][_0x02c6('0x3f')]+'%'};return _0x2b9e20;}})});}_0x4245ba=_[_0x02c6('0x40')]({},_0x4245ba,_0x5d5128[_0x02c6('0x41')]);var _0x5f1ff4={'where':_0x4245ba[_0x02c6('0x3c')]};return db['Plugin'][_0x02c6('0x1c')](_0x5f1ff4)[_0x02c6('0x22')](function(_0x5ecf59){_0x272212[_0x02c6('0x1c')]=_0x5ecf59;if(_0x5d5128[_0x02c6('0x32')][_0x02c6('0x42')]){_0x4245ba[_0x02c6('0x43')]=[{'all':!![]}];}return db[_0x02c6('0x2b')][_0x02c6('0x44')](_0x4245ba);})[_0x02c6('0x22')](function(_0x2e797c){_0x272212[_0x02c6('0x45')]=_0x2e797c;return _0x272212;})[_0x02c6('0x22')](respondWithFilteredResult(_0x10cd62,_0x4245ba))[_0x02c6('0x46')](handleError(_0x10cd62,null));};exports['show']=function(_0xc70b98,_0x43e823){var _0x2d4f68={'raw':!![],'where':{'id':_0xc70b98[_0x02c6('0x47')]['id']}},_0x3be083={};_0x3be083['model']=_[_0x02c6('0x33')](db[_0x02c6('0x2b')][_0x02c6('0x2c')]);_0x3be083[_0x02c6('0x32')]=_[_0x02c6('0x33')](_0xc70b98[_0x02c6('0x32')]);_0x3be083['filters']=_[_0x02c6('0x34')](_0x3be083['model'],_0x3be083[_0x02c6('0x32')]);_0x2d4f68[_0x02c6('0x35')]=_['intersection'](_0x3be083['model'],qs['fields'](_0xc70b98[_0x02c6('0x32')][_0x02c6('0x36')]));_0x2d4f68['attributes']=_0x2d4f68[_0x02c6('0x35')]['length']?_0x2d4f68[_0x02c6('0x35')]:_0x3be083[_0x02c6('0x30')];if(_0xc70b98[_0x02c6('0x32')][_0x02c6('0x42')]){_0x2d4f68[_0x02c6('0x43')]=[{'all':!![]}];}_0x2d4f68=_[_0x02c6('0x40')]({},_0x2d4f68,_0xc70b98[_0x02c6('0x41')]);return db[_0x02c6('0x2b')][_0x02c6('0x48')](_0x2d4f68)[_0x02c6('0x22')](handleEntityNotFound(_0x43e823,null))[_0x02c6('0x22')](respondWithResult(_0x43e823,null))[_0x02c6('0x46')](handleError(_0x43e823,null));};exports[_0x02c6('0x49')]=function(_0x18d8ae,_0x26b748,_0x5f5985){return db['Plugin'][_0x02c6('0x48')]({'where':{'id':_0x18d8ae['params']['id']},'attributes':[_0x02c6('0x29'),_0x02c6('0x4a')],'raw':!![]})[_0x02c6('0x22')](handleEntityNotFound(_0x26b748,null))['then'](function(_0x3293cb){if(_0x3293cb){var _0x57ce3e=path[_0x02c6('0x4b')](config[_0x02c6('0x4c')],'server/files/plugins',util[_0x02c6('0x4d')](_0x02c6('0x4e'),path[_0x02c6('0x4f')](_0x3293cb['path'])));var _0x34a025=fs[_0x02c6('0x50')](_0x57ce3e);var _0x94897=archiver(_0x02c6('0x51'),{'zlib':{'level':0x9}});_0x94897['on']('warning',function(_0x518f26){if(_0x518f26[_0x02c6('0x52')]===_0x02c6('0x53')){logger[_0x02c6('0x27')](_0x518f26);}else{throw new db[(_0x02c6('0x54'))][(_0x02c6('0x55'))](_0x02c6('0x56'));}});_0x94897['on']('error',function(_0x4e69cc){throw new db[(_0x02c6('0x54'))][(_0x02c6('0x55'))](_0x02c6('0x56'));});_0x94897['pipe'](_0x34a025);_0x94897[_0x02c6('0x57')](_0x02c6('0x58'),{'cwd':path['join'](config[_0x02c6('0x4c')],_0x02c6('0x59'),path[_0x02c6('0x5a')](_0x3293cb[_0x02c6('0x4a')])),'ignore':[path[_0x02c6('0x4b')](path[_0x02c6('0x4f')](_0x3293cb[_0x02c6('0x4a')]),_0x02c6('0x5b')),path[_0x02c6('0x4b')](path[_0x02c6('0x4f')](_0x3293cb[_0x02c6('0x4a')]),'attachments/**/*')],'nodir':!![]})[_0x02c6('0x5c')]();_0x34a025['on'](_0x02c6('0x5d'),function(){if(!fs[_0x02c6('0x5e')](_0x57ce3e)){throw new db[(_0x02c6('0x54'))][(_0x02c6('0x55'))](_0x02c6('0x5f'));}return _0x26b748['download'](_0x57ce3e,util[_0x02c6('0x4d')](_0x02c6('0x4e'),path[_0x02c6('0x4f')](_0x3293cb[_0x02c6('0x4a')])),function(_0x3d7727){if(_0x3d7727){throw new db[(_0x02c6('0x54'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x02c6('0x60')](_0x57ce3e);logger[_0x02c6('0x61')](_0x02c6('0x62'));logger[_0x02c6('0x61')](_0x02c6('0x63'));});});}return null;})[_0x02c6('0x46')](handleError(_0x26b748,null));};exports[_0x02c6('0x64')]=function(_0x2ece56,_0x28883b,_0x1ed8e4){var _0x2da98d=path[_0x02c6('0x4f')](_0x2ece56[_0x02c6('0x65')]['filename'],path['extname'](_0x2ece56[_0x02c6('0x65')]['filename']));var _0x277bfc=path['join'](config['root'],_0x02c6('0x59'),_0x2ece56['file'][_0x02c6('0x66')]);var _0x2b743e=path[_0x02c6('0x4b')](config[_0x02c6('0x4c')],_0x02c6('0x59'),_0x2da98d);logger[_0x02c6('0x61')](_0x02c6('0x67'),_0x277bfc);logger[_0x02c6('0x61')](_0x02c6('0x68'),_0x2b743e);try{fs[_0x02c6('0x69')](_0x277bfc,parseInt(_0x02c6('0x6a'),0x8));extract(_0x277bfc,{'dir':_0x2b743e},function(_0x4d7997){if(_0x4d7997){logger['error'](_0x4d7997);handleError(_0x4d7997,!![]);};var _0x20e655=fs['readdirSync'](_0x2b743e);if(_0x20e655[_0x02c6('0x37')]>0x1){removeReferences(_0x277bfc,_0x2b743e);logger[_0x02c6('0x27')](_0x02c6('0x6b'));return _0x1ed8e4(new Error(_0x02c6('0x6b')));}var _0x5c500d=fs[_0x02c6('0x6c')](path[_0x02c6('0x4b')](_0x2b743e,_0x20e655[0x0]));if(_0x5c500d[_0x02c6('0x6d')]()){removeReferences(_0x277bfc,_0x2b743e);logger[_0x02c6('0x27')]('Invalid\x20plugin\x20structure');return _0x1ed8e4(new Error(_0x02c6('0x6b')));}if(_0x5c500d['isDirectory']()){var _0xbe558e=fs[_0x02c6('0x6e')](path['join'](_0x2b743e,_0x20e655[0x0]));if(_0xbe558e['length']===0x0){removeReferences(_0x277bfc,_0x2b743e);logger[_0x02c6('0x27')](_0x02c6('0x6b'));return _0x1ed8e4(new Error(_0x02c6('0x6b')));}var _0x4464ae=_0xbe558e[_0x02c6('0x6f')](function(_0x72ebb0){return _0x72ebb0===_0x02c6('0x70');});if(!_0x4464ae){return _0x1ed8e4(new Error(_0x02c6('0x71')));}var _0xedeaed=fs[_0x02c6('0x72')](path['join'](_0x2b743e,_0x20e655[0x0],'manifest.json'));var _0x2a0da6=JSON['parse'](_0xedeaed);if(_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x29')]){return _0x1ed8e4(new Error(_0x02c6('0x73')));}if(_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x2e')]){return _0x1ed8e4(new Error(_0x02c6('0x74')));}if(_0x02c6('0x1b')==typeof _0x2a0da6['version']){return _0x1ed8e4(new Error(_0x02c6('0x75')));}if('undefined'==typeof _0x2a0da6['parameters']){return _0x1ed8e4(new Error(_0x02c6('0x76')));}if(_0x2a0da6[_0x02c6('0x2e')]==='html'){if(_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x77')]['views']){return _0x1ed8e4(new Error(_0x02c6('0x78')));}if(_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x77')]['views']['admin']&&_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]['agent']){return _0x1ed8e4(new Error(_0x02c6('0x7a')));}}else if(_0x2a0da6[_0x02c6('0x2e')]===_0x02c6('0x7b')){if(_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x7c')]){return _0x1ed8e4(new Error(_0x02c6('0x7d')));}if(_0x02c6('0x1b')==typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x7e')]){return _0x1ed8e4(new Error(_0x02c6('0x7f')));}}else{return _0x1ed8e4(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5cbe45=_0x2a0da6[_0x02c6('0x29')];var _0xacdf77=_0x2a0da6[_0x02c6('0x80')];var _0x1b70b9=_0x2a0da6[_0x02c6('0x2e')];var _0xce2918=_0x2a0da6['sidebar']?_0x2a0da6[_0x02c6('0x81')]:_0x02c6('0x82');var _0x4193ee=_0x2a0da6[_0x02c6('0x83')]?_0x2a0da6[_0x02c6('0x83')]:_0x02c6('0x84');var _0x15deef='';var _0xd77241='';var _0xe1a91='';var _0x1de5d0='';var _0x4f2c80=_0x2a0da6[_0x02c6('0x85')];if(_0x1b70b9===_0x02c6('0x86')){if(_0x02c6('0x1b')!=typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]['admin']){var _0x3b9f45=_0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3b9f45)){_0x15deef=path['join'](_0x02c6('0x87'),_0x2da98d,_0x20e655[0x0],_0x3b9f45);}else{_0x15deef=_0x3b9f45;}}else{logger[_0x02c6('0x61')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x02c6('0x1b')!=typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')][_0x02c6('0x88')]){var _0x293932=_0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x02c6('0x89')](_0x293932)){_0xd77241=path[_0x02c6('0x4b')](_0x02c6('0x87'),_0x2da98d,_0x20e655[0x0],_0x293932);}else{_0xd77241=_0x293932;}}else{logger['info'](_0x02c6('0x8a'));}}else if(_0x1b70b9===_0x02c6('0x7b')){_0xe1a91=_0x2a0da6[_0x02c6('0x77')][_0x02c6('0x7c')];_0x1de5d0=_0x2a0da6['parameters'][_0x02c6('0x7e')];if('undefined'!=typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]){if(_0x02c6('0x1b')!=typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')][_0x02c6('0x8b')]){var _0x3b9f45=_0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x02c6('0x89')](_0x3b9f45)){_0x15deef=path[_0x02c6('0x4b')](_0x02c6('0x87'),_0x2da98d,_0x20e655[0x0],_0x3b9f45);}else{_0x15deef=_0x3b9f45;}}if('undefined'!=typeof _0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')][_0x02c6('0x88')]){var _0x293932=_0x2a0da6[_0x02c6('0x77')][_0x02c6('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x293932)){_0xd77241=path[_0x02c6('0x4b')](_0x02c6('0x87'),_0x2da98d,_0x20e655[0x0],_0x293932);}else{_0xd77241=_0x293932;}}}}var _0xa9d389={'name':_0x5cbe45,'description':_0xacdf77,'path':path[_0x02c6('0x4b')](_0x2da98d,_0x20e655[0x0]),'type':_0x1b70b9,'sidebar':_0xce2918,'icon':_0x4193ee,'adminUrl':_0x15deef,'agentUrl':_0xd77241,'scriptName':_0xe1a91,'scriptPath':_0x1de5d0,'version':_0x4f2c80};removeReferences(_0x277bfc,null);return db['Plugin'][_0x02c6('0x8c')](_0xa9d389)[_0x02c6('0x22')](function(_0x1cb026){var _0x2fa830={'role':_0x2ece56[_0x02c6('0x8d')][_0x02c6('0x8e')],'userProfileId':_0x2ece56[_0x02c6('0x8d')]['userProfileId']};if(!_0x2fa830)throw new Error(_0x02c6('0x8f'));if(_0x2fa830[_0x02c6('0x8e')]===_0x02c6('0x90')){var _0x1bdb17=_0x1cb026[_0x02c6('0x23')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Plugins','userProfileId':_0x2fa830[_0x02c6('0x91')]},'raw':!![]})[_0x02c6('0x22')](function(_0x18b5ab){if(_0x18b5ab&&_0x18b5ab[_0x02c6('0x92')]===0x0){return db[_0x02c6('0x25')][_0x02c6('0x8c')]({'name':_0x1bdb17[_0x02c6('0x29')],'resourceId':_0x1bdb17['id'],'type':_0x18b5ab[_0x02c6('0x29')],'sectionId':_0x18b5ab['id']},{})['then'](function(){return _0x1cb026;});}else{return _0x1cb026;}})[_0x02c6('0x46')](function(_0x5754fe){logger[_0x02c6('0x27')](_0x02c6('0x93'),_0x5754fe);throw _0x5754fe;});}return _0x1cb026;})[_0x02c6('0x22')](respondWithResult(_0x28883b,null))[_0x02c6('0x46')](handleError(_0x28883b,null));}});}catch(_0x302889){_0x28883b[_0x02c6('0x18')](0x1f4)[_0x02c6('0x94')](_0x302889);}};function removeReferences(_0xe00b3b,_0x5cb732){try{if(_0xe00b3b){fs[_0x02c6('0x60')](_0xe00b3b);logger[_0x02c6('0x61')]('Zip\x20archive\x20removed');}if(_0x5cb732){rimraf(_0x5cb732,function(){});logger['info'](_0x02c6('0x95'));}}catch(_0x4e9ffd){logger[_0x02c6('0x27')](_0x4e9ffd);}}exports[_0x02c6('0x96')]=function(_0x263886,_0x58f8f6,_0x3f22ed){return db['Plugin']['find']({'where':{'id':_0x263886['params']['id']}})[_0x02c6('0x22')](handleEntityNotFound(_0x58f8f6,null))[_0x02c6('0x22')](saveUpdates(_0x263886[_0x02c6('0x8d')],null))[_0x02c6('0x22')](respondWithResult(_0x58f8f6,null))['catch'](handleError(_0x58f8f6,null));};exports[_0x02c6('0x97')]=function(_0x3c7633,_0x3ec4fe,_0x24f2e1){return db[_0x02c6('0x2b')]['find']({'where':{'id':_0x3c7633[_0x02c6('0x47')]['id']}})[_0x02c6('0x22')](function(_0x16dea5){if(_0x16dea5){return _0x16dea5[_0x02c6('0x26')]();}})[_0x02c6('0x22')](function(_0x2cfdf4){rimraf(path['join'](config['root'],'server/files/plugins',path[_0x02c6('0x5a')](_0x2cfdf4['path'])),function(){});return _0x2cfdf4;})['then'](handleEntityNotFound(_0x3ec4fe,null))[_0x02c6('0x22')](respondWithStatusCode(_0x3ec4fe,null))[_0x02c6('0x46')](handleError(_0x3ec4fe,null));};exports[_0x02c6('0x98')]=function(_0x4de203,_0x52ee24,_0x1dc19e){return BPromise[_0x02c6('0x99')]()[_0x02c6('0x22')](function(){if(!_0x4de203['query']['path']){throw new Error(_0x02c6('0x9a'));}if(!_0x4de203[_0x02c6('0x32')][_0x02c6('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x384b08=_0x4de203[_0x02c6('0x32')][_0x02c6('0x9c')]?_0x4de203['query'][_0x02c6('0x9c')]+':'+_0x4de203[_0x02c6('0x32')][_0x02c6('0x9b')]:_0x02c6('0x9d')+_0x4de203[_0x02c6('0x32')][_0x02c6('0x9b')];var _0x35be60=_0x4de203[_0x02c6('0x32')]['json']?_0x4de203[_0x02c6('0x32')][_0x02c6('0x1f')]:!![];var _0x6ef0b=_0x4de203[_0x02c6('0x32')][_0x02c6('0x9e')]?_0x4de203['query'][_0x02c6('0x9e')]:null;var _0xc766ec={'method':_0x4de203[_0x02c6('0x9f')],'uri':util[_0x02c6('0x4d')](_0x02c6('0xa0'),_0x384b08,_0x4de203[_0x02c6('0x32')][_0x02c6('0x4a')]),'json':_0x35be60,'resolveWithFullResponse':!![],'encoding':_0x6ef0b,'qs':_0x4de203[_0x02c6('0x32')]};if(_0x4de203['headers']){_0xc766ec['headers']=_0x4de203[_0x02c6('0xa1')];if(_0xc766ec[_0x02c6('0xa1')][_0x02c6('0xa2')]){delete _0xc766ec[_0x02c6('0xa1')][_0x02c6('0xa2')];}}if(_0xc766ec[_0x02c6('0xa1')]['content-type']){delete _0xc766ec['headers'][_0x02c6('0xa3')];}return rp(_0xc766ec);})[_0x02c6('0x22')](function(_0x24fb56){if(_0x24fb56){_0x52ee24['set'](_0x24fb56[_0x02c6('0xa1')]);logger[_0x02c6('0x61')](_0x24fb56[_0x02c6('0x8d')]);if(_['endsWith'](_0x4de203[_0x02c6('0x32')][_0x02c6('0x4a')],_0x02c6('0x49'))&&_0x24fb56[_0x02c6('0xa4')]==0x1f4){return _0x52ee24['sendStatus'](_0x24fb56[_0x02c6('0xa4')]);}else{return _0x52ee24[_0x02c6('0x18')](_0x24fb56['statusCode'])[_0x02c6('0x94')](_0x24fb56[_0x02c6('0x8d')]);}}else{return _0x52ee24['sendStatus'](0xc8);}})[_0x02c6('0x46')](handleError(_0x52ee24,null));};exports['webhookPost']=function(_0x3ca522,_0x517dd7,_0x3df091){return BPromise[_0x02c6('0x99')]()[_0x02c6('0x22')](function(){if(!_0x3ca522[_0x02c6('0x32')][_0x02c6('0x4a')]){throw new Error(_0x02c6('0x9a'));}if(!_0x3ca522[_0x02c6('0x32')][_0x02c6('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x156083=_0x3ca522['query'][_0x02c6('0x9c')]?_0x3ca522['query']['hostname']+':'+_0x3ca522[_0x02c6('0x32')][_0x02c6('0x9b')]:_0x02c6('0x9d')+_0x3ca522[_0x02c6('0x32')]['port'];var _0x308a40=_0x3ca522[_0x02c6('0x32')][_0x02c6('0x1f')]?_0x3ca522[_0x02c6('0x32')]['json']:!![];var _0x329016=_0x3ca522[_0x02c6('0x32')][_0x02c6('0x9e')]?_0x3ca522[_0x02c6('0x32')][_0x02c6('0x9e')]:null;var _0x251809={'method':_0x3ca522[_0x02c6('0x9f')],'uri':util[_0x02c6('0x4d')](_0x02c6('0xa0'),_0x156083,_0x3ca522['query'][_0x02c6('0x4a')]),'json':_0x308a40,'resolveWithFullResponse':!![],'encoding':_0x329016,'body':_0x3ca522[_0x02c6('0x8d')]};if(_0x3ca522[_0x02c6('0xa1')]){_0x251809['headers']=_0x3ca522[_0x02c6('0xa1')];if(_0x251809[_0x02c6('0xa1')][_0x02c6('0xa2')]){delete _0x251809[_0x02c6('0xa1')]['content-length'];}}if(_0x251809['headers'][_0x02c6('0xa3')]){delete _0x251809['headers'][_0x02c6('0xa3')];}return rp(_0x251809);})[_0x02c6('0x22')](function(_0x5de7d4){if(_0x5de7d4){_0x517dd7[_0x02c6('0x1d')](_0x5de7d4['headers']);logger[_0x02c6('0x61')](_0x5de7d4['body']);return _0x517dd7[_0x02c6('0x18')](_0x5de7d4[_0x02c6('0xa4')])[_0x02c6('0x94')](_0x5de7d4[_0x02c6('0x8d')]);}else{return _0x517dd7['sendStatus'](0xc8);}})['catch'](handleError(_0x517dd7,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c47dd3d..72a3ecc 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 _0x00b3=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x00b3,0x157));var _0x300b=function(_0xea7fdb,_0x583e65){_0xea7fdb=_0xea7fdb-0x0;var _0x5ba5f2=_0x00b3[_0xea7fdb];return _0x5ba5f2;};'use strict';var EventEmitter=require(_0x300b('0x0'));var Plugin=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x300b('0x3')](0x0);var events={'afterCreate':_0x300b('0x4'),'afterUpdate':_0x300b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x968375){return function(_0x204f71,_0x494436,_0x2f3a41){PluginEvents['emit'](_0x968375+':'+_0x204f71['id'],_0x204f71);PluginEvents[_0x300b('0x6')](_0x968375,_0x204f71);_0x2f3a41(null);};}for(var e in events){if(events[_0x300b('0x7')](e)){var event=events[e];Plugin[_0x300b('0x8')](e,emitEvent(event));}}module[_0x300b('0x9')]=PluginEvents; \ No newline at end of file +var _0xfd2e=['events','Plugin','save','remove','hasOwnProperty'];(function(_0x5c2fb6,_0x313d52){var _0x11e0f9=function(_0x55ede7){while(--_0x55ede7){_0x5c2fb6['push'](_0x5c2fb6['shift']());}};_0x11e0f9(++_0x313d52);}(_0xfd2e,0x6e));var _0xefd2=function(_0x59f381,_0x3a7337){_0x59f381=_0x59f381-0x0;var _0x51ddd8=_0xfd2e[_0x59f381];return _0x51ddd8;};'use strict';var EventEmitter=require(_0xefd2('0x0'));var Plugin=require('../../mysqldb')['db'][_0xefd2('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefd2('0x2'),'afterUpdate':'update','afterDestroy':_0xefd2('0x3')};function emitEvent(_0x1c75dd){return function(_0x2b6511,_0x11d644,_0x2e095c){PluginEvents['emit'](_0x1c75dd+':'+_0x2b6511['id'],_0x2b6511);PluginEvents['emit'](_0x1c75dd,_0x2b6511);_0x2e095c(null);};}for(var e in events){if(events[_0xefd2('0x4')](e)){var event=events[e];Plugin['hook'](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 abc7af1..156af57 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 _0x3072=['request-promise','path','rimraf','../../config/environment','exports','util','../../config/logger','api','moment','bluebird'];(function(_0x4f1d58,_0x64dbf){var _0x12dd38=function(_0x44ada3){while(--_0x44ada3){_0x4f1d58['push'](_0x4f1d58['shift']());}};_0x12dd38(++_0x64dbf);}(_0x3072,0xe1));var _0x2307=function(_0xf9b71d,_0x2547cb){_0xf9b71d=_0xf9b71d-0x0;var _0x30de83=_0x3072[_0xf9b71d];return _0x30de83;};'use strict';var _=require('lodash');var util=require(_0x2307('0x0'));var logger=require(_0x2307('0x1'))(_0x2307('0x2'));var moment=require(_0x2307('0x3'));var BPromise=require(_0x2307('0x4'));var rp=require(_0x2307('0x5'));var fs=require('fs');var path=require(_0x2307('0x6'));var rimraf=require(_0x2307('0x7'));var config=require(_0x2307('0x8'));var attributes=require('./plugin.attributes');module[_0x2307('0x9')]=function(_0x2ab878,_0xab1bd6){return _0x2ab878['define']('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd32=['api','request-promise','rimraf','../../config/environment','./plugin.attributes','define','plugins','lodash','util','../../config/logger'];(function(_0x4cafef,_0x4b4409){var _0x4e1700=function(_0x3abdd0){while(--_0x3abdd0){_0x4cafef['push'](_0x4cafef['shift']());}};_0x4e1700(++_0x4b4409);}(_0xfd32,0xd9));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fd3('0x0'));var util=require(_0x2fd3('0x1'));var logger=require(_0x2fd3('0x2'))(_0x2fd3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2fd3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fd3('0x5'));var config=require(_0x2fd3('0x6'));var attributes=require(_0x2fd3('0x7'));module['exports']=function(_0x16a47a,_0x49194b){return _0x16a47a[_0x2fd3('0x8')]('Plugin',attributes,{'tableName':_0x2fd3('0x9'),'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 ff8195c..df6cc3e 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 _0x6fd3=['options','raw','then','CreatePlugin','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','create','body'];(function(_0x4e7653,_0x90ae39){var _0x3ad469=function(_0x23f7a2){while(--_0x23f7a2){_0x4e7653['push'](_0x4e7653['shift']());}};_0x3ad469(++_0x90ae39);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x3b5c6a,_0x4a2b8e){_0x3b5c6a=_0x3b5c6a-0x0;var _0x168f02=_0x6fd3[_0x3b5c6a];return _0x168f02;};'use strict';var _=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var moment=require(_0x36fd('0x2'));var BPromise=require(_0x36fd('0x3'));var rs=require(_0x36fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36fd('0x5'))['db'];var utils=require(_0x36fd('0x6'));var logger=require('../../config/logger')(_0x36fd('0x7'));var config=require(_0x36fd('0x8'));var jayson=require(_0x36fd('0x9'));var client=jayson[_0x36fd('0xa')][_0x36fd('0xb')]({'port':0x232a});config[_0x36fd('0xc')]=_[_0x36fd('0xd')](config[_0x36fd('0xc')],{'host':_0x36fd('0xe'),'port':0x18eb});var socket=require(_0x36fd('0xf'))(new Redis(config[_0x36fd('0xc')]));require(_0x36fd('0x10'))['register'](socket);function respondWithRpcPromise(_0x29ca1a,_0x497849,_0x19ca39){return new BPromise(function(_0x58317e,_0x2f0bdd){return client[_0x36fd('0x11')](_0x29ca1a,_0x19ca39)['then'](function(_0x379c98){logger[_0x36fd('0x12')]('Plugin,\x20%s,\x20%s',_0x497849,_0x36fd('0x13'));logger[_0x36fd('0x14')](_0x36fd('0x15'),_0x497849,'request\x20sent',JSON[_0x36fd('0x16')](_0x379c98));if(_0x379c98[_0x36fd('0x17')]){if(_0x379c98[_0x36fd('0x17')][_0x36fd('0x18')]===0x1f4){logger[_0x36fd('0x17')](_0x36fd('0x19'),_0x497849,_0x379c98['error'][_0x36fd('0x1a')]);return _0x2f0bdd(_0x379c98[_0x36fd('0x17')][_0x36fd('0x1a')]);}logger[_0x36fd('0x17')]('Plugin,\x20%s,\x20%s',_0x497849,_0x379c98['error'][_0x36fd('0x1a')]);return _0x58317e(_0x379c98['error'][_0x36fd('0x1a')]);}else{logger[_0x36fd('0x12')](_0x36fd('0x19'),_0x497849,_0x36fd('0x13'));_0x58317e(_0x379c98['result'][_0x36fd('0x1a')]);}})[_0x36fd('0x1b')](function(_0x433e40){logger[_0x36fd('0x17')](_0x36fd('0x19'),_0x497849,_0x433e40);_0x2f0bdd(_0x433e40);});});}exports['CreatePlugin']=function(_0x1b6a31){var _0x332939=this;return new Promise(function(_0xb8f43d,_0x131295){return db[_0x36fd('0x1c')][_0x36fd('0x1d')](_0x1b6a31[_0x36fd('0x1e')],{'raw':_0x1b6a31['options']?_0x1b6a31[_0x36fd('0x1f')][_0x36fd('0x20')]===undefined?!![]:![]:!![]})[_0x36fd('0x21')](function(_0x31fd61){logger[_0x36fd('0x12')](_0x36fd('0x22'),_0x1b6a31);logger['debug'](_0x36fd('0x22'),_0x1b6a31,JSON[_0x36fd('0x16')](_0x31fd61));_0xb8f43d(_0x31fd61);})[_0x36fd('0x1b')](function(_0x56336e){logger[_0x36fd('0x17')](_0x36fd('0x22'),_0x56336e[_0x36fd('0x1a')],_0x1b6a31);_0x131295(_0x332939[_0x36fd('0x17')](0x1f4,_0x56336e[_0x36fd('0x1a')]));});});}; \ No newline at end of file +var _0x4d53=['redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0xbb59be,_0xd54a22){var _0x1969ce=function(_0x55cf80){while(--_0x55cf80){_0xbb59be['push'](_0xbb59be['shift']());}};_0x1969ce(++_0xd54a22);}(_0x4d53,0x170));var _0x34d5=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x4d53[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x34d5('0x0'));var util=require(_0x34d5('0x1'));var moment=require(_0x34d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34d5('0x3'));var db=require(_0x34d5('0x4'))['db'];var utils=require(_0x34d5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34d5('0x6'));var client=jayson[_0x34d5('0x7')][_0x34d5('0x8')]({'port':0x232a});config[_0x34d5('0x9')]=_[_0x34d5('0xa')](config[_0x34d5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x34d5('0xb'))(new Redis(config['redis']));require(_0x34d5('0xc'))[_0x34d5('0xd')](socket);function respondWithRpcPromise(_0x12c0cb,_0x1ba791,_0x35cdb9){return new BPromise(function(_0x2e5e39,_0x2f8b9e){return client['request'](_0x12c0cb,_0x35cdb9)[_0x34d5('0xe')](function(_0x20fc4a){logger[_0x34d5('0xf')](_0x34d5('0x10'),_0x1ba791,_0x34d5('0x11'));logger['debug'](_0x34d5('0x12'),_0x1ba791,_0x34d5('0x11'),JSON['stringify'](_0x20fc4a));if(_0x20fc4a[_0x34d5('0x13')]){if(_0x20fc4a['error'][_0x34d5('0x14')]===0x1f4){logger['error'](_0x34d5('0x10'),_0x1ba791,_0x20fc4a['error'][_0x34d5('0x15')]);return _0x2f8b9e(_0x20fc4a[_0x34d5('0x13')]['message']);}logger[_0x34d5('0x13')]('Plugin,\x20%s,\x20%s',_0x1ba791,_0x20fc4a[_0x34d5('0x13')][_0x34d5('0x15')]);return _0x2e5e39(_0x20fc4a['error']['message']);}else{logger[_0x34d5('0xf')](_0x34d5('0x10'),_0x1ba791,_0x34d5('0x11'));_0x2e5e39(_0x20fc4a['result'][_0x34d5('0x15')]);}})[_0x34d5('0x16')](function(_0x23969a){logger[_0x34d5('0x13')]('Plugin,\x20%s,\x20%s',_0x1ba791,_0x23969a);_0x2f8b9e(_0x23969a);});});}exports['CreatePlugin']=function(_0x88b1a0){var _0x5b0abf=this;return new Promise(function(_0xe58a13,_0x3331fc){return db[_0x34d5('0x17')][_0x34d5('0x18')](_0x88b1a0[_0x34d5('0x19')],{'raw':_0x88b1a0[_0x34d5('0x1a')]?_0x88b1a0[_0x34d5('0x1a')][_0x34d5('0x1b')]===undefined?!![]:![]:!![]})[_0x34d5('0xe')](function(_0x504013){logger['info'](_0x34d5('0x1c'),_0x88b1a0);logger['debug'](_0x34d5('0x1c'),_0x88b1a0,JSON['stringify'](_0x504013));_0xe58a13(_0x504013);})[_0x34d5('0x16')](function(_0x2c77e9){logger[_0x34d5('0x13')](_0x34d5('0x1c'),_0x2c77e9[_0x34d5('0x15')],_0x88b1a0);_0x3331fc(_0x5b0abf[_0x34d5('0x13')](0x1f4,_0x2c77e9[_0x34d5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index d7cbcce..fb9b767 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 _0xb0cf=['register','plugin:','save','remove','update','emit'];(function(_0x898cc2,_0x346605){var _0x10ec50=function(_0x4736b3){while(--_0x4736b3){_0x898cc2['push'](_0x898cc2['shift']());}};_0x10ec50(++_0x346605);}(_0xb0cf,0xb6));var _0xfb0c=function(_0x15d618,_0x210953){_0x15d618=_0x15d618-0x0;var _0x17291c=_0xb0cf[_0x15d618];return _0x17291c;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xfb0c('0x0'),_0xfb0c('0x1'),_0xfb0c('0x2')];function createListener(_0x47d0b7,_0x23ea92){return function(_0xd9f5de){_0x23ea92[_0xfb0c('0x3')](_0x47d0b7,_0xd9f5de);};}function removeListener(_0xb234fa,_0x51ee9d){return function(){PluginEvents['removeListener'](_0xb234fa,_0x51ee9d);};}exports[_0xfb0c('0x4')]=function(_0x60ebe2){for(var _0x29b763=0x0,_0x124ded=events['length'];_0x29b763<_0x124ded;_0x29b763++){var _0x19ed84=events[_0x29b763];var _0x21eff5=createListener(_0xfb0c('0x5')+_0x19ed84,_0x60ebe2);PluginEvents['on'](_0x19ed84,_0x21eff5);}}; \ No newline at end of file +var _0xdb96=['emit','removeListener','register','length','update'];(function(_0x34532b,_0x168bc7){var _0x5cb8ad=function(_0x387821){while(--_0x387821){_0x34532b['push'](_0x34532b['shift']());}};_0x5cb8ad(++_0x168bc7);}(_0xdb96,0xd1));var _0x6db9=function(_0x2a5755,_0x17f587){_0x2a5755=_0x2a5755-0x0;var _0x1700da=_0xdb96[_0x2a5755];return _0x1700da;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove',_0x6db9('0x0')];function createListener(_0x595819,_0x3affd3){return function(_0x355125){_0x3affd3[_0x6db9('0x1')](_0x595819,_0x355125);};}function removeListener(_0x5e07c1,_0x358103){return function(){PluginEvents[_0x6db9('0x2')](_0x5e07c1,_0x358103);};}exports[_0x6db9('0x3')]=function(_0x162f89){for(var _0xcb633c=0x0,_0x2ae8f6=events[_0x6db9('0x4')];_0xcb633c<_0x2ae8f6;_0xcb633c++){var _0x5aea42=events[_0xcb633c];var _0x3c37a6=createListener('plugin:'+_0x5aea42,_0x162f89);PluginEvents['on'](_0x5aea42,_0x3c37a6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a532ade..e1682cf 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(_0x502f05,_0x31b51c){var _0x228962=function(_0x3327f4){while(--_0x3327f4){_0x502f05['push'](_0x502f05['shift']());}};_0x228962(++_0x31b51c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x508409,_0x18d9b5){var _0x499c8d=function(_0xc1ac2a){while(--_0xc1ac2a){_0x508409['push'](_0x508409['shift']());}};_0x499c8d(++_0x18d9b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 f0ba645..2d8a816 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 _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xde2c,0x7f));var _0xcde2=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xde2c[_0x152449];return _0x5b58b2;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file +var _0xbc9d=['hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','sendStatus','json','error','name','status','send','npm\x20install','info','list','then','reject','motion2','catch','show','describe','params','body','script','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop'];(function(_0x3f32af,_0x3707be){var _0x4ea429=function(_0x1cfbd0){while(--_0x1cfbd0){_0x3f32af['push'](_0x3f32af['shift']());}};_0x4ea429(++_0x3707be);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x41e1ed,_0x1e4ed2){_0x41e1ed=_0x41e1ed-0x0;var _0x3d14b1=_0xbc9d[_0x41e1ed];return _0x3d14b1;};'use strict';var _=require(_0xdbc9('0x0'));var pm2=require(_0xdbc9('0x1'));var logger=require(_0xdbc9('0x2'))(_0xdbc9('0x3'));var path=require(_0xdbc9('0x4'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2aba48,_0x404513){return function(_0x3e63f1){if(!_0x3e63f1){_0x2aba48[_0xdbc9('0x5')](0x194);;}return _0x3e63f1;};}function respondWithResult(_0x6ab397,_0x7c4c55){_0x7c4c55=_0x7c4c55||0xc8;return function(_0x381a0e){if(_0x381a0e){return _0x6ab397['status'](_0x7c4c55)[_0xdbc9('0x6')](_0x381a0e);}return null;};}function handleError(_0x181f8a,_0x3d4918){_0x3d4918=_0x3d4918||0x1f4;return function(_0x4d6493){logger[_0xdbc9('0x7')](_0x4d6493['stack']);if(_0x4d6493['name']){delete _0x4d6493[_0xdbc9('0x8')];}_0x181f8a[_0xdbc9('0x9')](_0x3d4918)[_0xdbc9('0xa')](_0x4d6493);};}function execChildProcess(){return new BPromise(function(_0x2f5e6d,_0x531f09){exec(_0xdbc9('0xb'),function(_0x187149,_0xcc898,_0xd026bc){logger[_0xdbc9('0xc')](_0xcc898);logger[_0xdbc9('0xc')](_0xd026bc);if(_0x187149){logger['error'](_0x187149);return _0x531f09(_0x187149);}return _0x2f5e6d(_0xcc898);});});}exports['index']=function(_0x3d0fdd,_0x15c0a6){return pm2[_0xdbc9('0xd')]()[_0xdbc9('0xe')](function(_0x53495d){if(_0x53495d){var _0x4a9dcb=_[_0xdbc9('0xf')](_0x53495d,function(_0x1e41cf){return _0x1e41cf[_0xdbc9('0x8')]==='express'||_0x1e41cf[_0xdbc9('0x8')]===_0xdbc9('0x10');});return{'rows':_0x4a9dcb,'count':_0x4a9dcb['length']};}return null;})[_0xdbc9('0xe')](respondWithResult(_0x15c0a6,null))[_0xdbc9('0x11')](handleError(_0x15c0a6,null));};exports[_0xdbc9('0x12')]=function(_0x14e655,_0x1f22f4){return pm2[_0xdbc9('0x13')](_0x14e655[_0xdbc9('0x14')]['id'])[_0xdbc9('0xe')](respondWithResult(_0x1f22f4,null))[_0xdbc9('0xe')](handleEntityNotFound(_0x1f22f4,null))[_0xdbc9('0x11')](handleError(_0x1f22f4,null));};exports['create']=function(_0x1ca5fd,_0x497be2){if(_0x1ca5fd[_0xdbc9('0x15')][_0xdbc9('0x8')]&&_0x1ca5fd['body'][_0xdbc9('0x16')]){var _0x5367dc=path['join'](__dirname,'../../files/plugins',_0x1ca5fd['body'][_0xdbc9('0x16')]);var _0x2011a2=process['cwd']();process[_0xdbc9('0x17')](path[_0xdbc9('0x18')](_0x5367dc));return execChildProcess()['then'](function(_0x1bc073){process[_0xdbc9('0x17')](_0x2011a2);return pm2[_0xdbc9('0x19')]({'name':_0x1ca5fd[_0xdbc9('0x15')][_0xdbc9('0x8')],'script':_0x5367dc});})[_0xdbc9('0xe')](function(_0x32822f){pm2[_0xdbc9('0x1a')]();return _0x32822f[0x0];})[_0xdbc9('0xe')](respondWithResult(_0x497be2,0xc9))['catch'](handleError(_0x497be2,null));}else{return _0x497be2[_0xdbc9('0x9')](0x1f4)[_0xdbc9('0xa')]({'message':_0xdbc9('0x1b')});}};exports[_0xdbc9('0x1c')]=function(_0x24fdec,_0x50c3ee){if(_0x24fdec[_0xdbc9('0x15')]['id']){delete _0x24fdec[_0xdbc9('0x15')]['id'];}var _0x5300bd={'online':'restart','stopped':_0xdbc9('0x1d')};if(_0x5300bd[_0xdbc9('0x1e')](_0x24fdec[_0xdbc9('0x15')]['status'])){return pm2[_0x5300bd[_0x24fdec[_0xdbc9('0x15')]['status']]](_0x24fdec['params']['id'])[_0xdbc9('0xe')](respondWithResult(_0x50c3ee,0xc8))['catch'](handleError(_0x50c3ee,null));}else{return _0x50c3ee['status'](0x1f4)[_0xdbc9('0xa')]({'message':_0xdbc9('0x1f')});}};exports[_0xdbc9('0x20')]=function(_0x4db824,_0x35eaf8){if(_0x4db824[_0xdbc9('0x15')]['id']){delete _0x4db824['body']['id'];}if(_0x4db824['params']['id']){return pm2[_0xdbc9('0x21')](_0x4db824[_0xdbc9('0x14')]['id'])[_0xdbc9('0xe')](function(_0x3ce701){pm2[_0xdbc9('0x1a')]();return _0x3ce701[0x0];})[_0xdbc9('0xe')](respondWithResult(_0x35eaf8,null))[_0xdbc9('0x11')](handleError(_0x35eaf8,null));}else{return _0x35eaf8['status'](0x1f4)[_0xdbc9('0xa')]({'message':_0xdbc9('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 85c4871..bb85941 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 _0x74e7=['getQueues','Router','../../components/auth/service','./realtime.controller','get','getAgents','isAuthenticated'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x74e7,0x135));var _0x774e=function(_0x26a922,_0x2ff12b){_0x26a922=_0x26a922-0x0;var _0x10955f=_0x74e7[_0x26a922];return _0x10955f;};'use strict';var express=require('express');var router=express[_0x774e('0x0')]();var auth=require(_0x774e('0x1'));var controller=require(_0x774e('0x2'));router[_0x774e('0x3')]('/agents',auth['isAuthenticated'](),controller[_0x774e('0x4')]);router[_0x774e('0x3')]('/queues',auth[_0x774e('0x5')](),controller[_0x774e('0x6')]);module['exports']=router; \ No newline at end of file +var _0x3826=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getQueues','exports'];(function(_0x3e19d5,_0x5deb21){var _0x1b88c5=function(_0x30f9bd){while(--_0x30f9bd){_0x3e19d5['push'](_0x3e19d5['shift']());}};_0x1b88c5(++_0x5deb21);}(_0x3826,0x1ef));var _0x6382=function(_0x21cffc,_0x386d53){_0x21cffc=_0x21cffc-0x0;var _0x5818f3=_0x3826[_0x21cffc];return _0x5818f3;};'use strict';var express=require(_0x6382('0x0'));var router=express[_0x6382('0x1')]();var auth=require(_0x6382('0x2'));var controller=require(_0x6382('0x3'));router[_0x6382('0x4')](_0x6382('0x5'),auth[_0x6382('0x6')](),controller['getAgents']);router[_0x6382('0x4')]('/queues',auth[_0x6382('0x6')](),controller[_0x6382('0x7')]);module[_0x6382('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 48e7a48..60b1182 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 _0x68ed=['limit','count','status','set','Content-Range','json','error','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','agents','pick','filter','queue','length','busy','some','connectedlinenum','internal','toString','find','getMembers','UserId','online','voiceStatus','loggedInDb','User','Queue','Pause','QueueId','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','idle','pause','faxStatus','unknown','*pause','mail','chat','sms','fax','includes','toLowerCase','Invalid\x20channel','map','findOne','getAgents','all','uniq','value','split','order','startsWith','DESC','ASC','globalStatus','pauseType','userpic','lastLoginAt','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','smsStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','resolve','query','channel','sort','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','getOptions','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined'];(function(_0x59f3e6,_0x327230){var _0x2c197b=function(_0x29a94e){while(--_0x29a94e){_0x59f3e6['push'](_0x59f3e6['shift']());}};_0x2c197b(++_0x327230);}(_0x68ed,0x140));var _0xd68e=function(_0x115ec0,_0x369dd8){_0x115ec0=_0x115ec0-0x0;var _0x4f4527=_0x68ed[_0x115ec0];return _0x4f4527;};'use strict';var util=require(_0xd68e('0x0'));var _=require(_0xd68e('0x1'));var jayson=require(_0xd68e('0x2'));var qs=require(_0xd68e('0x3'));var logger=require(_0xd68e('0x4'))('api');var db=require(_0xd68e('0x5'))['db'];var amiClient=jayson[_0xd68e('0x6')][_0xd68e('0x7')]({'port':0x232a});var routingClient=jayson[_0xd68e('0x6')][_0xd68e('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x1dae40,_0x387b68){return function(_0xc32891){if(_0xc32891){var _0x4b7600=typeof _0x387b68[_0xd68e('0x8')]===_0xd68e('0x9')&&typeof _0x387b68[_0xd68e('0xa')]==='undefined';var _0x220893=_0xc32891[_0xd68e('0xb')];var _0x2b264=_0x4b7600?0x0:_0x387b68['offset'];var _0x570aac=_0x4b7600?_0xc32891[_0xd68e('0xb')]:_0x387b68[_0xd68e('0x8')]+_0x387b68[_0xd68e('0xa')];var _0x225b26;if(_0x570aac>=_0x220893){_0x570aac=_0x220893;_0x225b26=0xc8;}else{_0x225b26=0xce;}_0x1dae40[_0xd68e('0xc')](_0x225b26);return _0x1dae40[_0xd68e('0xd')](_0xd68e('0xe'),_0x2b264+'-'+_0x570aac+'/'+_0x220893)[_0xd68e('0xf')](_0xc32891);}return null;};}function handleError(_0x3b2aab,_0x295d26){_0x295d26=_0x295d26||0x1f4;return function(_0x357f31){logger[_0xd68e('0x10')](_0x357f31['stack']);if(_0x357f31[_0xd68e('0x11')]){delete _0x357f31[_0xd68e('0x11')];}_0x3b2aab['status'](_0x295d26)[_0xd68e('0x12')](_0x357f31);};}function getRealtimeAgents(){return new Promise(function(_0x336e9e,_0x51f055){return amiClient[_0xd68e('0x13')](_0xd68e('0x14'),{})[_0xd68e('0x15')](function(_0x3bb8eb){if(_0x3bb8eb[_0xd68e('0x10')])throw new Error(_0xd68e('0x16'));var _0x100af4=_0x3bb8eb['result'];return routingClient['request'](_0xd68e('0x14'),{})[_0xd68e('0x15')](function(_0x15bf36){if(_0x15bf36[_0xd68e('0x10')])throw new Error(_0xd68e('0x17'));var _0x3dd49d=_0x15bf36['result'];return _0x336e9e(_[_0xd68e('0x18')]({},_0x100af4,_0x3dd49d));});})[_0xd68e('0x19')](function(_0x459a85){_0x51f055(_0x459a85);});});}function getRealtimeQueues(_0x2eb522,_0x7a7d83){return new Promise(function(_0x358505,_0xe016ee){var _0xe44234=_0x7a7d83===_0xd68e('0x1a')?amiClient:routingClient;return _0xe44234[_0xd68e('0x13')](_[_0xd68e('0x1b')](_0x7a7d83)+_0xd68e('0x1c'),_0x2eb522)[_0xd68e('0x15')](function(_0x334d8c){if(_0x334d8c[_0xd68e('0x10')])throw new Error(util[_0xd68e('0x1d')](_0xd68e('0x1e'),_0x7a7d83));return _0x358505(_0x334d8c[_0xd68e('0x1f')]);})[_0xd68e('0x19')](function(_0x3b00a3){_0xe016ee(_0x3b00a3);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x20b19e,_0x5c2c76){return amiClient[_0xd68e('0x13')](_0xd68e('0x20'),{})[_0xd68e('0x15')](function(_0x254da7){if(_0x254da7[_0xd68e('0x10')])throw new Error(_0xd68e('0x21'));return _0x20b19e(_0x254da7[_0xd68e('0x1f')]);})['catch'](function(_0x51816f){_0x5c2c76(_0x51816f);});});}function initializeQueues(_0x10cf36,_0x3d5d12,_0x5adc28,_0x2911e3){var _0x5aaf0a=[_0xd68e('0x22'),_0xd68e('0x23'),_0xd68e('0x24'),_0xd68e('0x25'),_0xd68e('0x26')];if(_0x5adc28===_0xd68e('0x1a')&&_0x2911e3===_0xd68e('0x27')){_0x5aaf0a[_0xd68e('0x28')](_0xd68e('0x29'),_0xd68e('0x2a'),'message',_0xd68e('0x2b'),'dialMethod',_0xd68e('0x2c'),_0xd68e('0x2d'),_0xd68e('0x2e'),_0xd68e('0x2f'),_0xd68e('0x30'),_0xd68e('0x31'),_0xd68e('0x32'),_0xd68e('0x33'),_0xd68e('0x34'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xd68e('0x35'),_0xd68e('0x36'),_0xd68e('0x37'),_0xd68e('0x38'),_0xd68e('0x39'),_0xd68e('0x3a'));}return _0x10cf36['map'](function(_0x37b159){var _0x42a63b=_0x37b159['get']({'plain':!![]});_0x42a63b[_0xd68e('0x3b')]=[];_0x42a63b[_0xd68e('0x26')]=0x0;_0x42a63b['loggedInDb']=0x0;_0x42a63b[_0xd68e('0x22')]=0x0;_0x42a63b[_0xd68e('0x23')]=0x0;_0x42a63b[_0xd68e('0x24')]=0x0;if(_0x5adc28==='voice'){_0x42a63b[_0xd68e('0x25')]=0x0;_0x42a63b['busy']=0x0;if(_0x2911e3==='outbound'){_0x42a63b[_0xd68e('0x29')]=0x0;_0x42a63b[_0xd68e('0x2a')]=0x0;}}var _0xf8ccdc=_['find'](_0x3d5d12,['id',_0x42a63b['id']]);if(_0xf8ccdc)_['merge'](_0x42a63b,_[_0xd68e('0x3c')](_0xf8ccdc,_0x5aaf0a));return _0x42a63b;});}function updateAgentVoiceStatus(_0xd8fc12,_0x1762d1,_0x5926e8){var _0x387455=_[_0xd68e('0x3d')](_0x5926e8,[_0xd68e('0x3e'),_0x1762d1['name']]);if(_0x387455[_0xd68e('0x3f')]===0x0)return _0xd8fc12[_0xd68e('0x40')]=!![];if(_[_0xd68e('0x41')](_0x387455,[_0xd68e('0x42'),_0xd8fc12[_0xd68e('0x43')][_0xd68e('0x44')]()]))return _0xd8fc12[_0xd68e('0x25')]=!![];if(!_0xd8fc12[_0xd68e('0x25')])return _0xd8fc12[_0xd68e('0x40')]=!![];}function getVoiceQueueAgents(_0x2972db,_0x4ee1be,_0x530450,_0x353eb4){var _0x3ec581=_[_0xd68e('0x45')](_0x4ee1be,['id',_0x2972db['id']]);if(!_0x3ec581)return _0x2972db;return _0x3ec581[_0xd68e('0x46')]({'raw':!![]})[_0xd68e('0x15')](function(_0x501b4c){for(var _0x892e57=0x0;_0x892e57<_0x501b4c['length'];_0x892e57++){var _0x52e927=_[_0xd68e('0x45')](_0x530450,['id',_0x501b4c[_0x892e57][_0xd68e('0x47')]]);if(!_0x52e927){_0x52e927={'id':_0x501b4c[_0x892e57][_0xd68e('0x47')],'name':_0x501b4c[_0x892e57][_0xd68e('0x47')],'accountcode':'','online':![]};}var _0x294bc1={'id':_0x52e927['id'],'name':_0x52e927[_0xd68e('0x11')],'internal':_0x52e927['accountcode'],'online':Boolean(_0x52e927[_0xd68e('0x48')]),'paused':Boolean(_0x501b4c[_0x892e57][_0xd68e('0x26')])};if(_0x52e927[_0xd68e('0x49')]===_0xd68e('0x25'))updateAgentVoiceStatus(_0x294bc1,_0x2972db,_0x353eb4);if(_0x294bc1['online'])_0x2972db[_0xd68e('0x4a')]++;if(_0x294bc1[_0xd68e('0x40')])_0x2972db[_0xd68e('0x40')]++;if(_0x294bc1['paused']&&!_0x294bc1[_0xd68e('0x40')]&&!_0x294bc1[_0xd68e('0x25')])_0x2972db['paused']++;_0x2972db[_0xd68e('0x3b')][_0xd68e('0x28')](_0x294bc1);}return _0x2972db;});}function getQueueAgents(_0x28753c,_0x15c9f5,_0x50b9c4){var _0x518500=_0xd68e('0x4b')+_[_0xd68e('0x1b')](_0x50b9c4)+_0xd68e('0x4c');var _0x2b1b63=_0x50b9c4+_0xd68e('0x4d');return db[_0x518500]['findAll']({'where':{[_[_0xd68e('0x1b')](_0x50b9c4)+_0xd68e('0x4e')]:_0x28753c['id']},'raw':!![]})[_0xd68e('0x15')](function(_0x42d374){for(var _0x34ce2e=0x0;_0x34ce2e<_0x42d374[_0xd68e('0x3f')];_0x34ce2e++){var _0x23e1ff=_[_0xd68e('0x45')](_0x15c9f5,['id',_0x42d374[_0x34ce2e][_0xd68e('0x47')]]);if(!_0x23e1ff){_0x23e1ff={'id':_0x42d374[_0x34ce2e][_0xd68e('0x47')],'name':_0x42d374[_0x34ce2e]['UserId'],'online':![],['pauseField']:![]};}var _0x53da38={'id':_0x23e1ff['id'],'name':_0x23e1ff[_0xd68e('0x11')],'online':Boolean(_0x23e1ff[_0xd68e('0x48')]),'paused':Boolean(_0x23e1ff[_0x2b1b63])};if(_0x53da38['online'])_0x28753c['loggedInDb']++;_0x28753c['agents']['push'](_0x53da38);}return _0x28753c;});}function isIdle(_0x2426c4){return _0x2426c4==='idle'||_0x2426c4==='unknown'||_0x2426c4==='unavailable'||_0x2426c4===_0xd68e('0x4f')||_[_0xd68e('0x50')](_0x2426c4);}function isAgentPaused(_0x45fa0a,_0x3a59e3){var _0x4e31cf=[_0x45fa0a['chatPause'],_0x45fa0a[_0xd68e('0x51')],_0x45fa0a[_0xd68e('0x52')],_0x45fa0a[_0xd68e('0x53')],_0x45fa0a[_0xd68e('0x54')],_0x45fa0a[_0xd68e('0x55')],_0x45fa0a[_0xd68e('0x56')]];if(!_0x3a59e3)return _[_0xd68e('0x57')](_0x4e31cf);var _0xa20575=_[_0xd68e('0x3d')](_0x4e31cf);return _0xa20575[_0xd68e('0x3f')]>0x0&&_0xa20575[_0xd68e('0x3f')]<_0x4e31cf[_0xd68e('0x3f')]?!![]:![];}function isAgentIdle(_0x11ade6){if(_0x11ade6['voiceStatus']!==_0xd68e('0x58')&&_0x11ade6['voicePause']){_0x11ade6[_0xd68e('0x49')]=_0xd68e('0x59');return![];}return _[_0xd68e('0x57')]([_0x11ade6['chatStatus'],_0x11ade6[_0xd68e('0x5a')],_0x11ade6['mailStatus'],_0x11ade6['openchannelStatus'],_0x11ade6['smsStatus'],_0x11ade6['voiceStatus'],_0x11ade6['whatsappStatus']],isIdle);}function getAgentStatus(_0x18b101){var _0x361edf=_0xd68e('0x5b');if(isAgentPaused(_0x18b101))_0x361edf=_0xd68e('0x59');else if(isAgentPaused(_0x18b101,!![]))_0x361edf=_0xd68e('0x5c');else if(isAgentIdle(_0x18b101))_0x361edf=_0xd68e('0x58');else _0x361edf=_0xd68e('0x40');return _0x361edf;}function validateChannel(_0x15e8c3){var _0x3bafe8=[_0xd68e('0x5d'),_0xd68e('0x5e'),_0xd68e('0x5f'),'openchannel',_0xd68e('0x60'),'whatsapp','voice'];if(!_[_0xd68e('0x61')](_0x3bafe8,_0x15e8c3[_0xd68e('0x62')]()))throw new Error(_0xd68e('0x63'));return _0x15e8c3[_0xd68e('0x62')]();}function getFilteredAgentIds(_0x51af77,_0x5547d3){var _0x589798=_['isArray'](_0x51af77)?_0x51af77:[_0x51af77];var _0x2ee7a0=_[_0xd68e('0x64')](_0x589798,function(_0x2e6151){return db[_0x5547d3][_0xd68e('0x65')]({'where':{'name':_0x2e6151}})['then'](function(_0xa5dfe5){if(!_0xa5dfe5)return[];return _0xa5dfe5[_0xd68e('0x66')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd68e('0x67')](_0x2ee7a0)['then'](function(_0x131bab){var _0x738c64=_(_0x131bab)['flatten']()[_0xd68e('0x64')]('id')[_0xd68e('0x68')]()[_0xd68e('0x69')]();return _0x738c64;});}function getUpdatedSortOptions(_0x2a8a07){var _0x1af244={'fields':[],'order':null};var _0x49821c=_0x2a8a07[_0xd68e('0x6a')](',');_0x1af244['fields']=_['filter'](_0x49821c,function(_0xe8af62){if(!_0xe8af62['includes']('globalStatus'))return!![];_0x1af244[_0xd68e('0x6b')]=_[_0xd68e('0x6c')](_0xe8af62,'-')?_0xd68e('0x6d'):_0xd68e('0x6e');return![];});return _0x1af244;}function orderAgentsByStatus(_0x1eae38,_0x1dbb4d){return _0x1eae38['sort'](function(_0x5ae507,_0x34bebb){if(_0x5ae507[_0xd68e('0x6f')]===_0x34bebb[_0xd68e('0x6f')]&&_0x5ae507['globalStatus']===_0xd68e('0x59')){if(_0x1dbb4d==='DESC')return(_0x5ae507[_0xd68e('0x70')]||'')<(_0x34bebb['pauseType']||'')?0x1:-0x1;return _0x5ae507[_0xd68e('0x70')]<_0x34bebb[_0xd68e('0x70')]?-0x1:0x1;}else{if(_0x1dbb4d==='DESC')return _0x5ae507[_0xd68e('0x6f')]<_0x34bebb[_0xd68e('0x6f')]?0x1:-0x1;return _0x5ae507[_0xd68e('0x6f')]<_0x34bebb['globalStatus']?-0x1:0x1;}});}exports[_0xd68e('0x66')]=function(_0x463fc7,_0x46022f){var _0x3f0a57={'count':0x0,'rows':[]},_0x379eaf={},_0x416500,_0x4b330b,_0x45b70f,_0x582157,_0x4b6149=[_0xd68e('0x71'),_0xd68e('0x48'),_0xd68e('0x72'),'lastPauseAt',_0xd68e('0x70'),'lastPauseAt','internal',_0xd68e('0x73'),_0xd68e('0x74'),'openchannelPause','mailPause','smsPause',_0xd68e('0x56'),_0xd68e('0x51'),'voicePause',_0xd68e('0x75'),_0xd68e('0x76'),_0xd68e('0x77'),'smsCapacity',_0xd68e('0x78'),'faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity',_0xd68e('0x79'),_0xd68e('0x7a'),_0xd68e('0x7b'),_0xd68e('0x7c'),_0xd68e('0x7d'),_0xd68e('0x7e'),'mailStatus',_0xd68e('0x7f'),_0xd68e('0x80'),_0xd68e('0x5a'),_0xd68e('0x49'),_0xd68e('0x81'),_0xd68e('0x82'),_0xd68e('0x83'),_0xd68e('0x84'),'whatsappStatusTime',_0xd68e('0x85'),_0xd68e('0x86'),_0xd68e('0x3e'),_0xd68e('0x87'),_0xd68e('0x88'),'phoneBarEnableScreenRecordingByAgent',_0xd68e('0x89'),'routealias'],_0x1fa4b0=[_0xd68e('0x74'),_0xd68e('0x53'),_0xd68e('0x52'),_0xd68e('0x54'),_0xd68e('0x56'),_0xd68e('0x51'),_0xd68e('0x55'),_0xd68e('0x48')];Promise[_0xd68e('0x8a')]()[_0xd68e('0x15')](function(){if(_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8c')])_0x416500=validateChannel(_0x463fc7['query']['channel']);if(!_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8d')]||!_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8d')]['includes'](_0xd68e('0x6f')))return;var _0x594086=getUpdatedSortOptions(_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8d')]);_0x463fc7['query'][_0xd68e('0x8d')]=_0x594086['fields']['join'](',');_0x4b330b=_0x594086[_0xd68e('0x6b')];})[_0xd68e('0x15')](function(){if(!_0x463fc7[_0xd68e('0x8b')]['globalQueueFilter'])return[];var _0x295d65=_['startCase'](_0x416500)+_0xd68e('0x4c');return getFilteredAgentIds(_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x8e')],_0x295d65);})[_0xd68e('0x15')](function(_0x596778){var _0xbb1eea=_['map'](db[_0xd68e('0x4b')][_0xd68e('0x8f')],function(_0xf066ff){return{'name':_0xf066ff[_0xd68e('0x90')],'type':_0xf066ff[_0xd68e('0x91')][_0xd68e('0x92')]};});_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x93')]=_0xd68e('0x94');_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x48')]=!![];_0x379eaf=qs['getOptions'](_0xbb1eea,_0x463fc7);_0x379eaf[_0xd68e('0x95')]=!![];if(!_[_0xd68e('0x96')](_0x596778)){_0x379eaf[_0xd68e('0x97')]=_[_0xd68e('0x18')](_0x379eaf[_0xd68e('0x97')],{'$and':[{'id':{'$in':_0x596778}}]});}else if(!_[_0xd68e('0x96')](_0x463fc7['query'][_0xd68e('0x8e')])){return _0x3f0a57;}if(_0x463fc7[_0xd68e('0x98')]['role']===_0xd68e('0x98')){var _0x51483e={'params':{'id':_0x463fc7[_0xd68e('0x98')][_0xd68e('0x99')]},'query':{'section':_0xd68e('0x14'),'role':_0xd68e('0x94'),'online':!![],'nolimit':_0x463fc7[_0xd68e('0x8b')][_0xd68e('0x9a')],'sort':_0x463fc7[_0xd68e('0x8b')]['sort'],'filter':_0x463fc7['query']['filter'],'raw':!![],'ids':_0x596778}};return db[_0xd68e('0x9b')][_0xd68e('0x9c')](_0x51483e);}return db[_0xd68e('0x4b')][_0xd68e('0x9d')](_0x379eaf);})[_0xd68e('0x15')](function(_0x5d41ec){_0x3f0a57[_0xd68e('0xb')]=_0x5d41ec[_0xd68e('0xb')];_0x45b70f=_0x5d41ec[_0xd68e('0x9e')];return getRealtimeAgents();})[_0xd68e('0x15')](function(_0x1ae042){_0x582157=_0x1ae042[_0xd68e('0x9e')];return _0x45b70f[_0xd68e('0x64')](function(_0x462690){var _0x15eed9=_[_0xd68e('0x45')](_0x582157,['id',_0x462690['id']]);if(_0x15eed9)_['merge'](_0x462690,_[_0xd68e('0x3c')](_[_0xd68e('0x9f')](_0x15eed9,_0x1fa4b0),_0x4b6149));_0x462690['globalStatus']=getAgentStatus(_0x462690);return _0x462690;});})['then'](function(_0x20fe17){var _0x4bc199;if(_0x463fc7['query'][_0xd68e('0xa0')]){_0x4bc199=_[_0xd68e('0x3d')](_0x20fe17,[_0xd68e('0x6f'),_0x463fc7[_0xd68e('0x8b')][_0xd68e('0xa0')]]);if(_0x463fc7[_0xd68e('0x8b')]['pauseTypeFilter']){_0x4bc199=_['filter'](_0x4bc199,[_0xd68e('0x70'),_0x463fc7[_0xd68e('0x8b')][_0xd68e('0xa1')]]);}}if(_0x4bc199)_0x20fe17=_0x4bc199;if(!_0x4b330b)return _0x20fe17;return orderAgentsByStatus(_0x20fe17,_0x4b330b);})['then'](function(_0x33d61e){_0x3f0a57[_0xd68e('0x9e')]=_0x33d61e;return _0x3f0a57;})[_0xd68e('0x15')](respondWithFilteredResult(_0x46022f,_0x379eaf))[_0xd68e('0x19')](handleError(_0x46022f,null));};exports[_0xd68e('0xa2')]=function(_0x128e79,_0x269815){var _0x14f139={'count':0x0,'rows':[]},_0x2ed161={},_0x5f3da6,_0x44088a,_0x4519bb,_0x1e0c9a,_0x3c614d;Promise[_0xd68e('0x8a')]()['then'](function(){if(_0x128e79['query'][_0xd68e('0x8c')])_0x5f3da6=validateChannel(_0x128e79['query'][_0xd68e('0x8c')]);var _0x47982b=_['startCase'](_0x5f3da6)+'Queue';var _0x1f46ff=_['map'](db[_0x47982b]['rawAttributes'],function(_0x25b561){return{'name':_0x25b561[_0xd68e('0x90')],'type':_0x25b561[_0xd68e('0x91')][_0xd68e('0x92')]};});_0x2ed161=qs[_0xd68e('0xa3')](_0x1f46ff,_0x128e79);if(_0x128e79[_0xd68e('0x98')]['role']===_0xd68e('0x98')){var _0x30279e={'params':{'id':_0x128e79['user'][_0xd68e('0x99')]},'query':{'section':_0x5f3da6===_0xd68e('0x1a')&&_0x128e79['query']['type']===_0xd68e('0x27')?_0xd68e('0xa4'):_[_0xd68e('0x1b')](_0x5f3da6)+'Queues','type':_0x128e79[_0xd68e('0x8b')]['type'],'nolimit':!![],'sort':_0xd68e('0x11'),'filter':_0x128e79[_0xd68e('0x8b')][_0xd68e('0x3d')]}};return db[_0xd68e('0x9b')]['getResources'](_0x30279e);}return db[_0x47982b]['findAndCountAll'](_0x2ed161);})[_0xd68e('0x15')](function(_0x5cee90){_0x14f139[_0xd68e('0xb')]=_0x5cee90[_0xd68e('0xb')];_0x44088a=_0x5cee90['rows'];return getRealtimeQueues(_0x128e79,_0x5f3da6);})[_0xd68e('0x15')](function(_0x425ec8){_0x1e0c9a=_0x425ec8[_0xd68e('0x9e')];return getRealtimeAgents();})['then'](function(_0x53b046){_0x4519bb=_0x53b046['rows'];if(_0x5f3da6!=_0xd68e('0x1a'))return;return getRealtimeVoiceQueueChannels();})[_0xd68e('0x15')](function(_0x26afc8){_0x3c614d=_0x26afc8?_0x26afc8['rows']:[];return initializeQueues(_0x44088a,_0x1e0c9a,_0x5f3da6,_0x128e79[_0xd68e('0x8b')][_0xd68e('0x91')]);})[_0xd68e('0x15')](function(_0x4f953c){var _0xe61fc=_0x4f953c[_0xd68e('0x64')](function(_0x2f517b){if(_0x5f3da6==='voice')return getVoiceQueueAgents(_0x2f517b,_0x44088a,_0x4519bb,_0x3c614d);else return getQueueAgents(_0x2f517b,_0x4519bb,_0x5f3da6);});return Promise['all'](_0xe61fc);})[_0xd68e('0x15')](function(_0x53edde){_0x14f139[_0xd68e('0x9e')]=_0x53edde;return _0x14f139;})[_0xd68e('0x15')](respondWithFilteredResult(_0x269815,_0x2ed161))[_0xd68e('0x19')](handleError(_0x269815,null));}; \ No newline at end of file +var _0x3ea3=['isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','type','QueueCampaigns','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','name','send','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','paused','outbound','pTalking','originated','message','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','loggedInDb','busy','find','pick','filter','queue','length','connectedlinenum','internal','getMembers','UserId','accountcode','online','voiceStatus','push','Queue','findAll','QueueId','idle','unknown','unavailable','isNil','faxPause','mailPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','Invalid\x20channel','isArray','findOne','getAgents','all','uniq','fields','globalStatus','startsWith','DESC','ASC','sort','pauseType','userpic','lastLoginAt','lastPauseAt','address','chatPause','openchannelPause','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','smsCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','query','channel','join','globalQueueFilter','User','rawAttributes','fieldName','key','role','agent','getOptions','raw'];(function(_0x1bb340,_0x2cce8b){var _0x42b2d0=function(_0x50dbf6){while(--_0x50dbf6){_0x1bb340['push'](_0x1bb340['shift']());}};_0x42b2d0(++_0x2cce8b);}(_0x3ea3,0xb0));var _0x33ea=function(_0x1a53b5,_0x2649a4){_0x1a53b5=_0x1a53b5-0x0;var _0x5d8029=_0x3ea3[_0x1a53b5];return _0x5d8029;};'use strict';var util=require(_0x33ea('0x0'));var _=require(_0x33ea('0x1'));var jayson=require(_0x33ea('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x33ea('0x3'))(_0x33ea('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x33ea('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0x33ea('0x5')][_0x33ea('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xc4a3f8,_0x3fee5c){return function(_0x1128af){if(_0x1128af){var _0xcd3bee=typeof _0x3fee5c[_0x33ea('0x7')]===_0x33ea('0x8')&&typeof _0x3fee5c[_0x33ea('0x9')]==='undefined';var _0x479dde=_0x1128af['count'];var _0x3feec1=_0xcd3bee?0x0:_0x3fee5c['offset'];var _0x491964=_0xcd3bee?_0x1128af[_0x33ea('0xa')]:_0x3fee5c['offset']+_0x3fee5c['limit'];var _0x227968;if(_0x491964>=_0x479dde){_0x491964=_0x479dde;_0x227968=0xc8;}else{_0x227968=0xce;}_0xc4a3f8[_0x33ea('0xb')](_0x227968);return _0xc4a3f8[_0x33ea('0xc')](_0x33ea('0xd'),_0x3feec1+'-'+_0x491964+'/'+_0x479dde)['json'](_0x1128af);}return null;};}function handleError(_0x5b0a86,_0x32dfef){_0x32dfef=_0x32dfef||0x1f4;return function(_0x6d0e21){logger[_0x33ea('0xe')](_0x6d0e21[_0x33ea('0xf')]);if(_0x6d0e21['name']){delete _0x6d0e21[_0x33ea('0x10')];}_0x5b0a86[_0x33ea('0xb')](_0x32dfef)[_0x33ea('0x11')](_0x6d0e21);};}function getRealtimeAgents(){return new Promise(function(_0x338dea,_0x3e0f58){return amiClient['request'](_0x33ea('0x12'),{})['then'](function(_0x116e7b){if(_0x116e7b[_0x33ea('0xe')])throw new Error(_0x33ea('0x13'));var _0x5487ea=_0x116e7b[_0x33ea('0x14')];return routingClient['request']('Agents',{})['then'](function(_0x3eec47){if(_0x3eec47[_0x33ea('0xe')])throw new Error(_0x33ea('0x15'));var _0x3a65c7=_0x3eec47[_0x33ea('0x14')];return _0x338dea(_[_0x33ea('0x16')]({},_0x5487ea,_0x3a65c7));});})[_0x33ea('0x17')](function(_0x37ae4b){_0x3e0f58(_0x37ae4b);});});}function getRealtimeQueues(_0x524f4f,_0x37aebd){return new Promise(function(_0x4fe8b5,_0x4702f7){var _0x3d8ce9=_0x37aebd===_0x33ea('0x18')?amiClient:routingClient;return _0x3d8ce9[_0x33ea('0x19')](_[_0x33ea('0x1a')](_0x37aebd)+_0x33ea('0x1b'),_0x524f4f)[_0x33ea('0x1c')](function(_0x56306b){if(_0x56306b[_0x33ea('0xe')])throw new Error(util[_0x33ea('0x1d')](_0x33ea('0x1e'),_0x37aebd));return _0x4fe8b5(_0x56306b[_0x33ea('0x14')]);})['catch'](function(_0x3ee232){_0x4702f7(_0x3ee232);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x267876,_0x35806f){return amiClient[_0x33ea('0x19')]('VoiceQueuesChannels',{})['then'](function(_0x1e9df2){if(_0x1e9df2[_0x33ea('0xe')])throw new Error(_0x33ea('0x1f'));return _0x267876(_0x1e9df2[_0x33ea('0x14')]);})[_0x33ea('0x17')](function(_0x56489e){_0x35806f(_0x56489e);});});}function initializeQueues(_0x436c53,_0x44e9d2,_0x9bfbfa,_0x18bc8c){var _0x1b98d2=[_0x33ea('0x20'),'available',_0x33ea('0x21'),_0x33ea('0x22'),_0x33ea('0x23')];if(_0x9bfbfa===_0x33ea('0x18')&&_0x18bc8c===_0x33ea('0x24')){_0x1b98d2['push'](_0x33ea('0x25'),_0x33ea('0x26'),_0x33ea('0x27'),_0x33ea('0x28'),'dialMethod',_0x33ea('0x29'),_0x33ea('0x2a'),'startProgressive',_0x33ea('0x2b'),_0x33ea('0x2c'),_0x33ea('0x2d'),_0x33ea('0x2e'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x33ea('0x2f'),_0x33ea('0x30'),_0x33ea('0x31'),'predictiveIntervalAnsweredCalls',_0x33ea('0x32'),_0x33ea('0x33'),_0x33ea('0x34'),_0x33ea('0x35'));}return _0x436c53[_0x33ea('0x36')](function(_0x417d1b){var _0x138ac8=_0x417d1b['get']({'plain':!![]});_0x138ac8[_0x33ea('0x37')]=[];_0x138ac8['paused']=0x0;_0x138ac8[_0x33ea('0x38')]=0x0;_0x138ac8[_0x33ea('0x20')]=0x0;_0x138ac8['available']=0x0;_0x138ac8['waiting']=0x0;if(_0x9bfbfa===_0x33ea('0x18')){_0x138ac8['talking']=0x0;_0x138ac8[_0x33ea('0x39')]=0x0;if(_0x18bc8c===_0x33ea('0x24')){_0x138ac8[_0x33ea('0x25')]=0x0;_0x138ac8[_0x33ea('0x26')]=0x0;}}var _0x1995ab=_[_0x33ea('0x3a')](_0x44e9d2,['id',_0x138ac8['id']]);if(_0x1995ab)_[_0x33ea('0x16')](_0x138ac8,_[_0x33ea('0x3b')](_0x1995ab,_0x1b98d2));return _0x138ac8;});}function updateAgentVoiceStatus(_0x4bea03,_0x369079,_0x297e79){var _0x10cd1e=_[_0x33ea('0x3c')](_0x297e79,[_0x33ea('0x3d'),_0x369079['name']]);if(_0x10cd1e[_0x33ea('0x3e')]===0x0)return _0x4bea03[_0x33ea('0x39')]=!![];if(_['some'](_0x10cd1e,[_0x33ea('0x3f'),_0x4bea03[_0x33ea('0x40')]['toString']()]))return _0x4bea03[_0x33ea('0x22')]=!![];if(!_0x4bea03['talking'])return _0x4bea03[_0x33ea('0x39')]=!![];}function getVoiceQueueAgents(_0x406981,_0x5ab6f1,_0x2a972c,_0x5ae1ee){var _0x16946e=_[_0x33ea('0x3a')](_0x5ab6f1,['id',_0x406981['id']]);if(!_0x16946e)return _0x406981;return _0x16946e[_0x33ea('0x41')]({'raw':!![]})['then'](function(_0x5403ee){for(var _0x2b4f70=0x0;_0x2b4f70<_0x5403ee[_0x33ea('0x3e')];_0x2b4f70++){var _0x12a956=_[_0x33ea('0x3a')](_0x2a972c,['id',_0x5403ee[_0x2b4f70][_0x33ea('0x42')]]);if(!_0x12a956){_0x12a956={'id':_0x5403ee[_0x2b4f70][_0x33ea('0x42')],'name':_0x5403ee[_0x2b4f70][_0x33ea('0x42')],'accountcode':'','online':![]};}var _0x521b36={'id':_0x12a956['id'],'name':_0x12a956[_0x33ea('0x10')],'internal':_0x12a956[_0x33ea('0x43')],'online':Boolean(_0x12a956[_0x33ea('0x44')]),'paused':Boolean(_0x5403ee[_0x2b4f70][_0x33ea('0x23')])};if(_0x12a956[_0x33ea('0x45')]===_0x33ea('0x22'))updateAgentVoiceStatus(_0x521b36,_0x406981,_0x5ae1ee);if(_0x521b36[_0x33ea('0x44')])_0x406981[_0x33ea('0x38')]++;if(_0x521b36['busy'])_0x406981['busy']++;if(_0x521b36[_0x33ea('0x23')]&&!_0x521b36[_0x33ea('0x39')]&&!_0x521b36[_0x33ea('0x22')])_0x406981[_0x33ea('0x23')]++;_0x406981[_0x33ea('0x37')][_0x33ea('0x46')](_0x521b36);}return _0x406981;});}function getQueueAgents(_0x3f14b0,_0x36f661,_0x44bb8){var _0x2cf864='User'+_[_0x33ea('0x1a')](_0x44bb8)+_0x33ea('0x47');var _0x4108b3=_0x44bb8+'Pause';return db[_0x2cf864][_0x33ea('0x48')]({'where':{[_[_0x33ea('0x1a')](_0x44bb8)+_0x33ea('0x49')]:_0x3f14b0['id']},'raw':!![]})['then'](function(_0x166064){for(var _0x2f7e4f=0x0;_0x2f7e4f<_0x166064['length'];_0x2f7e4f++){var _0x28c330=_['find'](_0x36f661,['id',_0x166064[_0x2f7e4f][_0x33ea('0x42')]]);if(!_0x28c330){_0x28c330={'id':_0x166064[_0x2f7e4f][_0x33ea('0x42')],'name':_0x166064[_0x2f7e4f][_0x33ea('0x42')],'online':![],['pauseField']:![]};}var _0x4e608e={'id':_0x28c330['id'],'name':_0x28c330['name'],'online':Boolean(_0x28c330[_0x33ea('0x44')]),'paused':Boolean(_0x28c330[_0x4108b3])};if(_0x4e608e[_0x33ea('0x44')])_0x3f14b0['loggedInDb']++;_0x3f14b0[_0x33ea('0x37')][_0x33ea('0x46')](_0x4e608e);}return _0x3f14b0;});}function isIdle(_0x665c0a){return _0x665c0a===_0x33ea('0x4a')||_0x665c0a===_0x33ea('0x4b')||_0x665c0a===_0x33ea('0x4c')||_0x665c0a==='ringing'||_[_0x33ea('0x4d')](_0x665c0a);}function isAgentPaused(_0x417d6e,_0x29eada){var _0x14bbdc=[_0x417d6e['chatPause'],_0x417d6e[_0x33ea('0x4e')],_0x417d6e[_0x33ea('0x4f')],_0x417d6e['openchannelPause'],_0x417d6e['smsPause'],_0x417d6e[_0x33ea('0x50')],_0x417d6e[_0x33ea('0x51')]];if(!_0x29eada)return _[_0x33ea('0x52')](_0x14bbdc);var _0x13cce7=_[_0x33ea('0x3c')](_0x14bbdc);return _0x13cce7[_0x33ea('0x3e')]>0x0&&_0x13cce7[_0x33ea('0x3e')]<_0x14bbdc[_0x33ea('0x3e')]?!![]:![];}function isAgentIdle(_0x328675){if(_0x328675[_0x33ea('0x45')]!=='idle'&&_0x328675[_0x33ea('0x50')]){_0x328675[_0x33ea('0x45')]=_0x33ea('0x53');return![];}return _[_0x33ea('0x52')]([_0x328675[_0x33ea('0x54')],_0x328675[_0x33ea('0x55')],_0x328675[_0x33ea('0x56')],_0x328675[_0x33ea('0x57')],_0x328675['smsStatus'],_0x328675[_0x33ea('0x45')],_0x328675[_0x33ea('0x58')]],isIdle);}function getAgentStatus(_0x2bb11f){var _0x156e2e=_0x33ea('0x4b');if(isAgentPaused(_0x2bb11f))_0x156e2e='pause';else if(isAgentPaused(_0x2bb11f,!![]))_0x156e2e=_0x33ea('0x59');else if(isAgentIdle(_0x2bb11f))_0x156e2e=_0x33ea('0x4a');else _0x156e2e=_0x33ea('0x39');return _0x156e2e;}function validateChannel(_0x407360){var _0x2c43f9=[_0x33ea('0x5a'),_0x33ea('0x5b'),_0x33ea('0x5c'),_0x33ea('0x5d'),_0x33ea('0x5e'),_0x33ea('0x5f'),'voice'];if(!_[_0x33ea('0x60')](_0x2c43f9,_0x407360[_0x33ea('0x61')]()))throw new Error(_0x33ea('0x62'));return _0x407360['toLowerCase']();}function getFilteredAgentIds(_0x7fea67,_0x33e364){var _0x2a009d=_[_0x33ea('0x63')](_0x7fea67)?_0x7fea67:[_0x7fea67];var _0x21ed29=_[_0x33ea('0x36')](_0x2a009d,function(_0x19d606){return db[_0x33e364][_0x33ea('0x64')]({'where':{'name':_0x19d606}})[_0x33ea('0x1c')](function(_0x11c536){if(!_0x11c536)return[];return _0x11c536[_0x33ea('0x65')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x33ea('0x66')](_0x21ed29)[_0x33ea('0x1c')](function(_0x4fb569){var _0xa0adf8=_(_0x4fb569)['flatten']()[_0x33ea('0x36')]('id')[_0x33ea('0x67')]()['value']();return _0xa0adf8;});}function getUpdatedSortOptions(_0x52aa41){var _0x1bd576={'fields':[],'order':null};var _0x26634d=_0x52aa41['split'](',');_0x1bd576[_0x33ea('0x68')]=_['filter'](_0x26634d,function(_0x9b9343){if(!_0x9b9343['includes'](_0x33ea('0x69')))return!![];_0x1bd576['order']=_[_0x33ea('0x6a')](_0x9b9343,'-')?_0x33ea('0x6b'):_0x33ea('0x6c');return![];});return _0x1bd576;}function orderAgentsByStatus(_0x795dc3,_0x3e69c5){return _0x795dc3[_0x33ea('0x6d')](function(_0x564c7a,_0x303cff){if(_0x564c7a[_0x33ea('0x69')]===_0x303cff[_0x33ea('0x69')]&&_0x564c7a[_0x33ea('0x69')]===_0x33ea('0x53')){if(_0x3e69c5===_0x33ea('0x6b'))return(_0x564c7a[_0x33ea('0x6e')]||'')<(_0x303cff['pauseType']||'')?0x1:-0x1;return _0x564c7a['pauseType']<_0x303cff[_0x33ea('0x6e')]?-0x1:0x1;}else{if(_0x3e69c5===_0x33ea('0x6b'))return _0x564c7a['globalStatus']<_0x303cff[_0x33ea('0x69')]?0x1:-0x1;return _0x564c7a[_0x33ea('0x69')]<_0x303cff[_0x33ea('0x69')]?-0x1:0x1;}});}exports[_0x33ea('0x65')]=function(_0x4fab7e,_0x3a80bf){var _0x2db340={'count':0x0,'rows':[]},_0x446d17={},_0x23cf35,_0x5dbf06,_0x97082d,_0x27b563,_0xe29633=[_0x33ea('0x6f'),_0x33ea('0x44'),_0x33ea('0x70'),_0x33ea('0x71'),'pauseType',_0x33ea('0x71'),_0x33ea('0x40'),_0x33ea('0x72'),_0x33ea('0x73'),_0x33ea('0x74'),_0x33ea('0x4f'),_0x33ea('0x75'),_0x33ea('0x51'),_0x33ea('0x4e'),_0x33ea('0x50'),_0x33ea('0x76'),_0x33ea('0x77'),_0x33ea('0x78'),_0x33ea('0x79'),_0x33ea('0x7a'),_0x33ea('0x7b'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity',_0x33ea('0x7c'),'whatsappCurrentCapacity',_0x33ea('0x7d'),_0x33ea('0x54'),'openchannelStatus',_0x33ea('0x56'),_0x33ea('0x7e'),_0x33ea('0x58'),_0x33ea('0x55'),_0x33ea('0x45'),_0x33ea('0x7f'),'openchannelStatusTime',_0x33ea('0x80'),_0x33ea('0x81'),'whatsappStatusTime',_0x33ea('0x82'),'voiceStatusTime',_0x33ea('0x3d'),'destconnectedlinenum','screenrecording',_0x33ea('0x83'),_0x33ea('0x84'),'routealias'],_0x577903=['chatPause','openchannelPause','mailPause',_0x33ea('0x75'),_0x33ea('0x51'),_0x33ea('0x4e'),'voicePause',_0x33ea('0x44')];Promise[_0x33ea('0x85')]()['then'](function(){if(_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x87')])_0x23cf35=validateChannel(_0x4fab7e[_0x33ea('0x86')]['channel']);if(!_0x4fab7e['query'][_0x33ea('0x6d')]||!_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x6d')][_0x33ea('0x60')]('globalStatus'))return;var _0x26bef5=getUpdatedSortOptions(_0x4fab7e['query'][_0x33ea('0x6d')]);_0x4fab7e[_0x33ea('0x86')]['sort']=_0x26bef5[_0x33ea('0x68')][_0x33ea('0x88')](',');_0x5dbf06=_0x26bef5['order'];})[_0x33ea('0x1c')](function(){if(!_0x4fab7e[_0x33ea('0x86')]['globalQueueFilter'])return[];var _0x48ec64=_[_0x33ea('0x1a')](_0x23cf35)+_0x33ea('0x47');return getFilteredAgentIds(_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x89')],_0x48ec64);})[_0x33ea('0x1c')](function(_0x937094){var _0x5f17b0=_[_0x33ea('0x36')](db[_0x33ea('0x8a')][_0x33ea('0x8b')],function(_0x20cc63){return{'name':_0x20cc63[_0x33ea('0x8c')],'type':_0x20cc63['type'][_0x33ea('0x8d')]};});_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x8e')]=_0x33ea('0x8f');_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x44')]=!![];_0x446d17=qs[_0x33ea('0x90')](_0x5f17b0,_0x4fab7e);_0x446d17[_0x33ea('0x91')]=!![];if(!_[_0x33ea('0x92')](_0x937094)){_0x446d17[_0x33ea('0x93')]=_[_0x33ea('0x16')](_0x446d17[_0x33ea('0x93')],{'$and':[{'id':{'$in':_0x937094}}]});}else if(!_[_0x33ea('0x92')](_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x89')])){return _0x2db340;}if(_0x4fab7e[_0x33ea('0x94')][_0x33ea('0x8e')]===_0x33ea('0x94')){var _0x2b3815={'params':{'id':_0x4fab7e[_0x33ea('0x94')][_0x33ea('0x95')]},'query':{'section':_0x33ea('0x12'),'role':_0x33ea('0x8f'),'online':!![],'nolimit':_0x4fab7e['query'][_0x33ea('0x96')],'sort':_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x6d')],'filter':_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x3c')],'raw':!![],'ids':_0x937094}};return db[_0x33ea('0x97')][_0x33ea('0x98')](_0x2b3815);}return db[_0x33ea('0x8a')][_0x33ea('0x99')](_0x446d17);})[_0x33ea('0x1c')](function(_0x5c1a0a){_0x2db340[_0x33ea('0xa')]=_0x5c1a0a[_0x33ea('0xa')];_0x97082d=_0x5c1a0a[_0x33ea('0x9a')];return getRealtimeAgents();})[_0x33ea('0x1c')](function(_0x54bcbf){_0x27b563=_0x54bcbf['rows'];return _0x97082d[_0x33ea('0x36')](function(_0x5725fe){var _0x4a79d3=_[_0x33ea('0x3a')](_0x27b563,['id',_0x5725fe['id']]);if(_0x4a79d3)_['merge'](_0x5725fe,_[_0x33ea('0x3b')](_[_0x33ea('0x9b')](_0x4a79d3,_0x577903),_0xe29633));_0x5725fe['globalStatus']=getAgentStatus(_0x5725fe);return _0x5725fe;});})[_0x33ea('0x1c')](function(_0x1c4dd2){var _0x204f75;if(_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x9c')]){_0x204f75=_['filter'](_0x1c4dd2,[_0x33ea('0x69'),_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x9c')]]);if(_0x4fab7e[_0x33ea('0x86')]['pauseTypeFilter']){_0x204f75=_['filter'](_0x204f75,[_0x33ea('0x6e'),_0x4fab7e[_0x33ea('0x86')][_0x33ea('0x9d')]]);}}if(_0x204f75)_0x1c4dd2=_0x204f75;if(!_0x5dbf06)return _0x1c4dd2;return orderAgentsByStatus(_0x1c4dd2,_0x5dbf06);})[_0x33ea('0x1c')](function(_0x45c3ba){_0x2db340[_0x33ea('0x9a')]=_0x45c3ba;return _0x2db340;})[_0x33ea('0x1c')](respondWithFilteredResult(_0x3a80bf,_0x446d17))[_0x33ea('0x17')](handleError(_0x3a80bf,null));};exports[_0x33ea('0x9e')]=function(_0x4ec9f1,_0x424dc0){var _0xb49233={'count':0x0,'rows':[]},_0xfe94e9={},_0x5e0ac9,_0x5ef683,_0x2dcc09,_0x3645a1,_0x1988cf;Promise['resolve']()[_0x33ea('0x1c')](function(){if(_0x4ec9f1['query']['channel'])_0x5e0ac9=validateChannel(_0x4ec9f1[_0x33ea('0x86')][_0x33ea('0x87')]);var _0x5798e7=_[_0x33ea('0x1a')](_0x5e0ac9)+'Queue';var _0x22ec50=_[_0x33ea('0x36')](db[_0x5798e7]['rawAttributes'],function(_0x4bc0c2){return{'name':_0x4bc0c2['fieldName'],'type':_0x4bc0c2[_0x33ea('0x9f')][_0x33ea('0x8d')]};});_0xfe94e9=qs[_0x33ea('0x90')](_0x22ec50,_0x4ec9f1);if(_0x4ec9f1[_0x33ea('0x94')][_0x33ea('0x8e')]===_0x33ea('0x94')){var _0x403f24={'params':{'id':_0x4ec9f1[_0x33ea('0x94')][_0x33ea('0x95')]},'query':{'section':_0x5e0ac9===_0x33ea('0x18')&&_0x4ec9f1[_0x33ea('0x86')][_0x33ea('0x9f')]===_0x33ea('0x24')?_0x33ea('0xa0'):_[_0x33ea('0x1a')](_0x5e0ac9)+_0x33ea('0x1b'),'type':_0x4ec9f1[_0x33ea('0x86')][_0x33ea('0x9f')],'nolimit':!![],'sort':_0x33ea('0x10'),'filter':_0x4ec9f1[_0x33ea('0x86')][_0x33ea('0x3c')]}};return db[_0x33ea('0x97')][_0x33ea('0x98')](_0x403f24);}return db[_0x5798e7][_0x33ea('0x99')](_0xfe94e9);})[_0x33ea('0x1c')](function(_0x4d2183){_0xb49233['count']=_0x4d2183[_0x33ea('0xa')];_0x5ef683=_0x4d2183[_0x33ea('0x9a')];return getRealtimeQueues(_0x4ec9f1,_0x5e0ac9);})[_0x33ea('0x1c')](function(_0x330635){_0x3645a1=_0x330635[_0x33ea('0x9a')];return getRealtimeAgents();})['then'](function(_0x7fc121){_0x2dcc09=_0x7fc121[_0x33ea('0x9a')];if(_0x5e0ac9!=_0x33ea('0x18'))return;return getRealtimeVoiceQueueChannels();})[_0x33ea('0x1c')](function(_0x47512b){_0x1988cf=_0x47512b?_0x47512b[_0x33ea('0x9a')]:[];return initializeQueues(_0x5ef683,_0x3645a1,_0x5e0ac9,_0x4ec9f1[_0x33ea('0x86')]['type']);})['then'](function(_0x3ecdd8){var _0x505252=_0x3ecdd8['map'](function(_0x462db4){if(_0x5e0ac9===_0x33ea('0x18'))return getVoiceQueueAgents(_0x462db4,_0x5ef683,_0x2dcc09,_0x1988cf);else return getQueueAgents(_0x462db4,_0x2dcc09,_0x5e0ac9);});return Promise[_0x33ea('0x66')](_0x505252);})['then'](function(_0x551554){_0xb49233['rows']=_0x551554;return _0xb49233;})[_0x33ea('0x1c')](respondWithFilteredResult(_0x424dc0,_0xfe94e9))[_0x33ea('0x17')](handleError(_0x424dc0,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4678428..d33bd7f 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2fb0cf,_0x24e884){var _0x4ebe3f=function(_0x347eb0){while(--_0x347eb0){_0x2fb0cf['push'](_0x2fb0cf['shift']());}};_0x4ebe3f(++_0x24e884);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x111614,_0x4a7ac4){var _0x2c958e=function(_0x227e95){while(--_0x227e95){_0x111614['push'](_0x111614['shift']());}};_0x2c958e(++_0x4a7ac4);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9e4cf57..d978247 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 _0xf360=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x5a331b,_0x2e1e09){var _0x35be6c=function(_0x17ccb1){while(--_0x17ccb1){_0x5a331b['push'](_0x5a331b['shift']());}};_0x35be6c(++_0x2e1e09);}(_0xf360,0x9e));var _0x0f36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf360[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'state':{'type':Sequelize[_0x0f36('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0f36('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0f36('0x3')]},'responsetime':{'type':Sequelize[_0x0f36('0x3')]},'ringtime':{'type':Sequelize[_0x0f36('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0f36('0x4')]},'membername':{'type':Sequelize[_0x0f36('0x4')]}}; \ No newline at end of file +var _0x8c8b=['DATE','sequelize','STRING'];(function(_0x2b1f6e,_0x5d16f1){var _0x37eb42=function(_0x5aaf4e){while(--_0x5aaf4e){_0x2b1f6e['push'](_0x2b1f6e['shift']());}};_0x37eb42(++_0x5d16f1);}(_0x8c8b,0x106));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xb8c8('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb8c8('0x1')]},'scheduledat':{'type':Sequelize[_0xb8c8('0x2')]},'uniqueid':{'type':Sequelize[_0xb8c8('0x1')]},'starttime':{'type':Sequelize[_0xb8c8('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb8c8('0x1')]},'campaigntype':{'type':Sequelize[_0xb8c8('0x1')]},'membername':{'type':Sequelize[_0xb8c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 1016334..5b84d2e 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 _0xb25a=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x1ddde3,_0x3a23cd){var _0x758f08=function(_0x59bbbb){while(--_0x59bbbb){_0x1ddde3['push'](_0x1ddde3['shift']());}};_0x758f08(++_0x3a23cd);}(_0xb25a,0xa6));var _0xab25=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb25a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xab25('0x0'));var util=require(_0xab25('0x1'));var logger=require(_0xab25('0x2'))(_0xab25('0x3'));var moment=require(_0xab25('0x4'));var BPromise=require(_0xab25('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab25('0x6'));var config=require(_0xab25('0x7'));var attributes=require(_0xab25('0x8'));module['exports']=function(_0x3c95b6,_0x44cf67){return _0x3c95b6['define'](_0xab25('0x9'),attributes,{'tableName':_0xab25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x874f=['bluebird','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','lodash','util','../../config/logger','moment'];(function(_0x55c1bb,_0x37c7a0){var _0xc6d2f7=function(_0x2bf5c1){while(--_0x2bf5c1){_0x55c1bb['push'](_0x55c1bb['shift']());}};_0xc6d2f7(++_0x37c7a0);}(_0x874f,0x164));var _0xf874=function(_0x47c5bd,_0x7605da){_0x47c5bd=_0x47c5bd-0x0;var _0x2447dc=_0x874f[_0x47c5bd];return _0x2447dc;};'use strict';var _=require(_0xf874('0x0'));var util=require(_0xf874('0x1'));var logger=require(_0xf874('0x2'))('api');var moment=require(_0xf874('0x3'));var BPromise=require(_0xf874('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf874('0x5'));var rimraf=require('rimraf');var config=require(_0xf874('0x6'));var attributes=require(_0xf874('0x7'));module['exports']=function(_0x8cc97,_0x331ee9){return _0x8cc97['define'](_0xf874('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index e67fd56..6fc5721 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 _0x1c72=['../../config/environment','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x2ec9c6,_0x2c32b1){var _0x10561e=function(_0x20cb29){while(--_0x20cb29){_0x2ec9c6['push'](_0x2ec9c6['shift']());}};_0x10561e(++_0x2c32b1);}(_0x1c72,0x65));var _0x21c7=function(_0x3866cc,_0x1e8dca){_0x3866cc=_0x3866cc-0x0;var _0x2310a3=_0x1c72[_0x3866cc];return _0x2310a3;};'use strict';var _=require(_0x21c7('0x0'));var util=require(_0x21c7('0x1'));var moment=require(_0x21c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x21c7('0x3'));var fs=require('fs');var Redis=require(_0x21c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x21c7('0x5'))(_0x21c7('0x6'));var config=require(_0x21c7('0x7'));var jayson=require(_0x21c7('0x8'));var client=jayson[_0x21c7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5323,_0x37bc96,_0xd5b076){return new BPromise(function(_0x2c449a,_0x4b92f7){return client[_0x21c7('0xa')](_0x4f5323,_0xd5b076)[_0x21c7('0xb')](function(_0x1c73b7){logger['info'](_0x21c7('0xc'),_0x37bc96,_0x21c7('0xd'));logger[_0x21c7('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x37bc96,_0x21c7('0xd'),JSON[_0x21c7('0xf')](_0x1c73b7));if(_0x1c73b7[_0x21c7('0x10')]){if(_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x11')]===0x1f4){logger[_0x21c7('0x10')](_0x21c7('0xc'),_0x37bc96,_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x12')]);return _0x4b92f7(_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x12')]);}logger[_0x21c7('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x37bc96,_0x1c73b7['error'][_0x21c7('0x12')]);return _0x2c449a(_0x1c73b7[_0x21c7('0x10')][_0x21c7('0x12')]);}else{logger[_0x21c7('0x13')](_0x21c7('0xc'),_0x37bc96,_0x21c7('0xd'));_0x2c449a(_0x1c73b7[_0x21c7('0x14')][_0x21c7('0x12')]);}})[_0x21c7('0x15')](function(_0x5aa2f4){logger[_0x21c7('0x10')](_0x21c7('0xc'),_0x37bc96,_0x5aa2f4);_0x4b92f7(_0x5aa2f4);});});}exports[_0x21c7('0x16')]=function(_0x2fff71){var _0x20d717=this;return new Promise(function(_0x282a33,_0x8cd5a8){return db[_0x21c7('0x17')][_0x21c7('0x18')](_0x2fff71['body'],{'raw':_0x2fff71[_0x21c7('0x19')]?_0x2fff71[_0x21c7('0x19')][_0x21c7('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1be7e9){logger[_0x21c7('0x13')](_0x21c7('0x16'),_0x2fff71);logger[_0x21c7('0xe')]('CreateReportAgentPreview',_0x2fff71,JSON['stringify'](_0x1be7e9));_0x282a33(_0x1be7e9);})['catch'](function(_0x5ddc15){logger['error'](_0x21c7('0x16'),_0x5ddc15[_0x21c7('0x12')],_0x2fff71);_0x8cd5a8(_0x20d717['error'](0x1f4,_0x5ddc15[_0x21c7('0x12')]));});});}; \ No newline at end of file +var _0x3983=['create','body','options','then','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x3983,0x79));var _0x3398=function(_0x1b35f2,_0x4e6a6c){_0x1b35f2=_0x1b35f2-0x0;var _0xd8a3bd=_0x3983[_0x1b35f2];return _0xd8a3bd;};'use strict';var _=require('lodash');var util=require(_0x3398('0x0'));var moment=require('moment');var BPromise=require(_0x3398('0x1'));var rs=require(_0x3398('0x2'));var fs=require('fs');var Redis=require(_0x3398('0x3'));var db=require(_0x3398('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3398('0x5'))(_0x3398('0x6'));var config=require(_0x3398('0x7'));var jayson=require(_0x3398('0x8'));var client=jayson[_0x3398('0x9')][_0x3398('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1756b0,_0x277642,_0x80b8cc){return new BPromise(function(_0x53e5a4,_0x550ade){return client[_0x3398('0xb')](_0x1756b0,_0x80b8cc)['then'](function(_0x1da933){logger[_0x3398('0xc')](_0x3398('0xd'),_0x277642,_0x3398('0xe'));logger[_0x3398('0xf')](_0x3398('0x10'),_0x277642,'request\x20sent',JSON[_0x3398('0x11')](_0x1da933));if(_0x1da933['error']){if(_0x1da933[_0x3398('0x12')][_0x3398('0x13')]===0x1f4){logger[_0x3398('0x12')](_0x3398('0xd'),_0x277642,_0x1da933[_0x3398('0x12')][_0x3398('0x14')]);return _0x550ade(_0x1da933[_0x3398('0x12')][_0x3398('0x14')]);}logger[_0x3398('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x277642,_0x1da933[_0x3398('0x12')][_0x3398('0x14')]);return _0x53e5a4(_0x1da933[_0x3398('0x12')][_0x3398('0x14')]);}else{logger[_0x3398('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x277642,_0x3398('0xe'));_0x53e5a4(_0x1da933[_0x3398('0x15')][_0x3398('0x14')]);}})['catch'](function(_0x238536){logger[_0x3398('0x12')](_0x3398('0xd'),_0x277642,_0x238536);_0x550ade(_0x238536);});});}exports[_0x3398('0x16')]=function(_0x1c248e){var _0x330252=this;return new Promise(function(_0x2b35dd,_0x793793){return db[_0x3398('0x17')][_0x3398('0x18')](_0x1c248e[_0x3398('0x19')],{'raw':_0x1c248e[_0x3398('0x1a')]?_0x1c248e['options']['raw']===undefined?!![]:![]:!![]})[_0x3398('0x1b')](function(_0x5454da){logger[_0x3398('0xc')](_0x3398('0x16'),_0x1c248e);logger['debug'](_0x3398('0x16'),_0x1c248e,JSON[_0x3398('0x11')](_0x5454da));_0x2b35dd(_0x5454da);})[_0x3398('0x1c')](function(_0x3aa57){logger['error']('CreateReportAgentPreview',_0x3aa57[_0x3398('0x14')],_0x1c248e);_0x793793(_0x330252[_0x3398('0x12')](0x1f4,_0x3aa57[_0x3398('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a673cab..ba801a3 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 _0x4c9c=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x4c9c,0x12e));var _0xc4c9=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0x4c9c[_0x1443eb];return _0x2b8810;};'use strict';var multer=require(_0xc4c9('0x0'));var util=require(_0xc4c9('0x1'));var path=require(_0xc4c9('0x2'));var express=require(_0xc4c9('0x3'));var router=express[_0xc4c9('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xc4c9('0x5'));router[_0xc4c9('0x6')](_0xc4c9('0x7'),auth['isAuthenticated'](),controller[_0xc4c9('0x8')]);router[_0xc4c9('0x6')](_0xc4c9('0x9'),auth['isAuthenticated'](),controller[_0xc4c9('0xa')]);router[_0xc4c9('0x6')](_0xc4c9('0xb'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0xd')]);router[_0xc4c9('0x6')](_0xc4c9('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0xc4c9('0x6')](_0xc4c9('0xf'),auth[_0xc4c9('0xc')](),controller['chatQueues']);router[_0xc4c9('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0xc4c9('0x10')]);router[_0xc4c9('0x6')](_0xc4c9('0x11'),auth[_0xc4c9('0xc')](),controller['mailAccounts']);router['get'](_0xc4c9('0x12'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x13')]);router[_0xc4c9('0x6')](_0xc4c9('0x14'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x15')]);router[_0xc4c9('0x6')](_0xc4c9('0x16'),auth['isAuthenticated'](),controller[_0xc4c9('0x17')]);router[_0xc4c9('0x6')](_0xc4c9('0x18'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x19')]);router[_0xc4c9('0x6')](_0xc4c9('0x1a'),auth[_0xc4c9('0xc')](),controller['voiceQueuesPreview']);router['get'](_0xc4c9('0x1b'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x1c')]);router[_0xc4c9('0x6')](_0xc4c9('0x1d'),auth[_0xc4c9('0xc')](),controller['voiceQueuesChannel']);router['get'](_0xc4c9('0x1e'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x1f')]);router['get'](_0xc4c9('0x20'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x21')]);router[_0xc4c9('0x6')](_0xc4c9('0x22'),auth['isAuthenticated'](),controller[_0xc4c9('0x23')]);router[_0xc4c9('0x24')](_0xc4c9('0x22'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x25')]);router['get'](_0xc4c9('0x26'),auth['isAuthenticated'](),controller[_0xc4c9('0x27')]);router['get'](_0xc4c9('0x28'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x29')]);router[_0xc4c9('0x6')](_0xc4c9('0x2a'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x2b')]);router[_0xc4c9('0x24')](_0xc4c9('0x2c'),auth['isAuthenticated'](),controller[_0xc4c9('0x2d')]);router[_0xc4c9('0x6')](_0xc4c9('0x2e'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x2f')]);router[_0xc4c9('0x6')]('/trunks',auth['isAuthenticated'](),controller[_0xc4c9('0x30')]);router[_0xc4c9('0x6')](_0xc4c9('0x31'),auth['isAuthenticated'](),controller['campaigns']);router[_0xc4c9('0x6')](_0xc4c9('0x32'),auth['isAuthenticated'](),controller[_0xc4c9('0x33')]);router['get'](_0xc4c9('0x34'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x35')]);router[_0xc4c9('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xc4c9('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x36')]);router[_0xc4c9('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x37')]);router['get'](_0xc4c9('0x38'),auth[_0xc4c9('0xc')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x39')]);router[_0xc4c9('0x6')](_0xc4c9('0x3a'),auth['isAuthenticated'](),controller[_0xc4c9('0x3b')]);router['post'](_0xc4c9('0x3c'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x3d')]('mail'));router[_0xc4c9('0x6')](_0xc4c9('0x3e'),auth[_0xc4c9('0xc')](),controller['showMailQueues']);router[_0xc4c9('0x3f')](_0xc4c9('0x40'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x3d')](_0xc4c9('0x41')));router[_0xc4c9('0x6')](_0xc4c9('0x42'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x43')]);router['post'](_0xc4c9('0x44'),auth['isAuthenticated'](),controller[_0xc4c9('0x3d')](_0xc4c9('0x45')));router[_0xc4c9('0x6')](_0xc4c9('0x46'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x47')]);router[_0xc4c9('0x3f')](_0xc4c9('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0xc4c9('0x49')));router[_0xc4c9('0x6')](_0xc4c9('0x4a'),auth[_0xc4c9('0xc')](),controller['showOpenchannelQueues']);router[_0xc4c9('0x3f')](_0xc4c9('0x4b'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x3d')](_0xc4c9('0x4c')));router['post'](_0xc4c9('0x4d'),auth['isAuthenticated'](),controller[_0xc4c9('0x3d')]('whatsapp'));router['get']('/sms/queues/:id',auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x4e')]);router[_0xc4c9('0x6')](_0xc4c9('0x4f'),auth[_0xc4c9('0xc')](),controller[_0xc4c9('0x50')]);router[_0xc4c9('0x3f')](_0xc4c9('0x51'),auth[_0xc4c9('0xc')](),controller['agentNotify']);module[_0xc4c9('0x52')]=router; \ No newline at end of file +var _0x64ec=['chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x64ec,0xc2));var _0xc64e=function(_0x5a7558,_0x1a232d){_0x5a7558=_0x5a7558-0x0;var _0x1ff704=_0x64ec[_0x5a7558];return _0x1ff704;};'use strict';var multer=require(_0xc64e('0x0'));var util=require(_0xc64e('0x1'));var path=require(_0xc64e('0x2'));var express=require(_0xc64e('0x3'));var router=express[_0xc64e('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xc64e('0x5'));router[_0xc64e('0x6')](_0xc64e('0x7'),auth[_0xc64e('0x8')](),controller['voiceChannels']);router[_0xc64e('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xc64e('0x9')]);router[_0xc64e('0x6')](_0xc64e('0xa'),auth[_0xc64e('0x8')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xc64e('0xb'),auth['isAuthenticated'](),controller[_0xc64e('0xc')]);router[_0xc64e('0x6')](_0xc64e('0xd'),auth[_0xc64e('0x8')](),controller[_0xc64e('0xe')]);router[_0xc64e('0x6')](_0xc64e('0xf'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x10')]);router['get'](_0xc64e('0x11'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x12')]);router[_0xc64e('0x6')](_0xc64e('0x13'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x14')]);router['get'](_0xc64e('0x15'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xc64e('0x6')](_0xc64e('0x16'),auth[_0xc64e('0x8')](),controller['whatsappQueues']);router[_0xc64e('0x6')](_0xc64e('0x17'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x18')]);router['get'](_0xc64e('0x19'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x1a')]);router[_0xc64e('0x6')]('/voice/queues/channels',auth[_0xc64e('0x8')](),controller[_0xc64e('0x1b')]);router[_0xc64e('0x6')](_0xc64e('0x1c'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x1d')]);router[_0xc64e('0x6')](_0xc64e('0x1e'),auth['isAuthenticated'](),controller[_0xc64e('0x1f')]);router['get'](_0xc64e('0x20'),auth['isAuthenticated'](),controller[_0xc64e('0x21')]);router[_0xc64e('0x6')](_0xc64e('0x22'),auth['isAuthenticated'](),controller[_0xc64e('0x23')]);router[_0xc64e('0x24')](_0xc64e('0x22'),auth[_0xc64e('0x8')](),controller['updateVoiceQueue']);router['get'](_0xc64e('0x25'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x26')]);router[_0xc64e('0x6')](_0xc64e('0x27'),auth['isAuthenticated'](),controller[_0xc64e('0x28')]);router[_0xc64e('0x6')](_0xc64e('0x29'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x2a')]);router[_0xc64e('0x24')]('/agents/:id/capacity',auth[_0xc64e('0x8')](),controller[_0xc64e('0x2b')]);router[_0xc64e('0x6')](_0xc64e('0x2c'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x2d')]);router['get']('/trunks',auth[_0xc64e('0x8')](),controller[_0xc64e('0x2e')]);router['get'](_0xc64e('0x2f'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x30')]);router['get'](_0xc64e('0x31'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x32')]);router['get'](_0xc64e('0x33'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x34')]);router[_0xc64e('0x6')](_0xc64e('0x35'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x36')]);router[_0xc64e('0x6')](_0xc64e('0x37'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x38')]);router['get'](_0xc64e('0x39'),auth[_0xc64e('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc64e('0x6')](_0xc64e('0x3a'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x3b')]);router['get'](_0xc64e('0x3c'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xc64e('0x3d'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x3e')]);router['post'](_0xc64e('0x3f'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x40')](_0xc64e('0x41')));router[_0xc64e('0x6')](_0xc64e('0x42'),auth[_0xc64e('0x8')](),controller['showMailQueues']);router[_0xc64e('0x43')](_0xc64e('0x44'),auth[_0xc64e('0x8')](),controller['queueNotify'](_0xc64e('0x45')));router[_0xc64e('0x6')](_0xc64e('0x46'),auth[_0xc64e('0x8')](),controller[_0xc64e('0x47')]);router[_0xc64e('0x43')]('/fax/queues/:id/notify',auth[_0xc64e('0x8')](),controller[_0xc64e('0x40')](_0xc64e('0x48')));router[_0xc64e('0x6')](_0xc64e('0x49'),auth['isAuthenticated'](),controller[_0xc64e('0x4a')]);router[_0xc64e('0x43')](_0xc64e('0x4b'),auth['isAuthenticated'](),controller[_0xc64e('0x40')]('openchannel'));router['get'](_0xc64e('0x4c'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xc64e('0x43')]('/sms/queues/:id/notify',auth[_0xc64e('0x8')](),controller[_0xc64e('0x40')]('sms'));router[_0xc64e('0x43')](_0xc64e('0x4d'),auth['isAuthenticated'](),controller[_0xc64e('0x40')](_0xc64e('0x4e')));router[_0xc64e('0x6')]('/sms/queues/:id',auth[_0xc64e('0x8')](),controller['showSmsQueues']);router[_0xc64e('0x6')](_0xc64e('0x4f'),auth['isAuthenticated'](),controller[_0xc64e('0x50')]);router[_0xc64e('0x43')]('/agents/:id/notify',auth[_0xc64e('0x8')](),controller['agentNotify']);module[_0xc64e('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f9af337..14e4984 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 _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x29999b,_0x17b831){var _0x53e75a=function(_0x1f6d63){while(--_0x1f6d63){_0x29999b['push'](_0x29999b['shift']());}};_0x53e75a(++_0x17b831);}(_0x6f47,0xc7));var _0x76f4=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x6f47[_0x1e3c16];return _0x47a0c9;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file +var _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x5963e5,_0x5444c2){var _0x3132d8=function(_0x3b21bb){while(--_0x3b21bb){_0x5963e5['push'](_0x5963e5['shift']());}};_0x3132d8(++_0x5444c2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x5fc3[_0x409353];return _0x4f4b59;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index f34ee23..748b775 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 _0xc89c=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','destroy','exports'];(function(_0x1fd52e,_0x18738c){var _0x279b03=function(_0x3f22d9){while(--_0x3f22d9){_0x1fd52e['push'](_0x1fd52e['shift']());}};_0x279b03(++_0x18738c);}(_0xc89c,0xa2));var _0xcc89=function(_0x1504f0,_0x10c013){_0x1504f0=_0x1504f0-0x0;var _0x47012b=_0xc89c[_0x1504f0];return _0x47012b;};'use strict';var multer=require('multer');var util=require(_0xcc89('0x0'));var path=require(_0xcc89('0x1'));var timeout=require(_0xcc89('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcc89('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcc89('0x4'));var config=require(_0xcc89('0x5'));var controller=require('./schedule.controller');router[_0xcc89('0x6')]('/',auth[_0xcc89('0x7')](),controller[_0xcc89('0x8')]);router[_0xcc89('0x6')](_0xcc89('0x9'),auth[_0xcc89('0x7')](),controller[_0xcc89('0xa')]);router[_0xcc89('0x6')](_0xcc89('0xb'),auth[_0xcc89('0x7')](),controller['run']);router[_0xcc89('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcc89('0xd')](_0xcc89('0x9'),auth['isAuthenticated'](),controller[_0xcc89('0xe')]);router[_0xcc89('0xf')](_0xcc89('0x9'),auth[_0xcc89('0x7')](),controller[_0xcc89('0x10')]);module[_0xcc89('0x11')]=router; \ No newline at end of file +var _0x7cfe=['run','post','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x7cfe,0x180));var _0xe7cf=function(_0x3616d9,_0x3afc41){_0x3616d9=_0x3616d9-0x0;var _0x3ab121=_0x7cfe[_0x3616d9];return _0x3ab121;};'use strict';var multer=require(_0xe7cf('0x0'));var util=require('util');var path=require(_0xe7cf('0x1'));var timeout=require(_0xe7cf('0x2'));var express=require(_0xe7cf('0x3'));var router=express[_0xe7cf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe7cf('0x5'));var config=require('../../config/environment');var controller=require(_0xe7cf('0x6'));router[_0xe7cf('0x7')]('/',auth['isAuthenticated'](),controller[_0xe7cf('0x8')]);router[_0xe7cf('0x7')](_0xe7cf('0x9'),auth[_0xe7cf('0xa')](),controller[_0xe7cf('0xb')]);router[_0xe7cf('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0xe7cf('0xc')]);router[_0xe7cf('0xd')]('/',auth[_0xe7cf('0xa')](),controller['create']);router[_0xe7cf('0xe')](_0xe7cf('0x9'),auth[_0xe7cf('0xa')](),controller['update']);router[_0xe7cf('0xf')](_0xe7cf('0x9'),auth['isAuthenticated'](),controller[_0xe7cf('0x10')]);module[_0xe7cf('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 767d306..2fed417 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 _0x06fb=['quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x54e65a,_0x116a10){var _0x559fb6=function(_0x66046){while(--_0x66046){_0x54e65a['push'](_0x54e65a['shift']());}};_0x559fb6(++_0x116a10);}(_0x06fb,0x1eb));var _0xb06f=function(_0x725bd2,_0x5de588){_0x725bd2=_0x725bd2-0x0;var _0x295210=_0x06fb[_0x725bd2];return _0x295210;};'use strict';var Sequelize=require(_0xb06f('0x0'));module[_0xb06f('0x1')]={'name':{'type':Sequelize[_0xb06f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb06f('0x2')]},'active':{'type':Sequelize[_0xb06f('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb06f('0x4')},'startAt':{'type':Sequelize[_0xb06f('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb06f('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb06f('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb06f('0x7')](_0xb06f('0x8'),_0xb06f('0x9'),_0xb06f('0xa'),_0xb06f('0xb'),_0xb06f('0xc'),_0xb06f('0xd'),_0xb06f('0xe')),'allowNull':![],'defaultValue':_0xb06f('0xc')},'output':{'type':Sequelize[_0xb06f('0x7')](_0xb06f('0xf'),_0xb06f('0x10'),_0xb06f('0x11')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb06f('0x7')](_0xb06f('0x12'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb06f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb06f('0x2')]},'cc':{'type':Sequelize[_0xb06f('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xb06f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4078=['months','weeks','days','hours','minutes','csv','custom','default','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters'];(function(_0x3b7db2,_0x5edd58){var _0x3a819e=function(_0x207221){while(--_0x207221){_0x3b7db2['push'](_0x3b7db2['shift']());}};_0x3a819e(++_0x5edd58);}(_0x4078,0x1b1));var _0x8407=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4078[_0x34325b];return _0x3da348;};'use strict';var Sequelize=require(_0x8407('0x0'));module[_0x8407('0x1')]={'name':{'type':Sequelize[_0x8407('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8407('0x2')]},'active':{'type':Sequelize[_0x8407('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8407('0x2')],'allowNull':![],'defaultValue':_0x8407('0x4')},'startAt':{'type':Sequelize[_0x8407('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8407('0x6')](_0x8407('0x7'),_0x8407('0x8'),_0x8407('0x9'),_0x8407('0xa'),_0x8407('0xb'),_0x8407('0xc'),_0x8407('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x8407('0xe'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x8407('0xe')},'type':{'type':Sequelize[_0x8407('0x6')](_0x8407('0xf'),_0x8407('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x8407('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8407('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x8407('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 09666bc..c387556 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 _0x3618=['status','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource'];(function(_0x46dce0,_0x2e12a8){var _0x254615=function(_0x172af0){while(--_0x172af0){_0x46dce0['push'](_0x46dce0['shift']());}};_0x254615(++_0x2e12a8);}(_0x3618,0xe2));var _0x8361=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3618[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x8361('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8361('0x1'));var rp=require(_0x8361('0x2'));var moment=require(_0x8361('0x3'));var BPromise=require(_0x8361('0x4'));var Mustache=require(_0x8361('0x5'));var util=require(_0x8361('0x6'));var path=require(_0x8361('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8361('0x8'));var fs=require('fs');var fs_extra=require(_0x8361('0x9'));var _=require(_0x8361('0xa'));var squel=require(_0x8361('0xb'));var crypto=require(_0x8361('0xc'));var jsforce=require(_0x8361('0xd'));var deskjs=require(_0x8361('0xe'));var toCsv=require(_0x8361('0xf'));var querystring=require('querystring');var Papa=require(_0x8361('0x10'));var Redis=require(_0x8361('0x11'));var authService=require(_0x8361('0x12'));var qs=require(_0x8361('0x13'));var as=require(_0x8361('0x14'));var hardwareService=require(_0x8361('0x15'));var logger=require(_0x8361('0x16'))(_0x8361('0x17'));var utils=require('../../config/utils');var config=require(_0x8361('0x18'));var licenseUtil=require(_0x8361('0x19'));var db=require(_0x8361('0x1a'))['db'];function respondWithStatusCode(_0x48a87d,_0x1060f0){_0x1060f0=_0x1060f0||0xcc;return function(_0x471afd){if(_0x471afd){return _0x48a87d[_0x8361('0x1b')](_0x1060f0);}return _0x48a87d['status'](_0x1060f0)[_0x8361('0x1c')]();};}function respondWithResult(_0x55d45b,_0x45ffbc){_0x45ffbc=_0x45ffbc||0xc8;return function(_0x2cec9f){if(_0x2cec9f){return _0x55d45b['status'](_0x45ffbc)[_0x8361('0x1d')](_0x2cec9f);}};}function respondWithFilteredResult(_0x2100ae,_0x49261c){return function(_0x45e703){if(_0x45e703){var _0x101624=typeof _0x49261c[_0x8361('0x1e')]===_0x8361('0x1f')&&typeof _0x49261c['limit']===_0x8361('0x1f');var _0x4647d3=_0x45e703[_0x8361('0x20')];var _0x35f1c6=_0x101624?0x0:_0x49261c['offset'];var _0x381041=_0x101624?_0x45e703['count']:_0x49261c[_0x8361('0x1e')]+_0x49261c[_0x8361('0x21')];var _0x3215e9;if(_0x381041>=_0x4647d3){_0x381041=_0x4647d3;_0x3215e9=0xc8;}else{_0x3215e9=0xce;}_0x2100ae['status'](_0x3215e9);return _0x2100ae[_0x8361('0x22')](_0x8361('0x23'),_0x35f1c6+'-'+_0x381041+'/'+_0x4647d3)[_0x8361('0x1d')](_0x45e703);}return null;};}function patchUpdates(_0x4b93f4){return function(_0x278a69){try{jsonpatch[_0x8361('0x24')](_0x278a69,_0x4b93f4,!![]);}catch(_0x18bbed){return BPromise[_0x8361('0x25')](_0x18bbed);}return _0x278a69[_0x8361('0x26')]();};}function saveUpdates(_0x1ea6c8,_0x43fee2){return function(_0x168944){if(_0x168944){return _0x168944[_0x8361('0x27')](_0x1ea6c8)[_0x8361('0x28')](function(_0x30a97a){return _0x30a97a;});}return null;};}function removeEntity(_0x2a43b4,_0x239593){return function(_0x3678f6){if(_0x3678f6){return _0x3678f6[_0x8361('0x29')]()[_0x8361('0x28')](function(){var _0x1237b8=_0x3678f6[_0x8361('0x2a')]({'plain':!![]});var _0x252531='Scheduler';return db[_0x8361('0x2b')][_0x8361('0x29')]({'where':{'type':_0x252531,'resourceId':_0x1237b8['id']}})[_0x8361('0x28')](function(){return _0x3678f6;});})['then'](function(){_0x2a43b4[_0x8361('0x2c')](0xcc)[_0x8361('0x1c')]();});}};}function handleEntityNotFound(_0x2bf049,_0x459ccd){return function(_0x69a3b){if(!_0x69a3b){_0x2bf049['sendStatus'](0x194);}return _0x69a3b;};}function handleError(_0x4cd6b3,_0x5bd991){_0x5bd991=_0x5bd991||0x1f4;return function(_0x1e39b7){logger[_0x8361('0x2d')](_0x1e39b7[_0x8361('0x2e')]);if(_0x1e39b7[_0x8361('0x2f')]){delete _0x1e39b7[_0x8361('0x2f')];}_0x4cd6b3[_0x8361('0x2c')](_0x5bd991)[_0x8361('0x30')](_0x1e39b7);};}exports[_0x8361('0x31')]=function(_0xa07e67,_0x4cc803){var _0x48f779={},_0x2c8b0d={},_0x365747={'count':0x0,'rows':[]};var _0x31aae9=_['map'](db[_0x8361('0x32')][_0x8361('0x33')],function(_0x43c4a2){return{'name':_0x43c4a2[_0x8361('0x34')],'type':_0x43c4a2[_0x8361('0x35')][_0x8361('0x36')]};});_0x2c8b0d[_0x8361('0x37')]=_[_0x8361('0x38')](_0x31aae9,_0x8361('0x2f'));_0x2c8b0d[_0x8361('0x39')]=_['keys'](_0xa07e67[_0x8361('0x39')]);_0x2c8b0d[_0x8361('0x3a')]=_[_0x8361('0x3b')](_0x2c8b0d[_0x8361('0x37')],_0x2c8b0d[_0x8361('0x39')]);_0x48f779[_0x8361('0x3c')]=_[_0x8361('0x3b')](_0x2c8b0d[_0x8361('0x37')],qs[_0x8361('0x3d')](_0xa07e67['query'][_0x8361('0x3d')]));_0x48f779['attributes']=_0x48f779[_0x8361('0x3c')][_0x8361('0x3e')]?_0x48f779[_0x8361('0x3c')]:_0x2c8b0d[_0x8361('0x37')];if(!_0xa07e67[_0x8361('0x39')][_0x8361('0x3f')]('nolimit')){_0x48f779[_0x8361('0x21')]=qs['limit'](_0xa07e67[_0x8361('0x39')][_0x8361('0x21')]);_0x48f779[_0x8361('0x1e')]=qs['offset'](_0xa07e67[_0x8361('0x39')][_0x8361('0x1e')]);}_0x48f779[_0x8361('0x40')]=qs[_0x8361('0x41')](_0xa07e67[_0x8361('0x39')]['sort']);_0x48f779[_0x8361('0x42')]=qs[_0x8361('0x3a')](_[_0x8361('0x43')](_0xa07e67[_0x8361('0x39')],_0x2c8b0d[_0x8361('0x3a')]),_0x31aae9);if(_0xa07e67[_0x8361('0x39')][_0x8361('0x44')]){_0x48f779[_0x8361('0x42')]=_[_0x8361('0x45')](_0x48f779[_0x8361('0x42')],{'$or':_[_0x8361('0x38')](_0x31aae9,function(_0x662466){if(_0x662466[_0x8361('0x35')]!==_0x8361('0x46')){var _0x4dd8af={};_0x4dd8af[_0x662466[_0x8361('0x2f')]]={'$like':'%'+_0xa07e67['query'][_0x8361('0x44')]+'%'};return _0x4dd8af;}})});}_0x48f779=_[_0x8361('0x45')]({},_0x48f779,_0xa07e67[_0x8361('0x47')]);var _0x3a82e0={'where':_0x48f779['where']};return db[_0x8361('0x32')]['count'](_0x3a82e0)[_0x8361('0x28')](function(_0x576e85){_0x365747[_0x8361('0x20')]=_0x576e85;if(_0xa07e67[_0x8361('0x39')][_0x8361('0x48')]){_0x48f779['include']=[{'all':!![]}];}return db[_0x8361('0x32')][_0x8361('0x49')](_0x48f779);})['then'](function(_0x3da12c){_0x365747['rows']=_0x3da12c;return _0x365747;})[_0x8361('0x28')](respondWithFilteredResult(_0x4cc803,_0x48f779))[_0x8361('0x4a')](handleError(_0x4cc803,null));};exports[_0x8361('0x4b')]=function(_0x28b8e9,_0x4d8aac){var _0x558355={'raw':![],'where':{'id':_0x28b8e9['params']['id']}},_0x228615={};_0x228615['model']=_[_0x8361('0x4c')](db[_0x8361('0x32')]['rawAttributes']);_0x228615[_0x8361('0x39')]=_['keys'](_0x28b8e9[_0x8361('0x39')]);_0x228615['filters']=_['intersection'](_0x228615[_0x8361('0x37')],_0x228615[_0x8361('0x39')]);_0x558355[_0x8361('0x3c')]=_[_0x8361('0x3b')](_0x228615[_0x8361('0x37')],qs[_0x8361('0x3d')](_0x28b8e9['query'][_0x8361('0x3d')]));_0x558355[_0x8361('0x3c')]=_0x558355[_0x8361('0x3c')][_0x8361('0x3e')]?_0x558355['attributes']:_0x228615[_0x8361('0x37')];if(_0x28b8e9[_0x8361('0x39')][_0x8361('0x48')]){_0x558355[_0x8361('0x4d')]=[{'all':!![]}];}_0x558355=_[_0x8361('0x45')]({},_0x558355,_0x28b8e9['options']);return db[_0x8361('0x32')][_0x8361('0x4e')](_0x558355)[_0x8361('0x28')](handleEntityNotFound(_0x4d8aac,null))[_0x8361('0x28')](respondWithResult(_0x4d8aac,null))[_0x8361('0x4a')](handleError(_0x4d8aac,null));};exports[_0x8361('0x4f')]=function(_0x4c4cb6,_0x39397f){return db[_0x8361('0x32')][_0x8361('0x4f')](_0x4c4cb6[_0x8361('0x50')],{})[_0x8361('0x28')](function(_0x27e27a){var _0x5c6e7b=_0x4c4cb6[_0x8361('0x51')][_0x8361('0x2a')]({'plain':!![]});if(!_0x5c6e7b)throw new Error(_0x8361('0x52'));if(_0x5c6e7b[_0x8361('0x53')]===_0x8361('0x51')){var _0x4502a7=_0x27e27a[_0x8361('0x2a')]({'plain':!![]});var _0x554d68='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x554d68,'userProfileId':_0x5c6e7b[_0x8361('0x54')]},'raw':!![]})[_0x8361('0x28')](function(_0x2f428c){if(_0x2f428c&&_0x2f428c[_0x8361('0x55')]===0x0){return db['UserProfileResource'][_0x8361('0x4f')]({'name':_0x4502a7[_0x8361('0x2f')],'resourceId':_0x4502a7['id'],'type':_0x2f428c[_0x8361('0x2f')],'sectionId':_0x2f428c['id']},{})[_0x8361('0x28')](function(){return _0x27e27a;});}else{return _0x27e27a;}})[_0x8361('0x4a')](function(_0x57331f){logger[_0x8361('0x2d')](_0x8361('0x56'),_0x57331f);throw _0x57331f;});}return _0x27e27a;})['then'](respondWithResult(_0x39397f,0xc9))[_0x8361('0x4a')](handleError(_0x39397f,null));};exports[_0x8361('0x27')]=function(_0x44f978,_0x4b91a5){if(_0x44f978[_0x8361('0x50')]['id']){delete _0x44f978[_0x8361('0x50')]['id'];}return db[_0x8361('0x32')][_0x8361('0x4e')]({'where':{'id':_0x44f978[_0x8361('0x57')]['id']}})[_0x8361('0x28')](handleEntityNotFound(_0x4b91a5,null))[_0x8361('0x28')](saveUpdates(_0x44f978[_0x8361('0x50')],null))['then'](respondWithResult(_0x4b91a5,null))[_0x8361('0x4a')](handleError(_0x4b91a5,null));};exports[_0x8361('0x29')]=function(_0xa12cc9,_0x2c7b28){return db[_0x8361('0x32')][_0x8361('0x4e')]({'where':{'id':_0xa12cc9[_0x8361('0x57')]['id']}})[_0x8361('0x28')](handleEntityNotFound(_0x2c7b28,null))[_0x8361('0x28')](removeEntity(_0x2c7b28,null))[_0x8361('0x4a')](handleError(_0x2c7b28,null));};exports[_0x8361('0x58')]=function(_0x82388e,_0x2702b3,_0xb1409){var _0x21447f=require(_0x8361('0x59'));return db[_0x8361('0x32')][_0x8361('0x4e')]({'where':{'id':_0x82388e['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2702b3,null))[_0x8361('0x28')](function(){_0x21447f[_0x8361('0x58')](_0x82388e[_0x8361('0x57')]['id']);})['then'](respondWithStatusCode(_0x2702b3,null))[_0x8361('0x4a')](handleError(_0x2702b3,null));}; \ No newline at end of file +var _0xe559=['Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','options','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','body','run','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy'];(function(_0x32f850,_0x6ba444){var _0x38e424=function(_0x14e281){while(--_0x14e281){_0x32f850['push'](_0x32f850['shift']());}};_0x38e424(++_0x6ba444);}(_0xe559,0x7e));var _0x9e55=function(_0x59ec22,_0x29ddd0){_0x59ec22=_0x59ec22-0x0;var _0x14f69e=_0xe559[_0x59ec22];return _0x14f69e;};'use strict';var emlformat=require(_0x9e55('0x0'));var rimraf=require(_0x9e55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e55('0x2'));var rp=require(_0x9e55('0x3'));var moment=require('moment');var BPromise=require(_0x9e55('0x4'));var Mustache=require(_0x9e55('0x5'));var util=require(_0x9e55('0x6'));var path=require(_0x9e55('0x7'));var sox=require(_0x9e55('0x8'));var csv=require(_0x9e55('0x9'));var ejs=require(_0x9e55('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e55('0xb'));var squel=require(_0x9e55('0xc'));var crypto=require(_0x9e55('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9e55('0xe'));var toCsv=require(_0x9e55('0x9'));var querystring=require(_0x9e55('0xf'));var Papa=require('papaparse');var Redis=require(_0x9e55('0x10'));var authService=require(_0x9e55('0x11'));var qs=require(_0x9e55('0x12'));var as=require(_0x9e55('0x13'));var hardwareService=require(_0x9e55('0x14'));var logger=require(_0x9e55('0x15'))(_0x9e55('0x16'));var utils=require('../../config/utils');var config=require(_0x9e55('0x17'));var licenseUtil=require(_0x9e55('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c2206,_0x3efb19){_0x3efb19=_0x3efb19||0xcc;return function(_0x25fdc6){if(_0x25fdc6){return _0x5c2206[_0x9e55('0x19')](_0x3efb19);}return _0x5c2206[_0x9e55('0x1a')](_0x3efb19)[_0x9e55('0x1b')]();};}function respondWithResult(_0x4c2b75,_0x304a3c){_0x304a3c=_0x304a3c||0xc8;return function(_0x94018e){if(_0x94018e){return _0x4c2b75['status'](_0x304a3c)[_0x9e55('0x1c')](_0x94018e);}};}function respondWithFilteredResult(_0x36aab0,_0x247bfd){return function(_0x47ef82){if(_0x47ef82){var _0x3e1545=typeof _0x247bfd[_0x9e55('0x1d')]===_0x9e55('0x1e')&&typeof _0x247bfd['limit']===_0x9e55('0x1e');var _0x4386b3=_0x47ef82[_0x9e55('0x1f')];var _0x13521c=_0x3e1545?0x0:_0x247bfd[_0x9e55('0x1d')];var _0x655c5a=_0x3e1545?_0x47ef82[_0x9e55('0x1f')]:_0x247bfd[_0x9e55('0x1d')]+_0x247bfd[_0x9e55('0x20')];var _0x301363;if(_0x655c5a>=_0x4386b3){_0x655c5a=_0x4386b3;_0x301363=0xc8;}else{_0x301363=0xce;}_0x36aab0['status'](_0x301363);return _0x36aab0[_0x9e55('0x21')](_0x9e55('0x22'),_0x13521c+'-'+_0x655c5a+'/'+_0x4386b3)['json'](_0x47ef82);}return null;};}function patchUpdates(_0x5aa60e){return function(_0x3e234b){try{jsonpatch['apply'](_0x3e234b,_0x5aa60e,!![]);}catch(_0x37e551){return BPromise['reject'](_0x37e551);}return _0x3e234b['save']();};}function saveUpdates(_0x3d8a3c,_0x1b28db){return function(_0x387f4f){if(_0x387f4f){return _0x387f4f[_0x9e55('0x23')](_0x3d8a3c)[_0x9e55('0x24')](function(_0x37543e){return _0x37543e;});}return null;};}function removeEntity(_0x48e96b,_0xe85ab1){return function(_0x109817){if(_0x109817){return _0x109817[_0x9e55('0x25')]()[_0x9e55('0x24')](function(){var _0x515b1a=_0x109817['get']({'plain':!![]});var _0x1a4aac=_0x9e55('0x26');return db[_0x9e55('0x27')][_0x9e55('0x25')]({'where':{'type':_0x1a4aac,'resourceId':_0x515b1a['id']}})[_0x9e55('0x24')](function(){return _0x109817;});})['then'](function(){_0x48e96b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f4a1,_0x1ce0e9){return function(_0x3a5d62){if(!_0x3a5d62){_0x50f4a1[_0x9e55('0x19')](0x194);}return _0x3a5d62;};}function handleError(_0x2b55d0,_0x57e4bd){_0x57e4bd=_0x57e4bd||0x1f4;return function(_0x507d00){logger[_0x9e55('0x28')](_0x507d00[_0x9e55('0x29')]);if(_0x507d00[_0x9e55('0x2a')]){delete _0x507d00[_0x9e55('0x2a')];}_0x2b55d0[_0x9e55('0x1a')](_0x57e4bd)[_0x9e55('0x2b')](_0x507d00);};}exports[_0x9e55('0x2c')]=function(_0x288421,_0x231514){var _0xb1fc46={},_0x518304={},_0x3def17={'count':0x0,'rows':[]};var _0x5bb5b0=_[_0x9e55('0x2d')](db[_0x9e55('0x2e')][_0x9e55('0x2f')],function(_0x12354e){return{'name':_0x12354e['fieldName'],'type':_0x12354e[_0x9e55('0x30')][_0x9e55('0x31')]};});_0x518304[_0x9e55('0x32')]=_[_0x9e55('0x2d')](_0x5bb5b0,_0x9e55('0x2a'));_0x518304[_0x9e55('0x33')]=_['keys'](_0x288421['query']);_0x518304[_0x9e55('0x34')]=_[_0x9e55('0x35')](_0x518304[_0x9e55('0x32')],_0x518304[_0x9e55('0x33')]);_0xb1fc46[_0x9e55('0x36')]=_['intersection'](_0x518304['model'],qs['fields'](_0x288421[_0x9e55('0x33')][_0x9e55('0x37')]));_0xb1fc46[_0x9e55('0x36')]=_0xb1fc46['attributes'][_0x9e55('0x38')]?_0xb1fc46[_0x9e55('0x36')]:_0x518304[_0x9e55('0x32')];if(!_0x288421[_0x9e55('0x33')]['hasOwnProperty'](_0x9e55('0x39'))){_0xb1fc46[_0x9e55('0x20')]=qs[_0x9e55('0x20')](_0x288421[_0x9e55('0x33')]['limit']);_0xb1fc46[_0x9e55('0x1d')]=qs['offset'](_0x288421[_0x9e55('0x33')][_0x9e55('0x1d')]);}_0xb1fc46[_0x9e55('0x3a')]=qs[_0x9e55('0x3b')](_0x288421['query']['sort']);_0xb1fc46['where']=qs['filters'](_[_0x9e55('0x3c')](_0x288421[_0x9e55('0x33')],_0x518304['filters']),_0x5bb5b0);if(_0x288421['query'][_0x9e55('0x3d')]){_0xb1fc46[_0x9e55('0x3e')]=_[_0x9e55('0x3f')](_0xb1fc46[_0x9e55('0x3e')],{'$or':_[_0x9e55('0x2d')](_0x5bb5b0,function(_0x56aea4){if(_0x56aea4[_0x9e55('0x30')]!==_0x9e55('0x40')){var _0x182521={};_0x182521[_0x56aea4['name']]={'$like':'%'+_0x288421[_0x9e55('0x33')][_0x9e55('0x3d')]+'%'};return _0x182521;}})});}_0xb1fc46=_[_0x9e55('0x3f')]({},_0xb1fc46,_0x288421['options']);var _0x2b85f3={'where':_0xb1fc46[_0x9e55('0x3e')]};return db[_0x9e55('0x2e')][_0x9e55('0x1f')](_0x2b85f3)[_0x9e55('0x24')](function(_0x1a89d1){_0x3def17['count']=_0x1a89d1;if(_0x288421[_0x9e55('0x33')]['includeAll']){_0xb1fc46[_0x9e55('0x41')]=[{'all':!![]}];}return db[_0x9e55('0x2e')]['findAll'](_0xb1fc46);})[_0x9e55('0x24')](function(_0x26293b){_0x3def17[_0x9e55('0x42')]=_0x26293b;return _0x3def17;})[_0x9e55('0x24')](respondWithFilteredResult(_0x231514,_0xb1fc46))[_0x9e55('0x43')](handleError(_0x231514,null));};exports[_0x9e55('0x44')]=function(_0x1a3879,_0x35e079){var _0xbf328c={'raw':![],'where':{'id':_0x1a3879[_0x9e55('0x45')]['id']}},_0x1bbe3c={};_0x1bbe3c['model']=_[_0x9e55('0x46')](db[_0x9e55('0x2e')][_0x9e55('0x2f')]);_0x1bbe3c['query']=_['keys'](_0x1a3879[_0x9e55('0x33')]);_0x1bbe3c[_0x9e55('0x34')]=_[_0x9e55('0x35')](_0x1bbe3c[_0x9e55('0x32')],_0x1bbe3c[_0x9e55('0x33')]);_0xbf328c[_0x9e55('0x36')]=_[_0x9e55('0x35')](_0x1bbe3c[_0x9e55('0x32')],qs[_0x9e55('0x37')](_0x1a3879['query'][_0x9e55('0x37')]));_0xbf328c[_0x9e55('0x36')]=_0xbf328c[_0x9e55('0x36')][_0x9e55('0x38')]?_0xbf328c[_0x9e55('0x36')]:_0x1bbe3c[_0x9e55('0x32')];if(_0x1a3879[_0x9e55('0x33')][_0x9e55('0x47')]){_0xbf328c['include']=[{'all':!![]}];}_0xbf328c=_[_0x9e55('0x3f')]({},_0xbf328c,_0x1a3879[_0x9e55('0x48')]);return db[_0x9e55('0x2e')]['find'](_0xbf328c)[_0x9e55('0x24')](handleEntityNotFound(_0x35e079,null))['then'](respondWithResult(_0x35e079,null))[_0x9e55('0x43')](handleError(_0x35e079,null));};exports[_0x9e55('0x49')]=function(_0x163034,_0x31dbf8){return db[_0x9e55('0x2e')]['create'](_0x163034['body'],{})[_0x9e55('0x24')](function(_0x7b164b){var _0x5e9bdb=_0x163034['user'][_0x9e55('0x4a')]({'plain':!![]});if(!_0x5e9bdb)throw new Error(_0x9e55('0x4b'));if(_0x5e9bdb[_0x9e55('0x4c')]===_0x9e55('0x4d')){var _0x3e0bea=_0x7b164b['get']({'plain':!![]});var _0x274170='Scheduler';return db['UserProfileSection'][_0x9e55('0x4e')]({'where':{'name':_0x274170,'userProfileId':_0x5e9bdb[_0x9e55('0x4f')]},'raw':!![]})[_0x9e55('0x24')](function(_0x288fb6){if(_0x288fb6&&_0x288fb6['autoAssociation']===0x0){return db[_0x9e55('0x27')][_0x9e55('0x49')]({'name':_0x3e0bea['name'],'resourceId':_0x3e0bea['id'],'type':_0x288fb6['name'],'sectionId':_0x288fb6['id']},{})[_0x9e55('0x24')](function(){return _0x7b164b;});}else{return _0x7b164b;}})[_0x9e55('0x43')](function(_0x179783){logger[_0x9e55('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x179783);throw _0x179783;});}return _0x7b164b;})[_0x9e55('0x24')](respondWithResult(_0x31dbf8,0xc9))['catch'](handleError(_0x31dbf8,null));};exports['update']=function(_0x5495fa,_0x510596){if(_0x5495fa[_0x9e55('0x50')]['id']){delete _0x5495fa[_0x9e55('0x50')]['id'];}return db[_0x9e55('0x2e')][_0x9e55('0x4e')]({'where':{'id':_0x5495fa[_0x9e55('0x45')]['id']}})[_0x9e55('0x24')](handleEntityNotFound(_0x510596,null))['then'](saveUpdates(_0x5495fa[_0x9e55('0x50')],null))[_0x9e55('0x24')](respondWithResult(_0x510596,null))[_0x9e55('0x43')](handleError(_0x510596,null));};exports[_0x9e55('0x25')]=function(_0x2700a9,_0x1afce1){return db['Schedule']['find']({'where':{'id':_0x2700a9[_0x9e55('0x45')]['id']}})[_0x9e55('0x24')](handleEntityNotFound(_0x1afce1,null))[_0x9e55('0x24')](removeEntity(_0x1afce1,null))['catch'](handleError(_0x1afce1,null));};exports[_0x9e55('0x51')]=function(_0x16bc7d,_0x504403,_0x412866){var _0x2c0c1c=require('../../config/schedule');return db[_0x9e55('0x2e')]['find']({'where':{'id':_0x16bc7d[_0x9e55('0x45')]['id']},'raw':!![]})[_0x9e55('0x24')](handleEntityNotFound(_0x504403,null))[_0x9e55('0x24')](function(){_0x2c0c1c[_0x9e55('0x51')](_0x16bc7d[_0x9e55('0x45')]['id']);})[_0x9e55('0x24')](respondWithStatusCode(_0x504403,null))[_0x9e55('0x43')](handleError(_0x504403,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 5331132..57107b8 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 _0x8c8a=['./schedule.attributes','Schedule','tools_schedules','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x599508,_0xff98c5){var _0xa7a8d6=function(_0xa4e236){while(--_0xa4e236){_0x599508['push'](_0x599508['shift']());}};_0xa7a8d6(++_0xff98c5);}(_0x8c8a,0x150));var _0xa8c8=function(_0x4d2abc,_0x29b228){_0x4d2abc=_0x4d2abc-0x0;var _0x5c4540=_0x8c8a[_0x4d2abc];return _0x5c4540;};'use strict';var _=require(_0xa8c8('0x0'));var util=require(_0xa8c8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa8c8('0x2'));var rp=require(_0xa8c8('0x3'));var fs=require('fs');var path=require(_0xa8c8('0x4'));var rimraf=require(_0xa8c8('0x5'));var config=require('../../config/environment');var attributes=require(_0xa8c8('0x6'));module['exports']=function(_0x49f92d,_0xfb5724){return _0x49f92d['define'](_0xa8c8('0x7'),attributes,{'tableName':_0xa8c8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a9a=['api','moment','path','rimraf','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger'];(function(_0x512891,_0x46005a){var _0x1c190c=function(_0x42b95b){while(--_0x42b95b){_0x512891['push'](_0x512891['shift']());}};_0x1c190c(++_0x46005a);}(_0x5a9a,0xfa));var _0xa5a9=function(_0x501de3,_0x3883a5){_0x501de3=_0x501de3-0x0;var _0x4d10ea=_0x5a9a[_0x501de3];return _0x4d10ea;};'use strict';var _=require(_0xa5a9('0x0'));var util=require(_0xa5a9('0x1'));var logger=require(_0xa5a9('0x2'))(_0xa5a9('0x3'));var moment=require(_0xa5a9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a9('0x5'));var rimraf=require(_0xa5a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa5a9('0x7'));module['exports']=function(_0x432b95,_0x255975){return _0x432b95[_0xa5a9('0x8')](_0xa5a9('0x9'),attributes,{'tableName':_0xa5a9('0xa'),'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 bd16a75..5dd973c 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 _0x2dc7=['Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x5b8d12,_0x50e01c){var _0x1929aa=function(_0x1c8b84){while(--_0x1c8b84){_0x5b8d12['push'](_0x5b8d12['shift']());}};_0x1929aa(++_0x50e01c);}(_0x2dc7,0x110));var _0x72dc=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x2dc7[_0x174a72];return _0x32cecd;};'use strict';var _=require(_0x72dc('0x0'));var util=require(_0x72dc('0x1'));var moment=require(_0x72dc('0x2'));var BPromise=require(_0x72dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72dc('0x4'));var db=require(_0x72dc('0x5'))['db'];var utils=require(_0x72dc('0x6'));var logger=require('../../config/logger')(_0x72dc('0x7'));var config=require('../../config/environment');var jayson=require(_0x72dc('0x8'));var client=jayson[_0x72dc('0x9')][_0x72dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ebef6,_0x439b7d,_0x2639a6){return new BPromise(function(_0x92bf01,_0x332d0d){return client[_0x72dc('0xb')](_0x2ebef6,_0x2639a6)[_0x72dc('0xc')](function(_0xf931cb){logger[_0x72dc('0xd')](_0x72dc('0xe'),_0x439b7d,'request\x20sent');logger[_0x72dc('0xf')](_0x72dc('0x10'),_0x439b7d,_0x72dc('0x11'),JSON[_0x72dc('0x12')](_0xf931cb));if(_0xf931cb[_0x72dc('0x13')]){if(_0xf931cb[_0x72dc('0x13')][_0x72dc('0x14')]===0x1f4){logger[_0x72dc('0x13')](_0x72dc('0xe'),_0x439b7d,_0xf931cb[_0x72dc('0x13')]['message']);return _0x332d0d(_0xf931cb[_0x72dc('0x13')][_0x72dc('0x15')]);}logger[_0x72dc('0x13')](_0x72dc('0xe'),_0x439b7d,_0xf931cb[_0x72dc('0x13')]['message']);return _0x92bf01(_0xf931cb[_0x72dc('0x13')][_0x72dc('0x15')]);}else{logger[_0x72dc('0xd')](_0x72dc('0xe'),_0x439b7d,_0x72dc('0x11'));_0x92bf01(_0xf931cb[_0x72dc('0x16')][_0x72dc('0x15')]);}})[_0x72dc('0x17')](function(_0x10a535){logger[_0x72dc('0x13')](_0x72dc('0xe'),_0x439b7d,_0x10a535);_0x332d0d(_0x10a535);});});} \ No newline at end of file +var _0xd407=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14f483,_0xa4f335){var _0x27b0a9=function(_0x50219a){while(--_0x50219a){_0x14f483['push'](_0x14f483['shift']());}};_0x27b0a9(++_0xa4f335);}(_0xd407,0x124));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d40('0x0'));var moment=require(_0x7d40('0x1'));var BPromise=require(_0x7d40('0x2'));var rs=require(_0x7d40('0x3'));var fs=require('fs');var Redis=require(_0x7d40('0x4'));var db=require(_0x7d40('0x5'))['db'];var utils=require(_0x7d40('0x6'));var logger=require(_0x7d40('0x7'))('rpc');var config=require(_0x7d40('0x8'));var jayson=require(_0x7d40('0x9'));var client=jayson[_0x7d40('0xa')][_0x7d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a5a6b,_0x66387d,_0x30ee7a){return new BPromise(function(_0x4234b0,_0x4dcdf9){return client[_0x7d40('0xc')](_0x3a5a6b,_0x30ee7a)[_0x7d40('0xd')](function(_0x39f4cf){logger[_0x7d40('0xe')](_0x7d40('0xf'),_0x66387d,_0x7d40('0x10'));logger[_0x7d40('0x11')](_0x7d40('0x12'),_0x66387d,_0x7d40('0x10'),JSON[_0x7d40('0x13')](_0x39f4cf));if(_0x39f4cf[_0x7d40('0x14')]){if(_0x39f4cf['error']['code']===0x1f4){logger[_0x7d40('0x14')](_0x7d40('0xf'),_0x66387d,_0x39f4cf['error'][_0x7d40('0x15')]);return _0x4dcdf9(_0x39f4cf['error'][_0x7d40('0x15')]);}logger[_0x7d40('0x14')](_0x7d40('0xf'),_0x66387d,_0x39f4cf[_0x7d40('0x14')][_0x7d40('0x15')]);return _0x4234b0(_0x39f4cf[_0x7d40('0x14')][_0x7d40('0x15')]);}else{logger[_0x7d40('0xe')]('Schedule,\x20%s,\x20%s',_0x66387d,_0x7d40('0x10'));_0x4234b0(_0x39f4cf['result'][_0x7d40('0x15')]);}})[_0x7d40('0x16')](function(_0x26e728){logger[_0x7d40('0x14')]('Schedule,\x20%s,\x20%s',_0x66387d,_0x26e728);_0x4dcdf9(_0x26e728);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a3fba76..35ac652 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 _0xe205=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0xe205,0xe2));var _0x5e20=function(_0x343e5a,_0x438aa6){_0x343e5a=_0x343e5a-0x0;var _0x37e87f=_0xe205[_0x343e5a];return _0x37e87f;};'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['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e20('0x5'));var interaction=require(_0x5e20('0x6'));var config=require(_0x5e20('0x7'));var controller=require('./screenRecording.controller');router[_0x5e20('0x8')]('/',auth[_0x5e20('0x9')](),controller[_0x5e20('0xa')]);router['get'](_0x5e20('0xb'),auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router['get'](_0x5e20('0xd'),auth[_0x5e20('0x9')](),controller[_0x5e20('0xe')]);router['get']('/:id/download',auth[_0x5e20('0x9')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')]('/',auth['isAuthenticated'](),controller[_0x5e20('0x11')]);router[_0x5e20('0x12')](_0x5e20('0xd'),auth['isAuthenticated'](),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0x9')](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2d5f=['/:id/download','download','post','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x2d5f,0x1ee));var _0xf2d5=function(_0x2d0953,_0x30bcf9){_0x2d0953=_0x2d0953-0x0;var _0x1e824a=_0x2d5f[_0x2d0953];return _0x1e824a;};'use strict';var multer=require(_0xf2d5('0x0'));var util=require(_0xf2d5('0x1'));var path=require('path');var timeout=require(_0xf2d5('0x2'));var express=require(_0xf2d5('0x3'));var router=express['Router']();var fs_extra=require(_0xf2d5('0x4'));var auth=require(_0xf2d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2d5('0x6'));var controller=require('./screenRecording.controller');router[_0xf2d5('0x7')]('/',auth[_0xf2d5('0x8')](),controller['index']);router[_0xf2d5('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xf2d5('0x9')]);router[_0xf2d5('0x7')]('/:id',auth[_0xf2d5('0x8')](),controller['show']);router[_0xf2d5('0x7')](_0xf2d5('0xa'),auth[_0xf2d5('0x8')](),controller[_0xf2d5('0xb')]);router[_0xf2d5('0xc')]('/',auth[_0xf2d5('0x8')](),controller[_0xf2d5('0xd')]);router[_0xf2d5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf2d5('0xf')]);router[_0xf2d5('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf2d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 954cb34..cba3a5c 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 _0xda20=['VIRTUAL','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda20,0x1d9));var _0x0da2=function(_0x58ed03,_0x5d0c77){_0x58ed03=_0x58ed03-0x0;var _0x26d26f=_0xda20[_0x58ed03];return _0x26d26f;};'use strict';var Sequelize=require(_0x0da2('0x0'));var moment=require('moment');var path=require(_0x0da2('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x0da2('0x2')],'get':function(){return this['getDataValue'](_0x0da2('0x3'))?path[_0x0da2('0x4')](this['getDataValue'](_0x0da2('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0x0da2('0x5')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x0da2('0x5')],'set':function(_0x292ede){var _0x166a32=_0x292ede[_0x0da2('0x6')](/\\/g,'/');this[_0x0da2('0x7')](_0x0da2('0x3'),_0x166a32);}},'rating':{'type':Sequelize[_0x0da2('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0da2('0x8')],'set':function(_0x248bce){this['setDataValue'](_0x0da2('0x9'),moment()[_0x0da2('0xa')](_0x248bce,'ms'));this[_0x0da2('0x7')](_0x0da2('0xb'),moment());this['setDataValue']('duration',_0x248bce);}},'startedAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this[_0x0da2('0xd')](_0x0da2('0x9')))[_0x0da2('0xe')](_0x0da2('0xf'))[_0x0da2('0x10')]();}},'closedAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this['getDataValue'](_0x0da2('0xb')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this['getDataValue'](_0x0da2('0x11')))[_0x0da2('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x0da2('0x10')]();}},'updatedAt':{'type':Sequelize[_0x0da2('0xc')],'get':function(){return moment(this['getDataValue'](_0x0da2('0x12')))[_0x0da2('0xe')](_0x0da2('0xf'))['toString']();}}}; \ No newline at end of file +var _0xcd2f=['updatedAt','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','toString','DATE','format','createdAt','MM-DD-YYYY\x20HH:mm'];(function(_0x3f91ac,_0x43dbe3){var _0x23baa4=function(_0x281875){while(--_0x281875){_0x3f91ac['push'](_0x3f91ac['shift']());}};_0x23baa4(++_0x43dbe3);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xcd2f[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');var config=require(_0xfcd2('0x0'));module[_0xfcd2('0x1')]={'format':{'type':Sequelize[_0xfcd2('0x2')],'get':function(){return this[_0xfcd2('0x3')](_0xfcd2('0x4'))?path[_0xfcd2('0x5')](this[_0xfcd2('0x3')](_0xfcd2('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfcd2('0x6')]},'value':{'type':Sequelize[_0xfcd2('0x6')],'set':function(_0x41e836){var _0x20ac59=_0x41e836[_0xfcd2('0x7')](/\\/g,'/');this[_0xfcd2('0x8')](_0xfcd2('0x4'),_0x20ac59);}},'rating':{'type':Sequelize[_0xfcd2('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xfcd2('0x9')],'set':function(_0x358fb4){this[_0xfcd2('0x8')]('startedAt',moment()[_0xfcd2('0xa')](_0x358fb4,'ms'));this[_0xfcd2('0x8')](_0xfcd2('0xb'),moment());this[_0xfcd2('0x8')](_0xfcd2('0xc'),_0x358fb4);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xfcd2('0xd')]();}},'closedAt':{'type':Sequelize[_0xfcd2('0xe')],'get':function(){return moment(this['getDataValue'](_0xfcd2('0xb')))[_0xfcd2('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xfcd2('0xe')],'get':function(){return moment(this[_0xfcd2('0x3')](_0xfcd2('0x10')))[_0xfcd2('0xf')](_0xfcd2('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xfcd2('0xe')],'get':function(){return moment(this[_0xfcd2('0x3')](_0xfcd2('0x12')))[_0xfcd2('0xf')](_0xfcd2('0x11'))[_0xfcd2('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e1a4dfd..9a8b940 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 _0x3eea=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','format','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','Not\x20found','isNil','root','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys'];(function(_0x49397c,_0x5054a8){var _0x3c4bbc=function(_0x4d3c80){while(--_0x4d3c80){_0x49397c['push'](_0x49397c['shift']());}};_0x3c4bbc(++_0x5054a8);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x18f668,_0x501235){_0x18f668=_0x18f668-0x0;var _0x36d137=_0x3eea[_0x18f668];return _0x36d137;};'use strict';var emlformat=require(_0xa3ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ee('0x1'));var jsonpatch=require(_0xa3ee('0x2'));var rp=require(_0xa3ee('0x3'));var moment=require(_0xa3ee('0x4'));var BPromise=require(_0xa3ee('0x5'));var Mustache=require(_0xa3ee('0x6'));var util=require(_0xa3ee('0x7'));var path=require(_0xa3ee('0x8'));var sox=require(_0xa3ee('0x9'));var csv=require(_0xa3ee('0xa'));var ejs=require(_0xa3ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xa'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=typeof _0x5da681[_0xa3ee('0x19')]===_0xa3ee('0x1a')&&typeof _0x5da681[_0xa3ee('0x1b')]===_0xa3ee('0x1a');var _0x4cc8bb=_0x5358aa[_0xa3ee('0x1c')];var _0x40ffdb=_0x4b2c66?0x0:_0x5da681[_0xa3ee('0x19')];var _0x299b1e=_0x4b2c66?_0x5358aa[_0xa3ee('0x1c')]:_0x5da681['offset']+_0x5da681[_0xa3ee('0x1b')];var _0x18b738;if(_0x299b1e>=_0x4cc8bb){_0x299b1e=_0x4cc8bb;_0x18b738=0xc8;}else{_0x18b738=0xce;}_0x23df7d[_0xa3ee('0x1d')](_0x18b738);return _0x23df7d[_0xa3ee('0x1e')](_0xa3ee('0x1f'),_0x40ffdb+'-'+_0x299b1e+'/'+_0x4cc8bb)[_0xa3ee('0x18')](_0x5358aa);}return null;};}function patchUpdates(_0x4f8c56){return function(_0x3f5d70){try{jsonpatch[_0xa3ee('0x20')](_0x3f5d70,_0x4f8c56,!![]);}catch(_0x4b8445){return BPromise[_0xa3ee('0x21')](_0x4b8445);}return _0x3f5d70['save']();};}function saveUpdates(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x22')](_0x2fab5)[_0xa3ee('0x23')](function(_0x47108f){return _0x47108f;});}return null;};}function removeEntity(_0x3ce61b,_0x12108e){return function(_0x5ae0a1){if(_0x5ae0a1){return _0x5ae0a1[_0xa3ee('0x24')]()['then'](function(){_0x3ce61b[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x157071,_0x1fe4b4){return function(_0x2c48db){if(!_0x2c48db){_0x157071['sendStatus'](0x194);}return _0x2c48db;};}function handleError(_0x3c68f9,_0x1b766e){_0x1b766e=_0x1b766e||0x1f4;return function(_0x146493){logger[_0xa3ee('0x25')](_0x146493[_0xa3ee('0x26')]);if(_0x146493[_0xa3ee('0x27')]){delete _0x146493[_0xa3ee('0x27')];}_0x3c68f9[_0xa3ee('0x1d')](_0x1b766e)[_0xa3ee('0x28')](_0x146493);};}exports[_0xa3ee('0x29')]=function(_0x59c6f9,_0x5ba571){var _0x4abf49={},_0x78e581={},_0x481358={'count':0x0,'rows':[]};var _0x3fa094=_[_0xa3ee('0x2a')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')],function(_0x26b222){return{'name':_0x26b222[_0xa3ee('0x2d')],'type':_0x26b222[_0xa3ee('0x2e')][_0xa3ee('0x2f')]};});_0x78e581[_0xa3ee('0x30')]=_[_0xa3ee('0x31')](_['map'](_0x3fa094,_0xa3ee('0x27')),['format']);_0x78e581[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x59c6f9['query']);_0x78e581[_0xa3ee('0x34')]=_['intersection'](_0x78e581[_0xa3ee('0x30')],_0x78e581['query']);_0x4abf49[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x78e581[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x59c6f9[_0xa3ee('0x32')]['fields']));_0x4abf49[_0xa3ee('0x35')]=_0x4abf49[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x4abf49['attributes']:_0x78e581[_0xa3ee('0x30')];if(!_0x59c6f9['query'][_0xa3ee('0x39')]('nolimit')){_0x4abf49[_0xa3ee('0x1b')]=qs['limit'](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x1b')]);_0x4abf49[_0xa3ee('0x19')]=qs[_0xa3ee('0x19')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x19')]);}_0x4abf49[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3b')]);_0x4abf49[_0xa3ee('0x3c')]=qs[_0xa3ee('0x34')](_[_0xa3ee('0x3d')](_0x59c6f9['query'],_0x78e581[_0xa3ee('0x34')]),_0x3fa094);if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]){_0x4abf49[_0xa3ee('0x3c')]=_['merge'](_0x4abf49[_0xa3ee('0x3c')],{'$or':_[_0xa3ee('0x2a')](_0x3fa094,function(_0x1a9b63){if(_0x1a9b63['type']!==_0xa3ee('0x3f')){var _0x3554eb={};_0x3554eb[_0x1a9b63['name']]={'$like':'%'+_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x3e')]+'%'};return _0x3554eb;}})});}_0x4abf49=_['merge']({},_0x4abf49,_0x59c6f9[_0xa3ee('0x40')]);var _0x6dd235={'where':_0x4abf49[_0xa3ee('0x3c')]};return db[_0xa3ee('0x2b')][_0xa3ee('0x1c')](_0x6dd235)[_0xa3ee('0x23')](function(_0x2ca04f){_0x481358[_0xa3ee('0x1c')]=_0x2ca04f;if(_0x59c6f9[_0xa3ee('0x32')][_0xa3ee('0x41')]){_0x4abf49[_0xa3ee('0x42')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x4abf49);})['then'](function(_0x45aeec){_0x481358[_0xa3ee('0x43')]=_0x45aeec;return _0x481358;})['then'](respondWithFilteredResult(_0x5ba571,_0x4abf49))[_0xa3ee('0x44')](handleError(_0x5ba571,null));};exports[_0xa3ee('0x45')]=function(_0x279834,_0x55f47f){var _0x1af10b={'raw':![],'where':{'id':_0x279834[_0xa3ee('0x46')]['id']}},_0x559cc1={};_0x559cc1[_0xa3ee('0x30')]=_[_0xa3ee('0x33')](db[_0xa3ee('0x2b')][_0xa3ee('0x2c')]);_0x559cc1[_0xa3ee('0x32')]=_[_0xa3ee('0x33')](_0x279834[_0xa3ee('0x32')]);_0x559cc1[_0xa3ee('0x34')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],_0x559cc1[_0xa3ee('0x32')]);_0x1af10b[_0xa3ee('0x35')]=_[_0xa3ee('0x36')](_0x559cc1[_0xa3ee('0x30')],qs[_0xa3ee('0x37')](_0x279834[_0xa3ee('0x32')][_0xa3ee('0x37')]));_0x1af10b['attributes']=_0x1af10b[_0xa3ee('0x35')][_0xa3ee('0x38')]?_0x1af10b[_0xa3ee('0x35')]:_0x559cc1[_0xa3ee('0x30')];if(_0x279834['query'][_0xa3ee('0x41')]){_0x1af10b['include']=[{'all':!![]}];}_0x1af10b=_[_0xa3ee('0x47')]({},_0x1af10b,_0x279834[_0xa3ee('0x40')]);return db[_0xa3ee('0x2b')][_0xa3ee('0x48')](_0x1af10b)[_0xa3ee('0x23')](handleEntityNotFound(_0x55f47f,null))[_0xa3ee('0x23')](respondWithResult(_0x55f47f,null))[_0xa3ee('0x44')](handleError(_0x55f47f,null));};exports[_0xa3ee('0x49')]=function(_0x3c3677,_0xd6160e){return db['ScreenRecording'][_0xa3ee('0x49')](_0x3c3677['body'],{})['then'](respondWithResult(_0xd6160e,0xc9))[_0xa3ee('0x44')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x22')]=function(_0x45029f,_0x1ec479){if(_0x45029f[_0xa3ee('0x4a')]['id']){delete _0x45029f[_0xa3ee('0x4a')]['id'];}delete _0x45029f[_0xa3ee('0x4a')]['duration'];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4b')];delete _0x45029f['body'][_0xa3ee('0x4c')];delete _0x45029f[_0xa3ee('0x4a')][_0xa3ee('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x45029f[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](handleEntityNotFound(_0x1ec479,null))[_0xa3ee('0x23')](saveUpdates(_0x45029f[_0xa3ee('0x4a')],null))[_0xa3ee('0x23')](respondWithResult(_0x1ec479,null))['catch'](handleError(_0x1ec479,null));};exports['describe']=function(_0x15b55e,_0x441b23){return db['ScreenRecording'][_0xa3ee('0x4e')]()[_0xa3ee('0x23')](respondWithResult(_0x441b23,null))[_0xa3ee('0x44')](handleError(_0x441b23,null));};exports['download']=function(_0x505444,_0x2388f7,_0x49057c){var _0x172a73=require(_0xa3ee('0x4f'));var _0x5b8e79=![];var _0x4232e0={};if(_0x505444[_0xa3ee('0x32')][_0xa3ee('0x2e')]&&_0x505444['query'][_0xa3ee('0x2e')]===_0xa3ee('0x50')){_0x4232e0['uniqueid']=_0x505444[_0xa3ee('0x46')]['id'];}else{_0x4232e0['id']=_0x505444[_0xa3ee('0x46')]['id'];}return db[_0xa3ee('0x2b')]['find']({'where':_0x4232e0,'attributes':['id','value'],'raw':!![]})[_0xa3ee('0x23')](handleEntityNotFound(_0x2388f7,null))[_0xa3ee('0x23')](function(_0x4a1a2f){if(_0x4a1a2f){var _0x1f9913=path[_0xa3ee('0x51')](config['root'],'server/files/screen_recordings',_0x4a1a2f[_0xa3ee('0x4d')]);var _0x659491=util[_0xa3ee('0x52')]('%s.cypher',_0x1f9913);if(fs[_0xa3ee('0x53')](_0x659491)){_0x5b8e79=!![];return _0x172a73[_0xa3ee('0x54')](_0x659491,_0x1f9913,config[_0xa3ee('0x55')][_0xa3ee('0x56')])[_0xa3ee('0x23')](function(){return _0x4a1a2f;});}return _0x4a1a2f;}})[_0xa3ee('0x23')](function(_0x497be4){if(_0x497be4){var _0x10f508=path[_0xa3ee('0x51')](config['root'],_0xa3ee('0x57'),_0x497be4[_0xa3ee('0x4d')]);if(!fs[_0xa3ee('0x53')](_0x10f508)){throw new db[(_0xa3ee('0x58'))][(_0xa3ee('0x59'))](_0xa3ee('0x5a'));}if(_0x497be4['filename']){return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,_0x497be4[_0xa3ee('0x5c')]+path[_0xa3ee('0x5d')](_0x10f508),function(){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}else{return _0x2388f7[_0xa3ee('0x5b')](_0x10f508,function(_0x13b81b){if(_0x5b8e79){fs['unlink'](_0x10f508);}});}}})['catch'](function(_0x4df186){if(_0x4df186['message']===_0xa3ee('0x5a')){_0x2388f7[_0xa3ee('0x1d')](0x194)[_0xa3ee('0x28')](_0xa3ee('0x5e'));}else{return handleError(_0x2388f7,null);}});};exports[_0xa3ee('0x24')]=function(_0x18a164,_0x4000ee){return db['ScreenRecording'][_0xa3ee('0x48')]({'where':{'id':_0x18a164[_0xa3ee('0x46')]['id']}})[_0xa3ee('0x23')](function(_0xaff641){if(_[_0xa3ee('0x5f')](_0xaff641)){throw new ReferenceError('Entity\x20not\x20found');}return _0xaff641;})['then'](function(_0x7b1e97){var _0x303b71=path[_0xa3ee('0x51')](config[_0xa3ee('0x60')],_0xa3ee('0x57'),_0x7b1e97[_0xa3ee('0x4d')]);logger[_0xa3ee('0x61')](_0xa3ee('0x62'),_0x303b71);if(!_[_0xa3ee('0x5f')](_0x7b1e97[_0xa3ee('0x4d')])&&fs[_0xa3ee('0x53')](_0x303b71)){logger[_0xa3ee('0x61')](_0xa3ee('0x63')+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}_0x303b71=_0x303b71+'.cypher';if(!_[_0xa3ee('0x5f')](_0x7b1e97['value'])&&fs['existsSync'](_0x303b71)){logger[_0xa3ee('0x61')]('File:\x20\x22'+_0x303b71+_0xa3ee('0x64'));fs[_0xa3ee('0x65')](_0x303b71);}return _0x7b1e97;})[_0xa3ee('0x23')](function(_0x221deb){if(!_0x221deb)throw new InternalError();return _0x221deb['destroy']();})[_0xa3ee('0x23')](function(){_0x4000ee[_0xa3ee('0x1d')](0xcc)[_0xa3ee('0x17')]();})[_0xa3ee('0x44')](handleError(_0x4000ee,null));}; \ No newline at end of file +var _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x4a81e4,_0x3e1e9f){var _0x59aea8=function(_0xa8e630){while(--_0xa8e630){_0x4a81e4['push'](_0x4a81e4['shift']());}};_0x59aea8(++_0x3e1e9f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x00bb[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 037bff0..cbec313 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 _0xb60d=['moment','bluebird','request-promise','rimraf','define','ScreenRecording','lodash','util','../../config/logger','api'];(function(_0x147342,_0x5698d3){var _0x5c4434=function(_0x36b5ef){while(--_0x36b5ef){_0x147342['push'](_0x147342['shift']());}};_0x5c4434(++_0x5698d3);}(_0xb60d,0x100));var _0xdb60=function(_0x342217,_0x1cbbd7){_0x342217=_0x342217-0x0;var _0x2098bc=_0xb60d[_0x342217];return _0x2098bc;};'use strict';var _=require(_0xdb60('0x0'));var util=require(_0xdb60('0x1'));var logger=require(_0xdb60('0x2'))(_0xdb60('0x3'));var moment=require(_0xdb60('0x4'));var BPromise=require(_0xdb60('0x5'));var rp=require(_0xdb60('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb60('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x4cc120,_0x4de7d2){return _0x4cc120[_0xdb60('0x8')](_0xdb60('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4946=['path','../../config/environment','exports','define','ScreenRecording','interactionid','util','../../config/logger','api','moment','request-promise'];(function(_0x328026,_0x55df53){var _0x246abe=function(_0x360994){while(--_0x360994){_0x328026['push'](_0x328026['shift']());}};_0x246abe(++_0x55df53);}(_0x4946,0xed));var _0x6494=function(_0x2bad90,_0x38442c){_0x2bad90=_0x2bad90-0x0;var _0x1de2d9=_0x4946[_0x2bad90];return _0x1de2d9;};'use strict';var _=require('lodash');var util=require(_0x6494('0x0'));var logger=require(_0x6494('0x1'))(_0x6494('0x2'));var moment=require(_0x6494('0x3'));var BPromise=require('bluebird');var rp=require(_0x6494('0x4'));var fs=require('fs');var path=require(_0x6494('0x5'));var rimraf=require('rimraf');var config=require(_0x6494('0x6'));var attributes=require('./screenRecording.attributes');module[_0x6494('0x7')]=function(_0x5af0fa,_0x4ae2e2){return _0x5af0fa[_0x6494('0x8')](_0x6494('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x6494('0xa'),'fields':[_0x6494('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6186c91..ea33cf2 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 _0x35c0=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message'];(function(_0x2fb561,_0x579dbf){var _0x2b7be3=function(_0x578df4){while(--_0x578df4){_0x2fb561['push'](_0x2fb561['shift']());}};_0x2b7be3(++_0x579dbf);}(_0x35c0,0x8b));var _0x035c=function(_0xb12603,_0x142505){_0xb12603=_0xb12603-0x0;var _0x2bdc24=_0x35c0[_0xb12603];return _0x2bdc24;};'use strict';var _=require(_0x035c('0x0'));var util=require(_0x035c('0x1'));var moment=require(_0x035c('0x2'));var BPromise=require(_0x035c('0x3'));var rs=require(_0x035c('0x4'));var fs=require('fs');var Redis=require(_0x035c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x035c('0x6'));var logger=require(_0x035c('0x7'))(_0x035c('0x8'));var config=require(_0x035c('0x9'));var jayson=require(_0x035c('0xa'));var client=jayson[_0x035c('0xb')][_0x035c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a4ef2,_0x5e98cc,_0x5d3940){return new BPromise(function(_0x1e470f,_0x3db30e){return client[_0x035c('0xd')](_0x1a4ef2,_0x5d3940)['then'](function(_0x431ae6){logger[_0x035c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x5e98cc,_0x035c('0xf'));logger[_0x035c('0x10')](_0x035c('0x11'),_0x5e98cc,_0x035c('0xf'),JSON[_0x035c('0x12')](_0x431ae6));if(_0x431ae6['error']){if(_0x431ae6[_0x035c('0x13')]['code']===0x1f4){logger[_0x035c('0x13')](_0x035c('0x14'),_0x5e98cc,_0x431ae6['error'][_0x035c('0x15')]);return _0x3db30e(_0x431ae6[_0x035c('0x13')]['message']);}logger[_0x035c('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x5e98cc,_0x431ae6['error'][_0x035c('0x15')]);return _0x1e470f(_0x431ae6[_0x035c('0x13')][_0x035c('0x15')]);}else{logger[_0x035c('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x5e98cc,_0x035c('0xf'));_0x1e470f(_0x431ae6[_0x035c('0x16')][_0x035c('0x15')]);}})['catch'](function(_0x2f3e34){logger[_0x035c('0x13')](_0x035c('0x14'),_0x5e98cc,_0x2f3e34);_0x3db30e(_0x2f3e34);});});} \ No newline at end of file +var _0x3e1c=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x149c9c,_0x249082){var _0x47c99=function(_0x2ebc3e){while(--_0x2ebc3e){_0x149c9c['push'](_0x149c9c['shift']());}};_0x47c99(++_0x249082);}(_0x3e1c,0x84));var _0xc3e1=function(_0xd7b3a7,_0xf2fac7){_0xd7b3a7=_0xd7b3a7-0x0;var _0x1028c1=_0x3e1c[_0xd7b3a7];return _0x1028c1;};'use strict';var _=require(_0xc3e1('0x0'));var util=require(_0xc3e1('0x1'));var moment=require(_0xc3e1('0x2'));var BPromise=require(_0xc3e1('0x3'));var rs=require(_0xc3e1('0x4'));var fs=require('fs');var Redis=require(_0xc3e1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc3e1('0x6'))(_0xc3e1('0x7'));var config=require(_0xc3e1('0x8'));var jayson=require(_0xc3e1('0x9'));var client=jayson[_0xc3e1('0xa')][_0xc3e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21d559,_0x48fcf4,_0x2572fc){return new BPromise(function(_0x3eea9b,_0x34b92c){return client[_0xc3e1('0xc')](_0x21d559,_0x2572fc)[_0xc3e1('0xd')](function(_0x55f178){logger[_0xc3e1('0xe')](_0xc3e1('0xf'),_0x48fcf4,'request\x20sent');logger['debug'](_0xc3e1('0x10'),_0x48fcf4,'request\x20sent',JSON[_0xc3e1('0x11')](_0x55f178));if(_0x55f178[_0xc3e1('0x12')]){if(_0x55f178['error'][_0xc3e1('0x13')]===0x1f4){logger[_0xc3e1('0x12')](_0xc3e1('0xf'),_0x48fcf4,_0x55f178[_0xc3e1('0x12')][_0xc3e1('0x14')]);return _0x34b92c(_0x55f178['error'][_0xc3e1('0x14')]);}logger['error'](_0xc3e1('0xf'),_0x48fcf4,_0x55f178[_0xc3e1('0x12')][_0xc3e1('0x14')]);return _0x3eea9b(_0x55f178[_0xc3e1('0x12')]['message']);}else{logger[_0xc3e1('0xe')](_0xc3e1('0xf'),_0x48fcf4,'request\x20sent');_0x3eea9b(_0x55f178['result']['message']);}})[_0xc3e1('0x15')](function(_0x2b3600){logger['error'](_0xc3e1('0xf'),_0x48fcf4,_0x2b3600);_0x34b92c(_0x2b3600);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2be3690..44455cf 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 _0x81db=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file','addLogo','join','%s%s','logologin','preferred','addPreferred','favicon','addFavicon','put','/:id','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/logo'];(function(_0x19ebfd,_0x5ae121){var _0x11017a=function(_0x24db17){while(--_0x24db17){_0x19ebfd['push'](_0x19ebfd['shift']());}};_0x11017a(++_0x5ae121);}(_0x81db,0x9f));var _0xb81d=function(_0x212e58,_0x498378){_0x212e58=_0x212e58-0x0;var _0x4f42e0=_0x81db[_0x212e58];return _0x4f42e0;};'use strict';var multer=require(_0xb81d('0x0'));var util=require('util');var path=require(_0xb81d('0x1'));var timeout=require(_0xb81d('0x2'));var express=require('express');var router=express[_0xb81d('0x3')]();var fs_extra=require(_0xb81d('0x4'));var auth=require(_0xb81d('0x5'));var interaction=require(_0xb81d('0x6'));var config=require(_0xb81d('0x7'));var controller=require('./setting.controller');router[_0xb81d('0x8')]('/',auth[_0xb81d('0x9')](),controller[_0xb81d('0xa')]);router['get']('/now',controller['getDate']);router[_0xb81d('0x8')]('/:id',controller[_0xb81d('0xb')]);router[_0xb81d('0x8')](_0xb81d('0xc'),controller[_0xb81d('0xd')]);router[_0xb81d('0x8')](_0xb81d('0xe'),controller[_0xb81d('0xf')]);router['get'](_0xb81d('0x10'),controller['gdpr']);router[_0xb81d('0x8')](_0xb81d('0x11'),controller[_0xb81d('0x12')]);router[_0xb81d('0x8')](_0xb81d('0x13'),controller[_0xb81d('0x14')]);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0xbf4077,_0x2128d4,_0x1faf48){_0x1faf48(null,path['join'](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x569281,_0x374142,_0x7ba85e){_0x7ba85e(null,util[_0xb81d('0x18')]('%s%s',_0xb81d('0x19'),path[_0xb81d('0x1a')](_0x374142[_0xb81d('0x1b')])));}})});router[_0xb81d('0x1c')](_0xb81d('0xc'),upload[_0xb81d('0x1d')](_0xb81d('0x1e')),controller[_0xb81d('0x1f')]);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0xd146f8,_0x2f613e,_0x3b53c9){_0x3b53c9(null,path[_0xb81d('0x20')](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x399f3e,_0x3de4a9,_0x26d1fa){_0x26d1fa(null,util[_0xb81d('0x18')](_0xb81d('0x21'),_0xb81d('0x22'),path['extname'](_0x3de4a9['originalname'])));}})});router[_0xb81d('0x1c')](_0xb81d('0xe'),upload[_0xb81d('0x1d')](_0xb81d('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0x5ca894,_0x40dcf8,_0x1ed9db){_0x1ed9db(null,path[_0xb81d('0x20')](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x4ac4b4,_0x3e2fd3,_0x4b8152){_0x4b8152(null,util[_0xb81d('0x18')]('%s%s',_0xb81d('0x23'),path[_0xb81d('0x1a')](_0x3e2fd3[_0xb81d('0x1b')])));}})});router[_0xb81d('0x1c')]('/:id/preferred',upload[_0xb81d('0x1d')](_0xb81d('0x1e')),controller[_0xb81d('0x24')]);var upload=multer({'storage':multer[_0xb81d('0x15')]({'destination':function(_0x5cf5ba,_0x55acb7,_0x2c2a29){_0x2c2a29(null,path[_0xb81d('0x20')](config[_0xb81d('0x16')],_0xb81d('0x17')));},'filename':function(_0x246d48,_0x228828,_0x2473e2){_0x2473e2(null,util[_0xb81d('0x18')](_0xb81d('0x21'),_0xb81d('0x25'),path[_0xb81d('0x1a')](_0x228828[_0xb81d('0x1b')])));}})});router['post'](_0xb81d('0x13'),upload['single'](_0xb81d('0x1e')),controller[_0xb81d('0x26')]);router[_0xb81d('0x27')](_0xb81d('0x28'),auth[_0xb81d('0x9')](),controller[_0xb81d('0x29')]);module[_0xb81d('0x2a')]=router; \ No newline at end of file +var _0x5b52=['/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','logo','originalname','file','addLogo','server/files/images/logos/','logologin','extname','post','addLogoLogin','preferred','single','addPreferred','favicon','/:id/favicon','addFavicon','update','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated'];(function(_0xdd7ad9,_0x21c0fe){var _0x136202=function(_0x1ea017){while(--_0x1ea017){_0xdd7ad9['push'](_0xdd7ad9['shift']());}};_0x136202(++_0x21c0fe);}(_0x5b52,0xa2));var _0x25b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b52[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x25b5('0x0'));var util=require('util');var path=require(_0x25b5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x25b5('0x2')]();var fs_extra=require(_0x25b5('0x3'));var auth=require(_0x25b5('0x4'));var interaction=require(_0x25b5('0x5'));var config=require(_0x25b5('0x6'));var controller=require(_0x25b5('0x7'));router[_0x25b5('0x8')]('/',auth[_0x25b5('0x9')](),controller['index']);router['get'](_0x25b5('0xa'),controller['getDate']);router[_0x25b5('0x8')](_0x25b5('0xb'),controller[_0x25b5('0xc')]);router['get'](_0x25b5('0xd'),controller['getLogo']);router[_0x25b5('0x8')](_0x25b5('0xe'),controller[_0x25b5('0xf')]);router[_0x25b5('0x8')](_0x25b5('0x10'),controller[_0x25b5('0x11')]);router['get'](_0x25b5('0x12'),controller[_0x25b5('0x13')]);router[_0x25b5('0x8')]('/:id/favicon',controller[_0x25b5('0x14')]);var upload=multer({'storage':multer[_0x25b5('0x15')]({'destination':function(_0x4dfd8b,_0xa96fb9,_0x45ff77){_0x45ff77(null,path[_0x25b5('0x16')](config[_0x25b5('0x17')],'server/files/images/logos/'));},'filename':function(_0x332c40,_0x49b6a0,_0x271107){_0x271107(null,util[_0x25b5('0x18')](_0x25b5('0x19'),_0x25b5('0x1a'),path['extname'](_0x49b6a0[_0x25b5('0x1b')])));}})});router['post'](_0x25b5('0xd'),upload['single'](_0x25b5('0x1c')),controller[_0x25b5('0x1d')]);var upload=multer({'storage':multer[_0x25b5('0x15')]({'destination':function(_0x27fa22,_0x25f607,_0xfd6ef1){_0xfd6ef1(null,path[_0x25b5('0x16')](config[_0x25b5('0x17')],_0x25b5('0x1e')));},'filename':function(_0x188f44,_0x477ed2,_0x5c3d17){_0x5c3d17(null,util[_0x25b5('0x18')]('%s%s',_0x25b5('0x1f'),path[_0x25b5('0x20')](_0x477ed2[_0x25b5('0x1b')])));}})});router[_0x25b5('0x21')](_0x25b5('0xe'),upload['single'](_0x25b5('0x1c')),controller[_0x25b5('0x22')]);var upload=multer({'storage':multer[_0x25b5('0x15')]({'destination':function(_0x481673,_0x34270e,_0x236fd5){_0x236fd5(null,path['join'](config[_0x25b5('0x17')],'server/files/images/logos/'));},'filename':function(_0x5490b2,_0x45cef3,_0x43eaea){_0x43eaea(null,util[_0x25b5('0x18')](_0x25b5('0x19'),_0x25b5('0x23'),path[_0x25b5('0x20')](_0x45cef3['originalname'])));}})});router['post'](_0x25b5('0x12'),upload[_0x25b5('0x24')]('file'),controller[_0x25b5('0x25')]);var upload=multer({'storage':multer[_0x25b5('0x15')]({'destination':function(_0x2ff02d,_0x46e5d9,_0xa4a727){_0xa4a727(null,path[_0x25b5('0x16')](config[_0x25b5('0x17')],_0x25b5('0x1e')));},'filename':function(_0x5ede70,_0x5d67e5,_0x5719d5){_0x5719d5(null,util[_0x25b5('0x18')](_0x25b5('0x19'),_0x25b5('0x26'),path[_0x25b5('0x20')](_0x5d67e5[_0x25b5('0x1b')])));}})});router[_0x25b5('0x21')](_0x25b5('0x27'),upload[_0x25b5('0x24')](_0x25b5('0x1c')),controller[_0x25b5('0x28')]);router['put'](_0x25b5('0xb'),auth[_0x25b5('0x9')](),controller[_0x25b5('0x29')]);module[_0x25b5('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 9b72b2c..b277a53 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 _0xd481=['min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xd481,0x1e4));var _0x1d48=function(_0x1fdc33,_0x5cfe5a){_0x1fdc33=_0x1fdc33-0x0;var _0x761952=_0xd481[_0x1fdc33];return _0x761952;};'use strict';var Sequelize=require(_0x1d48('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x1d48('0x1')](0xb),'unique':_0x1d48('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1d48('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1d48('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1d48('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x1d48('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1d48('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1d48('0x4')]},'turnaddr':{'type':Sequelize[_0x1d48('0x4')]},'turnusername':{'type':Sequelize[_0x1d48('0x4')]},'turnpassword':{'type':Sequelize[_0x1d48('0x4')]},'pageTitle':{'type':Sequelize[_0x1d48('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1d48('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x1d48('0x6')},'enableEmailPreview':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1d48('0x4')],'defaultValue':_0x1d48('0x7')},'chatTimeout':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1d48('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1d48('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x1d48('0x4')]},'sentiment':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1d48('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1d48('0x4')]},'language':{'type':Sequelize[_0x1d48('0x4')]},'bucket':{'type':Sequelize[_0x1d48('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x1d48('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1d48('0x1')](0x2)[_0x1d48('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1d48('0x1')](0x2)[_0x1d48('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1d48('0x1')](0x2)[_0x1d48('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x1d48('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1d48('0x1')],'defaultValue':0x14}}; \ No newline at end of file +var _0x3f48=['alternate','UNSIGNED','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x132fc8,_0x4f10c0){var _0x194b1d=function(_0x18024e){while(--_0x18024e){_0x132fc8['push'](_0x132fc8['shift']());}};_0x194b1d(++_0x4f10c0);}(_0x3f48,0x17c));var _0x83f4=function(_0x2a74dc,_0x243c46){_0x2a74dc=_0x2a74dc-0x0;var _0x56784c=_0x3f48[_0x2a74dc];return _0x56784c;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x83f4('0x0')](0xb),'unique':_0x83f4('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x83f4('0x0')](0xb),'unique':_0x83f4('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x83f4('0x3')],'defaultValue':_0x83f4('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x83f4('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x83f4('0x3')]},'turnaddr':{'type':Sequelize[_0x83f4('0x3')]},'turnusername':{'type':Sequelize[_0x83f4('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x83f4('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x83f4('0x6')},'enableEmailPreview':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x83f4('0x7')},'chatTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x83f4('0x3')]},'defaultPreferred':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x83f4('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x83f4('0x3')]},'defaultFavicon':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x83f4('0x3')]},'sentiment':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x83f4('0x0')]},'sentimentRegion':{'type':Sequelize[_0x83f4('0x3')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x83f4('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x83f4('0x0')](0x2)[_0x83f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x83f4('0x0')](0x2)[_0x83f4('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x83f4('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x83f4('0x0')](0x2)[_0x83f4('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 426a496..be90a13 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 _0xa2cf=['sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','update','then','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','options','includeAll','show','params','fields','merge','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','getFavicon','server/files/images/logos','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3ba9ec,_0x49c244){var _0x39f681=function(_0x5da9c0){while(--_0x5da9c0){_0x3ba9ec['push'](_0x3ba9ec['shift']());}};_0x39f681(++_0x49c244);}(_0xa2cf,0x15c));var _0xfa2c=function(_0x16be86,_0x143002){_0x16be86=_0x16be86-0x0;var _0x163033=_0xa2cf[_0x16be86];return _0x163033;};'use strict';var emlformat=require(_0xfa2c('0x0'));var rimraf=require(_0xfa2c('0x1'));var zipdir=require(_0xfa2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa2c('0x3'));var moment=require(_0xfa2c('0x4'));var BPromise=require(_0xfa2c('0x5'));var Mustache=require(_0xfa2c('0x6'));var util=require(_0xfa2c('0x7'));var path=require(_0xfa2c('0x8'));var sox=require(_0xfa2c('0x9'));var csv=require(_0xfa2c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa2c('0xb'));var _=require(_0xfa2c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa2c('0xd'));var deskjs=require(_0xfa2c('0xe'));var toCsv=require(_0xfa2c('0xa'));var querystring=require(_0xfa2c('0xf'));var Papa=require(_0xfa2c('0x10'));var Redis=require('ioredis');var authService=require(_0xfa2c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfa2c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa2c('0x13'))(_0xfa2c('0x14'));var utils=require(_0xfa2c('0x15'));var config=require(_0xfa2c('0x16'));var licenseUtil=require(_0xfa2c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xfa2c('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4091b2,_0x3605ff,_0x105582,_0x1ef93c){return new BPromise(function(_0x26e208,_0x2fa9cb){var _0x200858=_0x1ef93c||client;return _0x200858[_0xfa2c('0x19')](_0x4091b2,_0x105582)['then'](function(_0x443fdd){logger[_0xfa2c('0x1a')](_0xfa2c('0x1b'),_0x3605ff,_0xfa2c('0x1c'));logger['debug'](_0xfa2c('0x1d'),_0x3605ff,_0xfa2c('0x1c'),JSON['stringify'](_0x443fdd));if(_0x443fdd['error']){if(_0x443fdd[_0xfa2c('0x1e')][_0xfa2c('0x1f')]===0x1f4){logger[_0xfa2c('0x1e')](_0xfa2c('0x1b'),_0x3605ff,_0x443fdd[_0xfa2c('0x1e')][_0xfa2c('0x20')]);return _0x2fa9cb(_0x443fdd[_0xfa2c('0x1e')]['message']);}logger[_0xfa2c('0x1e')](_0xfa2c('0x1b'),_0x3605ff,_0x443fdd[_0xfa2c('0x1e')][_0xfa2c('0x20')]);return _0x26e208(_0x443fdd['error'][_0xfa2c('0x20')]);}else{logger[_0xfa2c('0x1a')](_0xfa2c('0x1b'),_0x3605ff,_0xfa2c('0x1c'));_0x26e208(_0x443fdd[_0xfa2c('0x21')]['message']);}})[_0xfa2c('0x22')](function(_0x588237){logger[_0xfa2c('0x1e')](_0xfa2c('0x1b'),_0x3605ff,_0x588237);_0x2fa9cb(_0x588237);});});}function respondWithStatusCode(_0x5e29aa,_0x1f5a09){_0x1f5a09=_0x1f5a09||0xcc;return function(_0x3a630b){if(_0x3a630b){return _0x5e29aa[_0xfa2c('0x23')](_0x1f5a09);}return _0x5e29aa[_0xfa2c('0x24')](_0x1f5a09)[_0xfa2c('0x25')]();};}function respondWithResult(_0x2a0812,_0x43dbae){_0x43dbae=_0x43dbae||0xc8;return function(_0xde5a3a){if(_0xde5a3a){return _0x2a0812['status'](_0x43dbae)[_0xfa2c('0x26')](_0xde5a3a);}};}function respondWithFilteredResult(_0x2ca781,_0x33035a){return function(_0x2cfb17){if(_0x2cfb17){var _0x1bb22c=typeof _0x33035a['offset']===_0xfa2c('0x27')&&typeof _0x33035a['limit']===_0xfa2c('0x27');var _0x410fbd=_0x2cfb17[_0xfa2c('0x28')];var _0x11dfa7=_0x1bb22c?0x0:_0x33035a[_0xfa2c('0x29')];var _0x3e0f68=_0x1bb22c?_0x2cfb17['count']:_0x33035a[_0xfa2c('0x29')]+_0x33035a[_0xfa2c('0x2a')];var _0x43f351;if(_0x3e0f68>=_0x410fbd){_0x3e0f68=_0x410fbd;_0x43f351=0xc8;}else{_0x43f351=0xce;}_0x2ca781['status'](_0x43f351);return _0x2ca781[_0xfa2c('0x2b')]('Content-Range',_0x11dfa7+'-'+_0x3e0f68+'/'+_0x410fbd)[_0xfa2c('0x26')](_0x2cfb17);}return null;};}function patchUpdates(_0x102988){return function(_0x1f9307){try{jsonpatch[_0xfa2c('0x2c')](_0x1f9307,_0x102988,!![]);}catch(_0x540d2a){return BPromise['reject'](_0x540d2a);}return _0x1f9307['save']();};}function saveUpdates(_0x4e7007,_0x399140){return function(_0x1b0628){if(_0x1b0628){return _0x1b0628[_0xfa2c('0x2d')](_0x4e7007)[_0xfa2c('0x2e')](function(_0x1a6372){return _0x1a6372;});}return null;};}function removeEntity(_0xdb1d52,_0x47dbf4){return function(_0x4a4f27){if(_0x4a4f27){return _0x4a4f27[_0xfa2c('0x2f')]()[_0xfa2c('0x2e')](function(){_0xdb1d52[_0xfa2c('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd4e1,_0x297ab1){return function(_0x38a313){if(!_0x38a313){_0x2cd4e1[_0xfa2c('0x23')](0x194);}return _0x38a313;};}function handleError(_0x33ff49,_0x1210d5){_0x1210d5=_0x1210d5||0x1f4;return function(_0x508789){logger['error'](_0x508789[_0xfa2c('0x30')]);if(_0x508789[_0xfa2c('0x31')]){delete _0x508789['name'];}_0x33ff49[_0xfa2c('0x24')](_0x1210d5)['send'](_0x508789);};}exports[_0xfa2c('0x32')]=function(_0x2b31dc,_0x59357b){var _0x555616={},_0x1c077a={},_0x36e8f9={'count':0x0,'rows':[]};var _0x5f02a2=_[_0xfa2c('0x33')](db[_0xfa2c('0x34')]['rawAttributes'],function(_0x5cf3d6){return{'name':_0x5cf3d6[_0xfa2c('0x35')],'type':_0x5cf3d6[_0xfa2c('0x36')][_0xfa2c('0x37')]};});_0x1c077a[_0xfa2c('0x38')]=_[_0xfa2c('0x33')](_0x5f02a2,_0xfa2c('0x31'));_0x1c077a[_0xfa2c('0x39')]=_[_0xfa2c('0x3a')](_0x2b31dc[_0xfa2c('0x39')]);_0x1c077a[_0xfa2c('0x3b')]=_['intersection'](_0x1c077a[_0xfa2c('0x38')],_0x1c077a[_0xfa2c('0x39')]);_0x555616[_0xfa2c('0x3c')]=_[_0xfa2c('0x3d')](_0x1c077a[_0xfa2c('0x38')],qs['fields'](_0x2b31dc['query']['fields']));_0x555616[_0xfa2c('0x3c')]=_0x555616[_0xfa2c('0x3c')][_0xfa2c('0x3e')]?_0x555616[_0xfa2c('0x3c')]:_0x1c077a[_0xfa2c('0x38')];if(!_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x3f')](_0xfa2c('0x40'))){_0x555616[_0xfa2c('0x2a')]=qs[_0xfa2c('0x2a')](_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x2a')]);_0x555616[_0xfa2c('0x29')]=qs['offset'](_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x29')]);}_0x555616[_0xfa2c('0x41')]=qs['sort'](_0x2b31dc[_0xfa2c('0x39')]['sort']);_0x555616['where']=qs[_0xfa2c('0x3b')](_[_0xfa2c('0x42')](_0x2b31dc[_0xfa2c('0x39')],_0x1c077a[_0xfa2c('0x3b')]),_0x5f02a2);if(_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x43')]){_0x555616['where']=_['merge'](_0x555616[_0xfa2c('0x44')],{'$or':_[_0xfa2c('0x33')](_0x5f02a2,function(_0x142d31){if(_0x142d31['type']!==_0xfa2c('0x45')){var _0x1b7436={};_0x1b7436[_0x142d31[_0xfa2c('0x31')]]={'$like':'%'+_0x2b31dc[_0xfa2c('0x39')][_0xfa2c('0x43')]+'%'};return _0x1b7436;}})});}_0x555616=_['merge']({},_0x555616,_0x2b31dc[_0xfa2c('0x46')]);var _0x32443={'where':_0x555616[_0xfa2c('0x44')]};return db[_0xfa2c('0x34')]['count'](_0x32443)[_0xfa2c('0x2e')](function(_0x2b6bdd){_0x36e8f9[_0xfa2c('0x28')]=_0x2b6bdd;if(_0x2b31dc['query'][_0xfa2c('0x47')]){_0x555616['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x555616);})[_0xfa2c('0x2e')](function(_0x26f292){_0x36e8f9['rows']=_0x26f292;return _0x36e8f9;})[_0xfa2c('0x2e')](respondWithFilteredResult(_0x59357b,_0x555616))[_0xfa2c('0x22')](handleError(_0x59357b,null));};exports[_0xfa2c('0x48')]=function(_0x100076,_0x14dad9){var _0x532386={'raw':![],'where':{'id':_0x100076[_0xfa2c('0x49')]['id']}},_0x201913={};_0x201913[_0xfa2c('0x38')]=_[_0xfa2c('0x3a')](db[_0xfa2c('0x34')]['rawAttributes']);_0x201913[_0xfa2c('0x39')]=_[_0xfa2c('0x3a')](_0x100076[_0xfa2c('0x39')]);_0x201913['filters']=_[_0xfa2c('0x3d')](_0x201913[_0xfa2c('0x38')],_0x201913[_0xfa2c('0x39')]);_0x532386[_0xfa2c('0x3c')]=_[_0xfa2c('0x3d')](_0x201913[_0xfa2c('0x38')],qs[_0xfa2c('0x4a')](_0x100076[_0xfa2c('0x39')][_0xfa2c('0x4a')]));_0x532386[_0xfa2c('0x3c')]=_0x532386[_0xfa2c('0x3c')][_0xfa2c('0x3e')]?_0x532386['attributes']:_0x201913[_0xfa2c('0x38')];if(_0x100076[_0xfa2c('0x39')]['includeAll']){_0x532386['include']=[{'all':!![]}];}_0x532386=_[_0xfa2c('0x4b')]({},_0x532386,_0x100076[_0xfa2c('0x46')]);return db[_0xfa2c('0x34')][_0xfa2c('0x4c')](_0x532386)[_0xfa2c('0x2e')](handleEntityNotFound(_0x14dad9,null))['then'](respondWithResult(_0x14dad9,null))[_0xfa2c('0x22')](handleError(_0x14dad9,null));};exports[_0xfa2c('0x2d')]=function(_0x43a76e,_0x2b7ece){if(_0x43a76e['body']['id']){delete _0x43a76e['body']['id'];}return db['Setting'][_0xfa2c('0x4c')]({'where':{'id':_0x43a76e[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x2b7ece,null))[_0xfa2c('0x2e')](saveUpdates(_0x43a76e[_0xfa2c('0x4d')],null))['then'](respondWithResult(_0x2b7ece,null))[_0xfa2c('0x22')](handleError(_0x2b7ece,null));};exports[_0xfa2c('0x4e')]=function(_0x432a87,_0x2ee873,_0x4209e2){if(_0x432a87[_0xfa2c('0x4f')]&&_0x432a87[_0xfa2c('0x4f')][_0xfa2c('0x50')]){_0x432a87['body'][_0xfa2c('0x51')]=_0x432a87[_0xfa2c('0x4f')][_0xfa2c('0x50')];}return db['Setting'][_0xfa2c('0x4c')]({'where':{'id':_0x432a87[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x2ee873,null))[_0xfa2c('0x2e')](saveUpdates(_0x432a87[_0xfa2c('0x4d')],null))[_0xfa2c('0x2e')](respondWithResult(_0x2ee873,null))[_0xfa2c('0x22')](handleError(_0x2ee873,null));};exports[_0xfa2c('0x52')]=function(_0x1542e8,_0x3b435a,_0x35f27b){if(_0x1542e8[_0xfa2c('0x4f')]&&_0x1542e8[_0xfa2c('0x4f')]['filename']){_0x1542e8[_0xfa2c('0x4d')][_0xfa2c('0x53')]=_0x1542e8[_0xfa2c('0x4f')][_0xfa2c('0x50')];}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x1542e8[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x3b435a,null))[_0xfa2c('0x2e')](saveUpdates(_0x1542e8['body'],null))[_0xfa2c('0x2e')](respondWithResult(_0x3b435a,null))[_0xfa2c('0x22')](handleError(_0x3b435a,null));};var utilLicense=require('../../config/license/util');exports[_0xfa2c('0x54')]=function(_0x13811f,_0x382a87,_0x306b00){var _0x34daa2='server/files/images/logos';var _0x4d776c={'custom':![]};return utilLicense[_0xfa2c('0x55')]()[_0xfa2c('0x2e')](function(_0xbd0e5b){if(_0xbd0e5b){_0x4d776c=_0xbd0e5b;}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x13811f[_0xfa2c('0x49')]['id']},'attributes':[_0xfa2c('0x51'),_0xfa2c('0x53'),_0xfa2c('0x56'),_0xfa2c('0x57'),_0xfa2c('0x58'),_0xfa2c('0x59'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xfa2c('0x2e')](handleEntityNotFound(_0x382a87,null))[_0xfa2c('0x2e')](function(_0x4ff9fb){if(_0x4ff9fb){var _0x7ca811=_0x4ff9fb[_0xfa2c('0x51')]&&fs[_0xfa2c('0x5a')](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x34daa2,_[_0xfa2c('0x5d')](_0x4ff9fb[_0xfa2c('0x51')])))?path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x34daa2,_['toLower'](_0x4ff9fb['logo'])):path[_0xfa2c('0x5b')](config['root'],_0x34daa2,_['toLower'](_0xfa2c('0x5e')));var _0x1d532f=_0xfa2c('0x5f')+_[_0xfa2c('0x60')](_0xfa2c('0x51'));if(_0x4ff9fb[_0x1d532f]||!_0x4d776c[_0xfa2c('0x61')]){_0x7ca811=path[_0xfa2c('0x5b')](config['root'],_0x34daa2,_[_0xfa2c('0x5d')]('default_logo.svg'));}if(!fs['existsSync'](_0x7ca811)){throw new db[(_0xfa2c('0x62'))][(_0xfa2c('0x63'))](_[_0xfa2c('0x60')](_0xfa2c('0x51'))+_0xfa2c('0x64'));}return _0x382a87[_0xfa2c('0x65')](_0x7ca811);}})[_0xfa2c('0x22')](handleError(_0x382a87,null));};var utilLicense=require(_0xfa2c('0x17'));exports['getLogoLogin']=function(_0x3e4fed,_0x14eb0e,_0x3b55f2){var _0x3850f2='server/files/images/logos';var _0x4a14ab={'custom':![]};return utilLicense['getLicense']()[_0xfa2c('0x2e')](function(_0x491719){if(_0x491719){_0x4a14ab=_0x491719;}return db['Setting'][_0xfa2c('0x4c')]({'where':{'id':_0x3e4fed[_0xfa2c('0x49')]['id']},'attributes':[_0xfa2c('0x51'),_0xfa2c('0x53'),_0xfa2c('0x56'),'favicon',_0xfa2c('0x58'),_0xfa2c('0x59'),_0xfa2c('0x66'),'defaultFavicon'],'raw':!![]});})[_0xfa2c('0x2e')](handleEntityNotFound(_0x14eb0e,null))[_0xfa2c('0x2e')](function(_0x47e290){if(_0x47e290){var _0x352157=_0x47e290[_0xfa2c('0x53')]&&fs[_0xfa2c('0x5a')](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x3850f2,_[_0xfa2c('0x5d')](_0x47e290[_0xfa2c('0x53')])))?path[_0xfa2c('0x5b')](config['root'],_0x3850f2,_[_0xfa2c('0x5d')](_0x47e290['loginLogo'])):path[_0xfa2c('0x5b')](config['root'],_0x3850f2,_['toLower'](_0xfa2c('0x67')));var _0xa790a8='default'+_[_0xfa2c('0x60')](_0xfa2c('0x53'));if(_0x47e290[_0xa790a8]||!_0x4a14ab[_0xfa2c('0x61')]){_0x352157=path[_0xfa2c('0x5b')](config['root'],_0x3850f2,_['toLower'](_0xfa2c('0x67')));}if(!fs[_0xfa2c('0x5a')](_0x352157)){throw new db['Sequelize'][(_0xfa2c('0x63'))](_[_0xfa2c('0x60')](_0xfa2c('0x53'))+_0xfa2c('0x64'));}return _0x14eb0e[_0xfa2c('0x65')](_0x352157);}})[_0xfa2c('0x22')](handleError(_0x14eb0e,null));};exports[_0xfa2c('0x68')]=function(_0x4ad9c5,_0x1cae3a){return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x4ad9c5[_0xfa2c('0x49')]['id']},'attributes':[_0xfa2c('0x69')]})[_0xfa2c('0x2e')](respondWithResult(_0x1cae3a,null))['catch'](handleError(_0x1cae3a,null));};exports[_0xfa2c('0x6a')]=function(_0x3f8fcc,_0x4511c9,_0x35905c){if(_0x3f8fcc[_0xfa2c('0x4f')]&&_0x3f8fcc[_0xfa2c('0x4f')]['filename']){_0x3f8fcc[_0xfa2c('0x4d')]['preferred']=_0x3f8fcc[_0xfa2c('0x4f')]['filename'];}return db[_0xfa2c('0x34')]['find']({'where':{'id':_0x3f8fcc[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x4511c9,null))[_0xfa2c('0x2e')](saveUpdates(_0x3f8fcc[_0xfa2c('0x4d')],null))[_0xfa2c('0x2e')](respondWithResult(_0x4511c9,null))[_0xfa2c('0x22')](handleError(_0x4511c9,null));};var utilLicense=require(_0xfa2c('0x17'));exports[_0xfa2c('0x6b')]=function(_0x287fc1,_0x31024d,_0x1cc374){var _0x4f564f='server/files/images/logos';var _0x17e835={'custom':![]};return utilLicense['getLicense']()[_0xfa2c('0x2e')](function(_0x4c2380){if(_0x4c2380){_0x17e835=_0x4c2380;}return db[_0xfa2c('0x34')]['find']({'where':{'id':_0x287fc1['params']['id']},'attributes':['logo','loginLogo',_0xfa2c('0x56'),_0xfa2c('0x57'),'defaultLogo',_0xfa2c('0x59'),'defaultPreferred',_0xfa2c('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x31024d,null))[_0xfa2c('0x2e')](function(_0x17cfd2){if(_0x17cfd2){var _0x3fc545=_0x17cfd2[_0xfa2c('0x56')]&&fs[_0xfa2c('0x5a')](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x4f564f,_['toLower'](_0x17cfd2[_0xfa2c('0x56')])))?path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x4f564f,_[_0xfa2c('0x5d')](_0x17cfd2[_0xfa2c('0x56')])):path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x4f564f,_[_0xfa2c('0x5d')](_0xfa2c('0x6d')));var _0x564f0e=_0xfa2c('0x5f')+_[_0xfa2c('0x60')]('preferred');if(_0x17cfd2[_0x564f0e]||!_0x17e835['custom']||!_0x17e835[_0xfa2c('0x56')]){_0x3fc545=path['join'](config[_0xfa2c('0x5c')],_0x4f564f,_[_0xfa2c('0x5d')](_0xfa2c('0x6d')));}if(!fs[_0xfa2c('0x5a')](_0x3fc545)){throw new db[(_0xfa2c('0x62'))][(_0xfa2c('0x63'))](_['upperFirst'](_0xfa2c('0x56'))+_0xfa2c('0x64'));}return _0x31024d['download'](_0x3fc545);}})[_0xfa2c('0x22')](handleError(_0x31024d,null));};exports['addFavicon']=function(_0x4cd827,_0x292f9d,_0x21c68d){if(_0x4cd827[_0xfa2c('0x4f')]&&_0x4cd827['file'][_0xfa2c('0x50')]){_0x4cd827[_0xfa2c('0x4d')][_0xfa2c('0x57')]=_0x4cd827[_0xfa2c('0x4f')][_0xfa2c('0x50')];}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x4cd827[_0xfa2c('0x49')]['id']}})[_0xfa2c('0x2e')](handleEntityNotFound(_0x292f9d,null))[_0xfa2c('0x2e')](saveUpdates(_0x4cd827[_0xfa2c('0x4d')],null))[_0xfa2c('0x2e')](respondWithResult(_0x292f9d,null))['catch'](handleError(_0x292f9d,null));};var utilLicense=require(_0xfa2c('0x17'));exports[_0xfa2c('0x6e')]=function(_0x198fb3,_0x3a57bf,_0x24baea){var _0x472c10=_0xfa2c('0x6f');var _0x2df54e={'custom':![]};return utilLicense[_0xfa2c('0x55')]()['then'](function(_0x51055b){if(_0x51055b){_0x2df54e=_0x51055b;}return db[_0xfa2c('0x34')][_0xfa2c('0x4c')]({'where':{'id':_0x198fb3[_0xfa2c('0x49')]['id']},'attributes':['logo',_0xfa2c('0x53'),_0xfa2c('0x56'),_0xfa2c('0x57'),_0xfa2c('0x58'),_0xfa2c('0x59'),_0xfa2c('0x66'),_0xfa2c('0x6c')],'raw':!![]});})[_0xfa2c('0x2e')](handleEntityNotFound(_0x3a57bf,null))[_0xfa2c('0x2e')](function(_0x4b8bf5){if(_0x4b8bf5){var _0x46967f=_0x4b8bf5[_0xfa2c('0x57')]&&fs['existsSync'](path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x472c10,_[_0xfa2c('0x5d')](_0x4b8bf5[_0xfa2c('0x57')])))?path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x472c10,_[_0xfa2c('0x5d')](_0x4b8bf5['favicon'])):path[_0xfa2c('0x5b')](config['root'],_0x472c10,_[_0xfa2c('0x5d')](_0xfa2c('0x70')));var _0xcc0ad='default'+_['upperFirst'](_0xfa2c('0x57'));if(_0x4b8bf5[_0xcc0ad]||!_0x2df54e[_0xfa2c('0x61')]){_0x46967f=path[_0xfa2c('0x5b')](config[_0xfa2c('0x5c')],_0x472c10,_[_0xfa2c('0x5d')](_0xfa2c('0x70')));}if(!fs[_0xfa2c('0x5a')](_0x46967f)){throw new db[(_0xfa2c('0x62'))][(_0xfa2c('0x63'))](_[_0xfa2c('0x60')](_0xfa2c('0x57'))+'\x20not\x20found');}return _0x3a57bf[_0xfa2c('0x65')](_0x46967f);}})[_0xfa2c('0x22')](handleError(_0x3a57bf,null));};exports[_0xfa2c('0x71')]=function(_0x4be3b9,_0x3110a8){var _0x27168c={'offset':moment()[_0xfa2c('0x72')]()};_0x27168c[_0xfa2c('0x73')]=moment()[_0xfa2c('0x72')](_0x27168c[_0xfa2c('0x29')])[_0xfa2c('0x74')](_0xfa2c('0x75'));return _0x3110a8[_0xfa2c('0x24')](0xc8)[_0xfa2c('0x76')](_0x27168c);}; \ No newline at end of file +var _0x5f7d=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../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','catch','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','body','file','logo','addLogoLogin','filename','getLogo','server/files/images/logos','getLicense','defaultPreferred','existsSync','toLower','join','root','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','download','getLogoLogin','loginLogo','preferred','favicon','defaultLogo','defaultFavicon','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','querystring'];(function(_0xfc2a63,_0x31d40f){var _0x493a3f=function(_0x352907){while(--_0x352907){_0xfc2a63['push'](_0xfc2a63['shift']());}};_0x493a3f(++_0x31d40f);}(_0x5f7d,0x6d));var _0xd5f7=function(_0x2e7b83,_0x4b81f4){_0x2e7b83=_0x2e7b83-0x0;var _0x330d68=_0x5f7d[_0x2e7b83];return _0x330d68;};'use strict';var emlformat=require(_0xd5f7('0x0'));var rimraf=require(_0xd5f7('0x1'));var zipdir=require(_0xd5f7('0x2'));var jsonpatch=require(_0xd5f7('0x3'));var rp=require('request-promise');var moment=require(_0xd5f7('0x4'));var BPromise=require(_0xd5f7('0x5'));var Mustache=require(_0xd5f7('0x6'));var util=require(_0xd5f7('0x7'));var path=require(_0xd5f7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd5f7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5f7('0xa'));var squel=require('squel');var crypto=require(_0xd5f7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd5f7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd5f7('0xd'));var Papa=require('papaparse');var Redis=require(_0xd5f7('0xe'));var authService=require(_0xd5f7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5f7('0x10'));var hardwareService=require(_0xd5f7('0x11'));var logger=require('../../config/logger')(_0xd5f7('0x12'));var utils=require(_0xd5f7('0x13'));var config=require(_0xd5f7('0x14'));var licenseUtil=require(_0xd5f7('0x15'));var db=require(_0xd5f7('0x16'))['db'];var jayson=require(_0xd5f7('0x17'));var client=jayson[_0xd5f7('0x18')][_0xd5f7('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x11fb6b,_0x3690f5,_0x37190a,_0x2702e8){return new BPromise(function(_0x11a5a1,_0x48838e){var _0x3e3d68=_0x2702e8||client;return _0x3e3d68[_0xd5f7('0x1a')](_0x11fb6b,_0x37190a)[_0xd5f7('0x1b')](function(_0x400600){logger[_0xd5f7('0x1c')](_0xd5f7('0x1d'),_0x3690f5,'request\x20sent');logger[_0xd5f7('0x1e')](_0xd5f7('0x1f'),_0x3690f5,_0xd5f7('0x20'),JSON[_0xd5f7('0x21')](_0x400600));if(_0x400600[_0xd5f7('0x22')]){if(_0x400600[_0xd5f7('0x22')][_0xd5f7('0x23')]===0x1f4){logger[_0xd5f7('0x22')](_0xd5f7('0x1d'),_0x3690f5,_0x400600['error'][_0xd5f7('0x24')]);return _0x48838e(_0x400600['error']['message']);}logger[_0xd5f7('0x22')]('Setting,\x20%s,\x20%s',_0x3690f5,_0x400600[_0xd5f7('0x22')][_0xd5f7('0x24')]);return _0x11a5a1(_0x400600['error'][_0xd5f7('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3690f5,_0xd5f7('0x20'));_0x11a5a1(_0x400600['result'][_0xd5f7('0x24')]);}})[_0xd5f7('0x25')](function(_0x3adae4){logger[_0xd5f7('0x22')](_0xd5f7('0x1d'),_0x3690f5,_0x3adae4);_0x48838e(_0x3adae4);});});}function respondWithStatusCode(_0x264c96,_0x117327){_0x117327=_0x117327||0xcc;return function(_0x524254){if(_0x524254){return _0x264c96['sendStatus'](_0x117327);}return _0x264c96['status'](_0x117327)[_0xd5f7('0x26')]();};}function respondWithResult(_0x507847,_0x374dc0){_0x374dc0=_0x374dc0||0xc8;return function(_0x333774){if(_0x333774){return _0x507847[_0xd5f7('0x27')](_0x374dc0)[_0xd5f7('0x28')](_0x333774);}};}function respondWithFilteredResult(_0x98870c,_0x4ce6ad){return function(_0x440380){if(_0x440380){var _0x1ad009=typeof _0x4ce6ad[_0xd5f7('0x29')]==='undefined'&&typeof _0x4ce6ad[_0xd5f7('0x2a')]===_0xd5f7('0x2b');var _0x2be775=_0x440380[_0xd5f7('0x2c')];var _0x1b7f9c=_0x1ad009?0x0:_0x4ce6ad[_0xd5f7('0x29')];var _0x226ffa=_0x1ad009?_0x440380[_0xd5f7('0x2c')]:_0x4ce6ad['offset']+_0x4ce6ad[_0xd5f7('0x2a')];var _0x462208;if(_0x226ffa>=_0x2be775){_0x226ffa=_0x2be775;_0x462208=0xc8;}else{_0x462208=0xce;}_0x98870c['status'](_0x462208);return _0x98870c['set'](_0xd5f7('0x2d'),_0x1b7f9c+'-'+_0x226ffa+'/'+_0x2be775)[_0xd5f7('0x28')](_0x440380);}return null;};}function patchUpdates(_0x4fb1d2){return function(_0x578251){try{jsonpatch[_0xd5f7('0x2e')](_0x578251,_0x4fb1d2,!![]);}catch(_0x25fb31){return BPromise[_0xd5f7('0x2f')](_0x25fb31);}return _0x578251[_0xd5f7('0x30')]();};}function saveUpdates(_0xfa6bb4,_0xfc2309){return function(_0x18298a){if(_0x18298a){return _0x18298a[_0xd5f7('0x31')](_0xfa6bb4)['then'](function(_0x3e7ffe){return _0x3e7ffe;});}return null;};}function removeEntity(_0x2c3571,_0x5ac04e){return function(_0x119938){if(_0x119938){return _0x119938['destroy']()['then'](function(){_0x2c3571[_0xd5f7('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3737dc,_0x108ba3){return function(_0x3e3698){if(!_0x3e3698){_0x3737dc['sendStatus'](0x194);}return _0x3e3698;};}function handleError(_0x31f7ea,_0x4b1d1f){_0x4b1d1f=_0x4b1d1f||0x1f4;return function(_0x1c9116){logger[_0xd5f7('0x22')](_0x1c9116[_0xd5f7('0x32')]);if(_0x1c9116[_0xd5f7('0x33')]){delete _0x1c9116[_0xd5f7('0x33')];}_0x31f7ea['status'](_0x4b1d1f)[_0xd5f7('0x34')](_0x1c9116);};}exports[_0xd5f7('0x35')]=function(_0x157a57,_0x26121c){var _0x55f099={},_0x3ecd00={},_0x26656f={'count':0x0,'rows':[]};var _0x12cb68=_[_0xd5f7('0x36')](db[_0xd5f7('0x37')][_0xd5f7('0x38')],function(_0x96e870){return{'name':_0x96e870[_0xd5f7('0x39')],'type':_0x96e870['type'][_0xd5f7('0x3a')]};});_0x3ecd00[_0xd5f7('0x3b')]=_['map'](_0x12cb68,_0xd5f7('0x33'));_0x3ecd00[_0xd5f7('0x3c')]=_[_0xd5f7('0x3d')](_0x157a57['query']);_0x3ecd00[_0xd5f7('0x3e')]=_[_0xd5f7('0x3f')](_0x3ecd00[_0xd5f7('0x3b')],_0x3ecd00['query']);_0x55f099[_0xd5f7('0x40')]=_[_0xd5f7('0x3f')](_0x3ecd00[_0xd5f7('0x3b')],qs[_0xd5f7('0x41')](_0x157a57['query'][_0xd5f7('0x41')]));_0x55f099['attributes']=_0x55f099['attributes'][_0xd5f7('0x42')]?_0x55f099[_0xd5f7('0x40')]:_0x3ecd00[_0xd5f7('0x3b')];if(!_0x157a57[_0xd5f7('0x3c')][_0xd5f7('0x43')](_0xd5f7('0x44'))){_0x55f099[_0xd5f7('0x2a')]=qs[_0xd5f7('0x2a')](_0x157a57[_0xd5f7('0x3c')][_0xd5f7('0x2a')]);_0x55f099['offset']=qs[_0xd5f7('0x29')](_0x157a57[_0xd5f7('0x3c')][_0xd5f7('0x29')]);}_0x55f099['order']=qs[_0xd5f7('0x45')](_0x157a57['query'][_0xd5f7('0x45')]);_0x55f099['where']=qs[_0xd5f7('0x3e')](_[_0xd5f7('0x46')](_0x157a57['query'],_0x3ecd00[_0xd5f7('0x3e')]),_0x12cb68);if(_0x157a57[_0xd5f7('0x3c')][_0xd5f7('0x47')]){_0x55f099[_0xd5f7('0x48')]=_[_0xd5f7('0x49')](_0x55f099[_0xd5f7('0x48')],{'$or':_[_0xd5f7('0x36')](_0x12cb68,function(_0x42fb3c){if(_0x42fb3c[_0xd5f7('0x4a')]!==_0xd5f7('0x4b')){var _0x48749e={};_0x48749e[_0x42fb3c[_0xd5f7('0x33')]]={'$like':'%'+_0x157a57[_0xd5f7('0x3c')]['filter']+'%'};return _0x48749e;}})});}_0x55f099=_['merge']({},_0x55f099,_0x157a57[_0xd5f7('0x4c')]);var _0x358079={'where':_0x55f099['where']};return db[_0xd5f7('0x37')][_0xd5f7('0x2c')](_0x358079)['then'](function(_0x216aae){_0x26656f[_0xd5f7('0x2c')]=_0x216aae;if(_0x157a57[_0xd5f7('0x3c')][_0xd5f7('0x4d')]){_0x55f099['include']=[{'all':!![]}];}return db[_0xd5f7('0x37')][_0xd5f7('0x4e')](_0x55f099);})['then'](function(_0x171eae){_0x26656f[_0xd5f7('0x4f')]=_0x171eae;return _0x26656f;})[_0xd5f7('0x1b')](respondWithFilteredResult(_0x26121c,_0x55f099))[_0xd5f7('0x25')](handleError(_0x26121c,null));};exports[_0xd5f7('0x50')]=function(_0x84767f,_0x23177b){var _0x31cfc0={'raw':![],'where':{'id':_0x84767f[_0xd5f7('0x51')]['id']}},_0x7a531e={};_0x7a531e[_0xd5f7('0x3b')]=_['keys'](db[_0xd5f7('0x37')][_0xd5f7('0x38')]);_0x7a531e[_0xd5f7('0x3c')]=_[_0xd5f7('0x3d')](_0x84767f[_0xd5f7('0x3c')]);_0x7a531e['filters']=_[_0xd5f7('0x3f')](_0x7a531e[_0xd5f7('0x3b')],_0x7a531e[_0xd5f7('0x3c')]);_0x31cfc0[_0xd5f7('0x40')]=_[_0xd5f7('0x3f')](_0x7a531e[_0xd5f7('0x3b')],qs['fields'](_0x84767f['query'][_0xd5f7('0x41')]));_0x31cfc0[_0xd5f7('0x40')]=_0x31cfc0[_0xd5f7('0x40')]['length']?_0x31cfc0[_0xd5f7('0x40')]:_0x7a531e['model'];if(_0x84767f['query'][_0xd5f7('0x4d')]){_0x31cfc0['include']=[{'all':!![]}];}_0x31cfc0=_[_0xd5f7('0x49')]({},_0x31cfc0,_0x84767f[_0xd5f7('0x4c')]);return db['Setting'][_0xd5f7('0x52')](_0x31cfc0)[_0xd5f7('0x1b')](handleEntityNotFound(_0x23177b,null))['then'](respondWithResult(_0x23177b,null))['catch'](handleError(_0x23177b,null));};exports[_0xd5f7('0x31')]=function(_0xaca6f8,_0x11a012){if(_0xaca6f8[_0xd5f7('0x53')]['id']){delete _0xaca6f8[_0xd5f7('0x53')]['id'];}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0xaca6f8[_0xd5f7('0x51')]['id']}})[_0xd5f7('0x1b')](handleEntityNotFound(_0x11a012,null))['then'](saveUpdates(_0xaca6f8[_0xd5f7('0x53')],null))[_0xd5f7('0x1b')](respondWithResult(_0x11a012,null))[_0xd5f7('0x25')](handleError(_0x11a012,null));};exports['addLogo']=function(_0x5765a7,_0x230365,_0x5b1f29){if(_0x5765a7[_0xd5f7('0x54')]&&_0x5765a7['file']['filename']){_0x5765a7['body'][_0xd5f7('0x55')]=_0x5765a7[_0xd5f7('0x54')]['filename'];}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x5765a7[_0xd5f7('0x51')]['id']}})[_0xd5f7('0x1b')](handleEntityNotFound(_0x230365,null))['then'](saveUpdates(_0x5765a7[_0xd5f7('0x53')],null))[_0xd5f7('0x1b')](respondWithResult(_0x230365,null))['catch'](handleError(_0x230365,null));};exports[_0xd5f7('0x56')]=function(_0x551922,_0x5649bd,_0x28ddb9){if(_0x551922['file']&&_0x551922[_0xd5f7('0x54')][_0xd5f7('0x57')]){_0x551922[_0xd5f7('0x53')]['loginLogo']=_0x551922['file'][_0xd5f7('0x57')];}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x551922['params']['id']}})[_0xd5f7('0x1b')](handleEntityNotFound(_0x5649bd,null))[_0xd5f7('0x1b')](saveUpdates(_0x551922[_0xd5f7('0x53')],null))[_0xd5f7('0x1b')](respondWithResult(_0x5649bd,null))[_0xd5f7('0x25')](handleError(_0x5649bd,null));};var utilLicense=require(_0xd5f7('0x15'));exports[_0xd5f7('0x58')]=function(_0x3f397d,_0x210abd,_0x26c816){var _0x19d2f1=_0xd5f7('0x59');var _0x44a015={'custom':![]};return utilLicense[_0xd5f7('0x5a')]()[_0xd5f7('0x1b')](function(_0x194400){if(_0x194400){_0x44a015=_0x194400;}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x3f397d['params']['id']},'attributes':[_0xd5f7('0x55'),'loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo',_0xd5f7('0x5b'),'defaultFavicon'],'raw':!![]});})[_0xd5f7('0x1b')](handleEntityNotFound(_0x210abd,null))[_0xd5f7('0x1b')](function(_0x381501){if(_0x381501){var _0x362269=_0x381501[_0xd5f7('0x55')]&&fs[_0xd5f7('0x5c')](path['join'](config['root'],_0x19d2f1,_[_0xd5f7('0x5d')](_0x381501[_0xd5f7('0x55')])))?path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x19d2f1,_[_0xd5f7('0x5d')](_0x381501[_0xd5f7('0x55')])):path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x19d2f1,_[_0xd5f7('0x5d')](_0xd5f7('0x60')));var _0x4a6b18=_0xd5f7('0x61')+_['upperFirst']('logo');if(_0x381501[_0x4a6b18]||!_0x44a015[_0xd5f7('0x62')]){_0x362269=path['join'](config['root'],_0x19d2f1,_[_0xd5f7('0x5d')](_0xd5f7('0x60')));}if(!fs[_0xd5f7('0x5c')](_0x362269)){throw new db[(_0xd5f7('0x63'))][(_0xd5f7('0x64'))](_[_0xd5f7('0x65')](_0xd5f7('0x55'))+'\x20not\x20found');}return _0x210abd[_0xd5f7('0x66')](_0x362269);}})[_0xd5f7('0x25')](handleError(_0x210abd,null));};var utilLicense=require(_0xd5f7('0x15'));exports[_0xd5f7('0x67')]=function(_0x22425a,_0x31ca87,_0x3bbc44){var _0x44cf37=_0xd5f7('0x59');var _0x5c643a={'custom':![]};return utilLicense[_0xd5f7('0x5a')]()[_0xd5f7('0x1b')](function(_0x1910c9){if(_0x1910c9){_0x5c643a=_0x1910c9;}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x22425a['params']['id']},'attributes':[_0xd5f7('0x55'),_0xd5f7('0x68'),_0xd5f7('0x69'),_0xd5f7('0x6a'),_0xd5f7('0x6b'),'defaultLoginLogo',_0xd5f7('0x5b'),_0xd5f7('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x31ca87,null))['then'](function(_0x2c138b){if(_0x2c138b){var _0x521172=_0x2c138b['loginLogo']&&fs[_0xd5f7('0x5c')](path[_0xd5f7('0x5e')](config['root'],_0x44cf37,_[_0xd5f7('0x5d')](_0x2c138b[_0xd5f7('0x68')])))?path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x44cf37,_[_0xd5f7('0x5d')](_0x2c138b[_0xd5f7('0x68')])):path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x44cf37,_[_0xd5f7('0x5d')]('default_loginLogo.svg'));var _0x526f40=_0xd5f7('0x61')+_['upperFirst'](_0xd5f7('0x68'));if(_0x2c138b[_0x526f40]||!_0x5c643a[_0xd5f7('0x62')]){_0x521172=path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x44cf37,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xd5f7('0x5c')](_0x521172)){throw new db[(_0xd5f7('0x63'))][(_0xd5f7('0x64'))](_[_0xd5f7('0x65')]('loginLogo')+_0xd5f7('0x6d'));}return _0x31ca87[_0xd5f7('0x66')](_0x521172);}})['catch'](handleError(_0x31ca87,null));};exports[_0xd5f7('0x6e')]=function(_0x10c388,_0x4609bd){return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x10c388[_0xd5f7('0x51')]['id']},'attributes':[_0xd5f7('0x6f')]})[_0xd5f7('0x1b')](respondWithResult(_0x4609bd,null))[_0xd5f7('0x25')](handleError(_0x4609bd,null));};exports[_0xd5f7('0x70')]=function(_0x44d082,_0x5d0df3,_0x2f38cf){if(_0x44d082[_0xd5f7('0x54')]&&_0x44d082['file']['filename']){_0x44d082[_0xd5f7('0x53')]['preferred']=_0x44d082[_0xd5f7('0x54')][_0xd5f7('0x57')];}return db[_0xd5f7('0x37')]['find']({'where':{'id':_0x44d082[_0xd5f7('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d0df3,null))[_0xd5f7('0x1b')](saveUpdates(_0x44d082[_0xd5f7('0x53')],null))['then'](respondWithResult(_0x5d0df3,null))[_0xd5f7('0x25')](handleError(_0x5d0df3,null));};var utilLicense=require(_0xd5f7('0x15'));exports[_0xd5f7('0x71')]=function(_0x4aabc3,_0x16226b,_0x30f3fa){var _0x1cf333=_0xd5f7('0x59');var _0x61d66f={'custom':![]};return utilLicense[_0xd5f7('0x5a')]()['then'](function(_0x5837d9){if(_0x5837d9){_0x61d66f=_0x5837d9;}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x4aabc3[_0xd5f7('0x51')]['id']},'attributes':[_0xd5f7('0x55'),'loginLogo',_0xd5f7('0x69'),_0xd5f7('0x6a'),_0xd5f7('0x6b'),_0xd5f7('0x72'),_0xd5f7('0x5b'),_0xd5f7('0x6c')],'raw':!![]});})['then'](handleEntityNotFound(_0x16226b,null))[_0xd5f7('0x1b')](function(_0x20c5f0){if(_0x20c5f0){var _0x2d3b56=_0x20c5f0[_0xd5f7('0x69')]&&fs[_0xd5f7('0x5c')](path['join'](config[_0xd5f7('0x5f')],_0x1cf333,_[_0xd5f7('0x5d')](_0x20c5f0['preferred'])))?path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x1cf333,_[_0xd5f7('0x5d')](_0x20c5f0[_0xd5f7('0x69')])):path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x1cf333,_[_0xd5f7('0x5d')]('default_preferred.png'));var _0x2579a9=_0xd5f7('0x61')+_[_0xd5f7('0x65')](_0xd5f7('0x69'));if(_0x20c5f0[_0x2579a9]||!_0x61d66f[_0xd5f7('0x62')]||!_0x61d66f[_0xd5f7('0x69')]){_0x2d3b56=path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x1cf333,_['toLower'](_0xd5f7('0x73')));}if(!fs['existsSync'](_0x2d3b56)){throw new db['Sequelize'][(_0xd5f7('0x64'))](_[_0xd5f7('0x65')](_0xd5f7('0x69'))+_0xd5f7('0x6d'));}return _0x16226b[_0xd5f7('0x66')](_0x2d3b56);}})['catch'](handleError(_0x16226b,null));};exports[_0xd5f7('0x74')]=function(_0x10fec5,_0x37f897,_0x1fb3d5){if(_0x10fec5['file']&&_0x10fec5[_0xd5f7('0x54')]['filename']){_0x10fec5['body'][_0xd5f7('0x6a')]=_0x10fec5[_0xd5f7('0x54')][_0xd5f7('0x57')];}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x10fec5[_0xd5f7('0x51')]['id']}})[_0xd5f7('0x1b')](handleEntityNotFound(_0x37f897,null))['then'](saveUpdates(_0x10fec5[_0xd5f7('0x53')],null))['then'](respondWithResult(_0x37f897,null))['catch'](handleError(_0x37f897,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x3d8d38,_0x260b78,_0x5ceb4e){var _0x5a1712=_0xd5f7('0x59');var _0x9b767d={'custom':![]};return utilLicense[_0xd5f7('0x5a')]()[_0xd5f7('0x1b')](function(_0x5bb7a8){if(_0x5bb7a8){_0x9b767d=_0x5bb7a8;}return db[_0xd5f7('0x37')][_0xd5f7('0x52')]({'where':{'id':_0x3d8d38[_0xd5f7('0x51')]['id']},'attributes':['logo',_0xd5f7('0x68'),_0xd5f7('0x69'),_0xd5f7('0x6a'),_0xd5f7('0x6b'),_0xd5f7('0x72'),_0xd5f7('0x5b'),_0xd5f7('0x6c')],'raw':!![]});})[_0xd5f7('0x1b')](handleEntityNotFound(_0x260b78,null))[_0xd5f7('0x1b')](function(_0x37465a){if(_0x37465a){var _0x1a0f72=_0x37465a[_0xd5f7('0x6a')]&&fs[_0xd5f7('0x5c')](path[_0xd5f7('0x5e')](config['root'],_0x5a1712,_[_0xd5f7('0x5d')](_0x37465a[_0xd5f7('0x6a')])))?path['join'](config[_0xd5f7('0x5f')],_0x5a1712,_[_0xd5f7('0x5d')](_0x37465a[_0xd5f7('0x6a')])):path[_0xd5f7('0x5e')](config['root'],_0x5a1712,_['toLower'](_0xd5f7('0x75')));var _0x18c8e7=_0xd5f7('0x61')+_[_0xd5f7('0x65')]('favicon');if(_0x37465a[_0x18c8e7]||!_0x9b767d['custom']){_0x1a0f72=path[_0xd5f7('0x5e')](config[_0xd5f7('0x5f')],_0x5a1712,_[_0xd5f7('0x5d')]('default_favicon.ico'));}if(!fs[_0xd5f7('0x5c')](_0x1a0f72)){throw new db[(_0xd5f7('0x63'))][(_0xd5f7('0x64'))](_[_0xd5f7('0x65')](_0xd5f7('0x6a'))+_0xd5f7('0x6d'));}return _0x260b78[_0xd5f7('0x66')](_0x1a0f72);}})[_0xd5f7('0x25')](handleError(_0x260b78,null));};exports[_0xd5f7('0x76')]=function(_0x2f4341,_0x2984aa){var _0x5329f7={'offset':moment()[_0xd5f7('0x77')]()};_0x5329f7[_0xd5f7('0x78')]=moment()[_0xd5f7('0x77')](_0x5329f7[_0xd5f7('0x29')])[_0xd5f7('0x79')](_0xd5f7('0x7a'));return _0x2984aa[_0xd5f7('0x27')](0xc8)[_0xd5f7('0x34')](_0x5329f7);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a57a54c..70cd0ae 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x55ca,0x126));var _0xa55c=function(_0x55bd12,_0x3ccb52){_0x55bd12=_0x55bd12-0x0;var _0x1941dd=_0x55ca[_0x55bd12];return _0x1941dd;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index ddf180d..8dea5d2 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 _0x18c3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','Setting','options','raw','where','attributes','map','include','model','ShowSetting','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x18c3,0xe8));var _0x318c=function(_0x4c9143,_0x5cc26d){_0x4c9143=_0x4c9143-0x0;var _0x297b60=_0x18c3[_0x4c9143];return _0x297b60;};'use strict';var _=require(_0x318c('0x0'));var util=require(_0x318c('0x1'));var moment=require(_0x318c('0x2'));var BPromise=require(_0x318c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x318c('0x4'));var db=require(_0x318c('0x5'))['db'];var utils=require(_0x318c('0x6'));var logger=require(_0x318c('0x7'))('rpc');var config=require(_0x318c('0x8'));var jayson=require(_0x318c('0x9'));var client=jayson[_0x318c('0xa')][_0x318c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be9cd,_0x4d00b8,_0x32e9f8){return new BPromise(function(_0x15c735,_0x4c549a){return client[_0x318c('0xc')](_0x2be9cd,_0x32e9f8)[_0x318c('0xd')](function(_0x17ea7c){logger[_0x318c('0xe')]('Setting,\x20%s,\x20%s',_0x4d00b8,'request\x20sent');logger[_0x318c('0xf')](_0x318c('0x10'),_0x4d00b8,_0x318c('0x11'),JSON[_0x318c('0x12')](_0x17ea7c));if(_0x17ea7c['error']){if(_0x17ea7c[_0x318c('0x13')][_0x318c('0x14')]===0x1f4){logger['error'](_0x318c('0x15'),_0x4d00b8,_0x17ea7c[_0x318c('0x13')][_0x318c('0x16')]);return _0x4c549a(_0x17ea7c['error']['message']);}logger[_0x318c('0x13')](_0x318c('0x15'),_0x4d00b8,_0x17ea7c['error']['message']);return _0x15c735(_0x17ea7c[_0x318c('0x13')][_0x318c('0x16')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4d00b8,_0x318c('0x11'));_0x15c735(_0x17ea7c[_0x318c('0x17')]['message']);}})[_0x318c('0x18')](function(_0x42a687){logger[_0x318c('0x13')](_0x318c('0x15'),_0x4d00b8,_0x42a687);_0x4c549a(_0x42a687);});});}exports['ShowSetting']=function(_0x131253){var _0x19fa50=this;return new Promise(function(_0x24a570,_0x313c55){return db[_0x318c('0x19')]['find']({'raw':_0x131253[_0x318c('0x1a')]?_0x131253['options'][_0x318c('0x1b')]===undefined?!![]:![]:!![],'where':_0x131253[_0x318c('0x1a')]?_0x131253[_0x318c('0x1a')][_0x318c('0x1c')]||null:null,'attributes':_0x131253[_0x318c('0x1a')]?_0x131253[_0x318c('0x1a')][_0x318c('0x1d')]||null:null,'include':_0x131253[_0x318c('0x1a')]?_0x131253[_0x318c('0x1a')]['include']?_[_0x318c('0x1e')](_0x131253[_0x318c('0x1a')][_0x318c('0x1f')],function(_0x5c9ae1){return{'model':db[_0x5c9ae1[_0x318c('0x20')]],'as':_0x5c9ae1['as'],'attributes':_0x5c9ae1[_0x318c('0x1d')],'include':_0x5c9ae1[_0x318c('0x1f')]?_[_0x318c('0x1e')](_0x5c9ae1['include'],function(_0x587c3d){return{'model':db[_0x587c3d['model']],'as':_0x587c3d['as'],'attributes':_0x587c3d['attributes'],'include':_0x587c3d[_0x318c('0x1f')]?_[_0x318c('0x1e')](_0x587c3d[_0x318c('0x1f')],function(_0x3a97a4){return{'model':db[_0x3a97a4[_0x318c('0x20')]],'as':_0x3a97a4['as'],'attributes':_0x3a97a4[_0x318c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x318c('0xd')](function(_0x506b6a){logger[_0x318c('0xe')](_0x318c('0x21'),_0x131253);logger[_0x318c('0xf')]('ShowSetting',_0x131253,JSON[_0x318c('0x12')](_0x506b6a));_0x24a570(_0x506b6a);})[_0x318c('0x18')](function(_0x39631c){logger[_0x318c('0x13')](_0x318c('0x21'),_0x39631c[_0x318c('0x16')],_0x131253);_0x313c55(_0x19fa50[_0x318c('0x13')](0x1f4,_0x39631c[_0x318c('0x16')]));});});}; \ No newline at end of file +var _0x132d=['../../config/utils','rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x3c105b,_0x462b53){var _0x27a3e4=function(_0x566b8e){while(--_0x566b8e){_0x3c105b['push'](_0x3c105b['shift']());}};_0x27a3e4(++_0x462b53);}(_0x132d,0x73));var _0xd132=function(_0x4dd1d4,_0x3530ff){_0x4dd1d4=_0x4dd1d4-0x0;var _0x18f3bd=_0x132d[_0x4dd1d4];return _0x18f3bd;};'use strict';var _=require(_0xd132('0x0'));var util=require(_0xd132('0x1'));var moment=require(_0xd132('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd132('0x3'));var db=require(_0xd132('0x4'))['db'];var utils=require(_0xd132('0x5'));var logger=require('../../config/logger')(_0xd132('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd132('0x7')][_0xd132('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xab84cc,_0x414de1,_0x337694){return new BPromise(function(_0x156377,_0x23d621){return client[_0xd132('0x9')](_0xab84cc,_0x337694)[_0xd132('0xa')](function(_0x2c8f3f){logger[_0xd132('0xb')](_0xd132('0xc'),_0x414de1,'request\x20sent');logger[_0xd132('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x414de1,_0xd132('0xe'),JSON['stringify'](_0x2c8f3f));if(_0x2c8f3f[_0xd132('0xf')]){if(_0x2c8f3f[_0xd132('0xf')][_0xd132('0x10')]===0x1f4){logger[_0xd132('0xf')](_0xd132('0xc'),_0x414de1,_0x2c8f3f[_0xd132('0xf')][_0xd132('0x11')]);return _0x23d621(_0x2c8f3f['error'][_0xd132('0x11')]);}logger[_0xd132('0xf')]('Setting,\x20%s,\x20%s',_0x414de1,_0x2c8f3f[_0xd132('0xf')]['message']);return _0x156377(_0x2c8f3f[_0xd132('0xf')]['message']);}else{logger[_0xd132('0xb')](_0xd132('0xc'),_0x414de1,_0xd132('0xe'));_0x156377(_0x2c8f3f[_0xd132('0x12')][_0xd132('0x11')]);}})[_0xd132('0x13')](function(_0x145710){logger['error']('Setting,\x20%s,\x20%s',_0x414de1,_0x145710);_0x23d621(_0x145710);});});}exports[_0xd132('0x14')]=function(_0x26c0bf){var _0xd7aa0b=this;return new Promise(function(_0x152abf,_0x5ada7b){return db['Setting'][_0xd132('0x15')]({'raw':_0x26c0bf[_0xd132('0x16')]?_0x26c0bf['options'][_0xd132('0x17')]===undefined?!![]:![]:!![],'where':_0x26c0bf[_0xd132('0x16')]?_0x26c0bf[_0xd132('0x16')][_0xd132('0x18')]||null:null,'attributes':_0x26c0bf['options']?_0x26c0bf[_0xd132('0x16')][_0xd132('0x19')]||null:null,'include':_0x26c0bf[_0xd132('0x16')]?_0x26c0bf[_0xd132('0x16')][_0xd132('0x1a')]?_[_0xd132('0x1b')](_0x26c0bf['options'][_0xd132('0x1a')],function(_0x3980b7){return{'model':db[_0x3980b7[_0xd132('0x1c')]],'as':_0x3980b7['as'],'attributes':_0x3980b7[_0xd132('0x19')],'include':_0x3980b7['include']?_[_0xd132('0x1b')](_0x3980b7['include'],function(_0x166fb6){return{'model':db[_0x166fb6[_0xd132('0x1c')]],'as':_0x166fb6['as'],'attributes':_0x166fb6[_0xd132('0x19')],'include':_0x166fb6[_0xd132('0x1a')]?_[_0xd132('0x1b')](_0x166fb6[_0xd132('0x1a')],function(_0x3644ea){return{'model':db[_0x3644ea[_0xd132('0x1c')]],'as':_0x3644ea['as'],'attributes':_0x3644ea[_0xd132('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd132('0xa')](function(_0x270000){logger['info'](_0xd132('0x14'),_0x26c0bf);logger[_0xd132('0xd')]('ShowSetting',_0x26c0bf,JSON[_0xd132('0x1d')](_0x270000));_0x152abf(_0x270000);})[_0xd132('0x13')](function(_0x42a9d3){logger[_0xd132('0xf')](_0xd132('0x14'),_0x42a9d3[_0xd132('0x11')],_0x26c0bf);_0x5ada7b(_0xd7aa0b[_0xd132('0xf')](0x1f4,_0x42a9d3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3db023d..626a0b5 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x19692c,_0x584d68){var _0x538892=function(_0x4ae2db){while(--_0x4ae2db){_0x19692c['push'](_0x19692c['shift']());}};_0x538892(++_0x584d68);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x5fc3[_0x1e1965];return _0x1a2e96;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 2558c27..0448277 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 _0x26c4=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','connectel','clicksend','clickatell','csc','infobip','intelepeer','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xd65f4,_0x61ddc5){var _0x543b25=function(_0x57edfa){while(--_0x57edfa){_0xd65f4['push'](_0xd65f4['shift']());}};_0x543b25(++_0x61ddc5);}(_0x26c4,0x1ce));var _0x426c=function(_0x418d70,_0x21a2f1){_0x418d70=_0x418d70-0x0;var _0x3d1295=_0x26c4[_0x418d70];return _0x3d1295;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x426c('0x0'));module[_0x426c('0x1')]={'name':{'type':Sequelize[_0x426c('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x426c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x426c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x426c('0x2')],'defaultValue':function(){return rs[_0x426c('0x3')]();}},'phone':{'type':Sequelize[_0x426c('0x2')]},'type':{'type':Sequelize[_0x426c('0x4')](_0x426c('0x5'),'skebby',_0x426c('0x6'),_0x426c('0x7'),'plivo',_0x426c('0x8'),'bandwidth',_0x426c('0x9'),_0x426c('0xa'),_0x426c('0xb'))},'accountSid':{'type':Sequelize[_0x426c('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x426c('0x2')]},'smsMethod':{'type':Sequelize[_0x426c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x426c('0x2')]},'password':{'type':Sequelize[_0x426c('0x2')]},'apiKey':{'type':Sequelize[_0x426c('0x2')]},'applicationId':{'type':Sequelize[_0x426c('0x2')]},'accountId':{'type':Sequelize[_0x426c('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x426c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x426c('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x426c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x426c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x426c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x426c('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x426c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x426c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x426c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x426c('0xe')],'comment':_0x426c('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x426c('0xd')],'defaultValue':![],'comment':_0x426c('0x10'),'set':function(_0xb928e7){if(!_0xb928e7)this[_0x426c('0x11')](_0x426c('0x12'),null);this['setDataValue'](_0x426c('0x13'),_0xb928e7);}}}; \ No newline at end of file +var _0xc6ab=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x2510dd,_0x1c151f){var _0x5573f5=function(_0x2122d2){while(--_0x2122d2){_0x2510dd['push'](_0x2510dd['shift']());}};_0x5573f5(++_0x1c151f);}(_0xc6ab,0x177));var _0xbc6a=function(_0x48457f,_0xfc36d2){_0x48457f=_0x48457f-0x0;var _0x2d591e=_0xc6ab[_0x48457f];return _0x2d591e;};'use strict';var Sequelize=require(_0xbc6a('0x0'));var rs=require(_0xbc6a('0x1'));module[_0xbc6a('0x2')]={'name':{'type':Sequelize[_0xbc6a('0x3')],'unique':_0xbc6a('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xbc6a('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xbc6a('0x3')]},'type':{'type':Sequelize[_0xbc6a('0x5')]('twilio',_0xbc6a('0x6'),_0xbc6a('0x7'),_0xbc6a('0x8'),_0xbc6a('0x9'),'clickatell',_0xbc6a('0xa'),_0xbc6a('0xb'),_0xbc6a('0xc'),_0xbc6a('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xbc6a('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbc6a('0x3')]},'apiKey':{'type':Sequelize[_0xbc6a('0x3')]},'applicationId':{'type':Sequelize[_0xbc6a('0x3')]},'accountId':{'type':Sequelize[_0xbc6a('0x3')]},'senderString':{'type':Sequelize[_0xbc6a('0x3')]},'deliveryReport':{'type':Sequelize[_0xbc6a('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xbc6a('0x3')]},'notificationTemplate':{'type':Sequelize[_0xbc6a('0xf')],'defaultValue':function(){return _0xbc6a('0x10');}},'notificationSound':{'type':Sequelize[_0xbc6a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbc6a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbc6a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbc6a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbc6a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbc6a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbc6a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbc6a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbc6a('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbc6a('0x12'),'set':function(_0x3749f0){if(!_0x3749f0)this[_0xbc6a('0x13')](_0xbc6a('0x14'),null);this[_0xbc6a('0x13')](_0xbc6a('0x15'),_0x3749f0);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c53e27a..9204c42 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 _0xbb9e=['update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','options','create','body','SmsAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','From','Body','messageId','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','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','DESC','list','contact','SmsInteraction','spread','interaction','autoclose','push','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','User','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','state','message-id','addAgents','omit','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save'];(function(_0x83aca8,_0x397dd5){var _0x5ad200=function(_0x3dea39){while(--_0x3dea39){_0x83aca8['push'](_0x83aca8['shift']());}};_0x5ad200(++_0x397dd5);}(_0xbb9e,0xb0));var _0xebb9=function(_0x30dbf0,_0x1b3add){_0x30dbf0=_0x30dbf0-0x0;var _0x5b9f27=_0xbb9e[_0x30dbf0];return _0x5b9f27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebb9('0x0'));var zipdir=require(_0xebb9('0x1'));var jsonpatch=require(_0xebb9('0x2'));var rp=require(_0xebb9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebb9('0x4'));var util=require(_0xebb9('0x5'));var path=require('path');var sox=require(_0xebb9('0x6'));var csv=require(_0xebb9('0x7'));var ejs=require(_0xebb9('0x8'));var fs=require('fs');var fs_extra=require(_0xebb9('0x9'));var _=require(_0xebb9('0xa'));var squel=require(_0xebb9('0xb'));var crypto=require(_0xebb9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xebb9('0xd'));var toCsv=require(_0xebb9('0x7'));var querystring=require(_0xebb9('0xe'));var Papa=require(_0xebb9('0xf'));var Redis=require(_0xebb9('0x10'));var authService=require(_0xebb9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebb9('0x12'));var hardwareService=require(_0xebb9('0x13'));var logger=require(_0xebb9('0x14'))(_0xebb9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xebb9('0x16')]=_[_0xebb9('0x17')](config['redis'],{'host':_0xebb9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebb9('0x16')]));require(_0xebb9('0x19'))[_0xebb9('0x1a')](socket);var jayson=require(_0xebb9('0x1b'));var client=jayson[_0xebb9('0x1c')][_0xebb9('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x5c8ba3,_0x5dfbd8,_0x127493,_0x55d598){return new BPromise(function(_0x2dc054,_0x3a9bee){var _0x1c20ef=_0x55d598||client;return _0x1c20ef[_0xebb9('0x1e')](_0x5c8ba3,_0x127493)[_0xebb9('0x1f')](function(_0x3ece32){logger[_0xebb9('0x20')](_0xebb9('0x21'),_0x5dfbd8,_0xebb9('0x22'));logger['debug'](_0xebb9('0x23'),_0x5dfbd8,_0xebb9('0x22'),JSON[_0xebb9('0x24')](_0x3ece32));if(_0x3ece32[_0xebb9('0x25')]){if(_0x3ece32[_0xebb9('0x25')][_0xebb9('0x26')]===0x1f4){logger['error'](_0xebb9('0x21'),_0x5dfbd8,_0x3ece32[_0xebb9('0x25')][_0xebb9('0x27')]);return _0x3a9bee(_0x3ece32[_0xebb9('0x25')][_0xebb9('0x27')]);}logger[_0xebb9('0x25')](_0xebb9('0x21'),_0x5dfbd8,_0x3ece32['error'][_0xebb9('0x27')]);return _0x2dc054(_0x3ece32[_0xebb9('0x25')][_0xebb9('0x27')]);}else{logger['info'](_0xebb9('0x21'),_0x5dfbd8,_0xebb9('0x22'));_0x2dc054(_0x3ece32['result']['message']);}})[_0xebb9('0x28')](function(_0x15aa90){logger[_0xebb9('0x25')](_0xebb9('0x21'),_0x5dfbd8,_0x15aa90);_0x3a9bee(_0x15aa90);});});}function respondWithStatusCode(_0x25ba8f,_0x54d34f){_0x54d34f=_0x54d34f||0xcc;return function(_0x2de09f){if(_0x2de09f){return _0x25ba8f[_0xebb9('0x29')](_0x54d34f);}return _0x25ba8f[_0xebb9('0x2a')](_0x54d34f)[_0xebb9('0x2b')]();};}function respondWithResult(_0x3a1c90,_0x35eb59){_0x35eb59=_0x35eb59||0xc8;return function(_0x4c935e){if(_0x4c935e){return _0x3a1c90['status'](_0x35eb59)[_0xebb9('0x2c')](_0x4c935e);}};}function respondWithFilteredResult(_0x360927,_0x4593d4){return function(_0x3c3d15){if(_0x3c3d15){var _0x3de9b1=typeof _0x4593d4['offset']===_0xebb9('0x2d')&&typeof _0x4593d4[_0xebb9('0x2e')]===_0xebb9('0x2d');var _0x296a17=_0x3c3d15['count'];var _0xe6def8=_0x3de9b1?0x0:_0x4593d4[_0xebb9('0x2f')];var _0xad79a=_0x3de9b1?_0x3c3d15[_0xebb9('0x30')]:_0x4593d4[_0xebb9('0x2f')]+_0x4593d4[_0xebb9('0x2e')];var _0x2484e5;if(_0xad79a>=_0x296a17){_0xad79a=_0x296a17;_0x2484e5=0xc8;}else{_0x2484e5=0xce;}_0x360927['status'](_0x2484e5);return _0x360927[_0xebb9('0x31')](_0xebb9('0x32'),_0xe6def8+'-'+_0xad79a+'/'+_0x296a17)[_0xebb9('0x2c')](_0x3c3d15);}return null;};}function patchUpdates(_0x8f0cd1){return function(_0x4f4551){try{jsonpatch[_0xebb9('0x33')](_0x4f4551,_0x8f0cd1,!![]);}catch(_0x509068){return BPromise[_0xebb9('0x34')](_0x509068);}return _0x4f4551[_0xebb9('0x35')]();};}function saveUpdates(_0x31b44c,_0x353cbf){return function(_0x4127b9){if(_0x4127b9){return _0x4127b9[_0xebb9('0x36')](_0x31b44c)[_0xebb9('0x1f')](function(_0x50f295){return _0x50f295;});}return null;};}function removeEntity(_0x4035eb,_0x3a6dfc){return function(_0x219069){if(_0x219069){return _0x219069[_0xebb9('0x37')]()[_0xebb9('0x1f')](function(){var _0x506420=_0x219069[_0xebb9('0x38')]({'plain':!![]});var _0x182bf2='SmsAccounts';return db[_0xebb9('0x39')][_0xebb9('0x37')]({'where':{'type':_0x182bf2,'resourceId':_0x506420['id']}})[_0xebb9('0x1f')](function(){return _0x219069;});})[_0xebb9('0x1f')](function(){_0x4035eb[_0xebb9('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c855,_0x2e3953){return function(_0x2db5dd){if(!_0x2db5dd){_0x43c855[_0xebb9('0x29')](0x194);}return _0x2db5dd;};}function handleError(_0x4e334c,_0x317416){_0x317416=_0x317416||0x1f4;return function(_0x20b7f2){logger[_0xebb9('0x25')](_0x20b7f2[_0xebb9('0x3a')]);if(_0x20b7f2[_0xebb9('0x3b')]){delete _0x20b7f2[_0xebb9('0x3b')];}_0x4e334c[_0xebb9('0x2a')](_0x317416)[_0xebb9('0x3c')](_0x20b7f2);};}exports['index']=function(_0x4f5bdf,_0x428812){var _0x1ad131={'include':[{'model':db[_0xebb9('0x3d')],'as':_0xebb9('0x3e')}]},_0x2469e1={},_0x1419ee={'count':0x0,'rows':[]};var _0x630bc7=_[_0xebb9('0x3f')](db[_0xebb9('0x40')][_0xebb9('0x41')],function(_0x3f2b52){return{'name':_0x3f2b52['fieldName'],'type':_0x3f2b52[_0xebb9('0x42')][_0xebb9('0x43')]};});_0x2469e1[_0xebb9('0x44')]=_['map'](_0x630bc7,_0xebb9('0x3b'));_0x2469e1[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x4f5bdf['query']);_0x2469e1[_0xebb9('0x47')]=_['intersection'](_0x2469e1[_0xebb9('0x44')],_0x2469e1['query']);_0x1ad131['attributes']=_[_0xebb9('0x48')](_0x2469e1[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x4f5bdf[_0xebb9('0x45')]['fields']));_0x1ad131['attributes']=_0x1ad131[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x1ad131[_0xebb9('0x4a')]:_0x2469e1[_0xebb9('0x44')];if(!_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x1ad131[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x1ad131[_0xebb9('0x2f')]=qs[_0xebb9('0x2f')](_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x2f')]);}_0x1ad131['order']=qs['sort'](_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x1ad131[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x4f5bdf['query'],_0x2469e1[_0xebb9('0x47')]),_0x630bc7);if(_0x4f5bdf[_0xebb9('0x45')]['filter']){_0x1ad131[_0xebb9('0x4f')]=_[_0xebb9('0x51')](_0x1ad131[_0xebb9('0x4f')],{'$or':_[_0xebb9('0x3f')](_0x630bc7,function(_0x3df749){if(_0x3df749[_0xebb9('0x42')]!=='VIRTUAL'){var _0x5dbefe={};_0x5dbefe[_0x3df749[_0xebb9('0x3b')]]={'$like':'%'+_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x5dbefe;}})});}_0x1ad131=_['merge']({},_0x1ad131,_0x4f5bdf['options']);var _0x27030e={'where':_0x1ad131[_0xebb9('0x4f')]};return db[_0xebb9('0x40')][_0xebb9('0x30')](_0x27030e)[_0xebb9('0x1f')](function(_0x472091){_0x1419ee['count']=_0x472091;if(_0x4f5bdf[_0xebb9('0x45')][_0xebb9('0x53')]){_0x1ad131[_0xebb9('0x54')]=[{'all':!![]}];}return db[_0xebb9('0x40')][_0xebb9('0x55')](_0x1ad131);})[_0xebb9('0x1f')](function(_0x2dee75){_0x1419ee[_0xebb9('0x56')]=_0x2dee75;return _0x1419ee;})['then'](respondWithFilteredResult(_0x428812,_0x1ad131))['catch'](handleError(_0x428812,null));};exports[_0xebb9('0x57')]=function(_0x4c1af3,_0x36493b){var _0x1b8cfd={'raw':![],'where':{'id':_0x4c1af3[_0xebb9('0x58')]['id']},'include':[{'model':db[_0xebb9('0x3d')],'as':_0xebb9('0x3e')}]},_0x3db1f9={};_0x3db1f9['model']=_['keys'](db[_0xebb9('0x40')][_0xebb9('0x41')]);_0x3db1f9[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x4c1af3[_0xebb9('0x45')]);_0x3db1f9[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x3db1f9[_0xebb9('0x44')],_0x3db1f9[_0xebb9('0x45')]);_0x1b8cfd['attributes']=_[_0xebb9('0x48')](_0x3db1f9[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x4c1af3[_0xebb9('0x45')]['fields']));_0x1b8cfd[_0xebb9('0x4a')]=_0x1b8cfd['attributes'][_0xebb9('0x4b')]?_0x1b8cfd[_0xebb9('0x4a')]:_0x3db1f9[_0xebb9('0x44')];if(_0x4c1af3[_0xebb9('0x45')][_0xebb9('0x53')]){_0x1b8cfd['include']=[{'all':!![]}];}_0x1b8cfd=_[_0xebb9('0x51')]({},_0x1b8cfd,_0x4c1af3[_0xebb9('0x59')]);return db[_0xebb9('0x40')]['find'](_0x1b8cfd)[_0xebb9('0x1f')](handleEntityNotFound(_0x36493b,null))[_0xebb9('0x1f')](respondWithResult(_0x36493b,null))[_0xebb9('0x28')](handleError(_0x36493b,null));};exports[_0xebb9('0x5a')]=function(_0x204baa,_0x12b143){return db[_0xebb9('0x40')][_0xebb9('0x5a')](_0x204baa[_0xebb9('0x5b')],{})[_0xebb9('0x1f')](function(_0x5e14df){var _0x532d61=_0x204baa['user'][_0xebb9('0x38')]({'plain':!![]});if(!_0x532d61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x532d61['role']==='user'){var _0x20a552=_0x5e14df[_0xebb9('0x38')]({'plain':!![]});var _0x8e2f51=_0xebb9('0x5c');return db[_0xebb9('0x5d')][_0xebb9('0x5e')]({'where':{'name':_0x8e2f51,'userProfileId':_0x532d61[_0xebb9('0x5f')]},'raw':!![]})[_0xebb9('0x1f')](function(_0x181cce){if(_0x181cce&&_0x181cce[_0xebb9('0x60')]===0x0){return db[_0xebb9('0x39')][_0xebb9('0x5a')]({'name':_0x20a552['name'],'resourceId':_0x20a552['id'],'type':_0x181cce[_0xebb9('0x3b')],'sectionId':_0x181cce['id']},{})[_0xebb9('0x1f')](function(){return _0x5e14df;});}else{return _0x5e14df;}})['catch'](function(_0x20da53){logger[_0xebb9('0x25')](_0xebb9('0x61'),_0x20da53);throw _0x20da53;});}return _0x5e14df;})[_0xebb9('0x1f')](respondWithResult(_0x12b143,0xc9))[_0xebb9('0x28')](handleError(_0x12b143,null));};exports[_0xebb9('0x36')]=function(_0xc3ac58,_0x4e4611){if(_0xc3ac58['body']['id']){delete _0xc3ac58['body']['id'];}return db[_0xebb9('0x40')]['find']({'where':{'id':_0xc3ac58['params']['id']},'include':[{'model':db['Pause'],'as':_0xebb9('0x3e')}]})[_0xebb9('0x1f')](handleEntityNotFound(_0x4e4611,null))[_0xebb9('0x1f')](saveUpdates(_0xc3ac58[_0xebb9('0x5b')],null))['then'](respondWithResult(_0x4e4611,null))[_0xebb9('0x28')](handleError(_0x4e4611,null));};exports[_0xebb9('0x37')]=function(_0x363951,_0x576c68){return db['SmsAccount']['find']({'where':{'id':_0x363951[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x576c68,null))[_0xebb9('0x1f')](removeEntity(_0x576c68,null))[_0xebb9('0x28')](handleError(_0x576c68,null));};exports[_0xebb9('0x62')]=function(_0x287c27,_0x4c813c){return db[_0xebb9('0x40')][_0xebb9('0x62')]()['then'](respondWithResult(_0x4c813c,null))[_0xebb9('0x28')](handleError(_0x4c813c,null));};exports[_0xebb9('0x63')]=function(_0x497aa0,_0xa2933d,_0x2d7091){if(_0x497aa0['body']['id']){delete _0x497aa0[_0xebb9('0x5b')]['id'];}return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x497aa0['params']['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0xa2933d,null))[_0xebb9('0x1f')](function(_0xf18e8){if(_0xf18e8){_0x497aa0['body'][_0xebb9('0x64')]=_0xf18e8['id'];return db[_0xebb9('0x65')][_0xebb9('0x5a')](_0x497aa0[_0xebb9('0x5b')]);}})[_0xebb9('0x1f')](respondWithResult(_0xa2933d,null))[_0xebb9('0x28')](handleError(_0xa2933d,null));};exports['getDispositions']=function(_0x488898,_0x1be633,_0x5ba617){var _0x101126={'raw':![],'where':{}};var _0x3bbda4={};var _0x239aeb={'count':0x0,'rows':[]};return db[_0xebb9('0x40')][_0xebb9('0x66')]({'where':{'id':_0x488898[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x1be633,null))[_0xebb9('0x1f')](function(_0x4890f9){if(_0x4890f9){_0x3bbda4[_0xebb9('0x44')]=_['keys'](db[_0xebb9('0x65')]['rawAttributes']);_0x3bbda4[_0xebb9('0x45')]=_['keys'](_0x488898[_0xebb9('0x45')]);_0x3bbda4[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x3bbda4[_0xebb9('0x44')],_0x3bbda4['query']);_0x101126['attributes']=_[_0xebb9('0x48')](_0x3bbda4['model'],qs[_0xebb9('0x49')](_0x488898[_0xebb9('0x45')][_0xebb9('0x49')]));_0x101126[_0xebb9('0x4a')]=_0x101126['attributes'][_0xebb9('0x4b')]?_0x101126[_0xebb9('0x4a')]:_0x3bbda4[_0xebb9('0x44')];if(!_0x488898[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x101126[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0x488898[_0xebb9('0x45')]['limit']);_0x101126[_0xebb9('0x2f')]=qs['offset'](_0x488898['query'][_0xebb9('0x2f')]);}_0x101126[_0xebb9('0x67')]=qs[_0xebb9('0x4e')](_0x488898['query'][_0xebb9('0x4e')]);_0x101126[_0xebb9('0x4f')]=qs['filters'](_[_0xebb9('0x50')](_0x488898[_0xebb9('0x45')],_0x3bbda4[_0xebb9('0x47')]));_0x101126[_0xebb9('0x4f')]['SmsAccountId']=_0x4890f9['id'];if(_0x488898['query'][_0xebb9('0x52')]){_0x101126[_0xebb9('0x4f')]=_[_0xebb9('0x51')](_0x101126['where'],{'$or':_[_0xebb9('0x3f')](_0x101126['attributes'],function(_0x2c0571){var _0x3a47a9={};_0x3a47a9[_0x2c0571]={'$like':'%'+_0x488898[_0xebb9('0x45')]['filter']+'%'};return _0x3a47a9;})});}_0x101126=_['merge']({},_0x101126,_0x488898[_0xebb9('0x59')]);return db[_0xebb9('0x65')][_0xebb9('0x30')]({'where':_0x101126[_0xebb9('0x4f')]})['then'](function(_0x21e124){_0x239aeb['count']=_0x21e124;if(_0x488898[_0xebb9('0x45')][_0xebb9('0x53')]){_0x101126[_0xebb9('0x54')]=[{'all':!![]}];}return db[_0xebb9('0x65')]['findAll'](_0x101126);})['then'](function(_0x18ac47){_0x239aeb[_0xebb9('0x56')]=_0x18ac47;return _0x239aeb;});}})['then'](respondWithFilteredResult(_0x1be633,_0x101126))[_0xebb9('0x28')](handleError(_0x1be633,null));};exports[_0xebb9('0x68')]=function(_0x19ca14,_0x4c9fa4,_0x3ba6aa){return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x19ca14['params']['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x4c9fa4,null))[_0xebb9('0x1f')](function(_0xea1e49){if(_0xea1e49){return _0xea1e49[_0xebb9('0x68')](_0x19ca14[_0xebb9('0x45')][_0xebb9('0x69')]);}})['then'](respondWithStatusCode(_0x4c9fa4,null))['catch'](handleError(_0x4c9fa4,null));};exports[_0xebb9('0x6a')]=function(_0x57dfdd,_0x347116,_0x1802a9){if(_0x57dfdd['body']['id']){delete _0x57dfdd[_0xebb9('0x5b')]['id'];}return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x57dfdd[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x347116,null))[_0xebb9('0x1f')](function(_0x2000f9){if(_0x2000f9){_0x57dfdd['body'][_0xebb9('0x64')]=_0x2000f9['id'];return db[_0xebb9('0x6b')][_0xebb9('0x5a')](_0x57dfdd['body']);}})[_0xebb9('0x1f')](respondWithResult(_0x347116,null))['catch'](handleError(_0x347116,null));};exports[_0xebb9('0x6c')]=function(_0x38b096,_0x516e7d,_0x5e384b){var _0x249b63={'raw':![],'where':{}};var _0x10a37c={};var _0x2c95c0={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x38b096[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x516e7d,null))['then'](function(_0x4fa6ff){if(_0x4fa6ff){_0x10a37c[_0xebb9('0x44')]=_[_0xebb9('0x46')](db[_0xebb9('0x6b')][_0xebb9('0x41')]);_0x10a37c[_0xebb9('0x45')]=_['keys'](_0x38b096[_0xebb9('0x45')]);_0x10a37c['filters']=_[_0xebb9('0x48')](_0x10a37c['model'],_0x10a37c[_0xebb9('0x45')]);_0x249b63['attributes']=_[_0xebb9('0x48')](_0x10a37c[_0xebb9('0x44')],qs['fields'](_0x38b096[_0xebb9('0x45')][_0xebb9('0x49')]));_0x249b63['attributes']=_0x249b63[_0xebb9('0x4a')]['length']?_0x249b63[_0xebb9('0x4a')]:_0x10a37c['model'];if(!_0x38b096[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x249b63[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0x38b096[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x249b63[_0xebb9('0x2f')]=qs[_0xebb9('0x2f')](_0x38b096[_0xebb9('0x45')]['offset']);}_0x249b63['order']=qs[_0xebb9('0x4e')](_0x38b096[_0xebb9('0x45')]['sort']);_0x249b63[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x38b096[_0xebb9('0x45')],_0x10a37c[_0xebb9('0x47')]));_0x249b63['where'][_0xebb9('0x64')]=_0x4fa6ff['id'];if(_0x38b096[_0xebb9('0x45')]['filter']){_0x249b63[_0xebb9('0x4f')]=_[_0xebb9('0x51')](_0x249b63[_0xebb9('0x4f')],{'$or':_[_0xebb9('0x3f')](_0x249b63['attributes'],function(_0xb67fbb){var _0x375259={};_0x375259[_0xb67fbb]={'$like':'%'+_0x38b096[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x375259;})});}_0x249b63=_[_0xebb9('0x51')]({},_0x249b63,_0x38b096['options']);return db[_0xebb9('0x6b')][_0xebb9('0x30')]({'where':_0x249b63[_0xebb9('0x4f')]})[_0xebb9('0x1f')](function(_0x5cf6f9){_0x2c95c0[_0xebb9('0x30')]=_0x5cf6f9;if(_0x38b096[_0xebb9('0x45')][_0xebb9('0x53')]){_0x249b63['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xebb9('0x55')](_0x249b63);})['then'](function(_0x2475ca){_0x2c95c0[_0xebb9('0x56')]=_0x2475ca;return _0x2c95c0;});}})[_0xebb9('0x1f')](respondWithFilteredResult(_0x516e7d,_0x249b63))['catch'](handleError(_0x516e7d,null));};exports[_0xebb9('0x6d')]=function(_0x33e3e9,_0x449604,_0x5bf14f){return db[_0xebb9('0x40')]['find']({'where':{'id':_0x33e3e9[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x449604,null))[_0xebb9('0x1f')](function(_0x270b70){if(_0x270b70){return _0x270b70[_0xebb9('0x6d')](_0x33e3e9[_0xebb9('0x45')][_0xebb9('0x69')]);}})[_0xebb9('0x1f')](respondWithStatusCode(_0x449604,null))[_0xebb9('0x28')](handleError(_0x449604,null));};exports['notify']=function(_0x13a02d,_0x1e23b4,_0x257a34){var _0xd3327d={'channel':_0xebb9('0x6e')};var _0x357d1d=[];var _0x21f32b=[];var _0x2b1ec7={};return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x13a02d[_0xebb9('0x58')]['id']},'include':[{'model':db[_0xebb9('0x6f')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1e23b4,null))[_0xebb9('0x1f')](function(_0x52fb51){_0xd3327d['account']=_0x52fb51;_0xd3327d[_0xebb9('0x70')]=_[_0xebb9('0x71')](_0x52fb51[_0xebb9('0x72')],[_0xebb9('0x73')],[_0xebb9('0x74')]);if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0x72')]){delete _0xd3327d[_0xebb9('0x75')][_0xebb9('0x72')];}return db[_0xebb9('0x76')][_0xebb9('0x62')]();})[_0xebb9('0x1f')](function(_0x15b55a){if(!_0x15b55a){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0x79'));}_0x357d1d=_[_0xebb9('0x7a')](_[_0xebb9('0x46')](_0x15b55a),['createdAt',_0xebb9('0x7b')]);_0x21f32b=_[_0xebb9('0x7a')](_[_0xebb9('0x46')](_0x15b55a),['createdAt',_0xebb9('0x7b'),_0xebb9('0x7c'),_0xebb9('0x7d')]);_0xd3327d[_0xebb9('0x5b')]={'mapKey':'mobile'};if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0x42')]){switch(_0xd3327d['account'][_0xebb9('0x42')]){case'twilio':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d['body'][_0xebb9('0x7f')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x80')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')]=_0x13a02d[_0xebb9('0x5b')]['MessageSid'];break;case'skebby':_0xd3327d['body'][_0xebb9('0x7e')]='+'+_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x82')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x83')];break;case _0xebb9('0x84'):_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d['body'][_0xebb9('0x7e')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x27')];break;case _0xebb9('0x85'):_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x7e')];_0xd3327d[_0xebb9('0x5b')]['body']=_0x13a02d['body'][_0xebb9('0x5b')];_0xd3327d[_0xebb9('0x5b')]['messageId']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x86')];break;case _0xebb9('0x87'):_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x7f')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x88')];_0xd3327d[_0xebb9('0x5b')]['messageId']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x89')];break;case'infobip':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]='+'+_0x13a02d[_0xebb9('0x5b')]['results'][0x0]['from'];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x8a')][0x0][_0xebb9('0x83')];_0xd3327d['body'][_0xebb9('0x81')]=_0x13a02d[_0xebb9('0x5b')]['results'][0x0]['messageId'];break;case _0xebb9('0x8b'):_0xd3327d['body'][_0xebb9('0x7e')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x8c')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x8d')]['message'];break;case'clickatell':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')]=_0x13a02d['body'][_0xebb9('0x8e')];_0xd3327d['body']['body']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x83')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')]=_0x13a02d['body'][_0xebb9('0x8f')];break;case _0xebb9('0x90'):_0xd3327d[_0xebb9('0x5b')]['messageId']=_0x13a02d[_0xebb9('0x5b')][0x0][_0xebb9('0x27')]['id'];_0xd3327d[_0xebb9('0x5b')]['from']=_0x13a02d[_0xebb9('0x5b')][0x0][_0xebb9('0x27')]['from'];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]=_0x13a02d[_0xebb9('0x5b')][0x0][_0xebb9('0x27')][_0xebb9('0x83')];break;case _0xebb9('0x91'):_0xd3327d['body'][_0xebb9('0x7e')]=_0x13a02d['body']['from'];_0xd3327d[_0xebb9('0x5b')]['body']=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x27')];_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')]=_0x13a02d[_0xebb9('0x5b')][_0xebb9('0x92')];break;}}if(_0xd3327d[_0xebb9('0x5b')]['id']){delete _0xd3327d[_0xebb9('0x5b')]['id'];}if(_[_0xebb9('0x93')](_0xd3327d['body'][_0xebb9('0x7e')])){throw new db[(_0xebb9('0x77'))]['ValidationError'](_0xebb9('0x94'));}if(_[_0xebb9('0x93')](_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')])||_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x5b')]===''){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0x95'));}if(_[_0xebb9('0x93')](_0xd3327d[_0xebb9('0x5b')]['mapKey'])){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0x96')+_0x21f32b);}if(!_[_0xebb9('0x97')](_0x21f32b,_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x98')])){throw new db['Sequelize'][(_0xebb9('0x78'))](_0xebb9('0x99')+_0x21f32b);}_0x2b1ec7[_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x98')]]=_0xd3327d[_0xebb9('0x5b')]['from'];return db[_0xebb9('0x9a')][_0xebb9('0x5e')]({'where':{'id':_0xd3327d['account'][_0xebb9('0x7d')]},'include':[{'model':db[_0xebb9('0x76')],'as':_0xebb9('0x9b'),'where':_0x2b1ec7,'limit':0x1,'order':[['updatedAt',_0xebb9('0x9c')]]}]});})[_0xebb9('0x1f')](handleEntityNotFound(_0x1e23b4,null))[_0xebb9('0x1f')](function(_0x5a7176){if(_0x5a7176){_0xd3327d[_0xebb9('0x9d')]=_['omit'](_0x5a7176,[_0xebb9('0x9b')]);if(_0x5a7176[_0xebb9('0x9b')][_0xebb9('0x4b')]){return _0x5a7176[_0xebb9('0x9b')][0x0];}var _0xadf3c0=_[_0xebb9('0x17')](_0xd3327d['body'],{'firstName':_0xd3327d[_0xebb9('0x5b')]['from'],'ListId':_0x5a7176['id']});_0xadf3c0[_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x98')]]=_0xd3327d['body']['from'];return db[_0xebb9('0x76')][_0xebb9('0x5a')](_0xadf3c0,{'fields':_0x357d1d,'raw':!![]});}})[_0xebb9('0x1f')](handleEntityNotFound(_0x1e23b4,null))[_0xebb9('0x1f')](function(_0x38358c){if(_0x38358c){_0xd3327d[_0xebb9('0x9e')]=_0x38358c;var _0x5381a2={'ContactId':_0x38358c['id'],'phone':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')],'SmsAccountId':_0x13a02d[_0xebb9('0x58')]['id']};var _0x240426={'ContactId':_0x38358c['id'],'SmsAccountId':_0x13a02d[_0xebb9('0x58')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x240426})[_0xebb9('0x1f')](function(_0x3fc7bb){if(_0x3fc7bb){return[_0x3fc7bb,![]];}return db[_0xebb9('0x9f')][_0xebb9('0x5a')](_0x5381a2)[_0xebb9('0x1f')](function(_0xa43cc3){return[_0xa43cc3,!![]];});});}})[_0xebb9('0xa0')](function(_0x5d4d30,_0x4ca9e4){_0xd3327d['interaction']=_0x5d4d30[_0xebb9('0x38')]({'plain':!![]});_0xd3327d[_0xebb9('0xa1')]['created']=![];if(_0x4ca9e4){if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0xa2')]){_0xd3327d[_0xebb9('0x70')][_0xebb9('0xa3')]({'id':0x0,'priority':_0xd3327d[_0xebb9('0x70')]['length']+0x1,'app':'close','appdata':_0xebb9('0xa4'),'interval':_0xebb9('0xa5')});}_0xd3327d[_0xebb9('0xa1')][_0xebb9('0xa6')]=!![];}return db[_0xebb9('0xa7')][_0xebb9('0x5a')]({'phone':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x7e')],'messageId':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0x81')],'body':_0xd3327d['body']['body'],'SmsAccountId':_0x13a02d[_0xebb9('0x58')]['id'],'SmsInteractionId':_0x5d4d30['id'],'direction':'in','ContactId':_0x5d4d30[_0xebb9('0xa8')],'AttachmentId':_0xd3327d[_0xebb9('0x5b')][_0xebb9('0xa9')]});})[_0xebb9('0x1f')](function(_0x801332){_0xd3327d[_0xebb9('0x27')]=_0x801332;if(_0xd3327d[_0xebb9('0xa1')][_0xebb9('0xaa')]){return db['User'][_0xebb9('0x5e')]({'attributes':['id',_0xebb9('0x3b')],'where':{'id':_0xd3327d[_0xebb9('0xa1')]['UserId']}})[_0xebb9('0x1f')](function(_0x301c46){if(_0x301c46){_0xd3327d[_0xebb9('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':_0xebb9('0xab'),'appdata':_0x301c46['name']+','+(_0xd3327d['account'][_0xebb9('0xac')]||0xa),'interval':_0xebb9('0xa5')});}return respondWithRpcPromise(_0xebb9('0xad'),_0xebb9('0xae'),_0xd3327d);});}return respondWithRpcPromise('Start',_0xebb9('0xae'),_0xd3327d);})[_0xebb9('0x1f')](function(_0x5eba7e){if(_0x5eba7e){var _0x57ca03=0xc8;var _0xd1d6bd=_0xebb9('0xaf');logger[_0xebb9('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd1d6bd,_0x57ca03,_0xebb9('0xb0'));logger[_0xebb9('0xb1')](_0xebb9('0xb2'),_0xd1d6bd,_0x57ca03,_0xebb9('0xb0'),JSON['stringify'](_0x5eba7e));if(_0xd3327d[_0xebb9('0x75')][_0xebb9('0x42')]===_0xebb9('0xb3')){return _0x1e23b4[_0xebb9('0x2a')](_0x57ca03)[_0xebb9('0x31')]('Content-Type',_0xebb9('0xb4'))[_0xebb9('0x3c')](_0xebb9('0xb5'));}else{return _0x1e23b4[_0xebb9('0x2a')](_0x57ca03)[_0xebb9('0x2c')](_0x5eba7e);}}})[_0xebb9('0x28')](handleError(_0x1e23b4,null));};exports[_0xebb9('0xb6')]=function(_0xa9bb9e,_0x4d8874){var _0x4892e0=_0xa9bb9e[_0xebb9('0x58')]['id'];var _0x26aac9=_0xa9bb9e['body'];var _0x5e3a63=0xc8;var _0x2f326e=null;return db[_0xebb9('0xb7')][_0xebb9('0xb8')]({'isolationLevel':db[_0xebb9('0xb7')][_0xebb9('0xb9')]['ISOLATION_LEVELS'][_0xebb9('0xba')]},function(_0x5af110){return db[_0xebb9('0x40')][_0xebb9('0x66')]({'where':{'id':_0x4892e0},'transaction':_0x5af110})['then'](function(_0x55a901){if(_0x55a901){return db[_0xebb9('0x6f')][_0xebb9('0x37')]({'where':{'SmsAccountId':_0x4892e0},'transaction':_0x5af110})[_0xebb9('0x1f')](function(){var _0x2cb193=_['map'](_0x26aac9,function(_0x17b75f){_0x17b75f[_0xebb9('0x64')]=_0x4892e0;return _0x17b75f;});return db[_0xebb9('0x6f')][_0xebb9('0xbb')](_0x2cb193,{'transaction':_0x5af110});});}else{_0x5e3a63=0x194;_0x2f326e=[];}});})[_0xebb9('0x1f')](function(){if(_0x5e3a63!==0x194){return db[_0xebb9('0x6f')][_0xebb9('0xbc')]({'where':{'SmsAccountId':_0x4892e0},'order':_0xebb9('0x73')})['then'](function(_0x591c26){_0x2f326e=_0x591c26;});}})[_0xebb9('0x28')](function(_0x3fc8ad){_0x5e3a63=0x1f4;logger[_0xebb9('0x25')](_0x3fc8ad[_0xebb9('0x3a')]);if(_0x3fc8ad[_0xebb9('0x3b')]){delete _0x3fc8ad[_0xebb9('0x3b')];}_0x2f326e=_0x3fc8ad;})[_0xebb9('0xbd')](function(){if(_0x2f326e===null){_0x4d8874['sendStatus'](_0x5e3a63);}else{if(_0x5e3a63===0x1f4){_0x4d8874[_0xebb9('0x2a')](_0x5e3a63)[_0xebb9('0x3c')](_0x2f326e);}else{_0x4d8874['status'](_0x5e3a63)[_0xebb9('0x2c')](_0x2f326e);}}});};exports[_0xebb9('0xbe')]=function(_0x21a257,_0xf71c2,_0x132e50){var _0x5db5aa={};var _0x655272={};var _0x902495;var _0x2f27d4;return db['SmsAccount'][_0xebb9('0x66')]({'where':{'id':_0x21a257[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0xf71c2,null))['then'](function(_0x27ea45){if(_0x27ea45){_0x902495=_0x27ea45;_0x655272[_0xebb9('0x44')]=_['keys'](db['SmsApplication'][_0xebb9('0x41')]);_0x655272[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x21a257[_0xebb9('0x45')]);_0x655272[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x655272[_0xebb9('0x44')],_0x655272[_0xebb9('0x45')]);_0x5db5aa[_0xebb9('0x4a')]=_['intersection'](_0x655272[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x21a257[_0xebb9('0x45')]['fields']));_0x5db5aa[_0xebb9('0x4a')]=_0x5db5aa[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x5db5aa[_0xebb9('0x4a')]:_0x655272[_0xebb9('0x44')];_0x5db5aa[_0xebb9('0x67')]=qs[_0xebb9('0x4e')](_0x21a257[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x5db5aa[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x21a257['query'],_0x655272['filters']));if(_0x21a257['query']['filter']){_0x5db5aa[_0xebb9('0x4f')]=_['merge'](_0x5db5aa['where'],{'$or':_['map'](_0x5db5aa[_0xebb9('0x4a')],function(_0x3f9745){var _0xb154f9={};_0xb154f9[_0x3f9745]={'$like':'%'+_0x21a257[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0xb154f9;})});}_0x5db5aa=_[_0xebb9('0x51')]({},_0x5db5aa,_0x21a257[_0xebb9('0x59')]);return _0x902495['getApplications'](_0x5db5aa);}})[_0xebb9('0x1f')](function(_0x555f90){if(_0x555f90){_0x2f27d4=_0x555f90[_0xebb9('0x4b')];if(!_0x21a257[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x5db5aa[_0xebb9('0x2e')]=qs['limit'](_0x21a257['query'][_0xebb9('0x2e')]);_0x5db5aa[_0xebb9('0x2f')]=qs['offset'](_0x21a257['query'][_0xebb9('0x2f')]);}return _0x902495[_0xebb9('0xbe')](_0x5db5aa);}})[_0xebb9('0x1f')](function(_0x21f625){if(_0x21f625){return _0x21f625?{'count':_0x2f27d4,'rows':_0x21f625}:null;}})[_0xebb9('0x1f')](respondWithResult(_0xf71c2,null))['catch'](handleError(_0xf71c2,null));};exports['getInteractions']=function(_0x3d67b9,_0x554cd4,_0x13a341){var _0x9fe801={'raw':![],'where':{}};var _0x37f9d4={};var _0x2439d4={'count':0x0,'rows':[]};return db[_0xebb9('0x40')][_0xebb9('0x66')]({'where':{'id':_0x3d67b9[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x554cd4,null))[_0xebb9('0x1f')](function(_0x3ef0cd){if(_0x3ef0cd){_0x37f9d4[_0xebb9('0x44')]=_['keys'](db['SmsInteraction'][_0xebb9('0x41')]);_0x37f9d4[_0xebb9('0x45')]=_[_0xebb9('0x46')](_0x3d67b9[_0xebb9('0x45')]);_0x37f9d4[_0xebb9('0x47')]=_['intersection'](_0x37f9d4['model'],_0x37f9d4[_0xebb9('0x45')]);_0x9fe801[_0xebb9('0x4a')]=_[_0xebb9('0x48')](_0x37f9d4[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0x3d67b9['query'][_0xebb9('0x49')]));_0x9fe801[_0xebb9('0x4a')]=_0x9fe801[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x9fe801[_0xebb9('0x4a')]:_0x37f9d4['model'];if(!_0x3d67b9[_0xebb9('0x45')]['hasOwnProperty'](_0xebb9('0x4d'))){_0x9fe801[_0xebb9('0x2e')]=qs['limit'](_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x9fe801[_0xebb9('0x2f')]=qs['offset'](_0x3d67b9['query'][_0xebb9('0x2f')]);}_0x9fe801[_0xebb9('0x67')]=qs['sort'](_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x9fe801[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0x3d67b9[_0xebb9('0x45')],_0x37f9d4[_0xebb9('0x47')]));_0x9fe801[_0xebb9('0x4f')]['SmsAccountId']=_0x3ef0cd['id'];if(_0x3d67b9['query'][_0xebb9('0x52')]){_0x9fe801['where']=_[_0xebb9('0x51')](_0x9fe801['where'],{'$or':_[_0xebb9('0x3f')](_0x9fe801['attributes'],function(_0x837224){var _0x3e86fe={};_0x3e86fe[_0x837224]={'$like':'%'+_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x3e86fe;})});}_0x9fe801=_['merge']({},_0x9fe801,_0x3d67b9[_0xebb9('0x59')]);return db['SmsInteraction'][_0xebb9('0x30')]({'where':_0x9fe801['where']})[_0xebb9('0x1f')](function(_0x1c84fc){_0x2439d4[_0xebb9('0x30')]=_0x1c84fc;if(_0x3d67b9[_0xebb9('0x45')][_0xebb9('0x53')]){_0x9fe801['include']=[{'model':db[_0xebb9('0x76')],'as':'Contact','required':![]},{'model':db[_0xebb9('0xbf')],'as':_0xebb9('0xc0'),'attributes':[_0xebb9('0x3b'),_0xebb9('0xc1'),'internal'],'required':![]},{'model':db[_0xebb9('0xc2')],'as':_0xebb9('0xc3'),'attributes':['id',_0xebb9('0x3b'),_0xebb9('0xc4')],'where':_0x3d67b9[_0xebb9('0x45')]['tag']?{'id':_0x3d67b9[_0xebb9('0x45')][_0xebb9('0xc5')]}:undefined,'required':_0x3d67b9[_0xebb9('0x45')]['tag']?!![]:![]}];}return db[_0xebb9('0x9f')][_0xebb9('0x55')](_0x9fe801);})[_0xebb9('0x1f')](function(_0x5f24bb){_0x2439d4[_0xebb9('0x56')]=_0x5f24bb;return _0x2439d4;});}})[_0xebb9('0x1f')](respondWithFilteredResult(_0x554cd4,_0x9fe801))[_0xebb9('0x28')](handleError(_0x554cd4,null));};exports['send']=function(_0x38ccf5,_0x27580a,_0x354daa){var _0x443c00,_0xaad2d,_0x3ee0c3;if(_[_0xebb9('0x93')](_0x38ccf5['body']['body'])||_0x38ccf5[_0xebb9('0x5b')][_0xebb9('0x5b')]===''){throw new db['Sequelize'][(_0xebb9('0x78'))](_0xebb9('0x95'));}if(_['isNil'](_0x38ccf5['body']['to'])){throw new db[(_0xebb9('0x77'))][(_0xebb9('0x78'))](_0xebb9('0xc6'));}_0x443c00=_0x38ccf5[_0xebb9('0x5b')]['to'];return db['SmsAccount'][_0xebb9('0x5e')]({'where':{'id':_0x38ccf5[_0xebb9('0x58')]['id']},'include':[{'model':db[_0xebb9('0x9a')],'as':_0xebb9('0xc7'),'include':[{'model':db[_0xebb9('0x76')],'as':_0xebb9('0x9b'),'where':{'mobile':_0x443c00},'limit':0x1,'order':[[_0xebb9('0x7b'),'DESC']]}]}]})[_0xebb9('0x1f')](handleEntityNotFound(_0x27580a,null))['then'](function(_0x533751){if(_0x533751&&_0x533751[_0xebb9('0xc7')]){_0xaad2d=_0x533751[_0xebb9('0x38')]({'plain':!![]});if(_0xaad2d[_0xebb9('0xc7')]&&_0xaad2d[_0xebb9('0xc7')]['Contacts'][_0xebb9('0x4b')]){return _0xaad2d[_0xebb9('0xc7')][_0xebb9('0x9b')][0x0];}return db[_0xebb9('0x76')][_0xebb9('0x5a')](_[_0xebb9('0x17')](_0x38ccf5[_0xebb9('0x5b')],{'firstName':_0x443c00,'mobile':_0x443c00,'phone':_0x443c00,'ListId':_0xaad2d['ListId']}));}})[_0xebb9('0x1f')](handleEntityNotFound(_0x27580a,null))[_0xebb9('0x1f')](function(_0x21f4a8){if(_0x21f4a8){_0x3ee0c3=_0x21f4a8;return db['SmsInteraction'][_0xebb9('0x5e')]({'where':{'ContactId':_0x3ee0c3['id'],'closed':![],'SmsAccountId':_0xaad2d['id']}})['then'](function(_0x5ef8b8){if(_0x5ef8b8){return[_0x5ef8b8,![]];}return db[_0xebb9('0x9f')]['create']({'UserId':_0x38ccf5[_0xebb9('0xc8')]['id'],'ContactId':_0x3ee0c3['id'],'SmsAccountId':_0xaad2d['id'],'phone':_0x443c00,'firstMsgDirection':_0xebb9('0xc9'),'Messages':[_[_0xebb9('0x51')](_0x38ccf5[_0xebb9('0x5b')],{'read':![],'body':_0x38ccf5[_0xebb9('0x5b')]['body'],'phone':_0x443c00,'SmsAccountId':_0xaad2d['id'],'UserId':_0x38ccf5[_0xebb9('0xc8')]['id'],'ContactId':_0x3ee0c3['id']})]},{'include':[{'model':db[_0xebb9('0xa7')],'as':_0xebb9('0xca')}]})[_0xebb9('0x1f')](function(_0x3b5b5c){return[_0x3b5b5c,!![]];});});}})[_0xebb9('0xa0')](function(_0x19fa7f,_0x51833c){if(_0x51833c){return _0x19fa7f;}return db[_0xebb9('0xa7')][_0xebb9('0x5a')](_[_0xebb9('0x51')](_0x38ccf5[_0xebb9('0x5b')],{'read':![],'body':_0x38ccf5['body'][_0xebb9('0x5b')],'phone':_0x443c00,'SmsAccountId':_0xaad2d['id'],'SmsInteractionId':_0x19fa7f['id'],'UserId':_0x38ccf5['user']['id'],'ContactId':_0x3ee0c3['id']}))[_0xebb9('0x1f')](function(_0x311117){_0x19fa7f[_0xebb9('0xcb')][_0xebb9('0xca')]=[];_0x19fa7f[_0xebb9('0xcb')][_0xebb9('0xca')][_0xebb9('0xa3')](_0x311117['dataValues']);return _0x19fa7f;});})['then'](respondWithResult(_0x27580a,null))[_0xebb9('0x28')](handleError(_0x27580a,null));};exports[_0xebb9('0x2a')]=function(_0x33a176,_0x40b49f,_0x46af99){if(_0x33a176[_0xebb9('0x5b')]['id']){delete _0x33a176['body']['id'];}var _0x2cdf6d,_0x434d2a,_0x154759;return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x33a176[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x40b49f,null))[_0xebb9('0x1f')](function(_0x34e18a){if(_0x34e18a){_0x154759=_0x34e18a;logger[_0xebb9('0xb1')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xebb9('0xcc'),_0x34e18a[_0xebb9('0x42')],util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));switch(_0x34e18a[_0xebb9('0x42')]){case _0xebb9('0xce'):if(_0x33a176[_0xebb9('0x5b')][_0xebb9('0xcf')]&&_0x33a176[_0xebb9('0x5b')]['status']){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')];return db['SmsMessage'][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][_0xebb9('0xcf')]}});}break;case'connectel':if(_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd0')]&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd1')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd1')];return db[_0xebb9('0xa7')]['find']({'where':{'messageId':_0x33a176['body'][_0xebb9('0xd0')]}});}break;case'clicksend':if(_0x33a176['body']['message_id']&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd2')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0xd2')];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][_0xebb9('0x86')]}});}break;case'infobip':var _0x3324d9=_0x33a176[_0xebb9('0x5b')][_0xebb9('0x8a')][0x0];if(_0x3324d9[_0xebb9('0x81')]&&_0x3324d9[_0xebb9('0x2a')]['groupName']===_0xebb9('0xd3')){_0x434d2a=_0x3324d9[_0xebb9('0x2a')][_0xebb9('0xd4')];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x3324d9[_0xebb9('0x81')]}});}break;case _0xebb9('0xd5'):if(_0x33a176[_0xebb9('0x5b')]['messageId']&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')];return db[_0xebb9('0xa7')]['find']({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][_0xebb9('0x81')]}});}break;case'bandwidth':if(_0x33a176[_0xebb9('0x5b')][0x0][_0xebb9('0x27')]['id']){_0x434d2a=_0x33a176[_0xebb9('0x5b')][0x0]['type'];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176[_0xebb9('0x5b')][0x0]['message']['id']}});}break;case _0xebb9('0x91'):if(_0x33a176['body'][_0xebb9('0xd6')]&&_0x33a176[_0xebb9('0x5b')][_0xebb9('0x2a')]){_0x434d2a=_0x33a176[_0xebb9('0x5b')]['status'];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x33a176['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x40b49f,null))[_0xebb9('0x1f')](function(_0x28fe31){if(_0x28fe31){_0x2cdf6d=_0x28fe31;switch(_0x154759[_0xebb9('0x42')]){case _0xebb9('0xce'):if(_0x434d2a===_0xebb9('0xd3')){return _0x2cdf6d['update']({'read':!![]});}else{logger['error'](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0xce'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0x84'):if(_0x434d2a==='1'){return _0x2cdf6d['update']({'read':!![]});}else{logger['error'](_0xebb9('0x23'),'status',_0xebb9('0xce'),util['inspect'](_0x33a176['body'],{'showHidden':![],'depth':null}));}break;case _0xebb9('0x85'):if(!_0x33a176['body'][_0xebb9('0xd7')]&&_0x434d2a>=0xc8&&_0x434d2a<=0xce){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),_0xebb9('0x2a'),'clicksend',util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0xd8'):var _0x2135cf=_0x33a176[_0xebb9('0x5b')]['results'][0x0];if(_0x2135cf[_0xebb9('0x2a')][_0xebb9('0xd4')]===_0xebb9('0xd3')){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),'status',_0xebb9('0xd8'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0xd5'):if(_0x434d2a==_0xebb9('0xd9')||_0x434d2a==_0xebb9('0xda')){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xebb9('0x2a'),_0xebb9('0xd5'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x434d2a=='message-delivered'){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger['error'](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0x90'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xebb9('0x91'):if(_0x434d2a==='DELIVRD'||_0x434d2a===_0xebb9('0xdb')){return _0x2cdf6d[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0x91'),util[_0xebb9('0xcd')](_0x33a176[_0xebb9('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2cdf6d;}})[_0xebb9('0x1f')](respondWithResult(_0x40b49f,null))[_0xebb9('0x28')](handleError(_0x40b49f,null));};exports[_0xebb9('0xdc')]=function(_0x175bcd,_0x56d70e,_0x1270ac){var _0x1d2dd8,_0xb0fbce,_0x1abf76;return db[_0xebb9('0x40')][_0xebb9('0x5e')]({'where':{'id':_0x175bcd[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x56d70e,null))['then'](function(_0x136bca){if(_0x136bca){_0x1abf76=_0x136bca;logger[_0xebb9('0xb1')](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0xcc'),_0x136bca[_0xebb9('0x42')],util[_0xebb9('0xcd')](_0x175bcd[_0xebb9('0x45')],{'showHidden':![],'depth':null}));switch(_0x136bca[_0xebb9('0x42')]){case _0xebb9('0x8b'):if(_0x175bcd['query']['message-id']&&_0x175bcd[_0xebb9('0x45')][_0xebb9('0xdd')]){_0xb0fbce=_0x175bcd[_0xebb9('0x45')][_0xebb9('0xdd')];return db[_0xebb9('0xa7')][_0xebb9('0x5e')]({'where':{'messageId':_0x175bcd['query'][_0xebb9('0xde')]}});}break;}}})[_0xebb9('0x1f')](handleEntityNotFound(_0x56d70e,null))[_0xebb9('0x1f')](function(_0x11fd91){if(_0x11fd91){_0x1d2dd8=_0x11fd91;switch(_0x1abf76['type']){case _0xebb9('0x8b'):if(_0xb0fbce==='2'||_0xb0fbce==='6'){return _0x1d2dd8[_0xebb9('0x36')]({'read':!![]});}else{logger[_0xebb9('0x25')](_0xebb9('0x23'),_0xebb9('0x2a'),_0xebb9('0x8b'),util[_0xebb9('0xcd')](_0x175bcd[_0xebb9('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x1d2dd8;}})[_0xebb9('0x1f')](respondWithResult(_0x56d70e,null))[_0xebb9('0x28')](handleError(_0x56d70e,null));};exports[_0xebb9('0xdf')]=function(_0x5160b2,_0x731960,_0x4fa267){return db[_0xebb9('0x40')]['find']({'where':{'id':_0x5160b2[_0xebb9('0x58')]['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x731960,null))[_0xebb9('0x1f')](function(_0x3a632c){if(_0x3a632c){return _0x3a632c[_0xebb9('0xdf')](_0x5160b2[_0xebb9('0x5b')][_0xebb9('0x69')],_[_0xebb9('0xe0')](_0x5160b2['body'],['ids','id'])||{})[_0xebb9('0xa0')](function(_0x4aa9bd){for(var _0x5a2238=0x0;_0x5a2238<_0x5160b2[_0xebb9('0x5b')][_0xebb9('0x69')][_0xebb9('0x4b')];_0x5a2238+=0x1){socket[_0xebb9('0xe1')](_0xebb9('0xe2'),{'UserId':Number(_0x5160b2[_0xebb9('0x5b')][_0xebb9('0x69')][_0x5a2238]),'SmsAccountId':Number(_0x5160b2[_0xebb9('0x58')]['id'])});}return _0x4aa9bd;});}})['then'](respondWithResult(_0x731960,null))[_0xebb9('0x28')](handleError(_0x731960,null));};exports['removeAgents']=function(_0x7a009f,_0x2c8073,_0x2dbc4b){return db[_0xebb9('0x40')]['find']({'where':{'id':_0x7a009f['params']['id']}})[_0xebb9('0x1f')](handleEntityNotFound(_0x2c8073,null))['then'](function(_0x3bcd51){if(_0x3bcd51){return _0x3bcd51['removeAgents'](_0x7a009f[_0xebb9('0x45')][_0xebb9('0x69')])[_0xebb9('0x1f')](function(){if(_[_0xebb9('0xe3')](_0x7a009f[_0xebb9('0x45')]['ids'])){for(var _0x2c4d2e=0x0;_0x2c4d2e<_0x7a009f['query'][_0xebb9('0x69')][_0xebb9('0x4b')];_0x2c4d2e+=0x1){socket[_0xebb9('0xe1')](_0xebb9('0xe4'),{'UserId':Number(_0x7a009f[_0xebb9('0x45')]['ids'][_0x2c4d2e]),'SmsAccountId':Number(_0x7a009f['params']['id'])});}}else{socket[_0xebb9('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x7a009f[_0xebb9('0x45')]['ids']),'SmsAccountId':Number(_0x7a009f[_0xebb9('0x58')]['id'])});}});}})[_0xebb9('0x1f')](respondWithStatusCode(_0x2c8073,null))[_0xebb9('0x28')](handleError(_0x2c8073,null));};exports['getAgents']=function(_0xc62b17,_0x294c76,_0x37cd1f){var _0x2d2f7e={};var _0x4b7527={};var _0x46d86e;var _0x8c98ba;return db[_0xebb9('0x40')]['findOne']({'where':{'id':_0xc62b17[_0xebb9('0x58')]['id']}})['then'](handleEntityNotFound(_0x294c76,null))['then'](function(_0x138b6d){if(_0x138b6d){_0x46d86e=_0x138b6d;_0x4b7527[_0xebb9('0x44')]=_[_0xebb9('0x46')](db[_0xebb9('0xbf')]['rawAttributes']);_0x4b7527[_0xebb9('0x45')]=_['keys'](_0xc62b17[_0xebb9('0x45')]);_0x4b7527[_0xebb9('0x47')]=_[_0xebb9('0x48')](_0x4b7527[_0xebb9('0x44')],_0x4b7527[_0xebb9('0x45')]);_0x2d2f7e['attributes']=_['intersection'](_0x4b7527[_0xebb9('0x44')],qs[_0xebb9('0x49')](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x49')]));_0x2d2f7e[_0xebb9('0x4a')]=_0x2d2f7e[_0xebb9('0x4a')][_0xebb9('0x4b')]?_0x2d2f7e[_0xebb9('0x4a')]:_0x4b7527['model'];_0x2d2f7e[_0xebb9('0x67')]=qs[_0xebb9('0x4e')](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x4e')]);_0x2d2f7e[_0xebb9('0x4f')]=qs[_0xebb9('0x47')](_[_0xebb9('0x50')](_0xc62b17[_0xebb9('0x45')],_0x4b7527[_0xebb9('0x47')]));if(_0xc62b17[_0xebb9('0x45')]['filter']){_0x2d2f7e[_0xebb9('0x4f')]=_['merge'](_0x2d2f7e[_0xebb9('0x4f')],{'$or':_[_0xebb9('0x3f')](_0x2d2f7e['attributes'],function(_0x2577bb){var _0x12e598={};_0x12e598[_0x2577bb]={'$like':'%'+_0xc62b17[_0xebb9('0x45')][_0xebb9('0x52')]+'%'};return _0x12e598;})});}_0x2d2f7e=_[_0xebb9('0x51')]({},_0x2d2f7e,_0xc62b17[_0xebb9('0x59')]);return _0x46d86e['getAgents'](_0x2d2f7e);}})[_0xebb9('0x1f')](function(_0xf52f97){if(_0xf52f97){_0x8c98ba=_0xf52f97['length'];if(!_0xc62b17[_0xebb9('0x45')][_0xebb9('0x4c')](_0xebb9('0x4d'))){_0x2d2f7e[_0xebb9('0x2e')]=qs[_0xebb9('0x2e')](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x2e')]);_0x2d2f7e[_0xebb9('0x2f')]=qs['offset'](_0xc62b17[_0xebb9('0x45')][_0xebb9('0x2f')]);}return _0x46d86e[_0xebb9('0xe5')](_0x2d2f7e);}})['then'](function(_0x9138f9){if(_0x9138f9){return _0x9138f9?{'count':_0x8c98ba,'rows':_0x9138f9}:null;}})[_0xebb9('0x1f')](respondWithResult(_0x294c76,null))['catch'](handleError(_0x294c76,null));}; \ No newline at end of file +var _0x06f3=['ListId','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','status_code','groupName','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsAccount.socket','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','index','Pause','map','SmsAccount','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','mandatoryDispositionPause','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','mobile','type','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','ValidationError','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List'];(function(_0x51a939,_0x20e740){var _0x1250f4=function(_0x21a8e0){while(--_0x21a8e0){_0x51a939['push'](_0x51a939['shift']());}};_0x1250f4(++_0x20e740);}(_0x06f3,0x1e9));var _0x306f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x06f3[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x306f('0x0'));var rimraf=require(_0x306f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x306f('0x2'));var rp=require(_0x306f('0x3'));var moment=require('moment');var BPromise=require(_0x306f('0x4'));var Mustache=require(_0x306f('0x5'));var util=require(_0x306f('0x6'));var path=require('path');var sox=require(_0x306f('0x7'));var csv=require(_0x306f('0x8'));var ejs=require(_0x306f('0x9'));var fs=require('fs');var fs_extra=require(_0x306f('0xa'));var _=require('lodash');var squel=require(_0x306f('0xb'));var crypto=require(_0x306f('0xc'));var jsforce=require(_0x306f('0xd'));var deskjs=require(_0x306f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x306f('0xf'));var Papa=require('papaparse');var Redis=require(_0x306f('0x10'));var authService=require(_0x306f('0x11'));var qs=require(_0x306f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x306f('0x13'))(_0x306f('0x14'));var utils=require(_0x306f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x306f('0x16'));var db=require('../../mysqldb')['db'];config[_0x306f('0x17')]=_[_0x306f('0x18')](config['redis'],{'host':_0x306f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x306f('0x1a'))['register'](socket);var jayson=require(_0x306f('0x1b'));var client=jayson[_0x306f('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x51e4be,_0x1ac5eb,_0x1480cd,_0x255b88){return new BPromise(function(_0x1f7f82,_0x33bb5e){var _0x464ffb=_0x255b88||client;return _0x464ffb[_0x306f('0x1d')](_0x51e4be,_0x1480cd)[_0x306f('0x1e')](function(_0x4cf271){logger[_0x306f('0x1f')](_0x306f('0x20'),_0x1ac5eb,_0x306f('0x21'));logger[_0x306f('0x22')](_0x306f('0x23'),_0x1ac5eb,'request\x20sent',JSON[_0x306f('0x24')](_0x4cf271));if(_0x4cf271['error']){if(_0x4cf271[_0x306f('0x25')][_0x306f('0x26')]===0x1f4){logger[_0x306f('0x25')](_0x306f('0x20'),_0x1ac5eb,_0x4cf271['error'][_0x306f('0x27')]);return _0x33bb5e(_0x4cf271[_0x306f('0x25')]['message']);}logger[_0x306f('0x25')](_0x306f('0x20'),_0x1ac5eb,_0x4cf271['error'][_0x306f('0x27')]);return _0x1f7f82(_0x4cf271['error'][_0x306f('0x27')]);}else{logger[_0x306f('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x1ac5eb,_0x306f('0x21'));_0x1f7f82(_0x4cf271[_0x306f('0x28')]['message']);}})[_0x306f('0x29')](function(_0x8af5a6){logger[_0x306f('0x25')]('SmsAccount,\x20%s,\x20%s',_0x1ac5eb,_0x8af5a6);_0x33bb5e(_0x8af5a6);});});}function respondWithStatusCode(_0x104481,_0x5db789){_0x5db789=_0x5db789||0xcc;return function(_0x5e609f){if(_0x5e609f){return _0x104481[_0x306f('0x2a')](_0x5db789);}return _0x104481['status'](_0x5db789)[_0x306f('0x2b')]();};}function respondWithResult(_0x2ff908,_0x409227){_0x409227=_0x409227||0xc8;return function(_0x325941){if(_0x325941){return _0x2ff908[_0x306f('0x2c')](_0x409227)[_0x306f('0x2d')](_0x325941);}};}function respondWithFilteredResult(_0x49e2fb,_0x1423c9){return function(_0x53fbe9){if(_0x53fbe9){var _0x4061ac=typeof _0x1423c9[_0x306f('0x2e')]==='undefined'&&typeof _0x1423c9[_0x306f('0x2f')]==='undefined';var _0x5f0666=_0x53fbe9[_0x306f('0x30')];var _0x561e96=_0x4061ac?0x0:_0x1423c9[_0x306f('0x2e')];var _0x3df700=_0x4061ac?_0x53fbe9[_0x306f('0x30')]:_0x1423c9[_0x306f('0x2e')]+_0x1423c9['limit'];var _0x3c07c4;if(_0x3df700>=_0x5f0666){_0x3df700=_0x5f0666;_0x3c07c4=0xc8;}else{_0x3c07c4=0xce;}_0x49e2fb[_0x306f('0x2c')](_0x3c07c4);return _0x49e2fb[_0x306f('0x31')](_0x306f('0x32'),_0x561e96+'-'+_0x3df700+'/'+_0x5f0666)[_0x306f('0x2d')](_0x53fbe9);}return null;};}function patchUpdates(_0x123b5c){return function(_0x22982e){try{jsonpatch[_0x306f('0x33')](_0x22982e,_0x123b5c,!![]);}catch(_0x572221){return BPromise[_0x306f('0x34')](_0x572221);}return _0x22982e[_0x306f('0x35')]();};}function saveUpdates(_0x2aa899,_0x56e9e7){return function(_0x2c9125){if(_0x2c9125){return _0x2c9125[_0x306f('0x36')](_0x2aa899)[_0x306f('0x1e')](function(_0x514cfb){return _0x514cfb;});}return null;};}function removeEntity(_0x1dbd96,_0x3b36b5){return function(_0x12daa5){if(_0x12daa5){return _0x12daa5[_0x306f('0x37')]()[_0x306f('0x1e')](function(){var _0x5d03ef=_0x12daa5[_0x306f('0x38')]({'plain':!![]});var _0x1a11fa=_0x306f('0x39');return db['UserProfileResource'][_0x306f('0x37')]({'where':{'type':_0x1a11fa,'resourceId':_0x5d03ef['id']}})['then'](function(){return _0x12daa5;});})[_0x306f('0x1e')](function(){_0x1dbd96[_0x306f('0x2c')](0xcc)[_0x306f('0x2b')]();});}};}function handleEntityNotFound(_0x18ccdc,_0x1502d7){return function(_0x194ed7){if(!_0x194ed7){_0x18ccdc[_0x306f('0x2a')](0x194);}return _0x194ed7;};}function handleError(_0x5c6e34,_0xa1a513){_0xa1a513=_0xa1a513||0x1f4;return function(_0x3fba9d){logger['error'](_0x3fba9d[_0x306f('0x3a')]);if(_0x3fba9d['name']){delete _0x3fba9d[_0x306f('0x3b')];}_0x5c6e34['status'](_0xa1a513)['send'](_0x3fba9d);};}exports[_0x306f('0x3c')]=function(_0x58df42,_0x519f71){var _0x44b8ae={'include':[{'model':db[_0x306f('0x3d')],'as':'mandatoryDispositionPause'}]},_0x49cc61={},_0x40238c={'count':0x0,'rows':[]};var _0x257553=_[_0x306f('0x3e')](db[_0x306f('0x3f')][_0x306f('0x40')],function(_0x45119e){return{'name':_0x45119e[_0x306f('0x41')],'type':_0x45119e['type']['key']};});_0x49cc61[_0x306f('0x42')]=_[_0x306f('0x3e')](_0x257553,'name');_0x49cc61[_0x306f('0x43')]=_[_0x306f('0x44')](_0x58df42['query']);_0x49cc61['filters']=_['intersection'](_0x49cc61[_0x306f('0x42')],_0x49cc61['query']);_0x44b8ae[_0x306f('0x45')]=_[_0x306f('0x46')](_0x49cc61[_0x306f('0x42')],qs[_0x306f('0x47')](_0x58df42[_0x306f('0x43')][_0x306f('0x47')]));_0x44b8ae[_0x306f('0x45')]=_0x44b8ae[_0x306f('0x45')][_0x306f('0x48')]?_0x44b8ae[_0x306f('0x45')]:_0x49cc61['model'];if(!_0x58df42[_0x306f('0x43')][_0x306f('0x49')](_0x306f('0x4a'))){_0x44b8ae[_0x306f('0x2f')]=qs[_0x306f('0x2f')](_0x58df42['query']['limit']);_0x44b8ae['offset']=qs[_0x306f('0x2e')](_0x58df42[_0x306f('0x43')][_0x306f('0x2e')]);}_0x44b8ae[_0x306f('0x4b')]=qs[_0x306f('0x4c')](_0x58df42[_0x306f('0x43')][_0x306f('0x4c')]);_0x44b8ae[_0x306f('0x4d')]=qs['filters'](_[_0x306f('0x4e')](_0x58df42[_0x306f('0x43')],_0x49cc61[_0x306f('0x4f')]),_0x257553);if(_0x58df42[_0x306f('0x43')][_0x306f('0x50')]){_0x44b8ae['where']=_[_0x306f('0x51')](_0x44b8ae[_0x306f('0x4d')],{'$or':_['map'](_0x257553,function(_0x361d7e){if(_0x361d7e['type']!==_0x306f('0x52')){var _0x5a6a59={};_0x5a6a59[_0x361d7e[_0x306f('0x3b')]]={'$like':'%'+_0x58df42['query'][_0x306f('0x50')]+'%'};return _0x5a6a59;}})});}_0x44b8ae=_[_0x306f('0x51')]({},_0x44b8ae,_0x58df42['options']);var _0x46711c={'where':_0x44b8ae['where']};return db[_0x306f('0x3f')]['count'](_0x46711c)[_0x306f('0x1e')](function(_0x4d78ef){_0x40238c[_0x306f('0x30')]=_0x4d78ef;if(_0x58df42[_0x306f('0x43')][_0x306f('0x53')]){_0x44b8ae[_0x306f('0x54')]=[{'all':!![]}];}return db[_0x306f('0x3f')][_0x306f('0x55')](_0x44b8ae);})[_0x306f('0x1e')](function(_0x373fb3){_0x40238c[_0x306f('0x56')]=_0x373fb3;return _0x40238c;})[_0x306f('0x1e')](respondWithFilteredResult(_0x519f71,_0x44b8ae))['catch'](handleError(_0x519f71,null));};exports[_0x306f('0x57')]=function(_0xb1c211,_0x3b8018){var _0x5e92a9={'raw':![],'where':{'id':_0xb1c211['params']['id']},'include':[{'model':db[_0x306f('0x3d')],'as':_0x306f('0x58')}]},_0xcb8b1={};_0xcb8b1[_0x306f('0x42')]=_[_0x306f('0x44')](db[_0x306f('0x3f')]['rawAttributes']);_0xcb8b1['query']=_[_0x306f('0x44')](_0xb1c211[_0x306f('0x43')]);_0xcb8b1[_0x306f('0x4f')]=_['intersection'](_0xcb8b1[_0x306f('0x42')],_0xcb8b1[_0x306f('0x43')]);_0x5e92a9[_0x306f('0x45')]=_['intersection'](_0xcb8b1[_0x306f('0x42')],qs[_0x306f('0x47')](_0xb1c211[_0x306f('0x43')][_0x306f('0x47')]));_0x5e92a9[_0x306f('0x45')]=_0x5e92a9['attributes'][_0x306f('0x48')]?_0x5e92a9[_0x306f('0x45')]:_0xcb8b1[_0x306f('0x42')];if(_0xb1c211['query'][_0x306f('0x53')]){_0x5e92a9[_0x306f('0x54')]=[{'all':!![]}];}_0x5e92a9=_[_0x306f('0x51')]({},_0x5e92a9,_0xb1c211[_0x306f('0x59')]);return db['SmsAccount'][_0x306f('0x5a')](_0x5e92a9)['then'](handleEntityNotFound(_0x3b8018,null))['then'](respondWithResult(_0x3b8018,null))[_0x306f('0x29')](handleError(_0x3b8018,null));};exports['create']=function(_0x4fbf30,_0xc030a){return db[_0x306f('0x3f')]['create'](_0x4fbf30[_0x306f('0x5b')],{})['then'](function(_0x5c17dc){var _0x48109c=_0x4fbf30[_0x306f('0x5c')]['get']({'plain':!![]});if(!_0x48109c)throw new Error(_0x306f('0x5d'));if(_0x48109c[_0x306f('0x5e')]===_0x306f('0x5c')){var _0x3f9f8f=_0x5c17dc[_0x306f('0x38')]({'plain':!![]});var _0x466152=_0x306f('0x39');return db[_0x306f('0x5f')]['find']({'where':{'name':_0x466152,'userProfileId':_0x48109c['userProfileId']},'raw':!![]})[_0x306f('0x1e')](function(_0x1df7ec){if(_0x1df7ec&&_0x1df7ec['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3f9f8f[_0x306f('0x3b')],'resourceId':_0x3f9f8f['id'],'type':_0x1df7ec[_0x306f('0x3b')],'sectionId':_0x1df7ec['id']},{})[_0x306f('0x1e')](function(){return _0x5c17dc;});}else{return _0x5c17dc;}})[_0x306f('0x29')](function(_0x5540e5){logger[_0x306f('0x25')](_0x306f('0x60'),_0x5540e5);throw _0x5540e5;});}return _0x5c17dc;})[_0x306f('0x1e')](respondWithResult(_0xc030a,0xc9))[_0x306f('0x29')](handleError(_0xc030a,null));};exports[_0x306f('0x36')]=function(_0x52408f,_0x3c0704){if(_0x52408f[_0x306f('0x5b')]['id']){delete _0x52408f['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x52408f[_0x306f('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x306f('0x58')}]})[_0x306f('0x1e')](handleEntityNotFound(_0x3c0704,null))['then'](saveUpdates(_0x52408f[_0x306f('0x5b')],null))[_0x306f('0x1e')](respondWithResult(_0x3c0704,null))[_0x306f('0x29')](handleError(_0x3c0704,null));};exports['destroy']=function(_0x21af1a,_0x294279){return db[_0x306f('0x3f')]['find']({'where':{'id':_0x21af1a[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x294279,null))[_0x306f('0x1e')](removeEntity(_0x294279,null))[_0x306f('0x29')](handleError(_0x294279,null));};exports[_0x306f('0x62')]=function(_0x389d73,_0x2541f7){return db[_0x306f('0x3f')]['describe']()['then'](respondWithResult(_0x2541f7,null))[_0x306f('0x29')](handleError(_0x2541f7,null));};exports['addDisposition']=function(_0x970469,_0x4e0bac,_0x48109b){if(_0x970469[_0x306f('0x5b')]['id']){delete _0x970469[_0x306f('0x5b')]['id'];}return db[_0x306f('0x3f')][_0x306f('0x5a')]({'where':{'id':_0x970469['params']['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x4e0bac,null))[_0x306f('0x1e')](function(_0x195c3f){if(_0x195c3f){_0x970469[_0x306f('0x5b')][_0x306f('0x63')]=_0x195c3f['id'];return db[_0x306f('0x64')][_0x306f('0x65')](_0x970469[_0x306f('0x5b')]);}})[_0x306f('0x1e')](respondWithResult(_0x4e0bac,null))[_0x306f('0x29')](handleError(_0x4e0bac,null));};exports[_0x306f('0x66')]=function(_0x3e149d,_0x26f714,_0x5dcb4d){var _0x5ebb7e={'raw':![],'where':{}};var _0x149e25={};var _0x287471={'count':0x0,'rows':[]};return db['SmsAccount'][_0x306f('0x67')]({'where':{'id':_0x3e149d[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x26f714,null))['then'](function(_0x58ec61){if(_0x58ec61){_0x149e25[_0x306f('0x42')]=_['keys'](db[_0x306f('0x64')][_0x306f('0x40')]);_0x149e25[_0x306f('0x43')]=_['keys'](_0x3e149d['query']);_0x149e25[_0x306f('0x4f')]=_[_0x306f('0x46')](_0x149e25[_0x306f('0x42')],_0x149e25[_0x306f('0x43')]);_0x5ebb7e[_0x306f('0x45')]=_[_0x306f('0x46')](_0x149e25[_0x306f('0x42')],qs[_0x306f('0x47')](_0x3e149d[_0x306f('0x43')][_0x306f('0x47')]));_0x5ebb7e['attributes']=_0x5ebb7e['attributes'][_0x306f('0x48')]?_0x5ebb7e[_0x306f('0x45')]:_0x149e25[_0x306f('0x42')];if(!_0x3e149d[_0x306f('0x43')][_0x306f('0x49')]('nolimit')){_0x5ebb7e[_0x306f('0x2f')]=qs[_0x306f('0x2f')](_0x3e149d[_0x306f('0x43')][_0x306f('0x2f')]);_0x5ebb7e['offset']=qs[_0x306f('0x2e')](_0x3e149d[_0x306f('0x43')][_0x306f('0x2e')]);}_0x5ebb7e['order']=qs[_0x306f('0x4c')](_0x3e149d['query'][_0x306f('0x4c')]);_0x5ebb7e[_0x306f('0x4d')]=qs[_0x306f('0x4f')](_['pick'](_0x3e149d['query'],_0x149e25[_0x306f('0x4f')]));_0x5ebb7e[_0x306f('0x4d')][_0x306f('0x63')]=_0x58ec61['id'];if(_0x3e149d[_0x306f('0x43')]['filter']){_0x5ebb7e[_0x306f('0x4d')]=_['merge'](_0x5ebb7e[_0x306f('0x4d')],{'$or':_[_0x306f('0x3e')](_0x5ebb7e['attributes'],function(_0x4d72ac){var _0x1d1737={};_0x1d1737[_0x4d72ac]={'$like':'%'+_0x3e149d[_0x306f('0x43')][_0x306f('0x50')]+'%'};return _0x1d1737;})});}_0x5ebb7e=_[_0x306f('0x51')]({},_0x5ebb7e,_0x3e149d['options']);return db[_0x306f('0x64')][_0x306f('0x30')]({'where':_0x5ebb7e['where']})[_0x306f('0x1e')](function(_0x814e80){_0x287471['count']=_0x814e80;if(_0x3e149d[_0x306f('0x43')][_0x306f('0x53')]){_0x5ebb7e[_0x306f('0x54')]=[{'all':!![]}];}return db[_0x306f('0x64')]['findAll'](_0x5ebb7e);})[_0x306f('0x1e')](function(_0x309e45){_0x287471[_0x306f('0x56')]=_0x309e45;return _0x287471;});}})[_0x306f('0x1e')](respondWithFilteredResult(_0x26f714,_0x5ebb7e))[_0x306f('0x29')](handleError(_0x26f714,null));};exports[_0x306f('0x68')]=function(_0x2676fd,_0x16a122,_0x922c49){return db[_0x306f('0x3f')]['find']({'where':{'id':_0x2676fd[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x16a122,null))['then'](function(_0x29f70e){if(_0x29f70e){return _0x29f70e['removeDispositions'](_0x2676fd[_0x306f('0x43')][_0x306f('0x69')]);}})[_0x306f('0x1e')](respondWithStatusCode(_0x16a122,null))[_0x306f('0x29')](handleError(_0x16a122,null));};exports['addAnswer']=function(_0x462b3e,_0x10e87d,_0x4d9eaf){if(_0x462b3e[_0x306f('0x5b')]['id']){delete _0x462b3e[_0x306f('0x5b')]['id'];}return db[_0x306f('0x3f')][_0x306f('0x5a')]({'where':{'id':_0x462b3e[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x10e87d,null))[_0x306f('0x1e')](function(_0x36681e){if(_0x36681e){_0x462b3e['body']['SmsAccountId']=_0x36681e['id'];return db['CannedAnswer']['create'](_0x462b3e[_0x306f('0x5b')]);}})[_0x306f('0x1e')](respondWithResult(_0x10e87d,null))[_0x306f('0x29')](handleError(_0x10e87d,null));};exports[_0x306f('0x6a')]=function(_0x24a393,_0x4b29a5,_0x53a971){var _0x9383b9={'raw':![],'where':{}};var _0x33201f={};var _0x8fbb7a={'count':0x0,'rows':[]};return db[_0x306f('0x3f')]['findOne']({'where':{'id':_0x24a393[_0x306f('0x61')]['id']}})['then'](handleEntityNotFound(_0x4b29a5,null))[_0x306f('0x1e')](function(_0x10cfba){if(_0x10cfba){_0x33201f[_0x306f('0x42')]=_['keys'](db[_0x306f('0x6b')][_0x306f('0x40')]);_0x33201f['query']=_[_0x306f('0x44')](_0x24a393[_0x306f('0x43')]);_0x33201f[_0x306f('0x4f')]=_[_0x306f('0x46')](_0x33201f[_0x306f('0x42')],_0x33201f[_0x306f('0x43')]);_0x9383b9['attributes']=_[_0x306f('0x46')](_0x33201f['model'],qs['fields'](_0x24a393[_0x306f('0x43')][_0x306f('0x47')]));_0x9383b9[_0x306f('0x45')]=_0x9383b9[_0x306f('0x45')][_0x306f('0x48')]?_0x9383b9[_0x306f('0x45')]:_0x33201f['model'];if(!_0x24a393[_0x306f('0x43')]['hasOwnProperty'](_0x306f('0x4a'))){_0x9383b9[_0x306f('0x2f')]=qs[_0x306f('0x2f')](_0x24a393[_0x306f('0x43')][_0x306f('0x2f')]);_0x9383b9['offset']=qs[_0x306f('0x2e')](_0x24a393['query']['offset']);}_0x9383b9[_0x306f('0x4b')]=qs[_0x306f('0x4c')](_0x24a393['query'][_0x306f('0x4c')]);_0x9383b9[_0x306f('0x4d')]=qs[_0x306f('0x4f')](_[_0x306f('0x4e')](_0x24a393[_0x306f('0x43')],_0x33201f[_0x306f('0x4f')]));_0x9383b9[_0x306f('0x4d')]['SmsAccountId']=_0x10cfba['id'];if(_0x24a393['query'][_0x306f('0x50')]){_0x9383b9['where']=_[_0x306f('0x51')](_0x9383b9[_0x306f('0x4d')],{'$or':_[_0x306f('0x3e')](_0x9383b9['attributes'],function(_0x3324a7){var _0xfb8a60={};_0xfb8a60[_0x3324a7]={'$like':'%'+_0x24a393[_0x306f('0x43')]['filter']+'%'};return _0xfb8a60;})});}_0x9383b9=_['merge']({},_0x9383b9,_0x24a393['options']);return db[_0x306f('0x6b')][_0x306f('0x30')]({'where':_0x9383b9['where']})[_0x306f('0x1e')](function(_0x7c5322){_0x8fbb7a['count']=_0x7c5322;if(_0x24a393[_0x306f('0x43')]['includeAll']){_0x9383b9['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x9383b9);})[_0x306f('0x1e')](function(_0x20fa70){_0x8fbb7a[_0x306f('0x56')]=_0x20fa70;return _0x8fbb7a;});}})[_0x306f('0x1e')](respondWithFilteredResult(_0x4b29a5,_0x9383b9))[_0x306f('0x29')](handleError(_0x4b29a5,null));};exports[_0x306f('0x6c')]=function(_0x512873,_0x181660,_0x2803a6){return db[_0x306f('0x3f')][_0x306f('0x5a')]({'where':{'id':_0x512873[_0x306f('0x61')]['id']}})['then'](handleEntityNotFound(_0x181660,null))[_0x306f('0x1e')](function(_0x4fa29c){if(_0x4fa29c){return _0x4fa29c[_0x306f('0x6c')](_0x512873['query']['ids']);}})[_0x306f('0x1e')](respondWithStatusCode(_0x181660,null))[_0x306f('0x29')](handleError(_0x181660,null));};exports[_0x306f('0x6d')]=function(_0x12c19e,_0x4070c3,_0x4d13f4){var _0x23f593={'channel':'sms'};var _0x3ad759=[];var _0x51093a=[];var _0x54ce9e={};return db[_0x306f('0x3f')][_0x306f('0x5a')]({'where':{'id':_0x12c19e[_0x306f('0x61')]['id']},'include':[{'model':db[_0x306f('0x6e')],'as':_0x306f('0x6f')}]})[_0x306f('0x1e')](handleEntityNotFound(_0x4070c3,null))[_0x306f('0x1e')](function(_0x433741){_0x23f593[_0x306f('0x70')]=_0x433741;_0x23f593[_0x306f('0x71')]=_[_0x306f('0x72')](_0x433741[_0x306f('0x6f')],[_0x306f('0x73')],['asc']);if(_0x23f593[_0x306f('0x70')][_0x306f('0x6f')]){delete _0x23f593[_0x306f('0x70')][_0x306f('0x6f')];}return db['CmContact']['describe']();})[_0x306f('0x1e')](function(_0x35e406){if(!_0x35e406){throw new db[(_0x306f('0x74'))]['ValidationError'](_0x306f('0x75'));}_0x3ad759=_[_0x306f('0x76')](_[_0x306f('0x44')](_0x35e406),['createdAt',_0x306f('0x77')]);_0x51093a=_[_0x306f('0x76')](_[_0x306f('0x44')](_0x35e406),[_0x306f('0x78'),_0x306f('0x77'),'CompanyId','ListId']);_0x23f593[_0x306f('0x5b')]={'mapKey':_0x306f('0x79')};if(_0x23f593['account'][_0x306f('0x7a')]){switch(_0x23f593['account'][_0x306f('0x7a')]){case _0x306f('0x7b'):_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x7d')];_0x23f593['body'][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x7e')];_0x23f593[_0x306f('0x5b')][_0x306f('0x7f')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x80')];break;case _0x306f('0x81'):_0x23f593[_0x306f('0x5b')]['from']='+'+_0x12c19e[_0x306f('0x5b')][_0x306f('0x82')];_0x23f593['body']['body']=_0x12c19e[_0x306f('0x5b')][_0x306f('0x83')];break;case _0x306f('0x84'):_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')]=_0x12c19e['body'][_0x306f('0x7c')];_0x23f593[_0x306f('0x5b')][_0x306f('0x5b')]=_0x12c19e['body'][_0x306f('0x27')];break;case _0x306f('0x85'):_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x7c')];_0x23f593['body'][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x5b')];_0x23f593[_0x306f('0x5b')][_0x306f('0x7f')]=_0x12c19e['body'][_0x306f('0x86')];break;case _0x306f('0x87'):_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')]=_0x12c19e[_0x306f('0x5b')]['From'];_0x23f593[_0x306f('0x5b')][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x88')];_0x23f593[_0x306f('0x5b')][_0x306f('0x7f')]=_0x12c19e['body'][_0x306f('0x89')];break;case _0x306f('0x8a'):_0x23f593['body'][_0x306f('0x7c')]='+'+_0x12c19e[_0x306f('0x5b')][_0x306f('0x8b')][0x0][_0x306f('0x7c')];_0x23f593['body'][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')]['results'][0x0]['text'];_0x23f593[_0x306f('0x5b')][_0x306f('0x7f')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x8b')][0x0][_0x306f('0x7f')];break;case'csc':_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x8c')];_0x23f593['body']['body']=_0x12c19e['body'][_0x306f('0x8d')]['message'];break;case _0x306f('0x8e'):_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')]=_0x12c19e['body'][_0x306f('0x8f')];_0x23f593[_0x306f('0x5b')][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x83')];_0x23f593[_0x306f('0x5b')]['messageId']=_0x12c19e[_0x306f('0x5b')][_0x306f('0x90')];break;case _0x306f('0x91'):_0x23f593['body'][_0x306f('0x7f')]=_0x12c19e[_0x306f('0x5b')][0x0][_0x306f('0x27')]['id'];_0x23f593[_0x306f('0x5b')]['from']=_0x12c19e[_0x306f('0x5b')][0x0][_0x306f('0x27')][_0x306f('0x7c')];_0x23f593['body'][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')][0x0][_0x306f('0x27')]['text'];break;case _0x306f('0x92'):_0x23f593[_0x306f('0x5b')]['from']=_0x12c19e[_0x306f('0x5b')][_0x306f('0x7c')];_0x23f593['body'][_0x306f('0x5b')]=_0x12c19e[_0x306f('0x5b')][_0x306f('0x27')];_0x23f593[_0x306f('0x5b')][_0x306f('0x7f')]=_0x12c19e['body'][_0x306f('0x93')];break;}}if(_0x23f593[_0x306f('0x5b')]['id']){delete _0x23f593[_0x306f('0x5b')]['id'];}if(_[_0x306f('0x94')](_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')])){throw new db[(_0x306f('0x74'))]['ValidationError'](_0x306f('0x95'));}if(_[_0x306f('0x94')](_0x23f593['body'][_0x306f('0x5b')])||_0x23f593['body'][_0x306f('0x5b')]===''){throw new db[(_0x306f('0x74'))]['ValidationError'](_0x306f('0x96'));}if(_[_0x306f('0x94')](_0x23f593[_0x306f('0x5b')][_0x306f('0x97')])){throw new db[(_0x306f('0x74'))]['ValidationError'](_0x306f('0x98')+_0x51093a);}if(!_[_0x306f('0x99')](_0x51093a,_0x23f593[_0x306f('0x5b')][_0x306f('0x97')])){throw new db[(_0x306f('0x74'))][(_0x306f('0x9a'))](_0x306f('0x9b')+_0x51093a);}_0x54ce9e[_0x23f593[_0x306f('0x5b')]['mapKey']]=_0x23f593['body'][_0x306f('0x7c')];return db[_0x306f('0x9c')][_0x306f('0x5a')]({'where':{'id':_0x23f593[_0x306f('0x70')]['ListId']},'include':[{'model':db[_0x306f('0x9d')],'as':_0x306f('0x9e'),'where':_0x54ce9e,'limit':0x1,'order':[[_0x306f('0x77'),_0x306f('0x9f')]]}]});})[_0x306f('0x1e')](handleEntityNotFound(_0x4070c3,null))[_0x306f('0x1e')](function(_0x400aa6){if(_0x400aa6){_0x23f593[_0x306f('0xa0')]=_[_0x306f('0xa1')](_0x400aa6,['Contacts']);if(_0x400aa6['Contacts']['length']){return _0x400aa6['Contacts'][0x0];}var _0x26600f=_['defaults'](_0x23f593[_0x306f('0x5b')],{'firstName':_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')],'ListId':_0x400aa6['id']});_0x26600f[_0x23f593[_0x306f('0x5b')]['mapKey']]=_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')];return db[_0x306f('0x9d')][_0x306f('0x65')](_0x26600f,{'fields':_0x3ad759,'raw':!![]});}})[_0x306f('0x1e')](handleEntityNotFound(_0x4070c3,null))['then'](function(_0x431a52){if(_0x431a52){_0x23f593['contact']=_0x431a52;var _0x1a67da={'ContactId':_0x431a52['id'],'phone':_0x23f593[_0x306f('0x5b')][_0x306f('0x7c')],'SmsAccountId':_0x12c19e['params']['id']};var _0x4e6cfe={'ContactId':_0x431a52['id'],'SmsAccountId':_0x12c19e[_0x306f('0x61')]['id'],'closed':![]};return db[_0x306f('0xa2')][_0x306f('0x5a')]({'where':_0x4e6cfe})[_0x306f('0x1e')](function(_0x3f565a){if(_0x3f565a){return[_0x3f565a,![]];}return db[_0x306f('0xa2')][_0x306f('0x65')](_0x1a67da)['then'](function(_0x245aec){return[_0x245aec,!![]];});});}})[_0x306f('0xa3')](function(_0x5d03d5,_0xa408c7){_0x23f593['interaction']=_0x5d03d5[_0x306f('0x38')]({'plain':!![]});_0x23f593[_0x306f('0xa4')][_0x306f('0xa5')]=![];if(_0xa408c7){if(_0x23f593['account']['autoclose']){_0x23f593['applications'][_0x306f('0xa6')]({'id':0x0,'priority':_0x23f593[_0x306f('0x71')]['length']+0x1,'app':_0x306f('0xa7'),'appdata':'unmanaged','interval':_0x306f('0xa8')});}_0x23f593['interaction']['created']=!![];}return db[_0x306f('0xa9')][_0x306f('0x65')]({'phone':_0x23f593['body'][_0x306f('0x7c')],'messageId':_0x23f593[_0x306f('0x5b')][_0x306f('0x7f')],'body':_0x23f593[_0x306f('0x5b')][_0x306f('0x5b')],'SmsAccountId':_0x12c19e[_0x306f('0x61')]['id'],'SmsInteractionId':_0x5d03d5['id'],'direction':'in','ContactId':_0x5d03d5[_0x306f('0xaa')],'AttachmentId':_0x23f593[_0x306f('0x5b')][_0x306f('0xab')]});})['then'](function(_0x2c6000){_0x23f593[_0x306f('0x27')]=_0x2c6000;if(_0x23f593[_0x306f('0xa4')]['UserId']){return db['User'][_0x306f('0x5a')]({'attributes':['id',_0x306f('0x3b')],'where':{'id':_0x23f593[_0x306f('0xa4')][_0x306f('0xac')]}})[_0x306f('0x1e')](function(_0x15e69d){if(_0x15e69d){_0x23f593[_0x306f('0x71')]['unshift']({'id':0x0,'priority':0x0,'app':_0x306f('0xad'),'appdata':_0x15e69d[_0x306f('0x3b')]+','+(_0x23f593[_0x306f('0x70')][_0x306f('0xae')]||0xa),'interval':_0x306f('0xa8')});}return respondWithRpcPromise(_0x306f('0xaf'),'startRouting',_0x23f593);});}return respondWithRpcPromise(_0x306f('0xaf'),_0x306f('0xb0'),_0x23f593);})[_0x306f('0x1e')](function(_0x3ce15b){if(_0x3ce15b){var _0x4be58d=0xc8;var _0x21f1fc=_0x306f('0xb1');logger[_0x306f('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x21f1fc,_0x4be58d,_0x306f('0xb2'));logger['debug'](_0x306f('0xb3'),_0x21f1fc,_0x4be58d,_0x306f('0xb2'),JSON['stringify'](_0x3ce15b));if(_0x23f593[_0x306f('0x70')][_0x306f('0x7a')]==='twilio'){return _0x4070c3[_0x306f('0x2c')](_0x4be58d)[_0x306f('0x31')](_0x306f('0xb4'),_0x306f('0xb5'))['send'](_0x306f('0xb6'));}else{return _0x4070c3[_0x306f('0x2c')](_0x4be58d)[_0x306f('0x2d')](_0x3ce15b);}}})[_0x306f('0x29')](handleError(_0x4070c3,null));};exports[_0x306f('0xb7')]=function(_0x1ab859,_0x1b00c1){var _0x9d1db5=_0x1ab859['params']['id'];var _0x10a17d=_0x1ab859['body'];var _0x129e1b=0xc8;var _0x2818e0=null;return db[_0x306f('0xb8')][_0x306f('0xb9')]({'isolationLevel':db['sequelize']['Transaction'][_0x306f('0xba')][_0x306f('0xbb')]},function(_0xaf0c1f){return db[_0x306f('0x3f')][_0x306f('0x67')]({'where':{'id':_0x9d1db5},'transaction':_0xaf0c1f})[_0x306f('0x1e')](function(_0x35a468){if(_0x35a468){return db[_0x306f('0x6e')][_0x306f('0x37')]({'where':{'SmsAccountId':_0x9d1db5},'transaction':_0xaf0c1f})[_0x306f('0x1e')](function(){var _0x29bfd9=_[_0x306f('0x3e')](_0x10a17d,function(_0xaac3ac){_0xaac3ac['SmsAccountId']=_0x9d1db5;return _0xaac3ac;});return db[_0x306f('0x6e')][_0x306f('0xbc')](_0x29bfd9,{'transaction':_0xaf0c1f});});}else{_0x129e1b=0x194;_0x2818e0=[];}});})[_0x306f('0x1e')](function(){if(_0x129e1b!==0x194){return db['SmsApplication'][_0x306f('0xbd')]({'where':{'SmsAccountId':_0x9d1db5},'order':_0x306f('0x73')})[_0x306f('0x1e')](function(_0x2b5d48){_0x2818e0=_0x2b5d48;});}})[_0x306f('0x29')](function(_0x2a3c41){_0x129e1b=0x1f4;logger[_0x306f('0x25')](_0x2a3c41[_0x306f('0x3a')]);if(_0x2a3c41['name']){delete _0x2a3c41[_0x306f('0x3b')];}_0x2818e0=_0x2a3c41;})[_0x306f('0xbe')](function(){if(_0x2818e0===null){_0x1b00c1['sendStatus'](_0x129e1b);}else{if(_0x129e1b===0x1f4){_0x1b00c1['status'](_0x129e1b)[_0x306f('0xbf')](_0x2818e0);}else{_0x1b00c1[_0x306f('0x2c')](_0x129e1b)[_0x306f('0x2d')](_0x2818e0);}}});};exports[_0x306f('0xc0')]=function(_0x259d9f,_0x99f7bd,_0x5d08a8){var _0x49b9a7={};var _0x439658={};var _0x11547b;var _0x39a845;return db[_0x306f('0x3f')]['findOne']({'where':{'id':_0x259d9f[_0x306f('0x61')]['id']}})['then'](handleEntityNotFound(_0x99f7bd,null))[_0x306f('0x1e')](function(_0xb300de){if(_0xb300de){_0x11547b=_0xb300de;_0x439658['model']=_[_0x306f('0x44')](db[_0x306f('0x6e')][_0x306f('0x40')]);_0x439658['query']=_[_0x306f('0x44')](_0x259d9f[_0x306f('0x43')]);_0x439658['filters']=_[_0x306f('0x46')](_0x439658[_0x306f('0x42')],_0x439658[_0x306f('0x43')]);_0x49b9a7['attributes']=_[_0x306f('0x46')](_0x439658[_0x306f('0x42')],qs[_0x306f('0x47')](_0x259d9f[_0x306f('0x43')][_0x306f('0x47')]));_0x49b9a7[_0x306f('0x45')]=_0x49b9a7[_0x306f('0x45')]['length']?_0x49b9a7['attributes']:_0x439658[_0x306f('0x42')];_0x49b9a7['order']=qs['sort'](_0x259d9f[_0x306f('0x43')][_0x306f('0x4c')]);_0x49b9a7[_0x306f('0x4d')]=qs[_0x306f('0x4f')](_[_0x306f('0x4e')](_0x259d9f[_0x306f('0x43')],_0x439658['filters']));if(_0x259d9f[_0x306f('0x43')][_0x306f('0x50')]){_0x49b9a7[_0x306f('0x4d')]=_[_0x306f('0x51')](_0x49b9a7['where'],{'$or':_[_0x306f('0x3e')](_0x49b9a7[_0x306f('0x45')],function(_0x4c04b3){var _0x4f6e11={};_0x4f6e11[_0x4c04b3]={'$like':'%'+_0x259d9f[_0x306f('0x43')][_0x306f('0x50')]+'%'};return _0x4f6e11;})});}_0x49b9a7=_[_0x306f('0x51')]({},_0x49b9a7,_0x259d9f['options']);return _0x11547b[_0x306f('0xc0')](_0x49b9a7);}})[_0x306f('0x1e')](function(_0x58337b){if(_0x58337b){_0x39a845=_0x58337b[_0x306f('0x48')];if(!_0x259d9f[_0x306f('0x43')][_0x306f('0x49')](_0x306f('0x4a'))){_0x49b9a7[_0x306f('0x2f')]=qs[_0x306f('0x2f')](_0x259d9f[_0x306f('0x43')][_0x306f('0x2f')]);_0x49b9a7[_0x306f('0x2e')]=qs['offset'](_0x259d9f['query'][_0x306f('0x2e')]);}return _0x11547b[_0x306f('0xc0')](_0x49b9a7);}})['then'](function(_0x38c7bd){if(_0x38c7bd){return _0x38c7bd?{'count':_0x39a845,'rows':_0x38c7bd}:null;}})[_0x306f('0x1e')](respondWithResult(_0x99f7bd,null))['catch'](handleError(_0x99f7bd,null));};exports[_0x306f('0xc1')]=function(_0xd4c2a8,_0x20098b,_0x44e45f){var _0x34160b={'raw':![],'where':{}};var _0x1597fa={};var _0x4f36cc={'count':0x0,'rows':[]};return db[_0x306f('0x3f')][_0x306f('0x67')]({'where':{'id':_0xd4c2a8[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x20098b,null))[_0x306f('0x1e')](function(_0x5b20ea){if(_0x5b20ea){_0x1597fa['model']=_[_0x306f('0x44')](db[_0x306f('0xa2')][_0x306f('0x40')]);_0x1597fa['query']=_[_0x306f('0x44')](_0xd4c2a8[_0x306f('0x43')]);_0x1597fa[_0x306f('0x4f')]=_[_0x306f('0x46')](_0x1597fa['model'],_0x1597fa[_0x306f('0x43')]);_0x34160b['attributes']=_[_0x306f('0x46')](_0x1597fa['model'],qs[_0x306f('0x47')](_0xd4c2a8[_0x306f('0x43')]['fields']));_0x34160b[_0x306f('0x45')]=_0x34160b[_0x306f('0x45')][_0x306f('0x48')]?_0x34160b['attributes']:_0x1597fa[_0x306f('0x42')];if(!_0xd4c2a8[_0x306f('0x43')][_0x306f('0x49')](_0x306f('0x4a'))){_0x34160b[_0x306f('0x2f')]=qs['limit'](_0xd4c2a8[_0x306f('0x43')][_0x306f('0x2f')]);_0x34160b[_0x306f('0x2e')]=qs[_0x306f('0x2e')](_0xd4c2a8['query']['offset']);}_0x34160b[_0x306f('0x4b')]=qs[_0x306f('0x4c')](_0xd4c2a8[_0x306f('0x43')][_0x306f('0x4c')]);_0x34160b['where']=qs[_0x306f('0x4f')](_[_0x306f('0x4e')](_0xd4c2a8[_0x306f('0x43')],_0x1597fa[_0x306f('0x4f')]));_0x34160b[_0x306f('0x4d')][_0x306f('0x63')]=_0x5b20ea['id'];if(_0xd4c2a8['query'][_0x306f('0x50')]){_0x34160b[_0x306f('0x4d')]=_[_0x306f('0x51')](_0x34160b[_0x306f('0x4d')],{'$or':_[_0x306f('0x3e')](_0x34160b[_0x306f('0x45')],function(_0x653df){var _0x16be31={};_0x16be31[_0x653df]={'$like':'%'+_0xd4c2a8['query'][_0x306f('0x50')]+'%'};return _0x16be31;})});}_0x34160b=_['merge']({},_0x34160b,_0xd4c2a8[_0x306f('0x59')]);return db['SmsInteraction'][_0x306f('0x30')]({'where':_0x34160b[_0x306f('0x4d')]})[_0x306f('0x1e')](function(_0x38354f){_0x4f36cc[_0x306f('0x30')]=_0x38354f;if(_0xd4c2a8['query'][_0x306f('0x53')]){_0x34160b['include']=[{'model':db[_0x306f('0x9d')],'as':'Contact','required':![]},{'model':db[_0x306f('0xc2')],'as':_0x306f('0xc3'),'attributes':[_0x306f('0x3b'),_0x306f('0xc4'),_0x306f('0xc5')],'required':![]},{'model':db[_0x306f('0xc6')],'as':_0x306f('0xc7'),'attributes':['id',_0x306f('0x3b'),_0x306f('0xc8')],'where':_0xd4c2a8[_0x306f('0x43')][_0x306f('0xc9')]?{'id':_0xd4c2a8[_0x306f('0x43')][_0x306f('0xc9')]}:undefined,'required':_0xd4c2a8[_0x306f('0x43')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x306f('0x55')](_0x34160b);})[_0x306f('0x1e')](function(_0x1c3e37){_0x4f36cc[_0x306f('0x56')]=_0x1c3e37;return _0x4f36cc;});}})[_0x306f('0x1e')](respondWithFilteredResult(_0x20098b,_0x34160b))['catch'](handleError(_0x20098b,null));};exports[_0x306f('0xbf')]=function(_0x531932,_0x5b746d,_0x3f2327){var _0x164322,_0x4fcea5,_0x251606;if(_[_0x306f('0x94')](_0x531932['body'][_0x306f('0x5b')])||_0x531932[_0x306f('0x5b')][_0x306f('0x5b')]===''){throw new db[(_0x306f('0x74'))][(_0x306f('0x9a'))](_0x306f('0x96'));}if(_[_0x306f('0x94')](_0x531932['body']['to'])){throw new db[(_0x306f('0x74'))][(_0x306f('0x9a'))](_0x306f('0xca'));}_0x164322=_0x531932[_0x306f('0x5b')]['to'];return db['SmsAccount'][_0x306f('0x5a')]({'where':{'id':_0x531932[_0x306f('0x61')]['id']},'include':[{'model':db[_0x306f('0x9c')],'as':_0x306f('0xcb'),'include':[{'model':db[_0x306f('0x9d')],'as':_0x306f('0x9e'),'where':{'mobile':_0x164322},'limit':0x1,'order':[['updatedAt',_0x306f('0x9f')]]}]}]})[_0x306f('0x1e')](handleEntityNotFound(_0x5b746d,null))[_0x306f('0x1e')](function(_0x52e7dd){if(_0x52e7dd&&_0x52e7dd[_0x306f('0xcb')]){_0x4fcea5=_0x52e7dd[_0x306f('0x38')]({'plain':!![]});if(_0x4fcea5[_0x306f('0xcb')]&&_0x4fcea5[_0x306f('0xcb')][_0x306f('0x9e')][_0x306f('0x48')]){return _0x4fcea5[_0x306f('0xcb')]['Contacts'][0x0];}return db['CmContact']['create'](_['defaults'](_0x531932['body'],{'firstName':_0x164322,'mobile':_0x164322,'phone':_0x164322,'ListId':_0x4fcea5[_0x306f('0xcc')]}));}})[_0x306f('0x1e')](handleEntityNotFound(_0x5b746d,null))[_0x306f('0x1e')](function(_0x2bc7a1){if(_0x2bc7a1){_0x251606=_0x2bc7a1;return db['SmsInteraction'][_0x306f('0x5a')]({'where':{'ContactId':_0x251606['id'],'closed':![],'SmsAccountId':_0x4fcea5['id']}})['then'](function(_0x2f0602){if(_0x2f0602){return[_0x2f0602,![]];}return db[_0x306f('0xa2')][_0x306f('0x65')]({'UserId':_0x531932[_0x306f('0x5c')]['id'],'ContactId':_0x251606['id'],'SmsAccountId':_0x4fcea5['id'],'phone':_0x164322,'firstMsgDirection':_0x306f('0xcd'),'Messages':[_[_0x306f('0x51')](_0x531932['body'],{'read':![],'body':_0x531932[_0x306f('0x5b')][_0x306f('0x5b')],'phone':_0x164322,'SmsAccountId':_0x4fcea5['id'],'UserId':_0x531932['user']['id'],'ContactId':_0x251606['id']})]},{'include':[{'model':db[_0x306f('0xa9')],'as':_0x306f('0xce')}]})[_0x306f('0x1e')](function(_0x54bd99){return[_0x54bd99,!![]];});});}})['spread'](function(_0x333791,_0x59f821){if(_0x59f821){return _0x333791;}return db['SmsMessage']['create'](_[_0x306f('0x51')](_0x531932[_0x306f('0x5b')],{'read':![],'body':_0x531932[_0x306f('0x5b')][_0x306f('0x5b')],'phone':_0x164322,'SmsAccountId':_0x4fcea5['id'],'SmsInteractionId':_0x333791['id'],'UserId':_0x531932[_0x306f('0x5c')]['id'],'ContactId':_0x251606['id']}))[_0x306f('0x1e')](function(_0x3b9570){_0x333791['dataValues']['Messages']=[];_0x333791[_0x306f('0xcf')]['Messages'][_0x306f('0xa6')](_0x3b9570['dataValues']);return _0x333791;});})[_0x306f('0x1e')](respondWithResult(_0x5b746d,null))[_0x306f('0x29')](handleError(_0x5b746d,null));};exports['status']=function(_0xda000b,_0x351a7d,_0x24eaff){if(_0xda000b[_0x306f('0x5b')]['id']){delete _0xda000b[_0x306f('0x5b')]['id'];}var _0xd46447,_0x180eee,_0x300a97;return db[_0x306f('0x3f')]['find']({'where':{'id':_0xda000b[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x351a7d,null))['then'](function(_0x3dc4b3){if(_0x3dc4b3){_0x300a97=_0x3dc4b3;logger['debug'](_0x306f('0x23'),_0x306f('0x2c'),_0x306f('0xd0'),_0x3dc4b3[_0x306f('0x7a')],util[_0x306f('0xd1')](_0xda000b['body'],{'showHidden':![],'depth':null}));switch(_0x3dc4b3[_0x306f('0x7a')]){case _0x306f('0x81'):if(_0xda000b[_0x306f('0x5b')][_0x306f('0xd2')]&&_0xda000b[_0x306f('0x5b')][_0x306f('0x2c')]){_0x180eee=_0xda000b[_0x306f('0x5b')][_0x306f('0x2c')];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0xda000b[_0x306f('0x5b')][_0x306f('0xd2')]}});}break;case _0x306f('0x84'):if(_0xda000b[_0x306f('0x5b')][_0x306f('0xd3')]&&_0xda000b[_0x306f('0x5b')]['statusInt']){_0x180eee=_0xda000b['body']['statusInt'];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0xda000b[_0x306f('0x5b')]['requestid']}});}break;case'clicksend':if(_0xda000b[_0x306f('0x5b')]['message_id']&&_0xda000b[_0x306f('0x5b')][_0x306f('0xd4')]){_0x180eee=_0xda000b[_0x306f('0x5b')]['status_code'];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0xda000b['body'][_0x306f('0x86')]}});}break;case _0x306f('0x8a'):var _0x5a61a1=_0xda000b[_0x306f('0x5b')][_0x306f('0x8b')][0x0];if(_0x5a61a1[_0x306f('0x7f')]&&_0x5a61a1[_0x306f('0x2c')]['groupName']==='DELIVERED'){_0x180eee=_0x5a61a1[_0x306f('0x2c')][_0x306f('0xd5')];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0x5a61a1[_0x306f('0x7f')]}});}break;case _0x306f('0x8e'):if(_0xda000b[_0x306f('0x5b')]['messageId']&&_0xda000b[_0x306f('0x5b')][_0x306f('0x2c')]){_0x180eee=_0xda000b[_0x306f('0x5b')][_0x306f('0x2c')];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0xda000b[_0x306f('0x5b')]['messageId']}});}break;case _0x306f('0x91'):if(_0xda000b[_0x306f('0x5b')][0x0]['message']['id']){_0x180eee=_0xda000b[_0x306f('0x5b')][0x0][_0x306f('0x7a')];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0xda000b[_0x306f('0x5b')][0x0][_0x306f('0x27')]['id']}});}break;case'intelepeer':if(_0xda000b[_0x306f('0x5b')]['redif']&&_0xda000b[_0x306f('0x5b')][_0x306f('0x2c')]){_0x180eee=_0xda000b[_0x306f('0x5b')][_0x306f('0x2c')];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0xda000b[_0x306f('0x5b')]['redif']}});}break;}}})[_0x306f('0x1e')](handleEntityNotFound(_0x351a7d,null))['then'](function(_0x2782c2){if(_0x2782c2){_0xd46447=_0x2782c2;switch(_0x300a97[_0x306f('0x7a')]){case'skebby':if(_0x180eee===_0x306f('0xd6')){return _0xd46447['update']({'read':!![]});}else{logger[_0x306f('0x25')](_0x306f('0x23'),_0x306f('0x2c'),_0x306f('0x81'),util[_0x306f('0xd1')](_0xda000b['body'],{'showHidden':![],'depth':null}));}break;case _0x306f('0x84'):if(_0x180eee==='1'){return _0xd46447[_0x306f('0x36')]({'read':!![]});}else{logger['error'](_0x306f('0x23'),'status',_0x306f('0x81'),util[_0x306f('0xd1')](_0xda000b['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xda000b[_0x306f('0x5b')][_0x306f('0xd7')]&&_0x180eee>=0xc8&&_0x180eee<=0xce){return _0xd46447[_0x306f('0x36')]({'read':!![]});}else{logger[_0x306f('0x25')](_0x306f('0x23'),_0x306f('0x2c'),_0x306f('0x85'),util['inspect'](_0xda000b[_0x306f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x306f('0x8a'):var _0xf87e99=_0xda000b[_0x306f('0x5b')][_0x306f('0x8b')][0x0];if(_0xf87e99['status']['groupName']===_0x306f('0xd6')){return _0xd46447['update']({'read':!![]});}else{logger['error'](_0x306f('0x23'),_0x306f('0x2c'),'infobip',util[_0x306f('0xd1')](_0xda000b[_0x306f('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x180eee==_0x306f('0xd8')||_0x180eee==_0x306f('0xd9')){return _0xd46447['update']({'read':!![]});}else{logger['error'](_0x306f('0x23'),_0x306f('0x2c'),_0x306f('0x8e'),util[_0x306f('0xd1')](_0xda000b[_0x306f('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x306f('0x91'):if(_0x180eee==_0x306f('0xda')){return _0xd46447[_0x306f('0x36')]({'read':!![]});}else{logger[_0x306f('0x25')](_0x306f('0x23'),_0x306f('0x2c'),_0x306f('0x91'),util[_0x306f('0xd1')](_0xda000b['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x180eee===_0x306f('0xdb')||_0x180eee===_0x306f('0xdc')){return _0xd46447[_0x306f('0x36')]({'read':!![]});}else{logger[_0x306f('0x25')](_0x306f('0x23'),_0x306f('0x2c'),'intelepeer',util['inspect'](_0xda000b[_0x306f('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0xd46447;}})[_0x306f('0x1e')](respondWithResult(_0x351a7d,null))[_0x306f('0x29')](handleError(_0x351a7d,null));};exports[_0x306f('0xdd')]=function(_0x2efbd0,_0x28f506,_0x39d087){var _0x31e293,_0x17654e,_0x4879b3;return db['SmsAccount'][_0x306f('0x5a')]({'where':{'id':_0x2efbd0['params']['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x28f506,null))['then'](function(_0x3f377a){if(_0x3f377a){_0x4879b3=_0x3f377a;logger[_0x306f('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x306f('0x2c'),'received\x20delivery\x20report\x20from',_0x3f377a[_0x306f('0x7a')],util[_0x306f('0xd1')](_0x2efbd0[_0x306f('0x43')],{'showHidden':![],'depth':null}));switch(_0x3f377a[_0x306f('0x7a')]){case _0x306f('0xde'):if(_0x2efbd0[_0x306f('0x43')][_0x306f('0xdf')]&&_0x2efbd0[_0x306f('0x43')][_0x306f('0xe0')]){_0x17654e=_0x2efbd0[_0x306f('0x43')][_0x306f('0xe0')];return db[_0x306f('0xa9')][_0x306f('0x5a')]({'where':{'messageId':_0x2efbd0[_0x306f('0x43')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x28f506,null))[_0x306f('0x1e')](function(_0x417b58){if(_0x417b58){_0x31e293=_0x417b58;switch(_0x4879b3[_0x306f('0x7a')]){case'csc':if(_0x17654e==='2'||_0x17654e==='6'){return _0x31e293[_0x306f('0x36')]({'read':!![]});}else{logger[_0x306f('0x25')](_0x306f('0x23'),_0x306f('0x2c'),_0x306f('0xde'),util[_0x306f('0xd1')](_0x2efbd0[_0x306f('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x31e293;}})['then'](respondWithResult(_0x28f506,null))[_0x306f('0x29')](handleError(_0x28f506,null));};exports['addAgents']=function(_0x46d66f,_0x1cd3d5,_0x4c45de){return db[_0x306f('0x3f')][_0x306f('0x5a')]({'where':{'id':_0x46d66f[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x1cd3d5,null))[_0x306f('0x1e')](function(_0x521583){if(_0x521583){return _0x521583['addAgents'](_0x46d66f[_0x306f('0x5b')][_0x306f('0x69')],_[_0x306f('0xa1')](_0x46d66f[_0x306f('0x5b')],[_0x306f('0x69'),'id'])||{})[_0x306f('0xa3')](function(_0x251268){for(var _0x51d79e=0x0;_0x51d79e<_0x46d66f[_0x306f('0x5b')][_0x306f('0x69')][_0x306f('0x48')];_0x51d79e+=0x1){socket[_0x306f('0xe1')](_0x306f('0xe2'),{'UserId':Number(_0x46d66f[_0x306f('0x5b')]['ids'][_0x51d79e]),'SmsAccountId':Number(_0x46d66f[_0x306f('0x61')]['id'])});}return _0x251268;});}})[_0x306f('0x1e')](respondWithResult(_0x1cd3d5,null))[_0x306f('0x29')](handleError(_0x1cd3d5,null));};exports[_0x306f('0xe3')]=function(_0x4ba2c6,_0x3d9363,_0x6ac718){return db[_0x306f('0x3f')]['find']({'where':{'id':_0x4ba2c6[_0x306f('0x61')]['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x3d9363,null))[_0x306f('0x1e')](function(_0x55a44b){if(_0x55a44b){return _0x55a44b['removeAgents'](_0x4ba2c6['query'][_0x306f('0x69')])[_0x306f('0x1e')](function(){if(_[_0x306f('0xe4')](_0x4ba2c6['query'][_0x306f('0x69')])){for(var _0x1c0424=0x0;_0x1c0424<_0x4ba2c6['query'][_0x306f('0x69')]['length'];_0x1c0424+=0x1){socket[_0x306f('0xe1')](_0x306f('0xe5'),{'UserId':Number(_0x4ba2c6[_0x306f('0x43')][_0x306f('0x69')][_0x1c0424]),'SmsAccountId':Number(_0x4ba2c6[_0x306f('0x61')]['id'])});}}else{socket['emit'](_0x306f('0xe5'),{'UserId':Number(_0x4ba2c6[_0x306f('0x43')][_0x306f('0x69')]),'SmsAccountId':Number(_0x4ba2c6[_0x306f('0x61')]['id'])});}});}})[_0x306f('0x1e')](respondWithStatusCode(_0x3d9363,null))[_0x306f('0x29')](handleError(_0x3d9363,null));};exports[_0x306f('0xe6')]=function(_0x2ef47e,_0x19b433,_0x3bb6ed){var _0xa0001={};var _0x16a421={};var _0x2e5ca4;var _0x1ab66f;return db[_0x306f('0x3f')][_0x306f('0x67')]({'where':{'id':_0x2ef47e['params']['id']}})[_0x306f('0x1e')](handleEntityNotFound(_0x19b433,null))[_0x306f('0x1e')](function(_0x4a30c5){if(_0x4a30c5){_0x2e5ca4=_0x4a30c5;_0x16a421['model']=_[_0x306f('0x44')](db[_0x306f('0xc2')]['rawAttributes']);_0x16a421['query']=_[_0x306f('0x44')](_0x2ef47e[_0x306f('0x43')]);_0x16a421[_0x306f('0x4f')]=_[_0x306f('0x46')](_0x16a421[_0x306f('0x42')],_0x16a421[_0x306f('0x43')]);_0xa0001[_0x306f('0x45')]=_[_0x306f('0x46')](_0x16a421[_0x306f('0x42')],qs['fields'](_0x2ef47e[_0x306f('0x43')][_0x306f('0x47')]));_0xa0001[_0x306f('0x45')]=_0xa0001[_0x306f('0x45')][_0x306f('0x48')]?_0xa0001['attributes']:_0x16a421[_0x306f('0x42')];_0xa0001[_0x306f('0x4b')]=qs[_0x306f('0x4c')](_0x2ef47e['query']['sort']);_0xa0001[_0x306f('0x4d')]=qs[_0x306f('0x4f')](_['pick'](_0x2ef47e['query'],_0x16a421[_0x306f('0x4f')]));if(_0x2ef47e[_0x306f('0x43')]['filter']){_0xa0001[_0x306f('0x4d')]=_[_0x306f('0x51')](_0xa0001[_0x306f('0x4d')],{'$or':_[_0x306f('0x3e')](_0xa0001['attributes'],function(_0x1c8b9a){var _0x14cefb={};_0x14cefb[_0x1c8b9a]={'$like':'%'+_0x2ef47e[_0x306f('0x43')][_0x306f('0x50')]+'%'};return _0x14cefb;})});}_0xa0001=_[_0x306f('0x51')]({},_0xa0001,_0x2ef47e['options']);return _0x2e5ca4['getAgents'](_0xa0001);}})[_0x306f('0x1e')](function(_0x43f9b5){if(_0x43f9b5){_0x1ab66f=_0x43f9b5[_0x306f('0x48')];if(!_0x2ef47e[_0x306f('0x43')][_0x306f('0x49')]('nolimit')){_0xa0001[_0x306f('0x2f')]=qs[_0x306f('0x2f')](_0x2ef47e[_0x306f('0x43')][_0x306f('0x2f')]);_0xa0001[_0x306f('0x2e')]=qs[_0x306f('0x2e')](_0x2ef47e[_0x306f('0x43')][_0x306f('0x2e')]);}return _0x2e5ca4[_0x306f('0xe6')](_0xa0001);}})[_0x306f('0x1e')](function(_0x2f7870){if(_0x2f7870){return _0x2f7870?{'count':_0x1ab66f,'rows':_0x2f7870}:null;}})['then'](respondWithResult(_0x19b433,null))[_0x306f('0x29')](handleError(_0x19b433,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3866e7a..6b10677 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 _0x8c3f=['SmsAccount','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x53f47e,_0x5d6357){var _0x51d9c5=function(_0x2ce6d8){while(--_0x2ce6d8){_0x53f47e['push'](_0x53f47e['shift']());}};_0x51d9c5(++_0x5d6357);}(_0x8c3f,0x130));var _0xf8c3=function(_0x95c628,_0x2982c6){_0x95c628=_0x95c628-0x0;var _0x744c0b=_0x8c3f[_0x95c628];return _0x744c0b;};'use strict';var EventEmitter=require(_0xf8c3('0x0'));var SmsAccount=require(_0xf8c3('0x1'))['db'][_0xf8c3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8c3('0x3'),'afterUpdate':_0xf8c3('0x4'),'afterDestroy':_0xf8c3('0x5')};function emitEvent(_0x412fc2){return function(_0x2ad6ab,_0x437103,_0x5df09b){SmsAccountEvents[_0xf8c3('0x6')](_0x412fc2+':'+_0x2ad6ab['id'],_0x2ad6ab);SmsAccountEvents[_0xf8c3('0x6')](_0x412fc2,_0x2ad6ab);_0x5df09b(null);};}for(var e in events){if(events[_0xf8c3('0x7')](e)){var event=events[e];SmsAccount[_0xf8c3('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x3e04=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x3e04,0x19e));var _0x43e0=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x3e04[_0x9aada2];return _0x196dff;};'use strict';var EventEmitter=require(_0x43e0('0x0'));var SmsAccount=require(_0x43e0('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x43e0('0x2')](0x0);var events={'afterCreate':_0x43e0('0x3'),'afterUpdate':_0x43e0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52da6c){return function(_0x5cdbb4,_0x442b4b,_0x4bcbc9){SmsAccountEvents[_0x43e0('0x5')](_0x52da6c+':'+_0x5cdbb4['id'],_0x5cdbb4);SmsAccountEvents[_0x43e0('0x5')](_0x52da6c,_0x5cdbb4);_0x4bcbc9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x43e0('0x6')](e,emitEvent(event));}}module[_0x43e0('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 06ee978..3cb246d 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 _0x52b6=['util','../../config/logger','moment','bluebird','request-promise','path','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x52b6,0xef));var _0x652b=function(_0x21799b,_0x4694af){_0x21799b=_0x21799b-0x0;var _0x317530=_0x52b6[_0x21799b];return _0x317530;};'use strict';var _=require(_0x652b('0x0'));var util=require(_0x652b('0x1'));var logger=require(_0x652b('0x2'))('api');var moment=require(_0x652b('0x3'));var BPromise=require(_0x652b('0x4'));var rp=require(_0x652b('0x5'));var fs=require('fs');var path=require(_0x652b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x652b('0x7'));module[_0x652b('0x8')]=function(_0x5e91b3,_0x5a3ac1){return _0x5e91b3[_0x652b('0x9')](_0x652b('0xa'),attributes,{'tableName':_0x652b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa92b=['util','../../config/logger','bluebird','request-promise','path','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash'];(function(_0x435162,_0x5a3ca0){var _0x557ed6=function(_0x1b791e){while(--_0x1b791e){_0x435162['push'](_0x435162['shift']());}};_0x557ed6(++_0x5a3ca0);}(_0xa92b,0x95));var _0xba92=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0xa92b[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0xba92('0x0'));var util=require(_0xba92('0x1'));var logger=require(_0xba92('0x2'))('api');var moment=require('moment');var BPromise=require(_0xba92('0x3'));var rp=require(_0xba92('0x4'));var fs=require('fs');var path=require(_0xba92('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba92('0x6'));module[_0xba92('0x7')]=function(_0x15642d,_0x3bd88c){return _0x15642d['define'](_0xba92('0x8'),attributes,{'tableName':_0xba92('0x9'),'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 3529c64..9aa725b 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 _0xe535=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','catch','lodash','util'];(function(_0x582d5d,_0x244b01){var _0x4d6811=function(_0x399667){while(--_0x399667){_0x582d5d['push'](_0x582d5d['shift']());}};_0x4d6811(++_0x244b01);}(_0xe535,0x136));var _0x5e53=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xe535[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x5e53('0x0'));var util=require(_0x5e53('0x1'));var moment=require(_0x5e53('0x2'));var BPromise=require(_0x5e53('0x3'));var rs=require(_0x5e53('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e53('0x5'));var logger=require(_0x5e53('0x6'))(_0x5e53('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e53('0x8'));var client=jayson[_0x5e53('0x9')][_0x5e53('0xa')]({'port':0x232a});config[_0x5e53('0xb')]=_[_0x5e53('0xc')](config[_0x5e53('0xb')],{'host':_0x5e53('0xd'),'port':0x18eb});var socket=require(_0x5e53('0xe'))(new Redis(config[_0x5e53('0xb')]));require(_0x5e53('0xf'))[_0x5e53('0x10')](socket);function respondWithRpcPromise(_0x1aaec3,_0x57f7cd,_0x41aede){return new BPromise(function(_0x5cefe5,_0xbebc60){return client[_0x5e53('0x11')](_0x1aaec3,_0x41aede)[_0x5e53('0x12')](function(_0xc2e527){logger[_0x5e53('0x13')](_0x5e53('0x14'),_0x57f7cd,_0x5e53('0x15'));logger[_0x5e53('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57f7cd,_0x5e53('0x15'),JSON[_0x5e53('0x17')](_0xc2e527));if(_0xc2e527[_0x5e53('0x18')]){if(_0xc2e527[_0x5e53('0x18')][_0x5e53('0x19')]===0x1f4){logger[_0x5e53('0x18')]('SmsAccount,\x20%s,\x20%s',_0x57f7cd,_0xc2e527['error']['message']);return _0xbebc60(_0xc2e527[_0x5e53('0x18')][_0x5e53('0x1a')]);}logger[_0x5e53('0x18')]('SmsAccount,\x20%s,\x20%s',_0x57f7cd,_0xc2e527[_0x5e53('0x18')][_0x5e53('0x1a')]);return _0x5cefe5(_0xc2e527['error'][_0x5e53('0x1a')]);}else{logger[_0x5e53('0x13')]('SmsAccount,\x20%s,\x20%s',_0x57f7cd,_0x5e53('0x15'));_0x5cefe5(_0xc2e527[_0x5e53('0x1b')][_0x5e53('0x1a')]);}})['catch'](function(_0x549d2f){logger[_0x5e53('0x18')](_0x5e53('0x14'),_0x57f7cd,_0x549d2f);_0xbebc60(_0x549d2f);});});}exports[_0x5e53('0x1c')]=function(_0x46eba1){var _0x4dc887=this;return new Promise(function(_0x566716,_0x1ccc31){return db[_0x5e53('0x1d')][_0x5e53('0x1e')]({'raw':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1[_0x5e53('0x1f')][_0x5e53('0x20')]===undefined?!![]:![]:!![],'where':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1['options'][_0x5e53('0x21')]||null:null,'attributes':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1[_0x5e53('0x1f')]['attributes']||null:null,'include':_0x46eba1[_0x5e53('0x1f')]?_0x46eba1[_0x5e53('0x1f')][_0x5e53('0x22')]?_[_0x5e53('0x23')](_0x46eba1[_0x5e53('0x1f')]['include'],function(_0x190ca8){return{'model':db[_0x190ca8[_0x5e53('0x24')]],'as':_0x190ca8['as'],'attributes':_0x190ca8['attributes'],'include':_0x190ca8['include']?_[_0x5e53('0x23')](_0x190ca8[_0x5e53('0x22')],function(_0x4d8bef){return{'model':db[_0x4d8bef[_0x5e53('0x24')]],'as':_0x4d8bef['as'],'attributes':_0x4d8bef[_0x5e53('0x25')],'include':_0x4d8bef[_0x5e53('0x22')]?_[_0x5e53('0x23')](_0x4d8bef[_0x5e53('0x22')],function(_0x5ddc78){return{'model':db[_0x5ddc78[_0x5e53('0x24')]],'as':_0x5ddc78['as'],'attributes':_0x5ddc78[_0x5e53('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e886f){logger[_0x5e53('0x13')](_0x5e53('0x1c'),_0x46eba1);logger[_0x5e53('0x16')](_0x5e53('0x1c'),_0x46eba1,JSON[_0x5e53('0x17')](_0x4e886f));_0x566716(_0x4e886f);})[_0x5e53('0x26')](function(_0x22eaff){logger['error'](_0x5e53('0x1c'),_0x22eaff[_0x5e53('0x1a')],_0x46eba1);_0x1ccc31(_0x4dc887[_0x5e53('0x18')](0x1f4,_0x22eaff[_0x5e53('0x1a')]));});});}; \ No newline at end of file +var _0x4322=['message','result','ShowSmsAccount','SmsAccount','find','options','attributes','include','model','map','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s'];(function(_0x55c603,_0x5dd6ca){var _0x525d68=function(_0x413e40){while(--_0x413e40){_0x55c603['push'](_0x55c603['shift']());}};_0x525d68(++_0x5dd6ca);}(_0x4322,0x198));var _0x2432=function(_0x1185d5,_0x11f04f){_0x1185d5=_0x1185d5-0x0;var _0x110006=_0x4322[_0x1185d5];return _0x110006;};'use strict';var _=require('lodash');var util=require(_0x2432('0x0'));var moment=require(_0x2432('0x1'));var BPromise=require(_0x2432('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2432('0x3'));var db=require(_0x2432('0x4'))['db'];var utils=require(_0x2432('0x5'));var logger=require('../../config/logger')(_0x2432('0x6'));var config=require(_0x2432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2432('0x8')][_0x2432('0x9')]({'port':0x232a});config['redis']=_[_0x2432('0xa')](config[_0x2432('0xb')],{'host':_0x2432('0xc'),'port':0x18eb});var socket=require(_0x2432('0xd'))(new Redis(config[_0x2432('0xb')]));require(_0x2432('0xe'))['register'](socket);function respondWithRpcPromise(_0x500b3c,_0x5edbc5,_0x84d340){return new BPromise(function(_0x374c25,_0x2ed7f2){return client[_0x2432('0xf')](_0x500b3c,_0x84d340)[_0x2432('0x10')](function(_0x1b95f6){logger[_0x2432('0x11')]('SmsAccount,\x20%s,\x20%s',_0x5edbc5,_0x2432('0x12'));logger[_0x2432('0x13')](_0x2432('0x14'),_0x5edbc5,_0x2432('0x12'),JSON['stringify'](_0x1b95f6));if(_0x1b95f6[_0x2432('0x15')]){if(_0x1b95f6[_0x2432('0x15')][_0x2432('0x16')]===0x1f4){logger[_0x2432('0x15')](_0x2432('0x17'),_0x5edbc5,_0x1b95f6[_0x2432('0x15')][_0x2432('0x18')]);return _0x2ed7f2(_0x1b95f6['error'][_0x2432('0x18')]);}logger['error'](_0x2432('0x17'),_0x5edbc5,_0x1b95f6['error']['message']);return _0x374c25(_0x1b95f6['error'][_0x2432('0x18')]);}else{logger[_0x2432('0x11')](_0x2432('0x17'),_0x5edbc5,_0x2432('0x12'));_0x374c25(_0x1b95f6[_0x2432('0x19')][_0x2432('0x18')]);}})['catch'](function(_0x31a87b){logger[_0x2432('0x15')](_0x2432('0x17'),_0x5edbc5,_0x31a87b);_0x2ed7f2(_0x31a87b);});});}exports[_0x2432('0x1a')]=function(_0x4153a8){var _0x5e7e7d=this;return new Promise(function(_0x10abae,_0x3bf19f){return db[_0x2432('0x1b')][_0x2432('0x1c')]({'raw':_0x4153a8[_0x2432('0x1d')]?_0x4153a8['options']['raw']===undefined?!![]:![]:!![],'where':_0x4153a8[_0x2432('0x1d')]?_0x4153a8[_0x2432('0x1d')]['where']||null:null,'attributes':_0x4153a8['options']?_0x4153a8[_0x2432('0x1d')][_0x2432('0x1e')]||null:null,'include':_0x4153a8[_0x2432('0x1d')]?_0x4153a8[_0x2432('0x1d')][_0x2432('0x1f')]?_['map'](_0x4153a8[_0x2432('0x1d')][_0x2432('0x1f')],function(_0x3d16ac){return{'model':db[_0x3d16ac[_0x2432('0x20')]],'as':_0x3d16ac['as'],'attributes':_0x3d16ac[_0x2432('0x1e')],'include':_0x3d16ac['include']?_[_0x2432('0x21')](_0x3d16ac[_0x2432('0x1f')],function(_0x365fcb){return{'model':db[_0x365fcb['model']],'as':_0x365fcb['as'],'attributes':_0x365fcb[_0x2432('0x1e')],'include':_0x365fcb[_0x2432('0x1f')]?_['map'](_0x365fcb['include'],function(_0x49b8f4){return{'model':db[_0x49b8f4[_0x2432('0x20')]],'as':_0x49b8f4['as'],'attributes':_0x49b8f4[_0x2432('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55a0a2){logger[_0x2432('0x11')](_0x2432('0x1a'),_0x4153a8);logger[_0x2432('0x13')](_0x2432('0x1a'),_0x4153a8,JSON[_0x2432('0x22')](_0x55a0a2));_0x10abae(_0x55a0a2);})[_0x2432('0x23')](function(_0x481333){logger[_0x2432('0x15')](_0x2432('0x1a'),_0x481333['message'],_0x4153a8);_0x3bf19f(_0x5e7e7d[_0x2432('0x15')](0x1f4,_0x481333[_0x2432('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 866abf1..fbdd5e4 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 15f71a5..06cd458 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x278392,_0x2f2662){var _0x525961=function(_0x4a34a3){while(--_0x4a34a3){_0x278392['push'](_0x278392['shift']());}};_0x525961(++_0x2f2662);}(_0xedd9,0xfc));var _0x9edd=function(_0x340f5f,_0x2cd7ab){_0x340f5f=_0x340f5f-0x0;var _0x2b1219=_0xedd9[_0x340f5f];return _0x2b1219;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x176f0d,_0x28d379){var _0x444789=function(_0x48f64a){while(--_0x48f64a){_0x176f0d['push'](_0x176f0d['shift']());}};_0x444789(++_0x28d379);}(_0xedd9,0xfc));var _0x9edd=function(_0x5785a0,_0x4a5e9d){_0x5785a0=_0x5785a0-0x0;var _0x5d120c=_0xedd9[_0x5785a0];return _0x5d120c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6272890..0d7e5fc 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 _0xc0ac=['STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xc0ac,0x66));var _0xcc0a=function(_0x34ffc3,_0x234484){_0x34ffc3=_0x34ffc3-0x0;var _0x1725f3=_0xc0ac[_0x34ffc3];return _0x1725f3;};'use strict';var Sequelize=require(_0xcc0a('0x0'));module[_0xcc0a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc0a('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcc0a('0x3')]},'interval':{'type':Sequelize[_0xcc0a('0x3')],'defaultValue':_0xcc0a('0x4')}}; \ No newline at end of file +var _0x3622=['*,*,*,*','STRING','noop'];(function(_0x499217,_0x400dd5){var _0x5e3c53=function(_0xe8344c){while(--_0xe8344c){_0x499217['push'](_0x499217['shift']());}};_0x5e3c53(++_0x400dd5);}(_0x3622,0x70));var _0x2362=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x3622[_0x365e54];return _0x13317a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2362('0x0')],'allowNull':![],'defaultValue':_0x2362('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2362('0x0')]},'interval':{'type':Sequelize[_0x2362('0x0')],'defaultValue':_0x2362('0x2')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index bbbc73a..e5215b2 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 _0xab2d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','keys','intersection','attributes','query','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf6bb7d,_0x8af4f5){var _0x132764=function(_0x4f6309){while(--_0x4f6309){_0xf6bb7d['push'](_0xf6bb7d['shift']());}};_0x132764(++_0x8af4f5);}(_0xab2d,0x119));var _0xdab2=function(_0x1f19da,_0xa9bcad){_0x1f19da=_0x1f19da-0x0;var _0x41515b=_0xab2d[_0x1f19da];return _0x41515b;};'use strict';var emlformat=require(_0xdab2('0x0'));var rimraf=require(_0xdab2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdab2('0x2'));var rp=require(_0xdab2('0x3'));var moment=require(_0xdab2('0x4'));var BPromise=require(_0xdab2('0x5'));var Mustache=require(_0xdab2('0x6'));var util=require(_0xdab2('0x7'));var path=require(_0xdab2('0x8'));var sox=require(_0xdab2('0x9'));var csv=require(_0xdab2('0xa'));var ejs=require(_0xdab2('0xb'));var fs=require('fs');var fs_extra=require(_0xdab2('0xc'));var _=require(_0xdab2('0xd'));var squel=require(_0xdab2('0xe'));var crypto=require(_0xdab2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdab2('0x10'));var toCsv=require(_0xdab2('0xa'));var querystring=require('querystring');var Papa=require(_0xdab2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdab2('0x12'));var hardwareService=require(_0xdab2('0x13'));var logger=require(_0xdab2('0x14'))(_0xdab2('0x15'));var utils=require(_0xdab2('0x16'));var config=require(_0xdab2('0x17'));var licenseUtil=require(_0xdab2('0x18'));var db=require(_0xdab2('0x19'))['db'];function respondWithStatusCode(_0x2eaf40,_0x41feba){_0x41feba=_0x41feba||0xcc;return function(_0x18779f){if(_0x18779f){return _0x2eaf40[_0xdab2('0x1a')](_0x41feba);}return _0x2eaf40[_0xdab2('0x1b')](_0x41feba)[_0xdab2('0x1c')]();};}function respondWithResult(_0x1a646d,_0x2f7c08){_0x2f7c08=_0x2f7c08||0xc8;return function(_0x4d59aa){if(_0x4d59aa){return _0x1a646d[_0xdab2('0x1b')](_0x2f7c08)['json'](_0x4d59aa);}};}function respondWithFilteredResult(_0x59d602,_0x166908){return function(_0x3135fd){if(_0x3135fd){var _0xb28f97=typeof _0x166908[_0xdab2('0x1d')]===_0xdab2('0x1e')&&typeof _0x166908[_0xdab2('0x1f')]===_0xdab2('0x1e');var _0x4b05b9=_0x3135fd[_0xdab2('0x20')];var _0x416d38=_0xb28f97?0x0:_0x166908[_0xdab2('0x1d')];var _0x34ee9d=_0xb28f97?_0x3135fd[_0xdab2('0x20')]:_0x166908['offset']+_0x166908['limit'];var _0x337a6e;if(_0x34ee9d>=_0x4b05b9){_0x34ee9d=_0x4b05b9;_0x337a6e=0xc8;}else{_0x337a6e=0xce;}_0x59d602['status'](_0x337a6e);return _0x59d602['set'](_0xdab2('0x21'),_0x416d38+'-'+_0x34ee9d+'/'+_0x4b05b9)['json'](_0x3135fd);}return null;};}function patchUpdates(_0x5c0551){return function(_0x7545fd){try{jsonpatch['apply'](_0x7545fd,_0x5c0551,!![]);}catch(_0x4cb212){return BPromise[_0xdab2('0x22')](_0x4cb212);}return _0x7545fd[_0xdab2('0x23')]();};}function saveUpdates(_0x571751,_0x5ccca5){return function(_0x40bd53){if(_0x40bd53){return _0x40bd53[_0xdab2('0x24')](_0x571751)['then'](function(_0x3b45be){return _0x3b45be;});}return null;};}function removeEntity(_0x4dded7,_0x4bd85b){return function(_0x4b08a3){if(_0x4b08a3){return _0x4b08a3[_0xdab2('0x25')]()['then'](function(){_0x4dded7['status'](0xcc)[_0xdab2('0x1c')]();});}};}function handleEntityNotFound(_0x293855,_0x19fb5a){return function(_0x470907){if(!_0x470907){_0x293855[_0xdab2('0x1a')](0x194);}return _0x470907;};}function handleError(_0x271535,_0x1939a8){_0x1939a8=_0x1939a8||0x1f4;return function(_0x2f5ace){logger[_0xdab2('0x26')](_0x2f5ace[_0xdab2('0x27')]);if(_0x2f5ace[_0xdab2('0x28')]){delete _0x2f5ace[_0xdab2('0x28')];}_0x271535['status'](_0x1939a8)[_0xdab2('0x29')](_0x2f5ace);};}exports['index']=function(_0x357bce,_0xfa4ed2){var _0x7d6eca={},_0xa7974d={},_0x2e9283={'count':0x0,'rows':[]};var _0x1ac4eb=_[_0xdab2('0x2a')](db[_0xdab2('0x2b')][_0xdab2('0x2c')],function(_0x5e7953){return{'name':_0x5e7953['fieldName'],'type':_0x5e7953[_0xdab2('0x2d')][_0xdab2('0x2e')]};});_0xa7974d[_0xdab2('0x2f')]=_[_0xdab2('0x2a')](_0x1ac4eb,_0xdab2('0x28'));_0xa7974d['query']=_[_0xdab2('0x30')](_0x357bce['query']);_0xa7974d['filters']=_[_0xdab2('0x31')](_0xa7974d[_0xdab2('0x2f')],_0xa7974d['query']);_0x7d6eca[_0xdab2('0x32')]=_[_0xdab2('0x31')](_0xa7974d[_0xdab2('0x2f')],qs['fields'](_0x357bce[_0xdab2('0x33')][_0xdab2('0x34')]));_0x7d6eca['attributes']=_0x7d6eca[_0xdab2('0x32')]['length']?_0x7d6eca[_0xdab2('0x32')]:_0xa7974d[_0xdab2('0x2f')];if(!_0x357bce[_0xdab2('0x33')][_0xdab2('0x35')](_0xdab2('0x36'))){_0x7d6eca[_0xdab2('0x1f')]=qs[_0xdab2('0x1f')](_0x357bce[_0xdab2('0x33')][_0xdab2('0x1f')]);_0x7d6eca[_0xdab2('0x1d')]=qs[_0xdab2('0x1d')](_0x357bce[_0xdab2('0x33')]['offset']);}_0x7d6eca[_0xdab2('0x37')]=qs[_0xdab2('0x38')](_0x357bce['query']['sort']);_0x7d6eca['where']=qs['filters'](_[_0xdab2('0x39')](_0x357bce['query'],_0xa7974d['filters']),_0x1ac4eb);if(_0x357bce[_0xdab2('0x33')][_0xdab2('0x3a')]){_0x7d6eca[_0xdab2('0x3b')]=_[_0xdab2('0x3c')](_0x7d6eca[_0xdab2('0x3b')],{'$or':_[_0xdab2('0x2a')](_0x1ac4eb,function(_0x40560b){if(_0x40560b[_0xdab2('0x2d')]!==_0xdab2('0x3d')){var _0x259e1c={};_0x259e1c[_0x40560b[_0xdab2('0x28')]]={'$like':'%'+_0x357bce[_0xdab2('0x33')][_0xdab2('0x3a')]+'%'};return _0x259e1c;}})});}_0x7d6eca=_[_0xdab2('0x3c')]({},_0x7d6eca,_0x357bce[_0xdab2('0x3e')]);var _0x3b32b0={'where':_0x7d6eca[_0xdab2('0x3b')]};return db[_0xdab2('0x2b')][_0xdab2('0x20')](_0x3b32b0)[_0xdab2('0x3f')](function(_0x4c1751){_0x2e9283[_0xdab2('0x20')]=_0x4c1751;if(_0x357bce[_0xdab2('0x33')][_0xdab2('0x40')]){_0x7d6eca[_0xdab2('0x41')]=[{'all':!![]}];}return db[_0xdab2('0x2b')][_0xdab2('0x42')](_0x7d6eca);})[_0xdab2('0x3f')](function(_0xa655a4){_0x2e9283[_0xdab2('0x43')]=_0xa655a4;return _0x2e9283;})['then'](respondWithFilteredResult(_0xfa4ed2,_0x7d6eca))[_0xdab2('0x44')](handleError(_0xfa4ed2,null));};exports[_0xdab2('0x45')]=function(_0x3be724,_0x13fc0a){var _0x651eeb={'raw':!![],'where':{'id':_0x3be724[_0xdab2('0x46')]['id']}},_0x55d6a7={};_0x55d6a7[_0xdab2('0x2f')]=_['keys'](db[_0xdab2('0x2b')][_0xdab2('0x2c')]);_0x55d6a7['query']=_['keys'](_0x3be724[_0xdab2('0x33')]);_0x55d6a7[_0xdab2('0x47')]=_[_0xdab2('0x31')](_0x55d6a7[_0xdab2('0x2f')],_0x55d6a7[_0xdab2('0x33')]);_0x651eeb[_0xdab2('0x32')]=_[_0xdab2('0x31')](_0x55d6a7['model'],qs['fields'](_0x3be724[_0xdab2('0x33')][_0xdab2('0x34')]));_0x651eeb[_0xdab2('0x32')]=_0x651eeb['attributes'][_0xdab2('0x48')]?_0x651eeb[_0xdab2('0x32')]:_0x55d6a7[_0xdab2('0x2f')];if(_0x3be724[_0xdab2('0x33')][_0xdab2('0x40')]){_0x651eeb['include']=[{'all':!![]}];}_0x651eeb=_[_0xdab2('0x3c')]({},_0x651eeb,_0x3be724[_0xdab2('0x3e')]);return db[_0xdab2('0x2b')][_0xdab2('0x49')](_0x651eeb)[_0xdab2('0x3f')](handleEntityNotFound(_0x13fc0a,null))['then'](respondWithResult(_0x13fc0a,null))['catch'](handleError(_0x13fc0a,null));};exports[_0xdab2('0x4a')]=function(_0x562065,_0x1df946){return db['SmsApplication'][_0xdab2('0x4a')](_0x562065[_0xdab2('0x4b')],{})[_0xdab2('0x3f')](respondWithResult(_0x1df946,0xc9))[_0xdab2('0x44')](handleError(_0x1df946,null));};exports[_0xdab2('0x24')]=function(_0x384d78,_0x42cdde){if(_0x384d78[_0xdab2('0x4b')]['id']){delete _0x384d78[_0xdab2('0x4b')]['id'];}return db[_0xdab2('0x2b')][_0xdab2('0x49')]({'where':{'id':_0x384d78[_0xdab2('0x46')]['id']}})[_0xdab2('0x3f')](handleEntityNotFound(_0x42cdde,null))['then'](saveUpdates(_0x384d78['body'],null))['then'](respondWithResult(_0x42cdde,null))[_0xdab2('0x44')](handleError(_0x42cdde,null));};exports[_0xdab2('0x25')]=function(_0xb2be34,_0x9c416c){return db[_0xdab2('0x2b')][_0xdab2('0x49')]({'where':{'id':_0xb2be34[_0xdab2('0x46')]['id']}})[_0xdab2('0x3f')](handleEntityNotFound(_0x9c416c,null))[_0xdab2('0x3f')](removeEntity(_0x9c416c,null))[_0xdab2('0x44')](handleError(_0x9c416c,null));}; \ No newline at end of file +var _0xbe5c=['pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SmsApplication','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe5c,0xe8));var _0xcbe5=function(_0x1bd49b,_0x139307){_0x1bd49b=_0x1bd49b-0x0;var _0xdc3b5d=_0xbe5c[_0x1bd49b];return _0xdc3b5d;};'use strict';var emlformat=require(_0xcbe5('0x0'));var rimraf=require(_0xcbe5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbe5('0x2'));var rp=require('request-promise');var moment=require(_0xcbe5('0x3'));var BPromise=require(_0xcbe5('0x4'));var Mustache=require(_0xcbe5('0x5'));var util=require(_0xcbe5('0x6'));var path=require(_0xcbe5('0x7'));var sox=require(_0xcbe5('0x8'));var csv=require(_0xcbe5('0x9'));var ejs=require(_0xcbe5('0xa'));var fs=require('fs');var fs_extra=require(_0xcbe5('0xb'));var _=require(_0xcbe5('0xc'));var squel=require(_0xcbe5('0xd'));var crypto=require(_0xcbe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcbe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcbe5('0x10'));var Papa=require(_0xcbe5('0x11'));var Redis=require('ioredis');var authService=require(_0xcbe5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcbe5('0x13'));var hardwareService=require(_0xcbe5('0x14'));var logger=require('../../config/logger')(_0xcbe5('0x15'));var utils=require('../../config/utils');var config=require(_0xcbe5('0x16'));var licenseUtil=require(_0xcbe5('0x17'));var db=require(_0xcbe5('0x18'))['db'];function respondWithStatusCode(_0x29338f,_0xe236c4){_0xe236c4=_0xe236c4||0xcc;return function(_0x4e6157){if(_0x4e6157){return _0x29338f[_0xcbe5('0x19')](_0xe236c4);}return _0x29338f[_0xcbe5('0x1a')](_0xe236c4)[_0xcbe5('0x1b')]();};}function respondWithResult(_0x408963,_0x5a986e){_0x5a986e=_0x5a986e||0xc8;return function(_0x269de6){if(_0x269de6){return _0x408963[_0xcbe5('0x1a')](_0x5a986e)[_0xcbe5('0x1c')](_0x269de6);}};}function respondWithFilteredResult(_0x4ef00d,_0x1da9aa){return function(_0x5207eb){if(_0x5207eb){var _0x1d6430=typeof _0x1da9aa['offset']==='undefined'&&typeof _0x1da9aa['limit']===_0xcbe5('0x1d');var _0x264a45=_0x5207eb[_0xcbe5('0x1e')];var _0x3e19bc=_0x1d6430?0x0:_0x1da9aa['offset'];var _0x1410c6=_0x1d6430?_0x5207eb[_0xcbe5('0x1e')]:_0x1da9aa['offset']+_0x1da9aa[_0xcbe5('0x1f')];var _0x30ef52;if(_0x1410c6>=_0x264a45){_0x1410c6=_0x264a45;_0x30ef52=0xc8;}else{_0x30ef52=0xce;}_0x4ef00d[_0xcbe5('0x1a')](_0x30ef52);return _0x4ef00d['set'](_0xcbe5('0x20'),_0x3e19bc+'-'+_0x1410c6+'/'+_0x264a45)[_0xcbe5('0x1c')](_0x5207eb);}return null;};}function patchUpdates(_0x25c098){return function(_0x4951ef){try{jsonpatch['apply'](_0x4951ef,_0x25c098,!![]);}catch(_0x388366){return BPromise[_0xcbe5('0x21')](_0x388366);}return _0x4951ef[_0xcbe5('0x22')]();};}function saveUpdates(_0x1c791b,_0x3dd89b){return function(_0x2271f9){if(_0x2271f9){return _0x2271f9[_0xcbe5('0x23')](_0x1c791b)[_0xcbe5('0x24')](function(_0x4cbb43){return _0x4cbb43;});}return null;};}function removeEntity(_0xa5c54d,_0x5c17fa){return function(_0x2287ff){if(_0x2287ff){return _0x2287ff[_0xcbe5('0x25')]()['then'](function(){_0xa5c54d[_0xcbe5('0x1a')](0xcc)[_0xcbe5('0x1b')]();});}};}function handleEntityNotFound(_0x1f9f11,_0x54bcb7){return function(_0x5be376){if(!_0x5be376){_0x1f9f11[_0xcbe5('0x19')](0x194);}return _0x5be376;};}function handleError(_0x1673c3,_0x500e1c){_0x500e1c=_0x500e1c||0x1f4;return function(_0x128a05){logger[_0xcbe5('0x26')](_0x128a05['stack']);if(_0x128a05[_0xcbe5('0x27')]){delete _0x128a05['name'];}_0x1673c3[_0xcbe5('0x1a')](_0x500e1c)[_0xcbe5('0x28')](_0x128a05);};}exports[_0xcbe5('0x29')]=function(_0x2ea5cf,_0x5d580f){var _0x3af891={},_0x41fd90={},_0x285aa6={'count':0x0,'rows':[]};var _0x1d530f=_[_0xcbe5('0x2a')](db[_0xcbe5('0x2b')]['rawAttributes'],function(_0x26677d){return{'name':_0x26677d[_0xcbe5('0x2c')],'type':_0x26677d[_0xcbe5('0x2d')][_0xcbe5('0x2e')]};});_0x41fd90[_0xcbe5('0x2f')]=_['map'](_0x1d530f,'name');_0x41fd90['query']=_[_0xcbe5('0x30')](_0x2ea5cf[_0xcbe5('0x31')]);_0x41fd90[_0xcbe5('0x32')]=_['intersection'](_0x41fd90[_0xcbe5('0x2f')],_0x41fd90[_0xcbe5('0x31')]);_0x3af891[_0xcbe5('0x33')]=_[_0xcbe5('0x34')](_0x41fd90[_0xcbe5('0x2f')],qs[_0xcbe5('0x35')](_0x2ea5cf[_0xcbe5('0x31')][_0xcbe5('0x35')]));_0x3af891[_0xcbe5('0x33')]=_0x3af891[_0xcbe5('0x33')][_0xcbe5('0x36')]?_0x3af891[_0xcbe5('0x33')]:_0x41fd90['model'];if(!_0x2ea5cf[_0xcbe5('0x31')][_0xcbe5('0x37')](_0xcbe5('0x38'))){_0x3af891[_0xcbe5('0x1f')]=qs[_0xcbe5('0x1f')](_0x2ea5cf[_0xcbe5('0x31')][_0xcbe5('0x1f')]);_0x3af891[_0xcbe5('0x39')]=qs['offset'](_0x2ea5cf['query']['offset']);}_0x3af891['order']=qs[_0xcbe5('0x3a')](_0x2ea5cf[_0xcbe5('0x31')]['sort']);_0x3af891[_0xcbe5('0x3b')]=qs[_0xcbe5('0x32')](_[_0xcbe5('0x3c')](_0x2ea5cf['query'],_0x41fd90[_0xcbe5('0x32')]),_0x1d530f);if(_0x2ea5cf[_0xcbe5('0x31')][_0xcbe5('0x3d')]){_0x3af891['where']=_[_0xcbe5('0x3e')](_0x3af891[_0xcbe5('0x3b')],{'$or':_[_0xcbe5('0x2a')](_0x1d530f,function(_0x4fdf11){if(_0x4fdf11[_0xcbe5('0x2d')]!==_0xcbe5('0x3f')){var _0x20eb64={};_0x20eb64[_0x4fdf11[_0xcbe5('0x27')]]={'$like':'%'+_0x2ea5cf[_0xcbe5('0x31')][_0xcbe5('0x3d')]+'%'};return _0x20eb64;}})});}_0x3af891=_[_0xcbe5('0x3e')]({},_0x3af891,_0x2ea5cf[_0xcbe5('0x40')]);var _0x176932={'where':_0x3af891[_0xcbe5('0x3b')]};return db[_0xcbe5('0x2b')][_0xcbe5('0x1e')](_0x176932)[_0xcbe5('0x24')](function(_0x2087b4){_0x285aa6[_0xcbe5('0x1e')]=_0x2087b4;if(_0x2ea5cf['query'][_0xcbe5('0x41')]){_0x3af891[_0xcbe5('0x42')]=[{'all':!![]}];}return db[_0xcbe5('0x2b')]['findAll'](_0x3af891);})['then'](function(_0x5831e3){_0x285aa6[_0xcbe5('0x43')]=_0x5831e3;return _0x285aa6;})[_0xcbe5('0x24')](respondWithFilteredResult(_0x5d580f,_0x3af891))['catch'](handleError(_0x5d580f,null));};exports[_0xcbe5('0x44')]=function(_0x490b1a,_0x13e727){var _0x4262eb={'raw':!![],'where':{'id':_0x490b1a[_0xcbe5('0x45')]['id']}},_0x2763cc={};_0x2763cc[_0xcbe5('0x2f')]=_[_0xcbe5('0x30')](db[_0xcbe5('0x2b')]['rawAttributes']);_0x2763cc['query']=_[_0xcbe5('0x30')](_0x490b1a[_0xcbe5('0x31')]);_0x2763cc[_0xcbe5('0x32')]=_[_0xcbe5('0x34')](_0x2763cc[_0xcbe5('0x2f')],_0x2763cc['query']);_0x4262eb['attributes']=_['intersection'](_0x2763cc[_0xcbe5('0x2f')],qs[_0xcbe5('0x35')](_0x490b1a[_0xcbe5('0x31')][_0xcbe5('0x35')]));_0x4262eb[_0xcbe5('0x33')]=_0x4262eb[_0xcbe5('0x33')][_0xcbe5('0x36')]?_0x4262eb['attributes']:_0x2763cc['model'];if(_0x490b1a[_0xcbe5('0x31')][_0xcbe5('0x41')]){_0x4262eb[_0xcbe5('0x42')]=[{'all':!![]}];}_0x4262eb=_[_0xcbe5('0x3e')]({},_0x4262eb,_0x490b1a[_0xcbe5('0x40')]);return db['SmsApplication'][_0xcbe5('0x46')](_0x4262eb)[_0xcbe5('0x24')](handleEntityNotFound(_0x13e727,null))[_0xcbe5('0x24')](respondWithResult(_0x13e727,null))[_0xcbe5('0x47')](handleError(_0x13e727,null));};exports['create']=function(_0x471040,_0x56ac2f){return db[_0xcbe5('0x2b')]['create'](_0x471040[_0xcbe5('0x48')],{})[_0xcbe5('0x24')](respondWithResult(_0x56ac2f,0xc9))[_0xcbe5('0x47')](handleError(_0x56ac2f,null));};exports['update']=function(_0x21d7de,_0x4cb9b0){if(_0x21d7de[_0xcbe5('0x48')]['id']){delete _0x21d7de['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x21d7de[_0xcbe5('0x45')]['id']}})[_0xcbe5('0x24')](handleEntityNotFound(_0x4cb9b0,null))[_0xcbe5('0x24')](saveUpdates(_0x21d7de[_0xcbe5('0x48')],null))[_0xcbe5('0x24')](respondWithResult(_0x4cb9b0,null))[_0xcbe5('0x47')](handleError(_0x4cb9b0,null));};exports[_0xcbe5('0x25')]=function(_0x329f0a,_0x189d9d){return db['SmsApplication']['find']({'where':{'id':_0x329f0a['params']['id']}})[_0xcbe5('0x24')](handleEntityNotFound(_0x189d9d,null))[_0xcbe5('0x24')](removeEntity(_0x189d9d,null))[_0xcbe5('0x47')](handleError(_0x189d9d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 28e4305..5ffe853 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 _0x1354=['rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13bea0,_0x210a0c){var _0x3f12df=function(_0x11ef1c){while(--_0x11ef1c){_0x13bea0['push'](_0x13bea0['shift']());}};_0x3f12df(++_0x210a0c);}(_0x1354,0x95));var _0x4135=function(_0x454589,_0x3e852e){_0x454589=_0x454589-0x0;var _0x468c5c=_0x1354[_0x454589];return _0x468c5c;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))(_0x4135('0x3'));var moment=require(_0x4135('0x4'));var BPromise=require(_0x4135('0x5'));var rp=require(_0x4135('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4135('0x7'));var config=require(_0x4135('0x8'));var attributes=require(_0x4135('0x9'));module['exports']=function(_0x14ff47,_0x2bcd68){return _0x14ff47['define'](_0x4135('0xa'),attributes,{'tableName':_0x4135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4135('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe250=['SmsApplication','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','define'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0xe250,0x12b));var _0x0e25=function(_0x1f06aa,_0x2ec8e0){_0x1f06aa=_0x1f06aa-0x0;var _0x4bda3d=_0xe250[_0x1f06aa];return _0x4bda3d;};'use strict';var _=require('lodash');var util=require(_0x0e25('0x0'));var logger=require('../../config/logger')(_0x0e25('0x1'));var moment=require(_0x0e25('0x2'));var BPromise=require(_0x0e25('0x3'));var rp=require(_0x0e25('0x4'));var fs=require('fs');var path=require(_0x0e25('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module['exports']=function(_0x5cfbfe,_0x5d7802){return _0x5cfbfe[_0x0e25('0x6')](_0x0e25('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e25('0x8')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 1a13292..e83286a 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 _0xd1f1=['request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5337ed,_0x5a8f8c){var _0x1181b0=function(_0x57c202){while(--_0x57c202){_0x5337ed['push'](_0x5337ed['shift']());}};_0x1181b0(++_0x5a8f8c);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0xd1f1[_0x548e1d];return _0x398584;};'use strict';var _=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var moment=require('moment');var BPromise=require(_0x1d1f('0x2'));var rs=require(_0x1d1f('0x3'));var fs=require('fs');var Redis=require(_0x1d1f('0x4'));var db=require(_0x1d1f('0x5'))['db'];var utils=require(_0x1d1f('0x6'));var logger=require(_0x1d1f('0x7'))(_0x1d1f('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d1f('0x9'));var client=jayson[_0x1d1f('0xa')][_0x1d1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x188cc3,_0x30a1f2,_0x5228f4){return new BPromise(function(_0x4836b3,_0x4d9d5e){return client[_0x1d1f('0xc')](_0x188cc3,_0x5228f4)[_0x1d1f('0xd')](function(_0xfae470){logger[_0x1d1f('0xe')]('SmsApplication,\x20%s,\x20%s',_0x30a1f2,_0x1d1f('0xf'));logger[_0x1d1f('0x10')](_0x1d1f('0x11'),_0x30a1f2,_0x1d1f('0xf'),JSON[_0x1d1f('0x12')](_0xfae470));if(_0xfae470['error']){if(_0xfae470['error'][_0x1d1f('0x13')]===0x1f4){logger[_0x1d1f('0x14')]('SmsApplication,\x20%s,\x20%s',_0x30a1f2,_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);return _0x4d9d5e(_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);}logger['error'](_0x1d1f('0x16'),_0x30a1f2,_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);return _0x4836b3(_0xfae470[_0x1d1f('0x14')][_0x1d1f('0x15')]);}else{logger[_0x1d1f('0xe')](_0x1d1f('0x16'),_0x30a1f2,_0x1d1f('0xf'));_0x4836b3(_0xfae470[_0x1d1f('0x17')][_0x1d1f('0x15')]);}})[_0x1d1f('0x18')](function(_0xf9fb3c){logger[_0x1d1f('0x14')](_0x1d1f('0x16'),_0x30a1f2,_0xf9fb3c);_0x4d9d5e(_0xf9fb3c);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsApplication,\x20%s,\x20%s','message','catch','lodash'];(function(_0x20472e,_0x4633a7){var _0x320426=function(_0x39d102){while(--_0x39d102){_0x20472e['push'](_0x20472e['shift']());}};_0x320426(++_0x4633a7);}(_0x66fa,0x117));var _0xa66f=function(_0x1faca3,_0x1c1ebc){_0x1faca3=_0x1faca3-0x0;var _0x4d0a32=_0x66fa[_0x1faca3];return _0x4d0a32;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('SmsApplication,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 86cda23..b32a204 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 _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x1858e8,_0x293115){var _0xf67db0=function(_0x3d8a66){while(--_0x3d8a66){_0x1858e8['push'](_0x1858e8['shift']());}};_0xf67db0(++_0x293115);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file +var _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xe511,0x16f));var _0x1e51=function(_0x48b4a1,_0x3c2bf4){_0x48b4a1=_0x48b4a1-0x0;var _0x2df379=_0xe511[_0x48b4a1];return _0x2df379;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5ec532d..93e00ab 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 _0x8110=['STRING','DATE','ENUM','out','BOOLEAN','moment'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8110,0x185));var _0x0811=function(_0x4a2874,_0xead3ad){_0x4a2874=_0x4a2874-0x0;var _0x353601=_0x8110[_0x4a2874];return _0x353601;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0811('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0811('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0811('0x1')]},'note':{'type':Sequelize[_0x0811('0x1')]},'phone':{'type':Sequelize[_0x0811('0x1')]},'read1stAt':{'type':Sequelize[_0x0811('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0811('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0811('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0811('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0811('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x36b2=['ENUM','out','BOOLEAN','sequelize','moment','exports','DATE','STRING'];(function(_0x848300,_0xd6f38a){var _0x50ace4=function(_0x99adc6){while(--_0x99adc6){_0x848300['push'](_0x848300['shift']());}};_0x50ace4(++_0xd6f38a);}(_0x36b2,0x6b));var _0x236b=function(_0x216943,_0x2a2265){_0x216943=_0x216943-0x0;var _0x3ab407=_0x36b2[_0x216943];return _0x3ab407;};'use strict';var Sequelize=require(_0x236b('0x0'));var moment=require(_0x236b('0x1'));module[_0x236b('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x236b('0x3')]},'disposition':{'type':Sequelize[_0x236b('0x4')]},'secondDisposition':{'type':Sequelize[_0x236b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x236b('0x4')]},'phone':{'type':Sequelize[_0x236b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x236b('0x5')]('in',_0x236b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x236b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x236b('0x5')]('in',_0x236b('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x236b('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4187d1b..88703cd 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 _0xe189=['where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','isEmpty','SmsAccountId','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','SmsInteractionId','rows','params','includeAll','include','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','keys','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','files','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','get','Owner','N.A.','closedAt','disposition','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','download','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','status','offset','limit','count','set','Content-Range','json','save','then','destroy','end','sendStatus','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x4610c8,_0x39b9ec){var _0x31e396=function(_0x2927ce){while(--_0x2927ce){_0x4610c8['push'](_0x4610c8['shift']());}};_0x31e396(++_0x39b9ec);}(_0xe189,0x194));var _0x9e18=function(_0x24decf,_0x4372bb){_0x24decf=_0x24decf-0x0;var _0x21bea1=_0xe189[_0x24decf];return _0x21bea1;};'use strict';var emlformat=require(_0x9e18('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9e18('0x1'));var rp=require(_0x9e18('0x2'));var moment=require(_0x9e18('0x3'));var BPromise=require(_0x9e18('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e18('0x5'));var sox=require(_0x9e18('0x6'));var csv=require(_0x9e18('0x7'));var ejs=require(_0x9e18('0x8'));var fs=require('fs');var fs_extra=require(_0x9e18('0x9'));var _=require('lodash');var squel=require(_0x9e18('0xa'));var crypto=require(_0x9e18('0xb'));var jsforce=require(_0x9e18('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9e18('0x7'));var querystring=require(_0x9e18('0xd'));var Papa=require(_0x9e18('0xe'));var Redis=require('ioredis');var authService=require(_0x9e18('0xf'));var qs=require(_0x9e18('0x10'));var as=require(_0x9e18('0x11'));var pdf=require(_0x9e18('0x12'));var hardwareService=require(_0x9e18('0x13'));var logger=require(_0x9e18('0x14'))(_0x9e18('0x15'));var utils=require(_0x9e18('0x16'));var config=require(_0x9e18('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e18('0x18'))['db'];config['redis']=_[_0x9e18('0x19')](config[_0x9e18('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e18('0x1b'))(new Redis(config[_0x9e18('0x1a')]));require(_0x9e18('0x1c'))[_0x9e18('0x1d')](socket);function respondWithStatusCode(_0x566954,_0xbd877){_0xbd877=_0xbd877||0xcc;return function(_0x58c360){if(_0x58c360){return _0x566954['sendStatus'](_0xbd877);}return _0x566954[_0x9e18('0x1e')](_0xbd877)['end']();};}function respondWithResult(_0x691a51,_0x3a2ad9){_0x3a2ad9=_0x3a2ad9||0xc8;return function(_0x1f71fc){if(_0x1f71fc){return _0x691a51[_0x9e18('0x1e')](_0x3a2ad9)['json'](_0x1f71fc);}};}function respondWithFilteredResult(_0x4a5247,_0x15cf20){return function(_0x446098){if(_0x446098){var _0x57cd1f=typeof _0x15cf20[_0x9e18('0x1f')]==='undefined'&&typeof _0x15cf20[_0x9e18('0x20')]==='undefined';var _0x2ef267=_0x446098[_0x9e18('0x21')];var _0x20b492=_0x57cd1f?0x0:_0x15cf20[_0x9e18('0x1f')];var _0x1fb910=_0x57cd1f?_0x446098[_0x9e18('0x21')]:_0x15cf20[_0x9e18('0x1f')]+_0x15cf20[_0x9e18('0x20')];var _0x11619d;if(_0x1fb910>=_0x2ef267){_0x1fb910=_0x2ef267;_0x11619d=0xc8;}else{_0x11619d=0xce;}_0x4a5247['status'](_0x11619d);return _0x4a5247[_0x9e18('0x22')](_0x9e18('0x23'),_0x20b492+'-'+_0x1fb910+'/'+_0x2ef267)[_0x9e18('0x24')](_0x446098);}return null;};}function patchUpdates(_0x52039e){return function(_0x420ab0){try{jsonpatch['apply'](_0x420ab0,_0x52039e,!![]);}catch(_0x4b591){return BPromise['reject'](_0x4b591);}return _0x420ab0[_0x9e18('0x25')]();};}function saveUpdates(_0x4eabe9,_0x210547){return function(_0x1bd289){if(_0x1bd289){return _0x1bd289['update'](_0x4eabe9)[_0x9e18('0x26')](function(_0x4b6ab5){return _0x4b6ab5;});}return null;};}function removeEntity(_0x4c133b,_0x445f10){return function(_0x5efbde){if(_0x5efbde){return _0x5efbde[_0x9e18('0x27')]()['then'](function(){_0x4c133b[_0x9e18('0x1e')](0xcc)[_0x9e18('0x28')]();});}};}function handleEntityNotFound(_0x2cee0f,_0xd115f3){return function(_0x33fbd5){if(!_0x33fbd5){_0x2cee0f[_0x9e18('0x29')](0x194);}return _0x33fbd5;};}function handleError(_0x10c119,_0x3917fb){_0x3917fb=_0x3917fb||0x1f4;return function(_0xc75df0){logger['error'](_0xc75df0[_0x9e18('0x2a')]);if(_0xc75df0[_0x9e18('0x2b')]){delete _0xc75df0[_0x9e18('0x2b')];}_0x10c119[_0x9e18('0x1e')](_0x3917fb)['send'](_0xc75df0);};}function getInteractionUsers(_0x56cb83,_0x410655){return new BPromise(function(_0x1bb217,_0x3f6510){try{if(_0x410655[_0x56cb83['id']]){_0x56cb83[_0x9e18('0x2c')]=_[_0x9e18('0x2d')](_0x410655[_0x56cb83['id']],function(_0x53c35e){return{'id':_0x53c35e['id'],'fullname':_0x53c35e[_0x9e18('0x2e')]};});}}catch(_0x3862d9){_0x3f6510(_0x3862d9);}_0x1bb217(_0x56cb83);});}function getInteractionTags(_0x12f451,_0x1815e8){return new BPromise(function(_0x1a240d,_0x3412d5){try{if(_0x12f451['TagIds']){_0x12f451[_0x9e18('0x2f')]=[];_0x12f451[_0x9e18('0x30')][_0x9e18('0x31')](',')[_0x9e18('0x32')](function(_0x29942e){_0x12f451['Tags']['push'](_0x1815e8[_0x29942e]);});}delete _0x12f451[_0x9e18('0x30')];}catch(_0x38c8ec){_0x3412d5(_0x38c8ec);}_0x1a240d(_0x12f451);});}function updateSmsInteraction(_0x3cead0,_0xe49a38,_0x4b489a){return new BPromise(function(_0x3cb118,_0x1779a1){return getInteractionUsers(_0x3cead0,_0x4b489a)[_0x9e18('0x26')](function(_0x51b672){return getInteractionTags(_0x51b672,_0xe49a38);})[_0x9e18('0x26')](function(_0x48b9ed){return getStateInteraction(_0x48b9ed);})[_0x9e18('0x26')](function(_0x506ab8){_0x3cb118(_0x506ab8);})[_0x9e18('0x33')](function(_0x37b294){_0x1779a1(_0x37b294);});});}function getStateInteraction(_0xdc383c){return new BPromise(function(_0x984955){_0xdc383c[_0x9e18('0x34')]=0x0;_0xdc383c[_0x9e18('0x35')]=0x0;_0xdc383c[_0x9e18('0x36')]=0x0;_0xdc383c[_0x9e18('0x37')]=0x0;_0xdc383c[_0x9e18('0x38')]=0x0;if(!_0xdc383c[_0x9e18('0x39')]&&!_0xdc383c[_0x9e18('0x3a')]){_0xdc383c['waiting']+=0x1;}if(!_0xdc383c[_0x9e18('0x39')]&&_0xdc383c[_0x9e18('0x3a')]){_0xdc383c[_0x9e18('0x35')]+=0x1;if(_0xdc383c[_0x9e18('0x34')]){_0xdc383c[_0x9e18('0x34')]-=0x1;}}if(_0xdc383c[_0x9e18('0x39')]&&_0xdc383c[_0x9e18('0x3a')]){_0xdc383c[_0x9e18('0x36')]+=0x1;if(_0xdc383c[_0x9e18('0x35')]){_0xdc383c[_0x9e18('0x35')]-=0x1;}}if(_0xdc383c[_0x9e18('0x39')]&&!_0xdc383c[_0x9e18('0x3a')]){_0xdc383c[_0x9e18('0x37')]+=0x1;if(_0xdc383c[_0x9e18('0x34')]){_0xdc383c['waiting']-=0x1;}}_0xdc383c[_0x9e18('0x38')]+=0x1;_0x984955(_0xdc383c);});}exports[_0x9e18('0x3b')]=function(_0x3dc07c,_0x49ac7c){var _0x155695={},_0xf308ad={},_0x1821cb={'count':0x0,'rows':[]};var _0x2c9e9a=_[_0x9e18('0x2d')](db[_0x9e18('0x3c')][_0x9e18('0x3d')],function(_0x44b4fc){return{'name':_0x44b4fc[_0x9e18('0x3e')],'type':_0x44b4fc[_0x9e18('0x3f')]['key']};});_0xf308ad['model']=_['map'](_0x2c9e9a,_0x9e18('0x2b'));_0xf308ad['query']=_['keys'](_0x3dc07c[_0x9e18('0x40')]);_0xf308ad[_0x9e18('0x41')]=_[_0x9e18('0x42')](_0xf308ad['model'],_0xf308ad[_0x9e18('0x40')]);_0x155695[_0x9e18('0x43')]=_[_0x9e18('0x42')](_0xf308ad[_0x9e18('0x44')],qs[_0x9e18('0x45')](_0x3dc07c['query'][_0x9e18('0x45')]));_0x155695[_0x9e18('0x43')]=_0x155695[_0x9e18('0x43')][_0x9e18('0x46')]?_0x155695['attributes']:_0xf308ad[_0x9e18('0x44')];if(!_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x47')](_0x9e18('0x48'))){_0x155695[_0x9e18('0x20')]=qs['limit'](_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x20')]);_0x155695[_0x9e18('0x1f')]=qs[_0x9e18('0x1f')](_0x3dc07c[_0x9e18('0x40')]['offset']);}_0x155695['order']=qs['sort'](_0x3dc07c['query'][_0x9e18('0x49')]);_0x155695[_0x9e18('0x4a')]=qs[_0x9e18('0x41')](_[_0x9e18('0x4b')](_0x3dc07c[_0x9e18('0x40')],_0xf308ad['filters']),_0x2c9e9a);var _0x2bba5b=[];var _0x36eeaf=squel[_0x9e18('0x4c')]()[_0x9e18('0x4d')]('id')['field']('name')[_0x9e18('0x4d')](_0x9e18('0x4e'))[_0x9e18('0x4f')](_0x9e18('0x50'));var _0xda11e3=squel[_0x9e18('0x4c')]()['field'](_0x9e18('0x51'))['field'](_0x9e18('0x52'))[_0x9e18('0x4d')](_0x9e18('0x53'))[_0x9e18('0x4f')](_0x9e18('0x54'),'ui')[_0x9e18('0x55')](_0x9e18('0x56'),'u',_0x9e18('0x57'));var _0x352ca5=squel[_0x9e18('0x4c')]()[_0x9e18('0x4f')](_0x9e18('0x58'),'i')[_0x9e18('0x55')](_0x9e18('0x59'),'c',_0x9e18('0x5a'))['left_join'](_0x9e18('0x56'),'o',_0x9e18('0x5b'))[_0x9e18('0x55')](_0x9e18('0x5c'),'a',_0x9e18('0x5d'))['left_join'](_0x9e18('0x5e'),'me',_0x9e18('0x5f'))[_0x9e18('0x55')](_0x9e18('0x60'),'it',_0x9e18('0x61'))[_0x9e18('0x55')](_0x9e18('0x50'),'t',_0x9e18('0x62'));var _0x1ba96e=squel[_0x9e18('0x63')]();var _0x212c29=[];var _0x4047aa=squel[_0x9e18('0x63')]();var _0x1f19b8;if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x64')]){_0x1f19b8=as[_0x9e18('0x65')](_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x64')]);var _0x1c1f3f=_0x1f19b8[_0x9e18('0x66')];for(var _0x177f5c=0x0;_0x177f5c<_0x1f19b8[_0x9e18('0x67')][_0x9e18('0x46')];_0x177f5c++){var _0x474577=_0x1f19b8[_0x9e18('0x67')][_0x177f5c];var _0x3e6d71='i';var _0x5b2f8d=_[_0x9e18('0x68')](_0x2c9e9a,[_0x9e18('0x2b'),_0x474577[_0x9e18('0x4d')]]);if(!_0x5b2f8d){switch(_0x474577[_0x9e18('0x4d')]){case _0x9e18('0x69'):if(_0x474577[_0x9e18('0x6a')]==0x1){_0x352ca5[_0x9e18('0x6b')]('`'+_0x474577['field']+_0x9e18('0x6c'));}else{_0x352ca5[_0x9e18('0x6b')]('`'+_0x474577[_0x9e18('0x4d')]+_0x9e18('0x6d'));}break;case _0x9e18('0x6e'):if(_0x474577[_0x9e18('0x6f')]===_0x9e18('0x70')){if(_0x474577[_0x9e18('0x6a')][_0x9e18('0x31')]('\x20')['length']>0x1){_0x1ba96e[_0x1c1f3f](_0x9e18('0x71'),qs[_0x9e18('0x72')](_0x474577['value']),null);}else{var _0x354862='%'+_0x474577[_0x9e18('0x6a')]+'%';_0x1ba96e[_0x1c1f3f](_0x9e18('0x73'),_0x354862,_0x354862,_0x354862);}}else{_0x5b2f8d=_[_0x9e18('0x68')](_0x2c9e9a,[_0x9e18('0x2b'),_0x9e18('0x74')]);_0x474577[_0x9e18('0x4d')]=_0x9e18('0x74');_0x532678=as[_0x9e18('0x75')](_0x3e6d71,_0x5b2f8d['type'],_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678[_0x9e18('0x6a')][_0x9e18('0x77')],_0x532678[_0x9e18('0x6a')]['end']);}break;case _0x9e18('0x78'):var _0x4eb9d7=_0x474577[_0x9e18('0x6a')][_0x9e18('0x31')](',')[_0x9e18('0x2d')](function(_0x46d568){return Number(_0x46d568);});_0x4eb9d7[_0x9e18('0x32')](function(_0x157a66){_0x4047aa['or'](_0x9e18('0x79'),'%,'+_0x157a66+',%');});_0x212c29=_[_0x9e18('0x7a')](_0x212c29,_0x4eb9d7);break;case'User':if(_0x474577[_0x9e18('0x6f')]===_0x9e18('0x70')){_0x1ba96e[_0x1c1f3f](_0x9e18('0x7b'),'%'+_0x474577[_0x9e18('0x6a')]+'%',null);}else{_0x5b2f8d=_['find'](_0x2c9e9a,['name',_0x9e18('0x3a')]);_0x474577[_0x9e18('0x4d')]=_0x9e18('0x3a');_0x532678=as[_0x9e18('0x75')](_0x3e6d71,_0x5b2f8d[_0x9e18('0x3f')],_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678['value']['start'],_0x532678[_0x9e18('0x6a')][_0x9e18('0x28')]);}break;case _0x9e18('0x7c'):_0x532678=as[_0x9e18('0x75')]('me',null,_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678[_0x9e18('0x6a')]['start'],_0x532678[_0x9e18('0x6a')]['end']);break;}}else{var _0x532678=as['buildExpression'](_0x3e6d71,_0x5b2f8d['type'],_0x474577);_0x1ba96e[_0x1c1f3f](_0x532678[_0x9e18('0x76')],_0x532678[_0x9e18('0x6a')][_0x9e18('0x77')],_0x532678[_0x9e18('0x6a')][_0x9e18('0x28')]);}}}else{var _0xd083f9=_(_0x3dc07c[_0x9e18('0x40')])['keys']()[_0x9e18('0x2d')](function(_0x1e241d){return _['some'](_0x2c9e9a,['name',_0x1e241d])?_0x1e241d:undefined;})['compact']()['value']();if(!_[_0x9e18('0x7d')](_0xd083f9)){_0xd083f9[_0x9e18('0x32')](function(_0x1fffbe){if(_0x1fffbe===_0x9e18('0x7e')){_0x352ca5['where']('i.SmsAccountId\x20IN\x20?',[][_0x9e18('0x7f')](_0x3dc07c[_0x9e18('0x40')][_0x1fffbe]));}else if(_0x1fffbe===_0x9e18('0x80')){var _0x3ffd6b=JSON['parse'](_0x3dc07c['query'][_0x1fffbe])['$gte'];var _0x25565e=JSON['parse'](_0x3dc07c[_0x9e18('0x40')][_0x1fffbe])[_0x9e18('0x81')];_0x352ca5[_0x9e18('0x4a')](_0x9e18('0x82'),_0x3ffd6b,_0x25565e);}else{if(_0x3dc07c[_0x9e18('0x40')][_0x1fffbe]===_0x9e18('0x83')){_0x352ca5[_0x9e18('0x4a')]('i.'+_0x1fffbe+_0x9e18('0x84'));}else{_0x352ca5[_0x9e18('0x4a')]('i.'+_0x1fffbe+'\x20=\x20?',_0x3dc07c[_0x9e18('0x40')][_0x1fffbe]);}}});}if(_0x3dc07c['query']['read']){if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x85')]==0x1){_0x352ca5[_0x9e18('0x6b')](_0x9e18('0x86'));}else{_0x352ca5[_0x9e18('0x6b')]('`unreadMessages`\x20>\x200');}}if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x87')]){_0x212c29=_[_0x9e18('0x88')](_0x3dc07c['query'][_0x9e18('0x87')])?_0x3dc07c[_0x9e18('0x40')]['tag']:new Array(_0x3dc07c[_0x9e18('0x40')]['tag']);_0x212c29['forEach'](function(_0x4f9876){_0x4047aa['or'](_0x9e18('0x79'),'%,'+_0x4f9876+',%');});}if(_0x3dc07c[_0x9e18('0x40')]['filter']){var _0x55d48=_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x89')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9e18('0x8a')](_0x55d48)){_0x1ba96e['or']('i.id\x20LIKE\x20?',_0x55d48+'%')['or'](_0x9e18('0x8b'),_0x55d48+'%');}else{_0x1ba96e['or'](_0x9e18('0x8c'),qs['getFullTextValue'](_0x55d48))['or'](_0x9e18('0x8d'),_0x55d48+'%');}}}_0x352ca5['where'](_0x1ba96e);_0x352ca5[_0x9e18('0x8e')](_0x9e18('0x8f'));var _0x547a65={'type':db[_0x9e18('0x90')][_0x9e18('0x91')]['SELECT'],'raw':!![]};var _0x393def=_0x352ca5[_0x9e18('0x92')]();_0x393def[_0x9e18('0x4d')](_0x9e18('0x8f'));_0x393def[_0x9e18('0x4d')](_0x9e18('0x93'),_0x9e18('0x69'));if(_0x155695[_0x9e18('0x94')]){_0x155695[_0x9e18('0x94')][_0x9e18('0x32')](function(_0x3610b1){var _0x42ec02=_0x3610b1[0x0]===_0x9e18('0x95')?_0x3610b1[0x0]:'i.'+_0x3610b1[0x0];_0x352ca5['order'](_0x42ec02,_0x3610b1[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9e18('0x7d')](_0x212c29)){_0x352ca5[_0x9e18('0x6b')](_0x4047aa);_0x393def['where'](_0x9e18('0x96'),_0x212c29);}BPromise[_0x9e18('0x97')]()[_0x9e18('0x26')](function(){if(!_0x1f19b8){if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x7e')])return;_0x393def['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x352ca5[_0x9e18('0x4a')](_0x9e18('0x98'));return;}if(_0x3dc07c['user'][_0x9e18('0x99')]!==_0x9e18('0x9a'))return;return _0x3dc07c[_0x9e18('0x9b')][_0x9e18('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a7575){if(_['isEmpty'](_0x2a7575)){_0x393def[_0x9e18('0x4a')](_0x9e18('0x9d'));_0x352ca5[_0x9e18('0x4a')](_0x9e18('0x9d'));}else{_0x393def[_0x9e18('0x4a')](_0x9e18('0x9e'),_[_0x9e18('0x2d')](_0x2a7575,'id'));_0x352ca5[_0x9e18('0x4a')]('i.SmsAccountId\x20IN\x20?',_[_0x9e18('0x2d')](_0x2a7575,'id'));}});})[_0x9e18('0x26')](function(){if(_0x3dc07c[_0x9e18('0x9b')][_0x9e18('0x99')]==='agent'&&!_0x1f19b8&&!_0x3dc07c['query'][_0x9e18('0x7e')])return[];return db[_0x9e18('0x9f')][_0x9e18('0x40')](_0x393def[_0x9e18('0xa0')](),_0x547a65);})[_0x9e18('0x26')](function(_0x46edce){_0x1821cb[_0x9e18('0x21')]=_0x46edce[_0x9e18('0x46')];if(_0x1821cb[_0x9e18('0x21')]===0x0)return[];return db[_0x9e18('0x9f')][_0x9e18('0x40')](_0x36eeaf[_0x9e18('0xa0')](),_0x547a65)[_0x9e18('0x26')](function(_0x4f0fa0){_0x2bba5b=_[_0x9e18('0xa1')](_0x4f0fa0,'id');_0x547a65=_[_0x9e18('0xa2')](_0x547a65,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3dc07c[_0x9e18('0x40')][_0x9e18('0x45')]){_0x155695[_0x9e18('0x43')][_0x9e18('0x32')](function(_0x1a4041){_0x352ca5[_0x9e18('0x4d')]('i.'+_0x1a4041);});}else{_0x352ca5[_0x9e18('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9e18('0x69'));_0x352ca5['field'](_0x9e18('0xa3'),_0x9e18('0xa4'));_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xa5'),_0x9e18('0xa6'));_0x352ca5[_0x9e18('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x352ca5['field'](_0x9e18('0xa7'));_0x352ca5[_0x9e18('0x4d')]('c.firstName',_0x9e18('0xa8'));_0x352ca5['field'](_0x9e18('0xa9'),'Contact.lastName');_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xaa'),_0x9e18('0xab'));_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xac'),'Contact.phone');_0x352ca5['field'](_0x9e18('0xad'),'Contact.mobile');_0x352ca5['field'](_0x9e18('0xae'),_0x9e18('0xaf'));_0x352ca5[_0x9e18('0x4d')](_0x9e18('0xb0'),_0x9e18('0xb1'));_0x352ca5[_0x9e18('0x4d')]('o.internal',_0x9e18('0xb2'));_0x352ca5[_0x9e18('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9e18('0x30'));}if(_0x155695['limit'])_0x352ca5[_0x9e18('0x20')](_0x155695[_0x9e18('0x20')]);if(_0x155695[_0x9e18('0x1f')])_0x352ca5[_0x9e18('0x1f')](_0x155695['offset']);return db['sequelize'][_0x9e18('0x40')](_0x352ca5['toString'](),_0x547a65);})['then'](function(_0x3aa08c){if(_0x3aa08c[_0x9e18('0x46')]>0x0)_0xda11e3['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x9e18('0x2d')](_0x3aa08c,'id'));return db[_0x9e18('0x9f')]['query'](_0xda11e3['toString'](),_0x547a65)[_0x9e18('0x26')](function(_0x50abc1){var _0x1c9e8a=_['groupBy'](_0x50abc1,_0x9e18('0xb3'));var _0x2e89d1=[];_0x3aa08c['forEach'](function(_0x1aefc5){_0x2e89d1['push'](updateSmsInteraction(_0x1aefc5,_0x2bba5b,_0x1c9e8a));});return BPromise['all'](_0x2e89d1);});});})[_0x9e18('0x26')](function(_0x2b9650){_0x1821cb[_0x9e18('0xb4')]=_0x2b9650;return _0x1821cb;})['then'](respondWithFilteredResult(_0x49ac7c,_0x155695))['catch'](handleError(_0x49ac7c,null));};exports['show']=function(_0x4acad9,_0x1d2526){var _0x59359b={'raw':![],'where':{'id':_0x4acad9[_0x9e18('0xb5')]['id']}},_0x24021c={};_0x24021c[_0x9e18('0x44')]=_['keys'](db[_0x9e18('0x3c')]['rawAttributes']);_0x24021c['query']=_['keys'](_0x4acad9[_0x9e18('0x40')]);_0x24021c[_0x9e18('0x41')]=_[_0x9e18('0x42')](_0x24021c[_0x9e18('0x44')],_0x24021c[_0x9e18('0x40')]);_0x59359b[_0x9e18('0x43')]=_['intersection'](_0x24021c['model'],qs[_0x9e18('0x45')](_0x4acad9[_0x9e18('0x40')][_0x9e18('0x45')]));_0x59359b[_0x9e18('0x43')]=_0x59359b[_0x9e18('0x43')][_0x9e18('0x46')]?_0x59359b[_0x9e18('0x43')]:_0x24021c[_0x9e18('0x44')];if(_0x4acad9[_0x9e18('0x40')][_0x9e18('0xb6')]){_0x59359b[_0x9e18('0xb7')]=[{'all':!![]}];}_0x59359b=_['merge']({},_0x59359b,_0x4acad9[_0x9e18('0xb8')]);return db['SmsInteraction'][_0x9e18('0x68')](_0x59359b)[_0x9e18('0x26')](handleEntityNotFound(_0x1d2526,null))[_0x9e18('0x26')](respondWithResult(_0x1d2526,null))[_0x9e18('0x33')](handleError(_0x1d2526,null));};exports[_0x9e18('0xb9')]=function(_0x46fd42,_0x5125d0){return db[_0x9e18('0x3c')]['create'](_0x46fd42[_0x9e18('0x7c')],{})[_0x9e18('0x26')](respondWithResult(_0x5125d0,0xc9))[_0x9e18('0x33')](handleError(_0x5125d0,null));};exports[_0x9e18('0xba')]=function(_0x12572b,_0x5264c0){if(_0x12572b[_0x9e18('0x7c')]['id']){delete _0x12572b[_0x9e18('0x7c')]['id'];}return db[_0x9e18('0x3c')]['find']({'where':{'id':_0x12572b[_0x9e18('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5264c0,null))['then'](saveUpdates(_0x12572b['body'],null))[_0x9e18('0x26')](respondWithResult(_0x5264c0,null))[_0x9e18('0x33')](handleError(_0x5264c0,null));};exports[_0x9e18('0x27')]=function(_0x2c7795,_0x1e9e05){return db['SmsInteraction'][_0x9e18('0x68')]({'where':{'id':_0x2c7795[_0x9e18('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1e9e05,null))[_0x9e18('0x26')](removeEntity(_0x1e9e05,null))[_0x9e18('0x33')](handleError(_0x1e9e05,null));};exports[_0x9e18('0xbb')]=function(_0xcf671a,_0x4ff729){return db['SmsInteraction'][_0x9e18('0xbb')]()[_0x9e18('0x26')](respondWithResult(_0x4ff729,null))[_0x9e18('0x33')](handleError(_0x4ff729,null));};exports[_0x9e18('0xbc')]=function(_0x3422a0,_0x222b25,_0x575716){return db[_0x9e18('0xbd')][_0x9e18('0x68')]({'where':{'id':_0x3422a0['params']['id']}})['then'](handleEntityNotFound(_0x222b25,null))[_0x9e18('0x26')](function(_0x58e3a4){if(_0x58e3a4){return _0x58e3a4['addMessage'](_0x3422a0['body'][_0x9e18('0xbe')],_[_0x9e18('0xbf')](_0x3422a0['body'],[_0x9e18('0xbe'),'id'])||{});}})[_0x9e18('0x26')](respondWithResult(_0x222b25,null))['catch'](handleError(_0x222b25,null));};exports[_0x9e18('0xc0')]=function(_0xdffa05,_0x5c5173,_0x2ee383){var _0x210fc8={'raw':![],'where':{}};var _0xd5485a={};var _0x39508d={'count':0x0,'rows':[]};return db[_0x9e18('0x3c')][_0x9e18('0xc1')]({'where':{'id':_0xdffa05[_0x9e18('0xb5')]['id']}})[_0x9e18('0x26')](handleEntityNotFound(_0x5c5173,null))[_0x9e18('0x26')](function(_0xf24544){if(_0xf24544){_0xd5485a[_0x9e18('0x44')]=_[_0x9e18('0xc2')](db[_0x9e18('0xbd')]['rawAttributes']);_0xd5485a[_0x9e18('0x40')]=_[_0x9e18('0xc2')](_0xdffa05[_0x9e18('0x40')]);_0xd5485a[_0x9e18('0x41')]=_[_0x9e18('0x42')](_0xd5485a[_0x9e18('0x44')],_0xd5485a[_0x9e18('0x40')]);_0x210fc8[_0x9e18('0x43')]=_[_0x9e18('0x42')](_0xd5485a[_0x9e18('0x44')],qs[_0x9e18('0x45')](_0xdffa05[_0x9e18('0x40')][_0x9e18('0x45')]));_0x210fc8[_0x9e18('0x43')]=_0x210fc8['attributes'][_0x9e18('0x46')]?_0x210fc8['attributes']:_0xd5485a[_0x9e18('0x44')];if(!_0xdffa05['query'][_0x9e18('0x47')](_0x9e18('0x48'))){_0x210fc8['limit']=qs['limit'](_0xdffa05[_0x9e18('0x40')][_0x9e18('0x20')]);_0x210fc8[_0x9e18('0x1f')]=qs['offset'](_0xdffa05['query']['offset']);}_0x210fc8[_0x9e18('0x94')]=qs[_0x9e18('0x49')](_0xdffa05[_0x9e18('0x40')][_0x9e18('0x49')]);_0x210fc8[_0x9e18('0x4a')]=qs['filters'](_[_0x9e18('0x4b')](_0xdffa05[_0x9e18('0x40')],_0xd5485a[_0x9e18('0x41')]));_0x210fc8[_0x9e18('0x4a')]['SmsInteractionId']=_0xf24544['id'];if(_0xdffa05[_0x9e18('0x40')][_0x9e18('0x89')]){_0x210fc8[_0x9e18('0x4a')]=_[_0x9e18('0xa2')](_0x210fc8[_0x9e18('0x4a')],{'$or':_['map'](_0x210fc8[_0x9e18('0x43')],function(_0x29e13b){var _0xb330bd={};_0xb330bd[_0x29e13b]={'$like':'%'+_0xdffa05['query'][_0x9e18('0x89')]+'%'};return _0xb330bd;})});}if(_0xdffa05[_0x9e18('0x40')][_0x9e18('0xc3')]){var _0x4b475a=_0xdffa05[_0x9e18('0x40')][_0x9e18('0xc3')][_0x9e18('0x31')](',');var _0x6da0d4={};_0x6da0d4[_0x4b475a[0x0]]={'$gte':moment(_0x4b475a[0x1])[_0x9e18('0xc4')](_0x9e18('0xc5'))};_0x210fc8[_0x9e18('0x4a')]=_['merge'](_0x210fc8['where'],_0x6da0d4);}_0x210fc8=_['merge']({},_0x210fc8,_0xdffa05[_0x9e18('0xb8')]);return db['SmsMessage']['count']({'where':_0x210fc8[_0x9e18('0x4a')]})['then'](function(_0x61cd9d){_0x39508d['count']=_0x61cd9d;if(_0xdffa05[_0x9e18('0x40')]['includeAll']){_0x210fc8['include']=[{'all':!![]}];}return db['SmsMessage'][_0x9e18('0xc6')](_0x210fc8);})[_0x9e18('0x26')](function(_0x2252e1){_0x39508d[_0x9e18('0xb4')]=_0x2252e1;return _0x39508d;});}})['then'](respondWithFilteredResult(_0x5c5173,_0x210fc8))['catch'](handleError(_0x5c5173,null));};exports[_0x9e18('0xc7')]=function(_0xb1cec,_0x14f2ef,_0x21c873){return db[_0x9e18('0x3c')][_0x9e18('0x68')]({'where':{'id':_0xb1cec[_0x9e18('0xb5')]['id']}})[_0x9e18('0x26')](handleEntityNotFound(_0x14f2ef,null))[_0x9e18('0x26')](function(_0x25cadb){if(_0x25cadb){return _0x25cadb[_0x9e18('0xc8')](_0xb1cec['body']['ids'],_['omit'](_0xb1cec[_0x9e18('0x7c')],[_0x9e18('0xbe'),'id'])||{})[_0x9e18('0xc9')](function(){return db[_0x9e18('0x78')]['findAll']({'attributes':['id',_0x9e18('0x2b'),_0x9e18('0x4e')],'where':{'id':_0xb1cec[_0x9e18('0x7c')][_0x9e18('0xbe')]}});})['then'](function(_0x946390){socket[_0x9e18('0xca')](_0x9e18('0xcb'),{'id':Number(_0xb1cec[_0x9e18('0xb5')]['id']),'tags':_0x946390||[]});return{'id':Number(_0xb1cec[_0x9e18('0xb5')]['id']),'tags':_0x946390||[]};});}})[_0x9e18('0x26')](respondWithResult(_0x14f2ef,null))[_0x9e18('0x33')](handleError(_0x14f2ef,null));};exports[_0x9e18('0xcc')]=function(_0x47655c,_0x3c46be,_0x5cbd3c){return db[_0x9e18('0x3c')][_0x9e18('0x68')]({'where':{'id':_0x47655c[_0x9e18('0xb5')]['id']}})[_0x9e18('0x26')](handleEntityNotFound(_0x3c46be,null))[_0x9e18('0x26')](function(_0x1c1170){if(_0x1c1170){return _0x1c1170[_0x9e18('0xcc')](_0x47655c[_0x9e18('0x40')][_0x9e18('0xbe')]);}})[_0x9e18('0x26')](respondWithStatusCode(_0x3c46be,null))['catch'](handleError(_0x3c46be,null));};exports['download']=function(_0x28e3f8,_0x467ee7){var _0x46536e=moment()[_0x9e18('0xcd')]()['toString']();var _0x5e104d=path[_0x9e18('0xce')](config[_0x9e18('0xcf')],'server',_0x9e18('0xd0'),'tmp');var _0x7faaa7=path[_0x9e18('0xce')](config[_0x9e18('0xcf')],_0x9e18('0xd1'),_0x9e18('0xd0'),_0x9e18('0xd2'));var _0x1eb79d=path['join'](_0x5e104d,_0x46536e);var _0x4c991a=util[_0x9e18('0xc4')](_0x9e18('0xd3'),_0x28e3f8[_0x9e18('0xb5')]['id'],_0x46536e);var _0x461de2=path[_0x9e18('0xce')](_0x5e104d,_0x4c991a);var _0xfbf5c=[];_0xfbf5c[_0x9e18('0xd4')]({'model':db['User'],'as':_0x9e18('0xd5'),'attributes':['id',_0x9e18('0x2e')],'raw':!![]});_0xfbf5c[_0x9e18('0xd4')]({'model':db[_0x9e18('0xd6')],'as':_0x9e18('0x6e'),'attributes':['id',_0x9e18('0xd7'),_0x9e18('0xd8')],'raw':!![]});var _0x230a90=[{'model':db[_0x9e18('0xbd')],'as':_0x9e18('0xd9'),'attributes':['id',_0x9e18('0x7c'),_0x9e18('0x80'),_0x9e18('0xda'),_0x9e18('0xdb'),_0x9e18('0x85')],'include':_0xfbf5c}];_0x230a90[_0x9e18('0xd4')]({'model':db[_0x9e18('0xdc')],'as':_0x9e18('0xdd'),'attributes':['id',_0x9e18('0x2b')]});_0x230a90[_0x9e18('0xd4')]({'model':db[_0x9e18('0xd5')],'as':'Owner','attributes':['id',_0x9e18('0x2e')]});return db[_0x9e18('0x3c')][_0x9e18('0x68')]({'where':{'id':_0x28e3f8[_0x9e18('0xb5')]['id']},'include':_0x230a90})[_0x9e18('0x26')](handleEntityNotFound(_0x467ee7,null))[_0x9e18('0x26')](function(_0x3f1ca5){if(_0x3f1ca5){var _0x1e109b=_0x3f1ca5[_0x9e18('0xde')]({'plain':!![]});fs['mkdirSync'](_0x1eb79d);var _0x1ab2cf={'channel':'Sms','account':_0x1e109b[_0x9e18('0xdd')]['name'],'agent':_0x1e109b[_0x9e18('0xdf')]?_0x1e109b[_0x9e18('0xdf')][_0x9e18('0x2e')]:_0x9e18('0xe0'),'createdAt':moment(_0x1e109b['createdAt'])[_0x9e18('0xc4')](_0x9e18('0xc5'))[_0x9e18('0xa0')](),'closedAt':_0x1e109b[_0x9e18('0x39')]?moment(_0x1e109b[_0x9e18('0xe1')])[_0x9e18('0xc4')](_0x9e18('0xc5'))[_0x9e18('0xa0')]():'','disposition':_0x1e109b[_0x9e18('0xe2')],'messages':_(_0x1e109b[_0x9e18('0xd9')])['filter']({'secret':![]})['map'](function(_0x6ec43){return{'date':moment(_0x6ec43[_0x9e18('0x80')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9e18('0xa0')](),'sender':_0x6ec43[_0x9e18('0xda')]===_0x9e18('0xe3')?_0x6ec43[_0x9e18('0xd5')]?_0x6ec43[_0x9e18('0xd5')][_0x9e18('0x2e')]:_0x9e18('0xe4'):_0x6ec43['Contact'][_0x9e18('0xd7')]+(_0x6ec43[_0x9e18('0x6e')]['lastName']?'\x20'+_0x6ec43[_0x9e18('0x6e')][_0x9e18('0xd8')]:''),'body':_0x6ec43[_0x9e18('0x7c')],'direction':_0x6ec43[_0x9e18('0xda')]===_0x9e18('0xe3')?'A':'C','secret':_0x6ec43[_0x9e18('0xdb')],'read':_0x6ec43[_0x9e18('0x85')]};})['value']()};return ejs[_0x9e18('0xe5')](path[_0x9e18('0xce')](config['root'],_0x9e18('0xd1'),'views',_0x9e18('0xe6')),{'interaction':_0x1ab2cf})['then'](function(_0x462f65){var _0xa7aeea=path[_0x9e18('0xce')](_0x1eb79d,_0x9e18('0xe7')+_0x1e109b['id']+'-'+_0x46536e+_0x9e18('0xe8'));var _0x104589={'path':_0xa7aeea,'channel':_0x9e18('0xe9'),'interactionId':_0x1e109b['id']};return pdf[_0x9e18('0xea')](_0x462f65,_0x104589);})[_0x9e18('0x26')](function(){return new BPromise(function(_0x518891,_0x4460bc){zipdir(_0x1eb79d,{'saveTo':_0x461de2},function(_0x1fe2b7,_0x20f271){if(_0x1fe2b7)return _0x4460bc(_0x1fe2b7);return _0x518891(_0x20f271);});})[_0x9e18('0x26')](function(){return new BPromise(function(_0x52c5fb,_0x369785){rimraf(_0x1eb79d,function(_0x5ac806){if(_0x5ac806)_0x369785(_0x5ac806);return _0x52c5fb();});});})[_0x9e18('0x26')](function(){return _0x467ee7[_0x9e18('0xeb')](_0x461de2,_0x4c991a,function(_0x2fdc10){if(_0x2fdc10){console[_0x9e18('0xec')](_0x9e18('0xed'),_0x2fdc10);}else{fs[_0x9e18('0xee')](_0x461de2);}});});});}else{return _0x467ee7[_0x9e18('0x29')](0xc8);}})[_0x9e18('0x33')](handleError(_0x467ee7,null));}; \ No newline at end of file +var _0x3c4d=['disposition','direction','System','lastName','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','update','error','name','Users','map','fullname','TagIds','split','forEach','then','catch','waiting','talking','unmanaged','closed','UserId','total','index','SmsInteraction','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','select','field','color','from','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','start','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','push','all','show','params','keys','includeAll','include','create','destroy','addMessage','SmsMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','Messages','secret','SmsAccount','Sms','Owner','N.A.','closedAt'];(function(_0x40c98c,_0x1ef7ea){var _0x27e636=function(_0x37e316){while(--_0x37e316){_0x40c98c['push'](_0x40c98c['shift']());}};_0x27e636(++_0x1ef7ea);}(_0x3c4d,0x1dd));var _0xd3c4=function(_0x120aaf,_0x2fc83a){_0x120aaf=_0x120aaf-0x0;var _0x20bdde=_0x3c4d[_0x120aaf];return _0x20bdde;};'use strict';var emlformat=require(_0xd3c4('0x0'));var rimraf=require(_0xd3c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3c4('0x2'));var rp=require('request-promise');var moment=require(_0xd3c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd3c4('0x4'));var util=require(_0xd3c4('0x5'));var path=require(_0xd3c4('0x6'));var sox=require('sox');var csv=require(_0xd3c4('0x7'));var ejs=require(_0xd3c4('0x8'));var fs=require('fs');var fs_extra=require(_0xd3c4('0x9'));var _=require(_0xd3c4('0xa'));var squel=require(_0xd3c4('0xb'));var crypto=require(_0xd3c4('0xc'));var jsforce=require(_0xd3c4('0xd'));var deskjs=require(_0xd3c4('0xe'));var toCsv=require(_0xd3c4('0x7'));var querystring=require(_0xd3c4('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3c4('0x10'));var authService=require(_0xd3c4('0x11'));var qs=require(_0xd3c4('0x12'));var as=require(_0xd3c4('0x13'));var pdf=require(_0xd3c4('0x14'));var hardwareService=require(_0xd3c4('0x15'));var logger=require(_0xd3c4('0x16'))(_0xd3c4('0x17'));var utils=require(_0xd3c4('0x18'));var config=require(_0xd3c4('0x19'));var licenseUtil=require(_0xd3c4('0x1a'));var db=require(_0xd3c4('0x1b'))['db'];config['redis']=_[_0xd3c4('0x1c')](config[_0xd3c4('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3c4('0x1e'))(new Redis(config[_0xd3c4('0x1d')]));require(_0xd3c4('0x1f'))[_0xd3c4('0x20')](socket);function respondWithStatusCode(_0x24b8a1,_0xc79c1a){_0xc79c1a=_0xc79c1a||0xcc;return function(_0x49c624){if(_0x49c624){return _0x24b8a1[_0xd3c4('0x21')](_0xc79c1a);}return _0x24b8a1['status'](_0xc79c1a)[_0xd3c4('0x22')]();};}function respondWithResult(_0x5d7e13,_0x561fc2){_0x561fc2=_0x561fc2||0xc8;return function(_0x2e0437){if(_0x2e0437){return _0x5d7e13['status'](_0x561fc2)['json'](_0x2e0437);}};}function respondWithFilteredResult(_0x3e5f71,_0x20bd63){return function(_0x5f4696){if(_0x5f4696){var _0x57edbd=typeof _0x20bd63[_0xd3c4('0x23')]===_0xd3c4('0x24')&&typeof _0x20bd63['limit']===_0xd3c4('0x24');var _0x20ad44=_0x5f4696['count'];var _0x266064=_0x57edbd?0x0:_0x20bd63[_0xd3c4('0x23')];var _0x16f1aa=_0x57edbd?_0x5f4696[_0xd3c4('0x25')]:_0x20bd63[_0xd3c4('0x23')]+_0x20bd63[_0xd3c4('0x26')];var _0x157405;if(_0x16f1aa>=_0x20ad44){_0x16f1aa=_0x20ad44;_0x157405=0xc8;}else{_0x157405=0xce;}_0x3e5f71[_0xd3c4('0x27')](_0x157405);return _0x3e5f71[_0xd3c4('0x28')](_0xd3c4('0x29'),_0x266064+'-'+_0x16f1aa+'/'+_0x20ad44)[_0xd3c4('0x2a')](_0x5f4696);}return null;};}function patchUpdates(_0x40fe32){return function(_0x32fc5a){try{jsonpatch[_0xd3c4('0x2b')](_0x32fc5a,_0x40fe32,!![]);}catch(_0x8d12ed){return BPromise[_0xd3c4('0x2c')](_0x8d12ed);}return _0x32fc5a[_0xd3c4('0x2d')]();};}function saveUpdates(_0x1a0405,_0x3fcc2f){return function(_0x504965){if(_0x504965){return _0x504965[_0xd3c4('0x2e')](_0x1a0405)['then'](function(_0x4138f3){return _0x4138f3;});}return null;};}function removeEntity(_0x410124,_0x540838){return function(_0x23e8fc){if(_0x23e8fc){return _0x23e8fc['destroy']()['then'](function(){_0x410124['status'](0xcc)[_0xd3c4('0x22')]();});}};}function handleEntityNotFound(_0x24b129,_0x2050ce){return function(_0x1111ad){if(!_0x1111ad){_0x24b129[_0xd3c4('0x21')](0x194);}return _0x1111ad;};}function handleError(_0x2a9b2b,_0xfa43ca){_0xfa43ca=_0xfa43ca||0x1f4;return function(_0x3b7f12){logger[_0xd3c4('0x2f')](_0x3b7f12['stack']);if(_0x3b7f12[_0xd3c4('0x30')]){delete _0x3b7f12[_0xd3c4('0x30')];}_0x2a9b2b[_0xd3c4('0x27')](_0xfa43ca)['send'](_0x3b7f12);};}function getInteractionUsers(_0x19c805,_0x48bb8b){return new BPromise(function(_0x5167fd,_0x38cbec){try{if(_0x48bb8b[_0x19c805['id']]){_0x19c805[_0xd3c4('0x31')]=_[_0xd3c4('0x32')](_0x48bb8b[_0x19c805['id']],function(_0x73d3ab){return{'id':_0x73d3ab['id'],'fullname':_0x73d3ab[_0xd3c4('0x33')]};});}}catch(_0x358b3e){_0x38cbec(_0x358b3e);}_0x5167fd(_0x19c805);});}function getInteractionTags(_0xe0df1d,_0x6fd696){return new BPromise(function(_0x51777e,_0x743aee){try{if(_0xe0df1d['TagIds']){_0xe0df1d['Tags']=[];_0xe0df1d[_0xd3c4('0x34')][_0xd3c4('0x35')](',')[_0xd3c4('0x36')](function(_0x38a13b){_0xe0df1d['Tags']['push'](_0x6fd696[_0x38a13b]);});}delete _0xe0df1d['TagIds'];}catch(_0x4aace9){_0x743aee(_0x4aace9);}_0x51777e(_0xe0df1d);});}function updateSmsInteraction(_0x1f06e1,_0x3e5a4c,_0x4036b5){return new BPromise(function(_0x458cfe,_0x37a5c2){return getInteractionUsers(_0x1f06e1,_0x4036b5)[_0xd3c4('0x37')](function(_0x50eb69){return getInteractionTags(_0x50eb69,_0x3e5a4c);})[_0xd3c4('0x37')](function(_0xf2e2b9){return getStateInteraction(_0xf2e2b9);})[_0xd3c4('0x37')](function(_0x47ccb0){_0x458cfe(_0x47ccb0);})[_0xd3c4('0x38')](function(_0x1b4793){_0x37a5c2(_0x1b4793);});});}function getStateInteraction(_0x496752){return new BPromise(function(_0xfefbb0){_0x496752[_0xd3c4('0x39')]=0x0;_0x496752[_0xd3c4('0x3a')]=0x0;_0x496752['answered']=0x0;_0x496752[_0xd3c4('0x3b')]=0x0;_0x496752['total']=0x0;if(!_0x496752[_0xd3c4('0x3c')]&&!_0x496752['UserId']){_0x496752[_0xd3c4('0x39')]+=0x1;}if(!_0x496752[_0xd3c4('0x3c')]&&_0x496752[_0xd3c4('0x3d')]){_0x496752[_0xd3c4('0x3a')]+=0x1;if(_0x496752[_0xd3c4('0x39')]){_0x496752['waiting']-=0x1;}}if(_0x496752['closed']&&_0x496752[_0xd3c4('0x3d')]){_0x496752['answered']+=0x1;if(_0x496752['talking']){_0x496752[_0xd3c4('0x3a')]-=0x1;}}if(_0x496752[_0xd3c4('0x3c')]&&!_0x496752[_0xd3c4('0x3d')]){_0x496752[_0xd3c4('0x3b')]+=0x1;if(_0x496752[_0xd3c4('0x39')]){_0x496752[_0xd3c4('0x39')]-=0x1;}}_0x496752[_0xd3c4('0x3e')]+=0x1;_0xfefbb0(_0x496752);});}exports[_0xd3c4('0x3f')]=function(_0x146401,_0x2a11d0){var _0x2f799a={},_0x595cc0={},_0x4918ee={'count':0x0,'rows':[]};var _0x2e72ba=_[_0xd3c4('0x32')](db[_0xd3c4('0x40')][_0xd3c4('0x41')],function(_0x4fb351){return{'name':_0x4fb351[_0xd3c4('0x42')],'type':_0x4fb351[_0xd3c4('0x43')]['key']};});_0x595cc0[_0xd3c4('0x44')]=_[_0xd3c4('0x32')](_0x2e72ba,'name');_0x595cc0[_0xd3c4('0x45')]=_['keys'](_0x146401['query']);_0x595cc0[_0xd3c4('0x46')]=_['intersection'](_0x595cc0[_0xd3c4('0x44')],_0x595cc0[_0xd3c4('0x45')]);_0x2f799a[_0xd3c4('0x47')]=_[_0xd3c4('0x48')](_0x595cc0[_0xd3c4('0x44')],qs[_0xd3c4('0x49')](_0x146401[_0xd3c4('0x45')][_0xd3c4('0x49')]));_0x2f799a[_0xd3c4('0x47')]=_0x2f799a[_0xd3c4('0x47')]['length']?_0x2f799a[_0xd3c4('0x47')]:_0x595cc0[_0xd3c4('0x44')];if(!_0x146401[_0xd3c4('0x45')][_0xd3c4('0x4a')]('nolimit')){_0x2f799a[_0xd3c4('0x26')]=qs[_0xd3c4('0x26')](_0x146401[_0xd3c4('0x45')][_0xd3c4('0x26')]);_0x2f799a[_0xd3c4('0x23')]=qs[_0xd3c4('0x23')](_0x146401['query'][_0xd3c4('0x23')]);}_0x2f799a[_0xd3c4('0x4b')]=qs[_0xd3c4('0x4c')](_0x146401[_0xd3c4('0x45')]['sort']);_0x2f799a['where']=qs['filters'](_[_0xd3c4('0x4d')](_0x146401['query'],_0x595cc0[_0xd3c4('0x46')]),_0x2e72ba);var _0x11de3c=[];var _0x44da73=squel[_0xd3c4('0x4e')]()['field']('id')[_0xd3c4('0x4f')](_0xd3c4('0x30'))['field'](_0xd3c4('0x50'))[_0xd3c4('0x51')]('tools_tags');var _0x5edd70=squel[_0xd3c4('0x4e')]()[_0xd3c4('0x4f')](_0xd3c4('0x52'))[_0xd3c4('0x4f')]('u.fullname')[_0xd3c4('0x4f')](_0xd3c4('0x53'))[_0xd3c4('0x51')](_0xd3c4('0x54'),'ui')[_0xd3c4('0x55')](_0xd3c4('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x21907b=squel[_0xd3c4('0x4e')]()[_0xd3c4('0x51')](_0xd3c4('0x57'),'i')[_0xd3c4('0x55')](_0xd3c4('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xd3c4('0x56'),'o',_0xd3c4('0x59'))[_0xd3c4('0x55')](_0xd3c4('0x5a'),'a',_0xd3c4('0x5b'))[_0xd3c4('0x55')](_0xd3c4('0x5c'),'me',_0xd3c4('0x5d'))[_0xd3c4('0x55')](_0xd3c4('0x5e'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xd3c4('0x55')](_0xd3c4('0x5f'),'t',_0xd3c4('0x60'));var _0x2f54b1=squel[_0xd3c4('0x61')]();var _0x2d78fc=[];var _0x192308=squel[_0xd3c4('0x61')]();var _0x11d105;if(_0x146401[_0xd3c4('0x45')][_0xd3c4('0x62')]){_0x11d105=as[_0xd3c4('0x63')](_0x146401[_0xd3c4('0x45')][_0xd3c4('0x62')]);var _0x151934=_0x11d105[_0xd3c4('0x64')];for(var _0x454eeb=0x0;_0x454eeb<_0x11d105[_0xd3c4('0x65')][_0xd3c4('0x66')];_0x454eeb++){var _0x123109=_0x11d105[_0xd3c4('0x65')][_0x454eeb];var _0x2aa937='i';var _0x2e4300=_[_0xd3c4('0x67')](_0x2e72ba,[_0xd3c4('0x30'),_0x123109[_0xd3c4('0x4f')]]);if(!_0x2e4300){switch(_0x123109[_0xd3c4('0x4f')]){case _0xd3c4('0x68'):if(_0x123109['value']==0x1){_0x21907b[_0xd3c4('0x69')]('`'+_0x123109[_0xd3c4('0x4f')]+_0xd3c4('0x6a'));}else{_0x21907b[_0xd3c4('0x69')]('`'+_0x123109['field']+_0xd3c4('0x6b'));}break;case _0xd3c4('0x6c'):if(_0x123109['operator']===_0xd3c4('0x6d')){if(_0x123109['value'][_0xd3c4('0x35')]('\x20')[_0xd3c4('0x66')]>0x1){_0x2f54b1[_0x151934](_0xd3c4('0x6e'),qs[_0xd3c4('0x6f')](_0x123109[_0xd3c4('0x70')]),null);}else{var _0x482134='%'+_0x123109[_0xd3c4('0x70')]+'%';_0x2f54b1[_0x151934]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x482134,_0x482134,_0x482134);}}else{_0x2e4300=_[_0xd3c4('0x67')](_0x2e72ba,['name',_0xd3c4('0x71')]);_0x123109[_0xd3c4('0x4f')]=_0xd3c4('0x71');_0x4b0e6e=as[_0xd3c4('0x72')](_0x2aa937,_0x2e4300[_0xd3c4('0x43')],_0x123109);_0x2f54b1[_0x151934](_0x4b0e6e['text'],_0x4b0e6e['value']['start'],_0x4b0e6e['value'][_0xd3c4('0x22')]);}break;case _0xd3c4('0x73'):var _0x1b433c=_0x123109['value'][_0xd3c4('0x35')](',')[_0xd3c4('0x32')](function(_0xfcdbec){return Number(_0xfcdbec);});_0x1b433c[_0xd3c4('0x36')](function(_0x1451c8){_0x192308['or'](_0xd3c4('0x74'),'%,'+_0x1451c8+',%');});_0x2d78fc=_[_0xd3c4('0x75')](_0x2d78fc,_0x1b433c);break;case'User':if(_0x123109[_0xd3c4('0x76')]===_0xd3c4('0x6d')){_0x2f54b1[_0x151934](_0xd3c4('0x77'),'%'+_0x123109['value']+'%',null);}else{_0x2e4300=_[_0xd3c4('0x67')](_0x2e72ba,[_0xd3c4('0x30'),'UserId']);_0x123109[_0xd3c4('0x4f')]='UserId';_0x4b0e6e=as[_0xd3c4('0x72')](_0x2aa937,_0x2e4300['type'],_0x123109);_0x2f54b1[_0x151934](_0x4b0e6e[_0xd3c4('0x78')],_0x4b0e6e[_0xd3c4('0x70')][_0xd3c4('0x79')],_0x4b0e6e[_0xd3c4('0x70')][_0xd3c4('0x22')]);}break;case _0xd3c4('0x7a'):_0x4b0e6e=as[_0xd3c4('0x72')]('me',null,_0x123109);_0x2f54b1[_0x151934](_0x4b0e6e[_0xd3c4('0x78')],_0x4b0e6e[_0xd3c4('0x70')][_0xd3c4('0x79')],_0x4b0e6e[_0xd3c4('0x70')][_0xd3c4('0x22')]);break;}}else{var _0x4b0e6e=as[_0xd3c4('0x72')](_0x2aa937,_0x2e4300[_0xd3c4('0x43')],_0x123109);_0x2f54b1[_0x151934](_0x4b0e6e[_0xd3c4('0x78')],_0x4b0e6e[_0xd3c4('0x70')][_0xd3c4('0x79')],_0x4b0e6e['value'][_0xd3c4('0x22')]);}}}else{var _0x35a9ce=_(_0x146401[_0xd3c4('0x45')])['keys']()['map'](function(_0x1e9afa){return _[_0xd3c4('0x7b')](_0x2e72ba,['name',_0x1e9afa])?_0x1e9afa:undefined;})[_0xd3c4('0x7c')]()[_0xd3c4('0x70')]();if(!_[_0xd3c4('0x7d')](_0x35a9ce)){_0x35a9ce[_0xd3c4('0x36')](function(_0x389b63){if(_0x389b63==='SmsAccountId'){_0x21907b['where'](_0xd3c4('0x7e'),[][_0xd3c4('0x7f')](_0x146401['query'][_0x389b63]));}else if(_0x389b63===_0xd3c4('0x80')){var _0x4d9312=JSON[_0xd3c4('0x81')](_0x146401[_0xd3c4('0x45')][_0x389b63])[_0xd3c4('0x82')];var _0x26c05a=JSON[_0xd3c4('0x81')](_0x146401[_0xd3c4('0x45')][_0x389b63])['$lte'];_0x21907b[_0xd3c4('0x83')](_0xd3c4('0x84'),_0x4d9312,_0x26c05a);}else{if(_0x146401[_0xd3c4('0x45')][_0x389b63]===_0xd3c4('0x85')){_0x21907b[_0xd3c4('0x83')]('i.'+_0x389b63+_0xd3c4('0x86'));}else{_0x21907b[_0xd3c4('0x83')]('i.'+_0x389b63+_0xd3c4('0x87'),_0x146401[_0xd3c4('0x45')][_0x389b63]);}}});}if(_0x146401[_0xd3c4('0x45')][_0xd3c4('0x88')]){if(_0x146401[_0xd3c4('0x45')]['read']==0x1){_0x21907b[_0xd3c4('0x69')](_0xd3c4('0x89'));}else{_0x21907b[_0xd3c4('0x69')]('`unreadMessages`\x20>\x200');}}if(_0x146401[_0xd3c4('0x45')][_0xd3c4('0x8a')]){_0x2d78fc=_['isArray'](_0x146401[_0xd3c4('0x45')]['tag'])?_0x146401[_0xd3c4('0x45')][_0xd3c4('0x8a')]:new Array(_0x146401[_0xd3c4('0x45')][_0xd3c4('0x8a')]);_0x2d78fc[_0xd3c4('0x36')](function(_0x106f9c){_0x192308['or'](_0xd3c4('0x74'),'%,'+_0x106f9c+',%');});}if(_0x146401['query'][_0xd3c4('0x8b')]){var _0xd9e48a=_0x146401[_0xd3c4('0x45')][_0xd3c4('0x8b')]['replace']('\x5c','\x5c\x5c')[_0xd3c4('0x8c')](/'/g,'\x27\x27');if(qs[_0xd3c4('0x8d')](_0xd9e48a)){_0x2f54b1['or'](_0xd3c4('0x8e'),_0xd9e48a+'%')['or']('i.phone\x20LIKE\x20?',_0xd9e48a+'%');}else{_0x2f54b1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd3c4('0x6f')](_0xd9e48a))['or'](_0xd3c4('0x8f'),_0xd9e48a+'%');}}}_0x21907b['where'](_0x2f54b1);_0x21907b[_0xd3c4('0x90')](_0xd3c4('0x91'));var _0x189c91={'type':db[_0xd3c4('0x92')]['QueryTypes']['SELECT'],'raw':!![]};var _0x173930=_0x21907b[_0xd3c4('0x93')]();_0x173930[_0xd3c4('0x4f')](_0xd3c4('0x91'));_0x173930[_0xd3c4('0x4f')](_0xd3c4('0x94'),_0xd3c4('0x68'));if(_0x2f799a['order']){_0x2f799a[_0xd3c4('0x4b')][_0xd3c4('0x36')](function(_0x2b32eb){var _0x183803=_0x2b32eb[0x0]==='contactName'?_0x2b32eb[0x0]:'i.'+_0x2b32eb[0x0];_0x21907b[_0xd3c4('0x4b')](_0x183803,_0x2b32eb[0x1]===_0xd3c4('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x2d78fc)){_0x21907b[_0xd3c4('0x69')](_0x192308);_0x173930[_0xd3c4('0x83')]('t.id\x20IN\x20?',_0x2d78fc);}BPromise[_0xd3c4('0x96')]()[_0xd3c4('0x37')](function(){if(!_0x11d105){if(_0x146401['query'][_0xd3c4('0x97')])return;_0x173930[_0xd3c4('0x83')](_0xd3c4('0x98'));_0x21907b['where'](_0xd3c4('0x98'));return;}if(_0x146401['user'][_0xd3c4('0x99')]!==_0xd3c4('0x9a'))return;return _0x146401[_0xd3c4('0x9b')][_0xd3c4('0x9c')]({'attributes':['id'],'raw':!![]})[_0xd3c4('0x37')](function(_0x5c7e7c){if(_['isEmpty'](_0x5c7e7c)){_0x173930[_0xd3c4('0x83')](_0xd3c4('0x9d'));_0x21907b[_0xd3c4('0x83')](_0xd3c4('0x9d'));}else{_0x173930[_0xd3c4('0x83')](_0xd3c4('0x7e'),_[_0xd3c4('0x32')](_0x5c7e7c,'id'));_0x21907b['where']('i.SmsAccountId\x20IN\x20?',_[_0xd3c4('0x32')](_0x5c7e7c,'id'));}});})[_0xd3c4('0x37')](function(){if(_0x146401['user'][_0xd3c4('0x99')]==='agent'&&!_0x11d105&&!_0x146401['query'][_0xd3c4('0x97')])return[];return db[_0xd3c4('0x9e')][_0xd3c4('0x45')](_0x173930[_0xd3c4('0x9f')](),_0x189c91);})[_0xd3c4('0x37')](function(_0xf38e21){_0x4918ee['count']=_0xf38e21[_0xd3c4('0x66')];if(_0x4918ee[_0xd3c4('0x25')]===0x0)return[];return db[_0xd3c4('0x9e')][_0xd3c4('0x45')](_0x44da73[_0xd3c4('0x9f')](),_0x189c91)[_0xd3c4('0x37')](function(_0x42122a){_0x11de3c=_[_0xd3c4('0xa0')](_0x42122a,'id');_0x189c91=_[_0xd3c4('0xa1')](_0x189c91,{'model':db[_0xd3c4('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x146401[_0xd3c4('0x45')][_0xd3c4('0x49')]){_0x2f799a[_0xd3c4('0x47')][_0xd3c4('0x36')](function(_0x18a768){_0x21907b[_0xd3c4('0x4f')]('i.'+_0x18a768);});}else{_0x21907b['field'](_0xd3c4('0x94'),_0xd3c4('0x68'));_0x21907b[_0xd3c4('0x4f')]('a.key','Account.key');_0x21907b[_0xd3c4('0x4f')](_0xd3c4('0xa2'),'Account.mandatoryDisposition');_0x21907b[_0xd3c4('0x4f')](_0xd3c4('0xa3'),_0xd3c4('0xa4'));_0x21907b['field'](_0xd3c4('0xa5'));_0x21907b[_0xd3c4('0x4f')]('c.firstName',_0xd3c4('0xa6'));_0x21907b[_0xd3c4('0x4f')]('c.lastName',_0xd3c4('0xa7'));_0x21907b['field']('c.email',_0xd3c4('0xa8'));_0x21907b[_0xd3c4('0x4f')](_0xd3c4('0xa9'),_0xd3c4('0xaa'));_0x21907b['field'](_0xd3c4('0xab'),_0xd3c4('0xac'));_0x21907b['field'](_0xd3c4('0xad'),_0xd3c4('0xae'));_0x21907b['field'](_0xd3c4('0xaf'),_0xd3c4('0xb0'));_0x21907b[_0xd3c4('0x4f')](_0xd3c4('0xb1'),_0xd3c4('0xb2'));_0x21907b[_0xd3c4('0x4f')](_0xd3c4('0xb3'),_0xd3c4('0x34'));}if(_0x2f799a[_0xd3c4('0x26')])_0x21907b[_0xd3c4('0x26')](_0x2f799a[_0xd3c4('0x26')]);if(_0x2f799a[_0xd3c4('0x23')])_0x21907b['offset'](_0x2f799a['offset']);return db[_0xd3c4('0x9e')]['query'](_0x21907b[_0xd3c4('0x9f')](),_0x189c91);})[_0xd3c4('0x37')](function(_0x49b397){if(_0x49b397['length']>0x0)_0x5edd70['where'](_0xd3c4('0xb4'),_[_0xd3c4('0x32')](_0x49b397,'id'));return db[_0xd3c4('0x9e')][_0xd3c4('0x45')](_0x5edd70[_0xd3c4('0x9f')](),_0x189c91)[_0xd3c4('0x37')](function(_0x553d08){var _0x5bc818=_[_0xd3c4('0xb5')](_0x553d08,'SmsInteractionId');var _0x2c246d=[];_0x49b397[_0xd3c4('0x36')](function(_0x25e338){_0x2c246d[_0xd3c4('0xb6')](updateSmsInteraction(_0x25e338,_0x11de3c,_0x5bc818));});return BPromise[_0xd3c4('0xb7')](_0x2c246d);});});})['then'](function(_0x24b0ed){_0x4918ee['rows']=_0x24b0ed;return _0x4918ee;})[_0xd3c4('0x37')](respondWithFilteredResult(_0x2a11d0,_0x2f799a))[_0xd3c4('0x38')](handleError(_0x2a11d0,null));};exports[_0xd3c4('0xb8')]=function(_0x558326,_0x54c3b5){var _0x88c972={'raw':![],'where':{'id':_0x558326[_0xd3c4('0xb9')]['id']}},_0x17f6d0={};_0x17f6d0['model']=_['keys'](db[_0xd3c4('0x40')][_0xd3c4('0x41')]);_0x17f6d0[_0xd3c4('0x45')]=_[_0xd3c4('0xba')](_0x558326['query']);_0x17f6d0['filters']=_['intersection'](_0x17f6d0[_0xd3c4('0x44')],_0x17f6d0[_0xd3c4('0x45')]);_0x88c972[_0xd3c4('0x47')]=_[_0xd3c4('0x48')](_0x17f6d0[_0xd3c4('0x44')],qs[_0xd3c4('0x49')](_0x558326[_0xd3c4('0x45')][_0xd3c4('0x49')]));_0x88c972[_0xd3c4('0x47')]=_0x88c972['attributes'][_0xd3c4('0x66')]?_0x88c972[_0xd3c4('0x47')]:_0x17f6d0[_0xd3c4('0x44')];if(_0x558326[_0xd3c4('0x45')][_0xd3c4('0xbb')]){_0x88c972[_0xd3c4('0xbc')]=[{'all':!![]}];}_0x88c972=_[_0xd3c4('0xa1')]({},_0x88c972,_0x558326['options']);return db[_0xd3c4('0x40')]['find'](_0x88c972)[_0xd3c4('0x37')](handleEntityNotFound(_0x54c3b5,null))['then'](respondWithResult(_0x54c3b5,null))[_0xd3c4('0x38')](handleError(_0x54c3b5,null));};exports[_0xd3c4('0xbd')]=function(_0x52fa76,_0x277393){return db[_0xd3c4('0x40')]['create'](_0x52fa76[_0xd3c4('0x7a')],{})[_0xd3c4('0x37')](respondWithResult(_0x277393,0xc9))[_0xd3c4('0x38')](handleError(_0x277393,null));};exports[_0xd3c4('0x2e')]=function(_0x46049f,_0x1b0253){if(_0x46049f[_0xd3c4('0x7a')]['id']){delete _0x46049f[_0xd3c4('0x7a')]['id'];}return db[_0xd3c4('0x40')][_0xd3c4('0x67')]({'where':{'id':_0x46049f[_0xd3c4('0xb9')]['id']}})[_0xd3c4('0x37')](handleEntityNotFound(_0x1b0253,null))[_0xd3c4('0x37')](saveUpdates(_0x46049f[_0xd3c4('0x7a')],null))[_0xd3c4('0x37')](respondWithResult(_0x1b0253,null))[_0xd3c4('0x38')](handleError(_0x1b0253,null));};exports[_0xd3c4('0xbe')]=function(_0x106077,_0x233d3a){return db[_0xd3c4('0x40')][_0xd3c4('0x67')]({'where':{'id':_0x106077[_0xd3c4('0xb9')]['id']}})[_0xd3c4('0x37')](handleEntityNotFound(_0x233d3a,null))[_0xd3c4('0x37')](removeEntity(_0x233d3a,null))['catch'](handleError(_0x233d3a,null));};exports['describe']=function(_0x14ad36,_0x1b4a95){return db[_0xd3c4('0x40')]['describe']()['then'](respondWithResult(_0x1b4a95,null))['catch'](handleError(_0x1b4a95,null));};exports[_0xd3c4('0xbf')]=function(_0x595e93,_0x42159d,_0x3b5f93){return db[_0xd3c4('0xc0')][_0xd3c4('0x67')]({'where':{'id':_0x595e93['params']['id']}})[_0xd3c4('0x37')](handleEntityNotFound(_0x42159d,null))[_0xd3c4('0x37')](function(_0x5a4693){if(_0x5a4693){return _0x5a4693[_0xd3c4('0xbf')](_0x595e93[_0xd3c4('0x7a')][_0xd3c4('0xc1')],_[_0xd3c4('0xc2')](_0x595e93[_0xd3c4('0x7a')],[_0xd3c4('0xc1'),'id'])||{});}})[_0xd3c4('0x37')](respondWithResult(_0x42159d,null))['catch'](handleError(_0x42159d,null));};exports['getMessages']=function(_0x5612d0,_0x4c3e48,_0x2ba254){var _0x3f9abe={'raw':![],'where':{}};var _0x1b25ec={};var _0x8acbcd={'count':0x0,'rows':[]};return db[_0xd3c4('0x40')]['findOne']({'where':{'id':_0x5612d0['params']['id']}})[_0xd3c4('0x37')](handleEntityNotFound(_0x4c3e48,null))[_0xd3c4('0x37')](function(_0x1d00ce){if(_0x1d00ce){_0x1b25ec[_0xd3c4('0x44')]=_[_0xd3c4('0xba')](db[_0xd3c4('0xc0')][_0xd3c4('0x41')]);_0x1b25ec[_0xd3c4('0x45')]=_[_0xd3c4('0xba')](_0x5612d0[_0xd3c4('0x45')]);_0x1b25ec['filters']=_['intersection'](_0x1b25ec['model'],_0x1b25ec[_0xd3c4('0x45')]);_0x3f9abe[_0xd3c4('0x47')]=_[_0xd3c4('0x48')](_0x1b25ec[_0xd3c4('0x44')],qs[_0xd3c4('0x49')](_0x5612d0['query'][_0xd3c4('0x49')]));_0x3f9abe[_0xd3c4('0x47')]=_0x3f9abe[_0xd3c4('0x47')][_0xd3c4('0x66')]?_0x3f9abe['attributes']:_0x1b25ec['model'];if(!_0x5612d0['query']['hasOwnProperty']('nolimit')){_0x3f9abe[_0xd3c4('0x26')]=qs[_0xd3c4('0x26')](_0x5612d0['query'][_0xd3c4('0x26')]);_0x3f9abe[_0xd3c4('0x23')]=qs[_0xd3c4('0x23')](_0x5612d0[_0xd3c4('0x45')]['offset']);}_0x3f9abe[_0xd3c4('0x4b')]=qs['sort'](_0x5612d0[_0xd3c4('0x45')]['sort']);_0x3f9abe[_0xd3c4('0x83')]=qs[_0xd3c4('0x46')](_[_0xd3c4('0x4d')](_0x5612d0[_0xd3c4('0x45')],_0x1b25ec[_0xd3c4('0x46')]));_0x3f9abe['where']['SmsInteractionId']=_0x1d00ce['id'];if(_0x5612d0['query'][_0xd3c4('0x8b')]){_0x3f9abe['where']=_[_0xd3c4('0xa1')](_0x3f9abe['where'],{'$or':_[_0xd3c4('0x32')](_0x3f9abe['attributes'],function(_0xdece44){var _0x2efe28={};_0x2efe28[_0xdece44]={'$like':'%'+_0x5612d0[_0xd3c4('0x45')][_0xd3c4('0x8b')]+'%'};return _0x2efe28;})});}if(_0x5612d0[_0xd3c4('0x45')]['$gte']){var _0x2abe97=_0x5612d0[_0xd3c4('0x45')]['$gte'][_0xd3c4('0x35')](',');var _0x3ccc53={};_0x3ccc53[_0x2abe97[0x0]]={'$gte':moment(_0x2abe97[0x1])[_0xd3c4('0xc3')](_0xd3c4('0xc4'))};_0x3f9abe[_0xd3c4('0x83')]=_[_0xd3c4('0xa1')](_0x3f9abe['where'],_0x3ccc53);}_0x3f9abe=_[_0xd3c4('0xa1')]({},_0x3f9abe,_0x5612d0['options']);return db[_0xd3c4('0xc0')][_0xd3c4('0x25')]({'where':_0x3f9abe[_0xd3c4('0x83')]})[_0xd3c4('0x37')](function(_0x5caf3e){_0x8acbcd[_0xd3c4('0x25')]=_0x5caf3e;if(_0x5612d0[_0xd3c4('0x45')][_0xd3c4('0xbb')]){_0x3f9abe[_0xd3c4('0xbc')]=[{'all':!![]}];}return db[_0xd3c4('0xc0')][_0xd3c4('0xc5')](_0x3f9abe);})['then'](function(_0x1e0239){_0x8acbcd[_0xd3c4('0xc6')]=_0x1e0239;return _0x8acbcd;});}})[_0xd3c4('0x37')](respondWithFilteredResult(_0x4c3e48,_0x3f9abe))[_0xd3c4('0x38')](handleError(_0x4c3e48,null));};exports[_0xd3c4('0xc7')]=function(_0x4ba276,_0x39a8a2,_0x4b6951){return db[_0xd3c4('0x40')][_0xd3c4('0x67')]({'where':{'id':_0x4ba276[_0xd3c4('0xb9')]['id']}})['then'](handleEntityNotFound(_0x39a8a2,null))[_0xd3c4('0x37')](function(_0x46f448){if(_0x46f448){return _0x46f448[_0xd3c4('0xc8')](_0x4ba276['body'][_0xd3c4('0xc1')],_[_0xd3c4('0xc2')](_0x4ba276['body'],[_0xd3c4('0xc1'),'id'])||{})[_0xd3c4('0xc9')](function(){return db[_0xd3c4('0x73')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4ba276['body'][_0xd3c4('0xc1')]}});})[_0xd3c4('0x37')](function(_0x34dcfb){socket['emit'](_0xd3c4('0xca'),{'id':Number(_0x4ba276['params']['id']),'tags':_0x34dcfb||[]});return{'id':Number(_0x4ba276[_0xd3c4('0xb9')]['id']),'tags':_0x34dcfb||[]};});}})[_0xd3c4('0x37')](respondWithResult(_0x39a8a2,null))[_0xd3c4('0x38')](handleError(_0x39a8a2,null));};exports[_0xd3c4('0xcb')]=function(_0x795cb7,_0x116eaa,_0x550c87){return db[_0xd3c4('0x40')][_0xd3c4('0x67')]({'where':{'id':_0x795cb7[_0xd3c4('0xb9')]['id']}})[_0xd3c4('0x37')](handleEntityNotFound(_0x116eaa,null))[_0xd3c4('0x37')](function(_0x15fec7){if(_0x15fec7){return _0x15fec7['removeTags'](_0x795cb7[_0xd3c4('0x45')][_0xd3c4('0xc1')]);}})[_0xd3c4('0x37')](respondWithStatusCode(_0x116eaa,null))['catch'](handleError(_0x116eaa,null));};exports[_0xd3c4('0xcc')]=function(_0x4735fa,_0x8196fe){var _0x49e574=moment()[_0xd3c4('0xcd')]()['toString']();var _0x10c488=path[_0xd3c4('0xce')](config[_0xd3c4('0xcf')],_0xd3c4('0xd0'),_0xd3c4('0xd1'),'tmp');var _0x2740b7=path[_0xd3c4('0xce')](config[_0xd3c4('0xcf')],_0xd3c4('0xd0'),_0xd3c4('0xd1'),_0xd3c4('0xd2'));var _0x56a364=path[_0xd3c4('0xce')](_0x10c488,_0x49e574);var _0x4dad3b=util[_0xd3c4('0xc3')](_0xd3c4('0xd3'),_0x4735fa[_0xd3c4('0xb9')]['id'],_0x49e574);var _0x4b53a1=path[_0xd3c4('0xce')](_0x10c488,_0x4dad3b);var _0x15e04a=[];_0x15e04a['push']({'model':db[_0xd3c4('0xd4')],'as':_0xd3c4('0xd4'),'attributes':['id',_0xd3c4('0x33')],'raw':!![]});_0x15e04a[_0xd3c4('0xb6')]({'model':db[_0xd3c4('0xd5')],'as':_0xd3c4('0x6c'),'attributes':['id',_0xd3c4('0xd6'),'lastName'],'raw':!![]});var _0x52317f=[{'model':db[_0xd3c4('0xc0')],'as':_0xd3c4('0xd7'),'attributes':['id',_0xd3c4('0x7a'),'createdAt','direction',_0xd3c4('0xd8'),_0xd3c4('0x88')],'include':_0x15e04a}];_0x52317f['push']({'model':db[_0xd3c4('0xd9')],'as':'Account','attributes':['id',_0xd3c4('0x30')]});_0x52317f[_0xd3c4('0xb6')]({'model':db[_0xd3c4('0xd4')],'as':'Owner','attributes':['id',_0xd3c4('0x33')]});return db[_0xd3c4('0x40')][_0xd3c4('0x67')]({'where':{'id':_0x4735fa[_0xd3c4('0xb9')]['id']},'include':_0x52317f})['then'](handleEntityNotFound(_0x8196fe,null))['then'](function(_0x1c924d){if(_0x1c924d){var _0x2e5a36=_0x1c924d['get']({'plain':!![]});fs['mkdirSync'](_0x56a364);var _0x572163={'channel':_0xd3c4('0xda'),'account':_0x2e5a36['Account'][_0xd3c4('0x30')],'agent':_0x2e5a36[_0xd3c4('0xdb')]?_0x2e5a36[_0xd3c4('0xdb')][_0xd3c4('0x33')]:_0xd3c4('0xdc'),'createdAt':moment(_0x2e5a36['createdAt'])[_0xd3c4('0xc3')](_0xd3c4('0xc4'))[_0xd3c4('0x9f')](),'closedAt':_0x2e5a36[_0xd3c4('0x3c')]?moment(_0x2e5a36[_0xd3c4('0xdd')])[_0xd3c4('0xc3')](_0xd3c4('0xc4'))['toString']():'','disposition':_0x2e5a36[_0xd3c4('0xde')],'messages':_(_0x2e5a36['Messages'])[_0xd3c4('0x8b')]({'secret':![]})[_0xd3c4('0x32')](function(_0x45fd9d){return{'date':moment(_0x45fd9d['createdAt'])[_0xd3c4('0xc3')](_0xd3c4('0xc4'))[_0xd3c4('0x9f')](),'sender':_0x45fd9d[_0xd3c4('0xdf')]==='out'?_0x45fd9d[_0xd3c4('0xd4')]?_0x45fd9d[_0xd3c4('0xd4')][_0xd3c4('0x33')]:_0xd3c4('0xe0'):_0x45fd9d[_0xd3c4('0x6c')]['firstName']+(_0x45fd9d[_0xd3c4('0x6c')][_0xd3c4('0xe1')]?'\x20'+_0x45fd9d[_0xd3c4('0x6c')][_0xd3c4('0xe1')]:''),'body':_0x45fd9d[_0xd3c4('0x7a')],'direction':_0x45fd9d['direction']==='out'?'A':'C','secret':_0x45fd9d['secret'],'read':_0x45fd9d[_0xd3c4('0x88')]};})['value']()};return ejs[_0xd3c4('0xe2')](path[_0xd3c4('0xce')](config[_0xd3c4('0xcf')],_0xd3c4('0xd0'),_0xd3c4('0xe3'),_0xd3c4('0xe4')),{'interaction':_0x572163})[_0xd3c4('0x37')](function(_0x261718){var _0x19285f=path['join'](_0x56a364,'transcript-'+_0x2e5a36['id']+'-'+_0x49e574+'.pdf');var _0x2c7590={'path':_0x19285f,'channel':_0xd3c4('0xda'),'interactionId':_0x2e5a36['id']};return pdf[_0xd3c4('0xe5')](_0x261718,_0x2c7590);})['then'](function(){return new BPromise(function(_0x439f19,_0x360593){zipdir(_0x56a364,{'saveTo':_0x4b53a1},function(_0x44f086,_0x5aa8ca){if(_0x44f086)return _0x360593(_0x44f086);return _0x439f19(_0x5aa8ca);});})[_0xd3c4('0x37')](function(){return new BPromise(function(_0x330265,_0x5ae019){rimraf(_0x56a364,function(_0x18a8a6){if(_0x18a8a6)_0x5ae019(_0x18a8a6);return _0x330265();});});})[_0xd3c4('0x37')](function(){return _0x8196fe[_0xd3c4('0xcc')](_0x4b53a1,_0x4dad3b,function(_0x12e25d){if(_0x12e25d){console[_0xd3c4('0xe6')](_0xd3c4('0xe7'),_0x12e25d);}else{fs[_0xd3c4('0xe8')](_0x4b53a1);}});});});}else{return _0x8196fe[_0xd3c4('0x21')](0xc8);}})[_0xd3c4('0x38')](handleError(_0x8196fe,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index ed65624..ef76fe5 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 _0x93e9=['getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x44b4ba,_0x4c479f){var _0x21bef9=function(_0x546389){while(--_0x546389){_0x44b4ba['push'](_0x44b4ba['shift']());}};_0x21bef9(++_0x4c479f);}(_0x93e9,0xcc));var _0x993e=function(_0x2c862e,_0x13279c){_0x2c862e=_0x2c862e-0x0;var _0x2ec7ab=_0x93e9[_0x2c862e];return _0x2ec7ab;};'use strict';var EventEmitter=require(_0x993e('0x0'));var SmsInteraction=require(_0x993e('0x1'))['db'][_0x993e('0x2')];var SmsMessage=require(_0x993e('0x1'))['db'][_0x993e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x993e('0x4')](0x0);var events={'afterCreate':_0x993e('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b762e){return function(_0x255045,_0x15ce9b,_0x45f52e){_0x255045[_0x993e('0x6')]({'attributes':['id'],'raw':!![]})[_0x993e('0x7')](function(_0x12ac94){_0x255045[_0x993e('0x8')]('Users',_0x12ac94[_0x993e('0x9')](function(_0x69ff1){return{'id':_0x69ff1['id']};}));return SmsMessage[_0x993e('0xa')]({'where':{'SmsInteractionId':_0x255045['id'],'direction':'in','read':![]},'raw':!![]});})[_0x993e('0x7')](function(_0x2cd389){_0x255045[_0x993e('0x8')](_0x993e('0xb'),_0x2cd389['length']);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e+':'+_0x255045['id'],_0x255045);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e,_0x255045);_0x45f52e(null);})['catch'](_0x45f52e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x993e('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5f2f=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','Users','map','setDataValue','length'];(function(_0x4a061f,_0x503b5f){var _0x362146=function(_0x75dcfb){while(--_0x75dcfb){_0x4a061f['push'](_0x4a061f['shift']());}};_0x362146(++_0x503b5f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f5738,_0x35171f){_0x4f5738=_0x4f5738-0x0;var _0x4753f0=_0x5f2f[_0x4f5738];return _0x4753f0;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var SmsInteraction=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var SmsMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf5f2('0x4')](0x0);var events={'afterCreate':_0xf5f2('0x5'),'afterUpdate':_0xf5f2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4854b6){return function(_0x1665c7,_0x192215,_0xad7f65){_0x1665c7[_0xf5f2('0x7')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x8')](function(_0x473100){_0x1665c7['setDataValue'](_0xf5f2('0x9'),_0x473100[_0xf5f2('0xa')](function(_0x2ec345){return{'id':_0x2ec345['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1665c7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5f2('0x8')](function(_0x15dd7c){_0x1665c7[_0xf5f2('0xb')]('unreadMessages',_0x15dd7c[_0xf5f2('0xc')]);SmsInteractionEvents['emit'](_0x4854b6+':'+_0x1665c7['id'],_0x1665c7);SmsInteractionEvents['emit'](_0x4854b6,_0x1665c7);_0xad7f65(null);})[_0xf5f2('0xd')](_0xad7f65(null));};}for(var e in events){if(events[_0xf5f2('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xf5f2('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index e86fb88..1311275 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 _0x83d6=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','util','api','bluebird','request-promise','path'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x83d6,0x1db));var _0x683d=function(_0x1ef3fd,_0x2532fd){_0x1ef3fd=_0x1ef3fd-0x0;var _0x2a31a1=_0x83d6[_0x1ef3fd];return _0x2a31a1;};'use strict';var _=require('lodash');var util=require(_0x683d('0x0'));var logger=require('../../config/logger')(_0x683d('0x1'));var moment=require('moment');var BPromise=require(_0x683d('0x2'));var rp=require(_0x683d('0x3'));var fs=require('fs');var path=require(_0x683d('0x4'));var rimraf=require('rimraf');var config=require(_0x683d('0x5'));var attributes=require(_0x683d('0x6'));module[_0x683d('0x7')]=function(_0x3f5279,_0x4ff1d2){return _0x3f5279[_0x683d('0x8')](_0x683d('0x9'),attributes,{'tableName':_0x683d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x148c79,_0x3edfdb,_0x15e3dd){if(_0x148c79[_0x683d('0xb')](_0x683d('0xc'))){_0x148c79[_0x683d('0xd')]=moment()[_0x683d('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15e3dd(null,_0x148c79);}}});}; \ No newline at end of file +var _0xff29=['closedAt','format','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed'];(function(_0x3ac856,_0x5ced85){var _0x39ceee=function(_0x4ef551){while(--_0x4ef551){_0x3ac856['push'](_0x3ac856['shift']());}};_0x39ceee(++_0x5ced85);}(_0xff29,0x182));var _0x9ff2=function(_0x29836d,_0x1babe6){_0x29836d=_0x29836d-0x0;var _0x537c4d=_0xff29[_0x29836d];return _0x537c4d;};'use strict';var _=require('lodash');var util=require(_0x9ff2('0x0'));var logger=require(_0x9ff2('0x1'))(_0x9ff2('0x2'));var moment=require(_0x9ff2('0x3'));var BPromise=require(_0x9ff2('0x4'));var rp=require(_0x9ff2('0x5'));var fs=require('fs');var path=require(_0x9ff2('0x6'));var rimraf=require('rimraf');var config=require(_0x9ff2('0x7'));var attributes=require(_0x9ff2('0x8'));module[_0x9ff2('0x9')]=function(_0x2cbd00,_0x2e9281){return _0x2cbd00['define'](_0x9ff2('0xa'),attributes,{'tableName':_0x9ff2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc5b6b9,_0x451482,_0x5463b4){if(_0xc5b6b9[_0x9ff2('0xc')](_0x9ff2('0xd'))){_0xc5b6b9[_0x9ff2('0xe')]=moment()[_0x9ff2('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5463b4(null,_0xc5b6b9);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 835b9f6..70fdf9c 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 _0x8a70=['body','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','options','raw','where','attributes','limit','UpdateSmsInteraction','stringify','find','addTags'];(function(_0x1d949c,_0x596176){var _0x29e31b=function(_0x15c93a){while(--_0x15c93a){_0x1d949c['push'](_0x1d949c['shift']());}};_0x29e31b(++_0x596176);}(_0x8a70,0xfb));var _0x08a7=function(_0x3a9bde,_0x5886ae){_0x3a9bde=_0x3a9bde-0x0;var _0x58efa2=_0x8a70[_0x3a9bde];return _0x58efa2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08a7('0x0'));var BPromise=require(_0x08a7('0x1'));var rs=require(_0x08a7('0x2'));var fs=require('fs');var Redis=require(_0x08a7('0x3'));var db=require(_0x08a7('0x4'))['db'];var utils=require(_0x08a7('0x5'));var logger=require('../../config/logger')(_0x08a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x08a7('0x7'));var client=jayson[_0x08a7('0x8')]['http']({'port':0x232a});config[_0x08a7('0x9')]=_[_0x08a7('0xa')](config['redis'],{'host':_0x08a7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08a7('0x9')]));require(_0x08a7('0xc'))[_0x08a7('0xd')](socket);function respondWithRpcPromise(_0x38467e,_0x505994,_0x281a1e){return new BPromise(function(_0x63d654,_0x9a1085){return client['request'](_0x38467e,_0x281a1e)[_0x08a7('0xe')](function(_0x3ca388){logger[_0x08a7('0xf')](_0x08a7('0x10'),_0x505994,_0x08a7('0x11'));logger[_0x08a7('0x12')](_0x08a7('0x13'),_0x505994,'request\x20sent',JSON['stringify'](_0x3ca388));if(_0x3ca388[_0x08a7('0x14')]){if(_0x3ca388[_0x08a7('0x14')][_0x08a7('0x15')]===0x1f4){logger[_0x08a7('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x505994,_0x3ca388['error'][_0x08a7('0x16')]);return _0x9a1085(_0x3ca388['error']['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x505994,_0x3ca388['error'][_0x08a7('0x16')]);return _0x63d654(_0x3ca388['error'][_0x08a7('0x16')]);}else{logger['info'](_0x08a7('0x10'),_0x505994,_0x08a7('0x11'));_0x63d654(_0x3ca388[_0x08a7('0x17')]['message']);}})[_0x08a7('0x18')](function(_0x516989){logger[_0x08a7('0x14')](_0x08a7('0x10'),_0x505994,_0x516989);_0x9a1085(_0x516989);});});}exports['UpdateSmsInteraction']=function(_0x45f1dd){var _0x1b21a9=this;return new Promise(function(_0xba6c63,_0x3b5137){return db[_0x08a7('0x19')][_0x08a7('0x1a')](_0x45f1dd['body'],{'raw':_0x45f1dd[_0x08a7('0x1b')]?_0x45f1dd[_0x08a7('0x1b')][_0x08a7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f1dd['options']?_0x45f1dd[_0x08a7('0x1b')][_0x08a7('0x1d')]||null:null,'attributes':_0x45f1dd['options']?_0x45f1dd['options'][_0x08a7('0x1e')]||null:null,'limit':_0x45f1dd[_0x08a7('0x1b')]?_0x45f1dd[_0x08a7('0x1b')][_0x08a7('0x1f')]||null:null})[_0x08a7('0xe')](function(_0x4ea08c){logger[_0x08a7('0xf')](_0x08a7('0x20'),_0x45f1dd);logger[_0x08a7('0x12')](_0x08a7('0x20'),_0x45f1dd,JSON[_0x08a7('0x21')](_0x4ea08c));_0xba6c63(_0x4ea08c);})[_0x08a7('0x18')](function(_0x11698f){logger[_0x08a7('0x14')]('UpdateSmsInteraction',_0x11698f['message'],_0x45f1dd);_0x3b5137(_0x1b21a9[_0x08a7('0x14')](0x1f4,_0x11698f['message']));});});};exports['AddTagsToSmsInteraction']=function(_0xd26fff){return new Promise(function(_0x128802,_0x5980f3){return db[_0x08a7('0x19')][_0x08a7('0x22')]({'where':_0xd26fff[_0x08a7('0x1b')]?_0xd26fff['options'][_0x08a7('0x1d')]||null:null})['then'](function(_0x3f60dc){if(_0x3f60dc){return _0x3f60dc[_0x08a7('0x23')](_0xd26fff[_0x08a7('0x24')][_0x08a7('0x25')],_[_0x08a7('0x26')](_0xd26fff[_0x08a7('0x24')],[_0x08a7('0x25'),'id'])||{});}})[_0x08a7('0x27')](function(_0x3139b6){logger['info'](_0x08a7('0x28'),_0xd26fff);logger[_0x08a7('0x12')](_0x08a7('0x28'),_0xd26fff,JSON[_0x08a7('0x21')](_0x3139b6));_0x128802(_0x3139b6);})[_0x08a7('0x18')](function(_0x2f87bb){logger[_0x08a7('0x14')](_0x08a7('0x28'),_0x2f87bb[_0x08a7('0x16')],_0xd26fff);_0x5980f3(_this[_0x08a7('0x14')](0x1f4,_0x2f87bb['message']));});});}; \ No newline at end of file +var _0xb7ed=['where','attributes','limit','stringify','SmsInteraction','find','addTags','ids','omit','AddTags','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','update','body','options','raw'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xb7ed,0x1d2));var _0xdb7e=function(_0x36147b,_0x57f40b){_0x36147b=_0x36147b-0x0;var _0x141351=_0xb7ed[_0x36147b];return _0x141351;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdb7e('0x0'));var BPromise=require('bluebird');var rs=require(_0xdb7e('0x1'));var fs=require('fs');var Redis=require(_0xdb7e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb7e('0x3'))('rpc');var config=require(_0xdb7e('0x4'));var jayson=require(_0xdb7e('0x5'));var client=jayson[_0xdb7e('0x6')]['http']({'port':0x232a});config[_0xdb7e('0x7')]=_[_0xdb7e('0x8')](config[_0xdb7e('0x7')],{'host':_0xdb7e('0x9'),'port':0x18eb});var socket=require(_0xdb7e('0xa'))(new Redis(config[_0xdb7e('0x7')]));require('./smsInteraction.socket')[_0xdb7e('0xb')](socket);function respondWithRpcPromise(_0x562693,_0x49b737,_0x305954){return new BPromise(function(_0x347496,_0x5cbfd4){return client[_0xdb7e('0xc')](_0x562693,_0x305954)[_0xdb7e('0xd')](function(_0x3b507f){logger[_0xdb7e('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x49b737,_0xdb7e('0xf'));logger[_0xdb7e('0x10')](_0xdb7e('0x11'),_0x49b737,_0xdb7e('0xf'),JSON['stringify'](_0x3b507f));if(_0x3b507f[_0xdb7e('0x12')]){if(_0x3b507f[_0xdb7e('0x12')]['code']===0x1f4){logger[_0xdb7e('0x12')](_0xdb7e('0x13'),_0x49b737,_0x3b507f[_0xdb7e('0x12')]['message']);return _0x5cbfd4(_0x3b507f[_0xdb7e('0x12')][_0xdb7e('0x14')]);}logger[_0xdb7e('0x12')](_0xdb7e('0x13'),_0x49b737,_0x3b507f['error'][_0xdb7e('0x14')]);return _0x347496(_0x3b507f[_0xdb7e('0x12')]['message']);}else{logger['info'](_0xdb7e('0x13'),_0x49b737,_0xdb7e('0xf'));_0x347496(_0x3b507f[_0xdb7e('0x15')][_0xdb7e('0x14')]);}})[_0xdb7e('0x16')](function(_0x51f38d){logger[_0xdb7e('0x12')](_0xdb7e('0x13'),_0x49b737,_0x51f38d);_0x5cbfd4(_0x51f38d);});});}exports[_0xdb7e('0x17')]=function(_0x4f56c1){var _0x530dc8=this;return new Promise(function(_0x53ecbe,_0x30563d){return db['SmsInteraction'][_0xdb7e('0x18')](_0x4f56c1[_0xdb7e('0x19')],{'raw':_0x4f56c1['options']?_0x4f56c1[_0xdb7e('0x1a')][_0xdb7e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f56c1[_0xdb7e('0x1a')]?_0x4f56c1['options'][_0xdb7e('0x1c')]||null:null,'attributes':_0x4f56c1[_0xdb7e('0x1a')]?_0x4f56c1[_0xdb7e('0x1a')][_0xdb7e('0x1d')]||null:null,'limit':_0x4f56c1['options']?_0x4f56c1[_0xdb7e('0x1a')][_0xdb7e('0x1e')]||null:null})['then'](function(_0x4f4a6c){logger[_0xdb7e('0xe')](_0xdb7e('0x17'),_0x4f56c1);logger['debug'](_0xdb7e('0x17'),_0x4f56c1,JSON[_0xdb7e('0x1f')](_0x4f4a6c));_0x53ecbe(_0x4f4a6c);})[_0xdb7e('0x16')](function(_0x32c385){logger[_0xdb7e('0x12')](_0xdb7e('0x17'),_0x32c385[_0xdb7e('0x14')],_0x4f56c1);_0x30563d(_0x530dc8[_0xdb7e('0x12')](0x1f4,_0x32c385[_0xdb7e('0x14')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2305de){return new Promise(function(_0x4f644d,_0x1edb5b){return db[_0xdb7e('0x20')][_0xdb7e('0x21')]({'where':_0x2305de[_0xdb7e('0x1a')]?_0x2305de[_0xdb7e('0x1a')][_0xdb7e('0x1c')]||null:null})[_0xdb7e('0xd')](function(_0x48fa59){if(_0x48fa59){return _0x48fa59[_0xdb7e('0x22')](_0x2305de['body'][_0xdb7e('0x23')],_[_0xdb7e('0x24')](_0x2305de['body'],[_0xdb7e('0x23'),'id'])||{});}})['spread'](function(_0x5b97ea){logger[_0xdb7e('0xe')](_0xdb7e('0x25'),_0x2305de);logger['debug']('AddTags',_0x2305de,JSON['stringify'](_0x5b97ea));_0x4f644d(_0x5b97ea);})[_0xdb7e('0x16')](function(_0x184c18){logger[_0xdb7e('0x12')](_0xdb7e('0x25'),_0x184c18['message'],_0x2305de);_0x1edb5b(_this[_0xdb7e('0x12')](0x1f4,_0x184c18['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a05c30c..f76a9e6 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 _0xb3aa=['smsInteraction:','./smsInteraction.events','update','emit','register','length'];(function(_0x469ae2,_0x24cd30){var _0x5e33e4=function(_0x1aaeb1){while(--_0x1aaeb1){_0x469ae2['push'](_0x469ae2['shift']());}};_0x5e33e4(++_0x24cd30);}(_0xb3aa,0xaf));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var SmsInteractionEvents=require(_0xab3a('0x0'));var events=['save','remove',_0xab3a('0x1')];function createListener(_0x153f92,_0x2a2174){return function(_0x1a63a6){_0x2a2174[_0xab3a('0x2')](_0x153f92,_0x1a63a6);};}function removeListener(_0x34241a,_0x3858b1){return function(){SmsInteractionEvents['removeListener'](_0x34241a,_0x3858b1);};}exports[_0xab3a('0x3')]=function(_0x131a8b){for(var _0x594c6a=0x0,_0x55841e=events[_0xab3a('0x4')];_0x594c6a<_0x55841e;_0x594c6a++){var _0x12b0a8=events[_0x594c6a];var _0x4e4919=createListener(_0xab3a('0x5')+_0x12b0a8,_0x131a8b);SmsInteractionEvents['on'](_0x12b0a8,_0x4e4919);}}; \ No newline at end of file +var _0x3080=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x3080,0xec));var _0x0308=function(_0xbe5e43,_0x4e46c8){_0xbe5e43=_0xbe5e43-0x0;var _0x5f3a45=_0x3080[_0xbe5e43];return _0x5f3a45;};'use strict';var SmsInteractionEvents=require(_0x0308('0x0'));var events=[_0x0308('0x1'),_0x0308('0x2'),_0x0308('0x3')];function createListener(_0xffc88,_0x3976c9){return function(_0x167454){_0x3976c9[_0x0308('0x4')](_0xffc88,_0x167454);};}function removeListener(_0x28dab6,_0x5296a8){return function(){SmsInteractionEvents[_0x0308('0x5')](_0x28dab6,_0x5296a8);};}exports[_0x0308('0x6')]=function(_0x98b89f){for(var _0x1da90e=0x0,_0xc07209=events[_0x0308('0x7')];_0x1da90e<_0xc07209;_0x1da90e++){var _0x549f2b=events[_0x1da90e];var _0x1b85af=createListener(_0x0308('0x8')+_0x549f2b,_0x98b89f);SmsInteractionEvents['on'](_0x549f2b,_0x1b85af);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index feb2e21..5792c40 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 _0x3e05=['sms','smsmessage:create','create','/:id/status','status','put','/:id','update','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked'];(function(_0x32c7b5,_0x102aa2){var _0x1b1532=function(_0x208550){while(--_0x208550){_0x32c7b5['push'](_0x32c7b5['shift']());}};_0x1b1532(++_0x102aa2);}(_0x3e05,0x64));var _0x53e0=function(_0x2cfd53,_0x55a1d5){_0x2cfd53=_0x2cfd53-0x0;var _0x1df864=_0x3e05[_0x2cfd53];return _0x1df864;};'use strict';var multer=require('multer');var util=require(_0x53e0('0x0'));var path=require(_0x53e0('0x1'));var timeout=require(_0x53e0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x53e0('0x3'));var auth=require(_0x53e0('0x4'));var interaction=require(_0x53e0('0x5'));var config=require(_0x53e0('0x6'));var controller=require(_0x53e0('0x7'));router[_0x53e0('0x8')]('/',auth[_0x53e0('0x9')](),controller[_0x53e0('0xa')]);router[_0x53e0('0x8')](_0x53e0('0xb'),auth['isAuthenticated'](),controller[_0x53e0('0xc')]);router['get']('/:id',auth[_0x53e0('0x9')](),controller[_0x53e0('0xd')]);router[_0x53e0('0xe')]('/',auth[_0x53e0('0x9')](),interaction[_0x53e0('0xf')](_0x53e0('0x10'),_0x53e0('0x11')),controller[_0x53e0('0x12')]);router['post'](_0x53e0('0x13'),controller[_0x53e0('0x14')]);router[_0x53e0('0x15')](_0x53e0('0x16'),auth[_0x53e0('0x9')](),controller[_0x53e0('0x17')]);router[_0x53e0('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0x53e0('0x18')]);router[_0x53e0('0x15')](_0x53e0('0x19'),auth[_0x53e0('0x9')](),controller[_0x53e0('0x1a')]);router['delete'](_0x53e0('0x16'),auth[_0x53e0('0x9')](),controller[_0x53e0('0x1b')]);module[_0x53e0('0x1c')]=router; \ No newline at end of file +var _0x0d99=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','smsmessage:create','create','status','put','/:id/accept','accept','reject','destroy','exports'];(function(_0x1c1cd0,_0x4b5ae7){var _0x3af1b2=function(_0x2c67b5){while(--_0x2c67b5){_0x1c1cd0['push'](_0x1c1cd0['shift']());}};_0x3af1b2(++_0x4b5ae7);}(_0x0d99,0x1d4));var _0x90d9=function(_0x2a4d07,_0x4144a4){_0x2a4d07=_0x2a4d07-0x0;var _0x204644=_0x0d99[_0x2a4d07];return _0x204644;};'use strict';var multer=require(_0x90d9('0x0'));var util=require(_0x90d9('0x1'));var path=require(_0x90d9('0x2'));var timeout=require(_0x90d9('0x3'));var express=require(_0x90d9('0x4'));var router=express[_0x90d9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x90d9('0x6'));var interaction=require(_0x90d9('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x90d9('0x8')]('/',auth[_0x90d9('0x9')](),controller[_0x90d9('0xa')]);router[_0x90d9('0x8')](_0x90d9('0xb'),auth[_0x90d9('0x9')](),controller[_0x90d9('0xc')]);router[_0x90d9('0x8')](_0x90d9('0xd'),auth[_0x90d9('0x9')](),controller['show']);router[_0x90d9('0xe')]('/',auth[_0x90d9('0x9')](),interaction[_0x90d9('0xf')](_0x90d9('0x10'),_0x90d9('0x11')),controller[_0x90d9('0x12')]);router[_0x90d9('0xe')]('/:id/status',controller[_0x90d9('0x13')]);router[_0x90d9('0x14')](_0x90d9('0xd'),auth[_0x90d9('0x9')](),controller['update']);router[_0x90d9('0x14')](_0x90d9('0x15'),auth[_0x90d9('0x9')](),controller[_0x90d9('0x16')]);router[_0x90d9('0x14')]('/:id/reject',auth[_0x90d9('0x9')](),controller[_0x90d9('0x17')]);router['delete'](_0x90d9('0xd'),auth[_0x90d9('0x9')](),controller[_0x90d9('0x18')]);module[_0x90d9('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5c18b42..758cccb 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 _0x7250=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x4aed0a,_0x3f4a74){var _0x2a2430=function(_0x43639b){while(--_0x43639b){_0x4aed0a['push'](_0x4aed0a['shift']());}};_0x2a2430(++_0x3f4a74);}(_0x7250,0x1b1));var _0x0725=function(_0x3bded1,_0x485fa1){_0x3bded1=_0x3bded1-0x0;var _0x184881=_0x7250[_0x3bded1];return _0x184881;};'use strict';var Sequelize=require(_0x0725('0x0'));module[_0x0725('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0725('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0725('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0725('0x4')]('in',_0x0725('0x5')),'defaultValue':_0x0725('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0725('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0725('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0725('0x8')]}}; \ No newline at end of file +var _0x34f8=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x2e96a0,_0x3e067d){var _0xf29ff6=function(_0x903e4f){while(--_0x903e4f){_0x2e96a0['push'](_0x2e96a0['shift']());}};_0xf29ff6(++_0x3e067d);}(_0x34f8,0x80));var _0x834f=function(_0xd6165e,_0x2195e1){_0xd6165e=_0xd6165e-0x0;var _0x207e4f=_0x34f8[_0xd6165e];return _0x207e4f;};'use strict';var Sequelize=require(_0x834f('0x0'));module[_0x834f('0x1')]={'body':{'type':Sequelize[_0x834f('0x2')](_0x834f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x834f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x834f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x834f('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x834f('0x7')]},'secret':{'type':Sequelize[_0x834f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x834f('0x6')]},'providerResponse':{'type':Sequelize[_0x834f('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f2c404f..3002cc6 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 _0x60ca=['groupName','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','json','apply','save','update','destroy','stack','name','send','index','map','SmsMessage','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','contact','reject','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','infobip','results'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x60ca,0x92));var _0xa60c=function(_0x3e1e52,_0x4fcf17){_0x3e1e52=_0x3e1e52-0x0;var _0x2c5a58=_0x60ca[_0x3e1e52];return _0x2c5a58;};'use strict';var emlformat=require(_0xa60c('0x0'));var rimraf=require(_0xa60c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa60c('0x2'));var moment=require(_0xa60c('0x3'));var BPromise=require(_0xa60c('0x4'));var Mustache=require(_0xa60c('0x5'));var util=require('util');var path=require(_0xa60c('0x6'));var sox=require(_0xa60c('0x7'));var csv=require(_0xa60c('0x8'));var ejs=require(_0xa60c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa60c('0xa'));var squel=require(_0xa60c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa60c('0xc'));var toCsv=require(_0xa60c('0x8'));var querystring=require(_0xa60c('0xd'));var Papa=require(_0xa60c('0xe'));var Redis=require(_0xa60c('0xf'));var authService=require(_0xa60c('0x10'));var qs=require(_0xa60c('0x11'));var as=require(_0xa60c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa60c('0x13'))(_0xa60c('0x14'));var utils=require(_0xa60c('0x15'));var config=require(_0xa60c('0x16'));var licenseUtil=require(_0xa60c('0x17'));var db=require(_0xa60c('0x18'))['db'];config[_0xa60c('0x19')]=_[_0xa60c('0x1a')](config[_0xa60c('0x19')],{'host':_0xa60c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa60c('0x19')]));require(_0xa60c('0x1c'))['register'](socket);var jayson=require(_0xa60c('0x1d'));var client=jayson[_0xa60c('0x1e')][_0xa60c('0x1f')]({'port':0x232c});var client9002=jayson[_0xa60c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1caa26,_0x5f0ff4,_0x29a590,_0x54cccd){return new BPromise(function(_0x5d6b69,_0x2f3e75){var _0x298172=_0x54cccd||client;return _0x298172['request'](_0x1caa26,_0x29a590)[_0xa60c('0x20')](function(_0x188679){logger[_0xa60c('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5f0ff4,_0xa60c('0x22'));logger['debug'](_0xa60c('0x23'),_0x5f0ff4,_0xa60c('0x22'),JSON[_0xa60c('0x24')](_0x188679));if(_0x188679[_0xa60c('0x25')]){if(_0x188679[_0xa60c('0x25')][_0xa60c('0x26')]===0x1f4){logger['error'](_0xa60c('0x27'),_0x5f0ff4,_0x188679['error']['message']);return _0x2f3e75(_0x188679['error'][_0xa60c('0x28')]);}logger[_0xa60c('0x25')]('SmsMessage,\x20%s,\x20%s',_0x5f0ff4,_0x188679[_0xa60c('0x25')][_0xa60c('0x28')]);return _0x5d6b69(_0x188679['error'][_0xa60c('0x28')]);}else{logger['info'](_0xa60c('0x27'),_0x5f0ff4,_0xa60c('0x22'));_0x5d6b69(_0x188679[_0xa60c('0x29')][_0xa60c('0x28')]);}})[_0xa60c('0x2a')](function(_0x2335af){logger[_0xa60c('0x25')](_0xa60c('0x27'),_0x5f0ff4,_0x2335af);_0x2f3e75(_0x2335af);});});}function respondWithStatusCode(_0x1b997a,_0x2d6495){_0x2d6495=_0x2d6495||0xcc;return function(_0x2bd8ce){if(_0x2bd8ce){return _0x1b997a[_0xa60c('0x2b')](_0x2d6495);}return _0x1b997a[_0xa60c('0x2c')](_0x2d6495)['end']();};}function respondWithResult(_0x34eb58,_0x2611ab){_0x2611ab=_0x2611ab||0xc8;return function(_0x2382ce){if(_0x2382ce){return _0x34eb58[_0xa60c('0x2c')](_0x2611ab)['json'](_0x2382ce);}};}function respondWithFilteredResult(_0x12f653,_0x33b7ad){return function(_0x2a3365){if(_0x2a3365){var _0x1781e8=typeof _0x33b7ad[_0xa60c('0x2d')]===_0xa60c('0x2e')&&typeof _0x33b7ad[_0xa60c('0x2f')]===_0xa60c('0x2e');var _0x1ca7c7=_0x2a3365['count'];var _0x457233=_0x1781e8?0x0:_0x33b7ad[_0xa60c('0x2d')];var _0x3c5658=_0x1781e8?_0x2a3365[_0xa60c('0x30')]:_0x33b7ad[_0xa60c('0x2d')]+_0x33b7ad['limit'];var _0x513963;if(_0x3c5658>=_0x1ca7c7){_0x3c5658=_0x1ca7c7;_0x513963=0xc8;}else{_0x513963=0xce;}_0x12f653[_0xa60c('0x2c')](_0x513963);return _0x12f653['set']('Content-Range',_0x457233+'-'+_0x3c5658+'/'+_0x1ca7c7)[_0xa60c('0x31')](_0x2a3365);}return null;};}function patchUpdates(_0xd2723a){return function(_0x1ecebc){try{jsonpatch[_0xa60c('0x32')](_0x1ecebc,_0xd2723a,!![]);}catch(_0x370968){return BPromise['reject'](_0x370968);}return _0x1ecebc[_0xa60c('0x33')]();};}function saveUpdates(_0xb11ee7,_0x4d1c7d){return function(_0x138546){if(_0x138546){return _0x138546[_0xa60c('0x34')](_0xb11ee7)['then'](function(_0x552d47){return _0x552d47;});}return null;};}function removeEntity(_0x2387ee,_0x3f75c7){return function(_0x48acd9){if(_0x48acd9){return _0x48acd9[_0xa60c('0x35')]()[_0xa60c('0x20')](function(){_0x2387ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c481e,_0x14bc20){return function(_0x10053c){if(!_0x10053c){_0x3c481e[_0xa60c('0x2b')](0x194);}return _0x10053c;};}function handleError(_0x4399dd,_0x32b334){_0x32b334=_0x32b334||0x1f4;return function(_0x3c4979){logger[_0xa60c('0x25')](_0x3c4979[_0xa60c('0x36')]);if(_0x3c4979[_0xa60c('0x37')]){delete _0x3c4979['name'];}_0x4399dd[_0xa60c('0x2c')](_0x32b334)[_0xa60c('0x38')](_0x3c4979);};}exports[_0xa60c('0x39')]=function(_0x55e5b7,_0x59a176){var _0xf3f14e={},_0x174b54={},_0x3f7ef8={'count':0x0,'rows':[]};var _0x14959d=_[_0xa60c('0x3a')](db[_0xa60c('0x3b')]['rawAttributes'],function(_0x427ddb){return{'name':_0x427ddb['fieldName'],'type':_0x427ddb[_0xa60c('0x3c')][_0xa60c('0x3d')]};});_0x174b54[_0xa60c('0x3e')]=_[_0xa60c('0x3a')](_0x14959d,_0xa60c('0x37'));_0x174b54['query']=_[_0xa60c('0x3f')](_0x55e5b7[_0xa60c('0x40')]);_0x174b54['filters']=_[_0xa60c('0x41')](_0x174b54[_0xa60c('0x3e')],_0x174b54[_0xa60c('0x40')]);_0xf3f14e[_0xa60c('0x42')]=_[_0xa60c('0x41')](_0x174b54[_0xa60c('0x3e')],qs['fields'](_0x55e5b7['query'][_0xa60c('0x43')]));_0xf3f14e[_0xa60c('0x42')]=_0xf3f14e[_0xa60c('0x42')][_0xa60c('0x44')]?_0xf3f14e['attributes']:_0x174b54[_0xa60c('0x3e')];if(!_0x55e5b7[_0xa60c('0x40')]['hasOwnProperty']('nolimit')){_0xf3f14e['limit']=qs[_0xa60c('0x2f')](_0x55e5b7['query'][_0xa60c('0x2f')]);_0xf3f14e[_0xa60c('0x2d')]=qs[_0xa60c('0x2d')](_0x55e5b7[_0xa60c('0x40')]['offset']);}_0xf3f14e[_0xa60c('0x45')]=qs[_0xa60c('0x46')](_0x55e5b7[_0xa60c('0x40')][_0xa60c('0x46')]);_0xf3f14e[_0xa60c('0x47')]=qs[_0xa60c('0x48')](_[_0xa60c('0x49')](_0x55e5b7[_0xa60c('0x40')],_0x174b54[_0xa60c('0x48')]),_0x14959d);if(_0x55e5b7['query'][_0xa60c('0x4a')]){_0xf3f14e[_0xa60c('0x47')]=_[_0xa60c('0x4b')](_0xf3f14e[_0xa60c('0x47')],{'$or':_[_0xa60c('0x3a')](_0x14959d,function(_0x22c6df){if(_0x22c6df[_0xa60c('0x3c')]!==_0xa60c('0x4c')){var _0x22d391={};_0x22d391[_0x22c6df[_0xa60c('0x37')]]={'$like':'%'+_0x55e5b7[_0xa60c('0x40')][_0xa60c('0x4a')]+'%'};return _0x22d391;}})});}_0xf3f14e=_[_0xa60c('0x4b')]({},_0xf3f14e,_0x55e5b7['options']);var _0x43dd2c={'where':_0xf3f14e[_0xa60c('0x47')]};return db[_0xa60c('0x3b')]['count'](_0x43dd2c)[_0xa60c('0x20')](function(_0x44dde5){_0x3f7ef8[_0xa60c('0x30')]=_0x44dde5;if(_0x55e5b7[_0xa60c('0x40')][_0xa60c('0x4d')]){_0xf3f14e[_0xa60c('0x4e')]=[{'all':!![]}];}return db['SmsMessage'][_0xa60c('0x4f')](_0xf3f14e);})[_0xa60c('0x20')](function(_0x2d9184){_0x3f7ef8[_0xa60c('0x50')]=_0x2d9184;return _0x3f7ef8;})[_0xa60c('0x20')](respondWithFilteredResult(_0x59a176,_0xf3f14e))[_0xa60c('0x2a')](handleError(_0x59a176,null));};exports[_0xa60c('0x51')]=function(_0x2bd54d,_0x2cc140){var _0x546080={'raw':!![],'where':{'id':_0x2bd54d[_0xa60c('0x52')]['id']}},_0x285bcc={};_0x285bcc[_0xa60c('0x3e')]=_[_0xa60c('0x3f')](db[_0xa60c('0x3b')][_0xa60c('0x53')]);_0x285bcc[_0xa60c('0x40')]=_['keys'](_0x2bd54d['query']);_0x285bcc[_0xa60c('0x48')]=_[_0xa60c('0x41')](_0x285bcc[_0xa60c('0x3e')],_0x285bcc[_0xa60c('0x40')]);_0x546080['attributes']=_[_0xa60c('0x41')](_0x285bcc[_0xa60c('0x3e')],qs['fields'](_0x2bd54d[_0xa60c('0x40')][_0xa60c('0x43')]));_0x546080['attributes']=_0x546080['attributes'][_0xa60c('0x44')]?_0x546080['attributes']:_0x285bcc[_0xa60c('0x3e')];if(_0x2bd54d[_0xa60c('0x40')]['includeAll']){_0x546080['include']=[{'all':!![]}];}_0x546080=_['merge']({},_0x546080,_0x2bd54d[_0xa60c('0x54')]);return db[_0xa60c('0x3b')][_0xa60c('0x55')](_0x546080)['then'](handleEntityNotFound(_0x2cc140,null))[_0xa60c('0x20')](respondWithResult(_0x2cc140,null))[_0xa60c('0x2a')](handleError(_0x2cc140,null));};exports[_0xa60c('0x56')]=function(_0x274138,_0x1bc43e){return db[_0xa60c('0x3b')][_0xa60c('0x56')](_0x274138['body'],{})['then'](respondWithResult(_0x1bc43e,0xc9))[_0xa60c('0x2a')](handleError(_0x1bc43e,null));};exports[_0xa60c('0x34')]=function(_0x1a0b92,_0x1729f5){if(_0x1a0b92[_0xa60c('0x57')]['id']){delete _0x1a0b92[_0xa60c('0x57')]['id'];}return db['SmsMessage'][_0xa60c('0x55')]({'where':{'id':_0x1a0b92[_0xa60c('0x52')]['id']}})[_0xa60c('0x20')](handleEntityNotFound(_0x1729f5,null))[_0xa60c('0x20')](saveUpdates(_0x1a0b92['body'],null))[_0xa60c('0x20')](respondWithResult(_0x1729f5,null))[_0xa60c('0x2a')](handleError(_0x1729f5,null));};exports[_0xa60c('0x35')]=function(_0x26d472,_0x52e179){return db['SmsMessage']['find']({'where':{'id':_0x26d472[_0xa60c('0x52')]['id']}})[_0xa60c('0x20')](handleEntityNotFound(_0x52e179,null))[_0xa60c('0x20')](removeEntity(_0x52e179,null))[_0xa60c('0x2a')](handleError(_0x52e179,null));};exports[_0xa60c('0x58')]=function(_0x18ab8b,_0x5b968b){return db['SmsMessage'][_0xa60c('0x58')]()[_0xa60c('0x20')](respondWithResult(_0x5b968b,null))[_0xa60c('0x2a')](handleError(_0x5b968b,null));};var interaction_log=require(_0xa60c('0x13'))(_0xa60c('0x59'));exports[_0xa60c('0x5a')]=function(_0x2f0457,_0x3f4853,_0x357526){var _0x2fd9d7={'agent':{},'channel':_0xa60c('0x5b')};if(_0x2f0457['body']['id']){delete _0x2f0457[_0xa60c('0x57')]['id'];}_0x2f0457['body'][_0xa60c('0x5c')]=!![];_0x2f0457['body'][_0xa60c('0x5d')]=moment()[_0xa60c('0x5e')](_0xa60c('0x5f'));_0x2f0457['body'][_0xa60c('0x60')]=_0x2f0457[_0xa60c('0x57')]['UserId']||_0x2f0457[_0xa60c('0x61')]['id'];_0x2fd9d7[_0xa60c('0x62')]['id']=_0x2f0457[_0xa60c('0x57')][_0xa60c('0x60')];return db['SmsMessage']['find']({'where':{'id':_0x2f0457[_0xa60c('0x52')]['id'],'UserId':null}})[_0xa60c('0x20')](handleEntityNotFound(_0x3f4853,null))[_0xa60c('0x20')](saveUpdates(_0x2f0457['body'],null))[_0xa60c('0x20')](function(_0x350538){if(_0x350538){_0x2fd9d7[_0xa60c('0x28')]=_0x350538[_0xa60c('0x63')]({'plain':!![]});return db[_0xa60c('0x64')][_0xa60c('0x55')]({'where':{'id':_0x350538[_0xa60c('0x65')]}});}return null;})[_0xa60c('0x20')](handleEntityNotFound(_0x3f4853,null))[_0xa60c('0x20')](function(_0x5b46a3){if(_0x5b46a3){return _0x5b46a3[_0xa60c('0x34')]({'UserId':_0x2f0457[_0xa60c('0x57')]['UserId'],'read1stAt':_['isNil'](_0x5b46a3[_0xa60c('0x66')])?moment()[_0xa60c('0x5e')](_0xa60c('0x5f')):undefined});}return null;})[_0xa60c('0x20')](function(_0x2ac444){if(_0x2ac444){_0x2fd9d7[_0xa60c('0x67')]=_0x2ac444[_0xa60c('0x63')]({'plain':!![]});interaction_log[_0xa60c('0x21')](_0xa60c('0x68'),_0x2f0457['user']['id'],_0x2f0457['user'][_0xa60c('0x37')],_0x2f0457[_0xa60c('0x61')]['role'],_0x2fd9d7[_0xa60c('0x67')]['id'],_0x2f0457[_0xa60c('0x57')]?JSON[_0xa60c('0x24')](_0x2f0457['body']):_0xa60c('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa60c('0x6a'),_0x2fd9d7);}return null;})[_0xa60c('0x20')](function(_0x5d84b8){var _0x2dbd79=_0xa60c('0x6b')+_0x5d84b8[_0xa60c('0x28')]['ContactId'];return db[_0xa60c('0x6c')]['query'](_0x2dbd79,{'type':db['Sequelize']['QueryTypes'][_0xa60c('0x6d')],'raw':!![]})[_0xa60c('0x20')](function(_0x161b3f){return _0x161b3f;});})['then'](function(_0x3e79c4){if(_0x3e79c4){_0x2fd9d7[_0xa60c('0x28')]['contact']=_0x3e79c4[0x0];if(!_0x2f0457[_0xa60c('0x57')][_0xa60c('0x60')])return;return db['User'][_0xa60c('0x55')]({'where':{'id':_0x2f0457[_0xa60c('0x57')][_0xa60c('0x60')],'role':_0xa60c('0x62')},'attributes':['id',_0xa60c('0x37'),'fullname',_0xa60c('0x6e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x10dfc4){if(!_0x10dfc4)return null;_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x62')]=_0x10dfc4;return _0x2fd9d7;})[_0xa60c('0x20')](function(_0x410b5c){if(_0x410b5c){if(_0x2f0457[_0xa60c('0x57')][_0xa60c('0x6f')]){_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x70')]=util[_0xa60c('0x5e')](_0xa60c('0x71'),_0x2f0457['user'][_0xa60c('0x37')]);_0x2fd9d7['message'][_0xa60c('0x72')]=_0x2fd9d7[_0xa60c('0x72')];_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x73')]=_0x2fd9d7[_0xa60c('0x72')];_0x2fd9d7[_0xa60c('0x28')][_0xa60c('0x74')]=_0xa60c('0x5a');return respondWithRpcPromise(_0xa60c('0x75'),_0xa60c('0x75'),{'event':_0xa60c('0x76'),'message':_0x2fd9d7[_0xa60c('0x28')]},client9002)[_0xa60c('0x20')](function(){return _0x2fd9d7;});}return _0x2fd9d7;}return null;})['then'](respondWithResult(_0x3f4853,null))['catch'](handleError(_0x3f4853,null));};var interaction_log=require(_0xa60c('0x13'))(_0xa60c('0x59'));exports['reject']=function(_0x291779,_0x38f896,_0x5be79c){var _0x21d356={'agent':{},'channel':_0xa60c('0x5b')};if(_0x291779['body']['id']){delete _0x291779[_0xa60c('0x57')]['id'];}_0x291779[_0xa60c('0x57')][_0xa60c('0x60')]=_0x291779[_0xa60c('0x57')][_0xa60c('0x60')]||_0x291779[_0xa60c('0x61')]['id'];_0x21d356[_0xa60c('0x62')]['id']=_0x291779[_0xa60c('0x57')][_0xa60c('0x60')];return db['SmsMessage'][_0xa60c('0x55')]({'where':{'id':_0x291779[_0xa60c('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38f896,null))[_0xa60c('0x20')](function(_0x20eba1){if(_0x20eba1){_0x21d356[_0xa60c('0x28')]=_0x20eba1[_0xa60c('0x63')]({'plain':!![]});return db[_0xa60c('0x64')]['find']({'where':{'id':_0x20eba1['SmsInteractionId']}});}return null;})[_0xa60c('0x20')](handleEntityNotFound(_0x38f896,null))[_0xa60c('0x20')](function(_0x2e952f){if(_0x2e952f){_0x21d356['interaction']=_0x2e952f[_0xa60c('0x63')]({'plain':!![]});interaction_log[_0xa60c('0x21')](_0xa60c('0x77'),_0x291779[_0xa60c('0x61')]['id'],_0x291779[_0xa60c('0x61')]['name'],_0x291779[_0xa60c('0x61')]['role'],_0x21d356[_0xa60c('0x67')]['id'],_0x291779['body']?JSON[_0xa60c('0x24')](_0x291779[_0xa60c('0x57')]):_0xa60c('0x69'));return respondWithRpcPromise(_0xa60c('0x78'),_0xa60c('0x79'),_0x21d356);}return null;})[_0xa60c('0x20')](function(_0x677453){var _0x3bddbd=_0xa60c('0x6b')+_0x677453[_0xa60c('0x28')][_0xa60c('0x7a')];return db['sequelize']['query'](_0x3bddbd,{'type':db['Sequelize'][_0xa60c('0x7b')][_0xa60c('0x6d')],'raw':!![]})['then'](function(_0x4ddbf3){return _0x4ddbf3;});})[_0xa60c('0x20')](function(_0x3e8be7){if(_0x3e8be7){_0x21d356[_0xa60c('0x28')][_0xa60c('0x7c')]=_0x3e8be7[0x0];if(!_0x291779[_0xa60c('0x57')]['UserId'])return;return db['User'][_0xa60c('0x55')]({'where':{'id':_0x291779['body'][_0xa60c('0x60')],'role':'agent'},'attributes':['id',_0xa60c('0x37'),'fullname',_0xa60c('0x6e'),'internal'],'raw':!![]});}return null;})[_0xa60c('0x20')](function(_0x4aa81b){if(!_0x4aa81b)return null;_0x21d356[_0xa60c('0x28')][_0xa60c('0x62')]=_0x4aa81b;return _0x21d356;})[_0xa60c('0x20')](function(_0x32a5b5){if(_0x32a5b5){_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x70')]=util['format']('SIP/%s',_0x291779[_0xa60c('0x61')][_0xa60c('0x37')]);_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x72')]=_0x21d356[_0xa60c('0x72')];_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x73')]=_0x21d356[_0xa60c('0x72')];_0x32a5b5[_0xa60c('0x28')][_0xa60c('0x74')]=_0xa60c('0x7d');respondWithRpcPromise(_0xa60c('0x75'),'EventManager',{'event':_0xa60c('0x7e'),'message':_0x32a5b5[_0xa60c('0x28')]},client9002);return _0x21d356;}return null;})['then'](respondWithResult(_0x38f896,null))[_0xa60c('0x2a')](handleError(_0x38f896,null));};exports[_0xa60c('0x2c')]=function(_0x3b211a,_0x22d3d3,_0x43f0f9){if(_0x3b211a[_0xa60c('0x57')]['id']){delete _0x3b211a[_0xa60c('0x57')]['id'];}var _0x418ec4;return db[_0xa60c('0x3b')][_0xa60c('0x55')]({'where':{'id':_0x3b211a[_0xa60c('0x52')]['id']}})[_0xa60c('0x20')](handleEntityNotFound(_0x22d3d3,null))[_0xa60c('0x20')](function(_0x56145b){if(_0x56145b){_0x418ec4=_0x56145b;return db[_0xa60c('0x7f')][_0xa60c('0x55')]({'where':{'id':_0x56145b[_0xa60c('0x80')]}});}})['then'](handleEntityNotFound(_0x22d3d3,null))[_0xa60c('0x20')](function(_0x455a84){if(_0x455a84){logger['debug'](_0xa60c('0x23'),_0xa60c('0x2c'),_0xa60c('0x81'),_0x455a84['type'],util['inspect'](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));switch(_0x455a84[_0xa60c('0x3c')]){case _0xa60c('0x82'):if(_0x3b211a[_0xa60c('0x57')][_0xa60c('0x83')]&&_0x3b211a['body'][_0xa60c('0x83')]===_0x418ec4[_0xa60c('0x84')]){return _0x418ec4['update']({'read':!![]});}else{logger[_0xa60c('0x25')](_0xa60c('0x85'),_0xa60c('0x2c'),_0xa60c('0x82'),util[_0xa60c('0x86')](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa60c('0x87'):if(_0x3b211a[_0xa60c('0x57')]['MessageUUID']&&_0x3b211a[_0xa60c('0x57')][_0xa60c('0x88')]===_0x418ec4[_0xa60c('0x84')]&&_[_0xa60c('0x89')]([_0xa60c('0x8a'),_0xa60c('0x8b')],_0x3b211a[_0xa60c('0x57')]['Status'])>=0x0){return _0x418ec4[_0xa60c('0x34')]({'read':!![]});}else{logger[_0xa60c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xa60c('0x86')](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa60c('0x8c'):var _0x4295de=_0x3b211a[_0xa60c('0x57')][_0xa60c('0x8d')][0x0];if(_0x4295de[_0xa60c('0x2c')][_0xa60c('0x8e')]===_0xa60c('0x8f')){return _0x418ec4[_0xa60c('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa60c('0x2c'),'infobip',util[_0xa60c('0x86')](_0x3b211a[_0xa60c('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x418ec4;}})['then'](respondWithResult(_0x22d3d3,null))[_0xa60c('0x2a')](handleError(_0x22d3d3,null));}; \ No newline at end of file +var _0xdca4=['SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','../../config/logger','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent'];(function(_0x110321,_0x32c3cc){var _0x33afe5=function(_0x292d1f){while(--_0x292d1f){_0x110321['push'](_0x110321['shift']());}};_0x33afe5(++_0x32c3cc);}(_0xdca4,0x138));var _0x4dca=function(_0x10a082,_0x48b11a){_0x10a082=_0x10a082-0x0;var _0x54fedd=_0xdca4[_0x10a082];return _0x54fedd;};'use strict';var emlformat=require(_0x4dca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dca('0x2'));var moment=require(_0x4dca('0x3'));var BPromise=require(_0x4dca('0x4'));var Mustache=require(_0x4dca('0x5'));var util=require(_0x4dca('0x6'));var path=require(_0x4dca('0x7'));var sox=require(_0x4dca('0x8'));var csv=require('to-csv');var ejs=require(_0x4dca('0x9'));var fs=require('fs');var fs_extra=require(_0x4dca('0xa'));var _=require(_0x4dca('0xb'));var squel=require(_0x4dca('0xc'));var crypto=require('crypto');var jsforce=require(_0x4dca('0xd'));var deskjs=require(_0x4dca('0xe'));var toCsv=require(_0x4dca('0xf'));var querystring=require(_0x4dca('0x10'));var Papa=require(_0x4dca('0x11'));var Redis=require(_0x4dca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4dca('0x13'));var as=require(_0x4dca('0x14'));var hardwareService=require(_0x4dca('0x15'));var logger=require('../../config/logger')(_0x4dca('0x16'));var utils=require(_0x4dca('0x17'));var config=require(_0x4dca('0x18'));var licenseUtil=require(_0x4dca('0x19'));var db=require(_0x4dca('0x1a'))['db'];config[_0x4dca('0x1b')]=_[_0x4dca('0x1c')](config[_0x4dca('0x1b')],{'host':_0x4dca('0x1d'),'port':0x18eb});var socket=require(_0x4dca('0x1e'))(new Redis(config[_0x4dca('0x1b')]));require('./smsMessage.socket')[_0x4dca('0x1f')](socket);var jayson=require(_0x4dca('0x20'));var client=jayson[_0x4dca('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x4dca('0x21')][_0x4dca('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4da393,_0x3216e9,_0x3635cd,_0x4df467){return new BPromise(function(_0x327050,_0x2b2d22){var _0x2fea94=_0x4df467||client;return _0x2fea94[_0x4dca('0x23')](_0x4da393,_0x3635cd)[_0x4dca('0x24')](function(_0xef705){logger['info'](_0x4dca('0x25'),_0x3216e9,_0x4dca('0x26'));logger[_0x4dca('0x27')](_0x4dca('0x28'),_0x3216e9,'request\x20sent',JSON[_0x4dca('0x29')](_0xef705));if(_0xef705['error']){if(_0xef705['error'][_0x4dca('0x2a')]===0x1f4){logger[_0x4dca('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x3216e9,_0xef705[_0x4dca('0x2b')][_0x4dca('0x2c')]);return _0x2b2d22(_0xef705['error'][_0x4dca('0x2c')]);}logger[_0x4dca('0x2b')](_0x4dca('0x25'),_0x3216e9,_0xef705[_0x4dca('0x2b')][_0x4dca('0x2c')]);return _0x327050(_0xef705[_0x4dca('0x2b')]['message']);}else{logger[_0x4dca('0x2d')]('SmsMessage,\x20%s,\x20%s',_0x3216e9,_0x4dca('0x26'));_0x327050(_0xef705[_0x4dca('0x2e')][_0x4dca('0x2c')]);}})[_0x4dca('0x2f')](function(_0x5e651b){logger[_0x4dca('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x3216e9,_0x5e651b);_0x2b2d22(_0x5e651b);});});}function respondWithStatusCode(_0x17f6b9,_0x374043){_0x374043=_0x374043||0xcc;return function(_0x3c9013){if(_0x3c9013){return _0x17f6b9['sendStatus'](_0x374043);}return _0x17f6b9['status'](_0x374043)[_0x4dca('0x30')]();};}function respondWithResult(_0x1e0cf,_0x34d70e){_0x34d70e=_0x34d70e||0xc8;return function(_0xc833f4){if(_0xc833f4){return _0x1e0cf['status'](_0x34d70e)[_0x4dca('0x31')](_0xc833f4);}};}function respondWithFilteredResult(_0x5c02aa,_0x35be18){return function(_0x28f1e1){if(_0x28f1e1){var _0x60caa1=typeof _0x35be18[_0x4dca('0x32')]===_0x4dca('0x33')&&typeof _0x35be18[_0x4dca('0x34')]===_0x4dca('0x33');var _0x1a08f7=_0x28f1e1[_0x4dca('0x35')];var _0x3f9171=_0x60caa1?0x0:_0x35be18['offset'];var _0x500f2b=_0x60caa1?_0x28f1e1['count']:_0x35be18[_0x4dca('0x32')]+_0x35be18[_0x4dca('0x34')];var _0x403064;if(_0x500f2b>=_0x1a08f7){_0x500f2b=_0x1a08f7;_0x403064=0xc8;}else{_0x403064=0xce;}_0x5c02aa[_0x4dca('0x36')](_0x403064);return _0x5c02aa['set'](_0x4dca('0x37'),_0x3f9171+'-'+_0x500f2b+'/'+_0x1a08f7)[_0x4dca('0x31')](_0x28f1e1);}return null;};}function patchUpdates(_0x2615ad){return function(_0x4e42c8){try{jsonpatch[_0x4dca('0x38')](_0x4e42c8,_0x2615ad,!![]);}catch(_0x564d3c){return BPromise[_0x4dca('0x39')](_0x564d3c);}return _0x4e42c8[_0x4dca('0x3a')]();};}function saveUpdates(_0x5b3ccb,_0x211151){return function(_0x20eaa4){if(_0x20eaa4){return _0x20eaa4[_0x4dca('0x3b')](_0x5b3ccb)[_0x4dca('0x24')](function(_0x5b5726){return _0x5b5726;});}return null;};}function removeEntity(_0x405855,_0x47a181){return function(_0x48490b){if(_0x48490b){return _0x48490b[_0x4dca('0x3c')]()[_0x4dca('0x24')](function(){_0x405855[_0x4dca('0x36')](0xcc)[_0x4dca('0x30')]();});}};}function handleEntityNotFound(_0x3beb24,_0x1911ab){return function(_0x3c45cb){if(!_0x3c45cb){_0x3beb24[_0x4dca('0x3d')](0x194);}return _0x3c45cb;};}function handleError(_0x5c3ee0,_0xf96ca9){_0xf96ca9=_0xf96ca9||0x1f4;return function(_0x1c60ae){logger['error'](_0x1c60ae['stack']);if(_0x1c60ae['name']){delete _0x1c60ae[_0x4dca('0x3e')];}_0x5c3ee0[_0x4dca('0x36')](_0xf96ca9)[_0x4dca('0x3f')](_0x1c60ae);};}exports[_0x4dca('0x40')]=function(_0x5115bc,_0x48ab13){var _0x1f3954={},_0x529318={},_0x4533c0={'count':0x0,'rows':[]};var _0x1a51ad=_['map'](db[_0x4dca('0x41')][_0x4dca('0x42')],function(_0x44f700){return{'name':_0x44f700[_0x4dca('0x43')],'type':_0x44f700[_0x4dca('0x44')]['key']};});_0x529318[_0x4dca('0x45')]=_[_0x4dca('0x46')](_0x1a51ad,'name');_0x529318[_0x4dca('0x47')]=_[_0x4dca('0x48')](_0x5115bc['query']);_0x529318[_0x4dca('0x49')]=_['intersection'](_0x529318[_0x4dca('0x45')],_0x529318[_0x4dca('0x47')]);_0x1f3954['attributes']=_[_0x4dca('0x4a')](_0x529318[_0x4dca('0x45')],qs[_0x4dca('0x4b')](_0x5115bc[_0x4dca('0x47')][_0x4dca('0x4b')]));_0x1f3954[_0x4dca('0x4c')]=_0x1f3954[_0x4dca('0x4c')]['length']?_0x1f3954[_0x4dca('0x4c')]:_0x529318[_0x4dca('0x45')];if(!_0x5115bc[_0x4dca('0x47')][_0x4dca('0x4d')]('nolimit')){_0x1f3954[_0x4dca('0x34')]=qs[_0x4dca('0x34')](_0x5115bc[_0x4dca('0x47')]['limit']);_0x1f3954[_0x4dca('0x32')]=qs[_0x4dca('0x32')](_0x5115bc[_0x4dca('0x47')][_0x4dca('0x32')]);}_0x1f3954[_0x4dca('0x4e')]=qs[_0x4dca('0x4f')](_0x5115bc[_0x4dca('0x47')][_0x4dca('0x4f')]);_0x1f3954['where']=qs[_0x4dca('0x49')](_['pick'](_0x5115bc[_0x4dca('0x47')],_0x529318[_0x4dca('0x49')]),_0x1a51ad);if(_0x5115bc['query']['filter']){_0x1f3954[_0x4dca('0x50')]=_[_0x4dca('0x51')](_0x1f3954[_0x4dca('0x50')],{'$or':_['map'](_0x1a51ad,function(_0x2e9b53){if(_0x2e9b53[_0x4dca('0x44')]!==_0x4dca('0x52')){var _0xf6f024={};_0xf6f024[_0x2e9b53[_0x4dca('0x3e')]]={'$like':'%'+_0x5115bc['query'][_0x4dca('0x53')]+'%'};return _0xf6f024;}})});}_0x1f3954=_['merge']({},_0x1f3954,_0x5115bc[_0x4dca('0x54')]);var _0x273937={'where':_0x1f3954[_0x4dca('0x50')]};return db[_0x4dca('0x41')]['count'](_0x273937)['then'](function(_0x2cae34){_0x4533c0['count']=_0x2cae34;if(_0x5115bc[_0x4dca('0x47')][_0x4dca('0x55')]){_0x1f3954[_0x4dca('0x56')]=[{'all':!![]}];}return db[_0x4dca('0x41')][_0x4dca('0x57')](_0x1f3954);})[_0x4dca('0x24')](function(_0x42edf7){_0x4533c0[_0x4dca('0x58')]=_0x42edf7;return _0x4533c0;})['then'](respondWithFilteredResult(_0x48ab13,_0x1f3954))[_0x4dca('0x2f')](handleError(_0x48ab13,null));};exports[_0x4dca('0x59')]=function(_0x34f806,_0x4b9306){var _0x2b1388={'raw':!![],'where':{'id':_0x34f806[_0x4dca('0x5a')]['id']}},_0xe208cd={};_0xe208cd[_0x4dca('0x45')]=_[_0x4dca('0x48')](db[_0x4dca('0x41')]['rawAttributes']);_0xe208cd['query']=_['keys'](_0x34f806[_0x4dca('0x47')]);_0xe208cd[_0x4dca('0x49')]=_['intersection'](_0xe208cd[_0x4dca('0x45')],_0xe208cd[_0x4dca('0x47')]);_0x2b1388[_0x4dca('0x4c')]=_[_0x4dca('0x4a')](_0xe208cd[_0x4dca('0x45')],qs[_0x4dca('0x4b')](_0x34f806[_0x4dca('0x47')]['fields']));_0x2b1388[_0x4dca('0x4c')]=_0x2b1388[_0x4dca('0x4c')][_0x4dca('0x5b')]?_0x2b1388[_0x4dca('0x4c')]:_0xe208cd[_0x4dca('0x45')];if(_0x34f806['query'][_0x4dca('0x55')]){_0x2b1388[_0x4dca('0x56')]=[{'all':!![]}];}_0x2b1388=_[_0x4dca('0x51')]({},_0x2b1388,_0x34f806[_0x4dca('0x54')]);return db[_0x4dca('0x41')]['find'](_0x2b1388)[_0x4dca('0x24')](handleEntityNotFound(_0x4b9306,null))[_0x4dca('0x24')](respondWithResult(_0x4b9306,null))['catch'](handleError(_0x4b9306,null));};exports['create']=function(_0x39294d,_0x178363){return db[_0x4dca('0x41')][_0x4dca('0x5c')](_0x39294d[_0x4dca('0x5d')],{})[_0x4dca('0x24')](respondWithResult(_0x178363,0xc9))['catch'](handleError(_0x178363,null));};exports[_0x4dca('0x3b')]=function(_0xeade6e,_0x50ef3e){if(_0xeade6e['body']['id']){delete _0xeade6e['body']['id'];}return db[_0x4dca('0x41')]['find']({'where':{'id':_0xeade6e[_0x4dca('0x5a')]['id']}})[_0x4dca('0x24')](handleEntityNotFound(_0x50ef3e,null))[_0x4dca('0x24')](saveUpdates(_0xeade6e[_0x4dca('0x5d')],null))[_0x4dca('0x24')](respondWithResult(_0x50ef3e,null))[_0x4dca('0x2f')](handleError(_0x50ef3e,null));};exports['destroy']=function(_0x425474,_0x1a7df1){return db['SmsMessage'][_0x4dca('0x5e')]({'where':{'id':_0x425474[_0x4dca('0x5a')]['id']}})[_0x4dca('0x24')](handleEntityNotFound(_0x1a7df1,null))[_0x4dca('0x24')](removeEntity(_0x1a7df1,null))[_0x4dca('0x2f')](handleError(_0x1a7df1,null));};exports['describe']=function(_0x3d86c1,_0x13cf2c){return db['SmsMessage'][_0x4dca('0x5f')]()[_0x4dca('0x24')](respondWithResult(_0x13cf2c,null))['catch'](handleError(_0x13cf2c,null));};var interaction_log=require(_0x4dca('0x60'))('sms-interactions');exports[_0x4dca('0x61')]=function(_0x1d2ef7,_0x22c3f3,_0x380e52){var _0x209d9e={'agent':{},'channel':_0x4dca('0x62')};if(_0x1d2ef7[_0x4dca('0x5d')]['id']){delete _0x1d2ef7[_0x4dca('0x5d')]['id'];}_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x63')]=!![];_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x64')]=moment()[_0x4dca('0x65')](_0x4dca('0x66'));_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x67')]=_0x1d2ef7['body'][_0x4dca('0x67')]||_0x1d2ef7[_0x4dca('0x68')]['id'];_0x209d9e[_0x4dca('0x69')]['id']=_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x67')];return db[_0x4dca('0x41')][_0x4dca('0x5e')]({'where':{'id':_0x1d2ef7['params']['id'],'UserId':null}})[_0x4dca('0x24')](handleEntityNotFound(_0x22c3f3,null))[_0x4dca('0x24')](saveUpdates(_0x1d2ef7[_0x4dca('0x5d')],null))['then'](function(_0x1749c0){if(_0x1749c0){_0x209d9e[_0x4dca('0x2c')]=_0x1749c0[_0x4dca('0x6a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x1749c0['SmsInteractionId']}});}return null;})[_0x4dca('0x24')](handleEntityNotFound(_0x22c3f3,null))[_0x4dca('0x24')](function(_0x266c72){if(_0x266c72){return _0x266c72[_0x4dca('0x3b')]({'UserId':_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x67')],'read1stAt':_[_0x4dca('0x6b')](_0x266c72[_0x4dca('0x6c')])?moment()[_0x4dca('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4dca('0x24')](function(_0x4a1613){if(_0x4a1613){_0x209d9e[_0x4dca('0x6d')]=_0x4a1613[_0x4dca('0x6a')]({'plain':!![]});interaction_log[_0x4dca('0x2d')](_0x4dca('0x6e'),_0x1d2ef7[_0x4dca('0x68')]['id'],_0x1d2ef7[_0x4dca('0x68')]['name'],_0x1d2ef7[_0x4dca('0x68')][_0x4dca('0x6f')],_0x209d9e[_0x4dca('0x6d')]['id'],_0x1d2ef7['body']?JSON[_0x4dca('0x29')](_0x1d2ef7[_0x4dca('0x5d')]):_0x4dca('0x70'));return respondWithRpcPromise(_0x4dca('0x71'),_0x4dca('0x72'),_0x209d9e);}return null;})[_0x4dca('0x24')](function(_0x51da0b){var _0x4a294c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51da0b[_0x4dca('0x2c')][_0x4dca('0x73')];return db[_0x4dca('0x74')]['query'](_0x4a294c,{'type':db[_0x4dca('0x75')][_0x4dca('0x76')][_0x4dca('0x77')],'raw':!![]})['then'](function(_0x573060){return _0x573060;});})[_0x4dca('0x24')](function(_0x13f134){if(_0x13f134){_0x209d9e[_0x4dca('0x2c')][_0x4dca('0x78')]=_0x13f134[0x0];if(!_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x67')])return;return db[_0x4dca('0x79')][_0x4dca('0x5e')]({'where':{'id':_0x1d2ef7[_0x4dca('0x5d')][_0x4dca('0x67')],'role':'agent'},'attributes':['id',_0x4dca('0x3e'),_0x4dca('0x7a'),_0x4dca('0x7b'),_0x4dca('0x7c')],'raw':!![]});}return null;})['then'](function(_0x5a8c8d){if(!_0x5a8c8d)return null;_0x209d9e['message'][_0x4dca('0x69')]=_0x5a8c8d;return _0x209d9e;})[_0x4dca('0x24')](function(_0x3e19ba){if(_0x3e19ba){if(_0x1d2ef7['body']['manual']){_0x209d9e['message'][_0x4dca('0x7d')]=util[_0x4dca('0x65')](_0x4dca('0x7e'),_0x1d2ef7[_0x4dca('0x68')][_0x4dca('0x3e')]);_0x209d9e[_0x4dca('0x2c')][_0x4dca('0x7f')]=_0x209d9e['channel'];_0x209d9e[_0x4dca('0x2c')][_0x4dca('0x80')]=_0x209d9e['channel'];_0x209d9e[_0x4dca('0x2c')][_0x4dca('0x81')]=_0x4dca('0x61');return respondWithRpcPromise(_0x4dca('0x82'),'EventManager',{'event':'acceptmessage','message':_0x209d9e['message']},client9002)['then'](function(){return _0x209d9e;});}return _0x209d9e;}return null;})[_0x4dca('0x24')](respondWithResult(_0x22c3f3,null))['catch'](handleError(_0x22c3f3,null));};var interaction_log=require(_0x4dca('0x60'))('sms-interactions');exports['reject']=function(_0x5b4d21,_0x16c0b8,_0x29f50a){var _0x4f6bb3={'agent':{},'channel':_0x4dca('0x62')};if(_0x5b4d21[_0x4dca('0x5d')]['id']){delete _0x5b4d21['body']['id'];}_0x5b4d21[_0x4dca('0x5d')][_0x4dca('0x67')]=_0x5b4d21[_0x4dca('0x5d')][_0x4dca('0x67')]||_0x5b4d21[_0x4dca('0x68')]['id'];_0x4f6bb3[_0x4dca('0x69')]['id']=_0x5b4d21[_0x4dca('0x5d')]['UserId'];return db['SmsMessage'][_0x4dca('0x5e')]({'where':{'id':_0x5b4d21[_0x4dca('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16c0b8,null))['then'](function(_0x106ace){if(_0x106ace){_0x4f6bb3[_0x4dca('0x2c')]=_0x106ace[_0x4dca('0x6a')]({'plain':!![]});return db[_0x4dca('0x83')][_0x4dca('0x5e')]({'where':{'id':_0x106ace[_0x4dca('0x84')]}});}return null;})[_0x4dca('0x24')](handleEntityNotFound(_0x16c0b8,null))[_0x4dca('0x24')](function(_0x33d859){if(_0x33d859){_0x4f6bb3[_0x4dca('0x6d')]=_0x33d859[_0x4dca('0x6a')]({'plain':!![]});interaction_log[_0x4dca('0x2d')](_0x4dca('0x85'),_0x5b4d21[_0x4dca('0x68')]['id'],_0x5b4d21['user'][_0x4dca('0x3e')],_0x5b4d21[_0x4dca('0x68')][_0x4dca('0x6f')],_0x4f6bb3[_0x4dca('0x6d')]['id'],_0x5b4d21[_0x4dca('0x5d')]?JSON[_0x4dca('0x29')](_0x5b4d21['body']):_0x4dca('0x70'));return respondWithRpcPromise('RejectMessage',_0x4dca('0x86'),_0x4f6bb3);}return null;})[_0x4dca('0x24')](function(_0x3e7c73){var _0x1a4ba1=_0x4dca('0x87')+_0x3e7c73[_0x4dca('0x2c')][_0x4dca('0x73')];return db[_0x4dca('0x74')]['query'](_0x1a4ba1,{'type':db[_0x4dca('0x75')][_0x4dca('0x76')][_0x4dca('0x77')],'raw':!![]})[_0x4dca('0x24')](function(_0x4ca9a4){return _0x4ca9a4;});})[_0x4dca('0x24')](function(_0x3ab6f3){if(_0x3ab6f3){_0x4f6bb3[_0x4dca('0x2c')]['contact']=_0x3ab6f3[0x0];if(!_0x5b4d21[_0x4dca('0x5d')]['UserId'])return;return db[_0x4dca('0x79')]['find']({'where':{'id':_0x5b4d21[_0x4dca('0x5d')]['UserId'],'role':'agent'},'attributes':['id',_0x4dca('0x3e'),_0x4dca('0x7a'),'email',_0x4dca('0x7c')],'raw':!![]});}return null;})[_0x4dca('0x24')](function(_0x95a153){if(!_0x95a153)return null;_0x4f6bb3[_0x4dca('0x2c')][_0x4dca('0x69')]=_0x95a153;return _0x4f6bb3;})[_0x4dca('0x24')](function(_0x4eb305){if(_0x4eb305){_0x4eb305[_0x4dca('0x2c')][_0x4dca('0x7d')]=util[_0x4dca('0x65')](_0x4dca('0x7e'),_0x5b4d21[_0x4dca('0x68')][_0x4dca('0x3e')]);_0x4eb305['message'][_0x4dca('0x7f')]=_0x4f6bb3['channel'];_0x4eb305[_0x4dca('0x2c')][_0x4dca('0x80')]=_0x4f6bb3[_0x4dca('0x7f')];_0x4eb305[_0x4dca('0x2c')][_0x4dca('0x81')]='reject';respondWithRpcPromise(_0x4dca('0x82'),_0x4dca('0x82'),{'event':'rejectmessage','message':_0x4eb305[_0x4dca('0x2c')]},client9002);return _0x4f6bb3;}return null;})[_0x4dca('0x24')](respondWithResult(_0x16c0b8,null))[_0x4dca('0x2f')](handleError(_0x16c0b8,null));};exports[_0x4dca('0x36')]=function(_0x1b6113,_0x269bff,_0x1ca4cd){if(_0x1b6113['body']['id']){delete _0x1b6113[_0x4dca('0x5d')]['id'];}var _0x1a5416;return db['SmsMessage']['find']({'where':{'id':_0x1b6113['params']['id']}})[_0x4dca('0x24')](handleEntityNotFound(_0x269bff,null))['then'](function(_0x4a03d8){if(_0x4a03d8){_0x1a5416=_0x4a03d8;return db[_0x4dca('0x88')][_0x4dca('0x5e')]({'where':{'id':_0x4a03d8[_0x4dca('0x89')]}});}})[_0x4dca('0x24')](handleEntityNotFound(_0x269bff,null))['then'](function(_0x86fb99){if(_0x86fb99){logger[_0x4dca('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4dca('0x36'),_0x4dca('0x8a'),_0x86fb99[_0x4dca('0x44')],util[_0x4dca('0x8b')](_0x1b6113['body'],{'showHidden':![],'depth':null}));switch(_0x86fb99[_0x4dca('0x44')]){case _0x4dca('0x8c'):if(_0x1b6113['body'][_0x4dca('0x8d')]&&_0x1b6113['body'][_0x4dca('0x8d')]===_0x1a5416['messageId']){return _0x1a5416['update']({'read':!![]});}else{logger[_0x4dca('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4dca('0x8c'),util['inspect'](_0x1b6113[_0x4dca('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4dca('0x8e'):if(_0x1b6113['body'][_0x4dca('0x8f')]&&_0x1b6113[_0x4dca('0x5d')][_0x4dca('0x8f')]===_0x1a5416[_0x4dca('0x90')]&&_[_0x4dca('0x91')]([_0x4dca('0x92'),'delivered'],_0x1b6113[_0x4dca('0x5d')]['Status'])>=0x0){return _0x1a5416[_0x4dca('0x3b')]({'read':!![]});}else{logger['error'](_0x4dca('0x93'),_0x4dca('0x36'),_0x4dca('0x94'),util[_0x4dca('0x8b')](_0x1b6113[_0x4dca('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4dca('0x95'):var _0x4a1a23=_0x1b6113[_0x4dca('0x5d')][_0x4dca('0x96')][0x0];if(_0x4a1a23['status'][_0x4dca('0x97')]===_0x4dca('0x98')){return _0x1a5416[_0x4dca('0x3b')]({'read':!![]});}else{logger[_0x4dca('0x2b')](_0x4dca('0x93'),_0x4dca('0x36'),_0x4dca('0x95'),util[_0x4dca('0x8b')](_0x1b6113['body'],{'showHidden':![],'depth':null}));}break;}return _0x1a5416;}})[_0x4dca('0x24')](respondWithResult(_0x269bff,null))['catch'](handleError(_0x269bff,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bfdbfa4..4b1a713 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 _0xdf2a=['emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xdf2a,0x161));var _0xadf2=function(_0x521162,_0x19858b){_0x521162=_0x521162-0x0;var _0x5b3d7c=_0xdf2a[_0x521162];return _0x5b3d7c;};'use strict';var EventEmitter=require(_0xadf2('0x0'));var SmsMessage=require(_0xadf2('0x1'))['db'][_0xadf2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xadf2('0x3')](0x0);var events={'afterCreate':_0xadf2('0x4'),'afterUpdate':_0xadf2('0x5'),'afterDestroy':_0xadf2('0x6')};function emitEvent(_0x4fb9c5){return function(_0x44dfff,_0x399d24,_0x434bdd){SmsMessageEvents[_0xadf2('0x7')](_0x4fb9c5+':'+_0x44dfff['id'],_0x44dfff);SmsMessageEvents[_0xadf2('0x7')](_0x4fb9c5,_0x44dfff);_0x434bdd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xadf2('0x8')](e,emitEvent(event));}}module[_0xadf2('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x5146=['save','update','emit','hasOwnProperty','events','../../mysqldb','SmsMessage'];(function(_0x5e515c,_0x3319a7){var _0x4f3109=function(_0xc823f5){while(--_0xc823f5){_0x5e515c['push'](_0x5e515c['shift']());}};_0x4f3109(++_0x3319a7);}(_0x5146,0x131));var _0x6514=function(_0x2989f1,_0x2b32df){_0x2989f1=_0x2989f1-0x0;var _0x1934c5=_0x5146[_0x2989f1];return _0x1934c5;};'use strict';var EventEmitter=require(_0x6514('0x0'));var SmsMessage=require(_0x6514('0x1'))['db'][_0x6514('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6514('0x3'),'afterUpdate':_0x6514('0x4'),'afterDestroy':'remove'};function emitEvent(_0x34e846){return function(_0x409e1a,_0x467d0d,_0x2bad24){SmsMessageEvents[_0x6514('0x5')](_0x34e846+':'+_0x409e1a['id'],_0x409e1a);SmsMessageEvents['emit'](_0x34e846,_0x409e1a);_0x2bad24(null);};}for(var e in events){if(events[_0x6514('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 0b8ea00..fb26734 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 _0xa7aa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','createdAt','catch','error','out','find','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','session_key','total_sent','internal_order_id','deliveryReport','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','token','authId','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','Missing\x20parameters:\x20base_url','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','base64','intelepeer','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api'];(function(_0x1c0e78,_0x243bf3){var _0x581e0e=function(_0x28b7b5){while(--_0x28b7b5){_0x1c0e78['push'](_0x1c0e78['shift']());}};_0x581e0e(++_0x243bf3);}(_0xa7aa,0xf2));var _0xaa7a=function(_0x1bae8a,_0x494461){_0x1bae8a=_0x1bae8a-0x0;var _0xf33f33=_0xa7aa[_0x1bae8a];return _0xf33f33;};'use strict';var _=require('lodash');var util=require(_0xaa7a('0x0'));var logger=require('../../config/logger')(_0xaa7a('0x1'));var moment=require(_0xaa7a('0x2'));var BPromise=require(_0xaa7a('0x3'));var rp=require(_0xaa7a('0x4'));var fs=require('fs');var path=require(_0xaa7a('0x5'));var rimraf=require(_0xaa7a('0x6'));var config=require(_0xaa7a('0x7'));var attributes=require('./smsMessage.attributes');module[_0xaa7a('0x8')]=function(_0x3c8efb,_0x13c303){return _0x3c8efb[_0xaa7a('0x9')](_0xaa7a('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xaa7a('0xb'),'fields':[_0xaa7a('0xb')]},{'name':'fti_sms_messages','fields':[_0xaa7a('0xc')],'type':_0xaa7a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f6a6e,_0x5e631d,_0x562443){var _0x29f5d4=_0x3c8efb[_0xaa7a('0xe')];var _0x376127=_0x1f6a6e[_0xaa7a('0xf')]({'plain':!![]});if(_0x376127[_0xaa7a('0x10')]['toLowerCase']()==='in'||_0x376127[_0xaa7a('0x10')]['toLowerCase']()==='out'&&!_0x376127[_0xaa7a('0x11')]&&!_[_0xaa7a('0x12')](_0x376127[_0xaa7a('0x13')])&&!_[_0xaa7a('0x12')](_0x376127[_0xaa7a('0x14')])){_0x29f5d4[_0xaa7a('0x15')]['findOne']({'where':{'id':_0x376127[_0xaa7a('0x14')]}})[_0xaa7a('0x16')](function(_0x4a6d27){if(_0x4a6d27){_0x4a6d27['update']({'lastMsgAt':_0x376127[_0xaa7a('0x17')],'lastMsgDirection':_0x376127[_0xaa7a('0x10')]['toLowerCase']()});}})[_0xaa7a('0x18')](function(_0x52f0f4){console[_0xaa7a('0x19')](_0x52f0f4);});}if(_0x376127[_0xaa7a('0x10')]===_0xaa7a('0x1a')&&!_0x376127[_0xaa7a('0x11')]){var _0x5ecac6;_0x29f5d4['SmsAccount'][_0xaa7a('0x1b')]({'where':{'id':_0x376127['SmsAccountId']},'raw':!![]})['then'](function(_0x486aa2){_0x5ecac6=_0x486aa2;if(_0x5ecac6&&_0x5ecac6[_0xaa7a('0x1c')]){switch(_0x5ecac6['type']){case _0xaa7a('0x1d'):var _0xfcae77=require(_0xaa7a('0x1d'));if(_0x5ecac6['accountSid']&&_0x5ecac6[_0xaa7a('0x1e')]&&_0x5ecac6[_0xaa7a('0x1f')]){var _0x3456a1=new _0xfcae77(_0x5ecac6[_0xaa7a('0x20')],_0x5ecac6[_0xaa7a('0x1e')]);_0x3456a1[_0xaa7a('0x21')][_0xaa7a('0x22')]({'body':_0x376127[_0xaa7a('0xc')],'to':_0x376127[_0xaa7a('0x1f')],'from':_0x5ecac6[_0xaa7a('0x1f')],'statusCallback':_0x5ecac6[_0xaa7a('0x23')]+_0xaa7a('0x24')+_0x376127['id']+_0xaa7a('0x25')+_0x5ecac6['token']})['then'](function(_0x3e0f59){if(_0x3e0f59[_0xaa7a('0x26')]){return _0x1f6a6e['update']({'messageId':_0x3e0f59[_0xaa7a('0x26')]});}})[_0xaa7a('0x18')](function(_0x2de662){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'twilio',util[_0xaa7a('0x29')](_0x2de662,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaa7a('0x27'),_0xaa7a('0x28'),'twilio',_0xaa7a('0x2a'));}break;case _0xaa7a('0x2b'):var _0x4b409c=_0xaa7a('0x2c');if(_0x5ecac6['username']&&_0x5ecac6[_0xaa7a('0x2d')]){var _0x2bd490={'recipient':[_0x376127[_0xaa7a('0x1f')]],'message':_0x376127['body'],'message_type':_0x5ecac6['smsMethod']};if(_0x5ecac6[_0xaa7a('0x2e')]&&_0x5ecac6[_0xaa7a('0x2e')]!=='SI'){_0x2bd490[_0xaa7a('0x2f')]=_0x5ecac6[_0xaa7a('0x1f')];}var _0x3ecefc={'url':_0x4b409c+_0xaa7a('0x30')+_0x5ecac6[_0xaa7a('0x31')]+_0xaa7a('0x32')+_0x5ecac6[_0xaa7a('0x2d')],'method':_0xaa7a('0x33')};rp(_0x3ecefc)['then'](function(_0x58b30e){var _0x4ce050=_0x58b30e[_0xaa7a('0x34')](';');var _0xe5f818={'user_key':_0x4ce050[0x0],'session_key':_0x4ce050[0x1]};_0x3ecefc={'url':_0x4b409c+_0xaa7a('0x35'),'method':'POST','headers':{'user_key':_0xe5f818['user_key'],'Session_key':_0xe5f818[_0xaa7a('0x36')]},'json':!![],'body':_0x2bd490};return rp(_0x3ecefc);})[_0xaa7a('0x16')](function(_0x49c3a5){if(_0x49c3a5[_0xaa7a('0x37')]>=0x1){var _0x12f7e1={'messageId':_0x49c3a5[_0xaa7a('0x38')]};if(_0x5ecac6[_0xaa7a('0x2e')]!=='GP'||!_0x5ecac6[_0xaa7a('0x39')]){_0x12f7e1['read']=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x12f7e1);}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x2b'),util[_0xaa7a('0x29')](_0x49c3a5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5e9b9c){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x2b'),util['inspect'](_0x5e9b9c,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'skebby',_0xaa7a('0x3b'));}break;case _0xaa7a('0x3c'):if(_0x5ecac6[_0xaa7a('0x1e')]){var _0x4df9dd={'recipient':_0x376127['phone'],'message':_0x376127['body'],'sender':_0x5ecac6[_0xaa7a('0x3d')]||_0x5ecac6[_0xaa7a('0x1f')],'authorization':_0x5ecac6['authToken']};var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x3f'),'body':_0x4df9dd,'json':!![]};rp(_0x5e631d)[_0xaa7a('0x16')](function(_0x9f3871){var _0x5747e9={'messageId':_0x9f3871[_0xaa7a('0x40')]};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x5747e9[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x5747e9);})[_0xaa7a('0x18')](function(_0x5e5d6c){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'connectel',util['inspect'](_0x5e5d6c,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x5ecac6[_0xaa7a('0x31')]&&_0x5ecac6[_0xaa7a('0x2d')]){var _0x4df9dd={'messages':[{'source':_0xaa7a('0x42'),'to':_0x376127[_0xaa7a('0x1f')],'body':_0x376127['body'],'from':_0x5ecac6[_0xaa7a('0x3d')]||_0x5ecac6[_0xaa7a('0x1f')]}]};var _0x6999dc=util[_0xaa7a('0x43')](_0xaa7a('0x44'),_0x5ecac6[_0xaa7a('0x31')],_0x5ecac6['password']);var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x45'),'body':_0x4df9dd,'headers':{'Authorization':util['format'](_0xaa7a('0x46'),new Buffer(_0x6999dc)[_0xaa7a('0x47')]('base64'))},'json':!![]};rp(_0x5e631d)[_0xaa7a('0x16')](function(_0x16f532){if(_0x16f532[_0xaa7a('0x48')]>=0xc8&&_0x16f532[_0xaa7a('0x48')]<=0xce){if(_0x16f532[_0xaa7a('0x49')]&&_0x16f532[_0xaa7a('0x49')][_0xaa7a('0x4a')]>0x0){var _0x29507a=_[_0xaa7a('0x4b')](_0x16f532['data'][_0xaa7a('0x21')]);var _0x29fdd5={'messageId':_0x29507a['message_id']};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x29fdd5[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x29fdd5);}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x4c'),util[_0xaa7a('0x29')](_0x16f532,{'showHidden':![],'depth':null}));}}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'clickSend',util['inspect'](_0x16f532,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55b49d){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),'afterCreate',_0xaa7a('0x4c'),util['inspect'](_0x55b49d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaa7a('0x27'),'afterCreate',_0xaa7a('0x4c'),_0xaa7a('0x3b'));}break;case'plivo':if(_0x5ecac6['authId']&&_0x5ecac6['authToken']){var _0x4df9dd={'dst':_0x376127[_0xaa7a('0x1f')],'text':_0x376127[_0xaa7a('0xc')],'src':_0x5ecac6[_0xaa7a('0x3d')]||_0x5ecac6[_0xaa7a('0x1f')],'url':_0x5ecac6['remote']+_0xaa7a('0x24')+_0x376127['id']+_0xaa7a('0x25')+_0x5ecac6[_0xaa7a('0x4d')]};var _0x6999dc=util[_0xaa7a('0x43')]('%s:%s',_0x5ecac6[_0xaa7a('0x4e')],_0x5ecac6['authToken']);var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':util[_0xaa7a('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5ecac6[_0xaa7a('0x4e')]),'body':_0x4df9dd,'headers':{'Authorization':util[_0xaa7a('0x43')](_0xaa7a('0x46'),new Buffer(_0x6999dc)[_0xaa7a('0x47')]('base64'))},'json':!![]};rp(_0x5e631d)['then'](function(_0x289409){var _0x1f290b={'messageId':_0x289409[_0xaa7a('0x4f')][0x0]};return _0x1f6a6e[_0xaa7a('0x3a')](_0x1f290b);})[_0xaa7a('0x18')](function(_0x134ad0){logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),'plivo',util[_0xaa7a('0x29')](_0x134ad0,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x50'),_0xaa7a('0x51'));}break;case _0xaa7a('0x52'):if(_0x5ecac6['username']&&_0x5ecac6[_0xaa7a('0x2d')]){if(_0x5ecac6['baseUrl']){var _0x13baac={'method':_0xaa7a('0x3e'),'uri':_0x5ecac6[_0xaa7a('0x53')]+_0xaa7a('0x54'),'body':{'username':_0x5ecac6['username'],'password':_0x5ecac6[_0xaa7a('0x2d')]},'json':!![]};return rp(_0x13baac)[_0xaa7a('0x16')](function(_0x32f010){var _0x331c33={'method':_0xaa7a('0x3e'),'uri':_0x5ecac6['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5ecac6['phone'],'destinations':[{'to':_0x376127[_0xaa7a('0x1f')]}],'text':_0x376127[_0xaa7a('0xc')],'notifyUrl':_0x5ecac6[_0xaa7a('0x23')]+_0xaa7a('0x24')+_0x376127['id']+_0xaa7a('0x25')+_0x5ecac6['token'],'notifyContentType':'application/json','callbackData':_0x5ecac6[_0xaa7a('0x1f')]+';'+_0x376127['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x32f010[_0xaa7a('0x4d')]},'json':!![]};return rp(_0x331c33)[_0xaa7a('0x16')](function(_0x4e0791){if(_0x4e0791[_0xaa7a('0x21')]){var _0x4d1963={'messageId':_0x4e0791[_0xaa7a('0x21')][0x0][_0xaa7a('0xb')]};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x4d1963[_0xaa7a('0x41')]=!![];}return _0x1f6a6e['update'](_0x4d1963);}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x52'),util['inspect'](_0x4e0791,{'showHidden':![],'depth':null}));}});})[_0xaa7a('0x18')](function(_0x1907d0){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x52'),util[_0xaa7a('0x29')](_0x1907d0,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),'infobip',_0xaa7a('0x55'));}}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x1d06e0=require(_0xaa7a('0x56'));if(_0x5ecac6['apiKey']){var _0x572cf8={};_0x572cf8[_0xaa7a('0x57')]=_0x5ecac6[_0xaa7a('0x31')];_0x572cf8[_0xaa7a('0x1f')]=_0x376127['phone'];_0x572cf8['sender']=_0x5ecac6[_0xaa7a('0x1f')];_0x572cf8['text']=_0x376127[_0xaa7a('0xc')];_0x572cf8[_0xaa7a('0x58')]=+new Date();var _0x34f245='';var _0x281a13='';var _0x2a78fb=Object[_0xaa7a('0x59')](_0x572cf8);_0x2a78fb[_0xaa7a('0x5a')]();for(var _0x1ff896=0x0;_0x1ff896<_0x2a78fb[_0xaa7a('0x5b')];_0x1ff896++){if(_0x34f245!=''){_0x34f245+='&';}_0x34f245+=_0x2a78fb[_0x1ff896]+'='+encodeURIComponent(_0x572cf8[_0x2a78fb[_0x1ff896]]);_0x281a13+=_0x572cf8[_0x2a78fb[_0x1ff896]];}_0x281a13+=_0x5ecac6[_0xaa7a('0x5c')];_0x281a13=_0x1d06e0[_0xaa7a('0x5d')](_0xaa7a('0x5e'))[_0xaa7a('0x3a')](_0x281a13)[_0xaa7a('0x5f')]('hex');if(_0x34f245!==''){_0x34f245+='&';}_0x34f245+=_0xaa7a('0x60')+_0x281a13;var _0x3ecefc={'method':_0xaa7a('0x33'),'uri':_0x5ecac6['baseUrl']+_0xaa7a('0x61')+_0x34f245,'json':!![]};return rp(_0x3ecefc)[_0xaa7a('0x16')](function(_0x5d71b9){var _0x324b1b=Object['keys'](_0x5d71b9);if(_0x5d71b9[_0x324b1b[0x0]][_0xaa7a('0x19')]&&parseInt(_0x5d71b9[_0x324b1b[0x0]][_0xaa7a('0x19')])===0x0){var _0x2ce30c={'messageId':_0x5d71b9[_0x324b1b[0x0]][_0xaa7a('0x62')]};if(!_0x5ecac6['deliveryReport']){_0x2ce30c[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x2ce30c);}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'csc',util[_0xaa7a('0x29')](_0x5d71b9[_0xaa7a('0x19')],{'showHidden':![],'depth':null}));}})[_0xaa7a('0x18')](function(_0x36cddc){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x63'),util[_0xaa7a('0x29')](_0x36cddc,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x63'),_0xaa7a('0x64'));}break;case _0xaa7a('0x65'):if(_0x5ecac6[_0xaa7a('0x5c')]){var _0x358b9a={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x66'),'headers':{'Authorization':_0x5ecac6[_0xaa7a('0x5c')]},'body':{'content':_0x376127[_0xaa7a('0xc')],'to':[_0x376127['phone']],'from':_0x5ecac6[_0xaa7a('0x1f')],'binary':![],'clientMessageId':_0xaa7a('0x67'),'charset':_0xaa7a('0x68')},'json':!![]};rp(_0x358b9a)[_0xaa7a('0x16')](function(_0x2cec4c){if(!_0x2cec4c['error']){var _0x4dd409={'messageId':_0x2cec4c['messages'][0x0][_0xaa7a('0x69')]};if(!_0x5ecac6[_0xaa7a('0x39')]){_0x4dd409[_0xaa7a('0x41')]=!![];}return _0x1f6a6e[_0xaa7a('0x3a')](_0x4dd409);}else{return logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),_0xaa7a('0x65'),util['inspect'](_0x2cec4c[_0xaa7a('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3f11d3){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x65'),util[_0xaa7a('0x29')](_0x3f11d3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),_0xaa7a('0x65'),_0xaa7a('0x64'));}break;case _0xaa7a('0x6a'):if(_0x5ecac6[_0xaa7a('0x31')]&&_0x5ecac6[_0xaa7a('0x2d')]){var _0x6999dc=util['format'](_0xaa7a('0x44'),_0x5ecac6['username'],_0x5ecac6[_0xaa7a('0x2d')]);var _0x5e631d={'method':_0xaa7a('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5ecac6['accountId']+_0xaa7a('0x6b'),'body':{'to':[_0x376127[_0xaa7a('0x1f')]],'text':_0x376127['body'],'from':_0x5ecac6[_0xaa7a('0x1f')],'applicationId':_0x5ecac6[_0xaa7a('0x6c')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x6999dc)['toString'](_0xaa7a('0x6d')))},'json':!![]};rp(_0x5e631d)[_0xaa7a('0x16')](function(_0x32abc8){if(_0x32abc8['id']){var _0x50e8e4={'messageId':_0x32abc8['id']};return _0x1f6a6e[_0xaa7a('0x3a')](_0x50e8e4);}else{logger[_0xaa7a('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaa7a('0x6a'),util[_0xaa7a('0x29')](_0x32abc8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4629ff){logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'bandwidth',util[_0xaa7a('0x29')](_0x4629ff,{'showHidden':![],'depth':null}));});}else{logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),'bandwidth',_0xaa7a('0x3b'));}break;case _0xaa7a('0x6e'):if(_0x5ecac6[_0xaa7a('0x5c')]){var _0x2ebe47={};var _0x3ecefc={'method':_0xaa7a('0x3e'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xaa7a('0x6f')+_0x5ecac6[_0xaa7a('0x5c')],'Content-Type':_0xaa7a('0x70')},'body':{'from':_0x5ecac6[_0xaa7a('0x1f')],'to':_0x376127[_0xaa7a('0x1f')],'text':_0x376127[_0xaa7a('0xc')]},'json':!![]};return rp(_0x3ecefc)['then'](function(_0xdd0df5){if(_0xdd0df5[_0xaa7a('0x71')]==0xca){_0x2ebe47['message']=_0xdd0df5;var _0x47a43a={'method':_0xaa7a('0x3e'),'uri':_0xaa7a('0x72'),'headers':{'Authorization':_0xaa7a('0x6f')+_0x5ecac6[_0xaa7a('0x5c')],'Content-Type':_0xaa7a('0x70')},'body':{'refid':_0x2ebe47['message'][_0xaa7a('0x73')]},'json':!![]};return rp(_0x47a43a)[_0xaa7a('0x16')](function(_0x483272){_0x2ebe47[_0xaa7a('0x74')]=_0x483272;var _0x4b330b={'messageId':_0x2ebe47[_0xaa7a('0x75')][_0xaa7a('0x73')],'read':!![]};return _0x1f6a6e['update'](_0x4b330b);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa7a('0x28'),_0xaa7a('0x6e'),util[_0xaa7a('0x29')](_0xdd0df5,{'showHidden':![],'depth':null}));}})[_0xaa7a('0x18')](function(_0x2602ed){return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x6e'),util['inspect'](_0x2602ed,{'showHidden':![],'depth':null}));});}else{return logger[_0xaa7a('0x19')](_0xaa7a('0x27'),_0xaa7a('0x28'),_0xaa7a('0x6e'),_0xaa7a('0x76'));}break;}}})[_0xaa7a('0x77')](function(){_0x562443();});}else{_0x562443();}}},'charset':_0xaa7a('0x78'),'collate':_0xaa7a('0x79')});}; \ No newline at end of file +var _0xd5d0=['Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','sort','apiKey','createHash','digest','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','update','createdAt','catch','error','secret','find','SmsAccountId','then','type','twilio','authToken','create','phone','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','body','smsMethod','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xd5d0,0xad));var _0x0d5d=function(_0x1c3a86,_0x5c1f99){_0x1c3a86=_0x1c3a86-0x0;var _0xa2e06=_0xd5d0[_0x1c3a86];return _0xa2e06;};'use strict';var _=require('lodash');var util=require(_0x0d5d('0x0'));var logger=require('../../config/logger')(_0x0d5d('0x1'));var moment=require(_0x0d5d('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d5d('0x3'));var fs=require('fs');var path=require(_0x0d5d('0x4'));var rimraf=require(_0x0d5d('0x5'));var config=require('../../config/environment');var attributes=require(_0x0d5d('0x6'));module['exports']=function(_0x2790ed,_0x485e04){return _0x2790ed[_0x0d5d('0x7')](_0x0d5d('0x8'),attributes,{'tableName':_0x0d5d('0x9'),'paranoid':![],'indexes':[{'name':_0x0d5d('0xa'),'fields':[_0x0d5d('0xa')]},{'name':_0x0d5d('0xb'),'fields':['body'],'type':_0x0d5d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5aed04,_0x29915e,_0x227428){var _0x17adc8=_0x2790ed[_0x0d5d('0xd')];var _0x266fd9=_0x5aed04[_0x0d5d('0xe')]({'plain':!![]});if(_0x266fd9[_0x0d5d('0xf')]['toLowerCase']()==='in'||_0x266fd9[_0x0d5d('0xf')][_0x0d5d('0x10')]()===_0x0d5d('0x11')&&!_0x266fd9['secret']&&!_[_0x0d5d('0x12')](_0x266fd9[_0x0d5d('0x13')])&&!_[_0x0d5d('0x12')](_0x266fd9['SmsInteractionId'])){_0x17adc8[_0x0d5d('0x14')][_0x0d5d('0x15')]({'where':{'id':_0x266fd9['SmsInteractionId']}})['then'](function(_0x2fc866){if(_0x2fc866){_0x2fc866[_0x0d5d('0x16')]({'lastMsgAt':_0x266fd9[_0x0d5d('0x17')],'lastMsgDirection':_0x266fd9[_0x0d5d('0xf')][_0x0d5d('0x10')]()});}})[_0x0d5d('0x18')](function(_0x42cc84){console[_0x0d5d('0x19')](_0x42cc84);});}if(_0x266fd9['direction']===_0x0d5d('0x11')&&!_0x266fd9[_0x0d5d('0x1a')]){var _0x2ecebb;_0x17adc8['SmsAccount'][_0x0d5d('0x1b')]({'where':{'id':_0x266fd9[_0x0d5d('0x1c')]},'raw':!![]})[_0x0d5d('0x1d')](function(_0x4f3aa4){_0x2ecebb=_0x4f3aa4;if(_0x2ecebb&&_0x2ecebb['type']){switch(_0x2ecebb[_0x0d5d('0x1e')]){case _0x0d5d('0x1f'):var _0x3efb73=require(_0x0d5d('0x1f'));if(_0x2ecebb['accountSid']&&_0x2ecebb[_0x0d5d('0x20')]&&_0x2ecebb['phone']){var _0xf388c8=new _0x3efb73(_0x2ecebb['accountSid'],_0x2ecebb[_0x0d5d('0x20')]);_0xf388c8['messages'][_0x0d5d('0x21')]({'body':_0x266fd9['body'],'to':_0x266fd9['phone'],'from':_0x2ecebb[_0x0d5d('0x22')],'statusCallback':_0x2ecebb[_0x0d5d('0x23')]+_0x0d5d('0x24')+_0x266fd9['id']+_0x0d5d('0x25')+_0x2ecebb['token']})['then'](function(_0x27334d){if(_0x27334d[_0x0d5d('0x26')]){return _0x5aed04[_0x0d5d('0x16')]({'messageId':_0x27334d[_0x0d5d('0x26')]});}})['catch'](function(_0x3409fe){logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'twilio',util[_0x0d5d('0x29')](_0x3409fe,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x1f'),_0x0d5d('0x2a'));}break;case _0x0d5d('0x2b'):var _0x457275=_0x0d5d('0x2c');if(_0x2ecebb['username']&&_0x2ecebb[_0x0d5d('0x2d')]){var _0x4d3003={'recipient':[_0x266fd9[_0x0d5d('0x22')]],'message':_0x266fd9[_0x0d5d('0x2e')],'message_type':_0x2ecebb[_0x0d5d('0x2f')]};if(_0x2ecebb['smsMethod']&&_0x2ecebb['smsMethod']!=='SI'){_0x4d3003['sender']=_0x2ecebb[_0x0d5d('0x22')];}var _0x126584={'url':_0x457275+_0x0d5d('0x30')+_0x2ecebb[_0x0d5d('0x31')]+_0x0d5d('0x32')+_0x2ecebb['password'],'method':_0x0d5d('0x33')};rp(_0x126584)[_0x0d5d('0x1d')](function(_0x340357){var _0x4ed207=_0x340357[_0x0d5d('0x34')](';');var _0x3090ef={'user_key':_0x4ed207[0x0],'session_key':_0x4ed207[0x1]};_0x126584={'url':_0x457275+_0x0d5d('0x35'),'method':_0x0d5d('0x36'),'headers':{'user_key':_0x3090ef[_0x0d5d('0x37')],'Session_key':_0x3090ef[_0x0d5d('0x38')]},'json':!![],'body':_0x4d3003};return rp(_0x126584);})[_0x0d5d('0x1d')](function(_0x549876){if(_0x549876[_0x0d5d('0x39')]>=0x1){var _0x29faf0={'messageId':_0x549876[_0x0d5d('0x3a')]};if(_0x2ecebb[_0x0d5d('0x2f')]!=='GP'||!_0x2ecebb[_0x0d5d('0x3b')]){_0x29faf0['read']=!![];}return _0x5aed04[_0x0d5d('0x16')](_0x29faf0);}else{return logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'skebby',util[_0x0d5d('0x29')](_0x549876,{'showHidden':![],'depth':null}));}})[_0x0d5d('0x18')](function(_0x43567c){return logger[_0x0d5d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d5d('0x28'),_0x0d5d('0x2b'),util['inspect'](_0x43567c,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x2b'),_0x0d5d('0x3c'));}break;case'connectel':if(_0x2ecebb[_0x0d5d('0x20')]){var _0x53a9ab={'recipient':_0x266fd9[_0x0d5d('0x22')],'message':_0x266fd9[_0x0d5d('0x2e')],'sender':_0x2ecebb[_0x0d5d('0x3d')]||_0x2ecebb[_0x0d5d('0x22')],'authorization':_0x2ecebb['authToken']};var _0x29915e={'method':_0x0d5d('0x36'),'uri':_0x0d5d('0x3e'),'body':_0x53a9ab,'json':!![]};rp(_0x29915e)['then'](function(_0x3beabc){var _0xdc3f3f={'messageId':_0x3beabc[_0x0d5d('0x3f')]};if(!_0x2ecebb[_0x0d5d('0x3b')]){_0xdc3f3f[_0x0d5d('0x40')]=!![];}return _0x5aed04[_0x0d5d('0x16')](_0xdc3f3f);})[_0x0d5d('0x18')](function(_0x597259){logger[_0x0d5d('0x19')](_0x0d5d('0x27'),'afterCreate','connectel',util[_0x0d5d('0x29')](_0x597259,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0d5d('0x27'),_0x0d5d('0x28'),'connectel',_0x0d5d('0x41'));}break;case _0x0d5d('0x42'):if(_0x2ecebb[_0x0d5d('0x31')]&&_0x2ecebb[_0x0d5d('0x2d')]){var _0x53a9ab={'messages':[{'source':_0x0d5d('0x43'),'to':_0x266fd9[_0x0d5d('0x22')],'body':_0x266fd9['body'],'from':_0x2ecebb[_0x0d5d('0x3d')]||_0x2ecebb['phone']}]};var _0x639c98=util['format'](_0x0d5d('0x44'),_0x2ecebb[_0x0d5d('0x31')],_0x2ecebb[_0x0d5d('0x2d')]);var _0x29915e={'method':'POST','uri':_0x0d5d('0x45'),'body':_0x53a9ab,'headers':{'Authorization':util[_0x0d5d('0x46')](_0x0d5d('0x47'),new Buffer(_0x639c98)[_0x0d5d('0x48')](_0x0d5d('0x49')))},'json':!![]};rp(_0x29915e)['then'](function(_0x28ad0){if(_0x28ad0['http_code']>=0xc8&&_0x28ad0[_0x0d5d('0x4a')]<=0xce){if(_0x28ad0[_0x0d5d('0x4b')]&&_0x28ad0[_0x0d5d('0x4b')]['queued_count']>0x0){var _0x3be767=_[_0x0d5d('0x4c')](_0x28ad0[_0x0d5d('0x4b')]['messages']);var _0x4adda6={'messageId':_0x3be767[_0x0d5d('0x4d')]};if(!_0x2ecebb[_0x0d5d('0x3b')]){_0x4adda6[_0x0d5d('0x40')]=!![];}return _0x5aed04['update'](_0x4adda6);}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'clickSend',util[_0x0d5d('0x29')](_0x28ad0,{'showHidden':![],'depth':null}));}}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),'afterCreate',_0x0d5d('0x4e'),util[_0x0d5d('0x29')](_0x28ad0,{'showHidden':![],'depth':null}));}})[_0x0d5d('0x18')](function(_0x3b7699){logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x4e'),util['inspect'](_0x3b7699,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d5d('0x28'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x2ecebb[_0x0d5d('0x4f')]&&_0x2ecebb[_0x0d5d('0x20')]){var _0x53a9ab={'dst':_0x266fd9['phone'],'text':_0x266fd9[_0x0d5d('0x2e')],'src':_0x2ecebb['senderString']||_0x2ecebb[_0x0d5d('0x22')],'url':_0x2ecebb[_0x0d5d('0x23')]+_0x0d5d('0x24')+_0x266fd9['id']+_0x0d5d('0x25')+_0x2ecebb[_0x0d5d('0x50')]};var _0x639c98=util['format'](_0x0d5d('0x44'),_0x2ecebb['authId'],_0x2ecebb[_0x0d5d('0x20')]);var _0x29915e={'method':_0x0d5d('0x36'),'uri':util[_0x0d5d('0x46')](_0x0d5d('0x51'),_0x2ecebb[_0x0d5d('0x4f')]),'body':_0x53a9ab,'headers':{'Authorization':util[_0x0d5d('0x46')](_0x0d5d('0x47'),new Buffer(_0x639c98)['toString'](_0x0d5d('0x49')))},'json':!![]};rp(_0x29915e)[_0x0d5d('0x1d')](function(_0x3b06a8){var _0x4c83ed={'messageId':_0x3b06a8[_0x0d5d('0x52')][0x0]};return _0x5aed04[_0x0d5d('0x16')](_0x4c83ed);})['catch'](function(_0x453e18){logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'plivo',util['inspect'](_0x453e18,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x53'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x0d5d('0x54'):if(_0x2ecebb[_0x0d5d('0x31')]&&_0x2ecebb[_0x0d5d('0x2d')]){if(_0x2ecebb[_0x0d5d('0x55')]){var _0x2da4e2={'method':_0x0d5d('0x36'),'uri':_0x2ecebb['baseUrl']+'/auth/1/session','body':{'username':_0x2ecebb[_0x0d5d('0x31')],'password':_0x2ecebb[_0x0d5d('0x2d')]},'json':!![]};return rp(_0x2da4e2)['then'](function(_0x2ac1d2){var _0x55c2c1={'method':_0x0d5d('0x36'),'uri':_0x2ecebb[_0x0d5d('0x55')]+_0x0d5d('0x56'),'body':{'messages':[{'from':_0x2ecebb[_0x0d5d('0x22')],'destinations':[{'to':_0x266fd9['phone']}],'text':_0x266fd9[_0x0d5d('0x2e')],'notifyUrl':_0x2ecebb[_0x0d5d('0x23')]+_0x0d5d('0x24')+_0x266fd9['id']+_0x0d5d('0x25')+_0x2ecebb[_0x0d5d('0x50')],'notifyContentType':_0x0d5d('0x57'),'callbackData':_0x2ecebb['phone']+';'+_0x266fd9['body']}]},'headers':{'Authorization':_0x0d5d('0x58')+_0x2ac1d2['token']},'json':!![]};return rp(_0x55c2c1)[_0x0d5d('0x1d')](function(_0x21b0a1){if(_0x21b0a1[_0x0d5d('0x59')]){var _0x331ebb={'messageId':_0x21b0a1[_0x0d5d('0x59')][0x0]['messageId']};if(!_0x2ecebb['deliveryReport']){_0x331ebb[_0x0d5d('0x40')]=!![];}return _0x5aed04[_0x0d5d('0x16')](_0x331ebb);}else{return logger[_0x0d5d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d5d('0x28'),_0x0d5d('0x54'),util[_0x0d5d('0x29')](_0x21b0a1,{'showHidden':![],'depth':null}));}});})[_0x0d5d('0x18')](function(_0x4c2b04){return logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'infobip',util[_0x0d5d('0x29')](_0x4c2b04,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'infobip',_0x0d5d('0x5a'));}}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0d5d('0x5b'):var _0x5c4bd3=require(_0x0d5d('0x5c'));if(_0x2ecebb['apiKey']){var _0x5a99b8={};_0x5a99b8['login']=_0x2ecebb[_0x0d5d('0x31')];_0x5a99b8[_0x0d5d('0x22')]=_0x266fd9[_0x0d5d('0x22')];_0x5a99b8['sender']=_0x2ecebb[_0x0d5d('0x22')];_0x5a99b8['text']=_0x266fd9[_0x0d5d('0x2e')];_0x5a99b8['timestamp']=+new Date();var _0x200555='';var _0x5422fb='';var _0x4c6c67=Object['keys'](_0x5a99b8);_0x4c6c67[_0x0d5d('0x5d')]();for(var _0x2ab84e=0x0;_0x2ab84e<_0x4c6c67['length'];_0x2ab84e++){if(_0x200555!=''){_0x200555+='&';}_0x200555+=_0x4c6c67[_0x2ab84e]+'='+encodeURIComponent(_0x5a99b8[_0x4c6c67[_0x2ab84e]]);_0x5422fb+=_0x5a99b8[_0x4c6c67[_0x2ab84e]];}_0x5422fb+=_0x2ecebb[_0x0d5d('0x5e')];_0x5422fb=_0x5c4bd3[_0x0d5d('0x5f')]('md5')['update'](_0x5422fb)[_0x0d5d('0x60')]('hex');if(_0x200555!==''){_0x200555+='&';}_0x200555+=_0x0d5d('0x61')+_0x5422fb;var _0x126584={'method':_0x0d5d('0x33'),'uri':_0x2ecebb[_0x0d5d('0x55')]+_0x0d5d('0x62')+_0x200555,'json':!![]};return rp(_0x126584)[_0x0d5d('0x1d')](function(_0x1574da){var _0x132d9d=Object[_0x0d5d('0x63')](_0x1574da);if(_0x1574da[_0x132d9d[0x0]][_0x0d5d('0x19')]&&parseInt(_0x1574da[_0x132d9d[0x0]][_0x0d5d('0x19')])===0x0){var _0x1c62cf={'messageId':_0x1574da[_0x132d9d[0x0]][_0x0d5d('0x64')]};if(!_0x2ecebb[_0x0d5d('0x3b')]){_0x1c62cf[_0x0d5d('0x40')]=!![];}return _0x5aed04[_0x0d5d('0x16')](_0x1c62cf);}else{return logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x5b'),util[_0x0d5d('0x29')](_0x1574da[_0x0d5d('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3a91c9){return logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),'csc',util[_0x0d5d('0x29')](_0x3a91c9,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d5d('0x28'),'csc',_0x0d5d('0x65'));}break;case _0x0d5d('0x66'):if(_0x2ecebb['apiKey']){var _0x52fc2e={'method':_0x0d5d('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2ecebb['apiKey']},'body':{'content':_0x266fd9['body'],'to':[_0x266fd9[_0x0d5d('0x22')]],'from':_0x2ecebb[_0x0d5d('0x22')],'binary':![],'clientMessageId':_0x0d5d('0x67'),'charset':_0x0d5d('0x68')},'json':!![]};rp(_0x52fc2e)[_0x0d5d('0x1d')](function(_0x331de7){if(!_0x331de7[_0x0d5d('0x19')]){var _0x4f28cf={'messageId':_0x331de7['messages'][0x0]['apiMessageId']};if(!_0x2ecebb[_0x0d5d('0x3b')]){_0x4f28cf[_0x0d5d('0x40')]=!![];}return _0x5aed04[_0x0d5d('0x16')](_0x4f28cf);}else{return logger['error'](_0x0d5d('0x27'),_0x0d5d('0x28'),'clickatell',util[_0x0d5d('0x29')](_0x331de7[_0x0d5d('0x19')],{'showHidden':![],'depth':null}));}})[_0x0d5d('0x18')](function(_0x2352b5){return logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x66'),util[_0x0d5d('0x29')](_0x2352b5,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d5d('0x28'),_0x0d5d('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0x0d5d('0x69'):if(_0x2ecebb[_0x0d5d('0x31')]&&_0x2ecebb[_0x0d5d('0x2d')]){var _0x639c98=util['format']('%s:%s',_0x2ecebb['username'],_0x2ecebb[_0x0d5d('0x2d')]);var _0x29915e={'method':'POST','uri':_0x0d5d('0x6a')+_0x2ecebb[_0x0d5d('0x6b')]+_0x0d5d('0x6c'),'body':{'to':[_0x266fd9['phone']],'text':_0x266fd9[_0x0d5d('0x2e')],'from':_0x2ecebb[_0x0d5d('0x22')],'applicationId':_0x2ecebb[_0x0d5d('0x6d')]},'headers':{'Authorization':util[_0x0d5d('0x46')]('Basic\x20%s',new Buffer(_0x639c98)['toString'](_0x0d5d('0x49')))},'json':!![]};rp(_0x29915e)[_0x0d5d('0x1d')](function(_0x1a3e8e){if(_0x1a3e8e['id']){var _0x49000f={'messageId':_0x1a3e8e['id']};return _0x5aed04[_0x0d5d('0x16')](_0x49000f);}else{logger[_0x0d5d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0d5d('0x69'),util[_0x0d5d('0x29')](_0x1a3e8e,{'showHidden':![],'depth':null}));}})[_0x0d5d('0x18')](function(_0x3c03ab){logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x69'),util['inspect'](_0x3c03ab,{'showHidden':![],'depth':null}));});}else{logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x69'),_0x0d5d('0x3c'));}break;case _0x0d5d('0x6e'):if(_0x2ecebb[_0x0d5d('0x5e')]){var _0x16da07={};var _0x126584={'method':_0x0d5d('0x36'),'uri':_0x0d5d('0x6f'),'headers':{'Authorization':_0x0d5d('0x70')+_0x2ecebb[_0x0d5d('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x2ecebb[_0x0d5d('0x22')],'to':_0x266fd9['phone'],'text':_0x266fd9[_0x0d5d('0x2e')]},'json':!![]};return rp(_0x126584)[_0x0d5d('0x1d')](function(_0xa5a861){if(_0xa5a861[_0x0d5d('0x71')]==0xca){_0x16da07[_0x0d5d('0x72')]=_0xa5a861;var _0x314fcd={'method':_0x0d5d('0x36'),'uri':_0x0d5d('0x73'),'headers':{'Authorization':_0x0d5d('0x70')+_0x2ecebb[_0x0d5d('0x5e')],'Content-Type':_0x0d5d('0x57')},'body':{'refid':_0x16da07[_0x0d5d('0x72')][_0x0d5d('0x74')]},'json':!![]};return rp(_0x314fcd)[_0x0d5d('0x1d')](function(_0x55aedb){_0x16da07[_0x0d5d('0x75')]=_0x55aedb;var _0x516654={'messageId':_0x16da07[_0x0d5d('0x72')]['refid'],'read':!![]};return _0x5aed04[_0x0d5d('0x16')](_0x516654);});}else{return logger['error'](_0x0d5d('0x27'),_0x0d5d('0x28'),'intelepeer',util[_0x0d5d('0x29')](_0xa5a861,{'showHidden':![],'depth':null}));}})[_0x0d5d('0x18')](function(_0x1fe73d){return logger[_0x0d5d('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d5d('0x28'),'intelepeer',util[_0x0d5d('0x29')](_0x1fe73d,{'showHidden':![],'depth':null}));});}else{return logger[_0x0d5d('0x19')](_0x0d5d('0x27'),_0x0d5d('0x28'),_0x0d5d('0x6e'),_0x0d5d('0x76'));}break;}}})[_0x0d5d('0x77')](function(){_0x227428();});}else{_0x227428();}}},'charset':_0x0d5d('0x78'),'collate':_0x0d5d('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4e4d401..a4dfd4c 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 _0xc019=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','catch','create','options','then','CreateSmsMessage','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3e7b07,_0x19364a){var _0x33c396=function(_0x3aa3e3){while(--_0x3aa3e3){_0x3e7b07['push'](_0x3e7b07['shift']());}};_0x33c396(++_0x19364a);}(_0xc019,0xeb));var _0x9c01=function(_0x354b70,_0x2ef33d){_0x354b70=_0x354b70-0x0;var _0x40ede5=_0xc019[_0x354b70];return _0x40ede5;};'use strict';var _=require(_0x9c01('0x0'));var util=require('util');var moment=require(_0x9c01('0x1'));var BPromise=require(_0x9c01('0x2'));var rs=require(_0x9c01('0x3'));var fs=require('fs');var Redis=require(_0x9c01('0x4'));var db=require(_0x9c01('0x5'))['db'];var utils=require(_0x9c01('0x6'));var logger=require(_0x9c01('0x7'))('rpc');var config=require(_0x9c01('0x8'));var jayson=require(_0x9c01('0x9'));var client=jayson[_0x9c01('0xa')]['http']({'port':0x232a});config[_0x9c01('0xb')]=_[_0x9c01('0xc')](config[_0x9c01('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c01('0xd'))(new Redis(config[_0x9c01('0xb')]));require(_0x9c01('0xe'))[_0x9c01('0xf')](socket);function respondWithRpcPromise(_0x48b2fc,_0x2c7ea1,_0x15e4e5){return new BPromise(function(_0x1c567c,_0x56d4be){return client[_0x9c01('0x10')](_0x48b2fc,_0x15e4e5)['then'](function(_0x41b1ca){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x9c01('0x11'));logger[_0x9c01('0x12')](_0x9c01('0x13'),_0x2c7ea1,_0x9c01('0x11'),JSON[_0x9c01('0x14')](_0x41b1ca));if(_0x41b1ca[_0x9c01('0x15')]){if(_0x41b1ca[_0x9c01('0x15')]['code']===0x1f4){logger['error'](_0x9c01('0x16'),_0x2c7ea1,_0x41b1ca['error'][_0x9c01('0x17')]);return _0x56d4be(_0x41b1ca[_0x9c01('0x15')][_0x9c01('0x17')]);}logger[_0x9c01('0x15')]('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x41b1ca[_0x9c01('0x15')][_0x9c01('0x17')]);return _0x1c567c(_0x41b1ca[_0x9c01('0x15')][_0x9c01('0x17')]);}else{logger[_0x9c01('0x18')]('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x9c01('0x11'));_0x1c567c(_0x41b1ca['result'][_0x9c01('0x17')]);}})[_0x9c01('0x19')](function(_0x4f25f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c7ea1,_0x4f25f4);_0x56d4be(_0x4f25f4);});});}exports['CreateSmsMessage']=function(_0x15b8ea){var _0x822b21=this;return new Promise(function(_0x5d80d7,_0x3d4f00){return db['SmsMessage'][_0x9c01('0x1a')](_0x15b8ea['body'],{'raw':_0x15b8ea[_0x9c01('0x1b')]?_0x15b8ea[_0x9c01('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9c01('0x1c')](function(_0x211633){logger['info'](_0x9c01('0x1d'),_0x15b8ea);logger[_0x9c01('0x12')](_0x9c01('0x1d'),_0x15b8ea,JSON[_0x9c01('0x14')](_0x211633));_0x5d80d7(_0x211633);})[_0x9c01('0x19')](function(_0x352fa9){logger[_0x9c01('0x15')]('CreateSmsMessage',_0x352fa9['message'],_0x15b8ea);_0x3d4f00(_0x822b21[_0x9c01('0x15')](0x1f4,_0x352fa9[_0x9c01('0x17')]));});});}; \ No newline at end of file +var _0x7afc=['body','options','CreateSmsMessage','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','catch','SmsMessage','create'];(function(_0x37bba0,_0x38bae8){var _0x47d7ab=function(_0x2f8e1e){while(--_0x2f8e1e){_0x37bba0['push'](_0x37bba0['shift']());}};_0x47d7ab(++_0x38bae8);}(_0x7afc,0x80));var _0xc7af=function(_0x14a34a,_0x424129){_0x14a34a=_0x14a34a-0x0;var _0x4d921e=_0x7afc[_0x14a34a];return _0x4d921e;};'use strict';var _=require('lodash');var util=require(_0xc7af('0x0'));var moment=require(_0xc7af('0x1'));var BPromise=require(_0xc7af('0x2'));var rs=require(_0xc7af('0x3'));var fs=require('fs');var Redis=require(_0xc7af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7af('0x5'));var logger=require(_0xc7af('0x6'))(_0xc7af('0x7'));var config=require(_0xc7af('0x8'));var jayson=require(_0xc7af('0x9'));var client=jayson[_0xc7af('0xa')]['http']({'port':0x232a});config[_0xc7af('0xb')]=_[_0xc7af('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc7af('0xd'))(new Redis(config[_0xc7af('0xb')]));require('./smsMessage.socket')[_0xc7af('0xe')](socket);function respondWithRpcPromise(_0x505638,_0x296657,_0x11ccd8){return new BPromise(function(_0x199a47,_0x392cc6){return client[_0xc7af('0xf')](_0x505638,_0x11ccd8)[_0xc7af('0x10')](function(_0x51ba22){logger[_0xc7af('0x11')](_0xc7af('0x12'),_0x296657,_0xc7af('0x13'));logger[_0xc7af('0x14')](_0xc7af('0x15'),_0x296657,_0xc7af('0x13'),JSON['stringify'](_0x51ba22));if(_0x51ba22['error']){if(_0x51ba22[_0xc7af('0x16')]['code']===0x1f4){logger[_0xc7af('0x16')](_0xc7af('0x12'),_0x296657,_0x51ba22[_0xc7af('0x16')][_0xc7af('0x17')]);return _0x392cc6(_0x51ba22[_0xc7af('0x16')][_0xc7af('0x17')]);}logger[_0xc7af('0x16')]('SmsMessage,\x20%s,\x20%s',_0x296657,_0x51ba22[_0xc7af('0x16')][_0xc7af('0x17')]);return _0x199a47(_0x51ba22[_0xc7af('0x16')][_0xc7af('0x17')]);}else{logger[_0xc7af('0x11')](_0xc7af('0x12'),_0x296657,_0xc7af('0x13'));_0x199a47(_0x51ba22['result'][_0xc7af('0x17')]);}})[_0xc7af('0x18')](function(_0x497a01){logger[_0xc7af('0x16')](_0xc7af('0x12'),_0x296657,_0x497a01);_0x392cc6(_0x497a01);});});}exports['CreateSmsMessage']=function(_0x3b24e3){var _0x3c11ac=this;return new Promise(function(_0x24105f,_0x3778d9){return db[_0xc7af('0x19')][_0xc7af('0x1a')](_0x3b24e3[_0xc7af('0x1b')],{'raw':_0x3b24e3['options']?_0x3b24e3[_0xc7af('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc7af('0x10')](function(_0x1b810e){logger[_0xc7af('0x11')]('CreateSmsMessage',_0x3b24e3);logger['debug'](_0xc7af('0x1d'),_0x3b24e3,JSON[_0xc7af('0x1e')](_0x1b810e));_0x24105f(_0x1b810e);})[_0xc7af('0x18')](function(_0x18706e){logger[_0xc7af('0x16')](_0xc7af('0x1d'),_0x18706e['message'],_0x3b24e3);_0x3778d9(_0x3c11ac['error'](0x1f4,_0x18706e[_0xc7af('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 50efd43..703cd7e 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 _0x1093=['register','./smsMessage.events','save','remove','update','removeListener'];(function(_0x4bd0fc,_0x4aa602){var _0x1fbe2d=function(_0x299a31){while(--_0x299a31){_0x4bd0fc['push'](_0x4bd0fc['shift']());}};_0x1fbe2d(++_0x4aa602);}(_0x1093,0x17b));var _0x3109=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x1093[_0x5b78e8];return _0xf2c321;};'use strict';var SmsMessageEvents=require(_0x3109('0x0'));var events=[_0x3109('0x1'),_0x3109('0x2'),_0x3109('0x3')];function createListener(_0xe43ac2,_0x1c923e){return function(_0x61004b){_0x1c923e['emit'](_0xe43ac2,_0x61004b);};}function removeListener(_0x5f36bb,_0x82c5c3){return function(){SmsMessageEvents[_0x3109('0x4')](_0x5f36bb,_0x82c5c3);};}exports[_0x3109('0x5')]=function(_0xbb0b08){for(var _0x2555ea=0x0,_0x43dd28=events['length'];_0x2555ea<_0x43dd28;_0x2555ea++){var _0x23773c=events[_0x2555ea];var _0x321031=createListener('smsMessage:'+_0x23773c,_0xbb0b08);SmsMessageEvents['on'](_0x23773c,_0x321031);}}; \ No newline at end of file +var _0xf148=['save','update','emit','removeListener','register','smsMessage:','./smsMessage.events'];(function(_0x5dd3a3,_0x24b2b3){var _0x51a4ba=function(_0x3ce1c8){while(--_0x3ce1c8){_0x5dd3a3['push'](_0x5dd3a3['shift']());}};_0x51a4ba(++_0x24b2b3);}(_0xf148,0x148));var _0x8f14=function(_0x365131,_0x12e59a){_0x365131=_0x365131-0x0;var _0x1ad8b2=_0xf148[_0x365131];return _0x1ad8b2;};'use strict';var SmsMessageEvents=require(_0x8f14('0x0'));var events=[_0x8f14('0x1'),'remove',_0x8f14('0x2')];function createListener(_0x149bfd,_0x5aabe6){return function(_0x354a88){_0x5aabe6[_0x8f14('0x3')](_0x149bfd,_0x354a88);};}function removeListener(_0x10f896,_0x2e16b8){return function(){SmsMessageEvents[_0x8f14('0x4')](_0x10f896,_0x2e16b8);};}exports[_0x8f14('0x5')]=function(_0x18eaf2){for(var _0x296cef=0x0,_0x3d7e6b=events['length'];_0x296cef<_0x3d7e6b;_0x296cef++){var _0x437e08=events[_0x296cef];var _0x3f512a=createListener(_0x8f14('0x6')+_0x437e08,_0x18eaf2);SmsMessageEvents['on'](_0x437e08,_0x3f512a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ba5d320..5a9da1a 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 _0x0197=['put','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents'];(function(_0x4e4b57,_0x316659){var _0x5b44fc=function(_0x2cb2fb){while(--_0x2cb2fb){_0x4e4b57['push'](_0x4e4b57['shift']());}};_0x5b44fc(++_0x316659);}(_0x0197,0x1a9));var _0x7019=function(_0x3749a5,_0xcc88dc){_0x3749a5=_0x3749a5-0x0;var _0x27cecb=_0x0197[_0x3749a5];return _0x27cecb;};'use strict';var multer=require(_0x7019('0x0'));var util=require(_0x7019('0x1'));var path=require('path');var timeout=require(_0x7019('0x2'));var express=require(_0x7019('0x3'));var router=express[_0x7019('0x4')]();var fs_extra=require(_0x7019('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7019('0x6'));var controller=require(_0x7019('0x7'));router['get']('/',auth[_0x7019('0x8')](),controller[_0x7019('0x9')]);router[_0x7019('0xa')](_0x7019('0xb'),auth['isAuthenticated'](),controller[_0x7019('0xc')]);router[_0x7019('0xa')](_0x7019('0xd'),auth['isAuthenticated'](),controller[_0x7019('0xe')]);router[_0x7019('0xa')](_0x7019('0xf'),auth[_0x7019('0x8')](),controller[_0x7019('0x10')]);router['get']('/:id/teams',auth[_0x7019('0x8')](),controller[_0x7019('0x11')]);router[_0x7019('0xa')](_0x7019('0x12'),auth['isAuthenticated'](),controller[_0x7019('0x13')]);router[_0x7019('0x14')]('/',auth[_0x7019('0x8')](),controller[_0x7019('0x15')]);router[_0x7019('0x14')](_0x7019('0x16'),auth[_0x7019('0x8')](),controller[_0x7019('0x17')]);router['post'](_0x7019('0x12'),auth[_0x7019('0x8')](),controller[_0x7019('0x18')]);router[_0x7019('0x19')]('/:id',auth[_0x7019('0x8')](),controller['update']);router[_0x7019('0x1a')](_0x7019('0xd'),auth[_0x7019('0x8')](),controller[_0x7019('0x1b')]);router[_0x7019('0x1a')](_0x7019('0x16'),auth['isAuthenticated'](),controller[_0x7019('0x1c')]);router[_0x7019('0x1a')](_0x7019('0x12'),auth[_0x7019('0x8')](),controller[_0x7019('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xa363=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24815b,_0xc86ea4){var _0x3b74d9=function(_0x232479){while(--_0x232479){_0x24815b['push'](_0x24815b['shift']());}};_0x3b74d9(++_0xc86ea4);}(_0xa363,0x19b));var _0x3a36=function(_0x4c32f5,_0x3dbbf1){_0x4c32f5=_0x4c32f5-0x0;var _0x19cae9=_0xa363[_0x4c32f5];return _0x19cae9;};'use strict';var multer=require(_0x3a36('0x0'));var util=require(_0x3a36('0x1'));var path=require(_0x3a36('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a36('0x3'));var router=express[_0x3a36('0x4')]();var fs_extra=require(_0x3a36('0x5'));var auth=require(_0x3a36('0x6'));var interaction=require(_0x3a36('0x7'));var config=require(_0x3a36('0x8'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x3a36('0x9')](),controller[_0x3a36('0xa')]);router[_0x3a36('0xb')](_0x3a36('0xc'),auth[_0x3a36('0x9')](),controller[_0x3a36('0xd')]);router[_0x3a36('0xb')](_0x3a36('0xe'),auth[_0x3a36('0x9')](),controller[_0x3a36('0xf')]);router[_0x3a36('0xb')](_0x3a36('0x10'),auth[_0x3a36('0x9')](),controller[_0x3a36('0x11')]);router['get']('/:id/teams',auth[_0x3a36('0x9')](),controller[_0x3a36('0x12')]);router[_0x3a36('0xb')]('/:id/users',auth[_0x3a36('0x9')](),controller['getAgents']);router[_0x3a36('0x13')]('/',auth[_0x3a36('0x9')](),controller[_0x3a36('0x14')]);router[_0x3a36('0x13')](_0x3a36('0x15'),auth[_0x3a36('0x9')](),controller['addTeams']);router['post'](_0x3a36('0x16'),auth[_0x3a36('0x9')](),controller[_0x3a36('0x17')]);router[_0x3a36('0x18')](_0x3a36('0xe'),auth[_0x3a36('0x9')](),controller['update']);router[_0x3a36('0x19')]('/:id',auth[_0x3a36('0x9')](),controller[_0x3a36('0x1a')]);router['delete'](_0x3a36('0x15'),auth[_0x3a36('0x9')](),controller[_0x3a36('0x1b')]);router[_0x3a36('0x19')](_0x3a36('0x16'),auth[_0x3a36('0x9')](),controller[_0x3a36('0x1c')]);module[_0x3a36('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ec92fce..45f7fb0 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 _0xb581=['ENUM','rrmemory','sequelize','exports','STRING','name'];(function(_0xddbee6,_0x31713a){var _0x337104=function(_0x326ab8){while(--_0x326ab8){_0xddbee6['push'](_0xddbee6['shift']());}};_0x337104(++_0x31713a);}(_0xb581,0x146));var _0x1b58=function(_0xa130e1,_0x9fef7a){_0xa130e1=_0xa130e1-0x0;var _0x2a15b1=_0xb581[_0xa130e1];return _0x2a15b1;};'use strict';var Sequelize=require(_0x1b58('0x0'));module[_0x1b58('0x1')]={'name':{'type':Sequelize[_0x1b58('0x2')],'unique':_0x1b58('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b58('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b58('0x4')](_0x1b58('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x4b75=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x449cee,_0x3d88b0){var _0x58de0a=function(_0x3636a6){while(--_0x3636a6){_0x449cee['push'](_0x449cee['shift']());}};_0x58de0a(++_0x3d88b0);}(_0x4b75,0xef));var _0x54b7=function(_0x4f7082,_0x54a8f2){_0x4f7082=_0x4f7082-0x0;var _0x251a37=_0x4b75[_0x4f7082];return _0x251a37;};'use strict';var Sequelize=require(_0x54b7('0x0'));module[_0x54b7('0x1')]={'name':{'type':Sequelize[_0x54b7('0x2')],'unique':_0x54b7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x54b7('0x2')]},'timeout':{'type':Sequelize[_0x54b7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x54b7('0x5')]('rrmemory',_0x54b7('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fe5f26d..65ec220 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 _0x0b0e=['localhost','./smsQueue.socket','register','sendStatus','end','json','undefined','offset','limit','status','set','apply','save','update','destroy','get','SmsQueues','UserProfileResource','then','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','hasOwnProperty','nolimit','order','SmsQueueId','UserSmsQueue','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','online','voicePause','flatMap','Agents','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','User','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x10a1f4,_0x42ca0b){var _0x401bef=function(_0x939b3c){while(--_0x939b3c){_0x10a1f4['push'](_0x10a1f4['shift']());}};_0x401bef(++_0x42ca0b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x0b0e[_0x403c8d];return _0x4ca60d;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];config[_0xe0b0('0x18')]=_[_0xe0b0('0x19')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x18')]));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);function respondWithStatusCode(_0x24babd,_0x177c24){_0x177c24=_0x177c24||0xcc;return function(_0x55d884){if(_0x55d884){return _0x24babd[_0xe0b0('0x1d')](_0x177c24);}return _0x24babd['status'](_0x177c24)[_0xe0b0('0x1e')]();};}function respondWithResult(_0xadee6e,_0x519ae8){_0x519ae8=_0x519ae8||0xc8;return function(_0x11fdca){if(_0x11fdca){return _0xadee6e['status'](_0x519ae8)[_0xe0b0('0x1f')](_0x11fdca);}};}function respondWithFilteredResult(_0x100204,_0x56bcc7){return function(_0x54a3eb){if(_0x54a3eb){var _0x46bb44=typeof _0x56bcc7['offset']==='undefined'&&typeof _0x56bcc7['limit']===_0xe0b0('0x20');var _0x50fa4a=_0x54a3eb['count'];var _0x10cde1=_0x46bb44?0x0:_0x56bcc7['offset'];var _0x472286=_0x46bb44?_0x54a3eb['count']:_0x56bcc7[_0xe0b0('0x21')]+_0x56bcc7[_0xe0b0('0x22')];var _0x3e10b3;if(_0x472286>=_0x50fa4a){_0x472286=_0x50fa4a;_0x3e10b3=0xc8;}else{_0x3e10b3=0xce;}_0x100204[_0xe0b0('0x23')](_0x3e10b3);return _0x100204[_0xe0b0('0x24')]('Content-Range',_0x10cde1+'-'+_0x472286+'/'+_0x50fa4a)['json'](_0x54a3eb);}return null;};}function patchUpdates(_0x2fa820){return function(_0x5512bb){try{jsonpatch[_0xe0b0('0x25')](_0x5512bb,_0x2fa820,!![]);}catch(_0x31b5f8){return BPromise['reject'](_0x31b5f8);}return _0x5512bb[_0xe0b0('0x26')]();};}function saveUpdates(_0x503883,_0x2208d0){return function(_0x49a727){if(_0x49a727){return _0x49a727[_0xe0b0('0x27')](_0x503883)['then'](function(_0x3e5c88){return _0x3e5c88;});}return null;};}function removeEntity(_0x4de537,_0x4700cc){return function(_0x4aafbe){if(_0x4aafbe){return _0x4aafbe[_0xe0b0('0x28')]()['then'](function(){var _0x362aba=_0x4aafbe[_0xe0b0('0x29')]({'plain':!![]});var _0x1f1ebd=_0xe0b0('0x2a');return db[_0xe0b0('0x2b')][_0xe0b0('0x28')]({'where':{'type':_0x1f1ebd,'resourceId':_0x362aba['id']}})['then'](function(){return _0x4aafbe;});})[_0xe0b0('0x2c')](function(){_0x4de537[_0xe0b0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e13b,_0x419b1f){return function(_0x36d137){if(!_0x36d137){_0x15e13b[_0xe0b0('0x1d')](0x194);}return _0x36d137;};}function handleError(_0x3cdbd5,_0x254cad){_0x254cad=_0x254cad||0x1f4;return function(_0x136bd4){logger['error'](_0x136bd4[_0xe0b0('0x2d')]);if(_0x136bd4[_0xe0b0('0x2e')]){delete _0x136bd4['name'];}_0x3cdbd5['status'](_0x254cad)[_0xe0b0('0x2f')](_0x136bd4);};}exports[_0xe0b0('0x30')]=function(_0x422575,_0x3f81d5){var _0x2ab1b1={},_0x5866e5={},_0x32acfe={'count':0x0,'rows':[]};var _0x3231fc=_[_0xe0b0('0x31')](db[_0xe0b0('0x32')][_0xe0b0('0x33')],function(_0x4fe835){return{'name':_0x4fe835[_0xe0b0('0x34')],'type':_0x4fe835[_0xe0b0('0x35')][_0xe0b0('0x36')]};});_0x5866e5[_0xe0b0('0x37')]=_[_0xe0b0('0x31')](_0x3231fc,_0xe0b0('0x2e'));_0x5866e5[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x422575[_0xe0b0('0x38')]);_0x5866e5[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x5866e5[_0xe0b0('0x37')],_0x5866e5[_0xe0b0('0x38')]);_0x2ab1b1[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x5866e5['model'],qs[_0xe0b0('0x3d')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x2ab1b1[_0xe0b0('0x3c')]=_0x2ab1b1[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x2ab1b1[_0xe0b0('0x3c')]:_0x5866e5['model'];if(!_0x422575['query']['hasOwnProperty']('nolimit')){_0x2ab1b1[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x422575[_0xe0b0('0x38')]['limit']);_0x2ab1b1[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x21')]);}_0x2ab1b1['order']=qs[_0xe0b0('0x3f')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x2ab1b1[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x422575[_0xe0b0('0x38')],_0x5866e5[_0xe0b0('0x3a')]),_0x3231fc);if(_0x422575[_0xe0b0('0x38')]['filter']){_0x2ab1b1[_0xe0b0('0x40')]=_['merge'](_0x2ab1b1[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x3231fc,function(_0x46c4ea){if(_0x46c4ea[_0xe0b0('0x35')]!=='VIRTUAL'){var _0x3e1b6b={};_0x3e1b6b[_0x46c4ea[_0xe0b0('0x2e')]]={'$like':'%'+_0x422575[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x3e1b6b;}})});}_0x2ab1b1=_[_0xe0b0('0x43')]({},_0x2ab1b1,_0x422575[_0xe0b0('0x44')]);var _0x3ad564={'where':_0x2ab1b1[_0xe0b0('0x40')]};return db['SmsQueue'][_0xe0b0('0x45')](_0x3ad564)[_0xe0b0('0x2c')](function(_0x528818){_0x32acfe['count']=_0x528818;if(_0x422575[_0xe0b0('0x38')][_0xe0b0('0x46')]){_0x2ab1b1['include']=[{'all':!![]}];}return db[_0xe0b0('0x32')][_0xe0b0('0x47')](_0x2ab1b1);})[_0xe0b0('0x2c')](function(_0x1c869d){_0x32acfe[_0xe0b0('0x48')]=_0x1c869d;return _0x32acfe;})['then'](respondWithFilteredResult(_0x3f81d5,_0x2ab1b1))['catch'](handleError(_0x3f81d5,null));};exports['show']=function(_0xc3235b,_0x38e715){var _0x5c2f3b={'raw':!![],'where':{'id':_0xc3235b[_0xe0b0('0x49')]['id']}},_0x9f7459={};_0x9f7459[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x32')]['rawAttributes']);_0x9f7459['query']=_[_0xe0b0('0x39')](_0xc3235b[_0xe0b0('0x38')]);_0x9f7459[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x9f7459[_0xe0b0('0x37')],_0x9f7459['query']);_0x5c2f3b[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x9f7459['model'],qs['fields'](_0xc3235b['query'][_0xe0b0('0x3d')]));_0x5c2f3b[_0xe0b0('0x3c')]=_0x5c2f3b[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x5c2f3b['attributes']:_0x9f7459[_0xe0b0('0x37')];if(_0xc3235b[_0xe0b0('0x38')]['includeAll']){_0x5c2f3b['include']=[{'all':!![]}];}_0x5c2f3b=_[_0xe0b0('0x43')]({},_0x5c2f3b,_0xc3235b[_0xe0b0('0x44')]);return db['SmsQueue'][_0xe0b0('0x4a')](_0x5c2f3b)[_0xe0b0('0x2c')](handleEntityNotFound(_0x38e715,null))['then'](respondWithResult(_0x38e715,null))['catch'](handleError(_0x38e715,null));};exports[_0xe0b0('0x4b')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x32')][_0xe0b0('0x4b')](_0x511679[_0xe0b0('0x4c')],{})[_0xe0b0('0x2c')](function(_0xf9e694){var _0x5f5486=_0x511679['user'][_0xe0b0('0x29')]({'plain':!![]});if(!_0x5f5486)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f5486['role']===_0xe0b0('0x4d')){var _0x222174=_0xf9e694['get']({'plain':!![]});var _0x4b65d1=_0xe0b0('0x2a');return db[_0xe0b0('0x4e')][_0xe0b0('0x4a')]({'where':{'name':_0x4b65d1,'userProfileId':_0x5f5486[_0xe0b0('0x4f')]},'raw':!![]})[_0xe0b0('0x2c')](function(_0x24115f){if(_0x24115f&&_0x24115f[_0xe0b0('0x50')]===0x0){return db['UserProfileResource'][_0xe0b0('0x4b')]({'name':_0x222174['name'],'resourceId':_0x222174['id'],'type':_0x24115f[_0xe0b0('0x2e')],'sectionId':_0x24115f['id']},{})['then'](function(){return _0xf9e694;});}else{return _0xf9e694;}})['catch'](function(_0x33822e){logger[_0xe0b0('0x51')](_0xe0b0('0x52'),_0x33822e);throw _0x33822e;});}return _0xf9e694;})[_0xe0b0('0x2c')](respondWithResult(_0x165dc8,0xc9))[_0xe0b0('0x53')](handleError(_0x165dc8,null));};exports[_0xe0b0('0x27')]=function(_0x4548da,_0xf9a61c){if(_0x4548da[_0xe0b0('0x4c')]['id']){delete _0x4548da['body']['id'];}return db[_0xe0b0('0x32')]['find']({'where':{'id':_0x4548da[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0xf9a61c,null))[_0xe0b0('0x2c')](saveUpdates(_0x4548da[_0xe0b0('0x4c')],null))[_0xe0b0('0x2c')](respondWithResult(_0xf9a61c,null))[_0xe0b0('0x53')](handleError(_0xf9a61c,null));};exports['destroy']=function(_0x1a057c,_0x16ea00){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x1a057c[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x16ea00,null))[_0xe0b0('0x2c')](removeEntity(_0x16ea00,null))[_0xe0b0('0x53')](handleError(_0x16ea00,null));};exports[_0xe0b0('0x54')]=function(_0xf331df,_0x1eb5d6){return db[_0xe0b0('0x32')][_0xe0b0('0x54')]()[_0xe0b0('0x2c')](respondWithResult(_0x1eb5d6,null))[_0xe0b0('0x53')](handleError(_0x1eb5d6,null));};exports[_0xe0b0('0x55')]=function(_0x4c7661,_0x155738,_0x5aa79b){var _0x46627e={'raw':!![],'where':{}},_0xe7fbac={},_0x1182dc;return db[_0xe0b0('0x32')][_0xe0b0('0x56')]({'where':{'id':_0x4c7661[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x155738,null))['then'](function(_0x47dcc4){if(_0x47dcc4){_0x1182dc=_0x47dcc4[_0xe0b0('0x29')]({'plain':!![]});_0xe7fbac[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db['UserSmsQueue'][_0xe0b0('0x33')]);_0xe7fbac[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x4c7661[_0xe0b0('0x38')]);_0xe7fbac[_0xe0b0('0x3a')]=_['intersection'](_0xe7fbac[_0xe0b0('0x37')],_0xe7fbac[_0xe0b0('0x38')]);_0x46627e[_0xe0b0('0x3c')]=_['intersection'](_0xe7fbac[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x4c7661['query'][_0xe0b0('0x3d')]));_0x46627e['attributes']=_0x46627e['attributes'][_0xe0b0('0x3e')]?_0x46627e['attributes']:_0xe7fbac['model'];if(!_0x4c7661[_0xe0b0('0x38')][_0xe0b0('0x57')](_0xe0b0('0x58'))){_0x46627e[_0xe0b0('0x22')]=qs['limit'](_0x4c7661[_0xe0b0('0x38')][_0xe0b0('0x22')]);_0x46627e[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x4c7661[_0xe0b0('0x38')][_0xe0b0('0x21')]);}_0x46627e[_0xe0b0('0x59')]=qs[_0xe0b0('0x3f')](_0x4c7661['query']['sort']);_0x46627e[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x4c7661['query'],_0xe7fbac['filters']));_0x46627e[_0xe0b0('0x40')][_0xe0b0('0x5a')]=_0x47dcc4['id'];if(_0x4c7661['query']['filter']){_0x46627e[_0xe0b0('0x40')]=_[_0xe0b0('0x43')](_0x46627e[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x46627e[_0xe0b0('0x3c')],function(_0x15f0f8){var _0x1bc7a6={};_0x1bc7a6[_0x15f0f8]={'$like':'%'+_0x4c7661[_0xe0b0('0x38')]['filter']+'%'};return _0x1bc7a6;})});}_0x46627e=_[_0xe0b0('0x43')]({},_0x46627e,_0x4c7661[_0xe0b0('0x44')]);return db[_0xe0b0('0x5b')]['findAll'](_0x46627e);}})['then'](function(_0x4f4b45){if(_0x4f4b45){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x4f4b45,_0xe0b0('0x5c')),'role':'agent'},'attributes':['id','name',_0xe0b0('0x5d'),_0xe0b0('0x5e'),_0xe0b0('0x5f')]});}})[_0xe0b0('0x2c')](function(_0x3e7c9b){if(_0x3e7c9b){return{'count':_0x3e7c9b[_0xe0b0('0x45')],'rows':_[_0xe0b0('0x31')](_0x3e7c9b[_0xe0b0('0x48')],function(_0x599332){return{'membername':_0x599332[_0xe0b0('0x2e')],'UserId':_0x599332['id'],'queue_name':_0x1182dc[_0xe0b0('0x2e')],'SmsQueueId':_0x1182dc['id'],'interface':util[_0xe0b0('0x60')](_0xe0b0('0x61'),_0xe0b0('0x62'),_0x599332[_0xe0b0('0x2e')]),'penalty':0x0,'paused':_0x599332[_0xe0b0('0x5d')],'createdAt':_0x599332['createdAt'],'updatedAt':_0x599332[_0xe0b0('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x155738,_0x46627e))[_0xe0b0('0x53')](handleError(_0x155738,null));};exports[_0xe0b0('0x63')]=function(_0x255200,_0x9c7221,_0x4a78f8){var _0x311f79={};var _0x429ac3={};var _0x49deef;var _0x4cf60a;return db[_0xe0b0('0x32')][_0xe0b0('0x56')]({'where':{'id':_0x255200[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x9c7221,null))[_0xe0b0('0x2c')](function(_0x31dd21){if(_0x31dd21){_0x49deef=_0x31dd21;_0x429ac3[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x64')][_0xe0b0('0x33')]);_0x429ac3['query']=_['keys'](_0x255200[_0xe0b0('0x38')]);_0x429ac3['filters']=_['intersection'](_0x429ac3['model'],_0x429ac3['query']);_0x311f79[_0xe0b0('0x3c')]=_['intersection'](_0x429ac3[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x311f79['attributes']=_0x311f79[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x311f79['attributes']:_0x429ac3[_0xe0b0('0x37')];_0x311f79[_0xe0b0('0x59')]=qs[_0xe0b0('0x3f')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x311f79['where']=qs['filters'](_['pick'](_0x255200['query'],_0x429ac3['filters']));if(_0x255200[_0xe0b0('0x38')]['filter']){_0x311f79[_0xe0b0('0x40')]=_['merge'](_0x311f79[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x311f79[_0xe0b0('0x3c')],function(_0x380b4c){var _0x199929={};_0x199929[_0x380b4c]={'$like':'%'+_0x255200[_0xe0b0('0x38')]['filter']+'%'};return _0x199929;})});}_0x311f79=_['merge']({},_0x311f79,_0x255200['options']);return _0x49deef['getTeams'](_0x311f79);}})[_0xe0b0('0x2c')](function(_0x261381){if(_0x261381){_0x4cf60a=_0x261381[_0xe0b0('0x3e')];if(!_0x255200[_0xe0b0('0x38')][_0xe0b0('0x57')]('nolimit')){_0x311f79[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x22')]);_0x311f79[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x255200[_0xe0b0('0x38')][_0xe0b0('0x21')]);}return _0x49deef[_0xe0b0('0x63')](_0x311f79);}})['then'](function(_0x589c47){if(_0x589c47){return _0x589c47?{'count':_0x4cf60a,'rows':_0x589c47}:null;}})[_0xe0b0('0x2c')](respondWithResult(_0x9c7221,null))[_0xe0b0('0x53')](handleError(_0x9c7221,null));};exports['addTeams']=function(_0x7feff4,_0x4593f1,_0x44c475){var _0x3fcffd=_0x7feff4[_0xe0b0('0x4c')][_0xe0b0('0x65')];return db[_0xe0b0('0x64')][_0xe0b0('0x47')]({'where':{'id':_0x3fcffd},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xe0b0('0x66'),_0xe0b0('0x67'),'interface'],'raw':!![]}]})[_0xe0b0('0x2c')](function(_0x448694){if(_0x448694){var _0x396eec=_[_0xe0b0('0x68')](_0x448694,function(_0x5c45ae){var _0x56c4b9=_0x5c45ae['get']({'plain':!![]});return _0x56c4b9[_0xe0b0('0x69')];});return db[_0xe0b0('0x32')]['find']({'where':{'id':_0x7feff4[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](function(_0x5547ee){return db['sequelize'][_0xe0b0('0x6a')](function(_0x554181){return _0x5547ee[_0xe0b0('0x6b')](_0x3fcffd,{'transaction':_0x554181})['then'](function(){return BPromise[_0xe0b0('0x6c')](_0x396eec,function(_0x13995d){return db[_0xe0b0('0x5b')][_0xe0b0('0x6d')]({'where':{'UserId':_0x13995d['id'],'SmsQueueId':_0x7feff4[_0xe0b0('0x49')]['id']},'transaction':_0x554181});});})[_0xe0b0('0x2c')](function(){_0x396eec[_0xe0b0('0x6e')](function(_0x2ebbb5){socket[_0xe0b0('0x6f')]('userSmsQueue:save',{'UserId':_0x2ebbb5['id'],'SmsQueueId':_0x5547ee['id']});});});});});}})[_0xe0b0('0x2c')](respondWithStatusCode(_0x4593f1,null))[_0xe0b0('0x53')](handleError(_0x4593f1,null));};exports[_0xe0b0('0x70')]=function(_0x4e19f4,_0x1b7336,_0x4ad24f){return db[_0xe0b0('0x64')][_0xe0b0('0x47')]({'where':{'id':_0x4e19f4['query'][_0xe0b0('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0b0('0x2c')](handleEntityNotFound(_0x1b7336,null))['then'](function(_0x5085b0){var _0x4f027c=_[_0xe0b0('0x31')](_0x5085b0,'id');var _0x238979=[];var _0x9e8b9c=[];var _0x42b591=squel[_0xe0b0('0x71')]();_0x42b591['field'](_0xe0b0('0x72'))[_0xe0b0('0x73')](_0xe0b0('0x74'),'tq')['join'](_0xe0b0('0x75'),'ut',_0xe0b0('0x76'))['where']('SmsQueueId\x20=\x20?',_0x4e19f4[_0xe0b0('0x49')]['id']);for(var _0x556d14=0x0;_0x556d14<_0x5085b0[_0xe0b0('0x3e')];_0x556d14+=0x1){let _0xadc32=_0x5085b0[_0x556d14];for(var _0x40a5c0=0x0;_0x40a5c0<_0xadc32[_0xe0b0('0x69')][_0xe0b0('0x3e')];_0x40a5c0+=0x1){let _0x333d53=_0xadc32[_0xe0b0('0x69')][_0x40a5c0];var _0x504483=_0x42b591[_0xe0b0('0x77')]();_0x504483[_0xe0b0('0x40')](_0xe0b0('0x78'),_0x333d53['id']);_0x9e8b9c[_0xe0b0('0x79')](db[_0xe0b0('0x7a')]['query'](_0x504483['toString'](),{'type':db[_0xe0b0('0x7a')][_0xe0b0('0x7b')][_0xe0b0('0x7c')]})[_0xe0b0('0x2c')](function(_0xaeec1f){if(_0xaeec1f[_0xe0b0('0x3e')]===0x1){return _0x333d53['id'];}else{var _0x38ae1f=_[_0xe0b0('0x7d')](_[_0xe0b0('0x31')](_0xaeec1f,_0xe0b0('0x7e')),function(_0x4fe048){return _[_0xe0b0('0x7f')](_0x4f027c,_0x4fe048);});if(_0x38ae1f){return _0x333d53['id'];}}}));}}return BPromise[_0xe0b0('0x80')](_0x9e8b9c)[_0xe0b0('0x2c')](function(_0x16ed11){_0x238979=_(_0x238979)['union'](_0x16ed11)[_0xe0b0('0x81')]()[_0xe0b0('0x82')]();return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x4e19f4[_0xe0b0('0x49')]['id']}})['then'](function(_0x294e13){return db['sequelize'][_0xe0b0('0x6a')](function(_0x196ab7){return _0x294e13[_0xe0b0('0x70')](_0x4e19f4[_0xe0b0('0x38')][_0xe0b0('0x65')],{'transaction':_0x196ab7})['then'](function(){if(!_['isEmpty'](_0x238979)){return _0x294e13[_0xe0b0('0x83')](_0x238979,{'transaction':_0x196ab7});}})['then'](function(){_0x238979[_0xe0b0('0x6e')](function(_0x4c82d6){socket[_0xe0b0('0x6f')](_0xe0b0('0x84'),{'UserId':_0x4c82d6,'SmsQueueId':_0x294e13['id']});});});});});});})[_0xe0b0('0x2c')](respondWithStatusCode(_0x1b7336,null))[_0xe0b0('0x53')](handleError(_0x1b7336,null));};exports[_0xe0b0('0x85')]=function(_0x1bb4da,_0x43ff30,_0x5d7cee){return db['SmsQueue'][_0xe0b0('0x4a')]({'where':{'id':_0x1bb4da[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x43ff30,null))[_0xe0b0('0x2c')](function(_0xd83992){if(_0xd83992){return _0xd83992[_0xe0b0('0x85')](_0x1bb4da[_0xe0b0('0x4c')][_0xe0b0('0x65')],_[_0xe0b0('0x86')](_0x1bb4da[_0xe0b0('0x4c')],['ids','id'])||{})['spread'](function(_0x3dd34e){for(var _0x26caf8=0x0;_0x26caf8<_0x1bb4da[_0xe0b0('0x4c')][_0xe0b0('0x65')][_0xe0b0('0x3e')];_0x26caf8+=0x1){socket[_0xe0b0('0x6f')](_0xe0b0('0x87'),{'UserId':Number(_0x1bb4da['body']['ids'][_0x26caf8]),'SmsQueueId':Number(_0x1bb4da[_0xe0b0('0x49')]['id'])});}return _0x3dd34e;});}})[_0xe0b0('0x2c')](respondWithResult(_0x43ff30,null))[_0xe0b0('0x53')](handleError(_0x43ff30,null));};exports[_0xe0b0('0x83')]=function(_0x382ba7,_0x19cc74,_0x4173e0){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x382ba7[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x19cc74,null))[_0xe0b0('0x2c')](function(_0x3da9f8){if(_0x3da9f8){return _0x3da9f8['removeAgents'](_0x382ba7[_0xe0b0('0x38')][_0xe0b0('0x65')])[_0xe0b0('0x2c')](function(){if(_[_0xe0b0('0x88')](_0x382ba7[_0xe0b0('0x38')]['ids'])){for(var _0x14a778=0x0;_0x14a778<_0x382ba7[_0xe0b0('0x38')][_0xe0b0('0x65')][_0xe0b0('0x3e')];_0x14a778+=0x1){socket[_0xe0b0('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x382ba7[_0xe0b0('0x38')]['ids'][_0x14a778]),'SmsQueueId':Number(_0x382ba7[_0xe0b0('0x49')]['id'])});}}else{socket[_0xe0b0('0x6f')](_0xe0b0('0x84'),{'UserId':Number(_0x382ba7['query']['ids']),'SmsQueueId':Number(_0x382ba7[_0xe0b0('0x49')]['id'])});}});}})[_0xe0b0('0x2c')](respondWithStatusCode(_0x19cc74,null))[_0xe0b0('0x53')](handleError(_0x19cc74,null));};exports['getAgents']=function(_0x4d372a,_0x5da5eb,_0x5175e1){var _0x57694c={};var _0x52aa98={};var _0x3474ab;var _0x1c6674;return db['SmsQueue'][_0xe0b0('0x56')]({'where':{'id':_0x4d372a[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x5da5eb,null))[_0xe0b0('0x2c')](function(_0x437588){if(_0x437588){_0x3474ab=_0x437588;_0x52aa98['model']=_['keys'](db[_0xe0b0('0x89')][_0xe0b0('0x33')]);_0x52aa98[_0xe0b0('0x38')]=_['keys'](_0x4d372a[_0xe0b0('0x38')]);_0x52aa98[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x52aa98[_0xe0b0('0x37')],_0x52aa98[_0xe0b0('0x38')]);_0x57694c[_0xe0b0('0x3c')]=_['intersection'](_0x52aa98['model'],qs['fields'](_0x4d372a[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x57694c[_0xe0b0('0x3c')]=_0x57694c[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x57694c[_0xe0b0('0x3c')]:_0x52aa98[_0xe0b0('0x37')];_0x57694c[_0xe0b0('0x59')]=qs['sort'](_0x4d372a['query'][_0xe0b0('0x3f')]);_0x57694c[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_['pick'](_0x4d372a[_0xe0b0('0x38')],_0x52aa98[_0xe0b0('0x3a')]));if(_0x4d372a[_0xe0b0('0x38')]['filter']){_0x57694c[_0xe0b0('0x40')]=_['merge'](_0x57694c[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x57694c[_0xe0b0('0x3c')],function(_0x3038e2){var _0x3b133a={};_0x3b133a[_0x3038e2]={'$like':'%'+_0x4d372a[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x3b133a;})});}_0x57694c=_['merge']({},_0x57694c,_0x4d372a[_0xe0b0('0x44')]);return _0x3474ab[_0xe0b0('0x8a')](_0x57694c);}})['then'](function(_0x44e4a8){if(_0x44e4a8){_0x1c6674=_0x44e4a8[_0xe0b0('0x3e')];if(!_0x4d372a[_0xe0b0('0x38')]['hasOwnProperty'](_0xe0b0('0x58'))){_0x57694c[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x4d372a['query'][_0xe0b0('0x22')]);_0x57694c[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x4d372a[_0xe0b0('0x38')][_0xe0b0('0x21')]);}return _0x3474ab[_0xe0b0('0x8a')](_0x57694c);}})['then'](function(_0x44da91){if(_0x44da91){return _0x44da91?{'count':_0x1c6674,'rows':_0x44da91}:null;}})[_0xe0b0('0x2c')](respondWithResult(_0x5da5eb,null))[_0xe0b0('0x53')](handleError(_0x5da5eb,null));}; \ No newline at end of file +var _0xaf79=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','smsPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','isArray','getAgents','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','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','SmsQueues','UserProfileResource','destroy','error','stack','name','SmsQueue','rawAttributes','fieldName','type','key','model','map','keys','filters','query','fields','attributes','length','hasOwnProperty'];(function(_0x4f6a02,_0x1a9f63){var _0x538c63=function(_0x8f5323){while(--_0x8f5323){_0x4f6a02['push'](_0x4f6a02['shift']());}};_0x538c63(++_0x1a9f63);}(_0xaf79,0xe4));var _0x9af7=function(_0x4903e3,_0x2f1a47){_0x4903e3=_0x4903e3-0x0;var _0x35e723=_0xaf79[_0x4903e3];return _0x35e723;};'use strict';var emlformat=require(_0x9af7('0x0'));var rimraf=require(_0x9af7('0x1'));var zipdir=require(_0x9af7('0x2'));var jsonpatch=require(_0x9af7('0x3'));var rp=require(_0x9af7('0x4'));var moment=require(_0x9af7('0x5'));var BPromise=require(_0x9af7('0x6'));var Mustache=require(_0x9af7('0x7'));var util=require(_0x9af7('0x8'));var path=require(_0x9af7('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9af7('0xa'));var _=require(_0x9af7('0xb'));var squel=require(_0x9af7('0xc'));var crypto=require(_0x9af7('0xd'));var jsforce=require(_0x9af7('0xe'));var deskjs=require(_0x9af7('0xf'));var toCsv=require(_0x9af7('0x10'));var querystring=require(_0x9af7('0x11'));var Papa=require(_0x9af7('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9af7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9af7('0x14'));var logger=require(_0x9af7('0x15'))(_0x9af7('0x16'));var utils=require(_0x9af7('0x17'));var config=require(_0x9af7('0x18'));var licenseUtil=require(_0x9af7('0x19'));var db=require('../../mysqldb')['db'];config[_0x9af7('0x1a')]=_[_0x9af7('0x1b')](config[_0x9af7('0x1a')],{'host':_0x9af7('0x1c'),'port':0x18eb});var socket=require(_0x9af7('0x1d'))(new Redis(config[_0x9af7('0x1a')]));require(_0x9af7('0x1e'))[_0x9af7('0x1f')](socket);function respondWithStatusCode(_0x109052,_0x3ad37c){_0x3ad37c=_0x3ad37c||0xcc;return function(_0x30c8cb){if(_0x30c8cb){return _0x109052[_0x9af7('0x20')](_0x3ad37c);}return _0x109052['status'](_0x3ad37c)[_0x9af7('0x21')]();};}function respondWithResult(_0x10d96b,_0x48feb1){_0x48feb1=_0x48feb1||0xc8;return function(_0x372991){if(_0x372991){return _0x10d96b[_0x9af7('0x22')](_0x48feb1)[_0x9af7('0x23')](_0x372991);}};}function respondWithFilteredResult(_0x4de57f,_0x36910f){return function(_0x416aea){if(_0x416aea){var _0xe74d23=typeof _0x36910f[_0x9af7('0x24')]===_0x9af7('0x25')&&typeof _0x36910f[_0x9af7('0x26')]===_0x9af7('0x25');var _0x5efbcc=_0x416aea['count'];var _0x1941fc=_0xe74d23?0x0:_0x36910f[_0x9af7('0x24')];var _0x250cc5=_0xe74d23?_0x416aea[_0x9af7('0x27')]:_0x36910f[_0x9af7('0x24')]+_0x36910f[_0x9af7('0x26')];var _0xbd042d;if(_0x250cc5>=_0x5efbcc){_0x250cc5=_0x5efbcc;_0xbd042d=0xc8;}else{_0xbd042d=0xce;}_0x4de57f[_0x9af7('0x22')](_0xbd042d);return _0x4de57f[_0x9af7('0x28')](_0x9af7('0x29'),_0x1941fc+'-'+_0x250cc5+'/'+_0x5efbcc)[_0x9af7('0x23')](_0x416aea);}return null;};}function patchUpdates(_0x144b7a){return function(_0x2baf02){try{jsonpatch[_0x9af7('0x2a')](_0x2baf02,_0x144b7a,!![]);}catch(_0x442640){return BPromise[_0x9af7('0x2b')](_0x442640);}return _0x2baf02[_0x9af7('0x2c')]();};}function saveUpdates(_0x5ab3d0,_0x105837){return function(_0x5c587f){if(_0x5c587f){return _0x5c587f['update'](_0x5ab3d0)[_0x9af7('0x2d')](function(_0x1b5b50){return _0x1b5b50;});}return null;};}function removeEntity(_0x27aeee,_0x568d8e){return function(_0x148d09){if(_0x148d09){return _0x148d09['destroy']()[_0x9af7('0x2d')](function(){var _0xdf3c54=_0x148d09['get']({'plain':!![]});var _0x437899=_0x9af7('0x2e');return db[_0x9af7('0x2f')][_0x9af7('0x30')]({'where':{'type':_0x437899,'resourceId':_0xdf3c54['id']}})[_0x9af7('0x2d')](function(){return _0x148d09;});})[_0x9af7('0x2d')](function(){_0x27aeee[_0x9af7('0x22')](0xcc)[_0x9af7('0x21')]();});}};}function handleEntityNotFound(_0x5c29b9,_0x4fb57f){return function(_0x1bc398){if(!_0x1bc398){_0x5c29b9[_0x9af7('0x20')](0x194);}return _0x1bc398;};}function handleError(_0x190cd5,_0x49c08c){_0x49c08c=_0x49c08c||0x1f4;return function(_0xc5e9de){logger[_0x9af7('0x31')](_0xc5e9de[_0x9af7('0x32')]);if(_0xc5e9de[_0x9af7('0x33')]){delete _0xc5e9de[_0x9af7('0x33')];}_0x190cd5[_0x9af7('0x22')](_0x49c08c)['send'](_0xc5e9de);};}exports['index']=function(_0x321bc9,_0x2d2faf){var _0x312232={},_0x1e6630={},_0x2d01f2={'count':0x0,'rows':[]};var _0x4dc32a=_['map'](db[_0x9af7('0x34')][_0x9af7('0x35')],function(_0x1152bb){return{'name':_0x1152bb[_0x9af7('0x36')],'type':_0x1152bb[_0x9af7('0x37')][_0x9af7('0x38')]};});_0x1e6630[_0x9af7('0x39')]=_[_0x9af7('0x3a')](_0x4dc32a,_0x9af7('0x33'));_0x1e6630['query']=_[_0x9af7('0x3b')](_0x321bc9['query']);_0x1e6630[_0x9af7('0x3c')]=_['intersection'](_0x1e6630['model'],_0x1e6630['query']);_0x312232['attributes']=_['intersection'](_0x1e6630[_0x9af7('0x39')],qs['fields'](_0x321bc9[_0x9af7('0x3d')][_0x9af7('0x3e')]));_0x312232['attributes']=_0x312232[_0x9af7('0x3f')][_0x9af7('0x40')]?_0x312232[_0x9af7('0x3f')]:_0x1e6630[_0x9af7('0x39')];if(!_0x321bc9['query'][_0x9af7('0x41')](_0x9af7('0x42'))){_0x312232[_0x9af7('0x26')]=qs[_0x9af7('0x26')](_0x321bc9[_0x9af7('0x3d')][_0x9af7('0x26')]);_0x312232['offset']=qs[_0x9af7('0x24')](_0x321bc9['query'][_0x9af7('0x24')]);}_0x312232[_0x9af7('0x43')]=qs[_0x9af7('0x44')](_0x321bc9[_0x9af7('0x3d')][_0x9af7('0x44')]);_0x312232['where']=qs[_0x9af7('0x3c')](_[_0x9af7('0x45')](_0x321bc9['query'],_0x1e6630[_0x9af7('0x3c')]),_0x4dc32a);if(_0x321bc9[_0x9af7('0x3d')][_0x9af7('0x46')]){_0x312232[_0x9af7('0x47')]=_[_0x9af7('0x48')](_0x312232[_0x9af7('0x47')],{'$or':_[_0x9af7('0x3a')](_0x4dc32a,function(_0x2b2c07){if(_0x2b2c07[_0x9af7('0x37')]!==_0x9af7('0x49')){var _0x7b2d07={};_0x7b2d07[_0x2b2c07['name']]={'$like':'%'+_0x321bc9[_0x9af7('0x3d')][_0x9af7('0x46')]+'%'};return _0x7b2d07;}})});}_0x312232=_['merge']({},_0x312232,_0x321bc9[_0x9af7('0x4a')]);var _0xbea7e8={'where':_0x312232[_0x9af7('0x47')]};return db[_0x9af7('0x34')][_0x9af7('0x27')](_0xbea7e8)[_0x9af7('0x2d')](function(_0x49dad9){_0x2d01f2[_0x9af7('0x27')]=_0x49dad9;if(_0x321bc9[_0x9af7('0x3d')][_0x9af7('0x4b')]){_0x312232['include']=[{'all':!![]}];}return db['SmsQueue'][_0x9af7('0x4c')](_0x312232);})[_0x9af7('0x2d')](function(_0x3f0f60){_0x2d01f2[_0x9af7('0x4d')]=_0x3f0f60;return _0x2d01f2;})[_0x9af7('0x2d')](respondWithFilteredResult(_0x2d2faf,_0x312232))[_0x9af7('0x4e')](handleError(_0x2d2faf,null));};exports[_0x9af7('0x4f')]=function(_0x33cc59,_0x3a45b3){var _0x5c2c3c={'raw':!![],'where':{'id':_0x33cc59[_0x9af7('0x50')]['id']}},_0x121c6c={};_0x121c6c[_0x9af7('0x39')]=_[_0x9af7('0x3b')](db['SmsQueue'][_0x9af7('0x35')]);_0x121c6c[_0x9af7('0x3d')]=_[_0x9af7('0x3b')](_0x33cc59[_0x9af7('0x3d')]);_0x121c6c[_0x9af7('0x3c')]=_[_0x9af7('0x51')](_0x121c6c[_0x9af7('0x39')],_0x121c6c['query']);_0x5c2c3c[_0x9af7('0x3f')]=_['intersection'](_0x121c6c[_0x9af7('0x39')],qs[_0x9af7('0x3e')](_0x33cc59[_0x9af7('0x3d')][_0x9af7('0x3e')]));_0x5c2c3c['attributes']=_0x5c2c3c[_0x9af7('0x3f')][_0x9af7('0x40')]?_0x5c2c3c['attributes']:_0x121c6c[_0x9af7('0x39')];if(_0x33cc59['query']['includeAll']){_0x5c2c3c[_0x9af7('0x52')]=[{'all':!![]}];}_0x5c2c3c=_[_0x9af7('0x48')]({},_0x5c2c3c,_0x33cc59['options']);return db['SmsQueue'][_0x9af7('0x53')](_0x5c2c3c)[_0x9af7('0x2d')](handleEntityNotFound(_0x3a45b3,null))[_0x9af7('0x2d')](respondWithResult(_0x3a45b3,null))['catch'](handleError(_0x3a45b3,null));};exports[_0x9af7('0x54')]=function(_0x300f55,_0x5678df){return db[_0x9af7('0x34')][_0x9af7('0x54')](_0x300f55[_0x9af7('0x55')],{})[_0x9af7('0x2d')](function(_0x20ea4c){var _0x267bf6=_0x300f55[_0x9af7('0x56')][_0x9af7('0x57')]({'plain':!![]});if(!_0x267bf6)throw new Error(_0x9af7('0x58'));if(_0x267bf6[_0x9af7('0x59')]===_0x9af7('0x56')){var _0x3e6998=_0x20ea4c['get']({'plain':!![]});var _0x143583=_0x9af7('0x2e');return db[_0x9af7('0x5a')][_0x9af7('0x53')]({'where':{'name':_0x143583,'userProfileId':_0x267bf6[_0x9af7('0x5b')]},'raw':!![]})[_0x9af7('0x2d')](function(_0x5c9efd){if(_0x5c9efd&&_0x5c9efd[_0x9af7('0x5c')]===0x0){return db[_0x9af7('0x2f')][_0x9af7('0x54')]({'name':_0x3e6998[_0x9af7('0x33')],'resourceId':_0x3e6998['id'],'type':_0x5c9efd['name'],'sectionId':_0x5c9efd['id']},{})[_0x9af7('0x2d')](function(){return _0x20ea4c;});}else{return _0x20ea4c;}})[_0x9af7('0x4e')](function(_0x1a2571){logger['error'](_0x9af7('0x5d'),_0x1a2571);throw _0x1a2571;});}return _0x20ea4c;})['then'](respondWithResult(_0x5678df,0xc9))['catch'](handleError(_0x5678df,null));};exports[_0x9af7('0x5e')]=function(_0x27eeaa,_0x157f27){if(_0x27eeaa[_0x9af7('0x55')]['id']){delete _0x27eeaa[_0x9af7('0x55')]['id'];}return db['SmsQueue'][_0x9af7('0x53')]({'where':{'id':_0x27eeaa[_0x9af7('0x50')]['id']}})[_0x9af7('0x2d')](handleEntityNotFound(_0x157f27,null))[_0x9af7('0x2d')](saveUpdates(_0x27eeaa['body'],null))[_0x9af7('0x2d')](respondWithResult(_0x157f27,null))['catch'](handleError(_0x157f27,null));};exports['destroy']=function(_0x3c830c,_0x33a0c2){return db[_0x9af7('0x34')][_0x9af7('0x53')]({'where':{'id':_0x3c830c[_0x9af7('0x50')]['id']}})[_0x9af7('0x2d')](handleEntityNotFound(_0x33a0c2,null))[_0x9af7('0x2d')](removeEntity(_0x33a0c2,null))[_0x9af7('0x4e')](handleError(_0x33a0c2,null));};exports[_0x9af7('0x5f')]=function(_0x131f8e,_0x41f4f5){return db[_0x9af7('0x34')][_0x9af7('0x5f')]()[_0x9af7('0x2d')](respondWithResult(_0x41f4f5,null))[_0x9af7('0x4e')](handleError(_0x41f4f5,null));};exports[_0x9af7('0x60')]=function(_0x2aac11,_0x3ae03d,_0x4fe591){var _0x38a4bf={'raw':!![],'where':{}},_0x4f8add={},_0x4add0a;return db[_0x9af7('0x34')][_0x9af7('0x61')]({'where':{'id':_0x2aac11[_0x9af7('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ae03d,null))[_0x9af7('0x2d')](function(_0x2b18a9){if(_0x2b18a9){_0x4add0a=_0x2b18a9['get']({'plain':!![]});_0x4f8add['model']=_[_0x9af7('0x3b')](db[_0x9af7('0x62')]['rawAttributes']);_0x4f8add[_0x9af7('0x3d')]=_[_0x9af7('0x3b')](_0x2aac11[_0x9af7('0x3d')]);_0x4f8add[_0x9af7('0x3c')]=_[_0x9af7('0x51')](_0x4f8add['model'],_0x4f8add[_0x9af7('0x3d')]);_0x38a4bf[_0x9af7('0x3f')]=_[_0x9af7('0x51')](_0x4f8add[_0x9af7('0x39')],qs[_0x9af7('0x3e')](_0x2aac11['query'][_0x9af7('0x3e')]));_0x38a4bf['attributes']=_0x38a4bf[_0x9af7('0x3f')][_0x9af7('0x40')]?_0x38a4bf['attributes']:_0x4f8add['model'];if(!_0x2aac11[_0x9af7('0x3d')][_0x9af7('0x41')]('nolimit')){_0x38a4bf['limit']=qs['limit'](_0x2aac11['query'][_0x9af7('0x26')]);_0x38a4bf['offset']=qs[_0x9af7('0x24')](_0x2aac11[_0x9af7('0x3d')][_0x9af7('0x24')]);}_0x38a4bf[_0x9af7('0x43')]=qs['sort'](_0x2aac11[_0x9af7('0x3d')][_0x9af7('0x44')]);_0x38a4bf[_0x9af7('0x47')]=qs[_0x9af7('0x3c')](_[_0x9af7('0x45')](_0x2aac11[_0x9af7('0x3d')],_0x4f8add['filters']));_0x38a4bf['where'][_0x9af7('0x63')]=_0x2b18a9['id'];if(_0x2aac11['query']['filter']){_0x38a4bf[_0x9af7('0x47')]=_[_0x9af7('0x48')](_0x38a4bf[_0x9af7('0x47')],{'$or':_[_0x9af7('0x3a')](_0x38a4bf[_0x9af7('0x3f')],function(_0x33e0fa){var _0x575265={};_0x575265[_0x33e0fa]={'$like':'%'+_0x2aac11['query']['filter']+'%'};return _0x575265;})});}_0x38a4bf=_[_0x9af7('0x48')]({},_0x38a4bf,_0x2aac11['options']);return db[_0x9af7('0x62')]['findAll'](_0x38a4bf);}})[_0x9af7('0x2d')](function(_0x906e6){if(_0x906e6){return db[_0x9af7('0x64')][_0x9af7('0x65')]({'where':{'id':_[_0x9af7('0x3a')](_0x906e6,'UserId'),'role':'agent'},'attributes':['id','name',_0x9af7('0x66'),'updatedAt',_0x9af7('0x67')]});}})['then'](function(_0x12bc8c){if(_0x12bc8c){return{'count':_0x12bc8c['count'],'rows':_[_0x9af7('0x3a')](_0x12bc8c[_0x9af7('0x4d')],function(_0x5417a4){return{'membername':_0x5417a4[_0x9af7('0x33')],'UserId':_0x5417a4['id'],'queue_name':_0x4add0a[_0x9af7('0x33')],'SmsQueueId':_0x4add0a['id'],'interface':util[_0x9af7('0x68')](_0x9af7('0x69'),_0x9af7('0x6a'),_0x5417a4[_0x9af7('0x33')]),'penalty':0x0,'paused':_0x5417a4[_0x9af7('0x66')],'createdAt':_0x5417a4[_0x9af7('0x67')],'updatedAt':_0x5417a4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9af7('0x2d')](respondWithFilteredResult(_0x3ae03d,_0x38a4bf))[_0x9af7('0x4e')](handleError(_0x3ae03d,null));};exports[_0x9af7('0x6b')]=function(_0x38b93d,_0x42f254,_0xe4371c){var _0x76fbb6={};var _0x429411={};var _0x51ec94;var _0x360835;return db[_0x9af7('0x34')][_0x9af7('0x61')]({'where':{'id':_0x38b93d[_0x9af7('0x50')]['id']}})[_0x9af7('0x2d')](handleEntityNotFound(_0x42f254,null))[_0x9af7('0x2d')](function(_0x9cfcb7){if(_0x9cfcb7){_0x51ec94=_0x9cfcb7;_0x429411[_0x9af7('0x39')]=_[_0x9af7('0x3b')](db[_0x9af7('0x6c')][_0x9af7('0x35')]);_0x429411['query']=_[_0x9af7('0x3b')](_0x38b93d[_0x9af7('0x3d')]);_0x429411[_0x9af7('0x3c')]=_['intersection'](_0x429411[_0x9af7('0x39')],_0x429411[_0x9af7('0x3d')]);_0x76fbb6[_0x9af7('0x3f')]=_[_0x9af7('0x51')](_0x429411[_0x9af7('0x39')],qs[_0x9af7('0x3e')](_0x38b93d[_0x9af7('0x3d')][_0x9af7('0x3e')]));_0x76fbb6[_0x9af7('0x3f')]=_0x76fbb6[_0x9af7('0x3f')][_0x9af7('0x40')]?_0x76fbb6[_0x9af7('0x3f')]:_0x429411[_0x9af7('0x39')];_0x76fbb6[_0x9af7('0x43')]=qs[_0x9af7('0x44')](_0x38b93d['query']['sort']);_0x76fbb6['where']=qs[_0x9af7('0x3c')](_['pick'](_0x38b93d['query'],_0x429411[_0x9af7('0x3c')]));if(_0x38b93d[_0x9af7('0x3d')]['filter']){_0x76fbb6[_0x9af7('0x47')]=_['merge'](_0x76fbb6['where'],{'$or':_[_0x9af7('0x3a')](_0x76fbb6['attributes'],function(_0x23be37){var _0x38f28f={};_0x38f28f[_0x23be37]={'$like':'%'+_0x38b93d[_0x9af7('0x3d')][_0x9af7('0x46')]+'%'};return _0x38f28f;})});}_0x76fbb6=_[_0x9af7('0x48')]({},_0x76fbb6,_0x38b93d[_0x9af7('0x4a')]);return _0x51ec94[_0x9af7('0x6b')](_0x76fbb6);}})[_0x9af7('0x2d')](function(_0x607599){if(_0x607599){_0x360835=_0x607599[_0x9af7('0x40')];if(!_0x38b93d['query'][_0x9af7('0x41')](_0x9af7('0x42'))){_0x76fbb6['limit']=qs[_0x9af7('0x26')](_0x38b93d['query'][_0x9af7('0x26')]);_0x76fbb6[_0x9af7('0x24')]=qs[_0x9af7('0x24')](_0x38b93d[_0x9af7('0x3d')][_0x9af7('0x24')]);}return _0x51ec94[_0x9af7('0x6b')](_0x76fbb6);}})[_0x9af7('0x2d')](function(_0x22f694){if(_0x22f694){return _0x22f694?{'count':_0x360835,'rows':_0x22f694}:null;}})[_0x9af7('0x2d')](respondWithResult(_0x42f254,null))[_0x9af7('0x4e')](handleError(_0x42f254,null));};exports[_0x9af7('0x6d')]=function(_0x3d6b84,_0x4054d1,_0x14a446){var _0x7b8658=_0x3d6b84[_0x9af7('0x55')][_0x9af7('0x6e')];return db[_0x9af7('0x6c')][_0x9af7('0x4c')]({'where':{'id':_0x7b8658},'attributes':['id'],'include':[{'model':db[_0x9af7('0x64')],'as':_0x9af7('0x6f'),'attributes':['id',_0x9af7('0x33'),_0x9af7('0x70'),_0x9af7('0x71'),_0x9af7('0x72')],'raw':!![]}]})['then'](function(_0x3098dd){if(_0x3098dd){var _0x2bc9c1=_['flatMap'](_0x3098dd,function(_0x2ee20b){var _0x134c7c=_0x2ee20b[_0x9af7('0x57')]({'plain':!![]});return _0x134c7c[_0x9af7('0x6f')];});return db[_0x9af7('0x34')][_0x9af7('0x53')]({'where':{'id':_0x3d6b84['params']['id']}})['then'](function(_0x6cadaa){return db[_0x9af7('0x73')]['transaction'](function(_0x376b40){return _0x6cadaa[_0x9af7('0x6d')](_0x7b8658,{'transaction':_0x376b40})['then'](function(){return BPromise[_0x9af7('0x74')](_0x2bc9c1,function(_0x59c441){return db[_0x9af7('0x62')][_0x9af7('0x75')]({'where':{'UserId':_0x59c441['id'],'SmsQueueId':_0x3d6b84['params']['id']},'transaction':_0x376b40});});})['then'](function(){_0x2bc9c1[_0x9af7('0x76')](function(_0x303355){socket[_0x9af7('0x77')]('userSmsQueue:save',{'UserId':_0x303355['id'],'SmsQueueId':_0x6cadaa['id']});});});});});}})[_0x9af7('0x2d')](respondWithStatusCode(_0x4054d1,null))[_0x9af7('0x4e')](handleError(_0x4054d1,null));};exports[_0x9af7('0x78')]=function(_0xaffc38,_0x2532ea,_0x45083f){return db[_0x9af7('0x6c')][_0x9af7('0x4c')]({'where':{'id':_0xaffc38[_0x9af7('0x3d')][_0x9af7('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x9af7('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9af7('0x2d')](handleEntityNotFound(_0x2532ea,null))[_0x9af7('0x2d')](function(_0xe3450a){var _0x11c480=_[_0x9af7('0x3a')](_0xe3450a,'id');var _0x150eea=[];var _0x151405=[];var _0x5368ca=squel[_0x9af7('0x79')]();_0x5368ca[_0x9af7('0x7a')](_0x9af7('0x7b'))[_0x9af7('0x7c')](_0x9af7('0x7d'),'tq')[_0x9af7('0x7e')](_0x9af7('0x7f'),'ut',_0x9af7('0x80'))[_0x9af7('0x47')]('SmsQueueId\x20=\x20?',_0xaffc38[_0x9af7('0x50')]['id']);for(var _0x276611=0x0;_0x276611<_0xe3450a[_0x9af7('0x40')];_0x276611+=0x1){let _0x25b7f1=_0xe3450a[_0x276611];for(var _0x10b248=0x0;_0x10b248<_0x25b7f1['Agents'][_0x9af7('0x40')];_0x10b248+=0x1){let _0x2eebeb=_0x25b7f1[_0x9af7('0x6f')][_0x10b248];var _0x198f2f=_0x5368ca[_0x9af7('0x81')]();_0x198f2f[_0x9af7('0x47')](_0x9af7('0x82'),_0x2eebeb['id']);_0x151405['push'](db[_0x9af7('0x73')][_0x9af7('0x3d')](_0x198f2f['toString'](),{'type':db[_0x9af7('0x73')][_0x9af7('0x83')][_0x9af7('0x84')]})[_0x9af7('0x2d')](function(_0x3fe053){if(_0x3fe053[_0x9af7('0x40')]===0x1){return _0x2eebeb['id'];}else{var _0x2d60d4=_[_0x9af7('0x85')](_[_0x9af7('0x3a')](_0x3fe053,_0x9af7('0x86')),function(_0x200e78){return _[_0x9af7('0x87')](_0x11c480,_0x200e78);});if(_0x2d60d4){return _0x2eebeb['id'];}}}));}}return BPromise[_0x9af7('0x88')](_0x151405)['then'](function(_0x308c3c){_0x150eea=_(_0x150eea)[_0x9af7('0x89')](_0x308c3c)[_0x9af7('0x8a')]()['value']();return db[_0x9af7('0x34')][_0x9af7('0x53')]({'where':{'id':_0xaffc38['params']['id']}})[_0x9af7('0x2d')](function(_0x52f499){return db[_0x9af7('0x73')]['transaction'](function(_0x10c1e8){return _0x52f499[_0x9af7('0x78')](_0xaffc38[_0x9af7('0x3d')][_0x9af7('0x6e')],{'transaction':_0x10c1e8})[_0x9af7('0x2d')](function(){if(!_[_0x9af7('0x8b')](_0x150eea)){return _0x52f499[_0x9af7('0x8c')](_0x150eea,{'transaction':_0x10c1e8});}})[_0x9af7('0x2d')](function(){_0x150eea[_0x9af7('0x76')](function(_0xd20af8){socket[_0x9af7('0x77')](_0x9af7('0x8d'),{'UserId':_0xd20af8,'SmsQueueId':_0x52f499['id']});});});});});});})[_0x9af7('0x2d')](respondWithStatusCode(_0x2532ea,null))[_0x9af7('0x4e')](handleError(_0x2532ea,null));};exports[_0x9af7('0x8e')]=function(_0x40def7,_0x76276b,_0xb9bc18){return db[_0x9af7('0x34')][_0x9af7('0x53')]({'where':{'id':_0x40def7[_0x9af7('0x50')]['id']}})[_0x9af7('0x2d')](handleEntityNotFound(_0x76276b,null))[_0x9af7('0x2d')](function(_0x536d64){if(_0x536d64){return _0x536d64[_0x9af7('0x8e')](_0x40def7[_0x9af7('0x55')]['ids'],_['omit'](_0x40def7[_0x9af7('0x55')],[_0x9af7('0x6e'),'id'])||{})[_0x9af7('0x8f')](function(_0xdd0b43){for(var _0x174812=0x0;_0x174812<_0x40def7[_0x9af7('0x55')]['ids'][_0x9af7('0x40')];_0x174812+=0x1){socket['emit'](_0x9af7('0x90'),{'UserId':Number(_0x40def7[_0x9af7('0x55')]['ids'][_0x174812]),'SmsQueueId':Number(_0x40def7[_0x9af7('0x50')]['id'])});}return _0xdd0b43;});}})[_0x9af7('0x2d')](respondWithResult(_0x76276b,null))[_0x9af7('0x4e')](handleError(_0x76276b,null));};exports[_0x9af7('0x8c')]=function(_0x198e30,_0x584b9f,_0x55002a){return db[_0x9af7('0x34')][_0x9af7('0x53')]({'where':{'id':_0x198e30['params']['id']}})[_0x9af7('0x2d')](handleEntityNotFound(_0x584b9f,null))[_0x9af7('0x2d')](function(_0x3ba3e9){if(_0x3ba3e9){return _0x3ba3e9[_0x9af7('0x8c')](_0x198e30[_0x9af7('0x3d')][_0x9af7('0x6e')])[_0x9af7('0x2d')](function(){if(_[_0x9af7('0x91')](_0x198e30[_0x9af7('0x3d')][_0x9af7('0x6e')])){for(var _0x22e263=0x0;_0x22e263<_0x198e30[_0x9af7('0x3d')][_0x9af7('0x6e')][_0x9af7('0x40')];_0x22e263+=0x1){socket['emit'](_0x9af7('0x8d'),{'UserId':Number(_0x198e30[_0x9af7('0x3d')][_0x9af7('0x6e')][_0x22e263]),'SmsQueueId':Number(_0x198e30[_0x9af7('0x50')]['id'])});}}else{socket['emit'](_0x9af7('0x8d'),{'UserId':Number(_0x198e30[_0x9af7('0x3d')]['ids']),'SmsQueueId':Number(_0x198e30[_0x9af7('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x584b9f,null))['catch'](handleError(_0x584b9f,null));};exports['getAgents']=function(_0x2006a7,_0x787ede,_0x190f93){var _0x188fdf={};var _0x1857cc={};var _0x135f8d;var _0x47c60e;return db['SmsQueue']['findOne']({'where':{'id':_0x2006a7['params']['id']}})[_0x9af7('0x2d')](handleEntityNotFound(_0x787ede,null))[_0x9af7('0x2d')](function(_0x5d2644){if(_0x5d2644){_0x135f8d=_0x5d2644;_0x1857cc[_0x9af7('0x39')]=_[_0x9af7('0x3b')](db[_0x9af7('0x64')][_0x9af7('0x35')]);_0x1857cc[_0x9af7('0x3d')]=_['keys'](_0x2006a7[_0x9af7('0x3d')]);_0x1857cc[_0x9af7('0x3c')]=_[_0x9af7('0x51')](_0x1857cc['model'],_0x1857cc[_0x9af7('0x3d')]);_0x188fdf[_0x9af7('0x3f')]=_[_0x9af7('0x51')](_0x1857cc[_0x9af7('0x39')],qs[_0x9af7('0x3e')](_0x2006a7[_0x9af7('0x3d')][_0x9af7('0x3e')]));_0x188fdf['attributes']=_0x188fdf[_0x9af7('0x3f')][_0x9af7('0x40')]?_0x188fdf['attributes']:_0x1857cc[_0x9af7('0x39')];_0x188fdf[_0x9af7('0x43')]=qs['sort'](_0x2006a7[_0x9af7('0x3d')][_0x9af7('0x44')]);_0x188fdf[_0x9af7('0x47')]=qs[_0x9af7('0x3c')](_[_0x9af7('0x45')](_0x2006a7['query'],_0x1857cc[_0x9af7('0x3c')]));if(_0x2006a7['query'][_0x9af7('0x46')]){_0x188fdf[_0x9af7('0x47')]=_['merge'](_0x188fdf[_0x9af7('0x47')],{'$or':_['map'](_0x188fdf[_0x9af7('0x3f')],function(_0x804686){var _0x42bdeb={};_0x42bdeb[_0x804686]={'$like':'%'+_0x2006a7['query']['filter']+'%'};return _0x42bdeb;})});}_0x188fdf=_[_0x9af7('0x48')]({},_0x188fdf,_0x2006a7[_0x9af7('0x4a')]);return _0x135f8d[_0x9af7('0x92')](_0x188fdf);}})[_0x9af7('0x2d')](function(_0x4650a2){if(_0x4650a2){_0x47c60e=_0x4650a2[_0x9af7('0x40')];if(!_0x2006a7['query'][_0x9af7('0x41')](_0x9af7('0x42'))){_0x188fdf['limit']=qs['limit'](_0x2006a7[_0x9af7('0x3d')][_0x9af7('0x26')]);_0x188fdf[_0x9af7('0x24')]=qs[_0x9af7('0x24')](_0x2006a7['query'][_0x9af7('0x24')]);}return _0x135f8d['getAgents'](_0x188fdf);}})[_0x9af7('0x2d')](function(_0x585557){if(_0x585557){return _0x585557?{'count':_0x47c60e,'rows':_0x585557}:null;}})['then'](respondWithResult(_0x787ede,null))[_0x9af7('0x4e')](handleError(_0x787ede,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4d7aaa2..955b1f1 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 _0x8f6b=['events','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f6b,0x1a8));var _0xb8f6=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8f6b[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0xb8f6('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xb8f6('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb8f6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb8f6('0x3'),'afterDestroy':_0xb8f6('0x4')};function emitEvent(_0x3621a1){return function(_0x112c41,_0x19e5fd,_0x55ff29){SmsQueueEvents[_0xb8f6('0x5')](_0x3621a1+':'+_0x112c41['id'],_0x112c41);SmsQueueEvents[_0xb8f6('0x5')](_0x3621a1,_0x112c41);_0x55ff29(null);};}for(var e in events){if(events[_0xb8f6('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb8f6('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x9af5=['../../mysqldb','SmsQueue','save','remove','emit','hook','exports','events'];(function(_0x5ac5d6,_0x51eb3e){var _0x2c8e34=function(_0x5103c7){while(--_0x5103c7){_0x5ac5d6['push'](_0x5ac5d6['shift']());}};_0x2c8e34(++_0x51eb3e);}(_0x9af5,0xa7));var _0x59af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9af5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x59af('0x0'));var SmsQueue=require(_0x59af('0x1'))['db'][_0x59af('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59af('0x3'),'afterUpdate':'update','afterDestroy':_0x59af('0x4')};function emitEvent(_0x73937c){return function(_0x406a3b,_0x21d625,_0x162a86){SmsQueueEvents[_0x59af('0x5')](_0x73937c+':'+_0x406a3b['id'],_0x406a3b);SmsQueueEvents[_0x59af('0x5')](_0x73937c,_0x406a3b);_0x162a86(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x59af('0x6')](e,emitEvent(event));}}module[_0x59af('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4d8d961..fb65c49 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 _0x1643=['sms_queues','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x1643,0x118));var _0x3164=function(_0x2e88f8,_0x34c51c){_0x2e88f8=_0x2e88f8-0x0;var _0xada200=_0x1643[_0x2e88f8];return _0xada200;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3164('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3164('0x1'));var rp=require(_0x3164('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3164('0x3'));var config=require(_0x3164('0x4'));var attributes=require(_0x3164('0x5'));module[_0x3164('0x6')]=function(_0x22e723,_0x597972){return _0x22e723[_0x3164('0x7')]('SmsQueue',attributes,{'tableName':_0x3164('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb97=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api','moment'];(function(_0x1ce236,_0xca922e){var _0x241819=function(_0x1a66f8){while(--_0x1a66f8){_0x1ce236['push'](_0x1ce236['shift']());}};_0x241819(++_0xca922e);}(_0xfb97,0xf7));var _0x7fb9=function(_0x61711c,_0x5b2962){_0x61711c=_0x61711c-0x0;var _0x4cf0e9=_0xfb97[_0x61711c];return _0x4cf0e9;};'use strict';var _=require(_0x7fb9('0x0'));var util=require(_0x7fb9('0x1'));var logger=require(_0x7fb9('0x2'))(_0x7fb9('0x3'));var moment=require(_0x7fb9('0x4'));var BPromise=require(_0x7fb9('0x5'));var rp=require(_0x7fb9('0x6'));var fs=require('fs');var path=require(_0x7fb9('0x7'));var rimraf=require(_0x7fb9('0x8'));var config=require(_0x7fb9('0x9'));var attributes=require(_0x7fb9('0xa'));module[_0x7fb9('0xb')]=function(_0x52cc4a,_0x53dce1){return _0x52cc4a[_0x7fb9('0xc')](_0x7fb9('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 509a2d8..99c7a8d 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 _0x7cd0=['./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','model','catch','ShowSmsQueue','find','map','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7cd0,0xb7));var _0x07cd=function(_0x14806a,_0x14d122){_0x14806a=_0x14806a-0x0;var _0x12e125=_0x7cd0[_0x14806a];return _0x12e125;};'use strict';var _=require('lodash');var util=require(_0x07cd('0x0'));var moment=require(_0x07cd('0x1'));var BPromise=require(_0x07cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07cd('0x3'))['db'];var utils=require(_0x07cd('0x4'));var logger=require(_0x07cd('0x5'))('rpc');var config=require(_0x07cd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x07cd('0x7')][_0x07cd('0x8')]({'port':0x232a});config[_0x07cd('0x9')]=_[_0x07cd('0xa')](config[_0x07cd('0x9')],{'host':_0x07cd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07cd('0x9')]));require(_0x07cd('0xc'))[_0x07cd('0xd')](socket);function respondWithRpcPromise(_0x1d5237,_0x277226,_0x5b84f7){return new BPromise(function(_0x5d5dcf,_0x3f6ca8){return client[_0x07cd('0xe')](_0x1d5237,_0x5b84f7)[_0x07cd('0xf')](function(_0x1d7710){logger[_0x07cd('0x10')]('SmsQueue,\x20%s,\x20%s',_0x277226,_0x07cd('0x11'));logger[_0x07cd('0x12')](_0x07cd('0x13'),_0x277226,_0x07cd('0x11'),JSON[_0x07cd('0x14')](_0x1d7710));if(_0x1d7710[_0x07cd('0x15')]){if(_0x1d7710[_0x07cd('0x15')][_0x07cd('0x16')]===0x1f4){logger[_0x07cd('0x15')](_0x07cd('0x17'),_0x277226,_0x1d7710[_0x07cd('0x15')][_0x07cd('0x18')]);return _0x3f6ca8(_0x1d7710[_0x07cd('0x15')][_0x07cd('0x18')]);}logger[_0x07cd('0x15')]('SmsQueue,\x20%s,\x20%s',_0x277226,_0x1d7710[_0x07cd('0x15')]['message']);return _0x5d5dcf(_0x1d7710[_0x07cd('0x15')][_0x07cd('0x18')]);}else{logger[_0x07cd('0x10')](_0x07cd('0x17'),_0x277226,_0x07cd('0x11'));_0x5d5dcf(_0x1d7710['result'][_0x07cd('0x18')]);}})['catch'](function(_0x142377){logger[_0x07cd('0x15')](_0x07cd('0x17'),_0x277226,_0x142377);_0x3f6ca8(_0x142377);});});}exports[_0x07cd('0x19')]=function(_0x57b100){var _0x5ed649=this;return new Promise(function(_0x37c30e,_0x54d44b){return db[_0x07cd('0x1a')][_0x07cd('0x1b')]({'raw':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x1e')]||null:null,'attributes':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x1f')]||null:null,'limit':_0x57b100['options']?_0x57b100['options'][_0x07cd('0x20')]||null:null,'include':_0x57b100[_0x07cd('0x1c')]?_0x57b100[_0x07cd('0x1c')][_0x07cd('0x21')]?_['map'](_0x57b100[_0x07cd('0x1c')][_0x07cd('0x21')],function(_0x3b4ce5){return{'model':db[_0x3b4ce5['model']],'as':_0x3b4ce5['as'],'attributes':_0x3b4ce5[_0x07cd('0x1f')],'include':_0x3b4ce5[_0x07cd('0x21')]?_['map'](_0x3b4ce5[_0x07cd('0x21')],function(_0x332354){return{'model':db[_0x332354[_0x07cd('0x22')]],'as':_0x332354['as'],'attributes':_0x332354[_0x07cd('0x1f')],'include':_0x332354[_0x07cd('0x21')]?_['map'](_0x332354[_0x07cd('0x21')],function(_0x428b3f){return{'model':db[_0x428b3f['model']],'as':_0x428b3f['as'],'attributes':_0x428b3f[_0x07cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x07cd('0xf')](function(_0x1b8c20){logger[_0x07cd('0x10')]('GetSmsQueue',_0x57b100);logger[_0x07cd('0x12')]('GetSmsQueue',_0x57b100,JSON[_0x07cd('0x14')](_0x1b8c20));_0x37c30e(_0x1b8c20);})[_0x07cd('0x23')](function(_0x713722){logger[_0x07cd('0x15')](_0x07cd('0x19'),_0x713722['message'],_0x57b100);_0x54d44b(_0x5ed649[_0x07cd('0x15')](0x1f4,_0x713722[_0x07cd('0x18')]));});});};exports[_0x07cd('0x24')]=function(_0x248480){var _0x4a2a5b=this;return new Promise(function(_0x238279,_0x122b82){return db[_0x07cd('0x1a')][_0x07cd('0x25')]({'raw':_0x248480[_0x07cd('0x1c')]?_0x248480[_0x07cd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x248480[_0x07cd('0x1c')]?_0x248480[_0x07cd('0x1c')]['where']||null:null,'attributes':_0x248480[_0x07cd('0x1c')]?_0x248480['options'][_0x07cd('0x1f')]||null:null,'include':_0x248480[_0x07cd('0x1c')]?_0x248480[_0x07cd('0x1c')][_0x07cd('0x21')]?_[_0x07cd('0x26')](_0x248480[_0x07cd('0x1c')][_0x07cd('0x21')],function(_0x20623e){return{'model':db[_0x20623e[_0x07cd('0x22')]],'as':_0x20623e['as'],'attributes':_0x20623e['attributes'],'include':_0x20623e[_0x07cd('0x21')]?_[_0x07cd('0x26')](_0x20623e[_0x07cd('0x21')],function(_0x570042){return{'model':db[_0x570042[_0x07cd('0x22')]],'as':_0x570042['as'],'attributes':_0x570042['attributes'],'include':_0x570042[_0x07cd('0x21')]?_[_0x07cd('0x26')](_0x570042['include'],function(_0x31c0d6){return{'model':db[_0x31c0d6[_0x07cd('0x22')]],'as':_0x31c0d6['as'],'attributes':_0x31c0d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x07cd('0xf')](function(_0x5dad26){logger[_0x07cd('0x10')](_0x07cd('0x24'),_0x248480);logger['debug'](_0x07cd('0x24'),_0x248480,JSON[_0x07cd('0x14')](_0x5dad26));_0x238279(_0x5dad26);})['catch'](function(_0x4ba296){logger[_0x07cd('0x15')](_0x07cd('0x24'),_0x4ba296['message'],_0x248480);_0x122b82(_0x4a2a5b[_0x07cd('0x15')](0x1f4,_0x4ba296[_0x07cd('0x18')]));});});}; \ No newline at end of file +var _0x8f62=['GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','SmsQueue','ShowSmsQueue','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch'];(function(_0x59726f,_0x12ca2b){var _0x261676=function(_0x48bc57){while(--_0x48bc57){_0x59726f['push'](_0x59726f['shift']());}};_0x261676(++_0x12ca2b);}(_0x8f62,0x81));var _0x28f6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f62[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x28f6('0x0'));var moment=require(_0x28f6('0x1'));var BPromise=require(_0x28f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x28f6('0x4'));var logger=require(_0x28f6('0x5'))('rpc');var config=require(_0x28f6('0x6'));var jayson=require(_0x28f6('0x7'));var client=jayson[_0x28f6('0x8')][_0x28f6('0x9')]({'port':0x232a});config[_0x28f6('0xa')]=_[_0x28f6('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x28f6('0xc'))(new Redis(config[_0x28f6('0xa')]));require(_0x28f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x3ec537,_0xe6f021,_0x279ab1){return new BPromise(function(_0x3e0929,_0x3fa69f){return client[_0x28f6('0xe')](_0x3ec537,_0x279ab1)[_0x28f6('0xf')](function(_0x3583ff){logger[_0x28f6('0x10')]('SmsQueue,\x20%s,\x20%s',_0xe6f021,_0x28f6('0x11'));logger[_0x28f6('0x12')](_0x28f6('0x13'),_0xe6f021,'request\x20sent',JSON[_0x28f6('0x14')](_0x3583ff));if(_0x3583ff[_0x28f6('0x15')]){if(_0x3583ff['error'][_0x28f6('0x16')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0xe6f021,_0x3583ff[_0x28f6('0x15')][_0x28f6('0x17')]);return _0x3fa69f(_0x3583ff[_0x28f6('0x15')][_0x28f6('0x17')]);}logger['error'](_0x28f6('0x18'),_0xe6f021,_0x3583ff[_0x28f6('0x15')]['message']);return _0x3e0929(_0x3583ff[_0x28f6('0x15')][_0x28f6('0x17')]);}else{logger[_0x28f6('0x10')]('SmsQueue,\x20%s,\x20%s',_0xe6f021,_0x28f6('0x11'));_0x3e0929(_0x3583ff[_0x28f6('0x19')]['message']);}})[_0x28f6('0x1a')](function(_0x5c0bc5){logger[_0x28f6('0x15')](_0x28f6('0x18'),_0xe6f021,_0x5c0bc5);_0x3fa69f(_0x5c0bc5);});});}exports[_0x28f6('0x1b')]=function(_0x335a47){var _0x27b52f=this;return new Promise(function(_0x40277a,_0x142402){return db['SmsQueue'][_0x28f6('0x1c')]({'raw':_0x335a47[_0x28f6('0x1d')]?_0x335a47[_0x28f6('0x1d')][_0x28f6('0x1e')]===undefined?!![]:![]:!![],'where':_0x335a47[_0x28f6('0x1d')]?_0x335a47[_0x28f6('0x1d')][_0x28f6('0x1f')]||null:null,'attributes':_0x335a47[_0x28f6('0x1d')]?_0x335a47[_0x28f6('0x1d')][_0x28f6('0x20')]||null:null,'limit':_0x335a47[_0x28f6('0x1d')]?_0x335a47[_0x28f6('0x1d')][_0x28f6('0x21')]||null:null,'include':_0x335a47[_0x28f6('0x1d')]?_0x335a47['options'][_0x28f6('0x22')]?_[_0x28f6('0x23')](_0x335a47[_0x28f6('0x1d')][_0x28f6('0x22')],function(_0x53bbdf){return{'model':db[_0x53bbdf[_0x28f6('0x24')]],'as':_0x53bbdf['as'],'attributes':_0x53bbdf[_0x28f6('0x20')],'include':_0x53bbdf['include']?_[_0x28f6('0x23')](_0x53bbdf[_0x28f6('0x22')],function(_0x55c2e4){return{'model':db[_0x55c2e4[_0x28f6('0x24')]],'as':_0x55c2e4['as'],'attributes':_0x55c2e4[_0x28f6('0x20')],'include':_0x55c2e4['include']?_[_0x28f6('0x23')](_0x55c2e4[_0x28f6('0x22')],function(_0x18c0f6){return{'model':db[_0x18c0f6[_0x28f6('0x24')]],'as':_0x18c0f6['as'],'attributes':_0x18c0f6['attributes']};}):[]};}):[]};}):[]:[]})[_0x28f6('0xf')](function(_0x4b4d1e){logger[_0x28f6('0x10')]('GetSmsQueue',_0x335a47);logger[_0x28f6('0x12')]('GetSmsQueue',_0x335a47,JSON[_0x28f6('0x14')](_0x4b4d1e));_0x40277a(_0x4b4d1e);})['catch'](function(_0x57454a){logger[_0x28f6('0x15')](_0x28f6('0x1b'),_0x57454a[_0x28f6('0x17')],_0x335a47);_0x142402(_0x27b52f['error'](0x1f4,_0x57454a[_0x28f6('0x17')]));});});};exports['ShowSmsQueue']=function(_0x25f370){var _0x13ded3=this;return new Promise(function(_0x174441,_0x591b80){return db[_0x28f6('0x25')]['find']({'raw':_0x25f370[_0x28f6('0x1d')]?_0x25f370['options'][_0x28f6('0x1e')]===undefined?!![]:![]:!![],'where':_0x25f370[_0x28f6('0x1d')]?_0x25f370['options'][_0x28f6('0x1f')]||null:null,'attributes':_0x25f370[_0x28f6('0x1d')]?_0x25f370[_0x28f6('0x1d')][_0x28f6('0x20')]||null:null,'include':_0x25f370[_0x28f6('0x1d')]?_0x25f370[_0x28f6('0x1d')][_0x28f6('0x22')]?_[_0x28f6('0x23')](_0x25f370[_0x28f6('0x1d')][_0x28f6('0x22')],function(_0x20d416){return{'model':db[_0x20d416['model']],'as':_0x20d416['as'],'attributes':_0x20d416[_0x28f6('0x20')],'include':_0x20d416['include']?_[_0x28f6('0x23')](_0x20d416['include'],function(_0x44d5e9){return{'model':db[_0x44d5e9[_0x28f6('0x24')]],'as':_0x44d5e9['as'],'attributes':_0x44d5e9[_0x28f6('0x20')],'include':_0x44d5e9[_0x28f6('0x22')]?_[_0x28f6('0x23')](_0x44d5e9[_0x28f6('0x22')],function(_0x27c1c5){return{'model':db[_0x27c1c5['model']],'as':_0x27c1c5['as'],'attributes':_0x27c1c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee1f1){logger[_0x28f6('0x10')]('ShowSmsQueue',_0x25f370);logger[_0x28f6('0x12')](_0x28f6('0x26'),_0x25f370,JSON[_0x28f6('0x14')](_0x5ee1f1));_0x174441(_0x5ee1f1);})[_0x28f6('0x1a')](function(_0x3eb70e){logger[_0x28f6('0x15')](_0x28f6('0x26'),_0x3eb70e['message'],_0x25f370);_0x591b80(_0x13ded3['error'](0x1f4,_0x3eb70e[_0x28f6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e7d359c..95f927a 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 _0x96ab=['emit','removeListener','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x11e8d2,_0x386588){var _0x2012db=function(_0x5b5033){while(--_0x5b5033){_0x11e8d2['push'](_0x11e8d2['shift']());}};_0x2012db(++_0x386588);}(_0x96ab,0xec));var _0xb96a=function(_0x2c3ed5,_0x258e87){_0x2c3ed5=_0x2c3ed5-0x0;var _0x4c4067=_0x96ab[_0x2c3ed5];return _0x4c4067;};'use strict';var SmsQueueEvents=require(_0xb96a('0x0'));var events=[_0xb96a('0x1'),_0xb96a('0x2'),_0xb96a('0x3')];function createListener(_0x4582d5,_0x4f4bcf){return function(_0x28f5ee){_0x4f4bcf[_0xb96a('0x4')](_0x4582d5,_0x28f5ee);};}function removeListener(_0x6c381f,_0x1e27ca){return function(){SmsQueueEvents[_0xb96a('0x5')](_0x6c381f,_0x1e27ca);};}exports[_0xb96a('0x6')]=function(_0x25d97a){for(var _0x2776ad=0x0,_0x280880=events['length'];_0x2776ad<_0x280880;_0x2776ad++){var _0x2e69be=events[_0x2776ad];var _0x346b1c=createListener(_0xb96a('0x7')+_0x2e69be,_0x25d97a);SmsQueueEvents['on'](_0x2e69be,_0x346b1c);}}; \ No newline at end of file +var _0xe095=['./smsQueue.events','remove','removeListener','register','length','smsQueue:'];(function(_0x40e63a,_0xf7513a){var _0x8c950a=function(_0x10e67e){while(--_0x10e67e){_0x40e63a['push'](_0x40e63a['shift']());}};_0x8c950a(++_0xf7513a);}(_0xe095,0x198));var _0x5e09=function(_0x1bc82d,_0xef9531){_0x1bc82d=_0x1bc82d-0x0;var _0x11a505=_0xe095[_0x1bc82d];return _0x11a505;};'use strict';var SmsQueueEvents=require(_0x5e09('0x0'));var events=['save',_0x5e09('0x1'),'update'];function createListener(_0x3e4b3c,_0x20e948){return function(_0xec1e50){_0x20e948['emit'](_0x3e4b3c,_0xec1e50);};}function removeListener(_0x4db5ce,_0x286252){return function(){SmsQueueEvents[_0x5e09('0x2')](_0x4db5ce,_0x286252);};}exports[_0x5e09('0x3')]=function(_0x535fb7){for(var _0x1584b3=0x0,_0x596d2b=events[_0x5e09('0x4')];_0x1584b3<_0x596d2b;_0x1584b3++){var _0x5702dc=events[_0x1584b3];var _0xcde27c=createListener(_0x5e09('0x5')+_0x5702dc,_0x535fb7);SmsQueueEvents['on'](_0x5702dc,_0xcde27c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3033296..2361f8d 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 _0x6b24=['/:id','show','post','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0xfff675,_0x3ec3b0){var _0x45477c=function(_0x554bd9){while(--_0x554bd9){_0xfff675['push'](_0xfff675['shift']());}};_0x45477c(++_0x3ec3b0);}(_0x6b24,0xf7));var _0x46b2=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x6b24[_0x623e7];return _0x121131;};'use strict';var multer=require(_0x46b2('0x0'));var util=require(_0x46b2('0x1'));var path=require(_0x46b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46b2('0x3')]();var fs_extra=require(_0x46b2('0x4'));var auth=require(_0x46b2('0x5'));var interaction=require(_0x46b2('0x6'));var config=require(_0x46b2('0x7'));var controller=require('./smsQueueReport.controller');router[_0x46b2('0x8')]('/',auth[_0x46b2('0x9')](),controller[_0x46b2('0xa')]);router[_0x46b2('0x8')](_0x46b2('0xb'),auth['isAuthenticated'](),controller[_0x46b2('0xc')]);router[_0x46b2('0x8')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0xe')]);router[_0x46b2('0xf')]('/',auth[_0x46b2('0x9')](),controller['create']);router['put']('/:id',auth[_0x46b2('0x9')](),controller[_0x46b2('0x10')]);router[_0x46b2('0x11')](_0x46b2('0xd'),auth[_0x46b2('0x9')](),controller[_0x46b2('0x12')]);module[_0x46b2('0x13')]=router; \ No newline at end of file +var _0xce50=['index','describe','/:id','show','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0xec0f10,_0x155f24){var _0x57bea5=function(_0x47f4aa){while(--_0x47f4aa){_0xec0f10['push'](_0xec0f10['shift']());}};_0x57bea5(++_0x155f24);}(_0xce50,0x1d8));var _0x0ce5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xce50[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0x0ce5('0x0'));var path=require(_0x0ce5('0x1'));var timeout=require(_0x0ce5('0x2'));var express=require(_0x0ce5('0x3'));var router=express[_0x0ce5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0ce5('0x5'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x0ce5('0x6')]('/',auth[_0x0ce5('0x7')](),controller[_0x0ce5('0x8')]);router[_0x0ce5('0x6')]('/describe',auth[_0x0ce5('0x7')](),controller[_0x0ce5('0x9')]);router['get'](_0x0ce5('0xa'),auth['isAuthenticated'](),controller[_0x0ce5('0xb')]);router[_0x0ce5('0xc')]('/',auth[_0x0ce5('0x7')](),controller[_0x0ce5('0xd')]);router['put'](_0x0ce5('0xa'),auth[_0x0ce5('0x7')](),controller[_0x0ce5('0xe')]);router[_0x0ce5('0xf')](_0x0ce5('0xa'),auth['isAuthenticated'](),controller['destroy']);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 e500229..e5fdaab 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 _0xdbf7=['DATE','moment','sequelize','exports','STRING'];(function(_0x3064a3,_0x20e71a){var _0x4319b6=function(_0x2e5240){while(--_0x2e5240){_0x3064a3['push'](_0x3064a3['shift']());}};_0x4319b6(++_0x20e71a);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x19e71d,_0xf5732d){_0x19e71d=_0x19e71d-0x0;var _0x304813=_0xdbf7[_0x19e71d];return _0x304813;};'use strict';var moment=require(_0x7dbf('0x0'));var Sequelize=require(_0x7dbf('0x1'));module[_0x7dbf('0x2')]={'uniqueid':{'type':Sequelize[_0x7dbf('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7dbf('0x3')]},'joinAt':{'type':Sequelize[_0x7dbf('0x4')]},'leaveAt':{'type':Sequelize[_0x7dbf('0x4')]},'acceptAt':{'type':Sequelize[_0x7dbf('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7dbf('0x3')]}}; \ No newline at end of file +var _0xd40a=['sequelize','STRING','DATE'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0xd40a,0x17d));var _0xad40=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd40a[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xad40('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xad40('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xad40('0x1')]},'joinAt':{'type':Sequelize[_0xad40('0x2')]},'leaveAt':{'type':Sequelize[_0xad40('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xad40('0x2')]},'reason':{'type':Sequelize[_0xad40('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 011a5ef..e0ea4bc 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 _0x0e6c=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','SmsQueueReport','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','catch','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse'];(function(_0x6da8a9,_0x2f2989){var _0x275eb1=function(_0x2afa34){while(--_0x2afa34){_0x6da8a9['push'](_0x6da8a9['shift']());}};_0x275eb1(++_0x2f2989);}(_0x0e6c,0xc2));var _0xc0e6=function(_0x225c9c,_0xf844d7){_0x225c9c=_0x225c9c-0x0;var _0x1540a5=_0x0e6c[_0x225c9c];return _0x1540a5;};'use strict';var emlformat=require(_0xc0e6('0x0'));var rimraf=require(_0xc0e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0e6('0x2'));var rp=require(_0xc0e6('0x3'));var moment=require(_0xc0e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc0e6('0x5'));var util=require(_0xc0e6('0x6'));var path=require(_0xc0e6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc0e6('0x8'));var fs=require('fs');var fs_extra=require(_0xc0e6('0x9'));var _=require(_0xc0e6('0xa'));var squel=require(_0xc0e6('0xb'));var crypto=require(_0xc0e6('0xc'));var jsforce=require(_0xc0e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc0e6('0xe'));var querystring=require('querystring');var Papa=require(_0xc0e6('0xf'));var Redis=require('ioredis');var authService=require(_0xc0e6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc0e6('0x11'));var hardwareService=require(_0xc0e6('0x12'));var logger=require(_0xc0e6('0x13'))(_0xc0e6('0x14'));var utils=require(_0xc0e6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc0e6('0x16'));var db=require(_0xc0e6('0x17'))['db'];function respondWithStatusCode(_0x3ac87d,_0x28aa9e){_0x28aa9e=_0x28aa9e||0xcc;return function(_0x1d1ddd){if(_0x1d1ddd){return _0x3ac87d[_0xc0e6('0x18')](_0x28aa9e);}return _0x3ac87d[_0xc0e6('0x19')](_0x28aa9e)['end']();};}function respondWithResult(_0x526277,_0x49d565){_0x49d565=_0x49d565||0xc8;return function(_0xf9e2e5){if(_0xf9e2e5){return _0x526277['status'](_0x49d565)['json'](_0xf9e2e5);}};}function respondWithFilteredResult(_0x3d474c,_0x33e88e){return function(_0x56c745){if(_0x56c745){var _0xe340ac=typeof _0x33e88e['offset']===_0xc0e6('0x1a')&&typeof _0x33e88e[_0xc0e6('0x1b')]===_0xc0e6('0x1a');var _0x50929e=_0x56c745[_0xc0e6('0x1c')];var _0x25632b=_0xe340ac?0x0:_0x33e88e[_0xc0e6('0x1d')];var _0x215cc4=_0xe340ac?_0x56c745[_0xc0e6('0x1c')]:_0x33e88e[_0xc0e6('0x1d')]+_0x33e88e[_0xc0e6('0x1b')];var _0x23fa8c;if(_0x215cc4>=_0x50929e){_0x215cc4=_0x50929e;_0x23fa8c=0xc8;}else{_0x23fa8c=0xce;}_0x3d474c[_0xc0e6('0x19')](_0x23fa8c);return _0x3d474c[_0xc0e6('0x1e')](_0xc0e6('0x1f'),_0x25632b+'-'+_0x215cc4+'/'+_0x50929e)[_0xc0e6('0x20')](_0x56c745);}return null;};}function patchUpdates(_0x11d62a){return function(_0x329473){try{jsonpatch[_0xc0e6('0x21')](_0x329473,_0x11d62a,!![]);}catch(_0x1be179){return BPromise[_0xc0e6('0x22')](_0x1be179);}return _0x329473[_0xc0e6('0x23')]();};}function saveUpdates(_0x3ecd5c,_0x38bd44){return function(_0x1ab520){if(_0x1ab520){return _0x1ab520[_0xc0e6('0x24')](_0x3ecd5c)[_0xc0e6('0x25')](function(_0x4b57a3){return _0x4b57a3;});}return null;};}function removeEntity(_0x296531,_0x80199e){return function(_0x3339f6){if(_0x3339f6){return _0x3339f6[_0xc0e6('0x26')]()['then'](function(){_0x296531[_0xc0e6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a1cc,_0x2149dc){return function(_0x5d7242){if(!_0x5d7242){_0x54a1cc[_0xc0e6('0x18')](0x194);}return _0x5d7242;};}function handleError(_0x871fa4,_0x4500c3){_0x4500c3=_0x4500c3||0x1f4;return function(_0x1d41a9){logger[_0xc0e6('0x27')](_0x1d41a9['stack']);if(_0x1d41a9[_0xc0e6('0x28')]){delete _0x1d41a9['name'];}_0x871fa4[_0xc0e6('0x19')](_0x4500c3)['send'](_0x1d41a9);};}exports[_0xc0e6('0x29')]=function(_0x496d51,_0x415c73){var _0x2b8fb1={},_0x2a3e2d={},_0x14897f={'count':0x0,'rows':[]};var _0x195817=_[_0xc0e6('0x2a')](db[_0xc0e6('0x2b')]['rawAttributes'],function(_0x21fae2){return{'name':_0x21fae2[_0xc0e6('0x2c')],'type':_0x21fae2[_0xc0e6('0x2d')]['key']};});_0x2a3e2d[_0xc0e6('0x2e')]=_[_0xc0e6('0x2a')](_0x195817,_0xc0e6('0x28'));_0x2a3e2d['query']=_[_0xc0e6('0x2f')](_0x496d51[_0xc0e6('0x30')]);_0x2a3e2d['filters']=_[_0xc0e6('0x31')](_0x2a3e2d[_0xc0e6('0x2e')],_0x2a3e2d[_0xc0e6('0x30')]);_0x2b8fb1[_0xc0e6('0x32')]=_[_0xc0e6('0x31')](_0x2a3e2d['model'],qs[_0xc0e6('0x33')](_0x496d51[_0xc0e6('0x30')][_0xc0e6('0x33')]));_0x2b8fb1['attributes']=_0x2b8fb1[_0xc0e6('0x32')][_0xc0e6('0x34')]?_0x2b8fb1['attributes']:_0x2a3e2d[_0xc0e6('0x2e')];if(!_0x496d51[_0xc0e6('0x30')][_0xc0e6('0x35')](_0xc0e6('0x36'))){_0x2b8fb1['limit']=qs[_0xc0e6('0x1b')](_0x496d51['query'][_0xc0e6('0x1b')]);_0x2b8fb1[_0xc0e6('0x1d')]=qs['offset'](_0x496d51['query']['offset']);}_0x2b8fb1['order']=qs[_0xc0e6('0x37')](_0x496d51['query']['sort']);_0x2b8fb1[_0xc0e6('0x38')]=qs[_0xc0e6('0x39')](_[_0xc0e6('0x3a')](_0x496d51['query'],_0x2a3e2d[_0xc0e6('0x39')]),_0x195817);if(_0x496d51[_0xc0e6('0x30')]['filter']){_0x2b8fb1['where']=_[_0xc0e6('0x3b')](_0x2b8fb1[_0xc0e6('0x38')],{'$or':_[_0xc0e6('0x2a')](_0x195817,function(_0xae0994){if(_0xae0994[_0xc0e6('0x2d')]!=='VIRTUAL'){var _0x2a5e09={};_0x2a5e09[_0xae0994['name']]={'$like':'%'+_0x496d51[_0xc0e6('0x30')][_0xc0e6('0x3c')]+'%'};return _0x2a5e09;}})});}_0x2b8fb1=_[_0xc0e6('0x3b')]({},_0x2b8fb1,_0x496d51[_0xc0e6('0x3d')]);var _0x594b07={'where':_0x2b8fb1[_0xc0e6('0x38')]};return db[_0xc0e6('0x2b')][_0xc0e6('0x1c')](_0x594b07)[_0xc0e6('0x25')](function(_0x1aaadf){_0x14897f[_0xc0e6('0x1c')]=_0x1aaadf;if(_0x496d51['query']['includeAll']){_0x2b8fb1['include']=[{'all':!![]}];}return db[_0xc0e6('0x2b')]['findAll'](_0x2b8fb1);})[_0xc0e6('0x25')](function(_0x33971d){_0x14897f['rows']=_0x33971d;return _0x14897f;})[_0xc0e6('0x25')](respondWithFilteredResult(_0x415c73,_0x2b8fb1))[_0xc0e6('0x3e')](handleError(_0x415c73,null));};exports['show']=function(_0x4aeb00,_0x36a0b3){var _0x514451={'raw':!![],'where':{'id':_0x4aeb00[_0xc0e6('0x3f')]['id']}},_0x1f3dc2={};_0x1f3dc2[_0xc0e6('0x2e')]=_[_0xc0e6('0x2f')](db['SmsQueueReport'][_0xc0e6('0x40')]);_0x1f3dc2[_0xc0e6('0x30')]=_['keys'](_0x4aeb00[_0xc0e6('0x30')]);_0x1f3dc2[_0xc0e6('0x39')]=_['intersection'](_0x1f3dc2[_0xc0e6('0x2e')],_0x1f3dc2['query']);_0x514451[_0xc0e6('0x32')]=_[_0xc0e6('0x31')](_0x1f3dc2[_0xc0e6('0x2e')],qs[_0xc0e6('0x33')](_0x4aeb00[_0xc0e6('0x30')][_0xc0e6('0x33')]));_0x514451[_0xc0e6('0x32')]=_0x514451[_0xc0e6('0x32')][_0xc0e6('0x34')]?_0x514451[_0xc0e6('0x32')]:_0x1f3dc2[_0xc0e6('0x2e')];if(_0x4aeb00[_0xc0e6('0x30')]['includeAll']){_0x514451[_0xc0e6('0x41')]=[{'all':!![]}];}_0x514451=_[_0xc0e6('0x3b')]({},_0x514451,_0x4aeb00[_0xc0e6('0x3d')]);return db['SmsQueueReport'][_0xc0e6('0x42')](_0x514451)[_0xc0e6('0x25')](handleEntityNotFound(_0x36a0b3,null))[_0xc0e6('0x25')](respondWithResult(_0x36a0b3,null))[_0xc0e6('0x3e')](handleError(_0x36a0b3,null));};exports[_0xc0e6('0x43')]=function(_0x524766,_0x5d7829){return db[_0xc0e6('0x2b')][_0xc0e6('0x43')](_0x524766[_0xc0e6('0x44')],{})[_0xc0e6('0x25')](respondWithResult(_0x5d7829,0xc9))[_0xc0e6('0x3e')](handleError(_0x5d7829,null));};exports[_0xc0e6('0x24')]=function(_0x14bdfe,_0x19e4e5){if(_0x14bdfe[_0xc0e6('0x44')]['id']){delete _0x14bdfe[_0xc0e6('0x44')]['id'];}return db[_0xc0e6('0x2b')]['find']({'where':{'id':_0x14bdfe[_0xc0e6('0x3f')]['id']}})[_0xc0e6('0x25')](handleEntityNotFound(_0x19e4e5,null))[_0xc0e6('0x25')](saveUpdates(_0x14bdfe[_0xc0e6('0x44')],null))[_0xc0e6('0x25')](respondWithResult(_0x19e4e5,null))[_0xc0e6('0x3e')](handleError(_0x19e4e5,null));};exports['destroy']=function(_0x34159c,_0x4ee064){return db[_0xc0e6('0x2b')][_0xc0e6('0x42')]({'where':{'id':_0x34159c[_0xc0e6('0x3f')]['id']}})[_0xc0e6('0x25')](handleEntityNotFound(_0x4ee064,null))[_0xc0e6('0x25')](removeEntity(_0x4ee064,null))['catch'](handleError(_0x4ee064,null));};exports[_0xc0e6('0x45')]=function(_0x4f49ef,_0x4e1063){return db['SmsQueueReport']['describe']()[_0xc0e6('0x25')](respondWithResult(_0x4e1063,null))[_0xc0e6('0x3e')](handleError(_0x4e1063,null));}; \ No newline at end of file +var _0x31d1=['Content-Range','apply','save','then','destroy','error','stack','name','send','map','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','SmsQueueReport','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0xd1d90b,_0x3b8750){var _0x4aaa76=function(_0x4347c8){while(--_0x4347c8){_0xd1d90b['push'](_0xd1d90b['shift']());}};_0x4aaa76(++_0x3b8750);}(_0x31d1,0x116));var _0x131d=function(_0x1203d4,_0x19014c){_0x1203d4=_0x1203d4-0x0;var _0x481779=_0x31d1[_0x1203d4];return _0x481779;};'use strict';var emlformat=require(_0x131d('0x0'));var rimraf=require(_0x131d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x131d('0x2'));var rp=require(_0x131d('0x3'));var moment=require(_0x131d('0x4'));var BPromise=require(_0x131d('0x5'));var Mustache=require(_0x131d('0x6'));var util=require('util');var path=require(_0x131d('0x7'));var sox=require(_0x131d('0x8'));var csv=require(_0x131d('0x9'));var ejs=require(_0x131d('0xa'));var fs=require('fs');var fs_extra=require(_0x131d('0xb'));var _=require(_0x131d('0xc'));var squel=require(_0x131d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x131d('0x9'));var querystring=require(_0x131d('0xe'));var Papa=require(_0x131d('0xf'));var Redis=require(_0x131d('0x10'));var authService=require(_0x131d('0x11'));var qs=require(_0x131d('0x12'));var as=require(_0x131d('0x13'));var hardwareService=require(_0x131d('0x14'));var logger=require(_0x131d('0x15'))(_0x131d('0x16'));var utils=require(_0x131d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x131d('0x18'))['db'];function respondWithStatusCode(_0x386650,_0x3879ec){_0x3879ec=_0x3879ec||0xcc;return function(_0x4133a4){if(_0x4133a4){return _0x386650[_0x131d('0x19')](_0x3879ec);}return _0x386650[_0x131d('0x1a')](_0x3879ec)[_0x131d('0x1b')]();};}function respondWithResult(_0x4f776a,_0x3a4b0b){_0x3a4b0b=_0x3a4b0b||0xc8;return function(_0x49ef6f){if(_0x49ef6f){return _0x4f776a[_0x131d('0x1a')](_0x3a4b0b)[_0x131d('0x1c')](_0x49ef6f);}};}function respondWithFilteredResult(_0x4e1e61,_0x45520e){return function(_0x3b8e44){if(_0x3b8e44){var _0x4716ab=typeof _0x45520e[_0x131d('0x1d')]===_0x131d('0x1e')&&typeof _0x45520e[_0x131d('0x1f')]==='undefined';var _0x2cff41=_0x3b8e44[_0x131d('0x20')];var _0x51690d=_0x4716ab?0x0:_0x45520e['offset'];var _0xfec784=_0x4716ab?_0x3b8e44[_0x131d('0x20')]:_0x45520e[_0x131d('0x1d')]+_0x45520e['limit'];var _0x88ae89;if(_0xfec784>=_0x2cff41){_0xfec784=_0x2cff41;_0x88ae89=0xc8;}else{_0x88ae89=0xce;}_0x4e1e61[_0x131d('0x1a')](_0x88ae89);return _0x4e1e61[_0x131d('0x21')](_0x131d('0x22'),_0x51690d+'-'+_0xfec784+'/'+_0x2cff41)[_0x131d('0x1c')](_0x3b8e44);}return null;};}function patchUpdates(_0xc5fa4c){return function(_0x152765){try{jsonpatch[_0x131d('0x23')](_0x152765,_0xc5fa4c,!![]);}catch(_0x56a878){return BPromise['reject'](_0x56a878);}return _0x152765[_0x131d('0x24')]();};}function saveUpdates(_0x16f40a,_0x3f2062){return function(_0x59e4d8){if(_0x59e4d8){return _0x59e4d8['update'](_0x16f40a)[_0x131d('0x25')](function(_0x48f026){return _0x48f026;});}return null;};}function removeEntity(_0x344302,_0x199807){return function(_0x274610){if(_0x274610){return _0x274610[_0x131d('0x26')]()[_0x131d('0x25')](function(){_0x344302[_0x131d('0x1a')](0xcc)[_0x131d('0x1b')]();});}};}function handleEntityNotFound(_0x32a2c4,_0x20aeaf){return function(_0x10c115){if(!_0x10c115){_0x32a2c4[_0x131d('0x19')](0x194);}return _0x10c115;};}function handleError(_0x52f9ea,_0x2f6233){_0x2f6233=_0x2f6233||0x1f4;return function(_0x4aa304){logger[_0x131d('0x27')](_0x4aa304[_0x131d('0x28')]);if(_0x4aa304[_0x131d('0x29')]){delete _0x4aa304[_0x131d('0x29')];}_0x52f9ea[_0x131d('0x1a')](_0x2f6233)[_0x131d('0x2a')](_0x4aa304);};}exports['index']=function(_0x48e735,_0x463660){var _0x526890={},_0x17c7c1={},_0x25ca4c={'count':0x0,'rows':[]};var _0x475995=_[_0x131d('0x2b')](db['SmsQueueReport']['rawAttributes'],function(_0x1797ff){return{'name':_0x1797ff[_0x131d('0x2c')],'type':_0x1797ff[_0x131d('0x2d')][_0x131d('0x2e')]};});_0x17c7c1['model']=_[_0x131d('0x2b')](_0x475995,_0x131d('0x29'));_0x17c7c1[_0x131d('0x2f')]=_['keys'](_0x48e735[_0x131d('0x2f')]);_0x17c7c1['filters']=_[_0x131d('0x30')](_0x17c7c1[_0x131d('0x31')],_0x17c7c1[_0x131d('0x2f')]);_0x526890[_0x131d('0x32')]=_[_0x131d('0x30')](_0x17c7c1[_0x131d('0x31')],qs[_0x131d('0x33')](_0x48e735['query'][_0x131d('0x33')]));_0x526890[_0x131d('0x32')]=_0x526890[_0x131d('0x32')][_0x131d('0x34')]?_0x526890[_0x131d('0x32')]:_0x17c7c1[_0x131d('0x31')];if(!_0x48e735['query'][_0x131d('0x35')](_0x131d('0x36'))){_0x526890[_0x131d('0x1f')]=qs[_0x131d('0x1f')](_0x48e735[_0x131d('0x2f')][_0x131d('0x1f')]);_0x526890[_0x131d('0x1d')]=qs[_0x131d('0x1d')](_0x48e735[_0x131d('0x2f')][_0x131d('0x1d')]);}_0x526890[_0x131d('0x37')]=qs[_0x131d('0x38')](_0x48e735[_0x131d('0x2f')][_0x131d('0x38')]);_0x526890['where']=qs[_0x131d('0x39')](_[_0x131d('0x3a')](_0x48e735[_0x131d('0x2f')],_0x17c7c1[_0x131d('0x39')]),_0x475995);if(_0x48e735[_0x131d('0x2f')][_0x131d('0x3b')]){_0x526890['where']=_[_0x131d('0x3c')](_0x526890[_0x131d('0x3d')],{'$or':_[_0x131d('0x2b')](_0x475995,function(_0x4f63d9){if(_0x4f63d9[_0x131d('0x2d')]!==_0x131d('0x3e')){var _0x462df7={};_0x462df7[_0x4f63d9[_0x131d('0x29')]]={'$like':'%'+_0x48e735[_0x131d('0x2f')][_0x131d('0x3b')]+'%'};return _0x462df7;}})});}_0x526890=_[_0x131d('0x3c')]({},_0x526890,_0x48e735[_0x131d('0x3f')]);var _0x19f7c6={'where':_0x526890[_0x131d('0x3d')]};return db[_0x131d('0x40')]['count'](_0x19f7c6)[_0x131d('0x25')](function(_0x3b66ff){_0x25ca4c['count']=_0x3b66ff;if(_0x48e735[_0x131d('0x2f')]['includeAll']){_0x526890['include']=[{'all':!![]}];}return db[_0x131d('0x40')][_0x131d('0x41')](_0x526890);})['then'](function(_0x344cdd){_0x25ca4c[_0x131d('0x42')]=_0x344cdd;return _0x25ca4c;})[_0x131d('0x25')](respondWithFilteredResult(_0x463660,_0x526890))[_0x131d('0x43')](handleError(_0x463660,null));};exports[_0x131d('0x44')]=function(_0x2d843a,_0x125fd6){var _0x98e57={'raw':!![],'where':{'id':_0x2d843a['params']['id']}},_0xa16bf2={};_0xa16bf2[_0x131d('0x31')]=_[_0x131d('0x45')](db[_0x131d('0x40')][_0x131d('0x46')]);_0xa16bf2[_0x131d('0x2f')]=_[_0x131d('0x45')](_0x2d843a[_0x131d('0x2f')]);_0xa16bf2['filters']=_['intersection'](_0xa16bf2[_0x131d('0x31')],_0xa16bf2[_0x131d('0x2f')]);_0x98e57[_0x131d('0x32')]=_[_0x131d('0x30')](_0xa16bf2['model'],qs[_0x131d('0x33')](_0x2d843a[_0x131d('0x2f')][_0x131d('0x33')]));_0x98e57[_0x131d('0x32')]=_0x98e57[_0x131d('0x32')][_0x131d('0x34')]?_0x98e57[_0x131d('0x32')]:_0xa16bf2['model'];if(_0x2d843a[_0x131d('0x2f')]['includeAll']){_0x98e57[_0x131d('0x47')]=[{'all':!![]}];}_0x98e57=_['merge']({},_0x98e57,_0x2d843a['options']);return db[_0x131d('0x40')][_0x131d('0x48')](_0x98e57)['then'](handleEntityNotFound(_0x125fd6,null))[_0x131d('0x25')](respondWithResult(_0x125fd6,null))[_0x131d('0x43')](handleError(_0x125fd6,null));};exports[_0x131d('0x49')]=function(_0x4d0167,_0x3510d6){return db[_0x131d('0x40')]['create'](_0x4d0167[_0x131d('0x4a')],{})[_0x131d('0x25')](respondWithResult(_0x3510d6,0xc9))[_0x131d('0x43')](handleError(_0x3510d6,null));};exports[_0x131d('0x4b')]=function(_0x475a5a,_0x547759){if(_0x475a5a['body']['id']){delete _0x475a5a[_0x131d('0x4a')]['id'];}return db['SmsQueueReport'][_0x131d('0x48')]({'where':{'id':_0x475a5a[_0x131d('0x4c')]['id']}})[_0x131d('0x25')](handleEntityNotFound(_0x547759,null))[_0x131d('0x25')](saveUpdates(_0x475a5a[_0x131d('0x4a')],null))[_0x131d('0x25')](respondWithResult(_0x547759,null))['catch'](handleError(_0x547759,null));};exports[_0x131d('0x26')]=function(_0x28ebe2,_0xb1b8bd){return db[_0x131d('0x40')]['find']({'where':{'id':_0x28ebe2[_0x131d('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb1b8bd,null))[_0x131d('0x25')](removeEntity(_0xb1b8bd,null))[_0x131d('0x43')](handleError(_0xb1b8bd,null));};exports[_0x131d('0x4d')]=function(_0x100c93,_0x5c0741){return db[_0x131d('0x40')]['describe']()['then'](respondWithResult(_0x5c0741,null))['catch'](handleError(_0x5c0741,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0a993d3..7c2737c 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f8033ed..648eeef 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 _0x471a=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','create','body','raw','then','debug','UpdateSmsQueueReport','SmsQueueReport','update','options','attributes','limit','lodash','util','moment'];(function(_0x1902a7,_0x2039b1){var _0x213b5c=function(_0x5dc0e8){while(--_0x5dc0e8){_0x1902a7['push'](_0x1902a7['shift']());}};_0x213b5c(++_0x2039b1);}(_0x471a,0x85));var _0xa471=function(_0x57e3a7,_0x54a266){_0x57e3a7=_0x57e3a7-0x0;var _0x5421db=_0x471a[_0x57e3a7];return _0x5421db;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var moment=require(_0xa471('0x2'));var BPromise=require(_0xa471('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa471('0x4'));var db=require(_0xa471('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa471('0x6'))(_0xa471('0x7'));var config=require(_0xa471('0x8'));var jayson=require(_0xa471('0x9'));var client=jayson[_0xa471('0xa')][_0xa471('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b03d5,_0xf1d256,_0xacd78){return new BPromise(function(_0x253b96,_0x1f09b4){return client[_0xa471('0xc')](_0x4b03d5,_0xacd78)['then'](function(_0x4c423a){logger[_0xa471('0xd')](_0xa471('0xe'),_0xf1d256,_0xa471('0xf'));logger['debug'](_0xa471('0x10'),_0xf1d256,_0xa471('0xf'),JSON[_0xa471('0x11')](_0x4c423a));if(_0x4c423a[_0xa471('0x12')]){if(_0x4c423a[_0xa471('0x12')]['code']===0x1f4){logger[_0xa471('0x12')](_0xa471('0xe'),_0xf1d256,_0x4c423a[_0xa471('0x12')][_0xa471('0x13')]);return _0x1f09b4(_0x4c423a[_0xa471('0x12')][_0xa471('0x13')]);}logger[_0xa471('0x12')](_0xa471('0xe'),_0xf1d256,_0x4c423a[_0xa471('0x12')]['message']);return _0x253b96(_0x4c423a['error'][_0xa471('0x13')]);}else{logger[_0xa471('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0xf1d256,_0xa471('0xf'));_0x253b96(_0x4c423a[_0xa471('0x14')][_0xa471('0x13')]);}})[_0xa471('0x15')](function(_0x1ae6a1){logger[_0xa471('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0xf1d256,_0x1ae6a1);_0x1f09b4(_0x1ae6a1);});});}exports[_0xa471('0x16')]=function(_0xfd55b6){var _0x233931=this;return new Promise(function(_0x2d81ca,_0x2d9f91){return db['SmsQueueReport'][_0xa471('0x17')](_0xfd55b6[_0xa471('0x18')],{'raw':_0xfd55b6['options']?_0xfd55b6['options'][_0xa471('0x19')]===undefined?!![]:![]:!![]})[_0xa471('0x1a')](function(_0x12b7c3){logger[_0xa471('0xd')](_0xa471('0x16'),_0xfd55b6);logger[_0xa471('0x1b')](_0xa471('0x16'),_0xfd55b6,JSON[_0xa471('0x11')](_0x12b7c3));_0x2d81ca(_0x12b7c3);})[_0xa471('0x15')](function(_0x30497f){logger[_0xa471('0x12')](_0xa471('0x16'),_0x30497f[_0xa471('0x13')],_0xfd55b6);_0x2d9f91(_0x233931[_0xa471('0x12')](0x1f4,_0x30497f['message']));});});};exports[_0xa471('0x1c')]=function(_0x1279bf){var _0x1a0951=this;return new Promise(function(_0x38d088,_0x79b164){return db[_0xa471('0x1d')][_0xa471('0x1e')](_0x1279bf['body'],{'raw':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')][_0xa471('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')]['where']||null:null,'attributes':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')][_0xa471('0x20')]||null:null,'limit':_0x1279bf[_0xa471('0x1f')]?_0x1279bf[_0xa471('0x1f')][_0xa471('0x21')]||null:null})[_0xa471('0x1a')](function(_0x38a706){logger['info'](_0xa471('0x1c'),_0x1279bf);logger['debug']('UpdateSmsQueueReport',_0x1279bf,JSON[_0xa471('0x11')](_0x38a706));_0x38d088(_0x38a706);})[_0xa471('0x15')](function(_0x36f3f7){logger['error'](_0xa471('0x1c'),_0x36f3f7[_0xa471('0x13')],_0x1279bf);_0x79b164(_0x1a0951[_0xa471('0x12')](0x1f4,_0x36f3f7[_0xa471('0x13')]));});});}; \ No newline at end of file +var _0xd3fe=['UpdateSmsQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','create','body','options','raw','CreateSmsQueueReport','stringify','SmsQueueReport','update','where','limit'];(function(_0x18b34e,_0x2f643a){var _0x1e693b=function(_0x7b6599){while(--_0x7b6599){_0x18b34e['push'](_0x18b34e['shift']());}};_0x1e693b(++_0x2f643a);}(_0xd3fe,0x155));var _0xed3f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd3fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xed3f('0x0'));var util=require('util');var moment=require(_0xed3f('0x1'));var BPromise=require(_0xed3f('0x2'));var rs=require(_0xed3f('0x3'));var fs=require('fs');var Redis=require(_0xed3f('0x4'));var db=require(_0xed3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xed3f('0x6'))(_0xed3f('0x7'));var config=require(_0xed3f('0x8'));var jayson=require(_0xed3f('0x9'));var client=jayson[_0xed3f('0xa')][_0xed3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39c15c,_0x44a351,_0x31216e){return new BPromise(function(_0x54b0c7,_0x5ea0b8){return client[_0xed3f('0xc')](_0x39c15c,_0x31216e)[_0xed3f('0xd')](function(_0x336427){logger[_0xed3f('0xe')](_0xed3f('0xf'),_0x44a351,_0xed3f('0x10'));logger[_0xed3f('0x11')](_0xed3f('0x12'),_0x44a351,_0xed3f('0x10'),JSON['stringify'](_0x336427));if(_0x336427['error']){if(_0x336427[_0xed3f('0x13')]['code']===0x1f4){logger[_0xed3f('0x13')](_0xed3f('0xf'),_0x44a351,_0x336427[_0xed3f('0x13')][_0xed3f('0x14')]);return _0x5ea0b8(_0x336427[_0xed3f('0x13')][_0xed3f('0x14')]);}logger[_0xed3f('0x13')](_0xed3f('0xf'),_0x44a351,_0x336427[_0xed3f('0x13')][_0xed3f('0x14')]);return _0x54b0c7(_0x336427[_0xed3f('0x13')][_0xed3f('0x14')]);}else{logger[_0xed3f('0xe')](_0xed3f('0xf'),_0x44a351,_0xed3f('0x10'));_0x54b0c7(_0x336427[_0xed3f('0x15')][_0xed3f('0x14')]);}})[_0xed3f('0x16')](function(_0x5710a0){logger[_0xed3f('0x13')](_0xed3f('0xf'),_0x44a351,_0x5710a0);_0x5ea0b8(_0x5710a0);});});}exports['CreateSmsQueueReport']=function(_0x1ef803){var _0x272cff=this;return new Promise(function(_0x3029ba,_0x2b74ac){return db['SmsQueueReport'][_0xed3f('0x17')](_0x1ef803[_0xed3f('0x18')],{'raw':_0x1ef803[_0xed3f('0x19')]?_0x1ef803['options'][_0xed3f('0x1a')]===undefined?!![]:![]:!![]})[_0xed3f('0xd')](function(_0x11c3ee){logger['info']('CreateSmsQueueReport',_0x1ef803);logger[_0xed3f('0x11')](_0xed3f('0x1b'),_0x1ef803,JSON[_0xed3f('0x1c')](_0x11c3ee));_0x3029ba(_0x11c3ee);})[_0xed3f('0x16')](function(_0x55fd88){logger[_0xed3f('0x13')](_0xed3f('0x1b'),_0x55fd88[_0xed3f('0x14')],_0x1ef803);_0x2b74ac(_0x272cff[_0xed3f('0x13')](0x1f4,_0x55fd88[_0xed3f('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x5c42eb){var _0x3b151e=this;return new Promise(function(_0x3389d0,_0x517217){return db[_0xed3f('0x1d')][_0xed3f('0x1e')](_0x5c42eb[_0xed3f('0x18')],{'raw':_0x5c42eb[_0xed3f('0x19')]?_0x5c42eb[_0xed3f('0x19')][_0xed3f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c42eb[_0xed3f('0x19')]?_0x5c42eb[_0xed3f('0x19')][_0xed3f('0x1f')]||null:null,'attributes':_0x5c42eb[_0xed3f('0x19')]?_0x5c42eb[_0xed3f('0x19')]['attributes']||null:null,'limit':_0x5c42eb['options']?_0x5c42eb[_0xed3f('0x19')][_0xed3f('0x20')]||null:null})[_0xed3f('0xd')](function(_0x5723a2){logger['info']('UpdateSmsQueueReport',_0x5c42eb);logger[_0xed3f('0x11')](_0xed3f('0x21'),_0x5c42eb,JSON[_0xed3f('0x1c')](_0x5723a2));_0x3389d0(_0x5723a2);})[_0xed3f('0x16')](function(_0x4822bf){logger['error'](_0xed3f('0x21'),_0x4822bf['message'],_0x5c42eb);_0x517217(_0x3b151e[_0xed3f('0x13')](0x1f4,_0x4822bf[_0xed3f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e3acfb3..c26f8ee 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 _0xd2bb=['../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2a8381,_0x82ffab){var _0x280465=function(_0x42cf87){while(--_0x42cf87){_0x2a8381['push'](_0x2a8381['shift']());}};_0x280465(++_0x82ffab);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x5d9e8a,_0x11d5a2){_0x5d9e8a=_0x5d9e8a-0x0;var _0x4377d7=_0xd2bb[_0x5d9e8a];return _0x4377d7;};'use strict';var multer=require('multer');var util=require(_0xbd2b('0x0'));var path=require('path');var timeout=require(_0xbd2b('0x1'));var express=require(_0xbd2b('0x2'));var router=express[_0xbd2b('0x3')]();var fs_extra=require(_0xbd2b('0x4'));var auth=require(_0xbd2b('0x5'));var interaction=require(_0xbd2b('0x6'));var config=require('../../config/environment');var controller=require(_0xbd2b('0x7'));router[_0xbd2b('0x8')]('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xa')]);router[_0xbd2b('0x8')](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xc')]);router[_0xbd2b('0x8')](_0xbd2b('0xd'),auth['isAuthenticated'](),controller[_0xbd2b('0xe')]);router['post']('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xf')]);router['put'](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x10')]);router[_0xbd2b('0x11')](_0xbd2b('0xd'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x12')]);module[_0xbd2b('0x13')]=router; \ No newline at end of file +var _0x31f0=['./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x51f923,_0x37ed33){var _0x5d906d=function(_0x4f23eb){while(--_0x4f23eb){_0x51f923['push'](_0x51f923['shift']());}};_0x5d906d(++_0x37ed33);}(_0x31f0,0xb7));var _0x031f=function(_0x4e383f,_0x18f1bf){_0x4e383f=_0x4e383f-0x0;var _0xc1fa1d=_0x31f0[_0x4e383f];return _0xc1fa1d;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x031f('0x8')]('/describe',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0x8')](_0x031f('0xb'),auth['isAuthenticated'](),controller[_0x031f('0xc')]);router[_0x031f('0xd')]('/',auth[_0x031f('0x9')](),controller[_0x031f('0xe')]);router[_0x031f('0xf')](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0x10')]);router['delete'](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0x11')]);module[_0x031f('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 10c19c8..c9366b8 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3c6516,_0x35f01b){var _0x1bb36d=function(_0x40de6a){while(--_0x40de6a){_0x3c6516['push'](_0x3c6516['shift']());}};_0x1bb36d(++_0x35f01b);}(_0x34e8,0x12c));var _0x834e=function(_0x2c733c,_0x101e59){_0x2c733c=_0x2c733c-0x0;var _0xe55e0c=_0x34e8[_0x2c733c];return _0xe55e0c;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2d38f0,_0x79ecf){var _0x4f0ee2=function(_0x3f5b2b){while(--_0x3f5b2b){_0x2d38f0['push'](_0x2d38f0['shift']());}};_0x4f0ee2(++_0x79ecf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xcb91[_0x2ed8f3];return _0x525a55;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a9360cb..e750493 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 _0x4637=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','intersection','length','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsTransferReport'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0x4637,0xb3));var _0x7463=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4637[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x7463('0x0'));var rimraf=require(_0x7463('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7463('0x2'));var rp=require(_0x7463('0x3'));var moment=require(_0x7463('0x4'));var BPromise=require(_0x7463('0x5'));var Mustache=require(_0x7463('0x6'));var util=require(_0x7463('0x7'));var path=require(_0x7463('0x8'));var sox=require('sox');var csv=require(_0x7463('0x9'));var ejs=require(_0x7463('0xa'));var fs=require('fs');var fs_extra=require(_0x7463('0xb'));var _=require(_0x7463('0xc'));var squel=require('squel');var crypto=require(_0x7463('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7463('0xe'));var toCsv=require(_0x7463('0x9'));var querystring=require(_0x7463('0xf'));var Papa=require('papaparse');var Redis=require(_0x7463('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7463('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7463('0x12'));var logger=require(_0x7463('0x13'))(_0x7463('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7463('0x15'));var db=require(_0x7463('0x16'))['db'];function respondWithStatusCode(_0x39cff1,_0x29c811){_0x29c811=_0x29c811||0xcc;return function(_0x506e0a){if(_0x506e0a){return _0x39cff1[_0x7463('0x17')](_0x29c811);}return _0x39cff1[_0x7463('0x18')](_0x29c811)['end']();};}function respondWithResult(_0x57a901,_0x25284d){_0x25284d=_0x25284d||0xc8;return function(_0x46076a){if(_0x46076a){return _0x57a901[_0x7463('0x18')](_0x25284d)['json'](_0x46076a);}};}function respondWithFilteredResult(_0x5b9b01,_0x2cac45){return function(_0x4878f6){if(_0x4878f6){var _0x49adad=typeof _0x2cac45['offset']===_0x7463('0x19')&&typeof _0x2cac45['limit']===_0x7463('0x19');var _0x1f63d7=_0x4878f6[_0x7463('0x1a')];var _0x149043=_0x49adad?0x0:_0x2cac45[_0x7463('0x1b')];var _0x5b56b6=_0x49adad?_0x4878f6[_0x7463('0x1a')]:_0x2cac45['offset']+_0x2cac45[_0x7463('0x1c')];var _0x560fd6;if(_0x5b56b6>=_0x1f63d7){_0x5b56b6=_0x1f63d7;_0x560fd6=0xc8;}else{_0x560fd6=0xce;}_0x5b9b01[_0x7463('0x18')](_0x560fd6);return _0x5b9b01['set'](_0x7463('0x1d'),_0x149043+'-'+_0x5b56b6+'/'+_0x1f63d7)['json'](_0x4878f6);}return null;};}function patchUpdates(_0x1bfbb5){return function(_0x36cf54){try{jsonpatch[_0x7463('0x1e')](_0x36cf54,_0x1bfbb5,!![]);}catch(_0x30e95c){return BPromise[_0x7463('0x1f')](_0x30e95c);}return _0x36cf54[_0x7463('0x20')]();};}function saveUpdates(_0x4b57d2,_0x3aacbc){return function(_0x1d9a94){if(_0x1d9a94){return _0x1d9a94[_0x7463('0x21')](_0x4b57d2)[_0x7463('0x22')](function(_0x33dc46){return _0x33dc46;});}return null;};}function removeEntity(_0xa1ca56,_0x59bc23){return function(_0x5128f9){if(_0x5128f9){return _0x5128f9[_0x7463('0x23')]()[_0x7463('0x22')](function(){_0xa1ca56[_0x7463('0x18')](0xcc)[_0x7463('0x24')]();});}};}function handleEntityNotFound(_0x62c8d2,_0x2af5be){return function(_0x9aa2e3){if(!_0x9aa2e3){_0x62c8d2[_0x7463('0x17')](0x194);}return _0x9aa2e3;};}function handleError(_0x2c6fdc,_0x2a8f2f){_0x2a8f2f=_0x2a8f2f||0x1f4;return function(_0x2b0338){logger[_0x7463('0x25')](_0x2b0338[_0x7463('0x26')]);if(_0x2b0338['name']){delete _0x2b0338[_0x7463('0x27')];}_0x2c6fdc[_0x7463('0x18')](_0x2a8f2f)['send'](_0x2b0338);};}exports[_0x7463('0x28')]=function(_0x2d2371,_0x46574b){var _0x47bb13={},_0x1e26b9={},_0xf527f4={'count':0x0,'rows':[]};var _0x427d2d=_[_0x7463('0x29')](db[_0x7463('0x2a')][_0x7463('0x2b')],function(_0x299982){return{'name':_0x299982[_0x7463('0x2c')],'type':_0x299982[_0x7463('0x2d')][_0x7463('0x2e')]};});_0x1e26b9[_0x7463('0x2f')]=_[_0x7463('0x29')](_0x427d2d,_0x7463('0x27'));_0x1e26b9[_0x7463('0x30')]=_[_0x7463('0x31')](_0x2d2371[_0x7463('0x30')]);_0x1e26b9[_0x7463('0x32')]=_['intersection'](_0x1e26b9[_0x7463('0x2f')],_0x1e26b9[_0x7463('0x30')]);_0x47bb13[_0x7463('0x33')]=_['intersection'](_0x1e26b9['model'],qs[_0x7463('0x34')](_0x2d2371['query'][_0x7463('0x34')]));_0x47bb13[_0x7463('0x33')]=_0x47bb13[_0x7463('0x33')]['length']?_0x47bb13['attributes']:_0x1e26b9[_0x7463('0x2f')];if(!_0x2d2371['query'][_0x7463('0x35')](_0x7463('0x36'))){_0x47bb13[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x2d2371['query'][_0x7463('0x1c')]);_0x47bb13[_0x7463('0x1b')]=qs[_0x7463('0x1b')](_0x2d2371[_0x7463('0x30')][_0x7463('0x1b')]);}_0x47bb13[_0x7463('0x37')]=qs['sort'](_0x2d2371[_0x7463('0x30')][_0x7463('0x38')]);_0x47bb13[_0x7463('0x39')]=qs[_0x7463('0x32')](_[_0x7463('0x3a')](_0x2d2371[_0x7463('0x30')],_0x1e26b9[_0x7463('0x32')]),_0x427d2d);if(_0x2d2371[_0x7463('0x30')]['filter']){_0x47bb13[_0x7463('0x39')]=_[_0x7463('0x3b')](_0x47bb13[_0x7463('0x39')],{'$or':_[_0x7463('0x29')](_0x427d2d,function(_0x2ec4bb){if(_0x2ec4bb[_0x7463('0x2d')]!=='VIRTUAL'){var _0x3b8d4a={};_0x3b8d4a[_0x2ec4bb[_0x7463('0x27')]]={'$like':'%'+_0x2d2371[_0x7463('0x30')][_0x7463('0x3c')]+'%'};return _0x3b8d4a;}})});}_0x47bb13=_['merge']({},_0x47bb13,_0x2d2371[_0x7463('0x3d')]);var _0x4509ae={'where':_0x47bb13[_0x7463('0x39')]};return db[_0x7463('0x2a')][_0x7463('0x1a')](_0x4509ae)[_0x7463('0x22')](function(_0x2412b8){_0xf527f4[_0x7463('0x1a')]=_0x2412b8;if(_0x2d2371[_0x7463('0x30')][_0x7463('0x3e')]){_0x47bb13[_0x7463('0x3f')]=[{'all':!![]}];}return db[_0x7463('0x2a')][_0x7463('0x40')](_0x47bb13);})[_0x7463('0x22')](function(_0x24bd0a){_0xf527f4[_0x7463('0x41')]=_0x24bd0a;return _0xf527f4;})['then'](respondWithFilteredResult(_0x46574b,_0x47bb13))['catch'](handleError(_0x46574b,null));};exports['show']=function(_0x58434e,_0x1858c9){var _0x23352c={'raw':!![],'where':{'id':_0x58434e[_0x7463('0x42')]['id']}},_0x270237={};_0x270237[_0x7463('0x2f')]=_[_0x7463('0x31')](db[_0x7463('0x2a')][_0x7463('0x2b')]);_0x270237[_0x7463('0x30')]=_[_0x7463('0x31')](_0x58434e[_0x7463('0x30')]);_0x270237[_0x7463('0x32')]=_[_0x7463('0x43')](_0x270237[_0x7463('0x2f')],_0x270237[_0x7463('0x30')]);_0x23352c[_0x7463('0x33')]=_[_0x7463('0x43')](_0x270237['model'],qs['fields'](_0x58434e[_0x7463('0x30')][_0x7463('0x34')]));_0x23352c[_0x7463('0x33')]=_0x23352c[_0x7463('0x33')][_0x7463('0x44')]?_0x23352c[_0x7463('0x33')]:_0x270237[_0x7463('0x2f')];if(_0x58434e[_0x7463('0x30')][_0x7463('0x3e')]){_0x23352c[_0x7463('0x3f')]=[{'all':!![]}];}_0x23352c=_['merge']({},_0x23352c,_0x58434e[_0x7463('0x3d')]);return db[_0x7463('0x2a')][_0x7463('0x45')](_0x23352c)[_0x7463('0x22')](handleEntityNotFound(_0x1858c9,null))['then'](respondWithResult(_0x1858c9,null))[_0x7463('0x46')](handleError(_0x1858c9,null));};exports[_0x7463('0x47')]=function(_0xb5bece,_0x277932){return db['SmsTransferReport'][_0x7463('0x47')](_0xb5bece[_0x7463('0x48')],{})[_0x7463('0x22')](respondWithResult(_0x277932,0xc9))['catch'](handleError(_0x277932,null));};exports[_0x7463('0x21')]=function(_0x45ea42,_0x45e699){if(_0x45ea42['body']['id']){delete _0x45ea42[_0x7463('0x48')]['id'];}return db[_0x7463('0x2a')][_0x7463('0x45')]({'where':{'id':_0x45ea42['params']['id']}})['then'](handleEntityNotFound(_0x45e699,null))[_0x7463('0x22')](saveUpdates(_0x45ea42['body'],null))[_0x7463('0x22')](respondWithResult(_0x45e699,null))[_0x7463('0x46')](handleError(_0x45e699,null));};exports['destroy']=function(_0x578b03,_0x1196bc){return db[_0x7463('0x2a')][_0x7463('0x45')]({'where':{'id':_0x578b03[_0x7463('0x42')]['id']}})[_0x7463('0x22')](handleEntityNotFound(_0x1196bc,null))[_0x7463('0x22')](removeEntity(_0x1196bc,null))[_0x7463('0x46')](handleError(_0x1196bc,null));};exports[_0x7463('0x49')]=function(_0x560ffb,_0x32c6ff){return db[_0x7463('0x2a')][_0x7463('0x49')]()[_0x7463('0x22')](respondWithResult(_0x32c6ff,null))['catch'](handleError(_0x32c6ff,null));}; \ No newline at end of file +var _0xa1c2=['merge','options','includeAll','rows','catch','show','params','include','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','filter'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0xa1c2,0x9d));var _0x2a1c=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xa1c2[_0x4fdcc0];return _0xc0ce94;};'use strict';var emlformat=require(_0x2a1c('0x0'));var rimraf=require(_0x2a1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a1c('0x2'));var rp=require(_0x2a1c('0x3'));var moment=require(_0x2a1c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a1c('0x5'));var path=require('path');var sox=require(_0x2a1c('0x6'));var csv=require(_0x2a1c('0x7'));var ejs=require(_0x2a1c('0x8'));var fs=require('fs');var fs_extra=require(_0x2a1c('0x9'));var _=require(_0x2a1c('0xa'));var squel=require(_0x2a1c('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a1c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2a1c('0x7'));var querystring=require(_0x2a1c('0xd'));var Papa=require('papaparse');var Redis=require(_0x2a1c('0xe'));var authService=require(_0x2a1c('0xf'));var qs=require(_0x2a1c('0x10'));var as=require(_0x2a1c('0x11'));var hardwareService=require(_0x2a1c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2a1c('0x13'));var config=require(_0x2a1c('0x14'));var licenseUtil=require(_0x2a1c('0x15'));var db=require(_0x2a1c('0x16'))['db'];function respondWithStatusCode(_0xceeb42,_0x3d5898){_0x3d5898=_0x3d5898||0xcc;return function(_0x599c78){if(_0x599c78){return _0xceeb42[_0x2a1c('0x17')](_0x3d5898);}return _0xceeb42[_0x2a1c('0x18')](_0x3d5898)['end']();};}function respondWithResult(_0x2bd0d1,_0x41783d){_0x41783d=_0x41783d||0xc8;return function(_0x2a0267){if(_0x2a0267){return _0x2bd0d1[_0x2a1c('0x18')](_0x41783d)[_0x2a1c('0x19')](_0x2a0267);}};}function respondWithFilteredResult(_0x42b490,_0x427049){return function(_0x53478b){if(_0x53478b){var _0x5c56ec=typeof _0x427049[_0x2a1c('0x1a')]===_0x2a1c('0x1b')&&typeof _0x427049[_0x2a1c('0x1c')]===_0x2a1c('0x1b');var _0x20e24b=_0x53478b[_0x2a1c('0x1d')];var _0x419ca0=_0x5c56ec?0x0:_0x427049[_0x2a1c('0x1a')];var _0x12e383=_0x5c56ec?_0x53478b[_0x2a1c('0x1d')]:_0x427049[_0x2a1c('0x1a')]+_0x427049[_0x2a1c('0x1c')];var _0x3d8743;if(_0x12e383>=_0x20e24b){_0x12e383=_0x20e24b;_0x3d8743=0xc8;}else{_0x3d8743=0xce;}_0x42b490[_0x2a1c('0x18')](_0x3d8743);return _0x42b490['set'](_0x2a1c('0x1e'),_0x419ca0+'-'+_0x12e383+'/'+_0x20e24b)[_0x2a1c('0x19')](_0x53478b);}return null;};}function patchUpdates(_0x4ece93){return function(_0x4519be){try{jsonpatch[_0x2a1c('0x1f')](_0x4519be,_0x4ece93,!![]);}catch(_0x171be9){return BPromise[_0x2a1c('0x20')](_0x171be9);}return _0x4519be[_0x2a1c('0x21')]();};}function saveUpdates(_0x3623f5,_0x54b6f3){return function(_0x34365e){if(_0x34365e){return _0x34365e['update'](_0x3623f5)['then'](function(_0x1ab44f){return _0x1ab44f;});}return null;};}function removeEntity(_0x13643b,_0x35191f){return function(_0x41bc54){if(_0x41bc54){return _0x41bc54[_0x2a1c('0x22')]()[_0x2a1c('0x23')](function(){_0x13643b[_0x2a1c('0x18')](0xcc)[_0x2a1c('0x24')]();});}};}function handleEntityNotFound(_0xf7e71a,_0x5ce1fa){return function(_0x3e6d8d){if(!_0x3e6d8d){_0xf7e71a[_0x2a1c('0x17')](0x194);}return _0x3e6d8d;};}function handleError(_0x45d832,_0x5699ad){_0x5699ad=_0x5699ad||0x1f4;return function(_0x528ad0){logger[_0x2a1c('0x25')](_0x528ad0[_0x2a1c('0x26')]);if(_0x528ad0[_0x2a1c('0x27')]){delete _0x528ad0[_0x2a1c('0x27')];}_0x45d832[_0x2a1c('0x18')](_0x5699ad)[_0x2a1c('0x28')](_0x528ad0);};}exports['index']=function(_0x2c0eb5,_0x163f73){var _0x47c964={},_0x579dd6={},_0x47dfb4={'count':0x0,'rows':[]};var _0x1e3030=_[_0x2a1c('0x29')](db[_0x2a1c('0x2a')][_0x2a1c('0x2b')],function(_0x5a1d2f){return{'name':_0x5a1d2f[_0x2a1c('0x2c')],'type':_0x5a1d2f[_0x2a1c('0x2d')][_0x2a1c('0x2e')]};});_0x579dd6['model']=_['map'](_0x1e3030,_0x2a1c('0x27'));_0x579dd6[_0x2a1c('0x2f')]=_[_0x2a1c('0x30')](_0x2c0eb5[_0x2a1c('0x2f')]);_0x579dd6[_0x2a1c('0x31')]=_[_0x2a1c('0x32')](_0x579dd6[_0x2a1c('0x33')],_0x579dd6[_0x2a1c('0x2f')]);_0x47c964[_0x2a1c('0x34')]=_[_0x2a1c('0x32')](_0x579dd6[_0x2a1c('0x33')],qs[_0x2a1c('0x35')](_0x2c0eb5[_0x2a1c('0x2f')][_0x2a1c('0x35')]));_0x47c964[_0x2a1c('0x34')]=_0x47c964['attributes'][_0x2a1c('0x36')]?_0x47c964['attributes']:_0x579dd6[_0x2a1c('0x33')];if(!_0x2c0eb5[_0x2a1c('0x2f')]['hasOwnProperty'](_0x2a1c('0x37'))){_0x47c964[_0x2a1c('0x1c')]=qs['limit'](_0x2c0eb5['query'][_0x2a1c('0x1c')]);_0x47c964[_0x2a1c('0x1a')]=qs[_0x2a1c('0x1a')](_0x2c0eb5[_0x2a1c('0x2f')][_0x2a1c('0x1a')]);}_0x47c964[_0x2a1c('0x38')]=qs['sort'](_0x2c0eb5[_0x2a1c('0x2f')]['sort']);_0x47c964['where']=qs[_0x2a1c('0x31')](_['pick'](_0x2c0eb5[_0x2a1c('0x2f')],_0x579dd6[_0x2a1c('0x31')]),_0x1e3030);if(_0x2c0eb5['query']['filter']){_0x47c964[_0x2a1c('0x39')]=_['merge'](_0x47c964[_0x2a1c('0x39')],{'$or':_[_0x2a1c('0x29')](_0x1e3030,function(_0x34c885){if(_0x34c885[_0x2a1c('0x2d')]!=='VIRTUAL'){var _0x49026f={};_0x49026f[_0x34c885[_0x2a1c('0x27')]]={'$like':'%'+_0x2c0eb5['query'][_0x2a1c('0x3a')]+'%'};return _0x49026f;}})});}_0x47c964=_[_0x2a1c('0x3b')]({},_0x47c964,_0x2c0eb5[_0x2a1c('0x3c')]);var _0x35229a={'where':_0x47c964['where']};return db[_0x2a1c('0x2a')][_0x2a1c('0x1d')](_0x35229a)[_0x2a1c('0x23')](function(_0x4da749){_0x47dfb4[_0x2a1c('0x1d')]=_0x4da749;if(_0x2c0eb5['query'][_0x2a1c('0x3d')]){_0x47c964['include']=[{'all':!![]}];}return db[_0x2a1c('0x2a')]['findAll'](_0x47c964);})[_0x2a1c('0x23')](function(_0xe3f741){_0x47dfb4[_0x2a1c('0x3e')]=_0xe3f741;return _0x47dfb4;})[_0x2a1c('0x23')](respondWithFilteredResult(_0x163f73,_0x47c964))[_0x2a1c('0x3f')](handleError(_0x163f73,null));};exports[_0x2a1c('0x40')]=function(_0x22d3b1,_0x19e700){var _0xd47685={'raw':!![],'where':{'id':_0x22d3b1[_0x2a1c('0x41')]['id']}},_0x228e34={};_0x228e34['model']=_[_0x2a1c('0x30')](db['SmsTransferReport']['rawAttributes']);_0x228e34[_0x2a1c('0x2f')]=_[_0x2a1c('0x30')](_0x22d3b1[_0x2a1c('0x2f')]);_0x228e34['filters']=_[_0x2a1c('0x32')](_0x228e34[_0x2a1c('0x33')],_0x228e34[_0x2a1c('0x2f')]);_0xd47685[_0x2a1c('0x34')]=_[_0x2a1c('0x32')](_0x228e34['model'],qs[_0x2a1c('0x35')](_0x22d3b1[_0x2a1c('0x2f')]['fields']));_0xd47685[_0x2a1c('0x34')]=_0xd47685[_0x2a1c('0x34')][_0x2a1c('0x36')]?_0xd47685['attributes']:_0x228e34[_0x2a1c('0x33')];if(_0x22d3b1[_0x2a1c('0x2f')][_0x2a1c('0x3d')]){_0xd47685[_0x2a1c('0x42')]=[{'all':!![]}];}_0xd47685=_[_0x2a1c('0x3b')]({},_0xd47685,_0x22d3b1[_0x2a1c('0x3c')]);return db['SmsTransferReport']['find'](_0xd47685)[_0x2a1c('0x23')](handleEntityNotFound(_0x19e700,null))['then'](respondWithResult(_0x19e700,null))[_0x2a1c('0x3f')](handleError(_0x19e700,null));};exports[_0x2a1c('0x43')]=function(_0x55b3aa,_0x3d5a1d){return db[_0x2a1c('0x2a')][_0x2a1c('0x43')](_0x55b3aa[_0x2a1c('0x44')],{})['then'](respondWithResult(_0x3d5a1d,0xc9))[_0x2a1c('0x3f')](handleError(_0x3d5a1d,null));};exports[_0x2a1c('0x45')]=function(_0xe13370,_0x5162ac){if(_0xe13370[_0x2a1c('0x44')]['id']){delete _0xe13370['body']['id'];}return db[_0x2a1c('0x2a')][_0x2a1c('0x46')]({'where':{'id':_0xe13370['params']['id']}})[_0x2a1c('0x23')](handleEntityNotFound(_0x5162ac,null))['then'](saveUpdates(_0xe13370[_0x2a1c('0x44')],null))['then'](respondWithResult(_0x5162ac,null))['catch'](handleError(_0x5162ac,null));};exports['destroy']=function(_0x546478,_0x293fbf){return db[_0x2a1c('0x2a')][_0x2a1c('0x46')]({'where':{'id':_0x546478[_0x2a1c('0x41')]['id']}})[_0x2a1c('0x23')](handleEntityNotFound(_0x293fbf,null))['then'](removeEntity(_0x293fbf,null))[_0x2a1c('0x3f')](handleError(_0x293fbf,null));};exports[_0x2a1c('0x47')]=function(_0x5df103,_0x3fabb2){return db[_0x2a1c('0x2a')]['describe']()[_0x2a1c('0x23')](respondWithResult(_0x3fabb2,null))[_0x2a1c('0x3f')](handleError(_0x3fabb2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 22aca94..806ecee 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 _0x319c=['moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x319c,0x1d9));var _0xc319=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x319c[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var logger=require(_0xc319('0x1'))(_0xc319('0x2'));var moment=require(_0xc319('0x3'));var BPromise=require('bluebird');var rp=require(_0xc319('0x4'));var fs=require('fs');var path=require(_0xc319('0x5'));var rimraf=require(_0xc319('0x6'));var config=require(_0xc319('0x7'));var attributes=require(_0xc319('0x8'));module[_0xc319('0x9')]=function(_0xd892a7,_0x1c6cc6){return _0xd892a7[_0xc319('0xa')](_0xc319('0xb'),attributes,{'tableName':_0xc319('0xc'),'paranoid':![],'indexes':[{'name':_0xc319('0xd'),'fields':[_0xc319('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa162=['bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','api','moment'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0xa162,0x169));var _0x2a16=function(_0x4c771b,_0x2ab782){_0x4c771b=_0x4c771b-0x0;var _0x3c4f0f=_0xa162[_0x4c771b];return _0x3c4f0f;};'use strict';var _=require(_0x2a16('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2a16('0x1'));var moment=require(_0x2a16('0x2'));var BPromise=require(_0x2a16('0x3'));var rp=require(_0x2a16('0x4'));var fs=require('fs');var path=require(_0x2a16('0x5'));var rimraf=require(_0x2a16('0x6'));var config=require(_0x2a16('0x7'));var attributes=require(_0x2a16('0x8'));module['exports']=function(_0x2674f6,_0xc66f31){return _0x2674f6[_0x2a16('0x9')](_0x2a16('0xa'),attributes,{'tableName':_0x2a16('0xb'),'paranoid':![],'indexes':[{'name':_0x2a16('0xc'),'fields':[_0x2a16('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2abc4f7..585a7a3 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 _0x8c32=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x199a1e,_0x4eabf2){var _0x50150c=function(_0x5c73d6){while(--_0x5c73d6){_0x199a1e['push'](_0x199a1e['shift']());}};_0x50150c(++_0x4eabf2);}(_0x8c32,0x130));var _0x28c3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8c32[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var moment=require(_0x28c3('0x2'));var BPromise=require(_0x28c3('0x3'));var rs=require(_0x28c3('0x4'));var fs=require('fs');var Redis=require(_0x28c3('0x5'));var db=require(_0x28c3('0x6'))['db'];var utils=require(_0x28c3('0x7'));var logger=require(_0x28c3('0x8'))(_0x28c3('0x9'));var config=require(_0x28c3('0xa'));var jayson=require(_0x28c3('0xb'));var client=jayson['client'][_0x28c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ed515,_0x2ce6c1,_0x482952){return new BPromise(function(_0xbaee6f,_0x2fb4cb){return client['request'](_0x4ed515,_0x482952)[_0x28c3('0xd')](function(_0x37bda3){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2ce6c1,'request\x20sent');logger[_0x28c3('0xe')](_0x28c3('0xf'),_0x2ce6c1,'request\x20sent',JSON[_0x28c3('0x10')](_0x37bda3));if(_0x37bda3[_0x28c3('0x11')]){if(_0x37bda3[_0x28c3('0x11')]['code']===0x1f4){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x37bda3[_0x28c3('0x11')][_0x28c3('0x13')]);return _0x2fb4cb(_0x37bda3[_0x28c3('0x11')]['message']);}logger[_0x28c3('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x2ce6c1,_0x37bda3[_0x28c3('0x11')]['message']);return _0xbaee6f(_0x37bda3[_0x28c3('0x11')]['message']);}else{logger[_0x28c3('0x14')](_0x28c3('0x12'),_0x2ce6c1,'request\x20sent');_0xbaee6f(_0x37bda3[_0x28c3('0x15')]['message']);}})['catch'](function(_0x58e2b9){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x58e2b9);_0x2fb4cb(_0x58e2b9);});});} \ No newline at end of file +var _0x9973=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xbee7ab,_0x485dfc){var _0x4f1e2e=function(_0x4b09d6){while(--_0x4b09d6){_0xbee7ab['push'](_0xbee7ab['shift']());}};_0x4f1e2e(++_0x485dfc);}(_0x9973,0x157));var _0x3997=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9973[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var moment=require(_0x3997('0x1'));var BPromise=require('bluebird');var rs=require(_0x3997('0x2'));var fs=require('fs');var Redis=require(_0x3997('0x3'));var db=require(_0x3997('0x4'))['db'];var utils=require(_0x3997('0x5'));var logger=require(_0x3997('0x6'))(_0x3997('0x7'));var config=require(_0x3997('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3997('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x114d26,_0x3c6b75,_0x483d44){return new BPromise(function(_0x569ddf,_0x559dba){return client[_0x3997('0xa')](_0x114d26,_0x483d44)[_0x3997('0xb')](function(_0x1848ca){logger[_0x3997('0xc')](_0x3997('0xd'),_0x3c6b75,_0x3997('0xe'));logger[_0x3997('0xf')](_0x3997('0x10'),_0x3c6b75,_0x3997('0xe'),JSON[_0x3997('0x11')](_0x1848ca));if(_0x1848ca[_0x3997('0x12')]){if(_0x1848ca[_0x3997('0x12')][_0x3997('0x13')]===0x1f4){logger[_0x3997('0x12')](_0x3997('0xd'),_0x3c6b75,_0x1848ca[_0x3997('0x12')][_0x3997('0x14')]);return _0x559dba(_0x1848ca[_0x3997('0x12')][_0x3997('0x14')]);}logger[_0x3997('0x12')](_0x3997('0xd'),_0x3c6b75,_0x1848ca[_0x3997('0x12')][_0x3997('0x14')]);return _0x569ddf(_0x1848ca['error'][_0x3997('0x14')]);}else{logger[_0x3997('0xc')](_0x3997('0xd'),_0x3c6b75,_0x3997('0xe'));_0x569ddf(_0x1848ca['result'][_0x3997('0x14')]);}})[_0x3997('0x15')](function(_0x4cb897){logger['error'](_0x3997('0xd'),_0x3c6b75,_0x4cb897);_0x559dba(_0x4cb897);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a166c4e..539287d 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 _0x20dd=['./sound.controller','index','get','/:id','show','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x133b43,_0x3d1c28){var _0x54f4c5=function(_0x665dc4){while(--_0x665dc4){_0x133b43['push'](_0x133b43['shift']());}};_0x54f4c5(++_0x3d1c28);}(_0x20dd,0x157));var _0xd20d=function(_0x5873d3,_0x4f6a3f){_0x5873d3=_0x5873d3-0x0;var _0x18aef4=_0x20dd[_0x5873d3];return _0x18aef4;};'use strict';var multer=require(_0xd20d('0x0'));var util=require(_0xd20d('0x1'));var path=require('path');var timeout=require(_0xd20d('0x2'));var express=require(_0xd20d('0x3'));var router=express[_0xd20d('0x4')]();var fs_extra=require(_0xd20d('0x5'));var auth=require(_0xd20d('0x6'));var interaction=require(_0xd20d('0x7'));var config=require(_0xd20d('0x8'));var controller=require(_0xd20d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd20d('0xa')]);router[_0xd20d('0xb')](_0xd20d('0xc'),auth['isAuthenticated'](),controller[_0xd20d('0xd')]);router[_0xd20d('0xb')]('/:id/download',auth[_0xd20d('0xe')](),controller[_0xd20d('0xf')]);var upload=multer({'storage':multer[_0xd20d('0x10')]({'destination':function(_0x2c30a6,_0x21ceb1,_0x228dd4){_0x228dd4(null,path[_0xd20d('0x11')](config[_0xd20d('0x12')],_0xd20d('0x13')));},'filename':function(_0x4cfb3f,_0x584480,_0x33e4cc){_0x584480[_0xd20d('0x14')]=_0x584480[_0xd20d('0x14')][_0xd20d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e4cc(null,util[_0xd20d('0x16')]('%s-%s%s',path[_0xd20d('0x17')](_0x584480['originalname'],path[_0xd20d('0x18')](_0x584480[_0xd20d('0x14')])),Date[_0xd20d('0x19')](),path['extname'](_0x584480[_0xd20d('0x14')])));}})});router[_0xd20d('0x1a')]('/',upload[_0xd20d('0x1b')]('file'),controller[_0xd20d('0x1c')]);router[_0xd20d('0x1d')](_0xd20d('0xc'),auth[_0xd20d('0xe')](),controller[_0xd20d('0x1e')]);router['delete'](_0xd20d('0xc'),auth[_0xd20d('0xe')](),controller[_0xd20d('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xe0b3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','extname','post','single','file','create','delete','multer'];(function(_0xbcbd76,_0x25722b){var _0x503680=function(_0x163649){while(--_0x163649){_0xbcbd76['push'](_0xbcbd76['shift']());}};_0x503680(++_0x25722b);}(_0xe0b3,0x143));var _0x3e0b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0b3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3e0b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e0b('0x1'));var express=require(_0x3e0b('0x2'));var router=express[_0x3e0b('0x3')]();var fs_extra=require(_0x3e0b('0x4'));var auth=require(_0x3e0b('0x5'));var interaction=require(_0x3e0b('0x6'));var config=require(_0x3e0b('0x7'));var controller=require('./sound.controller');router[_0x3e0b('0x8')]('/',auth[_0x3e0b('0x9')](),controller[_0x3e0b('0xa')]);router[_0x3e0b('0x8')](_0x3e0b('0xb'),auth['isAuthenticated'](),controller[_0x3e0b('0xc')]);router[_0x3e0b('0x8')](_0x3e0b('0xd'),auth[_0x3e0b('0x9')](),controller[_0x3e0b('0xe')]);var upload=multer({'storage':multer[_0x3e0b('0xf')]({'destination':function(_0x120c9e,_0x3a1390,_0x30ea58){_0x30ea58(null,path[_0x3e0b('0x10')](config[_0x3e0b('0x11')],_0x3e0b('0x12')));},'filename':function(_0x448334,_0x3310a9,_0x5b96cb){_0x3310a9['originalname']=_0x3310a9[_0x3e0b('0x13')][_0x3e0b('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b96cb(null,util['format']('%s-%s%s',path['basename'](_0x3310a9['originalname'],path[_0x3e0b('0x15')](_0x3310a9['originalname'])),Date['now'](),path[_0x3e0b('0x15')](_0x3310a9[_0x3e0b('0x13')])));}})});router[_0x3e0b('0x16')]('/',upload[_0x3e0b('0x17')](_0x3e0b('0x18')),controller[_0x3e0b('0x19')]);router['put'](_0x3e0b('0xb'),auth[_0x3e0b('0x9')](),controller['update']);router['delete']('/:id',auth[_0x3e0b('0x9')](),controller[_0x3e0b('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d5cd9fd..6724063 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 _0x9ac0=['BIGINT','INTEGER','exports','STRING','FLOAT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ac0,0x179));var _0x09ac=function(_0x2925f5,_0x34cc05){_0x2925f5=_0x2925f5-0x0;var _0x2ef404=_0x9ac0[_0x2925f5];return _0x2ef404;};'use strict';var Sequelize=require('sequelize');module[_0x09ac('0x0')]={'name':{'type':Sequelize[_0x09ac('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x09ac('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x09ac('0x1')]},'original_duration':{'type':Sequelize[_0x09ac('0x2')]},'original_sampleCount':{'type':Sequelize[_0x09ac('0x3')]},'original_channelCount':{'type':Sequelize[_0x09ac('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x09ac('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x09ac('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x09ac('0x3')]},'converted_channelCount':{'type':Sequelize[_0x09ac('0x4')]},'converted_bitRate':{'type':Sequelize[_0x09ac('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1bf0=['INTEGER','BIGINT','sequelize','exports','STRING','FLOAT'];(function(_0x4bc276,_0x3a0014){var _0x3cb106=function(_0x27c889){while(--_0x27c889){_0x4bc276['push'](_0x4bc276['shift']());}};_0x3cb106(++_0x3a0014);}(_0x1bf0,0x1c4));var _0x01bf=function(_0x3e14ce,_0x3243bd){_0x3e14ce=_0x3e14ce-0x0;var _0x4a63ca=_0x1bf0[_0x3e14ce];return _0x4a63ca;};'use strict';var Sequelize=require(_0x01bf('0x0'));module[_0x01bf('0x1')]={'name':{'type':Sequelize[_0x01bf('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x01bf('0x2')]},'display_name':{'type':Sequelize[_0x01bf('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x01bf('0x2')]},'original_format':{'type':Sequelize[_0x01bf('0x2')]},'original_duration':{'type':Sequelize[_0x01bf('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x01bf('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x01bf('0x4')]},'converted_format':{'type':Sequelize[_0x01bf('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x01bf('0x5')]},'converted_channelCount':{'type':Sequelize[_0x01bf('0x4')]},'converted_bitRate':{'type':Sequelize[_0x01bf('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x01bf('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4ec8546..1951d27 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 _0x3cff=['lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','fields','find','download','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','save_name','create','basename','originalname','file','filename','extname','wav','server/files/sounds/original','root','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','start','send','update','description','delete','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x12b919,_0x2f43fa){var _0x5e2136=function(_0x4185ed){while(--_0x4185ed){_0x12b919['push'](_0x12b919['shift']());}};_0x5e2136(++_0x2f43fa);}(_0x3cff,0x177));var _0xf3cf=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x3cff[_0x2867d8];return _0x3b8176;};'use strict';var emlformat=require(_0xf3cf('0x0'));var rimraf=require(_0xf3cf('0x1'));var zipdir=require(_0xf3cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3cf('0x3'));var moment=require(_0xf3cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf3cf('0x5'));var util=require(_0xf3cf('0x6'));var path=require(_0xf3cf('0x7'));var sox=require(_0xf3cf('0x8'));var csv=require(_0xf3cf('0x9'));var ejs=require(_0xf3cf('0xa'));var fs=require('fs');var fs_extra=require(_0xf3cf('0xb'));var _=require(_0xf3cf('0xc'));var squel=require(_0xf3cf('0xd'));var crypto=require(_0xf3cf('0xe'));var jsforce=require(_0xf3cf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf3cf('0x9'));var querystring=require(_0xf3cf('0x10'));var Papa=require('papaparse');var Redis=require(_0xf3cf('0x11'));var authService=require(_0xf3cf('0x12'));var qs=require(_0xf3cf('0x13'));var as=require(_0xf3cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3cf('0x15'))(_0xf3cf('0x16'));var utils=require(_0xf3cf('0x17'));var config=require(_0xf3cf('0x18'));var licenseUtil=require(_0xf3cf('0x19'));var db=require(_0xf3cf('0x1a'))['db'];function respondWithStatusCode(_0x3e195a,_0x1aa913){_0x1aa913=_0x1aa913||0xcc;return function(_0x6543a6){if(_0x6543a6){return _0x3e195a[_0xf3cf('0x1b')](_0x1aa913);}return _0x3e195a[_0xf3cf('0x1c')](_0x1aa913)[_0xf3cf('0x1d')]();};}function respondWithResult(_0x459d85,_0x36581c){_0x36581c=_0x36581c||0xc8;return function(_0x1eb72e){if(_0x1eb72e){return _0x459d85['status'](_0x36581c)[_0xf3cf('0x1e')](_0x1eb72e);}};}function respondWithFilteredResult(_0x45292a,_0xb36d3c){return function(_0x57a284){if(_0x57a284){var _0x3ac735=typeof _0xb36d3c[_0xf3cf('0x1f')]===_0xf3cf('0x20')&&typeof _0xb36d3c[_0xf3cf('0x21')]===_0xf3cf('0x20');var _0x3c4b92=_0x57a284[_0xf3cf('0x22')];var _0x3b1390=_0x3ac735?0x0:_0xb36d3c['offset'];var _0x3aa578=_0x3ac735?_0x57a284[_0xf3cf('0x22')]:_0xb36d3c['offset']+_0xb36d3c[_0xf3cf('0x21')];var _0x7f0d2b;if(_0x3aa578>=_0x3c4b92){_0x3aa578=_0x3c4b92;_0x7f0d2b=0xc8;}else{_0x7f0d2b=0xce;}_0x45292a[_0xf3cf('0x1c')](_0x7f0d2b);return _0x45292a[_0xf3cf('0x23')](_0xf3cf('0x24'),_0x3b1390+'-'+_0x3aa578+'/'+_0x3c4b92)['json'](_0x57a284);}return null;};}function patchUpdates(_0x27a235){return function(_0x4a0305){try{jsonpatch[_0xf3cf('0x25')](_0x4a0305,_0x27a235,!![]);}catch(_0x3f915d){return BPromise[_0xf3cf('0x26')](_0x3f915d);}return _0x4a0305[_0xf3cf('0x27')]();};}function saveUpdates(_0x2cd7a8,_0x14659f){return function(_0xad5994){if(_0xad5994){return _0xad5994['update'](_0x2cd7a8)[_0xf3cf('0x28')](function(_0x1ae4e5){return _0x1ae4e5;});}return null;};}function removeEntity(_0x11933a,_0x11d8d9){return function(_0x49a32b){if(_0x49a32b){return _0x49a32b[_0xf3cf('0x29')]()[_0xf3cf('0x28')](function(){var _0x2528d0=_0x49a32b['get']({'plain':!![]});var _0xc3d97d=_0xf3cf('0x2a');return db[_0xf3cf('0x2b')][_0xf3cf('0x29')]({'where':{'type':_0xc3d97d,'resourceId':_0x2528d0['id']}})[_0xf3cf('0x28')](function(){return _0x49a32b;});})[_0xf3cf('0x28')](function(){_0x11933a[_0xf3cf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5722a3,_0x6b2e7b){return function(_0x4b1f8c){if(!_0x4b1f8c){_0x5722a3[_0xf3cf('0x1b')](0x194);}return _0x4b1f8c;};}function handleError(_0x308c33,_0x41af52){_0x41af52=_0x41af52||0x1f4;return function(_0x294237){logger[_0xf3cf('0x2c')](_0x294237[_0xf3cf('0x2d')]);if(_0x294237['name']){delete _0x294237[_0xf3cf('0x2e')];}_0x308c33[_0xf3cf('0x1c')](_0x41af52)['send'](_0x294237);};}exports[_0xf3cf('0x2f')]=function(_0x2ca3ca,_0x2c4ef9){var _0x3a10a0={},_0x13370b={},_0x3a711c={'count':0x0,'rows':[]};var _0x5e4d95=_[_0xf3cf('0x30')](db[_0xf3cf('0x31')][_0xf3cf('0x32')],function(_0xc48df8){return{'name':_0xc48df8[_0xf3cf('0x33')],'type':_0xc48df8[_0xf3cf('0x34')][_0xf3cf('0x35')]};});_0x13370b[_0xf3cf('0x36')]=_[_0xf3cf('0x30')](_0x5e4d95,'name');_0x13370b[_0xf3cf('0x37')]=_[_0xf3cf('0x38')](_0x2ca3ca[_0xf3cf('0x37')]);_0x13370b['filters']=_[_0xf3cf('0x39')](_0x13370b[_0xf3cf('0x36')],_0x13370b[_0xf3cf('0x37')]);_0x3a10a0['attributes']=_[_0xf3cf('0x39')](_0x13370b[_0xf3cf('0x36')],qs['fields'](_0x2ca3ca[_0xf3cf('0x37')]['fields']));_0x3a10a0[_0xf3cf('0x3a')]=_0x3a10a0[_0xf3cf('0x3a')][_0xf3cf('0x3b')]?_0x3a10a0[_0xf3cf('0x3a')]:_0x13370b[_0xf3cf('0x36')];if(!_0x2ca3ca['query'][_0xf3cf('0x3c')](_0xf3cf('0x3d'))){_0x3a10a0['limit']=qs[_0xf3cf('0x21')](_0x2ca3ca[_0xf3cf('0x37')]['limit']);_0x3a10a0[_0xf3cf('0x1f')]=qs[_0xf3cf('0x1f')](_0x2ca3ca[_0xf3cf('0x37')][_0xf3cf('0x1f')]);}_0x3a10a0[_0xf3cf('0x3e')]=qs['sort'](_0x2ca3ca[_0xf3cf('0x37')][_0xf3cf('0x3f')]);_0x3a10a0[_0xf3cf('0x40')]=qs[_0xf3cf('0x41')](_[_0xf3cf('0x42')](_0x2ca3ca[_0xf3cf('0x37')],_0x13370b[_0xf3cf('0x41')]),_0x5e4d95);if(_0x2ca3ca[_0xf3cf('0x37')][_0xf3cf('0x43')]){_0x3a10a0[_0xf3cf('0x40')]=_[_0xf3cf('0x44')](_0x3a10a0['where'],{'$or':_[_0xf3cf('0x30')](_0x5e4d95,function(_0x78766f){if(_0x78766f[_0xf3cf('0x34')]!==_0xf3cf('0x45')){var _0x4cf855={};_0x4cf855[_0x78766f[_0xf3cf('0x2e')]]={'$like':'%'+_0x2ca3ca['query']['filter']+'%'};return _0x4cf855;}})});}_0x3a10a0=_[_0xf3cf('0x44')]({},_0x3a10a0,_0x2ca3ca[_0xf3cf('0x46')]);var _0x37fced={'where':_0x3a10a0[_0xf3cf('0x40')]};return db[_0xf3cf('0x31')]['count'](_0x37fced)[_0xf3cf('0x28')](function(_0xd447ab){_0x3a711c[_0xf3cf('0x22')]=_0xd447ab;if(_0x2ca3ca[_0xf3cf('0x37')]['includeAll']){_0x3a10a0[_0xf3cf('0x47')]=[{'all':!![]}];}return db[_0xf3cf('0x31')][_0xf3cf('0x48')](_0x3a10a0);})[_0xf3cf('0x28')](function(_0x361f97){_0x3a711c['rows']=_0x361f97;return _0x3a711c;})[_0xf3cf('0x28')](respondWithFilteredResult(_0x2c4ef9,_0x3a10a0))[_0xf3cf('0x49')](handleError(_0x2c4ef9,null));};exports['show']=function(_0x344a9f,_0x26404c){var _0x1d4a5e={'raw':!![],'where':{'id':_0x344a9f[_0xf3cf('0x4a')]['id']}},_0x271d09={};_0x271d09[_0xf3cf('0x36')]=_[_0xf3cf('0x38')](db[_0xf3cf('0x31')][_0xf3cf('0x32')]);_0x271d09[_0xf3cf('0x37')]=_[_0xf3cf('0x38')](_0x344a9f['query']);_0x271d09[_0xf3cf('0x41')]=_[_0xf3cf('0x39')](_0x271d09['model'],_0x271d09[_0xf3cf('0x37')]);_0x1d4a5e['attributes']=_[_0xf3cf('0x39')](_0x271d09['model'],qs[_0xf3cf('0x4b')](_0x344a9f[_0xf3cf('0x37')][_0xf3cf('0x4b')]));_0x1d4a5e[_0xf3cf('0x3a')]=_0x1d4a5e[_0xf3cf('0x3a')][_0xf3cf('0x3b')]?_0x1d4a5e[_0xf3cf('0x3a')]:_0x271d09[_0xf3cf('0x36')];if(_0x344a9f[_0xf3cf('0x37')]['includeAll']){_0x1d4a5e[_0xf3cf('0x47')]=[{'all':!![]}];}_0x1d4a5e=_[_0xf3cf('0x44')]({},_0x1d4a5e,_0x344a9f['options']);return db[_0xf3cf('0x31')][_0xf3cf('0x4c')](_0x1d4a5e)[_0xf3cf('0x28')](handleEntityNotFound(_0x26404c,null))[_0xf3cf('0x28')](respondWithResult(_0x26404c,null))[_0xf3cf('0x49')](handleError(_0x26404c,null));};exports[_0xf3cf('0x4d')]=function(_0x353255,_0xfe661e,_0x4d5d84){return db['Sound']['find']({'where':{'id':_0x353255[_0xf3cf('0x4a')]['id']},'attributes':[_0xf3cf('0x2e'),'save_name',_0xf3cf('0x4e')],'raw':!![]})[_0xf3cf('0x28')](handleEntityNotFound(_0xfe661e,null))[_0xf3cf('0x28')](function(_0x16d57d){if(_0x16d57d){if(!fs[_0xf3cf('0x4f')](path[_0xf3cf('0x50')](config['root'],_0xf3cf('0x51'),_0x16d57d['save_name']+'.'+_0x16d57d[_0xf3cf('0x4e')]))){throw new db[(_0xf3cf('0x52'))][(_0xf3cf('0x53'))]('Sound\x20not\x20found');}return _0xfe661e[_0xf3cf('0x4d')](path['join'](config['root'],_0xf3cf('0x51'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),_0x16d57d[_0xf3cf('0x56')],_0x16d57d[_0xf3cf('0x4e')])),util['format'](_0xf3cf('0x55'),_0x16d57d[_0xf3cf('0x2e')],_0x16d57d['converted_format']));}return null;})[_0xf3cf('0x49')](handleError(_0xfe661e,null));};exports[_0xf3cf('0x57')]=function(_0x51bae7,_0x52743f,_0x1f32e3){var _0x1e5e9e={'name':path[_0xf3cf('0x58')](_0x51bae7['file'][_0xf3cf('0x59')],path['extname'](_0x51bae7[_0xf3cf('0x5a')][_0xf3cf('0x59')])),'save_name':path[_0xf3cf('0x58')](_0x51bae7['file'][_0xf3cf('0x5b')],path[_0xf3cf('0x5c')](_0x51bae7[_0xf3cf('0x5a')][_0xf3cf('0x5b')])),'original_format':path[_0xf3cf('0x5c')](_0x51bae7[_0xf3cf('0x5a')][_0xf3cf('0x59')])['substring'](0x1),'converted_format':_0xf3cf('0x5d')};var _0x9075c3=path['join'](config['root'],_0xf3cf('0x5e'),_0x51bae7[_0xf3cf('0x5a')]['filename']);var _0x4b484c=path[_0xf3cf('0x50')](config[_0xf3cf('0x5f')],_0xf3cf('0x51'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),path[_0xf3cf('0x58')](_0x51bae7[_0xf3cf('0x5a')]['filename'],path[_0xf3cf('0x5c')](_0x51bae7[_0xf3cf('0x5a')]['filename'])),_0x1e5e9e['converted_format']));logger['info'](_0xf3cf('0x60'),_0x9075c3);logger[_0xf3cf('0x61')](_0xf3cf('0x62'),_0x4b484c);try{fs[_0xf3cf('0x63')](_0x9075c3,parseInt(_0xf3cf('0x64'),0x8));var _0x2d7ffe=sox[_0xf3cf('0x65')](_0x9075c3,_0x4b484c,{'sampleRate':0x1f40,'format':_0xf3cf('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d7ffe['on']('error',function(_0xa2b262){fs[_0xf3cf('0x66')](_0x9075c3);_0x52743f[_0xf3cf('0x1c')](0x1f4)['send'](_0xa2b262);});_0x2d7ffe['on'](_0xf3cf('0x67'),function(_0x7fdf1e){_0x1e5e9e[_0xf3cf('0x68')]=isNaN(_0x7fdf1e[_0xf3cf('0x69')])?null:_0x7fdf1e[_0xf3cf('0x69')]*0x3e8;_0x1e5e9e[_0xf3cf('0x6a')]=isNaN(_0x7fdf1e[_0xf3cf('0x6b')])?null:_0x7fdf1e[_0xf3cf('0x6b')];_0x1e5e9e[_0xf3cf('0x6c')]=isNaN(_0x7fdf1e['channelCount'])?null:_0x7fdf1e[_0xf3cf('0x6d')];_0x1e5e9e[_0xf3cf('0x6e')]=isNaN(_0x7fdf1e[_0xf3cf('0x6f')])?null:_0x7fdf1e[_0xf3cf('0x6f')];_0x1e5e9e['original_sampleRate']=isNaN(_0x7fdf1e[_0xf3cf('0x70')])?null:_0x7fdf1e['sampleRate'];});_0x2d7ffe['on'](_0xf3cf('0x71'),function(_0xa40f97){_0x1e5e9e[_0xf3cf('0x72')]=isNaN(_0xa40f97[_0xf3cf('0x69')])?null:_0xa40f97[_0xf3cf('0x69')]*0x3e8;_0x1e5e9e[_0xf3cf('0x73')]=isNaN(_0xa40f97[_0xf3cf('0x6b')])?null:_0xa40f97['sampleCount'];_0x1e5e9e['converted_channelCount']=isNaN(_0xa40f97[_0xf3cf('0x6d')])?null:_0xa40f97[_0xf3cf('0x6d')];_0x1e5e9e[_0xf3cf('0x74')]=isNaN(_0xa40f97['bitRate'])?null:_0xa40f97[_0xf3cf('0x6f')];_0x1e5e9e['converted_sampleRate']=isNaN(_0xa40f97[_0xf3cf('0x70')])?null:_0xa40f97[_0xf3cf('0x70')];});_0x2d7ffe['on'](_0xf3cf('0x1d'),function(){fs[_0xf3cf('0x63')](_0x4b484c,parseInt(_0xf3cf('0x64'),0x8));return db[_0xf3cf('0x31')][_0xf3cf('0x57')](_0x1e5e9e)[_0xf3cf('0x28')](function(_0x3943f8){var _0x47d599={'role':_0x51bae7[_0xf3cf('0x75')]['role'],'userProfileId':_0x51bae7['body']['userProfileId']};if(!_0x47d599)throw new Error(_0xf3cf('0x76'));if(_0x47d599['role']===_0xf3cf('0x77')){var _0x5dbacc=_0x3943f8[_0xf3cf('0x78')]({'plain':!![]});return db[_0xf3cf('0x79')][_0xf3cf('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x47d599[_0xf3cf('0x7a')]},'raw':!![]})[_0xf3cf('0x28')](function(_0x801bfb){if(_0x801bfb&&_0x801bfb[_0xf3cf('0x7b')]===0x0){return db[_0xf3cf('0x2b')][_0xf3cf('0x57')]({'name':_0x5dbacc[_0xf3cf('0x2e')],'resourceId':_0x5dbacc['id'],'type':_0x801bfb[_0xf3cf('0x2e')],'sectionId':_0x801bfb['id']},{})[_0xf3cf('0x28')](function(){return _0x3943f8;});}else{return _0x3943f8;}})['catch'](function(_0x334ed6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334ed6);throw _0x334ed6;});}return _0x3943f8;})[_0xf3cf('0x28')](respondWithResult(_0x52743f,null))[_0xf3cf('0x49')](handleError(_0x52743f,null));});_0x2d7ffe[_0xf3cf('0x7c')]();}catch(_0x25bf33){_0x52743f['status'](0x1f4)[_0xf3cf('0x7d')](_0x25bf33);}};exports[_0xf3cf('0x7e')]=function(_0x2a4307,_0x511b79,_0xa78a65){return db[_0xf3cf('0x31')]['find']({'where':{'id':_0x2a4307[_0xf3cf('0x4a')]['id']}})[_0xf3cf('0x28')](handleEntityNotFound(_0x511b79,null))['then'](saveUpdates(_['pick'](_0x2a4307[_0xf3cf('0x75')],[_0xf3cf('0x2e'),_0xf3cf('0x7f')]),null))[_0xf3cf('0x28')](respondWithResult(_0x511b79,null))[_0xf3cf('0x49')](handleError(_0x511b79,null));};exports[_0xf3cf('0x80')]=function(_0x3d6958,_0x20c145,_0x323f16){return db['Sound'][_0xf3cf('0x4c')]({'where':{'id':_0x3d6958['params']['id']}})[_0xf3cf('0x28')](function(_0x2ac2bc){if(_0x2ac2bc){return _0x2ac2bc[_0xf3cf('0x29')]();}})[_0xf3cf('0x28')](function(_0x44b596){var _0x379e3f=path[_0xf3cf('0x50')](config[_0xf3cf('0x5f')],_0xf3cf('0x5e'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),_0x44b596[_0xf3cf('0x56')],_0x44b596['original_format']));var _0x52eadf=path[_0xf3cf('0x50')](config[_0xf3cf('0x5f')],_0xf3cf('0x51'),util[_0xf3cf('0x54')](_0xf3cf('0x55'),_0x44b596[_0xf3cf('0x56')],_0x44b596[_0xf3cf('0x4e')]));fs[_0xf3cf('0x66')](_0x379e3f);fs[_0xf3cf('0x66')](_0x52eadf);return _0x44b596;})[_0xf3cf('0x28')](function(_0x3bfd6c){if(_0x3bfd6c){return _0x20c145[_0xf3cf('0x1c')](0xcc)[_0xf3cf('0x1d')]();}})[_0xf3cf('0x28')](handleEntityNotFound(_0x20c145,null))['catch'](handleError(_0x20c145,null));}; \ No newline at end of file +var _0x8dc3=['info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','sampleRate','dest','converted_duration','converted_channelCount','bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','apply','reject','save','update','then','destroy','UserProfileResource','end','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','includeAll','include','rows','catch','show','params','options','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','originalname','extname','filename','file','substring','wav','server/files/sounds/original'];(function(_0x448774,_0x45ddc7){var _0x46b2f6=function(_0x1dee94){while(--_0x1dee94){_0x448774['push'](_0x448774['shift']());}};_0x46b2f6(++_0x45ddc7);}(_0x8dc3,0x121));var _0x38dc=function(_0xed24f4,_0xb0ae10){_0xed24f4=_0xed24f4-0x0;var _0x256fea=_0x8dc3[_0xed24f4];return _0x256fea;};'use strict';var emlformat=require(_0x38dc('0x0'));var rimraf=require(_0x38dc('0x1'));var zipdir=require(_0x38dc('0x2'));var jsonpatch=require(_0x38dc('0x3'));var rp=require(_0x38dc('0x4'));var moment=require(_0x38dc('0x5'));var BPromise=require(_0x38dc('0x6'));var Mustache=require('mustache');var util=require(_0x38dc('0x7'));var path=require(_0x38dc('0x8'));var sox=require(_0x38dc('0x9'));var csv=require('to-csv');var ejs=require(_0x38dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x38dc('0xb'));var crypto=require('crypto');var jsforce=require(_0x38dc('0xc'));var deskjs=require(_0x38dc('0xd'));var toCsv=require(_0x38dc('0xe'));var querystring=require(_0x38dc('0xf'));var Papa=require(_0x38dc('0x10'));var Redis=require(_0x38dc('0x11'));var authService=require(_0x38dc('0x12'));var qs=require(_0x38dc('0x13'));var as=require(_0x38dc('0x14'));var hardwareService=require(_0x38dc('0x15'));var logger=require('../../config/logger')(_0x38dc('0x16'));var utils=require(_0x38dc('0x17'));var config=require(_0x38dc('0x18'));var licenseUtil=require(_0x38dc('0x19'));var db=require(_0x38dc('0x1a'))['db'];function respondWithStatusCode(_0x17db04,_0x4d3ecb){_0x4d3ecb=_0x4d3ecb||0xcc;return function(_0x57a63a){if(_0x57a63a){return _0x17db04[_0x38dc('0x1b')](_0x4d3ecb);}return _0x17db04[_0x38dc('0x1c')](_0x4d3ecb)['end']();};}function respondWithResult(_0x10f4cd,_0x171bc8){_0x171bc8=_0x171bc8||0xc8;return function(_0x143d0f){if(_0x143d0f){return _0x10f4cd['status'](_0x171bc8)[_0x38dc('0x1d')](_0x143d0f);}};}function respondWithFilteredResult(_0x2b3cdd,_0x111bde){return function(_0x555c08){if(_0x555c08){var _0x3c0e40=typeof _0x111bde['offset']==='undefined'&&typeof _0x111bde[_0x38dc('0x1e')]==='undefined';var _0x44843b=_0x555c08[_0x38dc('0x1f')];var _0x4d23dd=_0x3c0e40?0x0:_0x111bde[_0x38dc('0x20')];var _0x11c813=_0x3c0e40?_0x555c08[_0x38dc('0x1f')]:_0x111bde[_0x38dc('0x20')]+_0x111bde[_0x38dc('0x1e')];var _0x10ca7b;if(_0x11c813>=_0x44843b){_0x11c813=_0x44843b;_0x10ca7b=0xc8;}else{_0x10ca7b=0xce;}_0x2b3cdd['status'](_0x10ca7b);return _0x2b3cdd[_0x38dc('0x21')]('Content-Range',_0x4d23dd+'-'+_0x11c813+'/'+_0x44843b)[_0x38dc('0x1d')](_0x555c08);}return null;};}function patchUpdates(_0x2de7a4){return function(_0x2d9e21){try{jsonpatch[_0x38dc('0x22')](_0x2d9e21,_0x2de7a4,!![]);}catch(_0x56cfbe){return BPromise[_0x38dc('0x23')](_0x56cfbe);}return _0x2d9e21[_0x38dc('0x24')]();};}function saveUpdates(_0x41746c,_0x31b420){return function(_0x4aa7d9){if(_0x4aa7d9){return _0x4aa7d9[_0x38dc('0x25')](_0x41746c)[_0x38dc('0x26')](function(_0x271a5e){return _0x271a5e;});}return null;};}function removeEntity(_0x2f1917,_0x353fc5){return function(_0x3218fd){if(_0x3218fd){return _0x3218fd[_0x38dc('0x27')]()[_0x38dc('0x26')](function(){var _0x12937d=_0x3218fd['get']({'plain':!![]});var _0x59a525='Sounds';return db[_0x38dc('0x28')][_0x38dc('0x27')]({'where':{'type':_0x59a525,'resourceId':_0x12937d['id']}})[_0x38dc('0x26')](function(){return _0x3218fd;});})[_0x38dc('0x26')](function(){_0x2f1917['status'](0xcc)[_0x38dc('0x29')]();});}};}function handleEntityNotFound(_0x95305b,_0x58f564){return function(_0xa3e4de){if(!_0xa3e4de){_0x95305b['sendStatus'](0x194);}return _0xa3e4de;};}function handleError(_0x48a8bb,_0x55f9b3){_0x55f9b3=_0x55f9b3||0x1f4;return function(_0x361b13){logger['error'](_0x361b13[_0x38dc('0x2a')]);if(_0x361b13[_0x38dc('0x2b')]){delete _0x361b13[_0x38dc('0x2b')];}_0x48a8bb[_0x38dc('0x1c')](_0x55f9b3)[_0x38dc('0x2c')](_0x361b13);};}exports[_0x38dc('0x2d')]=function(_0x5b959d,_0x50d55d){var _0x1b0528={},_0x73b71c={},_0x14cbad={'count':0x0,'rows':[]};var _0x55e36f=_[_0x38dc('0x2e')](db[_0x38dc('0x2f')][_0x38dc('0x30')],function(_0x5e257a){return{'name':_0x5e257a[_0x38dc('0x31')],'type':_0x5e257a[_0x38dc('0x32')][_0x38dc('0x33')]};});_0x73b71c[_0x38dc('0x34')]=_[_0x38dc('0x2e')](_0x55e36f,'name');_0x73b71c[_0x38dc('0x35')]=_[_0x38dc('0x36')](_0x5b959d['query']);_0x73b71c[_0x38dc('0x37')]=_[_0x38dc('0x38')](_0x73b71c[_0x38dc('0x34')],_0x73b71c[_0x38dc('0x35')]);_0x1b0528[_0x38dc('0x39')]=_[_0x38dc('0x38')](_0x73b71c[_0x38dc('0x34')],qs[_0x38dc('0x3a')](_0x5b959d['query'][_0x38dc('0x3a')]));_0x1b0528[_0x38dc('0x39')]=_0x1b0528[_0x38dc('0x39')][_0x38dc('0x3b')]?_0x1b0528[_0x38dc('0x39')]:_0x73b71c['model'];if(!_0x5b959d['query']['hasOwnProperty'](_0x38dc('0x3c'))){_0x1b0528[_0x38dc('0x1e')]=qs['limit'](_0x5b959d[_0x38dc('0x35')][_0x38dc('0x1e')]);_0x1b0528[_0x38dc('0x20')]=qs[_0x38dc('0x20')](_0x5b959d['query'][_0x38dc('0x20')]);}_0x1b0528[_0x38dc('0x3d')]=qs[_0x38dc('0x3e')](_0x5b959d['query'][_0x38dc('0x3e')]);_0x1b0528['where']=qs[_0x38dc('0x37')](_[_0x38dc('0x3f')](_0x5b959d[_0x38dc('0x35')],_0x73b71c[_0x38dc('0x37')]),_0x55e36f);if(_0x5b959d['query'][_0x38dc('0x40')]){_0x1b0528['where']=_[_0x38dc('0x41')](_0x1b0528['where'],{'$or':_[_0x38dc('0x2e')](_0x55e36f,function(_0x67d5db){if(_0x67d5db[_0x38dc('0x32')]!=='VIRTUAL'){var _0x2afad7={};_0x2afad7[_0x67d5db[_0x38dc('0x2b')]]={'$like':'%'+_0x5b959d[_0x38dc('0x35')][_0x38dc('0x40')]+'%'};return _0x2afad7;}})});}_0x1b0528=_[_0x38dc('0x41')]({},_0x1b0528,_0x5b959d['options']);var _0x3f003d={'where':_0x1b0528[_0x38dc('0x42')]};return db[_0x38dc('0x2f')]['count'](_0x3f003d)[_0x38dc('0x26')](function(_0x455787){_0x14cbad[_0x38dc('0x1f')]=_0x455787;if(_0x5b959d[_0x38dc('0x35')][_0x38dc('0x43')]){_0x1b0528[_0x38dc('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x1b0528);})[_0x38dc('0x26')](function(_0x5c5c1c){_0x14cbad[_0x38dc('0x45')]=_0x5c5c1c;return _0x14cbad;})[_0x38dc('0x26')](respondWithFilteredResult(_0x50d55d,_0x1b0528))[_0x38dc('0x46')](handleError(_0x50d55d,null));};exports[_0x38dc('0x47')]=function(_0x1bf544,_0xf0b709){var _0x59625b={'raw':!![],'where':{'id':_0x1bf544[_0x38dc('0x48')]['id']}},_0x5f4d83={};_0x5f4d83[_0x38dc('0x34')]=_[_0x38dc('0x36')](db[_0x38dc('0x2f')][_0x38dc('0x30')]);_0x5f4d83[_0x38dc('0x35')]=_[_0x38dc('0x36')](_0x1bf544[_0x38dc('0x35')]);_0x5f4d83['filters']=_[_0x38dc('0x38')](_0x5f4d83['model'],_0x5f4d83[_0x38dc('0x35')]);_0x59625b[_0x38dc('0x39')]=_[_0x38dc('0x38')](_0x5f4d83[_0x38dc('0x34')],qs[_0x38dc('0x3a')](_0x1bf544['query'][_0x38dc('0x3a')]));_0x59625b[_0x38dc('0x39')]=_0x59625b[_0x38dc('0x39')][_0x38dc('0x3b')]?_0x59625b[_0x38dc('0x39')]:_0x5f4d83[_0x38dc('0x34')];if(_0x1bf544[_0x38dc('0x35')][_0x38dc('0x43')]){_0x59625b[_0x38dc('0x44')]=[{'all':!![]}];}_0x59625b=_[_0x38dc('0x41')]({},_0x59625b,_0x1bf544[_0x38dc('0x49')]);return db['Sound'][_0x38dc('0x4a')](_0x59625b)['then'](handleEntityNotFound(_0xf0b709,null))['then'](respondWithResult(_0xf0b709,null))[_0x38dc('0x46')](handleError(_0xf0b709,null));};exports[_0x38dc('0x4b')]=function(_0x12bd50,_0x5a8af5,_0x1b82f5){return db['Sound']['find']({'where':{'id':_0x12bd50[_0x38dc('0x48')]['id']},'attributes':[_0x38dc('0x2b'),_0x38dc('0x4c'),'converted_format'],'raw':!![]})[_0x38dc('0x26')](handleEntityNotFound(_0x5a8af5,null))[_0x38dc('0x26')](function(_0x57764c){if(_0x57764c){if(!fs[_0x38dc('0x4d')](path[_0x38dc('0x4e')](config[_0x38dc('0x4f')],_0x38dc('0x50'),_0x57764c[_0x38dc('0x4c')]+'.'+_0x57764c[_0x38dc('0x51')]))){throw new db[(_0x38dc('0x52'))]['ValidationError'](_0x38dc('0x53'));}return _0x5a8af5[_0x38dc('0x4b')](path[_0x38dc('0x4e')](config['root'],_0x38dc('0x50'),util[_0x38dc('0x54')](_0x38dc('0x55'),_0x57764c[_0x38dc('0x4c')],_0x57764c[_0x38dc('0x51')])),util[_0x38dc('0x54')](_0x38dc('0x55'),_0x57764c['name'],_0x57764c['converted_format']));}return null;})[_0x38dc('0x46')](handleError(_0x5a8af5,null));};exports[_0x38dc('0x56')]=function(_0x21b7b4,_0x479595,_0x2e8a7e){var _0x25d691={'name':path[_0x38dc('0x57')](_0x21b7b4['file'][_0x38dc('0x58')],path[_0x38dc('0x59')](_0x21b7b4['file'][_0x38dc('0x58')])),'save_name':path['basename'](_0x21b7b4['file'][_0x38dc('0x5a')],path[_0x38dc('0x59')](_0x21b7b4[_0x38dc('0x5b')][_0x38dc('0x5a')])),'original_format':path[_0x38dc('0x59')](_0x21b7b4[_0x38dc('0x5b')][_0x38dc('0x58')])[_0x38dc('0x5c')](0x1),'converted_format':_0x38dc('0x5d')};var _0x3fb34c=path[_0x38dc('0x4e')](config['root'],_0x38dc('0x5e'),_0x21b7b4[_0x38dc('0x5b')][_0x38dc('0x5a')]);var _0x7df2f1=path[_0x38dc('0x4e')](config[_0x38dc('0x4f')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x38dc('0x57')](_0x21b7b4[_0x38dc('0x5b')][_0x38dc('0x5a')],path[_0x38dc('0x59')](_0x21b7b4[_0x38dc('0x5b')][_0x38dc('0x5a')])),_0x25d691['converted_format']));logger[_0x38dc('0x5f')](_0x38dc('0x60'),_0x3fb34c);logger[_0x38dc('0x5f')](_0x38dc('0x61'),_0x7df2f1);try{fs[_0x38dc('0x62')](_0x3fb34c,parseInt(_0x38dc('0x63'),0x8));var _0xac5d9d=sox['transcode'](_0x3fb34c,_0x7df2f1,{'sampleRate':0x1f40,'format':_0x38dc('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xac5d9d['on'](_0x38dc('0x64'),function(_0x27e753){fs[_0x38dc('0x65')](_0x3fb34c);_0x479595[_0x38dc('0x1c')](0x1f4)[_0x38dc('0x2c')](_0x27e753);});_0xac5d9d['on']('src',function(_0x34f5aa){_0x25d691[_0x38dc('0x66')]=isNaN(_0x34f5aa['duration'])?null:_0x34f5aa[_0x38dc('0x67')]*0x3e8;_0x25d691[_0x38dc('0x68')]=isNaN(_0x34f5aa[_0x38dc('0x69')])?null:_0x34f5aa['sampleCount'];_0x25d691[_0x38dc('0x6a')]=isNaN(_0x34f5aa[_0x38dc('0x6b')])?null:_0x34f5aa[_0x38dc('0x6b')];_0x25d691[_0x38dc('0x6c')]=isNaN(_0x34f5aa['bitRate'])?null:_0x34f5aa['bitRate'];_0x25d691['original_sampleRate']=isNaN(_0x34f5aa[_0x38dc('0x6d')])?null:_0x34f5aa[_0x38dc('0x6d')];});_0xac5d9d['on'](_0x38dc('0x6e'),function(_0x54a140){_0x25d691[_0x38dc('0x6f')]=isNaN(_0x54a140[_0x38dc('0x67')])?null:_0x54a140['duration']*0x3e8;_0x25d691['converted_sampleCount']=isNaN(_0x54a140['sampleCount'])?null:_0x54a140[_0x38dc('0x69')];_0x25d691[_0x38dc('0x70')]=isNaN(_0x54a140['channelCount'])?null:_0x54a140[_0x38dc('0x6b')];_0x25d691['converted_bitRate']=isNaN(_0x54a140[_0x38dc('0x71')])?null:_0x54a140[_0x38dc('0x71')];_0x25d691[_0x38dc('0x72')]=isNaN(_0x54a140['sampleRate'])?null:_0x54a140[_0x38dc('0x6d')];});_0xac5d9d['on']('end',function(){fs[_0x38dc('0x62')](_0x7df2f1,parseInt(_0x38dc('0x63'),0x8));return db['Sound'][_0x38dc('0x56')](_0x25d691)[_0x38dc('0x26')](function(_0x60bf36){var _0x2c3f63={'role':_0x21b7b4[_0x38dc('0x73')][_0x38dc('0x74')],'userProfileId':_0x21b7b4[_0x38dc('0x73')][_0x38dc('0x75')]};if(!_0x2c3f63)throw new Error(_0x38dc('0x76'));if(_0x2c3f63['role']===_0x38dc('0x77')){var _0x5db809=_0x60bf36[_0x38dc('0x78')]({'plain':!![]});return db[_0x38dc('0x79')][_0x38dc('0x4a')]({'where':{'name':_0x38dc('0x7a'),'userProfileId':_0x2c3f63[_0x38dc('0x75')]},'raw':!![]})[_0x38dc('0x26')](function(_0x2491e0){if(_0x2491e0&&_0x2491e0[_0x38dc('0x7b')]===0x0){return db[_0x38dc('0x28')][_0x38dc('0x56')]({'name':_0x5db809[_0x38dc('0x2b')],'resourceId':_0x5db809['id'],'type':_0x2491e0[_0x38dc('0x2b')],'sectionId':_0x2491e0['id']},{})[_0x38dc('0x26')](function(){return _0x60bf36;});}else{return _0x60bf36;}})['catch'](function(_0x33e1a2){logger['error'](_0x38dc('0x7c'),_0x33e1a2);throw _0x33e1a2;});}return _0x60bf36;})['then'](respondWithResult(_0x479595,null))[_0x38dc('0x46')](handleError(_0x479595,null));});_0xac5d9d[_0x38dc('0x7d')]();}catch(_0x2b9abd){_0x479595['status'](0x1f4)[_0x38dc('0x2c')](_0x2b9abd);}};exports[_0x38dc('0x25')]=function(_0x3fa240,_0x50ba2e,_0x29f774){return db['Sound']['find']({'where':{'id':_0x3fa240['params']['id']}})[_0x38dc('0x26')](handleEntityNotFound(_0x50ba2e,null))[_0x38dc('0x26')](saveUpdates(_[_0x38dc('0x3f')](_0x3fa240[_0x38dc('0x73')],[_0x38dc('0x2b'),_0x38dc('0x7e')]),null))[_0x38dc('0x26')](respondWithResult(_0x50ba2e,null))[_0x38dc('0x46')](handleError(_0x50ba2e,null));};exports[_0x38dc('0x7f')]=function(_0x56b8f6,_0x1a73a4,_0x2d39f8){return db[_0x38dc('0x2f')][_0x38dc('0x4a')]({'where':{'id':_0x56b8f6[_0x38dc('0x48')]['id']}})[_0x38dc('0x26')](function(_0x513232){if(_0x513232){return _0x513232[_0x38dc('0x27')]();}})[_0x38dc('0x26')](function(_0xcd4f12){var _0x214074=path[_0x38dc('0x4e')](config[_0x38dc('0x4f')],_0x38dc('0x5e'),util[_0x38dc('0x54')](_0x38dc('0x55'),_0xcd4f12[_0x38dc('0x4c')],_0xcd4f12['original_format']));var _0x307f07=path['join'](config[_0x38dc('0x4f')],'server/files/sounds/converted',util[_0x38dc('0x54')](_0x38dc('0x55'),_0xcd4f12[_0x38dc('0x4c')],_0xcd4f12[_0x38dc('0x51')]));fs[_0x38dc('0x65')](_0x214074);fs[_0x38dc('0x65')](_0x307f07);return _0xcd4f12;})[_0x38dc('0x26')](function(_0xb41223){if(_0xb41223){return _0x1a73a4['status'](0xcc)['end']();}})[_0x38dc('0x26')](handleEntityNotFound(_0x1a73a4,null))[_0x38dc('0x46')](handleError(_0x1a73a4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a9be54a..d00aa5f 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 _0x7189=['rimraf','../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2a60fc,_0x2b1cf4){var _0x4dd1a6=function(_0x1fbab6){while(--_0x1fbab6){_0x2a60fc['push'](_0x2a60fc['shift']());}};_0x4dd1a6(++_0x2b1cf4);}(_0x7189,0x19c));var _0x9718=function(_0x58e29f,_0x475e63){_0x58e29f=_0x58e29f-0x0;var _0x32a7ab=_0x7189[_0x58e29f];return _0x32a7ab;};'use strict';var _=require(_0x9718('0x0'));var util=require(_0x9718('0x1'));var logger=require(_0x9718('0x2'))(_0x9718('0x3'));var moment=require(_0x9718('0x4'));var BPromise=require('bluebird');var rp=require(_0x9718('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9718('0x6'));var config=require(_0x9718('0x7'));var attributes=require(_0x9718('0x8'));module[_0x9718('0x9')]=function(_0x3b4923,_0x178e6a){return _0x3b4923['define']('Sound',attributes,{'tableName':_0x9718('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dbf=['moment','request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api'];(function(_0x43c5f1,_0x24aded){var _0x3662ff=function(_0x11638d){while(--_0x11638d){_0x43c5f1['push'](_0x43c5f1['shift']());}};_0x3662ff(++_0x24aded);}(_0x5dbf,0x8d));var _0xf5db=function(_0x4e54c8,_0x5a6cf6){_0x4e54c8=_0x4e54c8-0x0;var _0x51db4f=_0x5dbf[_0x4e54c8];return _0x51db4f;};'use strict';var _=require('lodash');var util=require(_0xf5db('0x0'));var logger=require(_0xf5db('0x1'))(_0xf5db('0x2'));var moment=require(_0xf5db('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5db('0x4'));var fs=require('fs');var path=require(_0xf5db('0x5'));var rimraf=require('rimraf');var config=require(_0xf5db('0x6'));var attributes=require(_0xf5db('0x7'));module[_0xf5db('0x8')]=function(_0x5998a6,_0x234842){return _0x5998a6[_0xf5db('0x9')](_0xf5db('0xa'),attributes,{'tableName':_0xf5db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index d386520..ed5bfb2 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 _0x126f=['../../config/environment','jayson/promise','client','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','Sound','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x126f,0x18e));var _0xf126=function(_0x49a0b9,_0x8201dd){_0x49a0b9=_0x49a0b9-0x0;var _0x457f3e=_0x126f[_0x49a0b9];return _0x457f3e;};'use strict';var _=require(_0xf126('0x0'));var util=require(_0xf126('0x1'));var moment=require(_0xf126('0x2'));var BPromise=require(_0xf126('0x3'));var rs=require(_0xf126('0x4'));var fs=require('fs');var Redis=require(_0xf126('0x5'));var db=require(_0xf126('0x6'))['db'];var utils=require(_0xf126('0x7'));var logger=require(_0xf126('0x8'))(_0xf126('0x9'));var config=require(_0xf126('0xa'));var jayson=require(_0xf126('0xb'));var client=jayson[_0xf126('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41e81e,_0x248806,_0x3ea797){return new BPromise(function(_0x4f05b1,_0x3a9194){return client[_0xf126('0xd')](_0x41e81e,_0x3ea797)[_0xf126('0xe')](function(_0x5efe08){logger[_0xf126('0xf')]('Sound,\x20%s,\x20%s',_0x248806,'request\x20sent');logger[_0xf126('0x10')](_0xf126('0x11'),_0x248806,_0xf126('0x12'),JSON[_0xf126('0x13')](_0x5efe08));if(_0x5efe08[_0xf126('0x14')]){if(_0x5efe08[_0xf126('0x14')][_0xf126('0x15')]===0x1f4){logger[_0xf126('0x14')](_0xf126('0x16'),_0x248806,_0x5efe08[_0xf126('0x14')]['message']);return _0x3a9194(_0x5efe08[_0xf126('0x14')][_0xf126('0x17')]);}logger['error'](_0xf126('0x16'),_0x248806,_0x5efe08['error'][_0xf126('0x17')]);return _0x4f05b1(_0x5efe08['error'][_0xf126('0x17')]);}else{logger[_0xf126('0xf')](_0xf126('0x16'),_0x248806,_0xf126('0x12'));_0x4f05b1(_0x5efe08[_0xf126('0x18')][_0xf126('0x17')]);}})['catch'](function(_0x509dcf){logger[_0xf126('0x14')]('Sound,\x20%s,\x20%s',_0x248806,_0x509dcf);_0x3a9194(_0x509dcf);});});}exports['ShowSound']=function(_0x319f52){var _0x4e1747=this;return new Promise(function(_0x310d0f,_0x5dd1ff){return db[_0xf126('0x19')]['find']({'raw':_0x319f52[_0xf126('0x1a')]?_0x319f52[_0xf126('0x1a')][_0xf126('0x1b')]===undefined?!![]:![]:!![],'where':_0x319f52['options']?_0x319f52[_0xf126('0x1a')][_0xf126('0x1c')]||null:null,'attributes':_0x319f52['options']?_0x319f52[_0xf126('0x1a')][_0xf126('0x1d')]||null:null,'include':_0x319f52['options']?_0x319f52['options'][_0xf126('0x1e')]?_[_0xf126('0x1f')](_0x319f52[_0xf126('0x1a')][_0xf126('0x1e')],function(_0x189bd2){return{'model':db[_0x189bd2[_0xf126('0x20')]],'as':_0x189bd2['as'],'attributes':_0x189bd2['attributes'],'include':_0x189bd2[_0xf126('0x1e')]?_[_0xf126('0x1f')](_0x189bd2[_0xf126('0x1e')],function(_0x3e9e9c){return{'model':db[_0x3e9e9c['model']],'as':_0x3e9e9c['as'],'attributes':_0x3e9e9c[_0xf126('0x1d')],'include':_0x3e9e9c[_0xf126('0x1e')]?_[_0xf126('0x1f')](_0x3e9e9c[_0xf126('0x1e')],function(_0x55d086){return{'model':db[_0x55d086[_0xf126('0x20')]],'as':_0x55d086['as'],'attributes':_0x55d086['attributes']};}):[]};}):[]};}):[]:[]})[_0xf126('0xe')](function(_0x6c064c){logger[_0xf126('0xf')](_0xf126('0x21'),_0x319f52);logger[_0xf126('0x10')](_0xf126('0x21'),_0x319f52,JSON[_0xf126('0x13')](_0x6c064c));_0x310d0f(_0x6c064c);})['catch'](function(_0x1294b1){logger[_0xf126('0x14')](_0xf126('0x21'),_0x1294b1[_0xf126('0x17')],_0x319f52);_0x5dd1ff(_0x4e1747['error'](0x1f4,_0x1294b1['message']));});});}; \ No newline at end of file +var _0xcd6f=['find','options','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','ShowSound','Sound'];(function(_0x153461,_0x2daf30){var _0x9791c8=function(_0x523ab5){while(--_0x523ab5){_0x153461['push'](_0x153461['shift']());}};_0x9791c8(++_0x2daf30);}(_0xcd6f,0x6b));var _0xfcd6=function(_0x253772,_0x3a98fe){_0x253772=_0x253772-0x0;var _0xfdf302=_0xcd6f[_0x253772];return _0xfdf302;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var moment=require(_0xfcd6('0x2'));var BPromise=require(_0xfcd6('0x3'));var rs=require(_0xfcd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcd6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcd6('0x6'))(_0xfcd6('0x7'));var config=require(_0xfcd6('0x8'));var jayson=require(_0xfcd6('0x9'));var client=jayson[_0xfcd6('0xa')][_0xfcd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58097e,_0x28dabb,_0x2d4aae){return new BPromise(function(_0x832261,_0x36658d){return client[_0xfcd6('0xc')](_0x58097e,_0x2d4aae)[_0xfcd6('0xd')](function(_0x5a8b90){logger[_0xfcd6('0xe')](_0xfcd6('0xf'),_0x28dabb,'request\x20sent');logger[_0xfcd6('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x28dabb,_0xfcd6('0x11'),JSON[_0xfcd6('0x12')](_0x5a8b90));if(_0x5a8b90[_0xfcd6('0x13')]){if(_0x5a8b90['error'][_0xfcd6('0x14')]===0x1f4){logger[_0xfcd6('0x13')](_0xfcd6('0xf'),_0x28dabb,_0x5a8b90[_0xfcd6('0x13')][_0xfcd6('0x15')]);return _0x36658d(_0x5a8b90[_0xfcd6('0x13')][_0xfcd6('0x15')]);}logger[_0xfcd6('0x13')](_0xfcd6('0xf'),_0x28dabb,_0x5a8b90[_0xfcd6('0x13')][_0xfcd6('0x15')]);return _0x832261(_0x5a8b90[_0xfcd6('0x13')][_0xfcd6('0x15')]);}else{logger[_0xfcd6('0xe')](_0xfcd6('0xf'),_0x28dabb,'request\x20sent');_0x832261(_0x5a8b90[_0xfcd6('0x16')][_0xfcd6('0x15')]);}})['catch'](function(_0x32ca92){logger[_0xfcd6('0x13')](_0xfcd6('0xf'),_0x28dabb,_0x32ca92);_0x36658d(_0x32ca92);});});}exports[_0xfcd6('0x17')]=function(_0x383112){var _0x483908=this;return new Promise(function(_0x5ca03c,_0x245f22){return db[_0xfcd6('0x18')][_0xfcd6('0x19')]({'raw':_0x383112[_0xfcd6('0x1a')]?_0x383112['options']['raw']===undefined?!![]:![]:!![],'where':_0x383112[_0xfcd6('0x1a')]?_0x383112[_0xfcd6('0x1a')][_0xfcd6('0x1b')]||null:null,'attributes':_0x383112[_0xfcd6('0x1a')]?_0x383112[_0xfcd6('0x1a')][_0xfcd6('0x1c')]||null:null,'include':_0x383112[_0xfcd6('0x1a')]?_0x383112[_0xfcd6('0x1a')]['include']?_['map'](_0x383112[_0xfcd6('0x1a')][_0xfcd6('0x1d')],function(_0x599284){return{'model':db[_0x599284[_0xfcd6('0x1e')]],'as':_0x599284['as'],'attributes':_0x599284[_0xfcd6('0x1c')],'include':_0x599284[_0xfcd6('0x1d')]?_[_0xfcd6('0x1f')](_0x599284['include'],function(_0x4bc5ff){return{'model':db[_0x4bc5ff[_0xfcd6('0x1e')]],'as':_0x4bc5ff['as'],'attributes':_0x4bc5ff[_0xfcd6('0x1c')],'include':_0x4bc5ff[_0xfcd6('0x1d')]?_[_0xfcd6('0x1f')](_0x4bc5ff[_0xfcd6('0x1d')],function(_0x1c434b){return{'model':db[_0x1c434b[_0xfcd6('0x1e')]],'as':_0x1c434b['as'],'attributes':_0x1c434b[_0xfcd6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfcd6('0xd')](function(_0x43f85e){logger[_0xfcd6('0xe')](_0xfcd6('0x17'),_0x383112);logger['debug'](_0xfcd6('0x17'),_0x383112,JSON['stringify'](_0x43f85e));_0x5ca03c(_0x43f85e);})[_0xfcd6('0x20')](function(_0xa904a1){logger['error'](_0xfcd6('0x17'),_0xa904a1['message'],_0x383112);_0x245f22(_0x483908[_0xfcd6('0x13')](0x1f4,_0xa904a1[_0xfcd6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 630bc31..dee4519 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a5e61,_0xf2cca5){_0x1a5e61=_0x1a5e61-0x0;var _0x56cef8=_0x4fc2[_0x1a5e61];return _0x56cef8;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0xe6f4e1,_0x3c46e1){var _0x4e1f15=function(_0x19f161){while(--_0x19f161){_0xe6f4e1['push'](_0xe6f4e1['shift']());}};_0x4e1f15(++_0x3c46e1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 920cca1..d83029c 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 _0xb4f0=['ENUM','out','exports','STRING','TEXT','medium'];(function(_0x49af15,_0x551d7c){var _0xd0c010=function(_0x23ee07){while(--_0x23ee07){_0x49af15['push'](_0x49af15['shift']());}};_0xd0c010(++_0x551d7c);}(_0xb4f0,0x1c4));var _0x0b4f=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xb4f0[_0x2eb5bc];return _0x51c7b1;};'use strict';var Sequelize=require('sequelize');module[_0x0b4f('0x0')]={'uniqueid':{'type':Sequelize[_0x0b4f('0x1')]},'body':{'type':Sequelize[_0x0b4f('0x2')](_0x0b4f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0b4f('0x4')]('in',_0x0b4f('0x5')),'defaultValue':_0x0b4f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc593=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xc593,0x15a));var _0x3c59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc593[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x3c59('0x0'));module[_0x3c59('0x1')]={'uniqueid':{'type':Sequelize[_0x3c59('0x2')]},'body':{'type':Sequelize[_0x3c59('0x3')](_0x3c59('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x3c59('0x5')]('in','out'),'defaultValue':_0x3c59('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3c59('0x2')]},'providerResponse':{'type':Sequelize[_0x3c59('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f7a004f..b1e5928 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 _0x14d8=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','rawAttributes','length','options','catch','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x14d8,0x87));var _0x814d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x14d8[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x814d('0x0'));var rimraf=require(_0x814d('0x1'));var zipdir=require(_0x814d('0x2'));var jsonpatch=require(_0x814d('0x3'));var rp=require(_0x814d('0x4'));var moment=require(_0x814d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x814d('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x814d('0x7'));var ejs=require(_0x814d('0x8'));var fs=require('fs');var fs_extra=require(_0x814d('0x9'));var _=require('lodash');var squel=require(_0x814d('0xa'));var crypto=require(_0x814d('0xb'));var jsforce=require(_0x814d('0xc'));var deskjs=require(_0x814d('0xd'));var toCsv=require(_0x814d('0x7'));var querystring=require(_0x814d('0xe'));var Papa=require(_0x814d('0xf'));var Redis=require('ioredis');var authService=require(_0x814d('0x10'));var qs=require(_0x814d('0x11'));var as=require(_0x814d('0x12'));var hardwareService=require(_0x814d('0x13'));var logger=require(_0x814d('0x14'))(_0x814d('0x15'));var utils=require(_0x814d('0x16'));var config=require(_0x814d('0x17'));var licenseUtil=require(_0x814d('0x18'));var db=require(_0x814d('0x19'))['db'];function respondWithStatusCode(_0x13d604,_0x2b6d1d){_0x2b6d1d=_0x2b6d1d||0xcc;return function(_0x21116f){if(_0x21116f){return _0x13d604[_0x814d('0x1a')](_0x2b6d1d);}return _0x13d604['status'](_0x2b6d1d)[_0x814d('0x1b')]();};}function respondWithResult(_0x37b123,_0x19d338){_0x19d338=_0x19d338||0xc8;return function(_0x4ded99){if(_0x4ded99){return _0x37b123[_0x814d('0x1c')](_0x19d338)[_0x814d('0x1d')](_0x4ded99);}};}function respondWithFilteredResult(_0x3a3834,_0xd4e77b){return function(_0x19ccd8){if(_0x19ccd8){var _0x2b6518=typeof _0xd4e77b['offset']===_0x814d('0x1e')&&typeof _0xd4e77b[_0x814d('0x1f')]===_0x814d('0x1e');var _0x57ccaa=_0x19ccd8[_0x814d('0x20')];var _0x2e7def=_0x2b6518?0x0:_0xd4e77b['offset'];var _0x18aa84=_0x2b6518?_0x19ccd8[_0x814d('0x20')]:_0xd4e77b[_0x814d('0x21')]+_0xd4e77b['limit'];var _0x3634fe;if(_0x18aa84>=_0x57ccaa){_0x18aa84=_0x57ccaa;_0x3634fe=0xc8;}else{_0x3634fe=0xce;}_0x3a3834[_0x814d('0x1c')](_0x3634fe);return _0x3a3834[_0x814d('0x22')](_0x814d('0x23'),_0x2e7def+'-'+_0x18aa84+'/'+_0x57ccaa)[_0x814d('0x1d')](_0x19ccd8);}return null;};}function patchUpdates(_0x24387c){return function(_0x16be40){try{jsonpatch['apply'](_0x16be40,_0x24387c,!![]);}catch(_0x1be432){return BPromise[_0x814d('0x24')](_0x1be432);}return _0x16be40[_0x814d('0x25')]();};}function saveUpdates(_0x441d47,_0x540a67){return function(_0x526be1){if(_0x526be1){return _0x526be1[_0x814d('0x26')](_0x441d47)[_0x814d('0x27')](function(_0x376c31){return _0x376c31;});}return null;};}function removeEntity(_0x26d998,_0xfc1f7b){return function(_0x486dcd){if(_0x486dcd){return _0x486dcd[_0x814d('0x28')]()[_0x814d('0x27')](function(){_0x26d998[_0x814d('0x1c')](0xcc)[_0x814d('0x1b')]();});}};}function handleEntityNotFound(_0x56e809,_0x31855c){return function(_0x4d0b06){if(!_0x4d0b06){_0x56e809['sendStatus'](0x194);}return _0x4d0b06;};}function handleError(_0x5007d9,_0x50a9e8){_0x50a9e8=_0x50a9e8||0x1f4;return function(_0x14a5e3){logger[_0x814d('0x29')](_0x14a5e3[_0x814d('0x2a')]);if(_0x14a5e3[_0x814d('0x2b')]){delete _0x14a5e3['name'];}_0x5007d9[_0x814d('0x1c')](_0x50a9e8)['send'](_0x14a5e3);};}exports[_0x814d('0x2c')]=function(_0x387acb,_0x23c9ab){var _0x3522ae={},_0x1cf59b={},_0x3d0669={'count':0x0,'rows':[]};var _0x26e041=_[_0x814d('0x2d')](db[_0x814d('0x2e')]['rawAttributes'],function(_0xc5e4be){return{'name':_0xc5e4be[_0x814d('0x2f')],'type':_0xc5e4be['type'][_0x814d('0x30')]};});_0x1cf59b[_0x814d('0x31')]=_['map'](_0x26e041,'name');_0x1cf59b[_0x814d('0x32')]=_[_0x814d('0x33')](_0x387acb['query']);_0x1cf59b['filters']=_[_0x814d('0x34')](_0x1cf59b[_0x814d('0x31')],_0x1cf59b[_0x814d('0x32')]);_0x3522ae[_0x814d('0x35')]=_['intersection'](_0x1cf59b[_0x814d('0x31')],qs[_0x814d('0x36')](_0x387acb[_0x814d('0x32')][_0x814d('0x36')]));_0x3522ae[_0x814d('0x35')]=_0x3522ae[_0x814d('0x35')]['length']?_0x3522ae['attributes']:_0x1cf59b['model'];if(!_0x387acb[_0x814d('0x32')][_0x814d('0x37')](_0x814d('0x38'))){_0x3522ae[_0x814d('0x1f')]=qs[_0x814d('0x1f')](_0x387acb[_0x814d('0x32')][_0x814d('0x1f')]);_0x3522ae[_0x814d('0x21')]=qs[_0x814d('0x21')](_0x387acb[_0x814d('0x32')][_0x814d('0x21')]);}_0x3522ae[_0x814d('0x39')]=qs[_0x814d('0x3a')](_0x387acb[_0x814d('0x32')][_0x814d('0x3a')]);_0x3522ae['where']=qs[_0x814d('0x3b')](_[_0x814d('0x3c')](_0x387acb[_0x814d('0x32')],_0x1cf59b[_0x814d('0x3b')]),_0x26e041);if(_0x387acb[_0x814d('0x32')][_0x814d('0x3d')]){_0x3522ae[_0x814d('0x3e')]=_[_0x814d('0x3f')](_0x3522ae[_0x814d('0x3e')],{'$or':_[_0x814d('0x2d')](_0x26e041,function(_0x1e6502){if(_0x1e6502[_0x814d('0x40')]!==_0x814d('0x41')){var _0x30b278={};_0x30b278[_0x1e6502['name']]={'$like':'%'+_0x387acb[_0x814d('0x32')][_0x814d('0x3d')]+'%'};return _0x30b278;}})});}_0x3522ae=_[_0x814d('0x3f')]({},_0x3522ae,_0x387acb['options']);var _0x43ff0d={'where':_0x3522ae[_0x814d('0x3e')]};return db[_0x814d('0x2e')]['count'](_0x43ff0d)[_0x814d('0x27')](function(_0x2dd467){_0x3d0669[_0x814d('0x20')]=_0x2dd467;if(_0x387acb['query'][_0x814d('0x42')]){_0x3522ae[_0x814d('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0x814d('0x44')](_0x3522ae);})[_0x814d('0x27')](function(_0x5db021){_0x3d0669[_0x814d('0x45')]=_0x5db021;return _0x3d0669;})[_0x814d('0x27')](respondWithFilteredResult(_0x23c9ab,_0x3522ae))['catch'](handleError(_0x23c9ab,null));};exports[_0x814d('0x46')]=function(_0x1f6713,_0x1435bc){var _0x370d7d={'raw':!![],'where':{'id':_0x1f6713['params']['id']}},_0x3fc827={};_0x3fc827[_0x814d('0x31')]=_[_0x814d('0x33')](db['SquareMessage'][_0x814d('0x47')]);_0x3fc827[_0x814d('0x32')]=_[_0x814d('0x33')](_0x1f6713['query']);_0x3fc827[_0x814d('0x3b')]=_['intersection'](_0x3fc827[_0x814d('0x31')],_0x3fc827[_0x814d('0x32')]);_0x370d7d[_0x814d('0x35')]=_[_0x814d('0x34')](_0x3fc827[_0x814d('0x31')],qs[_0x814d('0x36')](_0x1f6713[_0x814d('0x32')][_0x814d('0x36')]));_0x370d7d['attributes']=_0x370d7d['attributes'][_0x814d('0x48')]?_0x370d7d[_0x814d('0x35')]:_0x3fc827[_0x814d('0x31')];if(_0x1f6713[_0x814d('0x32')][_0x814d('0x42')]){_0x370d7d['include']=[{'all':!![]}];}_0x370d7d=_[_0x814d('0x3f')]({},_0x370d7d,_0x1f6713[_0x814d('0x49')]);return db['SquareMessage']['find'](_0x370d7d)['then'](handleEntityNotFound(_0x1435bc,null))[_0x814d('0x27')](respondWithResult(_0x1435bc,null))[_0x814d('0x4a')](handleError(_0x1435bc,null));};exports[_0x814d('0x4b')]=function(_0x32c441,_0x5bc8ee){return db[_0x814d('0x2e')]['create'](_0x32c441[_0x814d('0x4c')],{})['then'](respondWithResult(_0x5bc8ee,0xc9))[_0x814d('0x4a')](handleError(_0x5bc8ee,null));};exports[_0x814d('0x26')]=function(_0x49c8d4,_0x26bd56){if(_0x49c8d4[_0x814d('0x4c')]['id']){delete _0x49c8d4[_0x814d('0x4c')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x49c8d4[_0x814d('0x4d')]['id']}})[_0x814d('0x27')](handleEntityNotFound(_0x26bd56,null))[_0x814d('0x27')](saveUpdates(_0x49c8d4['body'],null))['then'](respondWithResult(_0x26bd56,null))[_0x814d('0x4a')](handleError(_0x26bd56,null));};exports[_0x814d('0x28')]=function(_0x5730fe,_0x129339){return db[_0x814d('0x2e')][_0x814d('0x4e')]({'where':{'id':_0x5730fe[_0x814d('0x4d')]['id']}})[_0x814d('0x27')](handleEntityNotFound(_0x129339,null))[_0x814d('0x27')](removeEntity(_0x129339,null))[_0x814d('0x4a')](handleError(_0x129339,null));}; \ No newline at end of file +var _0x5f4d=['body','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x5f4d,0x91));var _0xd5f4=function(_0xaf08f2,_0x12f3c9){_0xaf08f2=_0xaf08f2-0x0;var _0xd2510a=_0x5f4d[_0xaf08f2];return _0xd2510a;};'use strict';var emlformat=require(_0xd5f4('0x0'));var rimraf=require(_0xd5f4('0x1'));var zipdir=require(_0xd5f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5f4('0x3'));var moment=require(_0xd5f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd5f4('0x5'));var path=require('path');var sox=require(_0xd5f4('0x6'));var csv=require(_0xd5f4('0x7'));var ejs=require(_0xd5f4('0x8'));var fs=require('fs');var fs_extra=require(_0xd5f4('0x9'));var _=require(_0xd5f4('0xa'));var squel=require(_0xd5f4('0xb'));var crypto=require(_0xd5f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd5f4('0xd'));var toCsv=require(_0xd5f4('0x7'));var querystring=require(_0xd5f4('0xe'));var Papa=require(_0xd5f4('0xf'));var Redis=require('ioredis');var authService=require(_0xd5f4('0x10'));var qs=require(_0xd5f4('0x11'));var as=require(_0xd5f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5f4('0x13'))(_0xd5f4('0x14'));var utils=require(_0xd5f4('0x15'));var config=require(_0xd5f4('0x16'));var licenseUtil=require(_0xd5f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f551,_0x42b25d){_0x42b25d=_0x42b25d||0xcc;return function(_0x2c1ec1){if(_0x2c1ec1){return _0x23f551[_0xd5f4('0x18')](_0x42b25d);}return _0x23f551[_0xd5f4('0x19')](_0x42b25d)['end']();};}function respondWithResult(_0x503909,_0x46f403){_0x46f403=_0x46f403||0xc8;return function(_0x1273b6){if(_0x1273b6){return _0x503909[_0xd5f4('0x19')](_0x46f403)[_0xd5f4('0x1a')](_0x1273b6);}};}function respondWithFilteredResult(_0xf2ac4d,_0x277f8e){return function(_0x1082ea){if(_0x1082ea){var _0x4dca10=typeof _0x277f8e[_0xd5f4('0x1b')]==='undefined'&&typeof _0x277f8e[_0xd5f4('0x1c')]==='undefined';var _0x4b9fcf=_0x1082ea[_0xd5f4('0x1d')];var _0x5845b7=_0x4dca10?0x0:_0x277f8e['offset'];var _0x17a9ad=_0x4dca10?_0x1082ea['count']:_0x277f8e[_0xd5f4('0x1b')]+_0x277f8e[_0xd5f4('0x1c')];var _0x33b7d3;if(_0x17a9ad>=_0x4b9fcf){_0x17a9ad=_0x4b9fcf;_0x33b7d3=0xc8;}else{_0x33b7d3=0xce;}_0xf2ac4d['status'](_0x33b7d3);return _0xf2ac4d[_0xd5f4('0x1e')](_0xd5f4('0x1f'),_0x5845b7+'-'+_0x17a9ad+'/'+_0x4b9fcf)[_0xd5f4('0x1a')](_0x1082ea);}return null;};}function patchUpdates(_0xe86d89){return function(_0x164552){try{jsonpatch['apply'](_0x164552,_0xe86d89,!![]);}catch(_0x187177){return BPromise[_0xd5f4('0x20')](_0x187177);}return _0x164552[_0xd5f4('0x21')]();};}function saveUpdates(_0x3b1560,_0xab182c){return function(_0x265299){if(_0x265299){return _0x265299[_0xd5f4('0x22')](_0x3b1560)[_0xd5f4('0x23')](function(_0x5e43b7){return _0x5e43b7;});}return null;};}function removeEntity(_0x1e601e,_0x1356a5){return function(_0x5cd927){if(_0x5cd927){return _0x5cd927['destroy']()['then'](function(){_0x1e601e['status'](0xcc)[_0xd5f4('0x24')]();});}};}function handleEntityNotFound(_0x7e1494,_0x29f9e4){return function(_0x1b811c){if(!_0x1b811c){_0x7e1494[_0xd5f4('0x18')](0x194);}return _0x1b811c;};}function handleError(_0x247e92,_0x471dd6){_0x471dd6=_0x471dd6||0x1f4;return function(_0x58fd9c){logger[_0xd5f4('0x25')](_0x58fd9c[_0xd5f4('0x26')]);if(_0x58fd9c[_0xd5f4('0x27')]){delete _0x58fd9c[_0xd5f4('0x27')];}_0x247e92[_0xd5f4('0x19')](_0x471dd6)[_0xd5f4('0x28')](_0x58fd9c);};}exports[_0xd5f4('0x29')]=function(_0x16223c,_0x53fb69){var _0x2bf553={},_0x4e3742={},_0x3e10ff={'count':0x0,'rows':[]};var _0x114023=_[_0xd5f4('0x2a')](db[_0xd5f4('0x2b')][_0xd5f4('0x2c')],function(_0x36ba7c){return{'name':_0x36ba7c[_0xd5f4('0x2d')],'type':_0x36ba7c['type'][_0xd5f4('0x2e')]};});_0x4e3742['model']=_[_0xd5f4('0x2a')](_0x114023,_0xd5f4('0x27'));_0x4e3742[_0xd5f4('0x2f')]=_[_0xd5f4('0x30')](_0x16223c[_0xd5f4('0x2f')]);_0x4e3742[_0xd5f4('0x31')]=_[_0xd5f4('0x32')](_0x4e3742[_0xd5f4('0x33')],_0x4e3742['query']);_0x2bf553[_0xd5f4('0x34')]=_[_0xd5f4('0x32')](_0x4e3742[_0xd5f4('0x33')],qs['fields'](_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x35')]));_0x2bf553[_0xd5f4('0x34')]=_0x2bf553[_0xd5f4('0x34')][_0xd5f4('0x36')]?_0x2bf553[_0xd5f4('0x34')]:_0x4e3742[_0xd5f4('0x33')];if(!_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x37')]('nolimit')){_0x2bf553['limit']=qs[_0xd5f4('0x1c')](_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x1c')]);_0x2bf553['offset']=qs[_0xd5f4('0x1b')](_0x16223c['query'][_0xd5f4('0x1b')]);}_0x2bf553[_0xd5f4('0x38')]=qs[_0xd5f4('0x39')](_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x39')]);_0x2bf553[_0xd5f4('0x3a')]=qs[_0xd5f4('0x31')](_[_0xd5f4('0x3b')](_0x16223c['query'],_0x4e3742[_0xd5f4('0x31')]),_0x114023);if(_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x3c')]){_0x2bf553['where']=_['merge'](_0x2bf553[_0xd5f4('0x3a')],{'$or':_['map'](_0x114023,function(_0x395044){if(_0x395044['type']!==_0xd5f4('0x3d')){var _0xe94da8={};_0xe94da8[_0x395044[_0xd5f4('0x27')]]={'$like':'%'+_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x3c')]+'%'};return _0xe94da8;}})});}_0x2bf553=_[_0xd5f4('0x3e')]({},_0x2bf553,_0x16223c[_0xd5f4('0x3f')]);var _0x3856cd={'where':_0x2bf553[_0xd5f4('0x3a')]};return db[_0xd5f4('0x2b')][_0xd5f4('0x1d')](_0x3856cd)[_0xd5f4('0x23')](function(_0xed93cf){_0x3e10ff[_0xd5f4('0x1d')]=_0xed93cf;if(_0x16223c[_0xd5f4('0x2f')][_0xd5f4('0x40')]){_0x2bf553[_0xd5f4('0x41')]=[{'all':!![]}];}return db[_0xd5f4('0x2b')]['findAll'](_0x2bf553);})[_0xd5f4('0x23')](function(_0x5c89ed){_0x3e10ff[_0xd5f4('0x42')]=_0x5c89ed;return _0x3e10ff;})[_0xd5f4('0x23')](respondWithFilteredResult(_0x53fb69,_0x2bf553))[_0xd5f4('0x43')](handleError(_0x53fb69,null));};exports['show']=function(_0x427ce1,_0xde04b3){var _0x2c829a={'raw':!![],'where':{'id':_0x427ce1[_0xd5f4('0x44')]['id']}},_0x4a7455={};_0x4a7455['model']=_[_0xd5f4('0x30')](db[_0xd5f4('0x2b')]['rawAttributes']);_0x4a7455[_0xd5f4('0x2f')]=_[_0xd5f4('0x30')](_0x427ce1[_0xd5f4('0x2f')]);_0x4a7455[_0xd5f4('0x31')]=_[_0xd5f4('0x32')](_0x4a7455[_0xd5f4('0x33')],_0x4a7455[_0xd5f4('0x2f')]);_0x2c829a['attributes']=_['intersection'](_0x4a7455[_0xd5f4('0x33')],qs[_0xd5f4('0x35')](_0x427ce1[_0xd5f4('0x2f')]['fields']));_0x2c829a[_0xd5f4('0x34')]=_0x2c829a['attributes'][_0xd5f4('0x36')]?_0x2c829a['attributes']:_0x4a7455['model'];if(_0x427ce1['query'][_0xd5f4('0x40')]){_0x2c829a['include']=[{'all':!![]}];}_0x2c829a=_['merge']({},_0x2c829a,_0x427ce1['options']);return db[_0xd5f4('0x2b')][_0xd5f4('0x45')](_0x2c829a)[_0xd5f4('0x23')](handleEntityNotFound(_0xde04b3,null))['then'](respondWithResult(_0xde04b3,null))[_0xd5f4('0x43')](handleError(_0xde04b3,null));};exports[_0xd5f4('0x46')]=function(_0x3bc05a,_0x21dc98){return db[_0xd5f4('0x2b')][_0xd5f4('0x46')](_0x3bc05a['body'],{})['then'](respondWithResult(_0x21dc98,0xc9))[_0xd5f4('0x43')](handleError(_0x21dc98,null));};exports['update']=function(_0x237ecd,_0x2de58e){if(_0x237ecd['body']['id']){delete _0x237ecd[_0xd5f4('0x47')]['id'];}return db['SquareMessage'][_0xd5f4('0x45')]({'where':{'id':_0x237ecd['params']['id']}})[_0xd5f4('0x23')](handleEntityNotFound(_0x2de58e,null))[_0xd5f4('0x23')](saveUpdates(_0x237ecd[_0xd5f4('0x47')],null))['then'](respondWithResult(_0x2de58e,null))[_0xd5f4('0x43')](handleError(_0x2de58e,null));};exports['destroy']=function(_0x523988,_0x51ffb9){return db[_0xd5f4('0x2b')]['find']({'where':{'id':_0x523988[_0xd5f4('0x44')]['id']}})[_0xd5f4('0x23')](handleEntityNotFound(_0x51ffb9,null))[_0xd5f4('0x23')](removeEntity(_0x51ffb9,null))['catch'](handleError(_0x51ffb9,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ef652dd..1666ae5 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 _0x3a69=['rimraf','./squareMessage.attributes','exports','define','square_messages','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x54b110,_0x28bd9d){var _0x28aae0=function(_0x15980f){while(--_0x15980f){_0x54b110['push'](_0x54b110['shift']());}};_0x28aae0(++_0x28bd9d);}(_0x3a69,0x9b));var _0x93a6=function(_0x2aa323,_0x1c492b){_0x2aa323=_0x2aa323-0x0;var _0x17fcab=_0x3a69[_0x2aa323];return _0x17fcab;};'use strict';var _=require(_0x93a6('0x0'));var util=require('util');var logger=require(_0x93a6('0x1'))(_0x93a6('0x2'));var moment=require('moment');var BPromise=require(_0x93a6('0x3'));var rp=require(_0x93a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93a6('0x5'));var config=require('../../config/environment');var attributes=require(_0x93a6('0x6'));module[_0x93a6('0x7')]=function(_0x1258b8,_0xf1c7a3){return _0x1258b8[_0x93a6('0x8')]('SquareMessage',attributes,{'tableName':_0x93a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b1=['bluebird','path','../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','util','../../config/logger','api','moment'];(function(_0x587f48,_0x2c1310){var _0x4fd9a5=function(_0x3690d3){while(--_0x3690d3){_0x587f48['push'](_0x587f48['shift']());}};_0x4fd9a5(++_0x2c1310);}(_0x72b1,0xa0));var _0x172b=function(_0x4ba14e,_0x3d8032){_0x4ba14e=_0x4ba14e-0x0;var _0xb1f4d4=_0x72b1[_0x4ba14e];return _0xb1f4d4;};'use strict';var _=require(_0x172b('0x0'));var util=require(_0x172b('0x1'));var logger=require(_0x172b('0x2'))(_0x172b('0x3'));var moment=require(_0x172b('0x4'));var BPromise=require(_0x172b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x172b('0x6'));var rimraf=require('rimraf');var config=require(_0x172b('0x7'));var attributes=require(_0x172b('0x8'));module['exports']=function(_0x29ea0f,_0x56c43d){return _0x29ea0f[_0x172b('0x9')](_0x172b('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index eb4d2e6..b4cfc79 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 _0x703d=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x703d,0x69));var _0xd703=function(_0x5ed4a8,_0x1cd519){_0x5ed4a8=_0x5ed4a8-0x0;var _0x26a0bf=_0x703d[_0x5ed4a8];return _0x26a0bf;};'use strict';var _=require(_0xd703('0x0'));var util=require('util');var moment=require(_0xd703('0x1'));var BPromise=require(_0xd703('0x2'));var rs=require(_0xd703('0x3'));var fs=require('fs');var Redis=require(_0xd703('0x4'));var db=require(_0xd703('0x5'))['db'];var utils=require(_0xd703('0x6'));var logger=require(_0xd703('0x7'))(_0xd703('0x8'));var config=require(_0xd703('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd703('0xa')][_0xd703('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15270,_0x52701c,_0x44291b){return new BPromise(function(_0x56e411,_0x41f02b){return client[_0xd703('0xc')](_0x15270,_0x44291b)[_0xd703('0xd')](function(_0x3e8f58){logger[_0xd703('0xe')](_0xd703('0xf'),_0x52701c,_0xd703('0x10'));logger[_0xd703('0x11')](_0xd703('0x12'),_0x52701c,'request\x20sent',JSON[_0xd703('0x13')](_0x3e8f58));if(_0x3e8f58[_0xd703('0x14')]){if(_0x3e8f58[_0xd703('0x14')][_0xd703('0x15')]===0x1f4){logger[_0xd703('0x14')](_0xd703('0xf'),_0x52701c,_0x3e8f58[_0xd703('0x14')]['message']);return _0x41f02b(_0x3e8f58['error'][_0xd703('0x16')]);}logger[_0xd703('0x14')](_0xd703('0xf'),_0x52701c,_0x3e8f58[_0xd703('0x14')][_0xd703('0x16')]);return _0x56e411(_0x3e8f58[_0xd703('0x14')][_0xd703('0x16')]);}else{logger[_0xd703('0xe')](_0xd703('0xf'),_0x52701c,_0xd703('0x10'));_0x56e411(_0x3e8f58['result'][_0xd703('0x16')]);}})[_0xd703('0x17')](function(_0x13accd){logger[_0xd703('0x14')](_0xd703('0xf'),_0x52701c,_0x13accd);_0x41f02b(_0x13accd);});});}exports[_0xd703('0x18')]=function(_0x51b3e9){var _0x461451=this;return new Promise(function(_0x1fc09a,_0x4237d3){return db['SquareMessage']['create'](_0x51b3e9[_0xd703('0x19')],{'raw':_0x51b3e9[_0xd703('0x1a')]?_0x51b3e9[_0xd703('0x1a')][_0xd703('0x1b')]===undefined?!![]:![]:!![]})[_0xd703('0xd')](function(_0x140368){logger[_0xd703('0xe')](_0xd703('0x18'),_0x51b3e9);logger[_0xd703('0x11')](_0xd703('0x18'),_0x51b3e9,JSON[_0xd703('0x13')](_0x140368));_0x1fc09a(_0x140368);})[_0xd703('0x17')](function(_0x38d997){logger[_0xd703('0x14')](_0xd703('0x18'),_0x38d997['message'],_0x51b3e9);_0x4237d3(_0x461451[_0xd703('0x14')](0x1f4,_0x38d997[_0xd703('0x16')]));});});}; \ No newline at end of file +var _0xfd94=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','bluebird'];(function(_0x1c2c48,_0x21760c){var _0x21c607=function(_0x143a67){while(--_0x143a67){_0x1c2c48['push'](_0x1c2c48['shift']());}};_0x21c607(++_0x21760c);}(_0xfd94,0x8b));var _0x4fd9=function(_0x463dfd,_0x4d92a3){_0x463dfd=_0x463dfd-0x0;var _0xc434ee=_0xfd94[_0x463dfd];return _0xc434ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4fd9('0x0'));var rs=require(_0x4fd9('0x1'));var fs=require('fs');var Redis=require(_0x4fd9('0x2'));var db=require(_0x4fd9('0x3'))['db'];var utils=require(_0x4fd9('0x4'));var logger=require(_0x4fd9('0x5'))('rpc');var config=require(_0x4fd9('0x6'));var jayson=require(_0x4fd9('0x7'));var client=jayson[_0x4fd9('0x8')][_0x4fd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x574302,_0x30f202,_0x4ed13d){return new BPromise(function(_0x3ad9c4,_0x49cfbe){return client[_0x4fd9('0xa')](_0x574302,_0x4ed13d)[_0x4fd9('0xb')](function(_0x410759){logger[_0x4fd9('0xc')]('SquareMessage,\x20%s,\x20%s',_0x30f202,_0x4fd9('0xd'));logger[_0x4fd9('0xe')](_0x4fd9('0xf'),_0x30f202,_0x4fd9('0xd'),JSON[_0x4fd9('0x10')](_0x410759));if(_0x410759['error']){if(_0x410759[_0x4fd9('0x11')][_0x4fd9('0x12')]===0x1f4){logger[_0x4fd9('0x11')](_0x4fd9('0x13'),_0x30f202,_0x410759[_0x4fd9('0x11')]['message']);return _0x49cfbe(_0x410759[_0x4fd9('0x11')][_0x4fd9('0x14')]);}logger[_0x4fd9('0x11')](_0x4fd9('0x13'),_0x30f202,_0x410759[_0x4fd9('0x11')][_0x4fd9('0x14')]);return _0x3ad9c4(_0x410759[_0x4fd9('0x11')][_0x4fd9('0x14')]);}else{logger[_0x4fd9('0xc')]('SquareMessage,\x20%s,\x20%s',_0x30f202,_0x4fd9('0xd'));_0x3ad9c4(_0x410759['result'][_0x4fd9('0x14')]);}})[_0x4fd9('0x15')](function(_0x2f4eb9){logger[_0x4fd9('0x11')](_0x4fd9('0x13'),_0x30f202,_0x2f4eb9);_0x49cfbe(_0x2f4eb9);});});}exports[_0x4fd9('0x16')]=function(_0xe8f15f){var _0x2b7969=this;return new Promise(function(_0x3bc136,_0x14fe49){return db[_0x4fd9('0x17')][_0x4fd9('0x18')](_0xe8f15f[_0x4fd9('0x19')],{'raw':_0xe8f15f[_0x4fd9('0x1a')]?_0xe8f15f[_0x4fd9('0x1a')][_0x4fd9('0x1b')]===undefined?!![]:![]:!![]})[_0x4fd9('0xb')](function(_0x148ca4){logger[_0x4fd9('0xc')]('CreateSquareMessage',_0xe8f15f);logger[_0x4fd9('0xe')]('CreateSquareMessage',_0xe8f15f,JSON[_0x4fd9('0x10')](_0x148ca4));_0x3bc136(_0x148ca4);})['catch'](function(_0x495f76){logger[_0x4fd9('0x11')](_0x4fd9('0x16'),_0x495f76['message'],_0xe8f15f);_0x14fe49(_0x2b7969['error'](0x1f4,_0x495f76[_0x4fd9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e2a3077..4017f7d 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 _0xf223=['isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x39c9f2,_0x56b55f){var _0x3e5a71=function(_0x424f2f){while(--_0x424f2f){_0x39c9f2['push'](_0x39c9f2['shift']());}};_0x3e5a71(++_0x56b55f);}(_0xf223,0x115));var _0x3f22=function(_0x1dcccf,_0x11f94f){_0x1dcccf=_0x1dcccf-0x0;var _0x321d8e=_0xf223[_0x1dcccf];return _0x321d8e;};'use strict';var multer=require('multer');var util=require(_0x3f22('0x0'));var path=require(_0x3f22('0x1'));var timeout=require(_0x3f22('0x2'));var express=require(_0x3f22('0x3'));var router=express[_0x3f22('0x4')]();var fs_extra=require(_0x3f22('0x5'));var auth=require(_0x3f22('0x6'));var interaction=require(_0x3f22('0x7'));var config=require(_0x3f22('0x8'));var controller=require(_0x3f22('0x9'));router[_0x3f22('0xa')]('/',auth[_0x3f22('0xb')](),controller['index']);router[_0x3f22('0xa')](_0x3f22('0xc'),auth[_0x3f22('0xb')](),controller[_0x3f22('0xd')]);router[_0x3f22('0xa')](_0x3f22('0xe'),auth[_0x3f22('0xb')](),timeout(_0x3f22('0xf')),controller[_0x3f22('0x10')]);router[_0x3f22('0x11')]('/',auth[_0x3f22('0xb')](),controller[_0x3f22('0x12')]);router[_0x3f22('0x13')]('/:id',auth[_0x3f22('0xb')](),controller[_0x3f22('0x14')]);router[_0x3f22('0x15')]('/:id',auth[_0x3f22('0xb')](),controller[_0x3f22('0x16')]);module[_0x3f22('0x17')]=router; \ No newline at end of file +var _0xa55a=['destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','15s','test','post','create','update','delete'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xa55a,0x7f));var _0xaa55=function(_0x12dbc4,_0x49d2de){_0x12dbc4=_0x12dbc4-0x0;var _0x54a850=_0xa55a[_0x12dbc4];return _0x54a850;};'use strict';var multer=require('multer');var util=require(_0xaa55('0x0'));var path=require('path');var timeout=require(_0xaa55('0x1'));var express=require(_0xaa55('0x2'));var router=express[_0xaa55('0x3')]();var fs_extra=require(_0xaa55('0x4'));var auth=require(_0xaa55('0x5'));var interaction=require(_0xaa55('0x6'));var config=require(_0xaa55('0x7'));var controller=require(_0xaa55('0x8'));router[_0xaa55('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa55('0xa')]);router['get'](_0xaa55('0xb'),auth[_0xaa55('0xc')](),controller[_0xaa55('0xd')]);router[_0xaa55('0x9')]('/:id/test',auth[_0xaa55('0xc')](),timeout(_0xaa55('0xe')),controller[_0xaa55('0xf')]);router[_0xaa55('0x10')]('/',auth[_0xaa55('0xc')](),controller[_0xaa55('0x11')]);router['put'](_0xaa55('0xb'),auth[_0xaa55('0xc')](),controller[_0xaa55('0x12')]);router[_0xaa55('0x13')](_0xaa55('0xb'),auth[_0xaa55('0xc')](),controller[_0xaa55('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index fd4264f..2add623 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 _0xe6c1=['exports','STRING','name','sequelize'];(function(_0x5d819e,_0x580967){var _0x13bde2=function(_0x5c9ecb){while(--_0x5c9ecb){_0x5d819e['push'](_0x5d819e['shift']());}};_0x13bde2(++_0x580967);}(_0xe6c1,0x173));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1e6c('0x0'));module[_0x1e6c('0x1')]={'name':{'type':Sequelize[_0x1e6c('0x2')],'unique':_0x1e6c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1e6c('0x2')]},'description':{'type':Sequelize[_0x1e6c('0x2')]}}; \ No newline at end of file +var _0x9fa8=['sequelize','name','STRING'];(function(_0x86271d,_0x2ccd0f){var _0x135777=function(_0x224373){while(--_0x224373){_0x86271d['push'](_0x86271d['shift']());}};_0x135777(++_0x2ccd0f);}(_0x9fa8,0xc9));var _0x89fa=function(_0x26b730,_0x408d19){_0x26b730=_0x26b730-0x0;var _0x548987=_0x9fa8[_0x26b730];return _0x548987;};'use strict';var Sequelize=require(_0x89fa('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x89fa('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x89fa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 33e6ae4..4c643b6 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 _0xb68c=['fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','then','destroy','get','ODBC','end','error','stack','name','send','index','SquareOdbc'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb68c,0x1cc));var _0xcb68=function(_0x47fabe,_0x592302){_0x47fabe=_0x47fabe-0x0;var _0x217c68=_0xb68c[_0x47fabe];return _0x217c68;};'use strict';var emlformat=require(_0xcb68('0x0'));var rimraf=require(_0xcb68('0x1'));var zipdir=require(_0xcb68('0x2'));var jsonpatch=require(_0xcb68('0x3'));var rp=require('request-promise');var moment=require(_0xcb68('0x4'));var BPromise=require(_0xcb68('0x5'));var Mustache=require(_0xcb68('0x6'));var util=require(_0xcb68('0x7'));var path=require(_0xcb68('0x8'));var sox=require(_0xcb68('0x9'));var csv=require(_0xcb68('0xa'));var ejs=require(_0xcb68('0xb'));var fs=require('fs');var fs_extra=require(_0xcb68('0xc'));var _=require(_0xcb68('0xd'));var squel=require('squel');var crypto=require(_0xcb68('0xe'));var jsforce=require(_0xcb68('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcb68('0xa'));var querystring=require(_0xcb68('0x10'));var Papa=require(_0xcb68('0x11'));var Redis=require(_0xcb68('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcb68('0x13'));var as=require(_0xcb68('0x14'));var hardwareService=require(_0xcb68('0x15'));var logger=require('../../config/logger')(_0xcb68('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120c23,_0x1d568c){_0x1d568c=_0x1d568c||0xcc;return function(_0x773c36){if(_0x773c36){return _0x120c23[_0xcb68('0x17')](_0x1d568c);}return _0x120c23[_0xcb68('0x18')](_0x1d568c)['end']();};}function respondWithResult(_0x21e1e3,_0x5720bd){_0x5720bd=_0x5720bd||0xc8;return function(_0x21935e){if(_0x21935e){return _0x21e1e3[_0xcb68('0x18')](_0x5720bd)[_0xcb68('0x19')](_0x21935e);}};}function respondWithFilteredResult(_0x193400,_0xa81779){return function(_0x552e6a){if(_0x552e6a){var _0x1a88a6=typeof _0xa81779['offset']==='undefined'&&typeof _0xa81779['limit']===_0xcb68('0x1a');var _0x2acc18=_0x552e6a[_0xcb68('0x1b')];var _0x3a247d=_0x1a88a6?0x0:_0xa81779[_0xcb68('0x1c')];var _0x32c030=_0x1a88a6?_0x552e6a[_0xcb68('0x1b')]:_0xa81779['offset']+_0xa81779[_0xcb68('0x1d')];var _0x46f17d;if(_0x32c030>=_0x2acc18){_0x32c030=_0x2acc18;_0x46f17d=0xc8;}else{_0x46f17d=0xce;}_0x193400[_0xcb68('0x18')](_0x46f17d);return _0x193400[_0xcb68('0x1e')](_0xcb68('0x1f'),_0x3a247d+'-'+_0x32c030+'/'+_0x2acc18)['json'](_0x552e6a);}return null;};}function patchUpdates(_0x16659f){return function(_0x55d053){try{jsonpatch['apply'](_0x55d053,_0x16659f,!![]);}catch(_0x28bf91){return BPromise['reject'](_0x28bf91);}return _0x55d053[_0xcb68('0x20')]();};}function saveUpdates(_0x5d40cf,_0x1de84d){return function(_0x41a8c8){if(_0x41a8c8){return _0x41a8c8['update'](_0x5d40cf)[_0xcb68('0x21')](function(_0x327638){return _0x327638;});}return null;};}function removeEntity(_0x404d57,_0xb84a6b){return function(_0x458539){if(_0x458539){return _0x458539[_0xcb68('0x22')]()[_0xcb68('0x21')](function(){var _0x9c2180=_0x458539[_0xcb68('0x23')]({'plain':!![]});var _0x24b9c5=_0xcb68('0x24');return db['UserProfileResource'][_0xcb68('0x22')]({'where':{'type':_0x24b9c5,'resourceId':_0x9c2180['id']}})[_0xcb68('0x21')](function(){return _0x458539;});})['then'](function(){_0x404d57[_0xcb68('0x18')](0xcc)[_0xcb68('0x25')]();});}};}function handleEntityNotFound(_0x4ca2ab,_0x40cde6){return function(_0x2d4037){if(!_0x2d4037){_0x4ca2ab[_0xcb68('0x17')](0x194);}return _0x2d4037;};}function handleError(_0x5cc661,_0x4dc13f){_0x4dc13f=_0x4dc13f||0x1f4;return function(_0x3e2530){logger[_0xcb68('0x26')](_0x3e2530[_0xcb68('0x27')]);if(_0x3e2530[_0xcb68('0x28')]){delete _0x3e2530[_0xcb68('0x28')];}_0x5cc661[_0xcb68('0x18')](_0x4dc13f)[_0xcb68('0x29')](_0x3e2530);};}exports[_0xcb68('0x2a')]=function(_0x5c27fc,_0x300494){var _0x497c1b={},_0x418375={},_0x420e4a={'count':0x0,'rows':[]};var _0x1afdcc=_['map'](db[_0xcb68('0x2b')]['rawAttributes'],function(_0x2d9341){return{'name':_0x2d9341[_0xcb68('0x2c')],'type':_0x2d9341[_0xcb68('0x2d')][_0xcb68('0x2e')]};});_0x418375[_0xcb68('0x2f')]=_[_0xcb68('0x30')](_0x1afdcc,_0xcb68('0x28'));_0x418375[_0xcb68('0x31')]=_['keys'](_0x5c27fc[_0xcb68('0x31')]);_0x418375[_0xcb68('0x32')]=_[_0xcb68('0x33')](_0x418375[_0xcb68('0x2f')],_0x418375[_0xcb68('0x31')]);_0x497c1b[_0xcb68('0x34')]=_[_0xcb68('0x33')](_0x418375[_0xcb68('0x2f')],qs[_0xcb68('0x35')](_0x5c27fc[_0xcb68('0x31')][_0xcb68('0x35')]));_0x497c1b[_0xcb68('0x34')]=_0x497c1b['attributes'][_0xcb68('0x36')]?_0x497c1b['attributes']:_0x418375[_0xcb68('0x2f')];if(!_0x5c27fc['query']['hasOwnProperty']('nolimit')){_0x497c1b[_0xcb68('0x1d')]=qs[_0xcb68('0x1d')](_0x5c27fc['query'][_0xcb68('0x1d')]);_0x497c1b[_0xcb68('0x1c')]=qs['offset'](_0x5c27fc[_0xcb68('0x31')][_0xcb68('0x1c')]);}_0x497c1b['order']=qs[_0xcb68('0x37')](_0x5c27fc['query'][_0xcb68('0x37')]);_0x497c1b[_0xcb68('0x38')]=qs[_0xcb68('0x32')](_[_0xcb68('0x39')](_0x5c27fc[_0xcb68('0x31')],_0x418375[_0xcb68('0x32')]),_0x1afdcc);if(_0x5c27fc['query'][_0xcb68('0x3a')]){_0x497c1b['where']=_[_0xcb68('0x3b')](_0x497c1b[_0xcb68('0x38')],{'$or':_[_0xcb68('0x30')](_0x1afdcc,function(_0x28e9d4){if(_0x28e9d4[_0xcb68('0x2d')]!==_0xcb68('0x3c')){var _0x209296={};_0x209296[_0x28e9d4[_0xcb68('0x28')]]={'$like':'%'+_0x5c27fc[_0xcb68('0x31')]['filter']+'%'};return _0x209296;}})});}_0x497c1b=_[_0xcb68('0x3b')]({},_0x497c1b,_0x5c27fc[_0xcb68('0x3d')]);var _0x248e6a={'where':_0x497c1b[_0xcb68('0x38')]};return db[_0xcb68('0x2b')][_0xcb68('0x1b')](_0x248e6a)['then'](function(_0x51621b){_0x420e4a[_0xcb68('0x1b')]=_0x51621b;if(_0x5c27fc[_0xcb68('0x31')][_0xcb68('0x3e')]){_0x497c1b['include']=[{'all':!![]}];}return db[_0xcb68('0x2b')][_0xcb68('0x3f')](_0x497c1b);})[_0xcb68('0x21')](function(_0x4be046){_0x420e4a[_0xcb68('0x40')]=_0x4be046;return _0x420e4a;})[_0xcb68('0x21')](respondWithFilteredResult(_0x300494,_0x497c1b))[_0xcb68('0x41')](handleError(_0x300494,null));};exports[_0xcb68('0x42')]=function(_0x3a94ff,_0x4adec5){var _0x27934f={'raw':!![],'where':{'id':_0x3a94ff[_0xcb68('0x43')]['id']}},_0xe58be6={};_0xe58be6[_0xcb68('0x2f')]=_[_0xcb68('0x44')](db[_0xcb68('0x2b')][_0xcb68('0x45')]);_0xe58be6['query']=_[_0xcb68('0x44')](_0x3a94ff['query']);_0xe58be6[_0xcb68('0x32')]=_[_0xcb68('0x33')](_0xe58be6[_0xcb68('0x2f')],_0xe58be6[_0xcb68('0x31')]);_0x27934f[_0xcb68('0x34')]=_['intersection'](_0xe58be6[_0xcb68('0x2f')],qs['fields'](_0x3a94ff[_0xcb68('0x31')][_0xcb68('0x35')]));_0x27934f['attributes']=_0x27934f['attributes'][_0xcb68('0x36')]?_0x27934f['attributes']:_0xe58be6['model'];if(_0x3a94ff[_0xcb68('0x31')][_0xcb68('0x3e')]){_0x27934f[_0xcb68('0x46')]=[{'all':!![]}];}_0x27934f=_[_0xcb68('0x3b')]({},_0x27934f,_0x3a94ff['options']);return db['SquareOdbc'][_0xcb68('0x47')](_0x27934f)[_0xcb68('0x21')](handleEntityNotFound(_0x4adec5,null))[_0xcb68('0x21')](respondWithResult(_0x4adec5,null))[_0xcb68('0x41')](handleError(_0x4adec5,null));};exports[_0xcb68('0x48')]=function(_0x3bd81e,_0x266bec){return db[_0xcb68('0x2b')][_0xcb68('0x48')](_0x3bd81e[_0xcb68('0x49')],{})[_0xcb68('0x21')](function(_0x24794f){var _0x164c2b=_0x3bd81e[_0xcb68('0x4a')][_0xcb68('0x23')]({'plain':!![]});if(!_0x164c2b)throw new Error(_0xcb68('0x4b'));if(_0x164c2b['role']===_0xcb68('0x4a')){var _0x1b7a55=_0x24794f[_0xcb68('0x23')]({'plain':!![]});var _0x4b4ed7=_0xcb68('0x24');return db[_0xcb68('0x4c')]['find']({'where':{'name':_0x4b4ed7,'userProfileId':_0x164c2b[_0xcb68('0x4d')]},'raw':!![]})[_0xcb68('0x21')](function(_0x37615d){if(_0x37615d&&_0x37615d[_0xcb68('0x4e')]===0x0){return db['UserProfileResource'][_0xcb68('0x48')]({'name':_0x1b7a55['name'],'resourceId':_0x1b7a55['id'],'type':_0x37615d[_0xcb68('0x28')],'sectionId':_0x37615d['id']},{})['then'](function(){return _0x24794f;});}else{return _0x24794f;}})['catch'](function(_0x1817e2){logger[_0xcb68('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1817e2);throw _0x1817e2;});}return _0x24794f;})[_0xcb68('0x21')](respondWithResult(_0x266bec,0xc9))['catch'](handleError(_0x266bec,null));};exports[_0xcb68('0x4f')]=function(_0x2feffd,_0x50eced){if(_0x2feffd[_0xcb68('0x49')]['id']){delete _0x2feffd[_0xcb68('0x49')]['id'];}return db[_0xcb68('0x2b')][_0xcb68('0x47')]({'where':{'id':_0x2feffd[_0xcb68('0x43')]['id']}})[_0xcb68('0x21')](handleEntityNotFound(_0x50eced,null))[_0xcb68('0x21')](saveUpdates(_0x2feffd[_0xcb68('0x49')],null))['then'](respondWithResult(_0x50eced,null))['catch'](handleError(_0x50eced,null));};exports[_0xcb68('0x22')]=function(_0x53d3a4,_0x459f59){return db[_0xcb68('0x2b')][_0xcb68('0x47')]({'where':{'id':_0x53d3a4[_0xcb68('0x43')]['id']}})[_0xcb68('0x21')](handleEntityNotFound(_0x459f59,null))[_0xcb68('0x21')](removeEntity(_0x459f59,null))[_0xcb68('0x41')](handleError(_0x459f59,null));};exports[_0xcb68('0x50')]=function(_0x3925c5,_0x2695b9,_0x10616a){var _0x1d45f7;return db['SquareOdbc'][_0xcb68('0x47')]({'where':{'id':_0x3925c5[_0xcb68('0x43')]['id']},'attributes':['id',_0xcb68('0x51')]})[_0xcb68('0x21')](handleEntityNotFound(_0x2695b9,null))[_0xcb68('0x21')](function(_0x807e98){if(_0x807e98){var _0x367e5b=require(_0xcb68('0x52'))();_0x367e5b[_0xcb68('0x53')](_0x807e98['dsn']);_0x367e5b['closeSync']();return _0x807e98;}})[_0xcb68('0x21')](respondWithResult(_0x2695b9,null))[_0xcb68('0x41')](handleError(_0x2695b9,null));}; \ No newline at end of file +var _0xa541=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','UserProfileSection','userProfileId','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1fc3ea,_0x51c25b){var _0x25f4ee=function(_0x17af49){while(--_0x17af49){_0x1fc3ea['push'](_0x1fc3ea['shift']());}};_0x25f4ee(++_0x51c25b);}(_0xa541,0xa1));var _0x1a54=function(_0x5e1994,_0x317ce2){_0x5e1994=_0x5e1994-0x0;var _0x227dd7=_0xa541[_0x5e1994];return _0x227dd7;};'use strict';var emlformat=require(_0x1a54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a54('0x1'));var jsonpatch=require(_0x1a54('0x2'));var rp=require(_0x1a54('0x3'));var moment=require(_0x1a54('0x4'));var BPromise=require(_0x1a54('0x5'));var Mustache=require(_0x1a54('0x6'));var util=require(_0x1a54('0x7'));var path=require(_0x1a54('0x8'));var sox=require('sox');var csv=require(_0x1a54('0x9'));var ejs=require(_0x1a54('0xa'));var fs=require('fs');var fs_extra=require(_0x1a54('0xb'));var _=require(_0x1a54('0xc'));var squel=require('squel');var crypto=require(_0x1a54('0xd'));var jsforce=require(_0x1a54('0xe'));var deskjs=require(_0x1a54('0xf'));var toCsv=require(_0x1a54('0x9'));var querystring=require(_0x1a54('0x10'));var Papa=require(_0x1a54('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1a54('0x12'));var as=require(_0x1a54('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a54('0x14'))(_0x1a54('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a54('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x577522,_0x2dbb0f){_0x2dbb0f=_0x2dbb0f||0xcc;return function(_0x5300e1){if(_0x5300e1){return _0x577522[_0x1a54('0x17')](_0x2dbb0f);}return _0x577522[_0x1a54('0x18')](_0x2dbb0f)[_0x1a54('0x19')]();};}function respondWithResult(_0x2a95b7,_0x5bbfbb){_0x5bbfbb=_0x5bbfbb||0xc8;return function(_0x52ab9a){if(_0x52ab9a){return _0x2a95b7[_0x1a54('0x18')](_0x5bbfbb)[_0x1a54('0x1a')](_0x52ab9a);}};}function respondWithFilteredResult(_0x434b85,_0x2de090){return function(_0x160b76){if(_0x160b76){var _0x3f2ede=typeof _0x2de090[_0x1a54('0x1b')]===_0x1a54('0x1c')&&typeof _0x2de090['limit']===_0x1a54('0x1c');var _0x298cc8=_0x160b76[_0x1a54('0x1d')];var _0x301e0b=_0x3f2ede?0x0:_0x2de090['offset'];var _0x2f3507=_0x3f2ede?_0x160b76['count']:_0x2de090['offset']+_0x2de090[_0x1a54('0x1e')];var _0x3d7bca;if(_0x2f3507>=_0x298cc8){_0x2f3507=_0x298cc8;_0x3d7bca=0xc8;}else{_0x3d7bca=0xce;}_0x434b85[_0x1a54('0x18')](_0x3d7bca);return _0x434b85[_0x1a54('0x1f')](_0x1a54('0x20'),_0x301e0b+'-'+_0x2f3507+'/'+_0x298cc8)[_0x1a54('0x1a')](_0x160b76);}return null;};}function patchUpdates(_0x45a2e4){return function(_0x1e29d9){try{jsonpatch['apply'](_0x1e29d9,_0x45a2e4,!![]);}catch(_0x1c3cb7){return BPromise[_0x1a54('0x21')](_0x1c3cb7);}return _0x1e29d9[_0x1a54('0x22')]();};}function saveUpdates(_0x211567,_0x2be820){return function(_0x3cf3cb){if(_0x3cf3cb){return _0x3cf3cb[_0x1a54('0x23')](_0x211567)[_0x1a54('0x24')](function(_0x505037){return _0x505037;});}return null;};}function removeEntity(_0x28513d,_0x5d90a4){return function(_0x547374){if(_0x547374){return _0x547374[_0x1a54('0x25')]()['then'](function(){var _0x3e0896=_0x547374[_0x1a54('0x26')]({'plain':!![]});var _0x2f378e='ODBC';return db[_0x1a54('0x27')][_0x1a54('0x25')]({'where':{'type':_0x2f378e,'resourceId':_0x3e0896['id']}})['then'](function(){return _0x547374;});})[_0x1a54('0x24')](function(){_0x28513d['status'](0xcc)[_0x1a54('0x19')]();});}};}function handleEntityNotFound(_0x5b521b,_0x37423e){return function(_0x54b7c3){if(!_0x54b7c3){_0x5b521b[_0x1a54('0x17')](0x194);}return _0x54b7c3;};}function handleError(_0x2377de,_0x181e87){_0x181e87=_0x181e87||0x1f4;return function(_0x39dc33){logger[_0x1a54('0x28')](_0x39dc33[_0x1a54('0x29')]);if(_0x39dc33['name']){delete _0x39dc33[_0x1a54('0x2a')];}_0x2377de['status'](_0x181e87)['send'](_0x39dc33);};}exports[_0x1a54('0x2b')]=function(_0x5e3772,_0x14d27b){var _0x312aa1={},_0x189816={},_0x39ca0a={'count':0x0,'rows':[]};var _0x474ced=_[_0x1a54('0x2c')](db[_0x1a54('0x2d')][_0x1a54('0x2e')],function(_0x2d3799){return{'name':_0x2d3799[_0x1a54('0x2f')],'type':_0x2d3799[_0x1a54('0x30')][_0x1a54('0x31')]};});_0x189816['model']=_[_0x1a54('0x2c')](_0x474ced,_0x1a54('0x2a'));_0x189816['query']=_[_0x1a54('0x32')](_0x5e3772['query']);_0x189816[_0x1a54('0x33')]=_[_0x1a54('0x34')](_0x189816[_0x1a54('0x35')],_0x189816[_0x1a54('0x36')]);_0x312aa1[_0x1a54('0x37')]=_[_0x1a54('0x34')](_0x189816[_0x1a54('0x35')],qs['fields'](_0x5e3772['query'][_0x1a54('0x38')]));_0x312aa1[_0x1a54('0x37')]=_0x312aa1['attributes'][_0x1a54('0x39')]?_0x312aa1[_0x1a54('0x37')]:_0x189816['model'];if(!_0x5e3772[_0x1a54('0x36')][_0x1a54('0x3a')](_0x1a54('0x3b'))){_0x312aa1[_0x1a54('0x1e')]=qs['limit'](_0x5e3772[_0x1a54('0x36')][_0x1a54('0x1e')]);_0x312aa1[_0x1a54('0x1b')]=qs[_0x1a54('0x1b')](_0x5e3772[_0x1a54('0x36')]['offset']);}_0x312aa1['order']=qs[_0x1a54('0x3c')](_0x5e3772['query']['sort']);_0x312aa1[_0x1a54('0x3d')]=qs[_0x1a54('0x33')](_[_0x1a54('0x3e')](_0x5e3772[_0x1a54('0x36')],_0x189816[_0x1a54('0x33')]),_0x474ced);if(_0x5e3772[_0x1a54('0x36')][_0x1a54('0x3f')]){_0x312aa1[_0x1a54('0x3d')]=_['merge'](_0x312aa1['where'],{'$or':_[_0x1a54('0x2c')](_0x474ced,function(_0x2c5f34){if(_0x2c5f34[_0x1a54('0x30')]!=='VIRTUAL'){var _0x2e8cc1={};_0x2e8cc1[_0x2c5f34['name']]={'$like':'%'+_0x5e3772['query'][_0x1a54('0x3f')]+'%'};return _0x2e8cc1;}})});}_0x312aa1=_[_0x1a54('0x40')]({},_0x312aa1,_0x5e3772[_0x1a54('0x41')]);var _0x108a38={'where':_0x312aa1[_0x1a54('0x3d')]};return db[_0x1a54('0x2d')][_0x1a54('0x1d')](_0x108a38)[_0x1a54('0x24')](function(_0x490ca3){_0x39ca0a['count']=_0x490ca3;if(_0x5e3772[_0x1a54('0x36')]['includeAll']){_0x312aa1[_0x1a54('0x42')]=[{'all':!![]}];}return db[_0x1a54('0x2d')][_0x1a54('0x43')](_0x312aa1);})[_0x1a54('0x24')](function(_0x3f09b6){_0x39ca0a[_0x1a54('0x44')]=_0x3f09b6;return _0x39ca0a;})[_0x1a54('0x24')](respondWithFilteredResult(_0x14d27b,_0x312aa1))[_0x1a54('0x45')](handleError(_0x14d27b,null));};exports['show']=function(_0x496ed4,_0xd913b5){var _0x155d11={'raw':!![],'where':{'id':_0x496ed4[_0x1a54('0x46')]['id']}},_0xcb3c22={};_0xcb3c22['model']=_['keys'](db[_0x1a54('0x2d')][_0x1a54('0x2e')]);_0xcb3c22[_0x1a54('0x36')]=_[_0x1a54('0x32')](_0x496ed4[_0x1a54('0x36')]);_0xcb3c22[_0x1a54('0x33')]=_[_0x1a54('0x34')](_0xcb3c22[_0x1a54('0x35')],_0xcb3c22[_0x1a54('0x36')]);_0x155d11[_0x1a54('0x37')]=_['intersection'](_0xcb3c22['model'],qs[_0x1a54('0x38')](_0x496ed4[_0x1a54('0x36')][_0x1a54('0x38')]));_0x155d11['attributes']=_0x155d11[_0x1a54('0x37')][_0x1a54('0x39')]?_0x155d11['attributes']:_0xcb3c22[_0x1a54('0x35')];if(_0x496ed4['query'][_0x1a54('0x47')]){_0x155d11[_0x1a54('0x42')]=[{'all':!![]}];}_0x155d11=_[_0x1a54('0x40')]({},_0x155d11,_0x496ed4['options']);return db[_0x1a54('0x2d')][_0x1a54('0x48')](_0x155d11)['then'](handleEntityNotFound(_0xd913b5,null))[_0x1a54('0x24')](respondWithResult(_0xd913b5,null))[_0x1a54('0x45')](handleError(_0xd913b5,null));};exports['create']=function(_0x3d5972,_0x3717dc){return db[_0x1a54('0x2d')][_0x1a54('0x49')](_0x3d5972[_0x1a54('0x4a')],{})[_0x1a54('0x24')](function(_0x2401a4){var _0x4dcbe2=_0x3d5972[_0x1a54('0x4b')][_0x1a54('0x26')]({'plain':!![]});if(!_0x4dcbe2)throw new Error(_0x1a54('0x4c'));if(_0x4dcbe2['role']==='user'){var _0x30f5ec=_0x2401a4[_0x1a54('0x26')]({'plain':!![]});var _0x1d7129=_0x1a54('0x4d');return db[_0x1a54('0x4e')][_0x1a54('0x48')]({'where':{'name':_0x1d7129,'userProfileId':_0x4dcbe2[_0x1a54('0x4f')]},'raw':!![]})['then'](function(_0x43337c){if(_0x43337c&&_0x43337c['autoAssociation']===0x0){return db[_0x1a54('0x27')]['create']({'name':_0x30f5ec[_0x1a54('0x2a')],'resourceId':_0x30f5ec['id'],'type':_0x43337c[_0x1a54('0x2a')],'sectionId':_0x43337c['id']},{})[_0x1a54('0x24')](function(){return _0x2401a4;});}else{return _0x2401a4;}})[_0x1a54('0x45')](function(_0x2851a2){logger[_0x1a54('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2851a2);throw _0x2851a2;});}return _0x2401a4;})['then'](respondWithResult(_0x3717dc,0xc9))['catch'](handleError(_0x3717dc,null));};exports[_0x1a54('0x23')]=function(_0x4b1c31,_0x2c558a){if(_0x4b1c31[_0x1a54('0x4a')]['id']){delete _0x4b1c31['body']['id'];}return db[_0x1a54('0x2d')][_0x1a54('0x48')]({'where':{'id':_0x4b1c31[_0x1a54('0x46')]['id']}})[_0x1a54('0x24')](handleEntityNotFound(_0x2c558a,null))[_0x1a54('0x24')](saveUpdates(_0x4b1c31['body'],null))[_0x1a54('0x24')](respondWithResult(_0x2c558a,null))['catch'](handleError(_0x2c558a,null));};exports[_0x1a54('0x25')]=function(_0x57b3db,_0x4da2e6){return db[_0x1a54('0x2d')][_0x1a54('0x48')]({'where':{'id':_0x57b3db[_0x1a54('0x46')]['id']}})['then'](handleEntityNotFound(_0x4da2e6,null))[_0x1a54('0x24')](removeEntity(_0x4da2e6,null))['catch'](handleError(_0x4da2e6,null));};exports[_0x1a54('0x50')]=function(_0x30015a,_0x24ac75,_0xa17bf8){var _0x193a3c;return db[_0x1a54('0x2d')][_0x1a54('0x48')]({'where':{'id':_0x30015a['params']['id']},'attributes':['id',_0x1a54('0x51')]})[_0x1a54('0x24')](handleEntityNotFound(_0x24ac75,null))[_0x1a54('0x24')](function(_0x52c2c7){if(_0x52c2c7){var _0x166a9d=require(_0x1a54('0x52'))();_0x166a9d[_0x1a54('0x53')](_0x52c2c7['dsn']);_0x166a9d[_0x1a54('0x54')]();return _0x52c2c7;}})[_0x1a54('0x24')](respondWithResult(_0x24ac75,null))['catch'](handleError(_0x24ac75,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f5292f0..f3d869b 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 _0xa914=['./squareOdbc.attributes','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c3e20,_0x50ec3f){var _0x5e43e9=function(_0x169eec){while(--_0x169eec){_0x3c3e20['push'](_0x3c3e20['shift']());}};_0x5e43e9(++_0x50ec3f);}(_0xa914,0xce));var _0x4a91=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa914[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x4a91('0x0'));var util=require(_0x4a91('0x1'));var logger=require(_0x4a91('0x2'))(_0x4a91('0x3'));var moment=require(_0x4a91('0x4'));var BPromise=require(_0x4a91('0x5'));var rp=require(_0x4a91('0x6'));var fs=require('fs');var path=require(_0x4a91('0x7'));var rimraf=require(_0x4a91('0x8'));var config=require(_0x4a91('0x9'));var attributes=require(_0x4a91('0xa'));module['exports']=function(_0x16f463,_0x11b923){return _0x16f463['define']('SquareOdbc',attributes,{'tableName':_0x4a91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd702=['api','moment','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash'];(function(_0x447197,_0x4e191d){var _0x303a6b=function(_0x4f05a8){while(--_0x4f05a8){_0x447197['push'](_0x447197['shift']());}};_0x303a6b(++_0x4e191d);}(_0xd702,0xe5));var _0x2d70=function(_0x1671ee,_0x3b605c){_0x1671ee=_0x1671ee-0x0;var _0x1cd3fe=_0xd702[_0x1671ee];return _0x1cd3fe;};'use strict';var _=require(_0x2d70('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d70('0x1'));var moment=require(_0x2d70('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d70('0x3'));var rimraf=require(_0x2d70('0x4'));var config=require(_0x2d70('0x5'));var attributes=require(_0x2d70('0x6'));module['exports']=function(_0xf8315a,_0x560470){return _0xf8315a[_0x2d70('0x7')](_0x2d70('0x8'),attributes,{'tableName':_0x2d70('0x9'),'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 39c543c..8a5b9da 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 _0x572b=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSquareOdbc','find','options','raw','attributes','include','map','model','then','catch','lodash'];(function(_0x57d95f,_0x638c94){var _0x20fddc=function(_0x22e28b){while(--_0x22e28b){_0x57d95f['push'](_0x57d95f['shift']());}};_0x20fddc(++_0x638c94);}(_0x572b,0x1b2));var _0xb572=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x572b[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0xb572('0x0'));var util=require(_0xb572('0x1'));var moment=require(_0xb572('0x2'));var BPromise=require(_0xb572('0x3'));var rs=require(_0xb572('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb572('0x5'))['db'];var utils=require(_0xb572('0x6'));var logger=require(_0xb572('0x7'))('rpc');var config=require(_0xb572('0x8'));var jayson=require(_0xb572('0x9'));var client=jayson[_0xb572('0xa')][_0xb572('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa9a5,_0x46aafe,_0xe9c455){return new BPromise(function(_0x2166ee,_0x427949){return client[_0xb572('0xc')](_0x2fa9a5,_0xe9c455)['then'](function(_0x34b3df){logger['info'](_0xb572('0xd'),_0x46aafe,_0xb572('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x46aafe,_0xb572('0xe'),JSON[_0xb572('0xf')](_0x34b3df));if(_0x34b3df[_0xb572('0x10')]){if(_0x34b3df['error']['code']===0x1f4){logger[_0xb572('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x46aafe,_0x34b3df[_0xb572('0x10')][_0xb572('0x11')]);return _0x427949(_0x34b3df[_0xb572('0x10')]['message']);}logger[_0xb572('0x10')](_0xb572('0xd'),_0x46aafe,_0x34b3df[_0xb572('0x10')]['message']);return _0x2166ee(_0x34b3df[_0xb572('0x10')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x46aafe,_0xb572('0xe'));_0x2166ee(_0x34b3df[_0xb572('0x12')][_0xb572('0x11')]);}})['catch'](function(_0x3285f9){logger[_0xb572('0x10')](_0xb572('0xd'),_0x46aafe,_0x3285f9);_0x427949(_0x3285f9);});});}exports[_0xb572('0x13')]=function(_0x583ea5){var _0x2b9c04=this;return new Promise(function(_0x18597b,_0x5b9a16){return db['SquareOdbc'][_0xb572('0x14')]({'raw':_0x583ea5[_0xb572('0x15')]?_0x583ea5['options'][_0xb572('0x16')]===undefined?!![]:![]:!![],'where':_0x583ea5['options']?_0x583ea5[_0xb572('0x15')]['where']||null:null,'attributes':_0x583ea5[_0xb572('0x15')]?_0x583ea5[_0xb572('0x15')][_0xb572('0x17')]||null:null,'include':_0x583ea5['options']?_0x583ea5[_0xb572('0x15')][_0xb572('0x18')]?_[_0xb572('0x19')](_0x583ea5['options'][_0xb572('0x18')],function(_0x1cc929){return{'model':db[_0x1cc929[_0xb572('0x1a')]],'as':_0x1cc929['as'],'attributes':_0x1cc929['attributes'],'include':_0x1cc929[_0xb572('0x18')]?_[_0xb572('0x19')](_0x1cc929[_0xb572('0x18')],function(_0x248d1a){return{'model':db[_0x248d1a['model']],'as':_0x248d1a['as'],'attributes':_0x248d1a[_0xb572('0x17')],'include':_0x248d1a[_0xb572('0x18')]?_[_0xb572('0x19')](_0x248d1a[_0xb572('0x18')],function(_0x5e8aba){return{'model':db[_0x5e8aba[_0xb572('0x1a')]],'as':_0x5e8aba['as'],'attributes':_0x5e8aba[_0xb572('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb572('0x1b')](function(_0x2f25ca){logger['info'](_0xb572('0x13'),_0x583ea5);logger['debug'](_0xb572('0x13'),_0x583ea5,JSON['stringify'](_0x2f25ca));_0x18597b(_0x2f25ca);})[_0xb572('0x1c')](function(_0x2c4b07){logger[_0xb572('0x10')](_0xb572('0x13'),_0x2c4b07[_0xb572('0x11')],_0x583ea5);_0x5b9a16(_0x2b9c04[_0xb572('0x10')](0x1f4,_0x2c4b07[_0xb572('0x11')]));});});}; \ No newline at end of file +var _0x59c2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','SquareOdbc','find','options','raw','attributes','include','map','model','then','ShowSquareOdbc','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52f7a0,_0x2bbdd3){var _0x38d8a1=function(_0x59f568){while(--_0x59f568){_0x52f7a0['push'](_0x52f7a0['shift']());}};_0x38d8a1(++_0x2bbdd3);}(_0x59c2,0x122));var _0x259c=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0x59c2[_0x164760];return _0x8b91b2;};'use strict';var _=require(_0x259c('0x0'));var util=require(_0x259c('0x1'));var moment=require(_0x259c('0x2'));var BPromise=require('bluebird');var rs=require(_0x259c('0x3'));var fs=require('fs');var Redis=require(_0x259c('0x4'));var db=require(_0x259c('0x5'))['db'];var utils=require(_0x259c('0x6'));var logger=require(_0x259c('0x7'))(_0x259c('0x8'));var config=require(_0x259c('0x9'));var jayson=require(_0x259c('0xa'));var client=jayson[_0x259c('0xb')][_0x259c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a6dc4,_0x18dfe8,_0x597c87){return new BPromise(function(_0x82deba,_0xc8cc2a){return client['request'](_0x2a6dc4,_0x597c87)['then'](function(_0x263402){logger[_0x259c('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x18dfe8,'request\x20sent');logger[_0x259c('0xe')](_0x259c('0xf'),_0x18dfe8,_0x259c('0x10'),JSON[_0x259c('0x11')](_0x263402));if(_0x263402[_0x259c('0x12')]){if(_0x263402[_0x259c('0x12')][_0x259c('0x13')]===0x1f4){logger['error'](_0x259c('0x14'),_0x18dfe8,_0x263402['error'][_0x259c('0x15')]);return _0xc8cc2a(_0x263402['error'][_0x259c('0x15')]);}logger[_0x259c('0x12')](_0x259c('0x14'),_0x18dfe8,_0x263402[_0x259c('0x12')]['message']);return _0x82deba(_0x263402['error'][_0x259c('0x15')]);}else{logger['info'](_0x259c('0x14'),_0x18dfe8,_0x259c('0x10'));_0x82deba(_0x263402['result'][_0x259c('0x15')]);}})[_0x259c('0x16')](function(_0x13e777){logger[_0x259c('0x12')](_0x259c('0x14'),_0x18dfe8,_0x13e777);_0xc8cc2a(_0x13e777);});});}exports['ShowSquareOdbc']=function(_0x183c4b){var _0x4964e9=this;return new Promise(function(_0x24ea8c,_0x1db5af){return db[_0x259c('0x17')][_0x259c('0x18')]({'raw':_0x183c4b['options']?_0x183c4b[_0x259c('0x19')][_0x259c('0x1a')]===undefined?!![]:![]:!![],'where':_0x183c4b[_0x259c('0x19')]?_0x183c4b[_0x259c('0x19')]['where']||null:null,'attributes':_0x183c4b[_0x259c('0x19')]?_0x183c4b['options'][_0x259c('0x1b')]||null:null,'include':_0x183c4b[_0x259c('0x19')]?_0x183c4b[_0x259c('0x19')][_0x259c('0x1c')]?_[_0x259c('0x1d')](_0x183c4b['options'][_0x259c('0x1c')],function(_0x50f03d){return{'model':db[_0x50f03d[_0x259c('0x1e')]],'as':_0x50f03d['as'],'attributes':_0x50f03d['attributes'],'include':_0x50f03d[_0x259c('0x1c')]?_[_0x259c('0x1d')](_0x50f03d[_0x259c('0x1c')],function(_0x4527da){return{'model':db[_0x4527da[_0x259c('0x1e')]],'as':_0x4527da['as'],'attributes':_0x4527da[_0x259c('0x1b')],'include':_0x4527da['include']?_[_0x259c('0x1d')](_0x4527da[_0x259c('0x1c')],function(_0x42cd0c){return{'model':db[_0x42cd0c[_0x259c('0x1e')]],'as':_0x42cd0c['as'],'attributes':_0x42cd0c[_0x259c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x259c('0x1f')](function(_0xec266f){logger[_0x259c('0xd')](_0x259c('0x20'),_0x183c4b);logger['debug'](_0x259c('0x20'),_0x183c4b,JSON[_0x259c('0x11')](_0xec266f));_0x24ea8c(_0xec266f);})[_0x259c('0x16')](function(_0x2c4faa){logger[_0x259c('0x12')](_0x259c('0x20'),_0x2c4faa[_0x259c('0x15')],_0x183c4b);_0x1db5af(_0x4964e9[_0x259c('0x12')](0x1f4,_0x2c4faa[_0x259c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d0fa9d2..5a66c41 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 _0x3da6=['getUsers','post','/:id/users','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x3da6,0xc1));var _0x63da=function(_0x58d204,_0x24719a){_0x58d204=_0x58d204-0x0;var _0x26a36a=_0x3da6[_0x58d204];return _0x26a36a;};'use strict';var multer=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var path=require(_0x63da('0x2'));var timeout=require(_0x63da('0x3'));var express=require(_0x63da('0x4'));var router=express[_0x63da('0x5')]();var fs_extra=require(_0x63da('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x63da('0x7'));var config=require(_0x63da('0x8'));var controller=require('./squareProject.controller');router[_0x63da('0x9')]('/',auth['isAuthenticated'](),controller[_0x63da('0xa')]);router['get'](_0x63da('0xb'),auth[_0x63da('0xc')](),controller[_0x63da('0xd')]);router[_0x63da('0x9')]('/:id/users',auth[_0x63da('0xc')](),controller[_0x63da('0xe')]);router['post']('/',auth[_0x63da('0xc')](),controller['create']);router[_0x63da('0xf')](_0x63da('0x10'),auth[_0x63da('0xc')](),controller[_0x63da('0x11')]);router[_0x63da('0x12')]('/:id',auth[_0x63da('0xc')](),controller['update']);router[_0x63da('0x13')](_0x63da('0xb'),auth[_0x63da('0xc')](),controller[_0x63da('0x14')]);router[_0x63da('0x13')](_0x63da('0x10'),auth[_0x63da('0xc')](),controller[_0x63da('0x15')]);module[_0x63da('0x16')]=router; \ No newline at end of file +var _0x4cd3=['util','fs-extra','../../components/auth/service','get','/:id','show','/:id/users','getUsers','post','isAuthenticated','create','addUsers','put','delete','destroy','exports','multer'];(function(_0x43fb7a,_0x3807f1){var _0x1be693=function(_0x4e12f8){while(--_0x4e12f8){_0x43fb7a['push'](_0x43fb7a['shift']());}};_0x1be693(++_0x3807f1);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x4cd3[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0x34cd('0x0'));var util=require(_0x34cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x34cd('0x2'));var auth=require(_0x34cd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x34cd('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x34cd('0x5'),auth['isAuthenticated'](),controller[_0x34cd('0x6')]);router[_0x34cd('0x4')](_0x34cd('0x7'),auth['isAuthenticated'](),controller[_0x34cd('0x8')]);router[_0x34cd('0x9')]('/',auth[_0x34cd('0xa')](),controller[_0x34cd('0xb')]);router[_0x34cd('0x9')](_0x34cd('0x7'),auth[_0x34cd('0xa')](),controller[_0x34cd('0xc')]);router[_0x34cd('0xd')](_0x34cd('0x5'),auth[_0x34cd('0xa')](),controller['update']);router[_0x34cd('0xe')](_0x34cd('0x5'),auth[_0x34cd('0xa')](),controller[_0x34cd('0xf')]);router[_0x34cd('0xe')](_0x34cd('0x7'),auth[_0x34cd('0xa')](),controller['removeUsers']);module[_0x34cd('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3732893..fd617ff 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 _0xa1c9=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING'];(function(_0x1d1867,_0x31a490){var _0x31202e=function(_0xad696f){while(--_0xad696f){_0x1d1867['push'](_0x1d1867['shift']());}};_0x31202e(++_0x31a490);}(_0xa1c9,0x135));var _0x9a1c=function(_0x30ebcc,_0x307cf4){_0x30ebcc=_0x30ebcc-0x0;var _0x19b3d8=_0xa1c9[_0x30ebcc];return _0x19b3d8;};'use strict';var Sequelize=require(_0x9a1c('0x0'));module[_0x9a1c('0x1')]={'name':{'type':Sequelize[_0x9a1c('0x2')],'unique':_0x9a1c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9a1c('0x2')]},'notes':{'type':Sequelize[_0x9a1c('0x4')]},'preproduction':{'type':Sequelize[_0x9a1c('0x5')](_0x9a1c('0x6')),'get':function(){if(this[_0x9a1c('0x7')]('preproduction')){return this[_0x9a1c('0x7')](_0x9a1c('0x8'))[_0x9a1c('0x9')](_0x9a1c('0xa'));}}},'production':{'type':Sequelize[_0x9a1c('0x5')]('long'),'get':function(){if(this[_0x9a1c('0x7')](_0x9a1c('0xb'))){return this['getDataValue']('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x9a1c('0xc')]},'publishedAt':{'type':Sequelize[_0x9a1c('0xc')]}}; \ No newline at end of file +var _0xd3ed=['STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports'];(function(_0x3ab3fb,_0x44f17f){var _0x1a3633=function(_0x1e8684){while(--_0x1e8684){_0x3ab3fb['push'](_0x3ab3fb['shift']());}};_0x1a3633(++_0x44f17f);}(_0xd3ed,0x142));var _0xdd3e=function(_0x2fa1fe,_0x592647){_0x2fa1fe=_0x2fa1fe-0x0;var _0xf87f21=_0xd3ed[_0x2fa1fe];return _0xf87f21;};'use strict';var Sequelize=require(_0xdd3e('0x0'));module[_0xdd3e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdd3e('0x2')]},'notes':{'type':Sequelize[_0xdd3e('0x3')]},'preproduction':{'type':Sequelize[_0xdd3e('0x4')](_0xdd3e('0x5')),'get':function(){if(this[_0xdd3e('0x6')](_0xdd3e('0x7'))){return this[_0xdd3e('0x6')](_0xdd3e('0x7'))[_0xdd3e('0x8')](_0xdd3e('0x9'));}}},'production':{'type':Sequelize[_0xdd3e('0x4')](_0xdd3e('0x5')),'get':function(){if(this[_0xdd3e('0x6')](_0xdd3e('0xa'))){return this[_0xdd3e('0x6')]('production')[_0xdd3e('0x8')](_0xdd3e('0x9'));}}},'savedAt':{'type':Sequelize[_0xdd3e('0xb')]},'publishedAt':{'type':Sequelize[_0xdd3e('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ca76f72..ac645cf 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 _0xbd9e=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','limit','undefined','count','offset','apply','save','then','get','UserProfileResource','destroy','error','name','send','index','map','SquareProject','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','rawAttributes','filters','length','includeAll','find','catch','user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x39578c,_0x23635b){var _0x15ee51=function(_0x1fb117){while(--_0x1fb117){_0x39578c['push'](_0x39578c['shift']());}};_0x15ee51(++_0x23635b);}(_0xbd9e,0x113));var _0xebd9=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xbd9e[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0xebd9('0x0'));var rimraf=require(_0xebd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebd9('0x2'));var rp=require('request-promise');var moment=require(_0xebd9('0x3'));var BPromise=require(_0xebd9('0x4'));var Mustache=require(_0xebd9('0x5'));var util=require(_0xebd9('0x6'));var path=require(_0xebd9('0x7'));var sox=require(_0xebd9('0x8'));var csv=require(_0xebd9('0x9'));var ejs=require(_0xebd9('0xa'));var fs=require('fs');var fs_extra=require(_0xebd9('0xb'));var _=require('lodash');var squel=require(_0xebd9('0xc'));var crypto=require(_0xebd9('0xd'));var jsforce=require(_0xebd9('0xe'));var deskjs=require(_0xebd9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xebd9('0x10'));var Papa=require('papaparse');var Redis=require(_0xebd9('0x11'));var authService=require(_0xebd9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebd9('0x13'));var logger=require('../../config/logger')(_0xebd9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebd9('0x15'));var db=require(_0xebd9('0x16'))['db'];config[_0xebd9('0x17')]=_[_0xebd9('0x18')](config[_0xebd9('0x17')],{'host':_0xebd9('0x19'),'port':0x18eb});var socket=require(_0xebd9('0x1a'))(new Redis(config['redis']));require(_0xebd9('0x1b'))['register'](socket);function respondWithStatusCode(_0x15709f,_0xa8a21d){_0xa8a21d=_0xa8a21d||0xcc;return function(_0x4e8471){if(_0x4e8471){return _0x15709f[_0xebd9('0x1c')](_0xa8a21d);}return _0x15709f[_0xebd9('0x1d')](_0xa8a21d)[_0xebd9('0x1e')]();};}function respondWithResult(_0x1779f8,_0x3fa01e){_0x3fa01e=_0x3fa01e||0xc8;return function(_0x2b40af){if(_0x2b40af){return _0x1779f8[_0xebd9('0x1d')](_0x3fa01e)[_0xebd9('0x1f')](_0x2b40af);}};}function respondWithFilteredResult(_0x304b3e,_0x33e527){return function(_0x5c0af1){if(_0x5c0af1){var _0xdd7cf9=typeof _0x33e527['offset']==='undefined'&&typeof _0x33e527[_0xebd9('0x20')]===_0xebd9('0x21');var _0x113116=_0x5c0af1[_0xebd9('0x22')];var _0x398d20=_0xdd7cf9?0x0:_0x33e527[_0xebd9('0x23')];var _0x50100d=_0xdd7cf9?_0x5c0af1[_0xebd9('0x22')]:_0x33e527[_0xebd9('0x23')]+_0x33e527[_0xebd9('0x20')];var _0x11df79;if(_0x50100d>=_0x113116){_0x50100d=_0x113116;_0x11df79=0xc8;}else{_0x11df79=0xce;}_0x304b3e[_0xebd9('0x1d')](_0x11df79);return _0x304b3e['set']('Content-Range',_0x398d20+'-'+_0x50100d+'/'+_0x113116)[_0xebd9('0x1f')](_0x5c0af1);}return null;};}function patchUpdates(_0x2d0396){return function(_0x305160){try{jsonpatch[_0xebd9('0x24')](_0x305160,_0x2d0396,!![]);}catch(_0x21f58b){return BPromise['reject'](_0x21f58b);}return _0x305160[_0xebd9('0x25')]();};}function saveUpdates(_0x44ae84,_0x2f4e43){return function(_0x543ea7){if(_0x543ea7){return _0x543ea7['update'](_0x44ae84)['then'](function(_0x342ad4){return _0x342ad4;});}return null;};}function removeEntity(_0x4361a6,_0x53e9c8){return function(_0x691f03){if(_0x691f03){return _0x691f03['destroy']()[_0xebd9('0x26')](function(){var _0x2da861=_0x691f03[_0xebd9('0x27')]({'plain':!![]});var _0x331c49='SquareProjects';return db[_0xebd9('0x28')][_0xebd9('0x29')]({'where':{'type':_0x331c49,'resourceId':_0x2da861['id']}})[_0xebd9('0x26')](function(){return _0x691f03;});})['then'](function(){_0x4361a6[_0xebd9('0x1d')](0xcc)[_0xebd9('0x1e')]();});}};}function handleEntityNotFound(_0x5b0b9f,_0x21bbdb){return function(_0x4ed50a){if(!_0x4ed50a){_0x5b0b9f[_0xebd9('0x1c')](0x194);}return _0x4ed50a;};}function handleError(_0x297bb4,_0x8bb54f){_0x8bb54f=_0x8bb54f||0x1f4;return function(_0x9fe7cb){logger[_0xebd9('0x2a')](_0x9fe7cb['stack']);if(_0x9fe7cb[_0xebd9('0x2b')]){delete _0x9fe7cb[_0xebd9('0x2b')];}_0x297bb4[_0xebd9('0x1d')](_0x8bb54f)[_0xebd9('0x2c')](_0x9fe7cb);};}exports[_0xebd9('0x2d')]=function(_0x15ef8e,_0x2974a0){var _0x420156={},_0x1a3067={},_0x550ef8={'count':0x0,'rows':[]};var _0x5b5c67=_[_0xebd9('0x2e')](db[_0xebd9('0x2f')]['rawAttributes'],function(_0xb1ea7f){return{'name':_0xb1ea7f[_0xebd9('0x30')],'type':_0xb1ea7f[_0xebd9('0x31')][_0xebd9('0x32')]};});_0x1a3067[_0xebd9('0x33')]=_[_0xebd9('0x2e')](_0x5b5c67,_0xebd9('0x2b'));_0x1a3067[_0xebd9('0x34')]=_[_0xebd9('0x35')](_0x15ef8e[_0xebd9('0x34')]);_0x1a3067['filters']=_[_0xebd9('0x36')](_0x1a3067['model'],_0x1a3067[_0xebd9('0x34')]);_0x420156[_0xebd9('0x37')]=_['intersection'](_0x1a3067[_0xebd9('0x33')],qs[_0xebd9('0x38')](_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x38')]));_0x420156[_0xebd9('0x37')]=_0x420156[_0xebd9('0x37')]['length']?_0x420156[_0xebd9('0x37')]:_0x1a3067[_0xebd9('0x33')];if(!_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x39')]('nolimit')){_0x420156['limit']=qs[_0xebd9('0x20')](_0x15ef8e[_0xebd9('0x34')]['limit']);_0x420156['offset']=qs[_0xebd9('0x23')](_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x23')]);}_0x420156[_0xebd9('0x3a')]=qs[_0xebd9('0x3b')](_0x15ef8e[_0xebd9('0x34')]['sort']);_0x420156[_0xebd9('0x3c')]=qs['filters'](_[_0xebd9('0x3d')](_0x15ef8e[_0xebd9('0x34')],_0x1a3067['filters']),_0x5b5c67);if(_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x3e')]){_0x420156['where']=_['merge'](_0x420156[_0xebd9('0x3c')],{'$or':_[_0xebd9('0x2e')](_0x5b5c67,function(_0x14ccaf){if(_0x14ccaf['type']!=='VIRTUAL'){var _0x275444={};_0x275444[_0x14ccaf[_0xebd9('0x2b')]]={'$like':'%'+_0x15ef8e[_0xebd9('0x34')][_0xebd9('0x3e')]+'%'};return _0x275444;}})});}_0x420156=_[_0xebd9('0x3f')]({},_0x420156,_0x15ef8e[_0xebd9('0x40')]);var _0x52f92b={'where':_0x420156[_0xebd9('0x3c')]};return db[_0xebd9('0x2f')][_0xebd9('0x22')](_0x52f92b)[_0xebd9('0x26')](function(_0x43bcdf){_0x550ef8[_0xebd9('0x22')]=_0x43bcdf;if(_0x15ef8e[_0xebd9('0x34')]['includeAll']){_0x420156[_0xebd9('0x41')]=[{'all':!![]}];}return db[_0xebd9('0x2f')][_0xebd9('0x42')](_0x420156);})[_0xebd9('0x26')](function(_0x5a5e46){_0x550ef8[_0xebd9('0x43')]=_0x5a5e46;return _0x550ef8;})[_0xebd9('0x26')](respondWithFilteredResult(_0x2974a0,_0x420156))['catch'](handleError(_0x2974a0,null));};exports['show']=function(_0x20be0e,_0x4afd31){var _0x3c3a85={'raw':![],'where':{'id':_0x20be0e[_0xebd9('0x44')]['id']}},_0x23acaa={};_0x23acaa[_0xebd9('0x33')]=_['keys'](db[_0xebd9('0x2f')][_0xebd9('0x45')]);_0x23acaa[_0xebd9('0x34')]=_[_0xebd9('0x35')](_0x20be0e[_0xebd9('0x34')]);_0x23acaa[_0xebd9('0x46')]=_[_0xebd9('0x36')](_0x23acaa[_0xebd9('0x33')],_0x23acaa['query']);_0x3c3a85[_0xebd9('0x37')]=_['intersection'](_0x23acaa['model'],qs[_0xebd9('0x38')](_0x20be0e['query'][_0xebd9('0x38')]));_0x3c3a85[_0xebd9('0x37')]=_0x3c3a85[_0xebd9('0x37')][_0xebd9('0x47')]?_0x3c3a85[_0xebd9('0x37')]:_0x23acaa[_0xebd9('0x33')];if(_0x20be0e[_0xebd9('0x34')][_0xebd9('0x48')]){_0x3c3a85[_0xebd9('0x41')]=[{'all':!![]}];}_0x3c3a85=_['merge']({},_0x3c3a85,_0x20be0e[_0xebd9('0x40')]);return db[_0xebd9('0x2f')][_0xebd9('0x49')](_0x3c3a85)[_0xebd9('0x26')](handleEntityNotFound(_0x4afd31,null))[_0xebd9('0x26')](respondWithResult(_0x4afd31,null))[_0xebd9('0x4a')](handleError(_0x4afd31,null));};exports['create']=function(_0x567384,_0x20158f){return db[_0xebd9('0x2f')]['create'](_0x567384['body'],{})[_0xebd9('0x26')](function(_0x421e62){var _0x29fb3b=_0x567384[_0xebd9('0x4b')][_0xebd9('0x27')]({'plain':!![]});if(!_0x29fb3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29fb3b[_0xebd9('0x4c')]===_0xebd9('0x4b')){var _0x2c5104=_0x421e62[_0xebd9('0x27')]({'plain':!![]});var _0xf82ea5=_0xebd9('0x4d');return db[_0xebd9('0x4e')][_0xebd9('0x49')]({'where':{'name':_0xf82ea5,'userProfileId':_0x29fb3b[_0xebd9('0x4f')]},'raw':!![]})[_0xebd9('0x26')](function(_0x4f1fd8){if(_0x4f1fd8&&_0x4f1fd8[_0xebd9('0x50')]===0x0){return db[_0xebd9('0x28')][_0xebd9('0x51')]({'name':_0x2c5104[_0xebd9('0x2b')],'resourceId':_0x2c5104['id'],'type':_0x4f1fd8[_0xebd9('0x2b')],'sectionId':_0x4f1fd8['id']},{})[_0xebd9('0x26')](function(){return _0x421e62;});}else{return _0x421e62;}})[_0xebd9('0x4a')](function(_0x58b60c){logger[_0xebd9('0x2a')](_0xebd9('0x52'),_0x58b60c);throw _0x58b60c;});}return _0x421e62;})['then'](respondWithResult(_0x20158f,0xc9))[_0xebd9('0x4a')](handleError(_0x20158f,null));};exports[_0xebd9('0x53')]=function(_0x3d8a94,_0x50a3ac){if(_0x3d8a94[_0xebd9('0x54')]['id']){delete _0x3d8a94[_0xebd9('0x54')]['id'];}return db['SquareProject'][_0xebd9('0x49')]({'where':{'id':_0x3d8a94[_0xebd9('0x44')]['id']}})['then'](handleEntityNotFound(_0x50a3ac,null))[_0xebd9('0x26')](saveUpdates(_0x3d8a94[_0xebd9('0x54')],null))[_0xebd9('0x26')](respondWithResult(_0x50a3ac,null))[_0xebd9('0x4a')](handleError(_0x50a3ac,null));};exports[_0xebd9('0x29')]=function(_0x291d79,_0x384902){return db[_0xebd9('0x2f')][_0xebd9('0x49')]({'where':{'id':_0x291d79[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x384902,null))[_0xebd9('0x26')](removeEntity(_0x384902,null))[_0xebd9('0x4a')](handleError(_0x384902,null));};exports[_0xebd9('0x55')]=function(_0x1e1b14,_0x1e5859,_0x1fe8c9){return db[_0xebd9('0x2f')][_0xebd9('0x49')]({'where':{'id':_0x1e1b14[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x1e5859,null))[_0xebd9('0x26')](function(_0x57a977){if(_0x57a977){return _0x57a977[_0xebd9('0x55')](_0x1e1b14['body'][_0xebd9('0x56')],_[_0xebd9('0x57')](_0x1e1b14['body'],['ids','id'])||{});}})[_0xebd9('0x26')](respondWithResult(_0x1e5859,null))[_0xebd9('0x4a')](handleError(_0x1e5859,null));};exports[_0xebd9('0x58')]=function(_0x18cff0,_0x4f6b1f,_0x36622e){return db[_0xebd9('0x2f')][_0xebd9('0x49')]({'where':{'id':_0x18cff0[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x4f6b1f,null))[_0xebd9('0x26')](function(_0x191071){if(_0x191071){return _0x191071[_0xebd9('0x58')](_0x18cff0[_0xebd9('0x34')]['ids'])[_0xebd9('0x26')](function(){if(_[_0xebd9('0x59')](_0x18cff0[_0xebd9('0x34')]['ids'])){for(var _0x2d3b65=0x0;_0x2d3b65<_0x18cff0[_0xebd9('0x34')]['ids'][_0xebd9('0x47')];_0x2d3b65+=0x1){socket[_0xebd9('0x5a')](_0xebd9('0x5b'),{'UserId':Number(_0x18cff0['query']['ids'][_0x2d3b65]),'SquareProjectId':Number(_0x18cff0[_0xebd9('0x44')]['id'])});}}else{socket[_0xebd9('0x5a')](_0xebd9('0x5b'),{'UserId':Number(_0x18cff0[_0xebd9('0x34')][_0xebd9('0x56')]),'SquareProjectId':Number(_0x18cff0[_0xebd9('0x44')]['id'])});}});}})[_0xebd9('0x26')](respondWithStatusCode(_0x4f6b1f,null))['catch'](handleError(_0x4f6b1f,null));};exports[_0xebd9('0x5c')]=function(_0x4ac1a4,_0x4454e4,_0x8418a4){var _0x163351={};var _0x4c1e1a={};var _0xecef0f;var _0x90d380;return db['SquareProject'][_0xebd9('0x5d')]({'where':{'id':_0x4ac1a4[_0xebd9('0x44')]['id']}})[_0xebd9('0x26')](handleEntityNotFound(_0x4454e4,null))[_0xebd9('0x26')](function(_0x1a1376){if(_0x1a1376){_0xecef0f=_0x1a1376;_0x4c1e1a['model']=_['keys'](db[_0xebd9('0x5e')]['rawAttributes']);_0x4c1e1a['query']=_[_0xebd9('0x35')](_0x4ac1a4[_0xebd9('0x34')]);_0x4c1e1a[_0xebd9('0x46')]=_[_0xebd9('0x36')](_0x4c1e1a[_0xebd9('0x33')],_0x4c1e1a[_0xebd9('0x34')]);_0x163351[_0xebd9('0x37')]=_['intersection'](_0x4c1e1a[_0xebd9('0x33')],qs[_0xebd9('0x38')](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x38')]));_0x163351[_0xebd9('0x37')]=_0x163351[_0xebd9('0x37')][_0xebd9('0x47')]?_0x163351[_0xebd9('0x37')]:_0x4c1e1a['model'];_0x163351[_0xebd9('0x3a')]=qs[_0xebd9('0x3b')](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x3b')]);_0x163351['where']=qs[_0xebd9('0x46')](_['pick'](_0x4ac1a4[_0xebd9('0x34')],_0x4c1e1a[_0xebd9('0x46')]));if(_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x3e')]){_0x163351['where']=_[_0xebd9('0x3f')](_0x163351[_0xebd9('0x3c')],{'$or':_[_0xebd9('0x2e')](_0x163351[_0xebd9('0x37')],function(_0x3d328a){var _0x31d7d9={};_0x31d7d9[_0x3d328a]={'$like':'%'+_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x3e')]+'%'};return _0x31d7d9;})});}_0x163351=_['merge']({},_0x163351,_0x4ac1a4[_0xebd9('0x40')]);return _0xecef0f[_0xebd9('0x5c')](_0x163351);}})[_0xebd9('0x26')](function(_0x579243){if(_0x579243){_0x90d380=_0x579243[_0xebd9('0x47')];if(!_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x39')](_0xebd9('0x5f'))){_0x163351[_0xebd9('0x20')]=qs[_0xebd9('0x20')](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x20')]);_0x163351['offset']=qs['offset'](_0x4ac1a4[_0xebd9('0x34')][_0xebd9('0x23')]);}return _0xecef0f['getUsers'](_0x163351);}})['then'](function(_0x3dc866){if(_0x3dc866){return _0x3dc866?{'count':_0x90d380,'rows':_0x3dc866}:null;}})[_0xebd9('0x26')](respondWithResult(_0x4454e4,null))[_0xebd9('0x4a')](handleError(_0x4454e4,null));}; \ No newline at end of file +var _0xd5b7=['sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','then','destroy','get','SquareProjects','UserProfileResource','stringify','name','send','net','Socket','port','127.0.0.1','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','length','options','catch','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','spread','production','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0xe4f3f0,_0xbe6c93){var _0x359497=function(_0xe52c95){while(--_0xe52c95){_0xe4f3f0['push'](_0xe4f3f0['shift']());}};_0x359497(++_0xbe6c93);}(_0xd5b7,0xe8));var _0x7d5b=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0xd5b7[_0x5df61d];return _0x24cc4c;};'use strict';var _=require('lodash');var Redis=require(_0x7d5b('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x7d5b('0x1'))(_0x7d5b('0x2'));var config=require(_0x7d5b('0x3'));var db=require('../../mysqldb')['db'];config[_0x7d5b('0x4')]=_[_0x7d5b('0x5')](config[_0x7d5b('0x4')],{'host':_0x7d5b('0x6'),'port':0x18eb});var socket=require(_0x7d5b('0x7'))(new Redis(config[_0x7d5b('0x4')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x350d13,_0x4fd1cb){_0x4fd1cb=_0x4fd1cb||0xcc;return function(_0xde9ad3){if(_0xde9ad3){return _0x350d13[_0x7d5b('0x8')](_0x4fd1cb);}return _0x350d13[_0x7d5b('0x9')](_0x4fd1cb)[_0x7d5b('0xa')]();};}function respondWithResult(_0x4d1ccf,_0x5ec50a){_0x5ec50a=_0x5ec50a||0xc8;return function(_0x15343a){if(_0x15343a){return _0x4d1ccf[_0x7d5b('0x9')](_0x5ec50a)['json'](_0x15343a);}};}function respondWithFilteredResult(_0x4aeec3,_0x49d2db){return function(_0x4f9c48){if(_0x4f9c48){var _0x72e28f=typeof _0x49d2db['offset']==='undefined'&&typeof _0x49d2db[_0x7d5b('0xb')]===_0x7d5b('0xc');var _0x135d1b=_0x4f9c48[_0x7d5b('0xd')];var _0x411504=_0x72e28f?0x0:_0x49d2db[_0x7d5b('0xe')];var _0xe494e9=_0x72e28f?_0x4f9c48[_0x7d5b('0xd')]:_0x49d2db[_0x7d5b('0xe')]+_0x49d2db[_0x7d5b('0xb')];var _0xa5bae8;if(_0xe494e9>=_0x135d1b){_0xe494e9=_0x135d1b;_0xa5bae8=0xc8;}else{_0xa5bae8=0xce;}_0x4aeec3[_0x7d5b('0x9')](_0xa5bae8);return _0x4aeec3[_0x7d5b('0xf')](_0x7d5b('0x10'),_0x411504+'-'+_0xe494e9+'/'+_0x135d1b)[_0x7d5b('0x11')](_0x4f9c48);}return null;};}function saveUpdates(_0x40755a){return function(_0xdcd484){if(_0xdcd484){return _0xdcd484['update'](_0x40755a)[_0x7d5b('0x12')](function(_0x2a6356){return _0x2a6356;});}return null;};}function removeEntity(_0x573444){return function(_0x2dda1e){if(_0x2dda1e){return _0x2dda1e[_0x7d5b('0x13')]()[_0x7d5b('0x12')](function(){var _0xd5a5e2=_0x2dda1e[_0x7d5b('0x14')]({'plain':!![]});var _0x3c2429=_0x7d5b('0x15');return db[_0x7d5b('0x16')][_0x7d5b('0x13')]({'where':{'type':_0x3c2429,'resourceId':_0xd5a5e2['id']}})['then'](function(){return _0x2dda1e;});})[_0x7d5b('0x12')](function(){return createAgiSocket();})[_0x7d5b('0x12')](function(_0x296286){_0x296286[_0x7d5b('0xa')](JSON[_0x7d5b('0x17')]({'id':_0x2dda1e['id'],'deleted':!![]}));})[_0x7d5b('0x12')](function(){_0x573444['status'](0xcc)[_0x7d5b('0xa')]();});}};}function handleEntityNotFound(_0x45d7af){return function(_0x151fb7){if(!_0x151fb7){_0x45d7af[_0x7d5b('0x8')](0x194);}return _0x151fb7;};}function handleError(_0xad8fe7,_0x160144){_0x160144=_0x160144||0x1f4;return function(_0x20eae5){logger['error'](_0x20eae5['stack']);if(_0x20eae5['name']){delete _0x20eae5[_0x7d5b('0x18')];}_0xad8fe7[_0x7d5b('0x9')](_0x160144)[_0x7d5b('0x19')](_0x20eae5);};}function createAgiSocket(){try{var _0x4ed484=require(_0x7d5b('0x1a'));var _0x3aabb1=new _0x4ed484[(_0x7d5b('0x1b'))]();return _0x3aabb1['connect'](config['agi'][_0x7d5b('0x1c')]||0x11dd,_0x7d5b('0x1d'));}catch(_0x2c6c05){throw _0x2c6c05;}}exports[_0x7d5b('0x1e')]=function(_0x495689,_0x2a6539){var _0x3d8a94={},_0x30d593={},_0x4d7fcc={'count':0x0,'rows':[]};var _0xb4b54=_[_0x7d5b('0x1f')](db[_0x7d5b('0x20')][_0x7d5b('0x21')],function(_0x1147ff){return{'name':_0x1147ff[_0x7d5b('0x22')],'type':_0x1147ff[_0x7d5b('0x23')][_0x7d5b('0x24')]};});_0x30d593[_0x7d5b('0x25')]=_[_0x7d5b('0x1f')](_0xb4b54,_0x7d5b('0x18'));_0x30d593[_0x7d5b('0x26')]=_[_0x7d5b('0x27')](_0x495689[_0x7d5b('0x26')]);_0x30d593[_0x7d5b('0x28')]=_[_0x7d5b('0x29')](_0x30d593['model'],_0x30d593[_0x7d5b('0x26')]);_0x3d8a94[_0x7d5b('0x2a')]=_['intersection'](_0x30d593[_0x7d5b('0x25')],qs[_0x7d5b('0x2b')](_0x495689['query'][_0x7d5b('0x2b')]));_0x3d8a94[_0x7d5b('0x2a')]=_0x3d8a94[_0x7d5b('0x2a')]['length']?_0x3d8a94['attributes']:_0x30d593[_0x7d5b('0x25')];if(!_0x495689[_0x7d5b('0x26')][_0x7d5b('0x2c')](_0x7d5b('0x2d'))){_0x3d8a94[_0x7d5b('0xb')]=qs[_0x7d5b('0xb')](_0x495689[_0x7d5b('0x26')][_0x7d5b('0xb')]);_0x3d8a94[_0x7d5b('0xe')]=qs[_0x7d5b('0xe')](_0x495689[_0x7d5b('0x26')][_0x7d5b('0xe')]);}_0x3d8a94[_0x7d5b('0x2e')]=qs['sort'](_0x495689['query'][_0x7d5b('0x2f')]);_0x3d8a94[_0x7d5b('0x30')]=qs[_0x7d5b('0x28')](_[_0x7d5b('0x31')](_0x495689['query'],_0x30d593[_0x7d5b('0x28')]),_0xb4b54);if(_0x495689[_0x7d5b('0x26')]['filter']){_0x3d8a94[_0x7d5b('0x30')]=_[_0x7d5b('0x32')](_0x3d8a94['where'],{'$or':_['map'](_0xb4b54,function(_0x4249c4){if(_0x4249c4[_0x7d5b('0x23')]!==_0x7d5b('0x33')){var _0x27c710={};_0x27c710[_0x4249c4[_0x7d5b('0x18')]]={'$like':'%'+_0x495689[_0x7d5b('0x26')][_0x7d5b('0x34')]+'%'};return _0x27c710;}})});}_0x3d8a94=_['merge']({},_0x3d8a94,_0x495689['options']);var _0x308ddb={'where':_0x3d8a94[_0x7d5b('0x30')]};return db[_0x7d5b('0x20')][_0x7d5b('0xd')](_0x308ddb)[_0x7d5b('0x12')](function(_0x1dc361){_0x4d7fcc[_0x7d5b('0xd')]=_0x1dc361;if(_0x495689[_0x7d5b('0x26')][_0x7d5b('0x35')]){_0x3d8a94[_0x7d5b('0x36')]=[{'all':!![]}];}return db[_0x7d5b('0x20')][_0x7d5b('0x37')](_0x3d8a94);})[_0x7d5b('0x12')](function(_0x2550b2){_0x4d7fcc[_0x7d5b('0x38')]=_0x2550b2;return _0x4d7fcc;})[_0x7d5b('0x12')](respondWithFilteredResult(_0x2a6539,_0x3d8a94))['catch'](handleError(_0x2a6539,null));};exports['show']=function(_0x583472,_0x232417){var _0xdbc7f8={'raw':![],'where':{'id':_0x583472[_0x7d5b('0x39')]['id']}},_0x2b9137={};_0x2b9137[_0x7d5b('0x25')]=_[_0x7d5b('0x27')](db[_0x7d5b('0x20')][_0x7d5b('0x21')]);_0x2b9137[_0x7d5b('0x26')]=_[_0x7d5b('0x27')](_0x583472[_0x7d5b('0x26')]);_0x2b9137[_0x7d5b('0x28')]=_[_0x7d5b('0x29')](_0x2b9137[_0x7d5b('0x25')],_0x2b9137[_0x7d5b('0x26')]);_0xdbc7f8[_0x7d5b('0x2a')]=_[_0x7d5b('0x29')](_0x2b9137['model'],qs[_0x7d5b('0x2b')](_0x583472[_0x7d5b('0x26')][_0x7d5b('0x2b')]));_0xdbc7f8[_0x7d5b('0x2a')]=_0xdbc7f8[_0x7d5b('0x2a')][_0x7d5b('0x3a')]?_0xdbc7f8['attributes']:_0x2b9137['model'];if(_0x583472['query'][_0x7d5b('0x35')]){_0xdbc7f8[_0x7d5b('0x36')]=[{'all':!![]}];}_0xdbc7f8=_[_0x7d5b('0x32')]({},_0xdbc7f8,_0x583472[_0x7d5b('0x3b')]);return db[_0x7d5b('0x20')]['find'](_0xdbc7f8)[_0x7d5b('0x12')](handleEntityNotFound(_0x232417,null))[_0x7d5b('0x12')](respondWithResult(_0x232417,null))[_0x7d5b('0x3c')](handleError(_0x232417,null));};exports['create']=function(_0x3a422b,_0x3c6d1b){return db[_0x7d5b('0x20')][_0x7d5b('0x3d')](_0x3a422b[_0x7d5b('0x3e')],{})[_0x7d5b('0x12')](function(_0x2adcc7){var _0x5c45c7=_0x3a422b[_0x7d5b('0x3f')][_0x7d5b('0x14')]({'plain':!![]});if(!_0x5c45c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c45c7[_0x7d5b('0x40')]===_0x7d5b('0x3f')){var _0x3c2fdf=_0x2adcc7[_0x7d5b('0x14')]({'plain':!![]});var _0x593935=_0x7d5b('0x15');return db[_0x7d5b('0x41')][_0x7d5b('0x42')]({'where':{'name':_0x593935,'userProfileId':_0x5c45c7['userProfileId']},'raw':!![]})[_0x7d5b('0x12')](function(_0x258602){if(_0x258602&&_0x258602[_0x7d5b('0x43')]===0x0){return db[_0x7d5b('0x16')][_0x7d5b('0x3d')]({'name':_0x3c2fdf['name'],'resourceId':_0x3c2fdf['id'],'type':_0x258602[_0x7d5b('0x18')],'sectionId':_0x258602['id']},{})['then'](function(){return _0x2adcc7;});}else{return _0x2adcc7;}})['catch'](function(_0x1977e6){logger['error'](_0x7d5b('0x44'),_0x1977e6);throw _0x1977e6;});}return _0x2adcc7;})[_0x7d5b('0x12')](respondWithResult(_0x3c6d1b,0xc9))['catch'](handleError(_0x3c6d1b,null));};exports['update']=function(_0x1e8b54,_0x35d4ea){if(_0x1e8b54[_0x7d5b('0x3e')]['id']){delete _0x1e8b54[_0x7d5b('0x3e')]['id'];}return db[_0x7d5b('0x20')][_0x7d5b('0x42')]({'where':{'id':_0x1e8b54[_0x7d5b('0x39')]['id']}})['then'](handleEntityNotFound(_0x35d4ea,null))[_0x7d5b('0x12')](saveUpdates(_0x1e8b54[_0x7d5b('0x3e')],null))[_0x7d5b('0x12')](function(_0x4010b9){if(!_0x4010b9)return;var _0x2e5aed=_0x4010b9[_0x7d5b('0x14')]({'plain':!![]});return[createAgiSocket(),_0x2e5aed];})[_0x7d5b('0x45')](function(_0xa03dc3,_0x503d2d){_0xa03dc3[_0x7d5b('0xa')](JSON[_0x7d5b('0x17')](_['pick'](_0x503d2d,['id',_0x7d5b('0x18'),_0x7d5b('0x46')])));return _0x503d2d;})[_0x7d5b('0x12')](respondWithResult(_0x35d4ea,null))['catch'](handleError(_0x35d4ea,null));};exports['destroy']=function(_0xbdd0b3,_0x40137b){return db[_0x7d5b('0x20')][_0x7d5b('0x42')]({'where':{'id':_0xbdd0b3[_0x7d5b('0x39')]['id']}})[_0x7d5b('0x12')](handleEntityNotFound(_0x40137b,null))['then'](removeEntity(_0x40137b,null))[_0x7d5b('0x3c')](handleError(_0x40137b,null));};exports[_0x7d5b('0x47')]=function(_0x57a271,_0x20a1bb){return db[_0x7d5b('0x20')][_0x7d5b('0x42')]({'where':{'id':_0x57a271[_0x7d5b('0x39')]['id']}})[_0x7d5b('0x12')](handleEntityNotFound(_0x20a1bb,null))[_0x7d5b('0x12')](function(_0x1983c5){if(_0x1983c5){return _0x1983c5['addUsers'](_0x57a271['body'][_0x7d5b('0x48')],_['omit'](_0x57a271[_0x7d5b('0x3e')],['ids','id'])||{});}})[_0x7d5b('0x12')](respondWithResult(_0x20a1bb,null))[_0x7d5b('0x3c')](handleError(_0x20a1bb,null));};exports['removeUsers']=function(_0x2555f8,_0x50d897){return db[_0x7d5b('0x20')][_0x7d5b('0x42')]({'where':{'id':_0x2555f8[_0x7d5b('0x39')]['id']}})[_0x7d5b('0x12')](handleEntityNotFound(_0x50d897,null))[_0x7d5b('0x12')](function(_0x575c2f){if(_0x575c2f){return _0x575c2f[_0x7d5b('0x49')](_0x2555f8[_0x7d5b('0x26')][_0x7d5b('0x48')])[_0x7d5b('0x12')](function(){if(_[_0x7d5b('0x4a')](_0x2555f8[_0x7d5b('0x26')][_0x7d5b('0x48')])){for(var _0x2dd9ae=0x0;_0x2dd9ae<_0x2555f8[_0x7d5b('0x26')][_0x7d5b('0x48')][_0x7d5b('0x3a')];_0x2dd9ae+=0x1){socket[_0x7d5b('0x4b')](_0x7d5b('0x4c'),{'UserId':Number(_0x2555f8[_0x7d5b('0x26')]['ids'][_0x2dd9ae]),'SquareProjectId':Number(_0x2555f8[_0x7d5b('0x39')]['id'])});}}else{socket[_0x7d5b('0x4b')](_0x7d5b('0x4c'),{'UserId':Number(_0x2555f8[_0x7d5b('0x26')]['ids']),'SquareProjectId':Number(_0x2555f8[_0x7d5b('0x39')]['id'])});}});}})[_0x7d5b('0x12')](respondWithStatusCode(_0x50d897,null))[_0x7d5b('0x3c')](handleError(_0x50d897,null));};exports[_0x7d5b('0x4d')]=function(_0x54510d,_0x2ae138){var _0x35e00b={};var _0x32a17c={};var _0x3442fc;var _0x4efe80;return db['SquareProject'][_0x7d5b('0x4e')]({'where':{'id':_0x54510d[_0x7d5b('0x39')]['id']}})[_0x7d5b('0x12')](handleEntityNotFound(_0x2ae138,null))['then'](function(_0x2417d5){if(_0x2417d5){_0x3442fc=_0x2417d5;_0x32a17c[_0x7d5b('0x25')]=_[_0x7d5b('0x27')](db[_0x7d5b('0x4f')]['rawAttributes']);_0x32a17c['query']=_[_0x7d5b('0x27')](_0x54510d[_0x7d5b('0x26')]);_0x32a17c[_0x7d5b('0x28')]=_[_0x7d5b('0x29')](_0x32a17c[_0x7d5b('0x25')],_0x32a17c[_0x7d5b('0x26')]);_0x35e00b[_0x7d5b('0x2a')]=_[_0x7d5b('0x29')](_0x32a17c[_0x7d5b('0x25')],qs[_0x7d5b('0x2b')](_0x54510d[_0x7d5b('0x26')][_0x7d5b('0x2b')]));_0x35e00b[_0x7d5b('0x2a')]=_0x35e00b[_0x7d5b('0x2a')][_0x7d5b('0x3a')]?_0x35e00b[_0x7d5b('0x2a')]:_0x32a17c[_0x7d5b('0x25')];_0x35e00b[_0x7d5b('0x2e')]=qs[_0x7d5b('0x2f')](_0x54510d['query'][_0x7d5b('0x2f')]);_0x35e00b['where']=qs['filters'](_[_0x7d5b('0x31')](_0x54510d[_0x7d5b('0x26')],_0x32a17c[_0x7d5b('0x28')]));if(_0x54510d[_0x7d5b('0x26')]['filter']){_0x35e00b[_0x7d5b('0x30')]=_[_0x7d5b('0x32')](_0x35e00b[_0x7d5b('0x30')],{'$or':_['map'](_0x35e00b[_0x7d5b('0x2a')],function(_0x102b38){var _0x2adf36={};_0x2adf36[_0x102b38]={'$like':'%'+_0x54510d[_0x7d5b('0x26')][_0x7d5b('0x34')]+'%'};return _0x2adf36;})});}_0x35e00b=_[_0x7d5b('0x32')]({},_0x35e00b,_0x54510d[_0x7d5b('0x3b')]);return _0x3442fc[_0x7d5b('0x4d')](_0x35e00b);}})[_0x7d5b('0x12')](function(_0x263d0b){if(_0x263d0b){_0x4efe80=_0x263d0b[_0x7d5b('0x3a')];if(!_0x54510d['query'][_0x7d5b('0x2c')](_0x7d5b('0x2d'))){_0x35e00b['limit']=qs[_0x7d5b('0xb')](_0x54510d[_0x7d5b('0x26')][_0x7d5b('0xb')]);_0x35e00b[_0x7d5b('0xe')]=qs['offset'](_0x54510d['query']['offset']);}return _0x3442fc[_0x7d5b('0x4d')](_0x35e00b);}})[_0x7d5b('0x12')](function(_0x5a2be8){if(_0x5a2be8){return _0x5a2be8?{'count':_0x4efe80,'rows':_0x5a2be8}:null;}})[_0x7d5b('0x12')](respondWithResult(_0x2ae138,null))[_0x7d5b('0x3c')](handleError(_0x2ae138,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 7fc32a8..0a3a74d 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 _0x8592=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x8592,0xf1));var _0x2859=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x8592[_0xbc1a4b];return _0x108b87;};'use strict';var EventEmitter=require(_0x2859('0x0'));var SquareProject=require(_0x2859('0x1'))['db'][_0x2859('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2859('0x3')](0x0);var events={'afterCreate':_0x2859('0x4'),'afterUpdate':_0x2859('0x5'),'afterDestroy':_0x2859('0x6')};function emitEvent(_0x56f847){return function(_0x24d2eb,_0x573918,_0x435cfc){SquareProjectEvents[_0x2859('0x7')](_0x56f847+':'+_0x24d2eb['id'],_0x24d2eb);SquareProjectEvents[_0x2859('0x7')](_0x56f847,_0x24d2eb);_0x435cfc(null);};}for(var e in events){if(events[_0x2859('0x8')](e)){var event=events[e];SquareProject[_0x2859('0x9')](e,emitEvent(event));}}module[_0x2859('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x065f=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x21a340,_0x2800fc){var _0x29e222=function(_0x2ac8d1){while(--_0x2ac8d1){_0x21a340['push'](_0x21a340['shift']());}};_0x29e222(++_0x2800fc);}(_0x065f,0x15b));var _0xf065=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x065f[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xf065('0x0'));var SquareProject=require(_0xf065('0x1'))['db'][_0xf065('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf065('0x3')](0x0);var events={'afterCreate':_0xf065('0x4'),'afterUpdate':_0xf065('0x5'),'afterDestroy':'remove'};function emitEvent(_0x445c21){return function(_0x344a06,_0x1208aa,_0x59f864){SquareProjectEvents[_0xf065('0x6')](_0x445c21+':'+_0x344a06['id'],_0x344a06);SquareProjectEvents[_0xf065('0x6')](_0x445c21,_0x344a06);_0x59f864(null);};}for(var e in events){if(events[_0xf065('0x7')](e)){var event=events[e];SquareProject[_0xf065('0x8')](e,emitEvent(event));}}module[_0xf065('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7f19546..0ef10fb 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 _0x3533=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','square_projects','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1fdb3f,_0x50fa7b){var _0x30ff64=function(_0x24b9d9){while(--_0x24b9d9){_0x1fdb3f['push'](_0x1fdb3f['shift']());}};_0x30ff64(++_0x50fa7b);}(_0x3533,0x1ed));var _0x3353=function(_0x5d8c2f,_0x5042c3){_0x5d8c2f=_0x5d8c2f-0x0;var _0x20580f=_0x3533[_0x5d8c2f];return _0x20580f;};'use strict';var _=require(_0x3353('0x0'));var util=require(_0x3353('0x1'));var logger=require(_0x3353('0x2'))(_0x3353('0x3'));var moment=require(_0x3353('0x4'));var BPromise=require(_0x3353('0x5'));var rp=require(_0x3353('0x6'));var fs=require('fs');var path=require(_0x3353('0x7'));var rimraf=require(_0x3353('0x8'));var config=require(_0x3353('0x9'));var attributes=require('./squareProject.attributes');module[_0x3353('0xa')]=function(_0x3991aa,_0xebc090){return _0x3991aa[_0x3353('0xb')]('SquareProject',attributes,{'tableName':_0x3353('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x300e5d,_0x2bc4fe,_0x30976f){if(_0x300e5d[_0x3353('0xd')](_0x3353('0xe'))){_0x300e5d['savedAt']=moment()[_0x3353('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x300e5d['changed'](_0x3353('0x10'))){_0x300e5d[_0x3353('0x11')]=moment()[_0x3353('0xf')](_0x3353('0x12'));}_0x30976f(null,_0x300e5d);}}});}; \ No newline at end of file +var _0x7710=['api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7710,0x1f1));var _0x0771=function(_0x2daf7b,_0x310791){_0x2daf7b=_0x2daf7b-0x0;var _0x4a1f8c=_0x7710[_0x2daf7b];return _0x4a1f8c;};'use strict';var _=require(_0x0771('0x0'));var util=require(_0x0771('0x1'));var logger=require(_0x0771('0x2'))(_0x0771('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0771('0x4'));var fs=require('fs');var path=require(_0x0771('0x5'));var rimraf=require(_0x0771('0x6'));var config=require(_0x0771('0x7'));var attributes=require(_0x0771('0x8'));module[_0x0771('0x9')]=function(_0xe77ed0,_0x4e217e){return _0xe77ed0[_0x0771('0xa')](_0x0771('0xb'),attributes,{'tableName':_0x0771('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27b631,_0x119933,_0x1cce0c){if(_0x27b631[_0x0771('0xd')](_0x0771('0xe'))){_0x27b631[_0x0771('0xf')]=moment()[_0x0771('0x10')](_0x0771('0x11'));}if(_0x27b631[_0x0771('0xd')](_0x0771('0x12'))){_0x27b631[_0x0771('0x13')]=moment()[_0x0771('0x10')](_0x0771('0x11'));}_0x1cce0c(null,_0x27b631);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a0ccd58..a058f59 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 _0x69b2=['debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','find','options','raw','attributes','include','map','model','then','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','./squareProject.socket','register','request','info'];(function(_0x236e9f,_0x2a5adc){var _0x4203ea=function(_0x39e803){while(--_0x39e803){_0x236e9f['push'](_0x236e9f['shift']());}};_0x4203ea(++_0x2a5adc);}(_0x69b2,0xbd));var _0x269b=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x69b2[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x269b('0x0'));var util=require(_0x269b('0x1'));var moment=require(_0x269b('0x2'));var BPromise=require('bluebird');var rs=require(_0x269b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x269b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x269b('0x5'))(_0x269b('0x6'));var config=require(_0x269b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x269b('0x8')][_0x269b('0x9')]({'port':0x232a});config[_0x269b('0xa')]=_['defaults'](config[_0x269b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x269b('0xa')]));require(_0x269b('0xb'))[_0x269b('0xc')](socket);function respondWithRpcPromise(_0x1d32b3,_0x4af7ba,_0x236be5){return new BPromise(function(_0x5803d4,_0x33fd00){return client[_0x269b('0xd')](_0x1d32b3,_0x236be5)['then'](function(_0x4860f9){logger[_0x269b('0xe')]('SquareProject,\x20%s,\x20%s',_0x4af7ba,'request\x20sent');logger[_0x269b('0xf')](_0x269b('0x10'),_0x4af7ba,_0x269b('0x11'),JSON[_0x269b('0x12')](_0x4860f9));if(_0x4860f9[_0x269b('0x13')]){if(_0x4860f9[_0x269b('0x13')][_0x269b('0x14')]===0x1f4){logger[_0x269b('0x13')](_0x269b('0x15'),_0x4af7ba,_0x4860f9[_0x269b('0x13')][_0x269b('0x16')]);return _0x33fd00(_0x4860f9[_0x269b('0x13')][_0x269b('0x16')]);}logger['error'](_0x269b('0x15'),_0x4af7ba,_0x4860f9['error'][_0x269b('0x16')]);return _0x5803d4(_0x4860f9[_0x269b('0x13')][_0x269b('0x16')]);}else{logger[_0x269b('0xe')]('SquareProject,\x20%s,\x20%s',_0x4af7ba,_0x269b('0x11'));_0x5803d4(_0x4860f9[_0x269b('0x17')]['message']);}})[_0x269b('0x18')](function(_0x4bee6d){logger[_0x269b('0x13')]('SquareProject,\x20%s,\x20%s',_0x4af7ba,_0x4bee6d);_0x33fd00(_0x4bee6d);});});}exports[_0x269b('0x19')]=function(_0x4bd729){var _0x19680c=this;return new Promise(function(_0x500a19,_0x5128f7){return db['SquareProject'][_0x269b('0x1a')]({'raw':_0x4bd729[_0x269b('0x1b')]?_0x4bd729['options'][_0x269b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bd729[_0x269b('0x1b')]?_0x4bd729[_0x269b('0x1b')]['where']||null:null,'attributes':_0x4bd729[_0x269b('0x1b')]?_0x4bd729[_0x269b('0x1b')][_0x269b('0x1d')]||null:null,'include':_0x4bd729[_0x269b('0x1b')]?_0x4bd729[_0x269b('0x1b')][_0x269b('0x1e')]?_[_0x269b('0x1f')](_0x4bd729[_0x269b('0x1b')][_0x269b('0x1e')],function(_0x581dfc){return{'model':db[_0x581dfc[_0x269b('0x20')]],'as':_0x581dfc['as'],'attributes':_0x581dfc[_0x269b('0x1d')],'include':_0x581dfc[_0x269b('0x1e')]?_[_0x269b('0x1f')](_0x581dfc[_0x269b('0x1e')],function(_0x19fe74){return{'model':db[_0x19fe74[_0x269b('0x20')]],'as':_0x19fe74['as'],'attributes':_0x19fe74['attributes'],'include':_0x19fe74['include']?_['map'](_0x19fe74[_0x269b('0x1e')],function(_0x5662f9){return{'model':db[_0x5662f9[_0x269b('0x20')]],'as':_0x5662f9['as'],'attributes':_0x5662f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x269b('0x21')](function(_0x310f39){logger[_0x269b('0xe')](_0x269b('0x19'),_0x4bd729);logger[_0x269b('0xf')](_0x269b('0x19'),_0x4bd729,JSON[_0x269b('0x12')](_0x310f39));_0x500a19(_0x310f39);})[_0x269b('0x18')](function(_0x3928ef){logger[_0x269b('0x13')]('ShowSquareProject',_0x3928ef[_0x269b('0x16')],_0x4bd729);_0x5128f7(_0x19680c['error'](0x1f4,_0x3928ef['message']));});});}; \ No newline at end of file +var _0xf856=['SquareProject','find','info','debug','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','options','raw','attributes','limit','include','model','map','then','GetSquareProjects','stringify','catch','error','message','ShowSquareProject'];(function(_0x535cb8,_0x2e6aa7){var _0x3ce9d9=function(_0x315ac9){while(--_0x315ac9){_0x535cb8['push'](_0x535cb8['shift']());}};_0x3ce9d9(++_0x2e6aa7);}(_0xf856,0x1b7));var _0x6f85=function(_0x9dd2e0,_0xcc6c6b){_0x9dd2e0=_0x9dd2e0-0x0;var _0x5d90d6=_0xf856[_0x9dd2e0];return _0x5d90d6;};'use strict';var _=require(_0x6f85('0x0'));var Redis=require(_0x6f85('0x1'));var db=require(_0x6f85('0x2'))['db'];var logger=require(_0x6f85('0x3'))(_0x6f85('0x4'));var config=require(_0x6f85('0x5'));config[_0x6f85('0x6')]=_[_0x6f85('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6f85('0x8'))(new Redis(config[_0x6f85('0x6')]));require(_0x6f85('0x9'))[_0x6f85('0xa')](socket);exports['GetSquareProjects']=function(_0x57a5db){var _0x25362b=this;return new Promise(function(_0x394eac,_0x482968){return db['SquareProject']['findAll']({'raw':_0x57a5db[_0x6f85('0xb')]?_0x57a5db['options'][_0x6f85('0xc')]===undefined?!![]:![]:!![],'where':_0x57a5db['options']?_0x57a5db['options']['where']||null:null,'attributes':_0x57a5db[_0x6f85('0xb')]?_0x57a5db[_0x6f85('0xb')][_0x6f85('0xd')]||null:null,'limit':_0x57a5db[_0x6f85('0xb')]?_0x57a5db['options'][_0x6f85('0xe')]||null:null,'include':_0x57a5db[_0x6f85('0xb')]?_0x57a5db[_0x6f85('0xb')][_0x6f85('0xf')]?_['map'](_0x57a5db[_0x6f85('0xb')]['include'],function(_0x5edb57){return{'model':db[_0x5edb57['model']],'as':_0x5edb57['as'],'attributes':_0x5edb57[_0x6f85('0xd')],'include':_0x5edb57[_0x6f85('0xf')]?_['map'](_0x5edb57[_0x6f85('0xf')],function(_0x5c77b1){return{'model':db[_0x5c77b1[_0x6f85('0x10')]],'as':_0x5c77b1['as'],'attributes':_0x5c77b1[_0x6f85('0xd')],'include':_0x5c77b1[_0x6f85('0xf')]?_[_0x6f85('0x11')](_0x5c77b1[_0x6f85('0xf')],function(_0x3902d7){return{'model':db[_0x3902d7[_0x6f85('0x10')]],'as':_0x3902d7['as'],'attributes':_0x3902d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f85('0x12')](function(_0x23495f){logger['info']('GetSquareProjects',_0x57a5db);logger['debug'](_0x6f85('0x13'),_0x57a5db,JSON[_0x6f85('0x14')](_0x23495f));_0x394eac(_0x23495f);})[_0x6f85('0x15')](function(_0x3a9577){logger[_0x6f85('0x16')](_0x6f85('0x13'),_0x3a9577[_0x6f85('0x17')],_0x57a5db);_0x482968(_0x25362b['error'](0x1f4,_0x3a9577[_0x6f85('0x17')]));});});};exports[_0x6f85('0x18')]=function(_0x3fc6ad){var _0x191576=this;return new Promise(function(_0x356b5b,_0x2a9a90){return db[_0x6f85('0x19')][_0x6f85('0x1a')]({'raw':_0x3fc6ad[_0x6f85('0xb')]?_0x3fc6ad[_0x6f85('0xb')][_0x6f85('0xc')]===undefined?!![]:![]:!![],'where':_0x3fc6ad['options']?_0x3fc6ad[_0x6f85('0xb')]['where']||null:null,'attributes':_0x3fc6ad['options']?_0x3fc6ad[_0x6f85('0xb')][_0x6f85('0xd')]||null:null,'include':_0x3fc6ad[_0x6f85('0xb')]?_0x3fc6ad[_0x6f85('0xb')][_0x6f85('0xf')]?_[_0x6f85('0x11')](_0x3fc6ad[_0x6f85('0xb')][_0x6f85('0xf')],function(_0xcc1662){return{'model':db[_0xcc1662[_0x6f85('0x10')]],'as':_0xcc1662['as'],'attributes':_0xcc1662[_0x6f85('0xd')],'include':_0xcc1662[_0x6f85('0xf')]?_[_0x6f85('0x11')](_0xcc1662[_0x6f85('0xf')],function(_0x387edc){return{'model':db[_0x387edc['model']],'as':_0x387edc['as'],'attributes':_0x387edc[_0x6f85('0xd')],'include':_0x387edc[_0x6f85('0xf')]?_[_0x6f85('0x11')](_0x387edc[_0x6f85('0xf')],function(_0x19ead3){return{'model':db[_0x19ead3[_0x6f85('0x10')]],'as':_0x19ead3['as'],'attributes':_0x19ead3[_0x6f85('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6f85('0x12')](function(_0xa74878){logger[_0x6f85('0x1b')](_0x6f85('0x18'),_0x3fc6ad);logger[_0x6f85('0x1c')](_0x6f85('0x18'),_0x3fc6ad,JSON[_0x6f85('0x14')](_0xa74878));_0x356b5b(_0xa74878);})[_0x6f85('0x15')](function(_0x414066){logger[_0x6f85('0x16')](_0x6f85('0x18'),_0x414066[_0x6f85('0x17')],_0x3fc6ad);_0x2a9a90(_0x191576['error'](0x1f4,_0x414066['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9497748..f75b365 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 _0x3d9c=['register','length','squareProject:','save','remove','update','removeListener'];(function(_0x38b19d,_0x287341){var _0x3d6ccd=function(_0x49f8a3){while(--_0x49f8a3){_0x38b19d['push'](_0x38b19d['shift']());}};_0x3d6ccd(++_0x287341);}(_0x3d9c,0xf8));var _0xc3d9=function(_0x7bb1df,_0x340ba5){_0x7bb1df=_0x7bb1df-0x0;var _0x181f48=_0x3d9c[_0x7bb1df];return _0x181f48;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xc3d9('0x0'),_0xc3d9('0x1'),_0xc3d9('0x2')];function createListener(_0x37baf8,_0x245bf1){return function(_0x359052){_0x245bf1['emit'](_0x37baf8,_0x359052);};}function removeListener(_0x45737c,_0x45e359){return function(){SquareProjectEvents[_0xc3d9('0x3')](_0x45737c,_0x45e359);};}exports[_0xc3d9('0x4')]=function(_0x49b3b4){for(var _0x177809=0x0,_0x6afa9=events[_0xc3d9('0x5')];_0x177809<_0x6afa9;_0x177809++){var _0x19db50=events[_0x177809];var _0x49a484=createListener(_0xc3d9('0x6')+_0x19db50,_0x49b3b4);SquareProjectEvents['on'](_0x19db50,_0x49a484);}}; \ No newline at end of file +var _0xdf29=['save','update','emit','removeListener','register','length','./squareProject.events'];(function(_0x1468bc,_0x2317a5){var _0x342420=function(_0x2622f1){while(--_0x2622f1){_0x1468bc['push'](_0x1468bc['shift']());}};_0x342420(++_0x2317a5);}(_0xdf29,0xc3));var _0x9df2=function(_0x5bfdd0,_0x21162f){_0x5bfdd0=_0x5bfdd0-0x0;var _0x100c0a=_0xdf29[_0x5bfdd0];return _0x100c0a;};'use strict';var SquareProjectEvents=require(_0x9df2('0x0'));var events=[_0x9df2('0x1'),'remove',_0x9df2('0x2')];function createListener(_0x2af8cf,_0x1d837b){return function(_0x4ac72e){_0x1d837b[_0x9df2('0x3')](_0x2af8cf,_0x4ac72e);};}function removeListener(_0x1ed129,_0x320add){return function(){SquareProjectEvents[_0x9df2('0x4')](_0x1ed129,_0x320add);};}exports[_0x9df2('0x5')]=function(_0x3bad3c){for(var _0x23c435=0x0,_0x584a8e=events[_0x9df2('0x6')];_0x23c435<_0x584a8e;_0x23c435++){var _0x1575db=events[_0x23c435];var _0x873ce4=createListener('squareProject:'+_0x1575db,_0x3bad3c);SquareProjectEvents['on'](_0x1575db,_0x873ce4);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index baa78d3..e60402e 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x362bde,_0x33aa22){var _0x176d28=function(_0x490e94){while(--_0x490e94){_0x362bde['push'](_0x362bde['shift']());}};_0x176d28(++_0x33aa22);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x29fc2c,_0x4ff86a){_0x29fc2c=_0x29fc2c-0x0;var _0x1adbc8=_0x7fbe[_0x29fc2c];return _0x1adbc8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x4fb6e4,_0x4cf1c0){var _0x4517b8=function(_0xdd6851){while(--_0xdd6851){_0x4fb6e4['push'](_0x4fb6e4['shift']());}};_0x4517b8(++_0x4cf1c0);}(_0x326f,0xd1));var _0xf326=function(_0xb9c05a,_0x565124){_0xb9c05a=_0xb9c05a-0x0;var _0x4d1cbb=_0x326f[_0xb9c05a];return _0x4d1cbb;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d74c3c3..3df2a12 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 _0x24ca=['sequelize','STRING','VIRTUAL','savePath','substring','lastIndexOf'];(function(_0x335cf5,_0x2713d2){var _0x59ace2=function(_0x236253){while(--_0x236253){_0x335cf5['push'](_0x335cf5['shift']());}};_0x59ace2(++_0x2713d2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x24ca[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'callerid':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'dnid':{'type':Sequelize[_0xa24c('0x1')]},'projectName':{'type':Sequelize[_0xa24c('0x1')]},'saveName':{'type':Sequelize[_0xa24c('0x1')]},'filename':{'type':Sequelize[_0xa24c('0x1')]},'savePath':{'type':Sequelize[_0xa24c('0x1')]},'format':{'type':Sequelize[_0xa24c('0x2')],'get':function(){var _0x257264='';var _0x9a5013=this['getDataValue'](_0xa24c('0x3'));if(_0x9a5013){_0x257264=_0x9a5013[_0xa24c('0x4')](_0x9a5013[_0xa24c('0x5')]('.'));}return _0x257264;}}}; \ No newline at end of file +var _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x2eb2,0x19f));var _0x22eb=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x2eb2[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'callerid':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'extension':{'type':Sequelize[_0x22eb('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x22eb('0x1')]},'filename':{'type':Sequelize[_0x22eb('0x1')]},'savePath':{'type':Sequelize[_0x22eb('0x1')]},'format':{'type':Sequelize[_0x22eb('0x2')],'get':function(){var _0x4539d0='';var _0x396806=this[_0x22eb('0x3')](_0x22eb('0x4'));if(_0x396806){_0x4539d0=_0x396806[_0x22eb('0x5')](_0x396806[_0x22eb('0x6')]('.'));}return _0x4539d0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c95de96..3213115 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 _0x0e16=['format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','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','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','count','apply','reject','save','then','destroy','status','sendStatus','error','stack','name','send','map','SquareRecording','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','update','body','find','download','../../components/encryptor','type','uniqueid','savePath','filename'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x0e16,0xde));var _0x60e1=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0e16[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x60e1('0x0'));var rimraf=require(_0x60e1('0x1'));var zipdir=require(_0x60e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60e1('0x3'));var moment=require('moment');var BPromise=require(_0x60e1('0x4'));var Mustache=require(_0x60e1('0x5'));var util=require(_0x60e1('0x6'));var path=require(_0x60e1('0x7'));var sox=require('sox');var csv=require(_0x60e1('0x8'));var ejs=require(_0x60e1('0x9'));var fs=require('fs');var fs_extra=require(_0x60e1('0xa'));var _=require(_0x60e1('0xb'));var squel=require(_0x60e1('0xc'));var crypto=require(_0x60e1('0xd'));var jsforce=require(_0x60e1('0xe'));var deskjs=require(_0x60e1('0xf'));var toCsv=require(_0x60e1('0x8'));var querystring=require(_0x60e1('0x10'));var Papa=require(_0x60e1('0x11'));var Redis=require(_0x60e1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x60e1('0x13'));var as=require(_0x60e1('0x14'));var hardwareService=require(_0x60e1('0x15'));var logger=require(_0x60e1('0x16'))(_0x60e1('0x17'));var utils=require('../../config/utils');var config=require(_0x60e1('0x18'));var licenseUtil=require(_0x60e1('0x19'));var db=require(_0x60e1('0x1a'))['db'];function respondWithStatusCode(_0x553240,_0x406648){_0x406648=_0x406648||0xcc;return function(_0x143453){if(_0x143453){return _0x553240['sendStatus'](_0x406648);}return _0x553240['status'](_0x406648)[_0x60e1('0x1b')]();};}function respondWithResult(_0x21f9d0,_0x477e5d){_0x477e5d=_0x477e5d||0xc8;return function(_0x53e561){if(_0x53e561){return _0x21f9d0['status'](_0x477e5d)['json'](_0x53e561);}};}function respondWithFilteredResult(_0x490bd5,_0x32ba20){return function(_0x27f9ec){if(_0x27f9ec){var _0x111bfd=typeof _0x32ba20[_0x60e1('0x1c')]===_0x60e1('0x1d')&&typeof _0x32ba20['limit']==='undefined';var _0x270a1e=_0x27f9ec[_0x60e1('0x1e')];var _0x4a6ae3=_0x111bfd?0x0:_0x32ba20[_0x60e1('0x1c')];var _0x59e08b=_0x111bfd?_0x27f9ec[_0x60e1('0x1e')]:_0x32ba20['offset']+_0x32ba20['limit'];var _0x47462b;if(_0x59e08b>=_0x270a1e){_0x59e08b=_0x270a1e;_0x47462b=0xc8;}else{_0x47462b=0xce;}_0x490bd5['status'](_0x47462b);return _0x490bd5['set']('Content-Range',_0x4a6ae3+'-'+_0x59e08b+'/'+_0x270a1e)['json'](_0x27f9ec);}return null;};}function patchUpdates(_0x5427d5){return function(_0x468243){try{jsonpatch[_0x60e1('0x1f')](_0x468243,_0x5427d5,!![]);}catch(_0x102cdd){return BPromise[_0x60e1('0x20')](_0x102cdd);}return _0x468243[_0x60e1('0x21')]();};}function saveUpdates(_0x4e97b7,_0x4f8ef4){return function(_0x25e239){if(_0x25e239){return _0x25e239['update'](_0x4e97b7)[_0x60e1('0x22')](function(_0x3ab642){return _0x3ab642;});}return null;};}function removeEntity(_0x512019,_0x169d53){return function(_0x33ec4d){if(_0x33ec4d){return _0x33ec4d[_0x60e1('0x23')]()[_0x60e1('0x22')](function(){_0x512019[_0x60e1('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cba94,_0x1adb70){return function(_0x3cf932){if(!_0x3cf932){_0x3cba94[_0x60e1('0x25')](0x194);}return _0x3cf932;};}function handleError(_0x509635,_0x1da0bb){_0x1da0bb=_0x1da0bb||0x1f4;return function(_0x29311a){logger[_0x60e1('0x26')](_0x29311a[_0x60e1('0x27')]);if(_0x29311a['name']){delete _0x29311a[_0x60e1('0x28')];}_0x509635['status'](_0x1da0bb)[_0x60e1('0x29')](_0x29311a);};}exports['index']=function(_0xe7f320,_0x549bd0){var _0x5e6069={},_0xe146a6={},_0x2d0771={'count':0x0,'rows':[]};var _0x3565ff=_[_0x60e1('0x2a')](db[_0x60e1('0x2b')][_0x60e1('0x2c')],function(_0x37e48e){return{'name':_0x37e48e['fieldName'],'type':_0x37e48e['type'][_0x60e1('0x2d')]};});_0xe146a6[_0x60e1('0x2e')]=_[_0x60e1('0x2a')](_0x3565ff,_0x60e1('0x28'));_0xe146a6['query']=_[_0x60e1('0x2f')](_0xe7f320[_0x60e1('0x30')]);_0xe146a6[_0x60e1('0x31')]=_[_0x60e1('0x32')](_0xe146a6[_0x60e1('0x2e')],_0xe146a6[_0x60e1('0x30')]);_0x5e6069[_0x60e1('0x33')]=_[_0x60e1('0x32')](_0xe146a6[_0x60e1('0x2e')],qs['fields'](_0xe7f320[_0x60e1('0x30')][_0x60e1('0x34')]));_0x5e6069[_0x60e1('0x33')]=_0x5e6069[_0x60e1('0x33')][_0x60e1('0x35')]?_0x5e6069[_0x60e1('0x33')]:_0xe146a6[_0x60e1('0x2e')];if(!_0xe7f320[_0x60e1('0x30')][_0x60e1('0x36')]('nolimit')){_0x5e6069[_0x60e1('0x37')]=qs[_0x60e1('0x37')](_0xe7f320['query'][_0x60e1('0x37')]);_0x5e6069['offset']=qs[_0x60e1('0x1c')](_0xe7f320[_0x60e1('0x30')]['offset']);}_0x5e6069[_0x60e1('0x38')]=qs[_0x60e1('0x39')](_0xe7f320[_0x60e1('0x30')]['sort']);_0x5e6069['where']=qs[_0x60e1('0x31')](_[_0x60e1('0x3a')](_0xe7f320[_0x60e1('0x30')],_0xe146a6[_0x60e1('0x31')]),_0x3565ff);if(_0xe7f320[_0x60e1('0x30')][_0x60e1('0x3b')]){_0x5e6069[_0x60e1('0x3c')]=_[_0x60e1('0x3d')](_0x5e6069[_0x60e1('0x3c')],{'$or':_['map'](_0x3565ff,function(_0x34a7b6){if(_0x34a7b6['type']!==_0x60e1('0x3e')){var _0x450b2e={};_0x450b2e[_0x34a7b6[_0x60e1('0x28')]]={'$like':'%'+_0xe7f320['query'][_0x60e1('0x3b')]+'%'};return _0x450b2e;}})});}_0x5e6069=_[_0x60e1('0x3d')]({},_0x5e6069,_0xe7f320[_0x60e1('0x3f')]);var _0x2051b4={'where':_0x5e6069[_0x60e1('0x3c')]};return db[_0x60e1('0x2b')][_0x60e1('0x1e')](_0x2051b4)[_0x60e1('0x22')](function(_0x682f64){_0x2d0771[_0x60e1('0x1e')]=_0x682f64;if(_0xe7f320[_0x60e1('0x30')][_0x60e1('0x40')]){_0x5e6069['include']=[{'all':!![]}];}return db['SquareRecording'][_0x60e1('0x41')](_0x5e6069);})['then'](function(_0x507b77){_0x2d0771[_0x60e1('0x42')]=_0x507b77;return _0x2d0771;})[_0x60e1('0x22')](respondWithFilteredResult(_0x549bd0,_0x5e6069))[_0x60e1('0x43')](handleError(_0x549bd0,null));};exports[_0x60e1('0x44')]=function(_0x35fe8c,_0x27bb62){var _0x39f3ce={'raw':!![],'where':{'id':_0x35fe8c[_0x60e1('0x45')]['id']}},_0x3b353d={};_0x3b353d[_0x60e1('0x2e')]=_[_0x60e1('0x2f')](db[_0x60e1('0x2b')][_0x60e1('0x2c')]);_0x3b353d[_0x60e1('0x30')]=_[_0x60e1('0x2f')](_0x35fe8c[_0x60e1('0x30')]);_0x3b353d[_0x60e1('0x31')]=_[_0x60e1('0x32')](_0x3b353d['model'],_0x3b353d['query']);_0x39f3ce[_0x60e1('0x33')]=_['intersection'](_0x3b353d['model'],qs[_0x60e1('0x34')](_0x35fe8c[_0x60e1('0x30')][_0x60e1('0x34')]));_0x39f3ce[_0x60e1('0x33')]=_0x39f3ce[_0x60e1('0x33')][_0x60e1('0x35')]?_0x39f3ce[_0x60e1('0x33')]:_0x3b353d[_0x60e1('0x2e')];if(_0x35fe8c[_0x60e1('0x30')][_0x60e1('0x40')]){_0x39f3ce[_0x60e1('0x46')]=[{'all':!![]}];}_0x39f3ce=_['merge']({},_0x39f3ce,_0x35fe8c['options']);return db[_0x60e1('0x2b')]['find'](_0x39f3ce)[_0x60e1('0x22')](handleEntityNotFound(_0x27bb62,null))[_0x60e1('0x22')](respondWithResult(_0x27bb62,null))[_0x60e1('0x43')](handleError(_0x27bb62,null));};exports[_0x60e1('0x47')]=function(_0x243bde,_0x538fa0){return db[_0x60e1('0x2b')][_0x60e1('0x47')](_0x243bde['body'],{})[_0x60e1('0x22')](respondWithResult(_0x538fa0,0xc9))['catch'](handleError(_0x538fa0,null));};exports[_0x60e1('0x48')]=function(_0x219789,_0x5a7ea8){if(_0x219789[_0x60e1('0x49')]['id']){delete _0x219789[_0x60e1('0x49')]['id'];}return db[_0x60e1('0x2b')][_0x60e1('0x4a')]({'where':{'id':_0x219789[_0x60e1('0x45')]['id']}})[_0x60e1('0x22')](handleEntityNotFound(_0x5a7ea8,null))[_0x60e1('0x22')](saveUpdates(_0x219789[_0x60e1('0x49')],null))[_0x60e1('0x22')](respondWithResult(_0x5a7ea8,null))[_0x60e1('0x43')](handleError(_0x5a7ea8,null));};exports[_0x60e1('0x4b')]=function(_0x14f35f,_0x2336c4,_0x4555f5){var _0x24e019=require(_0x60e1('0x4c'));var _0x402b3a=![];var _0x5548fe={};if(_0x14f35f[_0x60e1('0x30')][_0x60e1('0x4d')]&&_0x14f35f['query']['type']==='uniqueid'){_0x5548fe[_0x60e1('0x4e')]=_0x14f35f[_0x60e1('0x45')]['id'];}else{_0x5548fe['id']=_0x14f35f['params']['id'];}return db[_0x60e1('0x2b')][_0x60e1('0x4a')]({'where':_0x5548fe,'attributes':['id',_0x60e1('0x4f'),_0x60e1('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x2336c4,null))[_0x60e1('0x22')](function(_0x3fabbf){if(_0x3fabbf){var _0x5b5278=_0x3fabbf[_0x60e1('0x4f')];var _0x4fc7c8=util[_0x60e1('0x51')](_0x60e1('0x52'),_0x5b5278);if(fs[_0x60e1('0x53')](_0x4fc7c8)){_0x402b3a=!![];return _0x24e019[_0x60e1('0x54')](_0x4fc7c8,_0x5b5278,config[_0x60e1('0x55')][_0x60e1('0x56')])[_0x60e1('0x22')](function(){return _0x3fabbf;});}return _0x3fabbf;}})['then'](function(_0x5932d4){if(_0x5932d4){var _0x4faa4a=_0x5932d4[_0x60e1('0x4f')];if(!fs['existsSync'](_0x4faa4a)){throw new db[(_0x60e1('0x57'))][(_0x60e1('0x58'))](_0x60e1('0x59'));}if(_0x5932d4[_0x60e1('0x50')]){return _0x2336c4[_0x60e1('0x4b')](_0x4faa4a,_0x5932d4[_0x60e1('0x50')]+path[_0x60e1('0x5a')](_0x4faa4a),function(){if(_0x402b3a){fs[_0x60e1('0x5b')](_0x4faa4a);}});}else{return _0x2336c4[_0x60e1('0x4b')](_0x4faa4a,function(_0x1b9508){if(_0x402b3a){fs['unlink'](_0x4faa4a);}});}}})[_0x60e1('0x43')](function(_0x25f5f0){if(_0x25f5f0[_0x60e1('0x5c')]===_0x60e1('0x59')){_0x2336c4[_0x60e1('0x24')](0x194)[_0x60e1('0x29')](_0x60e1('0x5d'));}else{return handleError(_0x2336c4,null);}});};exports[_0x60e1('0x23')]=function(_0x1e9d02,_0x1fb7e7){return db[_0x60e1('0x2b')][_0x60e1('0x4a')]({'where':{'id':_0x1e9d02[_0x60e1('0x45')]['id']}})[_0x60e1('0x22')](function(_0x417bb1){if(_[_0x60e1('0x5e')](_0x417bb1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x417bb1;})['then'](function(_0x41e53e){var _0x36119b=_0x41e53e[_0x60e1('0x4f')];logger[_0x60e1('0x5f')](_0x60e1('0x60'),_0x36119b);if(!_[_0x60e1('0x5e')](_0x41e53e[_0x60e1('0x4f')])&&fs[_0x60e1('0x53')](_0x36119b)){logger[_0x60e1('0x5f')](_0x60e1('0x61')+_0x36119b+_0x60e1('0x62'));fs[_0x60e1('0x63')](_0x36119b);}_0x36119b=_0x36119b+_0x60e1('0x64');if(!_['isNil'](_0x41e53e['savePath'])&&fs[_0x60e1('0x53')](_0x36119b)){logger[_0x60e1('0x5f')](_0x60e1('0x61')+_0x36119b+_0x60e1('0x62'));fs[_0x60e1('0x63')](_0x36119b);}return _0x41e53e;})[_0x60e1('0x22')](function(_0x34f28e){if(!_0x34f28e)throw new InternalError();return _0x34f28e['destroy']();})[_0x60e1('0x22')](function(){_0x1fb7e7[_0x60e1('0x24')](0xcc)['end']();})['catch'](handleError(_0x1fb7e7,null));}; \ No newline at end of file +var _0x6bc0=['rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','body','download','../../components/encryptor','type','uniqueid','savePath','%s.cypher','existsSync','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','SquareRecording'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x6bc0,0xf8));var _0x06bc=function(_0x25283e,_0x371e47){_0x25283e=_0x25283e-0x0;var _0x5ac25b=_0x6bc0[_0x25283e];return _0x5ac25b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06bc('0x0'));var jsonpatch=require(_0x06bc('0x1'));var rp=require(_0x06bc('0x2'));var moment=require(_0x06bc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x06bc('0x4'));var util=require(_0x06bc('0x5'));var path=require(_0x06bc('0x6'));var sox=require(_0x06bc('0x7'));var csv=require(_0x06bc('0x8'));var ejs=require(_0x06bc('0x9'));var fs=require('fs');var fs_extra=require(_0x06bc('0xa'));var _=require('lodash');var squel=require(_0x06bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x06bc('0xc'));var deskjs=require(_0x06bc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x06bc('0xe'));var Papa=require(_0x06bc('0xf'));var Redis=require('ioredis');var authService=require(_0x06bc('0x10'));var qs=require(_0x06bc('0x11'));var as=require(_0x06bc('0x12'));var hardwareService=require(_0x06bc('0x13'));var logger=require(_0x06bc('0x14'))(_0x06bc('0x15'));var utils=require(_0x06bc('0x16'));var config=require(_0x06bc('0x17'));var licenseUtil=require(_0x06bc('0x18'));var db=require(_0x06bc('0x19'))['db'];function respondWithStatusCode(_0x2d3004,_0x9ddd95){_0x9ddd95=_0x9ddd95||0xcc;return function(_0x46b863){if(_0x46b863){return _0x2d3004[_0x06bc('0x1a')](_0x9ddd95);}return _0x2d3004['status'](_0x9ddd95)['end']();};}function respondWithResult(_0x1b7385,_0x860899){_0x860899=_0x860899||0xc8;return function(_0x2779a4){if(_0x2779a4){return _0x1b7385[_0x06bc('0x1b')](_0x860899)[_0x06bc('0x1c')](_0x2779a4);}};}function respondWithFilteredResult(_0x850f61,_0x4f55bb){return function(_0x387841){if(_0x387841){var _0x17ff53=typeof _0x4f55bb[_0x06bc('0x1d')]===_0x06bc('0x1e')&&typeof _0x4f55bb[_0x06bc('0x1f')]===_0x06bc('0x1e');var _0x5b2127=_0x387841['count'];var _0x2fa8ed=_0x17ff53?0x0:_0x4f55bb[_0x06bc('0x1d')];var _0x47013b=_0x17ff53?_0x387841[_0x06bc('0x20')]:_0x4f55bb[_0x06bc('0x1d')]+_0x4f55bb[_0x06bc('0x1f')];var _0x111bca;if(_0x47013b>=_0x5b2127){_0x47013b=_0x5b2127;_0x111bca=0xc8;}else{_0x111bca=0xce;}_0x850f61['status'](_0x111bca);return _0x850f61[_0x06bc('0x21')](_0x06bc('0x22'),_0x2fa8ed+'-'+_0x47013b+'/'+_0x5b2127)[_0x06bc('0x1c')](_0x387841);}return null;};}function patchUpdates(_0x495ded){return function(_0x3adecd){try{jsonpatch['apply'](_0x3adecd,_0x495ded,!![]);}catch(_0xca80bd){return BPromise[_0x06bc('0x23')](_0xca80bd);}return _0x3adecd[_0x06bc('0x24')]();};}function saveUpdates(_0x17c449,_0x4ba8c9){return function(_0x4a2bbb){if(_0x4a2bbb){return _0x4a2bbb[_0x06bc('0x25')](_0x17c449)[_0x06bc('0x26')](function(_0x8436e8){return _0x8436e8;});}return null;};}function removeEntity(_0x9f7628,_0x17bdd3){return function(_0x50e013){if(_0x50e013){return _0x50e013[_0x06bc('0x27')]()[_0x06bc('0x26')](function(){_0x9f7628[_0x06bc('0x1b')](0xcc)[_0x06bc('0x28')]();});}};}function handleEntityNotFound(_0x47cfdd,_0x59c627){return function(_0x46c486){if(!_0x46c486){_0x47cfdd[_0x06bc('0x1a')](0x194);}return _0x46c486;};}function handleError(_0x34db52,_0x5e3a4d){_0x5e3a4d=_0x5e3a4d||0x1f4;return function(_0x4aa170){logger[_0x06bc('0x29')](_0x4aa170[_0x06bc('0x2a')]);if(_0x4aa170[_0x06bc('0x2b')]){delete _0x4aa170[_0x06bc('0x2b')];}_0x34db52[_0x06bc('0x1b')](_0x5e3a4d)[_0x06bc('0x2c')](_0x4aa170);};}exports['index']=function(_0x48bf01,_0x46521e){var _0x3a3097={},_0x526af0={},_0x32b7be={'count':0x0,'rows':[]};var _0x33d6ea=_['map'](db[_0x06bc('0x2d')][_0x06bc('0x2e')],function(_0x3b5b18){return{'name':_0x3b5b18[_0x06bc('0x2f')],'type':_0x3b5b18['type'][_0x06bc('0x30')]};});_0x526af0[_0x06bc('0x31')]=_['map'](_0x33d6ea,_0x06bc('0x2b'));_0x526af0[_0x06bc('0x32')]=_['keys'](_0x48bf01[_0x06bc('0x32')]);_0x526af0[_0x06bc('0x33')]=_[_0x06bc('0x34')](_0x526af0[_0x06bc('0x31')],_0x526af0[_0x06bc('0x32')]);_0x3a3097[_0x06bc('0x35')]=_[_0x06bc('0x34')](_0x526af0[_0x06bc('0x31')],qs[_0x06bc('0x36')](_0x48bf01[_0x06bc('0x32')][_0x06bc('0x36')]));_0x3a3097[_0x06bc('0x35')]=_0x3a3097[_0x06bc('0x35')][_0x06bc('0x37')]?_0x3a3097[_0x06bc('0x35')]:_0x526af0[_0x06bc('0x31')];if(!_0x48bf01[_0x06bc('0x32')]['hasOwnProperty'](_0x06bc('0x38'))){_0x3a3097['limit']=qs[_0x06bc('0x1f')](_0x48bf01['query'][_0x06bc('0x1f')]);_0x3a3097[_0x06bc('0x1d')]=qs[_0x06bc('0x1d')](_0x48bf01['query'][_0x06bc('0x1d')]);}_0x3a3097['order']=qs[_0x06bc('0x39')](_0x48bf01[_0x06bc('0x32')]['sort']);_0x3a3097[_0x06bc('0x3a')]=qs[_0x06bc('0x33')](_[_0x06bc('0x3b')](_0x48bf01['query'],_0x526af0[_0x06bc('0x33')]),_0x33d6ea);if(_0x48bf01[_0x06bc('0x32')][_0x06bc('0x3c')]){_0x3a3097[_0x06bc('0x3a')]=_[_0x06bc('0x3d')](_0x3a3097[_0x06bc('0x3a')],{'$or':_['map'](_0x33d6ea,function(_0x4c1809){if(_0x4c1809['type']!==_0x06bc('0x3e')){var _0x4175d3={};_0x4175d3[_0x4c1809[_0x06bc('0x2b')]]={'$like':'%'+_0x48bf01[_0x06bc('0x32')][_0x06bc('0x3c')]+'%'};return _0x4175d3;}})});}_0x3a3097=_[_0x06bc('0x3d')]({},_0x3a3097,_0x48bf01[_0x06bc('0x3f')]);var _0x3d6ce4={'where':_0x3a3097[_0x06bc('0x3a')]};return db[_0x06bc('0x2d')][_0x06bc('0x20')](_0x3d6ce4)[_0x06bc('0x26')](function(_0x42367b){_0x32b7be[_0x06bc('0x20')]=_0x42367b;if(_0x48bf01[_0x06bc('0x32')][_0x06bc('0x40')]){_0x3a3097['include']=[{'all':!![]}];}return db[_0x06bc('0x2d')][_0x06bc('0x41')](_0x3a3097);})[_0x06bc('0x26')](function(_0x457bd8){_0x32b7be[_0x06bc('0x42')]=_0x457bd8;return _0x32b7be;})[_0x06bc('0x26')](respondWithFilteredResult(_0x46521e,_0x3a3097))[_0x06bc('0x43')](handleError(_0x46521e,null));};exports[_0x06bc('0x44')]=function(_0x119328,_0x2694b1){var _0x3ea10d={'raw':!![],'where':{'id':_0x119328[_0x06bc('0x45')]['id']}},_0x3280e1={};_0x3280e1[_0x06bc('0x31')]=_[_0x06bc('0x46')](db[_0x06bc('0x2d')]['rawAttributes']);_0x3280e1[_0x06bc('0x32')]=_[_0x06bc('0x46')](_0x119328[_0x06bc('0x32')]);_0x3280e1[_0x06bc('0x33')]=_[_0x06bc('0x34')](_0x3280e1[_0x06bc('0x31')],_0x3280e1[_0x06bc('0x32')]);_0x3ea10d[_0x06bc('0x35')]=_[_0x06bc('0x34')](_0x3280e1[_0x06bc('0x31')],qs['fields'](_0x119328[_0x06bc('0x32')][_0x06bc('0x36')]));_0x3ea10d['attributes']=_0x3ea10d[_0x06bc('0x35')][_0x06bc('0x37')]?_0x3ea10d[_0x06bc('0x35')]:_0x3280e1['model'];if(_0x119328[_0x06bc('0x32')]['includeAll']){_0x3ea10d[_0x06bc('0x47')]=[{'all':!![]}];}_0x3ea10d=_['merge']({},_0x3ea10d,_0x119328[_0x06bc('0x3f')]);return db[_0x06bc('0x2d')][_0x06bc('0x48')](_0x3ea10d)[_0x06bc('0x26')](handleEntityNotFound(_0x2694b1,null))[_0x06bc('0x26')](respondWithResult(_0x2694b1,null))[_0x06bc('0x43')](handleError(_0x2694b1,null));};exports['create']=function(_0x2341af,_0x46ea5a){return db[_0x06bc('0x2d')]['create'](_0x2341af[_0x06bc('0x49')],{})[_0x06bc('0x26')](respondWithResult(_0x46ea5a,0xc9))[_0x06bc('0x43')](handleError(_0x46ea5a,null));};exports['update']=function(_0x20d3e1,_0x3f9f0d){if(_0x20d3e1[_0x06bc('0x49')]['id']){delete _0x20d3e1[_0x06bc('0x49')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x20d3e1[_0x06bc('0x45')]['id']}})[_0x06bc('0x26')](handleEntityNotFound(_0x3f9f0d,null))['then'](saveUpdates(_0x20d3e1['body'],null))[_0x06bc('0x26')](respondWithResult(_0x3f9f0d,null))['catch'](handleError(_0x3f9f0d,null));};exports[_0x06bc('0x4a')]=function(_0x540f05,_0x7494b1,_0x48fd52){var _0xddb6d1=require(_0x06bc('0x4b'));var _0x25ec8c=![];var _0xbf932={};if(_0x540f05[_0x06bc('0x32')][_0x06bc('0x4c')]&&_0x540f05['query'][_0x06bc('0x4c')]===_0x06bc('0x4d')){_0xbf932[_0x06bc('0x4d')]=_0x540f05[_0x06bc('0x45')]['id'];}else{_0xbf932['id']=_0x540f05[_0x06bc('0x45')]['id'];}return db[_0x06bc('0x2d')][_0x06bc('0x48')]({'where':_0xbf932,'attributes':['id',_0x06bc('0x4e'),'filename'],'raw':!![]})[_0x06bc('0x26')](handleEntityNotFound(_0x7494b1,null))[_0x06bc('0x26')](function(_0x49b36f){if(_0x49b36f){var _0x3cc01d=_0x49b36f[_0x06bc('0x4e')];var _0x1f7ac1=util['format'](_0x06bc('0x4f'),_0x3cc01d);if(fs[_0x06bc('0x50')](_0x1f7ac1)){_0x25ec8c=!![];return _0xddb6d1['decryptFile'](_0x1f7ac1,_0x3cc01d,config['secrets'][_0x06bc('0x51')])[_0x06bc('0x26')](function(){return _0x49b36f;});}return _0x49b36f;}})[_0x06bc('0x26')](function(_0x38f344){if(_0x38f344){var _0x57b67b=_0x38f344[_0x06bc('0x4e')];if(!fs['existsSync'](_0x57b67b)){throw new db[(_0x06bc('0x52'))][(_0x06bc('0x53'))](_0x06bc('0x54'));}if(_0x38f344[_0x06bc('0x55')]){return _0x7494b1[_0x06bc('0x4a')](_0x57b67b,_0x38f344[_0x06bc('0x55')]+path[_0x06bc('0x56')](_0x57b67b),function(){if(_0x25ec8c){fs[_0x06bc('0x57')](_0x57b67b);}});}else{return _0x7494b1[_0x06bc('0x4a')](_0x57b67b,function(_0x469ced){if(_0x25ec8c){fs[_0x06bc('0x57')](_0x57b67b);}});}}})[_0x06bc('0x43')](function(_0x2bffa5){if(_0x2bffa5[_0x06bc('0x58')]===_0x06bc('0x54')){_0x7494b1['status'](0x194)[_0x06bc('0x2c')](_0x06bc('0x59'));}else{return handleError(_0x7494b1,null);}});};exports[_0x06bc('0x27')]=function(_0x4b3034,_0x5dd39f){return db['SquareRecording'][_0x06bc('0x48')]({'where':{'id':_0x4b3034[_0x06bc('0x45')]['id']}})[_0x06bc('0x26')](function(_0x3d712d){if(_['isNil'](_0x3d712d)){throw new ReferenceError(_0x06bc('0x5a'));}return _0x3d712d;})['then'](function(_0x32abe8){var _0x4ce84b=_0x32abe8['savePath'];logger['info'](_0x06bc('0x5b'),_0x4ce84b);if(!_[_0x06bc('0x5c')](_0x32abe8[_0x06bc('0x4e')])&&fs[_0x06bc('0x50')](_0x4ce84b)){logger[_0x06bc('0x5d')](_0x06bc('0x5e')+_0x4ce84b+_0x06bc('0x5f'));fs[_0x06bc('0x60')](_0x4ce84b);}_0x4ce84b=_0x4ce84b+_0x06bc('0x61');if(!_['isNil'](_0x32abe8[_0x06bc('0x4e')])&&fs[_0x06bc('0x50')](_0x4ce84b)){logger[_0x06bc('0x5d')](_0x06bc('0x5e')+_0x4ce84b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4ce84b);}return _0x32abe8;})[_0x06bc('0x26')](function(_0x21cd1c){if(!_0x21cd1c)throw new InternalError();return _0x21cd1c[_0x06bc('0x27')]();})[_0x06bc('0x26')](function(){_0x5dd39f[_0x06bc('0x1b')](0xcc)[_0x06bc('0x28')]();})[_0x06bc('0x43')](handleError(_0x5dd39f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0929479..b27ab97 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 _0x4c9d=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x296313,_0x5b9d39){var _0x5b3787=function(_0x388e9b){while(--_0x388e9b){_0x296313['push'](_0x296313['shift']());}};_0x5b3787(++_0x5b9d39);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4c9('0x0'));var util=require(_0xd4c9('0x1'));var logger=require(_0xd4c9('0x2'))('api');var moment=require(_0xd4c9('0x3'));var BPromise=require(_0xd4c9('0x4'));var rp=require(_0xd4c9('0x5'));var fs=require('fs');var path=require(_0xd4c9('0x6'));var rimraf=require(_0xd4c9('0x7'));var config=require(_0xd4c9('0x8'));var attributes=require(_0xd4c9('0x9'));module[_0xd4c9('0xa')]=function(_0x2c81cb,_0x5980e0){return _0x2c81cb['define'](_0xd4c9('0xb'),attributes,{'tableName':_0xd4c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x077e=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x077e,0x14a));var _0xe077=function(_0x57028f,_0x4bfc1d){_0x57028f=_0x57028f-0x0;var _0x59279d=_0x077e[_0x57028f];return _0x59279d;};'use strict';var _=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var logger=require(_0xe077('0x2'))(_0xe077('0x3'));var moment=require('moment');var BPromise=require(_0xe077('0x4'));var rp=require(_0xe077('0x5'));var fs=require('fs');var path=require(_0xe077('0x6'));var rimraf=require('rimraf');var config=require(_0xe077('0x7'));var attributes=require(_0xe077('0x8'));module[_0xe077('0x9')]=function(_0xe4430c,_0x3a9d18){return _0xe4430c[_0xe077('0xa')](_0xe077('0xb'),attributes,{'tableName':_0xe077('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index cf49862..181284c 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 _0x222b=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareRecording,\x20%s,\x20%s','message','info','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5a803a,_0xb0933c){var _0x5f2647=function(_0x420384){while(--_0x420384){_0x5a803a['push'](_0x5a803a['shift']());}};_0x5f2647(++_0xb0933c);}(_0x222b,0x1d3));var _0xb222=function(_0x1b999f,_0xada878){_0x1b999f=_0x1b999f-0x0;var _0x51d27a=_0x222b[_0x1b999f];return _0x51d27a;};'use strict';var _=require(_0xb222('0x0'));var util=require('util');var moment=require(_0xb222('0x1'));var BPromise=require(_0xb222('0x2'));var rs=require(_0xb222('0x3'));var fs=require('fs');var Redis=require(_0xb222('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb222('0x5'));var logger=require(_0xb222('0x6'))('rpc');var config=require(_0xb222('0x7'));var jayson=require(_0xb222('0x8'));var client=jayson[_0xb222('0x9')][_0xb222('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4677d1,_0x5c3cf4,_0x75199a){return new BPromise(function(_0x4832fe,_0x626bb6){return client[_0xb222('0xb')](_0x4677d1,_0x75199a)[_0xb222('0xc')](function(_0x1b5d75){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5c3cf4,_0xb222('0xd'));logger[_0xb222('0xe')](_0xb222('0xf'),_0x5c3cf4,_0xb222('0xd'),JSON[_0xb222('0x10')](_0x1b5d75));if(_0x1b5d75['error']){if(_0x1b5d75['error'][_0xb222('0x11')]===0x1f4){logger[_0xb222('0x12')](_0xb222('0x13'),_0x5c3cf4,_0x1b5d75[_0xb222('0x12')]['message']);return _0x626bb6(_0x1b5d75[_0xb222('0x12')][_0xb222('0x14')]);}logger['error'](_0xb222('0x13'),_0x5c3cf4,_0x1b5d75[_0xb222('0x12')][_0xb222('0x14')]);return _0x4832fe(_0x1b5d75['error']['message']);}else{logger[_0xb222('0x15')](_0xb222('0x13'),_0x5c3cf4,'request\x20sent');_0x4832fe(_0x1b5d75[_0xb222('0x16')][_0xb222('0x14')]);}})[_0xb222('0x17')](function(_0x89b43f){logger[_0xb222('0x12')](_0xb222('0x13'),_0x5c3cf4,_0x89b43f);_0x626bb6(_0x89b43f);});});}exports['CreateSquareRecording']=function(_0x186d97){var _0x47dd89=this;return new Promise(function(_0x5354ad,_0x10a252){return db[_0xb222('0x18')][_0xb222('0x19')](_0x186d97[_0xb222('0x1a')],{'raw':_0x186d97[_0xb222('0x1b')]?_0x186d97[_0xb222('0x1b')][_0xb222('0x1c')]===undefined?!![]:![]:!![]})[_0xb222('0xc')](function(_0x449341){logger[_0xb222('0x15')](_0xb222('0x1d'),_0x186d97);logger[_0xb222('0xe')](_0xb222('0x1d'),_0x186d97,JSON[_0xb222('0x10')](_0x449341));_0x5354ad(_0x449341);})[_0xb222('0x17')](function(_0x4909cf){logger['error'](_0xb222('0x1d'),_0x4909cf['message'],_0x186d97);_0x10a252(_0x47dd89[_0xb222('0x12')](0x1f4,_0x4909cf[_0xb222('0x14')]));});});}; \ No newline at end of file +var _0xa321=['randomstring','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','CreateSquareRecording','lodash','moment','bluebird'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0xa321,0x1f1));var _0x1a32=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xa321[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require(_0x1a32('0x0'));var util=require('util');var moment=require(_0x1a32('0x1'));var BPromise=require(_0x1a32('0x2'));var rs=require(_0x1a32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a32('0x4'))(_0x1a32('0x5'));var config=require('../../config/environment');var jayson=require(_0x1a32('0x6'));var client=jayson[_0x1a32('0x7')][_0x1a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d4917,_0x21a397,_0x51981e){return new BPromise(function(_0x7a0b00,_0xacf70c){return client['request'](_0x5d4917,_0x51981e)[_0x1a32('0x9')](function(_0x38f052){logger[_0x1a32('0xa')]('SquareRecording,\x20%s,\x20%s',_0x21a397,'request\x20sent');logger[_0x1a32('0xb')](_0x1a32('0xc'),_0x21a397,'request\x20sent',JSON[_0x1a32('0xd')](_0x38f052));if(_0x38f052['error']){if(_0x38f052['error'][_0x1a32('0xe')]===0x1f4){logger[_0x1a32('0xf')](_0x1a32('0x10'),_0x21a397,_0x38f052[_0x1a32('0xf')]['message']);return _0xacf70c(_0x38f052['error']['message']);}logger[_0x1a32('0xf')](_0x1a32('0x10'),_0x21a397,_0x38f052[_0x1a32('0xf')]['message']);return _0x7a0b00(_0x38f052[_0x1a32('0xf')][_0x1a32('0x11')]);}else{logger[_0x1a32('0xa')](_0x1a32('0x10'),_0x21a397,'request\x20sent');_0x7a0b00(_0x38f052[_0x1a32('0x12')]['message']);}})[_0x1a32('0x13')](function(_0x55f69a){logger[_0x1a32('0xf')](_0x1a32('0x10'),_0x21a397,_0x55f69a);_0xacf70c(_0x55f69a);});});}exports['CreateSquareRecording']=function(_0x14af22){var _0x4dc89d=this;return new Promise(function(_0x8a956f,_0x4de4a8){return db[_0x1a32('0x14')][_0x1a32('0x15')](_0x14af22[_0x1a32('0x16')],{'raw':_0x14af22[_0x1a32('0x17')]?_0x14af22[_0x1a32('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1a32('0x9')](function(_0x281ffd){logger[_0x1a32('0xa')]('CreateSquareRecording',_0x14af22);logger[_0x1a32('0xb')](_0x1a32('0x18'),_0x14af22,JSON[_0x1a32('0xd')](_0x281ffd));_0x8a956f(_0x281ffd);})[_0x1a32('0x13')](function(_0x52155c){logger[_0x1a32('0xf')](_0x1a32('0x18'),_0x52155c[_0x1a32('0x11')],_0x14af22);_0x4de4a8(_0x4dc89d['error'](0x1f4,_0x52155c[_0x1a32('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 5b4e516..9988382 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4a4c7a,_0x51f058){var _0x3b2656=function(_0x3c62a9){while(--_0x3c62a9){_0x4a4c7a['push'](_0x4a4c7a['shift']());}};_0x3b2656(++_0x51f058);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=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(_0x482a1c,_0xcecccf){var _0x2dab39=function(_0x314535){while(--_0x314535){_0x482a1c['push'](_0x482a1c['shift']());}};_0x2dab39(++_0xcecccf);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fe1ba27..f00c84d 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 _0x5795=['DATE','sequelize','exports','STRING'];(function(_0x46a4b8,_0x3ffba0){var _0x4f8599=function(_0x591a9b){while(--_0x591a9b){_0x46a4b8['push'](_0x46a4b8['shift']());}};_0x4f8599(++_0x3ffba0);}(_0x5795,0xd1));var _0x5579=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x5795[_0x4d07cc];return _0x42de3b;};'use strict';var Sequelize=require(_0x5579('0x0'));module[_0x5579('0x1')]={'network':{'type':Sequelize[_0x5579('0x2')]},'network_script':{'type':Sequelize[_0x5579('0x2')]},'request':{'type':Sequelize[_0x5579('0x2')]},'channel':{'type':Sequelize[_0x5579('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5579('0x2')]},'callerid':{'type':Sequelize[_0x5579('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x5579('0x2')]},'callingani2':{'type':Sequelize[_0x5579('0x2')]},'callington':{'type':Sequelize[_0x5579('0x2')]},'callingtns':{'type':Sequelize[_0x5579('0x2')]},'dnid':{'type':Sequelize[_0x5579('0x2')]},'rdnis':{'type':Sequelize[_0x5579('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5579('0x2')]},'priority':{'type':Sequelize[_0x5579('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x5579('0x2')]},'project_name':{'type':Sequelize[_0x5579('0x2')]},'joinAt':{'type':Sequelize[_0x5579('0x3')]},'leaveAt':{'type':Sequelize[_0x5579('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3418=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3418,0x6b));var _0x8341=function(_0x5c186f,_0x3f3b7b){_0x5c186f=_0x5c186f-0x0;var _0x1d0c56=_0x3418[_0x5c186f];return _0x1d0c56;};'use strict';var Sequelize=require(_0x8341('0x0'));module['exports']={'network':{'type':Sequelize[_0x8341('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8341('0x1')]},'language':{'type':Sequelize[_0x8341('0x1')]},'type':{'type':Sequelize[_0x8341('0x1')]},'uniqueid':{'type':Sequelize[_0x8341('0x1')]},'version':{'type':Sequelize[_0x8341('0x1')]},'callerid':{'type':Sequelize[_0x8341('0x1')]},'calleridname':{'type':Sequelize[_0x8341('0x1')]},'callingpres':{'type':Sequelize[_0x8341('0x1')]},'callingani2':{'type':Sequelize[_0x8341('0x1')]},'callington':{'type':Sequelize[_0x8341('0x1')]},'callingtns':{'type':Sequelize[_0x8341('0x1')]},'dnid':{'type':Sequelize[_0x8341('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8341('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8341('0x1')]},'threadid':{'type':Sequelize[_0x8341('0x1')]},'project_name':{'type':Sequelize[_0x8341('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8341('0x2')]},'bot':{'type':Sequelize[_0x8341('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 45b5fa1..e93ef38 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 _0xa57c=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','map','type'];(function(_0x2ebb98,_0x5f099c){var _0x163d87=function(_0x4e2bd7){while(--_0x4e2bd7){_0x2ebb98['push'](_0x2ebb98['shift']());}};_0x163d87(++_0x5f099c);}(_0xa57c,0xf1));var _0xca57=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa57c[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0xca57('0x0'));var rimraf=require(_0xca57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca57('0x2'));var rp=require(_0xca57('0x3'));var moment=require('moment');var BPromise=require(_0xca57('0x4'));var Mustache=require('mustache');var util=require(_0xca57('0x5'));var path=require(_0xca57('0x6'));var sox=require(_0xca57('0x7'));var csv=require(_0xca57('0x8'));var ejs=require(_0xca57('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca57('0xa'));var squel=require('squel');var crypto=require(_0xca57('0xb'));var jsforce=require(_0xca57('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca57('0xd'));var Redis=require(_0xca57('0xe'));var authService=require(_0xca57('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xca57('0x10'));var hardwareService=require(_0xca57('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xca57('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xca57('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1353,_0x2e7e9f){_0x2e7e9f=_0x2e7e9f||0xcc;return function(_0x240354){if(_0x240354){return _0x4f1353[_0xca57('0x14')](_0x2e7e9f);}return _0x4f1353[_0xca57('0x15')](_0x2e7e9f)[_0xca57('0x16')]();};}function respondWithResult(_0x24b8e6,_0x2586f2){_0x2586f2=_0x2586f2||0xc8;return function(_0x55277b){if(_0x55277b){return _0x24b8e6[_0xca57('0x15')](_0x2586f2)[_0xca57('0x17')](_0x55277b);}};}function respondWithFilteredResult(_0x4074b0,_0x3602ad){return function(_0x406c11){if(_0x406c11){var _0x2d7758=typeof _0x3602ad[_0xca57('0x18')]===_0xca57('0x19')&&typeof _0x3602ad[_0xca57('0x1a')]===_0xca57('0x19');var _0x583fe2=_0x406c11[_0xca57('0x1b')];var _0x4cbba8=_0x2d7758?0x0:_0x3602ad[_0xca57('0x18')];var _0x1e6cff=_0x2d7758?_0x406c11['count']:_0x3602ad[_0xca57('0x18')]+_0x3602ad['limit'];var _0x43d02a;if(_0x1e6cff>=_0x583fe2){_0x1e6cff=_0x583fe2;_0x43d02a=0xc8;}else{_0x43d02a=0xce;}_0x4074b0[_0xca57('0x15')](_0x43d02a);return _0x4074b0[_0xca57('0x1c')](_0xca57('0x1d'),_0x4cbba8+'-'+_0x1e6cff+'/'+_0x583fe2)[_0xca57('0x17')](_0x406c11);}return null;};}function patchUpdates(_0x33e432){return function(_0x338167){try{jsonpatch[_0xca57('0x1e')](_0x338167,_0x33e432,!![]);}catch(_0x272724){return BPromise['reject'](_0x272724);}return _0x338167[_0xca57('0x1f')]();};}function saveUpdates(_0x5b37b8,_0x337a50){return function(_0x4292dd){if(_0x4292dd){return _0x4292dd['update'](_0x5b37b8)[_0xca57('0x20')](function(_0x5406a9){return _0x5406a9;});}return null;};}function removeEntity(_0x57e8af,_0x5b63d0){return function(_0x49883c){if(_0x49883c){return _0x49883c[_0xca57('0x21')]()[_0xca57('0x20')](function(){_0x57e8af[_0xca57('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1a41,_0x5e10b7){return function(_0x261e2b){if(!_0x261e2b){_0x3b1a41[_0xca57('0x14')](0x194);}return _0x261e2b;};}function handleError(_0x25c977,_0x32426b){_0x32426b=_0x32426b||0x1f4;return function(_0x9c39d2){logger[_0xca57('0x22')](_0x9c39d2['stack']);if(_0x9c39d2['name']){delete _0x9c39d2[_0xca57('0x23')];}_0x25c977['status'](_0x32426b)[_0xca57('0x24')](_0x9c39d2);};}exports['index']=function(_0x443c68,_0x5f33f7){var _0x272506={},_0x5d3511={},_0x38ed2a={'count':0x0,'rows':[]};var _0x2fbcda=_[_0xca57('0x25')](db['SquareReport']['rawAttributes'],function(_0x52a703){return{'name':_0x52a703['fieldName'],'type':_0x52a703[_0xca57('0x26')][_0xca57('0x27')]};});_0x5d3511[_0xca57('0x28')]=_[_0xca57('0x25')](_0x2fbcda,'name');_0x5d3511[_0xca57('0x29')]=_[_0xca57('0x2a')](_0x443c68[_0xca57('0x29')]);_0x5d3511[_0xca57('0x2b')]=_[_0xca57('0x2c')](_0x5d3511[_0xca57('0x28')],_0x5d3511[_0xca57('0x29')]);_0x272506[_0xca57('0x2d')]=_[_0xca57('0x2c')](_0x5d3511[_0xca57('0x28')],qs['fields'](_0x443c68[_0xca57('0x29')][_0xca57('0x2e')]));_0x272506[_0xca57('0x2d')]=_0x272506[_0xca57('0x2d')][_0xca57('0x2f')]?_0x272506[_0xca57('0x2d')]:_0x5d3511[_0xca57('0x28')];if(!_0x443c68['query'][_0xca57('0x30')](_0xca57('0x31'))){_0x272506['limit']=qs[_0xca57('0x1a')](_0x443c68['query'][_0xca57('0x1a')]);_0x272506[_0xca57('0x18')]=qs[_0xca57('0x18')](_0x443c68['query'][_0xca57('0x18')]);}_0x272506[_0xca57('0x32')]=qs[_0xca57('0x33')](_0x443c68[_0xca57('0x29')][_0xca57('0x33')]);_0x272506[_0xca57('0x34')]=qs[_0xca57('0x2b')](_[_0xca57('0x35')](_0x443c68[_0xca57('0x29')],_0x5d3511[_0xca57('0x2b')]),_0x2fbcda);if(_0x443c68[_0xca57('0x29')][_0xca57('0x36')]){_0x272506[_0xca57('0x34')]=_[_0xca57('0x37')](_0x272506[_0xca57('0x34')],{'$or':_[_0xca57('0x25')](_0x2fbcda,function(_0x2460f5){if(_0x2460f5[_0xca57('0x26')]!==_0xca57('0x38')){var _0x49146d={};_0x49146d[_0x2460f5[_0xca57('0x23')]]={'$like':'%'+_0x443c68[_0xca57('0x29')][_0xca57('0x36')]+'%'};return _0x49146d;}})});}_0x272506=_[_0xca57('0x37')]({},_0x272506,_0x443c68[_0xca57('0x39')]);var _0x58515b={'where':_0x272506[_0xca57('0x34')]};return db[_0xca57('0x3a')][_0xca57('0x1b')](_0x58515b)[_0xca57('0x20')](function(_0x566a4a){_0x38ed2a[_0xca57('0x1b')]=_0x566a4a;if(_0x443c68['query'][_0xca57('0x3b')]){_0x272506['include']=[{'all':!![]}];}return db['SquareReport'][_0xca57('0x3c')](_0x272506);})[_0xca57('0x20')](function(_0x1bc53b){_0x38ed2a[_0xca57('0x3d')]=_0x1bc53b;return _0x38ed2a;})[_0xca57('0x20')](respondWithFilteredResult(_0x5f33f7,_0x272506))[_0xca57('0x3e')](handleError(_0x5f33f7,null));};exports[_0xca57('0x3f')]=function(_0x239ccd,_0x34de7e){var _0x3f3c55={'raw':!![],'where':{'id':_0x239ccd[_0xca57('0x40')]['id']}},_0x4d078e={};_0x4d078e[_0xca57('0x28')]=_['keys'](db[_0xca57('0x3a')][_0xca57('0x41')]);_0x4d078e[_0xca57('0x29')]=_[_0xca57('0x2a')](_0x239ccd[_0xca57('0x29')]);_0x4d078e[_0xca57('0x2b')]=_[_0xca57('0x2c')](_0x4d078e[_0xca57('0x28')],_0x4d078e['query']);_0x3f3c55[_0xca57('0x2d')]=_[_0xca57('0x2c')](_0x4d078e[_0xca57('0x28')],qs[_0xca57('0x2e')](_0x239ccd[_0xca57('0x29')]['fields']));_0x3f3c55[_0xca57('0x2d')]=_0x3f3c55[_0xca57('0x2d')][_0xca57('0x2f')]?_0x3f3c55[_0xca57('0x2d')]:_0x4d078e['model'];if(_0x239ccd['query'][_0xca57('0x3b')]){_0x3f3c55['include']=[{'all':!![]}];}_0x3f3c55=_[_0xca57('0x37')]({},_0x3f3c55,_0x239ccd[_0xca57('0x39')]);return db[_0xca57('0x3a')][_0xca57('0x42')](_0x3f3c55)[_0xca57('0x20')](handleEntityNotFound(_0x34de7e,null))[_0xca57('0x20')](respondWithResult(_0x34de7e,null))['catch'](handleError(_0x34de7e,null));};exports[_0xca57('0x43')]=function(_0x538dde,_0x37ddf7){return db[_0xca57('0x3a')][_0xca57('0x43')](_0x538dde[_0xca57('0x44')],{})[_0xca57('0x20')](respondWithResult(_0x37ddf7,0xc9))[_0xca57('0x3e')](handleError(_0x37ddf7,null));};exports['update']=function(_0x30e0ea,_0x3f065f){if(_0x30e0ea['body']['id']){delete _0x30e0ea[_0xca57('0x44')]['id'];}return db['SquareReport'][_0xca57('0x42')]({'where':{'id':_0x30e0ea[_0xca57('0x40')]['id']}})[_0xca57('0x20')](handleEntityNotFound(_0x3f065f,null))[_0xca57('0x20')](saveUpdates(_0x30e0ea[_0xca57('0x44')],null))[_0xca57('0x20')](respondWithResult(_0x3f065f,null))[_0xca57('0x3e')](handleError(_0x3f065f,null));};exports[_0xca57('0x21')]=function(_0x9adb41,_0x43d658){return db[_0xca57('0x3a')][_0xca57('0x42')]({'where':{'id':_0x9adb41['params']['id']}})['then'](handleEntityNotFound(_0x43d658,null))[_0xca57('0x20')](removeEntity(_0x43d658,null))[_0xca57('0x3e')](handleError(_0x43d658,null));};exports[_0xca57('0x45')]=function(_0x5e1734,_0x375abd){return db[_0xca57('0x3a')]['describe']()[_0xca57('0x20')](respondWithResult(_0x375abd,null))[_0xca57('0x3e')](handleError(_0x375abd,null));}; \ No newline at end of file +var _0x93f9=['save','update','then','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','SquareReport','includeAll','include','rows','catch','show','params','keys','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0xe98f85,_0x2e4ce2){var _0x19f549=function(_0x341f4d){while(--_0x341f4d){_0xe98f85['push'](_0xe98f85['shift']());}};_0x19f549(++_0x2e4ce2);}(_0x93f9,0x77));var _0x993f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x93f9[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x993f('0x0'));var rimraf=require(_0x993f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x993f('0x2'));var rp=require('request-promise');var moment=require(_0x993f('0x3'));var BPromise=require(_0x993f('0x4'));var Mustache=require(_0x993f('0x5'));var util=require('util');var path=require(_0x993f('0x6'));var sox=require('sox');var csv=require(_0x993f('0x7'));var ejs=require(_0x993f('0x8'));var fs=require('fs');var fs_extra=require(_0x993f('0x9'));var _=require(_0x993f('0xa'));var squel=require(_0x993f('0xb'));var crypto=require(_0x993f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x993f('0xd'));var toCsv=require(_0x993f('0x7'));var querystring=require('querystring');var Papa=require(_0x993f('0xe'));var Redis=require(_0x993f('0xf'));var authService=require(_0x993f('0x10'));var qs=require(_0x993f('0x11'));var as=require(_0x993f('0x12'));var hardwareService=require(_0x993f('0x13'));var logger=require(_0x993f('0x14'))('api');var utils=require(_0x993f('0x15'));var config=require(_0x993f('0x16'));var licenseUtil=require(_0x993f('0x17'));var db=require(_0x993f('0x18'))['db'];function respondWithStatusCode(_0x436373,_0x33f256){_0x33f256=_0x33f256||0xcc;return function(_0x545b7){if(_0x545b7){return _0x436373['sendStatus'](_0x33f256);}return _0x436373[_0x993f('0x19')](_0x33f256)['end']();};}function respondWithResult(_0x859f91,_0x77e34){_0x77e34=_0x77e34||0xc8;return function(_0x2fd64d){if(_0x2fd64d){return _0x859f91[_0x993f('0x19')](_0x77e34)['json'](_0x2fd64d);}};}function respondWithFilteredResult(_0x42dbbf,_0x5dd26b){return function(_0x5ac616){if(_0x5ac616){var _0x3cbab3=typeof _0x5dd26b[_0x993f('0x1a')]===_0x993f('0x1b')&&typeof _0x5dd26b[_0x993f('0x1c')]===_0x993f('0x1b');var _0x4c3957=_0x5ac616[_0x993f('0x1d')];var _0x5c6f00=_0x3cbab3?0x0:_0x5dd26b[_0x993f('0x1a')];var _0x116c7d=_0x3cbab3?_0x5ac616[_0x993f('0x1d')]:_0x5dd26b[_0x993f('0x1a')]+_0x5dd26b['limit'];var _0x22f33b;if(_0x116c7d>=_0x4c3957){_0x116c7d=_0x4c3957;_0x22f33b=0xc8;}else{_0x22f33b=0xce;}_0x42dbbf['status'](_0x22f33b);return _0x42dbbf['set'](_0x993f('0x1e'),_0x5c6f00+'-'+_0x116c7d+'/'+_0x4c3957)['json'](_0x5ac616);}return null;};}function patchUpdates(_0x10f7fd){return function(_0x5d379c){try{jsonpatch[_0x993f('0x1f')](_0x5d379c,_0x10f7fd,!![]);}catch(_0x56e8ce){return BPromise[_0x993f('0x20')](_0x56e8ce);}return _0x5d379c[_0x993f('0x21')]();};}function saveUpdates(_0x256d40,_0x294146){return function(_0x54e93f){if(_0x54e93f){return _0x54e93f[_0x993f('0x22')](_0x256d40)[_0x993f('0x23')](function(_0x3cf952){return _0x3cf952;});}return null;};}function removeEntity(_0x1b8fff,_0xb95c53){return function(_0x137030){if(_0x137030){return _0x137030['destroy']()['then'](function(){_0x1b8fff[_0x993f('0x19')](0xcc)[_0x993f('0x24')]();});}};}function handleEntityNotFound(_0x3356e2,_0x3c22b1){return function(_0x2b8642){if(!_0x2b8642){_0x3356e2[_0x993f('0x25')](0x194);}return _0x2b8642;};}function handleError(_0x206a2a,_0x1e44bf){_0x1e44bf=_0x1e44bf||0x1f4;return function(_0x5ab037){logger['error'](_0x5ab037[_0x993f('0x26')]);if(_0x5ab037['name']){delete _0x5ab037[_0x993f('0x27')];}_0x206a2a[_0x993f('0x19')](_0x1e44bf)[_0x993f('0x28')](_0x5ab037);};}exports[_0x993f('0x29')]=function(_0x2f211c,_0x5ee59a){var _0x43f4aa={},_0x1fd3f0={},_0x442cdc={'count':0x0,'rows':[]};var _0x344830=_['map'](db['SquareReport'][_0x993f('0x2a')],function(_0x55fd92){return{'name':_0x55fd92[_0x993f('0x2b')],'type':_0x55fd92[_0x993f('0x2c')][_0x993f('0x2d')]};});_0x1fd3f0['model']=_[_0x993f('0x2e')](_0x344830,_0x993f('0x27'));_0x1fd3f0['query']=_['keys'](_0x2f211c['query']);_0x1fd3f0[_0x993f('0x2f')]=_[_0x993f('0x30')](_0x1fd3f0[_0x993f('0x31')],_0x1fd3f0[_0x993f('0x32')]);_0x43f4aa[_0x993f('0x33')]=_['intersection'](_0x1fd3f0[_0x993f('0x31')],qs[_0x993f('0x34')](_0x2f211c[_0x993f('0x32')][_0x993f('0x34')]));_0x43f4aa[_0x993f('0x33')]=_0x43f4aa[_0x993f('0x33')][_0x993f('0x35')]?_0x43f4aa[_0x993f('0x33')]:_0x1fd3f0['model'];if(!_0x2f211c[_0x993f('0x32')][_0x993f('0x36')](_0x993f('0x37'))){_0x43f4aa[_0x993f('0x1c')]=qs[_0x993f('0x1c')](_0x2f211c[_0x993f('0x32')][_0x993f('0x1c')]);_0x43f4aa[_0x993f('0x1a')]=qs[_0x993f('0x1a')](_0x2f211c['query'][_0x993f('0x1a')]);}_0x43f4aa[_0x993f('0x38')]=qs[_0x993f('0x39')](_0x2f211c['query'][_0x993f('0x39')]);_0x43f4aa['where']=qs[_0x993f('0x2f')](_[_0x993f('0x3a')](_0x2f211c[_0x993f('0x32')],_0x1fd3f0[_0x993f('0x2f')]),_0x344830);if(_0x2f211c[_0x993f('0x32')][_0x993f('0x3b')]){_0x43f4aa['where']=_['merge'](_0x43f4aa[_0x993f('0x3c')],{'$or':_[_0x993f('0x2e')](_0x344830,function(_0x369498){if(_0x369498[_0x993f('0x2c')]!=='VIRTUAL'){var _0x192c86={};_0x192c86[_0x369498[_0x993f('0x27')]]={'$like':'%'+_0x2f211c[_0x993f('0x32')][_0x993f('0x3b')]+'%'};return _0x192c86;}})});}_0x43f4aa=_[_0x993f('0x3d')]({},_0x43f4aa,_0x2f211c['options']);var _0x252312={'where':_0x43f4aa[_0x993f('0x3c')]};return db[_0x993f('0x3e')][_0x993f('0x1d')](_0x252312)[_0x993f('0x23')](function(_0x15127d){_0x442cdc[_0x993f('0x1d')]=_0x15127d;if(_0x2f211c[_0x993f('0x32')][_0x993f('0x3f')]){_0x43f4aa[_0x993f('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x43f4aa);})[_0x993f('0x23')](function(_0x5719aa){_0x442cdc[_0x993f('0x41')]=_0x5719aa;return _0x442cdc;})[_0x993f('0x23')](respondWithFilteredResult(_0x5ee59a,_0x43f4aa))[_0x993f('0x42')](handleError(_0x5ee59a,null));};exports[_0x993f('0x43')]=function(_0x48c81f,_0x236c7b){var _0x1cb6af={'raw':!![],'where':{'id':_0x48c81f[_0x993f('0x44')]['id']}},_0x2756b3={};_0x2756b3[_0x993f('0x31')]=_['keys'](db[_0x993f('0x3e')][_0x993f('0x2a')]);_0x2756b3['query']=_[_0x993f('0x45')](_0x48c81f['query']);_0x2756b3[_0x993f('0x2f')]=_[_0x993f('0x30')](_0x2756b3[_0x993f('0x31')],_0x2756b3[_0x993f('0x32')]);_0x1cb6af['attributes']=_[_0x993f('0x30')](_0x2756b3[_0x993f('0x31')],qs[_0x993f('0x34')](_0x48c81f[_0x993f('0x32')][_0x993f('0x34')]));_0x1cb6af[_0x993f('0x33')]=_0x1cb6af[_0x993f('0x33')][_0x993f('0x35')]?_0x1cb6af[_0x993f('0x33')]:_0x2756b3[_0x993f('0x31')];if(_0x48c81f[_0x993f('0x32')][_0x993f('0x3f')]){_0x1cb6af[_0x993f('0x40')]=[{'all':!![]}];}_0x1cb6af=_[_0x993f('0x3d')]({},_0x1cb6af,_0x48c81f[_0x993f('0x46')]);return db[_0x993f('0x3e')][_0x993f('0x47')](_0x1cb6af)[_0x993f('0x23')](handleEntityNotFound(_0x236c7b,null))[_0x993f('0x23')](respondWithResult(_0x236c7b,null))[_0x993f('0x42')](handleError(_0x236c7b,null));};exports[_0x993f('0x48')]=function(_0x404c6e,_0x147e09){return db[_0x993f('0x3e')]['create'](_0x404c6e[_0x993f('0x49')],{})[_0x993f('0x23')](respondWithResult(_0x147e09,0xc9))['catch'](handleError(_0x147e09,null));};exports[_0x993f('0x22')]=function(_0x5149e5,_0x599f72){if(_0x5149e5['body']['id']){delete _0x5149e5[_0x993f('0x49')]['id'];}return db[_0x993f('0x3e')][_0x993f('0x47')]({'where':{'id':_0x5149e5[_0x993f('0x44')]['id']}})[_0x993f('0x23')](handleEntityNotFound(_0x599f72,null))['then'](saveUpdates(_0x5149e5['body'],null))[_0x993f('0x23')](respondWithResult(_0x599f72,null))[_0x993f('0x42')](handleError(_0x599f72,null));};exports[_0x993f('0x4a')]=function(_0x2b6a21,_0x240310){return db[_0x993f('0x3e')][_0x993f('0x47')]({'where':{'id':_0x2b6a21[_0x993f('0x44')]['id']}})[_0x993f('0x23')](handleEntityNotFound(_0x240310,null))[_0x993f('0x23')](removeEntity(_0x240310,null))[_0x993f('0x42')](handleError(_0x240310,null));};exports['describe']=function(_0x2467ef,_0x632a45){return db[_0x993f('0x3e')][_0x993f('0x4b')]()['then'](respondWithResult(_0x632a45,null))[_0x993f('0x42')](handleError(_0x632a45,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3ef02cd..c617821 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 _0xa76f=['project_name','leaveAt','lodash','util','../../config/logger','bluebird','path','./squareReport.attributes','exports','SquareReport','report_square','uniqueid'];(function(_0x4beff1,_0x26db76){var _0x1917b8=function(_0x329af3){while(--_0x329af3){_0x4beff1['push'](_0x4beff1['shift']());}};_0x1917b8(++_0x26db76);}(_0xa76f,0xfe));var _0xfa76=function(_0x4b10e1,_0x4a4196){_0x4b10e1=_0x4b10e1-0x0;var _0x13829a=_0xa76f[_0x4b10e1];return _0x13829a;};'use strict';var _=require(_0xfa76('0x0'));var util=require(_0xfa76('0x1'));var logger=require(_0xfa76('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa76('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa76('0x5'));module[_0xfa76('0x6')]=function(_0x5b66f3,_0x4775f9){return _0x5b66f3['define'](_0xfa76('0x7'),attributes,{'tableName':_0xfa76('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xfa76('0x9'),_0xfa76('0xa')]},{'name':_0xfa76('0xb'),'fields':[_0xfa76('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a82=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','uid_pname','util','../../config/logger','moment'];(function(_0x2f3e44,_0x459e06){var _0x4306ec=function(_0x55a660){while(--_0x55a660){_0x2f3e44['push'](_0x2f3e44['shift']());}};_0x4306ec(++_0x459e06);}(_0x3a82,0x16f));var _0x23a8=function(_0x2f0e60,_0x22c602){_0x2f0e60=_0x2f0e60-0x0;var _0x283e09=_0x3a82[_0x2f0e60];return _0x283e09;};'use strict';var _=require('lodash');var util=require(_0x23a8('0x0'));var logger=require(_0x23a8('0x1'))('api');var moment=require(_0x23a8('0x2'));var BPromise=require(_0x23a8('0x3'));var rp=require(_0x23a8('0x4'));var fs=require('fs');var path=require(_0x23a8('0x5'));var rimraf=require(_0x23a8('0x6'));var config=require(_0x23a8('0x7'));var attributes=require(_0x23a8('0x8'));module['exports']=function(_0x224ec1,_0x50263a){return _0x224ec1['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x23a8('0x9'),'fields':['uniqueid','project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8072970..d69f01c 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 _0x0765=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','then','stringify','catch','UpdateSquareReport','update','attributes','limit','lodash','moment','bluebird'];(function(_0x16a3b1,_0x34f0c6){var _0x4914b8=function(_0x198157){while(--_0x198157){_0x16a3b1['push'](_0x16a3b1['shift']());}};_0x4914b8(++_0x34f0c6);}(_0x0765,0x17e));var _0x5076=function(_0x5214e1,_0x30f6d2){_0x5214e1=_0x5214e1-0x0;var _0x3b7dd4=_0x0765[_0x5214e1];return _0x3b7dd4;};'use strict';var _=require(_0x5076('0x0'));var util=require('util');var moment=require(_0x5076('0x1'));var BPromise=require(_0x5076('0x2'));var rs=require(_0x5076('0x3'));var fs=require('fs');var Redis=require(_0x5076('0x4'));var db=require(_0x5076('0x5'))['db'];var utils=require(_0x5076('0x6'));var logger=require(_0x5076('0x7'))(_0x5076('0x8'));var config=require(_0x5076('0x9'));var jayson=require(_0x5076('0xa'));var client=jayson[_0x5076('0xb')][_0x5076('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21e06,_0xd1fd2f,_0x5996ba){return new BPromise(function(_0x5a6069,_0x1dcc73){return client[_0x5076('0xd')](_0x21e06,_0x5996ba)['then'](function(_0x3cd670){logger[_0x5076('0xe')](_0x5076('0xf'),_0xd1fd2f,_0x5076('0x10'));logger[_0x5076('0x11')](_0x5076('0x12'),_0xd1fd2f,_0x5076('0x10'),JSON['stringify'](_0x3cd670));if(_0x3cd670[_0x5076('0x13')]){if(_0x3cd670['error'][_0x5076('0x14')]===0x1f4){logger['error'](_0x5076('0xf'),_0xd1fd2f,_0x3cd670[_0x5076('0x13')]['message']);return _0x1dcc73(_0x3cd670['error'][_0x5076('0x15')]);}logger[_0x5076('0x13')](_0x5076('0xf'),_0xd1fd2f,_0x3cd670['error'][_0x5076('0x15')]);return _0x5a6069(_0x3cd670[_0x5076('0x13')]['message']);}else{logger[_0x5076('0xe')](_0x5076('0xf'),_0xd1fd2f,_0x5076('0x10'));_0x5a6069(_0x3cd670[_0x5076('0x16')]['message']);}})['catch'](function(_0x517020){logger[_0x5076('0x13')]('SquareReport,\x20%s,\x20%s',_0xd1fd2f,_0x517020);_0x1dcc73(_0x517020);});});}exports[_0x5076('0x17')]=function(_0x1e3625){var _0x203353=this;return new Promise(function(_0x2cbcc1,_0x4a6afe){return db[_0x5076('0x18')][_0x5076('0x19')](_0x1e3625[_0x5076('0x1a')],{'raw':_0x1e3625['options']?_0x1e3625[_0x5076('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x5076('0x1c')](function(_0x20b6b6){logger[_0x5076('0xe')]('CreateSquareReport',_0x1e3625);logger[_0x5076('0x11')](_0x5076('0x17'),_0x1e3625,JSON[_0x5076('0x1d')](_0x20b6b6));_0x2cbcc1(_0x20b6b6);})[_0x5076('0x1e')](function(_0x55cfaf){logger['error']('CreateSquareReport',_0x55cfaf[_0x5076('0x15')],_0x1e3625);_0x4a6afe(_0x203353[_0x5076('0x13')](0x1f4,_0x55cfaf[_0x5076('0x15')]));});});};exports[_0x5076('0x1f')]=function(_0x4cf7b6){var _0x58dfce=this;return new Promise(function(_0x17ad15,_0x3955fd){return db[_0x5076('0x18')][_0x5076('0x20')](_0x4cf7b6[_0x5076('0x1a')],{'raw':_0x4cf7b6['options']?_0x4cf7b6[_0x5076('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cf7b6[_0x5076('0x1b')]?_0x4cf7b6['options']['where']||null:null,'attributes':_0x4cf7b6[_0x5076('0x1b')]?_0x4cf7b6[_0x5076('0x1b')][_0x5076('0x21')]||null:null,'limit':_0x4cf7b6[_0x5076('0x1b')]?_0x4cf7b6[_0x5076('0x1b')][_0x5076('0x22')]||null:null})[_0x5076('0x1c')](function(_0x3dc96a){logger[_0x5076('0xe')](_0x5076('0x1f'),_0x4cf7b6);logger['debug'](_0x5076('0x1f'),_0x4cf7b6,JSON['stringify'](_0x3dc96a));_0x17ad15(_0x3dc96a);})[_0x5076('0x1e')](function(_0x3cd1f){logger[_0x5076('0x13')]('UpdateSquareReport',_0x3cd1f[_0x5076('0x15')],_0x4cf7b6);_0x3955fd(_0x58dfce[_0x5076('0x13')](0x1f4,_0x3cd1f[_0x5076('0x15')]));});});}; \ No newline at end of file +var _0x42b9=['../../config/environment','jayson/promise','client','request','then','info','debug','stringify','error','code','SquareReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x42b9,0xc9));var _0x942b=function(_0xb342c0,_0x57c0dd){_0xb342c0=_0xb342c0-0x0;var _0x191031=_0x42b9[_0xb342c0];return _0x191031;};'use strict';var _=require('lodash');var util=require(_0x942b('0x0'));var moment=require(_0x942b('0x1'));var BPromise=require(_0x942b('0x2'));var rs=require(_0x942b('0x3'));var fs=require('fs');var Redis=require(_0x942b('0x4'));var db=require(_0x942b('0x5'))['db'];var utils=require(_0x942b('0x6'));var logger=require(_0x942b('0x7'))(_0x942b('0x8'));var config=require(_0x942b('0x9'));var jayson=require(_0x942b('0xa'));var client=jayson[_0x942b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x96d6c6,_0x783911,_0x2219f7){return new BPromise(function(_0x4f8850,_0x478bfb){return client[_0x942b('0xc')](_0x96d6c6,_0x2219f7)[_0x942b('0xd')](function(_0x28e7d0){logger[_0x942b('0xe')]('SquareReport,\x20%s,\x20%s',_0x783911,'request\x20sent');logger[_0x942b('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x783911,'request\x20sent',JSON[_0x942b('0x10')](_0x28e7d0));if(_0x28e7d0[_0x942b('0x11')]){if(_0x28e7d0[_0x942b('0x11')][_0x942b('0x12')]===0x1f4){logger[_0x942b('0x11')](_0x942b('0x13'),_0x783911,_0x28e7d0[_0x942b('0x11')][_0x942b('0x14')]);return _0x478bfb(_0x28e7d0[_0x942b('0x11')][_0x942b('0x14')]);}logger['error'](_0x942b('0x13'),_0x783911,_0x28e7d0[_0x942b('0x11')][_0x942b('0x14')]);return _0x4f8850(_0x28e7d0[_0x942b('0x11')][_0x942b('0x14')]);}else{logger[_0x942b('0xe')]('SquareReport,\x20%s,\x20%s',_0x783911,_0x942b('0x15'));_0x4f8850(_0x28e7d0[_0x942b('0x16')][_0x942b('0x14')]);}})[_0x942b('0x17')](function(_0x431443){logger[_0x942b('0x11')](_0x942b('0x13'),_0x783911,_0x431443);_0x478bfb(_0x431443);});});}exports[_0x942b('0x18')]=function(_0x437dd0){var _0xcbf5fe=this;return new Promise(function(_0x1054ca,_0x2621b6){return db['SquareReport'][_0x942b('0x19')](_0x437dd0[_0x942b('0x1a')],{'raw':_0x437dd0['options']?_0x437dd0[_0x942b('0x1b')][_0x942b('0x1c')]===undefined?!![]:![]:!![]})[_0x942b('0xd')](function(_0x1197c1){logger['info'](_0x942b('0x18'),_0x437dd0);logger['debug'](_0x942b('0x18'),_0x437dd0,JSON[_0x942b('0x10')](_0x1197c1));_0x1054ca(_0x1197c1);})[_0x942b('0x17')](function(_0x1b0894){logger['error'](_0x942b('0x18'),_0x1b0894['message'],_0x437dd0);_0x2621b6(_0xcbf5fe['error'](0x1f4,_0x1b0894['message']));});});};exports[_0x942b('0x1d')]=function(_0x400007){var _0x350d9c=this;return new Promise(function(_0x37fa1b,_0x4e9443){return db[_0x942b('0x1e')][_0x942b('0x1f')](_0x400007['body'],{'raw':_0x400007['options']?_0x400007[_0x942b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x400007[_0x942b('0x1b')]?_0x400007['options'][_0x942b('0x20')]||null:null,'attributes':_0x400007[_0x942b('0x1b')]?_0x400007['options'][_0x942b('0x21')]||null:null,'limit':_0x400007[_0x942b('0x1b')]?_0x400007['options'][_0x942b('0x22')]||null:null})['then'](function(_0x7275b0){logger[_0x942b('0xe')](_0x942b('0x1d'),_0x400007);logger[_0x942b('0xf')]('UpdateSquareReport',_0x400007,JSON['stringify'](_0x7275b0));_0x37fa1b(_0x7275b0);})[_0x942b('0x17')](function(_0x18db98){logger[_0x942b('0x11')](_0x942b('0x1d'),_0x18db98[_0x942b('0x14')],_0x400007);_0x4e9443(_0x350d9c[_0x942b('0x11')](0x1f4,_0x18db98[_0x942b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b63b963..9e46452 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 _0x1f0a=['delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x448ff8,_0x5254f){var _0x38eea7=function(_0x14df4c){while(--_0x14df4c){_0x448ff8['push'](_0x448ff8['shift']());}};_0x38eea7(++_0x5254f);}(_0x1f0a,0x155));var _0xa1f0=function(_0xe1d0b2,_0x522a62){_0xe1d0b2=_0xe1d0b2-0x0;var _0x361185=_0x1f0a[_0xe1d0b2];return _0x361185;};'use strict';var multer=require(_0xa1f0('0x0'));var util=require(_0xa1f0('0x1'));var path=require(_0xa1f0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1f0('0x3'));var router=express['Router']();var fs_extra=require(_0xa1f0('0x4'));var auth=require(_0xa1f0('0x5'));var interaction=require(_0xa1f0('0x6'));var config=require(_0xa1f0('0x7'));var controller=require(_0xa1f0('0x8'));router[_0xa1f0('0x9')]('/',auth[_0xa1f0('0xa')](),controller[_0xa1f0('0xb')]);router[_0xa1f0('0x9')]('/describe',auth[_0xa1f0('0xa')](),controller[_0xa1f0('0xc')]);router[_0xa1f0('0x9')](_0xa1f0('0xd'),auth['isAuthenticated'](),controller[_0xa1f0('0xe')]);router[_0xa1f0('0xf')]('/',auth['isAuthenticated'](),controller[_0xa1f0('0x10')]);router[_0xa1f0('0x11')]('/:id',auth[_0xa1f0('0xa')](),controller[_0xa1f0('0x12')]);router[_0xa1f0('0x13')](_0xa1f0('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8b46=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8b46,0x108));var _0x68b4=function(_0x45673b,_0x7a4c21){_0x45673b=_0x45673b-0x0;var _0x5af26d=_0x8b46[_0x45673b];return _0x5af26d;};'use strict';var multer=require(_0x68b4('0x0'));var util=require(_0x68b4('0x1'));var path=require(_0x68b4('0x2'));var timeout=require(_0x68b4('0x3'));var express=require(_0x68b4('0x4'));var router=express[_0x68b4('0x5')]();var fs_extra=require(_0x68b4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68b4('0x7'));var config=require(_0x68b4('0x8'));var controller=require(_0x68b4('0x9'));router[_0x68b4('0xa')]('/',auth[_0x68b4('0xb')](),controller[_0x68b4('0xc')]);router[_0x68b4('0xa')](_0x68b4('0xd'),auth['isAuthenticated'](),controller[_0x68b4('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x68b4('0xf')]);router[_0x68b4('0x10')]('/',auth['isAuthenticated'](),controller[_0x68b4('0x11')]);router[_0x68b4('0x12')](_0x68b4('0x13'),auth['isAuthenticated'](),controller[_0x68b4('0x14')]);router[_0x68b4('0x15')]('/:id',auth[_0x68b4('0xb')](),controller[_0x68b4('0x16')]);module[_0x68b4('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 44494a9..85e1873 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 _0xc686=['STRING'];(function(_0x707193,_0x5ae152){var _0xbaedaa=function(_0x46a1ef){while(--_0x46a1ef){_0x707193['push'](_0x707193['shift']());}};_0xbaedaa(++_0x5ae152);}(_0xc686,0x148));var _0x6c68=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xc686[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6c68('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6c68('0x0')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x6c68('0x0')]},'callerid':{'type':Sequelize[_0x6c68('0x0')]}}; \ No newline at end of file +var _0x4fa6=['exports','STRING','TEXT','sequelize'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x4fa6,0xc3));var _0x64fa=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x4fa6[_0x40a825];return _0x273a54;};'use strict';var Sequelize=require(_0x64fa('0x0'));module[_0x64fa('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x64fa('0x2')]},'application':{'type':Sequelize[_0x64fa('0x2')]},'data':{'type':Sequelize[_0x64fa('0x3')]},'project_name':{'type':Sequelize[_0x64fa('0x2')]},'callerid':{'type':Sequelize[_0x64fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index cd025d0..fee6808 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 _0xf3e7=['findAll','rows','catch','params','keys','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','SquareDetailsReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include'];(function(_0x21ca85,_0x1c359d){var _0x116f7e=function(_0x2f15db){while(--_0x2f15db){_0x21ca85['push'](_0x21ca85['shift']());}};_0x116f7e(++_0x1c359d);}(_0xf3e7,0x1c9));var _0x7f3e=function(_0xe322c,_0x3226f9){_0xe322c=_0xe322c-0x0;var _0x3436b0=_0xf3e7[_0xe322c];return _0x3436b0;};'use strict';var emlformat=require(_0x7f3e('0x0'));var rimraf=require(_0x7f3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f3e('0x2'));var rp=require('request-promise');var moment=require(_0x7f3e('0x3'));var BPromise=require(_0x7f3e('0x4'));var Mustache=require(_0x7f3e('0x5'));var util=require(_0x7f3e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f3e('0x7'));var fs=require('fs');var fs_extra=require(_0x7f3e('0x8'));var _=require(_0x7f3e('0x9'));var squel=require(_0x7f3e('0xa'));var crypto=require(_0x7f3e('0xb'));var jsforce=require(_0x7f3e('0xc'));var deskjs=require(_0x7f3e('0xd'));var toCsv=require(_0x7f3e('0xe'));var querystring=require(_0x7f3e('0xf'));var Papa=require(_0x7f3e('0x10'));var Redis=require(_0x7f3e('0x11'));var authService=require(_0x7f3e('0x12'));var qs=require(_0x7f3e('0x13'));var as=require(_0x7f3e('0x14'));var hardwareService=require(_0x7f3e('0x15'));var logger=require(_0x7f3e('0x16'))(_0x7f3e('0x17'));var utils=require(_0x7f3e('0x18'));var config=require(_0x7f3e('0x19'));var licenseUtil=require(_0x7f3e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4759a7,_0x29a100){_0x29a100=_0x29a100||0xcc;return function(_0x5bdc12){if(_0x5bdc12){return _0x4759a7[_0x7f3e('0x1b')](_0x29a100);}return _0x4759a7[_0x7f3e('0x1c')](_0x29a100)['end']();};}function respondWithResult(_0x4f7b9e,_0x360d8d){_0x360d8d=_0x360d8d||0xc8;return function(_0x1da648){if(_0x1da648){return _0x4f7b9e[_0x7f3e('0x1c')](_0x360d8d)[_0x7f3e('0x1d')](_0x1da648);}};}function respondWithFilteredResult(_0x775d13,_0x13fe18){return function(_0x14202e){if(_0x14202e){var _0x214212=typeof _0x13fe18[_0x7f3e('0x1e')]==='undefined'&&typeof _0x13fe18[_0x7f3e('0x1f')]===_0x7f3e('0x20');var _0x5034a3=_0x14202e[_0x7f3e('0x21')];var _0x13a354=_0x214212?0x0:_0x13fe18[_0x7f3e('0x1e')];var _0x458a71=_0x214212?_0x14202e[_0x7f3e('0x21')]:_0x13fe18[_0x7f3e('0x1e')]+_0x13fe18[_0x7f3e('0x1f')];var _0x99a4b4;if(_0x458a71>=_0x5034a3){_0x458a71=_0x5034a3;_0x99a4b4=0xc8;}else{_0x99a4b4=0xce;}_0x775d13[_0x7f3e('0x1c')](_0x99a4b4);return _0x775d13['set'](_0x7f3e('0x22'),_0x13a354+'-'+_0x458a71+'/'+_0x5034a3)[_0x7f3e('0x1d')](_0x14202e);}return null;};}function patchUpdates(_0x2b1421){return function(_0x19178a){try{jsonpatch[_0x7f3e('0x23')](_0x19178a,_0x2b1421,!![]);}catch(_0x4c8c7d){return BPromise[_0x7f3e('0x24')](_0x4c8c7d);}return _0x19178a[_0x7f3e('0x25')]();};}function saveUpdates(_0x55dc64,_0x5afdf6){return function(_0x49c89d){if(_0x49c89d){return _0x49c89d[_0x7f3e('0x26')](_0x55dc64)[_0x7f3e('0x27')](function(_0x24673b){return _0x24673b;});}return null;};}function removeEntity(_0x12f381,_0xb7cb54){return function(_0x15ee55){if(_0x15ee55){return _0x15ee55[_0x7f3e('0x28')]()[_0x7f3e('0x27')](function(){_0x12f381[_0x7f3e('0x1c')](0xcc)[_0x7f3e('0x29')]();});}};}function handleEntityNotFound(_0x1645c9,_0xd754c4){return function(_0x3b32e9){if(!_0x3b32e9){_0x1645c9['sendStatus'](0x194);}return _0x3b32e9;};}function handleError(_0x168cbd,_0x452167){_0x452167=_0x452167||0x1f4;return function(_0x1382c8){logger[_0x7f3e('0x2a')](_0x1382c8[_0x7f3e('0x2b')]);if(_0x1382c8['name']){delete _0x1382c8[_0x7f3e('0x2c')];}_0x168cbd[_0x7f3e('0x1c')](_0x452167)['send'](_0x1382c8);};}exports[_0x7f3e('0x2d')]=function(_0x51a080,_0x497aba){var _0x4437fd={},_0x4c6796={},_0x43da1e={'count':0x0,'rows':[]};var _0xe58f6=_['map'](db[_0x7f3e('0x2e')][_0x7f3e('0x2f')],function(_0x55f46b){return{'name':_0x55f46b['fieldName'],'type':_0x55f46b[_0x7f3e('0x30')][_0x7f3e('0x31')]};});_0x4c6796[_0x7f3e('0x32')]=_['map'](_0xe58f6,_0x7f3e('0x2c'));_0x4c6796[_0x7f3e('0x33')]=_['keys'](_0x51a080[_0x7f3e('0x33')]);_0x4c6796[_0x7f3e('0x34')]=_[_0x7f3e('0x35')](_0x4c6796[_0x7f3e('0x32')],_0x4c6796[_0x7f3e('0x33')]);_0x4437fd[_0x7f3e('0x36')]=_[_0x7f3e('0x35')](_0x4c6796['model'],qs[_0x7f3e('0x37')](_0x51a080['query']['fields']));_0x4437fd[_0x7f3e('0x36')]=_0x4437fd[_0x7f3e('0x36')][_0x7f3e('0x38')]?_0x4437fd[_0x7f3e('0x36')]:_0x4c6796['model'];if(!_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x39')](_0x7f3e('0x3a'))){_0x4437fd[_0x7f3e('0x1f')]=qs['limit'](_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x1f')]);_0x4437fd[_0x7f3e('0x1e')]=qs[_0x7f3e('0x1e')](_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x1e')]);}_0x4437fd['order']=qs['sort'](_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x3b')]);_0x4437fd[_0x7f3e('0x3c')]=qs[_0x7f3e('0x34')](_['pick'](_0x51a080[_0x7f3e('0x33')],_0x4c6796['filters']),_0xe58f6);if(_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x3d')]){_0x4437fd['where']=_['merge'](_0x4437fd[_0x7f3e('0x3c')],{'$or':_[_0x7f3e('0x3e')](_0xe58f6,function(_0x2872d8){if(_0x2872d8['type']!==_0x7f3e('0x3f')){var _0x4fe442={};_0x4fe442[_0x2872d8['name']]={'$like':'%'+_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x3d')]+'%'};return _0x4fe442;}})});}_0x4437fd=_[_0x7f3e('0x40')]({},_0x4437fd,_0x51a080[_0x7f3e('0x41')]);var _0x4b1f4e={'where':_0x4437fd[_0x7f3e('0x3c')]};return db['SquareDetailsReport']['count'](_0x4b1f4e)['then'](function(_0x3a3d47){_0x43da1e[_0x7f3e('0x21')]=_0x3a3d47;if(_0x51a080[_0x7f3e('0x33')][_0x7f3e('0x42')]){_0x4437fd[_0x7f3e('0x43')]=[{'all':!![]}];}return db[_0x7f3e('0x2e')][_0x7f3e('0x44')](_0x4437fd);})[_0x7f3e('0x27')](function(_0x3e1acc){_0x43da1e[_0x7f3e('0x45')]=_0x3e1acc;return _0x43da1e;})[_0x7f3e('0x27')](respondWithFilteredResult(_0x497aba,_0x4437fd))[_0x7f3e('0x46')](handleError(_0x497aba,null));};exports['show']=function(_0x11056c,_0x422c17){var _0x58b9a4={'raw':!![],'where':{'id':_0x11056c[_0x7f3e('0x47')]['id']}},_0x79efb5={};_0x79efb5['model']=_[_0x7f3e('0x48')](db['SquareDetailsReport'][_0x7f3e('0x2f')]);_0x79efb5[_0x7f3e('0x33')]=_[_0x7f3e('0x48')](_0x11056c[_0x7f3e('0x33')]);_0x79efb5[_0x7f3e('0x34')]=_[_0x7f3e('0x35')](_0x79efb5[_0x7f3e('0x32')],_0x79efb5[_0x7f3e('0x33')]);_0x58b9a4[_0x7f3e('0x36')]=_[_0x7f3e('0x35')](_0x79efb5[_0x7f3e('0x32')],qs[_0x7f3e('0x37')](_0x11056c['query'][_0x7f3e('0x37')]));_0x58b9a4[_0x7f3e('0x36')]=_0x58b9a4[_0x7f3e('0x36')][_0x7f3e('0x38')]?_0x58b9a4[_0x7f3e('0x36')]:_0x79efb5[_0x7f3e('0x32')];if(_0x11056c[_0x7f3e('0x33')][_0x7f3e('0x42')]){_0x58b9a4['include']=[{'all':!![]}];}_0x58b9a4=_[_0x7f3e('0x40')]({},_0x58b9a4,_0x11056c[_0x7f3e('0x41')]);return db['SquareDetailsReport']['find'](_0x58b9a4)[_0x7f3e('0x27')](handleEntityNotFound(_0x422c17,null))[_0x7f3e('0x27')](respondWithResult(_0x422c17,null))[_0x7f3e('0x46')](handleError(_0x422c17,null));};exports[_0x7f3e('0x49')]=function(_0x2ac536,_0x14f474){return db[_0x7f3e('0x2e')]['create'](_0x2ac536[_0x7f3e('0x4a')],{})['then'](respondWithResult(_0x14f474,0xc9))[_0x7f3e('0x46')](handleError(_0x14f474,null));};exports['update']=function(_0x3412e3,_0x1620b3){if(_0x3412e3[_0x7f3e('0x4a')]['id']){delete _0x3412e3[_0x7f3e('0x4a')]['id'];}return db[_0x7f3e('0x2e')]['find']({'where':{'id':_0x3412e3['params']['id']}})['then'](handleEntityNotFound(_0x1620b3,null))[_0x7f3e('0x27')](saveUpdates(_0x3412e3[_0x7f3e('0x4a')],null))[_0x7f3e('0x27')](respondWithResult(_0x1620b3,null))[_0x7f3e('0x46')](handleError(_0x1620b3,null));};exports[_0x7f3e('0x28')]=function(_0x4d2199,_0x4e06c8){return db[_0x7f3e('0x2e')]['find']({'where':{'id':_0x4d2199[_0x7f3e('0x47')]['id']}})[_0x7f3e('0x27')](handleEntityNotFound(_0x4e06c8,null))[_0x7f3e('0x27')](removeEntity(_0x4e06c8,null))['catch'](handleError(_0x4e06c8,null));};exports['describe']=function(_0x2d0aac,_0x4044e9){return db[_0x7f3e('0x2e')]['describe']()['then'](respondWithResult(_0x4044e9,null))[_0x7f3e('0x46')](handleError(_0x4044e9,null));}; \ No newline at end of file +var _0x664d=['includeAll','include','rows','catch','show','params','length','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x664d,0x179));var _0xd664=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0x664d[_0xe9c8e4];return _0x2037fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd664('0x0'));var zipdir=require(_0xd664('0x1'));var jsonpatch=require(_0xd664('0x2'));var rp=require(_0xd664('0x3'));var moment=require('moment');var BPromise=require(_0xd664('0x4'));var Mustache=require(_0xd664('0x5'));var util=require('util');var path=require(_0xd664('0x6'));var sox=require(_0xd664('0x7'));var csv=require(_0xd664('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd664('0x9'));var _=require(_0xd664('0xa'));var squel=require('squel');var crypto=require(_0xd664('0xb'));var jsforce=require(_0xd664('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd664('0x8'));var querystring=require(_0xd664('0xd'));var Papa=require('papaparse');var Redis=require(_0xd664('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd664('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd664('0x10'));var logger=require(_0xd664('0x11'))('api');var utils=require(_0xd664('0x12'));var config=require(_0xd664('0x13'));var licenseUtil=require(_0xd664('0x14'));var db=require(_0xd664('0x15'))['db'];function respondWithStatusCode(_0x400f5a,_0x1986fe){_0x1986fe=_0x1986fe||0xcc;return function(_0x225854){if(_0x225854){return _0x400f5a['sendStatus'](_0x1986fe);}return _0x400f5a[_0xd664('0x16')](_0x1986fe)[_0xd664('0x17')]();};}function respondWithResult(_0x4040ec,_0x54a978){_0x54a978=_0x54a978||0xc8;return function(_0xa600c7){if(_0xa600c7){return _0x4040ec['status'](_0x54a978)[_0xd664('0x18')](_0xa600c7);}};}function respondWithFilteredResult(_0x2e7e68,_0x3d7493){return function(_0x5b4c96){if(_0x5b4c96){var _0x3d5d38=typeof _0x3d7493[_0xd664('0x19')]==='undefined'&&typeof _0x3d7493[_0xd664('0x1a')]===_0xd664('0x1b');var _0x2de2dc=_0x5b4c96[_0xd664('0x1c')];var _0x1a0ca8=_0x3d5d38?0x0:_0x3d7493[_0xd664('0x19')];var _0x4b26c4=_0x3d5d38?_0x5b4c96[_0xd664('0x1c')]:_0x3d7493[_0xd664('0x19')]+_0x3d7493[_0xd664('0x1a')];var _0x4fd738;if(_0x4b26c4>=_0x2de2dc){_0x4b26c4=_0x2de2dc;_0x4fd738=0xc8;}else{_0x4fd738=0xce;}_0x2e7e68[_0xd664('0x16')](_0x4fd738);return _0x2e7e68['set'](_0xd664('0x1d'),_0x1a0ca8+'-'+_0x4b26c4+'/'+_0x2de2dc)[_0xd664('0x18')](_0x5b4c96);}return null;};}function patchUpdates(_0x5ed7b8){return function(_0x4b655c){try{jsonpatch[_0xd664('0x1e')](_0x4b655c,_0x5ed7b8,!![]);}catch(_0x38030e){return BPromise[_0xd664('0x1f')](_0x38030e);}return _0x4b655c[_0xd664('0x20')]();};}function saveUpdates(_0x876d84,_0x401a13){return function(_0xb4ed5c){if(_0xb4ed5c){return _0xb4ed5c['update'](_0x876d84)[_0xd664('0x21')](function(_0x369607){return _0x369607;});}return null;};}function removeEntity(_0x204c3a,_0x41b15f){return function(_0x8eb024){if(_0x8eb024){return _0x8eb024['destroy']()[_0xd664('0x21')](function(){_0x204c3a[_0xd664('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aed77,_0x46f10d){return function(_0x36302e){if(!_0x36302e){_0x2aed77['sendStatus'](0x194);}return _0x36302e;};}function handleError(_0x2dfd26,_0x5b1644){_0x5b1644=_0x5b1644||0x1f4;return function(_0x5c20dd){logger[_0xd664('0x22')](_0x5c20dd['stack']);if(_0x5c20dd[_0xd664('0x23')]){delete _0x5c20dd['name'];}_0x2dfd26[_0xd664('0x16')](_0x5b1644)[_0xd664('0x24')](_0x5c20dd);};}exports[_0xd664('0x25')]=function(_0x41e5cb,_0x4ab858){var _0x5ed2cd={},_0x3409c={},_0x1050fa={'count':0x0,'rows':[]};var _0x1e5a17=_[_0xd664('0x26')](db[_0xd664('0x27')][_0xd664('0x28')],function(_0x2cb205){return{'name':_0x2cb205[_0xd664('0x29')],'type':_0x2cb205[_0xd664('0x2a')][_0xd664('0x2b')]};});_0x3409c[_0xd664('0x2c')]=_['map'](_0x1e5a17,'name');_0x3409c[_0xd664('0x2d')]=_[_0xd664('0x2e')](_0x41e5cb[_0xd664('0x2d')]);_0x3409c['filters']=_[_0xd664('0x2f')](_0x3409c['model'],_0x3409c[_0xd664('0x2d')]);_0x5ed2cd[_0xd664('0x30')]=_[_0xd664('0x2f')](_0x3409c['model'],qs[_0xd664('0x31')](_0x41e5cb[_0xd664('0x2d')][_0xd664('0x31')]));_0x5ed2cd['attributes']=_0x5ed2cd['attributes']['length']?_0x5ed2cd[_0xd664('0x30')]:_0x3409c[_0xd664('0x2c')];if(!_0x41e5cb[_0xd664('0x2d')][_0xd664('0x32')](_0xd664('0x33'))){_0x5ed2cd[_0xd664('0x1a')]=qs[_0xd664('0x1a')](_0x41e5cb[_0xd664('0x2d')]['limit']);_0x5ed2cd['offset']=qs[_0xd664('0x19')](_0x41e5cb[_0xd664('0x2d')][_0xd664('0x19')]);}_0x5ed2cd[_0xd664('0x34')]=qs['sort'](_0x41e5cb[_0xd664('0x2d')][_0xd664('0x35')]);_0x5ed2cd[_0xd664('0x36')]=qs[_0xd664('0x37')](_[_0xd664('0x38')](_0x41e5cb[_0xd664('0x2d')],_0x3409c[_0xd664('0x37')]),_0x1e5a17);if(_0x41e5cb['query']['filter']){_0x5ed2cd[_0xd664('0x36')]=_['merge'](_0x5ed2cd[_0xd664('0x36')],{'$or':_[_0xd664('0x26')](_0x1e5a17,function(_0x157393){if(_0x157393[_0xd664('0x2a')]!==_0xd664('0x39')){var _0x2d864b={};_0x2d864b[_0x157393[_0xd664('0x23')]]={'$like':'%'+_0x41e5cb[_0xd664('0x2d')][_0xd664('0x3a')]+'%'};return _0x2d864b;}})});}_0x5ed2cd=_[_0xd664('0x3b')]({},_0x5ed2cd,_0x41e5cb[_0xd664('0x3c')]);var _0x214055={'where':_0x5ed2cd[_0xd664('0x36')]};return db[_0xd664('0x27')]['count'](_0x214055)[_0xd664('0x21')](function(_0xda6e61){_0x1050fa[_0xd664('0x1c')]=_0xda6e61;if(_0x41e5cb[_0xd664('0x2d')][_0xd664('0x3d')]){_0x5ed2cd[_0xd664('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5ed2cd);})[_0xd664('0x21')](function(_0x1b5064){_0x1050fa[_0xd664('0x3f')]=_0x1b5064;return _0x1050fa;})[_0xd664('0x21')](respondWithFilteredResult(_0x4ab858,_0x5ed2cd))[_0xd664('0x40')](handleError(_0x4ab858,null));};exports[_0xd664('0x41')]=function(_0x41378a,_0x1d0278){var _0x2714c6={'raw':!![],'where':{'id':_0x41378a[_0xd664('0x42')]['id']}},_0x5c0b24={};_0x5c0b24[_0xd664('0x2c')]=_[_0xd664('0x2e')](db['SquareDetailsReport'][_0xd664('0x28')]);_0x5c0b24['query']=_['keys'](_0x41378a[_0xd664('0x2d')]);_0x5c0b24['filters']=_[_0xd664('0x2f')](_0x5c0b24[_0xd664('0x2c')],_0x5c0b24[_0xd664('0x2d')]);_0x2714c6[_0xd664('0x30')]=_[_0xd664('0x2f')](_0x5c0b24[_0xd664('0x2c')],qs[_0xd664('0x31')](_0x41378a['query'][_0xd664('0x31')]));_0x2714c6[_0xd664('0x30')]=_0x2714c6[_0xd664('0x30')][_0xd664('0x43')]?_0x2714c6[_0xd664('0x30')]:_0x5c0b24[_0xd664('0x2c')];if(_0x41378a['query'][_0xd664('0x3d')]){_0x2714c6[_0xd664('0x3e')]=[{'all':!![]}];}_0x2714c6=_[_0xd664('0x3b')]({},_0x2714c6,_0x41378a[_0xd664('0x3c')]);return db['SquareDetailsReport']['find'](_0x2714c6)['then'](handleEntityNotFound(_0x1d0278,null))[_0xd664('0x21')](respondWithResult(_0x1d0278,null))['catch'](handleError(_0x1d0278,null));};exports[_0xd664('0x44')]=function(_0xdf3f32,_0x4a2432){return db[_0xd664('0x27')][_0xd664('0x44')](_0xdf3f32[_0xd664('0x45')],{})[_0xd664('0x21')](respondWithResult(_0x4a2432,0xc9))[_0xd664('0x40')](handleError(_0x4a2432,null));};exports['update']=function(_0xa46d9d,_0x25ecb2){if(_0xa46d9d[_0xd664('0x45')]['id']){delete _0xa46d9d['body']['id'];}return db[_0xd664('0x27')]['find']({'where':{'id':_0xa46d9d[_0xd664('0x42')]['id']}})[_0xd664('0x21')](handleEntityNotFound(_0x25ecb2,null))[_0xd664('0x21')](saveUpdates(_0xa46d9d[_0xd664('0x45')],null))[_0xd664('0x21')](respondWithResult(_0x25ecb2,null))['catch'](handleError(_0x25ecb2,null));};exports[_0xd664('0x46')]=function(_0x1e35c0,_0x54ebd3){return db[_0xd664('0x27')][_0xd664('0x47')]({'where':{'id':_0x1e35c0[_0xd664('0x42')]['id']}})[_0xd664('0x21')](handleEntityNotFound(_0x54ebd3,null))[_0xd664('0x21')](removeEntity(_0x54ebd3,null))[_0xd664('0x40')](handleError(_0x54ebd3,null));};exports[_0xd664('0x48')]=function(_0x31fec5,_0x7ab54a){return db[_0xd664('0x27')][_0xd664('0x48')]()[_0xd664('0x21')](respondWithResult(_0x7ab54a,null))[_0xd664('0x40')](handleError(_0x7ab54a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6e7228c..ee4225a 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 _0x68b9=['path','rimraf','./squareReportDetail.attributes','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','request-promise'];(function(_0x4899d2,_0x37e75d){var _0x1f849a=function(_0x1496e8){while(--_0x1496e8){_0x4899d2['push'](_0x4899d2['shift']());}};_0x1f849a(++_0x37e75d);}(_0x68b9,0x95));var _0x968b=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0x68b9[_0x315aea];return _0x4a4bdb;};'use strict';var _=require(_0x968b('0x0'));var util=require(_0x968b('0x1'));var logger=require(_0x968b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x968b('0x3'));var fs=require('fs');var path=require(_0x968b('0x4'));var rimraf=require(_0x968b('0x5'));var config=require('../../config/environment');var attributes=require(_0x968b('0x6'));module['exports']=function(_0x11f62c,_0x196c69){return _0x11f62c['define'](_0x968b('0x7'),attributes,{'tableName':_0x968b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3d5=['define','SquareDetailsReport','report_square_details','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x5b7010,_0x581a43){var _0x188dc0=function(_0x4fbbf3){while(--_0x4fbbf3){_0x5b7010['push'](_0x5b7010['shift']());}};_0x188dc0(++_0x581a43);}(_0xe3d5,0xdb));var _0x5e3d=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xe3d5[_0x35007a];return _0x574f68;};'use strict';var _=require(_0x5e3d('0x0'));var util=require(_0x5e3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5e3d('0x2'));var BPromise=require(_0x5e3d('0x3'));var rp=require(_0x5e3d('0x4'));var fs=require('fs');var path=require(_0x5e3d('0x5'));var rimraf=require(_0x5e3d('0x6'));var config=require(_0x5e3d('0x7'));var attributes=require(_0x5e3d('0x8'));module['exports']=function(_0x117a19,_0x58897e){return _0x117a19[_0x5e3d('0x9')](_0x5e3d('0xa'),attributes,{'tableName':_0x5e3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 13f9689..08916ee 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 _0xd914=['client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1c9ee9,_0x49849f){var _0xf94757=function(_0x48df89){while(--_0x48df89){_0x1c9ee9['push'](_0x1c9ee9['shift']());}};_0xf94757(++_0x49849f);}(_0xd914,0x17f));var _0x4d91=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd914[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['create'](_0x44b9a7[_0x4d91('0x18')],{'raw':_0x44b9a7[_0x4d91('0x19')]?_0x44b9a7[_0x4d91('0x19')][_0x4d91('0x1a')]===undefined?!![]:![]:!![]})[_0x4d91('0x1b')](function(_0x40cde4){logger[_0x4d91('0xc')](_0x4d91('0x16'),_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x40cde4));_0x350e23(_0x40cde4);})[_0x4d91('0x15')](function(_0x5f5236){logger['error'](_0x4d91('0x16'),_0x5f5236[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40[_0x4d91('0x11')](0x1f4,_0x5f5236[_0x4d91('0x13')]));});});}; \ No newline at end of file +var _0x34b7=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x34b7,0x196));var _0x734b=function(_0x2e84ee,_0x283c59){_0x2e84ee=_0x2e84ee-0x0;var _0x5c82d0=_0x34b7[_0x2e84ee];return _0x5c82d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateSquareDetailsReport',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5fb18d4..86d7e67 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 _0xd680=['express','../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports'];(function(_0x22e9e2,_0x2fccc3){var _0x8d7925=function(_0x430adc){while(--_0x430adc){_0x22e9e2['push'](_0x22e9e2['shift']());}};_0x8d7925(++_0x2fccc3);}(_0xd680,0xaf));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x0d68('0x0'));var router=express['Router']();var auth=require(_0x0d68('0x1'));var controller=require(_0x0d68('0x2'));router[_0x0d68('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0d68('0x3')]('/process/:pid/kill',auth[_0x0d68('0x4')](),controller[_0x0d68('0x5')]);module[_0x0d68('0x6')]=router; \ No newline at end of file +var _0xb4ba=['/process/:pid/kill','killProcess','exports','express','Router','get','isAuthenticated','index'];(function(_0x1420f1,_0x3cdafd){var _0x1f2e65=function(_0x46e0b1){while(--_0x46e0b1){_0x1420f1['push'](_0x1420f1['shift']());}};_0x1f2e65(++_0x3cdafd);}(_0xb4ba,0xd3));var _0xab4b=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xb4ba[_0x373dee];return _0x46798f;};'use strict';var express=require(_0xab4b('0x0'));var router=express[_0xab4b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xab4b('0x2')]('/',auth[_0xab4b('0x3')](),controller[_0xab4b('0x4')]);router[_0xab4b('0x2')](_0xab4b('0x5'),auth[_0xab4b('0x3')](),controller[_0xab4b('0x6')]);module[_0xab4b('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 d00b681..ee59113 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 _0x9228=['getAllData','then','json','catch','killProcess','components/import/cm','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9228,0xf9));var _0x8922=function(_0x31b88d,_0x32e9ef){_0x31b88d=_0x31b88d-0x0;var _0x1128c9=_0x9228[_0x31b88d];return _0x1128c9;};'use strict';var info=require(_0x8922('0x0'));var exec=require('child_process')[_0x8922('0x1')];var logger=require('../../config/logger')(_0x8922('0x2'));var util=require(_0x8922('0x3'));var BPromise=require(_0x8922('0x4'));var _=require('lodash');function handleError(_0x440d18,_0xce79c0,_0xde2b45){_0xce79c0=_0xce79c0||0x1f4;return function(_0x1f0a7f){logger[_0x8922('0x5')](_0x8922('0x6'),_0xde2b45,_0xce79c0,util[_0x8922('0x7')](_0x1f0a7f,{'showHidden':![],'depth':null}));delete _0x1f0a7f[_0x8922('0x8')];_0x440d18[_0x8922('0x9')](_0xce79c0)['send'](_0x1f0a7f);};}exports[_0x8922('0xa')]=function(_0x49cb3c,_0x29b097){return info[_0x8922('0xb')]()[_0x8922('0xc')](function(_0x289a40){return _0x29b097[_0x8922('0x9')](0xc8)[_0x8922('0xd')](_0x289a40);})[_0x8922('0xe')](function(_0x4abd0f){return _0x29b097['status'](0x1f4)[_0x8922('0xd')](_0x4abd0f);});};exports[_0x8922('0xf')]=function(_0x44078e,_0x379aa0){var _0x571646=[_0x8922('0x10')];return new BPromise(function(_0x50a026,_0x4a0efa){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x44078e[_0x8922('0x11')][_0x8922('0x12')]),function(_0x253d91,_0x5d9fbd,_0x2539d5){if(_0x253d91){return _0x4a0efa(_0x253d91);}return _0x50a026(_0x5d9fbd);});})[_0x8922('0xc')](function(_0x3a582c){var _0x40e354=![];var _0x1f0a96=_0x3a582c[_0x8922('0x13')](/\n/);for(var _0x5637c1=0x0,_0xde78eb=_0x571646[_0x8922('0x14')];_0x5637c1<_0xde78eb,_0x40e354===![];_0x5637c1+=0x1){if(_0x3a582c['indexOf'](_0x571646[_0x5637c1])>=0x0){_0x40e354=!![];}}if(!_0x40e354){throw new Error(util['format'](_0x8922('0x15'),_0x44078e[_0x8922('0x11')][_0x8922('0x12')]));}process[_0x8922('0x16')](_0x44078e[_0x8922('0x11')][_0x8922('0x12')],_0x8922('0x17'));return _0x379aa0[_0x8922('0x9')](0xc8)['json']({'message':util[_0x8922('0x18')](_0x8922('0x19'),_0x44078e[_0x8922('0x11')][_0x8922('0x12')])});})['catch'](handleError(_0x379aa0,null,_0x8922('0xf')));}; \ No newline at end of file +var _0x5c33=['name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0xa010c1,_0x3dc335){var _0xd51b04=function(_0x292584){while(--_0x292584){_0xa010c1['push'](_0xa010c1['shift']());}};_0xd51b04(++_0x3dc335);}(_0x5c33,0x1f4));var _0x35c3=function(_0x3ae98b,_0x294260){_0x3ae98b=_0x3ae98b-0x0;var _0x1ac2b2=_0x5c33[_0x3ae98b];return _0x1ac2b2;};'use strict';var info=require(_0x35c3('0x0'));var exec=require(_0x35c3('0x1'))[_0x35c3('0x2')];var logger=require(_0x35c3('0x3'))(_0x35c3('0x4'));var util=require(_0x35c3('0x5'));var BPromise=require(_0x35c3('0x6'));var _=require(_0x35c3('0x7'));function handleError(_0x293649,_0x4e25cb,_0x3a03be){_0x4e25cb=_0x4e25cb||0x1f4;return function(_0x54d3f1){logger['error'](_0x35c3('0x8'),_0x3a03be,_0x4e25cb,util[_0x35c3('0x9')](_0x54d3f1,{'showHidden':![],'depth':null}));delete _0x54d3f1[_0x35c3('0xa')];_0x293649[_0x35c3('0xb')](_0x4e25cb)[_0x35c3('0xc')](_0x54d3f1);};}exports[_0x35c3('0xd')]=function(_0x2bd136,_0x6dfcf8){return info[_0x35c3('0xe')]()[_0x35c3('0xf')](function(_0x4e3d53){return _0x6dfcf8[_0x35c3('0xb')](0xc8)[_0x35c3('0x10')](_0x4e3d53);})[_0x35c3('0x11')](function(_0x5aba49){return _0x6dfcf8['status'](0x1f4)['json'](_0x5aba49);});};exports[_0x35c3('0x12')]=function(_0x2ac593,_0x547235){var _0x380b17=[_0x35c3('0x13')];return new BPromise(function(_0x5cffc5,_0x4304d3){return exec(util[_0x35c3('0x14')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2ac593['params']['pid']),function(_0x2d8241,_0x163053,_0x1575f2){if(_0x2d8241){return _0x4304d3(_0x2d8241);}return _0x5cffc5(_0x163053);});})[_0x35c3('0xf')](function(_0x243839){var _0x4f361a=![];var _0x50e40e=_0x243839[_0x35c3('0x15')](/\n/);for(var _0x2541fb=0x0,_0x3d79e1=_0x380b17[_0x35c3('0x16')];_0x2541fb<_0x3d79e1,_0x4f361a===![];_0x2541fb+=0x1){if(_0x243839[_0x35c3('0x17')](_0x380b17[_0x2541fb])>=0x0){_0x4f361a=!![];}}if(!_0x4f361a){throw new Error(util['format'](_0x35c3('0x18'),_0x2ac593[_0x35c3('0x19')]['pid']));}process[_0x35c3('0x1a')](_0x2ac593[_0x35c3('0x19')][_0x35c3('0x1b')],_0x35c3('0x1c'));return _0x547235['status'](0xc8)[_0x35c3('0x10')]({'message':util[_0x35c3('0x14')](_0x35c3('0x1d'),_0x2ac593['params'][_0x35c3('0x1b')])});})[_0x35c3('0x11')](handleError(_0x547235,null,_0x35c3('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 158db34..37fdce9 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 _0x98d1=['../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4947ca,_0x7f5359){var _0x415545=function(_0x289d3e){while(--_0x289d3e){_0x4947ca['push'](_0x4947ca['shift']());}};_0x415545(++_0x7f5359);}(_0x98d1,0x13e));var _0x198d=function(_0xad582f,_0x1e12df){_0xad582f=_0xad582f-0x0;var _0x2e938f=_0x98d1[_0xad582f];return _0x2e938f;};'use strict';var multer=require(_0x198d('0x0'));var util=require('util');var path=require(_0x198d('0x1'));var timeout=require('connect-timeout');var express=require(_0x198d('0x2'));var router=express[_0x198d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x198d('0x4'));var interaction=require(_0x198d('0x5'));var config=require(_0x198d('0x6'));var controller=require(_0x198d('0x7'));router[_0x198d('0x8')]('/',auth['isAuthenticated'](),controller[_0x198d('0x9')]);router[_0x198d('0x8')](_0x198d('0xa'),auth[_0x198d('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x198d('0xc')]);router[_0x198d('0xd')]('/:id',auth[_0x198d('0xb')](),controller[_0x198d('0xe')]);router[_0x198d('0xf')](_0x198d('0xa'),auth[_0x198d('0xb')](),controller[_0x198d('0x10')]);module[_0x198d('0x11')]=router; \ No newline at end of file +var _0xf0a3=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x3fc8b7,_0x2849a7){var _0x2f7414=function(_0x59bb4e){while(--_0x59bb4e){_0x3fc8b7['push'](_0x3fc8b7['shift']());}};_0x2f7414(++_0x2849a7);}(_0xf0a3,0x18d));var _0x3f0a=function(_0x11c649,_0x5b7812){_0x11c649=_0x11c649-0x0;var _0xfa2f4b=_0xf0a3[_0x11c649];return _0xfa2f4b;};'use strict';var multer=require('multer');var util=require(_0x3f0a('0x0'));var path=require(_0x3f0a('0x1'));var timeout=require(_0x3f0a('0x2'));var express=require('express');var router=express[_0x3f0a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f0a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3f0a('0x5'));var controller=require(_0x3f0a('0x6'));router[_0x3f0a('0x7')]('/',auth[_0x3f0a('0x8')](),controller[_0x3f0a('0x9')]);router[_0x3f0a('0x7')](_0x3f0a('0xa'),auth[_0x3f0a('0x8')](),controller[_0x3f0a('0xb')]);router[_0x3f0a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3f0a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3f0a('0xe')]);router[_0x3f0a('0xf')](_0x3f0a('0xa'),auth[_0x3f0a('0x8')](),controller[_0x3f0a('0x10')]);module[_0x3f0a('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 79eac45..8e6c27b 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 _0xea5b=['STRING','#0091EA','sequelize','exports'];(function(_0x3ef3ca,_0x4556f3){var _0x4a9930=function(_0x1eca22){while(--_0x1eca22){_0x3ef3ca['push'](_0x3ef3ca['shift']());}};_0x4a9930(++_0x4556f3);}(_0xea5b,0x152));var _0xbea5=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xea5b[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0xbea5('0x0'));module[_0xbea5('0x1')]={'name':{'type':Sequelize[_0xbea5('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xbea5('0x3')},'description':{'type':Sequelize[_0xbea5('0x2')]}}; \ No newline at end of file +var _0xa958=['sequelize','STRING','name','#0091EA'];(function(_0x4b23b0,_0xf3d9b4){var _0x1440d7=function(_0xcbf17b){while(--_0xcbf17b){_0x4b23b0['push'](_0x4b23b0['shift']());}};_0x1440d7(++_0xf3d9b4);}(_0xa958,0x94));var _0x8a95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa958[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8a95('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a95('0x1')],'unique':_0x8a95('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8a95('0x1')],'defaultValue':_0x8a95('0x3')},'description':{'type':Sequelize[_0x8a95('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 56e4378..54c951c 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 _0x80df=['fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Tags','end','sendStatus','error','stack','name','index','Tag','rawAttributes','type','key','map','query','filters','intersection','model'];(function(_0x5d02eb,_0x5bfe53){var _0x5aac6=function(_0x3e574b){while(--_0x3e574b){_0x5d02eb['push'](_0x5d02eb['shift']());}};_0x5aac6(++_0x5bfe53);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){var _0x3353a3=_0x32ad42[_0xf80d('0x29')]({'plain':!![]});var _0x323540=_0xf80d('0x2a');return db['UserProfileResource'][_0xf80d('0x28')]({'where':{'type':_0x323540,'resourceId':_0x3353a3['id']}})[_0xf80d('0x27')](function(){return _0x32ad42;});})[_0xf80d('0x27')](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x2b')]();});}};}function handleEntityNotFound(_0xde054a,_0x2fc429){return function(_0x68f2c6){if(!_0x68f2c6){_0xde054a[_0xf80d('0x2c')](0x194);}return _0x68f2c6;};}function handleError(_0x4d2579,_0xe940d6){_0xe940d6=_0xe940d6||0x1f4;return function(_0x1603a4){logger[_0xf80d('0x2d')](_0x1603a4[_0xf80d('0x2e')]);if(_0x1603a4[_0xf80d('0x2f')]){delete _0x1603a4[_0xf80d('0x2f')];}_0x4d2579[_0xf80d('0x1c')](_0xe940d6)['send'](_0x1603a4);};}exports[_0xf80d('0x30')]=function(_0x27887e,_0x214bff){var _0x435e23={},_0x5c3a1d={},_0x487d2c={'count':0x0,'rows':[]};var _0x2359f1=_['map'](db[_0xf80d('0x31')][_0xf80d('0x32')],function(_0x45f76a){return{'name':_0x45f76a['fieldName'],'type':_0x45f76a[_0xf80d('0x33')][_0xf80d('0x34')]};});_0x5c3a1d['model']=_[_0xf80d('0x35')](_0x2359f1,_0xf80d('0x2f'));_0x5c3a1d[_0xf80d('0x36')]=_['keys'](_0x27887e[_0xf80d('0x36')]);_0x5c3a1d[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x5c3a1d[_0xf80d('0x39')],_0x5c3a1d[_0xf80d('0x36')]);_0x435e23['attributes']=_[_0xf80d('0x38')](_0x5c3a1d['model'],qs[_0xf80d('0x3a')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x435e23[_0xf80d('0x3b')]=_0x435e23['attributes'][_0xf80d('0x3c')]?_0x435e23[_0xf80d('0x3b')]:_0x5c3a1d[_0xf80d('0x39')];if(!_0x27887e[_0xf80d('0x36')]['hasOwnProperty'](_0xf80d('0x3d'))){_0x435e23[_0xf80d('0x20')]=qs[_0xf80d('0x20')](_0x27887e[_0xf80d('0x36')][_0xf80d('0x20')]);_0x435e23[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x27887e[_0xf80d('0x36')]['offset']);}_0x435e23[_0xf80d('0x3e')]=qs[_0xf80d('0x3f')](_0x27887e[_0xf80d('0x36')]['sort']);_0x435e23[_0xf80d('0x40')]=qs['filters'](_[_0xf80d('0x41')](_0x27887e[_0xf80d('0x36')],_0x5c3a1d[_0xf80d('0x37')]),_0x2359f1);if(_0x27887e[_0xf80d('0x36')]['filter']){_0x435e23['where']=_['merge'](_0x435e23[_0xf80d('0x40')],{'$or':_[_0xf80d('0x35')](_0x2359f1,function(_0x2d0ee5){if(_0x2d0ee5[_0xf80d('0x33')]!==_0xf80d('0x42')){var _0x100dc7={};_0x100dc7[_0x2d0ee5['name']]={'$like':'%'+_0x27887e[_0xf80d('0x36')][_0xf80d('0x43')]+'%'};return _0x100dc7;}})});}_0x435e23=_[_0xf80d('0x44')]({},_0x435e23,_0x27887e['options']);var _0x14314a={'where':_0x435e23['where']};return db[_0xf80d('0x31')][_0xf80d('0x21')](_0x14314a)[_0xf80d('0x27')](function(_0x2cd371){_0x487d2c[_0xf80d('0x21')]=_0x2cd371;if(_0x27887e[_0xf80d('0x36')][_0xf80d('0x45')]){_0x435e23[_0xf80d('0x46')]=[{'all':!![]}];}return db[_0xf80d('0x31')][_0xf80d('0x47')](_0x435e23);})[_0xf80d('0x27')](function(_0x437e44){_0x487d2c[_0xf80d('0x48')]=_0x437e44;return _0x487d2c;})[_0xf80d('0x27')](respondWithFilteredResult(_0x214bff,_0x435e23))[_0xf80d('0x49')](handleError(_0x214bff,null));};exports[_0xf80d('0x4a')]=function(_0x43474d,_0x9da271){var _0x19b7eb={'raw':!![],'where':{'id':_0x43474d[_0xf80d('0x4b')]['id']}},_0x24c1e4={};_0x24c1e4[_0xf80d('0x39')]=_[_0xf80d('0x4c')](db[_0xf80d('0x31')][_0xf80d('0x32')]);_0x24c1e4['query']=_[_0xf80d('0x4c')](_0x43474d[_0xf80d('0x36')]);_0x24c1e4[_0xf80d('0x37')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],_0x24c1e4['query']);_0x19b7eb[_0xf80d('0x3b')]=_[_0xf80d('0x38')](_0x24c1e4[_0xf80d('0x39')],qs[_0xf80d('0x3a')](_0x43474d[_0xf80d('0x36')][_0xf80d('0x3a')]));_0x19b7eb[_0xf80d('0x3b')]=_0x19b7eb[_0xf80d('0x3b')][_0xf80d('0x3c')]?_0x19b7eb[_0xf80d('0x3b')]:_0x24c1e4[_0xf80d('0x39')];if(_0x43474d[_0xf80d('0x36')][_0xf80d('0x45')]){_0x19b7eb[_0xf80d('0x46')]=[{'all':!![]}];}_0x19b7eb=_[_0xf80d('0x44')]({},_0x19b7eb,_0x43474d[_0xf80d('0x4d')]);return db[_0xf80d('0x31')]['find'](_0x19b7eb)[_0xf80d('0x27')](handleEntityNotFound(_0x9da271,null))[_0xf80d('0x27')](respondWithResult(_0x9da271,null))[_0xf80d('0x49')](handleError(_0x9da271,null));};exports['create']=function(_0x3e5cf6,_0x1088ca){return db['Tag']['create'](_0x3e5cf6[_0xf80d('0x4e')],{})['then'](function(_0xcb5fe7){var _0x24c70e=_0x3e5cf6[_0xf80d('0x4f')][_0xf80d('0x29')]({'plain':!![]});if(!_0x24c70e)throw new Error(_0xf80d('0x50'));if(_0x24c70e[_0xf80d('0x51')]===_0xf80d('0x4f')){var _0x114132=_0xcb5fe7[_0xf80d('0x29')]({'plain':!![]});var _0x1f20a2=_0xf80d('0x2a');return db[_0xf80d('0x52')]['find']({'where':{'name':_0x1f20a2,'userProfileId':_0x24c70e[_0xf80d('0x53')]},'raw':!![]})[_0xf80d('0x27')](function(_0x3c25d7){if(_0x3c25d7&&_0x3c25d7['autoAssociation']===0x0){return db[_0xf80d('0x54')][_0xf80d('0x55')]({'name':_0x114132['name'],'resourceId':_0x114132['id'],'type':_0x3c25d7[_0xf80d('0x2f')],'sectionId':_0x3c25d7['id']},{})[_0xf80d('0x27')](function(){return _0xcb5fe7;});}else{return _0xcb5fe7;}})['catch'](function(_0xee12ae){logger[_0xf80d('0x2d')](_0xf80d('0x56'),_0xee12ae);throw _0xee12ae;});}return _0xcb5fe7;})[_0xf80d('0x27')](respondWithResult(_0x1088ca,0xc9))['catch'](handleError(_0x1088ca,null));};exports[_0xf80d('0x26')]=function(_0x374985,_0x1a4c08){if(_0x374985['body']['id']){delete _0x374985[_0xf80d('0x4e')]['id'];}return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x374985[_0xf80d('0x4b')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1a4c08,null))[_0xf80d('0x27')](saveUpdates(_0x374985[_0xf80d('0x4e')],null))[_0xf80d('0x27')](respondWithResult(_0x1a4c08,null))[_0xf80d('0x49')](handleError(_0x1a4c08,null));};exports[_0xf80d('0x28')]=function(_0x543dba,_0x112342){return db[_0xf80d('0x31')][_0xf80d('0x57')]({'where':{'id':_0x543dba[_0xf80d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x112342,null))['then'](removeEntity(_0x112342,null))[_0xf80d('0x49')](handleError(_0x112342,null));}; \ No newline at end of file +var _0x8ce3=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','UserProfileResource','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','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','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x8ce3,0xc3));var _0x38ce=function(_0x15df7f,_0x318875){_0x15df7f=_0x15df7f-0x0;var _0x2cb715=_0x8ce3[_0x15df7f];return _0x2cb715;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){var _0xe0af00=_0x2c85e6[_0x38ce('0x2b')]({'plain':!![]});var _0x43b479='Tags';return db['UserProfileResource'][_0x38ce('0x2a')]({'where':{'type':_0x43b479,'resourceId':_0xe0af00['id']}})[_0x38ce('0x29')](function(){return _0x2c85e6;});})[_0x38ce('0x29')](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x2a59fe,_0x13e2fc){return function(_0xce1f64){if(!_0xce1f64){_0x2a59fe[_0x38ce('0x1b')](0x194);}return _0xce1f64;};}function handleError(_0x4649be,_0xfc590a){_0xfc590a=_0xfc590a||0x1f4;return function(_0x381703){logger['error'](_0x381703[_0x38ce('0x2c')]);if(_0x381703[_0x38ce('0x2d')]){delete _0x381703['name'];}_0x4649be[_0x38ce('0x1c')](_0xfc590a)[_0x38ce('0x2e')](_0x381703);};}exports['index']=function(_0xd96d33,_0x282ee4){var _0x568d94={},_0x28d775={},_0x53f2c9={'count':0x0,'rows':[]};var _0x1aa8fb=_[_0x38ce('0x2f')](db[_0x38ce('0x30')][_0x38ce('0x31')],function(_0x444b93){return{'name':_0x444b93[_0x38ce('0x32')],'type':_0x444b93[_0x38ce('0x33')][_0x38ce('0x34')]};});_0x28d775['model']=_['map'](_0x1aa8fb,_0x38ce('0x2d'));_0x28d775[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xd96d33[_0x38ce('0x35')]);_0x28d775[_0x38ce('0x37')]=_['intersection'](_0x28d775[_0x38ce('0x38')],_0x28d775[_0x38ce('0x35')]);_0x568d94[_0x38ce('0x39')]=_[_0x38ce('0x3a')](_0x28d775[_0x38ce('0x38')],qs[_0x38ce('0x3b')](_0xd96d33[_0x38ce('0x35')]['fields']));_0x568d94[_0x38ce('0x39')]=_0x568d94[_0x38ce('0x39')]['length']?_0x568d94[_0x38ce('0x39')]:_0x28d775[_0x38ce('0x38')];if(!_0xd96d33[_0x38ce('0x35')][_0x38ce('0x3c')](_0x38ce('0x3d'))){_0x568d94[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0xd96d33[_0x38ce('0x35')]['limit']);_0x568d94[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0xd96d33[_0x38ce('0x35')][_0x38ce('0x1f')]);}_0x568d94['order']=qs[_0x38ce('0x3e')](_0xd96d33['query'][_0x38ce('0x3e')]);_0x568d94[_0x38ce('0x3f')]=qs[_0x38ce('0x37')](_[_0x38ce('0x40')](_0xd96d33[_0x38ce('0x35')],_0x28d775[_0x38ce('0x37')]),_0x1aa8fb);if(_0xd96d33['query'][_0x38ce('0x41')]){_0x568d94['where']=_[_0x38ce('0x42')](_0x568d94[_0x38ce('0x3f')],{'$or':_[_0x38ce('0x2f')](_0x1aa8fb,function(_0x37b738){if(_0x37b738[_0x38ce('0x33')]!==_0x38ce('0x43')){var _0x5209ee={};_0x5209ee[_0x37b738[_0x38ce('0x2d')]]={'$like':'%'+_0xd96d33[_0x38ce('0x35')][_0x38ce('0x41')]+'%'};return _0x5209ee;}})});}_0x568d94=_[_0x38ce('0x42')]({},_0x568d94,_0xd96d33[_0x38ce('0x44')]);var _0x467d3e={'where':_0x568d94['where']};return db['Tag'][_0x38ce('0x22')](_0x467d3e)[_0x38ce('0x29')](function(_0x174c86){_0x53f2c9[_0x38ce('0x22')]=_0x174c86;if(_0xd96d33[_0x38ce('0x35')][_0x38ce('0x45')]){_0x568d94[_0x38ce('0x46')]=[{'all':!![]}];}return db['Tag'][_0x38ce('0x47')](_0x568d94);})[_0x38ce('0x29')](function(_0x5a689b){_0x53f2c9[_0x38ce('0x48')]=_0x5a689b;return _0x53f2c9;})[_0x38ce('0x29')](respondWithFilteredResult(_0x282ee4,_0x568d94))[_0x38ce('0x49')](handleError(_0x282ee4,null));};exports['show']=function(_0xaf99ce,_0xd95bc8){var _0x33f6a6={'raw':!![],'where':{'id':_0xaf99ce[_0x38ce('0x4a')]['id']}},_0x981068={};_0x981068[_0x38ce('0x38')]=_['keys'](db[_0x38ce('0x30')][_0x38ce('0x31')]);_0x981068[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xaf99ce[_0x38ce('0x35')]);_0x981068[_0x38ce('0x37')]=_['intersection'](_0x981068[_0x38ce('0x38')],_0x981068[_0x38ce('0x35')]);_0x33f6a6['attributes']=_['intersection'](_0x981068['model'],qs[_0x38ce('0x3b')](_0xaf99ce[_0x38ce('0x35')]['fields']));_0x33f6a6['attributes']=_0x33f6a6[_0x38ce('0x39')]['length']?_0x33f6a6[_0x38ce('0x39')]:_0x981068['model'];if(_0xaf99ce[_0x38ce('0x35')][_0x38ce('0x45')]){_0x33f6a6['include']=[{'all':!![]}];}_0x33f6a6=_[_0x38ce('0x42')]({},_0x33f6a6,_0xaf99ce[_0x38ce('0x44')]);return db['Tag'][_0x38ce('0x4b')](_0x33f6a6)[_0x38ce('0x29')](handleEntityNotFound(_0xd95bc8,null))[_0x38ce('0x29')](respondWithResult(_0xd95bc8,null))[_0x38ce('0x49')](handleError(_0xd95bc8,null));};exports[_0x38ce('0x4c')]=function(_0x25a299,_0x58cc6f){return db[_0x38ce('0x30')][_0x38ce('0x4c')](_0x25a299['body'],{})[_0x38ce('0x29')](function(_0x316eec){var _0x429517=_0x25a299[_0x38ce('0x4d')][_0x38ce('0x2b')]({'plain':!![]});if(!_0x429517)throw new Error(_0x38ce('0x4e'));if(_0x429517[_0x38ce('0x4f')]==='user'){var _0x3e1522=_0x316eec[_0x38ce('0x2b')]({'plain':!![]});var _0x3f88df=_0x38ce('0x50');return db[_0x38ce('0x51')][_0x38ce('0x4b')]({'where':{'name':_0x3f88df,'userProfileId':_0x429517['userProfileId']},'raw':!![]})['then'](function(_0xc2c9d3){if(_0xc2c9d3&&_0xc2c9d3[_0x38ce('0x52')]===0x0){return db[_0x38ce('0x53')][_0x38ce('0x4c')]({'name':_0x3e1522[_0x38ce('0x2d')],'resourceId':_0x3e1522['id'],'type':_0xc2c9d3[_0x38ce('0x2d')],'sectionId':_0xc2c9d3['id']},{})['then'](function(){return _0x316eec;});}else{return _0x316eec;}})['catch'](function(_0x199c5b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199c5b);throw _0x199c5b;});}return _0x316eec;})[_0x38ce('0x29')](respondWithResult(_0x58cc6f,0xc9))[_0x38ce('0x49')](handleError(_0x58cc6f,null));};exports[_0x38ce('0x28')]=function(_0xbe5626,_0xd031c0){if(_0xbe5626['body']['id']){delete _0xbe5626[_0x38ce('0x54')]['id'];}return db[_0x38ce('0x30')][_0x38ce('0x4b')]({'where':{'id':_0xbe5626[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0xd031c0,null))[_0x38ce('0x29')](saveUpdates(_0xbe5626[_0x38ce('0x54')],null))[_0x38ce('0x29')](respondWithResult(_0xd031c0,null))[_0x38ce('0x49')](handleError(_0xd031c0,null));};exports[_0x38ce('0x2a')]=function(_0x2db125,_0x56d63e){return db['Tag'][_0x38ce('0x4b')]({'where':{'id':_0x2db125[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x56d63e,null))[_0x38ce('0x29')](removeEntity(_0x56d63e,null))['catch'](handleError(_0x56d63e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8f059d0..6dada1b 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 _0x89e3=['./tag.attributes','exports','define','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x404c37,_0x3839ae){var _0x45d73b=function(_0x19e719){while(--_0x19e719){_0x404c37['push'](_0x404c37['shift']());}};_0x45d73b(++_0x3839ae);}(_0x89e3,0x66));var _0x389e=function(_0x4f6812,_0x5cda55){_0x4f6812=_0x4f6812-0x0;var _0x3cca9e=_0x89e3[_0x4f6812];return _0x3cca9e;};'use strict';var _=require('lodash');var util=require(_0x389e('0x0'));var logger=require(_0x389e('0x1'))(_0x389e('0x2'));var moment=require(_0x389e('0x3'));var BPromise=require('bluebird');var rp=require(_0x389e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x389e('0x5'));var attributes=require(_0x389e('0x6'));module[_0x389e('0x7')]=function(_0x78a400,_0x11f26d){return _0x78a400[_0x389e('0x8')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x305c=['moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x305c,0x103));var _0xc305=function(_0x2b6c01,_0x4a1d39){_0x2b6c01=_0x2b6c01-0x0;var _0x4c051e=_0x305c[_0x2b6c01];return _0x4c051e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc305('0x0'));var moment=require(_0xc305('0x1'));var BPromise=require(_0xc305('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc305('0x3'));var rimraf=require(_0xc305('0x4'));var config=require(_0xc305('0x5'));var attributes=require(_0xc305('0x6'));module[_0xc305('0x7')]=function(_0x8ad5b6,_0x5a9275){return _0x8ad5b6[_0xc305('0x8')](_0xc305('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 70d074e..274ab67 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 _0xed1f=['request','then','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1902d3,_0x192697){var _0x2969ae=function(_0x222db8){while(--_0x222db8){_0x1902d3['push'](_0x1902d3['shift']());}};_0x2969ae(++_0x192697);}(_0xed1f,0x6a));var _0xfed1=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xed1f[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('Tag,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('Tag,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0x9335=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3f0bc9,_0x5ad2a8){var _0x1d334d=function(_0x12563f){while(--_0x12563f){_0x3f0bc9['push'](_0x3f0bc9['shift']());}};_0x1d334d(++_0x5ad2a8);}(_0x9335,0xab));var _0x5933=function(_0x3476c7,_0xa8ab14){_0x3476c7=_0x3476c7-0x0;var _0x1101dd=_0x9335[_0x3476c7];return _0x1101dd;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var moment=require('moment');var BPromise=require(_0x5933('0x2'));var rs=require(_0x5933('0x3'));var fs=require('fs');var Redis=require(_0x5933('0x4'));var db=require(_0x5933('0x5'))['db'];var utils=require(_0x5933('0x6'));var logger=require(_0x5933('0x7'))(_0x5933('0x8'));var config=require('../../config/environment');var jayson=require(_0x5933('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21f4c1,_0x3f15fc,_0x21ab46){return new BPromise(function(_0x59c5cb,_0x2ad740){return client[_0x5933('0xa')](_0x21f4c1,_0x21ab46)[_0x5933('0xb')](function(_0xbcd6bb){logger[_0x5933('0xc')](_0x5933('0xd'),_0x3f15fc,_0x5933('0xe'));logger[_0x5933('0xf')](_0x5933('0x10'),_0x3f15fc,_0x5933('0xe'),JSON[_0x5933('0x11')](_0xbcd6bb));if(_0xbcd6bb[_0x5933('0x12')]){if(_0xbcd6bb[_0x5933('0x12')]['code']===0x1f4){logger[_0x5933('0x12')]('Tag,\x20%s,\x20%s',_0x3f15fc,_0xbcd6bb[_0x5933('0x12')][_0x5933('0x13')]);return _0x2ad740(_0xbcd6bb[_0x5933('0x12')]['message']);}logger[_0x5933('0x12')]('Tag,\x20%s,\x20%s',_0x3f15fc,_0xbcd6bb[_0x5933('0x12')]['message']);return _0x59c5cb(_0xbcd6bb[_0x5933('0x12')]['message']);}else{logger[_0x5933('0xc')]('Tag,\x20%s,\x20%s',_0x3f15fc,_0x5933('0xe'));_0x59c5cb(_0xbcd6bb[_0x5933('0x14')][_0x5933('0x13')]);}})['catch'](function(_0x48dc5b){logger[_0x5933('0x12')](_0x5933('0xd'),_0x3f15fc,_0x48dc5b);_0x2ad740(_0x48dc5b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0b96c08..27cb4bb 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(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 bacb5a7..fa441ce 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x1d5666,_0x1a10d8){var _0x44fab5=function(_0x2f1bbb){while(--_0x2f1bbb){_0x1d5666['push'](_0x1d5666['shift']());}};_0x44fab5(++_0x1a10d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 0db432e..56288f3 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 _0xcd8a=['findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','penalty','QueueId','findOrCreate','emit','User','interface','upsert','isNil','format','voicePause','all','TeamVoicePrefix','spread','removeAgents','Queue:remove','UserVoiceQueueRt','UserVoicePrefix','getAgents','hasOwnProperty','eml-format','rimraf','request-promise','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','error','name','send','index','map','Team','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','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','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','VoicePrefixId','getQueues'];(function(_0x4a1081,_0x3ff2d9){var _0x5e07e7=function(_0x577282){while(--_0x577282){_0x4a1081['push'](_0x4a1081['shift']());}};_0x5e07e7(++_0x3ff2d9);}(_0xcd8a,0x14c));var _0xacd8=function(_0x14b93d,_0x284a01){_0x14b93d=_0x14b93d-0x0;var _0x3a4b7d=_0xcd8a[_0x14b93d];return _0x3a4b7d;};'use strict';var emlformat=require(_0xacd8('0x0'));var rimraf=require(_0xacd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xacd8('0x2'));var moment=require('moment');var BPromise=require(_0xacd8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xacd8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacd8('0x5'));var fs=require('fs');var fs_extra=require(_0xacd8('0x6'));var _=require('lodash');var squel=require(_0xacd8('0x7'));var crypto=require(_0xacd8('0x8'));var jsforce=require(_0xacd8('0x9'));var deskjs=require(_0xacd8('0xa'));var toCsv=require(_0xacd8('0xb'));var querystring=require(_0xacd8('0xc'));var Papa=require('papaparse');var Redis=require(_0xacd8('0xd'));var authService=require(_0xacd8('0xe'));var qs=require(_0xacd8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacd8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xacd8('0x11'));var licenseUtil=require(_0xacd8('0x12'));var db=require(_0xacd8('0x13'))['db'];config[_0xacd8('0x14')]=_[_0xacd8('0x15')](config[_0xacd8('0x14')],{'host':_0xacd8('0x16'),'port':0x18eb});var socket=require(_0xacd8('0x17'))(new Redis(config[_0xacd8('0x14')]));require(_0xacd8('0x18'))[_0xacd8('0x19')](socket);function respondWithStatusCode(_0x1883e3,_0x564157){_0x564157=_0x564157||0xcc;return function(_0x1cc004){if(_0x1cc004){return _0x1883e3['sendStatus'](_0x564157);}return _0x1883e3[_0xacd8('0x1a')](_0x564157)[_0xacd8('0x1b')]();};}function respondWithResult(_0xea712c,_0x19bb0b){_0x19bb0b=_0x19bb0b||0xc8;return function(_0x5c09ca){if(_0x5c09ca){return _0xea712c[_0xacd8('0x1a')](_0x19bb0b)[_0xacd8('0x1c')](_0x5c09ca);}};}function respondWithFilteredResult(_0x293613,_0x1f65fa){return function(_0x151776){if(_0x151776){var _0x14dfb7=typeof _0x1f65fa[_0xacd8('0x1d')]===_0xacd8('0x1e')&&typeof _0x1f65fa[_0xacd8('0x1f')]==='undefined';var _0x4049ae=_0x151776['count'];var _0x280a7e=_0x14dfb7?0x0:_0x1f65fa[_0xacd8('0x1d')];var _0x3ed1c3=_0x14dfb7?_0x151776[_0xacd8('0x20')]:_0x1f65fa['offset']+_0x1f65fa[_0xacd8('0x1f')];var _0x20b4cb;if(_0x3ed1c3>=_0x4049ae){_0x3ed1c3=_0x4049ae;_0x20b4cb=0xc8;}else{_0x20b4cb=0xce;}_0x293613[_0xacd8('0x1a')](_0x20b4cb);return _0x293613[_0xacd8('0x21')](_0xacd8('0x22'),_0x280a7e+'-'+_0x3ed1c3+'/'+_0x4049ae)[_0xacd8('0x1c')](_0x151776);}return null;};}function patchUpdates(_0x3d43c5){return function(_0x2a74e4){try{jsonpatch['apply'](_0x2a74e4,_0x3d43c5,!![]);}catch(_0x5c1c50){return BPromise[_0xacd8('0x23')](_0x5c1c50);}return _0x2a74e4[_0xacd8('0x24')]();};}function saveUpdates(_0x43827f,_0x34c801){return function(_0x49b1b5){if(_0x49b1b5){return _0x49b1b5['update'](_0x43827f)['then'](function(_0xbff726){return _0xbff726;});}return null;};}function handleEntityNotFound(_0x4efc69,_0x508d98){return function(_0x23270f){if(!_0x23270f){_0x4efc69['sendStatus'](0x194);}return _0x23270f;};}function handleError(_0x1f9921,_0x411e0a){_0x411e0a=_0x411e0a||0x1f4;return function(_0x1c43bc){logger[_0xacd8('0x25')](_0x1c43bc['stack']);if(_0x1c43bc[_0xacd8('0x26')]){delete _0x1c43bc['name'];}_0x1f9921[_0xacd8('0x1a')](_0x411e0a)[_0xacd8('0x27')](_0x1c43bc);};}exports[_0xacd8('0x28')]=function(_0x4733f6,_0x524b53){var _0xe7a48={},_0x515b65={},_0x5a3864={'count':0x0,'rows':[]};var _0x310e64=_[_0xacd8('0x29')](db[_0xacd8('0x2a')][_0xacd8('0x2b')],function(_0x5adcd0){return{'name':_0x5adcd0[_0xacd8('0x2c')],'type':_0x5adcd0['type'][_0xacd8('0x2d')]};});_0x515b65[_0xacd8('0x2e')]=_[_0xacd8('0x29')](_0x310e64,_0xacd8('0x26'));_0x515b65['query']=_[_0xacd8('0x2f')](_0x4733f6[_0xacd8('0x30')]);_0x515b65[_0xacd8('0x31')]=_[_0xacd8('0x32')](_0x515b65[_0xacd8('0x2e')],_0x515b65[_0xacd8('0x30')]);_0xe7a48['attributes']=_[_0xacd8('0x32')](_0x515b65[_0xacd8('0x2e')],qs[_0xacd8('0x33')](_0x4733f6[_0xacd8('0x30')][_0xacd8('0x33')]));_0xe7a48[_0xacd8('0x34')]=_0xe7a48[_0xacd8('0x34')][_0xacd8('0x35')]?_0xe7a48[_0xacd8('0x34')]:_0x515b65[_0xacd8('0x2e')];if(!_0x4733f6[_0xacd8('0x30')]['hasOwnProperty'](_0xacd8('0x36'))){_0xe7a48['limit']=qs[_0xacd8('0x1f')](_0x4733f6[_0xacd8('0x30')][_0xacd8('0x1f')]);_0xe7a48[_0xacd8('0x1d')]=qs[_0xacd8('0x1d')](_0x4733f6[_0xacd8('0x30')][_0xacd8('0x1d')]);}_0xe7a48[_0xacd8('0x37')]=qs[_0xacd8('0x38')](_0x4733f6['query'][_0xacd8('0x38')]);_0xe7a48[_0xacd8('0x39')]=qs['filters'](_[_0xacd8('0x3a')](_0x4733f6['query'],_0x515b65['filters']),_0x310e64);if(_0x4733f6[_0xacd8('0x30')][_0xacd8('0x3b')]){_0xe7a48['where']=_[_0xacd8('0x3c')](_0xe7a48[_0xacd8('0x39')],{'$or':_[_0xacd8('0x29')](_0x310e64,function(_0x24bcca){if(_0x24bcca[_0xacd8('0x3d')]!=='VIRTUAL'){var _0x2b082a={};_0x2b082a[_0x24bcca[_0xacd8('0x26')]]={'$like':'%'+_0x4733f6[_0xacd8('0x30')]['filter']+'%'};return _0x2b082a;}})});}_0xe7a48=_[_0xacd8('0x3c')]({},_0xe7a48,_0x4733f6[_0xacd8('0x3e')]);var _0x52282a={'where':_0xe7a48[_0xacd8('0x39')]};return db[_0xacd8('0x2a')][_0xacd8('0x20')](_0x52282a)[_0xacd8('0x3f')](function(_0x57c1fa){_0x5a3864['count']=_0x57c1fa;if(_0x4733f6[_0xacd8('0x30')][_0xacd8('0x40')]){_0xe7a48[_0xacd8('0x41')]=[{'all':!![]}];}return db[_0xacd8('0x2a')][_0xacd8('0x42')](_0xe7a48);})[_0xacd8('0x3f')](function(_0x545e1f){_0x5a3864[_0xacd8('0x43')]=_0x545e1f;return _0x5a3864;})[_0xacd8('0x3f')](respondWithFilteredResult(_0x524b53,_0xe7a48))[_0xacd8('0x44')](handleError(_0x524b53,null));};exports[_0xacd8('0x45')]=function(_0x5b1604,_0x4d9099){var _0x54ee89={'raw':![],'where':{'id':_0x5b1604[_0xacd8('0x46')]['id']}},_0x3067a8={};_0x3067a8[_0xacd8('0x2e')]=_[_0xacd8('0x2f')](db['Team'][_0xacd8('0x2b')]);_0x3067a8[_0xacd8('0x30')]=_['keys'](_0x5b1604[_0xacd8('0x30')]);_0x3067a8[_0xacd8('0x31')]=_[_0xacd8('0x32')](_0x3067a8['model'],_0x3067a8[_0xacd8('0x30')]);_0x54ee89['attributes']=_[_0xacd8('0x32')](_0x3067a8['model'],qs[_0xacd8('0x33')](_0x5b1604[_0xacd8('0x30')]['fields']));_0x54ee89[_0xacd8('0x34')]=_0x54ee89['attributes'][_0xacd8('0x35')]?_0x54ee89[_0xacd8('0x34')]:_0x3067a8['model'];if(_0x5b1604['query'][_0xacd8('0x40')]){_0x54ee89[_0xacd8('0x41')]=[{'all':!![]}];}_0x54ee89=_[_0xacd8('0x3c')]({},_0x54ee89,_0x5b1604['options']);return db['Team'][_0xacd8('0x47')](_0x54ee89)['then'](handleEntityNotFound(_0x4d9099,null))[_0xacd8('0x3f')](respondWithResult(_0x4d9099,null))[_0xacd8('0x44')](handleError(_0x4d9099,null));};exports[_0xacd8('0x48')]=function(_0x2cabbf,_0x9eac8){return db[_0xacd8('0x2a')][_0xacd8('0x48')](_0x2cabbf[_0xacd8('0x49')],{})[_0xacd8('0x3f')](function(_0x2b47e7){var _0x359e29=_0x2cabbf[_0xacd8('0x4a')][_0xacd8('0x4b')]({'plain':!![]});if(!_0x359e29)throw new Error(_0xacd8('0x4c'));if(_0x359e29[_0xacd8('0x4d')]===_0xacd8('0x4a')){var _0x394be3=_0x2b47e7[_0xacd8('0x4b')]({'plain':!![]});var _0x1f0788=_0xacd8('0x4e');return db[_0xacd8('0x4f')][_0xacd8('0x47')]({'where':{'name':_0x1f0788,'userProfileId':_0x359e29['userProfileId']},'raw':!![]})[_0xacd8('0x3f')](function(_0x53cd34){if(_0x53cd34&&_0x53cd34[_0xacd8('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x394be3[_0xacd8('0x26')],'resourceId':_0x394be3['id'],'type':_0x53cd34[_0xacd8('0x26')],'sectionId':_0x53cd34['id']},{})[_0xacd8('0x3f')](function(){return _0x2b47e7;});}else{return _0x2b47e7;}})[_0xacd8('0x44')](function(_0x25d7a4){logger[_0xacd8('0x25')](_0xacd8('0x51'),_0x25d7a4);throw _0x25d7a4;});}return _0x2b47e7;})[_0xacd8('0x3f')](respondWithResult(_0x9eac8,0xc9))[_0xacd8('0x44')](handleError(_0x9eac8,null));};exports[_0xacd8('0x52')]=function(_0x2da627,_0x3e948d){if(_0x2da627['body']['id']){delete _0x2da627['body']['id'];}return db['Team']['find']({'where':{'id':_0x2da627[_0xacd8('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e948d,null))['then'](saveUpdates(_0x2da627[_0xacd8('0x49')],null))[_0xacd8('0x3f')](respondWithResult(_0x3e948d,null))['catch'](handleError(_0x3e948d,null));};exports[_0xacd8('0x53')]=function(_0x2613be,_0x4b61e6){var _0x75efbc=_0x2613be[_0xacd8('0x46')]['id'];var _0x1d916e=[];return db['sequelize'][_0xacd8('0x54')](function(_0x560c33){var _0x44e4b2=_0xacd8('0x55')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x44e4b2,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33})[_0xacd8('0x3f')](function(_0x5ae2a5){_0x1d916e=_[_0xacd8('0x29')](_0x5ae2a5,function(_0x567527){return Number(_0x567527['UserId']);});})[_0xacd8('0x3f')](function(){var _0x19b106=_0xacd8('0x5a')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x19b106,{'type':db['Sequelize']['QueryTypes'][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x29a1e1){var _0x2b34e0=_['map'](_0x29a1e1,function(_0x2ab8a3){return Number(_0x2ab8a3['VoiceQueueId']);});return db[_0xacd8('0x5b')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'VoiceQueueId':{'$in':_0x2b34e0}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0x15f24e=_0xacd8('0x5c')+_0x75efbc;return db[_0xacd8('0x56')]['query'](_0x15f24e,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x7ffe5c){var _0x12d10b=_['map'](_0x7ffe5c,function(_0x3ee14b){return Number(_0x3ee14b['MailQueueId']);});return db[_0xacd8('0x5d')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'MailQueueId':{'$in':_0x12d10b}},'transaction':_0x560c33});})['then'](function(){var _0x2cceb7='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x2cceb7,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')]['SELECT'],'raw':!![],'transaction':_0x560c33});})['then'](function(_0x558fa7){var _0x24fc0a=_[_0xacd8('0x29')](_0x558fa7,function(_0xd57dcc){return Number(_0xd57dcc[_0xacd8('0x5e')]);});return db['UserSmsQueue'][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'SmsQueueId':{'$in':_0x24fc0a}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0x8f38f8=_0xacd8('0x5f')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x8f38f8,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x104f01){var _0x5646e8=_['map'](_0x104f01,function(_0x5e4098){return Number(_0x5e4098[_0xacd8('0x60')]);});return db[_0xacd8('0x61')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'ChatQueueId':{'$in':_0x5646e8}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0xa13ac1='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0xa13ac1,{'type':db[_0xacd8('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x24cc28){var _0x5ba812=_[_0xacd8('0x29')](_0x24cc28,function(_0x16527a){return Number(_0x16527a[_0xacd8('0x62')]);});return db[_0xacd8('0x63')][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'FaxQueueId':{'$in':_0x5ba812}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){var _0x276d9a=_0xacd8('0x64')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x276d9a,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')]['SELECT'],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x188fa3){var _0x2acfbd=_[_0xacd8('0x29')](_0x188fa3,function(_0x19425c){return Number(_0x19425c[_0xacd8('0x65')]);});return db[_0xacd8('0x66')]['destroy']({'where':{'UserId':{'$in':_0x1d916e},'OpenchannelQueueId':{'$in':_0x2acfbd}},'transaction':_0x560c33});})['then'](function(){var _0x3e2e50=_0xacd8('0x67')+_0x75efbc;return db[_0xacd8('0x56')][_0xacd8('0x30')](_0x3e2e50,{'type':db[_0xacd8('0x57')][_0xacd8('0x58')][_0xacd8('0x59')],'raw':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x3c5b6d){var _0x5113ac=_[_0xacd8('0x29')](_0x3c5b6d,function(_0x4422ea){return Number(_0x4422ea['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xacd8('0x53')]({'where':{'UserId':{'$in':_0x1d916e},'WhatsappQueueId':{'$in':_0x5113ac}},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){return db['TeamVoicePrefix'][_0xacd8('0x47')]({'where':{'TeamId':_0x75efbc}});})['then'](function(_0x3613eb){if(_0x3613eb===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x1d916e},'VoicePrefixId':_0x3613eb[_0xacd8('0x68')]},'transaction':_0x560c33});})[_0xacd8('0x3f')](function(){return db[_0xacd8('0x2a')][_0xacd8('0x53')]({'where':{'id':_0x75efbc},'cascade':!![],'transaction':_0x560c33});})[_0xacd8('0x3f')](function(_0x323b59){if(_0x323b59===0x0){_0x4b61e6['sendStatus'](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0xacd8('0x4e'),'resourceId':_0x75efbc},'cascade':!![],'transaction':_0x560c33})[_0xacd8('0x3f')](function(){_0x4b61e6[_0xacd8('0x1a')](0xcc)[_0xacd8('0x1b')]();});}})['catch'](function(_0xae0283){_0x4b61e6[_0xacd8('0x1a')](0x1f4)[_0xacd8('0x27')](_0xae0283);});});};exports[_0xacd8('0x69')]=function(_0x542212,_0x58e9a4,_0x225200){return db['Team'][_0xacd8('0x6a')]({'where':{'id':_0x542212[_0xacd8('0x46')]['id']}})[_0xacd8('0x3f')](handleEntityNotFound(_0x58e9a4,null))[_0xacd8('0x3f')](function(_0x2be2ee){if(!_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')]||!utils['isValidChannel'](_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')])){throw new db['Sequelize'][(_0xacd8('0x6c'))](_0xacd8('0x6d'));}var _0x4c0a97={};var _0x4c2f05={};_0x4c2f05[_0xacd8('0x2e')]=_[_0xacd8('0x2f')](db[_[_0xacd8('0x6e')](_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')][_0xacd8('0x6f')]())+_0xacd8('0x70')][_0xacd8('0x2b')]);_0x4c2f05[_0xacd8('0x30')]=_['keys'](_0x542212[_0xacd8('0x30')]);_0x4c2f05[_0xacd8('0x31')]=_[_0xacd8('0x32')](_0x4c2f05[_0xacd8('0x2e')],_0x4c2f05['query']);_0x4c0a97[_0xacd8('0x34')]=_['intersection'](_0x4c2f05[_0xacd8('0x2e')],qs[_0xacd8('0x33')](_0x542212[_0xacd8('0x30')][_0xacd8('0x33')]));_0x4c0a97['attributes']=_0x4c0a97[_0xacd8('0x34')][_0xacd8('0x35')]?_0x4c0a97[_0xacd8('0x34')]:_0x4c2f05[_0xacd8('0x2e')];_0x4c0a97['limit']=qs['limit'](_0x542212[_0xacd8('0x30')]['limit']);_0x4c0a97[_0xacd8('0x1d')]=qs[_0xacd8('0x1d')](_0x542212[_0xacd8('0x30')][_0xacd8('0x1d')]);_0x4c0a97[_0xacd8('0x37')]=qs[_0xacd8('0x38')](_0x542212[_0xacd8('0x30')]['sort']);_0x4c0a97[_0xacd8('0x39')]=qs[_0xacd8('0x31')](_[_0xacd8('0x3a')](_0x542212[_0xacd8('0x30')],_0x4c2f05['filters']));_0x4c0a97=_[_0xacd8('0x3c')]({},_0x4c0a97,_0x542212[_0xacd8('0x3e')]);return _0x2be2ee[_0xacd8('0x4b')+_[_0xacd8('0x6e')](_0x542212[_0xacd8('0x30')][_0xacd8('0x6b')]['toLowerCase']())+_0xacd8('0x71')](_0x4c0a97);})[_0xacd8('0x3f')](respondWithResult(_0x58e9a4,null))[_0xacd8('0x44')](handleError(_0x58e9a4,null));};exports[_0xacd8('0x72')]=function(_0x59a7d3,_0x4c4946,_0x21b95e){return db[_0xacd8('0x2a')]['findOne']({'where':{'id':_0x59a7d3[_0xacd8('0x46')]['id']}})['then'](function(_0x12c1cd){if(_0x12c1cd){if(!_0x59a7d3[_0xacd8('0x49')]['channel']||!utils['isValidChannel'](_0x59a7d3[_0xacd8('0x49')]['channel'])){throw new db['Sequelize'][(_0xacd8('0x6c'))](_0xacd8('0x6d'));}return _0x12c1cd[_0xacd8('0x73')+_[_0xacd8('0x6e')](_0x59a7d3['body']['channel'][_0xacd8('0x6f')]())+_0xacd8('0x71')](_0x59a7d3['body'][_0xacd8('0x74')]);}return null;})[_0xacd8('0x3f')](handleEntityNotFound(_0x4c4946,null))['then'](respondWithStatusCode(_0x4c4946,null))['catch'](handleError(_0x4c4946,null));};exports[_0xacd8('0x75')]=function(_0x1ef489,_0x13f683,_0x6de226){return db['Team']['findOne']({'where':{'id':_0x1ef489[_0xacd8('0x46')]['id']}})[_0xacd8('0x3f')](function(_0x5254b8){if(_0x5254b8){if(!_0x1ef489[_0xacd8('0x30')][_0xacd8('0x6b')]||!utils['isValidChannel'](_0x1ef489[_0xacd8('0x30')][_0xacd8('0x6b')])){throw new db[(_0xacd8('0x57'))]['ValidationError'](_0xacd8('0x6d'));}return _0x5254b8[_0xacd8('0x76')+_[_0xacd8('0x6e')](_0x1ef489[_0xacd8('0x30')][_0xacd8('0x6b')][_0xacd8('0x6f')]())+_0xacd8('0x71')](_0x1ef489[_0xacd8('0x30')][_0xacd8('0x74')]);}return null;})['then'](handleEntityNotFound(_0x13f683,null))[_0xacd8('0x3f')](respondWithStatusCode(_0x13f683,null))[_0xacd8('0x44')](handleError(_0x13f683,null));};exports[_0xacd8('0x77')]=function(_0x30dd48,_0x2cb547){var _0x21befa=_[_0xacd8('0x78')](_0x30dd48[_0xacd8('0x49')][_0xacd8('0x74')])?_0x30dd48[_0xacd8('0x49')][_0xacd8('0x74')]:[_0x30dd48[_0xacd8('0x49')][_0xacd8('0x74')]];var _0x1724af=_0x30dd48['params']['id'];return db[_0xacd8('0x2a')][_0xacd8('0x47')]({'where':{'id':_0x1724af}})[_0xacd8('0x3f')](handleEntityNotFound(_0x2cb547,null))[_0xacd8('0x3f')](function(_0x20fac8){if(_0x20fac8){var _0x2c2eca=[_0xacd8('0x79'),_0xacd8('0x7a'),_0xacd8('0x7b'),_0xacd8('0x7c'),_0xacd8('0x7d'),_0xacd8('0x7e'),'Whatsapp'];return db[_0xacd8('0x56')][_0xacd8('0x54')](function(_0x13ea06){var _0x3f9e2b=_['map'](_0x2c2eca,function(_0x2c6959){var _0x40073c={'attributes':['id','name']};if(_0x2c6959==='Voice'){_0x40073c['through']={'attributes':[_0xacd8('0x7f')]};}return _0x20fac8[_0xacd8('0x4b')+_0x2c6959+'Queues'](_0x40073c)[_0xacd8('0x3f')](function(_0x581be3){var _0x2acb91=_[_0xacd8('0x29')](_0x581be3,function(_0x1ddf69){var _0x53e343=_[_0xacd8('0x29')](_0x21befa,function(_0x4fe278){var _0x4949b6={'where':{'UserId':_0x4fe278,[_0x2c6959+_0xacd8('0x80')]:_0x1ddf69['id']},'transaction':_0x13ea06};if(_0x2c6959===_0xacd8('0x79')){_0x4949b6['defaults']={'penalty':_0x1ddf69['TeamVoiceQueue'][_0xacd8('0x7f')]};}return db['User'+_0x2c6959+'Queue'][_0xacd8('0x81')](_0x4949b6)['then'](function(){socket[_0xacd8('0x82')]('user'+_0x2c6959+'Queue:save',{'UserId':_0x4fe278,[_0x2c6959+_0xacd8('0x80')]:_0x1ddf69['id']});if(_0x2c6959!==_0xacd8('0x79')){return;}return db[_0xacd8('0x83')][_0xacd8('0x42')]({'where':{'id':_0x21befa,'online':0x1},'attributes':['id',_0xacd8('0x26'),'online','voicePause',_0xacd8('0x84')],'raw':!![]})[_0xacd8('0x3f')](function(_0x50d63c){var _0x4462e5=_['map'](_0x50d63c,function(_0x3f76dd){return db['UserVoiceQueueRt'][_0xacd8('0x85')]({'membername':_0x3f76dd['name'],'UserId':_0x3f76dd['id'],'queue_name':_0x1ddf69[_0xacd8('0x26')],'VoiceQueueId':_0x1ddf69['id'],'interface':_[_0xacd8('0x86')](_0x3f76dd[_0xacd8('0x84')])?util[_0xacd8('0x87')]('SIP/%s',_0x3f76dd[_0xacd8('0x26')]):_0x3f76dd['interface'],'paused':_0x3f76dd[_0xacd8('0x88')]||![],'penalty':_0x1ddf69['TeamVoiceQueue'][_0xacd8('0x7f')]},{'transaction':_0x13ea06});});return Promise[_0xacd8('0x89')](_0x4462e5);});});});return Promise['all'](_0x53e343);});return Promise[_0xacd8('0x89')](_0x2acb91);})['then'](function(){return db[_0xacd8('0x8a')][_0xacd8('0x6a')]({'where':{'teamId':_0x1724af}})[_0xacd8('0x3f')](function(_0x2b07e9){if(_0x2b07e9){var _0x4ff979=_[_0xacd8('0x29')](_0x21befa,function(_0x1e9c36){db['UserVoicePrefix']['upsert']({'UserId':_0x1e9c36,'VoicePrefixId':_0x2b07e9[_0xacd8('0x68')]});});return Promise[_0xacd8('0x89')](_0x4ff979);}});});});return Promise['all'](_0x3f9e2b)[_0xacd8('0x3f')](function(){return _0x20fac8[_0xacd8('0x77')](_0x21befa,{'transaction':_0x13ea06})[_0xacd8('0x8b')](function(_0x105d5d){return _0x105d5d;});});});}})[_0xacd8('0x3f')](respondWithResult(_0x2cb547,null))[_0xacd8('0x44')](handleError(_0x2cb547,null));};exports[_0xacd8('0x8c')]=function(_0x4d0cfc,_0xf90355){var _0x50c262=_['isArray'](_0x4d0cfc[_0xacd8('0x30')][_0xacd8('0x74')])?_0x4d0cfc[_0xacd8('0x30')]['ids']:[_0x4d0cfc[_0xacd8('0x30')]['ids']];var _0x55a4e2=_0x4d0cfc[_0xacd8('0x46')]['id'];return db[_0xacd8('0x2a')][_0xacd8('0x47')]({'where':{'id':_0x55a4e2}})[_0xacd8('0x3f')](handleEntityNotFound(_0xf90355,null))[_0xacd8('0x3f')](function(_0x1a249d){if(_0x1a249d){var _0x4c9114=['Voice',_0xacd8('0x7a'),_0xacd8('0x7b'),_0xacd8('0x7c'),_0xacd8('0x7d'),_0xacd8('0x7e'),'Whatsapp'];return db[_0xacd8('0x56')][_0xacd8('0x54')](function(_0x34d653){var _0x2f6a0a=_[_0xacd8('0x29')](_0x4c9114,function(_0x6372af){var _0x19be06={'attributes':['id',_0xacd8('0x26')]};return _0x1a249d[_0xacd8('0x4b')+_0x6372af+_0xacd8('0x71')](_0x19be06)['then'](function(_0x61f086){var _0x59043f=_[_0xacd8('0x29')](_0x61f086,function(_0x557c4f){return _0x557c4f['removeAgents'](_0x50c262,{'transaction':_0x34d653})[_0xacd8('0x3f')](function(){var _0x588169=_[_0xacd8('0x29')](_0x50c262,function(_0x476880){socket[_0xacd8('0x82')](_0xacd8('0x4a')+_0x6372af+_0xacd8('0x8d'),{'UserId':Number(_0x476880),[_0x6372af+_0xacd8('0x80')]:_0x557c4f['id']});if(_0x6372af!==_0xacd8('0x79')){return;}return db[_0xacd8('0x8e')][_0xacd8('0x53')]({'where':{'VoiceQueueId':_0x557c4f['id'],'UserId':_0x476880},'transaction':_0x34d653});});return Promise[_0xacd8('0x89')](_0x588169);});});return Promise[_0xacd8('0x89')](_0x59043f);});});return Promise['all'](_0x2f6a0a)[_0xacd8('0x3f')](function(){return _0x1a249d[_0xacd8('0x8c')](_0x50c262,{'transaction':_0x34d653});})[_0xacd8('0x3f')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x55a4e2}})[_0xacd8('0x3f')](function(_0x1216c9){if(_0x1216c9){var _0x4bd2c4=_[_0xacd8('0x29')](_0x50c262,function(_0x555b00){db[_0xacd8('0x8f')][_0xacd8('0x53')]({'where':{'UserId':_0x555b00,'VoicePrefixId':_0x1216c9[_0xacd8('0x68')]}});});return Promise[_0xacd8('0x89')](_0x4bd2c4);}});});});}})[_0xacd8('0x3f')](respondWithStatusCode(_0xf90355,null))[_0xacd8('0x44')](handleError(_0xf90355,null));};exports[_0xacd8('0x90')]=function(_0x15210f,_0x39fdfd,_0x4fcb6e){var _0x9214b={};var _0x5abaf4={};var _0x2a0b51;var _0x523233;return db[_0xacd8('0x2a')]['findOne']({'where':{'id':_0x15210f[_0xacd8('0x46')]['id']}})[_0xacd8('0x3f')](handleEntityNotFound(_0x39fdfd,null))[_0xacd8('0x3f')](function(_0x40c313){if(_0x40c313){_0x2a0b51=_0x40c313;_0x5abaf4[_0xacd8('0x2e')]=_[_0xacd8('0x2f')](db[_0xacd8('0x83')][_0xacd8('0x2b')]);_0x5abaf4[_0xacd8('0x30')]=_[_0xacd8('0x2f')](_0x15210f['query']);_0x5abaf4['filters']=_[_0xacd8('0x32')](_0x5abaf4['model'],_0x5abaf4[_0xacd8('0x30')]);_0x9214b[_0xacd8('0x34')]=_[_0xacd8('0x32')](_0x5abaf4[_0xacd8('0x2e')],qs[_0xacd8('0x33')](_0x15210f[_0xacd8('0x30')][_0xacd8('0x33')]));_0x9214b[_0xacd8('0x34')]=_0x9214b[_0xacd8('0x34')]['length']?_0x9214b[_0xacd8('0x34')]:_0x5abaf4[_0xacd8('0x2e')];_0x9214b[_0xacd8('0x37')]=qs[_0xacd8('0x38')](_0x15210f[_0xacd8('0x30')][_0xacd8('0x38')]);_0x9214b[_0xacd8('0x39')]=qs[_0xacd8('0x31')](_[_0xacd8('0x3a')](_0x15210f[_0xacd8('0x30')],_0x5abaf4[_0xacd8('0x31')]));if(_0x15210f[_0xacd8('0x30')]['filter']){_0x9214b['where']=_['merge'](_0x9214b[_0xacd8('0x39')],{'$or':_[_0xacd8('0x29')](_0x9214b['attributes'],function(_0x1cd998){var _0x33e15f={};_0x33e15f[_0x1cd998]={'$like':'%'+_0x15210f['query'][_0xacd8('0x3b')]+'%'};return _0x33e15f;})});}_0x9214b=_[_0xacd8('0x3c')]({},_0x9214b,_0x15210f[_0xacd8('0x3e')]);return _0x2a0b51[_0xacd8('0x90')](_0x9214b);}})['then'](function(_0x10a3ed){if(_0x10a3ed){_0x523233=_0x10a3ed[_0xacd8('0x35')];if(!_0x15210f[_0xacd8('0x30')][_0xacd8('0x91')]('nolimit')){_0x9214b[_0xacd8('0x1f')]=qs['limit'](_0x15210f['query'][_0xacd8('0x1f')]);_0x9214b[_0xacd8('0x1d')]=qs[_0xacd8('0x1d')](_0x15210f['query'][_0xacd8('0x1d')]);}return _0x2a0b51[_0xacd8('0x90')](_0x9214b);}})[_0xacd8('0x3f')](function(_0x21fca2){if(_0x21fca2){return _0x21fca2?{'count':_0x523233,'rows':_0x21fca2}:null;}})[_0xacd8('0x3f')](respondWithResult(_0x39fdfd,null))[_0xacd8('0x44')](handleError(_0x39fdfd,null));}; \ No newline at end of file +var _0xed38=['map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','filter','options','Team','then','includeAll','include','findAll','catch','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','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','UserProfileResource','getQueues','isValidChannel','channel','Unknown\x20channel','capitalize','filters','length','order','pick','toLowerCase','Queues','addQueues','findOne','ValidationError','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','spread','removeAgents','Fax','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','name','send','index'];(function(_0x43305f,_0x320675){var _0x32a65f=function(_0x3497f9){while(--_0x3497f9){_0x43305f['push'](_0x43305f['shift']());}};_0x32a65f(++_0x320675);}(_0xed38,0x70));var _0x8ed3=function(_0x4ce0fb,_0x2ce5b4){_0x4ce0fb=_0x4ce0fb-0x0;var _0xf04134=_0xed38[_0x4ce0fb];return _0xf04134;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ed3('0x0'));var zipdir=require(_0x8ed3('0x1'));var jsonpatch=require(_0x8ed3('0x2'));var rp=require(_0x8ed3('0x3'));var moment=require(_0x8ed3('0x4'));var BPromise=require(_0x8ed3('0x5'));var Mustache=require(_0x8ed3('0x6'));var util=require(_0x8ed3('0x7'));var path=require(_0x8ed3('0x8'));var sox=require(_0x8ed3('0x9'));var csv=require(_0x8ed3('0xa'));var ejs=require(_0x8ed3('0xb'));var fs=require('fs');var fs_extra=require(_0x8ed3('0xc'));var _=require('lodash');var squel=require(_0x8ed3('0xd'));var crypto=require(_0x8ed3('0xe'));var jsforce=require(_0x8ed3('0xf'));var deskjs=require(_0x8ed3('0x10'));var toCsv=require(_0x8ed3('0xa'));var querystring=require(_0x8ed3('0x11'));var Papa=require('papaparse');var Redis=require(_0x8ed3('0x12'));var authService=require(_0x8ed3('0x13'));var qs=require(_0x8ed3('0x14'));var as=require(_0x8ed3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ed3('0x16'))(_0x8ed3('0x17'));var utils=require(_0x8ed3('0x18'));var config=require(_0x8ed3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ed3('0x1a'))['db'];config[_0x8ed3('0x1b')]=_[_0x8ed3('0x1c')](config[_0x8ed3('0x1b')],{'host':_0x8ed3('0x1d'),'port':0x18eb});var socket=require(_0x8ed3('0x1e'))(new Redis(config[_0x8ed3('0x1b')]));require(_0x8ed3('0x1f'))[_0x8ed3('0x20')](socket);function respondWithStatusCode(_0x129bd0,_0x120a32){_0x120a32=_0x120a32||0xcc;return function(_0x3178b7){if(_0x3178b7){return _0x129bd0[_0x8ed3('0x21')](_0x120a32);}return _0x129bd0[_0x8ed3('0x22')](_0x120a32)['end']();};}function respondWithResult(_0x3bed2b,_0x3535da){_0x3535da=_0x3535da||0xc8;return function(_0x56e1e3){if(_0x56e1e3){return _0x3bed2b[_0x8ed3('0x22')](_0x3535da)['json'](_0x56e1e3);}};}function respondWithFilteredResult(_0xe62037,_0x1b7b5b){return function(_0x489d0e){if(_0x489d0e){var _0x281082=typeof _0x1b7b5b['offset']===_0x8ed3('0x23')&&typeof _0x1b7b5b[_0x8ed3('0x24')]===_0x8ed3('0x23');var _0x90efe3=_0x489d0e[_0x8ed3('0x25')];var _0x48854e=_0x281082?0x0:_0x1b7b5b[_0x8ed3('0x26')];var _0x11302c=_0x281082?_0x489d0e[_0x8ed3('0x25')]:_0x1b7b5b[_0x8ed3('0x26')]+_0x1b7b5b[_0x8ed3('0x24')];var _0x423fa8;if(_0x11302c>=_0x90efe3){_0x11302c=_0x90efe3;_0x423fa8=0xc8;}else{_0x423fa8=0xce;}_0xe62037[_0x8ed3('0x22')](_0x423fa8);return _0xe62037[_0x8ed3('0x27')](_0x8ed3('0x28'),_0x48854e+'-'+_0x11302c+'/'+_0x90efe3)[_0x8ed3('0x29')](_0x489d0e);}return null;};}function patchUpdates(_0x3d78fb){return function(_0x72e9bb){try{jsonpatch['apply'](_0x72e9bb,_0x3d78fb,!![]);}catch(_0x4f8079){return BPromise[_0x8ed3('0x2a')](_0x4f8079);}return _0x72e9bb['save']();};}function saveUpdates(_0x158c70,_0x5b9c3f){return function(_0x267e21){if(_0x267e21){return _0x267e21[_0x8ed3('0x2b')](_0x158c70)['then'](function(_0x521b1f){return _0x521b1f;});}return null;};}function handleEntityNotFound(_0xf211e7,_0x5955a6){return function(_0x1980e1){if(!_0x1980e1){_0xf211e7[_0x8ed3('0x21')](0x194);}return _0x1980e1;};}function handleError(_0x1495ea,_0x2a523c){_0x2a523c=_0x2a523c||0x1f4;return function(_0x12c547){logger['error'](_0x12c547['stack']);if(_0x12c547[_0x8ed3('0x2c')]){delete _0x12c547[_0x8ed3('0x2c')];}_0x1495ea[_0x8ed3('0x22')](_0x2a523c)[_0x8ed3('0x2d')](_0x12c547);};}exports[_0x8ed3('0x2e')]=function(_0x2fbde4,_0x340f93){var _0x5e59c1={},_0x6b4a86={},_0x4b79a3={'count':0x0,'rows':[]};var _0xb8546=_[_0x8ed3('0x2f')](db['Team'][_0x8ed3('0x30')],function(_0x1811a4){return{'name':_0x1811a4['fieldName'],'type':_0x1811a4[_0x8ed3('0x31')][_0x8ed3('0x32')]};});_0x6b4a86['model']=_['map'](_0xb8546,'name');_0x6b4a86[_0x8ed3('0x33')]=_[_0x8ed3('0x34')](_0x2fbde4['query']);_0x6b4a86['filters']=_[_0x8ed3('0x35')](_0x6b4a86[_0x8ed3('0x36')],_0x6b4a86['query']);_0x5e59c1['attributes']=_['intersection'](_0x6b4a86['model'],qs['fields'](_0x2fbde4[_0x8ed3('0x33')][_0x8ed3('0x37')]));_0x5e59c1[_0x8ed3('0x38')]=_0x5e59c1[_0x8ed3('0x38')]['length']?_0x5e59c1[_0x8ed3('0x38')]:_0x6b4a86[_0x8ed3('0x36')];if(!_0x2fbde4['query'][_0x8ed3('0x39')](_0x8ed3('0x3a'))){_0x5e59c1[_0x8ed3('0x24')]=qs[_0x8ed3('0x24')](_0x2fbde4[_0x8ed3('0x33')][_0x8ed3('0x24')]);_0x5e59c1[_0x8ed3('0x26')]=qs[_0x8ed3('0x26')](_0x2fbde4['query']['offset']);}_0x5e59c1['order']=qs[_0x8ed3('0x3b')](_0x2fbde4[_0x8ed3('0x33')]['sort']);_0x5e59c1[_0x8ed3('0x3c')]=qs['filters'](_['pick'](_0x2fbde4[_0x8ed3('0x33')],_0x6b4a86['filters']),_0xb8546);if(_0x2fbde4['query']['filter']){_0x5e59c1[_0x8ed3('0x3c')]=_[_0x8ed3('0x3d')](_0x5e59c1[_0x8ed3('0x3c')],{'$or':_['map'](_0xb8546,function(_0x454ae5){if(_0x454ae5[_0x8ed3('0x31')]!=='VIRTUAL'){var _0x191abe={};_0x191abe[_0x454ae5[_0x8ed3('0x2c')]]={'$like':'%'+_0x2fbde4[_0x8ed3('0x33')][_0x8ed3('0x3e')]+'%'};return _0x191abe;}})});}_0x5e59c1=_[_0x8ed3('0x3d')]({},_0x5e59c1,_0x2fbde4[_0x8ed3('0x3f')]);var _0x3373d2={'where':_0x5e59c1['where']};return db[_0x8ed3('0x40')][_0x8ed3('0x25')](_0x3373d2)[_0x8ed3('0x41')](function(_0x3f0563){_0x4b79a3[_0x8ed3('0x25')]=_0x3f0563;if(_0x2fbde4[_0x8ed3('0x33')][_0x8ed3('0x42')]){_0x5e59c1[_0x8ed3('0x43')]=[{'all':!![]}];}return db['Team'][_0x8ed3('0x44')](_0x5e59c1);})[_0x8ed3('0x41')](function(_0x350dbd){_0x4b79a3['rows']=_0x350dbd;return _0x4b79a3;})[_0x8ed3('0x41')](respondWithFilteredResult(_0x340f93,_0x5e59c1))[_0x8ed3('0x45')](handleError(_0x340f93,null));};exports['show']=function(_0x3667c4,_0x466ace){var _0x23e76a={'raw':![],'where':{'id':_0x3667c4[_0x8ed3('0x46')]['id']}},_0x34b209={};_0x34b209['model']=_[_0x8ed3('0x34')](db[_0x8ed3('0x40')][_0x8ed3('0x30')]);_0x34b209[_0x8ed3('0x33')]=_[_0x8ed3('0x34')](_0x3667c4['query']);_0x34b209['filters']=_[_0x8ed3('0x35')](_0x34b209[_0x8ed3('0x36')],_0x34b209[_0x8ed3('0x33')]);_0x23e76a['attributes']=_[_0x8ed3('0x35')](_0x34b209[_0x8ed3('0x36')],qs[_0x8ed3('0x37')](_0x3667c4[_0x8ed3('0x33')][_0x8ed3('0x37')]));_0x23e76a[_0x8ed3('0x38')]=_0x23e76a[_0x8ed3('0x38')]['length']?_0x23e76a['attributes']:_0x34b209[_0x8ed3('0x36')];if(_0x3667c4['query']['includeAll']){_0x23e76a[_0x8ed3('0x43')]=[{'all':!![]}];}_0x23e76a=_[_0x8ed3('0x3d')]({},_0x23e76a,_0x3667c4[_0x8ed3('0x3f')]);return db[_0x8ed3('0x40')][_0x8ed3('0x47')](_0x23e76a)['then'](handleEntityNotFound(_0x466ace,null))['then'](respondWithResult(_0x466ace,null))[_0x8ed3('0x45')](handleError(_0x466ace,null));};exports[_0x8ed3('0x48')]=function(_0x2a2edb,_0x4e503c){return db['Team'][_0x8ed3('0x48')](_0x2a2edb[_0x8ed3('0x49')],{})[_0x8ed3('0x41')](function(_0x58632f){var _0x3e18b6=_0x2a2edb['user'][_0x8ed3('0x4a')]({'plain':!![]});if(!_0x3e18b6)throw new Error(_0x8ed3('0x4b'));if(_0x3e18b6[_0x8ed3('0x4c')]===_0x8ed3('0x4d')){var _0x1031d4=_0x58632f['get']({'plain':!![]});var _0x7c9498=_0x8ed3('0x4e');return db[_0x8ed3('0x4f')][_0x8ed3('0x47')]({'where':{'name':_0x7c9498,'userProfileId':_0x3e18b6[_0x8ed3('0x50')]},'raw':!![]})[_0x8ed3('0x41')](function(_0x45477e){if(_0x45477e&&_0x45477e[_0x8ed3('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x1031d4[_0x8ed3('0x2c')],'resourceId':_0x1031d4['id'],'type':_0x45477e['name'],'sectionId':_0x45477e['id']},{})[_0x8ed3('0x41')](function(){return _0x58632f;});}else{return _0x58632f;}})[_0x8ed3('0x45')](function(_0x3eeef2){logger[_0x8ed3('0x52')](_0x8ed3('0x53'),_0x3eeef2);throw _0x3eeef2;});}return _0x58632f;})[_0x8ed3('0x41')](respondWithResult(_0x4e503c,0xc9))[_0x8ed3('0x45')](handleError(_0x4e503c,null));};exports['update']=function(_0x5243d3,_0x3ed2f4){if(_0x5243d3['body']['id']){delete _0x5243d3[_0x8ed3('0x49')]['id'];}return db[_0x8ed3('0x40')]['find']({'where':{'id':_0x5243d3['params']['id']}})[_0x8ed3('0x41')](handleEntityNotFound(_0x3ed2f4,null))[_0x8ed3('0x41')](saveUpdates(_0x5243d3[_0x8ed3('0x49')],null))[_0x8ed3('0x41')](respondWithResult(_0x3ed2f4,null))[_0x8ed3('0x45')](handleError(_0x3ed2f4,null));};exports['destroy']=function(_0x11caae,_0x5b235c){var _0x4ef2d4=_0x11caae[_0x8ed3('0x46')]['id'];var _0x4dedc7=[];return db[_0x8ed3('0x54')][_0x8ed3('0x55')](function(_0x28c3b6){var _0x5d6822=_0x8ed3('0x56')+_0x4ef2d4;return db[_0x8ed3('0x54')][_0x8ed3('0x33')](_0x5d6822,{'type':db[_0x8ed3('0x57')][_0x8ed3('0x58')][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6})[_0x8ed3('0x41')](function(_0x1a2639){_0x4dedc7=_['map'](_0x1a2639,function(_0xed360a){return Number(_0xed360a[_0x8ed3('0x5a')]);});})['then'](function(){var _0x33dd34=_0x8ed3('0x5b')+_0x4ef2d4;return db['sequelize'][_0x8ed3('0x33')](_0x33dd34,{'type':db[_0x8ed3('0x57')][_0x8ed3('0x58')][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(_0x25bf82){var _0x18bdf4=_[_0x8ed3('0x2f')](_0x25bf82,function(_0x5f13c9){return Number(_0x5f13c9[_0x8ed3('0x5c')]);});return db[_0x8ed3('0x5d')][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'VoiceQueueId':{'$in':_0x18bdf4}},'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(){var _0x502d7c=_0x8ed3('0x5f')+_0x4ef2d4;return db[_0x8ed3('0x54')][_0x8ed3('0x33')](_0x502d7c,{'type':db[_0x8ed3('0x57')][_0x8ed3('0x58')][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(_0x37cfee){var _0xafd90f=_[_0x8ed3('0x2f')](_0x37cfee,function(_0x7016cc){return Number(_0x7016cc[_0x8ed3('0x60')]);});return db['UserMailQueue'][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'MailQueueId':{'$in':_0xafd90f}},'transaction':_0x28c3b6});})['then'](function(){var _0xb8da9='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4ef2d4;return db[_0x8ed3('0x54')]['query'](_0xb8da9,{'type':db['Sequelize'][_0x8ed3('0x58')][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(_0x8a7596){var _0x6f93de=_[_0x8ed3('0x2f')](_0x8a7596,function(_0x483817){return Number(_0x483817[_0x8ed3('0x61')]);});return db[_0x8ed3('0x62')][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'SmsQueueId':{'$in':_0x6f93de}},'transaction':_0x28c3b6});})['then'](function(){var _0x21396d=_0x8ed3('0x63')+_0x4ef2d4;return db[_0x8ed3('0x54')][_0x8ed3('0x33')](_0x21396d,{'type':db[_0x8ed3('0x57')]['QueryTypes'][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(_0x119922){var _0x86af46=_[_0x8ed3('0x2f')](_0x119922,function(_0x26cdd3){return Number(_0x26cdd3[_0x8ed3('0x64')]);});return db['UserChatQueue'][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'ChatQueueId':{'$in':_0x86af46}},'transaction':_0x28c3b6});})['then'](function(){var _0x379b77=_0x8ed3('0x65')+_0x4ef2d4;return db[_0x8ed3('0x54')][_0x8ed3('0x33')](_0x379b77,{'type':db[_0x8ed3('0x57')][_0x8ed3('0x58')][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6});})['then'](function(_0x39776a){var _0x192f92=_[_0x8ed3('0x2f')](_0x39776a,function(_0xa2307d){return Number(_0xa2307d[_0x8ed3('0x66')]);});return db[_0x8ed3('0x67')][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'FaxQueueId':{'$in':_0x192f92}},'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(){var _0x46f5b7=_0x8ed3('0x68')+_0x4ef2d4;return db[_0x8ed3('0x54')][_0x8ed3('0x33')](_0x46f5b7,{'type':db[_0x8ed3('0x57')][_0x8ed3('0x58')][_0x8ed3('0x59')],'raw':!![],'transaction':_0x28c3b6});})['then'](function(_0x5ea2da){var _0x5e756a=_['map'](_0x5ea2da,function(_0x10e0fa){return Number(_0x10e0fa[_0x8ed3('0x69')]);});return db[_0x8ed3('0x6a')][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'OpenchannelQueueId':{'$in':_0x5e756a}},'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(){var _0x2befda=_0x8ed3('0x6b')+_0x4ef2d4;return db[_0x8ed3('0x54')][_0x8ed3('0x33')](_0x2befda,{'type':db[_0x8ed3('0x57')][_0x8ed3('0x58')]['SELECT'],'raw':!![],'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(_0x6c5eb9){var _0x23dc28=_[_0x8ed3('0x2f')](_0x6c5eb9,function(_0x1aaf76){return Number(_0x1aaf76[_0x8ed3('0x6c')]);});return db[_0x8ed3('0x6d')][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'WhatsappQueueId':{'$in':_0x23dc28}},'transaction':_0x28c3b6});})['then'](function(){return db[_0x8ed3('0x6e')][_0x8ed3('0x47')]({'where':{'TeamId':_0x4ef2d4}});})[_0x8ed3('0x41')](function(_0x4d4db5){if(_0x4d4db5===null){return;}return db['UserVoicePrefix'][_0x8ed3('0x5e')]({'where':{'UserId':{'$in':_0x4dedc7},'VoicePrefixId':_0x4d4db5[_0x8ed3('0x6f')]},'transaction':_0x28c3b6});})[_0x8ed3('0x41')](function(){return db['Team']['destroy']({'where':{'id':_0x4ef2d4},'cascade':!![],'transaction':_0x28c3b6});})['then'](function(_0x2502e7){if(_0x2502e7===0x0){_0x5b235c[_0x8ed3('0x21')](0x194);}else{return db[_0x8ed3('0x70')]['destroy']({'where':{'type':_0x8ed3('0x4e'),'resourceId':_0x4ef2d4},'cascade':!![],'transaction':_0x28c3b6})[_0x8ed3('0x41')](function(){_0x5b235c[_0x8ed3('0x22')](0xcc)['end']();});}})[_0x8ed3('0x45')](function(_0x51228b){_0x5b235c['status'](0x1f4)[_0x8ed3('0x2d')](_0x51228b);});});};exports[_0x8ed3('0x71')]=function(_0x5dc5be,_0x3c791c,_0x5b8774){return db['Team']['findOne']({'where':{'id':_0x5dc5be[_0x8ed3('0x46')]['id']}})[_0x8ed3('0x41')](handleEntityNotFound(_0x3c791c,null))[_0x8ed3('0x41')](function(_0x1132ea){if(!_0x5dc5be['query']['channel']||!utils[_0x8ed3('0x72')](_0x5dc5be['query'][_0x8ed3('0x73')])){throw new db[(_0x8ed3('0x57'))]['ValidationError'](_0x8ed3('0x74'));}var _0x17d07a={};var _0x1bf662={};_0x1bf662[_0x8ed3('0x36')]=_[_0x8ed3('0x34')](db[_[_0x8ed3('0x75')](_0x5dc5be[_0x8ed3('0x33')]['channel']['toLowerCase']())+'Queue'][_0x8ed3('0x30')]);_0x1bf662[_0x8ed3('0x33')]=_[_0x8ed3('0x34')](_0x5dc5be[_0x8ed3('0x33')]);_0x1bf662[_0x8ed3('0x76')]=_['intersection'](_0x1bf662[_0x8ed3('0x36')],_0x1bf662['query']);_0x17d07a[_0x8ed3('0x38')]=_[_0x8ed3('0x35')](_0x1bf662['model'],qs[_0x8ed3('0x37')](_0x5dc5be[_0x8ed3('0x33')][_0x8ed3('0x37')]));_0x17d07a[_0x8ed3('0x38')]=_0x17d07a['attributes'][_0x8ed3('0x77')]?_0x17d07a[_0x8ed3('0x38')]:_0x1bf662['model'];_0x17d07a['limit']=qs['limit'](_0x5dc5be[_0x8ed3('0x33')][_0x8ed3('0x24')]);_0x17d07a[_0x8ed3('0x26')]=qs['offset'](_0x5dc5be[_0x8ed3('0x33')]['offset']);_0x17d07a[_0x8ed3('0x78')]=qs[_0x8ed3('0x3b')](_0x5dc5be[_0x8ed3('0x33')]['sort']);_0x17d07a[_0x8ed3('0x3c')]=qs['filters'](_[_0x8ed3('0x79')](_0x5dc5be[_0x8ed3('0x33')],_0x1bf662[_0x8ed3('0x76')]));_0x17d07a=_[_0x8ed3('0x3d')]({},_0x17d07a,_0x5dc5be['options']);return _0x1132ea[_0x8ed3('0x4a')+_[_0x8ed3('0x75')](_0x5dc5be[_0x8ed3('0x33')]['channel'][_0x8ed3('0x7a')]())+_0x8ed3('0x7b')](_0x17d07a);})[_0x8ed3('0x41')](respondWithResult(_0x3c791c,null))[_0x8ed3('0x45')](handleError(_0x3c791c,null));};exports[_0x8ed3('0x7c')]=function(_0x5589fd,_0x4b792f,_0x1c7b62){return db[_0x8ed3('0x40')][_0x8ed3('0x7d')]({'where':{'id':_0x5589fd[_0x8ed3('0x46')]['id']}})[_0x8ed3('0x41')](function(_0x53c1d0){if(_0x53c1d0){if(!_0x5589fd[_0x8ed3('0x49')][_0x8ed3('0x73')]||!utils[_0x8ed3('0x72')](_0x5589fd[_0x8ed3('0x49')][_0x8ed3('0x73')])){throw new db[(_0x8ed3('0x57'))][(_0x8ed3('0x7e'))](_0x8ed3('0x74'));}return _0x53c1d0[_0x8ed3('0x7f')+_[_0x8ed3('0x75')](_0x5589fd[_0x8ed3('0x49')]['channel'][_0x8ed3('0x7a')]())+'Queues'](_0x5589fd[_0x8ed3('0x49')][_0x8ed3('0x80')]);}return null;})[_0x8ed3('0x41')](handleEntityNotFound(_0x4b792f,null))['then'](respondWithStatusCode(_0x4b792f,null))['catch'](handleError(_0x4b792f,null));};exports[_0x8ed3('0x81')]=function(_0x43758a,_0x4654a8,_0x46c56c){return db['Team'][_0x8ed3('0x7d')]({'where':{'id':_0x43758a[_0x8ed3('0x46')]['id']}})[_0x8ed3('0x41')](function(_0x398092){if(_0x398092){if(!_0x43758a[_0x8ed3('0x33')][_0x8ed3('0x73')]||!utils[_0x8ed3('0x72')](_0x43758a[_0x8ed3('0x33')][_0x8ed3('0x73')])){throw new db[(_0x8ed3('0x57'))]['ValidationError'](_0x8ed3('0x74'));}return _0x398092[_0x8ed3('0x82')+_['capitalize'](_0x43758a[_0x8ed3('0x33')]['channel']['toLowerCase']())+_0x8ed3('0x7b')](_0x43758a[_0x8ed3('0x33')]['ids']);}return null;})[_0x8ed3('0x41')](handleEntityNotFound(_0x4654a8,null))[_0x8ed3('0x41')](respondWithStatusCode(_0x4654a8,null))[_0x8ed3('0x45')](handleError(_0x4654a8,null));};exports['addAgents']=function(_0x3944f3,_0x2d3d03){var _0x435caa=_[_0x8ed3('0x83')](_0x3944f3['body'][_0x8ed3('0x80')])?_0x3944f3[_0x8ed3('0x49')][_0x8ed3('0x80')]:[_0x3944f3[_0x8ed3('0x49')]['ids']];var _0x139ea0=_0x3944f3[_0x8ed3('0x46')]['id'];return db[_0x8ed3('0x40')][_0x8ed3('0x47')]({'where':{'id':_0x139ea0}})[_0x8ed3('0x41')](handleEntityNotFound(_0x2d3d03,null))[_0x8ed3('0x41')](function(_0x3dad0){if(_0x3dad0){var _0x4b9b7c=[_0x8ed3('0x84'),_0x8ed3('0x85'),_0x8ed3('0x86'),_0x8ed3('0x87'),'Fax',_0x8ed3('0x88'),_0x8ed3('0x89')];return db[_0x8ed3('0x54')]['transaction'](function(_0x571e80){var _0x518b2c=_[_0x8ed3('0x2f')](_0x4b9b7c,function(_0x2a3f47){var _0x43b86f={'attributes':['id','name']};if(_0x2a3f47===_0x8ed3('0x84')){_0x43b86f[_0x8ed3('0x8a')]={'attributes':['penalty']};}return _0x3dad0[_0x8ed3('0x4a')+_0x2a3f47+_0x8ed3('0x7b')](_0x43b86f)[_0x8ed3('0x41')](function(_0x45f961){var _0x1e2895=_[_0x8ed3('0x2f')](_0x45f961,function(_0x3f163f){var _0x4a7670=_[_0x8ed3('0x2f')](_0x435caa,function(_0x42c137){var _0x34f7bf={'where':{'UserId':_0x42c137,[_0x2a3f47+_0x8ed3('0x8b')]:_0x3f163f['id']},'transaction':_0x571e80};if(_0x2a3f47==='Voice'){_0x34f7bf['defaults']={'penalty':_0x3f163f[_0x8ed3('0x8c')][_0x8ed3('0x8d')]};}return db[_0x8ed3('0x8e')+_0x2a3f47+'Queue'][_0x8ed3('0x8f')](_0x34f7bf)['then'](function(){socket[_0x8ed3('0x90')](_0x8ed3('0x4d')+_0x2a3f47+'Queue:save',{'UserId':_0x42c137,[_0x2a3f47+_0x8ed3('0x8b')]:_0x3f163f['id']});if(_0x2a3f47!==_0x8ed3('0x84')){return;}return db[_0x8ed3('0x8e')][_0x8ed3('0x44')]({'where':{'id':_0x435caa,'online':0x1},'attributes':['id',_0x8ed3('0x2c'),'online',_0x8ed3('0x91'),_0x8ed3('0x92')],'raw':!![]})[_0x8ed3('0x41')](function(_0x3b0b25){var _0x5158c2=_[_0x8ed3('0x2f')](_0x3b0b25,function(_0x2dcc52){return db[_0x8ed3('0x93')][_0x8ed3('0x94')]({'membername':_0x2dcc52[_0x8ed3('0x2c')],'UserId':_0x2dcc52['id'],'queue_name':_0x3f163f[_0x8ed3('0x2c')],'VoiceQueueId':_0x3f163f['id'],'interface':_[_0x8ed3('0x95')](_0x2dcc52[_0x8ed3('0x92')])?util[_0x8ed3('0x96')](_0x8ed3('0x97'),_0x2dcc52[_0x8ed3('0x2c')]):_0x2dcc52[_0x8ed3('0x92')],'paused':_0x2dcc52['voicePause']||![],'penalty':_0x3f163f[_0x8ed3('0x8c')][_0x8ed3('0x8d')]},{'transaction':_0x571e80});});return Promise[_0x8ed3('0x98')](_0x5158c2);});});});return Promise[_0x8ed3('0x98')](_0x4a7670);});return Promise[_0x8ed3('0x98')](_0x1e2895);})[_0x8ed3('0x41')](function(){return db[_0x8ed3('0x6e')][_0x8ed3('0x7d')]({'where':{'teamId':_0x139ea0}})['then'](function(_0x5503c1){if(_0x5503c1){var _0xf8d3df=_[_0x8ed3('0x2f')](_0x435caa,function(_0x543836){db[_0x8ed3('0x99')]['upsert']({'UserId':_0x543836,'VoicePrefixId':_0x5503c1[_0x8ed3('0x6f')]});});return Promise[_0x8ed3('0x98')](_0xf8d3df);}});});});return Promise[_0x8ed3('0x98')](_0x518b2c)[_0x8ed3('0x41')](function(){return _0x3dad0['addAgents'](_0x435caa,{'transaction':_0x571e80})[_0x8ed3('0x9a')](function(_0x1290cb){return _0x1290cb;});});});}})[_0x8ed3('0x41')](respondWithResult(_0x2d3d03,null))[_0x8ed3('0x45')](handleError(_0x2d3d03,null));};exports[_0x8ed3('0x9b')]=function(_0x2d14bf,_0x5712f7){var _0x5f2c43=_['isArray'](_0x2d14bf[_0x8ed3('0x33')][_0x8ed3('0x80')])?_0x2d14bf[_0x8ed3('0x33')][_0x8ed3('0x80')]:[_0x2d14bf[_0x8ed3('0x33')]['ids']];var _0x208b42=_0x2d14bf[_0x8ed3('0x46')]['id'];return db[_0x8ed3('0x40')][_0x8ed3('0x47')]({'where':{'id':_0x208b42}})[_0x8ed3('0x41')](handleEntityNotFound(_0x5712f7,null))[_0x8ed3('0x41')](function(_0x59c7e9){if(_0x59c7e9){var _0x1dc5d9=[_0x8ed3('0x84'),_0x8ed3('0x85'),'Mail',_0x8ed3('0x87'),_0x8ed3('0x9c'),_0x8ed3('0x88'),_0x8ed3('0x89')];return db[_0x8ed3('0x54')][_0x8ed3('0x55')](function(_0x452f58){var _0x5a1cf6=_[_0x8ed3('0x2f')](_0x1dc5d9,function(_0x40d425){var _0x435e45={'attributes':['id','name']};return _0x59c7e9[_0x8ed3('0x4a')+_0x40d425+_0x8ed3('0x7b')](_0x435e45)['then'](function(_0x539e54){var _0x2d1d65=_[_0x8ed3('0x2f')](_0x539e54,function(_0x4a71b3){return _0x4a71b3[_0x8ed3('0x9b')](_0x5f2c43,{'transaction':_0x452f58})['then'](function(){var _0x138abb=_['map'](_0x5f2c43,function(_0x4f6b1f){socket[_0x8ed3('0x90')]('user'+_0x40d425+_0x8ed3('0x9d'),{'UserId':Number(_0x4f6b1f),[_0x40d425+_0x8ed3('0x8b')]:_0x4a71b3['id']});if(_0x40d425!==_0x8ed3('0x84')){return;}return db[_0x8ed3('0x93')][_0x8ed3('0x5e')]({'where':{'VoiceQueueId':_0x4a71b3['id'],'UserId':_0x4f6b1f},'transaction':_0x452f58});});return Promise[_0x8ed3('0x98')](_0x138abb);});});return Promise[_0x8ed3('0x98')](_0x2d1d65);});});return Promise[_0x8ed3('0x98')](_0x5a1cf6)[_0x8ed3('0x41')](function(){return _0x59c7e9[_0x8ed3('0x9b')](_0x5f2c43,{'transaction':_0x452f58});})[_0x8ed3('0x41')](function(){return db[_0x8ed3('0x6e')][_0x8ed3('0x7d')]({'where':{'teamId':_0x208b42}})[_0x8ed3('0x41')](function(_0x18aa57){if(_0x18aa57){var _0x55c60e=_['map'](_0x5f2c43,function(_0x2e4bc6){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2e4bc6,'VoicePrefixId':_0x18aa57[_0x8ed3('0x6f')]}});});return Promise[_0x8ed3('0x98')](_0x55c60e);}});});});}})[_0x8ed3('0x41')](respondWithStatusCode(_0x5712f7,null))[_0x8ed3('0x45')](handleError(_0x5712f7,null));};exports[_0x8ed3('0x9e')]=function(_0xe2ee71,_0x53c589,_0x43bc04){var _0x11dcf4={};var _0x49b770={};var _0x5d99e5;var _0x3acd61;return db[_0x8ed3('0x40')][_0x8ed3('0x7d')]({'where':{'id':_0xe2ee71[_0x8ed3('0x46')]['id']}})['then'](handleEntityNotFound(_0x53c589,null))[_0x8ed3('0x41')](function(_0xf2a6f4){if(_0xf2a6f4){_0x5d99e5=_0xf2a6f4;_0x49b770[_0x8ed3('0x36')]=_[_0x8ed3('0x34')](db[_0x8ed3('0x8e')]['rawAttributes']);_0x49b770[_0x8ed3('0x33')]=_[_0x8ed3('0x34')](_0xe2ee71[_0x8ed3('0x33')]);_0x49b770[_0x8ed3('0x76')]=_['intersection'](_0x49b770['model'],_0x49b770[_0x8ed3('0x33')]);_0x11dcf4[_0x8ed3('0x38')]=_[_0x8ed3('0x35')](_0x49b770[_0x8ed3('0x36')],qs[_0x8ed3('0x37')](_0xe2ee71[_0x8ed3('0x33')][_0x8ed3('0x37')]));_0x11dcf4[_0x8ed3('0x38')]=_0x11dcf4[_0x8ed3('0x38')]['length']?_0x11dcf4[_0x8ed3('0x38')]:_0x49b770[_0x8ed3('0x36')];_0x11dcf4[_0x8ed3('0x78')]=qs[_0x8ed3('0x3b')](_0xe2ee71[_0x8ed3('0x33')][_0x8ed3('0x3b')]);_0x11dcf4[_0x8ed3('0x3c')]=qs[_0x8ed3('0x76')](_[_0x8ed3('0x79')](_0xe2ee71[_0x8ed3('0x33')],_0x49b770[_0x8ed3('0x76')]));if(_0xe2ee71['query'][_0x8ed3('0x3e')]){_0x11dcf4[_0x8ed3('0x3c')]=_['merge'](_0x11dcf4['where'],{'$or':_[_0x8ed3('0x2f')](_0x11dcf4[_0x8ed3('0x38')],function(_0x1cde53){var _0x50d2ac={};_0x50d2ac[_0x1cde53]={'$like':'%'+_0xe2ee71['query']['filter']+'%'};return _0x50d2ac;})});}_0x11dcf4=_[_0x8ed3('0x3d')]({},_0x11dcf4,_0xe2ee71[_0x8ed3('0x3f')]);return _0x5d99e5['getAgents'](_0x11dcf4);}})[_0x8ed3('0x41')](function(_0x381582){if(_0x381582){_0x3acd61=_0x381582[_0x8ed3('0x77')];if(!_0xe2ee71['query'][_0x8ed3('0x39')]('nolimit')){_0x11dcf4[_0x8ed3('0x24')]=qs[_0x8ed3('0x24')](_0xe2ee71['query']['limit']);_0x11dcf4[_0x8ed3('0x26')]=qs['offset'](_0xe2ee71[_0x8ed3('0x33')][_0x8ed3('0x26')]);}return _0x5d99e5[_0x8ed3('0x9e')](_0x11dcf4);}})[_0x8ed3('0x41')](function(_0x1566cd){if(_0x1566cd){return _0x1566cd?{'count':_0x3acd61,'rows':_0x1566cd}:null;}})[_0x8ed3('0x41')](respondWithResult(_0x53c589,null))[_0x8ed3('0x45')](handleError(_0x53c589,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ff9616c..f8ebe31 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 _0xdf0a=['hasOwnProperty','hook','setMaxListeners','save','remove','emit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdf0a,0xe6));var _0xadf0=function(_0x1e7480,_0x5783b3){_0x1e7480=_0x1e7480-0x0;var _0x453d99=_0xdf0a[_0x1e7480];return _0x453d99;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xadf0('0x0')](0x0);var events={'afterCreate':_0xadf0('0x1'),'afterUpdate':'update','afterDestroy':_0xadf0('0x2')};function emitEvent(_0x523cd1){return function(_0x3c2660,_0x2bd017,_0x50bd0f){TeamEvents[_0xadf0('0x3')](_0x523cd1+':'+_0x3c2660['id'],_0x3c2660);TeamEvents['emit'](_0x523cd1,_0x3c2660);_0x50bd0f(null);};}for(var e in events){if(events[_0xadf0('0x4')](e)){var event=events[e];Team[_0xadf0('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x2c49=['setMaxListeners','remove','emit','hook','events','../../mysqldb'];(function(_0x5d629d,_0x56e2ee){var _0x3cee0d=function(_0x126e54){while(--_0x126e54){_0x5d629d['push'](_0x5d629d['shift']());}};_0x3cee0d(++_0x56e2ee);}(_0x2c49,0x142));var _0x92c4=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x2c49[_0x2a67fe];return _0x57e726;};'use strict';var EventEmitter=require(_0x92c4('0x0'));var Team=require(_0x92c4('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x92c4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x92c4('0x3')};function emitEvent(_0x572f26){return function(_0x10fd9f,_0x107899,_0x2ffcb2){TeamEvents['emit'](_0x572f26+':'+_0x10fd9f['id'],_0x10fd9f);TeamEvents[_0x92c4('0x4')](_0x572f26,_0x10fd9f);_0x2ffcb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x92c4('0x5')](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 7953d6a..df962ef 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 _0x9142=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9142,0xfb));var _0x2914=function(_0x208f04,_0x4b3bad){_0x208f04=_0x208f04-0x0;var _0x2ce8a5=_0x9142[_0x208f04];return _0x2ce8a5;};'use strict';var _=require(_0x2914('0x0'));var util=require(_0x2914('0x1'));var logger=require(_0x2914('0x2'))(_0x2914('0x3'));var moment=require('moment');var BPromise=require(_0x2914('0x4'));var rp=require(_0x2914('0x5'));var fs=require('fs');var path=require(_0x2914('0x6'));var rimraf=require(_0x2914('0x7'));var config=require(_0x2914('0x8'));var attributes=require('./team.attributes');module[_0x2914('0x9')]=function(_0x75f76d,_0x3d858c){return _0x75f76d[_0x2914('0xa')](_0x2914('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe142=['path','rimraf','exports','define','Team','lodash','util','api'];(function(_0x26d188,_0x4306a3){var _0x4008bc=function(_0x59bc55){while(--_0x59bc55){_0x26d188['push'](_0x26d188['shift']());}};_0x4008bc(++_0x4306a3);}(_0xe142,0xed));var _0x2e14=function(_0x2e9782,_0xe29fa2){_0x2e9782=_0x2e9782-0x0;var _0x174ed2=_0xe142[_0x2e9782];return _0x174ed2;};'use strict';var _=require(_0x2e14('0x0'));var util=require(_0x2e14('0x1'));var logger=require('../../config/logger')(_0x2e14('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e14('0x3'));var rimraf=require(_0x2e14('0x4'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x2e14('0x5')]=function(_0x52f4ce,_0x2eccc4){return _0x52f4ce[_0x2e14('0x6')](_0x2e14('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index a7888cb..1dc496f 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 _0xe930=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x16cc5b,_0x15ed93){var _0x48d9e0=function(_0xa6b917){while(--_0xa6b917){_0x16cc5b['push'](_0x16cc5b['shift']());}};_0x48d9e0(++_0x15ed93);}(_0xe930,0xfb));var _0x0e93=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xe930[_0x4bd950];return _0x5dc59a;};'use strict';var _=require('lodash');var util=require(_0x0e93('0x0'));var moment=require(_0x0e93('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e93('0x2'))['db'];var utils=require(_0x0e93('0x3'));var logger=require(_0x0e93('0x4'))(_0x0e93('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e93('0x6'));var client=jayson['client'][_0x0e93('0x7')]({'port':0x232a});config['redis']=_[_0x0e93('0x8')](config[_0x0e93('0x9')],{'host':_0x0e93('0xa'),'port':0x18eb});var socket=require(_0x0e93('0xb'))(new Redis(config['redis']));require('./team.socket')[_0x0e93('0xc')](socket);function respondWithRpcPromise(_0x83d6bb,_0x1f2909,_0x11e4bd){return new BPromise(function(_0x3c3dda,_0x49be3b){return client['request'](_0x83d6bb,_0x11e4bd)[_0x0e93('0xd')](function(_0x46c4b0){logger[_0x0e93('0xe')](_0x0e93('0xf'),_0x1f2909,_0x0e93('0x10'));logger[_0x0e93('0x11')](_0x0e93('0x12'),_0x1f2909,_0x0e93('0x10'),JSON[_0x0e93('0x13')](_0x46c4b0));if(_0x46c4b0[_0x0e93('0x14')]){if(_0x46c4b0[_0x0e93('0x14')]['code']===0x1f4){logger['error'](_0x0e93('0xf'),_0x1f2909,_0x46c4b0['error']['message']);return _0x49be3b(_0x46c4b0['error'][_0x0e93('0x15')]);}logger['error'](_0x0e93('0xf'),_0x1f2909,_0x46c4b0['error'][_0x0e93('0x15')]);return _0x3c3dda(_0x46c4b0[_0x0e93('0x14')][_0x0e93('0x15')]);}else{logger[_0x0e93('0xe')](_0x0e93('0xf'),_0x1f2909,_0x0e93('0x10'));_0x3c3dda(_0x46c4b0['result'][_0x0e93('0x15')]);}})['catch'](function(_0x2a7454){logger[_0x0e93('0x14')](_0x0e93('0xf'),_0x1f2909,_0x2a7454);_0x49be3b(_0x2a7454);});});} \ No newline at end of file +var _0x1775=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0x1775,0x94));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))('rpc');var config=require(_0x5177('0x8'));var jayson=require(_0x5177('0x9'));var client=jayson[_0x5177('0xa')][_0x5177('0xb')]({'port':0x232a});config[_0x5177('0xc')]=_[_0x5177('0xd')](config[_0x5177('0xc')],{'host':_0x5177('0xe'),'port':0x18eb});var socket=require(_0x5177('0xf'))(new Redis(config['redis']));require('./team.socket')[_0x5177('0x10')](socket);function respondWithRpcPromise(_0x46eadb,_0x26c03e,_0x123442){return new BPromise(function(_0x87a0ad,_0x401728){return client[_0x5177('0x11')](_0x46eadb,_0x123442)[_0x5177('0x12')](function(_0x359cfc){logger[_0x5177('0x13')](_0x5177('0x14'),_0x26c03e,_0x5177('0x15'));logger[_0x5177('0x16')](_0x5177('0x17'),_0x26c03e,_0x5177('0x15'),JSON[_0x5177('0x18')](_0x359cfc));if(_0x359cfc[_0x5177('0x19')]){if(_0x359cfc[_0x5177('0x19')][_0x5177('0x1a')]===0x1f4){logger[_0x5177('0x19')](_0x5177('0x14'),_0x26c03e,_0x359cfc[_0x5177('0x19')][_0x5177('0x1b')]);return _0x401728(_0x359cfc[_0x5177('0x19')][_0x5177('0x1b')]);}logger['error']('Team,\x20%s,\x20%s',_0x26c03e,_0x359cfc[_0x5177('0x19')][_0x5177('0x1b')]);return _0x87a0ad(_0x359cfc[_0x5177('0x19')][_0x5177('0x1b')]);}else{logger[_0x5177('0x13')](_0x5177('0x14'),_0x26c03e,_0x5177('0x15'));_0x87a0ad(_0x359cfc['result'][_0x5177('0x1b')]);}})['catch'](function(_0x3429de){logger[_0x5177('0x19')](_0x5177('0x14'),_0x26c03e,_0x3429de);_0x401728(_0x3429de);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 879488f..94e0b0b 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 _0xb965=['register','team:','./team.events','save','emit'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xb965,0x9d));var _0x5b96=function(_0x2e740d,_0x531abe){_0x2e740d=_0x2e740d-0x0;var _0x2295e4=_0xb965[_0x2e740d];return _0x2295e4;};'use strict';var TeamEvents=require(_0x5b96('0x0'));var events=[_0x5b96('0x1'),'remove','update'];function createListener(_0x3a5c6a,_0x2d4f51){return function(_0x211e34){_0x2d4f51[_0x5b96('0x2')](_0x3a5c6a,_0x211e34);};}function removeListener(_0x844202,_0x4d599b){return function(){TeamEvents['removeListener'](_0x844202,_0x4d599b);};}exports[_0x5b96('0x3')]=function(_0x3d9d78){for(var _0x502072=0x0,_0x451426=events['length'];_0x502072<_0x451426;_0x502072++){var _0x3d2fa6=events[_0x502072];var _0x31a1fe=createListener(_0x5b96('0x4')+_0x3d2fa6,_0x3d9d78);TeamEvents['on'](_0x3d2fa6,_0x31a1fe);}}; \ No newline at end of file +var _0xf9fd=['remove','update','emit','removeListener','register','team:','save'];(function(_0x2c7516,_0x2ca7f1){var _0x1d76a2=function(_0x5ce25f){while(--_0x5ce25f){_0x2c7516['push'](_0x2c7516['shift']());}};_0x1d76a2(++_0x2ca7f1);}(_0xf9fd,0x14f));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var TeamEvents=require('./team.events');var events=[_0xdf9f('0x0'),_0xdf9f('0x1'),_0xdf9f('0x2')];function createListener(_0x337b40,_0x56bec4){return function(_0x49cb56){_0x56bec4[_0xdf9f('0x3')](_0x337b40,_0x49cb56);};}function removeListener(_0x150a0b,_0x3c9418){return function(){TeamEvents[_0xdf9f('0x4')](_0x150a0b,_0x3c9418);};}exports[_0xdf9f('0x5')]=function(_0x549031){for(var _0x4734df=0x0,_0x41d712=events['length'];_0x4734df<_0x41d712;_0x4734df++){var _0x56a29b=events[_0x4734df];var _0x41d667=createListener(_0xdf9f('0x6')+_0x56a29b,_0x549031);TeamEvents['on'](_0x56a29b,_0x41d667);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7b94005..9d4c41c 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 _0xeffd=['INTEGER','sequelize'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xeffd,0x6b));var _0xdeff=function(_0x28e88f,_0x3ea2e6){_0x28e88f=_0x28e88f-0x0;var _0x3be0c2=_0xeffd[_0x28e88f];return _0x3be0c2;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xdeff('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xdeff('0x1')]}}; \ No newline at end of file +var _0x64e9=['sequelize','INTEGER'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0x64e9,0x136));var _0x964e=function(_0x58332b,_0x158d5d){_0x58332b=_0x58332b-0x0;var _0x2376af=_0x64e9[_0x58332b];return _0x2376af;};'use strict';var Sequelize=require(_0x964e('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x964e('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 3486fe6..7985592 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 _0x594d=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x3d3d09,_0x56a334){var _0x564d89=function(_0x10b78f){while(--_0x10b78f){_0x3d3d09['push'](_0x3d3d09['shift']());}};_0x564d89(++_0x56a334);}(_0x594d,0x92));var _0xd594=function(_0x22d164,_0x154075){_0x22d164=_0x22d164-0x0;var _0xae5f1a=_0x594d[_0x22d164];return _0xae5f1a;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x215d=['TeamVoicePrefix','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x1073d7,_0x30148f){var _0xc3a63c=function(_0x2b5bf2){while(--_0x2b5bf2){_0x1073d7['push'](_0x1073d7['shift']());}};_0xc3a63c(++_0x30148f);}(_0x215d,0x187));var _0xd215=function(_0x27bd40,_0x258633){_0x27bd40=_0x27bd40-0x0;var _0x54f699=_0x215d[_0x27bd40];return _0x54f699;};'use strict';var _=require(_0xd215('0x0'));var util=require('util');var logger=require(_0xd215('0x1'))(_0xd215('0x2'));var moment=require(_0xd215('0x3'));var BPromise=require(_0xd215('0x4'));var rp=require(_0xd215('0x5'));var fs=require('fs');var path=require(_0xd215('0x6'));var rimraf=require('rimraf');var config=require(_0xd215('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0xd215('0x8')]=function(_0x1c1356,_0x269e38){return _0x1c1356['define'](_0xd215('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c714baa..d9b9f09 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5e7fa3,_0x537559){var _0x323185=function(_0x5e7423){while(--_0x5e7423){_0x5e7fa3['push'](_0x5e7fa3['shift']());}};_0x323185(++_0x537559);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x10e2c9,_0x489aab){var _0x426947=function(_0x123624){while(--_0x123624){_0x10e2c9['push'](_0x10e2c9['shift']());}};_0x426947(++_0x489aab);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9006424..3a05a9b 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ce4=['sequelize','exports','INTEGER'];(function(_0x1210af,_0xf5151){var _0x4db6a5=function(_0x4e3c0e){while(--_0x4e3c0e){_0x1210af['push'](_0x1210af['shift']());}};_0x4db6a5(++_0xf5151);}(_0x2ce4,0x141));var _0x42ce=function(_0x427c74,_0x1ad51b){_0x427c74=_0x427c74-0x0;var _0x24f675=_0x2ce4[_0x427c74];return _0x24f675;};'use strict';var Sequelize=require(_0x42ce('0x0'));module[_0x42ce('0x1')]={'penalty':{'type':Sequelize[_0x42ce('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 2d0401e..d854fc4 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 _0x4fde=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4fde,0x19f));var _0xe4fd=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0x4fde[_0x413727];return _0x5f46d7;};'use strict';var _=require(_0xe4fd('0x0'));var util=require(_0xe4fd('0x1'));var logger=require(_0xe4fd('0x2'))(_0xe4fd('0x3'));var moment=require('moment');var BPromise=require(_0xe4fd('0x4'));var rp=require(_0xe4fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4fd('0x6'));var config=require(_0xe4fd('0x7'));var attributes=require(_0xe4fd('0x8'));module[_0xe4fd('0x9')]=function(_0x464a19,_0x73219e){return _0x464a19[_0xe4fd('0xa')](_0xe4fd('0xb'),attributes,{'tableName':_0xe4fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee5=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x726d91,_0x2f9bc9){_0x726d91=_0x726d91-0x0;var _0x47c0ea=_0x3ee5[_0x726d91];return _0x47c0ea;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var logger=require(_0x53ee('0x1'))('api');var moment=require(_0x53ee('0x2'));var BPromise=require(_0x53ee('0x3'));var rp=require(_0x53ee('0x4'));var fs=require('fs');var path=require(_0x53ee('0x5'));var rimraf=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var attributes=require(_0x53ee('0x8'));module[_0x53ee('0x9')]=function(_0x343bbb,_0x16ad68){return _0x343bbb[_0x53ee('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x53ee('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 45c0f51..0031c73 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 _0x3f47=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x23402b,_0x421ac9){var _0x3a21c7=function(_0x3608ec){while(--_0x3608ec){_0x23402b['push'](_0x23402b['shift']());}};_0x3a21c7(++_0x421ac9);}(_0x3f47,0x10e));var _0x73f4=function(_0x2c44b9,_0x2870c9){_0x2c44b9=_0x2c44b9-0x0;var _0x5bec8a=_0x3f47[_0x2c44b9];return _0x5bec8a;};'use strict';var _=require(_0x73f4('0x0'));var util=require(_0x73f4('0x1'));var moment=require('moment');var BPromise=require(_0x73f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73f4('0x3'));var db=require(_0x73f4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x73f4('0x5'))(_0x73f4('0x6'));var config=require(_0x73f4('0x7'));var jayson=require(_0x73f4('0x8'));var client=jayson['client'][_0x73f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b06e2,_0x46e840,_0x28e2ab){return new BPromise(function(_0x2a06a6,_0x44b5eb){return client['request'](_0x2b06e2,_0x28e2ab)[_0x73f4('0xa')](function(_0x2a59d1){logger[_0x73f4('0xb')](_0x73f4('0xc'),_0x46e840,_0x73f4('0xd'));logger[_0x73f4('0xe')](_0x73f4('0xf'),_0x46e840,_0x73f4('0xd'),JSON[_0x73f4('0x10')](_0x2a59d1));if(_0x2a59d1[_0x73f4('0x11')]){if(_0x2a59d1['error']['code']===0x1f4){logger[_0x73f4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x46e840,_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);return _0x44b5eb(_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);}logger[_0x73f4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x46e840,_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);return _0x2a06a6(_0x2a59d1[_0x73f4('0x11')][_0x73f4('0x12')]);}else{logger[_0x73f4('0xb')](_0x73f4('0xc'),_0x46e840,'request\x20sent');_0x2a06a6(_0x2a59d1[_0x73f4('0x13')]['message']);}})['catch'](function(_0x2a415e){logger[_0x73f4('0x11')](_0x73f4('0xc'),_0x46e840,_0x2a415e);_0x44b5eb(_0x2a415e);});});} \ No newline at end of file +var _0xdd32=['rpc','../../config/environment','jayson/promise','http','then','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','TeamVoiceQueue,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x528d4f,_0x19b4f9){var _0x3df605=function(_0x18ed9d){while(--_0x18ed9d){_0x528d4f['push'](_0x528d4f['shift']());}};_0x3df605(++_0x19b4f9);}(_0xdd32,0x98));var _0x2dd3=function(_0x5c8f65,_0x406d32){_0x5c8f65=_0x5c8f65-0x0;var _0x156260=_0xdd32[_0x5c8f65];return _0x156260;};'use strict';var _=require(_0x2dd3('0x0'));var util=require(_0x2dd3('0x1'));var moment=require(_0x2dd3('0x2'));var BPromise=require(_0x2dd3('0x3'));var rs=require(_0x2dd3('0x4'));var fs=require('fs');var Redis=require(_0x2dd3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2dd3('0x6'));var logger=require(_0x2dd3('0x7'))(_0x2dd3('0x8'));var config=require(_0x2dd3('0x9'));var jayson=require(_0x2dd3('0xa'));var client=jayson['client'][_0x2dd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbb8917,_0x5e8fb1,_0xe2814f){return new BPromise(function(_0x337424,_0x1baebd){return client['request'](_0xbb8917,_0xe2814f)[_0x2dd3('0xc')](function(_0x43f8d0){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x5e8fb1,_0x2dd3('0xd'));logger['debug'](_0x2dd3('0xe'),_0x5e8fb1,_0x2dd3('0xd'),JSON['stringify'](_0x43f8d0));if(_0x43f8d0['error']){if(_0x43f8d0[_0x2dd3('0xf')]['code']===0x1f4){logger[_0x2dd3('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5e8fb1,_0x43f8d0[_0x2dd3('0xf')][_0x2dd3('0x10')]);return _0x1baebd(_0x43f8d0[_0x2dd3('0xf')][_0x2dd3('0x10')]);}logger[_0x2dd3('0xf')](_0x2dd3('0x11'),_0x5e8fb1,_0x43f8d0[_0x2dd3('0xf')][_0x2dd3('0x10')]);return _0x337424(_0x43f8d0['error'][_0x2dd3('0x10')]);}else{logger[_0x2dd3('0x12')](_0x2dd3('0x11'),_0x5e8fb1,_0x2dd3('0xd'));_0x337424(_0x43f8d0[_0x2dd3('0x13')][_0x2dd3('0x10')]);}})['catch'](function(_0x5ad554){logger[_0x2dd3('0xf')](_0x2dd3('0x11'),_0x5e8fb1,_0x5ad554);_0x1baebd(_0x5ad554);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7b25480..d34a895 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 _0x75dc=['delete','/:id','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','show','post','put','update'];(function(_0x237cf,_0x501864){var _0x3b3ad1=function(_0x2331ff){while(--_0x2331ff){_0x237cf['push'](_0x237cf['shift']());}};_0x3b3ad1(++_0x501864);}(_0x75dc,0x1d7));var _0xc75d=function(_0x1ed555,_0x163bb2){_0x1ed555=_0x1ed555-0x0;var _0x2ade3d=_0x75dc[_0x1ed555];return _0x2ade3d;};'use strict';var multer=require(_0xc75d('0x0'));var util=require(_0xc75d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc75d('0x2')]();var fs_extra=require(_0xc75d('0x3'));var auth=require(_0xc75d('0x4'));var interaction=require(_0xc75d('0x5'));var config=require(_0xc75d('0x6'));var controller=require(_0xc75d('0x7'));router['get']('/',auth[_0xc75d('0x8')](),controller[_0xc75d('0x9')]);router[_0xc75d('0xa')]('/:id',auth[_0xc75d('0x8')](),controller[_0xc75d('0xb')]);router[_0xc75d('0xc')]('/',auth[_0xc75d('0x8')](),controller['create']);router[_0xc75d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc75d('0xe')]);router[_0xc75d('0xf')](_0xc75d('0x10'),auth[_0xc75d('0x8')](),controller['destroy']);module[_0xc75d('0x11')]=router; \ No newline at end of file +var _0xf0f4=['/:id','show','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0f4,0x182));var _0x4f0f=function(_0x392bcc,_0x20df9f){_0x392bcc=_0x392bcc-0x0;var _0x2fc292=_0xf0f4[_0x392bcc];return _0x2fc292;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4f0f('0x3'));var interaction=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var controller=require(_0x4f0f('0x6'));router[_0x4f0f('0x7')]('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0x9')]);router['get'](_0x4f0f('0xa'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xb')]);router['post']('/',auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xc')]);router[_0x4f0f('0xd')](_0x4f0f('0xa'),auth[_0x4f0f('0x8')](),controller[_0x4f0f('0xe')]);router[_0x4f0f('0xf')](_0x4f0f('0xa'),auth['isAuthenticated'](),controller[_0x4f0f('0x10')]);module[_0x4f0f('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 1872f73..aa60af6 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 _0xa9bf=['sequelize','exports','STRING','TEXT'];(function(_0xdecfe0,_0x398f17){var _0x456db0=function(_0x2eedb9){while(--_0x2eedb9){_0xdecfe0['push'](_0xdecfe0['shift']());}};_0x456db0(++_0x398f17);}(_0xa9bf,0x118));var _0xfa9b=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0xa9bf[_0x387603];return _0x55ea9e;};'use strict';var Sequelize=require(_0xfa9b('0x0'));module[_0xfa9b('0x1')]={'name':{'type':Sequelize[_0xfa9b('0x2')]},'description':{'type':Sequelize[_0xfa9b('0x2')]},'html':{'type':Sequelize[_0xfa9b('0x3')]}}; \ No newline at end of file +var _0x4c70=['exports','STRING'];(function(_0x35e268,_0x5182b6){var _0x501fb1=function(_0x37e6e0){while(--_0x37e6e0){_0x35e268['push'](_0x35e268['shift']());}};_0x501fb1(++_0x5182b6);}(_0x4c70,0x150));var _0x04c7=function(_0x414166,_0x5e87f3){_0x414166=_0x414166-0x0;var _0x373505=_0x4c70[_0x414166];return _0x373505;};'use strict';var Sequelize=require('sequelize');module[_0x04c7('0x0')]={'name':{'type':Sequelize[_0x04c7('0x1')]},'description':{'type':Sequelize[_0x04c7('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index aba19a7..35ac2cc 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 _0x94bd=['Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','include','findAll','catch','show','params','rawAttributes','includeAll','merge','options','find','create','user','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set'];(function(_0x5c3a0a,_0x570cea){var _0x498445=function(_0x382dc5){while(--_0x382dc5){_0x5c3a0a['push'](_0x5c3a0a['shift']());}};_0x498445(++_0x570cea);}(_0x94bd,0x84));var _0xd94b=function(_0x42fe71,_0x344558){_0x42fe71=_0x42fe71-0x0;var _0x1bb9c6=_0x94bd[_0x42fe71];return _0x1bb9c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd94b('0x0'));var zipdir=require(_0xd94b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd94b('0x2'));var moment=require(_0xd94b('0x3'));var BPromise=require(_0xd94b('0x4'));var Mustache=require(_0xd94b('0x5'));var util=require(_0xd94b('0x6'));var path=require(_0xd94b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd94b('0x8'));var fs=require('fs');var fs_extra=require(_0xd94b('0x9'));var _=require(_0xd94b('0xa'));var squel=require(_0xd94b('0xb'));var crypto=require('crypto');var jsforce=require(_0xd94b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd94b('0xd'));var Papa=require(_0xd94b('0xe'));var Redis=require(_0xd94b('0xf'));var authService=require(_0xd94b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd94b('0x11'));var hardwareService=require(_0xd94b('0x12'));var logger=require('../../config/logger')(_0xd94b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd94b('0x14'));var db=require(_0xd94b('0x15'))['db'];function respondWithStatusCode(_0x1eb65a,_0x42d2fc){_0x42d2fc=_0x42d2fc||0xcc;return function(_0x34e0ab){if(_0x34e0ab){return _0x1eb65a[_0xd94b('0x16')](_0x42d2fc);}return _0x1eb65a[_0xd94b('0x17')](_0x42d2fc)[_0xd94b('0x18')]();};}function respondWithResult(_0x439528,_0x423ca5){_0x423ca5=_0x423ca5||0xc8;return function(_0x3df475){if(_0x3df475){return _0x439528[_0xd94b('0x17')](_0x423ca5)[_0xd94b('0x19')](_0x3df475);}};}function respondWithFilteredResult(_0x23795d,_0x4a98fb){return function(_0x33c7e7){if(_0x33c7e7){var _0x375310=typeof _0x4a98fb['offset']==='undefined'&&typeof _0x4a98fb[_0xd94b('0x1a')]==='undefined';var _0x149754=_0x33c7e7['count'];var _0x454b9b=_0x375310?0x0:_0x4a98fb[_0xd94b('0x1b')];var _0x921d0e=_0x375310?_0x33c7e7[_0xd94b('0x1c')]:_0x4a98fb[_0xd94b('0x1b')]+_0x4a98fb[_0xd94b('0x1a')];var _0x522535;if(_0x921d0e>=_0x149754){_0x921d0e=_0x149754;_0x522535=0xc8;}else{_0x522535=0xce;}_0x23795d['status'](_0x522535);return _0x23795d[_0xd94b('0x1d')](_0xd94b('0x1e'),_0x454b9b+'-'+_0x921d0e+'/'+_0x149754)[_0xd94b('0x19')](_0x33c7e7);}return null;};}function patchUpdates(_0x25b57c){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x25b57c,!![]);}catch(_0x59017c){return BPromise['reject'](_0x59017c);}return _0x1a3118[_0xd94b('0x1f')]();};}function saveUpdates(_0x1715df,_0x3b44bc){return function(_0x659c15){if(_0x659c15){return _0x659c15[_0xd94b('0x20')](_0x1715df)[_0xd94b('0x21')](function(_0x1c9787){return _0x1c9787;});}return null;};}function removeEntity(_0x3f570a,_0x193395){return function(_0x1a190d){if(_0x1a190d){return _0x1a190d[_0xd94b('0x22')]()['then'](function(){var _0x4ac82c=_0x1a190d[_0xd94b('0x23')]({'plain':!![]});var _0x9d42bc='Templates';return db[_0xd94b('0x24')][_0xd94b('0x22')]({'where':{'type':_0x9d42bc,'resourceId':_0x4ac82c['id']}})[_0xd94b('0x21')](function(){return _0x1a190d;});})[_0xd94b('0x21')](function(){_0x3f570a[_0xd94b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be72f,_0x386bee){return function(_0x1f6946){if(!_0x1f6946){_0x3be72f['sendStatus'](0x194);}return _0x1f6946;};}function handleError(_0x187f31,_0x27216f){_0x27216f=_0x27216f||0x1f4;return function(_0x39dde1){logger[_0xd94b('0x25')](_0x39dde1[_0xd94b('0x26')]);if(_0x39dde1[_0xd94b('0x27')]){delete _0x39dde1[_0xd94b('0x27')];}_0x187f31[_0xd94b('0x17')](_0x27216f)[_0xd94b('0x28')](_0x39dde1);};}exports[_0xd94b('0x29')]=function(_0xd94c93,_0x47117d){var _0x2e2fa9={},_0x1e478f={},_0x1fc732={'count':0x0,'rows':[]};var _0x2b0ca7=_[_0xd94b('0x2a')](db[_0xd94b('0x2b')]['rawAttributes'],function(_0x55fac6){return{'name':_0x55fac6[_0xd94b('0x2c')],'type':_0x55fac6['type'][_0xd94b('0x2d')]};});_0x1e478f[_0xd94b('0x2e')]=_[_0xd94b('0x2a')](_0x2b0ca7,'name');_0x1e478f[_0xd94b('0x2f')]=_[_0xd94b('0x30')](_0xd94c93[_0xd94b('0x2f')]);_0x1e478f[_0xd94b('0x31')]=_[_0xd94b('0x32')](_0x1e478f[_0xd94b('0x2e')],_0x1e478f[_0xd94b('0x2f')]);_0x2e2fa9['attributes']=_['intersection'](_0x1e478f[_0xd94b('0x2e')],qs[_0xd94b('0x33')](_0xd94c93['query']['fields']));_0x2e2fa9[_0xd94b('0x34')]=_0x2e2fa9[_0xd94b('0x34')][_0xd94b('0x35')]?_0x2e2fa9[_0xd94b('0x34')]:_0x1e478f[_0xd94b('0x2e')];if(!_0xd94c93['query'][_0xd94b('0x36')](_0xd94b('0x37'))){_0x2e2fa9[_0xd94b('0x1a')]=qs[_0xd94b('0x1a')](_0xd94c93[_0xd94b('0x2f')]['limit']);_0x2e2fa9['offset']=qs['offset'](_0xd94c93[_0xd94b('0x2f')][_0xd94b('0x1b')]);}_0x2e2fa9[_0xd94b('0x38')]=qs[_0xd94b('0x39')](_0xd94c93['query'][_0xd94b('0x39')]);_0x2e2fa9[_0xd94b('0x3a')]=qs[_0xd94b('0x31')](_[_0xd94b('0x3b')](_0xd94c93[_0xd94b('0x2f')],_0x1e478f[_0xd94b('0x31')]),_0x2b0ca7);if(_0xd94c93['query']['filter']){_0x2e2fa9[_0xd94b('0x3a')]=_['merge'](_0x2e2fa9[_0xd94b('0x3a')],{'$or':_[_0xd94b('0x2a')](_0x2b0ca7,function(_0x413b57){if(_0x413b57[_0xd94b('0x3c')]!=='VIRTUAL'){var _0x44d7da={};_0x44d7da[_0x413b57[_0xd94b('0x27')]]={'$like':'%'+_0xd94c93[_0xd94b('0x2f')][_0xd94b('0x3d')]+'%'};return _0x44d7da;}})});}_0x2e2fa9=_['merge']({},_0x2e2fa9,_0xd94c93['options']);var _0x30a2bb={'where':_0x2e2fa9[_0xd94b('0x3a')]};return db['Template']['count'](_0x30a2bb)[_0xd94b('0x21')](function(_0x12b965){_0x1fc732['count']=_0x12b965;if(_0xd94c93[_0xd94b('0x2f')]['includeAll']){_0x2e2fa9[_0xd94b('0x3e')]=[{'all':!![]}];}return db['Template'][_0xd94b('0x3f')](_0x2e2fa9);})['then'](function(_0x451163){_0x1fc732['rows']=_0x451163;return _0x1fc732;})[_0xd94b('0x21')](respondWithFilteredResult(_0x47117d,_0x2e2fa9))[_0xd94b('0x40')](handleError(_0x47117d,null));};exports[_0xd94b('0x41')]=function(_0x3561f6,_0x463934){var _0x80cf56={'raw':!![],'where':{'id':_0x3561f6[_0xd94b('0x42')]['id']}},_0x2159db={};_0x2159db[_0xd94b('0x2e')]=_[_0xd94b('0x30')](db[_0xd94b('0x2b')][_0xd94b('0x43')]);_0x2159db[_0xd94b('0x2f')]=_[_0xd94b('0x30')](_0x3561f6[_0xd94b('0x2f')]);_0x2159db[_0xd94b('0x31')]=_[_0xd94b('0x32')](_0x2159db['model'],_0x2159db['query']);_0x80cf56['attributes']=_[_0xd94b('0x32')](_0x2159db[_0xd94b('0x2e')],qs[_0xd94b('0x33')](_0x3561f6[_0xd94b('0x2f')][_0xd94b('0x33')]));_0x80cf56[_0xd94b('0x34')]=_0x80cf56[_0xd94b('0x34')][_0xd94b('0x35')]?_0x80cf56[_0xd94b('0x34')]:_0x2159db[_0xd94b('0x2e')];if(_0x3561f6['query'][_0xd94b('0x44')]){_0x80cf56[_0xd94b('0x3e')]=[{'all':!![]}];}_0x80cf56=_[_0xd94b('0x45')]({},_0x80cf56,_0x3561f6[_0xd94b('0x46')]);return db[_0xd94b('0x2b')][_0xd94b('0x47')](_0x80cf56)[_0xd94b('0x21')](handleEntityNotFound(_0x463934,null))[_0xd94b('0x21')](respondWithResult(_0x463934,null))[_0xd94b('0x40')](handleError(_0x463934,null));};exports['create']=function(_0x161aa1,_0x836e98){return db[_0xd94b('0x2b')][_0xd94b('0x48')](_0x161aa1['body'],{})[_0xd94b('0x21')](function(_0x4eb974){var _0x306900=_0x161aa1[_0xd94b('0x49')][_0xd94b('0x23')]({'plain':!![]});if(!_0x306900)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x306900[_0xd94b('0x4a')]===_0xd94b('0x49')){var _0x3b65df=_0x4eb974['get']({'plain':!![]});var _0x2e7b58=_0xd94b('0x4b');return db[_0xd94b('0x4c')][_0xd94b('0x47')]({'where':{'name':_0x2e7b58,'userProfileId':_0x306900[_0xd94b('0x4d')]},'raw':!![]})[_0xd94b('0x21')](function(_0x2213e7){if(_0x2213e7&&_0x2213e7[_0xd94b('0x4e')]===0x0){return db[_0xd94b('0x24')]['create']({'name':_0x3b65df[_0xd94b('0x27')],'resourceId':_0x3b65df['id'],'type':_0x2213e7[_0xd94b('0x27')],'sectionId':_0x2213e7['id']},{})[_0xd94b('0x21')](function(){return _0x4eb974;});}else{return _0x4eb974;}})[_0xd94b('0x40')](function(_0x4f2a21){logger[_0xd94b('0x25')](_0xd94b('0x4f'),_0x4f2a21);throw _0x4f2a21;});}return _0x4eb974;})[_0xd94b('0x21')](respondWithResult(_0x836e98,0xc9))[_0xd94b('0x40')](handleError(_0x836e98,null));};exports['update']=function(_0xbb6862,_0x539055){if(_0xbb6862[_0xd94b('0x50')]['id']){delete _0xbb6862[_0xd94b('0x50')]['id'];}return db[_0xd94b('0x2b')][_0xd94b('0x47')]({'where':{'id':_0xbb6862[_0xd94b('0x42')]['id']}})['then'](handleEntityNotFound(_0x539055,null))[_0xd94b('0x21')](saveUpdates(_0xbb6862[_0xd94b('0x50')],null))['then'](respondWithResult(_0x539055,null))[_0xd94b('0x40')](handleError(_0x539055,null));};exports[_0xd94b('0x22')]=function(_0x212f59,_0x45484d){return db[_0xd94b('0x2b')]['find']({'where':{'id':_0x212f59[_0xd94b('0x42')]['id']}})['then'](handleEntityNotFound(_0x45484d,null))[_0xd94b('0x21')](removeEntity(_0x45484d,null))[_0xd94b('0x40')](handleError(_0x45484d,null));}; \ No newline at end of file +var _0x2f8d=['apply','reject','update','destroy','Templates','UserProfileResource','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','json'];(function(_0x595fff,_0x2f1f7d){var _0xb9dd0c=function(_0xe1d963){while(--_0xe1d963){_0x595fff['push'](_0x595fff['shift']());}};_0xb9dd0c(++_0x2f1f7d);}(_0x2f8d,0x82));var _0xd2f8=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x2f8d[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2f8('0x0'));var zipdir=require(_0xd2f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2f8('0x2'));var BPromise=require(_0xd2f8('0x3'));var Mustache=require('mustache');var util=require(_0xd2f8('0x4'));var path=require(_0xd2f8('0x5'));var sox=require('sox');var csv=require(_0xd2f8('0x6'));var ejs=require(_0xd2f8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2f8('0x8'));var squel=require('squel');var crypto=require(_0xd2f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd2f8('0xa'));var toCsv=require(_0xd2f8('0x6'));var querystring=require('querystring');var Papa=require(_0xd2f8('0xb'));var Redis=require(_0xd2f8('0xc'));var authService=require(_0xd2f8('0xd'));var qs=require(_0xd2f8('0xe'));var as=require(_0xd2f8('0xf'));var hardwareService=require(_0xd2f8('0x10'));var logger=require(_0xd2f8('0x11'))('api');var utils=require(_0xd2f8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd2f8('0x13'));var db=require(_0xd2f8('0x14'))['db'];function respondWithStatusCode(_0x30a81c,_0x4d28ff){_0x4d28ff=_0x4d28ff||0xcc;return function(_0x284ae9){if(_0x284ae9){return _0x30a81c[_0xd2f8('0x15')](_0x4d28ff);}return _0x30a81c[_0xd2f8('0x16')](_0x4d28ff)[_0xd2f8('0x17')]();};}function respondWithResult(_0x3e9b5d,_0x55d124){_0x55d124=_0x55d124||0xc8;return function(_0x30be91){if(_0x30be91){return _0x3e9b5d[_0xd2f8('0x16')](_0x55d124)['json'](_0x30be91);}};}function respondWithFilteredResult(_0x3bbbc2,_0xb9e803){return function(_0x1b99b9){if(_0x1b99b9){var _0x4205d5=typeof _0xb9e803['offset']===_0xd2f8('0x18')&&typeof _0xb9e803[_0xd2f8('0x19')]===_0xd2f8('0x18');var _0x5b4bcd=_0x1b99b9['count'];var _0x2b3cd7=_0x4205d5?0x0:_0xb9e803[_0xd2f8('0x1a')];var _0x1a7d21=_0x4205d5?_0x1b99b9[_0xd2f8('0x1b')]:_0xb9e803[_0xd2f8('0x1a')]+_0xb9e803[_0xd2f8('0x19')];var _0x22b13d;if(_0x1a7d21>=_0x5b4bcd){_0x1a7d21=_0x5b4bcd;_0x22b13d=0xc8;}else{_0x22b13d=0xce;}_0x3bbbc2[_0xd2f8('0x16')](_0x22b13d);return _0x3bbbc2[_0xd2f8('0x1c')]('Content-Range',_0x2b3cd7+'-'+_0x1a7d21+'/'+_0x5b4bcd)[_0xd2f8('0x1d')](_0x1b99b9);}return null;};}function patchUpdates(_0x25012e){return function(_0x156e66){try{jsonpatch[_0xd2f8('0x1e')](_0x156e66,_0x25012e,!![]);}catch(_0x3c1d6a){return BPromise[_0xd2f8('0x1f')](_0x3c1d6a);}return _0x156e66['save']();};}function saveUpdates(_0x44e579,_0x40d857){return function(_0x25f7db){if(_0x25f7db){return _0x25f7db[_0xd2f8('0x20')](_0x44e579)['then'](function(_0x4fead3){return _0x4fead3;});}return null;};}function removeEntity(_0xa68a19,_0x1da30d){return function(_0x5dd75c){if(_0x5dd75c){return _0x5dd75c[_0xd2f8('0x21')]()['then'](function(){var _0x3a32d6=_0x5dd75c['get']({'plain':!![]});var _0x123716=_0xd2f8('0x22');return db[_0xd2f8('0x23')][_0xd2f8('0x21')]({'where':{'type':_0x123716,'resourceId':_0x3a32d6['id']}})[_0xd2f8('0x24')](function(){return _0x5dd75c;});})['then'](function(){_0xa68a19[_0xd2f8('0x16')](0xcc)[_0xd2f8('0x17')]();});}};}function handleEntityNotFound(_0x436700,_0x56fd36){return function(_0x1b6e13){if(!_0x1b6e13){_0x436700[_0xd2f8('0x15')](0x194);}return _0x1b6e13;};}function handleError(_0xc27c6e,_0x2b373c){_0x2b373c=_0x2b373c||0x1f4;return function(_0x21806e){logger[_0xd2f8('0x25')](_0x21806e['stack']);if(_0x21806e[_0xd2f8('0x26')]){delete _0x21806e[_0xd2f8('0x26')];}_0xc27c6e[_0xd2f8('0x16')](_0x2b373c)[_0xd2f8('0x27')](_0x21806e);};}exports[_0xd2f8('0x28')]=function(_0x2bff1d,_0x41d32b){var _0x4cd033={},_0x5dc437={},_0x56c2e0={'count':0x0,'rows':[]};var _0x1076b2=_[_0xd2f8('0x29')](db[_0xd2f8('0x2a')][_0xd2f8('0x2b')],function(_0x2a5f8c){return{'name':_0x2a5f8c[_0xd2f8('0x2c')],'type':_0x2a5f8c[_0xd2f8('0x2d')][_0xd2f8('0x2e')]};});_0x5dc437[_0xd2f8('0x2f')]=_['map'](_0x1076b2,_0xd2f8('0x26'));_0x5dc437[_0xd2f8('0x30')]=_['keys'](_0x2bff1d[_0xd2f8('0x30')]);_0x5dc437[_0xd2f8('0x31')]=_[_0xd2f8('0x32')](_0x5dc437[_0xd2f8('0x2f')],_0x5dc437['query']);_0x4cd033[_0xd2f8('0x33')]=_[_0xd2f8('0x32')](_0x5dc437['model'],qs[_0xd2f8('0x34')](_0x2bff1d[_0xd2f8('0x30')][_0xd2f8('0x34')]));_0x4cd033['attributes']=_0x4cd033[_0xd2f8('0x33')]['length']?_0x4cd033[_0xd2f8('0x33')]:_0x5dc437[_0xd2f8('0x2f')];if(!_0x2bff1d['query'][_0xd2f8('0x35')](_0xd2f8('0x36'))){_0x4cd033[_0xd2f8('0x19')]=qs['limit'](_0x2bff1d[_0xd2f8('0x30')][_0xd2f8('0x19')]);_0x4cd033[_0xd2f8('0x1a')]=qs[_0xd2f8('0x1a')](_0x2bff1d[_0xd2f8('0x30')]['offset']);}_0x4cd033[_0xd2f8('0x37')]=qs[_0xd2f8('0x38')](_0x2bff1d[_0xd2f8('0x30')][_0xd2f8('0x38')]);_0x4cd033['where']=qs[_0xd2f8('0x31')](_[_0xd2f8('0x39')](_0x2bff1d[_0xd2f8('0x30')],_0x5dc437[_0xd2f8('0x31')]),_0x1076b2);if(_0x2bff1d[_0xd2f8('0x30')][_0xd2f8('0x3a')]){_0x4cd033[_0xd2f8('0x3b')]=_[_0xd2f8('0x3c')](_0x4cd033['where'],{'$or':_[_0xd2f8('0x29')](_0x1076b2,function(_0x3ece04){if(_0x3ece04[_0xd2f8('0x2d')]!==_0xd2f8('0x3d')){var _0x4698fd={};_0x4698fd[_0x3ece04['name']]={'$like':'%'+_0x2bff1d['query'][_0xd2f8('0x3a')]+'%'};return _0x4698fd;}})});}_0x4cd033=_[_0xd2f8('0x3c')]({},_0x4cd033,_0x2bff1d[_0xd2f8('0x3e')]);var _0xdf8f97={'where':_0x4cd033['where']};return db[_0xd2f8('0x2a')][_0xd2f8('0x1b')](_0xdf8f97)[_0xd2f8('0x24')](function(_0x594b06){_0x56c2e0['count']=_0x594b06;if(_0x2bff1d[_0xd2f8('0x30')][_0xd2f8('0x3f')]){_0x4cd033[_0xd2f8('0x40')]=[{'all':!![]}];}return db['Template']['findAll'](_0x4cd033);})['then'](function(_0x587eb1){_0x56c2e0[_0xd2f8('0x41')]=_0x587eb1;return _0x56c2e0;})[_0xd2f8('0x24')](respondWithFilteredResult(_0x41d32b,_0x4cd033))[_0xd2f8('0x42')](handleError(_0x41d32b,null));};exports[_0xd2f8('0x43')]=function(_0x2949d5,_0x17439f){var _0x121039={'raw':!![],'where':{'id':_0x2949d5['params']['id']}},_0x4b11e6={};_0x4b11e6[_0xd2f8('0x2f')]=_[_0xd2f8('0x44')](db[_0xd2f8('0x2a')][_0xd2f8('0x2b')]);_0x4b11e6['query']=_[_0xd2f8('0x44')](_0x2949d5[_0xd2f8('0x30')]);_0x4b11e6['filters']=_['intersection'](_0x4b11e6[_0xd2f8('0x2f')],_0x4b11e6[_0xd2f8('0x30')]);_0x121039[_0xd2f8('0x33')]=_[_0xd2f8('0x32')](_0x4b11e6[_0xd2f8('0x2f')],qs[_0xd2f8('0x34')](_0x2949d5['query'][_0xd2f8('0x34')]));_0x121039[_0xd2f8('0x33')]=_0x121039['attributes'][_0xd2f8('0x45')]?_0x121039['attributes']:_0x4b11e6[_0xd2f8('0x2f')];if(_0x2949d5[_0xd2f8('0x30')][_0xd2f8('0x3f')]){_0x121039[_0xd2f8('0x40')]=[{'all':!![]}];}_0x121039=_['merge']({},_0x121039,_0x2949d5[_0xd2f8('0x3e')]);return db['Template'][_0xd2f8('0x46')](_0x121039)[_0xd2f8('0x24')](handleEntityNotFound(_0x17439f,null))[_0xd2f8('0x24')](respondWithResult(_0x17439f,null))[_0xd2f8('0x42')](handleError(_0x17439f,null));};exports[_0xd2f8('0x47')]=function(_0x47626d,_0x28ff7c){return db[_0xd2f8('0x2a')]['create'](_0x47626d['body'],{})['then'](function(_0x314b7c){var _0x4034c5=_0x47626d[_0xd2f8('0x48')][_0xd2f8('0x49')]({'plain':!![]});if(!_0x4034c5)throw new Error(_0xd2f8('0x4a'));if(_0x4034c5[_0xd2f8('0x4b')]===_0xd2f8('0x48')){var _0x19ea7c=_0x314b7c[_0xd2f8('0x49')]({'plain':!![]});var _0x2e73a6=_0xd2f8('0x22');return db['UserProfileSection'][_0xd2f8('0x46')]({'where':{'name':_0x2e73a6,'userProfileId':_0x4034c5[_0xd2f8('0x4c')]},'raw':!![]})[_0xd2f8('0x24')](function(_0x4ab205){if(_0x4ab205&&_0x4ab205['autoAssociation']===0x0){return db[_0xd2f8('0x23')]['create']({'name':_0x19ea7c[_0xd2f8('0x26')],'resourceId':_0x19ea7c['id'],'type':_0x4ab205[_0xd2f8('0x26')],'sectionId':_0x4ab205['id']},{})['then'](function(){return _0x314b7c;});}else{return _0x314b7c;}})[_0xd2f8('0x42')](function(_0x1220ff){logger[_0xd2f8('0x25')](_0xd2f8('0x4d'),_0x1220ff);throw _0x1220ff;});}return _0x314b7c;})[_0xd2f8('0x24')](respondWithResult(_0x28ff7c,0xc9))[_0xd2f8('0x42')](handleError(_0x28ff7c,null));};exports[_0xd2f8('0x20')]=function(_0x4bcbe0,_0x3436d9){if(_0x4bcbe0[_0xd2f8('0x4e')]['id']){delete _0x4bcbe0[_0xd2f8('0x4e')]['id'];}return db[_0xd2f8('0x2a')][_0xd2f8('0x46')]({'where':{'id':_0x4bcbe0[_0xd2f8('0x4f')]['id']}})[_0xd2f8('0x24')](handleEntityNotFound(_0x3436d9,null))[_0xd2f8('0x24')](saveUpdates(_0x4bcbe0[_0xd2f8('0x4e')],null))[_0xd2f8('0x24')](respondWithResult(_0x3436d9,null))[_0xd2f8('0x42')](handleError(_0x3436d9,null));};exports[_0xd2f8('0x21')]=function(_0x3fae92,_0x3ed981){return db[_0xd2f8('0x2a')][_0xd2f8('0x46')]({'where':{'id':_0x3fae92[_0xd2f8('0x4f')]['id']}})[_0xd2f8('0x24')](handleEntityNotFound(_0x3ed981,null))[_0xd2f8('0x24')](removeEntity(_0x3ed981,null))[_0xd2f8('0x42')](handleError(_0x3ed981,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7206abb..e87dcf2 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 _0xff32=['request-promise','path','rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','../../config/logger','moment','bluebird'];(function(_0x3e5193,_0x2ddca8){var _0xf56de6=function(_0x1b98f6){while(--_0x1b98f6){_0x3e5193['push'](_0x3e5193['shift']());}};_0xf56de6(++_0x2ddca8);}(_0xff32,0x17d));var _0x2ff3=function(_0x470e3f,_0x3b513d){_0x470e3f=_0x470e3f-0x0;var _0x4fd22b=_0xff32[_0x470e3f];return _0x4fd22b;};'use strict';var _=require(_0x2ff3('0x0'));var util=require('util');var logger=require(_0x2ff3('0x1'))('api');var moment=require(_0x2ff3('0x2'));var BPromise=require(_0x2ff3('0x3'));var rp=require(_0x2ff3('0x4'));var fs=require('fs');var path=require(_0x2ff3('0x5'));var rimraf=require(_0x2ff3('0x6'));var config=require(_0x2ff3('0x7'));var attributes=require(_0x2ff3('0x8'));module['exports']=function(_0x12fd72,_0x37d52a){return _0x12fd72[_0x2ff3('0x9')]('Template',attributes,{'tableName':_0x2ff3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0283=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','define','Template'];(function(_0x4a5f20,_0x38a6a3){var _0x141e8b=function(_0x1d6501){while(--_0x1d6501){_0x4a5f20['push'](_0x4a5f20['shift']());}};_0x141e8b(++_0x38a6a3);}(_0x0283,0x120));var _0x3028=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x0283[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x3028('0x0'));var util=require(_0x3028('0x1'));var logger=require(_0x3028('0x2'))(_0x3028('0x3'));var moment=require('moment');var BPromise=require(_0x3028('0x4'));var rp=require(_0x3028('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3028('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x4c249d,_0x3f0a4e){return _0x4c249d[_0x3028('0x7')](_0x3028('0x8'),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 0cfe74c..fd84467 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 _0x1123=['GetTemplate','findAll','options','raw','attributes','limit','include','model','map','debug','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1f4381,_0x303b7b){var _0x44d236=function(_0x3a196a){while(--_0x3a196a){_0x1f4381['push'](_0x1f4381['shift']());}};_0x44d236(++_0x303b7b);}(_0x1123,0x118));var _0x3112=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1123[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3112('0x0'));var BPromise=require('bluebird');var rs=require(_0x3112('0x1'));var fs=require('fs');var Redis=require(_0x3112('0x2'));var db=require(_0x3112('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3112('0x4'));var config=require(_0x3112('0x5'));var jayson=require(_0x3112('0x6'));var client=jayson[_0x3112('0x7')][_0x3112('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2b5c,_0x3bee38,_0x3f7ae4){return new BPromise(function(_0x3cd83c,_0x4849f9){return client[_0x3112('0x9')](_0x3e2b5c,_0x3f7ae4)[_0x3112('0xa')](function(_0x39b75b){logger[_0x3112('0xb')](_0x3112('0xc'),_0x3bee38,_0x3112('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'),JSON[_0x3112('0xe')](_0x39b75b));if(_0x39b75b[_0x3112('0xf')]){if(_0x39b75b[_0x3112('0xf')][_0x3112('0x10')]===0x1f4){logger['error'](_0x3112('0xc'),_0x3bee38,_0x39b75b['error']['message']);return _0x4849f9(_0x39b75b[_0x3112('0xf')][_0x3112('0x11')]);}logger[_0x3112('0xf')]('Template,\x20%s,\x20%s',_0x3bee38,_0x39b75b['error'][_0x3112('0x11')]);return _0x3cd83c(_0x39b75b['error'][_0x3112('0x11')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x3bee38,_0x3112('0xd'));_0x3cd83c(_0x39b75b[_0x3112('0x12')]['message']);}})[_0x3112('0x13')](function(_0x3f5cfd){logger['error']('Template,\x20%s,\x20%s',_0x3bee38,_0x3f5cfd);_0x4849f9(_0x3f5cfd);});});}exports[_0x3112('0x14')]=function(_0x5ca7d9){var _0x254ffc=this;return new Promise(function(_0x22925b,_0x5e9262){return db['Template'][_0x3112('0x15')]({'raw':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9[_0x3112('0x16')][_0x3112('0x17')]===undefined?!![]:![]:!![],'where':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9[_0x3112('0x16')]['where']||null:null,'attributes':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9['options'][_0x3112('0x18')]||null:null,'limit':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9[_0x3112('0x16')][_0x3112('0x19')]||null:null,'include':_0x5ca7d9[_0x3112('0x16')]?_0x5ca7d9['options'][_0x3112('0x1a')]?_['map'](_0x5ca7d9[_0x3112('0x16')]['include'],function(_0x537e31){return{'model':db[_0x537e31[_0x3112('0x1b')]],'as':_0x537e31['as'],'attributes':_0x537e31['attributes'],'include':_0x537e31[_0x3112('0x1a')]?_[_0x3112('0x1c')](_0x537e31[_0x3112('0x1a')],function(_0x4d898d){return{'model':db[_0x4d898d[_0x3112('0x1b')]],'as':_0x4d898d['as'],'attributes':_0x4d898d[_0x3112('0x18')],'include':_0x4d898d[_0x3112('0x1a')]?_[_0x3112('0x1c')](_0x4d898d['include'],function(_0x34ca6d){return{'model':db[_0x34ca6d[_0x3112('0x1b')]],'as':_0x34ca6d['as'],'attributes':_0x34ca6d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3112('0xa')](function(_0x58f21f){logger[_0x3112('0xb')](_0x3112('0x14'),_0x5ca7d9);logger[_0x3112('0x1d')](_0x3112('0x14'),_0x5ca7d9,JSON[_0x3112('0xe')](_0x58f21f));_0x22925b(_0x58f21f);})['catch'](function(_0x1d1e4a){logger['error'](_0x3112('0x14'),_0x1d1e4a['message'],_0x5ca7d9);_0x5e9262(_0x254ffc[_0x3112('0xf')](0x1f4,_0x1d1e4a[_0x3112('0x11')]));});});}; \ No newline at end of file +var _0x8ae0=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTemplate','Template','options','attributes','limit','include','model','map','lodash','util'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x8ae0,0x115));var _0x08ae=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8ae0[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x08ae('0x0'));var util=require(_0x08ae('0x1'));var moment=require(_0x08ae('0x2'));var BPromise=require(_0x08ae('0x3'));var rs=require(_0x08ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08ae('0x5'))['db'];var utils=require(_0x08ae('0x6'));var logger=require(_0x08ae('0x7'))(_0x08ae('0x8'));var config=require(_0x08ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08ae('0xa')][_0x08ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14ece5,_0x539956,_0x16b61f){return new BPromise(function(_0x5880de,_0x49f013){return client['request'](_0x14ece5,_0x16b61f)[_0x08ae('0xc')](function(_0xff81d2){logger[_0x08ae('0xd')](_0x08ae('0xe'),_0x539956,'request\x20sent');logger[_0x08ae('0xf')](_0x08ae('0x10'),_0x539956,_0x08ae('0x11'),JSON[_0x08ae('0x12')](_0xff81d2));if(_0xff81d2[_0x08ae('0x13')]){if(_0xff81d2['error'][_0x08ae('0x14')]===0x1f4){logger[_0x08ae('0x13')](_0x08ae('0xe'),_0x539956,_0xff81d2['error'][_0x08ae('0x15')]);return _0x49f013(_0xff81d2[_0x08ae('0x13')][_0x08ae('0x15')]);}logger[_0x08ae('0x13')](_0x08ae('0xe'),_0x539956,_0xff81d2[_0x08ae('0x13')][_0x08ae('0x15')]);return _0x5880de(_0xff81d2[_0x08ae('0x13')][_0x08ae('0x15')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x539956,_0x08ae('0x11'));_0x5880de(_0xff81d2[_0x08ae('0x16')][_0x08ae('0x15')]);}})['catch'](function(_0x48ea78){logger['error'](_0x08ae('0xe'),_0x539956,_0x48ea78);_0x49f013(_0x48ea78);});});}exports[_0x08ae('0x17')]=function(_0x1589df){var _0x23365a=this;return new Promise(function(_0x36dc40,_0xfed2a3){return db[_0x08ae('0x18')]['findAll']({'raw':_0x1589df['options']?_0x1589df[_0x08ae('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1589df[_0x08ae('0x19')]?_0x1589df[_0x08ae('0x19')]['where']||null:null,'attributes':_0x1589df[_0x08ae('0x19')]?_0x1589df['options'][_0x08ae('0x1a')]||null:null,'limit':_0x1589df['options']?_0x1589df[_0x08ae('0x19')][_0x08ae('0x1b')]||null:null,'include':_0x1589df[_0x08ae('0x19')]?_0x1589df[_0x08ae('0x19')]['include']?_['map'](_0x1589df[_0x08ae('0x19')][_0x08ae('0x1c')],function(_0x1639a6){return{'model':db[_0x1639a6[_0x08ae('0x1d')]],'as':_0x1639a6['as'],'attributes':_0x1639a6[_0x08ae('0x1a')],'include':_0x1639a6[_0x08ae('0x1c')]?_[_0x08ae('0x1e')](_0x1639a6[_0x08ae('0x1c')],function(_0xbd97e1){return{'model':db[_0xbd97e1['model']],'as':_0xbd97e1['as'],'attributes':_0xbd97e1['attributes'],'include':_0xbd97e1[_0x08ae('0x1c')]?_[_0x08ae('0x1e')](_0xbd97e1[_0x08ae('0x1c')],function(_0x39ac46){return{'model':db[_0x39ac46[_0x08ae('0x1d')]],'as':_0x39ac46['as'],'attributes':_0x39ac46[_0x08ae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x08ae('0xc')](function(_0xb30ce2){logger[_0x08ae('0xd')]('GetTemplate',_0x1589df);logger['debug']('GetTemplate',_0x1589df,JSON['stringify'](_0xb30ce2));_0x36dc40(_0xb30ce2);})['catch'](function(_0x121fbe){logger['error'](_0x08ae('0x17'),_0x121fbe[_0x08ae('0x15')],_0x1589df);_0xfed2a3(_0x23365a['error'](0x1f4,_0x121fbe['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 11b6424..81f5f87 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 _0x72e7=['isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x72e7,0x102));var _0x772e=function(_0x17196d,_0x4d2543){_0x17196d=_0x17196d-0x0;var _0xed7708=_0x72e7[_0x17196d];return _0xed7708;};'use strict';var multer=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var path=require(_0x772e('0x2'));var timeout=require(_0x772e('0x3'));var express=require(_0x772e('0x4'));var router=express[_0x772e('0x5')]();var fs_extra=require(_0x772e('0x6'));var auth=require(_0x772e('0x7'));var interaction=require(_0x772e('0x8'));var config=require(_0x772e('0x9'));var controller=require(_0x772e('0xa'));router[_0x772e('0xb')]('/',auth[_0x772e('0xc')](),controller[_0x772e('0xd')]);router[_0x772e('0xb')](_0x772e('0xe'),auth['isAuthenticated'](),controller[_0x772e('0xf')]);router[_0x772e('0xb')](_0x772e('0x10'),auth[_0x772e('0xc')](),controller[_0x772e('0x11')]);router['get'](_0x772e('0x12'),auth[_0x772e('0xc')](),controller['getAnyConditions']);router[_0x772e('0xb')](_0x772e('0x13'),auth[_0x772e('0xc')](),controller[_0x772e('0x14')]);router[_0x772e('0x15')]('/',auth[_0x772e('0xc')](),controller[_0x772e('0x16')]);router[_0x772e('0x15')](_0x772e('0x10'),auth[_0x772e('0xc')](),controller[_0x772e('0x17')]);router['post'](_0x772e('0x12'),auth[_0x772e('0xc')](),controller['addAnyCondition']);router[_0x772e('0x15')](_0x772e('0x13'),auth['isAuthenticated'](),controller[_0x772e('0x18')]);router[_0x772e('0x19')](_0x772e('0xe'),auth[_0x772e('0xc')](),controller[_0x772e('0x1a')]);router[_0x772e('0x1b')](_0x772e('0xe'),auth[_0x772e('0xc')](),controller[_0x772e('0x1c')]);module[_0x772e('0x1d')]=router; \ No newline at end of file +var _0xefdf=['express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','isAuthenticated','get','/:id','show','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAnyCondition','/:id/actions','addAction','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x8529ba,_0xab9f8a){var _0x3660ac=function(_0x31c555){while(--_0x31c555){_0x8529ba['push'](_0x8529ba['shift']());}};_0x3660ac(++_0xab9f8a);}(_0xefdf,0x129));var _0xfefd=function(_0x5c85c8,_0x16110b){_0x5c85c8=_0x5c85c8-0x0;var _0x42d66f=_0xefdf[_0x5c85c8];return _0x42d66f;};'use strict';var multer=require('multer');var util=require(_0xfefd('0x0'));var path=require(_0xfefd('0x1'));var timeout=require(_0xfefd('0x2'));var express=require(_0xfefd('0x3'));var router=express[_0xfefd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfefd('0x5'));var interaction=require(_0xfefd('0x6'));var config=require('../../config/environment');var controller=require(_0xfefd('0x7'));router['get']('/',auth[_0xfefd('0x8')](),controller['index']);router[_0xfefd('0x9')](_0xfefd('0xa'),auth[_0xfefd('0x8')](),controller[_0xfefd('0xb')]);router[_0xfefd('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router['get'](_0xfefd('0xc'),auth['isAuthenticated'](),controller[_0xfefd('0xd')]);router[_0xfefd('0x9')]('/:id/actions',auth[_0xfefd('0x8')](),controller[_0xfefd('0xe')]);router[_0xfefd('0xf')]('/',auth['isAuthenticated'](),controller[_0xfefd('0x10')]);router['post'](_0xfefd('0x11'),auth[_0xfefd('0x8')](),controller['addAllCondition']);router['post']('/:id/any_conditions',auth[_0xfefd('0x8')](),controller[_0xfefd('0x12')]);router[_0xfefd('0xf')](_0xfefd('0x13'),auth[_0xfefd('0x8')](),controller[_0xfefd('0x14')]);router[_0xfefd('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfefd('0x16')]);router['delete'](_0xfefd('0xa'),auth['isAuthenticated'](),controller[_0xfefd('0x17')]);module[_0xfefd('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 745ad59..abc762b 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 _0xefe2=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xefe2,0x178));var _0x2efe=function(_0x5f3056,_0x3dd505){_0x5f3056=_0x5f3056-0x0;var _0x585675=_0xefe2[_0x5f3056];return _0x585675;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2efe('0x2')]},'description':{'type':Sequelize[_0x2efe('0x2')]},'status':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9aa9=['STRING','sequelize'];(function(_0x11ab2c,_0x4ebf1c){var _0x41af3d=function(_0x406746){while(--_0x406746){_0x11ab2c['push'](_0x11ab2c['shift']());}};_0x41af3d(++_0x4ebf1c);}(_0x9aa9,0x193));var _0x99aa=function(_0x1bfc2d,_0x181462){_0x1bfc2d=_0x1bfc2d-0x0;var _0x501195=_0x9aa9[_0x1bfc2d];return _0x501195;};'use strict';var Sequelize=require(_0x99aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x99aa('0x1')]},'channel':{'type':Sequelize[_0x99aa('0x1')]},'description':{'type':Sequelize[_0x99aa('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 645b9ca..e91fbac 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 _0x72e6=['params','keys','length','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addAllCondition','TriggerAllId','addAnyCondition','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Trigger','findAll','rows','catch'];(function(_0xd3bdab,_0x5d784a){var _0x1c3178=function(_0x4f7ef4){while(--_0x4f7ef4){_0xd3bdab['push'](_0xd3bdab['shift']());}};_0x1c3178(++_0x5d784a);}(_0x72e6,0x196));var _0x672e=function(_0x4bab29,_0x74443e){_0x4bab29=_0x4bab29-0x0;var _0x9316d7=_0x72e6[_0x4bab29];return _0x9316d7;};'use strict';var emlformat=require(_0x672e('0x0'));var rimraf=require(_0x672e('0x1'));var zipdir=require(_0x672e('0x2'));var jsonpatch=require(_0x672e('0x3'));var rp=require(_0x672e('0x4'));var moment=require('moment');var BPromise=require(_0x672e('0x5'));var Mustache=require(_0x672e('0x6'));var util=require(_0x672e('0x7'));var path=require(_0x672e('0x8'));var sox=require(_0x672e('0x9'));var csv=require(_0x672e('0xa'));var ejs=require(_0x672e('0xb'));var fs=require('fs');var fs_extra=require(_0x672e('0xc'));var _=require(_0x672e('0xd'));var squel=require(_0x672e('0xe'));var crypto=require(_0x672e('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x672e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x672e('0x10'));var qs=require(_0x672e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672e('0x12'));var logger=require(_0x672e('0x13'))(_0x672e('0x14'));var utils=require(_0x672e('0x15'));var config=require(_0x672e('0x16'));var licenseUtil=require(_0x672e('0x17'));var db=require(_0x672e('0x18'))['db'];function respondWithStatusCode(_0x1146c9,_0x369ab8){_0x369ab8=_0x369ab8||0xcc;return function(_0x20bf91){if(_0x20bf91){return _0x1146c9['sendStatus'](_0x369ab8);}return _0x1146c9[_0x672e('0x19')](_0x369ab8)[_0x672e('0x1a')]();};}function respondWithResult(_0x3c5ecc,_0x45f903){_0x45f903=_0x45f903||0xc8;return function(_0x4838ca){if(_0x4838ca){return _0x3c5ecc[_0x672e('0x19')](_0x45f903)[_0x672e('0x1b')](_0x4838ca);}};}function respondWithFilteredResult(_0x4e165b,_0x4d9d03){return function(_0x49847e){if(_0x49847e){var _0x24ee53=typeof _0x4d9d03[_0x672e('0x1c')]==='undefined'&&typeof _0x4d9d03[_0x672e('0x1d')]===_0x672e('0x1e');var _0x2584a7=_0x49847e[_0x672e('0x1f')];var _0x3dff55=_0x24ee53?0x0:_0x4d9d03[_0x672e('0x1c')];var _0x8fbcf8=_0x24ee53?_0x49847e[_0x672e('0x1f')]:_0x4d9d03[_0x672e('0x1c')]+_0x4d9d03[_0x672e('0x1d')];var _0x25f23b;if(_0x8fbcf8>=_0x2584a7){_0x8fbcf8=_0x2584a7;_0x25f23b=0xc8;}else{_0x25f23b=0xce;}_0x4e165b[_0x672e('0x19')](_0x25f23b);return _0x4e165b[_0x672e('0x20')]('Content-Range',_0x3dff55+'-'+_0x8fbcf8+'/'+_0x2584a7)[_0x672e('0x1b')](_0x49847e);}return null;};}function patchUpdates(_0x1dbd06){return function(_0xc8ca7e){try{jsonpatch[_0x672e('0x21')](_0xc8ca7e,_0x1dbd06,!![]);}catch(_0x213f1b){return BPromise[_0x672e('0x22')](_0x213f1b);}return _0xc8ca7e[_0x672e('0x23')]();};}function saveUpdates(_0x148e18,_0x18f904){return function(_0x147ae0){if(_0x147ae0){return _0x147ae0[_0x672e('0x24')](_0x148e18)[_0x672e('0x25')](function(_0x524bb6){return _0x524bb6;});}return null;};}function removeEntity(_0x149bb9,_0x59ff96){return function(_0x1e7cc7){if(_0x1e7cc7){return _0x1e7cc7[_0x672e('0x26')]()[_0x672e('0x25')](function(){var _0x246b23=_0x1e7cc7['get']({'plain':!![]});var _0x462ee3=_0x672e('0x27');return db[_0x672e('0x28')][_0x672e('0x26')]({'where':{'type':_0x462ee3,'resourceId':_0x246b23['id']}})[_0x672e('0x25')](function(){return _0x1e7cc7;});})[_0x672e('0x25')](function(){_0x149bb9[_0x672e('0x19')](0xcc)[_0x672e('0x1a')]();});}};}function handleEntityNotFound(_0x307567,_0x5d31c9){return function(_0x5cdf61){if(!_0x5cdf61){_0x307567[_0x672e('0x29')](0x194);}return _0x5cdf61;};}function handleError(_0x5bb3f8,_0x3b3dfb){_0x3b3dfb=_0x3b3dfb||0x1f4;return function(_0x3f26f4){logger[_0x672e('0x2a')](_0x3f26f4[_0x672e('0x2b')]);if(_0x3f26f4['name']){delete _0x3f26f4[_0x672e('0x2c')];}_0x5bb3f8['status'](_0x3b3dfb)['send'](_0x3f26f4);};}exports['index']=function(_0x25cabb,_0x2286ab){var _0x35bf0d={},_0x4774d1={},_0x199fe4={'count':0x0,'rows':[]};var _0x44f38d=_[_0x672e('0x2d')](db['Trigger'][_0x672e('0x2e')],function(_0x3b1ea6){return{'name':_0x3b1ea6[_0x672e('0x2f')],'type':_0x3b1ea6[_0x672e('0x30')][_0x672e('0x31')]};});_0x4774d1[_0x672e('0x32')]=_[_0x672e('0x2d')](_0x44f38d,'name');_0x4774d1[_0x672e('0x33')]=_['keys'](_0x25cabb['query']);_0x4774d1[_0x672e('0x34')]=_[_0x672e('0x35')](_0x4774d1['model'],_0x4774d1[_0x672e('0x33')]);_0x35bf0d[_0x672e('0x36')]=_[_0x672e('0x35')](_0x4774d1[_0x672e('0x32')],qs[_0x672e('0x37')](_0x25cabb[_0x672e('0x33')][_0x672e('0x37')]));_0x35bf0d[_0x672e('0x36')]=_0x35bf0d['attributes']['length']?_0x35bf0d[_0x672e('0x36')]:_0x4774d1['model'];if(!_0x25cabb['query'][_0x672e('0x38')](_0x672e('0x39'))){_0x35bf0d[_0x672e('0x1d')]=qs['limit'](_0x25cabb[_0x672e('0x33')][_0x672e('0x1d')]);_0x35bf0d[_0x672e('0x1c')]=qs[_0x672e('0x1c')](_0x25cabb[_0x672e('0x33')][_0x672e('0x1c')]);}_0x35bf0d[_0x672e('0x3a')]=qs[_0x672e('0x3b')](_0x25cabb[_0x672e('0x33')][_0x672e('0x3b')]);_0x35bf0d[_0x672e('0x3c')]=qs[_0x672e('0x34')](_[_0x672e('0x3d')](_0x25cabb[_0x672e('0x33')],_0x4774d1[_0x672e('0x34')]),_0x44f38d);if(_0x25cabb['query'][_0x672e('0x3e')]){_0x35bf0d[_0x672e('0x3c')]=_[_0x672e('0x3f')](_0x35bf0d['where'],{'$or':_[_0x672e('0x2d')](_0x44f38d,function(_0xc5e1fa){if(_0xc5e1fa[_0x672e('0x30')]!==_0x672e('0x40')){var _0x5daaab={};_0x5daaab[_0xc5e1fa[_0x672e('0x2c')]]={'$like':'%'+_0x25cabb[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0x5daaab;}})});}_0x35bf0d=_[_0x672e('0x3f')]({},_0x35bf0d,_0x25cabb['options']);var _0x149990={'where':_0x35bf0d[_0x672e('0x3c')]};return db[_0x672e('0x41')]['count'](_0x149990)[_0x672e('0x25')](function(_0x41b364){_0x199fe4[_0x672e('0x1f')]=_0x41b364;if(_0x25cabb[_0x672e('0x33')]['includeAll']){_0x35bf0d['include']=[{'all':!![]}];}return db[_0x672e('0x41')][_0x672e('0x42')](_0x35bf0d);})[_0x672e('0x25')](function(_0x381349){_0x199fe4[_0x672e('0x43')]=_0x381349;return _0x199fe4;})[_0x672e('0x25')](respondWithFilteredResult(_0x2286ab,_0x35bf0d))[_0x672e('0x44')](handleError(_0x2286ab,null));};exports['show']=function(_0x290129,_0x35111f){var _0x1f819c={'raw':![],'where':{'id':_0x290129[_0x672e('0x45')]['id']}},_0x3a82a5={};_0x3a82a5[_0x672e('0x32')]=_[_0x672e('0x46')](db[_0x672e('0x41')][_0x672e('0x2e')]);_0x3a82a5[_0x672e('0x33')]=_[_0x672e('0x46')](_0x290129['query']);_0x3a82a5[_0x672e('0x34')]=_[_0x672e('0x35')](_0x3a82a5[_0x672e('0x32')],_0x3a82a5[_0x672e('0x33')]);_0x1f819c[_0x672e('0x36')]=_[_0x672e('0x35')](_0x3a82a5[_0x672e('0x32')],qs['fields'](_0x290129[_0x672e('0x33')][_0x672e('0x37')]));_0x1f819c[_0x672e('0x36')]=_0x1f819c[_0x672e('0x36')][_0x672e('0x47')]?_0x1f819c[_0x672e('0x36')]:_0x3a82a5[_0x672e('0x32')];if(_0x290129[_0x672e('0x33')][_0x672e('0x48')]){_0x1f819c[_0x672e('0x49')]=[{'all':!![]}];}_0x1f819c=_['merge']({},_0x1f819c,_0x290129[_0x672e('0x4a')]);return db[_0x672e('0x41')][_0x672e('0x4b')](_0x1f819c)['then'](handleEntityNotFound(_0x35111f,null))['then'](respondWithResult(_0x35111f,null))[_0x672e('0x44')](handleError(_0x35111f,null));};exports['create']=function(_0x5913a3,_0x27e23b){return db['Trigger'][_0x672e('0x4c')](_0x5913a3[_0x672e('0x4d')],{})[_0x672e('0x25')](function(_0x22c6ec){var _0x3ddcf5=_0x5913a3[_0x672e('0x4e')][_0x672e('0x4f')]({'plain':!![]});if(!_0x3ddcf5)throw new Error(_0x672e('0x50'));if(_0x3ddcf5[_0x672e('0x51')]==='user'){var _0x9809d4=_0x22c6ec[_0x672e('0x4f')]({'plain':!![]});var _0x45ab50='Triggers';return db['UserProfileSection'][_0x672e('0x4b')]({'where':{'name':_0x45ab50,'userProfileId':_0x3ddcf5[_0x672e('0x52')]},'raw':!![]})[_0x672e('0x25')](function(_0x1e0c1e){if(_0x1e0c1e&&_0x1e0c1e[_0x672e('0x53')]===0x0){return db[_0x672e('0x28')][_0x672e('0x4c')]({'name':_0x9809d4['name'],'resourceId':_0x9809d4['id'],'type':_0x1e0c1e[_0x672e('0x2c')],'sectionId':_0x1e0c1e['id']},{})['then'](function(){return _0x22c6ec;});}else{return _0x22c6ec;}})[_0x672e('0x44')](function(_0x514e2b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x514e2b);throw _0x514e2b;});}return _0x22c6ec;})['then'](respondWithResult(_0x27e23b,0xc9))[_0x672e('0x44')](handleError(_0x27e23b,null));};exports[_0x672e('0x24')]=function(_0x3ba4e3,_0x46c214){if(_0x3ba4e3[_0x672e('0x4d')]['id']){delete _0x3ba4e3[_0x672e('0x4d')]['id'];}return db['Trigger'][_0x672e('0x4b')]({'where':{'id':_0x3ba4e3[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x46c214,null))[_0x672e('0x25')](saveUpdates(_0x3ba4e3['body'],null))[_0x672e('0x25')](respondWithResult(_0x46c214,null))['catch'](handleError(_0x46c214,null));};exports[_0x672e('0x26')]=function(_0x5165f2,_0x22c561){return db[_0x672e('0x41')][_0x672e('0x4b')]({'where':{'id':_0x5165f2[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x22c561,null))[_0x672e('0x25')](removeEntity(_0x22c561,null))[_0x672e('0x44')](handleError(_0x22c561,null));};exports[_0x672e('0x54')]=function(_0x2131b8,_0xd3a3aa,_0x206dd0){if(_0x2131b8[_0x672e('0x4d')]['id']){delete _0x2131b8[_0x672e('0x4d')]['id'];}return db[_0x672e('0x41')][_0x672e('0x4b')]({'where':{'id':_0x2131b8[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0xd3a3aa,null))['then'](function(_0x8723c6){if(_0x8723c6){_0x2131b8[_0x672e('0x4d')][_0x672e('0x55')]=_0x8723c6['id'];return db['Condition'][_0x672e('0x4c')](_0x2131b8[_0x672e('0x4d')]);}})[_0x672e('0x25')](respondWithResult(_0xd3a3aa,null))['catch'](handleError(_0xd3a3aa,null));};exports[_0x672e('0x56')]=function(_0x1b4e3f,_0x2076ca,_0x3a5bf2){if(_0x1b4e3f[_0x672e('0x4d')]['id']){delete _0x1b4e3f['body']['id'];}return db['Trigger'][_0x672e('0x4b')]({'where':{'id':_0x1b4e3f[_0x672e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2076ca,null))[_0x672e('0x25')](function(_0x4d3d63){if(_0x4d3d63){_0x1b4e3f[_0x672e('0x4d')]['TriggerAnyId']=_0x4d3d63['id'];return db[_0x672e('0x57')][_0x672e('0x4c')](_0x1b4e3f['body']);}})[_0x672e('0x25')](respondWithResult(_0x2076ca,null))[_0x672e('0x44')](handleError(_0x2076ca,null));};exports[_0x672e('0x58')]=function(_0x46a37c,_0x25fade,_0x398a4d){var _0x11eaa5={};var _0x2fa02f={};var _0x888c2c;var _0x1ea305;return db['Trigger'][_0x672e('0x59')]({'where':{'id':_0x46a37c[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x25fade,null))[_0x672e('0x25')](function(_0x4643c4){if(_0x4643c4){_0x888c2c=_0x4643c4;_0x2fa02f['model']=_[_0x672e('0x46')](db[_0x672e('0x57')][_0x672e('0x2e')]);_0x2fa02f[_0x672e('0x33')]=_[_0x672e('0x46')](_0x46a37c[_0x672e('0x33')]);_0x2fa02f[_0x672e('0x34')]=_[_0x672e('0x35')](_0x2fa02f[_0x672e('0x32')],_0x2fa02f[_0x672e('0x33')]);_0x11eaa5[_0x672e('0x36')]=_[_0x672e('0x35')](_0x2fa02f[_0x672e('0x32')],qs[_0x672e('0x37')](_0x46a37c[_0x672e('0x33')][_0x672e('0x37')]));_0x11eaa5[_0x672e('0x36')]=_0x11eaa5[_0x672e('0x36')][_0x672e('0x47')]?_0x11eaa5[_0x672e('0x36')]:_0x2fa02f['model'];_0x11eaa5[_0x672e('0x3a')]=qs[_0x672e('0x3b')](_0x46a37c['query'][_0x672e('0x3b')]);_0x11eaa5[_0x672e('0x3c')]=qs[_0x672e('0x34')](_[_0x672e('0x3d')](_0x46a37c[_0x672e('0x33')],_0x2fa02f['filters']));if(_0x46a37c[_0x672e('0x33')][_0x672e('0x3e')]){_0x11eaa5[_0x672e('0x3c')]=_[_0x672e('0x3f')](_0x11eaa5['where'],{'$or':_[_0x672e('0x2d')](_0x11eaa5[_0x672e('0x36')],function(_0x183819){var _0x1d7fa4={};_0x1d7fa4[_0x183819]={'$like':'%'+_0x46a37c[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0x1d7fa4;})});}_0x11eaa5=_[_0x672e('0x3f')]({},_0x11eaa5,_0x46a37c[_0x672e('0x4a')]);return _0x888c2c['getAllConditions'](_0x11eaa5);}})['then'](function(_0x477d3b){if(_0x477d3b){_0x1ea305=_0x477d3b[_0x672e('0x47')];if(!_0x46a37c[_0x672e('0x33')][_0x672e('0x38')]('nolimit')){_0x11eaa5['limit']=qs[_0x672e('0x1d')](_0x46a37c[_0x672e('0x33')]['limit']);_0x11eaa5['offset']=qs[_0x672e('0x1c')](_0x46a37c[_0x672e('0x33')]['offset']);}return _0x888c2c[_0x672e('0x58')](_0x11eaa5);}})[_0x672e('0x25')](function(_0x2d7993){if(_0x2d7993){return _0x2d7993?{'count':_0x1ea305,'rows':_0x2d7993}:null;}})[_0x672e('0x25')](respondWithResult(_0x25fade,null))[_0x672e('0x44')](handleError(_0x25fade,null));};exports[_0x672e('0x5a')]=function(_0x288ee3,_0x106305,_0x52d5ed){var _0x1a7bc5={};var _0x106a65={};var _0x5aa980;var _0x3ca236;return db['Trigger'][_0x672e('0x59')]({'where':{'id':_0x288ee3[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x106305,null))[_0x672e('0x25')](function(_0x4f6863){if(_0x4f6863){_0x5aa980=_0x4f6863;_0x106a65[_0x672e('0x32')]=_[_0x672e('0x46')](db[_0x672e('0x57')][_0x672e('0x2e')]);_0x106a65[_0x672e('0x33')]=_['keys'](_0x288ee3[_0x672e('0x33')]);_0x106a65['filters']=_[_0x672e('0x35')](_0x106a65[_0x672e('0x32')],_0x106a65[_0x672e('0x33')]);_0x1a7bc5[_0x672e('0x36')]=_['intersection'](_0x106a65[_0x672e('0x32')],qs['fields'](_0x288ee3[_0x672e('0x33')][_0x672e('0x37')]));_0x1a7bc5[_0x672e('0x36')]=_0x1a7bc5[_0x672e('0x36')][_0x672e('0x47')]?_0x1a7bc5[_0x672e('0x36')]:_0x106a65[_0x672e('0x32')];_0x1a7bc5[_0x672e('0x3a')]=qs[_0x672e('0x3b')](_0x288ee3[_0x672e('0x33')][_0x672e('0x3b')]);_0x1a7bc5['where']=qs['filters'](_[_0x672e('0x3d')](_0x288ee3[_0x672e('0x33')],_0x106a65['filters']));if(_0x288ee3[_0x672e('0x33')][_0x672e('0x3e')]){_0x1a7bc5['where']=_[_0x672e('0x3f')](_0x1a7bc5['where'],{'$or':_[_0x672e('0x2d')](_0x1a7bc5[_0x672e('0x36')],function(_0x22e675){var _0x148bc1={};_0x148bc1[_0x22e675]={'$like':'%'+_0x288ee3[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0x148bc1;})});}_0x1a7bc5=_[_0x672e('0x3f')]({},_0x1a7bc5,_0x288ee3[_0x672e('0x4a')]);return _0x5aa980['getAnyConditions'](_0x1a7bc5);}})['then'](function(_0x2f494e){if(_0x2f494e){_0x3ca236=_0x2f494e[_0x672e('0x47')];if(!_0x288ee3['query'][_0x672e('0x38')](_0x672e('0x39'))){_0x1a7bc5['limit']=qs[_0x672e('0x1d')](_0x288ee3['query']['limit']);_0x1a7bc5['offset']=qs[_0x672e('0x1c')](_0x288ee3[_0x672e('0x33')][_0x672e('0x1c')]);}return _0x5aa980[_0x672e('0x5a')](_0x1a7bc5);}})[_0x672e('0x25')](function(_0x1767ad){if(_0x1767ad){return _0x1767ad?{'count':_0x3ca236,'rows':_0x1767ad}:null;}})[_0x672e('0x25')](respondWithResult(_0x106305,null))['catch'](handleError(_0x106305,null));};exports[_0x672e('0x5b')]=function(_0x3e88d0,_0x1c07a8,_0x49d200){if(_0x3e88d0[_0x672e('0x4d')]['id']){delete _0x3e88d0[_0x672e('0x4d')]['id'];}return db[_0x672e('0x41')][_0x672e('0x4b')]({'where':{'id':_0x3e88d0[_0x672e('0x45')]['id']}})[_0x672e('0x25')](handleEntityNotFound(_0x1c07a8,null))['then'](function(_0x2d6f24){if(_0x2d6f24){_0x3e88d0[_0x672e('0x4d')][_0x672e('0x5c')]=_0x2d6f24['id'];return db['Action'][_0x672e('0x4c')](_0x3e88d0[_0x672e('0x4d')]);}})[_0x672e('0x25')](respondWithResult(_0x1c07a8,null))[_0x672e('0x44')](handleError(_0x1c07a8,null));};exports[_0x672e('0x5d')]=function(_0x452224,_0x181b75,_0x362559){var _0x178ad3={};var _0x552167={};var _0x200368;var _0x294b14;return db[_0x672e('0x41')]['findOne']({'where':{'id':_0x452224[_0x672e('0x45')]['id']}})['then'](handleEntityNotFound(_0x181b75,null))[_0x672e('0x25')](function(_0x566b44){if(_0x566b44){_0x200368=_0x566b44;_0x552167['model']=_[_0x672e('0x46')](db[_0x672e('0x5e')]['rawAttributes']);_0x552167[_0x672e('0x33')]=_[_0x672e('0x46')](_0x452224['query']);_0x552167['filters']=_[_0x672e('0x35')](_0x552167[_0x672e('0x32')],_0x552167[_0x672e('0x33')]);_0x178ad3[_0x672e('0x36')]=_[_0x672e('0x35')](_0x552167[_0x672e('0x32')],qs[_0x672e('0x37')](_0x452224[_0x672e('0x33')]['fields']));_0x178ad3[_0x672e('0x36')]=_0x178ad3[_0x672e('0x36')][_0x672e('0x47')]?_0x178ad3[_0x672e('0x36')]:_0x552167[_0x672e('0x32')];_0x178ad3['order']=qs['sort'](_0x452224[_0x672e('0x33')][_0x672e('0x3b')]);_0x178ad3['where']=qs['filters'](_[_0x672e('0x3d')](_0x452224['query'],_0x552167[_0x672e('0x34')]));if(_0x452224['query'][_0x672e('0x3e')]){_0x178ad3[_0x672e('0x3c')]=_[_0x672e('0x3f')](_0x178ad3['where'],{'$or':_[_0x672e('0x2d')](_0x178ad3[_0x672e('0x36')],function(_0x11dae5){var _0xa6bd33={};_0xa6bd33[_0x11dae5]={'$like':'%'+_0x452224[_0x672e('0x33')][_0x672e('0x3e')]+'%'};return _0xa6bd33;})});}_0x178ad3=_[_0x672e('0x3f')]({},_0x178ad3,_0x452224[_0x672e('0x4a')]);return _0x200368[_0x672e('0x5d')](_0x178ad3);}})[_0x672e('0x25')](function(_0x5c9666){if(_0x5c9666){_0x294b14=_0x5c9666[_0x672e('0x47')];if(!_0x452224[_0x672e('0x33')][_0x672e('0x38')](_0x672e('0x39'))){_0x178ad3[_0x672e('0x1d')]=qs[_0x672e('0x1d')](_0x452224[_0x672e('0x33')]['limit']);_0x178ad3['offset']=qs[_0x672e('0x1c')](_0x452224[_0x672e('0x33')][_0x672e('0x1c')]);}return _0x200368[_0x672e('0x5d')](_0x178ad3);}})[_0x672e('0x25')](function(_0x1a0282){if(_0x1a0282){return _0x1a0282?{'count':_0x294b14,'rows':_0x1a0282}:null;}})[_0x672e('0x25')](respondWithResult(_0x181b75,null))[_0x672e('0x44')](handleError(_0x181b75,null));}; \ No newline at end of file +var _0x4ea6=['attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','catch','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','error','name','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x4ea6,0x146));var _0x64ea=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x4ea6[_0x396466];return _0x5e9ab4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64ea('0x0'));var zipdir=require(_0x64ea('0x1'));var jsonpatch=require(_0x64ea('0x2'));var rp=require(_0x64ea('0x3'));var moment=require(_0x64ea('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x64ea('0x5'));var sox=require(_0x64ea('0x6'));var csv=require(_0x64ea('0x7'));var ejs=require(_0x64ea('0x8'));var fs=require('fs');var fs_extra=require(_0x64ea('0x9'));var _=require('lodash');var squel=require(_0x64ea('0xa'));var crypto=require(_0x64ea('0xb'));var jsforce=require(_0x64ea('0xc'));var deskjs=require(_0x64ea('0xd'));var toCsv=require(_0x64ea('0x7'));var querystring=require(_0x64ea('0xe'));var Papa=require(_0x64ea('0xf'));var Redis=require(_0x64ea('0x10'));var authService=require(_0x64ea('0x11'));var qs=require(_0x64ea('0x12'));var as=require(_0x64ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64ea('0x14'))(_0x64ea('0x15'));var utils=require('../../config/utils');var config=require(_0x64ea('0x16'));var licenseUtil=require(_0x64ea('0x17'));var db=require(_0x64ea('0x18'))['db'];function respondWithStatusCode(_0x264f7b,_0x5bf0b4){_0x5bf0b4=_0x5bf0b4||0xcc;return function(_0x5658be){if(_0x5658be){return _0x264f7b[_0x64ea('0x19')](_0x5bf0b4);}return _0x264f7b[_0x64ea('0x1a')](_0x5bf0b4)[_0x64ea('0x1b')]();};}function respondWithResult(_0x369cc8,_0xe9799f){_0xe9799f=_0xe9799f||0xc8;return function(_0x48a279){if(_0x48a279){return _0x369cc8[_0x64ea('0x1a')](_0xe9799f)[_0x64ea('0x1c')](_0x48a279);}};}function respondWithFilteredResult(_0x26088e,_0xff5c32){return function(_0x52468c){if(_0x52468c){var _0x1d780e=typeof _0xff5c32[_0x64ea('0x1d')]==='undefined'&&typeof _0xff5c32[_0x64ea('0x1e')]===_0x64ea('0x1f');var _0x1ffc33=_0x52468c['count'];var _0x17f57e=_0x1d780e?0x0:_0xff5c32[_0x64ea('0x1d')];var _0x5a4215=_0x1d780e?_0x52468c['count']:_0xff5c32[_0x64ea('0x1d')]+_0xff5c32[_0x64ea('0x1e')];var _0x589997;if(_0x5a4215>=_0x1ffc33){_0x5a4215=_0x1ffc33;_0x589997=0xc8;}else{_0x589997=0xce;}_0x26088e['status'](_0x589997);return _0x26088e[_0x64ea('0x20')](_0x64ea('0x21'),_0x17f57e+'-'+_0x5a4215+'/'+_0x1ffc33)[_0x64ea('0x1c')](_0x52468c);}return null;};}function patchUpdates(_0x597a50){return function(_0x4b3611){try{jsonpatch[_0x64ea('0x22')](_0x4b3611,_0x597a50,!![]);}catch(_0x3e4a95){return BPromise[_0x64ea('0x23')](_0x3e4a95);}return _0x4b3611[_0x64ea('0x24')]();};}function saveUpdates(_0x5f3781,_0x4d4436){return function(_0x3841b2){if(_0x3841b2){return _0x3841b2['update'](_0x5f3781)[_0x64ea('0x25')](function(_0x45b8c3){return _0x45b8c3;});}return null;};}function removeEntity(_0x5f3520,_0x3c41db){return function(_0x17905b){if(_0x17905b){return _0x17905b[_0x64ea('0x26')]()[_0x64ea('0x25')](function(){var _0x44bea7=_0x17905b[_0x64ea('0x27')]({'plain':!![]});var _0x65a8c5=_0x64ea('0x28');return db['UserProfileResource'][_0x64ea('0x26')]({'where':{'type':_0x65a8c5,'resourceId':_0x44bea7['id']}})[_0x64ea('0x25')](function(){return _0x17905b;});})[_0x64ea('0x25')](function(){_0x5f3520[_0x64ea('0x1a')](0xcc)[_0x64ea('0x1b')]();});}};}function handleEntityNotFound(_0x3a9723,_0x44f12b){return function(_0x596fd2){if(!_0x596fd2){_0x3a9723[_0x64ea('0x19')](0x194);}return _0x596fd2;};}function handleError(_0x44c00d,_0x3cf5c4){_0x3cf5c4=_0x3cf5c4||0x1f4;return function(_0x2d4e69){logger[_0x64ea('0x29')](_0x2d4e69['stack']);if(_0x2d4e69[_0x64ea('0x2a')]){delete _0x2d4e69[_0x64ea('0x2a')];}_0x44c00d[_0x64ea('0x1a')](_0x3cf5c4)['send'](_0x2d4e69);};}exports['index']=function(_0xdafc1e,_0xdd5866){var _0x5bae26={},_0xc0b77f={},_0x20a1f6={'count':0x0,'rows':[]};var _0x38b840=_[_0x64ea('0x2b')](db[_0x64ea('0x2c')][_0x64ea('0x2d')],function(_0x5e2dc){return{'name':_0x5e2dc[_0x64ea('0x2e')],'type':_0x5e2dc[_0x64ea('0x2f')][_0x64ea('0x30')]};});_0xc0b77f[_0x64ea('0x31')]=_[_0x64ea('0x2b')](_0x38b840,_0x64ea('0x2a'));_0xc0b77f[_0x64ea('0x32')]=_[_0x64ea('0x33')](_0xdafc1e[_0x64ea('0x32')]);_0xc0b77f['filters']=_[_0x64ea('0x34')](_0xc0b77f[_0x64ea('0x31')],_0xc0b77f[_0x64ea('0x32')]);_0x5bae26['attributes']=_[_0x64ea('0x34')](_0xc0b77f[_0x64ea('0x31')],qs[_0x64ea('0x35')](_0xdafc1e[_0x64ea('0x32')][_0x64ea('0x35')]));_0x5bae26[_0x64ea('0x36')]=_0x5bae26[_0x64ea('0x36')][_0x64ea('0x37')]?_0x5bae26['attributes']:_0xc0b77f[_0x64ea('0x31')];if(!_0xdafc1e[_0x64ea('0x32')][_0x64ea('0x38')](_0x64ea('0x39'))){_0x5bae26[_0x64ea('0x1e')]=qs[_0x64ea('0x1e')](_0xdafc1e['query'][_0x64ea('0x1e')]);_0x5bae26[_0x64ea('0x1d')]=qs[_0x64ea('0x1d')](_0xdafc1e['query'][_0x64ea('0x1d')]);}_0x5bae26[_0x64ea('0x3a')]=qs[_0x64ea('0x3b')](_0xdafc1e[_0x64ea('0x32')][_0x64ea('0x3b')]);_0x5bae26[_0x64ea('0x3c')]=qs[_0x64ea('0x3d')](_['pick'](_0xdafc1e[_0x64ea('0x32')],_0xc0b77f[_0x64ea('0x3d')]),_0x38b840);if(_0xdafc1e[_0x64ea('0x32')]['filter']){_0x5bae26[_0x64ea('0x3c')]=_['merge'](_0x5bae26[_0x64ea('0x3c')],{'$or':_[_0x64ea('0x2b')](_0x38b840,function(_0x1d705a){if(_0x1d705a[_0x64ea('0x2f')]!==_0x64ea('0x3e')){var _0x7e6abe={};_0x7e6abe[_0x1d705a[_0x64ea('0x2a')]]={'$like':'%'+_0xdafc1e[_0x64ea('0x32')][_0x64ea('0x3f')]+'%'};return _0x7e6abe;}})});}_0x5bae26=_[_0x64ea('0x40')]({},_0x5bae26,_0xdafc1e[_0x64ea('0x41')]);var _0x316421={'where':_0x5bae26[_0x64ea('0x3c')]};return db[_0x64ea('0x2c')][_0x64ea('0x42')](_0x316421)[_0x64ea('0x25')](function(_0x380b71){_0x20a1f6['count']=_0x380b71;if(_0xdafc1e[_0x64ea('0x32')][_0x64ea('0x43')]){_0x5bae26['include']=[{'all':!![]}];}return db[_0x64ea('0x2c')][_0x64ea('0x44')](_0x5bae26);})[_0x64ea('0x25')](function(_0xda4c43){_0x20a1f6[_0x64ea('0x45')]=_0xda4c43;return _0x20a1f6;})['then'](respondWithFilteredResult(_0xdd5866,_0x5bae26))[_0x64ea('0x46')](handleError(_0xdd5866,null));};exports['show']=function(_0x529a33,_0x2ddefc){var _0x44ad67={'raw':![],'where':{'id':_0x529a33['params']['id']}},_0x45fc66={};_0x45fc66['model']=_[_0x64ea('0x33')](db[_0x64ea('0x2c')][_0x64ea('0x2d')]);_0x45fc66['query']=_[_0x64ea('0x33')](_0x529a33['query']);_0x45fc66[_0x64ea('0x3d')]=_[_0x64ea('0x34')](_0x45fc66['model'],_0x45fc66[_0x64ea('0x32')]);_0x44ad67[_0x64ea('0x36')]=_[_0x64ea('0x34')](_0x45fc66[_0x64ea('0x31')],qs['fields'](_0x529a33[_0x64ea('0x32')][_0x64ea('0x35')]));_0x44ad67[_0x64ea('0x36')]=_0x44ad67[_0x64ea('0x36')][_0x64ea('0x37')]?_0x44ad67['attributes']:_0x45fc66[_0x64ea('0x31')];if(_0x529a33[_0x64ea('0x32')][_0x64ea('0x43')]){_0x44ad67[_0x64ea('0x47')]=[{'all':!![]}];}_0x44ad67=_[_0x64ea('0x40')]({},_0x44ad67,_0x529a33[_0x64ea('0x41')]);return db[_0x64ea('0x2c')]['find'](_0x44ad67)[_0x64ea('0x25')](handleEntityNotFound(_0x2ddefc,null))[_0x64ea('0x25')](respondWithResult(_0x2ddefc,null))[_0x64ea('0x46')](handleError(_0x2ddefc,null));};exports['create']=function(_0x22efa7,_0x1c108c){return db['Trigger'][_0x64ea('0x48')](_0x22efa7[_0x64ea('0x49')],{})[_0x64ea('0x25')](function(_0x2281aa){var _0x5d2492=_0x22efa7[_0x64ea('0x4a')][_0x64ea('0x27')]({'plain':!![]});if(!_0x5d2492)throw new Error(_0x64ea('0x4b'));if(_0x5d2492[_0x64ea('0x4c')]===_0x64ea('0x4a')){var _0x21015c=_0x2281aa['get']({'plain':!![]});var _0x4fced6=_0x64ea('0x28');return db[_0x64ea('0x4d')][_0x64ea('0x4e')]({'where':{'name':_0x4fced6,'userProfileId':_0x5d2492[_0x64ea('0x4f')]},'raw':!![]})[_0x64ea('0x25')](function(_0x336942){if(_0x336942&&_0x336942[_0x64ea('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x21015c[_0x64ea('0x2a')],'resourceId':_0x21015c['id'],'type':_0x336942['name'],'sectionId':_0x336942['id']},{})[_0x64ea('0x25')](function(){return _0x2281aa;});}else{return _0x2281aa;}})[_0x64ea('0x46')](function(_0x41f72c){logger[_0x64ea('0x29')](_0x64ea('0x51'),_0x41f72c);throw _0x41f72c;});}return _0x2281aa;})[_0x64ea('0x25')](respondWithResult(_0x1c108c,0xc9))[_0x64ea('0x46')](handleError(_0x1c108c,null));};exports['update']=function(_0x445d79,_0x3c07cb){if(_0x445d79[_0x64ea('0x49')]['id']){delete _0x445d79[_0x64ea('0x49')]['id'];}return db['Trigger'][_0x64ea('0x4e')]({'where':{'id':_0x445d79[_0x64ea('0x52')]['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x3c07cb,null))['then'](saveUpdates(_0x445d79['body'],null))[_0x64ea('0x25')](respondWithResult(_0x3c07cb,null))[_0x64ea('0x46')](handleError(_0x3c07cb,null));};exports[_0x64ea('0x26')]=function(_0x4516dc,_0x18d2ca){return db[_0x64ea('0x2c')]['find']({'where':{'id':_0x4516dc[_0x64ea('0x52')]['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x18d2ca,null))[_0x64ea('0x25')](removeEntity(_0x18d2ca,null))[_0x64ea('0x46')](handleError(_0x18d2ca,null));};exports[_0x64ea('0x53')]=function(_0xeaf065,_0x343203,_0x27c937){if(_0xeaf065['body']['id']){delete _0xeaf065['body']['id'];}return db['Trigger'][_0x64ea('0x4e')]({'where':{'id':_0xeaf065[_0x64ea('0x52')]['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x343203,null))[_0x64ea('0x25')](function(_0x4bd778){if(_0x4bd778){_0xeaf065[_0x64ea('0x49')][_0x64ea('0x54')]=_0x4bd778['id'];return db['Condition'][_0x64ea('0x48')](_0xeaf065[_0x64ea('0x49')]);}})[_0x64ea('0x25')](respondWithResult(_0x343203,null))['catch'](handleError(_0x343203,null));};exports[_0x64ea('0x55')]=function(_0x4dbf2a,_0x92ba12,_0x426c48){if(_0x4dbf2a[_0x64ea('0x49')]['id']){delete _0x4dbf2a['body']['id'];}return db[_0x64ea('0x2c')][_0x64ea('0x4e')]({'where':{'id':_0x4dbf2a['params']['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x92ba12,null))[_0x64ea('0x25')](function(_0xa8860f){if(_0xa8860f){_0x4dbf2a[_0x64ea('0x49')][_0x64ea('0x56')]=_0xa8860f['id'];return db[_0x64ea('0x57')]['create'](_0x4dbf2a[_0x64ea('0x49')]);}})[_0x64ea('0x25')](respondWithResult(_0x92ba12,null))[_0x64ea('0x46')](handleError(_0x92ba12,null));};exports[_0x64ea('0x58')]=function(_0x1ca08e,_0x3ffcb3,_0x2c9811){var _0x37a768={};var _0x4d0996={};var _0x518f9c;var _0x19ccc9;return db['Trigger']['findOne']({'where':{'id':_0x1ca08e[_0x64ea('0x52')]['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x3ffcb3,null))[_0x64ea('0x25')](function(_0xd8fc8c){if(_0xd8fc8c){_0x518f9c=_0xd8fc8c;_0x4d0996[_0x64ea('0x31')]=_[_0x64ea('0x33')](db[_0x64ea('0x57')][_0x64ea('0x2d')]);_0x4d0996[_0x64ea('0x32')]=_[_0x64ea('0x33')](_0x1ca08e[_0x64ea('0x32')]);_0x4d0996[_0x64ea('0x3d')]=_[_0x64ea('0x34')](_0x4d0996[_0x64ea('0x31')],_0x4d0996[_0x64ea('0x32')]);_0x37a768[_0x64ea('0x36')]=_[_0x64ea('0x34')](_0x4d0996[_0x64ea('0x31')],qs[_0x64ea('0x35')](_0x1ca08e[_0x64ea('0x32')][_0x64ea('0x35')]));_0x37a768[_0x64ea('0x36')]=_0x37a768['attributes'][_0x64ea('0x37')]?_0x37a768['attributes']:_0x4d0996[_0x64ea('0x31')];_0x37a768[_0x64ea('0x3a')]=qs['sort'](_0x1ca08e[_0x64ea('0x32')]['sort']);_0x37a768['where']=qs[_0x64ea('0x3d')](_['pick'](_0x1ca08e['query'],_0x4d0996[_0x64ea('0x3d')]));if(_0x1ca08e['query'][_0x64ea('0x3f')]){_0x37a768[_0x64ea('0x3c')]=_[_0x64ea('0x40')](_0x37a768['where'],{'$or':_[_0x64ea('0x2b')](_0x37a768['attributes'],function(_0x201369){var _0x436558={};_0x436558[_0x201369]={'$like':'%'+_0x1ca08e[_0x64ea('0x32')][_0x64ea('0x3f')]+'%'};return _0x436558;})});}_0x37a768=_[_0x64ea('0x40')]({},_0x37a768,_0x1ca08e['options']);return _0x518f9c[_0x64ea('0x58')](_0x37a768);}})[_0x64ea('0x25')](function(_0x82adac){if(_0x82adac){_0x19ccc9=_0x82adac[_0x64ea('0x37')];if(!_0x1ca08e['query']['hasOwnProperty']('nolimit')){_0x37a768[_0x64ea('0x1e')]=qs[_0x64ea('0x1e')](_0x1ca08e[_0x64ea('0x32')][_0x64ea('0x1e')]);_0x37a768[_0x64ea('0x1d')]=qs[_0x64ea('0x1d')](_0x1ca08e['query'][_0x64ea('0x1d')]);}return _0x518f9c[_0x64ea('0x58')](_0x37a768);}})[_0x64ea('0x25')](function(_0x597bc0){if(_0x597bc0){return _0x597bc0?{'count':_0x19ccc9,'rows':_0x597bc0}:null;}})[_0x64ea('0x25')](respondWithResult(_0x3ffcb3,null))['catch'](handleError(_0x3ffcb3,null));};exports['getAnyConditions']=function(_0x363310,_0x3a23f6,_0xf927e8){var _0x1abfae={};var _0x409620={};var _0x503efc;var _0x3c68d6;return db[_0x64ea('0x2c')][_0x64ea('0x59')]({'where':{'id':_0x363310[_0x64ea('0x52')]['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x3a23f6,null))[_0x64ea('0x25')](function(_0x448716){if(_0x448716){_0x503efc=_0x448716;_0x409620[_0x64ea('0x31')]=_[_0x64ea('0x33')](db[_0x64ea('0x57')][_0x64ea('0x2d')]);_0x409620[_0x64ea('0x32')]=_['keys'](_0x363310[_0x64ea('0x32')]);_0x409620[_0x64ea('0x3d')]=_['intersection'](_0x409620[_0x64ea('0x31')],_0x409620[_0x64ea('0x32')]);_0x1abfae['attributes']=_['intersection'](_0x409620[_0x64ea('0x31')],qs[_0x64ea('0x35')](_0x363310[_0x64ea('0x32')][_0x64ea('0x35')]));_0x1abfae[_0x64ea('0x36')]=_0x1abfae[_0x64ea('0x36')][_0x64ea('0x37')]?_0x1abfae[_0x64ea('0x36')]:_0x409620[_0x64ea('0x31')];_0x1abfae[_0x64ea('0x3a')]=qs[_0x64ea('0x3b')](_0x363310['query'][_0x64ea('0x3b')]);_0x1abfae['where']=qs['filters'](_['pick'](_0x363310[_0x64ea('0x32')],_0x409620[_0x64ea('0x3d')]));if(_0x363310['query']['filter']){_0x1abfae[_0x64ea('0x3c')]=_['merge'](_0x1abfae[_0x64ea('0x3c')],{'$or':_[_0x64ea('0x2b')](_0x1abfae[_0x64ea('0x36')],function(_0x218486){var _0x282649={};_0x282649[_0x218486]={'$like':'%'+_0x363310[_0x64ea('0x32')][_0x64ea('0x3f')]+'%'};return _0x282649;})});}_0x1abfae=_[_0x64ea('0x40')]({},_0x1abfae,_0x363310['options']);return _0x503efc['getAnyConditions'](_0x1abfae);}})[_0x64ea('0x25')](function(_0x427b40){if(_0x427b40){_0x3c68d6=_0x427b40[_0x64ea('0x37')];if(!_0x363310[_0x64ea('0x32')][_0x64ea('0x38')](_0x64ea('0x39'))){_0x1abfae[_0x64ea('0x1e')]=qs[_0x64ea('0x1e')](_0x363310[_0x64ea('0x32')]['limit']);_0x1abfae[_0x64ea('0x1d')]=qs['offset'](_0x363310[_0x64ea('0x32')]['offset']);}return _0x503efc[_0x64ea('0x5a')](_0x1abfae);}})[_0x64ea('0x25')](function(_0x31d7b3){if(_0x31d7b3){return _0x31d7b3?{'count':_0x3c68d6,'rows':_0x31d7b3}:null;}})[_0x64ea('0x25')](respondWithResult(_0x3a23f6,null))[_0x64ea('0x46')](handleError(_0x3a23f6,null));};exports['addAction']=function(_0x2b09d7,_0x8c8d92,_0x1f125f){if(_0x2b09d7[_0x64ea('0x49')]['id']){delete _0x2b09d7[_0x64ea('0x49')]['id'];}return db[_0x64ea('0x2c')][_0x64ea('0x4e')]({'where':{'id':_0x2b09d7[_0x64ea('0x52')]['id']}})[_0x64ea('0x25')](handleEntityNotFound(_0x8c8d92,null))[_0x64ea('0x25')](function(_0x7bedb9){if(_0x7bedb9){_0x2b09d7['body'][_0x64ea('0x5b')]=_0x7bedb9['id'];return db[_0x64ea('0x5c')]['create'](_0x2b09d7[_0x64ea('0x49')]);}})[_0x64ea('0x25')](respondWithResult(_0x8c8d92,null))[_0x64ea('0x46')](handleError(_0x8c8d92,null));};exports[_0x64ea('0x5d')]=function(_0x8219d9,_0x24aada,_0x4af20c){var _0x1f0e21={};var _0x5a4b54={};var _0xcfc0b6;var _0xbac262;return db[_0x64ea('0x2c')][_0x64ea('0x59')]({'where':{'id':_0x8219d9['params']['id']}})['then'](handleEntityNotFound(_0x24aada,null))[_0x64ea('0x25')](function(_0x3ce7c2){if(_0x3ce7c2){_0xcfc0b6=_0x3ce7c2;_0x5a4b54[_0x64ea('0x31')]=_[_0x64ea('0x33')](db[_0x64ea('0x5c')][_0x64ea('0x2d')]);_0x5a4b54[_0x64ea('0x32')]=_[_0x64ea('0x33')](_0x8219d9['query']);_0x5a4b54[_0x64ea('0x3d')]=_['intersection'](_0x5a4b54[_0x64ea('0x31')],_0x5a4b54[_0x64ea('0x32')]);_0x1f0e21[_0x64ea('0x36')]=_[_0x64ea('0x34')](_0x5a4b54['model'],qs[_0x64ea('0x35')](_0x8219d9[_0x64ea('0x32')][_0x64ea('0x35')]));_0x1f0e21[_0x64ea('0x36')]=_0x1f0e21[_0x64ea('0x36')][_0x64ea('0x37')]?_0x1f0e21[_0x64ea('0x36')]:_0x5a4b54[_0x64ea('0x31')];_0x1f0e21['order']=qs['sort'](_0x8219d9[_0x64ea('0x32')][_0x64ea('0x3b')]);_0x1f0e21['where']=qs[_0x64ea('0x3d')](_[_0x64ea('0x5e')](_0x8219d9['query'],_0x5a4b54[_0x64ea('0x3d')]));if(_0x8219d9[_0x64ea('0x32')][_0x64ea('0x3f')]){_0x1f0e21['where']=_[_0x64ea('0x40')](_0x1f0e21[_0x64ea('0x3c')],{'$or':_['map'](_0x1f0e21[_0x64ea('0x36')],function(_0x5a5441){var _0x32712b={};_0x32712b[_0x5a5441]={'$like':'%'+_0x8219d9[_0x64ea('0x32')][_0x64ea('0x3f')]+'%'};return _0x32712b;})});}_0x1f0e21=_['merge']({},_0x1f0e21,_0x8219d9[_0x64ea('0x41')]);return _0xcfc0b6[_0x64ea('0x5d')](_0x1f0e21);}})[_0x64ea('0x25')](function(_0x58505f){if(_0x58505f){_0xbac262=_0x58505f['length'];if(!_0x8219d9[_0x64ea('0x32')][_0x64ea('0x38')](_0x64ea('0x39'))){_0x1f0e21[_0x64ea('0x1e')]=qs[_0x64ea('0x1e')](_0x8219d9['query'][_0x64ea('0x1e')]);_0x1f0e21[_0x64ea('0x1d')]=qs[_0x64ea('0x1d')](_0x8219d9['query'][_0x64ea('0x1d')]);}return _0xcfc0b6[_0x64ea('0x5d')](_0x1f0e21);}})[_0x64ea('0x25')](function(_0x5495e1){if(_0x5495e1){return _0x5495e1?{'count':_0xbac262,'rows':_0x5495e1}:null;}})[_0x64ea('0x25')](respondWithResult(_0x24aada,null))[_0x64ea('0x46')](handleError(_0x24aada,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d3785dd..7e493a2 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 _0xfd0f=['bluebird','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment'];(function(_0x1f3280,_0xec6845){var _0x50770f=function(_0x3edb5b){while(--_0x3edb5b){_0x1f3280['push'](_0x1f3280['shift']());}};_0x50770f(++_0xec6845);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x25c0ea,_0x15986d){_0x25c0ea=_0x25c0ea-0x0;var _0xb4e5bd=_0xfd0f[_0x25c0ea];return _0xb4e5bd;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var logger=require('../../config/logger')(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var BPromise=require(_0xffd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd0('0x5'));var rimraf=require('rimraf');var config=require(_0xffd0('0x6'));var attributes=require(_0xffd0('0x7'));module[_0xffd0('0x8')]=function(_0x9e9c1f,_0xd7f075){return _0x9e9c1f[_0xffd0('0x9')](_0xffd0('0xa'),attributes,{'tableName':_0xffd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc01b=['Trigger','tools_triggers','lodash','util','../../config/logger','api','bluebird','request-promise','./trigger.attributes','exports','define'];(function(_0x2f5ea7,_0x3eb157){var _0xb24286=function(_0x16c2bb){while(--_0x16c2bb){_0x2f5ea7['push'](_0x2f5ea7['shift']());}};_0xb24286(++_0x3eb157);}(_0xc01b,0x65));var _0xbc01=function(_0x4451b0,_0x205311){_0x4451b0=_0x4451b0-0x0;var _0xe828b1=_0xc01b[_0x4451b0];return _0xe828b1;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var logger=require(_0xbc01('0x2'))(_0xbc01('0x3'));var moment=require('moment');var BPromise=require(_0xbc01('0x4'));var rp=require(_0xbc01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc01('0x6'));module[_0xbc01('0x7')]=function(_0x53b2e6,_0x525a49){return _0x53b2e6[_0xbc01('0x8')](_0xbc01('0x9'),attributes,{'tableName':_0xbc01('0xa'),'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 ef1dd84..4dd6cde 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 _0xf739=['include','model','map','ShowTrigger','Trigger','raw','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','options','where','attributes','limit'];(function(_0x4f9d94,_0x392b6d){var _0x1757bd=function(_0x4c1d5c){while(--_0x4c1d5c){_0x4f9d94['push'](_0x4f9d94['shift']());}};_0x1757bd(++_0x392b6d);}(_0xf739,0x147));var _0x9f73=function(_0x214547,_0x5041f1){_0x214547=_0x214547-0x0;var _0x59405a=_0xf739[_0x214547];return _0x59405a;};'use strict';var _=require(_0x9f73('0x0'));var util=require('util');var moment=require(_0x9f73('0x1'));var BPromise=require(_0x9f73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f73('0x3'))['db'];var utils=require(_0x9f73('0x4'));var logger=require(_0x9f73('0x5'))(_0x9f73('0x6'));var config=require(_0x9f73('0x7'));var jayson=require(_0x9f73('0x8'));var client=jayson[_0x9f73('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eb8af,_0x2a373e,_0x4bcceb){return new BPromise(function(_0x3adc12,_0x4acb83){return client[_0x9f73('0xa')](_0x2eb8af,_0x4bcceb)[_0x9f73('0xb')](function(_0x5997a7){logger[_0x9f73('0xc')]('Trigger,\x20%s,\x20%s',_0x2a373e,_0x9f73('0xd'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x2a373e,_0x9f73('0xd'),JSON[_0x9f73('0xe')](_0x5997a7));if(_0x5997a7[_0x9f73('0xf')]){if(_0x5997a7[_0x9f73('0xf')][_0x9f73('0x10')]===0x1f4){logger[_0x9f73('0xf')](_0x9f73('0x11'),_0x2a373e,_0x5997a7[_0x9f73('0xf')][_0x9f73('0x12')]);return _0x4acb83(_0x5997a7['error'][_0x9f73('0x12')]);}logger['error'](_0x9f73('0x11'),_0x2a373e,_0x5997a7[_0x9f73('0xf')][_0x9f73('0x12')]);return _0x3adc12(_0x5997a7[_0x9f73('0xf')][_0x9f73('0x12')]);}else{logger[_0x9f73('0xc')]('Trigger,\x20%s,\x20%s',_0x2a373e,_0x9f73('0xd'));_0x3adc12(_0x5997a7['result'][_0x9f73('0x12')]);}})[_0x9f73('0x13')](function(_0x41d43b){logger['error'](_0x9f73('0x11'),_0x2a373e,_0x41d43b);_0x4acb83(_0x41d43b);});});}exports[_0x9f73('0x14')]=function(_0x5a967d){var _0x2323f3=this;return new Promise(function(_0x3aace8,_0x211ab6){return db['Trigger']['findAll']({'raw':_0x5a967d[_0x9f73('0x15')]?_0x5a967d[_0x9f73('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a967d['options']?_0x5a967d[_0x9f73('0x15')][_0x9f73('0x16')]||null:null,'attributes':_0x5a967d[_0x9f73('0x15')]?_0x5a967d['options'][_0x9f73('0x17')]||null:null,'limit':_0x5a967d[_0x9f73('0x15')]?_0x5a967d[_0x9f73('0x15')][_0x9f73('0x18')]||null:null,'include':_0x5a967d[_0x9f73('0x15')]?_0x5a967d[_0x9f73('0x15')][_0x9f73('0x19')]?_['map'](_0x5a967d[_0x9f73('0x15')][_0x9f73('0x19')],function(_0x1bd2c4){return{'model':db[_0x1bd2c4[_0x9f73('0x1a')]],'as':_0x1bd2c4['as'],'attributes':_0x1bd2c4[_0x9f73('0x17')],'include':_0x1bd2c4['include']?_['map'](_0x1bd2c4[_0x9f73('0x19')],function(_0x513c2d){return{'model':db[_0x513c2d['model']],'as':_0x513c2d['as'],'attributes':_0x513c2d['attributes'],'include':_0x513c2d[_0x9f73('0x19')]?_[_0x9f73('0x1b')](_0x513c2d[_0x9f73('0x19')],function(_0x5e4466){return{'model':db[_0x5e4466['model']],'as':_0x5e4466['as'],'attributes':_0x5e4466[_0x9f73('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9f73('0xb')](function(_0x1052f6){logger[_0x9f73('0xc')](_0x9f73('0x14'),_0x5a967d);logger['debug']('GetTrigger',_0x5a967d,JSON[_0x9f73('0xe')](_0x1052f6));_0x3aace8(_0x1052f6);})[_0x9f73('0x13')](function(_0x34b6a8){logger[_0x9f73('0xf')](_0x9f73('0x14'),_0x34b6a8[_0x9f73('0x12')],_0x5a967d);_0x211ab6(_0x2323f3[_0x9f73('0xf')](0x1f4,_0x34b6a8[_0x9f73('0x12')]));});});};exports[_0x9f73('0x1c')]=function(_0x471ea6){var _0x366515=this;return new Promise(function(_0x5f36ae,_0x16594a){return db[_0x9f73('0x1d')]['find']({'raw':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')][_0x9f73('0x1e')]===undefined?!![]:![]:!![],'where':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')]['where']||null:null,'attributes':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')]['attributes']||null:null,'include':_0x471ea6[_0x9f73('0x15')]?_0x471ea6[_0x9f73('0x15')][_0x9f73('0x19')]?_['map'](_0x471ea6['options'][_0x9f73('0x19')],function(_0x1450e2){return{'model':db[_0x1450e2['model']],'as':_0x1450e2['as'],'attributes':_0x1450e2[_0x9f73('0x17')],'include':_0x1450e2[_0x9f73('0x19')]?_[_0x9f73('0x1b')](_0x1450e2[_0x9f73('0x19')],function(_0x2b7b13){return{'model':db[_0x2b7b13[_0x9f73('0x1a')]],'as':_0x2b7b13['as'],'attributes':_0x2b7b13[_0x9f73('0x17')],'include':_0x2b7b13[_0x9f73('0x19')]?_[_0x9f73('0x1b')](_0x2b7b13[_0x9f73('0x19')],function(_0x5c3047){return{'model':db[_0x5c3047[_0x9f73('0x1a')]],'as':_0x5c3047['as'],'attributes':_0x5c3047[_0x9f73('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37bb18){logger[_0x9f73('0xc')](_0x9f73('0x1c'),_0x471ea6);logger[_0x9f73('0x1f')](_0x9f73('0x1c'),_0x471ea6,JSON[_0x9f73('0xe')](_0x37bb18));_0x5f36ae(_0x37bb18);})['catch'](function(_0x483654){logger[_0x9f73('0xf')]('ShowTrigger',_0x483654[_0x9f73('0x12')],_0x471ea6);_0x16594a(_0x366515[_0x9f73('0xf')](0x1f4,_0x483654['message']));});});}; \ No newline at end of file +var _0x03cb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','util','moment','randomstring','ioredis'];(function(_0x5ecac1,_0x2d7338){var _0x1fe487=function(_0x94c196){while(--_0x94c196){_0x5ecac1['push'](_0x5ecac1['shift']());}};_0x1fe487(++_0x2d7338);}(_0x03cb,0x1eb));var _0xb03c=function(_0x35ba87,_0xc7d66a){_0x35ba87=_0x35ba87-0x0;var _0x336d59=_0x03cb[_0x35ba87];return _0x336d59;};'use strict';var _=require('lodash');var util=require(_0xb03c('0x0'));var moment=require(_0xb03c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb03c('0x2'));var fs=require('fs');var Redis=require(_0xb03c('0x3'));var db=require(_0xb03c('0x4'))['db'];var utils=require(_0xb03c('0x5'));var logger=require(_0xb03c('0x6'))(_0xb03c('0x7'));var config=require(_0xb03c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb03c('0x9')][_0xb03c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c8a21,_0x4fa6ee,_0x44367b){return new BPromise(function(_0x129793,_0x43bcaf){return client['request'](_0x2c8a21,_0x44367b)[_0xb03c('0xb')](function(_0x536b07){logger[_0xb03c('0xc')](_0xb03c('0xd'),_0x4fa6ee,'request\x20sent');logger[_0xb03c('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4fa6ee,_0xb03c('0xf'),JSON['stringify'](_0x536b07));if(_0x536b07[_0xb03c('0x10')]){if(_0x536b07[_0xb03c('0x10')]['code']===0x1f4){logger[_0xb03c('0x10')](_0xb03c('0xd'),_0x4fa6ee,_0x536b07[_0xb03c('0x10')][_0xb03c('0x11')]);return _0x43bcaf(_0x536b07[_0xb03c('0x10')][_0xb03c('0x11')]);}logger[_0xb03c('0x10')](_0xb03c('0xd'),_0x4fa6ee,_0x536b07['error'][_0xb03c('0x11')]);return _0x129793(_0x536b07['error'][_0xb03c('0x11')]);}else{logger['info'](_0xb03c('0xd'),_0x4fa6ee,_0xb03c('0xf'));_0x129793(_0x536b07[_0xb03c('0x12')][_0xb03c('0x11')]);}})[_0xb03c('0x13')](function(_0xbe19ec){logger[_0xb03c('0x10')](_0xb03c('0xd'),_0x4fa6ee,_0xbe19ec);_0x43bcaf(_0xbe19ec);});});}exports[_0xb03c('0x14')]=function(_0x12246d){var _0x56eafe=this;return new Promise(function(_0x556014,_0x368eab){return db[_0xb03c('0x15')][_0xb03c('0x16')]({'raw':_0x12246d[_0xb03c('0x17')]?_0x12246d[_0xb03c('0x17')][_0xb03c('0x18')]===undefined?!![]:![]:!![],'where':_0x12246d['options']?_0x12246d['options'][_0xb03c('0x19')]||null:null,'attributes':_0x12246d[_0xb03c('0x17')]?_0x12246d[_0xb03c('0x17')][_0xb03c('0x1a')]||null:null,'limit':_0x12246d[_0xb03c('0x17')]?_0x12246d[_0xb03c('0x17')][_0xb03c('0x1b')]||null:null,'include':_0x12246d['options']?_0x12246d['options']['include']?_['map'](_0x12246d[_0xb03c('0x17')]['include'],function(_0x5f5337){return{'model':db[_0x5f5337['model']],'as':_0x5f5337['as'],'attributes':_0x5f5337[_0xb03c('0x1a')],'include':_0x5f5337[_0xb03c('0x1c')]?_[_0xb03c('0x1d')](_0x5f5337['include'],function(_0x3f3ee8){return{'model':db[_0x3f3ee8[_0xb03c('0x1e')]],'as':_0x3f3ee8['as'],'attributes':_0x3f3ee8[_0xb03c('0x1a')],'include':_0x3f3ee8[_0xb03c('0x1c')]?_[_0xb03c('0x1d')](_0x3f3ee8[_0xb03c('0x1c')],function(_0x55f80f){return{'model':db[_0x55f80f[_0xb03c('0x1e')]],'as':_0x55f80f['as'],'attributes':_0x55f80f[_0xb03c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb03c('0xb')](function(_0x10180a){logger[_0xb03c('0xc')](_0xb03c('0x14'),_0x12246d);logger[_0xb03c('0xe')](_0xb03c('0x14'),_0x12246d,JSON['stringify'](_0x10180a));_0x556014(_0x10180a);})[_0xb03c('0x13')](function(_0x4dd6a1){logger['error']('GetTrigger',_0x4dd6a1[_0xb03c('0x11')],_0x12246d);_0x368eab(_0x56eafe[_0xb03c('0x10')](0x1f4,_0x4dd6a1['message']));});});};exports[_0xb03c('0x1f')]=function(_0xd7535c){var _0x16b139=this;return new Promise(function(_0x46ebb0,_0x19e186){return db[_0xb03c('0x15')][_0xb03c('0x20')]({'raw':_0xd7535c[_0xb03c('0x17')]?_0xd7535c[_0xb03c('0x17')][_0xb03c('0x18')]===undefined?!![]:![]:!![],'where':_0xd7535c[_0xb03c('0x17')]?_0xd7535c[_0xb03c('0x17')][_0xb03c('0x19')]||null:null,'attributes':_0xd7535c[_0xb03c('0x17')]?_0xd7535c[_0xb03c('0x17')]['attributes']||null:null,'include':_0xd7535c[_0xb03c('0x17')]?_0xd7535c[_0xb03c('0x17')]['include']?_[_0xb03c('0x1d')](_0xd7535c[_0xb03c('0x17')][_0xb03c('0x1c')],function(_0x2aaad3){return{'model':db[_0x2aaad3['model']],'as':_0x2aaad3['as'],'attributes':_0x2aaad3[_0xb03c('0x1a')],'include':_0x2aaad3[_0xb03c('0x1c')]?_[_0xb03c('0x1d')](_0x2aaad3[_0xb03c('0x1c')],function(_0xaaaab5){return{'model':db[_0xaaaab5[_0xb03c('0x1e')]],'as':_0xaaaab5['as'],'attributes':_0xaaaab5[_0xb03c('0x1a')],'include':_0xaaaab5['include']?_['map'](_0xaaaab5['include'],function(_0x1c49bb){return{'model':db[_0x1c49bb[_0xb03c('0x1e')]],'as':_0x1c49bb['as'],'attributes':_0x1c49bb[_0xb03c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45d68d){logger['info'](_0xb03c('0x1f'),_0xd7535c);logger[_0xb03c('0xe')](_0xb03c('0x1f'),_0xd7535c,JSON['stringify'](_0x45d68d));_0x46ebb0(_0x45d68d);})[_0xb03c('0x13')](function(_0x5c466c){logger[_0xb03c('0x10')](_0xb03c('0x1f'),_0x5c466c[_0xb03c('0x11')],_0xd7535c);_0x19e186(_0x16b139[_0xb03c('0x10')](0x1f4,_0x5c466c['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index bf3bdd8..938f78f 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 _0xf664=['post','/:id/clone','clone','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf664,0x197));var _0x4f66=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0xf664[_0x5e8eae];return _0xdd09cd;};'use strict';var multer=require(_0x4f66('0x0'));var util=require(_0x4f66('0x1'));var path=require(_0x4f66('0x2'));var timeout=require(_0x4f66('0x3'));var express=require(_0x4f66('0x4'));var router=express['Router']();var fs_extra=require(_0x4f66('0x5'));var auth=require(_0x4f66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f66('0x7'));var controller=require(_0x4f66('0x8'));router['get']('/',auth[_0x4f66('0x9')](),controller['index']);router[_0x4f66('0xa')](_0x4f66('0xb'),auth[_0x4f66('0x9')](),controller[_0x4f66('0xc')]);router[_0x4f66('0xd')](_0x4f66('0xe'),auth[_0x4f66('0x9')](),controller[_0x4f66('0xf')]);router[_0x4f66('0xd')]('/',auth[_0x4f66('0x9')](),controller[_0x4f66('0x10')]);router[_0x4f66('0x11')](_0x4f66('0xb'),auth[_0x4f66('0x9')](),controller['update']);router[_0x4f66('0x12')](_0x4f66('0xb'),auth[_0x4f66('0x9')](),controller[_0x4f66('0x13')]);module[_0x4f66('0x14')]=router; \ No newline at end of file +var _0xaca1=['get','show','post','/:id/clone','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index'];(function(_0x49225c,_0x401017){var _0x42cd8b=function(_0x5a8cb9){while(--_0x5a8cb9){_0x49225c['push'](_0x49225c['shift']());}};_0x42cd8b(++_0x401017);}(_0xaca1,0x1d9));var _0x1aca=function(_0x2c215d,_0x28b602){_0x2c215d=_0x2c215d-0x0;var _0x498b4a=_0xaca1[_0x2c215d];return _0x498b4a;};'use strict';var multer=require(_0x1aca('0x0'));var util=require(_0x1aca('0x1'));var path=require(_0x1aca('0x2'));var timeout=require(_0x1aca('0x3'));var express=require('express');var router=express[_0x1aca('0x4')]();var fs_extra=require(_0x1aca('0x5'));var auth=require(_0x1aca('0x6'));var interaction=require(_0x1aca('0x7'));var config=require('../../config/environment');var controller=require(_0x1aca('0x8'));router['get']('/',auth[_0x1aca('0x9')](),controller[_0x1aca('0xa')]);router[_0x1aca('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1aca('0xc')]);router[_0x1aca('0xd')](_0x1aca('0xe'),auth[_0x1aca('0x9')](),controller['clone']);router[_0x1aca('0xd')]('/',auth[_0x1aca('0x9')](),controller[_0x1aca('0xf')]);router[_0x1aca('0x10')](_0x1aca('0x11'),auth[_0x1aca('0x9')](),controller[_0x1aca('0x12')]);router[_0x1aca('0x13')](_0x1aca('0x11'),auth[_0x1aca('0x9')](),controller[_0x1aca('0x14')]);module[_0x1aca('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ee4f4da..29c4588 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 _0x8426=['join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport'];(function(_0x470c1c,_0x35f9e7){var _0x2aee1b=function(_0x5702ab){while(--_0x5702ab){_0x470c1c['push'](_0x470c1c['shift']());}};_0x2aee1b(++_0x35f9e7);}(_0x8426,0x1d2));var _0x6842=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x8426[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require('sequelize');module[_0x6842('0x0')]={'name':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6842('0x2')]('friend',_0x6842('0x3'),'peer'),'allowNull':![],'defaultValue':_0x6842('0x4')},'context':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'defaultValue':_0x6842('0x5')},'callingpres':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x6'),_0x6842('0x7'),_0x6842('0x8'),'ALLOWED','PROHIB_NOT_SCREENED',_0x6842('0x9'),_0x6842('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x6842('0x1')]},'permit':{'type':Sequelize[_0x6842('0x1')]},'secret':{'type':Sequelize[_0x6842('0x1')]},'md5secret':{'type':Sequelize[_0x6842('0x1')]},'remotesecret':{'type':Sequelize[_0x6842('0x1')]},'transport':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0xb'),'set':function(_0xbed057){this[_0x6842('0xc')](_0x6842('0xd'),_0xbed057?_0xbed057[_0x6842('0xe')](','):null);},'get':function(){return this[_0x6842('0xf')](_0x6842('0xd'))?this[_0x6842('0xf')]('transport')[_0x6842('0x10')](','):null;},'comment':_0x6842('0x11')},'dtmfmode':{'type':Sequelize[_0x6842('0x2')]('rfc2833',_0x6842('0x12'),'shortinfo',_0x6842('0x13'),'auto'),'defaultValue':_0x6842('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no',_0x6842('0x16'),_0x6842('0x17'),_0x6842('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6842('0x1')]},'directmediadeny':{'type':Sequelize[_0x6842('0x1')]},'nat':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x19'),'set':function(_0x14e6ca){this[_0x6842('0xc')](_0x6842('0x1a'),_0x14e6ca?_0x14e6ca[_0x6842('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x6842('0x1a'))?this[_0x6842('0xf')]('nat')[_0x6842('0x10')](','):null;},'comment':_0x6842('0x1b')},'callgroup':{'type':Sequelize[_0x6842('0x1')]},'namedcallgroup':{'type':Sequelize[_0x6842('0x1')]},'pickupgroup':{'type':Sequelize[_0x6842('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6842('0x1')]},'language':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6842('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x6842('0x1')],'allowNull':![],'defaultValue':_0x6842('0x1c'),'set':function(_0x88856a){this[_0x6842('0xc')](_0x6842('0x1d'),_0x88856a?_0x88856a['join'](';'):_0x6842('0x1c'));},'get':function(){return this[_0x6842('0xf')](_0x6842('0x1d'))?this['getDataValue']('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x1e'),'set':function(_0x33a612){this['setDataValue'](_0x6842('0x1f'),_0x33a612?_0x33a612[_0x6842('0xe')](','):null);},'get':function(){return this[_0x6842('0xf')](_0x6842('0x1f'))?this['getDataValue'](_0x6842('0x1f'))[_0x6842('0x10')](','):null;},'comment':_0x6842('0x20')},'trustrpid':{'type':Sequelize[_0x6842('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x21'))},'promiscredir':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x6842('0x1')]},'callerid':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x22')},'amaflags':{'type':Sequelize[_0x6842('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no'),'defaultValue':_0x6842('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x6842('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6842('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x6842('0x2')]('accept','refuse',_0x6842('0x25'))},'session_expires':{'type':Sequelize[_0x6842('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x26'),_0x6842('0x27')),'defaultValue':_0x6842('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x6842('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x6842('0x1')]},'fromuser':{'type':Sequelize[_0x6842('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no'),'defaultValue':_0x6842('0x15')},'keepalive':{'type':Sequelize[_0x6842('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x6842('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x6842('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6842('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x6842('0x2')]('yes','no',_0x6842('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6842('0x1')]},'callbackextension':{'type':Sequelize[_0x6842('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x6842('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6842('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x6842('0x1')]},'contactdeny':{'type':Sequelize[_0x6842('0x1')]},'contactacl':{'type':Sequelize[_0x6842('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6842('0x1')]},'use_q850_reason':{'type':Sequelize[_0x6842('0x1')]},'maxforwards':{'type':Sequelize[_0x6842('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'force_avp':{'type':Sequelize[_0x6842('0x2')]('yes','no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6842('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x29'),_0x6842('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x6842('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x6842('0x1')]},'dtlscipher':{'type':Sequelize[_0x6842('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x6842('0x1')]},'dtlssetup':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x2b'),'passive',_0x6842('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6842('0x1')]},'recordofffeature':{'type':Sequelize[_0x6842('0x1')]},'call_limit':{'type':Sequelize[_0x6842('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no')},'vmexten':{'type':Sequelize[_0x6842('0x1')]},'mohinterpret':{'type':Sequelize[_0x6842('0x1')]},'mohsuggest':{'type':Sequelize[_0x6842('0x1')]},'parkinglot':{'type':Sequelize[_0x6842('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6842('0x1')],'defaultValue':_0x6842('0x2d')},'canreinvite':{'type':Sequelize[_0x6842('0x2')](_0x6842('0x15'),'no',_0x6842('0x16'),_0x6842('0x17'),_0x6842('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6842('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6842('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x593d=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','join','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','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','nonat','update,nonat','sequelize','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue'];(function(_0x1c36c9,_0x4aabda){var _0x3feb27=function(_0x30f80b){while(--_0x30f80b){_0x1c36c9['push'](_0x1c36c9['shift']());}};_0x3feb27(++_0x4aabda);}(_0x593d,0x1c2));var _0xd593=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x593d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd593('0x0'));module['exports']={'name':{'type':Sequelize[_0xd593('0x1')],'allowNull':![],'unique':_0xd593('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xd593('0x3'),_0xd593('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd593('0x1')],'allowNull':![],'defaultValue':_0xd593('0x5')},'callingpres':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x7'),_0xd593('0x8'),_0xd593('0x9'),_0xd593('0xa'),_0xd593('0xb'),_0xd593('0xc'),'PROHIB_FAILED_SCREEN',_0xd593('0xd'))},'deny':{'type':Sequelize[_0xd593('0x1')]},'permit':{'type':Sequelize[_0xd593('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xd593('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xd593('0x1')],'defaultValue':_0xd593('0xe'),'set':function(_0x4ad15d){this[_0xd593('0xf')](_0xd593('0x10'),_0x4ad15d?_0x4ad15d['join'](','):null);},'get':function(){return this[_0xd593('0x11')]('transport')?this[_0xd593('0x11')](_0xd593('0x10'))[_0xd593('0x12')](','):null;},'comment':_0xd593('0x13')},'dtmfmode':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x14'),_0xd593('0x15'),_0xd593('0x16'),_0xd593('0x17'),_0xd593('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd593('0x6')]('yes','no','nonat',_0xd593('0x19'),_0xd593('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xd593('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x55c248){this['setDataValue'](_0xd593('0x1c'),_0x55c248?_0x55c248['join'](','):null);},'get':function(){return this['getDataValue'](_0xd593('0x1c'))?this[_0xd593('0x11')](_0xd593('0x1c'))[_0xd593('0x12')](','):null;},'comment':_0xd593('0x1d')},'callgroup':{'type':Sequelize[_0xd593('0x1')]},'namedcallgroup':{'type':Sequelize[_0xd593('0x1')]},'pickupgroup':{'type':Sequelize[_0xd593('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd593('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd593('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd593('0x1')],'defaultValue':_0xd593('0x1e')},'allow':{'type':Sequelize[_0xd593('0x1')],'allowNull':![],'defaultValue':_0xd593('0x1f'),'set':function(_0x21227c){this[_0xd593('0xf')]('allow',_0x21227c?_0x21227c[_0xd593('0x20')](';'):_0xd593('0x1f'));},'get':function(){return this['getDataValue']('allow')?this['getDataValue']('allow')[_0xd593('0x12')](';'):null;},'comment':_0xd593('0x21')},'autoframing':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'insecure':{'type':Sequelize[_0xd593('0x1')],'defaultValue':_0xd593('0x22'),'set':function(_0x50e968){this[_0xd593('0xf')](_0xd593('0x23'),_0x50e968?_0x50e968[_0xd593('0x20')](','):null);},'get':function(){return this[_0xd593('0x11')]('insecure')?this[_0xd593('0x11')]('insecure')[_0xd593('0x12')](','):null;},'comment':_0xd593('0x24')},'trustrpid':{'type':Sequelize[_0xd593('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no',_0xd593('0x25'))},'promiscredir':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xd593('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0xd593('0x26')](0xb)},'setvar':{'type':Sequelize[_0xd593('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd593('0x1')]},'callcounter':{'type':Sequelize[_0xd593('0x6')]('yes','no'),'defaultValue':_0xd593('0x1b')},'busylevel':{'type':Sequelize[_0xd593('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xd593('0x1')]},'template':{'type':Sequelize[_0xd593('0x1')]},'videosupport':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no',_0xd593('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd593('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd593('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x28'),_0xd593('0x29'),_0xd593('0x2a'))},'session_expires':{'type':Sequelize[_0xd593('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xd593('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd593('0x2b'),_0xd593('0x2c')),'defaultValue':_0xd593('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xd593('0x1')]},'regexten':{'type':Sequelize[_0xd593('0x1')]},'fromdomain':{'type':Sequelize[_0xd593('0x1')]},'fromuser':{'type':Sequelize[_0xd593('0x1')]},'port':{'type':Sequelize[_0xd593('0x26')](0x5)},'qualify':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no'),'defaultValue':_0xd593('0x1b')},'keepalive':{'type':Sequelize[_0xd593('0x26')](0xb)},'defaultip':{'type':Sequelize[_0xd593('0x1')]},'defaultuser':{'type':Sequelize[_0xd593('0x1')]},'rtptimeout':{'type':Sequelize[_0xd593('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd593('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xd593('0x1b'),'no',_0xd593('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd593('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xd593('0x26')](0xb)},'timerb':{'type':Sequelize[_0xd593('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd593('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xd593('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xd593('0x1')]},'use_q850_reason':{'type':Sequelize[_0xd593('0x1')]},'maxforwards':{'type':Sequelize[_0xd593('0x26')](0xb)},'encryption':{'type':Sequelize[_0xd593('0x6')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd593('0x6')]('yes','no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xd593('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xd593('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xd593('0x1b'),'no',_0xd593('0x2e'),_0xd593('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xd593('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd593('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xd593('0x1')]},'dtlscipher':{'type':Sequelize[_0xd593('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x30'),_0xd593('0x31'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd593('0x1')]},'usereqphone':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xd593('0x1')]},'call_limit':{'type':Sequelize[_0xd593('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no')},'vmexten':{'type':Sequelize[_0xd593('0x1')]},'mohinterpret':{'type':Sequelize[_0xd593('0x1')]},'mohsuggest':{'type':Sequelize[_0xd593('0x1')]},'parkinglot':{'type':Sequelize[_0xd593('0x1')]},'description':{'type':Sequelize[_0xd593('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xd593('0x6')](_0xd593('0x1b'),'no',_0xd593('0x32'),'update',_0xd593('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd593('0x1')]},'otherFields':{'type':Sequelize[_0xd593('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd593('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 10a6d00..0a530d0 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 _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x312484,_0x2605e6){var _0x5035e8=function(_0x5b4330){while(--_0x5b4330){_0x312484['push'](_0x312484['shift']());}};_0x5035e8(++_0x2605e6);}(_0xb821,0xa7));var _0x1b82=function(_0x35e29d,_0x4ae9bb){_0x35e29d=_0x35e29d-0x0;var _0x364f06=_0xb821[_0x35e29d];return _0x364f06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x5d617f,_0x3ce07a){var _0x3034e1=function(_0x3a3bb5){while(--_0x3a3bb5){_0x5d617f['push'](_0x5d617f['shift']());}};_0x3034e1(++_0x3ce07a);}(_0xbec5,0xe5));var _0x5bec=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xbec5[_0x26f702];return _0x11417d;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7b38b66..ae4e69d 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 _0x8ffe=['lodash','../../config/logger','api','request-promise','path','rimraf','./trunk.attributes','exports','define','tools_trunks'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ffe,0x96));var _0xe8ff=function(_0x487ba5,_0x2297c0){_0x487ba5=_0x487ba5-0x0;var _0x472624=_0x8ffe[_0x487ba5];return _0x472624;};'use strict';var _=require(_0xe8ff('0x0'));var util=require('util');var logger=require(_0xe8ff('0x1'))(_0xe8ff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe8ff('0x3'));var fs=require('fs');var path=require(_0xe8ff('0x4'));var rimraf=require(_0xe8ff('0x5'));var config=require('../../config/environment');var attributes=require(_0xe8ff('0x6'));module[_0xe8ff('0x7')]=function(_0x42a201,_0xde2ca5){return _0x42a201[_0xe8ff('0x8')]('Trunk',attributes,{'tableName':_0xe8ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3901=['moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','lodash','util','api'];(function(_0x573f4b,_0x31feec){var _0x5b31dd=function(_0x1dc9eb){while(--_0x1dc9eb){_0x573f4b['push'](_0x573f4b['shift']());}};_0x5b31dd(++_0x31feec);}(_0x3901,0xb8));var _0x1390=function(_0x461c2c,_0x13f720){_0x461c2c=_0x461c2c-0x0;var _0x34ce82=_0x3901[_0x461c2c];return _0x34ce82;};'use strict';var _=require(_0x1390('0x0'));var util=require(_0x1390('0x1'));var logger=require('../../config/logger')(_0x1390('0x2'));var moment=require(_0x1390('0x3'));var BPromise=require('bluebird');var rp=require(_0x1390('0x4'));var fs=require('fs');var path=require(_0x1390('0x5'));var rimraf=require(_0x1390('0x6'));var config=require(_0x1390('0x7'));var attributes=require(_0x1390('0x8'));module['exports']=function(_0x16d1bd,_0x65a974){return _0x16d1bd[_0x1390('0x9')](_0x1390('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 8bf0c05..8366df4 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 _0x8546=['message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','find','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8546,0xf7));var _0x6854=function(_0x484324,_0x650c9d){_0x484324=_0x484324-0x0;var _0x4aa095=_0x8546[_0x484324];return _0x4aa095;};'use strict';var _=require(_0x6854('0x0'));var util=require(_0x6854('0x1'));var moment=require('moment');var BPromise=require(_0x6854('0x2'));var rs=require(_0x6854('0x3'));var fs=require('fs');var Redis=require(_0x6854('0x4'));var db=require(_0x6854('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6854('0x6'));var client=jayson[_0x6854('0x7')][_0x6854('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379f40,_0x140683,_0x422a38){return new BPromise(function(_0x379925,_0x380959){return client[_0x6854('0x9')](_0x379f40,_0x422a38)[_0x6854('0xa')](function(_0xae46d){logger['info'](_0x6854('0xb'),_0x140683,_0x6854('0xc'));logger[_0x6854('0xd')](_0x6854('0xe'),_0x140683,_0x6854('0xc'),JSON['stringify'](_0xae46d));if(_0xae46d[_0x6854('0xf')]){if(_0xae46d['error'][_0x6854('0x10')]===0x1f4){logger[_0x6854('0xf')]('Trunk,\x20%s,\x20%s',_0x140683,_0xae46d[_0x6854('0xf')]['message']);return _0x380959(_0xae46d['error'][_0x6854('0x11')]);}logger['error'](_0x6854('0xb'),_0x140683,_0xae46d['error']['message']);return _0x379925(_0xae46d[_0x6854('0xf')][_0x6854('0x11')]);}else{logger[_0x6854('0x12')](_0x6854('0xb'),_0x140683,_0x6854('0xc'));_0x379925(_0xae46d[_0x6854('0x13')][_0x6854('0x11')]);}})[_0x6854('0x14')](function(_0xb0aae7){logger[_0x6854('0xf')]('Trunk,\x20%s,\x20%s',_0x140683,_0xb0aae7);_0x380959(_0xb0aae7);});});}exports[_0x6854('0x15')]=function(_0x27ffb3){var _0x534309=this;return new Promise(function(_0x1fcb1f,_0x4a6796){return db[_0x6854('0x16')][_0x6854('0x17')]({'raw':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3[_0x6854('0x18')][_0x6854('0x19')]===undefined?!![]:![]:!![],'where':_0x27ffb3['options']?_0x27ffb3['options'][_0x6854('0x1a')]||null:null,'attributes':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3['options'][_0x6854('0x1b')]||null:null,'limit':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3[_0x6854('0x18')]['limit']||null:null,'include':_0x27ffb3[_0x6854('0x18')]?_0x27ffb3['options'][_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x27ffb3[_0x6854('0x18')]['include'],function(_0x5d8bc7){return{'model':db[_0x5d8bc7[_0x6854('0x1e')]],'as':_0x5d8bc7['as'],'attributes':_0x5d8bc7['attributes'],'include':_0x5d8bc7[_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x5d8bc7[_0x6854('0x1c')],function(_0x36ea8e){return{'model':db[_0x36ea8e[_0x6854('0x1e')]],'as':_0x36ea8e['as'],'attributes':_0x36ea8e[_0x6854('0x1b')],'include':_0x36ea8e[_0x6854('0x1c')]?_['map'](_0x36ea8e[_0x6854('0x1c')],function(_0x491da1){return{'model':db[_0x491da1[_0x6854('0x1e')]],'as':_0x491da1['as'],'attributes':_0x491da1[_0x6854('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x468cd5){logger[_0x6854('0x12')](_0x6854('0x15'),_0x27ffb3);logger[_0x6854('0xd')](_0x6854('0x15'),_0x27ffb3,JSON['stringify'](_0x468cd5));_0x1fcb1f(_0x468cd5);})['catch'](function(_0x1af854){logger[_0x6854('0xf')](_0x6854('0x15'),_0x1af854[_0x6854('0x11')],_0x27ffb3);_0x4a6796(_0x534309[_0x6854('0xf')](0x1f4,_0x1af854[_0x6854('0x11')]));});});};exports['ShowTrunk']=function(_0x5859bb){var _0x277cb1=this;return new Promise(function(_0x8437f0,_0x5c8d07){return db['Trunk'][_0x6854('0x1f')]({'raw':_0x5859bb[_0x6854('0x18')]?_0x5859bb[_0x6854('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5859bb[_0x6854('0x18')]?_0x5859bb[_0x6854('0x18')][_0x6854('0x1a')]||null:null,'attributes':_0x5859bb[_0x6854('0x18')]?_0x5859bb[_0x6854('0x18')][_0x6854('0x1b')]||null:null,'include':_0x5859bb[_0x6854('0x18')]?_0x5859bb['options'][_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x5859bb['options'][_0x6854('0x1c')],function(_0x513ab0){return{'model':db[_0x513ab0['model']],'as':_0x513ab0['as'],'attributes':_0x513ab0[_0x6854('0x1b')],'include':_0x513ab0[_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x513ab0['include'],function(_0x3419f3){return{'model':db[_0x3419f3['model']],'as':_0x3419f3['as'],'attributes':_0x3419f3['attributes'],'include':_0x3419f3[_0x6854('0x1c')]?_[_0x6854('0x1d')](_0x3419f3[_0x6854('0x1c')],function(_0x1a5e67){return{'model':db[_0x1a5e67['model']],'as':_0x1a5e67['as'],'attributes':_0x1a5e67[_0x6854('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a88f){logger['info'](_0x6854('0x20'),_0x5859bb);logger[_0x6854('0xd')](_0x6854('0x20'),_0x5859bb,JSON['stringify'](_0x19a88f));_0x8437f0(_0x19a88f);})['catch'](function(_0x5c4ded){logger[_0x6854('0xf')](_0x6854('0x20'),_0x5c4ded[_0x6854('0x11')],_0x5859bb);_0x5c8d07(_0x277cb1[_0x6854('0xf')](0x1f4,_0x5c4ded['message']));});});}; \ No newline at end of file +var _0x9780=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','then','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent'];(function(_0x5b5348,_0x114705){var _0x5badd6=function(_0x1f8c4b){while(--_0x1f8c4b){_0x5b5348['push'](_0x5b5348['shift']());}};_0x5badd6(++_0x114705);}(_0x9780,0x196));var _0x0978=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x9780[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0x0978('0x0'));var util=require('util');var moment=require(_0x0978('0x1'));var BPromise=require(_0x0978('0x2'));var rs=require(_0x0978('0x3'));var fs=require('fs');var Redis=require(_0x0978('0x4'));var db=require(_0x0978('0x5'))['db'];var utils=require(_0x0978('0x6'));var logger=require(_0x0978('0x7'))(_0x0978('0x8'));var config=require('../../config/environment');var jayson=require(_0x0978('0x9'));var client=jayson[_0x0978('0xa')][_0x0978('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13581c,_0x1936c3,_0x5b7c8a){return new BPromise(function(_0x1b9454,_0x1d3c41){return client['request'](_0x13581c,_0x5b7c8a)['then'](function(_0x483e86){logger[_0x0978('0xc')]('Trunk,\x20%s,\x20%s',_0x1936c3,_0x0978('0xd'));logger[_0x0978('0xe')](_0x0978('0xf'),_0x1936c3,'request\x20sent',JSON[_0x0978('0x10')](_0x483e86));if(_0x483e86['error']){if(_0x483e86['error'][_0x0978('0x11')]===0x1f4){logger[_0x0978('0x12')](_0x0978('0x13'),_0x1936c3,_0x483e86[_0x0978('0x12')][_0x0978('0x14')]);return _0x1d3c41(_0x483e86[_0x0978('0x12')]['message']);}logger[_0x0978('0x12')](_0x0978('0x13'),_0x1936c3,_0x483e86[_0x0978('0x12')]['message']);return _0x1b9454(_0x483e86[_0x0978('0x12')][_0x0978('0x14')]);}else{logger[_0x0978('0xc')]('Trunk,\x20%s,\x20%s',_0x1936c3,_0x0978('0xd'));_0x1b9454(_0x483e86[_0x0978('0x15')]['message']);}})[_0x0978('0x16')](function(_0x3f396b){logger[_0x0978('0x12')](_0x0978('0x13'),_0x1936c3,_0x3f396b);_0x1d3c41(_0x3f396b);});});}exports[_0x0978('0x17')]=function(_0x15f90d){var _0x2b8b8b=this;return new Promise(function(_0x448839,_0x25bc83){return db[_0x0978('0x18')][_0x0978('0x19')]({'raw':_0x15f90d[_0x0978('0x1a')]?_0x15f90d['options']['raw']===undefined?!![]:![]:!![],'where':_0x15f90d[_0x0978('0x1a')]?_0x15f90d[_0x0978('0x1a')][_0x0978('0x1b')]||null:null,'attributes':_0x15f90d['options']?_0x15f90d[_0x0978('0x1a')][_0x0978('0x1c')]||null:null,'limit':_0x15f90d['options']?_0x15f90d['options'][_0x0978('0x1d')]||null:null,'include':_0x15f90d[_0x0978('0x1a')]?_0x15f90d[_0x0978('0x1a')][_0x0978('0x1e')]?_[_0x0978('0x1f')](_0x15f90d[_0x0978('0x1a')][_0x0978('0x1e')],function(_0x579a5d){return{'model':db[_0x579a5d[_0x0978('0x20')]],'as':_0x579a5d['as'],'attributes':_0x579a5d['attributes'],'include':_0x579a5d[_0x0978('0x1e')]?_[_0x0978('0x1f')](_0x579a5d[_0x0978('0x1e')],function(_0x3fd8df){return{'model':db[_0x3fd8df[_0x0978('0x20')]],'as':_0x3fd8df['as'],'attributes':_0x3fd8df['attributes'],'include':_0x3fd8df[_0x0978('0x1e')]?_[_0x0978('0x1f')](_0x3fd8df[_0x0978('0x1e')],function(_0x1c563c){return{'model':db[_0x1c563c['model']],'as':_0x1c563c['as'],'attributes':_0x1c563c[_0x0978('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0978('0x21')](function(_0x25d8be){logger['info'](_0x0978('0x17'),_0x15f90d);logger[_0x0978('0xe')]('GetTrunk',_0x15f90d,JSON[_0x0978('0x10')](_0x25d8be));_0x448839(_0x25d8be);})[_0x0978('0x16')](function(_0x1de3ce){logger[_0x0978('0x12')](_0x0978('0x17'),_0x1de3ce['message'],_0x15f90d);_0x25bc83(_0x2b8b8b[_0x0978('0x12')](0x1f4,_0x1de3ce['message']));});});};exports['ShowTrunk']=function(_0x14b97f){var _0x2e649=this;return new Promise(function(_0x274933,_0x555c12){return db[_0x0978('0x18')]['find']({'raw':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')][_0x0978('0x1b')]||null:null,'attributes':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')][_0x0978('0x1c')]||null:null,'include':_0x14b97f[_0x0978('0x1a')]?_0x14b97f[_0x0978('0x1a')][_0x0978('0x1e')]?_['map'](_0x14b97f[_0x0978('0x1a')]['include'],function(_0x1d2112){return{'model':db[_0x1d2112[_0x0978('0x20')]],'as':_0x1d2112['as'],'attributes':_0x1d2112[_0x0978('0x1c')],'include':_0x1d2112[_0x0978('0x1e')]?_['map'](_0x1d2112['include'],function(_0x343cc7){return{'model':db[_0x343cc7['model']],'as':_0x343cc7['as'],'attributes':_0x343cc7[_0x0978('0x1c')],'include':_0x343cc7[_0x0978('0x1e')]?_['map'](_0x343cc7[_0x0978('0x1e')],function(_0x5ed3fd){return{'model':db[_0x5ed3fd[_0x0978('0x20')]],'as':_0x5ed3fd['as'],'attributes':_0x5ed3fd[_0x0978('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0978('0x21')](function(_0x41e600){logger[_0x0978('0xc')](_0x0978('0x22'),_0x14b97f);logger[_0x0978('0xe')]('ShowTrunk',_0x14b97f,JSON['stringify'](_0x41e600));_0x274933(_0x41e600);})[_0x0978('0x16')](function(_0x23f5fb){logger[_0x0978('0x12')](_0x0978('0x22'),_0x23f5fb['message'],_0x14b97f);_0x555c12(_0x2e649['error'](0x1f4,_0x23f5fb[_0x0978('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 43bdf66..3d1590e 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 _0x9f7e=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x3a63c4,_0x9fab5e){var _0x1dc75a=function(_0x15dedc){while(--_0x15dedc){_0x3a63c4['push'](_0x3a63c4['shift']());}};_0x1dc75a(++_0x9fab5e);}(_0x9f7e,0x79));var _0xe9f7=function(_0x37d799,_0x339c0d){_0x37d799=_0x37d799-0x0;var _0x1d353e=_0x9f7e[_0x37d799];return _0x1d353e;};'use strict';var express=require(_0xe9f7('0x0'));var router=express[_0xe9f7('0x1')]();var auth=require(_0xe9f7('0x2'));var controller=require(_0xe9f7('0x3'));router[_0xe9f7('0x4')](_0xe9f7('0x5'),auth[_0xe9f7('0x6')](),controller['update']);module[_0xe9f7('0x7')]=router; \ No newline at end of file +var _0x0d21=['put','/:id','update','exports','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x31fbaa,_0x2fde64){var _0x514f58=function(_0x118ac9){while(--_0x118ac9){_0x31fbaa['push'](_0x31fbaa['shift']());}};_0x514f58(++_0x2fde64);}(_0x0d21,0x1d4));var _0x10d2=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x0d21[_0x1b349a];return _0x5d1f7c;};'use strict';var express=require(_0x10d2('0x0'));var router=express[_0x10d2('0x1')]();var auth=require(_0x10d2('0x2'));var controller=require(_0x10d2('0x3'));router[_0x10d2('0x4')](_0x10d2('0x5'),auth['isAuthenticated'](),controller[_0x10d2('0x6')]);module[_0x10d2('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5385fe7..b0d73fa 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 _0x6911=['info','ENUM','TEXT','DATE','UserId','error'];(function(_0x146961,_0x9b5d75){var _0x17e6d0=function(_0x33ad43){while(--_0x33ad43){_0x146961['push'](_0x146961['shift']());}};_0x17e6d0(++_0x9b5d75);}(_0x6911,0xc5));var _0x1691=function(_0x18cd54,_0x182047){_0x18cd54=_0x18cd54-0x0;var _0x14207f=_0x6911[_0x18cd54];return _0x14207f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x1691('0x0'),'warning',_0x1691('0x1'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x1691('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1691('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1691('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x1691('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x1691('0x5')}}; \ No newline at end of file +var _0xb5cf=['DATE','INTEGER','error','info','debug','exports','ENUM','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5cf,0x102));var _0xfb5c=function(_0x4812d4,_0xf73537){_0x4812d4=_0x4812d4-0x0;var _0x3119aa=_0xb5cf[_0x4812d4];return _0x3119aa;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xfb5c('0x0'),'warning',_0xfb5c('0x1'),_0xfb5c('0x2')];module[_0xfb5c('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfb5c('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfb5c('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfb5c('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfb5c('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfb5c('0x7')],'unique':'UserId'}}; \ 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 9c9ade8..2273ba0 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 _0x8e63=['Invalid\x20user\x20setting\x20id','find','body','catch','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','update','then','sendStatus','error','stack','name','status','user','role','admin','Unauthorized','params'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x8e63,0x7c));var _0x38e6=function(_0x1bd33f,_0x29f836){_0x1bd33f=_0x1bd33f-0x0;var _0x33aee0=_0x8e63[_0x1bd33f];return _0x33aee0;};'use strict';var _=require('lodash');var Redis=require(_0x38e6('0x0'));var logger=require('../../config/logger')('api');var config=require(_0x38e6('0x1'));var db=require(_0x38e6('0x2'))['db'];var socket=require(_0x38e6('0x3'))(new Redis(config['redis']));require('./user-setting.socket')[_0x38e6('0x4')](socket);config[_0x38e6('0x5')]=_[_0x38e6('0x6')](config['redis'],{'host':_0x38e6('0x7'),'port':0x18eb});function respondWithResult(_0x19e7be,_0x9dd996){_0x9dd996=_0x9dd996||0xc8;return function(_0x315953){if(_0x315953){return _0x19e7be['status'](_0x9dd996)['json'](_0x315953);}};}function saveUpdates(_0x61cee2){return function(_0x1ea04f){if(_0x1ea04f){return _0x1ea04f[_0x38e6('0x8')](_0x61cee2)[_0x38e6('0x9')](function(_0x438258){return _0x438258;});}return null;};}function handleEntityNotFound(_0x58ccc2){return function(_0x563697){if(!_0x563697){_0x58ccc2[_0x38e6('0xa')](0x194);}return _0x563697;};}function handleError(_0x4c5e34,_0x36019a){_0x36019a=_0x36019a||0x1f4;return function(_0x4a97e3){logger[_0x38e6('0xb')](_0x4a97e3[_0x38e6('0xc')]);if(_0x4a97e3[_0x38e6('0xd')]){delete _0x4a97e3[_0x38e6('0xd')];}_0x4c5e34[_0x38e6('0xe')](_0x36019a)['send'](_0x4a97e3);};}exports[_0x38e6('0x8')]=function(_0x1059ab,_0x575b0b){if(_0x1059ab[_0x38e6('0xf')][_0x38e6('0x10')]!==_0x38e6('0x11'))throw new Error(_0x38e6('0x12'));if(isNaN(Number(_0x1059ab[_0x38e6('0x13')]['id'])))throw new Error(_0x38e6('0x14'));return db['UserSetting'][_0x38e6('0x15')]({'where':{'id':_0x1059ab[_0x38e6('0x13')]['id']}})[_0x38e6('0x9')](handleEntityNotFound(_0x575b0b,null))[_0x38e6('0x9')](saveUpdates(_0x1059ab[_0x38e6('0x16')],null))['then'](respondWithResult(_0x575b0b,null))[_0x38e6('0x17')](handleError(_0x575b0b,null));}; \ No newline at end of file +var _0xa4ba=['error','stack','name','status','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','register','redis','defaults','update','then','sendStatus'];(function(_0x1eca97,_0x1e1c87){var _0x25c9f6=function(_0x87d471){while(--_0x87d471){_0x1eca97['push'](_0x1eca97['shift']());}};_0x25c9f6(++_0x1e1c87);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa4ba[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var Redis=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var config=require(_0xaa4b('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xaa4b('0x4'))(new Redis(config['redis']));require('./user-setting.socket')[_0xaa4b('0x5')](socket);config[_0xaa4b('0x6')]=_[_0xaa4b('0x7')](config[_0xaa4b('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x40f127,_0x4d6e56){_0x4d6e56=_0x4d6e56||0xc8;return function(_0x3a6f0d){if(_0x3a6f0d){return _0x40f127['status'](_0x4d6e56)['json'](_0x3a6f0d);}};}function saveUpdates(_0x3e5546){return function(_0xcdbe18){if(_0xcdbe18){return _0xcdbe18[_0xaa4b('0x8')](_0x3e5546)[_0xaa4b('0x9')](function(_0xf06108){return _0xf06108;});}return null;};}function handleEntityNotFound(_0xdefae0){return function(_0x46c8b1){if(!_0x46c8b1){_0xdefae0[_0xaa4b('0xa')](0x194);}return _0x46c8b1;};}function handleError(_0xfb7353,_0x3cb231){_0x3cb231=_0x3cb231||0x1f4;return function(_0x2c7057){logger[_0xaa4b('0xb')](_0x2c7057[_0xaa4b('0xc')]);if(_0x2c7057[_0xaa4b('0xd')]){delete _0x2c7057[_0xaa4b('0xd')];}_0xfb7353[_0xaa4b('0xe')](_0x3cb231)[_0xaa4b('0xf')](_0x2c7057);};}exports['update']=function(_0x5c940c,_0x302695){if(_0x5c940c[_0xaa4b('0x10')]['role']!==_0xaa4b('0x11'))throw new Error(_0xaa4b('0x12'));if(isNaN(Number(_0x5c940c[_0xaa4b('0x13')]['id'])))throw new Error(_0xaa4b('0x14'));return db[_0xaa4b('0x15')][_0xaa4b('0x16')]({'where':{'id':_0x5c940c[_0xaa4b('0x13')]['id']}})[_0xaa4b('0x9')](handleEntityNotFound(_0x302695,null))[_0xaa4b('0x9')](saveUpdates(_0x5c940c[_0xaa4b('0x17')],null))[_0xaa4b('0x9')](respondWithResult(_0x302695,null))[_0xaa4b('0x18')](handleError(_0x302695,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 ec22a4a..d048b60 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 _0xa4e4=['events','UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0xa4e4,0x1d8));var _0x4a4e=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xa4e4[_0x126fb9];return _0xc8a3b1;};'use strict';var EventEmitter=require(_0x4a4e('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x4a4e('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4a4e('0x2')](0x0);var events={'afterCreate':_0x4a4e('0x3'),'afterUpdate':_0x4a4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x298cfa){return function(_0x343613,_0x21d44f,_0x4174ee){UserSettingEvents[_0x4a4e('0x5')](_0x298cfa+':'+_0x343613['id'],_0x343613);UserSettingEvents[_0x4a4e('0x5')](_0x298cfa,_0x343613);_0x4174ee(null);};}for(var e in events){if(events[_0x4a4e('0x6')](e)){var event=events[e];UserSetting[_0x4a4e('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x4d91=['exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x54ac38,_0x4f0b1b){var _0x152d6a=function(_0x45c040){while(--_0x45c040){_0x54ac38['push'](_0x54ac38['shift']());}};_0x152d6a(++_0x4f0b1b);}(_0x4d91,0x97));var _0x14d9=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x4d91[_0x6dd5c];return _0x5a87fa;};'use strict';var EventEmitter=require(_0x14d9('0x0'));var UserSetting=require(_0x14d9('0x1'))['db'][_0x14d9('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x14d9('0x3')](0x0);var events={'afterCreate':_0x14d9('0x4'),'afterUpdate':_0x14d9('0x5'),'afterDestroy':_0x14d9('0x6')};function emitEvent(_0x50d1bd){return function(_0x3e5239,_0x76d4e0,_0x1ebe02){UserSettingEvents['emit'](_0x50d1bd+':'+_0x3e5239['id'],_0x3e5239);UserSettingEvents[_0x14d9('0x7')](_0x50d1bd,_0x3e5239);_0x1ebe02(null);};}for(var e in events){if(events[_0x14d9('0x8')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x14d9('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 2739604..47142e8 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 _0x06ef=['clientSideLoggingEnabledSince','clientSideLoggingEnabled'];(function(_0x2b698c,_0x5bbdd5){var _0x535317=function(_0x2e76c0){while(--_0x2e76c0){_0x2b698c['push'](_0x2b698c['shift']());}};_0x535317(++_0x5bbdd5);}(_0x06ef,0x185));var _0xf06e=function(_0x48a411,_0x544e48){_0x48a411=_0x48a411-0x0;var _0x4c7681=_0x06ef[_0x48a411];return _0x4c7681;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x44397a){return _0x44397a['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57d08f){if(!_0x57d08f[_0xf06e('0x0')])_0x57d08f[_0xf06e('0x1')]=null;else if(_0x57d08f[_0xf06e('0x1')]===null)_0x57d08f['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xb01a=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x175dcc,_0x385886){var _0x4384b5=function(_0x164a7c){while(--_0x164a7c){_0x175dcc['push'](_0x175dcc['shift']());}};_0x4384b5(++_0x385886);}(_0xb01a,0x1a1));var _0xab01=function(_0x1e3cf9,_0x1fd35a){_0x1e3cf9=_0x1e3cf9-0x0;var _0x461065=_0xb01a[_0x1e3cf9];return _0x461065;};'use strict';var attributes=require(_0xab01('0x0'));module[_0xab01('0x1')]=function(_0x463eac){return _0x463eac[_0xab01('0x2')](_0xab01('0x3'),attributes,{'tableName':_0xab01('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd3eaba){if(!_0xd3eaba[_0xab01('0x5')])_0xd3eaba[_0xab01('0x6')]=null;else if(_0xd3eaba[_0xab01('0x6')]===null)_0xd3eaba[_0xab01('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 a5b3bfd..264c11a 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 _0x6539=['user-setting:update','user-setting:update:user-','length','./user-setting.events','save','update','emit'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x6539,0xc7));var _0x9653=function(_0x599b8a,_0x2d9bad){_0x599b8a=_0x599b8a-0x0;var _0x533936=_0x6539[_0x599b8a];return _0x533936;};'use strict';var UserSettingEvents=require(_0x9653('0x0'));var events=[_0x9653('0x1'),'remove',_0x9653('0x2')];function createListener(_0x571a8f,_0x14e112){return function(_0x15a32e){_0x14e112[_0x9653('0x3')](_0x571a8f,_0x15a32e);if(_0x571a8f===_0x9653('0x4')){_0x14e112[_0x9653('0x3')](_0x9653('0x5')+_0x15a32e['UserId'],_0x15a32e);}};}exports['register']=function(_0x5a42e2){for(var _0x3c17a0=0x0,_0x48ed85=events[_0x9653('0x6')];_0x3c17a0<_0x48ed85;_0x3c17a0++){var _0x5bb540=events[_0x3c17a0];var _0x2378cf=createListener('user-setting:'+_0x5bb540,_0x5a42e2);UserSettingEvents['on'](_0x5bb540,_0x2378cf);}}; \ No newline at end of file +var _0xf13b=['./user-setting.events','save','update','emit','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x2af353,_0x418430){var _0x3f3f4e=function(_0x186bb5){while(--_0x186bb5){_0x2af353['push'](_0x2af353['shift']());}};_0x3f3f4e(++_0x418430);}(_0xf13b,0x158));var _0xbf13=function(_0x5e7699,_0x34c7cf){_0x5e7699=_0x5e7699-0x0;var _0x139ad2=_0xf13b[_0x5e7699];return _0x139ad2;};'use strict';var UserSettingEvents=require(_0xbf13('0x0'));var events=[_0xbf13('0x1'),'remove',_0xbf13('0x2')];function createListener(_0x10d188,_0x1e2fa1){return function(_0x142a0e){_0x1e2fa1[_0xbf13('0x3')](_0x10d188,_0x142a0e);if(_0x10d188==='user-setting:update'){_0x1e2fa1[_0xbf13('0x3')](_0xbf13('0x4')+_0x142a0e[_0xbf13('0x5')],_0x142a0e);}};}exports[_0xbf13('0x6')]=function(_0x2852bb){for(var _0x57c84d=0x0,_0x3bd3a6=events['length'];_0x57c84d<_0x3bd3a6;_0x57c84d++){var _0xbb0fc=events[_0x57c84d];var _0x3a2cd8=createListener(_0xbf13('0x7')+_0xbb0fc,_0x2852bb);UserSettingEvents['on'](_0xbb0fc,_0x3a2cd8);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 14cecea..9ac5c50 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 _0x775b=['put','update','changePassword','delete','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','addContacts','create','/create_many','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/pause','pause','/:id/unpause','unpause','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects','createApiKey'];(function(_0x126052,_0x5bd0af){var _0x5ab1eb=function(_0x5050f4){while(--_0x5050f4){_0x126052['push'](_0x126052['shift']());}};_0x5ab1eb(++_0x5bd0af);}(_0x775b,0xf4));var _0xb775=function(_0x2b902c,_0x48ceff){_0x2b902c=_0x2b902c-0x0;var _0x5ebb44=_0x775b[_0x2b902c];return _0x5ebb44;};'use strict';var multer=require('multer');var util=require(_0xb775('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb775('0x1'));var router=express['Router']();var fs_extra=require(_0xb775('0x2'));var auth=require(_0xb775('0x3'));var interaction=require(_0xb775('0x4'));var config=require(_0xb775('0x5'));var controller=require(_0xb775('0x6'));router[_0xb775('0x7')]('/',auth[_0xb775('0x8')](),controller['index']);router['get'](_0xb775('0x9'),auth['isAuthenticated'](),controller[_0xb775('0xa')]);router[_0xb775('0x7')](_0xb775('0xb'),auth['isAuthenticated'](),controller['whoami']);router['get']('/presence',auth[_0xb775('0x8')](),controller['getPresence']);router['get']('/:id',auth[_0xb775('0x8')](),controller['show']);router[_0xb775('0x7')](_0xb775('0xc'),controller['getAvatar']);router[_0xb775('0x7')](_0xb775('0xd'),auth[_0xb775('0x8')](),controller[_0xb775('0xe')]);router['get'](_0xb775('0xf'),auth[_0xb775('0x8')](),controller[_0xb775('0x10')]);router[_0xb775('0x7')](_0xb775('0x11'),auth[_0xb775('0x8')](),controller[_0xb775('0x12')]);router['get'](_0xb775('0x13'),auth[_0xb775('0x8')](),controller[_0xb775('0x14')]);router[_0xb775('0x7')](_0xb775('0x15'),auth[_0xb775('0x8')](),controller['getGroups']);router[_0xb775('0x7')](_0xb775('0x16'),auth[_0xb775('0x8')](),controller[_0xb775('0x17')]);router[_0xb775('0x7')](_0xb775('0x18'),auth[_0xb775('0x8')](),controller[_0xb775('0x19')]);router[_0xb775('0x7')](_0xb775('0x1a'),auth[_0xb775('0x8')](),controller['getChatInteractions']);router[_0xb775('0x7')](_0xb775('0x1b'),auth[_0xb775('0x8')](),controller[_0xb775('0x1c')]);router['get'](_0xb775('0x1d'),auth['isAuthenticated'](),controller[_0xb775('0x1e')]);router['get'](_0xb775('0x1f'),auth[_0xb775('0x8')](),controller[_0xb775('0x20')]);router[_0xb775('0x7')](_0xb775('0x21'),auth[_0xb775('0x8')](),controller['getFaxInteractions']);router[_0xb775('0x7')]('/:id/whatsapp/interactions',auth[_0xb775('0x8')](),controller[_0xb775('0x22')]);router['get'](_0xb775('0x23'),auth[_0xb775('0x8')](),controller[_0xb775('0x24')]);router[_0xb775('0x7')](_0xb775('0x25'),auth[_0xb775('0x8')](),controller['getLists']);router[_0xb775('0x7')](_0xb775('0x26'),auth[_0xb775('0x8')](),controller[_0xb775('0x27')]);router[_0xb775('0x7')]('/:id/prefixes',auth[_0xb775('0x8')](),controller[_0xb775('0x28')]);router['get'](_0xb775('0x29'),auth[_0xb775('0x8')](),controller[_0xb775('0x2a')]);router[_0xb775('0x7')]('/:id/mail_accounts',auth[_0xb775('0x8')](),controller[_0xb775('0x2b')]);router[_0xb775('0x7')](_0xb775('0x2c'),auth[_0xb775('0x8')](),controller[_0xb775('0x2d')]);router[_0xb775('0x7')](_0xb775('0x2e'),auth[_0xb775('0x8')](),controller[_0xb775('0x2f')]);router[_0xb775('0x7')]('/:id/chat_websites',auth[_0xb775('0x8')](),controller[_0xb775('0x30')]);router[_0xb775('0x7')](_0xb775('0x31'),auth[_0xb775('0x8')](),controller['getWhatsappAccounts']);router[_0xb775('0x7')](_0xb775('0x32'),auth[_0xb775('0x8')](),controller[_0xb775('0x33')]);router[_0xb775('0x7')](_0xb775('0x34'),auth[_0xb775('0x8')](),controller[_0xb775('0x35')]);router[_0xb775('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0xb775('0x36')](_0xb775('0xf'),auth[_0xb775('0x8')](),controller[_0xb775('0x37')]);router[_0xb775('0x36')]('/',auth[_0xb775('0x8')](),controller[_0xb775('0x38')]);router[_0xb775('0x36')](_0xb775('0x39'),auth[_0xb775('0x8')](),controller['bulkCreate']);router['post'](_0xb775('0x11'),auth[_0xb775('0x8')](),controller[_0xb775('0x3a')]);var upload=multer({'storage':multer[_0xb775('0x3b')]({'destination':function(_0x3a6933,_0x2242ff,_0x7ac6c){_0x7ac6c(null,path['join'](config[_0xb775('0x3c')],_0xb775('0x3d')));},'filename':function(_0x2669d4,_0x3fb263,_0x54433a){_0x54433a(null,util[_0xb775('0x3e')](_0xb775('0x3f'),Date[_0xb775('0x40')](),_0x3fb263[_0xb775('0x41')]));}})});router[_0xb775('0x36')](_0xb775('0xc'),upload[_0xb775('0x42')](_0xb775('0x43')),controller[_0xb775('0x44')]);router[_0xb775('0x36')](_0xb775('0x45'),auth[_0xb775('0x8')](),controller[_0xb775('0x46')]);router[_0xb775('0x36')]('/:id/logout',auth[_0xb775('0x8')](),controller['logout']);router[_0xb775('0x36')](_0xb775('0x47'),auth[_0xb775('0x8')](),controller[_0xb775('0x48')]);router['post'](_0xb775('0x49'),auth[_0xb775('0x8')](),controller[_0xb775('0x4a')]);router[_0xb775('0x36')](_0xb775('0x23'),auth['isAuthenticated'](),controller['addTeams']);router[_0xb775('0x36')]('/:id/chat_interactions',auth[_0xb775('0x8')](),controller['addChatInteractions']);router[_0xb775('0x36')](_0xb775('0x4b'),auth[_0xb775('0x8')](),controller[_0xb775('0x4c')]);router[_0xb775('0x36')](_0xb775('0x4d'),auth[_0xb775('0x8')](),controller['addFaxInteractions']);router[_0xb775('0x36')](_0xb775('0x4e'),auth['isAuthenticated'](),controller[_0xb775('0x4f')]);router['post'](_0xb775('0x50'),auth[_0xb775('0x8')](),controller[_0xb775('0x51')]);router[_0xb775('0x36')](_0xb775('0x52'),auth[_0xb775('0x8')](),controller[_0xb775('0x53')]);router[_0xb775('0x36')](_0xb775('0x29'),auth[_0xb775('0x8')](),controller[_0xb775('0x54')]);router[_0xb775('0x36')]('/:id/mail_accounts',auth[_0xb775('0x8')](),controller[_0xb775('0x55')]);router[_0xb775('0x36')](_0xb775('0x2c'),auth[_0xb775('0x8')](),controller[_0xb775('0x56')]);router[_0xb775('0x36')](_0xb775('0x2e'),auth[_0xb775('0x8')](),controller[_0xb775('0x57')]);router['post'](_0xb775('0x58'),auth[_0xb775('0x8')](),controller[_0xb775('0x59')]);router[_0xb775('0x36')]('/:id/whatsapp_accounts',auth[_0xb775('0x8')](),controller['addWhatsappAccounts']);router[_0xb775('0x36')](_0xb775('0x32'),auth[_0xb775('0x8')](),controller[_0xb775('0x5a')]);router[_0xb775('0x36')]('/:id/api_key',auth[_0xb775('0x8')](),controller[_0xb775('0x5b')]);router[_0xb775('0x5c')]('/:id',auth[_0xb775('0x8')](),controller[_0xb775('0x5d')]);router[_0xb775('0x5c')]('/:id/password',auth['isAuthenticated'](),controller[_0xb775('0x5e')]);router[_0xb775('0x5f')](_0xb775('0x11'),auth[_0xb775('0x8')](),controller['removeQueues']);router[_0xb775('0x5f')](_0xb775('0x23'),auth[_0xb775('0x8')](),controller[_0xb775('0x60')]);router[_0xb775('0x5f')](_0xb775('0x61'),auth[_0xb775('0x8')](),controller[_0xb775('0x62')]);router[_0xb775('0x5f')]('/:id/chat_interactions',auth[_0xb775('0x8')](),controller[_0xb775('0x63')]);router[_0xb775('0x5f')](_0xb775('0x4b'),auth[_0xb775('0x8')](),controller[_0xb775('0x64')]);router[_0xb775('0x5f')]('/:id/fax_interactions',auth[_0xb775('0x8')](),controller[_0xb775('0x65')]);router[_0xb775('0x5f')](_0xb775('0x4e'),auth[_0xb775('0x8')](),controller[_0xb775('0x66')]);router[_0xb775('0x5f')](_0xb775('0x50'),auth['isAuthenticated'](),controller[_0xb775('0x67')]);router['delete'](_0xb775('0x52'),auth[_0xb775('0x8')](),controller[_0xb775('0x68')]);router[_0xb775('0x5f')](_0xb775('0x29'),auth[_0xb775('0x8')](),controller[_0xb775('0x69')]);router[_0xb775('0x5f')](_0xb775('0x6a'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xb775('0x5f')](_0xb775('0x2c'),auth[_0xb775('0x8')](),controller['removeOpenchannelAccounts']);router[_0xb775('0x5f')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xb775('0x6b')]);router[_0xb775('0x5f')](_0xb775('0x58'),auth['isAuthenticated'](),controller[_0xb775('0x6c')]);router[_0xb775('0x5f')](_0xb775('0x31'),auth['isAuthenticated'](),controller[_0xb775('0x6d')]);router[_0xb775('0x5f')](_0xb775('0x32'),auth[_0xb775('0x8')](),controller[_0xb775('0x6e')]);router[_0xb775('0x5f')]('/:id/api_key',auth[_0xb775('0x8')](),controller['removeApiKey']);module[_0xb775('0x6f')]=router; \ No newline at end of file +var _0x7276=['../../components/interaction/service','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/open_tabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','addContacts','post','create','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1791b2,_0x3def9b){var _0x8d366b=function(_0x4fadb7){while(--_0x4fadb7){_0x1791b2['push'](_0x1791b2['shift']());}};_0x8d366b(++_0x3def9b);}(_0x7276,0x6c));var _0x6727=function(_0x5a1fd3,_0x2ac694){_0x5a1fd3=_0x5a1fd3-0x0;var _0x49bb7a=_0x7276[_0x5a1fd3];return _0x49bb7a;};'use strict';var multer=require(_0x6727('0x0'));var util=require(_0x6727('0x1'));var path=require('path');var timeout=require(_0x6727('0x2'));var express=require(_0x6727('0x3'));var router=express[_0x6727('0x4')]();var fs_extra=require(_0x6727('0x5'));var auth=require(_0x6727('0x6'));var interaction=require(_0x6727('0x7'));var config=require('../../config/environment');var controller=require(_0x6727('0x8'));router[_0x6727('0x9')]('/',auth['isAuthenticated'](),controller[_0x6727('0xa')]);router[_0x6727('0x9')](_0x6727('0xb'),auth[_0x6727('0xc')](),controller[_0x6727('0xd')]);router[_0x6727('0x9')](_0x6727('0xe'),auth[_0x6727('0xc')](),controller[_0x6727('0xf')]);router['get'](_0x6727('0x10'),auth[_0x6727('0xc')](),controller['getPresence']);router['get'](_0x6727('0x11'),auth[_0x6727('0xc')](),controller[_0x6727('0x12')]);router['get']('/:id/avatar',controller[_0x6727('0x13')]);router[_0x6727('0x9')](_0x6727('0x14'),auth[_0x6727('0xc')](),controller['getOpenTabs']);router[_0x6727('0x9')]('/:id/contacts',auth[_0x6727('0xc')](),controller[_0x6727('0x15')]);router[_0x6727('0x9')](_0x6727('0x16'),auth['isAuthenticated'](),controller[_0x6727('0x17')]);router[_0x6727('0x9')](_0x6727('0x18'),auth[_0x6727('0xc')](),controller['getVoiceQueuesRt']);router[_0x6727('0x9')](_0x6727('0x19'),auth[_0x6727('0xc')](),controller[_0x6727('0x1a')]);router[_0x6727('0x9')](_0x6727('0x1b'),auth[_0x6727('0xc')](),controller[_0x6727('0x1c')]);router[_0x6727('0x9')](_0x6727('0x1d'),auth[_0x6727('0xc')](),controller['getScreenRecordings']);router[_0x6727('0x9')](_0x6727('0x1e'),auth[_0x6727('0xc')](),controller[_0x6727('0x1f')]);router[_0x6727('0x9')]('/:id/openchannel/interactions',auth[_0x6727('0xc')](),controller[_0x6727('0x20')]);router[_0x6727('0x9')]('/:id/mail/interactions',auth[_0x6727('0xc')](),controller[_0x6727('0x21')]);router[_0x6727('0x9')](_0x6727('0x22'),auth['isAuthenticated'](),controller[_0x6727('0x23')]);router[_0x6727('0x9')](_0x6727('0x24'),auth[_0x6727('0xc')](),controller[_0x6727('0x25')]);router[_0x6727('0x9')]('/:id/whatsapp/interactions',auth[_0x6727('0xc')](),controller['getWhatsappInteractions']);router[_0x6727('0x9')](_0x6727('0x26'),auth[_0x6727('0xc')](),controller[_0x6727('0x27')]);router[_0x6727('0x9')]('/:id/lists',auth[_0x6727('0xc')](),controller[_0x6727('0x28')]);router[_0x6727('0x9')](_0x6727('0x29'),auth[_0x6727('0xc')](),controller[_0x6727('0x2a')]);router[_0x6727('0x9')]('/:id/prefixes',auth[_0x6727('0xc')](),controller[_0x6727('0x2b')]);router[_0x6727('0x9')](_0x6727('0x2c'),auth[_0x6727('0xc')](),controller['getFaxAccounts']);router['get'](_0x6727('0x2d'),auth[_0x6727('0xc')](),controller[_0x6727('0x2e')]);router['get'](_0x6727('0x2f'),auth[_0x6727('0xc')](),controller[_0x6727('0x30')]);router[_0x6727('0x9')]('/:id/sms_accounts',auth[_0x6727('0xc')](),controller['getSmsAccounts']);router['get'](_0x6727('0x31'),auth[_0x6727('0xc')](),controller[_0x6727('0x32')]);router[_0x6727('0x9')](_0x6727('0x33'),auth['isAuthenticated'](),controller[_0x6727('0x34')]);router[_0x6727('0x9')](_0x6727('0x35'),auth[_0x6727('0xc')](),controller[_0x6727('0x36')]);router['get'](_0x6727('0x37'),auth[_0x6727('0xc')](),controller[_0x6727('0x38')]);router[_0x6727('0x9')](_0x6727('0x39'),auth[_0x6727('0xc')](),controller[_0x6727('0x3a')]);router['post'](_0x6727('0x3b'),auth[_0x6727('0xc')](),controller[_0x6727('0x3c')]);router[_0x6727('0x3d')]('/',auth[_0x6727('0xc')](),controller[_0x6727('0x3e')]);router['post']('/create_many',auth[_0x6727('0xc')](),controller[_0x6727('0x3f')]);router['post']('/:id/queues',auth[_0x6727('0xc')](),controller[_0x6727('0x40')]);var upload=multer({'storage':multer[_0x6727('0x41')]({'destination':function(_0x4fcac3,_0x42c8f5,_0x36c6ef){_0x36c6ef(null,path[_0x6727('0x42')](config[_0x6727('0x43')],'server/files/images/'));},'filename':function(_0x23f76f,_0x2ebd68,_0x2bf072){_0x2bf072(null,util[_0x6727('0x44')](_0x6727('0x45'),Date[_0x6727('0x46')](),_0x2ebd68[_0x6727('0x47')]));}})});router['post'](_0x6727('0x48'),upload[_0x6727('0x49')](_0x6727('0x4a')),controller[_0x6727('0x4b')]);router[_0x6727('0x3d')](_0x6727('0x4c'),auth['isAuthenticated'](),controller[_0x6727('0x4d')]);router[_0x6727('0x3d')]('/:id/logout',auth[_0x6727('0xc')](),controller['logout']);router[_0x6727('0x3d')](_0x6727('0x4e'),auth[_0x6727('0xc')](),controller['pause']);router[_0x6727('0x3d')]('/:id/unpause',auth[_0x6727('0xc')](),controller[_0x6727('0x4f')]);router['post'](_0x6727('0x26'),auth[_0x6727('0xc')](),controller[_0x6727('0x50')]);router[_0x6727('0x3d')]('/:id/chat_interactions',auth[_0x6727('0xc')](),controller[_0x6727('0x51')]);router[_0x6727('0x3d')](_0x6727('0x52'),auth['isAuthenticated'](),controller[_0x6727('0x53')]);router[_0x6727('0x3d')](_0x6727('0x54'),auth[_0x6727('0xc')](),controller['addFaxInteractions']);router[_0x6727('0x3d')](_0x6727('0x55'),auth['isAuthenticated'](),controller[_0x6727('0x56')]);router[_0x6727('0x3d')](_0x6727('0x57'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x6727('0x3d')]('/:id/whatsapp_interactions',auth[_0x6727('0xc')](),controller[_0x6727('0x58')]);router[_0x6727('0x3d')](_0x6727('0x2c'),auth[_0x6727('0xc')](),controller[_0x6727('0x59')]);router[_0x6727('0x3d')](_0x6727('0x2d'),auth[_0x6727('0xc')](),controller[_0x6727('0x5a')]);router[_0x6727('0x3d')](_0x6727('0x2f'),auth[_0x6727('0xc')](),controller[_0x6727('0x5b')]);router[_0x6727('0x3d')](_0x6727('0x5c'),auth[_0x6727('0xc')](),controller['addSmsAccounts']);router[_0x6727('0x3d')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x6727('0x5d')]);router[_0x6727('0x3d')](_0x6727('0x33'),auth[_0x6727('0xc')](),controller[_0x6727('0x5e')]);router[_0x6727('0x3d')](_0x6727('0x35'),auth[_0x6727('0xc')](),controller['addSquareProjects']);router[_0x6727('0x3d')](_0x6727('0x39'),auth['isAuthenticated'](),controller[_0x6727('0x5f')]);router[_0x6727('0x60')](_0x6727('0x11'),auth[_0x6727('0xc')](),controller['update']);router[_0x6727('0x60')]('/:id/password',auth[_0x6727('0xc')](),controller[_0x6727('0x61')]);router[_0x6727('0x62')]('/:id/queues',auth[_0x6727('0xc')](),controller[_0x6727('0x63')]);router[_0x6727('0x62')](_0x6727('0x26'),auth[_0x6727('0xc')](),controller[_0x6727('0x64')]);router['delete'](_0x6727('0x11'),auth[_0x6727('0xc')](),controller[_0x6727('0x65')]);router[_0x6727('0x62')](_0x6727('0x66'),auth[_0x6727('0xc')](),controller[_0x6727('0x67')]);router[_0x6727('0x62')](_0x6727('0x52'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x6727('0x62')](_0x6727('0x54'),auth[_0x6727('0xc')](),controller[_0x6727('0x68')]);router[_0x6727('0x62')](_0x6727('0x55'),auth[_0x6727('0xc')](),controller[_0x6727('0x69')]);router[_0x6727('0x62')]('/:id/openchannel_interactions',auth[_0x6727('0xc')](),controller[_0x6727('0x6a')]);router[_0x6727('0x62')](_0x6727('0x6b'),auth[_0x6727('0xc')](),controller[_0x6727('0x6c')]);router[_0x6727('0x62')](_0x6727('0x2c'),auth[_0x6727('0xc')](),controller['removeFaxAccounts']);router[_0x6727('0x62')](_0x6727('0x2d'),auth[_0x6727('0xc')](),controller[_0x6727('0x6d')]);router[_0x6727('0x62')](_0x6727('0x2f'),auth[_0x6727('0xc')](),controller['removeOpenchannelAccounts']);router[_0x6727('0x62')]('/:id/sms_accounts',auth[_0x6727('0xc')](),controller[_0x6727('0x6e')]);router[_0x6727('0x62')](_0x6727('0x31'),auth[_0x6727('0xc')](),controller[_0x6727('0x6f')]);router[_0x6727('0x62')](_0x6727('0x33'),auth[_0x6727('0xc')](),controller[_0x6727('0x70')]);router[_0x6727('0x62')](_0x6727('0x35'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x6727('0x62')](_0x6727('0x39'),auth[_0x6727('0xc')](),controller[_0x6727('0x71')]);module[_0x6727('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index dc59a56..e511f8d 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x500b43,_0x1a1737){var _0x15a63d=function(_0x2829d0){while(--_0x2829d0){_0x500b43['push'](_0x500b43['shift']());}};_0x15a63d(++_0x1a1737);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xcb91[_0x36436d];return _0x34615d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index af535a3..c59dd3b 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 _0x8b00=['$or','$gt','$gte','$lt','$eq','$not','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','lastName','phone','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','teams','queues','inbound','flatten','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','moment','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','./user.socket','register','redis','defaults','localhost','client','http','request','then','request\x20sent','stringify','error','User,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','update','get','admin','Users','user','Telephones','telephone','filter','value','role','find','name','destroy','end','stack','send','index','User','map','includes','salt','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','show','params','model','keys','rawAttributes','password','filters','intersection','fields','whatsapp','all','body','describe','addContacts','ids','omit','internal','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','agent','permissions','101','102','103','110','104','106','107','108','109','100','111','114','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Agents','autoAssociation','UserProfileResource','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','compact','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','Unknown\x20channel','add','capitalize','toLowerCase','spread','emit','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','mail','CHAT','FaxOpenTabs','FAX','createdAt','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','sort','where','pick','merge','List','tag','getQueues','isValidChannel','order','options','Unknown\x20role','nolimit','Queue','getVoiceQueuesRt','hasOwnProperty','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','type','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','lastPauseAt','QueuePause','unpause','manual','openchannel','Pause','getTeams','Team','addTeams','setDataValue','Voice','Mail','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','addAgent','getDataValue','QueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getVoiceQueues','getChatQueues','Chat','getMailQueues','Whatsapp','Openchannel','transaction','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','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','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and'];(function(_0x1dbd5f,_0x2c536a){var _0x16f0e7=function(_0x2c91c4){while(--_0x2c91c4){_0x1dbd5f['push'](_0x1dbd5f['shift']());}};_0x16f0e7(++_0x2c536a);}(_0x8b00,0x1cd));var _0x08b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b00[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x08b0('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x08b0('0x1'));var squel=require(_0x08b0('0x2'));var jayson=require(_0x08b0('0x3'));var Redis=require(_0x08b0('0x4'));var authService=require(_0x08b0('0x5'));var qs=require(_0x08b0('0x6'));var logger=require('../../config/logger')(_0x08b0('0x7'));var utils=require(_0x08b0('0x8'));var config=require(_0x08b0('0x9'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x08b0('0xa'))[_0x08b0('0xb')](socket);config[_0x08b0('0xc')]=_[_0x08b0('0xd')](config[_0x08b0('0xc')],{'host':_0x08b0('0xe'),'port':0x18eb});var client=jayson[_0x08b0('0xf')][_0x08b0('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x475f84,_0xf38988,_0x18789d,_0x1f0df9){return new BPromise(function(_0x28c5fe,_0x4766b1){var _0x3bdaf9=_0x1f0df9||client;return _0x3bdaf9[_0x08b0('0x11')](_0x475f84,_0x18789d)[_0x08b0('0x12')](function(_0x51ef51){logger['info']('User,\x20%s,\x20%s',_0xf38988,_0x08b0('0x13'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0xf38988,_0x08b0('0x13'),JSON[_0x08b0('0x14')](_0x51ef51));if(_0x51ef51['error']){if(_0x51ef51[_0x08b0('0x15')]['code']===0x1f4){logger[_0x08b0('0x15')](_0x08b0('0x16'),_0xf38988,_0x51ef51[_0x08b0('0x15')][_0x08b0('0x17')]);return _0x4766b1(_0x51ef51['error'][_0x08b0('0x17')]);}logger[_0x08b0('0x15')](_0x08b0('0x16'),_0xf38988,_0x51ef51[_0x08b0('0x15')][_0x08b0('0x17')]);return _0x28c5fe(_0x51ef51['error'][_0x08b0('0x17')]);}else{logger[_0x08b0('0x18')](_0x08b0('0x16'),_0xf38988,_0x08b0('0x13'));_0x28c5fe(_0x51ef51['result'][_0x08b0('0x17')]);}})[_0x08b0('0x19')](function(_0x2584a2){logger['error']('User,\x20%s,\x20%s',_0xf38988,_0x2584a2);_0x4766b1(_0x2584a2);});});}function respondWithStatusCode(_0xf7cb6e,_0xb4d18b){_0xb4d18b=_0xb4d18b||0xcc;return function(_0x1cbb1e){if(_0x1cbb1e){return _0xf7cb6e[_0x08b0('0x1a')](_0xb4d18b);}return _0xf7cb6e[_0x08b0('0x1b')](_0xb4d18b)['end']();};}function respondWithResult(_0x303cc6,_0x3b5554){_0x3b5554=_0x3b5554||0xc8;return function(_0xe0e055){if(_0xe0e055){return _0x303cc6[_0x08b0('0x1b')](_0x3b5554)[_0x08b0('0x1c')](_0xe0e055);}};}function respondWithFilteredResult(_0xdd3b87,_0x1979f1){return function(_0x48cd00){if(_0x48cd00){var _0x2fdf4d=typeof _0x1979f1[_0x08b0('0x1d')]==='undefined'&&typeof _0x1979f1[_0x08b0('0x1e')]===_0x08b0('0x1f');var _0x2f9089=_0x48cd00[_0x08b0('0x20')];var _0x384ced=_0x2fdf4d?0x0:_0x1979f1['offset'];var _0x3ede52=_0x2fdf4d?_0x48cd00['count']:_0x1979f1[_0x08b0('0x1d')]+_0x1979f1[_0x08b0('0x1e')];var _0x294560;if(_0x3ede52>=_0x2f9089){_0x3ede52=_0x2f9089;_0x294560=0xc8;}else{_0x294560=0xce;}_0xdd3b87[_0x08b0('0x1b')](_0x294560);return _0xdd3b87['set'](_0x08b0('0x21'),_0x384ced+'-'+_0x3ede52+'/'+_0x2f9089)[_0x08b0('0x1c')](_0x48cd00);}return null;};}function saveUpdates(_0x51ef0b){return function(_0x4edc70){if(_0x4edc70){return _0x4edc70[_0x08b0('0x22')](_0x51ef0b)[_0x08b0('0x12')](function(_0x48de2c){return _0x48de2c;});}return null;};}function removeEntity(_0x4e0cf1){return function(_0x34aab5){if(_0x34aab5){return _0x34aab5['destroy']()[_0x08b0('0x12')](function(){var _0x21ca87=_0x34aab5[_0x08b0('0x23')]({'plain':!![]});if(_0x21ca87['role']===_0x08b0('0x24'))return;var _0x19fd4d=[{'name':_0x08b0('0x25'),'value':_0x08b0('0x26'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x08b0('0x27'),'value':_0x08b0('0x28'),'ignore':![]}];var _0x2e90af=_(_0x19fd4d)[_0x08b0('0x29')]('ignore')['map'](_0x08b0('0x2a'))[_0x08b0('0x2a')]();if(_['includes'](_0x2e90af,_0x21ca87[_0x08b0('0x2b')])){return;}var _0x521d9c=_[_0x08b0('0x2c')](_0x19fd4d,[_0x08b0('0x2a'),_0x21ca87[_0x08b0('0x2b')]])[_0x08b0('0x2d')];return db['UserProfileResource'][_0x08b0('0x2e')]({'where':{'type':_0x521d9c,'resourceId':_0x21ca87['id']}})['then'](function(){return _0x34aab5;});})['then'](function(){_0x4e0cf1[_0x08b0('0x1b')](0xcc)[_0x08b0('0x2f')]();});}};}function handleEntityNotFound(_0x1e18d7){return function(_0x2064d2){if(!_0x2064d2){_0x1e18d7[_0x08b0('0x1a')](0x194);}return _0x2064d2;};}function handleError(_0x205b24,_0x157008){_0x157008=_0x157008||0x1f4;return function(_0xb542ea){logger[_0x08b0('0x15')](_0xb542ea[_0x08b0('0x30')]);if(_0xb542ea[_0x08b0('0x2d')]){delete _0xb542ea[_0x08b0('0x2d')];}_0x205b24['status'](_0x157008)[_0x08b0('0x31')](_0xb542ea);};}exports[_0x08b0('0x32')]=function(_0x7a67bf,_0x7151f4){var _0x57fa0d={},_0xf88b0f={'count':0x0,'rows':[]};var _0x4061bb=_(db[_0x08b0('0x33')]['rawAttributes'])[_0x08b0('0x34')](function(_0x4a7c38){return{'name':_0x4a7c38['fieldName'],'type':_0x4a7c38['type']['key']};})['filter'](function(_0x2f641a){return!_[_0x08b0('0x35')](['password',_0x08b0('0x36')],_0x2f641a[_0x08b0('0x2d')]);})[_0x08b0('0x2a')]();_0x57fa0d=qs['getOptions'](_0x4061bb,_0x7a67bf);var _0x5405f3={'where':_0x57fa0d['where']};return db[_0x08b0('0x33')][_0x08b0('0x20')](_0x5405f3)[_0x08b0('0x12')](function(_0x155565){_0xf88b0f[_0x08b0('0x20')]=_0x155565;if(_0x7a67bf['query'][_0x08b0('0x37')]){_0x57fa0d[_0x08b0('0x38')]=[{'all':!![]}];}if(_0x7a67bf[_0x08b0('0x39')][_0x08b0('0x3a')]===_0x08b0('0x3b')){_0x57fa0d[_0x08b0('0x38')]=[{'model':db[_0x08b0('0x3c')],'as':_0x08b0('0x3a')}];}if(!_[_0x08b0('0x35')](_0x57fa0d[_0x08b0('0x3d')],'id')){_0x57fa0d[_0x08b0('0x3d')][_0x08b0('0x3e')]('id');}return db['User'][_0x08b0('0x3f')](_0x57fa0d);})[_0x08b0('0x12')](function(_0x20aee1){_0xf88b0f[_0x08b0('0x40')]=_0x20aee1;if(_0x7a67bf[_0x08b0('0x39')][_0x08b0('0x41')]==='true'){var _0x9f860=[];for(var _0x2c354d=0x0;_0x2c354d<_0xf88b0f[_0x08b0('0x40')][_0x08b0('0x42')];_0x2c354d++){_0x9f860[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x43'),_0xf88b0f[_0x08b0('0x40')][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x45'),_0xf88b0f[_0x08b0('0x40')][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs('fax',_0xf88b0f['rows'][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs('mail',_0xf88b0f['rows'][_0x2c354d][_0x08b0('0x44')]));_0x9f860[_0x08b0('0x3e')](get_open_tabs('openchannel',_0xf88b0f['rows'][_0x2c354d]['dataValues']));_0x9f860[_0x08b0('0x3e')](get_open_tabs('whatsapp',_0xf88b0f['rows'][_0x2c354d][_0x08b0('0x44')]));}return BPromise['all'](_0x9f860)['then'](function(){return _0xf88b0f;});}else{return _0xf88b0f;}})[_0x08b0('0x12')](respondWithFilteredResult(_0x7151f4,_0x57fa0d))['catch'](handleError(_0x7151f4,null));};exports[_0x08b0('0x46')]=function(_0x28fdd3,_0x468a16){var _0x3a0204={'raw':![],'where':{'id':_0x28fdd3[_0x08b0('0x47')]['id']}},_0xb00621={};_0xb00621[_0x08b0('0x48')]=_['differenceBy'](_[_0x08b0('0x49')](db[_0x08b0('0x33')][_0x08b0('0x4a')]),[_0x08b0('0x4b'),_0x08b0('0x36')]);_0xb00621['query']=_['keys'](_0x28fdd3[_0x08b0('0x39')]);_0xb00621[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0xb00621['model'],_0xb00621[_0x08b0('0x39')]);_0x3a0204[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0xb00621['model'],qs[_0x08b0('0x4e')](_0x28fdd3['query'][_0x08b0('0x4e')]));_0x3a0204['attributes']=_0x3a0204[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x3a0204[_0x08b0('0x3d')]:_0xb00621[_0x08b0('0x48')];if(_0x28fdd3['query'][_0x08b0('0x37')]){_0x3a0204[_0x08b0('0x38')]=[{'all':!![]}];}if(_0x28fdd3['query']['userSetting']==='true'){_0x3a0204[_0x08b0('0x38')]=[{'model':db[_0x08b0('0x3c')],'as':_0x08b0('0x3a')}];}_0x3a0204=_['merge']({},_0x3a0204,_0x28fdd3['options']);if(!_[_0x08b0('0x35')](_0x3a0204[_0x08b0('0x3d')],'id')){_0x3a0204[_0x08b0('0x3d')][_0x08b0('0x3e')]('id');}return db[_0x08b0('0x33')][_0x08b0('0x2c')](_0x3a0204)[_0x08b0('0x12')](handleEntityNotFound(_0x468a16,null))[_0x08b0('0x12')](function(_0x10dd99){var _0x2a4261=[];values=_0x10dd99;if(_0x28fdd3['query'][_0x08b0('0x41')]===_0x08b0('0x3b')){_0x2a4261[_0x08b0('0x3e')](get_open_tabs('chat',_0x10dd99['dataValues']));_0x2a4261['push'](get_open_tabs(_0x08b0('0x45'),_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs('openchannel',_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x4f'),_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs('fax',_0x10dd99[_0x08b0('0x44')]));_0x2a4261[_0x08b0('0x3e')](get_open_tabs('mail',_0x10dd99['dataValues']));return BPromise[_0x08b0('0x50')](_0x2a4261);}else{return values;}})[_0x08b0('0x12')](function(){return values;})[_0x08b0('0x12')](respondWithResult(_0x468a16,null))[_0x08b0('0x19')](handleError(_0x468a16,null));};exports[_0x08b0('0x22')]=function(_0x48faa0,_0x4bdb64){if(_0x48faa0['body']['id']){delete _0x48faa0[_0x08b0('0x51')]['id'];}delete _0x48faa0[_0x08b0('0x51')][_0x08b0('0x2b')];return db['User']['find']({'where':{'id':_0x48faa0['params']['id']}})['then'](handleEntityNotFound(_0x4bdb64,null))[_0x08b0('0x12')](saveUpdates(_0x48faa0[_0x08b0('0x51')],null))['then'](respondWithResult(_0x4bdb64,null))[_0x08b0('0x19')](handleError(_0x4bdb64,null));};exports['describe']=function(_0x1fc3b9,_0x279cd1){return db[_0x08b0('0x33')][_0x08b0('0x52')]()[_0x08b0('0x12')](respondWithResult(_0x279cd1,null))[_0x08b0('0x19')](handleError(_0x279cd1,null));};exports[_0x08b0('0x53')]=function(_0x1fab96,_0x2d536d){return db['User'][_0x08b0('0x2c')]({'where':{'id':_0x1fab96[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x2d536d,null))[_0x08b0('0x12')](function(_0x50c513){if(_0x50c513){return _0x50c513[_0x08b0('0x53')](_0x1fab96[_0x08b0('0x51')][_0x08b0('0x54')],_[_0x08b0('0x55')](_0x1fab96[_0x08b0('0x51')],[_0x08b0('0x54'),'id'])||{});}})[_0x08b0('0x12')](respondWithResult(_0x2d536d,null))[_0x08b0('0x19')](handleError(_0x2d536d,null));};function validateUser(_0x80ab52){return new BPromise(function(_0x298f88,_0x4ca5a2){if(_0x80ab52[_0x08b0('0x56')])return _0x298f88(_0x80ab52);return db['Setting']['findById'](0x1)[_0x08b0('0x12')](function(_0x38159e){if(_0x38159e[_0x08b0('0x57')])authService[_0x08b0('0x58')](_0x80ab52[_0x08b0('0x4b')]);db['User'][_0x08b0('0x59')](_0x08b0('0x56'))[_0x08b0('0x12')](function(_0x1d5af9){if(_['isNil'](_0x1d5af9)){_0x80ab52[_0x08b0('0x56')]=_0x38159e[_0x08b0('0x5a')]||0x1;return;}if(_[_0x08b0('0x5b')](_0x38159e[_0x08b0('0x5a')])||_0x38159e['min_internal']===_0x1d5af9){_0x80ab52[_0x08b0('0x56')]=_0x1d5af9+0x1;return;}if(_0x38159e[_0x08b0('0x5a')]>_0x1d5af9){_0x80ab52[_0x08b0('0x56')]=_0x38159e[_0x08b0('0x5a')];return;}return db['sequelize'][_0x08b0('0x39')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x08b0('0x5c')][_0x08b0('0x5d')][_0x08b0('0x5e')]})[_0x08b0('0x12')](function(_0x2b654c){if(_0x2b654c&&_0x2b654c[_0x08b0('0x42')]){for(var _0x18fd99=0x0,_0x10bc0e=_0x2b654c['length'];_0x18fd99<_0x10bc0e&&_[_0x08b0('0x5b')](_0x80ab52['internal']);_0x18fd99++){if(_0x38159e['min_internal']<=_0x2b654c[_0x18fd99][_0x08b0('0x5f')]){_0x80ab52[_0x08b0('0x56')]=_0x2b654c[_0x18fd99][_0x08b0('0x5f')];}else if(_0x38159e['min_internal']>_0x2b654c[_0x18fd99]['from']&&_0x38159e[_0x08b0('0x5a')]<=_0x2b654c[_0x18fd99]['to']){_0x80ab52[_0x08b0('0x56')]=_0x38159e[_0x08b0('0x5a')];}}}if(_[_0x08b0('0x5b')](_0x80ab52[_0x08b0('0x56')])){_0x80ab52['internal']=_0x1d5af9+0x1;}return _0x298f88(_0x80ab52);});});})['catch'](function(_0x4538db){_0x4ca5a2(_0x4538db);});});}function updateUser(_0x383280){return new BPromise(function(_0x2036be,_0x8644b5){try{if(_0x383280[_0x08b0('0x60')]){_0x383280[_0x08b0('0x61')]=_0x383280[_0x08b0('0x56')];_0x383280['VoiceMail']={'mailbox':_0x383280[_0x08b0('0x56')],'password':_0x383280[_0x08b0('0x4b')],'fullname':_0x383280[_0x08b0('0x62')],'email':_0x383280[_0x08b0('0x63')]};}if(_0x383280[_0x08b0('0x2b')]===_0x08b0('0x64')){if(!_0x383280[_0x08b0('0x65')])_0x383280['permissions']=[_0x08b0('0x66'),_0x08b0('0x67'),_0x08b0('0x68'),'113',_0x08b0('0x69'),_0x08b0('0x6a'),'105',_0x08b0('0x6b'),_0x08b0('0x6c'),_0x08b0('0x6d'),_0x08b0('0x6e'),_0x08b0('0x6f'),_0x08b0('0x70'),_0x08b0('0x71'),'115'];}_0x2036be(_0x383280);}catch(_0x3eb183){_0x8644b5(_0x3eb183);}});}exports[_0x08b0('0x72')]=function(_0x4dcfd5,_0x56cdff){if(_0x4dcfd5[_0x08b0('0x26')]['role']===_0x08b0('0x64'))throw new Error('Unauthorized');if(_0x4dcfd5['body']['role']===_0x08b0('0x26')&&_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x24')){throw new Error(_0x08b0('0x73'));}if(_0x4dcfd5[_0x08b0('0x51')][_0x08b0('0x2b')]===_0x08b0('0x24')&&_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x08b0('0x74')]([_0x4dcfd5[_0x08b0('0x51')]])[_0x08b0('0x12')](function(){return validateUser(_0x4dcfd5[_0x08b0('0x51')]);})[_0x08b0('0x12')](function(_0x1fb34d){return updateUser(_0x1fb34d)[_0x08b0('0x12')](function(_0x469050){if(_0x469050[_0x08b0('0x2b')]===_0x08b0('0x24')){_0x469050['settingsEnabled']=_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x75')];delete _0x469050[_0x08b0('0x76')];}return _0x469050;});})['then'](function(_0x128194){return db[_0x08b0('0x33')]['create'](_0x128194,{'include':[{'model':db['VoiceMail'],'as':_0x08b0('0x77')}]});})[_0x08b0('0x12')](function(_0x3faa13){if(_0x4dcfd5[_0x08b0('0x51')][_0x08b0('0x2b')]===_0x08b0('0x26'))return _0x3faa13;if(_0x4dcfd5[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x26'))return _0x3faa13;return db[_0x08b0('0x78')]['find']({'where':{'name':_0x3faa13[_0x08b0('0x2b')]==='agent'?_0x08b0('0x79'):_0x08b0('0x27'),'userProfileId':_0x4dcfd5[_0x08b0('0x26')]['userProfileId']},'raw':!![]})['then'](function(_0x3d908c){if(!_0x3d908c||_0x3d908c[_0x08b0('0x7a')]!=0x0)return _0x3faa13;return db[_0x08b0('0x7b')][_0x08b0('0x72')]({'name':_0x3faa13[_0x08b0('0x2d')],'resourceId':_0x3faa13['id'],'type':_0x3d908c[_0x08b0('0x2d')],'sectionId':_0x3d908c['id']},{})[_0x08b0('0x12')](function(){return _0x3faa13;});})['catch'](function(_0x271ee4){logger[_0x08b0('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ee4);throw _0x271ee4;});})[_0x08b0('0x12')](respondWithResult(_0x56cdff,0xc9))[_0x08b0('0x19')](handleError(_0x56cdff,null));};exports[_0x08b0('0x7c')]=function(_0x31979e,_0xc36cf4){var _0x514547=_0x31979e[_0x08b0('0x51')];var _0x9e6539=[];if(_0x31979e[_0x08b0('0x26')][_0x08b0('0x2b')]===_0x08b0('0x64'))throw new Error(_0x08b0('0x7d'));if(_[_0x08b0('0x7e')](_0x514547,['role',_0x08b0('0x26')])&&_0x31979e['user']['role']!=='admin'){throw new Error(_0x08b0('0x73'));}if(_[_0x08b0('0x7e')](_0x514547,[_0x08b0('0x2b'),'admin'])&&_0x31979e[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x24')){throw new Error(_0x08b0('0x7f'));}return licenseUtil['checkUserLimits'](_0x514547)[_0x08b0('0x12')](function(){return validateUser(_0x514547[0x0]);})['then'](function(){for(var _0x56c89c=0x1;_0x56c89c<_0x514547[_0x08b0('0x42')];_0x56c89c++){var _0x5eba9a=_0x514547[_0x56c89c-0x1][_0x08b0('0x56')];if(!_0x514547[_0x56c89c][_0x08b0('0x56')])_0x514547[_0x56c89c][_0x08b0('0x56')]=_0x5eba9a+0x1;_0x9e6539[_0x08b0('0x3e')](validateUser(_0x514547[_0x56c89c]));}return BPromise[_0x08b0('0x50')](_0x9e6539);})[_0x08b0('0x12')](function(){_0x9e6539=[];for(var _0x13a9a9=0x0;_0x13a9a9<_0x514547[_0x08b0('0x42')];_0x13a9a9++){_0x9e6539[_0x08b0('0x3e')](updateUser(_0x514547[_0x13a9a9]));}return BPromise['all'](_0x9e6539);})[_0x08b0('0x12')](function(){return BPromise[_0x08b0('0x80')](_0x514547,function(_0x41bb95){return db['User']['create'](_0x41bb95,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x18c476){_0x41bb95['id']=_0x18c476['id'];return _0x41bb95;});});})['then'](function(_0x42795e){if(_0x31979e[_0x08b0('0x51')]['role']===_0x08b0('0x26'))return _0x42795e;if(_0x31979e[_0x08b0('0x26')][_0x08b0('0x2b')]!==_0x08b0('0x26'))return _0x42795e;var _0x409a4f=_['some'](_0x42795e,function(_0x1edd00){return _0x1edd00[_0x08b0('0x2b')]===_0x08b0('0x64')||_0x1edd00[_0x08b0('0x2b')]==='telephone';});if(!_0x409a4f)return _0x42795e;return db[_0x08b0('0x78')][_0x08b0('0x3f')]({'where':{'name':{'$or':[_0x08b0('0x79'),_0x08b0('0x27')]},'userProfileId':_0x31979e[_0x08b0('0x26')][_0x08b0('0x76')]},'raw':!![]})[_0x08b0('0x12')](function(_0x1524a1){if(_[_0x08b0('0x81')](_0x1524a1)||!_[_0x08b0('0x7e')](_0x1524a1,[_0x08b0('0x7a'),0x0]))return _0x42795e;_0x9e6539=[];var _0x351778=_(_0x1524a1)['map'](function(_0x2450f1){if(_0x2450f1['autoAssociation']===0x1)return;return _0x2450f1[_0x08b0('0x2d')]===_0x08b0('0x79')?_0x08b0('0x64'):_0x08b0('0x28');})[_0x08b0('0x82')]()[_0x08b0('0x2a')]();for(var _0x20cb68=0x0;_0x20cb68<_0x42795e[_0x08b0('0x42')];_0x20cb68++){if(!_[_0x08b0('0x35')](_0x351778,_0x42795e[_0x20cb68][_0x08b0('0x2b')]))return;var _0x28a827=_0x42795e[_0x20cb68][_0x08b0('0x2b')]===_0x08b0('0x64')?_0x08b0('0x79'):'Telephones';_0x9e6539[_0x08b0('0x3e')](db[_0x08b0('0x7b')]['create']({'name':_0x42795e[_0x20cb68]['name'],'resourceId':_0x42795e[_0x20cb68]['id'],'type':_0x28a827,'sectionId':_[_0x08b0('0x2c')](_0x1524a1,[_0x08b0('0x2d'),_0x28a827])['id']},{}));}return BPromise['all'](_0x9e6539);});})[_0x08b0('0x12')](respondWithResult(_0xc36cf4,0xc9))[_0x08b0('0x19')](handleError(_0xc36cf4,null));};exports[_0x08b0('0x83')]=function(_0x17c236,_0x1963bb){if(_0x17c236[_0x08b0('0x51')]['id']){delete _0x17c236[_0x08b0('0x51')]['id'];}return db[_0x08b0('0x33')]['find']({'where':{'id':_0x17c236['params']['id']}})[_0x08b0('0x12')](function(_0x37198d){if(!_0x37198d)return null;if(_0x37198d['id']===_0x17c236[_0x08b0('0x26')]['id']){if(!_0x17c236[_0x08b0('0x51')][_0x08b0('0x84')]||!_0x17c236['body']['newPassword']){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x87'));}if(!_0x37198d['authenticate'](_0x17c236[_0x08b0('0x51')][_0x08b0('0x84')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))]('Wrong\x20credentials');}if(_0x17c236[_0x08b0('0x51')][_0x08b0('0x84')]===_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')]){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x89'));}}else if(_0x17c236[_0x08b0('0x26')][_0x08b0('0x2b')]===_0x08b0('0x24')){if(!_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')]){throw new db[(_0x08b0('0x85'))]['ValidationError'](_0x08b0('0x8a'));}}else if(_0x17c236[_0x08b0('0x26')][_0x08b0('0x2b')]===_0x08b0('0x26')){if(!_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')]){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x8a'));}if(_0x37198d[_0x08b0('0x2b')]!==_0x08b0('0x64')){throw new db[(_0x08b0('0x85'))]['ValidationError'](_0x08b0('0x7d'));}}else{throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x7d'));}return _0x37198d;})['then'](handleEntityNotFound(_0x1963bb,null))['then'](function(_0xe3327a){return db['Setting'][_0x08b0('0x8b')]({'attributes':['id',_0x08b0('0x57'),'enforcePasswordHistory',_0x08b0('0x8c')]})[_0x08b0('0x12')](function(_0xcdd843){if(_0xcdd843[_0x08b0('0x57')])authService[_0x08b0('0x58')](_0x17c236['body'][_0x08b0('0x88')]);if(!_0xcdd843[_0x08b0('0x8d')]||!_0xe3327a[_0x08b0('0x8e')])return _0xe3327a;authService[_0x08b0('0x8f')](_0x17c236[_0x08b0('0x51')]['newPassword'],_0xe3327a['previousPasswords'],_0xcdd843[_0x08b0('0x8c')]);return _0xe3327a;})['then'](saveUpdates({'password':_0x17c236['body'][_0x08b0('0x88')],'passwordResetAt':_0x17c236[_0x08b0('0x26')]['id']==_0x17c236[_0x08b0('0x47')]['id']?moment():null,'previousPasswords':authService[_0x08b0('0x90')](_0x17c236[_0x08b0('0x51')][_0x08b0('0x88')],_0xe3327a['previousPasswords'])},null));})[_0x08b0('0x12')](respondWithResult(_0x1963bb,null))[_0x08b0('0x19')](handleError(_0x1963bb,null));};exports[_0x08b0('0x91')]=function(_0x539333,_0x3d71cd){var _0x42f7d4=_0x539333[_0x08b0('0x51')][_0x08b0('0x92')];return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x539333[_0x08b0('0x47')]['id']},'attributes':['id',_0x08b0('0x2d'),_0x08b0('0x2b'),_0x08b0('0x93'),_0x08b0('0x94'),_0x08b0('0x95'),'interface']})[_0x08b0('0x12')](handleEntityNotFound(_0x3d71cd,null))[_0x08b0('0x12')](function(_0x297f73){if(_0x297f73){if(!utils['isValidChannel'](_0x42f7d4)){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x96'));}return _0x297f73[_0x08b0('0x97')+_[_0x08b0('0x98')](_0x42f7d4[_0x08b0('0x99')]())+'Queues'](_0x539333[_0x08b0('0x51')][_0x08b0('0x54')],{'penalty':_0x539333['body']['penalty']||0x0})[_0x08b0('0x9a')](function(_0x3d24df){for(var _0x1706f4=0x0;_0x1706f4<_0x539333[_0x08b0('0x51')][_0x08b0('0x54')][_0x08b0('0x42')];_0x1706f4+=0x1){var _0x5a4f49={'UserId':Number(_0x539333['params']['id'])};_0x5a4f49[_[_0x08b0('0x98')](_0x42f7d4[_0x08b0('0x99')]())+'QueueId']=Number(_0x539333[_0x08b0('0x51')][_0x08b0('0x54')][_0x1706f4]);socket[_0x08b0('0x9b')]('user'+_[_0x08b0('0x98')](_0x42f7d4['toLowerCase']())+_0x08b0('0x9c'),_0x5a4f49);}return _0x3d24df;})[_0x08b0('0x12')](function(){if(_0x42f7d4===_0x08b0('0x9d')){return db[_0x08b0('0x9e')][_0x08b0('0x3f')]({'where':{'id':_0x539333[_0x08b0('0x51')][_0x08b0('0x54')]||[]},'raw':!![],'attributes':['id',_0x08b0('0x2d')]});}})['then'](function(_0x5c05e2){var _0x1ec4f6=_0x297f73['get']({'plain':!![]});var _0x4691ce=[];if(_0x42f7d4===_0x08b0('0x9d')&&_0x1ec4f6[_0x08b0('0x2b')]==='agent'&&_0x1ec4f6[_0x08b0('0x93')]){for(var _0x51b273=0x0;_0x51b273<_0x5c05e2[_0x08b0('0x42')];_0x51b273+=0x1){_0x4691ce['push']({'membername':_0x1ec4f6[_0x08b0('0x2d')],'UserId':_0x1ec4f6['id'],'queue_name':_0x5c05e2[_0x51b273][_0x08b0('0x2d')],'VoiceQueueId':_0x5c05e2[_0x51b273]['id'],'interface':_[_0x08b0('0x5b')](_0x1ec4f6[_0x08b0('0x9f')])?util[_0x08b0('0xa0')](_0x08b0('0xa1'),_0x1ec4f6[_0x08b0('0x2d')]):_0x1ec4f6[_0x08b0('0x9f')],'paused':_0x1ec4f6[_0x08b0('0x95')]||![],'penalty':_0x539333[_0x08b0('0x51')][_0x08b0('0xa2')]||0x0});}return BPromise[_0x08b0('0x80')](_0x4691ce,function(_0x4135c8){return db[_0x08b0('0xa3')][_0x08b0('0xa4')](_0x4135c8);});}return _0x297f73;});}})['then'](respondWithStatusCode(_0x3d71cd,null))[_0x08b0('0x19')](handleError(_0x3d71cd,null));};exports['removeQueues']=function(_0x2026e7,_0xc003a7){var _0x332188,_0x30b008;return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x2026e7[_0x08b0('0x47')]['id']},'attributes':['id',_0x08b0('0x2d'),_0x08b0('0x2b')]})[_0x08b0('0x12')](handleEntityNotFound(_0xc003a7,null))['then'](function(_0x10e86f){if(_0x10e86f){_0x332188=_0x10e86f;if(!_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')]||!utils['isValidChannel'](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x96'));}return _0x10e86f[_0x08b0('0xa5')+_['capitalize'](_0x2026e7[_0x08b0('0x39')]['channel'][_0x08b0('0x99')]())+_0x08b0('0xa6')](_0x2026e7[_0x08b0('0x39')]['ids']);}})[_0x08b0('0x12')](function(_0x410225){if(_[_0x08b0('0xa7')](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')])){for(var _0x8f6417=0x0;_0x8f6417<_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')]['length'];_0x8f6417+=0x1){_0x30b008={'UserId':Number(_0x2026e7[_0x08b0('0x47')]['id'])};_0x30b008[_['capitalize'](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')][_0x08b0('0x99')]())+'QueueId']=Number(_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')][_0x8f6417]);socket[_0x08b0('0x9b')](_0x08b0('0x26')+_['capitalize'](_0x2026e7['query']['channel'][_0x08b0('0x99')]())+_0x08b0('0xa8'),_0x30b008);}}else{_0x30b008={'UserId':Number(_0x2026e7[_0x08b0('0x47')]['id'])};_0x30b008[_['capitalize'](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')][_0x08b0('0x99')]())+'QueueId']=Number(_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')]);socket[_0x08b0('0x9b')](_0x08b0('0x26')+_[_0x08b0('0x98')](_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')]['toLowerCase']())+_0x08b0('0xa8'),_0x30b008);}return _0x410225;})[_0x08b0('0x12')](function(){if(_0x2026e7[_0x08b0('0x39')][_0x08b0('0x92')]==='voice'){return db[_0x08b0('0xa3')][_0x08b0('0x2e')]({'where':{'UserId':_0x2026e7['params']['id'],'VoiceQueueId':_0x2026e7[_0x08b0('0x39')][_0x08b0('0x54')]},'individualHooks':!![]})[_0x08b0('0x12')](function(){return _0x332188;});}return _0x332188;})[_0x08b0('0x12')](respondWithStatusCode(_0xc003a7,null))[_0x08b0('0x19')](handleError(_0xc003a7,null));};exports[_0x08b0('0xa9')]=function(_0xfd190c,_0x51e332){_0xfd190c[_0x08b0('0x51')][_0x08b0('0xaa')]=_0xfd190c[_0x08b0('0xab')][_0x08b0('0xac')];return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0xfd190c[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x51e332,null))['then'](saveUpdates(_0xfd190c[_0x08b0('0x51')],null))[_0x08b0('0x12')](respondWithResult(_0x51e332,null))[_0x08b0('0x19')](handleError(_0x51e332,null));};exports[_0x08b0('0xad')]=function(_0x4b95f8,_0x1ea4aa){var _0x4b32d5=path[_0x08b0('0xae')](config[_0x08b0('0xaf')],_0x08b0('0xb0'));return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x4b95f8['params']['id']},'attributes':['id',_0x08b0('0xaa')],'raw':!![]})[_0x08b0('0x12')](handleEntityNotFound(_0x1ea4aa,null))['then'](function(_0x143f84){if(_0x143f84){if(_[_0x08b0('0x5b')](_0x143f84[_0x08b0('0xaa')])){return _0x1ea4aa[_0x08b0('0xb1')](_0x4b32d5);}else{if(!fs[_0x08b0('0xb2')](path[_0x08b0('0xae')](config[_0x08b0('0xaf')],_0x08b0('0xb3'),_0x143f84['userpic']))){return _0x1ea4aa[_0x08b0('0xb1')](_0x4b32d5);}return _0x1ea4aa['download'](path[_0x08b0('0xae')](config['root'],'server/files/images/',_0x143f84[_0x08b0('0xaa')]));}}})[_0x08b0('0x19')](handleError(_0x1ea4aa,null));};exports[_0x08b0('0xb4')]=function(_0x2325e6,_0x2ab28b){return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x2325e6[_0x08b0('0x47')]['id']},'attributes':['id']})[_0x08b0('0x12')](handleEntityNotFound(_0x2ab28b,null))['then'](function(_0x446848){var _0x5071fa=[];values=_0x446848[_0x08b0('0x44')];_0x5071fa[_0x08b0('0x3e')](get_open_tabs(_0x08b0('0x43'),_0x446848[_0x08b0('0x44')]));_0x5071fa['push'](get_open_tabs(_0x08b0('0x45'),_0x446848[_0x08b0('0x44')]));_0x5071fa[_0x08b0('0x3e')](get_open_tabs('openchannel',_0x446848['dataValues']));_0x5071fa[_0x08b0('0x3e')](get_open_tabs('whatsapp',_0x446848[_0x08b0('0x44')]));_0x5071fa[_0x08b0('0x3e')](get_open_tabs('fax',_0x446848['dataValues']));_0x5071fa['push'](get_open_tabs(_0x08b0('0xb5'),_0x446848['dataValues']));return BPromise[_0x08b0('0x50')](_0x5071fa);})[_0x08b0('0x12')](function(_0x2efeaa){if(_0x2efeaa){var _0x3d6516=_[_0x08b0('0x34')](values['ChatOpenTabs'],function(_0x53dc76){return{'channel':_0x08b0('0xb6'),'id':_0x53dc76['id'],'createdAt':_0x53dc76['createdAt']};});var _0x317a13=_[_0x08b0('0x34')](values[_0x08b0('0xb7')],function(_0x47565a){return{'channel':_0x08b0('0xb8'),'id':_0x47565a['id'],'createdAt':_0x47565a[_0x08b0('0xb9')]};});var _0x181f43=_[_0x08b0('0x34')](values['OpenchannelOpenTabs'],function(_0x1ef43f){return{'channel':_0x08b0('0xba'),'id':_0x1ef43f['id'],'createdAt':_0x1ef43f[_0x08b0('0xb9')]};});var _0x3e8e5b=_[_0x08b0('0x34')](values['MailOpenTabs'],function(_0xd18b4){return{'channel':_0x08b0('0xbb'),'id':_0xd18b4['id'],'createdAt':_0xd18b4[_0x08b0('0xb9')]};});var _0x5565aa=_[_0x08b0('0x34')](values[_0x08b0('0xbc')],function(_0x2d300e){return{'channel':_0x08b0('0xbd'),'id':_0x2d300e['id'],'createdAt':_0x2d300e['createdAt']};});var _0x42d7c4=_[_0x08b0('0x34')](values[_0x08b0('0xbe')],function(_0x14f57c){return{'channel':'WHATSAPP','id':_0x14f57c['id'],'createdAt':_0x14f57c[_0x08b0('0xb9')]};});var _0x5c7ea3=_['concat'](_0x3d6516,_0x317a13,_0x181f43,_0x3e8e5b,_0x5565aa,_0x42d7c4);var _0x4cc441={'count':_0x5c7ea3[_0x08b0('0x42')],'rows':_0x5c7ea3};return _0x4cc441;}else return null;})[_0x08b0('0x12')](respondWithResult(_0x2ab28b,null))[_0x08b0('0x19')](handleError(_0x2ab28b,null));};exports[_0x08b0('0xbf')]=function(_0x385a24,_0x24922a){var _0x1734d4={};var _0x7ca4ba={};var _0x525068;var _0x462746;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x385a24[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x24922a,null))[_0x08b0('0x12')](function(_0x3e0860){if(_0x3e0860){_0x525068=_0x3e0860;_0x7ca4ba['model']=_[_0x08b0('0x49')](db[_0x08b0('0xc0')]['rawAttributes']);_0x7ca4ba[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x385a24[_0x08b0('0x39')]);_0x7ca4ba[_0x08b0('0x4c')]=_['intersection'](_0x7ca4ba[_0x08b0('0x48')],_0x7ca4ba[_0x08b0('0x39')]);_0x1734d4['attributes']=_[_0x08b0('0x4d')](_0x7ca4ba[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x385a24[_0x08b0('0x39')]['fields']));_0x1734d4[_0x08b0('0x3d')]=_0x1734d4[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1734d4[_0x08b0('0x3d')]:_0x7ca4ba[_0x08b0('0x48')];_0x1734d4['order']=qs[_0x08b0('0xc1')](_0x385a24[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1734d4[_0x08b0('0xc2')]=qs['filters'](_[_0x08b0('0xc3')](_0x385a24[_0x08b0('0x39')],_0x7ca4ba[_0x08b0('0x4c')]));if(_0x385a24[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1734d4[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x1734d4[_0x08b0('0xc2')],{'$or':_['map'](_0x1734d4['attributes'],function(_0x299990){var _0x126ca1={};_0x126ca1[_0x299990]={'$like':'%'+_0x385a24[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x126ca1;})});}_0x1734d4=_[_0x08b0('0xc4')]({},_0x1734d4,_0x385a24['options']);return _0x525068[_0x08b0('0xbf')](_0x1734d4);}})[_0x08b0('0x12')](function(_0x22de23){if(_0x22de23){_0x462746=_0x22de23[_0x08b0('0x42')];if(_0x385a24['query']['hasOwnProperty'](_0x08b0('0x37'))){_0x1734d4[_0x08b0('0x38')]=[{'model':db['CmList'],'as':_0x08b0('0xc5'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x08b0('0x2d'),'color'],'where':_0x385a24[_0x08b0('0x39')][_0x08b0('0xc6')]?{'id':_0x385a24[_0x08b0('0x39')][_0x08b0('0xc6')]}:undefined,'required':_0x385a24['query'][_0x08b0('0xc6')]?!![]:![]}];}if(!_0x385a24[_0x08b0('0x39')]['hasOwnProperty']('nolimit')){_0x1734d4[_0x08b0('0x1e')]=qs['limit'](_0x385a24['query'][_0x08b0('0x1e')]);_0x1734d4[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x385a24[_0x08b0('0x39')][_0x08b0('0x1d')]);}return _0x525068[_0x08b0('0xbf')](_0x1734d4);}})[_0x08b0('0x12')](function(_0x2eace7){if(_0x2eace7){return _0x2eace7?{'count':_0x462746,'rows':_0x2eace7}:null;}})[_0x08b0('0x12')](respondWithResult(_0x24922a,null))[_0x08b0('0x19')](handleError(_0x24922a,null));};exports[_0x08b0('0xc7')]=function(_0x509f5e,_0x59eaee){var _0x3276f6;var _0x3c8fb5={};var _0xf574fd;return db['User'][_0x08b0('0x8b')]({'where':{'id':_0x509f5e['params']['id']},'attributes':['id','name',_0x08b0('0x2b')]})[_0x08b0('0x12')](handleEntityNotFound(_0x59eaee,null))[_0x08b0('0x12')](function(_0x39a8c){if(!utils[_0x08b0('0xc8')](_0x509f5e['query'][_0x08b0('0x92')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0x96'));}_0x3276f6=_0x39a8c;var _0x14baf0={};_0x14baf0[_0x08b0('0x48')]=_[_0x08b0('0x49')](db[_['capitalize'](_0x509f5e[_0x08b0('0x39')]['channel'])+'Queue'][_0x08b0('0x4a')]);_0x14baf0[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x509f5e[_0x08b0('0x39')]);_0x14baf0[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x14baf0[_0x08b0('0x48')],_0x14baf0['query']);_0x3c8fb5[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x14baf0['model'],qs[_0x08b0('0x4e')](_0x509f5e['query'][_0x08b0('0x4e')]));_0x3c8fb5[_0x08b0('0x3d')]=_0x3c8fb5[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x3c8fb5[_0x08b0('0x3d')]:_0x14baf0['model'];_0x3c8fb5[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x3c8fb5[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x509f5e[_0x08b0('0x39')],_0x14baf0[_0x08b0('0x4c')]));if(_0x509f5e[_0x08b0('0x39')][_0x08b0('0x29')]){_0x3c8fb5[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x3c8fb5['where'],{'$or':_[_0x08b0('0x34')](_0x3c8fb5[_0x08b0('0x3d')],function(_0x50297d){var _0x4046ea={};_0x4046ea[_0x50297d]={'$like':'%'+_0x509f5e['query']['filter']+'%'};return _0x4046ea;})});}_0x3c8fb5=_[_0x08b0('0xc4')]({},_0x3c8fb5,_0x509f5e[_0x08b0('0xca')]);switch(_0x3276f6['role']){case _0x08b0('0x24'):return db[_[_0x08b0('0x98')](_0x509f5e[_0x08b0('0x39')]['channel'])+'Queue'][_0x08b0('0x3f')](_0x3c8fb5);case _0x08b0('0x26'):case'agent':return _0x3276f6[_0x08b0('0x23')+_[_0x08b0('0x98')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0x92')])+_0x08b0('0xa6')](_0x3c8fb5);default:throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0xcb'));}})[_0x08b0('0x12')](function(_0x549adf){_0xf574fd=_0x549adf['length'];if(!_0x509f5e[_0x08b0('0x39')]['hasOwnProperty'](_0x08b0('0xcc'))){_0x3c8fb5['limit']=qs[_0x08b0('0x1e')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x3c8fb5[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x509f5e[_0x08b0('0x39')][_0x08b0('0x1d')]);}switch(_0x3276f6[_0x08b0('0x2b')]){case _0x08b0('0x24'):return db[_['capitalize'](_0x509f5e['query'][_0x08b0('0x92')])+_0x08b0('0xcd')][_0x08b0('0x3f')](_0x3c8fb5);case _0x08b0('0x26'):case _0x08b0('0x64'):return _0x3276f6[_0x08b0('0x23')+_[_0x08b0('0x98')](_0x509f5e['query'][_0x08b0('0x92')])+_0x08b0('0xa6')](_0x3c8fb5);}})[_0x08b0('0x12')](function(_0x43820f){return{'count':_0xf574fd,'rows':_0x43820f};})[_0x08b0('0x12')](respondWithResult(_0x59eaee,null))[_0x08b0('0x19')](handleError(_0x59eaee,null));};exports['getVoiceQueuesRt']=function(_0x103080,_0xb48600){var _0x379b00={};var _0x4aa842={};var _0x2e1331;var _0x2ca158;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x103080[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0xb48600,null))[_0x08b0('0x12')](function(_0x6208d6){if(_0x6208d6){_0x2e1331=_0x6208d6;_0x4aa842[_0x08b0('0x48')]=_['keys'](db[_0x08b0('0xa3')]['rawAttributes']);_0x4aa842[_0x08b0('0x39')]=_['keys'](_0x103080[_0x08b0('0x39')]);_0x4aa842['filters']=_[_0x08b0('0x4d')](_0x4aa842[_0x08b0('0x48')],_0x4aa842[_0x08b0('0x39')]);_0x379b00[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x4aa842[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x103080[_0x08b0('0x39')][_0x08b0('0x4e')]));_0x379b00[_0x08b0('0x3d')]=_0x379b00[_0x08b0('0x3d')]['length']?_0x379b00[_0x08b0('0x3d')]:_0x4aa842['model'];_0x379b00[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x103080[_0x08b0('0x39')]['sort']);_0x379b00['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x103080[_0x08b0('0x39')],_0x4aa842[_0x08b0('0x4c')]));if(_0x103080[_0x08b0('0x39')]['filter']){_0x379b00[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x379b00['where'],{'$or':_['map'](_0x379b00[_0x08b0('0x3d')],function(_0x5586e9){var _0x38d71b={};_0x38d71b[_0x5586e9]={'$like':'%'+_0x103080[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x38d71b;})});}_0x379b00=_[_0x08b0('0xc4')]({},_0x379b00,_0x103080[_0x08b0('0xca')]);return _0x2e1331[_0x08b0('0xce')](_0x379b00);}})[_0x08b0('0x12')](function(_0x462723){if(_0x462723){_0x2ca158=_0x462723[_0x08b0('0x42')];if(!_0x103080[_0x08b0('0x39')][_0x08b0('0xcf')]('nolimit')){_0x379b00[_0x08b0('0x1e')]=qs['limit'](_0x103080[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x379b00['offset']=qs[_0x08b0('0x1d')](_0x103080[_0x08b0('0x39')]['offset']);}return _0x2e1331[_0x08b0('0xce')](_0x379b00);}})[_0x08b0('0x12')](function(_0x1d3b05){if(_0x1d3b05){return _0x1d3b05?{'count':_0x2ca158,'rows':_0x1d3b05}:null;}})[_0x08b0('0x12')](respondWithResult(_0xb48600,null))[_0x08b0('0x19')](handleError(_0xb48600,null));};exports[_0x08b0('0xd0')]=function(_0x5324c2,_0x39f669){var _0x3d2543={};var _0x4acc56={};var _0x1e2b58;var _0x526084;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x5324c2[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x39f669,null))[_0x08b0('0x12')](function(_0x3fd367){if(_0x3fd367){_0x1e2b58=_0x3fd367;_0x4acc56['model']=_[_0x08b0('0x49')](db[_0x08b0('0xd1')][_0x08b0('0x4a')]);_0x4acc56[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x5324c2[_0x08b0('0x39')]);_0x4acc56[_0x08b0('0x4c')]=_['intersection'](_0x4acc56[_0x08b0('0x48')],_0x4acc56[_0x08b0('0x39')]);_0x3d2543['attributes']=_[_0x08b0('0x4d')](_0x4acc56['model'],qs['fields'](_0x5324c2['query']['fields']));_0x3d2543['attributes']=_0x3d2543[_0x08b0('0x3d')]['length']?_0x3d2543['attributes']:_0x4acc56['model'];_0x3d2543['order']=qs['sort'](_0x5324c2[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x3d2543['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x5324c2[_0x08b0('0x39')],_0x4acc56[_0x08b0('0x4c')]));if(_0x5324c2[_0x08b0('0x39')]['filter']){_0x3d2543[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x3d2543['where'],{'$or':_[_0x08b0('0x34')](_0x3d2543['attributes'],function(_0x215323){var _0x3b152c={};_0x3b152c[_0x215323]={'$like':'%'+_0x5324c2[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x3b152c;})});}_0x3d2543=_[_0x08b0('0xc4')]({},_0x3d2543,_0x5324c2[_0x08b0('0xca')]);return _0x1e2b58[_0x08b0('0xd0')](_0x3d2543);}})[_0x08b0('0x12')](function(_0x5cf2fa){if(_0x5cf2fa){_0x526084=_0x5cf2fa[_0x08b0('0x42')];if(!_0x5324c2[_0x08b0('0x39')]['hasOwnProperty'](_0x08b0('0xcc'))){_0x3d2543[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x5324c2['query'][_0x08b0('0x1e')]);_0x3d2543[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x5324c2[_0x08b0('0x39')][_0x08b0('0x1d')]);}return _0x1e2b58['getGroups'](_0x3d2543);}})['then'](function(_0x28ea50){if(_0x28ea50){return _0x28ea50?{'count':_0x526084,'rows':_0x28ea50}:null;}})[_0x08b0('0x12')](respondWithResult(_0x39f669,null))[_0x08b0('0x19')](handleError(_0x39f669,null));};exports[_0x08b0('0xd2')]=function(_0x7b4690,_0x2e5e81){var _0x48fe86={'raw':!![],'where':{}};var _0x55ba56={};var _0x17f621={'count':0x0,'rows':[]};return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x7b4690[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x2e5e81,null))[_0x08b0('0x12')](function(_0x358165){if(_0x358165){_0x55ba56[_0x08b0('0x48')]=_[_0x08b0('0x49')](db[_0x08b0('0xd3')][_0x08b0('0x4a')]);_0x55ba56[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x7b4690['query']);_0x55ba56['filters']=_['intersection'](_0x55ba56[_0x08b0('0x48')],_0x55ba56[_0x08b0('0x39')]);_0x48fe86['attributes']=_[_0x08b0('0x4d')](_0x55ba56['model'],qs[_0x08b0('0x4e')](_0x7b4690[_0x08b0('0x39')]['fields']));_0x48fe86[_0x08b0('0x3d')]=_0x48fe86[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x48fe86['attributes']:_0x55ba56[_0x08b0('0x48')];if(!_0x7b4690['query'][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x48fe86['limit']=qs[_0x08b0('0x1e')](_0x7b4690['query'][_0x08b0('0x1e')]);_0x48fe86['offset']=qs[_0x08b0('0x1d')](_0x7b4690[_0x08b0('0x39')][_0x08b0('0x1d')]);}_0x48fe86[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x7b4690[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x48fe86[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x7b4690[_0x08b0('0x39')],_0x55ba56[_0x08b0('0x4c')]));_0x48fe86[_0x08b0('0xc2')]['UserId']=_0x358165['id'];if(_0x7b4690[_0x08b0('0x39')][_0x08b0('0x29')]){_0x48fe86['where']=_['merge'](_0x48fe86[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x48fe86[_0x08b0('0x3d')],function(_0xdd2175){var _0x76d97a={};_0x76d97a[_0xdd2175]={'$like':'%'+_0x7b4690['query']['filter']+'%'};return _0x76d97a;})});}_0x48fe86=_[_0x08b0('0xc4')]({},_0x48fe86,_0x7b4690[_0x08b0('0xca')]);return db[_0x08b0('0xd3')]['count']({'where':_0x48fe86[_0x08b0('0xc2')]})['then'](function(_0x226eab){_0x17f621['count']=_0x226eab;if(_0x7b4690[_0x08b0('0x39')]['includeAll']){_0x48fe86[_0x08b0('0x38')]=[{'all':!![]}];}return db[_0x08b0('0xd3')][_0x08b0('0x3f')](_0x48fe86);})['then'](function(_0x3dbb9c){_0x17f621[_0x08b0('0x40')]=_0x3dbb9c;return _0x17f621;});}})[_0x08b0('0x12')](respondWithFilteredResult(_0x2e5e81,_0x48fe86))[_0x08b0('0x19')](handleError(_0x2e5e81,null));};exports[_0x08b0('0xd4')]=function(_0x52f4e3,_0x5d6066){var _0x395c08={'raw':!![],'where':{}};var _0xab444e={};var _0x18a91f={'count':0x0,'rows':[]};return db[_0x08b0('0x33')]['findOne']({'where':{'id':_0x52f4e3[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x5d6066,null))['then'](function(_0x5335b1){if(_0x5335b1){_0xab444e[_0x08b0('0x48')]=_[_0x08b0('0x49')](db['ScreenRecording']['rawAttributes']);_0xab444e['query']=_['keys'](_0x52f4e3[_0x08b0('0x39')]);_0xab444e[_0x08b0('0x4c')]=_['intersection'](_0xab444e[_0x08b0('0x48')],_0xab444e[_0x08b0('0x39')]);_0x395c08[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0xab444e[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x52f4e3['query'][_0x08b0('0x4e')]));_0x395c08['attributes']=_0x395c08['attributes']['length']?_0x395c08[_0x08b0('0x3d')]:_0xab444e[_0x08b0('0x48')];if(!_0x52f4e3[_0x08b0('0x39')][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x395c08[_0x08b0('0x1e')]=qs['limit'](_0x52f4e3[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x395c08[_0x08b0('0x1d')]=qs['offset'](_0x52f4e3[_0x08b0('0x39')][_0x08b0('0x1d')]);}_0x395c08[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x52f4e3[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x395c08['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x52f4e3[_0x08b0('0x39')],_0xab444e[_0x08b0('0x4c')]));_0x395c08[_0x08b0('0xc2')][_0x08b0('0xd5')]=_0x5335b1['id'];if(_0x52f4e3[_0x08b0('0x39')]['filter']){_0x395c08['where']=_['merge'](_0x395c08['where'],{'$or':_['map'](_0x395c08[_0x08b0('0x3d')],function(_0x28f89a){var _0x5904eb={};_0x5904eb[_0x28f89a]={'$like':'%'+_0x52f4e3[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x5904eb;})});}_0x395c08=_[_0x08b0('0xc4')]({},_0x395c08,_0x52f4e3[_0x08b0('0xca')]);return db['ScreenRecording']['count']({'where':_0x395c08[_0x08b0('0xc2')]})[_0x08b0('0x12')](function(_0x4dc85a){_0x18a91f[_0x08b0('0x20')]=_0x4dc85a;if(_0x52f4e3[_0x08b0('0x39')]['includeAll']){_0x395c08[_0x08b0('0x38')]=[{'all':!![]}];}return db[_0x08b0('0xd6')]['findAll'](_0x395c08);})[_0x08b0('0x12')](function(_0x53115b){_0x18a91f['rows']=_0x53115b;return _0x18a91f;});}})[_0x08b0('0x12')](respondWithFilteredResult(_0x5d6066,_0x395c08))[_0x08b0('0x19')](handleError(_0x5d6066,null));};exports[_0x08b0('0xd7')]=function(_0x5e9711,_0x16ea70){var _0x3fb1be={};var _0x3ae739={};var _0x2268b2;var _0xaa792c;return db[_0x08b0('0x33')]['findOne']({'where':{'id':_0x5e9711[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x16ea70,null))[_0x08b0('0x12')](function(_0x312e3e){if(_0x312e3e){_0x2268b2=_0x312e3e;_0x3ae739['model']=_['keys'](db[_0x08b0('0xd8')][_0x08b0('0x4a')]);_0x3ae739[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x5e9711[_0x08b0('0x39')]);_0x3ae739['filters']=_[_0x08b0('0x4d')](_0x3ae739[_0x08b0('0x48')],_0x3ae739['query']);_0x3fb1be[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x3ae739[_0x08b0('0x48')],qs['fields'](_0x5e9711['query'][_0x08b0('0x4e')]));_0x3fb1be[_0x08b0('0x3d')]=_0x3fb1be[_0x08b0('0x3d')]['length']?_0x3fb1be[_0x08b0('0x3d')]:_0x3ae739[_0x08b0('0x48')];_0x3fb1be['order']=qs[_0x08b0('0xc1')](_0x5e9711[_0x08b0('0x39')]['sort']);_0x3fb1be[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x5e9711[_0x08b0('0x39')],_0x3ae739[_0x08b0('0x4c')]));if(_0x5e9711[_0x08b0('0x39')][_0x08b0('0x29')]){_0x3fb1be[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x3fb1be['where'],{'$or':_['map'](_0x3fb1be['attributes'],function(_0x397627){var _0x35b5e5={};_0x35b5e5[_0x397627]={'$like':'%'+_0x5e9711[_0x08b0('0x39')]['filter']+'%'};return _0x35b5e5;})});}_0x3fb1be=_[_0x08b0('0xc4')]({},_0x3fb1be,_0x5e9711[_0x08b0('0xca')]);return _0x2268b2[_0x08b0('0xd7')](_0x3fb1be);}})['then'](function(_0x5ec571){if(_0x5ec571){_0xaa792c=_0x5ec571[_0x08b0('0x42')];if(!_0x5e9711[_0x08b0('0x39')][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x3fb1be['limit']=qs[_0x08b0('0x1e')](_0x5e9711[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x3fb1be['offset']=qs[_0x08b0('0x1d')](_0x5e9711[_0x08b0('0x39')]['offset']);}return _0x2268b2['getChatInteractions'](_0x3fb1be);}})['then'](function(_0x2aa195){if(_0x2aa195){return _0x2aa195?{'count':_0xaa792c,'rows':_0x2aa195}:null;}})[_0x08b0('0x12')](respondWithResult(_0x16ea70,null))['catch'](handleError(_0x16ea70,null));};exports[_0x08b0('0xd9')]=function(_0x40f493,_0x5b9135){var _0x1bddff={};var _0x2452fc={};var _0x246b9b;var _0x13cd7a;return db['User'][_0x08b0('0x8b')]({'where':{'id':_0x40f493['params']['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x5b9135,null))['then'](function(_0xbe3d62){if(_0xbe3d62){_0x246b9b=_0xbe3d62;_0x2452fc[_0x08b0('0x48')]=_[_0x08b0('0x49')](db['OpenchannelInteraction'][_0x08b0('0x4a')]);_0x2452fc[_0x08b0('0x39')]=_['keys'](_0x40f493['query']);_0x2452fc['filters']=_[_0x08b0('0x4d')](_0x2452fc[_0x08b0('0x48')],_0x2452fc['query']);_0x1bddff[_0x08b0('0x3d')]=_['intersection'](_0x2452fc[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x40f493['query']['fields']));_0x1bddff[_0x08b0('0x3d')]=_0x1bddff[_0x08b0('0x3d')]['length']?_0x1bddff[_0x08b0('0x3d')]:_0x2452fc['model'];_0x1bddff['order']=qs[_0x08b0('0xc1')](_0x40f493[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1bddff[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x40f493[_0x08b0('0x39')],_0x2452fc[_0x08b0('0x4c')]));if(_0x40f493[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1bddff[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x1bddff[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x1bddff[_0x08b0('0x3d')],function(_0x4a5bf9){var _0x3e8115={};_0x3e8115[_0x4a5bf9]={'$like':'%'+_0x40f493['query'][_0x08b0('0x29')]+'%'};return _0x3e8115;})});}_0x1bddff=_[_0x08b0('0xc4')]({},_0x1bddff,_0x40f493[_0x08b0('0xca')]);return _0x246b9b[_0x08b0('0xd9')](_0x1bddff);}})['then'](function(_0x510051){if(_0x510051){_0x13cd7a=_0x510051[_0x08b0('0x42')];if(!_0x40f493[_0x08b0('0x39')][_0x08b0('0xcf')](_0x08b0('0xcc'))){_0x1bddff[_0x08b0('0x1e')]=qs['limit'](_0x40f493[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x1bddff[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x40f493['query'][_0x08b0('0x1d')]);}return _0x246b9b[_0x08b0('0xd9')](_0x1bddff);}})[_0x08b0('0x12')](function(_0x14cf4e){if(_0x14cf4e){return _0x14cf4e?{'count':_0x13cd7a,'rows':_0x14cf4e}:null;}})['then'](respondWithResult(_0x5b9135,null))['catch'](handleError(_0x5b9135,null));};exports[_0x08b0('0xda')]=function(_0x50a992,_0x3d8ab5){var _0x1b9bdc={'raw':!![],'where':{}};var _0x37e536={};var _0x23dd41={'count':0x0,'rows':[]};return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x50a992[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x3d8ab5,null))['then'](function(_0x494102){if(_0x494102){_0x37e536[_0x08b0('0x48')]=_['keys'](db[_0x08b0('0xdb')][_0x08b0('0x4a')]);_0x37e536['query']=_[_0x08b0('0x49')](_0x50a992[_0x08b0('0x39')]);_0x37e536[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x37e536[_0x08b0('0x48')],_0x37e536['query']);_0x1b9bdc[_0x08b0('0x3d')]=_['intersection'](_0x37e536[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x50a992['query'][_0x08b0('0x4e')]));_0x1b9bdc[_0x08b0('0x3d')]=_0x1b9bdc[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1b9bdc[_0x08b0('0x3d')]:_0x37e536[_0x08b0('0x48')];if(!_0x50a992['query'][_0x08b0('0xcf')]('nolimit')){_0x1b9bdc[_0x08b0('0x1e')]=qs['limit'](_0x50a992[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x1b9bdc[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x50a992[_0x08b0('0x39')][_0x08b0('0x1d')]);}_0x1b9bdc[_0x08b0('0xc9')]=qs['sort'](_0x50a992['query'][_0x08b0('0xc1')]);_0x1b9bdc[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x50a992[_0x08b0('0x39')],_0x37e536[_0x08b0('0x4c')]));_0x1b9bdc['where']['UserId']=_0x494102['id'];if(_0x50a992['query'][_0x08b0('0x29')]){_0x1b9bdc[_0x08b0('0xc2')]=_['merge'](_0x1b9bdc[_0x08b0('0xc2')],{'$or':_['map'](_0x1b9bdc[_0x08b0('0x3d')],function(_0x2a4460){var _0x291a23={};_0x291a23[_0x2a4460]={'$like':'%'+_0x50a992[_0x08b0('0x39')]['filter']+'%'};return _0x291a23;})});}_0x1b9bdc=_[_0x08b0('0xc4')]({},_0x1b9bdc,_0x50a992[_0x08b0('0xca')]);return db[_0x08b0('0xdb')]['count']({'where':_0x1b9bdc[_0x08b0('0xc2')]})[_0x08b0('0x12')](function(_0xa23363){_0x23dd41['count']=_0xa23363;if(_0x50a992[_0x08b0('0x39')][_0x08b0('0x37')]){_0x1b9bdc[_0x08b0('0x38')]=[{'all':!![]}];}return db[_0x08b0('0xdb')][_0x08b0('0x3f')](_0x1b9bdc);})['then'](function(_0x3f2067){_0x23dd41['rows']=_0x3f2067;return _0x23dd41;});}})[_0x08b0('0x12')](respondWithFilteredResult(_0x3d8ab5,_0x1b9bdc))[_0x08b0('0x19')](handleError(_0x3d8ab5,null));};exports['getSmsInteractions']=function(_0x271236,_0x57f44e){var _0x54f612={};var _0x31fb67={};var _0x224823;var _0x1144a;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x271236[_0x08b0('0x47')]['id']}})['then'](handleEntityNotFound(_0x57f44e,null))[_0x08b0('0x12')](function(_0x114f4f){if(_0x114f4f){_0x224823=_0x114f4f;_0x31fb67['model']=_['keys'](db[_0x08b0('0xdc')][_0x08b0('0x4a')]);_0x31fb67[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x271236[_0x08b0('0x39')]);_0x31fb67['filters']=_['intersection'](_0x31fb67[_0x08b0('0x48')],_0x31fb67['query']);_0x54f612[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x31fb67['model'],qs[_0x08b0('0x4e')](_0x271236[_0x08b0('0x39')]['fields']));_0x54f612[_0x08b0('0x3d')]=_0x54f612[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x54f612['attributes']:_0x31fb67['model'];_0x54f612[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x271236[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x54f612['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x271236[_0x08b0('0x39')],_0x31fb67[_0x08b0('0x4c')]));if(_0x271236[_0x08b0('0x39')][_0x08b0('0x29')]){_0x54f612[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x54f612[_0x08b0('0xc2')],{'$or':_['map'](_0x54f612[_0x08b0('0x3d')],function(_0x29641f){var _0x3f8ae0={};_0x3f8ae0[_0x29641f]={'$like':'%'+_0x271236['query'][_0x08b0('0x29')]+'%'};return _0x3f8ae0;})});}_0x54f612=_[_0x08b0('0xc4')]({},_0x54f612,_0x271236[_0x08b0('0xca')]);return _0x224823[_0x08b0('0xdd')](_0x54f612);}})[_0x08b0('0x12')](function(_0x4454a6){if(_0x4454a6){_0x1144a=_0x4454a6[_0x08b0('0x42')];if(!_0x271236[_0x08b0('0x39')]['hasOwnProperty']('nolimit')){_0x54f612[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x271236[_0x08b0('0x39')]['limit']);_0x54f612[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x271236['query'][_0x08b0('0x1d')]);}return _0x224823[_0x08b0('0xdd')](_0x54f612);}})[_0x08b0('0x12')](function(_0x42a320){if(_0x42a320){return _0x42a320?{'count':_0x1144a,'rows':_0x42a320}:null;}})[_0x08b0('0x12')](respondWithResult(_0x57f44e,null))[_0x08b0('0x19')](handleError(_0x57f44e,null));};exports[_0x08b0('0xde')]=function(_0x50c7ad,_0x10e0da){var _0xb2dcd8={};var _0x34bd38={};var _0x440d67;var _0xe6c8d6;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x50c7ad['params']['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x10e0da,null))[_0x08b0('0x12')](function(_0x13de22){if(_0x13de22){_0x440d67=_0x13de22;_0x34bd38[_0x08b0('0x48')]=_['keys'](db['FaxInteraction'][_0x08b0('0x4a')]);_0x34bd38[_0x08b0('0x39')]=_['keys'](_0x50c7ad['query']);_0x34bd38['filters']=_[_0x08b0('0x4d')](_0x34bd38[_0x08b0('0x48')],_0x34bd38[_0x08b0('0x39')]);_0xb2dcd8['attributes']=_['intersection'](_0x34bd38['model'],qs[_0x08b0('0x4e')](_0x50c7ad['query'][_0x08b0('0x4e')]));_0xb2dcd8['attributes']=_0xb2dcd8[_0x08b0('0x3d')]['length']?_0xb2dcd8['attributes']:_0x34bd38[_0x08b0('0x48')];_0xb2dcd8['order']=qs['sort'](_0x50c7ad['query'][_0x08b0('0xc1')]);_0xb2dcd8[_0x08b0('0xc2')]=qs['filters'](_[_0x08b0('0xc3')](_0x50c7ad[_0x08b0('0x39')],_0x34bd38['filters']));if(_0x50c7ad['query'][_0x08b0('0x29')]){_0xb2dcd8['where']=_[_0x08b0('0xc4')](_0xb2dcd8[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0xb2dcd8[_0x08b0('0x3d')],function(_0x507c67){var _0x492bcc={};_0x492bcc[_0x507c67]={'$like':'%'+_0x50c7ad['query'][_0x08b0('0x29')]+'%'};return _0x492bcc;})});}_0xb2dcd8=_[_0x08b0('0xc4')]({},_0xb2dcd8,_0x50c7ad[_0x08b0('0xca')]);return _0x440d67['getFaxInteractions'](_0xb2dcd8);}})[_0x08b0('0x12')](function(_0x41344b){if(_0x41344b){_0xe6c8d6=_0x41344b[_0x08b0('0x42')];if(!_0x50c7ad[_0x08b0('0x39')]['hasOwnProperty']('nolimit')){_0xb2dcd8[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x50c7ad[_0x08b0('0x39')][_0x08b0('0x1e')]);_0xb2dcd8[_0x08b0('0x1d')]=qs['offset'](_0x50c7ad[_0x08b0('0x39')]['offset']);}return _0x440d67[_0x08b0('0xde')](_0xb2dcd8);}})[_0x08b0('0x12')](function(_0x1994e5){if(_0x1994e5){return _0x1994e5?{'count':_0xe6c8d6,'rows':_0x1994e5}:null;}})[_0x08b0('0x12')](respondWithResult(_0x10e0da,null))[_0x08b0('0x19')](handleError(_0x10e0da,null));};exports[_0x08b0('0xdf')]=function(_0x9f112b,_0x2c159c){var _0x5f110f={};var _0x3aa239={};var _0x101cf8;var _0x32caa2;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x9f112b[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x2c159c,null))[_0x08b0('0x12')](function(_0x217180){if(_0x217180){_0x101cf8=_0x217180;_0x3aa239[_0x08b0('0x48')]=_['keys'](db['WhatsappInteraction'][_0x08b0('0x4a')]);_0x3aa239[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x9f112b[_0x08b0('0x39')]);_0x3aa239[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x3aa239[_0x08b0('0x48')],_0x3aa239[_0x08b0('0x39')]);_0x5f110f[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x3aa239['model'],qs['fields'](_0x9f112b[_0x08b0('0x39')]['fields']));_0x5f110f['attributes']=_0x5f110f[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x5f110f[_0x08b0('0x3d')]:_0x3aa239[_0x08b0('0x48')];_0x5f110f[_0x08b0('0xc9')]=qs['sort'](_0x9f112b['query'][_0x08b0('0xc1')]);_0x5f110f[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x9f112b[_0x08b0('0x39')],_0x3aa239[_0x08b0('0x4c')]));if(_0x9f112b[_0x08b0('0x39')][_0x08b0('0x29')]){_0x5f110f[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x5f110f[_0x08b0('0xc2')],{'$or':_['map'](_0x5f110f[_0x08b0('0x3d')],function(_0x4783c9){var _0x409fbc={};_0x409fbc[_0x4783c9]={'$like':'%'+_0x9f112b[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x409fbc;})});}_0x5f110f=_[_0x08b0('0xc4')]({},_0x5f110f,_0x9f112b[_0x08b0('0xca')]);return _0x101cf8[_0x08b0('0xdf')](_0x5f110f);}})[_0x08b0('0x12')](function(_0x1e73e3){if(_0x1e73e3){_0x32caa2=_0x1e73e3['length'];if(!_0x9f112b['query'][_0x08b0('0xcf')]('nolimit')){_0x5f110f[_0x08b0('0x1e')]=qs['limit'](_0x9f112b[_0x08b0('0x39')][_0x08b0('0x1e')]);_0x5f110f[_0x08b0('0x1d')]=qs['offset'](_0x9f112b[_0x08b0('0x39')][_0x08b0('0x1d')]);}return _0x101cf8['getWhatsappInteractions'](_0x5f110f);}})[_0x08b0('0x12')](function(_0x14d5e3){if(_0x14d5e3){return _0x14d5e3?{'count':_0x32caa2,'rows':_0x14d5e3}:null;}})[_0x08b0('0x12')](respondWithResult(_0x2c159c,null))[_0x08b0('0x19')](handleError(_0x2c159c,null));};exports['login']=function(_0x23c198,_0x515886,_0x5713e9){var _0x3dfbee;var _0x156d7b;var _0x566849;var _0x9f316e=!_[_0x08b0('0x5b')](_0x23c198[_0x08b0('0x47')]['id'])?_0x23c198[_0x08b0('0x47')]['id']:!_[_0x08b0('0x5b')](_0x23c198[_0x08b0('0x26')]['id'])?_0x23c198['user']['id']:null;return db[_0x08b0('0x33')]['find']({'where':{'id':_0x9f316e,'role':{'$or':[_0x08b0('0x24'),_0x08b0('0x26'),_0x08b0('0x64')]}},'attributes':['id',_0x08b0('0x2d'),'phone',_0x08b0('0xe0'),_0x08b0('0x2b'),_0x08b0('0x56'),_0x08b0('0x94')]})[_0x08b0('0x12')](function(_0x51dbe3){if(_0x51dbe3){if(_0x51dbe3[_0x08b0('0x2b')]===_0x08b0('0x64')){_0x3dfbee=_0x51dbe3;if(_0x23c198[_0x08b0('0x51')]['interface']){_0x566849=util['format'](_0x08b0('0xe1'),_0x3dfbee[_0x23c198[_0x08b0('0x51')][_0x08b0('0x9f')]]);}else if(_0x23c198[_0x08b0('0x51')][_0x08b0('0xe2')]){_0x566849=util['format'](_0x08b0('0xa1'),_0x23c198[_0x08b0('0x51')][_0x08b0('0xe2')]);}else{_0x566849=util['format']('SIP/%s',_0x3dfbee[_0x08b0('0x2d')]);}socket['to'](util['format'](_0x08b0('0xe3'),_0x3dfbee[_0x08b0('0x2d')]))[_0x08b0('0x9b')](_0x08b0('0xe4'),{'user':{'id':_0x3dfbee['id'],'name':_0x3dfbee[_0x08b0('0x2d')]},'ip':_0x23c198['headers'][_0x08b0('0xe5')]||_0x23c198[_0x08b0('0xe6')][_0x08b0('0xe7')]||_0x23c198[_0x08b0('0xe8')][_0x08b0('0xe7')]||_0x23c198[_0x08b0('0xe6')][_0x08b0('0xe8')][_0x08b0('0xe7')]});return db[_0x08b0('0xa3')]['destroy']({'where':{'membername':_0x3dfbee[_0x08b0('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))](_0x08b0('0xe9'));}})[_0x08b0('0x12')](function(){if(_0x3dfbee){return _0x3dfbee['getVoiceQueues']({'raw':!![]});}})[_0x08b0('0x12')](function(_0x3f276e){if(_0x3dfbee){var _0x4e224a=[];if(_0x3f276e){_0x156d7b=_0x3f276e;if(_0x156d7b[_0x08b0('0x42')]){for(var _0x5ba6e3=0x0;_0x5ba6e3<_0x156d7b[_0x08b0('0x42')];_0x5ba6e3++){_0x4e224a[_0x08b0('0x3e')]({'membername':_0x3dfbee['name'],'UserId':_0x3dfbee['id'],'queue_name':_0x156d7b[_0x5ba6e3]['name'],'VoiceQueueId':_0x156d7b[_0x5ba6e3]['id'],'interface':_0x566849,'paused':_0x3dfbee[_0x08b0('0x94')]||![],'penalty':_0x156d7b[_0x5ba6e3]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x08b0('0x80')](_0x4e224a,function(_0x17e160){return db[_0x08b0('0xa3')]['upsert'](_0x17e160);});}}}})[_0x08b0('0x12')](function(){if(_0x3dfbee){return db[_0x08b0('0xea')][_0x08b0('0x3f')]({'where':{'membername':_0x3dfbee[_0x08b0('0x2d')],'exitAt':null}});}})[_0x08b0('0x12')](function(_0x57398b){if(_0x3dfbee){var _0x3f17cd=[];_0x57398b[_0x08b0('0xeb')](function(_0x18e7dd){_0x3f17cd[_0x08b0('0x3e')](_0x18e7dd[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec'))}));});return BPromise[_0x08b0('0x50')](_0x3f17cd);}})[_0x08b0('0x12')](function(){if(_0x3dfbee){var _0x296c5d=[];var _0xce7c59=[];var _0x405956=utils[_0x08b0('0xed')]();var _0x54e385={'membername':_0x3dfbee['name'],'interface':_0x566849,'enterAt':moment()[_0x08b0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3dfbee['role'],'internal':_0x3dfbee[_0x08b0('0x56')]};_0x405956[_0x08b0('0xeb')](function(_0x4e4a29){_0x296c5d[_0x08b0('0x3e')](_[_0x08b0('0xc4')]({'channel':_0x4e4a29,'type':'LOGIN','data1':_0x23c198[_0x08b0('0x51')]['device'],'data2':_0x566849},_0x54e385));if(_0x3dfbee[_0x08b0('0x94')]){_0xce7c59['push'](_[_0x08b0('0xc4')]({'channel':_0x4e4a29,'type':_0x08b0('0xee'),'data1':_0x08b0('0xef')},_0x54e385));}});return db['MemberReport'][_0x08b0('0x7c')](_0x296c5d[_0x08b0('0xf0')](_0xce7c59),{'individualHooks':!![]});}})[_0x08b0('0x12')](function(){if(_0x3dfbee){return _0x3dfbee[_0x08b0('0x22')]({'online':!![],'lastLoginAt':moment()['format'](_0x08b0('0xec')),'voicePause':_0x3dfbee[_0x08b0('0x94')]||![],'mailPause':_0x3dfbee[_0x08b0('0x94')]||![],'chatPause':_0x3dfbee['loginInPause']||![],'faxPause':_0x3dfbee[_0x08b0('0x94')]||![],'smsPause':_0x3dfbee[_0x08b0('0x94')]||![],'openchannelPause':_0x3dfbee[_0x08b0('0x94')]||![],'whatsappPause':_0x3dfbee[_0x08b0('0x94')]||![],'pauseType':_0x3dfbee[_0x08b0('0x94')]?_0x08b0('0xef'):null,'interface':_0x566849,'lastPauseAt':moment()[_0x08b0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x08b0('0x12')](function(_0x411ff6){if(_0x23c198[_0x08b0('0xf1')]){return _0x5713e9();}else{return BPromise[_0x08b0('0xf2')](_0x411ff6)[_0x08b0('0x12')](respondWithResult(_0x515886,null));}})[_0x08b0('0x19')](handleError(_0x515886,null));};exports[_0x08b0('0xf3')]=function(_0x42792d,_0x5107f4){var _0x2fe9b1;return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x42792d['params']['id'],'role':_0x08b0('0x64')},'attributes':['id','name','role']})[_0x08b0('0x12')](handleEntityNotFound(_0x5107f4,null))[_0x08b0('0x12')](function(_0x589d27){if(_0x589d27){_0x2fe9b1=_0x589d27;return db[_0x08b0('0xa3')]['destroy']({'where':{'membername':_0x2fe9b1[_0x08b0('0x2d')]},'individualHooks':!![]});}})['then'](function(){return db[_0x08b0('0xea')][_0x08b0('0x3f')]({'where':{'membername':_0x2fe9b1[_0x08b0('0x2d')],'exitAt':null}});})[_0x08b0('0x12')](function(_0x3468a9){var _0x5c818e=[];_0x3468a9[_0x08b0('0xeb')](function(_0x5c7250){_0x5c818e['push'](_0x5c7250[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec'))}));});return BPromise[_0x08b0('0x50')](_0x5c818e);})[_0x08b0('0x12')](function(){return _0x2fe9b1[_0x08b0('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x5107f4,null))[_0x08b0('0x19')](handleError(_0x5107f4,null));};exports[_0x08b0('0xf4')]=function(_0x21fe5f,_0x542dee){var _0x310f6c;return db[_0x08b0('0xa3')]['update']({'paused':0x1},{'where':{'UserId':_0x21fe5f[_0x08b0('0x47')]['id']},'individualHooks':!![]})[_0x08b0('0x12')](function(){return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x21fe5f[_0x08b0('0x47')]['id'],'role':_0x08b0('0x64')},'attributes':['id',_0x08b0('0x2d'),_0x08b0('0x2b'),_0x08b0('0x56'),'interface']});})[_0x08b0('0x12')](handleEntityNotFound(_0x542dee,null))[_0x08b0('0x12')](function(_0x28a26e){if(_0x28a26e){_0x310f6c=_0x28a26e;return respondWithRpcPromise('QueuePause','pause',{'id':_0x310f6c['id'],'name':_0x310f6c['name'],'pause':!![]});}})[_0x08b0('0x12')](function(){if(_0x310f6c){return db[_0x08b0('0xea')][_0x08b0('0x3f')]({'where':{'membername':_0x310f6c[_0x08b0('0x2d')],'type':'PAUSE','exitAt':null}});}})[_0x08b0('0x12')](function(_0x18b826){if(_0x18b826['length']){var _0x4ee05f=moment()[_0x08b0('0xa0')](_0x08b0('0xec'));for(var _0x3672c2=0x0,_0x49afaf=_0x18b826[_0x08b0('0x42')];_0x3672c2<_0x49afaf;_0x3672c2++){_0x18b826[_0x3672c2][_0x08b0('0xf5')]({'exitAt':_0x4ee05f});}}})[_0x08b0('0x12')](function(){var _0x387a2a=[];var _0x16a8b6=utils[_0x08b0('0xed')]();_0x16a8b6[_0x08b0('0xeb')](function(_0x54f0af){_0x387a2a[_0x08b0('0x3e')]({'channel':_0x54f0af,'membername':_0x310f6c[_0x08b0('0x2d')],'interface':_[_0x08b0('0x5b')](_0x310f6c[_0x08b0('0x9f')])?util[_0x08b0('0xa0')](_0x08b0('0xa1'),_0x310f6c[_0x08b0('0x2d')]):_0x310f6c[_0x08b0('0x9f')],'type':_0x08b0('0xee'),'enterAt':moment()[_0x08b0('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x21fe5f['body']['type']||_0x08b0('0xf6'),'role':_0x310f6c[_0x08b0('0x2b')],'internal':_0x310f6c[_0x08b0('0x56')]});});return db[_0x08b0('0xea')][_0x08b0('0x7c')](_0x387a2a,{'individualHooks':!![]});})[_0x08b0('0x12')](function(){return _0x310f6c[_0x08b0('0x22')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x21fe5f['body'][_0x08b0('0xf7')]||_0x08b0('0xf6'),'lastPauseAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec'))});})[_0x08b0('0x12')](respondWithResult(_0x542dee,null))[_0x08b0('0x19')](handleError(_0x542dee,null));};exports['unpause']=function(_0x8793a6,_0x3d9cce){var _0x388dec;return db[_0x08b0('0x33')][_0x08b0('0x2c')]({'where':{'id':_0x8793a6['params']['id']},'attributes':['id','name',_0x08b0('0x2b'),_0x08b0('0x95'),_0x08b0('0xf8'),_0x08b0('0xf9'),_0x08b0('0xfa'),_0x08b0('0xfb'),'smsPause',_0x08b0('0xfc'),'pauseType',_0x08b0('0xfd')]})[_0x08b0('0x12')](handleEntityNotFound(_0x3d9cce,null))[_0x08b0('0x12')](function(_0x31edfd){if(_0x31edfd){_0x388dec=_0x31edfd;if(_0x8793a6[_0x08b0('0x51')]['channel']&&!utils['isValidChannel'](_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')])){throw new db[(_0x08b0('0x85'))][(_0x08b0('0x86'))]('Unknown\x20channel');}switch(_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')]){case _0x08b0('0x9d'):return respondWithRpcPromise(_0x08b0('0xfe'),_0x08b0('0xff'),{'id':_0x388dec['id'],'name':_0x388dec['name'],'pause':![]})['then'](function(){return db[_0x08b0('0xa3')][_0x08b0('0x22')]({'paused':0x0},{'where':{'UserId':_0x388dec['id']},'individualHooks':!![]});})[_0x08b0('0x12')](function(){return db[_0x08b0('0xea')]['find']({'where':{'channel':_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')],'membername':_0x388dec[_0x08b0('0x2d')],'type':_0x08b0('0xee'),'exitAt':null}});})[_0x08b0('0x12')](function(_0x2ce05c){if(_0x2ce05c){return _0x2ce05c[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec')),'data2':_0x08b0('0x100')},{'individualHooks':!![]});}return null;})[_0x08b0('0x12')](function(){return _0x388dec[_0x08b0('0x22')]({'voicePause':![]});});case _0x08b0('0xb5'):case'chat':case'fax':case _0x08b0('0x45'):case'whatsapp':case _0x08b0('0x101'):return db[_0x08b0('0xea')][_0x08b0('0x2c')]({'where':{'channel':_0x8793a6[_0x08b0('0x51')][_0x08b0('0x92')],'membername':_0x388dec[_0x08b0('0x2d')],'type':_0x08b0('0xee'),'exitAt':null}})['then'](function(_0x5c0a5d){if(_0x5c0a5d){return _0x5c0a5d[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec')),'data2':_0x08b0('0x100')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x364f81={};_['set'](_0x364f81,util[_0x08b0('0xa0')]('%s%s',_0x8793a6['body'][_0x08b0('0x92')],_0x08b0('0x102')),![]);return _0x388dec[_0x08b0('0x22')](_0x364f81);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x388dec['id'],'name':_0x388dec['name'],'pause':![]})['then'](function(){return db[_0x08b0('0xa3')]['update']({'paused':0x0},{'where':{'UserId':_0x388dec['id']}});})[_0x08b0('0x12')](function(){return db[_0x08b0('0xea')]['findAll']({'where':{'membername':_0x388dec[_0x08b0('0x2d')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x56b143){var _0x39607f=[];_0x56b143[_0x08b0('0xeb')](function(_0x5c78cf){_0x39607f[_0x08b0('0x3e')](_0x5c78cf[_0x08b0('0x22')]({'exitAt':moment()[_0x08b0('0xa0')](_0x08b0('0xec')),'data2':'manual'}));});return BPromise[_0x08b0('0x50')](_0x39607f);})[_0x08b0('0x12')](function(){return _0x388dec['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x08b0('0x12')](respondWithResult(_0x3d9cce,null))[_0x08b0('0x19')](handleError(_0x3d9cce,null));};exports[_0x08b0('0x103')]=function(_0x23e198,_0x3463ec){var _0x1a4b9c={};var _0x4a845b={};var _0x3898cf;var _0x28f765;return db['User'][_0x08b0('0x8b')]({'where':{'id':_0x23e198[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x3463ec,null))[_0x08b0('0x12')](function(_0x18b46e){if(_0x18b46e){_0x3898cf=_0x18b46e;_0x4a845b['model']=_[_0x08b0('0x49')](db[_0x08b0('0x104')]['rawAttributes']);_0x4a845b[_0x08b0('0x39')]=_['keys'](_0x23e198[_0x08b0('0x39')]);_0x4a845b[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x4a845b[_0x08b0('0x48')],_0x4a845b['query']);_0x1a4b9c[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x4a845b[_0x08b0('0x48')],qs['fields'](_0x23e198[_0x08b0('0x39')][_0x08b0('0x4e')]));_0x1a4b9c[_0x08b0('0x3d')]=_0x1a4b9c[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1a4b9c[_0x08b0('0x3d')]:_0x4a845b[_0x08b0('0x48')];_0x1a4b9c[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x23e198[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1a4b9c['where']=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x23e198[_0x08b0('0x39')],_0x4a845b[_0x08b0('0x4c')]));if(_0x23e198[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1a4b9c[_0x08b0('0xc2')]=_[_0x08b0('0xc4')](_0x1a4b9c[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x1a4b9c[_0x08b0('0x3d')],function(_0x183256){var _0xc0f72a={};_0xc0f72a[_0x183256]={'$like':'%'+_0x23e198[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0xc0f72a;})});}_0x1a4b9c=_[_0x08b0('0xc4')]({},_0x1a4b9c,_0x23e198[_0x08b0('0xca')]);return _0x3898cf[_0x08b0('0x103')](_0x1a4b9c);}})['then'](function(_0x48be78){if(_0x48be78){_0x28f765=_0x48be78[_0x08b0('0x42')];if(!_0x23e198['query']['hasOwnProperty'](_0x08b0('0xcc'))){_0x1a4b9c[_0x08b0('0x1e')]=qs['limit'](_0x23e198['query'][_0x08b0('0x1e')]);_0x1a4b9c[_0x08b0('0x1d')]=qs[_0x08b0('0x1d')](_0x23e198[_0x08b0('0x39')]['offset']);}return _0x3898cf[_0x08b0('0x103')](_0x1a4b9c);}})[_0x08b0('0x12')](function(_0x2867b2){if(_0x2867b2){return _0x2867b2?{'count':_0x28f765,'rows':_0x2867b2}:null;}})['then'](respondWithResult(_0x3463ec,null))[_0x08b0('0x19')](handleError(_0x3463ec,null));};exports[_0x08b0('0x105')]=function(_0x5cfdd9,_0x433fc5){return db[_0x08b0('0x33')]['find']({'where':{'id':_0x5cfdd9[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x433fc5,null))[_0x08b0('0x12')](function(_0x50a5c3){if(_0x50a5c3){var _0x1abd59=_0x50a5c3[_0x08b0('0x23')]({'plain':!![]});return _0x50a5c3[_0x08b0('0x105')](_0x5cfdd9[_0x08b0('0x51')]['ids'],_[_0x08b0('0x55')](_0x5cfdd9['body'],['ids','id'])||{})[_0x08b0('0x12')](function(){for(var _0x4da5a3=0x0;_0x4da5a3<_0x5cfdd9['body'][_0x08b0('0x54')][_0x08b0('0x42')];_0x4da5a3++){var _0x5be695=[];var _0x5e0b50={};db['Team'][_0x08b0('0x8b')]({'where':{'id':_0x5cfdd9[_0x08b0('0x51')][_0x08b0('0x54')][_0x4da5a3]}})[_0x08b0('0x12')](function(_0x1fd3e1){_0x5e0b50=_0x1fd3e1[_0x08b0('0x44')];_0x5be695['push'](_0x1fd3e1['getVoiceQueues']()[_0x08b0('0x12')](function(_0x51ea76){for(var _0x10900f=0x0;_0x10900f<_0x51ea76['length'];_0x10900f++){_0x51ea76[_0x10900f][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x107'));}return _0x51ea76;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1['getChatQueues']()['then'](function(_0x5d96d8){for(var _0x29610a=0x0;_0x29610a<_0x5d96d8[_0x08b0('0x42')];_0x29610a++){_0x5d96d8[_0x29610a][_0x08b0('0x106')](_0x08b0('0x92'),'Chat');}return _0x5d96d8;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1['getMailQueues']()['then'](function(_0x14725d){for(var _0x3f3411=0x0;_0x3f3411<_0x14725d['length'];_0x3f3411++){_0x14725d[_0x3f3411][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x108'));}return _0x14725d;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1[_0x08b0('0x109')]()[_0x08b0('0x12')](function(_0x54badb){for(var _0x31f729=0x0;_0x31f729<_0x54badb[_0x08b0('0x42')];_0x31f729++){_0x54badb[_0x31f729][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x10a'));}return _0x54badb;}));_0x5be695['push'](_0x1fd3e1[_0x08b0('0x10b')]()[_0x08b0('0x12')](function(_0x187f10){for(var _0x424599=0x0;_0x424599<_0x187f10['length'];_0x424599++){_0x187f10[_0x424599][_0x08b0('0x106')](_0x08b0('0x92'),'Whatsapp');}return _0x187f10;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1[_0x08b0('0x10c')]()['then'](function(_0x26a999){for(var _0x322178=0x0;_0x322178<_0x26a999[_0x08b0('0x42')];_0x322178++){_0x26a999[_0x322178][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x10d'));}return _0x26a999;}));_0x5be695[_0x08b0('0x3e')](_0x1fd3e1[_0x08b0('0x10e')]()[_0x08b0('0x12')](function(_0x31c8bd){for(var _0x2d7687=0x0;_0x2d7687<_0x31c8bd[_0x08b0('0x42')];_0x2d7687++){_0x31c8bd[_0x2d7687][_0x08b0('0x106')](_0x08b0('0x92'),'Openchannel');}return _0x31c8bd;}));return BPromise['all'](_0x5be695);})[_0x08b0('0x12')](function(_0x3a9917){var _0x37df1c=_['flatten'](_0x3a9917);_0x5be695=[];return db[_0x08b0('0x5c')]['transaction'](function(_0x1ded3c){for(var _0x254881=0x0;_0x254881<_0x37df1c['length'];_0x254881++){_0x5be695[_0x08b0('0x3e')](_0x37df1c[_0x254881][_0x08b0('0x10f')](_0x1abd59['id']),{'transaction':_0x1ded3c});}return BPromise[_0x08b0('0x50')](_0x5be695)[_0x08b0('0x12')](function(){if(_0x1abd59[_0x08b0('0x93')]){return BPromise[_0x08b0('0x80')](_['filter'](_0x37df1c,function(_0xcd4ca4){return _0xcd4ca4[_0x08b0('0x110')]('channel')===_0x08b0('0x107');}),function(_0x339a0e){return db[_0x08b0('0xa3')][_0x08b0('0xa4')]({'membername':_0x1abd59[_0x08b0('0x2d')],'UserId':_0x1abd59['id'],'queue_name':_0x339a0e[_0x08b0('0x2d')],'VoiceQueueId':_0x339a0e['id'],'interface':_[_0x08b0('0x5b')](_0x1abd59[_0x08b0('0x9f')])?util['format'](_0x08b0('0xa1'),_0x1abd59[_0x08b0('0x2d')]):_0x1abd59[_0x08b0('0x9f')],'paused':_0x1abd59['voicePause']||![],'penalty':_0x1abd59['penalty']},{'transaction':_0x1ded3c});});}else{return;}})[_0x08b0('0x12')](function(){for(var _0x2a4965=0x0;_0x2a4965<_0x37df1c[_0x08b0('0x42')];_0x2a4965++){var _0x2cc619=_0x37df1c[_0x2a4965]['getDataValue'](_0x08b0('0x92'));var _0xcccdbc=_0x2cc619+_0x08b0('0x111');socket[_0x08b0('0x9b')](_0x08b0('0x26')+_0x2cc619+_0x08b0('0x9c'),{'UserId':_0x1abd59['id'],['queueField']:_0x37df1c[_0x2a4965]['id']});}});});})['then'](function(){db[_0x08b0('0x112')][_0x08b0('0x8b')]({'where':{'teamId':_0x5e0b50['id']}})[_0x08b0('0x12')](function(_0x21a22f){if(_0x21a22f){db[_0x08b0('0x113')][_0x08b0('0x72')]({'UserId':_0x5cfdd9[_0x08b0('0x47')]['id'],'VoicePrefixId':_0x21a22f[_0x08b0('0x114')]});}});});}});}})[_0x08b0('0x12')](respondWithStatusCode(_0x433fc5,null))['catch'](handleError(_0x433fc5,null));};exports[_0x08b0('0x115')]=function(_0x5c4638,_0x13b95e){return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x5c4638[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x13b95e,null))[_0x08b0('0x12')](function(_0x526c65){if(_0x526c65){var _0x1dbad1=_0x526c65[_0x08b0('0x23')]({'plain':!![]});var _0xd25135=_0x5c4638[_0x08b0('0x39')][_0x08b0('0x54')];return _0x526c65[_0x08b0('0x115')](_0xd25135)[_0x08b0('0x12')](function(){for(var _0x234ef1=0x0;_0x234ef1<_0xd25135[_0x08b0('0x42')];_0x234ef1++){var _0x2c9ec2=[];var _0x5462f6={};db['Team'][_0x08b0('0x8b')]({'where':{'id':_0xd25135[_0x234ef1]}})[_0x08b0('0x12')](function(_0x2c0022){_0x5462f6=_0x2c0022['dataValues'];_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x116')]()[_0x08b0('0x12')](function(_0x4c7c07){for(var _0x4e048b=0x0;_0x4e048b<_0x4c7c07['length'];_0x4e048b++){_0x4c7c07[_0x4e048b]['setDataValue'](_0x08b0('0x92'),_0x08b0('0x107'));}return _0x4c7c07;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x117')]()[_0x08b0('0x12')](function(_0x40a4fc){for(var _0x1adfa1=0x0;_0x1adfa1<_0x40a4fc['length'];_0x1adfa1++){_0x40a4fc[_0x1adfa1][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x118'));}return _0x40a4fc;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x119')]()[_0x08b0('0x12')](function(_0x400d81){for(var _0x38cfe4=0x0;_0x38cfe4<_0x400d81[_0x08b0('0x42')];_0x38cfe4++){_0x400d81[_0x38cfe4][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x108'));}return _0x400d81;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x109')]()[_0x08b0('0x12')](function(_0x35162d){for(var _0xbb36f=0x0;_0xbb36f<_0x35162d[_0x08b0('0x42')];_0xbb36f++){_0x35162d[_0xbb36f][_0x08b0('0x106')](_0x08b0('0x92'),_0x08b0('0x10a'));}return _0x35162d;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x10b')]()['then'](function(_0x36dc90){for(var _0x12d77a=0x0;_0x12d77a<_0x36dc90[_0x08b0('0x42')];_0x12d77a++){_0x36dc90[_0x12d77a][_0x08b0('0x106')]('channel',_0x08b0('0x11a'));}return _0x36dc90;}));_0x2c9ec2[_0x08b0('0x3e')](_0x2c0022[_0x08b0('0x10c')]()[_0x08b0('0x12')](function(_0x1ff18c){for(var _0x4a9142=0x0;_0x4a9142<_0x1ff18c[_0x08b0('0x42')];_0x4a9142++){_0x1ff18c[_0x4a9142]['setDataValue'](_0x08b0('0x92'),_0x08b0('0x10d'));}return _0x1ff18c;}));_0x2c9ec2['push'](_0x2c0022[_0x08b0('0x10e')]()[_0x08b0('0x12')](function(_0xea3ddc){for(var _0x69eb41=0x0;_0x69eb41<_0xea3ddc[_0x08b0('0x42')];_0x69eb41++){_0xea3ddc[_0x69eb41]['setDataValue']('channel',_0x08b0('0x11b'));}return _0xea3ddc;}));return BPromise['all'](_0x2c9ec2);})[_0x08b0('0x12')](function(_0x1c56f9){var _0x3dc7a2=_['flatten'](_0x1c56f9);_0x2c9ec2=[];return db[_0x08b0('0x5c')][_0x08b0('0x11c')](function(_0x1c5160){for(var _0x19c6b5=0x0;_0x19c6b5<_0x3dc7a2[_0x08b0('0x42')];_0x19c6b5++){_0x2c9ec2['push'](_0x3dc7a2[_0x19c6b5]['removeAgent'](_0x1dbad1['id']),{'transaction':_0x1c5160});}return BPromise['all'](_0x2c9ec2)[_0x08b0('0x12')](function(){if(_0x1dbad1['online']){return BPromise[_0x08b0('0x80')](_[_0x08b0('0x29')](_0x3dc7a2,function(_0x20c3d3){return _0x20c3d3['getDataValue'](_0x08b0('0x92'))==='Voice';}),function(_0x322f75){return db[_0x08b0('0xa3')][_0x08b0('0x2e')]({'where':{'VoiceQueueId':_0x322f75['id'],'UserId':_0x1dbad1['id']},'transaction':_0x1c5160});});}else{return;}})[_0x08b0('0x12')](function(){db['TeamVoicePrefix'][_0x08b0('0x8b')]({'where':{'teamId':_0x5462f6['id']}})[_0x08b0('0x12')](function(_0x20894f){if(_0x20894f){return db[_0x08b0('0x113')]['destroy']({'where':{'UserId':_0x1dbad1['id'],'VoicePrefixId':_0x20894f[_0x08b0('0x44')][_0x08b0('0x114')]}});}});})['then'](function(){for(var _0x4e1f16=0x0;_0x4e1f16<_0x3dc7a2[_0x08b0('0x42')];_0x4e1f16++){var _0x68d481=_0x3dc7a2[_0x4e1f16][_0x08b0('0x110')](_0x08b0('0x92'));var _0x1ff12d=_0x68d481+_0x08b0('0x111');socket[_0x08b0('0x9b')](_0x08b0('0x26')+_0x68d481+_0x08b0('0xa8'),{'UserId':_0x1dbad1['id'],['queueField']:_0x3dc7a2[_0x4e1f16]['id']});}});});});}});}})[_0x08b0('0x12')](respondWithStatusCode(_0x13b95e,null))['catch'](handleError(_0x13b95e,null));};exports[_0x08b0('0x11d')]=function(_0x45b336,_0x4cb4cd){var _0x1f9f45={};var _0x29a08d={};var _0x1eb505;var _0x340e2f;return db[_0x08b0('0x33')][_0x08b0('0x8b')]({'where':{'id':_0x45b336[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0x4cb4cd,null))[_0x08b0('0x12')](function(_0x49dc26){if(_0x49dc26){_0x1eb505=_0x49dc26;_0x29a08d[_0x08b0('0x48')]=_['keys'](db[_0x08b0('0x11e')][_0x08b0('0x4a')]);_0x29a08d[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x45b336['query']);_0x29a08d[_0x08b0('0x4c')]=_['intersection'](_0x29a08d[_0x08b0('0x48')],_0x29a08d[_0x08b0('0x39')]);_0x1f9f45[_0x08b0('0x3d')]=_[_0x08b0('0x4d')](_0x29a08d[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x45b336[_0x08b0('0x39')][_0x08b0('0x4e')]));_0x1f9f45[_0x08b0('0x3d')]=_0x1f9f45[_0x08b0('0x3d')][_0x08b0('0x42')]?_0x1f9f45[_0x08b0('0x3d')]:_0x29a08d[_0x08b0('0x48')];_0x1f9f45[_0x08b0('0xc9')]=qs[_0x08b0('0xc1')](_0x45b336[_0x08b0('0x39')][_0x08b0('0xc1')]);_0x1f9f45[_0x08b0('0xc2')]=qs[_0x08b0('0x4c')](_[_0x08b0('0xc3')](_0x45b336['query'],_0x29a08d[_0x08b0('0x4c')]));if(_0x45b336[_0x08b0('0x39')][_0x08b0('0x29')]){_0x1f9f45[_0x08b0('0xc2')]=_['merge'](_0x1f9f45[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0x1f9f45[_0x08b0('0x3d')],function(_0x8a700a){var _0x1bc2fc={};_0x1bc2fc[_0x8a700a]={'$like':'%'+_0x45b336[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x1bc2fc;})});}_0x1f9f45=_[_0x08b0('0xc4')]({},_0x1f9f45,_0x45b336[_0x08b0('0xca')]);return _0x1eb505[_0x08b0('0x11d')](_0x1f9f45);}})[_0x08b0('0x12')](function(_0x361018){if(_0x361018){_0x340e2f=_0x361018[_0x08b0('0x42')];if(!_0x45b336[_0x08b0('0x39')]['hasOwnProperty'](_0x08b0('0xcc'))){_0x1f9f45[_0x08b0('0x1e')]=qs[_0x08b0('0x1e')](_0x45b336['query'][_0x08b0('0x1e')]);_0x1f9f45[_0x08b0('0x1d')]=qs['offset'](_0x45b336['query']['offset']);}return _0x1eb505[_0x08b0('0x11d')](_0x1f9f45);}})['then'](function(_0x330f7a){if(_0x330f7a){return _0x330f7a?{'count':_0x340e2f,'rows':_0x330f7a}:null;}})['then'](respondWithResult(_0x4cb4cd,null))[_0x08b0('0x19')](handleError(_0x4cb4cd,null));};exports[_0x08b0('0x11f')]=function(_0x576111,_0xbd7ba){var _0xaa9567={};var _0x2fc58c={};var _0x4728ac;return db[_0x08b0('0x33')]['findOne']({'where':{'id':_0x576111[_0x08b0('0x47')]['id']}})[_0x08b0('0x12')](handleEntityNotFound(_0xbd7ba,null))[_0x08b0('0x12')](function(_0x2386d5){if(_0x2386d5){_0x4728ac=_0x2386d5;_0x2fc58c[_0x08b0('0x48')]=_[_0x08b0('0x49')](db[_0x08b0('0x33')][_0x08b0('0x4a')]);_0x2fc58c[_0x08b0('0x39')]=_[_0x08b0('0x49')](_0x576111[_0x08b0('0x39')]);_0x2fc58c[_0x08b0('0x4c')]=_[_0x08b0('0x4d')](_0x2fc58c[_0x08b0('0x48')],_0x2fc58c['query']);_0xaa9567['attributes']=_[_0x08b0('0x4d')](_0x2fc58c[_0x08b0('0x48')],qs[_0x08b0('0x4e')](_0x576111[_0x08b0('0x39')][_0x08b0('0x4e')]));_0xaa9567[_0x08b0('0x3d')]=_0xaa9567[_0x08b0('0x3d')][_0x08b0('0x42')]?_0xaa9567['attributes']:_0x2fc58c[_0x08b0('0x48')];_0xaa9567[_0x08b0('0xc9')]=qs['sort'](_0x576111[_0x08b0('0x39')][_0x08b0('0xc1')]);_0xaa9567[_0x08b0('0xc2')]=qs['filters'](_[_0x08b0('0xc3')](_0x576111[_0x08b0('0x39')],_0x2fc58c[_0x08b0('0x4c')]));if(_0x576111['query'][_0x08b0('0x29')]){_0xaa9567[_0x08b0('0xc2')]=_['merge'](_0xaa9567[_0x08b0('0xc2')],{'$or':_[_0x08b0('0x34')](_0xaa9567[_0x08b0('0x3d')],function(_0x53ae82){var _0x1334d3={};_0x1334d3[_0x53ae82]={'$like':'%'+_0x576111[_0x08b0('0x39')][_0x08b0('0x29')]+'%'};return _0x1334d3;})});}_0xaa9567[_0x08b0('0x48')]=db['User'];_0xaa9567['as']=_0x08b0('0x79');_0xaa9567=_[_0x08b0('0xc4')]({},_0xaa9567,_0x576111[_0x08b0('0xca')]);return _0x4728ac[_0x08b0('0x116')]({'include':[_0xaa9567]});}})['then'](function(_0x1fa05b){if(_0x1fa05b){var _0x44bbe2={},_0x875fc5=[];for(var _0x32d97f=0x0;_0x32d97f<_0x1fa05b[_0x08b0('0x42')];_0x32d97f+=0x1){for(var _0xf510c5=0x0,_0xcfb992;_0xf510c5<_0x1fa05b[_0x32d97f][_0x08b0('0x79')]['length'];_0xf510c5+=0x1){_0xcfb992=_0x1fa05b[_0x32d97f][_0x08b0('0x79')][_0xf510c5][_0x08b0('0x23')]({'plain':!![]});_0x44bbe2[_0xcfb992['id']]=_0xcfb992;}}_0x44bbe2=_[_0x08b0('0x120')](_0x44bbe2);for(var _0x4637df=qs[_0x08b0('0x1d')](_0x576111[_0x08b0('0x39')][_0x08b0('0x1d')]);_0x4637df<_0x44bbe2[_0x08b0('0x42')]&&_0x875fc5[_0x08b0('0x42')]=_0x30fc1e){_0x4c81dd=_0x30fc1e;_0xfb9dc9=0xc8;}else{_0xfb9dc9=0xce;}_0x1f6c7d[_0x620d('0x1f')](_0xfb9dc9);return _0x1f6c7d[_0x620d('0x26')](_0x620d('0x27'),_0x33dec8+'-'+_0x4c81dd+'/'+_0x30fc1e)[_0x620d('0x21')](_0x10f3e3);}return null;};}function saveUpdates(_0x241cc8){return function(_0x153a6a){if(_0x153a6a){return _0x153a6a[_0x620d('0x28')](_0x241cc8)[_0x620d('0x14')](function(_0x5003f5){return _0x5003f5;});}return null;};}function removeEntity(_0x34490c){return function(_0x26ae5d){if(_0x26ae5d){return _0x26ae5d['destroy']()[_0x620d('0x14')](function(){var _0x3d570f=_0x26ae5d['get']({'plain':!![]});if(_0x3d570f['role']===_0x620d('0x29'))return;var _0x2e790e=[{'name':_0x620d('0x2a'),'value':_0x620d('0x2b'),'ignore':!![]},{'name':_0x620d('0x2c'),'value':'agent','ignore':![]},{'name':_0x620d('0x2d'),'value':_0x620d('0x2e'),'ignore':![]}];var _0x3628a1=_(_0x2e790e)[_0x620d('0x2f')]('ignore')['map'](_0x620d('0x30'))[_0x620d('0x30')]();if(_[_0x620d('0x31')](_0x3628a1,_0x3d570f[_0x620d('0x32')])){return;}var _0x14d400=_[_0x620d('0x33')](_0x2e790e,[_0x620d('0x30'),_0x3d570f[_0x620d('0x32')]])[_0x620d('0x34')];return db[_0x620d('0x35')]['destroy']({'where':{'type':_0x14d400,'resourceId':_0x3d570f['id']}})['then'](function(){return _0x26ae5d;});})[_0x620d('0x14')](function(){_0x34490c[_0x620d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5717cf){return function(_0x500364){if(!_0x500364){_0x5717cf[_0x620d('0x1e')](0x194);}return _0x500364;};}function handleError(_0x440df0,_0x4f738d){_0x4f738d=_0x4f738d||0x1f4;return function(_0x4832ed){logger[_0x620d('0x1a')](_0x4832ed[_0x620d('0x36')]);if(_0x4832ed['name']){delete _0x4832ed[_0x620d('0x34')];}_0x440df0[_0x620d('0x1f')](_0x4f738d)[_0x620d('0x37')](_0x4832ed);};}exports['index']=function(_0x589681,_0x4428b1){var _0x2735ff={},_0x1ce4e1={'count':0x0,'rows':[]};var _0x2a4556=_(db['User'][_0x620d('0x38')])[_0x620d('0x39')](function(_0x228e11){return{'name':_0x228e11[_0x620d('0x3a')],'type':_0x228e11[_0x620d('0x3b')][_0x620d('0x3c')]};})[_0x620d('0x2f')](function(_0x2d7170){return!_[_0x620d('0x31')](['password',_0x620d('0x3d')],_0x2d7170[_0x620d('0x34')]);})[_0x620d('0x30')]();_0x2735ff=qs[_0x620d('0x3e')](_0x2a4556,_0x589681);var _0x3250d1={'where':_0x2735ff[_0x620d('0x3f')]};return db[_0x620d('0x40')][_0x620d('0x25')](_0x3250d1)[_0x620d('0x14')](function(_0x686b62){_0x1ce4e1[_0x620d('0x25')]=_0x686b62;if(_0x589681[_0x620d('0x41')][_0x620d('0x42')]){_0x2735ff[_0x620d('0x43')]=[{'all':!![]}];}if(_0x589681['query']['userSetting']===_0x620d('0x44')){_0x2735ff['include']=[{'model':db[_0x620d('0x45')],'as':_0x620d('0x46')}];}if(!_[_0x620d('0x31')](_0x2735ff[_0x620d('0x47')],'id')){_0x2735ff[_0x620d('0x47')][_0x620d('0x48')]('id');}return db['User'][_0x620d('0x49')](_0x2735ff);})[_0x620d('0x14')](function(_0x3856e5){_0x1ce4e1['rows']=_0x3856e5;if(_0x589681[_0x620d('0x41')][_0x620d('0x4a')]===_0x620d('0x44')){var _0x19426b=[];for(var _0x3481c2=0x0;_0x3481c2<_0x1ce4e1[_0x620d('0x4b')][_0x620d('0x4c')];_0x3481c2++){_0x19426b[_0x620d('0x48')](get_open_tabs(_0x620d('0x4d'),_0x1ce4e1[_0x620d('0x4b')][_0x3481c2][_0x620d('0x4e')]));_0x19426b['push'](get_open_tabs(_0x620d('0x4f'),_0x1ce4e1[_0x620d('0x4b')][_0x3481c2][_0x620d('0x4e')]));_0x19426b[_0x620d('0x48')](get_open_tabs(_0x620d('0x50'),_0x1ce4e1['rows'][_0x3481c2][_0x620d('0x4e')]));_0x19426b[_0x620d('0x48')](get_open_tabs(_0x620d('0x51'),_0x1ce4e1['rows'][_0x3481c2][_0x620d('0x4e')]));_0x19426b[_0x620d('0x48')](get_open_tabs(_0x620d('0x52'),_0x1ce4e1['rows'][_0x3481c2][_0x620d('0x4e')]));_0x19426b[_0x620d('0x48')](get_open_tabs(_0x620d('0x53'),_0x1ce4e1[_0x620d('0x4b')][_0x3481c2][_0x620d('0x4e')]));}return BPromise['all'](_0x19426b)[_0x620d('0x14')](function(){return _0x1ce4e1;});}else{return _0x1ce4e1;}})[_0x620d('0x14')](respondWithFilteredResult(_0x4428b1,_0x2735ff))[_0x620d('0x1d')](handleError(_0x4428b1,null));};exports[_0x620d('0x54')]=function(_0xe7cf95,_0x12bf9c){var _0x570139={'raw':![],'where':{'id':_0xe7cf95[_0x620d('0x55')]['id']}},_0x52d033={};_0x52d033[_0x620d('0x56')]=_[_0x620d('0x57')](_[_0x620d('0x58')](db[_0x620d('0x40')][_0x620d('0x38')]),[_0x620d('0x59'),'salt']);_0x52d033[_0x620d('0x41')]=_[_0x620d('0x58')](_0xe7cf95[_0x620d('0x41')]);_0x52d033[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x52d033[_0x620d('0x56')],_0x52d033[_0x620d('0x41')]);_0x570139[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x52d033[_0x620d('0x56')],qs[_0x620d('0x5c')](_0xe7cf95[_0x620d('0x41')]['fields']));_0x570139[_0x620d('0x47')]=_0x570139[_0x620d('0x47')][_0x620d('0x4c')]?_0x570139[_0x620d('0x47')]:_0x52d033[_0x620d('0x56')];if(_0xe7cf95[_0x620d('0x41')][_0x620d('0x42')]){_0x570139[_0x620d('0x43')]=[{'all':!![]}];}if(_0xe7cf95['query'][_0x620d('0x46')]===_0x620d('0x44')){_0x570139[_0x620d('0x43')]=[{'model':db['UserSetting'],'as':_0x620d('0x46')}];}_0x570139=_[_0x620d('0x5d')]({},_0x570139,_0xe7cf95['options']);if(!_[_0x620d('0x31')](_0x570139[_0x620d('0x47')],'id')){_0x570139[_0x620d('0x47')][_0x620d('0x48')]('id');}return db['User'][_0x620d('0x33')](_0x570139)[_0x620d('0x14')](handleEntityNotFound(_0x12bf9c,null))[_0x620d('0x14')](function(_0x2b97cb){var _0x30030d=[];values=_0x2b97cb;if(_0xe7cf95[_0x620d('0x41')][_0x620d('0x4a')]==='true'){_0x30030d['push'](get_open_tabs(_0x620d('0x4d'),_0x2b97cb['dataValues']));_0x30030d[_0x620d('0x48')](get_open_tabs(_0x620d('0x4f'),_0x2b97cb[_0x620d('0x4e')]));_0x30030d['push'](get_open_tabs('openchannel',_0x2b97cb[_0x620d('0x4e')]));_0x30030d[_0x620d('0x48')](get_open_tabs(_0x620d('0x53'),_0x2b97cb[_0x620d('0x4e')]));_0x30030d['push'](get_open_tabs(_0x620d('0x50'),_0x2b97cb['dataValues']));_0x30030d[_0x620d('0x48')](get_open_tabs(_0x620d('0x51'),_0x2b97cb[_0x620d('0x4e')]));return BPromise[_0x620d('0x5e')](_0x30030d);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x12bf9c,null))[_0x620d('0x1d')](handleError(_0x12bf9c,null));};exports[_0x620d('0x28')]=function(_0x49e55d,_0x172db0){if(_0x49e55d[_0x620d('0x5f')]['id']){delete _0x49e55d[_0x620d('0x5f')]['id'];}delete _0x49e55d[_0x620d('0x5f')][_0x620d('0x32')];return db['User'][_0x620d('0x33')]({'where':{'id':_0x49e55d[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x172db0,null))[_0x620d('0x14')](saveUpdates(_0x49e55d[_0x620d('0x5f')],null))['then'](respondWithResult(_0x172db0,null))['catch'](handleError(_0x172db0,null));};exports['describe']=function(_0x29d9ab,_0x1d168d){return db[_0x620d('0x40')][_0x620d('0x60')]()[_0x620d('0x14')](respondWithResult(_0x1d168d,null))[_0x620d('0x1d')](handleError(_0x1d168d,null));};exports['addContacts']=function(_0x2134de,_0x17ae4b){return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x2134de[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x17ae4b,null))['then'](function(_0x3af84e){if(_0x3af84e){return _0x3af84e[_0x620d('0x61')](_0x2134de[_0x620d('0x5f')][_0x620d('0x62')],_[_0x620d('0x63')](_0x2134de[_0x620d('0x5f')],[_0x620d('0x62'),'id'])||{});}})[_0x620d('0x14')](respondWithResult(_0x17ae4b,null))[_0x620d('0x1d')](handleError(_0x17ae4b,null));};function validateUser(_0x468f1){return new BPromise(function(_0x4c26b9,_0x165ca8){if(_0x468f1[_0x620d('0x64')])return _0x4c26b9(_0x468f1);return db[_0x620d('0x65')][_0x620d('0x66')](0x1)[_0x620d('0x14')](function(_0x52b62b){if(_0x52b62b['securePassword'])authService[_0x620d('0x67')](_0x468f1[_0x620d('0x59')]);db[_0x620d('0x40')]['max']('internal')[_0x620d('0x14')](function(_0x10e1a5){if(_[_0x620d('0x68')](_0x10e1a5)){_0x468f1[_0x620d('0x64')]=_0x52b62b[_0x620d('0x69')]||0x1;return;}if(_[_0x620d('0x68')](_0x52b62b['min_internal'])||_0x52b62b[_0x620d('0x69')]===_0x10e1a5){_0x468f1['internal']=_0x10e1a5+0x1;return;}if(_0x52b62b[_0x620d('0x69')]>_0x10e1a5){_0x468f1[_0x620d('0x64')]=_0x52b62b[_0x620d('0x69')];return;}return db[_0x620d('0x6a')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x620d('0x6a')]['QueryTypes'][_0x620d('0x6b')]})[_0x620d('0x14')](function(_0x4691a0){if(_0x4691a0&&_0x4691a0[_0x620d('0x4c')]){for(var _0x39cc61=0x0,_0x401dd8=_0x4691a0['length'];_0x39cc61<_0x401dd8&&_['isNil'](_0x468f1[_0x620d('0x64')]);_0x39cc61++){if(_0x52b62b['min_internal']<=_0x4691a0[_0x39cc61][_0x620d('0x6c')]){_0x468f1['internal']=_0x4691a0[_0x39cc61][_0x620d('0x6c')];}else if(_0x52b62b[_0x620d('0x69')]>_0x4691a0[_0x39cc61][_0x620d('0x6c')]&&_0x52b62b[_0x620d('0x69')]<=_0x4691a0[_0x39cc61]['to']){_0x468f1[_0x620d('0x64')]=_0x52b62b[_0x620d('0x69')];}}}if(_[_0x620d('0x68')](_0x468f1['internal'])){_0x468f1[_0x620d('0x64')]=_0x10e1a5+0x1;}return _0x4c26b9(_0x468f1);});});})[_0x620d('0x1d')](function(_0x2f7fbe){_0x165ca8(_0x2f7fbe);});});}function updateUser(_0x4fb9eb){return new BPromise(function(_0x4d7362,_0x31ab79){try{if(_0x4fb9eb[_0x620d('0x6d')]){_0x4fb9eb[_0x620d('0x6e')]=_0x4fb9eb[_0x620d('0x64')];_0x4fb9eb[_0x620d('0x6f')]={'mailbox':_0x4fb9eb[_0x620d('0x64')],'password':_0x4fb9eb[_0x620d('0x59')],'fullname':_0x4fb9eb[_0x620d('0x70')],'email':_0x4fb9eb[_0x620d('0x71')]};}if(_0x4fb9eb[_0x620d('0x32')]==='agent'){if(!_0x4fb9eb[_0x620d('0x72')])_0x4fb9eb[_0x620d('0x72')]=[_0x620d('0x73'),_0x620d('0x74'),_0x620d('0x75'),_0x620d('0x76'),'110','104',_0x620d('0x77'),'106',_0x620d('0x78'),_0x620d('0x79'),_0x620d('0x7a'),_0x620d('0x7b'),'111',_0x620d('0x7c'),_0x620d('0x7d')];}_0x4d7362(_0x4fb9eb);}catch(_0x7a7ac8){_0x31ab79(_0x7a7ac8);}});}exports[_0x620d('0x7e')]=function(_0x1aa3b9,_0x1fdbf6){if(_0x1aa3b9['user'][_0x620d('0x32')]==='agent')throw new Error(_0x620d('0x7f'));if(_0x1aa3b9[_0x620d('0x5f')][_0x620d('0x32')]==='user'&&_0x1aa3b9[_0x620d('0x2b')][_0x620d('0x32')]!==_0x620d('0x29')){throw new Error(_0x620d('0x80'));}if(_0x1aa3b9[_0x620d('0x5f')][_0x620d('0x32')]===_0x620d('0x29')&&_0x1aa3b9['user'][_0x620d('0x32')]!==_0x620d('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x620d('0x81')]([_0x1aa3b9[_0x620d('0x5f')]])[_0x620d('0x14')](function(){return validateUser(_0x1aa3b9[_0x620d('0x5f')]);})[_0x620d('0x14')](function(_0x15a5b3){return updateUser(_0x15a5b3)[_0x620d('0x14')](function(_0x18ec35){if(_0x18ec35[_0x620d('0x32')]===_0x620d('0x29')){_0x18ec35['settingsEnabled']=_0x1aa3b9[_0x620d('0x2b')][_0x620d('0x82')];delete _0x18ec35[_0x620d('0x83')];}return _0x18ec35;});})[_0x620d('0x14')](function(_0x2ad798){return db['User']['create'](_0x2ad798,{'include':[{'model':db['VoiceMail'],'as':_0x620d('0x6f')}]});})['then'](function(_0x419897){if(_0x1aa3b9[_0x620d('0x5f')][_0x620d('0x32')]==='user')return _0x419897;if(_0x1aa3b9[_0x620d('0x2b')][_0x620d('0x32')]!==_0x620d('0x2b'))return _0x419897;return db['UserProfileSection'][_0x620d('0x33')]({'where':{'name':_0x419897[_0x620d('0x32')]===_0x620d('0x84')?_0x620d('0x2c'):_0x620d('0x2d'),'userProfileId':_0x1aa3b9[_0x620d('0x2b')][_0x620d('0x83')]},'raw':!![]})[_0x620d('0x14')](function(_0x33fa3b){if(!_0x33fa3b||_0x33fa3b[_0x620d('0x85')]!=0x0)return _0x419897;return db[_0x620d('0x35')][_0x620d('0x7e')]({'name':_0x419897[_0x620d('0x34')],'resourceId':_0x419897['id'],'type':_0x33fa3b[_0x620d('0x34')],'sectionId':_0x33fa3b['id']},{})[_0x620d('0x14')](function(){return _0x419897;});})[_0x620d('0x1d')](function(_0x3f1e63){logger[_0x620d('0x1a')](_0x620d('0x86'),_0x3f1e63);throw _0x3f1e63;});})[_0x620d('0x14')](respondWithResult(_0x1fdbf6,0xc9))['catch'](handleError(_0x1fdbf6,null));};exports[_0x620d('0x87')]=function(_0x301193,_0xf9d0f0){var _0x4acf3c=_0x301193[_0x620d('0x5f')];var _0x3fbaa2=[];if(_0x301193[_0x620d('0x2b')][_0x620d('0x32')]===_0x620d('0x84'))throw new Error(_0x620d('0x7f'));if(_[_0x620d('0x88')](_0x4acf3c,[_0x620d('0x32'),_0x620d('0x2b')])&&_0x301193[_0x620d('0x2b')][_0x620d('0x32')]!==_0x620d('0x29')){throw new Error(_0x620d('0x80'));}if(_[_0x620d('0x88')](_0x4acf3c,[_0x620d('0x32'),_0x620d('0x29')])&&_0x301193[_0x620d('0x2b')][_0x620d('0x32')]!==_0x620d('0x29')){throw new Error(_0x620d('0x89'));}return licenseUtil[_0x620d('0x81')](_0x4acf3c)[_0x620d('0x14')](function(){return validateUser(_0x4acf3c[0x0]);})[_0x620d('0x14')](function(){for(var _0x2a63ed=0x1;_0x2a63ed<_0x4acf3c['length'];_0x2a63ed++){var _0x4e1f61=_0x4acf3c[_0x2a63ed-0x1]['internal'];if(!_0x4acf3c[_0x2a63ed][_0x620d('0x64')])_0x4acf3c[_0x2a63ed]['internal']=_0x4e1f61+0x1;_0x3fbaa2[_0x620d('0x48')](validateUser(_0x4acf3c[_0x2a63ed]));}return BPromise[_0x620d('0x5e')](_0x3fbaa2);})[_0x620d('0x14')](function(){_0x3fbaa2=[];for(var _0x493887=0x0;_0x493887<_0x4acf3c[_0x620d('0x4c')];_0x493887++){_0x3fbaa2[_0x620d('0x48')](updateUser(_0x4acf3c[_0x493887]));}return BPromise[_0x620d('0x5e')](_0x3fbaa2);})[_0x620d('0x14')](function(){return BPromise[_0x620d('0x8a')](_0x4acf3c,function(_0x1ce8bb){return db[_0x620d('0x40')][_0x620d('0x7e')](_0x1ce8bb,{'include':[{'model':db[_0x620d('0x6f')],'as':_0x620d('0x6f')}]})['then'](function(_0x483695){_0x1ce8bb['id']=_0x483695['id'];return _0x1ce8bb;});});})[_0x620d('0x14')](function(_0x38bf40){if(_0x301193['body'][_0x620d('0x32')]===_0x620d('0x2b'))return _0x38bf40;if(_0x301193['user'][_0x620d('0x32')]!==_0x620d('0x2b'))return _0x38bf40;var _0x4e8620=_['some'](_0x38bf40,function(_0x2a298e){return _0x2a298e[_0x620d('0x32')]===_0x620d('0x84')||_0x2a298e[_0x620d('0x32')]==='telephone';});if(!_0x4e8620)return _0x38bf40;return db[_0x620d('0x8b')][_0x620d('0x49')]({'where':{'name':{'$or':[_0x620d('0x2c'),'Telephones']},'userProfileId':_0x301193[_0x620d('0x2b')][_0x620d('0x83')]},'raw':!![]})[_0x620d('0x14')](function(_0x91561c){if(_[_0x620d('0x8c')](_0x91561c)||!_['some'](_0x91561c,[_0x620d('0x85'),0x0]))return _0x38bf40;_0x3fbaa2=[];var _0x3cb666=_(_0x91561c)[_0x620d('0x39')](function(_0x22098d){if(_0x22098d[_0x620d('0x85')]===0x1)return;return _0x22098d[_0x620d('0x34')]===_0x620d('0x2c')?_0x620d('0x84'):_0x620d('0x2e');})[_0x620d('0x8d')]()[_0x620d('0x30')]();for(var _0x619298=0x0;_0x619298<_0x38bf40['length'];_0x619298++){if(!_['includes'](_0x3cb666,_0x38bf40[_0x619298][_0x620d('0x32')]))return;var _0x10efe1=_0x38bf40[_0x619298][_0x620d('0x32')]==='agent'?_0x620d('0x2c'):'Telephones';_0x3fbaa2[_0x620d('0x48')](db[_0x620d('0x35')]['create']({'name':_0x38bf40[_0x619298]['name'],'resourceId':_0x38bf40[_0x619298]['id'],'type':_0x10efe1,'sectionId':_[_0x620d('0x33')](_0x91561c,[_0x620d('0x34'),_0x10efe1])['id']},{}));}return BPromise[_0x620d('0x5e')](_0x3fbaa2);});})[_0x620d('0x14')](respondWithResult(_0xf9d0f0,0xc9))[_0x620d('0x1d')](handleError(_0xf9d0f0,null));};exports[_0x620d('0x8e')]=function(_0x206ece,_0x3d5538){if(_0x206ece[_0x620d('0x5f')]['id']){delete _0x206ece[_0x620d('0x5f')]['id'];}return db['User'][_0x620d('0x33')]({'where':{'id':_0x206ece[_0x620d('0x55')]['id']}})[_0x620d('0x14')](function(_0x456caa){if(!_0x456caa)return null;if(_0x456caa['id']===_0x206ece[_0x620d('0x2b')]['id']){if(!_0x206ece['body'][_0x620d('0x8f')]||!_0x206ece['body']['newPassword']){throw new db['Sequelize'][(_0x620d('0x90'))](_0x620d('0x91'));}if(!_0x456caa[_0x620d('0x92')](_0x206ece[_0x620d('0x5f')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0x620d('0x93'));}if(_0x206ece[_0x620d('0x5f')][_0x620d('0x8f')]===_0x206ece[_0x620d('0x5f')][_0x620d('0x94')]){throw new db[(_0x620d('0x95'))]['ValidationError'](_0x620d('0x96'));}}else if(_0x206ece['user'][_0x620d('0x32')]===_0x620d('0x29')){if(!_0x206ece[_0x620d('0x5f')][_0x620d('0x94')]){throw new db[(_0x620d('0x95'))]['ValidationError'](_0x620d('0x97'));}}else if(_0x206ece['user'][_0x620d('0x32')]==='user'){if(!_0x206ece[_0x620d('0x5f')][_0x620d('0x94')]){throw new db['Sequelize'][(_0x620d('0x90'))](_0x620d('0x97'));}if(_0x456caa[_0x620d('0x32')]!==_0x620d('0x84')){throw new db[(_0x620d('0x95'))][(_0x620d('0x90'))](_0x620d('0x7f'));}}else{throw new db[(_0x620d('0x95'))][(_0x620d('0x90'))](_0x620d('0x7f'));}return _0x456caa;})['then'](handleEntityNotFound(_0x3d5538,null))[_0x620d('0x14')](function(_0x5cca2d){return db['Setting']['findOne']({'attributes':['id',_0x620d('0x98'),_0x620d('0x99'),'passwordHistoryLimit']})[_0x620d('0x14')](function(_0x5cae43){if(_0x5cae43[_0x620d('0x98')])authService[_0x620d('0x67')](_0x206ece['body'][_0x620d('0x94')]);if(!_0x5cae43[_0x620d('0x99')]||!_0x5cca2d['previousPasswords'])return _0x5cca2d;authService['validatePasswordHistory'](_0x206ece[_0x620d('0x5f')][_0x620d('0x94')],_0x5cca2d[_0x620d('0x9a')],_0x5cae43[_0x620d('0x9b')]);return _0x5cca2d;})[_0x620d('0x14')](saveUpdates({'password':_0x206ece[_0x620d('0x5f')]['newPassword'],'passwordResetAt':_0x206ece[_0x620d('0x2b')]['id']==_0x206ece[_0x620d('0x55')]['id']?moment():null,'previousPasswords':authService[_0x620d('0x9c')](_0x206ece[_0x620d('0x5f')][_0x620d('0x94')],_0x5cca2d[_0x620d('0x9a')])},null));})[_0x620d('0x14')](respondWithResult(_0x3d5538,null))['catch'](handleError(_0x3d5538,null));};exports['addQueues']=function(_0x3c99b1,_0x2229e3){var _0x522f6d=_0x3c99b1[_0x620d('0x5f')][_0x620d('0x9d')];return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x3c99b1[_0x620d('0x55')]['id']},'attributes':['id',_0x620d('0x34'),_0x620d('0x32'),_0x620d('0x9e'),_0x620d('0x9f'),'voicePause','interface']})[_0x620d('0x14')](handleEntityNotFound(_0x2229e3,null))['then'](function(_0x1d9b13){if(_0x1d9b13){if(!utils[_0x620d('0xa0')](_0x522f6d)){throw new db['Sequelize'][(_0x620d('0x90'))]('Unknown\x20channel');}return _0x1d9b13[_0x620d('0xa1')+_[_0x620d('0xa2')](_0x522f6d[_0x620d('0xa3')]())+_0x620d('0xa4')](_0x3c99b1['body'][_0x620d('0x62')],{'penalty':_0x3c99b1['body'][_0x620d('0xa5')]||0x0})[_0x620d('0xa6')](function(_0x2502e0){for(var _0x404081=0x0;_0x404081<_0x3c99b1[_0x620d('0x5f')][_0x620d('0x62')][_0x620d('0x4c')];_0x404081+=0x1){var _0x1a6e47={'UserId':Number(_0x3c99b1[_0x620d('0x55')]['id'])};_0x1a6e47[_[_0x620d('0xa2')](_0x522f6d[_0x620d('0xa3')]())+_0x620d('0xa7')]=Number(_0x3c99b1[_0x620d('0x5f')][_0x620d('0x62')][_0x404081]);socket['emit'](_0x620d('0x2b')+_[_0x620d('0xa2')](_0x522f6d['toLowerCase']())+'Queue:save',_0x1a6e47);}return _0x2502e0;})[_0x620d('0x14')](function(){if(_0x522f6d===_0x620d('0xa8')){return db[_0x620d('0xa9')][_0x620d('0x49')]({'where':{'id':_0x3c99b1[_0x620d('0x5f')][_0x620d('0x62')]||[]},'raw':!![],'attributes':['id',_0x620d('0x34')]});}})['then'](function(_0x3203f4){var _0x4d8a10=_0x1d9b13[_0x620d('0xaa')]({'plain':!![]});var _0x2eb1eb=[];if(_0x522f6d===_0x620d('0xa8')&&_0x4d8a10['role']==='agent'&&_0x4d8a10[_0x620d('0x9e')]){for(var _0x781fb=0x0;_0x781fb<_0x3203f4[_0x620d('0x4c')];_0x781fb+=0x1){_0x2eb1eb[_0x620d('0x48')]({'membername':_0x4d8a10[_0x620d('0x34')],'UserId':_0x4d8a10['id'],'queue_name':_0x3203f4[_0x781fb][_0x620d('0x34')],'VoiceQueueId':_0x3203f4[_0x781fb]['id'],'interface':_[_0x620d('0x68')](_0x4d8a10[_0x620d('0xab')])?util[_0x620d('0xac')](_0x620d('0xad'),_0x4d8a10[_0x620d('0x34')]):_0x4d8a10['interface'],'paused':_0x4d8a10['voicePause']||![],'penalty':_0x3c99b1[_0x620d('0x5f')][_0x620d('0xa5')]||0x0});}return BPromise[_0x620d('0x8a')](_0x2eb1eb,function(_0x17febb){return db[_0x620d('0xae')][_0x620d('0xaf')](_0x17febb);});}return _0x1d9b13;});}})[_0x620d('0x14')](respondWithStatusCode(_0x2229e3,null))[_0x620d('0x1d')](handleError(_0x2229e3,null));};exports[_0x620d('0xb0')]=function(_0x4c0794,_0x3681ff){var _0x325185,_0x1c292e;return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x4c0794['params']['id']},'attributes':['id',_0x620d('0x34'),'role']})[_0x620d('0x14')](handleEntityNotFound(_0x3681ff,null))[_0x620d('0x14')](function(_0x55cbef){if(_0x55cbef){_0x325185=_0x55cbef;if(!_0x4c0794['query']['channel']||!utils['isValidChannel'](_0x4c0794[_0x620d('0x41')][_0x620d('0x9d')])){throw new db[(_0x620d('0x95'))][(_0x620d('0x90'))](_0x620d('0xb1'));}return _0x55cbef[_0x620d('0xb2')+_[_0x620d('0xa2')](_0x4c0794[_0x620d('0x41')][_0x620d('0x9d')]['toLowerCase']())+'Queues'](_0x4c0794[_0x620d('0x41')][_0x620d('0x62')]);}})[_0x620d('0x14')](function(_0x9b492b){if(_[_0x620d('0xb3')](_0x4c0794['query'][_0x620d('0x62')])){for(var _0x396e5e=0x0;_0x396e5e<_0x4c0794['query'][_0x620d('0x62')]['length'];_0x396e5e+=0x1){_0x1c292e={'UserId':Number(_0x4c0794[_0x620d('0x55')]['id'])};_0x1c292e[_[_0x620d('0xa2')](_0x4c0794[_0x620d('0x41')]['channel']['toLowerCase']())+_0x620d('0xa7')]=Number(_0x4c0794[_0x620d('0x41')]['ids'][_0x396e5e]);socket[_0x620d('0xb4')]('user'+_[_0x620d('0xa2')](_0x4c0794[_0x620d('0x41')][_0x620d('0x9d')][_0x620d('0xa3')]())+_0x620d('0xb5'),_0x1c292e);}}else{_0x1c292e={'UserId':Number(_0x4c0794['params']['id'])};_0x1c292e[_[_0x620d('0xa2')](_0x4c0794[_0x620d('0x41')][_0x620d('0x9d')][_0x620d('0xa3')]())+_0x620d('0xa7')]=Number(_0x4c0794[_0x620d('0x41')][_0x620d('0x62')]);socket[_0x620d('0xb4')]('user'+_[_0x620d('0xa2')](_0x4c0794[_0x620d('0x41')][_0x620d('0x9d')]['toLowerCase']())+_0x620d('0xb5'),_0x1c292e);}return _0x9b492b;})['then'](function(){if(_0x4c0794[_0x620d('0x41')][_0x620d('0x9d')]==='voice'){return db['UserVoiceQueueRt'][_0x620d('0xb6')]({'where':{'UserId':_0x4c0794[_0x620d('0x55')]['id'],'VoiceQueueId':_0x4c0794['query'][_0x620d('0x62')]},'individualHooks':!![]})[_0x620d('0x14')](function(){return _0x325185;});}return _0x325185;})[_0x620d('0x14')](respondWithStatusCode(_0x3681ff,null))[_0x620d('0x1d')](handleError(_0x3681ff,null));};exports[_0x620d('0xb7')]=function(_0x24ee07,_0x19b69c){_0x24ee07[_0x620d('0x5f')][_0x620d('0xb8')]=_0x24ee07[_0x620d('0xb9')]['filename'];return db['User'][_0x620d('0x33')]({'where':{'id':_0x24ee07[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x19b69c,null))['then'](saveUpdates(_0x24ee07['body'],null))[_0x620d('0x14')](respondWithResult(_0x19b69c,null))[_0x620d('0x1d')](handleError(_0x19b69c,null));};exports[_0x620d('0xba')]=function(_0x41783e,_0x50a9cf){var _0x205f7a=path[_0x620d('0xbb')](config[_0x620d('0xbc')],_0x620d('0xbd'));return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x41783e[_0x620d('0x55')]['id']},'attributes':['id',_0x620d('0xb8')],'raw':!![]})[_0x620d('0x14')](handleEntityNotFound(_0x50a9cf,null))[_0x620d('0x14')](function(_0x131cdb){if(_0x131cdb){if(_['isNil'](_0x131cdb[_0x620d('0xb8')])){return _0x50a9cf[_0x620d('0xbe')](_0x205f7a);}else{if(!fs[_0x620d('0xbf')](path[_0x620d('0xbb')](config['root'],'server/files/images/',_0x131cdb[_0x620d('0xb8')]))){return _0x50a9cf[_0x620d('0xbe')](_0x205f7a);}return _0x50a9cf[_0x620d('0xbe')](path[_0x620d('0xbb')](config[_0x620d('0xbc')],_0x620d('0xc0'),_0x131cdb[_0x620d('0xb8')]));}}})[_0x620d('0x1d')](handleError(_0x50a9cf,null));};exports[_0x620d('0xc1')]=function(_0x57b851,_0x5cda92){return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x57b851[_0x620d('0x55')]['id']},'attributes':['id']})[_0x620d('0x14')](handleEntityNotFound(_0x5cda92,null))[_0x620d('0x14')](function(_0x17ecec){var _0x4a521d=[];values=_0x17ecec[_0x620d('0x4e')];_0x4a521d['push'](get_open_tabs('chat',_0x17ecec['dataValues']));_0x4a521d['push'](get_open_tabs('sms',_0x17ecec[_0x620d('0x4e')]));_0x4a521d['push'](get_open_tabs(_0x620d('0x52'),_0x17ecec[_0x620d('0x4e')]));_0x4a521d['push'](get_open_tabs(_0x620d('0x53'),_0x17ecec[_0x620d('0x4e')]));_0x4a521d['push'](get_open_tabs('fax',_0x17ecec[_0x620d('0x4e')]));_0x4a521d['push'](get_open_tabs(_0x620d('0x51'),_0x17ecec[_0x620d('0x4e')]));return BPromise[_0x620d('0x5e')](_0x4a521d);})[_0x620d('0x14')](function(_0xd1ab9f){if(_0xd1ab9f){var _0xdfc7f0=_[_0x620d('0x39')](values[_0x620d('0xc2')],function(_0x4d4843){return{'channel':'CHAT','id':_0x4d4843['id'],'createdAt':_0x4d4843[_0x620d('0xc3')]};});var _0x20aab6=_[_0x620d('0x39')](values[_0x620d('0xc4')],function(_0x516f3a){return{'channel':_0x620d('0xc5'),'id':_0x516f3a['id'],'createdAt':_0x516f3a[_0x620d('0xc3')]};});var _0x420eb1=_['map'](values[_0x620d('0xc6')],function(_0x5dd3c0){return{'channel':_0x620d('0xc7'),'id':_0x5dd3c0['id'],'createdAt':_0x5dd3c0[_0x620d('0xc3')]};});var _0x1ba6f4=_['map'](values[_0x620d('0xc8')],function(_0x1dbc87){return{'channel':_0x620d('0xc9'),'id':_0x1dbc87['id'],'createdAt':_0x1dbc87[_0x620d('0xc3')]};});var _0x1987e2=_[_0x620d('0x39')](values[_0x620d('0xca')],function(_0x4fdccf){return{'channel':_0x620d('0xcb'),'id':_0x4fdccf['id'],'createdAt':_0x4fdccf[_0x620d('0xc3')]};});var _0x19380c=_[_0x620d('0x39')](values['WhatsappOpenTabs'],function(_0x14b53d){return{'channel':_0x620d('0xcc'),'id':_0x14b53d['id'],'createdAt':_0x14b53d['createdAt']};});var _0x196303=_[_0x620d('0xcd')](_0xdfc7f0,_0x20aab6,_0x420eb1,_0x1ba6f4,_0x1987e2,_0x19380c);var _0x5c5e6d={'count':_0x196303['length'],'rows':_0x196303};return _0x5c5e6d;}else return null;})[_0x620d('0x14')](respondWithResult(_0x5cda92,null))[_0x620d('0x1d')](handleError(_0x5cda92,null));};exports[_0x620d('0xce')]=function(_0x54321a,_0x103d65){var _0x6caa9b={};var _0x7d2d8a={};var _0x272b0e;var _0x219bbb;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x54321a[_0x620d('0x55')]['id']}})['then'](handleEntityNotFound(_0x103d65,null))['then'](function(_0xb4f5fb){if(_0xb4f5fb){_0x272b0e=_0xb4f5fb;_0x7d2d8a[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0xd0')][_0x620d('0x38')]);_0x7d2d8a['query']=_[_0x620d('0x58')](_0x54321a[_0x620d('0x41')]);_0x7d2d8a[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x7d2d8a[_0x620d('0x56')],_0x7d2d8a[_0x620d('0x41')]);_0x6caa9b['attributes']=_[_0x620d('0x5b')](_0x7d2d8a[_0x620d('0x56')],qs[_0x620d('0x5c')](_0x54321a[_0x620d('0x41')][_0x620d('0x5c')]));_0x6caa9b[_0x620d('0x47')]=_0x6caa9b[_0x620d('0x47')]['length']?_0x6caa9b['attributes']:_0x7d2d8a[_0x620d('0x56')];_0x6caa9b[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x54321a[_0x620d('0x41')][_0x620d('0xd2')]);_0x6caa9b[_0x620d('0x3f')]=qs[_0x620d('0x5a')](_[_0x620d('0xd3')](_0x54321a[_0x620d('0x41')],_0x7d2d8a[_0x620d('0x5a')]));if(_0x54321a['query'][_0x620d('0x2f')]){_0x6caa9b[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x6caa9b[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x6caa9b[_0x620d('0x47')],function(_0x436369){var _0x2c62fb={};_0x2c62fb[_0x436369]={'$like':'%'+_0x54321a[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x2c62fb;})});}_0x6caa9b=_['merge']({},_0x6caa9b,_0x54321a[_0x620d('0xd4')]);return _0x272b0e['getContacts'](_0x6caa9b);}})['then'](function(_0x57e009){if(_0x57e009){_0x219bbb=_0x57e009[_0x620d('0x4c')];if(_0x54321a[_0x620d('0x41')]['hasOwnProperty'](_0x620d('0x42'))){_0x6caa9b[_0x620d('0x43')]=[{'model':db['CmList'],'as':_0x620d('0xd5'),'required':![]},{'model':db[_0x620d('0xd6')],'as':_0x620d('0xd7'),'attributes':['id',_0x620d('0x34'),_0x620d('0xd8')],'where':_0x54321a['query'][_0x620d('0xd9')]?{'id':_0x54321a['query'][_0x620d('0xd9')]}:undefined,'required':_0x54321a[_0x620d('0x41')]['tag']?!![]:![]}];}if(!_0x54321a[_0x620d('0x41')]['hasOwnProperty']('nolimit')){_0x6caa9b['limit']=qs['limit'](_0x54321a[_0x620d('0x41')][_0x620d('0x24')]);_0x6caa9b['offset']=qs[_0x620d('0x22')](_0x54321a['query'][_0x620d('0x22')]);}return _0x272b0e['getContacts'](_0x6caa9b);}})[_0x620d('0x14')](function(_0x2dd5cf){if(_0x2dd5cf){return _0x2dd5cf?{'count':_0x219bbb,'rows':_0x2dd5cf}:null;}})[_0x620d('0x14')](respondWithResult(_0x103d65,null))['catch'](handleError(_0x103d65,null));};exports[_0x620d('0xda')]=function(_0x354da9,_0x11affd){var _0x40860c;var _0x433462={};var _0xb92018;return db[_0x620d('0x40')]['findOne']({'where':{'id':_0x354da9[_0x620d('0x55')]['id']},'attributes':['id',_0x620d('0x34'),_0x620d('0x32')]})['then'](handleEntityNotFound(_0x11affd,null))[_0x620d('0x14')](function(_0x21ffe6){if(!utils[_0x620d('0xa0')](_0x354da9['query']['channel'])){throw new db[(_0x620d('0x95'))]['ValidationError'](_0x620d('0xb1'));}_0x40860c=_0x21ffe6;var _0x287991={};_0x287991[_0x620d('0x56')]=_[_0x620d('0x58')](db[_['capitalize'](_0x354da9['query'][_0x620d('0x9d')])+'Queue']['rawAttributes']);_0x287991[_0x620d('0x41')]=_['keys'](_0x354da9[_0x620d('0x41')]);_0x287991[_0x620d('0x5a')]=_['intersection'](_0x287991[_0x620d('0x56')],_0x287991[_0x620d('0x41')]);_0x433462[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x287991[_0x620d('0x56')],qs[_0x620d('0x5c')](_0x354da9[_0x620d('0x41')][_0x620d('0x5c')]));_0x433462[_0x620d('0x47')]=_0x433462[_0x620d('0x47')][_0x620d('0x4c')]?_0x433462[_0x620d('0x47')]:_0x287991[_0x620d('0x56')];_0x433462[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x354da9['query'][_0x620d('0xd2')]);_0x433462[_0x620d('0x3f')]=qs[_0x620d('0x5a')](_['pick'](_0x354da9[_0x620d('0x41')],_0x287991[_0x620d('0x5a')]));if(_0x354da9['query'][_0x620d('0x2f')]){_0x433462['where']=_[_0x620d('0x5d')](_0x433462[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x433462[_0x620d('0x47')],function(_0x2f1411){var _0x42e8e8={};_0x42e8e8[_0x2f1411]={'$like':'%'+_0x354da9['query']['filter']+'%'};return _0x42e8e8;})});}_0x433462=_[_0x620d('0x5d')]({},_0x433462,_0x354da9[_0x620d('0xd4')]);switch(_0x40860c[_0x620d('0x32')]){case _0x620d('0x29'):return db[_[_0x620d('0xa2')](_0x354da9[_0x620d('0x41')][_0x620d('0x9d')])+_0x620d('0xdb')][_0x620d('0x49')](_0x433462);case _0x620d('0x2b'):case'agent':return _0x40860c[_0x620d('0xaa')+_['capitalize'](_0x354da9[_0x620d('0x41')][_0x620d('0x9d')])+_0x620d('0xa4')](_0x433462);default:throw new db[(_0x620d('0x95'))][(_0x620d('0x90'))]('Unknown\x20role');}})[_0x620d('0x14')](function(_0x2b15c8){_0xb92018=_0x2b15c8[_0x620d('0x4c')];if(!_0x354da9[_0x620d('0x41')][_0x620d('0xdc')]('nolimit')){_0x433462[_0x620d('0x24')]=qs['limit'](_0x354da9['query']['limit']);_0x433462['offset']=qs[_0x620d('0x22')](_0x354da9[_0x620d('0x41')][_0x620d('0x22')]);}switch(_0x40860c[_0x620d('0x32')]){case _0x620d('0x29'):return db[_['capitalize'](_0x354da9[_0x620d('0x41')][_0x620d('0x9d')])+_0x620d('0xdb')][_0x620d('0x49')](_0x433462);case _0x620d('0x2b'):case _0x620d('0x84'):return _0x40860c['get'+_[_0x620d('0xa2')](_0x354da9[_0x620d('0x41')]['channel'])+_0x620d('0xa4')](_0x433462);}})[_0x620d('0x14')](function(_0x987f3a){return{'count':_0xb92018,'rows':_0x987f3a};})[_0x620d('0x14')](respondWithResult(_0x11affd,null))[_0x620d('0x1d')](handleError(_0x11affd,null));};exports['getVoiceQueuesRt']=function(_0x4b9ad3,_0x55b429){var _0x280cd0={};var _0x63164c={};var _0x4b75de;var _0x44e94d;return db[_0x620d('0x40')]['findOne']({'where':{'id':_0x4b9ad3[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x55b429,null))[_0x620d('0x14')](function(_0x3ec142){if(_0x3ec142){_0x4b75de=_0x3ec142;_0x63164c[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0xae')][_0x620d('0x38')]);_0x63164c['query']=_[_0x620d('0x58')](_0x4b9ad3[_0x620d('0x41')]);_0x63164c[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x63164c['model'],_0x63164c[_0x620d('0x41')]);_0x280cd0['attributes']=_[_0x620d('0x5b')](_0x63164c['model'],qs[_0x620d('0x5c')](_0x4b9ad3[_0x620d('0x41')][_0x620d('0x5c')]));_0x280cd0[_0x620d('0x47')]=_0x280cd0[_0x620d('0x47')][_0x620d('0x4c')]?_0x280cd0[_0x620d('0x47')]:_0x63164c[_0x620d('0x56')];_0x280cd0[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x4b9ad3[_0x620d('0x41')]['sort']);_0x280cd0[_0x620d('0x3f')]=qs[_0x620d('0x5a')](_['pick'](_0x4b9ad3[_0x620d('0x41')],_0x63164c['filters']));if(_0x4b9ad3['query']['filter']){_0x280cd0[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x280cd0[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x280cd0[_0x620d('0x47')],function(_0x18aacf){var _0x7c16a2={};_0x7c16a2[_0x18aacf]={'$like':'%'+_0x4b9ad3[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x7c16a2;})});}_0x280cd0=_[_0x620d('0x5d')]({},_0x280cd0,_0x4b9ad3['options']);return _0x4b75de[_0x620d('0xdd')](_0x280cd0);}})[_0x620d('0x14')](function(_0x59e120){if(_0x59e120){_0x44e94d=_0x59e120[_0x620d('0x4c')];if(!_0x4b9ad3[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x280cd0[_0x620d('0x24')]=qs[_0x620d('0x24')](_0x4b9ad3['query'][_0x620d('0x24')]);_0x280cd0[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x4b9ad3[_0x620d('0x41')][_0x620d('0x22')]);}return _0x4b75de[_0x620d('0xdd')](_0x280cd0);}})['then'](function(_0x422aa6){if(_0x422aa6){return _0x422aa6?{'count':_0x44e94d,'rows':_0x422aa6}:null;}})[_0x620d('0x14')](respondWithResult(_0x55b429,null))[_0x620d('0x1d')](handleError(_0x55b429,null));};exports['getGroups']=function(_0x3f728f,_0x38fd24){var _0x174f14={};var _0x23a184={};var _0x1f4101;var _0x56b3f3;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x3f728f[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x38fd24,null))['then'](function(_0x3c4228){if(_0x3c4228){_0x1f4101=_0x3c4228;_0x23a184[_0x620d('0x56')]=_[_0x620d('0x58')](db['ChatGroup'][_0x620d('0x38')]);_0x23a184[_0x620d('0x41')]=_[_0x620d('0x58')](_0x3f728f[_0x620d('0x41')]);_0x23a184['filters']=_['intersection'](_0x23a184[_0x620d('0x56')],_0x23a184['query']);_0x174f14[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x23a184[_0x620d('0x56')],qs[_0x620d('0x5c')](_0x3f728f[_0x620d('0x41')][_0x620d('0x5c')]));_0x174f14[_0x620d('0x47')]=_0x174f14['attributes'][_0x620d('0x4c')]?_0x174f14[_0x620d('0x47')]:_0x23a184[_0x620d('0x56')];_0x174f14[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x3f728f[_0x620d('0x41')][_0x620d('0xd2')]);_0x174f14['where']=qs[_0x620d('0x5a')](_[_0x620d('0xd3')](_0x3f728f[_0x620d('0x41')],_0x23a184['filters']));if(_0x3f728f[_0x620d('0x41')][_0x620d('0x2f')]){_0x174f14[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x174f14[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x174f14[_0x620d('0x47')],function(_0x2dda31){var _0x60085b={};_0x60085b[_0x2dda31]={'$like':'%'+_0x3f728f['query'][_0x620d('0x2f')]+'%'};return _0x60085b;})});}_0x174f14=_[_0x620d('0x5d')]({},_0x174f14,_0x3f728f['options']);return _0x1f4101[_0x620d('0xdf')](_0x174f14);}})[_0x620d('0x14')](function(_0x18ed51){if(_0x18ed51){_0x56b3f3=_0x18ed51['length'];if(!_0x3f728f[_0x620d('0x41')]['hasOwnProperty'](_0x620d('0xde'))){_0x174f14[_0x620d('0x24')]=qs['limit'](_0x3f728f[_0x620d('0x41')]['limit']);_0x174f14[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x3f728f[_0x620d('0x41')][_0x620d('0x22')]);}return _0x1f4101[_0x620d('0xdf')](_0x174f14);}})[_0x620d('0x14')](function(_0x1a7be3){if(_0x1a7be3){return _0x1a7be3?{'count':_0x56b3f3,'rows':_0x1a7be3}:null;}})[_0x620d('0x14')](respondWithResult(_0x38fd24,null))[_0x620d('0x1d')](handleError(_0x38fd24,null));};exports[_0x620d('0xe0')]=function(_0x376021,_0x15476c){var _0x2b1419={'raw':!![],'where':{}};var _0x2e2d35={};var _0x579cb4={'count':0x0,'rows':[]};return db['User'][_0x620d('0xcf')]({'where':{'id':_0x376021[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x15476c,null))[_0x620d('0x14')](function(_0x5c205f){if(_0x5c205f){_0x2e2d35[_0x620d('0x56')]=_[_0x620d('0x58')](db['VoiceRecording'][_0x620d('0x38')]);_0x2e2d35[_0x620d('0x41')]=_[_0x620d('0x58')](_0x376021[_0x620d('0x41')]);_0x2e2d35[_0x620d('0x5a')]=_['intersection'](_0x2e2d35['model'],_0x2e2d35[_0x620d('0x41')]);_0x2b1419['attributes']=_[_0x620d('0x5b')](_0x2e2d35[_0x620d('0x56')],qs[_0x620d('0x5c')](_0x376021['query'][_0x620d('0x5c')]));_0x2b1419[_0x620d('0x47')]=_0x2b1419[_0x620d('0x47')][_0x620d('0x4c')]?_0x2b1419[_0x620d('0x47')]:_0x2e2d35['model'];if(!_0x376021[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x2b1419['limit']=qs[_0x620d('0x24')](_0x376021[_0x620d('0x41')][_0x620d('0x24')]);_0x2b1419[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x376021[_0x620d('0x41')][_0x620d('0x22')]);}_0x2b1419[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x376021[_0x620d('0x41')][_0x620d('0xd2')]);_0x2b1419[_0x620d('0x3f')]=qs['filters'](_[_0x620d('0xd3')](_0x376021[_0x620d('0x41')],_0x2e2d35['filters']));_0x2b1419[_0x620d('0x3f')]['UserId']=_0x5c205f['id'];if(_0x376021[_0x620d('0x41')][_0x620d('0x2f')]){_0x2b1419[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x2b1419[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x2b1419[_0x620d('0x47')],function(_0x1c3564){var _0x51d50c={};_0x51d50c[_0x1c3564]={'$like':'%'+_0x376021['query'][_0x620d('0x2f')]+'%'};return _0x51d50c;})});}_0x2b1419=_['merge']({},_0x2b1419,_0x376021[_0x620d('0xd4')]);return db[_0x620d('0xe1')][_0x620d('0x25')]({'where':_0x2b1419[_0x620d('0x3f')]})[_0x620d('0x14')](function(_0x396faf){_0x579cb4[_0x620d('0x25')]=_0x396faf;if(_0x376021[_0x620d('0x41')]['includeAll']){_0x2b1419['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x620d('0x49')](_0x2b1419);})['then'](function(_0x405647){_0x579cb4[_0x620d('0x4b')]=_0x405647;return _0x579cb4;});}})[_0x620d('0x14')](respondWithFilteredResult(_0x15476c,_0x2b1419))[_0x620d('0x1d')](handleError(_0x15476c,null));};exports['getScreenRecordings']=function(_0x59029c,_0x7bbfc4){var _0x1f3f82={'raw':!![],'where':{}};var _0x5549ee={};var _0xfa6208={'count':0x0,'rows':[]};return db['User'][_0x620d('0xcf')]({'where':{'id':_0x59029c['params']['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x7bbfc4,null))['then'](function(_0x2ffa8b){if(_0x2ffa8b){_0x5549ee[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0xe2')]['rawAttributes']);_0x5549ee[_0x620d('0x41')]=_[_0x620d('0x58')](_0x59029c[_0x620d('0x41')]);_0x5549ee[_0x620d('0x5a')]=_['intersection'](_0x5549ee[_0x620d('0x56')],_0x5549ee[_0x620d('0x41')]);_0x1f3f82[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x5549ee[_0x620d('0x56')],qs['fields'](_0x59029c[_0x620d('0x41')][_0x620d('0x5c')]));_0x1f3f82[_0x620d('0x47')]=_0x1f3f82[_0x620d('0x47')][_0x620d('0x4c')]?_0x1f3f82[_0x620d('0x47')]:_0x5549ee[_0x620d('0x56')];if(!_0x59029c[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x1f3f82[_0x620d('0x24')]=qs['limit'](_0x59029c[_0x620d('0x41')][_0x620d('0x24')]);_0x1f3f82[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x59029c[_0x620d('0x41')][_0x620d('0x22')]);}_0x1f3f82['order']=qs[_0x620d('0xd2')](_0x59029c['query'][_0x620d('0xd2')]);_0x1f3f82[_0x620d('0x3f')]=qs[_0x620d('0x5a')](_['pick'](_0x59029c[_0x620d('0x41')],_0x5549ee[_0x620d('0x5a')]));_0x1f3f82['where'][_0x620d('0xe3')]=_0x2ffa8b['id'];if(_0x59029c[_0x620d('0x41')][_0x620d('0x2f')]){_0x1f3f82[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x1f3f82[_0x620d('0x3f')],{'$or':_['map'](_0x1f3f82[_0x620d('0x47')],function(_0x2361ed){var _0x44c5b6={};_0x44c5b6[_0x2361ed]={'$like':'%'+_0x59029c[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x44c5b6;})});}_0x1f3f82=_[_0x620d('0x5d')]({},_0x1f3f82,_0x59029c['options']);return db[_0x620d('0xe2')]['count']({'where':_0x1f3f82['where']})[_0x620d('0x14')](function(_0x53e7c0){_0xfa6208[_0x620d('0x25')]=_0x53e7c0;if(_0x59029c['query']['includeAll']){_0x1f3f82[_0x620d('0x43')]=[{'all':!![]}];}return db[_0x620d('0xe2')]['findAll'](_0x1f3f82);})[_0x620d('0x14')](function(_0xa8a3fb){_0xfa6208[_0x620d('0x4b')]=_0xa8a3fb;return _0xfa6208;});}})[_0x620d('0x14')](respondWithFilteredResult(_0x7bbfc4,_0x1f3f82))[_0x620d('0x1d')](handleError(_0x7bbfc4,null));};exports['getChatInteractions']=function(_0x1c9495,_0x2a1d88){var _0x369618={};var _0x26a9a0={};var _0x30ac05;var _0x452e0a;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x1c9495['params']['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x2a1d88,null))['then'](function(_0x4593d4){if(_0x4593d4){_0x30ac05=_0x4593d4;_0x26a9a0[_0x620d('0x56')]=_['keys'](db[_0x620d('0xe4')][_0x620d('0x38')]);_0x26a9a0[_0x620d('0x41')]=_[_0x620d('0x58')](_0x1c9495['query']);_0x26a9a0[_0x620d('0x5a')]=_['intersection'](_0x26a9a0[_0x620d('0x56')],_0x26a9a0[_0x620d('0x41')]);_0x369618[_0x620d('0x47')]=_['intersection'](_0x26a9a0['model'],qs[_0x620d('0x5c')](_0x1c9495['query'][_0x620d('0x5c')]));_0x369618[_0x620d('0x47')]=_0x369618[_0x620d('0x47')][_0x620d('0x4c')]?_0x369618['attributes']:_0x26a9a0[_0x620d('0x56')];_0x369618[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x1c9495[_0x620d('0x41')][_0x620d('0xd2')]);_0x369618[_0x620d('0x3f')]=qs['filters'](_[_0x620d('0xd3')](_0x1c9495['query'],_0x26a9a0[_0x620d('0x5a')]));if(_0x1c9495[_0x620d('0x41')][_0x620d('0x2f')]){_0x369618[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x369618[_0x620d('0x3f')],{'$or':_['map'](_0x369618[_0x620d('0x47')],function(_0x1bec66){var _0x1a32ff={};_0x1a32ff[_0x1bec66]={'$like':'%'+_0x1c9495[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x1a32ff;})});}_0x369618=_[_0x620d('0x5d')]({},_0x369618,_0x1c9495[_0x620d('0xd4')]);return _0x30ac05[_0x620d('0xe5')](_0x369618);}})[_0x620d('0x14')](function(_0x35bda0){if(_0x35bda0){_0x452e0a=_0x35bda0[_0x620d('0x4c')];if(!_0x1c9495[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x369618[_0x620d('0x24')]=qs['limit'](_0x1c9495[_0x620d('0x41')][_0x620d('0x24')]);_0x369618[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x1c9495[_0x620d('0x41')][_0x620d('0x22')]);}return _0x30ac05[_0x620d('0xe5')](_0x369618);}})['then'](function(_0x367c98){if(_0x367c98){return _0x367c98?{'count':_0x452e0a,'rows':_0x367c98}:null;}})[_0x620d('0x14')](respondWithResult(_0x2a1d88,null))[_0x620d('0x1d')](handleError(_0x2a1d88,null));};exports['getOpenchannelInteractions']=function(_0x3b6de5,_0x1bcc45){var _0x54e681={};var _0x2b5109={};var _0x49de1e;var _0x3a48e1;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x3b6de5[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x1bcc45,null))[_0x620d('0x14')](function(_0x1bb08e){if(_0x1bb08e){_0x49de1e=_0x1bb08e;_0x2b5109[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0xe6')][_0x620d('0x38')]);_0x2b5109[_0x620d('0x41')]=_[_0x620d('0x58')](_0x3b6de5[_0x620d('0x41')]);_0x2b5109[_0x620d('0x5a')]=_['intersection'](_0x2b5109[_0x620d('0x56')],_0x2b5109[_0x620d('0x41')]);_0x54e681[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x2b5109['model'],qs[_0x620d('0x5c')](_0x3b6de5[_0x620d('0x41')]['fields']));_0x54e681['attributes']=_0x54e681[_0x620d('0x47')][_0x620d('0x4c')]?_0x54e681[_0x620d('0x47')]:_0x2b5109[_0x620d('0x56')];_0x54e681[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x3b6de5['query'][_0x620d('0xd2')]);_0x54e681[_0x620d('0x3f')]=qs['filters'](_[_0x620d('0xd3')](_0x3b6de5[_0x620d('0x41')],_0x2b5109[_0x620d('0x5a')]));if(_0x3b6de5[_0x620d('0x41')]['filter']){_0x54e681[_0x620d('0x3f')]=_['merge'](_0x54e681[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x54e681[_0x620d('0x47')],function(_0x40dee4){var _0x40dd02={};_0x40dd02[_0x40dee4]={'$like':'%'+_0x3b6de5[_0x620d('0x41')]['filter']+'%'};return _0x40dd02;})});}_0x54e681=_[_0x620d('0x5d')]({},_0x54e681,_0x3b6de5['options']);return _0x49de1e[_0x620d('0xe7')](_0x54e681);}})[_0x620d('0x14')](function(_0x7325a8){if(_0x7325a8){_0x3a48e1=_0x7325a8['length'];if(!_0x3b6de5[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x54e681[_0x620d('0x24')]=qs[_0x620d('0x24')](_0x3b6de5[_0x620d('0x41')][_0x620d('0x24')]);_0x54e681[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x3b6de5['query'][_0x620d('0x22')]);}return _0x49de1e[_0x620d('0xe7')](_0x54e681);}})[_0x620d('0x14')](function(_0x4e0e7b){if(_0x4e0e7b){return _0x4e0e7b?{'count':_0x3a48e1,'rows':_0x4e0e7b}:null;}})['then'](respondWithResult(_0x1bcc45,null))[_0x620d('0x1d')](handleError(_0x1bcc45,null));};exports[_0x620d('0xe8')]=function(_0x2ae08f,_0x52b875){var _0x4dc21c={'raw':!![],'where':{}};var _0x42e3ed={};var _0x4afd7f={'count':0x0,'rows':[]};return db[_0x620d('0x40')]['findOne']({'where':{'id':_0x2ae08f['params']['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x52b875,null))['then'](function(_0x36ede8){if(_0x36ede8){_0x42e3ed['model']=_[_0x620d('0x58')](db[_0x620d('0xe9')][_0x620d('0x38')]);_0x42e3ed[_0x620d('0x41')]=_['keys'](_0x2ae08f[_0x620d('0x41')]);_0x42e3ed[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x42e3ed[_0x620d('0x56')],_0x42e3ed['query']);_0x4dc21c[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x42e3ed['model'],qs[_0x620d('0x5c')](_0x2ae08f[_0x620d('0x41')]['fields']));_0x4dc21c['attributes']=_0x4dc21c['attributes']['length']?_0x4dc21c['attributes']:_0x42e3ed[_0x620d('0x56')];if(!_0x2ae08f[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x4dc21c[_0x620d('0x24')]=qs[_0x620d('0x24')](_0x2ae08f[_0x620d('0x41')]['limit']);_0x4dc21c[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x2ae08f[_0x620d('0x41')][_0x620d('0x22')]);}_0x4dc21c[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x2ae08f[_0x620d('0x41')][_0x620d('0xd2')]);_0x4dc21c['where']=qs[_0x620d('0x5a')](_['pick'](_0x2ae08f[_0x620d('0x41')],_0x42e3ed[_0x620d('0x5a')]));_0x4dc21c['where'][_0x620d('0xe3')]=_0x36ede8['id'];if(_0x2ae08f[_0x620d('0x41')]['filter']){_0x4dc21c[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x4dc21c[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x4dc21c[_0x620d('0x47')],function(_0x435335){var _0x4de279={};_0x4de279[_0x435335]={'$like':'%'+_0x2ae08f[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x4de279;})});}_0x4dc21c=_[_0x620d('0x5d')]({},_0x4dc21c,_0x2ae08f[_0x620d('0xd4')]);return db[_0x620d('0xe9')][_0x620d('0x25')]({'where':_0x4dc21c[_0x620d('0x3f')]})[_0x620d('0x14')](function(_0x88df9d){_0x4afd7f[_0x620d('0x25')]=_0x88df9d;if(_0x2ae08f[_0x620d('0x41')][_0x620d('0x42')]){_0x4dc21c[_0x620d('0x43')]=[{'all':!![]}];}return db[_0x620d('0xe9')]['findAll'](_0x4dc21c);})[_0x620d('0x14')](function(_0x177c92){_0x4afd7f[_0x620d('0x4b')]=_0x177c92;return _0x4afd7f;});}})[_0x620d('0x14')](respondWithFilteredResult(_0x52b875,_0x4dc21c))[_0x620d('0x1d')](handleError(_0x52b875,null));};exports['getSmsInteractions']=function(_0x3f521f,_0x46415e){var _0x276e38={};var _0x350737={};var _0x3c6c4;var _0x22837e;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x3f521f[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x46415e,null))[_0x620d('0x14')](function(_0x370eda){if(_0x370eda){_0x3c6c4=_0x370eda;_0x350737['model']=_['keys'](db[_0x620d('0xea')][_0x620d('0x38')]);_0x350737['query']=_[_0x620d('0x58')](_0x3f521f[_0x620d('0x41')]);_0x350737[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x350737[_0x620d('0x56')],_0x350737[_0x620d('0x41')]);_0x276e38[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x350737['model'],qs[_0x620d('0x5c')](_0x3f521f['query'][_0x620d('0x5c')]));_0x276e38[_0x620d('0x47')]=_0x276e38['attributes'][_0x620d('0x4c')]?_0x276e38[_0x620d('0x47')]:_0x350737[_0x620d('0x56')];_0x276e38['order']=qs[_0x620d('0xd2')](_0x3f521f[_0x620d('0x41')][_0x620d('0xd2')]);_0x276e38[_0x620d('0x3f')]=qs[_0x620d('0x5a')](_[_0x620d('0xd3')](_0x3f521f[_0x620d('0x41')],_0x350737['filters']));if(_0x3f521f['query'][_0x620d('0x2f')]){_0x276e38[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x276e38['where'],{'$or':_[_0x620d('0x39')](_0x276e38['attributes'],function(_0x521d3a){var _0xb1d00a={};_0xb1d00a[_0x521d3a]={'$like':'%'+_0x3f521f[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0xb1d00a;})});}_0x276e38=_[_0x620d('0x5d')]({},_0x276e38,_0x3f521f[_0x620d('0xd4')]);return _0x3c6c4[_0x620d('0xeb')](_0x276e38);}})['then'](function(_0x3675e6){if(_0x3675e6){_0x22837e=_0x3675e6[_0x620d('0x4c')];if(!_0x3f521f[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x276e38[_0x620d('0x24')]=qs['limit'](_0x3f521f[_0x620d('0x41')][_0x620d('0x24')]);_0x276e38[_0x620d('0x22')]=qs['offset'](_0x3f521f['query']['offset']);}return _0x3c6c4[_0x620d('0xeb')](_0x276e38);}})[_0x620d('0x14')](function(_0x20fa9a){if(_0x20fa9a){return _0x20fa9a?{'count':_0x22837e,'rows':_0x20fa9a}:null;}})[_0x620d('0x14')](respondWithResult(_0x46415e,null))[_0x620d('0x1d')](handleError(_0x46415e,null));};exports[_0x620d('0xec')]=function(_0x257482,_0x5c57a3){var _0x26d42e={};var _0x3796e5={};var _0x1eff60;var _0x8316fc;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x257482[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x5c57a3,null))[_0x620d('0x14')](function(_0x4d0610){if(_0x4d0610){_0x1eff60=_0x4d0610;_0x3796e5[_0x620d('0x56')]=_['keys'](db[_0x620d('0xed')][_0x620d('0x38')]);_0x3796e5['query']=_['keys'](_0x257482['query']);_0x3796e5['filters']=_[_0x620d('0x5b')](_0x3796e5['model'],_0x3796e5[_0x620d('0x41')]);_0x26d42e[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x3796e5[_0x620d('0x56')],qs[_0x620d('0x5c')](_0x257482[_0x620d('0x41')]['fields']));_0x26d42e[_0x620d('0x47')]=_0x26d42e[_0x620d('0x47')][_0x620d('0x4c')]?_0x26d42e[_0x620d('0x47')]:_0x3796e5[_0x620d('0x56')];_0x26d42e['order']=qs['sort'](_0x257482['query'][_0x620d('0xd2')]);_0x26d42e['where']=qs[_0x620d('0x5a')](_['pick'](_0x257482[_0x620d('0x41')],_0x3796e5[_0x620d('0x5a')]));if(_0x257482[_0x620d('0x41')][_0x620d('0x2f')]){_0x26d42e[_0x620d('0x3f')]=_['merge'](_0x26d42e['where'],{'$or':_[_0x620d('0x39')](_0x26d42e[_0x620d('0x47')],function(_0x5a85dd){var _0x277e1c={};_0x277e1c[_0x5a85dd]={'$like':'%'+_0x257482[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x277e1c;})});}_0x26d42e=_['merge']({},_0x26d42e,_0x257482[_0x620d('0xd4')]);return _0x1eff60[_0x620d('0xec')](_0x26d42e);}})[_0x620d('0x14')](function(_0x4aaeee){if(_0x4aaeee){_0x8316fc=_0x4aaeee[_0x620d('0x4c')];if(!_0x257482['query'][_0x620d('0xdc')]('nolimit')){_0x26d42e[_0x620d('0x24')]=qs[_0x620d('0x24')](_0x257482[_0x620d('0x41')]['limit']);_0x26d42e[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x257482['query'][_0x620d('0x22')]);}return _0x1eff60[_0x620d('0xec')](_0x26d42e);}})[_0x620d('0x14')](function(_0x56223c){if(_0x56223c){return _0x56223c?{'count':_0x8316fc,'rows':_0x56223c}:null;}})[_0x620d('0x14')](respondWithResult(_0x5c57a3,null))['catch'](handleError(_0x5c57a3,null));};exports['getWhatsappInteractions']=function(_0x24d683,_0x244bc7){var _0x3a9966={};var _0xfa570={};var _0x1d3a42;var _0x397099;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x24d683[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x244bc7,null))['then'](function(_0x5a01b6){if(_0x5a01b6){_0x1d3a42=_0x5a01b6;_0xfa570[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0xee')][_0x620d('0x38')]);_0xfa570[_0x620d('0x41')]=_[_0x620d('0x58')](_0x24d683[_0x620d('0x41')]);_0xfa570['filters']=_[_0x620d('0x5b')](_0xfa570[_0x620d('0x56')],_0xfa570['query']);_0x3a9966[_0x620d('0x47')]=_['intersection'](_0xfa570[_0x620d('0x56')],qs['fields'](_0x24d683[_0x620d('0x41')]['fields']));_0x3a9966[_0x620d('0x47')]=_0x3a9966['attributes']['length']?_0x3a9966[_0x620d('0x47')]:_0xfa570[_0x620d('0x56')];_0x3a9966[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x24d683[_0x620d('0x41')][_0x620d('0xd2')]);_0x3a9966[_0x620d('0x3f')]=qs['filters'](_[_0x620d('0xd3')](_0x24d683[_0x620d('0x41')],_0xfa570['filters']));if(_0x24d683[_0x620d('0x41')][_0x620d('0x2f')]){_0x3a9966[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x3a9966[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x3a9966[_0x620d('0x47')],function(_0x40a89c){var _0x2ec83d={};_0x2ec83d[_0x40a89c]={'$like':'%'+_0x24d683[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x2ec83d;})});}_0x3a9966=_[_0x620d('0x5d')]({},_0x3a9966,_0x24d683[_0x620d('0xd4')]);return _0x1d3a42[_0x620d('0xef')](_0x3a9966);}})['then'](function(_0x1d1d15){if(_0x1d1d15){_0x397099=_0x1d1d15[_0x620d('0x4c')];if(!_0x24d683[_0x620d('0x41')][_0x620d('0xdc')](_0x620d('0xde'))){_0x3a9966['limit']=qs[_0x620d('0x24')](_0x24d683['query'][_0x620d('0x24')]);_0x3a9966[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x24d683[_0x620d('0x41')][_0x620d('0x22')]);}return _0x1d3a42[_0x620d('0xef')](_0x3a9966);}})['then'](function(_0x4fd43d){if(_0x4fd43d){return _0x4fd43d?{'count':_0x397099,'rows':_0x4fd43d}:null;}})[_0x620d('0x14')](respondWithResult(_0x244bc7,null))[_0x620d('0x1d')](handleError(_0x244bc7,null));};exports['login']=function(_0x2055b1,_0x5883cb,_0x2f958a){var _0x519bc3;var _0x310667;var _0xe7f32e;var _0x3c3e5c=!_[_0x620d('0x68')](_0x2055b1['params']['id'])?_0x2055b1[_0x620d('0x55')]['id']:!_[_0x620d('0x68')](_0x2055b1[_0x620d('0x2b')]['id'])?_0x2055b1[_0x620d('0x2b')]['id']:null;return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x3c3e5c,'role':{'$or':[_0x620d('0x29'),_0x620d('0x2b'),'agent']}},'attributes':['id',_0x620d('0x34'),'phone','mobile',_0x620d('0x32'),_0x620d('0x64'),_0x620d('0x9f')]})[_0x620d('0x14')](function(_0x1ee9bf){if(_0x1ee9bf){if(_0x1ee9bf[_0x620d('0x32')]==='agent'){_0x519bc3=_0x1ee9bf;if(_0x2055b1[_0x620d('0x5f')][_0x620d('0xab')]){_0xe7f32e=util['format']('LOCAL/%s@from-sip/n',_0x519bc3[_0x2055b1[_0x620d('0x5f')][_0x620d('0xab')]]);}else if(_0x2055b1[_0x620d('0x5f')]['intrf']){_0xe7f32e=util[_0x620d('0xac')](_0x620d('0xad'),_0x2055b1[_0x620d('0x5f')][_0x620d('0xf0')]);}else{_0xe7f32e=util[_0x620d('0xac')]('SIP/%s',_0x519bc3['name']);}socket['to'](util[_0x620d('0xac')](_0x620d('0xf1'),_0x519bc3['name']))[_0x620d('0xb4')](_0x620d('0xf2'),{'user':{'id':_0x519bc3['id'],'name':_0x519bc3[_0x620d('0x34')]},'ip':_0x2055b1[_0x620d('0xf3')][_0x620d('0xf4')]||_0x2055b1['connection']['remoteAddress']||_0x2055b1[_0x620d('0xf5')][_0x620d('0xf6')]||_0x2055b1['connection'][_0x620d('0xf5')][_0x620d('0xf6')]});return db['UserVoiceQueueRt'][_0x620d('0xb6')]({'where':{'membername':_0x519bc3[_0x620d('0x34')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x620d('0x90'))](_0x620d('0xf7'));}})[_0x620d('0x14')](function(){if(_0x519bc3){return _0x519bc3[_0x620d('0xf8')]({'raw':!![]});}})['then'](function(_0x30b677){if(_0x519bc3){var _0x401829=[];if(_0x30b677){_0x310667=_0x30b677;if(_0x310667[_0x620d('0x4c')]){for(var _0x533719=0x0;_0x533719<_0x310667[_0x620d('0x4c')];_0x533719++){_0x401829[_0x620d('0x48')]({'membername':_0x519bc3[_0x620d('0x34')],'UserId':_0x519bc3['id'],'queue_name':_0x310667[_0x533719]['name'],'VoiceQueueId':_0x310667[_0x533719]['id'],'interface':_0xe7f32e,'paused':_0x519bc3[_0x620d('0x9f')]||![],'penalty':_0x310667[_0x533719]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x620d('0x8a')](_0x401829,function(_0x1ff091){return db[_0x620d('0xae')][_0x620d('0xaf')](_0x1ff091);});}}}})['then'](function(){if(_0x519bc3){return db[_0x620d('0xf9')][_0x620d('0x49')]({'where':{'membername':_0x519bc3[_0x620d('0x34')],'exitAt':null}});}})[_0x620d('0x14')](function(_0x20a29e){if(_0x519bc3){var _0x54d450=[];_0x20a29e[_0x620d('0xfa')](function(_0x200c19){_0x54d450[_0x620d('0x48')](_0x200c19['update']({'exitAt':moment()[_0x620d('0xac')](_0x620d('0xfb'))}));});return BPromise[_0x620d('0x5e')](_0x54d450);}})[_0x620d('0x14')](function(){if(_0x519bc3){var _0x4583a9=[];var _0x36391c=[];var _0x196b95=utils['getChannels']();var _0x53af20={'membername':_0x519bc3[_0x620d('0x34')],'interface':_0xe7f32e,'enterAt':moment()['format'](_0x620d('0xfb')),'role':_0x519bc3['role'],'internal':_0x519bc3[_0x620d('0x64')]};_0x196b95['forEach'](function(_0xe61eb2){_0x4583a9[_0x620d('0x48')](_[_0x620d('0x5d')]({'channel':_0xe61eb2,'type':_0x620d('0xfc'),'data1':_0x2055b1[_0x620d('0x5f')][_0x620d('0xfd')],'data2':_0xe7f32e},_0x53af20));if(_0x519bc3[_0x620d('0x9f')]){_0x36391c[_0x620d('0x48')](_['merge']({'channel':_0xe61eb2,'type':_0x620d('0xfe'),'data1':_0x620d('0xff')},_0x53af20));}});return db['MemberReport'][_0x620d('0x87')](_0x4583a9[_0x620d('0xcd')](_0x36391c),{'individualHooks':!![]});}})[_0x620d('0x14')](function(){if(_0x519bc3){return _0x519bc3['update']({'online':!![],'lastLoginAt':moment()[_0x620d('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x519bc3['loginInPause']||![],'mailPause':_0x519bc3[_0x620d('0x9f')]||![],'chatPause':_0x519bc3[_0x620d('0x9f')]||![],'faxPause':_0x519bc3['loginInPause']||![],'smsPause':_0x519bc3[_0x620d('0x9f')]||![],'openchannelPause':_0x519bc3[_0x620d('0x9f')]||![],'whatsappPause':_0x519bc3['loginInPause']||![],'pauseType':_0x519bc3[_0x620d('0x9f')]?_0x620d('0xff'):null,'interface':_0xe7f32e,'lastPauseAt':moment()['format'](_0x620d('0xfb'))});}})['then'](function(_0x574069){if(_0x2055b1[_0x620d('0x100')]){return _0x2f958a();}else{return BPromise[_0x620d('0x101')](_0x574069)[_0x620d('0x14')](respondWithResult(_0x5883cb,null));}})[_0x620d('0x1d')](handleError(_0x5883cb,null));};exports[_0x620d('0x102')]=function(_0x3de115,_0x3dff52){var _0x40994b;return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x3de115['params']['id'],'role':_0x620d('0x84')},'attributes':['id','name',_0x620d('0x32')]})['then'](handleEntityNotFound(_0x3dff52,null))[_0x620d('0x14')](function(_0x543fe6){if(_0x543fe6){_0x40994b=_0x543fe6;return db[_0x620d('0xae')]['destroy']({'where':{'membername':_0x40994b[_0x620d('0x34')]},'individualHooks':!![]});}})[_0x620d('0x14')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x40994b[_0x620d('0x34')],'exitAt':null}});})[_0x620d('0x14')](function(_0x577629){var _0x37c67b=[];_0x577629[_0x620d('0xfa')](function(_0x8de5d8){_0x37c67b[_0x620d('0x48')](_0x8de5d8['update']({'exitAt':moment()[_0x620d('0xac')](_0x620d('0xfb'))}));});return BPromise[_0x620d('0x5e')](_0x37c67b);})['then'](function(){return _0x40994b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x620d('0x14')](respondWithResult(_0x3dff52,null))['catch'](handleError(_0x3dff52,null));};exports[_0x620d('0x103')]=function(_0x35a35f,_0x9706e8){var _0x304228;return db[_0x620d('0xae')][_0x620d('0x28')]({'paused':0x1},{'where':{'UserId':_0x35a35f[_0x620d('0x55')]['id']},'individualHooks':!![]})[_0x620d('0x14')](function(){return db[_0x620d('0x40')]['find']({'where':{'id':_0x35a35f[_0x620d('0x55')]['id'],'role':'agent'},'attributes':['id',_0x620d('0x34'),_0x620d('0x32'),_0x620d('0x64'),'interface']});})[_0x620d('0x14')](handleEntityNotFound(_0x9706e8,null))[_0x620d('0x14')](function(_0xc72102){if(_0xc72102){_0x304228=_0xc72102;return respondWithRpcPromise(_0x620d('0x104'),_0x620d('0x103'),{'id':_0x304228['id'],'name':_0x304228[_0x620d('0x34')],'pause':!![]});}})[_0x620d('0x14')](function(){if(_0x304228){return db[_0x620d('0xf9')][_0x620d('0x49')]({'where':{'membername':_0x304228['name'],'type':_0x620d('0xfe'),'exitAt':null}});}})['then'](function(_0x2e0507){if(_0x2e0507[_0x620d('0x4c')]){var _0x2d260b=moment()[_0x620d('0xac')](_0x620d('0xfb'));for(var _0x5efca2=0x0,_0x25c553=_0x2e0507[_0x620d('0x4c')];_0x5efca2<_0x25c553;_0x5efca2++){_0x2e0507[_0x5efca2][_0x620d('0x105')]({'exitAt':_0x2d260b});}}})[_0x620d('0x14')](function(){var _0x23868b=[];var _0x6086e8=utils[_0x620d('0x106')]();_0x6086e8[_0x620d('0xfa')](function(_0xa09c0a){_0x23868b[_0x620d('0x48')]({'channel':_0xa09c0a,'membername':_0x304228[_0x620d('0x34')],'interface':_['isNil'](_0x304228[_0x620d('0xab')])?util['format']('SIP/%s',_0x304228[_0x620d('0x34')]):_0x304228[_0x620d('0xab')],'type':_0x620d('0xfe'),'enterAt':moment()['format'](_0x620d('0xfb')),'data1':_0x35a35f[_0x620d('0x5f')][_0x620d('0x3b')]||_0x620d('0x107'),'role':_0x304228[_0x620d('0x32')],'internal':_0x304228[_0x620d('0x64')]});});return db['MemberReport']['bulkCreate'](_0x23868b,{'individualHooks':!![]});})[_0x620d('0x14')](function(){return _0x304228[_0x620d('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x35a35f[_0x620d('0x5f')][_0x620d('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x620d('0xac')](_0x620d('0xfb'))});})[_0x620d('0x14')](respondWithResult(_0x9706e8,null))['catch'](handleError(_0x9706e8,null));};exports['unpause']=function(_0x50495b,_0x1df1c9){var _0x31669f;return db[_0x620d('0x40')][_0x620d('0x33')]({'where':{'id':_0x50495b['params']['id']},'attributes':['id',_0x620d('0x34'),_0x620d('0x32'),_0x620d('0x108'),'mailPause','chatPause','faxPause',_0x620d('0x109'),'smsPause',_0x620d('0x10a'),'pauseType','lastPauseAt']})[_0x620d('0x14')](handleEntityNotFound(_0x1df1c9,null))[_0x620d('0x14')](function(_0x38f81d){if(_0x38f81d){_0x31669f=_0x38f81d;if(_0x50495b['body'][_0x620d('0x9d')]&&!utils[_0x620d('0xa0')](_0x50495b[_0x620d('0x5f')][_0x620d('0x9d')])){throw new db[(_0x620d('0x95'))][(_0x620d('0x90'))](_0x620d('0xb1'));}switch(_0x50495b['body'][_0x620d('0x9d')]){case _0x620d('0xa8'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x31669f['id'],'name':_0x31669f[_0x620d('0x34')],'pause':![]})[_0x620d('0x14')](function(){return db[_0x620d('0xae')][_0x620d('0x28')]({'paused':0x0},{'where':{'UserId':_0x31669f['id']},'individualHooks':!![]});})[_0x620d('0x14')](function(){return db[_0x620d('0xf9')][_0x620d('0x33')]({'where':{'channel':_0x50495b[_0x620d('0x5f')][_0x620d('0x9d')],'membername':_0x31669f['name'],'type':'PAUSE','exitAt':null}});})[_0x620d('0x14')](function(_0x3fac1f){if(_0x3fac1f){return _0x3fac1f['update']({'exitAt':moment()[_0x620d('0xac')](_0x620d('0xfb')),'data2':_0x620d('0x10b')},{'individualHooks':!![]});}return null;})[_0x620d('0x14')](function(){return _0x31669f['update']({'voicePause':![]});});case _0x620d('0x51'):case _0x620d('0x4d'):case _0x620d('0x50'):case _0x620d('0x4f'):case _0x620d('0x53'):case'openchannel':return db['MemberReport'][_0x620d('0x33')]({'where':{'channel':_0x50495b[_0x620d('0x5f')][_0x620d('0x9d')],'membername':_0x31669f[_0x620d('0x34')],'type':_0x620d('0xfe'),'exitAt':null}})['then'](function(_0x8e94fb){if(_0x8e94fb){return _0x8e94fb[_0x620d('0x28')]({'exitAt':moment()[_0x620d('0xac')](_0x620d('0xfb')),'data2':_0x620d('0x10b')},{'individualHooks':!![]});}return null;})[_0x620d('0x14')](function(){var _0x277561={};_[_0x620d('0x26')](_0x277561,util[_0x620d('0xac')]('%s%s',_0x50495b['body'][_0x620d('0x9d')],_0x620d('0x10c')),![]);return _0x31669f['update'](_0x277561);});default:return respondWithRpcPromise(_0x620d('0x104'),'unpause',{'id':_0x31669f['id'],'name':_0x31669f[_0x620d('0x34')],'pause':![]})[_0x620d('0x14')](function(){return db['UserVoiceQueueRt'][_0x620d('0x28')]({'paused':0x0},{'where':{'UserId':_0x31669f['id']}});})['then'](function(){return db[_0x620d('0xf9')]['findAll']({'where':{'membername':_0x31669f[_0x620d('0x34')],'type':_0x620d('0xfe'),'exitAt':null}});})[_0x620d('0x14')](function(_0x47d642){var _0x200744=[];_0x47d642[_0x620d('0xfa')](function(_0x2621c6){_0x200744[_0x620d('0x48')](_0x2621c6['update']({'exitAt':moment()['format'](_0x620d('0xfb')),'data2':'manual'}));});return BPromise['all'](_0x200744);})[_0x620d('0x14')](function(){return _0x31669f[_0x620d('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1df1c9,null))[_0x620d('0x1d')](handleError(_0x1df1c9,null));};exports[_0x620d('0x10d')]=function(_0x327c7,_0xd1808e){var _0x554822={};var _0x50ac40={};var _0x36b1b1;var _0x9b78a9;return db['User'][_0x620d('0xcf')]({'where':{'id':_0x327c7[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0xd1808e,null))[_0x620d('0x14')](function(_0x4bf4c8){if(_0x4bf4c8){_0x36b1b1=_0x4bf4c8;_0x50ac40['model']=_[_0x620d('0x58')](db['Team'][_0x620d('0x38')]);_0x50ac40[_0x620d('0x41')]=_['keys'](_0x327c7[_0x620d('0x41')]);_0x50ac40[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x50ac40[_0x620d('0x56')],_0x50ac40[_0x620d('0x41')]);_0x554822[_0x620d('0x47')]=_['intersection'](_0x50ac40[_0x620d('0x56')],qs['fields'](_0x327c7[_0x620d('0x41')][_0x620d('0x5c')]));_0x554822[_0x620d('0x47')]=_0x554822[_0x620d('0x47')][_0x620d('0x4c')]?_0x554822[_0x620d('0x47')]:_0x50ac40[_0x620d('0x56')];_0x554822[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x327c7[_0x620d('0x41')][_0x620d('0xd2')]);_0x554822[_0x620d('0x3f')]=qs['filters'](_[_0x620d('0xd3')](_0x327c7['query'],_0x50ac40[_0x620d('0x5a')]));if(_0x327c7['query'][_0x620d('0x2f')]){_0x554822['where']=_[_0x620d('0x5d')](_0x554822[_0x620d('0x3f')],{'$or':_['map'](_0x554822[_0x620d('0x47')],function(_0x4f9a01){var _0x20a1a8={};_0x20a1a8[_0x4f9a01]={'$like':'%'+_0x327c7[_0x620d('0x41')][_0x620d('0x2f')]+'%'};return _0x20a1a8;})});}_0x554822=_[_0x620d('0x5d')]({},_0x554822,_0x327c7[_0x620d('0xd4')]);return _0x36b1b1[_0x620d('0x10d')](_0x554822);}})['then'](function(_0x2c5833){if(_0x2c5833){_0x9b78a9=_0x2c5833[_0x620d('0x4c')];if(!_0x327c7[_0x620d('0x41')]['hasOwnProperty']('nolimit')){_0x554822['limit']=qs[_0x620d('0x24')](_0x327c7[_0x620d('0x41')][_0x620d('0x24')]);_0x554822[_0x620d('0x22')]=qs[_0x620d('0x22')](_0x327c7['query'][_0x620d('0x22')]);}return _0x36b1b1[_0x620d('0x10d')](_0x554822);}})[_0x620d('0x14')](function(_0x1309c3){if(_0x1309c3){return _0x1309c3?{'count':_0x9b78a9,'rows':_0x1309c3}:null;}})[_0x620d('0x14')](respondWithResult(_0xd1808e,null))['catch'](handleError(_0xd1808e,null));};exports['addTeams']=function(_0x3200ff,_0x417608){return db['User'][_0x620d('0x33')]({'where':{'id':_0x3200ff[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x417608,null))['then'](function(_0x114981){if(_0x114981){var _0x538a66=_0x114981[_0x620d('0xaa')]({'plain':!![]});return _0x114981[_0x620d('0x10e')](_0x3200ff[_0x620d('0x5f')]['ids'],_[_0x620d('0x63')](_0x3200ff[_0x620d('0x5f')],[_0x620d('0x62'),'id'])||{})[_0x620d('0x14')](function(){for(var _0x13d94e=0x0;_0x13d94e<_0x3200ff['body'][_0x620d('0x62')][_0x620d('0x4c')];_0x13d94e++){var _0xa9f975=[];var _0x127875={};db[_0x620d('0x10f')][_0x620d('0xcf')]({'where':{'id':_0x3200ff[_0x620d('0x5f')][_0x620d('0x62')][_0x13d94e]}})[_0x620d('0x14')](function(_0x560120){_0x127875=_0x560120[_0x620d('0x4e')];_0xa9f975[_0x620d('0x48')](_0x560120[_0x620d('0xf8')]()[_0x620d('0x14')](function(_0x2b0b2e){for(var _0x4f2565=0x0;_0x4f2565<_0x2b0b2e[_0x620d('0x4c')];_0x4f2565++){_0x2b0b2e[_0x4f2565][_0x620d('0x110')](_0x620d('0x9d'),_0x620d('0x111'));}return _0x2b0b2e;}));_0xa9f975[_0x620d('0x48')](_0x560120[_0x620d('0x112')]()['then'](function(_0x582fd6){for(var _0x5b143f=0x0;_0x5b143f<_0x582fd6[_0x620d('0x4c')];_0x5b143f++){_0x582fd6[_0x5b143f][_0x620d('0x110')](_0x620d('0x9d'),_0x620d('0x113'));}return _0x582fd6;}));_0xa9f975[_0x620d('0x48')](_0x560120[_0x620d('0x114')]()['then'](function(_0x242014){for(var _0x3c8488=0x0;_0x3c8488<_0x242014['length'];_0x3c8488++){_0x242014[_0x3c8488][_0x620d('0x110')]('channel',_0x620d('0x115'));}return _0x242014;}));_0xa9f975[_0x620d('0x48')](_0x560120[_0x620d('0x116')]()[_0x620d('0x14')](function(_0x73895e){for(var _0x4b79f9=0x0;_0x4b79f9<_0x73895e['length'];_0x4b79f9++){_0x73895e[_0x4b79f9][_0x620d('0x110')]('channel',_0x620d('0x117'));}return _0x73895e;}));_0xa9f975['push'](_0x560120[_0x620d('0x118')]()[_0x620d('0x14')](function(_0x1cc90b){for(var _0x1d31cb=0x0;_0x1d31cb<_0x1cc90b[_0x620d('0x4c')];_0x1d31cb++){_0x1cc90b[_0x1d31cb][_0x620d('0x110')](_0x620d('0x9d'),'Whatsapp');}return _0x1cc90b;}));_0xa9f975[_0x620d('0x48')](_0x560120[_0x620d('0x119')]()['then'](function(_0x1b216f){for(var _0x4a21af=0x0;_0x4a21af<_0x1b216f[_0x620d('0x4c')];_0x4a21af++){_0x1b216f[_0x4a21af][_0x620d('0x110')]('channel',_0x620d('0x11a'));}return _0x1b216f;}));_0xa9f975[_0x620d('0x48')](_0x560120[_0x620d('0x11b')]()[_0x620d('0x14')](function(_0x2df841){for(var _0x22b3a8=0x0;_0x22b3a8<_0x2df841['length'];_0x22b3a8++){_0x2df841[_0x22b3a8][_0x620d('0x110')](_0x620d('0x9d'),_0x620d('0x11c'));}return _0x2df841;}));return BPromise[_0x620d('0x5e')](_0xa9f975);})[_0x620d('0x14')](function(_0x463f96){var _0x44df2c=_[_0x620d('0x11d')](_0x463f96);_0xa9f975=[];return db[_0x620d('0x6a')][_0x620d('0x11e')](function(_0x3bff4c){for(var _0x3329cb=0x0;_0x3329cb<_0x44df2c['length'];_0x3329cb++){_0xa9f975['push'](_0x44df2c[_0x3329cb][_0x620d('0x11f')](_0x538a66['id']),{'transaction':_0x3bff4c});}return BPromise[_0x620d('0x5e')](_0xa9f975)['then'](function(){if(_0x538a66[_0x620d('0x9e')]){return BPromise['each'](_['filter'](_0x44df2c,function(_0x560edf){return _0x560edf[_0x620d('0x120')](_0x620d('0x9d'))===_0x620d('0x111');}),function(_0x10f6f8){return db[_0x620d('0xae')]['upsert']({'membername':_0x538a66[_0x620d('0x34')],'UserId':_0x538a66['id'],'queue_name':_0x10f6f8[_0x620d('0x34')],'VoiceQueueId':_0x10f6f8['id'],'interface':_[_0x620d('0x68')](_0x538a66['interface'])?util[_0x620d('0xac')](_0x620d('0xad'),_0x538a66['name']):_0x538a66['interface'],'paused':_0x538a66[_0x620d('0x108')]||![],'penalty':_0x538a66[_0x620d('0xa5')]},{'transaction':_0x3bff4c});});}else{return;}})[_0x620d('0x14')](function(){for(var _0x19286e=0x0;_0x19286e<_0x44df2c[_0x620d('0x4c')];_0x19286e++){var _0x726582=_0x44df2c[_0x19286e][_0x620d('0x120')](_0x620d('0x9d'));var _0x4bafe7=_0x726582+_0x620d('0xa7');socket['emit'](_0x620d('0x2b')+_0x726582+'Queue:save',{'UserId':_0x538a66['id'],['queueField']:_0x44df2c[_0x19286e]['id']});}});});})['then'](function(){db[_0x620d('0x121')][_0x620d('0xcf')]({'where':{'teamId':_0x127875['id']}})[_0x620d('0x14')](function(_0x1bc106){if(_0x1bc106){db['UserVoicePrefix'][_0x620d('0x7e')]({'UserId':_0x3200ff['params']['id'],'VoicePrefixId':_0x1bc106[_0x620d('0x122')]});}});});}});}})['then'](respondWithStatusCode(_0x417608,null))[_0x620d('0x1d')](handleError(_0x417608,null));};exports[_0x620d('0x123')]=function(_0x188460,_0x2fe69f){return db[_0x620d('0x40')]['findOne']({'where':{'id':_0x188460[_0x620d('0x55')]['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x2fe69f,null))[_0x620d('0x14')](function(_0x2a166d){if(_0x2a166d){var _0x2356e2=_0x2a166d['get']({'plain':!![]});var _0x4e91d6=_0x188460[_0x620d('0x41')][_0x620d('0x62')];return _0x2a166d[_0x620d('0x123')](_0x4e91d6)[_0x620d('0x14')](function(){for(var _0xe75b40=0x0;_0xe75b40<_0x4e91d6['length'];_0xe75b40++){var _0x5c5361=[];var _0x23d5c5={};db[_0x620d('0x10f')][_0x620d('0xcf')]({'where':{'id':_0x4e91d6[_0xe75b40]}})[_0x620d('0x14')](function(_0x3cc786){_0x23d5c5=_0x3cc786['dataValues'];_0x5c5361[_0x620d('0x48')](_0x3cc786[_0x620d('0xf8')]()[_0x620d('0x14')](function(_0x26aac8){for(var _0x44c9b6=0x0;_0x44c9b6<_0x26aac8[_0x620d('0x4c')];_0x44c9b6++){_0x26aac8[_0x44c9b6][_0x620d('0x110')]('channel',_0x620d('0x111'));}return _0x26aac8;}));_0x5c5361[_0x620d('0x48')](_0x3cc786[_0x620d('0x112')]()[_0x620d('0x14')](function(_0x3cc2aa){for(var _0x421ae5=0x0;_0x421ae5<_0x3cc2aa[_0x620d('0x4c')];_0x421ae5++){_0x3cc2aa[_0x421ae5][_0x620d('0x110')]('channel',_0x620d('0x113'));}return _0x3cc2aa;}));_0x5c5361[_0x620d('0x48')](_0x3cc786[_0x620d('0x114')]()[_0x620d('0x14')](function(_0x40884d){for(var _0x355b56=0x0;_0x355b56<_0x40884d[_0x620d('0x4c')];_0x355b56++){_0x40884d[_0x355b56][_0x620d('0x110')](_0x620d('0x9d'),'Mail');}return _0x40884d;}));_0x5c5361[_0x620d('0x48')](_0x3cc786['getSmsQueues']()[_0x620d('0x14')](function(_0x366eb6){for(var _0x13522b=0x0;_0x13522b<_0x366eb6[_0x620d('0x4c')];_0x13522b++){_0x366eb6[_0x13522b]['setDataValue'](_0x620d('0x9d'),_0x620d('0x117'));}return _0x366eb6;}));_0x5c5361[_0x620d('0x48')](_0x3cc786[_0x620d('0x118')]()[_0x620d('0x14')](function(_0x147a2f){for(var _0x2144f1=0x0;_0x2144f1<_0x147a2f['length'];_0x2144f1++){_0x147a2f[_0x2144f1][_0x620d('0x110')](_0x620d('0x9d'),_0x620d('0x124'));}return _0x147a2f;}));_0x5c5361[_0x620d('0x48')](_0x3cc786[_0x620d('0x119')]()[_0x620d('0x14')](function(_0x42d4a2){for(var _0x75fe99=0x0;_0x75fe99<_0x42d4a2[_0x620d('0x4c')];_0x75fe99++){_0x42d4a2[_0x75fe99]['setDataValue'](_0x620d('0x9d'),_0x620d('0x11a'));}return _0x42d4a2;}));_0x5c5361[_0x620d('0x48')](_0x3cc786[_0x620d('0x11b')]()[_0x620d('0x14')](function(_0x5c5271){for(var _0x597bc3=0x0;_0x597bc3<_0x5c5271[_0x620d('0x4c')];_0x597bc3++){_0x5c5271[_0x597bc3][_0x620d('0x110')](_0x620d('0x9d'),'Openchannel');}return _0x5c5271;}));return BPromise[_0x620d('0x5e')](_0x5c5361);})[_0x620d('0x14')](function(_0x53bc6a){var _0x42e7f9=_[_0x620d('0x11d')](_0x53bc6a);_0x5c5361=[];return db[_0x620d('0x6a')][_0x620d('0x11e')](function(_0x1c9a4d){for(var _0x99539f=0x0;_0x99539f<_0x42e7f9[_0x620d('0x4c')];_0x99539f++){_0x5c5361[_0x620d('0x48')](_0x42e7f9[_0x99539f]['removeAgent'](_0x2356e2['id']),{'transaction':_0x1c9a4d});}return BPromise[_0x620d('0x5e')](_0x5c5361)[_0x620d('0x14')](function(){if(_0x2356e2['online']){return BPromise[_0x620d('0x8a')](_[_0x620d('0x2f')](_0x42e7f9,function(_0x13417d){return _0x13417d['getDataValue'](_0x620d('0x9d'))===_0x620d('0x111');}),function(_0x503122){return db[_0x620d('0xae')][_0x620d('0xb6')]({'where':{'VoiceQueueId':_0x503122['id'],'UserId':_0x2356e2['id']},'transaction':_0x1c9a4d});});}else{return;}})[_0x620d('0x14')](function(){db[_0x620d('0x121')][_0x620d('0xcf')]({'where':{'teamId':_0x23d5c5['id']}})[_0x620d('0x14')](function(_0x4ad24e){if(_0x4ad24e){return db['UserVoicePrefix'][_0x620d('0xb6')]({'where':{'UserId':_0x2356e2['id'],'VoicePrefixId':_0x4ad24e[_0x620d('0x4e')]['VoicePrefixId']}});}});})[_0x620d('0x14')](function(){for(var _0x3efc9b=0x0;_0x3efc9b<_0x42e7f9[_0x620d('0x4c')];_0x3efc9b++){var _0x1d297e=_0x42e7f9[_0x3efc9b][_0x620d('0x120')](_0x620d('0x9d'));var _0x96e4e0=_0x1d297e+'QueueId';socket[_0x620d('0xb4')](_0x620d('0x2b')+_0x1d297e+_0x620d('0xb5'),{'UserId':_0x2356e2['id'],['queueField']:_0x42e7f9[_0x3efc9b]['id']});}});});});}});}})[_0x620d('0x14')](respondWithStatusCode(_0x2fe69f,null))[_0x620d('0x1d')](handleError(_0x2fe69f,null));};exports[_0x620d('0x125')]=function(_0x440221,_0x5d91fc){var _0x38472b={};var _0x12c152={};var _0x103209;var _0x2a6327;return db[_0x620d('0x40')][_0x620d('0xcf')]({'where':{'id':_0x440221['params']['id']}})[_0x620d('0x14')](handleEntityNotFound(_0x5d91fc,null))[_0x620d('0x14')](function(_0x51b964){if(_0x51b964){_0x103209=_0x51b964;_0x12c152[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0x126')][_0x620d('0x38')]);_0x12c152[_0x620d('0x41')]=_['keys'](_0x440221[_0x620d('0x41')]);_0x12c152['filters']=_['intersection'](_0x12c152['model'],_0x12c152['query']);_0x38472b[_0x620d('0x47')]=_[_0x620d('0x5b')](_0x12c152['model'],qs[_0x620d('0x5c')](_0x440221['query'][_0x620d('0x5c')]));_0x38472b[_0x620d('0x47')]=_0x38472b[_0x620d('0x47')][_0x620d('0x4c')]?_0x38472b[_0x620d('0x47')]:_0x12c152[_0x620d('0x56')];_0x38472b[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x440221[_0x620d('0x41')][_0x620d('0xd2')]);_0x38472b['where']=qs[_0x620d('0x5a')](_[_0x620d('0xd3')](_0x440221['query'],_0x12c152[_0x620d('0x5a')]));if(_0x440221[_0x620d('0x41')][_0x620d('0x2f')]){_0x38472b[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x38472b[_0x620d('0x3f')],{'$or':_[_0x620d('0x39')](_0x38472b[_0x620d('0x47')],function(_0x1c8a75){var _0x2f86b6={};_0x2f86b6[_0x1c8a75]={'$like':'%'+_0x440221[_0x620d('0x41')]['filter']+'%'};return _0x2f86b6;})});}_0x38472b=_[_0x620d('0x5d')]({},_0x38472b,_0x440221[_0x620d('0xd4')]);return _0x103209[_0x620d('0x125')](_0x38472b);}})[_0x620d('0x14')](function(_0x4f0d77){if(_0x4f0d77){_0x2a6327=_0x4f0d77['length'];if(!_0x440221[_0x620d('0x41')]['hasOwnProperty']('nolimit')){_0x38472b['limit']=qs['limit'](_0x440221[_0x620d('0x41')]['limit']);_0x38472b['offset']=qs['offset'](_0x440221[_0x620d('0x41')][_0x620d('0x22')]);}return _0x103209[_0x620d('0x125')](_0x38472b);}})[_0x620d('0x14')](function(_0x5d8117){if(_0x5d8117){return _0x5d8117?{'count':_0x2a6327,'rows':_0x5d8117}:null;}})[_0x620d('0x14')](respondWithResult(_0x5d91fc,null))[_0x620d('0x1d')](handleError(_0x5d91fc,null));};exports['getAgents']=function(_0x2316fe,_0xa52f1){var _0x2bff6d={};var _0x55cff0={};var _0x29fa16;return db[_0x620d('0x40')]['findOne']({'where':{'id':_0x2316fe['params']['id']}})[_0x620d('0x14')](handleEntityNotFound(_0xa52f1,null))[_0x620d('0x14')](function(_0x2418d7){if(_0x2418d7){_0x29fa16=_0x2418d7;_0x55cff0[_0x620d('0x56')]=_[_0x620d('0x58')](db[_0x620d('0x40')][_0x620d('0x38')]);_0x55cff0[_0x620d('0x41')]=_[_0x620d('0x58')](_0x2316fe[_0x620d('0x41')]);_0x55cff0[_0x620d('0x5a')]=_[_0x620d('0x5b')](_0x55cff0[_0x620d('0x56')],_0x55cff0[_0x620d('0x41')]);_0x2bff6d[_0x620d('0x47')]=_['intersection'](_0x55cff0['model'],qs[_0x620d('0x5c')](_0x2316fe[_0x620d('0x41')][_0x620d('0x5c')]));_0x2bff6d[_0x620d('0x47')]=_0x2bff6d[_0x620d('0x47')]['length']?_0x2bff6d[_0x620d('0x47')]:_0x55cff0[_0x620d('0x56')];_0x2bff6d[_0x620d('0xd1')]=qs[_0x620d('0xd2')](_0x2316fe[_0x620d('0x41')]['sort']);_0x2bff6d['where']=qs[_0x620d('0x5a')](_[_0x620d('0xd3')](_0x2316fe[_0x620d('0x41')],_0x55cff0[_0x620d('0x5a')]));if(_0x2316fe[_0x620d('0x41')][_0x620d('0x2f')]){_0x2bff6d[_0x620d('0x3f')]=_[_0x620d('0x5d')](_0x2bff6d[_0x620d('0x3f')],{'$or':_['map'](_0x2bff6d[_0x620d('0x47')],function(_0x452d2d){var _0x490ca0={};_0x490ca0[_0x452d2d]={'$like':'%'+_0x2316fe['query'][_0x620d('0x2f')]+'%'};return _0x490ca0;})});}_0x2bff6d[_0x620d('0x56')]=db[_0x620d('0x40')];_0x2bff6d['as']='Agents';_0x2bff6d=_['merge']({},_0x2bff6d,_0x2316fe['options']);return _0x29fa16[_0x620d('0xf8')]({'include':[_0x2bff6d]});}})['then'](function(_0x25a4e0){if(_0x25a4e0){var _0x9a2624={},_0x207224=[];for(var _0x6376d=0x0;_0x6376d<_0x25a4e0[_0x620d('0x4c')];_0x6376d+=0x1){for(var _0x1456f3=0x0,_0x36a3bd;_0x1456f3<_0x25a4e0[_0x6376d][_0x620d('0x2c')][_0x620d('0x4c')];_0x1456f3+=0x1){_0x36a3bd=_0x25a4e0[_0x6376d][_0x620d('0x2c')][_0x1456f3][_0x620d('0xaa')]({'plain':!![]});_0x9a2624[_0x36a3bd['id']]=_0x36a3bd;}}_0x9a2624=_[_0x620d('0x127')](_0x9a2624);for(var _0x4bbdbc=qs[_0x620d('0x22')](_0x2316fe[_0x620d('0x41')][_0x620d('0x22')]);_0x4bbdbc<_0x9a2624[_0x620d('0x4c')]&&_0x207224[_0x620d('0x4c')]=_0x57f9e9[_0x0fcf('0x51')]){throw new Error(_0x0fcf('0x52'));}})[_0x0fcf('0xf')](function(){if(_0x38a57a){return db[_0x0fcf('0x3f')][_0x0fcf('0x47')]({'where':{'membername':_0x38a57a['name']},'individualHooks':!![]});}})[_0x0fcf('0xf')](function(){if(_0x38a57a){return _0x38a57a['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x24f5ab){if(_0x38a57a){if(_0x24f5ab){var _0x13e201=[];_0xbd96c1=_0x24f5ab;if(_0xbd96c1[_0x0fcf('0x30')]){for(var _0xe0d01d=0x0;_0xe0d01d<_0xbd96c1[_0x0fcf('0x30')];_0xe0d01d++){_0x13e201[_0x0fcf('0x48')](db[_0x0fcf('0x3f')]['upsert']({'membername':_0x38a57a['name'],'UserId':_0x38a57a['id'],'queue_name':_0xbd96c1[_0xe0d01d]['name'],'VoiceQueueId':_0xbd96c1[_0xe0d01d]['id'],'interface':_0x27ffbf,'paused':_0x38a57a[_0x0fcf('0x4c')]||![],'penalty':_0xbd96c1[_0xe0d01d][_0x0fcf('0x53')]||0x0}));}return BPromise[_0x0fcf('0x49')](_0x13e201);}}}})['then'](function(){if(_0x38a57a){return db[_0x0fcf('0x2c')]['findAll']({'where':{'membername':_0x38a57a[_0x0fcf('0x28')],'exitAt':null}});}})[_0x0fcf('0xf')](function(_0x4d39b3){if(_0x38a57a){if(_0x4d39b3&&_0x4d39b3[_0x0fcf('0x30')]){var _0x7fcd9f=[];_0x4d39b3[_0x0fcf('0x32')](function(_0x13d65d){_0x7fcd9f[_0x0fcf('0x48')](_0x13d65d[_0x0fcf('0x2b')]({'exitAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f'))}));});return BPromise[_0x0fcf('0x49')](_0x7fcd9f);}}})['then'](function(_0x55f141){if(_0x38a57a){var _0x23d313=[];var _0x592fc7=[];var _0x2e4c6a=utils[_0x0fcf('0x31')]();var _0xffaf1f={'membername':_0x38a57a[_0x0fcf('0x28')],'interface':_0x27ffbf,'enterAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f')),'role':_0x38a57a[_0x0fcf('0x29')],'internal':_0x38a57a[_0x0fcf('0x2a')]};_0x2e4c6a[_0x0fcf('0x32')](function(_0x4f9880){_0x23d313[_0x0fcf('0x48')](_[_0x0fcf('0x54')]({'channel':_0x4f9880,'type':'LOGIN','data1':_0x0fcf('0x55'),'data2':_0x27ffbf},_0xffaf1f));if(_0x38a57a[_0x0fcf('0x4c')]){_0x592fc7[_0x0fcf('0x48')](_[_0x0fcf('0x54')]({'channel':_0x4f9880,'type':_0x0fcf('0x2d'),'data1':'LOGININPAUSE'},_0xffaf1f));}});return db['MemberReport'][_0x0fcf('0x39')](_0x23d313[_0x0fcf('0x56')](_0x592fc7),{'individualHooks':!![]});}})[_0x0fcf('0xf')](function(){if(_0x38a57a){return _0x38a57a[_0x0fcf('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x0fcf('0x2e')](_0x0fcf('0x2f')),'voicePause':_0x38a57a[_0x0fcf('0x4c')]||![],'mailPause':_0x38a57a[_0x0fcf('0x4c')]||![],'chatPause':_0x38a57a[_0x0fcf('0x4c')]||![],'faxPause':_0x38a57a[_0x0fcf('0x4c')]||![],'smsPause':_0x38a57a['loginInPause']||![],'openchannelPause':_0x38a57a[_0x0fcf('0x4c')]||![],'pauseType':_0x38a57a['loginInPause']?_0x0fcf('0x57'):null,'lastPauseAt':moment()[_0x0fcf('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x27ffbf});}})[_0x0fcf('0xf')](function(_0x3cfca1){_0x539385(_0x3cfca1);})[_0x0fcf('0x18')](function(_0x5bcf0f){_0x1a57b6(_0x4faeef[_0x0fcf('0x14')](0x1f4,_0x5bcf0f[_0x0fcf('0x16')]));});});}; \ No newline at end of file +var _0xa260=['result','GetUser','User','findAll','options','raw','where','map','include','model','attributes','ShowUser','find','catch','PauseUser','name','role','internal','UserVoiceQueueRt','PAUSE','format','length','updateAttributes','getChannels','forEach','push','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','update','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','system','mail','fax','sms','openchannel','whatsapp','set','Pause','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','destroy','getVoiceQueues','upsert','LOGIN','callysquare','merge','LOGININPAUSE','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x3805af,_0x3b2809){var _0x5d8f8c=function(_0x174379){while(--_0x174379){_0x3805af['push'](_0x3805af['shift']());}};_0x5d8f8c(++_0x3b2809);}(_0xa260,0xf0));var _0x0a26=function(_0x32a0ba,_0x3ec167){_0x32a0ba=_0x32a0ba-0x0;var _0x490a04=_0xa260[_0x32a0ba];return _0x490a04;};'use strict';var _=require('lodash');var util=require(_0x0a26('0x0'));var moment=require(_0x0a26('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a26('0x2'));var fs=require('fs');var Redis=require(_0x0a26('0x3'));var db=require(_0x0a26('0x4'))['db'];var utils=require(_0x0a26('0x5'));var logger=require(_0x0a26('0x6'))(_0x0a26('0x7'));var config=require(_0x0a26('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a26('0x9')]({'port':0x232a});config[_0x0a26('0xa')]=_['defaults'](config[_0x0a26('0xa')],{'host':_0x0a26('0xb'),'port':0x18eb});var socket=require(_0x0a26('0xc'))(new Redis(config['redis']));require(_0x0a26('0xd'))[_0x0a26('0xe')](socket);function respondWithRpcPromise(_0x4a6db9,_0x2e0139,_0x247f38){return new BPromise(function(_0x55940c,_0x5366d8){return client[_0x0a26('0xf')](_0x4a6db9,_0x247f38)[_0x0a26('0x10')](function(_0x352647){logger[_0x0a26('0x11')](_0x0a26('0x12'),_0x2e0139,_0x0a26('0x13'));logger[_0x0a26('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x2e0139,_0x0a26('0x13'),JSON['stringify'](_0x352647));if(_0x352647[_0x0a26('0x15')]){if(_0x352647[_0x0a26('0x15')][_0x0a26('0x16')]===0x1f4){logger[_0x0a26('0x15')](_0x0a26('0x12'),_0x2e0139,_0x352647[_0x0a26('0x15')]['message']);return _0x5366d8(_0x352647[_0x0a26('0x15')][_0x0a26('0x17')]);}logger['error'](_0x0a26('0x12'),_0x2e0139,_0x352647['error']['message']);return _0x55940c(_0x352647[_0x0a26('0x15')]['message']);}else{logger[_0x0a26('0x11')](_0x0a26('0x12'),_0x2e0139,_0x0a26('0x13'));_0x55940c(_0x352647[_0x0a26('0x18')][_0x0a26('0x17')]);}})['catch'](function(_0x490737){logger[_0x0a26('0x15')]('User,\x20%s,\x20%s',_0x2e0139,_0x490737);_0x5366d8(_0x490737);});});}exports[_0x0a26('0x19')]=function(_0x320cdf){var _0x465c04=this;return new Promise(function(_0x52051d,_0x4f7ca7){return db[_0x0a26('0x1a')][_0x0a26('0x1b')]({'raw':_0x320cdf[_0x0a26('0x1c')]?_0x320cdf['options'][_0x0a26('0x1d')]===undefined?!![]:![]:!![],'where':_0x320cdf[_0x0a26('0x1c')]?_0x320cdf[_0x0a26('0x1c')][_0x0a26('0x1e')]||null:null,'attributes':_0x320cdf[_0x0a26('0x1c')]?_0x320cdf['options']['attributes']||null:null,'limit':_0x320cdf['options']?_0x320cdf[_0x0a26('0x1c')]['limit']||null:null,'include':_0x320cdf[_0x0a26('0x1c')]?_0x320cdf[_0x0a26('0x1c')]['include']?_[_0x0a26('0x1f')](_0x320cdf['options'][_0x0a26('0x20')],function(_0x3ac859){return{'model':db[_0x3ac859[_0x0a26('0x21')]],'as':_0x3ac859['as'],'attributes':_0x3ac859[_0x0a26('0x22')],'include':_0x3ac859[_0x0a26('0x20')]?_[_0x0a26('0x1f')](_0x3ac859[_0x0a26('0x20')],function(_0x53218a){return{'model':db[_0x53218a[_0x0a26('0x21')]],'as':_0x53218a['as'],'attributes':_0x53218a[_0x0a26('0x22')],'include':_0x53218a[_0x0a26('0x20')]?_[_0x0a26('0x1f')](_0x53218a[_0x0a26('0x20')],function(_0x2f082e){return{'model':db[_0x2f082e[_0x0a26('0x21')]],'as':_0x2f082e['as'],'attributes':_0x2f082e[_0x0a26('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a26('0x10')](function(_0x3a6954){logger[_0x0a26('0x11')](_0x0a26('0x19'),_0x320cdf);logger[_0x0a26('0x14')](_0x0a26('0x19'),_0x320cdf,JSON['stringify'](_0x3a6954));_0x52051d(_0x3a6954);})['catch'](function(_0xff2294){logger[_0x0a26('0x15')]('GetUser',_0xff2294['message'],_0x320cdf);_0x4f7ca7(_0x465c04['error'](0x1f4,_0xff2294[_0x0a26('0x17')]));});});};exports[_0x0a26('0x23')]=function(_0x4dc477){var _0x48301b=this;return new Promise(function(_0x2a4c1a,_0x45a784){return db[_0x0a26('0x1a')][_0x0a26('0x24')]({'raw':_0x4dc477[_0x0a26('0x1c')]?_0x4dc477[_0x0a26('0x1c')][_0x0a26('0x1d')]===undefined?!![]:![]:!![],'where':_0x4dc477[_0x0a26('0x1c')]?_0x4dc477['options']['where']||null:null,'attributes':_0x4dc477[_0x0a26('0x1c')]?_0x4dc477[_0x0a26('0x1c')][_0x0a26('0x22')]||null:null,'include':_0x4dc477['options']?_0x4dc477[_0x0a26('0x1c')][_0x0a26('0x20')]?_[_0x0a26('0x1f')](_0x4dc477[_0x0a26('0x1c')]['include'],function(_0x304c61){return{'model':db[_0x304c61[_0x0a26('0x21')]],'as':_0x304c61['as'],'attributes':_0x304c61[_0x0a26('0x22')],'include':_0x304c61['include']?_[_0x0a26('0x1f')](_0x304c61[_0x0a26('0x20')],function(_0x3bc0a0){return{'model':db[_0x3bc0a0['model']],'as':_0x3bc0a0['as'],'attributes':_0x3bc0a0[_0x0a26('0x22')],'include':_0x3bc0a0['include']?_['map'](_0x3bc0a0[_0x0a26('0x20')],function(_0x2623fe){return{'model':db[_0x2623fe[_0x0a26('0x21')]],'as':_0x2623fe['as'],'attributes':_0x2623fe[_0x0a26('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a26('0x10')](function(_0x22115f){logger[_0x0a26('0x11')]('ShowUser',_0x4dc477);logger[_0x0a26('0x14')](_0x0a26('0x23'),_0x4dc477,JSON['stringify'](_0x22115f));_0x2a4c1a(_0x22115f);})[_0x0a26('0x25')](function(_0x4d5b7b){logger[_0x0a26('0x15')](_0x0a26('0x23'),_0x4d5b7b[_0x0a26('0x17')],_0x4dc477);_0x45a784(_0x48301b[_0x0a26('0x15')](0x1f4,_0x4d5b7b[_0x0a26('0x17')]));});});};exports[_0x0a26('0x26')]=function(_0x5408e9){var _0x2189b2=this;return new Promise(function(_0x4b1410,_0x2bbe8c){var _0x49eaf0;return db[_0x0a26('0x1a')][_0x0a26('0x24')]({'where':_0x5408e9[_0x0a26('0x1c')]['where']||{},'attributes':['id',_0x0a26('0x27'),_0x0a26('0x28'),_0x0a26('0x29'),'interface']})['then'](function(_0x1bb63d){if(_0x1bb63d){_0x49eaf0=_0x1bb63d;return db[_0x0a26('0x2a')]['update']({'paused':0x1},{'where':{'UserId':_0x49eaf0['id']},'individualHooks':!![]});}})[_0x0a26('0x10')](function(){if(_0x49eaf0){return db['MemberReport']['findAll']({'where':{'membername':_0x49eaf0[_0x0a26('0x27')],'type':_0x0a26('0x2b'),'exitAt':null}});}})[_0x0a26('0x10')](function(_0x1a8922){if(_0x49eaf0){if(_0x1a8922&&_0x1a8922['length']){var _0x27c0c0=moment()[_0x0a26('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x126a5b=0x0,_0x1b4e2a=_0x1a8922[_0x0a26('0x2d')];_0x126a5b<_0x1b4e2a;_0x126a5b++){_0x1a8922[_0x126a5b][_0x0a26('0x2e')]({'exitAt':_0x27c0c0});}}}})[_0x0a26('0x10')](function(){if(_0x49eaf0){var _0x45b5c7=[];var _0x2c2fbe=utils[_0x0a26('0x2f')]();_0x2c2fbe[_0x0a26('0x30')](function(_0x4d9c65){_0x45b5c7[_0x0a26('0x31')]({'channel':_0x4d9c65,'membername':_0x49eaf0[_0x0a26('0x27')],'interface':_['isNil'](_0x49eaf0[_0x0a26('0x32')])?util[_0x0a26('0x2c')](_0x0a26('0x33'),_0x49eaf0[_0x0a26('0x27')]):_0x49eaf0[_0x0a26('0x32')],'type':_0x0a26('0x2b'),'enterAt':moment()[_0x0a26('0x2c')](_0x0a26('0x34')),'data1':_0x5408e9[_0x0a26('0x35')][_0x0a26('0x36')]||_0x0a26('0x37'),'role':_0x49eaf0[_0x0a26('0x28')],'internal':_0x49eaf0['internal'],'uniqueid':_0x5408e9['body'][_0x0a26('0x38')]||null});});return db[_0x0a26('0x39')]['bulkCreate'](_0x45b5c7,{'individualHooks':!![]});}})[_0x0a26('0x10')](function(){if(_0x49eaf0){return _0x49eaf0[_0x0a26('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5408e9[_0x0a26('0x35')][_0x0a26('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0a26('0x2c')](_0x0a26('0x34'))});}})[_0x0a26('0x10')](function(_0x29ebb3){_0x4b1410(_0x29ebb3);})[_0x0a26('0x25')](function(_0x55016f){_0x2bbe8c(_0x2189b2[_0x0a26('0x15')](0x1f4,_0x55016f[_0x0a26('0x17')]));});});};exports[_0x0a26('0x3b')]=function(_0x2d3547){var _0x37f3b2=this;return new Promise(function(_0x1d0b84,_0x60b8a3){var _0x2cb7b6;return db['User'][_0x0a26('0x3c')]({'where':_0x2d3547[_0x0a26('0x1c')]['where']||{},'attributes':['id',_0x0a26('0x27')]})[_0x0a26('0x10')](function(_0x4925db){if(_0x4925db){_0x2cb7b6=_0x4925db;if(_0x2d3547[_0x0a26('0x35')]['channel']&&!utils[_0x0a26('0x3d')](_0x2d3547[_0x0a26('0x35')][_0x0a26('0x3e')])){throw new Error(_0x0a26('0x3f'));}switch(_0x2d3547[_0x0a26('0x35')][_0x0a26('0x3e')]){case'voice':return db['UserVoiceQueueRt'][_0x0a26('0x3a')]({'paused':0x0},{'where':{'UserId':_0x2cb7b6['id']}})[_0x0a26('0x10')](function(){return db[_0x0a26('0x39')][_0x0a26('0x24')]({'where':{'channel':_0x2d3547[_0x0a26('0x35')][_0x0a26('0x3e')],'membername':_0x2cb7b6['name'],'type':'PAUSE','exitAt':null}});})[_0x0a26('0x10')](function(_0x489218){if(_0x489218){return _0x489218['update']({'exitAt':moment()[_0x0a26('0x2c')](_0x0a26('0x34')),'data2':_0x0a26('0x40')},{'individualHooks':!![]});}return null;})[_0x0a26('0x10')](function(){return _0x2cb7b6[_0x0a26('0x3a')]({'voicePause':![]});});case _0x0a26('0x41'):case'chat':case _0x0a26('0x42'):case _0x0a26('0x43'):case _0x0a26('0x44'):case _0x0a26('0x45'):return db[_0x0a26('0x39')][_0x0a26('0x24')]({'where':{'channel':_0x2d3547[_0x0a26('0x35')][_0x0a26('0x3e')],'membername':_0x2cb7b6['name'],'type':_0x0a26('0x2b'),'exitAt':null}})[_0x0a26('0x10')](function(_0x9be5fa){return _0x9be5fa[_0x0a26('0x3a')]({'exitAt':moment()[_0x0a26('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0a26('0x40')},{'individualHooks':!![]});})[_0x0a26('0x10')](function(){var _0x26a951={};_[_0x0a26('0x46')](_0x26a951,util[_0x0a26('0x2c')]('%s%s',_0x2d3547[_0x0a26('0x35')][_0x0a26('0x3e')],_0x0a26('0x47')),![]);return _0x2cb7b6[_0x0a26('0x3a')](_0x26a951);});default:return db[_0x0a26('0x2a')][_0x0a26('0x3a')]({'paused':0x0},{'where':{'UserId':_0x2cb7b6['id']}})['then'](function(){return db[_0x0a26('0x39')][_0x0a26('0x1b')]({'where':{'membername':_0x2cb7b6[_0x0a26('0x27')],'type':'PAUSE','exitAt':null}});})[_0x0a26('0x10')](function(_0x2e8779){var _0x16a000=[];_0x2e8779['forEach'](function(_0x112b9b){_0x16a000['push'](_0x112b9b['update']({'exitAt':moment()['format'](_0x0a26('0x34')),'data2':_0x0a26('0x40')}));});return BPromise[_0x0a26('0x48')](_0x16a000);})['then'](function(){return _0x2cb7b6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x0a26('0x10')](function(_0x1108ef){_0x1d0b84(_0x1108ef);})['catch'](function(_0x25a16b){_0x60b8a3(_0x37f3b2[_0x0a26('0x15')](0x1f4,_0x25a16b[_0x0a26('0x17')]));});});};exports['LogoutUser']=function(_0x1027e1){var _0x234c6e=this;return new Promise(function(_0x3ddacb,_0x362f6c){var _0x34d907;return db[_0x0a26('0x1a')][_0x0a26('0x3c')]({'where':_0x1027e1['options'][_0x0a26('0x1e')]||{},'attributes':['id',_0x0a26('0x27')]})[_0x0a26('0x10')](function(_0x4bd9b2){if(_0x4bd9b2){_0x34d907=_0x4bd9b2;return db[_0x0a26('0x2a')]['destroy']({'where':{'membername':_0x34d907[_0x0a26('0x27')]},'individualHooks':!![]});}})[_0x0a26('0x10')](function(){if(_0x34d907){return db[_0x0a26('0x39')][_0x0a26('0x1b')]({'where':{'membername':_0x34d907[_0x0a26('0x27')],'exitAt':null}});}})[_0x0a26('0x10')](function(_0x401406){if(_0x34d907){if(_0x401406&&_0x401406[_0x0a26('0x2d')]){var _0x2257d4=[];_0x401406['forEach'](function(_0x3886ad){_0x2257d4[_0x0a26('0x31')](_0x3886ad[_0x0a26('0x3a')]({'exitAt':moment()['format'](_0x0a26('0x34'))}));});return BPromise['all'](_0x2257d4);}}})[_0x0a26('0x10')](function(){if(_0x34d907){return _0x34d907['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0a26('0x10')](function(_0x243fa3){_0x3ddacb(_0x243fa3);})[_0x0a26('0x25')](function(_0x5cc22f){_0x362f6c(_0x234c6e[_0x0a26('0x15')](0x1f4,_0x5cc22f[_0x0a26('0x17')]));});});};exports[_0x0a26('0x49')]=function(_0x2e4f99){var _0x17115e=this;return new Promise(function(_0x2d6d17,_0x515df6){var _0x22c105;var _0x4b64d1;var _0x1bf9c4;var _0x368fd9;return db[_0x0a26('0x1a')]['findOne']({'where':_0x2e4f99[_0x0a26('0x1c')][_0x0a26('0x1e')]||{},'attributes':['id','name',_0x0a26('0x28'),_0x0a26('0x4a'),_0x0a26('0x4b'),_0x0a26('0x29'),_0x0a26('0x4c'),_0x0a26('0x32')]})[_0x0a26('0x10')](function(_0x134057){if(_0x134057){_0x22c105=_0x134057;_0x368fd9=_0x2e4f99[_0x0a26('0x35')][_0x0a26('0x32')]?_0x2e4f99[_0x0a26('0x35')]['interface']:util[_0x0a26('0x2c')](_0x0a26('0x33'),_0x22c105[_0x0a26('0x27')]);return db['User'][_0x0a26('0x4d')]({'where':{'role':_0x0a26('0x4e'),'online':!![],'id':{'$ne':_0x22c105['id']}}});}})[_0x0a26('0x10')](function(_0x69392b){if(_0x69392b){_0x1bf9c4=_0x69392b;return require(_0x0a26('0x4f'))['getLicense']();}})['then'](function(_0x5173ab){if(_0x5173ab&&_0x5173ab[_0x0a26('0x50')]&&_0x1bf9c4>=_0x5173ab[_0x0a26('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x22c105){return db[_0x0a26('0x2a')][_0x0a26('0x51')]({'where':{'membername':_0x22c105['name']},'individualHooks':!![]});}})[_0x0a26('0x10')](function(){if(_0x22c105){return _0x22c105[_0x0a26('0x52')]({'raw':!![]});}})['then'](function(_0xbf443f){if(_0x22c105){if(_0xbf443f){var _0x287f7d=[];_0x4b64d1=_0xbf443f;if(_0x4b64d1[_0x0a26('0x2d')]){for(var _0x34aecc=0x0;_0x34aecc<_0x4b64d1[_0x0a26('0x2d')];_0x34aecc++){_0x287f7d[_0x0a26('0x31')](db[_0x0a26('0x2a')][_0x0a26('0x53')]({'membername':_0x22c105['name'],'UserId':_0x22c105['id'],'queue_name':_0x4b64d1[_0x34aecc][_0x0a26('0x27')],'VoiceQueueId':_0x4b64d1[_0x34aecc]['id'],'interface':_0x368fd9,'paused':_0x22c105[_0x0a26('0x4c')]||![],'penalty':_0x4b64d1[_0x34aecc]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x0a26('0x48')](_0x287f7d);}}}})[_0x0a26('0x10')](function(){if(_0x22c105){return db[_0x0a26('0x39')][_0x0a26('0x1b')]({'where':{'membername':_0x22c105['name'],'exitAt':null}});}})[_0x0a26('0x10')](function(_0x34ea57){if(_0x22c105){if(_0x34ea57&&_0x34ea57[_0x0a26('0x2d')]){var _0x4d102a=[];_0x34ea57[_0x0a26('0x30')](function(_0x780c01){_0x4d102a[_0x0a26('0x31')](_0x780c01[_0x0a26('0x3a')]({'exitAt':moment()['format'](_0x0a26('0x34'))}));});return BPromise[_0x0a26('0x48')](_0x4d102a);}}})[_0x0a26('0x10')](function(_0x3f6d69){if(_0x22c105){var _0xb631a6=[];var _0x3f615e=[];var _0x32488f=utils[_0x0a26('0x2f')]();var _0x5b72a1={'membername':_0x22c105[_0x0a26('0x27')],'interface':_0x368fd9,'enterAt':moment()['format'](_0x0a26('0x34')),'role':_0x22c105[_0x0a26('0x28')],'internal':_0x22c105[_0x0a26('0x29')]};_0x32488f[_0x0a26('0x30')](function(_0x44c6cc){_0xb631a6[_0x0a26('0x31')](_['merge']({'channel':_0x44c6cc,'type':_0x0a26('0x54'),'data1':_0x0a26('0x55'),'data2':_0x368fd9},_0x5b72a1));if(_0x22c105['loginInPause']){_0x3f615e['push'](_[_0x0a26('0x56')]({'channel':_0x44c6cc,'type':_0x0a26('0x2b'),'data1':_0x0a26('0x57')},_0x5b72a1));}});return db[_0x0a26('0x39')]['bulkCreate'](_0xb631a6['concat'](_0x3f615e),{'individualHooks':!![]});}})[_0x0a26('0x10')](function(){if(_0x22c105){return _0x22c105[_0x0a26('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x0a26('0x2c')](_0x0a26('0x34')),'voicePause':_0x22c105[_0x0a26('0x4c')]||![],'mailPause':_0x22c105[_0x0a26('0x4c')]||![],'chatPause':_0x22c105[_0x0a26('0x4c')]||![],'faxPause':_0x22c105['loginInPause']||![],'smsPause':_0x22c105[_0x0a26('0x4c')]||![],'openchannelPause':_0x22c105[_0x0a26('0x4c')]||![],'pauseType':_0x22c105['loginInPause']?_0x0a26('0x57'):null,'lastPauseAt':moment()[_0x0a26('0x2c')](_0x0a26('0x34')),'interface':_0x368fd9});}})[_0x0a26('0x10')](function(_0x3ea878){_0x2d6d17(_0x3ea878);})[_0x0a26('0x25')](function(_0x2d114b){_0x515df6(_0x17115e['error'](0x1f4,_0x2d114b[_0x0a26('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bcf83c0..412b85c 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 _0x7ff4=['save','remove','update','emit','register','user:','./user.events'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x7ff4,0xca));var _0x47ff=function(_0x36a51c,_0x5a454e){_0x36a51c=_0x36a51c-0x0;var _0x4af928=_0x7ff4[_0x36a51c];return _0x4af928;};'use strict';var UserEvents=require(_0x47ff('0x0'));var events=[_0x47ff('0x1'),_0x47ff('0x2'),_0x47ff('0x3')];function createListener(_0xe5a35c,_0xb7f38c){return function(_0x187625){_0xb7f38c[_0x47ff('0x4')](_0xe5a35c,_0x187625);};}function removeListener(_0x52c5e2,_0x2e2408){return function(){UserEvents['removeListener'](_0x52c5e2,_0x2e2408);};}exports[_0x47ff('0x5')]=function(_0x459aa3){for(var _0x366577=0x0,_0x5aff73=events['length'];_0x366577<_0x5aff73;_0x366577++){var _0x86c264=events[_0x366577];var _0x1aeb31=createListener(_0x47ff('0x6')+_0x86c264,_0x459aa3);UserEvents['on'](_0x86c264,_0x1aeb31);}}; \ No newline at end of file +var _0x9f3d=['./user.events','remove','emit','removeListener','length'];(function(_0x51b698,_0x2fd161){var _0xfa0590=function(_0x3741ce){while(--_0x3741ce){_0x51b698['push'](_0x51b698['shift']());}};_0xfa0590(++_0x2fd161);}(_0x9f3d,0x78));var _0xd9f3=function(_0x28d6af,_0x1967d3){_0x28d6af=_0x28d6af-0x0;var _0x5c7a53=_0x9f3d[_0x28d6af];return _0x5c7a53;};'use strict';var UserEvents=require(_0xd9f3('0x0'));var events=['save',_0xd9f3('0x1'),'update'];function createListener(_0x2eed9a,_0x1ea73b){return function(_0x26ce04){_0x1ea73b[_0xd9f3('0x2')](_0x2eed9a,_0x26ce04);};}function removeListener(_0x172cfd,_0x475d42){return function(){UserEvents[_0xd9f3('0x3')](_0x172cfd,_0x475d42);};}exports['register']=function(_0x2c403e){for(var _0x112f59=0x0,_0x2f77c3=events[_0xd9f3('0x4')];_0x112f59<_0x2f77c3;_0x112f59++){var _0x17c876=events[_0x112f59];var _0x1aa8d8=createListener('user:'+_0x17c876,_0x2c403e);UserEvents['on'](_0x17c876,_0x1aa8d8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 92d6cd0..7baf68c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x18cabd,_0x4fc7de){var _0x9f99d7=function(_0xe3f0fd){while(--_0xe3f0fd){_0x18cabd['push'](_0x18cabd['shift']());}};_0x9f99d7(++_0x4fc7de);}(_0x70e0,0x17b));var _0x070e=function(_0x3ec6a1,_0x32a525){_0x3ec6a1=_0x3ec6a1-0x0;var _0x526e17=_0x70e0[_0x3ec6a1];return _0x526e17;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x111ee6,_0xd8a3ea){var _0x8bbb51=function(_0x273011){while(--_0x273011){_0x111ee6['push'](_0x111ee6['shift']());}};_0x8bbb51(++_0xd8a3ea);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fe4b0d8..710f409 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 _0x7958=['INTEGER','sequelize','exports'];(function(_0x2a8093,_0x5bcb32){var _0xaa71c8=function(_0x4e729d){while(--_0x4e729d){_0x2a8093['push'](_0x2a8093['shift']());}};_0xaa71c8(++_0x5bcb32);}(_0x7958,0x88));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8795('0x0'));module[_0x8795('0x1')]={'penalty':{'type':Sequelize[_0x8795('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc00e=['exports','sequelize'];(function(_0x426fce,_0x11e55a){var _0x19332f=function(_0x3c064d){while(--_0x3c064d){_0x426fce['push'](_0x426fce['shift']());}};_0x19332f(++_0x11e55a);}(_0xc00e,0xe1));var _0xec00=function(_0x1b1f31,_0x3b4f0e){_0x1b1f31=_0x1b1f31-0x0;var _0x61e39f=_0xc00e[_0x1b1f31];return _0x61e39f;};'use strict';var Sequelize=require(_0xec00('0x0'));module[_0xec00('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 301de7c..aff932f 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 _0x01ee=['UserChatQueue','user_has_chat_queues','lodash','util','api','bluebird','path','rimraf','exports','define'];(function(_0xd0b18,_0x5c6767){var _0x3c40d3=function(_0x4ec325){while(--_0x4ec325){_0xd0b18['push'](_0xd0b18['shift']());}};_0x3c40d3(++_0x5c6767);}(_0x01ee,0x188));var _0xe01e=function(_0x1bad62,_0x9fea54){_0x1bad62=_0x1bad62-0x0;var _0x4520a5=_0x01ee[_0x1bad62];return _0x4520a5;};'use strict';var _=require(_0xe01e('0x0'));var util=require(_0xe01e('0x1'));var logger=require('../../config/logger')(_0xe01e('0x2'));var moment=require('moment');var BPromise=require(_0xe01e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe01e('0x4'));var rimraf=require(_0xe01e('0x5'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xe01e('0x6')]=function(_0x5c83ab,_0x25b409){return _0x5c83ab[_0xe01e('0x7')](_0xe01e('0x8'),attributes,{'tableName':_0xe01e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22b4=['exports','define','UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes'];(function(_0xc6575,_0x16a6e1){var _0x58a184=function(_0xde2863){while(--_0xde2863){_0xc6575['push'](_0xc6575['shift']());}};_0x58a184(++_0x16a6e1);}(_0x22b4,0x6f));var _0x422b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x22b4[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x422b('0x0'));var util=require('util');var logger=require(_0x422b('0x1'))(_0x422b('0x2'));var moment=require(_0x422b('0x3'));var BPromise=require(_0x422b('0x4'));var rp=require(_0x422b('0x5'));var fs=require('fs');var path=require(_0x422b('0x6'));var rimraf=require('rimraf');var config=require(_0x422b('0x7'));var attributes=require(_0x422b('0x8'));module[_0x422b('0x9')]=function(_0x23fcf4,_0x1b19fb){return _0x23fcf4[_0x422b('0xa')](_0x422b('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 2d0e3f0..0027e20 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 _0x6deb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','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'];(function(_0x469b7d,_0x4760f8){var _0xc78a4b=function(_0xd48e6c){while(--_0xd48e6c){_0x469b7d['push'](_0x469b7d['shift']());}};_0xc78a4b(++_0x4760f8);}(_0x6deb,0x1cb));var _0xb6de=function(_0x2638bf,_0x3ebef6){_0x2638bf=_0x2638bf-0x0;var _0x33e951=_0x6deb[_0x2638bf];return _0x33e951;};'use strict';var _=require(_0xb6de('0x0'));var util=require(_0xb6de('0x1'));var moment=require(_0xb6de('0x2'));var BPromise=require(_0xb6de('0x3'));var rs=require(_0xb6de('0x4'));var fs=require('fs');var Redis=require(_0xb6de('0x5'));var db=require(_0xb6de('0x6'))['db'];var utils=require(_0xb6de('0x7'));var logger=require(_0xb6de('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x149018,_0x5b302d,_0x41e24){return new BPromise(function(_0x440487,_0x2b9927){return client[_0xb6de('0x9')](_0x149018,_0x41e24)[_0xb6de('0xa')](function(_0x5c1160){logger[_0xb6de('0xb')](_0xb6de('0xc'),_0x5b302d,_0xb6de('0xd'));logger[_0xb6de('0xe')](_0xb6de('0xf'),_0x5b302d,_0xb6de('0xd'),JSON[_0xb6de('0x10')](_0x5c1160));if(_0x5c1160[_0xb6de('0x11')]){if(_0x5c1160[_0xb6de('0x11')][_0xb6de('0x12')]===0x1f4){logger[_0xb6de('0x11')](_0xb6de('0xc'),_0x5b302d,_0x5c1160[_0xb6de('0x11')]['message']);return _0x2b9927(_0x5c1160[_0xb6de('0x11')][_0xb6de('0x13')]);}logger[_0xb6de('0x11')](_0xb6de('0xc'),_0x5b302d,_0x5c1160[_0xb6de('0x11')][_0xb6de('0x13')]);return _0x440487(_0x5c1160['error'][_0xb6de('0x13')]);}else{logger[_0xb6de('0xb')](_0xb6de('0xc'),_0x5b302d,_0xb6de('0xd'));_0x440487(_0x5c1160[_0xb6de('0x14')][_0xb6de('0x13')]);}})[_0xb6de('0x15')](function(_0x25ea68){logger[_0xb6de('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x5b302d,_0x25ea68);_0x2b9927(_0x25ea68);});});} \ No newline at end of file +var _0x7f61=['../../mysqldb','../../config/utils','../../config/logger','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird'];(function(_0xdc1176,_0x55c094){var _0x4d7c39=function(_0x280d21){while(--_0x280d21){_0xdc1176['push'](_0xdc1176['shift']());}};_0x4d7c39(++_0x55c094);}(_0x7f61,0x16c));var _0x17f6=function(_0x172aa3,_0x20a67e){_0x172aa3=_0x172aa3-0x0;var _0xe0b916=_0x7f61[_0x172aa3];return _0xe0b916;};'use strict';var _=require(_0x17f6('0x0'));var util=require(_0x17f6('0x1'));var moment=require(_0x17f6('0x2'));var BPromise=require(_0x17f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17f6('0x4'))['db'];var utils=require(_0x17f6('0x5'));var logger=require(_0x17f6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4986ba,_0x44fc1d,_0x1d248c){return new BPromise(function(_0x15d9bf,_0x291d6c){return client['request'](_0x4986ba,_0x1d248c)[_0x17f6('0x7')](function(_0x310486){logger[_0x17f6('0x8')](_0x17f6('0x9'),_0x44fc1d,_0x17f6('0xa'));logger[_0x17f6('0xb')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x44fc1d,'request\x20sent',JSON['stringify'](_0x310486));if(_0x310486[_0x17f6('0xc')]){if(_0x310486[_0x17f6('0xc')][_0x17f6('0xd')]===0x1f4){logger['error'](_0x17f6('0x9'),_0x44fc1d,_0x310486[_0x17f6('0xc')][_0x17f6('0xe')]);return _0x291d6c(_0x310486[_0x17f6('0xc')]['message']);}logger['error'](_0x17f6('0x9'),_0x44fc1d,_0x310486[_0x17f6('0xc')][_0x17f6('0xe')]);return _0x15d9bf(_0x310486['error'][_0x17f6('0xe')]);}else{logger[_0x17f6('0x8')](_0x17f6('0x9'),_0x44fc1d,_0x17f6('0xa'));_0x15d9bf(_0x310486[_0x17f6('0xf')]['message']);}})['catch'](function(_0x2922dd){logger[_0x17f6('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x44fc1d,_0x2922dd);_0x291d6c(_0x2922dd);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8931ca9..0c20ef2 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1a8fdb,_0x38d30b){var _0x4bf757=function(_0x4ed678){while(--_0x4ed678){_0x1a8fdb['push'](_0x1a8fdb['shift']());}};_0x4bf757(++_0x38d30b);}(_0xedd9,0xfc));var _0x9edd=function(_0x210b8c,_0xd76f59){_0x210b8c=_0x210b8c-0x0;var _0xf39efa=_0xedd9[_0x210b8c];return _0xf39efa;};'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(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a22f4ce..794ad88 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 _0xdc92=['INTEGER','STRING','sequelize','exports'];(function(_0xe68430,_0x7d734a){var _0x12e029=function(_0x3991c0){while(--_0x3991c0){_0xe68430['push'](_0xe68430['shift']());}};_0x12e029(++_0x7d734a);}(_0xdc92,0x1ee));var _0x2dc9=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xdc92[_0x47242d];return _0x30273a;};'use strict';var Sequelize=require(_0x2dc9('0x0'));module[_0x2dc9('0x1')]={'penalty':{'type':Sequelize[_0x2dc9('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2dc9('0x3')]}}; \ No newline at end of file +var _0x809a=['sequelize','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809a,0x13e));var _0xa809=function(_0x3b84cc,_0x1715b7){_0x3b84cc=_0x3b84cc-0x0;var _0x232ff2=_0x809a[_0x3b84cc];return _0x232ff2;};'use strict';var Sequelize=require(_0xa809('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa809('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa809('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa809('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ca09546..d0356df 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 _0xe77d=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c9771,_0x192fdd){var _0x3a9a12=function(_0x4e77d1){while(--_0x4e77d1){_0x1c9771['push'](_0x1c9771['shift']());}};_0x3a9a12(++_0x192fdd);}(_0xe77d,0x116));var _0xde77=function(_0x888a02,_0x5df389){_0x888a02=_0x888a02-0x0;var _0xedd786=_0xe77d[_0x888a02];return _0xedd786;};'use strict';var _=require(_0xde77('0x0'));var util=require(_0xde77('0x1'));var logger=require(_0xde77('0x2'))(_0xde77('0x3'));var moment=require(_0xde77('0x4'));var BPromise=require(_0xde77('0x5'));var rp=require(_0xde77('0x6'));var fs=require('fs');var path=require(_0xde77('0x7'));var rimraf=require(_0xde77('0x8'));var config=require(_0xde77('0x9'));var attributes=require('./userFaxQueue.attributes');module[_0xde77('0xa')]=function(_0x485521,_0x2d95cf){return _0x485521[_0xde77('0xb')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf1=['util','api','moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue'];(function(_0x48cd3f,_0x2b7efc){var _0x1b333f=function(_0x5a9034){while(--_0x5a9034){_0x48cd3f['push'](_0x48cd3f['shift']());}};_0x1b333f(++_0x2b7efc);}(_0xfaf1,0x19a));var _0x1faf=function(_0x240957,_0x2d254a){_0x240957=_0x240957-0x0;var _0x542cb5=_0xfaf1[_0x240957];return _0x542cb5;};'use strict';var _=require('lodash');var util=require(_0x1faf('0x0'));var logger=require('../../config/logger')(_0x1faf('0x1'));var moment=require(_0x1faf('0x2'));var BPromise=require(_0x1faf('0x3'));var rp=require(_0x1faf('0x4'));var fs=require('fs');var path=require(_0x1faf('0x5'));var rimraf=require('rimraf');var config=require(_0x1faf('0x6'));var attributes=require(_0x1faf('0x7'));module['exports']=function(_0x6c15cd,_0x52d9eb){return _0x6c15cd[_0x1faf('0x8')](_0x1faf('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 de63b66..6effdb1 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 _0x0813=['../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0813,0x195));var _0x3081=function(_0x52be08,_0x41e972){_0x52be08=_0x52be08-0x0;var _0x1b8f09=_0x0813[_0x52be08];return _0x1b8f09;};'use strict';var _=require(_0x3081('0x0'));var util=require(_0x3081('0x1'));var moment=require(_0x3081('0x2'));var BPromise=require(_0x3081('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3081('0x4'));var db=require(_0x3081('0x5'))['db'];var utils=require(_0x3081('0x6'));var logger=require(_0x3081('0x7'))(_0x3081('0x8'));var config=require(_0x3081('0x9'));var jayson=require(_0x3081('0xa'));var client=jayson[_0x3081('0xb')][_0x3081('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2898ec,_0x105242,_0x351f25){return new BPromise(function(_0x18e474,_0xaadf61){return client[_0x3081('0xd')](_0x2898ec,_0x351f25)[_0x3081('0xe')](function(_0x3a39ce){logger[_0x3081('0xf')](_0x3081('0x10'),_0x105242,_0x3081('0x11'));logger['debug'](_0x3081('0x12'),_0x105242,_0x3081('0x11'),JSON[_0x3081('0x13')](_0x3a39ce));if(_0x3a39ce[_0x3081('0x14')]){if(_0x3a39ce[_0x3081('0x14')][_0x3081('0x15')]===0x1f4){logger[_0x3081('0x14')](_0x3081('0x10'),_0x105242,_0x3a39ce[_0x3081('0x14')][_0x3081('0x16')]);return _0xaadf61(_0x3a39ce['error'][_0x3081('0x16')]);}logger[_0x3081('0x14')](_0x3081('0x10'),_0x105242,_0x3a39ce[_0x3081('0x14')]['message']);return _0x18e474(_0x3a39ce[_0x3081('0x14')][_0x3081('0x16')]);}else{logger[_0x3081('0xf')](_0x3081('0x10'),_0x105242,_0x3081('0x11'));_0x18e474(_0x3a39ce['result'][_0x3081('0x16')]);}})['catch'](function(_0x2aea25){logger[_0x3081('0x14')](_0x3081('0x10'),_0x105242,_0x2aea25);_0xaadf61(_0x2aea25);});});} \ No newline at end of file +var _0x54c4=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x14d1e4,_0x43f72c){var _0x14feed=function(_0x45d84c){while(--_0x45d84c){_0x14d1e4['push'](_0x14d1e4['shift']());}};_0x14feed(++_0x43f72c);}(_0x54c4,0x1f1));var _0x454c=function(_0x841fbe,_0x181bf0){_0x841fbe=_0x841fbe-0x0;var _0x2ad020=_0x54c4[_0x841fbe];return _0x2ad020;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x454c('0x0'));var rs=require(_0x454c('0x1'));var fs=require('fs');var Redis=require(_0x454c('0x2'));var db=require(_0x454c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x454c('0x4'));var config=require(_0x454c('0x5'));var jayson=require(_0x454c('0x6'));var client=jayson[_0x454c('0x7')][_0x454c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b9a33,_0x164cf5,_0x1e8b55){return new BPromise(function(_0x520c9f,_0x1c9e0a){return client[_0x454c('0x9')](_0x5b9a33,_0x1e8b55)[_0x454c('0xa')](function(_0x4b37a8){logger[_0x454c('0xb')](_0x454c('0xc'),_0x164cf5,_0x454c('0xd'));logger[_0x454c('0xe')](_0x454c('0xf'),_0x164cf5,'request\x20sent',JSON[_0x454c('0x10')](_0x4b37a8));if(_0x4b37a8[_0x454c('0x11')]){if(_0x4b37a8[_0x454c('0x11')][_0x454c('0x12')]===0x1f4){logger[_0x454c('0x11')](_0x454c('0xc'),_0x164cf5,_0x4b37a8[_0x454c('0x11')][_0x454c('0x13')]);return _0x1c9e0a(_0x4b37a8['error']['message']);}logger[_0x454c('0x11')](_0x454c('0xc'),_0x164cf5,_0x4b37a8[_0x454c('0x11')]['message']);return _0x520c9f(_0x4b37a8['error'][_0x454c('0x13')]);}else{logger[_0x454c('0xb')](_0x454c('0xc'),_0x164cf5,_0x454c('0xd'));_0x520c9f(_0x4b37a8[_0x454c('0x14')][_0x454c('0x13')]);}})[_0x454c('0x15')](function(_0x20bd33){logger[_0x454c('0x11')](_0x454c('0xc'),_0x164cf5,_0x20bd33);_0x1c9e0a(_0x20bd33);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 3022159..49a5fb4 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a294e,_0x5770d2){var _0x40832f=function(_0x12c18d){while(--_0x12c18d){_0x3a294e['push'](_0x3a294e['shift']());}};_0x40832f(++_0x5770d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5681f5,_0x3f3c4e){var _0x4fae5b=function(_0x4aa003){while(--_0x4aa003){_0x5681f5['push'](_0x5681f5['shift']());}};_0x4fae5b(++_0x3f3c4e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xcb91[_0x3452a8];return _0x233814;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9f3b9c0..31fee27 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 _0x32dd=['exports','sequelize'];(function(_0x3ad393,_0x348025){var _0x269fd4=function(_0x403c38){while(--_0x403c38){_0x3ad393['push'](_0x3ad393['shift']());}};_0x269fd4(++_0x348025);}(_0x32dd,0x99));var _0xd32d=function(_0x68c4e3,_0x5b18b0){_0x68c4e3=_0x68c4e3-0x0;var _0xaca048=_0x32dd[_0x68c4e3];return _0xaca048;};'use strict';var Sequelize=require(_0xd32d('0x0'));module[_0xd32d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2649=['exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2649,0x16a));var _0x9264=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x2649[_0x7791d5];return _0x5ce288;};'use strict';var Sequelize=require('sequelize');module[_0x9264('0x0')]={'penalty':{'type':Sequelize[_0x9264('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 59eb4ac..5e6b775 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 _0x8d08=['api','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x5a6f93,_0x19c0d3){var _0x14bf43=function(_0x2bf049){while(--_0x2bf049){_0x5a6f93['push'](_0x5a6f93['shift']());}};_0x14bf43(++_0x19c0d3);}(_0x8d08,0xd9));var _0x88d0=function(_0x6622a2,_0x401a17){_0x6622a2=_0x6622a2-0x0;var _0x52252e=_0x8d08[_0x6622a2];return _0x52252e;};'use strict';var _=require(_0x88d0('0x0'));var util=require(_0x88d0('0x1'));var logger=require(_0x88d0('0x2'))(_0x88d0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x88d0('0x4'));var rimraf=require(_0x88d0('0x5'));var config=require('../../config/environment');var attributes=require(_0x88d0('0x6'));module[_0x88d0('0x7')]=function(_0x447cef,_0x48dba3){return _0x447cef[_0x88d0('0x8')](_0x88d0('0x9'),attributes,{'tableName':_0x88d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa638=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x1121fc,_0x3ad11a){var _0x7963c3=function(_0x257bf0){while(--_0x257bf0){_0x1121fc['push'](_0x1121fc['shift']());}};_0x7963c3(++_0x3ad11a);}(_0xa638,0x14f));var _0x8a63=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa638[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x8a63('0x0'));var util=require('util');var logger=require(_0x8a63('0x1'))(_0x8a63('0x2'));var moment=require(_0x8a63('0x3'));var BPromise=require(_0x8a63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a63('0x5'));var config=require(_0x8a63('0x6'));var attributes=require(_0x8a63('0x7'));module[_0x8a63('0x8')]=function(_0x42bd1a,_0x47a769){return _0x42bd1a[_0x8a63('0x9')](_0x8a63('0xa'),attributes,{'tableName':_0x8a63('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 999d141..0253ade 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x9a98d9,_0x2dd2c7){var _0x5da06b=function(_0x4913bd){while(--_0x4913bd){_0x9a98d9['push'](_0x9a98d9['shift']());}};_0x5da06b(++_0x2dd2c7);}(_0x6aa7,0x178));var _0x76aa=function(_0x5af9fb,_0x56da36){_0x5af9fb=_0x5af9fb-0x0;var _0x378cd7=_0x6aa7[_0x5af9fb];return _0x378cd7;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x55f687,_0x31dfc9){var _0x4e0ccd=function(_0x2517e4){while(--_0x2517e4){_0x55f687['push'](_0x55f687['shift']());}};_0x4e0ccd(++_0x31dfc9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0xf3cd[_0x7185f7];return _0x182e45;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 582b081..fbcb8d4 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 _0xc0c1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports'];(function(_0x1b3335,_0x2b2f52){var _0x300d95=function(_0x2c2a38){while(--_0x2c2a38){_0x1b3335['push'](_0x1b3335['shift']());}};_0x300d95(++_0x2b2f52);}(_0xc0c1,0x15f));var _0x1c0c=function(_0x3009e0,_0x53d3b){_0x3009e0=_0x3009e0-0x0;var _0x106b8f=_0xc0c1[_0x3009e0];return _0x106b8f;};'use strict';var multer=require('multer');var util=require(_0x1c0c('0x0'));var path=require(_0x1c0c('0x1'));var timeout=require(_0x1c0c('0x2'));var express=require(_0x1c0c('0x3'));var router=express[_0x1c0c('0x4')]();var fs_extra=require(_0x1c0c('0x5'));var auth=require(_0x1c0c('0x6'));var interaction=require(_0x1c0c('0x7'));var config=require(_0x1c0c('0x8'));var controller=require(_0x1c0c('0x9'));router[_0x1c0c('0xa')]('/',auth['isAuthenticated'](),controller[_0x1c0c('0xb')]);module[_0x1c0c('0xc')]=router; \ No newline at end of file +var _0x6df0=['sendUserNotification','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x6df0,0x9e));var _0x06df=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6df0[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x06df('0x0'));var path=require(_0x06df('0x1'));var timeout=require('connect-timeout');var express=require(_0x06df('0x2'));var router=express[_0x06df('0x3')]();var fs_extra=require(_0x06df('0x4'));var auth=require(_0x06df('0x5'));var interaction=require(_0x06df('0x6'));var config=require(_0x06df('0x7'));var controller=require('./userNotification.controller');router[_0x06df('0x8')]('/',auth[_0x06df('0x9')](),controller[_0x06df('0xa')]);module[_0x06df('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b2f4690..546b4d5 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 _0xe564=['exports','TEXT','STRING','BOOLEAN'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xe564,0x1d8));var _0x4e56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe564[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x4e56('0x0')]={'body':{'type':Sequelize[_0x4e56('0x1')]},'senderName':{'type':Sequelize[_0x4e56('0x2')]},'recipientsId':{'type':Sequelize[_0x4e56('0x1')]},'recipientsDescription':{'type':Sequelize[_0x4e56('0x2')]},'beep':{'type':Sequelize[_0x4e56('0x3')]}}; \ No newline at end of file +var _0x7eee=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x553f9f,_0x19d019){var _0x1ca672=function(_0x579af6){while(--_0x579af6){_0x553f9f['push'](_0x553f9f['shift']());}};_0x1ca672(++_0x19d019);}(_0x7eee,0x12b));var _0xe7ee=function(_0xd3e596,_0xae908a){_0xd3e596=_0xd3e596-0x0;var _0x3c01f7=_0x7eee[_0xd3e596];return _0x3c01f7;};'use strict';var Sequelize=require(_0xe7ee('0x0'));module[_0xe7ee('0x1')]={'body':{'type':Sequelize[_0xe7ee('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe7ee('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe7ee('0x3')]},'beep':{'type':Sequelize[_0xe7ee('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c98114c..f145a6a 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 _0xcb7c=['fullname','recipientsDescription','beep','SenderId','join','sequelize','recipient','emit','catch','Template','findOne','html','render','view','forEach','startCase','toLowerCase','union','ids','includes','queue','replace','Queue','push','all','map','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','model','senderName'];(function(_0x51801f,_0x4a5cd0){var _0x15d7d1=function(_0x5cb65f){while(--_0x5cb65f){_0x51801f['push'](_0x51801f['shift']());}};_0x15d7d1(++_0x4a5cd0);}(_0xcb7c,0x70));var _0xccb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb7c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xccb7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccb7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccb7('0x2'));var moment=require('moment');var BPromise=require(_0xccb7('0x3'));var Mustache=require('mustache');var util=require(_0xccb7('0x4'));var path=require(_0xccb7('0x5'));var sox=require(_0xccb7('0x6'));var csv=require(_0xccb7('0x7'));var ejs=require(_0xccb7('0x8'));var fs=require('fs');var fs_extra=require(_0xccb7('0x9'));var _=require('lodash');var squel=require(_0xccb7('0xa'));var crypto=require('crypto');var jsforce=require(_0xccb7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xccb7('0x7'));var querystring=require(_0xccb7('0xc'));var Papa=require(_0xccb7('0xd'));var Redis=require(_0xccb7('0xe'));var authService=require(_0xccb7('0xf'));var qs=require(_0xccb7('0x10'));var as=require(_0xccb7('0x11'));var hardwareService=require(_0xccb7('0x12'));var logger=require(_0xccb7('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xccb7('0x14'))['db'];config[_0xccb7('0x15')]=_[_0xccb7('0x16')](config[_0xccb7('0x15')],{'host':_0xccb7('0x17'),'port':0x18eb});var socket=require(_0xccb7('0x18'))(new Redis(config[_0xccb7('0x15')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x1d5894,_0x11ddd1){_0x11ddd1=_0x11ddd1||0xcc;return function(_0x129d12){if(_0x129d12){return _0x1d5894[_0xccb7('0x19')](_0x11ddd1);}return _0x1d5894[_0xccb7('0x1a')](_0x11ddd1)[_0xccb7('0x1b')]();};}function respondWithResult(_0x11f796,_0x5066ba){_0x5066ba=_0x5066ba||0xc8;return function(_0x5ab3dc){if(_0x5ab3dc){return _0x11f796[_0xccb7('0x1a')](_0x5066ba)[_0xccb7('0x1c')](_0x5ab3dc);}};}function respondWithFilteredResult(_0x4497fc,_0x4f54b1){return function(_0x4baf49){if(_0x4baf49){var _0x29fb26=typeof _0x4f54b1[_0xccb7('0x1d')]===_0xccb7('0x1e')&&typeof _0x4f54b1[_0xccb7('0x1f')]===_0xccb7('0x1e');var _0x721824=_0x4baf49['count'];var _0x1a727e=_0x29fb26?0x0:_0x4f54b1[_0xccb7('0x1d')];var _0x224af8=_0x29fb26?_0x4baf49[_0xccb7('0x20')]:_0x4f54b1[_0xccb7('0x1d')]+_0x4f54b1[_0xccb7('0x1f')];var _0x4bf8ad;if(_0x224af8>=_0x721824){_0x224af8=_0x721824;_0x4bf8ad=0xc8;}else{_0x4bf8ad=0xce;}_0x4497fc[_0xccb7('0x1a')](_0x4bf8ad);return _0x4497fc[_0xccb7('0x21')](_0xccb7('0x22'),_0x1a727e+'-'+_0x224af8+'/'+_0x721824)[_0xccb7('0x1c')](_0x4baf49);}return null;};}function patchUpdates(_0x41f3c5){return function(_0x2b19f1){try{jsonpatch[_0xccb7('0x23')](_0x2b19f1,_0x41f3c5,!![]);}catch(_0xe5decb){return BPromise['reject'](_0xe5decb);}return _0x2b19f1[_0xccb7('0x24')]();};}function saveUpdates(_0x414f92,_0x418483){return function(_0x5804de){if(_0x5804de){return _0x5804de['update'](_0x414f92)['then'](function(_0x3e3025){return _0x3e3025;});}return null;};}function removeEntity(_0x23441e,_0x3b30b0){return function(_0x2fc481){if(_0x2fc481){return _0x2fc481['destroy']()[_0xccb7('0x25')](function(){_0x23441e['status'](0xcc)[_0xccb7('0x1b')]();});}};}function handleEntityNotFound(_0x45b3fb,_0xdc1bfc){return function(_0x19edcd){if(!_0x19edcd){_0x45b3fb[_0xccb7('0x19')](0x194);}return _0x19edcd;};}function handleError(_0x54cbb0,_0xb3a3e2){_0xb3a3e2=_0xb3a3e2||0x1f4;return function(_0x29a480){logger[_0xccb7('0x26')](_0x29a480['stack']);if(_0x29a480[_0xccb7('0x27')]){delete _0x29a480['name'];}_0x54cbb0[_0xccb7('0x1a')](_0xb3a3e2)[_0xccb7('0x28')](_0x29a480);};}exports['sendUserNotification']=function(_0x56863c,_0x504e66,_0x3905a6){if(!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')](_0xccb7('0x2b'))&&!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')](_0xccb7('0x2c'))){throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))](_0xccb7('0x2f'));}else{if(_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')]('TemplateId')&&!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')]('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')](_0xccb7('0x30'))){throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))](_0xccb7('0x31'));}else{try{var _0x382e76=JSON[_0xccb7('0x32')](_0x56863c[_0xccb7('0x29')][_0xccb7('0x30')]);}catch(_0x29e3b5){logger[_0xccb7('0x26')](_0x29e3b5);throw new db['Sequelize'][(_0xccb7('0x2e'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2836ea=[_0xccb7('0x33'),'faxqueue',_0xccb7('0x34'),_0xccb7('0x35'),_0xccb7('0x36'),_0xccb7('0x37'),_0xccb7('0x38'),'team',_0xccb7('0x39')];if(_['some'](_0x382e76,function(_0xbfd5d9){return!_['includes'](_0x2836ea,_0xbfd5d9[_0xccb7('0x3a')]['toLowerCase']());})){throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x15ff34={};_0x15ff34['senderName']=_0x56863c[_0xccb7('0x29')][_0xccb7('0x2a')]('senderName')?_0x56863c[_0xccb7('0x29')][_0xccb7('0x3b')]:_0x56863c[_0xccb7('0x39')][_0xccb7('0x3c')];_0x15ff34[_0xccb7('0x3d')]=_['isEmpty'](_0x56863c[_0xccb7('0x29')][_0xccb7('0x3d')])?null:_0x56863c[_0xccb7('0x29')][_0xccb7('0x3d')];_0x15ff34[_0xccb7('0x3e')]=_0x56863c['body'][_0xccb7('0x3e')]||![];_0x15ff34[_0xccb7('0x3f')]=_0x56863c[_0xccb7('0x39')]['id'];return getContent(_0x56863c[_0xccb7('0x29')])[_0xccb7('0x25')](function(_0x917898){_0x15ff34[_0xccb7('0x29')]=_0x917898;return getRecipients(_0x382e76);})['then'](function(_0x13afaf){_0x15ff34['recipientsId']=_['sortBy'](_0x13afaf)[_0xccb7('0x40')](',');return db[_0xccb7('0x41')]['transaction'](function(_0x39cc53){return db['UserNotification']['create'](_0x15ff34,{'raw':!![],'transaction':_0x39cc53})[_0xccb7('0x25')](function(_0x104d8e){var _0x1e5839={'sender':_0x15ff34['senderName'],'description':_0x15ff34[_0xccb7('0x3d')],'content':_0x15ff34[_0xccb7('0x29')],'beep':_0x15ff34[_0xccb7('0x3e')]};_0x13afaf['forEach'](function(_0x2bd6a8){_0x1e5839[_0xccb7('0x42')]=_0x2bd6a8;socket[_0xccb7('0x43')]('userNotification:send',_0x1e5839);});return _0x104d8e;});});})[_0xccb7('0x25')](respondWithResult(_0x504e66,0xc9))[_0xccb7('0x44')](handleError(_0x504e66,null));};function getContent(_0x3ac5c7){return new BPromise(function(_0x112de1,_0x594a0d){if(_0x3ac5c7[_0xccb7('0x2b')]){_0x112de1(_0x3ac5c7[_0xccb7('0x2b')]);return;}return db[_0xccb7('0x45')][_0xccb7('0x46')]({'attributes':[_0xccb7('0x47')],'where':{'id':_0x3ac5c7['TemplateId']},'raw':!![]})[_0xccb7('0x25')](function(_0x147693){if(!_0x147693)throw new db[(_0xccb7('0x2d'))][(_0xccb7('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1767a7=Mustache[_0xccb7('0x48')](_0x147693[_0xccb7('0x47')],_0x3ac5c7[_0xccb7('0x49')]);_0x112de1(_0x1767a7);})[_0xccb7('0x44')](function(_0xefcedf){_0x594a0d(_0xefcedf);});});}function getRecipients(_0x423923){return new BPromise(function(_0x2574c6,_0x5eb23d){var _0x2e755a=[];var _0x4385f5=[];_0x423923[_0xccb7('0x4a')](function(_0x17a7cc){var _0x51e035=_[_0xccb7('0x4b')](_0x17a7cc[_0xccb7('0x3a')][_0xccb7('0x4c')]());if(_0x51e035==='User'){_0x2e755a=_[_0xccb7('0x4d')](_0x2e755a,_0x17a7cc[_0xccb7('0x4e')]);}else{if(_[_0xccb7('0x4f')](_0x51e035,_0xccb7('0x50')))_0x51e035=_0x51e035[_0xccb7('0x51')](_0xccb7('0x50'),_0xccb7('0x52'));_0x17a7cc[_0xccb7('0x4e')]['forEach'](function(_0x50e797){_0x4385f5[_0xccb7('0x53')](getAgents(_0x51e035,_0x50e797));});}});return BPromise[_0xccb7('0x54')](_0x4385f5)[_0xccb7('0x25')](function(_0x11003b){_0x2e755a=_[_0xccb7('0x4d')](_0x2e755a,_['flatten'](_0x11003b));_0x2574c6(_0x2e755a);})['catch'](function(_0x14d690){_0x5eb23d(_0x14d690);});});}function getAgents(_0x20ce5b,_0x2a7e09){return new BPromise(function(_0x88228,_0x12647a){return db[_0x20ce5b][_0xccb7('0x46')]({'where':{'id':_0x2a7e09}})[_0xccb7('0x25')](function(_0x407821){return _0x407821['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d29ad){var _0x264fec=_[_0xccb7('0x55')](_0x3d29ad,'id');_0x88228(_0x264fec);});})[_0xccb7('0x44')](function(_0x4eddf6){_0x12647a(_0x4eddf6);});});} \ No newline at end of file +var _0x7754=['path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','voicequeue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','union','ids','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x34f46b,_0x24ec8b){var _0x422b82=function(_0x3f3733){while(--_0x3f3733){_0x34f46b['push'](_0x34f46b['shift']());}};_0x422b82(++_0x24ec8b);}(_0x7754,0x1e2));var _0x4775=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x7754[_0x478c8a];return _0x3b6b3e;};'use strict';var emlformat=require(_0x4775('0x0'));var rimraf=require(_0x4775('0x1'));var zipdir=require(_0x4775('0x2'));var jsonpatch=require(_0x4775('0x3'));var rp=require(_0x4775('0x4'));var moment=require(_0x4775('0x5'));var BPromise=require(_0x4775('0x6'));var Mustache=require(_0x4775('0x7'));var util=require('util');var path=require(_0x4775('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4775('0x9'));var _=require('lodash');var squel=require(_0x4775('0xa'));var crypto=require(_0x4775('0xb'));var jsforce=require(_0x4775('0xc'));var deskjs=require(_0x4775('0xd'));var toCsv=require(_0x4775('0xe'));var querystring=require('querystring');var Papa=require(_0x4775('0xf'));var Redis=require(_0x4775('0x10'));var authService=require(_0x4775('0x11'));var qs=require(_0x4775('0x12'));var as=require(_0x4775('0x13'));var hardwareService=require(_0x4775('0x14'));var logger=require('../../config/logger')(_0x4775('0x15'));var utils=require(_0x4775('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4775('0x17'));var db=require('../../mysqldb')['db'];config[_0x4775('0x18')]=_['defaults'](config[_0x4775('0x18')],{'host':_0x4775('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4775('0x18')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x2f393b,_0x4b1df3){_0x4b1df3=_0x4b1df3||0xcc;return function(_0x1a7a3f){if(_0x1a7a3f){return _0x2f393b['sendStatus'](_0x4b1df3);}return _0x2f393b[_0x4775('0x1a')](_0x4b1df3)[_0x4775('0x1b')]();};}function respondWithResult(_0x1ee1cb,_0x4c263f){_0x4c263f=_0x4c263f||0xc8;return function(_0x1b4139){if(_0x1b4139){return _0x1ee1cb['status'](_0x4c263f)[_0x4775('0x1c')](_0x1b4139);}};}function respondWithFilteredResult(_0x45c762,_0x43c7bb){return function(_0x3113a3){if(_0x3113a3){var _0x1f89dc=typeof _0x43c7bb[_0x4775('0x1d')]==='undefined'&&typeof _0x43c7bb['limit']===_0x4775('0x1e');var _0x515d95=_0x3113a3[_0x4775('0x1f')];var _0x1ce8d8=_0x1f89dc?0x0:_0x43c7bb[_0x4775('0x1d')];var _0xc2b9dc=_0x1f89dc?_0x3113a3['count']:_0x43c7bb[_0x4775('0x1d')]+_0x43c7bb[_0x4775('0x20')];var _0x37962f;if(_0xc2b9dc>=_0x515d95){_0xc2b9dc=_0x515d95;_0x37962f=0xc8;}else{_0x37962f=0xce;}_0x45c762[_0x4775('0x1a')](_0x37962f);return _0x45c762[_0x4775('0x21')](_0x4775('0x22'),_0x1ce8d8+'-'+_0xc2b9dc+'/'+_0x515d95)[_0x4775('0x1c')](_0x3113a3);}return null;};}function patchUpdates(_0x33b1c1){return function(_0x36ef86){try{jsonpatch[_0x4775('0x23')](_0x36ef86,_0x33b1c1,!![]);}catch(_0xf24caa){return BPromise['reject'](_0xf24caa);}return _0x36ef86[_0x4775('0x24')]();};}function saveUpdates(_0x3a1f98,_0x566965){return function(_0x2879db){if(_0x2879db){return _0x2879db[_0x4775('0x25')](_0x3a1f98)[_0x4775('0x26')](function(_0x57ec66){return _0x57ec66;});}return null;};}function removeEntity(_0x275034,_0x205d48){return function(_0xa218f9){if(_0xa218f9){return _0xa218f9[_0x4775('0x27')]()['then'](function(){_0x275034[_0x4775('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de8a5,_0x43a993){return function(_0x15b8cb){if(!_0x15b8cb){_0x2de8a5[_0x4775('0x28')](0x194);}return _0x15b8cb;};}function handleError(_0x45f234,_0x264ae8){_0x264ae8=_0x264ae8||0x1f4;return function(_0x34d483){logger[_0x4775('0x29')](_0x34d483[_0x4775('0x2a')]);if(_0x34d483[_0x4775('0x2b')]){delete _0x34d483['name'];}_0x45f234[_0x4775('0x1a')](_0x264ae8)[_0x4775('0x2c')](_0x34d483);};}exports[_0x4775('0x2d')]=function(_0x3653e9,_0x108da3,_0x5f03fb){if(!_0x3653e9[_0x4775('0x2e')][_0x4775('0x2f')]('text')&&!_0x3653e9[_0x4775('0x2e')][_0x4775('0x2f')](_0x4775('0x30'))){throw new db[(_0x4775('0x31'))][(_0x4775('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3653e9['body'][_0x4775('0x2f')]('TemplateId')&&!_0x3653e9['body'][_0x4775('0x2f')](_0x4775('0x33'))){throw new db['Sequelize'][(_0x4775('0x32'))](_0x4775('0x34'));}if(!_0x3653e9['body'][_0x4775('0x2f')]('recipients')){throw new db[(_0x4775('0x31'))][(_0x4775('0x32'))](_0x4775('0x35'));}else{try{var _0x1d70fa=JSON[_0x4775('0x36')](_0x3653e9['body'][_0x4775('0x37')]);}catch(_0x2cb29b){logger[_0x4775('0x29')](_0x2cb29b);throw new db[(_0x4775('0x31'))][(_0x4775('0x32'))](_0x4775('0x38'));}var _0x31b3c8=['chatqueue',_0x4775('0x39'),'mailqueue','openchannelqueue',_0x4775('0x3a'),_0x4775('0x3b'),'whatsappqueue','team','user'];if(_[_0x4775('0x3c')](_0x1d70fa,function(_0x20ca90){return!_[_0x4775('0x3d')](_0x31b3c8,_0x20ca90[_0x4775('0x3e')][_0x4775('0x3f')]());})){throw new db[(_0x4775('0x31'))][(_0x4775('0x32'))](_0x4775('0x40'));}}}var _0x469a9a={};_0x469a9a['senderName']=_0x3653e9['body']['hasOwnProperty']('senderName')?_0x3653e9[_0x4775('0x2e')][_0x4775('0x41')]:_0x3653e9[_0x4775('0x42')]['fullname'];_0x469a9a[_0x4775('0x43')]=_[_0x4775('0x44')](_0x3653e9['body']['recipientsDescription'])?null:_0x3653e9[_0x4775('0x2e')][_0x4775('0x43')];_0x469a9a[_0x4775('0x45')]=_0x3653e9[_0x4775('0x2e')]['beep']||![];_0x469a9a[_0x4775('0x46')]=_0x3653e9[_0x4775('0x42')]['id'];return getContent(_0x3653e9[_0x4775('0x2e')])[_0x4775('0x26')](function(_0x12d301){_0x469a9a[_0x4775('0x2e')]=_0x12d301;return getRecipients(_0x1d70fa);})[_0x4775('0x26')](function(_0x36c2de){_0x469a9a[_0x4775('0x47')]=_[_0x4775('0x48')](_0x36c2de)[_0x4775('0x49')](',');return db[_0x4775('0x4a')][_0x4775('0x4b')](function(_0x51f103){return db[_0x4775('0x4c')][_0x4775('0x4d')](_0x469a9a,{'raw':!![],'transaction':_0x51f103})['then'](function(_0x2330f2){var _0x17946b={'sender':_0x469a9a[_0x4775('0x41')],'description':_0x469a9a['recipientsDescription'],'content':_0x469a9a[_0x4775('0x2e')],'beep':_0x469a9a[_0x4775('0x45')]};_0x36c2de[_0x4775('0x4e')](function(_0x1d1c11){_0x17946b[_0x4775('0x4f')]=_0x1d1c11;socket[_0x4775('0x50')](_0x4775('0x51'),_0x17946b);});return _0x2330f2;});});})['then'](respondWithResult(_0x108da3,0xc9))[_0x4775('0x52')](handleError(_0x108da3,null));};function getContent(_0x320ae5){return new BPromise(function(_0x2eeede,_0x4ea147){if(_0x320ae5[_0x4775('0x53')]){_0x2eeede(_0x320ae5[_0x4775('0x53')]);return;}return db[_0x4775('0x54')][_0x4775('0x55')]({'attributes':[_0x4775('0x56')],'where':{'id':_0x320ae5[_0x4775('0x30')]},'raw':!![]})[_0x4775('0x26')](function(_0x20896f){if(!_0x20896f)throw new db[(_0x4775('0x31'))]['ValidationError'](_0x4775('0x57'));var _0x4f80f7=Mustache[_0x4775('0x58')](_0x20896f[_0x4775('0x56')],_0x320ae5[_0x4775('0x33')]);_0x2eeede(_0x4f80f7);})[_0x4775('0x52')](function(_0x471430){_0x4ea147(_0x471430);});});}function getRecipients(_0x171b57){return new BPromise(function(_0x161dfd,_0x56dbf4){var _0x7a1308=[];var _0xb14f4e=[];_0x171b57[_0x4775('0x4e')](function(_0x21d810){var _0x540409=_['startCase'](_0x21d810[_0x4775('0x3e')]['toLowerCase']());if(_0x540409==='User'){_0x7a1308=_[_0x4775('0x59')](_0x7a1308,_0x21d810[_0x4775('0x5a')]);}else{if(_[_0x4775('0x3d')](_0x540409,'queue'))_0x540409=_0x540409[_0x4775('0x5b')]('queue',_0x4775('0x5c'));_0x21d810[_0x4775('0x5a')][_0x4775('0x4e')](function(_0x49c0b6){_0xb14f4e[_0x4775('0x5d')](getAgents(_0x540409,_0x49c0b6));});}});return BPromise[_0x4775('0x5e')](_0xb14f4e)[_0x4775('0x26')](function(_0x16252c){_0x7a1308=_['union'](_0x7a1308,_[_0x4775('0x5f')](_0x16252c));_0x161dfd(_0x7a1308);})[_0x4775('0x52')](function(_0x4ad988){_0x56dbf4(_0x4ad988);});});}function getAgents(_0x2a0d0d,_0x2eb488){return new BPromise(function(_0x58d6e5,_0x17a735){return db[_0x2a0d0d]['findOne']({'where':{'id':_0x2eb488}})['then'](function(_0x4c842b){return _0x4c842b[_0x4775('0x60')]({'attributes':['id'],'raw':!![]})[_0x4775('0x26')](function(_0x465a31){var _0x2811c5=_[_0x4775('0x61')](_0x465a31,'id');_0x58d6e5(_0x2811c5);});})[_0x4775('0x52')](function(_0x90ee3b){_0x17a735(_0x90ee3b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 0c3d358..361afdb 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 _0xb672=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3845bd,_0x4d32f0){var _0x1181df=function(_0x449cda){while(--_0x449cda){_0x3845bd['push'](_0x3845bd['shift']());}};_0x1181df(++_0x4d32f0);}(_0xb672,0xfa));var _0x2b67=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb672[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x2b67('0x0'));var UserNotification=require(_0x2b67('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b67('0x2'),'afterUpdate':_0x2b67('0x3'),'afterDestroy':_0x2b67('0x4')};function emitEvent(_0x9025ed){return function(_0x2271ee,_0x9f1027,_0x1cc552){UserNotificationEvents[_0x2b67('0x5')](_0x9025ed+':'+_0x2271ee['id'],_0x2271ee);UserNotificationEvents['emit'](_0x9025ed,_0x2271ee);_0x1cc552(null);};}for(var e in events){if(events[_0x2b67('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x2b67('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x1861=['hook','exports','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x226c11,_0x14c0a4){var _0x4dc73e=function(_0x17e242){while(--_0x17e242){_0x226c11['push'](_0x226c11['shift']());}};_0x4dc73e(++_0x14c0a4);}(_0x1861,0xd1));var _0x1186=function(_0x8e45f4,_0x4ec7fb){_0x8e45f4=_0x8e45f4-0x0;var _0x547279=_0x1861[_0x8e45f4];return _0x547279;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x1186('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1186('0x1')](0x0);var events={'afterCreate':_0x1186('0x2'),'afterUpdate':_0x1186('0x3'),'afterDestroy':_0x1186('0x4')};function emitEvent(_0x564284){return function(_0x3d0eae,_0x62736a,_0x460cee){UserNotificationEvents[_0x1186('0x5')](_0x564284+':'+_0x3d0eae['id'],_0x3d0eae);UserNotificationEvents[_0x1186('0x5')](_0x564284,_0x3d0eae);_0x460cee(null);};}for(var e in events){if(events[_0x1186('0x6')](e)){var event=events[e];UserNotification[_0x1186('0x7')](e,emitEvent(event));}}module[_0x1186('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 626e6f7..8e13528 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 _0x7128=['lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','define','utf8mb4'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x7128,0x1b9));var _0x8712=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x7128[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x8712('0x0'));var util=require('util');var logger=require(_0x8712('0x1'))('api');var moment=require(_0x8712('0x2'));var BPromise=require(_0x8712('0x3'));var rp=require(_0x8712('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8712('0x5'));var attributes=require(_0x8712('0x6'));module['exports']=function(_0xf8aed0,_0x4e571b){return _0xf8aed0[_0x8712('0x7')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8712('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbee1=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x53a56f,_0x38f8c0){var _0x33bc06=function(_0x2967b5){while(--_0x2967b5){_0x53a56f['push'](_0x53a56f['shift']());}};_0x33bc06(++_0x38f8c0);}(_0xbee1,0xb3));var _0x1bee=function(_0x23a484,_0x2db584){_0x23a484=_0x23a484-0x0;var _0x579e05=_0xbee1[_0x23a484];return _0x579e05;};'use strict';var _=require(_0x1bee('0x0'));var util=require(_0x1bee('0x1'));var logger=require(_0x1bee('0x2'))(_0x1bee('0x3'));var moment=require(_0x1bee('0x4'));var BPromise=require(_0x1bee('0x5'));var rp=require(_0x1bee('0x6'));var fs=require('fs');var path=require(_0x1bee('0x7'));var rimraf=require(_0x1bee('0x8'));var config=require(_0x1bee('0x9'));var attributes=require(_0x1bee('0xa'));module[_0x1bee('0xb')]=function(_0x3cd725,_0x5b9a1e){return _0x3cd725[_0x1bee('0xc')]('UserNotification',attributes,{'tableName':_0x1bee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1bee('0xe'),'collate':_0x1bee('0xf')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index ec323fc..113ddbe 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 _0x58ee=['code','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x58ee,0x101));var _0xe58e=function(_0x3fdc0e,_0x94b816){_0x3fdc0e=_0x3fdc0e-0x0;var _0x34247b=_0x58ee[_0x3fdc0e];return _0x34247b;};'use strict';var _=require(_0xe58e('0x0'));var util=require('util');var moment=require(_0xe58e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe58e('0x2'));var db=require(_0xe58e('0x3'))['db'];var utils=require(_0xe58e('0x4'));var logger=require(_0xe58e('0x5'))('rpc');var config=require(_0xe58e('0x6'));var jayson=require(_0xe58e('0x7'));var client=jayson[_0xe58e('0x8')][_0xe58e('0x9')]({'port':0x232a});config['redis']=_[_0xe58e('0xa')](config[_0xe58e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe58e('0xc'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x68f9b5,_0x25f6d5,_0x36a52b){return new BPromise(function(_0xf6f3e8,_0x4dd258){return client['request'](_0x68f9b5,_0x36a52b)[_0xe58e('0xd')](function(_0x1460af){logger['info'](_0xe58e('0xe'),_0x25f6d5,_0xe58e('0xf'));logger['debug'](_0xe58e('0x10'),_0x25f6d5,_0xe58e('0xf'),JSON[_0xe58e('0x11')](_0x1460af));if(_0x1460af[_0xe58e('0x12')]){if(_0x1460af[_0xe58e('0x12')][_0xe58e('0x13')]===0x1f4){logger[_0xe58e('0x12')](_0xe58e('0xe'),_0x25f6d5,_0x1460af[_0xe58e('0x12')][_0xe58e('0x14')]);return _0x4dd258(_0x1460af[_0xe58e('0x12')][_0xe58e('0x14')]);}logger[_0xe58e('0x12')](_0xe58e('0xe'),_0x25f6d5,_0x1460af[_0xe58e('0x12')]['message']);return _0xf6f3e8(_0x1460af[_0xe58e('0x12')]['message']);}else{logger[_0xe58e('0x15')](_0xe58e('0xe'),_0x25f6d5,_0xe58e('0xf'));_0xf6f3e8(_0x1460af['result'][_0xe58e('0x14')]);}})[_0xe58e('0x16')](function(_0x458574){logger[_0xe58e('0x12')](_0xe58e('0xe'),_0x25f6d5,_0x458574);_0x4dd258(_0x458574);});});} \ No newline at end of file +var _0xaa58=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x4ce5b1,_0x438620){var _0xb5ccfc=function(_0x14b56e){while(--_0x14b56e){_0x4ce5b1['push'](_0x4ce5b1['shift']());}};_0xb5ccfc(++_0x438620);}(_0xaa58,0x188));var _0x8aa5=function(_0x4403e0,_0x26be98){_0x4403e0=_0x4403e0-0x0;var _0x4aa5e4=_0xaa58[_0x4403e0];return _0x4aa5e4;};'use strict';var _=require(_0x8aa5('0x0'));var util=require(_0x8aa5('0x1'));var moment=require(_0x8aa5('0x2'));var BPromise=require('bluebird');var rs=require(_0x8aa5('0x3'));var fs=require('fs');var Redis=require(_0x8aa5('0x4'));var db=require(_0x8aa5('0x5'))['db'];var utils=require(_0x8aa5('0x6'));var logger=require(_0x8aa5('0x7'))(_0x8aa5('0x8'));var config=require('../../config/environment');var jayson=require(_0x8aa5('0x9'));var client=jayson[_0x8aa5('0xa')][_0x8aa5('0xb')]({'port':0x232a});config[_0x8aa5('0xc')]=_['defaults'](config[_0x8aa5('0xc')],{'host':_0x8aa5('0xd'),'port':0x18eb});var socket=require(_0x8aa5('0xe'))(new Redis(config[_0x8aa5('0xc')]));require(_0x8aa5('0xf'))[_0x8aa5('0x10')](socket);function respondWithRpcPromise(_0x1c7e93,_0x27dd1f,_0x8d050d){return new BPromise(function(_0x2c2386,_0x307ee3){return client[_0x8aa5('0x11')](_0x1c7e93,_0x8d050d)[_0x8aa5('0x12')](function(_0x3e8d11){logger[_0x8aa5('0x13')](_0x8aa5('0x14'),_0x27dd1f,'request\x20sent');logger[_0x8aa5('0x15')](_0x8aa5('0x16'),_0x27dd1f,'request\x20sent',JSON['stringify'](_0x3e8d11));if(_0x3e8d11[_0x8aa5('0x17')]){if(_0x3e8d11['error'][_0x8aa5('0x18')]===0x1f4){logger['error'](_0x8aa5('0x14'),_0x27dd1f,_0x3e8d11[_0x8aa5('0x17')][_0x8aa5('0x19')]);return _0x307ee3(_0x3e8d11[_0x8aa5('0x17')][_0x8aa5('0x19')]);}logger[_0x8aa5('0x17')](_0x8aa5('0x14'),_0x27dd1f,_0x3e8d11['error'][_0x8aa5('0x19')]);return _0x2c2386(_0x3e8d11[_0x8aa5('0x17')][_0x8aa5('0x19')]);}else{logger[_0x8aa5('0x13')](_0x8aa5('0x14'),_0x27dd1f,_0x8aa5('0x1a'));_0x2c2386(_0x3e8d11[_0x8aa5('0x1b')][_0x8aa5('0x19')]);}})['catch'](function(_0x202cad){logger[_0x8aa5('0x17')](_0x8aa5('0x14'),_0x27dd1f,_0x202cad);_0x307ee3(_0x202cad);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 63640c1..352f275 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 _0x92be=['userNotification:','save','update','removeListener'];(function(_0xf35163,_0x5754d8){var _0x46dda1=function(_0x2984ff){while(--_0x2984ff){_0xf35163['push'](_0xf35163['shift']());}};_0x46dda1(++_0x5754d8);}(_0x92be,0xd1));var _0xe92b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x92be[_0x57b54c];return _0x59cc19;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xe92b('0x0'),'remove',_0xe92b('0x1')];function createListener(_0x2dc2d6,_0x30363b){return function(_0x3fde44){_0x30363b['emit'](_0x2dc2d6,_0x3fde44);};}function removeListener(_0x5c6c57,_0x1ffe49){return function(){UserNotificationEvents[_0xe92b('0x2')](_0x5c6c57,_0x1ffe49);};}exports['register']=function(_0x42426b){for(var _0xdd6156=0x0,_0x2360a2=events['length'];_0xdd6156<_0x2360a2;_0xdd6156++){var _0x3add2c=events[_0xdd6156];var _0xf22fee=createListener(_0xe92b('0x3')+_0x3add2c,_0x42426b);UserNotificationEvents['on'](_0x3add2c,_0xf22fee);}}; \ No newline at end of file +var _0xefbf=['length','save','remove','update','emit','register'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xefbf,0xe5));var _0xfefb=function(_0x36bb20,_0x57df9a){_0x36bb20=_0x36bb20-0x0;var _0xd3c635=_0xefbf[_0x36bb20];return _0xd3c635;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xfefb('0x0'),_0xfefb('0x1'),_0xfefb('0x2')];function createListener(_0x5099bb,_0x3092c0){return function(_0x3d4537){_0x3092c0[_0xfefb('0x3')](_0x5099bb,_0x3d4537);};}function removeListener(_0x7fa79f,_0x1028b1){return function(){UserNotificationEvents['removeListener'](_0x7fa79f,_0x1028b1);};}exports[_0xfefb('0x4')]=function(_0xf39e44){for(var _0x2b8b29=0x0,_0x1c9a7c=events[_0xfefb('0x5')];_0x2b8b29<_0x1c9a7c;_0x2b8b29++){var _0x22c3a7=events[_0x2b8b29];var _0x9c9830=createListener('userNotification:'+_0x22c3a7,_0xf39e44);UserNotificationEvents['on'](_0x22c3a7,_0x9c9830);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 67d2c12..5aaca23 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x13259c,_0x558710){var _0x163bc9=function(_0x36dae9){while(--_0x36dae9){_0x13259c['push'](_0x13259c['shift']());}};_0x163bc9(++_0x558710);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xcb91[_0x4226d6];return _0x19655b;};'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(_0x50e065,_0x4a6ee9){var _0x4fe802=function(_0x2b6548){while(--_0x2b6548){_0x50e065['push'](_0x50e065['shift']());}};_0x4fe802(++_0x4a6ee9);}(_0xedd9,0xfc));var _0x9edd=function(_0x44ed77,_0x168347){_0x44ed77=_0x44ed77-0x0;var _0x3ad8b8=_0xedd9[_0x44ed77];return _0x3ad8b8;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2c5f643..f2ed445 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 _0x3f2b=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f2b,0x13c));var _0xb3f2=function(_0xd7c92e,_0x2cc009){_0xd7c92e=_0xd7c92e-0x0;var _0x220c75=_0x3f2b[_0xd7c92e];return _0x220c75;};'use strict';var Sequelize=require(_0xb3f2('0x0'));module[_0xb3f2('0x1')]={'penalty':{'type':Sequelize[_0xb3f2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34f9=['exports','INTEGER','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x34f9,0x158));var _0x934f=function(_0x40852a,_0x192b56){_0x40852a=_0x40852a-0x0;var _0x24ffc0=_0x34f9[_0x40852a];return _0x24ffc0;};'use strict';var Sequelize=require(_0x934f('0x0'));module[_0x934f('0x1')]={'penalty':{'type':Sequelize[_0x934f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index c50b998..d28c79d 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 _0x275e=['api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x171b5c,_0xfd93df){var _0x30a347=function(_0x1ae91d){while(--_0x1ae91d){_0x171b5c['push'](_0x171b5c['shift']());}};_0x30a347(++_0xfd93df);}(_0x275e,0xa6));var _0xe275=function(_0x5de58a,_0x385b6e){_0x5de58a=_0x5de58a-0x0;var _0x32271c=_0x275e[_0x5de58a];return _0x32271c;};'use strict';var _=require(_0xe275('0x0'));var util=require(_0xe275('0x1'));var logger=require('../../config/logger')(_0xe275('0x2'));var moment=require(_0xe275('0x3'));var BPromise=require(_0xe275('0x4'));var rp=require(_0xe275('0x5'));var fs=require('fs');var path=require(_0xe275('0x6'));var rimraf=require('rimraf');var config=require(_0xe275('0x7'));var attributes=require(_0xe275('0x8'));module['exports']=function(_0x57d621,_0x239d11){return _0x57d621[_0xe275('0x9')](_0xe275('0xa'),attributes,{'tableName':_0xe275('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51db=['user_has_openchannel_queues','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x48eec8,_0x220f7f){var _0x3755cb=function(_0x3a9963){while(--_0x3a9963){_0x48eec8['push'](_0x48eec8['shift']());}};_0x3755cb(++_0x220f7f);}(_0x51db,0x156));var _0xb51d=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x51db[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0xb51d('0x0'));var util=require('util');var logger=require(_0xb51d('0x1'))(_0xb51d('0x2'));var moment=require(_0xb51d('0x3'));var BPromise=require('bluebird');var rp=require(_0xb51d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb51d('0x5'));var config=require(_0xb51d('0x6'));var attributes=require(_0xb51d('0x7'));module[_0xb51d('0x8')]=function(_0xb6eac8,_0x29869e){return _0xb6eac8[_0xb51d('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xb51d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 490406e..e5a5827 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 _0x9b58=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x9b58,0x94));var _0x89b5=function(_0x75db0,_0x6b613b){_0x75db0=_0x75db0-0x0;var _0x1bafc3=_0x9b58[_0x75db0];return _0x1bafc3;};'use strict';var _=require('lodash');var util=require(_0x89b5('0x0'));var moment=require(_0x89b5('0x1'));var BPromise=require(_0x89b5('0x2'));var rs=require(_0x89b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89b5('0x4'))['db'];var utils=require(_0x89b5('0x5'));var logger=require(_0x89b5('0x6'))(_0x89b5('0x7'));var config=require('../../config/environment');var jayson=require(_0x89b5('0x8'));var client=jayson[_0x89b5('0x9')][_0x89b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd22df1,_0x65ad5a,_0x371b52){return new BPromise(function(_0x266e5d,_0x4a6b0f){return client[_0x89b5('0xb')](_0xd22df1,_0x371b52)[_0x89b5('0xc')](function(_0x2fd575){logger['info'](_0x89b5('0xd'),_0x65ad5a,_0x89b5('0xe'));logger['debug'](_0x89b5('0xf'),_0x65ad5a,_0x89b5('0xe'),JSON['stringify'](_0x2fd575));if(_0x2fd575[_0x89b5('0x10')]){if(_0x2fd575[_0x89b5('0x10')][_0x89b5('0x11')]===0x1f4){logger['error'](_0x89b5('0xd'),_0x65ad5a,_0x2fd575['error'][_0x89b5('0x12')]);return _0x4a6b0f(_0x2fd575['error'][_0x89b5('0x12')]);}logger[_0x89b5('0x10')](_0x89b5('0xd'),_0x65ad5a,_0x2fd575[_0x89b5('0x10')]['message']);return _0x266e5d(_0x2fd575[_0x89b5('0x10')][_0x89b5('0x12')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x65ad5a,_0x89b5('0xe'));_0x266e5d(_0x2fd575[_0x89b5('0x13')][_0x89b5('0x12')]);}})[_0x89b5('0x14')](function(_0x53b0d4){logger[_0x89b5('0x10')](_0x89b5('0xd'),_0x65ad5a,_0x53b0d4);_0x4a6b0f(_0x53b0d4);});});} \ No newline at end of file +var _0x0530=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x4309e6,_0x328456){var _0x4f5ff8=function(_0x14f213){while(--_0x14f213){_0x4309e6['push'](_0x4309e6['shift']());}};_0x4f5ff8(++_0x328456);}(_0x0530,0x72));var _0x0053=function(_0x336ef2,_0x83fd79){_0x336ef2=_0x336ef2-0x0;var _0x324fe=_0x0530[_0x336ef2];return _0x324fe;};'use strict';var _=require(_0x0053('0x0'));var util=require(_0x0053('0x1'));var moment=require('moment');var BPromise=require(_0x0053('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0053('0x3'));var db=require(_0x0053('0x4'))['db'];var utils=require(_0x0053('0x5'));var logger=require('../../config/logger')(_0x0053('0x6'));var config=require(_0x0053('0x7'));var jayson=require(_0x0053('0x8'));var client=jayson[_0x0053('0x9')][_0x0053('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e244d,_0x5beedd,_0x27fcf9){return new BPromise(function(_0x4db241,_0x42a345){return client[_0x0053('0xb')](_0x4e244d,_0x27fcf9)[_0x0053('0xc')](function(_0x572bf0){logger[_0x0053('0xd')](_0x0053('0xe'),_0x5beedd,'request\x20sent');logger[_0x0053('0xf')](_0x0053('0x10'),_0x5beedd,_0x0053('0x11'),JSON['stringify'](_0x572bf0));if(_0x572bf0[_0x0053('0x12')]){if(_0x572bf0['error'][_0x0053('0x13')]===0x1f4){logger['error'](_0x0053('0xe'),_0x5beedd,_0x572bf0['error'][_0x0053('0x14')]);return _0x42a345(_0x572bf0[_0x0053('0x12')][_0x0053('0x14')]);}logger['error'](_0x0053('0xe'),_0x5beedd,_0x572bf0[_0x0053('0x12')][_0x0053('0x14')]);return _0x4db241(_0x572bf0[_0x0053('0x12')][_0x0053('0x14')]);}else{logger[_0x0053('0xd')](_0x0053('0xe'),_0x5beedd,_0x0053('0x11'));_0x4db241(_0x572bf0[_0x0053('0x15')][_0x0053('0x14')]);}})[_0x0053('0x16')](function(_0x62dce5){logger[_0x0053('0x12')](_0x0053('0xe'),_0x5beedd,_0x62dce5);_0x42a345(_0x62dce5);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 59b4058..50ec238 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 _0xbc88=['/:id/clone','clone','addSections','addResources','put','delete','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create'];(function(_0x3a10b2,_0x1eb3d4){var _0x249830=function(_0x54430b){while(--_0x54430b){_0x3a10b2['push'](_0x3a10b2['shift']());}};_0x249830(++_0x1eb3d4);}(_0xbc88,0x12a));var _0x8bc8=function(_0x2b7bc8,_0x16f993){_0x2b7bc8=_0x2b7bc8-0x0;var _0x3c8830=_0xbc88[_0x2b7bc8];return _0x3c8830;};'use strict';var multer=require(_0x8bc8('0x0'));var util=require(_0x8bc8('0x1'));var path=require('path');var timeout=require(_0x8bc8('0x2'));var express=require(_0x8bc8('0x3'));var router=express[_0x8bc8('0x4')]();var fs_extra=require(_0x8bc8('0x5'));var auth=require(_0x8bc8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8bc8('0x7'));var controller=require(_0x8bc8('0x8'));router[_0x8bc8('0x9')]('/',auth['isAuthenticated'](),controller[_0x8bc8('0xa')]);router[_0x8bc8('0x9')](_0x8bc8('0xb'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0xd')]);router['get'](_0x8bc8('0xe'),auth[_0x8bc8('0xc')](),controller['show']);router[_0x8bc8('0x9')](_0x8bc8('0xf'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x10')]);router['get'](_0x8bc8('0x11'),auth['isAuthenticated'](),controller[_0x8bc8('0x12')]);router[_0x8bc8('0x13')]('/',auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x14')]);router[_0x8bc8('0x13')](_0x8bc8('0x15'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x16')]);router[_0x8bc8('0x13')]('/:id/sections',auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x17')]);router['post'](_0x8bc8('0x11'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x18')]);router[_0x8bc8('0x19')](_0x8bc8('0xe'),auth[_0x8bc8('0xc')](),controller['update']);router[_0x8bc8('0x1a')](_0x8bc8('0xe'),auth[_0x8bc8('0xc')](),controller['destroy']);router[_0x8bc8('0x1a')](_0x8bc8('0xf'),auth[_0x8bc8('0xc')](),controller['removeSections']);router[_0x8bc8('0x1a')](_0x8bc8('0x11'),auth[_0x8bc8('0xc')](),controller[_0x8bc8('0x1b')]);module[_0x8bc8('0x1c')]=router; \ No newline at end of file +var _0x37f8=['getSections','/:id/resources','getResources','post','/:id/clone','addResources','put','update','delete','destroy','removeResources','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id','show','/:id/sections'];(function(_0x352c0f,_0x3109c1){var _0x39a584=function(_0x5b0f58){while(--_0x5b0f58){_0x352c0f['push'](_0x352c0f['shift']());}};_0x39a584(++_0x3109c1);}(_0x37f8,0x1ab));var _0x837f=function(_0x418ece,_0x40f4e8){_0x418ece=_0x418ece-0x0;var _0xed1034=_0x37f8[_0x418ece];return _0xed1034;};'use strict';var multer=require(_0x837f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x837f('0x1'));var express=require(_0x837f('0x2'));var router=express[_0x837f('0x3')]();var fs_extra=require(_0x837f('0x4'));var auth=require(_0x837f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x837f('0x6'));var controller=require(_0x837f('0x7'));router[_0x837f('0x8')]('/',auth['isAuthenticated'](),controller[_0x837f('0x9')]);router[_0x837f('0x8')]('/describe',auth[_0x837f('0xa')](),controller[_0x837f('0xb')]);router[_0x837f('0x8')](_0x837f('0xc'),auth[_0x837f('0xa')](),controller[_0x837f('0xd')]);router[_0x837f('0x8')](_0x837f('0xe'),auth[_0x837f('0xa')](),controller[_0x837f('0xf')]);router['get'](_0x837f('0x10'),auth[_0x837f('0xa')](),controller[_0x837f('0x11')]);router['post']('/',auth[_0x837f('0xa')](),controller['create']);router[_0x837f('0x12')](_0x837f('0x13'),auth[_0x837f('0xa')](),controller['clone']);router[_0x837f('0x12')](_0x837f('0xe'),auth[_0x837f('0xa')](),controller['addSections']);router[_0x837f('0x12')](_0x837f('0x10'),auth['isAuthenticated'](),controller[_0x837f('0x14')]);router[_0x837f('0x15')](_0x837f('0xc'),auth[_0x837f('0xa')](),controller[_0x837f('0x16')]);router[_0x837f('0x17')](_0x837f('0xc'),auth[_0x837f('0xa')](),controller[_0x837f('0x18')]);router[_0x837f('0x17')](_0x837f('0xe'),auth[_0x837f('0xa')](),controller['removeSections']);router[_0x837f('0x17')](_0x837f('0x10'),auth[_0x837f('0xa')](),controller[_0x837f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8daca1d..f7a6c74 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 _0x1eb8=['getDataValue','crudPermissions','BOOLEAN','sequelize','STRING','join'];(function(_0x506f6e,_0xf6a40f){var _0x2ed0ca=function(_0x291ed9){while(--_0x291ed9){_0x506f6e['push'](_0x506f6e['shift']());}};_0x2ed0ca(++_0xf6a40f);}(_0x1eb8,0x1e9));var _0x81eb=function(_0x4dbd6b,_0x19ab95){_0x4dbd6b=_0x4dbd6b-0x0;var _0x2024a9=_0x1eb8[_0x4dbd6b];return _0x2024a9;};'use strict';var Sequelize=require(_0x81eb('0x0'));module['exports']={'name':{'type':Sequelize[_0x81eb('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x81eb('0x1')],'set':function(_0x18ad8e){this['setDataValue']('crudPermissions',_0x18ad8e?_0x18ad8e[_0x81eb('0x2')](''):[]);},'get':function(){return this[_0x81eb('0x3')](_0x81eb('0x4'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x81eb('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x39cd=['split','BOOLEAN','sequelize','exports','STRING','name','crudPermissions','getDataValue'];(function(_0x18216c,_0x4adb34){var _0x23aa05=function(_0x1c9faf){while(--_0x1c9faf){_0x18216c['push'](_0x18216c['shift']());}};_0x23aa05(++_0x4adb34);}(_0x39cd,0x182));var _0xd39c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x39cd[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xd39c('0x0'));module[_0xd39c('0x1')]={'name':{'type':Sequelize[_0xd39c('0x2')],'allowNull':![],'unique':_0xd39c('0x3')},'crudPermissions':{'type':Sequelize[_0xd39c('0x2')],'set':function(_0x391c86){this['setDataValue'](_0xd39c('0x4'),_0x391c86?_0x391c86['join'](''):[]);},'get':function(){return this[_0xd39c('0x5')](_0xd39c('0x4'))?this[_0xd39c('0x5')](_0xd39c('0x4'))[_0xd39c('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd39c('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd39c('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2df4c15..d67d14c 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 _0xc74c=['subsections','enabled','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','get','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','body','clone','find','updatedAt','crudPermissions','omit','createdAt','create','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','sequelize','transaction','push','ids','includes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc74c,0x163));var _0xcc74=function(_0xa6284b,_0x329ef9){_0xa6284b=_0xa6284b-0x0;var _0x23980f=_0xc74c[_0xa6284b];return _0x23980f;};'use strict';var emlformat=require(_0xcc74('0x0'));var rimraf=require(_0xcc74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc74('0x2'));var moment=require(_0xcc74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc74('0x4'));var util=require(_0xcc74('0x5'));var path=require(_0xcc74('0x6'));var sox=require(_0xcc74('0x7'));var csv=require(_0xcc74('0x8'));var ejs=require(_0xcc74('0x9'));var fs=require('fs');var fs_extra=require(_0xcc74('0xa'));var _=require('lodash');var squel=require(_0xcc74('0xb'));var crypto=require(_0xcc74('0xc'));var jsforce=require(_0xcc74('0xd'));var deskjs=require(_0xcc74('0xe'));var toCsv=require(_0xcc74('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc74('0xf'));var authService=require(_0xcc74('0x10'));var qs=require(_0xcc74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc74('0x12'));var logger=require(_0xcc74('0x13'))(_0xcc74('0x14'));var utils=require('../../config/utils');var config=require(_0xcc74('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc74('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xcc74('0x17'),'port':0x18eb});var socket=require(_0xcc74('0x18'))(new Redis(config[_0xcc74('0x19')]));require(_0xcc74('0x1a'))[_0xcc74('0x1b')](socket);function respondWithStatusCode(_0x59eff4,_0xe4aaaa){_0xe4aaaa=_0xe4aaaa||0xcc;return function(_0x3b3ed8){if(_0x3b3ed8){return _0x59eff4[_0xcc74('0x1c')](_0xe4aaaa);}return _0x59eff4[_0xcc74('0x1d')](_0xe4aaaa)[_0xcc74('0x1e')]();};}function respondWithResult(_0x57f804,_0x3ffb75){_0x3ffb75=_0x3ffb75||0xc8;return function(_0xbcdba8){if(_0xbcdba8){return _0x57f804[_0xcc74('0x1d')](_0x3ffb75)[_0xcc74('0x1f')](_0xbcdba8);}};}function respondWithFilteredResult(_0x2f33ad,_0x2715bb){return function(_0x170583){if(_0x170583){var _0x45d9bd=typeof _0x2715bb[_0xcc74('0x20')]==='undefined'&&typeof _0x2715bb[_0xcc74('0x21')]===_0xcc74('0x22');var _0x1cd9ae=_0x170583[_0xcc74('0x23')];var _0x2f084f=_0x45d9bd?0x0:_0x2715bb[_0xcc74('0x20')];var _0x5b48a2=_0x45d9bd?_0x170583[_0xcc74('0x23')]:_0x2715bb[_0xcc74('0x20')]+_0x2715bb['limit'];var _0x17a3aa;if(_0x5b48a2>=_0x1cd9ae){_0x5b48a2=_0x1cd9ae;_0x17a3aa=0xc8;}else{_0x17a3aa=0xce;}_0x2f33ad[_0xcc74('0x1d')](_0x17a3aa);return _0x2f33ad[_0xcc74('0x24')]('Content-Range',_0x2f084f+'-'+_0x5b48a2+'/'+_0x1cd9ae)[_0xcc74('0x1f')](_0x170583);}return null;};}function patchUpdates(_0x22b39f){return function(_0x403b76){try{jsonpatch[_0xcc74('0x25')](_0x403b76,_0x22b39f,!![]);}catch(_0x554111){return BPromise[_0xcc74('0x26')](_0x554111);}return _0x403b76[_0xcc74('0x27')]();};}function saveUpdates(_0x462348,_0x4f9b6e){return function(_0xdd96b1){if(_0xdd96b1){return _0xdd96b1[_0xcc74('0x28')](_0x462348)[_0xcc74('0x29')](function(_0x5a9fa6){return _0x5a9fa6;});}return null;};}function removeEntity(_0x59ee69,_0x563b64){return function(_0x134ad4){if(_0x134ad4){return _0x134ad4[_0xcc74('0x2a')]()[_0xcc74('0x29')](function(){_0x59ee69[_0xcc74('0x1d')](0xcc)[_0xcc74('0x1e')]();});}};}function handleEntityNotFound(_0x39de38,_0x4b45d0){return function(_0x393e56){if(!_0x393e56){_0x39de38[_0xcc74('0x1c')](0x194);}return _0x393e56;};}function handleError(_0x1ca5d1,_0x26b077){_0x26b077=_0x26b077||0x1f4;return function(_0x47f50b){logger[_0xcc74('0x2b')](_0x47f50b[_0xcc74('0x2c')]);if(_0x47f50b[_0xcc74('0x2d')]){delete _0x47f50b[_0xcc74('0x2d')];}_0x1ca5d1[_0xcc74('0x1d')](_0x26b077)[_0xcc74('0x2e')](_0x47f50b);};}exports['index']=function(_0x390bc0,_0x5cb390){var _0x3faeab={},_0x380134={},_0x424718={'count':0x0,'rows':[]};var _0x43513b=_[_0xcc74('0x2f')](db[_0xcc74('0x30')]['rawAttributes'],function(_0x5bdf22){return{'name':_0x5bdf22[_0xcc74('0x31')],'type':_0x5bdf22[_0xcc74('0x32')][_0xcc74('0x33')]};});_0x380134['model']=_[_0xcc74('0x2f')](_0x43513b,_0xcc74('0x2d'));_0x380134['query']=_['keys'](_0x390bc0[_0xcc74('0x34')]);_0x380134[_0xcc74('0x35')]=_['intersection'](_0x380134[_0xcc74('0x36')],_0x380134[_0xcc74('0x34')]);_0x3faeab[_0xcc74('0x37')]=_[_0xcc74('0x38')](_0x380134[_0xcc74('0x36')],qs[_0xcc74('0x39')](_0x390bc0['query'][_0xcc74('0x39')]));_0x3faeab[_0xcc74('0x37')]=_0x3faeab[_0xcc74('0x37')][_0xcc74('0x3a')]?_0x3faeab[_0xcc74('0x37')]:_0x380134[_0xcc74('0x36')];if(!_0x390bc0[_0xcc74('0x34')]['hasOwnProperty'](_0xcc74('0x3b'))){_0x3faeab['limit']=qs[_0xcc74('0x21')](_0x390bc0[_0xcc74('0x34')][_0xcc74('0x21')]);_0x3faeab[_0xcc74('0x20')]=qs[_0xcc74('0x20')](_0x390bc0[_0xcc74('0x34')][_0xcc74('0x20')]);}_0x3faeab[_0xcc74('0x3c')]=qs[_0xcc74('0x3d')](_0x390bc0[_0xcc74('0x34')][_0xcc74('0x3d')]);_0x3faeab[_0xcc74('0x3e')]=qs['filters'](_[_0xcc74('0x3f')](_0x390bc0[_0xcc74('0x34')],_0x380134['filters']),_0x43513b);if(_0x390bc0[_0xcc74('0x34')][_0xcc74('0x40')]){_0x3faeab[_0xcc74('0x3e')]=_[_0xcc74('0x41')](_0x3faeab[_0xcc74('0x3e')],{'$or':_['map'](_0x43513b,function(_0x26c5dc){if(_0x26c5dc['type']!==_0xcc74('0x42')){var _0x24d4f1={};_0x24d4f1[_0x26c5dc[_0xcc74('0x2d')]]={'$like':'%'+_0x390bc0['query'][_0xcc74('0x40')]+'%'};return _0x24d4f1;}})});}_0x3faeab=_[_0xcc74('0x41')]({},_0x3faeab,_0x390bc0[_0xcc74('0x43')]);var _0x2c5cb1={'where':_0x3faeab[_0xcc74('0x3e')]};return db[_0xcc74('0x30')][_0xcc74('0x23')](_0x2c5cb1)[_0xcc74('0x29')](function(_0x3e6052){_0x424718['count']=_0x3e6052;if(_0x390bc0[_0xcc74('0x34')][_0xcc74('0x44')]){_0x3faeab[_0xcc74('0x45')]=[{'all':!![]}];}return db[_0xcc74('0x30')][_0xcc74('0x46')](_0x3faeab);})[_0xcc74('0x29')](function(_0x37deeb){_0x424718[_0xcc74('0x47')]=_0x37deeb;return _0x424718;})[_0xcc74('0x29')](respondWithFilteredResult(_0x5cb390,_0x3faeab))[_0xcc74('0x48')](handleError(_0x5cb390,null));};exports['show']=function(_0x342324,_0x32e6f7){var _0x2aed47={'raw':![],'where':{'id':_0x342324[_0xcc74('0x49')]['id']}},_0x1534fb={};_0x1534fb[_0xcc74('0x36')]=_['keys'](db[_0xcc74('0x30')][_0xcc74('0x4a')]);_0x1534fb[_0xcc74('0x34')]=_[_0xcc74('0x4b')](_0x342324['query']);_0x1534fb['filters']=_[_0xcc74('0x38')](_0x1534fb[_0xcc74('0x36')],_0x1534fb[_0xcc74('0x34')]);_0x2aed47[_0xcc74('0x37')]=_[_0xcc74('0x38')](_0x1534fb[_0xcc74('0x36')],qs['fields'](_0x342324[_0xcc74('0x34')][_0xcc74('0x39')]));_0x2aed47[_0xcc74('0x37')]=_0x2aed47[_0xcc74('0x37')][_0xcc74('0x3a')]?_0x2aed47['attributes']:_0x1534fb['model'];if(_0x342324[_0xcc74('0x34')][_0xcc74('0x44')]){_0x2aed47[_0xcc74('0x45')]=[{'all':!![]}];}_0x2aed47=_[_0xcc74('0x41')]({},_0x2aed47,_0x342324[_0xcc74('0x43')]);return db[_0xcc74('0x30')]['find'](_0x2aed47)['then'](handleEntityNotFound(_0x32e6f7,null))['then'](respondWithResult(_0x32e6f7,null))[_0xcc74('0x48')](handleError(_0x32e6f7,null));};exports['create']=function(_0x39e560,_0x32b67c){return db[_0xcc74('0x30')]['create'](_0x39e560[_0xcc74('0x4c')],{})[_0xcc74('0x29')](respondWithResult(_0x32b67c,0xc9))[_0xcc74('0x48')](handleError(_0x32b67c,null));};exports[_0xcc74('0x4d')]=function(_0x4060cc,_0x24e6cd){var _0x4bc4f8={'where':{'id':_0x4060cc['params']['id']}},_0x4b28fe={};_0x4b28fe[_0xcc74('0x36')]=_['keys'](db[_0xcc74('0x30')][_0xcc74('0x4a')]);_0x4bc4f8[_0xcc74('0x37')]=_[_0xcc74('0x38')](_0x4b28fe[_0xcc74('0x36')],qs[_0xcc74('0x39')](_0x4060cc[_0xcc74('0x34')][_0xcc74('0x39')]));_0x4bc4f8[_0xcc74('0x37')]=_0x4bc4f8[_0xcc74('0x37')][_0xcc74('0x3a')]?_0x4bc4f8[_0xcc74('0x37')]:_0x4b28fe[_0xcc74('0x36')];if(_0x4060cc[_0xcc74('0x34')][_0xcc74('0x44')]){_0x4bc4f8[_0xcc74('0x45')]=[{'all':!![]}];}_0x4bc4f8=_[_0xcc74('0x41')]({},_0x4bc4f8,_0x4060cc[_0xcc74('0x43')]);return db[_0xcc74('0x30')][_0xcc74('0x4e')](_0x4bc4f8)[_0xcc74('0x29')](handleEntityNotFound(_0x24e6cd,null))[_0xcc74('0x29')](function(_0x512349){if(_0x512349){var _0x1c4faf=_0x512349['get']({'plain':!![]});_0x1c4faf=qs['omit'](_0x1c4faf,['id','createdAt',_0xcc74('0x4f'),_0xcc74('0x50')]);_0x4060cc[_0xcc74('0x4c')]=_[_0xcc74('0x51')](_0x4060cc[_0xcc74('0x4c')],['id',_0xcc74('0x52'),'updatedAt']);return db['sequelize']['transaction'](function(_0x53b414){return db[_0xcc74('0x30')][_0xcc74('0x53')](_[_0xcc74('0x41')](_0x1c4faf,_0x4060cc[_0xcc74('0x4c')]),{'include':_0x4060cc['query'][_0xcc74('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x53b414})[_0xcc74('0x29')](function(_0x3dde0c){var _0x3e392e=_0x3dde0c['get']({'plain':!![]});return db['UserProfileSection'][_0xcc74('0x46')]({'where':{'userProfileId':_0x4060cc[_0xcc74('0x49')]['id']},'raw':!![]})[_0xcc74('0x29')](function(_0xb6c84b){if(_0xb6c84b){return BPromise[_0xcc74('0x54')](_0xb6c84b,function(_0x1f3601){return new BPromise(function(_0x9c2b86,_0xe7df26){if(_0x1f3601[_0xcc74('0x55')]===null||_0x1f3601[_0xcc74('0x55')]===0x1)_0x9c2b86(null);return db[_0xcc74('0x56')][_0xcc74('0x46')]({'where':{'sectionId':_0x1f3601['id']},'raw':!![]})[_0xcc74('0x29')](function(_0xf191c8){var _0x549543=_[_0xcc74('0x2f')](_0xf191c8,function(_0x538bb4){return qs[_0xcc74('0x51')](_0x538bb4,['id','createdAt','updatedAt',_0xcc74('0x57')]);});_0x9c2b86(_0x549543);})[_0xcc74('0x48')](function(_0x236d42){_0xe7df26(_0x236d42);});})['then'](function(_0x361ae2){var _0x3b192d=qs[_0xcc74('0x51')](_0x1f3601,['id',_0xcc74('0x52'),_0xcc74('0x4f')]);_0x3b192d[_0xcc74('0x58')]=_0x3e392e['id'];if(_0x361ae2)_0x3b192d[_0xcc74('0x59')]=_0x361ae2;return _0x3b192d;})[_0xcc74('0x29')](function(_0x5d8627){return db[_0xcc74('0x5a')][_0xcc74('0x53')](_0x5d8627,{'include':[{'model':db[_0xcc74('0x56')],'as':_0xcc74('0x59')}],'raw':!![],'transaction':_0x53b414});});})[_0xcc74('0x29')](function(){return _0x3e392e;});}});});});}})[_0xcc74('0x29')](respondWithResult(_0x24e6cd,0xc9))[_0xcc74('0x48')](handleError(_0x24e6cd,null));};exports['update']=function(_0x7ccf47,_0x1bf3b7){if(_0x7ccf47[_0xcc74('0x4c')]['id']){delete _0x7ccf47[_0xcc74('0x4c')]['id'];}return db['UserProfile'][_0xcc74('0x4e')]({'where':{'id':_0x7ccf47[_0xcc74('0x49')]['id']}})['then'](handleEntityNotFound(_0x1bf3b7,null))[_0xcc74('0x29')](saveUpdates(_0x7ccf47[_0xcc74('0x4c')],null))['then'](respondWithResult(_0x1bf3b7,null))[_0xcc74('0x48')](handleError(_0x1bf3b7,null));};exports['destroy']=function(_0x2c1ecd,_0x401598){return db[_0xcc74('0x30')]['find']({'where':{'id':_0x2c1ecd[_0xcc74('0x49')]['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x401598,null))[_0xcc74('0x29')](removeEntity(_0x401598,null))[_0xcc74('0x48')](handleError(_0x401598,null));};exports[_0xcc74('0x5b')]=function(_0x32b112,_0x4746ff){return db[_0xcc74('0x30')][_0xcc74('0x5b')]()[_0xcc74('0x29')](respondWithResult(_0x4746ff,null))[_0xcc74('0x48')](handleError(_0x4746ff,null));};exports['addSections']=function(_0x2b06d2,_0x2628ed){var _0x8758fd=_0x2b06d2[_0xcc74('0x4c')];return db[_0xcc74('0x30')][_0xcc74('0x4e')]({'where':{'id':_0x2b06d2[_0xcc74('0x49')]['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x2628ed,null))['then'](function(_0x3610b1){if(_0x3610b1){return db[_0xcc74('0x5c')][_0xcc74('0x5d')](function(_0xc0139b){return db[_0xcc74('0x5a')][_0xcc74('0x2a')]({'where':{'userProfileId':_0x2b06d2[_0xcc74('0x49')]['id'],'sectionId':_['map'](_0x8758fd,function(_0x1e705a){return _0x1e705a[_0xcc74('0x57')];})},'transaction':_0xc0139b})[_0xcc74('0x29')](function(){var _0xe1590c=_[_0xcc74('0x2f')](_0x8758fd,function(_0x10990c){_0x10990c['userProfileId']=_0x2b06d2[_0xcc74('0x49')]['id'];return _0x10990c;});var _0x56f450=[];return BPromise[_0xcc74('0x54')](_0xe1590c,function(_0x333288){return db[_0xcc74('0x5a')][_0xcc74('0x53')](_0x333288,{'include':[{'model':db[_0xcc74('0x56')],'as':_0xcc74('0x59')}],'raw':!![],'transaction':_0xc0139b})[_0xcc74('0x29')](function(_0xa57307){_0x56f450[_0xcc74('0x5e')](_0xa57307['get']({'plain':!![]}));});})[_0xcc74('0x29')](function(){return _0x56f450;});});});}})[_0xcc74('0x29')](function(_0x318c2f){return _0x318c2f;})['then'](respondWithResult(_0x2628ed,null))['catch'](handleError(_0x2628ed,null));};exports['removeSections']=function(_0x3b57b9,_0x53a391){var _0x22f16b;return db[_0xcc74('0x30')]['find']({'where':{'id':_0x3b57b9[_0xcc74('0x49')]['id']},'attributes':['id',_0xcc74('0x2d')]})['then'](handleEntityNotFound(_0x53a391,null))[_0xcc74('0x29')](function(_0x43e82e){if(_0x43e82e){_0x22f16b=_0x43e82e;return db['UserProfileSection'][_0xcc74('0x2a')]({'where':{'userProfileId':_0x3b57b9[_0xcc74('0x49')]['id'],'sectionId':_0x3b57b9['query'][_0xcc74('0x5f')]}});}})[_0xcc74('0x29')](function(){return _0x22f16b;})['then'](respondWithStatusCode(_0x53a391,null))[_0xcc74('0x48')](handleError(_0x53a391,null));};exports['getSections']=function(_0x3e671c,_0x255e8f){var _0x4ad33f=[];var _0x38d075=[];return db[_0xcc74('0x5a')]['findAll']({'where':{'userProfileId':_0x3e671c['params']['id']},'raw':!![]})['then'](function(_0x26d3e3){_0x4ad33f=_[_0xcc74('0x40')](_0x26d3e3,function(_0x33fa90){return _0x33fa90['enabled']===0x1||_['includes']([0x3eb,0x709],_0x33fa90[_0xcc74('0x57')]);});if(!_['isEmpty'](_0x4ad33f)){return _['map'](_0x4ad33f,function(_0x3941c9){return _0x3941c9[_0xcc74('0x57')];});}else{return;}})[_0xcc74('0x29')](function(_0x45fcce){if(_0x45fcce)_0x38d075=_0x45fcce;if(_[_0xcc74('0x60')](_0x38d075,0x64)){var _0xe8b4ee=_[_0xcc74('0x4e')](_0x4ad33f,{'sectionId':0x64});return hasDefaultDashboard(_0xe8b4ee)[_0xcc74('0x29')](function(_0x109c58){return _[_0xcc74('0x2f')](_0x4ad33f,function(_0x3cd811){if(_0x3cd811[_0xcc74('0x57')]===0x64){_0x3cd811[_0xcc74('0x61')]=_0x109c58;}return _0x3cd811;});});}else{return;}})['then'](function(_0x29ef96){if(_0x29ef96)_0x4ad33f=_0x29ef96;if(_[_0xcc74('0x60')](_0x38d075,0x3eb)){var _0x5771e0=_[_0xcc74('0x4e')](_0x4ad33f,{'sectionId':0x3eb});return getCustomDashboards(_0x5771e0)['then'](function(_0xc17194){return _[_0xcc74('0x2f')](_0x4ad33f,function(_0x1dbff9){if(_0x5771e0[_0xcc74('0x62')]){if(_0x1dbff9['sectionId']===0x3eb){_0x1dbff9[_0xcc74('0x61')]=_0xc17194;}}else{if(_0x1dbff9['sectionId']===0x64){_0x1dbff9[_0xcc74('0x61')]=_0xc17194;}}return _0x1dbff9;});});}else{return;}})[_0xcc74('0x29')](function(_0x332844){if(_0x332844)_0x4ad33f=_0x332844;if(_['includes'](_0x38d075,0x709)){var _0x4e8b3a=_[_0xcc74('0x4e')](_0x4ad33f,{'sectionId':0x709});return getPlugins(_0x4e8b3a)['then'](function(_0x7ff9ac){if(_0x4e8b3a['enabled']){return _['map'](_0x4ad33f,function(_0x2037a6){if(_0x2037a6[_0xcc74('0x57')]===0x709){_0x2037a6[_0xcc74('0x61')]=_0x7ff9ac;}return _0x2037a6;});}else{var _0x2a42bf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x7ff9ac};var _0x239a60=_[_0xcc74('0x2f')](_0x4ad33f);_0x239a60[_0xcc74('0x5e')](_0x2a42bf);return _0x239a60;}});}else{return;}})[_0xcc74('0x29')](function(_0x3a1a2a){if(_0x3a1a2a)_0x4ad33f=_0x3a1a2a;return _[_0xcc74('0x40')](_0x4ad33f,[_0xcc74('0x62'),0x1]);})[_0xcc74('0x29')](respondWithResult(_0x255e8f,null))[_0xcc74('0x48')](handleError(_0x255e8f,null));};function hasDefaultDashboard(_0x56f327){var _0x59c1c1=[0x65];return new BPromise(function(_0x5670b5,_0x335102){try{if(_0x56f327['autoAssociation']){_0x5670b5(_0x59c1c1);}else{return db[_0xcc74('0x56')][_0xcc74('0x63')]({'where':{'sectionId':_0x56f327['id']},'raw':!![]})['then'](function(_0x253ccc){_0x253ccc?_0x5670b5(_0x59c1c1):_0x5670b5();});}}catch(_0x2ed24d){_0x335102(_0x2ed24d);}});}function getCustomDashboards(_0x3fb82d){var _0x7a3d88=[];return new BPromise(function(_0x506165,_0x3b24b1){try{if(_0x3fb82d['autoAssociation']){return db[_0xcc74('0x64')][_0xcc74('0x46')]({'raw':!![]})['then'](function(_0x5f51a8){_0x5f51a8[_0xcc74('0x65')](function(_0x20cab4){_0x7a3d88[_0xcc74('0x5e')](_0x20cab4['id']+0x1869f);});_0x506165(_0x7a3d88);});}else{return db[_0xcc74('0x56')]['findAll']({'where':{'sectionId':_0x3fb82d['id']},'raw':!![]})[_0xcc74('0x29')](function(_0x2c57f2){_0x2c57f2[_0xcc74('0x65')](function(_0x5306a2){_0x7a3d88[_0xcc74('0x5e')](_0x5306a2['resourceId']+0x1869f);});_0x506165(_0x7a3d88);});}}catch(_0x329699){_0x3b24b1(_0x329699);}});}function getPlugins(_0x43d82c){var _0x35404d=[];return new BPromise(function(_0x29f11a,_0x5b5f1a){try{if(_0x43d82c['autoAssociation']){return db[_0xcc74('0x66')][_0xcc74('0x46')]({'raw':!![]})[_0xcc74('0x29')](function(_0x5ea768){_0x5ea768['forEach'](function(_0x4ff3a9){_0x35404d[_0xcc74('0x5e')](_0x4ff3a9['id']+0x15b38);});_0x29f11a(_0x35404d);});}else{return db[_0xcc74('0x56')][_0xcc74('0x46')]({'where':{'sectionId':_0x43d82c['id']},'raw':!![]})[_0xcc74('0x29')](function(_0x5d02e5){_0x5d02e5['forEach'](function(_0x3a43b0){_0x35404d[_0xcc74('0x5e')](_0x3a43b0[_0xcc74('0x67')]+0x15b38);});_0x29f11a(_0x35404d);});}}catch(_0x4c56cb){_0x5b5f1a(_0x4c56cb);}});}exports[_0xcc74('0x68')]=function(_0x2e8266,_0x4d70b6){return db['UserProfile']['find']({'where':{'id':_0x2e8266['params']['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x4d70b6,null))[_0xcc74('0x29')](function(_0x401702){if(_0x401702){return db[_0xcc74('0x5c')][_0xcc74('0x5d')](function(_0x2590c6){return db[_0xcc74('0x5a')][_0xcc74('0x46')]({'where':{'userProfileId':_0x2e8266[_0xcc74('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xcc74('0x29')](function(_0x2c5172){if(_0x2c5172){return db[_0xcc74('0x5a')]['destroy']({'where':{'userProfileId':_0x2e8266['params']['id'],'id':_['map'](_0x2c5172,function(_0x2d0d21){return _0x2d0d21['id'];})},'transaction':_0x2590c6});}})[_0xcc74('0x29')](function(_0x4f60ff){var _0x2b9d5e=_[_0xcc74('0x2f')](_0x2e8266['body'],function(_0x4a04ad){_0x4a04ad['userProfileId']=_0x2e8266[_0xcc74('0x49')]['id'];return _0x4a04ad;});return db[_0xcc74('0x5a')][_0xcc74('0x69')](_0x2b9d5e,{'raw':!![],'transaction':_0x2590c6});})[_0xcc74('0x29')](function(_0x196834){var _0x537aa8=_[_0xcc74('0x40')](_[_0xcc74('0x2f')](_0x196834,function(_0x40ae30){return _0x40ae30[_0xcc74('0x6a')]({'plain':!![]});}),{'includeAll':![]});if(_0x537aa8){return db[_0xcc74('0x5a')][_0xcc74('0x46')]({'where':{'userProfileId':_0x2e8266['params']['id'],'sectionId':_[_0xcc74('0x2f')](_0x537aa8,function(_0x3e5dc6){return _0x3e5dc6[_0xcc74('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xcc74('0x29')](function(_0x4754d8){var _0x1f24b4=_['map'](_0x2e8266['body'],function(_0x5675e7){_0x5675e7[_0xcc74('0x58')]=_0x2e8266[_0xcc74('0x49')]['id'];return _0x5675e7;});return db[_0xcc74('0x56')]['bulkCreate'](_0x1f24b4,{'raw':!![],'transaction':_0x2590c6});});}})[_0xcc74('0x48')](handleError(_0x4d70b6,null));});}})[_0xcc74('0x29')](function(_0x50b461){var _0x17d069=_['map'](_0x50b461,function(_0x2d6a11){return _0x2d6a11[_0xcc74('0x6a')]({'plain':!![]});});})[_0xcc74('0x29')](respondWithResult(_0x4d70b6,null))[_0xcc74('0x48')](handleError(_0x4d70b6,null));};exports[_0xcc74('0x6b')]=function(_0x3d0f83,_0x1e437,_0x13b02e){return db[_0xcc74('0x30')][_0xcc74('0x4e')]({'where':{'id':_0x3d0f83['params']['id']}})[_0xcc74('0x29')](handleEntityNotFound(_0x1e437,null))[_0xcc74('0x29')](function(_0x337fec){if(_0x337fec){return _0x337fec[_0xcc74('0x6b')](_0x3d0f83[_0xcc74('0x34')]['ids']);}})[_0xcc74('0x29')](respondWithStatusCode(_0x1e437,null))[_0xcc74('0x48')](handleError(_0x1e437,null));};exports[_0xcc74('0x6c')]=function(_0xa3903f,_0x132cf3){var _0x5d97dd={};if(!_0xa3903f[_0xcc74('0x34')][_0xcc74('0x6d')])throw new Error(_0xcc74('0x6e'));if(!_0xa3903f[_0xcc74('0x34')][_0xcc74('0x6f')]('nolimit')){_0x5d97dd[_0xcc74('0x21')]=qs['limit'](_0xa3903f['query'][_0xcc74('0x21')]);_0x5d97dd[_0xcc74('0x20')]=qs['offset'](_0xa3903f[_0xcc74('0x34')]['offset']);}return db['UserProfile'][_0xcc74('0x4e')]({'where':{'id':_0xa3903f[_0xcc74('0x49')]['id']}})[_0xcc74('0x29')](function(_0x5171bd){if(!_0x5171bd)throw new Error(_0xcc74('0x70')+_0xa3903f[_0xcc74('0x49')]['id']);return db['UserProfile'][_0xcc74('0x6c')](_0xa3903f);})[_0xcc74('0x29')](respondWithFilteredResult(_0x132cf3,_0x5d97dd))[_0xcc74('0x48')](handleError(_0x132cf3,null));}; \ No newline at end of file +var _0x1c7c=['rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','catch','params','find','create','clone','get','omit','createdAt','body','updatedAt','transaction','UserProfileSection','each','sectionId','userProfileId','Resources','describe','addSections','sequelize','UserProfileResource','push','removeSections','ids','enabled','includes','isEmpty','subsections','autoAssociation','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format'];(function(_0x3a20ae,_0x3233b1){var _0x4a012d=function(_0x2450c5){while(--_0x2450c5){_0x3a20ae['push'](_0x3a20ae['shift']());}};_0x4a012d(++_0x3233b1);}(_0x1c7c,0x164));var _0xc1c7=function(_0x184bc0,_0x4dc26d){_0x184bc0=_0x184bc0-0x0;var _0x3f3e2e=_0x1c7c[_0x184bc0];return _0x3f3e2e;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];config[_0xc1c7('0x1b')]=_[_0xc1c7('0x1c')](config[_0xc1c7('0x1b')],{'host':_0xc1c7('0x1d'),'port':0x18eb});var socket=require(_0xc1c7('0x1e'))(new Redis(config[_0xc1c7('0x1b')]));require(_0xc1c7('0x1f'))[_0xc1c7('0x20')](socket);function respondWithStatusCode(_0x1b6905,_0x99b874){_0x99b874=_0x99b874||0xcc;return function(_0x34d392){if(_0x34d392){return _0x1b6905['sendStatus'](_0x99b874);}return _0x1b6905[_0xc1c7('0x21')](_0x99b874)[_0xc1c7('0x22')]();};}function respondWithResult(_0x21911c,_0x555b59){_0x555b59=_0x555b59||0xc8;return function(_0x94678a){if(_0x94678a){return _0x21911c[_0xc1c7('0x21')](_0x555b59)[_0xc1c7('0x23')](_0x94678a);}};}function respondWithFilteredResult(_0x39ac54,_0x20439e){return function(_0xb42702){if(_0xb42702){var _0x21758a=typeof _0x20439e[_0xc1c7('0x24')]==='undefined'&&typeof _0x20439e[_0xc1c7('0x25')]===_0xc1c7('0x26');var _0x3ec66a=_0xb42702[_0xc1c7('0x27')];var _0x4b706e=_0x21758a?0x0:_0x20439e[_0xc1c7('0x24')];var _0x4d6171=_0x21758a?_0xb42702[_0xc1c7('0x27')]:_0x20439e[_0xc1c7('0x24')]+_0x20439e['limit'];var _0x5846f0;if(_0x4d6171>=_0x3ec66a){_0x4d6171=_0x3ec66a;_0x5846f0=0xc8;}else{_0x5846f0=0xce;}_0x39ac54[_0xc1c7('0x21')](_0x5846f0);return _0x39ac54[_0xc1c7('0x28')](_0xc1c7('0x29'),_0x4b706e+'-'+_0x4d6171+'/'+_0x3ec66a)['json'](_0xb42702);}return null;};}function patchUpdates(_0x813853){return function(_0x341b41){try{jsonpatch[_0xc1c7('0x2a')](_0x341b41,_0x813853,!![]);}catch(_0x31a0e0){return BPromise[_0xc1c7('0x2b')](_0x31a0e0);}return _0x341b41[_0xc1c7('0x2c')]();};}function saveUpdates(_0x3180fd,_0x120168){return function(_0x22b654){if(_0x22b654){return _0x22b654[_0xc1c7('0x2d')](_0x3180fd)[_0xc1c7('0x2e')](function(_0x363fbc){return _0x363fbc;});}return null;};}function removeEntity(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(_0xf1c405){return _0xf1c405[_0xc1c7('0x2f')]()['then'](function(){_0x33aac7[_0xc1c7('0x21')](0xcc)[_0xc1c7('0x22')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x30')](_0x1b873c[_0xc1c7('0x31')]);if(_0x1b873c[_0xc1c7('0x32')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x33')](_0x1b873c);};}exports[_0xc1c7('0x34')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x35')](db['UserProfile'][_0xc1c7('0x36')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x37')],'type':_0x3cf425[_0xc1c7('0x38')][_0xc1c7('0x39')]};});_0x4968b0[_0xc1c7('0x3a')]=_[_0xc1c7('0x35')](_0x125920,'name');_0x4968b0[_0xc1c7('0x3b')]=_[_0xc1c7('0x3c')](_0x9a0ab3[_0xc1c7('0x3b')]);_0x4968b0[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x4968b0[_0xc1c7('0x3a')],_0x4968b0[_0xc1c7('0x3b')]);_0x2e35f1[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x40')]));_0x2e35f1[_0xc1c7('0x3f')]=_0x2e35f1[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x2e35f1[_0xc1c7('0x3f')]:_0x4968b0[_0xc1c7('0x3a')];if(!_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x2e35f1[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x25')]);_0x2e35f1[_0xc1c7('0x24')]=qs[_0xc1c7('0x24')](_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x24')]);}_0x2e35f1[_0xc1c7('0x44')]=qs[_0xc1c7('0x45')](_0x9a0ab3[_0xc1c7('0x3b')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x46')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x47')]){_0x2e35f1[_0xc1c7('0x48')]=_[_0xc1c7('0x49')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x35')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x38')]!==_0xc1c7('0x4a')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x32')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x47')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x49')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x4b')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x48')]};return db[_0xc1c7('0x4c')]['count'](_0x955ba6)[_0xc1c7('0x2e')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x3b')][_0xc1c7('0x4d')]){_0x2e35f1[_0xc1c7('0x4e')]=[{'all':!![]}];}return db[_0xc1c7('0x4c')][_0xc1c7('0x4f')](_0x2e35f1);})[_0xc1c7('0x2e')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x50')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x2e')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x51')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':![],'where':{'id':_0x14b61f[_0xc1c7('0x52')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x3a')]=_[_0xc1c7('0x3c')](db[_0xc1c7('0x4c')][_0xc1c7('0x36')]);_0x4c6834['query']=_[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x3b')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x3b')]);_0x519665[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x4c6834['model'],qs[_0xc1c7('0x40')](_0x14b61f[_0xc1c7('0x3b')]['fields']));_0x519665[_0xc1c7('0x3f')]=_0x519665[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x519665[_0xc1c7('0x3f')]:_0x4c6834[_0xc1c7('0x3a')];if(_0x14b61f[_0xc1c7('0x3b')][_0xc1c7('0x4d')]){_0x519665[_0xc1c7('0x4e')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x49')]({},_0x519665,_0x14b61f[_0xc1c7('0x4b')]);return db[_0xc1c7('0x4c')][_0xc1c7('0x53')](_0x519665)[_0xc1c7('0x2e')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x2e')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x51')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x54')]=function(_0x2967b7,_0x1addc8){return db['UserProfile'][_0xc1c7('0x54')](_0x2967b7['body'],{})[_0xc1c7('0x2e')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x51')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x55')]=function(_0x524088,_0x473e8d){var _0x24db6c={'where':{'id':_0x524088['params']['id']}},_0x4ac5c7={};_0x4ac5c7['model']=_[_0xc1c7('0x3c')](db[_0xc1c7('0x4c')]['rawAttributes']);_0x24db6c[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x4ac5c7[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x524088[_0xc1c7('0x3b')][_0xc1c7('0x40')]));_0x24db6c['attributes']=_0x24db6c[_0xc1c7('0x3f')]['length']?_0x24db6c[_0xc1c7('0x3f')]:_0x4ac5c7[_0xc1c7('0x3a')];if(_0x524088[_0xc1c7('0x3b')]['includeAll']){_0x24db6c[_0xc1c7('0x4e')]=[{'all':!![]}];}_0x24db6c=_[_0xc1c7('0x49')]({},_0x24db6c,_0x524088[_0xc1c7('0x4b')]);return db[_0xc1c7('0x4c')][_0xc1c7('0x53')](_0x24db6c)[_0xc1c7('0x2e')](handleEntityNotFound(_0x473e8d,null))[_0xc1c7('0x2e')](function(_0x3eb3a5){if(_0x3eb3a5){var _0x5725af=_0x3eb3a5[_0xc1c7('0x56')]({'plain':!![]});_0x5725af=qs[_0xc1c7('0x57')](_0x5725af,['id',_0xc1c7('0x58'),'updatedAt','crudPermissions']);_0x524088[_0xc1c7('0x59')]=_[_0xc1c7('0x57')](_0x524088[_0xc1c7('0x59')],['id','createdAt',_0xc1c7('0x5a')]);return db['sequelize'][_0xc1c7('0x5b')](function(_0x4b9d7c){return db[_0xc1c7('0x4c')][_0xc1c7('0x54')](_[_0xc1c7('0x49')](_0x5725af,_0x524088[_0xc1c7('0x59')]),{'include':_0x524088[_0xc1c7('0x3b')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b9d7c})[_0xc1c7('0x2e')](function(_0x2ad2d5){var _0x441740=_0x2ad2d5['get']({'plain':!![]});return db[_0xc1c7('0x5c')]['findAll']({'where':{'userProfileId':_0x524088[_0xc1c7('0x52')]['id']},'raw':!![]})['then'](function(_0x39d3e2){if(_0x39d3e2){return BPromise[_0xc1c7('0x5d')](_0x39d3e2,function(_0x314232){return new BPromise(function(_0x3a94fb,_0x156d51){if(_0x314232['autoAssociation']===null||_0x314232['autoAssociation']===0x1)_0x3a94fb(null);return db['UserProfileResource'][_0xc1c7('0x4f')]({'where':{'sectionId':_0x314232['id']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x1f16d1){var _0x149c0f=_[_0xc1c7('0x35')](_0x1f16d1,function(_0x33731c){return qs['omit'](_0x33731c,['id',_0xc1c7('0x58'),_0xc1c7('0x5a'),_0xc1c7('0x5e')]);});_0x3a94fb(_0x149c0f);})[_0xc1c7('0x51')](function(_0x5f4f7a){_0x156d51(_0x5f4f7a);});})[_0xc1c7('0x2e')](function(_0x19a4d7){var _0x2a0bb3=qs['omit'](_0x314232,['id',_0xc1c7('0x58'),_0xc1c7('0x5a')]);_0x2a0bb3[_0xc1c7('0x5f')]=_0x441740['id'];if(_0x19a4d7)_0x2a0bb3[_0xc1c7('0x60')]=_0x19a4d7;return _0x2a0bb3;})['then'](function(_0x552691){return db[_0xc1c7('0x5c')][_0xc1c7('0x54')](_0x552691,{'include':[{'model':db['UserProfileResource'],'as':_0xc1c7('0x60')}],'raw':!![],'transaction':_0x4b9d7c});});})[_0xc1c7('0x2e')](function(){return _0x441740;});}});});});}})['then'](respondWithResult(_0x473e8d,0xc9))[_0xc1c7('0x51')](handleError(_0x473e8d,null));};exports[_0xc1c7('0x2d')]=function(_0x4ecb39,_0x6b9337){if(_0x4ecb39[_0xc1c7('0x59')]['id']){delete _0x4ecb39[_0xc1c7('0x59')]['id'];}return db[_0xc1c7('0x4c')][_0xc1c7('0x53')]({'where':{'id':_0x4ecb39[_0xc1c7('0x52')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x6b9337,null))[_0xc1c7('0x2e')](saveUpdates(_0x4ecb39[_0xc1c7('0x59')],null))[_0xc1c7('0x2e')](respondWithResult(_0x6b9337,null))[_0xc1c7('0x51')](handleError(_0x6b9337,null));};exports[_0xc1c7('0x2f')]=function(_0x206afd,_0x3c9ffe){return db[_0xc1c7('0x4c')][_0xc1c7('0x53')]({'where':{'id':_0x206afd[_0xc1c7('0x52')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x3c9ffe,null))[_0xc1c7('0x2e')](removeEntity(_0x3c9ffe,null))[_0xc1c7('0x51')](handleError(_0x3c9ffe,null));};exports[_0xc1c7('0x61')]=function(_0x31bb3c,_0x37938a){return db[_0xc1c7('0x4c')][_0xc1c7('0x61')]()[_0xc1c7('0x2e')](respondWithResult(_0x37938a,null))[_0xc1c7('0x51')](handleError(_0x37938a,null));};exports[_0xc1c7('0x62')]=function(_0x47d58e,_0x8c88c0){var _0x244b8c=_0x47d58e[_0xc1c7('0x59')];return db[_0xc1c7('0x4c')][_0xc1c7('0x53')]({'where':{'id':_0x47d58e[_0xc1c7('0x52')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x8c88c0,null))[_0xc1c7('0x2e')](function(_0x5f4f50){if(_0x5f4f50){return db[_0xc1c7('0x63')][_0xc1c7('0x5b')](function(_0x268a41){return db[_0xc1c7('0x5c')][_0xc1c7('0x2f')]({'where':{'userProfileId':_0x47d58e[_0xc1c7('0x52')]['id'],'sectionId':_[_0xc1c7('0x35')](_0x244b8c,function(_0xa00af6){return _0xa00af6['sectionId'];})},'transaction':_0x268a41})[_0xc1c7('0x2e')](function(){var _0x2547aa=_[_0xc1c7('0x35')](_0x244b8c,function(_0x4225ce){_0x4225ce[_0xc1c7('0x5f')]=_0x47d58e[_0xc1c7('0x52')]['id'];return _0x4225ce;});var _0x426698=[];return BPromise[_0xc1c7('0x5d')](_0x2547aa,function(_0x31948f){return db[_0xc1c7('0x5c')][_0xc1c7('0x54')](_0x31948f,{'include':[{'model':db[_0xc1c7('0x64')],'as':'Resources'}],'raw':!![],'transaction':_0x268a41})['then'](function(_0x1927c3){_0x426698[_0xc1c7('0x65')](_0x1927c3[_0xc1c7('0x56')]({'plain':!![]}));});})[_0xc1c7('0x2e')](function(){return _0x426698;});});});}})[_0xc1c7('0x2e')](function(_0x258dc5){return _0x258dc5;})[_0xc1c7('0x2e')](respondWithResult(_0x8c88c0,null))[_0xc1c7('0x51')](handleError(_0x8c88c0,null));};exports[_0xc1c7('0x66')]=function(_0xd5e555,_0x180607){var _0x1a59f0;return db[_0xc1c7('0x4c')]['find']({'where':{'id':_0xd5e555[_0xc1c7('0x52')]['id']},'attributes':['id',_0xc1c7('0x32')]})[_0xc1c7('0x2e')](handleEntityNotFound(_0x180607,null))['then'](function(_0x4de022){if(_0x4de022){_0x1a59f0=_0x4de022;return db['UserProfileSection'][_0xc1c7('0x2f')]({'where':{'userProfileId':_0xd5e555[_0xc1c7('0x52')]['id'],'sectionId':_0xd5e555['query'][_0xc1c7('0x67')]}});}})[_0xc1c7('0x2e')](function(){return _0x1a59f0;})['then'](respondWithStatusCode(_0x180607,null))['catch'](handleError(_0x180607,null));};exports['getSections']=function(_0x19263c,_0x515e58){var _0x219d44=[];var _0x3bc3aa=[];return db[_0xc1c7('0x5c')]['findAll']({'where':{'userProfileId':_0x19263c[_0xc1c7('0x52')]['id']},'raw':!![]})['then'](function(_0x32d38a){_0x219d44=_[_0xc1c7('0x47')](_0x32d38a,function(_0x51d66d){return _0x51d66d[_0xc1c7('0x68')]===0x1||_[_0xc1c7('0x69')]([0x3eb,0x709],_0x51d66d[_0xc1c7('0x5e')]);});if(!_[_0xc1c7('0x6a')](_0x219d44)){return _[_0xc1c7('0x35')](_0x219d44,function(_0x2d017c){return _0x2d017c[_0xc1c7('0x5e')];});}else{return;}})[_0xc1c7('0x2e')](function(_0x425f3d){if(_0x425f3d)_0x3bc3aa=_0x425f3d;if(_[_0xc1c7('0x69')](_0x3bc3aa,0x64)){var _0x4bb9bc=_[_0xc1c7('0x53')](_0x219d44,{'sectionId':0x64});return hasDefaultDashboard(_0x4bb9bc)[_0xc1c7('0x2e')](function(_0xae85a9){return _[_0xc1c7('0x35')](_0x219d44,function(_0x54f90e){if(_0x54f90e[_0xc1c7('0x5e')]===0x64){_0x54f90e[_0xc1c7('0x6b')]=_0xae85a9;}return _0x54f90e;});});}else{return;}})['then'](function(_0x4eaa5c){if(_0x4eaa5c)_0x219d44=_0x4eaa5c;if(_[_0xc1c7('0x69')](_0x3bc3aa,0x3eb)){var _0x22b364=_[_0xc1c7('0x53')](_0x219d44,{'sectionId':0x3eb});return getCustomDashboards(_0x22b364)[_0xc1c7('0x2e')](function(_0x157d40){return _[_0xc1c7('0x35')](_0x219d44,function(_0x48309e){if(_0x22b364[_0xc1c7('0x68')]){if(_0x48309e[_0xc1c7('0x5e')]===0x3eb){_0x48309e['subsections']=_0x157d40;}}else{if(_0x48309e[_0xc1c7('0x5e')]===0x64){_0x48309e[_0xc1c7('0x6b')]=_0x157d40;}}return _0x48309e;});});}else{return;}})[_0xc1c7('0x2e')](function(_0x392005){if(_0x392005)_0x219d44=_0x392005;if(_[_0xc1c7('0x69')](_0x3bc3aa,0x709)){var _0x2528f3=_[_0xc1c7('0x53')](_0x219d44,{'sectionId':0x709});return getPlugins(_0x2528f3)[_0xc1c7('0x2e')](function(_0x2dfefa){if(_0x2528f3[_0xc1c7('0x68')]){return _[_0xc1c7('0x35')](_0x219d44,function(_0x42863c){if(_0x42863c[_0xc1c7('0x5e')]===0x709){_0x42863c[_0xc1c7('0x6b')]=_0x2dfefa;}return _0x42863c;});}else{var _0x5c82da={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2dfefa};var _0x257a35=_[_0xc1c7('0x35')](_0x219d44);_0x257a35[_0xc1c7('0x65')](_0x5c82da);return _0x257a35;}});}else{return;}})[_0xc1c7('0x2e')](function(_0x421a11){if(_0x421a11)_0x219d44=_0x421a11;return _[_0xc1c7('0x47')](_0x219d44,['enabled',0x1]);})[_0xc1c7('0x2e')](respondWithResult(_0x515e58,null))[_0xc1c7('0x51')](handleError(_0x515e58,null));};function hasDefaultDashboard(_0x558066){var _0x5df8f4=[0x65];return new BPromise(function(_0xb2124e,_0x9145ec){try{if(_0x558066[_0xc1c7('0x6c')]){_0xb2124e(_0x5df8f4);}else{return db[_0xc1c7('0x64')][_0xc1c7('0x6d')]({'where':{'sectionId':_0x558066['id']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x5258c4){_0x5258c4?_0xb2124e(_0x5df8f4):_0xb2124e();});}}catch(_0x158c94){_0x9145ec(_0x158c94);}});}function getCustomDashboards(_0xc8633e){var _0x3f61ae=[];return new BPromise(function(_0x393676,_0x4d06c7){try{if(_0xc8633e[_0xc1c7('0x6c')]){return db['Dashboard'][_0xc1c7('0x4f')]({'raw':!![]})['then'](function(_0x3aca9a){_0x3aca9a[_0xc1c7('0x6e')](function(_0x5b4a9b){_0x3f61ae[_0xc1c7('0x65')](_0x5b4a9b['id']+0x1869f);});_0x393676(_0x3f61ae);});}else{return db[_0xc1c7('0x64')][_0xc1c7('0x4f')]({'where':{'sectionId':_0xc8633e['id']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x1ff3a3){_0x1ff3a3[_0xc1c7('0x6e')](function(_0x283689){_0x3f61ae[_0xc1c7('0x65')](_0x283689[_0xc1c7('0x6f')]+0x1869f);});_0x393676(_0x3f61ae);});}}catch(_0xe1e5dd){_0x4d06c7(_0xe1e5dd);}});}function getPlugins(_0x4510ea){var _0x94cc51=[];return new BPromise(function(_0x3615a5,_0x18f9c1){try{if(_0x4510ea[_0xc1c7('0x6c')]){return db[_0xc1c7('0x70')][_0xc1c7('0x4f')]({'raw':!![]})[_0xc1c7('0x2e')](function(_0x3045eb){_0x3045eb['forEach'](function(_0x48cddc){_0x94cc51['push'](_0x48cddc['id']+0x15b38);});_0x3615a5(_0x94cc51);});}else{return db[_0xc1c7('0x64')]['findAll']({'where':{'sectionId':_0x4510ea['id']},'raw':!![]})['then'](function(_0x5e1b46){_0x5e1b46[_0xc1c7('0x6e')](function(_0x2afcd2){_0x94cc51['push'](_0x2afcd2['resourceId']+0x15b38);});_0x3615a5(_0x94cc51);});}}catch(_0x57b04b){_0x18f9c1(_0x57b04b);}});}exports[_0xc1c7('0x71')]=function(_0x454b0d,_0x20a948){return db[_0xc1c7('0x4c')][_0xc1c7('0x53')]({'where':{'id':_0x454b0d[_0xc1c7('0x52')]['id']}})['then'](handleEntityNotFound(_0x20a948,null))[_0xc1c7('0x2e')](function(_0x12f753){if(_0x12f753){return db[_0xc1c7('0x63')]['transaction'](function(_0x3866a1){return db[_0xc1c7('0x5c')][_0xc1c7('0x4f')]({'where':{'userProfileId':_0x454b0d['params']['id']},'attributes':['id'],'raw':!![]})[_0xc1c7('0x2e')](function(_0x3231c7){if(_0x3231c7){return db[_0xc1c7('0x5c')][_0xc1c7('0x2f')]({'where':{'userProfileId':_0x454b0d[_0xc1c7('0x52')]['id'],'id':_[_0xc1c7('0x35')](_0x3231c7,function(_0x213f8e){return _0x213f8e['id'];})},'transaction':_0x3866a1});}})[_0xc1c7('0x2e')](function(_0x5ab498){var _0x4e7ed1=_[_0xc1c7('0x35')](_0x454b0d[_0xc1c7('0x59')],function(_0x1994c3){_0x1994c3['userProfileId']=_0x454b0d[_0xc1c7('0x52')]['id'];return _0x1994c3;});return db[_0xc1c7('0x5c')][_0xc1c7('0x72')](_0x4e7ed1,{'raw':!![],'transaction':_0x3866a1});})[_0xc1c7('0x2e')](function(_0x3369e2){var _0x48a85e=_[_0xc1c7('0x47')](_[_0xc1c7('0x35')](_0x3369e2,function(_0x405395){return _0x405395[_0xc1c7('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x48a85e){return db[_0xc1c7('0x5c')][_0xc1c7('0x4f')]({'where':{'userProfileId':_0x454b0d[_0xc1c7('0x52')]['id'],'sectionId':_[_0xc1c7('0x35')](_0x48a85e,function(_0x44245c){return _0x44245c[_0xc1c7('0x5e')];})},'attributes':['id',_0xc1c7('0x5e')],'raw':!![]})[_0xc1c7('0x2e')](function(_0x38fce7){var _0x38e932=_[_0xc1c7('0x35')](_0x454b0d['body'],function(_0x2656a7){_0x2656a7[_0xc1c7('0x5f')]=_0x454b0d[_0xc1c7('0x52')]['id'];return _0x2656a7;});return db[_0xc1c7('0x64')][_0xc1c7('0x72')](_0x38e932,{'raw':!![],'transaction':_0x3866a1});});}})['catch'](handleError(_0x20a948,null));});}})[_0xc1c7('0x2e')](function(_0x54f25b){var _0x29df03=_[_0xc1c7('0x35')](_0x54f25b,function(_0xd6ab9){return _0xd6ab9[_0xc1c7('0x56')]({'plain':!![]});});})['then'](respondWithResult(_0x20a948,null))[_0xc1c7('0x51')](handleError(_0x20a948,null));};exports['removeResources']=function(_0x2f4833,_0x344a09,_0x48f0fb){return db[_0xc1c7('0x4c')][_0xc1c7('0x53')]({'where':{'id':_0x2f4833[_0xc1c7('0x52')]['id']}})['then'](handleEntityNotFound(_0x344a09,null))[_0xc1c7('0x2e')](function(_0x415a0d){if(_0x415a0d){return _0x415a0d[_0xc1c7('0x73')](_0x2f4833[_0xc1c7('0x3b')][_0xc1c7('0x67')]);}})['then'](respondWithStatusCode(_0x344a09,null))[_0xc1c7('0x51')](handleError(_0x344a09,null));};exports['getResources']=function(_0x183c59,_0x4f445d){var _0x4f8ebf={};if(!_0x183c59[_0xc1c7('0x3b')][_0xc1c7('0x74')])throw new Error('Missing\x20section\x20parameter');if(!_0x183c59[_0xc1c7('0x3b')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x4f8ebf[_0xc1c7('0x25')]=qs['limit'](_0x183c59[_0xc1c7('0x3b')][_0xc1c7('0x25')]);_0x4f8ebf[_0xc1c7('0x24')]=qs[_0xc1c7('0x24')](_0x183c59[_0xc1c7('0x3b')][_0xc1c7('0x24')]);}return db[_0xc1c7('0x4c')][_0xc1c7('0x53')]({'where':{'id':_0x183c59[_0xc1c7('0x52')]['id']}})[_0xc1c7('0x2e')](function(_0x45e974){if(!_0x45e974)throw new Error(_0xc1c7('0x75')+_0x183c59[_0xc1c7('0x52')]['id']);return db['UserProfile'][_0xc1c7('0x76')](_0x183c59);})[_0xc1c7('0x2e')](respondWithFilteredResult(_0x4f445d,_0x4f8ebf))['catch'](handleError(_0x4f445d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 4ce97c9..6343299 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 _0xba18=['events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xb6ca94,_0x732794){var _0x4a3e1a=function(_0x489de3){while(--_0x489de3){_0xb6ca94['push'](_0xb6ca94['shift']());}};_0x4a3e1a(++_0x732794);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8ba1('0x0'));var UserProfile=require(_0x8ba1('0x1'))['db'][_0x8ba1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x8ba1('0x3')](0x0);var events={'afterCreate':_0x8ba1('0x4'),'afterUpdate':_0x8ba1('0x5'),'afterDestroy':_0x8ba1('0x6')};function emitEvent(_0x3b5254){return function(_0x59c54c,_0xe3bc16,_0x3136d7){UserProfileEvents[_0x8ba1('0x7')](_0x3b5254+':'+_0x59c54c['id'],_0x59c54c);UserProfileEvents[_0x8ba1('0x7')](_0x3b5254,_0x59c54c);_0x3136d7(null);};}for(var e in events){if(events[_0x8ba1('0x8')](e)){var event=events[e];UserProfile[_0x8ba1('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xf2e3=['remove','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xf2e3[_0x1da527];return _0x40fc7c;};'use strict';var EventEmitter=require(_0x3f2e('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x3f2e('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3f2e('0x2')](0x0);var events={'afterCreate':_0x3f2e('0x3'),'afterUpdate':_0x3f2e('0x4'),'afterDestroy':_0x3f2e('0x5')};function emitEvent(_0x1634cd){return function(_0x3938e2,_0xabcf5c,_0x216b26){UserProfileEvents['emit'](_0x1634cd+':'+_0x3938e2['id'],_0x3938e2);UserProfileEvents[_0x3f2e('0x6')](_0x1634cd,_0x3938e2);_0x216b26(null);};}for(var e in events){if(events[_0x3f2e('0x7')](e)){var event=events[e];UserProfile[_0x3f2e('0x8')](e,emitEvent(event));}}module[_0x3f2e('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 0515884..772fd41 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 _0x2a07=['VoicePrefix','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','VoiceQueues','users','agents','telephones','admin','user','Agents','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Pause','scheduler','Schedule','sounds','Sound','Template','triggers','Trigger','Variable','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.createdAt','from','user_has_','where','sequelize','query','OpenTabs','define','user_profiles','raw','Invalid\x20section\x20\x27','length','UserProfileSection','find','ignore','isEmpty','union','push','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','sort','pick','filters','merge','key','AnalyticExtractedReport','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','ids','count','Tag','color','ThroughTags','tag','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','User','role','agent','Telephones','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a07,0x74));var _0x72a0=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x2a07[_0x43444b];return _0x392fe5;};'use strict';var _=require(_0x72a0('0x0'));var attributes=require(_0x72a0('0x1'));var qs=require(_0x72a0('0x2'));var squel=require(_0x72a0('0x3'));module[_0x72a0('0x4')]=function(_0x548164){var _0x335b7c=_0x548164[_0x72a0('0x5')];function _0x135982(_0x45b155,_0x431f65){return new Promise(function(_0xce74c,_0x3ccf6d){if(!_0x431f65)return _0xce74c(null);var _0x20dab9=_0x431f65[_0x72a0('0x6')]?{[_0x431f65[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x431f65[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x45b155][_0x72a0('0x9')]({'where':_0x20dab9,'raw':!![]})[_0x72a0('0xa')](function(_0x2bc45b){_0x431f65['associatedResources']=_[_0x72a0('0xb')](_0x2bc45b,'id');_0xce74c(_0x431f65);})[_0x72a0('0xc')](function(_0x54abf6){_0x3ccf6d(_0x54abf6);});});}function _0x46fb8a(_0x194488,_0x1b85b1){return new Promise(function(_0x44d7cf,_0x975c27){var _0x516c08=_0x194488[_0x72a0('0x6')]?{[_0x194488[_0x72a0('0x6')][_0x72a0('0x7')]]:_0x194488[_0x72a0('0x6')][_0x72a0('0x8')]}:undefined;return _0x335b7c[_0x194488[_0x72a0('0xd')]][_0x72a0('0x9')]({'where':_0x516c08,'raw':!![]})['then'](function(_0x4930c5){_0x1b85b1[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x4930c5,function(_0x19eaf9){return _0x19eaf9[_0x72a0('0xf')];});_0x44d7cf(_0x1b85b1);})[_0x72a0('0xc')](function(_0x3f3d62){_0x975c27(_0x3f3d62);});});}function _0x4ab55e(_0x30248e,_0x2e7552,_0x16ac70){if(!_0x2e7552)return Promise[_0x72a0('0x10')](null);return new Promise(function(_0x2d1e95,_0x54495e){return _0x335b7c[_0x72a0('0x11')][_0x72a0('0x9')]({'where':{'sectionId':_0x2e7552['id']},'raw':!![]})[_0x72a0('0xa')](function(_0x5b63c8){if(_0x30248e[_0x72a0('0x7')]&&_0x30248e[_0x72a0('0x7')]!=='id'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x5437df){return _0x5437df[_0x30248e[_0x72a0('0x7')]];});}else{if(_0x16ac70==='AnalyticExtractedReport'){_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0xde058c){return{'id':_0xde058c['resourceId'],'type':_0xde058c[_0x72a0('0x12')]};});}else{_0x2e7552[_0x72a0('0xe')]=_[_0x72a0('0xb')](_0x5b63c8,function(_0x3d1965){return _0x3d1965['resourceId'];});}}_0x2d1e95(_0x2e7552);})[_0x72a0('0xc')](function(_0x390464){_0x54495e(_0x390464);});});}function _0x1ddd54(_0x23b918,_0x3022b0){var _0x174b1b={'parentSections':[]};switch(_0x23b918['toLowerCase']()){case'squareprojects':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x14');break;case _0x72a0('0x15'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x16');break;case _0x72a0('0x17'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x18');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x1a'),'field':'name','foreignKey':_0x72a0('0x1b')}];break;case _0x72a0('0x1c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1d');break;case _0x72a0('0x1e'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x1f');_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x20'),'field':'id','foreignKey':_0x72a0('0x21')}];break;case'lists':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x22');break;case _0x72a0('0x23'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x24');break;case _0x72a0('0x25'):_0x174b1b[_0x72a0('0x13')]='CmCustomField';break;case _0x72a0('0x26'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x27');break;case _0x72a0('0x28'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x29');break;case _0x72a0('0x2a'):_0x174b1b[_0x72a0('0x13')]='FaxQueue';break;case _0x72a0('0x2b'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2c');break;case'inboundroutes':case _0x72a0('0x2d'):case'outboundroutes':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x2e');break;case _0x72a0('0x2f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x30');break;case _0x72a0('0x31'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x32');break;case _0x72a0('0x33'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x34');_0x174b1b[_0x72a0('0x19')]=[{'name':'Agents','field':_0x72a0('0xf'),'foreignKey':'membername','model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x37')]}},{'name':_0x72a0('0x38'),'field':_0x72a0('0xf'),'foreignKey':_0x72a0('0x39'),'model':_0x72a0('0x35'),'filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':_0x72a0('0x12'),'value':[_0x72a0('0x3d')]}},{'name':_0x72a0('0x3e'),'field':'name','foreignKey':_0x72a0('0x3b'),'model':_0x72a0('0x3c'),'filter':{'field':'type','value':[_0x72a0('0x3f')]}}];break;case'musiconholds':_0x174b1b['childModel']='VoiceMusicOnHold';break;case _0x72a0('0x40'):_0x174b1b['childModel']=_0x72a0('0x41');break;case _0x72a0('0x42'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x43');break;case'ivrcampaigns':_0x174b1b['childModel']='Campaign';break;case'mailqueues':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x44');break;case'mailaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x45');break;case'mailsubstatuses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x46');break;case _0x72a0('0x47'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x48');break;case _0x72a0('0x49'):_0x174b1b['childModel']=_0x72a0('0x4a');break;case'smsqueues':_0x174b1b[_0x72a0('0x13')]='SmsQueue';break;case _0x72a0('0x4b'):_0x174b1b[_0x72a0('0x13')]='SmsAccount';break;case _0x72a0('0x4c'):_0x174b1b['childModel']=_0x72a0('0x4d');break;case _0x72a0('0x4e'):_0x174b1b[_0x72a0('0x13')]='WhatsappAccount';break;case _0x72a0('0x4f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x50');break;case'voicequeues':case'queuecampaigns':_0x174b1b[_0x72a0('0x13')]='VoiceQueue';if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x51')},{'name':_0x72a0('0x3e')}];}break;case _0x72a0('0x52'):case _0x72a0('0x53'):case _0x72a0('0x54'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x35');if(_0x3022b0){_0x174b1b[_0x72a0('0x19')]=[{'name':'Users','filter':{'field':_0x72a0('0x36'),'value':[_0x72a0('0x55'),_0x72a0('0x56')]},'ignore':!![]},{'name':_0x72a0('0x57')},{'name':_0x72a0('0x38')}];}break;case _0x72a0('0x58'):_0x174b1b[_0x72a0('0x13')]='ZendeskAccount';break;case'salesforceaccounts':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x59');break;case _0x72a0('0x5a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5b');break;case _0x72a0('0x5c'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x5d');break;case _0x72a0('0x5e'):_0x174b1b[_0x72a0('0x13')]='DeskAccount';break;case _0x72a0('0x5f'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x60');break;case _0x72a0('0x61'):_0x174b1b[_0x72a0('0x13')]='User';break;case _0x72a0('0x62'):_0x174b1b['childModel']='CannedAnswer';break;case _0x72a0('0x63'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x64');break;case _0x72a0('0x65'):_0x174b1b[_0x72a0('0x13')]='Dashboard';break;case _0x72a0('0x66'):_0x174b1b[_0x72a0('0x13')]='Interval';break;case'pauses':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x67');break;case _0x72a0('0x68'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x69');break;case _0x72a0('0x6a'):_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6b');break;case'tags':_0x174b1b[_0x72a0('0x13')]='Tag';break;case'templates':_0x174b1b['childModel']=_0x72a0('0x6c');break;case _0x72a0('0x6d'):_0x174b1b['childModel']=_0x72a0('0x6e');break;case'trunks':_0x174b1b[_0x72a0('0x13')]='Trunk';break;case'variables':_0x174b1b[_0x72a0('0x13')]=_0x72a0('0x6f');break;case'plugins':_0x174b1b[_0x72a0('0x13')]='Plugin';break;case _0x72a0('0x70'):_0x174b1b['childModel']='AnalyticExtractedReport';_0x174b1b[_0x72a0('0x19')]=[{'name':_0x72a0('0x71'),'field':'id','foreignKey':_0x72a0('0x72')}];break;case'metrics':_0x174b1b['childModel']=_0x72a0('0x73');break;}return _0x174b1b;}function _0x48f178(_0x44b171,_0x36d604){var _0x1cea02=_0x44b171[_0x72a0('0x74')](0x0)[_0x72a0('0x75')]()+_0x44b171[_0x72a0('0x76')](0x1);var _0x41f7f6={'type':_0x335b7c[_0x72a0('0x77')][_0x72a0('0x78')][_0x72a0('0x79')],'raw':!![]};return new Promise(function(_0x32a0bb,_0x43ec4b){var _0x4d0774=squel[_0x72a0('0x7a')]()['field']('ui.'+_0x1cea02+'InteractionId','id')['field'](_0x72a0('0x7b'))[_0x72a0('0x7c')](_0x72a0('0x7d')+_0x44b171+'_interactions','ui')[_0x72a0('0x7e')]('ui.UserId\x20=\x20?',_0x36d604['id']);return _0x335b7c[_0x72a0('0x7f')][_0x72a0('0x80')](_0x4d0774['toString'](),_0x41f7f6)[_0x72a0('0xa')](function(_0x24e211){_0x36d604[_0x1cea02+_0x72a0('0x81')]=_0x24e211;_0x32a0bb(_0x24e211);})[_0x72a0('0xc')](function(_0x5e47c4){_0x43ec4b(_0x5e47c4);});});}return _0x548164[_0x72a0('0x82')]('UserProfile',attributes,{'tableName':_0x72a0('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2cb292){var _0x1df6fc={'raw':_0x2cb292['query'][_0x72a0('0x84')],'where':{}};var _0x3eb3b5={};var _0x1b8a72={'count':0x0,'rows':[]};var _0x154c9d=_0x2cb292[_0x72a0('0x80')]['section'];var _0x5707e9=_0x2cb292[_0x72a0('0x80')]['mergeResources']||![];var _0x421c35=_0x1ddd54(_0x154c9d,_0x5707e9);if(!_0x421c35['childModel'])throw new Error(_0x72a0('0x85')+_0x154c9d+'\x27');var _0xd9ae1a=[{'name':_0x154c9d}];if(!_['isEmpty'](_0x421c35[_0x72a0('0x19')]))_0xd9ae1a=_0x421c35[_0x72a0('0x19')];var _0x83ebf6=[];for(var _0x55b301=0x0;_0x55b301<_0xd9ae1a[_0x72a0('0x86')];_0x55b301++){_0x83ebf6['push'](_0x335b7c[_0x72a0('0x87')][_0x72a0('0x88')]({'where':{'userProfileId':_0x2cb292['params']['id'],'name':_0xd9ae1a[_0x55b301][_0x72a0('0xf')]},'raw':!![]}));}return Promise['all'](_0x83ebf6)['then'](function(_0x5142de){var _0x28969a=_['filter'](_0x5142de,function(_0x115ba8){return _0x115ba8?_0x115ba8:undefined;});var _0x5520b8=_[_0x72a0('0x6')](_0xd9ae1a,[_0x72a0('0x89'),!![]]);var _0x143ebf=_['isEmpty'](_0x28969a)&&_[_0x72a0('0x8a')](_0x5520b8)?null:_[_0x72a0('0x8b')](_0x5520b8,_0x28969a);if(!_0x143ebf)return null;var _0x275e45=[];for(var _0x28551a=0x0;_0x28551a<_0x143ebf[_0x72a0('0x86')];_0x28551a++){var _0x58ef97=_[_0x72a0('0x88')](_0xd9ae1a,function(_0x2d431d){return _0x143ebf[_0x28551a]?_0x2d431d[_0x72a0('0xf')]===_0x143ebf[_0x28551a][_0x72a0('0xf')]:null;});if(_0x58ef97){if(_0x143ebf[_0x28551a]['ignore']){_0x275e45[_0x72a0('0x8c')](_0x135982(_0x421c35[_0x72a0('0x13')],_0x143ebf[_0x28551a]));}else{if(!_0x143ebf[_0x28551a]['autoAssociation']){_0x275e45[_0x72a0('0x8c')](_0x4ab55e(_0x58ef97,_0x143ebf[_0x28551a],_0x421c35['childModel']));}else{if(_0x58ef97[_0x72a0('0xd')]){_0x275e45[_0x72a0('0x8c')](_0x46fb8a(_0x58ef97,_0x143ebf[_0x28551a]));}}}}}return Promise[_0x72a0('0x8d')](_0x275e45);})[_0x72a0('0xa')](function(_0x14f61a){var _0x1e23e9=_0x14f61a;var _0x7450c7=null;if(_0x1e23e9){_0x7450c7=_0x1e23e9['length']===0x1?_0x1e23e9[0x0]:null;}if(!_0x7450c7&&!_0x1e23e9)return _0x1b8a72;var _0x5b0dfd=_0x335b7c[_0x421c35['childModel']][_0x72a0('0x8e')];_0x3eb3b5[_0x72a0('0xd')]=_[_0x72a0('0x8f')](_0x5b0dfd);_0x3eb3b5[_0x72a0('0x80')]=_[_0x72a0('0x8f')](_0x2cb292[_0x72a0('0x80')]);_0x3eb3b5['filters']=_[_0x72a0('0x90')](_0x3eb3b5[_0x72a0('0xd')],_0x3eb3b5[_0x72a0('0x80')]);_0x1df6fc[_0x72a0('0x91')]=_[_0x72a0('0x90')](_0x3eb3b5[_0x72a0('0xd')],qs[_0x72a0('0x92')](_0x2cb292['query'][_0x72a0('0x92')]));_0x1df6fc[_0x72a0('0x91')]=_0x1df6fc[_0x72a0('0x91')][_0x72a0('0x86')]?_0x1df6fc[_0x72a0('0x91')]:_0x3eb3b5[_0x72a0('0xd')];if(!_0x2cb292['query'][_0x72a0('0x93')]('nolimit')){_0x1df6fc[_0x72a0('0x94')]=qs[_0x72a0('0x94')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x94')]);_0x1df6fc[_0x72a0('0x95')]=qs['offset'](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x95')]);}_0x1df6fc['order']=qs[_0x72a0('0x96')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0x96')]);_0x1df6fc[_0x72a0('0x7e')]=qs['filters'](_[_0x72a0('0x97')](_0x2cb292[_0x72a0('0x80')],_0x3eb3b5[_0x72a0('0x98')]));if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x99')](_0x1df6fc[_0x72a0('0x7e')],{'$or':_[_0x72a0('0xb')](_0x5b0dfd,function(_0x3d02e6){if(_0x3d02e6[_0x72a0('0x12')][_0x72a0('0x9a')]!=='VIRTUAL'){var _0x18dc1b={};_0x18dc1b[_0x3d02e6[_0x72a0('0x7')]]={'$like':'%'+_0x2cb292[_0x72a0('0x80')][_0x72a0('0x6')]+'%'};return _0x18dc1b;}})});}var _0xada6ad=[];var _0x3a0bd6=null;var _0x20281b={};if(_0x7450c7){_0x3a0bd6=_[_0x72a0('0x88')](_0xd9ae1a,['name',_0x7450c7[_0x72a0('0xf')]]);if(_0x3a0bd6['field']){_0x20281b={};if(_0x421c35['childModel']===_0x72a0('0x9b')){_0x20281b[_0x3a0bd6['foreignKey']]=_['map'](_0x7450c7[_0x72a0('0xe')],'id');}else{_0x20281b[_0x3a0bd6['foreignKey']]=_0x7450c7[_0x72a0('0xe')];}_0xada6ad[_0x72a0('0x8c')](_0x20281b);}else{_0x1df6fc[_0x72a0('0x7e')]['id']=_0x7450c7['associatedResources'];}}else{for(var _0x344a69=0x0;_0x344a69<_0x1e23e9[_0x72a0('0x86')];_0x344a69++){_0x3a0bd6=_[_0x72a0('0x88')](_0xd9ae1a,[_0x72a0('0xf'),_0x1e23e9[_0x344a69][_0x72a0('0xf')]]);if(_0x3a0bd6['field']){_0x20281b={};_0x20281b[_0x3a0bd6[_0x72a0('0x9c')]]=_0x1e23e9[_0x344a69][_0x72a0('0xe')];_0xada6ad[_0x72a0('0x8c')](_0x20281b);}else{if(!_0x1df6fc['where']['id'])_0x1df6fc[_0x72a0('0x7e')]['id']=[];_0x1e23e9[_0x344a69][_0x72a0('0xe')][_0x72a0('0x9d')](function(_0x56104e){_0x1df6fc[_0x72a0('0x7e')]['id'][_0x72a0('0x8c')](_0x56104e);});}}}if(!_[_0x72a0('0x8a')](_0xada6ad)){_0x1df6fc[_0x72a0('0x7e')]=_[_0x72a0('0x99')](_0x1df6fc[_0x72a0('0x7e')],{'$and':{'$or':_0xada6ad}});}_0x1df6fc=_[_0x72a0('0x99')]({},_0x1df6fc,_0x2cb292[_0x72a0('0x9e')]);if(_0x7450c7&&!_0x7450c7[_0x72a0('0x9f')]&&_0x421c35['childModel']===_0x72a0('0x9b')){if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa0')]){_0x1df6fc[_0x72a0('0xa1')]=[{'all':!![]}];}return _0x335b7c[_0x421c35[_0x72a0('0x13')]]['findAll'](_0x1df6fc)[_0x72a0('0xa')](function(_0x2c72fd){var _0x1c95fc=[];_0x2c72fd[_0x72a0('0x9d')](function(_0x5a995e){var _0x36d8b9;switch(_0x5a995e[_0x72a0('0xa2')]){case _0x72a0('0xa3'):_0x36d8b9=_['find'](_0x7450c7['associatedResources'],function(_0x3e23e4){return _0x3e23e4['id']===_0x5a995e[_0x72a0('0x72')]&&_0x3e23e4[_0x72a0('0x12')]===_0x72a0('0xa4');});break;case _0x72a0('0xa5'):_0x36d8b9=_['find'](_0x7450c7['associatedResources'],function(_0x5c4170){return _0x5c4170['id']===_0x5a995e[_0x72a0('0x72')]&&_0x5c4170['type']===_0x72a0('0xa6');});break;}if(_0x36d8b9)_0x1c95fc['push'](_0x5a995e);});_0x1b8a72['count']=_0x1c95fc['length'];_0x1b8a72['rows']=_0x1c95fc;return _0x1b8a72;});}else{if(!_[_0x72a0('0x8a')](_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa7')])){_0x1df6fc[_0x72a0('0x7e')]['id']=_0x1df6fc['where']['id']?_[_0x72a0('0x90')](_0x1df6fc[_0x72a0('0x7e')]['id'],_0x2cb292['query'][_0x72a0('0xa7')]):_0x2cb292[_0x72a0('0x80')]['ids'];}return _0x335b7c[_0x421c35[_0x72a0('0x13')]][_0x72a0('0xa8')]({'where':_0x1df6fc[_0x72a0('0x7e')]})[_0x72a0('0xa')](function(_0x5e1638){_0x1b8a72['count']=_0x5e1638;if(_0x2cb292[_0x72a0('0x80')][_0x72a0('0xa0')]){if(_0x421c35[_0x72a0('0x13')]===_0x72a0('0x1f')){_0x1df6fc[_0x72a0('0xa1')]=[{'model':_0x335b7c[_0x72a0('0xa9')],'as':'Tags','attributes':['id','name',_0x72a0('0xaa')],'required':_0x2cb292[_0x72a0('0x80')]['tag']?!![]:![]},{'model':_0x335b7c[_0x72a0('0xa9')],'as':_0x72a0('0xab'),'attributes':['id',_0x72a0('0xf'),_0x72a0('0xaa')],'through':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]?{'attributes':[],'where':{'TagId':_0x2cb292[_0x72a0('0x80')]['tag']||undefined}}:{},'required':_0x2cb292[_0x72a0('0x80')][_0x72a0('0xac')]?!![]:![]}];}else{_0x1df6fc[_0x72a0('0xa1')]=[{'all':!![]}];}}return _0x335b7c[_0x421c35['childModel']][_0x72a0('0x9')](_0x1df6fc);})[_0x72a0('0xa')](function(_0x346e03){_0x1b8a72[_0x72a0('0xad')]=_0x346e03;if(_0x154c9d===_0x72a0('0x57')&&_0x2cb292['query'][_0x72a0('0xae')]===_0x72a0('0xaf')){var _0x1f6d7d=[];for(var _0x417ac4=0x0;_0x417ac4<_0x1b8a72[_0x72a0('0xad')][_0x72a0('0x86')];_0x417ac4++){_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb0'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb2'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb3'),_0x1b8a72['rows'][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb4'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));_0x1f6d7d[_0x72a0('0x8c')](_0x48f178(_0x72a0('0xb5'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4]['dataValues']));_0x1f6d7d['push'](_0x48f178(_0x72a0('0xb6'),_0x1b8a72[_0x72a0('0xad')][_0x417ac4][_0x72a0('0xb1')]));}return Promise[_0x72a0('0x8d')](_0x1f6d7d)[_0x72a0('0xa')](function(){return _0x1b8a72;});}return _0x1b8a72;});}});}}});}; \ No newline at end of file +var _0x5f66=['key','VIRTUAL','forEach','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','ids','CmContact','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','membername','role','agent','Telephones','User','telephone','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','Users','admin','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Trigger','trunks','variables','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','isEmpty','union','ignore','all','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','pick','merge'];(function(_0x179bb9,_0x444a3c){var _0x165dcd=function(_0x52dbe0){while(--_0x52dbe0){_0x179bb9['push'](_0x179bb9['shift']());}};_0x165dcd(++_0x444a3c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var attributes=require(_0x65f6('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x65f6('0x1'));module[_0x65f6('0x2')]=function(_0x3461cd){var _0xbce843=_0x3461cd[_0x65f6('0x3')];function _0x5eb9ad(_0x3c5029,_0x5150c8){return new Promise(function(_0x1c9f5b,_0x22b017){if(!_0x5150c8)return _0x1c9f5b(null);var _0x4ec221=_0x5150c8['filter']?{[_0x5150c8[_0x65f6('0x4')][_0x65f6('0x5')]]:_0x5150c8[_0x65f6('0x4')][_0x65f6('0x6')]}:undefined;return _0xbce843[_0x3c5029][_0x65f6('0x7')]({'where':_0x4ec221,'raw':!![]})[_0x65f6('0x8')](function(_0x48d85c){_0x5150c8['associatedResources']=_[_0x65f6('0x9')](_0x48d85c,'id');_0x1c9f5b(_0x5150c8);})[_0x65f6('0xa')](function(_0x264647){_0x22b017(_0x264647);});});}function _0x25c416(_0x50d26d,_0x41a7fd){return new Promise(function(_0x571436,_0x497cf3){var _0x2d2dfa=_0x50d26d['filter']?{[_0x50d26d[_0x65f6('0x4')]['field']]:_0x50d26d[_0x65f6('0x4')][_0x65f6('0x6')]}:undefined;return _0xbce843[_0x50d26d[_0x65f6('0xb')]][_0x65f6('0x7')]({'where':_0x2d2dfa,'raw':!![]})[_0x65f6('0x8')](function(_0x1d29fd){_0x41a7fd[_0x65f6('0xc')]=_[_0x65f6('0x9')](_0x1d29fd,function(_0x46dbc6){return _0x46dbc6[_0x65f6('0xd')];});_0x571436(_0x41a7fd);})['catch'](function(_0x19b9ff){_0x497cf3(_0x19b9ff);});});}function _0x49a913(_0x5dd324,_0x1693e6,_0x5c69f8){if(!_0x1693e6)return Promise[_0x65f6('0xe')](null);return new Promise(function(_0x1c955c,_0x1b1cbb){return _0xbce843[_0x65f6('0xf')][_0x65f6('0x7')]({'where':{'sectionId':_0x1693e6['id']},'raw':!![]})[_0x65f6('0x8')](function(_0x495dd6){if(_0x5dd324['field']&&_0x5dd324[_0x65f6('0x5')]!=='id'){_0x1693e6['associatedResources']=_['map'](_0x495dd6,function(_0x5c5b91){return _0x5c5b91[_0x5dd324[_0x65f6('0x5')]];});}else{if(_0x5c69f8===_0x65f6('0x10')){_0x1693e6['associatedResources']=_[_0x65f6('0x9')](_0x495dd6,function(_0x270893){return{'id':_0x270893[_0x65f6('0x11')],'type':_0x270893[_0x65f6('0x12')]};});}else{_0x1693e6[_0x65f6('0xc')]=_[_0x65f6('0x9')](_0x495dd6,function(_0x581374){return _0x581374[_0x65f6('0x11')];});}}_0x1c955c(_0x1693e6);})['catch'](function(_0x5b9e2a){_0x1b1cbb(_0x5b9e2a);});});}function _0x212247(_0xd173f4,_0x524e42){var _0x1eeaaa={'parentSections':[]};switch(_0xd173f4[_0x65f6('0x13')]()){case _0x65f6('0x14'):_0x1eeaaa[_0x65f6('0x15')]='SquareProject';break;case _0x65f6('0x16'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x17');break;case'squarerecordings':_0x1eeaaa['childModel']='SquareRecording';_0x1eeaaa[_0x65f6('0x18')]=[{'name':_0x65f6('0x19'),'field':'name','foreignKey':_0x65f6('0x1a')}];break;case _0x65f6('0x1b'):_0x1eeaaa['childModel']=_0x65f6('0x1c');break;case _0x65f6('0x1d'):_0x1eeaaa[_0x65f6('0x15')]='CmContact';_0x1eeaaa['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x65f6('0x1e')}];break;case _0x65f6('0x1f'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x20');break;case _0x65f6('0x21'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x22');break;case'globalcustomfields':_0x1eeaaa['childModel']=_0x65f6('0x23');break;case _0x65f6('0x24'):_0x1eeaaa['childModel']='ChatQueue';break;case _0x65f6('0x25'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x26');break;case _0x65f6('0x27'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x28');break;case'faxaccounts':_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x29');break;case _0x65f6('0x2a'):case'internalroutes':case _0x65f6('0x2b'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x2c');break;case _0x65f6('0x2d'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x2e');break;case'voicemails':_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x2f');break;case'voicerecordings':_0x1eeaaa[_0x65f6('0x15')]='VoiceRecording';_0x1eeaaa[_0x65f6('0x18')]=[{'name':'Agents','field':_0x65f6('0xd'),'foreignKey':_0x65f6('0x30'),'model':'User','filter':{'field':_0x65f6('0x31'),'value':[_0x65f6('0x32')]}},{'name':_0x65f6('0x33'),'field':'name','foreignKey':'membername','model':_0x65f6('0x34'),'filter':{'field':'role','value':[_0x65f6('0x35')]}},{'name':'VoiceQueues','field':_0x65f6('0xd'),'foreignKey':_0x65f6('0x36'),'model':'VoiceQueue','filter':{'field':_0x65f6('0x12'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x65f6('0xd'),'foreignKey':_0x65f6('0x36'),'model':_0x65f6('0x37'),'filter':{'field':_0x65f6('0x12'),'value':[_0x65f6('0x38')]}}];break;case _0x65f6('0x39'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x3a');break;case'chanspies':_0x1eeaaa[_0x65f6('0x15')]='VoiceChanSpy';break;case _0x65f6('0x3b'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x3c');break;case _0x65f6('0x3d'):_0x1eeaaa['childModel']=_0x65f6('0x3e');break;case _0x65f6('0x3f'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x40');break;case _0x65f6('0x41'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x42');break;case _0x65f6('0x43'):_0x1eeaaa[_0x65f6('0x15')]='MailSubstatus';break;case _0x65f6('0x44'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x45');break;case _0x65f6('0x46'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x47');break;case _0x65f6('0x48'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x49');break;case _0x65f6('0x4a'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x4b');break;case _0x65f6('0x4c'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x4d');break;case _0x65f6('0x4e'):_0x1eeaaa['childModel']=_0x65f6('0x4f');break;case _0x65f6('0x50'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x51');break;case'voicequeues':case _0x65f6('0x52'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x37');if(_0x524e42){_0x1eeaaa['parentSections']=[{'name':_0x65f6('0x53')},{'name':_0x65f6('0x54')}];}break;case _0x65f6('0x55'):case _0x65f6('0x56'):case'telephones':_0x1eeaaa[_0x65f6('0x15')]='User';if(_0x524e42){_0x1eeaaa[_0x65f6('0x18')]=[{'name':_0x65f6('0x57'),'filter':{'field':'role','value':[_0x65f6('0x58'),'user']},'ignore':!![]},{'name':_0x65f6('0x59')},{'name':_0x65f6('0x33')}];}break;case _0x65f6('0x5a'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x5b');break;case _0x65f6('0x5c'):_0x1eeaaa['childModel']='SalesforceAccount';break;case _0x65f6('0x5d'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x5e');break;case _0x65f6('0x5f'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x60');break;case _0x65f6('0x61'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x62');break;case'zohoaccounts':_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x63');break;case _0x65f6('0x64'):_0x1eeaaa['childModel']=_0x65f6('0x34');break;case _0x65f6('0x65'):_0x1eeaaa['childModel']=_0x65f6('0x66');break;case _0x65f6('0x67'):_0x1eeaaa['childModel']=_0x65f6('0x68');break;case'customdashboards':_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x69');break;case _0x65f6('0x6a'):_0x1eeaaa['childModel']=_0x65f6('0x6b');break;case _0x65f6('0x6c'):_0x1eeaaa['childModel']=_0x65f6('0x6d');break;case _0x65f6('0x6e'):_0x1eeaaa['childModel']=_0x65f6('0x6f');break;case _0x65f6('0x70'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x71');break;case _0x65f6('0x72'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x73');break;case _0x65f6('0x74'):_0x1eeaaa['childModel']='Template';break;case'triggers':_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x75');break;case _0x65f6('0x76'):_0x1eeaaa[_0x65f6('0x15')]='Trunk';break;case _0x65f6('0x77'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x78');break;case'plugins':_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x79');break;case _0x65f6('0x7a'):_0x1eeaaa['childModel']='AnalyticExtractedReport';_0x1eeaaa[_0x65f6('0x18')]=[{'name':_0x65f6('0x7b'),'field':'id','foreignKey':_0x65f6('0x7c')}];break;case _0x65f6('0x7d'):_0x1eeaaa[_0x65f6('0x15')]=_0x65f6('0x7e');break;}return _0x1eeaaa;}function _0x35d77f(_0x138334,_0x2d8b5b){var _0xddbd90=_0x138334[_0x65f6('0x7f')](0x0)[_0x65f6('0x80')]()+_0x138334[_0x65f6('0x81')](0x1);var _0x3e3143={'type':_0xbce843['Sequelize'][_0x65f6('0x82')][_0x65f6('0x83')],'raw':!![]};return new Promise(function(_0x42a805,_0x4b4efe){var _0x25cf9f=squel[_0x65f6('0x84')]()[_0x65f6('0x5')](_0x65f6('0x85')+_0xddbd90+'InteractionId','id')[_0x65f6('0x5')](_0x65f6('0x86'))[_0x65f6('0x87')](_0x65f6('0x88')+_0x138334+'_interactions','ui')[_0x65f6('0x89')](_0x65f6('0x8a'),_0x2d8b5b['id']);return _0xbce843['sequelize'][_0x65f6('0x8b')](_0x25cf9f[_0x65f6('0x8c')](),_0x3e3143)[_0x65f6('0x8')](function(_0x51549d){_0x2d8b5b[_0xddbd90+_0x65f6('0x8d')]=_0x51549d;_0x42a805(_0x51549d);})[_0x65f6('0xa')](function(_0x3974ef){_0x4b4efe(_0x3974ef);});});}return _0x3461cd[_0x65f6('0x8e')](_0x65f6('0x8f'),attributes,{'tableName':_0x65f6('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5e4759){var _0x4ee8bd={'raw':_0x5e4759['query'][_0x65f6('0x91')],'where':{}};var _0x367d95={};var _0x376a79={'count':0x0,'rows':[]};var _0x471bec=_0x5e4759[_0x65f6('0x8b')][_0x65f6('0x92')];var _0x4c5cd2=_0x5e4759[_0x65f6('0x8b')][_0x65f6('0x93')]||![];var _0x54b569=_0x212247(_0x471bec,_0x4c5cd2);if(!_0x54b569[_0x65f6('0x15')])throw new Error(_0x65f6('0x94')+_0x471bec+'\x27');var _0x477489=[{'name':_0x471bec}];if(!_['isEmpty'](_0x54b569[_0x65f6('0x18')]))_0x477489=_0x54b569[_0x65f6('0x18')];var _0x4e83dc=[];for(var _0x271d76=0x0;_0x271d76<_0x477489[_0x65f6('0x95')];_0x271d76++){_0x4e83dc[_0x65f6('0x96')](_0xbce843[_0x65f6('0x97')][_0x65f6('0x98')]({'where':{'userProfileId':_0x5e4759[_0x65f6('0x99')]['id'],'name':_0x477489[_0x271d76][_0x65f6('0xd')]},'raw':!![]}));}return Promise['all'](_0x4e83dc)['then'](function(_0x3eb33e){var _0x3da139=_['filter'](_0x3eb33e,function(_0x417ba5){return _0x417ba5?_0x417ba5:undefined;});var _0x5f3df9=_[_0x65f6('0x4')](_0x477489,['ignore',!![]]);var _0x440df1=_[_0x65f6('0x9a')](_0x3da139)&&_[_0x65f6('0x9a')](_0x5f3df9)?null:_[_0x65f6('0x9b')](_0x5f3df9,_0x3da139);if(!_0x440df1)return null;var _0x145aaa=[];for(var _0x264e6c=0x0;_0x264e6c<_0x440df1[_0x65f6('0x95')];_0x264e6c++){var _0x1cc66a=_[_0x65f6('0x98')](_0x477489,function(_0x4b7ecd){return _0x440df1[_0x264e6c]?_0x4b7ecd['name']===_0x440df1[_0x264e6c][_0x65f6('0xd')]:null;});if(_0x1cc66a){if(_0x440df1[_0x264e6c][_0x65f6('0x9c')]){_0x145aaa[_0x65f6('0x96')](_0x5eb9ad(_0x54b569['childModel'],_0x440df1[_0x264e6c]));}else{if(!_0x440df1[_0x264e6c]['autoAssociation']){_0x145aaa[_0x65f6('0x96')](_0x49a913(_0x1cc66a,_0x440df1[_0x264e6c],_0x54b569[_0x65f6('0x15')]));}else{if(_0x1cc66a[_0x65f6('0xb')]){_0x145aaa[_0x65f6('0x96')](_0x25c416(_0x1cc66a,_0x440df1[_0x264e6c]));}}}}}return Promise[_0x65f6('0x9d')](_0x145aaa);})[_0x65f6('0x8')](function(_0x522d32){var _0x4f42ae=_0x522d32;var _0x215a91=null;if(_0x4f42ae){_0x215a91=_0x4f42ae[_0x65f6('0x95')]===0x1?_0x4f42ae[0x0]:null;}if(!_0x215a91&&!_0x4f42ae)return _0x376a79;var _0x5543bc=_0xbce843[_0x54b569[_0x65f6('0x15')]]['rawAttributes'];_0x367d95[_0x65f6('0xb')]=_[_0x65f6('0x9e')](_0x5543bc);_0x367d95[_0x65f6('0x8b')]=_[_0x65f6('0x9e')](_0x5e4759['query']);_0x367d95[_0x65f6('0x9f')]=_[_0x65f6('0xa0')](_0x367d95[_0x65f6('0xb')],_0x367d95['query']);_0x4ee8bd['attributes']=_[_0x65f6('0xa0')](_0x367d95['model'],qs[_0x65f6('0xa1')](_0x5e4759[_0x65f6('0x8b')][_0x65f6('0xa1')]));_0x4ee8bd[_0x65f6('0xa2')]=_0x4ee8bd['attributes']['length']?_0x4ee8bd['attributes']:_0x367d95[_0x65f6('0xb')];if(!_0x5e4759[_0x65f6('0x8b')][_0x65f6('0xa3')]('nolimit')){_0x4ee8bd[_0x65f6('0xa4')]=qs[_0x65f6('0xa4')](_0x5e4759[_0x65f6('0x8b')]['limit']);_0x4ee8bd[_0x65f6('0xa5')]=qs[_0x65f6('0xa5')](_0x5e4759['query'][_0x65f6('0xa5')]);}_0x4ee8bd[_0x65f6('0xa6')]=qs['sort'](_0x5e4759[_0x65f6('0x8b')]['sort']);_0x4ee8bd[_0x65f6('0x89')]=qs['filters'](_[_0x65f6('0xa7')](_0x5e4759[_0x65f6('0x8b')],_0x367d95['filters']));if(_0x5e4759[_0x65f6('0x8b')][_0x65f6('0x4')]){_0x4ee8bd[_0x65f6('0x89')]=_[_0x65f6('0xa8')](_0x4ee8bd[_0x65f6('0x89')],{'$or':_[_0x65f6('0x9')](_0x5543bc,function(_0x46af9f){if(_0x46af9f[_0x65f6('0x12')][_0x65f6('0xa9')]!==_0x65f6('0xaa')){var _0x288eb0={};_0x288eb0[_0x46af9f['field']]={'$like':'%'+_0x5e4759[_0x65f6('0x8b')][_0x65f6('0x4')]+'%'};return _0x288eb0;}})});}var _0x15c8b7=[];var _0x219e42=null;var _0x5694f9={};if(_0x215a91){_0x219e42=_[_0x65f6('0x98')](_0x477489,[_0x65f6('0xd'),_0x215a91['name']]);if(_0x219e42[_0x65f6('0x5')]){_0x5694f9={};if(_0x54b569['childModel']===_0x65f6('0x10')){_0x5694f9[_0x219e42['foreignKey']]=_[_0x65f6('0x9')](_0x215a91[_0x65f6('0xc')],'id');}else{_0x5694f9[_0x219e42['foreignKey']]=_0x215a91['associatedResources'];}_0x15c8b7[_0x65f6('0x96')](_0x5694f9);}else{_0x4ee8bd[_0x65f6('0x89')]['id']=_0x215a91['associatedResources'];}}else{for(var _0x2d86c8=0x0;_0x2d86c8<_0x4f42ae[_0x65f6('0x95')];_0x2d86c8++){_0x219e42=_[_0x65f6('0x98')](_0x477489,['name',_0x4f42ae[_0x2d86c8][_0x65f6('0xd')]]);if(_0x219e42[_0x65f6('0x5')]){_0x5694f9={};_0x5694f9[_0x219e42['foreignKey']]=_0x4f42ae[_0x2d86c8][_0x65f6('0xc')];_0x15c8b7['push'](_0x5694f9);}else{if(!_0x4ee8bd[_0x65f6('0x89')]['id'])_0x4ee8bd['where']['id']=[];_0x4f42ae[_0x2d86c8]['associatedResources'][_0x65f6('0xab')](function(_0x1cf4ed){_0x4ee8bd[_0x65f6('0x89')]['id'][_0x65f6('0x96')](_0x1cf4ed);});}}}if(!_[_0x65f6('0x9a')](_0x15c8b7)){_0x4ee8bd[_0x65f6('0x89')]=_[_0x65f6('0xa8')](_0x4ee8bd[_0x65f6('0x89')],{'$and':{'$or':_0x15c8b7}});}_0x4ee8bd=_['merge']({},_0x4ee8bd,_0x5e4759['options']);if(_0x215a91&&!_0x215a91[_0x65f6('0xac')]&&_0x54b569['childModel']===_0x65f6('0x10')){if(_0x5e4759[_0x65f6('0x8b')][_0x65f6('0xad')]){_0x4ee8bd[_0x65f6('0xae')]=[{'all':!![]}];}return _0xbce843[_0x54b569[_0x65f6('0x15')]]['findAll'](_0x4ee8bd)[_0x65f6('0x8')](function(_0x257247){var _0x14c908=[];_0x257247['forEach'](function(_0xc7cee1){var _0x443aed;switch(_0xc7cee1[_0x65f6('0xaf')]){case _0x65f6('0xb0'):_0x443aed=_[_0x65f6('0x98')](_0x215a91[_0x65f6('0xc')],function(_0x53f0ea){return _0x53f0ea['id']===_0xc7cee1['reportId']&&_0x53f0ea[_0x65f6('0x12')]===_0x65f6('0xb1');});break;case _0x65f6('0xb2'):_0x443aed=_[_0x65f6('0x98')](_0x215a91['associatedResources'],function(_0x4bda86){return _0x4bda86['id']===_0xc7cee1[_0x65f6('0x7c')]&&_0x4bda86[_0x65f6('0x12')]===_0x65f6('0xb3');});break;}if(_0x443aed)_0x14c908[_0x65f6('0x96')](_0xc7cee1);});_0x376a79[_0x65f6('0xb4')]=_0x14c908[_0x65f6('0x95')];_0x376a79['rows']=_0x14c908;return _0x376a79;});}else{if(!_['isEmpty'](_0x5e4759['query'][_0x65f6('0xb5')])){_0x4ee8bd[_0x65f6('0x89')]['id']=_0x4ee8bd[_0x65f6('0x89')]['id']?_[_0x65f6('0xa0')](_0x4ee8bd['where']['id'],_0x5e4759['query'][_0x65f6('0xb5')]):_0x5e4759[_0x65f6('0x8b')]['ids'];}return _0xbce843[_0x54b569[_0x65f6('0x15')]]['count']({'where':_0x4ee8bd[_0x65f6('0x89')]})['then'](function(_0x3a30ed){_0x376a79[_0x65f6('0xb4')]=_0x3a30ed;if(_0x5e4759['query'][_0x65f6('0xad')]){if(_0x54b569[_0x65f6('0x15')]===_0x65f6('0xb6')){_0x4ee8bd[_0x65f6('0xae')]=[{'model':_0xbce843[_0x65f6('0x73')],'as':_0x65f6('0xb7'),'attributes':['id','name',_0x65f6('0xb8')],'required':_0x5e4759['query'][_0x65f6('0xb9')]?!![]:![]},{'model':_0xbce843['Tag'],'as':_0x65f6('0xba'),'attributes':['id',_0x65f6('0xd'),_0x65f6('0xb8')],'through':_0x5e4759[_0x65f6('0x8b')]['tag']?{'attributes':[],'where':{'TagId':_0x5e4759[_0x65f6('0x8b')][_0x65f6('0xb9')]||undefined}}:{},'required':_0x5e4759[_0x65f6('0x8b')]['tag']?!![]:![]}];}else{_0x4ee8bd['include']=[{'all':!![]}];}}return _0xbce843[_0x54b569[_0x65f6('0x15')]][_0x65f6('0x7')](_0x4ee8bd);})['then'](function(_0x180cde){_0x376a79[_0x65f6('0xbb')]=_0x180cde;if(_0x471bec===_0x65f6('0x59')&&_0x5e4759['query'][_0x65f6('0xbc')]===_0x65f6('0xbd')){var _0x5df361=[];for(var _0x709725=0x0;_0x709725<_0x376a79[_0x65f6('0xbb')][_0x65f6('0x95')];_0x709725++){_0x5df361['push'](_0x35d77f(_0x65f6('0xbe'),_0x376a79[_0x65f6('0xbb')][_0x709725][_0x65f6('0xbf')]));_0x5df361['push'](_0x35d77f(_0x65f6('0xc0'),_0x376a79['rows'][_0x709725][_0x65f6('0xbf')]));_0x5df361[_0x65f6('0x96')](_0x35d77f(_0x65f6('0xc1'),_0x376a79[_0x65f6('0xbb')][_0x709725][_0x65f6('0xbf')]));_0x5df361[_0x65f6('0x96')](_0x35d77f('mail',_0x376a79[_0x65f6('0xbb')][_0x709725][_0x65f6('0xbf')]));_0x5df361[_0x65f6('0x96')](_0x35d77f(_0x65f6('0xc2'),_0x376a79[_0x65f6('0xbb')][_0x709725]['dataValues']));_0x5df361['push'](_0x35d77f('whatsapp',_0x376a79[_0x65f6('0xbb')][_0x709725][_0x65f6('0xbf')]));}return Promise[_0x65f6('0x9d')](_0x5df361)['then'](function(){return _0x376a79;});}return _0x376a79;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 4872c4d..88a1094 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 _0x0954=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','lodash','moment','bluebird'];(function(_0x101d59,_0x331222){var _0x31dddd=function(_0x1598e8){while(--_0x1598e8){_0x101d59['push'](_0x101d59['shift']());}};_0x31dddd(++_0x331222);}(_0x0954,0x135));var _0x4095=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x0954[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x4095('0x0'));var util=require('util');var moment=require(_0x4095('0x1'));var BPromise=require(_0x4095('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4095('0x3'));var db=require(_0x4095('0x4'))['db'];var utils=require(_0x4095('0x5'));var logger=require(_0x4095('0x6'))(_0x4095('0x7'));var config=require(_0x4095('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4095('0x9')]=_[_0x4095('0xa')](config[_0x4095('0x9')],{'host':_0x4095('0xb'),'port':0x18eb});var socket=require(_0x4095('0xc'))(new Redis(config[_0x4095('0x9')]));require('./userProfile.socket')[_0x4095('0xd')](socket);function respondWithRpcPromise(_0xe32904,_0x9e1747,_0x5d3e09){return new BPromise(function(_0x296b6d,_0x33daa4){return client[_0x4095('0xe')](_0xe32904,_0x5d3e09)['then'](function(_0x1963eb){logger['info'](_0x4095('0xf'),_0x9e1747,'request\x20sent');logger[_0x4095('0x10')](_0x4095('0x11'),_0x9e1747,_0x4095('0x12'),JSON['stringify'](_0x1963eb));if(_0x1963eb['error']){if(_0x1963eb[_0x4095('0x13')][_0x4095('0x14')]===0x1f4){logger[_0x4095('0x13')](_0x4095('0xf'),_0x9e1747,_0x1963eb['error']['message']);return _0x33daa4(_0x1963eb[_0x4095('0x13')][_0x4095('0x15')]);}logger[_0x4095('0x13')](_0x4095('0xf'),_0x9e1747,_0x1963eb[_0x4095('0x13')][_0x4095('0x15')]);return _0x296b6d(_0x1963eb['error']['message']);}else{logger[_0x4095('0x16')](_0x4095('0xf'),_0x9e1747,'request\x20sent');_0x296b6d(_0x1963eb[_0x4095('0x17')]['message']);}})['catch'](function(_0x272010){logger['error'](_0x4095('0xf'),_0x9e1747,_0x272010);_0x33daa4(_0x272010);});});} \ No newline at end of file +var _0x4e47=['client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3fd691,_0x58331d){var _0x241e8e=function(_0x3f1651){while(--_0x3f1651){_0x3fd691['push'](_0x3fd691['shift']());}};_0x241e8e(++_0x58331d);}(_0x4e47,0x17f));var _0x74e4=function(_0xe0de7b,_0x45977c){_0xe0de7b=_0xe0de7b-0x0;var _0x2006f9=_0x4e47[_0xe0de7b];return _0x2006f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x74e4('0x0'));var BPromise=require(_0x74e4('0x1'));var rs=require(_0x74e4('0x2'));var fs=require('fs');var Redis=require(_0x74e4('0x3'));var db=require(_0x74e4('0x4'))['db'];var utils=require(_0x74e4('0x5'));var logger=require(_0x74e4('0x6'))(_0x74e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x74e4('0x8'));var client=jayson[_0x74e4('0x9')]['http']({'port':0x232a});config[_0x74e4('0xa')]=_[_0x74e4('0xb')](config[_0x74e4('0xa')],{'host':_0x74e4('0xc'),'port':0x18eb});var socket=require(_0x74e4('0xd'))(new Redis(config['redis']));require(_0x74e4('0xe'))[_0x74e4('0xf')](socket);function respondWithRpcPromise(_0x258940,_0x3525f8,_0xf13e3a){return new BPromise(function(_0x53567c,_0x46d9a7){return client[_0x74e4('0x10')](_0x258940,_0xf13e3a)['then'](function(_0x2f6d36){logger['info'](_0x74e4('0x11'),_0x3525f8,_0x74e4('0x12'));logger[_0x74e4('0x13')](_0x74e4('0x14'),_0x3525f8,_0x74e4('0x12'),JSON[_0x74e4('0x15')](_0x2f6d36));if(_0x2f6d36[_0x74e4('0x16')]){if(_0x2f6d36[_0x74e4('0x16')][_0x74e4('0x17')]===0x1f4){logger[_0x74e4('0x16')](_0x74e4('0x11'),_0x3525f8,_0x2f6d36['error']['message']);return _0x46d9a7(_0x2f6d36['error']['message']);}logger[_0x74e4('0x16')](_0x74e4('0x11'),_0x3525f8,_0x2f6d36[_0x74e4('0x16')]['message']);return _0x53567c(_0x2f6d36[_0x74e4('0x16')][_0x74e4('0x18')]);}else{logger[_0x74e4('0x19')](_0x74e4('0x11'),_0x3525f8,_0x74e4('0x12'));_0x53567c(_0x2f6d36[_0x74e4('0x1a')][_0x74e4('0x18')]);}})[_0x74e4('0x1b')](function(_0x4c9d2d){logger[_0x74e4('0x16')](_0x74e4('0x11'),_0x3525f8,_0x4c9d2d);_0x46d9a7(_0x4c9d2d);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ead54ed..9c046bf 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 _0xd164=['./userProfile.events','save','emit','register','length'];(function(_0x5a32cd,_0xaa03c4){var _0x7056d7=function(_0x574d5c){while(--_0x574d5c){_0x5a32cd['push'](_0x5a32cd['shift']());}};_0x7056d7(++_0xaa03c4);}(_0xd164,0x17c));var _0x4d16=function(_0x2e4bac,_0x598a47){_0x2e4bac=_0x2e4bac-0x0;var _0x517552=_0xd164[_0x2e4bac];return _0x517552;};'use strict';var UserProfileEvents=require(_0x4d16('0x0'));var events=[_0x4d16('0x1'),'remove','update'];function createListener(_0x3692bd,_0x429ca2){return function(_0x4b935e){_0x429ca2[_0x4d16('0x2')](_0x3692bd,_0x4b935e);};}function removeListener(_0x4aa90d,_0x1ee2b6){return function(){UserProfileEvents['removeListener'](_0x4aa90d,_0x1ee2b6);};}exports[_0x4d16('0x3')]=function(_0x3b3940){for(var _0x3baa45=0x0,_0x1becab=events[_0x4d16('0x4')];_0x3baa45<_0x1becab;_0x3baa45++){var _0x21e705=events[_0x3baa45];var _0x53dc78=createListener('userProfile:'+_0x21e705,_0x3b3940);UserProfileEvents['on'](_0x21e705,_0x53dc78);}}; \ No newline at end of file +var _0x3d58=['emit','removeListener','register','length','userProfile:','./userProfile.events','save','update'];(function(_0x10ecc7,_0x4f6235){var _0xf9b77a=function(_0x4f37a0){while(--_0x4f37a0){_0x10ecc7['push'](_0x10ecc7['shift']());}};_0xf9b77a(++_0x4f6235);}(_0x3d58,0x1e5));var _0x83d5=function(_0x10c70a,_0x37da2a){_0x10c70a=_0x10c70a-0x0;var _0x486a73=_0x3d58[_0x10c70a];return _0x486a73;};'use strict';var UserProfileEvents=require(_0x83d5('0x0'));var events=[_0x83d5('0x1'),'remove',_0x83d5('0x2')];function createListener(_0xdb27b0,_0x52224e){return function(_0x3a6169){_0x52224e[_0x83d5('0x3')](_0xdb27b0,_0x3a6169);};}function removeListener(_0x24ae4a,_0x297545){return function(){UserProfileEvents[_0x83d5('0x4')](_0x24ae4a,_0x297545);};}exports[_0x83d5('0x5')]=function(_0x517a81){for(var _0x3a7732=0x0,_0x298429=events[_0x83d5('0x6')];_0x3a7732<_0x298429;_0x3a7732++){var _0x510f72=events[_0x3a7732];var _0xddf073=createListener(_0x83d5('0x7')+_0x510f72,_0x517a81);UserProfileEvents['on'](_0x510f72,_0xddf073);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 27570bb..90c4082 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 _0x928c=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','/describe','describe','/:id','isAuthenticated','post','create','put','delete'];(function(_0x569ec0,_0x531e33){var _0x3653e4=function(_0x5c9266){while(--_0x5c9266){_0x569ec0['push'](_0x569ec0['shift']());}};_0x3653e4(++_0x531e33);}(_0x928c,0x1a0));var _0xc928=function(_0x2640f6,_0x20b5e8){_0x2640f6=_0x2640f6-0x0;var _0x14bf56=_0x928c[_0x2640f6];return _0x14bf56;};'use strict';var multer=require(_0xc928('0x0'));var util=require(_0xc928('0x1'));var path=require('path');var timeout=require(_0xc928('0x2'));var express=require('express');var router=express[_0xc928('0x3')]();var fs_extra=require(_0xc928('0x4'));var auth=require(_0xc928('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc928('0x6'));router[_0xc928('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc928('0x7')](_0xc928('0x8'),auth['isAuthenticated'](),controller[_0xc928('0x9')]);router[_0xc928('0x7')](_0xc928('0xa'),auth[_0xc928('0xb')](),controller['show']);router[_0xc928('0xc')]('/',auth[_0xc928('0xb')](),controller[_0xc928('0xd')]);router[_0xc928('0xe')]('/:id',auth[_0xc928('0xb')](),controller['update']);router[_0xc928('0xf')](_0xc928('0xa'),auth[_0xc928('0xb')](),controller[_0xc928('0x10')]);module[_0xc928('0x11')]=router; \ No newline at end of file +var _0xca14=['update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','create'];(function(_0x1c94a6,_0x2a938d){var _0xdb5e65=function(_0x214da9){while(--_0x214da9){_0x1c94a6['push'](_0x1c94a6['shift']());}};_0xdb5e65(++_0x2a938d);}(_0xca14,0x1e0));var _0x4ca1=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0xca14[_0x3bc3b4];return _0x4c546b;};'use strict';var multer=require('multer');var util=require(_0x4ca1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ca1('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x4ca1('0x2'));var interaction=require(_0x4ca1('0x3'));var config=require(_0x4ca1('0x4'));var controller=require(_0x4ca1('0x5'));router[_0x4ca1('0x6')]('/',auth[_0x4ca1('0x7')](),controller[_0x4ca1('0x8')]);router['get'](_0x4ca1('0x9'),auth[_0x4ca1('0x7')](),controller['describe']);router['get'](_0x4ca1('0xa'),auth[_0x4ca1('0x7')](),controller[_0x4ca1('0xb')]);router['post']('/',auth[_0x4ca1('0x7')](),controller[_0x4ca1('0xc')]);router['put'](_0x4ca1('0xa'),auth[_0x4ca1('0x7')](),controller[_0x4ca1('0xd')]);router[_0x4ca1('0xe')]('/:id',auth[_0x4ca1('0x7')](),controller[_0x4ca1('0xf')]);module[_0x4ca1('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f4ec87a..7928925 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 _0x80b3=['sequelize','STRING'];(function(_0x5c5b6e,_0x368b0c){var _0x4e87db=function(_0x54ce64){while(--_0x54ce64){_0x5c5b6e['push'](_0x5c5b6e['shift']());}};_0x4e87db(++_0x368b0c);}(_0x80b3,0xb8));var _0x380b=function(_0x4f0057,_0x7d37c4){_0x4f0057=_0x4f0057-0x0;var _0x57698f=_0x80b3[_0x4f0057];return _0x57698f;};'use strict';var Sequelize=require(_0x380b('0x0'));module['exports']={'name':{'type':Sequelize[_0x380b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x380b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc2e8=['INTEGER','sequelize','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc2e8,0x112));var _0x8c2e=function(_0x3cf89e,_0x4c40bb){_0x3cf89e=_0x3cf89e-0x0;var _0x168c11=_0xc2e8[_0x3cf89e];return _0x168c11;};'use strict';var Sequelize=require(_0x8c2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c2e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8c2e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8c2e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 94cbdf6..695a7d7 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 _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x51f959,_0x31f1b5){var _0x588f90=function(_0x40e1c7){while(--_0x40e1c7){_0x51f959['push'](_0x51f959['shift']());}};_0x588f90(++_0x31f1b5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file +var _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','UserProfileResource','includeAll','include'];(function(_0x497f48,_0x4e11f2){var _0x510210=function(_0x441d34){while(--_0x441d34){_0x497f48['push'](_0x497f48['shift']());}};_0x510210(++_0x4e11f2);}(_0x5c3c,0x132));var _0xc5c3=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x5c3c[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['UserProfileResource'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['UserProfileResource'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['UserProfileResource'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['UserProfileResource'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 94fa25f..76502c1 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 _0x52ae=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','lodash','../../config/logger','moment','rimraf'];(function(_0x23cc8e,_0x51d805){var _0x2f47d2=function(_0x3e353a){while(--_0x3e353a){_0x23cc8e['push'](_0x23cc8e['shift']());}};_0x2f47d2(++_0x51d805);}(_0x52ae,0x6a));var _0xe52a=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0x52ae[_0xdaab62];return _0x13d767;};'use strict';var _=require(_0xe52a('0x0'));var util=require('util');var logger=require(_0xe52a('0x1'))('api');var moment=require(_0xe52a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe52a('0x3'));var config=require(_0xe52a('0x4'));var attributes=require(_0xe52a('0x5'));module[_0xe52a('0x6')]=function(_0x3471b8,_0x258ac2){return _0x3471b8[_0xe52a('0x7')](_0xe52a('0x8'),attributes,{'tableName':_0xe52a('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9178=['path','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','bluebird'];(function(_0x9c297f,_0x1e1fbe){var _0x170b76=function(_0x476f6b){while(--_0x476f6b){_0x9c297f['push'](_0x9c297f['shift']());}};_0x170b76(++_0x1e1fbe);}(_0x9178,0x69));var _0x8917=function(_0x2d6dd1,_0x598d01){_0x2d6dd1=_0x2d6dd1-0x0;var _0x485ab1=_0x9178[_0x2d6dd1];return _0x485ab1;};'use strict';var _=require(_0x8917('0x0'));var util=require(_0x8917('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8917('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8917('0x3'));var rimraf=require('rimraf');var config=require(_0x8917('0x4'));var attributes=require('./userProfileResource.attributes');module[_0x8917('0x5')]=function(_0x2e95e1,_0x14b25d){return _0x2e95e1[_0x8917('0x6')](_0x8917('0x7'),attributes,{'tableName':_0x8917('0x8'),'paranoid':![],'indexes':[{'name':_0x8917('0x9'),'fields':[_0x8917('0xa'),_0x8917('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 21922da..7f0fca2 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 _0xe25c=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment'];(function(_0x4793f9,_0x634b26){var _0x4fc321=function(_0x4e51ee){while(--_0x4e51ee){_0x4793f9['push'](_0x4793f9['shift']());}};_0x4fc321(++_0x634b26);}(_0xe25c,0x167));var _0xce25=function(_0x4778e2,_0x58c806){_0x4778e2=_0x4778e2-0x0;var _0x138ded=_0xe25c[_0x4778e2];return _0x138ded;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce25('0x0'));var BPromise=require('bluebird');var rs=require(_0xce25('0x1'));var fs=require('fs');var Redis=require(_0xce25('0x2'));var db=require(_0xce25('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce25('0x4'));var config=require(_0xce25('0x5'));var jayson=require(_0xce25('0x6'));var client=jayson[_0xce25('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a32e4,_0x4ea75e,_0x1785c9){return new BPromise(function(_0x103550,_0x1369f7){return client['request'](_0x4a32e4,_0x1785c9)['then'](function(_0x49440a){logger[_0xce25('0x8')](_0xce25('0x9'),_0x4ea75e,_0xce25('0xa'));logger[_0xce25('0xb')](_0xce25('0xc'),_0x4ea75e,_0xce25('0xa'),JSON['stringify'](_0x49440a));if(_0x49440a[_0xce25('0xd')]){if(_0x49440a['error'][_0xce25('0xe')]===0x1f4){logger[_0xce25('0xd')](_0xce25('0x9'),_0x4ea75e,_0x49440a[_0xce25('0xd')][_0xce25('0xf')]);return _0x1369f7(_0x49440a[_0xce25('0xd')][_0xce25('0xf')]);}logger[_0xce25('0xd')](_0xce25('0x9'),_0x4ea75e,_0x49440a[_0xce25('0xd')][_0xce25('0xf')]);return _0x103550(_0x49440a['error'][_0xce25('0xf')]);}else{logger[_0xce25('0x8')](_0xce25('0x9'),_0x4ea75e,_0xce25('0xa'));_0x103550(_0x49440a[_0xce25('0x10')][_0xce25('0xf')]);}})[_0xce25('0x11')](function(_0x401ef5){logger['error'](_0xce25('0x9'),_0x4ea75e,_0x401ef5);_0x1369f7(_0x401ef5);});});} \ No newline at end of file +var _0xd2dd=['jayson/promise','client','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x36b0a3,_0xbf646a){var _0x38245d=function(_0x6bb05f){while(--_0x6bb05f){_0x36b0a3['push'](_0x36b0a3['shift']());}};_0x38245d(++_0xbf646a);}(_0xd2dd,0x1f1));var _0xdd2d=function(_0x8bc0de,_0x4baa98){_0x8bc0de=_0x8bc0de-0x0;var _0x40427d=_0xd2dd[_0x8bc0de];return _0x40427d;};'use strict';var _=require(_0xdd2d('0x0'));var util=require(_0xdd2d('0x1'));var moment=require(_0xdd2d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd2d('0x3'));var db=require(_0xdd2d('0x4'))['db'];var utils=require(_0xdd2d('0x5'));var logger=require(_0xdd2d('0x6'))(_0xdd2d('0x7'));var config=require(_0xdd2d('0x8'));var jayson=require(_0xdd2d('0x9'));var client=jayson[_0xdd2d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc0e8,_0x4c2b7f,_0x2a754e){return new BPromise(function(_0x55f775,_0x43f6c5){return client['request'](_0x4dc0e8,_0x2a754e)[_0xdd2d('0xb')](function(_0x261cd6){logger[_0xdd2d('0xc')](_0xdd2d('0xd'),_0x4c2b7f,_0xdd2d('0xe'));logger[_0xdd2d('0xf')](_0xdd2d('0x10'),_0x4c2b7f,_0xdd2d('0xe'),JSON['stringify'](_0x261cd6));if(_0x261cd6[_0xdd2d('0x11')]){if(_0x261cd6[_0xdd2d('0x11')][_0xdd2d('0x12')]===0x1f4){logger[_0xdd2d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x4c2b7f,_0x261cd6[_0xdd2d('0x11')][_0xdd2d('0x13')]);return _0x43f6c5(_0x261cd6[_0xdd2d('0x11')][_0xdd2d('0x13')]);}logger['error'](_0xdd2d('0xd'),_0x4c2b7f,_0x261cd6[_0xdd2d('0x11')][_0xdd2d('0x13')]);return _0x55f775(_0x261cd6[_0xdd2d('0x11')][_0xdd2d('0x13')]);}else{logger[_0xdd2d('0xc')](_0xdd2d('0xd'),_0x4c2b7f,'request\x20sent');_0x55f775(_0x261cd6[_0xdd2d('0x14')][_0xdd2d('0x13')]);}})[_0xdd2d('0x15')](function(_0x4e7f6f){logger['error'](_0xdd2d('0xd'),_0x4c2b7f,_0x4e7f6f);_0x43f6c5(_0x4e7f6f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index fb4daef..6f90c20 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 _0x1d08=['../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x27528f,_0x410b62){var _0x251a28=function(_0x1c7b68){while(--_0x1c7b68){_0x27528f['push'](_0x27528f['shift']());}};_0x251a28(++_0x410b62);}(_0x1d08,0x169));var _0x81d0=function(_0xe8362,_0x329927){_0xe8362=_0xe8362-0x0;var _0x3bd41d=_0x1d08[_0xe8362];return _0x3bd41d;};'use strict';var multer=require(_0x81d0('0x0'));var util=require(_0x81d0('0x1'));var path=require(_0x81d0('0x2'));var timeout=require(_0x81d0('0x3'));var express=require(_0x81d0('0x4'));var router=express[_0x81d0('0x5')]();var fs_extra=require(_0x81d0('0x6'));var auth=require(_0x81d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x81d0('0x8'));var controller=require(_0x81d0('0x9'));router[_0x81d0('0xa')]('/',auth[_0x81d0('0xb')](),controller[_0x81d0('0xc')]);router[_0x81d0('0xa')](_0x81d0('0xd'),auth[_0x81d0('0xb')](),controller[_0x81d0('0xe')]);router[_0x81d0('0xa')](_0x81d0('0xf'),auth[_0x81d0('0xb')](),controller['show']);router[_0x81d0('0x10')]('/',auth[_0x81d0('0xb')](),controller[_0x81d0('0x11')]);router[_0x81d0('0x12')](_0x81d0('0xf'),auth[_0x81d0('0xb')](),controller[_0x81d0('0x13')]);router[_0x81d0('0x14')](_0x81d0('0xf'),auth[_0x81d0('0xb')](),controller[_0x81d0('0x15')]);module[_0x81d0('0x16')]=router; \ No newline at end of file +var _0x0138=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x48e0bf,_0x19f2f3){var _0x56f176=function(_0x201d45){while(--_0x201d45){_0x48e0bf['push'](_0x48e0bf['shift']());}};_0x56f176(++_0x19f2f3);}(_0x0138,0x161));var _0x8013=function(_0x1d234d,_0x12b084){_0x1d234d=_0x1d234d-0x0;var _0x477d21=_0x0138[_0x1d234d];return _0x477d21;};'use strict';var multer=require(_0x8013('0x0'));var util=require(_0x8013('0x1'));var path=require(_0x8013('0x2'));var timeout=require(_0x8013('0x3'));var express=require(_0x8013('0x4'));var router=express[_0x8013('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8013('0x6'));var interaction=require(_0x8013('0x7'));var config=require(_0x8013('0x8'));var controller=require(_0x8013('0x9'));router[_0x8013('0xa')]('/',auth[_0x8013('0xb')](),controller[_0x8013('0xc')]);router[_0x8013('0xa')]('/describe',auth[_0x8013('0xb')](),controller['describe']);router[_0x8013('0xa')](_0x8013('0xd'),auth[_0x8013('0xb')](),controller[_0x8013('0xe')]);router[_0x8013('0xf')]('/',auth[_0x8013('0xb')](),controller['create']);router[_0x8013('0x10')](_0x8013('0xd'),auth[_0x8013('0xb')](),controller[_0x8013('0x11')]);router[_0x8013('0x12')]('/:id',auth[_0x8013('0xb')](),controller[_0x8013('0x13')]);module[_0x8013('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3978806..946b1c1 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 _0xdd4f=['BOOLEAN','STRING','setDataValue','join','getDataValue','crudPermissions','sequelize','INTEGER'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x600524,_0x13a3cb){_0x600524=_0x600524-0x0;var _0xf1eaa0=_0xdd4f[_0x600524];return _0xf1eaa0;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xfdd4('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfdd4('0x3')],'set':function(_0x3175f6){this[_0xfdd4('0x4')]('crudPermissions',_0x3175f6?_0x3175f6[_0xfdd4('0x5')](''):[]);},'get':function(){return this[_0xfdd4('0x6')](_0xfdd4('0x7'))?this[_0xfdd4('0x6')](_0xfdd4('0x7'))['split'](''):[];}}}; \ No newline at end of file +var _0x02ce=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x51614d,_0x5b316f){var _0x3ad77e=function(_0x2b9bdf){while(--_0x2b9bdf){_0x51614d['push'](_0x51614d['shift']());}};_0x3ad77e(++_0x5b316f);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4dafe7,_0x24f53b){_0x4dafe7=_0x4dafe7-0x0;var _0x17d233=_0x02ce[_0x4dafe7];return _0x17d233;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe02c('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe02c('0x2')],'set':function(_0x46475c){this[_0xe02c('0x5')](_0xe02c('0x6'),_0x46475c?_0x46475c[_0xe02c('0x7')](''):[]);},'get':function(){return this[_0xe02c('0x8')](_0xe02c('0x6'))?this[_0xe02c('0x8')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 104ad62..1d6b672 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 _0x883d=['rows','catch','show','params','includeAll','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll'];(function(_0x119819,_0x43a767){var _0x29d63b=function(_0x1ff9ce){while(--_0x1ff9ce){_0x119819['push'](_0x119819['shift']());}};_0x29d63b(++_0x43a767);}(_0x883d,0x16e));var _0xd883=function(_0xfa50a7,_0x4f0592){_0xfa50a7=_0xfa50a7-0x0;var _0x1232ce=_0x883d[_0xfa50a7];return _0x1232ce;};'use strict';var emlformat=require(_0xd883('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd883('0x1'));var jsonpatch=require(_0xd883('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd883('0x3'));var util=require(_0xd883('0x4'));var path=require(_0xd883('0x5'));var sox=require(_0xd883('0x6'));var csv=require('to-csv');var ejs=require(_0xd883('0x7'));var fs=require('fs');var fs_extra=require(_0xd883('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd883('0x9'));var jsforce=require(_0xd883('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd883('0xb'));var querystring=require('querystring');var Papa=require(_0xd883('0xc'));var Redis=require(_0xd883('0xd'));var authService=require(_0xd883('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd883('0xf'));var hardwareService=require(_0xd883('0x10'));var logger=require(_0xd883('0x11'))('api');var utils=require(_0xd883('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd883('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed95d,_0x24d56b){_0x24d56b=_0x24d56b||0xcc;return function(_0x3a3598){if(_0x3a3598){return _0x3ed95d[_0xd883('0x14')](_0x24d56b);}return _0x3ed95d[_0xd883('0x15')](_0x24d56b)[_0xd883('0x16')]();};}function respondWithResult(_0x29b77b,_0x371535){_0x371535=_0x371535||0xc8;return function(_0x51b7a7){if(_0x51b7a7){return _0x29b77b[_0xd883('0x15')](_0x371535)['json'](_0x51b7a7);}};}function respondWithFilteredResult(_0x261fd2,_0x48e9d9){return function(_0x56b648){if(_0x56b648){var _0x4d14cb=typeof _0x48e9d9[_0xd883('0x17')]===_0xd883('0x18')&&typeof _0x48e9d9[_0xd883('0x19')]==='undefined';var _0x476393=_0x56b648[_0xd883('0x1a')];var _0x26697d=_0x4d14cb?0x0:_0x48e9d9['offset'];var _0x5ed10a=_0x4d14cb?_0x56b648[_0xd883('0x1a')]:_0x48e9d9[_0xd883('0x17')]+_0x48e9d9[_0xd883('0x19')];var _0x3c9ec7;if(_0x5ed10a>=_0x476393){_0x5ed10a=_0x476393;_0x3c9ec7=0xc8;}else{_0x3c9ec7=0xce;}_0x261fd2[_0xd883('0x15')](_0x3c9ec7);return _0x261fd2['set'](_0xd883('0x1b'),_0x26697d+'-'+_0x5ed10a+'/'+_0x476393)['json'](_0x56b648);}return null;};}function patchUpdates(_0x502869){return function(_0x49d514){try{jsonpatch[_0xd883('0x1c')](_0x49d514,_0x502869,!![]);}catch(_0x295705){return BPromise['reject'](_0x295705);}return _0x49d514[_0xd883('0x1d')]();};}function saveUpdates(_0x1a37d6,_0x81188f){return function(_0x1eb8cf){if(_0x1eb8cf){return _0x1eb8cf['update'](_0x1a37d6)[_0xd883('0x1e')](function(_0x332651){return _0x332651;});}return null;};}function removeEntity(_0xf4b7e9,_0x1fe785){return function(_0x419e4a){if(_0x419e4a){return _0x419e4a['destroy']()[_0xd883('0x1e')](function(){_0xf4b7e9[_0xd883('0x15')](0xcc)[_0xd883('0x16')]();});}};}function handleEntityNotFound(_0x45897a,_0x59ae4e){return function(_0x3ff360){if(!_0x3ff360){_0x45897a['sendStatus'](0x194);}return _0x3ff360;};}function handleError(_0x55d977,_0x4b2c8a){_0x4b2c8a=_0x4b2c8a||0x1f4;return function(_0x21da5e){logger[_0xd883('0x1f')](_0x21da5e[_0xd883('0x20')]);if(_0x21da5e['name']){delete _0x21da5e[_0xd883('0x21')];}_0x55d977[_0xd883('0x15')](_0x4b2c8a)[_0xd883('0x22')](_0x21da5e);};}exports['index']=function(_0x22be37,_0x28c201){var _0x5a35cf={},_0x1b5862={},_0x54c67f={'count':0x0,'rows':[]};var _0x214d51=_[_0xd883('0x23')](db[_0xd883('0x24')][_0xd883('0x25')],function(_0x37e877){return{'name':_0x37e877[_0xd883('0x26')],'type':_0x37e877[_0xd883('0x27')]['key']};});_0x1b5862[_0xd883('0x28')]=_['map'](_0x214d51,_0xd883('0x21'));_0x1b5862['query']=_[_0xd883('0x29')](_0x22be37[_0xd883('0x2a')]);_0x1b5862[_0xd883('0x2b')]=_[_0xd883('0x2c')](_0x1b5862[_0xd883('0x28')],_0x1b5862[_0xd883('0x2a')]);_0x5a35cf[_0xd883('0x2d')]=_['intersection'](_0x1b5862[_0xd883('0x28')],qs[_0xd883('0x2e')](_0x22be37[_0xd883('0x2a')]['fields']));_0x5a35cf[_0xd883('0x2d')]=_0x5a35cf[_0xd883('0x2d')][_0xd883('0x2f')]?_0x5a35cf[_0xd883('0x2d')]:_0x1b5862[_0xd883('0x28')];if(!_0x22be37[_0xd883('0x2a')][_0xd883('0x30')](_0xd883('0x31'))){_0x5a35cf[_0xd883('0x19')]=qs[_0xd883('0x19')](_0x22be37[_0xd883('0x2a')][_0xd883('0x19')]);_0x5a35cf[_0xd883('0x17')]=qs['offset'](_0x22be37['query'][_0xd883('0x17')]);}_0x5a35cf[_0xd883('0x32')]=qs[_0xd883('0x33')](_0x22be37[_0xd883('0x2a')][_0xd883('0x33')]);_0x5a35cf[_0xd883('0x34')]=qs[_0xd883('0x2b')](_[_0xd883('0x35')](_0x22be37[_0xd883('0x2a')],_0x1b5862['filters']),_0x214d51);if(_0x22be37[_0xd883('0x2a')]['filter']){_0x5a35cf['where']=_['merge'](_0x5a35cf[_0xd883('0x34')],{'$or':_['map'](_0x214d51,function(_0x429434){if(_0x429434[_0xd883('0x27')]!==_0xd883('0x36')){var _0x5da2f3={};_0x5da2f3[_0x429434[_0xd883('0x21')]]={'$like':'%'+_0x22be37['query'][_0xd883('0x37')]+'%'};return _0x5da2f3;}})});}_0x5a35cf=_[_0xd883('0x38')]({},_0x5a35cf,_0x22be37[_0xd883('0x39')]);var _0x3754fe={'where':_0x5a35cf[_0xd883('0x34')]};return db[_0xd883('0x24')][_0xd883('0x1a')](_0x3754fe)[_0xd883('0x1e')](function(_0x5cb1cf){_0x54c67f['count']=_0x5cb1cf;if(_0x22be37['query']['includeAll']){_0x5a35cf[_0xd883('0x3a')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd883('0x3b')](_0x5a35cf);})[_0xd883('0x1e')](function(_0x1986ea){_0x54c67f[_0xd883('0x3c')]=_0x1986ea;return _0x54c67f;})['then'](respondWithFilteredResult(_0x28c201,_0x5a35cf))[_0xd883('0x3d')](handleError(_0x28c201,null));};exports[_0xd883('0x3e')]=function(_0xb72272,_0x2497b7){var _0x511ac4={'raw':![],'where':{'id':_0xb72272[_0xd883('0x3f')]['id']}},_0x51ad77={};_0x51ad77['model']=_[_0xd883('0x29')](db['UserProfileSection'][_0xd883('0x25')]);_0x51ad77[_0xd883('0x2a')]=_[_0xd883('0x29')](_0xb72272[_0xd883('0x2a')]);_0x51ad77[_0xd883('0x2b')]=_['intersection'](_0x51ad77[_0xd883('0x28')],_0x51ad77[_0xd883('0x2a')]);_0x511ac4[_0xd883('0x2d')]=_[_0xd883('0x2c')](_0x51ad77['model'],qs[_0xd883('0x2e')](_0xb72272['query'][_0xd883('0x2e')]));_0x511ac4['attributes']=_0x511ac4[_0xd883('0x2d')][_0xd883('0x2f')]?_0x511ac4[_0xd883('0x2d')]:_0x51ad77[_0xd883('0x28')];if(_0xb72272['query'][_0xd883('0x40')]){_0x511ac4[_0xd883('0x3a')]=[{'all':!![]}];}_0x511ac4=_['merge']({},_0x511ac4,_0xb72272[_0xd883('0x39')]);return db[_0xd883('0x24')][_0xd883('0x41')](_0x511ac4)['then'](handleEntityNotFound(_0x2497b7,null))[_0xd883('0x1e')](respondWithResult(_0x2497b7,null))[_0xd883('0x3d')](handleError(_0x2497b7,null));};exports[_0xd883('0x42')]=function(_0x538d21,_0x1db81f){return db[_0xd883('0x24')]['create'](_0x538d21[_0xd883('0x43')],{})['then'](respondWithResult(_0x1db81f,0xc9))['catch'](handleError(_0x1db81f,null));};exports[_0xd883('0x44')]=function(_0x302abd,_0x15db89){if(_0x302abd[_0xd883('0x43')]['id']){delete _0x302abd['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x302abd[_0xd883('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15db89,null))[_0xd883('0x1e')](saveUpdates(_0x302abd['body'],null))[_0xd883('0x1e')](respondWithResult(_0x15db89,null))[_0xd883('0x3d')](handleError(_0x15db89,null));};exports[_0xd883('0x45')]=function(_0x1640db,_0x40b9f0){return db['UserProfileSection']['find']({'where':{'id':_0x1640db[_0xd883('0x3f')]['id']}})[_0xd883('0x1e')](handleEntityNotFound(_0x40b9f0,null))[_0xd883('0x1e')](removeEntity(_0x40b9f0,null))[_0xd883('0x3d')](handleError(_0x40b9f0,null));};exports[_0xd883('0x46')]=function(_0x795787,_0x54f70c){return db[_0xd883('0x24')][_0xd883('0x46')]()['then'](respondWithResult(_0x54f70c,null))[_0xd883('0x3d')](handleError(_0x54f70c,null));}; \ No newline at end of file +var _0x2ec2=['then','destroy','status','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','query','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','limit','undefined','offset','count','set','reject','save'];(function(_0x58dc50,_0x2af0b7){var _0x1fda34=function(_0x5cf61b){while(--_0x5cf61b){_0x58dc50['push'](_0x58dc50['shift']());}};_0x1fda34(++_0x2af0b7);}(_0x2ec2,0x156));var _0x22ec=function(_0x4da4ea,_0x2875d3){_0x4da4ea=_0x4da4ea-0x0;var _0x3cc102=_0x2ec2[_0x4da4ea];return _0x3cc102;};'use strict';var emlformat=require(_0x22ec('0x0'));var rimraf=require(_0x22ec('0x1'));var zipdir=require(_0x22ec('0x2'));var jsonpatch=require(_0x22ec('0x3'));var rp=require(_0x22ec('0x4'));var moment=require(_0x22ec('0x5'));var BPromise=require(_0x22ec('0x6'));var Mustache=require(_0x22ec('0x7'));var util=require(_0x22ec('0x8'));var path=require(_0x22ec('0x9'));var sox=require(_0x22ec('0xa'));var csv=require(_0x22ec('0xb'));var ejs=require(_0x22ec('0xc'));var fs=require('fs');var fs_extra=require(_0x22ec('0xd'));var _=require('lodash');var squel=require(_0x22ec('0xe'));var crypto=require(_0x22ec('0xf'));var jsforce=require(_0x22ec('0x10'));var deskjs=require(_0x22ec('0x11'));var toCsv=require(_0x22ec('0xb'));var querystring=require(_0x22ec('0x12'));var Papa=require(_0x22ec('0x13'));var Redis=require(_0x22ec('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x22ec('0x15'));var as=require(_0x22ec('0x16'));var hardwareService=require(_0x22ec('0x17'));var logger=require(_0x22ec('0x18'))(_0x22ec('0x19'));var utils=require(_0x22ec('0x1a'));var config=require(_0x22ec('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x22ec('0x1c'))['db'];function respondWithStatusCode(_0x4a4b44,_0x6b3460){_0x6b3460=_0x6b3460||0xcc;return function(_0x422812){if(_0x422812){return _0x4a4b44['sendStatus'](_0x6b3460);}return _0x4a4b44['status'](_0x6b3460)[_0x22ec('0x1d')]();};}function respondWithResult(_0x96a82e,_0x1b8166){_0x1b8166=_0x1b8166||0xc8;return function(_0x3617a7){if(_0x3617a7){return _0x96a82e['status'](_0x1b8166)[_0x22ec('0x1e')](_0x3617a7);}};}function respondWithFilteredResult(_0x5cf58c,_0xe4f3ce){return function(_0x3e3112){if(_0x3e3112){var _0x4e2e3f=typeof _0xe4f3ce['offset']==='undefined'&&typeof _0xe4f3ce[_0x22ec('0x1f')]===_0x22ec('0x20');var _0x2e534d=_0x3e3112['count'];var _0x5e166e=_0x4e2e3f?0x0:_0xe4f3ce[_0x22ec('0x21')];var _0xfc628a=_0x4e2e3f?_0x3e3112[_0x22ec('0x22')]:_0xe4f3ce['offset']+_0xe4f3ce[_0x22ec('0x1f')];var _0x5e7fb5;if(_0xfc628a>=_0x2e534d){_0xfc628a=_0x2e534d;_0x5e7fb5=0xc8;}else{_0x5e7fb5=0xce;}_0x5cf58c['status'](_0x5e7fb5);return _0x5cf58c[_0x22ec('0x23')]('Content-Range',_0x5e166e+'-'+_0xfc628a+'/'+_0x2e534d)[_0x22ec('0x1e')](_0x3e3112);}return null;};}function patchUpdates(_0x4038d1){return function(_0x2d28b0){try{jsonpatch['apply'](_0x2d28b0,_0x4038d1,!![]);}catch(_0xb4fcaf){return BPromise[_0x22ec('0x24')](_0xb4fcaf);}return _0x2d28b0[_0x22ec('0x25')]();};}function saveUpdates(_0x1873d6,_0x1b7011){return function(_0x172c4e){if(_0x172c4e){return _0x172c4e['update'](_0x1873d6)[_0x22ec('0x26')](function(_0x4f8553){return _0x4f8553;});}return null;};}function removeEntity(_0x519435,_0x461e3e){return function(_0x4259a1){if(_0x4259a1){return _0x4259a1[_0x22ec('0x27')]()[_0x22ec('0x26')](function(){_0x519435[_0x22ec('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42ad77,_0x536484){return function(_0x40d113){if(!_0x40d113){_0x42ad77['sendStatus'](0x194);}return _0x40d113;};}function handleError(_0x2d2921,_0x5acd9b){_0x5acd9b=_0x5acd9b||0x1f4;return function(_0x2625d8){logger[_0x22ec('0x29')](_0x2625d8[_0x22ec('0x2a')]);if(_0x2625d8[_0x22ec('0x2b')]){delete _0x2625d8[_0x22ec('0x2b')];}_0x2d2921['status'](_0x5acd9b)[_0x22ec('0x2c')](_0x2625d8);};}exports[_0x22ec('0x2d')]=function(_0x41c9ab,_0x4e549b){var _0x4863f3={},_0x11188e={},_0x155d24={'count':0x0,'rows':[]};var _0x5a257e=_[_0x22ec('0x2e')](db[_0x22ec('0x2f')][_0x22ec('0x30')],function(_0x19d1d4){return{'name':_0x19d1d4['fieldName'],'type':_0x19d1d4[_0x22ec('0x31')]['key']};});_0x11188e['model']=_[_0x22ec('0x2e')](_0x5a257e,_0x22ec('0x2b'));_0x11188e[_0x22ec('0x32')]=_['keys'](_0x41c9ab[_0x22ec('0x32')]);_0x11188e['filters']=_[_0x22ec('0x33')](_0x11188e[_0x22ec('0x34')],_0x11188e[_0x22ec('0x32')]);_0x4863f3[_0x22ec('0x35')]=_[_0x22ec('0x33')](_0x11188e[_0x22ec('0x34')],qs[_0x22ec('0x36')](_0x41c9ab[_0x22ec('0x32')][_0x22ec('0x36')]));_0x4863f3[_0x22ec('0x35')]=_0x4863f3[_0x22ec('0x35')][_0x22ec('0x37')]?_0x4863f3[_0x22ec('0x35')]:_0x11188e[_0x22ec('0x34')];if(!_0x41c9ab[_0x22ec('0x32')]['hasOwnProperty']('nolimit')){_0x4863f3[_0x22ec('0x1f')]=qs[_0x22ec('0x1f')](_0x41c9ab['query'][_0x22ec('0x1f')]);_0x4863f3[_0x22ec('0x21')]=qs[_0x22ec('0x21')](_0x41c9ab[_0x22ec('0x32')][_0x22ec('0x21')]);}_0x4863f3[_0x22ec('0x38')]=qs[_0x22ec('0x39')](_0x41c9ab[_0x22ec('0x32')][_0x22ec('0x39')]);_0x4863f3[_0x22ec('0x3a')]=qs[_0x22ec('0x3b')](_[_0x22ec('0x3c')](_0x41c9ab[_0x22ec('0x32')],_0x11188e[_0x22ec('0x3b')]),_0x5a257e);if(_0x41c9ab[_0x22ec('0x32')][_0x22ec('0x3d')]){_0x4863f3['where']=_[_0x22ec('0x3e')](_0x4863f3[_0x22ec('0x3a')],{'$or':_[_0x22ec('0x2e')](_0x5a257e,function(_0x3a1423){if(_0x3a1423[_0x22ec('0x31')]!==_0x22ec('0x3f')){var _0x55beeb={};_0x55beeb[_0x3a1423[_0x22ec('0x2b')]]={'$like':'%'+_0x41c9ab['query'][_0x22ec('0x3d')]+'%'};return _0x55beeb;}})});}_0x4863f3=_[_0x22ec('0x3e')]({},_0x4863f3,_0x41c9ab[_0x22ec('0x40')]);var _0x69ac86={'where':_0x4863f3['where']};return db[_0x22ec('0x2f')][_0x22ec('0x22')](_0x69ac86)['then'](function(_0x5692b8){_0x155d24[_0x22ec('0x22')]=_0x5692b8;if(_0x41c9ab[_0x22ec('0x32')][_0x22ec('0x41')]){_0x4863f3[_0x22ec('0x42')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x4863f3);})[_0x22ec('0x26')](function(_0x23db2c){_0x155d24[_0x22ec('0x43')]=_0x23db2c;return _0x155d24;})[_0x22ec('0x26')](respondWithFilteredResult(_0x4e549b,_0x4863f3))['catch'](handleError(_0x4e549b,null));};exports[_0x22ec('0x44')]=function(_0x259301,_0x356a77){var _0x37528f={'raw':![],'where':{'id':_0x259301[_0x22ec('0x45')]['id']}},_0x3bf462={};_0x3bf462[_0x22ec('0x34')]=_[_0x22ec('0x46')](db[_0x22ec('0x2f')]['rawAttributes']);_0x3bf462[_0x22ec('0x32')]=_[_0x22ec('0x46')](_0x259301[_0x22ec('0x32')]);_0x3bf462[_0x22ec('0x3b')]=_[_0x22ec('0x33')](_0x3bf462['model'],_0x3bf462['query']);_0x37528f[_0x22ec('0x35')]=_[_0x22ec('0x33')](_0x3bf462[_0x22ec('0x34')],qs[_0x22ec('0x36')](_0x259301['query'][_0x22ec('0x36')]));_0x37528f[_0x22ec('0x35')]=_0x37528f['attributes'][_0x22ec('0x37')]?_0x37528f['attributes']:_0x3bf462[_0x22ec('0x34')];if(_0x259301[_0x22ec('0x32')][_0x22ec('0x41')]){_0x37528f[_0x22ec('0x42')]=[{'all':!![]}];}_0x37528f=_[_0x22ec('0x3e')]({},_0x37528f,_0x259301['options']);return db[_0x22ec('0x2f')][_0x22ec('0x47')](_0x37528f)[_0x22ec('0x26')](handleEntityNotFound(_0x356a77,null))[_0x22ec('0x26')](respondWithResult(_0x356a77,null))[_0x22ec('0x48')](handleError(_0x356a77,null));};exports[_0x22ec('0x49')]=function(_0x16d742,_0x109222){return db[_0x22ec('0x2f')][_0x22ec('0x49')](_0x16d742['body'],{})[_0x22ec('0x26')](respondWithResult(_0x109222,0xc9))[_0x22ec('0x48')](handleError(_0x109222,null));};exports['update']=function(_0x2c8ae7,_0x1bc6b1){if(_0x2c8ae7[_0x22ec('0x4a')]['id']){delete _0x2c8ae7[_0x22ec('0x4a')]['id'];}return db[_0x22ec('0x2f')][_0x22ec('0x47')]({'where':{'id':_0x2c8ae7['params']['id']}})[_0x22ec('0x26')](handleEntityNotFound(_0x1bc6b1,null))[_0x22ec('0x26')](saveUpdates(_0x2c8ae7['body'],null))[_0x22ec('0x26')](respondWithResult(_0x1bc6b1,null))['catch'](handleError(_0x1bc6b1,null));};exports[_0x22ec('0x27')]=function(_0x1acea4,_0x39cd6b){return db['UserProfileSection'][_0x22ec('0x47')]({'where':{'id':_0x1acea4[_0x22ec('0x45')]['id']}})[_0x22ec('0x26')](handleEntityNotFound(_0x39cd6b,null))[_0x22ec('0x26')](removeEntity(_0x39cd6b,null))[_0x22ec('0x48')](handleError(_0x39cd6b,null));};exports['describe']=function(_0x5550ac,_0x3ba51b){return db['UserProfileSection'][_0x22ec('0x4b')]()[_0x22ec('0x26')](respondWithResult(_0x3ba51b,null))[_0x22ec('0x48')](handleError(_0x3ba51b,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8fad277..a4602ca 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 _0xada7=['util','../../config/logger','moment','path','rimraf','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x56e423,_0x98016e){var _0x331ddb=function(_0x131190){while(--_0x131190){_0x56e423['push'](_0x56e423['shift']());}};_0x331ddb(++_0x98016e);}(_0xada7,0x113));var _0x7ada=function(_0x981022,_0x179a8a){_0x981022=_0x981022-0x0;var _0x656cd3=_0xada7[_0x981022];return _0x656cd3;};'use strict';var _=require(_0x7ada('0x0'));var util=require(_0x7ada('0x1'));var logger=require(_0x7ada('0x2'))('api');var moment=require(_0x7ada('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ada('0x4'));var rimraf=require(_0x7ada('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x7ada('0x6')]=function(_0x4437ec,_0x178be6){return _0x4437ec['define'](_0x7ada('0x7'),attributes,{'tableName':_0x7ada('0x8'),'paranoid':![],'indexes':[{'name':_0x7ada('0x9'),'fields':[_0x7ada('0xa'),_0x7ada('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5da=['sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','UserProfileSection','compositeIndex'];(function(_0x57953d,_0x2d146e){var _0x1cdf93=function(_0x57b789){while(--_0x57b789){_0x57953d['push'](_0x57953d['shift']());}};_0x1cdf93(++_0x2d146e);}(_0xf5da,0x1a6));var _0xaf5d=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0xf5da[_0x4991d6];return _0x50faf7;};'use strict';var _=require(_0xaf5d('0x0'));var util=require(_0xaf5d('0x1'));var logger=require(_0xaf5d('0x2'))(_0xaf5d('0x3'));var moment=require(_0xaf5d('0x4'));var BPromise=require(_0xaf5d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf5d('0x6'));var rimraf=require(_0xaf5d('0x7'));var config=require(_0xaf5d('0x8'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x4958b4,_0x4a2d4b){return _0x4958b4[_0xaf5d('0x9')](_0xaf5d('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xaf5d('0xb'),'fields':[_0xaf5d('0xc'),_0xaf5d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 53cde1e..3069d6e 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 _0x9fe7=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0xb431f3,_0x34c34d){var _0x109106=function(_0x5a9d38){while(--_0x5a9d38){_0xb431f3['push'](_0xb431f3['shift']());}};_0x109106(++_0x34c34d);}(_0x9fe7,0x1df));var _0x79fe=function(_0x60afad,_0x2ce66a){_0x60afad=_0x60afad-0x0;var _0x377df9=_0x9fe7[_0x60afad];return _0x377df9;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5aef,_0x2ba246,_0x4c8314){return new BPromise(function(_0x24faa0,_0x264323){return client[_0x79fe('0xa')](_0x2a5aef,_0x4c8314)[_0x79fe('0xb')](function(_0xafc7cd){logger['info'](_0x79fe('0xc'),_0x2ba246,_0x79fe('0xd'));logger['debug'](_0x79fe('0xe'),_0x2ba246,_0x79fe('0xd'),JSON[_0x79fe('0xf')](_0xafc7cd));if(_0xafc7cd[_0x79fe('0x10')]){if(_0xafc7cd['error'][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x264323(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}logger[_0x79fe('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x24faa0(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}else{logger[_0x79fe('0x13')](_0x79fe('0xc'),_0x2ba246,'request\x20sent');_0x24faa0(_0xafc7cd[_0x79fe('0x14')][_0x79fe('0x12')]);}})[_0x79fe('0x15')](function(_0x5f0af3){logger['error'](_0x79fe('0xc'),_0x2ba246,_0x5f0af3);_0x264323(_0x5f0af3);});});} \ No newline at end of file +var _0x3a14=['../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4cc960,_0x5e143e){var _0xdf9bc8=function(_0x3cfa90){while(--_0x3cfa90){_0x4cc960['push'](_0x4cc960['shift']());}};_0xdf9bc8(++_0x5e143e);}(_0x3a14,0xdf));var _0x43a1=function(_0x136309,_0x1835c1){_0x136309=_0x136309-0x0;var _0x1f4d18=_0x3a14[_0x136309];return _0x1f4d18;};'use strict';var _=require(_0x43a1('0x0'));var util=require(_0x43a1('0x1'));var moment=require(_0x43a1('0x2'));var BPromise=require(_0x43a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43a1('0x4'));var db=require(_0x43a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x43a1('0x6'))(_0x43a1('0x7'));var config=require(_0x43a1('0x8'));var jayson=require(_0x43a1('0x9'));var client=jayson[_0x43a1('0xa')][_0x43a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5288a2,_0x4f83f8,_0x451941){return new BPromise(function(_0x3c4603,_0x2ebfe1){return client['request'](_0x5288a2,_0x451941)[_0x43a1('0xc')](function(_0x2ed9f6){logger[_0x43a1('0xd')](_0x43a1('0xe'),_0x4f83f8,_0x43a1('0xf'));logger[_0x43a1('0x10')](_0x43a1('0x11'),_0x4f83f8,'request\x20sent',JSON['stringify'](_0x2ed9f6));if(_0x2ed9f6['error']){if(_0x2ed9f6[_0x43a1('0x12')][_0x43a1('0x13')]===0x1f4){logger[_0x43a1('0x12')](_0x43a1('0xe'),_0x4f83f8,_0x2ed9f6[_0x43a1('0x12')][_0x43a1('0x14')]);return _0x2ebfe1(_0x2ed9f6['error'][_0x43a1('0x14')]);}logger[_0x43a1('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x4f83f8,_0x2ed9f6[_0x43a1('0x12')][_0x43a1('0x14')]);return _0x3c4603(_0x2ed9f6['error'][_0x43a1('0x14')]);}else{logger['info'](_0x43a1('0xe'),_0x4f83f8,_0x43a1('0xf'));_0x3c4603(_0x2ed9f6['result'][_0x43a1('0x14')]);}})['catch'](function(_0x3fd7e8){logger[_0x43a1('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x4f83f8,_0x3fd7e8);_0x2ebfe1(_0x3fd7e8);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 84352f4..caf7501 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x39088f,_0x26f71b){var _0x435bfa=function(_0x4b0c61){while(--_0x4b0c61){_0x39088f['push'](_0x39088f['shift']());}};_0x435bfa(++_0x26f71b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xcb91[_0x5951e8];return _0x20a1f5;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x42ad47,_0x2439b1){var _0x53cadd=function(_0x248655){while(--_0x248655){_0x42ad47['push'](_0x42ad47['shift']());}};_0x53cadd(++_0x2439b1);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f8b62bf..70f1b63 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 _0xbc44=['INTEGER','exports'];(function(_0x9eadf8,_0x5d2d9e){var _0x5ce5eb=function(_0xe965c7){while(--_0xe965c7){_0x9eadf8['push'](_0x9eadf8['shift']());}};_0x5ce5eb(++_0x5d2d9e);}(_0xbc44,0xff));var _0x4bc4=function(_0x2abc0c,_0x129d2e){_0x2abc0c=_0x2abc0c-0x0;var _0x4c3e8b=_0xbc44[_0x2abc0c];return _0x4c3e8b;};'use strict';var Sequelize=require('sequelize');module[_0x4bc4('0x0')]={'penalty':{'type':Sequelize[_0x4bc4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5aa1=['exports','INTEGER','sequelize'];(function(_0x4504e7,_0x2ae46f){var _0x98c486=function(_0x2ad867){while(--_0x2ad867){_0x4504e7['push'](_0x4504e7['shift']());}};_0x98c486(++_0x2ae46f);}(_0x5aa1,0x158));var _0x15aa=function(_0x74763b,_0x3adad4){_0x74763b=_0x74763b-0x0;var _0x738f43=_0x5aa1[_0x74763b];return _0x738f43;};'use strict';var Sequelize=require(_0x15aa('0x0'));module[_0x15aa('0x1')]={'penalty':{'type':Sequelize[_0x15aa('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 24ece22..b5b0890 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x5c3d11,_0x589686){var _0x31e455=function(_0x251512){while(--_0x251512){_0x5c3d11['push'](_0x5c3d11['shift']());}};_0x31e455(++_0x589686);}(_0x2675,0x75));var _0x5267=function(_0x40cd6b,_0x58926b){_0x40cd6b=_0x40cd6b-0x0;var _0x5cc670=_0x2675[_0x40cd6b];return _0x5cc670;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','UserSmsQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x53b50e,_0xc49361){var _0x3f8625=function(_0x4ce88b){while(--_0x4ce88b){_0x53b50e['push'](_0x53b50e['shift']());}};_0x3f8625(++_0xc49361);}(_0x524e,0x15e));var _0xe524=function(_0x15f66d,_0x3cb992){_0x15f66d=_0x15f66d-0x0;var _0x2a66cf=_0x524e[_0x15f66d];return _0x2a66cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'user_has_sms_queues','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 313cf3e..be6f113 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 _0xf834=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x1ef2e3,_0x380ec2){var _0x173e11=function(_0x574cb9){while(--_0x574cb9){_0x1ef2e3['push'](_0x1ef2e3['shift']());}};_0x173e11(++_0x380ec2);}(_0xf834,0xf0));var _0x4f83=function(_0x1fb597,_0x10e8b2){_0x1fb597=_0x1fb597-0x0;var _0x51d6b4=_0xf834[_0x1fb597];return _0x51d6b4;};'use strict';var _=require(_0x4f83('0x0'));var util=require(_0x4f83('0x1'));var moment=require(_0x4f83('0x2'));var BPromise=require(_0x4f83('0x3'));var rs=require(_0x4f83('0x4'));var fs=require('fs');var Redis=require(_0x4f83('0x5'));var db=require(_0x4f83('0x6'))['db'];var utils=require(_0x4f83('0x7'));var logger=require(_0x4f83('0x8'))('rpc');var config=require(_0x4f83('0x9'));var jayson=require(_0x4f83('0xa'));var client=jayson['client'][_0x4f83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17b53a,_0x580ac0,_0x2bd7e9){return new BPromise(function(_0x4e34e6,_0x255f32){return client['request'](_0x17b53a,_0x2bd7e9)['then'](function(_0x162cb0){logger[_0x4f83('0xc')](_0x4f83('0xd'),_0x580ac0,_0x4f83('0xe'));logger[_0x4f83('0xf')](_0x4f83('0x10'),_0x580ac0,_0x4f83('0xe'),JSON['stringify'](_0x162cb0));if(_0x162cb0[_0x4f83('0x11')]){if(_0x162cb0['error'][_0x4f83('0x12')]===0x1f4){logger[_0x4f83('0x11')](_0x4f83('0xd'),_0x580ac0,_0x162cb0[_0x4f83('0x11')][_0x4f83('0x13')]);return _0x255f32(_0x162cb0['error'][_0x4f83('0x13')]);}logger[_0x4f83('0x11')](_0x4f83('0xd'),_0x580ac0,_0x162cb0['error']['message']);return _0x4e34e6(_0x162cb0[_0x4f83('0x11')]['message']);}else{logger[_0x4f83('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x580ac0,_0x4f83('0xe'));_0x4e34e6(_0x162cb0[_0x4f83('0x14')][_0x4f83('0x13')]);}})[_0x4f83('0x15')](function(_0x15652d){logger[_0x4f83('0x11')](_0x4f83('0xd'),_0x580ac0,_0x15652d);_0x255f32(_0x15652d);});});} \ No newline at end of file +var _0x8591=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x40042d,_0x3ce810){var _0x3889a1=function(_0x2fdcbb){while(--_0x2fdcbb){_0x40042d['push'](_0x40042d['shift']());}};_0x3889a1(++_0x3ce810);}(_0x8591,0x66));var _0x1859=function(_0x1f93d4,_0x1e2e0a){_0x1f93d4=_0x1f93d4-0x0;var _0xfe08cc=_0x8591[_0x1f93d4];return _0xfe08cc;};'use strict';var _=require(_0x1859('0x0'));var util=require(_0x1859('0x1'));var moment=require(_0x1859('0x2'));var BPromise=require(_0x1859('0x3'));var rs=require(_0x1859('0x4'));var fs=require('fs');var Redis=require(_0x1859('0x5'));var db=require(_0x1859('0x6'))['db'];var utils=require(_0x1859('0x7'));var logger=require(_0x1859('0x8'))(_0x1859('0x9'));var config=require(_0x1859('0xa'));var jayson=require(_0x1859('0xb'));var client=jayson[_0x1859('0xc')][_0x1859('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4d5598,_0x10c31f,_0x174e7a){return new BPromise(function(_0x360824,_0x33896a){return client['request'](_0x4d5598,_0x174e7a)['then'](function(_0x2478f6){logger[_0x1859('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x10c31f,_0x1859('0xf'));logger['debug'](_0x1859('0x10'),_0x10c31f,_0x1859('0xf'),JSON[_0x1859('0x11')](_0x2478f6));if(_0x2478f6[_0x1859('0x12')]){if(_0x2478f6['error']['code']===0x1f4){logger[_0x1859('0x12')](_0x1859('0x13'),_0x10c31f,_0x2478f6['error'][_0x1859('0x14')]);return _0x33896a(_0x2478f6['error']['message']);}logger[_0x1859('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x10c31f,_0x2478f6[_0x1859('0x12')][_0x1859('0x14')]);return _0x360824(_0x2478f6[_0x1859('0x12')][_0x1859('0x14')]);}else{logger[_0x1859('0xe')](_0x1859('0x13'),_0x10c31f,_0x1859('0xf'));_0x360824(_0x2478f6['result'][_0x1859('0x14')]);}})['catch'](function(_0x48b0ae){logger[_0x1859('0x12')](_0x1859('0x13'),_0x10c31f,_0x48b0ae);_0x33896a(_0x48b0ae);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d9f9fe9..397b512 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 _0xe337=['exports','INTEGER','sequelize'];(function(_0x4bfbc9,_0x30d326){var _0x1ab925=function(_0x27ada0){while(--_0x27ada0){_0x4bfbc9['push'](_0x4bfbc9['shift']());}};_0x1ab925(++_0x30d326);}(_0xe337,0x191));var _0x7e33=function(_0x2187b0,_0x10504c){_0x2187b0=_0x2187b0-0x0;var _0x341dc1=_0xe337[_0x2187b0];return _0x341dc1;};'use strict';var Sequelize=require(_0x7e33('0x0'));module[_0x7e33('0x1')]={'UserId':{'type':Sequelize[_0x7e33('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7e33('0x2')]}}; \ No newline at end of file +var _0x49b9=['INTEGER','sequelize','exports'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x49b9,0x154));var _0x949b=function(_0x157416,_0x94217){_0x157416=_0x157416-0x0;var _0x1052ea=_0x49b9[_0x157416];return _0x1052ea;};'use strict';var Sequelize=require(_0x949b('0x0'));module[_0x949b('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x949b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 296bf9f..6a6df0d 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(_0x519b38,_0x57511b){var _0x47a0f9=function(_0x375bae){while(--_0x375bae){_0x519b38['push'](_0x519b38['shift']());}};_0x47a0f9(++_0x57511b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb43dd5,_0x2fc474){var _0x55d7dd=function(_0x14c0c3){while(--_0x14c0c3){_0xb43dd5['push'](_0xb43dd5['shift']());}};_0x55d7dd(++_0x2fc474);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 d5f740d..7f718f8 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2f8125,_0x260435){var _0x332dfb=function(_0x12a258){while(--_0x12a258){_0x2f8125['push'](_0x2f8125['shift']());}};_0x332dfb(++_0x260435);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1dd02e,_0x65089){var _0x100a9e=function(_0x42ba71){while(--_0x42ba71){_0x1dd02e['push'](_0x1dd02e['shift']());}};_0x100a9e(++_0x65089);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xcb91[_0x4bcf38];return _0x4a89be;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 8e7946d..89d4be1 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 _0x482d=['INTEGER'];(function(_0x316aa0,_0x477bd2){var _0x7bcb5b=function(_0x1670c9){while(--_0x1670c9){_0x316aa0['push'](_0x316aa0['shift']());}};_0x7bcb5b(++_0x477bd2);}(_0x482d,0x16c));var _0xd482=function(_0x21593d,_0x3cd744){_0x21593d=_0x21593d-0x0;var _0x16e575=_0x482d[_0x21593d];return _0x16e575;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd482('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e0d=['sequelize','exports'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0x0e0d,0x100));var _0xd0e0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0e0d[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xd0e0('0x0'));module[_0xd0e0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index fc5da3e..ecd8299 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 _0x813f=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x14275a,_0x48f0e){var _0x204c6d=function(_0x4d3a9d){while(--_0x4d3a9d){_0x14275a['push'](_0x14275a['shift']());}};_0x204c6d(++_0x48f0e);}(_0x813f,0xcf));var _0xf813=function(_0x169e7c,_0x525175){_0x169e7c=_0x169e7c-0x0;var _0x38dba0=_0x813f[_0x169e7c];return _0x38dba0;};'use strict';var _=require(_0xf813('0x0'));var util=require(_0xf813('0x1'));var logger=require(_0xf813('0x2'))(_0xf813('0x3'));var moment=require(_0xf813('0x4'));var BPromise=require(_0xf813('0x5'));var rp=require(_0xf813('0x6'));var fs=require('fs');var path=require(_0xf813('0x7'));var rimraf=require('rimraf');var config=require(_0xf813('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x244e5d,_0x357e87){return _0x244e5d[_0xf813('0x9')](_0xf813('0xa'),attributes,{'tableName':_0xf813('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0ea=['exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x26227f,_0x4c1d08){var _0x31a385=function(_0x135a8c){while(--_0x135a8c){_0x26227f['push'](_0x26227f['shift']());}};_0x31a385(++_0x4c1d08);}(_0xa0ea,0xe0));var _0xaa0e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa0ea[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xaa0e('0x0'));var util=require(_0xaa0e('0x1'));var logger=require(_0xaa0e('0x2'))(_0xaa0e('0x3'));var moment=require(_0xaa0e('0x4'));var BPromise=require(_0xaa0e('0x5'));var rp=require(_0xaa0e('0x6'));var fs=require('fs');var path=require(_0xaa0e('0x7'));var rimraf=require('rimraf');var config=require(_0xaa0e('0x8'));var attributes=require(_0xaa0e('0x9'));module[_0xaa0e('0xa')]=function(_0x3a4f6d,_0x593df3){return _0x3a4f6d['define'](_0xaa0e('0xb'),attributes,{'tableName':_0xaa0e('0xc'),'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 65c6de7..2dc5ecc 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 _0x4f69=['error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x4f69,0x1be));var _0x94f6=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0x4f69[_0x30a457];return _0x2ae5cd;};'use strict';var _=require(_0x94f6('0x0'));var util=require(_0x94f6('0x1'));var moment=require('moment');var BPromise=require(_0x94f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94f6('0x3'))['db'];var utils=require(_0x94f6('0x4'));var logger=require(_0x94f6('0x5'))(_0x94f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x94f6('0x7'));var client=jayson[_0x94f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d646a,_0x5c3de8,_0x5535fa){return new BPromise(function(_0x2ea3b6,_0x4bf63a){return client[_0x94f6('0x9')](_0x2d646a,_0x5535fa)['then'](function(_0x51543d){logger[_0x94f6('0xa')](_0x94f6('0xb'),_0x5c3de8,_0x94f6('0xc'));logger[_0x94f6('0xd')](_0x94f6('0xe'),_0x5c3de8,'request\x20sent',JSON[_0x94f6('0xf')](_0x51543d));if(_0x51543d[_0x94f6('0x10')]){if(_0x51543d[_0x94f6('0x10')][_0x94f6('0x11')]===0x1f4){logger[_0x94f6('0x10')](_0x94f6('0xb'),_0x5c3de8,_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);return _0x4bf63a(_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);}logger[_0x94f6('0x10')](_0x94f6('0xb'),_0x5c3de8,_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);return _0x2ea3b6(_0x51543d[_0x94f6('0x10')][_0x94f6('0x12')]);}else{logger[_0x94f6('0xa')](_0x94f6('0xb'),_0x5c3de8,_0x94f6('0xc'));_0x2ea3b6(_0x51543d[_0x94f6('0x13')][_0x94f6('0x12')]);}})[_0x94f6('0x14')](function(_0x3735d3){logger[_0x94f6('0x10')](_0x94f6('0xb'),_0x5c3de8,_0x3735d3);_0x4bf63a(_0x3735d3);});});} \ No newline at end of file +var _0x09a4=['stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2309f9,_0x335abb){var _0x3ea602=function(_0x17de93){while(--_0x17de93){_0x2309f9['push'](_0x2309f9['shift']());}};_0x3ea602(++_0x335abb);}(_0x09a4,0x1a9));var _0x409a=function(_0x547c64,_0x26e343){_0x547c64=_0x547c64-0x0;var _0xa948f1=_0x09a4[_0x547c64];return _0xa948f1;};'use strict';var _=require(_0x409a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x409a('0x1'));var fs=require('fs');var Redis=require(_0x409a('0x2'));var db=require(_0x409a('0x3'))['db'];var utils=require(_0x409a('0x4'));var logger=require(_0x409a('0x5'))(_0x409a('0x6'));var config=require(_0x409a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x409a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2b1c,_0xe7f37,_0x23d24b){return new BPromise(function(_0x56232b,_0x44f0f5){return client[_0x409a('0x9')](_0x5a2b1c,_0x23d24b)[_0x409a('0xa')](function(_0x2dd71e){logger[_0x409a('0xb')](_0x409a('0xc'),_0xe7f37,'request\x20sent');logger[_0x409a('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0xe7f37,_0x409a('0xe'),JSON[_0x409a('0xf')](_0x2dd71e));if(_0x2dd71e['error']){if(_0x2dd71e[_0x409a('0x10')][_0x409a('0x11')]===0x1f4){logger[_0x409a('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0xe7f37,_0x2dd71e[_0x409a('0x10')][_0x409a('0x12')]);return _0x44f0f5(_0x2dd71e[_0x409a('0x10')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xe7f37,_0x2dd71e[_0x409a('0x10')]['message']);return _0x56232b(_0x2dd71e['error'][_0x409a('0x12')]);}else{logger[_0x409a('0xb')](_0x409a('0xc'),_0xe7f37,_0x409a('0xe'));_0x56232b(_0x2dd71e[_0x409a('0x13')][_0x409a('0x12')]);}})['catch'](function(_0x258cd7){logger[_0x409a('0x10')](_0x409a('0xc'),_0xe7f37,_0x258cd7);_0x44f0f5(_0x258cd7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2768c18..30382e2 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4b48d4,_0x286f25){var _0x2f9aa7=function(_0x5a5127){while(--_0x5a5127){_0x4b48d4['push'](_0x4b48d4['shift']());}};_0x2f9aa7(++_0x286f25);}(_0xe706,0xa3));var _0x6e70=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0xe706[_0x55969b];return _0x3d7fc1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x305dc8,_0x2aa7cd){var _0x427688=function(_0x1e8e4f){while(--_0x1e8e4f){_0x305dc8['push'](_0x305dc8['shift']());}};_0x427688(++_0x2aa7cd);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f8a9faf..3ea7c3f 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 _0x7816=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x7816,0x166));var _0x6781=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x7816[_0x1af98d];return _0x3553ea;};'use strict';var Sequelize=require(_0x6781('0x0'));module[_0x6781('0x1')]={'uniqueid':{'type':Sequelize[_0x6781('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6781('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x6781('0x3')},'UserId':{'type':Sequelize[_0x6781('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6781('0x4')],'allowNull':![],'unique':_0x6781('0x5'),'comment':_0x6781('0x3')},'VoiceQueueId':{'type':Sequelize[_0x6781('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x6781('0x4')],'allowNull':![],'unique':_0x6781('0x5'),'comment':_0x6781('0x3')},'penalty':{'type':Sequelize[_0x6781('0x2')](0xb),'defaultValue':0x0,'comment':_0x6781('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6781('0x3')}}; \ No newline at end of file +var _0x5c34=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x4422ad,_0x2856a8){var _0xa11ce7=function(_0x5c7f15){while(--_0x5c7f15){_0x4422ad['push'](_0x4422ad['shift']());}};_0xa11ce7(++_0x2856a8);}(_0x5c34,0x129));var _0x45c3=function(_0x461440,_0x4f40ca){_0x461440=_0x461440-0x0;var _0x389298=_0x5c34[_0x461440];return _0x389298;};'use strict';var Sequelize=require(_0x45c3('0x0'));module[_0x45c3('0x1')]={'uniqueid':{'type':Sequelize[_0x45c3('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x45c3('0x3')},'membername':{'type':Sequelize[_0x45c3('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x45c3('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x45c3('0x4')],'allowNull':![],'unique':_0x45c3('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x45c3('0x2')](0xb),'defaultValue':0x0,'comment':_0x45c3('0x3')},'paused':{'type':Sequelize[_0x45c3('0x2')](0xb),'defaultValue':0x0,'comment':_0x45c3('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f3aeaf1..0eca85e 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 _0x49ff=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5d99dd,_0x4bb40b){var _0x148a26=function(_0x25df5f){while(--_0x25df5f){_0x5d99dd['push'](_0x5d99dd['shift']());}};_0x148a26(++_0x4bb40b);}(_0x49ff,0x192));var _0xf49f=function(_0x1c8559,_0x22e992){_0x1c8559=_0x1c8559-0x0;var _0x2991af=_0x49ff[_0x1c8559];return _0x2991af;};'use strict';var EventEmitter=require(_0xf49f('0x0'));var UserVoiceQueueRt=require(_0xf49f('0x1'))['db'][_0xf49f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf49f('0x3')](0x0);var events={'afterCreate':_0xf49f('0x4'),'afterUpdate':_0xf49f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x757472){return function(_0x518d32,_0x105037,_0x5922db){UserVoiceQueueRtEvents[_0xf49f('0x6')](_0x757472+':'+_0x518d32['id'],_0x518d32);UserVoiceQueueRtEvents[_0xf49f('0x6')](_0x757472,_0x518d32);_0x5922db(null);};}for(var e in events){if(events[_0xf49f('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf49f('0x8')](e,emitEvent(event));}}module[_0xf49f('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2a3b=['UserVoiceQueueRt','setMaxListeners','update','remove','emit','hook','../../mysqldb'];(function(_0x5d3896,_0x2c2e33){var _0x139bcf=function(_0x29c7bf){while(--_0x29c7bf){_0x5d3896['push'](_0x5d3896['shift']());}};_0x139bcf(++_0x2c2e33);}(_0x2a3b,0x172));var _0xb2a3=function(_0x435e16,_0x21c780){_0x435e16=_0x435e16-0x0;var _0xb9477a=_0x2a3b[_0x435e16];return _0xb9477a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xb2a3('0x0'))['db'][_0xb2a3('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb2a3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb2a3('0x3'),'afterDestroy':_0xb2a3('0x4')};function emitEvent(_0x1f5719){return function(_0x12d81f,_0xb54eb2,_0x270cf0){UserVoiceQueueRtEvents[_0xb2a3('0x5')](_0x1f5719+':'+_0x12d81f['id'],_0x12d81f);UserVoiceQueueRtEvents[_0xb2a3('0x5')](_0x1f5719,_0x12d81f);_0x270cf0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xb2a3('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1283d54..29a7f5d 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 _0xc88a=['bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x2b635f,_0x583e0d){var _0x488d04=function(_0x178261){while(--_0x178261){_0x2b635f['push'](_0x2b635f['shift']());}};_0x488d04(++_0x583e0d);}(_0xc88a,0xd4));var _0xac88=function(_0x28664b,_0x1dcf95){_0x28664b=_0x28664b-0x0;var _0x5b1f0=_0xc88a[_0x28664b];return _0x5b1f0;};'use strict';var _=require(_0xac88('0x0'));var util=require(_0xac88('0x1'));var logger=require(_0xac88('0x2'))(_0xac88('0x3'));var moment=require('moment');var BPromise=require(_0xac88('0x4'));var rp=require(_0xac88('0x5'));var fs=require('fs');var path=require(_0xac88('0x6'));var rimraf=require(_0xac88('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xac88('0x8')]=function(_0x53a20c,_0x1d284c){return _0x53a20c[_0xac88('0x9')](_0xac88('0xa'),attributes,{'tableName':_0xac88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x726e=['../../config/environment','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b1ec0,_0xeddd47){var _0x1519c7=function(_0x31d1af){while(--_0x31d1af){_0x5b1ec0['push'](_0x5b1ec0['shift']());}};_0x1519c7(++_0xeddd47);}(_0x726e,0x100));var _0xe726=function(_0x49fe12,_0x5a6532){_0x49fe12=_0x49fe12-0x0;var _0x566134=_0x726e[_0x49fe12];return _0x566134;};'use strict';var _=require(_0xe726('0x0'));var util=require(_0xe726('0x1'));var logger=require(_0xe726('0x2'))('api');var moment=require(_0xe726('0x3'));var BPromise=require(_0xe726('0x4'));var rp=require(_0xe726('0x5'));var fs=require('fs');var path=require(_0xe726('0x6'));var rimraf=require(_0xe726('0x7'));var config=require(_0xe726('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x180fd6,_0x464b75){return _0x180fd6[_0xe726('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xe726('0xa'),'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 e1652ec..3047077 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 _0xaef6=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3fe85c,_0x7f00c8){var _0x5eb1cc=function(_0x5312b7){while(--_0x5312b7){_0x3fe85c['push'](_0x3fe85c['shift']());}};_0x5eb1cc(++_0x7f00c8);}(_0xaef6,0x7e));var _0x6aef=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaef6[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x6aef('0x0'));var util=require(_0x6aef('0x1'));var moment=require(_0x6aef('0x2'));var BPromise=require(_0x6aef('0x3'));var rs=require(_0x6aef('0x4'));var fs=require('fs');var Redis=require(_0x6aef('0x5'));var db=require(_0x6aef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6aef('0x7'));var config=require(_0x6aef('0x8'));var jayson=require(_0x6aef('0x9'));var client=jayson[_0x6aef('0xa')][_0x6aef('0xb')]({'port':0x232a});config[_0x6aef('0xc')]=_[_0x6aef('0xd')](config[_0x6aef('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6aef('0xe'))(new Redis(config[_0x6aef('0xc')]));require(_0x6aef('0xf'))[_0x6aef('0x10')](socket);function respondWithRpcPromise(_0x518a20,_0xa767af,_0x45705b){return new BPromise(function(_0x1472a5,_0x3ed8e8){return client[_0x6aef('0x11')](_0x518a20,_0x45705b)[_0x6aef('0x12')](function(_0x3668ad){logger[_0x6aef('0x13')](_0x6aef('0x14'),_0xa767af,_0x6aef('0x15'));logger[_0x6aef('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xa767af,_0x6aef('0x15'),JSON['stringify'](_0x3668ad));if(_0x3668ad[_0x6aef('0x17')]){if(_0x3668ad[_0x6aef('0x17')][_0x6aef('0x18')]===0x1f4){logger[_0x6aef('0x17')](_0x6aef('0x14'),_0xa767af,_0x3668ad[_0x6aef('0x17')][_0x6aef('0x19')]);return _0x3ed8e8(_0x3668ad[_0x6aef('0x17')]['message']);}logger[_0x6aef('0x17')](_0x6aef('0x14'),_0xa767af,_0x3668ad[_0x6aef('0x17')]['message']);return _0x1472a5(_0x3668ad[_0x6aef('0x17')][_0x6aef('0x19')]);}else{logger[_0x6aef('0x13')](_0x6aef('0x14'),_0xa767af,_0x6aef('0x15'));_0x1472a5(_0x3668ad['result'][_0x6aef('0x19')]);}})[_0x6aef('0x1a')](function(_0x23b45a){logger['error'](_0x6aef('0x14'),_0xa767af,_0x23b45a);_0x3ed8e8(_0x23b45a);});});}exports[_0x6aef('0x1b')]=function(_0xa71fcb){var _0x5206c8=this;return new Promise(function(_0x2b0a19,_0x1d48a3){return db['UserVoiceQueueRt'][_0x6aef('0x1c')]({'raw':_0xa71fcb['options']?_0xa71fcb[_0x6aef('0x1d')][_0x6aef('0x1e')]===undefined?!![]:![]:!![],'where':_0xa71fcb[_0x6aef('0x1d')]?_0xa71fcb[_0x6aef('0x1d')][_0x6aef('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x6aef('0x20')]['fn']('IF',db[_0x6aef('0x20')]['literal'](_0x6aef('0x21')))),'outboundQueuePauses']]})[_0x6aef('0x12')](function(_0x40b36f){logger['info'](_0x6aef('0x1b'),_0xa71fcb);logger[_0x6aef('0x16')](_0x6aef('0x1b'),_0xa71fcb,JSON[_0x6aef('0x22')](_0x40b36f));_0x2b0a19(_0x40b36f);})[_0x6aef('0x1a')](function(_0x53d147){logger[_0x6aef('0x17')](_0x6aef('0x1b'),_0x53d147['message'],_0xa71fcb);_0x1d48a3(_0x5206c8[_0x6aef('0x17')](0x1f4,_0x53d147[_0x6aef('0x19')]));});});}; \ No newline at end of file +var _0x29fe=['http','defaults','localhost','redis','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','then','GetVoiceQueueRtPauses','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x29fe,0x69));var _0xe29f=function(_0x368c72,_0x1dd70e){_0x368c72=_0x368c72-0x0;var _0x4c42d6=_0x29fe[_0x368c72];return _0x4c42d6;};'use strict';var _=require(_0xe29f('0x0'));var util=require(_0xe29f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe29f('0x2'));var fs=require('fs');var Redis=require(_0xe29f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe29f('0x4'));var logger=require(_0xe29f('0x5'))('rpc');var config=require(_0xe29f('0x6'));var jayson=require(_0xe29f('0x7'));var client=jayson[_0xe29f('0x8')][_0xe29f('0x9')]({'port':0x232a});config['redis']=_[_0xe29f('0xa')](config['redis'],{'host':_0xe29f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe29f('0xc')]));require(_0xe29f('0xd'))[_0xe29f('0xe')](socket);function respondWithRpcPromise(_0x38bc41,_0xff0291,_0x5c0a1f){return new BPromise(function(_0x28051a,_0x9cf76e){return client[_0xe29f('0xf')](_0x38bc41,_0x5c0a1f)['then'](function(_0x4bc4a7){logger[_0xe29f('0x10')](_0xe29f('0x11'),_0xff0291,_0xe29f('0x12'));logger[_0xe29f('0x13')](_0xe29f('0x14'),_0xff0291,'request\x20sent',JSON[_0xe29f('0x15')](_0x4bc4a7));if(_0x4bc4a7[_0xe29f('0x16')]){if(_0x4bc4a7['error'][_0xe29f('0x17')]===0x1f4){logger[_0xe29f('0x16')](_0xe29f('0x11'),_0xff0291,_0x4bc4a7[_0xe29f('0x16')][_0xe29f('0x18')]);return _0x9cf76e(_0x4bc4a7[_0xe29f('0x16')][_0xe29f('0x18')]);}logger[_0xe29f('0x16')](_0xe29f('0x11'),_0xff0291,_0x4bc4a7[_0xe29f('0x16')][_0xe29f('0x18')]);return _0x28051a(_0x4bc4a7['error'][_0xe29f('0x18')]);}else{logger[_0xe29f('0x10')](_0xe29f('0x11'),_0xff0291,'request\x20sent');_0x28051a(_0x4bc4a7[_0xe29f('0x19')][_0xe29f('0x18')]);}})[_0xe29f('0x1a')](function(_0x252f80){logger[_0xe29f('0x16')](_0xe29f('0x11'),_0xff0291,_0x252f80);_0x9cf76e(_0x252f80);});});}exports['GetVoiceQueueRtPauses']=function(_0x30257e){var _0x10a761=this;return new Promise(function(_0x5cec68,_0xa26ae3){return db[_0xe29f('0x1b')][_0xe29f('0x1c')]({'raw':_0x30257e[_0xe29f('0x1d')]?_0x30257e[_0xe29f('0x1d')][_0xe29f('0x1e')]===undefined?!![]:![]:!![],'where':_0x30257e['options']?_0x30257e[_0xe29f('0x1d')][_0xe29f('0x1f')]||null:null,'attributes':[[db[_0xe29f('0x20')]['fn'](_0xe29f('0x21'),db[_0xe29f('0x20')]['fn']('IF',db[_0xe29f('0x20')][_0xe29f('0x22')](_0xe29f('0x23')))),'outboundQueuePauses']]})[_0xe29f('0x24')](function(_0x112afc){logger['info'](_0xe29f('0x25'),_0x30257e);logger[_0xe29f('0x13')]('GetVoiceQueueRtPauses',_0x30257e,JSON[_0xe29f('0x15')](_0x112afc));_0x5cec68(_0x112afc);})[_0xe29f('0x1a')](function(_0xf79b41){logger['error'](_0xe29f('0x25'),_0xf79b41['message'],_0x30257e);_0xa26ae3(_0x10a761[_0xe29f('0x16')](0x1f4,_0xf79b41[_0xe29f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index df4b35b..f80cb3e 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 _0x7046=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var UserVoiceQueueRtEvents=require(_0x6704('0x0'));var events=[_0x6704('0x1'),_0x6704('0x2'),_0x6704('0x3')];function createListener(_0x54a895,_0x1fd895){return function(_0x4399c6){_0x1fd895[_0x6704('0x4')](_0x54a895,_0x4399c6);};}function removeListener(_0x5258e7,_0x1e9b2a){return function(){UserVoiceQueueRtEvents[_0x6704('0x5')](_0x5258e7,_0x1e9b2a);};}exports[_0x6704('0x6')]=function(_0x626a14){for(var _0x2917be=0x0,_0x4badf8=events[_0x6704('0x7')];_0x2917be<_0x4badf8;_0x2917be++){var _0x49b8b6=events[_0x2917be];var _0x56b1ff=createListener(_0x6704('0x8')+_0x49b8b6,_0x626a14);UserVoiceQueueRtEvents['on'](_0x49b8b6,_0x56b1ff);}}; \ No newline at end of file +var _0xd206=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd206,0x107));var _0x6d20=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xd206[_0x4ae6ef];return _0x3cbb4e;};'use strict';var UserVoiceQueueRtEvents=require(_0x6d20('0x0'));var events=[_0x6d20('0x1'),'remove',_0x6d20('0x2')];function createListener(_0x2a6fc3,_0xbf89ef){return function(_0x580523){_0xbf89ef[_0x6d20('0x3')](_0x2a6fc3,_0x580523);};}function removeListener(_0x28bc49,_0x243da3){return function(){UserVoiceQueueRtEvents[_0x6d20('0x4')](_0x28bc49,_0x243da3);};}exports['register']=function(_0x467e6e){for(var _0x5c5950=0x0,_0x4dc981=events[_0x6d20('0x5')];_0x5c5950<_0x4dc981;_0x5c5950++){var _0x3080fb=events[_0x5c5950];var _0x5b4154=createListener(_0x6d20('0x6')+_0x3080fb,_0x467e6e);UserVoiceQueueRtEvents['on'](_0x3080fb,_0x5b4154);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 171a1d8..452847e 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4692ed,_0x3e4769){var _0x481b53=function(_0x4954c1){while(--_0x4954c1){_0x4692ed['push'](_0x4692ed['shift']());}};_0x481b53(++_0x3e4769);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xcb91[_0x872b02];return _0x1a6b24;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x18aca6,_0x12f9b7){var _0x393027=function(_0x237ec1){while(--_0x237ec1){_0x18aca6['push'](_0x18aca6['shift']());}};_0x393027(++_0x12f9b7);}(_0x70e0,0x17b));var _0x070e=function(_0x200b2b,_0x1b0996){_0x200b2b=_0x200b2b-0x0;var _0x1340c7=_0x70e0[_0x200b2b];return _0x1340c7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d7e774c..70bcd4b 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 _0x677a=['exports','INTEGER'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0x677a,0xee));var _0xa677=function(_0x388cf8,_0x5f0ba3){_0x388cf8=_0x388cf8-0x0;var _0xbe7acf=_0x677a[_0x388cf8];return _0xbe7acf;};'use strict';var Sequelize=require('sequelize');module[_0xa677('0x0')]={'penalty':{'type':Sequelize[_0xa677('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x33fb=['exports','INTEGER'];(function(_0x5a8bb4,_0x10fab8){var _0x156a15=function(_0x26474b){while(--_0x26474b){_0x5a8bb4['push'](_0x5a8bb4['shift']());}};_0x156a15(++_0x10fab8);}(_0x33fb,0xaa));var _0xb33f=function(_0x16ce21,_0x280469){_0x16ce21=_0x16ce21-0x0;var _0x2ba3ea=_0x33fb[_0x16ce21];return _0x2ba3ea;};'use strict';var Sequelize=require('sequelize');module[_0xb33f('0x0')]={'penalty':{'type':Sequelize[_0xb33f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c19df51..944b0d6 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 _0x8e8d=['user_has_whatsapp_queues','api','moment','bluebird','request-promise','path','exports','UserWhatsappQueue'];(function(_0x15000c,_0x19dba1){var _0x59c273=function(_0x2a3274){while(--_0x2a3274){_0x15000c['push'](_0x15000c['shift']());}};_0x59c273(++_0x19dba1);}(_0x8e8d,0xd1));var _0xd8e8=function(_0xcaeee7,_0xa6e639){_0xcaeee7=_0xcaeee7-0x0;var _0x3cb526=_0x8e8d[_0xcaeee7];return _0x3cb526;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd8e8('0x0'));var moment=require(_0xd8e8('0x1'));var BPromise=require(_0xd8e8('0x2'));var rp=require(_0xd8e8('0x3'));var fs=require('fs');var path=require(_0xd8e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xd8e8('0x5')]=function(_0x57b96d,_0x30a359){return _0x57b96d['define'](_0xd8e8('0x6'),attributes,{'tableName':_0xd8e8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8e8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x587805,_0x164a4a){var _0x493ab6=function(_0x4c703a){while(--_0x4c703a){_0x587805['push'](_0x587805['shift']());}};_0x493ab6(++_0x164a4a);}(_0xe8e8,0x1b0));var _0x8e8e=function(_0x44e681,_0x20db64){_0x44e681=_0x44e681-0x0;var _0x54b06d=_0xe8e8[_0x44e681];return _0x54b06d;};'use strict';var _=require('lodash');var util=require(_0x8e8e('0x0'));var logger=require(_0x8e8e('0x1'))(_0x8e8e('0x2'));var moment=require('moment');var BPromise=require(_0x8e8e('0x3'));var rp=require(_0x8e8e('0x4'));var fs=require('fs');var path=require(_0x8e8e('0x5'));var rimraf=require(_0x8e8e('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e8e('0x7'));module[_0x8e8e('0x8')]=function(_0x50d834,_0x140738){return _0x50d834[_0x8e8e('0x9')](_0x8e8e('0xa'),attributes,{'tableName':_0x8e8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 2d298a8..f17eabf 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 _0xc10c=['http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xfac06,_0x2c5ee7){var _0x1e38ee=function(_0x5453d0){while(--_0x5453d0){_0xfac06['push'](_0xfac06['shift']());}};_0x1e38ee(++_0x2c5ee7);}(_0xc10c,0x1cf));var _0xcc10=function(_0x12de6d,_0x4ed177){_0x12de6d=_0x12de6d-0x0;var _0x567eb7=_0xc10c[_0x12de6d];return _0x567eb7;};'use strict';var _=require(_0xcc10('0x0'));var util=require(_0xcc10('0x1'));var moment=require(_0xcc10('0x2'));var BPromise=require(_0xcc10('0x3'));var rs=require(_0xcc10('0x4'));var fs=require('fs');var Redis=require(_0xcc10('0x5'));var db=require(_0xcc10('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc10('0x7'))(_0xcc10('0x8'));var config=require(_0xcc10('0x9'));var jayson=require(_0xcc10('0xa'));var client=jayson[_0xcc10('0xb')][_0xcc10('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29eb96,_0x20a374,_0x3c555c){return new BPromise(function(_0x441162,_0x397ae9){return client['request'](_0x29eb96,_0x3c555c)[_0xcc10('0xd')](function(_0x590e1f){logger[_0xcc10('0xe')](_0xcc10('0xf'),_0x20a374,_0xcc10('0x10'));logger[_0xcc10('0x11')](_0xcc10('0x12'),_0x20a374,_0xcc10('0x10'),JSON[_0xcc10('0x13')](_0x590e1f));if(_0x590e1f[_0xcc10('0x14')]){if(_0x590e1f[_0xcc10('0x14')][_0xcc10('0x15')]===0x1f4){logger[_0xcc10('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20a374,_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);return _0x397ae9(_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);}logger[_0xcc10('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20a374,_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);return _0x441162(_0x590e1f[_0xcc10('0x14')][_0xcc10('0x16')]);}else{logger[_0xcc10('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x20a374,_0xcc10('0x10'));_0x441162(_0x590e1f[_0xcc10('0x17')][_0xcc10('0x16')]);}})[_0xcc10('0x18')](function(_0x503c6d){logger[_0xcc10('0x14')](_0xcc10('0xf'),_0x20a374,_0x503c6d);_0x397ae9(_0x503c6d);});});} \ No newline at end of file +var _0xe12b=['../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11238d,_0x499ac8){var _0x3686b0=function(_0x1b7cbc){while(--_0x1b7cbc){_0x11238d['push'](_0x11238d['shift']());}};_0x3686b0(++_0x499ac8);}(_0xe12b,0xc8));var _0xbe12=function(_0x34aaff,_0x5ca8a1){_0x34aaff=_0x34aaff-0x0;var _0x142c27=_0xe12b[_0x34aaff];return _0x142c27;};'use strict';var _=require(_0xbe12('0x0'));var util=require(_0xbe12('0x1'));var moment=require(_0xbe12('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe12('0x3'));var fs=require('fs');var Redis=require(_0xbe12('0x4'));var db=require(_0xbe12('0x5'))['db'];var utils=require(_0xbe12('0x6'));var logger=require(_0xbe12('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe12('0x8'));var client=jayson['client'][_0xbe12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x318acf,_0x40f8cd,_0x1562d5){return new BPromise(function(_0xd1af73,_0x1410fd){return client[_0xbe12('0xa')](_0x318acf,_0x1562d5)[_0xbe12('0xb')](function(_0x2f6bc4){logger[_0xbe12('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x40f8cd,_0xbe12('0xd'));logger[_0xbe12('0xe')](_0xbe12('0xf'),_0x40f8cd,_0xbe12('0xd'),JSON[_0xbe12('0x10')](_0x2f6bc4));if(_0x2f6bc4['error']){if(_0x2f6bc4[_0xbe12('0x11')][_0xbe12('0x12')]===0x1f4){logger[_0xbe12('0x11')](_0xbe12('0x13'),_0x40f8cd,_0x2f6bc4[_0xbe12('0x11')][_0xbe12('0x14')]);return _0x1410fd(_0x2f6bc4[_0xbe12('0x11')][_0xbe12('0x14')]);}logger['error'](_0xbe12('0x13'),_0x40f8cd,_0x2f6bc4[_0xbe12('0x11')]['message']);return _0xd1af73(_0x2f6bc4[_0xbe12('0x11')][_0xbe12('0x14')]);}else{logger[_0xbe12('0xc')](_0xbe12('0x13'),_0x40f8cd,_0xbe12('0xd'));_0xd1af73(_0x2f6bc4[_0xbe12('0x15')][_0xbe12('0x14')]);}})[_0xbe12('0x16')](function(_0x3680eb){logger[_0xbe12('0x11')](_0xbe12('0x13'),_0x40f8cd,_0x3680eb);_0x1410fd(_0x3680eb);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5e9ff55..ef131aa 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 _0x66fa=['create','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x405458,_0x101ac8){var _0x319511=function(_0x16c958){while(--_0x16c958){_0x405458['push'](_0x405458['shift']());}};_0x319511(++_0x101ac8);}(_0x66fa,0x168));var _0xa66f=function(_0x28240c,_0x3fd8c5){_0x28240c=_0x28240c-0x0;var _0x5c140b=_0x66fa[_0x28240c];return _0x5c140b;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require(_0xa66f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa66f('0x3')]();var fs_extra=require(_0xa66f('0x4'));var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router[_0xa66f('0x9')]('/',auth[_0xa66f('0xa')](),controller[_0xa66f('0xb')]);router[_0xa66f('0x9')](_0xa66f('0xc'),auth['isAuthenticated'](),controller[_0xa66f('0xd')]);router['post']('/',auth[_0xa66f('0xa')](),controller[_0xa66f('0xe')]);router['put'](_0xa66f('0xc'),auth[_0xa66f('0xa')](),controller[_0xa66f('0xf')]);router[_0xa66f('0x10')](_0xa66f('0xc'),auth[_0xa66f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xea03=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','./variable.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x42490d,_0x1d07be){var _0x48d18c=function(_0x4ac0b9){while(--_0x4ac0b9){_0x42490d['push'](_0x42490d['shift']());}};_0x48d18c(++_0x1d07be);}(_0xea03,0x1ba));var _0x3ea0=function(_0x5ad60a,_0x5262c5){_0x5ad60a=_0x5ad60a-0x0;var _0x266de2=_0xea03[_0x5ad60a];return _0x266de2;};'use strict';var multer=require(_0x3ea0('0x0'));var util=require('util');var path=require(_0x3ea0('0x1'));var timeout=require(_0x3ea0('0x2'));var express=require(_0x3ea0('0x3'));var router=express[_0x3ea0('0x4')]();var fs_extra=require(_0x3ea0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ea0('0x6'));router[_0x3ea0('0x7')]('/',auth[_0x3ea0('0x8')](),controller[_0x3ea0('0x9')]);router[_0x3ea0('0x7')]('/:id',auth[_0x3ea0('0x8')](),controller[_0x3ea0('0xa')]);router[_0x3ea0('0xb')]('/',auth[_0x3ea0('0x8')](),controller[_0x3ea0('0xc')]);router[_0x3ea0('0xd')](_0x3ea0('0xe'),auth['isAuthenticated'](),controller[_0x3ea0('0xf')]);router[_0x3ea0('0x10')](_0x3ea0('0xe'),auth['isAuthenticated'](),controller[_0x3ea0('0x11')]);module[_0x3ea0('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f483c65..eae2774 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 _0xa4b0=['name','sequelize','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x99dfa5,_0x313bc1){_0x99dfa5=_0x99dfa5-0x0;var _0xbaa181=_0xa4b0[_0x99dfa5];return _0xbaa181;};'use strict';var Sequelize=require(_0x0a4b('0x0'));module[_0x0a4b('0x1')]={'name':{'type':Sequelize[_0x0a4b('0x2')],'unique':_0x0a4b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65a0=['STRING','sequelize','exports','name'];(function(_0x2ccc71,_0x1c458a){var _0x20fa15=function(_0x320e61){while(--_0x320e61){_0x2ccc71['push'](_0x2ccc71['shift']());}};_0x20fa15(++_0x1c458a);}(_0x65a0,0x89));var _0x065a=function(_0x1dbdf3,_0x164544){_0x1dbdf3=_0x1dbdf3-0x0;var _0x1191b5=_0x65a0[_0x1dbdf3];return _0x1191b5;};'use strict';var Sequelize=require(_0x065a('0x0'));module[_0x065a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x065a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x065a('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index ed7c52f..99a3785 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 _0xdea6=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','merge','VIRTUAL','filter','findAll','catch','params','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','name','send','map','Variable','rawAttributes','fieldName','type','model'];(function(_0x54b56d,_0x43cee0){var _0x29e581=function(_0x2d0f0f){while(--_0x2d0f0f){_0x54b56d['push'](_0x54b56d['shift']());}};_0x29e581(++_0x43cee0);}(_0xdea6,0xbd));var _0x6dea=function(_0x4ce462,_0x321f80){_0x4ce462=_0x4ce462-0x0;var _0x252492=_0xdea6[_0x4ce462];return _0x252492;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dea('0x0'));var zipdir=require(_0x6dea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6dea('0x2'));var moment=require(_0x6dea('0x3'));var BPromise=require(_0x6dea('0x4'));var Mustache=require(_0x6dea('0x5'));var util=require(_0x6dea('0x6'));var path=require('path');var sox=require(_0x6dea('0x7'));var csv=require(_0x6dea('0x8'));var ejs=require(_0x6dea('0x9'));var fs=require('fs');var fs_extra=require(_0x6dea('0xa'));var _=require(_0x6dea('0xb'));var squel=require(_0x6dea('0xc'));var crypto=require('crypto');var jsforce=require(_0x6dea('0xd'));var deskjs=require(_0x6dea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6dea('0xf'));var Papa=require(_0x6dea('0x10'));var Redis=require(_0x6dea('0x11'));var authService=require(_0x6dea('0x12'));var qs=require(_0x6dea('0x13'));var as=require(_0x6dea('0x14'));var hardwareService=require(_0x6dea('0x15'));var logger=require(_0x6dea('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x6dea('0x17'));var licenseUtil=require(_0x6dea('0x18'));var db=require(_0x6dea('0x19'))['db'];function respondWithStatusCode(_0x1162c9,_0x3d0ced){_0x3d0ced=_0x3d0ced||0xcc;return function(_0x408f8d){if(_0x408f8d){return _0x1162c9['sendStatus'](_0x3d0ced);}return _0x1162c9[_0x6dea('0x1a')](_0x3d0ced)[_0x6dea('0x1b')]();};}function respondWithResult(_0x344852,_0x4a24e2){_0x4a24e2=_0x4a24e2||0xc8;return function(_0x11f2cd){if(_0x11f2cd){return _0x344852[_0x6dea('0x1a')](_0x4a24e2)[_0x6dea('0x1c')](_0x11f2cd);}};}function respondWithFilteredResult(_0x234ab2,_0x5547e4){return function(_0x29d914){if(_0x29d914){var _0x1a1f7d=typeof _0x5547e4[_0x6dea('0x1d')]===_0x6dea('0x1e')&&typeof _0x5547e4[_0x6dea('0x1f')]===_0x6dea('0x1e');var _0x1b3081=_0x29d914[_0x6dea('0x20')];var _0x1b4f3f=_0x1a1f7d?0x0:_0x5547e4['offset'];var _0x5b1071=_0x1a1f7d?_0x29d914['count']:_0x5547e4[_0x6dea('0x1d')]+_0x5547e4[_0x6dea('0x1f')];var _0x2be62b;if(_0x5b1071>=_0x1b3081){_0x5b1071=_0x1b3081;_0x2be62b=0xc8;}else{_0x2be62b=0xce;}_0x234ab2[_0x6dea('0x1a')](_0x2be62b);return _0x234ab2[_0x6dea('0x21')](_0x6dea('0x22'),_0x1b4f3f+'-'+_0x5b1071+'/'+_0x1b3081)[_0x6dea('0x1c')](_0x29d914);}return null;};}function patchUpdates(_0x339086){return function(_0x507b68){try{jsonpatch[_0x6dea('0x23')](_0x507b68,_0x339086,!![]);}catch(_0x522dba){return BPromise[_0x6dea('0x24')](_0x522dba);}return _0x507b68[_0x6dea('0x25')]();};}function saveUpdates(_0x146fd1,_0x54bfdd){return function(_0x93eec){if(_0x93eec){return _0x93eec[_0x6dea('0x26')](_0x146fd1)[_0x6dea('0x27')](function(_0x1ee017){return _0x1ee017;});}return null;};}function removeEntity(_0x123654,_0xecda3d){return function(_0x4efbb0){if(_0x4efbb0){return _0x4efbb0[_0x6dea('0x28')]()[_0x6dea('0x27')](function(){var _0x27fe58=_0x4efbb0[_0x6dea('0x29')]({'plain':!![]});var _0x329cae=_0x6dea('0x2a');return db[_0x6dea('0x2b')][_0x6dea('0x28')]({'where':{'type':_0x329cae,'resourceId':_0x27fe58['id']}})[_0x6dea('0x27')](function(){return _0x4efbb0;});})['then'](function(){_0x123654[_0x6dea('0x1a')](0xcc)[_0x6dea('0x1b')]();});}};}function handleEntityNotFound(_0x691c04,_0x4b7890){return function(_0xf891df){if(!_0xf891df){_0x691c04[_0x6dea('0x2c')](0x194);}return _0xf891df;};}function handleError(_0x3c83d2,_0x5bf447){_0x5bf447=_0x5bf447||0x1f4;return function(_0x37d002){logger[_0x6dea('0x2d')](_0x37d002['stack']);if(_0x37d002[_0x6dea('0x2e')]){delete _0x37d002[_0x6dea('0x2e')];}_0x3c83d2[_0x6dea('0x1a')](_0x5bf447)[_0x6dea('0x2f')](_0x37d002);};}exports['index']=function(_0x54a7d5,_0x4b1694){var _0x105c0a={},_0x52cd49={},_0x5db05e={'count':0x0,'rows':[]};var _0x56ea22=_[_0x6dea('0x30')](db[_0x6dea('0x31')][_0x6dea('0x32')],function(_0x416f6a){return{'name':_0x416f6a[_0x6dea('0x33')],'type':_0x416f6a[_0x6dea('0x34')]['key']};});_0x52cd49[_0x6dea('0x35')]=_[_0x6dea('0x30')](_0x56ea22,'name');_0x52cd49[_0x6dea('0x36')]=_[_0x6dea('0x37')](_0x54a7d5['query']);_0x52cd49[_0x6dea('0x38')]=_[_0x6dea('0x39')](_0x52cd49['model'],_0x52cd49[_0x6dea('0x36')]);_0x105c0a[_0x6dea('0x3a')]=_[_0x6dea('0x39')](_0x52cd49['model'],qs['fields'](_0x54a7d5[_0x6dea('0x36')][_0x6dea('0x3b')]));_0x105c0a['attributes']=_0x105c0a[_0x6dea('0x3a')][_0x6dea('0x3c')]?_0x105c0a[_0x6dea('0x3a')]:_0x52cd49[_0x6dea('0x35')];if(!_0x54a7d5[_0x6dea('0x36')][_0x6dea('0x3d')]('nolimit')){_0x105c0a['limit']=qs[_0x6dea('0x1f')](_0x54a7d5[_0x6dea('0x36')]['limit']);_0x105c0a[_0x6dea('0x1d')]=qs[_0x6dea('0x1d')](_0x54a7d5[_0x6dea('0x36')]['offset']);}_0x105c0a[_0x6dea('0x3e')]=qs['sort'](_0x54a7d5[_0x6dea('0x36')]['sort']);_0x105c0a['where']=qs[_0x6dea('0x38')](_['pick'](_0x54a7d5['query'],_0x52cd49[_0x6dea('0x38')]),_0x56ea22);if(_0x54a7d5['query']['filter']){_0x105c0a[_0x6dea('0x3f')]=_[_0x6dea('0x40')](_0x105c0a['where'],{'$or':_[_0x6dea('0x30')](_0x56ea22,function(_0x4e2f52){if(_0x4e2f52['type']!==_0x6dea('0x41')){var _0x5988f5={};_0x5988f5[_0x4e2f52[_0x6dea('0x2e')]]={'$like':'%'+_0x54a7d5[_0x6dea('0x36')][_0x6dea('0x42')]+'%'};return _0x5988f5;}})});}_0x105c0a=_[_0x6dea('0x40')]({},_0x105c0a,_0x54a7d5['options']);var _0x5c1f0e={'where':_0x105c0a[_0x6dea('0x3f')]};return db[_0x6dea('0x31')]['count'](_0x5c1f0e)[_0x6dea('0x27')](function(_0x47f0c0){_0x5db05e['count']=_0x47f0c0;if(_0x54a7d5[_0x6dea('0x36')]['includeAll']){_0x105c0a['include']=[{'all':!![]}];}return db[_0x6dea('0x31')][_0x6dea('0x43')](_0x105c0a);})[_0x6dea('0x27')](function(_0x102a82){_0x5db05e['rows']=_0x102a82;return _0x5db05e;})[_0x6dea('0x27')](respondWithFilteredResult(_0x4b1694,_0x105c0a))[_0x6dea('0x44')](handleError(_0x4b1694,null));};exports['show']=function(_0x83bea5,_0x4bebdc){var _0x1967ed={'raw':!![],'where':{'id':_0x83bea5[_0x6dea('0x45')]['id']}},_0x2839f4={};_0x2839f4[_0x6dea('0x35')]=_[_0x6dea('0x37')](db[_0x6dea('0x31')][_0x6dea('0x32')]);_0x2839f4['query']=_[_0x6dea('0x37')](_0x83bea5[_0x6dea('0x36')]);_0x2839f4['filters']=_[_0x6dea('0x39')](_0x2839f4[_0x6dea('0x35')],_0x2839f4['query']);_0x1967ed['attributes']=_[_0x6dea('0x39')](_0x2839f4[_0x6dea('0x35')],qs[_0x6dea('0x3b')](_0x83bea5[_0x6dea('0x36')][_0x6dea('0x3b')]));_0x1967ed[_0x6dea('0x3a')]=_0x1967ed[_0x6dea('0x3a')][_0x6dea('0x3c')]?_0x1967ed[_0x6dea('0x3a')]:_0x2839f4[_0x6dea('0x35')];if(_0x83bea5[_0x6dea('0x36')][_0x6dea('0x46')]){_0x1967ed[_0x6dea('0x47')]=[{'all':!![]}];}_0x1967ed=_[_0x6dea('0x40')]({},_0x1967ed,_0x83bea5[_0x6dea('0x48')]);return db['Variable'][_0x6dea('0x49')](_0x1967ed)[_0x6dea('0x27')](handleEntityNotFound(_0x4bebdc,null))[_0x6dea('0x27')](respondWithResult(_0x4bebdc,null))['catch'](handleError(_0x4bebdc,null));};exports[_0x6dea('0x4a')]=function(_0x1c8f14,_0x4b1a09){return db[_0x6dea('0x31')][_0x6dea('0x4a')](_0x1c8f14[_0x6dea('0x4b')],{})[_0x6dea('0x27')](function(_0x57bedf){var _0x26dc97=_0x1c8f14[_0x6dea('0x4c')][_0x6dea('0x29')]({'plain':!![]});if(!_0x26dc97)throw new Error(_0x6dea('0x4d'));if(_0x26dc97[_0x6dea('0x4e')]===_0x6dea('0x4c')){var _0x26fe79=_0x57bedf[_0x6dea('0x29')]({'plain':!![]});var _0x2c18e5=_0x6dea('0x2a');return db[_0x6dea('0x4f')][_0x6dea('0x49')]({'where':{'name':_0x2c18e5,'userProfileId':_0x26dc97[_0x6dea('0x50')]},'raw':!![]})[_0x6dea('0x27')](function(_0x2d4aad){if(_0x2d4aad&&_0x2d4aad['autoAssociation']===0x0){return db[_0x6dea('0x2b')]['create']({'name':_0x26fe79[_0x6dea('0x2e')],'resourceId':_0x26fe79['id'],'type':_0x2d4aad['name'],'sectionId':_0x2d4aad['id']},{})[_0x6dea('0x27')](function(){return _0x57bedf;});}else{return _0x57bedf;}})[_0x6dea('0x44')](function(_0x48a1d8){logger[_0x6dea('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48a1d8);throw _0x48a1d8;});}return _0x57bedf;})[_0x6dea('0x27')](respondWithResult(_0x4b1a09,0xc9))[_0x6dea('0x44')](handleError(_0x4b1a09,null));};exports[_0x6dea('0x26')]=function(_0x39bd6b,_0xfbb95){if(_0x39bd6b[_0x6dea('0x4b')]['id']){delete _0x39bd6b[_0x6dea('0x4b')]['id'];}return db['Variable'][_0x6dea('0x49')]({'where':{'id':_0x39bd6b['params']['id']}})[_0x6dea('0x27')](handleEntityNotFound(_0xfbb95,null))[_0x6dea('0x27')](saveUpdates(_0x39bd6b[_0x6dea('0x4b')],null))['then'](respondWithResult(_0xfbb95,null))[_0x6dea('0x44')](handleError(_0xfbb95,null));};exports[_0x6dea('0x28')]=function(_0x14750b,_0x12f5c9){return db['Variable']['find']({'where':{'id':_0x14750b[_0x6dea('0x45')]['id']}})[_0x6dea('0x27')](handleEntityNotFound(_0x12f5c9,null))[_0x6dea('0x27')](removeEntity(_0x12f5c9,null))[_0x6dea('0x44')](handleError(_0x12f5c9,null));}; \ No newline at end of file +var _0xdba1=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x483578,_0xfb8c1c){var _0x287922=function(_0x43a8b0){while(--_0x43a8b0){_0x483578['push'](_0x483578['shift']());}};_0x287922(++_0xfb8c1c);}(_0xdba1,0x1e3));var _0x1dba=function(_0x5840cd,_0xa2a210){_0x5840cd=_0x5840cd-0x0;var _0x532203=_0xdba1[_0x5840cd];return _0x532203;};'use strict';var emlformat=require(_0x1dba('0x0'));var rimraf=require(_0x1dba('0x1'));var zipdir=require(_0x1dba('0x2'));var jsonpatch=require(_0x1dba('0x3'));var rp=require(_0x1dba('0x4'));var moment=require(_0x1dba('0x5'));var BPromise=require(_0x1dba('0x6'));var Mustache=require(_0x1dba('0x7'));var util=require(_0x1dba('0x8'));var path=require(_0x1dba('0x9'));var sox=require('sox');var csv=require(_0x1dba('0xa'));var ejs=require(_0x1dba('0xb'));var fs=require('fs');var fs_extra=require(_0x1dba('0xc'));var _=require(_0x1dba('0xd'));var squel=require('squel');var crypto=require(_0x1dba('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1dba('0xf'));var toCsv=require(_0x1dba('0xa'));var querystring=require(_0x1dba('0x10'));var Papa=require(_0x1dba('0x11'));var Redis=require('ioredis');var authService=require(_0x1dba('0x12'));var qs=require(_0x1dba('0x13'));var as=require(_0x1dba('0x14'));var hardwareService=require(_0x1dba('0x15'));var logger=require(_0x1dba('0x16'))(_0x1dba('0x17'));var utils=require(_0x1dba('0x18'));var config=require(_0x1dba('0x19'));var licenseUtil=require(_0x1dba('0x1a'));var db=require(_0x1dba('0x1b'))['db'];function respondWithStatusCode(_0x527747,_0x1e9196){_0x1e9196=_0x1e9196||0xcc;return function(_0x33039a){if(_0x33039a){return _0x527747[_0x1dba('0x1c')](_0x1e9196);}return _0x527747['status'](_0x1e9196)[_0x1dba('0x1d')]();};}function respondWithResult(_0x26e454,_0x156704){_0x156704=_0x156704||0xc8;return function(_0x52c9e7){if(_0x52c9e7){return _0x26e454[_0x1dba('0x1e')](_0x156704)[_0x1dba('0x1f')](_0x52c9e7);}};}function respondWithFilteredResult(_0x4ccbe9,_0x1f8053){return function(_0x5cb4c1){if(_0x5cb4c1){var _0x4798b7=typeof _0x1f8053[_0x1dba('0x20')]===_0x1dba('0x21')&&typeof _0x1f8053[_0x1dba('0x22')]===_0x1dba('0x21');var _0x9c7822=_0x5cb4c1[_0x1dba('0x23')];var _0x37baba=_0x4798b7?0x0:_0x1f8053[_0x1dba('0x20')];var _0xf37f20=_0x4798b7?_0x5cb4c1[_0x1dba('0x23')]:_0x1f8053[_0x1dba('0x20')]+_0x1f8053[_0x1dba('0x22')];var _0xb05b44;if(_0xf37f20>=_0x9c7822){_0xf37f20=_0x9c7822;_0xb05b44=0xc8;}else{_0xb05b44=0xce;}_0x4ccbe9['status'](_0xb05b44);return _0x4ccbe9[_0x1dba('0x24')](_0x1dba('0x25'),_0x37baba+'-'+_0xf37f20+'/'+_0x9c7822)[_0x1dba('0x1f')](_0x5cb4c1);}return null;};}function patchUpdates(_0x4d94fd){return function(_0x45645f){try{jsonpatch[_0x1dba('0x26')](_0x45645f,_0x4d94fd,!![]);}catch(_0x1e2ce1){return BPromise['reject'](_0x1e2ce1);}return _0x45645f[_0x1dba('0x27')]();};}function saveUpdates(_0x10b572,_0x753c44){return function(_0x2856ac){if(_0x2856ac){return _0x2856ac[_0x1dba('0x28')](_0x10b572)[_0x1dba('0x29')](function(_0x372a87){return _0x372a87;});}return null;};}function removeEntity(_0x2f1e54,_0x5c052f){return function(_0x2638eb){if(_0x2638eb){return _0x2638eb[_0x1dba('0x2a')]()[_0x1dba('0x29')](function(){var _0x5461c1=_0x2638eb[_0x1dba('0x2b')]({'plain':!![]});var _0x498979='Variables';return db[_0x1dba('0x2c')][_0x1dba('0x2a')]({'where':{'type':_0x498979,'resourceId':_0x5461c1['id']}})['then'](function(){return _0x2638eb;});})[_0x1dba('0x29')](function(){_0x2f1e54[_0x1dba('0x1e')](0xcc)[_0x1dba('0x1d')]();});}};}function handleEntityNotFound(_0x512f02,_0xf6cb6b){return function(_0x3ad963){if(!_0x3ad963){_0x512f02[_0x1dba('0x1c')](0x194);}return _0x3ad963;};}function handleError(_0x1dfd97,_0x598225){_0x598225=_0x598225||0x1f4;return function(_0x202b83){logger[_0x1dba('0x2d')](_0x202b83[_0x1dba('0x2e')]);if(_0x202b83[_0x1dba('0x2f')]){delete _0x202b83[_0x1dba('0x2f')];}_0x1dfd97[_0x1dba('0x1e')](_0x598225)['send'](_0x202b83);};}exports[_0x1dba('0x30')]=function(_0x1d5efb,_0x2d049d){var _0x1ea3b1={},_0x3da578={},_0x1fecc7={'count':0x0,'rows':[]};var _0x106815=_[_0x1dba('0x31')](db[_0x1dba('0x32')][_0x1dba('0x33')],function(_0x2feebc){return{'name':_0x2feebc[_0x1dba('0x34')],'type':_0x2feebc[_0x1dba('0x35')]['key']};});_0x3da578[_0x1dba('0x36')]=_['map'](_0x106815,_0x1dba('0x2f'));_0x3da578[_0x1dba('0x37')]=_[_0x1dba('0x38')](_0x1d5efb['query']);_0x3da578[_0x1dba('0x39')]=_[_0x1dba('0x3a')](_0x3da578[_0x1dba('0x36')],_0x3da578[_0x1dba('0x37')]);_0x1ea3b1[_0x1dba('0x3b')]=_[_0x1dba('0x3a')](_0x3da578[_0x1dba('0x36')],qs[_0x1dba('0x3c')](_0x1d5efb[_0x1dba('0x37')][_0x1dba('0x3c')]));_0x1ea3b1[_0x1dba('0x3b')]=_0x1ea3b1[_0x1dba('0x3b')][_0x1dba('0x3d')]?_0x1ea3b1[_0x1dba('0x3b')]:_0x3da578[_0x1dba('0x36')];if(!_0x1d5efb['query'][_0x1dba('0x3e')]('nolimit')){_0x1ea3b1[_0x1dba('0x22')]=qs[_0x1dba('0x22')](_0x1d5efb['query'][_0x1dba('0x22')]);_0x1ea3b1[_0x1dba('0x20')]=qs[_0x1dba('0x20')](_0x1d5efb[_0x1dba('0x37')][_0x1dba('0x20')]);}_0x1ea3b1[_0x1dba('0x3f')]=qs[_0x1dba('0x40')](_0x1d5efb[_0x1dba('0x37')]['sort']);_0x1ea3b1[_0x1dba('0x41')]=qs[_0x1dba('0x39')](_['pick'](_0x1d5efb['query'],_0x3da578['filters']),_0x106815);if(_0x1d5efb[_0x1dba('0x37')][_0x1dba('0x42')]){_0x1ea3b1[_0x1dba('0x41')]=_[_0x1dba('0x43')](_0x1ea3b1[_0x1dba('0x41')],{'$or':_[_0x1dba('0x31')](_0x106815,function(_0x40ff31){if(_0x40ff31['type']!=='VIRTUAL'){var _0x4059ca={};_0x4059ca[_0x40ff31[_0x1dba('0x2f')]]={'$like':'%'+_0x1d5efb[_0x1dba('0x37')][_0x1dba('0x42')]+'%'};return _0x4059ca;}})});}_0x1ea3b1=_[_0x1dba('0x43')]({},_0x1ea3b1,_0x1d5efb[_0x1dba('0x44')]);var _0x350020={'where':_0x1ea3b1['where']};return db['Variable']['count'](_0x350020)[_0x1dba('0x29')](function(_0x497002){_0x1fecc7[_0x1dba('0x23')]=_0x497002;if(_0x1d5efb[_0x1dba('0x37')][_0x1dba('0x45')]){_0x1ea3b1[_0x1dba('0x46')]=[{'all':!![]}];}return db[_0x1dba('0x32')][_0x1dba('0x47')](_0x1ea3b1);})[_0x1dba('0x29')](function(_0xf483f3){_0x1fecc7['rows']=_0xf483f3;return _0x1fecc7;})[_0x1dba('0x29')](respondWithFilteredResult(_0x2d049d,_0x1ea3b1))[_0x1dba('0x48')](handleError(_0x2d049d,null));};exports['show']=function(_0x4158d2,_0x4d9bbd){var _0x278b15={'raw':!![],'where':{'id':_0x4158d2['params']['id']}},_0x31b2f8={};_0x31b2f8[_0x1dba('0x36')]=_[_0x1dba('0x38')](db[_0x1dba('0x32')][_0x1dba('0x33')]);_0x31b2f8[_0x1dba('0x37')]=_['keys'](_0x4158d2['query']);_0x31b2f8[_0x1dba('0x39')]=_[_0x1dba('0x3a')](_0x31b2f8[_0x1dba('0x36')],_0x31b2f8[_0x1dba('0x37')]);_0x278b15['attributes']=_[_0x1dba('0x3a')](_0x31b2f8[_0x1dba('0x36')],qs[_0x1dba('0x3c')](_0x4158d2[_0x1dba('0x37')][_0x1dba('0x3c')]));_0x278b15['attributes']=_0x278b15['attributes'][_0x1dba('0x3d')]?_0x278b15[_0x1dba('0x3b')]:_0x31b2f8[_0x1dba('0x36')];if(_0x4158d2[_0x1dba('0x37')][_0x1dba('0x45')]){_0x278b15[_0x1dba('0x46')]=[{'all':!![]}];}_0x278b15=_[_0x1dba('0x43')]({},_0x278b15,_0x4158d2[_0x1dba('0x44')]);return db['Variable'][_0x1dba('0x49')](_0x278b15)['then'](handleEntityNotFound(_0x4d9bbd,null))[_0x1dba('0x29')](respondWithResult(_0x4d9bbd,null))[_0x1dba('0x48')](handleError(_0x4d9bbd,null));};exports[_0x1dba('0x4a')]=function(_0x4b3ff6,_0x221958){return db['Variable']['create'](_0x4b3ff6['body'],{})[_0x1dba('0x29')](function(_0x3a8695){var _0xc95434=_0x4b3ff6[_0x1dba('0x4b')]['get']({'plain':!![]});if(!_0xc95434)throw new Error(_0x1dba('0x4c'));if(_0xc95434[_0x1dba('0x4d')]===_0x1dba('0x4b')){var _0x237eb6=_0x3a8695[_0x1dba('0x2b')]({'plain':!![]});var _0xfc2e61=_0x1dba('0x4e');return db['UserProfileSection'][_0x1dba('0x49')]({'where':{'name':_0xfc2e61,'userProfileId':_0xc95434[_0x1dba('0x4f')]},'raw':!![]})[_0x1dba('0x29')](function(_0x59613a){if(_0x59613a&&_0x59613a[_0x1dba('0x50')]===0x0){return db['UserProfileResource'][_0x1dba('0x4a')]({'name':_0x237eb6['name'],'resourceId':_0x237eb6['id'],'type':_0x59613a[_0x1dba('0x2f')],'sectionId':_0x59613a['id']},{})['then'](function(){return _0x3a8695;});}else{return _0x3a8695;}})[_0x1dba('0x48')](function(_0x47c828){logger[_0x1dba('0x2d')](_0x1dba('0x51'),_0x47c828);throw _0x47c828;});}return _0x3a8695;})[_0x1dba('0x29')](respondWithResult(_0x221958,0xc9))[_0x1dba('0x48')](handleError(_0x221958,null));};exports['update']=function(_0x44243,_0x5cec92){if(_0x44243[_0x1dba('0x52')]['id']){delete _0x44243[_0x1dba('0x52')]['id'];}return db[_0x1dba('0x32')][_0x1dba('0x49')]({'where':{'id':_0x44243['params']['id']}})[_0x1dba('0x29')](handleEntityNotFound(_0x5cec92,null))[_0x1dba('0x29')](saveUpdates(_0x44243['body'],null))[_0x1dba('0x29')](respondWithResult(_0x5cec92,null))[_0x1dba('0x48')](handleError(_0x5cec92,null));};exports[_0x1dba('0x2a')]=function(_0x7b19af,_0xbdd6a2){return db[_0x1dba('0x32')]['find']({'where':{'id':_0x7b19af[_0x1dba('0x53')]['id']}})['then'](handleEntityNotFound(_0xbdd6a2,null))[_0x1dba('0x29')](removeEntity(_0xbdd6a2,null))[_0x1dba('0x48')](handleError(_0xbdd6a2,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 48361b3..1f8666a 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 _0x0785=['api','request-promise','rimraf','./variable.attributes','exports','Variable','tools_variables','util','../../config/logger'];(function(_0x1ad85a,_0x2c9743){var _0x28507e=function(_0x562d49){while(--_0x562d49){_0x1ad85a['push'](_0x1ad85a['shift']());}};_0x28507e(++_0x2c9743);}(_0x0785,0x8e));var _0x5078=function(_0x4f0523,_0x3603af){_0x4f0523=_0x4f0523-0x0;var _0x55e3ea=_0x0785[_0x4f0523];return _0x55e3ea;};'use strict';var _=require('lodash');var util=require(_0x5078('0x0'));var logger=require(_0x5078('0x1'))(_0x5078('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5078('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5078('0x4'));var config=require('../../config/environment');var attributes=require(_0x5078('0x5'));module[_0x5078('0x6')]=function(_0x42a0eb,_0x568563){return _0x42a0eb['define'](_0x5078('0x7'),attributes,{'tableName':_0x5078('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa48b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','api'];(function(_0x36d04d,_0x469817){var _0x213b48=function(_0x407b54){while(--_0x407b54){_0x36d04d['push'](_0x36d04d['shift']());}};_0x213b48(++_0x469817);}(_0xa48b,0x1aa));var _0xba48=function(_0x51293c,_0x1a01e8){_0x51293c=_0x51293c-0x0;var _0x2cabbe=_0xa48b[_0x51293c];return _0x2cabbe;};'use strict';var _=require(_0xba48('0x0'));var util=require(_0xba48('0x1'));var logger=require('../../config/logger')(_0xba48('0x2'));var moment=require(_0xba48('0x3'));var BPromise=require(_0xba48('0x4'));var rp=require(_0xba48('0x5'));var fs=require('fs');var path=require(_0xba48('0x6'));var rimraf=require(_0xba48('0x7'));var config=require(_0xba48('0x8'));var attributes=require(_0xba48('0x9'));module[_0xba48('0xa')]=function(_0x4d88be,_0x594dc4){return _0x4d88be[_0xba48('0xb')](_0xba48('0xc'),attributes,{'tableName':'tools_variables','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 1993c72..5f6e4ad 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x60d2b1,_0x2d3883){var _0x3d41ff=function(_0x5b8011){while(--_0x5b8011){_0x60d2b1['push'](_0x60d2b1['shift']());}};_0x3d41ff(++_0x2d3883);}(_0xf494,0x1c6));var _0x4f49=function(_0x1d75f7,_0x139d5e){_0x1d75f7=_0x1d75f7-0x0;var _0x307f9a=_0xf494[_0x1d75f7];return _0x307f9a;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x42ea7e,_0x5075d2){var _0x567e8c=function(_0x503bea){while(--_0x503bea){_0x42ea7e['push'](_0x42ea7e['shift']());}};_0x567e8c(++_0x5075d2);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index eb59c97..d88ed57 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 _0xb91f=['restart','/migrations','migrations','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/restart'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb91f,0x111));var _0xfb91=function(_0x24abca,_0x30c84c){_0x24abca=_0x24abca-0x0;var _0xd691d3=_0xb91f[_0x24abca];return _0xd691d3;};'use strict';var express=require('express');var router=express[_0xfb91('0x0')]();var auth=require(_0xfb91('0x1'));var controller=require('./version.controller');router[_0xfb91('0x2')]('/',controller[_0xfb91('0x3')]);router[_0xfb91('0x2')](_0xfb91('0x4'),auth[_0xfb91('0x5')](),auth['canUpdate'](),controller[_0xfb91('0x6')]);router[_0xfb91('0x2')](_0xfb91('0x7'),auth[_0xfb91('0x5')](),auth[_0xfb91('0x8')](),controller[_0xfb91('0x9')]);router[_0xfb91('0x2')]('/pull',auth[_0xfb91('0x5')](),auth[_0xfb91('0x8')](),controller[_0xfb91('0xa')]);router[_0xfb91('0x2')](_0xfb91('0xb'),auth['isAuthenticated'](),controller[_0xfb91('0xc')]);router[_0xfb91('0x2')](_0xfb91('0xd'),controller[_0xfb91('0xe')]);module['exports']=router; \ No newline at end of file +var _0x696a=['/fetch','isAuthenticated','fetch','/reset','get','/pull','canUpdate','pull','/migrations','Router','../../components/auth/service','./version.controller','index'];(function(_0x437707,_0x36c3c8){var _0x19fa0e=function(_0x424753){while(--_0x424753){_0x437707['push'](_0x437707['shift']());}};_0x19fa0e(++_0x36c3c8);}(_0x696a,0x19c));var _0xa696=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x696a[_0x2adbeb];return _0x5e18a6;};'use strict';var express=require('express');var router=express[_0xa696('0x0')]();var auth=require(_0xa696('0x1'));var controller=require(_0xa696('0x2'));router['get']('/',controller[_0xa696('0x3')]);router['get'](_0xa696('0x4'),auth[_0xa696('0x5')](),auth['canUpdate'](),controller[_0xa696('0x6')]);router['get'](_0xa696('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router[_0xa696('0x8')](_0xa696('0x9'),auth[_0xa696('0x5')](),auth[_0xa696('0xa')](),controller[_0xa696('0xb')]);router[_0xa696('0x8')]('/restart',auth[_0xa696('0x5')](),controller['restart']);router[_0xa696('0x8')](_0xa696('0xc'),controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 416a985..296e2b5 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 _0xa417=['motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','tags','version','status','json','fetch','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart'];(function(_0x1fa81d,_0x22a3fd){var _0x1a6768=function(_0x30bceb){while(--_0x30bceb){_0x1fa81d['push'](_0x1fa81d['shift']());}};_0x1a6768(++_0x22a3fd);}(_0xa417,0x15a));var _0x7a41=function(_0x3a6e90,_0x1bceff){_0x3a6e90=_0x3a6e90-0x0;var _0x4081c9=_0xa417[_0x3a6e90];return _0x4081c9;};'use strict';var Umzug=require(_0x7a41('0x0'));var path=require(_0x7a41('0x1'));var fs=require('fs');var _=require(_0x7a41('0x2'));var pkginfo=require(_0x7a41('0x3'))(module,'version');var compareVersions=require(_0x7a41('0x4'));var exec=require('child_process')[_0x7a41('0x5')];var db=require(_0x7a41('0x6'))['db'];var config=require(_0x7a41('0x7'));var pm2=require(_0x7a41('0x8'));var logger=require(_0x7a41('0x9'))(_0x7a41('0xa'));var git=require('simple-git')(config[_0x7a41('0xb')]);exports[_0x7a41('0xc')]=function(_0x584e9d,_0x3bff32){var _0x272801={'current':module[_0x7a41('0xd')]['version'],'phonebar':0x2};if(_0x584e9d['query']&&_0x584e9d[_0x7a41('0xe')][_0x7a41('0xf')]){return git['fetch']()[_0x7a41('0x10')](function(_0x29992d,_0x3ebb56){_0x272801[_0x7a41('0xf')]=(_0x29992d?module[_0x7a41('0xd')][_0x7a41('0x11')]:_0x3ebb56[_0x7a41('0xf')])||'2.0.0';return _0x3bff32['status'](0xc8)['json'](_0x272801);});}else{return _0x3bff32[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')](_0x272801);}};exports[_0x7a41('0x14')]=function(_0x338418,_0x2aa996){return git[_0x7a41('0x14')]([_0x7a41('0x15'),'master'],function(_0x21a3d2){if(_0x21a3d2){logger[_0x7a41('0x16')](_0x21a3d2);return _0x2aa996[_0x7a41('0x12')](0x1f4)['json'](_0x21a3d2);}logger[_0x7a41('0x17')](_0x7a41('0x18'));return _0x2aa996[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x7a41('0x19')});});};exports[_0x7a41('0x1a')]=function(_0x20314f,_0x1de15f){return git['reset'](['--hard',_0x7a41('0x1b')],function(_0x4e3de3){if(_0x4e3de3){logger[_0x7a41('0x16')](_0x4e3de3);return _0x1de15f[_0x7a41('0x12')](0x1f4)[_0x7a41('0x13')](_0x4e3de3);}logger[_0x7a41('0x17')](_0x7a41('0x1c'));return _0x1de15f[_0x7a41('0x12')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x7a41('0x1d')]=function(_0x442b42,_0x4dfc04){exec(_0x7a41('0x1e'),function(_0x4911aa,_0x4a474b,_0x475b7f){logger[_0x7a41('0x17')](_0x4a474b);logger[_0x7a41('0x17')](_0x475b7f);if(_0x4911aa){logger[_0x7a41('0x16')](_0x4911aa);return _0x4dfc04['status'](0x1f4)[_0x7a41('0x13')](_0x4911aa);}return _0x4dfc04[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x4a474b});});};exports[_0x7a41('0x1f')]=function(_0x3520c5,_0x16d05d){return pm2[_0x7a41('0x1f')](_0x7a41('0x20'))['then'](function(_0x21d4b9){logger[_0x7a41('0x17')]('pm2\x20restart\x20motion\x20%s',_0x21d4b9);return _0x16d05d[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x7a41('0x21')});})[_0x7a41('0x22')](function(_0x505aa2){logger[_0x7a41('0x16')](_0x505aa2);return _0x16d05d[_0x7a41('0x12')](0x1f4)[_0x7a41('0x13')](_0x505aa2);});};exports['migrations']=function(_0x5362b6,_0x165e49){var _0x19d87e=fs[_0x7a41('0x23')](path[_0x7a41('0x24')](config[_0x7a41('0xb')],_0x7a41('0x25'),'migrations'));var _0x4a7993=[];for(var _0x46ac76=0x0;_0x46ac76<_0x19d87e['length'];_0x46ac76++){var _0x50e9b5=_0x19d87e[_0x46ac76][_0x7a41('0x26')](_0x7a41('0x27'),'');if(compareVersions(module['exports'][_0x7a41('0x11')],_0x50e9b5)===-0x1){_0x4a7993[_0x7a41('0x28')](_0x50e9b5);}}if(_0x4a7993[_0x7a41('0x29')]){var _0x1ca327=_0x4a7993[_0x7a41('0x2a')](compareVersions);var _0x242020=new Umzug({'storage':_0x7a41('0x2b'),'storageOptions':{'model':db[_0x7a41('0x2c')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x7a41('0x2b')][_0x7a41('0x2d')](),db['sequelize'][_0x7a41('0x2e')],function(){throw new Error(_0x7a41('0x2f'));}],'path':path['join'](config[_0x7a41('0xb')],_0x7a41('0x25'),'migrations'),'pattern':/\.js$/}});_0x242020['up']({'migrations':_[_0x7a41('0x30')](_0x1ca327,function(_0x472c35){return _0x472c35+_0x7a41('0x27');})})[_0x7a41('0x31')](function(){return _0x165e49['status'](0xc8)['json']({'output':_0x7a41('0x32')+module[_0x7a41('0xd')]['version']+_0x7a41('0x33')+_[_0x7a41('0x34')](_0x1ca327),'migrations':_[_0x7a41('0x24')](_0x1ca327)});})[_0x7a41('0x22')](function(_0x2782fe){if(_0x2782fe instanceof db[_0x7a41('0x2b')]['UniqueConstraintError']){return _0x165e49[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':_0x7a41('0x35')});}else{return _0x165e49[_0x7a41('0x12')](0x1f4)[_0x7a41('0x13')](_0x2782fe);}});}else{return _0x165e49[_0x7a41('0x12')](0xc8)[_0x7a41('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xbf32=['status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','Database\x20already\x20up-to-date','umzug','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0'];(function(_0x2fab20,_0x1de496){var _0x57512b=function(_0x30d94f){while(--_0x30d94f){_0x2fab20['push'](_0x2fab20['shift']());}};_0x57512b(++_0x1de496);}(_0xbf32,0x16e));var _0x2bf3=function(_0x4eecc0,_0x1ee119){_0x4eecc0=_0x4eecc0-0x0;var _0xf21f5d=_0xbf32[_0x4eecc0];return _0xf21f5d;};'use strict';var Umzug=require(_0x2bf3('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2bf3('0x1'))(module,_0x2bf3('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x2bf3('0x3'))[_0x2bf3('0x4')];var db=require(_0x2bf3('0x5'))['db'];var config=require(_0x2bf3('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x2bf3('0x7'))(_0x2bf3('0x8'));var git=require(_0x2bf3('0x9'))(config[_0x2bf3('0xa')]);exports[_0x2bf3('0xb')]=function(_0x3a60e0,_0x15bc87){var _0x5bee62={'current':module[_0x2bf3('0xc')][_0x2bf3('0x2')],'phonebar':0x2};if(_0x3a60e0[_0x2bf3('0xd')]&&_0x3a60e0[_0x2bf3('0xd')][_0x2bf3('0xe')]){return git[_0x2bf3('0xf')]()[_0x2bf3('0x10')](function(_0x18deda,_0x5323f9){_0x5bee62['latest']=(_0x18deda?module[_0x2bf3('0xc')][_0x2bf3('0x2')]:_0x5323f9[_0x2bf3('0xe')])||_0x2bf3('0x11');return _0x15bc87[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')](_0x5bee62);});}else{return _0x15bc87[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')](_0x5bee62);}};exports[_0x2bf3('0xf')]=function(_0x58c62e,_0x28555b){return git[_0x2bf3('0xf')]([_0x2bf3('0x14'),_0x2bf3('0x15')],function(_0x4e6639){if(_0x4e6639){logger[_0x2bf3('0x16')](_0x4e6639);return _0x28555b[_0x2bf3('0x12')](0x1f4)[_0x2bf3('0x13')](_0x4e6639);}logger['info']('git\x20fetch');return _0x28555b[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')]({'output':_0x2bf3('0x17')});});};exports[_0x2bf3('0x18')]=function(_0x109507,_0x343817){return git[_0x2bf3('0x18')](['--hard','FETCH_HEAD'],function(_0x2110fd){if(_0x2110fd){logger[_0x2bf3('0x16')](_0x2110fd);return _0x343817[_0x2bf3('0x12')](0x1f4)[_0x2bf3('0x13')](_0x2110fd);}logger[_0x2bf3('0x19')](_0x2bf3('0x1a'));return _0x343817['status'](0xc8)[_0x2bf3('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x2bf3('0x1b')]=function(_0xb60d29,_0x31603e){exec(_0x2bf3('0x1c'),function(_0x4ec686,_0x244967,_0x462e2d){logger[_0x2bf3('0x19')](_0x244967);logger[_0x2bf3('0x19')](_0x462e2d);if(_0x4ec686){logger[_0x2bf3('0x16')](_0x4ec686);return _0x31603e[_0x2bf3('0x12')](0x1f4)[_0x2bf3('0x13')](_0x4ec686);}return _0x31603e[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')]({'output':_0x244967});});};exports[_0x2bf3('0x1d')]=function(_0x26abe0,_0x2e9ba2){return pm2['restart']('motion2')[_0x2bf3('0x1e')](function(_0x5c4c2b){logger[_0x2bf3('0x19')]('pm2\x20restart\x20motion\x20%s',_0x5c4c2b);return _0x2e9ba2[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')]({'output':_0x2bf3('0x1f')});})['catch'](function(_0x3b1a1d){logger[_0x2bf3('0x16')](_0x3b1a1d);return _0x2e9ba2[_0x2bf3('0x12')](0x1f4)[_0x2bf3('0x13')](_0x3b1a1d);});};exports[_0x2bf3('0x20')]=function(_0x1b8823,_0x531a56){var _0x217893=fs[_0x2bf3('0x21')](path['join'](config['root'],'server',_0x2bf3('0x20')));var _0x4fe8d6=[];for(var _0x3ba3a3=0x0;_0x3ba3a3<_0x217893[_0x2bf3('0x22')];_0x3ba3a3++){var _0x286b88=_0x217893[_0x3ba3a3][_0x2bf3('0x23')](_0x2bf3('0x24'),'');if(compareVersions(module[_0x2bf3('0xc')][_0x2bf3('0x2')],_0x286b88)===-0x1){_0x4fe8d6[_0x2bf3('0x25')](_0x286b88);}}if(_0x4fe8d6[_0x2bf3('0x22')]){var _0x4a5d61=_0x4fe8d6[_0x2bf3('0x26')](compareVersions);var _0x38f119=new Umzug({'storage':_0x2bf3('0x27'),'storageOptions':{'model':db[_0x2bf3('0x28')],'modelName':_0x2bf3('0x28'),'columnName':_0x2bf3('0x2')},'migrations':{'params':[db[_0x2bf3('0x27')]['getQueryInterface'](),db[_0x2bf3('0x27')][_0x2bf3('0x29')],function(){throw new Error(_0x2bf3('0x2a'));}],'path':path[_0x2bf3('0x2b')](config[_0x2bf3('0xa')],'server','migrations'),'pattern':/\.js$/}});_0x38f119['up']({'migrations':_['map'](_0x4a5d61,function(_0x179132){return _0x179132+'.js';})})[_0x2bf3('0x1e')](function(){return _0x531a56[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')]({'output':_0x2bf3('0x2c')+module[_0x2bf3('0xc')][_0x2bf3('0x2')]+'\x20to\x20'+_[_0x2bf3('0x2d')](_0x4a5d61),'migrations':_[_0x2bf3('0x2b')](_0x4a5d61)});})[_0x2bf3('0x2e')](function(_0x2fa124){if(_0x2fa124 instanceof db[_0x2bf3('0x27')]['UniqueConstraintError']){return _0x531a56[_0x2bf3('0x12')](0xc8)[_0x2bf3('0x13')]({'output':_0x2bf3('0x2f')});}else{return _0x531a56['status'](0x1f4)[_0x2bf3('0x13')](_0x2fa124);}});}else{return _0x531a56[_0x2bf3('0x12')](0xc8)['json']({'output':_0x2bf3('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 245b5ed..440effa 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 _0x62b0=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy'];(function(_0x45275b,_0x10cc21){var _0xd3c33a=function(_0x152ef7){while(--_0x152ef7){_0x45275b['push'](_0x45275b['shift']());}};_0xd3c33a(++_0x10cc21);}(_0x62b0,0xf1));var _0x062b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x062b('0x0'));var path=require('path');var timeout=require(_0x062b('0x1'));var express=require(_0x062b('0x2'));var router=express[_0x062b('0x3')]();var fs_extra=require(_0x062b('0x4'));var auth=require(_0x062b('0x5'));var interaction=require(_0x062b('0x6'));var config=require(_0x062b('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x062b('0x8')]('/',auth[_0x062b('0x9')](),controller[_0x062b('0xa')]);router[_0x062b('0x8')](_0x062b('0xb'),auth[_0x062b('0x9')](),controller[_0x062b('0xc')]);router[_0x062b('0x8')](_0x062b('0xd'),auth[_0x062b('0x9')](),controller['show']);router[_0x062b('0xe')]('/',auth[_0x062b('0x9')](),controller['create']);router[_0x062b('0xf')](_0x062b('0xd'),auth[_0x062b('0x9')](),controller[_0x062b('0x10')]);router[_0x062b('0x11')](_0x062b('0xd'),auth[_0x062b('0x9')](),controller[_0x062b('0x12')]);module[_0x062b('0x13')]=router; \ No newline at end of file +var _0x3ce1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x10ab79,_0x400c25){var _0x51bdd8=function(_0x393a72){while(--_0x393a72){_0x10ab79['push'](_0x10ab79['shift']());}};_0x51bdd8(++_0x400c25);}(_0x3ce1,0x12f));var _0x13ce=function(_0x3846d7,_0x12d3e1){_0x3846d7=_0x3846d7-0x0;var _0x518be2=_0x3ce1[_0x3846d7];return _0x518be2;};'use strict';var multer=require(_0x13ce('0x0'));var util=require(_0x13ce('0x1'));var path=require(_0x13ce('0x2'));var timeout=require(_0x13ce('0x3'));var express=require(_0x13ce('0x4'));var router=express['Router']();var fs_extra=require(_0x13ce('0x5'));var auth=require(_0x13ce('0x6'));var interaction=require(_0x13ce('0x7'));var config=require(_0x13ce('0x8'));var controller=require(_0x13ce('0x9'));router[_0x13ce('0xa')]('/',auth[_0x13ce('0xb')](),controller[_0x13ce('0xc')]);router[_0x13ce('0xa')]('/describe',auth[_0x13ce('0xb')](),controller[_0x13ce('0xd')]);router['get']('/:id',auth[_0x13ce('0xb')](),controller[_0x13ce('0xe')]);router[_0x13ce('0xf')]('/',auth[_0x13ce('0xb')](),controller[_0x13ce('0x10')]);router[_0x13ce('0x11')](_0x13ce('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x13ce('0x13')](_0x13ce('0x12'),auth[_0x13ce('0xb')](),controller[_0x13ce('0x14')]);module[_0x13ce('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9815feb..c17d185 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 _0x349e=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x221eb2,_0x2d65bc){var _0x3760ee=function(_0x3a88ee){while(--_0x3a88ee){_0x221eb2['push'](_0x221eb2['shift']());}};_0x3760ee(++_0x2d65bc);}(_0x349e,0xcb));var _0xe349=function(_0x19380e,_0x206d1e){_0x19380e=_0x19380e-0x0;var _0x5a31f8=_0x349e[_0x19380e];return _0x5a31f8;};'use strict';var Sequelize=require(_0xe349('0x0'));module[_0xe349('0x1')]={'type':{'type':Sequelize[_0xe349('0x2')]},'uniqueid':{'type':Sequelize[_0xe349('0x2')]},'calleridnum':{'type':Sequelize[_0xe349('0x2')]},'calleridname':{'type':Sequelize[_0xe349('0x2')]},'queue':{'type':Sequelize[_0xe349('0x2')]},'interface':{'type':Sequelize[_0xe349('0x2')]},'membername':{'type':Sequelize[_0xe349('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe349('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xe349('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe349('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe349('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe349('0x5')]},'agentacw':{'type':Sequelize[_0xe349('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe349('0x5')]},'reason':{'type':Sequelize[_0xe349('0x2')]},'lastevent':{'type':Sequelize[_0xe349('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xe349('0x5')]},'channelstatedesc':{'type':Sequelize[_0xe349('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe349('0x2')]},'connectedlinename':{'type':Sequelize[_0xe349('0x2')]},'language':{'type':Sequelize[_0xe349('0x2')]},'accountcode':{'type':Sequelize[_0xe349('0x2')]},'context':{'type':Sequelize[_0xe349('0x2')]},'exten':{'type':Sequelize[_0xe349('0x2')]},'priority':{'type':Sequelize[_0xe349('0x2')]},'destchannel':{'type':Sequelize[_0xe349('0x2')]},'destchannelstate':{'type':Sequelize[_0xe349('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xe349('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe349('0x2')]},'destcalleridname':{'type':Sequelize[_0xe349('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe349('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe349('0x2')]},'destlanguage':{'type':Sequelize[_0xe349('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe349('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe349('0x2')]},'destuniqueid':{'type':Sequelize[_0xe349('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe349('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe349('0x2')],'comment':_0xe349('0x6')},'transferexten':{'type':Sequelize[_0xe349('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe349('0x2')]},'agententerreason':{'type':Sequelize[_0xe349('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd8e=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x31b641,_0x569245){var _0x19f278=function(_0x385964){while(--_0x385964){_0x31b641['push'](_0x31b641['shift']());}};_0x19f278(++_0x569245);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xebd8('0x0'));module[_0xebd8('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xebd8('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xebd8('0x2')]},'interface':{'type':Sequelize[_0xebd8('0x2')]},'membername':{'type':Sequelize[_0xebd8('0x2')]},'agentcalledAt':{'type':Sequelize[_0xebd8('0x3')]},'agentconnectAt':{'type':Sequelize[_0xebd8('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xebd8('0x3')]},'agentdumpAt':{'type':Sequelize[_0xebd8('0x3')]},'holdtime':{'type':Sequelize[_0xebd8('0x4')]},'agentcomplete':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xebd8('0x4')]},'agentacw':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xebd8('0x4')]},'reason':{'type':Sequelize[_0xebd8('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xebd8('0x2')]},'connectedlinenum':{'type':Sequelize[_0xebd8('0x2')]},'connectedlinename':{'type':Sequelize[_0xebd8('0x2')]},'language':{'type':Sequelize[_0xebd8('0x2')]},'accountcode':{'type':Sequelize[_0xebd8('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xebd8('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xebd8('0x2')]},'destchannelstate':{'type':Sequelize[_0xebd8('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xebd8('0x2')]},'destcalleridname':{'type':Sequelize[_0xebd8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xebd8('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xebd8('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xebd8('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xebd8('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xebd8('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xebd8('0x2')]},'transfer':{'type':Sequelize[_0xebd8('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xebd8('0x2')],'comment':_0xebd8('0x6')},'transferexten':{'type':Sequelize[_0xebd8('0x2')]},'transferuniqueid':{'type':Sequelize[_0xebd8('0x2')]},'agententerreason':{'type':Sequelize[_0xebd8('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9af6dcb..de1cdd5 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(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 7ec652e..942adc3 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 _0x6334=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid'];(function(_0x3a05f6,_0x302a0b){var _0x33677f=function(_0x2321b5){while(--_0x2321b5){_0x3a05f6['push'](_0x3a05f6['shift']());}};_0x33677f(++_0x302a0b);}(_0x6334,0x119));var _0x4633=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x6334[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var BPromise=require(_0x4633('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4633('0x6'));var rimraf=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var attributes=require(_0x4633('0x9'));module[_0x4633('0xa')]=function(_0x6493dc,_0x175e14){return _0x6493dc['define'](_0x4633('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x4633('0xc'),_0x4633('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39d9=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf30d85,_0x1bb86b){var _0xd5116a=function(_0x57fae9){while(--_0x57fae9){_0xf30d85['push'](_0xf30d85['shift']());}};_0xd5116a(++_0x1bb86b);}(_0x39d9,0x17f));var _0x939d=function(_0x3671b7,_0x5398bd){_0x3671b7=_0x3671b7-0x0;var _0x50f41b=_0x39d9[_0x3671b7];return _0x50f41b;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var logger=require(_0x939d('0x2'))(_0x939d('0x3'));var moment=require(_0x939d('0x4'));var BPromise=require(_0x939d('0x5'));var rp=require(_0x939d('0x6'));var fs=require('fs');var path=require(_0x939d('0x7'));var rimraf=require('rimraf');var config=require(_0x939d('0x8'));var attributes=require(_0x939d('0x9'));module[_0x939d('0xa')]=function(_0x48b22f,_0x41c89f){return _0x48b22f['define'](_0x939d('0xb'),attributes,{'tableName':_0x939d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x939d('0xd'),_0x939d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1722f1a..455f7ce 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 _0x4473=['body','options','raw','info','CreateVoiceAgentReport','VoiceAgentReport','where','attributes','limit','UpdateVoiceAgentReport','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch'];(function(_0x4edea1,_0x336ac7){var _0x53cf5d=function(_0xbe51e5){while(--_0xbe51e5){_0x4edea1['push'](_0x4edea1['shift']());}};_0x53cf5d(++_0x336ac7);}(_0x4473,0x1ca));var _0x3447=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4473[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3447('0x0'));var BPromise=require(_0x3447('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3447('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3447('0x3'))(_0x3447('0x4'));var config=require(_0x3447('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3447('0x6')][_0x3447('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53b6ea,_0x1465e9,_0x536819){return new BPromise(function(_0x31e2d8,_0x5052d9){return client[_0x3447('0x8')](_0x53b6ea,_0x536819)[_0x3447('0x9')](function(_0x224647){logger['info'](_0x3447('0xa'),_0x1465e9,_0x3447('0xb'));logger['debug'](_0x3447('0xc'),_0x1465e9,'request\x20sent',JSON[_0x3447('0xd')](_0x224647));if(_0x224647[_0x3447('0xe')]){if(_0x224647[_0x3447('0xe')]['code']===0x1f4){logger[_0x3447('0xe')](_0x3447('0xa'),_0x1465e9,_0x224647[_0x3447('0xe')]['message']);return _0x5052d9(_0x224647[_0x3447('0xe')]['message']);}logger[_0x3447('0xe')](_0x3447('0xa'),_0x1465e9,_0x224647[_0x3447('0xe')]['message']);return _0x31e2d8(_0x224647[_0x3447('0xe')]['message']);}else{logger['info'](_0x3447('0xa'),_0x1465e9,_0x3447('0xb'));_0x31e2d8(_0x224647[_0x3447('0xf')][_0x3447('0x10')]);}})[_0x3447('0x11')](function(_0x34ebb5){logger[_0x3447('0xe')](_0x3447('0xa'),_0x1465e9,_0x34ebb5);_0x5052d9(_0x34ebb5);});});}exports['CreateVoiceAgentReport']=function(_0x3ce744){var _0x21f2d7=this;return new Promise(function(_0x90da54,_0x145ed6){return db['VoiceAgentReport']['create'](_0x3ce744[_0x3447('0x12')],{'raw':_0x3ce744[_0x3447('0x13')]?_0x3ce744['options'][_0x3447('0x14')]===undefined?!![]:![]:!![]})[_0x3447('0x9')](function(_0x4131bf){logger[_0x3447('0x15')](_0x3447('0x16'),_0x3ce744);logger['debug'](_0x3447('0x16'),_0x3ce744,JSON[_0x3447('0xd')](_0x4131bf));_0x90da54(_0x4131bf);})[_0x3447('0x11')](function(_0x1bb8b7){logger['error']('CreateVoiceAgentReport',_0x1bb8b7[_0x3447('0x10')],_0x3ce744);_0x145ed6(_0x21f2d7[_0x3447('0xe')](0x1f4,_0x1bb8b7[_0x3447('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x24e617){var _0x26f0c6=this;return new Promise(function(_0x2d1a92,_0x2d3190){return db[_0x3447('0x17')]['update'](_0x24e617['body'],{'raw':_0x24e617[_0x3447('0x13')]?_0x24e617[_0x3447('0x13')][_0x3447('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e617[_0x3447('0x13')]?_0x24e617[_0x3447('0x13')][_0x3447('0x18')]||null:null,'attributes':_0x24e617['options']?_0x24e617[_0x3447('0x13')][_0x3447('0x19')]||null:null,'limit':_0x24e617[_0x3447('0x13')]?_0x24e617[_0x3447('0x13')][_0x3447('0x1a')]||null:null})[_0x3447('0x9')](function(_0x29a9fd){logger[_0x3447('0x15')](_0x3447('0x1b'),_0x24e617);logger['debug'](_0x3447('0x1b'),_0x24e617,JSON['stringify'](_0x29a9fd));_0x2d1a92(_0x29a9fd);})[_0x3447('0x11')](function(_0x12ea0d){logger['error'](_0x3447('0x1b'),_0x12ea0d[_0x3447('0x10')],_0x24e617);_0x2d3190(_0x26f0c6[_0x3447('0xe')](0x1f4,_0x12ea0d[_0x3447('0x10')]));});});}; \ No newline at end of file +var _0x7318=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','lodash'];(function(_0xb54b2f,_0x3fd425){var _0x4bbbb7=function(_0x526447){while(--_0x526447){_0xb54b2f['push'](_0xb54b2f['shift']());}};_0x4bbbb7(++_0x3fd425);}(_0x7318,0x10f));var _0x8731=function(_0x2d6f8a,_0x31f818){_0x2d6f8a=_0x2d6f8a-0x0;var _0x4a4c7c=_0x7318[_0x2d6f8a];return _0x4a4c7c;};'use strict';var _=require(_0x8731('0x0'));var util=require('util');var moment=require(_0x8731('0x1'));var BPromise=require(_0x8731('0x2'));var rs=require(_0x8731('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8731('0x4'))['db'];var utils=require(_0x8731('0x5'));var logger=require(_0x8731('0x6'))('rpc');var config=require(_0x8731('0x7'));var jayson=require(_0x8731('0x8'));var client=jayson[_0x8731('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1241c9,_0x6bff8a,_0x5b9605){return new BPromise(function(_0xdedbb9,_0x246e90){return client[_0x8731('0xa')](_0x1241c9,_0x5b9605)[_0x8731('0xb')](function(_0x1364cf){logger[_0x8731('0xc')](_0x8731('0xd'),_0x6bff8a,_0x8731('0xe'));logger[_0x8731('0xf')](_0x8731('0x10'),_0x6bff8a,_0x8731('0xe'),JSON[_0x8731('0x11')](_0x1364cf));if(_0x1364cf[_0x8731('0x12')]){if(_0x1364cf[_0x8731('0x12')][_0x8731('0x13')]===0x1f4){logger['error'](_0x8731('0xd'),_0x6bff8a,_0x1364cf[_0x8731('0x12')][_0x8731('0x14')]);return _0x246e90(_0x1364cf[_0x8731('0x12')][_0x8731('0x14')]);}logger[_0x8731('0x12')](_0x8731('0xd'),_0x6bff8a,_0x1364cf[_0x8731('0x12')][_0x8731('0x14')]);return _0xdedbb9(_0x1364cf[_0x8731('0x12')]['message']);}else{logger['info'](_0x8731('0xd'),_0x6bff8a,_0x8731('0xe'));_0xdedbb9(_0x1364cf[_0x8731('0x15')][_0x8731('0x14')]);}})[_0x8731('0x16')](function(_0x528954){logger[_0x8731('0x12')](_0x8731('0xd'),_0x6bff8a,_0x528954);_0x246e90(_0x528954);});});}exports[_0x8731('0x17')]=function(_0x599131){var _0x1b622c=this;return new Promise(function(_0x1072a3,_0x46c935){return db['VoiceAgentReport'][_0x8731('0x18')](_0x599131[_0x8731('0x19')],{'raw':_0x599131['options']?_0x599131[_0x8731('0x1a')][_0x8731('0x1b')]===undefined?!![]:![]:!![]})[_0x8731('0xb')](function(_0x3de91c){logger[_0x8731('0xc')](_0x8731('0x17'),_0x599131);logger['debug'](_0x8731('0x17'),_0x599131,JSON[_0x8731('0x11')](_0x3de91c));_0x1072a3(_0x3de91c);})[_0x8731('0x16')](function(_0x3f366e){logger[_0x8731('0x12')](_0x8731('0x17'),_0x3f366e[_0x8731('0x14')],_0x599131);_0x46c935(_0x1b622c[_0x8731('0x12')](0x1f4,_0x3f366e[_0x8731('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x21f013){var _0x3c38d3=this;return new Promise(function(_0x2c4b62,_0x3be97b){return db[_0x8731('0x1c')][_0x8731('0x1d')](_0x21f013['body'],{'raw':_0x21f013[_0x8731('0x1a')]?_0x21f013[_0x8731('0x1a')][_0x8731('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21f013['options']?_0x21f013[_0x8731('0x1a')][_0x8731('0x1e')]||null:null,'attributes':_0x21f013[_0x8731('0x1a')]?_0x21f013[_0x8731('0x1a')][_0x8731('0x1f')]||null:null,'limit':_0x21f013[_0x8731('0x1a')]?_0x21f013[_0x8731('0x1a')][_0x8731('0x20')]||null:null})['then'](function(_0x45f4ec){logger[_0x8731('0xc')](_0x8731('0x21'),_0x21f013);logger[_0x8731('0xf')]('UpdateVoiceAgentReport',_0x21f013,JSON[_0x8731('0x11')](_0x45f4ec));_0x2c4b62(_0x45f4ec);})['catch'](function(_0x4c371f){logger[_0x8731('0x12')](_0x8731('0x21'),_0x4c371f['message'],_0x21f013);_0x3be97b(_0x3c38d3[_0x8731('0x12')](0x1f4,_0x4c371f[_0x8731('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 557d37a..5937f16 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 _0xaba6=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0xcbec1e,_0x5c0c9c){var _0x3ac98f=function(_0x1b5806){while(--_0x1b5806){_0xcbec1e['push'](_0xcbec1e['shift']());}};_0x3ac98f(++_0x5c0c9c);}(_0xaba6,0xe2));var _0x6aba=function(_0x482f76,_0x588ec9){_0x482f76=_0x482f76-0x0;var _0x229e38=_0xaba6[_0x482f76];return _0x229e38;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/describe',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['show']);router[_0x6aba('0xa')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['delete'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);module[_0x6aba('0xf')]=router; \ No newline at end of file +var _0x0fda=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x2a9e81,_0x56c735){var _0x3d2051=function(_0x478330){while(--_0x478330){_0x2a9e81['push'](_0x2a9e81['shift']());}};_0x3d2051(++_0x56c735);}(_0x0fda,0x1a0));var _0xa0fd=function(_0xc18408,_0x37cb15){_0xc18408=_0xc18408-0x0;var _0x470b95=_0x0fda[_0xc18408];return _0x470b95;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['get'](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xd')]);router[_0xa0fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xf')]);router[_0xa0fd('0x10')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0x11')]);router[_0xa0fd('0x12')](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 301728e..dbf2c84 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 _0x142c=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x142c,0x8f));var _0xc142=function(_0x154c0e,_0x1390ca){_0x154c0e=_0x154c0e-0x0;var _0x2e57fe=_0x142c[_0x154c0e];return _0x2e57fe;};'use strict';var Sequelize=require(_0xc142('0x0'));module[_0xc142('0x1')]={'uniqueid':{'type':Sequelize[_0xc142('0x2')]},'type':{'type':Sequelize[_0xc142('0x3')](_0xc142('0x4'),_0xc142('0x5'),_0xc142('0x6'),_0xc142('0x7'),'outbound-fax',_0xc142('0x8'))},'tag':{'type':Sequelize[_0xc142('0x2')]},'accountcode':{'type':Sequelize[_0xc142('0x2')]},'source':{'type':Sequelize[_0xc142('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc142('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc142('0x2')]},'destinationchannel':{'type':Sequelize[_0xc142('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc142('0x9')]},'starttime':{'type':Sequelize[_0xc142('0xa')]},'systemanswertime':{'type':Sequelize[_0xc142('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xc142('0xb')]},'billableseconds':{'type':Sequelize[_0xc142('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc142('0x2')]},'amaflags':{'type':Sequelize[_0xc142('0x2')]},'userfield':{'type':Sequelize[_0xc142('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xc142('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xc142('0x2')]},'note':{'type':Sequelize[_0xc142('0x2')]},'prefix':{'type':Sequelize[_0xc142('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xc142('0x2')]}}; \ No newline at end of file +var _0xd878=['sequelize','exports','STRING','ENUM','inbound','internal','outbound','TEXT','DATE','INTEGER'];(function(_0xc767a,_0x1ef0f9){var _0x3ab7c6=function(_0x2b6f8a){while(--_0x2b6f8a){_0xc767a['push'](_0xc767a['shift']());}};_0x3ab7c6(++_0x1ef0f9);}(_0xd878,0x118));var _0x8d87=function(_0x1be965,_0x50754a){_0x1be965=_0x1be965-0x0;var _0x5c0851=_0xd878[_0x1be965];return _0x5c0851;};'use strict';var Sequelize=require(_0x8d87('0x0'));module[_0x8d87('0x1')]={'uniqueid':{'type':Sequelize[_0x8d87('0x2')]},'type':{'type':Sequelize[_0x8d87('0x3')](_0x8d87('0x4'),_0x8d87('0x5'),_0x8d87('0x6'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0x8d87('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x8d87('0x2')]},'destinationcontext':{'type':Sequelize[_0x8d87('0x2')]},'callerid':{'type':Sequelize[_0x8d87('0x2')]},'channel':{'type':Sequelize[_0x8d87('0x2')]},'destinationchannel':{'type':Sequelize[_0x8d87('0x2')]},'lastapplication':{'type':Sequelize[_0x8d87('0x2')]},'lastdata':{'type':Sequelize[_0x8d87('0x7')]},'starttime':{'type':Sequelize[_0x8d87('0x8')]},'systemanswertime':{'type':Sequelize[_0x8d87('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8d87('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x8d87('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8d87('0x2')]},'amaflags':{'type':Sequelize[_0x8d87('0x2')]},'userfield':{'type':Sequelize[_0x8d87('0x2')]},'userDisposition':{'type':Sequelize[_0x8d87('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x8d87('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8d87('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x8d87('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b18e75a..655d865 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x3e960a,_0x12b04b){_0x3e960a=_0x3e960a-0x0;var _0x259c98=_0x2032[_0x3e960a];return _0x259c98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x10401b,_0x4c3284){var _0x51696a=function(_0x4db693){while(--_0x4db693){_0x10401b['push'](_0x10401b['shift']());}};_0x51696a(++_0x4c3284);}(_0x0b0e,0x187));var _0xe0b0=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0x0b0e[_0x8fa4bc];return _0x35b6a7;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 861daf7..90d7bdf 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 _0x4a5a=['../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x15eb8b,_0x4e1915){var _0x27c85f=function(_0x3c3160){while(--_0x3c3160){_0x15eb8b['push'](_0x15eb8b['shift']());}};_0x27c85f(++_0x4e1915);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x43651b,_0x52119b){_0x43651b=_0x43651b-0x0;var _0x35d53c=_0x4a5a[_0x43651b];return _0x35d53c;};'use strict';var _=require(_0xa4a5('0x0'));var util=require('util');var logger=require(_0xa4a5('0x1'))(_0xa4a5('0x2'));var moment=require(_0xa4a5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4a5('0x4'));var fs=require('fs');var path=require(_0xa4a5('0x5'));var rimraf=require(_0xa4a5('0x6'));var config=require(_0xa4a5('0x7'));var attributes=require(_0xa4a5('0x8'));module[_0xa4a5('0x9')]=function(_0x491af5,_0x4bc593){return _0x491af5[_0xa4a5('0xa')]('VoiceCallReport',attributes,{'tableName':_0xa4a5('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa4a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf62=['define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports'];(function(_0x41ade1,_0x34af04){var _0x465d5f=function(_0x22a1af){while(--_0x22a1af){_0x41ade1['push'](_0x41ade1['shift']());}};_0x465d5f(++_0x34af04);}(_0xaf62,0x88));var _0x2af6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf62[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2af6('0x0'));var util=require('util');var logger=require(_0x2af6('0x1'))(_0x2af6('0x2'));var moment=require(_0x2af6('0x3'));var BPromise=require('bluebird');var rp=require(_0x2af6('0x4'));var fs=require('fs');var path=require(_0x2af6('0x5'));var rimraf=require(_0x2af6('0x6'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x2af6('0x7')]=function(_0x11ce83,_0x547e2){return _0x11ce83[_0x2af6('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 208d0fc..a4801ef 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 _0xf037=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','map','include','model','debug','catch','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update','lodash','util','moment'];(function(_0x5d6e72,_0x5cf4a3){var _0x52d375=function(_0x1b3425){while(--_0x1b3425){_0x5d6e72['push'](_0x5d6e72['shift']());}};_0x52d375(++_0x5cf4a3);}(_0xf037,0x1e7));var _0x7f03=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xf037[_0x1e172a];return _0x96338b;};'use strict';var _=require(_0x7f03('0x0'));var util=require(_0x7f03('0x1'));var moment=require(_0x7f03('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f03('0x3'));var db=require(_0x7f03('0x4'))['db'];var utils=require(_0x7f03('0x5'));var logger=require('../../config/logger')(_0x7f03('0x6'));var config=require(_0x7f03('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f03('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x660db7,_0x23d8ad,_0x1a740f){return new BPromise(function(_0x3af8d0,_0x18624e){return client['request'](_0x660db7,_0x1a740f)[_0x7f03('0x9')](function(_0x2fe4f7){logger[_0x7f03('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x23d8ad,_0x7f03('0xb'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x23d8ad,'request\x20sent',JSON[_0x7f03('0xc')](_0x2fe4f7));if(_0x2fe4f7[_0x7f03('0xd')]){if(_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0xe')]===0x1f4){logger['error'](_0x7f03('0xf'),_0x23d8ad,_0x2fe4f7[_0x7f03('0xd')]['message']);return _0x18624e(_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0x10')]);}logger[_0x7f03('0xd')](_0x7f03('0xf'),_0x23d8ad,_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0x10')]);return _0x3af8d0(_0x2fe4f7[_0x7f03('0xd')][_0x7f03('0x10')]);}else{logger[_0x7f03('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x23d8ad,_0x7f03('0xb'));_0x3af8d0(_0x2fe4f7[_0x7f03('0x11')]['message']);}})['catch'](function(_0x4954b0){logger[_0x7f03('0xd')](_0x7f03('0xf'),_0x23d8ad,_0x4954b0);_0x18624e(_0x4954b0);});});}exports[_0x7f03('0x12')]=function(_0x1d2528){var _0x1dd1f1=this;return new Promise(function(_0x5e11d5,_0x4353d6){return db[_0x7f03('0x13')][_0x7f03('0x14')]({'raw':_0x1d2528['options']?_0x1d2528[_0x7f03('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2528[_0x7f03('0x15')]?_0x1d2528[_0x7f03('0x15')][_0x7f03('0x16')]||null:null,'attributes':_0x1d2528['options']?_0x1d2528[_0x7f03('0x15')][_0x7f03('0x17')]||null:null,'limit':_0x1d2528[_0x7f03('0x15')]?_0x1d2528[_0x7f03('0x15')][_0x7f03('0x18')]||null:null,'include':_0x1d2528['options']?_0x1d2528[_0x7f03('0x15')]['include']?_[_0x7f03('0x19')](_0x1d2528[_0x7f03('0x15')][_0x7f03('0x1a')],function(_0x1d79cc){return{'model':db[_0x1d79cc[_0x7f03('0x1b')]],'as':_0x1d79cc['as'],'attributes':_0x1d79cc[_0x7f03('0x17')],'include':_0x1d79cc[_0x7f03('0x1a')]?_[_0x7f03('0x19')](_0x1d79cc[_0x7f03('0x1a')],function(_0x27121e){return{'model':db[_0x27121e[_0x7f03('0x1b')]],'as':_0x27121e['as'],'attributes':_0x27121e['attributes'],'include':_0x27121e['include']?_[_0x7f03('0x19')](_0x27121e[_0x7f03('0x1a')],function(_0x301b99){return{'model':db[_0x301b99['model']],'as':_0x301b99['as'],'attributes':_0x301b99[_0x7f03('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x314c1f){logger['info'](_0x7f03('0x12'),_0x1d2528);logger[_0x7f03('0x1c')](_0x7f03('0x12'),_0x1d2528,JSON[_0x7f03('0xc')](_0x314c1f));_0x5e11d5(_0x314c1f);})[_0x7f03('0x1d')](function(_0x1fb0c1){logger[_0x7f03('0xd')]('GetVoiceCallReport',_0x1fb0c1[_0x7f03('0x10')],_0x1d2528);_0x4353d6(_0x1dd1f1['error'](0x1f4,_0x1fb0c1[_0x7f03('0x10')]));});});};exports[_0x7f03('0x1e')]=function(_0x51f3ab){var _0x5bde3f=this;return new Promise(function(_0xd8534e,_0x1ffd3a){return db['VoiceCallReport']['create'](_0x51f3ab[_0x7f03('0x1f')],{'raw':_0x51f3ab[_0x7f03('0x15')]?_0x51f3ab['options'][_0x7f03('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x27b196){logger[_0x7f03('0xa')](_0x7f03('0x1e'),_0x51f3ab);logger['debug'](_0x7f03('0x1e'),_0x51f3ab,JSON[_0x7f03('0xc')](_0x27b196));_0xd8534e(_0x27b196);})[_0x7f03('0x1d')](function(_0x39e20c){logger[_0x7f03('0xd')](_0x7f03('0x1e'),_0x39e20c[_0x7f03('0x10')],_0x51f3ab);_0x1ffd3a(_0x5bde3f[_0x7f03('0xd')](0x1f4,_0x39e20c[_0x7f03('0x10')]));});});};exports[_0x7f03('0x21')]=function(_0x39be41){var _0x278e5d=this;return new Promise(function(_0x2f37d1,_0x28f34f){return db['VoiceCallReport'][_0x7f03('0x22')](_0x39be41['body'],{'raw':_0x39be41[_0x7f03('0x15')]?_0x39be41[_0x7f03('0x15')][_0x7f03('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39be41[_0x7f03('0x15')]?_0x39be41[_0x7f03('0x15')][_0x7f03('0x16')]||null:null,'attributes':_0x39be41[_0x7f03('0x15')]?_0x39be41['options'][_0x7f03('0x17')]||null:null,'limit':_0x39be41[_0x7f03('0x15')]?_0x39be41[_0x7f03('0x15')]['limit']||null:null})['then'](function(_0x19ed2c){logger[_0x7f03('0xa')](_0x7f03('0x21'),_0x39be41);logger[_0x7f03('0x1c')](_0x7f03('0x21'),_0x39be41,JSON['stringify'](_0x19ed2c));_0x2f37d1(_0x19ed2c);})[_0x7f03('0x1d')](function(_0x2f186e){logger[_0x7f03('0xd')](_0x7f03('0x21'),_0x2f186e[_0x7f03('0x10')],_0x39be41);_0x28f34f(_0x278e5d[_0x7f03('0xd')](0x1f4,_0x2f186e[_0x7f03('0x10')]));});});}; \ No newline at end of file +var _0xa3d5=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceCallReport','stringify','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x23fc49,_0x24b727){var _0x39e5ed=function(_0x56ce61){while(--_0x56ce61){_0x23fc49['push'](_0x23fc49['shift']());}};_0x39e5ed(++_0x24b727);}(_0xa3d5,0xfe));var _0x5a3d=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0xa3d5[_0x47878f];return _0x4b05b8;};'use strict';var _=require(_0x5a3d('0x0'));var util=require('util');var moment=require(_0x5a3d('0x1'));var BPromise=require(_0x5a3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a3d('0x3'));var db=require(_0x5a3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a3d('0x5'))(_0x5a3d('0x6'));var config=require(_0x5a3d('0x7'));var jayson=require(_0x5a3d('0x8'));var client=jayson['client'][_0x5a3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c0cbc,_0x36d87a,_0x31bd06){return new BPromise(function(_0x4ab6f8,_0x5131d7){return client[_0x5a3d('0xa')](_0x4c0cbc,_0x31bd06)[_0x5a3d('0xb')](function(_0x3ceeb6){logger[_0x5a3d('0xc')](_0x5a3d('0xd'),_0x36d87a,_0x5a3d('0xe'));logger[_0x5a3d('0xf')](_0x5a3d('0x10'),_0x36d87a,_0x5a3d('0xe'),JSON['stringify'](_0x3ceeb6));if(_0x3ceeb6['error']){if(_0x3ceeb6[_0x5a3d('0x11')][_0x5a3d('0x12')]===0x1f4){logger['error'](_0x5a3d('0xd'),_0x36d87a,_0x3ceeb6[_0x5a3d('0x11')]['message']);return _0x5131d7(_0x3ceeb6[_0x5a3d('0x11')][_0x5a3d('0x13')]);}logger[_0x5a3d('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x36d87a,_0x3ceeb6['error'][_0x5a3d('0x13')]);return _0x4ab6f8(_0x3ceeb6['error'][_0x5a3d('0x13')]);}else{logger[_0x5a3d('0xc')](_0x5a3d('0xd'),_0x36d87a,'request\x20sent');_0x4ab6f8(_0x3ceeb6[_0x5a3d('0x14')][_0x5a3d('0x13')]);}})[_0x5a3d('0x15')](function(_0x184431){logger[_0x5a3d('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x36d87a,_0x184431);_0x5131d7(_0x184431);});});}exports['GetVoiceCallReport']=function(_0x53ea4a){var _0xa53d4c=this;return new Promise(function(_0x5788c6,_0x2e2f35){return db[_0x5a3d('0x16')][_0x5a3d('0x17')]({'raw':_0x53ea4a['options']?_0x53ea4a[_0x5a3d('0x18')][_0x5a3d('0x19')]===undefined?!![]:![]:!![],'where':_0x53ea4a[_0x5a3d('0x18')]?_0x53ea4a[_0x5a3d('0x18')]['where']||null:null,'attributes':_0x53ea4a[_0x5a3d('0x18')]?_0x53ea4a[_0x5a3d('0x18')][_0x5a3d('0x1a')]||null:null,'limit':_0x53ea4a[_0x5a3d('0x18')]?_0x53ea4a[_0x5a3d('0x18')][_0x5a3d('0x1b')]||null:null,'include':_0x53ea4a['options']?_0x53ea4a[_0x5a3d('0x18')]['include']?_['map'](_0x53ea4a[_0x5a3d('0x18')]['include'],function(_0x5027ea){return{'model':db[_0x5027ea['model']],'as':_0x5027ea['as'],'attributes':_0x5027ea[_0x5a3d('0x1a')],'include':_0x5027ea[_0x5a3d('0x1c')]?_[_0x5a3d('0x1d')](_0x5027ea['include'],function(_0x5147d6){return{'model':db[_0x5147d6[_0x5a3d('0x1e')]],'as':_0x5147d6['as'],'attributes':_0x5147d6[_0x5a3d('0x1a')],'include':_0x5147d6['include']?_[_0x5a3d('0x1d')](_0x5147d6[_0x5a3d('0x1c')],function(_0x55e93f){return{'model':db[_0x55e93f[_0x5a3d('0x1e')]],'as':_0x55e93f['as'],'attributes':_0x55e93f[_0x5a3d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f5b8b){logger[_0x5a3d('0xc')](_0x5a3d('0x1f'),_0x53ea4a);logger[_0x5a3d('0xf')](_0x5a3d('0x1f'),_0x53ea4a,JSON[_0x5a3d('0x20')](_0x5f5b8b));_0x5788c6(_0x5f5b8b);})[_0x5a3d('0x15')](function(_0x46b023){logger['error'](_0x5a3d('0x1f'),_0x46b023['message'],_0x53ea4a);_0x2e2f35(_0xa53d4c['error'](0x1f4,_0x46b023['message']));});});};exports[_0x5a3d('0x21')]=function(_0x38bb4a){var _0x368cc2=this;return new Promise(function(_0x319514,_0x3a3110){return db[_0x5a3d('0x16')]['create'](_0x38bb4a[_0x5a3d('0x22')],{'raw':_0x38bb4a['options']?_0x38bb4a[_0x5a3d('0x18')][_0x5a3d('0x19')]===undefined?!![]:![]:!![]})[_0x5a3d('0xb')](function(_0x29a183){logger[_0x5a3d('0xc')](_0x5a3d('0x21'),_0x38bb4a);logger[_0x5a3d('0xf')](_0x5a3d('0x21'),_0x38bb4a,JSON[_0x5a3d('0x20')](_0x29a183));_0x319514(_0x29a183);})['catch'](function(_0xb99141){logger[_0x5a3d('0x11')](_0x5a3d('0x21'),_0xb99141[_0x5a3d('0x13')],_0x38bb4a);_0x3a3110(_0x368cc2[_0x5a3d('0x11')](0x1f4,_0xb99141[_0x5a3d('0x13')]));});});};exports[_0x5a3d('0x23')]=function(_0x3dea81){var _0x4144b3=this;return new Promise(function(_0x342837,_0x31c88e){return db[_0x5a3d('0x16')][_0x5a3d('0x24')](_0x3dea81[_0x5a3d('0x22')],{'raw':_0x3dea81['options']?_0x3dea81[_0x5a3d('0x18')][_0x5a3d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dea81[_0x5a3d('0x18')]?_0x3dea81[_0x5a3d('0x18')][_0x5a3d('0x25')]||null:null,'attributes':_0x3dea81[_0x5a3d('0x18')]?_0x3dea81[_0x5a3d('0x18')][_0x5a3d('0x1a')]||null:null,'limit':_0x3dea81[_0x5a3d('0x18')]?_0x3dea81[_0x5a3d('0x18')]['limit']||null:null})[_0x5a3d('0xb')](function(_0x498f7f){logger[_0x5a3d('0xc')](_0x5a3d('0x23'),_0x3dea81);logger[_0x5a3d('0xf')](_0x5a3d('0x23'),_0x3dea81,JSON[_0x5a3d('0x20')](_0x498f7f));_0x342837(_0x498f7f);})[_0x5a3d('0x15')](function(_0x15b3c6){logger[_0x5a3d('0x11')](_0x5a3d('0x23'),_0x15b3c6[_0x5a3d('0x13')],_0x3dea81);_0x31c88e(_0x4144b3[_0x5a3d('0x11')](0x1f4,_0x15b3c6[_0x5a3d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 057491f..71715bc 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 _0x7953=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x1d9a84,_0x157084){var _0x418754=function(_0xfc0e01){while(--_0xfc0e01){_0x1d9a84['push'](_0x1d9a84['shift']());}};_0x418754(++_0x157084);}(_0x7953,0x1cd));var _0x3795=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x7953[_0x49d19d];return _0x4ebef1;};'use strict';var multer=require(_0x3795('0x0'));var util=require(_0x3795('0x1'));var path=require('path');var timeout=require(_0x3795('0x2'));var express=require('express');var router=express[_0x3795('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3795('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3795('0x5'));router[_0x3795('0x6')]('/',auth[_0x3795('0x7')](),controller[_0x3795('0x8')]);router[_0x3795('0x6')](_0x3795('0x9'),auth['isAuthenticated'](),controller[_0x3795('0xa')]);router[_0x3795('0xb')]('/',auth['isAuthenticated'](),controller[_0x3795('0xc')]);router['put'](_0x3795('0x9'),auth[_0x3795('0x7')](),controller[_0x3795('0xd')]);router[_0x3795('0xe')](_0x3795('0x9'),auth['isAuthenticated'](),controller[_0x3795('0xf')]);module[_0x3795('0x10')]=router; \ No newline at end of file +var _0x7712=['index','/:id','show','post','isAuthenticated','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x7712,0x18f));var _0x2771=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7712[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2771('0x0'));var router=express['Router']();var fs_extra=require(_0x2771('0x1'));var auth=require(_0x2771('0x2'));var interaction=require(_0x2771('0x3'));var config=require(_0x2771('0x4'));var controller=require(_0x2771('0x5'));router[_0x2771('0x6')]('/',auth['isAuthenticated'](),controller[_0x2771('0x7')]);router[_0x2771('0x6')](_0x2771('0x8'),auth['isAuthenticated'](),controller[_0x2771('0x9')]);router[_0x2771('0xa')]('/',auth[_0x2771('0xb')](),controller['create']);router['put']('/:id',auth[_0x2771('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2771('0xc')]);module[_0x2771('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ef087b2..703e3c1 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 _0x7f48=['options','BOOLEAN','STRING','name','setDataValue','join','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f48,0x144));var _0x87f4=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x7f48[_0x96f74c];return _0x379222;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x87f4('0x0')],'unique':_0x87f4('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x87f4('0x0')],'set':function(_0x14bcfb){this[_0x87f4('0x2')]('options',_0x14bcfb?_0x14bcfb[_0x87f4('0x3')](''):[]);},'get':function(){return this[_0x87f4('0x4')](_0x87f4('0x5'))?this[_0x87f4('0x4')](_0x87f4('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0x87f4('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x87f4('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87f4('0x0')]}}; \ No newline at end of file +var _0x1f11=['setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x20130c,_0x1d1159){var _0x20630b=function(_0x47c4b3){while(--_0x47c4b3){_0x20130c['push'](_0x20130c['shift']());}};_0x20630b(++_0x1d1159);}(_0x1f11,0xb0));var _0x11f1=function(_0x2ea20d,_0x5e8e3c){_0x2ea20d=_0x2ea20d-0x0;var _0x3ba66a=_0x1f11[_0x2ea20d];return _0x3ba66a;};'use strict';var Sequelize=require(_0x11f1('0x0'));module[_0x11f1('0x1')]={'name':{'type':Sequelize[_0x11f1('0x2')]},'prefix':{'type':Sequelize[_0x11f1('0x2')],'unique':_0x11f1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x11f1('0x2')],'set':function(_0x594cd3){this[_0x11f1('0x4')](_0x11f1('0x5'),_0x594cd3?_0x594cd3['join'](''):[]);},'get':function(){return this[_0x11f1('0x6')](_0x11f1('0x5'))?this[_0x11f1('0x6')](_0x11f1('0x5'))[_0x11f1('0x7')](''):[];}},'auth':{'type':Sequelize[_0x11f1('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x11f1('0x2')]},'record':{'type':Sequelize[_0x11f1('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x11f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ead51b3..e3440f2 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 _0x8ba2=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x411a9b,_0x5868ee){var _0x437505=function(_0x2bd719){while(--_0x2bd719){_0x411a9b['push'](_0x411a9b['shift']());}};_0x437505(++_0x5868ee);}(_0x8ba2,0x13f));var _0x28ba=function(_0x1b9ccc,_0x5d7607){_0x1b9ccc=_0x1b9ccc-0x0;var _0x42988f=_0x8ba2[_0x1b9ccc];return _0x42988f;};'use strict';var emlformat=require(_0x28ba('0x0'));var rimraf=require(_0x28ba('0x1'));var zipdir=require(_0x28ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ba('0x3'));var moment=require(_0x28ba('0x4'));var BPromise=require(_0x28ba('0x5'));var Mustache=require('mustache');var util=require(_0x28ba('0x6'));var path=require(_0x28ba('0x7'));var sox=require(_0x28ba('0x8'));var csv=require(_0x28ba('0x9'));var ejs=require(_0x28ba('0xa'));var fs=require('fs');var fs_extra=require(_0x28ba('0xb'));var _=require('lodash');var squel=require(_0x28ba('0xc'));var crypto=require(_0x28ba('0xd'));var jsforce=require(_0x28ba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28ba('0x9'));var querystring=require(_0x28ba('0xf'));var Papa=require(_0x28ba('0x10'));var Redis=require(_0x28ba('0x11'));var authService=require(_0x28ba('0x12'));var qs=require(_0x28ba('0x13'));var as=require(_0x28ba('0x14'));var hardwareService=require(_0x28ba('0x15'));var logger=require(_0x28ba('0x16'))(_0x28ba('0x17'));var utils=require('../../config/utils');var config=require(_0x28ba('0x18'));var licenseUtil=require(_0x28ba('0x19'));var db=require(_0x28ba('0x1a'))['db'];function respondWithStatusCode(_0x299f63,_0x1204af){_0x1204af=_0x1204af||0xcc;return function(_0x3a9644){if(_0x3a9644){return _0x299f63[_0x28ba('0x1b')](_0x1204af);}return _0x299f63['status'](_0x1204af)[_0x28ba('0x1c')]();};}function respondWithResult(_0x3cf923,_0x4ebcd6){_0x4ebcd6=_0x4ebcd6||0xc8;return function(_0x29cd51){if(_0x29cd51){return _0x3cf923[_0x28ba('0x1d')](_0x4ebcd6)[_0x28ba('0x1e')](_0x29cd51);}};}function respondWithFilteredResult(_0x1c5998,_0x563797){return function(_0x24b3f3){if(_0x24b3f3){var _0x38df4f=typeof _0x563797[_0x28ba('0x1f')]===_0x28ba('0x20')&&typeof _0x563797[_0x28ba('0x21')]==='undefined';var _0x571c92=_0x24b3f3[_0x28ba('0x22')];var _0x182824=_0x38df4f?0x0:_0x563797[_0x28ba('0x1f')];var _0x2cf1cf=_0x38df4f?_0x24b3f3[_0x28ba('0x22')]:_0x563797[_0x28ba('0x1f')]+_0x563797[_0x28ba('0x21')];var _0x31a45b;if(_0x2cf1cf>=_0x571c92){_0x2cf1cf=_0x571c92;_0x31a45b=0xc8;}else{_0x31a45b=0xce;}_0x1c5998[_0x28ba('0x1d')](_0x31a45b);return _0x1c5998['set']('Content-Range',_0x182824+'-'+_0x2cf1cf+'/'+_0x571c92)[_0x28ba('0x1e')](_0x24b3f3);}return null;};}function patchUpdates(_0x4352a4){return function(_0x5d3d33){try{jsonpatch['apply'](_0x5d3d33,_0x4352a4,!![]);}catch(_0xf9e0f4){return BPromise[_0x28ba('0x23')](_0xf9e0f4);}return _0x5d3d33[_0x28ba('0x24')]();};}function saveUpdates(_0x17b1f4,_0x425732){return function(_0x4ff05c){if(_0x4ff05c){return _0x4ff05c[_0x28ba('0x25')](_0x17b1f4)[_0x28ba('0x26')](function(_0x1684af){return _0x1684af;});}return null;};}function removeEntity(_0x3eec5d,_0x27a579){return function(_0x256892){if(_0x256892){return _0x256892['destroy']()[_0x28ba('0x26')](function(){var _0x46969a=_0x256892[_0x28ba('0x27')]({'plain':!![]});var _0x1d3fd1=_0x28ba('0x28');return db[_0x28ba('0x29')]['destroy']({'where':{'type':_0x1d3fd1,'resourceId':_0x46969a['id']}})[_0x28ba('0x26')](function(){return _0x256892;});})[_0x28ba('0x26')](function(){_0x3eec5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36dc29,_0x3e1ce7){return function(_0x5b9237){if(!_0x5b9237){_0x36dc29['sendStatus'](0x194);}return _0x5b9237;};}function handleError(_0x4267b4,_0x3638c5){_0x3638c5=_0x3638c5||0x1f4;return function(_0x39cd83){logger[_0x28ba('0x2a')](_0x39cd83[_0x28ba('0x2b')]);if(_0x39cd83[_0x28ba('0x2c')]){delete _0x39cd83[_0x28ba('0x2c')];}_0x4267b4[_0x28ba('0x1d')](_0x3638c5)[_0x28ba('0x2d')](_0x39cd83);};}exports[_0x28ba('0x2e')]=function(_0x296b66,_0x32ab4b){var _0x27737d={},_0x2c712e={},_0x5f0202={'count':0x0,'rows':[]};var _0x13dfd4=_[_0x28ba('0x2f')](db[_0x28ba('0x30')]['rawAttributes'],function(_0x2c32f3){return{'name':_0x2c32f3[_0x28ba('0x31')],'type':_0x2c32f3[_0x28ba('0x32')]['key']};});_0x2c712e[_0x28ba('0x33')]=_[_0x28ba('0x2f')](_0x13dfd4,_0x28ba('0x2c'));_0x2c712e[_0x28ba('0x34')]=_[_0x28ba('0x35')](_0x296b66[_0x28ba('0x34')]);_0x2c712e[_0x28ba('0x36')]=_[_0x28ba('0x37')](_0x2c712e[_0x28ba('0x33')],_0x2c712e[_0x28ba('0x34')]);_0x27737d['attributes']=_[_0x28ba('0x37')](_0x2c712e[_0x28ba('0x33')],qs[_0x28ba('0x38')](_0x296b66['query'][_0x28ba('0x38')]));_0x27737d[_0x28ba('0x39')]=_0x27737d[_0x28ba('0x39')][_0x28ba('0x3a')]?_0x27737d[_0x28ba('0x39')]:_0x2c712e[_0x28ba('0x33')];if(!_0x296b66[_0x28ba('0x34')][_0x28ba('0x3b')](_0x28ba('0x3c'))){_0x27737d[_0x28ba('0x21')]=qs[_0x28ba('0x21')](_0x296b66[_0x28ba('0x34')]['limit']);_0x27737d['offset']=qs['offset'](_0x296b66[_0x28ba('0x34')][_0x28ba('0x1f')]);}_0x27737d['order']=qs[_0x28ba('0x3d')](_0x296b66[_0x28ba('0x34')]['sort']);_0x27737d['where']=qs[_0x28ba('0x36')](_[_0x28ba('0x3e')](_0x296b66['query'],_0x2c712e['filters']),_0x13dfd4);if(_0x296b66[_0x28ba('0x34')][_0x28ba('0x3f')]){_0x27737d[_0x28ba('0x40')]=_[_0x28ba('0x41')](_0x27737d[_0x28ba('0x40')],{'$or':_[_0x28ba('0x2f')](_0x13dfd4,function(_0x241a4a){if(_0x241a4a[_0x28ba('0x32')]!==_0x28ba('0x42')){var _0x5b0174={};_0x5b0174[_0x241a4a['name']]={'$like':'%'+_0x296b66['query'][_0x28ba('0x3f')]+'%'};return _0x5b0174;}})});}_0x27737d=_[_0x28ba('0x41')]({},_0x27737d,_0x296b66[_0x28ba('0x43')]);var _0x2f5ce4={'where':_0x27737d[_0x28ba('0x40')]};return db['VoiceChanSpy']['count'](_0x2f5ce4)['then'](function(_0x424f73){_0x5f0202[_0x28ba('0x22')]=_0x424f73;if(_0x296b66[_0x28ba('0x34')][_0x28ba('0x44')]){_0x27737d[_0x28ba('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x28ba('0x46')](_0x27737d);})[_0x28ba('0x26')](function(_0x364b7a){_0x5f0202[_0x28ba('0x47')]=_0x364b7a;return _0x5f0202;})[_0x28ba('0x26')](respondWithFilteredResult(_0x32ab4b,_0x27737d))[_0x28ba('0x48')](handleError(_0x32ab4b,null));};exports[_0x28ba('0x49')]=function(_0x1c12f4,_0x213497){var _0x4c550c={'raw':![],'where':{'id':_0x1c12f4[_0x28ba('0x4a')]['id']}},_0x53f882={};_0x53f882[_0x28ba('0x33')]=_[_0x28ba('0x35')](db[_0x28ba('0x30')][_0x28ba('0x4b')]);_0x53f882['query']=_['keys'](_0x1c12f4['query']);_0x53f882['filters']=_[_0x28ba('0x37')](_0x53f882[_0x28ba('0x33')],_0x53f882[_0x28ba('0x34')]);_0x4c550c[_0x28ba('0x39')]=_[_0x28ba('0x37')](_0x53f882[_0x28ba('0x33')],qs['fields'](_0x1c12f4[_0x28ba('0x34')][_0x28ba('0x38')]));_0x4c550c['attributes']=_0x4c550c['attributes'][_0x28ba('0x3a')]?_0x4c550c['attributes']:_0x53f882[_0x28ba('0x33')];if(_0x1c12f4[_0x28ba('0x34')]['includeAll']){_0x4c550c[_0x28ba('0x45')]=[{'all':!![]}];}_0x4c550c=_['merge']({},_0x4c550c,_0x1c12f4[_0x28ba('0x43')]);return db['VoiceChanSpy'][_0x28ba('0x4c')](_0x4c550c)[_0x28ba('0x26')](handleEntityNotFound(_0x213497,null))[_0x28ba('0x26')](respondWithResult(_0x213497,null))[_0x28ba('0x48')](handleError(_0x213497,null));};exports[_0x28ba('0x4d')]=function(_0x4047c1,_0x5ccfab){return db[_0x28ba('0x30')]['create'](_0x4047c1['body'],{})[_0x28ba('0x26')](function(_0xd327ac){var _0x21931b=_0x4047c1[_0x28ba('0x4e')]['get']({'plain':!![]});if(!_0x21931b)throw new Error(_0x28ba('0x4f'));if(_0x21931b['role']==='user'){var _0x38bf5b=_0xd327ac[_0x28ba('0x27')]({'plain':!![]});var _0xf0938f=_0x28ba('0x28');return db[_0x28ba('0x50')][_0x28ba('0x4c')]({'where':{'name':_0xf0938f,'userProfileId':_0x21931b[_0x28ba('0x51')]},'raw':!![]})[_0x28ba('0x26')](function(_0x5aac05){if(_0x5aac05&&_0x5aac05[_0x28ba('0x52')]===0x0){return db[_0x28ba('0x29')][_0x28ba('0x4d')]({'name':_0x38bf5b[_0x28ba('0x2c')],'resourceId':_0x38bf5b['id'],'type':_0x5aac05[_0x28ba('0x2c')],'sectionId':_0x5aac05['id']},{})['then'](function(){return _0xd327ac;});}else{return _0xd327ac;}})[_0x28ba('0x48')](function(_0x2ec307){logger[_0x28ba('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ec307);throw _0x2ec307;});}return _0xd327ac;})[_0x28ba('0x26')](respondWithResult(_0x5ccfab,0xc9))[_0x28ba('0x48')](handleError(_0x5ccfab,null));};exports[_0x28ba('0x25')]=function(_0x4f5a05,_0x23e1fc){if(_0x4f5a05['body']['id']){delete _0x4f5a05[_0x28ba('0x53')]['id'];}return db[_0x28ba('0x30')]['find']({'where':{'id':_0x4f5a05[_0x28ba('0x4a')]['id']}})[_0x28ba('0x26')](handleEntityNotFound(_0x23e1fc,null))[_0x28ba('0x26')](saveUpdates(_0x4f5a05[_0x28ba('0x53')],null))[_0x28ba('0x26')](respondWithResult(_0x23e1fc,null))[_0x28ba('0x48')](handleError(_0x23e1fc,null));};exports[_0x28ba('0x54')]=function(_0x2131b8,_0x24bdd6){return db[_0x28ba('0x30')][_0x28ba('0x4c')]({'where':{'id':_0x2131b8['params']['id']}})[_0x28ba('0x26')](handleEntityNotFound(_0x24bdd6,null))[_0x28ba('0x26')](removeEntity(_0x24bdd6,null))[_0x28ba('0x48')](handleError(_0x24bdd6,null));}; \ No newline at end of file +var _0x1b73=['map','VoiceChanSpy','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','error','stack','name','send','index'];(function(_0x39d0f2,_0x1d63e1){var _0x2febf1=function(_0x5588ed){while(--_0x5588ed){_0x39d0f2['push'](_0x39d0f2['shift']());}};_0x2febf1(++_0x1d63e1);}(_0x1b73,0x1d5));var _0x31b7=function(_0x87f4f0,_0x505c12){_0x87f4f0=_0x87f4f0-0x0;var _0x4aa369=_0x1b73[_0x87f4f0];return _0x4aa369;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){var _0x35a51f=_0x3b0eff[_0x31b7('0x28')]({'plain':!![]});var _0x2c993b='ChanSpies';return db[_0x31b7('0x29')]['destroy']({'where':{'type':_0x2c993b,'resourceId':_0x35a51f['id']}})[_0x31b7('0x27')](function(){return _0x3b0eff;});})[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0xffacb,_0x128865){return function(_0x21ab03){if(!_0x21ab03){_0xffacb[_0x31b7('0x1a')](0x194);}return _0x21ab03;};}function handleError(_0x4e58e5,_0x47ef33){_0x47ef33=_0x47ef33||0x1f4;return function(_0x503549){logger[_0x31b7('0x2a')](_0x503549[_0x31b7('0x2b')]);if(_0x503549[_0x31b7('0x2c')]){delete _0x503549['name'];}_0x4e58e5[_0x31b7('0x1b')](_0x47ef33)[_0x31b7('0x2d')](_0x503549);};}exports[_0x31b7('0x2e')]=function(_0x277273,_0x58a87e){var _0x5b0ed2={},_0x34c62a={},_0x4b5cf9={'count':0x0,'rows':[]};var _0x574dfe=_[_0x31b7('0x2f')](db[_0x31b7('0x30')][_0x31b7('0x31')],function(_0x35f83c){return{'name':_0x35f83c['fieldName'],'type':_0x35f83c['type'][_0x31b7('0x32')]};});_0x34c62a[_0x31b7('0x33')]=_[_0x31b7('0x2f')](_0x574dfe,_0x31b7('0x2c'));_0x34c62a[_0x31b7('0x34')]=_['keys'](_0x277273['query']);_0x34c62a[_0x31b7('0x35')]=_[_0x31b7('0x36')](_0x34c62a['model'],_0x34c62a[_0x31b7('0x34')]);_0x5b0ed2[_0x31b7('0x37')]=_['intersection'](_0x34c62a[_0x31b7('0x33')],qs[_0x31b7('0x38')](_0x277273[_0x31b7('0x34')][_0x31b7('0x38')]));_0x5b0ed2[_0x31b7('0x37')]=_0x5b0ed2[_0x31b7('0x37')][_0x31b7('0x39')]?_0x5b0ed2[_0x31b7('0x37')]:_0x34c62a[_0x31b7('0x33')];if(!_0x277273[_0x31b7('0x34')][_0x31b7('0x3a')](_0x31b7('0x3b'))){_0x5b0ed2[_0x31b7('0x1e')]=qs['limit'](_0x277273['query'][_0x31b7('0x1e')]);_0x5b0ed2[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x277273[_0x31b7('0x34')][_0x31b7('0x20')]);}_0x5b0ed2[_0x31b7('0x3c')]=qs[_0x31b7('0x3d')](_0x277273[_0x31b7('0x34')][_0x31b7('0x3d')]);_0x5b0ed2[_0x31b7('0x3e')]=qs['filters'](_[_0x31b7('0x3f')](_0x277273[_0x31b7('0x34')],_0x34c62a[_0x31b7('0x35')]),_0x574dfe);if(_0x277273[_0x31b7('0x34')]['filter']){_0x5b0ed2[_0x31b7('0x3e')]=_[_0x31b7('0x40')](_0x5b0ed2['where'],{'$or':_[_0x31b7('0x2f')](_0x574dfe,function(_0x5724fa){if(_0x5724fa['type']!==_0x31b7('0x41')){var _0x10e82c={};_0x10e82c[_0x5724fa[_0x31b7('0x2c')]]={'$like':'%'+_0x277273[_0x31b7('0x34')][_0x31b7('0x42')]+'%'};return _0x10e82c;}})});}_0x5b0ed2=_['merge']({},_0x5b0ed2,_0x277273[_0x31b7('0x43')]);var _0x5d01ee={'where':_0x5b0ed2['where']};return db['VoiceChanSpy'][_0x31b7('0x1f')](_0x5d01ee)[_0x31b7('0x27')](function(_0x1527b3){_0x4b5cf9[_0x31b7('0x1f')]=_0x1527b3;if(_0x277273[_0x31b7('0x34')]['includeAll']){_0x5b0ed2[_0x31b7('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x31b7('0x45')](_0x5b0ed2);})[_0x31b7('0x27')](function(_0x41c92e){_0x4b5cf9[_0x31b7('0x46')]=_0x41c92e;return _0x4b5cf9;})['then'](respondWithFilteredResult(_0x58a87e,_0x5b0ed2))[_0x31b7('0x47')](handleError(_0x58a87e,null));};exports[_0x31b7('0x48')]=function(_0x1046fb,_0x4b3d24){var _0x31fd89={'raw':![],'where':{'id':_0x1046fb[_0x31b7('0x49')]['id']}},_0x51918d={};_0x51918d[_0x31b7('0x33')]=_['keys'](db[_0x31b7('0x30')][_0x31b7('0x31')]);_0x51918d[_0x31b7('0x34')]=_[_0x31b7('0x4a')](_0x1046fb['query']);_0x51918d[_0x31b7('0x35')]=_['intersection'](_0x51918d['model'],_0x51918d[_0x31b7('0x34')]);_0x31fd89[_0x31b7('0x37')]=_[_0x31b7('0x36')](_0x51918d[_0x31b7('0x33')],qs['fields'](_0x1046fb[_0x31b7('0x34')][_0x31b7('0x38')]));_0x31fd89['attributes']=_0x31fd89[_0x31b7('0x37')][_0x31b7('0x39')]?_0x31fd89[_0x31b7('0x37')]:_0x51918d['model'];if(_0x1046fb[_0x31b7('0x34')][_0x31b7('0x4b')]){_0x31fd89[_0x31b7('0x44')]=[{'all':!![]}];}_0x31fd89=_[_0x31b7('0x40')]({},_0x31fd89,_0x1046fb[_0x31b7('0x43')]);return db[_0x31b7('0x30')][_0x31b7('0x4c')](_0x31fd89)[_0x31b7('0x27')](handleEntityNotFound(_0x4b3d24,null))['then'](respondWithResult(_0x4b3d24,null))[_0x31b7('0x47')](handleError(_0x4b3d24,null));};exports['create']=function(_0x5a72ee,_0x22cc77){return db[_0x31b7('0x30')][_0x31b7('0x4d')](_0x5a72ee[_0x31b7('0x4e')],{})['then'](function(_0x322798){var _0x18556b=_0x5a72ee[_0x31b7('0x4f')]['get']({'plain':!![]});if(!_0x18556b)throw new Error(_0x31b7('0x50'));if(_0x18556b[_0x31b7('0x51')]===_0x31b7('0x4f')){var _0x3b5868=_0x322798[_0x31b7('0x28')]({'plain':!![]});var _0x309077=_0x31b7('0x52');return db[_0x31b7('0x53')]['find']({'where':{'name':_0x309077,'userProfileId':_0x18556b['userProfileId']},'raw':!![]})[_0x31b7('0x27')](function(_0x1d55e6){if(_0x1d55e6&&_0x1d55e6[_0x31b7('0x54')]===0x0){return db[_0x31b7('0x29')]['create']({'name':_0x3b5868['name'],'resourceId':_0x3b5868['id'],'type':_0x1d55e6[_0x31b7('0x2c')],'sectionId':_0x1d55e6['id']},{})[_0x31b7('0x27')](function(){return _0x322798;});}else{return _0x322798;}})[_0x31b7('0x47')](function(_0x5ea605){logger[_0x31b7('0x2a')](_0x31b7('0x55'),_0x5ea605);throw _0x5ea605;});}return _0x322798;})[_0x31b7('0x27')](respondWithResult(_0x22cc77,0xc9))[_0x31b7('0x47')](handleError(_0x22cc77,null));};exports['update']=function(_0x535a3c,_0x43c1ee){if(_0x535a3c[_0x31b7('0x4e')]['id']){delete _0x535a3c[_0x31b7('0x4e')]['id'];}return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x535a3c[_0x31b7('0x49')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x43c1ee,null))[_0x31b7('0x27')](saveUpdates(_0x535a3c[_0x31b7('0x4e')],null))[_0x31b7('0x27')](respondWithResult(_0x43c1ee,null))['catch'](handleError(_0x43c1ee,null));};exports['destroy']=function(_0x4bd00d,_0x954c){return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x4bd00d['params']['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x954c,null))[_0x31b7('0x27')](removeEntity(_0x954c,null))[_0x31b7('0x47')](handleError(_0x954c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9fdab55..e72e466 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 _0x5310=['push','merge','Set','format','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','name','options','join','record','concat','internal','User','findAll','then','exports','models','define','VoiceExtension','bulkCreate','catch','destroy','length','lodash','util','./voiceChanSpy.attributes','context','from-sip','prefix','system'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x5310,0x1c0));var _0x0531=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5310[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x0531('0x0'));var util=require(_0x0531('0x1'));var BPromise=require('bluebird');var attributes=require(_0x0531('0x2'));var getUserApplications=function(_0x195f35,_0x19778f,_0x54399f){var _0x5ef0de=0x1;var _0x1de254=[];var _0x32c990={'context':_0x19778f[_0x0531('0x3')]||_0x0531('0x4'),'exten':util['format']('%s%s',_0x195f35[_0x0531('0x5')],_0x54399f),'type':_0x0531('0x6'),'isApp':![],'ChanSpyId':_0x195f35['id'],'UserId':_0x19778f['id']};_0x1de254[_0x0531('0x7')](_[_0x0531('0x8')]({'app':_0x0531('0x9'),'appdata':util[_0x0531('0xa')](_0x0531('0xb'),_0x0531('0xc')),'priority':_0x5ef0de++},_0x32c990));if(_0x195f35['record']){_0x1de254['push'](_[_0x0531('0x8')]({'app':_0x0531('0xd'),'appdata':util[_0x0531('0xa')](_0x0531('0xe'),_0x195f35[_0x0531('0xf')]),'priority':_0x5ef0de++},_0x32c990));}if(_0x195f35['auth']){_0x1de254[_0x0531('0x7')](_[_0x0531('0x8')]({'app':'Authenticate','appdata':_0x195f35[_0x0531('0x10')],'priority':_0x5ef0de++},_0x32c990));}_0x1de254['push'](_[_0x0531('0x8')]({'app':_0x0531('0x11'),'appdata':util[_0x0531('0xa')]('SIP/%s,%s',_0x19778f[_0x0531('0x12')],_0x195f35[_0x0531('0x13')]?_0x195f35['options'][_0x0531('0x14')](''):''),'priority':_0x5ef0de++},_0x32c990));if(_0x195f35[_0x0531('0x15')]){_0x1de254[_0x0531('0x7')](_[_0x0531('0x8')]({'app':'StopMixMonitor','priority':_0x5ef0de++},_0x32c990));}return _0x1de254;};var getChanSpyApplications=function(_0x59e376,_0x1234fd){var _0x52890a=[];for(var _0x3a44ec=0x0,_0x312f87=0x1;_0x3a44ec<_0x1234fd['length'];_0x3a44ec++,_0x312f87=0x1){_0x52890a=_0x52890a[_0x0531('0x16')](getUserApplications(_0x59e376,_0x1234fd[_0x3a44ec],_0x1234fd[_0x3a44ec][_0x0531('0x17')]));if(_0x1234fd[_0x3a44ec]['internal']!=_0x1234fd[_0x3a44ec][_0x0531('0x12')]){_0x52890a=_0x52890a[_0x0531('0x16')](getUserApplications(_0x59e376,_0x1234fd[_0x3a44ec],_0x1234fd[_0x3a44ec][_0x0531('0x12')]));}}return _0x52890a;};var getChanSpyPromise=function(_0x3616fd,_0x2ee81b){return new BPromise(function(_0x8db5e8,_0x19e048){return _0x3616fd[_0x0531('0x18')][_0x0531('0x19')]({'attributes':['id',_0x0531('0x12'),_0x0531('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0531('0x1a')](function(_0x5195fb){if(_0x5195fb){return _0x8db5e8(getChanSpyApplications(_0x2ee81b,_0x5195fb));}return _0x8db5e8([]);})['catch'](function(_0x11b3d6){_0x19e048(_0x11b3d6);});});};module[_0x0531('0x1b')]=function(_0x2cf6ef,_0x53132c){var _0x183d74=_0x2cf6ef[_0x0531('0x1c')];return _0x2cf6ef[_0x0531('0x1d')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x145182,_0x2ed2b1,_0x1bf99b){return getChanSpyPromise(_0x183d74,_0x145182)[_0x0531('0x1a')](function(_0x5c60a7){if(_0x5c60a7&&_0x5c60a7['length']){return _0x183d74[_0x0531('0x1e')][_0x0531('0x1f')](_0x5c60a7);}})[_0x0531('0x1a')](function(){_0x1bf99b();})[_0x0531('0x20')](function(_0x3ed634){_0x1bf99b(_0x3ed634);});},'afterUpdate':function(_0x7de0db,_0x407e8c,_0x54fa5a){return _0x183d74[_0x0531('0x1e')][_0x0531('0x21')]({'where':{'ChanSpyId':_0x7de0db['id']}})[_0x0531('0x1a')](function(){return getChanSpyPromise(_0x183d74,_0x7de0db);})['then'](function(_0x16e983){if(_0x16e983&&_0x16e983[_0x0531('0x22')]){return _0x183d74['VoiceExtension']['bulkCreate'](_0x16e983);}})['then'](function(){_0x54fa5a();})[_0x0531('0x20')](function(_0x47ebb2){_0x54fa5a(_0x47ebb2);});},'afterDestroy':function(_0x4f1d74,_0x485fbf,_0x50402){return _0x183d74[_0x0531('0x1e')]['destroy']({'where':{'ChanSpyId':_0x4f1d74['id']}})[_0x0531('0x1a')](function(){_0x50402();})[_0x0531('0x20')](function(_0x3a1a81){_0x50402(_0x3a1a81);});}}});}; \ No newline at end of file +var _0x0f4d=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','merge','Set','CDR(type)=%s','chanspy','record','push'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0f4d,0xbf));var _0xd0f4=function(_0x28ce0d,_0x30c8db){_0x28ce0d=_0x28ce0d-0x0;var _0x3740cb=_0x0f4d[_0x28ce0d];return _0x3740cb;};'use strict';var _=require(_0xd0f4('0x0'));var util=require(_0xd0f4('0x1'));var BPromise=require(_0xd0f4('0x2'));var attributes=require(_0xd0f4('0x3'));var getUserApplications=function(_0x49d468,_0x44077d,_0x3abd32){var _0x34f5b4=0x1;var _0x316af1=[];var _0x14c10e={'context':_0x44077d[_0xd0f4('0x4')]||_0xd0f4('0x5'),'exten':util[_0xd0f4('0x6')](_0xd0f4('0x7'),_0x49d468['prefix'],_0x3abd32),'type':'system','isApp':![],'ChanSpyId':_0x49d468['id'],'UserId':_0x44077d['id']};_0x316af1['push'](_[_0xd0f4('0x8')]({'app':_0xd0f4('0x9'),'appdata':util[_0xd0f4('0x6')](_0xd0f4('0xa'),_0xd0f4('0xb')),'priority':_0x34f5b4++},_0x14c10e));if(_0x49d468[_0xd0f4('0xc')]){_0x316af1[_0xd0f4('0xd')](_[_0xd0f4('0x8')]({'app':_0xd0f4('0xe'),'appdata':util[_0xd0f4('0x6')](_0xd0f4('0xf'),_0x49d468[_0xd0f4('0x10')]),'priority':_0x34f5b4++},_0x14c10e));}if(_0x49d468[_0xd0f4('0x11')]){_0x316af1['push'](_[_0xd0f4('0x8')]({'app':_0xd0f4('0x12'),'appdata':_0x49d468[_0xd0f4('0x13')],'priority':_0x34f5b4++},_0x14c10e));}_0x316af1[_0xd0f4('0xd')](_[_0xd0f4('0x8')]({'app':_0xd0f4('0x14'),'appdata':util[_0xd0f4('0x6')](_0xd0f4('0x15'),_0x44077d[_0xd0f4('0x16')],_0x49d468[_0xd0f4('0x17')]?_0x49d468[_0xd0f4('0x17')][_0xd0f4('0x18')](''):''),'priority':_0x34f5b4++},_0x14c10e));if(_0x49d468[_0xd0f4('0xc')]){_0x316af1['push'](_[_0xd0f4('0x8')]({'app':_0xd0f4('0x19'),'priority':_0x34f5b4++},_0x14c10e));}return _0x316af1;};var getChanSpyApplications=function(_0x404c74,_0x42c1d9){var _0x141a89=[];for(var _0x12e836=0x0,_0x5eb6ad=0x1;_0x12e836<_0x42c1d9['length'];_0x12e836++,_0x5eb6ad=0x1){_0x141a89=_0x141a89[_0xd0f4('0x1a')](getUserApplications(_0x404c74,_0x42c1d9[_0x12e836],_0x42c1d9[_0x12e836][_0xd0f4('0x1b')]));if(_0x42c1d9[_0x12e836][_0xd0f4('0x1b')]!=_0x42c1d9[_0x12e836][_0xd0f4('0x16')]){_0x141a89=_0x141a89['concat'](getUserApplications(_0x404c74,_0x42c1d9[_0x12e836],_0x42c1d9[_0x12e836][_0xd0f4('0x16')]));}}return _0x141a89;};var getChanSpyPromise=function(_0x278803,_0x3bbedb){return new BPromise(function(_0x46a66c,_0x3e8fa3){return _0x278803[_0xd0f4('0x1c')][_0xd0f4('0x1d')]({'attributes':['id',_0xd0f4('0x16'),_0xd0f4('0x1b')],'where':{'role':_0xd0f4('0x1e'),'chanspy':!![]},'raw':!![]})[_0xd0f4('0x1f')](function(_0x28deb3){if(_0x28deb3){return _0x46a66c(getChanSpyApplications(_0x3bbedb,_0x28deb3));}return _0x46a66c([]);})[_0xd0f4('0x20')](function(_0xb4322b){_0x3e8fa3(_0xb4322b);});});};module[_0xd0f4('0x21')]=function(_0x11214e,_0x1b5f91){var _0x2b008c=_0x11214e[_0xd0f4('0x22')];return _0x11214e[_0xd0f4('0x23')]('VoiceChanSpy',attributes,{'tableName':_0xd0f4('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b9ef3,_0x4ab549,_0x5eefca){return getChanSpyPromise(_0x2b008c,_0x5b9ef3)['then'](function(_0x45ce5c){if(_0x45ce5c&&_0x45ce5c['length']){return _0x2b008c[_0xd0f4('0x25')][_0xd0f4('0x26')](_0x45ce5c);}})[_0xd0f4('0x1f')](function(){_0x5eefca();})['catch'](function(_0x1ac988){_0x5eefca(_0x1ac988);});},'afterUpdate':function(_0x249893,_0x56ee51,_0x14fb06){return _0x2b008c['VoiceExtension'][_0xd0f4('0x27')]({'where':{'ChanSpyId':_0x249893['id']}})[_0xd0f4('0x1f')](function(){return getChanSpyPromise(_0x2b008c,_0x249893);})['then'](function(_0x32240d){if(_0x32240d&&_0x32240d[_0xd0f4('0x28')]){return _0x2b008c['VoiceExtension'][_0xd0f4('0x26')](_0x32240d);}})[_0xd0f4('0x1f')](function(){_0x14fb06();})['catch'](function(_0x5a2d66){_0x14fb06(_0x5a2d66);});},'afterDestroy':function(_0x3e30ab,_0xfbe37,_0x202009){return _0x2b008c[_0xd0f4('0x25')][_0xd0f4('0x27')]({'where':{'ChanSpyId':_0x3e30ab['id']}})[_0xd0f4('0x1f')](function(){_0x202009();})[_0xd0f4('0x20')](function(_0x4530ed){_0x202009(_0x4530ed);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 82887b3..c4725c6 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 _0x80df=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x1e3f0a,_0x55b293){var _0x50064f=function(_0x582aa2){while(--_0x582aa2){_0x1e3f0a['push'](_0x1e3f0a['shift']());}};_0x50064f(++_0x55b293);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});} \ No newline at end of file +var _0x0e9f=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x0e9f,0x116));var _0xf0e9=function(_0x5c5355,_0x2e1e40){_0x5c5355=_0x5c5355-0x0;var _0x133e79=_0x0e9f[_0x5c5355];return _0x133e79;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 284e8c5..1d1e5d4 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 _0xf6c4=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put'];(function(_0x589640,_0x536586){var _0x2bf019=function(_0x54bf75){while(--_0x54bf75){_0x589640['push'](_0x589640['shift']());}};_0x2bf019(++_0x536586);}(_0xf6c4,0x15b));var _0x4f6c=function(_0x37d69d,_0x5d3284){_0x37d69d=_0x37d69d-0x0;var _0x5d98c7=_0xf6c4[_0x37d69d];return _0x5d98c7;};'use strict';var multer=require(_0x4f6c('0x0'));var util=require(_0x4f6c('0x1'));var path=require(_0x4f6c('0x2'));var timeout=require(_0x4f6c('0x3'));var express=require(_0x4f6c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f6c('0x5'));var interaction=require(_0x4f6c('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x4f6c('0x7')]('/',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0x9')]);router[_0x4f6c('0x7')]('/:id',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xa')]);router[_0x4f6c('0xb')]('/',auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xc')]);router[_0x4f6c('0xd')](_0x4f6c('0xe'),auth[_0x4f6c('0x8')](),controller[_0x4f6c('0xf')]);router[_0x4f6c('0x10')](_0x4f6c('0xe'),auth['isAuthenticated'](),controller[_0x4f6c('0x11')]);module[_0x4f6c('0x12')]=router; \ No newline at end of file +var _0x8b88=['update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x30eab9,_0x38bf99){var _0x305c01=function(_0x4a4479){while(--_0x4a4479){_0x30eab9['push'](_0x30eab9['shift']());}};_0x305c01(++_0x38bf99);}(_0x8b88,0x64));var _0x88b8=function(_0x2c4c06,_0x2d0497){_0x2c4c06=_0x2c4c06-0x0;var _0x9410b4=_0x8b88[_0x2c4c06];return _0x9410b4;};'use strict';var multer=require('multer');var util=require(_0x88b8('0x0'));var path=require(_0x88b8('0x1'));var timeout=require(_0x88b8('0x2'));var express=require('express');var router=express[_0x88b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x88b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x88b8('0x5'));var controller=require(_0x88b8('0x6'));router[_0x88b8('0x7')]('/',auth[_0x88b8('0x8')](),controller[_0x88b8('0x9')]);router['get']('/:id',auth[_0x88b8('0x8')](),controller[_0x88b8('0xa')]);router[_0x88b8('0xb')]('/',auth[_0x88b8('0x8')](),controller[_0x88b8('0xc')]);router[_0x88b8('0xd')]('/:id',auth[_0x88b8('0x8')](),controller[_0x88b8('0xe')]);router[_0x88b8('0xf')](_0x88b8('0x10'),auth[_0x88b8('0x8')](),controller[_0x88b8('0x11')]);module[_0x88b8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 58705c2..e2c6d1c 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 _0x5aa1=['STRING','name','sequelize'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x5aa1,0x92));var _0x15aa=function(_0x7128be,_0x209fe9){_0x7128be=_0x7128be-0x0;var _0x5c001a=_0x5aa1[_0x7128be];return _0x5c001a;};'use strict';var Sequelize=require(_0x15aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x15aa('0x1')],'unique':_0x15aa('0x2')},'description':{'type':Sequelize[_0x15aa('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2815=['BOOLEAN','name'];(function(_0x10924a,_0x187ed8){var _0xa6c621=function(_0x15d8bd){while(--_0x15d8bd){_0x10924a['push'](_0x10924a['shift']());}};_0xa6c621(++_0x187ed8);}(_0x2815,0xc5));var _0x5281=function(_0x4dd199,_0x2ec032){_0x4dd199=_0x4dd199-0x0;var _0x3646b4=_0x2815[_0x4dd199];return _0x3646b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5281('0x0')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5281('0x1')],'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 0b2f9db..550f458 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 _0xbd50=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','get','Contexts','UserProfileResource','destroy','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xbd50,0x183));var _0x0bd5=function(_0x211af9,_0x216a8c){_0x211af9=_0x211af9-0x0;var _0x242e38=_0xbd50[_0x211af9];return _0x242e38;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0bd5('0x1'));var jsonpatch=require(_0x0bd5('0x2'));var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require(_0x0bd5('0x8'));var sox=require(_0x0bd5('0x9'));var csv=require(_0x0bd5('0xa'));var ejs=require(_0x0bd5('0xb'));var fs=require('fs');var fs_extra=require(_0x0bd5('0xc'));var _=require(_0x0bd5('0xd'));var squel=require(_0x0bd5('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0bd5('0xf'));var Papa=require(_0x0bd5('0x10'));var Redis=require(_0x0bd5('0x11'));var authService=require(_0x0bd5('0x12'));var qs=require(_0x0bd5('0x13'));var as=require(_0x0bd5('0x14'));var hardwareService=require(_0x0bd5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0bd5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0bd5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x18')][_0x0bd5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x768573,_0x16fc99,_0x229147,_0x4c3bbd){return new BPromise(function(_0x525b02,_0x29d3a1){var _0x221f49=_0x4c3bbd||client;return _0x221f49[_0x0bd5('0x1a')](_0x768573,_0x229147)[_0x0bd5('0x1b')](function(_0x1cb1aa){logger[_0x0bd5('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x16fc99,_0x0bd5('0x1d'));logger[_0x0bd5('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x16fc99,'request\x20sent',JSON[_0x0bd5('0x1f')](_0x1cb1aa));if(_0x1cb1aa[_0x0bd5('0x20')]){if(_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x21')]===0x1f4){logger['error'](_0x0bd5('0x22'),_0x16fc99,_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);return _0x29d3a1(_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);}logger[_0x0bd5('0x20')](_0x0bd5('0x22'),_0x16fc99,_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);return _0x525b02(_0x1cb1aa[_0x0bd5('0x20')][_0x0bd5('0x23')]);}else{logger[_0x0bd5('0x1c')](_0x0bd5('0x22'),_0x16fc99,_0x0bd5('0x1d'));_0x525b02(_0x1cb1aa[_0x0bd5('0x24')][_0x0bd5('0x23')]);}})[_0x0bd5('0x25')](function(_0x488018){logger[_0x0bd5('0x20')](_0x0bd5('0x22'),_0x16fc99,_0x488018);_0x29d3a1(_0x488018);});});}function respondWithStatusCode(_0x208256,_0x4f60ce){_0x4f60ce=_0x4f60ce||0xcc;return function(_0x151667){if(_0x151667){return _0x208256[_0x0bd5('0x26')](_0x4f60ce);}return _0x208256[_0x0bd5('0x27')](_0x4f60ce)[_0x0bd5('0x28')]();};}function respondWithResult(_0x8d79b3,_0x4f80d7){_0x4f80d7=_0x4f80d7||0xc8;return function(_0x42e47e){if(_0x42e47e){return _0x8d79b3['status'](_0x4f80d7)[_0x0bd5('0x29')](_0x42e47e);}};}function respondWithFilteredResult(_0x366042,_0x45cfe0){return function(_0x482dd8){if(_0x482dd8){var _0xfe9aab=typeof _0x45cfe0[_0x0bd5('0x2a')]===_0x0bd5('0x2b')&&typeof _0x45cfe0[_0x0bd5('0x2c')]==='undefined';var _0x1ac0f5=_0x482dd8[_0x0bd5('0x2d')];var _0x31cf40=_0xfe9aab?0x0:_0x45cfe0[_0x0bd5('0x2a')];var _0x5412f4=_0xfe9aab?_0x482dd8['count']:_0x45cfe0[_0x0bd5('0x2a')]+_0x45cfe0['limit'];var _0x447039;if(_0x5412f4>=_0x1ac0f5){_0x5412f4=_0x1ac0f5;_0x447039=0xc8;}else{_0x447039=0xce;}_0x366042['status'](_0x447039);return _0x366042[_0x0bd5('0x2e')](_0x0bd5('0x2f'),_0x31cf40+'-'+_0x5412f4+'/'+_0x1ac0f5)[_0x0bd5('0x29')](_0x482dd8);}return null;};}function patchUpdates(_0x5b160f){return function(_0x1f40d0){try{jsonpatch[_0x0bd5('0x30')](_0x1f40d0,_0x5b160f,!![]);}catch(_0x3f675b){return BPromise[_0x0bd5('0x31')](_0x3f675b);}return _0x1f40d0['save']();};}function saveUpdates(_0x18b7ff,_0x1957b7){return function(_0x49a622){if(_0x49a622){return _0x49a622['update'](_0x18b7ff)[_0x0bd5('0x1b')](function(_0x55c5cb){return _0x55c5cb;});}return null;};}function removeEntity(_0x2e96a4,_0x24d7c1){return function(_0x6f52a3){if(_0x6f52a3){return _0x6f52a3['destroy']()[_0x0bd5('0x1b')](function(){var _0x40d216=_0x6f52a3[_0x0bd5('0x32')]({'plain':!![]});var _0x3b92f3=_0x0bd5('0x33');return db[_0x0bd5('0x34')][_0x0bd5('0x35')]({'where':{'type':_0x3b92f3,'resourceId':_0x40d216['id']}})[_0x0bd5('0x1b')](function(){return _0x6f52a3;});})[_0x0bd5('0x1b')](function(){_0x2e96a4['status'](0xcc)[_0x0bd5('0x28')]();});}};}function handleEntityNotFound(_0x3a52b3,_0x95f150){return function(_0x3df67b){if(!_0x3df67b){_0x3a52b3['sendStatus'](0x194);}return _0x3df67b;};}function handleError(_0x4ae694,_0x30dafe){_0x30dafe=_0x30dafe||0x1f4;return function(_0x45409d){logger[_0x0bd5('0x20')](_0x45409d[_0x0bd5('0x36')]);if(_0x45409d[_0x0bd5('0x37')]){delete _0x45409d[_0x0bd5('0x37')];}_0x4ae694[_0x0bd5('0x27')](_0x30dafe)['send'](_0x45409d);};}exports[_0x0bd5('0x38')]=function(_0x2a0080,_0x14e24b){var _0x5025f2={},_0x123944={},_0x13d029={'count':0x0,'rows':[]};var _0xebf771=_[_0x0bd5('0x39')](db[_0x0bd5('0x3a')][_0x0bd5('0x3b')],function(_0x494c9b){return{'name':_0x494c9b[_0x0bd5('0x3c')],'type':_0x494c9b[_0x0bd5('0x3d')][_0x0bd5('0x3e')]};});_0x123944[_0x0bd5('0x3f')]=_['map'](_0xebf771,_0x0bd5('0x37'));_0x123944[_0x0bd5('0x40')]=_['keys'](_0x2a0080['query']);_0x123944[_0x0bd5('0x41')]=_['intersection'](_0x123944['model'],_0x123944[_0x0bd5('0x40')]);_0x5025f2[_0x0bd5('0x42')]=_[_0x0bd5('0x43')](_0x123944['model'],qs['fields'](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x44')]));_0x5025f2[_0x0bd5('0x42')]=_0x5025f2[_0x0bd5('0x42')][_0x0bd5('0x45')]?_0x5025f2['attributes']:_0x123944['model'];if(!_0x2a0080['query'][_0x0bd5('0x46')](_0x0bd5('0x47'))){_0x5025f2[_0x0bd5('0x2c')]=qs[_0x0bd5('0x2c')](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x2c')]);_0x5025f2[_0x0bd5('0x2a')]=qs[_0x0bd5('0x2a')](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x2a')]);}_0x5025f2['order']=qs[_0x0bd5('0x48')](_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x48')]);_0x5025f2[_0x0bd5('0x49')]=qs[_0x0bd5('0x41')](_[_0x0bd5('0x4a')](_0x2a0080[_0x0bd5('0x40')],_0x123944[_0x0bd5('0x41')]),_0xebf771);if(_0x2a0080['query'][_0x0bd5('0x4b')]){_0x5025f2[_0x0bd5('0x49')]=_[_0x0bd5('0x4c')](_0x5025f2[_0x0bd5('0x49')],{'$or':_['map'](_0xebf771,function(_0x2a5307){if(_0x2a5307[_0x0bd5('0x3d')]!==_0x0bd5('0x4d')){var _0x11549a={};_0x11549a[_0x2a5307[_0x0bd5('0x37')]]={'$like':'%'+_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x4b')]+'%'};return _0x11549a;}})});}_0x5025f2=_[_0x0bd5('0x4c')]({},_0x5025f2,_0x2a0080[_0x0bd5('0x4e')]);var _0x5702e3={'where':_0x5025f2[_0x0bd5('0x49')]};return db[_0x0bd5('0x3a')][_0x0bd5('0x2d')](_0x5702e3)[_0x0bd5('0x1b')](function(_0x50e8f0){_0x13d029[_0x0bd5('0x2d')]=_0x50e8f0;if(_0x2a0080[_0x0bd5('0x40')][_0x0bd5('0x4f')]){_0x5025f2['include']=[{'all':!![]}];}return db[_0x0bd5('0x3a')][_0x0bd5('0x50')](_0x5025f2);})[_0x0bd5('0x1b')](function(_0xfb9e96){_0x13d029[_0x0bd5('0x51')]=_0xfb9e96;return _0x13d029;})[_0x0bd5('0x1b')](respondWithFilteredResult(_0x14e24b,_0x5025f2))[_0x0bd5('0x25')](handleError(_0x14e24b,null));};exports[_0x0bd5('0x52')]=function(_0x500dc9,_0x2bc831){var _0x31b982={'raw':![],'where':{'id':_0x500dc9[_0x0bd5('0x53')]['id']}},_0x3be3c1={};_0x3be3c1[_0x0bd5('0x3f')]=_[_0x0bd5('0x54')](db['VoiceContext'][_0x0bd5('0x3b')]);_0x3be3c1['query']=_[_0x0bd5('0x54')](_0x500dc9[_0x0bd5('0x40')]);_0x3be3c1[_0x0bd5('0x41')]=_[_0x0bd5('0x43')](_0x3be3c1[_0x0bd5('0x3f')],_0x3be3c1[_0x0bd5('0x40')]);_0x31b982[_0x0bd5('0x42')]=_[_0x0bd5('0x43')](_0x3be3c1['model'],qs['fields'](_0x500dc9['query']['fields']));_0x31b982[_0x0bd5('0x42')]=_0x31b982['attributes'][_0x0bd5('0x45')]?_0x31b982['attributes']:_0x3be3c1[_0x0bd5('0x3f')];if(_0x500dc9[_0x0bd5('0x40')][_0x0bd5('0x4f')]){_0x31b982[_0x0bd5('0x55')]=[{'all':!![]}];}_0x31b982=_[_0x0bd5('0x4c')]({},_0x31b982,_0x500dc9[_0x0bd5('0x4e')]);return db[_0x0bd5('0x3a')][_0x0bd5('0x56')](_0x31b982)[_0x0bd5('0x1b')](handleEntityNotFound(_0x2bc831,null))[_0x0bd5('0x1b')](respondWithResult(_0x2bc831,null))['catch'](handleError(_0x2bc831,null));};exports[_0x0bd5('0x57')]=function(_0x2e3376,_0x242b66,_0x11d4d4){var _0x3bbd99;return db[_0x0bd5('0x3a')][_0x0bd5('0x57')](_0x2e3376[_0x0bd5('0x58')],{'raw':!![]})[_0x0bd5('0x1b')](function(_0x7626bf){_0x3bbd99=_0x7626bf;return db['VoiceContext'][_0x0bd5('0x50')]({'raw':!![]});})[_0x0bd5('0x1b')](function(_0x358db8){var _0x234dad=fs[_0x0bd5('0x59')](path[_0x0bd5('0x5a')](config['root'],_0x0bd5('0x5b')),_0x0bd5('0x5c'));var _0x2b7264=ejs[_0x0bd5('0x5d')](_0x234dad,{'contexts':_0x358db8||[]});fs[_0x0bd5('0x5e')](_0x0bd5('0x5f'),_0x2b7264);})[_0x0bd5('0x1b')](function(){return respondWithRpcPromise(_0x0bd5('0x60'),_0x0bd5('0x57'),{'module':'chan_sip.so'});})[_0x0bd5('0x1b')](function(){var _0x37a6ee=_0x2e3376[_0x0bd5('0x61')][_0x0bd5('0x32')]({'plain':!![]});if(!_0x37a6ee)throw new Error(_0x0bd5('0x62'));if(_0x37a6ee[_0x0bd5('0x63')]===_0x0bd5('0x61')){var _0x4fc9f5=_0x3bbd99[_0x0bd5('0x32')]({'plain':!![]});return db[_0x0bd5('0x64')][_0x0bd5('0x56')]({'where':{'name':_0x0bd5('0x33'),'userProfileId':_0x37a6ee[_0x0bd5('0x65')]},'raw':!![]})[_0x0bd5('0x1b')](function(_0x55f2c9){if(_0x55f2c9&&_0x55f2c9[_0x0bd5('0x66')]===0x0){return db[_0x0bd5('0x34')][_0x0bd5('0x57')]({'name':_0x4fc9f5[_0x0bd5('0x37')],'resourceId':_0x4fc9f5['id'],'type':_0x55f2c9['name'],'sectionId':_0x55f2c9['id']},{})[_0x0bd5('0x1b')](function(){return _0x3bbd99;});}else{return _0x3bbd99;}})[_0x0bd5('0x25')](function(_0x3b9999){logger[_0x0bd5('0x20')](_0x0bd5('0x67'),_0x3b9999);throw _0x3b9999;});}return _0x3bbd99;})[_0x0bd5('0x1b')](respondWithResult(_0x242b66,0xc9))[_0x0bd5('0x25')](handleError(_0x242b66,null));};exports[_0x0bd5('0x68')]=function(_0x20925d,_0x35ea3c,_0x3aac74){var _0x3d974a;return db['VoiceContext'][_0x0bd5('0x56')]({'where':{'id':_0x20925d[_0x0bd5('0x53')]['id']}})['then'](handleEntityNotFound(_0x35ea3c,null))[_0x0bd5('0x1b')](saveUpdates(_0x20925d[_0x0bd5('0x58')],null))['then'](function(_0x93f5fb){if(_0x93f5fb){_0x3d974a=_0x93f5fb;return db[_0x0bd5('0x3a')][_0x0bd5('0x50')]({'raw':!![]});}})['then'](function(_0x356865){var _0x518d1d=fs['readFileSync'](path[_0x0bd5('0x5a')](config[_0x0bd5('0x69')],_0x0bd5('0x5b')),_0x0bd5('0x5c'));var _0x641664=ejs[_0x0bd5('0x5d')](_0x518d1d,{'contexts':_0x356865||[]});fs[_0x0bd5('0x5e')](_0x0bd5('0x5f'),_0x641664);})[_0x0bd5('0x1b')](function(){return respondWithRpcPromise(_0x0bd5('0x60'),'update',{'module':_0x0bd5('0x6a')});})[_0x0bd5('0x1b')](function(){return _0x3d974a;})[_0x0bd5('0x1b')](respondWithResult(_0x35ea3c,null))['catch'](handleError(_0x35ea3c,null));};exports[_0x0bd5('0x35')]=function(_0xbb2195,_0x257bb4,_0x1b4574){var _0x497437;return db[_0x0bd5('0x3a')]['find']({'where':{'id':_0xbb2195[_0x0bd5('0x53')]['id']}})[_0x0bd5('0x1b')](handleEntityNotFound(_0x257bb4,null))[_0x0bd5('0x1b')](removeEntity(_0x257bb4,null))[_0x0bd5('0x1b')](function(){return db[_0x0bd5('0x3a')][_0x0bd5('0x50')]({'raw':!![]});})['then'](function(_0x49fb06){var _0x2bcff7=fs[_0x0bd5('0x59')](path[_0x0bd5('0x5a')](config[_0x0bd5('0x69')],_0x0bd5('0x5b')),_0x0bd5('0x5c'));var _0x5a9f05=ejs[_0x0bd5('0x5d')](_0x2bcff7,{'contexts':_0x49fb06});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x5a9f05);return respondWithRpcPromise(_0x0bd5('0x60'),_0x0bd5('0x35'),{'module':_0x0bd5('0x6a')});})['catch'](handleError(_0x257bb4,null));}; \ No newline at end of file +var _0x8a25=['zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','end','stack','name','send','index','map','VoiceContext','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','type','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','includeAll','options','create','body','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','eml-format','rimraf'];(function(_0x7c18a9,_0x535d80){var _0x1126d6=function(_0x485aa7){while(--_0x485aa7){_0x7c18a9['push'](_0x7c18a9['shift']());}};_0x1126d6(++_0x535d80);}(_0x8a25,0x1a2));var _0x58a2=function(_0x778d9d,_0x4024ef){_0x778d9d=_0x778d9d-0x0;var _0x87abf5=_0x8a25[_0x778d9d];return _0x87abf5;};'use strict';var emlformat=require(_0x58a2('0x0'));var rimraf=require(_0x58a2('0x1'));var zipdir=require(_0x58a2('0x2'));var jsonpatch=require(_0x58a2('0x3'));var rp=require(_0x58a2('0x4'));var moment=require(_0x58a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x58a2('0x6'));var path=require(_0x58a2('0x7'));var sox=require(_0x58a2('0x8'));var csv=require('to-csv');var ejs=require(_0x58a2('0x9'));var fs=require('fs');var fs_extra=require(_0x58a2('0xa'));var _=require(_0x58a2('0xb'));var squel=require(_0x58a2('0xc'));var crypto=require(_0x58a2('0xd'));var jsforce=require(_0x58a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x58a2('0xf'));var querystring=require(_0x58a2('0x10'));var Papa=require(_0x58a2('0x11'));var Redis=require(_0x58a2('0x12'));var authService=require(_0x58a2('0x13'));var qs=require(_0x58a2('0x14'));var as=require(_0x58a2('0x15'));var hardwareService=require(_0x58a2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x58a2('0x17'));var config=require(_0x58a2('0x18'));var licenseUtil=require(_0x58a2('0x19'));var db=require(_0x58a2('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x58a2('0x1b')][_0x58a2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x267e84,_0x5d3f5c,_0x6d4769,_0x54ac3b){return new BPromise(function(_0x14e953,_0x457984){var _0x513f5a=_0x54ac3b||client;return _0x513f5a[_0x58a2('0x1d')](_0x267e84,_0x6d4769)['then'](function(_0x2d9808){logger[_0x58a2('0x1e')](_0x58a2('0x1f'),_0x5d3f5c,_0x58a2('0x20'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5d3f5c,'request\x20sent',JSON[_0x58a2('0x21')](_0x2d9808));if(_0x2d9808[_0x58a2('0x22')]){if(_0x2d9808['error'][_0x58a2('0x23')]===0x1f4){logger[_0x58a2('0x22')](_0x58a2('0x1f'),_0x5d3f5c,_0x2d9808[_0x58a2('0x22')]['message']);return _0x457984(_0x2d9808['error'][_0x58a2('0x24')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x5d3f5c,_0x2d9808['error'][_0x58a2('0x24')]);return _0x14e953(_0x2d9808[_0x58a2('0x22')][_0x58a2('0x24')]);}else{logger[_0x58a2('0x1e')](_0x58a2('0x1f'),_0x5d3f5c,_0x58a2('0x20'));_0x14e953(_0x2d9808[_0x58a2('0x25')][_0x58a2('0x24')]);}})[_0x58a2('0x26')](function(_0x262949){logger[_0x58a2('0x22')](_0x58a2('0x1f'),_0x5d3f5c,_0x262949);_0x457984(_0x262949);});});}function respondWithStatusCode(_0x5a4d35,_0x38880e){_0x38880e=_0x38880e||0xcc;return function(_0x46709a){if(_0x46709a){return _0x5a4d35[_0x58a2('0x27')](_0x38880e);}return _0x5a4d35[_0x58a2('0x28')](_0x38880e)['end']();};}function respondWithResult(_0x4ef232,_0x50c115){_0x50c115=_0x50c115||0xc8;return function(_0x57ef5f){if(_0x57ef5f){return _0x4ef232[_0x58a2('0x28')](_0x50c115)[_0x58a2('0x29')](_0x57ef5f);}};}function respondWithFilteredResult(_0x1ef088,_0x26a8a3){return function(_0x3d4634){if(_0x3d4634){var _0x3e3e08=typeof _0x26a8a3[_0x58a2('0x2a')]===_0x58a2('0x2b')&&typeof _0x26a8a3[_0x58a2('0x2c')]===_0x58a2('0x2b');var _0x3c34e3=_0x3d4634['count'];var _0x152ac5=_0x3e3e08?0x0:_0x26a8a3[_0x58a2('0x2a')];var _0x466e50=_0x3e3e08?_0x3d4634['count']:_0x26a8a3[_0x58a2('0x2a')]+_0x26a8a3[_0x58a2('0x2c')];var _0xc72473;if(_0x466e50>=_0x3c34e3){_0x466e50=_0x3c34e3;_0xc72473=0xc8;}else{_0xc72473=0xce;}_0x1ef088['status'](_0xc72473);return _0x1ef088[_0x58a2('0x2d')](_0x58a2('0x2e'),_0x152ac5+'-'+_0x466e50+'/'+_0x3c34e3)[_0x58a2('0x29')](_0x3d4634);}return null;};}function patchUpdates(_0x4e35b6){return function(_0x577641){try{jsonpatch[_0x58a2('0x2f')](_0x577641,_0x4e35b6,!![]);}catch(_0x583220){return BPromise[_0x58a2('0x30')](_0x583220);}return _0x577641[_0x58a2('0x31')]();};}function saveUpdates(_0x2e15bf,_0x351da6){return function(_0x2fb83f){if(_0x2fb83f){return _0x2fb83f[_0x58a2('0x32')](_0x2e15bf)[_0x58a2('0x33')](function(_0x5d597e){return _0x5d597e;});}return null;};}function removeEntity(_0xa9ab05,_0x1e0523){return function(_0x2c2254){if(_0x2c2254){return _0x2c2254[_0x58a2('0x34')]()[_0x58a2('0x33')](function(){var _0x58b459=_0x2c2254[_0x58a2('0x35')]({'plain':!![]});var _0x36c5e4=_0x58a2('0x36');return db['UserProfileResource'][_0x58a2('0x34')]({'where':{'type':_0x36c5e4,'resourceId':_0x58b459['id']}})[_0x58a2('0x33')](function(){return _0x2c2254;});})['then'](function(){_0xa9ab05[_0x58a2('0x28')](0xcc)[_0x58a2('0x37')]();});}};}function handleEntityNotFound(_0x53dfe5,_0x160390){return function(_0x5c30b9){if(!_0x5c30b9){_0x53dfe5[_0x58a2('0x27')](0x194);}return _0x5c30b9;};}function handleError(_0x40ce8e,_0x1afccc){_0x1afccc=_0x1afccc||0x1f4;return function(_0x4c5a81){logger[_0x58a2('0x22')](_0x4c5a81[_0x58a2('0x38')]);if(_0x4c5a81[_0x58a2('0x39')]){delete _0x4c5a81[_0x58a2('0x39')];}_0x40ce8e['status'](_0x1afccc)[_0x58a2('0x3a')](_0x4c5a81);};}exports[_0x58a2('0x3b')]=function(_0x3a833e,_0x5e7630){var _0x4d8717={},_0x5399a5={},_0x1dc448={'count':0x0,'rows':[]};var _0x19c3c5=_[_0x58a2('0x3c')](db[_0x58a2('0x3d')]['rawAttributes'],function(_0x13a882){return{'name':_0x13a882[_0x58a2('0x3e')],'type':_0x13a882['type'][_0x58a2('0x3f')]};});_0x5399a5['model']=_[_0x58a2('0x3c')](_0x19c3c5,_0x58a2('0x39'));_0x5399a5[_0x58a2('0x40')]=_[_0x58a2('0x41')](_0x3a833e['query']);_0x5399a5[_0x58a2('0x42')]=_[_0x58a2('0x43')](_0x5399a5[_0x58a2('0x44')],_0x5399a5[_0x58a2('0x40')]);_0x4d8717[_0x58a2('0x45')]=_[_0x58a2('0x43')](_0x5399a5[_0x58a2('0x44')],qs[_0x58a2('0x46')](_0x3a833e['query'][_0x58a2('0x46')]));_0x4d8717[_0x58a2('0x45')]=_0x4d8717[_0x58a2('0x45')][_0x58a2('0x47')]?_0x4d8717[_0x58a2('0x45')]:_0x5399a5[_0x58a2('0x44')];if(!_0x3a833e['query']['hasOwnProperty'](_0x58a2('0x48'))){_0x4d8717[_0x58a2('0x2c')]=qs[_0x58a2('0x2c')](_0x3a833e[_0x58a2('0x40')][_0x58a2('0x2c')]);_0x4d8717['offset']=qs[_0x58a2('0x2a')](_0x3a833e[_0x58a2('0x40')]['offset']);}_0x4d8717[_0x58a2('0x49')]=qs[_0x58a2('0x4a')](_0x3a833e[_0x58a2('0x40')][_0x58a2('0x4a')]);_0x4d8717[_0x58a2('0x4b')]=qs[_0x58a2('0x42')](_['pick'](_0x3a833e[_0x58a2('0x40')],_0x5399a5[_0x58a2('0x42')]),_0x19c3c5);if(_0x3a833e[_0x58a2('0x40')]['filter']){_0x4d8717['where']=_['merge'](_0x4d8717[_0x58a2('0x4b')],{'$or':_[_0x58a2('0x3c')](_0x19c3c5,function(_0x4327fb){if(_0x4327fb[_0x58a2('0x4c')]!==_0x58a2('0x4d')){var _0x536601={};_0x536601[_0x4327fb[_0x58a2('0x39')]]={'$like':'%'+_0x3a833e[_0x58a2('0x40')]['filter']+'%'};return _0x536601;}})});}_0x4d8717=_[_0x58a2('0x4e')]({},_0x4d8717,_0x3a833e['options']);var _0x31656c={'where':_0x4d8717[_0x58a2('0x4b')]};return db[_0x58a2('0x3d')]['count'](_0x31656c)[_0x58a2('0x33')](function(_0x433d5b){_0x1dc448['count']=_0x433d5b;if(_0x3a833e[_0x58a2('0x40')]['includeAll']){_0x4d8717[_0x58a2('0x4f')]=[{'all':!![]}];}return db[_0x58a2('0x3d')][_0x58a2('0x50')](_0x4d8717);})[_0x58a2('0x33')](function(_0x3acce5){_0x1dc448[_0x58a2('0x51')]=_0x3acce5;return _0x1dc448;})['then'](respondWithFilteredResult(_0x5e7630,_0x4d8717))[_0x58a2('0x26')](handleError(_0x5e7630,null));};exports[_0x58a2('0x52')]=function(_0x1c59dc,_0x53bce7){var _0x45737a={'raw':![],'where':{'id':_0x1c59dc[_0x58a2('0x53')]['id']}},_0x2cfcf8={};_0x2cfcf8['model']=_[_0x58a2('0x41')](db[_0x58a2('0x3d')][_0x58a2('0x54')]);_0x2cfcf8[_0x58a2('0x40')]=_[_0x58a2('0x41')](_0x1c59dc[_0x58a2('0x40')]);_0x2cfcf8[_0x58a2('0x42')]=_['intersection'](_0x2cfcf8[_0x58a2('0x44')],_0x2cfcf8[_0x58a2('0x40')]);_0x45737a[_0x58a2('0x45')]=_[_0x58a2('0x43')](_0x2cfcf8[_0x58a2('0x44')],qs[_0x58a2('0x46')](_0x1c59dc[_0x58a2('0x40')][_0x58a2('0x46')]));_0x45737a[_0x58a2('0x45')]=_0x45737a[_0x58a2('0x45')][_0x58a2('0x47')]?_0x45737a[_0x58a2('0x45')]:_0x2cfcf8[_0x58a2('0x44')];if(_0x1c59dc[_0x58a2('0x40')][_0x58a2('0x55')]){_0x45737a[_0x58a2('0x4f')]=[{'all':!![]}];}_0x45737a=_[_0x58a2('0x4e')]({},_0x45737a,_0x1c59dc[_0x58a2('0x56')]);return db[_0x58a2('0x3d')]['find'](_0x45737a)[_0x58a2('0x33')](handleEntityNotFound(_0x53bce7,null))[_0x58a2('0x33')](respondWithResult(_0x53bce7,null))['catch'](handleError(_0x53bce7,null));};exports[_0x58a2('0x57')]=function(_0x2b77f5,_0x4b6313,_0x42f85e){var _0x30614b;return db['VoiceContext'][_0x58a2('0x57')](_0x2b77f5[_0x58a2('0x58')],{'raw':!![]})[_0x58a2('0x33')](function(_0x43facf){_0x30614b=_0x43facf;return db['VoiceContext'][_0x58a2('0x50')]({'raw':!![]});})[_0x58a2('0x33')](function(_0x4b49ec){var _0x1cc420=fs[_0x58a2('0x59')](path[_0x58a2('0x5a')](config[_0x58a2('0x5b')],'server/files/templates/context.ejs'),_0x58a2('0x5c'));var _0x2dee4b=ejs[_0x58a2('0x5d')](_0x1cc420,{'contexts':_0x4b49ec||[]});fs[_0x58a2('0x5e')](_0x58a2('0x5f'),_0x2dee4b);})[_0x58a2('0x33')](function(){return respondWithRpcPromise(_0x58a2('0x60'),_0x58a2('0x57'),{'module':_0x58a2('0x61')});})[_0x58a2('0x33')](function(){var _0x1ae410=_0x2b77f5[_0x58a2('0x62')][_0x58a2('0x35')]({'plain':!![]});if(!_0x1ae410)throw new Error(_0x58a2('0x63'));if(_0x1ae410[_0x58a2('0x64')]===_0x58a2('0x62')){var _0x3c4214=_0x30614b[_0x58a2('0x35')]({'plain':!![]});return db[_0x58a2('0x65')][_0x58a2('0x66')]({'where':{'name':_0x58a2('0x36'),'userProfileId':_0x1ae410['userProfileId']},'raw':!![]})['then'](function(_0x42963a){if(_0x42963a&&_0x42963a['autoAssociation']===0x0){return db['UserProfileResource'][_0x58a2('0x57')]({'name':_0x3c4214[_0x58a2('0x39')],'resourceId':_0x3c4214['id'],'type':_0x42963a[_0x58a2('0x39')],'sectionId':_0x42963a['id']},{})[_0x58a2('0x33')](function(){return _0x30614b;});}else{return _0x30614b;}})['catch'](function(_0x53e053){logger[_0x58a2('0x22')](_0x58a2('0x67'),_0x53e053);throw _0x53e053;});}return _0x30614b;})['then'](respondWithResult(_0x4b6313,0xc9))['catch'](handleError(_0x4b6313,null));};exports['update']=function(_0x20b3ac,_0x75c34f,_0x192a09){var _0x138f62;return db['VoiceContext'][_0x58a2('0x66')]({'where':{'id':_0x20b3ac['params']['id']}})[_0x58a2('0x33')](handleEntityNotFound(_0x75c34f,null))[_0x58a2('0x33')](saveUpdates(_0x20b3ac['body'],null))['then'](function(_0x59d54b){if(_0x59d54b){_0x138f62=_0x59d54b;return db[_0x58a2('0x3d')][_0x58a2('0x50')]({'raw':!![]});}})[_0x58a2('0x33')](function(_0x54dcc){var _0x4d9045=fs['readFileSync'](path[_0x58a2('0x5a')](config[_0x58a2('0x5b')],_0x58a2('0x68')),_0x58a2('0x5c'));var _0x45acc0=ejs[_0x58a2('0x5d')](_0x4d9045,{'contexts':_0x54dcc||[]});fs['writeFileSync'](_0x58a2('0x5f'),_0x45acc0);})[_0x58a2('0x33')](function(){return respondWithRpcPromise(_0x58a2('0x60'),_0x58a2('0x32'),{'module':_0x58a2('0x61')});})[_0x58a2('0x33')](function(){return _0x138f62;})[_0x58a2('0x33')](respondWithResult(_0x75c34f,null))['catch'](handleError(_0x75c34f,null));};exports['destroy']=function(_0x4734d3,_0x523fc8,_0x27ce4a){var _0x546127;return db[_0x58a2('0x3d')][_0x58a2('0x66')]({'where':{'id':_0x4734d3[_0x58a2('0x53')]['id']}})[_0x58a2('0x33')](handleEntityNotFound(_0x523fc8,null))[_0x58a2('0x33')](removeEntity(_0x523fc8,null))[_0x58a2('0x33')](function(){return db[_0x58a2('0x3d')][_0x58a2('0x50')]({'raw':!![]});})[_0x58a2('0x33')](function(_0x468582){var _0x3d5ec2=fs['readFileSync'](path[_0x58a2('0x5a')](config[_0x58a2('0x5b')],_0x58a2('0x68')),_0x58a2('0x5c'));var _0x87c8ad=ejs[_0x58a2('0x5d')](_0x3d5ec2,{'contexts':_0x468582});fs['writeFileSync'](_0x58a2('0x5f'),_0x87c8ad);return respondWithRpcPromise(_0x58a2('0x60'),'destroy',{'module':'chan_sip.so'});})[_0x58a2('0x26')](handleError(_0x523fc8,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index bce55ce..31d251d 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 _0x9bc8=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x214b49,_0x48e334){var _0x346343=function(_0x17c8fa){while(--_0x17c8fa){_0x214b49['push'](_0x214b49['shift']());}};_0x346343(++_0x48e334);}(_0x9bc8,0xa6));var _0x89bc=function(_0x3121a8,_0x193f16){_0x3121a8=_0x3121a8-0x0;var _0x207fa4=_0x9bc8[_0x3121a8];return _0x207fa4;};'use strict';var _=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var logger=require(_0x89bc('0x2'))(_0x89bc('0x3'));var moment=require(_0x89bc('0x4'));var BPromise=require(_0x89bc('0x5'));var rp=require(_0x89bc('0x6'));var fs=require('fs');var path=require(_0x89bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x89bc('0x8')]=function(_0x38047c,_0x49c366){return _0x38047c[_0x89bc('0x9')](_0x89bc('0xa'),attributes,{'tableName':_0x89bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb652=['util','api','rimraf','./voiceContext.attributes','exports','voice_contexts'];(function(_0xfe26da,_0x5ac1b7){var _0x2abe6e=function(_0x586ea1){while(--_0x586ea1){_0xfe26da['push'](_0xfe26da['shift']());}};_0x2abe6e(++_0x5ac1b7);}(_0xb652,0x1ce));var _0x2b65=function(_0x22edf7,_0x528a09){_0x22edf7=_0x22edf7-0x0;var _0x4b4829=_0xb652[_0x22edf7];return _0x4b4829;};'use strict';var _=require('lodash');var util=require(_0x2b65('0x0'));var logger=require('../../config/logger')(_0x2b65('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b65('0x2'));var config=require('../../config/environment');var attributes=require(_0x2b65('0x3'));module[_0x2b65('0x4')]=function(_0x23c03e,_0x2c20b4){return _0x23c03e['define']('VoiceContext',attributes,{'tableName':_0x2b65('0x5'),'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 2c5c76e..548c58d 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 _0xa3c3=['code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5087f3,_0x30fe8c){var _0x4b5f57=function(_0x566cde){while(--_0x566cde){_0x5087f3['push'](_0x5087f3['shift']());}};_0x4b5f57(++_0x30fe8c);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x568a54,_0x1169c3){_0x568a54=_0x568a54-0x0;var _0x278433=_0xa3c3[_0x568a54];return _0x278433;};'use strict';var _=require(_0x3a3c('0x0'));var util=require('util');var moment=require(_0x3a3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a3c('0x3'))['db'];var utils=require(_0x3a3c('0x4'));var logger=require('../../config/logger')(_0x3a3c('0x5'));var config=require(_0x3a3c('0x6'));var jayson=require(_0x3a3c('0x7'));var client=jayson[_0x3a3c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5557ec,_0x40bb5f,_0x41a760){return new BPromise(function(_0x32f0f3,_0x320953){return client[_0x3a3c('0x9')](_0x5557ec,_0x41a760)['then'](function(_0x358367){logger[_0x3a3c('0xa')](_0x3a3c('0xb'),_0x40bb5f,_0x3a3c('0xc'));logger['debug'](_0x3a3c('0xd'),_0x40bb5f,_0x3a3c('0xc'),JSON[_0x3a3c('0xe')](_0x358367));if(_0x358367[_0x3a3c('0xf')]){if(_0x358367['error'][_0x3a3c('0x10')]===0x1f4){logger[_0x3a3c('0xf')](_0x3a3c('0xb'),_0x40bb5f,_0x358367[_0x3a3c('0xf')][_0x3a3c('0x11')]);return _0x320953(_0x358367[_0x3a3c('0xf')][_0x3a3c('0x11')]);}logger[_0x3a3c('0xf')](_0x3a3c('0xb'),_0x40bb5f,_0x358367[_0x3a3c('0xf')]['message']);return _0x32f0f3(_0x358367[_0x3a3c('0xf')][_0x3a3c('0x11')]);}else{logger['info'](_0x3a3c('0xb'),_0x40bb5f,_0x3a3c('0xc'));_0x32f0f3(_0x358367[_0x3a3c('0x12')][_0x3a3c('0x11')]);}})[_0x3a3c('0x13')](function(_0x33163e){logger[_0x3a3c('0xf')](_0x3a3c('0xb'),_0x40bb5f,_0x33163e);_0x320953(_0x33163e);});});} \ No newline at end of file +var _0xeb00=['then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0xeb00,0x129));var _0x0eb0=function(_0x1c1099,_0xb3dfa4){_0x1c1099=_0x1c1099-0x0;var _0x137178=_0xeb00[_0x1c1099];return _0x137178;};'use strict';var _=require(_0x0eb0('0x0'));var util=require('util');var moment=require(_0x0eb0('0x1'));var BPromise=require(_0x0eb0('0x2'));var rs=require(_0x0eb0('0x3'));var fs=require('fs');var Redis=require(_0x0eb0('0x4'));var db=require(_0x0eb0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0eb0('0x6'));var config=require(_0x0eb0('0x7'));var jayson=require(_0x0eb0('0x8'));var client=jayson[_0x0eb0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440e92,_0x44d592,_0x247477){return new BPromise(function(_0x25ad9e,_0x77c7a6){return client[_0x0eb0('0xa')](_0x440e92,_0x247477)[_0x0eb0('0xb')](function(_0x409f32){logger[_0x0eb0('0xc')](_0x0eb0('0xd'),_0x44d592,'request\x20sent');logger[_0x0eb0('0xe')](_0x0eb0('0xf'),_0x44d592,_0x0eb0('0x10'),JSON[_0x0eb0('0x11')](_0x409f32));if(_0x409f32['error']){if(_0x409f32[_0x0eb0('0x12')][_0x0eb0('0x13')]===0x1f4){logger[_0x0eb0('0x12')]('VoiceContext,\x20%s,\x20%s',_0x44d592,_0x409f32['error']['message']);return _0x77c7a6(_0x409f32[_0x0eb0('0x12')]['message']);}logger['error'](_0x0eb0('0xd'),_0x44d592,_0x409f32[_0x0eb0('0x12')]['message']);return _0x25ad9e(_0x409f32[_0x0eb0('0x12')][_0x0eb0('0x14')]);}else{logger[_0x0eb0('0xc')]('VoiceContext,\x20%s,\x20%s',_0x44d592,'request\x20sent');_0x25ad9e(_0x409f32[_0x0eb0('0x15')][_0x0eb0('0x14')]);}})['catch'](function(_0x28c3f1){logger[_0x0eb0('0x12')](_0x0eb0('0xd'),_0x44d592,_0x28c3f1);_0x77c7a6(_0x28c3f1);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index eaab3b9..50ffc07 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 _0x4754=['create','update','delete','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4abb3c,_0x2a335b){var _0x5cd7e7=function(_0x14fcc7){while(--_0x14fcc7){_0x4abb3c['push'](_0x4abb3c['shift']());}};_0x5cd7e7(++_0x2a335b);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4475('0x0'));var timeout=require('connect-timeout');var express=require(_0x4475('0x1'));var router=express['Router']();var fs_extra=require(_0x4475('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4475('0x3'));var config=require(_0x4475('0x4'));var controller=require(_0x4475('0x5'));router[_0x4475('0x6')]('/',auth[_0x4475('0x7')](),controller[_0x4475('0x8')]);router['get'](_0x4475('0x9'),auth[_0x4475('0x7')](),controller['describe']);router[_0x4475('0x6')](_0x4475('0xa'),auth[_0x4475('0x7')](),controller[_0x4475('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4475('0xc')]);router['put'](_0x4475('0xa'),auth['isAuthenticated'](),controller[_0x4475('0xd')]);router[_0x4475('0xe')](_0x4475('0xa'),auth[_0x4475('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x53d0=['isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','describe','show','post'];(function(_0x52ec13,_0xb520ab){var _0x4bf818=function(_0x31a40a){while(--_0x31a40a){_0x52ec13['push'](_0x52ec13['shift']());}};_0x4bf818(++_0xb520ab);}(_0x53d0,0x6c));var _0x053d=function(_0x3e9d20,_0x16afdd){_0x3e9d20=_0x3e9d20-0x0;var _0x1e21a2=_0x53d0[_0x3e9d20];return _0x1e21a2;};'use strict';var multer=require('multer');var util=require(_0x053d('0x0'));var path=require(_0x053d('0x1'));var timeout=require('connect-timeout');var express=require(_0x053d('0x2'));var router=express['Router']();var fs_extra=require(_0x053d('0x3'));var auth=require(_0x053d('0x4'));var interaction=require(_0x053d('0x5'));var config=require(_0x053d('0x6'));var controller=require(_0x053d('0x7'));router[_0x053d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x053d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x053d('0x9')]);router[_0x053d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x053d('0xa')]);router[_0x053d('0xb')]('/',auth[_0x053d('0xc')](),controller[_0x053d('0xd')]);router[_0x053d('0xe')](_0x053d('0xf'),auth[_0x053d('0xc')](),controller[_0x053d('0x10')]);router[_0x053d('0x11')](_0x053d('0xf'),auth[_0x053d('0xc')](),controller[_0x053d('0x12')]);module[_0x053d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 49f4c1e..58ebf99 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 _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x54ef,0x112));var _0xf54e=function(_0x34d488,_0x53ed9c){_0x34d488=_0x34d488-0x0;var _0x2785dc=_0x54ef[_0x34d488];return _0x2785dc;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x4bb265,_0x5a3252){var _0x33430a=function(_0x16c049){while(--_0x16c049){_0x4bb265['push'](_0x4bb265['shift']());}};_0x33430a(++_0x5a3252);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x84ab[_0x2a55f8];return _0x245efd;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 62c3dd2..e4cadbe 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 _0x5c0d=['attributes','fields','length','hasOwnProperty','nolimit','limit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../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','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5c0d,0x1d0));var _0xd5c0=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x5c0d[_0x13ce0c];return _0x4388fb;};'use strict';var emlformat=require(_0xd5c0('0x0'));var rimraf=require(_0xd5c0('0x1'));var zipdir=require(_0xd5c0('0x2'));var jsonpatch=require(_0xd5c0('0x3'));var rp=require(_0xd5c0('0x4'));var moment=require('moment');var BPromise=require(_0xd5c0('0x5'));var Mustache=require(_0xd5c0('0x6'));var util=require('util');var path=require(_0xd5c0('0x7'));var sox=require(_0xd5c0('0x8'));var csv=require(_0xd5c0('0x9'));var ejs=require(_0xd5c0('0xa'));var fs=require('fs');var fs_extra=require(_0xd5c0('0xb'));var _=require('lodash');var squel=require(_0xd5c0('0xc'));var crypto=require(_0xd5c0('0xd'));var jsforce=require(_0xd5c0('0xe'));var deskjs=require(_0xd5c0('0xf'));var toCsv=require(_0xd5c0('0x9'));var querystring=require(_0xd5c0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd5c0('0x11'));var qs=require(_0xd5c0('0x12'));var as=require(_0xd5c0('0x13'));var hardwareService=require(_0xd5c0('0x14'));var logger=require('../../config/logger')(_0xd5c0('0x15'));var utils=require(_0xd5c0('0x16'));var config=require(_0xd5c0('0x17'));var licenseUtil=require(_0xd5c0('0x18'));var db=require(_0xd5c0('0x19'))['db'];function respondWithStatusCode(_0x4d319d,_0x5be4e6){_0x5be4e6=_0x5be4e6||0xcc;return function(_0x3a20fc){if(_0x3a20fc){return _0x4d319d[_0xd5c0('0x1a')](_0x5be4e6);}return _0x4d319d[_0xd5c0('0x1b')](_0x5be4e6)[_0xd5c0('0x1c')]();};}function respondWithResult(_0xe19406,_0x4e3e71){_0x4e3e71=_0x4e3e71||0xc8;return function(_0x1d9324){if(_0x1d9324){return _0xe19406[_0xd5c0('0x1b')](_0x4e3e71)[_0xd5c0('0x1d')](_0x1d9324);}};}function respondWithFilteredResult(_0x4d5e66,_0x15cfbb){return function(_0x95da68){if(_0x95da68){var _0x586b79=typeof _0x15cfbb[_0xd5c0('0x1e')]===_0xd5c0('0x1f')&&typeof _0x15cfbb['limit']===_0xd5c0('0x1f');var _0x122c40=_0x95da68[_0xd5c0('0x20')];var _0x2be006=_0x586b79?0x0:_0x15cfbb[_0xd5c0('0x1e')];var _0x5209cc=_0x586b79?_0x95da68[_0xd5c0('0x20')]:_0x15cfbb[_0xd5c0('0x1e')]+_0x15cfbb['limit'];var _0xe3eecf;if(_0x5209cc>=_0x122c40){_0x5209cc=_0x122c40;_0xe3eecf=0xc8;}else{_0xe3eecf=0xce;}_0x4d5e66[_0xd5c0('0x1b')](_0xe3eecf);return _0x4d5e66[_0xd5c0('0x21')](_0xd5c0('0x22'),_0x2be006+'-'+_0x5209cc+'/'+_0x122c40)['json'](_0x95da68);}return null;};}function patchUpdates(_0x53c2de){return function(_0x3c7edd){try{jsonpatch[_0xd5c0('0x23')](_0x3c7edd,_0x53c2de,!![]);}catch(_0x1f6aef){return BPromise[_0xd5c0('0x24')](_0x1f6aef);}return _0x3c7edd['save']();};}function saveUpdates(_0x5b597d,_0x3ca96e){return function(_0x2d9755){if(_0x2d9755){return _0x2d9755['update'](_0x5b597d)[_0xd5c0('0x25')](function(_0x3cd7a4){return _0x3cd7a4;});}return null;};}function removeEntity(_0x486f33,_0x146e6d){return function(_0xa0c7d1){if(_0xa0c7d1){return _0xa0c7d1[_0xd5c0('0x26')]()['then'](function(){_0x486f33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2035e5,_0x52992b){return function(_0x3535b7){if(!_0x3535b7){_0x2035e5[_0xd5c0('0x1a')](0x194);}return _0x3535b7;};}function handleError(_0x455f29,_0x375e38){_0x375e38=_0x375e38||0x1f4;return function(_0xe601cb){logger[_0xd5c0('0x27')](_0xe601cb['stack']);if(_0xe601cb[_0xd5c0('0x28')]){delete _0xe601cb[_0xd5c0('0x28')];}_0x455f29[_0xd5c0('0x1b')](_0x375e38)[_0xd5c0('0x29')](_0xe601cb);};}exports[_0xd5c0('0x2a')]=function(_0x5956ae,_0x2b9b96){var _0x4927a8={},_0x4eeec3={},_0xb9c427={'count':0x0,'rows':[]};var _0x470f01=_[_0xd5c0('0x2b')](db[_0xd5c0('0x2c')][_0xd5c0('0x2d')],function(_0x8458a9){return{'name':_0x8458a9[_0xd5c0('0x2e')],'type':_0x8458a9[_0xd5c0('0x2f')][_0xd5c0('0x30')]};});_0x4eeec3[_0xd5c0('0x31')]=_['map'](_0x470f01,_0xd5c0('0x28'));_0x4eeec3[_0xd5c0('0x32')]=_[_0xd5c0('0x33')](_0x5956ae[_0xd5c0('0x32')]);_0x4eeec3[_0xd5c0('0x34')]=_[_0xd5c0('0x35')](_0x4eeec3[_0xd5c0('0x31')],_0x4eeec3['query']);_0x4927a8[_0xd5c0('0x36')]=_[_0xd5c0('0x35')](_0x4eeec3[_0xd5c0('0x31')],qs['fields'](_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x37')]));_0x4927a8[_0xd5c0('0x36')]=_0x4927a8[_0xd5c0('0x36')][_0xd5c0('0x38')]?_0x4927a8[_0xd5c0('0x36')]:_0x4eeec3[_0xd5c0('0x31')];if(!_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x39')](_0xd5c0('0x3a'))){_0x4927a8[_0xd5c0('0x3b')]=qs[_0xd5c0('0x3b')](_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x3b')]);_0x4927a8[_0xd5c0('0x1e')]=qs[_0xd5c0('0x1e')](_0x5956ae[_0xd5c0('0x32')]['offset']);}_0x4927a8['order']=qs['sort'](_0x5956ae[_0xd5c0('0x32')]['sort']);_0x4927a8[_0xd5c0('0x3c')]=qs[_0xd5c0('0x34')](_['pick'](_0x5956ae[_0xd5c0('0x32')],_0x4eeec3[_0xd5c0('0x34')]),_0x470f01);if(_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x3d')]){_0x4927a8[_0xd5c0('0x3c')]=_['merge'](_0x4927a8[_0xd5c0('0x3c')],{'$or':_['map'](_0x470f01,function(_0x31896d){if(_0x31896d[_0xd5c0('0x2f')]!==_0xd5c0('0x3e')){var _0x4afd56={};_0x4afd56[_0x31896d[_0xd5c0('0x28')]]={'$like':'%'+_0x5956ae[_0xd5c0('0x32')]['filter']+'%'};return _0x4afd56;}})});}_0x4927a8=_[_0xd5c0('0x3f')]({},_0x4927a8,_0x5956ae[_0xd5c0('0x40')]);var _0x1d5234={'where':_0x4927a8['where']};return db[_0xd5c0('0x2c')][_0xd5c0('0x20')](_0x1d5234)[_0xd5c0('0x25')](function(_0x13ac09){_0xb9c427['count']=_0x13ac09;if(_0x5956ae[_0xd5c0('0x32')][_0xd5c0('0x41')]){_0x4927a8[_0xd5c0('0x42')]=[{'all':!![]}];}return db[_0xd5c0('0x2c')][_0xd5c0('0x43')](_0x4927a8);})[_0xd5c0('0x25')](function(_0x2a5fc9){_0xb9c427['rows']=_0x2a5fc9;return _0xb9c427;})[_0xd5c0('0x25')](respondWithFilteredResult(_0x2b9b96,_0x4927a8))[_0xd5c0('0x44')](handleError(_0x2b9b96,null));};exports[_0xd5c0('0x45')]=function(_0x271dea,_0xbee5e){var _0x234d1b={'raw':!![],'where':{'id':_0x271dea[_0xd5c0('0x46')]['id']}},_0x2d4fe6={};_0x2d4fe6['model']=_[_0xd5c0('0x33')](db[_0xd5c0('0x2c')][_0xd5c0('0x2d')]);_0x2d4fe6[_0xd5c0('0x32')]=_[_0xd5c0('0x33')](_0x271dea[_0xd5c0('0x32')]);_0x2d4fe6['filters']=_[_0xd5c0('0x35')](_0x2d4fe6['model'],_0x2d4fe6[_0xd5c0('0x32')]);_0x234d1b[_0xd5c0('0x36')]=_[_0xd5c0('0x35')](_0x2d4fe6[_0xd5c0('0x31')],qs[_0xd5c0('0x37')](_0x271dea[_0xd5c0('0x32')][_0xd5c0('0x37')]));_0x234d1b[_0xd5c0('0x36')]=_0x234d1b[_0xd5c0('0x36')]['length']?_0x234d1b[_0xd5c0('0x36')]:_0x2d4fe6[_0xd5c0('0x31')];if(_0x271dea['query']['includeAll']){_0x234d1b[_0xd5c0('0x42')]=[{'all':!![]}];}_0x234d1b=_[_0xd5c0('0x3f')]({},_0x234d1b,_0x271dea[_0xd5c0('0x40')]);return db[_0xd5c0('0x2c')][_0xd5c0('0x47')](_0x234d1b)[_0xd5c0('0x25')](handleEntityNotFound(_0xbee5e,null))[_0xd5c0('0x25')](respondWithResult(_0xbee5e,null))['catch'](handleError(_0xbee5e,null));};exports['create']=function(_0x5b5bd2,_0x4c5fb5){return db['VoiceDialReport']['create'](_0x5b5bd2[_0xd5c0('0x48')],{})['then'](respondWithResult(_0x4c5fb5,0xc9))[_0xd5c0('0x44')](handleError(_0x4c5fb5,null));};exports['update']=function(_0x19a72f,_0x366726){if(_0x19a72f['body']['id']){delete _0x19a72f[_0xd5c0('0x48')]['id'];}return db[_0xd5c0('0x2c')][_0xd5c0('0x47')]({'where':{'id':_0x19a72f[_0xd5c0('0x46')]['id']}})[_0xd5c0('0x25')](handleEntityNotFound(_0x366726,null))[_0xd5c0('0x25')](saveUpdates(_0x19a72f[_0xd5c0('0x48')],null))[_0xd5c0('0x25')](respondWithResult(_0x366726,null))[_0xd5c0('0x44')](handleError(_0x366726,null));};exports[_0xd5c0('0x26')]=function(_0x603e4,_0x4ca6cc){return db[_0xd5c0('0x2c')][_0xd5c0('0x47')]({'where':{'id':_0x603e4['params']['id']}})[_0xd5c0('0x25')](handleEntityNotFound(_0x4ca6cc,null))[_0xd5c0('0x25')](removeEntity(_0x4ca6cc,null))['catch'](handleError(_0x4ca6cc,null));};exports[_0xd5c0('0x49')]=function(_0x5d15f4,_0x1e2e6f){return db[_0xd5c0('0x2c')][_0xd5c0('0x49')]()[_0xd5c0('0x25')](respondWithResult(_0x1e2e6f,null))['catch'](handleError(_0x1e2e6f,null));}; \ No newline at end of file +var _0x803e=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x256341,_0x2169e8){var _0x377b74=function(_0x135e70){while(--_0x135e70){_0x256341['push'](_0x256341['shift']());}};_0x377b74(++_0x2169e8);}(_0x803e,0x83));var _0xe803=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x803e[_0x1b3a5c];return _0x2ae8cb;};'use strict';var emlformat=require(_0xe803('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe803('0x1'));var jsonpatch=require(_0xe803('0x2'));var rp=require('request-promise');var moment=require(_0xe803('0x3'));var BPromise=require(_0xe803('0x4'));var Mustache=require('mustache');var util=require(_0xe803('0x5'));var path=require('path');var sox=require(_0xe803('0x6'));var csv=require(_0xe803('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe803('0x8'));var _=require(_0xe803('0x9'));var squel=require(_0xe803('0xa'));var crypto=require('crypto');var jsforce=require(_0xe803('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe803('0x7'));var querystring=require(_0xe803('0xc'));var Papa=require(_0xe803('0xd'));var Redis=require('ioredis');var authService=require(_0xe803('0xe'));var qs=require(_0xe803('0xf'));var as=require(_0xe803('0x10'));var hardwareService=require(_0xe803('0x11'));var logger=require(_0xe803('0x12'))('api');var utils=require(_0xe803('0x13'));var config=require(_0xe803('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe803('0x15'))['db'];function respondWithStatusCode(_0x588e12,_0x59eac5){_0x59eac5=_0x59eac5||0xcc;return function(_0x3e5b8f){if(_0x3e5b8f){return _0x588e12['sendStatus'](_0x59eac5);}return _0x588e12[_0xe803('0x16')](_0x59eac5)['end']();};}function respondWithResult(_0xd6e5f3,_0x4f9673){_0x4f9673=_0x4f9673||0xc8;return function(_0x3fc264){if(_0x3fc264){return _0xd6e5f3[_0xe803('0x16')](_0x4f9673)[_0xe803('0x17')](_0x3fc264);}};}function respondWithFilteredResult(_0x5e37ef,_0x13619f){return function(_0x2f9f6c){if(_0x2f9f6c){var _0x57b449=typeof _0x13619f['offset']===_0xe803('0x18')&&typeof _0x13619f['limit']===_0xe803('0x18');var _0x2b1584=_0x2f9f6c[_0xe803('0x19')];var _0x1dc14f=_0x57b449?0x0:_0x13619f['offset'];var _0x398df8=_0x57b449?_0x2f9f6c[_0xe803('0x19')]:_0x13619f['offset']+_0x13619f[_0xe803('0x1a')];var _0x44a0bd;if(_0x398df8>=_0x2b1584){_0x398df8=_0x2b1584;_0x44a0bd=0xc8;}else{_0x44a0bd=0xce;}_0x5e37ef[_0xe803('0x16')](_0x44a0bd);return _0x5e37ef[_0xe803('0x1b')](_0xe803('0x1c'),_0x1dc14f+'-'+_0x398df8+'/'+_0x2b1584)[_0xe803('0x17')](_0x2f9f6c);}return null;};}function patchUpdates(_0x75887a){return function(_0x92c154){try{jsonpatch[_0xe803('0x1d')](_0x92c154,_0x75887a,!![]);}catch(_0x5b2a88){return BPromise[_0xe803('0x1e')](_0x5b2a88);}return _0x92c154[_0xe803('0x1f')]();};}function saveUpdates(_0xbb21c0,_0x2748fb){return function(_0x11c94e){if(_0x11c94e){return _0x11c94e[_0xe803('0x20')](_0xbb21c0)['then'](function(_0x1edffa){return _0x1edffa;});}return null;};}function removeEntity(_0x48dadc,_0x1904d6){return function(_0x5253f9){if(_0x5253f9){return _0x5253f9[_0xe803('0x21')]()[_0xe803('0x22')](function(){_0x48dadc['status'](0xcc)[_0xe803('0x23')]();});}};}function handleEntityNotFound(_0x4c10a6,_0x433568){return function(_0x2508d8){if(!_0x2508d8){_0x4c10a6[_0xe803('0x24')](0x194);}return _0x2508d8;};}function handleError(_0x1aacf8,_0x4d92fd){_0x4d92fd=_0x4d92fd||0x1f4;return function(_0xc43e76){logger[_0xe803('0x25')](_0xc43e76[_0xe803('0x26')]);if(_0xc43e76['name']){delete _0xc43e76['name'];}_0x1aacf8[_0xe803('0x16')](_0x4d92fd)['send'](_0xc43e76);};}exports[_0xe803('0x27')]=function(_0xf7464c,_0x302f4a){var _0x463957={},_0x42c596={},_0x45f9e4={'count':0x0,'rows':[]};var _0x426014=_[_0xe803('0x28')](db[_0xe803('0x29')][_0xe803('0x2a')],function(_0x513929){return{'name':_0x513929[_0xe803('0x2b')],'type':_0x513929[_0xe803('0x2c')][_0xe803('0x2d')]};});_0x42c596['model']=_[_0xe803('0x28')](_0x426014,_0xe803('0x2e'));_0x42c596[_0xe803('0x2f')]=_[_0xe803('0x30')](_0xf7464c[_0xe803('0x2f')]);_0x42c596[_0xe803('0x31')]=_[_0xe803('0x32')](_0x42c596[_0xe803('0x33')],_0x42c596['query']);_0x463957[_0xe803('0x34')]=_['intersection'](_0x42c596['model'],qs['fields'](_0xf7464c[_0xe803('0x2f')][_0xe803('0x35')]));_0x463957['attributes']=_0x463957[_0xe803('0x34')][_0xe803('0x36')]?_0x463957[_0xe803('0x34')]:_0x42c596[_0xe803('0x33')];if(!_0xf7464c[_0xe803('0x2f')][_0xe803('0x37')]('nolimit')){_0x463957['limit']=qs['limit'](_0xf7464c['query']['limit']);_0x463957['offset']=qs[_0xe803('0x38')](_0xf7464c[_0xe803('0x2f')][_0xe803('0x38')]);}_0x463957['order']=qs[_0xe803('0x39')](_0xf7464c[_0xe803('0x2f')]['sort']);_0x463957['where']=qs[_0xe803('0x31')](_[_0xe803('0x3a')](_0xf7464c[_0xe803('0x2f')],_0x42c596[_0xe803('0x31')]),_0x426014);if(_0xf7464c['query']['filter']){_0x463957[_0xe803('0x3b')]=_[_0xe803('0x3c')](_0x463957['where'],{'$or':_[_0xe803('0x28')](_0x426014,function(_0x3b4f9a){if(_0x3b4f9a[_0xe803('0x2c')]!==_0xe803('0x3d')){var _0x4be0bc={};_0x4be0bc[_0x3b4f9a[_0xe803('0x2e')]]={'$like':'%'+_0xf7464c['query'][_0xe803('0x3e')]+'%'};return _0x4be0bc;}})});}_0x463957=_[_0xe803('0x3c')]({},_0x463957,_0xf7464c['options']);var _0x31b533={'where':_0x463957[_0xe803('0x3b')]};return db[_0xe803('0x29')]['count'](_0x31b533)[_0xe803('0x22')](function(_0x405b88){_0x45f9e4[_0xe803('0x19')]=_0x405b88;if(_0xf7464c[_0xe803('0x2f')][_0xe803('0x3f')]){_0x463957[_0xe803('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xe803('0x41')](_0x463957);})[_0xe803('0x22')](function(_0x36477b){_0x45f9e4[_0xe803('0x42')]=_0x36477b;return _0x45f9e4;})[_0xe803('0x22')](respondWithFilteredResult(_0x302f4a,_0x463957))[_0xe803('0x43')](handleError(_0x302f4a,null));};exports[_0xe803('0x44')]=function(_0x4b75ee,_0x21ea3a){var _0x5f806c={'raw':!![],'where':{'id':_0x4b75ee[_0xe803('0x45')]['id']}},_0x874795={};_0x874795[_0xe803('0x33')]=_[_0xe803('0x30')](db[_0xe803('0x29')][_0xe803('0x2a')]);_0x874795[_0xe803('0x2f')]=_[_0xe803('0x30')](_0x4b75ee['query']);_0x874795[_0xe803('0x31')]=_[_0xe803('0x32')](_0x874795['model'],_0x874795[_0xe803('0x2f')]);_0x5f806c[_0xe803('0x34')]=_[_0xe803('0x32')](_0x874795[_0xe803('0x33')],qs['fields'](_0x4b75ee[_0xe803('0x2f')][_0xe803('0x35')]));_0x5f806c[_0xe803('0x34')]=_0x5f806c[_0xe803('0x34')][_0xe803('0x36')]?_0x5f806c[_0xe803('0x34')]:_0x874795[_0xe803('0x33')];if(_0x4b75ee['query'][_0xe803('0x3f')]){_0x5f806c['include']=[{'all':!![]}];}_0x5f806c=_[_0xe803('0x3c')]({},_0x5f806c,_0x4b75ee['options']);return db['VoiceDialReport'][_0xe803('0x46')](_0x5f806c)[_0xe803('0x22')](handleEntityNotFound(_0x21ea3a,null))[_0xe803('0x22')](respondWithResult(_0x21ea3a,null))[_0xe803('0x43')](handleError(_0x21ea3a,null));};exports[_0xe803('0x47')]=function(_0x52470d,_0x352205){return db[_0xe803('0x29')][_0xe803('0x47')](_0x52470d['body'],{})[_0xe803('0x22')](respondWithResult(_0x352205,0xc9))[_0xe803('0x43')](handleError(_0x352205,null));};exports[_0xe803('0x20')]=function(_0x45306f,_0x12f518){if(_0x45306f[_0xe803('0x48')]['id']){delete _0x45306f['body']['id'];}return db[_0xe803('0x29')][_0xe803('0x46')]({'where':{'id':_0x45306f['params']['id']}})['then'](handleEntityNotFound(_0x12f518,null))['then'](saveUpdates(_0x45306f['body'],null))[_0xe803('0x22')](respondWithResult(_0x12f518,null))[_0xe803('0x43')](handleError(_0x12f518,null));};exports[_0xe803('0x21')]=function(_0x260b06,_0x5c28a6){return db['VoiceDialReport'][_0xe803('0x46')]({'where':{'id':_0x260b06[_0xe803('0x45')]['id']}})[_0xe803('0x22')](handleEntityNotFound(_0x5c28a6,null))[_0xe803('0x22')](removeEntity(_0x5c28a6,null))[_0xe803('0x43')](handleError(_0x5c28a6,null));};exports[_0xe803('0x49')]=function(_0x19a93b,_0x32bc6a){return db[_0xe803('0x29')]['describe']()[_0xe803('0x22')](respondWithResult(_0x32bc6a,null))[_0xe803('0x43')](handleError(_0x32bc6a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a85e285..74f2d56 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 _0x9a95=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial'];(function(_0x592fde,_0x2157a6){var _0x9cfdff=function(_0x4495c0){while(--_0x4495c0){_0x592fde['push'](_0x592fde['shift']());}};_0x9cfdff(++_0x2157a6);}(_0x9a95,0xb5));var _0x59a9=function(_0x505a02,_0x25a534){_0x505a02=_0x505a02-0x0;var _0x5d4323=_0x9a95[_0x505a02];return _0x5d4323;};'use strict';var _=require(_0x59a9('0x0'));var util=require(_0x59a9('0x1'));var logger=require(_0x59a9('0x2'))(_0x59a9('0x3'));var moment=require(_0x59a9('0x4'));var BPromise=require(_0x59a9('0x5'));var rp=require(_0x59a9('0x6'));var fs=require('fs');var path=require(_0x59a9('0x7'));var rimraf=require(_0x59a9('0x8'));var config=require(_0x59a9('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x59a9('0xa')]=function(_0x37bb4d,_0x50daf2){return _0x37bb4d[_0x59a9('0xb')](_0x59a9('0xc'),attributes,{'tableName':_0x59a9('0xd'),'paranoid':![],'indexes':[{'fields':[_0x59a9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a96=['bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','lodash','util','api','moment'];(function(_0x572342,_0x26552c){var _0x2b4d3=function(_0x4811f1){while(--_0x4811f1){_0x572342['push'](_0x572342['shift']());}};_0x2b4d3(++_0x26552c);}(_0x5a96,0xbc));var _0x65a9=function(_0x4df7a7,_0x357bb5){_0x4df7a7=_0x4df7a7-0x0;var _0x17528d=_0x5a96[_0x4df7a7];return _0x17528d;};'use strict';var _=require(_0x65a9('0x0'));var util=require(_0x65a9('0x1'));var logger=require('../../config/logger')(_0x65a9('0x2'));var moment=require(_0x65a9('0x3'));var BPromise=require(_0x65a9('0x4'));var rp=require(_0x65a9('0x5'));var fs=require('fs');var path=require(_0x65a9('0x6'));var rimraf=require(_0x65a9('0x7'));var config=require('../../config/environment');var attributes=require(_0x65a9('0x8'));module['exports']=function(_0x512646,_0x4b8b3e){return _0x512646[_0x65a9('0x9')](_0x65a9('0xa'),attributes,{'tableName':_0x65a9('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 96dc97c..9580724 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 _0xcedd=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','bluebird','ioredis'];(function(_0x1ee239,_0x339077){var _0x390b48=function(_0x40e6ff){while(--_0x40e6ff){_0x1ee239['push'](_0x1ee239['shift']());}};_0x390b48(++_0x339077);}(_0xcedd,0x14f));var _0xdced=function(_0x18d9c9,_0x54e207){_0x18d9c9=_0x18d9c9-0x0;var _0x4eff47=_0xcedd[_0x18d9c9];return _0x4eff47;};'use strict';var _=require(_0xdced('0x0'));var util=require(_0xdced('0x1'));var moment=require(_0xdced('0x2'));var BPromise=require(_0xdced('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdced('0x4'));var db=require(_0xdced('0x5'))['db'];var utils=require(_0xdced('0x6'));var logger=require('../../config/logger')(_0xdced('0x7'));var config=require('../../config/environment');var jayson=require(_0xdced('0x8'));var client=jayson[_0xdced('0x9')][_0xdced('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4520f2,_0x291ccf,_0x2d0b6e){return new BPromise(function(_0x2122d0,_0x30a456){return client[_0xdced('0xb')](_0x4520f2,_0x2d0b6e)[_0xdced('0xc')](function(_0x489e3c){logger[_0xdced('0xd')](_0xdced('0xe'),_0x291ccf,'request\x20sent');logger[_0xdced('0xf')](_0xdced('0x10'),_0x291ccf,_0xdced('0x11'),JSON[_0xdced('0x12')](_0x489e3c));if(_0x489e3c[_0xdced('0x13')]){if(_0x489e3c[_0xdced('0x13')][_0xdced('0x14')]===0x1f4){logger[_0xdced('0x13')](_0xdced('0xe'),_0x291ccf,_0x489e3c[_0xdced('0x13')]['message']);return _0x30a456(_0x489e3c[_0xdced('0x13')][_0xdced('0x15')]);}logger['error'](_0xdced('0xe'),_0x291ccf,_0x489e3c[_0xdced('0x13')][_0xdced('0x15')]);return _0x2122d0(_0x489e3c['error'][_0xdced('0x15')]);}else{logger['info'](_0xdced('0xe'),_0x291ccf,_0xdced('0x11'));_0x2122d0(_0x489e3c[_0xdced('0x16')]['message']);}})[_0xdced('0x17')](function(_0x22b7a7){logger['error'](_0xdced('0xe'),_0x291ccf,_0x22b7a7);_0x30a456(_0x22b7a7);});});}exports['CreateVoiceDialReport']=function(_0x218fa2){var _0x49ce07=this;return new Promise(function(_0x2e26f2,_0x3ca9a6){return db[_0xdced('0x18')][_0xdced('0x19')](_0x218fa2[_0xdced('0x1a')],{'raw':_0x218fa2[_0xdced('0x1b')]?_0x218fa2[_0xdced('0x1b')][_0xdced('0x1c')]===undefined?!![]:![]:!![]})[_0xdced('0xc')](function(_0x274168){logger[_0xdced('0xd')](_0xdced('0x1d'),_0x218fa2);logger['debug'](_0xdced('0x1d'),_0x218fa2,JSON['stringify'](_0x274168));_0x2e26f2(_0x274168);})[_0xdced('0x17')](function(_0x3e6e30){logger[_0xdced('0x13')]('CreateVoiceDialReport',_0x3e6e30[_0xdced('0x15')],_0x218fa2);_0x3ca9a6(_0x49ce07['error'](0x1f4,_0x3e6e30[_0xdced('0x15')]));});});};exports[_0xdced('0x1e')]=function(_0x452aeb){var _0x4d5cf8=this;return new Promise(function(_0x38b369,_0x430eb6){return db['VoiceDialReport'][_0xdced('0x1f')](_0x452aeb[_0xdced('0x1a')],{'raw':_0x452aeb[_0xdced('0x1b')]?_0x452aeb['options'][_0xdced('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x452aeb[_0xdced('0x1b')]?_0x452aeb[_0xdced('0x1b')][_0xdced('0x20')]||null:null,'attributes':_0x452aeb[_0xdced('0x1b')]?_0x452aeb['options'][_0xdced('0x21')]||null:null,'limit':_0x452aeb[_0xdced('0x1b')]?_0x452aeb[_0xdced('0x1b')]['limit']||null:null})['then'](function(_0x3460b5){logger[_0xdced('0xd')](_0xdced('0x1e'),_0x452aeb);logger[_0xdced('0xf')](_0xdced('0x1e'),_0x452aeb,JSON[_0xdced('0x12')](_0x3460b5));_0x38b369(_0x3460b5);})[_0xdced('0x17')](function(_0x4a4206){logger[_0xdced('0x13')](_0xdced('0x1e'),_0x4a4206[_0xdced('0x15')],_0x452aeb);_0x430eb6(_0x4d5cf8['error'](0x1f4,_0x4a4206[_0xdced('0x15')]));});});}; \ No newline at end of file +var _0x83b9=['VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','VoiceDialReport','create','body','options','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','where','attributes','limit','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1eed8c,_0x3d4497){var _0x4b2760=function(_0x4f222c){while(--_0x4f222c){_0x1eed8c['push'](_0x1eed8c['shift']());}};_0x4b2760(++_0x3d4497);}(_0x83b9,0x15c));var _0x983b=function(_0x4da1d1,_0x7e80bf){_0x4da1d1=_0x4da1d1-0x0;var _0x42b10c=_0x83b9[_0x4da1d1];return _0x42b10c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x983b('0x0'));var BPromise=require(_0x983b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x983b('0x2'))['db'];var utils=require(_0x983b('0x3'));var logger=require(_0x983b('0x4'))(_0x983b('0x5'));var config=require(_0x983b('0x6'));var jayson=require(_0x983b('0x7'));var client=jayson[_0x983b('0x8')][_0x983b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3504,_0x204317,_0x3adbd4){return new BPromise(function(_0x100dcf,_0x1c3f2b){return client[_0x983b('0xa')](_0x5b3504,_0x3adbd4)[_0x983b('0xb')](function(_0x282770){logger[_0x983b('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x204317,_0x983b('0xd'));logger[_0x983b('0xe')](_0x983b('0xf'),_0x204317,_0x983b('0xd'),JSON['stringify'](_0x282770));if(_0x282770[_0x983b('0x10')]){if(_0x282770[_0x983b('0x10')][_0x983b('0x11')]===0x1f4){logger[_0x983b('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x204317,_0x282770[_0x983b('0x10')][_0x983b('0x12')]);return _0x1c3f2b(_0x282770['error'][_0x983b('0x12')]);}logger[_0x983b('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x204317,_0x282770[_0x983b('0x10')][_0x983b('0x12')]);return _0x100dcf(_0x282770['error'][_0x983b('0x12')]);}else{logger[_0x983b('0xc')](_0x983b('0x13'),_0x204317,'request\x20sent');_0x100dcf(_0x282770[_0x983b('0x14')][_0x983b('0x12')]);}})[_0x983b('0x15')](function(_0x40ca86){logger['error'](_0x983b('0x13'),_0x204317,_0x40ca86);_0x1c3f2b(_0x40ca86);});});}exports['CreateVoiceDialReport']=function(_0xbbbdd7){var _0x361887=this;return new Promise(function(_0x12b9cc,_0x9e0c56){return db[_0x983b('0x16')][_0x983b('0x17')](_0xbbbdd7[_0x983b('0x18')],{'raw':_0xbbbdd7[_0x983b('0x19')]?_0xbbbdd7['options']['raw']===undefined?!![]:![]:!![]})[_0x983b('0xb')](function(_0xea5e6){logger['info'](_0x983b('0x1a'),_0xbbbdd7);logger[_0x983b('0xe')](_0x983b('0x1a'),_0xbbbdd7,JSON[_0x983b('0x1b')](_0xea5e6));_0x12b9cc(_0xea5e6);})[_0x983b('0x15')](function(_0xaad765){logger['error'](_0x983b('0x1a'),_0xaad765[_0x983b('0x12')],_0xbbbdd7);_0x9e0c56(_0x361887['error'](0x1f4,_0xaad765[_0x983b('0x12')]));});});};exports[_0x983b('0x1c')]=function(_0x1d9e81){var _0x1613a3=this;return new Promise(function(_0x396cda,_0x2580c1){return db['VoiceDialReport'][_0x983b('0x1d')](_0x1d9e81[_0x983b('0x18')],{'raw':_0x1d9e81[_0x983b('0x19')]?_0x1d9e81[_0x983b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9e81[_0x983b('0x19')]?_0x1d9e81[_0x983b('0x19')][_0x983b('0x1e')]||null:null,'attributes':_0x1d9e81['options']?_0x1d9e81[_0x983b('0x19')][_0x983b('0x1f')]||null:null,'limit':_0x1d9e81[_0x983b('0x19')]?_0x1d9e81[_0x983b('0x19')][_0x983b('0x20')]||null:null})[_0x983b('0xb')](function(_0x3ba0e5){logger[_0x983b('0xc')](_0x983b('0x1c'),_0x1d9e81);logger[_0x983b('0xe')](_0x983b('0x1c'),_0x1d9e81,JSON[_0x983b('0x1b')](_0x3ba0e5));_0x396cda(_0x3ba0e5);})['catch'](function(_0x39c1e5){logger[_0x983b('0x10')](_0x983b('0x1c'),_0x39c1e5['message'],_0x1d9e81);_0x2580c1(_0x1613a3[_0x983b('0x10')](0x1f4,_0x39c1e5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index dc6ae65..b954ad2 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 _0x6c51=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','/:id/applications','put','delete','destroy'];(function(_0x28ff6f,_0x286ecd){var _0x2f17e5=function(_0x1a5099){while(--_0x1a5099){_0x28ff6f['push'](_0x28ff6f['shift']());}};_0x2f17e5(++_0x286ecd);}(_0x6c51,0x10f));var _0x16c5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6c51[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x16c5('0x0'));var path=require(_0x16c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x16c5('0x2'));var router=express[_0x16c5('0x3')]();var fs_extra=require(_0x16c5('0x4'));var auth=require(_0x16c5('0x5'));var interaction=require(_0x16c5('0x6'));var config=require(_0x16c5('0x7'));var controller=require('./voiceExtension.controller');router[_0x16c5('0x8')]('/',auth[_0x16c5('0x9')](),controller['index']);router[_0x16c5('0x8')](_0x16c5('0xa'),auth[_0x16c5('0x9')](),controller[_0x16c5('0xb')]);router[_0x16c5('0xc')]('/',auth[_0x16c5('0x9')](),controller['create']);router[_0x16c5('0xc')](_0x16c5('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0x16c5('0xe')](_0x16c5('0xa'),auth[_0x16c5('0x9')](),controller['update']);router[_0x16c5('0xf')](_0x16c5('0xa'),auth[_0x16c5('0x9')](),controller[_0x16c5('0x10')]);module[_0x16c5('0x11')]=router; \ No newline at end of file +var _0xa41d=['../../components/auth/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x707d43,_0x53c59c){var _0x2cd625=function(_0x2079e2){while(--_0x2079e2){_0x707d43['push'](_0x707d43['shift']());}};_0x2cd625(++_0x53c59c);}(_0xa41d,0x144));var _0xda41=function(_0x19aa26,_0x5f17b3){_0x19aa26=_0x19aa26-0x0;var _0x19da4e=_0xa41d[_0x19aa26];return _0x19da4e;};'use strict';var multer=require(_0xda41('0x0'));var util=require(_0xda41('0x1'));var path=require(_0xda41('0x2'));var timeout=require('connect-timeout');var express=require(_0xda41('0x3'));var router=express[_0xda41('0x4')]();var fs_extra=require(_0xda41('0x5'));var auth=require(_0xda41('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xda41('0x7'));var controller=require(_0xda41('0x8'));router[_0xda41('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xda41('0xa'),auth[_0xda41('0xb')](),controller[_0xda41('0xc')]);router[_0xda41('0xd')]('/',auth[_0xda41('0xb')](),controller[_0xda41('0xe')]);router['post'](_0xda41('0xf'),auth[_0xda41('0xb')](),controller[_0xda41('0x10')]);router[_0xda41('0x11')](_0xda41('0xa'),auth['isAuthenticated'](),controller[_0xda41('0x12')]);router[_0xda41('0x13')](_0xda41('0xa'),auth[_0xda41('0xb')](),controller[_0xda41('0x14')]);module[_0xda41('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5e712df..fd5a45e 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 _0x472f=['internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x35f6d0,_0x4f2153){var _0x332ed4=function(_0x3388b4){while(--_0x3388b4){_0x35f6d0['push'](_0x35f6d0['shift']());}};_0x332ed4(++_0x4f2153);}(_0x472f,0x119));var _0xf472=function(_0x1c777,_0x225ed0){_0x1c777=_0x1c777-0x0;var _0x4f895f=_0x472f[_0x1c777];return _0x4f895f;};'use strict';var Sequelize=require(_0xf472('0x0'));module[_0xf472('0x1')]={'context':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'unique':_0xf472('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'unique':_0xf472('0x3')},'priority':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xf472('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'defaultValue':_0xf472('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf472('0x5')](_0xf472('0x6'),_0xf472('0x7'),_0xf472('0x8'),_0xf472('0x9'),'outbound-fax','system',_0xf472('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf472('0x2')],'allowNull':![],'defaultValue':_0xf472('0xb')},'IntervalId':{'type':Sequelize[_0xf472('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf472('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xf472('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf472('0xc')]},'recordingFormat':{'type':Sequelize[_0xf472('0x2')],'defaultValue':_0xf472('0xe')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xf472('0xf')],'get':function(_0x3c6431){return this[_0xf472('0x10')]('exten');}},'alias':{'type':Sequelize[_0xf472('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x84f7=['outbound-fax','system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x84f7,0x14c));var _0x784f=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x84f7[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x784f('0x0'));module[_0x784f('0x1')]={'context':{'type':Sequelize[_0x784f('0x2')],'allowNull':![],'unique':_0x784f('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x784f('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x784f('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x784f('0x2')],'allowNull':![],'defaultValue':_0x784f('0x4')},'appdata':{'type':Sequelize[_0x784f('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x784f('0x5')](_0x784f('0x6'),_0x784f('0x7'),_0x784f('0x8'),_0x784f('0x9'),_0x784f('0xa'),_0x784f('0xb'),_0x784f('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x784f('0x2')]},'interval':{'type':Sequelize[_0x784f('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x784f('0xd')]},'isApp':{'type':Sequelize[_0x784f('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x784f('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x784f('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x784f('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x784f('0xd')]},'recordingFormat':{'type':Sequelize[_0x784f('0x2')],'defaultValue':_0x784f('0xf')},'answer':{'type':Sequelize[_0x784f('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0x784f('0x10')],'get':function(_0x56c178){return this[_0x784f('0x11')](_0x784f('0x12'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d12f471..e0b8a8e 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 _0x8401=['findAll','show','params','rawAttributes','include','catch','find','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','userProfileId','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','VoiceExtension','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x29c07d,_0x16dd11){var _0x23a4b8=function(_0x28fa0f){while(--_0x28fa0f){_0x29c07d['push'](_0x29c07d['shift']());}};_0x23a4b8(++_0x16dd11);}(_0x8401,0x1f3));var _0x1840=function(_0x44c145,_0x11abd8){_0x44c145=_0x44c145-0x0;var _0x4b9cb9=_0x8401[_0x44c145];return _0x4b9cb9;};'use strict';var _=require(_0x1840('0x0'));var Redis=require(_0x1840('0x1'));var qs=require(_0x1840('0x2'));var logger=require(_0x1840('0x3'))(_0x1840('0x4'));var config=require(_0x1840('0x5'));var db=require(_0x1840('0x6'))['db'];config[_0x1840('0x7')]=_[_0x1840('0x8')](config['redis'],{'host':_0x1840('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1840('0x7')]));require(_0x1840('0xa'))['register'](socket);function respondWithStatusCode(_0x4e46bc,_0x321e4e){_0x321e4e=_0x321e4e||0xcc;return function(_0x350afc){if(_0x350afc){return _0x4e46bc[_0x1840('0xb')](_0x321e4e);}return _0x4e46bc['status'](_0x321e4e)[_0x1840('0xc')]();};}function respondWithResult(_0x4430b4,_0x3b5700){_0x3b5700=_0x3b5700||0xc8;return function(_0x4db665){if(_0x4db665){return _0x4430b4[_0x1840('0xd')](_0x3b5700)[_0x1840('0xe')](_0x4db665);}};}function respondWithFilteredResult(_0x1ef55e,_0x3cdbd6){return function(_0x4dc80d){if(_0x4dc80d){var _0x8be416=typeof _0x3cdbd6[_0x1840('0xf')]===_0x1840('0x10')&&typeof _0x3cdbd6['limit']==='undefined';var _0xbad3c1=_0x4dc80d[_0x1840('0x11')];var _0x4cc266=_0x8be416?0x0:_0x3cdbd6[_0x1840('0xf')];var _0x515749=_0x8be416?_0x4dc80d[_0x1840('0x11')]:_0x3cdbd6['offset']+_0x3cdbd6[_0x1840('0x12')];var _0x3a4121;if(_0x515749>=_0xbad3c1){_0x515749=_0xbad3c1;_0x3a4121=0xc8;}else{_0x3a4121=0xce;}_0x1ef55e[_0x1840('0xd')](_0x3a4121);return _0x1ef55e[_0x1840('0x13')](_0x1840('0x14'),_0x4cc266+'-'+_0x515749+'/'+_0xbad3c1)[_0x1840('0xe')](_0x4dc80d);}return null;};}function removeEntity(_0x1d6b49){return function(_0x8b8694){if(_0x8b8694){return _0x8b8694[_0x1840('0x15')]()[_0x1840('0x16')](function(){var _0x534680=_0x8b8694[_0x1840('0x17')]({'plain':!![]});var _0x40b9d1=[{'name':_0x1840('0x18'),'value':_0x1840('0x19'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1840('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0x1840('0x1b'),'ignore':![]}];var _0x8ad518=_(_0x40b9d1)[_0x1840('0x1c')](_0x1840('0x1d'))[_0x1840('0x1e')](_0x1840('0x1f'))[_0x1840('0x1f')]();if(_[_0x1840('0x20')](_0x8ad518,_0x534680['type'])){return;}var _0x5d486c=_['find'](_0x40b9d1,['value',_0x534680[_0x1840('0x21')]])[_0x1840('0x22')];return db[_0x1840('0x23')][_0x1840('0x15')]({'where':{'type':_0x5d486c,'resourceId':_0x534680['id']}})['then'](function(){return _0x8b8694;});})[_0x1840('0x16')](function(){_0x1d6b49[_0x1840('0xd')](0xcc)[_0x1840('0xc')]();});}};}function handleEntityNotFound(_0x5c53ee){return function(_0x1d2bb5){if(!_0x1d2bb5){_0x5c53ee[_0x1840('0xb')](0x194);}return _0x1d2bb5;};}function handleError(_0xe4b7ea,_0x5bf003){_0x5bf003=_0x5bf003||0x1f4;return function(_0xa4d0c4){logger[_0x1840('0x24')](_0xa4d0c4[_0x1840('0x25')]);if(_0xa4d0c4[_0x1840('0x22')]){delete _0xa4d0c4[_0x1840('0x22')];}_0xe4b7ea[_0x1840('0xd')](_0x5bf003)[_0x1840('0x26')](_0xa4d0c4);};}exports['index']=function(_0x248e38,_0x43b616){var _0x4f35d9={},_0x3c1bff={},_0x3a0874={'count':0x0,'rows':[]};var _0x439e34=_[_0x1840('0x1e')](db[_0x1840('0x27')]['rawAttributes'],function(_0x573971){return{'name':_0x573971['fieldName'],'type':_0x573971['type'][_0x1840('0x28')]};});_0x3c1bff[_0x1840('0x29')]=_[_0x1840('0x1e')](_0x439e34,'name');_0x3c1bff[_0x1840('0x2a')]=_[_0x1840('0x2b')](_0x248e38['query']);_0x3c1bff[_0x1840('0x2c')]=_[_0x1840('0x2d')](_0x3c1bff[_0x1840('0x29')],_0x3c1bff[_0x1840('0x2a')]);_0x4f35d9[_0x1840('0x2e')]=_[_0x1840('0x2d')](_0x3c1bff[_0x1840('0x29')],qs['fields'](_0x248e38['query'][_0x1840('0x2f')]));_0x4f35d9[_0x1840('0x2e')]=_0x4f35d9[_0x1840('0x2e')][_0x1840('0x30')]?_0x4f35d9[_0x1840('0x2e')]:_0x3c1bff[_0x1840('0x29')];if(!_0x248e38[_0x1840('0x2a')][_0x1840('0x31')](_0x1840('0x32'))){_0x4f35d9[_0x1840('0x12')]=qs[_0x1840('0x12')](_0x248e38[_0x1840('0x2a')][_0x1840('0x12')]);_0x4f35d9[_0x1840('0xf')]=qs[_0x1840('0xf')](_0x248e38[_0x1840('0x2a')][_0x1840('0xf')]);}_0x4f35d9[_0x1840('0x33')]=qs[_0x1840('0x34')](_0x248e38[_0x1840('0x2a')][_0x1840('0x34')]);_0x4f35d9[_0x1840('0x35')]=qs[_0x1840('0x2c')](_[_0x1840('0x36')](_0x248e38[_0x1840('0x2a')],_0x3c1bff[_0x1840('0x2c')]),_0x439e34);if(_0x248e38[_0x1840('0x2a')][_0x1840('0x1c')]){_0x4f35d9[_0x1840('0x35')]=_[_0x1840('0x37')](_0x4f35d9[_0x1840('0x35')],{'$or':_['map'](_0x439e34,function(_0x2c81fb){if(_0x2c81fb['type']!==_0x1840('0x38')){var _0x422c3d={};_0x422c3d[_0x2c81fb[_0x1840('0x22')]]={'$like':'%'+_0x248e38['query'][_0x1840('0x1c')]+'%'};return _0x422c3d;}})});}_0x4f35d9=_[_0x1840('0x37')]({},_0x4f35d9,_0x248e38[_0x1840('0x39')]);var _0x4e9318={'where':_0x4f35d9[_0x1840('0x35')]};return db['VoiceExtension'][_0x1840('0x11')](_0x4e9318)[_0x1840('0x16')](function(_0x39adce){_0x3a0874['count']=_0x39adce;if(_0x248e38['query'][_0x1840('0x3a')]){_0x4f35d9['include']=[{'all':!![]}];}return db[_0x1840('0x27')][_0x1840('0x3b')](_0x4f35d9);})[_0x1840('0x16')](function(_0x95303a){_0x3a0874['rows']=_0x95303a;return _0x3a0874;})['then'](respondWithFilteredResult(_0x43b616,_0x4f35d9))['catch'](handleError(_0x43b616,null));};exports[_0x1840('0x3c')]=function(_0x279891,_0x161dbe){var _0x6bfe27={'raw':![],'where':{'id':_0x279891[_0x1840('0x3d')]['id']}},_0x5742bc={};_0x5742bc[_0x1840('0x29')]=_[_0x1840('0x2b')](db[_0x1840('0x27')][_0x1840('0x3e')]);_0x5742bc['query']=_['keys'](_0x279891[_0x1840('0x2a')]);_0x5742bc[_0x1840('0x2c')]=_['intersection'](_0x5742bc[_0x1840('0x29')],_0x5742bc[_0x1840('0x2a')]);_0x6bfe27[_0x1840('0x2e')]=_['intersection'](_0x5742bc[_0x1840('0x29')],qs['fields'](_0x279891[_0x1840('0x2a')][_0x1840('0x2f')]));_0x6bfe27[_0x1840('0x2e')]=_0x6bfe27[_0x1840('0x2e')][_0x1840('0x30')]?_0x6bfe27[_0x1840('0x2e')]:_0x5742bc[_0x1840('0x29')];if(_0x279891['query'][_0x1840('0x3a')]){_0x6bfe27[_0x1840('0x3f')]=[{'all':!![]}];}_0x6bfe27=_['merge']({},_0x6bfe27,_0x279891[_0x1840('0x39')]);return db[_0x1840('0x27')]['find'](_0x6bfe27)['then'](handleEntityNotFound(_0x161dbe,null))[_0x1840('0x16')](respondWithResult(_0x161dbe,null))[_0x1840('0x40')](handleError(_0x161dbe,null));};exports[_0x1840('0x15')]=function(_0xe3e50c,_0x4ba390){return db[_0x1840('0x27')][_0x1840('0x41')]({'where':{'id':_0xe3e50c['params']['id']}})[_0x1840('0x16')](handleEntityNotFound(_0x4ba390,null))[_0x1840('0x16')](removeEntity(_0x4ba390,null))[_0x1840('0x40')](handleError(_0x4ba390,null));};exports[_0x1840('0x42')]=function(_0x1c667d,_0x5aefdb){if(_0x1c667d[_0x1840('0x43')][_0x1840('0x21')]===_0x1840('0x1a')&&!_['startsWith'](_0x1c667d['body'][_0x1840('0x44')],'_')){_0x1c667d[_0x1840('0x43')][_0x1840('0x44')]='_'[_0x1840('0x45')](_0x1c667d[_0x1840('0x43')][_0x1840('0x44')]);}return db['VoiceExtension'][_0x1840('0x42')](_0x1c667d['body'],{'raw':![]})['then'](function(_0x20aac3){var _0x220a3a=_0x1c667d[_0x1840('0x46')][_0x1840('0x17')]({'plain':!![]});if(!_0x220a3a)throw new Error(_0x1840('0x47'));if(_0x220a3a[_0x1840('0x48')]===_0x1840('0x46')){var _0x40d7ae=_0x20aac3['get']({'plain':!![]});var _0x7807a0=[{'name':_0x1840('0x18'),'value':_0x1840('0x19')},{'name':_0x1840('0x49'),'value':_0x1840('0x1a')},{'name':'InternalRoutes','value':'internal'}];var _0x226c06=_[_0x1840('0x41')](_0x7807a0,['value',_0x40d7ae[_0x1840('0x21')]])[_0x1840('0x22')];return db[_0x1840('0x4a')][_0x1840('0x41')]({'where':{'name':_0x226c06,'userProfileId':_0x220a3a[_0x1840('0x4b')]},'raw':!![]})[_0x1840('0x16')](function(_0x1ca180){if(_0x1ca180&&_0x1ca180['autoAssociation']===0x0){return db['UserProfileResource'][_0x1840('0x42')]({'name':_0x40d7ae[_0x1840('0x22')],'resourceId':_0x40d7ae['id'],'type':_0x1ca180[_0x1840('0x22')],'sectionId':_0x1ca180['id']},{})[_0x1840('0x16')](function(){return _0x20aac3;});}else{return _0x20aac3;}})[_0x1840('0x40')](function(_0x22b020){logger[_0x1840('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22b020);throw _0x22b020;});}return _0x20aac3;})[_0x1840('0x16')](respondWithResult(_0x5aefdb,0xc9))[_0x1840('0x40')](handleError(_0x5aefdb,null));};exports['update']=function(_0x5ca605,_0x101533){if(_0x5ca605[_0x1840('0x43')]['id']){delete _0x5ca605[_0x1840('0x43')]['id'];}return db['VoiceExtension'][_0x1840('0x41')]({'where':{'id':_0x5ca605[_0x1840('0x3d')]['id']}})[_0x1840('0x16')](handleEntityNotFound(_0x101533,null))['then'](function(_0x29ae65){if(_0x29ae65){return db[_0x1840('0x27')][_0x1840('0x4c')](_[_0x1840('0x36')](_0x5ca605['body'],['exten',_0x1840('0x4d'),_0x1840('0x4e'),'recordingFormat',_0x1840('0x4f'),_0x1840('0x50'),_0x1840('0x51')]),{'where':{'context':_0x29ae65[_0x1840('0x4d')],'exten':_0x29ae65[_0x1840('0x44')]},'individualHooks':!![]})['then'](function(_0x384146){return _0x384146;});}return null;})[_0x1840('0x16')](respondWithStatusCode(_0x101533,null))[_0x1840('0x40')](handleError(_0x101533,null));};exports[_0x1840('0x52')]=function(_0x2fce0c,_0x1e1313){var _0x361b3f=_0x2fce0c['params']['id'];var _0x4b91e4=_0x2fce0c[_0x1840('0x43')];var _0x4553e8=0xc8;var _0x4a5a99=null;return db[_0x1840('0x53')][_0x1840('0x54')]({'isolationLevel':db[_0x1840('0x53')][_0x1840('0x55')][_0x1840('0x56')][_0x1840('0x57')]},function(_0x4682fa){return db[_0x1840('0x27')][_0x1840('0x58')]({'where':{'id':_0x361b3f},'transaction':_0x4682fa})[_0x1840('0x16')](function(_0x3f2251){if(_0x3f2251){return db[_0x1840('0x27')][_0x1840('0x15')]({'where':{'VoiceExtensionId':_0x361b3f},'transaction':_0x4682fa})['then'](function(){var _0x4292ec=_['map'](_0x4b91e4,function(_0x413514){_0x413514[_0x1840('0x59')]=_0x361b3f;_0x413514[_0x1840('0x5a')]=!![];return _0x413514;});return _0x3f2251[_0x1840('0x5b')](_0x4292ec);})[_0x1840('0x16')](function(_0x3e068f){return db['VoiceExtension']['bulkCreate'](_0x3e068f,{'transaction':_0x4682fa});});}else{_0x4553e8=0x194;_0x4a5a99=[];}});})[_0x1840('0x16')](function(){if(_0x4553e8!==0x194){return db[_0x1840('0x27')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x361b3f},'order':'cast(priority\x20as\x20unsigned)'})[_0x1840('0x16')](function(_0x4c8d28){_0x4a5a99=_0x4c8d28;});}})[_0x1840('0x40')](function(_0x52b8dc){_0x4553e8=0x1f4;logger['error'](_0x52b8dc['stack']);if(_0x52b8dc[_0x1840('0x22')]){delete _0x52b8dc['name'];}_0x4a5a99=_0x52b8dc;})[_0x1840('0x5c')](function(){if(_0x4a5a99===null){_0x1e1313[_0x1840('0xb')](_0x4553e8);}else{if(_0x4553e8===0x1f4){_0x1e1313['status'](_0x4553e8)[_0x1840('0x26')](_0x4a5a99);}else{_0x1e1313['status'](_0x4553e8)[_0x1840('0xe')](_0x4a5a99);}}});}; \ No newline at end of file +var _0xbe6e=['hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','startsWith','exten','user','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','send','../../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','inbound','outbound','InternalRoutes','internal','filter','map','value','type','UserProfileResource','error','index','VoiceExtension','model','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x275fe7,_0x3f5a81){var _0x28ca20=function(_0x3599a4){while(--_0x3599a4){_0x275fe7['push'](_0x275fe7['shift']());}};_0x28ca20(++_0x3f5a81);}(_0xbe6e,0x138));var _0xebe6=function(_0x576572,_0x1b2768){_0x576572=_0x576572-0x0;var _0x1eabb2=_0xbe6e[_0x576572];return _0x1eabb2;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xebe6('0x0'));var logger=require(_0xebe6('0x1'))(_0xebe6('0x2'));var config=require(_0xebe6('0x3'));var db=require(_0xebe6('0x4'))['db'];config[_0xebe6('0x5')]=_['defaults'](config[_0xebe6('0x5')],{'host':_0xebe6('0x6'),'port':0x18eb});var socket=require(_0xebe6('0x7'))(new Redis(config[_0xebe6('0x5')]));require(_0xebe6('0x8'))[_0xebe6('0x9')](socket);function respondWithStatusCode(_0x207bae,_0x2836ed){_0x2836ed=_0x2836ed||0xcc;return function(_0x554798){if(_0x554798){return _0x207bae[_0xebe6('0xa')](_0x2836ed);}return _0x207bae[_0xebe6('0xb')](_0x2836ed)[_0xebe6('0xc')]();};}function respondWithResult(_0x482bc9,_0x12c34e){_0x12c34e=_0x12c34e||0xc8;return function(_0x5b65ac){if(_0x5b65ac){return _0x482bc9[_0xebe6('0xb')](_0x12c34e)[_0xebe6('0xd')](_0x5b65ac);}};}function respondWithFilteredResult(_0x450f0a,_0x2cf815){return function(_0xd549e7){if(_0xd549e7){var _0x58760c=typeof _0x2cf815[_0xebe6('0xe')]===_0xebe6('0xf')&&typeof _0x2cf815[_0xebe6('0x10')]==='undefined';var _0x4d13a6=_0xd549e7[_0xebe6('0x11')];var _0x4ecf8c=_0x58760c?0x0:_0x2cf815[_0xebe6('0xe')];var _0x37183b=_0x58760c?_0xd549e7['count']:_0x2cf815[_0xebe6('0xe')]+_0x2cf815[_0xebe6('0x10')];var _0x17243e;if(_0x37183b>=_0x4d13a6){_0x37183b=_0x4d13a6;_0x17243e=0xc8;}else{_0x17243e=0xce;}_0x450f0a[_0xebe6('0xb')](_0x17243e);return _0x450f0a[_0xebe6('0x12')]('Content-Range',_0x4ecf8c+'-'+_0x37183b+'/'+_0x4d13a6)[_0xebe6('0xd')](_0xd549e7);}return null;};}function removeEntity(_0x12a47a){return function(_0x283793){if(_0x283793){return _0x283793[_0xebe6('0x13')]()[_0xebe6('0x14')](function(){var _0x2d6d32=_0x283793[_0xebe6('0x15')]({'plain':!![]});var _0x1dfe83=[{'name':_0xebe6('0x16'),'value':_0xebe6('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0xebe6('0x18'),'ignore':![]},{'name':_0xebe6('0x19'),'value':_0xebe6('0x1a'),'ignore':![]}];var _0x1351e2=_(_0x1dfe83)[_0xebe6('0x1b')]('ignore')[_0xebe6('0x1c')](_0xebe6('0x1d'))[_0xebe6('0x1d')]();if(_['includes'](_0x1351e2,_0x2d6d32[_0xebe6('0x1e')])){return;}var _0x3f19fa=_['find'](_0x1dfe83,[_0xebe6('0x1d'),_0x2d6d32[_0xebe6('0x1e')]])['name'];return db[_0xebe6('0x1f')]['destroy']({'where':{'type':_0x3f19fa,'resourceId':_0x2d6d32['id']}})['then'](function(){return _0x283793;});})[_0xebe6('0x14')](function(){_0x12a47a[_0xebe6('0xb')](0xcc)[_0xebe6('0xc')]();});}};}function handleEntityNotFound(_0x7e78d6){return function(_0x16ed69){if(!_0x16ed69){_0x7e78d6['sendStatus'](0x194);}return _0x16ed69;};}function handleError(_0x208320,_0x3b3070){_0x3b3070=_0x3b3070||0x1f4;return function(_0x1e79dc){logger[_0xebe6('0x20')](_0x1e79dc['stack']);if(_0x1e79dc['name']){delete _0x1e79dc['name'];}_0x208320[_0xebe6('0xb')](_0x3b3070)['send'](_0x1e79dc);};}exports[_0xebe6('0x21')]=function(_0x240359,_0x4810f8){var _0x2b0b9e={},_0x53857a={},_0x5ddb1b={'count':0x0,'rows':[]};var _0x2fcedd=_['map'](db[_0xebe6('0x22')]['rawAttributes'],function(_0x554a9e){return{'name':_0x554a9e['fieldName'],'type':_0x554a9e[_0xebe6('0x1e')]['key']};});_0x53857a[_0xebe6('0x23')]=_[_0xebe6('0x1c')](_0x2fcedd,_0xebe6('0x24'));_0x53857a[_0xebe6('0x25')]=_[_0xebe6('0x26')](_0x240359['query']);_0x53857a[_0xebe6('0x27')]=_[_0xebe6('0x28')](_0x53857a[_0xebe6('0x23')],_0x53857a[_0xebe6('0x25')]);_0x2b0b9e[_0xebe6('0x29')]=_[_0xebe6('0x28')](_0x53857a[_0xebe6('0x23')],qs[_0xebe6('0x2a')](_0x240359[_0xebe6('0x25')][_0xebe6('0x2a')]));_0x2b0b9e[_0xebe6('0x29')]=_0x2b0b9e[_0xebe6('0x29')][_0xebe6('0x2b')]?_0x2b0b9e[_0xebe6('0x29')]:_0x53857a['model'];if(!_0x240359[_0xebe6('0x25')][_0xebe6('0x2c')](_0xebe6('0x2d'))){_0x2b0b9e[_0xebe6('0x10')]=qs['limit'](_0x240359[_0xebe6('0x25')][_0xebe6('0x10')]);_0x2b0b9e[_0xebe6('0xe')]=qs[_0xebe6('0xe')](_0x240359[_0xebe6('0x25')]['offset']);}_0x2b0b9e[_0xebe6('0x2e')]=qs[_0xebe6('0x2f')](_0x240359[_0xebe6('0x25')][_0xebe6('0x2f')]);_0x2b0b9e[_0xebe6('0x30')]=qs[_0xebe6('0x27')](_['pick'](_0x240359[_0xebe6('0x25')],_0x53857a[_0xebe6('0x27')]),_0x2fcedd);if(_0x240359[_0xebe6('0x25')][_0xebe6('0x1b')]){_0x2b0b9e[_0xebe6('0x30')]=_[_0xebe6('0x31')](_0x2b0b9e['where'],{'$or':_['map'](_0x2fcedd,function(_0x5ab1e7){if(_0x5ab1e7[_0xebe6('0x1e')]!==_0xebe6('0x32')){var _0xf72004={};_0xf72004[_0x5ab1e7[_0xebe6('0x24')]]={'$like':'%'+_0x240359[_0xebe6('0x25')]['filter']+'%'};return _0xf72004;}})});}_0x2b0b9e=_[_0xebe6('0x31')]({},_0x2b0b9e,_0x240359[_0xebe6('0x33')]);var _0x18f557={'where':_0x2b0b9e[_0xebe6('0x30')]};return db[_0xebe6('0x22')][_0xebe6('0x11')](_0x18f557)[_0xebe6('0x14')](function(_0x4005b2){_0x5ddb1b[_0xebe6('0x11')]=_0x4005b2;if(_0x240359[_0xebe6('0x25')][_0xebe6('0x34')]){_0x2b0b9e[_0xebe6('0x35')]=[{'all':!![]}];}return db[_0xebe6('0x22')]['findAll'](_0x2b0b9e);})['then'](function(_0x483f46){_0x5ddb1b[_0xebe6('0x36')]=_0x483f46;return _0x5ddb1b;})[_0xebe6('0x14')](respondWithFilteredResult(_0x4810f8,_0x2b0b9e))[_0xebe6('0x37')](handleError(_0x4810f8,null));};exports[_0xebe6('0x38')]=function(_0x26ab93,_0xef0527){var _0x36ad83={'raw':![],'where':{'id':_0x26ab93[_0xebe6('0x39')]['id']}},_0x4e94c8={};_0x4e94c8['model']=_[_0xebe6('0x26')](db['VoiceExtension'][_0xebe6('0x3a')]);_0x4e94c8[_0xebe6('0x25')]=_[_0xebe6('0x26')](_0x26ab93[_0xebe6('0x25')]);_0x4e94c8[_0xebe6('0x27')]=_[_0xebe6('0x28')](_0x4e94c8['model'],_0x4e94c8[_0xebe6('0x25')]);_0x36ad83[_0xebe6('0x29')]=_['intersection'](_0x4e94c8[_0xebe6('0x23')],qs[_0xebe6('0x2a')](_0x26ab93[_0xebe6('0x25')]['fields']));_0x36ad83[_0xebe6('0x29')]=_0x36ad83[_0xebe6('0x29')][_0xebe6('0x2b')]?_0x36ad83['attributes']:_0x4e94c8['model'];if(_0x26ab93['query']['includeAll']){_0x36ad83[_0xebe6('0x35')]=[{'all':!![]}];}_0x36ad83=_[_0xebe6('0x31')]({},_0x36ad83,_0x26ab93[_0xebe6('0x33')]);return db[_0xebe6('0x22')][_0xebe6('0x3b')](_0x36ad83)[_0xebe6('0x14')](handleEntityNotFound(_0xef0527,null))[_0xebe6('0x14')](respondWithResult(_0xef0527,null))[_0xebe6('0x37')](handleError(_0xef0527,null));};exports[_0xebe6('0x13')]=function(_0x47c6e6,_0x2a5470){return db[_0xebe6('0x22')][_0xebe6('0x3b')]({'where':{'id':_0x47c6e6[_0xebe6('0x39')]['id']}})['then'](handleEntityNotFound(_0x2a5470,null))[_0xebe6('0x14')](removeEntity(_0x2a5470,null))[_0xebe6('0x37')](handleError(_0x2a5470,null));};exports[_0xebe6('0x3c')]=function(_0x5d58e3,_0x1996a6){if(_0x5d58e3[_0xebe6('0x3d')]['type']==='outbound'&&!_[_0xebe6('0x3e')](_0x5d58e3[_0xebe6('0x3d')][_0xebe6('0x3f')],'_')){_0x5d58e3[_0xebe6('0x3d')][_0xebe6('0x3f')]='_'['concat'](_0x5d58e3[_0xebe6('0x3d')][_0xebe6('0x3f')]);}return db[_0xebe6('0x22')][_0xebe6('0x3c')](_0x5d58e3[_0xebe6('0x3d')],{'raw':![]})[_0xebe6('0x14')](function(_0x31a6f9){var _0x2fc020=_0x5d58e3[_0xebe6('0x40')][_0xebe6('0x15')]({'plain':!![]});if(!_0x2fc020)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fc020['role']===_0xebe6('0x40')){var _0x10ffc9=_0x31a6f9[_0xebe6('0x15')]({'plain':!![]});var _0x55f00d=[{'name':_0xebe6('0x16'),'value':_0xebe6('0x17')},{'name':_0xebe6('0x41'),'value':_0xebe6('0x18')},{'name':'InternalRoutes','value':_0xebe6('0x1a')}];var _0x235a9d=_['find'](_0x55f00d,[_0xebe6('0x1d'),_0x10ffc9[_0xebe6('0x1e')]])[_0xebe6('0x24')];return db[_0xebe6('0x42')][_0xebe6('0x3b')]({'where':{'name':_0x235a9d,'userProfileId':_0x2fc020[_0xebe6('0x43')]},'raw':!![]})[_0xebe6('0x14')](function(_0x16f824){if(_0x16f824&&_0x16f824[_0xebe6('0x44')]===0x0){return db[_0xebe6('0x1f')][_0xebe6('0x3c')]({'name':_0x10ffc9[_0xebe6('0x24')],'resourceId':_0x10ffc9['id'],'type':_0x16f824[_0xebe6('0x24')],'sectionId':_0x16f824['id']},{})[_0xebe6('0x14')](function(){return _0x31a6f9;});}else{return _0x31a6f9;}})['catch'](function(_0x408657){logger['error'](_0xebe6('0x45'),_0x408657);throw _0x408657;});}return _0x31a6f9;})['then'](respondWithResult(_0x1996a6,0xc9))[_0xebe6('0x37')](handleError(_0x1996a6,null));};exports['update']=function(_0x20c03d,_0x53bf2e){if(_0x20c03d[_0xebe6('0x3d')]['id']){delete _0x20c03d[_0xebe6('0x3d')]['id'];}return db[_0xebe6('0x22')][_0xebe6('0x3b')]({'where':{'id':_0x20c03d['params']['id']}})[_0xebe6('0x14')](handleEntityNotFound(_0x53bf2e,null))[_0xebe6('0x14')](function(_0x192c06){if(_0x192c06){return db[_0xebe6('0x22')]['update'](_[_0xebe6('0x46')](_0x20c03d[_0xebe6('0x3d')],[_0xebe6('0x3f'),_0xebe6('0x47'),_0xebe6('0x48'),_0xebe6('0x49'),_0xebe6('0x4a'),_0xebe6('0x4b'),_0xebe6('0x4c')]),{'where':{'context':_0x192c06[_0xebe6('0x47')],'exten':_0x192c06['exten']},'individualHooks':!![]})[_0xebe6('0x14')](function(_0x22dccd){return _0x22dccd;});}return null;})[_0xebe6('0x14')](respondWithStatusCode(_0x53bf2e,null))[_0xebe6('0x37')](handleError(_0x53bf2e,null));};exports[_0xebe6('0x4d')]=function(_0x1680d7,_0x53d915){var _0x26144d=_0x1680d7[_0xebe6('0x39')]['id'];var _0x44546b=_0x1680d7[_0xebe6('0x3d')];var _0x27b26a=0xc8;var _0x3b9d69=null;return db[_0xebe6('0x4e')]['transaction']({'isolationLevel':db[_0xebe6('0x4e')][_0xebe6('0x4f')][_0xebe6('0x50')][_0xebe6('0x51')]},function(_0x7b5878){return db[_0xebe6('0x22')][_0xebe6('0x52')]({'where':{'id':_0x26144d},'transaction':_0x7b5878})['then'](function(_0x395077){if(_0x395077){return db['VoiceExtension'][_0xebe6('0x13')]({'where':{'VoiceExtensionId':_0x26144d},'transaction':_0x7b5878})[_0xebe6('0x14')](function(){var _0x5ee4c4=_[_0xebe6('0x1c')](_0x44546b,function(_0x4309be){_0x4309be[_0xebe6('0x53')]=_0x26144d;_0x4309be[_0xebe6('0x54')]=!![];return _0x4309be;});return _0x395077['createRouting'](_0x5ee4c4);})[_0xebe6('0x14')](function(_0x485678){return db['VoiceExtension'][_0xebe6('0x55')](_0x485678,{'transaction':_0x7b5878});});}else{_0x27b26a=0x194;_0x3b9d69=[];}});})[_0xebe6('0x14')](function(){if(_0x27b26a!==0x194){return db[_0xebe6('0x22')][_0xebe6('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x26144d},'order':_0xebe6('0x57')})[_0xebe6('0x14')](function(_0x1b7864){_0x3b9d69=_0x1b7864;});}})[_0xebe6('0x37')](function(_0x5a3f89){_0x27b26a=0x1f4;logger[_0xebe6('0x20')](_0x5a3f89['stack']);if(_0x5a3f89[_0xebe6('0x24')]){delete _0x5a3f89['name'];}_0x3b9d69=_0x5a3f89;})['finally'](function(){if(_0x3b9d69===null){_0x53d915['sendStatus'](_0x27b26a);}else{if(_0x27b26a===0x1f4){_0x53d915[_0xebe6('0xb')](_0x27b26a)[_0xebe6('0x58')](_0x3b9d69);}else{_0x53d915['status'](_0x27b26a)['json'](_0x3b9d69);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 95c1897..aa705df 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 _0x94d5=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x94d5,0xcd));var _0x594d=function(_0x58ef97,_0x10b810){_0x58ef97=_0x58ef97-0x0;var _0x2ed8df=_0x94d5[_0x58ef97];return _0x2ed8df;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x594d('0x0'))['db'][_0x594d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x594d('0x2')](0x0);var events={'afterCreate':_0x594d('0x3'),'afterUpdate':'update','afterDestroy':_0x594d('0x4')};function emitEvent(_0x460223){return function(_0x5ca69c,_0x25ef46,_0x3d3931){VoiceExtensionEvents[_0x594d('0x5')](_0x460223+':'+_0x5ca69c['id'],_0x5ca69c);VoiceExtensionEvents[_0x594d('0x5')](_0x460223,_0x5ca69c);_0x3d3931(null);};}for(var e in events){if(events[_0x594d('0x6')](e)){var event=events[e];VoiceExtension[_0x594d('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x3cc3=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5d506b,_0x41b1ca){var _0x2a8f24=function(_0x12821c){while(--_0x12821c){_0x5d506b['push'](_0x5d506b['shift']());}};_0x2a8f24(++_0x41b1ca);}(_0x3cc3,0x95));var _0x33cc=function(_0x3c7e04,_0xb41daf){_0x3c7e04=_0x3c7e04-0x0;var _0xa700fa=_0x3cc3[_0x3c7e04];return _0xa700fa;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x33cc('0x0'))['db'][_0x33cc('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x33cc('0x2')](0x0);var events={'afterCreate':_0x33cc('0x3'),'afterUpdate':_0x33cc('0x4'),'afterDestroy':_0x33cc('0x5')};function emitEvent(_0x29ae11){return function(_0x36c583,_0x11b152,_0x59a225){VoiceExtensionEvents[_0x33cc('0x6')](_0x29ae11+':'+_0x36c583['id'],_0x36c583);VoiceExtensionEvents[_0x33cc('0x6')](_0x29ae11,_0x36c583);_0x59a225(null);};}for(var e in events){if(events[_0x33cc('0x7')](e)){var event=events[e];VoiceExtension[_0x33cc('0x8')](e,emitEvent(event));}}module[_0x33cc('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 273c3cb..2c158d9 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 _0xacd0=['Interval','interval','IntervalId','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','last','priority','VoiceExtension','voice_extensions','get','then','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xacd0,0xc9));var _0x0acd=function(_0x18efb0,_0x402155){_0x18efb0=_0x18efb0-0x0;var _0x463641=_0xacd0[_0x18efb0];return _0x463641;};'use strict';var _=require(_0x0acd('0x0'));var attributes=require(_0x0acd('0x1'));module[_0x0acd('0x2')]=function(_0x4bd438){var _0x42fa2d=_0x4bd438['models'];function _0x1e95fd(_0x569f93){var _0x147d6d=0x2;var _0x586d60=[{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':_0x0acd('0x5')+_0x569f93[_0x0acd('0x3')],'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93['type'],'app':_0x569f93['alias']?_0x0acd('0x4'):'NoOp','appdata':_0x569f93[_0x0acd('0x8')]?_0x0acd('0x9')+_0x569f93['alias']:_0x0acd('0xa'),'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']}];if(_0x569f93[_0x0acd('0x3')]===_0x0acd('0xb')){_0x586d60[_0x0acd('0xc')]({'type':'inbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0xd')+_0x569f93['id'],'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']});}_0x586d60['push']({'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x569f93['context'],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':_0x0acd('0xe'),'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']});return _0x586d60;}function _0x9ae857(_0x419059){var _0x48329a=0x2;var _0x4b137a=[{'type':_0x0acd('0xf'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x419059[_0x0acd('0x8')]?'Set':_0x0acd('0x10'),'appdata':_0x419059[_0x0acd('0x8')]?'CDR(routeAlias)='+_0x419059['alias']:_0x0acd('0xa'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x11')+(_0x419059[_0x0acd('0x12')]?_0x0acd('0x13')+_0x419059[_0x0acd('0x12')]+'}':'${EXTEN}'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0xd')+_0x419059['id'],'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x15')+(_0x48329a+0x2)+_0x0acd('0x16')+(_0x48329a+0x1)+')','context':_0x419059[_0x0acd('0x6')],'exten':_0x419059['exten'],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x419059[_0x0acd('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0x419059['cutdigits']+'}':_0x0acd('0x17'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x18'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x19'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0xe'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x1a')+_0x419059['id'],'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']}];if(_0x419059[_0x0acd('0x1b')](_0x0acd('0x1c'))&&_0x419059[_0x0acd('0x1c')]!==_0x0acd('0x1d')){_0x4b137a[_0x0acd('0xc')]({'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x1e'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x1f')+_0x419059[_0x0acd('0x1c')]||_0x0acd('0x20'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']});}return _0x4b137a;}function _0x1c335c(_0x4dd81a,_0x3a52af){var _0x458bf5=[{'name':_0x0acd('0x21'),'param':0x0},{'name':_0x0acd('0x22'),'param':0x1},{'name':_0x0acd('0x23'),'param':0x2},{'name':_0x0acd('0x24'),'param':0x3}];var _0x1cec0e={};var _0x5ab344=_0x3a52af[_0x0acd('0x25')](',');var _0x546e90=[];for(var _0x8eaa8d=0x0;_0x8eaa8d<_0x458bf5['length'];_0x8eaa8d++){switch(_0x458bf5[_0x8eaa8d][_0x0acd('0x26')]){case _0x0acd('0x21'):_0x1cec0e[_0x0acd('0x21')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]['split']('/')[0x1];_0x1cec0e[_0x0acd('0x28')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]['split']('/')[0x2];_0x1cec0e[_0x0acd('0x29')]=_0x1cec0e[_0x0acd('0x28')]?_0x1cec0e[_0x0acd('0x28')]['split']('$')[0x0]:undefined;_0x1cec0e[_0x0acd('0x28')]=_0x4dd81a['cutdigits']?(_0x1cec0e['prefix']||'')+_0x0acd('0x13')+_0x4dd81a[_0x0acd('0x12')]+'}':(_0x1cec0e[_0x0acd('0x29')]||'')+'${EXTEN}';_0x546e90[_0x458bf5[_0x8eaa8d]['param']]=[_0x0acd('0x2a'),_0x1cec0e['trunk'],_0x1cec0e[_0x0acd('0x28')]][_0x0acd('0x2b')]('/');break;case _0x0acd('0x23'):_0x1cec0e[_0x0acd('0x23')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]];if(_0x4dd81a[_0x0acd('0x1c')]!==_0x0acd('0x1d')){if(_0x1cec0e['options'][_0x0acd('0x2c')](_0x0acd('0x2d'))<0x0){_0x1cec0e[_0x0acd('0x23')]+=_0x0acd('0x2d');}}else{_0x1cec0e[_0x0acd('0x23')]=_0x1cec0e['options'][_0x0acd('0x2e')](_0x0acd('0x2d'),'');}_0x546e90[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]=_0x1cec0e['options'];break;default:_0x546e90[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]=_0x5ab344[_0x458bf5[_0x8eaa8d]['param']];}}return _0x546e90[_0x0acd('0x2b')](',');}function _0x4c9d9f(_0x44673e,_0x5a86f6,_0x3949f2){return new Promise(function(_0x470eba,_0x3f015c){var _0x4922ca=[];if(_[_0x0acd('0x2f')](_0x5a86f6))return _0x470eba(_0x4922ca);_0x42fa2d[_0x0acd('0x30')]['findAll']({'attributes':['id',_0x0acd('0x31'),_0x0acd('0x32')],'raw':!![]})['then'](function(_0x2de8ff){for(var _0x4ff471=0x0,_0x5421b5=0x0;_0x4ff471<_0x5a86f6[_0x0acd('0x33')];_0x4ff471++,_0x5421b5=0x0){var _0x2b611e=_0x5a86f6[_0x4ff471];var _0xd81b95=[];var _0x2ca39e=[];delete _0x2b611e['id'];if(_0x2b611e['interval']!==_0x0acd('0x34')){_0x2b611e[_0x0acd('0x35')]=[_0x2b611e[_0x0acd('0x31')]];}else{_0x2b611e[_0x0acd('0x35')]=_0x2b611e[_0x0acd('0x32')]?_[_0x0acd('0x36')](_[_0x0acd('0x37')](_0x2de8ff,{'IntervalId':_0x2b611e['IntervalId']}),_0x0acd('0x31')):[];}_0x2b611e[_0x0acd('0x6')]=_0x44673e[_0x0acd('0x6')];_0x2b611e[_0x0acd('0x7')]=_0x44673e[_0x0acd('0x7')];if(_0x2b611e['type'])_0x2b611e[_0x0acd('0x3')]=_0x2b611e['type'][_0x0acd('0x38')]();if(_0x44673e[_0x0acd('0x3')]===_0x0acd('0xf')){if(_0x2b611e[_0x0acd('0x1b')]('tag')&&_0x2b611e[_0x0acd('0x39')]&&_0x2b611e['tag']!=='--'){_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x3a')+_0x2b611e[_0x0acd('0x39')],'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':'ExecIf','appdata':_0x0acd('0x3b')+(_0x2b611e[_0x0acd('0x3c')]?'Set(CALLERID(all)='+_0x2b611e[_0x0acd('0x3c')]+')':_0x0acd('0x3d')),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}else{if(_0x2b611e[_0x0acd('0x1b')](_0x0acd('0x3e'))){if(['queue','playback'][_0x0acd('0x3f')](_0x2b611e[_0x0acd('0x40')][_0x0acd('0x38')]())&&_0x2b611e['appType']!==_0x0acd('0x41')){if(_0x2b611e[_0x0acd('0x3e')]){_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e['type']['toLowerCase'](),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x42'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e['intervals'][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x43'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e['exten'],'priority':_0x2b611e[_0x0acd('0x35')]['length']+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}else{_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')]['toLowerCase'](),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x44'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')]['length']+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});_0xd81b95['push']({'type':_0x2b611e[_0x0acd('0x3')]['toLowerCase'](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x45'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e['exten'],'priority':_0x2b611e['intervals'][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}}}}for(var _0x9345c0=0x0;_0x9345c0<_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')];_0x9345c0++){var _0x1b175c=_0x3949f2+_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')];var _0x1983c8=_0x9345c0===_0x2b611e['intervals'][_0x0acd('0x33')]-0x1?_0x3949f2+_0xd81b95[_0x0acd('0x33')]+_0x2ca39e[_0x0acd('0x33')]+0x2:_0x3949f2+_0x9345c0+0x1;_0xd81b95[_0x0acd('0x46')](_0x9345c0,0x0,{'type':_0x44673e[_0x0acd('0x3')],'app':_0x0acd('0x47'),'appdata':_0x2b611e[_0x0acd('0x35')][_0x9345c0]+'?'+_0x44673e[_0x0acd('0x6')]+_0x0acd('0x48')+_0x1b175c+':'+_0x44673e[_0x0acd('0x6')]+_0x0acd('0x48')+_0x1983c8,'exten':_0x44673e['exten'],'context':_0x44673e[_0x0acd('0x6')],'priority':_0x3949f2+_0x9345c0,'VoiceExtensionId':_0x44673e['id']});}if(_0x2b611e[_0x0acd('0x49')]==='outboundDial')_0x2b611e[_0x0acd('0x4a')]=_0x1c335c(_0x44673e,_0x2b611e[_0x0acd('0x4a')]);_0x2b611e['priority']=_0xd81b95[_0x0acd('0x33')]?_[_0x0acd('0x4b')](_0xd81b95)[_0x0acd('0x4c')]+0x1:_0x3949f2;_0x4922ca=_['concat'](_0x4922ca,_0xd81b95,[_0x2b611e],_0x2ca39e);_0x3949f2=_[_0x0acd('0x4b')](_0x4922ca)['priority']+0x1;}return _0x470eba(_0x4922ca);})['catch'](function(_0x2a8589){_0x3f015c(_0x2a8589);});});}return _0x4bd438['define'](_0x0acd('0x4d'),attributes,{'tableName':_0x0acd('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44307b){var _0x5af26a=this[_0x0acd('0x4f')]({'plain':!![]});var _0x25382a=_0x5af26a[_0x0acd('0x3')]===_0x0acd('0xf')?_0x9ae857(_0x5af26a):_0x1e95fd(_0x5af26a);return _0x4c9d9f(_0x5af26a,_0x44307b,_[_0x0acd('0x4b')](_0x25382a)[_0x0acd('0x4c')]+0x1)[_0x0acd('0x50')](function(_0x253f2e){var _0xbcfe11=_[_0x0acd('0x51')](_0x25382a,_0x253f2e);_0xbcfe11[_0x0acd('0xc')]({'type':_0x5af26a[_0x0acd('0x3')],'app':_0x0acd('0x52'),'exten':_0x5af26a[_0x0acd('0x7')],'context':_0x5af26a[_0x0acd('0x6')],'priority':_[_0x0acd('0x4b')](_0xbcfe11)[_0x0acd('0x4c')]+0x1,'VoiceExtensionId':_0x5af26a['id']});return _0xbcfe11;});}}});}; \ No newline at end of file +var _0xe008=['answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','get','Hangup','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','No\x20alias\x20set','outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','then','interval','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)'];(function(_0x4c1daa,_0x3837dd){var _0x523d81=function(_0x32ffaa){while(--_0x32ffaa){_0x4c1daa['push'](_0x4c1daa['shift']());}};_0x523d81(++_0x3837dd);}(_0xe008,0x14f));var _0x8e00=function(_0x44f447,_0x163ad3){_0x44f447=_0x44f447-0x0;var _0x1a140c=_0xe008[_0x44f447];return _0x1a140c;};'use strict';var _=require('lodash');var attributes=require(_0x8e00('0x0'));module[_0x8e00('0x1')]=function(_0x38d153){var _0x1b8e93=_0x38d153[_0x8e00('0x2')];function _0x5d8b6a(_0x1d9a68){var _0x555e84=0x2;var _0x4a6810=[{'type':_0x1d9a68[_0x8e00('0x3')],'app':_0x8e00('0x4'),'appdata':'CDR(type)='+_0x1d9a68[_0x8e00('0x3')],'context':_0x1d9a68[_0x8e00('0x5')],'exten':_0x1d9a68[_0x8e00('0x6')],'priority':_0x555e84++,'VoiceExtensionId':_0x1d9a68['id']},{'type':_0x1d9a68[_0x8e00('0x3')],'app':_0x1d9a68[_0x8e00('0x7')]?'Set':_0x8e00('0x8'),'appdata':_0x1d9a68[_0x8e00('0x7')]?_0x8e00('0x9')+_0x1d9a68['alias']:'No\x20alias\x20set','context':_0x1d9a68[_0x8e00('0x5')],'exten':_0x1d9a68[_0x8e00('0x6')],'priority':_0x555e84++,'VoiceExtensionId':_0x1d9a68['id']}];if(_0x1d9a68['type']===_0x8e00('0xa')){_0x4a6810['push']({'type':_0x8e00('0xa'),'app':'Set','appdata':_0x8e00('0xb')+_0x1d9a68['id'],'context':_0x1d9a68[_0x8e00('0x5')],'exten':_0x1d9a68['exten'],'priority':_0x555e84++,'VoiceExtensionId':_0x1d9a68['id']});}_0x4a6810[_0x8e00('0xc')]({'type':_0x1d9a68[_0x8e00('0x3')],'app':_0x8e00('0x4'),'appdata':_0x8e00('0xd'),'context':_0x1d9a68[_0x8e00('0x5')],'exten':_0x1d9a68[_0x8e00('0x6')],'priority':_0x555e84++,'VoiceExtensionId':_0x1d9a68['id']},{'type':_0x1d9a68[_0x8e00('0x3')],'app':'Set','appdata':_0x8e00('0xe'),'context':_0x1d9a68['context'],'exten':_0x1d9a68[_0x8e00('0x6')],'priority':_0x555e84++,'VoiceExtensionId':_0x1d9a68['id']},{'type':_0x1d9a68[_0x8e00('0x3')],'app':_0x8e00('0x4'),'appdata':_0x8e00('0xf'),'context':_0x1d9a68[_0x8e00('0x5')],'exten':_0x1d9a68[_0x8e00('0x6')],'priority':_0x555e84++,'VoiceExtensionId':_0x1d9a68['id']});return _0x4a6810;}function _0x5977e0(_0x1d209b){var _0x1b8093=0x2;var _0x475c49=[{'type':'outbound','app':_0x8e00('0x4'),'appdata':'CDR(type)=outbound','context':_0x1d209b['context'],'exten':_0x1d209b['exten'],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':'outbound','app':_0x1d209b[_0x8e00('0x7')]?_0x8e00('0x4'):'NoOp','appdata':_0x1d209b[_0x8e00('0x7')]?'CDR(routeAlias)='+_0x1d209b[_0x8e00('0x7')]:_0x8e00('0x10'),'context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':_0x8e00('0x4'),'appdata':'CDR(destination)='+(_0x1d209b[_0x8e00('0x12')]?_0x8e00('0x13')+_0x1d209b['cutdigits']+'}':'${EXTEN}'),'context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':'outbound','app':'Set','appdata':_0x8e00('0xb')+_0x1d209b['id'],'context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':_0x8e00('0x14'),'appdata':_0x8e00('0x15')+(_0x1b8093+0x2)+_0x8e00('0x16')+(_0x1b8093+0x1)+')','context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':'Set','appdata':_0x1d209b[_0x8e00('0x12')]?_0x8e00('0x17')+_0x1d209b[_0x8e00('0x12')]+'}':_0x8e00('0x18'),'context':_0x1d209b['context'],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':_0x8e00('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':_0x8e00('0x4'),'appdata':_0x8e00('0xe'),'context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':_0x8e00('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':'outbound','app':_0x8e00('0x4'),'appdata':_0x8e00('0x19')+_0x1d209b['id'],'context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b['exten'],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']}];if(_0x1d209b[_0x8e00('0x1a')]('recordingFormat')&&_0x1d209b[_0x8e00('0x1b')]!==_0x8e00('0x1c')){_0x475c49[_0x8e00('0xc')]({'type':_0x8e00('0x11'),'app':_0x8e00('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1d209b['context'],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']},{'type':_0x8e00('0x11'),'app':_0x8e00('0x4'),'appdata':_0x8e00('0x1d')+_0x1d209b[_0x8e00('0x1b')]||_0x8e00('0x1e'),'context':_0x1d209b[_0x8e00('0x5')],'exten':_0x1d209b[_0x8e00('0x6')],'priority':_0x1b8093++,'VoiceExtensionId':_0x1d209b['id']});}return _0x475c49;}function _0x122e46(_0x231043,_0x348222){var _0x46aa42=[{'name':_0x8e00('0x1f'),'param':0x0},{'name':_0x8e00('0x20'),'param':0x1},{'name':_0x8e00('0x21'),'param':0x2},{'name':_0x8e00('0x22'),'param':0x3}];var _0x5b5258={};var _0xd01870=_0x348222[_0x8e00('0x23')](',');var _0x59264a=[];for(var _0x26aa43=0x0;_0x26aa43<_0x46aa42[_0x8e00('0x24')];_0x26aa43++){switch(_0x46aa42[_0x26aa43][_0x8e00('0x25')]){case _0x8e00('0x1f'):_0x5b5258[_0x8e00('0x1f')]=_0xd01870[_0x46aa42[_0x26aa43][_0x8e00('0x26')]][_0x8e00('0x23')]('/')[0x1];_0x5b5258[_0x8e00('0x27')]=_0xd01870[_0x46aa42[_0x26aa43][_0x8e00('0x26')]]['split']('/')[0x2];_0x5b5258[_0x8e00('0x28')]=_0x5b5258[_0x8e00('0x27')]?_0x5b5258[_0x8e00('0x27')][_0x8e00('0x23')]('$')[0x0]:undefined;_0x5b5258['phone']=_0x231043['cutdigits']?(_0x5b5258['prefix']||'')+_0x8e00('0x13')+_0x231043[_0x8e00('0x12')]+'}':(_0x5b5258[_0x8e00('0x28')]||'')+'${EXTEN}';_0x59264a[_0x46aa42[_0x26aa43]['param']]=[_0x8e00('0x29'),_0x5b5258[_0x8e00('0x1f')],_0x5b5258['phone']][_0x8e00('0x2a')]('/');break;case _0x8e00('0x21'):_0x5b5258[_0x8e00('0x21')]=_0xd01870[_0x46aa42[_0x26aa43][_0x8e00('0x26')]];if(_0x231043['recordingFormat']!==_0x8e00('0x1c')){if(_0x5b5258['options']['indexOf'](_0x8e00('0x2b'))<0x0){_0x5b5258['options']+=_0x8e00('0x2b');}}else{_0x5b5258[_0x8e00('0x21')]=_0x5b5258['options'][_0x8e00('0x2c')](_0x8e00('0x2b'),'');}_0x59264a[_0x46aa42[_0x26aa43][_0x8e00('0x26')]]=_0x5b5258[_0x8e00('0x21')];break;default:_0x59264a[_0x46aa42[_0x26aa43]['param']]=_0xd01870[_0x46aa42[_0x26aa43][_0x8e00('0x26')]];}}return _0x59264a[_0x8e00('0x2a')](',');}function _0x3d8b75(_0x93f17e,_0x29de9e,_0x3727ea){return new Promise(function(_0x37bf60,_0x4289c7){var _0x588c57=[];if(_['isEmpty'](_0x29de9e))return _0x37bf60(_0x588c57);_0x1b8e93[_0x8e00('0x2d')][_0x8e00('0x2e')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0x8e00('0x2f')](function(_0xa90ade){for(var _0x35c67e=0x0,_0x365909=0x0;_0x35c67e<_0x29de9e['length'];_0x35c67e++,_0x365909=0x0){var _0x51ec39=_0x29de9e[_0x35c67e];var _0x5abffb=[];var _0x5c3fe4=[];delete _0x51ec39['id'];if(_0x51ec39[_0x8e00('0x30')]!==_0x8e00('0x31')){_0x51ec39[_0x8e00('0x32')]=[_0x51ec39[_0x8e00('0x30')]];}else{_0x51ec39['intervals']=_0x51ec39[_0x8e00('0x33')]?_[_0x8e00('0x34')](_[_0x8e00('0x35')](_0xa90ade,{'IntervalId':_0x51ec39[_0x8e00('0x33')]}),_0x8e00('0x30')):[];}_0x51ec39[_0x8e00('0x5')]=_0x93f17e[_0x8e00('0x5')];_0x51ec39[_0x8e00('0x6')]=_0x93f17e[_0x8e00('0x6')];if(_0x51ec39['type'])_0x51ec39[_0x8e00('0x3')]=_0x51ec39[_0x8e00('0x3')][_0x8e00('0x36')]();if(_0x93f17e[_0x8e00('0x3')]===_0x8e00('0x11')){if(_0x51ec39[_0x8e00('0x1a')](_0x8e00('0x37'))&&_0x51ec39[_0x8e00('0x37')]&&_0x51ec39[_0x8e00('0x37')]!=='--'){_0x5abffb[_0x8e00('0xc')]({'type':_0x51ec39[_0x8e00('0x3')]['toLowerCase'](),'app':_0x8e00('0x4'),'appdata':'CDR(tag)='+_0x51ec39[_0x8e00('0x37')],'context':_0x93f17e[_0x8e00('0x5')],'exten':_0x93f17e[_0x8e00('0x6')],'priority':_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')]+_0x3727ea+_0x365909++,'VoiceExtensionId':_0x93f17e['id']});}_0x5abffb['push']({'type':_0x51ec39[_0x8e00('0x3')][_0x8e00('0x36')](),'app':_0x8e00('0x14'),'appdata':_0x8e00('0x38')+(_0x51ec39['callerID']?_0x8e00('0x39')+_0x51ec39[_0x8e00('0x3a')]+')':_0x8e00('0x3b')),'context':_0x93f17e[_0x8e00('0x5')],'exten':_0x93f17e[_0x8e00('0x6')],'priority':_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')]+_0x3727ea+_0x365909++,'VoiceExtensionId':_0x93f17e['id']});}else{if(_0x51ec39[_0x8e00('0x1a')](_0x8e00('0x3c'))){if([_0x8e00('0x3d'),_0x8e00('0x3e')]['includes'](_0x51ec39[_0x8e00('0x3f')][_0x8e00('0x36')]())&&_0x51ec39[_0x8e00('0x40')]!==_0x8e00('0x41')){if(_0x51ec39[_0x8e00('0x3c')]){_0x5abffb[_0x8e00('0xc')]({'type':_0x51ec39[_0x8e00('0x3')][_0x8e00('0x36')](),'app':_0x8e00('0x14'),'appdata':_0x8e00('0x42'),'context':_0x93f17e['context'],'exten':_0x93f17e[_0x8e00('0x6')],'priority':_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')]+_0x3727ea+_0x365909++,'VoiceExtensionId':_0x93f17e['id']});_0x5abffb[_0x8e00('0xc')]({'type':_0x51ec39['type'][_0x8e00('0x36')](),'app':_0x8e00('0x4'),'appdata':_0x8e00('0x43'),'context':_0x93f17e[_0x8e00('0x5')],'exten':_0x93f17e['exten'],'priority':_0x51ec39[_0x8e00('0x32')]['length']+_0x3727ea+_0x365909++,'VoiceExtensionId':_0x93f17e['id']});}else{_0x5abffb[_0x8e00('0xc')]({'type':_0x51ec39[_0x8e00('0x3')][_0x8e00('0x36')](),'app':_0x8e00('0x14'),'appdata':_0x8e00('0x44'),'context':_0x93f17e[_0x8e00('0x5')],'exten':_0x93f17e[_0x8e00('0x6')],'priority':_0x51ec39[_0x8e00('0x32')]['length']+_0x3727ea+_0x365909++,'VoiceExtensionId':_0x93f17e['id']});_0x5abffb[_0x8e00('0xc')]({'type':_0x51ec39['type']['toLowerCase'](),'app':_0x8e00('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x93f17e['context'],'exten':_0x93f17e[_0x8e00('0x6')],'priority':_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')]+_0x3727ea+_0x365909++,'VoiceExtensionId':_0x93f17e['id']});}}}}for(var _0x2edfb4=0x0;_0x2edfb4<_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')];_0x2edfb4++){var _0x4b3d97=_0x3727ea+_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')];var _0x399814=_0x2edfb4===_0x51ec39[_0x8e00('0x32')][_0x8e00('0x24')]-0x1?_0x3727ea+_0x5abffb['length']+_0x5c3fe4[_0x8e00('0x24')]+0x2:_0x3727ea+_0x2edfb4+0x1;_0x5abffb[_0x8e00('0x45')](_0x2edfb4,0x0,{'type':_0x93f17e[_0x8e00('0x3')],'app':_0x8e00('0x46'),'appdata':_0x51ec39[_0x8e00('0x32')][_0x2edfb4]+'?'+_0x93f17e[_0x8e00('0x5')]+_0x8e00('0x47')+_0x4b3d97+':'+_0x93f17e[_0x8e00('0x5')]+_0x8e00('0x47')+_0x399814,'exten':_0x93f17e[_0x8e00('0x6')],'context':_0x93f17e[_0x8e00('0x5')],'priority':_0x3727ea+_0x2edfb4,'VoiceExtensionId':_0x93f17e['id']});}if(_0x51ec39[_0x8e00('0x40')]===_0x8e00('0x48'))_0x51ec39[_0x8e00('0x49')]=_0x122e46(_0x93f17e,_0x51ec39[_0x8e00('0x49')]);_0x51ec39[_0x8e00('0x4a')]=_0x5abffb[_0x8e00('0x24')]?_[_0x8e00('0x4b')](_0x5abffb)[_0x8e00('0x4a')]+0x1:_0x3727ea;_0x588c57=_[_0x8e00('0x4c')](_0x588c57,_0x5abffb,[_0x51ec39],_0x5c3fe4);_0x3727ea=_['last'](_0x588c57)[_0x8e00('0x4a')]+0x1;}return _0x37bf60(_0x588c57);})['catch'](function(_0x334532){_0x4289c7(_0x334532);});});}return _0x38d153['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x18fa37){var _0x533be7=this[_0x8e00('0x4d')]({'plain':!![]});var _0x2ffa02=_0x533be7[_0x8e00('0x3')]==='outbound'?_0x5977e0(_0x533be7):_0x5d8b6a(_0x533be7);return _0x3d8b75(_0x533be7,_0x18fa37,_[_0x8e00('0x4b')](_0x2ffa02)['priority']+0x1)[_0x8e00('0x2f')](function(_0x33c51e){var _0xe237ff=_[_0x8e00('0x4c')](_0x2ffa02,_0x33c51e);_0xe237ff[_0x8e00('0xc')]({'type':_0x533be7[_0x8e00('0x3')],'app':_0x8e00('0x4e'),'exten':_0x533be7['exten'],'context':_0x533be7[_0x8e00('0x5')],'priority':_['last'](_0xe237ff)[_0x8e00('0x4a')]+0x1,'VoiceExtensionId':_0x533be7['id']});return _0xe237ff;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3488e4a..7329de9 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 _0xe0ae=['where','attributes','include','map','model','GetVoiceExtension','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','findAll','options','raw'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe0ae[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee0a('0x0'));var BPromise=require(_0xee0a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee0a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('rpc');var config=require(_0xee0a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee0a('0x6')]({'port':0x232a});config[_0xee0a('0x7')]=_[_0xee0a('0x8')](config[_0xee0a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xee0a('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xee0a('0xa')](socket);function respondWithRpcPromise(_0x3d0b3f,_0xbd4483,_0x57d190){return new BPromise(function(_0x3bc0cf,_0x1a953e){return client['request'](_0x3d0b3f,_0x57d190)[_0xee0a('0xb')](function(_0x4b3e49){logger[_0xee0a('0xc')](_0xee0a('0xd'),_0xbd4483,'request\x20sent');logger[_0xee0a('0xe')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xbd4483,_0xee0a('0xf'),JSON[_0xee0a('0x10')](_0x4b3e49));if(_0x4b3e49['error']){if(_0x4b3e49['error'][_0xee0a('0x11')]===0x1f4){logger[_0xee0a('0x12')](_0xee0a('0xd'),_0xbd4483,_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);return _0x1a953e(_0x4b3e49['error'][_0xee0a('0x13')]);}logger[_0xee0a('0x12')]('VoiceExtension,\x20%s,\x20%s',_0xbd4483,_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);return _0x3bc0cf(_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);}else{logger['info'](_0xee0a('0xd'),_0xbd4483,_0xee0a('0xf'));_0x3bc0cf(_0x4b3e49[_0xee0a('0x14')]['message']);}})[_0xee0a('0x15')](function(_0x1ffdb5){logger[_0xee0a('0x12')](_0xee0a('0xd'),_0xbd4483,_0x1ffdb5);_0x1a953e(_0x1ffdb5);});});}exports['GetVoiceExtension']=function(_0xe9d5d4){var _0x10c224=this;return new Promise(function(_0x452d97,_0x201d32){return db['VoiceExtension'][_0xee0a('0x16')]({'raw':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x18')]===undefined?!![]:![]:!![],'where':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x19')]||null:null,'attributes':_0xe9d5d4['options']?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x1a')]||null:null,'limit':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')]['limit']||null:null,'include':_0xe9d5d4[_0xee0a('0x17')]?_0xe9d5d4[_0xee0a('0x17')][_0xee0a('0x1b')]?_[_0xee0a('0x1c')](_0xe9d5d4['options']['include'],function(_0x578ecf){return{'model':db[_0x578ecf[_0xee0a('0x1d')]],'as':_0x578ecf['as'],'attributes':_0x578ecf['attributes'],'include':_0x578ecf['include']?_[_0xee0a('0x1c')](_0x578ecf[_0xee0a('0x1b')],function(_0xe5365f){return{'model':db[_0xe5365f['model']],'as':_0xe5365f['as'],'attributes':_0xe5365f[_0xee0a('0x1a')],'include':_0xe5365f[_0xee0a('0x1b')]?_[_0xee0a('0x1c')](_0xe5365f[_0xee0a('0x1b')],function(_0x2e7f18){return{'model':db[_0x2e7f18[_0xee0a('0x1d')]],'as':_0x2e7f18['as'],'attributes':_0x2e7f18[_0xee0a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xb')](function(_0x65e054){logger[_0xee0a('0xc')]('GetVoiceExtension',_0xe9d5d4);logger[_0xee0a('0xe')](_0xee0a('0x1e'),_0xe9d5d4,JSON[_0xee0a('0x10')](_0x65e054));_0x452d97(_0x65e054);})[_0xee0a('0x15')](function(_0x45feeb){logger[_0xee0a('0x12')]('GetVoiceExtension',_0x45feeb[_0xee0a('0x13')],_0xe9d5d4);_0x201d32(_0x10c224[_0xee0a('0x12')](0x1f4,_0x45feeb[_0xee0a('0x13')]));});});}; \ No newline at end of file +var _0xb242=['defaults','localhost','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','model','attributes','GetVoiceExtension','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis'];(function(_0x4f4b56,_0x248ae9){var _0x10d809=function(_0x4a90ee){while(--_0x4a90ee){_0x4f4b56['push'](_0x4f4b56['shift']());}};_0x10d809(++_0x248ae9);}(_0xb242,0x1f3));var _0x2b24=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xb242[_0x3f25b2];return _0xd8caeb;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var moment=require(_0x2b24('0x1'));var BPromise=require(_0x2b24('0x2'));var rs=require(_0x2b24('0x3'));var fs=require('fs');var Redis=require(_0x2b24('0x4'));var db=require(_0x2b24('0x5'))['db'];var utils=require(_0x2b24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b24('0x7'));var jayson=require(_0x2b24('0x8'));var client=jayson['client'][_0x2b24('0x9')]({'port':0x232a});config[_0x2b24('0xa')]=_[_0x2b24('0xb')](config['redis'],{'host':_0x2b24('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b24('0xa')]));require(_0x2b24('0xd'))['register'](socket);function respondWithRpcPromise(_0x280030,_0x56dd79,_0x24efd2){return new BPromise(function(_0x12a5cb,_0x5e219d){return client['request'](_0x280030,_0x24efd2)[_0x2b24('0xe')](function(_0x4ab047){logger[_0x2b24('0xf')](_0x2b24('0x10'),_0x56dd79,_0x2b24('0x11'));logger[_0x2b24('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x56dd79,'request\x20sent',JSON[_0x2b24('0x13')](_0x4ab047));if(_0x4ab047[_0x2b24('0x14')]){if(_0x4ab047[_0x2b24('0x14')][_0x2b24('0x15')]===0x1f4){logger[_0x2b24('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x56dd79,_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);return _0x5e219d(_0x4ab047['error'][_0x2b24('0x16')]);}logger[_0x2b24('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x56dd79,_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);return _0x12a5cb(_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);}else{logger['info'](_0x2b24('0x10'),_0x56dd79,_0x2b24('0x11'));_0x12a5cb(_0x4ab047[_0x2b24('0x17')]['message']);}})[_0x2b24('0x18')](function(_0xa45843){logger[_0x2b24('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x56dd79,_0xa45843);_0x5e219d(_0xa45843);});});}exports['GetVoiceExtension']=function(_0x30f993){var _0x271827=this;return new Promise(function(_0xb6e4f8,_0x357596){return db['VoiceExtension'][_0x2b24('0x19')]({'raw':_0x30f993[_0x2b24('0x1a')]?_0x30f993[_0x2b24('0x1a')][_0x2b24('0x1b')]===undefined?!![]:![]:!![],'where':_0x30f993['options']?_0x30f993['options'][_0x2b24('0x1c')]||null:null,'attributes':_0x30f993['options']?_0x30f993['options']['attributes']||null:null,'limit':_0x30f993['options']?_0x30f993[_0x2b24('0x1a')][_0x2b24('0x1d')]||null:null,'include':_0x30f993[_0x2b24('0x1a')]?_0x30f993[_0x2b24('0x1a')]['include']?_['map'](_0x30f993['options'][_0x2b24('0x1e')],function(_0x20801c){return{'model':db[_0x20801c[_0x2b24('0x1f')]],'as':_0x20801c['as'],'attributes':_0x20801c[_0x2b24('0x20')],'include':_0x20801c['include']?_['map'](_0x20801c[_0x2b24('0x1e')],function(_0x3bd10a){return{'model':db[_0x3bd10a['model']],'as':_0x3bd10a['as'],'attributes':_0x3bd10a['attributes'],'include':_0x3bd10a[_0x2b24('0x1e')]?_['map'](_0x3bd10a['include'],function(_0x2a9a05){return{'model':db[_0x2a9a05[_0x2b24('0x1f')]],'as':_0x2a9a05['as'],'attributes':_0x2a9a05[_0x2b24('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2b24('0xe')](function(_0x4e6991){logger[_0x2b24('0xf')]('GetVoiceExtension',_0x30f993);logger[_0x2b24('0x12')](_0x2b24('0x21'),_0x30f993,JSON[_0x2b24('0x13')](_0x4e6991));_0xb6e4f8(_0x4e6991);})[_0x2b24('0x18')](function(_0x316253){logger[_0x2b24('0x14')](_0x2b24('0x21'),_0x316253[_0x2b24('0x16')],_0x30f993);_0x357596(_0x271827[_0x2b24('0x14')](0x1f4,_0x316253[_0x2b24('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 79849e5..49fdccc 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1a488d,_0x38264b){var _0x5515d5=function(_0x3d50be){while(--_0x3d50be){_0x1a488d['push'](_0x1a488d['shift']());}};_0x5515d5(++_0x38264b);}(_0x53ec,0x192));var _0xc53e=function(_0x415260,_0x135fcb){_0x415260=_0x415260-0x0;var _0x490f21=_0x53ec[_0x415260];return _0x490f21;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1b721f,_0xeaebe4){_0x1b721f=_0x1b721f-0x0;var _0x366333=_0x1cb9[_0x1b721f];return _0x366333;};'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 caa4be5..94de276 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 _0xf072=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy'];(function(_0x381ea4,_0x104e0d){var _0x471c9f=function(_0x3468e9){while(--_0x3468e9){_0x381ea4['push'](_0x381ea4['shift']());}};_0x471c9f(++_0x104e0d);}(_0xf072,0x1cf));var _0x2f07=function(_0x21ccce,_0x8cf90d){_0x21ccce=_0x21ccce-0x0;var _0x1d2351=_0xf072[_0x21ccce];return _0x1d2351;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0xf')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x10')]);router['put'](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f07('0x13')]);module[_0x2f07('0x14')]=router; \ No newline at end of file +var _0xa6b0=['post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x222dc8,_0x5b78cc){var _0x39c25b=function(_0x2902d2){while(--_0x2902d2){_0x222dc8['push'](_0x222dc8['shift']());}};_0x39c25b(++_0x5b78cc);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x44af3a,_0x1fa781){_0x44af3a=_0x44af3a-0x0;var _0x10c37f=_0xa6b0[_0x44af3a];return _0x10c37f;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x0a6b('0xe')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);router[_0x0a6b('0x12')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x13')]);module[_0x0a6b('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 b7972b9..d6b0824 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 _0x00d0=['yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','trim','central'];(function(_0x1be9f2,_0x174438){var _0x215fd6=function(_0x166cfb){while(--_0x166cfb){_0x1be9f2['push'](_0x1be9f2['shift']());}};_0x215fd6(++_0x174438);}(_0x00d0,0x169));var _0x000d=function(_0x2aa1d8,_0x23e357){_0x2aa1d8=_0x2aa1d8-0x0;var _0x201e5c=_0x00d0[_0x2aa1d8];return _0x201e5c;};'use strict';var Sequelize=require('sequelize');module[_0x000d('0x0')]={'customer_id':{'type':Sequelize[_0x000d('0x1')]},'context':{'type':Sequelize[_0x000d('0x1')],'defaultValue':_0x000d('0x2'),'unique':_0x000d('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x000d('0x3')},'password':{'type':Sequelize[_0x000d('0x1')]},'fullname':{'type':Sequelize[_0x000d('0x1')]},'email':{'type':Sequelize[_0x000d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x322b94){this['setDataValue'](_0x000d('0x4'),typeof _0x322b94==='string'&&_0x322b94['trim']()?_0x322b94[_0x000d('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x000d('0x6')},'attach':{'type':Sequelize['ENUM'](_0x000d('0x7'),'no'),'defaultValue':_0x000d('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x000d('0x1')]},'callback':{'type':Sequelize[_0x000d('0x1')]},'review':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x000d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x000d('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x000d('0x7'),'no'),'defaultValue':_0x000d('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x000d('0x8')](_0x000d('0x7'),'no'),'defaultValue':_0x000d('0x7'),'allowNull':![]},'stamp':{'type':_0x000d('0xa')},'emailsubject':{'type':Sequelize[_0x000d('0x1')]},'emailbody':{'type':Sequelize[_0x000d('0x1')]},'maxsecs':{'type':Sequelize[_0x000d('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x000d('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x000d('0xc')],'get':function(){return this[_0x000d('0xd')]('fullname')+_0x000d('0xe')+this[_0x000d('0xd')](_0x000d('0xf'));}}}; \ No newline at end of file +var _0xdc6a=['VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x58121f,_0x3b3c32){var _0x2708d1=function(_0x16d89f){while(--_0x16d89f){_0x58121f['push'](_0x58121f['shift']());}};_0x2708d1(++_0x3b3c32);}(_0xdc6a,0xaf));var _0xadc6=function(_0x5c54c2,_0x7f25e0){_0x5c54c2=_0x5c54c2-0x0;var _0x304b2d=_0xdc6a[_0x5c54c2];return _0x304b2d;};'use strict';var Sequelize=require('sequelize');module[_0xadc6('0x0')]={'customer_id':{'type':Sequelize[_0xadc6('0x1')]},'context':{'type':Sequelize[_0xadc6('0x1')],'defaultValue':_0xadc6('0x2'),'unique':_0xadc6('0x3')},'mailbox':{'type':Sequelize[_0xadc6('0x1')],'defaultValue':'','allowNull':![],'unique':_0xadc6('0x3')},'password':{'type':Sequelize[_0xadc6('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xadc6('0x1')],'validate':{'isEmail':!![]},'set':function(_0x10c63d){this[_0xadc6('0x4')](_0xadc6('0x5'),typeof _0x10c63d==='string'&&_0x10c63d[_0xadc6('0x6')]()?_0x10c63d[_0xadc6('0x6')]():null);}},'pager':{'type':Sequelize[_0xadc6('0x1')]},'tz':{'type':Sequelize[_0xadc6('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xadc6('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xadc6('0x8')](_0xadc6('0x7'),'no'),'defaultValue':_0xadc6('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xadc6('0x1')]},'review':{'type':Sequelize['ENUM'](_0xadc6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xadc6('0x8')](_0xadc6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xadc6('0x8')](_0xadc6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xadc6('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xadc6('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xadc6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xadc6('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xadc6('0x8')](_0xadc6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xadc6('0x8')](_0xadc6('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xadc6('0x8')](_0xadc6('0x7'),'no'),'defaultValue':_0xadc6('0x7'),'allowNull':![]},'stamp':{'type':_0xadc6('0xa')},'emailsubject':{'type':Sequelize[_0xadc6('0x1')]},'emailbody':{'type':Sequelize[_0xadc6('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xadc6('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xadc6('0xc')],'get':function(){return this['getDataValue'](_0xadc6('0xd'))+_0xadc6('0xe')+this[_0xadc6('0xf')](_0xadc6('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 97609be..b1e0114 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 _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x55734b,_0xa48bbd){var _0x39fef4=function(_0x1e440f){while(--_0x1e440f){_0x55734b['push'](_0x55734b['shift']());}};_0x39fef4(++_0xa48bbd);}(_0x34b7,0x196));var _0x734b=function(_0x390143,_0x2b54ac){_0x390143=_0x390143-0x0;var _0x11361b=_0x34b7[_0x390143];return _0x11361b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file +var _0xb9a7=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','findOne','VoiceMailMessage','rawAttributes','nolimit','findAndCountAll','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type'];(function(_0x1f0ce9,_0x4e3353){var _0x2c2d34=function(_0x5eefd2){while(--_0x5eefd2){_0x1f0ce9['push'](_0x1f0ce9['shift']());}};_0x2c2d34(++_0x4e3353);}(_0xb9a7,0x112));var _0x7b9a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb9a7[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){var _0x5b2f52=_0x269c07[_0x7b9a('0x20')]({'plain':!![]});var _0x23219e='Voicemails';return db[_0x7b9a('0x21')]['destroy']({'where':{'type':_0x23219e,'resourceId':_0x5b2f52['id']}})[_0x7b9a('0x1e')](function(){return _0x269c07;});})[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d886,_0x55301c){return function(_0x54df8a){if(!_0x54df8a){_0x24d886[_0x7b9a('0x22')](0x194);}return _0x54df8a;};}function handleError(_0x58fec8,_0x5be740){_0x5be740=_0x5be740||0x1f4;return function(_0x3847b4){logger['error'](_0x3847b4[_0x7b9a('0x23')]);if(_0x3847b4[_0x7b9a('0x24')]){delete _0x3847b4['name'];}_0x58fec8[_0x7b9a('0x14')](_0x5be740)[_0x7b9a('0x25')](_0x3847b4);};}exports[_0x7b9a('0x26')]=function(_0x5b64d7,_0x45ccf5){var _0x2ce78b={},_0x181e9c={},_0x6c8b1f={'count':0x0,'rows':[]};var _0x5028e7=_[_0x7b9a('0x27')](db['VoiceMail']['rawAttributes'],function(_0x2d278e){return{'name':_0x2d278e[_0x7b9a('0x28')],'type':_0x2d278e[_0x7b9a('0x29')]['key']};});_0x181e9c[_0x7b9a('0x2a')]=_[_0x7b9a('0x27')](_0x5028e7,'name');_0x181e9c['query']=_[_0x7b9a('0x2b')](_0x5b64d7[_0x7b9a('0x2c')]);_0x181e9c['filters']=_[_0x7b9a('0x2d')](_0x181e9c[_0x7b9a('0x2a')],_0x181e9c[_0x7b9a('0x2c')]);_0x2ce78b[_0x7b9a('0x2e')]=_[_0x7b9a('0x2d')](_0x181e9c['model'],qs[_0x7b9a('0x2f')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x2ce78b[_0x7b9a('0x2e')]=_0x2ce78b[_0x7b9a('0x2e')][_0x7b9a('0x30')]?_0x2ce78b['attributes']:_0x181e9c['model'];if(!_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x31')]('nolimit')){_0x2ce78b[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x5b64d7[_0x7b9a('0x2c')]['limit']);_0x2ce78b[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x5b64d7['query']['offset']);}_0x2ce78b[_0x7b9a('0x32')]=qs[_0x7b9a('0x33')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x33')]);_0x2ce78b[_0x7b9a('0x34')]=qs[_0x7b9a('0x35')](_[_0x7b9a('0x36')](_0x5b64d7[_0x7b9a('0x2c')],_0x181e9c['filters']),_0x5028e7);if(_0x5b64d7[_0x7b9a('0x2c')]['filter']){_0x2ce78b[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x2ce78b[_0x7b9a('0x34')],{'$or':_[_0x7b9a('0x27')](_0x5028e7,function(_0x3fa4cd){if(_0x3fa4cd[_0x7b9a('0x29')]!=='VIRTUAL'){var _0x34eebe={};_0x34eebe[_0x3fa4cd[_0x7b9a('0x24')]]={'$like':'%'+_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x34eebe;}})});}_0x2ce78b=_['merge']({},_0x2ce78b,_0x5b64d7[_0x7b9a('0x39')]);var _0xf86939={'where':_0x2ce78b[_0x7b9a('0x34')]};return db[_0x7b9a('0x3a')]['count'](_0xf86939)[_0x7b9a('0x1e')](function(_0x53d89a){_0x6c8b1f[_0x7b9a('0x19')]=_0x53d89a;if(_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x3b')]){_0x2ce78b[_0x7b9a('0x3c')]=[{'all':!![]}];}return db[_0x7b9a('0x3a')][_0x7b9a('0x3d')](_0x2ce78b);})['then'](function(_0x33edc6){_0x6c8b1f[_0x7b9a('0x3e')]=_0x33edc6;return _0x6c8b1f;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x45ccf5,_0x2ce78b))['catch'](handleError(_0x45ccf5,null));};exports['show']=function(_0x3724fe,_0x454b35){var _0x995d59={'raw':!![],'where':{'id':_0x3724fe[_0x7b9a('0x3f')]['id']}},_0x5cd3dd={};_0x5cd3dd[_0x7b9a('0x2a')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x5cd3dd[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x3724fe['query']);_0x5cd3dd[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0x5cd3dd[_0x7b9a('0x2a')],_0x5cd3dd['query']);_0x995d59[_0x7b9a('0x2e')]=_['intersection'](_0x5cd3dd[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x3724fe[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x995d59[_0x7b9a('0x2e')]=_0x995d59['attributes'][_0x7b9a('0x30')]?_0x995d59['attributes']:_0x5cd3dd[_0x7b9a('0x2a')];if(_0x3724fe['query']['includeAll']){_0x995d59[_0x7b9a('0x3c')]=[{'all':!![]}];}_0x995d59=_[_0x7b9a('0x37')]({},_0x995d59,_0x3724fe[_0x7b9a('0x39')]);return db[_0x7b9a('0x3a')][_0x7b9a('0x40')](_0x995d59)[_0x7b9a('0x1e')](handleEntityNotFound(_0x454b35,null))[_0x7b9a('0x1e')](respondWithResult(_0x454b35,null))[_0x7b9a('0x41')](handleError(_0x454b35,null));};exports[_0x7b9a('0x42')]=function(_0x5088c7,_0x1d7957){return db[_0x7b9a('0x3a')]['create'](_0x5088c7['body'],{})['then'](function(_0x1b3e65){var _0x30296e=_0x5088c7[_0x7b9a('0x43')][_0x7b9a('0x20')]({'plain':!![]});if(!_0x30296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30296e[_0x7b9a('0x44')]===_0x7b9a('0x43')){var _0x287dea=_0x1b3e65[_0x7b9a('0x20')]({'plain':!![]});var _0x2d083b='Voicemails';return db[_0x7b9a('0x45')]['find']({'where':{'name':_0x2d083b,'userProfileId':_0x30296e[_0x7b9a('0x46')]},'raw':!![]})[_0x7b9a('0x1e')](function(_0x239146){if(_0x239146&&_0x239146[_0x7b9a('0x47')]===0x0){return db['UserProfileResource'][_0x7b9a('0x42')]({'name':_0x287dea[_0x7b9a('0x24')],'resourceId':_0x287dea['id'],'type':_0x239146[_0x7b9a('0x24')],'sectionId':_0x239146['id']},{})[_0x7b9a('0x1e')](function(){return _0x1b3e65;});}else{return _0x1b3e65;}})[_0x7b9a('0x41')](function(_0x3e2f1b){logger[_0x7b9a('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2f1b);throw _0x3e2f1b;});}return _0x1b3e65;})['then'](respondWithResult(_0x1d7957,0xc9))['catch'](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1d')]=function(_0x2f8929,_0x5a1b7d){if(_0x2f8929['body']['id']){delete _0x2f8929['body']['id'];}return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x2f8929[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x5a1b7d,null))[_0x7b9a('0x1e')](saveUpdates(_0x2f8929[_0x7b9a('0x49')],null))[_0x7b9a('0x1e')](respondWithResult(_0x5a1b7d,null))[_0x7b9a('0x41')](handleError(_0x5a1b7d,null));};exports[_0x7b9a('0x1f')]=function(_0x5dc17e,_0x1f99f5){return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x5dc17e[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1f99f5,null))[_0x7b9a('0x1e')](removeEntity(_0x1f99f5,null))[_0x7b9a('0x41')](handleError(_0x1f99f5,null));};exports['getMessages']=function(_0x25ec82,_0x491804,_0x3d2df4){return db[_0x7b9a('0x3a')][_0x7b9a('0x4a')]({'where':{'id':_0x25ec82['params']['id']}})['then'](handleEntityNotFound(_0x491804,null))['then'](function(_0x4f6843){var _0x33375c;var _0x8a777f={},_0xb91099={};_0xb91099['model']=_[_0x7b9a('0x2b')](db[_0x7b9a('0x4b')][_0x7b9a('0x4c')]);_0xb91099[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x25ec82['query']);_0xb91099[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0xb91099[_0x7b9a('0x2a')],_0xb91099['query']);_0x8a777f['attributes']=_['intersection'](_0xb91099[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x25ec82[_0x7b9a('0x2c')]['fields']));_0x8a777f[_0x7b9a('0x2e')]=_0x8a777f[_0x7b9a('0x2e')]['length']?_0x8a777f[_0x7b9a('0x2e')]:_0xb91099['model'];if(!_0x25ec82[_0x7b9a('0x2c')]['hasOwnProperty'](_0x7b9a('0x4d'))){_0x8a777f[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x25ec82[_0x7b9a('0x2c')]['limit']);_0x8a777f[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x25ec82[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x8a777f['order']=qs[_0x7b9a('0x33')](_0x25ec82['query'][_0x7b9a('0x33')]);_0x8a777f['where']=qs[_0x7b9a('0x35')](_['pick'](_0x25ec82['query'],_0xb91099['filters']));if(_0x25ec82['query'][_0x7b9a('0x38')]){_0x8a777f[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'$or':_['map'](_0x8a777f[_0x7b9a('0x2e')],function(_0x4b9462){var _0x50b6f1={};_0x50b6f1[_0x4b9462]={'$like':'%'+_0x25ec82[_0x7b9a('0x2c')]['filter']+'%'};return _0x50b6f1;})});}_0x8a777f['where']=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'mailboxuser':_0x4f6843['mailbox']});_0x8a777f=_[_0x7b9a('0x37')]({},_0x8a777f,_0x25ec82['options']);return db[_0x7b9a('0x4b')][_0x7b9a('0x4e')](_0x8a777f)[_0x7b9a('0x1e')](respondWithFilteredResult(_0x491804,_0x8a777f));})['catch'](handleError(_0x491804,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a5a070d..4d644c2 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 _0xae14=['path','rimraf','../../config/environment','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c0fe2,_0x1838ed){var _0x4ff915=function(_0x280785){while(--_0x280785){_0x1c0fe2['push'](_0x1c0fe2['shift']());}};_0x4ff915(++_0x1838ed);}(_0xae14,0x78));var _0x4ae1=function(_0x160710,_0x250e9b){_0x160710=_0x160710-0x0;var _0x309b4b=_0xae14[_0x160710];return _0x309b4b;};'use strict';var _=require('lodash');var util=require(_0x4ae1('0x0'));var logger=require(_0x4ae1('0x1'))(_0x4ae1('0x2'));var moment=require(_0x4ae1('0x3'));var BPromise=require(_0x4ae1('0x4'));var rp=require(_0x4ae1('0x5'));var fs=require('fs');var path=require(_0x4ae1('0x6'));var rimraf=require(_0x4ae1('0x7'));var config=require(_0x4ae1('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x326be5,_0x2f4bef){return _0x326be5['define'](_0x4ae1('0x9'),attributes,{'tableName':_0x4ae1('0xa'),'paranoid':![],'indexes':[{'name':_0x4ae1('0xb'),'fields':[_0x4ae1('0xc'),_0x4ae1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5763=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x5a966c,_0x21654e){var _0x2cb5f8=function(_0x45d202){while(--_0x45d202){_0x5a966c['push'](_0x5a966c['shift']());}};_0x2cb5f8(++_0x21654e);}(_0x5763,0x10e));var _0x3576=function(_0x191828,_0x5c5de8){_0x191828=_0x191828-0x0;var _0x276a8d=_0x5763[_0x191828];return _0x276a8d;};'use strict';var _=require(_0x3576('0x0'));var util=require(_0x3576('0x1'));var logger=require(_0x3576('0x2'))(_0x3576('0x3'));var moment=require(_0x3576('0x4'));var BPromise=require('bluebird');var rp=require(_0x3576('0x5'));var fs=require('fs');var path=require(_0x3576('0x6'));var rimraf=require(_0x3576('0x7'));var config=require(_0x3576('0x8'));var attributes=require('./voiceMail.attributes');module[_0x3576('0x9')]=function(_0x271fd1,_0x32f13d){return _0x271fd1['define'](_0x3576('0xa'),attributes,{'tableName':_0x3576('0xb'),'paranoid':![],'indexes':[{'name':_0x3576('0xc'),'fields':[_0x3576('0xd'),_0x3576('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3e413b7..64a8d56 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 _0xf68c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x300e76,_0x5be27d){var _0x1384d5=function(_0x4d14c6){while(--_0x4d14c6){_0x300e76['push'](_0x300e76['shift']());}};_0x1384d5(++_0x5be27d);}(_0xf68c,0xc6));var _0xcf68=function(_0xfb42cc,_0x48caa1){_0xfb42cc=_0xfb42cc-0x0;var _0x9179ca=_0xf68c[_0xfb42cc];return _0x9179ca;};'use strict';var _=require(_0xcf68('0x0'));var util=require(_0xcf68('0x1'));var moment=require(_0xcf68('0x2'));var BPromise=require(_0xcf68('0x3'));var rs=require(_0xcf68('0x4'));var fs=require('fs');var Redis=require(_0xcf68('0x5'));var db=require(_0xcf68('0x6'))['db'];var utils=require(_0xcf68('0x7'));var logger=require(_0xcf68('0x8'))(_0xcf68('0x9'));var config=require(_0xcf68('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f976d,_0x2c7d26,_0x1e0adc){return new BPromise(function(_0x11cba3,_0x56c140){return client['request'](_0x2f976d,_0x1e0adc)['then'](function(_0x571a50){logger[_0xcf68('0xc')](_0xcf68('0xd'),_0x2c7d26,_0xcf68('0xe'));logger[_0xcf68('0xf')](_0xcf68('0x10'),_0x2c7d26,_0xcf68('0xe'),JSON['stringify'](_0x571a50));if(_0x571a50[_0xcf68('0x11')]){if(_0x571a50[_0xcf68('0x11')][_0xcf68('0x12')]===0x1f4){logger[_0xcf68('0x11')](_0xcf68('0xd'),_0x2c7d26,_0x571a50['error'][_0xcf68('0x13')]);return _0x56c140(_0x571a50['error']['message']);}logger['error'](_0xcf68('0xd'),_0x2c7d26,_0x571a50[_0xcf68('0x11')][_0xcf68('0x13')]);return _0x11cba3(_0x571a50['error'][_0xcf68('0x13')]);}else{logger[_0xcf68('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2c7d26,_0xcf68('0xe'));_0x11cba3(_0x571a50[_0xcf68('0x14')][_0xcf68('0x13')]);}})[_0xcf68('0x15')](function(_0x762e2b){logger['error'](_0xcf68('0xd'),_0x2c7d26,_0x762e2b);_0x56c140(_0x762e2b);});});} \ No newline at end of file +var _0x69a1=['http','request','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1eec1e,_0xa321f3){var _0x20d874=function(_0x576194){while(--_0x576194){_0x1eec1e['push'](_0x1eec1e['shift']());}};_0x20d874(++_0xa321f3);}(_0x69a1,0x17d));var _0x169a=function(_0x219d39,_0x3ec116){_0x219d39=_0x219d39-0x0;var _0x4d9be9=_0x69a1[_0x219d39];return _0x4d9be9;};'use strict';var _=require(_0x169a('0x0'));var util=require(_0x169a('0x1'));var moment=require('moment');var BPromise=require(_0x169a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x169a('0x3'));var db=require(_0x169a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x169a('0x5'))(_0x169a('0x6'));var config=require(_0x169a('0x7'));var jayson=require(_0x169a('0x8'));var client=jayson[_0x169a('0x9')][_0x169a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51a0f3,_0x125f02,_0x418e81){return new BPromise(function(_0x288568,_0x4ed112){return client[_0x169a('0xb')](_0x51a0f3,_0x418e81)[_0x169a('0xc')](function(_0x242acb){logger[_0x169a('0xd')](_0x169a('0xe'),_0x125f02,'request\x20sent');logger['debug'](_0x169a('0xf'),_0x125f02,'request\x20sent',JSON[_0x169a('0x10')](_0x242acb));if(_0x242acb[_0x169a('0x11')]){if(_0x242acb[_0x169a('0x11')][_0x169a('0x12')]===0x1f4){logger[_0x169a('0x11')](_0x169a('0xe'),_0x125f02,_0x242acb[_0x169a('0x11')][_0x169a('0x13')]);return _0x4ed112(_0x242acb['error']['message']);}logger[_0x169a('0x11')](_0x169a('0xe'),_0x125f02,_0x242acb['error']['message']);return _0x288568(_0x242acb[_0x169a('0x11')][_0x169a('0x13')]);}else{logger[_0x169a('0xd')](_0x169a('0xe'),_0x125f02,_0x169a('0x14'));_0x288568(_0x242acb[_0x169a('0x15')][_0x169a('0x13')]);}})[_0x169a('0x16')](function(_0x57a103){logger[_0x169a('0x11')](_0x169a('0xe'),_0x125f02,_0x57a103);_0x4ed112(_0x57a103);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index de1fa41..0052ac8 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 _0x1fd2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','show','/:id/download','isAuthenticated','download','post','create','put','/:id','delete','util'];(function(_0x9a5f6f,_0x5036be){var _0x3bdaee=function(_0x427107){while(--_0x427107){_0x9a5f6f['push'](_0x9a5f6f['shift']());}};_0x3bdaee(++_0x5036be);}(_0x1fd2,0x1af));var _0x21fd=function(_0x3780f2,_0xa99c19){_0x3780f2=_0x3780f2-0x0;var _0xa1deb8=_0x1fd2[_0x3780f2];return _0xa1deb8;};'use strict';var multer=require('multer');var util=require(_0x21fd('0x0'));var path=require(_0x21fd('0x1'));var timeout=require(_0x21fd('0x2'));var express=require(_0x21fd('0x3'));var router=express[_0x21fd('0x4')]();var fs_extra=require(_0x21fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x21fd('0x6'));var config=require(_0x21fd('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x21fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21fd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x21fd('0x9')]);router[_0x21fd('0x8')](_0x21fd('0xa'),auth[_0x21fd('0xb')](),controller[_0x21fd('0xc')]);router[_0x21fd('0xd')]('/',auth[_0x21fd('0xb')](),controller[_0x21fd('0xe')]);router[_0x21fd('0xf')](_0x21fd('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x21fd('0x11')](_0x21fd('0x10'),auth[_0x21fd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc1cc=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id/download','post','put','/:id','update','delete','destroy'];(function(_0x4f8897,_0x30f547){var _0x5b638c=function(_0x303508){while(--_0x303508){_0x4f8897['push'](_0x4f8897['shift']());}};_0x5b638c(++_0x30f547);}(_0xc1cc,0x169));var _0xcc1c=function(_0x30e4e3,_0x3d854a){_0x30e4e3=_0x30e4e3-0x0;var _0x37e107=_0xc1cc[_0x30e4e3];return _0x37e107;};'use strict';var multer=require(_0xcc1c('0x0'));var util=require(_0xcc1c('0x1'));var path=require('path');var timeout=require(_0xcc1c('0x2'));var express=require(_0xcc1c('0x3'));var router=express['Router']();var fs_extra=require(_0xcc1c('0x4'));var auth=require(_0xcc1c('0x5'));var interaction=require(_0xcc1c('0x6'));var config=require('../../config/environment');var controller=require(_0xcc1c('0x7'));router[_0xcc1c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcc1c('0x8')]('/:id',auth[_0xcc1c('0x9')](),controller['show']);router[_0xcc1c('0x8')](_0xcc1c('0xa'),auth[_0xcc1c('0x9')](),controller['download']);router[_0xcc1c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcc1c('0xc')](_0xcc1c('0xd'),auth[_0xcc1c('0x9')](),controller[_0xcc1c('0xe')]);router[_0xcc1c('0xf')](_0xcc1c('0xd'),auth[_0xcc1c('0x9')](),controller[_0xcc1c('0x10')]);module[_0xcc1c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 30ed195..470dbf8 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 _0xbdd4=['VIRTUAL','getDataValue','STRING','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports'];(function(_0xb230e4,_0x1ee46b){var _0x279a55=function(_0x55f19a){while(--_0x55f19a){_0xb230e4['push'](_0xb230e4['shift']());}};_0x279a55(++_0x1ee46b);}(_0xbdd4,0x125));var _0x4bdd=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xbdd4[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require('sequelize');module[_0x4bdd('0x0')]={'name':{'type':Sequelize[_0x4bdd('0x1')],'get':function(_0x1168ad){return this[_0x4bdd('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4bdd('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x4bdd('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x4bdd('0x5'),'defaultValue':Sequelize['literal'](_0x4bdd('0x6'))}}; \ No newline at end of file +var _0x1b4d=['STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x2523b0,_0x450793){var _0x39ec6d=function(_0x4a9fea){while(--_0x4a9fea){_0x2523b0['push'](_0x2523b0['shift']());}};_0x39ec6d(++_0x450793);}(_0x1b4d,0x1eb));var _0xd1b4=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x1b4d[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xd1b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1b4('0x1')],'get':function(_0xd69746){return this[_0xd1b4('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xd1b4('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xd1b4('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xd1b4('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd1b4('0x6'),'defaultValue':Sequelize[_0xd1b4('0x7')](_0xd1b4('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 89be8c4..db531a0 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 _0x3b6b=['limit','set','apply','reject','save','update','destroy','then','stack','name','send','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','nolimit','order','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','find','body','params','download','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x3b6b,0xcf));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb3b6('0x0'));var rimraf=require(_0xb3b6('0x1'));var zipdir=require(_0xb3b6('0x2'));var jsonpatch=require(_0xb3b6('0x3'));var rp=require(_0xb3b6('0x4'));var moment=require('moment');var BPromise=require(_0xb3b6('0x5'));var Mustache=require('mustache');var util=require(_0xb3b6('0x6'));var path=require(_0xb3b6('0x7'));var sox=require(_0xb3b6('0x8'));var csv=require(_0xb3b6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3b6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb3b6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3b6('0xc'));var toCsv=require(_0xb3b6('0x9'));var querystring=require(_0xb3b6('0xd'));var Papa=require('papaparse');var Redis=require(_0xb3b6('0xe'));var authService=require(_0xb3b6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3b6('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb3b6('0x11'));var config=require(_0xb3b6('0x12'));var licenseUtil=require(_0xb3b6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a374a,_0x35512a){_0x35512a=_0x35512a||0xcc;return function(_0x2fcd55){if(_0x2fcd55){return _0x2a374a[_0xb3b6('0x14')](_0x35512a);}return _0x2a374a[_0xb3b6('0x15')](_0x35512a)[_0xb3b6('0x16')]();};}function respondWithResult(_0x103d35,_0xac9a8f){_0xac9a8f=_0xac9a8f||0xc8;return function(_0x32e070){if(_0x32e070){return _0x103d35['status'](_0xac9a8f)[_0xb3b6('0x17')](_0x32e070);}};}function respondWithFilteredResult(_0x4494bd,_0x4e6af5){return function(_0x256c7c){if(_0x256c7c){var _0x4e272e=typeof _0x4e6af5[_0xb3b6('0x18')]===_0xb3b6('0x19')&&typeof _0x4e6af5['limit']===_0xb3b6('0x19');var _0x3ae19e=_0x256c7c[_0xb3b6('0x1a')];var _0x2c7630=_0x4e272e?0x0:_0x4e6af5['offset'];var _0x1e260b=_0x4e272e?_0x256c7c[_0xb3b6('0x1a')]:_0x4e6af5['offset']+_0x4e6af5[_0xb3b6('0x1b')];var _0x4a1d77;if(_0x1e260b>=_0x3ae19e){_0x1e260b=_0x3ae19e;_0x4a1d77=0xc8;}else{_0x4a1d77=0xce;}_0x4494bd[_0xb3b6('0x15')](_0x4a1d77);return _0x4494bd[_0xb3b6('0x1c')]('Content-Range',_0x2c7630+'-'+_0x1e260b+'/'+_0x3ae19e)['json'](_0x256c7c);}return null;};}function patchUpdates(_0x4c89d3){return function(_0x1a84ce){try{jsonpatch[_0xb3b6('0x1d')](_0x1a84ce,_0x4c89d3,!![]);}catch(_0x3ee4e3){return BPromise[_0xb3b6('0x1e')](_0x3ee4e3);}return _0x1a84ce[_0xb3b6('0x1f')]();};}function saveUpdates(_0x23de8b,_0x512ef8){return function(_0x6f24a2){if(_0x6f24a2){return _0x6f24a2[_0xb3b6('0x20')](_0x23de8b)['then'](function(_0x2575e4){return _0x2575e4;});}return null;};}function removeEntity(_0xe16cf7,_0x54bd2f){return function(_0x3a1be1){if(_0x3a1be1){return _0x3a1be1[_0xb3b6('0x21')]()[_0xb3b6('0x22')](function(){_0xe16cf7['status'](0xcc)[_0xb3b6('0x16')]();});}};}function handleEntityNotFound(_0x1a9c2b,_0x2747f8){return function(_0x222fbd){if(!_0x222fbd){_0x1a9c2b[_0xb3b6('0x14')](0x194);}return _0x222fbd;};}function handleError(_0x3a0115,_0xeef7d7){_0xeef7d7=_0xeef7d7||0x1f4;return function(_0x872168){logger['error'](_0x872168[_0xb3b6('0x23')]);if(_0x872168[_0xb3b6('0x24')]){delete _0x872168[_0xb3b6('0x24')];}_0x3a0115[_0xb3b6('0x15')](_0xeef7d7)[_0xb3b6('0x25')](_0x872168);};}exports['index']=function(_0x1ab88f,_0x3efa9e){var _0x30199e={},_0x177d3f={},_0x52ad07={'count':0x0,'rows':[]};var _0x2f4b08=_[_0xb3b6('0x26')](db[_0xb3b6('0x27')]['rawAttributes'],function(_0x171106){return{'name':_0x171106[_0xb3b6('0x28')],'type':_0x171106[_0xb3b6('0x29')][_0xb3b6('0x2a')]};});_0x177d3f['model']=_[_0xb3b6('0x2b')](_['map'](_0x2f4b08,_0xb3b6('0x24')),[_0xb3b6('0x24')]);_0x177d3f[_0xb3b6('0x2c')]=_['keys'](_0x1ab88f[_0xb3b6('0x2c')]);_0x177d3f[_0xb3b6('0x2d')]=_[_0xb3b6('0x2e')](_0x177d3f[_0xb3b6('0x2f')],_0x177d3f[_0xb3b6('0x2c')]);_0x30199e[_0xb3b6('0x30')]=_[_0xb3b6('0x2e')](_0x177d3f[_0xb3b6('0x2f')],qs[_0xb3b6('0x31')](_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x31')]));_0x30199e['attributes']=_0x30199e[_0xb3b6('0x30')]['length']?_0x30199e[_0xb3b6('0x30')]:_0x177d3f['model'];if(!_0x1ab88f['query']['hasOwnProperty'](_0xb3b6('0x32'))){_0x30199e[_0xb3b6('0x1b')]=qs[_0xb3b6('0x1b')](_0x1ab88f[_0xb3b6('0x2c')]['limit']);_0x30199e[_0xb3b6('0x18')]=qs[_0xb3b6('0x18')](_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x18')]);}_0x30199e[_0xb3b6('0x33')]=qs['sort'](_0x1ab88f[_0xb3b6('0x2c')]['sort']);_0x30199e['where']=qs[_0xb3b6('0x2d')](_[_0xb3b6('0x34')](_0x1ab88f[_0xb3b6('0x2c')],_0x177d3f['filters']),_0x2f4b08);if(_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x35')]){_0x30199e[_0xb3b6('0x36')]=_['merge'](_0x30199e[_0xb3b6('0x36')],{'$or':_[_0xb3b6('0x26')](_0x2f4b08,function(_0x585d71){if(_0x585d71[_0xb3b6('0x29')]!==_0xb3b6('0x37')){var _0x2e1891={};_0x2e1891[_0x585d71[_0xb3b6('0x24')]]={'$like':'%'+_0x1ab88f[_0xb3b6('0x2c')][_0xb3b6('0x35')]+'%'};return _0x2e1891;}})});}_0x30199e=_[_0xb3b6('0x38')]({},_0x30199e,_0x1ab88f[_0xb3b6('0x39')]);var _0x4b5595={'where':_0x30199e['where']};return db[_0xb3b6('0x27')]['count'](_0x4b5595)[_0xb3b6('0x22')](function(_0x347eb0){_0x52ad07[_0xb3b6('0x1a')]=_0x347eb0;if(_0x1ab88f['query']['includeAll']){_0x30199e[_0xb3b6('0x3a')]=[{'all':!![]}];}return db[_0xb3b6('0x27')][_0xb3b6('0x3b')](_0x30199e);})[_0xb3b6('0x22')](function(_0x1ef801){_0x52ad07[_0xb3b6('0x3c')]=_0x1ef801;return _0x52ad07;})[_0xb3b6('0x22')](respondWithFilteredResult(_0x3efa9e,_0x30199e))[_0xb3b6('0x3d')](handleError(_0x3efa9e,null));};exports[_0xb3b6('0x3e')]=function(_0x3b7c29,_0x210144){var _0x51391b={'raw':!![],'where':{'id':_0x3b7c29['params']['id']}},_0x28b57e={};_0x28b57e[_0xb3b6('0x2f')]=_[_0xb3b6('0x3f')](db[_0xb3b6('0x27')][_0xb3b6('0x40')]);_0x28b57e[_0xb3b6('0x2c')]=_[_0xb3b6('0x3f')](_0x3b7c29[_0xb3b6('0x2c')]);_0x28b57e[_0xb3b6('0x2d')]=_[_0xb3b6('0x2e')](_0x28b57e['model'],_0x28b57e['query']);_0x51391b['attributes']=_[_0xb3b6('0x2e')](_0x28b57e[_0xb3b6('0x2f')],qs[_0xb3b6('0x31')](_0x3b7c29[_0xb3b6('0x2c')][_0xb3b6('0x31')]));_0x51391b[_0xb3b6('0x30')]=_0x51391b['attributes'][_0xb3b6('0x41')]?_0x51391b[_0xb3b6('0x30')]:_0x28b57e[_0xb3b6('0x2f')];if(_0x3b7c29[_0xb3b6('0x2c')][_0xb3b6('0x42')]){_0x51391b[_0xb3b6('0x3a')]=[{'all':!![]}];}_0x51391b=_['merge']({},_0x51391b,_0x3b7c29['options']);return db[_0xb3b6('0x27')][_0xb3b6('0x43')](_0x51391b)['then'](handleEntityNotFound(_0x210144,null))[_0xb3b6('0x22')](respondWithResult(_0x210144,null))[_0xb3b6('0x3d')](handleError(_0x210144,null));};exports['create']=function(_0x363024,_0x576987){return db[_0xb3b6('0x27')]['create'](_0x363024[_0xb3b6('0x44')],{})['then'](respondWithResult(_0x576987,0xc9))['catch'](handleError(_0x576987,null));};exports[_0xb3b6('0x20')]=function(_0x14ab4f,_0x1ecb78){if(_0x14ab4f[_0xb3b6('0x44')]['id']){delete _0x14ab4f[_0xb3b6('0x44')]['id'];}return db[_0xb3b6('0x27')][_0xb3b6('0x43')]({'where':{'id':_0x14ab4f[_0xb3b6('0x45')]['id']}})[_0xb3b6('0x22')](handleEntityNotFound(_0x1ecb78,null))[_0xb3b6('0x22')](saveUpdates(_0x14ab4f[_0xb3b6('0x44')],null))[_0xb3b6('0x22')](respondWithResult(_0x1ecb78,null))['catch'](handleError(_0x1ecb78,null));};exports[_0xb3b6('0x21')]=function(_0x86d71,_0x2b42c9){return db[_0xb3b6('0x27')][_0xb3b6('0x43')]({'where':{'id':_0x86d71[_0xb3b6('0x45')]['id']}})[_0xb3b6('0x22')](handleEntityNotFound(_0x2b42c9,null))['then'](removeEntity(_0x2b42c9,null))[_0xb3b6('0x3d')](handleError(_0x2b42c9,null));};exports[_0xb3b6('0x46')]=function(_0x4a92fb,_0x3d7dbc,_0x3e741b){return db[_0xb3b6('0x27')][_0xb3b6('0x43')]({'where':{'id':_0x4a92fb[_0xb3b6('0x45')]['id']},'attributes':['id','recording','msg_id']})[_0xb3b6('0x22')](handleEntityNotFound(_0x3d7dbc,null))[_0xb3b6('0x22')](function(_0xfd6d49){if(_0xfd6d49){if(!_0xfd6d49['recording']){throw new db['Sequelize'][(_0xb3b6('0x47'))](_0xb3b6('0x48'));}var _0x7db319={'Content-Type':_0xb3b6('0x49'),'Content-Disposition':'attachment'};if(_0xfd6d49[_0xb3b6('0x4a')]){_0x7db319[_0xb3b6('0x4b')]=_0xb3b6('0x4c')+_0xfd6d49[_0xb3b6('0x4a')]+_0xb3b6('0x4d');}_0x3d7dbc['set'](_0x7db319);return _0x3d7dbc[_0xb3b6('0x25')](new Buffer(_0xfd6d49['recording']));}})[_0xb3b6('0x3d')](handleError(_0x3d7dbc,null));}; \ No newline at end of file +var _0x420b=['status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','catch','params','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1a8ca6,_0x2868bb){var _0x993297=function(_0x3ab545){while(--_0x3ab545){_0x1a8ca6['push'](_0x1a8ca6['shift']());}};_0x993297(++_0x2868bb);}(_0x420b,0x141));var _0xb420=function(_0x1dbd93,_0x5d5f30){_0x1dbd93=_0x1dbd93-0x0;var _0x2a551b=_0x420b[_0x1dbd93];return _0x2a551b;};'use strict';var emlformat=require(_0xb420('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb420('0x1'));var jsonpatch=require(_0xb420('0x2'));var rp=require(_0xb420('0x3'));var moment=require(_0xb420('0x4'));var BPromise=require(_0xb420('0x5'));var Mustache=require(_0xb420('0x6'));var util=require(_0xb420('0x7'));var path=require(_0xb420('0x8'));var sox=require(_0xb420('0x9'));var csv=require(_0xb420('0xa'));var ejs=require(_0xb420('0xb'));var fs=require('fs');var fs_extra=require(_0xb420('0xc'));var _=require(_0xb420('0xd'));var squel=require(_0xb420('0xe'));var crypto=require('crypto');var jsforce=require(_0xb420('0xf'));var deskjs=require(_0xb420('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb420('0x11'));var Papa=require(_0xb420('0x12'));var Redis=require(_0xb420('0x13'));var authService=require(_0xb420('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb420('0x15'));var hardwareService=require(_0xb420('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xb420('0x17'));var config=require(_0xb420('0x18'));var licenseUtil=require(_0xb420('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42bd52,_0x228418){_0x228418=_0x228418||0xcc;return function(_0x59c94a){if(_0x59c94a){return _0x42bd52[_0xb420('0x1a')](_0x228418);}return _0x42bd52[_0xb420('0x1b')](_0x228418)[_0xb420('0x1c')]();};}function respondWithResult(_0x3f3b64,_0xf1f878){_0xf1f878=_0xf1f878||0xc8;return function(_0x3f58d0){if(_0x3f58d0){return _0x3f3b64[_0xb420('0x1b')](_0xf1f878)['json'](_0x3f58d0);}};}function respondWithFilteredResult(_0xad99a6,_0x2c7121){return function(_0xe384b5){if(_0xe384b5){var _0x1087d8=typeof _0x2c7121[_0xb420('0x1d')]===_0xb420('0x1e')&&typeof _0x2c7121[_0xb420('0x1f')]===_0xb420('0x1e');var _0x23229d=_0xe384b5[_0xb420('0x20')];var _0x17ece7=_0x1087d8?0x0:_0x2c7121['offset'];var _0x2067e6=_0x1087d8?_0xe384b5[_0xb420('0x20')]:_0x2c7121[_0xb420('0x1d')]+_0x2c7121[_0xb420('0x1f')];var _0x59073c;if(_0x2067e6>=_0x23229d){_0x2067e6=_0x23229d;_0x59073c=0xc8;}else{_0x59073c=0xce;}_0xad99a6[_0xb420('0x1b')](_0x59073c);return _0xad99a6[_0xb420('0x21')](_0xb420('0x22'),_0x17ece7+'-'+_0x2067e6+'/'+_0x23229d)['json'](_0xe384b5);}return null;};}function patchUpdates(_0x3ff744){return function(_0xe5fc4a){try{jsonpatch[_0xb420('0x23')](_0xe5fc4a,_0x3ff744,!![]);}catch(_0x430103){return BPromise['reject'](_0x430103);}return _0xe5fc4a[_0xb420('0x24')]();};}function saveUpdates(_0x2df13f,_0x581a48){return function(_0x2945ee){if(_0x2945ee){return _0x2945ee[_0xb420('0x25')](_0x2df13f)[_0xb420('0x26')](function(_0x27abbe){return _0x27abbe;});}return null;};}function removeEntity(_0x4cf1d5,_0x5746b8){return function(_0x278513){if(_0x278513){return _0x278513[_0xb420('0x27')]()[_0xb420('0x26')](function(){_0x4cf1d5[_0xb420('0x1b')](0xcc)[_0xb420('0x1c')]();});}};}function handleEntityNotFound(_0x5493c1,_0x3ed606){return function(_0x2ddbb1){if(!_0x2ddbb1){_0x5493c1['sendStatus'](0x194);}return _0x2ddbb1;};}function handleError(_0x38b2e9,_0x8373a3){_0x8373a3=_0x8373a3||0x1f4;return function(_0x209e50){logger[_0xb420('0x28')](_0x209e50[_0xb420('0x29')]);if(_0x209e50['name']){delete _0x209e50[_0xb420('0x2a')];}_0x38b2e9[_0xb420('0x1b')](_0x8373a3)[_0xb420('0x2b')](_0x209e50);};}exports[_0xb420('0x2c')]=function(_0x518b50,_0x339379){var _0x56bfe4={},_0x507628={},_0x28893b={'count':0x0,'rows':[]};var _0x390f56=_['map'](db[_0xb420('0x2d')][_0xb420('0x2e')],function(_0x2c8d51){return{'name':_0x2c8d51[_0xb420('0x2f')],'type':_0x2c8d51[_0xb420('0x30')][_0xb420('0x31')]};});_0x507628['model']=_[_0xb420('0x32')](_['map'](_0x390f56,'name'),['name']);_0x507628['query']=_[_0xb420('0x33')](_0x518b50[_0xb420('0x34')]);_0x507628[_0xb420('0x35')]=_[_0xb420('0x36')](_0x507628[_0xb420('0x37')],_0x507628['query']);_0x56bfe4['attributes']=_[_0xb420('0x36')](_0x507628[_0xb420('0x37')],qs[_0xb420('0x38')](_0x518b50[_0xb420('0x34')][_0xb420('0x38')]));_0x56bfe4[_0xb420('0x39')]=_0x56bfe4[_0xb420('0x39')][_0xb420('0x3a')]?_0x56bfe4[_0xb420('0x39')]:_0x507628[_0xb420('0x37')];if(!_0x518b50[_0xb420('0x34')][_0xb420('0x3b')](_0xb420('0x3c'))){_0x56bfe4[_0xb420('0x1f')]=qs[_0xb420('0x1f')](_0x518b50[_0xb420('0x34')][_0xb420('0x1f')]);_0x56bfe4[_0xb420('0x1d')]=qs[_0xb420('0x1d')](_0x518b50[_0xb420('0x34')][_0xb420('0x1d')]);}_0x56bfe4[_0xb420('0x3d')]=qs[_0xb420('0x3e')](_0x518b50['query'][_0xb420('0x3e')]);_0x56bfe4[_0xb420('0x3f')]=qs[_0xb420('0x35')](_[_0xb420('0x40')](_0x518b50['query'],_0x507628['filters']),_0x390f56);if(_0x518b50[_0xb420('0x34')][_0xb420('0x41')]){_0x56bfe4[_0xb420('0x3f')]=_[_0xb420('0x42')](_0x56bfe4['where'],{'$or':_['map'](_0x390f56,function(_0x35fea1){if(_0x35fea1[_0xb420('0x30')]!==_0xb420('0x43')){var _0x43af54={};_0x43af54[_0x35fea1[_0xb420('0x2a')]]={'$like':'%'+_0x518b50[_0xb420('0x34')][_0xb420('0x41')]+'%'};return _0x43af54;}})});}_0x56bfe4=_[_0xb420('0x42')]({},_0x56bfe4,_0x518b50[_0xb420('0x44')]);var _0x30c76a={'where':_0x56bfe4['where']};return db[_0xb420('0x2d')][_0xb420('0x20')](_0x30c76a)['then'](function(_0x4c5285){_0x28893b[_0xb420('0x20')]=_0x4c5285;if(_0x518b50[_0xb420('0x34')][_0xb420('0x45')]){_0x56bfe4['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xb420('0x46')](_0x56bfe4);})['then'](function(_0x2548a4){_0x28893b[_0xb420('0x47')]=_0x2548a4;return _0x28893b;})[_0xb420('0x26')](respondWithFilteredResult(_0x339379,_0x56bfe4))['catch'](handleError(_0x339379,null));};exports[_0xb420('0x48')]=function(_0x466789,_0x2cb597){var _0x4fed59={'raw':!![],'where':{'id':_0x466789['params']['id']}},_0x109e6c={};_0x109e6c[_0xb420('0x37')]=_[_0xb420('0x33')](db['VoiceMailMessage']['rawAttributes']);_0x109e6c['query']=_['keys'](_0x466789[_0xb420('0x34')]);_0x109e6c[_0xb420('0x35')]=_[_0xb420('0x36')](_0x109e6c[_0xb420('0x37')],_0x109e6c[_0xb420('0x34')]);_0x4fed59[_0xb420('0x39')]=_[_0xb420('0x36')](_0x109e6c[_0xb420('0x37')],qs[_0xb420('0x38')](_0x466789[_0xb420('0x34')]['fields']));_0x4fed59[_0xb420('0x39')]=_0x4fed59[_0xb420('0x39')][_0xb420('0x3a')]?_0x4fed59[_0xb420('0x39')]:_0x109e6c[_0xb420('0x37')];if(_0x466789['query'][_0xb420('0x45')]){_0x4fed59[_0xb420('0x49')]=[{'all':!![]}];}_0x4fed59=_[_0xb420('0x42')]({},_0x4fed59,_0x466789[_0xb420('0x44')]);return db[_0xb420('0x2d')][_0xb420('0x4a')](_0x4fed59)[_0xb420('0x26')](handleEntityNotFound(_0x2cb597,null))[_0xb420('0x26')](respondWithResult(_0x2cb597,null))['catch'](handleError(_0x2cb597,null));};exports[_0xb420('0x4b')]=function(_0x210156,_0x477609){return db[_0xb420('0x2d')][_0xb420('0x4b')](_0x210156[_0xb420('0x4c')],{})['then'](respondWithResult(_0x477609,0xc9))[_0xb420('0x4d')](handleError(_0x477609,null));};exports[_0xb420('0x25')]=function(_0x5c443a,_0x6e5844){if(_0x5c443a[_0xb420('0x4c')]['id']){delete _0x5c443a[_0xb420('0x4c')]['id'];}return db[_0xb420('0x2d')]['find']({'where':{'id':_0x5c443a[_0xb420('0x4e')]['id']}})[_0xb420('0x26')](handleEntityNotFound(_0x6e5844,null))['then'](saveUpdates(_0x5c443a[_0xb420('0x4c')],null))[_0xb420('0x26')](respondWithResult(_0x6e5844,null))[_0xb420('0x4d')](handleError(_0x6e5844,null));};exports[_0xb420('0x27')]=function(_0x461c89,_0x59c6f3){return db[_0xb420('0x2d')][_0xb420('0x4a')]({'where':{'id':_0x461c89[_0xb420('0x4e')]['id']}})[_0xb420('0x26')](handleEntityNotFound(_0x59c6f3,null))['then'](removeEntity(_0x59c6f3,null))[_0xb420('0x4d')](handleError(_0x59c6f3,null));};exports[_0xb420('0x4f')]=function(_0x443deb,_0x40b4dd,_0x590985){return db['VoiceMailMessage']['find']({'where':{'id':_0x443deb[_0xb420('0x4e')]['id']},'attributes':['id','recording',_0xb420('0x50')]})[_0xb420('0x26')](handleEntityNotFound(_0x40b4dd,null))[_0xb420('0x26')](function(_0x41b342){if(_0x41b342){if(!_0x41b342[_0xb420('0x51')]){throw new db['Sequelize'][(_0xb420('0x52'))](_0xb420('0x53'));}var _0x54e6ca={'Content-Type':'audio/wav','Content-Disposition':_0xb420('0x54')};if(_0x41b342[_0xb420('0x50')]){_0x54e6ca[_0xb420('0x55')]='attachment;\x20filename=\x22'+_0x41b342[_0xb420('0x50')]+_0xb420('0x56');}_0x40b4dd['set'](_0x54e6ca);return _0x40b4dd['send'](new Buffer(_0x41b342[_0xb420('0x51')]));}})[_0xb420('0x4d')](handleError(_0x40b4dd,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index de1769c..671068f 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 _0xc0c6=['rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0c6,0x1db));var _0x6c0c=function(_0x2154e7,_0x195446){_0x2154e7=_0x2154e7-0x0;var _0x462859=_0xc0c6[_0x2154e7];return _0x462859;};'use strict';var _=require(_0x6c0c('0x0'));var util=require(_0x6c0c('0x1'));var logger=require('../../config/logger')(_0x6c0c('0x2'));var moment=require(_0x6c0c('0x3'));var BPromise=require(_0x6c0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c0c('0x5'));var rimraf=require(_0x6c0c('0x6'));var config=require(_0x6c0c('0x7'));var attributes=require(_0x6c0c('0x8'));module['exports']=function(_0x51797f,_0x1b8c78){return _0x51797f[_0x6c0c('0x9')](_0x6c0c('0xa'),attributes,{'tableName':_0x6c0c('0xb'),'paranoid':![],'indexes':[{'name':_0x6c0c('0xc'),'fields':[_0x6c0c('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0d3d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x3b8de0,_0x2e5f3a){var _0x653e71=function(_0x129d73){while(--_0x129d73){_0x3b8de0['push'](_0x3b8de0['shift']());}};_0x653e71(++_0x2e5f3a);}(_0x0d3d,0xf6));var _0xd0d3=function(_0x3f0b3d,_0x4f004a){_0x3f0b3d=_0x3f0b3d-0x0;var _0x471192=_0x0d3d[_0x3f0b3d];return _0x471192;};'use strict';var _=require(_0xd0d3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd0d3('0x1'));var moment=require('moment');var BPromise=require(_0xd0d3('0x2'));var rp=require(_0xd0d3('0x3'));var fs=require('fs');var path=require(_0xd0d3('0x4'));var rimraf=require(_0xd0d3('0x5'));var config=require(_0xd0d3('0x6'));var attributes=require(_0xd0d3('0x7'));module[_0xd0d3('0x8')]=function(_0x2ddc8c,_0x15793f){return _0x2ddc8c[_0xd0d3('0x9')](_0xd0d3('0xa'),attributes,{'tableName':_0xd0d3('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xd0d3('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 82290a2..23c875e 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 _0x48ac=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x3d17ff,_0x20fde6){var _0xad17a7=function(_0x57c97c){while(--_0x57c97c){_0x3d17ff['push'](_0x3d17ff['shift']());}};_0xad17a7(++_0x20fde6);}(_0x48ac,0x151));var _0xc48a=function(_0x44720a,_0x59fe9a){_0x44720a=_0x44720a-0x0;var _0xfffc20=_0x48ac[_0x44720a];return _0xfffc20;};'use strict';var _=require(_0xc48a('0x0'));var util=require(_0xc48a('0x1'));var moment=require(_0xc48a('0x2'));var BPromise=require('bluebird');var rs=require(_0xc48a('0x3'));var fs=require('fs');var Redis=require(_0xc48a('0x4'));var db=require(_0xc48a('0x5'))['db'];var utils=require(_0xc48a('0x6'));var logger=require('../../config/logger')(_0xc48a('0x7'));var config=require(_0xc48a('0x8'));var jayson=require(_0xc48a('0x9'));var client=jayson['client'][_0xc48a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8aaebd,_0x5d1743,_0x1b3cd5){return new BPromise(function(_0x13c8c7,_0x1713ab){return client['request'](_0x8aaebd,_0x1b3cd5)[_0xc48a('0xb')](function(_0x2adc73){logger['info'](_0xc48a('0xc'),_0x5d1743,_0xc48a('0xd'));logger['debug'](_0xc48a('0xe'),_0x5d1743,_0xc48a('0xd'),JSON[_0xc48a('0xf')](_0x2adc73));if(_0x2adc73['error']){if(_0x2adc73[_0xc48a('0x10')][_0xc48a('0x11')]===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xc'),_0x5d1743,_0x2adc73[_0xc48a('0x10')][_0xc48a('0x12')]);return _0x1713ab(_0x2adc73['error'][_0xc48a('0x12')]);}logger[_0xc48a('0x10')](_0xc48a('0xc'),_0x5d1743,_0x2adc73[_0xc48a('0x10')][_0xc48a('0x12')]);return _0x13c8c7(_0x2adc73[_0xc48a('0x10')][_0xc48a('0x12')]);}else{logger['info'](_0xc48a('0xc'),_0x5d1743,_0xc48a('0xd'));_0x13c8c7(_0x2adc73[_0xc48a('0x13')][_0xc48a('0x12')]);}})['catch'](function(_0x1fe786){logger['error'](_0xc48a('0xc'),_0x5d1743,_0x1fe786);_0x1713ab(_0x1fe786);});});} \ No newline at end of file +var _0x6cd7=['error','message','VoiceMailMessage,\x20%s,\x20%s','info','result','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','request','then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x218aa7,_0x36ae2c){var _0x53e85d=function(_0xe31799){while(--_0xe31799){_0x218aa7['push'](_0x218aa7['shift']());}};_0x53e85d(++_0x36ae2c);}(_0x6cd7,0x19d));var _0x76cd=function(_0x38f34e,_0x287825){_0x38f34e=_0x38f34e-0x0;var _0x3f3adf=_0x6cd7[_0x38f34e];return _0x3f3adf;};'use strict';var _=require('lodash');var util=require(_0x76cd('0x0'));var moment=require(_0x76cd('0x1'));var BPromise=require(_0x76cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76cd('0x3'));var db=require(_0x76cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76cd('0x5'));var config=require(_0x76cd('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x126868,_0x4d3ce1,_0x314a51){return new BPromise(function(_0x595733,_0x5c556a){return client[_0x76cd('0x7')](_0x126868,_0x314a51)[_0x76cd('0x8')](function(_0x13bdb8){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x4d3ce1,_0x76cd('0x9'));logger[_0x76cd('0xa')](_0x76cd('0xb'),_0x4d3ce1,_0x76cd('0x9'),JSON['stringify'](_0x13bdb8));if(_0x13bdb8[_0x76cd('0xc')]){if(_0x13bdb8[_0x76cd('0xc')]['code']===0x1f4){logger[_0x76cd('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x4d3ce1,_0x13bdb8[_0x76cd('0xc')][_0x76cd('0xd')]);return _0x5c556a(_0x13bdb8['error'][_0x76cd('0xd')]);}logger[_0x76cd('0xc')](_0x76cd('0xe'),_0x4d3ce1,_0x13bdb8[_0x76cd('0xc')][_0x76cd('0xd')]);return _0x595733(_0x13bdb8[_0x76cd('0xc')][_0x76cd('0xd')]);}else{logger[_0x76cd('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x4d3ce1,_0x76cd('0x9'));_0x595733(_0x13bdb8[_0x76cd('0x10')][_0x76cd('0xd')]);}})['catch'](function(_0x1c7cfe){logger[_0x76cd('0xc')](_0x76cd('0xe'),_0x4d3ce1,_0x1c7cfe);_0x5c556a(_0x1c7cfe);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 30689ed..8e03e5a 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 _0x5b2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1e7a8e,_0x324715){var _0x36a028=function(_0x2455fe){while(--_0x2455fe){_0x1e7a8e['push'](_0x1e7a8e['shift']());}};_0x36a028(++_0x324715);}(_0x5b2f,0x1a9));var _0xf5b2=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0x5b2f[_0x2755fb];return _0x293f12;};'use strict';var multer=require(_0xf5b2('0x0'));var util=require(_0xf5b2('0x1'));var path=require(_0xf5b2('0x2'));var timeout=require(_0xf5b2('0x3'));var express=require(_0xf5b2('0x4'));var router=express[_0xf5b2('0x5')]();var fs_extra=require(_0xf5b2('0x6'));var auth=require(_0xf5b2('0x7'));var interaction=require(_0xf5b2('0x8'));var config=require(_0xf5b2('0x9'));var controller=require('./voiceMusicOnHold.controller');router[_0xf5b2('0xa')]('/',auth[_0xf5b2('0xb')](),controller['index']);router[_0xf5b2('0xa')](_0xf5b2('0xc'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0xd')]);router[_0xf5b2('0xa')](_0xf5b2('0xe'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0xf')]);router[_0xf5b2('0x10')]('/',auth[_0xf5b2('0xb')](),controller[_0xf5b2('0x11')]);router[_0xf5b2('0x10')](_0xf5b2('0xe'),auth['isAuthenticated'](),controller['addSound']);router[_0xf5b2('0x12')](_0xf5b2('0xc'),auth[_0xf5b2('0xb')](),controller['update']);router['delete'](_0xf5b2('0xc'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0x13')]);router[_0xf5b2('0x14')](_0xf5b2('0x15'),auth[_0xf5b2('0xb')](),controller[_0xf5b2('0x16')]);module[_0xf5b2('0x17')]=router; \ No newline at end of file +var _0x6c2a=['addSound','put','update','destroy','delete','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x6c2a,0x1bc));var _0xa6c2=function(_0x222f08,_0x140c5c){_0x222f08=_0x222f08-0x0;var _0x41eaa6=_0x6c2a[_0x222f08];return _0x41eaa6;};'use strict';var multer=require(_0xa6c2('0x0'));var util=require(_0xa6c2('0x1'));var path=require('path');var timeout=require(_0xa6c2('0x2'));var express=require(_0xa6c2('0x3'));var router=express[_0xa6c2('0x4')]();var fs_extra=require(_0xa6c2('0x5'));var auth=require(_0xa6c2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa6c2('0x7'));var controller=require(_0xa6c2('0x8'));router[_0xa6c2('0x9')]('/',auth[_0xa6c2('0xa')](),controller[_0xa6c2('0xb')]);router['get'](_0xa6c2('0xc'),auth[_0xa6c2('0xa')](),controller['show']);router['get'](_0xa6c2('0xd'),auth['isAuthenticated'](),controller[_0xa6c2('0xe')]);router[_0xa6c2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6c2('0xf')](_0xa6c2('0xd'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x10')]);router[_0xa6c2('0x11')](_0xa6c2('0xc'),auth['isAuthenticated'](),controller[_0xa6c2('0x12')]);router['delete'](_0xa6c2('0xc'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x13')]);router[_0xa6c2('0x14')]('/:id/sounds/:id2',auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x15')]);module[_0xa6c2('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index ac7a323..efe092f 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 _0xbf07=['exports','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','STRING','alpha','BOOLEAN','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbf07,0xef));var _0x7bf0=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0xbf07[_0x3d2e4b];return _0x509e78;};'use strict';var Sequelize=require(_0x7bf0('0x0'));module[_0x7bf0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7bf0('0x2')](_0x7bf0('0x3'),'files',_0x7bf0('0x4'),_0x7bf0('0x5'),_0x7bf0('0x6'),_0x7bf0('0x7')),'allowNull':!![],'defaultValue':_0x7bf0('0x8')},'directory':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![],'defaultValue':_0x7bf0('0xa')},'format':{'type':Sequelize[_0x7bf0('0x9')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x7bf0('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ea4=['mp3nb','quietmp3nb','quietmp3','alpha','BOOLEAN','exports','STRING','name','ENUM','custom','files'];(function(_0x34f7bb,_0x547eb3){var _0x2efee3=function(_0x1fc766){while(--_0x1fc766){_0x34f7bb['push'](_0x34f7bb['shift']());}};_0x2efee3(++_0x547eb3);}(_0x5ea4,0x7e));var _0x45ea=function(_0xdfad94,_0x500479){_0xdfad94=_0xdfad94-0x0;var _0x348a4e=_0x5ea4[_0xdfad94];return _0x348a4e;};'use strict';var Sequelize=require('sequelize');module[_0x45ea('0x0')]={'name':{'type':Sequelize[_0x45ea('0x1')],'allowNull':![],'unique':_0x45ea('0x2')},'mode':{'type':Sequelize[_0x45ea('0x3')](_0x45ea('0x4'),_0x45ea('0x5'),_0x45ea('0x6'),_0x45ea('0x7'),_0x45ea('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x45ea('0x5')},'directory':{'type':Sequelize[_0x45ea('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x45ea('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x45ea('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x45ea('0x1')],'allowNull':!![],'defaultValue':_0x45ea('0x9')},'format':{'type':Sequelize[_0x45ea('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x45ea('0xa')],'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 c88a559..64fe6ee 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 _0xc2b7=['save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','body','files','directory','join','root','server/files/moh','create','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','sequelize','readdirSync','forEach','rmdirSync','Sequelize','addSound','transaction','converted_format','createdAt','server/files/sounds/converted','%s.%s','save_name','format','symlinkSync','ValidationError','message','removeSound','id2','Sound','findOne','unlinkSync','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc2b7,0xc8));var _0x7c2b=function(_0x4fadb8,_0x11b539){_0x4fadb8=_0x4fadb8-0x0;var _0x3c9e20=_0xc2b7[_0x4fadb8];return _0x3c9e20;};'use strict';var emlformat=require(_0x7c2b('0x0'));var rimraf=require(_0x7c2b('0x1'));var zipdir=require(_0x7c2b('0x2'));var jsonpatch=require(_0x7c2b('0x3'));var rp=require(_0x7c2b('0x4'));var moment=require(_0x7c2b('0x5'));var BPromise=require(_0x7c2b('0x6'));var Mustache=require(_0x7c2b('0x7'));var util=require(_0x7c2b('0x8'));var path=require('path');var sox=require(_0x7c2b('0x9'));var csv=require(_0x7c2b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c2b('0xb'));var _=require(_0x7c2b('0xc'));var squel=require(_0x7c2b('0xd'));var crypto=require(_0x7c2b('0xe'));var jsforce=require(_0x7c2b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7c2b('0xa'));var querystring=require(_0x7c2b('0x10'));var Papa=require(_0x7c2b('0x11'));var Redis=require('ioredis');var authService=require(_0x7c2b('0x12'));var qs=require(_0x7c2b('0x13'));var as=require(_0x7c2b('0x14'));var hardwareService=require(_0x7c2b('0x15'));var logger=require(_0x7c2b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7c2b('0x17'));var licenseUtil=require(_0x7c2b('0x18'));var db=require(_0x7c2b('0x19'))['db'];function respondWithStatusCode(_0x57c7da,_0x3dae47){_0x3dae47=_0x3dae47||0xcc;return function(_0x27336f){if(_0x27336f){return _0x57c7da[_0x7c2b('0x1a')](_0x3dae47);}return _0x57c7da[_0x7c2b('0x1b')](_0x3dae47)[_0x7c2b('0x1c')]();};}function respondWithResult(_0x1c1d83,_0xeb3616){_0xeb3616=_0xeb3616||0xc8;return function(_0x510882){if(_0x510882){return _0x1c1d83['status'](_0xeb3616)[_0x7c2b('0x1d')](_0x510882);}};}function respondWithFilteredResult(_0x3d7028,_0x9e1685){return function(_0x209a51){if(_0x209a51){var _0x33cd99=typeof _0x9e1685['offset']==='undefined'&&typeof _0x9e1685[_0x7c2b('0x1e')]===_0x7c2b('0x1f');var _0x5eee43=_0x209a51[_0x7c2b('0x20')];var _0x2b60ae=_0x33cd99?0x0:_0x9e1685[_0x7c2b('0x21')];var _0x4473ee=_0x33cd99?_0x209a51[_0x7c2b('0x20')]:_0x9e1685[_0x7c2b('0x21')]+_0x9e1685[_0x7c2b('0x1e')];var _0x383780;if(_0x4473ee>=_0x5eee43){_0x4473ee=_0x5eee43;_0x383780=0xc8;}else{_0x383780=0xce;}_0x3d7028[_0x7c2b('0x1b')](_0x383780);return _0x3d7028[_0x7c2b('0x22')](_0x7c2b('0x23'),_0x2b60ae+'-'+_0x4473ee+'/'+_0x5eee43)[_0x7c2b('0x1d')](_0x209a51);}return null;};}function patchUpdates(_0x5282c1){return function(_0x2731e0){try{jsonpatch[_0x7c2b('0x24')](_0x2731e0,_0x5282c1,!![]);}catch(_0x5e3aab){return BPromise[_0x7c2b('0x25')](_0x5e3aab);}return _0x2731e0[_0x7c2b('0x26')]();};}function saveUpdates(_0x556626,_0x24b8c1){return function(_0x4c3c37){if(_0x4c3c37){return _0x4c3c37[_0x7c2b('0x27')](_0x556626)[_0x7c2b('0x28')](function(_0x4f93f1){return _0x4f93f1;});}return null;};}function removeEntity(_0x483a64,_0x429d04){return function(_0x169f27){if(_0x169f27){return _0x169f27[_0x7c2b('0x29')]()[_0x7c2b('0x28')](function(){var _0x3513e7=_0x169f27[_0x7c2b('0x2a')]({'plain':!![]});var _0x556e80=_0x7c2b('0x2b');return db['UserProfileResource'][_0x7c2b('0x29')]({'where':{'type':_0x556e80,'resourceId':_0x3513e7['id']}})['then'](function(){return _0x169f27;});})[_0x7c2b('0x28')](function(){_0x483a64[_0x7c2b('0x1b')](0xcc)[_0x7c2b('0x1c')]();});}};}function handleEntityNotFound(_0x161ea9,_0x4ba13c){return function(_0x49c221){if(!_0x49c221){_0x161ea9[_0x7c2b('0x1a')](0x194);}return _0x49c221;};}function handleError(_0x380bf9,_0x1f61e3){_0x1f61e3=_0x1f61e3||0x1f4;return function(_0x507ee5){logger[_0x7c2b('0x2c')](_0x507ee5[_0x7c2b('0x2d')]);if(_0x507ee5['name']){delete _0x507ee5[_0x7c2b('0x2e')];}_0x380bf9['status'](_0x1f61e3)[_0x7c2b('0x2f')](_0x507ee5);};}exports[_0x7c2b('0x30')]=function(_0x413e58,_0x2bace8){var _0xacc36d={},_0x460cea={},_0x886928={'count':0x0,'rows':[]};var _0x175228=_['map'](db[_0x7c2b('0x31')][_0x7c2b('0x32')],function(_0x3108b1){return{'name':_0x3108b1[_0x7c2b('0x33')],'type':_0x3108b1[_0x7c2b('0x34')][_0x7c2b('0x35')]};});_0x460cea[_0x7c2b('0x36')]=_[_0x7c2b('0x37')](_0x175228,_0x7c2b('0x2e'));_0x460cea['query']=_['keys'](_0x413e58[_0x7c2b('0x38')]);_0x460cea[_0x7c2b('0x39')]=_['intersection'](_0x460cea[_0x7c2b('0x36')],_0x460cea[_0x7c2b('0x38')]);_0xacc36d['attributes']=_[_0x7c2b('0x3a')](_0x460cea['model'],qs[_0x7c2b('0x3b')](_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x3b')]));_0xacc36d['attributes']=_0xacc36d['attributes'][_0x7c2b('0x3c')]?_0xacc36d[_0x7c2b('0x3d')]:_0x460cea['model'];if(!_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x3e')]('nolimit')){_0xacc36d[_0x7c2b('0x1e')]=qs['limit'](_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x1e')]);_0xacc36d['offset']=qs[_0x7c2b('0x21')](_0x413e58['query'][_0x7c2b('0x21')]);}_0xacc36d[_0x7c2b('0x3f')]=qs[_0x7c2b('0x40')](_0x413e58['query'][_0x7c2b('0x40')]);delete _0x413e58[_0x7c2b('0x38')][_0x7c2b('0x40')];_0xacc36d[_0x7c2b('0x41')]=qs['filters'](_[_0x7c2b('0x42')](_0x413e58['query'],_0x460cea[_0x7c2b('0x39')]),_0x175228);if(_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x43')]){_0xacc36d[_0x7c2b('0x41')]=_[_0x7c2b('0x44')](_0xacc36d['where'],{'$or':_[_0x7c2b('0x37')](_0x175228,function(_0x86e885){if(_0x86e885[_0x7c2b('0x34')]!==_0x7c2b('0x45')){var _0x262627={};_0x262627[_0x86e885[_0x7c2b('0x2e')]]={'$like':'%'+_0x413e58[_0x7c2b('0x38')][_0x7c2b('0x43')]+'%'};return _0x262627;}})});}_0xacc36d=_[_0x7c2b('0x44')]({},_0xacc36d,_0x413e58[_0x7c2b('0x46')]);var _0x5209c7={'where':_0xacc36d[_0x7c2b('0x41')]};return db[_0x7c2b('0x31')][_0x7c2b('0x20')](_0x5209c7)[_0x7c2b('0x28')](function(_0x329368){_0x886928[_0x7c2b('0x20')]=_0x329368;if(_0x413e58['query'][_0x7c2b('0x47')]){_0xacc36d[_0x7c2b('0x48')]=[{'all':!![]}];}return db[_0x7c2b('0x31')][_0x7c2b('0x49')](_0xacc36d);})[_0x7c2b('0x28')](function(_0x4a8e55){_0x886928[_0x7c2b('0x4a')]=_0x4a8e55;return _0x886928;})['then'](respondWithFilteredResult(_0x2bace8,_0xacc36d))[_0x7c2b('0x4b')](handleError(_0x2bace8,null));};exports[_0x7c2b('0x4c')]=function(_0x3abd7b,_0x2bcafd){var _0x2ffd2e={'raw':![],'where':{'id':_0x3abd7b[_0x7c2b('0x4d')]['id']}},_0x206a4a={};_0x206a4a[_0x7c2b('0x36')]=_[_0x7c2b('0x4e')](db['VoiceMusicOnHold'][_0x7c2b('0x32')]);_0x206a4a['query']=_['keys'](_0x3abd7b[_0x7c2b('0x38')]);_0x206a4a[_0x7c2b('0x39')]=_['intersection'](_0x206a4a[_0x7c2b('0x36')],_0x206a4a[_0x7c2b('0x38')]);_0x2ffd2e[_0x7c2b('0x3d')]=_[_0x7c2b('0x3a')](_0x206a4a[_0x7c2b('0x36')],qs[_0x7c2b('0x3b')](_0x3abd7b[_0x7c2b('0x38')][_0x7c2b('0x3b')]));_0x2ffd2e[_0x7c2b('0x3d')]=_0x2ffd2e['attributes'][_0x7c2b('0x3c')]?_0x2ffd2e['attributes']:_0x206a4a['model'];if(_0x3abd7b['query'][_0x7c2b('0x47')]){_0x2ffd2e[_0x7c2b('0x48')]=[{'all':!![]}];}_0x2ffd2e=_[_0x7c2b('0x44')]({},_0x2ffd2e,_0x3abd7b[_0x7c2b('0x46')]);return db['VoiceMusicOnHold']['find'](_0x2ffd2e)[_0x7c2b('0x28')](handleEntityNotFound(_0x2bcafd,null))[_0x7c2b('0x28')](respondWithResult(_0x2bcafd,null))[_0x7c2b('0x4b')](handleError(_0x2bcafd,null));};exports[_0x7c2b('0x27')]=function(_0x36541d,_0xbf8d6c){if(_0x36541d[_0x7c2b('0x4f')]['id']){delete _0x36541d[_0x7c2b('0x4f')]['id'];}return db[_0x7c2b('0x31')]['find']({'where':{'id':_0x36541d[_0x7c2b('0x4d')]['id']}})['then'](handleEntityNotFound(_0xbf8d6c,null))[_0x7c2b('0x28')](saveUpdates(_0x36541d['body'],null))[_0x7c2b('0x28')](respondWithResult(_0xbf8d6c,null))[_0x7c2b('0x4b')](handleError(_0xbf8d6c,null));};exports['create']=function(_0x209191,_0x39df29,_0x48b0c1){return db['sequelize']['transaction'](function(_0x5f0979){if(_0x209191[_0x7c2b('0x4f')]['mode']===_0x7c2b('0x50')){_0x209191[_0x7c2b('0x4f')][_0x7c2b('0x51')]=path[_0x7c2b('0x52')](config[_0x7c2b('0x53')],_0x7c2b('0x54'),_0x209191[_0x7c2b('0x4f')]['name']);}return db[_0x7c2b('0x31')][_0x7c2b('0x55')](_0x209191[_0x7c2b('0x4f')],{'transaction':_0x5f0979})['then'](function(_0x17001b){if(_0x209191[_0x7c2b('0x4f')][_0x7c2b('0x56')]==='files'){fs[_0x7c2b('0x57')](_0x17001b[_0x7c2b('0x51')],parseInt(_0x7c2b('0x58'),0x8));}var _0x61fcac=_0x209191[_0x7c2b('0x59')][_0x7c2b('0x2a')]({'plain':!![]});if(!_0x61fcac)throw new Error(_0x7c2b('0x5a'));if(_0x61fcac[_0x7c2b('0x5b')]===_0x7c2b('0x59')){var _0x62e10e=_0x17001b['get']({'plain':!![]});return db[_0x7c2b('0x5c')][_0x7c2b('0x5d')]({'where':{'name':_0x7c2b('0x2b'),'userProfileId':_0x61fcac[_0x7c2b('0x5e')]},'raw':!![]})[_0x7c2b('0x28')](function(_0x2346f6){if(_0x2346f6&&_0x2346f6[_0x7c2b('0x5f')]===0x0){return db['UserProfileResource'][_0x7c2b('0x55')]({'name':_0x62e10e['name'],'resourceId':_0x62e10e['id'],'type':_0x2346f6['name'],'sectionId':_0x2346f6['id']},{})[_0x7c2b('0x28')](function(){return _0x17001b;});}else{return _0x17001b;}})[_0x7c2b('0x4b')](function(_0x4361dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4361dd);});}return _0x17001b;});})[_0x7c2b('0x28')](respondWithResult(_0x39df29,0xc9))[_0x7c2b('0x4b')](handleError(_0x39df29,null));};exports[_0x7c2b('0x29')]=function(_0x500250,_0x1af828,_0x3b5f2c){var _0x1ee9bf;return db[_0x7c2b('0x31')]['find']({'where':{'id':_0x500250[_0x7c2b('0x4d')]['id']}})['then'](function(_0x5b712b){if(_0x5b712b){return db[_0x7c2b('0x60')]['transaction'](function(_0x496bd8){return _0x5b712b['destroy']({'transaction':_0x496bd8,'raw':!![]})[_0x7c2b('0x28')](function(_0x9b1a69){if(_0x9b1a69['directory']){fs[_0x7c2b('0x61')](_0x9b1a69['directory'])[_0x7c2b('0x62')](function(_0x17250a){fs['unlinkSync'](path[_0x7c2b('0x52')](_0x9b1a69['directory'],_0x17250a));});fs[_0x7c2b('0x63')](_0x9b1a69[_0x7c2b('0x51')]);}return _0x9b1a69;});})[_0x7c2b('0x4b')](function(_0x1a350e){throw new db[(_0x7c2b('0x64'))]['ValidationError'](_0x1a350e['message']);});}})[_0x7c2b('0x28')](handleEntityNotFound(_0x1af828,null))[_0x7c2b('0x28')](removeEntity(_0x1af828,null))[_0x7c2b('0x4b')](handleError(_0x1af828,null));};exports[_0x7c2b('0x65')]=function(_0x3b8507,_0x15d8b9,_0x26875a){return db[_0x7c2b('0x60')][_0x7c2b('0x66')](function(_0x36239d){var _0x25a6a3;return db[_0x7c2b('0x31')]['find']({'where':{'id':_0x3b8507['params']['id']}})['then'](function(_0x3dd6dd){if(_0x3dd6dd){_0x25a6a3=_0x3dd6dd;return _0x3dd6dd[_0x7c2b('0x65')](_0x3b8507[_0x7c2b('0x4f')]['id'],{'transaction':_0x36239d});}})[_0x7c2b('0x28')](function(_0x179faf){if(_0x179faf){return db['Sound']['findOne']({'where':{'id':_0x3b8507['body']['id']},'attributes':['id',_0x7c2b('0x2e'),'save_name',_0x7c2b('0x67'),_0x7c2b('0x68')],'raw':!![]});}})['then'](function(_0x3e391a){if(_0x3e391a){var _0x3b2ba5=path[_0x7c2b('0x52')](config[_0x7c2b('0x53')],_0x7c2b('0x69'),util['format'](_0x7c2b('0x6a'),path['basename'](_0x3e391a[_0x7c2b('0x6b')],path['extname'](_0x3e391a[_0x7c2b('0x6b')])),_0x3e391a[_0x7c2b('0x67')]));var _0x34127f=path[_0x7c2b('0x52')](config['root'],_0x7c2b('0x54'),_0x25a6a3[_0x7c2b('0x2e')],util[_0x7c2b('0x6c')]('%s.%s',_0x3e391a[_0x7c2b('0x2e')],_0x3e391a[_0x7c2b('0x67')]));fs[_0x7c2b('0x6d')](_0x3b2ba5,_0x34127f);return _0x3e391a;}})[_0x7c2b('0x4b')](function(_0x53339f){throw new db['Sequelize'][(_0x7c2b('0x6e'))](_0x53339f[_0x7c2b('0x6f')]);});})[_0x7c2b('0x28')](handleEntityNotFound(_0x15d8b9,null))[_0x7c2b('0x28')](respondWithResult(_0x15d8b9,0xc9))[_0x7c2b('0x4b')](handleError(_0x15d8b9,null));};exports[_0x7c2b('0x70')]=function(_0x40ff16,_0x3eb390,_0x17cf17){return db[_0x7c2b('0x60')][_0x7c2b('0x66')](function(_0x553bc5){var _0xacd35c;return db[_0x7c2b('0x31')]['findOne']({'where':{'id':_0x40ff16[_0x7c2b('0x4d')]['id']}})[_0x7c2b('0x28')](handleEntityNotFound(_0x3eb390,null))[_0x7c2b('0x28')](function(_0x57369a){if(_0x57369a){_0xacd35c=_0x57369a;return _0x57369a[_0x7c2b('0x70')](_0x40ff16[_0x7c2b('0x4d')][_0x7c2b('0x71')]);}})[_0x7c2b('0x28')](function(_0x1d1409){if(_0x1d1409){return db[_0x7c2b('0x72')][_0x7c2b('0x73')]({'where':{'id':_0x40ff16['params'][_0x7c2b('0x71')]},'attributes':['id',_0x7c2b('0x2e'),_0x7c2b('0x6b'),_0x7c2b('0x67'),_0x7c2b('0x68')],'raw':!![]});}})[_0x7c2b('0x28')](function(_0x170028){if(_0x170028){fs[_0x7c2b('0x74')](path[_0x7c2b('0x52')](_0xacd35c[_0x7c2b('0x51')],util['format'](_0x7c2b('0x6a'),_0x170028[_0x7c2b('0x2e')],_0x170028[_0x7c2b('0x67')])));return _0x170028;}})['catch'](function(_0x152777){throw new db[(_0x7c2b('0x64'))][(_0x7c2b('0x6e'))](_0x152777[_0x7c2b('0x6f')]);});})[_0x7c2b('0x28')](handleEntityNotFound(_0x3eb390,null))[_0x7c2b('0x28')](respondWithStatusCode(_0x3eb390,0xcc))[_0x7c2b('0x4b')](handleError(_0x3eb390,null));};exports[_0x7c2b('0x75')]=function(_0x14f11e,_0x5afd47,_0x59faf2){var _0x4f3882={};var _0x232d5e={};var _0x5c01fc;var _0x105cd9;return db['VoiceMusicOnHold'][_0x7c2b('0x73')]({'where':{'id':_0x14f11e[_0x7c2b('0x4d')]['id']}})[_0x7c2b('0x28')](handleEntityNotFound(_0x5afd47,null))[_0x7c2b('0x28')](function(_0x133571){if(_0x133571){_0x5c01fc=_0x133571;_0x232d5e['model']=_[_0x7c2b('0x4e')](db[_0x7c2b('0x72')][_0x7c2b('0x32')]);_0x232d5e[_0x7c2b('0x38')]=_[_0x7c2b('0x4e')](_0x14f11e[_0x7c2b('0x38')]);_0x232d5e[_0x7c2b('0x39')]=_[_0x7c2b('0x3a')](_0x232d5e[_0x7c2b('0x36')],_0x232d5e[_0x7c2b('0x38')]);_0x4f3882['attributes']=_['intersection'](_0x232d5e[_0x7c2b('0x36')],qs[_0x7c2b('0x3b')](_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x3b')]));_0x4f3882[_0x7c2b('0x3d')]=_0x4f3882['attributes']['length']?_0x4f3882[_0x7c2b('0x3d')]:_0x232d5e[_0x7c2b('0x36')];_0x4f3882['order']=qs['sort'](_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x40')]);_0x4f3882['where']=qs[_0x7c2b('0x39')](_[_0x7c2b('0x42')](_0x14f11e[_0x7c2b('0x38')],_0x232d5e[_0x7c2b('0x39')]));if(_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x43')]){_0x4f3882[_0x7c2b('0x41')]=_['merge'](_0x4f3882[_0x7c2b('0x41')],{'$or':_[_0x7c2b('0x37')](_0x4f3882[_0x7c2b('0x3d')],function(_0x346670){var _0x1cae1f={};_0x1cae1f[_0x346670]={'$like':'%'+_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x43')]+'%'};return _0x1cae1f;})});}_0x4f3882=_[_0x7c2b('0x44')]({},_0x4f3882,_0x14f11e[_0x7c2b('0x46')]);return _0x5c01fc['getSounds'](_0x4f3882);}})['then'](function(_0xe4c78e){if(_0xe4c78e){_0x105cd9=_0xe4c78e['length'];if(!_0x14f11e[_0x7c2b('0x38')][_0x7c2b('0x3e')](_0x7c2b('0x76'))){_0x4f3882[_0x7c2b('0x1e')]=qs['limit'](_0x14f11e['query'][_0x7c2b('0x1e')]);_0x4f3882[_0x7c2b('0x21')]=qs['offset'](_0x14f11e['query'][_0x7c2b('0x21')]);}return _0x5c01fc[_0x7c2b('0x75')](_0x4f3882);}})[_0x7c2b('0x28')](function(_0x402b95){if(_0x402b95){return _0x402b95?{'count':_0x105cd9,'rows':_0x402b95}:null;}})[_0x7c2b('0x28')](respondWithResult(_0x5afd47,null))[_0x7c2b('0x4b')](handleError(_0x5afd47,null));}; \ No newline at end of file +var _0x0fcb=['role','UserProfileSection','userProfileId','UserProfileResource','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','basename','server/files/moh','symlinkSync','removeSound','id2','directory','format','%s.%s','message','getSounds','order','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','body','create','sequelize','transaction','mode','files','join','root','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x53796a,_0x5c7a57){var _0x1b6dff=function(_0x24115c){while(--_0x24115c){_0x53796a['push'](_0x53796a['shift']());}};_0x1b6dff(++_0x5c7a57);}(_0x0fcb,0x89));var _0xb0fc=function(_0x1c8e45,_0x2cbc28){_0x1c8e45=_0x1c8e45-0x0;var _0x3952ec=_0x0fcb[_0x1c8e45];return _0x3952ec;};'use strict';var emlformat=require(_0xb0fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0fc('0x1'));var jsonpatch=require(_0xb0fc('0x2'));var rp=require(_0xb0fc('0x3'));var moment=require('moment');var BPromise=require(_0xb0fc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb0fc('0x5'));var sox=require(_0xb0fc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0fc('0x7'));var _=require(_0xb0fc('0x8'));var squel=require(_0xb0fc('0x9'));var crypto=require(_0xb0fc('0xa'));var jsforce=require(_0xb0fc('0xb'));var deskjs=require(_0xb0fc('0xc'));var toCsv=require(_0xb0fc('0xd'));var querystring=require(_0xb0fc('0xe'));var Papa=require(_0xb0fc('0xf'));var Redis=require(_0xb0fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb0fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0fc('0x12'))(_0xb0fc('0x13'));var utils=require(_0xb0fc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb0fc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f5725,_0x214af6){_0x214af6=_0x214af6||0xcc;return function(_0x49039b){if(_0x49039b){return _0x3f5725['sendStatus'](_0x214af6);}return _0x3f5725[_0xb0fc('0x16')](_0x214af6)[_0xb0fc('0x17')]();};}function respondWithResult(_0x64fd58,_0x38ae46){_0x38ae46=_0x38ae46||0xc8;return function(_0xed0d68){if(_0xed0d68){return _0x64fd58[_0xb0fc('0x16')](_0x38ae46)[_0xb0fc('0x18')](_0xed0d68);}};}function respondWithFilteredResult(_0x209d4d,_0x54f0ad){return function(_0x3437f4){if(_0x3437f4){var _0x4a2b60=typeof _0x54f0ad[_0xb0fc('0x19')]===_0xb0fc('0x1a')&&typeof _0x54f0ad['limit']===_0xb0fc('0x1a');var _0xb63530=_0x3437f4[_0xb0fc('0x1b')];var _0x28510a=_0x4a2b60?0x0:_0x54f0ad['offset'];var _0x3c8bca=_0x4a2b60?_0x3437f4['count']:_0x54f0ad[_0xb0fc('0x19')]+_0x54f0ad[_0xb0fc('0x1c')];var _0x3caa50;if(_0x3c8bca>=_0xb63530){_0x3c8bca=_0xb63530;_0x3caa50=0xc8;}else{_0x3caa50=0xce;}_0x209d4d[_0xb0fc('0x16')](_0x3caa50);return _0x209d4d['set']('Content-Range',_0x28510a+'-'+_0x3c8bca+'/'+_0xb63530)[_0xb0fc('0x18')](_0x3437f4);}return null;};}function patchUpdates(_0x3020b1){return function(_0x423d61){try{jsonpatch[_0xb0fc('0x1d')](_0x423d61,_0x3020b1,!![]);}catch(_0x29c0b7){return BPromise[_0xb0fc('0x1e')](_0x29c0b7);}return _0x423d61[_0xb0fc('0x1f')]();};}function saveUpdates(_0x506cae,_0x24fc8b){return function(_0xaeb3e1){if(_0xaeb3e1){return _0xaeb3e1[_0xb0fc('0x20')](_0x506cae)[_0xb0fc('0x21')](function(_0x5d40f4){return _0x5d40f4;});}return null;};}function removeEntity(_0x36efcc,_0x1b08a0){return function(_0x3d8be4){if(_0x3d8be4){return _0x3d8be4[_0xb0fc('0x22')]()[_0xb0fc('0x21')](function(){var _0x894748=_0x3d8be4[_0xb0fc('0x23')]({'plain':!![]});var _0x1f30cc=_0xb0fc('0x24');return db['UserProfileResource'][_0xb0fc('0x22')]({'where':{'type':_0x1f30cc,'resourceId':_0x894748['id']}})[_0xb0fc('0x21')](function(){return _0x3d8be4;});})['then'](function(){_0x36efcc[_0xb0fc('0x16')](0xcc)[_0xb0fc('0x17')]();});}};}function handleEntityNotFound(_0x485fd4,_0x29a4b8){return function(_0x97ba5c){if(!_0x97ba5c){_0x485fd4[_0xb0fc('0x25')](0x194);}return _0x97ba5c;};}function handleError(_0x4cb5ab,_0x2750dc){_0x2750dc=_0x2750dc||0x1f4;return function(_0xb08487){logger[_0xb0fc('0x26')](_0xb08487[_0xb0fc('0x27')]);if(_0xb08487[_0xb0fc('0x28')]){delete _0xb08487[_0xb0fc('0x28')];}_0x4cb5ab[_0xb0fc('0x16')](_0x2750dc)['send'](_0xb08487);};}exports[_0xb0fc('0x29')]=function(_0xd83a29,_0x4044aa){var _0x10b723={},_0x5f5120={},_0x30bab3={'count':0x0,'rows':[]};var _0x452615=_['map'](db[_0xb0fc('0x2a')][_0xb0fc('0x2b')],function(_0x276c6b){return{'name':_0x276c6b[_0xb0fc('0x2c')],'type':_0x276c6b[_0xb0fc('0x2d')][_0xb0fc('0x2e')]};});_0x5f5120[_0xb0fc('0x2f')]=_[_0xb0fc('0x30')](_0x452615,'name');_0x5f5120[_0xb0fc('0x31')]=_[_0xb0fc('0x32')](_0xd83a29[_0xb0fc('0x31')]);_0x5f5120[_0xb0fc('0x33')]=_[_0xb0fc('0x34')](_0x5f5120['model'],_0x5f5120[_0xb0fc('0x31')]);_0x10b723['attributes']=_[_0xb0fc('0x34')](_0x5f5120[_0xb0fc('0x2f')],qs['fields'](_0xd83a29[_0xb0fc('0x31')][_0xb0fc('0x35')]));_0x10b723[_0xb0fc('0x36')]=_0x10b723['attributes'][_0xb0fc('0x37')]?_0x10b723[_0xb0fc('0x36')]:_0x5f5120[_0xb0fc('0x2f')];if(!_0xd83a29[_0xb0fc('0x31')][_0xb0fc('0x38')](_0xb0fc('0x39'))){_0x10b723[_0xb0fc('0x1c')]=qs[_0xb0fc('0x1c')](_0xd83a29['query']['limit']);_0x10b723[_0xb0fc('0x19')]=qs[_0xb0fc('0x19')](_0xd83a29[_0xb0fc('0x31')][_0xb0fc('0x19')]);}_0x10b723['order']=qs[_0xb0fc('0x3a')](_0xd83a29['query'][_0xb0fc('0x3a')]);delete _0xd83a29[_0xb0fc('0x31')][_0xb0fc('0x3a')];_0x10b723[_0xb0fc('0x3b')]=qs['filters'](_[_0xb0fc('0x3c')](_0xd83a29[_0xb0fc('0x31')],_0x5f5120[_0xb0fc('0x33')]),_0x452615);if(_0xd83a29['query'][_0xb0fc('0x3d')]){_0x10b723[_0xb0fc('0x3b')]=_['merge'](_0x10b723[_0xb0fc('0x3b')],{'$or':_[_0xb0fc('0x30')](_0x452615,function(_0x1c743c){if(_0x1c743c['type']!==_0xb0fc('0x3e')){var _0x3fd246={};_0x3fd246[_0x1c743c[_0xb0fc('0x28')]]={'$like':'%'+_0xd83a29['query'][_0xb0fc('0x3d')]+'%'};return _0x3fd246;}})});}_0x10b723=_[_0xb0fc('0x3f')]({},_0x10b723,_0xd83a29[_0xb0fc('0x40')]);var _0x35c605={'where':_0x10b723[_0xb0fc('0x3b')]};return db[_0xb0fc('0x2a')][_0xb0fc('0x1b')](_0x35c605)['then'](function(_0x193e63){_0x30bab3['count']=_0x193e63;if(_0xd83a29[_0xb0fc('0x31')]['includeAll']){_0x10b723[_0xb0fc('0x41')]=[{'all':!![]}];}return db[_0xb0fc('0x2a')][_0xb0fc('0x42')](_0x10b723);})[_0xb0fc('0x21')](function(_0x58e3bf){_0x30bab3[_0xb0fc('0x43')]=_0x58e3bf;return _0x30bab3;})[_0xb0fc('0x21')](respondWithFilteredResult(_0x4044aa,_0x10b723))[_0xb0fc('0x44')](handleError(_0x4044aa,null));};exports['show']=function(_0x185f46,_0x3ccd67){var _0x4d1a59={'raw':![],'where':{'id':_0x185f46[_0xb0fc('0x45')]['id']}},_0x500234={};_0x500234[_0xb0fc('0x2f')]=_[_0xb0fc('0x32')](db[_0xb0fc('0x2a')][_0xb0fc('0x2b')]);_0x500234['query']=_[_0xb0fc('0x32')](_0x185f46[_0xb0fc('0x31')]);_0x500234[_0xb0fc('0x33')]=_[_0xb0fc('0x34')](_0x500234[_0xb0fc('0x2f')],_0x500234[_0xb0fc('0x31')]);_0x4d1a59[_0xb0fc('0x36')]=_[_0xb0fc('0x34')](_0x500234[_0xb0fc('0x2f')],qs[_0xb0fc('0x35')](_0x185f46[_0xb0fc('0x31')][_0xb0fc('0x35')]));_0x4d1a59[_0xb0fc('0x36')]=_0x4d1a59[_0xb0fc('0x36')][_0xb0fc('0x37')]?_0x4d1a59[_0xb0fc('0x36')]:_0x500234[_0xb0fc('0x2f')];if(_0x185f46[_0xb0fc('0x31')][_0xb0fc('0x46')]){_0x4d1a59['include']=[{'all':!![]}];}_0x4d1a59=_[_0xb0fc('0x3f')]({},_0x4d1a59,_0x185f46[_0xb0fc('0x40')]);return db['VoiceMusicOnHold'][_0xb0fc('0x47')](_0x4d1a59)[_0xb0fc('0x21')](handleEntityNotFound(_0x3ccd67,null))[_0xb0fc('0x21')](respondWithResult(_0x3ccd67,null))[_0xb0fc('0x44')](handleError(_0x3ccd67,null));};exports[_0xb0fc('0x20')]=function(_0x1caa70,_0x126aaa){if(_0x1caa70['body']['id']){delete _0x1caa70['body']['id'];}return db['VoiceMusicOnHold'][_0xb0fc('0x47')]({'where':{'id':_0x1caa70[_0xb0fc('0x45')]['id']}})[_0xb0fc('0x21')](handleEntityNotFound(_0x126aaa,null))[_0xb0fc('0x21')](saveUpdates(_0x1caa70[_0xb0fc('0x48')],null))[_0xb0fc('0x21')](respondWithResult(_0x126aaa,null))[_0xb0fc('0x44')](handleError(_0x126aaa,null));};exports[_0xb0fc('0x49')]=function(_0x15d154,_0x43a0df,_0x3d5774){return db[_0xb0fc('0x4a')][_0xb0fc('0x4b')](function(_0x2f58b0){if(_0x15d154[_0xb0fc('0x48')][_0xb0fc('0x4c')]===_0xb0fc('0x4d')){_0x15d154[_0xb0fc('0x48')]['directory']=path[_0xb0fc('0x4e')](config[_0xb0fc('0x4f')],'server/files/moh',_0x15d154[_0xb0fc('0x48')][_0xb0fc('0x28')]);}return db['VoiceMusicOnHold']['create'](_0x15d154[_0xb0fc('0x48')],{'transaction':_0x2f58b0})[_0xb0fc('0x21')](function(_0xdc723f){if(_0x15d154['body'][_0xb0fc('0x4c')]===_0xb0fc('0x4d')){fs[_0xb0fc('0x50')](_0xdc723f['directory'],parseInt('0777',0x8));}var _0x528a7c=_0x15d154[_0xb0fc('0x51')][_0xb0fc('0x23')]({'plain':!![]});if(!_0x528a7c)throw new Error(_0xb0fc('0x52'));if(_0x528a7c[_0xb0fc('0x53')]===_0xb0fc('0x51')){var _0x29ffc9=_0xdc723f[_0xb0fc('0x23')]({'plain':!![]});return db[_0xb0fc('0x54')][_0xb0fc('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x528a7c[_0xb0fc('0x55')]},'raw':!![]})[_0xb0fc('0x21')](function(_0x203190){if(_0x203190&&_0x203190['autoAssociation']===0x0){return db[_0xb0fc('0x56')]['create']({'name':_0x29ffc9[_0xb0fc('0x28')],'resourceId':_0x29ffc9['id'],'type':_0x203190[_0xb0fc('0x28')],'sectionId':_0x203190['id']},{})[_0xb0fc('0x21')](function(){return _0xdc723f;});}else{return _0xdc723f;}})[_0xb0fc('0x44')](function(_0x1b6fea){logger[_0xb0fc('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b6fea);});}return _0xdc723f;});})[_0xb0fc('0x21')](respondWithResult(_0x43a0df,0xc9))[_0xb0fc('0x44')](handleError(_0x43a0df,null));};exports[_0xb0fc('0x22')]=function(_0x5004f4,_0x1646fb,_0x159f4f){var _0x2b0f8e;return db['VoiceMusicOnHold'][_0xb0fc('0x47')]({'where':{'id':_0x5004f4[_0xb0fc('0x45')]['id']}})[_0xb0fc('0x21')](function(_0x3b3c09){if(_0x3b3c09){return db[_0xb0fc('0x4a')]['transaction'](function(_0x44ec6c){return _0x3b3c09[_0xb0fc('0x22')]({'transaction':_0x44ec6c,'raw':!![]})[_0xb0fc('0x21')](function(_0x1144e1){if(_0x1144e1['directory']){fs[_0xb0fc('0x57')](_0x1144e1['directory'])[_0xb0fc('0x58')](function(_0x5d5926){fs[_0xb0fc('0x59')](path['join'](_0x1144e1['directory'],_0x5d5926));});fs[_0xb0fc('0x5a')](_0x1144e1['directory']);}return _0x1144e1;});})[_0xb0fc('0x44')](function(_0x305d2a){throw new db[(_0xb0fc('0x5b'))][(_0xb0fc('0x5c'))](_0x305d2a['message']);});}})[_0xb0fc('0x21')](handleEntityNotFound(_0x1646fb,null))[_0xb0fc('0x21')](removeEntity(_0x1646fb,null))[_0xb0fc('0x44')](handleError(_0x1646fb,null));};exports[_0xb0fc('0x5d')]=function(_0x501404,_0x2a34fb,_0xb05519){return db[_0xb0fc('0x4a')][_0xb0fc('0x4b')](function(_0x55a45f){var _0x3c935b;return db[_0xb0fc('0x2a')][_0xb0fc('0x47')]({'where':{'id':_0x501404[_0xb0fc('0x45')]['id']}})[_0xb0fc('0x21')](function(_0x12a475){if(_0x12a475){_0x3c935b=_0x12a475;return _0x12a475[_0xb0fc('0x5d')](_0x501404[_0xb0fc('0x48')]['id'],{'transaction':_0x55a45f});}})[_0xb0fc('0x21')](function(_0x3acb9f){if(_0x3acb9f){return db[_0xb0fc('0x5e')][_0xb0fc('0x5f')]({'where':{'id':_0x501404[_0xb0fc('0x48')]['id']},'attributes':['id',_0xb0fc('0x28'),_0xb0fc('0x60'),_0xb0fc('0x61'),_0xb0fc('0x62')],'raw':!![]});}})[_0xb0fc('0x21')](function(_0x34a81d){if(_0x34a81d){var _0x24c88f=path[_0xb0fc('0x4e')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',path[_0xb0fc('0x63')](_0x34a81d['save_name'],path['extname'](_0x34a81d[_0xb0fc('0x60')])),_0x34a81d['converted_format']));var _0x4d70fe=path[_0xb0fc('0x4e')](config[_0xb0fc('0x4f')],_0xb0fc('0x64'),_0x3c935b[_0xb0fc('0x28')],util['format']('%s.%s',_0x34a81d[_0xb0fc('0x28')],_0x34a81d[_0xb0fc('0x61')]));fs[_0xb0fc('0x65')](_0x24c88f,_0x4d70fe);return _0x34a81d;}})[_0xb0fc('0x44')](function(_0x2de86d){throw new db[(_0xb0fc('0x5b'))][(_0xb0fc('0x5c'))](_0x2de86d['message']);});})['then'](handleEntityNotFound(_0x2a34fb,null))[_0xb0fc('0x21')](respondWithResult(_0x2a34fb,0xc9))['catch'](handleError(_0x2a34fb,null));};exports['removeSound']=function(_0x5f00b7,_0x3bfc34,_0x590d7a){return db['sequelize'][_0xb0fc('0x4b')](function(_0xfe6f1e){var _0x443b27;return db[_0xb0fc('0x2a')][_0xb0fc('0x5f')]({'where':{'id':_0x5f00b7[_0xb0fc('0x45')]['id']}})[_0xb0fc('0x21')](handleEntityNotFound(_0x3bfc34,null))[_0xb0fc('0x21')](function(_0x52e3af){if(_0x52e3af){_0x443b27=_0x52e3af;return _0x52e3af[_0xb0fc('0x66')](_0x5f00b7[_0xb0fc('0x45')][_0xb0fc('0x67')]);}})[_0xb0fc('0x21')](function(_0x4c5ede){if(_0x4c5ede){return db[_0xb0fc('0x5e')][_0xb0fc('0x5f')]({'where':{'id':_0x5f00b7[_0xb0fc('0x45')][_0xb0fc('0x67')]},'attributes':['id','name',_0xb0fc('0x60'),'converted_format',_0xb0fc('0x62')],'raw':!![]});}})[_0xb0fc('0x21')](function(_0x183a07){if(_0x183a07){fs[_0xb0fc('0x59')](path[_0xb0fc('0x4e')](_0x443b27[_0xb0fc('0x68')],util[_0xb0fc('0x69')](_0xb0fc('0x6a'),_0x183a07['name'],_0x183a07[_0xb0fc('0x61')])));return _0x183a07;}})['catch'](function(_0x4f3081){throw new db[(_0xb0fc('0x5b'))][(_0xb0fc('0x5c'))](_0x4f3081[_0xb0fc('0x6b')]);});})[_0xb0fc('0x21')](handleEntityNotFound(_0x3bfc34,null))[_0xb0fc('0x21')](respondWithStatusCode(_0x3bfc34,0xcc))[_0xb0fc('0x44')](handleError(_0x3bfc34,null));};exports[_0xb0fc('0x6c')]=function(_0x134ca0,_0x26e014,_0x2c803e){var _0x38b088={};var _0x2171a9={};var _0x387dac;var _0x171ffc;return db[_0xb0fc('0x2a')][_0xb0fc('0x5f')]({'where':{'id':_0x134ca0['params']['id']}})['then'](handleEntityNotFound(_0x26e014,null))[_0xb0fc('0x21')](function(_0x3be24f){if(_0x3be24f){_0x387dac=_0x3be24f;_0x2171a9[_0xb0fc('0x2f')]=_['keys'](db[_0xb0fc('0x5e')][_0xb0fc('0x2b')]);_0x2171a9[_0xb0fc('0x31')]=_[_0xb0fc('0x32')](_0x134ca0[_0xb0fc('0x31')]);_0x2171a9[_0xb0fc('0x33')]=_[_0xb0fc('0x34')](_0x2171a9['model'],_0x2171a9[_0xb0fc('0x31')]);_0x38b088[_0xb0fc('0x36')]=_[_0xb0fc('0x34')](_0x2171a9[_0xb0fc('0x2f')],qs[_0xb0fc('0x35')](_0x134ca0['query'][_0xb0fc('0x35')]));_0x38b088[_0xb0fc('0x36')]=_0x38b088[_0xb0fc('0x36')][_0xb0fc('0x37')]?_0x38b088[_0xb0fc('0x36')]:_0x2171a9[_0xb0fc('0x2f')];_0x38b088[_0xb0fc('0x6d')]=qs['sort'](_0x134ca0['query'][_0xb0fc('0x3a')]);_0x38b088[_0xb0fc('0x3b')]=qs[_0xb0fc('0x33')](_[_0xb0fc('0x3c')](_0x134ca0[_0xb0fc('0x31')],_0x2171a9[_0xb0fc('0x33')]));if(_0x134ca0[_0xb0fc('0x31')][_0xb0fc('0x3d')]){_0x38b088[_0xb0fc('0x3b')]=_[_0xb0fc('0x3f')](_0x38b088[_0xb0fc('0x3b')],{'$or':_[_0xb0fc('0x30')](_0x38b088[_0xb0fc('0x36')],function(_0x546a2e){var _0x4f653d={};_0x4f653d[_0x546a2e]={'$like':'%'+_0x134ca0[_0xb0fc('0x31')][_0xb0fc('0x3d')]+'%'};return _0x4f653d;})});}_0x38b088=_[_0xb0fc('0x3f')]({},_0x38b088,_0x134ca0[_0xb0fc('0x40')]);return _0x387dac[_0xb0fc('0x6c')](_0x38b088);}})['then'](function(_0x5d92ca){if(_0x5d92ca){_0x171ffc=_0x5d92ca['length'];if(!_0x134ca0[_0xb0fc('0x31')][_0xb0fc('0x38')](_0xb0fc('0x39'))){_0x38b088[_0xb0fc('0x1c')]=qs[_0xb0fc('0x1c')](_0x134ca0[_0xb0fc('0x31')]['limit']);_0x38b088[_0xb0fc('0x19')]=qs[_0xb0fc('0x19')](_0x134ca0[_0xb0fc('0x31')][_0xb0fc('0x19')]);}return _0x387dac[_0xb0fc('0x6c')](_0x38b088);}})['then'](function(_0x14c7a5){if(_0x14c7a5){return _0x14c7a5?{'count':_0x171ffc,'rows':_0x14c7a5}:null;}})['then'](respondWithResult(_0x26e014,null))[_0xb0fc('0x44')](handleError(_0x26e014,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3b8c9bb..12f5cc3 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 _0x69b6=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x368ffd,_0x147cbe){var _0x3b4aa1=function(_0x1a2d1d){while(--_0x1a2d1d){_0x368ffd['push'](_0x368ffd['shift']());}};_0x3b4aa1(++_0x147cbe);}(_0x69b6,0x139));var _0x669b=function(_0x104d23,_0x39fb6c){_0x104d23=_0x104d23-0x0;var _0x1988c5=_0x69b6[_0x104d23];return _0x1988c5;};'use strict';var _=require(_0x669b('0x0'));var util=require(_0x669b('0x1'));var logger=require(_0x669b('0x2'))(_0x669b('0x3'));var moment=require(_0x669b('0x4'));var BPromise=require(_0x669b('0x5'));var rp=require(_0x669b('0x6'));var fs=require('fs');var path=require(_0x669b('0x7'));var rimraf=require(_0x669b('0x8'));var config=require(_0x669b('0x9'));var attributes=require(_0x669b('0xa'));module['exports']=function(_0x3a72d9,_0x3174eb){return _0x3a72d9[_0x669b('0xb')](_0x669b('0xc'),attributes,{'tableName':_0x669b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc886=['voice_musiconhold','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold'];(function(_0x51179f,_0x2d93f7){var _0x184c8d=function(_0x122038){while(--_0x122038){_0x51179f['push'](_0x51179f['shift']());}};_0x184c8d(++_0x2d93f7);}(_0xc886,0x135));var _0x6c88=function(_0x343801,_0x3e4437){_0x343801=_0x343801-0x0;var _0x3425b0=_0xc886[_0x343801];return _0x3425b0;};'use strict';var _=require(_0x6c88('0x0'));var util=require(_0x6c88('0x1'));var logger=require(_0x6c88('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c88('0x3'));var rp=require(_0x6c88('0x4'));var fs=require('fs');var path=require(_0x6c88('0x5'));var rimraf=require(_0x6c88('0x6'));var config=require(_0x6c88('0x7'));var attributes=require(_0x6c88('0x8'));module['exports']=function(_0x1f882c,_0x135fa7){return _0x1f882c['define'](_0x6c88('0x9'),attributes,{'tableName':_0x6c88('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index d76f2f2..9f7ba8d 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3ea2d4,_0x441498){var _0x8a7bf4=function(_0xbcc99e){while(--_0xbcc99e){_0x3ea2d4['push'](_0x3ea2d4['shift']());}};_0x8a7bf4(++_0x441498);}(_0x34e8,0x12c));var _0x834e=function(_0x1b7e8a,_0x232851){_0x1b7e8a=_0x1b7e8a-0x0;var _0x4033fe=_0x34e8[_0x1b7e8a];return _0x4033fe;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +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(_0x273b4b,_0x4ce452){var _0x53eaae=function(_0x4ea919){while(--_0x4ea919){_0x273b4b['push'](_0x273b4b['shift']());}};_0x53eaae(++_0x4ce452);}(_0xe706,0xa3));var _0x6e70=function(_0x235f7f,_0x4cc112){_0x235f7f=_0x235f7f-0x0;var _0x3bf31e=_0xe706[_0x235f7f];return _0x3bf31e;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c5bd096..ea310ce 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 _0xee24=['update','delete','destroy','removeAgents','removeTeams','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','getAgents','/:id/teams','post','create','addAgents','put'];(function(_0x1814fa,_0x5b2c26){var _0x18e64c=function(_0x190ecd){while(--_0x190ecd){_0x1814fa['push'](_0x1814fa['shift']());}};_0x18e64c(++_0x5b2c26);}(_0xee24,0x1a6));var _0x4ee2=function(_0x188db2,_0x48d1fa){_0x188db2=_0x188db2-0x0;var _0x37e450=_0xee24[_0x188db2];return _0x37e450;};'use strict';var multer=require('multer');var util=require(_0x4ee2('0x0'));var path=require(_0x4ee2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ee2('0x2'));var router=express[_0x4ee2('0x3')]();var fs_extra=require(_0x4ee2('0x4'));var auth=require(_0x4ee2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ee2('0x6'));var controller=require(_0x4ee2('0x7'));router[_0x4ee2('0x8')]('/',auth[_0x4ee2('0x9')](),controller['index']);router[_0x4ee2('0x8')](_0x4ee2('0xa'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xb')]);router[_0x4ee2('0x8')](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xd')]);router['get']('/:id/users',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xe')]);router[_0x4ee2('0x8')](_0x4ee2('0xf'),auth[_0x4ee2('0x9')](),controller['getTeams']);router[_0x4ee2('0x10')]('/',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x11')]);router[_0x4ee2('0x10')]('/:id/users',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x12')]);router[_0x4ee2('0x10')](_0x4ee2('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x4ee2('0x13')](_0x4ee2('0xc'),auth['isAuthenticated'](),controller[_0x4ee2('0x14')]);router[_0x4ee2('0x15')](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x16')]);router[_0x4ee2('0x15')]('/:id/users',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x17')]);router[_0x4ee2('0x15')]('/:id/teams',auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x18')]);module[_0x4ee2('0x19')]=router; \ No newline at end of file +var _0x58ef=['/:id','show','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','removeTeams','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x58ef,0x1ce));var _0xf58e=function(_0xc1de64,_0x904dbf){_0xc1de64=_0xc1de64-0x0;var _0x4b1137=_0x58ef[_0xc1de64];return _0x4b1137;};'use strict';var multer=require(_0xf58e('0x0'));var util=require('util');var path=require(_0xf58e('0x1'));var timeout=require(_0xf58e('0x2'));var express=require(_0xf58e('0x3'));var router=express[_0xf58e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf58e('0x5'));var interaction=require(_0xf58e('0x6'));var config=require(_0xf58e('0x7'));var controller=require(_0xf58e('0x8'));router[_0xf58e('0x9')]('/',auth[_0xf58e('0xa')](),controller[_0xf58e('0xb')]);router[_0xf58e('0x9')](_0xf58e('0xc'),auth['isAuthenticated'](),controller[_0xf58e('0xd')]);router['get'](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0xf')]);router[_0xf58e('0x9')]('/:id/users',auth[_0xf58e('0xa')](),controller['getAgents']);router[_0xf58e('0x9')](_0xf58e('0x10'),auth['isAuthenticated'](),controller[_0xf58e('0x11')]);router[_0xf58e('0x12')]('/',auth[_0xf58e('0xa')](),controller[_0xf58e('0x13')]);router[_0xf58e('0x12')](_0xf58e('0x14'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x15')]);router['post'](_0xf58e('0x10'),auth[_0xf58e('0xa')](),controller['addTeams']);router[_0xf58e('0x16')](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x17')]);router[_0xf58e('0x18')](_0xf58e('0xe'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x19')]);router[_0xf58e('0x18')](_0xf58e('0x14'),auth['isAuthenticated'](),controller[_0xf58e('0x1a')]);router[_0xf58e('0x18')](_0xf58e('0x10'),auth[_0xf58e('0xa')](),controller[_0xf58e('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 966afd0..15cfabd 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 _0x3a18=['sequelize','exports','name','VIRTUAL','getDataValue','STRING','INTEGER'];(function(_0x36fde7,_0x59f562){var _0x4b04ee=function(_0x1da06f){while(--_0x1da06f){_0x36fde7['push'](_0x36fde7['shift']());}};_0x4b04ee(++_0x59f562);}(_0x3a18,0x142));var _0x83a1=function(_0x4a6159,_0x24aefc){_0x4a6159=_0x4a6159-0x0;var _0x11a6a0=_0x3a18[_0x4a6159];return _0x11a6a0;};'use strict';var Sequelize=require(_0x83a1('0x0'));module[_0x83a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x83a1('0x2')},'prefix':{'type':Sequelize[_0x83a1('0x3')],'get':function(_0x27e47f){return'system-'+this[_0x83a1('0x4')](_0x83a1('0x2'))+'-';}},'description':{'type':Sequelize[_0x83a1('0x5')]},'callerIdAll':{'type':Sequelize[_0x83a1('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x83a1('0x6')]}}; \ No newline at end of file +var _0x11ae=['exports','STRING','name','system-','INTEGER'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x11ae,0x113));var _0xe11a=function(_0x3e786a,_0x7490ff){_0x3e786a=_0x3e786a-0x0;var _0x3a9454=_0x11ae[_0x3e786a];return _0x3a9454;};'use strict';var Sequelize=require('sequelize');module[_0xe11a('0x0')]={'name':{'type':Sequelize[_0xe11a('0x1')],'allowNull':![],'unique':_0xe11a('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4914f9){return _0xe11a('0x3')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xe11a('0x1')]},'callerIdAll':{'type':Sequelize[_0xe11a('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xe11a('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ccc4945..4975184 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 _0xd943=['isArray','userVoicePrefix:remove','getAgents','User','getTeams','Team','addTeams','Agents','online','flatMap','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rawAttributes','merge','options','find','catch','params','describe','create','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','emit'];(function(_0x3078c9,_0x3667fb){var _0x2e1fe1=function(_0x5cbe85){while(--_0x5cbe85){_0x3078c9['push'](_0x3078c9['shift']());}};_0x2e1fe1(++_0x3667fb);}(_0xd943,0x15d));var _0x3d94=function(_0x3d69d4,_0x15847b){_0x3d69d4=_0x3d69d4-0x0;var _0x379d30=_0xd943[_0x3d69d4];return _0x379d30;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];config[_0x3d94('0x16')]=_['defaults'](config[_0x3d94('0x16')],{'host':_0x3d94('0x17'),'port':0x18eb});var socket=require(_0x3d94('0x18'))(new Redis(config['redis']));require(_0x3d94('0x19'))[_0x3d94('0x1a')](socket);function respondWithStatusCode(_0x7d6969,_0x5d9366){_0x5d9366=_0x5d9366||0xcc;return function(_0x14ea5f){if(_0x14ea5f){return _0x7d6969[_0x3d94('0x1b')](_0x5d9366);}return _0x7d6969[_0x3d94('0x1c')](_0x5d9366)[_0x3d94('0x1d')]();};}function respondWithResult(_0xaf939a,_0xd8efaa){_0xd8efaa=_0xd8efaa||0xc8;return function(_0x31c6e8){if(_0x31c6e8){return _0xaf939a[_0x3d94('0x1c')](_0xd8efaa)['json'](_0x31c6e8);}};}function respondWithFilteredResult(_0x22676a,_0x1a9315){return function(_0x2acee3){if(_0x2acee3){var _0x1c35a8=typeof _0x1a9315[_0x3d94('0x1e')]===_0x3d94('0x1f')&&typeof _0x1a9315[_0x3d94('0x20')]==='undefined';var _0x9bca24=_0x2acee3['count'];var _0x28bead=_0x1c35a8?0x0:_0x1a9315[_0x3d94('0x1e')];var _0x16a6d0=_0x1c35a8?_0x2acee3[_0x3d94('0x21')]:_0x1a9315[_0x3d94('0x1e')]+_0x1a9315['limit'];var _0x578002;if(_0x16a6d0>=_0x9bca24){_0x16a6d0=_0x9bca24;_0x578002=0xc8;}else{_0x578002=0xce;}_0x22676a[_0x3d94('0x1c')](_0x578002);return _0x22676a[_0x3d94('0x22')](_0x3d94('0x23'),_0x28bead+'-'+_0x16a6d0+'/'+_0x9bca24)['json'](_0x2acee3);}return null;};}function patchUpdates(_0x30af25){return function(_0x2e8c91){try{jsonpatch[_0x3d94('0x24')](_0x2e8c91,_0x30af25,!![]);}catch(_0x384f76){return BPromise[_0x3d94('0x25')](_0x384f76);}return _0x2e8c91[_0x3d94('0x26')]();};}function saveUpdates(_0x295493,_0x27f978){return function(_0xee7b8d){if(_0xee7b8d){return _0xee7b8d[_0x3d94('0x27')](_0x295493)[_0x3d94('0x28')](function(_0x192839){return _0x192839;});}return null;};}function removeEntity(_0x292976,_0x3496c3){return function(_0x2945d2){if(_0x2945d2){return _0x2945d2['destroy']()[_0x3d94('0x28')](function(){var _0x558fd2=_0x2945d2[_0x3d94('0x29')]({'plain':!![]});var _0x1d0a7a=_0x3d94('0x2a');return db[_0x3d94('0x2b')][_0x3d94('0x2c')]({'where':{'type':_0x1d0a7a,'resourceId':_0x558fd2['id']}})[_0x3d94('0x28')](function(){return _0x2945d2;});})[_0x3d94('0x28')](function(){_0x292976['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x362642,_0x4813e1){return function(_0x4dd410){if(!_0x4dd410){_0x362642[_0x3d94('0x1b')](0x194);}return _0x4dd410;};}function handleError(_0x58c0d0,_0x19bfd4){_0x19bfd4=_0x19bfd4||0x1f4;return function(_0xef9644){logger[_0x3d94('0x2d')](_0xef9644['stack']);if(_0xef9644[_0x3d94('0x2e')]){delete _0xef9644['name'];}_0x58c0d0[_0x3d94('0x1c')](_0x19bfd4)['send'](_0xef9644);};}exports[_0x3d94('0x2f')]=function(_0x215ad7,_0x29b1ff){var _0x246f88={},_0x50560c={},_0x18f854={'count':0x0,'rows':[]};var _0x51f634=_[_0x3d94('0x30')](db[_0x3d94('0x31')]['rawAttributes'],function(_0x5288da){return{'name':_0x5288da[_0x3d94('0x32')],'type':_0x5288da[_0x3d94('0x33')][_0x3d94('0x34')]};});_0x50560c['model']=_[_0x3d94('0x30')](_0x51f634,_0x3d94('0x2e'));_0x50560c['query']=_[_0x3d94('0x35')](_0x215ad7[_0x3d94('0x36')]);_0x50560c[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],_0x50560c['query']);_0x246f88[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0x50560c[_0x3d94('0x39')],qs[_0x3d94('0x3b')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x246f88['attributes']=_0x246f88['attributes'][_0x3d94('0x3c')]?_0x246f88[_0x3d94('0x3a')]:_0x50560c[_0x3d94('0x39')];if(!_0x215ad7[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x246f88[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x20')]);_0x246f88['offset']=qs[_0x3d94('0x1e')](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x1e')]);}_0x246f88[_0x3d94('0x3f')]=qs['sort'](_0x215ad7[_0x3d94('0x36')][_0x3d94('0x40')]);_0x246f88[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x215ad7['query'],_0x50560c[_0x3d94('0x37')]),_0x51f634);if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]){_0x246f88['where']=_['merge'](_0x246f88['where'],{'$or':_['map'](_0x51f634,function(_0x3b3550){if(_0x3b3550[_0x3d94('0x33')]!==_0x3d94('0x44')){var _0x146ccb={};_0x146ccb[_0x3b3550[_0x3d94('0x2e')]]={'$like':'%'+_0x215ad7[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x146ccb;}})});}_0x246f88=_['merge']({},_0x246f88,_0x215ad7['options']);var _0x118fda={'where':_0x246f88[_0x3d94('0x41')]};return db['VoicePrefix'][_0x3d94('0x21')](_0x118fda)['then'](function(_0x1361fb){_0x18f854[_0x3d94('0x21')]=_0x1361fb;if(_0x215ad7[_0x3d94('0x36')][_0x3d94('0x45')]){_0x246f88[_0x3d94('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0x3d94('0x47')](_0x246f88);})[_0x3d94('0x28')](function(_0x18a70c){_0x18f854['rows']=_0x18a70c;return _0x18f854;})[_0x3d94('0x28')](respondWithFilteredResult(_0x29b1ff,_0x246f88))['catch'](handleError(_0x29b1ff,null));};exports['show']=function(_0x3f4b32,_0x402132){var _0x6190cc={'raw':![],'where':{'id':_0x3f4b32['params']['id']}},_0xfeae3a={};_0xfeae3a[_0x3d94('0x39')]=_['keys'](db[_0x3d94('0x31')][_0x3d94('0x48')]);_0xfeae3a[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x3f4b32[_0x3d94('0x36')]);_0xfeae3a[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xfeae3a['model'],_0xfeae3a[_0x3d94('0x36')]);_0x6190cc[_0x3d94('0x3a')]=_['intersection'](_0xfeae3a['model'],qs[_0x3d94('0x3b')](_0x3f4b32[_0x3d94('0x36')]['fields']));_0x6190cc[_0x3d94('0x3a')]=_0x6190cc[_0x3d94('0x3a')][_0x3d94('0x3c')]?_0x6190cc[_0x3d94('0x3a')]:_0xfeae3a[_0x3d94('0x39')];if(_0x3f4b32[_0x3d94('0x36')][_0x3d94('0x45')]){_0x6190cc[_0x3d94('0x46')]=[{'all':!![]}];}_0x6190cc=_[_0x3d94('0x49')]({},_0x6190cc,_0x3f4b32[_0x3d94('0x4a')]);return db[_0x3d94('0x31')][_0x3d94('0x4b')](_0x6190cc)[_0x3d94('0x28')](handleEntityNotFound(_0x402132,null))[_0x3d94('0x28')](respondWithResult(_0x402132,null))[_0x3d94('0x4c')](handleError(_0x402132,null));};exports['destroy']=function(_0x44df82,_0x22e2b8){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x44df82[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x22e2b8,null))[_0x3d94('0x28')](removeEntity(_0x22e2b8,null))[_0x3d94('0x4c')](handleError(_0x22e2b8,null));};exports[_0x3d94('0x4e')]=function(_0x5465a5,_0x88ec05){return db['VoicePrefix'][_0x3d94('0x4e')]()[_0x3d94('0x28')](respondWithResult(_0x88ec05,null))['catch'](handleError(_0x88ec05,null));};exports[_0x3d94('0x4f')]=function(_0x49f544,_0x567751){var _0x335247;return db['sequelize'][_0x3d94('0x50')](function(_0x132e0b){return db['VoicePrefix'][_0x3d94('0x4f')](_0x49f544['body'],{'transaction':_0x132e0b})['then'](function(_0x1a91d9){_0x335247=_0x1a91d9[_0x3d94('0x29')]({'plain':!![]});return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x335247[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x137052){return createVoicePrefixExtensions(_0x335247,_0x137052,_0x132e0b);});});})[_0x3d94('0x28')](function(){var _0xae892=_0x49f544['user'][_0x3d94('0x29')]({'plain':!![]});if(!_0xae892)throw new Error(_0x3d94('0x53'));if(_0xae892[_0x3d94('0x54')]===_0x3d94('0x55')){var _0xe7d1dc=_0x335247;return db[_0x3d94('0x56')][_0x3d94('0x4b')]({'where':{'name':_0x3d94('0x2a'),'userProfileId':_0xae892[_0x3d94('0x57')]},'raw':!![]})[_0x3d94('0x28')](function(_0x1fd806){if(_0x1fd806&&_0x1fd806['autoAssociation']===0x0){return db[_0x3d94('0x2b')]['create']({'name':_0xe7d1dc[_0x3d94('0x2e')],'resourceId':_0xe7d1dc['id'],'type':_0x1fd806[_0x3d94('0x2e')],'sectionId':_0x1fd806['id']},{})[_0x3d94('0x28')](function(){return _0x335247;});}else{return _0x335247;}})[_0x3d94('0x4c')](function(_0x3a837b){logger[_0x3d94('0x2d')](_0x3d94('0x58'),_0x3a837b);throw _0x3a837b;});}return _0x335247;})[_0x3d94('0x28')](respondWithResult(_0x567751,null))[_0x3d94('0x4c')](handleError(_0x567751,null));};function Extension(_0x5da38c,_0x519ada,_0x46bff3,_0x4bd97c){this[_0x3d94('0x59')]=_0x3d94('0x5a');this['exten']=_0x5da38c;this[_0x3d94('0x5b')]=_0x46bff3;this[_0x3d94('0x33')]=_0x3d94('0x5c');this[_0x3d94('0x5d')]=_0x3d94('0x5e');this[_0x3d94('0x5f')]=_0x519ada;this[_0x3d94('0x60')]=_0x4bd97c;}function createVoicePrefixExtensions(_0x4b023e,_0x22dbf9,_0x351ea6){return new BPromise(function(_0x368581,_0x4b23b5){var _0x2d8b49=new Extension(formatPrefixName(_0x4b023e[_0x3d94('0x61')]),0x1,_0x3d94('0x62'),_0x3d94('0x63'));_0x2d8b49['VoicePrefixId']=_0x4b023e['id'];return db['VoiceExtension'][_0x3d94('0x4f')](_0x2d8b49,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x4190ef){var _0x3eaecc=_0x4190ef['get']({'plain':!![]});var _0x1c12da=_[_0x3d94('0x30')](addVoicePrefixExtensions(_0x4b023e,_0x22dbf9),function(_0x49bfb0){_0x49bfb0[_0x3d94('0x52')]=_0x3eaecc['id'];_0x49bfb0[_0x3d94('0x64')]=_0x4b023e['id'];return _0x49bfb0;});return db[_0x3d94('0x51')]['bulkCreate'](_0x1c12da,{'transaction':_0x351ea6})[_0x3d94('0x28')](function(_0x227372){if(!_0x227372){return _0x4b23b5(_0x3d94('0x65'));}else{return _0x368581(_0x227372);}})['catch'](function(_0x11eeaa){return _0x4b23b5(_0x11eeaa);});});;});};function addVoicePrefixExtensions(_0x68c033,_0x5c7aac){var _0x4d291e=[];var _0x4e1932=formatPrefixName(_0x68c033[_0x3d94('0x61')]);_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x2,_0x3d94('0x67'),_0x3d94('0x68')+_0x68c033[_0x3d94('0x2e')]));if(_0x68c033['callerIdAll']){_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x67'),_0x3d94('0x69')+_0x68c033[_0x3d94('0x6a')]));}else{_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x3,_0x3d94('0x62'),'No\x20callerid\x20available'));}_0x4d291e[_0x3d94('0x66')](new Extension(_0x4e1932,0x4,'goto',_0x5c7aac[_0x3d94('0x59')]+','+_0x3d94('0x6b')+(0x8+_0x68c033[_0x3d94('0x2e')][_0x3d94('0x3c')])+'}'+','+0x1));return _0x4d291e;}function formatPrefixName(_0x128fdc){var _0x350ad3='_';for(var _0x48b108=0x0;_0x48b108<_0x128fdc['length'];_0x48b108++){if(_0x128fdc[_0x3d94('0x6c')](_0x48b108)=='-'){_0x350ad3+=_0x128fdc['charAt'](_0x48b108);}else{_0x350ad3+='['+_0x128fdc['charAt'](_0x48b108)+']';}}_0x350ad3+='.';return _0x350ad3;}exports['update']=function(_0x3c7dc4,_0x262a6a,_0x222963){var _0x396146=_0x3c7dc4[_0x3d94('0x6d')];_0x396146[_0x3d94('0x61')]=_0x3d94('0x6e')+_0x396146[_0x3d94('0x2e')]+'-';return db['sequelize'][_0x3d94('0x50')](function(_0x5e55a4){return db[_0x3d94('0x31')][_0x3d94('0x27')](_0x396146,{'where':{'id':_0x396146['id']},'transaction':_0x5e55a4})[_0x3d94('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x396146['id']},'transaction':_0x5e55a4})['then'](function(){return db[_0x3d94('0x51')][_0x3d94('0x4b')]({'where':{'id':_0x396146[_0x3d94('0x52')]},'raw':!![]})[_0x3d94('0x28')](function(_0x2382df){return createVoicePrefixExtensions(_0x396146,_0x2382df,_0x5e55a4);});});});})['then'](function(){return db['VoicePrefix'][_0x3d94('0x6f')](_0x396146['id']);})[_0x3d94('0x28')](respondWithResult(_0x262a6a,null))[_0x3d94('0x4c')](handleError(_0x262a6a,null));};exports['addAgents']=function(_0x46a9af,_0x53d471,_0x255d56){return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x46a9af[_0x3d94('0x4d')]['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x53d471,null))[_0x3d94('0x28')](function(_0x234bce){if(_0x234bce){return _0x234bce[_0x3d94('0x70')](_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')],_[_0x3d94('0x72')](_0x46a9af[_0x3d94('0x6d')],[_0x3d94('0x71'),'id'])||{})['spread'](function(_0x2a6df3){for(var _0x2819e2=0x0;_0x2819e2<_0x46a9af[_0x3d94('0x6d')][_0x3d94('0x71')]['length'];_0x2819e2+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:save',{'UserId':Number(_0x46a9af['body'][_0x3d94('0x71')][_0x2819e2]),'VoicePrefixId':Number(_0x46a9af['params']['id'])});}return _0x2a6df3;});}})[_0x3d94('0x28')](respondWithResult(_0x53d471,null))[_0x3d94('0x4c')](handleError(_0x53d471,null));};exports['removeAgents']=function(_0x4558ff,_0x4acb44,_0x3b612f){return db[_0x3d94('0x31')]['find']({'where':{'id':_0x4558ff['params']['id']}})['then'](handleEntityNotFound(_0x4acb44,null))[_0x3d94('0x28')](function(_0x5b2dd6){if(_0x5b2dd6){return _0x5b2dd6['removeAgents'](_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')])[_0x3d94('0x28')](function(){if(_[_0x3d94('0x74')](_0x4558ff['query'][_0x3d94('0x71')])){for(var _0x3fc0e7=0x0;_0x3fc0e7<_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3d94('0x3c')];_0x3fc0e7+=0x1){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')][_0x3fc0e7]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}}else{socket[_0x3d94('0x73')](_0x3d94('0x75'),{'UserId':Number(_0x4558ff[_0x3d94('0x36')][_0x3d94('0x71')]),'VoicePrefixId':Number(_0x4558ff[_0x3d94('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x4acb44,null))['catch'](handleError(_0x4acb44,null));};exports[_0x3d94('0x76')]=function(_0x23b1a6,_0x970b44,_0x561e65){var _0x43a00e={};var _0xa193a1={};var _0x43192c;var _0xdb96c0;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x23b1a6['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x970b44,null))[_0x3d94('0x28')](function(_0x274a82){if(_0x274a82){_0x43192c=_0x274a82;_0xa193a1[_0x3d94('0x39')]=_[_0x3d94('0x35')](db[_0x3d94('0x77')][_0x3d94('0x48')]);_0xa193a1[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x23b1a6[_0x3d94('0x36')]);_0xa193a1[_0x3d94('0x37')]=_[_0x3d94('0x38')](_0xa193a1[_0x3d94('0x39')],_0xa193a1['query']);_0x43a00e[_0x3d94('0x3a')]=_[_0x3d94('0x38')](_0xa193a1['model'],qs['fields'](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3b')]));_0x43a00e[_0x3d94('0x3a')]=_0x43a00e[_0x3d94('0x3a')]['length']?_0x43a00e['attributes']:_0xa193a1[_0x3d94('0x39')];_0x43a00e[_0x3d94('0x3f')]=qs[_0x3d94('0x40')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x40')]);_0x43a00e['where']=qs[_0x3d94('0x37')](_['pick'](_0x23b1a6[_0x3d94('0x36')],_0xa193a1[_0x3d94('0x37')]));if(_0x23b1a6[_0x3d94('0x36')]['filter']){_0x43a00e[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0x43a00e['where'],{'$or':_[_0x3d94('0x30')](_0x43a00e['attributes'],function(_0x3c62ec){var _0x401772={};_0x401772[_0x3c62ec]={'$like':'%'+_0x23b1a6[_0x3d94('0x36')]['filter']+'%'};return _0x401772;})});}_0x43a00e=_[_0x3d94('0x49')]({},_0x43a00e,_0x23b1a6[_0x3d94('0x4a')]);return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})['then'](function(_0x3e091a){if(_0x3e091a){_0xdb96c0=_0x3e091a[_0x3d94('0x3c')];if(!_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0x43a00e[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x23b1a6[_0x3d94('0x36')]['limit']);_0x43a00e[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x23b1a6[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x43192c[_0x3d94('0x76')](_0x43a00e);}})[_0x3d94('0x28')](function(_0x5716fd){if(_0x5716fd){return _0x5716fd?{'count':_0xdb96c0,'rows':_0x5716fd}:null;}})[_0x3d94('0x28')](respondWithResult(_0x970b44,null))[_0x3d94('0x4c')](handleError(_0x970b44,null));};exports[_0x3d94('0x78')]=function(_0x59b62b,_0x3fc2f2,_0x4c6c49){var _0xe85875={};var _0x3ed74f={};var _0x490d77;var _0x73b09c;return db[_0x3d94('0x31')]['findOne']({'where':{'id':_0x59b62b['params']['id']}})[_0x3d94('0x28')](handleEntityNotFound(_0x3fc2f2,null))[_0x3d94('0x28')](function(_0x48a22f){if(_0x48a22f){_0x490d77=_0x48a22f;_0x3ed74f['model']=_['keys'](db[_0x3d94('0x79')][_0x3d94('0x48')]);_0x3ed74f[_0x3d94('0x36')]=_[_0x3d94('0x35')](_0x59b62b[_0x3d94('0x36')]);_0x3ed74f['filters']=_[_0x3d94('0x38')](_0x3ed74f[_0x3d94('0x39')],_0x3ed74f[_0x3d94('0x36')]);_0xe85875['attributes']=_[_0x3d94('0x38')](_0x3ed74f['model'],qs[_0x3d94('0x3b')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3b')]));_0xe85875[_0x3d94('0x3a')]=_0xe85875[_0x3d94('0x3a')]['length']?_0xe85875['attributes']:_0x3ed74f[_0x3d94('0x39')];_0xe85875[_0x3d94('0x3f')]=qs['sort'](_0x59b62b[_0x3d94('0x36')]['sort']);_0xe85875[_0x3d94('0x41')]=qs[_0x3d94('0x37')](_[_0x3d94('0x42')](_0x59b62b['query'],_0x3ed74f[_0x3d94('0x37')]));if(_0x59b62b['query'][_0x3d94('0x43')]){_0xe85875[_0x3d94('0x41')]=_[_0x3d94('0x49')](_0xe85875[_0x3d94('0x41')],{'$or':_['map'](_0xe85875['attributes'],function(_0x11ff83){var _0x26e454={};_0x26e454[_0x11ff83]={'$like':'%'+_0x59b62b[_0x3d94('0x36')][_0x3d94('0x43')]+'%'};return _0x26e454;})});}_0xe85875=_['merge']({},_0xe85875,_0x59b62b[_0x3d94('0x4a')]);return _0x490d77['getTeams'](_0xe85875);}})['then'](function(_0x543b1a){if(_0x543b1a){_0x73b09c=_0x543b1a[_0x3d94('0x3c')];if(!_0x59b62b[_0x3d94('0x36')][_0x3d94('0x3d')](_0x3d94('0x3e'))){_0xe85875[_0x3d94('0x20')]=qs[_0x3d94('0x20')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x20')]);_0xe85875[_0x3d94('0x1e')]=qs[_0x3d94('0x1e')](_0x59b62b[_0x3d94('0x36')][_0x3d94('0x1e')]);}return _0x490d77[_0x3d94('0x78')](_0xe85875);}})[_0x3d94('0x28')](function(_0x140ad1){if(_0x140ad1){return _0x140ad1?{'count':_0x73b09c,'rows':_0x140ad1}:null;}})['then'](respondWithResult(_0x3fc2f2,null))['catch'](handleError(_0x3fc2f2,null));};exports[_0x3d94('0x7a')]=function(_0x3ff668,_0x1837c9,_0x41251d){var _0x876bcc=_0x3ff668[_0x3d94('0x6d')][_0x3d94('0x71')];var _0x47ab6a;return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x876bcc},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id',_0x3d94('0x2e'),_0x3d94('0x7c'),'voicePause','interface'],'raw':!![]}]})[_0x3d94('0x28')](function(_0x50e8ba){if(_0x50e8ba){_0x47ab6a=_0x50e8ba;var _0x248fbe=_[_0x3d94('0x7d')](_0x50e8ba,function(_0x350751){var _0x16853d=_0x350751[_0x3d94('0x29')]({'plain':!![]});return _0x16853d[_0x3d94('0x7b')];});return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x3ff668['params']['id']}})[_0x3d94('0x28')](function(_0x2c8a2f){return db[_0x3d94('0x7e')][_0x3d94('0x50')](function(_0x22e7ff){return _0x2c8a2f[_0x3d94('0x7a')](_0x876bcc,{'transaction':_0x22e7ff})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x47ab6a,function(_0x1c7315){return db[_0x3d94('0x80')][_0x3d94('0x81')]({'TeamId':_0x1c7315['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},{'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){return BPromise[_0x3d94('0x7f')](_0x248fbe,function(_0x2d02db){return db[_0x3d94('0x82')][_0x3d94('0x83')]({'where':{'UserId':_0x2d02db['id'],'VoicePrefixId':_0x3ff668[_0x3d94('0x4d')]['id']},'transaction':_0x22e7ff});});})[_0x3d94('0x28')](function(){_0x248fbe[_0x3d94('0x84')](function(_0xb55889){socket['emit'](_0x3d94('0x85'),{'UserId':_0xb55889['id'],'VoicePrefixId':_0x2c8a2f['id']});});});});});}})[_0x3d94('0x28')](respondWithStatusCode(_0x1837c9,null))[_0x3d94('0x4c')](handleError(_0x1837c9,null));};exports[_0x3d94('0x86')]=function(_0x434b19,_0x185592,_0x594800){return db[_0x3d94('0x79')][_0x3d94('0x47')]({'where':{'id':_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3d94('0x77')],'as':_0x3d94('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x185592,null))[_0x3d94('0x28')](function(_0x4ff1a0){var _0x577fd0=_['map'](_0x4ff1a0,'id');var _0x4a1faa=[];var _0x3e1139=[];var _0x77b79d=squel[_0x3d94('0x87')]();_0x77b79d[_0x3d94('0x88')](_0x3d94('0x89'))['from'](_0x3d94('0x8a'),'tq')[_0x3d94('0x8b')](_0x3d94('0x8c'),'ut',_0x3d94('0x8d'))[_0x3d94('0x41')](_0x3d94('0x8e'),_0x434b19['params']['id']);for(var _0x167d4c=0x0;_0x167d4c<_0x4ff1a0['length'];_0x167d4c+=0x1){let _0x219757=_0x4ff1a0[_0x167d4c];for(var _0xb970e1=0x0;_0xb970e1<_0x219757[_0x3d94('0x7b')][_0x3d94('0x3c')];_0xb970e1+=0x1){let _0x5df8b4=_0x219757[_0x3d94('0x7b')][_0xb970e1];var _0x2e409b=_0x77b79d[_0x3d94('0x8f')]();_0x2e409b[_0x3d94('0x41')]('ut.UserId\x20=\x20?',_0x5df8b4['id']);_0x3e1139['push'](db[_0x3d94('0x7e')][_0x3d94('0x36')](_0x2e409b[_0x3d94('0x90')](),{'type':db['sequelize'][_0x3d94('0x91')]['SELECT']})['then'](function(_0x560fdf){if(_0x560fdf[_0x3d94('0x3c')]===0x1){return _0x5df8b4['id'];}else{var _0x4ae177=_[_0x3d94('0x92')](_[_0x3d94('0x30')](_0x560fdf,_0x3d94('0x93')),function(_0x5ed8e8){return _[_0x3d94('0x94')](_0x577fd0,_0x5ed8e8);});if(_0x4ae177){return _0x5df8b4['id'];}}}));}}return BPromise[_0x3d94('0x95')](_0x3e1139)['then'](function(_0x551002){_0x4a1faa=_(_0x4a1faa)[_0x3d94('0x96')](_0x551002)[_0x3d94('0x97')]()[_0x3d94('0x98')]();return db[_0x3d94('0x31')][_0x3d94('0x4b')]({'where':{'id':_0x434b19[_0x3d94('0x4d')]['id']}})['then'](function(_0x54651a){return db['sequelize']['transaction'](function(_0x3c736a){return _0x54651a[_0x3d94('0x86')](_0x434b19[_0x3d94('0x36')][_0x3d94('0x71')],{'transaction':_0x3c736a})[_0x3d94('0x28')](function(){if(!_[_0x3d94('0x99')](_0x4a1faa)){return _0x54651a[_0x3d94('0x9a')](_0x4a1faa,{'transaction':_0x3c736a});}})[_0x3d94('0x28')](function(){_0x4a1faa[_0x3d94('0x84')](function(_0x414b82){socket[_0x3d94('0x73')]('userVoicePrefix:remove',{'UserId':_0x414b82,'VoicePrefixId':_0x54651a['id']});});});});});});})[_0x3d94('0x28')](respondWithStatusCode(_0x185592,null))['catch'](handleError(_0x185592,null));}; \ No newline at end of file +var _0xb10b=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','options','catch','show','params','fields','includeAll','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','transaction','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','order','getTeams','Team','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb10b,0x12a));var _0xbb10=function(_0x1202a2,_0x2912d9){_0x1202a2=_0x1202a2-0x0;var _0x3a8ac6=_0xb10b[_0x1202a2];return _0x3a8ac6;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config['redis']));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);function respondWithStatusCode(_0x45b9d6,_0x17fd46){_0x17fd46=_0x17fd46||0xcc;return function(_0x3df17b){if(_0x3df17b){return _0x45b9d6[_0xbb10('0x1e')](_0x17fd46);}return _0x45b9d6[_0xbb10('0x1f')](_0x17fd46)[_0xbb10('0x20')]();};}function respondWithResult(_0x3e26f4,_0x2b184e){_0x2b184e=_0x2b184e||0xc8;return function(_0x4a2bfc){if(_0x4a2bfc){return _0x3e26f4[_0xbb10('0x1f')](_0x2b184e)[_0xbb10('0x21')](_0x4a2bfc);}};}function respondWithFilteredResult(_0x133ac2,_0x42db98){return function(_0x378da8){if(_0x378da8){var _0x1682a4=typeof _0x42db98[_0xbb10('0x22')]===_0xbb10('0x23')&&typeof _0x42db98[_0xbb10('0x24')]===_0xbb10('0x23');var _0x48b6e9=_0x378da8[_0xbb10('0x25')];var _0x19f48d=_0x1682a4?0x0:_0x42db98[_0xbb10('0x22')];var _0x109908=_0x1682a4?_0x378da8[_0xbb10('0x25')]:_0x42db98[_0xbb10('0x22')]+_0x42db98['limit'];var _0x12f888;if(_0x109908>=_0x48b6e9){_0x109908=_0x48b6e9;_0x12f888=0xc8;}else{_0x12f888=0xce;}_0x133ac2[_0xbb10('0x1f')](_0x12f888);return _0x133ac2['set']('Content-Range',_0x19f48d+'-'+_0x109908+'/'+_0x48b6e9)[_0xbb10('0x21')](_0x378da8);}return null;};}function patchUpdates(_0x311abe){return function(_0x2e911d){try{jsonpatch[_0xbb10('0x26')](_0x2e911d,_0x311abe,!![]);}catch(_0x445761){return BPromise[_0xbb10('0x27')](_0x445761);}return _0x2e911d[_0xbb10('0x28')]();};}function saveUpdates(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){return _0x395404[_0xbb10('0x29')](_0x436104)[_0xbb10('0x2a')](function(_0x537898){return _0x537898;});}return null;};}function removeEntity(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(_0xc93a04){return _0xc93a04[_0xbb10('0x2b')]()[_0xbb10('0x2a')](function(){var _0x4e25ff=_0xc93a04[_0xbb10('0x2c')]({'plain':!![]});var _0x24d586=_0xbb10('0x2d');return db[_0xbb10('0x2e')][_0xbb10('0x2b')]({'where':{'type':_0x24d586,'resourceId':_0x4e25ff['id']}})[_0xbb10('0x2a')](function(){return _0xc93a04;});})[_0xbb10('0x2a')](function(){_0x4fedac['status'](0xcc)[_0xbb10('0x20')]();});}};}function handleEntityNotFound(_0x21ac54,_0xfc3595){return function(_0x2e0249){if(!_0x2e0249){_0x21ac54[_0xbb10('0x1e')](0x194);}return _0x2e0249;};}function handleError(_0x2ff4c1,_0x5d5c80){_0x5d5c80=_0x5d5c80||0x1f4;return function(_0x221624){logger['error'](_0x221624[_0xbb10('0x2f')]);if(_0x221624['name']){delete _0x221624[_0xbb10('0x30')];}_0x2ff4c1[_0xbb10('0x1f')](_0x5d5c80)[_0xbb10('0x31')](_0x221624);};}exports['index']=function(_0x518d47,_0x4c3744){var _0x34f65e={},_0x4f590d={},_0x359ad4={'count':0x0,'rows':[]};var _0x37dde7=_[_0xbb10('0x32')](db[_0xbb10('0x33')][_0xbb10('0x34')],function(_0x138bc6){return{'name':_0x138bc6[_0xbb10('0x35')],'type':_0x138bc6['type'][_0xbb10('0x36')]};});_0x4f590d[_0xbb10('0x37')]=_[_0xbb10('0x32')](_0x37dde7,_0xbb10('0x30'));_0x4f590d[_0xbb10('0x38')]=_[_0xbb10('0x39')](_0x518d47[_0xbb10('0x38')]);_0x4f590d[_0xbb10('0x3a')]=_[_0xbb10('0x3b')](_0x4f590d['model'],_0x4f590d[_0xbb10('0x38')]);_0x34f65e[_0xbb10('0x3c')]=_[_0xbb10('0x3b')](_0x4f590d[_0xbb10('0x37')],qs['fields'](_0x518d47[_0xbb10('0x38')]['fields']));_0x34f65e['attributes']=_0x34f65e[_0xbb10('0x3c')][_0xbb10('0x3d')]?_0x34f65e[_0xbb10('0x3c')]:_0x4f590d[_0xbb10('0x37')];if(!_0x518d47[_0xbb10('0x38')][_0xbb10('0x3e')]('nolimit')){_0x34f65e[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x518d47['query']['limit']);_0x34f65e['offset']=qs[_0xbb10('0x22')](_0x518d47[_0xbb10('0x38')][_0xbb10('0x22')]);}_0x34f65e['order']=qs[_0xbb10('0x3f')](_0x518d47[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x34f65e['where']=qs[_0xbb10('0x3a')](_[_0xbb10('0x40')](_0x518d47[_0xbb10('0x38')],_0x4f590d[_0xbb10('0x3a')]),_0x37dde7);if(_0x518d47['query'][_0xbb10('0x41')]){_0x34f65e[_0xbb10('0x42')]=_['merge'](_0x34f65e[_0xbb10('0x42')],{'$or':_[_0xbb10('0x32')](_0x37dde7,function(_0x44d6ae){if(_0x44d6ae[_0xbb10('0x43')]!==_0xbb10('0x44')){var _0x185a52={};_0x185a52[_0x44d6ae['name']]={'$like':'%'+_0x518d47[_0xbb10('0x38')][_0xbb10('0x41')]+'%'};return _0x185a52;}})});}_0x34f65e=_[_0xbb10('0x45')]({},_0x34f65e,_0x518d47[_0xbb10('0x46')]);var _0x4943d9={'where':_0x34f65e[_0xbb10('0x42')]};return db[_0xbb10('0x33')][_0xbb10('0x25')](_0x4943d9)[_0xbb10('0x2a')](function(_0x5e2cfa){_0x359ad4[_0xbb10('0x25')]=_0x5e2cfa;if(_0x518d47[_0xbb10('0x38')]['includeAll']){_0x34f65e['include']=[{'all':!![]}];}return db[_0xbb10('0x33')]['findAll'](_0x34f65e);})[_0xbb10('0x2a')](function(_0x180933){_0x359ad4['rows']=_0x180933;return _0x359ad4;})[_0xbb10('0x2a')](respondWithFilteredResult(_0x4c3744,_0x34f65e))[_0xbb10('0x47')](handleError(_0x4c3744,null));};exports[_0xbb10('0x48')]=function(_0x5cf4f8,_0x2dd02b){var _0xebd70c={'raw':![],'where':{'id':_0x5cf4f8[_0xbb10('0x49')]['id']}},_0x3b9fdf={};_0x3b9fdf[_0xbb10('0x37')]=_[_0xbb10('0x39')](db[_0xbb10('0x33')][_0xbb10('0x34')]);_0x3b9fdf[_0xbb10('0x38')]=_[_0xbb10('0x39')](_0x5cf4f8[_0xbb10('0x38')]);_0x3b9fdf[_0xbb10('0x3a')]=_['intersection'](_0x3b9fdf[_0xbb10('0x37')],_0x3b9fdf[_0xbb10('0x38')]);_0xebd70c['attributes']=_[_0xbb10('0x3b')](_0x3b9fdf[_0xbb10('0x37')],qs[_0xbb10('0x4a')](_0x5cf4f8[_0xbb10('0x38')][_0xbb10('0x4a')]));_0xebd70c[_0xbb10('0x3c')]=_0xebd70c[_0xbb10('0x3c')]['length']?_0xebd70c['attributes']:_0x3b9fdf[_0xbb10('0x37')];if(_0x5cf4f8[_0xbb10('0x38')][_0xbb10('0x4b')]){_0xebd70c['include']=[{'all':!![]}];}_0xebd70c=_['merge']({},_0xebd70c,_0x5cf4f8[_0xbb10('0x46')]);return db[_0xbb10('0x33')][_0xbb10('0x4c')](_0xebd70c)[_0xbb10('0x2a')](handleEntityNotFound(_0x2dd02b,null))[_0xbb10('0x2a')](respondWithResult(_0x2dd02b,null))[_0xbb10('0x47')](handleError(_0x2dd02b,null));};exports[_0xbb10('0x2b')]=function(_0x460788,_0x2626d8){return db[_0xbb10('0x33')]['find']({'where':{'id':_0x460788['params']['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0x2626d8,null))[_0xbb10('0x2a')](removeEntity(_0x2626d8,null))[_0xbb10('0x47')](handleError(_0x2626d8,null));};exports[_0xbb10('0x4d')]=function(_0x36aa7d,_0x440f9e){return db[_0xbb10('0x33')][_0xbb10('0x4d')]()[_0xbb10('0x2a')](respondWithResult(_0x440f9e,null))[_0xbb10('0x47')](handleError(_0x440f9e,null));};exports[_0xbb10('0x4e')]=function(_0x20e18a,_0x61e689){var _0x2e6fd9;return db[_0xbb10('0x4f')]['transaction'](function(_0x124052){return db['VoicePrefix'][_0xbb10('0x4e')](_0x20e18a[_0xbb10('0x50')],{'transaction':_0x124052})[_0xbb10('0x2a')](function(_0x3f27ce){_0x2e6fd9=_0x3f27ce[_0xbb10('0x2c')]({'plain':!![]});return db[_0xbb10('0x51')][_0xbb10('0x4c')]({'where':{'id':_0x2e6fd9[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x2a')](function(_0x3d71e){return createVoicePrefixExtensions(_0x2e6fd9,_0x3d71e,_0x124052);});});})[_0xbb10('0x2a')](function(){var _0x1c2dce=_0x20e18a[_0xbb10('0x53')][_0xbb10('0x2c')]({'plain':!![]});if(!_0x1c2dce)throw new Error(_0xbb10('0x54'));if(_0x1c2dce['role']===_0xbb10('0x53')){var _0x466eb7=_0x2e6fd9;return db[_0xbb10('0x55')][_0xbb10('0x4c')]({'where':{'name':_0xbb10('0x2d'),'userProfileId':_0x1c2dce[_0xbb10('0x56')]},'raw':!![]})['then'](function(_0x120bda){if(_0x120bda&&_0x120bda[_0xbb10('0x57')]===0x0){return db[_0xbb10('0x2e')][_0xbb10('0x4e')]({'name':_0x466eb7[_0xbb10('0x30')],'resourceId':_0x466eb7['id'],'type':_0x120bda[_0xbb10('0x30')],'sectionId':_0x120bda['id']},{})[_0xbb10('0x2a')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})[_0xbb10('0x47')](function(_0x205e01){logger[_0xbb10('0x58')](_0xbb10('0x59'),_0x205e01);throw _0x205e01;});}return _0x2e6fd9;})[_0xbb10('0x2a')](respondWithResult(_0x61e689,null))[_0xbb10('0x47')](handleError(_0x61e689,null));};function Extension(_0x4e7fac,_0x4ea1a6,_0x16272d,_0x3e6338){this[_0xbb10('0x5a')]=_0xbb10('0x5b');this['exten']=_0x4e7fac;this['app']=_0x16272d;this[_0xbb10('0x43')]=_0xbb10('0x5c');this[_0xbb10('0x5d')]=_0xbb10('0x5e');this[_0xbb10('0x5f')]=_0x4ea1a6;this[_0xbb10('0x60')]=_0x3e6338;}function createVoicePrefixExtensions(_0x45c0dc,_0x4a5fb9,_0x117e84){return new BPromise(function(_0x216cff,_0x4917a5){var _0x5e03cb=new Extension(formatPrefixName(_0x45c0dc['prefix']),0x1,_0xbb10('0x61'),_0xbb10('0x62'));_0x5e03cb[_0xbb10('0x63')]=_0x45c0dc['id'];return db['VoiceExtension']['create'](_0x5e03cb,{'transaction':_0x117e84})['then'](function(_0x3ebc5f){var _0x249b33=_0x3ebc5f[_0xbb10('0x2c')]({'plain':!![]});var _0x4e9fbd=_[_0xbb10('0x32')](addVoicePrefixExtensions(_0x45c0dc,_0x4a5fb9),function(_0x13131c){_0x13131c['VoiceExtensionId']=_0x249b33['id'];_0x13131c['VoicePrefixId']=_0x45c0dc['id'];return _0x13131c;});return db[_0xbb10('0x51')][_0xbb10('0x64')](_0x4e9fbd,{'transaction':_0x117e84})[_0xbb10('0x2a')](function(_0x237246){if(!_0x237246){return _0x4917a5('Extensions\x20creation\x20failed');}else{return _0x216cff(_0x237246);}})[_0xbb10('0x47')](function(_0xec48ac){return _0x4917a5(_0xec48ac);});});;});};function addVoicePrefixExtensions(_0xa7179d,_0x5202d7){var _0x402a01=[];var _0x2f05bc=formatPrefixName(_0xa7179d[_0xbb10('0x65')]);_0x402a01['push'](new Extension(_0x2f05bc,0x2,_0xbb10('0x66'),_0xbb10('0x67')+_0xa7179d[_0xbb10('0x30')]));if(_0xa7179d[_0xbb10('0x68')]){_0x402a01['push'](new Extension(_0x2f05bc,0x3,_0xbb10('0x66'),_0xbb10('0x69')+_0xa7179d[_0xbb10('0x68')]));}else{_0x402a01[_0xbb10('0x6a')](new Extension(_0x2f05bc,0x3,'NoOp',_0xbb10('0x6b')));}_0x402a01[_0xbb10('0x6a')](new Extension(_0x2f05bc,0x4,_0xbb10('0x6c'),_0x5202d7[_0xbb10('0x5a')]+','+_0xbb10('0x6d')+(0x8+_0xa7179d[_0xbb10('0x30')][_0xbb10('0x3d')])+'}'+','+0x1));return _0x402a01;}function formatPrefixName(_0x4a30c5){var _0x4a13d7='_';for(var _0x5acd5e=0x0;_0x5acd5e<_0x4a30c5[_0xbb10('0x3d')];_0x5acd5e++){if(_0x4a30c5[_0xbb10('0x6e')](_0x5acd5e)=='-'){_0x4a13d7+=_0x4a30c5[_0xbb10('0x6e')](_0x5acd5e);}else{_0x4a13d7+='['+_0x4a30c5['charAt'](_0x5acd5e)+']';}}_0x4a13d7+='.';return _0x4a13d7;}exports['update']=function(_0x46f462,_0x1b11c0,_0xd9e743){var _0x3a9677=_0x46f462[_0xbb10('0x50')];_0x3a9677[_0xbb10('0x65')]='system-'+_0x3a9677[_0xbb10('0x30')]+'-';return db[_0xbb10('0x4f')][_0xbb10('0x6f')](function(_0x14f16b){return db[_0xbb10('0x33')]['update'](_0x3a9677,{'where':{'id':_0x3a9677['id']},'transaction':_0x14f16b})['then'](function(){return db['VoiceExtension'][_0xbb10('0x2b')]({'where':{'VoicePrefixId':_0x3a9677['id']},'transaction':_0x14f16b})[_0xbb10('0x2a')](function(){return db[_0xbb10('0x51')][_0xbb10('0x4c')]({'where':{'id':_0x3a9677[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x2a')](function(_0x5d942d){return createVoicePrefixExtensions(_0x3a9677,_0x5d942d,_0x14f16b);});});});})[_0xbb10('0x2a')](function(){return db['VoicePrefix']['findById'](_0x3a9677['id']);})['then'](respondWithResult(_0x1b11c0,null))[_0xbb10('0x47')](handleError(_0x1b11c0,null));};exports[_0xbb10('0x70')]=function(_0x23b1d5,_0x108f99,_0x5ce94f){return db[_0xbb10('0x33')]['find']({'where':{'id':_0x23b1d5['params']['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0x108f99,null))[_0xbb10('0x2a')](function(_0x29529c){if(_0x29529c){return _0x29529c[_0xbb10('0x70')](_0x23b1d5[_0xbb10('0x50')]['ids'],_[_0xbb10('0x71')](_0x23b1d5[_0xbb10('0x50')],[_0xbb10('0x72'),'id'])||{})[_0xbb10('0x73')](function(_0x43cdb7){for(var _0x27f42f=0x0;_0x27f42f<_0x23b1d5[_0xbb10('0x50')]['ids'][_0xbb10('0x3d')];_0x27f42f+=0x1){socket[_0xbb10('0x74')](_0xbb10('0x75'),{'UserId':Number(_0x23b1d5[_0xbb10('0x50')][_0xbb10('0x72')][_0x27f42f]),'VoicePrefixId':Number(_0x23b1d5[_0xbb10('0x49')]['id'])});}return _0x43cdb7;});}})[_0xbb10('0x2a')](respondWithResult(_0x108f99,null))[_0xbb10('0x47')](handleError(_0x108f99,null));};exports['removeAgents']=function(_0x428146,_0x218690,_0x145baf){return db['VoicePrefix']['find']({'where':{'id':_0x428146['params']['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0x218690,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){return _0x4e3d6a[_0xbb10('0x76')](_0x428146[_0xbb10('0x38')][_0xbb10('0x72')])[_0xbb10('0x2a')](function(){if(_[_0xbb10('0x77')](_0x428146[_0xbb10('0x38')][_0xbb10('0x72')])){for(var _0x417304=0x0;_0x417304<_0x428146[_0xbb10('0x38')]['ids'][_0xbb10('0x3d')];_0x417304+=0x1){socket[_0xbb10('0x74')](_0xbb10('0x78'),{'UserId':Number(_0x428146[_0xbb10('0x38')]['ids'][_0x417304]),'VoicePrefixId':Number(_0x428146['params']['id'])});}}else{socket[_0xbb10('0x74')](_0xbb10('0x78'),{'UserId':Number(_0x428146[_0xbb10('0x38')][_0xbb10('0x72')]),'VoicePrefixId':Number(_0x428146['params']['id'])});}});}})[_0xbb10('0x2a')](respondWithStatusCode(_0x218690,null))[_0xbb10('0x47')](handleError(_0x218690,null));};exports[_0xbb10('0x79')]=function(_0xf7b3e1,_0x35c1e8,_0x517185){var _0x5f0691={};var _0x372636={};var _0x53c698;var _0x22c030;return db['VoicePrefix'][_0xbb10('0x7a')]({'where':{'id':_0xf7b3e1[_0xbb10('0x49')]['id']}})['then'](handleEntityNotFound(_0x35c1e8,null))['then'](function(_0x2f667f){if(_0x2f667f){_0x53c698=_0x2f667f;_0x372636[_0xbb10('0x37')]=_[_0xbb10('0x39')](db['User'][_0xbb10('0x34')]);_0x372636[_0xbb10('0x38')]=_[_0xbb10('0x39')](_0xf7b3e1[_0xbb10('0x38')]);_0x372636[_0xbb10('0x3a')]=_[_0xbb10('0x3b')](_0x372636[_0xbb10('0x37')],_0x372636[_0xbb10('0x38')]);_0x5f0691[_0xbb10('0x3c')]=_['intersection'](_0x372636[_0xbb10('0x37')],qs[_0xbb10('0x4a')](_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x4a')]));_0x5f0691[_0xbb10('0x3c')]=_0x5f0691[_0xbb10('0x3c')][_0xbb10('0x3d')]?_0x5f0691[_0xbb10('0x3c')]:_0x372636[_0xbb10('0x37')];_0x5f0691[_0xbb10('0x7b')]=qs[_0xbb10('0x3f')](_0xf7b3e1[_0xbb10('0x38')]['sort']);_0x5f0691['where']=qs[_0xbb10('0x3a')](_[_0xbb10('0x40')](_0xf7b3e1[_0xbb10('0x38')],_0x372636[_0xbb10('0x3a')]));if(_0xf7b3e1[_0xbb10('0x38')]['filter']){_0x5f0691[_0xbb10('0x42')]=_[_0xbb10('0x45')](_0x5f0691[_0xbb10('0x42')],{'$or':_[_0xbb10('0x32')](_0x5f0691[_0xbb10('0x3c')],function(_0x379d49){var _0x546db5={};_0x546db5[_0x379d49]={'$like':'%'+_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x41')]+'%'};return _0x546db5;})});}_0x5f0691=_['merge']({},_0x5f0691,_0xf7b3e1[_0xbb10('0x46')]);return _0x53c698['getAgents'](_0x5f0691);}})[_0xbb10('0x2a')](function(_0x28bd76){if(_0x28bd76){_0x22c030=_0x28bd76[_0xbb10('0x3d')];if(!_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x3e')]('nolimit')){_0x5f0691[_0xbb10('0x24')]=qs['limit'](_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x24')]);_0x5f0691['offset']=qs['offset'](_0xf7b3e1[_0xbb10('0x38')][_0xbb10('0x22')]);}return _0x53c698[_0xbb10('0x79')](_0x5f0691);}})[_0xbb10('0x2a')](function(_0x18d18d){if(_0x18d18d){return _0x18d18d?{'count':_0x22c030,'rows':_0x18d18d}:null;}})[_0xbb10('0x2a')](respondWithResult(_0x35c1e8,null))[_0xbb10('0x47')](handleError(_0x35c1e8,null));};exports[_0xbb10('0x7c')]=function(_0x252ab8,_0xbccd46,_0x2bf9dd){var _0x4c0b83={};var _0x2b9a50={};var _0x3eeceb;var _0x1b0a6c;return db[_0xbb10('0x33')][_0xbb10('0x7a')]({'where':{'id':_0x252ab8[_0xbb10('0x49')]['id']}})[_0xbb10('0x2a')](handleEntityNotFound(_0xbccd46,null))[_0xbb10('0x2a')](function(_0x3e6fe2){if(_0x3e6fe2){_0x3eeceb=_0x3e6fe2;_0x2b9a50[_0xbb10('0x37')]=_[_0xbb10('0x39')](db[_0xbb10('0x7d')]['rawAttributes']);_0x2b9a50[_0xbb10('0x38')]=_['keys'](_0x252ab8[_0xbb10('0x38')]);_0x2b9a50[_0xbb10('0x3a')]=_[_0xbb10('0x3b')](_0x2b9a50[_0xbb10('0x37')],_0x2b9a50[_0xbb10('0x38')]);_0x4c0b83['attributes']=_[_0xbb10('0x3b')](_0x2b9a50[_0xbb10('0x37')],qs[_0xbb10('0x4a')](_0x252ab8[_0xbb10('0x38')][_0xbb10('0x4a')]));_0x4c0b83[_0xbb10('0x3c')]=_0x4c0b83['attributes']['length']?_0x4c0b83[_0xbb10('0x3c')]:_0x2b9a50[_0xbb10('0x37')];_0x4c0b83[_0xbb10('0x7b')]=qs['sort'](_0x252ab8[_0xbb10('0x38')][_0xbb10('0x3f')]);_0x4c0b83['where']=qs[_0xbb10('0x3a')](_[_0xbb10('0x40')](_0x252ab8['query'],_0x2b9a50[_0xbb10('0x3a')]));if(_0x252ab8['query'][_0xbb10('0x41')]){_0x4c0b83[_0xbb10('0x42')]=_['merge'](_0x4c0b83[_0xbb10('0x42')],{'$or':_[_0xbb10('0x32')](_0x4c0b83['attributes'],function(_0x5dae56){var _0xea6bf2={};_0xea6bf2[_0x5dae56]={'$like':'%'+_0x252ab8[_0xbb10('0x38')][_0xbb10('0x41')]+'%'};return _0xea6bf2;})});}_0x4c0b83=_[_0xbb10('0x45')]({},_0x4c0b83,_0x252ab8[_0xbb10('0x46')]);return _0x3eeceb['getTeams'](_0x4c0b83);}})[_0xbb10('0x2a')](function(_0x9f2e0f){if(_0x9f2e0f){_0x1b0a6c=_0x9f2e0f[_0xbb10('0x3d')];if(!_0x252ab8['query'][_0xbb10('0x3e')](_0xbb10('0x7e'))){_0x4c0b83[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x252ab8[_0xbb10('0x38')][_0xbb10('0x24')]);_0x4c0b83[_0xbb10('0x22')]=qs[_0xbb10('0x22')](_0x252ab8[_0xbb10('0x38')]['offset']);}return _0x3eeceb['getTeams'](_0x4c0b83);}})[_0xbb10('0x2a')](function(_0xe7238b){if(_0xe7238b){return _0xe7238b?{'count':_0x1b0a6c,'rows':_0xe7238b}:null;}})[_0xbb10('0x2a')](respondWithResult(_0xbccd46,null))[_0xbb10('0x47')](handleError(_0xbccd46,null));};exports[_0xbb10('0x7f')]=function(_0x363b81,_0x1cccec,_0x1674f7){var _0x3ede66=_0x363b81[_0xbb10('0x50')][_0xbb10('0x72')];var _0x167734;return db[_0xbb10('0x7d')]['findAll']({'where':{'id':_0x3ede66},'attributes':['id'],'include':[{'model':db[_0xbb10('0x80')],'as':_0xbb10('0x81'),'attributes':['id',_0xbb10('0x30'),_0xbb10('0x82'),_0xbb10('0x83'),_0xbb10('0x84')],'raw':!![]}]})[_0xbb10('0x2a')](function(_0x1421e2){if(_0x1421e2){_0x167734=_0x1421e2;var _0x3c6c45=_[_0xbb10('0x85')](_0x1421e2,function(_0x2a1c53){var _0x57f4a3=_0x2a1c53[_0xbb10('0x2c')]({'plain':!![]});return _0x57f4a3['Agents'];});return db[_0xbb10('0x33')][_0xbb10('0x4c')]({'where':{'id':_0x363b81[_0xbb10('0x49')]['id']}})[_0xbb10('0x2a')](function(_0x2b6e27){return db[_0xbb10('0x4f')]['transaction'](function(_0x2d8a25){return _0x2b6e27['addTeams'](_0x3ede66,{'transaction':_0x2d8a25})[_0xbb10('0x2a')](function(){return BPromise[_0xbb10('0x86')](_0x167734,function(_0xda122){return db[_0xbb10('0x87')][_0xbb10('0x88')]({'TeamId':_0xda122['id'],'VoicePrefixId':_0x363b81[_0xbb10('0x49')]['id']},{'transaction':_0x2d8a25});});})[_0xbb10('0x2a')](function(){return BPromise[_0xbb10('0x86')](_0x3c6c45,function(_0x25c5b2){return db[_0xbb10('0x89')][_0xbb10('0x8a')]({'where':{'UserId':_0x25c5b2['id'],'VoicePrefixId':_0x363b81[_0xbb10('0x49')]['id']},'transaction':_0x2d8a25});});})['then'](function(){_0x3c6c45[_0xbb10('0x8b')](function(_0x516520){socket[_0xbb10('0x74')](_0xbb10('0x75'),{'UserId':_0x516520['id'],'VoicePrefixId':_0x2b6e27['id']});});});});});}})[_0xbb10('0x2a')](respondWithStatusCode(_0x1cccec,null))[_0xbb10('0x47')](handleError(_0x1cccec,null));};exports[_0xbb10('0x8c')]=function(_0x40271f,_0x185ec9,_0x5e9888){return db[_0xbb10('0x7d')]['findAll']({'where':{'id':_0x40271f['query'][_0xbb10('0x72')]},'attributes':['id'],'include':[{'model':db[_0xbb10('0x80')],'as':_0xbb10('0x81'),'attributes':['id'],'raw':!![]}]})[_0xbb10('0x2a')](handleEntityNotFound(_0x185ec9,null))[_0xbb10('0x2a')](function(_0x16b8c1){var _0x5d1077=_[_0xbb10('0x32')](_0x16b8c1,'id');var _0x2c25ab=[];var _0x39aa9e=[];var _0xb1b7c8=squel[_0xbb10('0x8d')]();_0xb1b7c8[_0xbb10('0x8e')]('tq.TeamId')[_0xbb10('0x8f')](_0xbb10('0x90'),'tq')[_0xbb10('0x91')](_0xbb10('0x92'),'ut',_0xbb10('0x93'))[_0xbb10('0x42')](_0xbb10('0x94'),_0x40271f['params']['id']);for(var _0x33a43e=0x0;_0x33a43e<_0x16b8c1['length'];_0x33a43e+=0x1){let _0x3afbcf=_0x16b8c1[_0x33a43e];for(var _0x4a6660=0x0;_0x4a6660<_0x3afbcf['Agents'][_0xbb10('0x3d')];_0x4a6660+=0x1){let _0x225064=_0x3afbcf[_0xbb10('0x81')][_0x4a6660];var _0x3b7552=_0xb1b7c8[_0xbb10('0x95')]();_0x3b7552['where'](_0xbb10('0x96'),_0x225064['id']);_0x39aa9e['push'](db['sequelize']['query'](_0x3b7552[_0xbb10('0x97')](),{'type':db[_0xbb10('0x4f')][_0xbb10('0x98')][_0xbb10('0x99')]})[_0xbb10('0x2a')](function(_0x5abedf){if(_0x5abedf[_0xbb10('0x3d')]===0x1){return _0x225064['id'];}else{var _0x42a2d7=_[_0xbb10('0x9a')](_[_0xbb10('0x32')](_0x5abedf,_0xbb10('0x9b')),function(_0x37ff15){return _[_0xbb10('0x9c')](_0x5d1077,_0x37ff15);});if(_0x42a2d7){return _0x225064['id'];}}}));}}return BPromise['all'](_0x39aa9e)['then'](function(_0x584a62){_0x2c25ab=_(_0x2c25ab)[_0xbb10('0x9d')](_0x584a62)[_0xbb10('0x9e')]()[_0xbb10('0x9f')]();return db[_0xbb10('0x33')][_0xbb10('0x4c')]({'where':{'id':_0x40271f[_0xbb10('0x49')]['id']}})[_0xbb10('0x2a')](function(_0x423628){return db[_0xbb10('0x4f')][_0xbb10('0x6f')](function(_0x4cc8d4){return _0x423628['removeTeams'](_0x40271f['query'][_0xbb10('0x72')],{'transaction':_0x4cc8d4})[_0xbb10('0x2a')](function(){if(!_[_0xbb10('0xa0')](_0x2c25ab)){return _0x423628['removeAgents'](_0x2c25ab,{'transaction':_0x4cc8d4});}})[_0xbb10('0x2a')](function(){_0x2c25ab[_0xbb10('0x8b')](function(_0x2c638d){socket[_0xbb10('0x74')](_0xbb10('0x78'),{'UserId':_0x2c638d,'VoicePrefixId':_0x423628['id']});});});});});});})[_0xbb10('0x2a')](respondWithStatusCode(_0x185ec9,null))['catch'](handleError(_0x185ec9,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0c8f91d..47bfe11 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 _0x21ef=['update','remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x174e96,_0x2ef390){var _0x40117c=function(_0x339162){while(--_0x339162){_0x174e96['push'](_0x174e96['shift']());}};_0x40117c(++_0x2ef390);}(_0x21ef,0x1e5));var _0xf21e=function(_0x39f509,_0x3a3e3d){_0x39f509=_0x39f509-0x0;var _0x52b7b4=_0x21ef[_0x39f509];return _0x52b7b4;};'use strict';var EventEmitter=require(_0xf21e('0x0'));var VoicePrefix=require(_0xf21e('0x1'))['db'][_0xf21e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf21e('0x3')](0x0);var events={'afterCreate':_0xf21e('0x4'),'afterUpdate':_0xf21e('0x5'),'afterDestroy':_0xf21e('0x6')};function emitEvent(_0x1d81cc){return function(_0x5d8ae1,_0xda1648,_0x434f36){VoicePrefixEvents[_0xf21e('0x7')](_0x1d81cc+':'+_0x5d8ae1['id'],_0x5d8ae1);VoicePrefixEvents['emit'](_0x1d81cc,_0x5d8ae1);_0x434f36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xf21e('0x8')](e,emitEvent(event));}}module[_0xf21e('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x4a68=['hasOwnProperty','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x549dda,_0x2463a7){var _0x2c5ff0=function(_0x42860b){while(--_0x42860b){_0x549dda['push'](_0x549dda['shift']());}};_0x2c5ff0(++_0x2463a7);}(_0x4a68,0x123));var _0x84a6=function(_0x482c95,_0x504190){_0x482c95=_0x482c95-0x0;var _0x38c2e8=_0x4a68[_0x482c95];return _0x38c2e8;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x84a6('0x0'))['db'][_0x84a6('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x84a6('0x2')](0x0);var events={'afterCreate':_0x84a6('0x3'),'afterUpdate':_0x84a6('0x4'),'afterDestroy':_0x84a6('0x5')};function emitEvent(_0x5197a6){return function(_0x946cb0,_0x34eb9e,_0x2665b1){VoicePrefixEvents['emit'](_0x5197a6+':'+_0x946cb0['id'],_0x946cb0);VoicePrefixEvents['emit'](_0x5197a6,_0x946cb0);_0x2665b1(null);};}for(var e in events){if(events[_0x84a6('0x6')](e)){var event=events[e];VoicePrefix[_0x84a6('0x7')](e,emitEvent(event));}}module[_0x84a6('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 4688a15..8486894 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 _0x0447=['voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x5859d3,_0x26b667){var _0x1698f0=function(_0x15bce2){while(--_0x15bce2){_0x5859d3['push'](_0x5859d3['shift']());}};_0x1698f0(++_0x26b667);}(_0x0447,0x6f));var _0x7044=function(_0xa042a2,_0x59f0b9){_0xa042a2=_0xa042a2-0x0;var _0x398132=_0x0447[_0xa042a2];return _0x398132;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var logger=require(_0x7044('0x2'))(_0x7044('0x3'));var moment=require(_0x7044('0x4'));var BPromise=require('bluebird');var rp=require(_0x7044('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7044('0x6'));var attributes=require(_0x7044('0x7'));module[_0x7044('0x8')]=function(_0x36dcec,_0x473f9d){return _0x36dcec[_0x7044('0x9')]('VoicePrefix',attributes,{'tableName':_0x7044('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2998=['../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2a7bde,_0x4fe9d4){var _0x20e16f=function(_0x5b7fc3){while(--_0x5b7fc3){_0x2a7bde['push'](_0x2a7bde['shift']());}};_0x20e16f(++_0x4fe9d4);}(_0x2998,0x179));var _0x8299=function(_0x478bc0,_0x3c3cc9){_0x478bc0=_0x478bc0-0x0;var _0x39c121=_0x2998[_0x478bc0];return _0x39c121;};'use strict';var _=require(_0x8299('0x0'));var util=require(_0x8299('0x1'));var logger=require(_0x8299('0x2'))('api');var moment=require(_0x8299('0x3'));var BPromise=require('bluebird');var rp=require(_0x8299('0x4'));var fs=require('fs');var path=require(_0x8299('0x5'));var rimraf=require(_0x8299('0x6'));var config=require(_0x8299('0x7'));var attributes=require(_0x8299('0x8'));module['exports']=function(_0x385cd5,_0x45d421){return _0x385cd5[_0x8299('0x9')](_0x8299('0xa'),attributes,{'tableName':_0x8299('0xb'),'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 e06e9f6..74cd08c 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 _0x282a=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x282a,0xa2));var _0xa282=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x282a[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0xa282('0x0'));var moment=require(_0xa282('0x1'));var BPromise=require(_0xa282('0x2'));var rs=require(_0xa282('0x3'));var fs=require('fs');var Redis=require(_0xa282('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa282('0x5'));var logger=require(_0xa282('0x6'))('rpc');var config=require(_0xa282('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa282('0x8')]['http']({'port':0x232a});config[_0xa282('0x9')]=_[_0xa282('0xa')](config[_0xa282('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa282('0xb'))(new Redis(config['redis']));require(_0xa282('0xc'))[_0xa282('0xd')](socket);function respondWithRpcPromise(_0x375b36,_0x8bb6a0,_0x10876a){return new BPromise(function(_0x117ec7,_0x9a296c){return client[_0xa282('0xe')](_0x375b36,_0x10876a)[_0xa282('0xf')](function(_0x1509a0){logger[_0xa282('0x10')](_0xa282('0x11'),_0x8bb6a0,_0xa282('0x12'));logger[_0xa282('0x13')](_0xa282('0x14'),_0x8bb6a0,_0xa282('0x12'),JSON[_0xa282('0x15')](_0x1509a0));if(_0x1509a0[_0xa282('0x16')]){if(_0x1509a0['error'][_0xa282('0x17')]===0x1f4){logger[_0xa282('0x16')](_0xa282('0x11'),_0x8bb6a0,_0x1509a0[_0xa282('0x16')][_0xa282('0x18')]);return _0x9a296c(_0x1509a0['error']['message']);}logger[_0xa282('0x16')](_0xa282('0x11'),_0x8bb6a0,_0x1509a0[_0xa282('0x16')][_0xa282('0x18')]);return _0x117ec7(_0x1509a0[_0xa282('0x16')]['message']);}else{logger['info'](_0xa282('0x11'),_0x8bb6a0,_0xa282('0x12'));_0x117ec7(_0x1509a0[_0xa282('0x19')][_0xa282('0x18')]);}})[_0xa282('0x1a')](function(_0x36f3a0){logger[_0xa282('0x16')](_0xa282('0x11'),_0x8bb6a0,_0x36f3a0);_0x9a296c(_0x36f3a0);});});} \ No newline at end of file +var _0x21b7=['request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voicePrefix.socket','register'];(function(_0x4d4e92,_0x51997c){var _0x5d8fa0=function(_0x1df501){while(--_0x1df501){_0x4d4e92['push'](_0x4d4e92['shift']());}};_0x5d8fa0(++_0x51997c);}(_0x21b7,0xef));var _0x721b=function(_0x595378,_0x4d8aed){_0x595378=_0x595378-0x0;var _0x3f7bdc=_0x21b7[_0x595378];return _0x3f7bdc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x721b('0x0'));var rs=require(_0x721b('0x1'));var fs=require('fs');var Redis=require(_0x721b('0x2'));var db=require(_0x721b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x721b('0x4'));var config=require(_0x721b('0x5'));var jayson=require(_0x721b('0x6'));var client=jayson[_0x721b('0x7')][_0x721b('0x8')]({'port':0x232a});config[_0x721b('0x9')]=_['defaults'](config[_0x721b('0x9')],{'host':_0x721b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x721b('0xb'))[_0x721b('0xc')](socket);function respondWithRpcPromise(_0xe13699,_0x35f524,_0xfcc6d7){return new BPromise(function(_0x5e11e3,_0x302bfd){return client[_0x721b('0xd')](_0xe13699,_0xfcc6d7)[_0x721b('0xe')](function(_0x2c6f5a){logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x35f524,_0x721b('0x11'),JSON['stringify'](_0x2c6f5a));if(_0x2c6f5a[_0x721b('0x12')]){if(_0x2c6f5a[_0x721b('0x12')]['code']===0x1f4){logger['error'](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x302bfd(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);return _0x5e11e3(_0x2c6f5a[_0x721b('0x12')][_0x721b('0x13')]);}else{logger[_0x721b('0xf')](_0x721b('0x10'),_0x35f524,_0x721b('0x11'));_0x5e11e3(_0x2c6f5a['result'][_0x721b('0x13')]);}})[_0x721b('0x14')](function(_0x821d77){logger[_0x721b('0x12')](_0x721b('0x10'),_0x35f524,_0x821d77);_0x302bfd(_0x821d77);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1e29a1d..f3f6eb9 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 _0xbee3=['register','length','voicePrefix:','save','emit'];(function(_0x5cdc23,_0x1d6581){var _0x277267=function(_0x42d65e){while(--_0x42d65e){_0x5cdc23['push'](_0x5cdc23['shift']());}};_0x277267(++_0x1d6581);}(_0xbee3,0xd5));var _0x3bee=function(_0x232c7a,_0x3fa4fa){_0x232c7a=_0x232c7a-0x0;var _0x37d42d=_0xbee3[_0x232c7a];return _0x37d42d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x3bee('0x0'),'remove','update'];function createListener(_0x45a1bf,_0x27f822){return function(_0x4945a7){_0x27f822[_0x3bee('0x1')](_0x45a1bf,_0x4945a7);};}function removeListener(_0x1956c1,_0x1cf379){return function(){VoicePrefixEvents['removeListener'](_0x1956c1,_0x1cf379);};}exports[_0x3bee('0x2')]=function(_0x3baf77){for(var _0x4c5ef5=0x0,_0x2fdeec=events[_0x3bee('0x3')];_0x4c5ef5<_0x2fdeec;_0x4c5ef5++){var _0x1b510d=events[_0x4c5ef5];var _0x339223=createListener(_0x3bee('0x4')+_0x1b510d,_0x3baf77);VoicePrefixEvents['on'](_0x1b510d,_0x339223);}}; \ No newline at end of file +var _0x847d=['length','voicePrefix:','save','remove','update','emit','removeListener','register'];(function(_0x2da0d1,_0x2be18b){var _0x227c84=function(_0x14a3f7){while(--_0x14a3f7){_0x2da0d1['push'](_0x2da0d1['shift']());}};_0x227c84(++_0x2be18b);}(_0x847d,0x14a));var _0xd847=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x847d[_0x4aba15];return _0x1c8122;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xd847('0x0'),_0xd847('0x1'),_0xd847('0x2')];function createListener(_0x4f2500,_0x202b1c){return function(_0x4a85d8){_0x202b1c[_0xd847('0x3')](_0x4f2500,_0x4a85d8);};}function removeListener(_0x18051f,_0x5258c0){return function(){VoicePrefixEvents[_0xd847('0x4')](_0x18051f,_0x5258c0);};}exports[_0xd847('0x5')]=function(_0x375a88){for(var _0x13d8d4=0x0,_0x5f3349=events[_0xd847('0x6')];_0x13d8d4<_0x5f3349;_0x13d8d4++){var _0x19fdb5=events[_0x13d8d4];var _0x2bb22b=createListener(_0xd847('0x7')+_0x19fdb5,_0x375a88);VoicePrefixEvents['on'](_0x19fdb5,_0x2bb22b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3c4121b..7775355 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3382e1,_0x1b69ee){var _0x166bd5=function(_0x548a6d){while(--_0x548a6d){_0x3382e1['push'](_0x3382e1['shift']());}};_0x166bd5(++_0x1b69ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _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(_0x3d1ce2,_0x2a9d26){var _0x43c682=function(_0x1d3031){while(--_0x1d3031){_0x3d1ce2['push'](_0x3d1ce2['shift']());}};_0x43c682(++_0x2a9d26);}(_0xb10b,0x12a));var _0xbb10=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0xb10b[_0x43a5c7];return _0x3b12a2;};'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 8875c8b..61cf082 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 _0xf502=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\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)','#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','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','booked','progressive','power','INTEGER','yes','once','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x10911a,_0x5b58df){var _0x61dc2c=function(_0x5647e8){while(--_0x5647e8){_0x10911a['push'](_0x10911a['shift']());}};_0x61dc2c(++_0x5b58df);}(_0xf502,0x10e));var _0x2f50=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xf502[_0x16de68];return _0x1c277e;};'use strict';var Sequelize=require(_0x2f50('0x0'));module[_0x2f50('0x1')]={'name':{'type':Sequelize[_0x2f50('0x2')],'allowNull':![],'unique':_0x2f50('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x5'),_0x2f50('0x6')),'allowNull':![],'defaultValue':_0x2f50('0x5')},'musiconhold':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':_0x2f50('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x2f50('0x8'),_0x2f50('0x9'),'fewestcalls',_0x2f50('0xa'),'rrmemory','linear','wrandom',_0x2f50('0xb')),'allowNull':![],'defaultValue':_0x2f50('0x8'),'set':function(_0x185e1e){this[_0x2f50('0xc')](_0x2f50('0xd'),_0x185e1e?_0x185e1e:_0x2f50('0xe'));},'get':function(){var _0x281cc9=this[_0x2f50('0xf')](_0x2f50('0x10'));var _0x1faf0c=this[_0x2f50('0xf')]('dialMethod');var _0xe48560=this[_0x2f50('0xf')](_0x2f50('0xd'));if(_0x281cc9===_0x2f50('0x5')){return _0xe48560;}if(_0x1faf0c==='booked'&&_0xe48560===_0x2f50('0xe')||_0x1faf0c===_0x2f50('0x11')&&_0xe48560==='roundrobin'){return _0xe48560;}if(_0x1faf0c===_0x2f50('0x12')||_0x1faf0c==='predictive'||_0x1faf0c===_0x2f50('0x13')){return _0xe48560;}return null;}},'servicelevel':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2f50('0x2')]},'weight':{'type':Sequelize[_0x2f50('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':_0x2f50('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x2f50('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2f50('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2f50('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2f50('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2f50('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2f50('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2f50('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':_0x2f50('0x15')},'announce_holdtime':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no',_0x2f50('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2f50('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2f50('0x2')]},'queue_quantity2':{'type':Sequelize[_0x2f50('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x2f50('0x2')]},'queue_less_than':{'type':Sequelize[_0x2f50('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x496ff3){this[_0x2f50('0xc')](_0x2f50('0x17'),_0x496ff3?_0x496ff3['join'](','):[]);},'get':function(){return this[_0x2f50('0xf')](_0x2f50('0x17'))?this['getDataValue'](_0x2f50('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':_0x2f50('0x15'),'set':function(_0x586138){this[_0x2f50('0xc')](_0x2f50('0x18'),_0x586138?_0x586138['join'](','):undefined);},'get':function(){return this[_0x2f50('0xf')](_0x2f50('0x18'))?this['getDataValue'](_0x2f50('0x18'))[_0x2f50('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':'no','set':function(_0xb1c14d){this[_0x2f50('0xc')](_0x2f50('0x1a'),_0xb1c14d?_0xb1c14d['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x2f50('0x1a'))?this[_0x2f50('0xf')](_0x2f50('0x1a'))[_0x2f50('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x2f50('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2f50('0x2')]},'description':{'type':Sequelize[_0x2f50('0x2')]},'acw':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':0x0,'set':function(_0x19edd0){this[_0x2f50('0xc')](_0x2f50('0x1c'),_0x19edd0);if(_0x19edd0){if(this[_0x2f50('0xf')](_0x2f50('0x1d'))<0x2){this[_0x2f50('0xc')](_0x2f50('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2f50('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':0x0,'comment':_0x2f50('0x1e')},'dialMethod':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x1f'),'progressive','power',_0x2f50('0x20'),_0x2f50('0x11')),'defaultValue':'progressive','comment':_0x2f50('0x21')},'dialLimitChannel':{'type':Sequelize[_0x2f50('0x14')](0x4)[_0x2f50('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f50('0x23')},'dialLimitQueue':{'type':Sequelize[_0x2f50('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2f50('0x24')},'dialPowerLevel':{'type':Sequelize[_0x2f50('0x25')](0x2)[_0x2f50('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x2f50('0x4')](_0x2f50('0x26'),_0x2f50('0x27')),'defaultValue':'dropRate','comment':_0x2f50('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2f50('0x25')](0x2)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2f50('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2f50('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2f50('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':'tTxX','comment':_0x2f50('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x2d')},'dialQueueProject':{'type':Sequelize[_0x2f50('0x2')],'comment':_0x2f50('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'comment':_0x2f50('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'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[_0x2f50('0x2')],'defaultValue':_0x2f50('0x35')},'dialPrefix':{'type':Sequelize[_0x2f50('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2f50('0x4')]('always',_0x2f50('0x36'),_0x2f50('0x37')),'defaultValue':_0x2f50('0x38')},'dialAMDActive':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2f50('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2f50('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x2f50('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2f50('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2f50('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2f50('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2f50('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2f50('0x14')](0x9)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2f50('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2f50('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2f50('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2f50('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f50('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x2f50('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2f50('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2f50('0x4')]('DESC',_0x2f50('0x41')),'defaultValue':_0x2f50('0x42')},'dialQueueProject2':{'type':Sequelize[_0x2f50('0x2')],'comment':_0x2f50('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f50('0x43')},'dialCutDigit':{'type':Sequelize[_0x2f50('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2f50('0x14')](0x5)[_0x2f50('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2f50('0x14')](0x3)[_0x2f50('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f50('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f50('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f50('0x14')],'allowNull':!![],'comment':_0x2f50('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x24191d){if(!_0x24191d)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x24191d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2f50('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2f50('0x1b')],'defaultValue':![]}}; \ No newline at end of file +var _0xcb43=['#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','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','type','getDataValue','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#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','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0xb476fa,_0x49adfd){var _0x47d49b=function(_0x2d240a){while(--_0x2d240a){_0xb476fa['push'](_0xb476fa['shift']());}};_0x47d49b(++_0x49adfd);}(_0xcb43,0xe9));var _0x3cb4=function(_0x1602fb,_0x20b6b3){_0x1602fb=_0x1602fb-0x0;var _0x461831=_0xcb43[_0x1602fb];return _0x461831;};'use strict';var Sequelize=require(_0x3cb4('0x0'));module[_0x3cb4('0x1')]={'name':{'type':Sequelize[_0x3cb4('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':_0x3cb4('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x3cb4('0x3')]('rr',_0x3cb4('0x6'),_0x3cb4('0x7'),_0x3cb4('0x8'),_0x3cb4('0x9'),_0x3cb4('0xa'),_0x3cb4('0xb'),'wrandom',_0x3cb4('0xc')),'allowNull':![],'defaultValue':_0x3cb4('0x6'),'set':function(_0x2f8cc6){this[_0x3cb4('0xd')]('strategy',_0x2f8cc6?_0x2f8cc6:_0x3cb4('0xa'));},'get':function(){var _0x5ee553=this['getDataValue'](_0x3cb4('0xe'));var _0x4ccfe8=this[_0x3cb4('0xf')]('dialMethod');var _0xd5231e=this['getDataValue'](_0x3cb4('0x10'));if(_0x5ee553==='inbound'){return _0xd5231e;}if(_0x4ccfe8===_0x3cb4('0x11')&&_0xd5231e===_0x3cb4('0xa')||_0x4ccfe8===_0x3cb4('0x11')&&_0xd5231e===_0x3cb4('0x12')){return _0xd5231e;}if(_0x4ccfe8===_0x3cb4('0x13')||_0x4ccfe8===_0x3cb4('0x14')||_0x4ccfe8===_0x3cb4('0x15')){return _0xd5231e;}return null;}},'servicelevel':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3cb4('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3cb4('0x2')]},'weight':{'type':Sequelize[_0x3cb4('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x3cb4('0x17'),'no',_0x3cb4('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x3cb4('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3cb4('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3cb4('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3cb4('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':_0x3cb4('0x17')},'announce_holdtime':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x3cb4('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3cb4('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3cb4('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3cb4('0x2')]},'queue_quantity1':{'type':Sequelize[_0x3cb4('0x2')]},'queue_quantity2':{'type':Sequelize[_0x3cb4('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x3cb4('0x2')]},'queue_less_than':{'type':Sequelize[_0x3cb4('0x2')]},'periodic_announce':{'type':Sequelize[_0x3cb4('0x19')],'set':function(_0x1e5302){this[_0x3cb4('0xd')](_0x3cb4('0x1a'),_0x1e5302?_0x1e5302[_0x3cb4('0x1b')](','):[]);},'get':function(){return this[_0x3cb4('0xf')](_0x3cb4('0x1a'))?this['getDataValue'](_0x3cb4('0x1a'))[_0x3cb4('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x3cb4('0x17'),'set':function(_0xeb0fcb){this['setDataValue'](_0x3cb4('0x1d'),_0xeb0fcb?_0xeb0fcb[_0x3cb4('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x3cb4('0x1d'))?this[_0x3cb4('0xf')](_0x3cb4('0x1d'))[_0x3cb4('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':'no','set':function(_0x27053f){this[_0x3cb4('0xd')](_0x3cb4('0x1e'),_0x27053f?_0x27053f['join'](','):undefined);},'get':function(){return this[_0x3cb4('0xf')](_0x3cb4('0x1e'))?this[_0x3cb4('0xf')](_0x3cb4('0x1e'))[_0x3cb4('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3cb4('0x3')](_0x3cb4('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3cb4('0x2')]},'description':{'type':Sequelize[_0x3cb4('0x2')]},'acw':{'type':Sequelize[_0x3cb4('0x1f')],'defaultValue':0x0,'set':function(_0x4f7768){this[_0x3cb4('0xd')]('acw',_0x4f7768);if(_0x4f7768){if(this[_0x3cb4('0xf')](_0x3cb4('0x20'))<0x2){this[_0x3cb4('0xd')](_0x3cb4('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3cb4('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3cb4('0x1f')],'defaultValue':0x0,'comment':_0x3cb4('0x21')},'dialMethod':{'type':Sequelize['ENUM'](_0x3cb4('0x22'),'progressive',_0x3cb4('0x15'),_0x3cb4('0x14'),_0x3cb4('0x11')),'defaultValue':_0x3cb4('0x13'),'comment':_0x3cb4('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x3cb4('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3cb4('0x25')},'dialLimitQueue':{'type':Sequelize[_0x3cb4('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3cb4('0x26')},'dialPowerLevel':{'type':Sequelize[_0x3cb4('0x27')](0x2)[_0x3cb4('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x3cb4('0x28'),'dropRate'),'defaultValue':_0x3cb4('0x29'),'comment':_0x3cb4('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3cb4('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x3cb4('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3cb4('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3cb4('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':'tTxX','comment':_0x3cb4('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x3cb4('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3cb4('0x16')](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3cb4('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'comment':_0x3cb4('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3cb4('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3cb4('0x33'),_0x3cb4('0x34'),_0x3cb4('0x35')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3cb4('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3cb4('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3cb4('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x3cb4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3cb4('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3cb4('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3cb4('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3cb4('0x16')](0x9)[_0x3cb4('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3cb4('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3cb4('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3cb4('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3cb4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3cb4('0x16')](0x9)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3cb4('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x3cb4('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3cb4('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3cb4('0x16')](0x9)[_0x3cb4('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3cb4('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3cb4('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3cb4('0x3')]('DESC','ASC'),'defaultValue':_0x3cb4('0x40')},'dialQueueProject2':{'type':Sequelize[_0x3cb4('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3cb4('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3cb4('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3cb4('0x41')},'dialCutDigit':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3cb4('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3cb4('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x3cb4('0x16')](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3cb4('0x16')](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3cb4('0x16')](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3cb4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3cb4('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3cb4('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3cb4('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x3cb4('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x3cb4('0x1f')],'defaultValue':![],'comment':_0x3cb4('0x4a'),'set':function(_0x32bb6d){if(!_0x32bb6d)this[_0x3cb4('0xd')]('mandatoryDispositionPauseId',null);this[_0x3cb4('0xd')](_0x3cb4('0x4b'),_0x32bb6d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3cb4('0x16')](0x3)[_0x3cb4('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x3cb4('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3cb4('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 199330c..ebf966e 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 _0xdfde=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','get','role','QueueCampaigns','outbound','userProfileId','autoAssociation','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','format','SIP/%s','voicePause','emit','removeTeams','User','select','field','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','userVoiceQueue:save','isNil','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper','into','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','save','update','then','inbound','filter','map','type','value','UserProfileResource','destroy','end','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xdfde,0x78));var _0xedfd=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0xdfde[_0x3a3758];return _0x1a9234;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedfd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedfd('0x1'));var rp=require(_0xedfd('0x2'));var moment=require('moment');var BPromise=require(_0xedfd('0x3'));var Mustache=require(_0xedfd('0x4'));var util=require(_0xedfd('0x5'));var path=require(_0xedfd('0x6'));var sox=require(_0xedfd('0x7'));var csv=require(_0xedfd('0x8'));var ejs=require(_0xedfd('0x9'));var fs=require('fs');var fs_extra=require(_0xedfd('0xa'));var _=require(_0xedfd('0xb'));var squel=require(_0xedfd('0xc'));var crypto=require(_0xedfd('0xd'));var jsforce=require(_0xedfd('0xe'));var deskjs=require(_0xedfd('0xf'));var toCsv=require(_0xedfd('0x8'));var querystring=require(_0xedfd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xedfd('0x11'));var qs=require(_0xedfd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedfd('0x13'));var logger=require(_0xedfd('0x14'))(_0xedfd('0x15'));var utils=require(_0xedfd('0x16'));var config=require(_0xedfd('0x17'));var licenseUtil=require(_0xedfd('0x18'));var db=require(_0xedfd('0x19'))['db'];config[_0xedfd('0x1a')]=_[_0xedfd('0x1b')](config[_0xedfd('0x1a')],{'host':_0xedfd('0x1c'),'port':0x18eb});var socket=require(_0xedfd('0x1d'))(new Redis(config[_0xedfd('0x1a')]));require(_0xedfd('0x1e'))[_0xedfd('0x1f')](socket);function respondWithStatusCode(_0xba524c,_0x36e50f){_0x36e50f=_0x36e50f||0xcc;return function(_0x597f1e){if(_0x597f1e){return _0xba524c[_0xedfd('0x20')](_0x36e50f);}return _0xba524c[_0xedfd('0x21')](_0x36e50f)['end']();};}function respondWithResult(_0x2412b9,_0xd087ea){_0xd087ea=_0xd087ea||0xc8;return function(_0x12cd48){if(_0x12cd48){return _0x2412b9[_0xedfd('0x21')](_0xd087ea)[_0xedfd('0x22')](_0x12cd48);}};}function respondWithFilteredResult(_0x512988,_0x2835b7){return function(_0x31015d){if(_0x31015d){var _0x385caf=typeof _0x2835b7[_0xedfd('0x23')]==='undefined'&&typeof _0x2835b7[_0xedfd('0x24')]===_0xedfd('0x25');var _0x1de493=_0x31015d[_0xedfd('0x26')];var _0x1b9694=_0x385caf?0x0:_0x2835b7[_0xedfd('0x23')];var _0xc3015e=_0x385caf?_0x31015d[_0xedfd('0x26')]:_0x2835b7[_0xedfd('0x23')]+_0x2835b7[_0xedfd('0x24')];var _0x280a6c;if(_0xc3015e>=_0x1de493){_0xc3015e=_0x1de493;_0x280a6c=0xc8;}else{_0x280a6c=0xce;}_0x512988[_0xedfd('0x21')](_0x280a6c);return _0x512988[_0xedfd('0x27')]('Content-Range',_0x1b9694+'-'+_0xc3015e+'/'+_0x1de493)[_0xedfd('0x22')](_0x31015d);}return null;};}function patchUpdates(_0x670f06){return function(_0x9d7c4c){try{jsonpatch['apply'](_0x9d7c4c,_0x670f06,!![]);}catch(_0x3f679){return BPromise['reject'](_0x3f679);}return _0x9d7c4c[_0xedfd('0x28')]();};}function saveUpdates(_0x4c33ad,_0x385da6){return function(_0x216b19){if(_0x216b19){return _0x216b19[_0xedfd('0x29')](_0x4c33ad)[_0xedfd('0x2a')](function(_0xb2a258){return _0xb2a258;});}return null;};}function removeEntity(_0x1e9633,_0x34ad78){return function(_0xaad313){if(_0xaad313){return _0xaad313['destroy']()[_0xedfd('0x2a')](function(){var _0x1c1a74=_0xaad313['get']({'plain':!![]});var _0xdd9b45=[{'name':'VoiceQueues','value':_0xedfd('0x2b'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x2ae3a5=_(_0xdd9b45)[_0xedfd('0x2c')]('ignore')[_0xedfd('0x2d')]('value')['value']();if(_['includes'](_0x2ae3a5,_0x1c1a74[_0xedfd('0x2e')])){return;}var _0x1b3acb=_['find'](_0xdd9b45,[_0xedfd('0x2f'),_0x1c1a74['type']])['name'];return db[_0xedfd('0x30')][_0xedfd('0x31')]({'where':{'type':_0x1b3acb,'resourceId':_0x1c1a74['id']}})[_0xedfd('0x2a')](function(){return _0xaad313;});})[_0xedfd('0x2a')](function(){_0x1e9633['status'](0xcc)[_0xedfd('0x32')]();});}};}function handleEntityNotFound(_0x2cad55,_0x1a781b){return function(_0x13f458){if(!_0x13f458){_0x2cad55[_0xedfd('0x20')](0x194);}return _0x13f458;};}function handleError(_0x3a3da9,_0x18644e){_0x18644e=_0x18644e||0x1f4;return function(_0x21d3d1){logger[_0xedfd('0x33')](_0x21d3d1[_0xedfd('0x34')]);if(_0x21d3d1['name']){delete _0x21d3d1[_0xedfd('0x35')];}_0x3a3da9[_0xedfd('0x21')](_0x18644e)['send'](_0x21d3d1);};}exports['index']=function(_0x2e2db1,_0x90478e){var _0x283124={},_0x1bc6f0={},_0x4f06ba={'count':0x0,'rows':[]};var _0x426f53=_[_0xedfd('0x2d')](db[_0xedfd('0x36')][_0xedfd('0x37')],function(_0x837f40){return{'name':_0x837f40[_0xedfd('0x38')],'type':_0x837f40[_0xedfd('0x2e')][_0xedfd('0x39')]};});_0x1bc6f0['model']=_[_0xedfd('0x2d')](_0x426f53,_0xedfd('0x35'));_0x1bc6f0[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x2e2db1[_0xedfd('0x3a')]);_0x1bc6f0[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x1bc6f0[_0xedfd('0x3e')],_0x1bc6f0[_0xedfd('0x3a')]);_0x283124[_0xedfd('0x3f')]=_[_0xedfd('0x3d')](_0x1bc6f0[_0xedfd('0x3e')],qs['fields'](_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x283124[_0xedfd('0x3f')]=_0x283124['attributes'][_0xedfd('0x41')]?_0x283124[_0xedfd('0x3f')]:_0x1bc6f0[_0xedfd('0x3e')];if(!_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x283124[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x2e2db1['query']['limit']);_0x283124[_0xedfd('0x23')]=qs['offset'](_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x23')]);}_0x283124[_0xedfd('0x44')]=qs['sort'](_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x283124[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x2e2db1[_0xedfd('0x3a')],_0x1bc6f0[_0xedfd('0x3c')]),_0x426f53);if(_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x283124[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x283124[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x426f53,function(_0x58c89b){if(_0x58c89b[_0xedfd('0x2e')]!==_0xedfd('0x49')){var _0x1a7265={};_0x1a7265[_0x58c89b[_0xedfd('0x35')]]={'$like':'%'+_0x2e2db1[_0xedfd('0x3a')]['filter']+'%'};return _0x1a7265;}})});}_0x283124=_[_0xedfd('0x48')]({},_0x283124,_0x2e2db1[_0xedfd('0x4a')]);var _0x5e6c0f={'where':_0x283124['where']};return db['VoiceQueue'][_0xedfd('0x26')](_0x5e6c0f)[_0xedfd('0x2a')](function(_0x59c6a1){_0x4f06ba[_0xedfd('0x26')]=_0x59c6a1;if(_0x2e2db1[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x283124[_0xedfd('0x4c')]=[{'all':!![]}];}return db[_0xedfd('0x36')]['findAll'](_0x283124);})[_0xedfd('0x2a')](function(_0x2faf75){_0x4f06ba[_0xedfd('0x4d')]=_0x2faf75;return _0x4f06ba;})['then'](respondWithFilteredResult(_0x90478e,_0x283124))[_0xedfd('0x4e')](handleError(_0x90478e,null));};exports['show']=function(_0x41e3fd,_0xec8745){var _0x452fed={'raw':![],'where':{'id':_0x41e3fd[_0xedfd('0x4f')]['id']}},_0xc9c3ba={};_0xc9c3ba[_0xedfd('0x3e')]=_['keys'](db[_0xedfd('0x36')][_0xedfd('0x37')]);_0xc9c3ba['query']=_[_0xedfd('0x3b')](_0x41e3fd[_0xedfd('0x3a')]);_0xc9c3ba['filters']=_[_0xedfd('0x3d')](_0xc9c3ba['model'],_0xc9c3ba[_0xedfd('0x3a')]);_0x452fed['attributes']=_[_0xedfd('0x3d')](_0xc9c3ba[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x41e3fd[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x452fed[_0xedfd('0x3f')]=_0x452fed[_0xedfd('0x3f')]['length']?_0x452fed['attributes']:_0xc9c3ba[_0xedfd('0x3e')];if(_0x41e3fd['query'][_0xedfd('0x4b')]){_0x452fed[_0xedfd('0x4c')]=[{'all':!![]}];}_0x452fed=_[_0xedfd('0x48')]({},_0x452fed,_0x41e3fd[_0xedfd('0x4a')]);return db[_0xedfd('0x36')][_0xedfd('0x50')](_0x452fed)[_0xedfd('0x2a')](handleEntityNotFound(_0xec8745,null))[_0xedfd('0x2a')](respondWithResult(_0xec8745,null))[_0xedfd('0x4e')](handleError(_0xec8745,null));};exports[_0xedfd('0x51')]=function(_0x48fcdb,_0x3222cc){return db[_0xedfd('0x36')][_0xedfd('0x51')](_0x48fcdb[_0xedfd('0x52')],{})['then'](function(_0x5bf940){var _0x36853c=_0x48fcdb[_0xedfd('0x53')][_0xedfd('0x54')]({'plain':!![]});if(!_0x36853c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36853c[_0xedfd('0x55')]===_0xedfd('0x53')){var _0x133889=_0x5bf940[_0xedfd('0x54')]({'plain':!![]});var _0x2d8011=[{'name':'VoiceQueues','value':_0xedfd('0x2b')},{'name':_0xedfd('0x56'),'value':_0xedfd('0x57')}];var _0x3c980d=_[_0xedfd('0x50')](_0x2d8011,[_0xedfd('0x2f'),_0x133889[_0xedfd('0x2e')]])[_0xedfd('0x35')];return db['UserProfileSection'][_0xedfd('0x50')]({'where':{'name':_0x3c980d,'userProfileId':_0x36853c[_0xedfd('0x58')]},'raw':!![]})['then'](function(_0x3cafb0){if(_0x3cafb0&&_0x3cafb0[_0xedfd('0x59')]===0x0){return db[_0xedfd('0x30')][_0xedfd('0x51')]({'name':_0x133889[_0xedfd('0x35')],'resourceId':_0x133889['id'],'type':_0x3cafb0[_0xedfd('0x35')],'sectionId':_0x3cafb0['id']},{})[_0xedfd('0x2a')](function(){return _0x5bf940;});}else{return _0x5bf940;}})[_0xedfd('0x4e')](function(_0x2632d4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2632d4);throw _0x2632d4;});}return _0x5bf940;})['then'](respondWithResult(_0x3222cc,0xc9))[_0xedfd('0x4e')](handleError(_0x3222cc,null));};exports['clone']=function(_0x38a630,_0x514e40){var _0x2cc0f1={'where':{'id':_0x38a630[_0xedfd('0x4f')]['id']}},_0x96ba2e={};_0x96ba2e[_0xedfd('0x3e')]=_['keys'](db[_0xedfd('0x36')]['rawAttributes']);_0x2cc0f1[_0xedfd('0x3f')]=_[_0xedfd('0x3d')](_0x96ba2e['model'],qs['fields'](_0x38a630[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x2cc0f1[_0xedfd('0x3f')]=_0x2cc0f1[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x2cc0f1['attributes']:_0x96ba2e[_0xedfd('0x3e')];if(_0x38a630[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x2cc0f1[_0xedfd('0x4c')]=[{'all':!![]}];}_0x2cc0f1=_[_0xedfd('0x48')]({},_0x2cc0f1,_0x38a630[_0xedfd('0x4a')]);return db[_0xedfd('0x36')]['find'](_0x2cc0f1)['then'](handleEntityNotFound(_0x514e40,null))[_0xedfd('0x2a')](function(_0x7fbe4c){if(_0x7fbe4c){var _0x47fb61=_0x7fbe4c[_0xedfd('0x54')]({'plain':!![]});_0x47fb61=qs['omit'](_0x47fb61,['id',_0xedfd('0x5a'),_0xedfd('0x5b')]);_0x38a630[_0xedfd('0x52')]=_[_0xedfd('0x5c')](_0x38a630[_0xedfd('0x52')],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0xedfd('0x51')](_['merge'](_0x47fb61,_0x38a630[_0xedfd('0x52')]),{'include':_0x38a630[_0xedfd('0x3a')][_0xedfd('0x4b')]?[{'all':!![]}]:undefined})[_0xedfd('0x2a')](function(_0x37c706){var _0x45b24f=_0x38a630['user'][_0xedfd('0x54')]({'plain':!![]});if(!_0x45b24f)throw new Error(_0xedfd('0x5d'));if(_0x45b24f[_0xedfd('0x55')]==='user'){var _0x1d277e=_0x37c706[_0xedfd('0x54')]({'plain':!![]});var _0x7d34b8=[{'name':_0xedfd('0x5e'),'value':'inbound'},{'name':_0xedfd('0x56'),'value':_0xedfd('0x57')}];var _0x11b8aa=_[_0xedfd('0x50')](_0x7d34b8,[_0xedfd('0x2f'),_0x1d277e[_0xedfd('0x2e')]])['name'];return db[_0xedfd('0x5f')][_0xedfd('0x50')]({'where':{'name':_0x11b8aa,'userProfileId':_0x45b24f['userProfileId']},'raw':!![]})[_0xedfd('0x2a')](function(_0x1eaf0a){if(_0x1eaf0a&&_0x1eaf0a[_0xedfd('0x59')]===0x0){return db[_0xedfd('0x30')]['create']({'name':_0x1d277e['name'],'resourceId':_0x1d277e['id'],'type':_0x1eaf0a[_0xedfd('0x35')],'sectionId':_0x1eaf0a['id']},{})[_0xedfd('0x2a')](function(){return _0x37c706;});}else{return _0x37c706;}})['catch'](function(_0x28d50b){logger[_0xedfd('0x33')](_0xedfd('0x60'),_0x28d50b);throw _0x28d50b;});}return _0x37c706;});}})['then'](respondWithResult(_0x514e40,0xc9))[_0xedfd('0x4e')](handleError(_0x514e40,null));};exports['update']=function(_0x1306fa,_0x46a2f7){if(_0x1306fa[_0xedfd('0x52')]['id']){delete _0x1306fa[_0xedfd('0x52')]['id'];}return db['VoiceQueue'][_0xedfd('0x50')]({'where':{'id':_0x1306fa['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x46a2f7,null))[_0xedfd('0x2a')](saveUpdates(_0x1306fa['body'],null))[_0xedfd('0x2a')](respondWithResult(_0x46a2f7,null))[_0xedfd('0x4e')](handleError(_0x46a2f7,null));};exports[_0xedfd('0x31')]=function(_0x2c2f9b,_0x30e5b2){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x2c2f9b[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x30e5b2,null))[_0xedfd('0x2a')](removeEntity(_0x30e5b2,null))[_0xedfd('0x4e')](handleError(_0x30e5b2,null));};exports[_0xedfd('0x61')]=function(_0x500bd4,_0x438f5e,_0x35e71f){var _0x29e20a={'raw':![],'where':{}};var _0x198fd0={};var _0x775b6c={'count':0x0,'rows':[]};return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x500bd4[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x438f5e,null))[_0xedfd('0x2a')](function(_0x2fce4b){if(_0x2fce4b){_0x198fd0[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x62')][_0xedfd('0x37')]);_0x198fd0['query']=_[_0xedfd('0x3b')](_0x500bd4['query']);_0x198fd0[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x198fd0[_0xedfd('0x3e')],_0x198fd0[_0xedfd('0x3a')]);_0x29e20a[_0xedfd('0x3f')]=_['intersection'](_0x198fd0[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x500bd4[_0xedfd('0x3a')]['fields']));_0x29e20a[_0xedfd('0x3f')]=_0x29e20a['attributes'][_0xedfd('0x41')]?_0x29e20a[_0xedfd('0x3f')]:_0x198fd0[_0xedfd('0x3e')];if(!_0x500bd4[_0xedfd('0x3a')]['hasOwnProperty'](_0xedfd('0x43'))){_0x29e20a['limit']=qs[_0xedfd('0x24')](_0x500bd4[_0xedfd('0x3a')]['limit']);_0x29e20a['offset']=qs['offset'](_0x500bd4['query'][_0xedfd('0x23')]);}_0x29e20a['order']=qs[_0xedfd('0x45')](_0x500bd4[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x29e20a['where']=qs[_0xedfd('0x3c')](_['pick'](_0x500bd4[_0xedfd('0x3a')],_0x198fd0[_0xedfd('0x3c')]));_0x29e20a[_0xedfd('0x46')][_0xedfd('0x63')]=_0x2fce4b['id'];if(_0x500bd4[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x29e20a[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x29e20a['where'],{'$or':_[_0xedfd('0x2d')](_0x29e20a['attributes'],function(_0x12132b){var _0x79e7c8={};_0x79e7c8[_0x12132b]={'$like':'%'+_0x500bd4[_0xedfd('0x3a')]['filter']+'%'};return _0x79e7c8;})});}_0x29e20a=_['merge']({},_0x29e20a,_0x500bd4['options']);return db[_0xedfd('0x62')][_0xedfd('0x26')]({'where':_0x29e20a[_0xedfd('0x46')]})['then'](function(_0x5a9ac2){_0x775b6c['count']=_0x5a9ac2;if(_0x500bd4[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x29e20a[_0xedfd('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0xedfd('0x64')](_0x29e20a);})[_0xedfd('0x2a')](function(_0x451113){_0x775b6c['rows']=_0x451113;return _0x775b6c;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x438f5e,_0x29e20a))[_0xedfd('0x4e')](handleError(_0x438f5e,null));};exports[_0xedfd('0x65')]=function(_0x3dad06,_0x1e1838,_0x5966b7){var _0x1bdcd9={'raw':!![],'where':{}};var _0x466dae={};var _0x4afc54={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xedfd('0x66')]({'where':{'id':_0x3dad06[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1e1838,null))['then'](function(_0x8796b5){if(_0x8796b5){_0x466dae[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db['CmHopperHistory'][_0xedfd('0x37')]);_0x466dae[_0xedfd('0x3a')]=_['keys'](_0x3dad06['query']);_0x466dae[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x466dae[_0xedfd('0x3e')],_0x466dae['query']);_0x1bdcd9[_0xedfd('0x3f')]=_['intersection'](_0x466dae[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x3dad06[_0xedfd('0x3a')]['fields']));_0x1bdcd9['attributes']=_0x1bdcd9['attributes']['length']?_0x1bdcd9[_0xedfd('0x3f')]:_0x466dae[_0xedfd('0x3e')];if(!_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x1bdcd9[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x3dad06['query'][_0xedfd('0x24')]);_0x1bdcd9[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x23')]);}_0x1bdcd9[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x3dad06['query'][_0xedfd('0x45')]);_0x1bdcd9[_0xedfd('0x46')]=qs['filters'](_[_0xedfd('0x47')](_0x3dad06['query'],_0x466dae[_0xedfd('0x3c')]));_0x1bdcd9[_0xedfd('0x46')][_0xedfd('0x63')]=_0x8796b5['id'];if(_0x3dad06['query'][_0xedfd('0x2c')]){_0x1bdcd9['where']=_[_0xedfd('0x48')](_0x1bdcd9[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x1bdcd9[_0xedfd('0x3f')],function(_0x4a8693){var _0x58f478={};_0x58f478[_0x4a8693]={'$like':'%'+_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x58f478;})});}_0x1bdcd9=_['merge']({},_0x1bdcd9,_0x3dad06[_0xedfd('0x4a')]);return db[_0xedfd('0x67')][_0xedfd('0x26')]({'where':_0x1bdcd9['where']})[_0xedfd('0x2a')](function(_0x1362ad){_0x4afc54[_0xedfd('0x26')]=_0x1362ad;if(_0x3dad06[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x1bdcd9[_0xedfd('0x4c')]=[{'all':!![]}];}return db[_0xedfd('0x67')][_0xedfd('0x64')](_0x1bdcd9);})[_0xedfd('0x2a')](function(_0x3c62f4){_0x4afc54['rows']=_0x3c62f4;return _0x4afc54;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x1e1838,_0x1bdcd9))['catch'](handleError(_0x1e1838,null));};exports['getHopperFinals']=function(_0x2986db,_0x279871,_0x58ab48){var _0x4b8fcb={'raw':!![],'where':{}};var _0x1a2505={};var _0x1f0ef5={'count':0x0,'rows':[]};return db[_0xedfd('0x36')][_0xedfd('0x66')]({'where':{'id':_0x2986db[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x279871,null))[_0xedfd('0x2a')](function(_0x4b8910){if(_0x4b8910){_0x1a2505[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x68')]['rawAttributes']);_0x1a2505[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x2986db[_0xedfd('0x3a')]);_0x1a2505[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x1a2505[_0xedfd('0x3e')],_0x1a2505['query']);_0x4b8fcb['attributes']=_[_0xedfd('0x3d')](_0x1a2505[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x2986db[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x4b8fcb['attributes']=_0x4b8fcb['attributes']['length']?_0x4b8fcb[_0xedfd('0x3f')]:_0x1a2505[_0xedfd('0x3e')];if(!_0x2986db[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x4b8fcb[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x2986db[_0xedfd('0x3a')][_0xedfd('0x24')]);_0x4b8fcb[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x2986db['query']['offset']);}_0x4b8fcb['order']=qs[_0xedfd('0x45')](_0x2986db[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x4b8fcb[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x2986db[_0xedfd('0x3a')],_0x1a2505[_0xedfd('0x3c')]));_0x4b8fcb[_0xedfd('0x46')][_0xedfd('0x63')]=_0x4b8910['id'];if(_0x2986db[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x4b8fcb['where']=_['merge'](_0x4b8fcb[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x4b8fcb[_0xedfd('0x3f')],function(_0x2df58c){var _0x36a316={};_0x36a316[_0x2df58c]={'$like':'%'+_0x2986db[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x36a316;})});}_0x4b8fcb=_[_0xedfd('0x48')]({},_0x4b8fcb,_0x2986db[_0xedfd('0x4a')]);return db[_0xedfd('0x68')][_0xedfd('0x26')]({'where':_0x4b8fcb[_0xedfd('0x46')]})['then'](function(_0x1e7f40){_0x1f0ef5[_0xedfd('0x26')]=_0x1e7f40;if(_0x2986db[_0xedfd('0x3a')][_0xedfd('0x4b')]){_0x4b8fcb[_0xedfd('0x4c')]=[{'all':!![]}];}return db[_0xedfd('0x68')][_0xedfd('0x64')](_0x4b8fcb);})[_0xedfd('0x2a')](function(_0x762588){_0x1f0ef5[_0xedfd('0x4d')]=_0x762588;return _0x1f0ef5;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x279871,_0x4b8fcb))[_0xedfd('0x4e')](handleError(_0x279871,null));};exports[_0xedfd('0x69')]=function(_0x129111,_0x450c30,_0x140ef5){var _0x17e6cf={'raw':!![],'where':{}};var _0x28619c={};var _0x55a3f4={'count':0x0,'rows':[]};return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x129111['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x450c30,null))[_0xedfd('0x2a')](function(_0x1e1647){if(_0x1e1647){_0x28619c['model']=_['keys'](db[_0xedfd('0x6a')][_0xedfd('0x37')]);_0x28619c[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x129111['query']);_0x28619c['filters']=_[_0xedfd('0x3d')](_0x28619c[_0xedfd('0x3e')],_0x28619c[_0xedfd('0x3a')]);_0x17e6cf['attributes']=_['intersection'](_0x28619c['model'],qs[_0xedfd('0x40')](_0x129111[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x17e6cf[_0xedfd('0x3f')]=_0x17e6cf[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x17e6cf[_0xedfd('0x3f')]:_0x28619c[_0xedfd('0x3e')];if(!_0x129111[_0xedfd('0x3a')][_0xedfd('0x42')](_0xedfd('0x43'))){_0x17e6cf['limit']=qs[_0xedfd('0x24')](_0x129111[_0xedfd('0x3a')]['limit']);_0x17e6cf['offset']=qs[_0xedfd('0x23')](_0x129111[_0xedfd('0x3a')][_0xedfd('0x23')]);}_0x17e6cf[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x129111[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x17e6cf[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x129111[_0xedfd('0x3a')],_0x28619c['filters']));_0x17e6cf[_0xedfd('0x46')][_0xedfd('0x63')]=_0x1e1647['id'];if(_0x129111[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x17e6cf[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x17e6cf[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x17e6cf[_0xedfd('0x3f')],function(_0x2178fc){var _0x1ef940={};_0x1ef940[_0x2178fc]={'$like':'%'+_0x129111[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x1ef940;})});}_0x17e6cf=_['merge']({},_0x17e6cf,_0x129111[_0xedfd('0x4a')]);return db[_0xedfd('0x6a')]['count']({'where':_0x17e6cf[_0xedfd('0x46')]})[_0xedfd('0x2a')](function(_0x32afbf){_0x55a3f4[_0xedfd('0x26')]=_0x32afbf;if(_0x129111[_0xedfd('0x3a')]['includeAll']){_0x17e6cf[_0xedfd('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xedfd('0x64')](_0x17e6cf);})[_0xedfd('0x2a')](function(_0x18bb56){_0x55a3f4[_0xedfd('0x4d')]=_0x18bb56;return _0x55a3f4;});}})[_0xedfd('0x2a')](respondWithFilteredResult(_0x450c30,_0x17e6cf))[_0xedfd('0x4e')](handleError(_0x450c30,null));};exports[_0xedfd('0x6b')]=function(_0x48832a,_0x1f9425,_0x3a0d55){var _0x20fe78={};var _0x393b25={};var _0x2f2e23;var _0x45acc8;return db['VoiceQueue'][_0xedfd('0x66')]({'where':{'id':_0x48832a[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1f9425,null))[_0xedfd('0x2a')](function(_0x3d44e5){if(_0x3d44e5){_0x2f2e23=_0x3d44e5;_0x393b25['model']=_['keys'](db['Team'][_0xedfd('0x37')]);_0x393b25[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x48832a[_0xedfd('0x3a')]);_0x393b25[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x393b25[_0xedfd('0x3e')],_0x393b25[_0xedfd('0x3a')]);_0x20fe78[_0xedfd('0x3f')]=_['intersection'](_0x393b25[_0xedfd('0x3e')],qs['fields'](_0x48832a[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x20fe78[_0xedfd('0x3f')]=_0x20fe78[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x20fe78[_0xedfd('0x3f')]:_0x393b25['model'];_0x20fe78['order']=qs[_0xedfd('0x45')](_0x48832a[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x20fe78['where']=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x48832a[_0xedfd('0x3a')],_0x393b25[_0xedfd('0x3c')]));if(_0x48832a[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x20fe78[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x20fe78['where'],{'$or':_[_0xedfd('0x2d')](_0x20fe78[_0xedfd('0x3f')],function(_0x1cf9a2){var _0x433c1d={};_0x433c1d[_0x1cf9a2]={'$like':'%'+_0x48832a[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x433c1d;})});}_0x20fe78=_['merge']({},_0x20fe78,_0x48832a[_0xedfd('0x4a')]);return _0x2f2e23[_0xedfd('0x6b')](_0x20fe78);}})['then'](function(_0x10026b){if(_0x10026b){_0x45acc8=_0x10026b[_0xedfd('0x41')];if(!_0x48832a['query'][_0xedfd('0x42')](_0xedfd('0x43'))){_0x20fe78[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x48832a[_0xedfd('0x3a')][_0xedfd('0x24')]);_0x20fe78[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x48832a['query'][_0xedfd('0x23')]);}return _0x2f2e23[_0xedfd('0x6b')](_0x20fe78);}})[_0xedfd('0x2a')](function(_0x577f88){if(_0x577f88){return _0x577f88?{'count':_0x45acc8,'rows':_0x577f88}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x1f9425,null))[_0xedfd('0x4e')](handleError(_0x1f9425,null));};exports[_0xedfd('0x6c')]=function(_0x4e5274,_0x551b91,_0x57b657){var _0x9163e3=_0x4e5274[_0xedfd('0x52')]['teams'];var _0x2daf76=_['map'](_0x9163e3,'id');return db[_0xedfd('0x6d')]['findAll']({'where':{'id':_0x2daf76},'attributes':['id'],'include':[{'model':db['User'],'as':_0xedfd('0x6e'),'attributes':['id',_0xedfd('0x35'),_0xedfd('0x6f'),'voicePause',_0xedfd('0x70')],'raw':!![]}]})[_0xedfd('0x2a')](function(_0x57d498){if(_0x57d498){var _0x3139f7=_[_0xedfd('0x71')](_0x57d498,function(_0x2ff1bc){var _0x3af753=_0x2ff1bc[_0xedfd('0x54')]({'plain':!![]});_0x3af753[_0xedfd('0x6e')][_0xedfd('0x72')](function(_0x4e6c31){_0x4e6c31[_0xedfd('0x73')]=_[_0xedfd('0x50')](_0x9163e3,{'id':_0x3af753['id']})['penalty'];});return _0x3af753[_0xedfd('0x6e')];});return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x4e5274[_0xedfd('0x4f')]['id']}})['then'](function(_0x30c6cd){return db[_0xedfd('0x74')][_0xedfd('0x75')](function(_0x9dc086){return _0x30c6cd[_0xedfd('0x6c')](_0x2daf76,{'transaction':_0x9dc086})['then'](function(){return BPromise[_0xedfd('0x76')](_0x9163e3,function(_0x57a8c8){return db[_0xedfd('0x77')][_0xedfd('0x78')]({'TeamId':_0x57a8c8['id'],'VoiceQueueId':_0x4e5274[_0xedfd('0x4f')]['id'],'penalty':_0x57a8c8['penalty']},{'transaction':_0x9dc086});});})['then'](function(){return BPromise[_0xedfd('0x76')](_0x3139f7,function(_0x5bde5e){return db['UserVoiceQueue'][_0xedfd('0x79')]({'where':{'UserId':_0x5bde5e['id'],'VoiceQueueId':_0x4e5274[_0xedfd('0x4f')]['id']},'defaults':{'penalty':_0x5bde5e['penalty']},'transaction':_0x9dc086});});})[_0xedfd('0x2a')](function(){return BPromise[_0xedfd('0x76')](_[_0xedfd('0x2c')](_0x3139f7,{'online':!![]}),function(_0x4664d8){return db[_0xedfd('0x7a')]['upsert']({'membername':_0x4664d8[_0xedfd('0x35')],'UserId':_0x4664d8['id'],'queue_name':_0x30c6cd['name'],'VoiceQueueId':_0x30c6cd['id'],'interface':_['isNil'](_0x4664d8[_0xedfd('0x70')])?util[_0xedfd('0x7b')](_0xedfd('0x7c'),_0x4664d8['name']):_0x4664d8[_0xedfd('0x70')],'paused':_0x4664d8[_0xedfd('0x7d')]||![],'penalty':_0x4664d8[_0xedfd('0x73')]},{'transaction':_0x9dc086});});})[_0xedfd('0x2a')](function(){_0x3139f7[_0xedfd('0x72')](function(_0x10a3e6){socket[_0xedfd('0x7e')]('userVoiceQueue:save',{'UserId':_0x10a3e6['id'],'VoiceQueueId':_0x30c6cd['id']});});});});});}})['then'](respondWithStatusCode(_0x551b91,null))[_0xedfd('0x4e')](handleError(_0x551b91,null));};exports[_0xedfd('0x7f')]=function(_0x3002fc,_0xc9507e,_0x411431){return db[_0xedfd('0x6d')][_0xedfd('0x64')]({'where':{'id':_0x3002fc[_0xedfd('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xedfd('0x80')],'as':_0xedfd('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xc9507e,null))[_0xedfd('0x2a')](function(_0x43f081){var _0x42903f=_[_0xedfd('0x2d')](_0x43f081,'id');var _0x4ce72c=[];var _0x256829=[];var _0x4b1ee0=squel[_0xedfd('0x81')]();_0x4b1ee0[_0xedfd('0x82')]('tq.TeamId')['from'](_0xedfd('0x83'),'tq')['join']('user_has_teams','ut',_0xedfd('0x84'))[_0xedfd('0x46')](_0xedfd('0x85'),_0x3002fc[_0xedfd('0x4f')]['id']);for(var _0x546ff0=0x0;_0x546ff0<_0x43f081[_0xedfd('0x41')];_0x546ff0+=0x1){let _0x186780=_0x43f081[_0x546ff0];for(var _0x49615e=0x0;_0x49615e<_0x186780[_0xedfd('0x6e')][_0xedfd('0x41')];_0x49615e+=0x1){let _0x207c33=_0x186780[_0xedfd('0x6e')][_0x49615e];var _0x3efc4c=_0x4b1ee0[_0xedfd('0x86')]();_0x3efc4c[_0xedfd('0x46')](_0xedfd('0x87'),_0x207c33['id']);_0x256829[_0xedfd('0x88')](db['sequelize'][_0xedfd('0x3a')](_0x3efc4c[_0xedfd('0x89')](),{'type':db[_0xedfd('0x74')]['QueryTypes']['SELECT']})[_0xedfd('0x2a')](function(_0x3e806a){if(_0x3e806a[_0xedfd('0x41')]===0x1){return _0x207c33['id'];}else{var _0x5b193b=_[_0xedfd('0x8a')](_[_0xedfd('0x2d')](_0x3e806a,_0xedfd('0x8b')),function(_0x5b0e57){return _['includes'](_0x42903f,_0x5b0e57);});if(_0x5b193b){return _0x207c33['id'];}}}));}}return BPromise[_0xedfd('0x8c')](_0x256829)[_0xedfd('0x2a')](function(_0x46ca19){_0x4ce72c=_(_0x4ce72c)[_0xedfd('0x8d')](_0x46ca19)[_0xedfd('0x8e')]()[_0xedfd('0x2f')]();return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x3002fc['params']['id']}})[_0xedfd('0x2a')](function(_0x4a143c){return db['sequelize'][_0xedfd('0x75')](function(_0x3f1377){return _0x4a143c[_0xedfd('0x7f')](_0x3002fc[_0xedfd('0x3a')]['ids'],{'transaction':_0x3f1377})[_0xedfd('0x2a')](function(){if(!_[_0xedfd('0x8f')](_0x4ce72c)){return _0x4a143c[_0xedfd('0x90')](_0x4ce72c,{'transaction':_0x3f1377})[_0xedfd('0x2a')](function(){return db[_0xedfd('0x7a')][_0xedfd('0x31')]({'where':{'VoiceQueueId':_0x3002fc[_0xedfd('0x4f')]['id'],'UserId':_0x4ce72c},'transaction':_0x3f1377});});}})[_0xedfd('0x2a')](function(){_0x4ce72c['forEach'](function(_0x39e776){socket[_0xedfd('0x7e')](_0xedfd('0x91'),{'UserId':_0x39e776,'VoiceQueueId':_0x4a143c['id']});});});});});});})['then'](respondWithStatusCode(_0xc9507e,null))['catch'](handleError(_0xc9507e,null));};exports[_0xedfd('0x92')]=function(_0x23d95d,_0x1c3ea1,_0x4eeb94){var _0x15e067,_0x4950f8;return db['VoiceQueue'][_0xedfd('0x50')]({'where':{'id':_0x23d95d[_0xedfd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c3ea1,null))[_0xedfd('0x2a')](function(_0x28dc0a){if(_0x28dc0a){_0x4950f8=_0x28dc0a;return _0x28dc0a[_0xedfd('0x92')](_0x23d95d[_0xedfd('0x52')][_0xedfd('0x93')],_[_0xedfd('0x5c')](_0x23d95d[_0xedfd('0x52')],[_0xedfd('0x93'),'id'])||{})[_0xedfd('0x94')](function(_0x35cbbf){for(var _0x513eb3=0x0;_0x513eb3<_0x23d95d[_0xedfd('0x52')][_0xedfd('0x93')][_0xedfd('0x41')];_0x513eb3+=0x1){socket[_0xedfd('0x7e')](_0xedfd('0x95'),{'UserId':Number(_0x23d95d[_0xedfd('0x52')][_0xedfd('0x93')][_0x513eb3]),'VoiceQueueId':Number(_0x23d95d[_0xedfd('0x4f')]['id'])});}return _0x35cbbf;});}})['then'](function(_0x253da8){_0x15e067=_0x253da8||[];if(_0x4950f8){return db[_0xedfd('0x80')][_0xedfd('0x64')]({'where':{'id':_0x23d95d[_0xedfd('0x52')]['ids']},'attributes':['id',_0xedfd('0x35'),_0xedfd('0x6f'),'voicePause','interface'],'raw':!![]});}})[_0xedfd('0x2a')](function(_0x2b060b){if(!_[_0xedfd('0x8f')](_0x2b060b)){var _0x16b9e6=[];for(var _0x4f728e=0x0;_0x4f728e<_0x2b060b['length'];_0x4f728e++){if(_0x2b060b[_0x4f728e]['online']){_0x16b9e6[_0xedfd('0x88')](db[_0xedfd('0x7a')]['upsert']({'membername':_0x2b060b[_0x4f728e][_0xedfd('0x35')],'UserId':_0x2b060b[_0x4f728e]['id'],'queue_name':_0x4950f8[_0xedfd('0x35')],'VoiceQueueId':_0x4950f8['id'],'interface':_[_0xedfd('0x96')](_0x2b060b[_0x4f728e][_0xedfd('0x70')])?util[_0xedfd('0x7b')](_0xedfd('0x7c'),_0x2b060b[_0x4f728e][_0xedfd('0x35')]):_0x2b060b[_0x4f728e][_0xedfd('0x70')],'paused':_0x2b060b[_0x4f728e][_0xedfd('0x7d')]||![],'penalty':_0x23d95d[_0xedfd('0x52')]['penalty']||0x0}));}}return BPromise[_0xedfd('0x8c')](_0x16b9e6);}})['then'](function(){return _0x15e067;})[_0xedfd('0x2a')](respondWithResult(_0x1c3ea1,null))[_0xedfd('0x4e')](handleError(_0x1c3ea1,null));};exports[_0xedfd('0x90')]=function(_0x2a45a5,_0x569e4c,_0x1e0e41){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x2a45a5[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x569e4c,null))[_0xedfd('0x2a')](function(_0x27de16){if(_0x27de16){return _0x27de16[_0xedfd('0x90')](_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')])[_0xedfd('0x2a')](function(){if(_[_0xedfd('0x97')](_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')])){for(var _0x428ec8=0x0;_0x428ec8<_0x2a45a5['query']['ids'][_0xedfd('0x41')];_0x428ec8+=0x1){socket[_0xedfd('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')][_0x428ec8]),'VoiceQueueId':Number(_0x2a45a5['params']['id'])});}}else{socket['emit'](_0xedfd('0x91'),{'UserId':Number(_0x2a45a5[_0xedfd('0x3a')][_0xedfd('0x93')]),'VoiceQueueId':Number(_0x2a45a5[_0xedfd('0x4f')]['id'])});}});}})[_0xedfd('0x2a')](function(_0x53eac3){return db['UserVoiceQueueRt'][_0xedfd('0x31')]({'where':{'VoiceQueueId':_0x2a45a5[_0xedfd('0x4f')]['id'],'UserId':_0x2a45a5[_0xedfd('0x3a')]['ids']}})[_0xedfd('0x2a')](function(){return _0x53eac3;});})[_0xedfd('0x2a')](respondWithStatusCode(_0x569e4c,null))['catch'](handleError(_0x569e4c,null));};exports[_0xedfd('0x98')]=function(_0x265d5c,_0x3d82be,_0x1207dc){var _0x14e168={};var _0x5b89f1={};var _0x3e1743;var _0x37c0fb;return db[_0xedfd('0x36')][_0xedfd('0x66')]({'where':{'id':_0x265d5c[_0xedfd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d82be,null))['then'](function(_0x3807b5){if(_0x3807b5){_0x3e1743=_0x3807b5;_0x5b89f1[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x80')][_0xedfd('0x37')]);_0x5b89f1[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x265d5c['query']);_0x5b89f1[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0x5b89f1['model'],_0x5b89f1[_0xedfd('0x3a')]);_0x14e168[_0xedfd('0x3f')]=_[_0xedfd('0x3d')](_0x5b89f1['model'],qs[_0xedfd('0x40')](_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x14e168[_0xedfd('0x3f')]=_0x14e168['attributes'][_0xedfd('0x41')]?_0x14e168['attributes']:_0x5b89f1[_0xedfd('0x3e')];_0x14e168['order']=qs[_0xedfd('0x45')](_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x14e168[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x265d5c['query'],_0x5b89f1[_0xedfd('0x3c')]));if(_0x265d5c['query'][_0xedfd('0x2c')]){_0x14e168[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x14e168['where'],{'$or':_[_0xedfd('0x2d')](_0x14e168['attributes'],function(_0x9b5ac7){var _0x480a04={};_0x480a04[_0x9b5ac7]={'$like':'%'+_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x480a04;})});}_0x14e168=_[_0xedfd('0x48')]({},_0x14e168,_0x265d5c[_0xedfd('0x4a')]);return _0x3e1743[_0xedfd('0x98')](_0x14e168);}})[_0xedfd('0x2a')](function(_0x289ae6){if(_0x289ae6){_0x37c0fb=_0x289ae6[_0xedfd('0x41')];if(!_0x265d5c['query'][_0xedfd('0x42')](_0xedfd('0x43'))){_0x14e168[_0xedfd('0x24')]=qs[_0xedfd('0x24')](_0x265d5c[_0xedfd('0x3a')]['limit']);_0x14e168[_0xedfd('0x23')]=qs['offset'](_0x265d5c[_0xedfd('0x3a')][_0xedfd('0x23')]);}return _0x3e1743[_0xedfd('0x98')](_0x14e168);}})[_0xedfd('0x2a')](function(_0x3a714e){if(_0x3a714e){return _0x3a714e?{'count':_0x37c0fb,'rows':_0x3a714e}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x3d82be,null))[_0xedfd('0x4e')](handleError(_0x3d82be,null));};exports[_0xedfd('0x99')]=function(_0x4a23d5,_0x1d96e0,_0x17c187){var _0x1c11f9={};var _0x48d3b1={};var _0x208a5a;var _0x3b47bb;return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x4a23d5[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1d96e0,null))[_0xedfd('0x2a')](function(_0x511df0){if(_0x511df0){_0x208a5a=_0x511df0;_0x48d3b1[_0xedfd('0x3e')]=_['keys'](db[_0xedfd('0x7a')][_0xedfd('0x37')]);_0x48d3b1[_0xedfd('0x3a')]=_['keys'](_0x4a23d5[_0xedfd('0x3a')]);_0x48d3b1['filters']=_[_0xedfd('0x3d')](_0x48d3b1[_0xedfd('0x3e')],_0x48d3b1[_0xedfd('0x3a')]);_0x1c11f9[_0xedfd('0x3f')]=_['intersection'](_0x48d3b1[_0xedfd('0x3e')],qs['fields'](_0x4a23d5['query'][_0xedfd('0x40')]));_0x1c11f9[_0xedfd('0x3f')]=_0x1c11f9[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x1c11f9[_0xedfd('0x3f')]:_0x48d3b1[_0xedfd('0x3e')];_0x1c11f9[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x4a23d5[_0xedfd('0x3a')]['sort']);_0x1c11f9[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x4a23d5[_0xedfd('0x3a')],_0x48d3b1[_0xedfd('0x3c')]));if(_0x4a23d5[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x1c11f9[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x1c11f9[_0xedfd('0x46')],{'$or':_['map'](_0x1c11f9[_0xedfd('0x3f')],function(_0x3c58d3){var _0x324ba3={};_0x324ba3[_0x3c58d3]={'$like':'%'+_0x4a23d5[_0xedfd('0x3a')]['filter']+'%'};return _0x324ba3;})});}_0x1c11f9=_[_0xedfd('0x48')]({},_0x1c11f9,_0x4a23d5['options']);return _0x208a5a['getMembers'](_0x1c11f9);}})[_0xedfd('0x2a')](function(_0x44714f){if(_0x44714f){_0x3b47bb=_0x44714f['length'];if(!_0x4a23d5['query'][_0xedfd('0x42')](_0xedfd('0x43'))){_0x1c11f9['limit']=qs[_0xedfd('0x24')](_0x4a23d5[_0xedfd('0x3a')]['limit']);_0x1c11f9[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x4a23d5[_0xedfd('0x3a')][_0xedfd('0x23')]);}return _0x208a5a[_0xedfd('0x99')](_0x1c11f9);}})[_0xedfd('0x2a')](function(_0x5c4b47){return _0x5c4b47?{'count':_0x3b47bb,'rows':_0x5c4b47}:null;})['then'](respondWithResult(_0x1d96e0,null))[_0xedfd('0x4e')](handleError(_0x1d96e0,null));};exports[_0xedfd('0x9a')]=function(_0x22d8c1,_0x1a0cad,_0x4b19ad){var _0x186053={};var _0x120ed8={};var _0x7ddaba;var _0x19247c;return db[_0xedfd('0x36')]['findOne']({'where':{'id':_0x22d8c1[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1a0cad,null))[_0xedfd('0x2a')](function(_0x3061d6){if(_0x3061d6){_0x7ddaba=_0x3061d6;_0x120ed8[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db[_0xedfd('0x9b')][_0xedfd('0x37')]);_0x120ed8['query']=_[_0xedfd('0x3b')](_0x22d8c1['query']);_0x120ed8[_0xedfd('0x3c')]=_['intersection'](_0x120ed8[_0xedfd('0x3e')],_0x120ed8[_0xedfd('0x3a')]);_0x186053['attributes']=_[_0xedfd('0x3d')](_0x120ed8[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x22d8c1[_0xedfd('0x3a')]['fields']));_0x186053[_0xedfd('0x3f')]=_0x186053[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x186053[_0xedfd('0x3f')]:_0x120ed8[_0xedfd('0x3e')];_0x186053['order']=qs[_0xedfd('0x45')](_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x45')]);_0x186053[_0xedfd('0x46')]=qs[_0xedfd('0x3c')](_[_0xedfd('0x47')](_0x22d8c1[_0xedfd('0x3a')],_0x120ed8[_0xedfd('0x3c')]));if(_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x186053[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x186053[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x186053[_0xedfd('0x3f')],function(_0x706056){var _0x48c1fc={};_0x48c1fc[_0x706056]={'$like':'%'+_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x48c1fc;})});}_0x186053=_[_0xedfd('0x48')]({},_0x186053,_0x22d8c1[_0xedfd('0x4a')]);return _0x7ddaba[_0xedfd('0x9a')](_0x186053);}})[_0xedfd('0x2a')](function(_0x1fa198){if(_0x1fa198){_0x19247c=_0x1fa198[_0xedfd('0x41')];if(!_0x22d8c1[_0xedfd('0x3a')]['hasOwnProperty'](_0xedfd('0x43'))){_0x186053['limit']=qs['limit'](_0x22d8c1[_0xedfd('0x3a')][_0xedfd('0x24')]);_0x186053['offset']=qs[_0xedfd('0x23')](_0x22d8c1['query'][_0xedfd('0x23')]);}return _0x7ddaba[_0xedfd('0x9a')](_0x186053);}})[_0xedfd('0x2a')](function(_0x731944){if(_0x731944){return _0x731944?{'count':_0x19247c,'rows':_0x731944}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x1a0cad,null))[_0xedfd('0x4e')](handleError(_0x1a0cad,null));};exports['addLists']=function(_0x5cc755,_0x1161f1,_0xc16bb3){var _0xe3813b,_0x43341a;return db[_0xedfd('0x36')]['find']({'where':{'id':_0x5cc755[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x1161f1,null))[_0xedfd('0x2a')](function(_0x6b1f5f){if(_0x6b1f5f){_0x43341a=_0x6b1f5f;return _0x6b1f5f[_0xedfd('0x9c')](_0x5cc755[_0xedfd('0x52')]['ids'],_[_0xedfd('0x5c')](_0x5cc755[_0xedfd('0x52')],[_0xedfd('0x93'),'id'])||{});}return null;})[_0xedfd('0x94')](function(_0xb819ed){var _0x392ff2;_0xe3813b=_0xb819ed||[];var _0x2ab9ab=[];if(_0xb819ed){for(var _0x37bbe4=0x0;_0x37bbe4<_0xb819ed[_0xedfd('0x41')];_0x37bbe4+=0x1){var _0x38d620=_0xb819ed[_0x37bbe4][_0xedfd('0x54')]({'plain':!![]});_0x43341a[_0xedfd('0x9d')]=_0x5cc755[_0xedfd('0x52')][_0xedfd('0x9d')]?_0x5cc755[_0xedfd('0x52')]['dialCheckDuplicateType']:_0x43341a['dialCheckDuplicateType'];switch(_0x43341a[_0xedfd('0x9d')]){case _0xedfd('0x9e'):_0x392ff2=squel[_0xedfd('0x9f')]()['into']('cm_hopper')[_0xedfd('0xa0')]([_0xedfd('0xa1'),_0xedfd('0xa2'),'ContactId',_0xedfd('0xa3'),_0xedfd('0x63'),_0xedfd('0x5a'),_0xedfd('0x5b')],squel[_0xedfd('0x81')]()['field'](_0xedfd('0xa1'),_0xedfd('0xa1'))['field'](_0xedfd('0xa4'),_0xedfd('0xa2'))['field']('id',_0xedfd('0xa5'))['field'](_0x38d620['CmListId']['toString'](),_0xedfd('0xa3'))[_0xedfd('0x82')](_0x5cc755[_0xedfd('0x4f')]['id'][_0xedfd('0x89')](),_0xedfd('0x63'))[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0x5a'))['field'](_0xedfd('0xa4'),_0xedfd('0x5b'))[_0xedfd('0xa6')](_0xedfd('0xa7'))['where'](_0xedfd('0xa8'))[_0xedfd('0x46')](_0xedfd('0xa9'),_0x38d620[_0xedfd('0xaa')]['toString']())[_0xedfd('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xedfd('0xab'),squel['select']()[_0xedfd('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0xedfd('0xa6')](_0xedfd('0xac'))[_0xedfd('0x46')](_0xedfd('0x85'),_0x5cc755['params']['id']['toString']()))[_0xedfd('0x46')](_0xedfd('0xab'),squel[_0xedfd('0x81')]()[_0xedfd('0x82')]('COALESCE(phone,\x27\x27)')[_0xedfd('0xa6')](_0xedfd('0xad'))[_0xedfd('0x46')](_0xedfd('0x85'),_0x5cc755['params']['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x392ff2=squel[_0xedfd('0x9f')]()[_0xedfd('0xae')](_0xedfd('0xad'))[_0xedfd('0xa0')](['phone','scheduledAt','ContactId',_0xedfd('0xa3'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xedfd('0x81')]()[_0xedfd('0x82')](_0xedfd('0xa1'),_0xedfd('0xa1'))['field'](_0xedfd('0xa4'),_0xedfd('0xa2'))[_0xedfd('0x82')]('id',_0xedfd('0xa5'))[_0xedfd('0x82')](_0x38d620['CmListId']['toString'](),'ListId')[_0xedfd('0x82')](_0x5cc755[_0xedfd('0x4f')]['id'][_0xedfd('0x89')](),'VoiceQueueId')['field']('NOW()','createdAt')[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0x5b'))[_0xedfd('0xa6')](_0xedfd('0xa7'))[_0xedfd('0x46')](_0xedfd('0xa8'))['where'](_0xedfd('0xa9'),_0x38d620[_0xedfd('0xaa')]['toString']())[_0xedfd('0x46')](_0xedfd('0xaf'))[_0xedfd('0x46')](_0xedfd('0xab'),squel[_0xedfd('0x81')]()[_0xedfd('0x82')](_0xedfd('0xb0'))['from']('cm_hopper')[_0xedfd('0x46')](_0xedfd('0x85'),_0x5cc755[_0xedfd('0x4f')]['id'][_0xedfd('0x89')]())))[_0xedfd('0x89')]();break;default:_0x392ff2=squel[_0xedfd('0x9f')]()[_0xedfd('0xae')](_0xedfd('0xad'))[_0xedfd('0xa0')]([_0xedfd('0xa1'),'scheduledAt',_0xedfd('0xa5'),_0xedfd('0xa3'),'VoiceQueueId',_0xedfd('0x5a'),_0xedfd('0x5b')],squel['select']()[_0xedfd('0x82')](_0xedfd('0xa1'),'phone')[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0xa2'))[_0xedfd('0x82')]('id',_0xedfd('0xa5'))[_0xedfd('0x82')](_0x38d620[_0xedfd('0xaa')][_0xedfd('0x89')](),_0xedfd('0xa3'))['field'](_0x5cc755['params']['id'][_0xedfd('0x89')](),_0xedfd('0x63'))[_0xedfd('0x82')]('NOW()','createdAt')['field'](_0xedfd('0xa4'),_0xedfd('0x5b'))['from']('cm_contacts')[_0xedfd('0x46')]('deletedAt\x20IS\x20NULL')[_0xedfd('0x46')](_0xedfd('0xa9'),_0x38d620['CmListId'][_0xedfd('0x89')]())[_0xedfd('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0xedfd('0x89')]();}_0x2ab9ab['push'](db[_0xedfd('0x74')][_0xedfd('0x3a')](_0x392ff2));}return BPromise['all'](_0x2ab9ab);}})[_0xedfd('0x2a')](function(){return _0xe3813b;})['then'](respondWithResult(_0x1161f1,null))[_0xedfd('0x4e')](handleError(_0x1161f1,null));};exports[_0xedfd('0xb1')]=function(_0x155495,_0x37e596,_0x1566aa){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x155495[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x37e596,null))[_0xedfd('0x2a')](function(_0x12992){if(_0x12992){return _0x12992['removeLists'](_0x155495[_0xedfd('0x3a')][_0xedfd('0x93')]);}})[_0xedfd('0x2a')](function(_0x9bf15d){if(_0x9bf15d){return db[_0xedfd('0x62')][_0xedfd('0x31')]({'where':{'ListId':_0x155495[_0xedfd('0x3a')]['ids'],'VoiceQueueId':_0x155495[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](function(){return _0x9bf15d;});}})[_0xedfd('0x2a')](respondWithStatusCode(_0x37e596,null))[_0xedfd('0x4e')](handleError(_0x37e596,null));};exports[_0xedfd('0xb2')]=function(_0x3f7ce8,_0x2b830e,_0x54c02f){var _0x1d2a75={};var _0xc9ae35={};var _0x1536fc;var _0xf87fd6;return db[_0xedfd('0x36')][_0xedfd('0x66')]({'where':{'id':_0x3f7ce8['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x2b830e,null))['then'](function(_0x48dd7c){if(_0x48dd7c){_0x1536fc=_0x48dd7c;_0xc9ae35[_0xedfd('0x3e')]=_[_0xedfd('0x3b')](db['CmList'][_0xedfd('0x37')]);_0xc9ae35[_0xedfd('0x3a')]=_[_0xedfd('0x3b')](_0x3f7ce8[_0xedfd('0x3a')]);_0xc9ae35[_0xedfd('0x3c')]=_[_0xedfd('0x3d')](_0xc9ae35[_0xedfd('0x3e')],_0xc9ae35[_0xedfd('0x3a')]);_0x1d2a75['attributes']=_['intersection'](_0xc9ae35[_0xedfd('0x3e')],qs[_0xedfd('0x40')](_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x40')]));_0x1d2a75[_0xedfd('0x3f')]=_0x1d2a75[_0xedfd('0x3f')][_0xedfd('0x41')]?_0x1d2a75[_0xedfd('0x3f')]:_0xc9ae35['model'];_0x1d2a75[_0xedfd('0x44')]=qs[_0xedfd('0x45')](_0x3f7ce8['query']['sort']);_0x1d2a75['where']=qs[_0xedfd('0x3c')](_['pick'](_0x3f7ce8[_0xedfd('0x3a')],_0xc9ae35[_0xedfd('0x3c')]));if(_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x2c')]){_0x1d2a75[_0xedfd('0x46')]=_[_0xedfd('0x48')](_0x1d2a75[_0xedfd('0x46')],{'$or':_[_0xedfd('0x2d')](_0x1d2a75[_0xedfd('0x3f')],function(_0x7d18be){var _0x307d99={};_0x307d99[_0x7d18be]={'$like':'%'+_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x2c')]+'%'};return _0x307d99;})});}_0x1d2a75=_[_0xedfd('0x48')]({},_0x1d2a75,_0x3f7ce8['options']);return _0x1536fc[_0xedfd('0xb2')](_0x1d2a75);}})[_0xedfd('0x2a')](function(_0x264f99){if(_0x264f99){_0xf87fd6=_0x264f99['length'];if(!_0x3f7ce8['query']['hasOwnProperty'](_0xedfd('0x43'))){_0x1d2a75[_0xedfd('0x24')]=qs['limit'](_0x3f7ce8[_0xedfd('0x3a')]['limit']);_0x1d2a75[_0xedfd('0x23')]=qs[_0xedfd('0x23')](_0x3f7ce8[_0xedfd('0x3a')][_0xedfd('0x23')]);}return _0x1536fc[_0xedfd('0xb2')](_0x1d2a75);}})[_0xedfd('0x2a')](function(_0x292151){if(_0x292151){return _0x292151?{'count':_0xf87fd6,'rows':_0x292151}:null;}})[_0xedfd('0x2a')](respondWithResult(_0x2b830e,null))[_0xedfd('0x4e')](handleError(_0x2b830e,null));};exports[_0xedfd('0xb3')]=function(_0x2b1eae,_0x235848,_0x348ad9){var _0x337459,_0x327862;return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x2b1eae['params']['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x235848,null))['then'](function(_0x1ac990){if(_0x1ac990){_0x327862=_0x1ac990;return _0x1ac990['addBlackLists'](_0x2b1eae[_0xedfd('0x52')][_0xedfd('0x93')],_[_0xedfd('0x5c')](_0x2b1eae[_0xedfd('0x52')],[_0xedfd('0x93'),'id'])||{});}return null;})['spread'](function(_0x4f4d4c){var _0x390e73;_0x337459=_0x4f4d4c||[];var _0x126ab9=[];if(_0x4f4d4c){for(var _0x2c6a58=0x0;_0x2c6a58<_0x4f4d4c['length'];_0x2c6a58+=0x1){var _0x23a47c=_0x4f4d4c[_0x2c6a58][_0xedfd('0x54')]({'plain':!![]});_0x390e73=squel[_0xedfd('0x9f')]()[_0xedfd('0xae')](_0xedfd('0xb4'))[_0xedfd('0xa0')]([_0xedfd('0xa1'),_0xedfd('0xa5'),_0xedfd('0xa3'),_0xedfd('0x63'),'createdAt',_0xedfd('0x5b')],squel['select']()['field']('phone',_0xedfd('0xa1'))[_0xedfd('0x82')]('id',_0xedfd('0xa5'))[_0xedfd('0x82')](_0x23a47c[_0xedfd('0xaa')][_0xedfd('0x89')](),_0xedfd('0xa3'))[_0xedfd('0x82')](_0x2b1eae[_0xedfd('0x4f')]['id'][_0xedfd('0x89')](),'VoiceQueueId')[_0xedfd('0x82')](_0xedfd('0xa4'),'createdAt')[_0xedfd('0x82')](_0xedfd('0xa4'),_0xedfd('0x5b'))[_0xedfd('0xa6')](_0xedfd('0xa7'))[_0xedfd('0x46')](_0xedfd('0xa8'))[_0xedfd('0x46')](_0xedfd('0xa9'),_0x23a47c[_0xedfd('0xaa')][_0xedfd('0x89')]())[_0xedfd('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x126ab9[_0xedfd('0x88')](db[_0xedfd('0x74')][_0xedfd('0x3a')](_0x390e73));}return BPromise[_0xedfd('0x8c')](_0x126ab9);}})['then'](function(){return _0x337459;})['then'](respondWithResult(_0x235848,null))[_0xedfd('0x4e')](handleError(_0x235848,null));};exports[_0xedfd('0xb5')]=function(_0x3988cd,_0x37c819,_0x43335e){return db[_0xedfd('0x36')][_0xedfd('0x50')]({'where':{'id':_0x3988cd[_0xedfd('0x4f')]['id']}})[_0xedfd('0x2a')](handleEntityNotFound(_0x37c819,null))[_0xedfd('0x2a')](function(_0x17c774){if(_0x17c774){return _0x17c774['removeBlackLists'](_0x3988cd[_0xedfd('0x3a')][_0xedfd('0x93')]);}})['then'](function(_0x1a3b1a){if(_0x1a3b1a){return db[_0xedfd('0x6a')][_0xedfd('0x31')]({'where':{'ListId':_0x3988cd[_0xedfd('0x3a')][_0xedfd('0x93')],'VoiceQueueId':_0x3988cd['params']['id']}})['then'](function(){return _0x1a3b1a;});}})[_0xedfd('0x2a')](respondWithStatusCode(_0x37c819,null))[_0xedfd('0x4e')](handleError(_0x37c819,null));}; \ No newline at end of file +var _0x3263=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','inbound','userProfileId','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','userVoiceQueue:save','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','every','TeamId','all','union','compact','ids','emit','userVoiceQueue:remove','spread','isEmpty','format','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','select','field','CmListId','toString','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','removeLists','getBlackLists','addBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','name','UserProfileResource','sendStatus','stack','index','VoiceQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','create','body','user','get'];(function(_0x4f6400,_0x379b1b){var _0x4e447=function(_0x5766a2){while(--_0x5766a2){_0x4f6400['push'](_0x4f6400['shift']());}};_0x4e447(++_0x379b1b);}(_0x3263,0x122));var _0x3326=function(_0x8f7825,_0xaa0ca0){_0x8f7825=_0x8f7825-0x0;var _0x29a7c9=_0x3263[_0x8f7825];return _0x29a7c9;};'use strict';var emlformat=require(_0x3326('0x0'));var rimraf=require(_0x3326('0x1'));var zipdir=require(_0x3326('0x2'));var jsonpatch=require(_0x3326('0x3'));var rp=require(_0x3326('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3326('0x5'));var util=require(_0x3326('0x6'));var path=require(_0x3326('0x7'));var sox=require(_0x3326('0x8'));var csv=require(_0x3326('0x9'));var ejs=require(_0x3326('0xa'));var fs=require('fs');var fs_extra=require(_0x3326('0xb'));var _=require(_0x3326('0xc'));var squel=require(_0x3326('0xd'));var crypto=require(_0x3326('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3326('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3326('0x10'));var Papa=require(_0x3326('0x11'));var Redis=require(_0x3326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3326('0x13'));var as=require(_0x3326('0x14'));var hardwareService=require(_0x3326('0x15'));var logger=require(_0x3326('0x16'))(_0x3326('0x17'));var utils=require(_0x3326('0x18'));var config=require(_0x3326('0x19'));var licenseUtil=require(_0x3326('0x1a'));var db=require(_0x3326('0x1b'))['db'];config[_0x3326('0x1c')]=_[_0x3326('0x1d')](config[_0x3326('0x1c')],{'host':_0x3326('0x1e'),'port':0x18eb});var socket=require(_0x3326('0x1f'))(new Redis(config[_0x3326('0x1c')]));require(_0x3326('0x20'))[_0x3326('0x21')](socket);function respondWithStatusCode(_0x124696,_0x51534b){_0x51534b=_0x51534b||0xcc;return function(_0x158d82){if(_0x158d82){return _0x124696['sendStatus'](_0x51534b);}return _0x124696[_0x3326('0x22')](_0x51534b)[_0x3326('0x23')]();};}function respondWithResult(_0x28b267,_0x1927e0){_0x1927e0=_0x1927e0||0xc8;return function(_0x5595d8){if(_0x5595d8){return _0x28b267[_0x3326('0x22')](_0x1927e0)[_0x3326('0x24')](_0x5595d8);}};}function respondWithFilteredResult(_0x5480f7,_0xee55b){return function(_0x1dda08){if(_0x1dda08){var _0x48de46=typeof _0xee55b[_0x3326('0x25')]===_0x3326('0x26')&&typeof _0xee55b['limit']===_0x3326('0x26');var _0x19a8fa=_0x1dda08[_0x3326('0x27')];var _0x55728d=_0x48de46?0x0:_0xee55b['offset'];var _0x3247b3=_0x48de46?_0x1dda08[_0x3326('0x27')]:_0xee55b['offset']+_0xee55b['limit'];var _0x456d33;if(_0x3247b3>=_0x19a8fa){_0x3247b3=_0x19a8fa;_0x456d33=0xc8;}else{_0x456d33=0xce;}_0x5480f7['status'](_0x456d33);return _0x5480f7[_0x3326('0x28')](_0x3326('0x29'),_0x55728d+'-'+_0x3247b3+'/'+_0x19a8fa)['json'](_0x1dda08);}return null;};}function patchUpdates(_0x45d167){return function(_0x35784e){try{jsonpatch[_0x3326('0x2a')](_0x35784e,_0x45d167,!![]);}catch(_0x14fd53){return BPromise[_0x3326('0x2b')](_0x14fd53);}return _0x35784e[_0x3326('0x2c')]();};}function saveUpdates(_0x3a93f8,_0x259c5c){return function(_0x108b50){if(_0x108b50){return _0x108b50[_0x3326('0x2d')](_0x3a93f8)[_0x3326('0x2e')](function(_0x58e748){return _0x58e748;});}return null;};}function removeEntity(_0x32ff37,_0x2b3f0e){return function(_0x5ca104){if(_0x5ca104){return _0x5ca104[_0x3326('0x2f')]()['then'](function(){var _0x59bc2f=_0x5ca104['get']({'plain':!![]});var _0x5b0e68=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x3326('0x30'),'value':_0x3326('0x31'),'ignore':![]}];var _0x474a54=_(_0x5b0e68)[_0x3326('0x32')](_0x3326('0x33'))[_0x3326('0x34')](_0x3326('0x35'))[_0x3326('0x35')]();if(_[_0x3326('0x36')](_0x474a54,_0x59bc2f['type'])){return;}var _0x2ca862=_[_0x3326('0x37')](_0x5b0e68,[_0x3326('0x35'),_0x59bc2f['type']])[_0x3326('0x38')];return db[_0x3326('0x39')][_0x3326('0x2f')]({'where':{'type':_0x2ca862,'resourceId':_0x59bc2f['id']}})[_0x3326('0x2e')](function(){return _0x5ca104;});})['then'](function(){_0x32ff37['status'](0xcc)[_0x3326('0x23')]();});}};}function handleEntityNotFound(_0x59efe5,_0xdf9e8b){return function(_0xd25b49){if(!_0xd25b49){_0x59efe5[_0x3326('0x3a')](0x194);}return _0xd25b49;};}function handleError(_0x46c16e,_0x115aa7){_0x115aa7=_0x115aa7||0x1f4;return function(_0xf6f4ca){logger['error'](_0xf6f4ca[_0x3326('0x3b')]);if(_0xf6f4ca[_0x3326('0x38')]){delete _0xf6f4ca['name'];}_0x46c16e[_0x3326('0x22')](_0x115aa7)['send'](_0xf6f4ca);};}exports[_0x3326('0x3c')]=function(_0xfda964,_0x3b71be){var _0x2b743c={},_0x2ae06a={},_0x516987={'count':0x0,'rows':[]};var _0x42784f=_['map'](db[_0x3326('0x3d')][_0x3326('0x3e')],function(_0x5cbd58){return{'name':_0x5cbd58[_0x3326('0x3f')],'type':_0x5cbd58[_0x3326('0x40')][_0x3326('0x41')]};});_0x2ae06a[_0x3326('0x42')]=_[_0x3326('0x34')](_0x42784f,'name');_0x2ae06a[_0x3326('0x43')]=_['keys'](_0xfda964[_0x3326('0x43')]);_0x2ae06a[_0x3326('0x44')]=_[_0x3326('0x45')](_0x2ae06a[_0x3326('0x42')],_0x2ae06a[_0x3326('0x43')]);_0x2b743c[_0x3326('0x46')]=_['intersection'](_0x2ae06a[_0x3326('0x42')],qs[_0x3326('0x47')](_0xfda964[_0x3326('0x43')][_0x3326('0x47')]));_0x2b743c[_0x3326('0x46')]=_0x2b743c[_0x3326('0x46')][_0x3326('0x48')]?_0x2b743c[_0x3326('0x46')]:_0x2ae06a[_0x3326('0x42')];if(!_0xfda964['query'][_0x3326('0x49')](_0x3326('0x4a'))){_0x2b743c['limit']=qs[_0x3326('0x4b')](_0xfda964[_0x3326('0x43')][_0x3326('0x4b')]);_0x2b743c[_0x3326('0x25')]=qs[_0x3326('0x25')](_0xfda964[_0x3326('0x43')][_0x3326('0x25')]);}_0x2b743c[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0xfda964['query'][_0x3326('0x4d')]);_0x2b743c[_0x3326('0x4e')]=qs[_0x3326('0x44')](_[_0x3326('0x4f')](_0xfda964[_0x3326('0x43')],_0x2ae06a[_0x3326('0x44')]),_0x42784f);if(_0xfda964[_0x3326('0x43')][_0x3326('0x32')]){_0x2b743c[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x2b743c[_0x3326('0x4e')],{'$or':_[_0x3326('0x34')](_0x42784f,function(_0x4f1ce4){if(_0x4f1ce4[_0x3326('0x40')]!==_0x3326('0x51')){var _0x39dfd5={};_0x39dfd5[_0x4f1ce4[_0x3326('0x38')]]={'$like':'%'+_0xfda964[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x39dfd5;}})});}_0x2b743c=_['merge']({},_0x2b743c,_0xfda964['options']);var _0x4d823d={'where':_0x2b743c[_0x3326('0x4e')]};return db[_0x3326('0x3d')]['count'](_0x4d823d)['then'](function(_0x2e7984){_0x516987[_0x3326('0x27')]=_0x2e7984;if(_0xfda964[_0x3326('0x43')][_0x3326('0x52')]){_0x2b743c[_0x3326('0x53')]=[{'all':!![]}];}return db[_0x3326('0x3d')]['findAll'](_0x2b743c);})[_0x3326('0x2e')](function(_0x491340){_0x516987[_0x3326('0x54')]=_0x491340;return _0x516987;})[_0x3326('0x2e')](respondWithFilteredResult(_0x3b71be,_0x2b743c))[_0x3326('0x55')](handleError(_0x3b71be,null));};exports[_0x3326('0x56')]=function(_0x5bff1d,_0x2d0aa4){var _0x47f3b2={'raw':![],'where':{'id':_0x5bff1d[_0x3326('0x57')]['id']}},_0xd05ab5={};_0xd05ab5['model']=_[_0x3326('0x58')](db[_0x3326('0x3d')]['rawAttributes']);_0xd05ab5[_0x3326('0x43')]=_['keys'](_0x5bff1d[_0x3326('0x43')]);_0xd05ab5[_0x3326('0x44')]=_[_0x3326('0x45')](_0xd05ab5['model'],_0xd05ab5[_0x3326('0x43')]);_0x47f3b2[_0x3326('0x46')]=_[_0x3326('0x45')](_0xd05ab5[_0x3326('0x42')],qs[_0x3326('0x47')](_0x5bff1d[_0x3326('0x43')][_0x3326('0x47')]));_0x47f3b2[_0x3326('0x46')]=_0x47f3b2[_0x3326('0x46')][_0x3326('0x48')]?_0x47f3b2[_0x3326('0x46')]:_0xd05ab5[_0x3326('0x42')];if(_0x5bff1d[_0x3326('0x43')][_0x3326('0x52')]){_0x47f3b2[_0x3326('0x53')]=[{'all':!![]}];}_0x47f3b2=_[_0x3326('0x50')]({},_0x47f3b2,_0x5bff1d[_0x3326('0x59')]);return db['VoiceQueue'][_0x3326('0x37')](_0x47f3b2)[_0x3326('0x2e')](handleEntityNotFound(_0x2d0aa4,null))['then'](respondWithResult(_0x2d0aa4,null))[_0x3326('0x55')](handleError(_0x2d0aa4,null));};exports['create']=function(_0x3a9934,_0xc96387){return db['VoiceQueue'][_0x3326('0x5a')](_0x3a9934[_0x3326('0x5b')],{})[_0x3326('0x2e')](function(_0xfef03b){var _0x5c505f=_0x3a9934[_0x3326('0x5c')][_0x3326('0x5d')]({'plain':!![]});if(!_0x5c505f)throw new Error(_0x3326('0x5e'));if(_0x5c505f[_0x3326('0x5f')]===_0x3326('0x5c')){var _0x5e8914=_0xfef03b[_0x3326('0x5d')]({'plain':!![]});var _0x4fd5dd=[{'name':_0x3326('0x60'),'value':'inbound'},{'name':_0x3326('0x30'),'value':_0x3326('0x31')}];var _0x24aaa2=_[_0x3326('0x37')](_0x4fd5dd,[_0x3326('0x35'),_0x5e8914['type']])[_0x3326('0x38')];return db[_0x3326('0x61')]['find']({'where':{'name':_0x24aaa2,'userProfileId':_0x5c505f['userProfileId']},'raw':!![]})[_0x3326('0x2e')](function(_0x1f96c7){if(_0x1f96c7&&_0x1f96c7[_0x3326('0x62')]===0x0){return db['UserProfileResource'][_0x3326('0x5a')]({'name':_0x5e8914[_0x3326('0x38')],'resourceId':_0x5e8914['id'],'type':_0x1f96c7[_0x3326('0x38')],'sectionId':_0x1f96c7['id']},{})[_0x3326('0x2e')](function(){return _0xfef03b;});}else{return _0xfef03b;}})[_0x3326('0x55')](function(_0x3281b6){logger[_0x3326('0x63')](_0x3326('0x64'),_0x3281b6);throw _0x3281b6;});}return _0xfef03b;})['then'](respondWithResult(_0xc96387,0xc9))[_0x3326('0x55')](handleError(_0xc96387,null));};exports['clone']=function(_0x266ccc,_0x2b9136){var _0x49ebe8={'where':{'id':_0x266ccc[_0x3326('0x57')]['id']}},_0x183864={};_0x183864[_0x3326('0x42')]=_[_0x3326('0x58')](db[_0x3326('0x3d')][_0x3326('0x3e')]);_0x49ebe8[_0x3326('0x46')]=_[_0x3326('0x45')](_0x183864[_0x3326('0x42')],qs[_0x3326('0x47')](_0x266ccc[_0x3326('0x43')][_0x3326('0x47')]));_0x49ebe8[_0x3326('0x46')]=_0x49ebe8[_0x3326('0x46')]['length']?_0x49ebe8[_0x3326('0x46')]:_0x183864[_0x3326('0x42')];if(_0x266ccc[_0x3326('0x43')][_0x3326('0x52')]){_0x49ebe8[_0x3326('0x53')]=[{'all':!![]}];}_0x49ebe8=_[_0x3326('0x50')]({},_0x49ebe8,_0x266ccc[_0x3326('0x59')]);return db[_0x3326('0x3d')][_0x3326('0x37')](_0x49ebe8)['then'](handleEntityNotFound(_0x2b9136,null))[_0x3326('0x2e')](function(_0x11ca5c){if(_0x11ca5c){var _0x3a3b68=_0x11ca5c[_0x3326('0x5d')]({'plain':!![]});_0x3a3b68=qs[_0x3326('0x65')](_0x3a3b68,['id',_0x3326('0x66'),'updatedAt']);_0x266ccc[_0x3326('0x5b')]=_[_0x3326('0x65')](_0x266ccc[_0x3326('0x5b')],['id',_0x3326('0x66'),_0x3326('0x67')]);return db['VoiceQueue']['create'](_[_0x3326('0x50')](_0x3a3b68,_0x266ccc[_0x3326('0x5b')]),{'include':_0x266ccc[_0x3326('0x43')][_0x3326('0x52')]?[{'all':!![]}]:undefined})[_0x3326('0x2e')](function(_0x175d9a){var _0x4b7237=_0x266ccc[_0x3326('0x5c')][_0x3326('0x5d')]({'plain':!![]});if(!_0x4b7237)throw new Error(_0x3326('0x5e'));if(_0x4b7237[_0x3326('0x5f')]==='user'){var _0x38d849=_0x175d9a[_0x3326('0x5d')]({'plain':!![]});var _0x1f5a14=[{'name':_0x3326('0x60'),'value':_0x3326('0x68')},{'name':_0x3326('0x30'),'value':_0x3326('0x31')}];var _0x5ef01e=_['find'](_0x1f5a14,[_0x3326('0x35'),_0x38d849['type']])[_0x3326('0x38')];return db['UserProfileSection'][_0x3326('0x37')]({'where':{'name':_0x5ef01e,'userProfileId':_0x4b7237[_0x3326('0x69')]},'raw':!![]})['then'](function(_0x5069ca){if(_0x5069ca&&_0x5069ca[_0x3326('0x62')]===0x0){return db[_0x3326('0x39')]['create']({'name':_0x38d849[_0x3326('0x38')],'resourceId':_0x38d849['id'],'type':_0x5069ca[_0x3326('0x38')],'sectionId':_0x5069ca['id']},{})[_0x3326('0x2e')](function(){return _0x175d9a;});}else{return _0x175d9a;}})[_0x3326('0x55')](function(_0x2900d8){logger[_0x3326('0x63')](_0x3326('0x64'),_0x2900d8);throw _0x2900d8;});}return _0x175d9a;});}})[_0x3326('0x2e')](respondWithResult(_0x2b9136,0xc9))[_0x3326('0x55')](handleError(_0x2b9136,null));};exports[_0x3326('0x2d')]=function(_0x11d7ec,_0x4caeaf){if(_0x11d7ec['body']['id']){delete _0x11d7ec[_0x3326('0x5b')]['id'];}return db['VoiceQueue'][_0x3326('0x37')]({'where':{'id':_0x11d7ec[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x4caeaf,null))[_0x3326('0x2e')](saveUpdates(_0x11d7ec['body'],null))['then'](respondWithResult(_0x4caeaf,null))['catch'](handleError(_0x4caeaf,null));};exports[_0x3326('0x2f')]=function(_0x5e47bf,_0x30b6d7){return db[_0x3326('0x3d')][_0x3326('0x37')]({'where':{'id':_0x5e47bf[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x30b6d7,null))[_0x3326('0x2e')](removeEntity(_0x30b6d7,null))[_0x3326('0x55')](handleError(_0x30b6d7,null));};exports[_0x3326('0x6a')]=function(_0x114deb,_0x3d8ad9,_0xc319bc){var _0x5dc291={'raw':![],'where':{}};var _0x4d0de8={};var _0x4c1690={'count':0x0,'rows':[]};return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x114deb[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x3d8ad9,null))[_0x3326('0x2e')](function(_0x1355c8){if(_0x1355c8){_0x4d0de8[_0x3326('0x42')]=_[_0x3326('0x58')](db['CmHopper']['rawAttributes']);_0x4d0de8['query']=_[_0x3326('0x58')](_0x114deb['query']);_0x4d0de8[_0x3326('0x44')]=_[_0x3326('0x45')](_0x4d0de8[_0x3326('0x42')],_0x4d0de8['query']);_0x5dc291[_0x3326('0x46')]=_['intersection'](_0x4d0de8[_0x3326('0x42')],qs['fields'](_0x114deb[_0x3326('0x43')][_0x3326('0x47')]));_0x5dc291[_0x3326('0x46')]=_0x5dc291[_0x3326('0x46')][_0x3326('0x48')]?_0x5dc291[_0x3326('0x46')]:_0x4d0de8[_0x3326('0x42')];if(!_0x114deb['query'][_0x3326('0x49')](_0x3326('0x4a'))){_0x5dc291['limit']=qs[_0x3326('0x4b')](_0x114deb['query']['limit']);_0x5dc291[_0x3326('0x25')]=qs[_0x3326('0x25')](_0x114deb[_0x3326('0x43')][_0x3326('0x25')]);}_0x5dc291[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0x114deb['query']['sort']);_0x5dc291[_0x3326('0x4e')]=qs['filters'](_[_0x3326('0x4f')](_0x114deb[_0x3326('0x43')],_0x4d0de8['filters']));_0x5dc291['where'][_0x3326('0x6c')]=_0x1355c8['id'];if(_0x114deb[_0x3326('0x43')][_0x3326('0x32')]){_0x5dc291[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x5dc291['where'],{'$or':_[_0x3326('0x34')](_0x5dc291[_0x3326('0x46')],function(_0x56f787){var _0x2c6d3c={};_0x2c6d3c[_0x56f787]={'$like':'%'+_0x114deb[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x2c6d3c;})});}_0x5dc291=_[_0x3326('0x50')]({},_0x5dc291,_0x114deb['options']);return db[_0x3326('0x6d')][_0x3326('0x27')]({'where':_0x5dc291[_0x3326('0x4e')]})[_0x3326('0x2e')](function(_0x27382b){_0x4c1690[_0x3326('0x27')]=_0x27382b;if(_0x114deb['query']['includeAll']){_0x5dc291[_0x3326('0x53')]=[{'all':!![]}];}return db[_0x3326('0x6d')][_0x3326('0x6e')](_0x5dc291);})['then'](function(_0x9de1d6){_0x4c1690[_0x3326('0x54')]=_0x9de1d6;return _0x4c1690;});}})['then'](respondWithFilteredResult(_0x3d8ad9,_0x5dc291))['catch'](handleError(_0x3d8ad9,null));};exports[_0x3326('0x6f')]=function(_0x56b143,_0x273c8f,_0x5234fe){var _0x28cd3d={'raw':!![],'where':{}};var _0x35ba7b={};var _0x229533={'count':0x0,'rows':[]};return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x56b143[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x273c8f,null))[_0x3326('0x2e')](function(_0x4fe96c){if(_0x4fe96c){_0x35ba7b[_0x3326('0x42')]=_['keys'](db['CmHopperHistory'][_0x3326('0x3e')]);_0x35ba7b[_0x3326('0x43')]=_[_0x3326('0x58')](_0x56b143['query']);_0x35ba7b[_0x3326('0x44')]=_[_0x3326('0x45')](_0x35ba7b[_0x3326('0x42')],_0x35ba7b[_0x3326('0x43')]);_0x28cd3d[_0x3326('0x46')]=_[_0x3326('0x45')](_0x35ba7b[_0x3326('0x42')],qs[_0x3326('0x47')](_0x56b143[_0x3326('0x43')][_0x3326('0x47')]));_0x28cd3d[_0x3326('0x46')]=_0x28cd3d[_0x3326('0x46')][_0x3326('0x48')]?_0x28cd3d[_0x3326('0x46')]:_0x35ba7b[_0x3326('0x42')];if(!_0x56b143['query'][_0x3326('0x49')](_0x3326('0x4a'))){_0x28cd3d[_0x3326('0x4b')]=qs['limit'](_0x56b143[_0x3326('0x43')][_0x3326('0x4b')]);_0x28cd3d[_0x3326('0x25')]=qs['offset'](_0x56b143['query'][_0x3326('0x25')]);}_0x28cd3d[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0x56b143[_0x3326('0x43')][_0x3326('0x4d')]);_0x28cd3d[_0x3326('0x4e')]=qs[_0x3326('0x44')](_[_0x3326('0x4f')](_0x56b143[_0x3326('0x43')],_0x35ba7b['filters']));_0x28cd3d[_0x3326('0x4e')][_0x3326('0x6c')]=_0x4fe96c['id'];if(_0x56b143[_0x3326('0x43')][_0x3326('0x32')]){_0x28cd3d['where']=_[_0x3326('0x50')](_0x28cd3d['where'],{'$or':_['map'](_0x28cd3d[_0x3326('0x46')],function(_0x5b17e5){var _0x4e0224={};_0x4e0224[_0x5b17e5]={'$like':'%'+_0x56b143[_0x3326('0x43')]['filter']+'%'};return _0x4e0224;})});}_0x28cd3d=_['merge']({},_0x28cd3d,_0x56b143['options']);return db[_0x3326('0x70')][_0x3326('0x27')]({'where':_0x28cd3d['where']})[_0x3326('0x2e')](function(_0x1cd121){_0x229533[_0x3326('0x27')]=_0x1cd121;if(_0x56b143['query']['includeAll']){_0x28cd3d[_0x3326('0x53')]=[{'all':!![]}];}return db[_0x3326('0x70')]['findAll'](_0x28cd3d);})[_0x3326('0x2e')](function(_0x1e7128){_0x229533[_0x3326('0x54')]=_0x1e7128;return _0x229533;});}})['then'](respondWithFilteredResult(_0x273c8f,_0x28cd3d))['catch'](handleError(_0x273c8f,null));};exports[_0x3326('0x71')]=function(_0x2d3bbb,_0x449370,_0x4e1c30){var _0x51a657={'raw':!![],'where':{}};var _0x46a4e1={};var _0x21a639={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3326('0x6b')]({'where':{'id':_0x2d3bbb[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x449370,null))[_0x3326('0x2e')](function(_0x127322){if(_0x127322){_0x46a4e1['model']=_[_0x3326('0x58')](db[_0x3326('0x72')][_0x3326('0x3e')]);_0x46a4e1[_0x3326('0x43')]=_[_0x3326('0x58')](_0x2d3bbb[_0x3326('0x43')]);_0x46a4e1['filters']=_[_0x3326('0x45')](_0x46a4e1['model'],_0x46a4e1[_0x3326('0x43')]);_0x51a657[_0x3326('0x46')]=_[_0x3326('0x45')](_0x46a4e1['model'],qs[_0x3326('0x47')](_0x2d3bbb['query'][_0x3326('0x47')]));_0x51a657[_0x3326('0x46')]=_0x51a657[_0x3326('0x46')][_0x3326('0x48')]?_0x51a657[_0x3326('0x46')]:_0x46a4e1['model'];if(!_0x2d3bbb[_0x3326('0x43')][_0x3326('0x49')](_0x3326('0x4a'))){_0x51a657[_0x3326('0x4b')]=qs['limit'](_0x2d3bbb['query'][_0x3326('0x4b')]);_0x51a657[_0x3326('0x25')]=qs[_0x3326('0x25')](_0x2d3bbb[_0x3326('0x43')]['offset']);}_0x51a657[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0x2d3bbb[_0x3326('0x43')][_0x3326('0x4d')]);_0x51a657[_0x3326('0x4e')]=qs['filters'](_[_0x3326('0x4f')](_0x2d3bbb[_0x3326('0x43')],_0x46a4e1[_0x3326('0x44')]));_0x51a657[_0x3326('0x4e')][_0x3326('0x6c')]=_0x127322['id'];if(_0x2d3bbb[_0x3326('0x43')][_0x3326('0x32')]){_0x51a657[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x51a657[_0x3326('0x4e')],{'$or':_[_0x3326('0x34')](_0x51a657['attributes'],function(_0x35275c){var _0x47dfcd={};_0x47dfcd[_0x35275c]={'$like':'%'+_0x2d3bbb[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x47dfcd;})});}_0x51a657=_['merge']({},_0x51a657,_0x2d3bbb[_0x3326('0x59')]);return db['CmHopperFinal']['count']({'where':_0x51a657[_0x3326('0x4e')]})[_0x3326('0x2e')](function(_0x35752e){_0x21a639[_0x3326('0x27')]=_0x35752e;if(_0x2d3bbb[_0x3326('0x43')]['includeAll']){_0x51a657['include']=[{'all':!![]}];}return db[_0x3326('0x72')][_0x3326('0x6e')](_0x51a657);})[_0x3326('0x2e')](function(_0x1f998e){_0x21a639['rows']=_0x1f998e;return _0x21a639;});}})[_0x3326('0x2e')](respondWithFilteredResult(_0x449370,_0x51a657))[_0x3326('0x55')](handleError(_0x449370,null));};exports[_0x3326('0x73')]=function(_0x5f5bde,_0x2319bc,_0x3544b6){var _0x6e1bbc={'raw':!![],'where':{}};var _0xb876ee={};var _0x529464={'count':0x0,'rows':[]};return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x5f5bde[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x2319bc,null))[_0x3326('0x2e')](function(_0x101cd4){if(_0x101cd4){_0xb876ee[_0x3326('0x42')]=_[_0x3326('0x58')](db[_0x3326('0x74')][_0x3326('0x3e')]);_0xb876ee[_0x3326('0x43')]=_['keys'](_0x5f5bde['query']);_0xb876ee[_0x3326('0x44')]=_[_0x3326('0x45')](_0xb876ee[_0x3326('0x42')],_0xb876ee['query']);_0x6e1bbc[_0x3326('0x46')]=_[_0x3326('0x45')](_0xb876ee['model'],qs['fields'](_0x5f5bde[_0x3326('0x43')][_0x3326('0x47')]));_0x6e1bbc[_0x3326('0x46')]=_0x6e1bbc[_0x3326('0x46')][_0x3326('0x48')]?_0x6e1bbc[_0x3326('0x46')]:_0xb876ee['model'];if(!_0x5f5bde[_0x3326('0x43')]['hasOwnProperty'](_0x3326('0x4a'))){_0x6e1bbc[_0x3326('0x4b')]=qs[_0x3326('0x4b')](_0x5f5bde[_0x3326('0x43')]['limit']);_0x6e1bbc[_0x3326('0x25')]=qs[_0x3326('0x25')](_0x5f5bde[_0x3326('0x43')][_0x3326('0x25')]);}_0x6e1bbc[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0x5f5bde[_0x3326('0x43')][_0x3326('0x4d')]);_0x6e1bbc[_0x3326('0x4e')]=qs[_0x3326('0x44')](_['pick'](_0x5f5bde['query'],_0xb876ee[_0x3326('0x44')]));_0x6e1bbc['where'][_0x3326('0x6c')]=_0x101cd4['id'];if(_0x5f5bde[_0x3326('0x43')][_0x3326('0x32')]){_0x6e1bbc['where']=_[_0x3326('0x50')](_0x6e1bbc['where'],{'$or':_[_0x3326('0x34')](_0x6e1bbc['attributes'],function(_0xdfeb3b){var _0xfa4516={};_0xfa4516[_0xdfeb3b]={'$like':'%'+_0x5f5bde[_0x3326('0x43')]['filter']+'%'};return _0xfa4516;})});}_0x6e1bbc=_[_0x3326('0x50')]({},_0x6e1bbc,_0x5f5bde[_0x3326('0x59')]);return db['CmHopperBlack'][_0x3326('0x27')]({'where':_0x6e1bbc[_0x3326('0x4e')]})[_0x3326('0x2e')](function(_0x5f48f9){_0x529464[_0x3326('0x27')]=_0x5f48f9;if(_0x5f5bde[_0x3326('0x43')][_0x3326('0x52')]){_0x6e1bbc[_0x3326('0x53')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3326('0x6e')](_0x6e1bbc);})['then'](function(_0x4b0163){_0x529464[_0x3326('0x54')]=_0x4b0163;return _0x529464;});}})[_0x3326('0x2e')](respondWithFilteredResult(_0x2319bc,_0x6e1bbc))[_0x3326('0x55')](handleError(_0x2319bc,null));};exports[_0x3326('0x75')]=function(_0x9a61bc,_0x327aca,_0x111a2a){var _0x5e9d0e={};var _0x4272c5={};var _0xd40032;var _0x306714;return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x9a61bc['params']['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x327aca,null))[_0x3326('0x2e')](function(_0x2e1c1f){if(_0x2e1c1f){_0xd40032=_0x2e1c1f;_0x4272c5[_0x3326('0x42')]=_[_0x3326('0x58')](db['Team'][_0x3326('0x3e')]);_0x4272c5[_0x3326('0x43')]=_[_0x3326('0x58')](_0x9a61bc[_0x3326('0x43')]);_0x4272c5['filters']=_[_0x3326('0x45')](_0x4272c5[_0x3326('0x42')],_0x4272c5[_0x3326('0x43')]);_0x5e9d0e['attributes']=_['intersection'](_0x4272c5[_0x3326('0x42')],qs[_0x3326('0x47')](_0x9a61bc[_0x3326('0x43')][_0x3326('0x47')]));_0x5e9d0e[_0x3326('0x46')]=_0x5e9d0e['attributes']['length']?_0x5e9d0e[_0x3326('0x46')]:_0x4272c5[_0x3326('0x42')];_0x5e9d0e[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0x9a61bc[_0x3326('0x43')][_0x3326('0x4d')]);_0x5e9d0e['where']=qs[_0x3326('0x44')](_['pick'](_0x9a61bc[_0x3326('0x43')],_0x4272c5[_0x3326('0x44')]));if(_0x9a61bc[_0x3326('0x43')][_0x3326('0x32')]){_0x5e9d0e[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x5e9d0e[_0x3326('0x4e')],{'$or':_[_0x3326('0x34')](_0x5e9d0e[_0x3326('0x46')],function(_0x3f200d){var _0x21c651={};_0x21c651[_0x3f200d]={'$like':'%'+_0x9a61bc[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x21c651;})});}_0x5e9d0e=_[_0x3326('0x50')]({},_0x5e9d0e,_0x9a61bc[_0x3326('0x59')]);return _0xd40032['getTeams'](_0x5e9d0e);}})['then'](function(_0x319775){if(_0x319775){_0x306714=_0x319775['length'];if(!_0x9a61bc[_0x3326('0x43')][_0x3326('0x49')](_0x3326('0x4a'))){_0x5e9d0e[_0x3326('0x4b')]=qs[_0x3326('0x4b')](_0x9a61bc['query'][_0x3326('0x4b')]);_0x5e9d0e['offset']=qs['offset'](_0x9a61bc[_0x3326('0x43')][_0x3326('0x25')]);}return _0xd40032[_0x3326('0x75')](_0x5e9d0e);}})[_0x3326('0x2e')](function(_0x238267){if(_0x238267){return _0x238267?{'count':_0x306714,'rows':_0x238267}:null;}})[_0x3326('0x2e')](respondWithResult(_0x327aca,null))['catch'](handleError(_0x327aca,null));};exports['addTeams']=function(_0x43f5b2,_0x5879de,_0x474f2e){var _0x465638=_0x43f5b2['body']['teams'];var _0x320918=_[_0x3326('0x34')](_0x465638,'id');return db[_0x3326('0x76')][_0x3326('0x6e')]({'where':{'id':_0x320918},'attributes':['id'],'include':[{'model':db[_0x3326('0x77')],'as':_0x3326('0x78'),'attributes':['id',_0x3326('0x38'),_0x3326('0x79'),_0x3326('0x7a'),'interface'],'raw':!![]}]})[_0x3326('0x2e')](function(_0x5a9c43){if(_0x5a9c43){var _0x35f777=_[_0x3326('0x7b')](_0x5a9c43,function(_0x9088c6){var _0x4b8fb5=_0x9088c6['get']({'plain':!![]});_0x4b8fb5[_0x3326('0x78')][_0x3326('0x7c')](function(_0x5e5acf){_0x5e5acf['penalty']=_['find'](_0x465638,{'id':_0x4b8fb5['id']})[_0x3326('0x7d')];});return _0x4b8fb5['Agents'];});return db['VoiceQueue'][_0x3326('0x37')]({'where':{'id':_0x43f5b2[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](function(_0x271298){return db[_0x3326('0x7e')][_0x3326('0x7f')](function(_0x4c7f01){return _0x271298[_0x3326('0x80')](_0x320918,{'transaction':_0x4c7f01})[_0x3326('0x2e')](function(){return BPromise[_0x3326('0x81')](_0x465638,function(_0x39e7f4){return db[_0x3326('0x82')]['upsert']({'TeamId':_0x39e7f4['id'],'VoiceQueueId':_0x43f5b2[_0x3326('0x57')]['id'],'penalty':_0x39e7f4['penalty']},{'transaction':_0x4c7f01});});})[_0x3326('0x2e')](function(){return BPromise['each'](_0x35f777,function(_0x4770f7){return db[_0x3326('0x83')][_0x3326('0x84')]({'where':{'UserId':_0x4770f7['id'],'VoiceQueueId':_0x43f5b2[_0x3326('0x57')]['id']},'defaults':{'penalty':_0x4770f7[_0x3326('0x7d')]},'transaction':_0x4c7f01});});})[_0x3326('0x2e')](function(){return BPromise[_0x3326('0x81')](_[_0x3326('0x32')](_0x35f777,{'online':!![]}),function(_0x15f127){return db[_0x3326('0x85')][_0x3326('0x86')]({'membername':_0x15f127[_0x3326('0x38')],'UserId':_0x15f127['id'],'queue_name':_0x271298[_0x3326('0x38')],'VoiceQueueId':_0x271298['id'],'interface':_[_0x3326('0x87')](_0x15f127[_0x3326('0x88')])?util['format'](_0x3326('0x89'),_0x15f127[_0x3326('0x38')]):_0x15f127[_0x3326('0x88')],'paused':_0x15f127[_0x3326('0x7a')]||![],'penalty':_0x15f127['penalty']},{'transaction':_0x4c7f01});});})[_0x3326('0x2e')](function(){_0x35f777[_0x3326('0x7c')](function(_0x58cce1){socket['emit'](_0x3326('0x8a'),{'UserId':_0x58cce1['id'],'VoiceQueueId':_0x271298['id']});});});});});}})['then'](respondWithStatusCode(_0x5879de,null))[_0x3326('0x55')](handleError(_0x5879de,null));};exports[_0x3326('0x8b')]=function(_0x19d18d,_0x3c6b11,_0x1f2cec){return db[_0x3326('0x76')][_0x3326('0x6e')]({'where':{'id':_0x19d18d[_0x3326('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3326('0x77')],'as':_0x3326('0x78'),'attributes':['id'],'raw':!![]}]})[_0x3326('0x2e')](handleEntityNotFound(_0x3c6b11,null))[_0x3326('0x2e')](function(_0x4f8810){var _0x5ee227=_[_0x3326('0x34')](_0x4f8810,'id');var _0x50b164=[];var _0x50f18f=[];var _0x1d7206=squel['select']();_0x1d7206['field'](_0x3326('0x8c'))[_0x3326('0x8d')]('team_has_voice_queues','tq')[_0x3326('0x8e')]('user_has_teams','ut',_0x3326('0x8f'))['where'](_0x3326('0x90'),_0x19d18d['params']['id']);for(var _0x2d1490=0x0;_0x2d1490<_0x4f8810[_0x3326('0x48')];_0x2d1490+=0x1){let _0x3c84a5=_0x4f8810[_0x2d1490];for(var _0x17aedf=0x0;_0x17aedf<_0x3c84a5[_0x3326('0x78')][_0x3326('0x48')];_0x17aedf+=0x1){let _0x38152d=_0x3c84a5[_0x3326('0x78')][_0x17aedf];var _0x1cebcf=_0x1d7206['clone']();_0x1cebcf['where'](_0x3326('0x91'),_0x38152d['id']);_0x50f18f[_0x3326('0x92')](db['sequelize'][_0x3326('0x43')](_0x1cebcf['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x3326('0x2e')](function(_0x235163){if(_0x235163[_0x3326('0x48')]===0x1){return _0x38152d['id'];}else{var _0x1e50d4=_[_0x3326('0x93')](_[_0x3326('0x34')](_0x235163,_0x3326('0x94')),function(_0x5b9bd7){return _[_0x3326('0x36')](_0x5ee227,_0x5b9bd7);});if(_0x1e50d4){return _0x38152d['id'];}}}));}}return BPromise[_0x3326('0x95')](_0x50f18f)[_0x3326('0x2e')](function(_0x274408){_0x50b164=_(_0x50b164)[_0x3326('0x96')](_0x274408)[_0x3326('0x97')]()[_0x3326('0x35')]();return db[_0x3326('0x3d')]['find']({'where':{'id':_0x19d18d[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](function(_0x5d3e95){return db[_0x3326('0x7e')][_0x3326('0x7f')](function(_0x3fb408){return _0x5d3e95[_0x3326('0x8b')](_0x19d18d[_0x3326('0x43')][_0x3326('0x98')],{'transaction':_0x3fb408})[_0x3326('0x2e')](function(){if(!_['isEmpty'](_0x50b164)){return _0x5d3e95['removeAgents'](_0x50b164,{'transaction':_0x3fb408})[_0x3326('0x2e')](function(){return db['UserVoiceQueueRt'][_0x3326('0x2f')]({'where':{'VoiceQueueId':_0x19d18d[_0x3326('0x57')]['id'],'UserId':_0x50b164},'transaction':_0x3fb408});});}})[_0x3326('0x2e')](function(){_0x50b164['forEach'](function(_0x3bc3aa){socket[_0x3326('0x99')](_0x3326('0x9a'),{'UserId':_0x3bc3aa,'VoiceQueueId':_0x5d3e95['id']});});});});});});})[_0x3326('0x2e')](respondWithStatusCode(_0x3c6b11,null))['catch'](handleError(_0x3c6b11,null));};exports['addAgents']=function(_0x3847dd,_0x412f64,_0x1907bb){var _0x1054ef,_0xb09414;return db[_0x3326('0x3d')][_0x3326('0x37')]({'where':{'id':_0x3847dd['params']['id']}})['then'](handleEntityNotFound(_0x412f64,null))[_0x3326('0x2e')](function(_0x4cbce7){if(_0x4cbce7){_0xb09414=_0x4cbce7;return _0x4cbce7['addAgents'](_0x3847dd['body'][_0x3326('0x98')],_[_0x3326('0x65')](_0x3847dd['body'],[_0x3326('0x98'),'id'])||{})[_0x3326('0x9b')](function(_0x98cb73){for(var _0x56cdba=0x0;_0x56cdba<_0x3847dd[_0x3326('0x5b')][_0x3326('0x98')][_0x3326('0x48')];_0x56cdba+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x3847dd[_0x3326('0x5b')][_0x3326('0x98')][_0x56cdba]),'VoiceQueueId':Number(_0x3847dd[_0x3326('0x57')]['id'])});}return _0x98cb73;});}})['then'](function(_0x54a70b){_0x1054ef=_0x54a70b||[];if(_0xb09414){return db['User'][_0x3326('0x6e')]({'where':{'id':_0x3847dd[_0x3326('0x5b')][_0x3326('0x98')]},'attributes':['id',_0x3326('0x38'),_0x3326('0x79'),_0x3326('0x7a'),'interface'],'raw':!![]});}})[_0x3326('0x2e')](function(_0xc898b8){if(!_[_0x3326('0x9c')](_0xc898b8)){var _0x1eacae=[];for(var _0x5ce2a6=0x0;_0x5ce2a6<_0xc898b8[_0x3326('0x48')];_0x5ce2a6++){if(_0xc898b8[_0x5ce2a6][_0x3326('0x79')]){_0x1eacae[_0x3326('0x92')](db[_0x3326('0x85')][_0x3326('0x86')]({'membername':_0xc898b8[_0x5ce2a6][_0x3326('0x38')],'UserId':_0xc898b8[_0x5ce2a6]['id'],'queue_name':_0xb09414[_0x3326('0x38')],'VoiceQueueId':_0xb09414['id'],'interface':_[_0x3326('0x87')](_0xc898b8[_0x5ce2a6]['interface'])?util[_0x3326('0x9d')](_0x3326('0x89'),_0xc898b8[_0x5ce2a6]['name']):_0xc898b8[_0x5ce2a6]['interface'],'paused':_0xc898b8[_0x5ce2a6][_0x3326('0x7a')]||![],'penalty':_0x3847dd['body'][_0x3326('0x7d')]||0x0}));}}return BPromise[_0x3326('0x95')](_0x1eacae);}})[_0x3326('0x2e')](function(){return _0x1054ef;})[_0x3326('0x2e')](respondWithResult(_0x412f64,null))[_0x3326('0x55')](handleError(_0x412f64,null));};exports[_0x3326('0x9e')]=function(_0x528a9f,_0x2b9014,_0x2033db){return db[_0x3326('0x3d')][_0x3326('0x37')]({'where':{'id':_0x528a9f[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x2b9014,null))[_0x3326('0x2e')](function(_0x49a8e3){if(_0x49a8e3){return _0x49a8e3[_0x3326('0x9e')](_0x528a9f['query']['ids'])['then'](function(){if(_[_0x3326('0x9f')](_0x528a9f['query'][_0x3326('0x98')])){for(var _0x49d569=0x0;_0x49d569<_0x528a9f['query']['ids'][_0x3326('0x48')];_0x49d569+=0x1){socket[_0x3326('0x99')](_0x3326('0x9a'),{'UserId':Number(_0x528a9f[_0x3326('0x43')]['ids'][_0x49d569]),'VoiceQueueId':Number(_0x528a9f[_0x3326('0x57')]['id'])});}}else{socket[_0x3326('0x99')](_0x3326('0x9a'),{'UserId':Number(_0x528a9f['query']['ids']),'VoiceQueueId':Number(_0x528a9f[_0x3326('0x57')]['id'])});}});}})[_0x3326('0x2e')](function(_0x251bee){return db[_0x3326('0x85')]['destroy']({'where':{'VoiceQueueId':_0x528a9f[_0x3326('0x57')]['id'],'UserId':_0x528a9f[_0x3326('0x43')][_0x3326('0x98')]}})[_0x3326('0x2e')](function(){return _0x251bee;});})['then'](respondWithStatusCode(_0x2b9014,null))['catch'](handleError(_0x2b9014,null));};exports['getAgents']=function(_0x4826e2,_0x1a2d87,_0x2514c8){var _0x1d9f7a={};var _0x206e41={};var _0x32826c;var _0x3aadff;return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x4826e2[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x1a2d87,null))['then'](function(_0x1f79b7){if(_0x1f79b7){_0x32826c=_0x1f79b7;_0x206e41[_0x3326('0x42')]=_[_0x3326('0x58')](db[_0x3326('0x77')][_0x3326('0x3e')]);_0x206e41[_0x3326('0x43')]=_['keys'](_0x4826e2[_0x3326('0x43')]);_0x206e41['filters']=_[_0x3326('0x45')](_0x206e41[_0x3326('0x42')],_0x206e41[_0x3326('0x43')]);_0x1d9f7a[_0x3326('0x46')]=_[_0x3326('0x45')](_0x206e41[_0x3326('0x42')],qs['fields'](_0x4826e2[_0x3326('0x43')]['fields']));_0x1d9f7a['attributes']=_0x1d9f7a[_0x3326('0x46')][_0x3326('0x48')]?_0x1d9f7a['attributes']:_0x206e41[_0x3326('0x42')];_0x1d9f7a['order']=qs['sort'](_0x4826e2['query'][_0x3326('0x4d')]);_0x1d9f7a[_0x3326('0x4e')]=qs['filters'](_[_0x3326('0x4f')](_0x4826e2[_0x3326('0x43')],_0x206e41[_0x3326('0x44')]));if(_0x4826e2[_0x3326('0x43')]['filter']){_0x1d9f7a[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x1d9f7a[_0x3326('0x4e')],{'$or':_[_0x3326('0x34')](_0x1d9f7a[_0x3326('0x46')],function(_0x3e1a52){var _0x5c9aa2={};_0x5c9aa2[_0x3e1a52]={'$like':'%'+_0x4826e2[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x5c9aa2;})});}_0x1d9f7a=_[_0x3326('0x50')]({},_0x1d9f7a,_0x4826e2[_0x3326('0x59')]);return _0x32826c['getAgents'](_0x1d9f7a);}})[_0x3326('0x2e')](function(_0x3ebec5){if(_0x3ebec5){_0x3aadff=_0x3ebec5[_0x3326('0x48')];if(!_0x4826e2['query'][_0x3326('0x49')](_0x3326('0x4a'))){_0x1d9f7a[_0x3326('0x4b')]=qs[_0x3326('0x4b')](_0x4826e2[_0x3326('0x43')][_0x3326('0x4b')]);_0x1d9f7a[_0x3326('0x25')]=qs[_0x3326('0x25')](_0x4826e2[_0x3326('0x43')]['offset']);}return _0x32826c[_0x3326('0xa0')](_0x1d9f7a);}})[_0x3326('0x2e')](function(_0x27f2f0){if(_0x27f2f0){return _0x27f2f0?{'count':_0x3aadff,'rows':_0x27f2f0}:null;}})['then'](respondWithResult(_0x1a2d87,null))[_0x3326('0x55')](handleError(_0x1a2d87,null));};exports[_0x3326('0xa1')]=function(_0x4e6a25,_0x18b57e,_0x5bceeb){var _0x4235c4={};var _0xd4df2d={};var _0x1e47f9;var _0x245a25;return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x4e6a25['params']['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x18b57e,null))[_0x3326('0x2e')](function(_0x1c449c){if(_0x1c449c){_0x1e47f9=_0x1c449c;_0xd4df2d[_0x3326('0x42')]=_[_0x3326('0x58')](db['UserVoiceQueueRt']['rawAttributes']);_0xd4df2d[_0x3326('0x43')]=_[_0x3326('0x58')](_0x4e6a25[_0x3326('0x43')]);_0xd4df2d[_0x3326('0x44')]=_['intersection'](_0xd4df2d[_0x3326('0x42')],_0xd4df2d['query']);_0x4235c4[_0x3326('0x46')]=_['intersection'](_0xd4df2d['model'],qs['fields'](_0x4e6a25[_0x3326('0x43')][_0x3326('0x47')]));_0x4235c4[_0x3326('0x46')]=_0x4235c4['attributes'][_0x3326('0x48')]?_0x4235c4['attributes']:_0xd4df2d['model'];_0x4235c4[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0x4e6a25['query'][_0x3326('0x4d')]);_0x4235c4['where']=qs[_0x3326('0x44')](_[_0x3326('0x4f')](_0x4e6a25[_0x3326('0x43')],_0xd4df2d[_0x3326('0x44')]));if(_0x4e6a25[_0x3326('0x43')][_0x3326('0x32')]){_0x4235c4['where']=_[_0x3326('0x50')](_0x4235c4[_0x3326('0x4e')],{'$or':_[_0x3326('0x34')](_0x4235c4[_0x3326('0x46')],function(_0x29f296){var _0x390349={};_0x390349[_0x29f296]={'$like':'%'+_0x4e6a25[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x390349;})});}_0x4235c4=_['merge']({},_0x4235c4,_0x4e6a25[_0x3326('0x59')]);return _0x1e47f9['getMembers'](_0x4235c4);}})[_0x3326('0x2e')](function(_0x1d7e53){if(_0x1d7e53){_0x245a25=_0x1d7e53[_0x3326('0x48')];if(!_0x4e6a25['query'][_0x3326('0x49')](_0x3326('0x4a'))){_0x4235c4[_0x3326('0x4b')]=qs[_0x3326('0x4b')](_0x4e6a25[_0x3326('0x43')][_0x3326('0x4b')]);_0x4235c4[_0x3326('0x25')]=qs['offset'](_0x4e6a25['query'][_0x3326('0x25')]);}return _0x1e47f9[_0x3326('0xa1')](_0x4235c4);}})[_0x3326('0x2e')](function(_0x52cc58){return _0x52cc58?{'count':_0x245a25,'rows':_0x52cc58}:null;})[_0x3326('0x2e')](respondWithResult(_0x18b57e,null))[_0x3326('0x55')](handleError(_0x18b57e,null));};exports[_0x3326('0xa2')]=function(_0x3b9b0b,_0x51420c,_0x3b0ef4){var _0x43b828={};var _0x2e6c3b={};var _0x23fcfa;var _0x374cf4;return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0x3b9b0b[_0x3326('0x57')]['id']}})['then'](handleEntityNotFound(_0x51420c,null))[_0x3326('0x2e')](function(_0xc3eb44){if(_0xc3eb44){_0x23fcfa=_0xc3eb44;_0x2e6c3b[_0x3326('0x42')]=_[_0x3326('0x58')](db[_0x3326('0xa3')]['rawAttributes']);_0x2e6c3b[_0x3326('0x43')]=_['keys'](_0x3b9b0b['query']);_0x2e6c3b[_0x3326('0x44')]=_[_0x3326('0x45')](_0x2e6c3b['model'],_0x2e6c3b[_0x3326('0x43')]);_0x43b828[_0x3326('0x46')]=_['intersection'](_0x2e6c3b[_0x3326('0x42')],qs[_0x3326('0x47')](_0x3b9b0b['query'][_0x3326('0x47')]));_0x43b828[_0x3326('0x46')]=_0x43b828[_0x3326('0x46')][_0x3326('0x48')]?_0x43b828[_0x3326('0x46')]:_0x2e6c3b['model'];_0x43b828[_0x3326('0x4c')]=qs['sort'](_0x3b9b0b[_0x3326('0x43')][_0x3326('0x4d')]);_0x43b828[_0x3326('0x4e')]=qs[_0x3326('0x44')](_[_0x3326('0x4f')](_0x3b9b0b[_0x3326('0x43')],_0x2e6c3b[_0x3326('0x44')]));if(_0x3b9b0b[_0x3326('0x43')][_0x3326('0x32')]){_0x43b828[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x43b828[_0x3326('0x4e')],{'$or':_['map'](_0x43b828['attributes'],function(_0x3a8f56){var _0x33c69d={};_0x33c69d[_0x3a8f56]={'$like':'%'+_0x3b9b0b[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x33c69d;})});}_0x43b828=_[_0x3326('0x50')]({},_0x43b828,_0x3b9b0b[_0x3326('0x59')]);return _0x23fcfa[_0x3326('0xa2')](_0x43b828);}})[_0x3326('0x2e')](function(_0x378cbf){if(_0x378cbf){_0x374cf4=_0x378cbf[_0x3326('0x48')];if(!_0x3b9b0b['query']['hasOwnProperty'](_0x3326('0x4a'))){_0x43b828['limit']=qs[_0x3326('0x4b')](_0x3b9b0b[_0x3326('0x43')][_0x3326('0x4b')]);_0x43b828[_0x3326('0x25')]=qs[_0x3326('0x25')](_0x3b9b0b['query'][_0x3326('0x25')]);}return _0x23fcfa['getLists'](_0x43b828);}})[_0x3326('0x2e')](function(_0x49a835){if(_0x49a835){return _0x49a835?{'count':_0x374cf4,'rows':_0x49a835}:null;}})[_0x3326('0x2e')](respondWithResult(_0x51420c,null))[_0x3326('0x55')](handleError(_0x51420c,null));};exports[_0x3326('0xa4')]=function(_0xce651a,_0xdd2d71,_0x52be27){var _0x338db7,_0x55ee7c;return db[_0x3326('0x3d')]['find']({'where':{'id':_0xce651a['params']['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0xdd2d71,null))['then'](function(_0x189eb0){if(_0x189eb0){_0x55ee7c=_0x189eb0;return _0x189eb0[_0x3326('0xa4')](_0xce651a[_0x3326('0x5b')][_0x3326('0x98')],_[_0x3326('0x65')](_0xce651a[_0x3326('0x5b')],['ids','id'])||{});}return null;})[_0x3326('0x9b')](function(_0x22b7a8){var _0x3031f0;_0x338db7=_0x22b7a8||[];var _0x16e7d4=[];if(_0x22b7a8){for(var _0x55109a=0x0;_0x55109a<_0x22b7a8[_0x3326('0x48')];_0x55109a+=0x1){var _0x732fc4=_0x22b7a8[_0x55109a][_0x3326('0x5d')]({'plain':!![]});_0x55ee7c[_0x3326('0xa5')]=_0xce651a[_0x3326('0x5b')][_0x3326('0xa5')]?_0xce651a[_0x3326('0x5b')][_0x3326('0xa5')]:_0x55ee7c[_0x3326('0xa5')];switch(_0x55ee7c['dialCheckDuplicateType']){case _0x3326('0xa6'):_0x3031f0=squel[_0x3326('0xa7')]()[_0x3326('0xa8')]('cm_hopper')['fromQuery']([_0x3326('0xa9'),_0x3326('0xaa'),_0x3326('0xab'),'ListId','VoiceQueueId',_0x3326('0x66'),_0x3326('0x67')],squel[_0x3326('0xac')]()[_0x3326('0xad')](_0x3326('0xa9'),'phone')[_0x3326('0xad')]('NOW()','scheduledAt')[_0x3326('0xad')]('id',_0x3326('0xab'))[_0x3326('0xad')](_0x732fc4[_0x3326('0xae')][_0x3326('0xaf')](),_0x3326('0xb0'))[_0x3326('0xad')](_0xce651a[_0x3326('0x57')]['id'][_0x3326('0xaf')](),_0x3326('0x6c'))[_0x3326('0xad')](_0x3326('0xb1'),_0x3326('0x66'))['field'](_0x3326('0xb1'),'updatedAt')[_0x3326('0x8d')](_0x3326('0xb2'))[_0x3326('0x4e')](_0x3326('0xb3'))[_0x3326('0x4e')](_0x3326('0xb4'),_0x732fc4[_0x3326('0xae')][_0x3326('0xaf')]())['where'](_0x3326('0xb5'))[_0x3326('0x4e')](_0x3326('0xb6'),squel[_0x3326('0xac')]()[_0x3326('0xad')](_0x3326('0xb7'))[_0x3326('0x8d')](_0x3326('0xb8'))[_0x3326('0x4e')]('VoiceQueueId\x20=\x20?',_0xce651a[_0x3326('0x57')]['id']['toString']()))[_0x3326('0x4e')](_0x3326('0xb6'),squel['select']()[_0x3326('0xad')](_0x3326('0xb9'))['from'](_0x3326('0xba'))[_0x3326('0x4e')](_0x3326('0x90'),_0xce651a['params']['id'][_0x3326('0xaf')]())))[_0x3326('0xaf')]();break;case _0x3326('0xbb'):_0x3031f0=squel[_0x3326('0xa7')]()['into'](_0x3326('0xba'))[_0x3326('0xbc')]([_0x3326('0xa9'),_0x3326('0xaa'),'ContactId','ListId',_0x3326('0x6c'),_0x3326('0x66'),_0x3326('0x67')],squel[_0x3326('0xac')]()[_0x3326('0xad')]('phone','phone')[_0x3326('0xad')](_0x3326('0xb1'),_0x3326('0xaa'))[_0x3326('0xad')]('id',_0x3326('0xab'))[_0x3326('0xad')](_0x732fc4[_0x3326('0xae')]['toString'](),'ListId')[_0x3326('0xad')](_0xce651a[_0x3326('0x57')]['id'][_0x3326('0xaf')](),_0x3326('0x6c'))['field'](_0x3326('0xb1'),'createdAt')['field'](_0x3326('0xb1'),'updatedAt')['from'](_0x3326('0xb2'))[_0x3326('0x4e')]('deletedAt\x20IS\x20NULL')[_0x3326('0x4e')](_0x3326('0xb4'),_0x732fc4[_0x3326('0xae')]['toString']())[_0x3326('0x4e')](_0x3326('0xb5'))[_0x3326('0x4e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3326('0xac')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x3326('0x4e')](_0x3326('0x90'),_0xce651a[_0x3326('0x57')]['id'][_0x3326('0xaf')]())))[_0x3326('0xaf')]();break;default:_0x3031f0=squel[_0x3326('0xa7')]()['into'](_0x3326('0xba'))['fromQuery']([_0x3326('0xa9'),_0x3326('0xaa'),_0x3326('0xab'),_0x3326('0xb0'),_0x3326('0x6c'),'createdAt',_0x3326('0x67')],squel['select']()['field'](_0x3326('0xa9'),_0x3326('0xa9'))[_0x3326('0xad')](_0x3326('0xb1'),_0x3326('0xaa'))['field']('id',_0x3326('0xab'))[_0x3326('0xad')](_0x732fc4[_0x3326('0xae')][_0x3326('0xaf')](),_0x3326('0xb0'))['field'](_0xce651a[_0x3326('0x57')]['id'][_0x3326('0xaf')](),_0x3326('0x6c'))['field']('NOW()',_0x3326('0x66'))[_0x3326('0xad')](_0x3326('0xb1'),_0x3326('0x67'))[_0x3326('0x8d')](_0x3326('0xb2'))[_0x3326('0x4e')](_0x3326('0xb3'))['where']('ListId\x20=\x20?',_0x732fc4[_0x3326('0xae')][_0x3326('0xaf')]())[_0x3326('0x4e')]('phone\x20IS\x20NOT\x20NULL'))[_0x3326('0xaf')]();}_0x16e7d4['push'](db[_0x3326('0x7e')][_0x3326('0x43')](_0x3031f0));}return BPromise[_0x3326('0x95')](_0x16e7d4);}})['then'](function(){return _0x338db7;})[_0x3326('0x2e')](respondWithResult(_0xdd2d71,null))['catch'](handleError(_0xdd2d71,null));};exports[_0x3326('0xbd')]=function(_0x5e1ba3,_0x1708d0,_0x33dc25){return db['VoiceQueue'][_0x3326('0x37')]({'where':{'id':_0x5e1ba3[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x1708d0,null))[_0x3326('0x2e')](function(_0x30299e){if(_0x30299e){return _0x30299e['removeLists'](_0x5e1ba3[_0x3326('0x43')]['ids']);}})['then'](function(_0x2e40cb){if(_0x2e40cb){return db[_0x3326('0x6d')][_0x3326('0x2f')]({'where':{'ListId':_0x5e1ba3[_0x3326('0x43')]['ids'],'VoiceQueueId':_0x5e1ba3['params']['id']}})[_0x3326('0x2e')](function(){return _0x2e40cb;});}})[_0x3326('0x2e')](respondWithStatusCode(_0x1708d0,null))[_0x3326('0x55')](handleError(_0x1708d0,null));};exports[_0x3326('0xbe')]=function(_0xae038c,_0x3bd048,_0x3f53fd){var _0x33707b={};var _0x46957e={};var _0x76ba60;var _0x2e4efe;return db[_0x3326('0x3d')][_0x3326('0x6b')]({'where':{'id':_0xae038c[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x3bd048,null))[_0x3326('0x2e')](function(_0x3aa92c){if(_0x3aa92c){_0x76ba60=_0x3aa92c;_0x46957e['model']=_[_0x3326('0x58')](db['CmList']['rawAttributes']);_0x46957e[_0x3326('0x43')]=_['keys'](_0xae038c[_0x3326('0x43')]);_0x46957e['filters']=_[_0x3326('0x45')](_0x46957e[_0x3326('0x42')],_0x46957e['query']);_0x33707b[_0x3326('0x46')]=_[_0x3326('0x45')](_0x46957e[_0x3326('0x42')],qs[_0x3326('0x47')](_0xae038c[_0x3326('0x43')][_0x3326('0x47')]));_0x33707b[_0x3326('0x46')]=_0x33707b[_0x3326('0x46')]['length']?_0x33707b[_0x3326('0x46')]:_0x46957e['model'];_0x33707b[_0x3326('0x4c')]=qs[_0x3326('0x4d')](_0xae038c['query']['sort']);_0x33707b[_0x3326('0x4e')]=qs['filters'](_[_0x3326('0x4f')](_0xae038c[_0x3326('0x43')],_0x46957e[_0x3326('0x44')]));if(_0xae038c['query'][_0x3326('0x32')]){_0x33707b[_0x3326('0x4e')]=_[_0x3326('0x50')](_0x33707b[_0x3326('0x4e')],{'$or':_[_0x3326('0x34')](_0x33707b['attributes'],function(_0x358b52){var _0x315b65={};_0x315b65[_0x358b52]={'$like':'%'+_0xae038c[_0x3326('0x43')][_0x3326('0x32')]+'%'};return _0x315b65;})});}_0x33707b=_[_0x3326('0x50')]({},_0x33707b,_0xae038c[_0x3326('0x59')]);return _0x76ba60[_0x3326('0xbe')](_0x33707b);}})[_0x3326('0x2e')](function(_0x459509){if(_0x459509){_0x2e4efe=_0x459509['length'];if(!_0xae038c[_0x3326('0x43')][_0x3326('0x49')](_0x3326('0x4a'))){_0x33707b[_0x3326('0x4b')]=qs[_0x3326('0x4b')](_0xae038c[_0x3326('0x43')][_0x3326('0x4b')]);_0x33707b[_0x3326('0x25')]=qs[_0x3326('0x25')](_0xae038c['query'][_0x3326('0x25')]);}return _0x76ba60[_0x3326('0xbe')](_0x33707b);}})[_0x3326('0x2e')](function(_0x1eff94){if(_0x1eff94){return _0x1eff94?{'count':_0x2e4efe,'rows':_0x1eff94}:null;}})[_0x3326('0x2e')](respondWithResult(_0x3bd048,null))[_0x3326('0x55')](handleError(_0x3bd048,null));};exports[_0x3326('0xbf')]=function(_0x4ad000,_0x17d2ee,_0xa62972){var _0x357c6e,_0x3498d9;return db[_0x3326('0x3d')]['find']({'where':{'id':_0x4ad000['params']['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x17d2ee,null))[_0x3326('0x2e')](function(_0x2f5a0c){if(_0x2f5a0c){_0x3498d9=_0x2f5a0c;return _0x2f5a0c[_0x3326('0xbf')](_0x4ad000[_0x3326('0x5b')][_0x3326('0x98')],_[_0x3326('0x65')](_0x4ad000[_0x3326('0x5b')],[_0x3326('0x98'),'id'])||{});}return null;})['spread'](function(_0x333ee3){var _0x3e4372;_0x357c6e=_0x333ee3||[];var _0x3e0d49=[];if(_0x333ee3){for(var _0x337627=0x0;_0x337627<_0x333ee3[_0x3326('0x48')];_0x337627+=0x1){var _0xe14545=_0x333ee3[_0x337627][_0x3326('0x5d')]({'plain':!![]});_0x3e4372=squel['insert']()[_0x3326('0xa8')]('cm_hopper_black')['fromQuery']([_0x3326('0xa9'),'ContactId',_0x3326('0xb0'),_0x3326('0x6c'),_0x3326('0x66'),_0x3326('0x67')],squel[_0x3326('0xac')]()[_0x3326('0xad')](_0x3326('0xa9'),_0x3326('0xa9'))['field']('id',_0x3326('0xab'))[_0x3326('0xad')](_0xe14545['CmListId']['toString'](),'ListId')[_0x3326('0xad')](_0x4ad000['params']['id'][_0x3326('0xaf')](),'VoiceQueueId')[_0x3326('0xad')](_0x3326('0xb1'),_0x3326('0x66'))['field'](_0x3326('0xb1'),'updatedAt')[_0x3326('0x8d')]('cm_contacts')['where'](_0x3326('0xb3'))['where'](_0x3326('0xb4'),_0xe14545[_0x3326('0xae')][_0x3326('0xaf')]())[_0x3326('0x4e')](_0x3326('0xb5')))[_0x3326('0xaf')]();_0x3e0d49['push'](db[_0x3326('0x7e')]['query'](_0x3e4372));}return BPromise[_0x3326('0x95')](_0x3e0d49);}})[_0x3326('0x2e')](function(){return _0x357c6e;})['then'](respondWithResult(_0x17d2ee,null))[_0x3326('0x55')](handleError(_0x17d2ee,null));};exports['removeBlackLists']=function(_0x7c04a,_0x1a7925,_0x1eba9d){return db[_0x3326('0x3d')][_0x3326('0x37')]({'where':{'id':_0x7c04a[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](handleEntityNotFound(_0x1a7925,null))[_0x3326('0x2e')](function(_0x1e8c67){if(_0x1e8c67){return _0x1e8c67['removeBlackLists'](_0x7c04a[_0x3326('0x43')]['ids']);}})[_0x3326('0x2e')](function(_0x4876b3){if(_0x4876b3){return db[_0x3326('0x74')][_0x3326('0x2f')]({'where':{'ListId':_0x7c04a[_0x3326('0x43')][_0x3326('0x98')],'VoiceQueueId':_0x7c04a[_0x3326('0x57')]['id']}})[_0x3326('0x2e')](function(){return _0x4876b3;});}})['then'](respondWithStatusCode(_0x1a7925,null))[_0x3326('0x55')](handleError(_0x1a7925,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 71cf28f..2cd21de 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 _0x8c0f=['update','emit','exports','events','../../mysqldb','save'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x8c0f,0x7b));var _0xf8c0=function(_0x13d388,_0x1743c0){_0x13d388=_0x13d388-0x0;var _0x5ec11c=_0x8c0f[_0x13d388];return _0x5ec11c;};'use strict';var EventEmitter=require(_0xf8c0('0x0'));var VoiceQueue=require(_0xf8c0('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8c0('0x2'),'afterUpdate':_0xf8c0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x192581){return function(_0x1a1b83,_0x5f78dd,_0x449170){VoiceQueueEvents[_0xf8c0('0x4')](_0x192581+':'+_0x1a1b83['id'],_0x1a1b83);VoiceQueueEvents[_0xf8c0('0x4')](_0x192581,_0x1a1b83);_0x449170(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf8c0('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0x6be2=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x1c2f29,_0xd124c4){var _0x6d56aa=function(_0x444b72){while(--_0x444b72){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x6d56aa(++_0xd124c4);}(_0x6be2,0x107));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x26be('0x0'));var VoiceQueue=require(_0x26be('0x1'))['db'][_0x26be('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x26be('0x3')](0x0);var events={'afterCreate':_0x26be('0x4'),'afterUpdate':_0x26be('0x5'),'afterDestroy':_0x26be('0x6')};function emitEvent(_0x15ca55){return function(_0x39c1e6,_0x55fde5,_0xf5dc6b){VoiceQueueEvents[_0x26be('0x7')](_0x15ca55+':'+_0x39c1e6['id'],_0x39c1e6);VoiceQueueEvents[_0x26be('0x7')](_0x15ca55,_0x39c1e6);_0xf5dc6b(null);};}for(var e in events){if(events[_0x26be('0x8')](e)){var event=events[e];VoiceQueue[_0x26be('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 9a8a417..1d6575e 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(_0x3fbe46,_0x12a0d1){var _0x27c406=function(_0x4a1020){while(--_0x4a1020){_0x3fbe46['push'](_0x3fbe46['shift']());}};_0x27c406(++_0x12a0d1);}(_0x008c,0x188));var _0xc008=function(_0x1ed791,_0x3c86aa){_0x1ed791=_0x1ed791-0x0;var _0xea6482=_0x008c[_0x1ed791];return _0xea6482;};'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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x582f7e,_0x4cd7ba){var _0x1ac226=function(_0x40b322){while(--_0x40b322){_0x582f7e['push'](_0x582f7e['shift']());}};_0x1ac226(++_0x4cd7ba);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'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 efaa1b2..bb11c8a 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 _0x0942=['register','request','then','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x43352f,_0x440b48){var _0x9a21b0=function(_0x3b5bee){while(--_0x3b5bee){_0x43352f['push'](_0x43352f['shift']());}};_0x9a21b0(++_0x440b48);}(_0x0942,0x173));var _0x2094=function(_0x2b4eb0,_0x145855){_0x2b4eb0=_0x2b4eb0-0x0;var _0x3e9e10=_0x0942[_0x2b4eb0];return _0x3e9e10;};'use strict';var _=require(_0x2094('0x0'));var util=require(_0x2094('0x1'));var moment=require(_0x2094('0x2'));var BPromise=require(_0x2094('0x3'));var rs=require(_0x2094('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2094('0x5'))['db'];var utils=require(_0x2094('0x6'));var logger=require('../../config/logger')(_0x2094('0x7'));var config=require(_0x2094('0x8'));var jayson=require(_0x2094('0x9'));var client=jayson[_0x2094('0xa')][_0x2094('0xb')]({'port':0x232a});config[_0x2094('0xc')]=_[_0x2094('0xd')](config[_0x2094('0xc')],{'host':_0x2094('0xe'),'port':0x18eb});var socket=require(_0x2094('0xf'))(new Redis(config[_0x2094('0xc')]));require('./voiceQueue.socket')[_0x2094('0x10')](socket);function respondWithRpcPromise(_0x2c54b8,_0x10cbb0,_0xbd753d){return new BPromise(function(_0x358747,_0x4e2869){return client[_0x2094('0x11')](_0x2c54b8,_0xbd753d)[_0x2094('0x12')](function(_0x17396f){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x10cbb0,'request\x20sent');logger[_0x2094('0x13')](_0x2094('0x14'),_0x10cbb0,_0x2094('0x15'),JSON['stringify'](_0x17396f));if(_0x17396f[_0x2094('0x16')]){if(_0x17396f[_0x2094('0x16')][_0x2094('0x17')]===0x1f4){logger[_0x2094('0x16')](_0x2094('0x18'),_0x10cbb0,_0x17396f['error'][_0x2094('0x19')]);return _0x4e2869(_0x17396f['error'][_0x2094('0x19')]);}logger[_0x2094('0x16')](_0x2094('0x18'),_0x10cbb0,_0x17396f[_0x2094('0x16')][_0x2094('0x19')]);return _0x358747(_0x17396f[_0x2094('0x16')][_0x2094('0x19')]);}else{logger[_0x2094('0x1a')](_0x2094('0x18'),_0x10cbb0,'request\x20sent');_0x358747(_0x17396f[_0x2094('0x1b')]['message']);}})[_0x2094('0x1c')](function(_0x17ff8c){logger[_0x2094('0x16')](_0x2094('0x18'),_0x10cbb0,_0x17ff8c);_0x4e2869(_0x17ff8c);});});}exports[_0x2094('0x1d')]=function(_0xa67059){var _0x8b6b88=this;return new Promise(function(_0x530207,_0x209358){return db[_0x2094('0x1e')][_0x2094('0x1f')]({'raw':_0xa67059['options']?_0xa67059[_0x2094('0x20')][_0x2094('0x21')]===undefined?!![]:![]:!![],'where':_0xa67059[_0x2094('0x20')]?_0xa67059['options'][_0x2094('0x22')]||null:null,'attributes':_0xa67059[_0x2094('0x20')]?_0xa67059[_0x2094('0x20')][_0x2094('0x23')]||null:null,'limit':_0xa67059[_0x2094('0x20')]?_0xa67059[_0x2094('0x20')][_0x2094('0x24')]||null:null,'include':_0xa67059[_0x2094('0x20')]?_0xa67059[_0x2094('0x20')][_0x2094('0x25')]?_['map'](_0xa67059[_0x2094('0x20')][_0x2094('0x25')],function(_0x5b9363){return{'model':db[_0x5b9363['model']],'as':_0x5b9363['as'],'attributes':_0x5b9363[_0x2094('0x23')],'include':_0x5b9363[_0x2094('0x25')]?_[_0x2094('0x26')](_0x5b9363['include'],function(_0x55009d){return{'model':db[_0x55009d[_0x2094('0x27')]],'as':_0x55009d['as'],'attributes':_0x55009d[_0x2094('0x23')],'include':_0x55009d[_0x2094('0x25')]?_['map'](_0x55009d[_0x2094('0x25')],function(_0xec48ce){return{'model':db[_0xec48ce[_0x2094('0x27')]],'as':_0xec48ce['as'],'attributes':_0xec48ce[_0x2094('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2094('0x12')](function(_0x32f31e){logger['info'](_0x2094('0x1d'),_0xa67059);logger[_0x2094('0x13')](_0x2094('0x1d'),_0xa67059,JSON[_0x2094('0x28')](_0x32f31e));_0x530207(_0x32f31e);})[_0x2094('0x1c')](function(_0x5af66d){logger[_0x2094('0x16')](_0x2094('0x1d'),_0x5af66d[_0x2094('0x19')],_0xa67059);_0x209358(_0x8b6b88[_0x2094('0x16')](0x1f4,_0x5af66d[_0x2094('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x1f7079){var _0x54c000=this;return new Promise(function(_0x3c2116,_0x238f0b){return db[_0x2094('0x1e')][_0x2094('0x29')]({'raw':_0x1f7079[_0x2094('0x20')]?_0x1f7079['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f7079[_0x2094('0x20')]?_0x1f7079[_0x2094('0x20')]['where']||null:null,'attributes':_0x1f7079[_0x2094('0x20')]?_0x1f7079[_0x2094('0x20')][_0x2094('0x23')]||null:null,'include':_0x1f7079[_0x2094('0x20')]?_0x1f7079[_0x2094('0x20')][_0x2094('0x25')]?_[_0x2094('0x26')](_0x1f7079[_0x2094('0x20')][_0x2094('0x25')],function(_0x5430b9){return{'model':db[_0x5430b9[_0x2094('0x27')]],'as':_0x5430b9['as'],'attributes':_0x5430b9[_0x2094('0x23')],'include':_0x5430b9[_0x2094('0x25')]?_[_0x2094('0x26')](_0x5430b9[_0x2094('0x25')],function(_0x4e7284){return{'model':db[_0x4e7284[_0x2094('0x27')]],'as':_0x4e7284['as'],'attributes':_0x4e7284[_0x2094('0x23')],'include':_0x4e7284[_0x2094('0x25')]?_['map'](_0x4e7284['include'],function(_0x3b0413){return{'model':db[_0x3b0413[_0x2094('0x27')]],'as':_0x3b0413['as'],'attributes':_0x3b0413['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd33cb){logger[_0x2094('0x1a')](_0x2094('0x2a'),_0x1f7079);logger['debug'](_0x2094('0x2a'),_0x1f7079,JSON['stringify'](_0xd33cb));_0x3c2116(_0xd33cb);})[_0x2094('0x1c')](function(_0x3725fa){logger['error'](_0x2094('0x2a'),_0x3725fa[_0x2094('0x19')],_0x1f7079);_0x238f0b(_0x54c000['error'](0x1f4,_0x3725fa['message']));});});}; \ No newline at end of file +var _0x97b7=['include','map','model','then','stringify','ShowVoiceQueue','find','raw','where','debug','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','attributes'];(function(_0x1d2a77,_0x3bcfe5){var _0x5bab7d=function(_0xe3a05a){while(--_0xe3a05a){_0x1d2a77['push'](_0x1d2a77['shift']());}};_0x5bab7d(++_0x3bcfe5);}(_0x97b7,0xbe));var _0x797b=function(_0x4efc7a,_0x398453){_0x4efc7a=_0x4efc7a-0x0;var _0x15c38e=_0x97b7[_0x4efc7a];return _0x15c38e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x797b('0x0'));var rs=require(_0x797b('0x1'));var fs=require('fs');var Redis=require(_0x797b('0x2'));var db=require(_0x797b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x797b('0x4'))('rpc');var config=require(_0x797b('0x5'));var jayson=require(_0x797b('0x6'));var client=jayson[_0x797b('0x7')][_0x797b('0x8')]({'port':0x232a});config[_0x797b('0x9')]=_[_0x797b('0xa')](config[_0x797b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x797b('0x9')]));require(_0x797b('0xb'))[_0x797b('0xc')](socket);function respondWithRpcPromise(_0x27c085,_0x211d0b,_0x524cf3){return new BPromise(function(_0x2ad199,_0xa073cf){return client['request'](_0x27c085,_0x524cf3)['then'](function(_0x4e0ee3){logger[_0x797b('0xd')](_0x797b('0xe'),_0x211d0b,_0x797b('0xf'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x211d0b,'request\x20sent',JSON['stringify'](_0x4e0ee3));if(_0x4e0ee3[_0x797b('0x10')]){if(_0x4e0ee3['error'][_0x797b('0x11')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x211d0b,_0x4e0ee3[_0x797b('0x10')][_0x797b('0x12')]);return _0xa073cf(_0x4e0ee3[_0x797b('0x10')][_0x797b('0x12')]);}logger[_0x797b('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x211d0b,_0x4e0ee3[_0x797b('0x10')][_0x797b('0x12')]);return _0x2ad199(_0x4e0ee3['error'][_0x797b('0x12')]);}else{logger['info'](_0x797b('0xe'),_0x211d0b,_0x797b('0xf'));_0x2ad199(_0x4e0ee3[_0x797b('0x13')]['message']);}})[_0x797b('0x14')](function(_0x518422){logger[_0x797b('0x10')](_0x797b('0xe'),_0x211d0b,_0x518422);_0xa073cf(_0x518422);});});}exports[_0x797b('0x15')]=function(_0x32b96c){var _0x53033e=this;return new Promise(function(_0xae6bdb,_0x2e77d1){return db[_0x797b('0x16')][_0x797b('0x17')]({'raw':_0x32b96c[_0x797b('0x18')]?_0x32b96c[_0x797b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x32b96c['options']?_0x32b96c['options']['where']||null:null,'attributes':_0x32b96c[_0x797b('0x18')]?_0x32b96c[_0x797b('0x18')][_0x797b('0x19')]||null:null,'limit':_0x32b96c[_0x797b('0x18')]?_0x32b96c[_0x797b('0x18')]['limit']||null:null,'include':_0x32b96c[_0x797b('0x18')]?_0x32b96c[_0x797b('0x18')][_0x797b('0x1a')]?_[_0x797b('0x1b')](_0x32b96c['options'][_0x797b('0x1a')],function(_0x966100){return{'model':db[_0x966100[_0x797b('0x1c')]],'as':_0x966100['as'],'attributes':_0x966100[_0x797b('0x19')],'include':_0x966100[_0x797b('0x1a')]?_[_0x797b('0x1b')](_0x966100[_0x797b('0x1a')],function(_0x3af530){return{'model':db[_0x3af530['model']],'as':_0x3af530['as'],'attributes':_0x3af530[_0x797b('0x19')],'include':_0x3af530['include']?_['map'](_0x3af530[_0x797b('0x1a')],function(_0x521e1b){return{'model':db[_0x521e1b[_0x797b('0x1c')]],'as':_0x521e1b['as'],'attributes':_0x521e1b['attributes']};}):[]};}):[]};}):[]:[]})[_0x797b('0x1d')](function(_0x3860d4){logger[_0x797b('0xd')](_0x797b('0x15'),_0x32b96c);logger['debug'](_0x797b('0x15'),_0x32b96c,JSON[_0x797b('0x1e')](_0x3860d4));_0xae6bdb(_0x3860d4);})[_0x797b('0x14')](function(_0x57e246){logger[_0x797b('0x10')]('GetVoiceQueue',_0x57e246[_0x797b('0x12')],_0x32b96c);_0x2e77d1(_0x53033e[_0x797b('0x10')](0x1f4,_0x57e246[_0x797b('0x12')]));});});};exports[_0x797b('0x1f')]=function(_0x542600){var _0x1169bb=this;return new Promise(function(_0x2078c2,_0x283708){return db['VoiceQueue'][_0x797b('0x20')]({'raw':_0x542600[_0x797b('0x18')]?_0x542600[_0x797b('0x18')][_0x797b('0x21')]===undefined?!![]:![]:!![],'where':_0x542600[_0x797b('0x18')]?_0x542600[_0x797b('0x18')][_0x797b('0x22')]||null:null,'attributes':_0x542600['options']?_0x542600[_0x797b('0x18')][_0x797b('0x19')]||null:null,'include':_0x542600[_0x797b('0x18')]?_0x542600['options']['include']?_[_0x797b('0x1b')](_0x542600['options'][_0x797b('0x1a')],function(_0x138832){return{'model':db[_0x138832[_0x797b('0x1c')]],'as':_0x138832['as'],'attributes':_0x138832['attributes'],'include':_0x138832[_0x797b('0x1a')]?_['map'](_0x138832['include'],function(_0x2b47f4){return{'model':db[_0x2b47f4[_0x797b('0x1c')]],'as':_0x2b47f4['as'],'attributes':_0x2b47f4[_0x797b('0x19')],'include':_0x2b47f4[_0x797b('0x1a')]?_['map'](_0x2b47f4[_0x797b('0x1a')],function(_0x15e83f){return{'model':db[_0x15e83f[_0x797b('0x1c')]],'as':_0x15e83f['as'],'attributes':_0x15e83f[_0x797b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x797b('0x1d')](function(_0x5a8bdf){logger[_0x797b('0xd')](_0x797b('0x1f'),_0x542600);logger[_0x797b('0x23')](_0x797b('0x1f'),_0x542600,JSON['stringify'](_0x5a8bdf));_0x2078c2(_0x5a8bdf);})['catch'](function(_0x3f2b6d){logger[_0x797b('0x10')](_0x797b('0x1f'),_0x3f2b6d[_0x797b('0x12')],_0x542600);_0x283708(_0x1169bb[_0x797b('0x10')](0x1f4,_0x3f2b6d[_0x797b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 257f610..0452fd0 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 _0xedff=['emit','register','voiceQueue:','save','remove'];(function(_0x268d04,_0x1d6c99){var _0x193919=function(_0x226091){while(--_0x226091){_0x268d04['push'](_0x268d04['shift']());}};_0x193919(++_0x1d6c99);}(_0xedff,0x94));var _0xfedf=function(_0x25e426,_0x2f3a59){_0x25e426=_0x25e426-0x0;var _0x5b8625=_0xedff[_0x25e426];return _0x5b8625;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xfedf('0x0'),_0xfedf('0x1'),'update'];function createListener(_0x443a9a,_0x3a47c9){return function(_0x2c7d34){_0x3a47c9[_0xfedf('0x2')](_0x443a9a,_0x2c7d34);};}function removeListener(_0x41042d,_0x56b097){return function(){VoiceQueueEvents['removeListener'](_0x41042d,_0x56b097);};}exports[_0xfedf('0x3')]=function(_0x3b779b){for(var _0x3b4eee=0x0,_0x5ce282=events['length'];_0x3b4eee<_0x5ce282;_0x3b4eee++){var _0x1ba804=events[_0x3b4eee];var _0xcd7eb9=createListener(_0xfedf('0x4')+_0x1ba804,_0x3b779b);VoiceQueueEvents['on'](_0x1ba804,_0xcd7eb9);}}; \ No newline at end of file +var _0x9712=['remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2fed8b,_0x35601d){var _0x44819b=function(_0x480276){while(--_0x480276){_0x2fed8b['push'](_0x2fed8b['shift']());}};_0x44819b(++_0x35601d);}(_0x9712,0xf6));var _0x2971=function(_0x3a51f0,_0x84e1c7){_0x3a51f0=_0x3a51f0-0x0;var _0x11c7c8=_0x9712[_0x3a51f0];return _0x11c7c8;};'use strict';var VoiceQueueEvents=require(_0x2971('0x0'));var events=[_0x2971('0x1'),_0x2971('0x2'),'update'];function createListener(_0x14f2c0,_0x3ab9a5){return function(_0x5335ae){_0x3ab9a5[_0x2971('0x3')](_0x14f2c0,_0x5335ae);};}function removeListener(_0x32f833,_0xd60555){return function(){VoiceQueueEvents[_0x2971('0x4')](_0x32f833,_0xd60555);};}exports[_0x2971('0x5')]=function(_0x33c18b){for(var _0x176adc=0x0,_0x2a6f20=events[_0x2971('0x6')];_0x176adc<_0x2a6f20;_0x176adc++){var _0xbb4c2c=events[_0x176adc];var _0x267ebf=createListener(_0x2971('0x7')+_0xbb4c2c,_0x33c18b);VoiceQueueEvents['on'](_0xbb4c2c,_0x267ebf);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1b6ac15..e79cd54 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 _0x939a=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update'];(function(_0x38e191,_0x8d5355){var _0x4af767=function(_0x29faac){while(--_0x29faac){_0x38e191['push'](_0x38e191['shift']());}};_0x4af767(++_0x8d5355);}(_0x939a,0x12d));var _0xa939=function(_0x4e7b44,_0x5db395){_0x4e7b44=_0x4e7b44-0x0;var _0x153a5e=_0x939a[_0x4e7b44];return _0x153a5e;};'use strict';var multer=require(_0xa939('0x0'));var util=require(_0xa939('0x1'));var path=require(_0xa939('0x2'));var timeout=require(_0xa939('0x3'));var express=require(_0xa939('0x4'));var router=express[_0xa939('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa939('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa939('0x7'));var controller=require(_0xa939('0x8'));router[_0xa939('0x9')]('/',auth[_0xa939('0xa')](),controller['index']);router['get'](_0xa939('0xb'),auth[_0xa939('0xa')](),controller[_0xa939('0xc')]);router[_0xa939('0x9')](_0xa939('0xd'),auth[_0xa939('0xa')](),controller[_0xa939('0xe')]);router[_0xa939('0x9')]('/:id',auth[_0xa939('0xa')](),controller[_0xa939('0xf')]);router[_0xa939('0x10')]('/',auth[_0xa939('0xa')](),controller[_0xa939('0x11')]);router[_0xa939('0x12')](_0xa939('0x13'),auth[_0xa939('0xa')](),controller[_0xa939('0x14')]);router[_0xa939('0x15')]('/:id',auth[_0xa939('0xa')](),controller['destroy']);module[_0xa939('0x16')]=router; \ No newline at end of file +var _0xa4f9=['delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','/index','getVoiceQueuesReport','/:id','create','put','update'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xa4f9,0x1cb));var _0x9a4f=function(_0x33a8b6,_0x277343){_0x33a8b6=_0x33a8b6-0x0;var _0x33959c=_0xa4f9[_0x33a8b6];return _0x33959c;};'use strict';var multer=require('multer');var util=require(_0x9a4f('0x0'));var path=require('path');var timeout=require(_0x9a4f('0x1'));var express=require(_0x9a4f('0x2'));var router=express[_0x9a4f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a4f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a4f('0x5'));router['get']('/',auth[_0x9a4f('0x6')](),controller['index']);router[_0x9a4f('0x7')](_0x9a4f('0x8'),auth[_0x9a4f('0x6')](),controller[_0x9a4f('0x9')]);router[_0x9a4f('0x7')](_0x9a4f('0xa'),auth[_0x9a4f('0x6')](),controller[_0x9a4f('0xb')]);router[_0x9a4f('0x7')](_0x9a4f('0xc'),auth[_0x9a4f('0x6')](),controller['show']);router['post']('/',auth[_0x9a4f('0x6')](),controller[_0x9a4f('0xd')]);router[_0x9a4f('0xe')](_0x9a4f('0xc'),auth[_0x9a4f('0x6')](),controller[_0x9a4f('0xf')]);router[_0x9a4f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9a4f('0x11')]);module[_0x9a4f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 82124eb..2891c11 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 _0x5bb9=['sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x175c5e,_0x2581fe){var _0x3e1158=function(_0x1919a0){while(--_0x1919a0){_0x175c5e['push'](_0x175c5e['shift']());}};_0x3e1158(++_0x2581fe);}(_0x5bb9,0xb4));var _0x95bb=function(_0x8f3051,_0x12c59f){_0x8f3051=_0x8f3051-0x0;var _0x518a60=_0x5bb9[_0x8f3051];return _0x518a60;};'use strict';var Sequelize=require(_0x95bb('0x0'));var moment=require(_0x95bb('0x1'));module[_0x95bb('0x2')]={'type':{'type':Sequelize[_0x95bb('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x95bb('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x95bb('0x4')],'set':function(_0x33447f){var _0x5414d9=moment(_0x33447f);var _0x509ae8=moment(this['getDataValue'](_0x95bb('0x5')))[_0x95bb('0x6')](_0x95bb('0x7'));var _0x477559=_0x5414d9[_0x95bb('0x8')](_0x509ae8,'seconds');this['setDataValue'](_0x95bb('0x9'),_0x33447f);this[_0x95bb('0xa')]('holdtime',_0x477559||null);}},'position':{'type':Sequelize[_0x95bb('0xb')]},'count':{'type':Sequelize[_0x95bb('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallerexit':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x95bb('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x95bb('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x95bb('0x3')]},'connectedlinename':{'type':Sequelize[_0x95bb('0x3')]},'accountcode':{'type':Sequelize[_0x95bb('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x95bb('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x95bb('0xb')]},'mohtime':{'type':Sequelize[_0x95bb('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x95bb('0x3')]},'transfer':{'type':Sequelize[_0x95bb('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x95bb('0x3')],'comment':_0x95bb('0xe')},'transferexten':{'type':Sequelize[_0x95bb('0x3')]},'transferuniqueid':{'type':Sequelize[_0x95bb('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x95bb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x95bb('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ae4=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','getDataValue','queuecallerjoinAt'];(function(_0x10e3ce,_0x5a9272){var _0x2cf532=function(_0x29f052){while(--_0x29f052){_0x10e3ce['push'](_0x10e3ce['shift']());}};_0x2cf532(++_0x5a9272);}(_0x6ae4,0xeb));var _0x46ae=function(_0x129767,_0x1b8fa8){_0x129767=_0x129767-0x0;var _0xbc8b4b=_0x6ae4[_0x129767];return _0xbc8b4b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x46ae('0x0'));module[_0x46ae('0x1')]={'type':{'type':Sequelize[_0x46ae('0x2')]},'uniqueid':{'type':Sequelize[_0x46ae('0x2')]},'calleridnum':{'type':Sequelize[_0x46ae('0x2')]},'calleridname':{'type':Sequelize[_0x46ae('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x29447b){var _0x3d5921=moment(_0x29447b);var _0x271d19=moment(this[_0x46ae('0x3')](_0x46ae('0x4')))[_0x46ae('0x5')](_0x46ae('0x6'));var _0x53517e=_0x3d5921[_0x46ae('0x7')](_0x271d19,_0x46ae('0x8'));this[_0x46ae('0x9')](_0x46ae('0xa'),_0x29447b);this[_0x46ae('0x9')](_0x46ae('0xb'),_0x53517e||null);}},'position':{'type':Sequelize[_0x46ae('0xc')]},'count':{'type':Sequelize[_0x46ae('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x46ae('0xe')]},'queuecallerexitreason':{'type':Sequelize[_0x46ae('0x2')],'comment':_0x46ae('0xf')},'originalposition':{'type':Sequelize[_0x46ae('0xc')]},'channel':{'type':Sequelize[_0x46ae('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x46ae('0x2')]},'accountcode':{'type':Sequelize[_0x46ae('0x2')]},'context':{'type':Sequelize[_0x46ae('0x2')]},'exten':{'type':Sequelize[_0x46ae('0x2')]},'priority':{'type':Sequelize[_0x46ae('0x2')]},'holdtime':{'type':Sequelize[_0x46ae('0xc')]},'mohtime':{'type':Sequelize[_0x46ae('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x46ae('0x2')]},'transfer':{'type':Sequelize[_0x46ae('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x46ae('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x46ae('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x46ae('0x2')]},'secondDisposition':{'type':Sequelize[_0x46ae('0x2')]},'thirdDisposition':{'type':Sequelize[_0x46ae('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x46ae('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 6c81074..c015958 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 _0xd627=['VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','intersection','create','body','find','describe','getVoiceQueuesReport','order','pick','findAll','rows','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge'];(function(_0x488882,_0x50c541){var _0x1b3b0c=function(_0x3c287c){while(--_0x3c287c){_0x488882['push'](_0x488882['shift']());}};_0x1b3b0c(++_0x50c541);}(_0xd627,0x106));var _0x7d62=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd627[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d62('0x0'));var zipdir=require(_0x7d62('0x1'));var jsonpatch=require(_0x7d62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d62('0x3'));var Mustache=require(_0x7d62('0x4'));var util=require(_0x7d62('0x5'));var path=require('path');var sox=require(_0x7d62('0x6'));var csv=require(_0x7d62('0x7'));var ejs=require(_0x7d62('0x8'));var fs=require('fs');var fs_extra=require(_0x7d62('0x9'));var _=require(_0x7d62('0xa'));var squel=require(_0x7d62('0xb'));var crypto=require(_0x7d62('0xc'));var jsforce=require(_0x7d62('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7d62('0x7'));var querystring=require(_0x7d62('0xe'));var Papa=require(_0x7d62('0xf'));var Redis=require('ioredis');var authService=require(_0x7d62('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d62('0x11'));var logger=require(_0x7d62('0x12'))(_0x7d62('0x13'));var utils=require('../../config/utils');var config=require(_0x7d62('0x14'));var licenseUtil=require(_0x7d62('0x15'));var db=require(_0x7d62('0x16'))['db'];config[_0x7d62('0x17')]=_[_0x7d62('0x18')](config[_0x7d62('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d62('0x19'))(new Redis(config[_0x7d62('0x17')]));require(_0x7d62('0x1a'))[_0x7d62('0x1b')](socket);function respondWithStatusCode(_0x4abeac,_0x21ea11){_0x21ea11=_0x21ea11||0xcc;return function(_0x3b263c){if(_0x3b263c){return _0x4abeac[_0x7d62('0x1c')](_0x21ea11);}return _0x4abeac[_0x7d62('0x1d')](_0x21ea11)[_0x7d62('0x1e')]();};}function respondWithResult(_0x591917,_0x583f25){_0x583f25=_0x583f25||0xc8;return function(_0x40f010){if(_0x40f010){return _0x591917[_0x7d62('0x1d')](_0x583f25)['json'](_0x40f010);}};}function respondWithFilteredResult(_0x8da045,_0x454648){return function(_0x282047){if(_0x282047){var _0xa38b0e=typeof _0x454648[_0x7d62('0x1f')]===_0x7d62('0x20')&&typeof _0x454648[_0x7d62('0x21')]==='undefined';var _0x5ec141=_0x282047[_0x7d62('0x22')];var _0x40b161=_0xa38b0e?0x0:_0x454648[_0x7d62('0x1f')];var _0x276852=_0xa38b0e?_0x282047[_0x7d62('0x22')]:_0x454648['offset']+_0x454648['limit'];var _0x308964;if(_0x276852>=_0x5ec141){_0x276852=_0x5ec141;_0x308964=0xc8;}else{_0x308964=0xce;}_0x8da045['status'](_0x308964);return _0x8da045['set'](_0x7d62('0x23'),_0x40b161+'-'+_0x276852+'/'+_0x5ec141)[_0x7d62('0x24')](_0x282047);}return null;};}function patchUpdates(_0x3df175){return function(_0x57c3a0){try{jsonpatch['apply'](_0x57c3a0,_0x3df175,!![]);}catch(_0x1d9468){return BPromise[_0x7d62('0x25')](_0x1d9468);}return _0x57c3a0['save']();};}function saveUpdates(_0x2242a6,_0x3147ef){return function(_0x56981f){if(_0x56981f){return _0x56981f[_0x7d62('0x26')](_0x2242a6)[_0x7d62('0x27')](function(_0x2760dd){return _0x2760dd;});}return null;};}function removeEntity(_0x597bec,_0x5e90a3){return function(_0x4129e2){if(_0x4129e2){return _0x4129e2[_0x7d62('0x28')]()['then'](function(){_0x597bec[_0x7d62('0x1d')](0xcc)[_0x7d62('0x1e')]();});}};}function handleEntityNotFound(_0x214b20,_0x5bf94b){return function(_0xee793a){if(!_0xee793a){_0x214b20['sendStatus'](0x194);}return _0xee793a;};}function handleError(_0x1f72a1,_0x45c934){_0x45c934=_0x45c934||0x1f4;return function(_0x5ca80c){logger['error'](_0x5ca80c[_0x7d62('0x29')]);if(_0x5ca80c['name']){delete _0x5ca80c[_0x7d62('0x2a')];}_0x1f72a1['status'](_0x45c934)[_0x7d62('0x2b')](_0x5ca80c);};}exports[_0x7d62('0x2c')]=function(_0x7b0f76,_0x1f478d){var _0x133e32={},_0x137f4b={},_0x2fc60a={'count':0x0,'rows':[]};var _0x41e5e0=_[_0x7d62('0x2d')](db[_0x7d62('0x2e')][_0x7d62('0x2f')],function(_0x4d25b7){return{'name':_0x4d25b7[_0x7d62('0x30')],'type':_0x4d25b7[_0x7d62('0x31')][_0x7d62('0x32')]};});_0x137f4b[_0x7d62('0x33')]=_[_0x7d62('0x2d')](_0x41e5e0,_0x7d62('0x2a'));_0x137f4b[_0x7d62('0x34')]=_['keys'](_0x7b0f76[_0x7d62('0x34')]);_0x137f4b[_0x7d62('0x35')]=_['intersection'](_0x137f4b[_0x7d62('0x33')],_0x137f4b[_0x7d62('0x34')]);_0x133e32[_0x7d62('0x36')]=_['intersection'](_0x137f4b['model'],qs['fields'](_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x37')]));_0x133e32[_0x7d62('0x36')]=_0x133e32['attributes'][_0x7d62('0x38')]?_0x133e32['attributes']:_0x137f4b['model'];if(!_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x39')](_0x7d62('0x3a'))){_0x133e32[_0x7d62('0x21')]=qs[_0x7d62('0x21')](_0x7b0f76['query'][_0x7d62('0x21')]);_0x133e32[_0x7d62('0x1f')]=qs[_0x7d62('0x1f')](_0x7b0f76['query']['offset']);}_0x133e32['order']=qs[_0x7d62('0x3b')](_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x3b')]);_0x133e32['where']=qs[_0x7d62('0x35')](_['pick'](_0x7b0f76[_0x7d62('0x34')],_0x137f4b[_0x7d62('0x35')]),_0x41e5e0);if(_0x7b0f76[_0x7d62('0x34')]['filter']){_0x133e32[_0x7d62('0x3c')]=_[_0x7d62('0x3d')](_0x133e32[_0x7d62('0x3c')],{'$or':_[_0x7d62('0x2d')](_0x41e5e0,function(_0x424b04){if(_0x424b04['type']!==_0x7d62('0x3e')){var _0xa753b={};_0xa753b[_0x424b04['name']]={'$like':'%'+_0x7b0f76['query'][_0x7d62('0x3f')]+'%'};return _0xa753b;}})});}_0x133e32=_[_0x7d62('0x3d')]({},_0x133e32,_0x7b0f76[_0x7d62('0x40')]);var _0x513e4c={'where':_0x133e32[_0x7d62('0x3c')]};return db['VoiceQueueReport']['count'](_0x513e4c)[_0x7d62('0x27')](function(_0x355bb8){_0x2fc60a[_0x7d62('0x22')]=_0x355bb8;if(_0x7b0f76[_0x7d62('0x34')][_0x7d62('0x41')]){_0x133e32[_0x7d62('0x42')]=[{'all':!![]}];}return db[_0x7d62('0x2e')]['findAll'](_0x133e32);})[_0x7d62('0x27')](function(_0x58aa0c){_0x2fc60a['rows']=_0x58aa0c;return _0x2fc60a;})['then'](respondWithFilteredResult(_0x1f478d,_0x133e32))[_0x7d62('0x43')](handleError(_0x1f478d,null));};exports[_0x7d62('0x44')]=function(_0x9a50dc,_0x4dd062){var _0xc6b2a7={'raw':![],'where':{'id':_0x9a50dc[_0x7d62('0x45')]['id']}},_0x211fe6={};_0x211fe6[_0x7d62('0x33')]=_[_0x7d62('0x46')](db['VoiceQueueReport']['rawAttributes']);_0x211fe6[_0x7d62('0x34')]=_[_0x7d62('0x46')](_0x9a50dc['query']);_0x211fe6[_0x7d62('0x35')]=_[_0x7d62('0x47')](_0x211fe6[_0x7d62('0x33')],_0x211fe6[_0x7d62('0x34')]);_0xc6b2a7[_0x7d62('0x36')]=_[_0x7d62('0x47')](_0x211fe6[_0x7d62('0x33')],qs[_0x7d62('0x37')](_0x9a50dc[_0x7d62('0x34')]['fields']));_0xc6b2a7[_0x7d62('0x36')]=_0xc6b2a7[_0x7d62('0x36')][_0x7d62('0x38')]?_0xc6b2a7['attributes']:_0x211fe6[_0x7d62('0x33')];if(_0x9a50dc[_0x7d62('0x34')][_0x7d62('0x41')]){_0xc6b2a7[_0x7d62('0x42')]=[{'all':!![]}];}_0xc6b2a7=_[_0x7d62('0x3d')]({},_0xc6b2a7,_0x9a50dc['options']);return db[_0x7d62('0x2e')]['find'](_0xc6b2a7)['then'](handleEntityNotFound(_0x4dd062,null))[_0x7d62('0x27')](respondWithResult(_0x4dd062,null))['catch'](handleError(_0x4dd062,null));};exports[_0x7d62('0x48')]=function(_0x25ebcd,_0xa28e5a){return db[_0x7d62('0x2e')]['create'](_0x25ebcd[_0x7d62('0x49')],{})[_0x7d62('0x27')](respondWithResult(_0xa28e5a,0xc9))[_0x7d62('0x43')](handleError(_0xa28e5a,null));};exports[_0x7d62('0x26')]=function(_0x57987e,_0x387c52){if(_0x57987e[_0x7d62('0x49')]['id']){delete _0x57987e['body']['id'];}return db[_0x7d62('0x2e')]['find']({'where':{'id':_0x57987e[_0x7d62('0x45')]['id']}})[_0x7d62('0x27')](handleEntityNotFound(_0x387c52,null))[_0x7d62('0x27')](saveUpdates(_0x57987e[_0x7d62('0x49')],null))[_0x7d62('0x27')](respondWithResult(_0x387c52,null))['catch'](handleError(_0x387c52,null));};exports['destroy']=function(_0x16219f,_0x76700e){return db[_0x7d62('0x2e')][_0x7d62('0x4a')]({'where':{'id':_0x16219f[_0x7d62('0x45')]['id']}})[_0x7d62('0x27')](handleEntityNotFound(_0x76700e,null))[_0x7d62('0x27')](removeEntity(_0x76700e,null))['catch'](handleError(_0x76700e,null));};exports['describe']=function(_0x55e9d7,_0x48fbd3){return db['VoiceQueueReport'][_0x7d62('0x4b')]()[_0x7d62('0x27')](respondWithResult(_0x48fbd3,null))[_0x7d62('0x43')](handleError(_0x48fbd3,null));};exports[_0x7d62('0x4c')]=function(_0xf3f987,_0x5f9cec){var _0x45cb3e={},_0x699b07={},_0xdfa2ff={'count':0x0,'rows':[]};_0x699b07[_0x7d62('0x33')]=_[_0x7d62('0x46')](db['VoiceQueueReport'][_0x7d62('0x2f')]);_0x699b07[_0x7d62('0x34')]=_[_0x7d62('0x46')](_0xf3f987[_0x7d62('0x34')]);_0x699b07[_0x7d62('0x35')]=_['intersection'](_0x699b07[_0x7d62('0x33')],_0x699b07[_0x7d62('0x34')]);_0x45cb3e[_0x7d62('0x36')]=_[_0x7d62('0x47')](_0x699b07[_0x7d62('0x33')],qs[_0x7d62('0x37')](_0xf3f987['query'][_0x7d62('0x37')]));_0x45cb3e[_0x7d62('0x36')]=_0x45cb3e[_0x7d62('0x36')]['length']?_0x45cb3e[_0x7d62('0x36')]:_0x699b07['model'];if(!_0xf3f987[_0x7d62('0x34')]['hasOwnProperty'](_0x7d62('0x3a'))){_0x45cb3e[_0x7d62('0x21')]=qs[_0x7d62('0x21')](_0xf3f987[_0x7d62('0x34')][_0x7d62('0x21')]);_0x45cb3e[_0x7d62('0x1f')]=qs[_0x7d62('0x1f')](_0xf3f987[_0x7d62('0x34')][_0x7d62('0x1f')]);}_0x45cb3e[_0x7d62('0x4d')]=qs[_0x7d62('0x3b')](_0xf3f987[_0x7d62('0x34')][_0x7d62('0x3b')]);_0x45cb3e[_0x7d62('0x3c')]=qs['filters'](_[_0x7d62('0x4e')](_0xf3f987['query'],_0x699b07[_0x7d62('0x35')]));if(_0xf3f987[_0x7d62('0x34')]['filter']){_0x45cb3e[_0x7d62('0x3c')]=_[_0x7d62('0x3d')](_0x45cb3e[_0x7d62('0x3c')],{'$or':_[_0x7d62('0x2d')](_0x45cb3e[_0x7d62('0x36')],function(_0x49607e){var _0x19a18a={};_0x19a18a[_0x49607e]={'$like':'%'+_0xf3f987[_0x7d62('0x34')]['filter']+'%'};return _0x19a18a;})});}_0x45cb3e=_[_0x7d62('0x3d')]({},_0x45cb3e,_0xf3f987[_0x7d62('0x40')]);var _0x500f8e={'where':_0x45cb3e['where']};return db['VoiceQueueReport'][_0x7d62('0x22')](_0x500f8e)[_0x7d62('0x27')](function(_0x41fb3e){_0xdfa2ff[_0x7d62('0x22')]=_0x41fb3e;if(_0xf3f987[_0x7d62('0x34')][_0x7d62('0x41')]){_0x45cb3e[_0x7d62('0x42')]=[{'all':!![]}];}return db[_0x7d62('0x2e')][_0x7d62('0x4f')](_0x45cb3e);})[_0x7d62('0x27')](function(_0xd10d67){_0xdfa2ff[_0x7d62('0x50')]=_0xd10d67;return _0xdfa2ff;})['then'](respondWithFilteredResult(_0x5f9cec,_0x45cb3e,_0x7d62('0x4c')))[_0x7d62('0x43')](handleError(_0x5f9cec,null,_0x7d62('0x4c')));}; \ No newline at end of file +var _0x7aca=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','catch','show','rawAttributes','include','options','find','create','body','update','params','describe','getVoiceQueuesReport','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','offset','undefined','count','limit','set','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','model','query','keys'];(function(_0x3c7b07,_0x101171){var _0x2b1fde=function(_0x54b936){while(--_0x54b936){_0x3c7b07['push'](_0x3c7b07['shift']());}};_0x2b1fde(++_0x101171);}(_0x7aca,0x164));var _0xa7ac=function(_0x4c96dd,_0x2045d3){_0x4c96dd=_0x4c96dd-0x0;var _0x52a76e=_0x7aca[_0x4c96dd];return _0x52a76e;};'use strict';var emlformat=require(_0xa7ac('0x0'));var rimraf=require(_0xa7ac('0x1'));var zipdir=require(_0xa7ac('0x2'));var jsonpatch=require(_0xa7ac('0x3'));var rp=require(_0xa7ac('0x4'));var moment=require(_0xa7ac('0x5'));var BPromise=require(_0xa7ac('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa7ac('0x7'));var csv=require(_0xa7ac('0x8'));var ejs=require(_0xa7ac('0x9'));var fs=require('fs');var fs_extra=require(_0xa7ac('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa7ac('0xb'));var deskjs=require(_0xa7ac('0xc'));var toCsv=require(_0xa7ac('0x8'));var querystring=require(_0xa7ac('0xd'));var Papa=require(_0xa7ac('0xe'));var Redis=require(_0xa7ac('0xf'));var authService=require(_0xa7ac('0x10'));var qs=require(_0xa7ac('0x11'));var as=require(_0xa7ac('0x12'));var hardwareService=require(_0xa7ac('0x13'));var logger=require(_0xa7ac('0x14'))(_0xa7ac('0x15'));var utils=require(_0xa7ac('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa7ac('0x17'));var db=require(_0xa7ac('0x18'))['db'];config[_0xa7ac('0x19')]=_[_0xa7ac('0x1a')](config[_0xa7ac('0x19')],{'host':_0xa7ac('0x1b'),'port':0x18eb});var socket=require(_0xa7ac('0x1c'))(new Redis(config[_0xa7ac('0x19')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x25a529,_0x4146f4){_0x4146f4=_0x4146f4||0xcc;return function(_0x397d0c){if(_0x397d0c){return _0x25a529['sendStatus'](_0x4146f4);}return _0x25a529[_0xa7ac('0x1d')](_0x4146f4)[_0xa7ac('0x1e')]();};}function respondWithResult(_0x1f34cf,_0x2222e1){_0x2222e1=_0x2222e1||0xc8;return function(_0x1be731){if(_0x1be731){return _0x1f34cf[_0xa7ac('0x1d')](_0x2222e1)['json'](_0x1be731);}};}function respondWithFilteredResult(_0x93b49d,_0x39b5f4){return function(_0x32ace0){if(_0x32ace0){var _0x3c5cda=typeof _0x39b5f4[_0xa7ac('0x1f')]===_0xa7ac('0x20')&&typeof _0x39b5f4['limit']===_0xa7ac('0x20');var _0xe9159=_0x32ace0[_0xa7ac('0x21')];var _0x51db57=_0x3c5cda?0x0:_0x39b5f4['offset'];var _0x55a5d5=_0x3c5cda?_0x32ace0[_0xa7ac('0x21')]:_0x39b5f4['offset']+_0x39b5f4[_0xa7ac('0x22')];var _0x2007f7;if(_0x55a5d5>=_0xe9159){_0x55a5d5=_0xe9159;_0x2007f7=0xc8;}else{_0x2007f7=0xce;}_0x93b49d[_0xa7ac('0x1d')](_0x2007f7);return _0x93b49d[_0xa7ac('0x23')]('Content-Range',_0x51db57+'-'+_0x55a5d5+'/'+_0xe9159)['json'](_0x32ace0);}return null;};}function patchUpdates(_0xfff5b0){return function(_0x167fa0){try{jsonpatch[_0xa7ac('0x24')](_0x167fa0,_0xfff5b0,!![]);}catch(_0x380cea){return BPromise[_0xa7ac('0x25')](_0x380cea);}return _0x167fa0['save']();};}function saveUpdates(_0x42fbe5,_0x24b882){return function(_0x4e73d3){if(_0x4e73d3){return _0x4e73d3['update'](_0x42fbe5)[_0xa7ac('0x26')](function(_0xc2a332){return _0xc2a332;});}return null;};}function removeEntity(_0x33f165,_0x264942){return function(_0x9c9f26){if(_0x9c9f26){return _0x9c9f26[_0xa7ac('0x27')]()['then'](function(){_0x33f165[_0xa7ac('0x1d')](0xcc)[_0xa7ac('0x1e')]();});}};}function handleEntityNotFound(_0x21e8fb,_0x567398){return function(_0x394ff6){if(!_0x394ff6){_0x21e8fb[_0xa7ac('0x28')](0x194);}return _0x394ff6;};}function handleError(_0x3e4c02,_0x1c3422){_0x1c3422=_0x1c3422||0x1f4;return function(_0x4380a9){logger[_0xa7ac('0x29')](_0x4380a9[_0xa7ac('0x2a')]);if(_0x4380a9['name']){delete _0x4380a9[_0xa7ac('0x2b')];}_0x3e4c02[_0xa7ac('0x1d')](_0x1c3422)[_0xa7ac('0x2c')](_0x4380a9);};}exports[_0xa7ac('0x2d')]=function(_0x266841,_0x38e3bd){var _0x4bb081={},_0x107368={},_0x440a5b={'count':0x0,'rows':[]};var _0x1f375b=_[_0xa7ac('0x2e')](db[_0xa7ac('0x2f')]['rawAttributes'],function(_0x428339){return{'name':_0x428339[_0xa7ac('0x30')],'type':_0x428339[_0xa7ac('0x31')][_0xa7ac('0x32')]};});_0x107368[_0xa7ac('0x33')]=_[_0xa7ac('0x2e')](_0x1f375b,_0xa7ac('0x2b'));_0x107368[_0xa7ac('0x34')]=_[_0xa7ac('0x35')](_0x266841[_0xa7ac('0x34')]);_0x107368['filters']=_[_0xa7ac('0x36')](_0x107368[_0xa7ac('0x33')],_0x107368[_0xa7ac('0x34')]);_0x4bb081[_0xa7ac('0x37')]=_[_0xa7ac('0x36')](_0x107368[_0xa7ac('0x33')],qs[_0xa7ac('0x38')](_0x266841[_0xa7ac('0x34')][_0xa7ac('0x38')]));_0x4bb081[_0xa7ac('0x37')]=_0x4bb081['attributes'][_0xa7ac('0x39')]?_0x4bb081['attributes']:_0x107368[_0xa7ac('0x33')];if(!_0x266841[_0xa7ac('0x34')][_0xa7ac('0x3a')](_0xa7ac('0x3b'))){_0x4bb081[_0xa7ac('0x22')]=qs[_0xa7ac('0x22')](_0x266841['query'][_0xa7ac('0x22')]);_0x4bb081[_0xa7ac('0x1f')]=qs[_0xa7ac('0x1f')](_0x266841['query'][_0xa7ac('0x1f')]);}_0x4bb081[_0xa7ac('0x3c')]=qs[_0xa7ac('0x3d')](_0x266841[_0xa7ac('0x34')][_0xa7ac('0x3d')]);_0x4bb081[_0xa7ac('0x3e')]=qs[_0xa7ac('0x3f')](_[_0xa7ac('0x40')](_0x266841[_0xa7ac('0x34')],_0x107368[_0xa7ac('0x3f')]),_0x1f375b);if(_0x266841[_0xa7ac('0x34')][_0xa7ac('0x41')]){_0x4bb081[_0xa7ac('0x3e')]=_[_0xa7ac('0x42')](_0x4bb081['where'],{'$or':_[_0xa7ac('0x2e')](_0x1f375b,function(_0x55c22f){if(_0x55c22f[_0xa7ac('0x31')]!==_0xa7ac('0x43')){var _0x1f2f08={};_0x1f2f08[_0x55c22f[_0xa7ac('0x2b')]]={'$like':'%'+_0x266841[_0xa7ac('0x34')][_0xa7ac('0x41')]+'%'};return _0x1f2f08;}})});}_0x4bb081=_[_0xa7ac('0x42')]({},_0x4bb081,_0x266841['options']);var _0x1965f7={'where':_0x4bb081['where']};return db[_0xa7ac('0x2f')][_0xa7ac('0x21')](_0x1965f7)[_0xa7ac('0x26')](function(_0x47abfe){_0x440a5b['count']=_0x47abfe;if(_0x266841[_0xa7ac('0x34')]['includeAll']){_0x4bb081['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa7ac('0x44')](_0x4bb081);})[_0xa7ac('0x26')](function(_0x23ad46){_0x440a5b['rows']=_0x23ad46;return _0x440a5b;})['then'](respondWithFilteredResult(_0x38e3bd,_0x4bb081))[_0xa7ac('0x45')](handleError(_0x38e3bd,null));};exports[_0xa7ac('0x46')]=function(_0x55b8a2,_0x5cb382){var _0x3f65ff={'raw':![],'where':{'id':_0x55b8a2['params']['id']}},_0x352373={};_0x352373[_0xa7ac('0x33')]=_['keys'](db['VoiceQueueReport'][_0xa7ac('0x47')]);_0x352373[_0xa7ac('0x34')]=_[_0xa7ac('0x35')](_0x55b8a2[_0xa7ac('0x34')]);_0x352373['filters']=_['intersection'](_0x352373['model'],_0x352373['query']);_0x3f65ff[_0xa7ac('0x37')]=_[_0xa7ac('0x36')](_0x352373[_0xa7ac('0x33')],qs['fields'](_0x55b8a2[_0xa7ac('0x34')][_0xa7ac('0x38')]));_0x3f65ff['attributes']=_0x3f65ff[_0xa7ac('0x37')][_0xa7ac('0x39')]?_0x3f65ff[_0xa7ac('0x37')]:_0x352373[_0xa7ac('0x33')];if(_0x55b8a2[_0xa7ac('0x34')]['includeAll']){_0x3f65ff[_0xa7ac('0x48')]=[{'all':!![]}];}_0x3f65ff=_[_0xa7ac('0x42')]({},_0x3f65ff,_0x55b8a2[_0xa7ac('0x49')]);return db[_0xa7ac('0x2f')][_0xa7ac('0x4a')](_0x3f65ff)[_0xa7ac('0x26')](handleEntityNotFound(_0x5cb382,null))[_0xa7ac('0x26')](respondWithResult(_0x5cb382,null))[_0xa7ac('0x45')](handleError(_0x5cb382,null));};exports[_0xa7ac('0x4b')]=function(_0x26bb0c,_0x443631){return db[_0xa7ac('0x2f')][_0xa7ac('0x4b')](_0x26bb0c[_0xa7ac('0x4c')],{})['then'](respondWithResult(_0x443631,0xc9))['catch'](handleError(_0x443631,null));};exports[_0xa7ac('0x4d')]=function(_0x199410,_0x2c2316){if(_0x199410[_0xa7ac('0x4c')]['id']){delete _0x199410['body']['id'];}return db[_0xa7ac('0x2f')][_0xa7ac('0x4a')]({'where':{'id':_0x199410[_0xa7ac('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c2316,null))[_0xa7ac('0x26')](saveUpdates(_0x199410[_0xa7ac('0x4c')],null))[_0xa7ac('0x26')](respondWithResult(_0x2c2316,null))[_0xa7ac('0x45')](handleError(_0x2c2316,null));};exports['destroy']=function(_0x22cd57,_0x53efb5){return db[_0xa7ac('0x2f')][_0xa7ac('0x4a')]({'where':{'id':_0x22cd57[_0xa7ac('0x4e')]['id']}})[_0xa7ac('0x26')](handleEntityNotFound(_0x53efb5,null))['then'](removeEntity(_0x53efb5,null))[_0xa7ac('0x45')](handleError(_0x53efb5,null));};exports[_0xa7ac('0x4f')]=function(_0x1c067d,_0x53f9dd){return db[_0xa7ac('0x2f')][_0xa7ac('0x4f')]()[_0xa7ac('0x26')](respondWithResult(_0x53f9dd,null))[_0xa7ac('0x45')](handleError(_0x53f9dd,null));};exports[_0xa7ac('0x50')]=function(_0x100cfc,_0x4eea91){var _0x1b1c46={},_0x2fe2de={},_0x275428={'count':0x0,'rows':[]};_0x2fe2de[_0xa7ac('0x33')]=_[_0xa7ac('0x35')](db[_0xa7ac('0x2f')][_0xa7ac('0x47')]);_0x2fe2de[_0xa7ac('0x34')]=_[_0xa7ac('0x35')](_0x100cfc['query']);_0x2fe2de[_0xa7ac('0x3f')]=_['intersection'](_0x2fe2de[_0xa7ac('0x33')],_0x2fe2de['query']);_0x1b1c46[_0xa7ac('0x37')]=_[_0xa7ac('0x36')](_0x2fe2de[_0xa7ac('0x33')],qs[_0xa7ac('0x38')](_0x100cfc[_0xa7ac('0x34')][_0xa7ac('0x38')]));_0x1b1c46[_0xa7ac('0x37')]=_0x1b1c46['attributes'][_0xa7ac('0x39')]?_0x1b1c46[_0xa7ac('0x37')]:_0x2fe2de[_0xa7ac('0x33')];if(!_0x100cfc['query'][_0xa7ac('0x3a')](_0xa7ac('0x3b'))){_0x1b1c46[_0xa7ac('0x22')]=qs[_0xa7ac('0x22')](_0x100cfc[_0xa7ac('0x34')][_0xa7ac('0x22')]);_0x1b1c46[_0xa7ac('0x1f')]=qs[_0xa7ac('0x1f')](_0x100cfc[_0xa7ac('0x34')][_0xa7ac('0x1f')]);}_0x1b1c46[_0xa7ac('0x3c')]=qs['sort'](_0x100cfc['query'][_0xa7ac('0x3d')]);_0x1b1c46['where']=qs['filters'](_[_0xa7ac('0x40')](_0x100cfc[_0xa7ac('0x34')],_0x2fe2de['filters']));if(_0x100cfc[_0xa7ac('0x34')][_0xa7ac('0x41')]){_0x1b1c46[_0xa7ac('0x3e')]=_['merge'](_0x1b1c46[_0xa7ac('0x3e')],{'$or':_[_0xa7ac('0x2e')](_0x1b1c46[_0xa7ac('0x37')],function(_0x50764f){var _0x424cba={};_0x424cba[_0x50764f]={'$like':'%'+_0x100cfc[_0xa7ac('0x34')]['filter']+'%'};return _0x424cba;})});}_0x1b1c46=_['merge']({},_0x1b1c46,_0x100cfc[_0xa7ac('0x49')]);var _0xf2a37c={'where':_0x1b1c46[_0xa7ac('0x3e')]};return db[_0xa7ac('0x2f')][_0xa7ac('0x21')](_0xf2a37c)[_0xa7ac('0x26')](function(_0x3b46c6){_0x275428[_0xa7ac('0x21')]=_0x3b46c6;if(_0x100cfc[_0xa7ac('0x34')][_0xa7ac('0x51')]){_0x1b1c46['include']=[{'all':!![]}];}return db[_0xa7ac('0x2f')][_0xa7ac('0x44')](_0x1b1c46);})[_0xa7ac('0x26')](function(_0x2d08e8){_0x275428['rows']=_0x2d08e8;return _0x275428;})['then'](respondWithFilteredResult(_0x4eea91,_0x1b1c46,_0xa7ac('0x50')))[_0xa7ac('0x45')](handleError(_0x4eea91,null,_0xa7ac('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 96b4535..eeda302 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 _0x6c12=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x110e45,_0x33b34f){var _0x2f2dc7=function(_0x16dae0){while(--_0x16dae0){_0x110e45['push'](_0x110e45['shift']());}};_0x2f2dc7(++_0x33b34f);}(_0x6c12,0x17c));var _0x26c1=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x6c12[_0x11deef];return _0xe9ba85;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x26c1('0x0'))['db'][_0x26c1('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x26c1('0x2')](0x0);var events={'afterCreate':_0x26c1('0x3'),'afterUpdate':_0x26c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x61dc0d){return function(_0x567355,_0x998033,_0x2472ce){VoiceQueueReportEvents['emit'](_0x61dc0d+':'+_0x567355['id'],_0x567355);VoiceQueueReportEvents[_0x26c1('0x5')](_0x61dc0d,_0x567355);_0x2472ce(null);};}for(var e in events){if(events[_0x26c1('0x6')](e)){var event=events[e];VoiceQueueReport[_0x26c1('0x7')](e,emitEvent(event));}}module[_0x26c1('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe83e=['hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xe83e,0x7a));var _0xee83=function(_0x3f833e,_0x33f97d){_0x3f833e=_0x3f833e-0x0;var _0x58d70b=_0xe83e[_0x3f833e];return _0x58d70b;};'use strict';var EventEmitter=require(_0xee83('0x0'));var VoiceQueueReport=require(_0xee83('0x1'))['db'][_0xee83('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xee83('0x3')](0x0);var events={'afterCreate':_0xee83('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d4d96){return function(_0x3dcec7,_0x10a536,_0x3e03a3){VoiceQueueReportEvents[_0xee83('0x5')](_0x3d4d96+':'+_0x3dcec7['id'],_0x3dcec7);VoiceQueueReportEvents[_0xee83('0x5')](_0x3d4d96,_0x3dcec7);_0x3e03a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xee83('0x6')](e,emitEvent(event));}}module[_0xee83('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2107abf..72e210e 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 _0x0ab2=['./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','../../config/logger','moment','bluebird','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0ab2,0x92));var _0x20ab=function(_0x246e50,_0x33c7c4){_0x246e50=_0x246e50-0x0;var _0x915b44=_0x0ab2[_0x246e50];return _0x915b44;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20ab('0x0'))('api');var moment=require(_0x20ab('0x1'));var BPromise=require(_0x20ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x20ab('0x3'));var config=require('../../config/environment');var attributes=require(_0x20ab('0x4'));module['exports']=function(_0x44fdb2,_0x259548){return _0x44fdb2[_0x20ab('0x5')](_0x20ab('0x6'),attributes,{'tableName':_0x20ab('0x7'),'paranoid':![],'indexes':[{'fields':[_0x20ab('0x8')]},{'fields':[_0x20ab('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7fc=['path','rimraf','../../config/environment','exports','report_queue','calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe7fc,0xf6));var _0xce7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe7fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce7f('0x0'));var util=require('util');var logger=require(_0xce7f('0x1'))(_0xce7f('0x2'));var moment=require(_0xce7f('0x3'));var BPromise=require(_0xce7f('0x4'));var rp=require(_0xce7f('0x5'));var fs=require('fs');var path=require(_0xce7f('0x6'));var rimraf=require(_0xce7f('0x7'));var config=require(_0xce7f('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xce7f('0x9')]=function(_0x5c571e,_0x994acf){return _0x5c571e['define']('VoiceQueueReport',attributes,{'tableName':_0xce7f('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xce7f('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 bc957c5..364e181 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 _0xcee5=['body','catch','update','UpdateVoiceQueueReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create'];(function(_0x1973a3,_0x53bee8){var _0x229ecf=function(_0x4aa302){while(--_0x4aa302){_0x1973a3['push'](_0x1973a3['shift']());}};_0x229ecf(++_0x53bee8);}(_0xcee5,0x199));var _0x5cee=function(_0x402b61,_0x358e7d){_0x402b61=_0x402b61-0x0;var _0x3c91c9=_0xcee5[_0x402b61];return _0x3c91c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5cee('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cee('0x1'));var db=require(_0x5cee('0x2'))['db'];var utils=require(_0x5cee('0x3'));var logger=require(_0x5cee('0x4'))(_0x5cee('0x5'));var config=require(_0x5cee('0x6'));var jayson=require(_0x5cee('0x7'));var client=jayson[_0x5cee('0x8')][_0x5cee('0x9')]({'port':0x232a});config[_0x5cee('0xa')]=_[_0x5cee('0xb')](config[_0x5cee('0xa')],{'host':_0x5cee('0xc'),'port':0x18eb});var socket=require(_0x5cee('0xd'))(new Redis(config[_0x5cee('0xa')]));require(_0x5cee('0xe'))[_0x5cee('0xf')](socket);function respondWithRpcPromise(_0x2da805,_0x498d08,_0x2c7892){return new BPromise(function(_0x3faf1d,_0xe672fc){return client[_0x5cee('0x10')](_0x2da805,_0x2c7892)[_0x5cee('0x11')](function(_0x1c3654){logger[_0x5cee('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x498d08,_0x5cee('0x13'));logger[_0x5cee('0x14')](_0x5cee('0x15'),_0x498d08,_0x5cee('0x13'),JSON[_0x5cee('0x16')](_0x1c3654));if(_0x1c3654[_0x5cee('0x17')]){if(_0x1c3654[_0x5cee('0x17')][_0x5cee('0x18')]===0x1f4){logger[_0x5cee('0x17')](_0x5cee('0x19'),_0x498d08,_0x1c3654[_0x5cee('0x17')][_0x5cee('0x1a')]);return _0xe672fc(_0x1c3654[_0x5cee('0x17')][_0x5cee('0x1a')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x498d08,_0x1c3654[_0x5cee('0x17')]['message']);return _0x3faf1d(_0x1c3654[_0x5cee('0x17')][_0x5cee('0x1a')]);}else{logger['info'](_0x5cee('0x19'),_0x498d08,'request\x20sent');_0x3faf1d(_0x1c3654[_0x5cee('0x1b')][_0x5cee('0x1a')]);}})['catch'](function(_0x232f19){logger['error'](_0x5cee('0x19'),_0x498d08,_0x232f19);_0xe672fc(_0x232f19);});});}exports['GetVoiceQueueReport']=function(_0x389c68){var _0xbfc5cb=this;return new Promise(function(_0x201c41,_0x2245d0){return db[_0x5cee('0x1c')][_0x5cee('0x1d')]({'raw':_0x389c68[_0x5cee('0x1e')]?_0x389c68['options'][_0x5cee('0x1f')]===undefined?!![]:![]:!![],'where':_0x389c68[_0x5cee('0x1e')]?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x20')]||null:null,'attributes':_0x389c68[_0x5cee('0x1e')]?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x21')]||null:null,'limit':_0x389c68['options']?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x22')]||null:null,'include':_0x389c68[_0x5cee('0x1e')]?_0x389c68[_0x5cee('0x1e')][_0x5cee('0x23')]?_[_0x5cee('0x24')](_0x389c68['options'][_0x5cee('0x23')],function(_0x36ec6a){return{'model':db[_0x36ec6a['model']],'as':_0x36ec6a['as'],'attributes':_0x36ec6a['attributes'],'include':_0x36ec6a[_0x5cee('0x23')]?_[_0x5cee('0x24')](_0x36ec6a[_0x5cee('0x23')],function(_0x302a04){return{'model':db[_0x302a04[_0x5cee('0x25')]],'as':_0x302a04['as'],'attributes':_0x302a04['attributes'],'include':_0x302a04['include']?_[_0x5cee('0x24')](_0x302a04[_0x5cee('0x23')],function(_0x2b5b74){return{'model':db[_0x2b5b74[_0x5cee('0x25')]],'as':_0x2b5b74['as'],'attributes':_0x2b5b74[_0x5cee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5cee('0x11')](function(_0x513a9b){logger[_0x5cee('0x12')](_0x5cee('0x26'),_0x389c68);logger[_0x5cee('0x14')]('GetVoiceQueueReport',_0x389c68,JSON['stringify'](_0x513a9b));_0x201c41(_0x513a9b);})['catch'](function(_0x37de79){logger['error'](_0x5cee('0x26'),_0x37de79[_0x5cee('0x1a')],_0x389c68);_0x2245d0(_0xbfc5cb[_0x5cee('0x17')](0x1f4,_0x37de79[_0x5cee('0x1a')]));});});};exports[_0x5cee('0x27')]=function(_0x4253aa){var _0x14c8a6=this;return new Promise(function(_0x94e20f,_0x19ea7c){return db[_0x5cee('0x1c')][_0x5cee('0x28')](_0x4253aa[_0x5cee('0x29')],{'raw':_0x4253aa[_0x5cee('0x1e')]?_0x4253aa['options'][_0x5cee('0x1f')]===undefined?!![]:![]:!![]})[_0x5cee('0x11')](function(_0x1015fb){logger[_0x5cee('0x12')](_0x5cee('0x27'),_0x4253aa);logger['debug'](_0x5cee('0x27'),_0x4253aa,JSON[_0x5cee('0x16')](_0x1015fb));_0x94e20f(_0x1015fb);})[_0x5cee('0x2a')](function(_0x3a3c19){logger[_0x5cee('0x17')](_0x5cee('0x27'),_0x3a3c19[_0x5cee('0x1a')],_0x4253aa);_0x19ea7c(_0x14c8a6['error'](0x1f4,_0x3a3c19[_0x5cee('0x1a')]));});});};exports['UpdateVoiceQueueReport']=function(_0x13935a){var _0xf0605d=this;return new Promise(function(_0xfeae8e,_0x40a64f){return db[_0x5cee('0x1c')][_0x5cee('0x2b')](_0x13935a[_0x5cee('0x29')],{'raw':_0x13935a['options']?_0x13935a[_0x5cee('0x1e')][_0x5cee('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13935a[_0x5cee('0x1e')]?_0x13935a[_0x5cee('0x1e')]['where']||null:null,'attributes':_0x13935a[_0x5cee('0x1e')]?_0x13935a[_0x5cee('0x1e')][_0x5cee('0x21')]||null:null,'limit':_0x13935a[_0x5cee('0x1e')]?_0x13935a[_0x5cee('0x1e')][_0x5cee('0x22')]||null:null})['then'](function(_0x2c7e62){logger[_0x5cee('0x12')](_0x5cee('0x2c'),_0x13935a);logger[_0x5cee('0x14')](_0x5cee('0x2c'),_0x13935a,JSON[_0x5cee('0x16')](_0x2c7e62));_0xfeae8e(_0x2c7e62);})['catch'](function(_0x59ae8f){logger[_0x5cee('0x17')](_0x5cee('0x2c'),_0x59ae8f[_0x5cee('0x1a')],_0x13935a);_0x40a64f(_0xf0605d[_0x5cee('0x17')](0x1f4,_0x59ae8f[_0x5cee('0x1a')]));});});}; \ No newline at end of file +var _0xf039=['result','GetVoiceQueueReport','VoiceQueueReport','options','raw','attributes','limit','include','map','model','info','debug','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xf039,0x91));var _0x9f03=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0xf039[_0x2b8722];return _0x20c180;};'use strict';var _=require(_0x9f03('0x0'));var util=require(_0x9f03('0x1'));var moment=require(_0x9f03('0x2'));var BPromise=require(_0x9f03('0x3'));var rs=require(_0x9f03('0x4'));var fs=require('fs');var Redis=require(_0x9f03('0x5'));var db=require(_0x9f03('0x6'))['db'];var utils=require(_0x9f03('0x7'));var logger=require(_0x9f03('0x8'))(_0x9f03('0x9'));var config=require(_0x9f03('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9f03('0xb')]=_['defaults'](config[_0x9f03('0xb')],{'host':_0x9f03('0xc'),'port':0x18eb});var socket=require(_0x9f03('0xd'))(new Redis(config[_0x9f03('0xb')]));require(_0x9f03('0xe'))[_0x9f03('0xf')](socket);function respondWithRpcPromise(_0x5e6cd4,_0x3f9702,_0x8aff5e){return new BPromise(function(_0x3de9fe,_0x3bacea){return client['request'](_0x5e6cd4,_0x8aff5e)[_0x9f03('0x10')](function(_0x2a57d7){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x3f9702,_0x9f03('0x11'));logger['debug'](_0x9f03('0x12'),_0x3f9702,'request\x20sent',JSON[_0x9f03('0x13')](_0x2a57d7));if(_0x2a57d7[_0x9f03('0x14')]){if(_0x2a57d7[_0x9f03('0x14')]['code']===0x1f4){logger[_0x9f03('0x14')](_0x9f03('0x15'),_0x3f9702,_0x2a57d7[_0x9f03('0x14')]['message']);return _0x3bacea(_0x2a57d7[_0x9f03('0x14')]['message']);}logger[_0x9f03('0x14')](_0x9f03('0x15'),_0x3f9702,_0x2a57d7[_0x9f03('0x14')][_0x9f03('0x16')]);return _0x3de9fe(_0x2a57d7[_0x9f03('0x14')][_0x9f03('0x16')]);}else{logger['info'](_0x9f03('0x15'),_0x3f9702,_0x9f03('0x11'));_0x3de9fe(_0x2a57d7[_0x9f03('0x17')]['message']);}})['catch'](function(_0x114133){logger['error'](_0x9f03('0x15'),_0x3f9702,_0x114133);_0x3bacea(_0x114133);});});}exports[_0x9f03('0x18')]=function(_0x175383){var _0x25adf1=this;return new Promise(function(_0x547409,_0x1f0a75){return db[_0x9f03('0x19')]['findAll']({'raw':_0x175383[_0x9f03('0x1a')]?_0x175383[_0x9f03('0x1a')][_0x9f03('0x1b')]===undefined?!![]:![]:!![],'where':_0x175383[_0x9f03('0x1a')]?_0x175383[_0x9f03('0x1a')]['where']||null:null,'attributes':_0x175383[_0x9f03('0x1a')]?_0x175383[_0x9f03('0x1a')][_0x9f03('0x1c')]||null:null,'limit':_0x175383[_0x9f03('0x1a')]?_0x175383[_0x9f03('0x1a')][_0x9f03('0x1d')]||null:null,'include':_0x175383['options']?_0x175383[_0x9f03('0x1a')][_0x9f03('0x1e')]?_[_0x9f03('0x1f')](_0x175383[_0x9f03('0x1a')][_0x9f03('0x1e')],function(_0x56cba0){return{'model':db[_0x56cba0[_0x9f03('0x20')]],'as':_0x56cba0['as'],'attributes':_0x56cba0[_0x9f03('0x1c')],'include':_0x56cba0[_0x9f03('0x1e')]?_[_0x9f03('0x1f')](_0x56cba0['include'],function(_0x3a7ea7){return{'model':db[_0x3a7ea7['model']],'as':_0x3a7ea7['as'],'attributes':_0x3a7ea7[_0x9f03('0x1c')],'include':_0x3a7ea7[_0x9f03('0x1e')]?_[_0x9f03('0x1f')](_0x3a7ea7['include'],function(_0x381942){return{'model':db[_0x381942[_0x9f03('0x20')]],'as':_0x381942['as'],'attributes':_0x381942[_0x9f03('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da540){logger[_0x9f03('0x21')]('GetVoiceQueueReport',_0x175383);logger[_0x9f03('0x22')](_0x9f03('0x18'),_0x175383,JSON[_0x9f03('0x13')](_0x1da540));_0x547409(_0x1da540);})[_0x9f03('0x23')](function(_0x5e06f9){logger[_0x9f03('0x14')](_0x9f03('0x18'),_0x5e06f9[_0x9f03('0x16')],_0x175383);_0x1f0a75(_0x25adf1['error'](0x1f4,_0x5e06f9['message']));});});};exports[_0x9f03('0x24')]=function(_0x1dc8b6){var _0x397b88=this;return new Promise(function(_0xd949dc,_0x30092d){return db[_0x9f03('0x19')][_0x9f03('0x25')](_0x1dc8b6[_0x9f03('0x26')],{'raw':_0x1dc8b6['options']?_0x1dc8b6['options'][_0x9f03('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22839f){logger[_0x9f03('0x21')](_0x9f03('0x24'),_0x1dc8b6);logger[_0x9f03('0x22')]('CreateVoiceQueueReport',_0x1dc8b6,JSON[_0x9f03('0x13')](_0x22839f));_0xd949dc(_0x22839f);})[_0x9f03('0x23')](function(_0xb3a17d){logger[_0x9f03('0x14')]('CreateVoiceQueueReport',_0xb3a17d[_0x9f03('0x16')],_0x1dc8b6);_0x30092d(_0x397b88[_0x9f03('0x14')](0x1f4,_0xb3a17d['message']));});});};exports[_0x9f03('0x27')]=function(_0x46829d){var _0x5d678c=this;return new Promise(function(_0x313c9a,_0x25a09a){return db[_0x9f03('0x19')][_0x9f03('0x28')](_0x46829d[_0x9f03('0x26')],{'raw':_0x46829d[_0x9f03('0x1a')]?_0x46829d[_0x9f03('0x1a')][_0x9f03('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46829d[_0x9f03('0x1a')]?_0x46829d['options'][_0x9f03('0x29')]||null:null,'attributes':_0x46829d[_0x9f03('0x1a')]?_0x46829d['options'][_0x9f03('0x1c')]||null:null,'limit':_0x46829d['options']?_0x46829d['options']['limit']||null:null})[_0x9f03('0x10')](function(_0x3931eb){logger[_0x9f03('0x21')](_0x9f03('0x27'),_0x46829d);logger['debug']('UpdateVoiceQueueReport',_0x46829d,JSON[_0x9f03('0x13')](_0x3931eb));_0x313c9a(_0x3931eb);})['catch'](function(_0x2a0417){logger[_0x9f03('0x14')]('UpdateVoiceQueueReport',_0x2a0417[_0x9f03('0x16')],_0x46829d);_0x25a09a(_0x5d678c[_0x9f03('0x14')](0x1f4,_0x2a0417[_0x9f03('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b95bda1..8479c3e 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 _0xfef2=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x42df51,_0x115daf){var _0x3fe434=function(_0x41dc0d){while(--_0x41dc0d){_0x42df51['push'](_0x42df51['shift']());}};_0x3fe434(++_0x115daf);}(_0xfef2,0x1e0));var _0x2fef=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0xfef2[_0xc1a4cf];return _0x2930d1;};'use strict';var VoiceQueueReportEvents=require(_0x2fef('0x0'));var events=[_0x2fef('0x1'),_0x2fef('0x2'),'update'];function createListener(_0x16c6fc,_0x30ff3d){return function(_0x36264c){_0x30ff3d[_0x2fef('0x3')](_0x16c6fc,_0x36264c);};}function removeListener(_0x5ac51f,_0x2fb0c2){return function(){VoiceQueueReportEvents['removeListener'](_0x5ac51f,_0x2fb0c2);};}exports[_0x2fef('0x4')]=function(_0x35c574){for(var _0x152f6d=0x0,_0x1b7c88=events[_0x2fef('0x5')];_0x152f6d<_0x1b7c88;_0x152f6d++){var _0x1e80f8=events[_0x152f6d];var _0x1b2d7e=createListener(_0x2fef('0x6')+_0x1e80f8,_0x35c574);VoiceQueueReportEvents['on'](_0x1e80f8,_0x1b2d7e);}}; \ No newline at end of file +var _0x9b2a=['length','./voiceQueueReport.events','remove','update','emit','removeListener','register'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x9b2a,0x127));var _0xa9b2=function(_0x3bfa52,_0x29b319){_0x3bfa52=_0x3bfa52-0x0;var _0xf08a3=_0x9b2a[_0x3bfa52];return _0xf08a3;};'use strict';var VoiceQueueReportEvents=require(_0xa9b2('0x0'));var events=['save',_0xa9b2('0x1'),_0xa9b2('0x2')];function createListener(_0x18ea12,_0x4c06c8){return function(_0x28dfe2){_0x4c06c8[_0xa9b2('0x3')](_0x18ea12,_0x28dfe2);};}function removeListener(_0x50f884,_0x524e4b){return function(){VoiceQueueReportEvents[_0xa9b2('0x4')](_0x50f884,_0x524e4b);};}exports[_0xa9b2('0x5')]=function(_0x181a8f){for(var _0xd7801e=0x0,_0x558267=events[_0xa9b2('0x6')];_0xd7801e<_0x558267;_0xd7801e++){var _0xce1b20=events[_0xd7801e];var _0x2d2560=createListener('voiceQueueReport:'+_0xce1b20,_0x181a8f);VoiceQueueReportEvents['on'](_0xce1b20,_0x2d2560);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 7c6b61d..68645ab 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 _0x6e8b=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b34ab,_0x4b2a3c){var _0x57adc9=function(_0x2b4f9d){while(--_0x2b4f9d){_0x2b34ab['push'](_0x2b34ab['shift']());}};_0x57adc9(++_0x4b2a3c);}(_0x6e8b,0x6a));var _0xb6e8=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x6e8b[_0x4c73ac];return _0x9839ee;};'use strict';var multer=require(_0xb6e8('0x0'));var util=require(_0xb6e8('0x1'));var path=require(_0xb6e8('0x2'));var timeout=require(_0xb6e8('0x3'));var express=require(_0xb6e8('0x4'));var router=express[_0xb6e8('0x5')]();var fs_extra=require(_0xb6e8('0x6'));var auth=require(_0xb6e8('0x7'));var interaction=require(_0xb6e8('0x8'));var config=require(_0xb6e8('0x9'));var controller=require(_0xb6e8('0xa'));router[_0xb6e8('0xb')]('/',auth[_0xb6e8('0xc')](),controller[_0xb6e8('0xd')]);router['get'](_0xb6e8('0xe'),auth[_0xb6e8('0xc')](),controller[_0xb6e8('0xf')]);router[_0xb6e8('0x10')]('/',auth[_0xb6e8('0xc')](),controller[_0xb6e8('0x11')]);router[_0xb6e8('0x12')](_0xb6e8('0xe'),auth['isAuthenticated'](),controller[_0xb6e8('0x13')]);router[_0xb6e8('0x14')]('/:id',auth[_0xb6e8('0xc')](),controller[_0xb6e8('0x15')]);module[_0xb6e8('0x16')]=router; \ No newline at end of file +var _0x6c2a=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x251fde,_0x384469){var _0x350af6=function(_0x15a6a3){while(--_0x15a6a3){_0x251fde['push'](_0x251fde['shift']());}};_0x350af6(++_0x384469);}(_0x6c2a,0x177));var _0xa6c2=function(_0x4b38f4,_0x97430c){_0x4b38f4=_0x4b38f4-0x0;var _0x529ae5=_0x6c2a[_0x4b38f4];return _0x529ae5;};'use strict';var multer=require(_0xa6c2('0x0'));var util=require(_0xa6c2('0x1'));var path=require(_0xa6c2('0x2'));var timeout=require(_0xa6c2('0x3'));var express=require(_0xa6c2('0x4'));var router=express['Router']();var fs_extra=require(_0xa6c2('0x5'));var auth=require(_0xa6c2('0x6'));var interaction=require(_0xa6c2('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0xa6c2('0x8')]('/',auth[_0xa6c2('0x9')](),controller[_0xa6c2('0xa')]);router[_0xa6c2('0x8')](_0xa6c2('0xb'),auth[_0xa6c2('0x9')](),controller[_0xa6c2('0xc')]);router[_0xa6c2('0xd')]('/',auth[_0xa6c2('0x9')](),controller[_0xa6c2('0xe')]);router[_0xa6c2('0xf')](_0xa6c2('0xb'),auth[_0xa6c2('0x9')](),controller[_0xa6c2('0x10')]);router[_0xa6c2('0x11')](_0xa6c2('0xb'),auth[_0xa6c2('0x9')](),controller[_0xa6c2('0x12')]);module[_0xa6c2('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b10f7d6..6ee8824 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 _0x3d74=['sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5a2803,_0x450308){var _0x14a7f5=function(_0x4bbc06){while(--_0x4bbc06){_0x5a2803['push'](_0x5a2803['shift']());}};_0x14a7f5(++_0x450308);}(_0x3d74,0x6c));var _0x43d7=function(_0x27ea86,_0x5a17b3){_0x27ea86=_0x27ea86-0x0;var _0x4a12fb=_0x3d74[_0x27ea86];return _0x4a12fb;};'use strict';var Sequelize=require(_0x43d7('0x0'));var moment=require(_0x43d7('0x1'));module[_0x43d7('0x2')]={'time':{'type':Sequelize[_0x43d7('0x3')]},'callid':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x43d7('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x43d7('0x5'))}}; \ No newline at end of file +var _0x73a8=['DATE','format','moment','STRING'];(function(_0x2b2e47,_0x354fb2){var _0x39d6f5=function(_0x155f0f){while(--_0x155f0f){_0x2b2e47['push'](_0x2b2e47['shift']());}};_0x39d6f5(++_0x354fb2);}(_0x73a8,0x12a));var _0x873a=function(_0x28d2d3,_0x3c9554){_0x28d2d3=_0x28d2d3-0x0;var _0x25e8e1=_0x73a8[_0x28d2d3];return _0x25e8e1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x873a('0x0'));module['exports']={'time':{'type':Sequelize[_0x873a('0x1')]},'callid':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x873a('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x873a('0x2')],'allowNull':![],'defaultValue':moment()[_0x873a('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c905c61..a8f1ecb 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 _0x7996=['api','../../config/utils','../../config/environment','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','VoiceQueuesLog','rows','catch','show','params','find','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x48598e,_0x34a606){var _0x11066f=function(_0xf35e97){while(--_0xf35e97){_0x48598e['push'](_0x48598e['shift']());}};_0x11066f(++_0x34a606);}(_0x7996,0xc4));var _0x6799=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x7996[_0x1f909a];return _0x543f16;};'use strict';var emlformat=require(_0x6799('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6799('0x1'));var jsonpatch=require(_0x6799('0x2'));var rp=require(_0x6799('0x3'));var moment=require(_0x6799('0x4'));var BPromise=require(_0x6799('0x5'));var Mustache=require(_0x6799('0x6'));var util=require(_0x6799('0x7'));var path=require(_0x6799('0x8'));var sox=require(_0x6799('0x9'));var csv=require(_0x6799('0xa'));var ejs=require(_0x6799('0xb'));var fs=require('fs');var fs_extra=require(_0x6799('0xc'));var _=require(_0x6799('0xd'));var squel=require(_0x6799('0xe'));var crypto=require(_0x6799('0xf'));var jsforce=require(_0x6799('0x10'));var deskjs=require(_0x6799('0x11'));var toCsv=require(_0x6799('0xa'));var querystring=require(_0x6799('0x12'));var Papa=require(_0x6799('0x13'));var Redis=require(_0x6799('0x14'));var authService=require(_0x6799('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6799('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6799('0x17'));var utils=require(_0x6799('0x18'));var config=require(_0x6799('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa5bf9c,_0x6ef23c){_0x6ef23c=_0x6ef23c||0xcc;return function(_0x4022fd){if(_0x4022fd){return _0xa5bf9c['sendStatus'](_0x6ef23c);}return _0xa5bf9c[_0x6799('0x1a')](_0x6ef23c)[_0x6799('0x1b')]();};}function respondWithResult(_0x55d1a0,_0x3c2832){_0x3c2832=_0x3c2832||0xc8;return function(_0x330284){if(_0x330284){return _0x55d1a0[_0x6799('0x1a')](_0x3c2832)['json'](_0x330284);}};}function respondWithFilteredResult(_0x204c46,_0x9ae1d5){return function(_0x503377){if(_0x503377){var _0x557cb0=typeof _0x9ae1d5[_0x6799('0x1c')]==='undefined'&&typeof _0x9ae1d5[_0x6799('0x1d')]===_0x6799('0x1e');var _0x3420ca=_0x503377[_0x6799('0x1f')];var _0x449358=_0x557cb0?0x0:_0x9ae1d5[_0x6799('0x1c')];var _0x237a69=_0x557cb0?_0x503377['count']:_0x9ae1d5['offset']+_0x9ae1d5[_0x6799('0x1d')];var _0x34950a;if(_0x237a69>=_0x3420ca){_0x237a69=_0x3420ca;_0x34950a=0xc8;}else{_0x34950a=0xce;}_0x204c46[_0x6799('0x1a')](_0x34950a);return _0x204c46[_0x6799('0x20')](_0x6799('0x21'),_0x449358+'-'+_0x237a69+'/'+_0x3420ca)[_0x6799('0x22')](_0x503377);}return null;};}function patchUpdates(_0xa89795){return function(_0x40e43b){try{jsonpatch['apply'](_0x40e43b,_0xa89795,!![]);}catch(_0x11e20b){return BPromise[_0x6799('0x23')](_0x11e20b);}return _0x40e43b[_0x6799('0x24')]();};}function saveUpdates(_0x2092bb,_0xb8647){return function(_0x3b56e4){if(_0x3b56e4){return _0x3b56e4[_0x6799('0x25')](_0x2092bb)[_0x6799('0x26')](function(_0x12d20){return _0x12d20;});}return null;};}function removeEntity(_0x5e3231,_0x2505c7){return function(_0x3aa712){if(_0x3aa712){return _0x3aa712[_0x6799('0x27')]()[_0x6799('0x26')](function(){_0x5e3231['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x455af4,_0x418444){return function(_0x4913a6){if(!_0x4913a6){_0x455af4[_0x6799('0x28')](0x194);}return _0x4913a6;};}function handleError(_0x50f2bf,_0x495aa5){_0x495aa5=_0x495aa5||0x1f4;return function(_0x4a644a){logger['error'](_0x4a644a[_0x6799('0x29')]);if(_0x4a644a['name']){delete _0x4a644a[_0x6799('0x2a')];}_0x50f2bf['status'](_0x495aa5)[_0x6799('0x2b')](_0x4a644a);};}exports[_0x6799('0x2c')]=function(_0x26f80c,_0xe2faea){var _0x4d1ebc={},_0x35f0b3={},_0x251cab={'count':0x0,'rows':[]};var _0x6334d6=_['map'](db['VoiceQueuesLog'][_0x6799('0x2d')],function(_0x3ea1ed){return{'name':_0x3ea1ed['fieldName'],'type':_0x3ea1ed['type']['key']};});_0x35f0b3['model']=_['map'](_0x6334d6,_0x6799('0x2a'));_0x35f0b3[_0x6799('0x2e')]=_[_0x6799('0x2f')](_0x26f80c[_0x6799('0x2e')]);_0x35f0b3[_0x6799('0x30')]=_['intersection'](_0x35f0b3['model'],_0x35f0b3[_0x6799('0x2e')]);_0x4d1ebc[_0x6799('0x31')]=_[_0x6799('0x32')](_0x35f0b3[_0x6799('0x33')],qs[_0x6799('0x34')](_0x26f80c['query'][_0x6799('0x34')]));_0x4d1ebc[_0x6799('0x31')]=_0x4d1ebc[_0x6799('0x31')][_0x6799('0x35')]?_0x4d1ebc['attributes']:_0x35f0b3[_0x6799('0x33')];if(!_0x26f80c[_0x6799('0x2e')][_0x6799('0x36')](_0x6799('0x37'))){_0x4d1ebc[_0x6799('0x1d')]=qs[_0x6799('0x1d')](_0x26f80c[_0x6799('0x2e')][_0x6799('0x1d')]);_0x4d1ebc[_0x6799('0x1c')]=qs[_0x6799('0x1c')](_0x26f80c[_0x6799('0x2e')][_0x6799('0x1c')]);}_0x4d1ebc[_0x6799('0x38')]=qs[_0x6799('0x39')](_0x26f80c[_0x6799('0x2e')][_0x6799('0x39')]);_0x4d1ebc[_0x6799('0x3a')]=qs[_0x6799('0x30')](_['pick'](_0x26f80c[_0x6799('0x2e')],_0x35f0b3[_0x6799('0x30')]),_0x6334d6);if(_0x26f80c[_0x6799('0x2e')][_0x6799('0x3b')]){_0x4d1ebc[_0x6799('0x3a')]=_['merge'](_0x4d1ebc[_0x6799('0x3a')],{'$or':_['map'](_0x6334d6,function(_0x1d93ab){if(_0x1d93ab[_0x6799('0x3c')]!==_0x6799('0x3d')){var _0xa96c8d={};_0xa96c8d[_0x1d93ab[_0x6799('0x2a')]]={'$like':'%'+_0x26f80c[_0x6799('0x2e')]['filter']+'%'};return _0xa96c8d;}})});}_0x4d1ebc=_[_0x6799('0x3e')]({},_0x4d1ebc,_0x26f80c[_0x6799('0x3f')]);var _0x51a483={'where':_0x4d1ebc[_0x6799('0x3a')]};return db['VoiceQueuesLog'][_0x6799('0x1f')](_0x51a483)['then'](function(_0x2d4928){_0x251cab['count']=_0x2d4928;if(_0x26f80c[_0x6799('0x2e')][_0x6799('0x40')]){_0x4d1ebc[_0x6799('0x41')]=[{'all':!![]}];}return db[_0x6799('0x42')]['findAll'](_0x4d1ebc);})['then'](function(_0x4d4ad8){_0x251cab[_0x6799('0x43')]=_0x4d4ad8;return _0x251cab;})[_0x6799('0x26')](respondWithFilteredResult(_0xe2faea,_0x4d1ebc))[_0x6799('0x44')](handleError(_0xe2faea,null));};exports[_0x6799('0x45')]=function(_0x4ee7eb,_0x2782ee){var _0x46a414={'raw':!![],'where':{'id':_0x4ee7eb[_0x6799('0x46')]['id']}},_0xccee03={};_0xccee03[_0x6799('0x33')]=_[_0x6799('0x2f')](db['VoiceQueuesLog'][_0x6799('0x2d')]);_0xccee03[_0x6799('0x2e')]=_[_0x6799('0x2f')](_0x4ee7eb[_0x6799('0x2e')]);_0xccee03[_0x6799('0x30')]=_[_0x6799('0x32')](_0xccee03[_0x6799('0x33')],_0xccee03[_0x6799('0x2e')]);_0x46a414[_0x6799('0x31')]=_['intersection'](_0xccee03[_0x6799('0x33')],qs[_0x6799('0x34')](_0x4ee7eb['query']['fields']));_0x46a414[_0x6799('0x31')]=_0x46a414[_0x6799('0x31')][_0x6799('0x35')]?_0x46a414[_0x6799('0x31')]:_0xccee03[_0x6799('0x33')];if(_0x4ee7eb[_0x6799('0x2e')][_0x6799('0x40')]){_0x46a414[_0x6799('0x41')]=[{'all':!![]}];}_0x46a414=_['merge']({},_0x46a414,_0x4ee7eb['options']);return db[_0x6799('0x42')][_0x6799('0x47')](_0x46a414)['then'](handleEntityNotFound(_0x2782ee,null))[_0x6799('0x26')](respondWithResult(_0x2782ee,null))[_0x6799('0x44')](handleError(_0x2782ee,null));};exports['create']=function(_0x2f0cda,_0x385818){return db['VoiceQueuesLog']['create'](_0x2f0cda[_0x6799('0x48')],{})[_0x6799('0x26')](respondWithResult(_0x385818,0xc9))[_0x6799('0x44')](handleError(_0x385818,null));};exports[_0x6799('0x25')]=function(_0x18fb2c,_0x38e226){if(_0x18fb2c[_0x6799('0x48')]['id']){delete _0x18fb2c['body']['id'];}return db['VoiceQueuesLog'][_0x6799('0x47')]({'where':{'id':_0x18fb2c[_0x6799('0x46')]['id']}})['then'](handleEntityNotFound(_0x38e226,null))[_0x6799('0x26')](saveUpdates(_0x18fb2c[_0x6799('0x48')],null))[_0x6799('0x26')](respondWithResult(_0x38e226,null))[_0x6799('0x44')](handleError(_0x38e226,null));};exports['destroy']=function(_0x1c0873,_0x50a0a3){return db[_0x6799('0x42')][_0x6799('0x47')]({'where':{'id':_0x1c0873[_0x6799('0x46')]['id']}})[_0x6799('0x26')](handleEntityNotFound(_0x50a0a3,null))['then'](removeEntity(_0x50a0a3,null))[_0x6799('0x44')](handleError(_0x50a0a3,null));}; \ No newline at end of file +var _0x1b2c=['send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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/utils','../../config/environment','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','name'];(function(_0x1f98f3,_0x49cbfa){var _0x1b5c81=function(_0x2a761e){while(--_0x2a761e){_0x1f98f3['push'](_0x1f98f3['shift']());}};_0x1b5c81(++_0x49cbfa);}(_0x1b2c,0xc0));var _0xc1b2=function(_0x241595,_0x11afec){_0x241595=_0x241595-0x0;var _0x22db6e=_0x1b2c[_0x241595];return _0x22db6e;};'use strict';var emlformat=require(_0xc1b2('0x0'));var rimraf=require(_0xc1b2('0x1'));var zipdir=require(_0xc1b2('0x2'));var jsonpatch=require(_0xc1b2('0x3'));var rp=require(_0xc1b2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc1b2('0x5'));var util=require('util');var path=require(_0xc1b2('0x6'));var sox=require(_0xc1b2('0x7'));var csv=require(_0xc1b2('0x8'));var ejs=require(_0xc1b2('0x9'));var fs=require('fs');var fs_extra=require(_0xc1b2('0xa'));var _=require(_0xc1b2('0xb'));var squel=require(_0xc1b2('0xc'));var crypto=require(_0xc1b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc1b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1b2('0xf'));var Papa=require(_0xc1b2('0x10'));var Redis=require(_0xc1b2('0x11'));var authService=require(_0xc1b2('0x12'));var qs=require(_0xc1b2('0x13'));var as=require(_0xc1b2('0x14'));var hardwareService=require(_0xc1b2('0x15'));var logger=require(_0xc1b2('0x16'))(_0xc1b2('0x17'));var utils=require(_0xc1b2('0x18'));var config=require(_0xc1b2('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1b2('0x1a'))['db'];function respondWithStatusCode(_0x5623f9,_0x5d9b4c){_0x5d9b4c=_0x5d9b4c||0xcc;return function(_0x127b59){if(_0x127b59){return _0x5623f9['sendStatus'](_0x5d9b4c);}return _0x5623f9[_0xc1b2('0x1b')](_0x5d9b4c)[_0xc1b2('0x1c')]();};}function respondWithResult(_0x4a5341,_0x30ba15){_0x30ba15=_0x30ba15||0xc8;return function(_0xabc9e4){if(_0xabc9e4){return _0x4a5341[_0xc1b2('0x1b')](_0x30ba15)[_0xc1b2('0x1d')](_0xabc9e4);}};}function respondWithFilteredResult(_0x5a6b95,_0x4cf9b7){return function(_0x19ea6f){if(_0x19ea6f){var _0x5b908d=typeof _0x4cf9b7[_0xc1b2('0x1e')]==='undefined'&&typeof _0x4cf9b7['limit']==='undefined';var _0x2ad298=_0x19ea6f[_0xc1b2('0x1f')];var _0xe5987=_0x5b908d?0x0:_0x4cf9b7[_0xc1b2('0x1e')];var _0xae710e=_0x5b908d?_0x19ea6f[_0xc1b2('0x1f')]:_0x4cf9b7[_0xc1b2('0x1e')]+_0x4cf9b7[_0xc1b2('0x20')];var _0x3096d7;if(_0xae710e>=_0x2ad298){_0xae710e=_0x2ad298;_0x3096d7=0xc8;}else{_0x3096d7=0xce;}_0x5a6b95['status'](_0x3096d7);return _0x5a6b95[_0xc1b2('0x21')](_0xc1b2('0x22'),_0xe5987+'-'+_0xae710e+'/'+_0x2ad298)[_0xc1b2('0x1d')](_0x19ea6f);}return null;};}function patchUpdates(_0x5505ad){return function(_0x2c363d){try{jsonpatch[_0xc1b2('0x23')](_0x2c363d,_0x5505ad,!![]);}catch(_0x5935c3){return BPromise['reject'](_0x5935c3);}return _0x2c363d[_0xc1b2('0x24')]();};}function saveUpdates(_0x2a26c1,_0x51073d){return function(_0x15da87){if(_0x15da87){return _0x15da87['update'](_0x2a26c1)[_0xc1b2('0x25')](function(_0x5ae789){return _0x5ae789;});}return null;};}function removeEntity(_0x5c20ff,_0x322e64){return function(_0x238a87){if(_0x238a87){return _0x238a87[_0xc1b2('0x26')]()[_0xc1b2('0x25')](function(){_0x5c20ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x486054,_0x1dfdec){return function(_0x7adac4){if(!_0x7adac4){_0x486054[_0xc1b2('0x27')](0x194);}return _0x7adac4;};}function handleError(_0xf3c99,_0x4062c7){_0x4062c7=_0x4062c7||0x1f4;return function(_0x1d00f2){logger[_0xc1b2('0x28')](_0x1d00f2['stack']);if(_0x1d00f2[_0xc1b2('0x29')]){delete _0x1d00f2[_0xc1b2('0x29')];}_0xf3c99[_0xc1b2('0x1b')](_0x4062c7)[_0xc1b2('0x2a')](_0x1d00f2);};}exports[_0xc1b2('0x2b')]=function(_0x43aeef,_0x18fc5c){var _0x503d02={},_0x227243={},_0x2fa8fb={'count':0x0,'rows':[]};var _0x3866a0=_['map'](db[_0xc1b2('0x2c')][_0xc1b2('0x2d')],function(_0x1d222c){return{'name':_0x1d222c[_0xc1b2('0x2e')],'type':_0x1d222c[_0xc1b2('0x2f')][_0xc1b2('0x30')]};});_0x227243[_0xc1b2('0x31')]=_[_0xc1b2('0x32')](_0x3866a0,_0xc1b2('0x29'));_0x227243[_0xc1b2('0x33')]=_[_0xc1b2('0x34')](_0x43aeef[_0xc1b2('0x33')]);_0x227243[_0xc1b2('0x35')]=_[_0xc1b2('0x36')](_0x227243[_0xc1b2('0x31')],_0x227243[_0xc1b2('0x33')]);_0x503d02[_0xc1b2('0x37')]=_[_0xc1b2('0x36')](_0x227243[_0xc1b2('0x31')],qs['fields'](_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x38')]));_0x503d02[_0xc1b2('0x37')]=_0x503d02[_0xc1b2('0x37')]['length']?_0x503d02[_0xc1b2('0x37')]:_0x227243[_0xc1b2('0x31')];if(!_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x39')](_0xc1b2('0x3a'))){_0x503d02[_0xc1b2('0x20')]=qs['limit'](_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x20')]);_0x503d02[_0xc1b2('0x1e')]=qs['offset'](_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x1e')]);}_0x503d02[_0xc1b2('0x3b')]=qs[_0xc1b2('0x3c')](_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x3c')]);_0x503d02[_0xc1b2('0x3d')]=qs[_0xc1b2('0x35')](_[_0xc1b2('0x3e')](_0x43aeef[_0xc1b2('0x33')],_0x227243['filters']),_0x3866a0);if(_0x43aeef[_0xc1b2('0x33')]['filter']){_0x503d02[_0xc1b2('0x3d')]=_['merge'](_0x503d02[_0xc1b2('0x3d')],{'$or':_[_0xc1b2('0x32')](_0x3866a0,function(_0x30c06c){if(_0x30c06c[_0xc1b2('0x2f')]!==_0xc1b2('0x3f')){var _0x2f275f={};_0x2f275f[_0x30c06c[_0xc1b2('0x29')]]={'$like':'%'+_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x40')]+'%'};return _0x2f275f;}})});}_0x503d02=_[_0xc1b2('0x41')]({},_0x503d02,_0x43aeef[_0xc1b2('0x42')]);var _0x54ed79={'where':_0x503d02[_0xc1b2('0x3d')]};return db[_0xc1b2('0x2c')]['count'](_0x54ed79)[_0xc1b2('0x25')](function(_0x3f7d0b){_0x2fa8fb[_0xc1b2('0x1f')]=_0x3f7d0b;if(_0x43aeef[_0xc1b2('0x33')][_0xc1b2('0x43')]){_0x503d02['include']=[{'all':!![]}];}return db[_0xc1b2('0x2c')][_0xc1b2('0x44')](_0x503d02);})[_0xc1b2('0x25')](function(_0x1eb039){_0x2fa8fb['rows']=_0x1eb039;return _0x2fa8fb;})[_0xc1b2('0x25')](respondWithFilteredResult(_0x18fc5c,_0x503d02))[_0xc1b2('0x45')](handleError(_0x18fc5c,null));};exports[_0xc1b2('0x46')]=function(_0x5c13a2,_0x5a9827){var _0x3eb666={'raw':!![],'where':{'id':_0x5c13a2[_0xc1b2('0x47')]['id']}},_0x264931={};_0x264931[_0xc1b2('0x31')]=_[_0xc1b2('0x34')](db[_0xc1b2('0x2c')][_0xc1b2('0x2d')]);_0x264931[_0xc1b2('0x33')]=_[_0xc1b2('0x34')](_0x5c13a2[_0xc1b2('0x33')]);_0x264931[_0xc1b2('0x35')]=_[_0xc1b2('0x36')](_0x264931[_0xc1b2('0x31')],_0x264931[_0xc1b2('0x33')]);_0x3eb666[_0xc1b2('0x37')]=_[_0xc1b2('0x36')](_0x264931[_0xc1b2('0x31')],qs['fields'](_0x5c13a2[_0xc1b2('0x33')]['fields']));_0x3eb666['attributes']=_0x3eb666[_0xc1b2('0x37')][_0xc1b2('0x48')]?_0x3eb666[_0xc1b2('0x37')]:_0x264931[_0xc1b2('0x31')];if(_0x5c13a2[_0xc1b2('0x33')][_0xc1b2('0x43')]){_0x3eb666[_0xc1b2('0x49')]=[{'all':!![]}];}_0x3eb666=_[_0xc1b2('0x41')]({},_0x3eb666,_0x5c13a2[_0xc1b2('0x42')]);return db[_0xc1b2('0x2c')][_0xc1b2('0x4a')](_0x3eb666)['then'](handleEntityNotFound(_0x5a9827,null))[_0xc1b2('0x25')](respondWithResult(_0x5a9827,null))[_0xc1b2('0x45')](handleError(_0x5a9827,null));};exports[_0xc1b2('0x4b')]=function(_0x554cf4,_0x5d90fb){return db[_0xc1b2('0x2c')][_0xc1b2('0x4b')](_0x554cf4[_0xc1b2('0x4c')],{})[_0xc1b2('0x25')](respondWithResult(_0x5d90fb,0xc9))[_0xc1b2('0x45')](handleError(_0x5d90fb,null));};exports[_0xc1b2('0x4d')]=function(_0xb37ee8,_0x353640){if(_0xb37ee8[_0xc1b2('0x4c')]['id']){delete _0xb37ee8[_0xc1b2('0x4c')]['id'];}return db['VoiceQueuesLog'][_0xc1b2('0x4a')]({'where':{'id':_0xb37ee8['params']['id']}})[_0xc1b2('0x25')](handleEntityNotFound(_0x353640,null))[_0xc1b2('0x25')](saveUpdates(_0xb37ee8['body'],null))['then'](respondWithResult(_0x353640,null))['catch'](handleError(_0x353640,null));};exports[_0xc1b2('0x26')]=function(_0x3487ef,_0x11d82e){return db[_0xc1b2('0x2c')][_0xc1b2('0x4a')]({'where':{'id':_0x3487ef[_0xc1b2('0x47')]['id']}})[_0xc1b2('0x25')](handleEntityNotFound(_0x11d82e,null))[_0xc1b2('0x25')](removeEntity(_0x11d82e,null))[_0xc1b2('0x45')](handleError(_0x11d82e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 761ce48..79a3915 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 _0xeb93=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util'];(function(_0x127cc1,_0x28f94e){var _0xe7ef98=function(_0xd21847){while(--_0xd21847){_0x127cc1['push'](_0x127cc1['shift']());}};_0xe7ef98(++_0x28f94e);}(_0xeb93,0x195));var _0x3eb9=function(_0x2bb787,_0x41bf02){_0x2bb787=_0x2bb787-0x0;var _0x425b33=_0xeb93[_0x2bb787];return _0x425b33;};'use strict';var _=require('lodash');var util=require(_0x3eb9('0x0'));var logger=require(_0x3eb9('0x1'))('api');var moment=require(_0x3eb9('0x2'));var BPromise=require(_0x3eb9('0x3'));var rp=require(_0x3eb9('0x4'));var fs=require('fs');var path=require(_0x3eb9('0x5'));var rimraf=require(_0x3eb9('0x6'));var config=require(_0x3eb9('0x7'));var attributes=require(_0x3eb9('0x8'));module['exports']=function(_0x4cb913,_0x223c44){return _0x4cb913[_0x3eb9('0x9')](_0x3eb9('0xa'),attributes,{'tableName':_0x3eb9('0xb'),'paranoid':![],'indexes':[{'name':_0x3eb9('0xc'),'fields':['event',_0x3eb9('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2e14=['./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','event','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42342b,_0x1c2993){var _0x3f60b8=function(_0x291a60){while(--_0x291a60){_0x42342b['push'](_0x42342b['shift']());}};_0x3f60b8(++_0x1c2993);}(_0x2e14,0xae));var _0x42e1=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0x2e14[_0x23ca3a];return _0x5c1aab;};'use strict';var _=require(_0x42e1('0x0'));var util=require(_0x42e1('0x1'));var logger=require('../../config/logger')(_0x42e1('0x2'));var moment=require('moment');var BPromise=require(_0x42e1('0x3'));var rp=require(_0x42e1('0x4'));var fs=require('fs');var path=require(_0x42e1('0x5'));var rimraf=require(_0x42e1('0x6'));var config=require(_0x42e1('0x7'));var attributes=require(_0x42e1('0x8'));module['exports']=function(_0xc604f,_0x42815d){return _0xc604f[_0x42e1('0x9')](_0x42e1('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x42e1('0xb'),'fields':[_0x42e1('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d385e76..b67fbee 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 _0xc540=['info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x241288,_0x3d6f94){var _0x4287d6=function(_0x2d972f){while(--_0x2d972f){_0x241288['push'](_0x241288['shift']());}};_0x4287d6(++_0x3d6f94);}(_0xc540,0x184));var _0x0c54=function(_0x514151,_0x46381b){_0x514151=_0x514151-0x0;var _0x3f69b2=_0xc540[_0x514151];return _0x3f69b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0c54('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c54('0x1'));var db=require(_0x0c54('0x2'))['db'];var utils=require(_0x0c54('0x3'));var logger=require(_0x0c54('0x4'))(_0x0c54('0x5'));var config=require('../../config/environment');var jayson=require(_0x0c54('0x6'));var client=jayson[_0x0c54('0x7')][_0x0c54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd1bfc5,_0x2eee8f,_0x90e1b0){return new BPromise(function(_0x4067ac,_0x32664a){return client[_0x0c54('0x9')](_0xd1bfc5,_0x90e1b0)[_0x0c54('0xa')](function(_0x10a76a){logger[_0x0c54('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2eee8f,_0x0c54('0xc'));logger['debug'](_0x0c54('0xd'),_0x2eee8f,_0x0c54('0xc'),JSON[_0x0c54('0xe')](_0x10a76a));if(_0x10a76a['error']){if(_0x10a76a['error'][_0x0c54('0xf')]===0x1f4){logger[_0x0c54('0x10')](_0x0c54('0x11'),_0x2eee8f,_0x10a76a[_0x0c54('0x10')][_0x0c54('0x12')]);return _0x32664a(_0x10a76a[_0x0c54('0x10')]['message']);}logger['error'](_0x0c54('0x11'),_0x2eee8f,_0x10a76a[_0x0c54('0x10')]['message']);return _0x4067ac(_0x10a76a['error'][_0x0c54('0x12')]);}else{logger[_0x0c54('0xb')](_0x0c54('0x11'),_0x2eee8f,_0x0c54('0xc'));_0x4067ac(_0x10a76a['result'][_0x0c54('0x12')]);}})['catch'](function(_0x10425a){logger[_0x0c54('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2eee8f,_0x10425a);_0x32664a(_0x10425a);});});} \ No newline at end of file +var _0xeca7=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','VoiceQueuesLog,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring'];(function(_0x258653,_0x46bf52){var _0x3df0e5=function(_0x3fb3ad){while(--_0x3fb3ad){_0x258653['push'](_0x258653['shift']());}};_0x3df0e5(++_0x46bf52);}(_0xeca7,0xba));var _0x7eca=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0xeca7[_0x40d078];return _0x46fc81;};'use strict';var _=require(_0x7eca('0x0'));var util=require(_0x7eca('0x1'));var moment=require(_0x7eca('0x2'));var BPromise=require('bluebird');var rs=require(_0x7eca('0x3'));var fs=require('fs');var Redis=require(_0x7eca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7eca('0x5'));var logger=require(_0x7eca('0x6'))('rpc');var config=require(_0x7eca('0x7'));var jayson=require(_0x7eca('0x8'));var client=jayson[_0x7eca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0553,_0x3abbd5,_0x61f0f3){return new BPromise(function(_0x55b57a,_0x3d794a){return client['request'](_0x1c0553,_0x61f0f3)['then'](function(_0x1e3ff2){logger['info'](_0x7eca('0xa'),_0x3abbd5,'request\x20sent');logger[_0x7eca('0xb')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3abbd5,'request\x20sent',JSON[_0x7eca('0xc')](_0x1e3ff2));if(_0x1e3ff2[_0x7eca('0xd')]){if(_0x1e3ff2[_0x7eca('0xd')]['code']===0x1f4){logger[_0x7eca('0xd')](_0x7eca('0xa'),_0x3abbd5,_0x1e3ff2['error']['message']);return _0x3d794a(_0x1e3ff2[_0x7eca('0xd')][_0x7eca('0xe')]);}logger[_0x7eca('0xd')](_0x7eca('0xa'),_0x3abbd5,_0x1e3ff2[_0x7eca('0xd')][_0x7eca('0xe')]);return _0x55b57a(_0x1e3ff2[_0x7eca('0xd')]['message']);}else{logger[_0x7eca('0xf')](_0x7eca('0xa'),_0x3abbd5,_0x7eca('0x10'));_0x55b57a(_0x1e3ff2[_0x7eca('0x11')][_0x7eca('0xe')]);}})[_0x7eca('0x12')](function(_0x357a93){logger[_0x7eca('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3abbd5,_0x357a93);_0x3d794a(_0x357a93);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 52dee73..2aa6754 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 _0x2eaa=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2eaa,0x192));var _0xa2ea=function(_0x1e48f0,_0x206c44){_0x1e48f0=_0x1e48f0-0x0;var _0x3cc81e=_0x2eaa[_0x1e48f0];return _0x3cc81e;};'use strict';var multer=require(_0xa2ea('0x0'));var util=require('util');var path=require(_0xa2ea('0x1'));var timeout=require(_0xa2ea('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa2ea('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0xa2ea('0x4')]('/',auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x6')]);router['get'](_0xa2ea('0x7'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x8')]);router[_0xa2ea('0x4')]('/:id',auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x9')]);router[_0xa2ea('0x4')](_0xa2ea('0xa'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0xb')]);router['get'](_0xa2ea('0xc'),controller[_0xa2ea('0xd')]);router[_0xa2ea('0x4')](_0xa2ea('0xe'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0xf')]);router[_0xa2ea('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa2ea('0x10')]('/:id/transcribe',auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x11')]);router[_0xa2ea('0x12')](_0xa2ea('0x13'),auth[_0xa2ea('0x5')](),controller[_0xa2ea('0x14')]);router[_0xa2ea('0x15')]('/:id',auth[_0xa2ea('0x5')](),controller['destroy']);module[_0xa2ea('0x16')]=router; \ No newline at end of file +var _0xfb9f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfb9f,0x108));var _0xffb9=function(_0x210b09,_0x43a0f2){_0x210b09=_0x210b09-0x0;var _0x579151=_0xfb9f[_0x210b09];return _0x579151;};'use strict';var multer=require(_0xffb9('0x0'));var util=require(_0xffb9('0x1'));var path=require(_0xffb9('0x2'));var timeout=require(_0xffb9('0x3'));var express=require(_0xffb9('0x4'));var router=express[_0xffb9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xffb9('0x6'));var interaction=require(_0xffb9('0x7'));var config=require(_0xffb9('0x8'));var controller=require(_0xffb9('0x9'));router[_0xffb9('0xa')]('/',auth[_0xffb9('0xb')](),controller[_0xffb9('0xc')]);router[_0xffb9('0xa')](_0xffb9('0xd'),auth['isAuthenticated'](),controller[_0xffb9('0xe')]);router[_0xffb9('0xa')](_0xffb9('0xf'),auth['isAuthenticated'](),controller[_0xffb9('0x10')]);router[_0xffb9('0xa')](_0xffb9('0x11'),auth['isAuthenticated'](),controller[_0xffb9('0x12')]);router[_0xffb9('0xa')](_0xffb9('0x13'),controller[_0xffb9('0x14')]);router['get'](_0xffb9('0x15'),auth[_0xffb9('0xb')](),controller[_0xffb9('0x16')]);router[_0xffb9('0x17')]('/',auth[_0xffb9('0xb')](),controller[_0xffb9('0x18')]);router['post'](_0xffb9('0x15'),auth['isAuthenticated'](),controller[_0xffb9('0x19')]);router[_0xffb9('0x1a')](_0xffb9('0xf'),auth['isAuthenticated'](),controller[_0xffb9('0x1b')]);router['delete'](_0xffb9('0xf'),auth[_0xffb9('0xb')](),controller[_0xffb9('0x1c')]);module[_0xffb9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a36ab1d..53181a9 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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 1d90ee6..d9ef3b5 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 _0xac8e=['root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceRecording','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','unlink','VoiceRecording\x20not\x20found','sequelize','MD5','col','$and','push','extname','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','listBuckets','createBucket','upload','startTranscriptionJob','readFileSync','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText'];(function(_0x2ff28d,_0x5d4d8a){var _0x5efbd9=function(_0x1118fc){while(--_0x1118fc){_0x2ff28d['push'](_0x2ff28d['shift']());}};_0x5efbd9(++_0x5d4d8a);}(_0xac8e,0x12a));var _0xeac8=function(_0x40ad4d,_0x35a2d4){_0x40ad4d=_0x40ad4d-0x0;var _0x425a49=_0xac8e[_0x40ad4d];return _0x425a49;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeac8('0x0'));var jsonpatch=require(_0xeac8('0x1'));var rp=require(_0xeac8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeac8('0x3'));var util=require(_0xeac8('0x4'));var path=require(_0xeac8('0x5'));var sox=require(_0xeac8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeac8('0x7'));var _=require('lodash');var squel=require(_0xeac8('0x8'));var crypto=require(_0xeac8('0x9'));var jsforce=require(_0xeac8('0xa'));var deskjs=require(_0xeac8('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeac8('0xc'));var Papa=require(_0xeac8('0xd'));var AWS=require(_0xeac8('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xeac8('0xf'));var authService=require(_0xeac8('0x10'));var qs=require(_0xeac8('0x11'));var as=require(_0xeac8('0x12'));var hardwareService=require(_0xeac8('0x13'));var logger=require(_0xeac8('0x14'))(_0xeac8('0x15'));var utils=require(_0xeac8('0x16'));var config=require(_0xeac8('0x17'));var licenseUtil=require(_0xeac8('0x18'));var db=require(_0xeac8('0x19'))['db'];function respondWithStatusCode(_0x65543b,_0x122f53){_0x122f53=_0x122f53||0xcc;return function(_0x1b2ae8){if(_0x1b2ae8){return _0x65543b['sendStatus'](_0x122f53);}return _0x65543b[_0xeac8('0x1a')](_0x122f53)[_0xeac8('0x1b')]();};}function respondWithResult(_0x86ae8e,_0x11bab8){_0x11bab8=_0x11bab8||0xc8;return function(_0x25d013){if(_0x25d013){return _0x86ae8e[_0xeac8('0x1a')](_0x11bab8)[_0xeac8('0x1c')](_0x25d013);}};}function respondWithFilteredResult(_0x404dc0,_0x45b5f1){return function(_0x3620fe){if(_0x3620fe){var _0x5c3831=typeof _0x45b5f1[_0xeac8('0x1d')]==='undefined'&&typeof _0x45b5f1['limit']===_0xeac8('0x1e');var _0x5b9db9=_0x3620fe['count'];var _0x24a889=_0x5c3831?0x0:_0x45b5f1['offset'];var _0x110053=_0x5c3831?_0x3620fe[_0xeac8('0x1f')]:_0x45b5f1['offset']+_0x45b5f1[_0xeac8('0x20')];var _0x2463f7;if(_0x110053>=_0x5b9db9){_0x110053=_0x5b9db9;_0x2463f7=0xc8;}else{_0x2463f7=0xce;}_0x404dc0[_0xeac8('0x1a')](_0x2463f7);return _0x404dc0[_0xeac8('0x21')](_0xeac8('0x22'),_0x24a889+'-'+_0x110053+'/'+_0x5b9db9)[_0xeac8('0x1c')](_0x3620fe);}return null;};}function patchUpdates(_0xb0e5b9){return function(_0xde9e18){try{jsonpatch['apply'](_0xde9e18,_0xb0e5b9,!![]);}catch(_0x4700a9){return BPromise[_0xeac8('0x23')](_0x4700a9);}return _0xde9e18[_0xeac8('0x24')]();};}function saveUpdates(_0x58f60f,_0x403a9e){return function(_0x5b73f0){if(_0x5b73f0){return _0x5b73f0[_0xeac8('0x25')](_0x58f60f)['then'](function(_0x5f3bda){return _0x5f3bda;});}return null;};}function removeEntity(_0x1f5c49,_0x44318c){return function(_0x57188a){if(_0x57188a){return _0x57188a['destroy']()[_0xeac8('0x26')](function(){_0x1f5c49[_0xeac8('0x1a')](0xcc)[_0xeac8('0x1b')]();});}};}function handleEntityNotFound(_0x3c188d,_0xb9cd7e){return function(_0x2fc733){if(!_0x2fc733){_0x3c188d[_0xeac8('0x27')](0x194);}return _0x2fc733;};}function handleError(_0x48360a,_0x4acc79){_0x4acc79=_0x4acc79||0x1f4;return function(_0x516591){logger[_0xeac8('0x28')](_0x516591[_0xeac8('0x29')]);if(_0x516591['name']){delete _0x516591[_0xeac8('0x2a')];}_0x48360a[_0xeac8('0x1a')](_0x4acc79)['send'](_0x516591);};}exports[_0xeac8('0x2b')]=function(_0x2383d5,_0x250449){var _0x428fda={},_0x2c971b={},_0x2251a8={'count':0x0,'rows':[]};var _0x33cc03=_[_0xeac8('0x2c')](db[_0xeac8('0x2d')]['rawAttributes'],function(_0x340c3a){return{'name':_0x340c3a[_0xeac8('0x2e')],'type':_0x340c3a[_0xeac8('0x2f')][_0xeac8('0x30')]};});_0x2c971b[_0xeac8('0x31')]=_['differenceBy'](_[_0xeac8('0x2c')](_0x33cc03,_0xeac8('0x2a')),[_0xeac8('0x32')]);_0x2c971b[_0xeac8('0x33')]=_[_0xeac8('0x34')](_0x2383d5[_0xeac8('0x33')]);_0x2c971b['filters']=_[_0xeac8('0x35')](_0x2c971b['model'],_0x2c971b['query']);_0x428fda['attributes']=_[_0xeac8('0x35')](_0x2c971b[_0xeac8('0x31')],qs[_0xeac8('0x36')](_0x2383d5[_0xeac8('0x33')][_0xeac8('0x36')]));_0x428fda[_0xeac8('0x37')]=_0x428fda[_0xeac8('0x37')][_0xeac8('0x38')]?_0x428fda[_0xeac8('0x37')]:_0x2c971b['model'];if(!_0x2383d5[_0xeac8('0x33')]['hasOwnProperty']('nolimit')){_0x428fda['limit']=qs[_0xeac8('0x20')](_0x2383d5[_0xeac8('0x33')][_0xeac8('0x20')]);_0x428fda['offset']=qs[_0xeac8('0x1d')](_0x2383d5[_0xeac8('0x33')]['offset']);}_0x428fda[_0xeac8('0x39')]=qs[_0xeac8('0x3a')](_0x2383d5[_0xeac8('0x33')][_0xeac8('0x3a')]);_0x428fda[_0xeac8('0x3b')]=qs['filters'](_[_0xeac8('0x3c')](_0x2383d5[_0xeac8('0x33')],_0x2c971b[_0xeac8('0x3d')]),_0x33cc03);if(_0x2383d5['query'][_0xeac8('0x3e')]){_0x428fda[_0xeac8('0x3b')]=_[_0xeac8('0x3f')](_0x428fda[_0xeac8('0x3b')],{'$or':_[_0xeac8('0x2c')](_0x33cc03,function(_0x571884){if(_0x571884[_0xeac8('0x2f')]!==_0xeac8('0x40')){var _0x1c567f={};_0x1c567f[_0x571884[_0xeac8('0x2a')]]={'$like':'%'+_0x2383d5['query'][_0xeac8('0x3e')]+'%'};return _0x1c567f;}})});}_0x428fda=_[_0xeac8('0x3f')]({},_0x428fda,_0x2383d5['options']);var _0x373039={'where':_0x428fda[_0xeac8('0x3b')]};return db[_0xeac8('0x2d')][_0xeac8('0x1f')](_0x373039)[_0xeac8('0x26')](function(_0x36face){_0x2251a8['count']=_0x36face;if(_0x2383d5[_0xeac8('0x33')][_0xeac8('0x41')]){_0x428fda[_0xeac8('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xeac8('0x43')](_0x428fda);})['then'](function(_0x5b0ebe){_0x2251a8[_0xeac8('0x44')]=_0x5b0ebe;return _0x2251a8;})[_0xeac8('0x26')](respondWithFilteredResult(_0x250449,_0x428fda))[_0xeac8('0x45')](handleError(_0x250449,null));};exports['show']=function(_0x42d7bb,_0x32ef1f){var _0x5a628d={'raw':![],'where':{'id':_0x42d7bb[_0xeac8('0x46')]['id']}},_0x937de6={};_0x937de6[_0xeac8('0x31')]=_['keys'](db[_0xeac8('0x2d')][_0xeac8('0x47')]);_0x937de6['query']=_[_0xeac8('0x34')](_0x42d7bb[_0xeac8('0x33')]);_0x937de6['filters']=_[_0xeac8('0x35')](_0x937de6['model'],_0x937de6[_0xeac8('0x33')]);_0x5a628d['attributes']=_['intersection'](_0x937de6[_0xeac8('0x31')],qs[_0xeac8('0x36')](_0x42d7bb[_0xeac8('0x33')][_0xeac8('0x36')]));_0x5a628d[_0xeac8('0x37')]=_0x5a628d[_0xeac8('0x37')]['length']?_0x5a628d['attributes']:_0x937de6[_0xeac8('0x31')];if(_0x42d7bb['query'][_0xeac8('0x41')]){_0x5a628d['include']=[{'all':!![]}];}_0x5a628d=_[_0xeac8('0x3f')]({},_0x5a628d,_0x42d7bb[_0xeac8('0x48')]);return db['VoiceRecording'][_0xeac8('0x49')](_0x5a628d)[_0xeac8('0x26')](handleEntityNotFound(_0x32ef1f,null))['then'](respondWithResult(_0x32ef1f,null))[_0xeac8('0x45')](handleError(_0x32ef1f,null));};exports[_0xeac8('0x4a')]=function(_0x2f5fd6,_0x28eabe){return db['VoiceRecording'][_0xeac8('0x4a')](_0x2f5fd6[_0xeac8('0x4b')],{})['then'](respondWithResult(_0x28eabe,0xc9))[_0xeac8('0x45')](handleError(_0x28eabe,null));};exports['update']=function(_0x5740f1,_0x4a43fa){if(_0x5740f1[_0xeac8('0x4b')]['id']){delete _0x5740f1['body']['id'];}return db[_0xeac8('0x2d')]['find']({'where':{'id':_0x5740f1[_0xeac8('0x46')]['id']}})[_0xeac8('0x26')](handleEntityNotFound(_0x4a43fa,null))[_0xeac8('0x26')](saveUpdates(_0x5740f1[_0xeac8('0x4b')],null))[_0xeac8('0x26')](respondWithResult(_0x4a43fa,null))[_0xeac8('0x45')](handleError(_0x4a43fa,null));};exports[_0xeac8('0x4c')]=function(_0x4917f5,_0x1ffc92){return db['VoiceRecording']['describe']()[_0xeac8('0x26')](respondWithResult(_0x1ffc92,null))[_0xeac8('0x45')](handleError(_0x1ffc92,null));};exports[_0xeac8('0x4d')]=function(_0x2c460b,_0x18e6b2,_0xf5b928){var _0x3bc574=require(_0xeac8('0x4e'));var _0x2235c4=![];var _0x3e48f8={};if(_0x2c460b[_0xeac8('0x33')][_0xeac8('0x2f')]&&_0x2c460b[_0xeac8('0x33')][_0xeac8('0x2f')]===_0xeac8('0x4f')){_0x3e48f8[_0xeac8('0x4f')]=_0x2c460b[_0xeac8('0x46')]['id'];}else{_0x3e48f8['id']=_0x2c460b[_0xeac8('0x46')]['id'];}return db[_0xeac8('0x2d')][_0xeac8('0x49')]({'where':_0x3e48f8,'attributes':['id','value'],'raw':!![]})[_0xeac8('0x26')](handleEntityNotFound(_0x18e6b2,null))[_0xeac8('0x26')](function(_0x2c016f){if(_0x2c016f){var _0x122b44=_0x2c016f[_0xeac8('0x50')];var _0x535c8e=util[_0xeac8('0x32')](_0xeac8('0x51'),_0x122b44);if(fs[_0xeac8('0x52')](_0x535c8e)){_0x2235c4=!![];return _0x3bc574[_0xeac8('0x53')](_0x535c8e,_0x122b44,config[_0xeac8('0x54')][_0xeac8('0x55')])['then'](function(){return _0x2c016f;});}return _0x2c016f;}})[_0xeac8('0x26')](function(_0x369da0){if(_0x369da0){var _0x226944=_0x369da0[_0xeac8('0x50')];if(!fs['existsSync'](_0x226944)){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x369da0[_0xeac8('0x58')]){return _0x18e6b2[_0xeac8('0x4d')](_0x226944,_0x369da0[_0xeac8('0x58')]+path['extname'](_0x226944),function(){if(_0x2235c4){fs[_0xeac8('0x59')](_0x226944);}});}else{return _0x18e6b2['download'](_0x226944,function(_0x43358b){if(_0x2235c4){fs[_0xeac8('0x59')](_0x226944);}});}}})[_0xeac8('0x45')](function(_0x5698c8){if(_0x5698c8['message']===_0xeac8('0x5a')){_0x18e6b2[_0xeac8('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x18e6b2,null);}});};exports['downloads']=function(_0x36f769,_0x12bfbf,_0x5ad0cd){var _0x1fe87a=require(_0xeac8('0x4e'));var _0x22e67c=![];var _0x43a316={'$and':[db[_0xeac8('0x5b')][_0xeac8('0x3b')](db[_0xeac8('0x5b')]['fn'](_0xeac8('0x5c'),db[_0xeac8('0x5b')][_0xeac8('0x5d')](_0xeac8('0x4f'))),_0x36f769[_0xeac8('0x33')]['token'])]};if(_0x36f769[_0xeac8('0x33')]['type']&&_0x36f769[_0xeac8('0x33')][_0xeac8('0x2f')]==='uniqueid'){_0x43a316[_0xeac8('0x5e')][_0xeac8('0x5f')]({'uniqueid':_0x36f769['params']['id']});}else{_0x43a316[_0xeac8('0x5e')][_0xeac8('0x5f')]({'id':_0x36f769[_0xeac8('0x46')]['id']});}return db['VoiceRecording'][_0xeac8('0x49')]({'where':_0x43a316,'attributes':['id',_0xeac8('0x50')],'raw':!![]})[_0xeac8('0x26')](handleEntityNotFound(_0x12bfbf,null))['then'](function(_0x17c73a){if(_0x17c73a){var _0x522991=util['format'](_0xeac8('0x51'),_0x17c73a['value']);if(fs[_0xeac8('0x52')](_0x522991)){_0x22e67c=!![];return _0x1fe87a[_0xeac8('0x53')](_0x522991,_0x17c73a[_0xeac8('0x50')],config['secrets']['recording'])['then'](function(){return _0x17c73a;});}return _0x17c73a;}})[_0xeac8('0x26')](function(_0x6e8c64){if(_0x6e8c64){if(!fs[_0xeac8('0x52')](_0x6e8c64[_0xeac8('0x50')])){throw new db['Sequelize'][(_0xeac8('0x57'))](_0xeac8('0x5a'));}if(_0x6e8c64[_0xeac8('0x58')]){return _0x12bfbf[_0xeac8('0x4d')](_0x6e8c64[_0xeac8('0x50')],_0x6e8c64[_0xeac8('0x58')]+path[_0xeac8('0x60')](_0x6e8c64[_0xeac8('0x50')]),function(){if(_0x22e67c){fs[_0xeac8('0x59')](_0x6e8c64[_0xeac8('0x50')]);}});}else{return _0x12bfbf[_0xeac8('0x4d')](_0x6e8c64[_0xeac8('0x50')],function(_0x281fd9){if(_0x22e67c){fs[_0xeac8('0x59')](_0x6e8c64[_0xeac8('0x50')]);}});}}})[_0xeac8('0x45')](handleError(_0x12bfbf,null));};exports[_0xeac8('0x61')]=function(_0x1a4194,_0x5c671e){return db[_0xeac8('0x2d')][_0xeac8('0x49')]({'where':{'id':_0x1a4194[_0xeac8('0x46')]['id']}})[_0xeac8('0x26')](function(_0x401f28){if(_['isNil'](_0x401f28)){throw new ReferenceError(_0xeac8('0x62'));}return _0x401f28;})[_0xeac8('0x26')](function(_0x238111){var _0x1990df=_0x238111[_0xeac8('0x50')];logger['info'](_0xeac8('0x63'),_0x1990df);if(!_[_0xeac8('0x64')](_0x238111[_0xeac8('0x50')])&&fs[_0xeac8('0x52')](_0x1990df)){logger['info'](_0xeac8('0x65')+_0x1990df+_0xeac8('0x66'));fs[_0xeac8('0x67')](_0x1990df);}_0x1990df=_0x1990df+_0xeac8('0x68');if(!_[_0xeac8('0x64')](_0x238111['value'])&&fs[_0xeac8('0x52')](_0x1990df)){logger[_0xeac8('0x69')](_0xeac8('0x65')+_0x1990df+_0xeac8('0x66'));fs[_0xeac8('0x67')](_0x1990df);}return _0x238111;})[_0xeac8('0x26')](function(_0x5ac605){if(!_0x5ac605)throw new InternalError();return _0x5ac605[_0xeac8('0x61')]();})[_0xeac8('0x26')](function(){_0x5c671e['status'](0xcc)[_0xeac8('0x1b')]();})[_0xeac8('0x45')](handleError(_0x5c671e,null));};function getBucketslist(_0x3ecfb8,_0x38391e,_0x2b65ef){return new Promise(function(_0x4d5389,_0x2e4413){var _0xe4c420=new AWS['S3']({'accessKeyId':_0x38391e,'secretAccessKey':_0x3ecfb8,'region':_0x2b65ef});_0xe4c420[_0xeac8('0x6a')]({},function(_0x55cca3,_0xf12a19){if(_0x55cca3){return _0x2e4413(_0x55cca3);}else{return _0x4d5389(_0xf12a19);}});});}function createBucket(_0x1c8da8,_0x18f295,_0x5b5a01,_0x377e5b){return new Promise(function(_0x7310d7,_0x1b8207){var _0x2fe5e3=new AWS['S3']({'accessKeyId':_0x18f295,'secretAccessKey':_0x1c8da8,'region':_0x5b5a01});_0x2fe5e3[_0xeac8('0x6b')]({'Bucket':_0x377e5b},function(_0xa6a27c,_0x1a607a){if(_0xa6a27c){return _0x1b8207(_0xa6a27c);}else{return _0x7310d7(_0x1a607a);}});});}function uploadFile(_0x2082f1,_0x414d99,_0x1b60f6,_0x5496a7,_0x1e1559,_0x41a5b0){return new Promise(function(_0x2e3bd7,_0x3b4a8b){var _0x30e6c2=new AWS['S3']({'accessKeyId':_0x414d99,'secretAccessKey':_0x2082f1,'region':_0x1b60f6});_0x30e6c2[_0xeac8('0x6c')]({'Bucket':_0x5496a7,'Key':_0x1e1559,'Body':_0x41a5b0},function(_0x350fad,_0x382a08){if(_0x350fad){return _0x3b4a8b(_0x350fad);}else{return _0x2e3bd7(_0x382a08);}});});}function startTranscribe(_0x45cd3a,_0x5f12d0,_0x16713e,_0x303ab0,_0x52360c,_0x4adbff){return new Promise(function(_0x57f18b,_0x475836){var _0x3bd13b=new AWS['TranscribeService']({'accessKeyId':_0x5f12d0,'secretAccessKey':_0x45cd3a,'region':_0x16713e});_0x3bd13b[_0xeac8('0x6d')]({'TranscriptionJobName':_0x303ab0,'LanguageCode':_0x52360c,'Media':{'MediaFileUri':_0x4adbff}},function(_0x498ce3,_0x33dd94){if(_0x498ce3){return _0x475836(_0x498ce3);}else{return _0x57f18b(_0x33dd94);}});});}function transcribe(_0x4c9fcc,_0x539e3d,_0x32fdba,_0x133b6b,_0x3dab36,_0x28b412,_0x17d83d){return new Promise(function(_0x30aead,_0x1feaf3){var _0x34704f={};logger['info'](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4c9fcc,_0x3dab36));return uploadFile(_0x539e3d,_0x32fdba,_0x133b6b,_0x3dab36,path['basename'](_0x28b412),fs[_0xeac8('0x6e')](_0x28b412))[_0xeac8('0x26')](function(_0x481104){logger[_0xeac8('0x69')](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4c9fcc,_0x3dab36,_0x481104[_0xeac8('0x6f')]));_0x34704f[_0xeac8('0x70')]=_0x481104[_0xeac8('0x71')];_0x34704f[_0xeac8('0x72')]=_0x481104[_0xeac8('0x6f')];logger[_0xeac8('0x69')](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4c9fcc));return startTranscribe(_0x539e3d,_0x32fdba,_0x133b6b,uuidv4(),_0x17d83d,_0x481104['Location']);})[_0xeac8('0x26')](function(_0x3247a6){logger['info'](util[_0xeac8('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4c9fcc,_0x3247a6[_0xeac8('0x73')][_0xeac8('0x74')]));_0x34704f['transcribeName']=_0x3247a6['TranscriptionJob'][_0xeac8('0x74')];_0x34704f[_0xeac8('0x75')]=_0x3247a6['TranscriptionJob'][_0xeac8('0x76')];return _0x30aead(_0x34704f);})[_0xeac8('0x45')](function(_0x9bdb70){return _0x1feaf3(_0x9bdb70);});});}exports['runTranscribe']=function(_0x149c61,_0x4f98be,_0x5c2a51){var _0x211edb;var _0x13ad24;var _0xb63972;var _0x3c07c0=require('../../components/encryptor');return db['VoiceRecording'][_0xeac8('0x77')]({'where':{'id':_0x149c61[_0xeac8('0x46')]['id']}})['then'](function(_0x1c3521){if(_0x1c3521){var _0x362d64=util[_0xeac8('0x32')]('%s.cypher',_0x1c3521[_0xeac8('0x50')]);if(fs[_0xeac8('0x52')](_0x362d64)){cypher=!![];return _0x3c07c0[_0xeac8('0x53')](_0x362d64,_0x1c3521['value'],config[_0xeac8('0x54')][_0xeac8('0x55')])[_0xeac8('0x26')](function(){return _0x1c3521;});}return _0x1c3521;}})[_0xeac8('0x26')](function(_0x1b7a77){if(!_0x1b7a77){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x78'));}_0x13ad24=_0x1b7a77;return db[_0xeac8('0x79')][_0xeac8('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4f98be,null))['then'](function(_0x25b7da){if(_0x25b7da){_0x211edb=_0x25b7da;if(!_0x211edb[_0xeac8('0x7a')]||!_0x211edb[_0xeac8('0x7b')]||!_0x211edb[_0xeac8('0x7c')]||!_0x211edb['language']||!_0x211edb['bucket']){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))]('Transcribe\x20not\x20configured');}if(_0x149c61['body'][_0xeac8('0x7d')]&&(!_0x211edb['sentiment']||!_0x211edb['sentimentAccountId']||!_0x211edb[_0xeac8('0x7e')]||!_0x211edb[_0xeac8('0x7f')]||!_0x211edb[_0xeac8('0x70')])){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xeac8('0x80')][_0xeac8('0x77')]({'where':{'id':_0x211edb[_0xeac8('0x7b')]}});}})[_0xeac8('0x26')](function(_0x3bb7e2){if(!_0x3bb7e2){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x81'));}if(!_0x3bb7e2[_0xeac8('0x82')]||!_0x3bb7e2[_0xeac8('0x83')]){throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x84'));}_0xb63972=_0x3bb7e2;return getBucketslist(_0xb63972['data1'],_0xb63972[_0xeac8('0x83')],_0x211edb[_0xeac8('0x7c')]);})[_0xeac8('0x26')](function(_0x50c12d){if(_0x50c12d&&_0x50c12d[_0xeac8('0x85')]){var _0x41132e=_[_0xeac8('0x49')](_0x50c12d[_0xeac8('0x85')],function(_0xf57458){return _0xf57458[_0xeac8('0x86')]===_0x211edb['bucket'];});if(!_0x41132e){logger[_0xeac8('0x69')](util['format'](_0xeac8('0x87'),_0x149c61[_0xeac8('0x46')]['id'],_0x211edb[_0xeac8('0x70')]));return createBucket(_0xb63972[_0xeac8('0x82')],_0xb63972['data2'],_0x211edb[_0xeac8('0x7c')],_0x211edb[_0xeac8('0x70')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x149c61[_0xeac8('0x46')]['id'],_0x211edb[_0xeac8('0x70')]));return;}})[_0xeac8('0x26')](function(_0x8a8020){if(_0x13ad24[_0xeac8('0x75')]===_0xeac8('0x88')){return transcribe(_0x149c61[_0xeac8('0x46')]['id'],_0xb63972[_0xeac8('0x82')],_0xb63972[_0xeac8('0x83')],_0x211edb[_0xeac8('0x7c')],_0x211edb[_0xeac8('0x70')],_0x13ad24[_0xeac8('0x50')],_0x211edb[_0xeac8('0x7f')]);}else{logger['info'](util['format'](_0xeac8('0x89'),_0x149c61['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xeac8('0x26')](function(_0xb6e498){if(_0xb6e498){_0xb6e498[_0xeac8('0x8a')]=_0x149c61[_0xeac8('0x4b')][_0xeac8('0x7d')];return _0x13ad24[_0xeac8('0x8b')](_0xb6e498);}})[_0xeac8('0x26')](respondWithResult(_0x4f98be,null))[_0xeac8('0x45')](handleError(_0x4f98be,null));};function writeFile(_0x48c998,_0x370445){return new Promise(function(_0x5cfddb,_0x27a4f4){fs[_0xeac8('0x8c')](_0x370445,_0x48c998,function(_0x19e2b7,_0xaaf33e){if(_0x19e2b7){return _0x27a4f4(_0x19e2b7);}else{return _0x5cfddb(_0xaaf33e);}});});}exports[_0xeac8('0x8d')]=function(_0x2b693e,_0x4f6a56,_0x1c31dc){return db[_0xeac8('0x2d')][_0xeac8('0x77')]({'where':{'id':_0x2b693e['params']['id']}})[_0xeac8('0x26')](handleEntityNotFound(_0x4f6a56))['then'](function(_0x45aab0){if(_0x45aab0&&_0x45aab0[_0xeac8('0x8e')]){var _0x27e119=_0x45aab0[_0xeac8('0x8e')];var _0x3fc12c=config[_0xeac8('0x8f')]+_0xeac8('0x90')+_0x45aab0['id']+_0xeac8('0x91');if(fs['existsSync'](_0x3fc12c)){return _0x3fc12c;}return writeFile(_0x27e119,_0x3fc12c)[_0xeac8('0x26')](function(){return _0x3fc12c;});}else{throw new db[(_0xeac8('0x56'))][(_0xeac8('0x57'))](_0xeac8('0x92'));}})[_0xeac8('0x26')](function(_0x1fd99f){return _0x4f6a56[_0xeac8('0x4d')](_0x1fd99f);})[_0xeac8('0x45')](handleError(_0x4f6a56));}; \ No newline at end of file +var _0x024d=['[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','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','TranscribeService'];(function(_0x254b3f,_0x1392e6){var _0x1ddbb4=function(_0x58dbac){while(--_0x58dbac){_0x254b3f['push'](_0x254b3f['shift']());}};_0x1ddbb4(++_0x1392e6);}(_0x024d,0xc2));var _0xd024=function(_0x3d7043,_0x59e1a8){_0x3d7043=_0x3d7043-0x0;var _0x4b9863=_0x024d[_0x3d7043];return _0x4b9863;};'use strict';var emlformat=require(_0xd024('0x0'));var rimraf=require(_0xd024('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd024('0x2'));var rp=require(_0xd024('0x3'));var moment=require(_0xd024('0x4'));var BPromise=require(_0xd024('0x5'));var Mustache=require(_0xd024('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd024('0x7'));var csv=require(_0xd024('0x8'));var ejs=require(_0xd024('0x9'));var fs=require('fs');var fs_extra=require(_0xd024('0xa'));var _=require('lodash');var squel=require(_0xd024('0xb'));var crypto=require(_0xd024('0xc'));var jsforce=require(_0xd024('0xd'));var deskjs=require(_0xd024('0xe'));var toCsv=require(_0xd024('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xd024('0xf'));var Redis=require(_0xd024('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd024('0x11'));var as=require(_0xd024('0x12'));var hardwareService=require(_0xd024('0x13'));var logger=require(_0xd024('0x14'))(_0xd024('0x15'));var utils=require('../../config/utils');var config=require(_0xd024('0x16'));var licenseUtil=require(_0xd024('0x17'));var db=require(_0xd024('0x18'))['db'];function respondWithStatusCode(_0x23356e,_0x72fb){_0x72fb=_0x72fb||0xcc;return function(_0x6b43f0){if(_0x6b43f0){return _0x23356e[_0xd024('0x19')](_0x72fb);}return _0x23356e[_0xd024('0x1a')](_0x72fb)[_0xd024('0x1b')]();};}function respondWithResult(_0xeab791,_0x284e0b){_0x284e0b=_0x284e0b||0xc8;return function(_0xf1599){if(_0xf1599){return _0xeab791[_0xd024('0x1a')](_0x284e0b)['json'](_0xf1599);}};}function respondWithFilteredResult(_0x490c31,_0x363397){return function(_0x432910){if(_0x432910){var _0xe3eee2=typeof _0x363397[_0xd024('0x1c')]==='undefined'&&typeof _0x363397['limit']===_0xd024('0x1d');var _0x165967=_0x432910[_0xd024('0x1e')];var _0x56f671=_0xe3eee2?0x0:_0x363397['offset'];var _0xfb8885=_0xe3eee2?_0x432910[_0xd024('0x1e')]:_0x363397[_0xd024('0x1c')]+_0x363397[_0xd024('0x1f')];var _0x150e77;if(_0xfb8885>=_0x165967){_0xfb8885=_0x165967;_0x150e77=0xc8;}else{_0x150e77=0xce;}_0x490c31['status'](_0x150e77);return _0x490c31[_0xd024('0x20')](_0xd024('0x21'),_0x56f671+'-'+_0xfb8885+'/'+_0x165967)[_0xd024('0x22')](_0x432910);}return null;};}function patchUpdates(_0x1af02f){return function(_0x39274a){try{jsonpatch[_0xd024('0x23')](_0x39274a,_0x1af02f,!![]);}catch(_0x3bc9a9){return BPromise['reject'](_0x3bc9a9);}return _0x39274a[_0xd024('0x24')]();};}function saveUpdates(_0x5616cb,_0x22d2ad){return function(_0x540d9e){if(_0x540d9e){return _0x540d9e[_0xd024('0x25')](_0x5616cb)[_0xd024('0x26')](function(_0x2c8592){return _0x2c8592;});}return null;};}function removeEntity(_0x42eb8f,_0x52108c){return function(_0x531f56){if(_0x531f56){return _0x531f56[_0xd024('0x27')]()[_0xd024('0x26')](function(){_0x42eb8f[_0xd024('0x1a')](0xcc)[_0xd024('0x1b')]();});}};}function handleEntityNotFound(_0x25dea9,_0x216cc4){return function(_0x7a13f9){if(!_0x7a13f9){_0x25dea9[_0xd024('0x19')](0x194);}return _0x7a13f9;};}function handleError(_0x259ded,_0x143b4f){_0x143b4f=_0x143b4f||0x1f4;return function(_0x4c6fc8){logger[_0xd024('0x28')](_0x4c6fc8[_0xd024('0x29')]);if(_0x4c6fc8[_0xd024('0x2a')]){delete _0x4c6fc8[_0xd024('0x2a')];}_0x259ded['status'](_0x143b4f)[_0xd024('0x2b')](_0x4c6fc8);};}exports['index']=function(_0x35b8b7,_0x1f26e5){var _0x56a746={},_0x4ebf91={},_0x1a7d09={'count':0x0,'rows':[]};var _0x25ecde=_[_0xd024('0x2c')](db[_0xd024('0x2d')][_0xd024('0x2e')],function(_0x430101){return{'name':_0x430101[_0xd024('0x2f')],'type':_0x430101[_0xd024('0x30')]['key']};});_0x4ebf91[_0xd024('0x31')]=_[_0xd024('0x32')](_[_0xd024('0x2c')](_0x25ecde,_0xd024('0x2a')),[_0xd024('0x33')]);_0x4ebf91[_0xd024('0x34')]=_[_0xd024('0x35')](_0x35b8b7['query']);_0x4ebf91[_0xd024('0x36')]=_[_0xd024('0x37')](_0x4ebf91[_0xd024('0x31')],_0x4ebf91[_0xd024('0x34')]);_0x56a746[_0xd024('0x38')]=_[_0xd024('0x37')](_0x4ebf91[_0xd024('0x31')],qs['fields'](_0x35b8b7['query'][_0xd024('0x39')]));_0x56a746['attributes']=_0x56a746['attributes'][_0xd024('0x3a')]?_0x56a746[_0xd024('0x38')]:_0x4ebf91['model'];if(!_0x35b8b7[_0xd024('0x34')][_0xd024('0x3b')](_0xd024('0x3c'))){_0x56a746[_0xd024('0x1f')]=qs[_0xd024('0x1f')](_0x35b8b7[_0xd024('0x34')][_0xd024('0x1f')]);_0x56a746[_0xd024('0x1c')]=qs[_0xd024('0x1c')](_0x35b8b7[_0xd024('0x34')]['offset']);}_0x56a746['order']=qs[_0xd024('0x3d')](_0x35b8b7['query'][_0xd024('0x3d')]);_0x56a746[_0xd024('0x3e')]=qs[_0xd024('0x36')](_[_0xd024('0x3f')](_0x35b8b7['query'],_0x4ebf91[_0xd024('0x36')]),_0x25ecde);if(_0x35b8b7['query'][_0xd024('0x40')]){_0x56a746[_0xd024('0x3e')]=_[_0xd024('0x41')](_0x56a746[_0xd024('0x3e')],{'$or':_[_0xd024('0x2c')](_0x25ecde,function(_0x460de9){if(_0x460de9[_0xd024('0x30')]!=='VIRTUAL'){var _0x447255={};_0x447255[_0x460de9[_0xd024('0x2a')]]={'$like':'%'+_0x35b8b7['query'][_0xd024('0x40')]+'%'};return _0x447255;}})});}_0x56a746=_[_0xd024('0x41')]({},_0x56a746,_0x35b8b7[_0xd024('0x42')]);var _0x2350f0={'where':_0x56a746[_0xd024('0x3e')]};return db[_0xd024('0x2d')][_0xd024('0x1e')](_0x2350f0)[_0xd024('0x26')](function(_0x148c79){_0x1a7d09[_0xd024('0x1e')]=_0x148c79;if(_0x35b8b7[_0xd024('0x34')][_0xd024('0x43')]){_0x56a746[_0xd024('0x44')]=[{'all':!![]}];}return db[_0xd024('0x2d')][_0xd024('0x45')](_0x56a746);})[_0xd024('0x26')](function(_0x5ddbbe){_0x1a7d09[_0xd024('0x46')]=_0x5ddbbe;return _0x1a7d09;})['then'](respondWithFilteredResult(_0x1f26e5,_0x56a746))['catch'](handleError(_0x1f26e5,null));};exports[_0xd024('0x47')]=function(_0x3d5ec5,_0x4fb8cc){var _0x4df760={'raw':![],'where':{'id':_0x3d5ec5[_0xd024('0x48')]['id']}},_0x20eb2d={};_0x20eb2d['model']=_[_0xd024('0x35')](db['VoiceRecording'][_0xd024('0x2e')]);_0x20eb2d['query']=_[_0xd024('0x35')](_0x3d5ec5[_0xd024('0x34')]);_0x20eb2d[_0xd024('0x36')]=_['intersection'](_0x20eb2d['model'],_0x20eb2d['query']);_0x4df760[_0xd024('0x38')]=_[_0xd024('0x37')](_0x20eb2d[_0xd024('0x31')],qs[_0xd024('0x39')](_0x3d5ec5[_0xd024('0x34')]['fields']));_0x4df760[_0xd024('0x38')]=_0x4df760['attributes'][_0xd024('0x3a')]?_0x4df760[_0xd024('0x38')]:_0x20eb2d[_0xd024('0x31')];if(_0x3d5ec5['query']['includeAll']){_0x4df760[_0xd024('0x44')]=[{'all':!![]}];}_0x4df760=_[_0xd024('0x41')]({},_0x4df760,_0x3d5ec5[_0xd024('0x42')]);return db[_0xd024('0x2d')]['find'](_0x4df760)[_0xd024('0x26')](handleEntityNotFound(_0x4fb8cc,null))[_0xd024('0x26')](respondWithResult(_0x4fb8cc,null))[_0xd024('0x49')](handleError(_0x4fb8cc,null));};exports['create']=function(_0xdd8494,_0x3f8f32){return db[_0xd024('0x2d')][_0xd024('0x4a')](_0xdd8494[_0xd024('0x4b')],{})['then'](respondWithResult(_0x3f8f32,0xc9))[_0xd024('0x49')](handleError(_0x3f8f32,null));};exports[_0xd024('0x25')]=function(_0x190726,_0x2df050){if(_0x190726[_0xd024('0x4b')]['id']){delete _0x190726[_0xd024('0x4b')]['id'];}return db[_0xd024('0x2d')][_0xd024('0x4c')]({'where':{'id':_0x190726[_0xd024('0x48')]['id']}})[_0xd024('0x26')](handleEntityNotFound(_0x2df050,null))[_0xd024('0x26')](saveUpdates(_0x190726[_0xd024('0x4b')],null))[_0xd024('0x26')](respondWithResult(_0x2df050,null))[_0xd024('0x49')](handleError(_0x2df050,null));};exports[_0xd024('0x4d')]=function(_0x114158,_0x4353c8){return db[_0xd024('0x2d')][_0xd024('0x4d')]()['then'](respondWithResult(_0x4353c8,null))[_0xd024('0x49')](handleError(_0x4353c8,null));};exports[_0xd024('0x4e')]=function(_0x405728,_0x3721b7,_0x3f4202){var _0x4e3031=require(_0xd024('0x4f'));var _0x333381=![];var _0x2e4757={};if(_0x405728[_0xd024('0x34')][_0xd024('0x30')]&&_0x405728[_0xd024('0x34')][_0xd024('0x30')]===_0xd024('0x50')){_0x2e4757['uniqueid']=_0x405728['params']['id'];}else{_0x2e4757['id']=_0x405728[_0xd024('0x48')]['id'];}return db[_0xd024('0x2d')][_0xd024('0x4c')]({'where':_0x2e4757,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3721b7,null))[_0xd024('0x26')](function(_0x213c51){if(_0x213c51){var _0x5096d4=_0x213c51[_0xd024('0x51')];var _0x58bae8=util['format'](_0xd024('0x52'),_0x5096d4);if(fs[_0xd024('0x53')](_0x58bae8)){_0x333381=!![];return _0x4e3031[_0xd024('0x54')](_0x58bae8,_0x5096d4,config[_0xd024('0x55')][_0xd024('0x56')])['then'](function(){return _0x213c51;});}return _0x213c51;}})['then'](function(_0x3de7e0){if(_0x3de7e0){var _0x5aeceb=_0x3de7e0[_0xd024('0x51')];if(!fs[_0xd024('0x53')](_0x5aeceb)){throw new db['Sequelize'][(_0xd024('0x57'))](_0xd024('0x58'));}if(_0x3de7e0['filename']){return _0x3721b7[_0xd024('0x4e')](_0x5aeceb,_0x3de7e0[_0xd024('0x59')]+path[_0xd024('0x5a')](_0x5aeceb),function(){if(_0x333381){fs[_0xd024('0x5b')](_0x5aeceb);}});}else{return _0x3721b7[_0xd024('0x4e')](_0x5aeceb,function(_0x5d79d4){if(_0x333381){fs[_0xd024('0x5b')](_0x5aeceb);}});}}})['catch'](function(_0x47cbdb){if(_0x47cbdb[_0xd024('0x5c')]===_0xd024('0x58')){_0x3721b7[_0xd024('0x1a')](0x194)[_0xd024('0x2b')](_0xd024('0x5d'));}else{return handleError(_0x3721b7,null);}});};exports[_0xd024('0x5e')]=function(_0x369509,_0x5d1c5a,_0x2a2d86){var _0x398871=require(_0xd024('0x4f'));var _0x263837=![];var _0x212215={'$and':[db[_0xd024('0x5f')][_0xd024('0x3e')](db[_0xd024('0x5f')]['fn'](_0xd024('0x60'),db[_0xd024('0x5f')][_0xd024('0x61')](_0xd024('0x50'))),_0x369509[_0xd024('0x34')][_0xd024('0x62')])]};if(_0x369509['query'][_0xd024('0x30')]&&_0x369509[_0xd024('0x34')][_0xd024('0x30')]===_0xd024('0x50')){_0x212215[_0xd024('0x63')][_0xd024('0x64')]({'uniqueid':_0x369509[_0xd024('0x48')]['id']});}else{_0x212215['$and'][_0xd024('0x64')]({'id':_0x369509['params']['id']});}return db[_0xd024('0x2d')][_0xd024('0x4c')]({'where':_0x212215,'attributes':['id',_0xd024('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x5d1c5a,null))[_0xd024('0x26')](function(_0x44b87e){if(_0x44b87e){var _0xf2da14=util[_0xd024('0x33')]('%s.cypher',_0x44b87e['value']);if(fs[_0xd024('0x53')](_0xf2da14)){_0x263837=!![];return _0x398871['decryptFile'](_0xf2da14,_0x44b87e[_0xd024('0x51')],config[_0xd024('0x55')]['recording'])[_0xd024('0x26')](function(){return _0x44b87e;});}return _0x44b87e;}})['then'](function(_0x544cbb){if(_0x544cbb){if(!fs[_0xd024('0x53')](_0x544cbb['value'])){throw new db['Sequelize'][(_0xd024('0x57'))](_0xd024('0x58'));}if(_0x544cbb[_0xd024('0x59')]){return _0x5d1c5a[_0xd024('0x4e')](_0x544cbb[_0xd024('0x51')],_0x544cbb[_0xd024('0x59')]+path[_0xd024('0x5a')](_0x544cbb[_0xd024('0x51')]),function(){if(_0x263837){fs[_0xd024('0x5b')](_0x544cbb[_0xd024('0x51')]);}});}else{return _0x5d1c5a[_0xd024('0x4e')](_0x544cbb[_0xd024('0x51')],function(_0x4e06a5){if(_0x263837){fs[_0xd024('0x5b')](_0x544cbb[_0xd024('0x51')]);}});}}})[_0xd024('0x49')](handleError(_0x5d1c5a,null));};exports[_0xd024('0x27')]=function(_0x4a05d8,_0x3afc77){return db[_0xd024('0x2d')]['find']({'where':{'id':_0x4a05d8['params']['id']}})[_0xd024('0x26')](function(_0x2423d9){if(_['isNil'](_0x2423d9)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2423d9;})[_0xd024('0x26')](function(_0x5c7bcd){var _0x77d7cb=_0x5c7bcd['value'];logger[_0xd024('0x65')](_0xd024('0x66'),_0x77d7cb);if(!_[_0xd024('0x67')](_0x5c7bcd['value'])&&fs[_0xd024('0x53')](_0x77d7cb)){logger['info']('File:\x20\x22'+_0x77d7cb+_0xd024('0x68'));fs[_0xd024('0x69')](_0x77d7cb);}_0x77d7cb=_0x77d7cb+_0xd024('0x6a');if(!_[_0xd024('0x67')](_0x5c7bcd[_0xd024('0x51')])&&fs[_0xd024('0x53')](_0x77d7cb)){logger[_0xd024('0x65')](_0xd024('0x6b')+_0x77d7cb+_0xd024('0x68'));fs['unlinkSync'](_0x77d7cb);}return _0x5c7bcd;})['then'](function(_0x16ed09){if(!_0x16ed09)throw new InternalError();return _0x16ed09['destroy']();})[_0xd024('0x26')](function(){_0x3afc77[_0xd024('0x1a')](0xcc)['end']();})[_0xd024('0x49')](handleError(_0x3afc77,null));};function getBucketslist(_0x25870f,_0x528940,_0x3d3df1){return new Promise(function(_0x2137ed,_0x502ba0){var _0x225ca5=new AWS['S3']({'accessKeyId':_0x528940,'secretAccessKey':_0x25870f,'region':_0x3d3df1});_0x225ca5[_0xd024('0x6c')]({},function(_0x4ecd69,_0xe66ddd){if(_0x4ecd69){return _0x502ba0(_0x4ecd69);}else{return _0x2137ed(_0xe66ddd);}});});}function createBucket(_0x1c2e08,_0x407247,_0x2cf44,_0x5b3c04){return new Promise(function(_0x43edce,_0x5abadb){var _0x27eec5=new AWS['S3']({'accessKeyId':_0x407247,'secretAccessKey':_0x1c2e08,'region':_0x2cf44});_0x27eec5['createBucket']({'Bucket':_0x5b3c04},function(_0x232530,_0x338ba5){if(_0x232530){return _0x5abadb(_0x232530);}else{return _0x43edce(_0x338ba5);}});});}function uploadFile(_0x49c1e6,_0x38123e,_0x2f965d,_0x43475c,_0x26d1f5,_0x131434){return new Promise(function(_0x5a186f,_0x3ff525){var _0x5b14a2=new AWS['S3']({'accessKeyId':_0x38123e,'secretAccessKey':_0x49c1e6,'region':_0x2f965d});_0x5b14a2['upload']({'Bucket':_0x43475c,'Key':_0x26d1f5,'Body':_0x131434},function(_0x47673c,_0x45551b){if(_0x47673c){return _0x3ff525(_0x47673c);}else{return _0x5a186f(_0x45551b);}});});}function startTranscribe(_0x56b285,_0x6ab438,_0x5dc23b,_0xf5e220,_0x1e4db7,_0x53ffba){return new Promise(function(_0x3d6de7,_0x263a71){var _0x54fb77=new AWS[(_0xd024('0x6d'))]({'accessKeyId':_0x6ab438,'secretAccessKey':_0x56b285,'region':_0x5dc23b});_0x54fb77['startTranscriptionJob']({'TranscriptionJobName':_0xf5e220,'LanguageCode':_0x1e4db7,'Media':{'MediaFileUri':_0x53ffba}},function(_0x472196,_0x284e49){if(_0x472196){return _0x263a71(_0x472196);}else{return _0x3d6de7(_0x284e49);}});});}function transcribe(_0x4d1e14,_0x2f0247,_0x500b8c,_0x20713b,_0x1caedd,_0x42685c,_0x3789bc){return new Promise(function(_0x44e46e,_0x4b3e23){var _0x348f69={};logger['info'](util[_0xd024('0x33')](_0xd024('0x6e'),_0x4d1e14,_0x1caedd));return uploadFile(_0x2f0247,_0x500b8c,_0x20713b,_0x1caedd,path[_0xd024('0x6f')](_0x42685c),fs[_0xd024('0x70')](_0x42685c))['then'](function(_0x3a691a){logger['info'](util[_0xd024('0x33')](_0xd024('0x71'),_0x4d1e14,_0x1caedd,_0x3a691a[_0xd024('0x72')]));_0x348f69['bucket']=_0x3a691a[_0xd024('0x73')];_0x348f69['location']=_0x3a691a[_0xd024('0x72')];logger['info'](util[_0xd024('0x33')](_0xd024('0x74'),_0x4d1e14));return startTranscribe(_0x2f0247,_0x500b8c,_0x20713b,uuidv4(),_0x3789bc,_0x3a691a[_0xd024('0x72')]);})['then'](function(_0x27a810){logger[_0xd024('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4d1e14,_0x27a810[_0xd024('0x75')][_0xd024('0x76')]));_0x348f69[_0xd024('0x77')]=_0x27a810[_0xd024('0x75')][_0xd024('0x76')];_0x348f69['transcribeStatus']=_0x27a810['TranscriptionJob'][_0xd024('0x78')];return _0x44e46e(_0x348f69);})[_0xd024('0x49')](function(_0x4ca6f6){return _0x4b3e23(_0x4ca6f6);});});}exports[_0xd024('0x79')]=function(_0x1fe2f9,_0x13c8c8,_0x1d3355){var _0x36a8d3;var _0xf60fa2;var _0x42ab18;var _0xfabdf=require(_0xd024('0x4f'));return db[_0xd024('0x2d')][_0xd024('0x7a')]({'where':{'id':_0x1fe2f9[_0xd024('0x48')]['id']}})[_0xd024('0x26')](function(_0x3e2bef){if(_0x3e2bef){var _0x26280e=util[_0xd024('0x33')](_0xd024('0x52'),_0x3e2bef[_0xd024('0x51')]);if(fs['existsSync'](_0x26280e)){cypher=!![];return _0xfabdf[_0xd024('0x54')](_0x26280e,_0x3e2bef[_0xd024('0x51')],config[_0xd024('0x55')][_0xd024('0x56')])[_0xd024('0x26')](function(){return _0x3e2bef;});}return _0x3e2bef;}})[_0xd024('0x26')](function(_0x5ed7e2){if(!_0x5ed7e2){throw new db[(_0xd024('0x7b'))][(_0xd024('0x57'))](_0xd024('0x7c'));}_0xf60fa2=_0x5ed7e2;return db['Setting'][_0xd024('0x7a')]({'where':{'id':0x1}});})[_0xd024('0x26')](handleEntityNotFound(_0x13c8c8,null))['then'](function(_0x4606df){if(_0x4606df){_0x36a8d3=_0x4606df;if(!_0x36a8d3[_0xd024('0x7d')]||!_0x36a8d3[_0xd024('0x7e')]||!_0x36a8d3[_0xd024('0x7f')]||!_0x36a8d3[_0xd024('0x80')]||!_0x36a8d3[_0xd024('0x81')]){throw new db[(_0xd024('0x7b'))][(_0xd024('0x57'))](_0xd024('0x82'));}if(_0x1fe2f9['body']['runSentiment']&&(!_0x36a8d3['sentiment']||!_0x36a8d3[_0xd024('0x83')]||!_0x36a8d3[_0xd024('0x84')]||!_0x36a8d3[_0xd024('0x80')]||!_0x36a8d3[_0xd024('0x81')])){throw new db[(_0xd024('0x7b'))][(_0xd024('0x57'))](_0xd024('0x85'));}return db[_0xd024('0x86')][_0xd024('0x7a')]({'where':{'id':_0x36a8d3[_0xd024('0x7e')]}});}})[_0xd024('0x26')](function(_0x5a2e58){if(!_0x5a2e58){throw new db[(_0xd024('0x7b'))]['ValidationError'](_0xd024('0x87'));}if(!_0x5a2e58[_0xd024('0x88')]||!_0x5a2e58[_0xd024('0x89')]){throw new db[(_0xd024('0x7b'))][(_0xd024('0x57'))](_0xd024('0x8a'));}_0x42ab18=_0x5a2e58;return getBucketslist(_0x42ab18[_0xd024('0x88')],_0x42ab18[_0xd024('0x89')],_0x36a8d3[_0xd024('0x7f')]);})['then'](function(_0x1411da){if(_0x1411da&&_0x1411da['Buckets']){var _0x321d4f=_['find'](_0x1411da[_0xd024('0x8b')],function(_0x509e52){return _0x509e52[_0xd024('0x8c')]===_0x36a8d3[_0xd024('0x81')];});if(!_0x321d4f){logger[_0xd024('0x65')](util[_0xd024('0x33')](_0xd024('0x8d'),_0x1fe2f9['params']['id'],_0x36a8d3[_0xd024('0x81')]));return createBucket(_0x42ab18['data1'],_0x42ab18[_0xd024('0x89')],_0x36a8d3[_0xd024('0x7f')],_0x36a8d3[_0xd024('0x81')]);}logger['info'](util[_0xd024('0x33')](_0xd024('0x8e'),_0x1fe2f9[_0xd024('0x48')]['id'],_0x36a8d3[_0xd024('0x81')]));return;}})[_0xd024('0x26')](function(_0x23372b){if(_0xf60fa2[_0xd024('0x8f')]===_0xd024('0x90')){return transcribe(_0x1fe2f9[_0xd024('0x48')]['id'],_0x42ab18[_0xd024('0x88')],_0x42ab18['data2'],_0x36a8d3[_0xd024('0x7f')],_0x36a8d3['bucket'],_0xf60fa2[_0xd024('0x51')],_0x36a8d3[_0xd024('0x80')]);}else{logger['info'](util[_0xd024('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1fe2f9[_0xd024('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xd024('0x26')](function(_0x4f2e0){if(_0x4f2e0){_0x4f2e0[_0xd024('0x91')]=_0x1fe2f9['body']['runSentiment'];return _0xf60fa2['updateAttributes'](_0x4f2e0);}})[_0xd024('0x26')](respondWithResult(_0x13c8c8,null))[_0xd024('0x49')](handleError(_0x13c8c8,null));};function writeFile(_0x4f331f,_0x54a722){return new Promise(function(_0x3d618f,_0x551ed1){fs[_0xd024('0x92')](_0x54a722,_0x4f331f,function(_0xd68378,_0x2cf66f){if(_0xd68378){return _0x551ed1(_0xd68378);}else{return _0x3d618f(_0x2cf66f);}});});}exports[_0xd024('0x93')]=function(_0x313a42,_0x175355,_0x1f38cd){return db[_0xd024('0x2d')][_0xd024('0x7a')]({'where':{'id':_0x313a42[_0xd024('0x48')]['id']}})['then'](handleEntityNotFound(_0x175355))[_0xd024('0x26')](function(_0x4aa98d){if(_0x4aa98d&&_0x4aa98d[_0xd024('0x94')]){var _0x2fdb5a=_0x4aa98d[_0xd024('0x94')];var _0x5ad5c0=config[_0xd024('0x95')]+'/server/files/transcribes/transcribe_'+_0x4aa98d['id']+_0xd024('0x96');if(fs['existsSync'](_0x5ad5c0)){return _0x5ad5c0;}return writeFile(_0x2fdb5a,_0x5ad5c0)[_0xd024('0x26')](function(){return _0x5ad5c0;});}else{throw new db[(_0xd024('0x7b'))]['ValidationError'](_0xd024('0x97'));}})[_0xd024('0x26')](function(_0x3e2024){return _0x175355['download'](_0x3e2024);})[_0xd024('0x49')](handleError(_0x175355));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ee69150..3d7d937 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 _0xd21d=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x4cbb31,_0xc6e39e){var _0x5ef9d0=function(_0x2e3bef){while(--_0x2e3bef){_0x4cbb31['push'](_0x4cbb31['shift']());}};_0x5ef9d0(++_0xc6e39e);}(_0xd21d,0x14e));var _0xdd21=function(_0x473a79,_0x5e608b){_0x473a79=_0x473a79-0x0;var _0x5a91b3=_0xd21d[_0x473a79];return _0x5a91b3;};'use strict';var _=require('lodash');var util=require(_0xdd21('0x0'));var logger=require(_0xdd21('0x1'))(_0xdd21('0x2'));var moment=require(_0xdd21('0x3'));var BPromise=require(_0xdd21('0x4'));var rp=require(_0xdd21('0x5'));var fs=require('fs');var path=require(_0xdd21('0x6'));var rimraf=require(_0xdd21('0x7'));var config=require(_0xdd21('0x8'));var attributes=require(_0xdd21('0x9'));module[_0xdd21('0xa')]=function(_0x1791e6,_0x55c2fc){return _0x1791e6[_0xdd21('0xb')](_0xdd21('0xc'),attributes,{'tableName':_0xdd21('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdd21('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['exports','define','VoiceRecording','voice_recordings','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x117c70,_0x241a36){var _0x3a5b78=function(_0x58bde6){while(--_0x58bde6){_0x117c70['push'](_0x117c70['shift']());}};_0x3a5b78(++_0x241a36);}(_0xadb5,0xad));var _0x5adb=function(_0x222b21,_0x5f1271){_0x222b21=_0x222b21-0x0;var _0x4f5146=_0xadb5[_0x222b21];return _0x4f5146;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ca00b92..2b66d82 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 _0x6a55=['callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateVoiceRecording','update','body','options','where','limit','findOne'];(function(_0xcfc932,_0x4c9861){var _0x6839da=function(_0x3d9afe){while(--_0x3d9afe){_0xcfc932['push'](_0xcfc932['shift']());}};_0x6839da(++_0x4c9861);}(_0x6a55,0xdb));var _0x56a5=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x6a55[_0x57fc2a];return _0xa839b;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});}exports[_0x56a5('0x13')]=function(_0x28fe74){var _0x1ba472=this;return new Promise(function(_0x143f3d,_0x1dddec){return db['VoiceRecording'][_0x56a5('0x14')](_0x28fe74[_0x56a5('0x15')],{'raw':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x17')]||null:null,'attributes':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['attributes']||null:null,'limit':_0x28fe74['options']?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x18')]||null:null})['then'](function(_0x1556eb){logger[_0x56a5('0x8')](_0x56a5('0x13'),_0x28fe74);logger[_0x56a5('0xb')](_0x56a5('0x13'),_0x28fe74,JSON[_0x56a5('0xd')](_0x1556eb));_0x143f3d(_0x1556eb);})[_0x56a5('0x12')](function(_0x8431df){logger[_0x56a5('0xf')](_0x56a5('0x13'),_0x8431df[_0x56a5('0x10')],_0x28fe74);_0x1dddec(_0x1ba472[_0x56a5('0xf')](0x1f4,_0x8431df[_0x56a5('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5c76a7){var _0x2d8e68=this;return new Promise(function(_0x42cd45,_0x2706f9){var _0x43a815=require('../../components/encryptor');var _0x18e863;return db['Setting'][_0x56a5('0x19')]({'attributes':['id',_0x56a5('0x1a')],'where':{'id':0x1},'raw':!![]})[_0x56a5('0x7')](function(_0x284ee5){_0x18e863=_0x284ee5;return db['VoiceRecording'][_0x56a5('0x1b')](_0x5c76a7[_0x56a5('0x15')]);})[_0x56a5('0x7')](function(_0x51ef6f){if(_0x18e863[_0x56a5('0x1a')]&&fs[_0x56a5('0x1c')](_0x51ef6f[_0x56a5('0x1d')])){var _0x214649=util[_0x56a5('0x1e')]('%s.cypher',_0x51ef6f[_0x56a5('0x1d')]);return _0x43a815[_0x56a5('0x1f')](_0x51ef6f[_0x56a5('0x1d')],_0x214649,config[_0x56a5('0x20')][_0x56a5('0x21')])['then'](function(){fs['unlink'](_0x51ef6f[_0x56a5('0x1d')]);logger[_0x56a5('0x8')](_0x56a5('0x22'));return _0x51ef6f;});}return _0x51ef6f;})['then'](function(_0x1de021){logger[_0x56a5('0x8')]('CreateVoiceRecording',_0x5c76a7);logger['debug']('CreateVoiceRecording',_0x5c76a7,JSON['stringify'](_0x1de021));_0x42cd45(_0x1de021);})[_0x56a5('0x12')](function(_0x29c8f1){logger[_0x56a5('0xf')]('CreateVoiceRecording',_0x29c8f1[_0x56a5('0x10')],_0x5c76a7);_0x2706f9(_0x2d8e68['error'](0x1f4,_0x29c8f1[_0x56a5('0x10')]));});});}; \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14da3e,_0x245176){var _0x4a5348=function(_0x2c7766){while(--_0x2c7766){_0x14da3e['push'](_0x14da3e['shift']());}};_0x4a5348(++_0x245176);}(_0x1623,0xab));var _0x3162=function(_0x20ddd7,_0x341d12){_0x20ddd7=_0x20ddd7-0x0;var _0x44b5ac=_0x1623[_0x20ddd7];return _0x44b5ac;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x1a')]?_0x1eed46['options']['attributes']||null:null,'limit':_0x1eed46[_0x3162('0x1a')]?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1c')]||null:null})[_0x3162('0xa')](function(_0x31b27b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('UpdateVoiceRecording',_0x1eed46,JSON[_0x3162('0xf')](_0x31b27b));_0x4b2bf3(_0x31b27b);})[_0x3162('0x15')](function(_0x3919e7){logger[_0x3162('0x10')](_0x3162('0x16'),_0x3919e7[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x3919e7[_0x3162('0x13')]));});});};exports[_0x3162('0x1d')]=function(_0x356c5d){var _0x8fa09f=this;return new Promise(function(_0x2f62d7,_0x1c03a4){var _0x48de45=require(_0x3162('0x1e'));var _0x552469;return db[_0x3162('0x1f')][_0x3162('0x20')]({'attributes':['id',_0x3162('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x4903e7){_0x552469=_0x4903e7;return db[_0x3162('0x17')][_0x3162('0x22')](_0x356c5d[_0x3162('0x19')]);})[_0x3162('0xa')](function(_0x2f88ec){if(_0x552469['callRecordingEncryption']&&fs[_0x3162('0x23')](_0x2f88ec['value'])){var _0xf11765=util[_0x3162('0x24')](_0x3162('0x25'),_0x2f88ec[_0x3162('0x26')]);return _0x48de45[_0x3162('0x27')](_0x2f88ec[_0x3162('0x26')],_0xf11765,config[_0x3162('0x28')][_0x3162('0x29')])['then'](function(){fs[_0x3162('0x2a')](_0x2f88ec[_0x3162('0x26')]);logger['info'](_0x3162('0x2b'));return _0x2f88ec;});}return _0x2f88ec;})[_0x3162('0xa')](function(_0x528340){logger['info'](_0x3162('0x1d'),_0x356c5d);logger['debug'](_0x3162('0x1d'),_0x356c5d,JSON[_0x3162('0xf')](_0x528340));_0x2f62d7(_0x528340);})[_0x3162('0x15')](function(_0x551442){logger['error'](_0x3162('0x1d'),_0x551442[_0x3162('0x13')],_0x356c5d);_0x1c03a4(_0x8fa09f['error'](0x1f4,_0x551442[_0x3162('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b087639..639597e 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 _0x361b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xaee3c3,_0x4d1e48){var _0x2cf888=function(_0x80d163){while(--_0x80d163){_0xaee3c3['push'](_0xaee3c3['shift']());}};_0x2cf888(++_0x4d1e48);}(_0x361b,0x15d));var _0xb361=function(_0xbb782b,_0x677675){_0xbb782b=_0xbb782b-0x0;var _0x4778d7=_0x361b[_0xbb782b];return _0x4778d7;};'use strict';var multer=require(_0xb361('0x0'));var util=require(_0xb361('0x1'));var path=require('path');var timeout=require(_0xb361('0x2'));var express=require(_0xb361('0x3'));var router=express[_0xb361('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb361('0x5'));var interaction=require(_0xb361('0x6'));var config=require(_0xb361('0x7'));var controller=require(_0xb361('0x8'));router[_0xb361('0x9')]('/',auth[_0xb361('0xa')](),controller[_0xb361('0xb')]);router[_0xb361('0x9')](_0xb361('0xc'),auth[_0xb361('0xa')](),controller['describe']);router[_0xb361('0x9')](_0xb361('0xd'),auth[_0xb361('0xa')](),controller[_0xb361('0xe')]);router[_0xb361('0xf')]('/',auth[_0xb361('0xa')](),controller[_0xb361('0x10')]);router[_0xb361('0x11')]('/:id',auth[_0xb361('0xa')](),controller[_0xb361('0x12')]);router[_0xb361('0x13')](_0xb361('0xd'),auth[_0xb361('0xa')](),controller[_0xb361('0x14')]);module[_0xb361('0x15')]=router; \ No newline at end of file +var _0x8442=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','post','/:id','destroy'];(function(_0x5eb6f7,_0x46ed64){var _0x43c94d=function(_0x426b07){while(--_0x426b07){_0x5eb6f7['push'](_0x5eb6f7['shift']());}};_0x43c94d(++_0x46ed64);}(_0x8442,0x186));var _0x2844=function(_0x5a0f67,_0x1f9421){_0x5a0f67=_0x5a0f67-0x0;var _0x21a0db=_0x8442[_0x5a0f67];return _0x21a0db;};'use strict';var multer=require(_0x2844('0x0'));var util=require(_0x2844('0x1'));var path=require('path');var timeout=require(_0x2844('0x2'));var express=require(_0x2844('0x3'));var router=express[_0x2844('0x4')]();var fs_extra=require(_0x2844('0x5'));var auth=require(_0x2844('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2844('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x2844('0x8')]('/',auth[_0x2844('0x9')](),controller[_0x2844('0xa')]);router[_0x2844('0x8')]('/describe',auth[_0x2844('0x9')](),controller[_0x2844('0xb')]);router[_0x2844('0x8')]('/:id',auth[_0x2844('0x9')](),controller['show']);router[_0x2844('0xc')]('/',auth[_0x2844('0x9')](),controller['create']);router['put'](_0x2844('0xd'),auth[_0x2844('0x9')](),controller['update']);router['delete']('/:id',auth[_0x2844('0x9')](),controller[_0x2844('0xe')]);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 91afefe..15d03b6 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 _0x761a=['ENUM','moment','blind','attended','STRING'];(function(_0x5aa6bb,_0x2177d5){var _0x2bf5e0=function(_0x5e1f2d){while(--_0x5e1f2d){_0x5aa6bb['push'](_0x5aa6bb['shift']());}};_0x2bf5e0(++_0x2177d5);}(_0x761a,0xe2));var _0xa761=function(_0x2f2960,_0x3f334d){_0x2f2960=_0x2f2960-0x0;var _0x47951c=_0x761a[_0x2f2960];return _0x47951c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa761('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa761('0x1'),_0xa761('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa761('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xa761('0x3')]},'transferercalleridname':{'type':Sequelize[_0xa761('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xa761('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa761('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xa761('0x3')]},'transfereechannel':{'type':Sequelize[_0xa761('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xa761('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xa761('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa761('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa761('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xa761('0x3')]},'transfereecontext':{'type':Sequelize[_0xa761('0x3')]},'transfereeexten':{'type':Sequelize[_0xa761('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xa761('0x4')]('Yes','No')},'context':{'type':Sequelize[_0xa761('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2bf2=['STRING','ENUM','Yes','sequelize','exports','blind','attended'];(function(_0x55cb9f,_0x64654d){var _0x272a75=function(_0x2d4f90){while(--_0x2d4f90){_0x55cb9f['push'](_0x55cb9f['shift']());}};_0x272a75(++_0x64654d);}(_0x2bf2,0x1d1));var _0x22bf=function(_0x39e06f,_0x9a2555){_0x39e06f=_0x39e06f-0x0;var _0x389749=_0x2bf2[_0x39e06f];return _0x389749;};'use strict';var Sequelize=require(_0x22bf('0x0'));var moment=require('moment');module[_0x22bf('0x1')]={'type':{'type':Sequelize['ENUM'](_0x22bf('0x2'),_0x22bf('0x3'))},'result':{'type':Sequelize[_0x22bf('0x4')]},'transfererchannel':{'type':Sequelize[_0x22bf('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x22bf('0x4')]},'transferercalleridname':{'type':Sequelize[_0x22bf('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x22bf('0x4')]},'transfererexten':{'type':Sequelize[_0x22bf('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x22bf('0x4')]},'transfereechannel':{'type':Sequelize[_0x22bf('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x22bf('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x22bf('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x22bf('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x22bf('0x4')]},'transfereecontext':{'type':Sequelize[_0x22bf('0x4')]},'transfereeexten':{'type':Sequelize[_0x22bf('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x22bf('0x4')]},'isexternal':{'type':Sequelize[_0x22bf('0x5')](_0x22bf('0x6'),'No')},'context':{'type':Sequelize[_0x22bf('0x4')]},'extension':{'type':Sequelize[_0x22bf('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 17d98cb..c5410d8 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 _0x829e=['options','VoiceTransferReport','includeAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x829e,0x123));var _0xe829=function(_0x5a0601,_0x562ea7){_0x5a0601=_0x5a0601-0x0;var _0x61b297=_0x829e[_0x5a0601];return _0x61b297;};'use strict';var emlformat=require(_0xe829('0x0'));var rimraf=require(_0xe829('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe829('0x2'));var rp=require(_0xe829('0x3'));var moment=require(_0xe829('0x4'));var BPromise=require(_0xe829('0x5'));var Mustache=require(_0xe829('0x6'));var util=require('util');var path=require(_0xe829('0x7'));var sox=require('sox');var csv=require(_0xe829('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe829('0x9'));var _=require(_0xe829('0xa'));var squel=require(_0xe829('0xb'));var crypto=require(_0xe829('0xc'));var jsforce=require(_0xe829('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe829('0x8'));var querystring=require(_0xe829('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe829('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe829('0x10'));var utils=require(_0xe829('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe829('0x12'));var db=require(_0xe829('0x13'))['db'];function respondWithStatusCode(_0x226ef2,_0x445985){_0x445985=_0x445985||0xcc;return function(_0x298847){if(_0x298847){return _0x226ef2[_0xe829('0x14')](_0x445985);}return _0x226ef2[_0xe829('0x15')](_0x445985)['end']();};}function respondWithResult(_0x13ed8e,_0x58269c){_0x58269c=_0x58269c||0xc8;return function(_0x440ab4){if(_0x440ab4){return _0x13ed8e['status'](_0x58269c)[_0xe829('0x16')](_0x440ab4);}};}function respondWithFilteredResult(_0x246eba,_0x9c919a){return function(_0x3597be){if(_0x3597be){var _0x35a74c=typeof _0x9c919a[_0xe829('0x17')]==='undefined'&&typeof _0x9c919a[_0xe829('0x18')]==='undefined';var _0x590a7a=_0x3597be['count'];var _0x4703a0=_0x35a74c?0x0:_0x9c919a[_0xe829('0x17')];var _0x20d76a=_0x35a74c?_0x3597be[_0xe829('0x19')]:_0x9c919a[_0xe829('0x17')]+_0x9c919a[_0xe829('0x18')];var _0x30742d;if(_0x20d76a>=_0x590a7a){_0x20d76a=_0x590a7a;_0x30742d=0xc8;}else{_0x30742d=0xce;}_0x246eba[_0xe829('0x15')](_0x30742d);return _0x246eba[_0xe829('0x1a')](_0xe829('0x1b'),_0x4703a0+'-'+_0x20d76a+'/'+_0x590a7a)['json'](_0x3597be);}return null;};}function patchUpdates(_0x1dd0bb){return function(_0x4bd9e3){try{jsonpatch[_0xe829('0x1c')](_0x4bd9e3,_0x1dd0bb,!![]);}catch(_0x4d1d78){return BPromise[_0xe829('0x1d')](_0x4d1d78);}return _0x4bd9e3[_0xe829('0x1e')]();};}function saveUpdates(_0xfe59da,_0x86263d){return function(_0x47ae1b){if(_0x47ae1b){return _0x47ae1b[_0xe829('0x1f')](_0xfe59da)[_0xe829('0x20')](function(_0x5e025d){return _0x5e025d;});}return null;};}function removeEntity(_0x1cd80a,_0x4f1319){return function(_0x4d3dba){if(_0x4d3dba){return _0x4d3dba[_0xe829('0x21')]()[_0xe829('0x20')](function(){_0x1cd80a[_0xe829('0x15')](0xcc)[_0xe829('0x22')]();});}};}function handleEntityNotFound(_0x1fb450,_0x3a8d48){return function(_0x1a7a00){if(!_0x1a7a00){_0x1fb450[_0xe829('0x14')](0x194);}return _0x1a7a00;};}function handleError(_0x89b16a,_0x2ebfbe){_0x2ebfbe=_0x2ebfbe||0x1f4;return function(_0x53a0cf){logger['error'](_0x53a0cf['stack']);if(_0x53a0cf[_0xe829('0x23')]){delete _0x53a0cf[_0xe829('0x23')];}_0x89b16a[_0xe829('0x15')](_0x2ebfbe)[_0xe829('0x24')](_0x53a0cf);};}exports[_0xe829('0x25')]=function(_0x5091ff,_0x5995b4){var _0x32dd50={},_0x22e7d2={},_0x19b248={'count':0x0,'rows':[]};var _0x280800=_[_0xe829('0x26')](db['VoiceTransferReport'][_0xe829('0x27')],function(_0x1c715a){return{'name':_0x1c715a[_0xe829('0x28')],'type':_0x1c715a[_0xe829('0x29')][_0xe829('0x2a')]};});_0x22e7d2[_0xe829('0x2b')]=_['map'](_0x280800,_0xe829('0x23'));_0x22e7d2[_0xe829('0x2c')]=_[_0xe829('0x2d')](_0x5091ff[_0xe829('0x2c')]);_0x22e7d2[_0xe829('0x2e')]=_[_0xe829('0x2f')](_0x22e7d2[_0xe829('0x2b')],_0x22e7d2[_0xe829('0x2c')]);_0x32dd50[_0xe829('0x30')]=_['intersection'](_0x22e7d2[_0xe829('0x2b')],qs[_0xe829('0x31')](_0x5091ff[_0xe829('0x2c')][_0xe829('0x31')]));_0x32dd50[_0xe829('0x30')]=_0x32dd50['attributes'][_0xe829('0x32')]?_0x32dd50[_0xe829('0x30')]:_0x22e7d2[_0xe829('0x2b')];if(!_0x5091ff['query'][_0xe829('0x33')](_0xe829('0x34'))){_0x32dd50[_0xe829('0x18')]=qs[_0xe829('0x18')](_0x5091ff[_0xe829('0x2c')]['limit']);_0x32dd50['offset']=qs[_0xe829('0x17')](_0x5091ff[_0xe829('0x2c')][_0xe829('0x17')]);}_0x32dd50[_0xe829('0x35')]=qs[_0xe829('0x36')](_0x5091ff[_0xe829('0x2c')][_0xe829('0x36')]);_0x32dd50[_0xe829('0x37')]=qs[_0xe829('0x2e')](_[_0xe829('0x38')](_0x5091ff[_0xe829('0x2c')],_0x22e7d2[_0xe829('0x2e')]),_0x280800);if(_0x5091ff['query']['filter']){_0x32dd50[_0xe829('0x37')]=_['merge'](_0x32dd50[_0xe829('0x37')],{'$or':_['map'](_0x280800,function(_0x535f00){if(_0x535f00[_0xe829('0x29')]!==_0xe829('0x39')){var _0x384b7a={};_0x384b7a[_0x535f00[_0xe829('0x23')]]={'$like':'%'+_0x5091ff[_0xe829('0x2c')][_0xe829('0x3a')]+'%'};return _0x384b7a;}})});}_0x32dd50=_['merge']({},_0x32dd50,_0x5091ff[_0xe829('0x3b')]);var _0x6dd86d={'where':_0x32dd50[_0xe829('0x37')]};return db[_0xe829('0x3c')][_0xe829('0x19')](_0x6dd86d)[_0xe829('0x20')](function(_0x25701d){_0x19b248[_0xe829('0x19')]=_0x25701d;if(_0x5091ff['query'][_0xe829('0x3d')]){_0x32dd50['include']=[{'all':!![]}];}return db[_0xe829('0x3c')]['findAll'](_0x32dd50);})['then'](function(_0x248215){_0x19b248[_0xe829('0x3e')]=_0x248215;return _0x19b248;})[_0xe829('0x20')](respondWithFilteredResult(_0x5995b4,_0x32dd50))[_0xe829('0x3f')](handleError(_0x5995b4,null));};exports[_0xe829('0x40')]=function(_0x110d2a,_0x1d9ae7){var _0xa2ed8c={'raw':!![],'where':{'id':_0x110d2a['params']['id']}},_0x33408d={};_0x33408d[_0xe829('0x2b')]=_['keys'](db['VoiceTransferReport'][_0xe829('0x27')]);_0x33408d['query']=_[_0xe829('0x2d')](_0x110d2a[_0xe829('0x2c')]);_0x33408d[_0xe829('0x2e')]=_[_0xe829('0x2f')](_0x33408d['model'],_0x33408d[_0xe829('0x2c')]);_0xa2ed8c['attributes']=_[_0xe829('0x2f')](_0x33408d[_0xe829('0x2b')],qs[_0xe829('0x31')](_0x110d2a[_0xe829('0x2c')][_0xe829('0x31')]));_0xa2ed8c[_0xe829('0x30')]=_0xa2ed8c[_0xe829('0x30')][_0xe829('0x32')]?_0xa2ed8c[_0xe829('0x30')]:_0x33408d[_0xe829('0x2b')];if(_0x110d2a[_0xe829('0x2c')][_0xe829('0x3d')]){_0xa2ed8c['include']=[{'all':!![]}];}_0xa2ed8c=_['merge']({},_0xa2ed8c,_0x110d2a['options']);return db[_0xe829('0x3c')]['find'](_0xa2ed8c)[_0xe829('0x20')](handleEntityNotFound(_0x1d9ae7,null))['then'](respondWithResult(_0x1d9ae7,null))[_0xe829('0x3f')](handleError(_0x1d9ae7,null));};exports[_0xe829('0x41')]=function(_0x2a6fe6,_0x351624){return db[_0xe829('0x3c')]['create'](_0x2a6fe6['body'],{})['then'](respondWithResult(_0x351624,0xc9))[_0xe829('0x3f')](handleError(_0x351624,null));};exports[_0xe829('0x1f')]=function(_0x5f2cb1,_0x1a3883){if(_0x5f2cb1[_0xe829('0x42')]['id']){delete _0x5f2cb1[_0xe829('0x42')]['id'];}return db[_0xe829('0x3c')][_0xe829('0x43')]({'where':{'id':_0x5f2cb1[_0xe829('0x44')]['id']}})[_0xe829('0x20')](handleEntityNotFound(_0x1a3883,null))[_0xe829('0x20')](saveUpdates(_0x5f2cb1['body'],null))[_0xe829('0x20')](respondWithResult(_0x1a3883,null))[_0xe829('0x3f')](handleError(_0x1a3883,null));};exports[_0xe829('0x21')]=function(_0xe53455,_0x5e846c){return db[_0xe829('0x3c')][_0xe829('0x43')]({'where':{'id':_0xe53455[_0xe829('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e846c,null))[_0xe829('0x20')](removeEntity(_0x5e846c,null))['catch'](handleError(_0x5e846c,null));};exports['describe']=function(_0x1ca4d7,_0x1707de){return db[_0xe829('0x3c')][_0xe829('0x45')]()[_0xe829('0x20')](respondWithResult(_0x1707de,null))[_0xe829('0x3f')](handleError(_0x1707de,null));}; \ No newline at end of file +var _0xa5be=['name','send','index','map','VoiceTransferReport','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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'];(function(_0x55dd60,_0x479fb7){var _0x505abb=function(_0x5429c9){while(--_0x5429c9){_0x55dd60['push'](_0x55dd60['shift']());}};_0x505abb(++_0x479fb7);}(_0xa5be,0x15a));var _0xea5b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa5be[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xea5b('0x0'));var rimraf=require(_0xea5b('0x1'));var zipdir=require(_0xea5b('0x2'));var jsonpatch=require(_0xea5b('0x3'));var rp=require('request-promise');var moment=require(_0xea5b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea5b('0x5'));var util=require(_0xea5b('0x6'));var path=require(_0xea5b('0x7'));var sox=require(_0xea5b('0x8'));var csv=require(_0xea5b('0x9'));var ejs=require(_0xea5b('0xa'));var fs=require('fs');var fs_extra=require(_0xea5b('0xb'));var _=require(_0xea5b('0xc'));var squel=require(_0xea5b('0xd'));var crypto=require(_0xea5b('0xe'));var jsforce=require(_0xea5b('0xf'));var deskjs=require(_0xea5b('0x10'));var toCsv=require(_0xea5b('0x9'));var querystring=require(_0xea5b('0x11'));var Papa=require(_0xea5b('0x12'));var Redis=require(_0xea5b('0x13'));var authService=require(_0xea5b('0x14'));var qs=require(_0xea5b('0x15'));var as=require(_0xea5b('0x16'));var hardwareService=require(_0xea5b('0x17'));var logger=require(_0xea5b('0x18'))(_0xea5b('0x19'));var utils=require('../../config/utils');var config=require(_0xea5b('0x1a'));var licenseUtil=require(_0xea5b('0x1b'));var db=require(_0xea5b('0x1c'))['db'];function respondWithStatusCode(_0x8ea1e6,_0x4e2299){_0x4e2299=_0x4e2299||0xcc;return function(_0xfb6be1){if(_0xfb6be1){return _0x8ea1e6[_0xea5b('0x1d')](_0x4e2299);}return _0x8ea1e6[_0xea5b('0x1e')](_0x4e2299)[_0xea5b('0x1f')]();};}function respondWithResult(_0x4e07aa,_0xb74bdd){_0xb74bdd=_0xb74bdd||0xc8;return function(_0x1eab86){if(_0x1eab86){return _0x4e07aa[_0xea5b('0x1e')](_0xb74bdd)[_0xea5b('0x20')](_0x1eab86);}};}function respondWithFilteredResult(_0x3a6f23,_0x5f4aed){return function(_0x364707){if(_0x364707){var _0x34c7cb=typeof _0x5f4aed[_0xea5b('0x21')]===_0xea5b('0x22')&&typeof _0x5f4aed[_0xea5b('0x23')]==='undefined';var _0x238a09=_0x364707[_0xea5b('0x24')];var _0x1f5ee0=_0x34c7cb?0x0:_0x5f4aed['offset'];var _0x16af5c=_0x34c7cb?_0x364707[_0xea5b('0x24')]:_0x5f4aed[_0xea5b('0x21')]+_0x5f4aed[_0xea5b('0x23')];var _0x1354a3;if(_0x16af5c>=_0x238a09){_0x16af5c=_0x238a09;_0x1354a3=0xc8;}else{_0x1354a3=0xce;}_0x3a6f23[_0xea5b('0x1e')](_0x1354a3);return _0x3a6f23['set'](_0xea5b('0x25'),_0x1f5ee0+'-'+_0x16af5c+'/'+_0x238a09)['json'](_0x364707);}return null;};}function patchUpdates(_0xa865f2){return function(_0x590ede){try{jsonpatch['apply'](_0x590ede,_0xa865f2,!![]);}catch(_0x5853ba){return BPromise[_0xea5b('0x26')](_0x5853ba);}return _0x590ede[_0xea5b('0x27')]();};}function saveUpdates(_0x3afd4d,_0x2e8cfb){return function(_0x37039d){if(_0x37039d){return _0x37039d[_0xea5b('0x28')](_0x3afd4d)[_0xea5b('0x29')](function(_0x4f3010){return _0x4f3010;});}return null;};}function removeEntity(_0x411624,_0x57f31e){return function(_0x310ad3){if(_0x310ad3){return _0x310ad3[_0xea5b('0x2a')]()[_0xea5b('0x29')](function(){_0x411624[_0xea5b('0x1e')](0xcc)[_0xea5b('0x1f')]();});}};}function handleEntityNotFound(_0x1a5b97,_0x2758ca){return function(_0x2eb960){if(!_0x2eb960){_0x1a5b97[_0xea5b('0x1d')](0x194);}return _0x2eb960;};}function handleError(_0x437b7b,_0x31698b){_0x31698b=_0x31698b||0x1f4;return function(_0x15f0ce){logger[_0xea5b('0x2b')](_0x15f0ce['stack']);if(_0x15f0ce[_0xea5b('0x2c')]){delete _0x15f0ce[_0xea5b('0x2c')];}_0x437b7b[_0xea5b('0x1e')](_0x31698b)[_0xea5b('0x2d')](_0x15f0ce);};}exports[_0xea5b('0x2e')]=function(_0xcebf45,_0x44e0d3){var _0x5b1827={},_0x574934={},_0x18199c={'count':0x0,'rows':[]};var _0x2692f0=_[_0xea5b('0x2f')](db[_0xea5b('0x30')]['rawAttributes'],function(_0x7b34b6){return{'name':_0x7b34b6['fieldName'],'type':_0x7b34b6['type']['key']};});_0x574934[_0xea5b('0x31')]=_[_0xea5b('0x2f')](_0x2692f0,'name');_0x574934[_0xea5b('0x32')]=_[_0xea5b('0x33')](_0xcebf45['query']);_0x574934[_0xea5b('0x34')]=_[_0xea5b('0x35')](_0x574934['model'],_0x574934[_0xea5b('0x32')]);_0x5b1827['attributes']=_[_0xea5b('0x35')](_0x574934['model'],qs[_0xea5b('0x36')](_0xcebf45[_0xea5b('0x32')][_0xea5b('0x36')]));_0x5b1827[_0xea5b('0x37')]=_0x5b1827['attributes'][_0xea5b('0x38')]?_0x5b1827[_0xea5b('0x37')]:_0x574934[_0xea5b('0x31')];if(!_0xcebf45[_0xea5b('0x32')][_0xea5b('0x39')](_0xea5b('0x3a'))){_0x5b1827[_0xea5b('0x23')]=qs[_0xea5b('0x23')](_0xcebf45[_0xea5b('0x32')][_0xea5b('0x23')]);_0x5b1827[_0xea5b('0x21')]=qs['offset'](_0xcebf45[_0xea5b('0x32')][_0xea5b('0x21')]);}_0x5b1827[_0xea5b('0x3b')]=qs['sort'](_0xcebf45['query'][_0xea5b('0x3c')]);_0x5b1827[_0xea5b('0x3d')]=qs[_0xea5b('0x34')](_[_0xea5b('0x3e')](_0xcebf45[_0xea5b('0x32')],_0x574934[_0xea5b('0x34')]),_0x2692f0);if(_0xcebf45[_0xea5b('0x32')]['filter']){_0x5b1827[_0xea5b('0x3d')]=_['merge'](_0x5b1827['where'],{'$or':_[_0xea5b('0x2f')](_0x2692f0,function(_0x5b6b9d){if(_0x5b6b9d['type']!==_0xea5b('0x3f')){var _0xeb079a={};_0xeb079a[_0x5b6b9d['name']]={'$like':'%'+_0xcebf45[_0xea5b('0x32')][_0xea5b('0x40')]+'%'};return _0xeb079a;}})});}_0x5b1827=_[_0xea5b('0x41')]({},_0x5b1827,_0xcebf45['options']);var _0x490c85={'where':_0x5b1827['where']};return db[_0xea5b('0x30')]['count'](_0x490c85)[_0xea5b('0x29')](function(_0x406996){_0x18199c[_0xea5b('0x24')]=_0x406996;if(_0xcebf45[_0xea5b('0x32')]['includeAll']){_0x5b1827[_0xea5b('0x42')]=[{'all':!![]}];}return db[_0xea5b('0x30')][_0xea5b('0x43')](_0x5b1827);})['then'](function(_0x21e9f2){_0x18199c[_0xea5b('0x44')]=_0x21e9f2;return _0x18199c;})[_0xea5b('0x29')](respondWithFilteredResult(_0x44e0d3,_0x5b1827))['catch'](handleError(_0x44e0d3,null));};exports[_0xea5b('0x45')]=function(_0x1d4705,_0x777a47){var _0x465ca6={'raw':!![],'where':{'id':_0x1d4705[_0xea5b('0x46')]['id']}},_0x36b503={};_0x36b503[_0xea5b('0x31')]=_[_0xea5b('0x33')](db[_0xea5b('0x30')][_0xea5b('0x47')]);_0x36b503[_0xea5b('0x32')]=_[_0xea5b('0x33')](_0x1d4705[_0xea5b('0x32')]);_0x36b503[_0xea5b('0x34')]=_[_0xea5b('0x35')](_0x36b503['model'],_0x36b503[_0xea5b('0x32')]);_0x465ca6[_0xea5b('0x37')]=_[_0xea5b('0x35')](_0x36b503['model'],qs[_0xea5b('0x36')](_0x1d4705[_0xea5b('0x32')][_0xea5b('0x36')]));_0x465ca6['attributes']=_0x465ca6['attributes']['length']?_0x465ca6[_0xea5b('0x37')]:_0x36b503['model'];if(_0x1d4705['query'][_0xea5b('0x48')]){_0x465ca6[_0xea5b('0x42')]=[{'all':!![]}];}_0x465ca6=_[_0xea5b('0x41')]({},_0x465ca6,_0x1d4705[_0xea5b('0x49')]);return db[_0xea5b('0x30')][_0xea5b('0x4a')](_0x465ca6)['then'](handleEntityNotFound(_0x777a47,null))[_0xea5b('0x29')](respondWithResult(_0x777a47,null))[_0xea5b('0x4b')](handleError(_0x777a47,null));};exports[_0xea5b('0x4c')]=function(_0x590103,_0xbf14f1){return db[_0xea5b('0x30')]['create'](_0x590103['body'],{})[_0xea5b('0x29')](respondWithResult(_0xbf14f1,0xc9))[_0xea5b('0x4b')](handleError(_0xbf14f1,null));};exports[_0xea5b('0x28')]=function(_0x51effa,_0xaf1ec7){if(_0x51effa[_0xea5b('0x4d')]['id']){delete _0x51effa[_0xea5b('0x4d')]['id'];}return db[_0xea5b('0x30')][_0xea5b('0x4a')]({'where':{'id':_0x51effa['params']['id']}})['then'](handleEntityNotFound(_0xaf1ec7,null))[_0xea5b('0x29')](saveUpdates(_0x51effa[_0xea5b('0x4d')],null))[_0xea5b('0x29')](respondWithResult(_0xaf1ec7,null))['catch'](handleError(_0xaf1ec7,null));};exports['destroy']=function(_0x10e1cb,_0x5990ea){return db[_0xea5b('0x30')][_0xea5b('0x4a')]({'where':{'id':_0x10e1cb[_0xea5b('0x46')]['id']}})[_0xea5b('0x29')](handleEntityNotFound(_0x5990ea,null))[_0xea5b('0x29')](removeEntity(_0x5990ea,null))['catch'](handleError(_0x5990ea,null));};exports['describe']=function(_0x2495e0,_0x16ba09){return db['VoiceTransferReport']['describe']()[_0xea5b('0x29')](respondWithResult(_0x16ba09,null))[_0xea5b('0x4b')](handleError(_0x16ba09,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 776e88d..25868c3 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 _0xfcb9=['util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash'];(function(_0x575657,_0x21734e){var _0x14c77b=function(_0x455521){while(--_0x455521){_0x575657['push'](_0x575657['shift']());}};_0x14c77b(++_0x21734e);}(_0xfcb9,0x15f));var _0x9fcb=function(_0x584b8c,_0x3a2cf7){_0x584b8c=_0x584b8c-0x0;var _0x474a89=_0xfcb9[_0x584b8c];return _0x474a89;};'use strict';var _=require(_0x9fcb('0x0'));var util=require(_0x9fcb('0x1'));var logger=require('../../config/logger')(_0x9fcb('0x2'));var moment=require(_0x9fcb('0x3'));var BPromise=require(_0x9fcb('0x4'));var rp=require(_0x9fcb('0x5'));var fs=require('fs');var path=require(_0x9fcb('0x6'));var rimraf=require('rimraf');var config=require(_0x9fcb('0x7'));var attributes=require(_0x9fcb('0x8'));module[_0x9fcb('0x9')]=function(_0x33d01b,_0x48f2de){return _0x33d01b['define']('VoiceTransferReport',attributes,{'tableName':_0x9fcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27fc=['bluebird','request-promise','path','rimraf','../../config/environment','exports','report_call_transfer','lodash','../../config/logger','api','moment'];(function(_0x41a765,_0x4a1742){var _0x39dbd6=function(_0x527776){while(--_0x527776){_0x41a765['push'](_0x41a765['shift']());}};_0x39dbd6(++_0x4a1742);}(_0x27fc,0x1b4));var _0xc27f=function(_0x324e58,_0x5667bf){_0x324e58=_0x324e58-0x0;var _0x41bda1=_0x27fc[_0x324e58];return _0x41bda1;};'use strict';var _=require(_0xc27f('0x0'));var util=require('util');var logger=require(_0xc27f('0x1'))(_0xc27f('0x2'));var moment=require(_0xc27f('0x3'));var BPromise=require(_0xc27f('0x4'));var rp=require(_0xc27f('0x5'));var fs=require('fs');var path=require(_0xc27f('0x6'));var rimraf=require(_0xc27f('0x7'));var config=require(_0xc27f('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xc27f('0x9')]=function(_0x120390,_0x21933){return _0x120390['define']('VoiceTransferReport',attributes,{'tableName':_0xc27f('0xa'),'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 c26319b..73cbed2 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 _0x6464=['stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','create','raw','then','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x1d6527,_0x2f2bf8){var _0x1cdb65=function(_0x3a980b){while(--_0x3a980b){_0x1d6527['push'](_0x1d6527['shift']());}};_0x1cdb65(++_0x2f2bf8);}(_0x6464,0x14f));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4646('0x0'));var util=require(_0x4646('0x1'));var moment=require('moment');var BPromise=require(_0x4646('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4646('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4646('0x4'));var logger=require(_0x4646('0x5'))(_0x4646('0x6'));var config=require(_0x4646('0x7'));var jayson=require(_0x4646('0x8'));var client=jayson[_0x4646('0x9')][_0x4646('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x251f0d,_0x4f0303,_0x208ce6){return new BPromise(function(_0x4999e0,_0x31360c){return client[_0x4646('0xb')](_0x251f0d,_0x208ce6)['then'](function(_0x26d617){logger[_0x4646('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f0303,_0x4646('0xd'));logger[_0x4646('0xe')](_0x4646('0xf'),_0x4f0303,_0x4646('0xd'),JSON[_0x4646('0x10')](_0x26d617));if(_0x26d617[_0x4646('0x11')]){if(_0x26d617[_0x4646('0x11')][_0x4646('0x12')]===0x1f4){logger[_0x4646('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f0303,_0x26d617[_0x4646('0x11')][_0x4646('0x13')]);return _0x31360c(_0x26d617[_0x4646('0x11')]['message']);}logger[_0x4646('0x11')](_0x4646('0x14'),_0x4f0303,_0x26d617['error'][_0x4646('0x13')]);return _0x4999e0(_0x26d617[_0x4646('0x11')][_0x4646('0x13')]);}else{logger[_0x4646('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f0303,_0x4646('0xd'));_0x4999e0(_0x26d617[_0x4646('0x15')][_0x4646('0x13')]);}})[_0x4646('0x16')](function(_0x4d9f02){logger[_0x4646('0x11')](_0x4646('0x14'),_0x4f0303,_0x4d9f02);_0x31360c(_0x4d9f02);});});}exports[_0x4646('0x17')]=function(_0x4c777c){var _0x3dcff1=this;return new Promise(function(_0x57ff7d,_0x4ec1ef){return db['VoiceTransferReport'][_0x4646('0x18')](_0x4c777c['body'],{'raw':_0x4c777c['options']?_0x4c777c['options'][_0x4646('0x19')]===undefined?!![]:![]:!![]})[_0x4646('0x1a')](function(_0x1b10eb){logger[_0x4646('0xc')](_0x4646('0x17'),_0x4c777c);logger[_0x4646('0xe')]('CreateVoiceTransferReport',_0x4c777c,JSON['stringify'](_0x1b10eb));_0x57ff7d(_0x1b10eb);})['catch'](function(_0x445476){logger[_0x4646('0x11')](_0x4646('0x17'),_0x445476[_0x4646('0x13')],_0x4c777c);_0x4ec1ef(_0x3dcff1['error'](0x1f4,_0x445476[_0x4646('0x13')]));});});}; \ No newline at end of file +var _0xb478=['info','request\x20sent','debug','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x3ff1a1,_0x209a5c){var _0x323cee=function(_0x293a3a){while(--_0x293a3a){_0x3ff1a1['push'](_0x3ff1a1['shift']());}};_0x323cee(++_0x209a5c);}(_0xb478,0x1b6));var _0x8b47=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0xb478[_0x4baac8];return _0x56ebc5;};'use strict';var _=require(_0x8b47('0x0'));var util=require(_0x8b47('0x1'));var moment=require(_0x8b47('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b47('0x3'));var fs=require('fs');var Redis=require(_0x8b47('0x4'));var db=require(_0x8b47('0x5'))['db'];var utils=require(_0x8b47('0x6'));var logger=require(_0x8b47('0x7'))(_0x8b47('0x8'));var config=require(_0x8b47('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10b415,_0x5a73d3,_0x1027d6){return new BPromise(function(_0x110026,_0x4effcf){return client[_0x8b47('0xa')](_0x10b415,_0x1027d6)[_0x8b47('0xb')](function(_0x27d4cf){logger[_0x8b47('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5a73d3,_0x8b47('0xd'));logger[_0x8b47('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5a73d3,'request\x20sent',JSON[_0x8b47('0xf')](_0x27d4cf));if(_0x27d4cf['error']){if(_0x27d4cf[_0x8b47('0x10')]['code']===0x1f4){logger[_0x8b47('0x10')](_0x8b47('0x11'),_0x5a73d3,_0x27d4cf['error'][_0x8b47('0x12')]);return _0x4effcf(_0x27d4cf[_0x8b47('0x10')][_0x8b47('0x12')]);}logger[_0x8b47('0x10')](_0x8b47('0x11'),_0x5a73d3,_0x27d4cf[_0x8b47('0x10')][_0x8b47('0x12')]);return _0x110026(_0x27d4cf[_0x8b47('0x10')][_0x8b47('0x12')]);}else{logger[_0x8b47('0xc')](_0x8b47('0x11'),_0x5a73d3,_0x8b47('0xd'));_0x110026(_0x27d4cf[_0x8b47('0x13')][_0x8b47('0x12')]);}})[_0x8b47('0x14')](function(_0x2bc6b8){logger['error'](_0x8b47('0x11'),_0x5a73d3,_0x2bc6b8);_0x4effcf(_0x2bc6b8);});});}exports[_0x8b47('0x15')]=function(_0x39e1a1){var _0x8fde=this;return new Promise(function(_0x3e5800,_0x308590){return db[_0x8b47('0x16')][_0x8b47('0x17')](_0x39e1a1['body'],{'raw':_0x39e1a1[_0x8b47('0x18')]?_0x39e1a1[_0x8b47('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x8b47('0xb')](function(_0x48ee7f){logger[_0x8b47('0xc')](_0x8b47('0x15'),_0x39e1a1);logger[_0x8b47('0xe')]('CreateVoiceTransferReport',_0x39e1a1,JSON[_0x8b47('0xf')](_0x48ee7f));_0x3e5800(_0x48ee7f);})[_0x8b47('0x14')](function(_0x2d13ba){logger[_0x8b47('0x10')](_0x8b47('0x15'),_0x2d13ba[_0x8b47('0x12')],_0x39e1a1);_0x308590(_0x8fde[_0x8b47('0x10')](0x1f4,_0x2d13ba[_0x8b47('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 457d111..6476767 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xcb91[_0x11a220];return _0x20d8fe;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x4f0198,_0x4d5451){var _0x574720=function(_0x50793b){while(--_0x50793b){_0x4f0198['push'](_0x4f0198['shift']());}};_0x574720(++_0x4d5451);}(_0x9a19,0x114));var _0x99a1=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9a19[_0x51020b];return _0x371e47;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 5471434..4bc371e 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 _0xad8a=['answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','user:%s','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','all','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup\x20executed!','answer'];(function(_0x366ca5,_0x46b5c1){var _0x24fc5a=function(_0x400138){while(--_0x400138){_0x366ca5['push'](_0x366ca5['shift']());}};_0x24fc5a(++_0x46b5c1);}(_0xad8a,0xb0));var _0xaad8=function(_0x46355b,_0x4144f4){_0x46355b=_0x46355b-0x0;var _0x35fb58=_0xad8a[_0x46355b];return _0x35fb58;};'use strict';var path=require(_0xaad8('0x0'));var fs=require('fs');var _=require(_0xaad8('0x1'));var db=require(_0xaad8('0x2'))['db'];var config=require(_0xaad8('0x3'));var util=require(_0xaad8('0x4'));var BPromise=require('bluebird');var jayson=require(_0xaad8('0x5'));var amiClient=jayson[_0xaad8('0x6')][_0xaad8('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xaad8('0x8'));var Redis=require(_0xaad8('0x9'));config[_0xaad8('0xa')]=_[_0xaad8('0xb')](config[_0xaad8('0xa')],{'host':_0xaad8('0xc'),'port':0x18eb});var io=require(_0xaad8('0xd'))(new Redis(config[_0xaad8('0xa')]));var Schema=require(_0xaad8('0xe'));var originateValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xaad8('0x10')]},'callerId':{'type':_0xaad8('0x11')},'callbackUrl':{'type':_0xaad8('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':[!![],_0xaad8('0x13')]},'transferNumber':{'type':_0xaad8('0x11'),'required':[!![],_0xaad8('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaad8('0x12')]}});function emit(_0xb63cb3,_0x511344,_0x1749d5){logger[_0xaad8('0x15')](_0xb63cb3,_0x511344,JSON[_0xaad8('0x16')](_0x1749d5));io['to'](_0xb63cb3)[_0xaad8('0x17')](_0x511344,_0x1749d5);}function handleError(_0x19ae08){return function(_0x3895e2){console['log'](_0xaad8('0x18'),_0x3895e2,_0x3895e2 instanceof RangeError);logger[_0xaad8('0x19')](_0x3895e2['stack']);if(_0x3895e2 instanceof RangeError){if(_0x3895e2[_0xaad8('0x1a')]){delete _0x3895e2['name'];}_0x19ae08[_0xaad8('0x1b')](0x194)[_0xaad8('0x1c')](_0x3895e2);}else{if(_0x3895e2[_0xaad8('0x1a')]){delete _0x3895e2[_0xaad8('0x1a')];}_0x19ae08['status'](0x1f4)[_0xaad8('0x1c')](_0x3895e2);}};}function checkError(){return function(_0x2c8fd8){if(!_0x2c8fd8){throw new RangeError('NotFound');}return _0x2c8fd8;};}function respondWithRpcPromise(_0x8bc75,_0x61542a){return new BPromise(function(_0x262e57,_0x5b4b61){var _0x5ba0fb=amiClient;return _0x5ba0fb[_0xaad8('0x1d')](_0x8bc75,_0x61542a)[_0xaad8('0x1e')](function(_0x3930f0){if(_0x3930f0[_0xaad8('0x19')]){if(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x1f')]===0x1f4){return _0x5b4b61(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x20')]);}return _0x262e57(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x20')]);}else{_0x262e57(_0x3930f0[_0xaad8('0x21')]);}})[_0xaad8('0x22')](function(_0x4193cb){_0x5b4b61(_0x4193cb);});});}function getAgent(_0x37c3f6){return db[_0xaad8('0x23')]['findOne']({'where':{'id':_0x37c3f6,'role':_0xaad8('0x24')}})[_0xaad8('0x1e')](checkError());}function getAgentCheckSession(_0x3f066f,_0x47b7a2){return new BPromise(function(_0x237c67,_0x37ca5c){var _0x36b180=respondWithRpcPromise(_0xaad8('0x25'));var _0x24c01d=getAgent(_0x3f066f);Promise['all']([_0x36b180,_0x24c01d])[_0xaad8('0x1e')](function(_0x43c489){var _0x1e253f=_0x43c489[0x0];var _0x31ad19=_0x43c489[0x1];var _0x151c26=_['filter'](_0x1e253f[_0xaad8('0x26')],function(_0x4030ea){return _0x4030ea[_0xaad8('0x27')]==_0x31ad19['id']&&_0x4030ea[_0xaad8('0x28')]==_0x47b7a2;});if(_0x151c26['length']==0x1){_0x237c67(_0x31ad19);}else{_0x37ca5c(new RangeError(_0xaad8('0x29')+_0x47b7a2+_0xaad8('0x2a')));}});});}exports[_0xaad8('0x2b')]=function(_0x1eaf8e,_0x254ee5){logger['info'](_0xaad8('0x2c'),_0x1eaf8e[_0xaad8('0x2d')]);var _0x4845a4=originateValidation['validate'](_0x1eaf8e[_0xaad8('0x2d')]);if(_0x4845a4[_0xaad8('0x2e')]>0x0){return _0x254ee5[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x4845a4);}var _0x501ce8=_0x1eaf8e[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x4b6c1a=_0x1eaf8e['body'][_0xaad8('0x31')];var _0x3689cb=_0x1eaf8e['body'][_0xaad8('0x32')];var _0x4fb0ae=_0x1eaf8e['body'][_0xaad8('0x33')];return getAgent(_0x501ce8)[_0xaad8('0x1e')](function(_0x54ab34){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x54ab34[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x54ab34[_0xaad8('0x1a')]),_0xaad8('0x36'),{'callNumber':_0x4b6c1a,'callerId':_0x3689cb,'callbackUrl':_0x4fb0ae});return _0x254ee5[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x37')});})[_0xaad8('0x22')](handleError(_0x254ee5));};exports['hangup']=function(_0x2aea32,_0x3d0244){logger[_0xaad8('0x15')]('hangup\x20fired:',_0x2aea32[_0xaad8('0x2d')]);var _0x39374b=hangupValidation[_0xaad8('0xe')](_0x2aea32[_0xaad8('0x2d')]);if(_0x39374b[_0xaad8('0x2e')]>0x0){return _0x3d0244[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x39374b);}var _0x4d3a4f=_0x2aea32[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x3e9af2=_0x2aea32[_0xaad8('0x2d')][_0xaad8('0x28')];return getAgent(_0x4d3a4f)[_0xaad8('0x1e')](function(_0x4e4081){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x4e4081[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x4e4081['name']),'webbar:hangup',{'sessionId':_0x3e9af2});return _0x3d0244[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x38')});})['catch'](handleError(_0x3d0244));};exports[_0xaad8('0x39')]=function(_0x355fc2,_0x4af930){logger[_0xaad8('0x15')](_0xaad8('0x3a'),_0x355fc2[_0xaad8('0x2d')]);var _0x292d4e=answerValidation[_0xaad8('0xe')](_0x355fc2[_0xaad8('0x2d')]);if(_0x292d4e[_0xaad8('0x2e')]>0x0){return _0x4af930[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x292d4e);}var _0xbd5191=_0x355fc2[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x4b5b76=_0x355fc2['body']['sessionId'];return getAgent(_0xbd5191)[_0xaad8('0x1e')](function(_0x5b0ad2){logger[_0xaad8('0x15')]('entityFound:',_0x5b0ad2['name']);emit(util[_0xaad8('0x35')]('user:%s',_0x5b0ad2[_0xaad8('0x1a')]),_0xaad8('0x3b'),{'sessionId':_0x4b5b76});return _0x4af930[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x3c')});})[_0xaad8('0x22')](handleError(_0x4af930));};exports[_0xaad8('0x3d')]=function(_0x1f920b,_0x233fd2){logger[_0xaad8('0x15')](_0xaad8('0x3e'),_0x1f920b[_0xaad8('0x2d')]);var _0x14a837=holdValidation[_0xaad8('0xe')](_0x1f920b[_0xaad8('0x2d')]);if(_0x14a837['length']>0x0){return _0x233fd2['status'](0x190)[_0xaad8('0x2f')](_0x14a837);}var _0x42cfa4=_0x1f920b[_0xaad8('0x2d')]['userId'];var _0x5e2117=_0x1f920b[_0xaad8('0x2d')]['sessionId'];return getAgent(_0x42cfa4)[_0xaad8('0x1e')](function(_0x1560ef){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x1560ef[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0x1560ef[_0xaad8('0x1a')]),_0xaad8('0x40'),{'sessionId':_0x5e2117});return _0x233fd2['status'](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x41')});})['catch'](handleError(_0x233fd2));};exports[_0xaad8('0x42')]=function(_0x5e5ef1,_0x2a2542){logger[_0xaad8('0x15')](_0xaad8('0x43'),_0x5e5ef1[_0xaad8('0x2d')]);var _0x4068ec=unholdValidation[_0xaad8('0xe')](_0x5e5ef1[_0xaad8('0x2d')]);if(_0x4068ec[_0xaad8('0x2e')]>0x0){return _0x2a2542[_0xaad8('0x1b')](0x190)['json'](_0x4068ec);}var _0x2461f7=_0x5e5ef1[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x13f11d=_0x5e5ef1[_0xaad8('0x2d')][_0xaad8('0x28')];return getAgent(_0x2461f7)['then'](function(_0x1e5127){logger[_0xaad8('0x15')]('entityFound:',_0x1e5127['name']);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0x1e5127[_0xaad8('0x1a')]),_0xaad8('0x44'),{'sessionId':_0x13f11d});return _0x2a2542[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xaad8('0x22')](handleError(_0x2a2542));};exports[_0xaad8('0x45')]=function(_0x3e6f4a,_0x1db8c2){logger[_0xaad8('0x15')]('calls\x20fired:',_0x1db8c2['body']);var _0x48edf6=callsValidation[_0xaad8('0xe')](_0x3e6f4a[_0xaad8('0x2d')]);if(_0x48edf6['length']>0x0){return _0x1db8c2[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x48edf6);}var _0x78a183=_0x3e6f4a['body'][_0xaad8('0x30')];var _0x49865e=respondWithRpcPromise(_0xaad8('0x25'));var _0x437266=getAgent(_0x78a183);return Promise[_0xaad8('0x46')]([_0x49865e,_0x437266])[_0xaad8('0x1e')](function(_0x5bd83e){var _0x9bb038=_0x5bd83e[0x0];var _0x1fe921=_0x5bd83e[0x1];var _0x5cf106=_['filter'](_0x9bb038[_0xaad8('0x26')],function(_0x4e64f5){return _0x4e64f5[_0xaad8('0x27')]==_0x1fe921['id'];});return _0x1db8c2[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'count':_0x5cf106[_0xaad8('0x2e')],'rows':_0x5cf106});})[_0xaad8('0x22')](handleError(_0x1db8c2));};exports[_0xaad8('0x47')]=function(_0x1d55fa,_0x2aaa54){logger[_0xaad8('0x15')]('conference\x20fired:',_0x1d55fa[_0xaad8('0x2d')]);var _0x34044d=conferenceValidation[_0xaad8('0xe')](_0x1d55fa[_0xaad8('0x2d')]);if(_0x34044d[_0xaad8('0x2e')]>0x0){return _0x2aaa54[_0xaad8('0x1b')](0x190)['json'](_0x34044d);}var _0x2abbe7=_0x1d55fa[_0xaad8('0x2d')][_0xaad8('0x30')];return getAgent(_0x2abbe7)['then'](function(_0x585380){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x585380[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x585380[_0xaad8('0x1a')]),_0xaad8('0x48'));return _0x2aaa54[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x49')});})['catch'](handleError(_0x2aaa54));};exports['transfer']=function(_0x2bcb8d,_0xb71d6f){logger[_0xaad8('0x15')](_0xaad8('0x4a'),_0x2bcb8d[_0xaad8('0x2d')]);var _0x739b8=transferValidation['validate'](_0x2bcb8d[_0xaad8('0x2d')]);if(_0x739b8[_0xaad8('0x2e')]>0x0){return _0xb71d6f[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x739b8);}var _0x30514f=_0x2bcb8d['body']['userId'];var _0x586a15=_0x2bcb8d[_0xaad8('0x2d')][_0xaad8('0x28')];var _0x500df3=_0x2bcb8d[_0xaad8('0x2d')][_0xaad8('0x4b')];return getAgent(_0x30514f)[_0xaad8('0x1e')](function(_0xe96206){logger[_0xaad8('0x15')]('entityFound:',_0xe96206[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0xe96206['name']),_0xaad8('0x4c'),{'sessionId':_0x586a15,'transferNumber':_0x500df3});return _0xb71d6f['status'](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x4d')});})['catch'](handleError(_0xb71d6f));}; \ No newline at end of file +var _0xad8a=['answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','user:%s','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','all','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','name','status','send','request','then','code','message','result','catch','User','agent','VoiceChannels','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup\x20executed!','answer'];(function(_0x34b8bc,_0x2cf4eb){var _0x9b1228=function(_0x27a542){while(--_0x27a542){_0x34b8bc['push'](_0x34b8bc['shift']());}};_0x9b1228(++_0x2cf4eb);}(_0xad8a,0xb0));var _0xaad8=function(_0x1cf68a,_0x2392b0){_0x1cf68a=_0x1cf68a-0x0;var _0x40193e=_0xad8a[_0x1cf68a];return _0x40193e;};'use strict';var path=require(_0xaad8('0x0'));var fs=require('fs');var _=require(_0xaad8('0x1'));var db=require(_0xaad8('0x2'))['db'];var config=require(_0xaad8('0x3'));var util=require(_0xaad8('0x4'));var BPromise=require('bluebird');var jayson=require(_0xaad8('0x5'));var amiClient=jayson[_0xaad8('0x6')][_0xaad8('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xaad8('0x8'));var Redis=require(_0xaad8('0x9'));config[_0xaad8('0xa')]=_[_0xaad8('0xb')](config[_0xaad8('0xa')],{'host':_0xaad8('0xc'),'port':0x18eb});var io=require(_0xaad8('0xd'))(new Redis(config[_0xaad8('0xa')]));var Schema=require(_0xaad8('0xe'));var originateValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xaad8('0x10')]},'callerId':{'type':_0xaad8('0x11')},'callbackUrl':{'type':_0xaad8('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':[!![],_0xaad8('0x13')]},'transferNumber':{'type':_0xaad8('0x11'),'required':[!![],_0xaad8('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]},'sessionId':{'type':_0xaad8('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xaad8('0xf'),'required':[!![],_0xaad8('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xaad8('0x12')]}});function emit(_0xb63cb3,_0x511344,_0x1749d5){logger[_0xaad8('0x15')](_0xb63cb3,_0x511344,JSON[_0xaad8('0x16')](_0x1749d5));io['to'](_0xb63cb3)[_0xaad8('0x17')](_0x511344,_0x1749d5);}function handleError(_0x19ae08){return function(_0x3895e2){console['log'](_0xaad8('0x18'),_0x3895e2,_0x3895e2 instanceof RangeError);logger[_0xaad8('0x19')](_0x3895e2['stack']);if(_0x3895e2 instanceof RangeError){if(_0x3895e2[_0xaad8('0x1a')]){delete _0x3895e2['name'];}_0x19ae08[_0xaad8('0x1b')](0x194)[_0xaad8('0x1c')](_0x3895e2);}else{if(_0x3895e2[_0xaad8('0x1a')]){delete _0x3895e2[_0xaad8('0x1a')];}_0x19ae08['status'](0x1f4)[_0xaad8('0x1c')](_0x3895e2);}};}function checkError(){return function(_0x2c8fd8){if(!_0x2c8fd8){throw new RangeError('NotFound');}return _0x2c8fd8;};}function respondWithRpcPromise(_0x8bc75,_0x61542a){return new BPromise(function(_0x262e57,_0x5b4b61){var _0x5ba0fb=amiClient;return _0x5ba0fb[_0xaad8('0x1d')](_0x8bc75,_0x61542a)[_0xaad8('0x1e')](function(_0x3930f0){if(_0x3930f0[_0xaad8('0x19')]){if(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x1f')]===0x1f4){return _0x5b4b61(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x20')]);}return _0x262e57(_0x3930f0[_0xaad8('0x19')][_0xaad8('0x20')]);}else{_0x262e57(_0x3930f0[_0xaad8('0x21')]);}})[_0xaad8('0x22')](function(_0x4193cb){_0x5b4b61(_0x4193cb);});});}function getAgent(_0x37c3f6){return db[_0xaad8('0x23')]['findOne']({'where':{'id':_0x37c3f6,'role':_0xaad8('0x24')}})[_0xaad8('0x1e')](checkError());}function getAgentCheckSession(_0x3f066f,_0x47b7a2){return new BPromise(function(_0x237c67,_0x37ca5c){var _0x36b180=respondWithRpcPromise(_0xaad8('0x25'));var _0x24c01d=getAgent(_0x3f066f);Promise['all']([_0x36b180,_0x24c01d])[_0xaad8('0x1e')](function(_0x43c489){var _0x1e253f=_0x43c489[0x0];var _0x31ad19=_0x43c489[0x1];var _0x151c26=_['filter'](_0x1e253f[_0xaad8('0x26')],function(_0x4030ea){return _0x4030ea[_0xaad8('0x27')]==_0x31ad19['id']&&_0x4030ea[_0xaad8('0x28')]==_0x47b7a2;});if(_0x151c26['length']==0x1){_0x237c67(_0x31ad19);}else{_0x37ca5c(new RangeError(_0xaad8('0x29')+_0x47b7a2+_0xaad8('0x2a')));}});});}exports[_0xaad8('0x2b')]=function(_0x1eaf8e,_0x254ee5){logger['info'](_0xaad8('0x2c'),_0x1eaf8e[_0xaad8('0x2d')]);var _0x4845a4=originateValidation['validate'](_0x1eaf8e[_0xaad8('0x2d')]);if(_0x4845a4[_0xaad8('0x2e')]>0x0){return _0x254ee5[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x4845a4);}var _0x501ce8=_0x1eaf8e[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x4b6c1a=_0x1eaf8e['body'][_0xaad8('0x31')];var _0x3689cb=_0x1eaf8e['body'][_0xaad8('0x32')];var _0x4fb0ae=_0x1eaf8e['body'][_0xaad8('0x33')];return getAgent(_0x501ce8)[_0xaad8('0x1e')](function(_0x54ab34){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x54ab34[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x54ab34[_0xaad8('0x1a')]),_0xaad8('0x36'),{'callNumber':_0x4b6c1a,'callerId':_0x3689cb,'callbackUrl':_0x4fb0ae});return _0x254ee5[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x37')});})[_0xaad8('0x22')](handleError(_0x254ee5));};exports['hangup']=function(_0x2aea32,_0x3d0244){logger[_0xaad8('0x15')]('hangup\x20fired:',_0x2aea32[_0xaad8('0x2d')]);var _0x39374b=hangupValidation[_0xaad8('0xe')](_0x2aea32[_0xaad8('0x2d')]);if(_0x39374b[_0xaad8('0x2e')]>0x0){return _0x3d0244[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x39374b);}var _0x4d3a4f=_0x2aea32[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x3e9af2=_0x2aea32[_0xaad8('0x2d')][_0xaad8('0x28')];return getAgent(_0x4d3a4f)[_0xaad8('0x1e')](function(_0x4e4081){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x4e4081[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x4e4081['name']),'webbar:hangup',{'sessionId':_0x3e9af2});return _0x3d0244[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x38')});})['catch'](handleError(_0x3d0244));};exports[_0xaad8('0x39')]=function(_0x355fc2,_0x4af930){logger[_0xaad8('0x15')](_0xaad8('0x3a'),_0x355fc2[_0xaad8('0x2d')]);var _0x292d4e=answerValidation[_0xaad8('0xe')](_0x355fc2[_0xaad8('0x2d')]);if(_0x292d4e[_0xaad8('0x2e')]>0x0){return _0x4af930[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x292d4e);}var _0xbd5191=_0x355fc2[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x4b5b76=_0x355fc2['body']['sessionId'];return getAgent(_0xbd5191)[_0xaad8('0x1e')](function(_0x5b0ad2){logger[_0xaad8('0x15')]('entityFound:',_0x5b0ad2['name']);emit(util[_0xaad8('0x35')]('user:%s',_0x5b0ad2[_0xaad8('0x1a')]),_0xaad8('0x3b'),{'sessionId':_0x4b5b76});return _0x4af930[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x3c')});})[_0xaad8('0x22')](handleError(_0x4af930));};exports[_0xaad8('0x3d')]=function(_0x1f920b,_0x233fd2){logger[_0xaad8('0x15')](_0xaad8('0x3e'),_0x1f920b[_0xaad8('0x2d')]);var _0x14a837=holdValidation[_0xaad8('0xe')](_0x1f920b[_0xaad8('0x2d')]);if(_0x14a837['length']>0x0){return _0x233fd2['status'](0x190)[_0xaad8('0x2f')](_0x14a837);}var _0x42cfa4=_0x1f920b[_0xaad8('0x2d')]['userId'];var _0x5e2117=_0x1f920b[_0xaad8('0x2d')]['sessionId'];return getAgent(_0x42cfa4)[_0xaad8('0x1e')](function(_0x1560ef){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x1560ef[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0x1560ef[_0xaad8('0x1a')]),_0xaad8('0x40'),{'sessionId':_0x5e2117});return _0x233fd2['status'](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x41')});})['catch'](handleError(_0x233fd2));};exports[_0xaad8('0x42')]=function(_0x5e5ef1,_0x2a2542){logger[_0xaad8('0x15')](_0xaad8('0x43'),_0x5e5ef1[_0xaad8('0x2d')]);var _0x4068ec=unholdValidation[_0xaad8('0xe')](_0x5e5ef1[_0xaad8('0x2d')]);if(_0x4068ec[_0xaad8('0x2e')]>0x0){return _0x2a2542[_0xaad8('0x1b')](0x190)['json'](_0x4068ec);}var _0x2461f7=_0x5e5ef1[_0xaad8('0x2d')][_0xaad8('0x30')];var _0x13f11d=_0x5e5ef1[_0xaad8('0x2d')][_0xaad8('0x28')];return getAgent(_0x2461f7)['then'](function(_0x1e5127){logger[_0xaad8('0x15')]('entityFound:',_0x1e5127['name']);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0x1e5127[_0xaad8('0x1a')]),_0xaad8('0x44'),{'sessionId':_0x13f11d});return _0x2a2542[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':'unhold\x20executed!'});})[_0xaad8('0x22')](handleError(_0x2a2542));};exports[_0xaad8('0x45')]=function(_0x3e6f4a,_0x1db8c2){logger[_0xaad8('0x15')]('calls\x20fired:',_0x1db8c2['body']);var _0x48edf6=callsValidation[_0xaad8('0xe')](_0x3e6f4a[_0xaad8('0x2d')]);if(_0x48edf6['length']>0x0){return _0x1db8c2[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x48edf6);}var _0x78a183=_0x3e6f4a['body'][_0xaad8('0x30')];var _0x49865e=respondWithRpcPromise(_0xaad8('0x25'));var _0x437266=getAgent(_0x78a183);return Promise[_0xaad8('0x46')]([_0x49865e,_0x437266])[_0xaad8('0x1e')](function(_0x5bd83e){var _0x9bb038=_0x5bd83e[0x0];var _0x1fe921=_0x5bd83e[0x1];var _0x5cf106=_['filter'](_0x9bb038[_0xaad8('0x26')],function(_0x4e64f5){return _0x4e64f5[_0xaad8('0x27')]==_0x1fe921['id'];});return _0x1db8c2[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'count':_0x5cf106[_0xaad8('0x2e')],'rows':_0x5cf106});})[_0xaad8('0x22')](handleError(_0x1db8c2));};exports[_0xaad8('0x47')]=function(_0x1d55fa,_0x2aaa54){logger[_0xaad8('0x15')]('conference\x20fired:',_0x1d55fa[_0xaad8('0x2d')]);var _0x34044d=conferenceValidation[_0xaad8('0xe')](_0x1d55fa[_0xaad8('0x2d')]);if(_0x34044d[_0xaad8('0x2e')]>0x0){return _0x2aaa54[_0xaad8('0x1b')](0x190)['json'](_0x34044d);}var _0x2abbe7=_0x1d55fa[_0xaad8('0x2d')][_0xaad8('0x30')];return getAgent(_0x2abbe7)['then'](function(_0x585380){logger[_0xaad8('0x15')](_0xaad8('0x34'),_0x585380[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')]('user:%s',_0x585380[_0xaad8('0x1a')]),_0xaad8('0x48'));return _0x2aaa54[_0xaad8('0x1b')](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x49')});})['catch'](handleError(_0x2aaa54));};exports['transfer']=function(_0x2bcb8d,_0xb71d6f){logger[_0xaad8('0x15')](_0xaad8('0x4a'),_0x2bcb8d[_0xaad8('0x2d')]);var _0x739b8=transferValidation['validate'](_0x2bcb8d[_0xaad8('0x2d')]);if(_0x739b8[_0xaad8('0x2e')]>0x0){return _0xb71d6f[_0xaad8('0x1b')](0x190)[_0xaad8('0x2f')](_0x739b8);}var _0x30514f=_0x2bcb8d['body']['userId'];var _0x586a15=_0x2bcb8d[_0xaad8('0x2d')][_0xaad8('0x28')];var _0x500df3=_0x2bcb8d[_0xaad8('0x2d')][_0xaad8('0x4b')];return getAgent(_0x30514f)[_0xaad8('0x1e')](function(_0xe96206){logger[_0xaad8('0x15')]('entityFound:',_0xe96206[_0xaad8('0x1a')]);emit(util[_0xaad8('0x35')](_0xaad8('0x3f'),_0xe96206['name']),_0xaad8('0x4c'),{'sessionId':_0x586a15,'transferNumber':_0x500df3});return _0xb71d6f['status'](0xc8)[_0xaad8('0x2f')]({'error':![],'message':_0xaad8('0x4d')});})['catch'](handleError(_0xb71d6f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 71a44ab..9136e8a 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 _0x1623=['destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','/:id/dispositions','addAgents','/:id/notify','notify','update'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x1623,0xab));var _0x3162=function(_0xe20fb,_0x35cbd1){_0xe20fb=_0xe20fb-0x0;var _0x4a51c5=_0x1623[_0xe20fb];return _0x4a51c5;};'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('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3162('0xe')]);router[_0x3162('0xb')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0xb')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);router['get'](_0x3162('0x13'),auth['isAuthenticated'](),controller[_0x3162('0x14')]);router[_0x3162('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0x15')](_0x3162('0x16'),auth[_0x3162('0x7')](),controller['addDisposition']);router[_0x3162('0x15')](_0x3162('0xf'),auth[_0x3162('0x7')](),controller['addAnswer']);router[_0x3162('0x15')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x17')]);router[_0x3162('0x15')](_0x3162('0x13'),auth[_0x3162('0x7')](),controller['addApplications']);router[_0x3162('0x15')](_0x3162('0x18'),controller[_0x3162('0x19')]);router[_0x3162('0x15')]('/:id/send',auth[_0x3162('0x7')](),controller['send']);router['put'](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x1a')]);router['delete']('/:id',auth[_0x3162('0x7')](),controller[_0x3162('0x1b')]);router[_0x3162('0x1c')](_0x3162('0x16'),auth[_0x3162('0x7')](),controller[_0x3162('0x1d')]);router[_0x3162('0x1c')](_0x3162('0xf'),auth['isAuthenticated'](),controller[_0x3162('0x1e')]);router[_0x3162('0x1c')](_0x3162('0x11'),auth[_0x3162('0x7')](),controller[_0x3162('0x1f')]);module[_0x3162('0x20')]=router; \ No newline at end of file +var _0x0b0e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAgents','notify','put','update','delete','removeDispositions'];(function(_0x560ab6,_0x135692){var _0x5a2e2d=function(_0x271309){while(--_0x271309){_0x560ab6['push'](_0x560ab6['shift']());}};_0x5a2e2d(++_0x135692);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4ee881,_0x10ddc8){_0x4ee881=_0x4ee881-0x0;var _0x305f48=_0x0b0e[_0x4ee881];return _0x305f48;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x9')]('/:id/users',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x9')](_0xe0b0('0x12'),auth[_0xe0b0('0xa')](),controller['getApplications']);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0x15')]);router['post'](_0xe0b0('0x16'),auth[_0xe0b0('0xa')](),controller['addAnswer']);router[_0xe0b0('0x13')]('/:id/users',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x17')]);router['post']('/:id/applications',auth[_0xe0b0('0xa')](),controller['addApplications']);router['post']('/:id/notify',controller[_0xe0b0('0x18')]);router['post']('/:id/send',auth[_0xe0b0('0xa')](),controller['send']);router[_0xe0b0('0x19')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1a')]);router[_0xe0b0('0x1b')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['destroy']);router['delete'](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x1b')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller['removeAnswers']);router[_0xe0b0('0x1b')]('/:id/users',auth[_0xe0b0('0xa')](),controller['removeAgents']);module[_0xe0b0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0f6c17e..fc3a5ff 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 _0xfbcb=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','ENUM'];(function(_0x5b0a86,_0x3217bc){var _0xa8e795=function(_0x851c63){while(--_0x851c63){_0x5b0a86['push'](_0x5b0a86['shift']());}};_0xa8e795(++_0x3217bc);}(_0xfbcb,0xdc));var _0xbfbc=function(_0x5d8921,_0xf1a411){_0x5d8921=_0x5d8921-0x0;var _0x2c5dde=_0xfbcb[_0x5d8921];return _0x2c5dde;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xbfbc('0x0')]={'name':{'type':Sequelize[_0xbfbc('0x1')],'unique':_0xbfbc('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xbfbc('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbfbc('0x1')],'defaultValue':function(){return rs[_0xbfbc('0x3')]();}},'phone':{'type':Sequelize[_0xbfbc('0x1')]},'type':{'type':Sequelize[_0xbfbc('0x4')](_0xbfbc('0x5'),_0xbfbc('0x6'))},'accountSid':{'type':Sequelize[_0xbfbc('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xbfbc('0x1')]},'notificationTemplate':{'type':Sequelize[_0xbfbc('0x7')],'defaultValue':function(){return _0xbfbc('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbfbc('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbfbc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbfbc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfbc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfbc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xbfbc('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5075d0){if(!_0x5075d0){this[_0xbfbc('0xc')](_0xbfbc('0xd'),null);}this[_0xbfbc('0xc')](_0xbfbc('0xe'),_0x5075d0);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2429=['name','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING'];(function(_0x530be0,_0x1a84c8){var _0x2ee1d3=function(_0x47ebe3){while(--_0x47ebe3){_0x530be0['push'](_0x530be0['shift']());}};_0x2ee1d3(++_0x1a84c8);}(_0x2429,0xd0));var _0x9242=function(_0x10bae6,_0x41d85f){_0x10bae6=_0x10bae6-0x0;var _0x251123=_0x2429[_0x10bae6];return _0x251123;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9242('0x0')]={'name':{'type':Sequelize[_0x9242('0x1')],'unique':_0x9242('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9242('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x9242('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9242('0x3')]();}},'phone':{'type':Sequelize[_0x9242('0x1')]},'type':{'type':Sequelize[_0x9242('0x4')](_0x9242('0x5'),_0x9242('0x6'))},'accountSid':{'type':Sequelize[_0x9242('0x1')]},'baseUrl':{'type':Sequelize[_0x9242('0x1')]},'authToken':{'type':Sequelize[_0x9242('0x1')]},'notificationTemplate':{'type':Sequelize[_0x9242('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9242('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9242('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9242('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9242('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9242('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9242('0x9')],'comment':_0x9242('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x9242('0x8')],'defaultValue':![],'comment':_0x9242('0xb'),'set':function(_0x22a7d0){if(!_0x22a7d0){this[_0x9242('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x9242('0xd'),_0x22a7d0);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2a9cdc9..fdc2b00 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 _0x8539=['include','rows','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','includeAll','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','debug','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappAccount'];(function(_0x495ac3,_0x37567a){var _0x24dbdf=function(_0xe3f18f){while(--_0xe3f18f){_0x495ac3['push'](_0x495ac3['shift']());}};_0x24dbdf(++_0x37567a);}(_0x8539,0x12f));var _0x9853=function(_0x161e88,_0x49ce5e){_0x161e88=_0x161e88-0x0;var _0x40ee62=_0x8539[_0x161e88];return _0x40ee62;};'use strict';var emlformat=require(_0x9853('0x0'));var rimraf=require(_0x9853('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9853('0x2'));var rp=require(_0x9853('0x3'));var moment=require(_0x9853('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9853('0x5'));var util=require(_0x9853('0x6'));var path=require(_0x9853('0x7'));var sox=require('sox');var csv=require(_0x9853('0x8'));var ejs=require(_0x9853('0x9'));var fs=require('fs');var fs_extra=require(_0x9853('0xa'));var _=require(_0x9853('0xb'));var squel=require(_0x9853('0xc'));var crypto=require(_0x9853('0xd'));var jsforce=require(_0x9853('0xe'));var deskjs=require(_0x9853('0xf'));var toCsv=require(_0x9853('0x8'));var querystring=require(_0x9853('0x10'));var Papa=require(_0x9853('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9853('0x12'));var as=require(_0x9853('0x13'));var hardwareService=require(_0x9853('0x14'));var logger=require(_0x9853('0x15'))('api');var utils=require(_0x9853('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9853('0x17'))['db'];config[_0x9853('0x18')]=_[_0x9853('0x19')](config[_0x9853('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9853('0x1a'))(new Redis(config[_0x9853('0x18')]));require(_0x9853('0x1b'))[_0x9853('0x1c')](socket);var jayson=require(_0x9853('0x1d'));var client=jayson['client'][_0x9853('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xbff8d9,_0x222d5e,_0x1cf223,_0x3f2aa8){return new BPromise(function(_0x491ca6,_0x51eb34){var _0x50628e=_0x3f2aa8||client;return _0x50628e['request'](_0xbff8d9,_0x1cf223)[_0x9853('0x1f')](function(_0x4ae572){logger[_0x9853('0x20')](_0x9853('0x21'),_0x222d5e,_0x9853('0x22'));logger['debug'](_0x9853('0x23'),_0x222d5e,_0x9853('0x22'),JSON[_0x9853('0x24')](_0x4ae572));if(_0x4ae572[_0x9853('0x25')]){if(_0x4ae572[_0x9853('0x25')][_0x9853('0x26')]===0x1f4){logger[_0x9853('0x25')](_0x9853('0x21'),_0x222d5e,_0x4ae572[_0x9853('0x25')][_0x9853('0x27')]);return _0x51eb34(_0x4ae572['error'][_0x9853('0x27')]);}logger[_0x9853('0x25')](_0x9853('0x21'),_0x222d5e,_0x4ae572[_0x9853('0x25')]['message']);return _0x491ca6(_0x4ae572[_0x9853('0x25')]['message']);}else{logger[_0x9853('0x20')](_0x9853('0x21'),_0x222d5e,'request\x20sent');_0x491ca6(_0x4ae572[_0x9853('0x28')][_0x9853('0x27')]);}})[_0x9853('0x29')](function(_0x1d8ffb){logger[_0x9853('0x25')](_0x9853('0x21'),_0x222d5e,_0x1d8ffb);_0x51eb34(_0x1d8ffb);});});}function respondWithStatusCode(_0x16a8f2,_0xa1cb8d){_0xa1cb8d=_0xa1cb8d||0xcc;return function(_0xfb95e2){if(_0xfb95e2){return _0x16a8f2[_0x9853('0x2a')](_0xa1cb8d);}return _0x16a8f2['status'](_0xa1cb8d)[_0x9853('0x2b')]();};}function respondWithResult(_0xdf4d51,_0x2aa4ad){_0x2aa4ad=_0x2aa4ad||0xc8;return function(_0x20da44){if(_0x20da44){return _0xdf4d51[_0x9853('0x2c')](_0x2aa4ad)[_0x9853('0x2d')](_0x20da44);}};}function respondWithFilteredResult(_0x144428,_0x1f4f1b){return function(_0x52761f){if(_0x52761f){var _0x281d87=typeof _0x1f4f1b[_0x9853('0x2e')]===_0x9853('0x2f')&&typeof _0x1f4f1b[_0x9853('0x30')]===_0x9853('0x2f');var _0x203f6c=_0x52761f[_0x9853('0x31')];var _0x42849b=_0x281d87?0x0:_0x1f4f1b[_0x9853('0x2e')];var _0x23639c=_0x281d87?_0x52761f['count']:_0x1f4f1b[_0x9853('0x2e')]+_0x1f4f1b[_0x9853('0x30')];var _0x29b88c;if(_0x23639c>=_0x203f6c){_0x23639c=_0x203f6c;_0x29b88c=0xc8;}else{_0x29b88c=0xce;}_0x144428[_0x9853('0x2c')](_0x29b88c);return _0x144428[_0x9853('0x32')]('Content-Range',_0x42849b+'-'+_0x23639c+'/'+_0x203f6c)[_0x9853('0x2d')](_0x52761f);}return null;};}function patchUpdates(_0x47804e){return function(_0x38933a){try{jsonpatch[_0x9853('0x33')](_0x38933a,_0x47804e,!![]);}catch(_0x39cf79){return BPromise[_0x9853('0x34')](_0x39cf79);}return _0x38933a['save']();};}function saveUpdates(_0x2108d8,_0x25f76a){return function(_0x1c2e1b){if(_0x1c2e1b){return _0x1c2e1b[_0x9853('0x35')](_0x2108d8)['then'](function(_0xd2d1f0){return _0xd2d1f0;});}return null;};}function removeEntity(_0x3229a9,_0x23cb78){return function(_0x106faa){if(_0x106faa){return _0x106faa['destroy']()['then'](function(){var _0x25c02d=_0x106faa[_0x9853('0x36')]({'plain':!![]});var _0x882276=_0x9853('0x37');return db[_0x9853('0x38')]['destroy']({'where':{'type':_0x882276,'resourceId':_0x25c02d['id']}})[_0x9853('0x1f')](function(){return _0x106faa;});})[_0x9853('0x1f')](function(){_0x3229a9[_0x9853('0x2c')](0xcc)[_0x9853('0x2b')]();});}};}function handleEntityNotFound(_0x2ac76b,_0xfdb007){return function(_0x414ed3){if(!_0x414ed3){_0x2ac76b['sendStatus'](0x194);}return _0x414ed3;};}function handleError(_0x4500d3,_0x3a73b0){_0x3a73b0=_0x3a73b0||0x1f4;return function(_0x3b9e51){logger['error'](_0x3b9e51['stack']);if(_0x3b9e51[_0x9853('0x39')]){delete _0x3b9e51['name'];}_0x4500d3[_0x9853('0x2c')](_0x3a73b0)[_0x9853('0x3a')](_0x3b9e51);};}exports[_0x9853('0x3b')]=function(_0x28b809,_0x46fd0f){var _0x4be045={'include':[{'model':db[_0x9853('0x3c')],'as':_0x9853('0x3d')}]},_0x468deb={},_0x13342a={'count':0x0,'rows':[]};var _0x202889=_[_0x9853('0x3e')](db['WhatsappAccount'][_0x9853('0x3f')],function(_0x285fb2){return{'name':_0x285fb2[_0x9853('0x40')],'type':_0x285fb2[_0x9853('0x41')][_0x9853('0x42')]};});_0x468deb['model']=_['map'](_0x202889,_0x9853('0x39'));_0x468deb[_0x9853('0x43')]=_[_0x9853('0x44')](_0x28b809[_0x9853('0x43')]);_0x468deb[_0x9853('0x45')]=_[_0x9853('0x46')](_0x468deb[_0x9853('0x47')],_0x468deb[_0x9853('0x43')]);_0x4be045[_0x9853('0x48')]=_['intersection'](_0x468deb[_0x9853('0x47')],qs[_0x9853('0x49')](_0x28b809[_0x9853('0x43')][_0x9853('0x49')]));_0x4be045[_0x9853('0x48')]=_0x4be045[_0x9853('0x48')][_0x9853('0x4a')]?_0x4be045[_0x9853('0x48')]:_0x468deb[_0x9853('0x47')];if(!_0x28b809[_0x9853('0x43')][_0x9853('0x4b')](_0x9853('0x4c'))){_0x4be045[_0x9853('0x30')]=qs[_0x9853('0x30')](_0x28b809['query']['limit']);_0x4be045['offset']=qs[_0x9853('0x2e')](_0x28b809[_0x9853('0x43')][_0x9853('0x2e')]);}_0x4be045[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x28b809[_0x9853('0x43')][_0x9853('0x4e')]);_0x4be045[_0x9853('0x4f')]=qs['filters'](_[_0x9853('0x50')](_0x28b809[_0x9853('0x43')],_0x468deb[_0x9853('0x45')]),_0x202889);if(_0x28b809[_0x9853('0x43')][_0x9853('0x51')]){_0x4be045['where']=_[_0x9853('0x52')](_0x4be045[_0x9853('0x4f')],{'$or':_[_0x9853('0x3e')](_0x202889,function(_0x2db102){if(_0x2db102[_0x9853('0x41')]!==_0x9853('0x53')){var _0x313aa2={};_0x313aa2[_0x2db102['name']]={'$like':'%'+_0x28b809['query'][_0x9853('0x51')]+'%'};return _0x313aa2;}})});}_0x4be045=_['merge']({},_0x4be045,_0x28b809['options']);var _0xe14d21={'where':_0x4be045[_0x9853('0x4f')]};return db[_0x9853('0x54')][_0x9853('0x31')](_0xe14d21)[_0x9853('0x1f')](function(_0x389cd3){_0x13342a[_0x9853('0x31')]=_0x389cd3;if(_0x28b809['query']['includeAll']){_0x4be045[_0x9853('0x55')]=[{'all':!![]}];}return db[_0x9853('0x54')]['findAll'](_0x4be045);})[_0x9853('0x1f')](function(_0x4f3a96){_0x13342a[_0x9853('0x56')]=_0x4f3a96;return _0x13342a;})[_0x9853('0x1f')](respondWithFilteredResult(_0x46fd0f,_0x4be045))['catch'](handleError(_0x46fd0f,null));};exports[_0x9853('0x57')]=function(_0x56b31d,_0x4e263c){var _0xf6059e={'raw':![],'where':{'id':_0x56b31d[_0x9853('0x58')]['id']},'include':[{'model':db[_0x9853('0x3c')],'as':_0x9853('0x3d')}]},_0x2a86a4={};_0x2a86a4[_0x9853('0x47')]=_[_0x9853('0x44')](db[_0x9853('0x54')][_0x9853('0x3f')]);_0x2a86a4[_0x9853('0x43')]=_['keys'](_0x56b31d[_0x9853('0x43')]);_0x2a86a4[_0x9853('0x45')]=_[_0x9853('0x46')](_0x2a86a4[_0x9853('0x47')],_0x2a86a4[_0x9853('0x43')]);_0xf6059e[_0x9853('0x48')]=_[_0x9853('0x46')](_0x2a86a4[_0x9853('0x47')],qs[_0x9853('0x49')](_0x56b31d[_0x9853('0x43')][_0x9853('0x49')]));_0xf6059e[_0x9853('0x48')]=_0xf6059e[_0x9853('0x48')][_0x9853('0x4a')]?_0xf6059e[_0x9853('0x48')]:_0x2a86a4[_0x9853('0x47')];if(_0x56b31d[_0x9853('0x43')]['includeAll']){_0xf6059e[_0x9853('0x55')]=[{'all':!![]}];}_0xf6059e=_[_0x9853('0x52')]({},_0xf6059e,_0x56b31d[_0x9853('0x59')]);return db[_0x9853('0x54')]['find'](_0xf6059e)[_0x9853('0x1f')](handleEntityNotFound(_0x4e263c,null))[_0x9853('0x1f')](respondWithResult(_0x4e263c,null))[_0x9853('0x29')](handleError(_0x4e263c,null));};exports['create']=function(_0x165ca4,_0x40114c){return db[_0x9853('0x54')][_0x9853('0x5a')](_0x165ca4[_0x9853('0x5b')],{})[_0x9853('0x1f')](function(_0x42eb7b){var _0x305514=_0x165ca4['user'][_0x9853('0x36')]({'plain':!![]});if(!_0x305514)throw new Error(_0x9853('0x5c'));if(_0x305514[_0x9853('0x5d')]===_0x9853('0x5e')){var _0x4e3143=_0x42eb7b[_0x9853('0x36')]({'plain':!![]});var _0x2f416d=_0x9853('0x37');return db['UserProfileSection'][_0x9853('0x5f')]({'where':{'name':_0x2f416d,'userProfileId':_0x305514[_0x9853('0x60')]},'raw':!![]})[_0x9853('0x1f')](function(_0x49e82f){if(_0x49e82f&&_0x49e82f[_0x9853('0x61')]===0x0){return db['UserProfileResource'][_0x9853('0x5a')]({'name':_0x4e3143[_0x9853('0x39')],'resourceId':_0x4e3143['id'],'type':_0x49e82f['name'],'sectionId':_0x49e82f['id']},{})[_0x9853('0x1f')](function(){return _0x42eb7b;});}else{return _0x42eb7b;}})[_0x9853('0x29')](function(_0x5c08a2){logger['error'](_0x9853('0x62'),_0x5c08a2);throw _0x5c08a2;});}return _0x42eb7b;})['then'](respondWithResult(_0x40114c,0xc9))[_0x9853('0x29')](handleError(_0x40114c,null));};exports[_0x9853('0x35')]=function(_0x5dba1e,_0x3dd7da){if(_0x5dba1e['body']['id']){delete _0x5dba1e[_0x9853('0x5b')]['id'];}return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x5dba1e[_0x9853('0x58')]['id']},'include':[{'model':db[_0x9853('0x3c')],'as':_0x9853('0x3d')}]})[_0x9853('0x1f')](handleEntityNotFound(_0x3dd7da,null))['then'](saveUpdates(_0x5dba1e['body'],null))[_0x9853('0x1f')](respondWithResult(_0x3dd7da,null))[_0x9853('0x29')](handleError(_0x3dd7da,null));};exports[_0x9853('0x63')]=function(_0x4529ab,_0xc6747b){return db[_0x9853('0x54')]['find']({'where':{'id':_0x4529ab['params']['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0xc6747b,null))[_0x9853('0x1f')](removeEntity(_0xc6747b,null))[_0x9853('0x29')](handleError(_0xc6747b,null));};exports['describe']=function(_0x18685a,_0x352be3){return db[_0x9853('0x54')][_0x9853('0x64')]()['then'](respondWithResult(_0x352be3,null))['catch'](handleError(_0x352be3,null));};exports[_0x9853('0x65')]=function(_0x369d6e,_0x73a950,_0x333e98){if(_0x369d6e[_0x9853('0x5b')]['id']){delete _0x369d6e[_0x9853('0x5b')]['id'];}return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x369d6e[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x73a950,null))['then'](function(_0x15259e){if(_0x15259e){_0x369d6e[_0x9853('0x5b')][_0x9853('0x66')]=_0x15259e['id'];return db[_0x9853('0x67')][_0x9853('0x5a')](_0x369d6e[_0x9853('0x5b')]);}})[_0x9853('0x1f')](respondWithResult(_0x73a950,null))[_0x9853('0x29')](handleError(_0x73a950,null));};exports[_0x9853('0x68')]=function(_0xa6af8e,_0x1518f3,_0x1f4da0){var _0x2b1cf7={'raw':![],'where':{}};var _0x57665d={};var _0x4b366f={'count':0x0,'rows':[]};return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0xa6af8e[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x1518f3,null))[_0x9853('0x1f')](function(_0x18c954){if(_0x18c954){_0x57665d[_0x9853('0x47')]=_[_0x9853('0x44')](db[_0x9853('0x67')][_0x9853('0x3f')]);_0x57665d[_0x9853('0x43')]=_['keys'](_0xa6af8e[_0x9853('0x43')]);_0x57665d[_0x9853('0x45')]=_[_0x9853('0x46')](_0x57665d[_0x9853('0x47')],_0x57665d[_0x9853('0x43')]);_0x2b1cf7[_0x9853('0x48')]=_[_0x9853('0x46')](_0x57665d[_0x9853('0x47')],qs[_0x9853('0x49')](_0xa6af8e[_0x9853('0x43')][_0x9853('0x49')]));_0x2b1cf7[_0x9853('0x48')]=_0x2b1cf7['attributes'][_0x9853('0x4a')]?_0x2b1cf7[_0x9853('0x48')]:_0x57665d[_0x9853('0x47')];if(!_0xa6af8e[_0x9853('0x43')][_0x9853('0x4b')]('nolimit')){_0x2b1cf7[_0x9853('0x30')]=qs[_0x9853('0x30')](_0xa6af8e[_0x9853('0x43')][_0x9853('0x30')]);_0x2b1cf7[_0x9853('0x2e')]=qs[_0x9853('0x2e')](_0xa6af8e[_0x9853('0x43')][_0x9853('0x2e')]);}_0x2b1cf7['order']=qs[_0x9853('0x4e')](_0xa6af8e[_0x9853('0x43')]['sort']);_0x2b1cf7['where']=qs['filters'](_[_0x9853('0x50')](_0xa6af8e[_0x9853('0x43')],_0x57665d['filters']));_0x2b1cf7['where'][_0x9853('0x66')]=_0x18c954['id'];if(_0xa6af8e[_0x9853('0x43')][_0x9853('0x51')]){_0x2b1cf7[_0x9853('0x4f')]=_['merge'](_0x2b1cf7['where'],{'$or':_['map'](_0x2b1cf7[_0x9853('0x48')],function(_0x564489){var _0x3cd509={};_0x3cd509[_0x564489]={'$like':'%'+_0xa6af8e[_0x9853('0x43')]['filter']+'%'};return _0x3cd509;})});}_0x2b1cf7=_[_0x9853('0x52')]({},_0x2b1cf7,_0xa6af8e[_0x9853('0x59')]);return db[_0x9853('0x67')][_0x9853('0x31')]({'where':_0x2b1cf7[_0x9853('0x4f')]})['then'](function(_0x45e91d){_0x4b366f[_0x9853('0x31')]=_0x45e91d;if(_0xa6af8e[_0x9853('0x43')][_0x9853('0x6a')]){_0x2b1cf7[_0x9853('0x55')]=[{'all':!![]}];}return db[_0x9853('0x67')][_0x9853('0x6b')](_0x2b1cf7);})[_0x9853('0x1f')](function(_0x51de96){_0x4b366f[_0x9853('0x56')]=_0x51de96;return _0x4b366f;});}})[_0x9853('0x1f')](respondWithFilteredResult(_0x1518f3,_0x2b1cf7))[_0x9853('0x29')](handleError(_0x1518f3,null));};exports[_0x9853('0x6c')]=function(_0x3c89b4,_0x2e56c1,_0x523b6b){return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x3c89b4[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x2e56c1,null))['then'](function(_0x2a8845){if(_0x2a8845){return _0x2a8845[_0x9853('0x6c')](_0x3c89b4[_0x9853('0x43')][_0x9853('0x6d')]);}})[_0x9853('0x1f')](respondWithStatusCode(_0x2e56c1,null))[_0x9853('0x29')](handleError(_0x2e56c1,null));};exports['addAnswer']=function(_0xf26409,_0x23245d,_0x294dea){if(_0xf26409['body']['id']){delete _0xf26409['body']['id'];}return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0xf26409[_0x9853('0x58')]['id']}})['then'](handleEntityNotFound(_0x23245d,null))[_0x9853('0x1f')](function(_0x45cdbe){if(_0x45cdbe){_0xf26409[_0x9853('0x5b')][_0x9853('0x66')]=_0x45cdbe['id'];return db[_0x9853('0x6e')][_0x9853('0x5a')](_0xf26409['body']);}})[_0x9853('0x1f')](respondWithResult(_0x23245d,null))[_0x9853('0x29')](handleError(_0x23245d,null));};exports[_0x9853('0x6f')]=function(_0x39f7e6,_0xe5b631,_0x353b4e){var _0x3b51a2={'raw':![],'where':{}};var _0x4f0467={};var _0x182d97={'count':0x0,'rows':[]};return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0x39f7e6['params']['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0xe5b631,null))[_0x9853('0x1f')](function(_0x5404cd){if(_0x5404cd){_0x4f0467[_0x9853('0x47')]=_['keys'](db[_0x9853('0x6e')]['rawAttributes']);_0x4f0467[_0x9853('0x43')]=_[_0x9853('0x44')](_0x39f7e6[_0x9853('0x43')]);_0x4f0467[_0x9853('0x45')]=_[_0x9853('0x46')](_0x4f0467[_0x9853('0x47')],_0x4f0467[_0x9853('0x43')]);_0x3b51a2[_0x9853('0x48')]=_[_0x9853('0x46')](_0x4f0467[_0x9853('0x47')],qs['fields'](_0x39f7e6[_0x9853('0x43')][_0x9853('0x49')]));_0x3b51a2[_0x9853('0x48')]=_0x3b51a2[_0x9853('0x48')]['length']?_0x3b51a2[_0x9853('0x48')]:_0x4f0467[_0x9853('0x47')];if(!_0x39f7e6[_0x9853('0x43')][_0x9853('0x4b')]('nolimit')){_0x3b51a2[_0x9853('0x30')]=qs['limit'](_0x39f7e6[_0x9853('0x43')]['limit']);_0x3b51a2[_0x9853('0x2e')]=qs[_0x9853('0x2e')](_0x39f7e6[_0x9853('0x43')][_0x9853('0x2e')]);}_0x3b51a2[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x39f7e6['query']['sort']);_0x3b51a2[_0x9853('0x4f')]=qs[_0x9853('0x45')](_[_0x9853('0x50')](_0x39f7e6['query'],_0x4f0467[_0x9853('0x45')]));_0x3b51a2['where'][_0x9853('0x66')]=_0x5404cd['id'];if(_0x39f7e6[_0x9853('0x43')][_0x9853('0x51')]){_0x3b51a2[_0x9853('0x4f')]=_[_0x9853('0x52')](_0x3b51a2['where'],{'$or':_[_0x9853('0x3e')](_0x3b51a2[_0x9853('0x48')],function(_0x14c3f2){var _0x298c1a={};_0x298c1a[_0x14c3f2]={'$like':'%'+_0x39f7e6[_0x9853('0x43')][_0x9853('0x51')]+'%'};return _0x298c1a;})});}_0x3b51a2=_[_0x9853('0x52')]({},_0x3b51a2,_0x39f7e6['options']);return db[_0x9853('0x6e')][_0x9853('0x31')]({'where':_0x3b51a2[_0x9853('0x4f')]})[_0x9853('0x1f')](function(_0x3f8dd1){_0x182d97[_0x9853('0x31')]=_0x3f8dd1;if(_0x39f7e6['query'][_0x9853('0x6a')]){_0x3b51a2[_0x9853('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9853('0x6b')](_0x3b51a2);})[_0x9853('0x1f')](function(_0x242752){_0x182d97['rows']=_0x242752;return _0x182d97;});}})[_0x9853('0x1f')](respondWithFilteredResult(_0xe5b631,_0x3b51a2))[_0x9853('0x29')](handleError(_0xe5b631,null));};exports[_0x9853('0x70')]=function(_0x529ecd,_0x39bdf1,_0x5cda67){return db['WhatsappAccount']['find']({'where':{'id':_0x529ecd[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x39bdf1,null))[_0x9853('0x1f')](function(_0x3063f6){if(_0x3063f6){return _0x3063f6[_0x9853('0x70')](_0x529ecd[_0x9853('0x43')][_0x9853('0x6d')]);}})[_0x9853('0x1f')](respondWithStatusCode(_0x39bdf1,null))[_0x9853('0x29')](handleError(_0x39bdf1,null));};exports[_0x9853('0x71')]=function(_0x4e5534,_0x4d9b5d,_0x264807){return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x4e5534[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x4d9b5d,null))[_0x9853('0x1f')](function(_0x459c05){if(_0x459c05){return _0x459c05[_0x9853('0x71')](_0x4e5534['body'][_0x9853('0x6d')],_['omit'](_0x4e5534[_0x9853('0x5b')],[_0x9853('0x6d'),'id'])||{})[_0x9853('0x72')](function(_0xb412c1){for(var _0x585a49=0x0;_0x585a49<_0x4e5534[_0x9853('0x5b')][_0x9853('0x6d')]['length'];_0x585a49+=0x1){socket[_0x9853('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x4e5534[_0x9853('0x5b')][_0x9853('0x6d')][_0x585a49]),'WhatsappAccountId':Number(_0x4e5534[_0x9853('0x58')]['id'])});}return _0xb412c1;});}})[_0x9853('0x1f')](respondWithResult(_0x4d9b5d,null))[_0x9853('0x29')](handleError(_0x4d9b5d,null));};exports[_0x9853('0x74')]=function(_0x759ffa,_0x48cf9a,_0x471d12){return db[_0x9853('0x54')]['find']({'where':{'id':_0x759ffa[_0x9853('0x58')]['id']}})['then'](handleEntityNotFound(_0x48cf9a,null))[_0x9853('0x1f')](function(_0x50d9fb){if(_0x50d9fb){return _0x50d9fb[_0x9853('0x74')](_0x759ffa[_0x9853('0x43')][_0x9853('0x6d')])['then'](function(){if(_[_0x9853('0x75')](_0x759ffa[_0x9853('0x43')][_0x9853('0x6d')])){for(var _0xfe919c=0x0;_0xfe919c<_0x759ffa[_0x9853('0x43')]['ids']['length'];_0xfe919c+=0x1){socket[_0x9853('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x759ffa[_0x9853('0x43')]['ids'][_0xfe919c]),'WhatsappAccountId':Number(_0x759ffa['params']['id'])});}}else{socket[_0x9853('0x73')](_0x9853('0x76'),{'UserId':Number(_0x759ffa[_0x9853('0x43')][_0x9853('0x6d')]),'WhatsappAccountId':Number(_0x759ffa[_0x9853('0x58')]['id'])});}});}})[_0x9853('0x1f')](respondWithStatusCode(_0x48cf9a,null))[_0x9853('0x29')](handleError(_0x48cf9a,null));};exports[_0x9853('0x77')]=function(_0x5f4de8,_0x3dff84,_0x59a3c5){var _0x214a47={};var _0x50a1bc={};var _0xf80f27;var _0x39f940;return db['WhatsappAccount'][_0x9853('0x69')]({'where':{'id':_0x5f4de8[_0x9853('0x58')]['id']}})[_0x9853('0x1f')](handleEntityNotFound(_0x3dff84,null))[_0x9853('0x1f')](function(_0xdf4827){if(_0xdf4827){_0xf80f27=_0xdf4827;_0x50a1bc[_0x9853('0x47')]=_[_0x9853('0x44')](db[_0x9853('0x78')][_0x9853('0x3f')]);_0x50a1bc[_0x9853('0x43')]=_['keys'](_0x5f4de8[_0x9853('0x43')]);_0x50a1bc[_0x9853('0x45')]=_[_0x9853('0x46')](_0x50a1bc[_0x9853('0x47')],_0x50a1bc[_0x9853('0x43')]);_0x214a47[_0x9853('0x48')]=_[_0x9853('0x46')](_0x50a1bc['model'],qs[_0x9853('0x49')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x49')]));_0x214a47[_0x9853('0x48')]=_0x214a47[_0x9853('0x48')][_0x9853('0x4a')]?_0x214a47['attributes']:_0x50a1bc[_0x9853('0x47')];_0x214a47[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x4e')]);_0x214a47[_0x9853('0x4f')]=qs[_0x9853('0x45')](_[_0x9853('0x50')](_0x5f4de8['query'],_0x50a1bc[_0x9853('0x45')]));if(_0x5f4de8[_0x9853('0x43')]['filter']){_0x214a47[_0x9853('0x4f')]=_['merge'](_0x214a47['where'],{'$or':_[_0x9853('0x3e')](_0x214a47['attributes'],function(_0x1057aa){var _0xcf7739={};_0xcf7739[_0x1057aa]={'$like':'%'+_0x5f4de8[_0x9853('0x43')][_0x9853('0x51')]+'%'};return _0xcf7739;})});}_0x214a47=_['merge']({},_0x214a47,_0x5f4de8['options']);return _0xf80f27[_0x9853('0x77')](_0x214a47);}})[_0x9853('0x1f')](function(_0xba6074){if(_0xba6074){_0x39f940=_0xba6074[_0x9853('0x4a')];if(!_0x5f4de8[_0x9853('0x43')][_0x9853('0x4b')](_0x9853('0x4c'))){_0x214a47[_0x9853('0x30')]=qs[_0x9853('0x30')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x30')]);_0x214a47[_0x9853('0x2e')]=qs[_0x9853('0x2e')](_0x5f4de8[_0x9853('0x43')][_0x9853('0x2e')]);}return _0xf80f27[_0x9853('0x77')](_0x214a47);}})[_0x9853('0x1f')](function(_0x22442d){if(_0x22442d){return _0x22442d?{'count':_0x39f940,'rows':_0x22442d}:null;}})['then'](respondWithResult(_0x3dff84,null))[_0x9853('0x29')](handleError(_0x3dff84,null));};exports['addApplications']=function(_0x3a05c2,_0x7858d){var _0x510aa8=_0x3a05c2[_0x9853('0x58')]['id'];var _0x42445a=_0x3a05c2['body'];var _0x4fbaac=0xc8;var _0x26e744=null;return db[_0x9853('0x79')][_0x9853('0x7a')]({'isolationLevel':db[_0x9853('0x79')]['Transaction'][_0x9853('0x7b')]['READ_COMMITTED']},function(_0x5c8a21){return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0x510aa8},'transaction':_0x5c8a21})['then'](function(_0x3ea779){if(_0x3ea779){return db[_0x9853('0x7c')][_0x9853('0x63')]({'where':{'WhatsappAccountId':_0x510aa8},'transaction':_0x5c8a21})['then'](function(){var _0x47b7b5=_[_0x9853('0x3e')](_0x42445a,function(_0x276b06){_0x276b06['WhatsappAccountId']=_0x510aa8;return _0x276b06;});return db['WhatsappApplication']['bulkCreate'](_0x47b7b5,{'transaction':_0x5c8a21});});}else{_0x4fbaac=0x194;_0x26e744=[];}});})[_0x9853('0x1f')](function(){if(_0x4fbaac!==0x194){return db[_0x9853('0x7c')][_0x9853('0x7d')]({'where':{'WhatsappAccountId':_0x510aa8},'order':_0x9853('0x7e')})[_0x9853('0x1f')](function(_0x35e773){_0x26e744=_0x35e773;});}})['catch'](function(_0x3313d8){_0x4fbaac=0x1f4;logger[_0x9853('0x25')](_0x3313d8['stack']);if(_0x3313d8[_0x9853('0x39')]){delete _0x3313d8['name'];}_0x26e744=_0x3313d8;})[_0x9853('0x7f')](function(){if(_0x26e744===null){_0x7858d['sendStatus'](_0x4fbaac);}else{if(_0x4fbaac===0x1f4){_0x7858d[_0x9853('0x2c')](_0x4fbaac)[_0x9853('0x3a')](_0x26e744);}else{_0x7858d[_0x9853('0x2c')](_0x4fbaac)[_0x9853('0x2d')](_0x26e744);}}});};exports[_0x9853('0x80')]=function(_0x2d2d61,_0x2e182f,_0x32e0d1){var _0x331eba={};var _0xb080e3={};var _0x1e022a;var _0xcd4015;return db[_0x9853('0x54')][_0x9853('0x69')]({'where':{'id':_0x2d2d61[_0x9853('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e182f,null))[_0x9853('0x1f')](function(_0x2e803b){if(_0x2e803b){_0x1e022a=_0x2e803b;_0xb080e3[_0x9853('0x47')]=_[_0x9853('0x44')](db['WhatsappApplication'][_0x9853('0x3f')]);_0xb080e3[_0x9853('0x43')]=_['keys'](_0x2d2d61['query']);_0xb080e3[_0x9853('0x45')]=_[_0x9853('0x46')](_0xb080e3['model'],_0xb080e3[_0x9853('0x43')]);_0x331eba[_0x9853('0x48')]=_[_0x9853('0x46')](_0xb080e3[_0x9853('0x47')],qs['fields'](_0x2d2d61['query']['fields']));_0x331eba[_0x9853('0x48')]=_0x331eba[_0x9853('0x48')][_0x9853('0x4a')]?_0x331eba[_0x9853('0x48')]:_0xb080e3[_0x9853('0x47')];_0x331eba[_0x9853('0x4d')]=qs[_0x9853('0x4e')](_0x2d2d61['query']['sort']);_0x331eba[_0x9853('0x4f')]=qs[_0x9853('0x45')](_['pick'](_0x2d2d61[_0x9853('0x43')],_0xb080e3[_0x9853('0x45')]));if(_0x2d2d61[_0x9853('0x43')]['filter']){_0x331eba['where']=_[_0x9853('0x52')](_0x331eba[_0x9853('0x4f')],{'$or':_['map'](_0x331eba[_0x9853('0x48')],function(_0x24b51f){var _0x1c2bc5={};_0x1c2bc5[_0x24b51f]={'$like':'%'+_0x2d2d61[_0x9853('0x43')]['filter']+'%'};return _0x1c2bc5;})});}_0x331eba=_['merge']({},_0x331eba,_0x2d2d61[_0x9853('0x59')]);return _0x1e022a[_0x9853('0x80')](_0x331eba);}})['then'](function(_0x3b7762){if(_0x3b7762){_0xcd4015=_0x3b7762[_0x9853('0x4a')];if(!_0x2d2d61[_0x9853('0x43')][_0x9853('0x4b')](_0x9853('0x4c'))){_0x331eba[_0x9853('0x30')]=qs[_0x9853('0x30')](_0x2d2d61['query'][_0x9853('0x30')]);_0x331eba[_0x9853('0x2e')]=qs['offset'](_0x2d2d61[_0x9853('0x43')]['offset']);}return _0x1e022a['getApplications'](_0x331eba);}})[_0x9853('0x1f')](function(_0xd12c77){if(_0xd12c77){return _0xd12c77?{'count':_0xcd4015,'rows':_0xd12c77}:null;}})['then'](respondWithResult(_0x2e182f,null))['catch'](handleError(_0x2e182f,null));};exports[_0x9853('0x81')]=function(_0x342cea,_0xe4c74c,_0x1bf516){var _0x594c7d={'channel':_0x9853('0x82')};var _0x2ac201=[];var _0x33d032=[];var _0x41251f={};return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x342cea[_0x9853('0x58')]['id']},'include':[{'model':db[_0x9853('0x7c')],'as':_0x9853('0x83')}]})['then'](handleEntityNotFound(_0xe4c74c,null))[_0x9853('0x1f')](function(_0x2fef80){_0x594c7d['account']=_0x2fef80;if(_0x594c7d['account']&&_0x594c7d[_0x9853('0x84')][_0x9853('0x41')]===_0x9853('0x85')&&_0x342cea[_0x9853('0x5b')][_0x9853('0x86')]){if(_0x342cea[_0x9853('0x5b')][_0x9853('0x86')]['length']===0x0)return;if(_0x342cea['body'][_0x9853('0x86')][0x0]['state']!==_0x9853('0x87'))return;return db['WhatsappMessage'][_0x9853('0x35')]({'read':!![],'readAt':_0x342cea[_0x9853('0x5b')]['statuses'][0x0][_0x9853('0x88')]},{'where':{'messageId':_0x342cea[_0x9853('0x5b')][_0x9853('0x86')][0x0][_0x9853('0x89')]},'individualHooks':!![]})[_0x9853('0x1f')](function(_0x3be22f){return _0xe4c74c[_0x9853('0x2c')](0xc8)['json'](_0x3be22f);});}_0x594c7d[_0x9853('0x8a')]=_[_0x9853('0x8b')](_0x2fef80['Applications'],[_0x9853('0x7e')],[_0x9853('0x8c')]);if(_0x594c7d[_0x9853('0x84')][_0x9853('0x83')]){delete _0x594c7d[_0x9853('0x84')][_0x9853('0x83')];}return db[_0x9853('0x8d')][_0x9853('0x64')]()[_0x9853('0x1f')](function(_0x147785){if(!_0x147785){throw new db[(_0x9853('0x8e'))][(_0x9853('0x8f'))](_0x9853('0x90'));}_0x2ac201=_[_0x9853('0x91')](_[_0x9853('0x44')](_0x147785),[_0x9853('0x92'),_0x9853('0x93')]);_0x33d032=_['difference'](_[_0x9853('0x44')](_0x147785),[_0x9853('0x92'),_0x9853('0x93'),_0x9853('0x94'),'ListId']);_0x594c7d[_0x9853('0x5b')]={'mapKey':_0x9853('0x95')};if(_0x594c7d[_0x9853('0x84')]&&_0x594c7d[_0x9853('0x84')][_0x9853('0x41')]===_0x9853('0x96')){_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')]=_0x342cea['body'][_0x9853('0x98')][_0x9853('0x99')](_0x9853('0x9a'),'');_0x594c7d['body'][_0x9853('0x5b')]=_0x342cea[_0x9853('0x5b')]['Body'];_0x594c7d['body'][_0x9853('0x9b')]=_0x342cea[_0x9853('0x5b')][_0x9853('0x9c')];}if(_0x594c7d[_0x9853('0x84')]&&_0x594c7d[_0x9853('0x84')][_0x9853('0x41')]===_0x9853('0x85')){_0x594c7d['body']['from']=_0x342cea[_0x9853('0x5b')][_0x9853('0x9d')][0x0]['from'];_0x594c7d[_0x9853('0x5b')]['body']=_0x342cea[_0x9853('0x5b')][_0x9853('0x9d')][0x0]['message']['body'];_0x594c7d[_0x9853('0x5b')]['messageId']=_0x342cea[_0x9853('0x5b')][_0x9853('0x9d')][0x0][_0x9853('0x89')];}if(_0x594c7d['body']['id']){delete _0x594c7d[_0x9853('0x5b')]['id'];}if(_[_0x9853('0x9e')](_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')])){throw new db[(_0x9853('0x8e'))]['ValidationError'](_0x9853('0x9f'));}if(_[_0x9853('0x9e')](_0x594c7d[_0x9853('0x5b')]['body'])||_0x594c7d[_0x9853('0x5b')]['body']===''){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xa0'));}if(_[_0x9853('0x9e')](_0x594c7d['body']['mapKey'])){throw new db[(_0x9853('0x8e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33d032);}if(!_['includes'](_0x33d032,_0x594c7d['body'][_0x9853('0xa1')])){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xa2')+_0x33d032);}_0x41251f[_0x594c7d['body']['mapKey']]=_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')];return db['CmList'][_0x9853('0x5f')]({'where':{'id':_0x594c7d['account']['ListId']},'include':[{'model':db[_0x9853('0x8d')],'as':_0x9853('0xa3'),'where':_0x41251f,'limit':0x1,'order':[[_0x9853('0x93'),_0x9853('0xa4')]]}]});})[_0x9853('0x1f')](handleEntityNotFound(_0xe4c74c,null))[_0x9853('0x1f')](function(_0x365104){if(_0x365104){_0x594c7d[_0x9853('0xa5')]=_['omit'](_0x365104,[_0x9853('0xa3')]);if(_0x365104[_0x9853('0xa3')]['length']){return _0x365104[_0x9853('0xa3')][0x0];}var _0x34a0f6=_[_0x9853('0x19')](_0x594c7d[_0x9853('0x5b')],{'firstName':_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')],'ListId':_0x365104['id']});_0x34a0f6[_0x594c7d['body'][_0x9853('0xa1')]]=_0x594c7d[_0x9853('0x5b')]['from'];return db['CmContact'][_0x9853('0x5a')](_0x34a0f6,{'fields':_0x2ac201,'raw':!![]});}})['then'](handleEntityNotFound(_0xe4c74c,null))[_0x9853('0x1f')](function(_0x16ccec){if(_0x16ccec){_0x594c7d['contact']=_0x16ccec;var _0xa2033e={'ContactId':_0x16ccec['id'],'phone':_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')],'WhatsappAccountId':_0x342cea[_0x9853('0x58')]['id']};var _0x5929e6={'ContactId':_0x16ccec['id'],'WhatsappAccountId':_0x342cea[_0x9853('0x58')]['id'],'closed':![]};return db[_0x9853('0xa6')][_0x9853('0x5f')]({'where':_0x5929e6})[_0x9853('0x1f')](function(_0xfd1720){if(_0xfd1720){return[_0xfd1720,![]];}return db[_0x9853('0xa6')][_0x9853('0x5a')](_0xa2033e)[_0x9853('0x1f')](function(_0x501df8){return[_0x501df8,!![]];});});}})['spread'](function(_0x3758d6,_0x4a592f){_0x594c7d[_0x9853('0xa7')]=_0x3758d6[_0x9853('0x36')]({'plain':!![]});_0x594c7d[_0x9853('0xa7')][_0x9853('0xa8')]=![];if(_0x4a592f){if(_0x594c7d[_0x9853('0x84')][_0x9853('0xa9')]){_0x594c7d[_0x9853('0x8a')][_0x9853('0xaa')]({'id':0x0,'priority':_0x594c7d[_0x9853('0x8a')][_0x9853('0x4a')]+0x1,'app':_0x9853('0xab'),'appdata':_0x9853('0xac'),'interval':'*,*,*,*'});}_0x594c7d['interaction']['created']=!![];}return db[_0x9853('0xad')][_0x9853('0x5a')]({'phone':_0x594c7d[_0x9853('0x5b')][_0x9853('0x97')],'messageId':_0x594c7d[_0x9853('0x5b')][_0x9853('0x9b')],'body':_0x594c7d[_0x9853('0x5b')][_0x9853('0x5b')],'WhatsappAccountId':_0x342cea[_0x9853('0x58')]['id'],'WhatsappInteractionId':_0x3758d6['id'],'direction':'in','ContactId':_0x3758d6[_0x9853('0xae')],'AttachmentId':_0x594c7d[_0x9853('0x5b')][_0x9853('0xaf')]});})[_0x9853('0x1f')](function(_0x38e461){_0x594c7d['message']=_0x38e461;if(_0x594c7d['interaction'][_0x9853('0xb0')]){return db['User'][_0x9853('0x5f')]({'attributes':['id',_0x9853('0x39')],'where':{'id':_0x594c7d[_0x9853('0xa7')][_0x9853('0xb0')]}})[_0x9853('0x1f')](function(_0x384dc4){if(_0x384dc4){_0x594c7d[_0x9853('0x8a')][_0x9853('0xb1')]({'id':0x0,'priority':0x0,'app':_0x9853('0xb2'),'appdata':_0x384dc4[_0x9853('0x39')]+','+(_0x594c7d['account'][_0x9853('0xb3')]||0xa),'interval':_0x9853('0xb4')});}return respondWithRpcPromise('Start','startRouting',_0x594c7d);});}return respondWithRpcPromise(_0x9853('0xb5'),_0x9853('0xb6'),_0x594c7d);})[_0x9853('0x1f')](function(_0x37a908){if(_0x37a908){var _0x5e8833=0xc8;var _0x48d3c0='receiveMessage';logger[_0x9853('0x20')](_0x9853('0x23'),_0x48d3c0,_0x5e8833,_0x9853('0xb7'));logger[_0x9853('0xb8')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x48d3c0,_0x5e8833,_0x9853('0xb7'),JSON[_0x9853('0x24')](_0x37a908));if(_0x594c7d[_0x9853('0x84')]['type']===_0x9853('0x96')){return _0xe4c74c[_0x9853('0x2c')](_0x5e8833)[_0x9853('0x32')](_0x9853('0xb9'),_0x9853('0xba'))[_0x9853('0x3a')](_0x9853('0xbb'));}else{return _0xe4c74c[_0x9853('0x2c')](_0x5e8833)['json'](_0x37a908);}}});})['catch'](handleError(_0xe4c74c,null));};exports[_0x9853('0x3a')]=function(_0x24150f,_0x4223bd,_0x59f15c){var _0x4740fd,_0x22490,_0x13d1ba;if(_[_0x9853('0x9e')](_0x24150f[_0x9853('0x5b')][_0x9853('0x5b')])||_0x24150f[_0x9853('0x5b')][_0x9853('0x5b')]===''){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xa0'));}if(_[_0x9853('0x9e')](_0x24150f['body']['to'])){throw new db['Sequelize'][(_0x9853('0x8f'))](_0x9853('0xbc'));}_0x4740fd=_0x24150f[_0x9853('0x5b')]['to'];return db[_0x9853('0x54')][_0x9853('0x5f')]({'where':{'id':_0x24150f[_0x9853('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9853('0x8d')],'as':'Contacts','where':{'mobile':_0x4740fd},'limit':0x1,'order':[[_0x9853('0x93'),_0x9853('0xa4')]]}]}]})[_0x9853('0x1f')](handleEntityNotFound(_0x4223bd,null))[_0x9853('0x1f')](function(_0x134d05){if(_0x134d05&&_0x134d05[_0x9853('0xbd')]){_0x22490=_0x134d05[_0x9853('0x36')]({'plain':!![]});if(_0x22490[_0x9853('0xbd')]&&_0x22490[_0x9853('0xbd')][_0x9853('0xa3')][_0x9853('0x4a')]){return _0x22490[_0x9853('0xbd')][_0x9853('0xa3')][0x0];}return db[_0x9853('0x8d')][_0x9853('0x5a')](_['defaults'](_0x24150f[_0x9853('0x5b')],{'firstName':_0x4740fd,'mobile':_0x4740fd,'phone':_0x4740fd,'ListId':_0x22490[_0x9853('0xbe')]}));}})[_0x9853('0x1f')](handleEntityNotFound(_0x4223bd,null))['then'](function(_0x1a1d4f){if(_0x1a1d4f){_0x13d1ba=_0x1a1d4f;return db[_0x9853('0xa6')][_0x9853('0x5f')]({'where':{'ContactId':_0x13d1ba['id'],'closed':![],'WhatsappAccountId':_0x22490['id']}})[_0x9853('0x1f')](function(_0x4d2ea4){if(_0x4d2ea4){return[_0x4d2ea4,![]];}return db['WhatsappInteraction'][_0x9853('0x5a')]({'UserId':_0x24150f[_0x9853('0x5e')]['id'],'ContactId':_0x13d1ba['id'],'WhatsappAccountId':_0x22490['id'],'phone':_0x4740fd,'firstMsgDirection':_0x9853('0xbf'),'Messages':[_[_0x9853('0x52')](_0x24150f[_0x9853('0x5b')],{'read':![],'body':_0x24150f[_0x9853('0x5b')][_0x9853('0x5b')],'phone':_0x4740fd,'WhatsappAccountId':_0x22490['id'],'UserId':_0x24150f[_0x9853('0x5e')]['id'],'ContactId':_0x13d1ba['id']})]},{'include':[{'model':db[_0x9853('0xad')],'as':_0x9853('0xc0')}]})[_0x9853('0x1f')](function(_0x5095ee){return[_0x5095ee,!![]];});});}})['spread'](function(_0x2c0edd,_0x15214b){if(_0x15214b){return _0x2c0edd;}return db[_0x9853('0xad')][_0x9853('0x5a')](_[_0x9853('0x52')](_0x24150f['body'],{'read':![],'body':_0x24150f[_0x9853('0x5b')]['body'],'phone':_0x4740fd,'WhatsappAccountId':_0x22490['id'],'WhatsappInteractionId':_0x2c0edd['id'],'UserId':_0x24150f['user']['id'],'ContactId':_0x13d1ba['id']}))[_0x9853('0x1f')](function(_0x360942){_0x2c0edd[_0x9853('0xc1')][_0x9853('0xc0')]=[];_0x2c0edd[_0x9853('0xc1')][_0x9853('0xc0')][_0x9853('0xaa')](_0x360942[_0x9853('0xc1')]);return _0x2c0edd;});})['then'](respondWithResult(_0x4223bd,null))['catch'](handleError(_0x4223bd,null));}; \ No newline at end of file +var _0x2d24=['stringify','error','message','result','catch','status','end','limit','undefined','count','offset','Content-Range','reject','update','then','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','send','Pause','map','WhatsappAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority','stack','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','contact','WhatsappInteraction','interaction','created','autoclose','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','json','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d88f8,_0x44bb38){var _0x49b17c=function(_0x215f58){while(--_0x215f58){_0x1d88f8['push'](_0x1d88f8['shift']());}};_0x49b17c(++_0x44bb38);}(_0x2d24,0xa1));var _0x42d2=function(_0x3d8fba,_0x24a47f){_0x3d8fba=_0x3d8fba-0x0;var _0x56103a=_0x2d24[_0x3d8fba];return _0x56103a;};'use strict';var emlformat=require(_0x42d2('0x0'));var rimraf=require(_0x42d2('0x1'));var zipdir=require(_0x42d2('0x2'));var jsonpatch=require(_0x42d2('0x3'));var rp=require(_0x42d2('0x4'));var moment=require('moment');var BPromise=require(_0x42d2('0x5'));var Mustache=require('mustache');var util=require(_0x42d2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x42d2('0x7'));var ejs=require(_0x42d2('0x8'));var fs=require('fs');var fs_extra=require(_0x42d2('0x9'));var _=require(_0x42d2('0xa'));var squel=require(_0x42d2('0xb'));var crypto=require(_0x42d2('0xc'));var jsforce=require(_0x42d2('0xd'));var deskjs=require(_0x42d2('0xe'));var toCsv=require(_0x42d2('0x7'));var querystring=require(_0x42d2('0xf'));var Papa=require(_0x42d2('0x10'));var Redis=require(_0x42d2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x42d2('0x12'));var as=require(_0x42d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x42d2('0x14'));var config=require(_0x42d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x42d2('0x16'))['db'];config[_0x42d2('0x17')]=_[_0x42d2('0x18')](config['redis'],{'host':_0x42d2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42d2('0x17')]));require(_0x42d2('0x1a'))[_0x42d2('0x1b')](socket);var jayson=require(_0x42d2('0x1c'));var client=jayson[_0x42d2('0x1d')][_0x42d2('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5ecc27,_0x361a17,_0x460c72,_0x44b0dc){return new BPromise(function(_0xc349b5,_0x14b985){var _0x25074e=_0x44b0dc||client;return _0x25074e[_0x42d2('0x1f')](_0x5ecc27,_0x460c72)['then'](function(_0x149e23){logger[_0x42d2('0x20')](_0x42d2('0x21'),_0x361a17,_0x42d2('0x22'));logger[_0x42d2('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x361a17,_0x42d2('0x22'),JSON[_0x42d2('0x24')](_0x149e23));if(_0x149e23[_0x42d2('0x25')]){if(_0x149e23[_0x42d2('0x25')]['code']===0x1f4){logger[_0x42d2('0x25')](_0x42d2('0x21'),_0x361a17,_0x149e23[_0x42d2('0x25')][_0x42d2('0x26')]);return _0x14b985(_0x149e23[_0x42d2('0x25')][_0x42d2('0x26')]);}logger[_0x42d2('0x25')](_0x42d2('0x21'),_0x361a17,_0x149e23[_0x42d2('0x25')][_0x42d2('0x26')]);return _0xc349b5(_0x149e23[_0x42d2('0x25')][_0x42d2('0x26')]);}else{logger[_0x42d2('0x20')](_0x42d2('0x21'),_0x361a17,_0x42d2('0x22'));_0xc349b5(_0x149e23[_0x42d2('0x27')][_0x42d2('0x26')]);}})[_0x42d2('0x28')](function(_0x5beb6e){logger[_0x42d2('0x25')](_0x42d2('0x21'),_0x361a17,_0x5beb6e);_0x14b985(_0x5beb6e);});});}function respondWithStatusCode(_0x3d7205,_0x18455f){_0x18455f=_0x18455f||0xcc;return function(_0x133100){if(_0x133100){return _0x3d7205['sendStatus'](_0x18455f);}return _0x3d7205[_0x42d2('0x29')](_0x18455f)[_0x42d2('0x2a')]();};}function respondWithResult(_0x386851,_0x4adfbc){_0x4adfbc=_0x4adfbc||0xc8;return function(_0x3811db){if(_0x3811db){return _0x386851[_0x42d2('0x29')](_0x4adfbc)['json'](_0x3811db);}};}function respondWithFilteredResult(_0x3f6533,_0x547403){return function(_0x1850a2){if(_0x1850a2){var _0x8f85ad=typeof _0x547403['offset']==='undefined'&&typeof _0x547403[_0x42d2('0x2b')]===_0x42d2('0x2c');var _0x2f7a17=_0x1850a2[_0x42d2('0x2d')];var _0x129b43=_0x8f85ad?0x0:_0x547403[_0x42d2('0x2e')];var _0x45863e=_0x8f85ad?_0x1850a2[_0x42d2('0x2d')]:_0x547403[_0x42d2('0x2e')]+_0x547403['limit'];var _0x1152b6;if(_0x45863e>=_0x2f7a17){_0x45863e=_0x2f7a17;_0x1152b6=0xc8;}else{_0x1152b6=0xce;}_0x3f6533['status'](_0x1152b6);return _0x3f6533['set'](_0x42d2('0x2f'),_0x129b43+'-'+_0x45863e+'/'+_0x2f7a17)['json'](_0x1850a2);}return null;};}function patchUpdates(_0xc63ff9){return function(_0x37b132){try{jsonpatch['apply'](_0x37b132,_0xc63ff9,!![]);}catch(_0x13f9dd){return BPromise[_0x42d2('0x30')](_0x13f9dd);}return _0x37b132['save']();};}function saveUpdates(_0x19e30a,_0xeb58ed){return function(_0x42b2de){if(_0x42b2de){return _0x42b2de[_0x42d2('0x31')](_0x19e30a)[_0x42d2('0x32')](function(_0x4c3900){return _0x4c3900;});}return null;};}function removeEntity(_0x296465,_0x5f1c41){return function(_0x110e63){if(_0x110e63){return _0x110e63[_0x42d2('0x33')]()['then'](function(){var _0x3b667c=_0x110e63[_0x42d2('0x34')]({'plain':!![]});var _0x3aff9a=_0x42d2('0x35');return db[_0x42d2('0x36')][_0x42d2('0x33')]({'where':{'type':_0x3aff9a,'resourceId':_0x3b667c['id']}})['then'](function(){return _0x110e63;});})[_0x42d2('0x32')](function(){_0x296465[_0x42d2('0x29')](0xcc)[_0x42d2('0x2a')]();});}};}function handleEntityNotFound(_0x6ccb08,_0xa58752){return function(_0x8f9738){if(!_0x8f9738){_0x6ccb08[_0x42d2('0x37')](0x194);}return _0x8f9738;};}function handleError(_0x1202b7,_0x57a58e){_0x57a58e=_0x57a58e||0x1f4;return function(_0x302969){logger[_0x42d2('0x25')](_0x302969['stack']);if(_0x302969[_0x42d2('0x38')]){delete _0x302969[_0x42d2('0x38')];}_0x1202b7[_0x42d2('0x29')](_0x57a58e)[_0x42d2('0x39')](_0x302969);};}exports['index']=function(_0x892d7d,_0x213aa3){var _0x26328f={'include':[{'model':db[_0x42d2('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3d1f99={},_0x516da9={'count':0x0,'rows':[]};var _0x368567=_[_0x42d2('0x3b')](db[_0x42d2('0x3c')][_0x42d2('0x3d')],function(_0x1addcc){return{'name':_0x1addcc['fieldName'],'type':_0x1addcc[_0x42d2('0x3e')]['key']};});_0x3d1f99[_0x42d2('0x3f')]=_[_0x42d2('0x3b')](_0x368567,_0x42d2('0x38'));_0x3d1f99[_0x42d2('0x40')]=_['keys'](_0x892d7d[_0x42d2('0x40')]);_0x3d1f99[_0x42d2('0x41')]=_[_0x42d2('0x42')](_0x3d1f99[_0x42d2('0x3f')],_0x3d1f99[_0x42d2('0x40')]);_0x26328f[_0x42d2('0x43')]=_['intersection'](_0x3d1f99[_0x42d2('0x3f')],qs[_0x42d2('0x44')](_0x892d7d[_0x42d2('0x40')][_0x42d2('0x44')]));_0x26328f['attributes']=_0x26328f[_0x42d2('0x43')][_0x42d2('0x45')]?_0x26328f[_0x42d2('0x43')]:_0x3d1f99[_0x42d2('0x3f')];if(!_0x892d7d[_0x42d2('0x40')][_0x42d2('0x46')](_0x42d2('0x47'))){_0x26328f[_0x42d2('0x2b')]=qs[_0x42d2('0x2b')](_0x892d7d[_0x42d2('0x40')][_0x42d2('0x2b')]);_0x26328f[_0x42d2('0x2e')]=qs[_0x42d2('0x2e')](_0x892d7d['query'][_0x42d2('0x2e')]);}_0x26328f[_0x42d2('0x48')]=qs[_0x42d2('0x49')](_0x892d7d[_0x42d2('0x40')]['sort']);_0x26328f[_0x42d2('0x4a')]=qs[_0x42d2('0x41')](_[_0x42d2('0x4b')](_0x892d7d[_0x42d2('0x40')],_0x3d1f99[_0x42d2('0x41')]),_0x368567);if(_0x892d7d['query'][_0x42d2('0x4c')]){_0x26328f[_0x42d2('0x4a')]=_[_0x42d2('0x4d')](_0x26328f['where'],{'$or':_[_0x42d2('0x3b')](_0x368567,function(_0x410ddd){if(_0x410ddd[_0x42d2('0x3e')]!==_0x42d2('0x4e')){var _0x13815e={};_0x13815e[_0x410ddd[_0x42d2('0x38')]]={'$like':'%'+_0x892d7d[_0x42d2('0x40')]['filter']+'%'};return _0x13815e;}})});}_0x26328f=_['merge']({},_0x26328f,_0x892d7d[_0x42d2('0x4f')]);var _0x1536a0={'where':_0x26328f[_0x42d2('0x4a')]};return db[_0x42d2('0x3c')][_0x42d2('0x2d')](_0x1536a0)[_0x42d2('0x32')](function(_0x109e90){_0x516da9[_0x42d2('0x2d')]=_0x109e90;if(_0x892d7d['query'][_0x42d2('0x50')]){_0x26328f[_0x42d2('0x51')]=[{'all':!![]}];}return db[_0x42d2('0x3c')][_0x42d2('0x52')](_0x26328f);})['then'](function(_0x1ed8e7){_0x516da9[_0x42d2('0x53')]=_0x1ed8e7;return _0x516da9;})[_0x42d2('0x32')](respondWithFilteredResult(_0x213aa3,_0x26328f))[_0x42d2('0x28')](handleError(_0x213aa3,null));};exports[_0x42d2('0x54')]=function(_0x2000d5,_0x435346){var _0x5d040f={'raw':![],'where':{'id':_0x2000d5[_0x42d2('0x55')]['id']},'include':[{'model':db[_0x42d2('0x3a')],'as':_0x42d2('0x56')}]},_0x566c60={};_0x566c60[_0x42d2('0x3f')]=_['keys'](db[_0x42d2('0x3c')][_0x42d2('0x3d')]);_0x566c60[_0x42d2('0x40')]=_[_0x42d2('0x57')](_0x2000d5['query']);_0x566c60[_0x42d2('0x41')]=_[_0x42d2('0x42')](_0x566c60['model'],_0x566c60[_0x42d2('0x40')]);_0x5d040f['attributes']=_[_0x42d2('0x42')](_0x566c60[_0x42d2('0x3f')],qs[_0x42d2('0x44')](_0x2000d5['query'][_0x42d2('0x44')]));_0x5d040f[_0x42d2('0x43')]=_0x5d040f[_0x42d2('0x43')][_0x42d2('0x45')]?_0x5d040f[_0x42d2('0x43')]:_0x566c60[_0x42d2('0x3f')];if(_0x2000d5['query'][_0x42d2('0x50')]){_0x5d040f[_0x42d2('0x51')]=[{'all':!![]}];}_0x5d040f=_[_0x42d2('0x4d')]({},_0x5d040f,_0x2000d5[_0x42d2('0x4f')]);return db[_0x42d2('0x3c')][_0x42d2('0x58')](_0x5d040f)[_0x42d2('0x32')](handleEntityNotFound(_0x435346,null))[_0x42d2('0x32')](respondWithResult(_0x435346,null))[_0x42d2('0x28')](handleError(_0x435346,null));};exports[_0x42d2('0x59')]=function(_0x5f2e4f,_0x1e2ed6){return db['WhatsappAccount'][_0x42d2('0x59')](_0x5f2e4f[_0x42d2('0x5a')],{})['then'](function(_0x5df633){var _0x15b06b=_0x5f2e4f[_0x42d2('0x5b')][_0x42d2('0x34')]({'plain':!![]});if(!_0x15b06b)throw new Error(_0x42d2('0x5c'));if(_0x15b06b['role']===_0x42d2('0x5b')){var _0x316618=_0x5df633[_0x42d2('0x34')]({'plain':!![]});var _0x34748c='WhatsappAccounts';return db[_0x42d2('0x5d')][_0x42d2('0x58')]({'where':{'name':_0x34748c,'userProfileId':_0x15b06b[_0x42d2('0x5e')]},'raw':!![]})[_0x42d2('0x32')](function(_0x3f9c88){if(_0x3f9c88&&_0x3f9c88[_0x42d2('0x5f')]===0x0){return db[_0x42d2('0x36')][_0x42d2('0x59')]({'name':_0x316618[_0x42d2('0x38')],'resourceId':_0x316618['id'],'type':_0x3f9c88[_0x42d2('0x38')],'sectionId':_0x3f9c88['id']},{})[_0x42d2('0x32')](function(){return _0x5df633;});}else{return _0x5df633;}})[_0x42d2('0x28')](function(_0x49841f){logger[_0x42d2('0x25')](_0x42d2('0x60'),_0x49841f);throw _0x49841f;});}return _0x5df633;})['then'](respondWithResult(_0x1e2ed6,0xc9))[_0x42d2('0x28')](handleError(_0x1e2ed6,null));};exports[_0x42d2('0x31')]=function(_0x2d1df3,_0x53c21a){if(_0x2d1df3[_0x42d2('0x5a')]['id']){delete _0x2d1df3[_0x42d2('0x5a')]['id'];}return db['WhatsappAccount'][_0x42d2('0x58')]({'where':{'id':_0x2d1df3['params']['id']},'include':[{'model':db[_0x42d2('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x53c21a,null))[_0x42d2('0x32')](saveUpdates(_0x2d1df3[_0x42d2('0x5a')],null))[_0x42d2('0x32')](respondWithResult(_0x53c21a,null))[_0x42d2('0x28')](handleError(_0x53c21a,null));};exports[_0x42d2('0x33')]=function(_0x140118,_0x1ea6f1){return db[_0x42d2('0x3c')]['find']({'where':{'id':_0x140118[_0x42d2('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ea6f1,null))[_0x42d2('0x32')](removeEntity(_0x1ea6f1,null))[_0x42d2('0x28')](handleError(_0x1ea6f1,null));};exports[_0x42d2('0x61')]=function(_0x57fedb,_0x44d54d){return db[_0x42d2('0x3c')]['describe']()['then'](respondWithResult(_0x44d54d,null))['catch'](handleError(_0x44d54d,null));};exports[_0x42d2('0x62')]=function(_0x11530d,_0x34a435,_0x13a287){if(_0x11530d['body']['id']){delete _0x11530d[_0x42d2('0x5a')]['id'];}return db['WhatsappAccount'][_0x42d2('0x58')]({'where':{'id':_0x11530d[_0x42d2('0x55')]['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x34a435,null))[_0x42d2('0x32')](function(_0x49aa3e){if(_0x49aa3e){_0x11530d[_0x42d2('0x5a')][_0x42d2('0x63')]=_0x49aa3e['id'];return db['Disposition'][_0x42d2('0x59')](_0x11530d['body']);}})['then'](respondWithResult(_0x34a435,null))['catch'](handleError(_0x34a435,null));};exports[_0x42d2('0x64')]=function(_0x5ca703,_0x34e78c,_0x2c0175){var _0x549ef3={'raw':![],'where':{}};var _0x21c35b={};var _0x104f58={'count':0x0,'rows':[]};return db[_0x42d2('0x3c')][_0x42d2('0x65')]({'where':{'id':_0x5ca703[_0x42d2('0x55')]['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x34e78c,null))['then'](function(_0x46c1a1){if(_0x46c1a1){_0x21c35b[_0x42d2('0x3f')]=_[_0x42d2('0x57')](db[_0x42d2('0x66')][_0x42d2('0x3d')]);_0x21c35b[_0x42d2('0x40')]=_['keys'](_0x5ca703['query']);_0x21c35b[_0x42d2('0x41')]=_[_0x42d2('0x42')](_0x21c35b[_0x42d2('0x3f')],_0x21c35b['query']);_0x549ef3[_0x42d2('0x43')]=_[_0x42d2('0x42')](_0x21c35b[_0x42d2('0x3f')],qs[_0x42d2('0x44')](_0x5ca703[_0x42d2('0x40')][_0x42d2('0x44')]));_0x549ef3[_0x42d2('0x43')]=_0x549ef3[_0x42d2('0x43')][_0x42d2('0x45')]?_0x549ef3[_0x42d2('0x43')]:_0x21c35b[_0x42d2('0x3f')];if(!_0x5ca703[_0x42d2('0x40')][_0x42d2('0x46')](_0x42d2('0x47'))){_0x549ef3[_0x42d2('0x2b')]=qs[_0x42d2('0x2b')](_0x5ca703[_0x42d2('0x40')][_0x42d2('0x2b')]);_0x549ef3[_0x42d2('0x2e')]=qs[_0x42d2('0x2e')](_0x5ca703['query'][_0x42d2('0x2e')]);}_0x549ef3['order']=qs[_0x42d2('0x49')](_0x5ca703[_0x42d2('0x40')][_0x42d2('0x49')]);_0x549ef3[_0x42d2('0x4a')]=qs[_0x42d2('0x41')](_['pick'](_0x5ca703[_0x42d2('0x40')],_0x21c35b[_0x42d2('0x41')]));_0x549ef3[_0x42d2('0x4a')][_0x42d2('0x63')]=_0x46c1a1['id'];if(_0x5ca703[_0x42d2('0x40')][_0x42d2('0x4c')]){_0x549ef3[_0x42d2('0x4a')]=_['merge'](_0x549ef3[_0x42d2('0x4a')],{'$or':_[_0x42d2('0x3b')](_0x549ef3[_0x42d2('0x43')],function(_0x4ae958){var _0x27aae1={};_0x27aae1[_0x4ae958]={'$like':'%'+_0x5ca703['query']['filter']+'%'};return _0x27aae1;})});}_0x549ef3=_['merge']({},_0x549ef3,_0x5ca703['options']);return db[_0x42d2('0x66')][_0x42d2('0x2d')]({'where':_0x549ef3['where']})['then'](function(_0x26dfaa){_0x104f58[_0x42d2('0x2d')]=_0x26dfaa;if(_0x5ca703[_0x42d2('0x40')]['includeAll']){_0x549ef3['include']=[{'all':!![]}];}return db['Disposition'][_0x42d2('0x52')](_0x549ef3);})[_0x42d2('0x32')](function(_0x36222f){_0x104f58[_0x42d2('0x53')]=_0x36222f;return _0x104f58;});}})[_0x42d2('0x32')](respondWithFilteredResult(_0x34e78c,_0x549ef3))[_0x42d2('0x28')](handleError(_0x34e78c,null));};exports[_0x42d2('0x67')]=function(_0x37117e,_0x387bd9,_0xf99690){return db[_0x42d2('0x3c')][_0x42d2('0x58')]({'where':{'id':_0x37117e[_0x42d2('0x55')]['id']}})['then'](handleEntityNotFound(_0x387bd9,null))[_0x42d2('0x32')](function(_0x24d2d4){if(_0x24d2d4){return _0x24d2d4['removeDispositions'](_0x37117e[_0x42d2('0x40')][_0x42d2('0x68')]);}})[_0x42d2('0x32')](respondWithStatusCode(_0x387bd9,null))[_0x42d2('0x28')](handleError(_0x387bd9,null));};exports[_0x42d2('0x69')]=function(_0x3db8d1,_0x4b413f,_0x2973a8){if(_0x3db8d1[_0x42d2('0x5a')]['id']){delete _0x3db8d1[_0x42d2('0x5a')]['id'];}return db['WhatsappAccount'][_0x42d2('0x58')]({'where':{'id':_0x3db8d1['params']['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x4b413f,null))['then'](function(_0x2f784c){if(_0x2f784c){_0x3db8d1[_0x42d2('0x5a')][_0x42d2('0x63')]=_0x2f784c['id'];return db[_0x42d2('0x6a')][_0x42d2('0x59')](_0x3db8d1[_0x42d2('0x5a')]);}})[_0x42d2('0x32')](respondWithResult(_0x4b413f,null))['catch'](handleError(_0x4b413f,null));};exports[_0x42d2('0x6b')]=function(_0x5a4257,_0x2440c8,_0x5761e5){var _0x42c35e={'raw':![],'where':{}};var _0x91b080={};var _0x97921c={'count':0x0,'rows':[]};return db[_0x42d2('0x3c')]['findOne']({'where':{'id':_0x5a4257['params']['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x2440c8,null))[_0x42d2('0x32')](function(_0x2f2c2b){if(_0x2f2c2b){_0x91b080[_0x42d2('0x3f')]=_[_0x42d2('0x57')](db['CannedAnswer'][_0x42d2('0x3d')]);_0x91b080['query']=_[_0x42d2('0x57')](_0x5a4257[_0x42d2('0x40')]);_0x91b080[_0x42d2('0x41')]=_['intersection'](_0x91b080[_0x42d2('0x3f')],_0x91b080[_0x42d2('0x40')]);_0x42c35e[_0x42d2('0x43')]=_[_0x42d2('0x42')](_0x91b080[_0x42d2('0x3f')],qs['fields'](_0x5a4257['query'][_0x42d2('0x44')]));_0x42c35e[_0x42d2('0x43')]=_0x42c35e['attributes'][_0x42d2('0x45')]?_0x42c35e[_0x42d2('0x43')]:_0x91b080[_0x42d2('0x3f')];if(!_0x5a4257[_0x42d2('0x40')][_0x42d2('0x46')]('nolimit')){_0x42c35e[_0x42d2('0x2b')]=qs[_0x42d2('0x2b')](_0x5a4257[_0x42d2('0x40')][_0x42d2('0x2b')]);_0x42c35e[_0x42d2('0x2e')]=qs[_0x42d2('0x2e')](_0x5a4257[_0x42d2('0x40')][_0x42d2('0x2e')]);}_0x42c35e[_0x42d2('0x48')]=qs['sort'](_0x5a4257['query'][_0x42d2('0x49')]);_0x42c35e['where']=qs[_0x42d2('0x41')](_[_0x42d2('0x4b')](_0x5a4257[_0x42d2('0x40')],_0x91b080[_0x42d2('0x41')]));_0x42c35e[_0x42d2('0x4a')][_0x42d2('0x63')]=_0x2f2c2b['id'];if(_0x5a4257[_0x42d2('0x40')][_0x42d2('0x4c')]){_0x42c35e[_0x42d2('0x4a')]=_[_0x42d2('0x4d')](_0x42c35e[_0x42d2('0x4a')],{'$or':_[_0x42d2('0x3b')](_0x42c35e[_0x42d2('0x43')],function(_0x4d0da0){var _0x264a69={};_0x264a69[_0x4d0da0]={'$like':'%'+_0x5a4257[_0x42d2('0x40')][_0x42d2('0x4c')]+'%'};return _0x264a69;})});}_0x42c35e=_[_0x42d2('0x4d')]({},_0x42c35e,_0x5a4257[_0x42d2('0x4f')]);return db[_0x42d2('0x6a')]['count']({'where':_0x42c35e[_0x42d2('0x4a')]})[_0x42d2('0x32')](function(_0x44ab9c){_0x97921c['count']=_0x44ab9c;if(_0x5a4257[_0x42d2('0x40')]['includeAll']){_0x42c35e['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x42d2('0x52')](_0x42c35e);})['then'](function(_0x5ef8b4){_0x97921c['rows']=_0x5ef8b4;return _0x97921c;});}})['then'](respondWithFilteredResult(_0x2440c8,_0x42c35e))[_0x42d2('0x28')](handleError(_0x2440c8,null));};exports[_0x42d2('0x6c')]=function(_0x2276f4,_0x2703b4,_0x553d47){return db[_0x42d2('0x3c')]['find']({'where':{'id':_0x2276f4[_0x42d2('0x55')]['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x2703b4,null))[_0x42d2('0x32')](function(_0x5bc133){if(_0x5bc133){return _0x5bc133[_0x42d2('0x6c')](_0x2276f4[_0x42d2('0x40')][_0x42d2('0x68')]);}})[_0x42d2('0x32')](respondWithStatusCode(_0x2703b4,null))[_0x42d2('0x28')](handleError(_0x2703b4,null));};exports['addAgents']=function(_0x2e9059,_0x1ea5bd,_0x5159f1){return db[_0x42d2('0x3c')][_0x42d2('0x58')]({'where':{'id':_0x2e9059[_0x42d2('0x55')]['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x1ea5bd,null))[_0x42d2('0x32')](function(_0x44de3b){if(_0x44de3b){return _0x44de3b[_0x42d2('0x6d')](_0x2e9059[_0x42d2('0x5a')][_0x42d2('0x68')],_['omit'](_0x2e9059[_0x42d2('0x5a')],[_0x42d2('0x68'),'id'])||{})['spread'](function(_0x382909){for(var _0x81e893=0x0;_0x81e893<_0x2e9059[_0x42d2('0x5a')]['ids'][_0x42d2('0x45')];_0x81e893+=0x1){socket[_0x42d2('0x6e')](_0x42d2('0x6f'),{'UserId':Number(_0x2e9059[_0x42d2('0x5a')][_0x42d2('0x68')][_0x81e893]),'WhatsappAccountId':Number(_0x2e9059[_0x42d2('0x55')]['id'])});}return _0x382909;});}})['then'](respondWithResult(_0x1ea5bd,null))['catch'](handleError(_0x1ea5bd,null));};exports[_0x42d2('0x70')]=function(_0x229c97,_0x434c07,_0x26dda7){return db[_0x42d2('0x3c')]['find']({'where':{'id':_0x229c97['params']['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x434c07,null))['then'](function(_0x3f134b){if(_0x3f134b){return _0x3f134b[_0x42d2('0x70')](_0x229c97[_0x42d2('0x40')][_0x42d2('0x68')])['then'](function(){if(_[_0x42d2('0x71')](_0x229c97[_0x42d2('0x40')][_0x42d2('0x68')])){for(var _0x27f0f9=0x0;_0x27f0f9<_0x229c97[_0x42d2('0x40')][_0x42d2('0x68')][_0x42d2('0x45')];_0x27f0f9+=0x1){socket[_0x42d2('0x6e')](_0x42d2('0x72'),{'UserId':Number(_0x229c97[_0x42d2('0x40')]['ids'][_0x27f0f9]),'WhatsappAccountId':Number(_0x229c97[_0x42d2('0x55')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x229c97[_0x42d2('0x40')][_0x42d2('0x68')]),'WhatsappAccountId':Number(_0x229c97['params']['id'])});}});}})['then'](respondWithStatusCode(_0x434c07,null))[_0x42d2('0x28')](handleError(_0x434c07,null));};exports[_0x42d2('0x73')]=function(_0x5da650,_0x31114e,_0x14245a){var _0x362d96={};var _0x19df25={};var _0x91b1e6;var _0x384b2d;return db[_0x42d2('0x3c')][_0x42d2('0x65')]({'where':{'id':_0x5da650[_0x42d2('0x55')]['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x31114e,null))[_0x42d2('0x32')](function(_0x2ff205){if(_0x2ff205){_0x91b1e6=_0x2ff205;_0x19df25[_0x42d2('0x3f')]=_[_0x42d2('0x57')](db[_0x42d2('0x74')][_0x42d2('0x3d')]);_0x19df25[_0x42d2('0x40')]=_[_0x42d2('0x57')](_0x5da650[_0x42d2('0x40')]);_0x19df25['filters']=_['intersection'](_0x19df25[_0x42d2('0x3f')],_0x19df25['query']);_0x362d96[_0x42d2('0x43')]=_['intersection'](_0x19df25['model'],qs[_0x42d2('0x44')](_0x5da650[_0x42d2('0x40')][_0x42d2('0x44')]));_0x362d96[_0x42d2('0x43')]=_0x362d96['attributes'][_0x42d2('0x45')]?_0x362d96['attributes']:_0x19df25[_0x42d2('0x3f')];_0x362d96[_0x42d2('0x48')]=qs['sort'](_0x5da650[_0x42d2('0x40')][_0x42d2('0x49')]);_0x362d96[_0x42d2('0x4a')]=qs['filters'](_[_0x42d2('0x4b')](_0x5da650[_0x42d2('0x40')],_0x19df25['filters']));if(_0x5da650[_0x42d2('0x40')][_0x42d2('0x4c')]){_0x362d96[_0x42d2('0x4a')]=_[_0x42d2('0x4d')](_0x362d96[_0x42d2('0x4a')],{'$or':_[_0x42d2('0x3b')](_0x362d96['attributes'],function(_0x58443c){var _0x50b9c9={};_0x50b9c9[_0x58443c]={'$like':'%'+_0x5da650[_0x42d2('0x40')][_0x42d2('0x4c')]+'%'};return _0x50b9c9;})});}_0x362d96=_['merge']({},_0x362d96,_0x5da650[_0x42d2('0x4f')]);return _0x91b1e6[_0x42d2('0x73')](_0x362d96);}})[_0x42d2('0x32')](function(_0x25bf1b){if(_0x25bf1b){_0x384b2d=_0x25bf1b[_0x42d2('0x45')];if(!_0x5da650[_0x42d2('0x40')][_0x42d2('0x46')](_0x42d2('0x47'))){_0x362d96[_0x42d2('0x2b')]=qs['limit'](_0x5da650[_0x42d2('0x40')][_0x42d2('0x2b')]);_0x362d96[_0x42d2('0x2e')]=qs[_0x42d2('0x2e')](_0x5da650['query'][_0x42d2('0x2e')]);}return _0x91b1e6['getAgents'](_0x362d96);}})[_0x42d2('0x32')](function(_0x49ffd4){if(_0x49ffd4){return _0x49ffd4?{'count':_0x384b2d,'rows':_0x49ffd4}:null;}})[_0x42d2('0x32')](respondWithResult(_0x31114e,null))[_0x42d2('0x28')](handleError(_0x31114e,null));};exports[_0x42d2('0x75')]=function(_0x1d2002,_0x40d467){var _0x5efb21=_0x1d2002['params']['id'];var _0x512616=_0x1d2002[_0x42d2('0x5a')];var _0x409e0b=0xc8;var _0x4e1b1b=null;return db[_0x42d2('0x76')][_0x42d2('0x77')]({'isolationLevel':db[_0x42d2('0x76')][_0x42d2('0x78')][_0x42d2('0x79')][_0x42d2('0x7a')]},function(_0x1a328c){return db[_0x42d2('0x3c')][_0x42d2('0x65')]({'where':{'id':_0x5efb21},'transaction':_0x1a328c})[_0x42d2('0x32')](function(_0xb55bf6){if(_0xb55bf6){return db[_0x42d2('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x5efb21},'transaction':_0x1a328c})[_0x42d2('0x32')](function(){var _0x101a9c=_[_0x42d2('0x3b')](_0x512616,function(_0x1749e7){_0x1749e7[_0x42d2('0x63')]=_0x5efb21;return _0x1749e7;});return db[_0x42d2('0x7b')]['bulkCreate'](_0x101a9c,{'transaction':_0x1a328c});});}else{_0x409e0b=0x194;_0x4e1b1b=[];}});})['then'](function(){if(_0x409e0b!==0x194){return db[_0x42d2('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x5efb21},'order':_0x42d2('0x7c')})[_0x42d2('0x32')](function(_0x5c7172){_0x4e1b1b=_0x5c7172;});}})[_0x42d2('0x28')](function(_0x5c7062){_0x409e0b=0x1f4;logger['error'](_0x5c7062[_0x42d2('0x7d')]);if(_0x5c7062[_0x42d2('0x38')]){delete _0x5c7062[_0x42d2('0x38')];}_0x4e1b1b=_0x5c7062;})[_0x42d2('0x7e')](function(){if(_0x4e1b1b===null){_0x40d467[_0x42d2('0x37')](_0x409e0b);}else{if(_0x409e0b===0x1f4){_0x40d467[_0x42d2('0x29')](_0x409e0b)[_0x42d2('0x39')](_0x4e1b1b);}else{_0x40d467[_0x42d2('0x29')](_0x409e0b)['json'](_0x4e1b1b);}}});};exports['getApplications']=function(_0x3db2d7,_0x7be6b9,_0x2fecb1){var _0xbb914a={};var _0xcdb56e={};var _0x4f5c9a;var _0x34dcf2;return db['WhatsappAccount']['findOne']({'where':{'id':_0x3db2d7['params']['id']}})[_0x42d2('0x32')](handleEntityNotFound(_0x7be6b9,null))['then'](function(_0x3f95c4){if(_0x3f95c4){_0x4f5c9a=_0x3f95c4;_0xcdb56e['model']=_[_0x42d2('0x57')](db[_0x42d2('0x7b')][_0x42d2('0x3d')]);_0xcdb56e[_0x42d2('0x40')]=_[_0x42d2('0x57')](_0x3db2d7[_0x42d2('0x40')]);_0xcdb56e[_0x42d2('0x41')]=_[_0x42d2('0x42')](_0xcdb56e['model'],_0xcdb56e['query']);_0xbb914a[_0x42d2('0x43')]=_[_0x42d2('0x42')](_0xcdb56e[_0x42d2('0x3f')],qs['fields'](_0x3db2d7[_0x42d2('0x40')]['fields']));_0xbb914a[_0x42d2('0x43')]=_0xbb914a[_0x42d2('0x43')][_0x42d2('0x45')]?_0xbb914a[_0x42d2('0x43')]:_0xcdb56e[_0x42d2('0x3f')];_0xbb914a[_0x42d2('0x48')]=qs[_0x42d2('0x49')](_0x3db2d7[_0x42d2('0x40')]['sort']);_0xbb914a[_0x42d2('0x4a')]=qs[_0x42d2('0x41')](_[_0x42d2('0x4b')](_0x3db2d7[_0x42d2('0x40')],_0xcdb56e[_0x42d2('0x41')]));if(_0x3db2d7['query'][_0x42d2('0x4c')]){_0xbb914a[_0x42d2('0x4a')]=_[_0x42d2('0x4d')](_0xbb914a['where'],{'$or':_['map'](_0xbb914a['attributes'],function(_0x3570bb){var _0x3d4623={};_0x3d4623[_0x3570bb]={'$like':'%'+_0x3db2d7['query'][_0x42d2('0x4c')]+'%'};return _0x3d4623;})});}_0xbb914a=_[_0x42d2('0x4d')]({},_0xbb914a,_0x3db2d7[_0x42d2('0x4f')]);return _0x4f5c9a[_0x42d2('0x7f')](_0xbb914a);}})[_0x42d2('0x32')](function(_0x3b695b){if(_0x3b695b){_0x34dcf2=_0x3b695b[_0x42d2('0x45')];if(!_0x3db2d7[_0x42d2('0x40')]['hasOwnProperty'](_0x42d2('0x47'))){_0xbb914a['limit']=qs[_0x42d2('0x2b')](_0x3db2d7['query'][_0x42d2('0x2b')]);_0xbb914a[_0x42d2('0x2e')]=qs['offset'](_0x3db2d7['query'][_0x42d2('0x2e')]);}return _0x4f5c9a[_0x42d2('0x7f')](_0xbb914a);}})[_0x42d2('0x32')](function(_0x26ecc7){if(_0x26ecc7){return _0x26ecc7?{'count':_0x34dcf2,'rows':_0x26ecc7}:null;}})[_0x42d2('0x32')](respondWithResult(_0x7be6b9,null))[_0x42d2('0x28')](handleError(_0x7be6b9,null));};exports[_0x42d2('0x80')]=function(_0x30f45b,_0x4817a5,_0x586307){var _0x5013b3={'channel':'whatsapp'};var _0x4998dd=[];var _0x3d8cc3=[];var _0x3f971c={};return db[_0x42d2('0x3c')][_0x42d2('0x58')]({'where':{'id':_0x30f45b[_0x42d2('0x55')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x42d2('0x81')}]})[_0x42d2('0x32')](handleEntityNotFound(_0x4817a5,null))[_0x42d2('0x32')](function(_0x1f36d7){_0x5013b3[_0x42d2('0x82')]=_0x1f36d7;if(_0x5013b3['account']&&_0x5013b3[_0x42d2('0x82')][_0x42d2('0x3e')]===_0x42d2('0x83')&&_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x84')]){if(_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x84')][_0x42d2('0x45')]===0x0)return;if(_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x84')][0x0][_0x42d2('0x85')]!==_0x42d2('0x86'))return;return db[_0x42d2('0x87')][_0x42d2('0x31')]({'read':!![],'readAt':_0x30f45b[_0x42d2('0x5a')]['statuses'][0x0][_0x42d2('0x88')]},{'where':{'messageId':_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x84')][0x0][_0x42d2('0x89')]},'individualHooks':!![]})[_0x42d2('0x32')](function(_0x54286d){return _0x4817a5['status'](0xc8)['json'](_0x54286d);});}_0x5013b3[_0x42d2('0x8a')]=_['orderBy'](_0x1f36d7[_0x42d2('0x81')],[_0x42d2('0x7c')],[_0x42d2('0x8b')]);if(_0x5013b3[_0x42d2('0x82')][_0x42d2('0x81')]){delete _0x5013b3['account']['Applications'];}return db[_0x42d2('0x8c')][_0x42d2('0x61')]()[_0x42d2('0x32')](function(_0x1cf23f){if(!_0x1cf23f){throw new db['Sequelize'][(_0x42d2('0x8d'))](_0x42d2('0x8e'));}_0x4998dd=_[_0x42d2('0x8f')](_[_0x42d2('0x57')](_0x1cf23f),[_0x42d2('0x90'),_0x42d2('0x91')]);_0x3d8cc3=_[_0x42d2('0x8f')](_[_0x42d2('0x57')](_0x1cf23f),[_0x42d2('0x90'),_0x42d2('0x91'),_0x42d2('0x92'),'ListId']);_0x5013b3[_0x42d2('0x5a')]={'mapKey':_0x42d2('0x93')};if(_0x5013b3[_0x42d2('0x82')]&&_0x5013b3['account'][_0x42d2('0x3e')]===_0x42d2('0x94')){_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x95')]=_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x96')][_0x42d2('0x97')](_0x42d2('0x98'),'');_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x5a')]=_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x99')];_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x9a')]=_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x9b')];}if(_0x5013b3[_0x42d2('0x82')]&&_0x5013b3[_0x42d2('0x82')][_0x42d2('0x3e')]==='sinch'){_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x95')]=_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x9c')][0x0]['from'];_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x5a')]=_0x30f45b[_0x42d2('0x5a')][_0x42d2('0x9c')][0x0][_0x42d2('0x26')][_0x42d2('0x5a')];_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x9a')]=_0x30f45b[_0x42d2('0x5a')]['notifications'][0x0][_0x42d2('0x89')];}if(_0x5013b3[_0x42d2('0x5a')]['id']){delete _0x5013b3[_0x42d2('0x5a')]['id'];}if(_[_0x42d2('0x9d')](_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x95')])){throw new db[(_0x42d2('0x9e'))][(_0x42d2('0x8d'))](_0x42d2('0x9f'));}if(_[_0x42d2('0x9d')](_0x5013b3['body'][_0x42d2('0x5a')])||_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x5a')]===''){throw new db['Sequelize'][(_0x42d2('0x8d'))](_0x42d2('0xa0'));}if(_[_0x42d2('0x9d')](_0x5013b3['body'][_0x42d2('0xa1')])){throw new db[(_0x42d2('0x9e'))][(_0x42d2('0x8d'))](_0x42d2('0xa2')+_0x3d8cc3);}if(!_['includes'](_0x3d8cc3,_0x5013b3[_0x42d2('0x5a')][_0x42d2('0xa1')])){throw new db[(_0x42d2('0x9e'))][(_0x42d2('0x8d'))](_0x42d2('0xa3')+_0x3d8cc3);}_0x3f971c[_0x5013b3['body'][_0x42d2('0xa1')]]=_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x95')];return db[_0x42d2('0xa4')][_0x42d2('0x58')]({'where':{'id':_0x5013b3[_0x42d2('0x82')][_0x42d2('0xa5')]},'include':[{'model':db[_0x42d2('0x8c')],'as':_0x42d2('0xa6'),'where':_0x3f971c,'limit':0x1,'order':[[_0x42d2('0x91'),_0x42d2('0xa7')]]}]});})['then'](handleEntityNotFound(_0x4817a5,null))[_0x42d2('0x32')](function(_0x49b998){if(_0x49b998){_0x5013b3['list']=_[_0x42d2('0xa8')](_0x49b998,[_0x42d2('0xa6')]);if(_0x49b998[_0x42d2('0xa6')][_0x42d2('0x45')]){return _0x49b998[_0x42d2('0xa6')][0x0];}var _0x425ee7=_[_0x42d2('0x18')](_0x5013b3[_0x42d2('0x5a')],{'firstName':_0x5013b3['body'][_0x42d2('0x95')],'ListId':_0x49b998['id']});_0x425ee7[_0x5013b3[_0x42d2('0x5a')][_0x42d2('0xa1')]]=_0x5013b3[_0x42d2('0x5a')]['from'];return db[_0x42d2('0x8c')]['create'](_0x425ee7,{'fields':_0x4998dd,'raw':!![]});}})['then'](handleEntityNotFound(_0x4817a5,null))['then'](function(_0x22c898){if(_0x22c898){_0x5013b3[_0x42d2('0xa9')]=_0x22c898;var _0x6c1e61={'ContactId':_0x22c898['id'],'phone':_0x5013b3['body']['from'],'WhatsappAccountId':_0x30f45b[_0x42d2('0x55')]['id']};var _0x19c0a6={'ContactId':_0x22c898['id'],'WhatsappAccountId':_0x30f45b[_0x42d2('0x55')]['id'],'closed':![]};return db[_0x42d2('0xaa')][_0x42d2('0x58')]({'where':_0x19c0a6})[_0x42d2('0x32')](function(_0xf46938){if(_0xf46938){return[_0xf46938,![]];}return db[_0x42d2('0xaa')][_0x42d2('0x59')](_0x6c1e61)[_0x42d2('0x32')](function(_0x5501e0){return[_0x5501e0,!![]];});});}})['spread'](function(_0x3a9aae,_0x3688b1){_0x5013b3[_0x42d2('0xab')]=_0x3a9aae[_0x42d2('0x34')]({'plain':!![]});_0x5013b3['interaction'][_0x42d2('0xac')]=![];if(_0x3688b1){if(_0x5013b3[_0x42d2('0x82')][_0x42d2('0xad')]){_0x5013b3[_0x42d2('0x8a')]['push']({'id':0x0,'priority':_0x5013b3[_0x42d2('0x8a')][_0x42d2('0x45')]+0x1,'app':'close','appdata':_0x42d2('0xae'),'interval':_0x42d2('0xaf')});}_0x5013b3[_0x42d2('0xab')][_0x42d2('0xac')]=!![];}return db['WhatsappMessage'][_0x42d2('0x59')]({'phone':_0x5013b3[_0x42d2('0x5a')]['from'],'messageId':_0x5013b3['body'][_0x42d2('0x9a')],'body':_0x5013b3[_0x42d2('0x5a')][_0x42d2('0x5a')],'WhatsappAccountId':_0x30f45b[_0x42d2('0x55')]['id'],'WhatsappInteractionId':_0x3a9aae['id'],'direction':'in','ContactId':_0x3a9aae[_0x42d2('0xb0')],'AttachmentId':_0x5013b3['body'][_0x42d2('0xb1')]});})[_0x42d2('0x32')](function(_0x4fa29c){_0x5013b3[_0x42d2('0x26')]=_0x4fa29c;if(_0x5013b3[_0x42d2('0xab')][_0x42d2('0xb2')]){return db[_0x42d2('0x74')]['find']({'attributes':['id',_0x42d2('0x38')],'where':{'id':_0x5013b3[_0x42d2('0xab')][_0x42d2('0xb2')]}})[_0x42d2('0x32')](function(_0x53950d){if(_0x53950d){_0x5013b3['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x53950d[_0x42d2('0x38')]+','+(_0x5013b3[_0x42d2('0x82')][_0x42d2('0xb3')]||0xa),'interval':_0x42d2('0xaf')});}return respondWithRpcPromise('Start',_0x42d2('0xb4'),_0x5013b3);});}return respondWithRpcPromise(_0x42d2('0xb5'),_0x42d2('0xb4'),_0x5013b3);})['then'](function(_0x2ff164){if(_0x2ff164){var _0x695831=0xc8;var _0x7e027d=_0x42d2('0xb6');logger[_0x42d2('0x20')](_0x42d2('0xb7'),_0x7e027d,_0x695831,_0x42d2('0xb8'));logger[_0x42d2('0x23')](_0x42d2('0xb9'),_0x7e027d,_0x695831,_0x42d2('0xb8'),JSON[_0x42d2('0x24')](_0x2ff164));if(_0x5013b3['account'][_0x42d2('0x3e')]===_0x42d2('0x94')){return _0x4817a5[_0x42d2('0x29')](_0x695831)[_0x42d2('0xba')](_0x42d2('0xbb'),'text/xml')[_0x42d2('0x39')](_0x42d2('0xbc'));}else{return _0x4817a5[_0x42d2('0x29')](_0x695831)[_0x42d2('0xbd')](_0x2ff164);}}});})[_0x42d2('0x28')](handleError(_0x4817a5,null));};exports[_0x42d2('0x39')]=function(_0x3fedf9,_0x2c98ea,_0x4fb92e){var _0x51e881,_0x2eee56,_0x37860a;if(_[_0x42d2('0x9d')](_0x3fedf9[_0x42d2('0x5a')]['body'])||_0x3fedf9[_0x42d2('0x5a')]['body']===''){throw new db['Sequelize'][(_0x42d2('0x8d'))](_0x42d2('0xa0'));}if(_[_0x42d2('0x9d')](_0x3fedf9[_0x42d2('0x5a')]['to'])){throw new db[(_0x42d2('0x9e'))][(_0x42d2('0x8d'))](_0x42d2('0xbe'));}_0x51e881=_0x3fedf9[_0x42d2('0x5a')]['to'];return db['WhatsappAccount'][_0x42d2('0x58')]({'where':{'id':_0x3fedf9[_0x42d2('0x55')]['id']},'include':[{'model':db[_0x42d2('0xa4')],'as':_0x42d2('0xbf'),'include':[{'model':db[_0x42d2('0x8c')],'as':_0x42d2('0xa6'),'where':{'mobile':_0x51e881},'limit':0x1,'order':[[_0x42d2('0x91'),_0x42d2('0xa7')]]}]}]})['then'](handleEntityNotFound(_0x2c98ea,null))[_0x42d2('0x32')](function(_0x3c6a41){if(_0x3c6a41&&_0x3c6a41['List']){_0x2eee56=_0x3c6a41[_0x42d2('0x34')]({'plain':!![]});if(_0x2eee56[_0x42d2('0xbf')]&&_0x2eee56[_0x42d2('0xbf')]['Contacts'][_0x42d2('0x45')]){return _0x2eee56[_0x42d2('0xbf')][_0x42d2('0xa6')][0x0];}return db[_0x42d2('0x8c')]['create'](_[_0x42d2('0x18')](_0x3fedf9[_0x42d2('0x5a')],{'firstName':_0x51e881,'mobile':_0x51e881,'phone':_0x51e881,'ListId':_0x2eee56[_0x42d2('0xa5')]}));}})[_0x42d2('0x32')](handleEntityNotFound(_0x2c98ea,null))[_0x42d2('0x32')](function(_0x32d0c6){if(_0x32d0c6){_0x37860a=_0x32d0c6;return db[_0x42d2('0xaa')][_0x42d2('0x58')]({'where':{'ContactId':_0x37860a['id'],'closed':![],'WhatsappAccountId':_0x2eee56['id']}})['then'](function(_0x53bb14){if(_0x53bb14){return[_0x53bb14,![]];}return db[_0x42d2('0xaa')][_0x42d2('0x59')]({'UserId':_0x3fedf9[_0x42d2('0x5b')]['id'],'ContactId':_0x37860a['id'],'WhatsappAccountId':_0x2eee56['id'],'phone':_0x51e881,'firstMsgDirection':_0x42d2('0xc0'),'Messages':[_['merge'](_0x3fedf9['body'],{'read':![],'body':_0x3fedf9[_0x42d2('0x5a')][_0x42d2('0x5a')],'phone':_0x51e881,'WhatsappAccountId':_0x2eee56['id'],'UserId':_0x3fedf9['user']['id'],'ContactId':_0x37860a['id']})]},{'include':[{'model':db[_0x42d2('0x87')],'as':_0x42d2('0xc1')}]})['then'](function(_0x117b46){return[_0x117b46,!![]];});});}})[_0x42d2('0xc2')](function(_0x652102,_0x1f7f09){if(_0x1f7f09){return _0x652102;}return db[_0x42d2('0x87')][_0x42d2('0x59')](_[_0x42d2('0x4d')](_0x3fedf9[_0x42d2('0x5a')],{'read':![],'body':_0x3fedf9[_0x42d2('0x5a')][_0x42d2('0x5a')],'phone':_0x51e881,'WhatsappAccountId':_0x2eee56['id'],'WhatsappInteractionId':_0x652102['id'],'UserId':_0x3fedf9[_0x42d2('0x5b')]['id'],'ContactId':_0x37860a['id']}))['then'](function(_0x2089a6){_0x652102[_0x42d2('0xc3')][_0x42d2('0xc1')]=[];_0x652102['dataValues'][_0x42d2('0xc1')][_0x42d2('0xc4')](_0x2089a6[_0x42d2('0xc3')]);return _0x652102;});})[_0x42d2('0x32')](respondWithResult(_0x2c98ea,null))['catch'](handleError(_0x2c98ea,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7a48ff6..46644e1 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 _0xe435=['events','../../mysqldb','WhatsappAccount','save','update','remove','emit','hook'];(function(_0x4c7e5c,_0x3d8711){var _0x4cae7d=function(_0x30cb65){while(--_0x30cb65){_0x4c7e5c['push'](_0x4c7e5c['shift']());}};_0x4cae7d(++_0x3d8711);}(_0xe435,0x70));var _0x5e43=function(_0x2ad237,_0x51ef20){_0x2ad237=_0x2ad237-0x0;var _0x35ca94=_0xe435[_0x2ad237];return _0x35ca94;};'use strict';var EventEmitter=require(_0x5e43('0x0'));var WhatsappAccount=require(_0x5e43('0x1'))['db'][_0x5e43('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e43('0x3'),'afterUpdate':_0x5e43('0x4'),'afterDestroy':_0x5e43('0x5')};function emitEvent(_0x5714dd){return function(_0x214ca5,_0x3399bc,_0x3a8071){WhatsappAccountEvents[_0x5e43('0x6')](_0x5714dd+':'+_0x214ca5['id'],_0x214ca5);WhatsappAccountEvents['emit'](_0x5714dd,_0x214ca5);_0x3a8071(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x5e43('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x061f=['emit','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove'];(function(_0xf8935e,_0x2cf61f){var _0x458463=function(_0xc15fb4){while(--_0xc15fb4){_0xf8935e['push'](_0xf8935e['shift']());}};_0x458463(++_0x2cf61f);}(_0x061f,0x112));var _0xf061=function(_0x4b2801,_0x5895e5){_0x4b2801=_0x4b2801-0x0;var _0x346455=_0x061f[_0x4b2801];return _0x346455;};'use strict';var EventEmitter=require(_0xf061('0x0'));var WhatsappAccount=require(_0xf061('0x1'))['db'][_0xf061('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf061('0x3')](0x0);var events={'afterCreate':_0xf061('0x4'),'afterUpdate':'update','afterDestroy':_0xf061('0x5')};function emitEvent(_0x4735fd){return function(_0x34a78d,_0x37183c,_0x5348b4){WhatsappAccountEvents[_0xf061('0x6')](_0x4735fd+':'+_0x34a78d['id'],_0x34a78d);WhatsappAccountEvents[_0xf061('0x6')](_0x4735fd,_0x34a78d);_0x5348b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xf061('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index eeb2502..8244247 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 _0x3af6=['WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x221e9a,_0x52034a){var _0xf204d6=function(_0xd99672){while(--_0xd99672){_0x221e9a['push'](_0x221e9a['shift']());}};_0xf204d6(++_0x52034a);}(_0x3af6,0x116));var _0x63af=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3af6[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x63af('0x0'));var logger=require(_0x63af('0x1'))(_0x63af('0x2'));var moment=require(_0x63af('0x3'));var BPromise=require('bluebird');var rp=require(_0x63af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63af('0x5'));var config=require(_0x63af('0x6'));var attributes=require(_0x63af('0x7'));module[_0x63af('0x8')]=function(_0x491c36,_0x582f91){return _0x491c36[_0x63af('0x9')](_0x63af('0xa'),attributes,{'tableName':_0x63af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca98=['bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2c4cee,_0xed54d6){var _0x4cad54=function(_0x5ee3bd){while(--_0x5ee3bd){_0x2c4cee['push'](_0x2c4cee['shift']());}};_0x4cad54(++_0xed54d6);}(_0xca98,0xa3));var _0x8ca9=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0xca98[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require(_0x8ca9('0x0'));var util=require(_0x8ca9('0x1'));var logger=require(_0x8ca9('0x2'))(_0x8ca9('0x3'));var moment=require(_0x8ca9('0x4'));var BPromise=require(_0x8ca9('0x5'));var rp=require(_0x8ca9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ca9('0x7'));var config=require(_0x8ca9('0x8'));var attributes=require(_0x8ca9('0x9'));module[_0x8ca9('0xa')]=function(_0x47b314,_0x17acac){return _0x47b314[_0x8ca9('0xb')](_0x8ca9('0xc'),attributes,{'tableName':_0x8ca9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index a90c48d..1327628 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 _0xbde8=['localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis'];(function(_0x531233,_0x25067c){var _0x343e88=function(_0x1079d5){while(--_0x1079d5){_0x531233['push'](_0x531233['shift']());}};_0x343e88(++_0x25067c);}(_0xbde8,0xd9));var _0x8bde=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0xbde8[_0x525b28];return _0x180178;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bde('0x0'));var db=require(_0x8bde('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8bde('0x2'));var jayson=require(_0x8bde('0x3'));var client=jayson[_0x8bde('0x4')][_0x8bde('0x5')]({'port':0x232a});config[_0x8bde('0x6')]=_['defaults'](config['redis'],{'host':_0x8bde('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8bde('0x8'))[_0x8bde('0x9')](socket);function respondWithRpcPromise(_0x5134c1,_0x201568,_0x5070ed){return new BPromise(function(_0x2f083e,_0x45996b){return client[_0x8bde('0xa')](_0x5134c1,_0x5070ed)[_0x8bde('0xb')](function(_0x23b9ab){logger[_0x8bde('0xc')](_0x8bde('0xd'),_0x201568,_0x8bde('0xe'));logger[_0x8bde('0xf')](_0x8bde('0x10'),_0x201568,_0x8bde('0xe'),JSON[_0x8bde('0x11')](_0x23b9ab));if(_0x23b9ab['error']){if(_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x13')]===0x1f4){logger[_0x8bde('0x12')](_0x8bde('0xd'),_0x201568,_0x23b9ab['error']['message']);return _0x45996b(_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x14')]);}logger[_0x8bde('0x12')](_0x8bde('0xd'),_0x201568,_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x14')]);return _0x2f083e(_0x23b9ab[_0x8bde('0x12')][_0x8bde('0x14')]);}else{logger[_0x8bde('0xc')](_0x8bde('0xd'),_0x201568,_0x8bde('0xe'));_0x2f083e(_0x23b9ab[_0x8bde('0x15')][_0x8bde('0x14')]);}})[_0x8bde('0x16')](function(_0xef975){logger[_0x8bde('0x12')](_0x8bde('0xd'),_0x201568,_0xef975);_0x45996b(_0xef975);});});}exports[_0x8bde('0x17')]=function(_0x382fd9){var _0x2dc1f1=this;return new Promise(function(_0x52a1ad,_0x2139b8){return db['WhatsappAccount'][_0x8bde('0x18')]({'raw':_0x382fd9[_0x8bde('0x19')]?_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1a')]===undefined?!![]:![]:!![],'where':_0x382fd9['options']?_0x382fd9['options'][_0x8bde('0x1b')]||null:null,'attributes':_0x382fd9[_0x8bde('0x19')]?_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1c')]||null:null,'include':_0x382fd9['options']?_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1d')]?_[_0x8bde('0x1e')](_0x382fd9[_0x8bde('0x19')][_0x8bde('0x1d')],function(_0x53cb5d){return{'model':db[_0x53cb5d[_0x8bde('0x1f')]],'as':_0x53cb5d['as'],'attributes':_0x53cb5d['attributes'],'include':_0x53cb5d[_0x8bde('0x1d')]?_[_0x8bde('0x1e')](_0x53cb5d['include'],function(_0x1b8df8){return{'model':db[_0x1b8df8['model']],'as':_0x1b8df8['as'],'attributes':_0x1b8df8[_0x8bde('0x1c')],'include':_0x1b8df8[_0x8bde('0x1d')]?_[_0x8bde('0x1e')](_0x1b8df8[_0x8bde('0x1d')],function(_0x28a7b1){return{'model':db[_0x28a7b1[_0x8bde('0x1f')]],'as':_0x28a7b1['as'],'attributes':_0x28a7b1[_0x8bde('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8bde('0xb')](function(_0x33b03c){logger[_0x8bde('0xc')]('ShowWhatsappAccount',_0x382fd9);logger['debug'](_0x8bde('0x17'),_0x382fd9,JSON[_0x8bde('0x11')](_0x33b03c));_0x52a1ad(_0x33b03c);})['catch'](function(_0x21698d){logger[_0x8bde('0x12')](_0x8bde('0x17'),_0x21698d[_0x8bde('0x14')],_0x382fd9);_0x2139b8(_0x2dc1f1[_0x8bde('0x12')](0x1f4,_0x21698d['message']));});});}; \ No newline at end of file +var _0x7268=['model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','find','raw','options','where','attributes','map','include'];(function(_0x31c6b6,_0xdd33b7){var _0x32b27b=function(_0x32f195){while(--_0x32f195){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x32b27b(++_0xdd33b7);}(_0x7268,0x146));var _0x8726=function(_0x5462d5,_0x484cf5){_0x5462d5=_0x5462d5-0x0;var _0x3d0fcb=_0x7268[_0x5462d5];return _0x3d0fcb;};'use strict';var _=require(_0x8726('0x0'));var util=require('util');var moment=require(_0x8726('0x1'));var BPromise=require(_0x8726('0x2'));var rs=require(_0x8726('0x3'));var fs=require('fs');var Redis=require(_0x8726('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8726('0x5'));var logger=require(_0x8726('0x6'))(_0x8726('0x7'));var config=require('../../config/environment');var jayson=require(_0x8726('0x8'));var client=jayson['client'][_0x8726('0x9')]({'port':0x232a});config[_0x8726('0xa')]=_[_0x8726('0xb')](config[_0x8726('0xa')],{'host':_0x8726('0xc'),'port':0x18eb});var socket=require(_0x8726('0xd'))(new Redis(config[_0x8726('0xa')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x208825,_0x2e2c8f,_0x535099){return new BPromise(function(_0x46e804,_0xe52c1){return client[_0x8726('0xe')](_0x208825,_0x535099)['then'](function(_0x594872){logger['info'](_0x8726('0xf'),_0x2e2c8f,_0x8726('0x10'));logger[_0x8726('0x11')](_0x8726('0x12'),_0x2e2c8f,_0x8726('0x10'),JSON[_0x8726('0x13')](_0x594872));if(_0x594872[_0x8726('0x14')]){if(_0x594872[_0x8726('0x14')][_0x8726('0x15')]===0x1f4){logger['error'](_0x8726('0xf'),_0x2e2c8f,_0x594872[_0x8726('0x14')][_0x8726('0x16')]);return _0xe52c1(_0x594872[_0x8726('0x14')][_0x8726('0x16')]);}logger[_0x8726('0x14')](_0x8726('0xf'),_0x2e2c8f,_0x594872[_0x8726('0x14')][_0x8726('0x16')]);return _0x46e804(_0x594872[_0x8726('0x14')]['message']);}else{logger[_0x8726('0x17')](_0x8726('0xf'),_0x2e2c8f,_0x8726('0x10'));_0x46e804(_0x594872[_0x8726('0x18')]['message']);}})[_0x8726('0x19')](function(_0x1cb35f){logger[_0x8726('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x2e2c8f,_0x1cb35f);_0xe52c1(_0x1cb35f);});});}exports[_0x8726('0x1a')]=function(_0x4524be){var _0xec568c=this;return new Promise(function(_0x42f1bf,_0x44d9bc){return db['WhatsappAccount'][_0x8726('0x1b')]({'raw':_0x4524be['options']?_0x4524be['options'][_0x8726('0x1c')]===undefined?!![]:![]:!![],'where':_0x4524be['options']?_0x4524be[_0x8726('0x1d')][_0x8726('0x1e')]||null:null,'attributes':_0x4524be[_0x8726('0x1d')]?_0x4524be[_0x8726('0x1d')][_0x8726('0x1f')]||null:null,'include':_0x4524be[_0x8726('0x1d')]?_0x4524be[_0x8726('0x1d')]['include']?_[_0x8726('0x20')](_0x4524be[_0x8726('0x1d')][_0x8726('0x21')],function(_0x552bd9){return{'model':db[_0x552bd9[_0x8726('0x22')]],'as':_0x552bd9['as'],'attributes':_0x552bd9[_0x8726('0x1f')],'include':_0x552bd9[_0x8726('0x21')]?_[_0x8726('0x20')](_0x552bd9[_0x8726('0x21')],function(_0x3b6cc1){return{'model':db[_0x3b6cc1[_0x8726('0x22')]],'as':_0x3b6cc1['as'],'attributes':_0x3b6cc1[_0x8726('0x1f')],'include':_0x3b6cc1['include']?_[_0x8726('0x20')](_0x3b6cc1[_0x8726('0x21')],function(_0x3779e3){return{'model':db[_0x3779e3[_0x8726('0x22')]],'as':_0x3779e3['as'],'attributes':_0x3779e3[_0x8726('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8726('0x23')](function(_0x247e09){logger[_0x8726('0x17')]('ShowWhatsappAccount',_0x4524be);logger[_0x8726('0x11')](_0x8726('0x1a'),_0x4524be,JSON[_0x8726('0x13')](_0x247e09));_0x42f1bf(_0x247e09);})[_0x8726('0x19')](function(_0x59fbbe){logger[_0x8726('0x14')](_0x8726('0x1a'),_0x59fbbe[_0x8726('0x16')],_0x4524be);_0x44d9bc(_0xec568c[_0x8726('0x14')](0x1f4,_0x59fbbe[_0x8726('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 350180a..835209b 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 _0x3a0a=['emit','removeListener','register','length','save','remove','update'];(function(_0x1ba252,_0x34411f){var _0x459466=function(_0x55f893){while(--_0x55f893){_0x1ba252['push'](_0x1ba252['shift']());}};_0x459466(++_0x34411f);}(_0x3a0a,0x154));var _0xa3a0=function(_0x248302,_0x22b1a7){_0x248302=_0x248302-0x0;var _0x5ea301=_0x3a0a[_0x248302];return _0x5ea301;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xa3a0('0x0'),_0xa3a0('0x1'),_0xa3a0('0x2')];function createListener(_0xe24f0,_0x21a9d4){return function(_0x21e61b){_0x21a9d4[_0xa3a0('0x3')](_0xe24f0,_0x21e61b);};}function removeListener(_0xcbdd5c,_0x3dd712){return function(){WhatsappAccountEvents[_0xa3a0('0x4')](_0xcbdd5c,_0x3dd712);};}exports[_0xa3a0('0x5')]=function(_0x2d56c4){for(var _0x40b3b3=0x0,_0x204208=events[_0xa3a0('0x6')];_0x40b3b3<_0x204208;_0x40b3b3++){var _0x27c176=events[_0x40b3b3];var _0x218170=createListener('whatsappAccount:'+_0x27c176,_0x2d56c4);WhatsappAccountEvents['on'](_0x27c176,_0x218170);}}; \ No newline at end of file +var _0xe745=['removeListener','register','length','save','update','emit'];(function(_0x53ff05,_0x710e8){var _0x45159e=function(_0x14c180){while(--_0x14c180){_0x53ff05['push'](_0x53ff05['shift']());}};_0x45159e(++_0x710e8);}(_0xe745,0xf9));var _0x5e74=function(_0x4f9c9b,_0x647ec6){_0x4f9c9b=_0x4f9c9b-0x0;var _0x9ddc3e=_0xe745[_0x4f9c9b];return _0x9ddc3e;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x5e74('0x0'),'remove',_0x5e74('0x1')];function createListener(_0x17f78f,_0x140948){return function(_0x2e6364){_0x140948[_0x5e74('0x2')](_0x17f78f,_0x2e6364);};}function removeListener(_0x124890,_0x50771f){return function(){WhatsappAccountEvents[_0x5e74('0x3')](_0x124890,_0x50771f);};}exports[_0x5e74('0x4')]=function(_0x442a5f){for(var _0x14c398=0x0,_0x251de1=events[_0x5e74('0x5')];_0x14c398<_0x251de1;_0x14c398++){var _0x21ce91=events[_0x14c398];var _0x4beb47=createListener('whatsappAccount:'+_0x21ce91,_0x442a5f);WhatsappAccountEvents['on'](_0x21ce91,_0x4beb47);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index a846173..73fdf30 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 _0x4e7d=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x497d8c,_0x2904c9){var _0xeafed7=function(_0x3b51e8){while(--_0x3b51e8){_0x497d8c['push'](_0x497d8c['shift']());}};_0xeafed7(++_0x2904c9);}(_0x4e7d,0x187));var _0xd4e7=function(_0x2a9407,_0x5d18e9){_0x2a9407=_0x2a9407-0x0;var _0x51f349=_0x4e7d[_0x2a9407];return _0x51f349;};'use strict';var multer=require(_0xd4e7('0x0'));var util=require(_0xd4e7('0x1'));var path=require(_0xd4e7('0x2'));var timeout=require(_0xd4e7('0x3'));var express=require(_0xd4e7('0x4'));var router=express[_0xd4e7('0x5')]();var fs_extra=require(_0xd4e7('0x6'));var auth=require(_0xd4e7('0x7'));var interaction=require(_0xd4e7('0x8'));var config=require(_0xd4e7('0x9'));var controller=require(_0xd4e7('0xa'));router[_0xd4e7('0xb')]('/',auth[_0xd4e7('0xc')](),controller[_0xd4e7('0xd')]);router[_0xd4e7('0xb')](_0xd4e7('0xe'),auth[_0xd4e7('0xc')](),controller[_0xd4e7('0xf')]);router['post']('/',auth[_0xd4e7('0xc')](),controller[_0xd4e7('0x10')]);router['put'](_0xd4e7('0xe'),auth[_0xd4e7('0xc')](),controller[_0xd4e7('0x11')]);router[_0xd4e7('0x12')](_0xd4e7('0xe'),auth[_0xd4e7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb3cd=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','post','destroy'];(function(_0x243b9c,_0x5a499f){var _0x523a25=function(_0x2172ea){while(--_0x2172ea){_0x243b9c['push'](_0x243b9c['shift']());}};_0x523a25(++_0x5a499f);}(_0xb3cd,0x196));var _0xdb3c=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xb3cd[_0x55fa03];return _0x2cd7cd;};'use strict';var multer=require('multer');var util=require(_0xdb3c('0x0'));var path=require('path');var timeout=require(_0xdb3c('0x1'));var express=require('express');var router=express[_0xdb3c('0x2')]();var fs_extra=require(_0xdb3c('0x3'));var auth=require(_0xdb3c('0x4'));var interaction=require(_0xdb3c('0x5'));var config=require(_0xdb3c('0x6'));var controller=require(_0xdb3c('0x7'));router[_0xdb3c('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb3c('0x9')]);router[_0xdb3c('0x8')](_0xdb3c('0xa'),auth[_0xdb3c('0xb')](),controller['show']);router[_0xdb3c('0xc')]('/',auth[_0xdb3c('0xb')](),controller['create']);router['put'](_0xdb3c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdb3c('0xa'),auth['isAuthenticated'](),controller[_0xdb3c('0xd')]);module[_0xdb3c('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2433440..63f2f26 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 _0x0ca4=['sequelize','INTEGER','STRING','*,*,*,*'];(function(_0x96eef2,_0x4bf5a1){var _0x316ecd=function(_0x5ff233){while(--_0x5ff233){_0x96eef2['push'](_0x96eef2['shift']());}};_0x316ecd(++_0x4bf5a1);}(_0x0ca4,0xe8));var _0x40ca=function(_0x33899b,_0x4eed99){_0x33899b=_0x33899b-0x0;var _0x344612=_0x0ca4[_0x33899b];return _0x344612;};'use strict';var Sequelize=require(_0x40ca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x40ca('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x40ca('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x40ca('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x40ca('0x3')}}; \ No newline at end of file +var _0x5c94=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0xf63384,_0x5c8d61){var _0x44a17a=function(_0x260205){while(--_0x260205){_0xf63384['push'](_0xf63384['shift']());}};_0x44a17a(++_0x5c8d61);}(_0x5c94,0x149));var _0x45c9=function(_0x28c732,_0x436f0a){_0x28c732=_0x28c732-0x0;var _0x55ab7e=_0x5c94[_0x28c732];return _0x55ab7e;};'use strict';var Sequelize=require(_0x45c9('0x0'));module[_0x45c9('0x1')]={'priority':{'type':Sequelize[_0x45c9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x45c9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x45c9('0x4')]()},'description':{'type':Sequelize[_0x45c9('0x3')]},'interval':{'type':Sequelize[_0x45c9('0x3')],'defaultValue':_0x45c9('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 794820b..b557f77 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 _0xe35d=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3e5a76,_0x1e2316){var _0x2b9bc6=function(_0x1218e3){while(--_0x1218e3){_0x3e5a76['push'](_0x3e5a76['shift']());}};_0x2b9bc6(++_0x1e2316);}(_0xe35d,0xd5));var _0xde35=function(_0x2c6074,_0x29a401){_0x2c6074=_0x2c6074-0x0;var _0x8cdb5f=_0xe35d[_0x2c6074];return _0x8cdb5f;};'use strict';var emlformat=require(_0xde35('0x0'));var rimraf=require(_0xde35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde35('0x2'));var moment=require(_0xde35('0x3'));var BPromise=require(_0xde35('0x4'));var Mustache=require(_0xde35('0x5'));var util=require(_0xde35('0x6'));var path=require(_0xde35('0x7'));var sox=require(_0xde35('0x8'));var csv=require(_0xde35('0x9'));var ejs=require(_0xde35('0xa'));var fs=require('fs');var fs_extra=require(_0xde35('0xb'));var _=require('lodash');var squel=require(_0xde35('0xc'));var crypto=require(_0xde35('0xd'));var jsforce=require(_0xde35('0xe'));var deskjs=require(_0xde35('0xf'));var toCsv=require(_0xde35('0x9'));var querystring=require('querystring');var Papa=require(_0xde35('0x10'));var Redis=require(_0xde35('0x11'));var authService=require(_0xde35('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde35('0x13'));var hardwareService=require(_0xde35('0x14'));var logger=require('../../config/logger')(_0xde35('0x15'));var utils=require('../../config/utils');var config=require(_0xde35('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde35('0x17'))['db'];function respondWithStatusCode(_0x50b021,_0x51370b){_0x51370b=_0x51370b||0xcc;return function(_0x530552){if(_0x530552){return _0x50b021['sendStatus'](_0x51370b);}return _0x50b021['status'](_0x51370b)[_0xde35('0x18')]();};}function respondWithResult(_0x292a13,_0x4f58b1){_0x4f58b1=_0x4f58b1||0xc8;return function(_0x560d70){if(_0x560d70){return _0x292a13[_0xde35('0x19')](_0x4f58b1)[_0xde35('0x1a')](_0x560d70);}};}function respondWithFilteredResult(_0x1f318f,_0x2771fd){return function(_0x121717){if(_0x121717){var _0x5d8c6e=typeof _0x2771fd[_0xde35('0x1b')]===_0xde35('0x1c')&&typeof _0x2771fd[_0xde35('0x1d')]===_0xde35('0x1c');var _0x1f7d7f=_0x121717[_0xde35('0x1e')];var _0x19ec9e=_0x5d8c6e?0x0:_0x2771fd['offset'];var _0x3c912a=_0x5d8c6e?_0x121717['count']:_0x2771fd['offset']+_0x2771fd['limit'];var _0x408829;if(_0x3c912a>=_0x1f7d7f){_0x3c912a=_0x1f7d7f;_0x408829=0xc8;}else{_0x408829=0xce;}_0x1f318f['status'](_0x408829);return _0x1f318f[_0xde35('0x1f')](_0xde35('0x20'),_0x19ec9e+'-'+_0x3c912a+'/'+_0x1f7d7f)[_0xde35('0x1a')](_0x121717);}return null;};}function patchUpdates(_0x3d66d6){return function(_0x104a3b){try{jsonpatch[_0xde35('0x21')](_0x104a3b,_0x3d66d6,!![]);}catch(_0x441657){return BPromise[_0xde35('0x22')](_0x441657);}return _0x104a3b[_0xde35('0x23')]();};}function saveUpdates(_0x5cd6b2,_0x48c253){return function(_0x560c11){if(_0x560c11){return _0x560c11['update'](_0x5cd6b2)[_0xde35('0x24')](function(_0x394129){return _0x394129;});}return null;};}function removeEntity(_0x519035,_0x13ff99){return function(_0x126248){if(_0x126248){return _0x126248[_0xde35('0x25')]()['then'](function(){_0x519035[_0xde35('0x19')](0xcc)[_0xde35('0x18')]();});}};}function handleEntityNotFound(_0x740ab8,_0x3af90d){return function(_0x256277){if(!_0x256277){_0x740ab8[_0xde35('0x26')](0x194);}return _0x256277;};}function handleError(_0x2e4e79,_0x4a29a2){_0x4a29a2=_0x4a29a2||0x1f4;return function(_0x31a61d){logger['error'](_0x31a61d[_0xde35('0x27')]);if(_0x31a61d[_0xde35('0x28')]){delete _0x31a61d[_0xde35('0x28')];}_0x2e4e79[_0xde35('0x19')](_0x4a29a2)['send'](_0x31a61d);};}exports[_0xde35('0x29')]=function(_0x2fcc94,_0x10533a){var _0x17da4e={},_0x459d29={},_0x45ca01={'count':0x0,'rows':[]};var _0x2b50e4=_['map'](db[_0xde35('0x2a')][_0xde35('0x2b')],function(_0x459a50){return{'name':_0x459a50[_0xde35('0x2c')],'type':_0x459a50[_0xde35('0x2d')][_0xde35('0x2e')]};});_0x459d29[_0xde35('0x2f')]=_[_0xde35('0x30')](_0x2b50e4,'name');_0x459d29[_0xde35('0x31')]=_[_0xde35('0x32')](_0x2fcc94[_0xde35('0x31')]);_0x459d29[_0xde35('0x33')]=_['intersection'](_0x459d29['model'],_0x459d29[_0xde35('0x31')]);_0x17da4e[_0xde35('0x34')]=_[_0xde35('0x35')](_0x459d29['model'],qs[_0xde35('0x36')](_0x2fcc94[_0xde35('0x31')][_0xde35('0x36')]));_0x17da4e[_0xde35('0x34')]=_0x17da4e[_0xde35('0x34')]['length']?_0x17da4e[_0xde35('0x34')]:_0x459d29[_0xde35('0x2f')];if(!_0x2fcc94['query'][_0xde35('0x37')](_0xde35('0x38'))){_0x17da4e[_0xde35('0x1d')]=qs[_0xde35('0x1d')](_0x2fcc94[_0xde35('0x31')][_0xde35('0x1d')]);_0x17da4e['offset']=qs['offset'](_0x2fcc94[_0xde35('0x31')][_0xde35('0x1b')]);}_0x17da4e[_0xde35('0x39')]=qs['sort'](_0x2fcc94[_0xde35('0x31')][_0xde35('0x3a')]);_0x17da4e['where']=qs[_0xde35('0x33')](_[_0xde35('0x3b')](_0x2fcc94[_0xde35('0x31')],_0x459d29['filters']),_0x2b50e4);if(_0x2fcc94[_0xde35('0x31')][_0xde35('0x3c')]){_0x17da4e[_0xde35('0x3d')]=_[_0xde35('0x3e')](_0x17da4e[_0xde35('0x3d')],{'$or':_[_0xde35('0x30')](_0x2b50e4,function(_0x2a683a){if(_0x2a683a['type']!==_0xde35('0x3f')){var _0x472a23={};_0x472a23[_0x2a683a[_0xde35('0x28')]]={'$like':'%'+_0x2fcc94[_0xde35('0x31')]['filter']+'%'};return _0x472a23;}})});}_0x17da4e=_[_0xde35('0x3e')]({},_0x17da4e,_0x2fcc94[_0xde35('0x40')]);var _0x1e5051={'where':_0x17da4e[_0xde35('0x3d')]};return db['WhatsappApplication'][_0xde35('0x1e')](_0x1e5051)[_0xde35('0x24')](function(_0x45a82a){_0x45ca01[_0xde35('0x1e')]=_0x45a82a;if(_0x2fcc94[_0xde35('0x31')]['includeAll']){_0x17da4e[_0xde35('0x41')]=[{'all':!![]}];}return db[_0xde35('0x2a')][_0xde35('0x42')](_0x17da4e);})[_0xde35('0x24')](function(_0x32e61d){_0x45ca01['rows']=_0x32e61d;return _0x45ca01;})['then'](respondWithFilteredResult(_0x10533a,_0x17da4e))['catch'](handleError(_0x10533a,null));};exports[_0xde35('0x43')]=function(_0x4792d0,_0x13c077){var _0x298eaf={'raw':!![],'where':{'id':_0x4792d0[_0xde35('0x44')]['id']}},_0x4adfbf={};_0x4adfbf[_0xde35('0x2f')]=_[_0xde35('0x32')](db['WhatsappApplication'][_0xde35('0x2b')]);_0x4adfbf[_0xde35('0x31')]=_[_0xde35('0x32')](_0x4792d0[_0xde35('0x31')]);_0x4adfbf[_0xde35('0x33')]=_[_0xde35('0x35')](_0x4adfbf[_0xde35('0x2f')],_0x4adfbf[_0xde35('0x31')]);_0x298eaf[_0xde35('0x34')]=_[_0xde35('0x35')](_0x4adfbf[_0xde35('0x2f')],qs[_0xde35('0x36')](_0x4792d0['query'][_0xde35('0x36')]));_0x298eaf[_0xde35('0x34')]=_0x298eaf[_0xde35('0x34')][_0xde35('0x45')]?_0x298eaf[_0xde35('0x34')]:_0x4adfbf[_0xde35('0x2f')];if(_0x4792d0['query'][_0xde35('0x46')]){_0x298eaf['include']=[{'all':!![]}];}_0x298eaf=_['merge']({},_0x298eaf,_0x4792d0['options']);return db[_0xde35('0x2a')][_0xde35('0x47')](_0x298eaf)[_0xde35('0x24')](handleEntityNotFound(_0x13c077,null))[_0xde35('0x24')](respondWithResult(_0x13c077,null))[_0xde35('0x48')](handleError(_0x13c077,null));};exports[_0xde35('0x49')]=function(_0x1fd567,_0x4ade5d){return db[_0xde35('0x2a')][_0xde35('0x49')](_0x1fd567['body'],{})[_0xde35('0x24')](respondWithResult(_0x4ade5d,0xc9))[_0xde35('0x48')](handleError(_0x4ade5d,null));};exports['update']=function(_0x243f76,_0x5d178b){if(_0x243f76[_0xde35('0x4a')]['id']){delete _0x243f76[_0xde35('0x4a')]['id'];}return db[_0xde35('0x2a')][_0xde35('0x47')]({'where':{'id':_0x243f76['params']['id']}})[_0xde35('0x24')](handleEntityNotFound(_0x5d178b,null))[_0xde35('0x24')](saveUpdates(_0x243f76['body'],null))[_0xde35('0x24')](respondWithResult(_0x5d178b,null))[_0xde35('0x48')](handleError(_0x5d178b,null));};exports[_0xde35('0x25')]=function(_0x17340b,_0x453f0b){return db['WhatsappApplication']['find']({'where':{'id':_0x17340b[_0xde35('0x44')]['id']}})[_0xde35('0x24')](handleEntityNotFound(_0x453f0b,null))[_0xde35('0x24')](removeEntity(_0x453f0b,null))['catch'](handleError(_0x453f0b,null));}; \ No newline at end of file +var _0x404d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x404d,0x1e9));var _0xd404=function(_0xfd617,_0x41361f){_0xfd617=_0xfd617-0x0;var _0x1c0a28=_0x404d[_0xfd617];return _0x1c0a28;};'use strict';var emlformat=require(_0xd404('0x0'));var rimraf=require(_0xd404('0x1'));var zipdir=require(_0xd404('0x2'));var jsonpatch=require(_0xd404('0x3'));var rp=require(_0xd404('0x4'));var moment=require(_0xd404('0x5'));var BPromise=require(_0xd404('0x6'));var Mustache=require(_0xd404('0x7'));var util=require(_0xd404('0x8'));var path=require('path');var sox=require(_0xd404('0x9'));var csv=require(_0xd404('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd404('0xb'));var _=require(_0xd404('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd404('0xd'));var deskjs=require(_0xd404('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd404('0xf'));var Redis=require(_0xd404('0x10'));var authService=require(_0xd404('0x11'));var qs=require(_0xd404('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd404('0x13'))(_0xd404('0x14'));var utils=require('../../config/utils');var config=require(_0xd404('0x15'));var licenseUtil=require(_0xd404('0x16'));var db=require(_0xd404('0x17'))['db'];function respondWithStatusCode(_0x2cc1ec,_0x1d6071){_0x1d6071=_0x1d6071||0xcc;return function(_0x9f7667){if(_0x9f7667){return _0x2cc1ec[_0xd404('0x18')](_0x1d6071);}return _0x2cc1ec[_0xd404('0x19')](_0x1d6071)[_0xd404('0x1a')]();};}function respondWithResult(_0x31c8f8,_0x2516c2){_0x2516c2=_0x2516c2||0xc8;return function(_0x2ff703){if(_0x2ff703){return _0x31c8f8[_0xd404('0x19')](_0x2516c2)[_0xd404('0x1b')](_0x2ff703);}};}function respondWithFilteredResult(_0xaf965f,_0x424467){return function(_0x2051e8){if(_0x2051e8){var _0xa4d1b2=typeof _0x424467[_0xd404('0x1c')]===_0xd404('0x1d')&&typeof _0x424467[_0xd404('0x1e')]==='undefined';var _0x1ad1c4=_0x2051e8[_0xd404('0x1f')];var _0x5e19e4=_0xa4d1b2?0x0:_0x424467[_0xd404('0x1c')];var _0x149fa5=_0xa4d1b2?_0x2051e8['count']:_0x424467[_0xd404('0x1c')]+_0x424467[_0xd404('0x1e')];var _0x387d0b;if(_0x149fa5>=_0x1ad1c4){_0x149fa5=_0x1ad1c4;_0x387d0b=0xc8;}else{_0x387d0b=0xce;}_0xaf965f['status'](_0x387d0b);return _0xaf965f[_0xd404('0x20')](_0xd404('0x21'),_0x5e19e4+'-'+_0x149fa5+'/'+_0x1ad1c4)[_0xd404('0x1b')](_0x2051e8);}return null;};}function patchUpdates(_0x3e8183){return function(_0x1d89e0){try{jsonpatch[_0xd404('0x22')](_0x1d89e0,_0x3e8183,!![]);}catch(_0x458f6e){return BPromise['reject'](_0x458f6e);}return _0x1d89e0[_0xd404('0x23')]();};}function saveUpdates(_0xcc7bf1,_0x50c0e2){return function(_0x17d0e6){if(_0x17d0e6){return _0x17d0e6['update'](_0xcc7bf1)['then'](function(_0x1005d1){return _0x1005d1;});}return null;};}function removeEntity(_0x476731,_0x133232){return function(_0x32b5f8){if(_0x32b5f8){return _0x32b5f8['destroy']()[_0xd404('0x24')](function(){_0x476731[_0xd404('0x19')](0xcc)[_0xd404('0x1a')]();});}};}function handleEntityNotFound(_0x55cfde,_0x557d0e){return function(_0x3e706a){if(!_0x3e706a){_0x55cfde[_0xd404('0x18')](0x194);}return _0x3e706a;};}function handleError(_0x2d7af8,_0x36fdb6){_0x36fdb6=_0x36fdb6||0x1f4;return function(_0x1ddf0d){logger[_0xd404('0x25')](_0x1ddf0d[_0xd404('0x26')]);if(_0x1ddf0d[_0xd404('0x27')]){delete _0x1ddf0d['name'];}_0x2d7af8['status'](_0x36fdb6)[_0xd404('0x28')](_0x1ddf0d);};}exports['index']=function(_0x2b14ec,_0x4f210c){var _0x23525b={},_0x1e6341={},_0x3e746e={'count':0x0,'rows':[]};var _0x2268d2=_[_0xd404('0x29')](db[_0xd404('0x2a')][_0xd404('0x2b')],function(_0x4ece21){return{'name':_0x4ece21['fieldName'],'type':_0x4ece21[_0xd404('0x2c')]['key']};});_0x1e6341['model']=_[_0xd404('0x29')](_0x2268d2,_0xd404('0x27'));_0x1e6341[_0xd404('0x2d')]=_['keys'](_0x2b14ec[_0xd404('0x2d')]);_0x1e6341['filters']=_[_0xd404('0x2e')](_0x1e6341[_0xd404('0x2f')],_0x1e6341['query']);_0x23525b[_0xd404('0x30')]=_[_0xd404('0x2e')](_0x1e6341[_0xd404('0x2f')],qs[_0xd404('0x31')](_0x2b14ec[_0xd404('0x2d')]['fields']));_0x23525b[_0xd404('0x30')]=_0x23525b[_0xd404('0x30')][_0xd404('0x32')]?_0x23525b['attributes']:_0x1e6341[_0xd404('0x2f')];if(!_0x2b14ec[_0xd404('0x2d')][_0xd404('0x33')](_0xd404('0x34'))){_0x23525b['limit']=qs['limit'](_0x2b14ec[_0xd404('0x2d')][_0xd404('0x1e')]);_0x23525b[_0xd404('0x1c')]=qs[_0xd404('0x1c')](_0x2b14ec[_0xd404('0x2d')][_0xd404('0x1c')]);}_0x23525b['order']=qs[_0xd404('0x35')](_0x2b14ec[_0xd404('0x2d')][_0xd404('0x35')]);_0x23525b['where']=qs[_0xd404('0x36')](_[_0xd404('0x37')](_0x2b14ec[_0xd404('0x2d')],_0x1e6341['filters']),_0x2268d2);if(_0x2b14ec[_0xd404('0x2d')][_0xd404('0x38')]){_0x23525b[_0xd404('0x39')]=_['merge'](_0x23525b[_0xd404('0x39')],{'$or':_[_0xd404('0x29')](_0x2268d2,function(_0x47a108){if(_0x47a108[_0xd404('0x2c')]!==_0xd404('0x3a')){var _0x237592={};_0x237592[_0x47a108[_0xd404('0x27')]]={'$like':'%'+_0x2b14ec[_0xd404('0x2d')][_0xd404('0x38')]+'%'};return _0x237592;}})});}_0x23525b=_[_0xd404('0x3b')]({},_0x23525b,_0x2b14ec[_0xd404('0x3c')]);var _0x58f0ad={'where':_0x23525b[_0xd404('0x39')]};return db['WhatsappApplication'][_0xd404('0x1f')](_0x58f0ad)[_0xd404('0x24')](function(_0x598f08){_0x3e746e[_0xd404('0x1f')]=_0x598f08;if(_0x2b14ec['query'][_0xd404('0x3d')]){_0x23525b['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xd404('0x3e')](_0x23525b);})[_0xd404('0x24')](function(_0x397f30){_0x3e746e[_0xd404('0x3f')]=_0x397f30;return _0x3e746e;})['then'](respondWithFilteredResult(_0x4f210c,_0x23525b))['catch'](handleError(_0x4f210c,null));};exports[_0xd404('0x40')]=function(_0x234876,_0x8c56bc){var _0x108cc3={'raw':!![],'where':{'id':_0x234876[_0xd404('0x41')]['id']}},_0x199d66={};_0x199d66[_0xd404('0x2f')]=_['keys'](db[_0xd404('0x2a')]['rawAttributes']);_0x199d66[_0xd404('0x2d')]=_['keys'](_0x234876[_0xd404('0x2d')]);_0x199d66[_0xd404('0x36')]=_[_0xd404('0x2e')](_0x199d66['model'],_0x199d66[_0xd404('0x2d')]);_0x108cc3[_0xd404('0x30')]=_[_0xd404('0x2e')](_0x199d66[_0xd404('0x2f')],qs['fields'](_0x234876[_0xd404('0x2d')][_0xd404('0x31')]));_0x108cc3[_0xd404('0x30')]=_0x108cc3[_0xd404('0x30')][_0xd404('0x32')]?_0x108cc3[_0xd404('0x30')]:_0x199d66[_0xd404('0x2f')];if(_0x234876[_0xd404('0x2d')][_0xd404('0x3d')]){_0x108cc3[_0xd404('0x42')]=[{'all':!![]}];}_0x108cc3=_[_0xd404('0x3b')]({},_0x108cc3,_0x234876['options']);return db[_0xd404('0x2a')][_0xd404('0x43')](_0x108cc3)[_0xd404('0x24')](handleEntityNotFound(_0x8c56bc,null))[_0xd404('0x24')](respondWithResult(_0x8c56bc,null))[_0xd404('0x44')](handleError(_0x8c56bc,null));};exports['create']=function(_0x175982,_0x30cc1c){return db['WhatsappApplication'][_0xd404('0x45')](_0x175982[_0xd404('0x46')],{})[_0xd404('0x24')](respondWithResult(_0x30cc1c,0xc9))[_0xd404('0x44')](handleError(_0x30cc1c,null));};exports[_0xd404('0x47')]=function(_0x169dc9,_0x21ff82){if(_0x169dc9[_0xd404('0x46')]['id']){delete _0x169dc9[_0xd404('0x46')]['id'];}return db['WhatsappApplication'][_0xd404('0x43')]({'where':{'id':_0x169dc9[_0xd404('0x41')]['id']}})['then'](handleEntityNotFound(_0x21ff82,null))[_0xd404('0x24')](saveUpdates(_0x169dc9[_0xd404('0x46')],null))[_0xd404('0x24')](respondWithResult(_0x21ff82,null))['catch'](handleError(_0x21ff82,null));};exports[_0xd404('0x48')]=function(_0x584a03,_0x16737a){return db[_0xd404('0x2a')][_0xd404('0x43')]({'where':{'id':_0x584a03[_0xd404('0x41')]['id']}})[_0xd404('0x24')](handleEntityNotFound(_0x16737a,null))['then'](removeEntity(_0x16737a,null))['catch'](handleError(_0x16737a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f28d1c9..ab7bd32 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 _0x0ba7=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x226332,_0x58d9d5){var _0x5b3d8d=function(_0x1fbac8){while(--_0x1fbac8){_0x226332['push'](_0x226332['shift']());}};_0x5b3d8d(++_0x58d9d5);}(_0x0ba7,0x16d));var _0x70ba=function(_0x47c6c7,_0x178c10){_0x47c6c7=_0x47c6c7-0x0;var _0x5a4270=_0x0ba7[_0x47c6c7];return _0x5a4270;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var logger=require(_0x70ba('0x1'))(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ba('0x5'));var rimraf=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var attributes=require(_0x70ba('0x8'));module[_0x70ba('0x9')]=function(_0x3f9877,_0x17a00c){return _0x3f9877[_0x70ba('0xa')](_0x70ba('0xb'),attributes,{'tableName':_0x70ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70ba('0xd'),'collate':_0x70ba('0xe')});}; \ No newline at end of file +var _0x9b9b=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x3e0ff0,_0x433f8a){var _0x3ba409=function(_0x30d5b4){while(--_0x30d5b4){_0x3e0ff0['push'](_0x3e0ff0['shift']());}};_0x3ba409(++_0x433f8a);}(_0x9b9b,0x114));var _0xb9b9=function(_0x184e69,_0x39af04){_0x184e69=_0x184e69-0x0;var _0x57d8ad=_0x9b9b[_0x184e69];return _0x57d8ad;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9b9('0xc'),'collate':_0xb9b9('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 64b9ebe..aaaf7d3 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 _0x22fb=['WhatsappApplication,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x727544,_0x3f9525){var _0x2af4b9=function(_0x51cbfe){while(--_0x51cbfe){_0x727544['push'](_0x727544['shift']());}};_0x2af4b9(++_0x3f9525);}(_0x22fb,0x192));var _0xb22f=function(_0x149506,_0x29bd2b){_0x149506=_0x149506-0x0;var _0x14fba6=_0x22fb[_0x149506];return _0x14fba6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x167f78,_0x16de34){var _0x58ee9a=function(_0x2e9f24){while(--_0x2e9f24){_0x167f78['push'](_0x167f78['shift']());}};_0x58ee9a(++_0x16de34);}(_0x9bde,0xe1));var _0xe9bd=function(_0x8ea518,_0x38225f){_0x8ea518=_0x8ea518-0x0;var _0x5ef423=_0x9bde[_0x8ea518];return _0x5ef423;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4c6c486..cc03590 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 _0x2bd8=['delete','whatsappinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bd8,0x130));var _0x82bd=function(_0x1a9c5b,_0x455812){_0x1a9c5b=_0x1a9c5b-0x0;var _0x17c75b=_0x2bd8[_0x1a9c5b];return _0x17c75b;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x82bd('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x82bd('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router[_0x82bd('0x10')]('/',auth['isAuthenticated'](),controller[_0x82bd('0x11')]);router['post'](_0x82bd('0xe'),auth['isAuthenticated'](),controller[_0x82bd('0x12')]);router[_0x82bd('0x10')](_0x82bd('0x13'),auth[_0x82bd('0xa')](),interaction['tracked'](_0x82bd('0x14'),_0x82bd('0x15')),controller['addTags']);router[_0x82bd('0x16')]('/:id',auth[_0x82bd('0xa')](),interaction[_0x82bd('0x17')](_0x82bd('0x14'),_0x82bd('0x18')),controller[_0x82bd('0x19')]);router[_0x82bd('0x1a')](_0x82bd('0xd'),auth[_0x82bd('0xa')](),interaction[_0x82bd('0x17')](_0x82bd('0x14'),_0x82bd('0x1b')),controller[_0x82bd('0x1c')]);router[_0x82bd('0x1a')](_0x82bd('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x82bd('0x1d')]=router; \ No newline at end of file +var _0x8375=['post','create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x56e953,_0x42b5a1){var _0x1504d4=function(_0x1ffa33){while(--_0x1ffa33){_0x56e953['push'](_0x56e953['shift']());}};_0x1504d4(++_0x42b5a1);}(_0x8375,0xa8));var _0x5837=function(_0x5cc649,_0x29dd20){_0x5cc649=_0x5cc649-0x0;var _0x2cad3d=_0x8375[_0x5cc649];return _0x2cad3d;};'use strict';var multer=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var path=require(_0x5837('0x2'));var timeout=require('connect-timeout');var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var fs_extra=require(_0x5837('0x5'));var auth=require(_0x5837('0x6'));var interaction=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x5837('0x9')]('/',auth[_0x5837('0xa')](),controller[_0x5837('0xb')]);router[_0x5837('0x9')](_0x5837('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5837('0x9')](_0x5837('0xd'),auth['isAuthenticated'](),controller[_0x5837('0xe')]);router['get'](_0x5837('0xf'),auth[_0x5837('0xa')](),controller[_0x5837('0x10')]);router[_0x5837('0x9')](_0x5837('0x11'),auth[_0x5837('0xa')](),controller['download']);router[_0x5837('0x12')]('/',auth[_0x5837('0xa')](),controller[_0x5837('0x13')]);router[_0x5837('0x12')](_0x5837('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x5837('0x14'),auth[_0x5837('0xa')](),interaction[_0x5837('0x15')](_0x5837('0x16'),_0x5837('0x17')),controller[_0x5837('0x18')]);router[_0x5837('0x19')](_0x5837('0xd'),auth[_0x5837('0xa')](),interaction['tracked'](_0x5837('0x16'),_0x5837('0x1a')),controller['update']);router[_0x5837('0x1b')](_0x5837('0xd'),auth[_0x5837('0xa')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller[_0x5837('0x1c')]);router[_0x5837('0x1b')](_0x5837('0x14'),auth['isAuthenticated'](),controller[_0x5837('0x1d')]);module[_0x5837('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 d58669f..e90c3c1 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 _0x33ac=['moment','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x6218ce,_0x2c07a0){var _0x1fe609=function(_0x4224e4){while(--_0x4224e4){_0x6218ce['push'](_0x6218ce['shift']());}};_0x1fe609(++_0x2c07a0);}(_0x33ac,0x1f2));var _0xc33a=function(_0x2ee106,_0x27df18){_0x2ee106=_0x2ee106-0x0;var _0x4d9c60=_0x33ac[_0x2ee106];return _0x4d9c60;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc33a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc33a('0x1')]},'disposition':{'type':Sequelize[_0xc33a('0x2')]},'secondDisposition':{'type':Sequelize[_0xc33a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc33a('0x2')]},'note':{'type':Sequelize[_0xc33a('0x2')]},'phone':{'type':Sequelize[_0xc33a('0x2')]},'read1stAt':{'type':Sequelize[_0xc33a('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xc33a('0x3')]('in',_0xc33a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc33a('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc33a('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xe314=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x37993c,_0x3eb705){var _0xbf84c9=function(_0x38104d){while(--_0x38104d){_0x37993c['push'](_0x37993c['shift']());}};_0xbf84c9(++_0x3eb705);}(_0xe314,0x7c));var _0x4e31=function(_0x5834ff,_0x53f287){_0x5834ff=_0x5834ff-0x0;var _0x2ac1fd=_0xe314[_0x5834ff];return _0x2ac1fd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4e31('0x0'));module[_0x4e31('0x1')]={'closed':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4e31('0x3')]},'disposition':{'type':Sequelize[_0x4e31('0x4')]},'secondDisposition':{'type':Sequelize[_0x4e31('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4e31('0x4')]},'note':{'type':Sequelize[_0x4e31('0x4')]},'phone':{'type':Sequelize[_0x4e31('0x4')]},'read1stAt':{'type':Sequelize[_0x4e31('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4e31('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4e31('0x5')]('in',_0x4e31('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4e31('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 4477e1a..93a86b7 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 _0x6edc=['toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','push','rows','params','WhatsappInteraction','rawAttributes','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','spread','findAll','emit','removeTags','download','unix','root','server','files','join','attachments','CmContact','Contact','firstName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','Whatsapp','Owner','N.A.','format','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','lastName','renderFile','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','catch','waiting','talking','answered','unmanaged','total','closed','UserId','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','field','color','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','whatsapp_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','WhatsappAccountId','where','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize'];(function(_0x278903,_0x23c447){var _0x4bfc71=function(_0x5be785){while(--_0x5be785){_0x278903['push'](_0x278903['shift']());}};_0x4bfc71(++_0x23c447);}(_0x6edc,0x138));var _0xc6ed=function(_0xec1d0c,_0x14aef7){_0xec1d0c=_0xec1d0c-0x0;var _0x552358=_0x6edc[_0xec1d0c];return _0x552358;};'use strict';var emlformat=require(_0xc6ed('0x0'));var rimraf=require(_0xc6ed('0x1'));var zipdir=require(_0xc6ed('0x2'));var jsonpatch=require(_0xc6ed('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6ed('0x4'));var Mustache=require(_0xc6ed('0x5'));var util=require(_0xc6ed('0x6'));var path=require(_0xc6ed('0x7'));var sox=require('sox');var csv=require(_0xc6ed('0x8'));var ejs=require(_0xc6ed('0x9'));var fs=require('fs');var fs_extra=require(_0xc6ed('0xa'));var _=require('lodash');var squel=require(_0xc6ed('0xb'));var crypto=require('crypto');var jsforce=require(_0xc6ed('0xc'));var deskjs=require(_0xc6ed('0xd'));var toCsv=require(_0xc6ed('0x8'));var querystring=require(_0xc6ed('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6ed('0xf'));var authService=require(_0xc6ed('0x10'));var qs=require(_0xc6ed('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xc6ed('0x12'));var logger=require(_0xc6ed('0x13'))(_0xc6ed('0x14'));var utils=require(_0xc6ed('0x15'));var config=require(_0xc6ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6ed('0x17'))['db'];config['redis']=_[_0xc6ed('0x18')](config['redis'],{'host':_0xc6ed('0x19'),'port':0x18eb});var socket=require(_0xc6ed('0x1a'))(new Redis(config[_0xc6ed('0x1b')]));require('./whatsappInteraction.socket')[_0xc6ed('0x1c')](socket);function respondWithStatusCode(_0x282ea6,_0xb14647){_0xb14647=_0xb14647||0xcc;return function(_0x5da6a5){if(_0x5da6a5){return _0x282ea6[_0xc6ed('0x1d')](_0xb14647);}return _0x282ea6['status'](_0xb14647)[_0xc6ed('0x1e')]();};}function respondWithResult(_0x35e1d8,_0x16ee41){_0x16ee41=_0x16ee41||0xc8;return function(_0x5346fe){if(_0x5346fe){return _0x35e1d8[_0xc6ed('0x1f')](_0x16ee41)[_0xc6ed('0x20')](_0x5346fe);}};}function respondWithFilteredResult(_0x297fc2,_0x1fd66b){return function(_0x503d90){if(_0x503d90){var _0x5d4c5a=typeof _0x1fd66b[_0xc6ed('0x21')]===_0xc6ed('0x22')&&typeof _0x1fd66b[_0xc6ed('0x23')]===_0xc6ed('0x22');var _0x41c5e8=_0x503d90[_0xc6ed('0x24')];var _0x28a334=_0x5d4c5a?0x0:_0x1fd66b[_0xc6ed('0x21')];var _0xad393b=_0x5d4c5a?_0x503d90[_0xc6ed('0x24')]:_0x1fd66b[_0xc6ed('0x21')]+_0x1fd66b[_0xc6ed('0x23')];var _0x2664a9;if(_0xad393b>=_0x41c5e8){_0xad393b=_0x41c5e8;_0x2664a9=0xc8;}else{_0x2664a9=0xce;}_0x297fc2[_0xc6ed('0x1f')](_0x2664a9);return _0x297fc2['set']('Content-Range',_0x28a334+'-'+_0xad393b+'/'+_0x41c5e8)[_0xc6ed('0x20')](_0x503d90);}return null;};}function patchUpdates(_0x5c5620){return function(_0x565705){try{jsonpatch[_0xc6ed('0x25')](_0x565705,_0x5c5620,!![]);}catch(_0x487461){return BPromise[_0xc6ed('0x26')](_0x487461);}return _0x565705[_0xc6ed('0x27')]();};}function saveUpdates(_0x4682c5,_0x5b0d06){return function(_0x4b63bc){if(_0x4b63bc){return _0x4b63bc['update'](_0x4682c5)[_0xc6ed('0x28')](function(_0x100f7f){return _0x100f7f;});}return null;};}function removeEntity(_0x34f312,_0x33a3c2){return function(_0x1c78bf){if(_0x1c78bf){return _0x1c78bf[_0xc6ed('0x29')]()[_0xc6ed('0x28')](function(){_0x34f312[_0xc6ed('0x1f')](0xcc)[_0xc6ed('0x1e')]();});}};}function handleEntityNotFound(_0x3c97e0,_0xa7e8e3){return function(_0x1abee){if(!_0x1abee){_0x3c97e0['sendStatus'](0x194);}return _0x1abee;};}function handleError(_0x499163,_0x2eec31){_0x2eec31=_0x2eec31||0x1f4;return function(_0x14be47){logger[_0xc6ed('0x2a')](_0x14be47[_0xc6ed('0x2b')]);if(_0x14be47['name']){delete _0x14be47[_0xc6ed('0x2c')];}_0x499163[_0xc6ed('0x1f')](_0x2eec31)[_0xc6ed('0x2d')](_0x14be47);};}function getInteractionUsers(_0x19e628,_0x187cce){return new BPromise(function(_0x4bf19f,_0x35ee5d){try{if(_0x187cce[_0x19e628['id']]){_0x19e628[_0xc6ed('0x2e')]=_[_0xc6ed('0x2f')](_0x187cce[_0x19e628['id']],function(_0x93237d){return{'id':_0x93237d['id'],'fullname':_0x93237d[_0xc6ed('0x30')]};});}}catch(_0xa91fc){_0x35ee5d(_0xa91fc);}_0x4bf19f(_0x19e628);});}function getInteractionTags(_0x3ce947,_0x9ef3f8){return new BPromise(function(_0x6c0ad0,_0x13b110){try{if(_0x3ce947[_0xc6ed('0x31')]){_0x3ce947['Tags']=[];_0x3ce947[_0xc6ed('0x31')][_0xc6ed('0x32')](',')[_0xc6ed('0x33')](function(_0x1028c6){_0x3ce947[_0xc6ed('0x34')]['push'](_0x9ef3f8[_0x1028c6]);});}delete _0x3ce947[_0xc6ed('0x31')];}catch(_0x4f519e){_0x13b110(_0x4f519e);}_0x6c0ad0(_0x3ce947);});}function updateWhatsappInteraction(_0x2d26ea,_0x634747,_0x50b082){return new BPromise(function(_0x5f45d2,_0x1ff7ef){return getInteractionUsers(_0x2d26ea,_0x50b082)[_0xc6ed('0x28')](function(_0x5556b8){return getInteractionTags(_0x5556b8,_0x634747);})[_0xc6ed('0x28')](function(_0x4071f9){return getStateInteraction(_0x4071f9);})['then'](function(_0x52f286){_0x5f45d2(_0x52f286);})[_0xc6ed('0x35')](function(_0xddb409){_0x1ff7ef(_0xddb409);});});}function getStateInteraction(_0x4bdcde){return new BPromise(function(_0x2a8cfb){_0x4bdcde[_0xc6ed('0x36')]=0x0;_0x4bdcde[_0xc6ed('0x37')]=0x0;_0x4bdcde[_0xc6ed('0x38')]=0x0;_0x4bdcde[_0xc6ed('0x39')]=0x0;_0x4bdcde[_0xc6ed('0x3a')]=0x0;if(!_0x4bdcde[_0xc6ed('0x3b')]&&!_0x4bdcde[_0xc6ed('0x3c')]){_0x4bdcde['waiting']+=0x1;}if(!_0x4bdcde[_0xc6ed('0x3b')]&&_0x4bdcde['UserId']){_0x4bdcde[_0xc6ed('0x37')]+=0x1;if(_0x4bdcde[_0xc6ed('0x36')]){_0x4bdcde['waiting']-=0x1;}}if(_0x4bdcde[_0xc6ed('0x3b')]&&_0x4bdcde[_0xc6ed('0x3c')]){_0x4bdcde[_0xc6ed('0x38')]+=0x1;if(_0x4bdcde[_0xc6ed('0x37')]){_0x4bdcde[_0xc6ed('0x37')]-=0x1;}}if(_0x4bdcde[_0xc6ed('0x3b')]&&!_0x4bdcde['UserId']){_0x4bdcde[_0xc6ed('0x39')]+=0x1;if(_0x4bdcde['waiting']){_0x4bdcde[_0xc6ed('0x36')]-=0x1;}}_0x4bdcde[_0xc6ed('0x3a')]+=0x1;_0x2a8cfb(_0x4bdcde);});}exports['index']=function(_0x5916b3,_0x395b9f){var _0x834950={},_0xf1dc6b={},_0x464477={'count':0x0,'rows':[]};var _0x3ef554=_[_0xc6ed('0x2f')](db['WhatsappInteraction']['rawAttributes'],function(_0x471582){return{'name':_0x471582[_0xc6ed('0x3d')],'type':_0x471582[_0xc6ed('0x3e')][_0xc6ed('0x3f')]};});_0xf1dc6b[_0xc6ed('0x40')]=_[_0xc6ed('0x2f')](_0x3ef554,_0xc6ed('0x2c'));_0xf1dc6b[_0xc6ed('0x41')]=_[_0xc6ed('0x42')](_0x5916b3[_0xc6ed('0x41')]);_0xf1dc6b['filters']=_[_0xc6ed('0x43')](_0xf1dc6b[_0xc6ed('0x40')],_0xf1dc6b['query']);_0x834950[_0xc6ed('0x44')]=_['intersection'](_0xf1dc6b[_0xc6ed('0x40')],qs[_0xc6ed('0x45')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x45')]));_0x834950['attributes']=_0x834950[_0xc6ed('0x44')][_0xc6ed('0x46')]?_0x834950['attributes']:_0xf1dc6b[_0xc6ed('0x40')];if(!_0x5916b3[_0xc6ed('0x41')]['hasOwnProperty'](_0xc6ed('0x47'))){_0x834950[_0xc6ed('0x23')]=qs[_0xc6ed('0x23')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x23')]);_0x834950[_0xc6ed('0x21')]=qs[_0xc6ed('0x21')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x21')]);}_0x834950['order']=qs[_0xc6ed('0x48')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x48')]);_0x834950['where']=qs[_0xc6ed('0x49')](_[_0xc6ed('0x4a')](_0x5916b3[_0xc6ed('0x41')],_0xf1dc6b[_0xc6ed('0x49')]),_0x3ef554);var _0xd6cb25=[];var _0x448577=squel['select']()[_0xc6ed('0x4b')]('id')[_0xc6ed('0x4b')]('name')['field'](_0xc6ed('0x4c'))['from'](_0xc6ed('0x4d'));var _0x1fbd41=squel[_0xc6ed('0x4e')]()[_0xc6ed('0x4b')](_0xc6ed('0x4f'))[_0xc6ed('0x4b')](_0xc6ed('0x50'))[_0xc6ed('0x4b')](_0xc6ed('0x51'))[_0xc6ed('0x52')](_0xc6ed('0x53'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0xbf6e85=squel['select']()['from'](_0xc6ed('0x54'),'i')[_0xc6ed('0x55')](_0xc6ed('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc6ed('0x55')](_0xc6ed('0x57'),'o',_0xc6ed('0x58'))[_0xc6ed('0x55')](_0xc6ed('0x59'),'a',_0xc6ed('0x5a'))[_0xc6ed('0x55')]('whatsapp_messages','me',_0xc6ed('0x5b'))[_0xc6ed('0x55')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xc6ed('0x55')]('tools_tags','t',_0xc6ed('0x5c'));var _0x1fa5e1=squel[_0xc6ed('0x5d')]();var _0x2c6849=[];var _0x4710ac=squel[_0xc6ed('0x5d')]();var _0x4edb81;if(_0x5916b3[_0xc6ed('0x41')]['search']){_0x4edb81=as[_0xc6ed('0x5e')](_0x5916b3['query'][_0xc6ed('0x5f')]);var _0xe79e7a=_0x4edb81[_0xc6ed('0x60')];for(var _0x961d43=0x0;_0x961d43<_0x4edb81[_0xc6ed('0x61')][_0xc6ed('0x46')];_0x961d43++){var _0x5414ff=_0x4edb81[_0xc6ed('0x61')][_0x961d43];var _0x47bf76='i';var _0x351b05=_[_0xc6ed('0x62')](_0x3ef554,[_0xc6ed('0x2c'),_0x5414ff[_0xc6ed('0x4b')]]);if(!_0x351b05){switch(_0x5414ff[_0xc6ed('0x4b')]){case'unreadMessages':if(_0x5414ff[_0xc6ed('0x63')]==0x1){_0xbf6e85[_0xc6ed('0x64')]('`'+_0x5414ff[_0xc6ed('0x4b')]+_0xc6ed('0x65'));}else{_0xbf6e85[_0xc6ed('0x64')]('`'+_0x5414ff[_0xc6ed('0x4b')]+'`\x20>\x200');}break;case'Contact':if(_0x5414ff[_0xc6ed('0x66')]===_0xc6ed('0x67')){if(_0x5414ff['value']['split']('\x20')[_0xc6ed('0x46')]>0x1){_0x1fa5e1[_0xe79e7a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc6ed('0x68')](_0x5414ff[_0xc6ed('0x63')]),null);}else{var _0x1a7445='%'+_0x5414ff[_0xc6ed('0x63')]+'%';_0x1fa5e1[_0xe79e7a](_0xc6ed('0x69'),_0x1a7445,_0x1a7445,_0x1a7445);}}else{_0x351b05=_[_0xc6ed('0x62')](_0x3ef554,[_0xc6ed('0x2c'),_0xc6ed('0x6a')]);_0x5414ff['field']=_0xc6ed('0x6a');_0x5adb65=as[_0xc6ed('0x6b')](_0x47bf76,_0x351b05[_0xc6ed('0x3e')],_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')]['start'],_0x5adb65['value'][_0xc6ed('0x1e')]);}break;case _0xc6ed('0x6d'):var _0x25c421=_0x5414ff[_0xc6ed('0x63')][_0xc6ed('0x32')](',')[_0xc6ed('0x2f')](function(_0x1b05e8){return Number(_0x1b05e8);});_0x25c421[_0xc6ed('0x33')](function(_0x33e19d){_0x4710ac['or'](_0xc6ed('0x6e'),'%,'+_0x33e19d+',%');});_0x2c6849=_[_0xc6ed('0x6f')](_0x2c6849,_0x25c421);break;case _0xc6ed('0x70'):if(_0x5414ff[_0xc6ed('0x66')]===_0xc6ed('0x67')){_0x1fa5e1[_0xe79e7a](_0xc6ed('0x71'),'%'+_0x5414ff[_0xc6ed('0x63')]+'%',null);}else{_0x351b05=_[_0xc6ed('0x62')](_0x3ef554,[_0xc6ed('0x2c'),_0xc6ed('0x3c')]);_0x5414ff[_0xc6ed('0x4b')]='UserId';_0x5adb65=as['buildExpression'](_0x47bf76,_0x351b05[_0xc6ed('0x3e')],_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')][_0xc6ed('0x72')],_0x5adb65['value'][_0xc6ed('0x1e')]);}break;case _0xc6ed('0x73'):_0x5adb65=as[_0xc6ed('0x6b')]('me',null,_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')][_0xc6ed('0x72')],_0x5adb65[_0xc6ed('0x63')][_0xc6ed('0x1e')]);break;}}else{var _0x5adb65=as[_0xc6ed('0x6b')](_0x47bf76,_0x351b05['type'],_0x5414ff);_0x1fa5e1[_0xe79e7a](_0x5adb65[_0xc6ed('0x6c')],_0x5adb65[_0xc6ed('0x63')]['start'],_0x5adb65['value']['end']);}}}else{var _0x5f2608=_(_0x5916b3[_0xc6ed('0x41')])[_0xc6ed('0x42')]()['map'](function(_0x58e562){return _[_0xc6ed('0x74')](_0x3ef554,[_0xc6ed('0x2c'),_0x58e562])?_0x58e562:undefined;})[_0xc6ed('0x75')]()[_0xc6ed('0x63')]();if(!_[_0xc6ed('0x76')](_0x5f2608)){_0x5f2608[_0xc6ed('0x33')](function(_0x33859c){if(_0x33859c===_0xc6ed('0x77')){_0xbf6e85[_0xc6ed('0x78')]('i.WhatsappAccountId\x20IN\x20?',[][_0xc6ed('0x79')](_0x5916b3[_0xc6ed('0x41')][_0x33859c]));}else if(_0x33859c===_0xc6ed('0x7a')){var _0x416969=JSON[_0xc6ed('0x7b')](_0x5916b3[_0xc6ed('0x41')][_0x33859c])[_0xc6ed('0x7c')];var _0x3b3572=JSON[_0xc6ed('0x7b')](_0x5916b3[_0xc6ed('0x41')][_0x33859c])['$lte'];_0xbf6e85[_0xc6ed('0x78')](_0xc6ed('0x7d'),_0x416969,_0x3b3572);}else{if(_0x5916b3[_0xc6ed('0x41')][_0x33859c]==='null'){_0xbf6e85[_0xc6ed('0x78')]('i.'+_0x33859c+'\x20IS\x20NULL');}else{_0xbf6e85[_0xc6ed('0x78')]('i.'+_0x33859c+'\x20=\x20?',_0x5916b3[_0xc6ed('0x41')][_0x33859c]);}}});}if(_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x7e')]){if(_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x7e')]==0x1){_0xbf6e85['having'](_0xc6ed('0x7f'));}else{_0xbf6e85['having']('`unreadMessages`\x20>\x200');}}if(_0x5916b3['query'][_0xc6ed('0x80')]){_0x2c6849=_[_0xc6ed('0x81')](_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x80')])?_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x80')]:new Array(_0x5916b3[_0xc6ed('0x41')]['tag']);_0x2c6849['forEach'](function(_0x126fe3){_0x4710ac['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x126fe3+',%');});}if(_0x5916b3[_0xc6ed('0x41')][_0xc6ed('0x82')]){var _0x19813f=_0x5916b3['query'][_0xc6ed('0x82')][_0xc6ed('0x83')]('\x5c','\x5c\x5c')[_0xc6ed('0x83')](/'/g,'\x27\x27');if(qs[_0xc6ed('0x84')](_0x19813f)){_0x1fa5e1['or'](_0xc6ed('0x85'),_0x19813f+'%')['or'](_0xc6ed('0x86'),_0x19813f+'%');}else{_0x1fa5e1['or'](_0xc6ed('0x87'),qs[_0xc6ed('0x68')](_0x19813f))['or'](_0xc6ed('0x88'),_0x19813f+'%');}}}_0xbf6e85[_0xc6ed('0x78')](_0x1fa5e1);_0xbf6e85['group']('i.id');var _0x266b57={'type':db[_0xc6ed('0x89')][_0xc6ed('0x8a')]['SELECT'],'raw':!![]};var _0x33733e=_0xbf6e85[_0xc6ed('0x8b')]();_0x33733e[_0xc6ed('0x4b')](_0xc6ed('0x8c'));_0x33733e[_0xc6ed('0x4b')](_0xc6ed('0x8d'),'unreadMessages');if(_0x834950[_0xc6ed('0x8e')]){_0x834950['order']['forEach'](function(_0x3c430b){var _0x2b29bf=_0x3c430b[0x0]===_0xc6ed('0x8f')?_0x3c430b[0x0]:'i.'+_0x3c430b[0x0];_0xbf6e85[_0xc6ed('0x8e')](_0x2b29bf,_0x3c430b[0x1]===_0xc6ed('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x2c6849)){_0xbf6e85[_0xc6ed('0x64')](_0x4710ac);_0x33733e[_0xc6ed('0x78')](_0xc6ed('0x91'),_0x2c6849);}BPromise['resolve']()[_0xc6ed('0x28')](function(){if(!_0x4edb81){if(_0x5916b3[_0xc6ed('0x41')]['WhatsappAccountId'])return;_0x33733e[_0xc6ed('0x78')](_0xc6ed('0x92'));_0xbf6e85[_0xc6ed('0x78')](_0xc6ed('0x92'));return;}if(_0x5916b3[_0xc6ed('0x93')][_0xc6ed('0x94')]!=='agent')return;return _0x5916b3[_0xc6ed('0x93')][_0xc6ed('0x95')]({'attributes':['id'],'raw':!![]})[_0xc6ed('0x28')](function(_0x58f775){if(_['isEmpty'](_0x58f775)){_0x33733e[_0xc6ed('0x78')]('i.WhatsappAccountId\x20IS\x20NULL');_0xbf6e85[_0xc6ed('0x78')](_0xc6ed('0x96'));}else{_0x33733e['where'](_0xc6ed('0x97'),_[_0xc6ed('0x2f')](_0x58f775,'id'));_0xbf6e85['where'](_0xc6ed('0x97'),_[_0xc6ed('0x2f')](_0x58f775,'id'));}});})['then'](function(){if(_0x5916b3['user'][_0xc6ed('0x94')]===_0xc6ed('0x98')&&!_0x4edb81&&!_0x5916b3['query']['WhatsappAccountId'])return[];return db[_0xc6ed('0x99')][_0xc6ed('0x41')](_0x33733e[_0xc6ed('0x9a')](),_0x266b57);})['then'](function(_0x466dc3){_0x464477[_0xc6ed('0x24')]=_0x466dc3[_0xc6ed('0x46')];if(_0x464477['count']===0x0)return[];return db['sequelize']['query'](_0x448577[_0xc6ed('0x9a')](),_0x266b57)['then'](function(_0x103e65){_0xd6cb25=_[_0xc6ed('0x9b')](_0x103e65,'id');_0x266b57=_[_0xc6ed('0x9c')](_0x266b57,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5916b3[_0xc6ed('0x41')]['fields']){_0x834950[_0xc6ed('0x44')][_0xc6ed('0x33')](function(_0x4950db){_0xbf6e85[_0xc6ed('0x4b')]('i.'+_0x4950db);});}else{_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0x8d'),'unreadMessages');_0xbf6e85[_0xc6ed('0x4b')]('a.key','Account.key');_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0x9d'),_0xc6ed('0x9e'));_0xbf6e85['field'](_0xc6ed('0x9f'),_0xc6ed('0x8f'));_0xbf6e85['field'](_0xc6ed('0xa0'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa1'),_0xc6ed('0xa2'));_0xbf6e85['field'](_0xc6ed('0xa3'),'Contact.lastName');_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa4'),_0xc6ed('0xa5'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa6'),_0xc6ed('0xa7'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xa8'),_0xc6ed('0xa9'));_0xbf6e85[_0xc6ed('0x4b')]('c.fax',_0xc6ed('0xaa'));_0xbf6e85[_0xc6ed('0x4b')]('o.fullname','Owner.fullname');_0xbf6e85[_0xc6ed('0x4b')]('o.internal',_0xc6ed('0xab'));_0xbf6e85[_0xc6ed('0x4b')](_0xc6ed('0xac'),_0xc6ed('0x31'));}if(_0x834950['limit'])_0xbf6e85[_0xc6ed('0x23')](_0x834950['limit']);if(_0x834950[_0xc6ed('0x21')])_0xbf6e85[_0xc6ed('0x21')](_0x834950['offset']);return db[_0xc6ed('0x99')][_0xc6ed('0x41')](_0xbf6e85[_0xc6ed('0x9a')](),_0x266b57);})[_0xc6ed('0x28')](function(_0x3ed828){if(_0x3ed828[_0xc6ed('0x46')]>0x0)_0x1fbd41[_0xc6ed('0x78')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xc6ed('0x2f')](_0x3ed828,'id'));return db[_0xc6ed('0x99')][_0xc6ed('0x41')](_0x1fbd41[_0xc6ed('0x9a')](),_0x266b57)[_0xc6ed('0x28')](function(_0xa2b613){var _0x481258=_[_0xc6ed('0xad')](_0xa2b613,_0xc6ed('0xae'));var _0x27dd37=[];_0x3ed828[_0xc6ed('0x33')](function(_0x4bb4a7){_0x27dd37[_0xc6ed('0xaf')](updateWhatsappInteraction(_0x4bb4a7,_0xd6cb25,_0x481258));});return BPromise['all'](_0x27dd37);});});})[_0xc6ed('0x28')](function(_0x69cd9b){_0x464477[_0xc6ed('0xb0')]=_0x69cd9b;return _0x464477;})[_0xc6ed('0x28')](respondWithFilteredResult(_0x395b9f,_0x834950))[_0xc6ed('0x35')](handleError(_0x395b9f,null));};exports['show']=function(_0x4a2a27,_0x3e0c93){var _0x560eb9={'raw':![],'where':{'id':_0x4a2a27[_0xc6ed('0xb1')]['id']}},_0x581472={};_0x581472[_0xc6ed('0x40')]=_['keys'](db[_0xc6ed('0xb2')][_0xc6ed('0xb3')]);_0x581472[_0xc6ed('0x41')]=_[_0xc6ed('0x42')](_0x4a2a27['query']);_0x581472[_0xc6ed('0x49')]=_[_0xc6ed('0x43')](_0x581472[_0xc6ed('0x40')],_0x581472[_0xc6ed('0x41')]);_0x560eb9[_0xc6ed('0x44')]=_[_0xc6ed('0x43')](_0x581472[_0xc6ed('0x40')],qs[_0xc6ed('0x45')](_0x4a2a27['query']['fields']));_0x560eb9[_0xc6ed('0x44')]=_0x560eb9[_0xc6ed('0x44')][_0xc6ed('0x46')]?_0x560eb9['attributes']:_0x581472[_0xc6ed('0x40')];if(_0x4a2a27['query'][_0xc6ed('0xb4')]){_0x560eb9[_0xc6ed('0xb5')]=[{'all':!![]}];}_0x560eb9=_[_0xc6ed('0x9c')]({},_0x560eb9,_0x4a2a27['options']);return db[_0xc6ed('0xb2')][_0xc6ed('0x62')](_0x560eb9)[_0xc6ed('0x28')](handleEntityNotFound(_0x3e0c93,null))[_0xc6ed('0x28')](respondWithResult(_0x3e0c93,null))[_0xc6ed('0x35')](handleError(_0x3e0c93,null));};exports[_0xc6ed('0xb6')]=function(_0x4310d9,_0x32cea0){return db[_0xc6ed('0xb2')][_0xc6ed('0xb6')](_0x4310d9[_0xc6ed('0x73')],{})[_0xc6ed('0x28')](respondWithResult(_0x32cea0,0xc9))[_0xc6ed('0x35')](handleError(_0x32cea0,null));};exports['update']=function(_0x4c30f7,_0x41c889){if(_0x4c30f7['body']['id']){delete _0x4c30f7['body']['id'];}return db[_0xc6ed('0xb2')][_0xc6ed('0x62')]({'where':{'id':_0x4c30f7[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x41c889,null))[_0xc6ed('0x28')](saveUpdates(_0x4c30f7[_0xc6ed('0x73')],null))['then'](respondWithResult(_0x41c889,null))[_0xc6ed('0x35')](handleError(_0x41c889,null));};exports['destroy']=function(_0x321346,_0x2e8260){return db[_0xc6ed('0xb2')]['find']({'where':{'id':_0x321346[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x2e8260,null))['then'](removeEntity(_0x2e8260,null))['catch'](handleError(_0x2e8260,null));};exports[_0xc6ed('0xb7')]=function(_0x375acc,_0x5e81e6){return db[_0xc6ed('0xb2')][_0xc6ed('0xb7')]()['then'](respondWithResult(_0x5e81e6,null))['catch'](handleError(_0x5e81e6,null));};exports[_0xc6ed('0xb8')]=function(_0x242505,_0x599118,_0x4e1927){return db[_0xc6ed('0xb9')]['find']({'where':{'id':_0x242505[_0xc6ed('0xb1')]['id']}})['then'](handleEntityNotFound(_0x599118,null))['then'](function(_0x57801e){if(_0x57801e){return _0x57801e['addMessage'](_0x242505[_0xc6ed('0x73')][_0xc6ed('0xba')],_[_0xc6ed('0xbb')](_0x242505[_0xc6ed('0x73')],['ids','id'])||{});}})[_0xc6ed('0x28')](respondWithResult(_0x599118,null))[_0xc6ed('0x35')](handleError(_0x599118,null));};exports[_0xc6ed('0xbc')]=function(_0x561162,_0x5591f7,_0x38dfb1){var _0x4eeafc={'raw':![],'where':{}};var _0x5ca6ad={};var _0x566c8c={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x561162[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x5591f7,null))[_0xc6ed('0x28')](function(_0x1a4a52){if(_0x1a4a52){_0x5ca6ad[_0xc6ed('0x40')]=_[_0xc6ed('0x42')](db[_0xc6ed('0xb9')]['rawAttributes']);_0x5ca6ad[_0xc6ed('0x41')]=_['keys'](_0x561162[_0xc6ed('0x41')]);_0x5ca6ad[_0xc6ed('0x49')]=_[_0xc6ed('0x43')](_0x5ca6ad[_0xc6ed('0x40')],_0x5ca6ad[_0xc6ed('0x41')]);_0x4eeafc[_0xc6ed('0x44')]=_[_0xc6ed('0x43')](_0x5ca6ad[_0xc6ed('0x40')],qs[_0xc6ed('0x45')](_0x561162[_0xc6ed('0x41')]['fields']));_0x4eeafc[_0xc6ed('0x44')]=_0x4eeafc[_0xc6ed('0x44')][_0xc6ed('0x46')]?_0x4eeafc[_0xc6ed('0x44')]:_0x5ca6ad[_0xc6ed('0x40')];if(!_0x561162[_0xc6ed('0x41')][_0xc6ed('0xbd')](_0xc6ed('0x47'))){_0x4eeafc[_0xc6ed('0x23')]=qs['limit'](_0x561162[_0xc6ed('0x41')][_0xc6ed('0x23')]);_0x4eeafc[_0xc6ed('0x21')]=qs[_0xc6ed('0x21')](_0x561162[_0xc6ed('0x41')][_0xc6ed('0x21')]);}_0x4eeafc[_0xc6ed('0x8e')]=qs[_0xc6ed('0x48')](_0x561162[_0xc6ed('0x41')][_0xc6ed('0x48')]);_0x4eeafc[_0xc6ed('0x78')]=qs[_0xc6ed('0x49')](_[_0xc6ed('0x4a')](_0x561162[_0xc6ed('0x41')],_0x5ca6ad[_0xc6ed('0x49')]));_0x4eeafc[_0xc6ed('0x78')][_0xc6ed('0xae')]=_0x1a4a52['id'];if(_0x561162[_0xc6ed('0x41')]['filter']){_0x4eeafc[_0xc6ed('0x78')]=_[_0xc6ed('0x9c')](_0x4eeafc[_0xc6ed('0x78')],{'$or':_[_0xc6ed('0x2f')](_0x4eeafc[_0xc6ed('0x44')],function(_0x486b7e){var _0x517e85={};_0x517e85[_0x486b7e]={'$like':'%'+_0x561162[_0xc6ed('0x41')][_0xc6ed('0x82')]+'%'};return _0x517e85;})});}if(_0x561162[_0xc6ed('0x41')][_0xc6ed('0x7c')]){var _0x59f5eb=_0x561162[_0xc6ed('0x41')][_0xc6ed('0x7c')]['split'](',');var _0x268010={};_0x268010[_0x59f5eb[0x0]]={'$gte':moment(_0x59f5eb[0x1])['format'](_0xc6ed('0xbe'))};_0x4eeafc[_0xc6ed('0x78')]=_[_0xc6ed('0x9c')](_0x4eeafc[_0xc6ed('0x78')],_0x268010);}_0x4eeafc=_[_0xc6ed('0x9c')]({},_0x4eeafc,_0x561162[_0xc6ed('0xbf')]);return db['WhatsappMessage'][_0xc6ed('0x24')]({'where':_0x4eeafc[_0xc6ed('0x78')]})[_0xc6ed('0x28')](function(_0x2535b6){_0x566c8c['count']=_0x2535b6;if(_0x561162[_0xc6ed('0x41')][_0xc6ed('0xb4')]){_0x4eeafc[_0xc6ed('0xb5')]=[{'all':!![]}];}return db[_0xc6ed('0xb9')]['findAll'](_0x4eeafc);})[_0xc6ed('0x28')](function(_0x112b1a){_0x566c8c['rows']=_0x112b1a;return _0x566c8c;});}})['then'](respondWithFilteredResult(_0x5591f7,_0x4eeafc))['catch'](handleError(_0x5591f7,null));};exports[_0xc6ed('0xc0')]=function(_0x4443a2,_0x5ce659,_0x171c9){return db['WhatsappInteraction'][_0xc6ed('0x62')]({'where':{'id':_0x4443a2[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x5ce659,null))[_0xc6ed('0x28')](function(_0x1ee1a4){if(_0x1ee1a4){return _0x1ee1a4[_0xc6ed('0xc1')](_0x4443a2[_0xc6ed('0x73')][_0xc6ed('0xba')],_[_0xc6ed('0xbb')](_0x4443a2['body'],[_0xc6ed('0xba'),'id'])||{})[_0xc6ed('0xc2')](function(){return db[_0xc6ed('0x6d')][_0xc6ed('0xc3')]({'attributes':['id',_0xc6ed('0x2c'),_0xc6ed('0x4c')],'where':{'id':_0x4443a2[_0xc6ed('0x73')][_0xc6ed('0xba')]}});})[_0xc6ed('0x28')](function(_0x1b277f){socket[_0xc6ed('0xc4')]('whatsappInteractionTags:save',{'id':Number(_0x4443a2[_0xc6ed('0xb1')]['id']),'tags':_0x1b277f||[]});return{'id':Number(_0x4443a2[_0xc6ed('0xb1')]['id']),'tags':_0x1b277f||[]};});}})['then'](respondWithResult(_0x5ce659,null))[_0xc6ed('0x35')](handleError(_0x5ce659,null));};exports[_0xc6ed('0xc5')]=function(_0x2d82a2,_0x179b07,_0x574c05){return db[_0xc6ed('0xb2')]['find']({'where':{'id':_0x2d82a2[_0xc6ed('0xb1')]['id']}})[_0xc6ed('0x28')](handleEntityNotFound(_0x179b07,null))['then'](function(_0x493276){if(_0x493276){return _0x493276['removeTags'](_0x2d82a2[_0xc6ed('0x41')][_0xc6ed('0xba')]);}})[_0xc6ed('0x28')](respondWithStatusCode(_0x179b07,null))['catch'](handleError(_0x179b07,null));};exports[_0xc6ed('0xc6')]=function(_0x42b13f,_0x3aa0b5){var _0x3f0d73=moment()[_0xc6ed('0xc7')]()['toString']();var _0x11aa46=path['join'](config[_0xc6ed('0xc8')],_0xc6ed('0xc9'),_0xc6ed('0xca'),'tmp');var _0x36f59b=path[_0xc6ed('0xcb')](config[_0xc6ed('0xc8')],_0xc6ed('0xc9'),'files',_0xc6ed('0xcc'));var _0x2883f3=path[_0xc6ed('0xcb')](_0x11aa46,_0x3f0d73);var _0x57c7d1=util['format']('transcript-%d-%s.zip',_0x42b13f[_0xc6ed('0xb1')]['id'],_0x3f0d73);var _0x1d1a5f=path['join'](_0x11aa46,_0x57c7d1);var _0x54f3fe=[];_0x54f3fe[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0x70')],'as':'User','attributes':['id',_0xc6ed('0x30')],'raw':!![]});_0x54f3fe[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0xcd')],'as':_0xc6ed('0xce'),'attributes':['id',_0xc6ed('0xcf'),'lastName'],'raw':!![]});if(_0x42b13f[_0xc6ed('0x41')]['attachments']){_0x54f3fe['push']({'model':db[_0xc6ed('0xd0')],'as':'Attachment','raw':!![]});}var _0x2ada9d=[{'model':db[_0xc6ed('0xb9')],'as':_0xc6ed('0xd1'),'attributes':['id',_0xc6ed('0x73'),_0xc6ed('0x7a'),_0xc6ed('0xd2'),_0xc6ed('0xd3'),_0xc6ed('0x7e')],'include':_0x54f3fe}];_0x2ada9d[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0xd4')],'as':_0xc6ed('0xd5'),'attributes':['id',_0xc6ed('0x2c')]});_0x2ada9d[_0xc6ed('0xaf')]({'model':db[_0xc6ed('0x70')],'as':'Owner','attributes':['id',_0xc6ed('0x30')]});return db[_0xc6ed('0xb2')][_0xc6ed('0x62')]({'where':{'id':_0x42b13f[_0xc6ed('0xb1')]['id']},'include':_0x2ada9d})[_0xc6ed('0x28')](handleEntityNotFound(_0x3aa0b5,null))[_0xc6ed('0x28')](function(_0x2e6562){if(_0x2e6562){var _0x44aad4=_0x2e6562[_0xc6ed('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x2883f3);var _0x5d2d3a={'channel':_0xc6ed('0xd7'),'account':_0x44aad4['Account'][_0xc6ed('0x2c')],'agent':_0x44aad4[_0xc6ed('0xd8')]?_0x44aad4[_0xc6ed('0xd8')][_0xc6ed('0x30')]:_0xc6ed('0xd9'),'createdAt':moment(_0x44aad4['createdAt'])[_0xc6ed('0xda')](_0xc6ed('0xbe'))[_0xc6ed('0x9a')](),'closedAt':_0x44aad4[_0xc6ed('0x3b')]?moment(_0x44aad4[_0xc6ed('0xdb')])[_0xc6ed('0xda')](_0xc6ed('0xbe'))[_0xc6ed('0x9a')]():'','disposition':_0x44aad4[_0xc6ed('0xdc')],'messages':_(_0x44aad4[_0xc6ed('0xd1')])[_0xc6ed('0x82')]({'secret':![]})['map'](function(_0x536ccb){if(_0x536ccb[_0xc6ed('0xd0')]){var _0x502cbe=path[_0xc6ed('0xcb')](_0x36f59b,_0x536ccb[_0xc6ed('0xd0')][_0xc6ed('0xdd')]);if(fs[_0xc6ed('0xde')](_0x502cbe)){fs[_0xc6ed('0xdf')](_0x502cbe)['pipe'](fs[_0xc6ed('0xe0')](path[_0xc6ed('0xcb')](_0x2883f3,_0x536ccb[_0xc6ed('0xd0')][_0xc6ed('0xdd')])));}}return{'date':moment(_0x536ccb['createdAt'])['format'](_0xc6ed('0xbe'))['toString'](),'sender':_0x536ccb[_0xc6ed('0xd2')]===_0xc6ed('0xe1')?_0x536ccb[_0xc6ed('0x70')]?_0x536ccb[_0xc6ed('0x70')][_0xc6ed('0x30')]:'System':_0x536ccb[_0xc6ed('0xce')][_0xc6ed('0xcf')]+(_0x536ccb[_0xc6ed('0xce')]['lastName']?'\x20'+_0x536ccb['Contact'][_0xc6ed('0xe2')]:''),'body':_0x536ccb[_0xc6ed('0xd0')]?_0x536ccb[_0xc6ed('0xd0')][_0xc6ed('0xdd')]:_0x536ccb['body'],'direction':_0x536ccb[_0xc6ed('0xd2')]===_0xc6ed('0xe1')?'A':'C','secret':_0x536ccb['secret'],'read':_0x536ccb[_0xc6ed('0x7e')],'attachment':_0x536ccb['Attachment']};})[_0xc6ed('0x63')]()};return ejs[_0xc6ed('0xe3')](path[_0xc6ed('0xcb')](config['root'],_0xc6ed('0xc9'),_0xc6ed('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x5d2d3a})[_0xc6ed('0x28')](function(_0x5912d6){var _0x56c9d2=path['join'](_0x2883f3,_0xc6ed('0xe5')+_0x44aad4['id']+'-'+_0x3f0d73+_0xc6ed('0xe6'));var _0x213c9d={'path':_0x56c9d2,'channel':'Whatsapp','interactionId':_0x44aad4['id']};return pdf[_0xc6ed('0xe7')](_0x5912d6,_0x213c9d);})[_0xc6ed('0x28')](function(){return new BPromise(function(_0x1651d7,_0x4e7820){zipdir(_0x2883f3,{'saveTo':_0x1d1a5f},function(_0x57a578,_0x10aa08){if(_0x57a578)return _0x4e7820(_0x57a578);return _0x1651d7(_0x10aa08);});})[_0xc6ed('0x28')](function(){return new BPromise(function(_0x3f9962,_0x2560ef){rimraf(_0x2883f3,function(_0x4e8061){if(_0x4e8061)_0x2560ef(_0x4e8061);return _0x3f9962();});});})[_0xc6ed('0x28')](function(){return _0x3aa0b5[_0xc6ed('0xc6')](_0x1d1a5f,_0x57c7d1,function(_0x27289e){if(_0x27289e){console['log']('err',_0x27289e);}else{fs[_0xc6ed('0xe8')](_0x1d1a5f);}});});});}else{return _0x3aa0b5[_0xc6ed('0x1d')](0xc8);}})[_0xc6ed('0x35')](handleError(_0x3aa0b5,null));}; \ No newline at end of file +var _0x5204=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','Tags','TagIds','split','forEach','push','answered','unmanaged','total','closed','UserId','waiting','talking','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','where','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','includeAll','include','options','catch','create','params','describe','addMessage','WhatsappMessage','ids','omit','findOne','findAll','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','Attachment','Messages','createdAt','direction','WhatsappAccount','Account','Owner','closedAt','existsSync','createReadStream','createWriteStream','basename','format','YYYY-MM-DD\x20HH:mm:ss','lastName','secret','renderFile','views','downloadInteraction.ejs','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x5204,0xdf));var _0x4520=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x5204[_0xd7b0a4];return _0x184e9e;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var pdf=require(_0x4520('0x14'));var hardwareService=require(_0x4520('0x15'));var logger=require(_0x4520('0x16'))(_0x4520('0x17'));var utils=require(_0x4520('0x18'));var config=require(_0x4520('0x19'));var licenseUtil=require(_0x4520('0x1a'));var db=require(_0x4520('0x1b'))['db'];config[_0x4520('0x1c')]=_[_0x4520('0x1d')](config[_0x4520('0x1c')],{'host':_0x4520('0x1e'),'port':0x18eb});var socket=require(_0x4520('0x1f'))(new Redis(config[_0x4520('0x1c')]));require(_0x4520('0x20'))[_0x4520('0x21')](socket);function respondWithStatusCode(_0x48b3e7,_0x3e53e5){_0x3e53e5=_0x3e53e5||0xcc;return function(_0x20de6b){if(_0x20de6b){return _0x48b3e7[_0x4520('0x22')](_0x3e53e5);}return _0x48b3e7[_0x4520('0x23')](_0x3e53e5)[_0x4520('0x24')]();};}function respondWithResult(_0x51d85f,_0x2c1805){_0x2c1805=_0x2c1805||0xc8;return function(_0x33ac29){if(_0x33ac29){return _0x51d85f[_0x4520('0x23')](_0x2c1805)[_0x4520('0x25')](_0x33ac29);}};}function respondWithFilteredResult(_0x1b8b0f,_0x2e00f4){return function(_0x1dcf51){if(_0x1dcf51){var _0x4ba69f=typeof _0x2e00f4[_0x4520('0x26')]===_0x4520('0x27')&&typeof _0x2e00f4[_0x4520('0x28')]===_0x4520('0x27');var _0x4ac41d=_0x1dcf51[_0x4520('0x29')];var _0x52ca8c=_0x4ba69f?0x0:_0x2e00f4['offset'];var _0x4c46c5=_0x4ba69f?_0x1dcf51[_0x4520('0x29')]:_0x2e00f4['offset']+_0x2e00f4[_0x4520('0x28')];var _0x270dc2;if(_0x4c46c5>=_0x4ac41d){_0x4c46c5=_0x4ac41d;_0x270dc2=0xc8;}else{_0x270dc2=0xce;}_0x1b8b0f[_0x4520('0x23')](_0x270dc2);return _0x1b8b0f['set'](_0x4520('0x2a'),_0x52ca8c+'-'+_0x4c46c5+'/'+_0x4ac41d)[_0x4520('0x25')](_0x1dcf51);}return null;};}function patchUpdates(_0x3b2ede){return function(_0x4b889a){try{jsonpatch[_0x4520('0x2b')](_0x4b889a,_0x3b2ede,!![]);}catch(_0x847d15){return BPromise[_0x4520('0x2c')](_0x847d15);}return _0x4b889a[_0x4520('0x2d')]();};}function saveUpdates(_0x2a8528,_0x552da1){return function(_0x3774bd){if(_0x3774bd){return _0x3774bd[_0x4520('0x2e')](_0x2a8528)[_0x4520('0x2f')](function(_0x3e2906){return _0x3e2906;});}return null;};}function removeEntity(_0x57306b,_0x336c63){return function(_0x4602a4){if(_0x4602a4){return _0x4602a4[_0x4520('0x30')]()[_0x4520('0x2f')](function(){_0x57306b[_0x4520('0x23')](0xcc)[_0x4520('0x24')]();});}};}function handleEntityNotFound(_0x2d6902,_0x195c58){return function(_0x180c44){if(!_0x180c44){_0x2d6902[_0x4520('0x22')](0x194);}return _0x180c44;};}function handleError(_0x58836d,_0x222dbd){_0x222dbd=_0x222dbd||0x1f4;return function(_0x5c1a0b){logger[_0x4520('0x31')](_0x5c1a0b[_0x4520('0x32')]);if(_0x5c1a0b[_0x4520('0x33')]){delete _0x5c1a0b[_0x4520('0x33')];}_0x58836d[_0x4520('0x23')](_0x222dbd)[_0x4520('0x34')](_0x5c1a0b);};}function getInteractionUsers(_0x5bb163,_0x2c32ce){return new BPromise(function(_0x508c05,_0x2585eb){try{if(_0x2c32ce[_0x5bb163['id']]){_0x5bb163['Users']=_[_0x4520('0x35')](_0x2c32ce[_0x5bb163['id']],function(_0x5c140c){return{'id':_0x5c140c['id'],'fullname':_0x5c140c[_0x4520('0x36')]};});}}catch(_0x4e6a5f){_0x2585eb(_0x4e6a5f);}_0x508c05(_0x5bb163);});}function getInteractionTags(_0x5087dc,_0x18d6e9){return new BPromise(function(_0x14cbb5,_0x24d5b9){try{if(_0x5087dc['TagIds']){_0x5087dc[_0x4520('0x37')]=[];_0x5087dc[_0x4520('0x38')][_0x4520('0x39')](',')[_0x4520('0x3a')](function(_0x59b4ff){_0x5087dc['Tags'][_0x4520('0x3b')](_0x18d6e9[_0x59b4ff]);});}delete _0x5087dc[_0x4520('0x38')];}catch(_0x4a57d3){_0x24d5b9(_0x4a57d3);}_0x14cbb5(_0x5087dc);});}function updateWhatsappInteraction(_0x779e94,_0x3ee94f,_0x1b61d6){return new BPromise(function(_0x345bdc,_0x1eb998){return getInteractionUsers(_0x779e94,_0x1b61d6)[_0x4520('0x2f')](function(_0x550a0f){return getInteractionTags(_0x550a0f,_0x3ee94f);})[_0x4520('0x2f')](function(_0x368644){return getStateInteraction(_0x368644);})['then'](function(_0x3acc82){_0x345bdc(_0x3acc82);})['catch'](function(_0x8bf557){_0x1eb998(_0x8bf557);});});}function getStateInteraction(_0x268c05){return new BPromise(function(_0x4f2dc4){_0x268c05['waiting']=0x0;_0x268c05['talking']=0x0;_0x268c05[_0x4520('0x3c')]=0x0;_0x268c05[_0x4520('0x3d')]=0x0;_0x268c05[_0x4520('0x3e')]=0x0;if(!_0x268c05[_0x4520('0x3f')]&&!_0x268c05[_0x4520('0x40')]){_0x268c05[_0x4520('0x41')]+=0x1;}if(!_0x268c05[_0x4520('0x3f')]&&_0x268c05['UserId']){_0x268c05[_0x4520('0x42')]+=0x1;if(_0x268c05[_0x4520('0x41')]){_0x268c05[_0x4520('0x41')]-=0x1;}}if(_0x268c05['closed']&&_0x268c05[_0x4520('0x40')]){_0x268c05[_0x4520('0x3c')]+=0x1;if(_0x268c05['talking']){_0x268c05['talking']-=0x1;}}if(_0x268c05[_0x4520('0x3f')]&&!_0x268c05[_0x4520('0x40')]){_0x268c05[_0x4520('0x3d')]+=0x1;if(_0x268c05[_0x4520('0x41')]){_0x268c05[_0x4520('0x41')]-=0x1;}}_0x268c05['total']+=0x1;_0x4f2dc4(_0x268c05);});}exports['index']=function(_0x4f5aa1,_0x57a165){var _0x516993={},_0x43dc36={},_0x54da7a={'count':0x0,'rows':[]};var _0x517fcb=_[_0x4520('0x35')](db[_0x4520('0x43')][_0x4520('0x44')],function(_0x214026){return{'name':_0x214026[_0x4520('0x45')],'type':_0x214026['type'][_0x4520('0x46')]};});_0x43dc36[_0x4520('0x47')]=_['map'](_0x517fcb,'name');_0x43dc36[_0x4520('0x48')]=_[_0x4520('0x49')](_0x4f5aa1['query']);_0x43dc36[_0x4520('0x4a')]=_[_0x4520('0x4b')](_0x43dc36[_0x4520('0x47')],_0x43dc36[_0x4520('0x48')]);_0x516993['attributes']=_[_0x4520('0x4b')](_0x43dc36[_0x4520('0x47')],qs[_0x4520('0x4c')](_0x4f5aa1[_0x4520('0x48')][_0x4520('0x4c')]));_0x516993[_0x4520('0x4d')]=_0x516993[_0x4520('0x4d')][_0x4520('0x4e')]?_0x516993[_0x4520('0x4d')]:_0x43dc36[_0x4520('0x47')];if(!_0x4f5aa1[_0x4520('0x48')][_0x4520('0x4f')](_0x4520('0x50'))){_0x516993[_0x4520('0x28')]=qs[_0x4520('0x28')](_0x4f5aa1[_0x4520('0x48')][_0x4520('0x28')]);_0x516993['offset']=qs[_0x4520('0x26')](_0x4f5aa1[_0x4520('0x48')]['offset']);}_0x516993['order']=qs['sort'](_0x4f5aa1['query'][_0x4520('0x51')]);_0x516993['where']=qs[_0x4520('0x4a')](_[_0x4520('0x52')](_0x4f5aa1[_0x4520('0x48')],_0x43dc36[_0x4520('0x4a')]),_0x517fcb);var _0x177c4e=[];var _0x5e3eef=squel[_0x4520('0x53')]()[_0x4520('0x54')]('id')[_0x4520('0x54')](_0x4520('0x33'))[_0x4520('0x54')](_0x4520('0x55'))[_0x4520('0x56')](_0x4520('0x57'));var _0x17e353=squel[_0x4520('0x53')]()[_0x4520('0x54')](_0x4520('0x58'))['field']('u.fullname')[_0x4520('0x54')](_0x4520('0x59'))[_0x4520('0x56')]('user_has_whatsapp_interactions','ui')[_0x4520('0x5a')](_0x4520('0x5b'),'u',_0x4520('0x5c'));var _0x5398c2=squel[_0x4520('0x53')]()[_0x4520('0x56')](_0x4520('0x5d'),'i')['left_join']('cm_contacts','c',_0x4520('0x5e'))[_0x4520('0x5a')](_0x4520('0x5b'),'o',_0x4520('0x5f'))[_0x4520('0x5a')](_0x4520('0x60'),'a',_0x4520('0x61'))[_0x4520('0x5a')]('whatsapp_messages','me',_0x4520('0x62'))[_0x4520('0x5a')](_0x4520('0x63'),'it',_0x4520('0x64'))[_0x4520('0x5a')](_0x4520('0x57'),'t',_0x4520('0x65'));var _0x1a9a2d=squel[_0x4520('0x66')]();var _0x4562c4=[];var _0x381e0b=squel[_0x4520('0x66')]();var _0x2f11d9;if(_0x4f5aa1[_0x4520('0x48')][_0x4520('0x67')]){_0x2f11d9=as[_0x4520('0x68')](_0x4f5aa1[_0x4520('0x48')]['search']);var _0x52bb6c=_0x2f11d9[_0x4520('0x69')];for(var _0x35defa=0x0;_0x35defa<_0x2f11d9[_0x4520('0x6a')][_0x4520('0x4e')];_0x35defa++){var _0x265bb4=_0x2f11d9[_0x4520('0x6a')][_0x35defa];var _0x54372b='i';var _0xdd3a69=_[_0x4520('0x6b')](_0x517fcb,['name',_0x265bb4[_0x4520('0x54')]]);if(!_0xdd3a69){switch(_0x265bb4[_0x4520('0x54')]){case _0x4520('0x6c'):if(_0x265bb4[_0x4520('0x6d')]==0x1){_0x5398c2['having']('`'+_0x265bb4[_0x4520('0x54')]+_0x4520('0x6e'));}else{_0x5398c2['having']('`'+_0x265bb4['field']+_0x4520('0x6f'));}break;case _0x4520('0x70'):if(_0x265bb4[_0x4520('0x71')]===_0x4520('0x72')){if(_0x265bb4[_0x4520('0x6d')][_0x4520('0x39')]('\x20')['length']>0x1){_0x1a9a2d[_0x52bb6c](_0x4520('0x73'),qs[_0x4520('0x74')](_0x265bb4[_0x4520('0x6d')]),null);}else{var _0x11966f='%'+_0x265bb4['value']+'%';_0x1a9a2d[_0x52bb6c](_0x4520('0x75'),_0x11966f,_0x11966f,_0x11966f);}}else{_0xdd3a69=_[_0x4520('0x6b')](_0x517fcb,['name',_0x4520('0x76')]);_0x265bb4['field']=_0x4520('0x76');_0x116328=as[_0x4520('0x77')](_0x54372b,_0xdd3a69[_0x4520('0x78')],_0x265bb4);_0x1a9a2d[_0x52bb6c](_0x116328[_0x4520('0x79')],_0x116328['value'][_0x4520('0x7a')],_0x116328[_0x4520('0x6d')][_0x4520('0x24')]);}break;case _0x4520('0x7b'):var _0x4b6f71=_0x265bb4[_0x4520('0x6d')][_0x4520('0x39')](',')[_0x4520('0x35')](function(_0x2d5bf6){return Number(_0x2d5bf6);});_0x4b6f71[_0x4520('0x3a')](function(_0x8d166){_0x381e0b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x8d166+',%');});_0x4562c4=_[_0x4520('0x7c')](_0x4562c4,_0x4b6f71);break;case'User':if(_0x265bb4[_0x4520('0x71')]===_0x4520('0x72')){_0x1a9a2d[_0x52bb6c](_0x4520('0x7d'),'%'+_0x265bb4[_0x4520('0x6d')]+'%',null);}else{_0xdd3a69=_[_0x4520('0x6b')](_0x517fcb,[_0x4520('0x33'),'UserId']);_0x265bb4['field']=_0x4520('0x40');_0x116328=as['buildExpression'](_0x54372b,_0xdd3a69[_0x4520('0x78')],_0x265bb4);_0x1a9a2d[_0x52bb6c](_0x116328[_0x4520('0x79')],_0x116328[_0x4520('0x6d')][_0x4520('0x7a')],_0x116328[_0x4520('0x6d')][_0x4520('0x24')]);}break;case _0x4520('0x7e'):_0x116328=as[_0x4520('0x77')]('me',null,_0x265bb4);_0x1a9a2d[_0x52bb6c](_0x116328[_0x4520('0x79')],_0x116328['value'][_0x4520('0x7a')],_0x116328['value'][_0x4520('0x24')]);break;}}else{var _0x116328=as[_0x4520('0x77')](_0x54372b,_0xdd3a69[_0x4520('0x78')],_0x265bb4);_0x1a9a2d[_0x52bb6c](_0x116328[_0x4520('0x79')],_0x116328['value'][_0x4520('0x7a')],_0x116328[_0x4520('0x6d')][_0x4520('0x24')]);}}}else{var _0x228973=_(_0x4f5aa1['query'])['keys']()['map'](function(_0x2bf316){return _[_0x4520('0x7f')](_0x517fcb,[_0x4520('0x33'),_0x2bf316])?_0x2bf316:undefined;})['compact']()[_0x4520('0x6d')]();if(!_[_0x4520('0x80')](_0x228973)){_0x228973[_0x4520('0x3a')](function(_0xc560a8){if(_0xc560a8===_0x4520('0x81')){_0x5398c2['where'](_0x4520('0x82'),[][_0x4520('0x83')](_0x4f5aa1[_0x4520('0x48')][_0xc560a8]));}else if(_0xc560a8==='createdAt'){var _0x3419bd=JSON[_0x4520('0x84')](_0x4f5aa1[_0x4520('0x48')][_0xc560a8])[_0x4520('0x85')];var _0x2e8474=JSON[_0x4520('0x84')](_0x4f5aa1[_0x4520('0x48')][_0xc560a8])[_0x4520('0x86')];_0x5398c2['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3419bd,_0x2e8474);}else{if(_0x4f5aa1[_0x4520('0x48')][_0xc560a8]===_0x4520('0x87')){_0x5398c2['where']('i.'+_0xc560a8+_0x4520('0x88'));}else{_0x5398c2['where']('i.'+_0xc560a8+_0x4520('0x89'),_0x4f5aa1[_0x4520('0x48')][_0xc560a8]);}}});}if(_0x4f5aa1['query'][_0x4520('0x8a')]){if(_0x4f5aa1[_0x4520('0x48')]['read']==0x1){_0x5398c2[_0x4520('0x8b')](_0x4520('0x8c'));}else{_0x5398c2['having'](_0x4520('0x8d'));}}if(_0x4f5aa1[_0x4520('0x48')][_0x4520('0x8e')]){_0x4562c4=_['isArray'](_0x4f5aa1[_0x4520('0x48')][_0x4520('0x8e')])?_0x4f5aa1[_0x4520('0x48')][_0x4520('0x8e')]:new Array(_0x4f5aa1[_0x4520('0x48')][_0x4520('0x8e')]);_0x4562c4[_0x4520('0x3a')](function(_0x2a1503){_0x381e0b['or'](_0x4520('0x8f'),'%,'+_0x2a1503+',%');});}if(_0x4f5aa1[_0x4520('0x48')][_0x4520('0x90')]){var _0x31676c=_0x4f5aa1['query']['filter'][_0x4520('0x91')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x4520('0x92')](_0x31676c)){_0x1a9a2d['or'](_0x4520('0x93'),_0x31676c+'%')['or'](_0x4520('0x94'),_0x31676c+'%');}else{_0x1a9a2d['or'](_0x4520('0x95'),qs[_0x4520('0x74')](_0x31676c))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x31676c+'%');}}}_0x5398c2['where'](_0x1a9a2d);_0x5398c2[_0x4520('0x96')](_0x4520('0x97'));var _0x415d7f={'type':db[_0x4520('0x98')][_0x4520('0x99')][_0x4520('0x9a')],'raw':!![]};var _0x4b60e2=_0x5398c2[_0x4520('0x9b')]();_0x4b60e2[_0x4520('0x54')]('i.id');_0x4b60e2[_0x4520('0x54')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x516993['order']){_0x516993[_0x4520('0x9c')][_0x4520('0x3a')](function(_0x74297e){var _0x454b8c=_0x74297e[0x0]===_0x4520('0x9d')?_0x74297e[0x0]:'i.'+_0x74297e[0x0];_0x5398c2['order'](_0x454b8c,_0x74297e[0x1]===_0x4520('0x9e')?![]:!![]);});}if(!_[_0x4520('0x80')](_0x4562c4)){_0x5398c2['having'](_0x381e0b);_0x4b60e2['where'](_0x4520('0x9f'),_0x4562c4);}BPromise[_0x4520('0xa0')]()[_0x4520('0x2f')](function(){if(!_0x2f11d9){if(_0x4f5aa1['query'][_0x4520('0x81')])return;_0x4b60e2[_0x4520('0xa1')](_0x4520('0xa2'));_0x5398c2['where'](_0x4520('0xa2'));return;}if(_0x4f5aa1[_0x4520('0xa3')]['role']!==_0x4520('0xa4'))return;return _0x4f5aa1['user'][_0x4520('0xa5')]({'attributes':['id'],'raw':!![]})[_0x4520('0x2f')](function(_0x3e53d7){if(_[_0x4520('0x80')](_0x3e53d7)){_0x4b60e2[_0x4520('0xa1')](_0x4520('0xa6'));_0x5398c2[_0x4520('0xa1')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x4b60e2[_0x4520('0xa1')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4520('0x35')](_0x3e53d7,'id'));_0x5398c2[_0x4520('0xa1')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4520('0x35')](_0x3e53d7,'id'));}});})[_0x4520('0x2f')](function(){if(_0x4f5aa1[_0x4520('0xa3')][_0x4520('0xa7')]===_0x4520('0xa4')&&!_0x2f11d9&&!_0x4f5aa1[_0x4520('0x48')][_0x4520('0x81')])return[];return db[_0x4520('0xa8')][_0x4520('0x48')](_0x4b60e2[_0x4520('0xa9')](),_0x415d7f);})[_0x4520('0x2f')](function(_0x5b86ad){_0x54da7a['count']=_0x5b86ad['length'];if(_0x54da7a['count']===0x0)return[];return db['sequelize'][_0x4520('0x48')](_0x5e3eef[_0x4520('0xa9')](),_0x415d7f)[_0x4520('0x2f')](function(_0x3896fc){_0x177c4e=_['keyBy'](_0x3896fc,'id');_0x415d7f=_[_0x4520('0xaa')](_0x415d7f,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f5aa1[_0x4520('0x48')]['fields']){_0x516993[_0x4520('0x4d')]['forEach'](function(_0x2b334a){_0x5398c2[_0x4520('0x54')]('i.'+_0x2b334a);});}else{_0x5398c2[_0x4520('0x54')](_0x4520('0xab'),'unreadMessages');_0x5398c2[_0x4520('0x54')]('a.key',_0x4520('0xac'));_0x5398c2[_0x4520('0x54')](_0x4520('0xad'),_0x4520('0xae'));_0x5398c2[_0x4520('0x54')]('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',_0x4520('0x9d'));_0x5398c2[_0x4520('0x54')]('i.*');_0x5398c2[_0x4520('0x54')](_0x4520('0xaf'),'Contact.firstName');_0x5398c2[_0x4520('0x54')]('c.lastName','Contact.lastName');_0x5398c2[_0x4520('0x54')](_0x4520('0xb0'),'Contact.email');_0x5398c2[_0x4520('0x54')]('c.phone',_0x4520('0xb1'));_0x5398c2[_0x4520('0x54')](_0x4520('0xb2'),_0x4520('0xb3'));_0x5398c2[_0x4520('0x54')](_0x4520('0xb4'),_0x4520('0xb5'));_0x5398c2[_0x4520('0x54')](_0x4520('0xb6'),_0x4520('0xb7'));_0x5398c2[_0x4520('0x54')](_0x4520('0xb8'),_0x4520('0xb9'));_0x5398c2[_0x4520('0x54')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4520('0x38'));}if(_0x516993[_0x4520('0x28')])_0x5398c2['limit'](_0x516993[_0x4520('0x28')]);if(_0x516993[_0x4520('0x26')])_0x5398c2['offset'](_0x516993[_0x4520('0x26')]);return db[_0x4520('0xa8')][_0x4520('0x48')](_0x5398c2[_0x4520('0xa9')](),_0x415d7f);})[_0x4520('0x2f')](function(_0xad6e88){if(_0xad6e88['length']>0x0)_0x17e353[_0x4520('0xa1')](_0x4520('0xba'),_[_0x4520('0x35')](_0xad6e88,'id'));return db[_0x4520('0xa8')][_0x4520('0x48')](_0x17e353['toString'](),_0x415d7f)['then'](function(_0x1f9fc1){var _0x3e46bd=_[_0x4520('0xbb')](_0x1f9fc1,_0x4520('0xbc'));var _0x28f486=[];_0xad6e88[_0x4520('0x3a')](function(_0x423c7e){_0x28f486[_0x4520('0x3b')](updateWhatsappInteraction(_0x423c7e,_0x177c4e,_0x3e46bd));});return BPromise[_0x4520('0xbd')](_0x28f486);});});})[_0x4520('0x2f')](function(_0x480939){_0x54da7a[_0x4520('0xbe')]=_0x480939;return _0x54da7a;})[_0x4520('0x2f')](respondWithFilteredResult(_0x57a165,_0x516993))['catch'](handleError(_0x57a165,null));};exports[_0x4520('0xbf')]=function(_0x572f6b,_0x54d969){var _0x14724f={'raw':![],'where':{'id':_0x572f6b['params']['id']}},_0x1823a2={};_0x1823a2['model']=_[_0x4520('0x49')](db[_0x4520('0x43')][_0x4520('0x44')]);_0x1823a2[_0x4520('0x48')]=_['keys'](_0x572f6b[_0x4520('0x48')]);_0x1823a2[_0x4520('0x4a')]=_[_0x4520('0x4b')](_0x1823a2[_0x4520('0x47')],_0x1823a2[_0x4520('0x48')]);_0x14724f[_0x4520('0x4d')]=_[_0x4520('0x4b')](_0x1823a2[_0x4520('0x47')],qs[_0x4520('0x4c')](_0x572f6b['query'][_0x4520('0x4c')]));_0x14724f[_0x4520('0x4d')]=_0x14724f[_0x4520('0x4d')]['length']?_0x14724f['attributes']:_0x1823a2[_0x4520('0x47')];if(_0x572f6b['query'][_0x4520('0xc0')]){_0x14724f[_0x4520('0xc1')]=[{'all':!![]}];}_0x14724f=_[_0x4520('0xaa')]({},_0x14724f,_0x572f6b[_0x4520('0xc2')]);return db[_0x4520('0x43')][_0x4520('0x6b')](_0x14724f)[_0x4520('0x2f')](handleEntityNotFound(_0x54d969,null))[_0x4520('0x2f')](respondWithResult(_0x54d969,null))[_0x4520('0xc3')](handleError(_0x54d969,null));};exports['create']=function(_0x309d14,_0x3cfb78){return db[_0x4520('0x43')][_0x4520('0xc4')](_0x309d14[_0x4520('0x7e')],{})[_0x4520('0x2f')](respondWithResult(_0x3cfb78,0xc9))[_0x4520('0xc3')](handleError(_0x3cfb78,null));};exports['update']=function(_0x666f9c,_0x249502){if(_0x666f9c[_0x4520('0x7e')]['id']){delete _0x666f9c[_0x4520('0x7e')]['id'];}return db[_0x4520('0x43')]['find']({'where':{'id':_0x666f9c['params']['id']}})[_0x4520('0x2f')](handleEntityNotFound(_0x249502,null))[_0x4520('0x2f')](saveUpdates(_0x666f9c[_0x4520('0x7e')],null))['then'](respondWithResult(_0x249502,null))['catch'](handleError(_0x249502,null));};exports[_0x4520('0x30')]=function(_0x904f4f,_0x3e99e3){return db['WhatsappInteraction'][_0x4520('0x6b')]({'where':{'id':_0x904f4f[_0x4520('0xc5')]['id']}})['then'](handleEntityNotFound(_0x3e99e3,null))[_0x4520('0x2f')](removeEntity(_0x3e99e3,null))[_0x4520('0xc3')](handleError(_0x3e99e3,null));};exports[_0x4520('0xc6')]=function(_0x3c5501,_0xea598f){return db[_0x4520('0x43')][_0x4520('0xc6')]()[_0x4520('0x2f')](respondWithResult(_0xea598f,null))[_0x4520('0xc3')](handleError(_0xea598f,null));};exports[_0x4520('0xc7')]=function(_0x5de8f9,_0x31b6f5,_0x4f8512){return db[_0x4520('0xc8')]['find']({'where':{'id':_0x5de8f9[_0x4520('0xc5')]['id']}})[_0x4520('0x2f')](handleEntityNotFound(_0x31b6f5,null))[_0x4520('0x2f')](function(_0x3639f1){if(_0x3639f1){return _0x3639f1['addMessage'](_0x5de8f9[_0x4520('0x7e')][_0x4520('0xc9')],_[_0x4520('0xca')](_0x5de8f9[_0x4520('0x7e')],[_0x4520('0xc9'),'id'])||{});}})[_0x4520('0x2f')](respondWithResult(_0x31b6f5,null))[_0x4520('0xc3')](handleError(_0x31b6f5,null));};exports['getMessages']=function(_0x39fa27,_0x56f398,_0x4ab423){var _0x320603={'raw':![],'where':{}};var _0x59d564={};var _0x9cbef9={'count':0x0,'rows':[]};return db[_0x4520('0x43')][_0x4520('0xcb')]({'where':{'id':_0x39fa27[_0x4520('0xc5')]['id']}})[_0x4520('0x2f')](handleEntityNotFound(_0x56f398,null))[_0x4520('0x2f')](function(_0x550969){if(_0x550969){_0x59d564[_0x4520('0x47')]=_[_0x4520('0x49')](db[_0x4520('0xc8')][_0x4520('0x44')]);_0x59d564['query']=_[_0x4520('0x49')](_0x39fa27['query']);_0x59d564[_0x4520('0x4a')]=_[_0x4520('0x4b')](_0x59d564['model'],_0x59d564[_0x4520('0x48')]);_0x320603[_0x4520('0x4d')]=_[_0x4520('0x4b')](_0x59d564['model'],qs[_0x4520('0x4c')](_0x39fa27[_0x4520('0x48')]['fields']));_0x320603[_0x4520('0x4d')]=_0x320603[_0x4520('0x4d')][_0x4520('0x4e')]?_0x320603[_0x4520('0x4d')]:_0x59d564[_0x4520('0x47')];if(!_0x39fa27['query'][_0x4520('0x4f')](_0x4520('0x50'))){_0x320603[_0x4520('0x28')]=qs['limit'](_0x39fa27[_0x4520('0x48')]['limit']);_0x320603[_0x4520('0x26')]=qs[_0x4520('0x26')](_0x39fa27[_0x4520('0x48')][_0x4520('0x26')]);}_0x320603[_0x4520('0x9c')]=qs[_0x4520('0x51')](_0x39fa27[_0x4520('0x48')][_0x4520('0x51')]);_0x320603[_0x4520('0xa1')]=qs['filters'](_[_0x4520('0x52')](_0x39fa27[_0x4520('0x48')],_0x59d564['filters']));_0x320603['where'][_0x4520('0xbc')]=_0x550969['id'];if(_0x39fa27[_0x4520('0x48')][_0x4520('0x90')]){_0x320603[_0x4520('0xa1')]=_[_0x4520('0xaa')](_0x320603[_0x4520('0xa1')],{'$or':_[_0x4520('0x35')](_0x320603[_0x4520('0x4d')],function(_0x1cea0e){var _0x156129={};_0x156129[_0x1cea0e]={'$like':'%'+_0x39fa27[_0x4520('0x48')]['filter']+'%'};return _0x156129;})});}if(_0x39fa27[_0x4520('0x48')][_0x4520('0x85')]){var _0x3847ca=_0x39fa27[_0x4520('0x48')][_0x4520('0x85')][_0x4520('0x39')](',');var _0x2d596d={};_0x2d596d[_0x3847ca[0x0]]={'$gte':moment(_0x3847ca[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x320603['where']=_[_0x4520('0xaa')](_0x320603[_0x4520('0xa1')],_0x2d596d);}_0x320603=_[_0x4520('0xaa')]({},_0x320603,_0x39fa27[_0x4520('0xc2')]);return db[_0x4520('0xc8')][_0x4520('0x29')]({'where':_0x320603[_0x4520('0xa1')]})[_0x4520('0x2f')](function(_0xdc61bd){_0x9cbef9[_0x4520('0x29')]=_0xdc61bd;if(_0x39fa27[_0x4520('0x48')][_0x4520('0xc0')]){_0x320603[_0x4520('0xc1')]=[{'all':!![]}];}return db[_0x4520('0xc8')][_0x4520('0xcc')](_0x320603);})[_0x4520('0x2f')](function(_0x45c3ad){_0x9cbef9['rows']=_0x45c3ad;return _0x9cbef9;});}})[_0x4520('0x2f')](respondWithFilteredResult(_0x56f398,_0x320603))[_0x4520('0xc3')](handleError(_0x56f398,null));};exports['addTags']=function(_0x49eaec,_0x5068cc,_0x574eb5){return db['WhatsappInteraction'][_0x4520('0x6b')]({'where':{'id':_0x49eaec[_0x4520('0xc5')]['id']}})[_0x4520('0x2f')](handleEntityNotFound(_0x5068cc,null))[_0x4520('0x2f')](function(_0x3427d8){if(_0x3427d8){return _0x3427d8[_0x4520('0xcd')](_0x49eaec[_0x4520('0x7e')][_0x4520('0xc9')],_[_0x4520('0xca')](_0x49eaec['body'],['ids','id'])||{})[_0x4520('0xce')](function(){return db[_0x4520('0x7b')][_0x4520('0xcc')]({'attributes':['id',_0x4520('0x33'),_0x4520('0x55')],'where':{'id':_0x49eaec['body']['ids']}});})['then'](function(_0x2751fe){socket[_0x4520('0xcf')](_0x4520('0xd0'),{'id':Number(_0x49eaec['params']['id']),'tags':_0x2751fe||[]});return{'id':Number(_0x49eaec[_0x4520('0xc5')]['id']),'tags':_0x2751fe||[]};});}})[_0x4520('0x2f')](respondWithResult(_0x5068cc,null))['catch'](handleError(_0x5068cc,null));};exports[_0x4520('0xd1')]=function(_0x5f3712,_0x75a51a,_0x444ecd){return db['WhatsappInteraction']['find']({'where':{'id':_0x5f3712[_0x4520('0xc5')]['id']}})['then'](handleEntityNotFound(_0x75a51a,null))[_0x4520('0x2f')](function(_0x15783d){if(_0x15783d){return _0x15783d[_0x4520('0xd1')](_0x5f3712[_0x4520('0x48')][_0x4520('0xc9')]);}})[_0x4520('0x2f')](respondWithStatusCode(_0x75a51a,null))[_0x4520('0xc3')](handleError(_0x75a51a,null));};exports[_0x4520('0xd2')]=function(_0xf9306d,_0x942005){var _0x1d62df=moment()['unix']()[_0x4520('0xa9')]();var _0x349912=path['join'](config[_0x4520('0xd3')],_0x4520('0xd4'),_0x4520('0xd5'),_0x4520('0xd6'));var _0x2199ac=path[_0x4520('0xd7')](config[_0x4520('0xd3')],'server',_0x4520('0xd5'),_0x4520('0xd8'));var _0x490ec8=path[_0x4520('0xd7')](_0x349912,_0x1d62df);var _0x4d7a3c=util['format'](_0x4520('0xd9'),_0xf9306d[_0x4520('0xc5')]['id'],_0x1d62df);var _0x2edd95=path[_0x4520('0xd7')](_0x349912,_0x4d7a3c);var _0x51f4da=[];_0x51f4da[_0x4520('0x3b')]({'model':db['User'],'as':_0x4520('0xda'),'attributes':['id',_0x4520('0x36')],'raw':!![]});_0x51f4da[_0x4520('0x3b')]({'model':db['CmContact'],'as':_0x4520('0x70'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0xf9306d[_0x4520('0x48')][_0x4520('0xd8')]){_0x51f4da[_0x4520('0x3b')]({'model':db[_0x4520('0xdb')],'as':_0x4520('0xdb'),'raw':!![]});}var _0x500f4b=[{'model':db[_0x4520('0xc8')],'as':_0x4520('0xdc'),'attributes':['id',_0x4520('0x7e'),_0x4520('0xdd'),_0x4520('0xde'),'secret',_0x4520('0x8a')],'include':_0x51f4da}];_0x500f4b[_0x4520('0x3b')]({'model':db[_0x4520('0xdf')],'as':_0x4520('0xe0'),'attributes':['id',_0x4520('0x33')]});_0x500f4b[_0x4520('0x3b')]({'model':db['User'],'as':_0x4520('0xe1'),'attributes':['id',_0x4520('0x36')]});return db['WhatsappInteraction']['find']({'where':{'id':_0xf9306d[_0x4520('0xc5')]['id']},'include':_0x500f4b})[_0x4520('0x2f')](handleEntityNotFound(_0x942005,null))[_0x4520('0x2f')](function(_0x522ba6){if(_0x522ba6){var _0x559ff3=_0x522ba6['get']({'plain':!![]});fs['mkdirSync'](_0x490ec8);var _0x117ec3={'channel':'Whatsapp','account':_0x559ff3[_0x4520('0xe0')][_0x4520('0x33')],'agent':_0x559ff3['Owner']?_0x559ff3[_0x4520('0xe1')]['fullname']:'N.A.','createdAt':moment(_0x559ff3[_0x4520('0xdd')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4520('0xa9')](),'closedAt':_0x559ff3[_0x4520('0x3f')]?moment(_0x559ff3[_0x4520('0xe2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4520('0xa9')]():'','disposition':_0x559ff3['disposition'],'messages':_(_0x559ff3['Messages'])[_0x4520('0x90')]({'secret':![]})[_0x4520('0x35')](function(_0x5bdd2b){if(_0x5bdd2b[_0x4520('0xdb')]){var _0x5eb334=path[_0x4520('0xd7')](_0x2199ac,_0x5bdd2b[_0x4520('0xdb')]['basename']);if(fs[_0x4520('0xe3')](_0x5eb334)){fs[_0x4520('0xe4')](_0x5eb334)['pipe'](fs[_0x4520('0xe5')](path['join'](_0x490ec8,_0x5bdd2b['Attachment'][_0x4520('0xe6')])));}}return{'date':moment(_0x5bdd2b[_0x4520('0xdd')])[_0x4520('0xe7')](_0x4520('0xe8'))[_0x4520('0xa9')](),'sender':_0x5bdd2b[_0x4520('0xde')]==='out'?_0x5bdd2b[_0x4520('0xda')]?_0x5bdd2b[_0x4520('0xda')]['fullname']:'System':_0x5bdd2b['Contact']['firstName']+(_0x5bdd2b[_0x4520('0x70')][_0x4520('0xe9')]?'\x20'+_0x5bdd2b[_0x4520('0x70')]['lastName']:''),'body':_0x5bdd2b['Attachment']?_0x5bdd2b[_0x4520('0xdb')][_0x4520('0xe6')]:_0x5bdd2b[_0x4520('0x7e')],'direction':_0x5bdd2b['direction']==='out'?'A':'C','secret':_0x5bdd2b[_0x4520('0xea')],'read':_0x5bdd2b[_0x4520('0x8a')],'attachment':_0x5bdd2b[_0x4520('0xdb')]};})['value']()};return ejs[_0x4520('0xeb')](path[_0x4520('0xd7')](config[_0x4520('0xd3')],_0x4520('0xd4'),_0x4520('0xec'),_0x4520('0xed')),{'interaction':_0x117ec3})[_0x4520('0x2f')](function(_0x5be947){var _0xfac206=path[_0x4520('0xd7')](_0x490ec8,'transcript-'+_0x559ff3['id']+'-'+_0x1d62df+'.pdf');var _0x29b1af={'path':_0xfac206,'channel':'Whatsapp','interactionId':_0x559ff3['id']};return pdf['createPdfFromHTML'](_0x5be947,_0x29b1af);})[_0x4520('0x2f')](function(){return new BPromise(function(_0x13d892,_0x3b0c7a){zipdir(_0x490ec8,{'saveTo':_0x2edd95},function(_0x129f52,_0x7fb324){if(_0x129f52)return _0x3b0c7a(_0x129f52);return _0x13d892(_0x7fb324);});})[_0x4520('0x2f')](function(){return new BPromise(function(_0x347acf,_0x24a450){rimraf(_0x490ec8,function(_0x2096ed){if(_0x2096ed)_0x24a450(_0x2096ed);return _0x347acf();});});})[_0x4520('0x2f')](function(){return _0x942005[_0x4520('0xd2')](_0x2edd95,_0x4d7a3c,function(_0x492714){if(_0x492714){console[_0x4520('0xee')](_0x4520('0xef'),_0x492714);}else{fs[_0x4520('0xf0')](_0x2edd95);}});});});}else{return _0x942005[_0x4520('0x22')](0xc8);}})[_0x4520('0xc3')](handleError(_0x942005,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 8346676..2c8b40d 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 _0xfc73=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc73,0x8d));var _0x3fc7=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xfc73[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require(_0x3fc7('0x0'));var WhatsappInteraction=require(_0x3fc7('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x3fc7('0x1'))['db'][_0x3fc7('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3fc7('0x3')](0x0);var events={'afterCreate':_0x3fc7('0x4'),'afterUpdate':_0x3fc7('0x5'),'afterDestroy':_0x3fc7('0x6')};function emitEvent(_0x429287){return function(_0x8e713,_0x4427df,_0x1039e0){_0x8e713[_0x3fc7('0x7')]({'attributes':['id'],'raw':!![]})[_0x3fc7('0x8')](function(_0x5e41d3){_0x8e713[_0x3fc7('0x9')](_0x3fc7('0xa'),_0x5e41d3[_0x3fc7('0xb')](function(_0x3e2653){return{'id':_0x3e2653['id']};}));return WhatsappMessage[_0x3fc7('0xc')]({'where':{'WhatsappInteractionId':_0x8e713['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5a0444){_0x8e713[_0x3fc7('0x9')](_0x3fc7('0xd'),_0x5a0444[_0x3fc7('0xe')]);WhatsappInteractionEvents[_0x3fc7('0xf')](_0x429287+':'+_0x8e713['id'],_0x8e713);WhatsappInteractionEvents[_0x3fc7('0xf')](_0x429287,_0x8e713);_0x1039e0(null);})[_0x3fc7('0x10')](_0x1039e0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x3fc7('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xcbe1=['update','then','setDataValue','Users','map','findAll','length','emit','catch','hook','../../mysqldb','save'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x2af3e1,_0xb5207f){_0x2af3e1=_0x2af3e1-0x0;var _0xfa27d=_0xcbe1[_0x2af3e1];return _0xfa27d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x1cbe('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cbe('0x1'),'afterUpdate':_0x1cbe('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1ba56c){return function(_0x563162,_0x940654,_0x168121){_0x563162['getUsers']({'attributes':['id'],'raw':!![]})[_0x1cbe('0x3')](function(_0x21342a){_0x563162[_0x1cbe('0x4')](_0x1cbe('0x5'),_0x21342a[_0x1cbe('0x6')](function(_0x3e72a0){return{'id':_0x3e72a0['id']};}));return WhatsappMessage[_0x1cbe('0x7')]({'where':{'WhatsappInteractionId':_0x563162['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cbe('0x3')](function(_0x5af288){_0x563162[_0x1cbe('0x4')]('unreadMessages',_0x5af288[_0x1cbe('0x8')]);WhatsappInteractionEvents[_0x1cbe('0x9')](_0x1ba56c+':'+_0x563162['id'],_0x563162);WhatsappInteractionEvents[_0x1cbe('0x9')](_0x1ba56c,_0x563162);_0x168121(null);})[_0x1cbe('0xa')](_0x168121(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x1cbe('0xb')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2c8d40c..5224bdf 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 _0x09cd=['moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x3cccfb,_0x4eac2d){var _0x16110f=function(_0x40b297){while(--_0x40b297){_0x3cccfb['push'](_0x3cccfb['shift']());}};_0x16110f(++_0x4eac2d);}(_0x09cd,0xcd));var _0xd09c=function(_0x177be9,_0x441b63){_0x177be9=_0x177be9-0x0;var _0x2d415d=_0x09cd[_0x177be9];return _0x2d415d;};'use strict';var _=require(_0xd09c('0x0'));var util=require('util');var logger=require(_0xd09c('0x1'))(_0xd09c('0x2'));var moment=require(_0xd09c('0x3'));var BPromise=require(_0xd09c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd09c('0x5'));var rimraf=require('rimraf');var config=require(_0xd09c('0x6'));var attributes=require(_0xd09c('0x7'));module[_0xd09c('0x8')]=function(_0x503b53,_0x5b011d){return _0x503b53[_0xd09c('0x9')]('WhatsappInteraction',attributes,{'tableName':_0xd09c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a19b4,_0xbfbd94,_0x1baa65){if(_0x5a19b4['changed']('closed')){_0x5a19b4['closedAt']=moment()[_0xd09c('0xb')](_0xd09c('0xc'));}_0x1baa65(null,_0x5a19b4);}}});}; \ No newline at end of file +var _0xa280=['../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0xb7f08,_0x523aa0){var _0x3474f5=function(_0x44d70c){while(--_0x44d70c){_0xb7f08['push'](_0xb7f08['shift']());}};_0x3474f5(++_0x523aa0);}(_0xa280,0x126));var _0x0a28=function(_0x1ca7e0,_0x1de683){_0x1ca7e0=_0x1ca7e0-0x0;var _0x360316=_0xa280[_0x1ca7e0];return _0x360316;};'use strict';var _=require('lodash');var util=require(_0x0a28('0x0'));var logger=require(_0x0a28('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0a28('0x2'));var rp=require(_0x0a28('0x3'));var fs=require('fs');var path=require(_0x0a28('0x4'));var rimraf=require(_0x0a28('0x5'));var config=require(_0x0a28('0x6'));var attributes=require(_0x0a28('0x7'));module[_0x0a28('0x8')]=function(_0x12faad,_0x1dae54){return _0x12faad['define'](_0x0a28('0x9'),attributes,{'tableName':_0x0a28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e6ba7,_0x8c72df,_0x78beaa){if(_0x4e6ba7[_0x0a28('0xb')](_0x0a28('0xc'))){_0x4e6ba7[_0x0a28('0xd')]=moment()[_0x0a28('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x78beaa(null,_0x4e6ba7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e6f8c49..f9eeb46 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 _0x07e3=['AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x07e3,0x189));var _0x307e=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x07e3[_0x4d180c];return _0x49b57e;};'use strict';var _=require(_0x307e('0x0'));var util=require(_0x307e('0x1'));var moment=require(_0x307e('0x2'));var BPromise=require('bluebird');var rs=require(_0x307e('0x3'));var fs=require('fs');var Redis=require(_0x307e('0x4'));var db=require(_0x307e('0x5'))['db'];var utils=require(_0x307e('0x6'));var logger=require('../../config/logger')(_0x307e('0x7'));var config=require(_0x307e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x307e('0x9')][_0x307e('0xa')]({'port':0x232a});config[_0x307e('0xb')]=_[_0x307e('0xc')](config[_0x307e('0xb')],{'host':_0x307e('0xd'),'port':0x18eb});var socket=require(_0x307e('0xe'))(new Redis(config[_0x307e('0xb')]));require(_0x307e('0xf'))[_0x307e('0x10')](socket);function respondWithRpcPromise(_0x2ef929,_0x105135,_0x23934c){return new BPromise(function(_0x2e1ee8,_0xd6507b){return client[_0x307e('0x11')](_0x2ef929,_0x23934c)[_0x307e('0x12')](function(_0x2bdd88){logger[_0x307e('0x13')](_0x307e('0x14'),_0x105135,_0x307e('0x15'));logger[_0x307e('0x16')](_0x307e('0x17'),_0x105135,'request\x20sent',JSON[_0x307e('0x18')](_0x2bdd88));if(_0x2bdd88['error']){if(_0x2bdd88[_0x307e('0x19')]['code']===0x1f4){logger['error'](_0x307e('0x14'),_0x105135,_0x2bdd88[_0x307e('0x19')]['message']);return _0xd6507b(_0x2bdd88[_0x307e('0x19')][_0x307e('0x1a')]);}logger[_0x307e('0x19')](_0x307e('0x14'),_0x105135,_0x2bdd88[_0x307e('0x19')][_0x307e('0x1a')]);return _0x2e1ee8(_0x2bdd88[_0x307e('0x19')]['message']);}else{logger[_0x307e('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x105135,_0x307e('0x15'));_0x2e1ee8(_0x2bdd88[_0x307e('0x1b')][_0x307e('0x1a')]);}})[_0x307e('0x1c')](function(_0x5db476){logger[_0x307e('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x105135,_0x5db476);_0xd6507b(_0x5db476);});});}exports[_0x307e('0x1d')]=function(_0x3b4b42){var _0x537fa3=this;return new Promise(function(_0x552df5,_0x487532){return db[_0x307e('0x1e')][_0x307e('0x1f')](_0x3b4b42[_0x307e('0x20')],{'raw':_0x3b4b42[_0x307e('0x21')]?_0x3b4b42[_0x307e('0x21')][_0x307e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4b42[_0x307e('0x21')]?_0x3b4b42['options'][_0x307e('0x23')]||null:null,'attributes':_0x3b4b42[_0x307e('0x21')]?_0x3b4b42[_0x307e('0x21')][_0x307e('0x24')]||null:null,'limit':_0x3b4b42['options']?_0x3b4b42[_0x307e('0x21')]['limit']||null:null})['then'](function(_0x2f34f1){logger['info'](_0x307e('0x1d'),_0x3b4b42);logger[_0x307e('0x16')](_0x307e('0x1d'),_0x3b4b42,JSON['stringify'](_0x2f34f1));_0x552df5(_0x2f34f1);})[_0x307e('0x1c')](function(_0x547bce){logger[_0x307e('0x19')](_0x307e('0x1d'),_0x547bce[_0x307e('0x1a')],_0x3b4b42);_0x487532(_0x537fa3[_0x307e('0x19')](0x1f4,_0x547bce[_0x307e('0x1a')]));});});};exports[_0x307e('0x25')]=function(_0x586100){return new Promise(function(_0xf5af41,_0x4e5edf){return db['WhatsappInteraction'][_0x307e('0x26')]({'where':_0x586100[_0x307e('0x21')]?_0x586100['options'][_0x307e('0x23')]||null:null})[_0x307e('0x12')](function(_0x237f69){if(_0x237f69){return _0x237f69[_0x307e('0x27')](_0x586100[_0x307e('0x20')]['ids'],_['omit'](_0x586100[_0x307e('0x20')],[_0x307e('0x28'),'id'])||{});}})[_0x307e('0x29')](function(_0x4fa258){logger[_0x307e('0x13')]('AddTags',_0x586100);logger[_0x307e('0x16')](_0x307e('0x2a'),_0x586100,JSON[_0x307e('0x18')](_0x4fa258));_0xf5af41(_0x4fa258);})[_0x307e('0x1c')](function(_0x4be2e2){logger[_0x307e('0x19')]('AddTags',_0x4be2e2[_0x307e('0x1a')],_0x586100);_0x4e5edf(_this[_0x307e('0x19')](0x1f4,_0x4be2e2['message']));});});}; \ No newline at end of file +var _0xcb9b=['http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','omit','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xcb9b,0x11c));var _0xbcb9=function(_0x2d3030,_0x2daea2){_0x2d3030=_0x2d3030-0x0;var _0x247c7e=_0xcb9b[_0x2d3030];return _0x247c7e;};'use strict';var _=require(_0xbcb9('0x0'));var util=require('util');var moment=require(_0xbcb9('0x1'));var BPromise=require(_0xbcb9('0x2'));var rs=require(_0xbcb9('0x3'));var fs=require('fs');var Redis=require(_0xbcb9('0x4'));var db=require(_0xbcb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcb9('0x6'))(_0xbcb9('0x7'));var config=require(_0xbcb9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbcb9('0x9')][_0xbcb9('0xa')]({'port':0x232a});config[_0xbcb9('0xb')]=_[_0xbcb9('0xc')](config[_0xbcb9('0xb')],{'host':_0xbcb9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbcb9('0xb')]));require(_0xbcb9('0xe'))[_0xbcb9('0xf')](socket);function respondWithRpcPromise(_0x5da8c1,_0x362c4c,_0x510015){return new BPromise(function(_0x5f15de,_0x517e9c){return client[_0xbcb9('0x10')](_0x5da8c1,_0x510015)[_0xbcb9('0x11')](function(_0x270c5c){logger[_0xbcb9('0x12')](_0xbcb9('0x13'),_0x362c4c,'request\x20sent');logger[_0xbcb9('0x14')](_0xbcb9('0x15'),_0x362c4c,_0xbcb9('0x16'),JSON[_0xbcb9('0x17')](_0x270c5c));if(_0x270c5c[_0xbcb9('0x18')]){if(_0x270c5c['error'][_0xbcb9('0x19')]===0x1f4){logger[_0xbcb9('0x18')](_0xbcb9('0x13'),_0x362c4c,_0x270c5c[_0xbcb9('0x18')][_0xbcb9('0x1a')]);return _0x517e9c(_0x270c5c[_0xbcb9('0x18')][_0xbcb9('0x1a')]);}logger[_0xbcb9('0x18')](_0xbcb9('0x13'),_0x362c4c,_0x270c5c[_0xbcb9('0x18')][_0xbcb9('0x1a')]);return _0x5f15de(_0x270c5c[_0xbcb9('0x18')][_0xbcb9('0x1a')]);}else{logger['info'](_0xbcb9('0x13'),_0x362c4c,'request\x20sent');_0x5f15de(_0x270c5c[_0xbcb9('0x1b')][_0xbcb9('0x1a')]);}})[_0xbcb9('0x1c')](function(_0x4ec398){logger['error'](_0xbcb9('0x13'),_0x362c4c,_0x4ec398);_0x517e9c(_0x4ec398);});});}exports[_0xbcb9('0x1d')]=function(_0x8571b){var _0x3fc4e0=this;return new Promise(function(_0x10f27d,_0x4a8ecd){return db[_0xbcb9('0x1e')]['update'](_0x8571b[_0xbcb9('0x1f')],{'raw':_0x8571b[_0xbcb9('0x20')]?_0x8571b[_0xbcb9('0x20')][_0xbcb9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8571b[_0xbcb9('0x20')]?_0x8571b[_0xbcb9('0x20')][_0xbcb9('0x22')]||null:null,'attributes':_0x8571b[_0xbcb9('0x20')]?_0x8571b[_0xbcb9('0x20')][_0xbcb9('0x23')]||null:null,'limit':_0x8571b[_0xbcb9('0x20')]?_0x8571b['options'][_0xbcb9('0x24')]||null:null})['then'](function(_0x336c0e){logger[_0xbcb9('0x12')](_0xbcb9('0x1d'),_0x8571b);logger['debug'](_0xbcb9('0x1d'),_0x8571b,JSON[_0xbcb9('0x17')](_0x336c0e));_0x10f27d(_0x336c0e);})[_0xbcb9('0x1c')](function(_0x570e52){logger[_0xbcb9('0x18')](_0xbcb9('0x1d'),_0x570e52[_0xbcb9('0x1a')],_0x8571b);_0x4a8ecd(_0x3fc4e0[_0xbcb9('0x18')](0x1f4,_0x570e52[_0xbcb9('0x1a')]));});});};exports[_0xbcb9('0x25')]=function(_0x46373f){return new Promise(function(_0x941641,_0x53bf00){return db[_0xbcb9('0x1e')][_0xbcb9('0x26')]({'where':_0x46373f[_0xbcb9('0x20')]?_0x46373f[_0xbcb9('0x20')]['where']||null:null})['then'](function(_0x161841){if(_0x161841){return _0x161841['addTags'](_0x46373f['body']['ids'],_[_0xbcb9('0x27')](_0x46373f[_0xbcb9('0x1f')],[_0xbcb9('0x28'),'id'])||{});}})['spread'](function(_0x5ca62d){logger[_0xbcb9('0x12')]('AddTags',_0x46373f);logger[_0xbcb9('0x14')](_0xbcb9('0x29'),_0x46373f,JSON[_0xbcb9('0x17')](_0x5ca62d));_0x941641(_0x5ca62d);})[_0xbcb9('0x1c')](function(_0x96a6ed){logger[_0xbcb9('0x18')](_0xbcb9('0x29'),_0x96a6ed[_0xbcb9('0x1a')],_0x46373f);_0x53bf00(_this[_0xbcb9('0x18')](0x1f4,_0x96a6ed[_0xbcb9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 958ba1d..bf0ca73 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 _0xf5ae=['save','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xf5ae,0x179));var _0xef5a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf5ae[_0x59ee6f];return _0x4c0979;};'use strict';var WhatsappInteractionEvents=require(_0xef5a('0x0'));var events=[_0xef5a('0x1'),'remove','update'];function createListener(_0x1ea19a,_0x326a77){return function(_0x3b56cb){_0x326a77[_0xef5a('0x2')](_0x1ea19a,_0x3b56cb);};}function removeListener(_0x3b7e90,_0x5112c8){return function(){WhatsappInteractionEvents[_0xef5a('0x3')](_0x3b7e90,_0x5112c8);};}exports[_0xef5a('0x4')]=function(_0x8c420){for(var _0x5472fc=0x0,_0x6ea091=events['length'];_0x5472fc<_0x6ea091;_0x5472fc++){var _0x67b20b=events[_0x5472fc];var _0x56dda2=createListener(_0xef5a('0x5')+_0x67b20b,_0x8c420);WhatsappInteractionEvents['on'](_0x67b20b,_0x56dda2);}}; \ No newline at end of file +var _0x7ad7=['register','length','whatsappInteraction:','remove','update','emit','removeListener'];(function(_0x552804,_0x3c3d1e){var _0x32be66=function(_0x14c213){while(--_0x14c213){_0x552804['push'](_0x552804['shift']());}};_0x32be66(++_0x3c3d1e);}(_0x7ad7,0x184));var _0x77ad=function(_0x2cdd25,_0x25b185){_0x2cdd25=_0x2cdd25-0x0;var _0x1f38c3=_0x7ad7[_0x2cdd25];return _0x1f38c3;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x77ad('0x0'),_0x77ad('0x1')];function createListener(_0x4a255c,_0x4babc9){return function(_0x503899){_0x4babc9[_0x77ad('0x2')](_0x4a255c,_0x503899);};}function removeListener(_0x56f034,_0x5d1362){return function(){WhatsappInteractionEvents[_0x77ad('0x3')](_0x56f034,_0x5d1362);};}exports[_0x77ad('0x4')]=function(_0x2ad013){for(var _0x15f539=0x0,_0x231c83=events[_0x77ad('0x5')];_0x15f539<_0x231c83;_0x15f539++){var _0x1c0ce7=events[_0x15f539];var _0x31fbc5=createListener(_0x77ad('0x6')+_0x1c0ce7,_0x2ad013);WhatsappInteractionEvents['on'](_0x1c0ce7,_0x31fbc5);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 46377e0..acd4f61 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 _0x35d0=['./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x35d0,0x1c6));var _0x035d=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x35d0[_0xabfec4];return _0x7bafa2;};'use strict';var multer=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var path=require(_0x035d('0x2'));var timeout=require(_0x035d('0x3'));var express=require(_0x035d('0x4'));var router=express[_0x035d('0x5')]();var fs_extra=require(_0x035d('0x6'));var auth=require(_0x035d('0x7'));var interaction=require(_0x035d('0x8'));var config=require(_0x035d('0x9'));var controller=require(_0x035d('0xa'));router['get']('/',auth[_0x035d('0xb')](),controller[_0x035d('0xc')]);router[_0x035d('0xd')]('/describe',auth[_0x035d('0xb')](),controller[_0x035d('0xe')]);router[_0x035d('0xd')](_0x035d('0xf'),auth[_0x035d('0xb')](),controller[_0x035d('0x10')]);router['post']('/',auth[_0x035d('0xb')](),interaction[_0x035d('0x11')](_0x035d('0x12'),_0x035d('0x13')),controller[_0x035d('0x14')]);router['post'](_0x035d('0x15'),controller['status']);router['put'](_0x035d('0xf'),auth[_0x035d('0xb')](),controller['update']);router[_0x035d('0x16')](_0x035d('0x17'),auth['isAuthenticated'](),controller['accept']);router[_0x035d('0x16')](_0x035d('0x18'),auth[_0x035d('0xb')](),controller[_0x035d('0x19')]);router[_0x035d('0x1a')]('/:id',auth[_0x035d('0xb')](),controller[_0x035d('0x1b')]);module[_0x035d('0x1c')]=router; \ No newline at end of file +var _0x45f6=['/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','Router','fs-extra','get','index','/describe','isAuthenticated','describe','/:id','show','whatsapp','whatsappmessage:create','create','/:id/status','update','put'];(function(_0x4fc797,_0x30d6c6){var _0x24f9df=function(_0x40a9e1){while(--_0x40a9e1){_0x4fc797['push'](_0x4fc797['shift']());}};_0x24f9df(++_0x30d6c6);}(_0x45f6,0x10c));var _0x645f=function(_0x152999,_0x1dd83b){_0x152999=_0x152999-0x0;var _0x32ef67=_0x45f6[_0x152999];return _0x32ef67;};'use strict';var multer=require(_0x645f('0x0'));var util=require(_0x645f('0x1'));var path=require(_0x645f('0x2'));var timeout=require(_0x645f('0x3'));var express=require(_0x645f('0x4'));var router=express[_0x645f('0x5')]();var fs_extra=require(_0x645f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x645f('0x7')]('/',auth['isAuthenticated'](),controller[_0x645f('0x8')]);router[_0x645f('0x7')](_0x645f('0x9'),auth[_0x645f('0xa')](),controller[_0x645f('0xb')]);router['get'](_0x645f('0xc'),auth[_0x645f('0xa')](),controller[_0x645f('0xd')]);router['post']('/',auth[_0x645f('0xa')](),interaction['tracked'](_0x645f('0xe'),_0x645f('0xf')),controller[_0x645f('0x10')]);router['post'](_0x645f('0x11'),controller['status']);router['put'](_0x645f('0xc'),auth['isAuthenticated'](),controller[_0x645f('0x12')]);router[_0x645f('0x13')](_0x645f('0x14'),auth[_0x645f('0xa')](),controller[_0x645f('0x15')]);router['put'](_0x645f('0x16'),auth['isAuthenticated'](),controller[_0x645f('0x17')]);router['delete'](_0x645f('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 697d01b..cc72d83 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 _0x3e2a=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x565d0a,_0x4927cc){var _0x24c211=function(_0x18ae2b){while(--_0x18ae2b){_0x565d0a['push'](_0x565d0a['shift']());}};_0x24c211(++_0x4927cc);}(_0x3e2a,0xa0));var _0xa3e2=function(_0x2bc37e,_0x15afa3){_0x2bc37e=_0x2bc37e-0x0;var _0x32795b=_0x3e2a[_0x2bc37e];return _0x32795b;};'use strict';var Sequelize=require('sequelize');module[_0xa3e2('0x0')]={'body':{'type':Sequelize[_0xa3e2('0x1')](_0xa3e2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa3e2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa3e2('0x4')]('in',_0xa3e2('0x5')),'defaultValue':_0xa3e2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa3e2('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa3e2('0x7')]},'secret':{'type':Sequelize[_0xa3e2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa3e2('0x6')]},'providerResponse':{'type':Sequelize[_0xa3e2('0x1')]}}; \ No newline at end of file +var _0x81bb=['BOOLEAN','sequelize','TEXT','ENUM','STRING'];(function(_0x2236dc,_0x43c7f9){var _0x20583f=function(_0x293e36){while(--_0x293e36){_0x2236dc['push'](_0x2236dc['shift']());}};_0x20583f(++_0x43c7f9);}(_0x81bb,0x74));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb81b('0x0'));module['exports']={'body':{'type':Sequelize[_0xb81b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb81b('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xb81b('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xb81b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb81b('0x3')]},'providerResponse':{'type':Sequelize[_0xb81b('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ade59bd..89233bd 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 _0xfbab=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','Content-Range','apply','reject','save','destroy','sendStatus','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','rows','create','body','update','find','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','agent','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','Sequelize','SELECT','fullname','internal','event','rejectmessage','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse'];(function(_0x13b735,_0x321543){var _0x2387f3=function(_0x66bc48){while(--_0x66bc48){_0x13b735['push'](_0x13b735['shift']());}};_0x2387f3(++_0x321543);}(_0xfbab,0x101));var _0xbfba=function(_0x17672f,_0x428ccb){_0x17672f=_0x17672f-0x0;var _0x20b4a6=_0xfbab[_0x17672f];return _0x20b4a6;};'use strict';var emlformat=require(_0xbfba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfba('0x1'));var jsonpatch=require(_0xbfba('0x2'));var rp=require(_0xbfba('0x3'));var moment=require(_0xbfba('0x4'));var BPromise=require(_0xbfba('0x5'));var Mustache=require(_0xbfba('0x6'));var util=require(_0xbfba('0x7'));var path=require('path');var sox=require(_0xbfba('0x8'));var csv=require(_0xbfba('0x9'));var ejs=require(_0xbfba('0xa'));var fs=require('fs');var fs_extra=require(_0xbfba('0xb'));var _=require('lodash');var squel=require(_0xbfba('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbfba('0xd'));var toCsv=require(_0xbfba('0x9'));var querystring=require('querystring');var Papa=require(_0xbfba('0xe'));var Redis=require(_0xbfba('0xf'));var authService=require(_0xbfba('0x10'));var qs=require(_0xbfba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfba('0x12'));var logger=require(_0xbfba('0x13'))(_0xbfba('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbfba('0x15'));var db=require('../../mysqldb')['db'];config[_0xbfba('0x16')]=_[_0xbfba('0x17')](config[_0xbfba('0x16')],{'host':_0xbfba('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfba('0x16')]));require(_0xbfba('0x19'))[_0xbfba('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbfba('0x1b')][_0xbfba('0x1c')]({'port':0x232c});var client9002=jayson[_0xbfba('0x1b')][_0xbfba('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x52ac0c,_0x2ff195,_0xc7e367,_0x5edffd){return new BPromise(function(_0x3c95b9,_0x22b40a){var _0x316e88=_0x5edffd||client;return _0x316e88[_0xbfba('0x1d')](_0x52ac0c,_0xc7e367)[_0xbfba('0x1e')](function(_0x275e04){logger[_0xbfba('0x1f')](_0xbfba('0x20'),_0x2ff195,'request\x20sent');logger[_0xbfba('0x21')](_0xbfba('0x22'),_0x2ff195,_0xbfba('0x23'),JSON[_0xbfba('0x24')](_0x275e04));if(_0x275e04[_0xbfba('0x25')]){if(_0x275e04[_0xbfba('0x25')][_0xbfba('0x26')]===0x1f4){logger[_0xbfba('0x25')](_0xbfba('0x20'),_0x2ff195,_0x275e04[_0xbfba('0x25')][_0xbfba('0x27')]);return _0x22b40a(_0x275e04['error'][_0xbfba('0x27')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2ff195,_0x275e04[_0xbfba('0x25')][_0xbfba('0x27')]);return _0x3c95b9(_0x275e04[_0xbfba('0x25')][_0xbfba('0x27')]);}else{logger[_0xbfba('0x1f')](_0xbfba('0x20'),_0x2ff195,'request\x20sent');_0x3c95b9(_0x275e04[_0xbfba('0x28')][_0xbfba('0x27')]);}})[_0xbfba('0x29')](function(_0x110ec5){logger[_0xbfba('0x25')](_0xbfba('0x20'),_0x2ff195,_0x110ec5);_0x22b40a(_0x110ec5);});});}function respondWithStatusCode(_0x6a673b,_0xd58a64){_0xd58a64=_0xd58a64||0xcc;return function(_0x24950f){if(_0x24950f){return _0x6a673b['sendStatus'](_0xd58a64);}return _0x6a673b[_0xbfba('0x2a')](_0xd58a64)[_0xbfba('0x2b')]();};}function respondWithResult(_0x377b1d,_0x4245b0){_0x4245b0=_0x4245b0||0xc8;return function(_0x3d8274){if(_0x3d8274){return _0x377b1d['status'](_0x4245b0)[_0xbfba('0x2c')](_0x3d8274);}};}function respondWithFilteredResult(_0x461e6e,_0x4f08c9){return function(_0x2176c4){if(_0x2176c4){var _0x2568ce=typeof _0x4f08c9[_0xbfba('0x2d')]==='undefined'&&typeof _0x4f08c9[_0xbfba('0x2e')]==='undefined';var _0x184321=_0x2176c4[_0xbfba('0x2f')];var _0x23148a=_0x2568ce?0x0:_0x4f08c9['offset'];var _0x171c42=_0x2568ce?_0x2176c4[_0xbfba('0x2f')]:_0x4f08c9[_0xbfba('0x2d')]+_0x4f08c9[_0xbfba('0x2e')];var _0x1340c8;if(_0x171c42>=_0x184321){_0x171c42=_0x184321;_0x1340c8=0xc8;}else{_0x1340c8=0xce;}_0x461e6e[_0xbfba('0x2a')](_0x1340c8);return _0x461e6e['set'](_0xbfba('0x30'),_0x23148a+'-'+_0x171c42+'/'+_0x184321)['json'](_0x2176c4);}return null;};}function patchUpdates(_0x3b12c3){return function(_0x30bfe9){try{jsonpatch[_0xbfba('0x31')](_0x30bfe9,_0x3b12c3,!![]);}catch(_0x23fd97){return BPromise[_0xbfba('0x32')](_0x23fd97);}return _0x30bfe9[_0xbfba('0x33')]();};}function saveUpdates(_0x1b98b6,_0x343e8e){return function(_0x33098e){if(_0x33098e){return _0x33098e['update'](_0x1b98b6)['then'](function(_0xe32981){return _0xe32981;});}return null;};}function removeEntity(_0x4a5fe7,_0x37ef3d){return function(_0x65b453){if(_0x65b453){return _0x65b453[_0xbfba('0x34')]()[_0xbfba('0x1e')](function(){_0x4a5fe7[_0xbfba('0x2a')](0xcc)[_0xbfba('0x2b')]();});}};}function handleEntityNotFound(_0x228230,_0x1fb627){return function(_0x21ba4d){if(!_0x21ba4d){_0x228230[_0xbfba('0x35')](0x194);}return _0x21ba4d;};}function handleError(_0x308245,_0x3177e8){_0x3177e8=_0x3177e8||0x1f4;return function(_0x13e902){logger[_0xbfba('0x25')](_0x13e902['stack']);if(_0x13e902[_0xbfba('0x36')]){delete _0x13e902[_0xbfba('0x36')];}_0x308245[_0xbfba('0x2a')](_0x3177e8)[_0xbfba('0x37')](_0x13e902);};}exports[_0xbfba('0x38')]=function(_0x5cd8a3,_0x1d4e83){var _0x363934={},_0x39172c={},_0x52c89a={'count':0x0,'rows':[]};var _0x176a6d=_[_0xbfba('0x39')](db[_0xbfba('0x3a')][_0xbfba('0x3b')],function(_0x4f8e2c){return{'name':_0x4f8e2c[_0xbfba('0x3c')],'type':_0x4f8e2c['type'][_0xbfba('0x3d')]};});_0x39172c[_0xbfba('0x3e')]=_[_0xbfba('0x39')](_0x176a6d,_0xbfba('0x36'));_0x39172c[_0xbfba('0x3f')]=_[_0xbfba('0x40')](_0x5cd8a3[_0xbfba('0x3f')]);_0x39172c[_0xbfba('0x41')]=_['intersection'](_0x39172c[_0xbfba('0x3e')],_0x39172c[_0xbfba('0x3f')]);_0x363934[_0xbfba('0x42')]=_[_0xbfba('0x43')](_0x39172c[_0xbfba('0x3e')],qs[_0xbfba('0x44')](_0x5cd8a3[_0xbfba('0x3f')][_0xbfba('0x44')]));_0x363934['attributes']=_0x363934[_0xbfba('0x42')][_0xbfba('0x45')]?_0x363934[_0xbfba('0x42')]:_0x39172c[_0xbfba('0x3e')];if(!_0x5cd8a3['query'][_0xbfba('0x46')]('nolimit')){_0x363934['limit']=qs[_0xbfba('0x2e')](_0x5cd8a3[_0xbfba('0x3f')]['limit']);_0x363934[_0xbfba('0x2d')]=qs[_0xbfba('0x2d')](_0x5cd8a3[_0xbfba('0x3f')]['offset']);}_0x363934[_0xbfba('0x47')]=qs[_0xbfba('0x48')](_0x5cd8a3['query'][_0xbfba('0x48')]);_0x363934[_0xbfba('0x49')]=qs[_0xbfba('0x41')](_[_0xbfba('0x4a')](_0x5cd8a3['query'],_0x39172c['filters']),_0x176a6d);if(_0x5cd8a3['query']['filter']){_0x363934['where']=_[_0xbfba('0x4b')](_0x363934[_0xbfba('0x49')],{'$or':_[_0xbfba('0x39')](_0x176a6d,function(_0x4144a3){if(_0x4144a3[_0xbfba('0x4c')]!=='VIRTUAL'){var _0x2a4049={};_0x2a4049[_0x4144a3[_0xbfba('0x36')]]={'$like':'%'+_0x5cd8a3['query'][_0xbfba('0x4d')]+'%'};return _0x2a4049;}})});}_0x363934=_[_0xbfba('0x4b')]({},_0x363934,_0x5cd8a3[_0xbfba('0x4e')]);var _0x1a2610={'where':_0x363934[_0xbfba('0x49')]};return db['WhatsappMessage']['count'](_0x1a2610)[_0xbfba('0x1e')](function(_0x33cf45){_0x52c89a[_0xbfba('0x2f')]=_0x33cf45;if(_0x5cd8a3['query']['includeAll']){_0x363934[_0xbfba('0x4f')]=[{'all':!![]}];}return db[_0xbfba('0x3a')]['findAll'](_0x363934);})['then'](function(_0x5d09cc){_0x52c89a[_0xbfba('0x50')]=_0x5d09cc;return _0x52c89a;})[_0xbfba('0x1e')](respondWithFilteredResult(_0x1d4e83,_0x363934))[_0xbfba('0x29')](handleError(_0x1d4e83,null));};exports['show']=function(_0x408fd1,_0x33616a){var _0x5386a2={'raw':!![],'where':{'id':_0x408fd1['params']['id']}},_0x51fac4={};_0x51fac4[_0xbfba('0x3e')]=_[_0xbfba('0x40')](db[_0xbfba('0x3a')][_0xbfba('0x3b')]);_0x51fac4[_0xbfba('0x3f')]=_['keys'](_0x408fd1[_0xbfba('0x3f')]);_0x51fac4['filters']=_[_0xbfba('0x43')](_0x51fac4[_0xbfba('0x3e')],_0x51fac4[_0xbfba('0x3f')]);_0x5386a2[_0xbfba('0x42')]=_[_0xbfba('0x43')](_0x51fac4[_0xbfba('0x3e')],qs['fields'](_0x408fd1['query'][_0xbfba('0x44')]));_0x5386a2[_0xbfba('0x42')]=_0x5386a2[_0xbfba('0x42')][_0xbfba('0x45')]?_0x5386a2[_0xbfba('0x42')]:_0x51fac4[_0xbfba('0x3e')];if(_0x408fd1['query']['includeAll']){_0x5386a2[_0xbfba('0x4f')]=[{'all':!![]}];}_0x5386a2=_['merge']({},_0x5386a2,_0x408fd1[_0xbfba('0x4e')]);return db['WhatsappMessage']['find'](_0x5386a2)[_0xbfba('0x1e')](handleEntityNotFound(_0x33616a,null))[_0xbfba('0x1e')](respondWithResult(_0x33616a,null))[_0xbfba('0x29')](handleError(_0x33616a,null));};exports[_0xbfba('0x51')]=function(_0x5d2622,_0x3d4485){return db['WhatsappMessage'][_0xbfba('0x51')](_0x5d2622[_0xbfba('0x52')],{})[_0xbfba('0x1e')](respondWithResult(_0x3d4485,0xc9))[_0xbfba('0x29')](handleError(_0x3d4485,null));};exports[_0xbfba('0x53')]=function(_0x13da94,_0x532ae4){if(_0x13da94[_0xbfba('0x52')]['id']){delete _0x13da94[_0xbfba('0x52')]['id'];}return db[_0xbfba('0x3a')][_0xbfba('0x54')]({'where':{'id':_0x13da94[_0xbfba('0x55')]['id']}})[_0xbfba('0x1e')](handleEntityNotFound(_0x532ae4,null))[_0xbfba('0x1e')](saveUpdates(_0x13da94['body'],null))[_0xbfba('0x1e')](respondWithResult(_0x532ae4,null))[_0xbfba('0x29')](handleError(_0x532ae4,null));};exports[_0xbfba('0x34')]=function(_0x52d253,_0x52b5df){return db['WhatsappMessage'][_0xbfba('0x54')]({'where':{'id':_0x52d253[_0xbfba('0x55')]['id']}})['then'](handleEntityNotFound(_0x52b5df,null))['then'](removeEntity(_0x52b5df,null))[_0xbfba('0x29')](handleError(_0x52b5df,null));};exports[_0xbfba('0x56')]=function(_0x48645d,_0x2f0173){return db['WhatsappMessage'][_0xbfba('0x56')]()[_0xbfba('0x1e')](respondWithResult(_0x2f0173,null))[_0xbfba('0x29')](handleError(_0x2f0173,null));};var interaction_log=require(_0xbfba('0x13'))(_0xbfba('0x57'));exports[_0xbfba('0x58')]=function(_0x9145ef,_0x16719f,_0x5542b5){var _0x31bef={'agent':{},'channel':_0xbfba('0x59')};if(_0x9145ef[_0xbfba('0x52')]['id']){delete _0x9145ef['body']['id'];}_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5a')]=!![];_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5b')]=moment()['format'](_0xbfba('0x5c'));_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')]=_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')]||_0x9145ef[_0xbfba('0x5e')]['id'];_0x31bef['agent']['id']=_0x9145ef[_0xbfba('0x52')]['UserId'];return db[_0xbfba('0x3a')][_0xbfba('0x54')]({'where':{'id':_0x9145ef[_0xbfba('0x55')]['id'],'UserId':null}})[_0xbfba('0x1e')](handleEntityNotFound(_0x16719f,null))[_0xbfba('0x1e')](saveUpdates(_0x9145ef[_0xbfba('0x52')],null))[_0xbfba('0x1e')](function(_0x5e0b51){if(_0x5e0b51){_0x31bef[_0xbfba('0x27')]=_0x5e0b51[_0xbfba('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xbfba('0x54')]({'where':{'id':_0x5e0b51[_0xbfba('0x60')]}});}return null;})[_0xbfba('0x1e')](handleEntityNotFound(_0x16719f,null))['then'](function(_0x1d74c1){if(_0x1d74c1){return _0x1d74c1[_0xbfba('0x53')]({'UserId':_0x9145ef[_0xbfba('0x52')]['UserId'],'read1stAt':_[_0xbfba('0x61')](_0x1d74c1[_0xbfba('0x62')])?moment()[_0xbfba('0x63')](_0xbfba('0x5c')):undefined});}return null;})[_0xbfba('0x1e')](function(_0x5504ca){if(_0x5504ca){_0x31bef['interaction']=_0x5504ca[_0xbfba('0x5f')]({'plain':!![]});interaction_log[_0xbfba('0x1f')](_0xbfba('0x64'),_0x9145ef[_0xbfba('0x5e')]['id'],_0x9145ef[_0xbfba('0x5e')][_0xbfba('0x36')],_0x9145ef['user']['role'],_0x31bef[_0xbfba('0x65')]['id'],_0x9145ef['body']?JSON[_0xbfba('0x24')](_0x9145ef['body']):_0xbfba('0x66'));return respondWithRpcPromise(_0xbfba('0x67'),_0xbfba('0x68'),_0x31bef);}return null;})[_0xbfba('0x1e')](function(_0x1f6e88){var _0x3f74f9=_0xbfba('0x69')+_0x1f6e88[_0xbfba('0x27')]['ContactId'];return db[_0xbfba('0x6a')]['query'](_0x3f74f9,{'type':db['Sequelize'][_0xbfba('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x455177){return _0x455177;});})[_0xbfba('0x1e')](function(_0x5bca2c){if(_0x5bca2c){_0x31bef['message'][_0xbfba('0x6c')]=_0x5bca2c[0x0];if(!_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')])return;return db[_0xbfba('0x6d')][_0xbfba('0x54')]({'where':{'id':_0x9145ef[_0xbfba('0x52')][_0xbfba('0x5d')],'role':_0xbfba('0x6e')},'attributes':['id',_0xbfba('0x36'),'fullname',_0xbfba('0x6f'),'internal'],'raw':!![]});}return null;})[_0xbfba('0x1e')](function(_0x44c792){if(!_0x44c792)return null;_0x31bef[_0xbfba('0x27')][_0xbfba('0x6e')]=_0x44c792;return _0x31bef;})[_0xbfba('0x1e')](function(_0x897e37){if(_0x897e37){if(_0x9145ef[_0xbfba('0x52')][_0xbfba('0x70')]){_0x31bef[_0xbfba('0x27')][_0xbfba('0x71')]=util[_0xbfba('0x63')](_0xbfba('0x72'),_0x9145ef['user'][_0xbfba('0x36')]);_0x31bef['message'][_0xbfba('0x73')]=_0x31bef[_0xbfba('0x73')];_0x31bef[_0xbfba('0x27')][_0xbfba('0x74')]=_0x31bef[_0xbfba('0x73')];_0x31bef[_0xbfba('0x27')]['event']='accept';return respondWithRpcPromise(_0xbfba('0x75'),_0xbfba('0x75'),{'event':_0xbfba('0x76'),'message':_0x31bef[_0xbfba('0x27')]},client9002)[_0xbfba('0x1e')](function(){return _0x31bef;});}return _0x31bef;}return null;})[_0xbfba('0x1e')](respondWithResult(_0x16719f,null))['catch'](handleError(_0x16719f,null));};var interaction_log=require('../../config/logger')(_0xbfba('0x57'));exports[_0xbfba('0x32')]=function(_0x4dcced,_0x222f40,_0x2128af){var _0x2d3c0a={'agent':{},'channel':_0xbfba('0x59')};if(_0x4dcced[_0xbfba('0x52')]['id']){delete _0x4dcced[_0xbfba('0x52')]['id'];}_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')]=_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')]||_0x4dcced[_0xbfba('0x5e')]['id'];_0x2d3c0a[_0xbfba('0x6e')]['id']=_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')];return db['WhatsappMessage'][_0xbfba('0x54')]({'where':{'id':_0x4dcced['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x222f40,null))['then'](function(_0xad75ab){if(_0xad75ab){_0x2d3c0a[_0xbfba('0x27')]=_0xad75ab[_0xbfba('0x5f')]({'plain':!![]});return db[_0xbfba('0x77')][_0xbfba('0x54')]({'where':{'id':_0xad75ab['WhatsappInteractionId']}});}return null;})[_0xbfba('0x1e')](handleEntityNotFound(_0x222f40,null))[_0xbfba('0x1e')](function(_0x4bf97d){if(_0x4bf97d){_0x2d3c0a['interaction']=_0x4bf97d['get']({'plain':!![]});interaction_log[_0xbfba('0x1f')](_0xbfba('0x78'),_0x4dcced[_0xbfba('0x5e')]['id'],_0x4dcced[_0xbfba('0x5e')][_0xbfba('0x36')],_0x4dcced[_0xbfba('0x5e')][_0xbfba('0x79')],_0x2d3c0a[_0xbfba('0x65')]['id'],_0x4dcced['body']?JSON[_0xbfba('0x24')](_0x4dcced[_0xbfba('0x52')]):_0xbfba('0x66'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2d3c0a);}return null;})['then'](function(_0x340070){var _0x2d29eb=_0xbfba('0x69')+_0x340070[_0xbfba('0x27')][_0xbfba('0x7a')];return db[_0xbfba('0x6a')][_0xbfba('0x3f')](_0x2d29eb,{'type':db[_0xbfba('0x7b')]['QueryTypes'][_0xbfba('0x7c')],'raw':!![]})[_0xbfba('0x1e')](function(_0x19e1ee){return _0x19e1ee;});})[_0xbfba('0x1e')](function(_0x472593){if(_0x472593){_0x2d3c0a['message'][_0xbfba('0x6c')]=_0x472593[0x0];if(!_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')])return;return db[_0xbfba('0x6d')][_0xbfba('0x54')]({'where':{'id':_0x4dcced[_0xbfba('0x52')][_0xbfba('0x5d')],'role':_0xbfba('0x6e')},'attributes':['id',_0xbfba('0x36'),_0xbfba('0x7d'),'email',_0xbfba('0x7e')],'raw':!![]});}return null;})[_0xbfba('0x1e')](function(_0x32240b){if(!_0x32240b)return null;_0x2d3c0a['message'][_0xbfba('0x6e')]=_0x32240b;return _0x2d3c0a;})[_0xbfba('0x1e')](function(_0x2c97e3){if(_0x2c97e3){_0x2c97e3[_0xbfba('0x27')]['interface']=util[_0xbfba('0x63')](_0xbfba('0x72'),_0x4dcced['user'][_0xbfba('0x36')]);_0x2c97e3[_0xbfba('0x27')][_0xbfba('0x73')]=_0x2d3c0a[_0xbfba('0x73')];_0x2c97e3['message'][_0xbfba('0x74')]=_0x2d3c0a[_0xbfba('0x73')];_0x2c97e3[_0xbfba('0x27')][_0xbfba('0x7f')]='reject';respondWithRpcPromise(_0xbfba('0x75'),_0xbfba('0x75'),{'event':_0xbfba('0x80'),'message':_0x2c97e3[_0xbfba('0x27')]},client9002);return _0x2d3c0a;}return null;})['then'](respondWithResult(_0x222f40,null))[_0xbfba('0x29')](handleError(_0x222f40,null));};exports[_0xbfba('0x2a')]=function(_0x224f8d,_0x89358b,_0x55264b){if(_0x224f8d[_0xbfba('0x52')]['id']){delete _0x224f8d['body']['id'];}var _0x167868;return db['WhatsappMessage'][_0xbfba('0x54')]({'where':{'id':_0x224f8d[_0xbfba('0x55')]['id']}})['then'](handleEntityNotFound(_0x89358b,null))[_0xbfba('0x1e')](function(_0x5c6622){if(_0x5c6622){_0x167868=_0x5c6622;return db[_0xbfba('0x81')][_0xbfba('0x54')]({'where':{'id':_0x5c6622[_0xbfba('0x82')]}});}})['then'](handleEntityNotFound(_0x89358b,null))[_0xbfba('0x1e')](function(_0x3ee7bf){if(_0x3ee7bf){logger[_0xbfba('0x21')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xbfba('0x2a'),'received\x20delivery\x20report\x20from',_0x3ee7bf['type'],util[_0xbfba('0x83')](_0x224f8d['body'],{'showHidden':![],'depth':null}));switch(_0x3ee7bf['type']){case _0xbfba('0x84'):if(_0x224f8d[_0xbfba('0x52')][_0xbfba('0x85')]&&_0x224f8d[_0xbfba('0x52')][_0xbfba('0x85')]===_0x167868[_0xbfba('0x86')]&&_0x224f8d[_0xbfba('0x52')]['MessageStatus']&&_0x224f8d[_0xbfba('0x52')][_0xbfba('0x87')]==='read'){return _0x167868[_0xbfba('0x53')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xbfba('0x2a'),_0xbfba('0x84'),util[_0xbfba('0x83')](_0x224f8d[_0xbfba('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x167868;}})[_0xbfba('0x1e')](respondWithResult(_0x89358b,null))[_0xbfba('0x29')](handleError(_0x89358b,null));}; \ No newline at end of file +var _0x51fe=['twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','update','stack','send','index','map','WhatsappMessage','fieldName','type','key','model','filters','intersection','attributes','fields','length','hasOwnProperty','query','order','sort','where','filter','name','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE: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','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','EventManager','acceptmessage','interface','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect'];(function(_0x1f88c5,_0x446d22){var _0x4552e8=function(_0xa09d8b){while(--_0xa09d8b){_0x1f88c5['push'](_0x1f88c5['shift']());}};_0x4552e8(++_0x446d22);}(_0x51fe,0x19a));var _0xe51f=function(_0x356660,_0x4c85a4){_0x356660=_0x356660-0x0;var _0x5d9860=_0x51fe[_0x356660];return _0x5d9860;};'use strict';var emlformat=require(_0xe51f('0x0'));var rimraf=require(_0xe51f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe51f('0x2'));var moment=require('moment');var BPromise=require(_0xe51f('0x3'));var Mustache=require(_0xe51f('0x4'));var util=require(_0xe51f('0x5'));var path=require(_0xe51f('0x6'));var sox=require(_0xe51f('0x7'));var csv=require('to-csv');var ejs=require(_0xe51f('0x8'));var fs=require('fs');var fs_extra=require(_0xe51f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe51f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe51f('0xb'));var querystring=require(_0xe51f('0xc'));var Papa=require(_0xe51f('0xd'));var Redis=require(_0xe51f('0xe'));var authService=require(_0xe51f('0xf'));var qs=require(_0xe51f('0x10'));var as=require(_0xe51f('0x11'));var hardwareService=require(_0xe51f('0x12'));var logger=require('../../config/logger')(_0xe51f('0x13'));var utils=require(_0xe51f('0x14'));var config=require(_0xe51f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe51f('0x16'))['db'];config[_0xe51f('0x17')]=_['defaults'](config['redis'],{'host':_0xe51f('0x18'),'port':0x18eb});var socket=require(_0xe51f('0x19'))(new Redis(config[_0xe51f('0x17')]));require(_0xe51f('0x1a'))[_0xe51f('0x1b')](socket);var jayson=require(_0xe51f('0x1c'));var client=jayson[_0xe51f('0x1d')][_0xe51f('0x1e')]({'port':0x232c});var client9002=jayson[_0xe51f('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236ffe,_0x5d877f,_0x33e1fe,_0x576e30){return new BPromise(function(_0x42653c,_0x4766c2){var _0x25dd3b=_0x576e30||client;return _0x25dd3b['request'](_0x236ffe,_0x33e1fe)[_0xe51f('0x1f')](function(_0x51028e){logger[_0xe51f('0x20')](_0xe51f('0x21'),_0x5d877f,_0xe51f('0x22'));logger[_0xe51f('0x23')](_0xe51f('0x24'),_0x5d877f,'request\x20sent',JSON[_0xe51f('0x25')](_0x51028e));if(_0x51028e[_0xe51f('0x26')]){if(_0x51028e['error'][_0xe51f('0x27')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5d877f,_0x51028e[_0xe51f('0x26')][_0xe51f('0x28')]);return _0x4766c2(_0x51028e[_0xe51f('0x26')]['message']);}logger[_0xe51f('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x5d877f,_0x51028e['error'][_0xe51f('0x28')]);return _0x42653c(_0x51028e[_0xe51f('0x26')][_0xe51f('0x28')]);}else{logger[_0xe51f('0x20')](_0xe51f('0x21'),_0x5d877f,_0xe51f('0x22'));_0x42653c(_0x51028e[_0xe51f('0x29')][_0xe51f('0x28')]);}})['catch'](function(_0xce9e9f){logger['error'](_0xe51f('0x21'),_0x5d877f,_0xce9e9f);_0x4766c2(_0xce9e9f);});});}function respondWithStatusCode(_0x57f2ab,_0x2a1e77){_0x2a1e77=_0x2a1e77||0xcc;return function(_0x2e08f3){if(_0x2e08f3){return _0x57f2ab[_0xe51f('0x2a')](_0x2a1e77);}return _0x57f2ab[_0xe51f('0x2b')](_0x2a1e77)[_0xe51f('0x2c')]();};}function respondWithResult(_0x44d716,_0x36ed16){_0x36ed16=_0x36ed16||0xc8;return function(_0x446366){if(_0x446366){return _0x44d716[_0xe51f('0x2b')](_0x36ed16)['json'](_0x446366);}};}function respondWithFilteredResult(_0x568051,_0x1838fd){return function(_0x1b2764){if(_0x1b2764){var _0x1ac05c=typeof _0x1838fd[_0xe51f('0x2d')]===_0xe51f('0x2e')&&typeof _0x1838fd[_0xe51f('0x2f')]==='undefined';var _0x3928f7=_0x1b2764[_0xe51f('0x30')];var _0x5468b2=_0x1ac05c?0x0:_0x1838fd['offset'];var _0x8a241=_0x1ac05c?_0x1b2764['count']:_0x1838fd['offset']+_0x1838fd[_0xe51f('0x2f')];var _0x4d83e4;if(_0x8a241>=_0x3928f7){_0x8a241=_0x3928f7;_0x4d83e4=0xc8;}else{_0x4d83e4=0xce;}_0x568051[_0xe51f('0x2b')](_0x4d83e4);return _0x568051['set'](_0xe51f('0x31'),_0x5468b2+'-'+_0x8a241+'/'+_0x3928f7)['json'](_0x1b2764);}return null;};}function patchUpdates(_0x35d502){return function(_0x3ba0da){try{jsonpatch['apply'](_0x3ba0da,_0x35d502,!![]);}catch(_0x217676){return BPromise[_0xe51f('0x32')](_0x217676);}return _0x3ba0da['save']();};}function saveUpdates(_0x4fe44c,_0x38758c){return function(_0x54f3ad){if(_0x54f3ad){return _0x54f3ad[_0xe51f('0x33')](_0x4fe44c)[_0xe51f('0x1f')](function(_0x5cfea6){return _0x5cfea6;});}return null;};}function removeEntity(_0x4f48e9,_0x156abf){return function(_0x469fc0){if(_0x469fc0){return _0x469fc0['destroy']()[_0xe51f('0x1f')](function(){_0x4f48e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2140e0,_0x5dce9f){return function(_0x177b05){if(!_0x177b05){_0x2140e0[_0xe51f('0x2a')](0x194);}return _0x177b05;};}function handleError(_0xba77ea,_0x1e6282){_0x1e6282=_0x1e6282||0x1f4;return function(_0x28654d){logger[_0xe51f('0x26')](_0x28654d[_0xe51f('0x34')]);if(_0x28654d['name']){delete _0x28654d['name'];}_0xba77ea[_0xe51f('0x2b')](_0x1e6282)[_0xe51f('0x35')](_0x28654d);};}exports[_0xe51f('0x36')]=function(_0x4a7525,_0x5dfde0){var _0x361e9e={},_0x501690={},_0x406d4d={'count':0x0,'rows':[]};var _0x130eda=_[_0xe51f('0x37')](db[_0xe51f('0x38')]['rawAttributes'],function(_0xd767f3){return{'name':_0xd767f3[_0xe51f('0x39')],'type':_0xd767f3[_0xe51f('0x3a')][_0xe51f('0x3b')]};});_0x501690[_0xe51f('0x3c')]=_['map'](_0x130eda,'name');_0x501690['query']=_['keys'](_0x4a7525['query']);_0x501690[_0xe51f('0x3d')]=_[_0xe51f('0x3e')](_0x501690[_0xe51f('0x3c')],_0x501690['query']);_0x361e9e[_0xe51f('0x3f')]=_[_0xe51f('0x3e')](_0x501690[_0xe51f('0x3c')],qs[_0xe51f('0x40')](_0x4a7525['query'][_0xe51f('0x40')]));_0x361e9e[_0xe51f('0x3f')]=_0x361e9e[_0xe51f('0x3f')][_0xe51f('0x41')]?_0x361e9e[_0xe51f('0x3f')]:_0x501690[_0xe51f('0x3c')];if(!_0x4a7525['query'][_0xe51f('0x42')]('nolimit')){_0x361e9e[_0xe51f('0x2f')]=qs[_0xe51f('0x2f')](_0x4a7525[_0xe51f('0x43')]['limit']);_0x361e9e['offset']=qs[_0xe51f('0x2d')](_0x4a7525[_0xe51f('0x43')]['offset']);}_0x361e9e[_0xe51f('0x44')]=qs[_0xe51f('0x45')](_0x4a7525[_0xe51f('0x43')][_0xe51f('0x45')]);_0x361e9e[_0xe51f('0x46')]=qs[_0xe51f('0x3d')](_['pick'](_0x4a7525[_0xe51f('0x43')],_0x501690[_0xe51f('0x3d')]),_0x130eda);if(_0x4a7525['query'][_0xe51f('0x47')]){_0x361e9e[_0xe51f('0x46')]=_['merge'](_0x361e9e[_0xe51f('0x46')],{'$or':_[_0xe51f('0x37')](_0x130eda,function(_0x1efbe0){if(_0x1efbe0['type']!=='VIRTUAL'){var _0x355f19={};_0x355f19[_0x1efbe0[_0xe51f('0x48')]]={'$like':'%'+_0x4a7525[_0xe51f('0x43')][_0xe51f('0x47')]+'%'};return _0x355f19;}})});}_0x361e9e=_[_0xe51f('0x49')]({},_0x361e9e,_0x4a7525[_0xe51f('0x4a')]);var _0x14bff2={'where':_0x361e9e[_0xe51f('0x46')]};return db[_0xe51f('0x38')][_0xe51f('0x30')](_0x14bff2)[_0xe51f('0x1f')](function(_0x1ff148){_0x406d4d[_0xe51f('0x30')]=_0x1ff148;if(_0x4a7525[_0xe51f('0x43')][_0xe51f('0x4b')]){_0x361e9e['include']=[{'all':!![]}];}return db[_0xe51f('0x38')][_0xe51f('0x4c')](_0x361e9e);})[_0xe51f('0x1f')](function(_0x5dc836){_0x406d4d[_0xe51f('0x4d')]=_0x5dc836;return _0x406d4d;})[_0xe51f('0x1f')](respondWithFilteredResult(_0x5dfde0,_0x361e9e))[_0xe51f('0x4e')](handleError(_0x5dfde0,null));};exports['show']=function(_0x502a77,_0x3e696b){var _0x4f4944={'raw':!![],'where':{'id':_0x502a77[_0xe51f('0x4f')]['id']}},_0x1a7253={};_0x1a7253[_0xe51f('0x3c')]=_[_0xe51f('0x50')](db[_0xe51f('0x38')][_0xe51f('0x51')]);_0x1a7253[_0xe51f('0x43')]=_[_0xe51f('0x50')](_0x502a77['query']);_0x1a7253[_0xe51f('0x3d')]=_['intersection'](_0x1a7253[_0xe51f('0x3c')],_0x1a7253[_0xe51f('0x43')]);_0x4f4944[_0xe51f('0x3f')]=_[_0xe51f('0x3e')](_0x1a7253[_0xe51f('0x3c')],qs['fields'](_0x502a77[_0xe51f('0x43')][_0xe51f('0x40')]));_0x4f4944[_0xe51f('0x3f')]=_0x4f4944[_0xe51f('0x3f')][_0xe51f('0x41')]?_0x4f4944[_0xe51f('0x3f')]:_0x1a7253['model'];if(_0x502a77[_0xe51f('0x43')][_0xe51f('0x4b')]){_0x4f4944[_0xe51f('0x52')]=[{'all':!![]}];}_0x4f4944=_[_0xe51f('0x49')]({},_0x4f4944,_0x502a77[_0xe51f('0x4a')]);return db[_0xe51f('0x38')][_0xe51f('0x53')](_0x4f4944)['then'](handleEntityNotFound(_0x3e696b,null))[_0xe51f('0x1f')](respondWithResult(_0x3e696b,null))[_0xe51f('0x4e')](handleError(_0x3e696b,null));};exports['create']=function(_0x2d33f0,_0x58c580){return db['WhatsappMessage'][_0xe51f('0x54')](_0x2d33f0[_0xe51f('0x55')],{})['then'](respondWithResult(_0x58c580,0xc9))[_0xe51f('0x4e')](handleError(_0x58c580,null));};exports['update']=function(_0x479d5a,_0x326210){if(_0x479d5a[_0xe51f('0x55')]['id']){delete _0x479d5a[_0xe51f('0x55')]['id'];}return db[_0xe51f('0x38')][_0xe51f('0x53')]({'where':{'id':_0x479d5a[_0xe51f('0x4f')]['id']}})[_0xe51f('0x1f')](handleEntityNotFound(_0x326210,null))['then'](saveUpdates(_0x479d5a[_0xe51f('0x55')],null))[_0xe51f('0x1f')](respondWithResult(_0x326210,null))[_0xe51f('0x4e')](handleError(_0x326210,null));};exports[_0xe51f('0x56')]=function(_0x163d26,_0x5f0ab0){return db[_0xe51f('0x38')][_0xe51f('0x53')]({'where':{'id':_0x163d26[_0xe51f('0x4f')]['id']}})[_0xe51f('0x1f')](handleEntityNotFound(_0x5f0ab0,null))[_0xe51f('0x1f')](removeEntity(_0x5f0ab0,null))[_0xe51f('0x4e')](handleError(_0x5f0ab0,null));};exports[_0xe51f('0x57')]=function(_0x44c0df,_0x51149b){return db[_0xe51f('0x38')][_0xe51f('0x57')]()[_0xe51f('0x1f')](respondWithResult(_0x51149b,null))[_0xe51f('0x4e')](handleError(_0x51149b,null));};var interaction_log=require(_0xe51f('0x58'))(_0xe51f('0x59'));exports[_0xe51f('0x5a')]=function(_0x454ef4,_0x2ce835,_0x415f89){var _0x46d7e2={'agent':{},'channel':_0xe51f('0x5b')};if(_0x454ef4[_0xe51f('0x55')]['id']){delete _0x454ef4[_0xe51f('0x55')]['id'];}_0x454ef4[_0xe51f('0x55')][_0xe51f('0x5c')]=!![];_0x454ef4[_0xe51f('0x55')][_0xe51f('0x5d')]=moment()[_0xe51f('0x5e')](_0xe51f('0x5f'));_0x454ef4[_0xe51f('0x55')][_0xe51f('0x60')]=_0x454ef4[_0xe51f('0x55')][_0xe51f('0x60')]||_0x454ef4[_0xe51f('0x61')]['id'];_0x46d7e2[_0xe51f('0x62')]['id']=_0x454ef4['body'][_0xe51f('0x60')];return db[_0xe51f('0x38')][_0xe51f('0x53')]({'where':{'id':_0x454ef4[_0xe51f('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ce835,null))[_0xe51f('0x1f')](saveUpdates(_0x454ef4['body'],null))[_0xe51f('0x1f')](function(_0x479f75){if(_0x479f75){_0x46d7e2[_0xe51f('0x28')]=_0x479f75[_0xe51f('0x63')]({'plain':!![]});return db[_0xe51f('0x64')][_0xe51f('0x53')]({'where':{'id':_0x479f75[_0xe51f('0x65')]}});}return null;})[_0xe51f('0x1f')](handleEntityNotFound(_0x2ce835,null))[_0xe51f('0x1f')](function(_0x4cadc0){if(_0x4cadc0){return _0x4cadc0[_0xe51f('0x33')]({'UserId':_0x454ef4['body']['UserId'],'read1stAt':_['isNil'](_0x4cadc0['read1stAt'])?moment()[_0xe51f('0x5e')](_0xe51f('0x5f')):undefined});}return null;})['then'](function(_0xfcde5f){if(_0xfcde5f){_0x46d7e2[_0xe51f('0x66')]=_0xfcde5f['get']({'plain':!![]});interaction_log[_0xe51f('0x20')](_0xe51f('0x67'),_0x454ef4[_0xe51f('0x61')]['id'],_0x454ef4['user'][_0xe51f('0x48')],_0x454ef4[_0xe51f('0x61')][_0xe51f('0x68')],_0x46d7e2[_0xe51f('0x66')]['id'],_0x454ef4[_0xe51f('0x55')]?JSON['stringify'](_0x454ef4[_0xe51f('0x55')]):_0xe51f('0x69'));return respondWithRpcPromise(_0xe51f('0x6a'),_0xe51f('0x6b'),_0x46d7e2);}return null;})[_0xe51f('0x1f')](function(_0x47e130){var _0x46a104=_0xe51f('0x6c')+_0x47e130['message'][_0xe51f('0x6d')];return db[_0xe51f('0x6e')]['query'](_0x46a104,{'type':db['Sequelize']['QueryTypes'][_0xe51f('0x6f')],'raw':!![]})[_0xe51f('0x1f')](function(_0x72c0ea){return _0x72c0ea;});})['then'](function(_0xdd6118){if(_0xdd6118){_0x46d7e2[_0xe51f('0x28')][_0xe51f('0x70')]=_0xdd6118[0x0];if(!_0x454ef4[_0xe51f('0x55')][_0xe51f('0x60')])return;return db[_0xe51f('0x71')][_0xe51f('0x53')]({'where':{'id':_0x454ef4[_0xe51f('0x55')][_0xe51f('0x60')],'role':_0xe51f('0x62')},'attributes':['id',_0xe51f('0x48'),_0xe51f('0x72'),_0xe51f('0x73'),_0xe51f('0x74')],'raw':!![]});}return null;})[_0xe51f('0x1f')](function(_0x7ed59e){if(!_0x7ed59e)return null;_0x46d7e2[_0xe51f('0x28')]['agent']=_0x7ed59e;return _0x46d7e2;})['then'](function(_0x16d5c8){if(_0x16d5c8){if(_0x454ef4[_0xe51f('0x55')]['manual']){_0x46d7e2[_0xe51f('0x28')]['interface']=util[_0xe51f('0x5e')](_0xe51f('0x75'),_0x454ef4[_0xe51f('0x61')][_0xe51f('0x48')]);_0x46d7e2['message'][_0xe51f('0x76')]=_0x46d7e2[_0xe51f('0x76')];_0x46d7e2[_0xe51f('0x28')][_0xe51f('0x77')]=_0x46d7e2[_0xe51f('0x76')];_0x46d7e2[_0xe51f('0x28')]['event']=_0xe51f('0x5a');return respondWithRpcPromise('EventManager',_0xe51f('0x78'),{'event':_0xe51f('0x79'),'message':_0x46d7e2[_0xe51f('0x28')]},client9002)[_0xe51f('0x1f')](function(){return _0x46d7e2;});}return _0x46d7e2;}return null;})[_0xe51f('0x1f')](respondWithResult(_0x2ce835,null))[_0xe51f('0x4e')](handleError(_0x2ce835,null));};var interaction_log=require(_0xe51f('0x58'))(_0xe51f('0x59'));exports['reject']=function(_0xd0963c,_0x4193e6,_0x2f8966){var _0x1f73a2={'agent':{},'channel':_0xe51f('0x5b')};if(_0xd0963c['body']['id']){delete _0xd0963c[_0xe51f('0x55')]['id'];}_0xd0963c[_0xe51f('0x55')][_0xe51f('0x60')]=_0xd0963c['body'][_0xe51f('0x60')]||_0xd0963c[_0xe51f('0x61')]['id'];_0x1f73a2[_0xe51f('0x62')]['id']=_0xd0963c[_0xe51f('0x55')][_0xe51f('0x60')];return db[_0xe51f('0x38')][_0xe51f('0x53')]({'where':{'id':_0xd0963c[_0xe51f('0x4f')]['id'],'UserId':null}})[_0xe51f('0x1f')](handleEntityNotFound(_0x4193e6,null))[_0xe51f('0x1f')](function(_0xf03396){if(_0xf03396){_0x1f73a2[_0xe51f('0x28')]=_0xf03396[_0xe51f('0x63')]({'plain':!![]});return db[_0xe51f('0x64')]['find']({'where':{'id':_0xf03396[_0xe51f('0x65')]}});}return null;})[_0xe51f('0x1f')](handleEntityNotFound(_0x4193e6,null))[_0xe51f('0x1f')](function(_0x37b9a4){if(_0x37b9a4){_0x1f73a2[_0xe51f('0x66')]=_0x37b9a4[_0xe51f('0x63')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd0963c[_0xe51f('0x61')]['id'],_0xd0963c['user'][_0xe51f('0x48')],_0xd0963c['user'][_0xe51f('0x68')],_0x1f73a2[_0xe51f('0x66')]['id'],_0xd0963c[_0xe51f('0x55')]?JSON['stringify'](_0xd0963c[_0xe51f('0x55')]):_0xe51f('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1f73a2);}return null;})[_0xe51f('0x1f')](function(_0x5053d7){var _0x3dcfe2=_0xe51f('0x6c')+_0x5053d7[_0xe51f('0x28')][_0xe51f('0x6d')];return db[_0xe51f('0x6e')]['query'](_0x3dcfe2,{'type':db['Sequelize']['QueryTypes'][_0xe51f('0x6f')],'raw':!![]})[_0xe51f('0x1f')](function(_0x4d9f7){return _0x4d9f7;});})['then'](function(_0x1f22a4){if(_0x1f22a4){_0x1f73a2[_0xe51f('0x28')][_0xe51f('0x70')]=_0x1f22a4[0x0];if(!_0xd0963c[_0xe51f('0x55')][_0xe51f('0x60')])return;return db[_0xe51f('0x71')][_0xe51f('0x53')]({'where':{'id':_0xd0963c[_0xe51f('0x55')]['UserId'],'role':_0xe51f('0x62')},'attributes':['id','name',_0xe51f('0x72'),_0xe51f('0x73'),_0xe51f('0x74')],'raw':!![]});}return null;})[_0xe51f('0x1f')](function(_0x41772f){if(!_0x41772f)return null;_0x1f73a2[_0xe51f('0x28')][_0xe51f('0x62')]=_0x41772f;return _0x1f73a2;})[_0xe51f('0x1f')](function(_0x5b88f2){if(_0x5b88f2){_0x5b88f2[_0xe51f('0x28')][_0xe51f('0x7a')]=util[_0xe51f('0x5e')]('SIP/%s',_0xd0963c[_0xe51f('0x61')][_0xe51f('0x48')]);_0x5b88f2['message']['channel']=_0x1f73a2[_0xe51f('0x76')];_0x5b88f2['message']['motionChannel']=_0x1f73a2[_0xe51f('0x76')];_0x5b88f2[_0xe51f('0x28')][_0xe51f('0x7b')]='reject';respondWithRpcPromise(_0xe51f('0x78'),'EventManager',{'event':_0xe51f('0x7c'),'message':_0x5b88f2[_0xe51f('0x28')]},client9002);return _0x1f73a2;}return null;})['then'](respondWithResult(_0x4193e6,null))[_0xe51f('0x4e')](handleError(_0x4193e6,null));};exports[_0xe51f('0x2b')]=function(_0x110ae3,_0x1991dc,_0x491ee1){if(_0x110ae3[_0xe51f('0x55')]['id']){delete _0x110ae3[_0xe51f('0x55')]['id'];}var _0x332c6e;return db[_0xe51f('0x38')][_0xe51f('0x53')]({'where':{'id':_0x110ae3['params']['id']}})[_0xe51f('0x1f')](handleEntityNotFound(_0x1991dc,null))[_0xe51f('0x1f')](function(_0x215fcb){if(_0x215fcb){_0x332c6e=_0x215fcb;return db[_0xe51f('0x7d')]['find']({'where':{'id':_0x215fcb[_0xe51f('0x7e')]}});}})[_0xe51f('0x1f')](handleEntityNotFound(_0x1991dc,null))[_0xe51f('0x1f')](function(_0x1c9420){if(_0x1c9420){logger[_0xe51f('0x23')](_0xe51f('0x7f'),_0xe51f('0x2b'),_0xe51f('0x80'),_0x1c9420['type'],util[_0xe51f('0x81')](_0x110ae3['body'],{'showHidden':![],'depth':null}));switch(_0x1c9420[_0xe51f('0x3a')]){case _0xe51f('0x82'):if(_0x110ae3[_0xe51f('0x55')][_0xe51f('0x83')]&&_0x110ae3[_0xe51f('0x55')][_0xe51f('0x83')]===_0x332c6e[_0xe51f('0x84')]&&_0x110ae3[_0xe51f('0x55')][_0xe51f('0x85')]&&_0x110ae3[_0xe51f('0x55')]['MessageStatus']===_0xe51f('0x5c')){return _0x332c6e[_0xe51f('0x33')]({'read':!![]});}else{logger[_0xe51f('0x26')](_0xe51f('0x86'),_0xe51f('0x2b'),_0xe51f('0x82'),util[_0xe51f('0x81')](_0x110ae3['body'],{'showHidden':![],'depth':null}));}break;}return _0x332c6e;}})[_0xe51f('0x1f')](respondWithResult(_0x1991dc,null))['catch'](handleError(_0x1991dc,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 7b9d6db..33620fe 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 _0x55ea=['WhatsappMessage','save','update','remove','exports','events','../../mysqldb'];(function(_0x4bbafa,_0x332ab1){var _0x515407=function(_0x37fd05){while(--_0x37fd05){_0x4bbafa['push'](_0x4bbafa['shift']());}};_0x515407(++_0x332ab1);}(_0x55ea,0xc9));var _0xa55e=function(_0x45b236,_0xb66449){_0x45b236=_0x45b236-0x0;var _0x27fe4f=_0x55ea[_0x45b236];return _0x27fe4f;};'use strict';var EventEmitter=require(_0xa55e('0x0'));var WhatsappMessage=require(_0xa55e('0x1'))['db'][_0xa55e('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa55e('0x3'),'afterUpdate':_0xa55e('0x4'),'afterDestroy':_0xa55e('0x5')};function emitEvent(_0x1325cc){return function(_0x95af3d,_0x54f178,_0x2d1040){WhatsappMessageEvents['emit'](_0x1325cc+':'+_0x95af3d['id'],_0x95af3d);WhatsappMessageEvents['emit'](_0x1325cc,_0x95af3d);_0x2d1040(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xa55e('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x2504=['update','remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x37737b,_0x52df49){var _0x5c7cf0=function(_0xe53a50){while(--_0xe53a50){_0x37737b['push'](_0x37737b['shift']());}};_0x5c7cf0(++_0x52df49);}(_0x2504,0xee));var _0x4250=function(_0x1f49f8,_0xb17e9c){_0x1f49f8=_0x1f49f8-0x0;var _0x409c9b=_0x2504[_0x1f49f8];return _0x409c9b;};'use strict';var EventEmitter=require(_0x4250('0x0'));var WhatsappMessage=require(_0x4250('0x1'))['db'][_0x4250('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4250('0x3')](0x0);var events={'afterCreate':_0x4250('0x4'),'afterUpdate':_0x4250('0x5'),'afterDestroy':_0x4250('0x6')};function emitEvent(_0x320d79){return function(_0x17d2d8,_0xc31f3a,_0xe5986d){WhatsappMessageEvents[_0x4250('0x7')](_0x320d79+':'+_0x17d2d8['id'],_0x17d2d8);WhatsappMessageEvents['emit'](_0x320d79,_0x17d2d8);_0xe5986d(null);};}for(var e in events){if(events[_0x4250('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 04d4dab..ac8b8ab 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 _0x10da=['node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','type','accountSid','phone','authToken','messages','create','whatsapp:','remote','/status?token=','token','sid','afterCreate','twilio','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','Bearer\x20','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise'];(function(_0x22b9db,_0x586cf8){var _0x82efab=function(_0xc03543){while(--_0xc03543){_0x22b9db['push'](_0x22b9db['shift']());}};_0x82efab(++_0x586cf8);}(_0x10da,0x145));var _0xa10d=function(_0xcd5d0a,_0x41a4b2){_0xcd5d0a=_0xcd5d0a-0x0;var _0xc28575=_0x10da[_0xcd5d0a];return _0xc28575;};'use strict';var _=require(_0xa10d('0x0'));var util=require(_0xa10d('0x1'));var logger=require('../../config/logger')(_0xa10d('0x2'));var moment=require('moment');var BPromise=require(_0xa10d('0x3'));var rp=require(_0xa10d('0x4'));var fetch=require(_0xa10d('0x5'));var fs=require('fs');var path=require(_0xa10d('0x6'));var rimraf=require(_0xa10d('0x7'));var config=require(_0xa10d('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0xa10d('0x9')]=function(_0x5f5138,_0x259392){return _0x5f5138[_0xa10d('0xa')](_0xa10d('0xb'),attributes,{'tableName':_0xa10d('0xc'),'paranoid':![],'indexes':[{'name':_0xa10d('0xd'),'fields':[_0xa10d('0xd')]},{'name':_0xa10d('0xe'),'fields':[_0xa10d('0xf')],'type':_0xa10d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x209616,_0x3d34e6,_0x48ac08){var _0xeb92ec=_0x5f5138['models'];var _0x4340c5=_0x209616['get']({'plain':!![]});if(_0x4340c5[_0xa10d('0x11')]['toLowerCase']()==='in'||_0x4340c5['direction'][_0xa10d('0x12')]()===_0xa10d('0x13')&&!_0x4340c5[_0xa10d('0x14')]&&!_['isNil'](_0x4340c5[_0xa10d('0x15')])){_0xeb92ec['WhatsappInteraction']['findOne']({'where':{'id':_0x4340c5[_0xa10d('0x16')]}})[_0xa10d('0x17')](function(_0x16b180){if(_0x16b180){_0x16b180[_0xa10d('0x18')]({'lastMsgAt':_0x4340c5['createdAt'],'lastMsgDirection':_0x4340c5[_0xa10d('0x11')][_0xa10d('0x12')]()});}})[_0xa10d('0x19')](function(_0x2e894f){console[_0xa10d('0x1a')](_0x2e894f);});}if(_0x4340c5['direction']===_0xa10d('0x13')&&!_0x4340c5[_0xa10d('0x14')]){var _0x5f2958;_0xeb92ec[_0xa10d('0x1b')][_0xa10d('0x1c')]({'where':{'id':_0x4340c5['WhatsappAccountId']},'raw':!![]})[_0xa10d('0x17')](function(_0x456121){_0x5f2958=_0x456121;if(_0x5f2958&&_0x5f2958[_0xa10d('0x1d')]){switch(_0x5f2958[_0xa10d('0x1d')]){case'twilio':var _0x154024=require('twilio');if(_0x5f2958[_0xa10d('0x1e')]&&_0x5f2958['authToken']&&_0x5f2958[_0xa10d('0x1f')]){var _0x534934=new _0x154024(_0x5f2958[_0xa10d('0x1e')],_0x5f2958[_0xa10d('0x20')]);_0x534934[_0xa10d('0x21')][_0xa10d('0x22')]({'body':_0x4340c5[_0xa10d('0xf')],'to':_0xa10d('0x23')+_0x4340c5[_0xa10d('0x1f')],'from':'whatsapp:'+_0x5f2958[_0xa10d('0x1f')],'statusCallback':_0x5f2958[_0xa10d('0x24')]+'/api/whatsapp/messages/'+_0x4340c5['id']+_0xa10d('0x25')+_0x5f2958[_0xa10d('0x26')]})[_0xa10d('0x17')](function(_0x38a729){if(_0x38a729[_0xa10d('0x27')]){return _0x209616[_0xa10d('0x18')]({'messageId':_0x38a729[_0xa10d('0x27')]});}})[_0xa10d('0x19')](function(_0x48ac3e){logger[_0xa10d('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xa10d('0x28'),_0xa10d('0x29'),util['inspect'](_0x48ac3e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa10d('0x2a'),_0xa10d('0x28'),_0xa10d('0x29'),_0xa10d('0x2b'));}break;case _0xa10d('0x2c'):var _0x5c4432=_0x5f2958[_0xa10d('0x1e')];var _0x301011=_0x5f2958[_0xa10d('0x20')];var _0x4f723d=_0x5f2958[_0xa10d('0x2d')]+'/whatsapp/v1/'+_0x5c4432+_0xa10d('0x2e');var _0x4338e0={'to':[_0x4340c5[_0xa10d('0x1f')]],'message':{'type':_0xa10d('0x2f'),'text':_0x4340c5[_0xa10d('0xf')]}};var _0x1690ad={'method':_0xa10d('0x30'),'uri':_0x4f723d,'headers':{'Authorization':_0xa10d('0x31')+_0x301011,'Content-Type':'application/json'},'body':_0x4338e0,'json':!![]};rp(_0x1690ad)[_0xa10d('0x17')](function(_0x331dab){if(_0x331dab[_0xa10d('0x32')][0x0][_0xa10d('0x33')]){return _0x209616['update']({'messageId':_0x331dab['statuses'][0x0][_0xa10d('0x33')]});}})[_0xa10d('0x19')](function(_0x3134d9){logger['err']('WhatsappMessage,\x20%s',_0x3134d9);});break;}}})[_0xa10d('0x34')](function(){_0x48ac08();});}else{_0x48ac08();}}},'charset':_0xa10d('0x35'),'collate':_0xa10d('0x36')});}; \ No newline at end of file +var _0x3733=['direction','toLowerCase','out','secret','isNil','findOne','then','catch','WhatsappAccount','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','POST','Bearer\x20','application/json','statuses','update','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x3733,0x93));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3373('0x0'));var util=require(_0x3373('0x1'));var logger=require(_0x3373('0x2'))(_0x3373('0x3'));var moment=require(_0x3373('0x4'));var BPromise=require('bluebird');var rp=require(_0x3373('0x5'));var fetch=require(_0x3373('0x6'));var fs=require('fs');var path=require(_0x3373('0x7'));var rimraf=require('rimraf');var config=require(_0x3373('0x8'));var attributes=require(_0x3373('0x9'));module[_0x3373('0xa')]=function(_0x1d49ae,_0xe1587c){return _0x1d49ae[_0x3373('0xb')](_0x3373('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x3373('0xd'),'fields':[_0x3373('0xd')]},{'name':_0x3373('0xe'),'fields':['body'],'type':_0x3373('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3daadf,_0x1d8508,_0x2693d4){var _0x10d4d1=_0x1d49ae[_0x3373('0x10')];var _0x4897a1=_0x3daadf[_0x3373('0x11')]({'plain':!![]});if(_0x4897a1[_0x3373('0x12')][_0x3373('0x13')]()==='in'||_0x4897a1['direction']['toLowerCase']()===_0x3373('0x14')&&!_0x4897a1[_0x3373('0x15')]&&!_[_0x3373('0x16')](_0x4897a1['UserId'])){_0x10d4d1['WhatsappInteraction'][_0x3373('0x17')]({'where':{'id':_0x4897a1['WhatsappInteractionId']}})[_0x3373('0x18')](function(_0x1b279d){if(_0x1b279d){_0x1b279d['update']({'lastMsgAt':_0x4897a1['createdAt'],'lastMsgDirection':_0x4897a1[_0x3373('0x12')][_0x3373('0x13')]()});}})[_0x3373('0x19')](function(_0x83353f){console['error'](_0x83353f);});}if(_0x4897a1[_0x3373('0x12')]===_0x3373('0x14')&&!_0x4897a1[_0x3373('0x15')]){var _0x2ad5b5;_0x10d4d1[_0x3373('0x1a')]['find']({'where':{'id':_0x4897a1['WhatsappAccountId']},'raw':!![]})[_0x3373('0x18')](function(_0x3d2507){_0x2ad5b5=_0x3d2507;if(_0x2ad5b5&&_0x2ad5b5['type']){switch(_0x2ad5b5['type']){case _0x3373('0x1b'):var _0x481829=require(_0x3373('0x1b'));if(_0x2ad5b5[_0x3373('0x1c')]&&_0x2ad5b5[_0x3373('0x1d')]&&_0x2ad5b5[_0x3373('0x1e')]){var _0x245c97=new _0x481829(_0x2ad5b5[_0x3373('0x1c')],_0x2ad5b5[_0x3373('0x1d')]);_0x245c97[_0x3373('0x1f')]['create']({'body':_0x4897a1['body'],'to':_0x3373('0x20')+_0x4897a1[_0x3373('0x1e')],'from':'whatsapp:'+_0x2ad5b5[_0x3373('0x1e')],'statusCallback':_0x2ad5b5[_0x3373('0x21')]+_0x3373('0x22')+_0x4897a1['id']+_0x3373('0x23')+_0x2ad5b5[_0x3373('0x24')]})['then'](function(_0x2e8a96){if(_0x2e8a96[_0x3373('0x25')]){return _0x3daadf['update']({'messageId':_0x2e8a96[_0x3373('0x25')]});}})['catch'](function(_0x25e772){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3373('0x1b'),util[_0x3373('0x26')](_0x25e772,{'showHidden':![],'depth':null}));});}else{logger[_0x3373('0x27')](_0x3373('0x28'),'afterCreate','twilio',_0x3373('0x29'));}break;case _0x3373('0x2a'):var _0x56a2a9=_0x2ad5b5[_0x3373('0x1c')];var _0x40d9c7=_0x2ad5b5[_0x3373('0x1d')];var _0x23b402=_0x2ad5b5[_0x3373('0x2b')]+'/whatsapp/v1/'+_0x56a2a9+_0x3373('0x2c');var _0x46d83c={'to':[_0x4897a1[_0x3373('0x1e')]],'message':{'type':'text','text':_0x4897a1['body']}};var _0x5be257={'method':_0x3373('0x2d'),'uri':_0x23b402,'headers':{'Authorization':_0x3373('0x2e')+_0x40d9c7,'Content-Type':_0x3373('0x2f')},'body':_0x46d83c,'json':!![]};rp(_0x5be257)[_0x3373('0x18')](function(_0x1626f4){if(_0x1626f4[_0x3373('0x30')][0x0]['message_id']){return _0x3daadf[_0x3373('0x31')]({'messageId':_0x1626f4[_0x3373('0x30')][0x0]['message_id']});}})[_0x3373('0x19')](function(_0x3f2440){logger[_0x3373('0x32')](_0x3373('0x33'),_0x3f2440);});break;}}})[_0x3373('0x34')](function(){_0x2693d4();});}else{_0x2693d4();}}},'charset':_0x3373('0x35'),'collate':_0x3373('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 4ae5642..335e07d 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 _0x7ecb=['result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7ecb,0xee));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb7ec('0x0'));var util=require(_0xb7ec('0x1'));var moment=require(_0xb7ec('0x2'));var BPromise=require(_0xb7ec('0x3'));var rs=require(_0xb7ec('0x4'));var fs=require('fs');var Redis=require(_0xb7ec('0x5'));var db=require(_0xb7ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7ec('0x7'))('rpc');var config=require(_0xb7ec('0x8'));var jayson=require(_0xb7ec('0x9'));var client=jayson[_0xb7ec('0xa')][_0xb7ec('0xb')]({'port':0x232a});config[_0xb7ec('0xc')]=_['defaults'](config['redis'],{'host':_0xb7ec('0xd'),'port':0x18eb});var socket=require(_0xb7ec('0xe'))(new Redis(config['redis']));require(_0xb7ec('0xf'))['register'](socket);function respondWithRpcPromise(_0x591b5e,_0x3c5329,_0x3e2f71){return new BPromise(function(_0x497202,_0x58355f){return client[_0xb7ec('0x10')](_0x591b5e,_0x3e2f71)[_0xb7ec('0x11')](function(_0x4e95d8){logger[_0xb7ec('0x12')](_0xb7ec('0x13'),_0x3c5329,_0xb7ec('0x14'));logger['debug'](_0xb7ec('0x15'),_0x3c5329,_0xb7ec('0x14'),JSON[_0xb7ec('0x16')](_0x4e95d8));if(_0x4e95d8[_0xb7ec('0x17')]){if(_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x18')]===0x1f4){logger[_0xb7ec('0x17')](_0xb7ec('0x13'),_0x3c5329,_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x19')]);return _0x58355f(_0x4e95d8['error']['message']);}logger[_0xb7ec('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x3c5329,_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x19')]);return _0x497202(_0x4e95d8[_0xb7ec('0x17')][_0xb7ec('0x19')]);}else{logger[_0xb7ec('0x12')](_0xb7ec('0x13'),_0x3c5329,_0xb7ec('0x14'));_0x497202(_0x4e95d8[_0xb7ec('0x1a')][_0xb7ec('0x19')]);}})[_0xb7ec('0x1b')](function(_0x40e7d9){logger[_0xb7ec('0x17')](_0xb7ec('0x13'),_0x3c5329,_0x40e7d9);_0x58355f(_0x40e7d9);});});}exports[_0xb7ec('0x1c')]=function(_0x5d4cb9){var _0x167720=this;return new Promise(function(_0x1992e0,_0x59dcdc){return db[_0xb7ec('0x1d')]['create'](_0x5d4cb9[_0xb7ec('0x1e')],{'raw':_0x5d4cb9[_0xb7ec('0x1f')]?_0x5d4cb9[_0xb7ec('0x1f')][_0xb7ec('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0xaade){logger[_0xb7ec('0x12')](_0xb7ec('0x1c'),_0x5d4cb9);logger['debug'](_0xb7ec('0x1c'),_0x5d4cb9,JSON[_0xb7ec('0x16')](_0xaade));_0x1992e0(_0xaade);})[_0xb7ec('0x1b')](function(_0x401bfb){logger[_0xb7ec('0x17')]('CreateWhatsappMessage',_0x401bfb[_0xb7ec('0x19')],_0x5d4cb9);_0x59dcdc(_0x167720[_0xb7ec('0x17')](0x1f4,_0x401bfb[_0xb7ec('0x19')]));});});}; \ No newline at end of file +var _0x0388=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappMessage.socket','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateWhatsappMessage','body','options','raw','util','moment','bluebird','randomstring','ioredis'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x0388,0x16f));var _0x8038=function(_0x50f157,_0x280833){_0x50f157=_0x50f157-0x0;var _0x7e0178=_0x0388[_0x50f157];return _0x7e0178;};'use strict';var _=require('lodash');var util=require(_0x8038('0x0'));var moment=require(_0x8038('0x1'));var BPromise=require(_0x8038('0x2'));var rs=require(_0x8038('0x3'));var fs=require('fs');var Redis=require(_0x8038('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8038('0x5'));var logger=require(_0x8038('0x6'))(_0x8038('0x7'));var config=require(_0x8038('0x8'));var jayson=require(_0x8038('0x9'));var client=jayson['client'][_0x8038('0xa')]({'port':0x232a});config['redis']=_[_0x8038('0xb')](config[_0x8038('0xc')],{'host':_0x8038('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8038('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d4707,_0x243a06,_0x38b1bc){return new BPromise(function(_0x19eaf5,_0x20d338){return client[_0x8038('0xf')](_0x3d4707,_0x38b1bc)[_0x8038('0x10')](function(_0x3ef0a0){logger[_0x8038('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x243a06,'request\x20sent');logger[_0x8038('0x12')](_0x8038('0x13'),_0x243a06,'request\x20sent',JSON[_0x8038('0x14')](_0x3ef0a0));if(_0x3ef0a0[_0x8038('0x15')]){if(_0x3ef0a0[_0x8038('0x15')]['code']===0x1f4){logger['error'](_0x8038('0x16'),_0x243a06,_0x3ef0a0['error'][_0x8038('0x17')]);return _0x20d338(_0x3ef0a0[_0x8038('0x15')]['message']);}logger['error'](_0x8038('0x16'),_0x243a06,_0x3ef0a0[_0x8038('0x15')]['message']);return _0x19eaf5(_0x3ef0a0[_0x8038('0x15')][_0x8038('0x17')]);}else{logger[_0x8038('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x243a06,_0x8038('0x18'));_0x19eaf5(_0x3ef0a0[_0x8038('0x19')][_0x8038('0x17')]);}})[_0x8038('0x1a')](function(_0x257973){logger[_0x8038('0x15')](_0x8038('0x16'),_0x243a06,_0x257973);_0x20d338(_0x257973);});});}exports[_0x8038('0x1b')]=function(_0x5c9825){var _0x2b6b23=this;return new Promise(function(_0x173fdd,_0x24f388){return db['WhatsappMessage']['create'](_0x5c9825[_0x8038('0x1c')],{'raw':_0x5c9825['options']?_0x5c9825[_0x8038('0x1d')][_0x8038('0x1e')]===undefined?!![]:![]:!![]})[_0x8038('0x10')](function(_0x345581){logger['info'](_0x8038('0x1b'),_0x5c9825);logger[_0x8038('0x12')](_0x8038('0x1b'),_0x5c9825,JSON[_0x8038('0x14')](_0x345581));_0x173fdd(_0x345581);})[_0x8038('0x1a')](function(_0x4c8649){logger[_0x8038('0x15')](_0x8038('0x1b'),_0x4c8649['message'],_0x5c9825);_0x24f388(_0x2b6b23[_0x8038('0x15')](0x1f4,_0x4c8649[_0x8038('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index fa11eb6..2a5f5ad 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 _0x7b4d=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x224749,_0x336d1e){var _0xf23c0a=function(_0x1aa7d3){while(--_0x1aa7d3){_0x224749['push'](_0x224749['shift']());}};_0xf23c0a(++_0x336d1e);}(_0x7b4d,0x165));var _0xd7b4=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x7b4d[_0x1dd82f];return _0x353ca4;};'use strict';var WhatsappMessageEvents=require(_0xd7b4('0x0'));var events=[_0xd7b4('0x1'),'remove',_0xd7b4('0x2')];function createListener(_0x421eda,_0x3fa5df){return function(_0x12d1e7){_0x3fa5df[_0xd7b4('0x3')](_0x421eda,_0x12d1e7);};}function removeListener(_0x4cb9df,_0x4d5623){return function(){WhatsappMessageEvents[_0xd7b4('0x4')](_0x4cb9df,_0x4d5623);};}exports[_0xd7b4('0x5')]=function(_0xa1e4ce){for(var _0x2e2123=0x0,_0x2e2c33=events[_0xd7b4('0x6')];_0x2e2123<_0x2e2c33;_0x2e2123++){var _0x443d72=events[_0x2e2123];var _0x57e96b=createListener(_0xd7b4('0x7')+_0x443d72,_0xa1e4ce);WhatsappMessageEvents['on'](_0x443d72,_0x57e96b);}}; \ No newline at end of file +var _0x5ecf=['update','emit','removeListener','register','length','./whatsappMessage.events','save'];(function(_0x56f01f,_0x3e4bb5){var _0xf204db=function(_0x5254a7){while(--_0x5254a7){_0x56f01f['push'](_0x56f01f['shift']());}};_0xf204db(++_0x3e4bb5);}(_0x5ecf,0x16a));var _0xf5ec=function(_0x4e168e,_0x438fcb){_0x4e168e=_0x4e168e-0x0;var _0x4b6d5b=_0x5ecf[_0x4e168e];return _0x4b6d5b;};'use strict';var WhatsappMessageEvents=require(_0xf5ec('0x0'));var events=[_0xf5ec('0x1'),'remove',_0xf5ec('0x2')];function createListener(_0x5e200f,_0x53d7bb){return function(_0x236fdd){_0x53d7bb[_0xf5ec('0x3')](_0x5e200f,_0x236fdd);};}function removeListener(_0x594a2f,_0x52b8ee){return function(){WhatsappMessageEvents[_0xf5ec('0x4')](_0x594a2f,_0x52b8ee);};}exports[_0xf5ec('0x5')]=function(_0xd00777){for(var _0x4c51aa=0x0,_0x5285b4=events[_0xf5ec('0x6')];_0x4c51aa<_0x5285b4;_0x4c51aa++){var _0x153e6b=events[_0x4c51aa];var _0xedcaf5=createListener('whatsappMessage:'+_0x153e6b,_0xd00777);WhatsappMessageEvents['on'](_0x153e6b,_0xedcaf5);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a5aff4e..7fb6fcc 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 _0x1488=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers'];(function(_0x2dc937,_0x211004){var _0x53bd4f=function(_0x469dce){while(--_0x469dce){_0x2dc937['push'](_0x2dc937['shift']());}};_0x53bd4f(++_0x211004);}(_0x1488,0x1c6));var _0x8148=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x1488[_0x650e11];return _0x1a9b47;};'use strict';var multer=require('multer');var util=require(_0x8148('0x0'));var path=require(_0x8148('0x1'));var timeout=require(_0x8148('0x2'));var express=require('express');var router=express[_0x8148('0x3')]();var fs_extra=require(_0x8148('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8148('0x5'));router[_0x8148('0x6')]('/',auth[_0x8148('0x7')](),controller[_0x8148('0x8')]);router['get']('/describe',auth[_0x8148('0x7')](),controller[_0x8148('0x9')]);router[_0x8148('0x6')](_0x8148('0xa'),auth[_0x8148('0x7')](),controller[_0x8148('0xb')]);router[_0x8148('0x6')](_0x8148('0xc'),auth[_0x8148('0x7')](),controller[_0x8148('0xd')]);router[_0x8148('0x6')](_0x8148('0xe'),auth[_0x8148('0x7')](),controller[_0x8148('0xf')]);router['get'](_0x8148('0x10'),auth[_0x8148('0x7')](),controller[_0x8148('0x11')]);router[_0x8148('0x12')]('/',auth['isAuthenticated'](),controller[_0x8148('0x13')]);router[_0x8148('0x12')](_0x8148('0xe'),auth[_0x8148('0x7')](),controller[_0x8148('0x14')]);router[_0x8148('0x12')](_0x8148('0x10'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x8148('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8148('0x15')]('/:id',auth[_0x8148('0x7')](),controller[_0x8148('0x16')]);router[_0x8148('0x15')](_0x8148('0xe'),auth[_0x8148('0x7')](),controller[_0x8148('0x17')]);router['delete'](_0x8148('0x10'),auth['isAuthenticated'](),controller[_0x8148('0x18')]);module[_0x8148('0x19')]=router; \ No newline at end of file +var _0x89e3=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x547667,_0x110152){var _0x245b6d=function(_0x567a35){while(--_0x567a35){_0x547667['push'](_0x547667['shift']());}};_0x245b6d(++_0x110152);}(_0x89e3,0xc2));var _0x389e=function(_0x3cb5c4,_0x4dff8b){_0x3cb5c4=_0x3cb5c4-0x0;var _0x203787=_0x89e3[_0x3cb5c4];return _0x203787;};'use strict';var multer=require(_0x389e('0x0'));var util=require(_0x389e('0x1'));var path=require(_0x389e('0x2'));var timeout=require(_0x389e('0x3'));var express=require(_0x389e('0x4'));var router=express['Router']();var fs_extra=require(_0x389e('0x5'));var auth=require(_0x389e('0x6'));var interaction=require(_0x389e('0x7'));var config=require(_0x389e('0x8'));var controller=require(_0x389e('0x9'));router[_0x389e('0xa')]('/',auth[_0x389e('0xb')](),controller[_0x389e('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x389e('0xd')]);router['get'](_0x389e('0xe'),auth[_0x389e('0xb')](),controller[_0x389e('0xf')]);router[_0x389e('0xa')](_0x389e('0x10'),auth[_0x389e('0xb')](),controller[_0x389e('0x11')]);router[_0x389e('0xa')](_0x389e('0x12'),auth['isAuthenticated'](),controller[_0x389e('0x13')]);router[_0x389e('0xa')](_0x389e('0x14'),auth['isAuthenticated'](),controller[_0x389e('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x389e('0x16')](_0x389e('0x12'),auth[_0x389e('0xb')](),controller[_0x389e('0x17')]);router['post'](_0x389e('0x14'),auth['isAuthenticated'](),controller[_0x389e('0x18')]);router['put'](_0x389e('0xe'),auth[_0x389e('0xb')](),controller[_0x389e('0x19')]);router[_0x389e('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x389e('0x1b')]);router[_0x389e('0x1a')]('/:id/teams',auth[_0x389e('0xb')](),controller[_0x389e('0x1c')]);router[_0x389e('0x1a')]('/:id/users',auth[_0x389e('0xb')](),controller[_0x389e('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 11bd4eb..b8002c9 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 _0x292e=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x4941bc,_0x199598){var _0xf3862d=function(_0x7bdbd5){while(--_0x7bdbd5){_0x4941bc['push'](_0x4941bc['shift']());}};_0xf3862d(++_0x199598);}(_0x292e,0xcb));var _0xe292=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x292e[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xe292('0x0'));module[_0xe292('0x1')]={'name':{'type':Sequelize[_0xe292('0x2')],'unique':_0xe292('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe292('0x4'),_0xe292('0x5'),_0xe292('0x6'))},'description':{'type':Sequelize[_0xe292('0x2')]}}; \ No newline at end of file +var _0x0b25=['STRING','name','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x4e9f46,_0x156642){var _0x12d150=function(_0x3633f0){while(--_0x3633f0){_0x4e9f46['push'](_0x4e9f46['shift']());}};_0x12d150(++_0x156642);}(_0x0b25,0x155));var _0x50b2=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x0b25[_0x189305];return _0xea3406;};'use strict';var Sequelize=require(_0x50b2('0x0'));module[_0x50b2('0x1')]={'name':{'type':Sequelize[_0x50b2('0x2')],'unique':_0x50b2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x50b2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x50b2('0x5')](_0x50b2('0x6'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x50b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9dac5b6..e5719a3 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 _0xf877=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','WhatsappQueues','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','show','keys','catch','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','find','describe','getMembers','findOne','params','WhatsappQueueId','UserWhatsappQueue','findAll','User','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x57cf37,_0x149b89){var _0x2df46f=function(_0x70283c){while(--_0x70283c){_0x57cf37['push'](_0x57cf37['shift']());}};_0x2df46f(++_0x149b89);}(_0xf877,0x110));var _0x7f87=function(_0x255428,_0x2eaf1f){_0x255428=_0x255428-0x0;var _0x24abea=_0xf877[_0x255428];return _0x24abea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f87('0x0'));var zipdir=require(_0x7f87('0x1'));var jsonpatch=require(_0x7f87('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f87('0x3'));var Mustache=require(_0x7f87('0x4'));var util=require('util');var path=require(_0x7f87('0x5'));var sox=require(_0x7f87('0x6'));var csv=require(_0x7f87('0x7'));var ejs=require(_0x7f87('0x8'));var fs=require('fs');var fs_extra=require(_0x7f87('0x9'));var _=require(_0x7f87('0xa'));var squel=require(_0x7f87('0xb'));var crypto=require('crypto');var jsforce=require(_0x7f87('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7f87('0x7'));var querystring=require('querystring');var Papa=require(_0x7f87('0xd'));var Redis=require(_0x7f87('0xe'));var authService=require(_0x7f87('0xf'));var qs=require(_0x7f87('0x10'));var as=require(_0x7f87('0x11'));var hardwareService=require(_0x7f87('0x12'));var logger=require(_0x7f87('0x13'))(_0x7f87('0x14'));var utils=require('../../config/utils');var config=require(_0x7f87('0x15'));var licenseUtil=require(_0x7f87('0x16'));var db=require(_0x7f87('0x17'))['db'];config[_0x7f87('0x18')]=_[_0x7f87('0x19')](config[_0x7f87('0x18')],{'host':_0x7f87('0x1a'),'port':0x18eb});var socket=require(_0x7f87('0x1b'))(new Redis(config[_0x7f87('0x18')]));require('./whatsappQueue.socket')[_0x7f87('0x1c')](socket);function respondWithStatusCode(_0x2610df,_0x54ed29){_0x54ed29=_0x54ed29||0xcc;return function(_0x6fb1c8){if(_0x6fb1c8){return _0x2610df[_0x7f87('0x1d')](_0x54ed29);}return _0x2610df['status'](_0x54ed29)[_0x7f87('0x1e')]();};}function respondWithResult(_0x5b5319,_0x17e571){_0x17e571=_0x17e571||0xc8;return function(_0x3ee5b8){if(_0x3ee5b8){return _0x5b5319[_0x7f87('0x1f')](_0x17e571)['json'](_0x3ee5b8);}};}function respondWithFilteredResult(_0x55fb31,_0x243a79){return function(_0x6a7574){if(_0x6a7574){var _0x247521=typeof _0x243a79[_0x7f87('0x20')]===_0x7f87('0x21')&&typeof _0x243a79[_0x7f87('0x22')]===_0x7f87('0x21');var _0x850325=_0x6a7574[_0x7f87('0x23')];var _0x34b86b=_0x247521?0x0:_0x243a79['offset'];var _0x5960a8=_0x247521?_0x6a7574['count']:_0x243a79[_0x7f87('0x20')]+_0x243a79[_0x7f87('0x22')];var _0x24884c;if(_0x5960a8>=_0x850325){_0x5960a8=_0x850325;_0x24884c=0xc8;}else{_0x24884c=0xce;}_0x55fb31[_0x7f87('0x1f')](_0x24884c);return _0x55fb31[_0x7f87('0x24')](_0x7f87('0x25'),_0x34b86b+'-'+_0x5960a8+'/'+_0x850325)['json'](_0x6a7574);}return null;};}function patchUpdates(_0x4d84a6){return function(_0x318fc0){try{jsonpatch[_0x7f87('0x26')](_0x318fc0,_0x4d84a6,!![]);}catch(_0x2e7454){return BPromise[_0x7f87('0x27')](_0x2e7454);}return _0x318fc0['save']();};}function saveUpdates(_0x26d66,_0x37d8ca){return function(_0x155d9d){if(_0x155d9d){return _0x155d9d[_0x7f87('0x28')](_0x26d66)[_0x7f87('0x29')](function(_0xc3ef8f){return _0xc3ef8f;});}return null;};}function removeEntity(_0x467362,_0x3524c6){return function(_0x274fa9){if(_0x274fa9){return _0x274fa9['destroy']()[_0x7f87('0x29')](function(){var _0x34df95=_0x274fa9[_0x7f87('0x2a')]({'plain':!![]});var _0x4ac0e2=_0x7f87('0x2b');return db['UserProfileResource'][_0x7f87('0x2c')]({'where':{'type':_0x4ac0e2,'resourceId':_0x34df95['id']}})[_0x7f87('0x29')](function(){return _0x274fa9;});})['then'](function(){_0x467362[_0x7f87('0x1f')](0xcc)[_0x7f87('0x1e')]();});}};}function handleEntityNotFound(_0x35b456,_0x11a85e){return function(_0x4ea9bc){if(!_0x4ea9bc){_0x35b456[_0x7f87('0x1d')](0x194);}return _0x4ea9bc;};}function handleError(_0x230d9e,_0xa2730d){_0xa2730d=_0xa2730d||0x1f4;return function(_0x463437){logger[_0x7f87('0x2d')](_0x463437[_0x7f87('0x2e')]);if(_0x463437[_0x7f87('0x2f')]){delete _0x463437[_0x7f87('0x2f')];}_0x230d9e[_0x7f87('0x1f')](_0xa2730d)[_0x7f87('0x30')](_0x463437);};}exports[_0x7f87('0x31')]=function(_0x210686,_0x574141){var _0x2fe84f={},_0xbe8ce9={},_0x581b63={'count':0x0,'rows':[]};var _0x59c153=_[_0x7f87('0x32')](db[_0x7f87('0x33')][_0x7f87('0x34')],function(_0x17a283){return{'name':_0x17a283[_0x7f87('0x35')],'type':_0x17a283[_0x7f87('0x36')]['key']};});_0xbe8ce9[_0x7f87('0x37')]=_[_0x7f87('0x32')](_0x59c153,_0x7f87('0x2f'));_0xbe8ce9[_0x7f87('0x38')]=_['keys'](_0x210686[_0x7f87('0x38')]);_0xbe8ce9['filters']=_[_0x7f87('0x39')](_0xbe8ce9['model'],_0xbe8ce9[_0x7f87('0x38')]);_0x2fe84f[_0x7f87('0x3a')]=_['intersection'](_0xbe8ce9[_0x7f87('0x37')],qs[_0x7f87('0x3b')](_0x210686[_0x7f87('0x38')][_0x7f87('0x3b')]));_0x2fe84f[_0x7f87('0x3a')]=_0x2fe84f[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x2fe84f['attributes']:_0xbe8ce9['model'];if(!_0x210686[_0x7f87('0x38')]['hasOwnProperty'](_0x7f87('0x3d'))){_0x2fe84f[_0x7f87('0x22')]=qs[_0x7f87('0x22')](_0x210686[_0x7f87('0x38')][_0x7f87('0x22')]);_0x2fe84f['offset']=qs[_0x7f87('0x20')](_0x210686[_0x7f87('0x38')][_0x7f87('0x20')]);}_0x2fe84f[_0x7f87('0x3e')]=qs[_0x7f87('0x3f')](_0x210686[_0x7f87('0x38')]['sort']);_0x2fe84f[_0x7f87('0x40')]=qs[_0x7f87('0x41')](_[_0x7f87('0x42')](_0x210686[_0x7f87('0x38')],_0xbe8ce9[_0x7f87('0x41')]),_0x59c153);if(_0x210686['query']['filter']){_0x2fe84f[_0x7f87('0x40')]=_['merge'](_0x2fe84f['where'],{'$or':_[_0x7f87('0x32')](_0x59c153,function(_0x15bc4){if(_0x15bc4[_0x7f87('0x36')]!==_0x7f87('0x43')){var _0x49ec0e={};_0x49ec0e[_0x15bc4[_0x7f87('0x2f')]]={'$like':'%'+_0x210686['query'][_0x7f87('0x44')]+'%'};return _0x49ec0e;}})});}_0x2fe84f=_[_0x7f87('0x45')]({},_0x2fe84f,_0x210686[_0x7f87('0x46')]);var _0x1b4676={'where':_0x2fe84f[_0x7f87('0x40')]};return db['WhatsappQueue'][_0x7f87('0x23')](_0x1b4676)[_0x7f87('0x29')](function(_0x3c8d73){_0x581b63[_0x7f87('0x23')]=_0x3c8d73;if(_0x210686['query'][_0x7f87('0x47')]){_0x2fe84f[_0x7f87('0x48')]=[{'all':!![]}];}return db[_0x7f87('0x33')]['findAll'](_0x2fe84f);})[_0x7f87('0x29')](function(_0x569963){_0x581b63[_0x7f87('0x49')]=_0x569963;return _0x581b63;})[_0x7f87('0x29')](respondWithFilteredResult(_0x574141,_0x2fe84f))['catch'](handleError(_0x574141,null));};exports[_0x7f87('0x4a')]=function(_0x1619ec,_0x367934){var _0x2b276f={'raw':!![],'where':{'id':_0x1619ec['params']['id']}},_0x24d2ec={};_0x24d2ec[_0x7f87('0x37')]=_[_0x7f87('0x4b')](db[_0x7f87('0x33')]['rawAttributes']);_0x24d2ec['query']=_['keys'](_0x1619ec['query']);_0x24d2ec[_0x7f87('0x41')]=_[_0x7f87('0x39')](_0x24d2ec['model'],_0x24d2ec[_0x7f87('0x38')]);_0x2b276f['attributes']=_[_0x7f87('0x39')](_0x24d2ec['model'],qs[_0x7f87('0x3b')](_0x1619ec[_0x7f87('0x38')]['fields']));_0x2b276f['attributes']=_0x2b276f[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x2b276f[_0x7f87('0x3a')]:_0x24d2ec['model'];if(_0x1619ec[_0x7f87('0x38')][_0x7f87('0x47')]){_0x2b276f[_0x7f87('0x48')]=[{'all':!![]}];}_0x2b276f=_[_0x7f87('0x45')]({},_0x2b276f,_0x1619ec[_0x7f87('0x46')]);return db[_0x7f87('0x33')]['find'](_0x2b276f)[_0x7f87('0x29')](handleEntityNotFound(_0x367934,null))[_0x7f87('0x29')](respondWithResult(_0x367934,null))[_0x7f87('0x4c')](handleError(_0x367934,null));};exports['create']=function(_0x316dc7,_0x515788){return db[_0x7f87('0x33')][_0x7f87('0x4d')](_0x316dc7[_0x7f87('0x4e')],{})[_0x7f87('0x29')](function(_0x335ed0){var _0x34b37b=_0x316dc7[_0x7f87('0x4f')][_0x7f87('0x2a')]({'plain':!![]});if(!_0x34b37b)throw new Error(_0x7f87('0x50'));if(_0x34b37b[_0x7f87('0x51')]===_0x7f87('0x4f')){var _0x3e5b33=_0x335ed0[_0x7f87('0x2a')]({'plain':!![]});var _0x216dd9='WhatsappQueues';return db[_0x7f87('0x52')]['find']({'where':{'name':_0x216dd9,'userProfileId':_0x34b37b[_0x7f87('0x53')]},'raw':!![]})['then'](function(_0x3cc443){if(_0x3cc443&&_0x3cc443[_0x7f87('0x54')]===0x0){return db[_0x7f87('0x55')][_0x7f87('0x4d')]({'name':_0x3e5b33[_0x7f87('0x2f')],'resourceId':_0x3e5b33['id'],'type':_0x3cc443[_0x7f87('0x2f')],'sectionId':_0x3cc443['id']},{})[_0x7f87('0x29')](function(){return _0x335ed0;});}else{return _0x335ed0;}})[_0x7f87('0x4c')](function(_0x40d72c){logger['error'](_0x7f87('0x56'),_0x40d72c);throw _0x40d72c;});}return _0x335ed0;})[_0x7f87('0x29')](respondWithResult(_0x515788,0xc9))[_0x7f87('0x4c')](handleError(_0x515788,null));};exports[_0x7f87('0x28')]=function(_0x5134ff,_0x5b9f44){if(_0x5134ff[_0x7f87('0x4e')]['id']){delete _0x5134ff['body']['id'];}return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x5134ff['params']['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x5b9f44,null))[_0x7f87('0x29')](saveUpdates(_0x5134ff['body'],null))['then'](respondWithResult(_0x5b9f44,null))[_0x7f87('0x4c')](handleError(_0x5b9f44,null));};exports['destroy']=function(_0x13ce0e,_0xbdde13){return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x13ce0e['params']['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0xbdde13,null))[_0x7f87('0x29')](removeEntity(_0xbdde13,null))[_0x7f87('0x4c')](handleError(_0xbdde13,null));};exports[_0x7f87('0x58')]=function(_0x8dfea7,_0x4b7928){return db[_0x7f87('0x33')][_0x7f87('0x58')]()[_0x7f87('0x29')](respondWithResult(_0x4b7928,null))['catch'](handleError(_0x4b7928,null));};exports[_0x7f87('0x59')]=function(_0x533dcc,_0x35678c,_0x4178a7){var _0x5351de={'raw':!![],'where':{}},_0x519328={},_0x5875b7;return db['WhatsappQueue'][_0x7f87('0x5a')]({'where':{'id':_0x533dcc[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x35678c,null))[_0x7f87('0x29')](function(_0x4f6d34){if(_0x4f6d34){_0x5875b7=_0x4f6d34[_0x7f87('0x2a')]({'plain':!![]});_0x519328[_0x7f87('0x37')]=_['keys'](db['UserWhatsappQueue'][_0x7f87('0x34')]);_0x519328[_0x7f87('0x38')]=_[_0x7f87('0x4b')](_0x533dcc['query']);_0x519328['filters']=_[_0x7f87('0x39')](_0x519328[_0x7f87('0x37')],_0x519328[_0x7f87('0x38')]);_0x5351de['attributes']=_[_0x7f87('0x39')](_0x519328[_0x7f87('0x37')],qs[_0x7f87('0x3b')](_0x533dcc[_0x7f87('0x38')]['fields']));_0x5351de['attributes']=_0x5351de[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x5351de['attributes']:_0x519328[_0x7f87('0x37')];if(!_0x533dcc[_0x7f87('0x38')]['hasOwnProperty'](_0x7f87('0x3d'))){_0x5351de[_0x7f87('0x22')]=qs['limit'](_0x533dcc[_0x7f87('0x38')][_0x7f87('0x22')]);_0x5351de[_0x7f87('0x20')]=qs[_0x7f87('0x20')](_0x533dcc[_0x7f87('0x38')][_0x7f87('0x20')]);}_0x5351de[_0x7f87('0x3e')]=qs[_0x7f87('0x3f')](_0x533dcc[_0x7f87('0x38')]['sort']);_0x5351de[_0x7f87('0x40')]=qs[_0x7f87('0x41')](_[_0x7f87('0x42')](_0x533dcc[_0x7f87('0x38')],_0x519328[_0x7f87('0x41')]));_0x5351de[_0x7f87('0x40')][_0x7f87('0x5c')]=_0x4f6d34['id'];if(_0x533dcc[_0x7f87('0x38')][_0x7f87('0x44')]){_0x5351de[_0x7f87('0x40')]=_['merge'](_0x5351de[_0x7f87('0x40')],{'$or':_[_0x7f87('0x32')](_0x5351de[_0x7f87('0x3a')],function(_0x503d81){var _0x30d4d4={};_0x30d4d4[_0x503d81]={'$like':'%'+_0x533dcc['query']['filter']+'%'};return _0x30d4d4;})});}_0x5351de=_[_0x7f87('0x45')]({},_0x5351de,_0x533dcc[_0x7f87('0x46')]);return db[_0x7f87('0x5d')][_0x7f87('0x5e')](_0x5351de);}})[_0x7f87('0x29')](function(_0x10e92e){if(_0x10e92e){return db[_0x7f87('0x5f')]['findAndCountAll']({'where':{'id':_[_0x7f87('0x32')](_0x10e92e,_0x7f87('0x60')),'role':_0x7f87('0x61')},'attributes':['id',_0x7f87('0x2f'),_0x7f87('0x62'),'updatedAt',_0x7f87('0x63')]});}})['then'](function(_0x188dc7){if(_0x188dc7){return{'count':_0x188dc7[_0x7f87('0x23')],'rows':_[_0x7f87('0x32')](_0x188dc7['rows'],function(_0x1ba389){return{'membername':_0x1ba389[_0x7f87('0x2f')],'UserId':_0x1ba389['id'],'queue_name':_0x5875b7['name'],'WhatsappQueueId':_0x5875b7['id'],'interface':util[_0x7f87('0x64')](_0x7f87('0x65'),_0x7f87('0x66'),_0x1ba389[_0x7f87('0x2f')]),'penalty':0x0,'paused':_0x1ba389['whatsappPause'],'createdAt':_0x1ba389[_0x7f87('0x63')],'updatedAt':_0x1ba389['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7f87('0x29')](respondWithFilteredResult(_0x35678c,_0x5351de))[_0x7f87('0x4c')](handleError(_0x35678c,null));};exports[_0x7f87('0x67')]=function(_0x5b4f55,_0x5cf765,_0x3ad04c){var _0x4a3864={};var _0x5699c7={};var _0x56f880;var _0x303953;return db[_0x7f87('0x33')][_0x7f87('0x5a')]({'where':{'id':_0x5b4f55[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x5cf765,null))[_0x7f87('0x29')](function(_0x19ca76){if(_0x19ca76){_0x56f880=_0x19ca76;_0x5699c7[_0x7f87('0x37')]=_[_0x7f87('0x4b')](db['Team'][_0x7f87('0x34')]);_0x5699c7[_0x7f87('0x38')]=_[_0x7f87('0x4b')](_0x5b4f55[_0x7f87('0x38')]);_0x5699c7[_0x7f87('0x41')]=_[_0x7f87('0x39')](_0x5699c7[_0x7f87('0x37')],_0x5699c7['query']);_0x4a3864[_0x7f87('0x3a')]=_[_0x7f87('0x39')](_0x5699c7['model'],qs['fields'](_0x5b4f55[_0x7f87('0x38')][_0x7f87('0x3b')]));_0x4a3864[_0x7f87('0x3a')]=_0x4a3864['attributes'][_0x7f87('0x3c')]?_0x4a3864[_0x7f87('0x3a')]:_0x5699c7['model'];_0x4a3864['order']=qs[_0x7f87('0x3f')](_0x5b4f55['query']['sort']);_0x4a3864['where']=qs[_0x7f87('0x41')](_[_0x7f87('0x42')](_0x5b4f55[_0x7f87('0x38')],_0x5699c7[_0x7f87('0x41')]));if(_0x5b4f55[_0x7f87('0x38')][_0x7f87('0x44')]){_0x4a3864[_0x7f87('0x40')]=_['merge'](_0x4a3864[_0x7f87('0x40')],{'$or':_[_0x7f87('0x32')](_0x4a3864['attributes'],function(_0x523266){var _0x7e15ff={};_0x7e15ff[_0x523266]={'$like':'%'+_0x5b4f55[_0x7f87('0x38')]['filter']+'%'};return _0x7e15ff;})});}_0x4a3864=_[_0x7f87('0x45')]({},_0x4a3864,_0x5b4f55[_0x7f87('0x46')]);return _0x56f880[_0x7f87('0x67')](_0x4a3864);}})[_0x7f87('0x29')](function(_0x36f931){if(_0x36f931){_0x303953=_0x36f931[_0x7f87('0x3c')];if(!_0x5b4f55['query']['hasOwnProperty']('nolimit')){_0x4a3864[_0x7f87('0x22')]=qs['limit'](_0x5b4f55[_0x7f87('0x38')][_0x7f87('0x22')]);_0x4a3864[_0x7f87('0x20')]=qs[_0x7f87('0x20')](_0x5b4f55[_0x7f87('0x38')]['offset']);}return _0x56f880[_0x7f87('0x67')](_0x4a3864);}})[_0x7f87('0x29')](function(_0x1d9ba5){if(_0x1d9ba5){return _0x1d9ba5?{'count':_0x303953,'rows':_0x1d9ba5}:null;}})['then'](respondWithResult(_0x5cf765,null))['catch'](handleError(_0x5cf765,null));};exports[_0x7f87('0x68')]=function(_0x272914,_0x20217a,_0x20b160){var _0x3e68d=_0x272914['body'][_0x7f87('0x69')];return db[_0x7f87('0x6a')][_0x7f87('0x5e')]({'where':{'id':_0x3e68d},'attributes':['id'],'include':[{'model':db[_0x7f87('0x5f')],'as':_0x7f87('0x6b'),'attributes':['id',_0x7f87('0x2f'),_0x7f87('0x6c'),_0x7f87('0x6d'),_0x7f87('0x6e')],'raw':!![]}]})[_0x7f87('0x29')](function(_0x3fbdfd){if(_0x3fbdfd){var _0x2eeb9a=_[_0x7f87('0x6f')](_0x3fbdfd,function(_0xf7e549){var _0x4e436a=_0xf7e549['get']({'plain':!![]});return _0x4e436a[_0x7f87('0x6b')];});return db['WhatsappQueue'][_0x7f87('0x57')]({'where':{'id':_0x272914[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](function(_0xee5f78){return db['sequelize']['transaction'](function(_0x5a6fa1){return _0xee5f78['addTeams'](_0x3e68d,{'transaction':_0x5a6fa1})[_0x7f87('0x29')](function(){return BPromise['each'](_0x2eeb9a,function(_0x23f802){return db[_0x7f87('0x5d')]['findOrCreate']({'where':{'UserId':_0x23f802['id'],'WhatsappQueueId':_0x272914['params']['id']},'transaction':_0x5a6fa1});});})['then'](function(){_0x2eeb9a[_0x7f87('0x70')](function(_0x562e7a){socket[_0x7f87('0x71')](_0x7f87('0x72'),{'UserId':_0x562e7a['id'],'WhatsappQueueId':_0xee5f78['id']});});});});});}})[_0x7f87('0x29')](respondWithStatusCode(_0x20217a,null))[_0x7f87('0x4c')](handleError(_0x20217a,null));};exports[_0x7f87('0x73')]=function(_0x13edcb,_0x3ac438,_0x1f94ce){return db['Team'][_0x7f87('0x5e')]({'where':{'id':_0x13edcb[_0x7f87('0x38')][_0x7f87('0x69')]},'attributes':['id'],'include':[{'model':db[_0x7f87('0x5f')],'as':_0x7f87('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ac438,null))[_0x7f87('0x29')](function(_0x3dd810){var _0x20193c=_[_0x7f87('0x32')](_0x3dd810,'id');var _0xc35d59=[];var _0x1df3ce=[];var _0x2aa91a=squel[_0x7f87('0x74')]();_0x2aa91a[_0x7f87('0x75')](_0x7f87('0x76'))[_0x7f87('0x77')](_0x7f87('0x78'),'tq')[_0x7f87('0x79')](_0x7f87('0x7a'),'ut',_0x7f87('0x7b'))[_0x7f87('0x40')](_0x7f87('0x7c'),_0x13edcb[_0x7f87('0x5b')]['id']);for(var _0xfa6eb=0x0;_0xfa6eb<_0x3dd810['length'];_0xfa6eb+=0x1){let _0x1563a9=_0x3dd810[_0xfa6eb];for(var _0x3960ad=0x0;_0x3960ad<_0x1563a9[_0x7f87('0x6b')][_0x7f87('0x3c')];_0x3960ad+=0x1){let _0xc63741=_0x1563a9['Agents'][_0x3960ad];var _0x3d007b=_0x2aa91a['clone']();_0x3d007b[_0x7f87('0x40')](_0x7f87('0x7d'),_0xc63741['id']);_0x1df3ce[_0x7f87('0x7e')](db['sequelize'][_0x7f87('0x38')](_0x3d007b[_0x7f87('0x7f')](),{'type':db['sequelize'][_0x7f87('0x80')]['SELECT']})[_0x7f87('0x29')](function(_0x58ff64){if(_0x58ff64['length']===0x1){return _0xc63741['id'];}else{var _0x44a4cf=_[_0x7f87('0x81')](_[_0x7f87('0x32')](_0x58ff64,_0x7f87('0x82')),function(_0x32bb10){return _[_0x7f87('0x83')](_0x20193c,_0x32bb10);});if(_0x44a4cf){return _0xc63741['id'];}}}));}}return BPromise[_0x7f87('0x84')](_0x1df3ce)[_0x7f87('0x29')](function(_0xc28612){_0xc35d59=_(_0xc35d59)[_0x7f87('0x85')](_0xc28612)[_0x7f87('0x86')]()['value']();return db[_0x7f87('0x33')]['find']({'where':{'id':_0x13edcb[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](function(_0x4cf8af){return db[_0x7f87('0x87')][_0x7f87('0x88')](function(_0x2f8d95){return _0x4cf8af[_0x7f87('0x73')](_0x13edcb[_0x7f87('0x38')]['ids'],{'transaction':_0x2f8d95})[_0x7f87('0x29')](function(){if(!_[_0x7f87('0x89')](_0xc35d59)){return _0x4cf8af[_0x7f87('0x8a')](_0xc35d59,{'transaction':_0x2f8d95});}})[_0x7f87('0x29')](function(){_0xc35d59[_0x7f87('0x70')](function(_0x5ddc1e){socket[_0x7f87('0x71')]('userWhatsappQueue:remove',{'UserId':_0x5ddc1e,'WhatsappQueueId':_0x4cf8af['id']});});});});});});})[_0x7f87('0x29')](respondWithStatusCode(_0x3ac438,null))[_0x7f87('0x4c')](handleError(_0x3ac438,null));};exports[_0x7f87('0x8b')]=function(_0x4d2188,_0x5778f0,_0x5efb0b){return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x4d2188['params']['id']}})['then'](handleEntityNotFound(_0x5778f0,null))[_0x7f87('0x29')](function(_0x3a7b7c){if(_0x3a7b7c){return _0x3a7b7c[_0x7f87('0x8b')](_0x4d2188['body'][_0x7f87('0x69')],_[_0x7f87('0x8c')](_0x4d2188['body'],['ids','id'])||{})[_0x7f87('0x8d')](function(_0x468360){for(var _0x5f1fdf=0x0;_0x5f1fdf<_0x4d2188[_0x7f87('0x4e')][_0x7f87('0x69')][_0x7f87('0x3c')];_0x5f1fdf+=0x1){socket[_0x7f87('0x71')]('userWhatsappQueue:save',{'UserId':Number(_0x4d2188[_0x7f87('0x4e')]['ids'][_0x5f1fdf]),'WhatsappQueueId':Number(_0x4d2188[_0x7f87('0x5b')]['id'])});}return _0x468360;});}})[_0x7f87('0x29')](respondWithResult(_0x5778f0,null))[_0x7f87('0x4c')](handleError(_0x5778f0,null));};exports['removeAgents']=function(_0x12faff,_0x237f8a,_0x53f658){return db[_0x7f87('0x33')][_0x7f87('0x57')]({'where':{'id':_0x12faff['params']['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x237f8a,null))[_0x7f87('0x29')](function(_0x4b807c){if(_0x4b807c){return _0x4b807c[_0x7f87('0x8a')](_0x12faff[_0x7f87('0x38')]['ids'])[_0x7f87('0x29')](function(){if(_['isArray'](_0x12faff[_0x7f87('0x38')][_0x7f87('0x69')])){for(var _0x1c5e08=0x0;_0x1c5e08<_0x12faff['query'][_0x7f87('0x69')][_0x7f87('0x3c')];_0x1c5e08+=0x1){socket['emit'](_0x7f87('0x8e'),{'UserId':Number(_0x12faff[_0x7f87('0x38')]['ids'][_0x1c5e08]),'WhatsappQueueId':Number(_0x12faff[_0x7f87('0x5b')]['id'])});}}else{socket[_0x7f87('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x12faff[_0x7f87('0x38')][_0x7f87('0x69')]),'WhatsappQueueId':Number(_0x12faff[_0x7f87('0x5b')]['id'])});}});}})[_0x7f87('0x29')](respondWithStatusCode(_0x237f8a,null))['catch'](handleError(_0x237f8a,null));};exports[_0x7f87('0x8f')]=function(_0x514222,_0x470540,_0x4bba4a){var _0x5c14f0={};var _0x5dc53d={};var _0x1cacc8;var _0x387f81;return db[_0x7f87('0x33')][_0x7f87('0x5a')]({'where':{'id':_0x514222[_0x7f87('0x5b')]['id']}})[_0x7f87('0x29')](handleEntityNotFound(_0x470540,null))[_0x7f87('0x29')](function(_0x1536dc){if(_0x1536dc){_0x1cacc8=_0x1536dc;_0x5dc53d['model']=_['keys'](db[_0x7f87('0x5f')][_0x7f87('0x34')]);_0x5dc53d[_0x7f87('0x38')]=_[_0x7f87('0x4b')](_0x514222['query']);_0x5dc53d[_0x7f87('0x41')]=_[_0x7f87('0x39')](_0x5dc53d[_0x7f87('0x37')],_0x5dc53d[_0x7f87('0x38')]);_0x5c14f0[_0x7f87('0x3a')]=_[_0x7f87('0x39')](_0x5dc53d[_0x7f87('0x37')],qs[_0x7f87('0x3b')](_0x514222['query'][_0x7f87('0x3b')]));_0x5c14f0['attributes']=_0x5c14f0[_0x7f87('0x3a')][_0x7f87('0x3c')]?_0x5c14f0[_0x7f87('0x3a')]:_0x5dc53d[_0x7f87('0x37')];_0x5c14f0[_0x7f87('0x3e')]=qs[_0x7f87('0x3f')](_0x514222['query'][_0x7f87('0x3f')]);_0x5c14f0[_0x7f87('0x40')]=qs[_0x7f87('0x41')](_['pick'](_0x514222[_0x7f87('0x38')],_0x5dc53d['filters']));if(_0x514222[_0x7f87('0x38')][_0x7f87('0x44')]){_0x5c14f0[_0x7f87('0x40')]=_[_0x7f87('0x45')](_0x5c14f0[_0x7f87('0x40')],{'$or':_[_0x7f87('0x32')](_0x5c14f0['attributes'],function(_0x45babe){var _0x447f72={};_0x447f72[_0x45babe]={'$like':'%'+_0x514222['query'][_0x7f87('0x44')]+'%'};return _0x447f72;})});}_0x5c14f0=_[_0x7f87('0x45')]({},_0x5c14f0,_0x514222['options']);return _0x1cacc8[_0x7f87('0x8f')](_0x5c14f0);}})[_0x7f87('0x29')](function(_0x4bf498){if(_0x4bf498){_0x387f81=_0x4bf498[_0x7f87('0x3c')];if(!_0x514222['query'][_0x7f87('0x90')](_0x7f87('0x3d'))){_0x5c14f0[_0x7f87('0x22')]=qs['limit'](_0x514222[_0x7f87('0x38')][_0x7f87('0x22')]);_0x5c14f0[_0x7f87('0x20')]=qs['offset'](_0x514222['query'][_0x7f87('0x20')]);}return _0x1cacc8[_0x7f87('0x8f')](_0x5c14f0);}})['then'](function(_0x1e3bb2){if(_0x1e3bb2){return _0x1e3bb2?{'count':_0x387f81,'rows':_0x1e3bb2}:null;}})[_0x7f87('0x29')](respondWithResult(_0x470540,null))['catch'](handleError(_0x470540,null));}; \ No newline at end of file +var _0x15ea=['util','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','sendStatus','name','send','WhatsappQueue','rawAttributes','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','intersection','includeAll','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','includes','all','union','value','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x29fdd0,_0x4afcaf){var _0x4af6d4=function(_0x5311d4){while(--_0x5311d4){_0x29fdd0['push'](_0x29fdd0['shift']());}};_0x4af6d4(++_0x4afcaf);}(_0x15ea,0x108));var _0xa15e=function(_0x484b5d,_0x155128){_0x484b5d=_0x484b5d-0x0;var _0x36a0ed=_0x15ea[_0x484b5d];return _0x36a0ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa15e('0x0'));var zipdir=require(_0xa15e('0x1'));var jsonpatch=require(_0xa15e('0x2'));var rp=require(_0xa15e('0x3'));var moment=require(_0xa15e('0x4'));var BPromise=require(_0xa15e('0x5'));var Mustache=require('mustache');var util=require(_0xa15e('0x6'));var path=require('path');var sox=require(_0xa15e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa15e('0x8'));var _=require('lodash');var squel=require(_0xa15e('0x9'));var crypto=require(_0xa15e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa15e('0xb'));var toCsv=require(_0xa15e('0xc'));var querystring=require('querystring');var Papa=require(_0xa15e('0xd'));var Redis=require(_0xa15e('0xe'));var authService=require(_0xa15e('0xf'));var qs=require(_0xa15e('0x10'));var as=require(_0xa15e('0x11'));var hardwareService=require(_0xa15e('0x12'));var logger=require('../../config/logger')(_0xa15e('0x13'));var utils=require('../../config/utils');var config=require(_0xa15e('0x14'));var licenseUtil=require(_0xa15e('0x15'));var db=require(_0xa15e('0x16'))['db'];config[_0xa15e('0x17')]=_[_0xa15e('0x18')](config[_0xa15e('0x17')],{'host':_0xa15e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa15e('0x17')]));require(_0xa15e('0x1a'))['register'](socket);function respondWithStatusCode(_0x5343fd,_0x520cca){_0x520cca=_0x520cca||0xcc;return function(_0x4eb338){if(_0x4eb338){return _0x5343fd['sendStatus'](_0x520cca);}return _0x5343fd[_0xa15e('0x1b')](_0x520cca)['end']();};}function respondWithResult(_0x9ed710,_0x47c327){_0x47c327=_0x47c327||0xc8;return function(_0x39e67a){if(_0x39e67a){return _0x9ed710['status'](_0x47c327)[_0xa15e('0x1c')](_0x39e67a);}};}function respondWithFilteredResult(_0x2ddccb,_0x17ee36){return function(_0x4eb87e){if(_0x4eb87e){var _0x431baa=typeof _0x17ee36[_0xa15e('0x1d')]==='undefined'&&typeof _0x17ee36[_0xa15e('0x1e')]===_0xa15e('0x1f');var _0x1a85f1=_0x4eb87e[_0xa15e('0x20')];var _0x3dd36a=_0x431baa?0x0:_0x17ee36['offset'];var _0x52047e=_0x431baa?_0x4eb87e[_0xa15e('0x20')]:_0x17ee36['offset']+_0x17ee36['limit'];var _0x133301;if(_0x52047e>=_0x1a85f1){_0x52047e=_0x1a85f1;_0x133301=0xc8;}else{_0x133301=0xce;}_0x2ddccb[_0xa15e('0x1b')](_0x133301);return _0x2ddccb[_0xa15e('0x21')]('Content-Range',_0x3dd36a+'-'+_0x52047e+'/'+_0x1a85f1)[_0xa15e('0x1c')](_0x4eb87e);}return null;};}function patchUpdates(_0x449bcd){return function(_0x755eaa){try{jsonpatch[_0xa15e('0x22')](_0x755eaa,_0x449bcd,!![]);}catch(_0x591acf){return BPromise[_0xa15e('0x23')](_0x591acf);}return _0x755eaa[_0xa15e('0x24')]();};}function saveUpdates(_0x3c9903,_0x5cd4d7){return function(_0x246caa){if(_0x246caa){return _0x246caa[_0xa15e('0x25')](_0x3c9903)[_0xa15e('0x26')](function(_0x1f572d){return _0x1f572d;});}return null;};}function removeEntity(_0x17ccd0,_0x5e2894){return function(_0x3e3073){if(_0x3e3073){return _0x3e3073[_0xa15e('0x27')]()[_0xa15e('0x26')](function(){var _0x39573e=_0x3e3073[_0xa15e('0x28')]({'plain':!![]});var _0x40873d=_0xa15e('0x29');return db[_0xa15e('0x2a')][_0xa15e('0x27')]({'where':{'type':_0x40873d,'resourceId':_0x39573e['id']}})[_0xa15e('0x26')](function(){return _0x3e3073;});})[_0xa15e('0x26')](function(){_0x17ccd0['status'](0xcc)[_0xa15e('0x2b')]();});}};}function handleEntityNotFound(_0x5d8be3,_0x24b0e3){return function(_0x159132){if(!_0x159132){_0x5d8be3[_0xa15e('0x2c')](0x194);}return _0x159132;};}function handleError(_0x300a17,_0x383b8f){_0x383b8f=_0x383b8f||0x1f4;return function(_0x492019){logger['error'](_0x492019['stack']);if(_0x492019[_0xa15e('0x2d')]){delete _0x492019[_0xa15e('0x2d')];}_0x300a17[_0xa15e('0x1b')](_0x383b8f)[_0xa15e('0x2e')](_0x492019);};}exports['index']=function(_0x435e4c,_0x21e6d0){var _0x5980c4={},_0xa988c={},_0x30c570={'count':0x0,'rows':[]};var _0x5a7ea5=_['map'](db[_0xa15e('0x2f')][_0xa15e('0x30')],function(_0x49cb42){return{'name':_0x49cb42['fieldName'],'type':_0x49cb42['type'][_0xa15e('0x31')]};});_0xa988c[_0xa15e('0x32')]=_[_0xa15e('0x33')](_0x5a7ea5,_0xa15e('0x2d'));_0xa988c[_0xa15e('0x34')]=_[_0xa15e('0x35')](_0x435e4c[_0xa15e('0x34')]);_0xa988c[_0xa15e('0x36')]=_['intersection'](_0xa988c[_0xa15e('0x32')],_0xa988c[_0xa15e('0x34')]);_0x5980c4[_0xa15e('0x37')]=_['intersection'](_0xa988c[_0xa15e('0x32')],qs['fields'](_0x435e4c[_0xa15e('0x34')][_0xa15e('0x38')]));_0x5980c4[_0xa15e('0x37')]=_0x5980c4['attributes'][_0xa15e('0x39')]?_0x5980c4['attributes']:_0xa988c['model'];if(!_0x435e4c[_0xa15e('0x34')][_0xa15e('0x3a')]('nolimit')){_0x5980c4[_0xa15e('0x1e')]=qs[_0xa15e('0x1e')](_0x435e4c[_0xa15e('0x34')][_0xa15e('0x1e')]);_0x5980c4[_0xa15e('0x1d')]=qs[_0xa15e('0x1d')](_0x435e4c['query'][_0xa15e('0x1d')]);}_0x5980c4[_0xa15e('0x3b')]=qs[_0xa15e('0x3c')](_0x435e4c[_0xa15e('0x34')][_0xa15e('0x3c')]);_0x5980c4['where']=qs[_0xa15e('0x36')](_[_0xa15e('0x3d')](_0x435e4c[_0xa15e('0x34')],_0xa988c[_0xa15e('0x36')]),_0x5a7ea5);if(_0x435e4c[_0xa15e('0x34')][_0xa15e('0x3e')]){_0x5980c4[_0xa15e('0x3f')]=_[_0xa15e('0x40')](_0x5980c4[_0xa15e('0x3f')],{'$or':_['map'](_0x5a7ea5,function(_0x571c7f){if(_0x571c7f['type']!==_0xa15e('0x41')){var _0xb66682={};_0xb66682[_0x571c7f['name']]={'$like':'%'+_0x435e4c['query'][_0xa15e('0x3e')]+'%'};return _0xb66682;}})});}_0x5980c4=_[_0xa15e('0x40')]({},_0x5980c4,_0x435e4c[_0xa15e('0x42')]);var _0x3c2ddf={'where':_0x5980c4[_0xa15e('0x3f')]};return db[_0xa15e('0x2f')][_0xa15e('0x20')](_0x3c2ddf)[_0xa15e('0x26')](function(_0x19fc6e){_0x30c570['count']=_0x19fc6e;if(_0x435e4c['query']['includeAll']){_0x5980c4[_0xa15e('0x43')]=[{'all':!![]}];}return db[_0xa15e('0x2f')][_0xa15e('0x44')](_0x5980c4);})[_0xa15e('0x26')](function(_0x3db5a4){_0x30c570[_0xa15e('0x45')]=_0x3db5a4;return _0x30c570;})[_0xa15e('0x26')](respondWithFilteredResult(_0x21e6d0,_0x5980c4))['catch'](handleError(_0x21e6d0,null));};exports['show']=function(_0x1941bb,_0x2cde86){var _0x2d4956={'raw':!![],'where':{'id':_0x1941bb[_0xa15e('0x46')]['id']}},_0x46ae3c={};_0x46ae3c[_0xa15e('0x32')]=_[_0xa15e('0x35')](db[_0xa15e('0x2f')][_0xa15e('0x30')]);_0x46ae3c[_0xa15e('0x34')]=_[_0xa15e('0x35')](_0x1941bb['query']);_0x46ae3c[_0xa15e('0x36')]=_['intersection'](_0x46ae3c[_0xa15e('0x32')],_0x46ae3c[_0xa15e('0x34')]);_0x2d4956['attributes']=_[_0xa15e('0x47')](_0x46ae3c['model'],qs[_0xa15e('0x38')](_0x1941bb[_0xa15e('0x34')]['fields']));_0x2d4956[_0xa15e('0x37')]=_0x2d4956['attributes'][_0xa15e('0x39')]?_0x2d4956['attributes']:_0x46ae3c[_0xa15e('0x32')];if(_0x1941bb[_0xa15e('0x34')][_0xa15e('0x48')]){_0x2d4956['include']=[{'all':!![]}];}_0x2d4956=_['merge']({},_0x2d4956,_0x1941bb['options']);return db[_0xa15e('0x2f')][_0xa15e('0x49')](_0x2d4956)[_0xa15e('0x26')](handleEntityNotFound(_0x2cde86,null))[_0xa15e('0x26')](respondWithResult(_0x2cde86,null))[_0xa15e('0x4a')](handleError(_0x2cde86,null));};exports[_0xa15e('0x4b')]=function(_0x54a703,_0x134aa6){return db[_0xa15e('0x2f')][_0xa15e('0x4b')](_0x54a703[_0xa15e('0x4c')],{})['then'](function(_0x19744b){var _0x478e34=_0x54a703['user']['get']({'plain':!![]});if(!_0x478e34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x478e34[_0xa15e('0x4d')]==='user'){var _0x145b06=_0x19744b['get']({'plain':!![]});var _0x5d9743=_0xa15e('0x29');return db[_0xa15e('0x4e')][_0xa15e('0x49')]({'where':{'name':_0x5d9743,'userProfileId':_0x478e34[_0xa15e('0x4f')]},'raw':!![]})[_0xa15e('0x26')](function(_0x5326f7){if(_0x5326f7&&_0x5326f7[_0xa15e('0x50')]===0x0){return db[_0xa15e('0x2a')][_0xa15e('0x4b')]({'name':_0x145b06[_0xa15e('0x2d')],'resourceId':_0x145b06['id'],'type':_0x5326f7[_0xa15e('0x2d')],'sectionId':_0x5326f7['id']},{})[_0xa15e('0x26')](function(){return _0x19744b;});}else{return _0x19744b;}})[_0xa15e('0x4a')](function(_0x342a06){logger[_0xa15e('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x342a06);throw _0x342a06;});}return _0x19744b;})[_0xa15e('0x26')](respondWithResult(_0x134aa6,0xc9))[_0xa15e('0x4a')](handleError(_0x134aa6,null));};exports[_0xa15e('0x25')]=function(_0x3dac89,_0x2e78fa){if(_0x3dac89[_0xa15e('0x4c')]['id']){delete _0x3dac89[_0xa15e('0x4c')]['id'];}return db[_0xa15e('0x2f')][_0xa15e('0x49')]({'where':{'id':_0x3dac89[_0xa15e('0x46')]['id']}})[_0xa15e('0x26')](handleEntityNotFound(_0x2e78fa,null))['then'](saveUpdates(_0x3dac89[_0xa15e('0x4c')],null))['then'](respondWithResult(_0x2e78fa,null))[_0xa15e('0x4a')](handleError(_0x2e78fa,null));};exports[_0xa15e('0x27')]=function(_0x4deeda,_0x302c83){return db[_0xa15e('0x2f')][_0xa15e('0x49')]({'where':{'id':_0x4deeda[_0xa15e('0x46')]['id']}})['then'](handleEntityNotFound(_0x302c83,null))['then'](removeEntity(_0x302c83,null))['catch'](handleError(_0x302c83,null));};exports['describe']=function(_0xe90fde,_0x2cd18b){return db['WhatsappQueue'][_0xa15e('0x52')]()[_0xa15e('0x26')](respondWithResult(_0x2cd18b,null))[_0xa15e('0x4a')](handleError(_0x2cd18b,null));};exports[_0xa15e('0x53')]=function(_0x517121,_0x207649,_0x53fb5f){var _0x5091fe={'raw':!![],'where':{}},_0x105290={},_0x22ffc0;return db['WhatsappQueue'][_0xa15e('0x54')]({'where':{'id':_0x517121[_0xa15e('0x46')]['id']}})[_0xa15e('0x26')](handleEntityNotFound(_0x207649,null))[_0xa15e('0x26')](function(_0x27f77c){if(_0x27f77c){_0x22ffc0=_0x27f77c[_0xa15e('0x28')]({'plain':!![]});_0x105290['model']=_['keys'](db[_0xa15e('0x55')][_0xa15e('0x30')]);_0x105290['query']=_[_0xa15e('0x35')](_0x517121['query']);_0x105290['filters']=_['intersection'](_0x105290[_0xa15e('0x32')],_0x105290['query']);_0x5091fe[_0xa15e('0x37')]=_[_0xa15e('0x47')](_0x105290[_0xa15e('0x32')],qs[_0xa15e('0x38')](_0x517121[_0xa15e('0x34')]['fields']));_0x5091fe[_0xa15e('0x37')]=_0x5091fe[_0xa15e('0x37')]['length']?_0x5091fe[_0xa15e('0x37')]:_0x105290['model'];if(!_0x517121[_0xa15e('0x34')]['hasOwnProperty'](_0xa15e('0x56'))){_0x5091fe[_0xa15e('0x1e')]=qs[_0xa15e('0x1e')](_0x517121[_0xa15e('0x34')][_0xa15e('0x1e')]);_0x5091fe[_0xa15e('0x1d')]=qs['offset'](_0x517121[_0xa15e('0x34')]['offset']);}_0x5091fe['order']=qs[_0xa15e('0x3c')](_0x517121['query'][_0xa15e('0x3c')]);_0x5091fe[_0xa15e('0x3f')]=qs[_0xa15e('0x36')](_[_0xa15e('0x3d')](_0x517121['query'],_0x105290['filters']));_0x5091fe['where'][_0xa15e('0x57')]=_0x27f77c['id'];if(_0x517121[_0xa15e('0x34')][_0xa15e('0x3e')]){_0x5091fe[_0xa15e('0x3f')]=_[_0xa15e('0x40')](_0x5091fe[_0xa15e('0x3f')],{'$or':_[_0xa15e('0x33')](_0x5091fe[_0xa15e('0x37')],function(_0x8fece4){var _0x3f143d={};_0x3f143d[_0x8fece4]={'$like':'%'+_0x517121[_0xa15e('0x34')]['filter']+'%'};return _0x3f143d;})});}_0x5091fe=_[_0xa15e('0x40')]({},_0x5091fe,_0x517121[_0xa15e('0x42')]);return db[_0xa15e('0x55')]['findAll'](_0x5091fe);}})[_0xa15e('0x26')](function(_0x11d4e0){if(_0x11d4e0){return db[_0xa15e('0x58')][_0xa15e('0x59')]({'where':{'id':_[_0xa15e('0x33')](_0x11d4e0,'UserId'),'role':_0xa15e('0x5a')},'attributes':['id',_0xa15e('0x2d'),_0xa15e('0x5b'),_0xa15e('0x5c'),'createdAt']});}})['then'](function(_0xb9078a){if(_0xb9078a){return{'count':_0xb9078a[_0xa15e('0x20')],'rows':_['map'](_0xb9078a[_0xa15e('0x45')],function(_0x447d17){return{'membername':_0x447d17['name'],'UserId':_0x447d17['id'],'queue_name':_0x22ffc0[_0xa15e('0x2d')],'WhatsappQueueId':_0x22ffc0['id'],'interface':util[_0xa15e('0x5d')](_0xa15e('0x5e'),_0xa15e('0x5f'),_0x447d17[_0xa15e('0x2d')]),'penalty':0x0,'paused':_0x447d17[_0xa15e('0x5b')],'createdAt':_0x447d17[_0xa15e('0x60')],'updatedAt':_0x447d17[_0xa15e('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa15e('0x26')](respondWithFilteredResult(_0x207649,_0x5091fe))[_0xa15e('0x4a')](handleError(_0x207649,null));};exports[_0xa15e('0x61')]=function(_0x437460,_0x30cc44,_0x10c8fc){var _0x2a409b={};var _0x5f0482={};var _0x462dcf;var _0x2e2724;return db[_0xa15e('0x2f')][_0xa15e('0x54')]({'where':{'id':_0x437460[_0xa15e('0x46')]['id']}})['then'](handleEntityNotFound(_0x30cc44,null))[_0xa15e('0x26')](function(_0x485092){if(_0x485092){_0x462dcf=_0x485092;_0x5f0482[_0xa15e('0x32')]=_[_0xa15e('0x35')](db[_0xa15e('0x62')][_0xa15e('0x30')]);_0x5f0482['query']=_['keys'](_0x437460[_0xa15e('0x34')]);_0x5f0482[_0xa15e('0x36')]=_[_0xa15e('0x47')](_0x5f0482[_0xa15e('0x32')],_0x5f0482[_0xa15e('0x34')]);_0x2a409b[_0xa15e('0x37')]=_['intersection'](_0x5f0482[_0xa15e('0x32')],qs[_0xa15e('0x38')](_0x437460['query']['fields']));_0x2a409b['attributes']=_0x2a409b[_0xa15e('0x37')][_0xa15e('0x39')]?_0x2a409b[_0xa15e('0x37')]:_0x5f0482[_0xa15e('0x32')];_0x2a409b[_0xa15e('0x3b')]=qs[_0xa15e('0x3c')](_0x437460[_0xa15e('0x34')][_0xa15e('0x3c')]);_0x2a409b['where']=qs[_0xa15e('0x36')](_[_0xa15e('0x3d')](_0x437460[_0xa15e('0x34')],_0x5f0482[_0xa15e('0x36')]));if(_0x437460[_0xa15e('0x34')][_0xa15e('0x3e')]){_0x2a409b[_0xa15e('0x3f')]=_[_0xa15e('0x40')](_0x2a409b['where'],{'$or':_[_0xa15e('0x33')](_0x2a409b[_0xa15e('0x37')],function(_0x4946e4){var _0x348910={};_0x348910[_0x4946e4]={'$like':'%'+_0x437460[_0xa15e('0x34')]['filter']+'%'};return _0x348910;})});}_0x2a409b=_[_0xa15e('0x40')]({},_0x2a409b,_0x437460[_0xa15e('0x42')]);return _0x462dcf[_0xa15e('0x61')](_0x2a409b);}})[_0xa15e('0x26')](function(_0x2dee8e){if(_0x2dee8e){_0x2e2724=_0x2dee8e[_0xa15e('0x39')];if(!_0x437460[_0xa15e('0x34')][_0xa15e('0x3a')]('nolimit')){_0x2a409b[_0xa15e('0x1e')]=qs[_0xa15e('0x1e')](_0x437460[_0xa15e('0x34')][_0xa15e('0x1e')]);_0x2a409b[_0xa15e('0x1d')]=qs[_0xa15e('0x1d')](_0x437460[_0xa15e('0x34')][_0xa15e('0x1d')]);}return _0x462dcf[_0xa15e('0x61')](_0x2a409b);}})[_0xa15e('0x26')](function(_0x5aa75c){if(_0x5aa75c){return _0x5aa75c?{'count':_0x2e2724,'rows':_0x5aa75c}:null;}})[_0xa15e('0x26')](respondWithResult(_0x30cc44,null))[_0xa15e('0x4a')](handleError(_0x30cc44,null));};exports[_0xa15e('0x63')]=function(_0x298deb,_0x5f4fa9,_0x594142){var _0x3a6d33=_0x298deb[_0xa15e('0x4c')]['ids'];return db[_0xa15e('0x62')][_0xa15e('0x44')]({'where':{'id':_0x3a6d33},'attributes':['id'],'include':[{'model':db[_0xa15e('0x58')],'as':_0xa15e('0x64'),'attributes':['id','name',_0xa15e('0x65'),_0xa15e('0x66'),'interface'],'raw':!![]}]})[_0xa15e('0x26')](function(_0x18526c){if(_0x18526c){var _0x2f9a28=_[_0xa15e('0x67')](_0x18526c,function(_0x166606){var _0x117ea8=_0x166606['get']({'plain':!![]});return _0x117ea8['Agents'];});return db[_0xa15e('0x2f')][_0xa15e('0x49')]({'where':{'id':_0x298deb['params']['id']}})[_0xa15e('0x26')](function(_0x1035cf){return db[_0xa15e('0x68')][_0xa15e('0x69')](function(_0x1b4092){return _0x1035cf['addTeams'](_0x3a6d33,{'transaction':_0x1b4092})[_0xa15e('0x26')](function(){return BPromise['each'](_0x2f9a28,function(_0x596556){return db[_0xa15e('0x55')][_0xa15e('0x6a')]({'where':{'UserId':_0x596556['id'],'WhatsappQueueId':_0x298deb[_0xa15e('0x46')]['id']},'transaction':_0x1b4092});});})['then'](function(){_0x2f9a28[_0xa15e('0x6b')](function(_0x3cd8f5){socket[_0xa15e('0x6c')](_0xa15e('0x6d'),{'UserId':_0x3cd8f5['id'],'WhatsappQueueId':_0x1035cf['id']});});});});});}})[_0xa15e('0x26')](respondWithStatusCode(_0x5f4fa9,null))[_0xa15e('0x4a')](handleError(_0x5f4fa9,null));};exports[_0xa15e('0x6e')]=function(_0xc88eb5,_0x1ee8bf,_0xce15e5){return db[_0xa15e('0x62')][_0xa15e('0x44')]({'where':{'id':_0xc88eb5[_0xa15e('0x34')][_0xa15e('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xa15e('0x58')],'as':_0xa15e('0x64'),'attributes':['id'],'raw':!![]}]})[_0xa15e('0x26')](handleEntityNotFound(_0x1ee8bf,null))[_0xa15e('0x26')](function(_0x13f9b1){var _0x57e409=_[_0xa15e('0x33')](_0x13f9b1,'id');var _0xf97502=[];var _0x1a0dbc=[];var _0x2132ec=squel[_0xa15e('0x70')]();_0x2132ec[_0xa15e('0x71')](_0xa15e('0x72'))[_0xa15e('0x73')](_0xa15e('0x74'),'tq')[_0xa15e('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa15e('0x76'),_0xc88eb5['params']['id']);for(var _0x4efcbd=0x0;_0x4efcbd<_0x13f9b1[_0xa15e('0x39')];_0x4efcbd+=0x1){let _0x40570e=_0x13f9b1[_0x4efcbd];for(var _0x367b70=0x0;_0x367b70<_0x40570e['Agents'][_0xa15e('0x39')];_0x367b70+=0x1){let _0x4e9da3=_0x40570e['Agents'][_0x367b70];var _0x2a56bd=_0x2132ec[_0xa15e('0x77')]();_0x2a56bd['where']('ut.UserId\x20=\x20?',_0x4e9da3['id']);_0x1a0dbc[_0xa15e('0x78')](db['sequelize'][_0xa15e('0x34')](_0x2a56bd['toString'](),{'type':db[_0xa15e('0x68')][_0xa15e('0x79')][_0xa15e('0x7a')]})[_0xa15e('0x26')](function(_0x299450){if(_0x299450['length']===0x1){return _0x4e9da3['id'];}else{var _0x3f215e=_[_0xa15e('0x7b')](_[_0xa15e('0x33')](_0x299450,'TeamId'),function(_0x3d6392){return _[_0xa15e('0x7c')](_0x57e409,_0x3d6392);});if(_0x3f215e){return _0x4e9da3['id'];}}}));}}return BPromise[_0xa15e('0x7d')](_0x1a0dbc)[_0xa15e('0x26')](function(_0x5a496f){_0xf97502=_(_0xf97502)[_0xa15e('0x7e')](_0x5a496f)['compact']()[_0xa15e('0x7f')]();return db['WhatsappQueue']['find']({'where':{'id':_0xc88eb5['params']['id']}})[_0xa15e('0x26')](function(_0xc3253){return db['sequelize']['transaction'](function(_0xc3b317){return _0xc3253[_0xa15e('0x6e')](_0xc88eb5[_0xa15e('0x34')][_0xa15e('0x6f')],{'transaction':_0xc3b317})[_0xa15e('0x26')](function(){if(!_['isEmpty'](_0xf97502)){return _0xc3253[_0xa15e('0x80')](_0xf97502,{'transaction':_0xc3b317});}})[_0xa15e('0x26')](function(){_0xf97502[_0xa15e('0x6b')](function(_0x432d65){socket[_0xa15e('0x6c')]('userWhatsappQueue:remove',{'UserId':_0x432d65,'WhatsappQueueId':_0xc3253['id']});});});});});});})['then'](respondWithStatusCode(_0x1ee8bf,null))[_0xa15e('0x4a')](handleError(_0x1ee8bf,null));};exports[_0xa15e('0x81')]=function(_0x28d330,_0x832db8,_0x166a46){return db[_0xa15e('0x2f')][_0xa15e('0x49')]({'where':{'id':_0x28d330[_0xa15e('0x46')]['id']}})[_0xa15e('0x26')](handleEntityNotFound(_0x832db8,null))[_0xa15e('0x26')](function(_0x3af131){if(_0x3af131){return _0x3af131[_0xa15e('0x81')](_0x28d330['body'][_0xa15e('0x6f')],_[_0xa15e('0x82')](_0x28d330[_0xa15e('0x4c')],[_0xa15e('0x6f'),'id'])||{})[_0xa15e('0x83')](function(_0x1dd9a8){for(var _0x181ebf=0x0;_0x181ebf<_0x28d330[_0xa15e('0x4c')][_0xa15e('0x6f')][_0xa15e('0x39')];_0x181ebf+=0x1){socket[_0xa15e('0x6c')](_0xa15e('0x6d'),{'UserId':Number(_0x28d330[_0xa15e('0x4c')]['ids'][_0x181ebf]),'WhatsappQueueId':Number(_0x28d330[_0xa15e('0x46')]['id'])});}return _0x1dd9a8;});}})[_0xa15e('0x26')](respondWithResult(_0x832db8,null))['catch'](handleError(_0x832db8,null));};exports[_0xa15e('0x80')]=function(_0x2a2208,_0x730eb0,_0x2316ac){return db['WhatsappQueue'][_0xa15e('0x49')]({'where':{'id':_0x2a2208[_0xa15e('0x46')]['id']}})[_0xa15e('0x26')](handleEntityNotFound(_0x730eb0,null))['then'](function(_0xe7eb90){if(_0xe7eb90){return _0xe7eb90['removeAgents'](_0x2a2208[_0xa15e('0x34')][_0xa15e('0x6f')])[_0xa15e('0x26')](function(){if(_[_0xa15e('0x84')](_0x2a2208[_0xa15e('0x34')][_0xa15e('0x6f')])){for(var _0x124bf7=0x0;_0x124bf7<_0x2a2208[_0xa15e('0x34')][_0xa15e('0x6f')][_0xa15e('0x39')];_0x124bf7+=0x1){socket[_0xa15e('0x6c')](_0xa15e('0x85'),{'UserId':Number(_0x2a2208[_0xa15e('0x34')]['ids'][_0x124bf7]),'WhatsappQueueId':Number(_0x2a2208[_0xa15e('0x46')]['id'])});}}else{socket[_0xa15e('0x6c')](_0xa15e('0x85'),{'UserId':Number(_0x2a2208[_0xa15e('0x34')][_0xa15e('0x6f')]),'WhatsappQueueId':Number(_0x2a2208[_0xa15e('0x46')]['id'])});}});}})[_0xa15e('0x26')](respondWithStatusCode(_0x730eb0,null))['catch'](handleError(_0x730eb0,null));};exports['getAgents']=function(_0x184c37,_0x26990,_0x5b1534){var _0x4d1a1d={};var _0x242b30={};var _0x18be05;var _0x15e19e;return db[_0xa15e('0x2f')][_0xa15e('0x54')]({'where':{'id':_0x184c37[_0xa15e('0x46')]['id']}})[_0xa15e('0x26')](handleEntityNotFound(_0x26990,null))[_0xa15e('0x26')](function(_0x2bbc6f){if(_0x2bbc6f){_0x18be05=_0x2bbc6f;_0x242b30['model']=_['keys'](db[_0xa15e('0x58')][_0xa15e('0x30')]);_0x242b30[_0xa15e('0x34')]=_['keys'](_0x184c37[_0xa15e('0x34')]);_0x242b30[_0xa15e('0x36')]=_['intersection'](_0x242b30[_0xa15e('0x32')],_0x242b30[_0xa15e('0x34')]);_0x4d1a1d['attributes']=_[_0xa15e('0x47')](_0x242b30['model'],qs['fields'](_0x184c37['query'][_0xa15e('0x38')]));_0x4d1a1d[_0xa15e('0x37')]=_0x4d1a1d[_0xa15e('0x37')]['length']?_0x4d1a1d['attributes']:_0x242b30['model'];_0x4d1a1d['order']=qs[_0xa15e('0x3c')](_0x184c37[_0xa15e('0x34')][_0xa15e('0x3c')]);_0x4d1a1d['where']=qs[_0xa15e('0x36')](_[_0xa15e('0x3d')](_0x184c37[_0xa15e('0x34')],_0x242b30[_0xa15e('0x36')]));if(_0x184c37['query'][_0xa15e('0x3e')]){_0x4d1a1d[_0xa15e('0x3f')]=_[_0xa15e('0x40')](_0x4d1a1d[_0xa15e('0x3f')],{'$or':_['map'](_0x4d1a1d[_0xa15e('0x37')],function(_0x1c4273){var _0x42d03b={};_0x42d03b[_0x1c4273]={'$like':'%'+_0x184c37['query'][_0xa15e('0x3e')]+'%'};return _0x42d03b;})});}_0x4d1a1d=_[_0xa15e('0x40')]({},_0x4d1a1d,_0x184c37[_0xa15e('0x42')]);return _0x18be05[_0xa15e('0x86')](_0x4d1a1d);}})[_0xa15e('0x26')](function(_0x40d887){if(_0x40d887){_0x15e19e=_0x40d887[_0xa15e('0x39')];if(!_0x184c37[_0xa15e('0x34')][_0xa15e('0x3a')](_0xa15e('0x56'))){_0x4d1a1d[_0xa15e('0x1e')]=qs[_0xa15e('0x1e')](_0x184c37[_0xa15e('0x34')][_0xa15e('0x1e')]);_0x4d1a1d[_0xa15e('0x1d')]=qs[_0xa15e('0x1d')](_0x184c37[_0xa15e('0x34')][_0xa15e('0x1d')]);}return _0x18be05[_0xa15e('0x86')](_0x4d1a1d);}})[_0xa15e('0x26')](function(_0x37f717){if(_0x37f717){return _0x37f717?{'count':_0x15e19e,'rows':_0x37f717}:null;}})[_0xa15e('0x26')](respondWithResult(_0x26990,null))[_0xa15e('0x4a')](handleError(_0x26990,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c97a06f..d0f8d62 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 _0x2669=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x2669,0x76));var _0x9266=function(_0x438459,_0x5a601f){_0x438459=_0x438459-0x0;var _0x15be84=_0x2669[_0x438459];return _0x15be84;};'use strict';var EventEmitter=require(_0x9266('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x9266('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9266('0x2'),'afterDestroy':_0x9266('0x3')};function emitEvent(_0x24e30b){return function(_0x3dc3d0,_0x4ca9ac,_0x236973){WhatsappQueueEvents[_0x9266('0x4')](_0x24e30b+':'+_0x3dc3d0['id'],_0x3dc3d0);WhatsappQueueEvents['emit'](_0x24e30b,_0x3dc3d0);_0x236973(null);};}for(var e in events){if(events[_0x9266('0x5')](e)){var event=events[e];WhatsappQueue[_0x9266('0x6')](e,emitEvent(event));}}module[_0x9266('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6d32=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','update'];(function(_0x3e7bd3,_0x581414){var _0x128a46=function(_0x147942){while(--_0x147942){_0x3e7bd3['push'](_0x3e7bd3['shift']());}};_0x128a46(++_0x581414);}(_0x6d32,0x1ed));var _0x26d3=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x6d32[_0x4fde08];return _0x12e725;};'use strict';var EventEmitter=require(_0x26d3('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x26d3('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x26d3('0x2'),'afterDestroy':_0x26d3('0x3')};function emitEvent(_0x2bc4b1){return function(_0xf84d55,_0xe78142,_0x261530){WhatsappQueueEvents[_0x26d3('0x4')](_0x2bc4b1+':'+_0xf84d55['id'],_0xf84d55);WhatsappQueueEvents[_0x26d3('0x4')](_0x2bc4b1,_0xf84d55);_0x261530(null);};}for(var e in events){if(events[_0x26d3('0x5')](e)){var event=events[e];WhatsappQueue[_0x26d3('0x6')](e,emitEvent(event));}}module[_0x26d3('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e963b43..0d3261f 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 _0xd7aa=['util','moment','path','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd7aa,0xa1));var _0xad7a=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xd7aa[_0x43a1b8];return _0x324ecc;};'use strict';var _=require(_0xad7a('0x0'));var util=require(_0xad7a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xad7a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xad7a('0x3'));var rimraf=require('rimraf');var config=require(_0xad7a('0x4'));var attributes=require('./whatsappQueue.attributes');module[_0xad7a('0x5')]=function(_0x1a74df,_0x1fa489){return _0x1a74df[_0xad7a('0x6')](_0xad7a('0x7'),attributes,{'tableName':_0xad7a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe99c=['WhatsappQueue','whatsapp_queues','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes','exports','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe99c,0x1d6));var _0xce99=function(_0x3c1b50,_0x1d2ee7){_0x3c1b50=_0x3c1b50-0x0;var _0x26634b=_0xe99c[_0x3c1b50];return _0x26634b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xce99('0x0'));var BPromise=require(_0xce99('0x1'));var rp=require(_0xce99('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce99('0x3'));var config=require('../../config/environment');var attributes=require(_0xce99('0x4'));module[_0xce99('0x5')]=function(_0xbbc1d0,_0x4f789f){return _0xbbc1d0[_0xce99('0x6')](_0xce99('0x7'),attributes,{'tableName':_0xce99('0x8'),'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 4936de8..3332827 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 _0x2ffe=['socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','stringify','find','raw','ShowWhatsappQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x2ffe,0x149));var _0xe2ff=function(_0x1cdd85,_0x572e2e){_0x1cdd85=_0x1cdd85-0x0;var _0xd0096f=_0x2ffe[_0x1cdd85];return _0xd0096f;};'use strict';var _=require(_0xe2ff('0x0'));var util=require(_0xe2ff('0x1'));var moment=require('moment');var BPromise=require(_0xe2ff('0x2'));var rs=require(_0xe2ff('0x3'));var fs=require('fs');var Redis=require(_0xe2ff('0x4'));var db=require(_0xe2ff('0x5'))['db'];var utils=require(_0xe2ff('0x6'));var logger=require(_0xe2ff('0x7'))(_0xe2ff('0x8'));var config=require('../../config/environment');var jayson=require(_0xe2ff('0x9'));var client=jayson[_0xe2ff('0xa')][_0xe2ff('0xb')]({'port':0x232a});config[_0xe2ff('0xc')]=_[_0xe2ff('0xd')](config[_0xe2ff('0xc')],{'host':_0xe2ff('0xe'),'port':0x18eb});var socket=require(_0xe2ff('0xf'))(new Redis(config[_0xe2ff('0xc')]));require(_0xe2ff('0x10'))[_0xe2ff('0x11')](socket);function respondWithRpcPromise(_0x140cfc,_0xca7bdd,_0x115053){return new BPromise(function(_0x216f55,_0x10650a){return client['request'](_0x140cfc,_0x115053)[_0xe2ff('0x12')](function(_0x460066){logger[_0xe2ff('0x13')](_0xe2ff('0x14'),_0xca7bdd,'request\x20sent');logger[_0xe2ff('0x15')](_0xe2ff('0x16'),_0xca7bdd,_0xe2ff('0x17'),JSON['stringify'](_0x460066));if(_0x460066[_0xe2ff('0x18')]){if(_0x460066[_0xe2ff('0x18')][_0xe2ff('0x19')]===0x1f4){logger[_0xe2ff('0x18')](_0xe2ff('0x14'),_0xca7bdd,_0x460066['error']['message']);return _0x10650a(_0x460066[_0xe2ff('0x18')]['message']);}logger[_0xe2ff('0x18')](_0xe2ff('0x14'),_0xca7bdd,_0x460066[_0xe2ff('0x18')]['message']);return _0x216f55(_0x460066[_0xe2ff('0x18')][_0xe2ff('0x1a')]);}else{logger['info'](_0xe2ff('0x14'),_0xca7bdd,_0xe2ff('0x17'));_0x216f55(_0x460066[_0xe2ff('0x1b')]['message']);}})[_0xe2ff('0x1c')](function(_0x15a7a3){logger[_0xe2ff('0x18')](_0xe2ff('0x14'),_0xca7bdd,_0x15a7a3);_0x10650a(_0x15a7a3);});});}exports[_0xe2ff('0x1d')]=function(_0x313cdd){var _0x57cb99=this;return new Promise(function(_0x175442,_0xb78a65){return db[_0xe2ff('0x1e')][_0xe2ff('0x1f')]({'raw':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd['options']['raw']===undefined?!![]:![]:!![],'where':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x21')]||null:null,'attributes':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd['options']['attributes']||null:null,'limit':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x22')]||null:null,'include':_0x313cdd[_0xe2ff('0x20')]?_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x313cdd[_0xe2ff('0x20')][_0xe2ff('0x23')],function(_0x5e3669){return{'model':db[_0x5e3669[_0xe2ff('0x25')]],'as':_0x5e3669['as'],'attributes':_0x5e3669['attributes'],'include':_0x5e3669[_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x5e3669['include'],function(_0x5548c8){return{'model':db[_0x5548c8[_0xe2ff('0x25')]],'as':_0x5548c8['as'],'attributes':_0x5548c8[_0xe2ff('0x26')],'include':_0x5548c8[_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x5548c8[_0xe2ff('0x23')],function(_0x2eba66){return{'model':db[_0x2eba66[_0xe2ff('0x25')]],'as':_0x2eba66['as'],'attributes':_0x2eba66[_0xe2ff('0x26')]};}):[]};}):[]};}):[]:[]})[_0xe2ff('0x12')](function(_0x2db3f6){logger[_0xe2ff('0x13')](_0xe2ff('0x1d'),_0x313cdd);logger[_0xe2ff('0x15')](_0xe2ff('0x1d'),_0x313cdd,JSON[_0xe2ff('0x27')](_0x2db3f6));_0x175442(_0x2db3f6);})[_0xe2ff('0x1c')](function(_0x6b4229){logger['error']('GetWhatsappQueue',_0x6b4229[_0xe2ff('0x1a')],_0x313cdd);_0xb78a65(_0x57cb99[_0xe2ff('0x18')](0x1f4,_0x6b4229[_0xe2ff('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x1c8fb1){var _0x2a1c6e=this;return new Promise(function(_0x26dc8a,_0x20f518){return db[_0xe2ff('0x1e')][_0xe2ff('0x28')]({'raw':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1['options'][_0xe2ff('0x29')]===undefined?!![]:![]:!![],'where':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1[_0xe2ff('0x20')][_0xe2ff('0x21')]||null:null,'attributes':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1[_0xe2ff('0x20')][_0xe2ff('0x26')]||null:null,'include':_0x1c8fb1[_0xe2ff('0x20')]?_0x1c8fb1[_0xe2ff('0x20')][_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x1c8fb1['options']['include'],function(_0x263d4e){return{'model':db[_0x263d4e[_0xe2ff('0x25')]],'as':_0x263d4e['as'],'attributes':_0x263d4e[_0xe2ff('0x26')],'include':_0x263d4e[_0xe2ff('0x23')]?_[_0xe2ff('0x24')](_0x263d4e['include'],function(_0x1aedc3){return{'model':db[_0x1aedc3[_0xe2ff('0x25')]],'as':_0x1aedc3['as'],'attributes':_0x1aedc3['attributes'],'include':_0x1aedc3['include']?_[_0xe2ff('0x24')](_0x1aedc3[_0xe2ff('0x23')],function(_0x177f33){return{'model':db[_0x177f33[_0xe2ff('0x25')]],'as':_0x177f33['as'],'attributes':_0x177f33['attributes']};}):[]};}):[]};}):[]:[]})[_0xe2ff('0x12')](function(_0x300b58){logger[_0xe2ff('0x13')]('ShowWhatsappQueue',_0x1c8fb1);logger[_0xe2ff('0x15')](_0xe2ff('0x2a'),_0x1c8fb1,JSON[_0xe2ff('0x27')](_0x300b58));_0x26dc8a(_0x300b58);})[_0xe2ff('0x1c')](function(_0x548378){logger[_0xe2ff('0x18')](_0xe2ff('0x2a'),_0x548378[_0xe2ff('0x1a')],_0x1c8fb1);_0x20f518(_0x2a1c6e[_0xe2ff('0x18')](0x1f4,_0x548378[_0xe2ff('0x1a')]));});});}; \ No newline at end of file +var _0xb008=['WhatsappQueue,\x20%s,\x20%s','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','model','map','attributes','then','ShowWhatsappQueue','debug','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','request\x20sent','stringify','error','code','message'];(function(_0x53586d,_0x352407){var _0x398d39=function(_0x354d05){while(--_0x354d05){_0x53586d['push'](_0x53586d['shift']());}};_0x398d39(++_0x352407);}(_0xb008,0x132));var _0x8b00=function(_0x93b6a9,_0x347e85){_0x93b6a9=_0x93b6a9-0x0;var _0x18e14f=_0xb008[_0x93b6a9];return _0x18e14f;};'use strict';var _=require(_0x8b00('0x0'));var util=require('util');var moment=require(_0x8b00('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b00('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b00('0x3'))['db'];var utils=require(_0x8b00('0x4'));var logger=require(_0x8b00('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b00('0x6'));var client=jayson[_0x8b00('0x7')]['http']({'port':0x232a});config[_0x8b00('0x8')]=_[_0x8b00('0x9')](config[_0x8b00('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b00('0xa'))(new Redis(config[_0x8b00('0x8')]));require(_0x8b00('0xb'))['register'](socket);function respondWithRpcPromise(_0x508346,_0x49a5ce,_0x2fa661){return new BPromise(function(_0x53a67b,_0x2b03f6){return client[_0x8b00('0xc')](_0x508346,_0x2fa661)['then'](function(_0x3cfda7){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x49a5ce,_0x8b00('0xd'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x49a5ce,'request\x20sent',JSON[_0x8b00('0xe')](_0x3cfda7));if(_0x3cfda7['error']){if(_0x3cfda7[_0x8b00('0xf')][_0x8b00('0x10')]===0x1f4){logger[_0x8b00('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x49a5ce,_0x3cfda7[_0x8b00('0xf')][_0x8b00('0x11')]);return _0x2b03f6(_0x3cfda7['error'][_0x8b00('0x11')]);}logger[_0x8b00('0xf')](_0x8b00('0x12'),_0x49a5ce,_0x3cfda7[_0x8b00('0xf')][_0x8b00('0x11')]);return _0x53a67b(_0x3cfda7[_0x8b00('0xf')][_0x8b00('0x11')]);}else{logger[_0x8b00('0x13')](_0x8b00('0x12'),_0x49a5ce,_0x8b00('0xd'));_0x53a67b(_0x3cfda7[_0x8b00('0x14')][_0x8b00('0x11')]);}})[_0x8b00('0x15')](function(_0x43a346){logger[_0x8b00('0xf')](_0x8b00('0x12'),_0x49a5ce,_0x43a346);_0x2b03f6(_0x43a346);});});}exports[_0x8b00('0x16')]=function(_0x571c34){var _0x59b760=this;return new Promise(function(_0x21bdcf,_0x5c25f4){return db[_0x8b00('0x17')][_0x8b00('0x18')]({'raw':_0x571c34['options']?_0x571c34[_0x8b00('0x19')][_0x8b00('0x1a')]===undefined?!![]:![]:!![],'where':_0x571c34[_0x8b00('0x19')]?_0x571c34[_0x8b00('0x19')][_0x8b00('0x1b')]||null:null,'attributes':_0x571c34[_0x8b00('0x19')]?_0x571c34[_0x8b00('0x19')]['attributes']||null:null,'limit':_0x571c34[_0x8b00('0x19')]?_0x571c34[_0x8b00('0x19')][_0x8b00('0x1c')]||null:null,'include':_0x571c34[_0x8b00('0x19')]?_0x571c34[_0x8b00('0x19')][_0x8b00('0x1d')]?_['map'](_0x571c34[_0x8b00('0x19')][_0x8b00('0x1d')],function(_0x3a77c4){return{'model':db[_0x3a77c4[_0x8b00('0x1e')]],'as':_0x3a77c4['as'],'attributes':_0x3a77c4['attributes'],'include':_0x3a77c4['include']?_[_0x8b00('0x1f')](_0x3a77c4[_0x8b00('0x1d')],function(_0x44dd0f){return{'model':db[_0x44dd0f[_0x8b00('0x1e')]],'as':_0x44dd0f['as'],'attributes':_0x44dd0f[_0x8b00('0x20')],'include':_0x44dd0f['include']?_['map'](_0x44dd0f[_0x8b00('0x1d')],function(_0x4a5be2){return{'model':db[_0x4a5be2[_0x8b00('0x1e')]],'as':_0x4a5be2['as'],'attributes':_0x4a5be2[_0x8b00('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b00('0x21')](function(_0x579baa){logger[_0x8b00('0x13')]('GetWhatsappQueue',_0x571c34);logger['debug'](_0x8b00('0x16'),_0x571c34,JSON[_0x8b00('0xe')](_0x579baa));_0x21bdcf(_0x579baa);})[_0x8b00('0x15')](function(_0x46006b){logger[_0x8b00('0xf')](_0x8b00('0x16'),_0x46006b['message'],_0x571c34);_0x5c25f4(_0x59b760[_0x8b00('0xf')](0x1f4,_0x46006b[_0x8b00('0x11')]));});});};exports[_0x8b00('0x22')]=function(_0x52d586){var _0x10d951=this;return new Promise(function(_0x2c8804,_0x3c45eb){return db['WhatsappQueue']['find']({'raw':_0x52d586[_0x8b00('0x19')]?_0x52d586['options'][_0x8b00('0x1a')]===undefined?!![]:![]:!![],'where':_0x52d586['options']?_0x52d586[_0x8b00('0x19')][_0x8b00('0x1b')]||null:null,'attributes':_0x52d586[_0x8b00('0x19')]?_0x52d586[_0x8b00('0x19')]['attributes']||null:null,'include':_0x52d586['options']?_0x52d586[_0x8b00('0x19')][_0x8b00('0x1d')]?_[_0x8b00('0x1f')](_0x52d586[_0x8b00('0x19')][_0x8b00('0x1d')],function(_0xd3ff2a){return{'model':db[_0xd3ff2a[_0x8b00('0x1e')]],'as':_0xd3ff2a['as'],'attributes':_0xd3ff2a[_0x8b00('0x20')],'include':_0xd3ff2a[_0x8b00('0x1d')]?_[_0x8b00('0x1f')](_0xd3ff2a['include'],function(_0xfd204e){return{'model':db[_0xfd204e[_0x8b00('0x1e')]],'as':_0xfd204e['as'],'attributes':_0xfd204e[_0x8b00('0x20')],'include':_0xfd204e[_0x8b00('0x1d')]?_[_0x8b00('0x1f')](_0xfd204e[_0x8b00('0x1d')],function(_0x2fe75e){return{'model':db[_0x2fe75e[_0x8b00('0x1e')]],'as':_0x2fe75e['as'],'attributes':_0x2fe75e[_0x8b00('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b00('0x21')](function(_0x1841cf){logger[_0x8b00('0x13')](_0x8b00('0x22'),_0x52d586);logger[_0x8b00('0x23')]('ShowWhatsappQueue',_0x52d586,JSON['stringify'](_0x1841cf));_0x2c8804(_0x1841cf);})['catch'](function(_0x2f78dd){logger[_0x8b00('0xf')]('ShowWhatsappQueue',_0x2f78dd[_0x8b00('0x11')],_0x52d586);_0x3c45eb(_0x10d951[_0x8b00('0xf')](0x1f4,_0x2f78dd[_0x8b00('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3e4e8f5..49eb287 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 _0x1df0=['remove','update','emit','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x11354c,_0x52ea66){var _0x399ccd=function(_0x4e3f4e){while(--_0x4e3f4e){_0x11354c['push'](_0x11354c['shift']());}};_0x399ccd(++_0x52ea66);}(_0x1df0,0x13e));var _0x01df=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1df0[_0x31e29a];return _0x32d892;};'use strict';var WhatsappQueueEvents=require(_0x01df('0x0'));var events=[_0x01df('0x1'),_0x01df('0x2'),_0x01df('0x3')];function createListener(_0xdbdaf6,_0x1c8d70){return function(_0x3db799){_0x1c8d70[_0x01df('0x4')](_0xdbdaf6,_0x3db799);};}function removeListener(_0x14501d,_0x1416c6){return function(){WhatsappQueueEvents['removeListener'](_0x14501d,_0x1416c6);};}exports[_0x01df('0x5')]=function(_0x243a6f){for(var _0x58dcb2=0x0,_0xba54c3=events[_0x01df('0x6')];_0x58dcb2<_0xba54c3;_0x58dcb2++){var _0x3c2004=events[_0x58dcb2];var _0x6130d9=createListener(_0x01df('0x7')+_0x3c2004,_0x243a6f);WhatsappQueueEvents['on'](_0x3c2004,_0x6130d9);}}; \ No newline at end of file +var _0xdee9=['removeListener','register','length','whatsappQueue:','save','remove','update'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xdee9,0x146));var _0x9dee=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xdee9[_0x376b45];return _0x2341b3;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x9dee('0x0'),_0x9dee('0x1'),_0x9dee('0x2')];function createListener(_0x1a123f,_0x4e9997){return function(_0x4077b8){_0x4e9997['emit'](_0x1a123f,_0x4077b8);};}function removeListener(_0x312e3e,_0x307787){return function(){WhatsappQueueEvents[_0x9dee('0x3')](_0x312e3e,_0x307787);};}exports[_0x9dee('0x4')]=function(_0x26347c){for(var _0x6b9be1=0x0,_0x429c25=events[_0x9dee('0x5')];_0x6b9be1<_0x429c25;_0x6b9be1++){var _0x49b331=events[_0x6b9be1];var _0x44b2d2=createListener(_0x9dee('0x6')+_0x49b331,_0x26347c);WhatsappQueueEvents['on'](_0x49b331,_0x44b2d2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9185618..199b7bf 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 _0x9a89=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x2fa7fc,_0x298fb7){var _0x3447e9=function(_0x4660cb){while(--_0x4660cb){_0x2fa7fc['push'](_0x2fa7fc['shift']());}};_0x3447e9(++_0x298fb7);}(_0x9a89,0x82));var _0x99a8=function(_0x3dfc00,_0xa71d8d){_0x3dfc00=_0x3dfc00-0x0;var _0x49c612=_0x9a89[_0x3dfc00];return _0x49c612;};'use strict';var multer=require(_0x99a8('0x0'));var util=require(_0x99a8('0x1'));var path=require(_0x99a8('0x2'));var timeout=require(_0x99a8('0x3'));var express=require('express');var router=express[_0x99a8('0x4')]();var fs_extra=require(_0x99a8('0x5'));var auth=require(_0x99a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99a8('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x99a8('0x8')]('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0xa')]);router[_0x99a8('0x8')](_0x99a8('0xb'),auth[_0x99a8('0x9')](),controller[_0x99a8('0xc')]);router[_0x99a8('0x8')](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0xe')]);router['post']('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0xf')]);router[_0x99a8('0x10')](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x11')]);router[_0x99a8('0x12')](_0x99a8('0xd'),auth['isAuthenticated'](),controller[_0x99a8('0x13')]);module[_0x99a8('0x14')]=router; \ No newline at end of file +var _0x96ad=['destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','create','put','update','delete'];(function(_0x17d6bc,_0x362d4f){var _0x5e1e2e=function(_0x535237){while(--_0x535237){_0x17d6bc['push'](_0x17d6bc['shift']());}};_0x5e1e2e(++_0x362d4f);}(_0x96ad,0xbc));var _0xd96a=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x96ad[_0x1c4409];return _0x356d8f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd96a('0x0'));var timeout=require(_0xd96a('0x1'));var express=require(_0xd96a('0x2'));var router=express['Router']();var fs_extra=require(_0xd96a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd96a('0x4'));var config=require(_0xd96a('0x5'));var controller=require(_0xd96a('0x6'));router['get']('/',auth[_0xd96a('0x7')](),controller['index']);router[_0xd96a('0x8')](_0xd96a('0x9'),auth[_0xd96a('0x7')](),controller[_0xd96a('0xa')]);router[_0xd96a('0x8')](_0xd96a('0xb'),auth[_0xd96a('0x7')](),controller['show']);router['post']('/',auth[_0xd96a('0x7')](),controller[_0xd96a('0xc')]);router[_0xd96a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd96a('0xe')]);router[_0xd96a('0xf')](_0xd96a('0xb'),auth[_0xd96a('0x7')](),controller[_0xd96a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 8dd68a9..2965a15 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x348d5b,_0x49f298){var _0x270758=function(_0x5ecb76){while(--_0x5ecb76){_0x348d5b['push'](_0x348d5b['shift']());}};_0x270758(++_0x49f298);}(_0x7a54,0x106));var _0x47a5=function(_0x5afe96,_0x41ed68){_0x5afe96=_0x5afe96-0x0;var _0x221b54=_0x7a54[_0x5afe96];return _0x221b54;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3daa80,_0xd015d1){var _0x43a641=function(_0x32bf98){while(--_0x32bf98){_0x3daa80['push'](_0x3daa80['shift']());}};_0x43a641(++_0xd015d1);}(_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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 699eda3..14b0a3b 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 _0xd4f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','findAll','rows','then','catch','show','params','keys','includeAll','include','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x32a4bd,_0x1590c5){_0x32a4bd=_0x32a4bd-0x0;var _0x2d5d33=_0xd4f4[_0x32a4bd];return _0x2d5d33;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x1cf365,_0x28443b){return function(_0x5cf9e7){if(!_0x5cf9e7){_0x1cf365['sendStatus'](0x194);}return _0x5cf9e7;};}function handleError(_0x141245,_0xd51604){_0xd51604=_0xd51604||0x1f4;return function(_0xa2492c){logger[_0x4d4f('0x2b')](_0xa2492c['stack']);if(_0xa2492c[_0x4d4f('0x2c')]){delete _0xa2492c[_0x4d4f('0x2c')];}_0x141245[_0x4d4f('0x1f')](_0xd51604)[_0x4d4f('0x2d')](_0xa2492c);};}exports['index']=function(_0x338ba2,_0x51cb3d){var _0x1688bb={},_0x333a40={},_0x550040={'count':0x0,'rows':[]};var _0x2768f1=_[_0x4d4f('0x2e')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')],function(_0x19a502){return{'name':_0x19a502[_0x4d4f('0x31')],'type':_0x19a502['type'][_0x4d4f('0x32')]};});_0x333a40[_0x4d4f('0x33')]=_[_0x4d4f('0x2e')](_0x2768f1,_0x4d4f('0x2c'));_0x333a40[_0x4d4f('0x34')]=_['keys'](_0x338ba2[_0x4d4f('0x34')]);_0x333a40['filters']=_[_0x4d4f('0x35')](_0x333a40['model'],_0x333a40['query']);_0x1688bb['attributes']=_[_0x4d4f('0x35')](_0x333a40['model'],qs[_0x4d4f('0x36')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x36')]));_0x1688bb['attributes']=_0x1688bb[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x1688bb[_0x4d4f('0x37')]:_0x333a40['model'];if(!_0x338ba2[_0x4d4f('0x34')]['hasOwnProperty'](_0x4d4f('0x39'))){_0x1688bb[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x23')]);_0x1688bb[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x338ba2[_0x4d4f('0x34')]['offset']);}_0x1688bb['order']=qs[_0x4d4f('0x3a')](_0x338ba2['query']['sort']);_0x1688bb[_0x4d4f('0x3b')]=qs[_0x4d4f('0x3c')](_[_0x4d4f('0x3d')](_0x338ba2[_0x4d4f('0x34')],_0x333a40[_0x4d4f('0x3c')]),_0x2768f1);if(_0x338ba2['query'][_0x4d4f('0x3e')]){_0x1688bb[_0x4d4f('0x3b')]=_['merge'](_0x1688bb[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2e')](_0x2768f1,function(_0x336625){if(_0x336625[_0x4d4f('0x3f')]!==_0x4d4f('0x40')){var _0x19ebfe={};_0x19ebfe[_0x336625[_0x4d4f('0x2c')]]={'$like':'%'+_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x3e')]+'%'};return _0x19ebfe;}})});}_0x1688bb=_['merge']({},_0x1688bb,_0x338ba2['options']);var _0x1cb919={'where':_0x1688bb[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2f')][_0x4d4f('0x24')](_0x1cb919)['then'](function(_0x5764cb){_0x550040[_0x4d4f('0x24')]=_0x5764cb;if(_0x338ba2[_0x4d4f('0x34')]['includeAll']){_0x1688bb['include']=[{'all':!![]}];}return db[_0x4d4f('0x2f')][_0x4d4f('0x41')](_0x1688bb);})['then'](function(_0x949a6d){_0x550040[_0x4d4f('0x42')]=_0x949a6d;return _0x550040;})[_0x4d4f('0x43')](respondWithFilteredResult(_0x51cb3d,_0x1688bb))[_0x4d4f('0x44')](handleError(_0x51cb3d,null));};exports[_0x4d4f('0x45')]=function(_0x587e6e,_0x2b274e){var _0x4c7c24={'raw':!![],'where':{'id':_0x587e6e[_0x4d4f('0x46')]['id']}},_0x45a0c1={};_0x45a0c1['model']=_[_0x4d4f('0x47')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')]);_0x45a0c1['query']=_[_0x4d4f('0x47')](_0x587e6e['query']);_0x45a0c1[_0x4d4f('0x3c')]=_['intersection'](_0x45a0c1[_0x4d4f('0x33')],_0x45a0c1[_0x4d4f('0x34')]);_0x4c7c24[_0x4d4f('0x37')]=_[_0x4d4f('0x35')](_0x45a0c1[_0x4d4f('0x33')],qs['fields'](_0x587e6e['query'][_0x4d4f('0x36')]));_0x4c7c24[_0x4d4f('0x37')]=_0x4c7c24[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x4c7c24['attributes']:_0x45a0c1['model'];if(_0x587e6e['query'][_0x4d4f('0x48')]){_0x4c7c24[_0x4d4f('0x49')]=[{'all':!![]}];}_0x4c7c24=_[_0x4d4f('0x4a')]({},_0x4c7c24,_0x587e6e[_0x4d4f('0x4b')]);return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')](_0x4c7c24)[_0x4d4f('0x43')](handleEntityNotFound(_0x2b274e,null))[_0x4d4f('0x43')](respondWithResult(_0x2b274e,null))[_0x4d4f('0x44')](handleError(_0x2b274e,null));};exports[_0x4d4f('0x4d')]=function(_0x37745d,_0x1c290b){return db['WhatsappQueueReport'][_0x4d4f('0x4d')](_0x37745d[_0x4d4f('0x4e')],{})['then'](respondWithResult(_0x1c290b,0xc9))[_0x4d4f('0x44')](handleError(_0x1c290b,null));};exports['update']=function(_0x15cf38,_0x401466){if(_0x15cf38['body']['id']){delete _0x15cf38[_0x4d4f('0x4e')]['id'];}return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')]({'where':{'id':_0x15cf38[_0x4d4f('0x46')]['id']}})[_0x4d4f('0x43')](handleEntityNotFound(_0x401466,null))[_0x4d4f('0x43')](saveUpdates(_0x15cf38[_0x4d4f('0x4e')],null))[_0x4d4f('0x43')](respondWithResult(_0x401466,null))[_0x4d4f('0x44')](handleError(_0x401466,null));};exports[_0x4d4f('0x2a')]=function(_0xa6cef,_0x3a21a6){return db['WhatsappQueueReport'][_0x4d4f('0x4c')]({'where':{'id':_0xa6cef['params']['id']}})['then'](handleEntityNotFound(_0x3a21a6,null))['then'](removeEntity(_0x3a21a6,null))[_0x4d4f('0x44')](handleError(_0x3a21a6,null));};exports[_0x4d4f('0x4f')]=function(_0x487212,_0x5f3252){return db[_0x4d4f('0x2f')][_0x4d4f('0x4f')]()['then'](respondWithResult(_0x5f3252,null))[_0x4d4f('0x44')](handleError(_0x5f3252,null));}; \ No newline at end of file +var _0x36ee=['describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','WhatsappQueueReport','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)[_0xe36e('0x28')]();});}};}function handleEntityNotFound(_0x1507f9,_0x1a045c){return function(_0x5ac484){if(!_0x5ac484){_0x1507f9[_0xe36e('0x19')](0x194);}return _0x5ac484;};}function handleError(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0x1f4;return function(_0x262caa){logger['error'](_0x262caa[_0xe36e('0x29')]);if(_0x262caa['name']){delete _0x262caa[_0xe36e('0x2a')];}_0x35f9e7['status'](_0x10597f)[_0xe36e('0x2b')](_0x262caa);};}exports['index']=function(_0x410504,_0x4c5d98){var _0x3b1045={},_0x59548b={},_0x4bb75b={'count':0x0,'rows':[]};var _0x5d8fd8=_['map'](db[_0xe36e('0x2c')][_0xe36e('0x2d')],function(_0x4cf185){return{'name':_0x4cf185['fieldName'],'type':_0x4cf185[_0xe36e('0x2e')][_0xe36e('0x2f')]};});_0x59548b[_0xe36e('0x30')]=_[_0xe36e('0x31')](_0x5d8fd8,_0xe36e('0x2a'));_0x59548b[_0xe36e('0x32')]=_['keys'](_0x410504[_0xe36e('0x32')]);_0x59548b[_0xe36e('0x33')]=_['intersection'](_0x59548b[_0xe36e('0x30')],_0x59548b[_0xe36e('0x32')]);_0x3b1045[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x59548b[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x410504[_0xe36e('0x32')][_0xe36e('0x36')]));_0x3b1045[_0xe36e('0x34')]=_0x3b1045[_0xe36e('0x34')][_0xe36e('0x37')]?_0x3b1045['attributes']:_0x59548b[_0xe36e('0x30')];if(!_0x410504['query']['hasOwnProperty'](_0xe36e('0x38'))){_0x3b1045['limit']=qs[_0xe36e('0x1e')](_0x410504[_0xe36e('0x32')][_0xe36e('0x1e')]);_0x3b1045[_0xe36e('0x1c')]=qs['offset'](_0x410504['query'][_0xe36e('0x1c')]);}_0x3b1045[_0xe36e('0x39')]=qs[_0xe36e('0x3a')](_0x410504[_0xe36e('0x32')]['sort']);_0x3b1045[_0xe36e('0x3b')]=qs[_0xe36e('0x33')](_[_0xe36e('0x3c')](_0x410504['query'],_0x59548b[_0xe36e('0x33')]),_0x5d8fd8);if(_0x410504[_0xe36e('0x32')]['filter']){_0x3b1045[_0xe36e('0x3b')]=_[_0xe36e('0x3d')](_0x3b1045[_0xe36e('0x3b')],{'$or':_[_0xe36e('0x31')](_0x5d8fd8,function(_0xeadfa6){if(_0xeadfa6[_0xe36e('0x2e')]!==_0xe36e('0x3e')){var _0x20877d={};_0x20877d[_0xeadfa6[_0xe36e('0x2a')]]={'$like':'%'+_0x410504[_0xe36e('0x32')][_0xe36e('0x3f')]+'%'};return _0x20877d;}})});}_0x3b1045=_[_0xe36e('0x3d')]({},_0x3b1045,_0x410504[_0xe36e('0x40')]);var _0x5f396c={'where':_0x3b1045[_0xe36e('0x3b')]};return db[_0xe36e('0x2c')][_0xe36e('0x1f')](_0x5f396c)[_0xe36e('0x26')](function(_0x295feb){_0x4bb75b['count']=_0x295feb;if(_0x410504['query'][_0xe36e('0x41')]){_0x3b1045[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2c')][_0xe36e('0x43')](_0x3b1045);})[_0xe36e('0x26')](function(_0x34a1ba){_0x4bb75b[_0xe36e('0x44')]=_0x34a1ba;return _0x4bb75b;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4c5d98,_0x3b1045))['catch'](handleError(_0x4c5d98,null));};exports[_0xe36e('0x45')]=function(_0x2d392c,_0x4788a0){var _0x21dc35={'raw':!![],'where':{'id':_0x2d392c[_0xe36e('0x46')]['id']}},_0x5ef3e4={};_0x5ef3e4[_0xe36e('0x30')]=_[_0xe36e('0x47')](db[_0xe36e('0x2c')][_0xe36e('0x2d')]);_0x5ef3e4['query']=_[_0xe36e('0x47')](_0x2d392c[_0xe36e('0x32')]);_0x5ef3e4[_0xe36e('0x33')]=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],_0x5ef3e4[_0xe36e('0x32')]);_0x21dc35['attributes']=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x2d392c[_0xe36e('0x32')][_0xe36e('0x36')]));_0x21dc35['attributes']=_0x21dc35[_0xe36e('0x34')][_0xe36e('0x37')]?_0x21dc35[_0xe36e('0x34')]:_0x5ef3e4[_0xe36e('0x30')];if(_0x2d392c[_0xe36e('0x32')][_0xe36e('0x41')]){_0x21dc35[_0xe36e('0x42')]=[{'all':!![]}];}_0x21dc35=_[_0xe36e('0x3d')]({},_0x21dc35,_0x2d392c[_0xe36e('0x40')]);return db['WhatsappQueueReport']['find'](_0x21dc35)[_0xe36e('0x26')](handleEntityNotFound(_0x4788a0,null))['then'](respondWithResult(_0x4788a0,null))[_0xe36e('0x48')](handleError(_0x4788a0,null));};exports[_0xe36e('0x49')]=function(_0x38b93f,_0x25aa09){return db['WhatsappQueueReport'][_0xe36e('0x49')](_0x38b93f[_0xe36e('0x4a')],{})['then'](respondWithResult(_0x25aa09,0xc9))[_0xe36e('0x48')](handleError(_0x25aa09,null));};exports[_0xe36e('0x25')]=function(_0x2c26e6,_0x42eae5){if(_0x2c26e6[_0xe36e('0x4a')]['id']){delete _0x2c26e6[_0xe36e('0x4a')]['id'];}return db[_0xe36e('0x2c')][_0xe36e('0x4b')]({'where':{'id':_0x2c26e6[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x42eae5,null))[_0xe36e('0x26')](saveUpdates(_0x2c26e6[_0xe36e('0x4a')],null))[_0xe36e('0x26')](respondWithResult(_0x42eae5,null))[_0xe36e('0x48')](handleError(_0x42eae5,null));};exports[_0xe36e('0x27')]=function(_0x5678d3,_0x3262bf){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5678d3[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x3262bf,null))['then'](removeEntity(_0x3262bf,null))[_0xe36e('0x48')](handleError(_0x3262bf,null));};exports[_0xe36e('0x4c')]=function(_0x8a767a,_0x1f4a5d){return db[_0xe36e('0x2c')][_0xe36e('0x4c')]()[_0xe36e('0x26')](respondWithResult(_0x1f4a5d,null))[_0xe36e('0x48')](handleError(_0x1f4a5d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a9936ee..458b549 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 _0xf94e=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf94e,0x1ea));var _0xef94=function(_0x3b1648,_0xb5d1cb){_0x3b1648=_0x3b1648-0x0;var _0x45f56e=_0xf94e[_0x3b1648];return _0x45f56e;};'use strict';var _=require(_0xef94('0x0'));var util=require(_0xef94('0x1'));var logger=require(_0xef94('0x2'))(_0xef94('0x3'));var moment=require('moment');var BPromise=require(_0xef94('0x4'));var rp=require(_0xef94('0x5'));var fs=require('fs');var path=require(_0xef94('0x6'));var rimraf=require('rimraf');var config=require(_0xef94('0x7'));var attributes=require(_0xef94('0x8'));module[_0xef94('0x9')]=function(_0x204c7b,_0x3c1baf){return _0x204c7b[_0xef94('0xa')](_0xef94('0xb'),attributes,{'tableName':_0xef94('0xc'),'paranoid':![],'indexes':[{'name':_0xef94('0xd'),'fields':[_0xef94('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ce=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x3e572e,_0x22e1ef){var _0x5b4da7=function(_0x47b514){while(--_0x47b514){_0x3e572e['push'](_0x3e572e['shift']());}};_0x5b4da7(++_0x22e1ef);}(_0xb9ce,0x163));var _0xeb9c=function(_0x375ae8,_0x2c5ff3){_0x375ae8=_0x375ae8-0x0;var _0x25513b=_0xb9ce[_0x375ae8];return _0x25513b;};'use strict';var _=require('lodash');var util=require(_0xeb9c('0x0'));var logger=require(_0xeb9c('0x1'))(_0xeb9c('0x2'));var moment=require(_0xeb9c('0x3'));var BPromise=require(_0xeb9c('0x4'));var rp=require(_0xeb9c('0x5'));var fs=require('fs');var path=require(_0xeb9c('0x6'));var rimraf=require('rimraf');var config=require(_0xeb9c('0x7'));var attributes=require(_0xeb9c('0x8'));module[_0xeb9c('0x9')]=function(_0x8e798d,_0x3771d6){return _0x8e798d[_0xeb9c('0xa')](_0xeb9c('0xb'),attributes,{'tableName':_0xeb9c('0xc'),'paranoid':![],'indexes':[{'name':_0xeb9c('0xd'),'fields':[_0xeb9c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index b5fd6bc..4db385e 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 _0x9b53=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9b53,0x1d4));var _0x39b5=function(_0x527027,_0xe097a3){_0x527027=_0x527027-0x0;var _0x45a143=_0x9b53[_0x527027];return _0x45a143;};'use strict';var _=require(_0x39b5('0x0'));var util=require(_0x39b5('0x1'));var moment=require(_0x39b5('0x2'));var BPromise=require(_0x39b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39b5('0x4'));var db=require(_0x39b5('0x5'))['db'];var utils=require(_0x39b5('0x6'));var logger=require(_0x39b5('0x7'))('rpc');var config=require(_0x39b5('0x8'));var jayson=require(_0x39b5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1755e4,_0x25de86,_0x29b38b){return new BPromise(function(_0x5ad67c,_0x1e14d2){return client[_0x39b5('0xa')](_0x1755e4,_0x29b38b)[_0x39b5('0xb')](function(_0x2747d6){logger[_0x39b5('0xc')](_0x39b5('0xd'),_0x25de86,_0x39b5('0xe'));logger[_0x39b5('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x25de86,_0x39b5('0xe'),JSON[_0x39b5('0x10')](_0x2747d6));if(_0x2747d6[_0x39b5('0x11')]){if(_0x2747d6['error'][_0x39b5('0x12')]===0x1f4){logger[_0x39b5('0x11')](_0x39b5('0xd'),_0x25de86,_0x2747d6[_0x39b5('0x11')]['message']);return _0x1e14d2(_0x2747d6[_0x39b5('0x11')][_0x39b5('0x13')]);}logger[_0x39b5('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x25de86,_0x2747d6[_0x39b5('0x11')][_0x39b5('0x13')]);return _0x5ad67c(_0x2747d6[_0x39b5('0x11')][_0x39b5('0x13')]);}else{logger['info'](_0x39b5('0xd'),_0x25de86,_0x39b5('0xe'));_0x5ad67c(_0x2747d6[_0x39b5('0x14')][_0x39b5('0x13')]);}})[_0x39b5('0x15')](function(_0x78194b){logger[_0x39b5('0x11')](_0x39b5('0xd'),_0x25de86,_0x78194b);_0x1e14d2(_0x78194b);});});}exports['CreateWhatsappQueueReport']=function(_0x9e36d){var _0x37efc1=this;return new Promise(function(_0x479ad1,_0x5b6af0){return db[_0x39b5('0x16')]['create'](_0x9e36d[_0x39b5('0x17')],{'raw':_0x9e36d['options']?_0x9e36d[_0x39b5('0x18')][_0x39b5('0x19')]===undefined?!![]:![]:!![]})[_0x39b5('0xb')](function(_0x3b2ffe){logger[_0x39b5('0xc')](_0x39b5('0x1a'),_0x9e36d);logger[_0x39b5('0xf')](_0x39b5('0x1a'),_0x9e36d,JSON['stringify'](_0x3b2ffe));_0x479ad1(_0x3b2ffe);})['catch'](function(_0x42f825){logger[_0x39b5('0x11')](_0x39b5('0x1a'),_0x42f825[_0x39b5('0x13')],_0x9e36d);_0x5b6af0(_0x37efc1[_0x39b5('0x11')](0x1f4,_0x42f825['message']));});});};exports[_0x39b5('0x1b')]=function(_0x2eebd1){var _0x6fa957=this;return new Promise(function(_0x31433f,_0x1f7eb5){return db[_0x39b5('0x16')][_0x39b5('0x1c')](_0x2eebd1[_0x39b5('0x17')],{'raw':_0x2eebd1['options']?_0x2eebd1[_0x39b5('0x18')][_0x39b5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eebd1[_0x39b5('0x18')]?_0x2eebd1[_0x39b5('0x18')][_0x39b5('0x1d')]||null:null,'attributes':_0x2eebd1[_0x39b5('0x18')]?_0x2eebd1[_0x39b5('0x18')][_0x39b5('0x1e')]||null:null,'limit':_0x2eebd1['options']?_0x2eebd1['options'][_0x39b5('0x1f')]||null:null})[_0x39b5('0xb')](function(_0x1b47f9){logger[_0x39b5('0xc')]('UpdateWhatsappQueueReport',_0x2eebd1);logger[_0x39b5('0xf')](_0x39b5('0x1b'),_0x2eebd1,JSON['stringify'](_0x1b47f9));_0x31433f(_0x1b47f9);})[_0x39b5('0x15')](function(_0x578f50){logger['error'](_0x39b5('0x1b'),_0x578f50[_0x39b5('0x13')],_0x2eebd1);_0x1f7eb5(_0x6fa957[_0x39b5('0x11')](0x1f4,_0x578f50[_0x39b5('0x13')]));});});}; \ No newline at end of file +var _0x8433=['WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x491ff4,_0x1c83fd){var _0x223621=function(_0x71f8b3){while(--_0x71f8b3){_0x491ff4['push'](_0x491ff4['shift']());}};_0x223621(++_0x1c83fd);}(_0x8433,0x1d8));var _0x3843=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x8433[_0x151381];return _0x2afab6;};'use strict';var _=require(_0x3843('0x0'));var util=require(_0x3843('0x1'));var moment=require(_0x3843('0x2'));var BPromise=require(_0x3843('0x3'));var rs=require(_0x3843('0x4'));var fs=require('fs');var Redis=require(_0x3843('0x5'));var db=require(_0x3843('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3843('0x7'))('rpc');var config=require(_0x3843('0x8'));var jayson=require(_0x3843('0x9'));var client=jayson[_0x3843('0xa')][_0x3843('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15eb86,_0x46df13,_0x12d85a){return new BPromise(function(_0x7bcd82,_0x3694f2){return client[_0x3843('0xc')](_0x15eb86,_0x12d85a)[_0x3843('0xd')](function(_0x4ecd46){logger['info'](_0x3843('0xe'),_0x46df13,_0x3843('0xf'));logger[_0x3843('0x10')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x46df13,_0x3843('0xf'),JSON[_0x3843('0x11')](_0x4ecd46));if(_0x4ecd46[_0x3843('0x12')]){if(_0x4ecd46[_0x3843('0x12')]['code']===0x1f4){logger[_0x3843('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x46df13,_0x4ecd46[_0x3843('0x12')][_0x3843('0x13')]);return _0x3694f2(_0x4ecd46[_0x3843('0x12')][_0x3843('0x13')]);}logger[_0x3843('0x12')](_0x3843('0xe'),_0x46df13,_0x4ecd46[_0x3843('0x12')][_0x3843('0x13')]);return _0x7bcd82(_0x4ecd46[_0x3843('0x12')][_0x3843('0x13')]);}else{logger[_0x3843('0x14')](_0x3843('0xe'),_0x46df13,_0x3843('0xf'));_0x7bcd82(_0x4ecd46[_0x3843('0x15')][_0x3843('0x13')]);}})[_0x3843('0x16')](function(_0x1238b5){logger[_0x3843('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x46df13,_0x1238b5);_0x3694f2(_0x1238b5);});});}exports['CreateWhatsappQueueReport']=function(_0x44fcef){var _0x51ac44=this;return new Promise(function(_0x323f2c,_0x27d6a4){return db[_0x3843('0x17')][_0x3843('0x18')](_0x44fcef[_0x3843('0x19')],{'raw':_0x44fcef[_0x3843('0x1a')]?_0x44fcef[_0x3843('0x1a')][_0x3843('0x1b')]===undefined?!![]:![]:!![]})[_0x3843('0xd')](function(_0xa2da5){logger[_0x3843('0x14')](_0x3843('0x1c'),_0x44fcef);logger[_0x3843('0x10')](_0x3843('0x1c'),_0x44fcef,JSON[_0x3843('0x11')](_0xa2da5));_0x323f2c(_0xa2da5);})['catch'](function(_0x309c3f){logger[_0x3843('0x12')]('CreateWhatsappQueueReport',_0x309c3f[_0x3843('0x13')],_0x44fcef);_0x27d6a4(_0x51ac44['error'](0x1f4,_0x309c3f[_0x3843('0x13')]));});});};exports[_0x3843('0x1d')]=function(_0x4af4e1){var _0x19f8bd=this;return new Promise(function(_0x4219b7,_0x420a2a){return db[_0x3843('0x17')][_0x3843('0x1e')](_0x4af4e1['body'],{'raw':_0x4af4e1[_0x3843('0x1a')]?_0x4af4e1[_0x3843('0x1a')][_0x3843('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af4e1['options']?_0x4af4e1[_0x3843('0x1a')][_0x3843('0x1f')]||null:null,'attributes':_0x4af4e1[_0x3843('0x1a')]?_0x4af4e1[_0x3843('0x1a')][_0x3843('0x20')]||null:null,'limit':_0x4af4e1['options']?_0x4af4e1[_0x3843('0x1a')]['limit']||null:null})[_0x3843('0xd')](function(_0x139304){logger[_0x3843('0x14')](_0x3843('0x1d'),_0x4af4e1);logger[_0x3843('0x10')](_0x3843('0x1d'),_0x4af4e1,JSON[_0x3843('0x11')](_0x139304));_0x4219b7(_0x139304);})[_0x3843('0x16')](function(_0x2e114e){logger[_0x3843('0x12')](_0x3843('0x1d'),_0x2e114e[_0x3843('0x13')],_0x4af4e1);_0x420a2a(_0x19f8bd[_0x3843('0x12')](0x1f4,_0x2e114e[_0x3843('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 27fa4bd..224d5af 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 _0x58ec=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5e5f0b,_0x42d61d){var _0x4de9ea=function(_0x566acd){while(--_0x566acd){_0x5e5f0b['push'](_0x5e5f0b['shift']());}};_0x4de9ea(++_0x42d61d);}(_0x58ec,0xbf));var _0xc58e=function(_0x444e11,_0x5957ff){_0x444e11=_0x444e11-0x0;var _0x13fee5=_0x58ec[_0x444e11];return _0x13fee5;};'use strict';var multer=require(_0xc58e('0x0'));var util=require(_0xc58e('0x1'));var path=require(_0xc58e('0x2'));var timeout=require(_0xc58e('0x3'));var express=require(_0xc58e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc58e('0x5'));var interaction=require(_0xc58e('0x6'));var config=require(_0xc58e('0x7'));var controller=require(_0xc58e('0x8'));router[_0xc58e('0x9')]('/',auth[_0xc58e('0xa')](),controller[_0xc58e('0xb')]);router[_0xc58e('0x9')](_0xc58e('0xc'),auth['isAuthenticated'](),controller[_0xc58e('0xd')]);router[_0xc58e('0x9')](_0xc58e('0xe'),auth[_0xc58e('0xa')](),controller[_0xc58e('0xf')]);router[_0xc58e('0x10')]('/',auth['isAuthenticated'](),controller[_0xc58e('0x11')]);router[_0xc58e('0x12')](_0xc58e('0xe'),auth[_0xc58e('0xa')](),controller[_0xc58e('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc58e('0x14')]);module[_0xc58e('0x15')]=router; \ No newline at end of file +var _0xa865=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update'];(function(_0x1a099b,_0x1209e0){var _0x5ca45f=function(_0x3e0e73){while(--_0x3e0e73){_0x1a099b['push'](_0x1a099b['shift']());}};_0x5ca45f(++_0x1209e0);}(_0xa865,0x132));var _0x5a86=function(_0x1b56ac,_0x32127f){_0x1b56ac=_0x1b56ac-0x0;var _0x4eea86=_0xa865[_0x1b56ac];return _0x4eea86;};'use strict';var multer=require(_0x5a86('0x0'));var util=require(_0x5a86('0x1'));var path=require(_0x5a86('0x2'));var timeout=require(_0x5a86('0x3'));var express=require('express');var router=express[_0x5a86('0x4')]();var fs_extra=require(_0x5a86('0x5'));var auth=require(_0x5a86('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a86('0x7'));router[_0x5a86('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a86('0x8')]('/describe',auth[_0x5a86('0x9')](),controller[_0x5a86('0xa')]);router[_0x5a86('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5a86('0xb')]);router[_0x5a86('0xc')]('/',auth[_0x5a86('0x9')](),controller[_0x5a86('0xd')]);router[_0x5a86('0xe')](_0x5a86('0xf'),auth[_0x5a86('0x9')](),controller[_0x5a86('0x10')]);router['delete'](_0x5a86('0xf'),auth['isAuthenticated'](),controller[_0x5a86('0x11')]);module[_0x5a86('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5cd8977..36a7e7e 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 _0x3f9b=['agent','STRING','account'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x1bdcc8,_0x519d7c){_0x1bdcc8=_0x1bdcc8-0x0;var _0x1141bf=_0x3f9b[_0x1bdcc8];return _0x1141bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb3f9('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb3f9('0x1'),_0xb3f9('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb12d=['STRING','account','queue','DATE','sequelize','exports'];(function(_0x87667f,_0x2fa934){var _0x1c162b=function(_0x4da2ca){while(--_0x4da2ca){_0x87667f['push'](_0x87667f['shift']());}};_0x1c162b(++_0x2fa934);}(_0xb12d,0x124));var _0xdb12=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xb12d[_0xf0bc07];return _0x1c50c2;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'uniqueid':{'type':Sequelize[_0xdb12('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdb12('0x3'),'agent',_0xdb12('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdb12('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 17e6806..95124b8 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 _0xdd8c=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xdd8c,0xcb));var _0xcdd8=function(_0x323071,_0x123b2d){_0x323071=_0x323071-0x0;var _0x8894a9=_0xdd8c[_0x323071];return _0x8894a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcdd8('0x1'));var rp=require(_0xcdd8('0x2'));var moment=require(_0xcdd8('0x3'));var BPromise=require(_0xcdd8('0x4'));var Mustache=require('mustache');var util=require(_0xcdd8('0x5'));var path=require('path');var sox=require(_0xcdd8('0x6'));var csv=require(_0xcdd8('0x7'));var ejs=require(_0xcdd8('0x8'));var fs=require('fs');var fs_extra=require(_0xcdd8('0x9'));var _=require('lodash');var squel=require(_0xcdd8('0xa'));var crypto=require(_0xcdd8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdd8('0xc'));var toCsv=require(_0xcdd8('0x7'));var querystring=require(_0xcdd8('0xd'));var Papa=require(_0xcdd8('0xe'));var Redis=require(_0xcdd8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcdd8('0x10'));var as=require(_0xcdd8('0x11'));var hardwareService=require(_0xcdd8('0x12'));var logger=require(_0xcdd8('0x13'))(_0xcdd8('0x14'));var utils=require(_0xcdd8('0x15'));var config=require(_0xcdd8('0x16'));var licenseUtil=require(_0xcdd8('0x17'));var db=require(_0xcdd8('0x18'))['db'];function respondWithStatusCode(_0x286a2e,_0xc386ae){_0xc386ae=_0xc386ae||0xcc;return function(_0x550900){if(_0x550900){return _0x286a2e['sendStatus'](_0xc386ae);}return _0x286a2e[_0xcdd8('0x19')](_0xc386ae)[_0xcdd8('0x1a')]();};}function respondWithResult(_0x12804c,_0x30e128){_0x30e128=_0x30e128||0xc8;return function(_0x5aabfa){if(_0x5aabfa){return _0x12804c[_0xcdd8('0x19')](_0x30e128)[_0xcdd8('0x1b')](_0x5aabfa);}};}function respondWithFilteredResult(_0x5e6205,_0x3fc8c8){return function(_0x1951c4){if(_0x1951c4){var _0x10aee5=typeof _0x3fc8c8[_0xcdd8('0x1c')]===_0xcdd8('0x1d')&&typeof _0x3fc8c8['limit']==='undefined';var _0x28053e=_0x1951c4[_0xcdd8('0x1e')];var _0x1a59e6=_0x10aee5?0x0:_0x3fc8c8[_0xcdd8('0x1c')];var _0x35992d=_0x10aee5?_0x1951c4['count']:_0x3fc8c8[_0xcdd8('0x1c')]+_0x3fc8c8[_0xcdd8('0x1f')];var _0x4bba22;if(_0x35992d>=_0x28053e){_0x35992d=_0x28053e;_0x4bba22=0xc8;}else{_0x4bba22=0xce;}_0x5e6205['status'](_0x4bba22);return _0x5e6205[_0xcdd8('0x20')](_0xcdd8('0x21'),_0x1a59e6+'-'+_0x35992d+'/'+_0x28053e)[_0xcdd8('0x1b')](_0x1951c4);}return null;};}function patchUpdates(_0x49ef63){return function(_0x36bfb0){try{jsonpatch[_0xcdd8('0x22')](_0x36bfb0,_0x49ef63,!![]);}catch(_0xa7efcd){return BPromise[_0xcdd8('0x23')](_0xa7efcd);}return _0x36bfb0[_0xcdd8('0x24')]();};}function saveUpdates(_0x429abe,_0x201d20){return function(_0x2a11df){if(_0x2a11df){return _0x2a11df[_0xcdd8('0x25')](_0x429abe)[_0xcdd8('0x26')](function(_0x54b3ce){return _0x54b3ce;});}return null;};}function removeEntity(_0x4e580e,_0x3dcf54){return function(_0x46afae){if(_0x46afae){return _0x46afae[_0xcdd8('0x27')]()[_0xcdd8('0x26')](function(){_0x4e580e[_0xcdd8('0x19')](0xcc)[_0xcdd8('0x1a')]();});}};}function handleEntityNotFound(_0x1bf0b4,_0x3f92c9){return function(_0x5107a0){if(!_0x5107a0){_0x1bf0b4['sendStatus'](0x194);}return _0x5107a0;};}function handleError(_0x5e27f0,_0x2668a6){_0x2668a6=_0x2668a6||0x1f4;return function(_0x258861){logger['error'](_0x258861['stack']);if(_0x258861[_0xcdd8('0x28')]){delete _0x258861['name'];}_0x5e27f0[_0xcdd8('0x19')](_0x2668a6)[_0xcdd8('0x29')](_0x258861);};}exports['index']=function(_0x3e2ab8,_0x33cd46){var _0x44ebb5={},_0x4788d6={},_0x521042={'count':0x0,'rows':[]};var _0x1052c7=_['map'](db[_0xcdd8('0x2a')][_0xcdd8('0x2b')],function(_0x639788){return{'name':_0x639788[_0xcdd8('0x2c')],'type':_0x639788[_0xcdd8('0x2d')][_0xcdd8('0x2e')]};});_0x4788d6['model']=_[_0xcdd8('0x2f')](_0x1052c7,_0xcdd8('0x28'));_0x4788d6[_0xcdd8('0x30')]=_['keys'](_0x3e2ab8[_0xcdd8('0x30')]);_0x4788d6[_0xcdd8('0x31')]=_[_0xcdd8('0x32')](_0x4788d6['model'],_0x4788d6[_0xcdd8('0x30')]);_0x44ebb5[_0xcdd8('0x33')]=_[_0xcdd8('0x32')](_0x4788d6[_0xcdd8('0x34')],qs[_0xcdd8('0x35')](_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x35')]));_0x44ebb5[_0xcdd8('0x33')]=_0x44ebb5[_0xcdd8('0x33')][_0xcdd8('0x36')]?_0x44ebb5[_0xcdd8('0x33')]:_0x4788d6[_0xcdd8('0x34')];if(!_0x3e2ab8['query']['hasOwnProperty'](_0xcdd8('0x37'))){_0x44ebb5[_0xcdd8('0x1f')]=qs[_0xcdd8('0x1f')](_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x1f')]);_0x44ebb5[_0xcdd8('0x1c')]=qs[_0xcdd8('0x1c')](_0x3e2ab8['query']['offset']);}_0x44ebb5[_0xcdd8('0x38')]=qs['sort'](_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x39')]);_0x44ebb5[_0xcdd8('0x3a')]=qs[_0xcdd8('0x31')](_[_0xcdd8('0x3b')](_0x3e2ab8[_0xcdd8('0x30')],_0x4788d6['filters']),_0x1052c7);if(_0x3e2ab8['query']['filter']){_0x44ebb5['where']=_['merge'](_0x44ebb5['where'],{'$or':_['map'](_0x1052c7,function(_0x5307fd){if(_0x5307fd[_0xcdd8('0x2d')]!==_0xcdd8('0x3c')){var _0x2982b2={};_0x2982b2[_0x5307fd[_0xcdd8('0x28')]]={'$like':'%'+_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x3d')]+'%'};return _0x2982b2;}})});}_0x44ebb5=_[_0xcdd8('0x3e')]({},_0x44ebb5,_0x3e2ab8['options']);var _0x147b36={'where':_0x44ebb5['where']};return db['WhatsappTransferReport'][_0xcdd8('0x1e')](_0x147b36)[_0xcdd8('0x26')](function(_0x47cd1d){_0x521042['count']=_0x47cd1d;if(_0x3e2ab8[_0xcdd8('0x30')][_0xcdd8('0x3f')]){_0x44ebb5[_0xcdd8('0x40')]=[{'all':!![]}];}return db[_0xcdd8('0x2a')][_0xcdd8('0x41')](_0x44ebb5);})[_0xcdd8('0x26')](function(_0x3ca2b5){_0x521042['rows']=_0x3ca2b5;return _0x521042;})[_0xcdd8('0x26')](respondWithFilteredResult(_0x33cd46,_0x44ebb5))[_0xcdd8('0x42')](handleError(_0x33cd46,null));};exports[_0xcdd8('0x43')]=function(_0x2a385f,_0x4116ae){var _0x2d4faa={'raw':!![],'where':{'id':_0x2a385f[_0xcdd8('0x44')]['id']}},_0x5198cc={};_0x5198cc[_0xcdd8('0x34')]=_['keys'](db[_0xcdd8('0x2a')][_0xcdd8('0x2b')]);_0x5198cc[_0xcdd8('0x30')]=_[_0xcdd8('0x45')](_0x2a385f[_0xcdd8('0x30')]);_0x5198cc[_0xcdd8('0x31')]=_[_0xcdd8('0x32')](_0x5198cc[_0xcdd8('0x34')],_0x5198cc['query']);_0x2d4faa['attributes']=_['intersection'](_0x5198cc[_0xcdd8('0x34')],qs['fields'](_0x2a385f['query']['fields']));_0x2d4faa[_0xcdd8('0x33')]=_0x2d4faa[_0xcdd8('0x33')]['length']?_0x2d4faa[_0xcdd8('0x33')]:_0x5198cc[_0xcdd8('0x34')];if(_0x2a385f['query'][_0xcdd8('0x3f')]){_0x2d4faa[_0xcdd8('0x40')]=[{'all':!![]}];}_0x2d4faa=_[_0xcdd8('0x3e')]({},_0x2d4faa,_0x2a385f[_0xcdd8('0x46')]);return db['WhatsappTransferReport'][_0xcdd8('0x47')](_0x2d4faa)[_0xcdd8('0x26')](handleEntityNotFound(_0x4116ae,null))[_0xcdd8('0x26')](respondWithResult(_0x4116ae,null))['catch'](handleError(_0x4116ae,null));};exports[_0xcdd8('0x48')]=function(_0x3fb0f0,_0x4cbda8){return db[_0xcdd8('0x2a')][_0xcdd8('0x48')](_0x3fb0f0[_0xcdd8('0x49')],{})[_0xcdd8('0x26')](respondWithResult(_0x4cbda8,0xc9))['catch'](handleError(_0x4cbda8,null));};exports[_0xcdd8('0x25')]=function(_0x248841,_0x143d2f){if(_0x248841[_0xcdd8('0x49')]['id']){delete _0x248841[_0xcdd8('0x49')]['id'];}return db[_0xcdd8('0x2a')][_0xcdd8('0x47')]({'where':{'id':_0x248841[_0xcdd8('0x44')]['id']}})[_0xcdd8('0x26')](handleEntityNotFound(_0x143d2f,null))[_0xcdd8('0x26')](saveUpdates(_0x248841[_0xcdd8('0x49')],null))[_0xcdd8('0x26')](respondWithResult(_0x143d2f,null))[_0xcdd8('0x42')](handleError(_0x143d2f,null));};exports[_0xcdd8('0x27')]=function(_0x39df5d,_0x3c1f6d){return db['WhatsappTransferReport'][_0xcdd8('0x47')]({'where':{'id':_0x39df5d['params']['id']}})['then'](handleEntityNotFound(_0x3c1f6d,null))[_0xcdd8('0x26')](removeEntity(_0x3c1f6d,null))['catch'](handleError(_0x3c1f6d,null));};exports['describe']=function(_0x1ed5f9,_0x12eb81){return db[_0xcdd8('0x2a')][_0xcdd8('0x4a')]()[_0xcdd8('0x26')](respondWithResult(_0x12eb81,null))[_0xcdd8('0x42')](handleError(_0x12eb81,null));}; \ No newline at end of file +var _0x8ce2=['attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','include','rows','catch','show','params','length','includeAll','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','save','then','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','model','keys','query','filters'];(function(_0x11bd59,_0x4e54ca){var _0x515581=function(_0x59df62){while(--_0x59df62){_0x11bd59['push'](_0x11bd59['shift']());}};_0x515581(++_0x4e54ca);}(_0x8ce2,0x18b));var _0x28ce=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x8ce2[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x28ce('0x0'));var rimraf=require(_0x28ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28ce('0x2'));var rp=require(_0x28ce('0x3'));var moment=require(_0x28ce('0x4'));var BPromise=require(_0x28ce('0x5'));var Mustache=require(_0x28ce('0x6'));var util=require(_0x28ce('0x7'));var path=require('path');var sox=require(_0x28ce('0x8'));var csv=require(_0x28ce('0x9'));var ejs=require(_0x28ce('0xa'));var fs=require('fs');var fs_extra=require(_0x28ce('0xb'));var _=require(_0x28ce('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28ce('0xd'));var deskjs=require(_0x28ce('0xe'));var toCsv=require(_0x28ce('0x9'));var querystring=require(_0x28ce('0xf'));var Papa=require(_0x28ce('0x10'));var Redis=require(_0x28ce('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x28ce('0x12'));var as=require(_0x28ce('0x13'));var hardwareService=require(_0x28ce('0x14'));var logger=require(_0x28ce('0x15'))('api');var utils=require(_0x28ce('0x16'));var config=require(_0x28ce('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x28ce('0x18'))['db'];function respondWithStatusCode(_0x565301,_0x3f7a82){_0x3f7a82=_0x3f7a82||0xcc;return function(_0x14d096){if(_0x14d096){return _0x565301[_0x28ce('0x19')](_0x3f7a82);}return _0x565301['status'](_0x3f7a82)[_0x28ce('0x1a')]();};}function respondWithResult(_0x39f188,_0x2f08e2){_0x2f08e2=_0x2f08e2||0xc8;return function(_0x3d557f){if(_0x3d557f){return _0x39f188[_0x28ce('0x1b')](_0x2f08e2)[_0x28ce('0x1c')](_0x3d557f);}};}function respondWithFilteredResult(_0x46c874,_0x3e02de){return function(_0x44e3eb){if(_0x44e3eb){var _0x52a3e2=typeof _0x3e02de[_0x28ce('0x1d')]===_0x28ce('0x1e')&&typeof _0x3e02de[_0x28ce('0x1f')]===_0x28ce('0x1e');var _0x158b18=_0x44e3eb[_0x28ce('0x20')];var _0x1b1411=_0x52a3e2?0x0:_0x3e02de[_0x28ce('0x1d')];var _0x1e4eec=_0x52a3e2?_0x44e3eb[_0x28ce('0x20')]:_0x3e02de['offset']+_0x3e02de['limit'];var _0x2f1468;if(_0x1e4eec>=_0x158b18){_0x1e4eec=_0x158b18;_0x2f1468=0xc8;}else{_0x2f1468=0xce;}_0x46c874[_0x28ce('0x1b')](_0x2f1468);return _0x46c874[_0x28ce('0x21')]('Content-Range',_0x1b1411+'-'+_0x1e4eec+'/'+_0x158b18)[_0x28ce('0x1c')](_0x44e3eb);}return null;};}function patchUpdates(_0x2c9a64){return function(_0x1d2ebf){try{jsonpatch['apply'](_0x1d2ebf,_0x2c9a64,!![]);}catch(_0x4c6b9f){return BPromise['reject'](_0x4c6b9f);}return _0x1d2ebf[_0x28ce('0x22')]();};}function saveUpdates(_0xd1ced5,_0x22c6aa){return function(_0x2d4e8a){if(_0x2d4e8a){return _0x2d4e8a['update'](_0xd1ced5)['then'](function(_0x8ea2c9){return _0x8ea2c9;});}return null;};}function removeEntity(_0x58cc84,_0x6ff15c){return function(_0x5017c7){if(_0x5017c7){return _0x5017c7['destroy']()[_0x28ce('0x23')](function(){_0x58cc84[_0x28ce('0x1b')](0xcc)[_0x28ce('0x1a')]();});}};}function handleEntityNotFound(_0x1e71ca,_0x51a015){return function(_0x231b95){if(!_0x231b95){_0x1e71ca[_0x28ce('0x19')](0x194);}return _0x231b95;};}function handleError(_0x4667cd,_0x2ef379){_0x2ef379=_0x2ef379||0x1f4;return function(_0x2f21de){logger[_0x28ce('0x24')](_0x2f21de[_0x28ce('0x25')]);if(_0x2f21de[_0x28ce('0x26')]){delete _0x2f21de['name'];}_0x4667cd[_0x28ce('0x1b')](_0x2ef379)[_0x28ce('0x27')](_0x2f21de);};}exports[_0x28ce('0x28')]=function(_0x186639,_0x121a9a){var _0x37c4d4={},_0x9f5834={},_0x3f5c2b={'count':0x0,'rows':[]};var _0x12c91e=_['map'](db[_0x28ce('0x29')][_0x28ce('0x2a')],function(_0x89bc8c){return{'name':_0x89bc8c[_0x28ce('0x2b')],'type':_0x89bc8c[_0x28ce('0x2c')]['key']};});_0x9f5834[_0x28ce('0x2d')]=_['map'](_0x12c91e,_0x28ce('0x26'));_0x9f5834['query']=_[_0x28ce('0x2e')](_0x186639[_0x28ce('0x2f')]);_0x9f5834[_0x28ce('0x30')]=_['intersection'](_0x9f5834['model'],_0x9f5834[_0x28ce('0x2f')]);_0x37c4d4[_0x28ce('0x31')]=_[_0x28ce('0x32')](_0x9f5834[_0x28ce('0x2d')],qs[_0x28ce('0x33')](_0x186639[_0x28ce('0x2f')][_0x28ce('0x33')]));_0x37c4d4[_0x28ce('0x31')]=_0x37c4d4[_0x28ce('0x31')]['length']?_0x37c4d4[_0x28ce('0x31')]:_0x9f5834[_0x28ce('0x2d')];if(!_0x186639[_0x28ce('0x2f')][_0x28ce('0x34')](_0x28ce('0x35'))){_0x37c4d4[_0x28ce('0x1f')]=qs[_0x28ce('0x1f')](_0x186639['query'][_0x28ce('0x1f')]);_0x37c4d4['offset']=qs[_0x28ce('0x1d')](_0x186639['query'][_0x28ce('0x1d')]);}_0x37c4d4[_0x28ce('0x36')]=qs[_0x28ce('0x37')](_0x186639[_0x28ce('0x2f')][_0x28ce('0x37')]);_0x37c4d4['where']=qs[_0x28ce('0x30')](_['pick'](_0x186639['query'],_0x9f5834['filters']),_0x12c91e);if(_0x186639[_0x28ce('0x2f')]['filter']){_0x37c4d4[_0x28ce('0x38')]=_[_0x28ce('0x39')](_0x37c4d4[_0x28ce('0x38')],{'$or':_[_0x28ce('0x3a')](_0x12c91e,function(_0x2a506e){if(_0x2a506e[_0x28ce('0x2c')]!==_0x28ce('0x3b')){var _0x584f55={};_0x584f55[_0x2a506e[_0x28ce('0x26')]]={'$like':'%'+_0x186639[_0x28ce('0x2f')][_0x28ce('0x3c')]+'%'};return _0x584f55;}})});}_0x37c4d4=_[_0x28ce('0x39')]({},_0x37c4d4,_0x186639[_0x28ce('0x3d')]);var _0x4d0601={'where':_0x37c4d4[_0x28ce('0x38')]};return db[_0x28ce('0x29')][_0x28ce('0x20')](_0x4d0601)[_0x28ce('0x23')](function(_0x16e825){_0x3f5c2b[_0x28ce('0x20')]=_0x16e825;if(_0x186639['query']['includeAll']){_0x37c4d4[_0x28ce('0x3e')]=[{'all':!![]}];}return db[_0x28ce('0x29')]['findAll'](_0x37c4d4);})[_0x28ce('0x23')](function(_0xd54d31){_0x3f5c2b[_0x28ce('0x3f')]=_0xd54d31;return _0x3f5c2b;})[_0x28ce('0x23')](respondWithFilteredResult(_0x121a9a,_0x37c4d4))[_0x28ce('0x40')](handleError(_0x121a9a,null));};exports[_0x28ce('0x41')]=function(_0x2e2b84,_0x3afa17){var _0x480e11={'raw':!![],'where':{'id':_0x2e2b84[_0x28ce('0x42')]['id']}},_0x43f071={};_0x43f071[_0x28ce('0x2d')]=_[_0x28ce('0x2e')](db[_0x28ce('0x29')][_0x28ce('0x2a')]);_0x43f071[_0x28ce('0x2f')]=_[_0x28ce('0x2e')](_0x2e2b84[_0x28ce('0x2f')]);_0x43f071[_0x28ce('0x30')]=_[_0x28ce('0x32')](_0x43f071[_0x28ce('0x2d')],_0x43f071[_0x28ce('0x2f')]);_0x480e11[_0x28ce('0x31')]=_['intersection'](_0x43f071[_0x28ce('0x2d')],qs[_0x28ce('0x33')](_0x2e2b84[_0x28ce('0x2f')][_0x28ce('0x33')]));_0x480e11[_0x28ce('0x31')]=_0x480e11['attributes'][_0x28ce('0x43')]?_0x480e11[_0x28ce('0x31')]:_0x43f071['model'];if(_0x2e2b84[_0x28ce('0x2f')][_0x28ce('0x44')]){_0x480e11[_0x28ce('0x3e')]=[{'all':!![]}];}_0x480e11=_[_0x28ce('0x39')]({},_0x480e11,_0x2e2b84[_0x28ce('0x3d')]);return db[_0x28ce('0x29')][_0x28ce('0x45')](_0x480e11)[_0x28ce('0x23')](handleEntityNotFound(_0x3afa17,null))[_0x28ce('0x23')](respondWithResult(_0x3afa17,null))[_0x28ce('0x40')](handleError(_0x3afa17,null));};exports[_0x28ce('0x46')]=function(_0x33a648,_0x3b2af5){return db[_0x28ce('0x29')][_0x28ce('0x46')](_0x33a648[_0x28ce('0x47')],{})[_0x28ce('0x23')](respondWithResult(_0x3b2af5,0xc9))[_0x28ce('0x40')](handleError(_0x3b2af5,null));};exports[_0x28ce('0x48')]=function(_0x40a570,_0x37b092){if(_0x40a570[_0x28ce('0x47')]['id']){delete _0x40a570[_0x28ce('0x47')]['id'];}return db[_0x28ce('0x29')]['find']({'where':{'id':_0x40a570[_0x28ce('0x42')]['id']}})[_0x28ce('0x23')](handleEntityNotFound(_0x37b092,null))[_0x28ce('0x23')](saveUpdates(_0x40a570[_0x28ce('0x47')],null))[_0x28ce('0x23')](respondWithResult(_0x37b092,null))['catch'](handleError(_0x37b092,null));};exports['destroy']=function(_0x164638,_0x495ca4){return db['WhatsappTransferReport'][_0x28ce('0x45')]({'where':{'id':_0x164638['params']['id']}})[_0x28ce('0x23')](handleEntityNotFound(_0x495ca4,null))['then'](removeEntity(_0x495ca4,null))[_0x28ce('0x40')](handleError(_0x495ca4,null));};exports[_0x28ce('0x49')]=function(_0x33f0ca,_0x30989a){return db[_0x28ce('0x29')][_0x28ce('0x49')]()['then'](respondWithResult(_0x30989a,null))[_0x28ce('0x40')](handleError(_0x30989a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 52029e9..2a0b974 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 _0x4909=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2ea6a4,_0x35d33d){var _0x47094b=function(_0x1d9ddb){while(--_0x1d9ddb){_0x2ea6a4['push'](_0x2ea6a4['shift']());}};_0x47094b(++_0x35d33d);}(_0x4909,0x18b));var _0x9490=function(_0x303862,_0x20b5ab){_0x303862=_0x303862-0x0;var _0xe6f228=_0x4909[_0x303862];return _0xe6f228;};'use strict';var _=require(_0x9490('0x0'));var util=require(_0x9490('0x1'));var logger=require(_0x9490('0x2'))(_0x9490('0x3'));var moment=require('moment');var BPromise=require(_0x9490('0x4'));var rp=require(_0x9490('0x5'));var fs=require('fs');var path=require(_0x9490('0x6'));var rimraf=require(_0x9490('0x7'));var config=require('../../config/environment');var attributes=require(_0x9490('0x8'));module[_0x9490('0x9')]=function(_0x3f5cda,_0x37d23f){return _0x3f5cda[_0x9490('0xa')](_0x9490('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x9490('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x67a6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x67a6,0xee));var _0x667a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x67a6[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x667a('0x0'));var util=require(_0x667a('0x1'));var logger=require(_0x667a('0x2'))(_0x667a('0x3'));var moment=require(_0x667a('0x4'));var BPromise=require(_0x667a('0x5'));var rp=require(_0x667a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x667a('0x7'));var config=require(_0x667a('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x667a('0x9')]=function(_0x4eda9e,_0x3c209d){return _0x4eda9e[_0x667a('0xa')](_0x667a('0xb'),attributes,{'tableName':_0x667a('0xc'),'paranoid':![],'indexes':[{'name':_0x667a('0xd'),'fields':[_0x667a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e82adb3..e17cf7b 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 _0xf545=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x19413a,_0x373beb){var _0x13e4cf=function(_0x131fc2){while(--_0x131fc2){_0x19413a['push'](_0x19413a['shift']());}};_0x13e4cf(++_0x373beb);}(_0xf545,0x179));var _0x5f54=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0xf545[_0x48b724];return _0x4d38b3;};'use strict';var _=require(_0x5f54('0x0'));var util=require(_0x5f54('0x1'));var moment=require(_0x5f54('0x2'));var BPromise=require(_0x5f54('0x3'));var rs=require(_0x5f54('0x4'));var fs=require('fs');var Redis=require(_0x5f54('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f54('0x6'));var logger=require(_0x5f54('0x7'))(_0x5f54('0x8'));var config=require(_0x5f54('0x9'));var jayson=require(_0x5f54('0xa'));var client=jayson['client'][_0x5f54('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc52cc8,_0x991302,_0x144003){return new BPromise(function(_0x59cea9,_0xa1e9ea){return client[_0x5f54('0xc')](_0xc52cc8,_0x144003)[_0x5f54('0xd')](function(_0xbcc5f8){logger['info'](_0x5f54('0xe'),_0x991302,_0x5f54('0xf'));logger[_0x5f54('0x10')](_0x5f54('0x11'),_0x991302,'request\x20sent',JSON[_0x5f54('0x12')](_0xbcc5f8));if(_0xbcc5f8['error']){if(_0xbcc5f8['error'][_0x5f54('0x13')]===0x1f4){logger[_0x5f54('0x14')](_0x5f54('0xe'),_0x991302,_0xbcc5f8[_0x5f54('0x14')]['message']);return _0xa1e9ea(_0xbcc5f8[_0x5f54('0x14')][_0x5f54('0x15')]);}logger[_0x5f54('0x14')](_0x5f54('0xe'),_0x991302,_0xbcc5f8['error']['message']);return _0x59cea9(_0xbcc5f8[_0x5f54('0x14')][_0x5f54('0x15')]);}else{logger[_0x5f54('0x16')](_0x5f54('0xe'),_0x991302,'request\x20sent');_0x59cea9(_0xbcc5f8[_0x5f54('0x17')][_0x5f54('0x15')]);}})[_0x5f54('0x18')](function(_0x55b376){logger[_0x5f54('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x991302,_0x55b376);_0xa1e9ea(_0x55b376);});});} \ No newline at end of file +var _0x9196=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x3b1e89,_0x2228f8){var _0x5ea335=function(_0x24b0a2){while(--_0x24b0a2){_0x3b1e89['push'](_0x3b1e89['shift']());}};_0x5ea335(++_0x2228f8);}(_0x9196,0xd1));var _0x6919=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x9196[_0x8e9386];return _0x4abf26;};'use strict';var _=require(_0x6919('0x0'));var util=require(_0x6919('0x1'));var moment=require('moment');var BPromise=require(_0x6919('0x2'));var rs=require(_0x6919('0x3'));var fs=require('fs');var Redis=require(_0x6919('0x4'));var db=require(_0x6919('0x5'))['db'];var utils=require(_0x6919('0x6'));var logger=require(_0x6919('0x7'))('rpc');var config=require(_0x6919('0x8'));var jayson=require(_0x6919('0x9'));var client=jayson[_0x6919('0xa')][_0x6919('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106ea3,_0x2b42a0,_0x2ec378){return new BPromise(function(_0x36c25f,_0x5cb09f){return client[_0x6919('0xc')](_0x106ea3,_0x2ec378)[_0x6919('0xd')](function(_0x1b4bab){logger[_0x6919('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2b42a0,'request\x20sent');logger['debug'](_0x6919('0xf'),_0x2b42a0,_0x6919('0x10'),JSON[_0x6919('0x11')](_0x1b4bab));if(_0x1b4bab[_0x6919('0x12')]){if(_0x1b4bab[_0x6919('0x12')]['code']===0x1f4){logger[_0x6919('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2b42a0,_0x1b4bab[_0x6919('0x12')]['message']);return _0x5cb09f(_0x1b4bab[_0x6919('0x12')][_0x6919('0x13')]);}logger[_0x6919('0x12')](_0x6919('0x14'),_0x2b42a0,_0x1b4bab[_0x6919('0x12')]['message']);return _0x36c25f(_0x1b4bab[_0x6919('0x12')]['message']);}else{logger[_0x6919('0xe')](_0x6919('0x14'),_0x2b42a0,'request\x20sent');_0x36c25f(_0x1b4bab[_0x6919('0x15')][_0x6919('0x13')]);}})[_0x6919('0x16')](function(_0x4cbc5f){logger[_0x6919('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2b42a0,_0x4cbc5f);_0x5cb09f(_0x4cbc5f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 51cd008..be73cd9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b83=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','online','Offline\x20apps:','status','join','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0x7b83,0xa1));var _0x37b8=function(_0x4215b8,_0x398c6c){_0x4215b8=_0x4215b8-0x0;var _0x45f9c3=_0x7b83[_0x4215b8];return _0x45f9c3;};'use strict';var _=require(_0x37b8('0x0'));var db=require(_0x37b8('0x1'))['db'];var seedDb=require(_0x37b8('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x37b8('0x3'));var logger=require(_0x37b8('0x4'))(_0x37b8('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x37b8('0x6'));var schedule=require(_0x37b8('0x7'));var chat=require(_0x37b8('0x8'));var whatsapp=require(_0x37b8('0x9'));var transcribe=require(_0x37b8('0xa'));var provider=require(_0x37b8('0xb'));function main(){return db['sequelize'][_0x37b8('0xc')]()[_0x37b8('0xd')](function(){if(config['seedDB']){return seedDb[_0x37b8('0xe')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc['listen']();})[_0x37b8('0xd')](function(_0xa1526a){logger[_0x37b8('0xf')](_0xa1526a);return chat[_0x37b8('0x10')]();})[_0x37b8('0xd')](function(){return whatsapp['start']();})[_0x37b8('0xd')](function(){return schedule['start']();})[_0x37b8('0xd')](function(){return transcribe['start']();})[_0x37b8('0xd')](function(){return provider[_0x37b8('0x10')]();})[_0x37b8('0xd')](function(_0xf737ae){logger[_0x37b8('0xf')](_0xf737ae);return pm2['start'](pm2Config);})['then'](function(_0x316229){var _0x35fe29=_0x316229[_0x37b8('0x11')](function(_0x4ab58e){return typeof _0x4ab58e['exitCode']===_0x37b8('0x12')&&_0x4ab58e[_0x37b8('0x13')]>=0x0;});if(_0x35fe29[_0x37b8('0x14')]>0x0){throw new Error(_0x35fe29[_0x37b8('0x14')]+_0x37b8('0x15')+_[_0x37b8('0x16')](_0x35fe29,function(_0x286cf3){return'\x22'+_0x286cf3['pm2_env'][_0x37b8('0x17')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x37b8('0x16')](_[_0x37b8('0x11')](_0x316229,{'status':_0x37b8('0x18')}),_0x37b8('0x17'))['join']());logger[_0x37b8('0xf')](_0x37b8('0x19'),_[_0x37b8('0x16')](_[_0x37b8('0x11')](_0x316229,function(_0x497623){return _0x497623[_0x37b8('0x1a')]!==_0x37b8('0x18');}),_0x37b8('0x17'))[_0x37b8('0x1b')]()||'None');console[_0x37b8('0x1c')](_0x37b8('0x1d'));})[_0x37b8('0x1e')](function(_0x1cf84a){console[_0x37b8('0x1c')](_0x37b8('0x1f'),_0x1cf84a);logger[_0x37b8('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1cf84a);process[_0x37b8('0x21')](0x1);});}main(); \ No newline at end of file +var _0x8784=['lodash','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','map','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x416a98,_0xcec305){var _0x33e6a4=function(_0x39d2b0){while(--_0x39d2b0){_0x416a98['push'](_0x416a98['shift']());}};_0x33e6a4(++_0xcec305);}(_0x8784,0x172));var _0x4878=function(_0xb5fc3e,_0x234703){_0xb5fc3e=_0xb5fc3e-0x0;var _0x2efc3c=_0x8784[_0xb5fc3e];return _0x2efc3c;};'use strict';var _=require(_0x4878('0x0'));var db=require(_0x4878('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x4878('0x2'));var rpc=require(_0x4878('0x3'));var config=require(_0x4878('0x4'));var logger=require(_0x4878('0x5'))(_0x4878('0x6'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x4878('0x7'));var chat=require(_0x4878('0x8'));var whatsapp=require(_0x4878('0x9'));var transcribe=require(_0x4878('0xa'));var provider=require(_0x4878('0xb'));function main(){return db[_0x4878('0xc')][_0x4878('0xd')]()[_0x4878('0xe')](function(){if(config[_0x4878('0xf')]){return seedDb['default']();}})[_0x4878('0xe')](function(){return checkLicense[_0x4878('0x10')]();})[_0x4878('0xe')](function(){return rpc[_0x4878('0x11')]();})[_0x4878('0xe')](function(_0x1febf2){logger[_0x4878('0x12')](_0x1febf2);return chat[_0x4878('0x13')]();})[_0x4878('0xe')](function(){return whatsapp[_0x4878('0x13')]();})[_0x4878('0xe')](function(){return schedule[_0x4878('0x13')]();})['then'](function(){return transcribe[_0x4878('0x13')]();})[_0x4878('0xe')](function(){return provider[_0x4878('0x13')]();})['then'](function(_0x13a0ef){logger[_0x4878('0x12')](_0x13a0ef);return pm2['start'](pm2Config);})[_0x4878('0xe')](function(_0x5e67cc){var _0x4ec9f8=_0x5e67cc[_0x4878('0x14')](function(_0x41fefd){return typeof _0x41fefd[_0x4878('0x15')]===_0x4878('0x16')&&_0x41fefd[_0x4878('0x15')]>=0x0;});if(_0x4ec9f8['length']>0x0){throw new Error(_0x4ec9f8[_0x4878('0x17')]+_0x4878('0x18')+_['map'](_0x4ec9f8,function(_0x4319a8){return'\x22'+_0x4319a8['pm2_env'][_0x4878('0x19')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x4878('0x1a')](_[_0x4878('0x14')](_0x5e67cc,{'status':_0x4878('0x1b')}),_0x4878('0x19'))[_0x4878('0x1c')]());logger['info'](_0x4878('0x1d'),_[_0x4878('0x1a')](_[_0x4878('0x14')](_0x5e67cc,function(_0x436f62){return _0x436f62[_0x4878('0x1e')]!==_0x4878('0x1b');}),'name')[_0x4878('0x1c')]()||_0x4878('0x1f'));console[_0x4878('0x20')]('App\x20Ready!');})[_0x4878('0x21')](function(_0x38bc49){console['log'](_0x4878('0x22'),_0x38bc49);logger[_0x4878('0x23')](_0x4878('0x24'),_0x38bc49);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 45c21e1..acd9ae5 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 _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x41c49e,_0x4e9e2c){_0x41c49e=_0x41c49e-0x0;var _0x648a67=_0x9bde[_0x41c49e];return _0x648a67;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file +var _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1a19ab,_0x1576ae){_0x1a19ab=_0x1a19ab-0x0;var _0x3c7d02=_0x9bde[_0x1a19ab];return _0x3c7d02;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 76c8eba..b350066 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 _0x064a=['hasOwnProperty','encryptFile','createWriteStream','createCipher','data','binary','write','final','end','close','unlink','decryptFile','createReadStream','createDecipher','update','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter'];(function(_0x4ebcea,_0x4cf4c6){var _0x5de849=function(_0x237d66){while(--_0x237d66){_0x4ebcea['push'](_0x4ebcea['shift']());}};_0x5de849(++_0x4cf4c6);}(_0x064a,0x188));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xa064('0x0'));var fs=require('fs');var BPromise=require(_0xa064('0x1'));var _=require(_0xa064('0x2'));var config=require(_0xa064('0x3'));var logger=require('../../config/logger')(_0xa064('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa064('0x5')]['session'],'algorithm':_0xa064('0x6')};const fileOptions={'algorithm':_0xa064('0x7')};if(config['encrypt']&&config[_0xa064('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xa064('0x8')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0xa064('0x8')][_0xa064('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa064('0xa')](',\x20');logger[_0xa064('0xb')](config[_0xa064('0x8')]['algorithm'],_0xa064('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x31958d){return AES_SUPPORTED_RX[_0xa064('0xd')](_0x31958d);}function getSupportedCiphers(){return crypto[_0xa064('0xe')]()[_0xa064('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x2019ef){return getSupportedCiphers()['indexOf'](_0x2019ef)>-0x1;}function combineOptions(_0x632017){var _0x4ca8ea={};for(var _0x4c2270 in fileOptions){if(fileOptions[_0xa064('0x10')](_0x4c2270)){_0x4ca8ea[_0x4c2270]=fileOptions[_0x4c2270];}}if(_0x632017){for(var _0x2f9c12 in _0x632017){if(_0x632017[_0xa064('0x10')](_0x2f9c12)){_0x4ca8ea[_0x2f9c12]=_0x632017[_0x2f9c12];}}}return _0x4ca8ea;}exports[_0xa064('0x11')]=function(_0x30feda,_0x50f578,_0x3869ee,_0x313871){return new BPromise(function(_0x57f4bb,_0x535f33){_0x313871=combineOptions(_0x313871);var _0x35b13e=new Buffer(_0x3869ee);var _0x8db565=fs['createReadStream'](_0x30feda);var _0x23bfd7=fs[_0xa064('0x12')](_0x50f578);var _0x205adb=crypto[_0xa064('0x13')](_0x313871['algorithm'],_0x35b13e);_0x8db565['on'](_0xa064('0x14'),function(_0x4457f5){var _0x2778bd=new Buffer(_0x205adb['update'](_0x4457f5),_0xa064('0x15'));_0x23bfd7[_0xa064('0x16')](_0x2778bd);});_0x8db565['on']('end',function(){try{var _0x4e002c=new Buffer(_0x205adb[_0xa064('0x17')](_0xa064('0x15')),'binary');_0x23bfd7['write'](_0x4e002c);_0x23bfd7[_0xa064('0x18')]();_0x23bfd7['on'](_0xa064('0x19'),function(){return _0x57f4bb(_0x50f578);});}catch(_0x6c8c70){fs[_0xa064('0x1a')](_0x50f578);return _0x535f33(_0x6c8c70);}});});};exports[_0xa064('0x1b')]=function(_0x399751,_0xf6323f,_0x1c5e44,_0x15007e){return new BPromise(function(_0x3e04f9,_0x548770){_0x15007e=combineOptions(_0x15007e);var _0x5b177c=new Buffer(_0x1c5e44);var _0xfdd5d0=fs[_0xa064('0x1c')](_0x399751);var _0x502101=fs[_0xa064('0x12')](_0xf6323f);var _0xd95ade=crypto[_0xa064('0x1d')](_0x15007e[_0xa064('0x9')],_0x5b177c);_0xfdd5d0['on'](_0xa064('0x14'),function(_0xf66964){var _0x12bbe5=new Buffer(_0xd95ade[_0xa064('0x1e')](_0xf66964),_0xa064('0x15'));_0x502101[_0xa064('0x16')](_0x12bbe5);});_0xfdd5d0['on'](_0xa064('0x18'),function(){try{var _0x22fced=new Buffer(_0xd95ade[_0xa064('0x17')](_0xa064('0x15')),_0xa064('0x15'));_0x502101[_0xa064('0x16')](_0x22fced);_0x502101[_0xa064('0x18')]();_0x502101['on'](_0xa064('0x19'),function(){return _0x3e04f9(_0xf6323f);});}catch(_0x3fba6b){fs['unlink'](_0xf6323f);return _0x548770(_0x3fba6b);}});});};exports['encryptString']=function(_0x3e0548,_0x10bb4a,_0x493290){var _0x4e538e=_0x493290||stringOptions[_0xa064('0x9')];var _0x318f6f=_0x10bb4a||stringOptions['secret'];var _0xd87bd7=crypto[_0xa064('0x13')](_0x4e538e,_0x318f6f);var _0x1aacc8=_0xd87bd7[_0xa064('0x1e')](_0x3e0548,_0xa064('0x1f'),'base64');_0x1aacc8+=_0xd87bd7['final'](_0xa064('0x20'));return _0x1aacc8;};exports[_0xa064('0x21')]=function(_0x4a1642,_0x38f5df,_0x57a1ec){var _0x203397=_0x57a1ec||stringOptions[_0xa064('0x9')];var _0x58f16=_0x38f5df||stringOptions['secret'];var _0x37373c=crypto[_0xa064('0x1d')](_0x203397,_0x58f16);var _0x9d785c=_0x37373c[_0xa064('0x1e')](_0x4a1642,_0xa064('0x20'),_0xa064('0x1f'));_0x9d785c+=_0x37373c['final'](_0xa064('0x1f'));return _0x9d785c;}; \ No newline at end of file +var _0x5281=['binary','end','final','write','close','unlink','createWriteStream','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x5281,0x1bd));var _0x1528=function(_0x5d4840,_0x57db8b){_0x5d4840=_0x5d4840-0x0;var _0x83cd9f=_0x5281[_0x5d4840];return _0x83cd9f;};'use strict';var crypto=require(_0x1528('0x0'));var fs=require('fs');var BPromise=require(_0x1528('0x1'));var _=require(_0x1528('0x2'));var config=require(_0x1528('0x3'));var logger=require(_0x1528('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1528('0x5')][_0x1528('0x6')],'algorithm':_0x1528('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x1528('0x8')]&&config[_0x1528('0x8')][_0x1528('0x9')]){var isSupported=isAlgorithmSupported(config[_0x1528('0x8')][_0x1528('0x9')]);if(isSupported){fileOptions[_0x1528('0x9')]=config[_0x1528('0x8')][_0x1528('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1528('0xa')](',\x20');logger[_0x1528('0xb')](config[_0x1528('0x8')][_0x1528('0x9')],_0x1528('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2a6e79){return AES_SUPPORTED_RX[_0x1528('0xd')](_0x2a6e79);}function getSupportedCiphers(){return crypto[_0x1528('0xe')]()[_0x1528('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x35802a){return getSupportedCiphers()[_0x1528('0x10')](_0x35802a)>-0x1;}function combineOptions(_0x47f339){var _0xd2570d={};for(var _0x373f86 in fileOptions){if(fileOptions[_0x1528('0x11')](_0x373f86)){_0xd2570d[_0x373f86]=fileOptions[_0x373f86];}}if(_0x47f339){for(var _0x524c4 in _0x47f339){if(_0x47f339['hasOwnProperty'](_0x524c4)){_0xd2570d[_0x524c4]=_0x47f339[_0x524c4];}}}return _0xd2570d;}exports[_0x1528('0x12')]=function(_0x397fc4,_0x1886bc,_0x516114,_0xae7f46){return new BPromise(function(_0x3673ea,_0x2a498e){_0xae7f46=combineOptions(_0xae7f46);var _0x46fa28=new Buffer(_0x516114);var _0xd9d199=fs[_0x1528('0x13')](_0x397fc4);var _0x39963a=fs['createWriteStream'](_0x1886bc);var _0x268bdf=crypto[_0x1528('0x14')](_0xae7f46[_0x1528('0x9')],_0x46fa28);_0xd9d199['on'](_0x1528('0x15'),function(_0x523bdd){var _0x2df4e9=new Buffer(_0x268bdf[_0x1528('0x16')](_0x523bdd),_0x1528('0x17'));_0x39963a['write'](_0x2df4e9);});_0xd9d199['on'](_0x1528('0x18'),function(){try{var _0x16f7fa=new Buffer(_0x268bdf[_0x1528('0x19')]('binary'),'binary');_0x39963a[_0x1528('0x1a')](_0x16f7fa);_0x39963a[_0x1528('0x18')]();_0x39963a['on'](_0x1528('0x1b'),function(){return _0x3673ea(_0x1886bc);});}catch(_0x27b03a){fs[_0x1528('0x1c')](_0x1886bc);return _0x2a498e(_0x27b03a);}});});};exports['decryptFile']=function(_0x1f6791,_0x17a1db,_0x152ff1,_0x490692){return new BPromise(function(_0x1ea28e,_0x30c97a){_0x490692=combineOptions(_0x490692);var _0x52c7a9=new Buffer(_0x152ff1);var _0x490feb=fs[_0x1528('0x13')](_0x1f6791);var _0x148a1c=fs[_0x1528('0x1d')](_0x17a1db);var _0x4aae51=crypto[_0x1528('0x1e')](_0x490692[_0x1528('0x9')],_0x52c7a9);_0x490feb['on'](_0x1528('0x15'),function(_0x30660b){var _0x3dcce1=new Buffer(_0x4aae51[_0x1528('0x16')](_0x30660b),_0x1528('0x17'));_0x148a1c[_0x1528('0x1a')](_0x3dcce1);});_0x490feb['on']('end',function(){try{var _0x55edb4=new Buffer(_0x4aae51[_0x1528('0x19')](_0x1528('0x17')),'binary');_0x148a1c['write'](_0x55edb4);_0x148a1c[_0x1528('0x18')]();_0x148a1c['on']('close',function(){return _0x1ea28e(_0x17a1db);});}catch(_0x377d2b){fs[_0x1528('0x1c')](_0x17a1db);return _0x30c97a(_0x377d2b);}});});};exports[_0x1528('0x1f')]=function(_0x3eea1f,_0x287315,_0x56331a){var _0x2f31a3=_0x56331a||stringOptions[_0x1528('0x9')];var _0xfe9822=_0x287315||stringOptions[_0x1528('0x20')];var _0x5516a8=crypto[_0x1528('0x14')](_0x2f31a3,_0xfe9822);var _0x5282dd=_0x5516a8['update'](_0x3eea1f,_0x1528('0x21'),_0x1528('0x22'));_0x5282dd+=_0x5516a8[_0x1528('0x19')](_0x1528('0x22'));return _0x5282dd;};exports[_0x1528('0x23')]=function(_0x425dd0,_0x41b490,_0x50ea0a){var _0x4a0a5e=_0x50ea0a||stringOptions[_0x1528('0x9')];var _0x12ad24=_0x41b490||stringOptions[_0x1528('0x20')];var _0xd09ff8=crypto[_0x1528('0x1e')](_0x4a0a5e,_0x12ad24);var _0x26836a=_0xd09ff8['update'](_0x425dd0,_0x1528('0x22'),_0x1528('0x21'));_0x26836a+=_0xd09ff8[_0x1528('0x19')]('utf8');return _0x26836a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6636d75..8cadf44 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 _0x4119=['../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','format','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','split','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','to-csv','rimraf','../../mysqldb'];(function(_0x27b54d,_0x5a6a4a){var _0x25f177=function(_0xd7210){while(--_0xd7210){_0x27b54d['push'](_0x27b54d['shift']());}};_0x25f177(++_0x5a6a4a);}(_0x4119,0x1a2));var _0x9411=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4119[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x9411('0x0'));var path=require(_0x9411('0x1'));var _=require('lodash');var csv=require(_0x9411('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9411('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x9411('0x4'))['dbH'];var logger=require(_0x9411('0x5'))(_0x9411('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x9411('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9411('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b9743,_0x894842){var _0x2ec31f={'status':_0x2b9743};var _0x3c7bf3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x894842){_0x2ec31f[_0x9411('0x8')]=_0x894842;}return db['AnalyticExtractedReport'][_0x9411('0x9')](_0x2ec31f,_0x3c7bf3);}function main(){var _0x13f5b5=0x1388;var _0x480ecf;logger[_0x9411('0xa')](util['format'](_0x9411('0xb'),EXTRACTED_REPORT_ID,_0x9411('0xc')));return db[_0x9411('0xd')][_0x9411('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9411('0xf')]})['then'](function(_0xf092a7){if(_0xf092a7){_0x480ecf=_0xf092a7;_0x13f5b5=_0x480ecf[_0x9411('0xf')]||0x1388;}})[_0x9411('0x10')](function(){return dbH[_0x9411('0x11')][_0x9411('0x12')](util[_0x9411('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9411('0x11')][_0x9411('0x14')][_0x9411('0x15')]});})[_0x9411('0x10')](function(_0x5e6d34){if(!_0x5e6d34[0x0][_0x9411('0x16')]){return analyticExtractedReport(_0x9411('0x17'));}var _0x1acc24=[];var _0x45361f=0x0;if(_0x480ecf['split']){if(_0x5e6d34&&_0x5e6d34[_0x9411('0x18')]){var _0x5ced90=_[_0x9411('0x19')](_0x5e6d34[0x0]['num']/_0x13f5b5);var _0x49925b=Number['isInteger'](_0x5e6d34[0x0][_0x9411('0x16')]/_0x13f5b5)?_0x5e6d34[0x0]['num']%_0x13f5b5:0x0;_0x5ced90[_0x9411('0x1a')](function(_0x4da784){if(_0x4da784>0x0){_0x45361f+=_0x13f5b5;}_0x1acc24[_0x9411('0x1b')](dbH[_0x9411('0x11')][_0x9411('0x12')](util[_0x9411('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x13f5b5,_0x45361f),{'type':dbH[_0x9411('0x11')][_0x9411('0x14')][_0x9411('0x15')]}));});if(_0x49925b>0x0){_0x45361f+=_0x13f5b5;_0x1acc24[_0x9411('0x1b')](dbH[_0x9411('0x11')][_0x9411('0x12')](util[_0x9411('0x13')](_0x9411('0x1c'),QUERY,_0x49925b,_0x45361f),{'type':dbH[_0x9411('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x1acc24['push'](dbH[_0x9411('0x11')]['query'](QUERY,{'type':dbH[_0x9411('0x11')]['QueryTypes'][_0x9411('0x15')]}));}var _0x5d2305=path[_0x9411('0x1d')](PATH);var _0x97d51e=path[_0x9411('0x1e')](PATH,'.csv');var _0x31d703=_0x480ecf[_0x9411('0x1f')]&&_0x1acc24[_0x9411('0x18')]>0x1;var _0x5760f9=[];if(!fs[_0x9411('0x20')](path[_0x9411('0x21')](_0x5d2305,_0x97d51e))&&_0x31d703){fs[_0x9411('0x22')](path['join'](_0x5d2305,_0x97d51e));}return BPromise['each'](_0x1acc24,function(_0x288413){_0x5760f9['push'](_0x288413);})['then'](function(){for(var _0x529093=0x0;_0x529093<_0x5760f9[_0x9411('0x18')];_0x529093+=0x1){var _0x5f5b24;var _0x37227c=_0x5760f9[_0x529093];if(_0x31d703){_0x5f5b24=path[_0x9411('0x21')](_0x5d2305,_0x97d51e,util['format'](_0x9411('0x23'),_0x97d51e,_0x529093,_0x9411('0x24')));}else{_0x5f5b24=path['join'](_0x5d2305,util[_0x9411('0x13')](_0x9411('0x25'),_0x97d51e,'csv'));}fs[_0x9411('0x26')](_0x5f5b24,csv(_0x37227c));}})['then'](function(){if(_0x31d703){return new Promise(function(_0x399f2d){zipdir(path[_0x9411('0x21')](_0x5d2305,_0x97d51e),{'saveTo':path[_0x9411('0x21')](_0x5d2305,util[_0x9411('0x13')]('%s.%s',_0x97d51e,'zip'))},function(_0x12f0d8,_0x5bcf53){rimraf(path[_0x9411('0x21')](_0x5d2305,_0x97d51e),function(){});_0x399f2d(_0x9411('0x27'));});});}})['then'](function(){logger[_0x9411('0xa')](util['format'](_0x9411('0x28'),EXTRACTED_REPORT_ID,_0x9411('0xc')));return analyticExtractedReport(_0x9411('0x29'),_0x31d703?util['format'](_0x9411('0x25'),_0x97d51e,_0x31d703?_0x9411('0x2a'):'csv'):null);});})['catch'](function(_0x25e810){logger['info'](util[_0x9411('0x13')](_0x9411('0x2b'),EXTRACTED_REPORT_ID,_0x9411('0xc')),util['inspect'](_0x25e810,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9411('0x2c'));})[_0x9411('0x2d')](function(){process[_0x9411('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x59ac=['dirname','basename','.csv','length','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','csv','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','range','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0xd4627b,_0xff27fe){var _0x30e307=function(_0x4d3124){while(--_0x4d3124){_0xd4627b['push'](_0xd4627b['shift']());}};_0x30e307(++_0xff27fe);}(_0x59ac,0x156));var _0xc59a=function(_0x17100e,_0xa58af4){_0x17100e=_0x17100e-0x0;var _0x541fbd=_0x59ac[_0x17100e];return _0x541fbd;};'use strict';var util=require(_0xc59a('0x0'));var path=require(_0xc59a('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xc59a('0x2'));var zipdir=require(_0xc59a('0x3'));var rimraf=require(_0xc59a('0x4'));var db=require(_0xc59a('0x5'))['db'];var dbH=require(_0xc59a('0x5'))['dbH'];var logger=require('../../config/logger')(_0xc59a('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xc59a('0x7')][0x2]);var QUERY=process[_0xc59a('0x7')][0x3];var PATH=process[_0xc59a('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3136dd,_0x41bf56){var _0xb1f913={'status':_0x3136dd};var _0xffed30={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41bf56){_0xb1f913['savename']=_0x41bf56;}return db['AnalyticExtractedReport']['update'](_0xb1f913,_0xffed30);}function main(){var _0x1f9111=0x1388;var _0x54bf9a;logger[_0xc59a('0x8')](util['format'](_0xc59a('0x9'),EXTRACTED_REPORT_ID,_0xc59a('0xa')));return db[_0xc59a('0xb')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc59a('0xc'),_0xc59a('0xd')]})['then'](function(_0x401132){if(_0x401132){_0x54bf9a=_0x401132;_0x1f9111=_0x54bf9a['splitSizeCsv']||0x1388;}})[_0xc59a('0xe')](function(){return dbH[_0xc59a('0xf')][_0xc59a('0x10')](util[_0xc59a('0x11')](_0xc59a('0x12'),QUERY),{'type':dbH[_0xc59a('0xf')][_0xc59a('0x13')]['SELECT']});})[_0xc59a('0xe')](function(_0x2d7057){if(!_0x2d7057[0x0][_0xc59a('0x14')]){return analyticExtractedReport(_0xc59a('0x15'));}var _0x593fe8=[];var _0x410ae7=0x0;if(_0x54bf9a['split']){if(_0x2d7057&&_0x2d7057['length']){var _0x556bc9=_[_0xc59a('0x16')](_0x2d7057[0x0][_0xc59a('0x14')]/_0x1f9111);var _0xcf177c=Number['isInteger'](_0x2d7057[0x0]['num']/_0x1f9111)?_0x2d7057[0x0]['num']%_0x1f9111:0x0;_0x556bc9['forEach'](function(_0x5a5aa8){if(_0x5a5aa8>0x0){_0x410ae7+=_0x1f9111;}_0x593fe8[_0xc59a('0x17')](dbH[_0xc59a('0xf')][_0xc59a('0x10')](util[_0xc59a('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1f9111,_0x410ae7),{'type':dbH[_0xc59a('0xf')]['QueryTypes'][_0xc59a('0x18')]}));});if(_0xcf177c>0x0){_0x410ae7+=_0x1f9111;_0x593fe8[_0xc59a('0x17')](dbH[_0xc59a('0xf')][_0xc59a('0x10')](util[_0xc59a('0x11')](_0xc59a('0x19'),QUERY,_0xcf177c,_0x410ae7),{'type':dbH['sequelize'][_0xc59a('0x13')][_0xc59a('0x18')]}));}}}else{_0x593fe8[_0xc59a('0x17')](dbH[_0xc59a('0xf')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x292ebf=path[_0xc59a('0x1a')](PATH);var _0x50f4a5=path[_0xc59a('0x1b')](PATH,_0xc59a('0x1c'));var _0x1692c1=_0x54bf9a[_0xc59a('0xc')]&&_0x593fe8[_0xc59a('0x1d')]>0x1;var _0x1f94dc=[];if(!fs[_0xc59a('0x1e')](path['join'](_0x292ebf,_0x50f4a5))&&_0x1692c1){fs[_0xc59a('0x1f')](path[_0xc59a('0x20')](_0x292ebf,_0x50f4a5));}return BPromise[_0xc59a('0x21')](_0x593fe8,function(_0x5aadce){_0x1f94dc[_0xc59a('0x17')](_0x5aadce);})[_0xc59a('0xe')](function(){for(var _0x468da2=0x0;_0x468da2<_0x1f94dc[_0xc59a('0x1d')];_0x468da2+=0x1){var _0x981b32;var _0x287c3d=_0x1f94dc[_0x468da2];if(_0x1692c1){_0x981b32=path[_0xc59a('0x20')](_0x292ebf,_0x50f4a5,util['format'](_0xc59a('0x22'),_0x50f4a5,_0x468da2,'csv'));}else{_0x981b32=path[_0xc59a('0x20')](_0x292ebf,util[_0xc59a('0x11')](_0xc59a('0x23'),_0x50f4a5,_0xc59a('0x24')));}fs['writeFileSync'](_0x981b32,csv(_0x287c3d));}})[_0xc59a('0xe')](function(){if(_0x1692c1){return new Promise(function(_0x3db5e6){zipdir(path[_0xc59a('0x20')](_0x292ebf,_0x50f4a5),{'saveTo':path[_0xc59a('0x20')](_0x292ebf,util['format'](_0xc59a('0x23'),_0x50f4a5,_0xc59a('0x25')))},function(_0xa2fe20,_0x5dc1ae){rimraf(path['join'](_0x292ebf,_0x50f4a5),function(){});_0x3db5e6(_0xc59a('0x26'));});});}})[_0xc59a('0xe')](function(){logger[_0xc59a('0x8')](util[_0xc59a('0x11')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc59a('0xa')));return analyticExtractedReport(_0xc59a('0x27'),_0x1692c1?util['format'](_0xc59a('0x23'),_0x50f4a5,_0x1692c1?_0xc59a('0x25'):_0xc59a('0x24')):null);});})[_0xc59a('0x28')](function(_0x279db4){logger[_0xc59a('0x8')](util[_0xc59a('0x11')](_0xc59a('0x29'),EXTRACTED_REPORT_ID,_0xc59a('0xa')),util[_0xc59a('0x2a')](_0x279db4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc59a('0x2b'));})[_0xc59a('0x2c')](function(){process[_0xc59a('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9eda343..fb098cb 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 _0x166a=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','then','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','jsdom','JSDOM','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','before','landscape','\x20/\x20','Arial','black','right','Setting','split','splitSizePdf','range','num','isInteger','sequelize','query'];(function(_0xd9bfc0,_0x323b5e){var _0x3c26ca=function(_0x41668e){while(--_0x41668e){_0xd9bfc0['push'](_0xd9bfc0['shift']());}};_0x3c26ca(++_0x323b5e);}(_0x166a,0x136));var _0xa166=function(_0x312dd5,_0xa36281){_0x312dd5=_0x312dd5-0x0;var _0x1a3ff0=_0x166a[_0x312dd5];return _0x1a3ff0;};'use strict';var _=require(_0xa166('0x0'));var fs=require('fs');var util=require(_0xa166('0x1'));var path=require(_0xa166('0x2'));var moment=require(_0xa166('0x3'));var htmlToPdfmake=require(_0xa166('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xa166('0x5'))[_0xa166('0x6')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0xa166('0x7'))[_0xa166('0x8')];var logger=require(_0xa166('0x9'))(_0xa166('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xa166('0xb')][0x2]);var QUERY=process[_0xa166('0xb')][0x3];var PATH=process[_0xa166('0xb')][0x4];var NAME=process[_0xa166('0xb')][0x5];var FORMAT=_0xa166('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x11357b,_0x4eaf72){var _0x24a414={'status':_0x11357b};var _0xaf2e43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4eaf72){_0x24a414['savename']=_0x4eaf72;}return db[_0xa166('0xd')][_0xa166('0xe')](_0x24a414,_0xaf2e43);}function getHeaders(_0x1b64f8){return _[_0xa166('0xf')](_0x1b64f8,function(_0x1c21ee){return{'text':_0x1c21ee,'style':_0xa166('0x10')};});}function getRows(_0x533395,_0x145c3b){return _[_0xa166('0xf')](_0x145c3b,function(_0x8221e0){return _(_0x8221e0)[_0xa166('0x11')](_0x533395)['map'](function(_0x398bc6){return _0x398bc6?_['toString'](_0x398bc6):'';})[_0xa166('0x12')]();});}function createTable(_0x2edb02,_0x1eee21){var _0x5527e2={'widths':_['fill'](Array(_0x2edb02[_0xa166('0x13')]),0x91),'heights':function(_0x31d86a){return _0x31d86a===0x0?_0xa166('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x103312=getHeaders(_0x2edb02);_0x5527e2[_0xa166('0x15')]['push'](_0x103312);var _0x2ae4f9=getRows(_0x2edb02,_0x1eee21);_0x5527e2['body']=_0x5527e2['body'][_0xa166('0x16')](_0x2ae4f9);return _0x5527e2;}function createTables(_0x271116){var _0x2b9bff=[];var _0x4c3240=_[_0xa166('0x17')](Object[_0xa166('0x18')](_0x271116[0x0]),0x5);_0x4c3240[_0xa166('0x19')](function(_0x1d390e){_0x2b9bff[_0xa166('0x1a')](createTable(_0x1d390e,_0x271116));});return _0x2b9bff;}function getPDFDocDefinition(_0x1fb38e){var _0x3569a0=util[_0xa166('0x1b')](_0xa166('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xa166('0x1d')])[_0xa166('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x127b69=[];for(var _0x23d7ad=0x0;_0x23d7ad<_0x1fb38e[_0xa166('0x13')];_0x23d7ad++){var _0x43f168=[];if(_0x23d7ad===0x0){_0x43f168['push']({'text':_0x3569a0,'style':_0xa166('0x1e')});}var _0x2ac7f7={'table':_0x1fb38e[_0x23d7ad]};if(_0x23d7ad>0x0){_0x2ac7f7[_0xa166('0x1f')]=_0xa166('0x20');_0x2ac7f7['margin']=[0x0,0x46,0x0,0x0];}_0x43f168[_0xa166('0x1a')](_0x2ac7f7);_0x127b69['push'](_0x43f168);}return{'pageSize':'A4','pageOrientation':_0xa166('0x21'),'content':_0x127b69,'footer':function(_0x8d7dd2,_0x1d7acd){return{'text':_0x8d7dd2['toString']()+_0xa166('0x22')+_0x1d7acd,'style':'footer'};},'defaultStyle':{'font':_0xa166('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa166('0x24')},'footer':{'alignment':_0xa166('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1909ff){var _0x5b4abe=0x1388;var _0x26fdc8;if(!_0x1909ff[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xa166('0x26')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa166('0x27'),'splitSizePdf']})['then'](function(_0x355a88){if(_0x355a88){_0x26fdc8=_0x355a88;_0x5b4abe=_0x26fdc8[_0xa166('0x28')]||0x3e8;}})['then'](function(){var _0x1a29f7=[];var _0x19c5d7=0x0;if(_0x26fdc8[_0xa166('0x27')]){if(_0x1909ff&&_0x1909ff[_0xa166('0x13')]){var _0x579845=_[_0xa166('0x29')](_0x1909ff[0x0][_0xa166('0x2a')]/_0x5b4abe);var _0x2d28eb=Number[_0xa166('0x2b')](_0x1909ff[0x0][_0xa166('0x2a')]/_0x5b4abe)?_0x1909ff[0x0][_0xa166('0x2a')]%_0x5b4abe:0x0;_0x579845[_0xa166('0x19')](function(_0x2717a8){if(_0x2717a8>0x0){_0x19c5d7+=_0x5b4abe;}_0x1a29f7[_0xa166('0x1a')](dbH['sequelize']['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5b4abe,_0x19c5d7),{'type':dbH[_0xa166('0x2c')]['QueryTypes']['SELECT']}));});if(_0x2d28eb>0x0){_0x19c5d7+=_0x5b4abe;_0x1a29f7[_0xa166('0x1a')](dbH[_0xa166('0x2c')][_0xa166('0x2d')](util[_0xa166('0x1b')](_0xa166('0x2e'),QUERY,_0x2d28eb,_0x19c5d7),{'type':dbH[_0xa166('0x2c')][_0xa166('0x2f')][_0xa166('0x30')]}));}}}else{_0x1a29f7[_0xa166('0x1a')](dbH[_0xa166('0x2c')][_0xa166('0x2d')](QUERY,{'type':dbH[_0xa166('0x2c')][_0xa166('0x2f')][_0xa166('0x30')]}));}var _0x27e55a=path[_0xa166('0x31')](PATH);var _0x3701a1=path[_0xa166('0x32')](PATH,_0xa166('0x33'));var _0x1b8fe6=_0x26fdc8[_0xa166('0x27')]&&_0x1a29f7[_0xa166('0x13')]>0x1;var _0x6ee5a=[];if(!fs['existsSync'](path[_0xa166('0x34')](_0x27e55a,_0x3701a1))&&_0x1b8fe6){fs[_0xa166('0x35')](path['join'](_0x27e55a,_0x3701a1));}return BPromise[_0xa166('0x36')](_0x1a29f7,function(_0x4a3558){_0x6ee5a['push'](_0x4a3558);})['then'](function(){var _0x9fb842=[];for(var _0x1265df=0x0;_0x1265df<_0x6ee5a[_0xa166('0x13')];_0x1265df+=0x1){var _0x2c4e91=_0x6ee5a[_0x1265df];var _0x1b196b=createTables(_[_0xa166('0x37')](_0x2c4e91));var _0x5e0939;var _0x483099=getPDFDocDefinition(_0x1b196b);var _0x5e81a3=getPDFPrinter();var _0x5de508=_0x5e81a3[_0xa166('0x38')](_0x483099);if(_0x1b8fe6){_0x5e0939=path['join'](_0x27e55a,_0x3701a1,util[_0xa166('0x1b')]('%s%d.%s',_0x3701a1,_0x1265df,_0xa166('0x39')));}else{_0x5e0939=path[_0xa166('0x34')](_0x27e55a,util[_0xa166('0x1b')](_0xa166('0x3a'),_0x3701a1,_0xa166('0x39')));}_0x9fb842[_0xa166('0x1a')](writePDFDocument(_0x5de508,_0x5e0939));}return Promise[_0xa166('0x3b')](_0x9fb842);})[_0xa166('0x3c')](function(){if(_0x1b8fe6){return new Promise(function(_0x26794b){zipdir(path[_0xa166('0x34')](_0x27e55a,_0x3701a1),{'saveTo':path[_0xa166('0x34')](_0x27e55a,util[_0xa166('0x1b')]('%s.%s',_0x3701a1,_0xa166('0x3d')))},function(){rimraf(path['join'](_0x27e55a,_0x3701a1),function(){});_0x26794b(_0xa166('0x3e'));});});}})[_0xa166('0x3c')](function(){if(!_0x1b8fe6)return;rimraf(path['join'](_0x27e55a,_0x3701a1),function(){});})['then'](function(){logger[_0xa166('0x3f')](util[_0xa166('0x1b')](_0xa166('0x40'),EXTRACTED_REPORT_ID,_0xa166('0x41')));return analyticExtractedReport('Completed',_0x1b8fe6?util[_0xa166('0x1b')](_0xa166('0x3a'),_0x3701a1,_0x1b8fe6?_0xa166('0x3d'):_0xa166('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa166('0x3f')](util[_0xa166('0x1b')](_0xa166('0x42'),EXTRACTED_REPORT_ID,_0xa166('0x41')));return db[_0xa166('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa166('0x3c')](function(_0x4ff91c){EXTRACTED_REPORT=_0x4ff91c;return dbH[_0xa166('0x2c')][_0xa166('0x2d')](util[_0xa166('0x1b')](_0xa166('0x43'),QUERY),{'type':dbH[_0xa166('0x2c')]['QueryTypes'][_0xa166('0x30')]});})[_0xa166('0x3c')](extractReport)[_0xa166('0x44')](function(_0x153e98){logger[_0xa166('0x3f')](util['format'](_0xa166('0x45'),EXTRACTED_REPORT_ID,_0xa166('0x41')),util[_0xa166('0x46')](_0x153e98,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa166('0x47'));})[_0xa166('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1add7=new PdfPrinter({'Arial':{'normal':__dirname+_0xa166('0x49'),'bold':__dirname+_0xa166('0x4a'),'italics':__dirname+_0xa166('0x4b'),'bolditalics':__dirname+_0xa166('0x4c')}});return _0x1add7;}function getPDFDocDefinitionFromHTML(_0xc29971,_0xa8fd7e){var _0x1682d8=util['format']('%s\x20#%d',_0xa8fd7e[_0xa166('0x4d')],_0xa8fd7e[_0xa166('0x4e')]);var _0x574f3c=moment()[_0xa166('0x1b')](_0xa166('0x4f'))['toString']();var _0x2c7d7a=htmlToPdfmake(_0xc29971,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c7d7a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa166('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa166('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xa166('0x51'),'style':_0xa166('0x1e')}];},'footer':function(_0x2747ef,_0x509f7e){return[{'text':util[_0xa166('0x1b')](_0xa166('0x52'),_0x1682d8,_0x2747ef,_0x509f7e,_0x574f3c),'style':_0xa166('0x53')}];}};}function writePDFDocument(_0x4d61a4,_0x19c05b){return new Promise(function(_0x13826e,_0x462ec8){var _0x3b84c9=_0x4d61a4[_0xa166('0x54')](fs['createWriteStream'](_0x19c05b));_0x3b84c9['on'](_0xa166('0x55'),function(){_0x13826e(_0xa166('0x55'));});_0x3b84c9['on'](_0xa166('0x56'),function(_0x498969){_0x462ec8(_0x498969);});_0x4d61a4[_0xa166('0x57')]();});}exports[_0xa166('0x58')]=function(_0x11c398,_0x51c613){var _0x837bf7=getPDFPrinter();var _0x1811fd=getPDFDocDefinitionFromHTML(_0x11c398,_0x51c613);var _0x78d7ae=_0x837bf7[_0xa166('0x38')](_0x1811fd);return writePDFDocument(_0x78d7ae,_0x51c613[_0xa166('0x2')])['catch'](function(_0xe0e3ee){throw _0xe0e3ee;});}; \ No newline at end of file +var _0x6b0d=['landscape','toString','\x20/\x20','footer','black','right','num','Setting','find','split','splitSizePdf','then','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','mkdirSync','flatten','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','auto','body','push','concat','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin'];(function(_0x234ea9,_0x5e1f7d){var _0x471d20=function(_0x4d7c4c){while(--_0x4d7c4c){_0x234ea9['push'](_0x234ea9['shift']());}};_0x471d20(++_0x5e1f7d);}(_0x6b0d,0x150));var _0xd6b0=function(_0x3e257f,_0x3c0ae9){_0x3e257f=_0x3e257f-0x0;var _0x4a2fc4=_0x6b0d[_0x3e257f];return _0x4a2fc4;};'use strict';var _=require(_0xd6b0('0x0'));var fs=require('fs');var util=require(_0xd6b0('0x1'));var path=require(_0xd6b0('0x2'));var moment=require(_0xd6b0('0x3'));var htmlToPdfmake=require(_0xd6b0('0x4'));var PdfPrinter=require(_0xd6b0('0x5'));var zipdir=require(_0xd6b0('0x6'));var rimraf=require(_0xd6b0('0x7'));var JSDOM=require('jsdom')[_0xd6b0('0x8')];var window=new JSDOM('')[_0xd6b0('0x9')];var BPromise=require('bluebird');var db=require(_0xd6b0('0xa'))['db'];var dbH=require(_0xd6b0('0xa'))[_0xd6b0('0xb')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd6b0('0xc')][0x2]);var QUERY=process[_0xd6b0('0xc')][0x3];var PATH=process[_0xd6b0('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xd6b0('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1174cd,_0x107197){var _0x187627={'status':_0x1174cd};var _0x13473b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x107197){_0x187627[_0xd6b0('0xe')]=_0x107197;}return db[_0xd6b0('0xf')][_0xd6b0('0x10')](_0x187627,_0x13473b);}function getHeaders(_0x3a36cb){return _[_0xd6b0('0x11')](_0x3a36cb,function(_0x3bb31b){return{'text':_0x3bb31b,'style':_0xd6b0('0x12')};});}function getRows(_0x397181,_0x56c9f4){return _[_0xd6b0('0x11')](_0x56c9f4,function(_0x2dd008){return _(_0x2dd008)[_0xd6b0('0x13')](_0x397181)[_0xd6b0('0x11')](function(_0x5785d7){return _0x5785d7?_['toString'](_0x5785d7):'';})[_0xd6b0('0x14')]();});}function createTable(_0x1a2b0d,_0x134687){var _0x4b9ed8={'widths':_[_0xd6b0('0x15')](Array(_0x1a2b0d[_0xd6b0('0x16')]),0x91),'heights':function(_0x166090){return _0x166090===0x0?_0xd6b0('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3ed0dc=getHeaders(_0x1a2b0d);_0x4b9ed8[_0xd6b0('0x18')][_0xd6b0('0x19')](_0x3ed0dc);var _0x533f3a=getRows(_0x1a2b0d,_0x134687);_0x4b9ed8[_0xd6b0('0x18')]=_0x4b9ed8[_0xd6b0('0x18')][_0xd6b0('0x1a')](_0x533f3a);return _0x4b9ed8;}function createTables(_0x2fa4e8){var _0x825945=[];var _0x2e72c8=_['chunk'](Object[_0xd6b0('0x1b')](_0x2fa4e8[0x0]),0x5);_0x2e72c8['forEach'](function(_0xf666d){_0x825945['push'](createTable(_0xf666d,_0x2fa4e8));});return _0x825945;}function getPDFDocDefinition(_0x3ab14c){var _0x333a1f=util[_0xd6b0('0x1c')](_0xd6b0('0x1d'),NAME,EXTRACTED_REPORT[_0xd6b0('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0xd6b0('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xd6b0('0x1f')])['format'](FORMAT));var _0x9fbf78=[];for(var _0x3bd0e5=0x0;_0x3bd0e5<_0x3ab14c['length'];_0x3bd0e5++){var _0x21bf8a=[];if(_0x3bd0e5===0x0){_0x21bf8a['push']({'text':_0x333a1f,'style':_0xd6b0('0x20')});}var _0xa8b253={'table':_0x3ab14c[_0x3bd0e5]};if(_0x3bd0e5>0x0){_0xa8b253[_0xd6b0('0x21')]=_0xd6b0('0x22');_0xa8b253[_0xd6b0('0x23')]=[0x0,0x46,0x0,0x0];}_0x21bf8a[_0xd6b0('0x19')](_0xa8b253);_0x9fbf78[_0xd6b0('0x19')](_0x21bf8a);}return{'pageSize':'A4','pageOrientation':_0xd6b0('0x24'),'content':_0x9fbf78,'footer':function(_0x55f98e,_0x27a573){return{'text':_0x55f98e[_0xd6b0('0x25')]()+_0xd6b0('0x26')+_0x27a573,'style':_0xd6b0('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd6b0('0x28')},'footer':{'alignment':_0xd6b0('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x241dc8){var _0x223837=0x1388;var _0x17a167;if(!_0x241dc8[0x0][_0xd6b0('0x2a')]){return analyticExtractedReport('Empty');}return db[_0xd6b0('0x2b')][_0xd6b0('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd6b0('0x2d'),_0xd6b0('0x2e')]})[_0xd6b0('0x2f')](function(_0x87eb80){if(_0x87eb80){_0x17a167=_0x87eb80;_0x223837=_0x17a167[_0xd6b0('0x2e')]||0x3e8;}})['then'](function(){var _0x1de0c0=[];var _0x5d8b4a=0x0;if(_0x17a167[_0xd6b0('0x2d')]){if(_0x241dc8&&_0x241dc8['length']){var _0x5880c5=_[_0xd6b0('0x30')](_0x241dc8[0x0][_0xd6b0('0x2a')]/_0x223837);var _0x4e8127=Number[_0xd6b0('0x31')](_0x241dc8[0x0]['num']/_0x223837)?_0x241dc8[0x0][_0xd6b0('0x2a')]%_0x223837:0x0;_0x5880c5[_0xd6b0('0x32')](function(_0x24ac35){if(_0x24ac35>0x0){_0x5d8b4a+=_0x223837;}_0x1de0c0[_0xd6b0('0x19')](dbH['sequelize'][_0xd6b0('0x33')](util['format'](_0xd6b0('0x34'),QUERY,_0x223837,_0x5d8b4a),{'type':dbH[_0xd6b0('0x35')][_0xd6b0('0x36')][_0xd6b0('0x37')]}));});if(_0x4e8127>0x0){_0x5d8b4a+=_0x223837;_0x1de0c0[_0xd6b0('0x19')](dbH[_0xd6b0('0x35')][_0xd6b0('0x33')](util[_0xd6b0('0x1c')](_0xd6b0('0x34'),QUERY,_0x4e8127,_0x5d8b4a),{'type':dbH[_0xd6b0('0x35')][_0xd6b0('0x36')][_0xd6b0('0x37')]}));}}}else{_0x1de0c0[_0xd6b0('0x19')](dbH[_0xd6b0('0x35')][_0xd6b0('0x33')](QUERY,{'type':dbH[_0xd6b0('0x35')][_0xd6b0('0x36')]['SELECT']}));}var _0x2d4d5c=path[_0xd6b0('0x38')](PATH);var _0x27fc71=path[_0xd6b0('0x39')](PATH,_0xd6b0('0x3a'));var _0x2bad56=_0x17a167['split']&&_0x1de0c0[_0xd6b0('0x16')]>0x1;var _0x222dbc=[];if(!fs['existsSync'](path['join'](_0x2d4d5c,_0x27fc71))&&_0x2bad56){fs[_0xd6b0('0x3b')](path['join'](_0x2d4d5c,_0x27fc71));}return BPromise['each'](_0x1de0c0,function(_0x18b3b3){_0x222dbc[_0xd6b0('0x19')](_0x18b3b3);})[_0xd6b0('0x2f')](function(){var _0x11295f=[];for(var _0x172de7=0x0;_0x172de7<_0x222dbc[_0xd6b0('0x16')];_0x172de7+=0x1){var _0x4903f7=_0x222dbc[_0x172de7];var _0x4dce0e=createTables(_[_0xd6b0('0x3c')](_0x4903f7));var _0x26bd1b;var _0x18510f=getPDFDocDefinition(_0x4dce0e);var _0x485dc7=getPDFPrinter();var _0x353023=_0x485dc7[_0xd6b0('0x3d')](_0x18510f);if(_0x2bad56){_0x26bd1b=path[_0xd6b0('0x3e')](_0x2d4d5c,_0x27fc71,util['format'](_0xd6b0('0x3f'),_0x27fc71,_0x172de7,_0xd6b0('0x40')));}else{_0x26bd1b=path[_0xd6b0('0x3e')](_0x2d4d5c,util[_0xd6b0('0x1c')](_0xd6b0('0x41'),_0x27fc71,_0xd6b0('0x40')));}_0x11295f[_0xd6b0('0x19')](writePDFDocument(_0x353023,_0x26bd1b));}return Promise['all'](_0x11295f);})[_0xd6b0('0x2f')](function(){if(_0x2bad56){return new Promise(function(_0xb2c8c7){zipdir(path[_0xd6b0('0x3e')](_0x2d4d5c,_0x27fc71),{'saveTo':path['join'](_0x2d4d5c,util[_0xd6b0('0x1c')](_0xd6b0('0x41'),_0x27fc71,_0xd6b0('0x42')))},function(){rimraf(path[_0xd6b0('0x3e')](_0x2d4d5c,_0x27fc71),function(){});_0xb2c8c7(_0xd6b0('0x43'));});});}})[_0xd6b0('0x2f')](function(){if(!_0x2bad56)return;rimraf(path['join'](_0x2d4d5c,_0x27fc71),function(){});})[_0xd6b0('0x2f')](function(){logger['info'](util['format'](_0xd6b0('0x44'),EXTRACTED_REPORT_ID,_0xd6b0('0x45')));return analyticExtractedReport('Completed',_0x2bad56?util[_0xd6b0('0x1c')]('%s.%s',_0x27fc71,_0x2bad56?'zip':_0xd6b0('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd6b0('0x46')](util[_0xd6b0('0x1c')](_0xd6b0('0x47'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xd6b0('0xf')][_0xd6b0('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd6b0('0x2f')](function(_0x34af68){EXTRACTED_REPORT=_0x34af68;return dbH[_0xd6b0('0x35')][_0xd6b0('0x33')](util[_0xd6b0('0x1c')](_0xd6b0('0x49'),QUERY),{'type':dbH[_0xd6b0('0x35')][_0xd6b0('0x36')][_0xd6b0('0x37')]});})['then'](extractReport)[_0xd6b0('0x4a')](function(_0x3dbe1c){logger[_0xd6b0('0x46')](util['format'](_0xd6b0('0x4b'),EXTRACTED_REPORT_ID,_0xd6b0('0x45')),util[_0xd6b0('0x4c')](_0x3dbe1c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd6b0('0x4d')](function(){process[_0xd6b0('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2d2127=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xd6b0('0x4f'),'bolditalics':__dirname+_0xd6b0('0x50')}});return _0x2d2127;}function getPDFDocDefinitionFromHTML(_0x3b553f,_0x3c9e9d){var _0x235f71=util[_0xd6b0('0x1c')]('%s\x20#%d',_0x3c9e9d[_0xd6b0('0x51')],_0x3c9e9d[_0xd6b0('0x52')]);var _0x479a1=moment()[_0xd6b0('0x1c')](_0xd6b0('0x53'))[_0xd6b0('0x25')]();var _0x1a2d30=htmlToPdfmake(_0x3b553f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1a2d30],'defaultStyle':{'font':_0xd6b0('0x54')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd6b0('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd6b0('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd6b0('0x55')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x97e1e,_0x10fa52){return[{'text':util[_0xd6b0('0x1c')](_0xd6b0('0x56'),_0x235f71,_0x97e1e,_0x10fa52,_0x479a1),'style':'footer'}];}};}function writePDFDocument(_0x5dbfc2,_0x264e00){return new Promise(function(_0x5797c7,_0x384998){var _0x2e9423=_0x5dbfc2[_0xd6b0('0x57')](fs[_0xd6b0('0x58')](_0x264e00));_0x2e9423['on'](_0xd6b0('0x59'),function(){_0x5797c7('finish');});_0x2e9423['on'](_0xd6b0('0x5a'),function(_0x408adb){_0x384998(_0x408adb);});_0x5dbfc2[_0xd6b0('0x5b')]();});}exports[_0xd6b0('0x5c')]=function(_0x212a68,_0x2debbb){var _0x584b2c=getPDFPrinter();var _0x5b9a10=getPDFDocDefinitionFromHTML(_0x212a68,_0x2debbb);var _0x359e37=_0x584b2c[_0xd6b0('0x3d')](_0x5b9a10);return writePDFDocument(_0x359e37,_0x2debbb[_0xd6b0('0x2')])[_0xd6b0('0x4a')](function(_0x2b93a0){throw _0x2b93a0;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5a7bf5d..e879ba5 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 _0x2f77=['split','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','length','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty'];(function(_0x15f695,_0x2eca0e){var _0x955fd9=function(_0x4c2f7b){while(--_0x4c2f7b){_0x15f695['push'](_0x15f695['shift']());}};_0x955fd9(++_0x2eca0e);}(_0x2f77,0x1d2));var _0x72f7=function(_0x340214,_0x117887){_0x340214=_0x340214-0x0;var _0x5269ea=_0x2f77[_0x340214];return _0x5269ea;};'use strict';var util=require(_0x72f7('0x0'));var path=require(_0x72f7('0x1'));var _=require(_0x72f7('0x2'));var fs=require('fs');var json2xls=require(_0x72f7('0x3'));var BPromise=require(_0x72f7('0x4'));var zipdir=require(_0x72f7('0x5'));var rimraf=require('rimraf');var db=require(_0x72f7('0x6'))['db'];var dbH=require(_0x72f7('0x6'))[_0x72f7('0x7')];var logger=require(_0x72f7('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x72f7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x134993,_0x55f681){var _0x37495f={'status':_0x134993};var _0x5aa1ec={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x55f681){_0x37495f[_0x72f7('0xa')]=_0x55f681;}return db['AnalyticExtractedReport'][_0x72f7('0xb')](_0x37495f,_0x5aa1ec);}function main(){var _0xcf7303=0x1388;var _0x5cbcb8;logger[_0x72f7('0xc')](util['format'](_0x72f7('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x72f7('0xe')][_0x72f7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x72f7('0x10')]})['then'](function(_0x4f1d56){if(_0x4f1d56){_0x5cbcb8=_0x4f1d56;_0xcf7303=_0x5cbcb8[_0x72f7('0x10')]||0x1388;}})[_0x72f7('0x11')](function(){return dbH[_0x72f7('0x12')][_0x72f7('0x13')](util[_0x72f7('0x14')](_0x72f7('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x72f7('0x16')]});})[_0x72f7('0x11')](function(_0x5c1a87){if(!_0x5c1a87[0x0]['num']){return analyticExtractedReport(_0x72f7('0x17'));}var _0x1ac3b8=[];var _0x431ab6=0x0;if(_0x5cbcb8[_0x72f7('0x18')]){if(_0x5c1a87&&_0x5c1a87['length']){var _0x111187=_[_0x72f7('0x19')](_0x5c1a87[0x0][_0x72f7('0x1a')]/_0xcf7303);var _0x10fce6=Number['isInteger'](_0x5c1a87[0x0][_0x72f7('0x1a')]/_0xcf7303)?_0x5c1a87[0x0]['num']%_0xcf7303:0x0;_0x111187[_0x72f7('0x1b')](function(_0x32b420){if(_0x32b420>0x0){_0x431ab6+=_0xcf7303;}_0x1ac3b8[_0x72f7('0x1c')](dbH['sequelize'][_0x72f7('0x13')](util[_0x72f7('0x14')](_0x72f7('0x1d'),QUERY,_0xcf7303,_0x431ab6),{'type':dbH[_0x72f7('0x12')][_0x72f7('0x1e')]['SELECT']}));});if(_0x10fce6>0x0){_0x431ab6+=_0xcf7303;_0x1ac3b8[_0x72f7('0x1c')](dbH[_0x72f7('0x12')][_0x72f7('0x13')](util[_0x72f7('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x10fce6,_0x431ab6),{'type':dbH[_0x72f7('0x12')][_0x72f7('0x1e')][_0x72f7('0x16')]}));}}}else{_0x1ac3b8[_0x72f7('0x1c')](dbH[_0x72f7('0x12')][_0x72f7('0x13')](QUERY,{'type':dbH[_0x72f7('0x12')][_0x72f7('0x1e')][_0x72f7('0x16')]}));}var _0x93217b=path['dirname'](PATH);var _0x1a6691=path[_0x72f7('0x1f')](PATH,'.xlsx');var _0x433e79=_0x5cbcb8[_0x72f7('0x18')]&&_0x1ac3b8[_0x72f7('0x20')]>0x1;var _0x22fe03=[];if(!fs[_0x72f7('0x21')](path[_0x72f7('0x22')](_0x93217b,_0x1a6691))&&_0x433e79){fs[_0x72f7('0x23')](path[_0x72f7('0x22')](_0x93217b,_0x1a6691));}return BPromise['each'](_0x1ac3b8,function(_0xe9ce9a){_0x22fe03[_0x72f7('0x1c')](_0xe9ce9a);})[_0x72f7('0x11')](function(){for(var _0x5583f8=0x0;_0x5583f8<_0x22fe03['length'];_0x5583f8+=0x1){var _0x4066ed;var _0x2d703e=_0x22fe03[_0x5583f8];if(_0x433e79){_0x4066ed=path[_0x72f7('0x22')](_0x93217b,_0x1a6691,util[_0x72f7('0x14')](_0x72f7('0x24'),_0x1a6691,_0x5583f8,'xlsx'));}else{_0x4066ed=path[_0x72f7('0x22')](_0x93217b,util[_0x72f7('0x14')](_0x72f7('0x25'),_0x1a6691,_0x72f7('0x26')));}fs['writeFileSync'](_0x4066ed,json2xls(_0x2d703e),'binary');}})[_0x72f7('0x11')](function(){if(_0x433e79){return new Promise(function(_0x45d0da){zipdir(path[_0x72f7('0x22')](_0x93217b,_0x1a6691),{'saveTo':path[_0x72f7('0x22')](_0x93217b,util[_0x72f7('0x14')](_0x72f7('0x25'),_0x1a6691,'zip'))},function(_0x141191,_0x5d5b70){rimraf(path[_0x72f7('0x22')](_0x93217b,_0x1a6691),function(){});_0x45d0da(_0x72f7('0x27'));});});}})[_0x72f7('0x11')](function(){logger[_0x72f7('0xc')](util[_0x72f7('0x14')](_0x72f7('0x28'),EXTRACTED_REPORT_ID,_0x72f7('0x29')));return analyticExtractedReport(_0x72f7('0x2a'),_0x433e79?util['format'](_0x72f7('0x25'),_0x1a6691,_0x433e79?_0x72f7('0x2b'):_0x72f7('0x26')):null);});})[_0x72f7('0x2c')](function(_0x2daea7){logger[_0x72f7('0xc')](util[_0x72f7('0x14')](_0x72f7('0x2d'),EXTRACTED_REPORT_ID,_0x72f7('0x29')),util[_0x72f7('0x2e')](_0x2daea7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x72f7('0x2f'));})['finally'](function(){process[_0x72f7('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0924=['dirname','.xlsx','split','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','isInteger','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x0924,0x77));var _0x4092=function(_0x525864,_0x1bb3ea){_0x525864=_0x525864-0x0;var _0x4f9964=_0x0924[_0x525864];return _0x4f9964;};'use strict';var util=require('util');var path=require(_0x4092('0x0'));var _=require(_0x4092('0x1'));var fs=require('fs');var json2xls=require(_0x4092('0x2'));var BPromise=require(_0x4092('0x3'));var zipdir=require(_0x4092('0x4'));var rimraf=require(_0x4092('0x5'));var db=require(_0x4092('0x6'))['db'];var dbH=require('../../mysqldb')[_0x4092('0x7')];var logger=require(_0x4092('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4092('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4092('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x238a93,_0x524f38){var _0x5f10ea={'status':_0x238a93};var _0x5f3135={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x524f38){_0x5f10ea[_0x4092('0xa')]=_0x524f38;}return db['AnalyticExtractedReport'][_0x4092('0xb')](_0x5f10ea,_0x5f3135);}function main(){var _0x5b37ff=0x1388;var _0xeecaff;logger['info'](util[_0x4092('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4092('0xd')));return db[_0x4092('0xe')][_0x4092('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4092('0x10')]})[_0x4092('0x11')](function(_0x2c10f1){if(_0x2c10f1){_0xeecaff=_0x2c10f1;_0x5b37ff=_0xeecaff['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x4092('0x12')][_0x4092('0x13')](util[_0x4092('0xc')](_0x4092('0x14'),QUERY),{'type':dbH['sequelize'][_0x4092('0x15')]['SELECT']});})[_0x4092('0x11')](function(_0x5dd2f2){if(!_0x5dd2f2[0x0]['num']){return analyticExtractedReport(_0x4092('0x16'));}var _0x567364=[];var _0xe2057e=0x0;if(_0xeecaff['split']){if(_0x5dd2f2&&_0x5dd2f2[_0x4092('0x17')]){var _0x3b081d=_[_0x4092('0x18')](_0x5dd2f2[0x0][_0x4092('0x19')]/_0x5b37ff);var _0x49d3ee=Number[_0x4092('0x1a')](_0x5dd2f2[0x0][_0x4092('0x19')]/_0x5b37ff)?_0x5dd2f2[0x0][_0x4092('0x19')]%_0x5b37ff:0x0;_0x3b081d[_0x4092('0x1b')](function(_0x177aec){if(_0x177aec>0x0){_0xe2057e+=_0x5b37ff;}_0x567364[_0x4092('0x1c')](dbH[_0x4092('0x12')][_0x4092('0x13')](util[_0x4092('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5b37ff,_0xe2057e),{'type':dbH[_0x4092('0x12')][_0x4092('0x15')][_0x4092('0x1d')]}));});if(_0x49d3ee>0x0){_0xe2057e+=_0x5b37ff;_0x567364['push'](dbH[_0x4092('0x12')][_0x4092('0x13')](util[_0x4092('0xc')](_0x4092('0x1e'),QUERY,_0x49d3ee,_0xe2057e),{'type':dbH['sequelize'][_0x4092('0x15')][_0x4092('0x1d')]}));}}}else{_0x567364[_0x4092('0x1c')](dbH[_0x4092('0x12')]['query'](QUERY,{'type':dbH[_0x4092('0x12')][_0x4092('0x15')]['SELECT']}));}var _0x16d272=path[_0x4092('0x1f')](PATH);var _0x58e62d=path['basename'](PATH,_0x4092('0x20'));var _0x34257d=_0xeecaff[_0x4092('0x21')]&&_0x567364['length']>0x1;var _0x4a149f=[];if(!fs[_0x4092('0x22')](path[_0x4092('0x23')](_0x16d272,_0x58e62d))&&_0x34257d){fs['mkdirSync'](path[_0x4092('0x23')](_0x16d272,_0x58e62d));}return BPromise[_0x4092('0x24')](_0x567364,function(_0x4b9028){_0x4a149f['push'](_0x4b9028);})[_0x4092('0x11')](function(){for(var _0x2845fe=0x0;_0x2845fe<_0x4a149f['length'];_0x2845fe+=0x1){var _0x28f708;var _0x127a47=_0x4a149f[_0x2845fe];if(_0x34257d){_0x28f708=path[_0x4092('0x23')](_0x16d272,_0x58e62d,util[_0x4092('0xc')]('%s%d.%s',_0x58e62d,_0x2845fe,_0x4092('0x25')));}else{_0x28f708=path[_0x4092('0x23')](_0x16d272,util[_0x4092('0xc')](_0x4092('0x26'),_0x58e62d,_0x4092('0x25')));}fs[_0x4092('0x27')](_0x28f708,json2xls(_0x127a47),_0x4092('0x28'));}})[_0x4092('0x11')](function(){if(_0x34257d){return new Promise(function(_0x44058a){zipdir(path[_0x4092('0x23')](_0x16d272,_0x58e62d),{'saveTo':path['join'](_0x16d272,util[_0x4092('0xc')](_0x4092('0x26'),_0x58e62d,_0x4092('0x29')))},function(_0xb35c07,_0x450a4b){rimraf(path[_0x4092('0x23')](_0x16d272,_0x58e62d),function(){});_0x44058a(_0x4092('0x2a'));});});}})[_0x4092('0x11')](function(){logger[_0x4092('0x2b')](util[_0x4092('0xc')](_0x4092('0x2c'),EXTRACTED_REPORT_ID,_0x4092('0xd')));return analyticExtractedReport(_0x4092('0x2d'),_0x34257d?util[_0x4092('0xc')](_0x4092('0x26'),_0x58e62d,_0x34257d?_0x4092('0x29'):'xlsx'):null);});})[_0x4092('0x2e')](function(_0x36b3c3){logger[_0x4092('0x2b')](util[_0x4092('0xc')](_0x4092('0x2f'),EXTRACTED_REPORT_ID,_0x4092('0xd')),util[_0x4092('0x30')](_0x36b3c3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4092('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3e575c2..8cb0dbf 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 _0xaa86=['CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${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-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','CDR(routeid)=','VoiceExtensionId','outbound'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaa86,0x1d6));var _0x6aa8=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xaa86[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x6aa8('0x0'));var util=require(_0x6aa8('0x1'));function rewrite(_0x310a7f,_0xa26f68){var _0x221f16=this;return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x3')]['findAll']({'raw':!![]})[_0x6aa8('0x4')](function(_0x1aeaa1){_0x221f16[_0x6aa8('0x5')]=_0x1aeaa1;return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x6')]['findAll']({'where':{'IntervalId':_0xa26f68[_0x6aa8('0x7')]},'raw':!![]});})[_0x6aa8('0x4')](function(_0x5667b2){return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x6aa8('0x8')](_0x5667b2,_0x6aa8('0x9')))}},'order':[{'raw':_0x6aa8('0xa')}],'raw':!![]});})['then'](function(_0x160c94){var _0x4c07b6=_[_0x6aa8('0xb')](_0x160c94,{'priority':'1'});var _0x967aea=_[_0x6aa8('0xb')](_0x160c94,{'isApp':0x1});var _0x1179b3=_[_0x6aa8('0xc')](_0x967aea,'exten');var _0x15f9ca=['queue',_0x6aa8('0xd')];var _0x55f8ff=[];var _0x117401=[];for(var _0xca1f1d in _0x1179b3){if(_0x1179b3[_0x6aa8('0xe')](_0xca1f1d)){_0x221f16[_0x6aa8('0xf')]=0x2;_0x221f16[_0x6aa8('0x10')]=[];_0x221f16[_0x6aa8('0x11')]=_[_0x6aa8('0x12')](_0x4c07b6,{'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')]});_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':util['format'](_0x6aa8('0x16'),_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')]),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0]['VoiceExtensionId']});if(_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')]==='inbound'){_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x18')+_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')],'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}else if(_0x1179b3[_0xca1f1d][0x0]['type']===_0x6aa8('0x1a')){if(_0x221f16[_0x6aa8('0x11')]){_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x1b')+(_0x221f16[_0x6aa8('0x11')][_0x6aa8('0x1c')]?_0x6aa8('0x1d')+_0x221f16[_0x6aa8('0x11')]['cutdigits']+'}':_0x6aa8('0x1e')),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0]['type'],'app':_0x6aa8('0x15'),'appdata':'CDR(routeid)='+_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')],'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});var _0x39b267=_0x221f16[_0x6aa8('0xf')]++;_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':'ExecIf','appdata':_0x6aa8('0x1f')+(_0x39b267+0x2)+_0x6aa8('0x20')+(_0x39b267+0x1)+')','context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x39b267,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});if(_0x221f16[_0x6aa8('0x11')]){_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x221f16['extension'][_0x6aa8('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x221f16[_0x6aa8('0x11')][_0x6aa8('0x1c')]+'}':_0x6aa8('0x21'),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16['priority']++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x22')+_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')],'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});if(_0x221f16[_0x6aa8('0x11')]&&_0x221f16[_0x6aa8('0x11')][_0x6aa8('0xe')](_0x6aa8('0x23'))&&_0x221f16[_0x6aa8('0x11')][_0x6aa8('0x23')]!=='none'){_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0]['type'],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x24'),'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x25')+_0x221f16[_0x6aa8('0x11')]['recordingFormat']||_0x6aa8('0x26'),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}}_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0]['type'],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x27'),'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});_0x221f16[_0x6aa8('0x10')][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':'Set','appdata':_0x6aa8('0x28'),'context':_0x1179b3[_0xca1f1d][0x0]['context'],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0]['VoiceExtensionId']});_0x221f16['extensions'][_0x6aa8('0x13')]({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':'Set','appdata':_0x6aa8('0x29'),'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'exten':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x9')],'priority':_0x221f16[_0x6aa8('0xf')]++,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});for(var _0x5f0440=0x0,_0x24d01a=0x0;_0x5f0440<_0x1179b3[_0xca1f1d][_0x6aa8('0x2a')];_0x5f0440+=0x1,_0x24d01a=0x0){var _0xec8527=_0x1179b3[_0xca1f1d][_0x5f0440];if(_0xec8527[_0x6aa8('0x14')]){_0xec8527[_0x6aa8('0x14')]=_0xec8527['type'][_0x6aa8('0x2b')]();}var _0x326641=[];var _0x320961=[];delete _0xec8527['id'];delete _0xec8527[_0x6aa8('0x2c')];delete _0xec8527[_0x6aa8('0x2d')];var _0x3ed9df=_0xec8527[_0x6aa8('0x2e')]!==_0x6aa8('0x2f')?[_0xec8527[_0x6aa8('0x2e')]]:_0xec8527['IntervalId']?_['map'](_[_0x6aa8('0xb')](_0x221f16[_0x6aa8('0x5')],{'IntervalId':_0xec8527[_0x6aa8('0x7')]}),'interval'):[];if(_0xec8527['hasOwnProperty'](_0x6aa8('0x30'))){if(_0xec8527[_0x6aa8('0x30')]&&_0xec8527[_0x6aa8('0x30')]!=='--'){_0x326641['push']({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':_0x6aa8('0x31')+_0xec8527[_0x6aa8('0x30')],'context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}}if(_0xec8527[_0x6aa8('0x14')]===_0x6aa8('0x1a')&&_0xec8527[_0x6aa8('0xe')]('callerID')){if(_0xec8527['callerID']){_0x326641['push']({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x32'),'appdata':_0x6aa8('0x33')+_0xec8527[_0x6aa8('0x34')]+')','context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16['priority']+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}else{_0x326641['push']({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x32'),'appdata':_0x6aa8('0x35'),'context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527['exten'],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}}if(_0xec8527['hasOwnProperty'](_0x6aa8('0x36'))){if(_0x15f9ca[_0x6aa8('0x37')](_0xec8527[_0x6aa8('0x38')][_0x6aa8('0x2b')]())>=0x0&&_0xec8527[_0x6aa8('0x39')]!==_0x6aa8('0x3a')){if(_0xec8527[_0x6aa8('0x36')]){_0x326641[_0x6aa8('0x13')]({'type':_0xec8527['type'],'app':_0x6aa8('0x32'),'appdata':_0x6aa8('0x3b'),'context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16['priority']+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});_0x326641[_0x6aa8('0x13')]({'type':_0xec8527['type'],'app':_0x6aa8('0x15'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});}else{_0x326641[_0x6aa8('0x13')]({'type':_0xec8527['type'],'app':'ExecIf','appdata':_0x6aa8('0x3c'),'context':_0xec8527['context'],'exten':_0xec8527['exten'],'priority':_0x3ed9df[_0x6aa8('0x2a')]+_0x221f16[_0x6aa8('0xf')]+_0x24d01a++,'VoiceExtensionId':_0xec8527[_0x6aa8('0x19')]});_0x326641[_0x6aa8('0x13')]({'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xec8527[_0x6aa8('0x17')],'exten':_0xec8527[_0x6aa8('0x9')],'priority':_0x3ed9df['length']+_0x221f16['priority']+_0x24d01a++,'VoiceExtensionId':_0xec8527['VoiceExtensionId']});}}}for(var _0x28ef3a=0x0;_0x28ef3a<_0x3ed9df['length'];_0x28ef3a+=0x1){var _0x4c4a6e=_0x221f16[_0x6aa8('0xf')]+_0x3ed9df[_0x6aa8('0x2a')];var _0x160638=_0x28ef3a===_0x3ed9df[_0x6aa8('0x2a')]-0x1?_0x221f16[_0x6aa8('0xf')]+_0x326641[_0x6aa8('0x2a')]+_0x320961[_0x6aa8('0x2a')]+0x2:_0x221f16[_0x6aa8('0xf')]+_0x28ef3a+0x1;_0x326641['splice'](_0x28ef3a,0x0,{'type':_0xec8527[_0x6aa8('0x14')],'app':_0x6aa8('0x3d'),'appdata':_0x3ed9df[_0x28ef3a]+'?'+_0xec8527['context']+_0x6aa8('0x3e')+_0x4c4a6e+':'+_0xec8527[_0x6aa8('0x17')]+_0x6aa8('0x3e')+_0x160638,'exten':_0xec8527[_0x6aa8('0x9')],'context':_0xec8527['context'],'priority':_0x221f16['priority']+_0x28ef3a,'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});}_0xec8527[_0x6aa8('0xf')]=_0x326641[_0x6aa8('0x2a')]?_['last'](_0x326641)[_0x6aa8('0xf')]+0x1:_0x221f16[_0x6aa8('0xf')];_0x221f16[_0x6aa8('0xf')]=(_0x320961['length']?_[_0x6aa8('0x3f')](_0x320961)[_0x6aa8('0xf')]:_0xec8527['priority'])+0x1;_0x221f16[_0x6aa8('0x10')]=_[_0x6aa8('0x40')](_0x221f16['extensions'],_0x326641,[_0xec8527],_0x320961);}_0x221f16[_0x6aa8('0x10')]['push']({'type':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x14')],'app':_0x6aa8('0x41'),'exten':_0x1179b3[_0xca1f1d][0x0]['exten'],'context':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x17')],'priority':_0x221f16[_0x6aa8('0xf')],'VoiceExtensionId':_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]});_0x55f8ff[_0x6aa8('0x13')](_0x1179b3[_0xca1f1d][0x0][_0x6aa8('0x19')]);_0x117401=_['concat'](_0x117401,_0x221f16[_0x6aa8('0x10')]);}}return _0x310a7f[_0x6aa8('0x42')](function(_0x189713){return _0x310a7f[_0x6aa8('0x2')][_0x6aa8('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x55f8ff}},'transaction':_0x189713})[_0x6aa8('0x4')](function(_0xc7bd15){return _0x310a7f['models']['VoiceExtension'][_0x6aa8('0x43')](_['sortBy'](_0x117401,_0x6aa8('0xf')),{'transaction':_0x189713});});});})[_0x6aa8('0x44')](function(_0x3f9d39){console[_0x6aa8('0x45')](_0x3f9d39);});}exports[_0x6aa8('0x46')]=rewrite; \ No newline at end of file +var _0x959e=['recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','length','createdAt','updatedAt','*,*,*,*','intervals','interval','tag','CDR(tag)=','callerID','ExecIf','$[${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','toLowerCase','appType','$[${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','destroy','VoiceExtension','bulkCreate','catch','rewrite','lodash','models','Interval','findAll','then','IntervalId','map','exten','filter','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','Set','format','CDR(type)=%s','context','VoiceExtensionId','type','inbound','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid='];(function(_0x3d3e03,_0x322473){var _0x2fb8a5=function(_0x4a0703){while(--_0x4a0703){_0x3d3e03['push'](_0x3d3e03['shift']());}};_0x2fb8a5(++_0x322473);}(_0x959e,0x17e));var _0xe959=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x959e[_0x16dbfd];return _0x382254;};'use strict';var _=require(_0xe959('0x0'));var util=require('util');function rewrite(_0x4f993a,_0x4b3523){var _0x321be7=this;return _0x4f993a[_0xe959('0x1')][_0xe959('0x2')][_0xe959('0x3')]({'raw':!![]})[_0xe959('0x4')](function(_0x15df96){_0x321be7['intervals']=_0x15df96;return _0x4f993a[_0xe959('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x4b3523[_0xe959('0x5')]},'raw':!![]});})[_0xe959('0x4')](function(_0x33b5ac){return _0x4f993a['models']['VoiceExtension'][_0xe959('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0xe959('0x6')](_0x33b5ac,_0xe959('0x7')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x28bb6a){var _0x28b75f=_[_0xe959('0x8')](_0x28bb6a,{'priority':'1'});var _0x2ec3c2=_[_0xe959('0x8')](_0x28bb6a,{'isApp':0x1});var _0x90a519=_['groupBy'](_0x2ec3c2,_0xe959('0x7'));var _0x3ea59d=[_0xe959('0x9'),_0xe959('0xa')];var _0x45118e=[];var _0x51a903=[];for(var _0xa1a4b1 in _0x90a519){if(_0x90a519[_0xe959('0xb')](_0xa1a4b1)){_0x321be7[_0xe959('0xc')]=0x2;_0x321be7['extensions']=[];_0x321be7[_0xe959('0xd')]=_[_0xe959('0xe')](_0x28b75f,{'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')]});_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0]['type'],'app':_0xe959('0x11'),'appdata':util[_0xe959('0x12')](_0xe959('0x13'),_0x90a519[_0xa1a4b1][0x0]['type']),'context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});if(_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')]===_0xe959('0x17')){_0x321be7['extensions'][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':_0xe959('0x18')+_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')],'context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0]['exten'],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});}else if(_0x90a519[_0xa1a4b1][0x0]['type']===_0xe959('0x19')){if(_0x321be7['extension']){_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0]['type'],'app':'Set','appdata':_0xe959('0x1a')+(_0x321be7[_0xe959('0xd')]['cutdigits']?_0xe959('0x1b')+_0x321be7[_0xe959('0xd')]['cutdigits']+'}':'${EXTEN}'),'context':_0x90a519[_0xa1a4b1][0x0]['context'],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']});}_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':'Set','appdata':_0xe959('0x18')+_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId'],'context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0]['exten'],'priority':_0x321be7['priority']++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});var _0x1798fc=_0x321be7[_0xe959('0xc')]++;_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':'ExecIf','appdata':_0xe959('0x1c')+(_0x1798fc+0x2)+'):Goto('+(_0x1798fc+0x1)+')','context':_0x90a519[_0xa1a4b1][0x0]['context'],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x1798fc,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']});if(_0x321be7['extension']){_0x321be7[_0xe959('0xf')]['push']({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':_0x321be7[_0xe959('0xd')][_0xe959('0x1d')]?_0xe959('0x1e')+_0x321be7[_0xe959('0xd')][_0xe959('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});}_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':_0xe959('0x1f')+_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')],'context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']});if(_0x321be7[_0xe959('0xd')]&&_0x321be7['extension'][_0xe959('0xb')](_0xe959('0x20'))&&_0x321be7[_0xe959('0xd')][_0xe959('0x20')]!==_0xe959('0x21')){_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':_0xe959('0x22'),'context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7['priority']++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});_0x321be7['extensions'][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x321be7[_0xe959('0xd')]['recordingFormat']||_0xe959('0x23'),'context':_0x90a519[_0xa1a4b1][0x0]['context'],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});}}_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});_0x321be7[_0xe959('0xf')][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7[_0xe959('0xc')]++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']});_0x321be7['extensions'][_0xe959('0x10')]({'type':_0x90a519[_0xa1a4b1][0x0]['type'],'app':_0xe959('0x11'),'appdata':'MONITOR_OPTIONS=ab','context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'priority':_0x321be7['priority']++,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x15')]});for(var _0x55334b=0x0,_0x3c123a=0x0;_0x55334b<_0x90a519[_0xa1a4b1][_0xe959('0x24')];_0x55334b+=0x1,_0x3c123a=0x0){var _0x567e44=_0x90a519[_0xa1a4b1][_0x55334b];if(_0x567e44['type']){_0x567e44['type']=_0x567e44['type']['toLowerCase']();}var _0x13250b=[];var _0x42c85d=[];delete _0x567e44['id'];delete _0x567e44[_0xe959('0x25')];delete _0x567e44[_0xe959('0x26')];var _0x51e78e=_0x567e44['interval']!==_0xe959('0x27')?[_0x567e44['interval']]:_0x567e44['IntervalId']?_[_0xe959('0x6')](_[_0xe959('0x8')](_0x321be7[_0xe959('0x28')],{'IntervalId':_0x567e44[_0xe959('0x5')]}),_0xe959('0x29')):[];if(_0x567e44[_0xe959('0xb')]('tag')){if(_0x567e44[_0xe959('0x2a')]&&_0x567e44[_0xe959('0x2a')]!=='--'){_0x13250b[_0xe959('0x10')]({'type':_0x567e44['type'],'app':_0xe959('0x11'),'appdata':_0xe959('0x2b')+_0x567e44[_0xe959('0x2a')],'context':_0x567e44['context'],'exten':_0x567e44[_0xe959('0x7')],'priority':_0x51e78e['length']+_0x321be7[_0xe959('0xc')]+_0x3c123a++,'VoiceExtensionId':_0x567e44[_0xe959('0x15')]});}}if(_0x567e44['type']===_0xe959('0x19')&&_0x567e44['hasOwnProperty'](_0xe959('0x2c'))){if(_0x567e44['callerID']){_0x13250b[_0xe959('0x10')]({'type':_0x567e44[_0xe959('0x16')],'app':_0xe959('0x2d'),'appdata':_0xe959('0x2e')+_0x567e44[_0xe959('0x2c')]+')','context':_0x567e44[_0xe959('0x14')],'exten':_0x567e44[_0xe959('0x7')],'priority':_0x51e78e[_0xe959('0x24')]+_0x321be7[_0xe959('0xc')]+_0x3c123a++,'VoiceExtensionId':_0x567e44[_0xe959('0x15')]});}else{_0x13250b[_0xe959('0x10')]({'type':_0x567e44[_0xe959('0x16')],'app':_0xe959('0x2d'),'appdata':_0xe959('0x2f'),'context':_0x567e44[_0xe959('0x14')],'exten':_0x567e44[_0xe959('0x7')],'priority':_0x51e78e[_0xe959('0x24')]+_0x321be7['priority']+_0x3c123a++,'VoiceExtensionId':_0x567e44[_0xe959('0x15')]});}}if(_0x567e44[_0xe959('0xb')](_0xe959('0x30'))){if(_0x3ea59d[_0xe959('0x31')](_0x567e44[_0xe959('0x32')][_0xe959('0x33')]())>=0x0&&_0x567e44[_0xe959('0x34')]!=='custom'){if(_0x567e44[_0xe959('0x30')]){_0x13250b[_0xe959('0x10')]({'type':_0x567e44['type'],'app':_0xe959('0x2d'),'appdata':_0xe959('0x35'),'context':_0x567e44[_0xe959('0x14')],'exten':_0x567e44[_0xe959('0x7')],'priority':_0x51e78e[_0xe959('0x24')]+_0x321be7[_0xe959('0xc')]+_0x3c123a++,'VoiceExtensionId':_0x567e44['VoiceExtensionId']});_0x13250b['push']({'type':_0x567e44[_0xe959('0x16')],'app':_0xe959('0x11'),'appdata':_0xe959('0x36'),'context':_0x567e44['context'],'exten':_0x567e44[_0xe959('0x7')],'priority':_0x51e78e['length']+_0x321be7['priority']+_0x3c123a++,'VoiceExtensionId':_0x567e44['VoiceExtensionId']});}else{_0x13250b[_0xe959('0x10')]({'type':_0x567e44[_0xe959('0x16')],'app':_0xe959('0x2d'),'appdata':_0xe959('0x37'),'context':_0x567e44[_0xe959('0x14')],'exten':_0x567e44['exten'],'priority':_0x51e78e[_0xe959('0x24')]+_0x321be7[_0xe959('0xc')]+_0x3c123a++,'VoiceExtensionId':_0x567e44[_0xe959('0x15')]});_0x13250b[_0xe959('0x10')]({'type':_0x567e44['type'],'app':_0xe959('0x11'),'appdata':_0xe959('0x38'),'context':_0x567e44[_0xe959('0x14')],'exten':_0x567e44[_0xe959('0x7')],'priority':_0x51e78e[_0xe959('0x24')]+_0x321be7[_0xe959('0xc')]+_0x3c123a++,'VoiceExtensionId':_0x567e44['VoiceExtensionId']});}}}for(var _0x3a9a44=0x0;_0x3a9a44<_0x51e78e['length'];_0x3a9a44+=0x1){var _0x599132=_0x321be7[_0xe959('0xc')]+_0x51e78e[_0xe959('0x24')];var _0x10aee0=_0x3a9a44===_0x51e78e['length']-0x1?_0x321be7[_0xe959('0xc')]+_0x13250b[_0xe959('0x24')]+_0x42c85d[_0xe959('0x24')]+0x2:_0x321be7['priority']+_0x3a9a44+0x1;_0x13250b[_0xe959('0x39')](_0x3a9a44,0x0,{'type':_0x567e44['type'],'app':_0xe959('0x3a'),'appdata':_0x51e78e[_0x3a9a44]+'?'+_0x567e44[_0xe959('0x14')]+_0xe959('0x3b')+_0x599132+':'+_0x567e44[_0xe959('0x14')]+_0xe959('0x3b')+_0x10aee0,'exten':_0x567e44['exten'],'context':_0x567e44[_0xe959('0x14')],'priority':_0x321be7[_0xe959('0xc')]+_0x3a9a44,'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']});}_0x567e44[_0xe959('0xc')]=_0x13250b[_0xe959('0x24')]?_[_0xe959('0x3c')](_0x13250b)[_0xe959('0xc')]+0x1:_0x321be7[_0xe959('0xc')];_0x321be7[_0xe959('0xc')]=(_0x42c85d[_0xe959('0x24')]?_[_0xe959('0x3c')](_0x42c85d)['priority']:_0x567e44[_0xe959('0xc')])+0x1;_0x321be7[_0xe959('0xf')]=_[_0xe959('0x3d')](_0x321be7[_0xe959('0xf')],_0x13250b,[_0x567e44],_0x42c85d);}_0x321be7[_0xe959('0xf')]['push']({'type':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x16')],'app':_0xe959('0x3e'),'exten':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x7')],'context':_0x90a519[_0xa1a4b1][0x0][_0xe959('0x14')],'priority':_0x321be7[_0xe959('0xc')],'VoiceExtensionId':_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']});_0x45118e[_0xe959('0x10')](_0x90a519[_0xa1a4b1][0x0]['VoiceExtensionId']);_0x51a903=_[_0xe959('0x3d')](_0x51a903,_0x321be7['extensions']);}}return _0x4f993a[_0xe959('0x3f')](function(_0x44901c){return _0x4f993a[_0xe959('0x1')]['VoiceExtension'][_0xe959('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x45118e}},'transaction':_0x44901c})[_0xe959('0x4')](function(_0x598658){return _0x4f993a[_0xe959('0x1')][_0xe959('0x41')][_0xe959('0x42')](_['sortBy'](_0x51a903,_0xe959('0xc')),{'transaction':_0x44901c});});});})[_0xe959('0x43')](function(_0x4761b4){console['error'](_0x4761b4);});}exports[_0xe959('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 60a3481..6509798 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 _0x3723=['ContactId','createdAt','updatedAt','select','field','scheduledAt','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','insert','into','fromQuery','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','always','sequelize','VoiceQueueId','query','all','BlackLists','CampaignId','onlyIfOpen','CmList','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','emit','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','cm_hopper'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x3723,0xa6));var _0x3372=function(_0x548a81,_0x37b227){_0x548a81=_0x548a81-0x0;var _0x34f8e9=_0x3723[_0x548a81];return _0x34f8e9;};'use strict';var BPromise=require(_0x3372('0x0'));var util=require(_0x3372('0x1'));var _=require(_0x3372('0x2'));var fs=require('fs');var squel=require(_0x3372('0x3'));var Papa=require(_0x3372('0x4'));var Redis=require(_0x3372('0x5'));var db=require(_0x3372('0x6'))['db'];var config=require(_0x3372('0x7'));var logger=require(_0x3372('0x8'))(_0x3372('0x9'));config[_0x3372('0xa')]=_[_0x3372('0xb')](config[_0x3372('0xa')],{'host':_0x3372('0xc'),'port':0x18eb});var socket=require(_0x3372('0xd'))(new Redis(config[_0x3372('0xa')]));require(_0x3372('0xe'))[_0x3372('0xf')](socket);try{if(!process[_0x3372('0x10')][0x2]||process[_0x3372('0x10')][0x2]===_0x3372('0x11')||process[_0x3372('0x10')][0x2]===_0x3372('0x12')){throw new Error(_0x3372('0x13'));}var FILEPATH=process[_0x3372('0x10')][0x2];if(!process['argv'][0x3]||process[_0x3372('0x10')][0x3]===_0x3372('0x11')||process[_0x3372('0x10')][0x3]===_0x3372('0x12')||!process['argv'][0x4]||process[_0x3372('0x10')][0x4]===_0x3372('0x11')||process[_0x3372('0x10')][0x4]===_0x3372('0x12')){throw new Error(_0x3372('0x14'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x3372('0x15')](','),process[_0x3372('0x10')][0x4][_0x3372('0x15')](','));if(!process[_0x3372('0x10')][0x5]||process[_0x3372('0x10')][0x5]===_0x3372('0x11')||process[_0x3372('0x10')][0x5]===_0x3372('0x12')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x3372('0x10')][0x5];var COMPANYID=process[_0x3372('0x10')][0x6]&&process[_0x3372('0x10')][0x6]!==_0x3372('0x11')&&process[_0x3372('0x10')][0x6]!==_0x3372('0x12')?process[_0x3372('0x10')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x3372('0x10')][0x7]!==_0x3372('0x11')&&process[_0x3372('0x10')][0x7]!==_0x3372('0x12')?process['argv'][0x7]:null;if(!process[_0x3372('0x10')][0x8]||process[_0x3372('0x10')][0x8]===_0x3372('0x11')||process[_0x3372('0x10')][0x8]===_0x3372('0x12')){throw new Error(_0x3372('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x1678fb){logger[_0x3372('0x17')](_0x1678fb);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(_0x5a1f8c,_0x1bfe93,_0x4eff19,_0x57a82a){var _0x265a8e={'message':_0x1bfe93};_0x265a8e[_0x5a1f8c]=!![];if(_0x4eff19){_0x265a8e[_0x3372('0x18')]=_0x4eff19;}if(_0x57a82a){_0x265a8e[_0x3372('0x19')]=_0x57a82a;}return _0x265a8e;}function isEmail(_0x75642e){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))*$/[_0x3372('0x1a')](_0x75642e);}function checkRow(_0x43daf6,_0xac4f44,_0x482f12){return new BPromise(function(_0x3a457d,_0x5d4856){if(_['isNil'](_0x43daf6)){return _0x5d4856(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x482f12));}if(_0x43daf6[_0x3372('0x1b')]&&_0x43daf6[_0x3372('0x1b')][_0x3372('0x1c')]){var _0x1c6170=_[_0x3372('0x1d')](_0x43daf6[_0x3372('0x1b')],_0x3372('0x1e'))[_0x3372('0x1f')](';');return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x1c6170,null,_0x482f12));}var _0x28c6b5={};for(var _0x97970b in FIELDS){if(FIELDS[_0x3372('0x20')](_0x97970b)&&FIELDS[_0x97970b]){_0x28c6b5[_0x97970b]=_0x43daf6[_0x3372('0x21')][0x0][FIELDS[_0x97970b]]||_0x43daf6['data'][0x0]['\ufeff'+FIELDS[_0x97970b]];}}if(!_0x28c6b5[_0x3372('0x22')]){return _0x5d4856(handleCheckRowError('error',_0x3372('0x23'),null,_0x482f12));}if(!_0x28c6b5[_0x3372('0x24')]){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x3372('0x25'),null,_0x482f12));}if(_0x28c6b5[_0x3372('0x26')]){var _0x18e6f7=moment(_0x28c6b5['birthDate'],_0x3372('0x27'));if(!_0x18e6f7[_0x3372('0x28')]()){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x3372('0x29'),null,_0x482f12));}}if(_0x28c6b5[_0x3372('0x2a')]){if(!isEmail(_0x28c6b5[_0x3372('0x2a')])){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x482f12));}}_0x28c6b5[_0x3372('0x2b')]=LISTID;_0x28c6b5[_0x3372('0x2c')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xac4f44){var _0x324f97={};for(var _0x3cb011=0x0,_0x2007dc=DUPLICATES['length'];_0x3cb011<_0x2007dc;_0x3cb011+=0x1){_0x324f97[DUPLICATES[_0x3cb011]]=_0x28c6b5[DUPLICATES[_0x3cb011]];}var _0x2d453e=_[_0x3372('0x2d')](_0xac4f44,_0x324f97);if(_0x2d453e){return _0x5d4856(handleCheckRowError(_0x3372('0x2e'),_0x3372('0x2f'),_0x2d453e,_0x482f12));}}return db[_0x3372('0x30')][_0x3372('0x31')](_0x28c6b5,{'raw':!![],'hooks':![],'fields':_['keys'](_0x28c6b5)})['then'](function(_0x51cec9){if(DUPLICATES&&DUPLICATES['length']&&_0xac4f44){_0xac4f44[_0x3372('0x32')](_[_0x3372('0x33')](_0x28c6b5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x51cec9['id'];return _0x3a457d();})[_0x3372('0x34')](function(_0x55ad5c){return _0x5d4856(handleCheckRowError(_0x3372('0x17'),_0x3372('0x35')+(_0x55ad5c[_0x3372('0x1e')]||JSON['stringify'](_0x55ad5c)),null,_0x482f12));});});}function checkHopper(){function _0x4bd2f5(){return function(_0x5c2e6e){logger[_0x3372('0x17')](_0x3372('0x36'),_0x3372('0x37'),util[_0x3372('0x38')](_0x5c2e6e,{'showHidden':![],'depth':null}));};}var _0x54e05c=function(_0x5f11da,_0x20ae47){var _0x5e5bc3=squel['insert']()['into'](_0x3372('0x39'))['fromQuery']([_0x3372('0x24'),'scheduledAt',_0x3372('0x3a'),_0x3372('0x2b'),_0x20ae47,_0x3372('0x3b'),_0x3372('0x3c')],squel[_0x3372('0x3d')]()[_0x3372('0x3e')](_0x3372('0x24'),_0x3372('0x24'))[_0x3372('0x3e')]('NOW()',_0x3372('0x3f'))['field']('id',_0x3372('0x3a'))[_0x3372('0x3e')](LISTID['toString'](),_0x3372('0x2b'))[_0x3372('0x3e')](_0x5f11da['id'][_0x3372('0x40')](),_0x20ae47)[_0x3372('0x3e')](_0x3372('0x41'),'createdAt')[_0x3372('0x3e')](_0x3372('0x41'),'updatedAt')['from'](_0x3372('0x42'))[_0x3372('0x43')](_0x3372('0x44'))[_0x3372('0x43')](_0x3372('0x45'),LISTID['toString']())['where'](_0x3372('0x46'))[_0x3372('0x43')](_0x3372('0x47'),squel[_0x3372('0x3d')]()[_0x3372('0x3e')](_0x3372('0x24'))[_0x3372('0x48')](_0x3372('0x39'))[_0x3372('0x43')](_0x20ae47+_0x3372('0x49'),_0x5f11da['id']['toString']())))[_0x3372('0x40')]();return _0x5e5bc3;};var _0x23fd98=function(_0x1b1d8f,_0x35d7ef){var _0x3524f0=squel[_0x3372('0x4a')]()[_0x3372('0x4b')](_0x3372('0x39'))[_0x3372('0x4c')]([_0x3372('0x24'),_0x3372('0x3f'),_0x3372('0x3a'),_0x3372('0x2b'),_0x35d7ef,_0x3372('0x3b'),_0x3372('0x3c')],squel['select']()[_0x3372('0x3e')](_0x3372('0x24'),'phone')['field'](_0x3372('0x41'),_0x3372('0x3f'))[_0x3372('0x3e')]('id',_0x3372('0x3a'))['field'](LISTID['toString'](),_0x3372('0x2b'))[_0x3372('0x3e')](_0x1b1d8f['id'][_0x3372('0x40')](),_0x35d7ef)[_0x3372('0x3e')](_0x3372('0x41'),'createdAt')[_0x3372('0x3e')](_0x3372('0x41'),_0x3372('0x3c'))[_0x3372('0x48')](_0x3372('0x42'))['where'](_0x3372('0x44'))[_0x3372('0x43')](_0x3372('0x45'),LISTID[_0x3372('0x40')]())[_0x3372('0x43')](_0x3372('0x4d'),squel[_0x3372('0x4e')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x3372('0x43')](_0x3372('0x47'),squel['select']()[_0x3372('0x3e')]('calleridnum')['from']('cm_hopper_final')[_0x3372('0x43')](_0x35d7ef+'\x20=\x20?',_0x1b1d8f['id'][_0x3372('0x40')]()))[_0x3372('0x43')](_0x3372('0x47'),squel['select']()[_0x3372('0x3e')]('phone')[_0x3372('0x48')](_0x3372('0x39'))[_0x3372('0x43')](_0x35d7ef+_0x3372('0x49'),_0x1b1d8f['id'][_0x3372('0x40')]())))[_0x3372('0x40')]();return _0x3524f0;};function _0x4663e4(_0x1a6959,_0x44a402){var _0x11b75b=squel[_0x3372('0x4a')]()['into'](_0x3372('0x39'))[_0x3372('0x4c')]([_0x3372('0x24'),_0x3372('0x3f'),_0x3372('0x3a'),_0x3372('0x2b'),_0x44a402,_0x3372('0x3b'),'updatedAt'],squel['select']()[_0x3372('0x3e')]('phone',_0x3372('0x24'))[_0x3372('0x3e')]('NOW()',_0x3372('0x3f'))['field']('id',_0x3372('0x3a'))[_0x3372('0x3e')](LISTID[_0x3372('0x40')](),_0x3372('0x2b'))['field'](_0x1a6959['id'][_0x3372('0x40')](),_0x44a402)['field'](_0x3372('0x41'),_0x3372('0x3b'))[_0x3372('0x3e')](_0x3372('0x41'),_0x3372('0x3c'))[_0x3372('0x48')](_0x3372('0x42'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x3372('0x45'),LISTID[_0x3372('0x40')]())[_0x3372('0x43')](_0x3372('0x4d'),squel[_0x3372('0x4e')](hopperContacts))[_0x3372('0x43')](_0x3372('0x46')))[_0x3372('0x40')]();return _0x11b75b;}function _0xa41a63(_0x1a9ba7,_0x30f127){var _0x4f0e8c=squel[_0x3372('0x4a')]()[_0x3372('0x4b')](_0x3372('0x4f'))[_0x3372('0x4c')]([_0x3372('0x24'),'ContactId',_0x3372('0x2b'),_0x30f127,_0x3372('0x3b'),_0x3372('0x3c')],squel[_0x3372('0x3d')]()[_0x3372('0x3e')](_0x3372('0x24'),_0x3372('0x24'))[_0x3372('0x3e')]('id',_0x3372('0x3a'))[_0x3372('0x3e')](LISTID[_0x3372('0x40')](),'ListId')['field'](_0x1a9ba7['id']['toString'](),_0x30f127)['field']('NOW()',_0x3372('0x3b'))[_0x3372('0x3e')]('NOW()',_0x3372('0x3c'))['from']('cm_contacts')['where'](_0x3372('0x44'))[_0x3372('0x43')](_0x3372('0x45'),LISTID[_0x3372('0x40')]())[_0x3372('0x43')](_0x3372('0x4d'),squel['str'](hopperContacts))[_0x3372('0x43')](_0x3372('0x46')))[_0x3372('0x40')]();return _0x4f0e8c;}return db[_0x3372('0x50')][_0x3372('0x51')]({'where':{'type':_0x3372('0x52')},'attributes':['id',_0x3372('0x53')],'include':[{'model':db['CmList'],'as':_0x3372('0x54'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x62b9ad){var _0xd16a50=[];if(_0x62b9ad){var _0x350bf7;for(var _0x5387a2=0x0,_0x5b4517;_0x5387a2<_0x62b9ad[_0x3372('0x1c')];_0x5387a2+=0x1){_0x5b4517=_0x62b9ad[_0x5387a2][_0x3372('0x56')]({'plain':!![]});switch(_0x5b4517[_0x3372('0x53')]){case _0x3372('0x57'):_0xd16a50[_0x3372('0x32')](db[_0x3372('0x58')]['query'](_0x23fd98(_0x5b4517,_0x3372('0x59')))[_0x3372('0x55')](function(){})['catch'](_0x4bd2f5()));break;case'onlyIfOpen':_0xd16a50['push'](db[_0x3372('0x58')][_0x3372('0x5a')](_0x54e05c(_0x5b4517,_0x3372('0x59')))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));break;default:_0xd16a50[_0x3372('0x32')](db[_0x3372('0x58')]['query'](_0x4663e4(_0x5b4517,_0x3372('0x59')))[_0x3372('0x55')](function(){})[_0x3372('0x34')](_0x4bd2f5()));}}}return _0xd16a50;})[_0x3372('0x5b')]()['then'](function(){return db[_0x3372('0x50')][_0x3372('0x51')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3372('0x5c'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x13d7e9){var _0x355629=[];if(_0x13d7e9){var _0x331736;for(var _0x39f2a5=0x0,_0x265379;_0x39f2a5<_0x13d7e9[_0x3372('0x1c')];_0x39f2a5+=0x1){_0x265379=_0x13d7e9[_0x39f2a5][_0x3372('0x56')]({'plain':!![]});_0x355629[_0x3372('0x32')](db['sequelize'][_0x3372('0x5a')](_0xa41a63(_0x265379,_0x3372('0x59')))[_0x3372('0x55')](function(){})['catch'](_0x4bd2f5()));}}return _0x355629;})[_0x3372('0x5b')]();})[_0x3372('0x55')](function(){return db['Campaign'][_0x3372('0x51')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x3372('0x54'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x430f7e){var _0x4ef6f7=[];if(_0x430f7e){for(var _0x3c326c=0x0,_0x1918f8;_0x3c326c<_0x430f7e[_0x3372('0x1c')];_0x3c326c+=0x1){_0x1918f8=_0x430f7e[_0x3c326c][_0x3372('0x56')]({'plain':!![]});switch(_0x1918f8[_0x3372('0x53')]){case'always':_0x4ef6f7[_0x3372('0x32')](db[_0x3372('0x58')]['query'](_0x23fd98(_0x1918f8,_0x3372('0x5d')))['then'](function(){})['catch'](_0x4bd2f5()));break;case _0x3372('0x5e'):_0x4ef6f7['push'](db[_0x3372('0x58')][_0x3372('0x5a')](_0x54e05c(_0x1918f8,_0x3372('0x5d')))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));break;default:_0x4ef6f7[_0x3372('0x32')](db[_0x3372('0x58')][_0x3372('0x5a')](_0x4663e4(_0x1918f8,'CampaignId'))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));}}}return _0x4ef6f7;})[_0x3372('0x5b')]();})[_0x3372('0x55')](function(){return db['Campaign'][_0x3372('0x51')]({'attributes':['id'],'include':[{'model':db[_0x3372('0x5f')],'as':_0x3372('0x5c'),'where':{'id':LISTID}}]})[_0x3372('0x55')](function(_0x4493f3){var _0x156b2f=[];if(_0x4493f3){for(var _0x1817e4=0x0,_0x5c96f3;_0x1817e4<_0x4493f3[_0x3372('0x1c')];_0x1817e4+=0x1){_0x5c96f3=_0x4493f3[_0x1817e4][_0x3372('0x56')]({'plain':!![]});_0x156b2f[_0x3372('0x32')](db['sequelize'][_0x3372('0x5a')](_0xa41a63(_0x5c96f3,_0x3372('0x5d')))['then'](function(){})[_0x3372('0x34')](_0x4bd2f5()));}}return _0x156b2f;})[_0x3372('0x5b')]();})[_0x3372('0x34')](function(_0x2e6024){logger[_0x3372('0x17')](_0x3372('0x60'),'generalCheckHopper',_0x2e6024[_0x3372('0x1e')]);});}var processPromises=function(_0xa34d32){return BPromise[_0x3372('0x5b')](promises)['then'](function(_0x5003aa){})[_0x3372('0x34')](function(_0x4599d3){logger[_0x3372('0x17')](_0x3372('0x61'),JSON[_0x3372('0x62')](_0x4599d3));})[_0x3372('0x63')](function(){socket['emit'](_0x3372('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xa34d32){return _0xa34d32['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x3372('0x55')](function(){socket[_0x3372('0x65')](_0x3372('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x283801){logger[_0x3372('0x17')](_0x3372('0x66'),JSON[_0x3372('0x62')](_0x283801));}finally{process['exit'](0x0);}});};process['on'](_0x3372('0x67'),function(){logger[_0x3372('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x3372('0x69')]()[_0x3372('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3372('0x30')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3372('0x55')](function(_0x472d00){var _0x484c37=fs[_0x3372('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3372('0x6b')](_0x484c37,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c03a9,_0x311db8){total+=0x1;var _0x2296d9=total;promises['push'](checkRow(_0x1c03a9,_0x472d00,_0x2296d9)['then'](function(){success+=0x1;})[_0x3372('0x34')](function(_0x510def){if(_0x510def['error']){errors+=0x1;delete _0x510def[_0x3372('0x17')];}else if(_0x510def[_0x3372('0x2e')]){duplicates+=0x1;delete _0x510def[_0x3372('0x2e')];}rows[_0x3372('0x32')](_0x510def);}));if(total%0xc8===0x0){_0x311db8[_0x3372('0x6c')]();return processPromises(_0x311db8);}},'complete':function(){return processPromises()[_0x3372('0x55')](function(){logger[_0x3372('0x68')](_0x3372('0x6d'));endCsv();});},'error':function(_0x119069,_0x420fe7){logger[_0x3372('0x68')](_0x3372('0x6e'),JSON['stringify'](_0x119069));endCsv();}});})[_0x3372('0x34')](function(_0x44f253){logger['error'](_0x3372('0x6f'),JSON[_0x3372('0x62')](_0x44f253));});}main(); \ No newline at end of file +var _0x94b3=['CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','undefined','argv','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','join','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','createdAt','updatedAt','field','ContactId','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','into','scheduledAt','select','id\x20IN\x20?','str','cm_hopper_final','fromQuery','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','dialCheckDuplicateType','sequelize','VoiceQueueId','all','CmList','get','query','Lists','always','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x94b3,0x1a2));var _0x394b=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x94b3[_0x255d5b];return _0x3e141a;};'use strict';var BPromise=require('bluebird');var util=require(_0x394b('0x0'));var _=require(_0x394b('0x1'));var fs=require('fs');var squel=require(_0x394b('0x2'));var Papa=require('papaparse');var Redis=require(_0x394b('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x394b('0x4'));var logger=require(_0x394b('0x5'))('api');config[_0x394b('0x6')]=_[_0x394b('0x7')](config[_0x394b('0x6')],{'host':_0x394b('0x8'),'port':0x18eb});var socket=require(_0x394b('0x9'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x394b('0xa')||process[_0x394b('0xb')][0x2]===_0x394b('0xc')){throw new Error(_0x394b('0xd'));}var FILEPATH=process[_0x394b('0xb')][0x2];if(!process[_0x394b('0xb')][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]===_0x394b('0xc')||!process['argv'][0x4]||process[_0x394b('0xb')][0x4]==='undefined'||process['argv'][0x4]===_0x394b('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x394b('0xe')](process[_0x394b('0xb')][0x3][_0x394b('0xf')](','),process[_0x394b('0xb')][0x4][_0x394b('0xf')](','));if(!process[_0x394b('0xb')][0x5]||process[_0x394b('0xb')][0x5]===_0x394b('0xa')||process[_0x394b('0xb')][0x5]==='null'){throw new Error(_0x394b('0x10'));}var LISTID=process[_0x394b('0xb')][0x5];var COMPANYID=process[_0x394b('0xb')][0x6]&&process[_0x394b('0xb')][0x6]!==_0x394b('0xa')&&process[_0x394b('0xb')][0x6]!==_0x394b('0xc')?process[_0x394b('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x394b('0xb')][0x7]!==_0x394b('0xa')&&process[_0x394b('0xb')][0x7]!==_0x394b('0xc')?process[_0x394b('0xb')][0x7]:null;if(!process[_0x394b('0xb')][0x8]||process[_0x394b('0xb')][0x8]===_0x394b('0xa')||process['argv'][0x8]===_0x394b('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x394b('0xb')][0x8];}catch(_0x3700a0){logger['error'](_0x3700a0);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(_0x2ecf85,_0x3b20c6,_0x39f0d1,_0x3c71fb){var _0x3d8576={'message':_0x3b20c6};_0x3d8576[_0x2ecf85]=!![];if(_0x39f0d1){_0x3d8576[_0x394b('0x11')]=_0x39f0d1;}if(_0x3c71fb){_0x3d8576[_0x394b('0x12')]=_0x3c71fb;}return _0x3d8576;}function isEmail(_0x1140da){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))*$/[_0x394b('0x13')](_0x1140da);}function checkRow(_0x10e7a4,_0x205a9f,_0x2619b7){return new BPromise(function(_0x3a6ba8,_0x21c590){if(_[_0x394b('0x14')](_0x10e7a4)){return _0x21c590(handleCheckRowError(_0x394b('0x15'),_0x394b('0x16'),null,_0x2619b7));}if(_0x10e7a4[_0x394b('0x17')]&&_0x10e7a4[_0x394b('0x17')]['length']){var _0x5c574c=_['map'](_0x10e7a4['errors'],'message')[_0x394b('0x18')](';');return _0x21c590(handleCheckRowError('error',_0x5c574c,null,_0x2619b7));}var _0x56c138={};for(var _0x4902c9 in FIELDS){if(FIELDS[_0x394b('0x19')](_0x4902c9)&&FIELDS[_0x4902c9]){_0x56c138[_0x4902c9]=_0x10e7a4[_0x394b('0x1a')][0x0][FIELDS[_0x4902c9]]||_0x10e7a4[_0x394b('0x1a')][0x0]['\ufeff'+FIELDS[_0x4902c9]];}}if(!_0x56c138[_0x394b('0x1b')]){return _0x21c590(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x2619b7));}if(!_0x56c138[_0x394b('0x1c')]){return _0x21c590(handleCheckRowError(_0x394b('0x15'),'phone\x20not\x20specified!',null,_0x2619b7));}if(_0x56c138[_0x394b('0x1d')]){var _0x104bb9=moment(_0x56c138[_0x394b('0x1d')],_0x394b('0x1e'));if(!_0x104bb9['isValid']()){return _0x21c590(handleCheckRowError('error',_0x394b('0x1f'),null,_0x2619b7));}}if(_0x56c138[_0x394b('0x20')]){if(!isEmail(_0x56c138[_0x394b('0x20')])){return _0x21c590(handleCheckRowError(_0x394b('0x15'),_0x394b('0x21'),null,_0x2619b7));}}_0x56c138[_0x394b('0x22')]=LISTID;_0x56c138[_0x394b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x394b('0x24')]&&_0x205a9f){var _0x3d87b3={};for(var _0xc43396=0x0,_0x51307c=DUPLICATES[_0x394b('0x24')];_0xc43396<_0x51307c;_0xc43396+=0x1){_0x3d87b3[DUPLICATES[_0xc43396]]=_0x56c138[DUPLICATES[_0xc43396]];}var _0x30b290=_['find'](_0x205a9f,_0x3d87b3);if(_0x30b290){return _0x21c590(handleCheckRowError('duplicate',_0x394b('0x25'),_0x30b290,_0x2619b7));}}return db['CmContact'][_0x394b('0x26')](_0x56c138,{'raw':!![],'hooks':![],'fields':_[_0x394b('0x27')](_0x56c138)})[_0x394b('0x28')](function(_0x2c21eb){if(DUPLICATES&&DUPLICATES[_0x394b('0x24')]&&_0x205a9f){_0x205a9f[_0x394b('0x29')](_[_0x394b('0x2a')](_0x56c138,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2c21eb['id'];return _0x3a6ba8();})[_0x394b('0x2b')](function(_0x17fcd6){return _0x21c590(handleCheckRowError(_0x394b('0x15'),_0x394b('0x2c')+(_0x17fcd6['message']||JSON[_0x394b('0x2d')](_0x17fcd6)),null,_0x2619b7));});});}function checkHopper(){function _0xea0da7(){return function(_0x1bca53){logger[_0x394b('0x15')]('cmContact',_0x394b('0x2e'),util[_0x394b('0x2f')](_0x1bca53,{'showHidden':![],'depth':null}));};}var _0x1974cf=function(_0x13bc85,_0x5ec901){var _0x57bc68=squel[_0x394b('0x30')]()['into']('cm_hopper')['fromQuery'](['phone','scheduledAt','ContactId',_0x394b('0x22'),_0x5ec901,_0x394b('0x31'),_0x394b('0x32')],squel['select']()[_0x394b('0x33')](_0x394b('0x1c'),_0x394b('0x1c'))[_0x394b('0x33')]('NOW()','scheduledAt')[_0x394b('0x33')]('id',_0x394b('0x34'))[_0x394b('0x33')](LISTID[_0x394b('0x35')](),'ListId')[_0x394b('0x33')](_0x13bc85['id']['toString'](),_0x5ec901)[_0x394b('0x33')](_0x394b('0x36'),'createdAt')[_0x394b('0x33')](_0x394b('0x36'),_0x394b('0x32'))['from'](_0x394b('0x37'))[_0x394b('0x38')](_0x394b('0x39'))[_0x394b('0x38')](_0x394b('0x3a'),LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x394b('0x38')](_0x394b('0x3b'),squel['select']()[_0x394b('0x33')](_0x394b('0x1c'))[_0x394b('0x3c')](_0x394b('0x3d'))[_0x394b('0x38')](_0x5ec901+_0x394b('0x3e'),_0x13bc85['id'][_0x394b('0x35')]())))[_0x394b('0x35')]();return _0x57bc68;};var _0xbf72c9=function(_0x125725,_0xe20b78){var _0x48ec6c=squel['insert']()[_0x394b('0x3f')]('cm_hopper')['fromQuery']([_0x394b('0x1c'),_0x394b('0x40'),'ContactId',_0x394b('0x22'),_0xe20b78,_0x394b('0x31'),_0x394b('0x32')],squel[_0x394b('0x41')]()['field'](_0x394b('0x1c'),_0x394b('0x1c'))[_0x394b('0x33')]('NOW()',_0x394b('0x40'))['field']('id',_0x394b('0x34'))[_0x394b('0x33')](LISTID[_0x394b('0x35')](),_0x394b('0x22'))[_0x394b('0x33')](_0x125725['id'][_0x394b('0x35')](),_0xe20b78)['field']('NOW()',_0x394b('0x31'))[_0x394b('0x33')](_0x394b('0x36'),_0x394b('0x32'))[_0x394b('0x3c')](_0x394b('0x37'))[_0x394b('0x38')]('deletedAt\x20IS\x20NULL')[_0x394b('0x38')]('ListId\x20=\x20?',LISTID[_0x394b('0x35')]())[_0x394b('0x38')](_0x394b('0x42'),squel[_0x394b('0x43')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x394b('0x38')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x394b('0x33')]('calleridnum')[_0x394b('0x3c')](_0x394b('0x44'))[_0x394b('0x38')](_0xe20b78+_0x394b('0x3e'),_0x125725['id'][_0x394b('0x35')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x394b('0x41')]()[_0x394b('0x33')](_0x394b('0x1c'))[_0x394b('0x3c')](_0x394b('0x3d'))[_0x394b('0x38')](_0xe20b78+'\x20=\x20?',_0x125725['id']['toString']())))[_0x394b('0x35')]();return _0x48ec6c;};function _0x21f76e(_0x21f736,_0x338b0b){var _0x52a20b=squel[_0x394b('0x30')]()[_0x394b('0x3f')]('cm_hopper')[_0x394b('0x45')]([_0x394b('0x1c'),_0x394b('0x40'),_0x394b('0x34'),'ListId',_0x338b0b,'createdAt',_0x394b('0x32')],squel['select']()[_0x394b('0x33')](_0x394b('0x1c'),_0x394b('0x1c'))[_0x394b('0x33')](_0x394b('0x36'),_0x394b('0x40'))['field']('id','ContactId')['field'](LISTID['toString'](),'ListId')[_0x394b('0x33')](_0x21f736['id'][_0x394b('0x35')](),_0x338b0b)['field'](_0x394b('0x36'),_0x394b('0x31'))[_0x394b('0x33')]('NOW()',_0x394b('0x32'))['from'](_0x394b('0x37'))[_0x394b('0x38')](_0x394b('0x39'))['where'](_0x394b('0x3a'),LISTID[_0x394b('0x35')]())[_0x394b('0x38')](_0x394b('0x42'),squel[_0x394b('0x43')](hopperContacts))[_0x394b('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x394b('0x35')]();return _0x52a20b;}function _0x3c3723(_0x9268f5,_0x1fdb48){var _0x5966c0=squel[_0x394b('0x30')]()[_0x394b('0x3f')](_0x394b('0x46'))['fromQuery'](['phone',_0x394b('0x34'),_0x394b('0x22'),_0x1fdb48,_0x394b('0x31'),'updatedAt'],squel[_0x394b('0x41')]()[_0x394b('0x33')](_0x394b('0x1c'),_0x394b('0x1c'))['field']('id',_0x394b('0x34'))['field'](LISTID[_0x394b('0x35')](),_0x394b('0x22'))['field'](_0x9268f5['id']['toString'](),_0x1fdb48)[_0x394b('0x33')](_0x394b('0x36'),_0x394b('0x31'))['field'](_0x394b('0x36'),_0x394b('0x32'))[_0x394b('0x3c')](_0x394b('0x37'))[_0x394b('0x38')](_0x394b('0x39'))['where'](_0x394b('0x3a'),LISTID[_0x394b('0x35')]())['where'](_0x394b('0x42'),squel[_0x394b('0x43')](hopperContacts))[_0x394b('0x38')](_0x394b('0x47')))['toString']();return _0x5966c0;}return db[_0x394b('0x48')][_0x394b('0x49')]({'where':{'type':_0x394b('0x4a')},'attributes':['id',_0x394b('0x4b')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x730bdf){var _0x69399a=[];if(_0x730bdf){var _0x6c5b5e;for(var _0x453f45=0x0,_0x334ccf;_0x453f45<_0x730bdf[_0x394b('0x24')];_0x453f45+=0x1){_0x334ccf=_0x730bdf[_0x453f45]['get']({'plain':!![]});switch(_0x334ccf[_0x394b('0x4b')]){case'always':_0x69399a[_0x394b('0x29')](db[_0x394b('0x4c')]['query'](_0xbf72c9(_0x334ccf,_0x394b('0x4d')))['then'](function(){})[_0x394b('0x2b')](_0xea0da7()));break;case'onlyIfOpen':_0x69399a[_0x394b('0x29')](db[_0x394b('0x4c')]['query'](_0x1974cf(_0x334ccf,_0x394b('0x4d')))[_0x394b('0x28')](function(){})[_0x394b('0x2b')](_0xea0da7()));break;default:_0x69399a[_0x394b('0x29')](db[_0x394b('0x4c')]['query'](_0x21f76e(_0x334ccf,_0x394b('0x4d')))['then'](function(){})[_0x394b('0x2b')](_0xea0da7()));}}}return _0x69399a;})[_0x394b('0x4e')]()['then'](function(){return db['VoiceQueue'][_0x394b('0x49')]({'where':{'type':_0x394b('0x4a')},'attributes':['id'],'include':[{'model':db[_0x394b('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x394b('0x28')](function(_0x314a46){var _0x51c5d8=[];if(_0x314a46){var _0x4bdac1;for(var _0x4cd50d=0x0,_0x2aa1d9;_0x4cd50d<_0x314a46[_0x394b('0x24')];_0x4cd50d+=0x1){_0x2aa1d9=_0x314a46[_0x4cd50d][_0x394b('0x50')]({'plain':!![]});_0x51c5d8[_0x394b('0x29')](db[_0x394b('0x4c')][_0x394b('0x51')](_0x3c3723(_0x2aa1d9,'VoiceQueueId'))['then'](function(){})[_0x394b('0x2b')](_0xea0da7()));}}return _0x51c5d8;})['all']();})[_0x394b('0x28')](function(){return db['Campaign'][_0x394b('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x394b('0x52'),'where':{'id':LISTID}}]})[_0x394b('0x28')](function(_0x51586c){var _0x244300=[];if(_0x51586c){for(var _0x419fbb=0x0,_0x19af25;_0x419fbb<_0x51586c[_0x394b('0x24')];_0x419fbb+=0x1){_0x19af25=_0x51586c[_0x419fbb][_0x394b('0x50')]({'plain':!![]});switch(_0x19af25[_0x394b('0x4b')]){case _0x394b('0x53'):_0x244300[_0x394b('0x29')](db['sequelize']['query'](_0xbf72c9(_0x19af25,_0x394b('0x54')))[_0x394b('0x28')](function(){})[_0x394b('0x2b')](_0xea0da7()));break;case _0x394b('0x55'):_0x244300[_0x394b('0x29')](db[_0x394b('0x4c')][_0x394b('0x51')](_0x1974cf(_0x19af25,_0x394b('0x54')))[_0x394b('0x28')](function(){})[_0x394b('0x2b')](_0xea0da7()));break;default:_0x244300['push'](db['sequelize']['query'](_0x21f76e(_0x19af25,_0x394b('0x54')))[_0x394b('0x28')](function(){})['catch'](_0xea0da7()));}}}return _0x244300;})[_0x394b('0x4e')]();})[_0x394b('0x28')](function(){return db['Campaign'][_0x394b('0x49')]({'attributes':['id'],'include':[{'model':db[_0x394b('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x394b('0x28')](function(_0xc61a80){var _0x28eae0=[];if(_0xc61a80){for(var _0x319f90=0x0,_0x5738f0;_0x319f90<_0xc61a80[_0x394b('0x24')];_0x319f90+=0x1){_0x5738f0=_0xc61a80[_0x319f90][_0x394b('0x50')]({'plain':!![]});_0x28eae0[_0x394b('0x29')](db[_0x394b('0x4c')][_0x394b('0x51')](_0x3c3723(_0x5738f0,_0x394b('0x54')))[_0x394b('0x28')](function(){})[_0x394b('0x2b')](_0xea0da7()));}}return _0x28eae0;})['all']();})[_0x394b('0x2b')](function(_0x226607){logger[_0x394b('0x15')](_0x394b('0x56'),_0x394b('0x57'),_0x226607['message']);});}var processPromises=function(_0x465c7e){return BPromise[_0x394b('0x4e')](promises)[_0x394b('0x28')](function(_0x1388ee){})[_0x394b('0x2b')](function(_0x3a97a0){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x394b('0x2d')](_0x3a97a0));})[_0x394b('0x58')](function(){socket[_0x394b('0x59')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x465c7e){return _0x465c7e[_0x394b('0x5a')]();}});};var endCsv=function(){return BPromise[_0x394b('0x5b')]()[_0x394b('0x28')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x394b('0x59')](_0x394b('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x394b('0x5d')](FILEPATH);}catch(_0x1d3990){logger['error'](_0x394b('0x5e'),JSON[_0x394b('0x2d')](_0x1d3990));}finally{process['exit'](0x0);}});};process['on'](_0x394b('0x5f'),function(){logger[_0x394b('0x60')](_0x394b('0x61'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x394b('0x28')](function(_0x19364a){var _0xb0239b=fs[_0x394b('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x394b('0x63')](_0xb0239b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ea9b9,_0x2d2b75){total+=0x1;var _0x2c94a6=total;promises[_0x394b('0x29')](checkRow(_0x2ea9b9,_0x19364a,_0x2c94a6)[_0x394b('0x28')](function(){success+=0x1;})[_0x394b('0x2b')](function(_0x613661){if(_0x613661[_0x394b('0x15')]){errors+=0x1;delete _0x613661[_0x394b('0x15')];}else if(_0x613661[_0x394b('0x64')]){duplicates+=0x1;delete _0x613661[_0x394b('0x64')];}rows[_0x394b('0x29')](_0x613661);}));if(total%0xc8===0x0){_0x2d2b75[_0x394b('0x65')]();return processPromises(_0x2d2b75);}},'complete':function(){return processPromises()[_0x394b('0x28')](function(){logger['info'](_0x394b('0x66'));endCsv();});},'error':function(_0x2f556f,_0x54796d){logger[_0x394b('0x60')](_0x394b('0x67'),JSON[_0x394b('0x2d')](_0x2f556f));endCsv();}});})[_0x394b('0x2b')](function(_0x426a24){logger[_0x394b('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x426a24));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 13ef3eb..14b7b3d 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 _0x8bc5=['voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','phone','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','fromQuery','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','cm_contacts','field','ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','push','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','length','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','timezones','isNil','set','offset','dialTimezone','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','parse','createReadStream','data','rows','errors','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','\x20not\x20specified','SystemRow','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_0x8bc5,0x152));var _0x58bc=function(_0x22fe93,_0x1c0fd6){_0x22fe93=_0x22fe93-0x0;var _0x272f1e=_0x8bc5[_0x22fe93];return _0x272f1e;};'use strict';var fs=require('fs');var path=require(_0x58bc('0x0'));var _=require(_0x58bc('0x1'));var Papa=require(_0x58bc('0x2'));var util=require('util');var BPromise=require(_0x58bc('0x3'));var moment=require('moment');var squel=require(_0x58bc('0x4'));var Redis=require(_0x58bc('0x5'));var db=require(_0x58bc('0x6'))['db'];var config=require(_0x58bc('0x7'));var shared=require(_0x58bc('0x8'));var logger=require(_0x58bc('0x9'))('import');config['redis']=_['defaults'](config[_0x58bc('0xa')],{'host':_0x58bc('0xb'),'port':0x18eb});var socket=require(_0x58bc('0xc'))(new Redis(config[_0x58bc('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x58bc('0xd')](_0x58bc('0xe'));function isEmail(_0x164496){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))*$/[_0x58bc('0xf')](_0x164496);}function selectNotIn(_0x142be8,_0xcfcac2,_0x3171fa,_0x2254aa,_0x4b7f11){return squel['select']()['field']('phone')[_0x58bc('0x10')](_0x2254aa)['join'](_0xcfcac2,null,_0xcfcac2+_0x58bc('0x11')+_0x2254aa+'.'+_0x3171fa)[_0x58bc('0x12')](_0x2254aa+'.'+_0x3171fa+_0x58bc('0x13')+_0x142be8+'.'+_0x3171fa)[_0x58bc('0x12')](_0xcfcac2+_0x58bc('0x14')+_0x4b7f11[_0x58bc('0x15')]()+')');}function insertCmHopper(_0x5565f0,_0x6b5eda,_0x1d7488,_0x3e03cf,_0x2e3bb9){var _0x4e8179=[_0x58bc('0x16'),_0x58bc('0x17'),_0x58bc('0x18'),_0x58bc('0x19'),_0x6b5eda+'.'+_0x3e03cf,_0x58bc('0x1a'),'cm_contacts.updatedAt',_0x58bc('0x1b'),_0x58bc('0x1c'),'\x22'+_0x2e3bb9+'\x22'];return squel[_0x58bc('0x1d')]()[_0x58bc('0x1e')](_0x58bc('0x1f'))['fromQuery']([_0x58bc('0x20'),'scheduledat',_0x58bc('0x21'),_0x58bc('0x22'),_0x3e03cf,_0x58bc('0x23'),_0x58bc('0x24'),_0x58bc('0x25'),_0x58bc('0x26'),_0x58bc('0x27')],squel[_0x58bc('0x28')]()[_0x58bc('0x29')](_0x4e8179)[_0x58bc('0x10')](_0x6b5eda)[_0x58bc('0x15')]('cm_contacts',null,_0x58bc('0x2a')+_0x6b5eda+_0x58bc('0x2b'))[_0x58bc('0x15')](_0x1d7488,null,_0x1d7488+'.id\x20=\x20'+_0x6b5eda+'.'+_0x3e03cf)[_0x58bc('0x12')](_0x6b5eda+_0x58bc('0x2c'),_0x5565f0)[_0x58bc('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x6b5eda,_0x1d7488,_0x3e03cf,_0x58bc('0x1f'),['\x22always\x22',_0x58bc('0x2e')]))[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x6b5eda,_0x1d7488,_0x3e03cf,_0x58bc('0x1f'),[_0x58bc('0x2f')])))[_0x58bc('0x30')]();}function insertCmHopperBlack(_0x19b655,_0x128b90,_0x3d97e6,_0x5aaaef){var _0x536bdf=['cm_contacts.phone',_0x58bc('0x18'),_0x58bc('0x19'),_0x128b90+'.'+_0x5aaaef,'cm_contacts.createdAt',_0x58bc('0x31')];return squel[_0x58bc('0x1d')]()[_0x58bc('0x1e')](_0x58bc('0x32'))[_0x58bc('0x33')](['phone',_0x58bc('0x21'),_0x58bc('0x22'),_0x5aaaef,_0x58bc('0x23'),_0x58bc('0x24')],squel['select']()['fields'](_0x536bdf)[_0x58bc('0x10')](_0x128b90)[_0x58bc('0x15')]('cm_contacts',null,_0x58bc('0x2a')+_0x128b90+'.CmListId')[_0x58bc('0x15')](_0x3d97e6,null,_0x3d97e6+_0x58bc('0x11')+_0x128b90+'.'+_0x5aaaef)['where'](_0x128b90+'.CmListId\x20=\x20?',_0x19b655)[_0x58bc('0x12')](_0x58bc('0x34'),NOW)['where'](_0x58bc('0x2d'),squel[_0x58bc('0x28')]()['field'](_0x58bc('0x20'))['from'](_0x58bc('0x32'))[_0x58bc('0x12')]('ListId\x20=\x20?',_0x19b655)[_0x58bc('0x12')](_0x5aaaef+_0x58bc('0x35'),_0x128b90+'.'+_0x5aaaef)))['toString']();}function insertTzCmHopper(_0x26ba31,_0x499d30,_0x2d0ff7,_0x38f2b8,_0xb09507,_0x47278e){var _0x5ea30e=[_0x58bc('0x16'),_0x58bc('0x36')+_0x47278e+_0x58bc('0x37'),_0x58bc('0x18'),_0x58bc('0x19'),_0x499d30+'.'+_0x38f2b8,_0x58bc('0x1a'),_0x58bc('0x31'),_0x58bc('0x1b'),_0x58bc('0x1c'),'\x22'+_0xb09507+'\x22'];var _0x10eee8=squel['insert']()['into'](_0x58bc('0x1f'))[_0x58bc('0x33')]([_0x58bc('0x20'),_0x58bc('0x38'),_0x58bc('0x21'),_0x58bc('0x22'),_0x38f2b8,'createdAt','updatedAt',_0x58bc('0x25'),_0x58bc('0x26'),_0x58bc('0x27')],squel[_0x58bc('0x28')]()[_0x58bc('0x29')](_0x5ea30e)[_0x58bc('0x10')](_0x499d30)[_0x58bc('0x15')](_0x58bc('0x39'),null,_0x58bc('0x2a')+_0x499d30+_0x58bc('0x2b'))[_0x58bc('0x15')](_0x2d0ff7,null,_0x2d0ff7+_0x58bc('0x11')+_0x499d30+'.'+_0x38f2b8)['join'](_0x47278e,null,_0x47278e+_0x58bc('0x11')+_0x499d30+'.'+_0x38f2b8)[_0x58bc('0x12')](_0x499d30+'.CmListId\x20=\x20?',_0x26ba31)[_0x58bc('0x12')](_0x58bc('0x34'),NOW)[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x499d30,_0x2d0ff7,_0x38f2b8,'cm_hopper',[_0x58bc('0x2f'),_0x58bc('0x2e')]))[_0x58bc('0x12')](_0x58bc('0x2d'),selectNotIn(_0x499d30,_0x2d0ff7,_0x38f2b8,_0x58bc('0x1f'),[_0x58bc('0x2f')])))[_0x58bc('0x30')]();return _0x10eee8;}function insertTzCmHopperBlack(_0xa65250,_0x55e7d8,_0x5b3dd7,_0xa523b1){var _0x13956d=[_0x58bc('0x16'),_0x58bc('0x18'),'cm_contacts.ListId',_0x55e7d8+'.'+_0xa523b1,_0x58bc('0x1a'),'cm_contacts.updatedAt'];return squel[_0x58bc('0x1d')]()['into'](_0x58bc('0x32'))[_0x58bc('0x33')]([_0x58bc('0x20'),_0x58bc('0x21'),_0x58bc('0x22'),_0xa523b1,'createdAt',_0x58bc('0x24')],squel[_0x58bc('0x28')]()['fields'](_0x13956d)['from'](_0x55e7d8)[_0x58bc('0x15')](_0x58bc('0x39'),null,_0x58bc('0x2a')+_0x55e7d8+'.CmListId')['join'](_0x5b3dd7,null,_0x5b3dd7+_0x58bc('0x11')+_0x55e7d8+'.'+_0xa523b1)[_0x58bc('0x12')](_0x55e7d8+_0x58bc('0x2c'),_0xa65250)[_0x58bc('0x12')](_0x58bc('0x34'),NOW)[_0x58bc('0x12')](_0x58bc('0x2d'),squel[_0x58bc('0x28')]()[_0x58bc('0x3a')](_0x58bc('0x20'))['from']('cm_hopper_black')['where'](_0x58bc('0x3b'),_0xa65250)[_0x58bc('0x12')](_0xa523b1+'\x20=\x20?',_0x55e7d8+'.'+_0xa523b1)))[_0x58bc('0x30')]();}function insertCmContact(_0x1062cb,_0x367484,_0x241e2f,_0x27b0af){var _0x1a03c4=_[_0x58bc('0x3c')](_[_0x58bc('0x3d')](_0x27b0af),['ListId','CompanyId',_0x58bc('0x23'),_0x58bc('0x24')]);return squel[_0x58bc('0x1d')]()['into'](_0x58bc('0x39'))[_0x58bc('0x33')](_0x1a03c4,squel['select']()[_0x58bc('0x29')](_0x1a03c4)['from'](_0x367484)['where']('('+_0x241e2f[_0x58bc('0x15')](',')+_0x58bc('0x3e'),squel[_0x58bc('0x28')]()[_0x58bc('0x29')](_0x241e2f)[_0x58bc('0x10')](_0x58bc('0x39'))[_0x58bc('0x12')](_0x58bc('0x3b'),_0x1062cb)[_0x58bc('0x12')]('deletedAt\x20IS\x20NULL'))[_0x58bc('0x12')](_0x58bc('0x3f'),squel[_0x58bc('0x28')]()['field'](_0x58bc('0x40'),_0x58bc('0x41'))[_0x58bc('0x10')](_0x367484)[_0x58bc('0x42')](_0x241e2f[_0x58bc('0x15')](','))))[_0x58bc('0x30')]();}function handleStop(){logger[_0x58bc('0x43')](_0x58bc('0x44'));stopped=!![];}function handleUncaughtException(_0x29026b){logger['error'](_0x29026b[_0x58bc('0x45')]);process[_0x58bc('0x46')](0x1);}function handleError(_0xf403fd,_0x48f023){stats['errors'][_0x58bc('0x47')]({'name':_0x48f023['code'],'message':_0x48f023['message'],'row':_0xf403fd});}function handleQuery(_0x5950c6){logger[_0x58bc('0x43')](_0x5950c6);return db['sequelize'][_0x58bc('0x48')](_0x5950c6)[_0x58bc('0x49')](function(_0x91bfcf){results[_0x58bc('0x47')](_0x91bfcf);})[_0x58bc('0x4a')](function(_0x8dd92b){logger[_0x58bc('0x4b')](_0x8dd92b['message']);});}function updateTzCampaigns(_0x5718bb){return new Promise(function(_0x10b2d5,_0x5207fd){var _0x515394=squel[_0x58bc('0x28')]()[_0x58bc('0x29')]([_0x58bc('0x4c'),_0x58bc('0x4d')])[_0x58bc('0x10')]('campaigns')[_0x58bc('0x15')]('campaigns_has_cm_lists',null,_0x58bc('0x4e'))['where']('campaigns_has_cm_lists.CmListId='+_0x5718bb);db[_0x58bc('0x4f')]['query'](_0x515394[_0x58bc('0x30')]())['spread'](function(_0x2b7877){var _0x2295a8=[];for(var _0x3bcbe6=0x0;_0x3bcbe6<_0x2b7877[_0x58bc('0x50')];_0x3bcbe6++){_0x2295a8[_0x58bc('0x47')](getTimezoneData(_0x2b7877[_0x3bcbe6],tmp_campaigns));}BPromise['all'](_0x2295a8)[_0x58bc('0x51')](function(){_0x10b2d5({'val':0x1});});})[_0x58bc('0x4a')](function(_0x1a138d){logger['error'](_0x1a138d[_0x58bc('0x45')]);_0x10b2d5({'val':0x0});});});}function updateTzVoiceQueues(_0x5bc0e3){return new Promise(function(_0x1e9719,_0x5320ff){var _0x3bf44d=squel['select']()['fields']([_0x58bc('0x52'),_0x58bc('0x53')])['from'](_0x58bc('0x54'))['join'](_0x58bc('0x55'),null,_0x58bc('0x56'))[_0x58bc('0x12')](_0x58bc('0x57')+_0x5bc0e3);db['sequelize'][_0x58bc('0x48')](_0x3bf44d[_0x58bc('0x30')]())[_0x58bc('0x49')](function(_0x3e0082){var _0x435b2b=[];for(var _0x290fba=0x0;_0x290fba<_0x3e0082[_0x58bc('0x50')];_0x290fba++){_0x435b2b[_0x58bc('0x47')](getTimezoneData(_0x3e0082[_0x290fba],tmp_voice_queues));}BPromise[_0x58bc('0x58')](_0x435b2b)['then'](function(){_0x1e9719({'val':0x1});});})[_0x58bc('0x4a')](function(_0x822469){logger[_0x58bc('0x4b')](_0x822469[_0x58bc('0x45')]);_0x1e9719({'val':0x0});});});}function getTimezoneData(_0x5190af,_0xcc1ae1){return new Promise(function(_0x248954,_0x36e6d9){var _0x51ca78=shared[_0x58bc('0x59')];var _0x782270=_0x51ca78[_0x5190af['dialTimezone']];if(_[_0x58bc('0x5a')](_0x782270)){_0x248954({'ret':0x1});}else{var _0x4bbfa5=_0x782270['utcOffset'];var _0x20685a=squel[_0x58bc('0x1d')]()[_0x58bc('0x1e')](_0xcc1ae1)[_0x58bc('0x5b')]('id',_0x5190af['id'])[_0x58bc('0x5b')](_0x58bc('0x5c'),_0x4bbfa5)[_0x58bc('0x5b')](_0x58bc('0x5d'),_0x5190af[_0x58bc('0x5d')])[_0x58bc('0x30')]();return db['sequelize']['query'](_0x20685a)[_0x58bc('0x49')](function(_0x21c3bf){_0x248954({'ret':0x1});})[_0x58bc('0x4a')](function(_0x320234){logger[_0x58bc('0x4b')](_0x320234[_0x58bc('0x45')]);_0x36e6d9({'ret':0x1});});}});}function handleTZQuery(_0x1987f2){logger[_0x58bc('0x43')](_0x1987f2);return db[_0x58bc('0x4f')][_0x58bc('0x48')](_0x1987f2)[_0x58bc('0x49')](function(_0x491205){})[_0x58bc('0x4a')](function(_0x9a5b8d){logger[_0x58bc('0x4b')](_0x9a5b8d[_0x58bc('0x45')]);});}function main(_0x36a845,_0x46c9e7,_0x33cd15,_0x547e3e){logger['info'](_0x58bc('0x5e'),_0x36a845,JSON['stringify'](_0x46c9e7));process[_0x58bc('0x5f')](_0x58bc('0x60'));var _0x36bfb6=_0x46c9e7[_0x58bc('0x61')];var _0x1eae7e=_0x46c9e7[_0x58bc('0x62')];var _0x27df27=path[_0x58bc('0x15')](config[_0x58bc('0x63')],_0x58bc('0x64'),_0x1eae7e+_0x58bc('0x65'));hasTZ=_[_0x58bc('0x3d')](_0x36bfb6)['includes'](_0x58bc('0x5d'));var _0x2c72f5=_[_0x58bc('0x3d')](_0x36bfb6)[_0x58bc('0x15')]();logger[_0x58bc('0x43')](_0x58bc('0x66'),_0x2c72f5);if(hasTZ)_0x2c72f5+=',utcOffset';fs['writeFileSync'](_0x27df27,_0x2c72f5+'\x0a');Papa[_0x58bc('0x67')](fs[_0x58bc('0x68')](_0x36a845),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71a7,_0x16f640){try{for(var _0x2c857=0x0,_0x5b878d=[];_0x2c857<_0x1e71a7[_0x58bc('0x69')]['length'];_0x2c857++){stats[_0x58bc('0x6a')]+=0x1;if(_0x1e71a7[_0x58bc('0x6b')][_0x2c857]){handleError(_0x1e71a7['data'][_0x2c857],_0x1e71a7['errors'][_0x2c857]);}else{var _0x4b06aa=[];for(var _0x1753d0 in _0x36bfb6){if(_0x36bfb6['hasOwnProperty'](_0x1753d0)){if(_0x1e71a7[_0x58bc('0x69')][_0x2c857][_0x36bfb6[_0x1753d0]]){var _0x590565=_[_0x58bc('0x6c')](_0x1e71a7[_0x58bc('0x69')][_0x2c857][_0x36bfb6[_0x1753d0]][_0x58bc('0x6d')](/"/g,'\x27'));switch(_0x1753d0){case _0x58bc('0x38'):var _0xff527e=moment(_0x590565,_0x58bc('0xe'),!![]);if(_0xff527e[_0x58bc('0x6e')]()){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}else{_0x4b06aa[_0x58bc('0x47')](_0x58bc('0x6f'));}break;case'priority':var _0x468c92=parseInt(_0x590565);_0x590565=_['isNaN'](_0x468c92)||_0x468c92<0x0||_0x468c92>0x4?_0x547e3e?0x3:0x2:_0x468c92;_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');break;case'UserId':var _0x44101c=parseInt(_0x590565);if(_[_0x58bc('0x70')](_0x44101c)&&_[_0x58bc('0x71')](_0x33cd15,_0x44101c)){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x44101c+'\x22');}else{_0x4b06aa[_0x58bc('0x47')](_0x58bc('0x72'));}break;case _0x58bc('0x73'):if(isEmail(_0x590565)){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}else{_0x4b06aa[_0x58bc('0x47')](_0x58bc('0x74'));}break;case _0x58bc('0x75'):var _0xe2d156=moment(_0x590565,'YYYY-MM-DD',!![]);if(_0xe2d156[_0x58bc('0x6e')]()){_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}else{_0x4b06aa['push'](_0x58bc('0x76'));}break;case _0x58bc('0x5d'):var _0x1ca587=shared[_0x58bc('0x59')];var _0x172175=_0x1ca587[_0x590565];if(!_[_0x58bc('0x5a')](_0x172175)){var _0x1185c8=_0x172175[_0x58bc('0x77')];_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');_0x5b878d[_0x58bc('0x47')]('\x22'+_0x1185c8+'\x22');}break;default:_0x5b878d[_0x58bc('0x47')]('\x22'+_0x590565+'\x22');}}else{switch(_0x1753d0){case'firstName':case'phone':_0x4b06aa[_0x58bc('0x47')](_0x1753d0+_0x58bc('0x78'));break;default:_0x5b878d[_0x58bc('0x47')]('\x22\x22');}}}}if(_0x4b06aa[_0x58bc('0x50')]){handleError(_0x1e71a7[_0x58bc('0x69')][_0x2c857],{'code':_0x58bc('0x79'),'message':_0x4b06aa['join']()});}else{fs['appendFileSync'](_0x27df27,_0x5b878d[_0x58bc('0x15')]()+'\x0a');}_0x5b878d=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x58bc('0x7a')+_0x1eae7e,stats);stats['errors']=[];}}if(stopped){logger[_0x58bc('0x43')](_0x58bc('0x7b'));_0x16f640[_0x58bc('0x7c')]();}}catch(_0xa53321){handleError(_0x1e71a7[_0x58bc('0x69')][_0x2c857],{'code':'SystemError','message':_0xa53321[_0x58bc('0x45')]});logger[_0x58bc('0x4b')](_0x58bc('0x7d'),_0xa53321[_0x58bc('0x45')]);}},'complete':function(){try{var _0x37ab13=[];var _0x461ea5=[];var _0x974e71=_0x58bc('0x39');if(_0x46c9e7[_0x58bc('0x7e')]&&_0x46c9e7[_0x58bc('0x7e')]['length']){_0x974e71=_0x58bc('0x7f')+_0x1eae7e;_0x37ab13[_0x58bc('0x47')](_0x58bc('0x80')+_0x974e71+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x58bc('0x81')+_0x1eae7e;tmp_voice_queues=_0x58bc('0x82')+_0x1eae7e;_0x461ea5[_0x58bc('0x47')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x58bc('0x83'));_0x461ea5[_0x58bc('0x47')](_0x58bc('0x80')+tmp_voice_queues+_0x58bc('0x83'));BPromise[_0x58bc('0x84')](_0x461ea5,handleTZQuery)[_0x58bc('0x51')](function(_0x13fe98){updateTzCampaigns(_0x46c9e7[_0x58bc('0x22')])[_0x58bc('0x51')](function(_0x10dab){updateTzVoiceQueues(_0x46c9e7[_0x58bc('0x22')])[_0x58bc('0x51')](function(_0x4d0543){var _0x5c8bf2=util['format'](_0x58bc('0x85'),_0x27df27,_0x974e71,_0x2c72f5,_0x46c9e7[_0x58bc('0x22')],_0x46c9e7[_0x58bc('0x86')]||null,NOW,NOW);if(_['isNil'](_0x36bfb6[_0x58bc('0x38')])){_0x5c8bf2+=',\x20scheduledAt\x20=\x20NOW()';}_0x37ab13[_0x58bc('0x47')](_0x5c8bf2);if(_0x46c9e7[_0x58bc('0x7e')]&&_0x46c9e7[_0x58bc('0x7e')][_0x58bc('0x50')]){_0x37ab13[_0x58bc('0x47')](insertCmContact(_0x46c9e7[_0x58bc('0x22')],_0x974e71,_0x46c9e7[_0x58bc('0x7e')],_0x36bfb6));_0x37ab13[_0x58bc('0x47')](_0x58bc('0x87')+_0x974e71+';');}if(hasTZ){_0x37ab13[_0x58bc('0x47')](insertTzCmHopper(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x55'),_0x58bc('0x54'),_0x58bc('0x88'),_0x547e3e,tmp_voice_queues));_0x37ab13[_0x58bc('0x47')](insertTzCmHopperBlack(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x89'),_0x58bc('0x54'),_0x58bc('0x88')));_0x37ab13[_0x58bc('0x47')](insertTzCmHopper(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x8a'),'campaigns',_0x58bc('0x8b'),_0x547e3e,tmp_campaigns));_0x37ab13[_0x58bc('0x47')](insertTzCmHopperBlack(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x8c'),_0x58bc('0x8d'),_0x58bc('0x8b')));}else{_0x37ab13[_0x58bc('0x47')](insertCmHopper(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x55'),_0x58bc('0x54'),_0x58bc('0x88'),_0x547e3e));_0x37ab13[_0x58bc('0x47')](insertCmHopperBlack(_0x46c9e7[_0x58bc('0x22')],_0x58bc('0x89'),_0x58bc('0x54'),_0x58bc('0x88')));_0x37ab13[_0x58bc('0x47')](insertCmHopper(_0x46c9e7[_0x58bc('0x22')],'campaigns_has_cm_lists',_0x58bc('0x8d'),'CampaignId',_0x547e3e));_0x37ab13['push'](insertCmHopperBlack(_0x46c9e7['ListId'],'campaigns_has_cm_blacklists',_0x58bc('0x8d'),_0x58bc('0x8b')));}_0x37ab13[_0x58bc('0x47')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x37ab13['push'](_0x58bc('0x87')+tmp_voice_queues+';');BPromise['each'](_0x37ab13,handleQuery)[_0x58bc('0x51')](function(_0x3db045){stats[_0x58bc('0x8e')]=!![];stats[_0x58bc('0x8f')]=_0x46c9e7['duplicates']&&_0x46c9e7[_0x58bc('0x7e')][_0x58bc('0x50')]?results[0x2][_0x58bc('0x8f')]:results[0x0][_0x58bc('0x8f')];socket['emit']('contact:import:'+_0x1eae7e,stats);fs[_0x58bc('0x90')](_0x36a845);fs[_0x58bc('0x90')](_0x27df27);process[_0x58bc('0x46')](0x0);})[_0x58bc('0x4a')](function(_0x3daf77){logger[_0x58bc('0x4b')](_0x3daf77['message']);process[_0x58bc('0x46')](0x1);});});});});}catch(_0x36a4a7){logger[_0x58bc('0x4b')](_0x58bc('0x91'),_0x36a4a7[_0x58bc('0x45')]);process[_0x58bc('0x46')](0x1);}},'error':function(_0xcf5a,_0x13a4d3,_0x28cb62,_0xe5c7a4){throw new Error(_0xe5c7a4);}});}function validate(){if(process['argv']&&process['argv'][_0x58bc('0x50')]<0x4){throw new Error(_0x58bc('0x92'));}var _0x27e0ec=path[_0x58bc('0x15')](config['root'],_0x58bc('0x64'),process[_0x58bc('0x93')][0x2]);if(!fs[_0x58bc('0x94')](_0x27e0ec)){throw new Error(_0x58bc('0x95'));}var _0x28f10f={};try{_0x28f10f=JSON[_0x58bc('0x67')](process[_0x58bc('0x93')][0x3]);if(!_0x28f10f[_0x58bc('0x61')]){throw new Error(_0x58bc('0x96'));}if(!_0x28f10f[_0x58bc('0x61')][_0x58bc('0x20')]){throw new Error(_0x58bc('0x97'));}if(!_0x28f10f[_0x58bc('0x61')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x3dc7b6=0x0;if(_0x28f10f['binding'][_0x58bc('0x26')]){_0x3dc7b6=0x1;}if(!_0x28f10f[_0x58bc('0x22')]){throw new Error(_0x58bc('0x98'));}}catch(_0x7219f3){throw new Error('body\x20id\x20mandatory');}var _0x129cf0=[];try{_0x129cf0=_[_0x58bc('0x99')](JSON[_0x58bc('0x67')](process[_0x58bc('0x93')][0x4]),'id');}catch(_0x1a96ce){logger[_0x58bc('0x43')](_0x58bc('0x9a'));}main(_0x27e0ec,_0x28f10f,_0x129cf0,_0x3dc7b6);}validate();process['on']('SIGINT',handleStop);process['on'](_0x58bc('0x9b'),handleUncaughtException); \ No newline at end of file +var _0x56ef=['cm_hopper_black','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','code','message','sequelize','query','spread','push','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','dialTimezone','offset','set','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv',',utcOffset','writeFileSync','createReadStream','data','errors','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','ListId','fields'];(function(_0x12019a,_0x407485){var _0x49520a=function(_0x150fb6){while(--_0x150fb6){_0x12019a['push'](_0x12019a['shift']());}};_0x49520a(++_0x407485);}(_0x56ef,0x66));var _0xf56e=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x56ef[_0x5c4f6b];return _0x104c4e;};'use strict';var fs=require('fs');var path=require(_0xf56e('0x0'));var _=require('lodash');var Papa=require(_0xf56e('0x1'));var util=require(_0xf56e('0x2'));var BPromise=require(_0xf56e('0x3'));var moment=require(_0xf56e('0x4'));var squel=require(_0xf56e('0x5'));var Redis=require(_0xf56e('0x6'));var db=require(_0xf56e('0x7'))['db'];var config=require(_0xf56e('0x8'));var shared=require(_0xf56e('0x9'));var logger=require(_0xf56e('0xa'))(_0xf56e('0xb'));config[_0xf56e('0xc')]=_[_0xf56e('0xd')](config[_0xf56e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf56e('0xe'))(new Redis(config[_0xf56e('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xf56e('0xf')](_0xf56e('0x10'));function isEmail(_0x5021d0){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))*$/[_0xf56e('0x11')](_0x5021d0);}function selectNotIn(_0x26cb96,_0x3d29c3,_0x5ab137,_0x23e05e,_0x531847){return squel[_0xf56e('0x12')]()[_0xf56e('0x13')](_0xf56e('0x14'))[_0xf56e('0x15')](_0x23e05e)['join'](_0x3d29c3,null,_0x3d29c3+_0xf56e('0x16')+_0x23e05e+'.'+_0x5ab137)['where'](_0x23e05e+'.'+_0x5ab137+_0xf56e('0x17')+_0x26cb96+'.'+_0x5ab137)['where'](_0x3d29c3+_0xf56e('0x18')+_0x531847[_0xf56e('0x19')]()+')');}function insertCmHopper(_0xea1be3,_0x548bd5,_0x1ce843,_0x330fcc,_0x4903c8){var _0x2575a6=[_0xf56e('0x1a'),'cm_contacts.scheduledat',_0xf56e('0x1b'),_0xf56e('0x1c'),_0x548bd5+'.'+_0x330fcc,'cm_contacts.createdAt',_0xf56e('0x1d'),_0xf56e('0x1e'),_0xf56e('0x1f'),'\x22'+_0x4903c8+'\x22'];return squel[_0xf56e('0x20')]()[_0xf56e('0x21')](_0xf56e('0x22'))[_0xf56e('0x23')]([_0xf56e('0x14'),'scheduledat',_0xf56e('0x24'),'ListId',_0x330fcc,_0xf56e('0x25'),_0xf56e('0x26'),_0xf56e('0x27'),'UserId',_0xf56e('0x28')],squel['select']()['fields'](_0x2575a6)[_0xf56e('0x15')](_0x548bd5)['join'](_0xf56e('0x29'),null,_0xf56e('0x2a')+_0x548bd5+_0xf56e('0x2b'))[_0xf56e('0x19')](_0x1ce843,null,_0x1ce843+_0xf56e('0x16')+_0x548bd5+'.'+_0x330fcc)[_0xf56e('0x2c')](_0x548bd5+_0xf56e('0x2d'),_0xea1be3)[_0xf56e('0x2c')](_0xf56e('0x2e'),NOW)[_0xf56e('0x2c')](_0xf56e('0x2f'),selectNotIn(_0x548bd5,_0x1ce843,_0x330fcc,_0xf56e('0x22'),[_0xf56e('0x30'),_0xf56e('0x31')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x548bd5,_0x1ce843,_0x330fcc,'cm_hopper',['\x22always\x22'])))[_0xf56e('0x32')]();}function insertCmHopperBlack(_0x13e7f3,_0x4f83c0,_0x5cbbe9,_0x4029e6){var _0x50bd92=[_0xf56e('0x1a'),_0xf56e('0x1b'),'cm_contacts.ListId',_0x4f83c0+'.'+_0x4029e6,_0xf56e('0x33'),_0xf56e('0x1d')];return squel['insert']()['into']('cm_hopper_black')[_0xf56e('0x23')](['phone',_0xf56e('0x24'),_0xf56e('0x34'),_0x4029e6,_0xf56e('0x25'),_0xf56e('0x26')],squel[_0xf56e('0x12')]()[_0xf56e('0x35')](_0x50bd92)['from'](_0x4f83c0)['join'](_0xf56e('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0x4f83c0+'.CmListId')['join'](_0x5cbbe9,null,_0x5cbbe9+'.id\x20=\x20'+_0x4f83c0+'.'+_0x4029e6)[_0xf56e('0x2c')](_0x4f83c0+_0xf56e('0x2d'),_0x13e7f3)[_0xf56e('0x2c')](_0xf56e('0x2e'),NOW)['where'](_0xf56e('0x2f'),squel[_0xf56e('0x12')]()[_0xf56e('0x13')](_0xf56e('0x14'))['from'](_0xf56e('0x36'))['where']('ListId\x20=\x20?',_0x13e7f3)[_0xf56e('0x2c')](_0x4029e6+_0xf56e('0x37'),_0x4f83c0+'.'+_0x4029e6)))['toString']();}function insertTzCmHopper(_0x3d6570,_0x15adb2,_0x5a46ee,_0x4f8032,_0x48efb3,_0xf1cfe){var _0x3874d4=[_0xf56e('0x1a'),_0xf56e('0x38')+_0xf1cfe+_0xf56e('0x39'),_0xf56e('0x1b'),_0xf56e('0x1c'),_0x15adb2+'.'+_0x4f8032,'cm_contacts.createdAt',_0xf56e('0x1d'),_0xf56e('0x1e'),'cm_contacts.UserId','\x22'+_0x48efb3+'\x22'];var _0x42823d=squel[_0xf56e('0x20')]()['into'](_0xf56e('0x22'))[_0xf56e('0x23')]([_0xf56e('0x14'),'scheduledat',_0xf56e('0x24'),_0xf56e('0x34'),_0x4f8032,_0xf56e('0x25'),_0xf56e('0x26'),_0xf56e('0x27'),_0xf56e('0x3a'),_0xf56e('0x28')],squel[_0xf56e('0x12')]()[_0xf56e('0x35')](_0x3874d4)[_0xf56e('0x15')](_0x15adb2)[_0xf56e('0x19')](_0xf56e('0x29'),null,_0xf56e('0x2a')+_0x15adb2+'.CmListId')[_0xf56e('0x19')](_0x5a46ee,null,_0x5a46ee+_0xf56e('0x16')+_0x15adb2+'.'+_0x4f8032)[_0xf56e('0x19')](_0xf1cfe,null,_0xf1cfe+_0xf56e('0x16')+_0x15adb2+'.'+_0x4f8032)[_0xf56e('0x2c')](_0x15adb2+'.CmListId\x20=\x20?',_0x3d6570)[_0xf56e('0x2c')](_0xf56e('0x2e'),NOW)[_0xf56e('0x2c')](_0xf56e('0x2f'),selectNotIn(_0x15adb2,_0x5a46ee,_0x4f8032,_0xf56e('0x22'),[_0xf56e('0x30'),_0xf56e('0x31')]))['where'](_0xf56e('0x2f'),selectNotIn(_0x15adb2,_0x5a46ee,_0x4f8032,'cm_hopper',['\x22always\x22'])))[_0xf56e('0x32')]();return _0x42823d;}function insertTzCmHopperBlack(_0x365787,_0x41a01f,_0xe721ab,_0x220971){var _0x5f445f=['cm_contacts.phone',_0xf56e('0x1b'),_0xf56e('0x1c'),_0x41a01f+'.'+_0x220971,_0xf56e('0x33'),_0xf56e('0x1d')];return squel['insert']()[_0xf56e('0x21')](_0xf56e('0x36'))[_0xf56e('0x23')]([_0xf56e('0x14'),_0xf56e('0x24'),_0xf56e('0x34'),_0x220971,'createdAt',_0xf56e('0x26')],squel[_0xf56e('0x12')]()['fields'](_0x5f445f)['from'](_0x41a01f)[_0xf56e('0x19')](_0xf56e('0x29'),null,_0xf56e('0x2a')+_0x41a01f+_0xf56e('0x2b'))['join'](_0xe721ab,null,_0xe721ab+'.id\x20=\x20'+_0x41a01f+'.'+_0x220971)['where'](_0x41a01f+_0xf56e('0x2d'),_0x365787)['where'](_0xf56e('0x2e'),NOW)[_0xf56e('0x2c')](_0xf56e('0x2f'),squel[_0xf56e('0x12')]()[_0xf56e('0x13')](_0xf56e('0x14'))[_0xf56e('0x15')](_0xf56e('0x36'))['where']('ListId\x20=\x20?',_0x365787)['where'](_0x220971+_0xf56e('0x37'),_0x41a01f+'.'+_0x220971)))[_0xf56e('0x32')]();}function insertCmContact(_0xcacb16,_0x192a36,_0x36b1c1,_0xe077c1){var _0x5b670b=_[_0xf56e('0x3b')](_[_0xf56e('0x3c')](_0xe077c1),[_0xf56e('0x34'),_0xf56e('0x3d'),_0xf56e('0x25'),'updatedAt']);return squel[_0xf56e('0x20')]()[_0xf56e('0x21')](_0xf56e('0x29'))['fromQuery'](_0x5b670b,squel[_0xf56e('0x12')]()[_0xf56e('0x35')](_0x5b670b)['from'](_0x192a36)['where']('('+_0x36b1c1[_0xf56e('0x19')](',')+_0xf56e('0x3e'),squel[_0xf56e('0x12')]()['fields'](_0x36b1c1)[_0xf56e('0x15')](_0xf56e('0x29'))[_0xf56e('0x2c')](_0xf56e('0x3f'),_0xcacb16)['where'](_0xf56e('0x40')))[_0xf56e('0x2c')](_0xf56e('0x41'),squel[_0xf56e('0x12')]()[_0xf56e('0x13')](_0xf56e('0x42'),_0xf56e('0x43'))[_0xf56e('0x15')](_0x192a36)['group'](_0x36b1c1[_0xf56e('0x19')](','))))[_0xf56e('0x32')]();}function handleStop(){logger[_0xf56e('0x44')](_0xf56e('0x45'));stopped=!![];}function handleUncaughtException(_0x36dd13){logger['error'](_0x36dd13['message']);process[_0xf56e('0x46')](0x1);}function handleError(_0xf27e2e,_0x594893){stats['errors']['push']({'name':_0x594893[_0xf56e('0x47')],'message':_0x594893[_0xf56e('0x48')],'row':_0xf27e2e});}function handleQuery(_0x3ef6e0){logger[_0xf56e('0x44')](_0x3ef6e0);return db[_0xf56e('0x49')][_0xf56e('0x4a')](_0x3ef6e0)[_0xf56e('0x4b')](function(_0x1bd827){results[_0xf56e('0x4c')](_0x1bd827);})[_0xf56e('0x4d')](function(_0x25cc5b){logger[_0xf56e('0x4e')](_0x25cc5b[_0xf56e('0x48')]);});}function updateTzCampaigns(_0x354440){return new Promise(function(_0x4c3a54,_0xf3ce28){var _0x13b3fa=squel[_0xf56e('0x12')]()[_0xf56e('0x35')]([_0xf56e('0x4f'),_0xf56e('0x50')])['from'](_0xf56e('0x51'))[_0xf56e('0x19')]('campaigns_has_cm_lists',null,_0xf56e('0x52'))[_0xf56e('0x2c')](_0xf56e('0x53')+_0x354440);db[_0xf56e('0x49')][_0xf56e('0x4a')](_0x13b3fa[_0xf56e('0x32')]())[_0xf56e('0x4b')](function(_0x194624){var _0x5b0224=[];for(var _0x12baba=0x0;_0x12baba<_0x194624[_0xf56e('0x54')];_0x12baba++){_0x5b0224[_0xf56e('0x4c')](getTimezoneData(_0x194624[_0x12baba],tmp_campaigns));}BPromise[_0xf56e('0x55')](_0x5b0224)[_0xf56e('0x56')](function(){_0x4c3a54({'val':0x1});});})[_0xf56e('0x4d')](function(_0x574aee){logger[_0xf56e('0x4e')](_0x574aee[_0xf56e('0x48')]);_0x4c3a54({'val':0x0});});});}function updateTzVoiceQueues(_0x17530d){return new Promise(function(_0x456320,_0x38e094){var _0x4ae402=squel['select']()['fields']([_0xf56e('0x57'),_0xf56e('0x58')])[_0xf56e('0x15')](_0xf56e('0x59'))[_0xf56e('0x19')](_0xf56e('0x5a'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x17530d);db['sequelize'][_0xf56e('0x4a')](_0x4ae402[_0xf56e('0x32')]())[_0xf56e('0x4b')](function(_0x2119de){var _0x354fe2=[];for(var _0xf52ad9=0x0;_0xf52ad9<_0x2119de['length'];_0xf52ad9++){_0x354fe2[_0xf56e('0x4c')](getTimezoneData(_0x2119de[_0xf52ad9],tmp_voice_queues));}BPromise[_0xf56e('0x55')](_0x354fe2)['then'](function(){_0x456320({'val':0x1});});})[_0xf56e('0x4d')](function(_0x493a01){logger['error'](_0x493a01['message']);_0x456320({'val':0x0});});});}function getTimezoneData(_0x5ac807,_0x5953e0){return new Promise(function(_0x5441b0,_0x4b5da4){var _0x124572=shared[_0xf56e('0x5b')];var _0x22c4fb=_0x124572[_0x5ac807[_0xf56e('0x5c')]];if(_['isNil'](_0x22c4fb)){_0x5441b0({'ret':0x1});}else{var _0x3ff573=_0x22c4fb['utcOffset'];var _0x498f0a=squel[_0xf56e('0x20')]()[_0xf56e('0x21')](_0x5953e0)['set']('id',_0x5ac807['id'])['set'](_0xf56e('0x5d'),_0x3ff573)[_0xf56e('0x5e')]('dialTimezone',_0x5ac807[_0xf56e('0x5c')])[_0xf56e('0x32')]();return db['sequelize']['query'](_0x498f0a)[_0xf56e('0x4b')](function(_0x3f6ed1){_0x5441b0({'ret':0x1});})[_0xf56e('0x4d')](function(_0x32bfc0){logger[_0xf56e('0x4e')](_0x32bfc0[_0xf56e('0x48')]);_0x4b5da4({'ret':0x1});});}});}function handleTZQuery(_0xcb2c61){logger[_0xf56e('0x44')](_0xcb2c61);return db[_0xf56e('0x49')][_0xf56e('0x4a')](_0xcb2c61)['spread'](function(_0xb214df){})[_0xf56e('0x4d')](function(_0x361ca8){logger[_0xf56e('0x4e')](_0x361ca8[_0xf56e('0x48')]);});}function main(_0x1fc1e8,_0x4cd630,_0x2e7ea9,_0x87f736){logger[_0xf56e('0x44')](_0xf56e('0x5f'),_0x1fc1e8,JSON[_0xf56e('0x60')](_0x4cd630));process[_0xf56e('0x61')](_0xf56e('0x62'));var _0xd2c413=_0x4cd630[_0xf56e('0x63')];var _0x1c6964=_0x4cd630[_0xf56e('0x64')];var _0x4c48d3=path[_0xf56e('0x19')](config[_0xf56e('0x65')],_0xf56e('0x66'),_0x1c6964+_0xf56e('0x67'));hasTZ=_[_0xf56e('0x3c')](_0xd2c413)['includes'](_0xf56e('0x5c'));var _0x372ac4=_[_0xf56e('0x3c')](_0xd2c413)[_0xf56e('0x19')]();logger[_0xf56e('0x44')]('header',_0x372ac4);if(hasTZ)_0x372ac4+=_0xf56e('0x68');fs[_0xf56e('0x69')](_0x4c48d3,_0x372ac4+'\x0a');Papa['parse'](fs[_0xf56e('0x6a')](_0x1fc1e8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e59e0,_0x910c2a){try{for(var _0x14c457=0x0,_0x10bdd3=[];_0x14c457<_0x5e59e0[_0xf56e('0x6b')][_0xf56e('0x54')];_0x14c457++){stats['rows']+=0x1;if(_0x5e59e0[_0xf56e('0x6c')][_0x14c457]){handleError(_0x5e59e0[_0xf56e('0x6b')][_0x14c457],_0x5e59e0[_0xf56e('0x6c')][_0x14c457]);}else{var _0x42d01f=[];for(var _0x378c0c in _0xd2c413){if(_0xd2c413['hasOwnProperty'](_0x378c0c)){if(_0x5e59e0[_0xf56e('0x6b')][_0x14c457][_0xd2c413[_0x378c0c]]){var _0x79f614=_['trim'](_0x5e59e0[_0xf56e('0x6b')][_0x14c457][_0xd2c413[_0x378c0c]]['replace'](/"/g,'\x27'));switch(_0x378c0c){case _0xf56e('0x6d'):var _0x2e496d=moment(_0x79f614,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2e496d['isValid']()){_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x79f614+'\x22');}else{_0x42d01f[_0xf56e('0x4c')](_0xf56e('0x6e'));}break;case _0xf56e('0x27'):var _0x1b3637=parseInt(_0x79f614);_0x79f614=_[_0xf56e('0x6f')](_0x1b3637)||_0x1b3637<0x0||_0x1b3637>0x4?_0x87f736?0x3:0x2:_0x1b3637;_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x79f614+'\x22');break;case'UserId':var _0x1bcc10=parseInt(_0x79f614);if(_[_0xf56e('0x70')](_0x1bcc10)&&_[_0xf56e('0x71')](_0x2e7ea9,_0x1bcc10)){_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x1bcc10+'\x22');}else{_0x42d01f[_0xf56e('0x4c')](_0xf56e('0x72'));}break;case _0xf56e('0x73'):if(isEmail(_0x79f614)){_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x79f614+'\x22');}else{_0x42d01f[_0xf56e('0x4c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2cfe64=moment(_0x79f614,_0xf56e('0x74'),!![]);if(_0x2cfe64[_0xf56e('0x75')]()){_0x10bdd3['push']('\x22'+_0x79f614+'\x22');}else{_0x42d01f[_0xf56e('0x4c')](_0xf56e('0x76'));}break;case _0xf56e('0x5c'):var _0x554634=shared[_0xf56e('0x5b')];var _0x4d991e=_0x554634[_0x79f614];if(!_['isNil'](_0x4d991e)){var _0x223f03=_0x4d991e[_0xf56e('0x77')];_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x79f614+'\x22');_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x223f03+'\x22');}break;default:_0x10bdd3[_0xf56e('0x4c')]('\x22'+_0x79f614+'\x22');}}else{switch(_0x378c0c){case _0xf56e('0x78'):case _0xf56e('0x14'):_0x42d01f[_0xf56e('0x4c')](_0x378c0c+_0xf56e('0x79'));break;default:_0x10bdd3['push']('\x22\x22');}}}}if(_0x42d01f['length']){handleError(_0x5e59e0[_0xf56e('0x6b')][_0x14c457],{'code':'SystemRow','message':_0x42d01f[_0xf56e('0x19')]()});}else{fs[_0xf56e('0x7a')](_0x4c48d3,_0x10bdd3[_0xf56e('0x19')]()+'\x0a');}_0x10bdd3=[];}if(!(stats[_0xf56e('0x7b')]%0xc8)){socket[_0xf56e('0x7c')](_0xf56e('0x7d')+_0x1c6964,stats);stats[_0xf56e('0x6c')]=[];}}if(stopped){logger['info'](_0xf56e('0x7e'));_0x910c2a[_0xf56e('0x7f')]();}}catch(_0x4126e7){handleError(_0x5e59e0[_0xf56e('0x6b')][_0x14c457],{'code':'SystemError','message':_0x4126e7[_0xf56e('0x48')]});logger['error']('step',_0x4126e7[_0xf56e('0x48')]);}},'complete':function(){try{var _0x3fa9dc=[];var _0x5dfb40=[];var _0x2eedfc=_0xf56e('0x29');if(_0x4cd630[_0xf56e('0x80')]&&_0x4cd630[_0xf56e('0x80')][_0xf56e('0x54')]){_0x2eedfc=_0xf56e('0x81')+_0x1c6964;_0x3fa9dc[_0xf56e('0x4c')](_0xf56e('0x82')+_0x2eedfc+_0xf56e('0x83'));}tmp_campaigns=_0xf56e('0x84')+_0x1c6964;tmp_voice_queues='voice_queues_'+_0x1c6964;_0x5dfb40['push'](_0xf56e('0x82')+tmp_campaigns+_0xf56e('0x85'));_0x5dfb40[_0xf56e('0x4c')](_0xf56e('0x82')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xf56e('0x86')](_0x5dfb40,handleTZQuery)['then'](function(_0xef09b3){updateTzCampaigns(_0x4cd630[_0xf56e('0x34')])[_0xf56e('0x56')](function(_0x4b1e50){updateTzVoiceQueues(_0x4cd630[_0xf56e('0x34')])[_0xf56e('0x56')](function(_0x36b0a5){var _0x4a5f79=util[_0xf56e('0xf')](_0xf56e('0x87'),_0x4c48d3,_0x2eedfc,_0x372ac4,_0x4cd630[_0xf56e('0x34')],_0x4cd630[_0xf56e('0x3d')]||null,NOW,NOW);if(_['isNil'](_0xd2c413[_0xf56e('0x6d')])){_0x4a5f79+=_0xf56e('0x88');}_0x3fa9dc[_0xf56e('0x4c')](_0x4a5f79);if(_0x4cd630[_0xf56e('0x80')]&&_0x4cd630[_0xf56e('0x80')][_0xf56e('0x54')]){_0x3fa9dc[_0xf56e('0x4c')](insertCmContact(_0x4cd630[_0xf56e('0x34')],_0x2eedfc,_0x4cd630[_0xf56e('0x80')],_0xd2c413));_0x3fa9dc['push'](_0xf56e('0x89')+_0x2eedfc+';');}if(hasTZ){_0x3fa9dc[_0xf56e('0x4c')](insertTzCmHopper(_0x4cd630[_0xf56e('0x34')],_0xf56e('0x5a'),_0xf56e('0x59'),_0xf56e('0x8a'),_0x87f736,tmp_voice_queues));_0x3fa9dc[_0xf56e('0x4c')](insertTzCmHopperBlack(_0x4cd630[_0xf56e('0x34')],_0xf56e('0x8b'),_0xf56e('0x59'),'VoiceQueueId'));_0x3fa9dc['push'](insertTzCmHopper(_0x4cd630[_0xf56e('0x34')],_0xf56e('0x8c'),_0xf56e('0x51'),_0xf56e('0x8d'),_0x87f736,tmp_campaigns));_0x3fa9dc[_0xf56e('0x4c')](insertTzCmHopperBlack(_0x4cd630['ListId'],_0xf56e('0x8e'),_0xf56e('0x51'),'CampaignId'));}else{_0x3fa9dc['push'](insertCmHopper(_0x4cd630['ListId'],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0x87f736));_0x3fa9dc[_0xf56e('0x4c')](insertCmHopperBlack(_0x4cd630[_0xf56e('0x34')],_0xf56e('0x8b'),'voice_queues',_0xf56e('0x8a')));_0x3fa9dc[_0xf56e('0x4c')](insertCmHopper(_0x4cd630['ListId'],_0xf56e('0x8c'),_0xf56e('0x51'),_0xf56e('0x8d'),_0x87f736));_0x3fa9dc[_0xf56e('0x4c')](insertCmHopperBlack(_0x4cd630[_0xf56e('0x34')],'campaigns_has_cm_blacklists',_0xf56e('0x51'),_0xf56e('0x8d')));}_0x3fa9dc[_0xf56e('0x4c')]('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x3fa9dc[_0xf56e('0x4c')](_0xf56e('0x89')+tmp_voice_queues+';');BPromise['each'](_0x3fa9dc,handleQuery)[_0xf56e('0x56')](function(_0x50b3c6){stats[_0xf56e('0x8f')]=!![];stats[_0xf56e('0x90')]=_0x4cd630['duplicates']&&_0x4cd630[_0xf56e('0x80')]['length']?results[0x2][_0xf56e('0x90')]:results[0x0]['affectedRows'];socket['emit'](_0xf56e('0x7d')+_0x1c6964,stats);fs[_0xf56e('0x91')](_0x1fc1e8);fs['unlink'](_0x4c48d3);process[_0xf56e('0x46')](0x0);})['catch'](function(_0xcf80b3){logger['error'](_0xcf80b3['message']);process[_0xf56e('0x46')](0x1);});});});});}catch(_0x52475b){logger['error']('complete',_0x52475b[_0xf56e('0x48')]);process['exit'](0x1);}},'error':function(_0x3b5e22,_0x50257a,_0x53d6f2,_0x1a65e5){throw new Error(_0x1a65e5);}});}function validate(){if(process[_0xf56e('0x92')]&&process['argv'][_0xf56e('0x54')]<0x4){throw new Error(_0xf56e('0x93'));}var _0x554b34=path[_0xf56e('0x19')](config[_0xf56e('0x65')],_0xf56e('0x66'),process['argv'][0x2]);if(!fs[_0xf56e('0x94')](_0x554b34)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2ac77b={};try{_0x2ac77b=JSON[_0xf56e('0x95')](process[_0xf56e('0x92')][0x3]);if(!_0x2ac77b['binding']){throw new Error(_0xf56e('0x96'));}if(!_0x2ac77b[_0xf56e('0x63')][_0xf56e('0x14')]){throw new Error(_0xf56e('0x97'));}if(!_0x2ac77b['binding'][_0xf56e('0x78')]){throw new Error(_0xf56e('0x98'));}var _0x300b01=0x0;if(_0x2ac77b[_0xf56e('0x63')][_0xf56e('0x3a')]){_0x300b01=0x1;}if(!_0x2ac77b[_0xf56e('0x34')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x426bef){throw new Error(_0xf56e('0x99'));}var _0x3500d6=[];try{_0x3500d6=_['map'](JSON[_0xf56e('0x95')](process[_0xf56e('0x92')][0x4]),'id');}catch(_0x20183b){logger['info']('No\x20agent\x20available');}main(_0x554b34,_0x2ac77b,_0x3500d6,_0x300b01);}validate();process['on'](_0xf56e('0x9a'),handleStop);process['on'](_0xf56e('0x9b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index e4bac18..c1cab4f 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 _0x4552=['destexten','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','Call\x20To'];(function(_0x3fc287,_0x5c3f36){var _0x33af9f=function(_0x27cfc6){while(--_0x27cfc6){_0x3fc287['push'](_0x3fc287['shift']());}};_0x33af9f(++_0x5c3f36);}(_0x4552,0x14e));var _0x2455=function(_0x4345e5,_0x2b91e2){_0x4345e5=_0x4345e5-0x0;var _0x1887c7=_0x4552[_0x4345e5];return _0x1887c7;};'use strict';exports[_0x2455('0x0')]=function(_0x4da9f2,_0x1ada6e){var _0x11f951=[{'type':_0x2455('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x4da9f2[_0x2455('0x2')]()){case'voice':switch(_0x1ada6e['toLowerCase']()){case _0x2455('0x3'):_0x11f951[_0x2455('0x4')]({'type':_0x2455('0x5'),'content':'','variableName':_0x2455('0x6')});_0x11f951['push']({'type':_0x2455('0x5'),'content':'','variableName':'calleridnum'});break;case _0x2455('0x7'):_0x11f951[_0x2455('0x4')]({'type':_0x2455('0x1'),'content':_0x2455('0x8'),'variableName':null});_0x11f951[_0x2455('0x4')]({'type':'variable','content':'','variableName':_0x2455('0x9')});break;}}return _0x11f951;};exports[_0x2455('0xa')]=function(_0x174553,_0x560b72){var _0x438e74=[];switch(_0x174553[_0x2455('0x2')]()){case _0x2455('0xb'):switch(_0x560b72[_0x2455('0x2')]()){case _0x2455('0x3'):_0x438e74=[{'type':_0x2455('0x1'),'content':_0x2455('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0xe'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0xf')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x10'),'keyType':'variable','variableName':'calleridname'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x11'),'keyType':'variable','variableName':_0x2455('0x12')},{'type':_0x2455('0xd'),'content':'','key':'Queue','keyType':_0x2455('0x5'),'variableName':_0x2455('0x6')},{'type':_0x2455('0xd'),'content':'','key':'UniqueId','keyType':_0x2455('0x5'),'variableName':_0x2455('0x13')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x14'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x15')},{'type':_0x2455('0x1'),'content':_0x2455('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x17'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x18')},{'type':'keyValue','content':'','key':_0x2455('0x19'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x9')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x2455('0x5'),'variableName':_0x2455('0x15')},{'type':'keyValue','content':'','key':_0x2455('0x1a'),'keyType':_0x2455('0x5'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x2455('0x1b'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x1c')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x1d'),'keyType':_0x2455('0x5'),'variableName':'holdtime'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x1e'),'keyType':_0x2455('0x5'),'variableName':_0x2455('0x1f')}];break;case'outbound':_0x438e74=[{'type':_0x2455('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0x2455('0x20'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x9')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x21'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x22')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x23'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x14'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x24')},{'type':_0x2455('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x25'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x26'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x27')},{'type':_0x2455('0xd'),'content':'','key':_0x2455('0x28'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x29')},{'type':'keyValue','content':'','key':_0x2455('0x2a'),'keyType':_0x2455('0x5'),'keyContent':'','variableName':_0x2455('0x2b')}];break;}}return _0x438e74;}; \ No newline at end of file +var _0x55a7=['Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Called\x20Number','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','push','variable','queue','calleridnum','destcalleridnum','getDescriptions','voice','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','Queue','UniqueId'];(function(_0x2a193f,_0x10ab8e){var _0x579e2c=function(_0x492111){while(--_0x492111){_0x2a193f['push'](_0x2a193f['shift']());}};_0x579e2c(++_0x10ab8e);}(_0x55a7,0x140));var _0x755a=function(_0x396d93,_0x48c4db){_0x396d93=_0x396d93-0x0;var _0x62af0a=_0x55a7[_0x396d93];return _0x62af0a;};'use strict';exports['getSubjects']=function(_0x2668a7,_0x495916){var _0x45430f=[{'type':_0x755a('0x0'),'content':_0x755a('0x1'),'variableName':null}];switch(_0x2668a7[_0x755a('0x2')]()){case'voice':switch(_0x495916['toLowerCase']()){case'inbound':_0x45430f[_0x755a('0x3')]({'type':_0x755a('0x4'),'content':'','variableName':_0x755a('0x5')});_0x45430f[_0x755a('0x3')]({'type':_0x755a('0x4'),'content':'','variableName':_0x755a('0x6')});break;case'outbound':_0x45430f['push']({'type':_0x755a('0x0'),'content':'Outbound\x20Call','variableName':null});_0x45430f['push']({'type':_0x755a('0x4'),'content':'','variableName':_0x755a('0x7')});break;}}return _0x45430f;};exports[_0x755a('0x8')]=function(_0x2a0afa,_0x443367){var _0x3c299b=[];switch(_0x2a0afa[_0x755a('0x2')]()){case _0x755a('0x9'):switch(_0x443367[_0x755a('0x2')]()){case'inbound':_0x3c299b=[{'type':_0x755a('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0xb'),'keyType':_0x755a('0x4'),'variableName':_0x755a('0x6')},{'type':'keyValue','content':'','key':_0x755a('0xc'),'keyType':_0x755a('0x4'),'variableName':'calleridname'},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0xd'),'keyType':'variable','variableName':'destexten'},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0xe'),'keyType':'variable','variableName':_0x755a('0x5')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0xf'),'keyType':_0x755a('0x4'),'variableName':'uniqueid'},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x10'),'keyType':_0x755a('0x4'),'variableName':'agentcalledAt'},{'type':_0x755a('0x0'),'content':_0x755a('0x11'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x755a('0x12'),'keyType':_0x755a('0x4'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x755a('0x13'),'keyType':_0x755a('0x4'),'variableName':_0x755a('0x7')},{'type':'string','content':_0x755a('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x15'),'keyType':_0x755a('0x4'),'variableName':_0x755a('0x16')},{'type':_0x755a('0xa'),'content':'','key':'Agent\x20Connect','keyType':_0x755a('0x4'),'variableName':_0x755a('0x17')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x18'),'keyType':_0x755a('0x4'),'variableName':_0x755a('0x19')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x1a'),'keyType':_0x755a('0x4'),'variableName':_0x755a('0x1b')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x1c'),'keyType':_0x755a('0x4'),'variableName':'talktime'}];break;case _0x755a('0x1d'):_0x3c299b=[{'type':_0x755a('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0x755a('0x1e'),'keyType':'variable','keyContent':'','variableName':_0x755a('0x7')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x755a('0x4'),'keyContent':'','variableName':_0x755a('0x1f')},{'type':_0x755a('0xa'),'content':'','key':'UniqueId','keyType':_0x755a('0x4'),'keyContent':'','variableName':_0x755a('0x20')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x10'),'keyType':_0x755a('0x4'),'keyContent':'','variableName':_0x755a('0x21')},{'type':'string','content':_0x755a('0x14')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x22'),'keyType':_0x755a('0x4'),'keyContent':'','variableName':_0x755a('0x23')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x24'),'keyType':'variable','keyContent':'','variableName':_0x755a('0x25')},{'type':'keyValue','content':'','key':_0x755a('0x26'),'keyType':_0x755a('0x4'),'keyContent':'','variableName':_0x755a('0x27')},{'type':_0x755a('0xa'),'content':'','key':_0x755a('0x28'),'keyType':'variable','keyContent':'','variableName':_0x755a('0x29')}];break;}}return _0x3c299b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 25611f4..431b5c5 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 _0x2285=['findOne','update','info','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null'];(function(_0x873304,_0x34db47){var _0x2ff861=function(_0x3c1d1b){while(--_0x3c1d1b){_0x873304['push'](_0x873304['shift']());}};_0x2ff861(++_0x34db47);}(_0x2285,0x82));var _0x5228=function(_0x46ed1e,_0x1a4610){_0x46ed1e=_0x46ed1e-0x0;var _0x1ed287=_0x2285[_0x46ed1e];return _0x1ed287;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x5228('0x0'))(_0x5228('0x1')),'mail':require(_0x5228('0x0'))(_0x5228('0x2')),'fax':require('../../config/logger')(_0x5228('0x3')),'sms':require('../../config/logger')(_0x5228('0x4')),'chat':require(_0x5228('0x0'))('chat-interactions'),'whatsapp':require(_0x5228('0x0'))(_0x5228('0x5'))};function getInteractionId(_0x5b58cd,_0x51296b,_0x81054c){if(_0x5b58cd&&_0x5b58cd[_['upperFirst'](_0x81054c)+_0x5228('0x6')]){return _0x5b58cd[_[_0x5228('0x7')](_0x81054c)+'InteractionId'];}else if(_0x5b58cd&&_0x5b58cd['id']){return _0x5b58cd['id'];}else if(_0x51296b&&_0x51296b['id']){return _0x51296b['id'];}else{return _0x5228('0x8');}}function log(_0x557d65,_0x304de5,_0x3868bb,_0x5c89f8,_0x459c47,_0x92706e){loggers[_0x459c47[_0x5228('0x9')]()][_0x557d65](_0x5228('0xa'),_0x92706e[_0x5228('0xb')](),_0x304de5?_0x304de5['id']:null,_0x304de5?_0x304de5[_0x5228('0xc')]:null,_0x304de5?_0x304de5[_0x5228('0xd')]:null,getInteractionId(_0x3868bb,_0x5c89f8,_0x459c47),_0x3868bb?JSON['stringify'](_0x3868bb):_0x5228('0xe'));}function updateUser(_0x1c540a,_0xaf4e56,_0x886598,_0x4fda42,_0x58b75a){db[_['upperFirst'](_0x4fda42)+'Interaction'][_0x5228('0xf')]({'where':{'id':getInteractionId(_0xaf4e56,_0x886598,_0x4fda42)}})['then'](function(_0x2f14c0){if(_0x2f14c0){return _0x2f14c0[_0x5228('0x10')]({'UserId':_0x1c540a?_0x1c540a['id']:null});}})['then'](function(_0xa57563){if(_0xa57563){log(_0x5228('0x11'),_0x1c540a,_0xaf4e56,_0x886598,_0x4fda42,_0x58b75a);}})['catch'](function(){log(_0x5228('0x12'),_0x1c540a,_0xaf4e56,_0x886598,_0x4fda42,_0x58b75a);});}exports[_0x5228('0x13')]=function(_0x464739,_0x647c86){return function(_0x3f3a64,_0x193329,_0x41c43d){var _0x1c27c5=_0x3f3a64[_0x5228('0x14')];var _0xdb354e={};var _0x6afe60=_0x3f3a64[_0x5228('0x15')];if(_0xdb354e){_0xdb354e=_[_0x5228('0x16')](_0x3f3a64[_0x5228('0x17')]);_0xdb354e=_[_0x5228('0x18')](_0xdb354e,[_0x5228('0x17'),_0x5228('0x19'),_0x5228('0x1a'),_0x5228('0x1b'),_0x5228('0x1c')]);}updateUser(_0x1c27c5,_0xdb354e,_0x6afe60,_0x464739,_0x647c86);_0x41c43d(null);};}; \ No newline at end of file +var _0xa140=['stringify','null','Interaction','findOne','then','update','info','error','user','query','clone','omit','body','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toUpperCase','role'];(function(_0x129a32,_0x263de4){var _0x35a482=function(_0x1d61a4){while(--_0x1d61a4){_0x129a32['push'](_0x129a32['shift']());}};_0x35a482(++_0x263de4);}(_0xa140,0x9a));var _0x0a14=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xa140[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x0a14('0x0'));var db=require(_0x0a14('0x1'))['db'];var loggers={'openchannel':require(_0x0a14('0x2'))(_0x0a14('0x3')),'mail':require(_0x0a14('0x2'))(_0x0a14('0x4')),'fax':require('../../config/logger')(_0x0a14('0x5')),'sms':require('../../config/logger')(_0x0a14('0x6')),'chat':require(_0x0a14('0x2'))(_0x0a14('0x7')),'whatsapp':require(_0x0a14('0x2'))(_0x0a14('0x8'))};function getInteractionId(_0x272159,_0x2b8697,_0x18496d){if(_0x272159&&_0x272159[_[_0x0a14('0x9')](_0x18496d)+_0x0a14('0xa')]){return _0x272159[_[_0x0a14('0x9')](_0x18496d)+'InteractionId'];}else if(_0x272159&&_0x272159['id']){return _0x272159['id'];}else if(_0x2b8697&&_0x2b8697['id']){return _0x2b8697['id'];}else{return _0x0a14('0xb');}}function log(_0x19375c,_0x521937,_0x28342d,_0x5c0bc4,_0x489814,_0x327d01){loggers[_0x489814['toLowerCase']()][_0x19375c]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x327d01[_0x0a14('0xc')](),_0x521937?_0x521937['id']:null,_0x521937?_0x521937['name']:null,_0x521937?_0x521937[_0x0a14('0xd')]:null,getInteractionId(_0x28342d,_0x5c0bc4,_0x489814),_0x28342d?JSON[_0x0a14('0xe')](_0x28342d):_0x0a14('0xf'));}function updateUser(_0x1f927a,_0x138d44,_0x3ce82d,_0x41c6ec,_0x3a1f1e){db[_[_0x0a14('0x9')](_0x41c6ec)+_0x0a14('0x10')][_0x0a14('0x11')]({'where':{'id':getInteractionId(_0x138d44,_0x3ce82d,_0x41c6ec)}})[_0x0a14('0x12')](function(_0x3c8969){if(_0x3c8969){return _0x3c8969[_0x0a14('0x13')]({'UserId':_0x1f927a?_0x1f927a['id']:null});}})[_0x0a14('0x12')](function(_0x38ae3f){if(_0x38ae3f){log(_0x0a14('0x14'),_0x1f927a,_0x138d44,_0x3ce82d,_0x41c6ec,_0x3a1f1e);}})['catch'](function(){log(_0x0a14('0x15'),_0x1f927a,_0x138d44,_0x3ce82d,_0x41c6ec,_0x3a1f1e);});}exports['tracked']=function(_0x5165d6,_0x57b671){return function(_0x5b8a1a,_0x303fb3,_0x583f07){var _0x2c492d=_0x5b8a1a[_0x0a14('0x16')];var _0x6a69fd={};var _0x39a6ae=_0x5b8a1a[_0x0a14('0x17')];if(_0x6a69fd){_0x6a69fd=_[_0x0a14('0x18')](_0x5b8a1a['body']);_0x6a69fd=_[_0x0a14('0x19')](_0x6a69fd,[_0x0a14('0x1a'),'html','phone',_0x0a14('0x1b'),'mobile']);}updateUser(_0x2c492d,_0x6a69fd,_0x39a6ae,_0x5165d6,_0x57b671);_0x583f07(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 6a61c6a..0c0de98 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 _0x8d84=['update','utf8','final','parse','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s'];(function(_0x5ce24f,_0x15260a){var _0x330eac=function(_0x16457f){while(--_0x16457f){_0x5ce24f['push'](_0x5ce24f['shift']());}};_0x330eac(++_0x15260a);}(_0x8d84,0x114));var _0x48d8=function(_0x2fb2dc,_0x3471da){_0x2fb2dc=_0x2fb2dc-0x0;var _0xdc9483=_0x8d84[_0x2fb2dc];return _0xdc9483;};'use strict';var crypto=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x48d8('0x2'));function getValueFromLicense(_0x273f5f,_0x5822df){if(_0x273f5f&&_0x5822df){if(_0x5822df['data1']&&_0x5822df[_0x48d8('0x3')]){var _0x801d1=_0x5822df[_0x48d8('0x4')];var _0x522e1c=_0x5822df['license'];var _0x57bfe1=_0x801d1[_0x48d8('0x5')]('-')[0x4];var _0x4d161f=_0x801d1[_0x48d8('0x5')]('-')[0x0];var _0x149bdf=crypto[_0x48d8('0x6')](_0x48d8('0x7'),util[_0x48d8('0x8')](_0x48d8('0x9'),_0x57bfe1,_0x801d1,_0x4d161f));var _0x4a286b=_0x149bdf[_0x48d8('0xa')](_0x522e1c,'base64',_0x48d8('0xb'));_0x4a286b+=_0x149bdf[_0x48d8('0xc')](_0x48d8('0xb'));var _0x44d302=JSON[_0x48d8('0xd')](_0x4a286b);return _0x44d302[_0x48d8('0xe')](_0x273f5f)?_0x44d302[_0x273f5f]:null;}}return null;}function isLimit(_0x15021e,_0x46188c,_0x4020fb,_0x49b02c){var _0x1a14b2=_0x46188c;return compose()['use'](function(_0x319dd3,_0x5c938b,_0x3e621d){return db['License'][_0x48d8('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x48d8('0x10')](function(_0x4c16ce){var _0x2046c9=getValueFromLicense(_0x15021e,_0x4c16ce);return _0x2046c9?_0x2046c9:_0x1a14b2;})[_0x48d8('0x10')](function(_0x24d776){_0x1a14b2=_0x24d776;return _0x4020fb[_0x48d8('0x11')](_0x49b02c);})[_0x48d8('0x10')](function(_0x29b8f9){if(_0x29b8f9>=_0x1a14b2){return _0x5c938b[_0x48d8('0x12')](0x193)[_0x48d8('0x13')]({'message':util[_0x48d8('0x8')](_0x48d8('0x14'),_0x15021e)});}_0x3e621d();})['catch'](function(_0x4040f9){_0x3e621d(_0x4040f9);});});}function isUserLimit(){return isLimit(_0x48d8('0x15'),0x1,db[_0x48d8('0x16')],{'where':{'$or':[{'role':_0x48d8('0x17')},{'role':_0x48d8('0x18')}]}});}exports[_0x48d8('0x19')]=isUserLimit; \ No newline at end of file +var _0xbd47=['../../mysqldb','../../config/environment','license','createDecipher','format','%s:%s:%s','base64','final','hasOwnProperty','use','License','then','json','catch','users','User','admin','isUserLimit','crypto','util','composable-middleware'];(function(_0x30602a,_0x50926e){var _0x157554=function(_0x4e8258){while(--_0x4e8258){_0x30602a['push'](_0x30602a['shift']());}};_0x157554(++_0x50926e);}(_0xbd47,0x1a1));var _0x7bd4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xbd47[_0x32f7d7];return _0x133d09;};'use strict';var crypto=require(_0x7bd4('0x0'));var util=require(_0x7bd4('0x1'));var compose=require(_0x7bd4('0x2'));var db=require(_0x7bd4('0x3'))['db'];var config=require(_0x7bd4('0x4'));function getValueFromLicense(_0x31da1d,_0x4b8c97){if(_0x31da1d&&_0x4b8c97){if(_0x4b8c97['data1']&&_0x4b8c97[_0x7bd4('0x5')]){var _0x1d3501=_0x4b8c97['data1'];var _0x818e30=_0x4b8c97[_0x7bd4('0x5')];var _0x329094=_0x1d3501['split']('-')[0x4];var _0x5f69e1=_0x1d3501['split']('-')[0x0];var _0xbf86ff=crypto[_0x7bd4('0x6')]('aes-256-ctr',util[_0x7bd4('0x7')](_0x7bd4('0x8'),_0x329094,_0x1d3501,_0x5f69e1));var _0x3a9ef3=_0xbf86ff['update'](_0x818e30,_0x7bd4('0x9'),'utf8');_0x3a9ef3+=_0xbf86ff[_0x7bd4('0xa')]('utf8');var _0x4d3505=JSON['parse'](_0x3a9ef3);return _0x4d3505[_0x7bd4('0xb')](_0x31da1d)?_0x4d3505[_0x31da1d]:null;}}return null;}function isLimit(_0x86a5ee,_0x2100ec,_0x1a12dd,_0x423ca0){var _0x3ec961=_0x2100ec;return compose()[_0x7bd4('0xc')](function(_0x582ccc,_0x30f983,_0x331064){return db[_0x7bd4('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x7bd4('0xe')](function(_0x2c573e){var _0x23b899=getValueFromLicense(_0x86a5ee,_0x2c573e);return _0x23b899?_0x23b899:_0x3ec961;})[_0x7bd4('0xe')](function(_0x61b072){_0x3ec961=_0x61b072;return _0x1a12dd['count'](_0x423ca0);})[_0x7bd4('0xe')](function(_0x1a24b1){if(_0x1a24b1>=_0x3ec961){return _0x30f983['status'](0x193)[_0x7bd4('0xf')]({'message':util[_0x7bd4('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x86a5ee)});}_0x331064();})[_0x7bd4('0x10')](function(_0x26c43e){_0x331064(_0x26c43e);});});}function isUserLimit(){return isLimit(_0x7bd4('0x11'),0x1,db[_0x7bd4('0x12')],{'where':{'$or':[{'role':_0x7bd4('0x13')},{'role':'user'}]}});}exports[_0x7bd4('0x14')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index e46916e..4c1bc71 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 _0x458b=['add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$lte','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','moment','[$or]','replace','[$and]','split','length','slice','forEach','shift','match','filter','map','push','buildExpression','operator','$eq','$between','value','includes','$gt'];(function(_0x43a0bb,_0x11c9a4){var _0x125462=function(_0x56cd77){while(--_0x56cd77){_0x43a0bb['push'](_0x43a0bb['shift']());}};_0x125462(++_0x11c9a4);}(_0x458b,0x1c8));var _0xb458=function(_0x389abb,_0x241f9f){_0x389abb=_0x389abb-0x0;var _0x36d5b0=_0x458b[_0x389abb];return _0x36d5b0;};'use strict';var _=require(_0xb458('0x0'));var moment=require(_0xb458('0x1'));exports['parseSearch']=function(_0x11d95d){var _0x268fc1={'conditions':[]};_0x268fc1['sqlOperator']=_['startsWith'](_0x11d95d,_0xb458('0x2'))?'or':'and';var _0x4e5ed5=_0x11d95d[_0xb458('0x3')](_0xb458('0x4'),'')[_0xb458('0x3')](_0xb458('0x2'),'')[_0xb458('0x5')]('||');for(var _0x2680b0=0x0;_0x2680b0<_0x4e5ed5[_0xb458('0x6')];_0x2680b0++){var _0x14fa97=_0x4e5ed5[_0x2680b0][_0xb458('0x5')](':=');var _0x115a21=_0x14fa97[0x0];var _0x48bed6=_0x14fa97[_0xb458('0x7')](0x1);_0x48bed6[_0xb458('0x8')](function(_0x125699){var _0x2b7367=_0x125699[_0xb458('0x5')]('[')[_0xb458('0x9')]();var _0x3eff94=_0x125699[_0xb458('0xa')](/\[(.*?)\]/g);_0x3eff94[_0xb458('0x8')](function(_0x253886){var _0x3b8725=_0x253886[_0xb458('0x5')]('[')[_0xb458('0xb')](function(_0x1e184f){return _0x1e184f['indexOf'](']')>-0x1;})[_0xb458('0xc')](function(_0x82808f){return _0x82808f[_0xb458('0x5')](']')[0x0];})[0x0];_0x268fc1['conditions'][_0xb458('0xd')]({'field':_0x115a21,'operator':_0x2b7367,'value':_0x3b8725});});});}return _0x268fc1;};exports[_0xb458('0xe')]=function(_0x14fd8c,_0x2fbbf6,_0x3cdb47){var _0x2c1c3d={};if(_0x2fbbf6==='DATE'){if(_0x3cdb47[_0xb458('0xf')]===_0xb458('0x10')){_0x3cdb47[_0xb458('0xf')]=_0xb458('0x11');_0x3cdb47['value']+=','+_0x3cdb47[_0xb458('0x12')];}else if(_[_0xb458('0x13')]([_0xb458('0x14'),'$lte'],_0x3cdb47[_0xb458('0xf')])){_0x3cdb47[_0xb458('0x12')]=moment(_0x3cdb47[_0xb458('0x12')])[_0xb458('0x15')](0x1,'days')[_0xb458('0x16')](_0xb458('0x17'));}}if(_0x3cdb47[_0xb458('0x18')]){_0x2fbbf6=_0x3cdb47[_0xb458('0x18')];_0x2c1c3d[_0xb458('0x19')]=_0xb458('0x1a')+_0x14fd8c+'.'+_0x3cdb47[_0xb458('0x1b')]+_0xb458('0x1c')+_0x3cdb47['castTo']+')\x20'+parseOperator(_0x3cdb47[_0xb458('0xf')]);}else{_0x2c1c3d[_0xb458('0x19')]=_0x14fd8c+'.'+_0x3cdb47['field']+'\x20'+parseOperator(_0x3cdb47[_0xb458('0xf')]);}if(_[_0xb458('0x13')](['$ne',_0xb458('0x1d')],_0x3cdb47['operator']))_0x2c1c3d[_0xb458('0x19')]='('+_0x2c1c3d['text']+_0xb458('0x1e')+_0x14fd8c+'.'+_0x3cdb47[_0xb458('0x1b')]+_0xb458('0x1f');_0x2c1c3d[_0xb458('0x12')]=parseValue(_0x2fbbf6,_0x3cdb47['operator'],_0x3cdb47[_0xb458('0x12')]);return _0x2c1c3d;};function parseOperator(_0x2a5e8a){var _0xf5fa18;switch(_0x2a5e8a){case _0xb458('0x20'):_0xf5fa18=_0xb458('0x21');break;case _0xb458('0x1d'):_0xf5fa18=_0xb458('0x22');break;case _0xb458('0x10'):_0xf5fa18=_0xb458('0x23');break;case _0xb458('0x24'):_0xf5fa18='<>\x20?';break;case'$substring':case _0xb458('0x25'):case _0xb458('0x26'):_0xf5fa18='LIKE\x20?';break;case _0xb458('0x27'):_0xf5fa18=_0xb458('0x28');break;case _0xb458('0x14'):_0xf5fa18=_0xb458('0x29');break;case _0xb458('0x2a'):_0xf5fa18='<=\x20?';break;case _0xb458('0x2b'):_0xf5fa18=_0xb458('0x2c');break;case _0xb458('0x11'):_0xf5fa18=_0xb458('0x2d');break;}return _0xf5fa18;}function parseValue(_0x3fb1ae,_0x2d722f,_0x4bea82){var _0x5dae72={'start':undefined,'end':undefined};switch(_0x2d722f){case _0xb458('0x20'):case'$notIn':_0x5dae72[_0xb458('0x2e')]=_0x4bea82[_0xb458('0x5')](',');break;case _0xb458('0x2f'):_0x5dae72[_0xb458('0x2e')]='%'+_0x4bea82+'%';break;case _0xb458('0x25'):_0x5dae72[_0xb458('0x2e')]=_0x4bea82+'%';break;case _0xb458('0x26'):_0x5dae72['start']='%'+_0x4bea82;break;case _0xb458('0x11'):var _0x14e90e=_0x4bea82[_0xb458('0x5')](',');var _0x4bea82=_0x14e90e[_0xb458('0x9')]();var _0x5b95ac=_0x14e90e[_0xb458('0x30')]();if(_0x3fb1ae==='DATE'){_0x4bea82=moment(_0x4bea82)[_0xb458('0x31')](0x0,!![])[_0xb458('0x16')]();_0x5b95ac=moment(_0x5b95ac)[_0xb458('0x31')](0x0,!![])[_0xb458('0x15')](0x17,_0xb458('0x32'))[_0xb458('0x15')](0x3b,_0xb458('0x33'))['add'](0x3b,_0xb458('0x34'))[_0xb458('0x16')]();}_0x5dae72={'start':_0x4bea82,'end':_0x5b95ac};break;default:_0x5dae72[_0xb458('0x2e')]=_0x4bea82;break;}return _0x5dae72;} \ No newline at end of file +var _0x6eed=['add','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','$gt','YYYY-MM-DD','castTo','text','field','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$substring','utcOffset','format'];(function(_0x3ee8fc,_0x25babf){var _0x525fb6=function(_0x14e4b2){while(--_0x14e4b2){_0x3ee8fc['push'](_0x3ee8fc['shift']());}};_0x525fb6(++_0x25babf);}(_0x6eed,0x11d));var _0xd6ee=function(_0x587c18,_0x2eb0db){_0x587c18=_0x587c18-0x0;var _0x390c77=_0x6eed[_0x587c18];return _0x390c77;};'use strict';var _=require(_0xd6ee('0x0'));var moment=require(_0xd6ee('0x1'));exports[_0xd6ee('0x2')]=function(_0x47501f){var _0x29730b={'conditions':[]};_0x29730b[_0xd6ee('0x3')]=_[_0xd6ee('0x4')](_0x47501f,_0xd6ee('0x5'))?'or':_0xd6ee('0x6');var _0x442b67=_0x47501f[_0xd6ee('0x7')]('[$and]','')[_0xd6ee('0x7')](_0xd6ee('0x5'),'')[_0xd6ee('0x8')]('||');for(var _0x17f696=0x0;_0x17f696<_0x442b67[_0xd6ee('0x9')];_0x17f696++){var _0x490e8d=_0x442b67[_0x17f696]['split'](':=');var _0x3f05f5=_0x490e8d[0x0];var _0x131423=_0x490e8d[_0xd6ee('0xa')](0x1);_0x131423[_0xd6ee('0xb')](function(_0x1ddd29){var _0x272de6=_0x1ddd29[_0xd6ee('0x8')]('[')[_0xd6ee('0xc')]();var _0x22b7ec=_0x1ddd29['match'](/\[(.*?)\]/g);_0x22b7ec[_0xd6ee('0xb')](function(_0x5343a1){var _0x141717=_0x5343a1[_0xd6ee('0x8')]('[')[_0xd6ee('0xd')](function(_0x5dfc12){return _0x5dfc12[_0xd6ee('0xe')](']')>-0x1;})[_0xd6ee('0xf')](function(_0x3b6c67){return _0x3b6c67['split'](']')[0x0];})[0x0];_0x29730b[_0xd6ee('0x10')]['push']({'field':_0x3f05f5,'operator':_0x272de6,'value':_0x141717});});});}return _0x29730b;};exports[_0xd6ee('0x11')]=function(_0x278f27,_0x5bd201,_0x5a5f2a){var _0xd0d479={};if(_0x5bd201===_0xd6ee('0x12')){if(_0x5a5f2a[_0xd6ee('0x13')]===_0xd6ee('0x14')){_0x5a5f2a[_0xd6ee('0x13')]=_0xd6ee('0x15');_0x5a5f2a[_0xd6ee('0x16')]+=','+_0x5a5f2a[_0xd6ee('0x16')];}else if(_['includes']([_0xd6ee('0x17'),'$lte'],_0x5a5f2a['operator'])){_0x5a5f2a[_0xd6ee('0x16')]=moment(_0x5a5f2a[_0xd6ee('0x16')])['add'](0x1,'days')['format'](_0xd6ee('0x18'));}}if(_0x5a5f2a[_0xd6ee('0x19')]){_0x5bd201=_0x5a5f2a[_0xd6ee('0x19')];_0xd0d479[_0xd6ee('0x1a')]='CAST('+_0x278f27+'.'+_0x5a5f2a[_0xd6ee('0x1b')]+'\x20AS\x20'+_0x5a5f2a['castTo']+')\x20'+parseOperator(_0x5a5f2a[_0xd6ee('0x13')]);}else{_0xd0d479[_0xd6ee('0x1a')]=_0x278f27+'.'+_0x5a5f2a['field']+'\x20'+parseOperator(_0x5a5f2a[_0xd6ee('0x13')]);}if(_['includes'](['$ne',_0xd6ee('0x1c')],_0x5a5f2a[_0xd6ee('0x13')]))_0xd0d479['text']='('+_0xd0d479[_0xd6ee('0x1a')]+_0xd6ee('0x1d')+_0x278f27+'.'+_0x5a5f2a[_0xd6ee('0x1b')]+'\x20IS\x20NULL)';_0xd0d479[_0xd6ee('0x16')]=parseValue(_0x5bd201,_0x5a5f2a[_0xd6ee('0x13')],_0x5a5f2a[_0xd6ee('0x16')]);return _0xd0d479;};function parseOperator(_0x2a196b){var _0x2338a6;switch(_0x2a196b){case _0xd6ee('0x1e'):_0x2338a6='IN\x20?';break;case _0xd6ee('0x1c'):_0x2338a6=_0xd6ee('0x1f');break;case _0xd6ee('0x14'):_0x2338a6=_0xd6ee('0x20');break;case'$ne':_0x2338a6=_0xd6ee('0x21');break;case'$substring':case _0xd6ee('0x22'):case _0xd6ee('0x23'):_0x2338a6=_0xd6ee('0x24');break;case _0xd6ee('0x25'):_0x2338a6='<\x20?';break;case _0xd6ee('0x17'):_0x2338a6=_0xd6ee('0x26');break;case'$lte':_0x2338a6='<=\x20?';break;case _0xd6ee('0x27'):_0x2338a6='>=\x20?';break;case _0xd6ee('0x15'):_0x2338a6=_0xd6ee('0x28');break;}return _0x2338a6;}function parseValue(_0x441327,_0x4f26e4,_0x4c6066){var _0x30fc78={'start':undefined,'end':undefined};switch(_0x4f26e4){case _0xd6ee('0x1e'):case _0xd6ee('0x1c'):_0x30fc78['start']=_0x4c6066[_0xd6ee('0x8')](',');break;case _0xd6ee('0x29'):_0x30fc78['start']='%'+_0x4c6066+'%';break;case _0xd6ee('0x22'):_0x30fc78['start']=_0x4c6066+'%';break;case _0xd6ee('0x23'):_0x30fc78['start']='%'+_0x4c6066;break;case _0xd6ee('0x15'):var _0x1e6480=_0x4c6066[_0xd6ee('0x8')](',');var _0x4c6066=_0x1e6480[_0xd6ee('0xc')]();var _0x1489a2=_0x1e6480['pop']();if(_0x441327===_0xd6ee('0x12')){_0x4c6066=moment(_0x4c6066)[_0xd6ee('0x2a')](0x0,!![])[_0xd6ee('0x2b')]();_0x1489a2=moment(_0x1489a2)[_0xd6ee('0x2a')](0x0,!![])[_0xd6ee('0x2c')](0x17,_0xd6ee('0x2d'))[_0xd6ee('0x2c')](0x3b,_0xd6ee('0x2e'))[_0xd6ee('0x2c')](0x3b,'seconds')[_0xd6ee('0x2b')]();}_0x30fc78={'start':_0x4c6066,'end':_0x1489a2};break;default:_0x30fc78['start']=_0x4c6066;break;}return _0x30fc78;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d8430c0..108183e 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 _0x81bd=['lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','format','utc','$lte','YYYY-MM-DD','subtract','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','unsigned','DESC','col','ASC','omit','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','join','getOptions','query','$id','map','name','intersection','model','attributes','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x81bd,0x7c));var _0xd81b=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x81bd[_0x1bb80c];return _0x368f16;};'use strict';var _=require(_0xd81b('0x0'));var sequelize=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2337b1){var _0x2d27cb=['ne'];try{var _0x2ec03a=JSON[_0xd81b('0x3')](_0x2337b1);var _0x54e096=Object[_0xd81b('0x4')](_0x2ec03a)[0x0];return _0x2d27cb[_0xd81b('0x5')](_0x54e096);}catch(_0x1b6cfe){return![];}}function getOperatorValue(_0x4d8e7e){var _0x42a0aa=JSON[_0xd81b('0x3')](_0x4d8e7e);var _0x1f3f2c=Object['keys'](_0x42a0aa)[0x0];var _0x5e14e8=_0x42a0aa[_0x1f3f2c];return{['$'+_0x1f3f2c]:_0x5e14e8};}exports[_0xd81b('0x6')]=function(_0x5468d5){var _0x223515=null;if(_0x5468d5){_0x223515=_0x5468d5[_0xd81b('0x7')](',');}return _0x223515;};exports[_0xd81b('0x8')]=function(_0x86dab6,_0x17fba4){var _0x1ff60f={};if(!_[_0xd81b('0x9')](_0x86dab6)){_[_0xd81b('0xa')](_0x86dab6,function(_0x2090e1,_0x23c789){try{if(_0x17fba4){var _0x215b92=_[_0xd81b('0xb')](_0x17fba4,{'name':_0x23c789})||{};if(hasSequelizeOperator(_0x2090e1)){_0x1ff60f[_0x23c789]=getOperatorValue(_0x2090e1);}else if(_0x215b92[_0xd81b('0xc')]==='DATE'&&_[_0xd81b('0xd')](_0x2090e1)){var _0x57f71d=JSON[_0xd81b('0x3')](_0x2090e1);var _0xe75568={'$gte':moment(moment(_0x57f71d['$gte'])[_0xd81b('0xe')]('YYYY-MM-DD'))[_0xd81b('0xf')]()[_0xd81b('0xe')](),'$lte':moment(moment(_0x57f71d[_0xd81b('0x10')])[_0xd81b('0xe')](_0xd81b('0x11')))['utc']()[_0xd81b('0x12')](0x1,'s')[_0xd81b('0xe')]()};_0x1ff60f[_0x23c789]=_0xe75568;}else if(_0x215b92['name']===_0xd81b('0x13')){_0x1ff60f[_0x23c789]=_0x2090e1;}else{_0x1ff60f[_0x23c789]=_[_0xd81b('0x14')](_0x2090e1)?_0x2090e1:JSON[_0xd81b('0x3')](_0x2090e1);}}else{_0x1ff60f[_0x23c789]=_[_0xd81b('0x14')](_0x2090e1)?_0x2090e1:JSON[_0xd81b('0x3')](_0x2090e1);}}catch(_0xc49b8d){_0x1ff60f[_0x23c789]=_0x2090e1[_0xd81b('0x7')](',');}});}return _0x1ff60f;};exports[_0xd81b('0x15')]=function(_0x1c34c5){_0x1c34c5=parseInt(_0x1c34c5,0xa);if(!_0x1c34c5||_0x1c34c5<0x0){_0x1c34c5=LIMIT_VALUE;}return _0x1c34c5;};exports[_0xd81b('0x16')]=function(_0x1ff3c6){_0x1ff3c6=parseInt(_0x1ff3c6,0xa);if(!_0x1ff3c6||_0x1ff3c6<0x0){_0x1ff3c6=0x0;}return _0x1ff3c6;};exports[_0xd81b('0x17')]=function(_0xfa27e0){var _0x3518f0,_0x156894=null;if(_0xfa27e0){_0x3518f0=_0xfa27e0[_0xd81b('0x7')](',');_0x156894=_['map'](_0x3518f0,function(_0x4d566e){if(_0x4d566e[_0xd81b('0x18')]('-')===0x0){return[_0x4d566e===_0xd81b('0x19')?sequelize[_0xd81b('0x1a')](sequelize['col'](_0xd81b('0x19')),_0xd81b('0x1b')):_0x4d566e['substr'](0x1),_0xd81b('0x1c')];}else{return[_0x4d566e===_0xd81b('0x19')?sequelize[_0xd81b('0x1a')](sequelize[_0xd81b('0x1d')](_0xd81b('0x19')),_0xd81b('0x1b')):_0x4d566e,_0xd81b('0x1e')];}});}return _0x156894;};exports[_0xd81b('0x1f')]=function(_0x341aec,_0x212c4e){if(_[_0xd81b('0x9')](_0x341aec)){return _0x341aec;}if(_[_0xd81b('0x14')](_0x341aec)){for(var _0x596389=0x0;_0x596389<_0x341aec[_0xd81b('0x20')];_0x596389+=0x1){_0x341aec[_0x596389]=this[_0xd81b('0x1f')](_0x341aec[_0x596389],_0x212c4e);}return _0x341aec;}if(!_[_0xd81b('0x21')](_0x341aec)){return _0x341aec;}if(_[_0xd81b('0x22')](_0x212c4e)){_0x212c4e=[_0x212c4e];}if(!_[_0xd81b('0x14')](_0x212c4e)){return _0x341aec;}for(var _0x2d0d02=0x0;_0x2d0d02<_0x212c4e[_0xd81b('0x20')];_0x2d0d02+=0x1){_[_0xd81b('0x23')](_0x341aec,_0x212c4e[_0x2d0d02]);}for(var _0x10a561 in _0x341aec){if(_0x341aec['hasOwnProperty'](_0x10a561)){_0x341aec[_0x10a561]=this[_0xd81b('0x1f')](_0x341aec[_0x10a561],_0x212c4e);}}return _0x341aec;};exports['isNumeric']=function(_0x5c8aee){return _0x5c8aee[_0xd81b('0x24')](RegExp(_0xd81b('0x25')))?!![]:![];};exports['isEmail']=function(_0x481454){return _0x481454[_0xd81b('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xd81b('0x26')]=function(_0x1b1434){var _0x289f54=[];_0x1b1434[_0xd81b('0x7')](/[ ,]+/)[_0xd81b('0x27')](function(_0x5527ed){_0x5527ed=_0x5527ed[_0xd81b('0x28')](/([^:]")"+/g,'$1');_0x5527ed='+'+_0x5527ed+'*';var _0x26f629=/[ `!@#$%^&*()_\-?~]/;if(_0x5527ed['match'](_0x26f629))_0x5527ed='\x22'+_0x5527ed+'\x22';_0x289f54['push'](_0x5527ed);});return _0x289f54[_0xd81b('0x29')]('\x20');};exports[_0xd81b('0x2a')]=function(_0x50472a,_0x50ce25,_0x5317b2){var _0x322991={},_0x3ead68={};if(_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x2c')]){_0x50ce25[_0xd81b('0x2b')]['id']=_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x2c')];delete _0x50ce25['query'][_0xd81b('0x2c')];}_0x322991['model']=_[_0xd81b('0x2d')](_0x50472a,_0xd81b('0x2e'));_0x322991[_0xd81b('0x2b')]=_[_0xd81b('0x4')](_0x50ce25[_0xd81b('0x2b')]);_0x322991[_0xd81b('0x8')]=_[_0xd81b('0x2f')](_0x322991[_0xd81b('0x30')],_0x322991[_0xd81b('0x2b')]);_0x3ead68[_0xd81b('0x31')]=_[_0xd81b('0x2f')](_0x322991[_0xd81b('0x30')],this[_0xd81b('0x6')](_0x50ce25['query']['fields']));_0x3ead68[_0xd81b('0x31')]=_0x3ead68[_0xd81b('0x31')][_0xd81b('0x20')]?_0x3ead68['attributes']:_0x322991[_0xd81b('0x30')];if(!_0x50ce25[_0xd81b('0x2b')]['hasOwnProperty'](_0xd81b('0x32'))){_0x3ead68[_0xd81b('0x15')]=this['limit'](_0x50ce25[_0xd81b('0x2b')]['limit']);_0x3ead68[_0xd81b('0x16')]=this[_0xd81b('0x16')](_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x16')]);}_0x3ead68['order']=this[_0xd81b('0x17')](_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x17')]);_0x3ead68[_0xd81b('0x33')]=this[_0xd81b('0x8')](_[_0xd81b('0x34')](_0x50ce25[_0xd81b('0x2b')],_0x322991['filters']),_0x50472a);if(_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')]){var _0x5185fe=_0x50472a;var _0x5065a0=_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')];if(typeof _0x5065a0===_0xd81b('0x36')){_0x5185fe=_[_0xd81b('0x35')](_0x50472a,function(_0x29bddd){return _['includes'](_0x5065a0[_0xd81b('0x37')],_0x29bddd[_0xd81b('0x2e')]);});_0x5065a0=_0x5065a0[_0xd81b('0x38')];}_0x3ead68[_0xd81b('0x33')]=_[_0xd81b('0x39')](_0x3ead68[_0xd81b('0x33')],{'$or':_[_0xd81b('0x2d')](_0x5185fe,function(_0x486f0d){if(_0x486f0d[_0xd81b('0xc')]!==_0xd81b('0x3a')){if(_0x5317b2){return sequelize[_0xd81b('0x33')](sequelize['fn']('lower',sequelize[_0xd81b('0x1d')](_0x486f0d[_0xd81b('0x2e')])),{'$like':sequelize['fn'](_0xd81b('0x3b'),'%'+_0x50ce25[_0xd81b('0x2b')][_0xd81b('0x35')]+'%')});}else{var _0x194d2a={};_0x194d2a[_0x486f0d[_0xd81b('0x2e')]]={'$like':'%'+_0x50ce25[_0xd81b('0x2b')]['filter']+'%'};return _0x194d2a;}}})});}_0x3ead68=_['merge']({},_0x3ead68,_0x50ce25[_0xd81b('0x3c')]);return _0x3ead68;}; \ No newline at end of file +var _0x5075=['subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','getOptions','query','$id','model','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','filter','object','columns','value','merge','type','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','filters','forOwn','find','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte'];(function(_0x2bd8fe,_0x3d3a95){var _0x31744c=function(_0x510d4b){while(--_0x510d4b){_0x2bd8fe['push'](_0x2bd8fe['shift']());}};_0x31744c(++_0x3d3a95);}(_0x5075,0x73));var _0x5507=function(_0x4c79aa,_0x456fcd){_0x4c79aa=_0x4c79aa-0x0;var _0x28e73a=_0x5075[_0x4c79aa];return _0x28e73a;};'use strict';var _=require(_0x5507('0x0'));var sequelize=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1a552a){var _0x3ec62f=['ne'];try{var _0x2b444e=JSON[_0x5507('0x3')](_0x1a552a);var _0x518ca7=Object[_0x5507('0x4')](_0x2b444e)[0x0];return _0x3ec62f[_0x5507('0x5')](_0x518ca7);}catch(_0x8fb8a3){return![];}}function getOperatorValue(_0x54267f){var _0x5b6d7f=JSON[_0x5507('0x3')](_0x54267f);var _0x773559=Object['keys'](_0x5b6d7f)[0x0];var _0x42c232=_0x5b6d7f[_0x773559];return{['$'+_0x773559]:_0x42c232};}exports[_0x5507('0x6')]=function(_0xbf4b50){var _0x504e05=null;if(_0xbf4b50){_0x504e05=_0xbf4b50['split'](',');}return _0x504e05;};exports[_0x5507('0x7')]=function(_0x441bdc,_0xbbb0fc){var _0x36c9eb={};if(!_['isEmpty'](_0x441bdc)){_[_0x5507('0x8')](_0x441bdc,function(_0x1a6792,_0x55520e){try{if(_0xbbb0fc){var _0x18601c=_[_0x5507('0x9')](_0xbbb0fc,{'name':_0x55520e})||{};if(hasSequelizeOperator(_0x1a6792)){_0x36c9eb[_0x55520e]=getOperatorValue(_0x1a6792);}else if(_0x18601c['type']===_0x5507('0xa')&&_[_0x5507('0xb')](_0x1a6792)){var _0x32c872=JSON[_0x5507('0x3')](_0x1a6792);var _0x13b60a={'$gte':moment(moment(_0x32c872[_0x5507('0xc')])['format'](_0x5507('0xd')))[_0x5507('0xe')]()[_0x5507('0xf')](),'$lte':moment(moment(_0x32c872[_0x5507('0x10')])['format'](_0x5507('0xd')))[_0x5507('0xe')]()[_0x5507('0x11')](0x1,'s')[_0x5507('0xf')]()};_0x36c9eb[_0x55520e]=_0x13b60a;}else if(_0x18601c[_0x5507('0x12')]===_0x5507('0x13')){_0x36c9eb[_0x55520e]=_0x1a6792;}else{_0x36c9eb[_0x55520e]=_[_0x5507('0x14')](_0x1a6792)?_0x1a6792:JSON[_0x5507('0x3')](_0x1a6792);}}else{_0x36c9eb[_0x55520e]=_[_0x5507('0x14')](_0x1a6792)?_0x1a6792:JSON[_0x5507('0x3')](_0x1a6792);}}catch(_0x233b6a){_0x36c9eb[_0x55520e]=_0x1a6792[_0x5507('0x15')](',');}});}return _0x36c9eb;};exports[_0x5507('0x16')]=function(_0x5ad6d7){_0x5ad6d7=parseInt(_0x5ad6d7,0xa);if(!_0x5ad6d7||_0x5ad6d7<0x0){_0x5ad6d7=LIMIT_VALUE;}return _0x5ad6d7;};exports[_0x5507('0x17')]=function(_0x276a81){_0x276a81=parseInt(_0x276a81,0xa);if(!_0x276a81||_0x276a81<0x0){_0x276a81=0x0;}return _0x276a81;};exports[_0x5507('0x18')]=function(_0x193eda){var _0x54f473,_0x1dc53e=null;if(_0x193eda){_0x54f473=_0x193eda[_0x5507('0x15')](',');_0x1dc53e=_[_0x5507('0x19')](_0x54f473,function(_0x3ca1f7){if(_0x3ca1f7[_0x5507('0x1a')]('-')===0x0){return[_0x3ca1f7===_0x5507('0x1b')?sequelize['cast'](sequelize[_0x5507('0x1c')](_0x5507('0x1b')),_0x5507('0x1d')):_0x3ca1f7[_0x5507('0x1e')](0x1),_0x5507('0x1f')];}else{return[_0x3ca1f7===_0x5507('0x1b')?sequelize[_0x5507('0x20')](sequelize[_0x5507('0x1c')](_0x5507('0x1b')),_0x5507('0x1d')):_0x3ca1f7,_0x5507('0x21')];}});}return _0x1dc53e;};exports[_0x5507('0x22')]=function(_0x164ac7,_0x2ee6ed){if(_[_0x5507('0x23')](_0x164ac7)){return _0x164ac7;}if(_['isArray'](_0x164ac7)){for(var _0x4e8906=0x0;_0x4e8906<_0x164ac7['length'];_0x4e8906+=0x1){_0x164ac7[_0x4e8906]=this[_0x5507('0x22')](_0x164ac7[_0x4e8906],_0x2ee6ed);}return _0x164ac7;}if(!_['isObject'](_0x164ac7)){return _0x164ac7;}if(_[_0x5507('0x24')](_0x2ee6ed)){_0x2ee6ed=[_0x2ee6ed];}if(!_[_0x5507('0x14')](_0x2ee6ed)){return _0x164ac7;}for(var _0x4beb0a=0x0;_0x4beb0a<_0x2ee6ed['length'];_0x4beb0a+=0x1){_[_0x5507('0x25')](_0x164ac7,_0x2ee6ed[_0x4beb0a]);}for(var _0x1a18d0 in _0x164ac7){if(_0x164ac7['hasOwnProperty'](_0x1a18d0)){_0x164ac7[_0x1a18d0]=this[_0x5507('0x22')](_0x164ac7[_0x1a18d0],_0x2ee6ed);}}return _0x164ac7;};exports[_0x5507('0x26')]=function(_0x85d383){return _0x85d383[_0x5507('0x27')](RegExp(_0x5507('0x28')))?!![]:![];};exports[_0x5507('0x29')]=function(_0x55e889){return _0x55e889[_0x5507('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x5507('0x2a')]=function(_0x106b11){var _0x38f0f5=[];_0x106b11[_0x5507('0x15')](/[ ,]+/)['forEach'](function(_0x51e692){_0x51e692=_0x51e692[_0x5507('0x2b')](/([^:]")"+/g,'$1');_0x51e692='+'+_0x51e692+'*';var _0x37c364=/[ `!@#$%^&*()_\-?~]/;if(_0x51e692[_0x5507('0x27')](_0x37c364))_0x51e692='\x22'+_0x51e692+'\x22';_0x38f0f5[_0x5507('0x2c')](_0x51e692);});return _0x38f0f5['join']('\x20');};exports[_0x5507('0x2d')]=function(_0x13b6e5,_0xab91bc,_0x3fe39a){var _0x3cf04d={},_0x2074a={};if(_0xab91bc[_0x5507('0x2e')][_0x5507('0x2f')]){_0xab91bc['query']['id']=_0xab91bc[_0x5507('0x2e')][_0x5507('0x2f')];delete _0xab91bc[_0x5507('0x2e')]['$id'];}_0x3cf04d['model']=_[_0x5507('0x19')](_0x13b6e5,_0x5507('0x12'));_0x3cf04d[_0x5507('0x2e')]=_[_0x5507('0x4')](_0xab91bc[_0x5507('0x2e')]);_0x3cf04d['filters']=_['intersection'](_0x3cf04d[_0x5507('0x30')],_0x3cf04d[_0x5507('0x2e')]);_0x2074a[_0x5507('0x31')]=_[_0x5507('0x32')](_0x3cf04d['model'],this['fields'](_0xab91bc[_0x5507('0x2e')]['fields']));_0x2074a[_0x5507('0x31')]=_0x2074a[_0x5507('0x31')][_0x5507('0x33')]?_0x2074a[_0x5507('0x31')]:_0x3cf04d[_0x5507('0x30')];if(!_0xab91bc[_0x5507('0x2e')][_0x5507('0x34')](_0x5507('0x35'))){_0x2074a[_0x5507('0x16')]=this[_0x5507('0x16')](_0xab91bc['query']['limit']);_0x2074a['offset']=this['offset'](_0xab91bc[_0x5507('0x2e')][_0x5507('0x17')]);}_0x2074a[_0x5507('0x36')]=this[_0x5507('0x18')](_0xab91bc[_0x5507('0x2e')][_0x5507('0x18')]);_0x2074a[_0x5507('0x37')]=this[_0x5507('0x7')](_[_0x5507('0x38')](_0xab91bc[_0x5507('0x2e')],_0x3cf04d[_0x5507('0x7')]),_0x13b6e5);if(_0xab91bc[_0x5507('0x2e')][_0x5507('0x39')]){var _0x4418de=_0x13b6e5;var _0x4fe79b=_0xab91bc['query']['filter'];if(typeof _0x4fe79b===_0x5507('0x3a')){_0x4418de=_[_0x5507('0x39')](_0x13b6e5,function(_0x417022){return _[_0x5507('0x5')](_0x4fe79b[_0x5507('0x3b')],_0x417022[_0x5507('0x12')]);});_0x4fe79b=_0x4fe79b[_0x5507('0x3c')];}_0x2074a[_0x5507('0x37')]=_[_0x5507('0x3d')](_0x2074a[_0x5507('0x37')],{'$or':_[_0x5507('0x19')](_0x4418de,function(_0x192a00){if(_0x192a00[_0x5507('0x3e')]!==_0x5507('0x3f')){if(_0x3fe39a){return sequelize[_0x5507('0x37')](sequelize['fn'](_0x5507('0x40'),sequelize[_0x5507('0x1c')](_0x192a00[_0x5507('0x12')])),{'$like':sequelize['fn'](_0x5507('0x40'),'%'+_0xab91bc['query'][_0x5507('0x39')]+'%')});}else{var _0x113f74={};_0x113f74[_0x192a00['name']]={'$like':'%'+_0xab91bc['query'][_0x5507('0x39')]+'%'};return _0x113f74;}}})});}_0x2074a=_[_0x5507('0x3d')]({},_0x2074a,_0xab91bc[_0x5507('0x41')]);return _0x2074a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 159f555..a90dbfa 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(_0x519ea7,_0x26a415){var _0x2b5043=function(_0x180324){while(--_0x180324){_0x519ea7['push'](_0x519ea7['shift']());}};_0x2b5043(++_0x26a415);}(_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 _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index bbfc977..5f2a448 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 _0xf3f8=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','win32','utf8','replace','macAddress'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0xf3f8,0x169));var _0x8f3f=function(_0xe17656,_0x310796){_0xe17656=_0xe17656-0x0;var _0x1b6340=_0xf3f8[_0xe17656];return _0x1b6340;};'use strict';var _=require(_0x8f3f('0x0'));var os=require('os');var crypto=require(_0x8f3f('0x1'));var machine=require(_0x8f3f('0x2'));var exec=require(_0x8f3f('0x3'))[_0x8f3f('0x4')];var config=require(_0x8f3f('0x5'));function getInterfaces(){var _0xf0a229=[];var _0x4222e8=os[_0x8f3f('0x6')]();var _0x4453f3=_[_0x8f3f('0x7')](_[_0x8f3f('0x8')](_0x4222e8));for(var _0x5957e2=0x0;_0x5957e2<_0x4453f3['length'];_0x5957e2++){var _0x406bb6=_0x4222e8[_0x4453f3[_0x5957e2]]['filter'](function(_0x147bc3){return _0x147bc3['family']==='IPv4'&&_0x147bc3[_0x8f3f('0x9')]===![];});_0xf0a229=_0xf0a229['concat'](_0x406bb6);}return _0xf0a229;}function getFirstInterface(){var _0x2b3bae=_['head'](getInterfaces());return{'macAddress':_0x2b3bae&&_0x2b3bae['mac']?_0x2b3bae[_0x8f3f('0xa')]:_0x8f3f('0xb'),'ipAddress':_0x2b3bae&&_0x2b3bae[_0x8f3f('0xc')]?_0x2b3bae['address']:_0x8f3f('0xd')};}exports[_0x8f3f('0xe')]=getFirstInterface;function getCPUhash(){var _0x3942e2=_[_0x8f3f('0x7')](os[_0x8f3f('0xf')]()['map'](function(_0x5e955b){return _0x5e955b[_0x8f3f('0x10')];}))[_0x8f3f('0x11')](':');return crypto[_0x8f3f('0x12')](_0x8f3f('0x13'))[_0x8f3f('0x14')](_0x3942e2)[_0x8f3f('0x15')](_0x8f3f('0x16'));}exports['getUuid']=function(){var _0x48b9f4=os[_0x8f3f('0x17')]();var _0x4fc522=/[0-9a-f-]{36}/;if(config[_0x8f3f('0x18')]&&_0x4fc522['test'](config['licenseToken'])){return config[_0x8f3f('0x18')];}else if(_0x48b9f4===_0x8f3f('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x8f3f('0x1a')})[_0x8f3f('0x1b')]('\x0d\x0a','');}else{var _0x12d8e8=getFirstInterface();var _0x53a1ad=getCPUhash();var _0x44cc2c=_0x53a1ad+'|'+os['hostname']()+'|'+_0x12d8e8[_0x8f3f('0x1c')]+'|'+_0x12d8e8['ipAddress'];var _0x521a81=crypto[_0x8f3f('0x12')](_0x8f3f('0x13'))[_0x8f3f('0x14')](_0x44cc2c)[_0x8f3f('0x15')](_0x8f3f('0x16'));return _0x521a81[_0x8f3f('0x1d')](0x0,0x8)+'-'+_0x521a81[_0x8f3f('0x1d')](0x8,0xc)+'-'+_0x521a81[_0x8f3f('0x1d')](0xc,0x10)+'-'+_0x521a81['substring'](0x10,0x14)+'-'+_0x521a81[_0x8f3f('0x1d')](0x14);}}; \ No newline at end of file +var _0xfc25=['digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','lodash','crypto','execSync','length','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','update'];(function(_0x3014ce,_0x155a5d){var _0x507649=function(_0x1f8c4d){while(--_0x1f8c4d){_0x3014ce['push'](_0x3014ce['shift']());}};_0x507649(++_0x155a5d);}(_0xfc25,0x156));var _0x5fc2=function(_0x2ecb25,_0x16bbfc){_0x2ecb25=_0x2ecb25-0x0;var _0x5afa71=_0xfc25[_0x2ecb25];return _0x5afa71;};'use strict';var _=require(_0x5fc2('0x0'));var os=require('os');var crypto=require(_0x5fc2('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x5fc2('0x2')];var config=require('../environment');function getInterfaces(){var _0x210ed1=[];var _0x3b43de=os['networkInterfaces']();var _0xf8b94c=_['orderBy'](_['keys'](_0x3b43de));for(var _0x466a59=0x0;_0x466a59<_0xf8b94c[_0x5fc2('0x3')];_0x466a59++){var _0x4bf38d=_0x3b43de[_0xf8b94c[_0x466a59]][_0x5fc2('0x4')](function(_0x15d100){return _0x15d100[_0x5fc2('0x5')]===_0x5fc2('0x6')&&_0x15d100[_0x5fc2('0x7')]===![];});_0x210ed1=_0x210ed1[_0x5fc2('0x8')](_0x4bf38d);}return _0x210ed1;}function getFirstInterface(){var _0x2002ea=_['head'](getInterfaces());return{'macAddress':_0x2002ea&&_0x2002ea['mac']?_0x2002ea[_0x5fc2('0x9')]:_0x5fc2('0xa'),'ipAddress':_0x2002ea&&_0x2002ea[_0x5fc2('0xb')]?_0x2002ea['address']:_0x5fc2('0xc')};}exports[_0x5fc2('0xd')]=getFirstInterface;function getCPUhash(){var _0x3390eb=_[_0x5fc2('0xe')](os[_0x5fc2('0xf')]()[_0x5fc2('0x10')](function(_0x121aeb){return _0x121aeb[_0x5fc2('0x11')];}))[_0x5fc2('0x12')](':');return crypto[_0x5fc2('0x13')]('md5')[_0x5fc2('0x14')](_0x3390eb)[_0x5fc2('0x15')](_0x5fc2('0x16'));}exports[_0x5fc2('0x17')]=function(){var _0x37fbf4=os[_0x5fc2('0x18')]();var _0x288eb6=/[0-9a-f-]{36}/;if(config[_0x5fc2('0x19')]&&_0x288eb6['test'](config['licenseToken'])){return config[_0x5fc2('0x19')];}else if(_0x37fbf4===_0x5fc2('0x1a')){return exec(_0x5fc2('0x1b'),{'encoding':_0x5fc2('0x1c')})[_0x5fc2('0x1d')]('\x0d\x0a','');}else{var _0x1ff05c=getFirstInterface();var _0x8c0af5=getCPUhash();var _0x338077=_0x8c0af5+'|'+os[_0x5fc2('0x1e')]()+'|'+_0x1ff05c['macAddress']+'|'+_0x1ff05c[_0x5fc2('0x1f')];var _0x4e763d=crypto[_0x5fc2('0x13')]('md5')[_0x5fc2('0x14')](_0x338077)['digest'](_0x5fc2('0x16'));return _0x4e763d[_0x5fc2('0x20')](0x0,0x8)+'-'+_0x4e763d[_0x5fc2('0x20')](0x8,0xc)+'-'+_0x4e763d[_0x5fc2('0x20')](0xc,0x10)+'-'+_0x4e763d[_0x5fc2('0x20')](0x10,0x14)+'-'+_0x4e763d[_0x5fc2('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ee77373..255fc72 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 _0xef4b=['format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com'];(function(_0x7b4399,_0x3927df){var _0x4136b6=function(_0x21a50d){while(--_0x21a50d){_0x7b4399['push'](_0x7b4399['shift']());}};_0x4136b6(++_0x3927df);}(_0xef4b,0xb5));var _0xbef4=function(_0x38e730,_0x2e63b6){_0x38e730=_0x38e730-0x0;var _0x29b82e=_0xef4b[_0x38e730];return _0x29b82e;};'use strict';var util=require(_0xbef4('0x0'));var moment=require(_0xbef4('0x1'));var rp=require('request-promise');var BPromise=require(_0xbef4('0x2'));var pkginfo=require(_0xbef4('0x3'))(module,'version');var db=require(_0xbef4('0x4'))['db'];var encryptor=require(_0xbef4('0x5'));var hardware=require(_0xbef4('0x6'));var logger=require('../logger')(_0xbef4('0x7'));var HOST=_0xbef4('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x336d80){return new BPromise(function(_0x4c9f59,_0x1ccf48){var _0x1166e6=util[_0xbef4('0x9')](_0xbef4('0xa'),HOST,_0x336d80,module[_0xbef4('0xb')]['version']);if(oldToken){_0x1166e6=util[_0xbef4('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x336d80,module[_0xbef4('0xb')]['version'],oldToken);}var _0x5282a2={'uri':_0x1166e6,'method':_0xbef4('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x5282a2)[_0xbef4('0xd')](function(_0x1c30eb){_0x4c9f59(_0x1c30eb);})[_0xbef4('0xe')](function(_0xa39ba1){_0x1ccf48(_0xa39ba1);});});}function manageLicense(_0x5e391a,_0x34ea2f){var _0x3311f8=_0x34ea2f[_0xbef4('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3311f8[_0xbef4('0x10')]!==_0x5e391a&&!_0x3311f8[_0xbef4('0x11')]){oldToken=_0x3311f8[_0xbef4('0x10')];}httpRequest(_0x5e391a)[_0xbef4('0xd')](function(_0x32c865){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x32c865[_0xbef4('0x12')]){isOldTokenSent=![];if(!_0x3311f8['license']&&_0x3311f8[_0xbef4('0x7')]!=_0x32c865['license']||_0x3311f8[_0xbef4('0x7')]&&_0x3311f8[_0xbef4('0x11')]){logger['info'](_0xbef4('0x13'));}if(_0x3311f8[_0xbef4('0x7')]&&!_0x3311f8[_0xbef4('0x11')]&&_0x3311f8[_0xbef4('0x7')]!=_0x32c865[_0xbef4('0x7')]){logger[_0xbef4('0x14')](_0xbef4('0x15'));}if(_0x3311f8[_0xbef4('0x7')]&&!_0x3311f8[_0xbef4('0x11')]&&_0x3311f8[_0xbef4('0x7')]==_0x32c865[_0xbef4('0x7')]){return _0x34ea2f;}return _0x34ea2f[_0xbef4('0x16')]({'data1':_0x5e391a,'data2':null,'license':_0x32c865[_0xbef4('0x7')]});}else{if(_0x32c865[_0xbef4('0x7')]||_0x3311f8['license']){if(!_0x3311f8[_0xbef4('0x11')]){if(_0x3311f8['data1']==_0x5e391a){GRAY_PERIOD_REASON=_0xbef4('0x17');logger['info'](_0xbef4('0x18'));}else{GRAY_PERIOD_REASON=_0xbef4('0x19');logger[_0xbef4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3311f8[_0xbef4('0x10')],_0x5e391a);}logger[_0xbef4('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x34ea2f[_0xbef4('0x16')]({'data2':encryptor[_0xbef4('0x1a')](moment()['format'](_0xbef4('0x1b')))});}else{if(moment()[_0xbef4('0x1c')](encryptor['decryptString'](_0x3311f8[_0xbef4('0x11')]),_0xbef4('0x1d'))>DAYS){logger[_0xbef4('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0xbef4('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x34ea2f[_0xbef4('0x16')]({'data1':_0x5e391a,'data2':null,'license':null});}}}else{if(_0x3311f8[_0xbef4('0x10')]!=_0x5e391a){logger[_0xbef4('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3311f8[_0xbef4('0x10')],_0x5e391a);return _0x34ea2f[_0xbef4('0x16')]({'data1':_0x5e391a,'data2':null,'license':null});}}}return _0x34ea2f;})['then'](function(_0x572858){_0x34ea2f=_0x572858;})[_0xbef4('0xe')](function(_0x4fe61a){logger[_0xbef4('0x1e')](_0x4fe61a[_0xbef4('0x1f')]);})[_0xbef4('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xbef4('0x21')](),_0x34ea2f);},TIME);});}function defaultLicense(){var _0x3147b5=hardware[_0xbef4('0x21')]();if(_0x3147b5){return db[_0xbef4('0x22')][_0xbef4('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3147b5}})[_0xbef4('0x24')](function(_0x1b7c36,_0x4ccb2c){logger[_0xbef4('0x14')](_0xbef4('0x25'),_0x3147b5);manageLicense(_0x3147b5,_0x1b7c36);})[_0xbef4('0xe')](function(_0x575020){logger[_0xbef4('0x1e')](_0x575020['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x0fd1=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','diff','decryptString','days','YYYY-MM-DD\x20HH:mm','update','finally','getUuid','License','findOrCreate','spread','error','message','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x525181,_0x21b1d3){var _0x213ac3=function(_0x1cc1e7){while(--_0x1cc1e7){_0x525181['push'](_0x525181['shift']());}};_0x213ac3(++_0x21b1d3);}(_0x0fd1,0x198));var _0x10fd=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0fd1[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x10fd('0x0'));var BPromise=require(_0x10fd('0x1'));var pkginfo=require(_0x10fd('0x2'))(module,_0x10fd('0x3'));var db=require(_0x10fd('0x4'))['db'];var encryptor=require(_0x10fd('0x5'));var hardware=require(_0x10fd('0x6'));var logger=require(_0x10fd('0x7'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1e6d68){return new BPromise(function(_0xd5a06e,_0x560d77){var _0xd722ab=util[_0x10fd('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x1e6d68,module[_0x10fd('0x9')][_0x10fd('0x3')]);if(oldToken){_0xd722ab=util['format'](_0x10fd('0xa'),HOST,_0x1e6d68,module[_0x10fd('0x9')][_0x10fd('0x3')],oldToken);}var _0x28aa49={'uri':_0xd722ab,'method':_0x10fd('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x28aa49)[_0x10fd('0xc')](function(_0x3266c1){_0xd5a06e(_0x3266c1);})[_0x10fd('0xd')](function(_0x2fa2ce){_0x560d77(_0x2fa2ce);});});}function manageLicense(_0x4f4cd7,_0x28b42a){var _0xdf663d=_0x28b42a[_0x10fd('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0xdf663d['data1']!==_0x4f4cd7&&!_0xdf663d[_0x10fd('0xf')]){oldToken=_0xdf663d[_0x10fd('0x10')];}httpRequest(_0x4f4cd7)[_0x10fd('0xc')](function(_0x26d959){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x26d959['active']){isOldTokenSent=![];if(!_0xdf663d[_0x10fd('0x11')]&&_0xdf663d['license']!=_0x26d959[_0x10fd('0x11')]||_0xdf663d[_0x10fd('0x11')]&&_0xdf663d[_0x10fd('0xf')]){logger[_0x10fd('0x12')](_0x10fd('0x13'));}if(_0xdf663d[_0x10fd('0x11')]&&!_0xdf663d[_0x10fd('0xf')]&&_0xdf663d['license']!=_0x26d959[_0x10fd('0x11')]){logger[_0x10fd('0x12')](_0x10fd('0x14'));}if(_0xdf663d['license']&&!_0xdf663d['data2']&&_0xdf663d['license']==_0x26d959[_0x10fd('0x11')]){return _0x28b42a;}return _0x28b42a['update']({'data1':_0x4f4cd7,'data2':null,'license':_0x26d959[_0x10fd('0x11')]});}else{if(_0x26d959[_0x10fd('0x11')]||_0xdf663d[_0x10fd('0x11')]){if(!_0xdf663d[_0x10fd('0xf')]){if(_0xdf663d[_0x10fd('0x10')]==_0x4f4cd7){GRAY_PERIOD_REASON=_0x10fd('0x15');logger[_0x10fd('0x12')](_0x10fd('0x16'));}else{GRAY_PERIOD_REASON=_0x10fd('0x17');logger[_0x10fd('0x12')](_0x10fd('0x18'),_0xdf663d[_0x10fd('0x10')],_0x4f4cd7);}logger[_0x10fd('0x12')](_0x10fd('0x19'),GRAY_PERIOD_REASON[_0x10fd('0x1a')](),moment()[_0x10fd('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x28b42a['update']({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x10fd('0x1b')](encryptor[_0x10fd('0x1c')](_0xdf663d[_0x10fd('0xf')]),_0x10fd('0x1d'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x10fd('0x8')](_0x10fd('0x1e')));isOldTokenSent=![];return _0x28b42a[_0x10fd('0x1f')]({'data1':_0x4f4cd7,'data2':null,'license':null});}}}else{if(_0xdf663d[_0x10fd('0x10')]!=_0x4f4cd7){logger[_0x10fd('0x12')](_0x10fd('0x18'),_0xdf663d[_0x10fd('0x10')],_0x4f4cd7);return _0x28b42a['update']({'data1':_0x4f4cd7,'data2':null,'license':null});}}}return _0x28b42a;})[_0x10fd('0xc')](function(_0x3c139c){_0x28b42a=_0x3c139c;})[_0x10fd('0xd')](function(_0x1a12eb){logger['error'](_0x1a12eb['message']);})[_0x10fd('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x10fd('0x21')](),_0x28b42a);},TIME);});}function defaultLicense(){var _0x3dbe31=hardware[_0x10fd('0x21')]();if(_0x3dbe31){return db[_0x10fd('0x22')][_0x10fd('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x3dbe31}})[_0x10fd('0x24')](function(_0x357f5d,_0x593428){logger[_0x10fd('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3dbe31);manageLicense(_0x3dbe31,_0x357f5d);})[_0x10fd('0xd')](function(_0x1255f6){logger[_0x10fd('0x25')](_0x1255f6[_0x10fd('0x26')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index edab48e..0d8913e 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 _0x273b=['add','days','changed','message','User','role','sequelize','COUNT','col','count','telephone','users','telephones','forEach','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','getUuid','License','defaults','then','catch','uuid','data1','license','split','decryptString','format','parse','demo','machineUuid','gray','deadline'];(function(_0x360bd3,_0x386767){var _0x22b47c=function(_0x531a11){while(--_0x531a11){_0x360bd3['push'](_0x360bd3['shift']());}};_0x22b47c(++_0x386767);}(_0x273b,0x148));var _0xb273=function(_0x1d0c7b,_0x14619){_0x1d0c7b=_0x1d0c7b-0x0;var _0x4ea487=_0x273b[_0x1d0c7b];return _0x4ea487;};'use strict';var util=require(_0xb273('0x0'));var _=require('lodash');var moment=require(_0xb273('0x1'));var BPromise=require(_0xb273('0x2'));var hardware=require(_0xb273('0x3'));var encryptor=require(_0xb273('0x4'));var db=require(_0xb273('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb273('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb273('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xb273('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x37caf5){return new BPromise(function(_0x554b85,_0x391873){return db[_0xb273('0x9')]['find'](_[_0xb273('0xa')](_0x37caf5,{'raw':!![],'where':{'id':0x1}}))[_0xb273('0xb')](function(_0x3eb18f){return checkLicense(_0x3eb18f,null);})[_0xb273('0xb')](function(_0x50f86b){_0x554b85(_0x50f86b);return;})[_0xb273('0xc')](function(_0x5704d0){_0x391873(_0x5704d0);});});}function checkLicense(_0x143661,_0x2d63b5){if(!_0x143661){demoLicense[_0xb273('0xd')]=_0x143661[_0xb273('0xe')];return demoLicense;}try{var _0x337981=_0x2d63b5||_0x143661[_0xb273('0xf')];if(_['isEmpty'](_0x337981)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x559e9c=_0x143661[_0xb273('0xe')];var _0x33cf7c=_0x143661['data2'];var _0x52c498=_0x559e9c[_0xb273('0x10')]('-')[0x4];var _0x55b369=_0x559e9c[_0xb273('0x10')]('-')[0x0];var _0x830932=encryptor[_0xb273('0x11')](_0x337981,util[_0xb273('0x12')]('%s:%s:%s',_0x52c498,_0x559e9c,_0x55b369));var _0x3ef593=JSON[_0xb273('0x13')](_0x830932);_0x3ef593[_0xb273('0x14')]=![];_0x3ef593[_0xb273('0xd')]=_0x559e9c;_0x3ef593[_0xb273('0x15')]=hardware[_0xb273('0x8')]();if(_0x33cf7c){var _0x164a0b=encryptor[_0xb273('0x11')](_0x33cf7c);_0x3ef593[_0xb273('0x16')]=_0x164a0b;_0x3ef593[_0xb273('0x17')]=moment(_0x164a0b)[_0xb273('0x18')](0x7,_0xb273('0x19'))['format']();_0x3ef593['grayReason']=_0x3ef593[_0xb273('0xd')]!=_0x3ef593[_0xb273('0x15')]?_0xb273('0x1a'):'disabled';}return _0x3ef593;}catch(_0x251d30){breakingLicense[_0xb273('0xd')]=_0x143661[_0xb273('0xe')];breakingLicense[_0xb273('0x1b')]=_0x251d30['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x12bfc4,_0x1cb7ea){getLicense()[_0xb273('0xb')](function(_0x414a0d){return db[_0xb273('0x1c')]['findAll']({'attributes':[_0xb273('0x1d'),[db[_0xb273('0x1e')]['fn'](_0xb273('0x1f'),db[_0xb273('0x1e')][_0xb273('0x20')](_0xb273('0x1d'))),_0xb273('0x21')]],'group':_0xb273('0x1d'),'where':{'role':{'$or':['admin','user',_0xb273('0x22')]}},'raw':!![]})[_0xb273('0xb')](function(_0x4acedd){var _0xe82dea={'user':_0x414a0d[_0xb273('0x23')]||0x0,'telephone':_0x414a0d[_0xb273('0x24')]||0x0};_0x4acedd[_0xb273('0x25')](function(_0x3f2dfd){var _0x44732c=_0x3f2dfd[_0xb273('0x1d')]===_0xb273('0x26')?_0xb273('0x27'):_0x3f2dfd[_0xb273('0x1d')];_0xe82dea[_0x44732c]-=_0x3f2dfd[_0xb273('0x21')];if(_0xe82dea[_0x44732c]<0x0)_0xe82dea[_0x44732c]=0x0;});_0x12bfc4(_0xe82dea);return;});})['catch'](function(_0x4420a4){_0x1cb7ea(_0x4420a4);});});}function checkUserLimits(_0x320890){return new BPromise(function(_0x3fcebe,_0x40d3e9){getLimits()[_0xb273('0xb')](function(_0x1c4473){var _0x3b6b5e=_[_0xb273('0x28')](_[_0xb273('0x29')](_0x320890,'role'),[_0xb273('0x26'),_0xb273('0x27'),_0xb273('0x22')]);var _0xd713f4=(_0x3b6b5e[_0xb273('0x26')]||0x0)+(_0x3b6b5e[_0xb273('0x27')]||0x0);var _0x40a13a=_0x3b6b5e[_0xb273('0x22')]||0x0;if(_0xd713f4>_0x1c4473[_0xb273('0x27')])return _0x40d3e9('License\x20limit\x20reached\x20for\x20users');if(_0x40a13a>_0x1c4473['telephone'])return _0x40d3e9(_0xb273('0x2a'));return _0x3fcebe();})['catch'](function(_0x1cc395){_0x40d3e9(_0x1cc395);});});}module[_0xb273('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3fcc=['disabled','User','sequelize','col','role','count','user','telephone','users','forEach','admin','countBy','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','split','decryptString','%s:%s:%s','parse','demo','machineUuid','deadline','add','days'];(function(_0x44898c,_0x13ce31){var _0x53ccf6=function(_0x422fec){while(--_0x422fec){_0x44898c['push'](_0x44898c['shift']());}};_0x53ccf6(++_0x13ce31);}(_0x3fcc,0xd5));var _0xc3fc=function(_0x3fe273,_0x4db627){_0x3fe273=_0x3fe273-0x0;var _0x3b0948=_0x3fcc[_0x3fe273];return _0x3b0948;};'use strict';var util=require('util');var _=require(_0xc3fc('0x0'));var moment=require(_0xc3fc('0x1'));var BPromise=require(_0xc3fc('0x2'));var hardware=require(_0xc3fc('0x3'));var encryptor=require(_0xc3fc('0x4'));var db=require(_0xc3fc('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc3fc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xc3fc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc3fc('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc3fc('0x8'),'machineUuid':hardware[_0xc3fc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4e3d19){return new BPromise(function(_0x86db82,_0x1cb4ac){return db[_0xc3fc('0x9')][_0xc3fc('0xa')](_[_0xc3fc('0xb')](_0x4e3d19,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x206f41){return checkLicense(_0x206f41,null);})[_0xc3fc('0xc')](function(_0x3dc791){_0x86db82(_0x3dc791);return;})[_0xc3fc('0xd')](function(_0x2aa6db){_0x1cb4ac(_0x2aa6db);});});}function checkLicense(_0x18dde5,_0x59bb21){if(!_0x18dde5){demoLicense[_0xc3fc('0xe')]=_0x18dde5[_0xc3fc('0xf')];return demoLicense;}try{var _0x494c25=_0x59bb21||_0x18dde5[_0xc3fc('0x10')];if(_[_0xc3fc('0x11')](_0x494c25)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x22af80=_0x18dde5[_0xc3fc('0xf')];var _0x1a0a23=_0x18dde5['data2'];var _0x5b6663=_0x22af80[_0xc3fc('0x12')]('-')[0x4];var _0x6a33bd=_0x22af80[_0xc3fc('0x12')]('-')[0x0];var _0x4b1f3c=encryptor[_0xc3fc('0x13')](_0x494c25,util['format'](_0xc3fc('0x14'),_0x5b6663,_0x22af80,_0x6a33bd));var _0x535f11=JSON[_0xc3fc('0x15')](_0x4b1f3c);_0x535f11[_0xc3fc('0x16')]=![];_0x535f11[_0xc3fc('0xe')]=_0x22af80;_0x535f11[_0xc3fc('0x17')]=hardware[_0xc3fc('0x7')]();if(_0x1a0a23){var _0x4fa624=encryptor[_0xc3fc('0x13')](_0x1a0a23);_0x535f11['gray']=_0x4fa624;_0x535f11[_0xc3fc('0x18')]=moment(_0x4fa624)[_0xc3fc('0x19')](0x7,_0xc3fc('0x1a'))['format']();_0x535f11['grayReason']=_0x535f11[_0xc3fc('0xe')]!=_0x535f11['machineUuid']?'changed':_0xc3fc('0x1b');}return _0x535f11;}catch(_0x457e2f){breakingLicense[_0xc3fc('0xe')]=_0x18dde5[_0xc3fc('0xf')];breakingLicense['message']=_0x457e2f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x29faaa,_0x1c432f){getLicense()['then'](function(_0x30186a){return db[_0xc3fc('0x1c')]['findAll']({'attributes':['role',[db[_0xc3fc('0x1d')]['fn']('COUNT',db[_0xc3fc('0x1d')][_0xc3fc('0x1e')](_0xc3fc('0x1f'))),_0xc3fc('0x20')]],'group':_0xc3fc('0x1f'),'where':{'role':{'$or':['admin',_0xc3fc('0x21'),_0xc3fc('0x22')]}},'raw':!![]})[_0xc3fc('0xc')](function(_0x147141){var _0x4ef696={'user':_0x30186a[_0xc3fc('0x23')]||0x0,'telephone':_0x30186a['telephones']||0x0};_0x147141[_0xc3fc('0x24')](function(_0x4d9749){var _0x1f6d4e=_0x4d9749[_0xc3fc('0x1f')]===_0xc3fc('0x25')?_0xc3fc('0x21'):_0x4d9749['role'];_0x4ef696[_0x1f6d4e]-=_0x4d9749[_0xc3fc('0x20')];if(_0x4ef696[_0x1f6d4e]<0x0)_0x4ef696[_0x1f6d4e]=0x0;});_0x29faaa(_0x4ef696);return;});})[_0xc3fc('0xd')](function(_0x3fd3af){_0x1c432f(_0x3fd3af);});});}function checkUserLimits(_0x2c341a){return new BPromise(function(_0x5220ed,_0x5e318d){getLimits()[_0xc3fc('0xc')](function(_0x22cec6){var _0x2ed390=_['pick'](_[_0xc3fc('0x26')](_0x2c341a,_0xc3fc('0x1f')),['admin',_0xc3fc('0x21'),'telephone']);var _0x3b40c5=(_0x2ed390[_0xc3fc('0x25')]||0x0)+(_0x2ed390[_0xc3fc('0x21')]||0x0);var _0x5892ac=_0x2ed390[_0xc3fc('0x22')]||0x0;if(_0x3b40c5>_0x22cec6[_0xc3fc('0x21')])return _0x5e318d('License\x20limit\x20reached\x20for\x20users');if(_0x5892ac>_0x22cec6[_0xc3fc('0x22')])return _0x5e318d('License\x20limit\x20reached\x20for\x20telephones');return _0x5220ed();})[_0xc3fc('0xd')](function(_0xc26ca0){_0x5e318d(_0xc26ca0);});});}module[_0xc3fc('0x27')]={'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 d84ad08..3e7dc1e 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5204,0xdf));var _0x4520=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x5204[_0x4d7a61];return _0x186f73;};'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(_0x8dba4d,_0x44f9c9){var _0x44a11d=function(_0x28da03){while(--_0x28da03){_0x8dba4d['push'](_0x8dba4d['shift']());}};_0x44a11d(++_0x44f9c9);}(_0x8f4c,0x113));var _0xc8f4=function(_0x5a2a75,_0xe3a29e){_0x5a2a75=_0x5a2a75-0x0;var _0x4109c3=_0x8f4c[_0x5a2a75];return _0x4109c3;};'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 5d75556..7b435dc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe97e=['exports','fileLogger'];(function(_0x2a96de,_0x7ac856){var _0x22b36e=function(_0x1ebe00){while(--_0x1ebe00){_0x2a96de['push'](_0x2a96de['shift']());}};_0x22b36e(++_0x7ac856);}(_0xe97e,0xf9));var _0xee97=function(_0x3e1d49,_0x21bc59){_0x3e1d49=_0x3e1d49-0x0;var _0x2b2b24=_0xe97e[_0x3e1d49];return _0x2b2b24;};'use strict';var fileLogger=require('../utils/loggers')[_0xee97('0x0')];module[_0xee97('0x1')]=fileLogger; \ No newline at end of file +var _0x8661=['fileLogger','exports','../utils/loggers'];(function(_0x5eee8f,_0x3c54c3){var _0x11e333=function(_0x3ec37c){while(--_0x3ec37c){_0x5eee8f['push'](_0x5eee8f['shift']());}};_0x11e333(++_0x3c54c3);}(_0x8661,0x1b8));var _0x1866=function(_0x3fad91,_0x35b014){_0x3fad91=_0x3fad91-0x0;var _0x18ff03=_0x8661[_0x3fad91];return _0x18ff03;};'use strict';var fileLogger=require(_0x1866('0x0'))[_0x1866('0x1')];module[_0x1866('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 71d69d0..e41a0d2 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 _0x522c=['xdr','../../services/xdr/index.js','path','express','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x522c,0xf2));var _0xc522=function(_0x14d322,_0x34b9d1){_0x14d322=_0x14d322-0x0;var _0x34adf4=_0x522c[_0x14d322];return _0x34adf4;};'use strict';var path=require(_0xc522('0x0'));var os=require('os');var config={'apps':[{'name':_0xc522('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0xc522('0x2'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0x4'))},{'name':_0xc522('0x5'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0x6'))},{'name':_0xc522('0x7'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0x8'))},{'name':'routing','script':path['join'](__dirname,_0xc522('0x9'))},{'name':_0xc522('0xa'),'script':path[_0xc522('0x3')](__dirname,_0xc522('0xb'))}]};module['exports']=config; \ No newline at end of file +var _0x743b=['../../services/ami/index.js','../../services/agi/index.js','email','routing','exports','path','express','join','ami'];(function(_0x510d99,_0x1d9113){var _0x242894=function(_0x4e8904){while(--_0x4e8904){_0x510d99['push'](_0x510d99['shift']());}};_0x242894(++_0x1d9113);}(_0x743b,0x164));var _0xb743=function(_0x4c15af,_0x21fe8b){_0x4c15af=_0x4c15af-0x0;var _0x585a8a=_0x743b[_0x4c15af];return _0x585a8a;};'use strict';var path=require(_0xb743('0x0'));var os=require('os');var config={'apps':[{'name':_0xb743('0x1'),'script':path[_0xb743('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xb743('0x3'),'script':path[_0xb743('0x2')](__dirname,_0xb743('0x4'))},{'name':'agi','script':path['join'](__dirname,_0xb743('0x5'))},{'name':_0xb743('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0xb743('0x7'),'script':path[_0xb743('0x2')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0xb743('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xb743('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 26c0284..edacccd 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 _0x8ed0=['describe','dump','bluebird','./config','connect','start','then','disconnect','stop','restart','list'];(function(_0x40e3eb,_0x64d28d){var _0x58251c=function(_0x4ba29c){while(--_0x4ba29c){_0x40e3eb['push'](_0x40e3eb['shift']());}};_0x58251c(++_0x64d28d);}(_0x8ed0,0x70));var _0x08ed=function(_0x1b3d9c,_0x2668fb){_0x1b3d9c=_0x1b3d9c-0x0;var _0x23169c=_0x8ed0[_0x1b3d9c];return _0x23169c;};'use strict';var pm2=require('pm2');var BPromise=require(_0x08ed('0x0'));var config=require(_0x08ed('0x1'));function connect(){return new BPromise(function(_0x84df90,_0x1a4210){return pm2[_0x08ed('0x2')](function(_0x4351d6){if(_0x4351d6){return _0x1a4210(_0x4351d6);}return _0x84df90('connected');});});};exports[_0x08ed('0x3')]=function(_0x4c67c2){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0xc68095,_0x1058d2){return pm2[_0x08ed('0x3')](_0x4c67c2,function(_0x5246b7,_0x5e83c5){if(_0x5246b7){return _0x1058d2(_0x5246b7);}pm2[_0x08ed('0x5')]();return _0xc68095(_0x5e83c5);});});});};exports[_0x08ed('0x6')]=function(_0x2872de){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0x113a79,_0x252e52){return pm2[_0x08ed('0x6')](_0x2872de,function(_0x549a1e,_0x6c0837){if(_0x549a1e){return _0x252e52(_0x549a1e);}pm2[_0x08ed('0x5')]();return _0x113a79(_0x6c0837);});});});};exports['restart']=function(_0x247eee){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0xe976ae,_0x71aa45){return pm2[_0x08ed('0x7')](_0x247eee,function(_0x53931b,_0x29e806){if(_0x53931b){return _0x71aa45(_0x53931b);}pm2['disconnect']();return _0xe976ae(_0x29e806);});});});};exports[_0x08ed('0x8')]=function(){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0x31b196,_0x20a342){return pm2[_0x08ed('0x8')](function(_0x28120f,_0x506408){if(_0x28120f){return _0x20a342(_0x28120f);}pm2[_0x08ed('0x5')]();return _0x31b196(_0x506408);});});});};exports['describe']=function(_0x5c19af){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0x52ddd9,_0x1d1f25){return pm2[_0x08ed('0x9')](_0x5c19af,function(_0x4aea3d,_0x106a5b){if(_0x4aea3d){return _0x1d1f25(_0x4aea3d);}pm2[_0x08ed('0x5')]();return _0x52ddd9(_0x106a5b);});});});};exports['delete']=function(_0x58c8f8){return connect()['then'](function(){return new BPromise(function(_0x59e962,_0x47eb7f){return pm2['delete'](_0x58c8f8,function(_0x589baa,_0x5765a5){if(_0x589baa){return _0x47eb7f(_0x589baa);}pm2[_0x08ed('0x5')]();return _0x59e962(_0x5765a5);});});});};exports[_0x08ed('0xa')]=function(){return connect()[_0x08ed('0x4')](function(){return new BPromise(function(_0xe0f60e,_0x36c1b1){return pm2[_0x08ed('0xa')](function(_0x4e0e65){if(_0x4e0e65){return _0x36c1b1(_0x4e0e65);}return _0xe0f60e('saved');});});});}; \ No newline at end of file +var _0x2756=['stop','disconnect','list','describe','delete','dump','pm2','bluebird','connected','start','then'];(function(_0xdfbd47,_0x46bee4){var _0x55040a=function(_0x5aaeac){while(--_0x5aaeac){_0xdfbd47['push'](_0xdfbd47['shift']());}};_0x55040a(++_0x46bee4);}(_0x2756,0x1be));var _0x6275=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0x2756[_0x3a78a0];return _0x48e917;};'use strict';var pm2=require(_0x6275('0x0'));var BPromise=require(_0x6275('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x461dba,_0x1bfbed){return pm2['connect'](function(_0x1a3966){if(_0x1a3966){return _0x1bfbed(_0x1a3966);}return _0x461dba(_0x6275('0x2'));});});};exports[_0x6275('0x3')]=function(_0x4e0034){return connect()[_0x6275('0x4')](function(){return new BPromise(function(_0x5bb598,_0x160710){return pm2[_0x6275('0x3')](_0x4e0034,function(_0x16ff2d,_0x58d33b){if(_0x16ff2d){return _0x160710(_0x16ff2d);}pm2['disconnect']();return _0x5bb598(_0x58d33b);});});});};exports[_0x6275('0x5')]=function(_0x371f89){return connect()[_0x6275('0x4')](function(){return new BPromise(function(_0x11e17e,_0x19bb33){return pm2['stop'](_0x371f89,function(_0x31b33a,_0x483bdf){if(_0x31b33a){return _0x19bb33(_0x31b33a);}pm2['disconnect']();return _0x11e17e(_0x483bdf);});});});};exports['restart']=function(_0x22cc28){return connect()['then'](function(){return new BPromise(function(_0x2b3abc,_0x2beb6a){return pm2['restart'](_0x22cc28,function(_0x3204a2,_0x101809){if(_0x3204a2){return _0x2beb6a(_0x3204a2);}pm2[_0x6275('0x6')]();return _0x2b3abc(_0x101809);});});});};exports[_0x6275('0x7')]=function(){return connect()[_0x6275('0x4')](function(){return new BPromise(function(_0xe3668b,_0x450541){return pm2[_0x6275('0x7')](function(_0x9bd850,_0x349366){if(_0x9bd850){return _0x450541(_0x9bd850);}pm2[_0x6275('0x6')]();return _0xe3668b(_0x349366);});});});};exports[_0x6275('0x8')]=function(_0x283051){return connect()[_0x6275('0x4')](function(){return new BPromise(function(_0xb3afc7,_0x4857fa){return pm2[_0x6275('0x8')](_0x283051,function(_0x27974c,_0x1abed0){if(_0x27974c){return _0x4857fa(_0x27974c);}pm2[_0x6275('0x6')]();return _0xb3afc7(_0x1abed0);});});});};exports['delete']=function(_0x29f91e){return connect()[_0x6275('0x4')](function(){return new BPromise(function(_0x3299fd,_0x21f43a){return pm2[_0x6275('0x9')](_0x29f91e,function(_0x5cab32,_0x567a7a){if(_0x5cab32){return _0x21f43a(_0x5cab32);}pm2[_0x6275('0x6')]();return _0x3299fd(_0x567a7a);});});});};exports[_0x6275('0xa')]=function(){return connect()[_0x6275('0x4')](function(){return new BPromise(function(_0x58e2e0,_0x288d5c){return pm2[_0x6275('0xa')](function(_0x39c995){if(_0x39c995){return _0x288d5c(_0x39c995);}return _0x58e2e0('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e0bbbc0..8229c60 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 _0x651b=['start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x651b,0x88));var _0xb651=function(_0x55dbcc,_0x471200){_0x55dbcc=_0x55dbcc-0x0;var _0x4bf589=_0x651b[_0x55dbcc];return _0x4bf589;};'use strict';var _=require(_0xb651('0x0'));var moment=require(_0xb651('0x1'));var Redis=require(_0xb651('0x2'));var util=require(_0xb651('0x3'));var config=require(_0xb651('0x4'));var db=require(_0xb651('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xb651('0x6')]=_['defaults'](config['redis'],{'host':_0xb651('0x7'),'port':0x18eb});var io=require(_0xb651('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x5ae436=0x0;var _0x14705b=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0xb651('0x9')],'where':{'id':0x1}})[_0xb651('0xa')](function(_0x7fce75){_0x5ae436=_0x7fce75[_0xb651('0x9')];if(_0x5ae436){return db[_0xb651('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb651('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x7fce75[_0xb651('0x9')],_0xb651('0xd'))}}});}else{return[];}})['then'](function(_0x5ee8ef){if(_0x5ee8ef&&_0x5ee8ef[_0xb651('0xe')]){_0x14705b=_['map'](_0x5ee8ef||[],'id');logger[_0xb651('0xf')](_0xb651('0x10'),_0x14705b[_0xb651('0x11')]());return db[_0xb651('0xb')][_0xb651('0x12')]({'closeReason':_0xb651('0x13'),'disposition':_0xb651('0x14'),'closed':!![],'closedAt':moment()['format'](_0xb651('0x15'))},{'where':{'id':_0x14705b}});}})[_0xb651('0xa')](function(){if(_0x14705b&&_0x14705b[_0xb651('0xe')]){logger[_0xb651('0xf')](_0xb651('0x16'),_0x14705b[_0xb651('0x11')]());for(var _0x4d423d=0x0;_0x4d423d<_0x14705b['length'];_0x4d423d++){io['emit'](_0xb651('0x17'),{'id':_0x14705b[_0x4d423d],'closed':!![]});}}})[_0xb651('0x18')](function(_0x377108){logger[_0xb651('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0x377108?util['inspect'](_0x377108,{'showHidden':![],'depth':null}):'');});}exports[_0xb651('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2b36=['lastMsgAt','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','catch','error','inspect','start','ioredis','util','../../config/environment','../logger','schedule','localhost','socket.io-emitter','redis','Setting','find','chatTimeout','then','ChatInteraction','findAll'];(function(_0x3f15d0,_0x5a270d){var _0x3107fb=function(_0x122b78){while(--_0x122b78){_0x3f15d0['push'](_0x3f15d0['shift']());}};_0x3107fb(++_0x5a270d);}(_0x2b36,0x1df));var _0x62b3=function(_0xeeb4b7,_0x151e67){_0xeeb4b7=_0xeeb4b7-0x0;var _0x1da8f2=_0x2b36[_0xeeb4b7];return _0x1da8f2;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x62b3('0x0'));var util=require(_0x62b3('0x1'));var config=require(_0x62b3('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x62b3('0x3'))(_0x62b3('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x62b3('0x5'),'port':0x18eb});var io=require(_0x62b3('0x6'))(new Redis(config[_0x62b3('0x7')]));function closeInteractions(){var _0x107081=0x0;var _0x25352a=[];return db[_0x62b3('0x8')][_0x62b3('0x9')]({'raw':!![],'attributes':['id',_0x62b3('0xa')],'where':{'id':0x1}})[_0x62b3('0xb')](function(_0x3de75d){_0x107081=_0x3de75d[_0x62b3('0xa')];if(_0x107081){return db[_0x62b3('0xc')][_0x62b3('0xd')]({'raw':!![],'attributes':['id',_0x62b3('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3de75d[_0x62b3('0xa')],_0x62b3('0xf'))}}});}else{return[];}})['then'](function(_0x23ec37){if(_0x23ec37&&_0x23ec37['length']){_0x25352a=_[_0x62b3('0x10')](_0x23ec37||[],'id');logger[_0x62b3('0x11')](_0x62b3('0x12'),_0x25352a[_0x62b3('0x13')]());return db[_0x62b3('0xc')][_0x62b3('0x14')]({'closeReason':_0x62b3('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x25352a}});}})[_0x62b3('0xb')](function(){if(_0x25352a&&_0x25352a['length']){logger['info'](_0x62b3('0x16'),_0x25352a[_0x62b3('0x13')]());for(var _0x295d9c=0x0;_0x295d9c<_0x25352a[_0x62b3('0x17')];_0x295d9c++){io[_0x62b3('0x18')]('chatInteraction:update',{'id':_0x25352a[_0x295d9c],'closed':!![]});}}})[_0x62b3('0x19')](function(_0x5a7408){logger[_0x62b3('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x5a7408?util[_0x62b3('0x1b')](_0x5a7408,{'showHidden':![],'depth':null}):'');});}exports[_0x62b3('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 1d142fd..caa3f7a 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 _0xb769=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb769,0x93));var _0x9b76=function(_0x24bc66,_0x44a9fe){_0x24bc66=_0x24bc66-0x0;var _0x5e0da0=_0xb769[_0x24bc66];return _0x5e0da0;};'use strict';function start(){var _0x3c1c92=require(_0x9b76('0x0'));return _0x3c1c92[_0x9b76('0x1')]();}module[_0x9b76('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x2123=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2123,0xec));var _0x3212=function(_0x5d9d91,_0x206c4e){_0x5d9d91=_0x5d9d91-0x0;var _0x525a7b=_0x2123[_0x5d9d91];return _0x525a7b;};'use strict';function start(){var _0x322812=require(_0x3212('0x0'));return _0x322812[_0x3212('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 94272b7..5dfa9db 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 _0x6ce2=['run\x20job','cron','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','active','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','findAll','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','stop','deleteJob','toRun','index','my\x20id','resolve'];(function(_0xf78364,_0x30d64c){var _0x17e382=function(_0x7fb37e){while(--_0x7fb37e){_0xf78364['push'](_0xf78364['shift']());}};_0x17e382(++_0x30d64c);}(_0x6ce2,0x117));var _0x26ce=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6ce2[_0x4baae2];return _0x1a2285;};'use strict';var fs=require('fs');var util=require(_0x26ce('0x0'));var path=require(_0x26ce('0x1'));var _=require(_0x26ce('0x2'));var moment=require(_0x26ce('0x3'));var CronJobManager=require(_0x26ce('0x4'));var jayson=require(_0x26ce('0x5'));var BPromise=require(_0x26ce('0x6'));var logger=require('../logger')('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x26ce('0x7'));var analyticDefaultReportController=require(_0x26ce('0x8'));var client=jayson[_0x26ce('0x9')][_0x26ce('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x37796a,_0xaef09a){return function(){logger[_0x26ce('0xb')](_0x26ce('0xc'),_0x37796a['email']);var _0x313bbc=!![];var _0x4a0cb8=_0x37796a['MailAccount'][_0x26ce('0xd')]();var _0x155736={'account':_0x4a0cb8,'message':{'from':util[_0x26ce('0xe')](_0x26ce('0xf'),_0x37796a[_0x26ce('0x10')][_0x26ce('0x11')],_0x37796a[_0x26ce('0x10')]['email']||_0x37796a['MailAccount'][_0x26ce('0x12')][_0x26ce('0x13')]),'to':_0x37796a[_0x26ce('0x14')],'cc':_0x37796a['cc'],'bcc':_0x37796a[_0x26ce('0x15')],'subject':util['format'](_0x26ce('0x16'),_0xaef09a['name'],_0x37796a[_0x26ce('0x17')],_0x37796a[_0x26ce('0x18')])}};var _0x253c1c=path[_0x26ce('0x19')](__dirname,_0x26ce('0x1a'));var _0x2d6de6=_0xaef09a[_0x26ce('0x1b')];var _0x24387a=util[_0x26ce('0xe')](_0x26ce('0x1c'),path['basename'](_0xaef09a[_0x26ce('0x1b')],path[_0x26ce('0x1d')](_0xaef09a[_0x26ce('0x1b')])),_0x26ce('0x1e'));var _0x151f8e=path[_0x26ce('0x19')](_0x253c1c,_0x2d6de6);var _0x228a42=path[_0x26ce('0x19')](_0x253c1c,_0x24387a);if(fs[_0x26ce('0x1f')](_0x151f8e)){_0xaef09a['status']=_0x26ce('0x20');_0x155736[_0x26ce('0x21')][_0x26ce('0x22')]=[{'filename':_0x2d6de6,'path':_0x151f8e}];_0x155736[_0x26ce('0x21')][_0x26ce('0x23')]=util[_0x26ce('0xe')](_0x26ce('0x24'),JSON[_0x26ce('0x25')](_0xaef09a,null,0x2));}else if(fs['existsSync'](_0x228a42)){_0xaef09a[_0x26ce('0x26')]=_0x26ce('0x20');_0x155736[_0x26ce('0x21')]['attachments']=[{'filename':_0x24387a,'path':_0x228a42}];}else{_0x155736[_0x26ce('0x21')][_0x26ce('0x23')]=_0x26ce('0x27');if(!_0x37796a[_0x26ce('0x28')]){_0x313bbc=![];logger[_0x26ce('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x313bbc){return client[_0x26ce('0x29')](_0x26ce('0x2a'),_0x155736)[_0x26ce('0x2b')](function(_0x5f5706){if(_0x5f5706[_0x26ce('0x2c')]){return logger[_0x26ce('0x2c')](_0x26ce('0x2d'),JSON['stringify'](_0x5f5706));}return logger[_0x26ce('0xb')](_0x26ce('0x2e'));})[_0x26ce('0x2f')](function(_0xd3d3d){return logger[_0x26ce('0x2c')](_0x26ce('0x2d'),JSON['stringify'](_0xd3d3d));});}};}function handleError(){return function(_0x5a09ce){return logger['error'](JSON['stringify'](_0x5a09ce));};}function handleResult(_0x1067e0){return function(_0x58c7e9){logger[_0x26ce('0xb')](_0x26ce('0x30'),JSON[_0x26ce('0x25')](_0x58c7e9));if(_0x1067e0[_0x26ce('0x10')]&&_0x1067e0[_0x26ce('0x10')][_0x26ce('0x12')]&&!_['isNil'](_0x1067e0[_0x26ce('0x14')])){setTimeout(handleSendEmail(_0x1067e0,_0x58c7e9),0x3c*0x3e8);}};}function handleJob(_0x5de40b){return function(){try{if(_[_0x26ce('0x31')](_0x5de40b[_0x26ce('0x17')])){return logger[_0x26ce('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x26ce('0x31')](_0x5de40b['subtractUnit'])){return logger[_0x26ce('0xb')](_0x26ce('0x32'));}var _0x4406b0={'startDate':moment()[_0x26ce('0x33')](_0x5de40b[_0x26ce('0x17')],_0x5de40b[_0x26ce('0x18')])[_0x26ce('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x26ce('0xe')](_0x26ce('0x34')),'type':_0x26ce('0x35'),'output':_0x5de40b[_0x26ce('0x36')],'name':_0x5de40b['name']};if(!_['isNil'](_0x5de40b[_0x26ce('0x37')])){logger[_0x26ce('0xb')](_0x26ce('0x38'),_0x5de40b[_0x26ce('0x37')]);return analyticDefaultReportController[_0x26ce('0x39')]({'id':_0x5de40b[_0x26ce('0x37')]},_0x4406b0)[_0x26ce('0x2b')](handleResult(_0x5de40b))['catch'](handleError());}if(!_[_0x26ce('0x31')](_0x5de40b['CustomReportId'])){logger[_0x26ce('0xb')](_0x26ce('0x3a'),_0x5de40b['CustomReportId']);return analyticCustomReportController[_0x26ce('0x39')]({'id':_0x5de40b[_0x26ce('0x3b')]},_0x4406b0)['then'](handleResult(_0x5de40b))[_0x26ce('0x2f')](handleError());}}catch(_0x58a589){logger['error'](JSON[_0x26ce('0x25')](_0x58a589));}return logger[_0x26ce('0xb')](_0x26ce('0x3c'));};}function getJobs(_0x1f0db6){var _0x560429={};if(_0x1f0db6){_0x560429['id']=_0x1f0db6;}return db['Schedule'][_0x26ce('0x3d')]({'where':_0x560429,'include':[{'model':db[_0x26ce('0x10')],'attributes':['id','name',_0x26ce('0x14')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x26ce('0x3e')}]}]}]})[_0x26ce('0x2b')](function(_0x3cb314){var _0x5785a3=_[_0x26ce('0x3f')](manager[_0x26ce('0x40')]);var _0x1dfd7f=_[_0x26ce('0x41')](_0x3cb314,function(_0x49505f){return _0x49505f['id']['toString']();});var _0x150e3f=_[_0x26ce('0x42')](_0x3cb314,function(_0x34abec){return _0x34abec['id'][_0x26ce('0x43')]();});var _0x2bb642=_0x1f0db6?_0x1dfd7f:_[_0x26ce('0x44')](_0x1dfd7f,_0x5785a3);var _0x565b5c=_[_0x26ce('0x45')](_0x1dfd7f,_0x5785a3);var _0x72cf4e=_[_0x26ce('0x44')](_0x5785a3,_0x1dfd7f);var _0x5703ce;var _0x3646a3;for(_0x5703ce=0x0;_0x5703ce<_0x72cf4e[_0x26ce('0x46')]&&!_0x1f0db6;_0x5703ce+=0x1){_0x3646a3=_0x72cf4e[_0x5703ce][_0x26ce('0x43')]();if(manager['exists'](_0x3646a3)){manager[_0x26ce('0x47')](_0x3646a3);manager[_0x26ce('0x48')](_0x3646a3);logger[_0x26ce('0xb')]('delete\x20cron',_0x3646a3);}}logger['info'](_0x26ce('0x49'),JSON[_0x26ce('0x25')](_0x2bb642));for(_0x5703ce=0x0;_0x5703ce<_0x2bb642[_0x26ce('0x46')];_0x5703ce+=0x1){_0x3646a3=_0x2bb642[_0x5703ce]['toString']();logger['info'](_0x26ce('0x4a'),_0x3646a3);if(_0x1f0db6){logger[_0x26ce('0xb')](_0x26ce('0x4b'),_0x1f0db6);logger['info'](JSON[_0x26ce('0x25')](_0x150e3f[_0x3646a3]));BPromise[_0x26ce('0x4c')]()[_0x26ce('0x2b')](handleJob(_0x150e3f[_0x3646a3]));logger[_0x26ce('0xb')](_0x26ce('0x4d'),_0x150e3f[_0x3646a3][_0x26ce('0x11')],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}else if(_0x150e3f[_0x3646a3]['cron']&&_0x150e3f[_0x3646a3]['active']&&moment()[_0x26ce('0x4f')](_0x150e3f[_0x3646a3][_0x26ce('0x50')],_0x150e3f[_0x3646a3][_0x26ce('0x51')])){manager[_0x26ce('0x52')](_0x3646a3,_0x150e3f[_0x3646a3][_0x26ce('0x4e')],handleJob(_0x150e3f[_0x3646a3]));manager['start'](_0x3646a3);logger[_0x26ce('0xb')](_0x26ce('0x53'),_0x150e3f[_0x3646a3]['name'],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}else if(manager[_0x26ce('0x54')](_0x3646a3)){manager[_0x26ce('0x47')](_0x3646a3);manager[_0x26ce('0x48')](_0x3646a3);logger[_0x26ce('0xb')](_0x26ce('0x55'),_0x150e3f[_0x3646a3][_0x26ce('0x11')],_0x150e3f[_0x3646a3]['cron']);}}for(_0x5703ce=0x0,_0x3646a3;_0x5703ce<_0x565b5c[_0x26ce('0x46')]&&!_0x1f0db6;_0x5703ce+=0x1){_0x3646a3=_0x565b5c[_0x5703ce]['toString']();if(manager[_0x26ce('0x54')](_0x3646a3)){if(_0x150e3f[_0x3646a3][_0x26ce('0x4e')]&&_0x150e3f[_0x3646a3][_0x26ce('0x56')]&&moment()[_0x26ce('0x4f')](_0x150e3f[_0x3646a3][_0x26ce('0x50')],_0x150e3f[_0x3646a3][_0x26ce('0x51')])){manager['update'](_0x3646a3,_0x150e3f[_0x3646a3][_0x26ce('0x4e')],handleJob(_0x150e3f[_0x3646a3]));logger[_0x26ce('0xb')](_0x26ce('0x57'),_0x150e3f[_0x3646a3]['name'],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}else{manager['stop'](_0x3646a3);manager['deleteJob'](_0x3646a3);logger[_0x26ce('0xb')]('stop\x20cron',_0x150e3f[_0x3646a3][_0x26ce('0x11')],_0x150e3f[_0x3646a3][_0x26ce('0x4e')]);}}}})[_0x26ce('0x2f')](function(_0x46f741){logger[_0x26ce('0x2c')](JSON[_0x26ce('0x25')](_0x46f741));});}exports[_0x26ce('0x58')]=function(_0xfb947f){return getJobs(_0xfb947f);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf304=['active','endAt','update\x20cron','stop\x20cron','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','MailAccount','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','join','existsSync','status','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','message','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','toString','difference','length','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','add\x20cron','stop','exists'];(function(_0x37a505,_0x319129){var _0x5d094e=function(_0x5b78ea){while(--_0x5b78ea){_0x37a505['push'](_0x37a505['shift']());}};_0x5d094e(++_0x319129);}(_0xf304,0x19f));var _0x4f30=function(_0x2ca892,_0x11af43){_0x2ca892=_0x2ca892-0x0;var _0x3d3f77=_0xf304[_0x2ca892];return _0x3d3f77;};'use strict';var fs=require('fs');var util=require(_0x4f30('0x0'));var path=require(_0x4f30('0x1'));var _=require(_0x4f30('0x2'));var moment=require(_0x4f30('0x3'));var CronJobManager=require(_0x4f30('0x4'));var jayson=require(_0x4f30('0x5'));var BPromise=require(_0x4f30('0x6'));var logger=require('../logger')('schedule');var db=require(_0x4f30('0x7'))['db'];var analyticCustomReportController=require(_0x4f30('0x8'));var analyticDefaultReportController=require(_0x4f30('0x9'));var client=jayson['client'][_0x4f30('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4d48f2,_0x51146c){return function(){logger[_0x4f30('0xb')](_0x4f30('0xc'),_0x4d48f2['email']);var _0x3ac159=!![];var _0x2abe93=_0x4d48f2['MailAccount'][_0x4f30('0xd')]();var _0x5ae5f7={'account':_0x2abe93,'message':{'from':util[_0x4f30('0xe')](_0x4f30('0xf'),_0x4d48f2['MailAccount'][_0x4f30('0x10')],_0x4d48f2['MailAccount'][_0x4f30('0x11')]||_0x4d48f2[_0x4f30('0x12')][_0x4f30('0x13')]['user']),'to':_0x4d48f2[_0x4f30('0x11')],'cc':_0x4d48f2['cc'],'bcc':_0x4d48f2[_0x4f30('0x14')],'subject':util['format'](_0x4f30('0x15'),_0x51146c[_0x4f30('0x10')],_0x4d48f2[_0x4f30('0x16')],_0x4d48f2[_0x4f30('0x17')])}};var _0x35abc5=path['join'](__dirname,_0x4f30('0x18'));var _0x4e0fbc=_0x51146c[_0x4f30('0x19')];var _0x2ccb1a=util['format'](_0x4f30('0x1a'),path[_0x4f30('0x1b')](_0x51146c[_0x4f30('0x19')],path[_0x4f30('0x1c')](_0x51146c[_0x4f30('0x19')])),'zip');var _0x2ade19=path['join'](_0x35abc5,_0x4e0fbc);var _0x42e750=path[_0x4f30('0x1d')](_0x35abc5,_0x2ccb1a);if(fs[_0x4f30('0x1e')](_0x2ade19)){_0x51146c[_0x4f30('0x1f')]='Sent';_0x5ae5f7['message']['attachments']=[{'filename':_0x4e0fbc,'path':_0x2ade19}];_0x5ae5f7['message'][_0x4f30('0x20')]=util[_0x4f30('0xe')](_0x4f30('0x21'),JSON[_0x4f30('0x22')](_0x51146c,null,0x2));}else if(fs[_0x4f30('0x1e')](_0x42e750)){_0x51146c[_0x4f30('0x1f')]=_0x4f30('0x23');_0x5ae5f7[_0x4f30('0x24')][_0x4f30('0x25')]=[{'filename':_0x2ccb1a,'path':_0x42e750}];}else{_0x5ae5f7[_0x4f30('0x24')][_0x4f30('0x20')]=_0x4f30('0x26');if(!_0x4d48f2[_0x4f30('0x27')]){_0x3ac159=![];logger['info'](_0x4f30('0x28'));}}if(_0x3ac159){return client[_0x4f30('0x29')](_0x4f30('0x2a'),_0x5ae5f7)[_0x4f30('0x2b')](function(_0x4ab7b4){if(_0x4ab7b4[_0x4f30('0x2c')]){return logger[_0x4f30('0x2c')](_0x4f30('0x2d'),JSON[_0x4f30('0x22')](_0x4ab7b4));}return logger[_0x4f30('0xb')]('email\x20sent');})[_0x4f30('0x2e')](function(_0x3ca528){return logger[_0x4f30('0x2c')]('error\x20mail',JSON['stringify'](_0x3ca528));});}};}function handleError(){return function(_0x124f90){return logger[_0x4f30('0x2c')](JSON[_0x4f30('0x22')](_0x124f90));};}function handleResult(_0x4724aa){return function(_0x57162e){logger['info'](_0x4f30('0x2f'),JSON['stringify'](_0x57162e));if(_0x4724aa[_0x4f30('0x12')]&&_0x4724aa[_0x4f30('0x12')]['Smtp']&&!_[_0x4f30('0x30')](_0x4724aa[_0x4f30('0x11')])){setTimeout(handleSendEmail(_0x4724aa,_0x57162e),0x3c*0x3e8);}};}function handleJob(_0x10119a){return function(){try{if(_[_0x4f30('0x30')](_0x10119a[_0x4f30('0x16')])){return logger[_0x4f30('0xb')](_0x4f30('0x31'));}if(_['isNil'](_0x10119a[_0x4f30('0x17')])){return logger[_0x4f30('0xb')](_0x4f30('0x32'));}var _0x34f1b2={'startDate':moment()['subtract'](_0x10119a[_0x4f30('0x16')],_0x10119a['subtractUnit'])[_0x4f30('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4f30('0xe')](_0x4f30('0x33')),'type':'scheduled','output':_0x10119a[_0x4f30('0x34')],'name':_0x10119a[_0x4f30('0x10')]};if(!_[_0x4f30('0x30')](_0x10119a[_0x4f30('0x35')])){logger[_0x4f30('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x10119a['DefaultReportId']);return analyticDefaultReportController[_0x4f30('0x36')]({'id':_0x10119a[_0x4f30('0x35')]},_0x34f1b2)[_0x4f30('0x2b')](handleResult(_0x10119a))[_0x4f30('0x2e')](handleError());}if(!_['isNil'](_0x10119a[_0x4f30('0x37')])){logger['info'](_0x4f30('0x38'),_0x10119a['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x10119a[_0x4f30('0x37')]},_0x34f1b2)['then'](handleResult(_0x10119a))['catch'](handleError());}}catch(_0x2d6313){logger[_0x4f30('0x2c')](JSON[_0x4f30('0x22')](_0x2d6313));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x579fe9){var _0x1107e9={};if(_0x579fe9){_0x1107e9['id']=_0x579fe9;}return db[_0x4f30('0x39')][_0x4f30('0x3a')]({'where':_0x1107e9,'include':[{'model':db[_0x4f30('0x12')],'attributes':['id',_0x4f30('0x10'),_0x4f30('0x11')],'include':[{'model':db[_0x4f30('0x3b')],'as':_0x4f30('0x13'),'include':[{'model':db[_0x4f30('0x3c')],'as':_0x4f30('0x3c')}]}]}]})['then'](function(_0x332481){var _0x3a148c=_['keys'](manager['jobs']);var _0x4ca433=_['map'](_0x332481,function(_0x3103e5){return _0x3103e5['id']['toString']();});var _0x5bfb48=_['keyBy'](_0x332481,function(_0x15f468){return _0x15f468['id'][_0x4f30('0x3d')]();});var _0x408c0e=_0x579fe9?_0x4ca433:_[_0x4f30('0x3e')](_0x4ca433,_0x3a148c);var _0x14f766=_['intersection'](_0x4ca433,_0x3a148c);var _0x50ce15=_[_0x4f30('0x3e')](_0x3a148c,_0x4ca433);var _0x207dad;var _0x198b7a;for(_0x207dad=0x0;_0x207dad<_0x50ce15[_0x4f30('0x3f')]&&!_0x579fe9;_0x207dad+=0x1){_0x198b7a=_0x50ce15[_0x207dad]['toString']();if(manager['exists'](_0x198b7a)){manager['stop'](_0x198b7a);manager[_0x4f30('0x40')](_0x198b7a);logger[_0x4f30('0xb')](_0x4f30('0x41'),_0x198b7a);}}logger[_0x4f30('0xb')](_0x4f30('0x42'),JSON[_0x4f30('0x22')](_0x408c0e));for(_0x207dad=0x0;_0x207dad<_0x408c0e['length'];_0x207dad+=0x1){_0x198b7a=_0x408c0e[_0x207dad]['toString']();logger['info'](_0x4f30('0x43'),_0x198b7a);if(_0x579fe9){logger[_0x4f30('0xb')](_0x4f30('0x44'),_0x579fe9);logger[_0x4f30('0xb')](JSON[_0x4f30('0x22')](_0x5bfb48[_0x198b7a]));BPromise[_0x4f30('0x45')]()[_0x4f30('0x2b')](handleJob(_0x5bfb48[_0x198b7a]));logger['info'](_0x4f30('0x46'),_0x5bfb48[_0x198b7a][_0x4f30('0x10')],_0x5bfb48[_0x198b7a][_0x4f30('0x47')]);}else if(_0x5bfb48[_0x198b7a][_0x4f30('0x47')]&&_0x5bfb48[_0x198b7a]['active']&&moment()[_0x4f30('0x48')](_0x5bfb48[_0x198b7a][_0x4f30('0x49')],_0x5bfb48[_0x198b7a]['endAt'])){manager['add'](_0x198b7a,_0x5bfb48[_0x198b7a][_0x4f30('0x47')],handleJob(_0x5bfb48[_0x198b7a]));manager['start'](_0x198b7a);logger[_0x4f30('0xb')](_0x4f30('0x4a'),_0x5bfb48[_0x198b7a][_0x4f30('0x10')],_0x5bfb48[_0x198b7a][_0x4f30('0x47')]);}else if(manager['exists'](_0x198b7a)){manager[_0x4f30('0x4b')](_0x198b7a);manager[_0x4f30('0x40')](_0x198b7a);logger[_0x4f30('0xb')]('stop\x20cron',_0x5bfb48[_0x198b7a][_0x4f30('0x10')],_0x5bfb48[_0x198b7a][_0x4f30('0x47')]);}}for(_0x207dad=0x0,_0x198b7a;_0x207dad<_0x14f766['length']&&!_0x579fe9;_0x207dad+=0x1){_0x198b7a=_0x14f766[_0x207dad][_0x4f30('0x3d')]();if(manager[_0x4f30('0x4c')](_0x198b7a)){if(_0x5bfb48[_0x198b7a][_0x4f30('0x47')]&&_0x5bfb48[_0x198b7a][_0x4f30('0x4d')]&&moment()[_0x4f30('0x48')](_0x5bfb48[_0x198b7a]['startAt'],_0x5bfb48[_0x198b7a][_0x4f30('0x4e')])){manager['update'](_0x198b7a,_0x5bfb48[_0x198b7a][_0x4f30('0x47')],handleJob(_0x5bfb48[_0x198b7a]));logger[_0x4f30('0xb')](_0x4f30('0x4f'),_0x5bfb48[_0x198b7a][_0x4f30('0x10')],_0x5bfb48[_0x198b7a][_0x4f30('0x47')]);}else{manager['stop'](_0x198b7a);manager[_0x4f30('0x40')](_0x198b7a);logger[_0x4f30('0xb')](_0x4f30('0x50'),_0x5bfb48[_0x198b7a]['name'],_0x5bfb48[_0x198b7a][_0x4f30('0x47')]);}}}})[_0x4f30('0x2e')](function(_0x15698e){logger[_0x4f30('0x2c')](JSON[_0x4f30('0x22')](_0x15698e));});}exports['run']=function(_0x385806){return getJobs(_0x385806);};exports[_0x4f30('0x51')]=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 e17916d..e372b60 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 _0x63ad=['data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','format','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','ValidationError','sentiment','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','name','error','start','aws-sdk','request-promise','transcribe','TranscribeService','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x63ad,0x7d));var _0xd63a=function(_0x1a9fe9,_0xcfafde){_0x1a9fe9=_0x1a9fe9-0x0;var _0x20356c=_0x63ad[_0x1a9fe9];return _0x20356c;};var _=require('lodash');var AWS=require(_0xd63a('0x0'));var rp=require(_0xd63a('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xd63a('0x2'));function getTranscriptionJob(_0x2c11bc,_0x4a9034,_0x22f15a,_0x1c4437){return new Promise(function(_0x32e509,_0xcfe533){var _0x3b0ad8=new AWS[(_0xd63a('0x3'))]({'accessKeyId':_0x4a9034,'secretAccessKey':_0x2c11bc,'region':_0x22f15a});_0x3b0ad8['getTranscriptionJob']({'TranscriptionJobName':_0x1c4437},function(_0x1505e0,_0x4e01e3){if(_0x1505e0){return _0xcfe533(_0x1505e0);}else{return _0x32e509(_0x4e01e3);}});});}function sentiment(_0xb861fd,_0x4c671f,_0x432556,_0x2a3cae,_0x32e0d1){return new Promise(function(_0x565aa3,_0x4baa08){var _0x51612b=new AWS[(_0xd63a('0x4'))]({'accessKeyId':_0x4c671f,'secretAccessKey':_0xb861fd,'region':_0x432556});_0x51612b['detectSentiment']({'Text':_0x2a3cae,'LanguageCode':_0x32e0d1[_0xd63a('0x5')](0x0,0x2)},function(_0x135e54,_0x492c0a){if(_0x135e54){return _0x4baa08(_0x135e54);}else{return _0x565aa3(_0x492c0a);}});});}function checkTranscribeJob(_0x2a1e86,_0x24bc2b,_0x2d58fe){var _0x4741f5;return new BPromise(function(_0x2fd204,_0xb1021e){logger[_0xd63a('0x6')](util['format'](_0xd63a('0x7'),_0x2a1e86['id'],_0x2a1e86[_0xd63a('0x8')]));return getTranscriptionJob(_0x2d58fe[_0xd63a('0x9')],_0x2d58fe[_0xd63a('0xa')],_0x24bc2b[_0xd63a('0xb')],_0x2a1e86[_0xd63a('0x8')])[_0xd63a('0xc')](function(_0x59423d){logger[_0xd63a('0x6')](util['format'](_0xd63a('0xd'),_0x2a1e86['id'],_0x2a1e86[_0xd63a('0x8')],_0x59423d[_0xd63a('0xe')][_0xd63a('0xf')]));if(!_0x2a1e86[_0xd63a('0x10')]){switch(_0x59423d[_0xd63a('0xe')][_0xd63a('0xf')]){case _0xd63a('0x11'):var _0x4a02e8={'transcribeStatus':_0x59423d[_0xd63a('0xe')]['TranscriptionJobStatus'],'fileUri':_0x59423d[_0xd63a('0xe')][_0xd63a('0x12')]['TranscriptFileUri']};logger['info'](util[_0xd63a('0x13')](_0xd63a('0x14'),_0x2a1e86['id']));return rp({'uri':_0x59423d[_0xd63a('0xe')][_0xd63a('0x12')]['TranscriptFileUri'],'json':!![]})[_0xd63a('0xc')](function(_0x36dd33){logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2a1e86['id']));if(_0x36dd33&&_0x36dd33[_0xd63a('0x15')]&&_0x36dd33['results'][_0xd63a('0x16')]&&_0x36dd33[_0xd63a('0x15')]['transcripts'][_0xd63a('0x17')]){_0x4a02e8[_0xd63a('0x10')]='';for(var _0x1924c6=0x0;_0x1924c6<_0x36dd33['results']['transcripts'][_0xd63a('0x17')];_0x1924c6++){_0x4a02e8['fileText']+=_0x36dd33['results'][_0xd63a('0x16')][_0x1924c6][_0xd63a('0x18')]+'';}}return _0x2a1e86[_0xd63a('0x19')](_0x4a02e8);})[_0xd63a('0xc')](function(){logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a1e86['id']));if(!_0x2a1e86[_0xd63a('0x1a')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x24bc2b['sentiment']||!_0x24bc2b[_0xd63a('0x1b')]||!_0x24bc2b[_0xd63a('0x1c')]||!_0x24bc2b[_0xd63a('0x1d')]||!_0x24bc2b[_0xd63a('0x1e')]){throw new db[(_0xd63a('0x1f'))]['ValidationError'](_0xd63a('0x20'));}if(!_0x4a02e8[_0xd63a('0x10')]){throw new Error(_0xd63a('0x21'));}if(_0x24bc2b[_0xd63a('0x1b')]===_0x2d58fe['id']){return _0x2d58fe;}else{return db[_0xd63a('0x22')][_0xd63a('0x23')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2f3c62){if(!_0x2f3c62){throw new db[(_0xd63a('0x1f'))]['ValidationError'](_0xd63a('0x24'));}if(!_0x2f3c62['data1']||!_0x2f3c62['data2']){throw new db['Sequelize']['ValidationError'](_0xd63a('0x25'));}_0x4741f5=_0x2f3c62;logger['info'](util[_0xd63a('0x13')](_0xd63a('0x26'),_0x2a1e86['id']));return sentiment(_0x4741f5['data1'],_0x4741f5[_0xd63a('0xa')],_0x24bc2b[_0xd63a('0x1c')],_0x4a02e8['fileText'],_0x24bc2b[_0xd63a('0x1d')]);})[_0xd63a('0xc')](function(_0x4e9865){logger[_0xd63a('0x6')](util[_0xd63a('0x13')](_0xd63a('0x27'),_0x2a1e86['id']));return _0x2a1e86['update']({'sentiment':_0x4e9865[_0xd63a('0x28')],'sPositive':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2a')],'sNegative':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2b')],'sMixed':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2c')],'sNeutral':_0x4e9865[_0xd63a('0x29')][_0xd63a('0x2d')]});})['then'](function(){logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a1e86['id']));_0x2fd204();});case _0xd63a('0x2e'):return _0x2a1e86[_0xd63a('0x19')]({'transcribeStatus':_0xd63a('0x2e'),'failureReason':_0x59423d[_0xd63a('0xe')][_0xd63a('0x2f')]})[_0xd63a('0xc')](function(){logger[_0xd63a('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a1e86['id']));_0x2fd204();});default:logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2a1e86['id']));break;}}else{return BPromise[_0xd63a('0x30')]()[_0xd63a('0xc')](function(){if(!_0x2a1e86['tempSentiment']){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x24bc2b[_0xd63a('0x32')]||!_0x24bc2b[_0xd63a('0x1b')]||!_0x24bc2b[_0xd63a('0x1c')]||!_0x24bc2b[_0xd63a('0x1d')]||!_0x24bc2b[_0xd63a('0x1e')]){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))](_0xd63a('0x20'));}if(!_0x2a1e86[_0xd63a('0x10')]){throw new Error(_0xd63a('0x21'));}if(_0x24bc2b[_0xd63a('0x1b')]===_0x2d58fe['id']){return _0x2d58fe;}else{return db[_0xd63a('0x22')][_0xd63a('0x23')]({'where':{'id':_settings[_0xd63a('0x1b')]}});}})[_0xd63a('0xc')](function(_0x5b6e13){if(!_0x5b6e13){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5b6e13[_0xd63a('0x9')]||!_0x5b6e13[_0xd63a('0xa')]){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))](_0xd63a('0x25'));}_0x4741f5=_0x5b6e13;logger[_0xd63a('0x6')](util[_0xd63a('0x13')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2a1e86['id']));return sentiment(_0x4741f5['data1'],_0x4741f5['data2'],_0x24bc2b['sentimentRegion'],_0x2a1e86[_0xd63a('0x10')],_0x24bc2b[_0xd63a('0x1d')]);})[_0xd63a('0xc')](function(_0x48afef){logger[_0xd63a('0x6')](util[_0xd63a('0x13')](_0xd63a('0x27'),_0x2a1e86['id']));return _0x2a1e86[_0xd63a('0x19')]({'sentiment':_0x48afef[_0xd63a('0x28')],'sPositive':_0x48afef[_0xd63a('0x29')]['Positive'],'sNegative':_0x48afef[_0xd63a('0x29')][_0xd63a('0x2b')],'sMixed':_0x48afef[_0xd63a('0x29')][_0xd63a('0x2c')],'sNeutral':_0x48afef['SentimentScore'][_0xd63a('0x2d')],'transcribeStatus':_0xd63a('0x11')});})[_0xd63a('0xc')](function(){logger[_0xd63a('0x6')](util[_0xd63a('0x13')](_0xd63a('0x33'),_0x2a1e86['id']));_0x2fd204();});}})['catch'](function(_0x3bc278){if(_0x3bc278){if(!_0x3bc278['name']||_0x3bc278['name']!==_0xd63a('0x34')){logger['error'](util[_0xd63a('0x13')](_0xd63a('0x35'),_0x2a1e86['id']),util[_0xd63a('0x36')](_0x3bc278,{'showHidden':![],'depth':null}));}}_0x2fd204();});});}function checkTranscribe(){var _0x5cff6b;var _0xbe579b;var _0x78d162;return db['VoiceRecording'][_0xd63a('0x37')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x1f6427){if(!_0x1f6427||!_0x1f6427[_0xd63a('0x17')]){throw new db[(_0xd63a('0x1f'))]['ValidationError'](_0xd63a('0x38'));}_0x5cff6b=_0x1f6427;return db[_0xd63a('0x39')][_0xd63a('0x23')]({'where':{'id':0x1}});})[_0xd63a('0xc')](function(_0x11fa4d){if(!_0x11fa4d){throw new db[(_0xd63a('0x1f'))][(_0xd63a('0x31'))]('Settings\x20not\x20available');}_0xbe579b=_0x11fa4d;if(!_0xbe579b[_0xd63a('0x2')]||!_0xbe579b[_0xd63a('0x3a')]||!_0xbe579b[_0xd63a('0xb')]||!_0xbe579b['language']||!_0xbe579b[_0xd63a('0x1e')]){throw new db['Sequelize'][(_0xd63a('0x31'))](_0xd63a('0x3b'));}return db[_0xd63a('0x22')][_0xd63a('0x23')]({'where':{'id':_0xbe579b[_0xd63a('0x3a')]}});})['then'](function(_0x1266bf){if(!_0x1266bf){throw new db['Sequelize']['ValidationError'](_0xd63a('0x24'));}if(!_0x1266bf[_0xd63a('0x9')]||!_0x1266bf[_0xd63a('0xa')]){throw new db[(_0xd63a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x78d162=_0x1266bf;var _0x13f777=[];_0x5cff6b[_0xd63a('0x3c')](function(_0x8d48c5){_0x13f777[_0xd63a('0x3d')](checkTranscribeJob(_0x8d48c5,_0xbe579b,_0x78d162));});return BPromise[_0xd63a('0x3e')](_0x13f777);})[_0xd63a('0x3f')](function(_0x1c2372){if(_0x1c2372){if(!_0x1c2372[_0xd63a('0x40')]||_0x1c2372['name']!==_0xd63a('0x34')){logger[_0xd63a('0x41')](util[_0xd63a('0x36')](_0x1c2372,{'showHidden':![],'depth':null}));}}});}exports[_0xd63a('0x42')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb01a=['transcribeName','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','language','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','SequelizeValidationError','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','substring','info','format','transcribeRegion','then'];(function(_0xb8acdd,_0x11b6bc){var _0x41ea5f=function(_0x32824d){while(--_0x32824d){_0xb8acdd['push'](_0xb8acdd['shift']());}};_0x41ea5f(++_0x11b6bc);}(_0xb01a,0x1a1));var _0xab01=function(_0xb6ca7d,_0x1fffc5){_0xb6ca7d=_0xb6ca7d-0x0;var _0x418d19=_0xb01a[_0xb6ca7d];return _0x418d19;};var _=require(_0xab01('0x0'));var AWS=require(_0xab01('0x1'));var rp=require(_0xab01('0x2'));var util=require(_0xab01('0x3'));var BPromise=require(_0xab01('0x4'));var db=require(_0xab01('0x5'))['db'];var logger=require(_0xab01('0x6'))(_0xab01('0x7'));function getTranscriptionJob(_0x472445,_0x3713b6,_0x257db6,_0x47103c){return new Promise(function(_0x22db85,_0x5d8dd9){var _0x13957f=new AWS[(_0xab01('0x8'))]({'accessKeyId':_0x3713b6,'secretAccessKey':_0x472445,'region':_0x257db6});_0x13957f['getTranscriptionJob']({'TranscriptionJobName':_0x47103c},function(_0x52146e,_0x71864b){if(_0x52146e){return _0x5d8dd9(_0x52146e);}else{return _0x22db85(_0x71864b);}});});}function sentiment(_0x13f309,_0x5bc6e9,_0x1a2b45,_0x48be78,_0x57b047){return new Promise(function(_0x434bf3,_0x5c0122){var _0x2bac1d=new AWS[(_0xab01('0x9'))]({'accessKeyId':_0x5bc6e9,'secretAccessKey':_0x13f309,'region':_0x1a2b45});_0x2bac1d['detectSentiment']({'Text':_0x48be78,'LanguageCode':_0x57b047[_0xab01('0xa')](0x0,0x2)},function(_0x515eda,_0x5d9bbd){if(_0x515eda){return _0x5c0122(_0x515eda);}else{return _0x434bf3(_0x5d9bbd);}});});}function checkTranscribeJob(_0x3410a1,_0x37088b,_0x1ededa){var _0xe9d23c;return new BPromise(function(_0x449402,_0x215a9e){logger[_0xab01('0xb')](util[_0xab01('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3410a1['id'],_0x3410a1['transcribeName']));return getTranscriptionJob(_0x1ededa['data1'],_0x1ededa['data2'],_0x37088b[_0xab01('0xd')],_0x3410a1['transcribeName'])[_0xab01('0xe')](function(_0x2d9c23){logger[_0xab01('0xb')](util[_0xab01('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3410a1['id'],_0x3410a1[_0xab01('0xf')],_0x2d9c23['TranscriptionJob'][_0xab01('0x10')]));if(!_0x3410a1[_0xab01('0x11')]){switch(_0x2d9c23['TranscriptionJob']['TranscriptionJobStatus']){case _0xab01('0x12'):var _0xcd917d={'transcribeStatus':_0x2d9c23[_0xab01('0x13')][_0xab01('0x10')],'fileUri':_0x2d9c23[_0xab01('0x13')][_0xab01('0x14')][_0xab01('0x15')]};logger[_0xab01('0xb')](util[_0xab01('0xc')](_0xab01('0x16'),_0x3410a1['id']));return rp({'uri':_0x2d9c23['TranscriptionJob'][_0xab01('0x14')][_0xab01('0x15')],'json':!![]})[_0xab01('0xe')](function(_0xac3a88){logger[_0xab01('0xb')](util[_0xab01('0xc')](_0xab01('0x17'),_0x3410a1['id']));if(_0xac3a88&&_0xac3a88[_0xab01('0x18')]&&_0xac3a88['results'][_0xab01('0x19')]&&_0xac3a88[_0xab01('0x18')][_0xab01('0x19')][_0xab01('0x1a')]){_0xcd917d[_0xab01('0x11')]='';for(var _0x1ebc65=0x0;_0x1ebc65<_0xac3a88[_0xab01('0x18')]['transcripts'][_0xab01('0x1a')];_0x1ebc65++){_0xcd917d[_0xab01('0x11')]+=_0xac3a88[_0xab01('0x18')][_0xab01('0x19')][_0x1ebc65][_0xab01('0x1b')]+'';}}return _0x3410a1[_0xab01('0x1c')](_0xcd917d);})[_0xab01('0xe')](function(){logger['info'](util[_0xab01('0xc')](_0xab01('0x1d'),_0x3410a1['id']));if(!_0x3410a1[_0xab01('0x1e')]){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x21'));}if(!_0x37088b['sentiment']||!_0x37088b[_0xab01('0x22')]||!_0x37088b[_0xab01('0x23')]||!_0x37088b['language']||!_0x37088b[_0xab01('0x24')]){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x25'));}if(!_0xcd917d[_0xab01('0x11')]){throw new Error(_0xab01('0x26'));}if(_0x37088b[_0xab01('0x22')]===_0x1ededa['id']){return _0x1ededa;}else{return db[_0xab01('0x27')]['findOne']({'where':{'id':_settings[_0xab01('0x22')]}});}})[_0xab01('0xe')](function(_0x51a120){if(!_0x51a120){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x28'));}if(!_0x51a120[_0xab01('0x29')]||!_0x51a120[_0xab01('0x2a')]){throw new db[(_0xab01('0x1f'))]['ValidationError'](_0xab01('0x2b'));}_0xe9d23c=_0x51a120;logger[_0xab01('0xb')](util[_0xab01('0xc')](_0xab01('0x2c'),_0x3410a1['id']));return sentiment(_0xe9d23c[_0xab01('0x29')],_0xe9d23c[_0xab01('0x2a')],_0x37088b[_0xab01('0x23')],_0xcd917d['fileText'],_0x37088b['language']);})['then'](function(_0x43594c){logger[_0xab01('0xb')](util[_0xab01('0xc')](_0xab01('0x2d'),_0x3410a1['id']));return _0x3410a1[_0xab01('0x1c')]({'sentiment':_0x43594c[_0xab01('0x2e')],'sPositive':_0x43594c[_0xab01('0x2f')][_0xab01('0x30')],'sNegative':_0x43594c[_0xab01('0x2f')][_0xab01('0x31')],'sMixed':_0x43594c[_0xab01('0x2f')][_0xab01('0x32')],'sNeutral':_0x43594c[_0xab01('0x2f')][_0xab01('0x33')]});})[_0xab01('0xe')](function(){logger[_0xab01('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3410a1['id']));_0x449402();});case _0xab01('0x34'):return _0x3410a1[_0xab01('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x2d9c23[_0xab01('0x13')][_0xab01('0x35')]})[_0xab01('0xe')](function(){logger['info'](util[_0xab01('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3410a1['id']));_0x449402();});default:logger['info'](util[_0xab01('0xc')](_0xab01('0x36'),_0x3410a1['id']));break;}}else{return BPromise['resolve']()[_0xab01('0xe')](function(){if(!_0x3410a1[_0xab01('0x1e')]){throw new db['Sequelize'][(_0xab01('0x20'))](_0xab01('0x21'));}if(!_0x37088b[_0xab01('0x37')]||!_0x37088b[_0xab01('0x22')]||!_0x37088b[_0xab01('0x23')]||!_0x37088b[_0xab01('0x38')]||!_0x37088b['bucket']){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x25'));}if(!_0x3410a1[_0xab01('0x11')]){throw new Error(_0xab01('0x26'));}if(_0x37088b['sentimentAccountId']===_0x1ededa['id']){return _0x1ededa;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xab01('0x22')]}});}})[_0xab01('0xe')](function(_0x520182){if(!_0x520182){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x28'));}if(!_0x520182[_0xab01('0x29')]||!_0x520182[_0xab01('0x2a')]){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x2b'));}_0xe9d23c=_0x520182;logger[_0xab01('0xb')](util[_0xab01('0xc')](_0xab01('0x2c'),_0x3410a1['id']));return sentiment(_0xe9d23c[_0xab01('0x29')],_0xe9d23c[_0xab01('0x2a')],_0x37088b[_0xab01('0x23')],_0x3410a1[_0xab01('0x11')],_0x37088b[_0xab01('0x38')]);})[_0xab01('0xe')](function(_0x518c6b){logger['info'](util[_0xab01('0xc')](_0xab01('0x2d'),_0x3410a1['id']));return _0x3410a1[_0xab01('0x1c')]({'sentiment':_0x518c6b[_0xab01('0x2e')],'sPositive':_0x518c6b[_0xab01('0x2f')][_0xab01('0x30')],'sNegative':_0x518c6b['SentimentScore'][_0xab01('0x31')],'sMixed':_0x518c6b[_0xab01('0x2f')]['Mixed'],'sNeutral':_0x518c6b[_0xab01('0x2f')][_0xab01('0x33')],'transcribeStatus':_0xab01('0x12')});})['then'](function(){logger[_0xab01('0xb')](util[_0xab01('0xc')](_0xab01('0x1d'),_0x3410a1['id']));_0x449402();});}})[_0xab01('0x39')](function(_0x3fcd0f){if(_0x3fcd0f){if(!_0x3fcd0f['name']||_0x3fcd0f[_0xab01('0x3a')]!=='SequelizeValidationError'){logger[_0xab01('0x3b')](util[_0xab01('0xc')](_0xab01('0x3c'),_0x3410a1['id']),util['inspect'](_0x3fcd0f,{'showHidden':![],'depth':null}));}}_0x449402();});});}function checkTranscribe(){var _0xc3fe64;var _0x247261;var _0x46e255;return db[_0xab01('0x3d')]['findAll']({'where':{'transcribeStatus':_0xab01('0x3e')}})[_0xab01('0xe')](function(_0x13802e){if(!_0x13802e||!_0x13802e[_0xab01('0x1a')]){throw new db[(_0xab01('0x1f'))]['ValidationError'](_0xab01('0x3f'));}_0xc3fe64=_0x13802e;return db[_0xab01('0x40')]['findOne']({'where':{'id':0x1}});})[_0xab01('0xe')](function(_0x32fd3d){if(!_0x32fd3d){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x41'));}_0x247261=_0x32fd3d;if(!_0x247261[_0xab01('0x7')]||!_0x247261[_0xab01('0x42')]||!_0x247261['transcribeRegion']||!_0x247261['language']||!_0x247261[_0xab01('0x24')]){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x43'));}return db['CloudProvider']['findOne']({'where':{'id':_0x247261[_0xab01('0x42')]}});})[_0xab01('0xe')](function(_0x1f1b6f){if(!_0x1f1b6f){throw new db[(_0xab01('0x1f'))][(_0xab01('0x20'))](_0xab01('0x28'));}if(!_0x1f1b6f[_0xab01('0x29')]||!_0x1f1b6f['data2']){throw new db['Sequelize'][(_0xab01('0x20'))](_0xab01('0x2b'));}_0x46e255=_0x1f1b6f;var _0x384cc6=[];_0xc3fe64[_0xab01('0x44')](function(_0x3eba5e){_0x384cc6['push'](checkTranscribeJob(_0x3eba5e,_0x247261,_0x46e255));});return BPromise['all'](_0x384cc6);})['catch'](function(_0x6e55f4){if(_0x6e55f4){if(!_0x6e55f4[_0xab01('0x3a')]||_0x6e55f4[_0xab01('0x3a')]!==_0xab01('0x45')){logger[_0xab01('0x3b')](util[_0xab01('0x46')](_0x6e55f4,{'showHidden':![],'depth':null}));}}});}exports[_0xab01('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 22d297d..877f4ca 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 _0xff7c=['lodash','moment','util','../../config/environment','../../mysqldb','../logger','defaults','socket.io-emitter','redis','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xff7c,0x1d4));var _0xcff7=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xff7c[_0x566bdf];return _0x331215;};'use strict';var _=require(_0xcff7('0x0'));var moment=require(_0xcff7('0x1'));var Redis=require('ioredis');var util=require(_0xcff7('0x2'));var config=require(_0xcff7('0x3'));var db=require(_0xcff7('0x4'))['db'];var logger=require(_0xcff7('0x5'))('schedule');config['redis']=_[_0xcff7('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xcff7('0x7'))(new Redis(config[_0xcff7('0x8')]));function closeInteractions(){var _0xdd3a13=[];return db[_0xcff7('0x9')][_0xcff7('0xa')]({'raw':!![],'attributes':['id',_0xcff7('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xcff7('0xc')](0x18,'hours')}}})[_0xcff7('0xd')](function(_0x768ae){if(_0x768ae&&_0x768ae[_0xcff7('0xe')]){_0xdd3a13=_[_0xcff7('0xf')](_0x768ae||[],'id');logger[_0xcff7('0x10')](_0xcff7('0x11'),_0xdd3a13[_0xcff7('0x12')]());return db[_0xcff7('0x9')]['update']({'closeReason':'system','disposition':_0xcff7('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xdd3a13}});}})[_0xcff7('0xd')](function(){if(_0xdd3a13&&_0xdd3a13[_0xcff7('0xe')]){logger[_0xcff7('0x10')](_0xcff7('0x14'),_0xdd3a13['join']());for(var _0x3aa258=0x0;_0x3aa258<_0xdd3a13['length'];_0x3aa258++){io[_0xcff7('0x15')](_0xcff7('0x16'),{'id':_0xdd3a13[_0x3aa258],'closed':!![]});}}})[_0xcff7('0x17')](function(_0x57dee2){logger[_0xcff7('0x18')](_0xcff7('0x19'),_0x57dee2?util['inspect'](_0x57dee2,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xea89=['ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment'];(function(_0x5634f7,_0x2154de){var _0x4a65aa=function(_0x20acfe){while(--_0x20acfe){_0x5634f7['push'](_0x5634f7['shift']());}};_0x4a65aa(++_0x2154de);}(_0xea89,0xfa));var _0x9ea8=function(_0x439403,_0x2c9db9){_0x439403=_0x439403-0x0;var _0x5d4cab=_0xea89[_0x439403];return _0x5d4cab;};'use strict';var _=require(_0x9ea8('0x0'));var moment=require(_0x9ea8('0x1'));var Redis=require(_0x9ea8('0x2'));var util=require(_0x9ea8('0x3'));var config=require(_0x9ea8('0x4'));var db=require(_0x9ea8('0x5'))['db'];var logger=require(_0x9ea8('0x6'))(_0x9ea8('0x7'));config['redis']=_[_0x9ea8('0x8')](config[_0x9ea8('0x9')],{'host':_0x9ea8('0xa'),'port':0x18eb});var io=require(_0x9ea8('0xb'))(new Redis(config[_0x9ea8('0x9')]));function closeInteractions(){var _0x2f7b38=[];return db[_0x9ea8('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x9ea8('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x9ea8('0xe'))}}})[_0x9ea8('0xf')](function(_0xd2435){if(_0xd2435&&_0xd2435[_0x9ea8('0x10')]){_0x2f7b38=_[_0x9ea8('0x11')](_0xd2435||[],'id');logger[_0x9ea8('0x12')](_0x9ea8('0x13'),_0x2f7b38['join']());return db[_0x9ea8('0xc')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x9ea8('0x14')](_0x9ea8('0x15'))},{'where':{'id':_0x2f7b38}});}})[_0x9ea8('0xf')](function(){if(_0x2f7b38&&_0x2f7b38[_0x9ea8('0x10')]){logger[_0x9ea8('0x12')](_0x9ea8('0x16'),_0x2f7b38['join']());for(var _0x427c7f=0x0;_0x427c7f<_0x2f7b38[_0x9ea8('0x10')];_0x427c7f++){io[_0x9ea8('0x17')]('whatsappInteraction:update',{'id':_0x2f7b38[_0x427c7f],'closed':!![]});}}})[_0x9ea8('0x18')](function(_0x3cfcee){logger[_0x9ea8('0x19')](_0x9ea8('0x1a'),_0x3cfcee?util[_0x9ea8('0x1b')](_0x3cfcee,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 0878538..f4c6a7b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4c2=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then'];(function(_0x45db5a,_0x1d4bd4){var _0x326d9c=function(_0x3a7ba6){while(--_0x3a7ba6){_0x45db5a['push'](_0x45db5a['shift']());}};_0x326d9c(++_0x1d4bd4);}(_0xc4c2,0xaa));var _0x2c4c=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xc4c2[_0xc67528];return _0x38e26d;};'use strict';var util=require('util');var db=require(_0x2c4c('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2c4c('0x1')]({'id':i,'firstName':_0x2c4c('0x2')+i,'lastName':_0x2c4c('0x3')+i,'phone':0xf879fb460+i,'email':_0x2c4c('0x4')+i+_0x2c4c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2c4c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2c4c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c4c('0x6')](),'updatedAt':Date[_0x2c4c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2c4c('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2c4c('0x4')+i+_0x2c4c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2c4c('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2c4c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2c4c('0x6')](),'updatedAt':Date[_0x2c4c('0x6')]()});}db[_0x2c4c('0x7')][_0x2c4c('0x8')]({'where':{}})[_0x2c4c('0x9')](function(){return db[_0x2c4c('0x7')][_0x2c4c('0xa')](contacts);})[_0x2c4c('0x9')](function(){console[_0x2c4c('0xb')](_0x2c4c('0xc'),_0x2c4c('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0x2c4c('0x9')](function(){return db[_0x2c4c('0xe')][_0x2c4c('0xa')](hopper);})[_0x2c4c('0x9')](function(){console[_0x2c4c('0xb')](_0x2c4c('0xc'),_0x2c4c('0xf'));return db[_0x2c4c('0x7')][_0x2c4c('0xa')](contacts2);})['then'](function(){console[_0x2c4c('0xb')](_0x2c4c('0xc'),_0x2c4c('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x2c4c('0x9')](function(){console['log'](_0x2c4c('0xc'),'hopper2');})[_0x2c4c('0x11')](function(_0x109f3f){console[_0x2c4c('0xb')](_0x109f3f);}); \ No newline at end of file +var _0x4991=['util','../mysqldb','Innocenzo','innocenzo.biondo','now','Biondo','@xcally.com','push','destroy','then','CmContact','bulkCreate','finished\x20populating','CmHopper','hopper1','contacts2','log','hopper2','catch'];(function(_0x2591e0,_0xc78dbc){var _0x59f1ff=function(_0x433244){while(--_0x433244){_0x2591e0['push'](_0x2591e0['shift']());}};_0x59f1ff(++_0xc78dbc);}(_0x4991,0x72));var _0x1499=function(_0x2e1b00,_0x286b4e){_0x2e1b00=_0x2e1b00-0x0;var _0x545829=_0x4991[_0x2e1b00];return _0x545829;};'use strict';var util=require(_0x1499('0x0'));var db=require(_0x1499('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1499('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x1499('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x1499('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1499('0x4')](),'updatedAt':Date[_0x1499('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x1499('0x2')+i,'lastName':_0x1499('0x5')+i,'phone':0xf879fb460+i,'email':_0x1499('0x3')+i+_0x1499('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1499('0x7')]({'id':i,'active':![],'scheduledat':Date[_0x1499('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1499('0x4')](),'updatedAt':Date[_0x1499('0x4')]()});}db['CmContact'][_0x1499('0x8')]({'where':{}})[_0x1499('0x9')](function(){return db[_0x1499('0xa')][_0x1499('0xb')](contacts);})[_0x1499('0x9')](function(){console['log'](_0x1499('0xc'),'contacts1');return db[_0x1499('0xd')]['destroy']({'where':{}});})['then'](function(){return db[_0x1499('0xd')][_0x1499('0xb')](hopper);})[_0x1499('0x9')](function(){console['log']('finished\x20populating',_0x1499('0xe'));return db['CmContact'][_0x1499('0xb')](contacts2);})[_0x1499('0x9')](function(){console['log'](_0x1499('0xc'),_0x1499('0xf'));return db[_0x1499('0xd')][_0x1499('0xb')](hopper2);})[_0x1499('0x9')](function(){console[_0x1499('0x10')](_0x1499('0xc'),_0x1499('0x11'));})[_0x1499('0x12')](function(_0x20e657){console[_0x1499('0x10')](_0x20e657);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 0de757e..1eba47f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f4e=['format','%s%s','%s%s@xcally.com','agent','friend','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1f4e,0x1ca));var _0xe1f4=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0x1f4e[_0x493cea];return _0x1c32ba;};'use strict';var util=require(_0xe1f4('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe1f4('0x1')]('%s%s','agent',i),'fullname':util[_0xe1f4('0x1')](_0xe1f4('0x2'),'agent',i),'email':util[_0xe1f4('0x1')](_0xe1f4('0x3'),'agent',i),'role':_0xe1f4('0x4'),'password':'password','internal':0xfa0+i,'type':_0xe1f4('0x5'),'transport':['udp','ws','wss'],'disallow':[_0xe1f4('0x6')],'allow':['ulaw'],'defaultuser':util[_0xe1f4('0x1')](_0xe1f4('0x2'),_0xe1f4('0x4'),i),'encryption':'yes','avpf':_0xe1f4('0x7'),'force_avp':_0xe1f4('0x7'),'icesupport':_0xe1f4('0x7'),'dtlsenable':_0xe1f4('0x7'),'dtlsverify':'no','dtlscertfile':_0xe1f4('0x8'),'dtlsprivatekey':_0xe1f4('0x9'),'dtlssetup':_0xe1f4('0xa'),'callerid':util[_0xe1f4('0x1')](_0xe1f4('0xb'),util[_0xe1f4('0x1')]('%s%s','agent',i),0xfa0+i)});}db['User'][_0xe1f4('0xc')](users)[_0xe1f4('0xd')](function(){console[_0xe1f4('0xe')](_0xe1f4('0xf'));})[_0xe1f4('0x10')](function(_0x3276a4){console[_0xe1f4('0xe')](_0x3276a4);}); \ No newline at end of file +var _0xa9e8=['yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0xdd4256,_0x332969){var _0x8b7475=function(_0x52834c){while(--_0x52834c){_0xdd4256['push'](_0xdd4256['shift']());}};_0x8b7475(++_0x332969);}(_0xa9e8,0xfb));var _0x8a9e=function(_0x19bb73,_0x103ad5){_0x19bb73=_0x19bb73-0x0;var _0x2ea3ba=_0xa9e8[_0x19bb73];return _0x2ea3ba;};'use strict';var util=require(_0x8a9e('0x0'));var db=require(_0x8a9e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8a9e('0x2')]({'name':util[_0x8a9e('0x3')](_0x8a9e('0x4'),'agent',i),'fullname':util[_0x8a9e('0x3')](_0x8a9e('0x4'),_0x8a9e('0x5'),i),'email':util[_0x8a9e('0x3')](_0x8a9e('0x6'),_0x8a9e('0x5'),i),'role':_0x8a9e('0x5'),'password':_0x8a9e('0x7'),'internal':0xfa0+i,'type':_0x8a9e('0x8'),'transport':[_0x8a9e('0x9'),'ws',_0x8a9e('0xa')],'disallow':[_0x8a9e('0xb')],'allow':[_0x8a9e('0xc')],'defaultuser':util[_0x8a9e('0x3')]('%s%s',_0x8a9e('0x5'),i),'encryption':'yes','avpf':_0x8a9e('0xd'),'force_avp':_0x8a9e('0xd'),'icesupport':_0x8a9e('0xd'),'dtlsenable':_0x8a9e('0xd'),'dtlsverify':'no','dtlscertfile':_0x8a9e('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x8a9e('0xf'),'callerid':util[_0x8a9e('0x3')](_0x8a9e('0x10'),util[_0x8a9e('0x3')](_0x8a9e('0x4'),'agent',i),0xfa0+i)});}db[_0x8a9e('0x11')][_0x8a9e('0x12')](users)[_0x8a9e('0x13')](function(){console['log']('add\x20user');})[_0x8a9e('0x14')](function(_0x4a179d){console[_0x8a9e('0x15')](_0x4a179d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 79f3a22..4c953ff 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcde=['type','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','Trunks','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','map','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','catch','log','join','address','connection','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','../mysqldb','./environment','name','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','User','where','telephone','Campaign'];(function(_0x48e515,_0x598084){var _0x1b4d16=function(_0x3d37e9){while(--_0x3d37e9){_0x48e515['push'](_0x48e515['shift']());}};_0x1b4d16(++_0x598084);}(_0xdcde,0x1d0));var _0xedcd=function(_0x134796,_0x5aeb0d){_0x134796=_0x134796-0x0;var _0x388846=_0xdcde[_0x134796];return _0x388846;};'use strict';var _=require(_0xedcd('0x0'));var util=require(_0xedcd('0x1'));var BPromise=require('bluebird');var db=require(_0xedcd('0x2'))['db'];var config=require(_0xedcd('0x3'));var queryQueues={'attributes':['id',_0xedcd('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0xedcd('0x5')],'raw':!![],'where':{'role':_0xedcd('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xedcd('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xedcd('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xedcd('0x4')],'where':{'role':_0xedcd('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xedcd('0x4'),'type'],'where':{'type':_0xedcd('0x7')}};function getAssociatedResources(_0x2ce75a,_0x35e647,_0x263453){return db[_0xedcd('0x8')][_0xedcd('0x9')]({'where':{'name':_0x2ce75a,'userProfileId':_0x35e647},'raw':!![]})[_0xedcd('0xa')](function(_0x20128d){if(_0x20128d){if(_0x20128d[_0xedcd('0xb')]){switch(_0x2ce75a){case _0xedcd('0xc'):case _0xedcd('0xd'):case _0xedcd('0xe'):case _0xedcd('0xf'):case _0xedcd('0x10'):case _0xedcd('0x11'):case _0xedcd('0x12'):return db[_0x263453]['findAll'](queryQueues);case _0xedcd('0x13'):return db[_0x263453][_0xedcd('0x14')](queryTelephones);case'Trunks':return db[_0x263453][_0xedcd('0x14')](queryTrunks);case _0xedcd('0x15'):return db[_0x263453]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xedcd('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x20128d['id']},'raw':!![]})['then'](function(_0x4091b3){if(_0x4091b3){var _0x39a87a={'where':{'id':_['map'](_0x4091b3,'resourceId')},'raw':!![]};switch(_0x263453){case _0xedcd('0x16'):_0x39a87a[_0xedcd('0x17')]['role']=_0xedcd('0x18');break;case _0xedcd('0x19'):_0x39a87a[_0xedcd('0x17')][_0xedcd('0x1a')]='ivr';break;}return db[_0x263453]['findAll'](_0x39a87a);}else{return[];}});}}else{return[];}})[_0xedcd('0xa')](function(_0x23d850){return _0x23d850;});}function joinOrLeaveQueues(_0x4151ac,_0x32d07f,_0x5b33d8,_0x398654){_0x4151ac[_0x32d07f](util[_0xedcd('0x1b')](_0xedcd('0x1c'),_0x5b33d8,_0x398654['name']));if(_0x398654[_0xedcd('0x1d')]){for(var _0x506c11=0x0;_0x506c11<_0x398654[_0xedcd('0x1d')][_0xedcd('0x1e')];_0x506c11+=0x1){_0x4151ac[_0x32d07f](util[_0xedcd('0x1b')](_0xedcd('0x1f'),_0x398654[_0xedcd('0x1d')][_0x506c11]['name']));}}}function joinOrLeave(_0x4e7360,_0x41e13d,_0xed7aed){var _0x1b51d9;if(_0x4e7360['handshake'][_0xedcd('0x20')]['id']){db['User'][_0xedcd('0x21')]({'attributes':['id',_0xedcd('0x4'),_0xedcd('0x5'),_0xedcd('0x22')],'where':{'id':_0x4e7360[_0xedcd('0x23')]['query']['id']},'include':[{'model':db[_0xedcd('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x25')],'as':_0xedcd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x27')],'as':_0xedcd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x29')],'as':_0xedcd('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x2b')],'as':_0xedcd('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xedcd('0x2d')],'as':_0xedcd('0x2e'),'attributes':['id'],'raw':!![]}]})[_0xedcd('0xa')](function(_0x561b14){if(_0x561b14){_0x1b51d9=_0x561b14;_0x4e7360[_0x41e13d](util[_0xedcd('0x1b')](_0xedcd('0x1f'),_0x561b14[_0xedcd('0x4')]));var _0x517ec0=[];switch(_0x561b14[_0xedcd('0x5')]){case _0xedcd('0x2f'):_0x4e7360[_0x41e13d](_0xedcd('0x30'));_0x4e7360[_0x41e13d]('voice:outbound');if(queryQueues[_0xedcd('0x31')]('include')){delete queryQueues[_0xedcd('0x32')];}_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x34')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x35')]['findAll'](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x36')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x37')]['findAll'](queryQueues));_0x517ec0['push'](db[_0xedcd('0x38')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x39')][_0xedcd('0x14')](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x3a')]['findAll'](queryQueues));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x16')]['findAll'](queryTelephones));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x3b')][_0xedcd('0x14')](queryTrunks));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x19')][_0xedcd('0x14')](queryCampaigns));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x16')]['findAll'](queryAgents));break;case'user':_0x4e7360[_0x41e13d](_0xedcd('0x30'));_0x4e7360[_0x41e13d](_0xedcd('0x3c'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources('VoiceQueues',_0x561b14[_0xedcd('0x22')],'VoiceQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0xd'),_0x561b14[_0xedcd('0x22')],'ChatQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0xe'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x36')));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0xf'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x37')));_0x517ec0['push'](getAssociatedResources(_0xedcd('0x10'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x38')));_0x517ec0['push'](getAssociatedResources('OpenchannelQueues',_0x561b14[_0xedcd('0x22')],'OpenchannelQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0x12'),_0x561b14['userProfileId'],'WhatsappQueue'));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0x13'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x16')));_0x517ec0[_0xedcd('0x33')](getAssociatedResources(_0xedcd('0x3d'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x3b')));_0x517ec0['push'](getAssociatedResources(_0xedcd('0x15'),_0x561b14[_0xedcd('0x22')],_0xedcd('0x19')));_0x517ec0[_0xedcd('0x33')](db[_0xedcd('0x16')]['findAll'](queryAgents));break;case _0xedcd('0x6'):_0x4e7360[_0x41e13d]('voice:inbound');_0x4e7360[_0x41e13d]('voice:outbound');_0x517ec0[_0xedcd('0x33')](_0x561b14['getVoiceQueues']({'attributes':['id','name']}));_0x517ec0['push'](_0x561b14[_0xedcd('0x3e')]({'attributes':['id','name']}));_0x517ec0['push'](_0x561b14[_0xedcd('0x3f')]({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0[_0xedcd('0x33')](_0x561b14['getSmsQueues']({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0[_0xedcd('0x33')](_0x561b14[_0xedcd('0x40')]({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0['push'](_0x561b14[_0xedcd('0x41')]({'attributes':['id',_0xedcd('0x4')]}));_0x517ec0['push'](_0x561b14[_0xedcd('0x42')]({'attributes':['id',_0xedcd('0x4')]}));break;}return BPromise[_0xedcd('0x43')](_0x517ec0);}})[_0xedcd('0xa')](function(_0x3e754a){if(_0x3e754a&&_0x3e754a[_0xedcd('0x1e')]){for(var _0x19893f=0x0;_0x19893f<_0x3e754a[_0xedcd('0x1e')];_0x19893f+=0x1){for(var _0x5a113a=0x0;_0x5a113a<_0x3e754a[_0x19893f][_0xedcd('0x1e')];_0x5a113a+=0x1){switch(_0x19893f){case 0x0:joinOrLeaveQueues(_0x4e7360,_0x41e13d,'voice',_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x1:joinOrLeaveQueues(_0x4e7360,_0x41e13d,'chat',_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x2:joinOrLeaveQueues(_0x4e7360,_0x41e13d,'fax',_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x3:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x44'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x4:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x45'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x5:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x46'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x6:joinOrLeaveQueues(_0x4e7360,_0x41e13d,_0xedcd('0x47'),_0x3e754a[_0x19893f][_0x5a113a]);break;case 0x7:if(_0x1b51d9[_0xedcd('0x5')]!==_0xedcd('0x6'))_0x4e7360[_0x41e13d](util['format'](_0xedcd('0x48'),_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x4')]));break;case 0x8:if(_0x1b51d9[_0xedcd('0x5')]!==_0xedcd('0x6'))_0x4e7360[_0x41e13d](util[_0xedcd('0x1b')](_0xedcd('0x49'),_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x4')]));break;case 0x9:if(_0x1b51d9[_0xedcd('0x5')]!==_0xedcd('0x6'))_0x4e7360[_0x41e13d](util['format'](_0xedcd('0x4a'),_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x1a')],_0x3e754a[_0x19893f][_0x5a113a][_0xedcd('0x4')]));break;case 0xa:_0x4e7360[_0x41e13d](util[_0xedcd('0x1b')](_0xedcd('0x1f'),_0x3e754a[_0x19893f][_0x5a113a]['name']));break;}}}}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x271c82=_['map'](_0x1b51d9[_0xedcd('0x4c')],'id');return _0x1b51d9[_0xedcd('0x4d')](_0x271c82)['then'](function(){for(var _0x1c5c95=0x0;_0x1c5c95<_0x271c82['length'];_0x1c5c95+=0x1){_0xed7aed[_0xedcd('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x271c82[_0x1c5c95]),'UserId':Number(_0x1b51d9['id'])});}});}})['then'](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x4a5b7f=_['map'](_0x1b51d9[_0xedcd('0x26')],'id');return _0x1b51d9[_0xedcd('0x4f')](_0x4a5b7f)[_0xedcd('0xa')](function(){for(var _0x12dafb=0x0;_0x12dafb<_0x4a5b7f[_0xedcd('0x1e')];_0x12dafb+=0x1){_0xed7aed[_0xedcd('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4a5b7f[_0x12dafb]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x55daec=_[_0xedcd('0x50')](_0x1b51d9[_0xedcd('0x28')],'id');return _0x1b51d9['removeFaxInteractions'](_0x55daec)[_0xedcd('0xa')](function(){for(var _0x52c861=0x0;_0x52c861<_0x55daec[_0xedcd('0x1e')];_0x52c861+=0x1){_0xed7aed[_0xedcd('0x4e')](_0xedcd('0x51'),{'FaxInteractionId':Number(_0x55daec[_0x52c861]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x55fb79=_[_0xedcd('0x50')](_0x1b51d9['SmsInteractions'],'id');return _0x1b51d9[_0xedcd('0x52')](_0x55fb79)[_0xedcd('0xa')](function(){for(var _0x5ca493=0x0;_0x5ca493<_0x55fb79[_0xedcd('0x1e')];_0x5ca493+=0x1){_0xed7aed[_0xedcd('0x4e')](_0xedcd('0x53'),{'SmsInteractionId':Number(_0x55fb79[_0x5ca493]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0xa')](function(){if(_0x41e13d===_0xedcd('0x4b')){var _0x1d6f0f=_[_0xedcd('0x50')](_0x1b51d9['OpenchannelInteractions'],'id');return _0x1b51d9[_0xedcd('0x54')](_0x1d6f0f)[_0xedcd('0xa')](function(){for(var _0x2d5be3=0x0;_0x2d5be3<_0x1d6f0f[_0xedcd('0x1e')];_0x2d5be3+=0x1){_0xed7aed['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1d6f0f[_0x2d5be3]),'UserId':Number(_0x1b51d9['id'])});}});}})['then'](function(){if(_0x41e13d==='leave'){var _0x15fd72=_[_0xedcd('0x50')](_0x1b51d9[_0xedcd('0x2e')],'id');return _0x1b51d9[_0xedcd('0x55')](_0x15fd72)[_0xedcd('0xa')](function(){for(var _0x218c89=0x0;_0x218c89<_0x15fd72[_0xedcd('0x1e')];_0x218c89+=0x1){_0xed7aed[_0xedcd('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x15fd72[_0x218c89]),'UserId':Number(_0x1b51d9['id'])});}});}})[_0xedcd('0x56')](function(_0x1fa189){_0x4e7360[_0xedcd('0x57')](_0x1fa189);});}}function onDisconnect(_0x2d1b2f,_0x299fba){joinOrLeave(_0x2d1b2f,'leave',_0x299fba);}function onConnect(_0x4ebb41){joinOrLeave(_0x4ebb41,_0xedcd('0x58'));}exports['default']=function(_0x4d0305){_0x4d0305['on']('connection',function(_0x5de550){_0x5de550['setMaxListeners'](0x0);_0x5de550[_0xedcd('0x59')]=_0x5de550['request'][_0xedcd('0x5a')][_0xedcd('0x5b')]+':'+_0x5de550[_0xedcd('0x5c')]['connection'][_0xedcd('0x5d')];_0x5de550[_0xedcd('0x5e')]=new Date();_0x5de550[_0xedcd('0x57')]=function(_0x1aeff7){console['log'](_0xedcd('0x5f')+_0x5de550[_0xedcd('0x60')][_0xedcd('0x4')]+'['+_0x5de550[_0xedcd('0x59')]+']',_0x1aeff7);};_0x5de550['on'](_0xedcd('0x61'),function(){onDisconnect(_0x5de550,_0x4d0305);_0x5de550[_0xedcd('0x57')]('DISCONNECTED');});onConnect(_0x5de550);_0x5de550[_0xedcd('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0x9148=['MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','voice:outbound','FaxQueues','userProfileId','SmsQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','length','format','user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction'];(function(_0x508c97,_0x409158){var _0x463d56=function(_0x53a92d){while(--_0x53a92d){_0x508c97['push'](_0x508c97['shift']());}};_0x463d56(++_0x409158);}(_0x9148,0x10d));var _0x8914=function(_0x152555,_0x41966a){_0x152555=_0x152555-0x0;var _0x2d81d3=_0x9148[_0x152555];return _0x2d81d3;};'use strict';var _=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var BPromise=require(_0x8914('0x2'));var db=require(_0x8914('0x3'))['db'];var config=require(_0x8914('0x4'));var queryQueues={'attributes':['id',_0x8914('0x5')],'include':[{'as':_0x8914('0x6'),'model':db[_0x8914('0x7')],'attributes':['id',_0x8914('0x5'),_0x8914('0x8')],'raw':!![],'where':{'role':_0x8914('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8914('0xa')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x8914('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8914('0x5'),_0x8914('0xb')],'where':{'type':_0x8914('0xc')}};function getAssociatedResources(_0x45febb,_0x50484a,_0x2e7aac){return db[_0x8914('0xd')][_0x8914('0xe')]({'where':{'name':_0x45febb,'userProfileId':_0x50484a},'raw':!![]})[_0x8914('0xf')](function(_0x3e8af9){if(_0x3e8af9){if(_0x3e8af9['autoAssociation']){switch(_0x45febb){case _0x8914('0x10'):case _0x8914('0x11'):case'FaxQueues':case'SmsQueues':case _0x8914('0x12'):case _0x8914('0x13'):case _0x8914('0x14'):return db[_0x2e7aac][_0x8914('0x15')](queryQueues);case _0x8914('0x16'):return db[_0x2e7aac][_0x8914('0x15')](queryTelephones);case'Trunks':return db[_0x2e7aac][_0x8914('0x15')](queryTrunks);case _0x8914('0x17'):return db[_0x2e7aac]['findAll'](queryCampaigns);}}else{return db[_0x8914('0x18')][_0x8914('0x15')]({'attributes':[_0x8914('0x19')],'where':{'sectionId':_0x3e8af9['id']},'raw':!![]})[_0x8914('0xf')](function(_0x1d9609){if(_0x1d9609){var _0x3aa515={'where':{'id':_[_0x8914('0x1a')](_0x1d9609,_0x8914('0x19'))},'raw':!![]};switch(_0x2e7aac){case _0x8914('0x7'):_0x3aa515['where'][_0x8914('0x8')]=_0x8914('0xa');break;case _0x8914('0x1b'):_0x3aa515[_0x8914('0x1c')][_0x8914('0xb')]=_0x8914('0xc');break;}return db[_0x2e7aac][_0x8914('0x15')](_0x3aa515);}else{return[];}});}}else{return[];}})['then'](function(_0x20eca1){return _0x20eca1;});}function joinOrLeaveQueues(_0x404632,_0x53163a,_0x5de618,_0x3e4dcc){_0x404632[_0x53163a](util['format']('%s:queue:%s',_0x5de618,_0x3e4dcc[_0x8914('0x5')]));if(_0x3e4dcc[_0x8914('0x6')]){for(var _0x2d60c2=0x0;_0x2d60c2<_0x3e4dcc[_0x8914('0x6')][_0x8914('0x1d')];_0x2d60c2+=0x1){_0x404632[_0x53163a](util[_0x8914('0x1e')](_0x8914('0x1f'),_0x3e4dcc[_0x8914('0x6')][_0x2d60c2][_0x8914('0x5')]));}}}function joinOrLeave(_0x182327,_0x179b66,_0x41a901){var _0x14db21;if(_0x182327[_0x8914('0x20')][_0x8914('0x21')]['id']){db['User']['find']({'attributes':['id',_0x8914('0x5'),'role','userProfileId'],'where':{'id':_0x182327['handshake'][_0x8914('0x21')]['id']},'include':[{'model':db[_0x8914('0x22')],'as':_0x8914('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8914('0x24')],'as':_0x8914('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x8914('0x26')],'as':_0x8914('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8914('0x28')],'as':_0x8914('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x8914('0x2a')],'as':_0x8914('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x8914('0x2c')],'as':_0x8914('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x8914('0xf')](function(_0x26db69){if(_0x26db69){_0x14db21=_0x26db69;_0x182327[_0x179b66](util[_0x8914('0x1e')](_0x8914('0x1f'),_0x26db69[_0x8914('0x5')]));var _0x217afa=[];switch(_0x26db69['role']){case'admin':_0x182327[_0x179b66](_0x8914('0x2e'));_0x182327[_0x179b66]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x8914('0x2f'))){delete queryQueues['include'];}_0x217afa[_0x8914('0x30')](db[_0x8914('0x31')][_0x8914('0x15')](queryQueues));_0x217afa[_0x8914('0x30')](db[_0x8914('0x32')][_0x8914('0x15')](queryQueues));_0x217afa[_0x8914('0x30')](db[_0x8914('0x33')]['findAll'](queryQueues));_0x217afa[_0x8914('0x30')](db[_0x8914('0x34')][_0x8914('0x15')](queryQueues));_0x217afa[_0x8914('0x30')](db[_0x8914('0x35')]['findAll'](queryQueues));_0x217afa['push'](db[_0x8914('0x36')][_0x8914('0x15')](queryQueues));_0x217afa[_0x8914('0x30')](db['WhatsappQueue']['findAll'](queryQueues));_0x217afa[_0x8914('0x30')](db[_0x8914('0x7')][_0x8914('0x15')](queryTelephones));_0x217afa['push'](db[_0x8914('0x37')][_0x8914('0x15')](queryTrunks));_0x217afa['push'](db['Campaign'][_0x8914('0x15')](queryCampaigns));_0x217afa[_0x8914('0x30')](db[_0x8914('0x7')][_0x8914('0x15')](queryAgents));break;case'user':_0x182327[_0x179b66]('voice:inbound');_0x182327[_0x179b66](_0x8914('0x38'));_0x217afa[_0x8914('0x30')](getAssociatedResources(_0x8914('0x10'),_0x26db69['userProfileId'],_0x8914('0x31')));_0x217afa['push'](getAssociatedResources(_0x8914('0x11'),_0x26db69['userProfileId'],_0x8914('0x32')));_0x217afa[_0x8914('0x30')](getAssociatedResources(_0x8914('0x39'),_0x26db69[_0x8914('0x3a')],_0x8914('0x33')));_0x217afa['push'](getAssociatedResources(_0x8914('0x3b'),_0x26db69[_0x8914('0x3a')],_0x8914('0x34')));_0x217afa[_0x8914('0x30')](getAssociatedResources('MailQueues',_0x26db69[_0x8914('0x3a')],_0x8914('0x35')));_0x217afa['push'](getAssociatedResources(_0x8914('0x13'),_0x26db69[_0x8914('0x3a')],_0x8914('0x36')));_0x217afa[_0x8914('0x30')](getAssociatedResources(_0x8914('0x14'),_0x26db69[_0x8914('0x3a')],_0x8914('0x3c')));_0x217afa[_0x8914('0x30')](getAssociatedResources(_0x8914('0x16'),_0x26db69[_0x8914('0x3a')],_0x8914('0x7')));_0x217afa[_0x8914('0x30')](getAssociatedResources('Trunks',_0x26db69[_0x8914('0x3a')],'Trunk'));_0x217afa[_0x8914('0x30')](getAssociatedResources(_0x8914('0x17'),_0x26db69[_0x8914('0x3a')],_0x8914('0x1b')));_0x217afa[_0x8914('0x30')](db[_0x8914('0x7')][_0x8914('0x15')](queryAgents));break;case _0x8914('0x9'):_0x182327[_0x179b66]('voice:inbound');_0x182327[_0x179b66](_0x8914('0x38'));_0x217afa['push'](_0x26db69[_0x8914('0x3d')]({'attributes':['id','name']}));_0x217afa[_0x8914('0x30')](_0x26db69[_0x8914('0x3e')]({'attributes':['id',_0x8914('0x5')]}));_0x217afa[_0x8914('0x30')](_0x26db69[_0x8914('0x3f')]({'attributes':['id',_0x8914('0x5')]}));_0x217afa[_0x8914('0x30')](_0x26db69['getSmsQueues']({'attributes':['id','name']}));_0x217afa[_0x8914('0x30')](_0x26db69[_0x8914('0x40')]({'attributes':['id',_0x8914('0x5')]}));_0x217afa['push'](_0x26db69[_0x8914('0x41')]({'attributes':['id',_0x8914('0x5')]}));_0x217afa[_0x8914('0x30')](_0x26db69[_0x8914('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x8914('0x43')](_0x217afa);}})[_0x8914('0xf')](function(_0x5c7f2c){if(_0x5c7f2c&&_0x5c7f2c['length']){for(var _0xa6a9c=0x0;_0xa6a9c<_0x5c7f2c[_0x8914('0x1d')];_0xa6a9c+=0x1){for(var _0x408190=0x0;_0x408190<_0x5c7f2c[_0xa6a9c]['length'];_0x408190+=0x1){switch(_0xa6a9c){case 0x0:joinOrLeaveQueues(_0x182327,_0x179b66,_0x8914('0x44'),_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x1:joinOrLeaveQueues(_0x182327,_0x179b66,_0x8914('0x45'),_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x2:joinOrLeaveQueues(_0x182327,_0x179b66,_0x8914('0x46'),_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x3:joinOrLeaveQueues(_0x182327,_0x179b66,'sms',_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x4:joinOrLeaveQueues(_0x182327,_0x179b66,_0x8914('0x47'),_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x5:joinOrLeaveQueues(_0x182327,_0x179b66,_0x8914('0x48'),_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x6:joinOrLeaveQueues(_0x182327,_0x179b66,_0x8914('0x49'),_0x5c7f2c[_0xa6a9c][_0x408190]);break;case 0x7:if(_0x14db21[_0x8914('0x8')]!==_0x8914('0x9'))_0x182327[_0x179b66](util['format'](_0x8914('0x4a'),_0x5c7f2c[_0xa6a9c][_0x408190]['name']));break;case 0x8:if(_0x14db21[_0x8914('0x8')]!=='agent')_0x182327[_0x179b66](util[_0x8914('0x1e')](_0x8914('0x4b'),_0x5c7f2c[_0xa6a9c][_0x408190][_0x8914('0x5')]));break;case 0x9:if(_0x14db21['role']!==_0x8914('0x9'))_0x182327[_0x179b66](util[_0x8914('0x1e')](_0x8914('0x4c'),_0x5c7f2c[_0xa6a9c][_0x408190][_0x8914('0xb')],_0x5c7f2c[_0xa6a9c][_0x408190]['name']));break;case 0xa:_0x182327[_0x179b66](util[_0x8914('0x1e')](_0x8914('0x1f'),_0x5c7f2c[_0xa6a9c][_0x408190][_0x8914('0x5')]));break;}}}}})[_0x8914('0xf')](function(){if(_0x179b66===_0x8914('0x4d')){var _0x371d66=_[_0x8914('0x1a')](_0x14db21[_0x8914('0x23')],'id');return _0x14db21[_0x8914('0x4e')](_0x371d66)['then'](function(){for(var _0x4c8c99=0x0;_0x4c8c99<_0x371d66[_0x8914('0x1d')];_0x4c8c99+=0x1){_0x41a901[_0x8914('0x4f')](_0x8914('0x50'),{'ChatInteractionId':Number(_0x371d66[_0x4c8c99]),'UserId':Number(_0x14db21['id'])});}});}})[_0x8914('0xf')](function(){if(_0x179b66==='leave'){var _0x25697d=_[_0x8914('0x1a')](_0x14db21['MailInteractions'],'id');return _0x14db21['removeMailInteractions'](_0x25697d)[_0x8914('0xf')](function(){for(var _0x20ee77=0x0;_0x20ee77<_0x25697d[_0x8914('0x1d')];_0x20ee77+=0x1){_0x41a901[_0x8914('0x4f')](_0x8914('0x51'),{'MailInteractionId':Number(_0x25697d[_0x20ee77]),'UserId':Number(_0x14db21['id'])});}});}})[_0x8914('0xf')](function(){if(_0x179b66===_0x8914('0x4d')){var _0x489632=_[_0x8914('0x1a')](_0x14db21[_0x8914('0x27')],'id');return _0x14db21[_0x8914('0x52')](_0x489632)[_0x8914('0xf')](function(){for(var _0x56b427=0x0;_0x56b427<_0x489632['length'];_0x56b427+=0x1){_0x41a901[_0x8914('0x4f')](_0x8914('0x53'),{'FaxInteractionId':Number(_0x489632[_0x56b427]),'UserId':Number(_0x14db21['id'])});}});}})['then'](function(){if(_0x179b66===_0x8914('0x4d')){var _0x3ddf3c=_['map'](_0x14db21[_0x8914('0x29')],'id');return _0x14db21[_0x8914('0x54')](_0x3ddf3c)[_0x8914('0xf')](function(){for(var _0xc9d6b3=0x0;_0xc9d6b3<_0x3ddf3c[_0x8914('0x1d')];_0xc9d6b3+=0x1){_0x41a901['emit'](_0x8914('0x55'),{'SmsInteractionId':Number(_0x3ddf3c[_0xc9d6b3]),'UserId':Number(_0x14db21['id'])});}});}})[_0x8914('0xf')](function(){if(_0x179b66===_0x8914('0x4d')){var _0x18dfbe=_[_0x8914('0x1a')](_0x14db21[_0x8914('0x2b')],'id');return _0x14db21[_0x8914('0x56')](_0x18dfbe)[_0x8914('0xf')](function(){for(var _0x23428f=0x0;_0x23428f<_0x18dfbe[_0x8914('0x1d')];_0x23428f+=0x1){_0x41a901[_0x8914('0x4f')](_0x8914('0x57'),{'OpenchannelInteractionId':Number(_0x18dfbe[_0x23428f]),'UserId':Number(_0x14db21['id'])});}});}})['then'](function(){if(_0x179b66===_0x8914('0x4d')){var _0x3608f0=_[_0x8914('0x1a')](_0x14db21[_0x8914('0x2d')],'id');return _0x14db21['removeWhatsappInteractions'](_0x3608f0)[_0x8914('0xf')](function(){for(var _0x40f4f4=0x0;_0x40f4f4<_0x3608f0[_0x8914('0x1d')];_0x40f4f4+=0x1){_0x41a901[_0x8914('0x4f')](_0x8914('0x58'),{'WhatsappInteractionId':Number(_0x3608f0[_0x40f4f4]),'UserId':Number(_0x14db21['id'])});}});}})[_0x8914('0x59')](function(_0x310926){_0x182327[_0x8914('0x5a')](_0x310926);});}}function onDisconnect(_0x5bd26a,_0x20a0bc){joinOrLeave(_0x5bd26a,_0x8914('0x4d'),_0x20a0bc);}function onConnect(_0x2417cd){joinOrLeave(_0x2417cd,_0x8914('0x5b'));}exports[_0x8914('0x5c')]=function(_0xc21762){_0xc21762['on']('connection',function(_0x3dc89b){_0x3dc89b[_0x8914('0x5d')](0x0);_0x3dc89b[_0x8914('0x5e')]=_0x3dc89b[_0x8914('0x5f')][_0x8914('0x60')][_0x8914('0x61')]+':'+_0x3dc89b['request'][_0x8914('0x60')][_0x8914('0x62')];_0x3dc89b['connectedAt']=new Date();_0x3dc89b[_0x8914('0x5a')]=function(_0x40309b){console[_0x8914('0x5a')]('SocketIO\x20'+_0x3dc89b['nsp'][_0x8914('0x5')]+'['+_0x3dc89b[_0x8914('0x5e')]+']',_0x40309b);};_0x3dc89b['on'](_0x8914('0x63'),function(){onDisconnect(_0x3dc89b,_0xc21762);_0x3dc89b[_0x8914('0x5a')](_0x8914('0x64'));});onConnect(_0x3dc89b);_0x3dc89b[_0x8914('0x5a')](_0x8914('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 15d7de7..7166309 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 _0x4118=['model','hook','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','client','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','ChatOfflineMessage','newmessage','Sms','newinteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','catch','Trigger,\x20%s','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','contact','UserId','interface','format','name','agent','incomingmessage','AfterCreateMessage','opened','QueryTypes','SELECT','SIP/%s','AfterCreate','changed','closed','substatus','AfterUpdate','find','internal','default','length','hasOwnProperty'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x4118,0x128));var _0x8411=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x4118[_0x45bf86];return _0x1f02b7;};'use strict';var util=require(_0x8411('0x0'));var db=require(_0x8411('0x1'))['db'];var jayson=require(_0x8411('0x2'));var logger=require(_0x8411('0x3'))(_0x8411('0x4'));var client=jayson[_0x8411('0x5')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x8411('0x6'),'event':_0x8411('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8411('0x8'),'model':_0x8411('0x6'),'event':_0x8411('0x9'),'condition':_0x8411('0xa'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x8411('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x8411('0xb'),'event':'afterCreate','condition':_0x8411('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x8411('0xd'),'model':'SmsInteraction','event':_0x8411('0x7'),'condition':_0x8411('0xe'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x8411('0x9'),'condition':_0x8411('0xa'),'callback':afterUpdate},{'channel':_0x8411('0xd'),'model':_0x8411('0xf'),'event':_0x8411('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x8411('0x10'),'event':'afterCreate','condition':_0x8411('0xe'),'callback':afterCreate},{'channel':_0x8411('0x11'),'model':'WhatsappInteraction','event':_0x8411('0x9'),'condition':_0x8411('0xa'),'callback':afterUpdate},{'channel':_0x8411('0x11'),'model':_0x8411('0x12'),'event':_0x8411('0x7'),'condition':_0x8411('0xc'),'callback':afterCreateMessage},{'channel':_0x8411('0x13'),'model':_0x8411('0x14'),'event':_0x8411('0x7'),'condition':_0x8411('0xe'),'callback':afterCreate},{'channel':_0x8411('0x13'),'model':_0x8411('0x14'),'event':_0x8411('0x9'),'condition':_0x8411('0xa'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x8411('0x7'),'condition':_0x8411('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x8411('0x15'),'event':_0x8411('0x7'),'condition':_0x8411('0xe'),'callback':afterCreate},{'channel':_0x8411('0x16'),'model':'MailInteraction','event':_0x8411('0x9'),'condition':_0x8411('0xa'),'callback':afterUpdate},{'channel':_0x8411('0x16'),'model':_0x8411('0x17'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8411('0x18'),'model':_0x8411('0x19'),'event':_0x8411('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x8411('0x19'),'event':_0x8411('0x9'),'condition':_0x8411('0xa'),'callback':afterUpdate},{'channel':_0x8411('0x18'),'model':_0x8411('0x1a'),'event':_0x8411('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x52bf7e){return client[_0x8411('0x1b')](_0x8411('0x1c'),_0x52bf7e)[_0x8411('0x1d')](function(_0x5486c4){logger[_0x8411('0x1e')]('Trigger,\x20%s',_0x8411('0x1c'),_0x5486c4);if(_0x5486c4['error']){if(_0x5486c4[_0x8411('0x1f')][_0x8411('0x20')]===0x1f4){logger[_0x8411('0x1f')]('Trigger,\x20%s','EventManager',_0x5486c4[_0x8411('0x1f')]);}}})[_0x8411('0x21')](function(_0x2e7994){logger[_0x8411('0x1f')](_0x8411('0x22'),_0x8411('0x1c'),_0x2e7994);});}function afterCreateMessage(_0xc5f66){return function(_0x11452d){_0x11452d=_0x11452d[_0x8411('0x23')]({'plain':!![]});_0x11452d[_0x8411('0x24')]=_0xc5f66;_0x11452d[_0x8411('0x25')]=_0xc5f66;_0x11452d[_0x8411('0x26')]=_0x11452d[_0x8411('0x27')];Promise[_0x8411('0x28')]()[_0x8411('0x1d')](function(){if(typeof _0x11452d[_0x8411('0x29')]===_0x8411('0x2a'))return null;var _0xb28ffe=_0x8411('0x2b')+_0x11452d[_0x8411('0x29')];return db[_0x8411('0x2c')][_0x8411('0x2d')](_0xb28ffe,{'type':db[_0x8411('0x2e')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x8411('0x1d')](function(_0x4f06fd){if(_0x4f06fd){_0x11452d[_0x8411('0x2f')]=_0x4f06fd[0x0];}if(typeof _0x11452d[_0x8411('0x30')]===_0x8411('0x2a'))return;return getAgent(_0x11452d[_0x8411('0x30')]);})['then'](function(_0x5a4a48){if(_0x5a4a48){_0x11452d[_0x8411('0x31')]=util[_0x8411('0x32')]('SIP/%s',_0x5a4a48[_0x8411('0x33')]);_0x11452d[_0x8411('0x34')]=_0x5a4a48;_0x11452d[_0x8411('0x24')]=_0xc5f66;return request({'event':_0x8411('0x35'),'message':_0x11452d});}else{return request({'event':'outgoingmessage','message':_0x11452d});}})['catch'](function(_0x415dcf){logger['error'](_0x8411('0x22'),_0x8411('0x36'),_0x415dcf);});};}function afterCreateOfflineMessage(_0x3a0f2f){return function(_0x6e35b){_0x6e35b=_0x6e35b['get']({'plain':!![]});_0x6e35b[_0x8411('0x24')]=_0x3a0f2f;_0x6e35b[_0x8411('0x25')]=_0x3a0f2f;_0x6e35b['event']='offlineMessage';return request({'event':_0x6e35b[_0x8411('0x26')],'message':_0x6e35b});};}function afterCreate(_0x225c53,_0x46fca7){return function(_0x17de40){_0x17de40=_0x17de40[_0x8411('0x23')]({'plain':!![]});_0x17de40[_0x8411('0x24')]=_0x225c53;_0x17de40[_0x8411('0x25')]=_0x225c53;_0x17de40[_0x8411('0x26')]=_0x8411('0x37');Promise[_0x8411('0x28')]()['then'](function(){var _0x1e0751='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17de40[_0x8411('0x29')];return db[_0x8411('0x2c')][_0x8411('0x2d')](_0x1e0751,{'type':db['Sequelize'][_0x8411('0x38')][_0x8411('0x39')],'raw':!![]});})['then'](function(_0x336daa){if(_0x336daa){_0x17de40[_0x8411('0x2f')]=_0x336daa[0x0];}if(typeof _0x17de40[_0x8411('0x30')]===_0x8411('0x2a'))return;return getAgent(_0x17de40['UserId']);})['then'](function(_0x14047b){if(_0x14047b){_0x17de40[_0x8411('0x31')]=util['format'](_0x8411('0x3a'),_0x14047b['name']);_0x17de40[_0x8411('0x34')]=_0x14047b;}return request({'event':_0x46fca7,'message':_0x17de40});})[_0x8411('0x21')](function(_0x349aff){logger['error'](_0x8411('0x22'),_0x8411('0x3b'),_0x349aff);});};}function afterUpdate(_0x34c550){return function(_0x453352){var _0x120469=_0x453352[_0x8411('0x3c')]('closed')&&_0x453352[_0x8411('0x3d')];var _0x45957c=_0x453352[_0x8411('0x3c')](_0x8411('0x3e'));if(_0x120469||_0x45957c){var _0x4f0ded=_0x120469?'closedinteraction':_0x8411('0x3e');var _0x486caa=_0x453352[_0x8411('0x23')]({'plain':!![]});_0x486caa[_0x8411('0x24')]=_0x34c550;_0x486caa['motionChannel']=_0x34c550;_0x486caa[_0x8411('0x26')]=_0x120469?_0x8411('0x3d'):_0x8411('0x3e');var _0x382e2c=_0x8411('0x2b')+_0x486caa[_0x8411('0x29')];return db[_0x8411('0x2c')][_0x8411('0x2d')](_0x382e2c,{'type':db[_0x8411('0x2e')][_0x8411('0x38')][_0x8411('0x39')],'raw':!![]})['then'](function(_0x4030fb){if(_0x4030fb){_0x486caa[_0x8411('0x2f')]=_0x4030fb[0x0];}if(typeof _0x486caa[_0x8411('0x30')]==='undefined')return;return getAgent(_0x486caa[_0x8411('0x30')]);})['then'](function(_0x45c03c){if(_0x45c03c){_0x486caa[_0x8411('0x31')]=util['format'](_0x8411('0x3a'),_0x45c03c[_0x8411('0x33')]);_0x486caa[_0x8411('0x34')]=_0x45c03c;}return request({'event':_0x4f0ded,'message':_0x486caa});})['catch'](function(_0x2afe86){logger[_0x8411('0x1f')](_0x8411('0x22'),_0x8411('0x3f'),_0x2afe86);});}};}function getAgent(_0x28b68e){return db['User'][_0x8411('0x40')]({'where':{'id':_0x28b68e},'attributes':['id',_0x8411('0x33'),'fullname','email',_0x8411('0x41')],'raw':!![]})[_0x8411('0x1d')](function(_0x16fe8d){return _0x16fe8d;});}exports[_0x8411('0x42')]=function(){for(var _0x4d6369=0x0;_0x4d6369=_0x1b4cc4['agents']){throw Error(_0x2585('0x15'));}_0x2ee717(_0x401575);})['catch'](function(_0xdc21e5){_0x131931(_0xdc21e5);});});}; \ No newline at end of file +var _0xb17d=['toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','getLicense','role','agent','User','count','then','agents','catch','lodash','../mysqldb','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel'];(function(_0x5a59d5,_0x34b8c3){var _0x59d48d=function(_0xbefe40){while(--_0xbefe40){_0x5a59d5['push'](_0x5a59d5['shift']());}};_0x59d48d(++_0x34b8c3);}(_0xb17d,0x194));var _0xdb17=function(_0x5271fb,_0x49fc86){_0x5271fb=_0x5271fb-0x0;var _0x19650e=_0xb17d[_0x5271fb];return _0x19650e;};'use strict';var _=require(_0xdb17('0x0'));var BPromise=require('bluebird');var db=require(_0xdb17('0x1'))['db'];var util=require('./license/util');var channels=[_0xdb17('0x2'),_0xdb17('0x3'),_0xdb17('0x4'),_0xdb17('0x5'),_0xdb17('0x6'),'whatsapp',_0xdb17('0x7')];exports[_0xdb17('0x8')]=function(){return channels;};exports[_0xdb17('0x9')]=function(_0x2e3d1f){_0x2e3d1f=_0x2e3d1f[_0xdb17('0xa')]();return _[_0xdb17('0xb')](channels,_0x2e3d1f);};exports[_0xdb17('0xc')]=function(_0x5dd00a,_0x585d25,_0x5ea9ac,_0x24ad8c){var _0xebb5c2={'loginAttempts':_0x585d25,'blocked':_0x5ea9ac};if(!_[_0xdb17('0xd')](_0x24ad8c)){_0xebb5c2[_0xdb17('0xe')]=_0x24ad8c;}return _0x5dd00a['updateAttributes'](_0xebb5c2);};exports[_0xdb17('0xf')]=function(_0x9ac1aa){return new BPromise(function(_0x196ef9,_0x16f056){var _0x141e86=0x0;if(_0x9ac1aa[_0xdb17('0x10')]!==_0xdb17('0x11')){_0x196ef9(_0x9ac1aa);}db[_0xdb17('0x12')][_0xdb17('0x13')]({'where':{'role':_0xdb17('0x11'),'online':!![],'id':{'$ne':_0x9ac1aa['id']}}})[_0xdb17('0x14')](function(_0x4b9920){_0x141e86=_0x4b9920;return util[_0xdb17('0xf')]();})[_0xdb17('0x14')](function(_0xb6c729){if(_0xb6c729&&_0xb6c729[_0xdb17('0x15')]&&_0x141e86>=_0xb6c729[_0xdb17('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x196ef9(_0x9ac1aa);})[_0xdb17('0x16')](function(_0x2baed1){_0x16f056(_0x2baed1);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6104ae9..89ea2d8 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dfc=['render','json','404','status'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x4dfc,0xda));var _0xc4df=function(_0x306646,_0xdc2e1b){_0x306646=_0x306646-0x0;var _0x40bd8d=_0x4dfc[_0x306646];return _0x40bd8d;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5036f6,_0x4edcd3){var _0x4114c8=_0xc4df('0x0');var _0x3571ba=0x194;var _0x18ec70={'status':_0x3571ba};_0x4edcd3[_0xc4df('0x1')](_0x18ec70[_0xc4df('0x1')]);_0x4edcd3[_0xc4df('0x2')](_0x4114c8,{},function(_0x4a36ef,_0x5b227a){if(_0x4a36ef){return _0x4edcd3['status'](_0x18ec70[_0xc4df('0x1')])[_0xc4df('0x3')](_0x18ec70);}_0x4edcd3['send'](_0x5b227a);});}; \ No newline at end of file +var _0xbc9d=['exports','404','status','render','json'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x58038b,_0x41a272){_0x58038b=_0x58038b-0x0;var _0x68986f=_0xbc9d[_0x58038b];return _0x68986f;};'use strict';module[_0xdbc9('0x0')][0x194]=function pageNotFound(_0xbca678,_0x8aa82b){var _0x434f6e=_0xdbc9('0x1');var _0x4d5f79=0x194;var _0x4d8228={'status':_0x4d5f79};_0x8aa82b['status'](_0x4d8228[_0xdbc9('0x2')]);_0x8aa82b[_0xdbc9('0x3')](_0x434f6e,{},function(_0x3e63f1,_0x4a32b4){if(_0x3e63f1){return _0x8aa82b[_0xdbc9('0x2')](_0x4d8228[_0xdbc9('0x2')])[_0xdbc9('0x4')](_0x4d8228);}_0x8aa82b['send'](_0x4a32b4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index dea4d38..584cf5b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa561=['../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','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','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','hasMany','Recordings','Extensions','cascade','CmHopperHistory','HopperHistory','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','UserOpenchannelQueue','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','TrunkId','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailServerIn','restrict','CloudProviderId','Imap','Smtp','Disposition','Dispositions','MailAccountId','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','TagId','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatGroupId','Members','CompanyId','JscriptySessions','OpenchannelInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','DescriptionId','FieldId','SalesforceField','SubjectId','Description','VariableId','Descriptions','Subject','Field','int_desk_configuration_has_tags','ZendeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowField','Dynamics365Configuration','ToId','SessionId','SmsQueueReport','ProjectId','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefixes','TrunkBackup','BlackLists','campaigns_has_cm_blacklists','ChatOfflineMessageId','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','TeamVoicePrefix','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','xcall','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount'];(function(_0x3e7b8d,_0x59060d){var _0x145c46=function(_0x3bac73){while(--_0x3bac73){_0x3e7b8d['push'](_0x3e7b8d['shift']());}};_0x145c46(++_0x59060d);}(_0xa561,0x1ae));var _0x1a56=function(_0x2f84af,_0x2d16a7){_0x2f84af=_0x2f84af-0x0;var _0x3a355c=_0xa561[_0x2f84af];return _0x3a355c;};'use strict';var config=require(_0x1a56('0x0'));var Sequelize=require(_0x1a56('0x1'));var _=require(_0x1a56('0x2'));var jstz=require(_0x1a56('0x3'));var timezone=jstz['determine']();config[_0x1a56('0x1')]=_[_0x1a56('0x4')](config['sequelize'],{'database':'motion2','username':_0x1a56('0x5'),'password':'xC@LL1234','options':{'host':_0x1a56('0x6'),'port':0xcea,'dialect':_0x1a56('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x1a56('0x8')](),'define':{'charset':_0x1a56('0x9'),'collate':_0x1a56('0xa')}}});config[_0x1a56('0xb')]=_[_0x1a56('0x4')](config[_0x1a56('0xb')],{'database':'motion2','username':_0x1a56('0x5'),'password':_0x1a56('0xc'),'options':{'host':_0x1a56('0x6'),'port':0xcea,'dialect':_0x1a56('0x7'),'dialectOptions':{'charset':_0x1a56('0xd')},'logging':![],'timezone':timezone[_0x1a56('0x8')](),'define':{'charset':_0x1a56('0x9'),'collate':_0x1a56('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a56('0x1')][_0x1a56('0xe')],config[_0x1a56('0x1')][_0x1a56('0xf')],config[_0x1a56('0x1')][_0x1a56('0x10')],config[_0x1a56('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1a56('0xb')][_0x1a56('0xe')],config[_0x1a56('0xb')]['username'],config['sequelizeHistory'][_0x1a56('0x10')],config['sequelizeHistory'][_0x1a56('0x11')])};db[_0x1a56('0x12')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x14'));db['VoiceChanSpy']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x15'));db[_0x1a56('0x16')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x17'));db[_0x1a56('0x18')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x1a'));db[_0x1a56('0x1b')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x1c'));db[_0x1a56('0x1d')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x1e'));db[_0x1a56('0x1f')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x20'));db[_0x1a56('0x21')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x22'));db[_0x1a56('0x23')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x24'));db[_0x1a56('0x25')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x1a56('0x1')]['import'](_0x1a56('0x26'));db[_0x1a56('0x27')]=db['sequelize']['import'](_0x1a56('0x28'));db[_0x1a56('0x29')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x1a56('0x2a')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/memberReport/memberReport.model');db[_0x1a56('0x2b')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x2c'));db['VoiceTransferReport']=db[_0x1a56('0x1')]['import'](_0x1a56('0x2d'));db['UserVoiceQueueRt']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x2e'));db[_0x1a56('0x2f')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x30'));db['UserChatQueue']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x1a56('0x31')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x32'));db['UserFaxQueue']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x33'));db[_0x1a56('0x34')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x35'));db['UserOpenchannelQueue']=db['sequelize'][_0x1a56('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x1a56('0x36')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x37'));db['MailServerIn']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x38'));db[_0x1a56('0x39')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x3a'));db[_0x1a56('0x3b')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x3c'));db[_0x1a56('0x3d')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/mailQueue/mailQueue.model');db[_0x1a56('0x3e')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0x1a56('0x3f')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x40'));db[_0x1a56('0x41')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x42'));db[_0x1a56('0x43')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x44'));db[_0x1a56('0x45')]=db[_0x1a56('0x1')]['import']('../api/mailQueueReport/mailQueueReport.model');db[_0x1a56('0x46')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x47'));db[_0x1a56('0x48')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x49'));db[_0x1a56('0x4a')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x4b'));db[_0x1a56('0x4c')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x4d'));db[_0x1a56('0x4e')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x4f'));db[_0x1a56('0x50')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x51'));db[_0x1a56('0x52')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x53'));db[_0x1a56('0x54')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x55'));db['SmsAccount']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x56'));db[_0x1a56('0x57')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x58'));db[_0x1a56('0x59')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x5a'));db[_0x1a56('0x5b')]=db['sequelize']['import'](_0x1a56('0x5c'));db[_0x1a56('0x5d')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x5e'));db[_0x1a56('0x5f')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x60'));db[_0x1a56('0x61')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x62'));db[_0x1a56('0x63')]=db['sequelize']['import'](_0x1a56('0x64'));db[_0x1a56('0x65')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x1a56('0x66')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x67'));db[_0x1a56('0x68')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x69'));db[_0x1a56('0x6a')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x6b'));db[_0x1a56('0x6c')]=db['sequelize'][_0x1a56('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x1a56('0x6d')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x6e'));db[_0x1a56('0x6f')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x1a56('0x70')]=db[_0x1a56('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x71'));db[_0x1a56('0x72')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x1a56('0x73')]=db[_0x1a56('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0x1a56('0x74')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x75'));db[_0x1a56('0x76')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x77'));db[_0x1a56('0x78')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x79'));db[_0x1a56('0x7a')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x7b'));db['CmHopperHistory']=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x7c'));db[_0x1a56('0x7d')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x7e'));db[_0x1a56('0x7f')]=db['sequelize'][_0x1a56('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x1a56('0x1')]['import']('../api/action/action.model');db[_0x1a56('0x80')]=db[_0x1a56('0x1')]['import']('../api/automation/automation.model');db[_0x1a56('0x81')]=db['sequelize']['import'](_0x1a56('0x82'));db['Disposition']=db['sequelize']['import'](_0x1a56('0x83'));db[_0x1a56('0x84')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x85'));db['Interval']=db[_0x1a56('0x1')]['import'](_0x1a56('0x86'));db[_0x1a56('0x87')]=db[_0x1a56('0x1')]['import']('../api/pause/pause.model');db[_0x1a56('0x88')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x89'));db[_0x1a56('0x8a')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x8b'));db[_0x1a56('0x8c')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x8d'));db[_0x1a56('0x8e')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x8f'));db[_0x1a56('0x90')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/tag/tag.model');db[_0x1a56('0x91')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x92'));db[_0x1a56('0x93')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x94'));db[_0x1a56('0x95')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x96'));db['Integration']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/integration/integration.model');db[_0x1a56('0x97')]=db['sequelize'][_0x1a56('0x13')]('../api/integrationReport/integrationReport.model');db[_0x1a56('0x98')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x99'));db[_0x1a56('0x9a')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x9b'));db[_0x1a56('0x9c')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x9d'));db[_0x1a56('0x9e')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x9f'));db[_0x1a56('0xa0')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xa1'));db[_0x1a56('0xa2')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xa3'));db[_0x1a56('0xa4')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xa5'));db['SalesforceField']=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x1a56('0xa6')]=db['sequelize']['import'](_0x1a56('0xa7'));db[_0x1a56('0xa8')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xa9'));db[_0x1a56('0xaa')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xab'));db[_0x1a56('0xac')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x1a56('0xad')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xae'));db[_0x1a56('0xaf')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb0'));db[_0x1a56('0xb1')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1a56('0xb2')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb3'));db[_0x1a56('0xb4')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb5'));db[_0x1a56('0xb6')]=db['sequelize']['import'](_0x1a56('0xb7'));db['ZendeskConfiguration']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xb8'));db[_0x1a56('0xb9')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xba'));db[_0x1a56('0xbb')]=db[_0x1a56('0x1')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x1a56('0xbc')]=db['sequelize'][_0x1a56('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x1a56('0xbd')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xbe'));db[_0x1a56('0xbf')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc0'));db['VtigerConfiguration']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc1'));db[_0x1a56('0xc2')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x1a56('0xc3')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x1a56('0xc4')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xc5'));db['ServicenowField']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc6'));db[_0x1a56('0xc7')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xc8'));db['Dynamics365Configuration']=db['sequelize'][_0x1a56('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x1a56('0xc9')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xca'));db[_0x1a56('0xcb')]=db['sequelize']['import'](_0x1a56('0xcc'));db[_0x1a56('0xcd')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xce'));db[_0x1a56('0xcf')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xd0'));db[_0x1a56('0xd1')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xd2'));db[_0x1a56('0xd3')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xd4'));db[_0x1a56('0xd5')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xd6'));db[_0x1a56('0xd7')]=db['sequelize']['import'](_0x1a56('0xd8'));db[_0x1a56('0xd9')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xda'));db[_0x1a56('0xdb')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xdc'));db[_0x1a56('0xdd')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xde'));db['SmsQueueReport']=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xdf'));db[_0x1a56('0xe0')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xe1'));db[_0x1a56('0xe2')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xe3'));db[_0x1a56('0xe4')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1a56('0xe5')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/setting/setting.model');db[_0x1a56('0xe6')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xe7'));db[_0x1a56('0xe8')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/squareProject/squareProject.model');db[_0x1a56('0xe9')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xea'));db[_0x1a56('0xeb')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xec'));db[_0x1a56('0xed')]=db[_0x1a56('0x1')]['import'](_0x1a56('0xee'));db['License']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xef'));db[_0x1a56('0xf0')]=db[_0x1a56('0x1')]['import']('../api/campaign/campaign.model');db[_0x1a56('0xf1')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xf2'));db[_0x1a56('0xf3')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xf4'));db[_0x1a56('0xf5')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xf6'));db[_0x1a56('0xf7')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0xf8'));db[_0x1a56('0xf9')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xfa'));db[_0x1a56('0xfb')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xfc'));db[_0x1a56('0xfd')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0xfe'));db[_0x1a56('0xff')]=db['sequelize'][_0x1a56('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x1a56('0x100')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/cmList/cmList.model');db[_0x1a56('0x101')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x102'));db[_0x1a56('0x103')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/userProfile/userProfile.model');db[_0x1a56('0x104')]=db[_0x1a56('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x1a56('0x105')]=db['sequelize'][_0x1a56('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0x1a56('0x106')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x107'));db[_0x1a56('0x108')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x109'));db[_0x1a56('0x10a')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x10b'));db[_0x1a56('0x10c')]=db['sequelize'][_0x1a56('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x10d'));db[_0x1a56('0x10e')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x10f'));db[_0x1a56('0x110')]=db['sequelize'][_0x1a56('0x13')](_0x1a56('0x111'));db[_0x1a56('0x112')]=db[_0x1a56('0x1')][_0x1a56('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x1a56('0x113')]=db[_0x1a56('0x1')]['import'](_0x1a56('0x114'));db['TeamVoiceQueue']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x115'));db['TeamVoicePrefix']=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x116'));db[_0x1a56('0x117')]=db['sequelize']['import'](_0x1a56('0x118'));db[_0x1a56('0x119')]=db[_0x1a56('0x1')][_0x1a56('0x13')](_0x1a56('0x11a'));db[_0x1a56('0x12')][_0x1a56('0x11b')](db[_0x1a56('0x21')],{'as':_0x1a56('0x21'),'onDelete':'cascade','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11b')](db[_0x1a56('0x119')],{'as':_0x1a56('0x11d'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x1a56('0x11e')](db[_0x1a56('0x1d')],{'as':_0x1a56('0x11f'),'foreignKey':_0x1a56('0x11c')});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db['VoiceExtension'],{'as':_0x1a56('0x120'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x122')],{'as':_0x1a56('0x123'),'foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x1a56('0x11c')});db['User'][_0x1a56('0x11e')](db[_0x1a56('0x6c')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x57')],{'as':'SmsInteractions','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x4e')],{'as':_0x1a56('0x124'),'foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x3f')],{'as':'MailInteractions','foreignKey':_0x1a56('0x11c')});db['User'][_0x1a56('0x11e')](db['WhatsappInteraction'],{'as':_0x1a56('0x125'),'foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x12')][_0x1a56('0x11e')](db[_0x1a56('0x106')],{'as':_0x1a56('0x126'),'foreignKey':_0x1a56('0x127')});db['User'][_0x1a56('0x128')](db[_0x1a56('0x103')],{'as':_0x1a56('0x103'),'foreignKey':_0x1a56('0x129')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['ChatGroup'],{'as':'Groups','through':_0x1a56('0x12b')});db['User'][_0x1a56('0x12a')](db['CmContact'],{'as':_0x1a56('0x12c'),'through':_0x1a56('0x12d')});db['User'][_0x1a56('0x12a')](db['CmList'],{'as':_0x1a56('0x12e'),'through':_0x1a56('0x12f')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x130')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x3f')],{'as':_0x1a56('0x131'),'through':_0x1a56('0x132')});db['User'][_0x1a56('0x12a')](db[_0x1a56('0x6c')],{'as':_0x1a56('0x133'),'through':_0x1a56('0x134')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['FaxInteraction'],{'as':_0x1a56('0x124'),'through':_0x1a56('0x135')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x57')],{'as':_0x1a56('0x136'),'through':_0x1a56('0x137')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x61')],{'as':'OpenchannelInteractions','through':_0x1a56('0x138')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x10c')],{'as':_0x1a56('0x125'),'through':_0x1a56('0x139')});db[_0x1a56('0x12')]['belongsToMany'](db[_0x1a56('0x1b')],{'as':_0x1a56('0x13a'),'through':_0x1a56('0x2f'),'required':![]});db['User']['belongsToMany'](db[_0x1a56('0x101')],{'as':'VoicePrefixes','through':_0x1a56('0x117'),'required':![]});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x3d')],{'as':_0x1a56('0x13b'),'through':'UserMailQueue','required':![]});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x70')],{'as':_0x1a56('0x13c'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x1a56('0x12a')](db[_0x1a56('0x52')],{'as':_0x1a56('0x13d'),'through':_0x1a56('0x13e'),'required':![]});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x5b')],{'as':_0x1a56('0x13f'),'through':'UserSmsQueue','required':![]});db['User']['belongsToMany'](db[_0x1a56('0x65')],{'as':'OpenchannelQueues','through':_0x1a56('0x140'),'required':![]});db['User'][_0x1a56('0x12a')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x1a56('0x36'),'required':![]});db[_0x1a56('0x12')]['belongsToMany'](db[_0x1a56('0x100')],{'through':'cm_user_has_lists'});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x66')],{'as':'ChatWebsites','through':_0x1a56('0x141')});db['User'][_0x1a56('0x12a')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User'][_0x1a56('0x12a')](db[_0x1a56('0x3b')],{'as':_0x1a56('0x142'),'through':_0x1a56('0x143')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['OpenchannelAccount'],{'as':_0x1a56('0x144'),'through':_0x1a56('0x145')});db[_0x1a56('0x12')]['belongsToMany'](db[_0x1a56('0x146')],{'as':_0x1a56('0x147'),'through':_0x1a56('0x148')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db[_0x1a56('0x108')],{'as':_0x1a56('0x149'),'through':_0x1a56('0x14a')});db[_0x1a56('0x12')][_0x1a56('0x12a')](db['SquareProject'],{'as':_0x1a56('0x14b'),'through':_0x1a56('0x14c')});db[_0x1a56('0x14d')][_0x1a56('0x11e')](db[_0x1a56('0x18')],{'as':_0x1a56('0x14e'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x14f')});db['VoiceContext']['hasMany'](db[_0x1a56('0x18')],{'onDelete':_0x1a56('0x121')});db['VoiceExtension'][_0x1a56('0x11e')](db['VoiceExtension'],{'as':_0x1a56('0x150'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x151')]['belongsToMany'](db['Sound'],{'as':_0x1a56('0x152'),'through':_0x1a56('0x153')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0x154')],{'as':'Members','foreignKey':_0x1a56('0x155')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0x76')],{'as':_0x1a56('0x156'),'foreignKey':'VoiceQueueId'});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':'VoiceQueueId'});db[_0x1a56('0x1b')]['hasMany'](db[_0x1a56('0x122')],{'as':_0x1a56('0x158'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x1a56('0x11e')](db[_0x1a56('0x7d')],{'as':_0x1a56('0x7d'),'foreignKey':_0x1a56('0x155')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x1a56('0x155')});db[_0x1a56('0x1b')][_0x1a56('0x11e')](db[_0x1a56('0xdd')],{'as':'JscriptySessions','foreignKey':_0x1a56('0x155')});db['VoiceQueue'][_0x1a56('0x128')](db[_0x1a56('0x2b')],{'as':'Trunk','foreignKey':_0x1a56('0x159')});db[_0x1a56('0x1b')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x1a56('0x15a')});db[_0x1a56('0x1b')][_0x1a56('0x128')](db[_0x1a56('0x15b')],{'as':_0x1a56('0x15b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x1b')][_0x1a56('0x128')](db['Pause'],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db[_0x1a56('0x1b')][_0x1a56('0x12a')](db[_0x1a56('0x100')],{'as':_0x1a56('0x12e'),'through':_0x1a56('0x15f')});db[_0x1a56('0x1b')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x2f')});db[_0x1a56('0x1b')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x1a56('0x1b')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0x1a56('0x161')});db[_0x1a56('0x1d')][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x12'),'foreignKey':_0x1a56('0x11c')});db['ScreenRecording']['belongsTo'](db['User'],{'as':_0x1a56('0x12'),'foreignKey':_0x1a56('0x11c')});db['VoiceMail'][_0x1a56('0x11e')](db[_0x1a56('0x23')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':_0x1a56('0x163'),'sourceKey':_0x1a56('0x164')});db['VoiceMailMessage'][_0x1a56('0x128')](db[_0x1a56('0x21')],{'foreignKey':_0x1a56('0x163'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x1a56('0x11e')](db['VoiceQueueReport'],{'as':_0x1a56('0x165'),'foreignKey':_0x1a56('0x166'),'constraints':![]});db['VoiceCallReport'][_0x1a56('0x11e')](db[_0x1a56('0x27')],{'as':_0x1a56('0x167'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'User','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x25')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x16a')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x1a56('0x16a')][_0x1a56('0x128')](db[_0x1a56('0x113')],{'as':_0x1a56('0x113'),'foreignKey':'CloudProviderId','onDelete':_0x1a56('0x16b')});db['MailServerOut'][_0x1a56('0x128')](db['MailAccount'],{'as':_0x1a56('0x3b'),'foreignKey':'MailAccountId'});db[_0x1a56('0x39')][_0x1a56('0x128')](db[_0x1a56('0x113')],{'as':_0x1a56('0x113'),'foreignKey':_0x1a56('0x16c'),'onDelete':'restrict'});db[_0x1a56('0x3b')][_0x1a56('0x11b')](db['MailServerIn'],{'as':_0x1a56('0x16d'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x3b')]['hasOne'](db[_0x1a56('0x39')],{'as':_0x1a56('0x16e'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x3b')]['hasMany'](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x171'),'onDelete':_0x1a56('0x121')});db['MailAccount']['hasMany'](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x171')});db['MailAccount'][_0x1a56('0x11e')](db[_0x1a56('0x41')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x1a56('0x3b')]['hasMany'](db[_0x1a56('0x3f')],{'as':_0x1a56('0x173')});db[_0x1a56('0x3b')]['hasMany'](db['MailApplication'],{'as':_0x1a56('0x150')});db['MailAccount'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x3b')][_0x1a56('0x128')](db[_0x1a56('0x91')],{'as':_0x1a56('0x91'),'foreignKey':_0x1a56('0x176')});db[_0x1a56('0x3b')][_0x1a56('0x128')](db[_0x1a56('0x87')],{'as':_0x1a56('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x31')});db[_0x1a56('0x3d')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x177'),'as':_0x1a56('0x178')});db[_0x1a56('0x3f')]['hasMany'](db[_0x1a56('0x41')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x1a56('0x3f')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x171')});db[_0x1a56('0x3f')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x3f')]['belongsTo'](db[_0x1a56('0x12')],{'as':_0x1a56('0x17a'),'foreignKey':'UserId'});db[_0x1a56('0x3f')]['belongsToMany'](db['Tag'],{'through':_0x1a56('0x17b'),'as':_0x1a56('0x17c')});db[_0x1a56('0x3f')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x17b'),'as':_0x1a56('0x17d')});db[_0x1a56('0x3f')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Users','through':_0x1a56('0x132'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0x1a56('0xf3')],{'as':_0x1a56('0x17e'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x41')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'User'});db['MailMessage'][_0x1a56('0x128')](db['CmContact'],{'onDelete':_0x1a56('0x121'),'as':'Contact'});db[_0x1a56('0x41')]['belongsTo'](db[_0x1a56('0x3f')],{'as':_0x1a56('0x17f'),'foreignKey':'MailInteractionId'});db[_0x1a56('0x41')]['belongsTo'](db['MailAccount'],{'as':_0x1a56('0x179'),'foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x1a56('0x66'),'foreignKey':_0x1a56('0x180')});db[_0x1a56('0x41')][_0x1a56('0x128')](db[_0x1a56('0x6f')],{'as':_0x1a56('0x6f'),'foreignKey':'ChatOfflineMessageId'});db[_0x1a56('0x43')]['belongsTo'](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x43')][_0x1a56('0x128')](db[_0x1a56('0x3d')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x43')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x43')]['belongsTo'](db['Interval'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x15c')});db['MailApplication'][_0x1a56('0x128')](db['Tag'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db[_0x1a56('0x45')][_0x1a56('0x128')](db[_0x1a56('0x3b')],{});db['MailQueueReport'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':'ListId'});db[_0x1a56('0x45')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0x45')]['belongsTo'](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x1a56('0x41')],{});db[_0x1a56('0x45')]['belongsTo'](db[_0x1a56('0x12')],{});db[_0x1a56('0x45')][_0x1a56('0x128')](db[_0x1a56('0x3d')],{});db[_0x1a56('0x46')][_0x1a56('0x11e')](db[_0x1a56('0x48')],{'as':'Items','onDelete':_0x1a56('0x121')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db['Disposition'],{'as':_0x1a56('0x170'),'foreignKey':'FaxAccountId','onDelete':_0x1a56('0x121')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x182')});db[_0x1a56('0x4a')]['hasMany'](db[_0x1a56('0x4e')],{'as':_0x1a56('0x173')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db['FaxApplication'],{'as':_0x1a56('0x150')});db['FaxAccount'][_0x1a56('0x11e')](db[_0x1a56('0x18')],{'as':_0x1a56('0x183'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x4a')][_0x1a56('0x11e')](db[_0x1a56('0x50')],{'as':'Messages'});db[_0x1a56('0x4a')][_0x1a56('0x128')](db[_0x1a56('0x2b')],{'as':_0x1a56('0x2b')});db['FaxAccount']['belongsTo'](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x4a')]['belongsTo'](db[_0x1a56('0x87')],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db['FaxAccount'][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x184')});db['FaxApplication']['belongsTo'](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x4c')][_0x1a56('0x128')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x1a56('0x4c')][_0x1a56('0x128')](db[_0x1a56('0x4a')],{'onDelete':'restrict'});db[_0x1a56('0x4c')][_0x1a56('0x128')](db[_0x1a56('0x90')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db[_0x1a56('0x4e')]['hasMany'](db[_0x1a56('0x50')],{'as':_0x1a56('0x162'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x185')});db[_0x1a56('0x4e')][_0x1a56('0x128')](db[_0x1a56('0x4a')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x182')});db[_0x1a56('0x4e')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x17a'),'foreignKey':'UserId'});db[_0x1a56('0x4e')]['belongsToMany'](db[_0x1a56('0x90')],{'through':'fax_interaction_has_tags','as':_0x1a56('0x17c')});db[_0x1a56('0x4e')][_0x1a56('0x12a')](db['Tag'],{'through':_0x1a56('0x186'),'as':'ThroughTags'});db[_0x1a56('0x4e')][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x187'),'through':_0x1a56('0x135'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x12')});db['FaxMessage'][_0x1a56('0x128')](db[_0x1a56('0x4e')],{'as':_0x1a56('0x17f'),'foreignKey':_0x1a56('0x185')});db[_0x1a56('0x50')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'onDelete':'cascade','as':_0x1a56('0x168')});db[_0x1a56('0x50')][_0x1a56('0x128')](db[_0x1a56('0xf3')],{'as':_0x1a56('0xf3'),'foreignKey':_0x1a56('0x188')});db[_0x1a56('0x50')][_0x1a56('0x128')](db['FaxAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x182')});db[_0x1a56('0x52')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x13e')});db['FaxQueue'][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x189'),'as':_0x1a56('0x178')});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x4a')],{});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x54')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x4e')],{});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x50')],{});db[_0x1a56('0x54')][_0x1a56('0x128')](db[_0x1a56('0x12')],{});db[_0x1a56('0x54')]['belongsTo'](db['FaxQueue'],{});db[_0x1a56('0x146')][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x18a'),'onDelete':'cascade'});db[_0x1a56('0x146')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x1a56('0x18a')});db[_0x1a56('0x146')]['hasMany'](db[_0x1a56('0x59')],{'as':_0x1a56('0x162'),'foreignKey':_0x1a56('0x18a')});db[_0x1a56('0x146')][_0x1a56('0x11e')](db['SmsInteraction'],{'as':_0x1a56('0x173')});db[_0x1a56('0x146')]['hasMany'](db['SmsApplication'],{'as':_0x1a56('0x150')});db[_0x1a56('0x146')][_0x1a56('0x128')](db['CmList'],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x146')][_0x1a56('0x128')](db[_0x1a56('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x1a56('0x15e')});db[_0x1a56('0x146')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x148')});db[_0x1a56('0x18b')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':'restrict'});db['SmsApplication'][_0x1a56('0x128')](db[_0x1a56('0x5b')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x18b')]['belongsTo'](db[_0x1a56('0x146')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x18b')]['belongsTo'](db[_0x1a56('0x15b')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x18b')][_0x1a56('0x128')](db[_0x1a56('0x90')],{'onDelete':'restrict','foreignKey':_0x1a56('0x181')});db[_0x1a56('0x57')][_0x1a56('0x11e')](db[_0x1a56('0x59')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':_0x1a56('0x18c')});db[_0x1a56('0x57')][_0x1a56('0x128')](db['SmsAccount'],{'as':'Account','foreignKey':_0x1a56('0x18a')});db['SmsInteraction'][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x57')][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x17a'),'foreignKey':_0x1a56('0x11c')});db['SmsInteraction'][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x18d'),'as':'Tags'});db[_0x1a56('0x57')]['belongsToMany'](db[_0x1a56('0x90')],{'through':_0x1a56('0x18d'),'as':_0x1a56('0x17d')});db[_0x1a56('0x57')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x187'),'through':_0x1a56('0x137'),'foreignKey':_0x1a56('0x18c')});db[_0x1a56('0x59')][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x12')});db[_0x1a56('0x59')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168')});db['SmsMessage'][_0x1a56('0x128')](db[_0x1a56('0x57')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x17f'),'foreignKey':_0x1a56('0x18c')});db[_0x1a56('0x59')]['belongsTo'](db[_0x1a56('0x146')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x18a')});db[_0x1a56('0x5b')][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x160'),'through':_0x1a56('0x34'),'foreignKey':'SmsQueueId'});db[_0x1a56('0x5b')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x18e'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x18e')});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db[_0x1a56('0x61')],{'as':_0x1a56('0x173'),'foreignKey':_0x1a56('0x18e')});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db['OpenchannelMessage'],{'as':_0x1a56('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x1a56('0x5d')][_0x1a56('0x11e')](db[_0x1a56('0x5f')],{'as':_0x1a56('0x150'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['belongsTo'](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db['OpenchannelAccount'][_0x1a56('0x128')](db['Pause'],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db['OpenchannelAccount'][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x145')});db[_0x1a56('0x5f')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x5f')][_0x1a56('0x128')](db[_0x1a56('0x65')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x18f')});db[_0x1a56('0x5f')]['belongsTo'](db[_0x1a56('0x5d')],{'onDelete':'restrict','foreignKey':_0x1a56('0x18e')});db['OpenchannelApplication'][_0x1a56('0x128')](db['Interval'],{'onDelete':_0x1a56('0x16b'),'foreignKey':'IntervalId'});db[_0x1a56('0x5f')][_0x1a56('0x128')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1a56('0x181')});db[_0x1a56('0x61')][_0x1a56('0x11e')](db[_0x1a56('0x63')],{'as':_0x1a56('0x162'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x190')});db[_0x1a56('0x61')][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'as':_0x1a56('0x179'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':'Contact','foreignKey':_0x1a56('0x169')});db[_0x1a56('0x61')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':_0x1a56('0x17a'),'foreignKey':_0x1a56('0x11c')});db['OpenchannelInteraction'][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x191'),'as':_0x1a56('0x17c')});db[_0x1a56('0x61')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x191'),'as':_0x1a56('0x17d')});db[_0x1a56('0x61')]['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x187'),'through':_0x1a56('0x138'),'foreignKey':_0x1a56('0x190')});db[_0x1a56('0x63')]['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db['OpenchannelMessage']['belongsTo'](db[_0x1a56('0x74')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168')});db['OpenchannelMessage'][_0x1a56('0x128')](db[_0x1a56('0x61')],{'onDelete':'cascade','as':_0x1a56('0x17f'),'foreignKey':_0x1a56('0x190')});db[_0x1a56('0x63')][_0x1a56('0x128')](db[_0x1a56('0xf3')],{'as':'Attachment','foreignKey':_0x1a56('0x188')});db['OpenchannelMessage'][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x18e')});db[_0x1a56('0x65')]['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x140'),'foreignKey':_0x1a56('0x18f')});db[_0x1a56('0x65')]['belongsToMany'](db[_0x1a56('0xed')],{'through':_0x1a56('0x192'),'as':'Teams'});db[_0x1a56('0x66')][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x180'),'onDelete':_0x1a56('0x121')});db['ChatWebsite'][_0x1a56('0x11e')](db[_0x1a56('0x81')],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x180')});db['ChatWebsite']['hasMany'](db[_0x1a56('0x72')],{'as':'ProactiveActions'});db[_0x1a56('0x66')][_0x1a56('0x11e')](db[_0x1a56('0x6c')],{'as':_0x1a56('0x173')});db['ChatWebsite'][_0x1a56('0x11e')](db[_0x1a56('0x6a')],{'as':_0x1a56('0x150')});db[_0x1a56('0x66')][_0x1a56('0x11e')](db[_0x1a56('0x6d')],{'as':'Messages'});db['ChatWebsite'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x66')][_0x1a56('0x128')](db[_0x1a56('0x15b')],{'as':_0x1a56('0x15b'),'foreignKey':'IntervalId'});db[_0x1a56('0x66')]['belongsTo'](db[_0x1a56('0x3b')],{'as':_0x1a56('0x3b'),'foreignKey':'MailAccountId'});db[_0x1a56('0x66')]['belongsTo'](db[_0x1a56('0x87')],{'as':_0x1a56('0x15d'),'foreignKey':_0x1a56('0x15e')});db[_0x1a56('0x66')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x141')});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a56('0x5d')],{});db[_0x1a56('0x68')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x68')][_0x1a56('0x128')](db['CmContact'],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0x68')][_0x1a56('0x128')](db[_0x1a56('0x61')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a56('0x63')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1a56('0x12')],{});db[_0x1a56('0x68')][_0x1a56('0x128')](db[_0x1a56('0x65')],{});db['ChatApplication'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':_0x1a56('0x193'),'foreignKey':_0x1a56('0x11c'),'onDelete':_0x1a56('0x16b')});db['ChatApplication'][_0x1a56('0x128')](db[_0x1a56('0x70')],{'as':_0x1a56('0x194'),'foreignKey':_0x1a56('0x195'),'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x6a')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x196'),'foreignKey':_0x1a56('0x180'),'onDelete':_0x1a56('0x16b')});db['ChatApplication'][_0x1a56('0x128')](db[_0x1a56('0x90')],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db['ChatInteraction'][_0x1a56('0x11e')](db[_0x1a56('0x6d')],{'as':_0x1a56('0x162'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x197')});db[_0x1a56('0x6c')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x179'),'foreignKey':'ChatWebsiteId'});db[_0x1a56('0x6c')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x6c')]['belongsTo'](db[_0x1a56('0x12')],{'as':_0x1a56('0x17a'),'foreignKey':'UserId'});db['ChatInteraction'][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x198'),'as':_0x1a56('0x17c')});db['ChatInteraction']['belongsToMany'](db[_0x1a56('0x90')],{'through':_0x1a56('0x198'),'as':_0x1a56('0x17d')});db[_0x1a56('0x6c')]['belongsToMany'](db['User'],{'as':_0x1a56('0x187'),'through':_0x1a56('0x134'),'foreignKey':_0x1a56('0x197')});db[_0x1a56('0x6d')]['belongsTo'](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x12')});db[_0x1a56('0x6d')][_0x1a56('0x128')](db['CmContact'],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x6d')][_0x1a56('0x128')](db[_0x1a56('0x6c')],{'onDelete':_0x1a56('0x121'),'as':'Interaction','foreignKey':_0x1a56('0x197')});db['ChatMessage']['belongsTo'](db[_0x1a56('0xf3')],{'as':_0x1a56('0xf3'),'foreignKey':'AttachmentId'});db[_0x1a56('0x6d')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x180')});db['ChatOfflineMessage'][_0x1a56('0x11e')](db[_0x1a56('0xf3')],{'as':_0x1a56('0x17e'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x1a56('0x121'),'hooks':!![]});db[_0x1a56('0x6f')][_0x1a56('0x128')](db['CmContact'],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x6f')]['belongsTo'](db[_0x1a56('0x66')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x180')});db[_0x1a56('0x70')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x199'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x1a56('0xed')],{'through':_0x1a56('0x19a'),'as':_0x1a56('0x178')});db['ChatGroup'][_0x1a56('0x11e')](db[_0x1a56('0xd7')],{'as':'Messages','foreignKey':_0x1a56('0x19b'),'onDelete':_0x1a56('0x121')});db['ChatGroup']['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x19c'),'through':'chat_group_has_users'});db[_0x1a56('0x72')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'as':_0x1a56('0x196'),'foreignKey':'ChatWebsiteId'});db[_0x1a56('0x73')]['hasMany'](db[_0x1a56('0x74')],{'as':_0x1a56('0x12c'),'foreignKey':_0x1a56('0x19d')});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x76')],{'as':_0x1a56('0x156'),'foreignKey':'ContactId'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':'ContactId'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x122')],{'as':'HopperHistories','foreignKey':_0x1a56('0x169')});db['CmContact']['hasMany'](db[_0x1a56('0x7d')],{'as':_0x1a56('0x7d'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x1a56('0xdd')],{'as':_0x1a56('0x19e'),'foreignKey':'ContactId'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x61')],{'as':_0x1a56('0x19f'),'foreignKey':_0x1a56('0x169'),'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x6c')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x1a56('0x16b')});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x57')],{'as':_0x1a56('0x136'),'foreignKey':_0x1a56('0x169'),'onDelete':_0x1a56('0x16b')});db['CmContact'][_0x1a56('0x11e')](db[_0x1a56('0x4e')],{'as':_0x1a56('0x124'),'foreignKey':_0x1a56('0x169'),'onDelete':'restrict'});db[_0x1a56('0x74')][_0x1a56('0x11e')](db[_0x1a56('0x3f')],{'as':_0x1a56('0x131'),'foreignKey':_0x1a56('0x169'),'onDelete':_0x1a56('0x16b')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0x1a56('0x1a0'),'foreignKey':_0x1a56('0x19d')});db[_0x1a56('0x74')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':'ListId','onDelete':_0x1a56('0x121')});db['CmContact'][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x187'),'through':_0x1a56('0x12d')});db[_0x1a56('0x74')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'as':'Tags','through':_0x1a56('0x1a1')});db[_0x1a56('0x74')]['belongsToMany'](db[_0x1a56('0x90')],{'through':_0x1a56('0x1a1'),'as':_0x1a56('0x17d')});db[_0x1a56('0x76')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x1a56('0x76')][_0x1a56('0x128')](db['CmList'],{'as':'List','foreignKey':_0x1a56('0x175'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'Agent','foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0x1b')],{'as':_0x1a56('0x194'),'foreignKey':_0x1a56('0x155'),'onDelete':'cascade'});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0xf0')],{'as':_0x1a56('0xf0'),'foreignKey':_0x1a56('0x1a2'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x76')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':'Owner','foreignKey':_0x1a56('0x1a3')});db[_0x1a56('0x78')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169'),'onDelete':'cascade'});db[_0x1a56('0x78')][_0x1a56('0x128')](db['CmList'],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x78')]['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x1a56('0x155'),'onDelete':_0x1a56('0x121')});db['CmHopperBlack'][_0x1a56('0x128')](db['Campaign'],{'as':_0x1a56('0xf0'),'foreignKey':_0x1a56('0x1a2'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x80')][_0x1a56('0x11e')](db[_0x1a56('0x84')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x1a56('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x1a56('0x11e')](db[_0x1a56('0x84')],{'as':{'plural':_0x1a56('0x1a5'),'singular':_0x1a56('0x1a6')},'foreignKey':_0x1a56('0x1a7'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db['Automation'][_0x1a56('0x11e')](db[_0x1a56('0x1a8')],{'as':_0x1a56('0x1a9'),'foreignKey':_0x1a56('0x1aa'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db['Disposition'][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x1ab'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x15b')][_0x1a56('0x11e')](db[_0x1a56('0x15b')],{'as':_0x1a56('0x1ac'),'foreignKey':_0x1a56('0x15c'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x1a56('0x15b')]['hasMany'](db['VoiceExtension'],{'as':_0x1a56('0x120'),'foreignKey':_0x1a56('0x15c'),'onDelete':'restrict'});db['Interval'][_0x1a56('0x11e')](db['MailApplication'],{'as':_0x1a56('0x1ad'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x15b')][_0x1a56('0x11e')](db[_0x1a56('0x6a')],{'as':_0x1a56('0x1ae'),'foreignKey':'IntervalId'});db[_0x1a56('0x15b')]['hasMany'](db[_0x1a56('0x4c')],{'as':_0x1a56('0x1af'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x15b')][_0x1a56('0x11e')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x8c')][_0x1a56('0x128')](db['MailAccount'],{});db[_0x1a56('0x8c')][_0x1a56('0x128')](db[_0x1a56('0x9a')],{'foreignKey':_0x1a56('0x1b0')});db[_0x1a56('0x8c')]['belongsTo'](db[_0x1a56('0x98')],{'foreignKey':_0x1a56('0x1b1')});db[_0x1a56('0x8e')][_0x1a56('0x12a')](db['VoiceMusicOnHold'],{'as':_0x1a56('0x1b2'),'through':_0x1a56('0x153'),'onDelete':'restrict'});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x74')],{'through':_0x1a56('0x1a1')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x6c')],{'through':_0x1a56('0x198')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x1a56('0x90')]['belongsToMany'](db[_0x1a56('0x57')],{'through':_0x1a56('0x18d')});db[_0x1a56('0x90')]['belongsToMany'](db[_0x1a56('0x4e')],{'through':_0x1a56('0x186')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x61')],{'through':_0x1a56('0x191')});db[_0x1a56('0x90')][_0x1a56('0x12a')](db[_0x1a56('0x10c')],{'through':_0x1a56('0x1b3')});db['Trigger']['hasMany'](db[_0x1a56('0x84')],{'as':{'plural':'AllConditions','singular':_0x1a56('0x1b4')},'foreignKey':_0x1a56('0x1b5'),'onDelete':_0x1a56('0x121'),'hooks':!![]});db['Trigger'][_0x1a56('0x11e')](db[_0x1a56('0x84')],{'as':{'plural':_0x1a56('0x1b6'),'singular':_0x1a56('0x1b7')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x1a56('0x93')][_0x1a56('0x11e')](db[_0x1a56('0x1a8')],{'as':_0x1a56('0x1a9'),'foreignKey':'TriggerId','onDelete':_0x1a56('0x121'),'hooks':!![]});db[_0x1a56('0x98')][_0x1a56('0x11e')](db[_0x1a56('0x9e')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1a56('0x1b1'),'hooks':!![]});db[_0x1a56('0x9a')]['hasMany'](db[_0x1a56('0x9e')],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1b0')});db['AnalyticMetric'][_0x1a56('0x11e')](db['AnalyticFieldReport'],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':'MetricId'});db[_0x1a56('0x9e')]['belongsTo'](db[_0x1a56('0x1b9')],{'foreignKey':_0x1a56('0x1ba')});db[_0x1a56('0xa2')][_0x1a56('0x11e')](db[_0x1a56('0xa4')],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xa4')][_0x1a56('0x11e')](db['SalesforceField'],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':'SubjectId'});db[_0x1a56('0xa4')][_0x1a56('0x11e')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1be')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x1a56('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xa4')][_0x1a56('0x128')](db['SalesforceAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0x1c0')][_0x1a56('0x11e')](db[_0x1a56('0x1c0')],{'as':'Subject','foreignKey':_0x1a56('0x1c1')});db['SalesforceField'][_0x1a56('0x11e')](db[_0x1a56('0x1c0')],{'as':_0x1a56('0x1c2'),'foreignKey':'DescriptionId'});db[_0x1a56('0x1c0')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0x1c0')][_0x1a56('0x128')](db['Variable'],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xa6')]['hasMany'](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db['SugarcrmConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xa8')][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':_0x1a56('0x1c4'),'onDelete':'cascade','foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xa8')][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':'Fields','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xa8')][_0x1a56('0x128')](db[_0x1a56('0xa6')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xaa')][_0x1a56('0x11e')](db['SugarcrmField'],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xaa')][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x1a56('0x11e')](db[_0x1a56('0xaa')],{'as':_0x1a56('0x1c6'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xac')][_0x1a56('0x11e')](db[_0x1a56('0xad')],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':'SubjectId'});db[_0x1a56('0xad')]['hasMany'](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c4'),'onDelete':_0x1a56('0x121'),'foreignKey':'DescriptionId'});db[_0x1a56('0xad')][_0x1a56('0x11e')](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xad')][_0x1a56('0x128')](db[_0x1a56('0xac')],{'as':_0x1a56('0x179'),'foreignKey':'AccountId'});db[_0x1a56('0xad')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':_0x1a56('0x1c7')});db[_0x1a56('0xaf')][_0x1a56('0x11e')](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xaf')]['hasMany'](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c2'),'foreignKey':_0x1a56('0x1be')});db['DeskField'][_0x1a56('0x11e')](db[_0x1a56('0xaf')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xaf')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xb1')][_0x1a56('0x11e')](db['ZohoConfiguration'],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db['ZohoConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xb4')],{'as':_0x1a56('0x1bd'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xb2')][_0x1a56('0x11e')](db[_0x1a56('0xb4')],{'as':'Descriptions','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xb2')][_0x1a56('0x11e')](db[_0x1a56('0xb4')],{'as':_0x1a56('0x1b8'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xb2')][_0x1a56('0x128')](db[_0x1a56('0xb1')],{'as':'Account','foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xb4')][_0x1a56('0x11e')](db['ZohoField'],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xb4')]['hasMany'](db['ZohoField'],{'as':'Description','foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xb4')]['hasMany'](db[_0x1a56('0xb4')],{'as':_0x1a56('0x1c6'),'foreignKey':'FieldId'});db[_0x1a56('0xb4')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':'Variable','foreignKey':_0x1a56('0x1c3')});db['ZendeskAccount'][_0x1a56('0x11e')](db[_0x1a56('0x1c8')],{'as':_0x1a56('0x1bb'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bc')});db['ZendeskConfiguration']['hasMany'](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1bd'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0x1c8')][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':'Descriptions','foreignKey':_0x1a56('0x1be')});db['ZendeskConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':'Fields','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0x1c8')]['belongsTo'](db['ZendeskAccount'],{'as':_0x1a56('0x179'),'foreignKey':'AccountId'});db[_0x1a56('0x1c8')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xb9')][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1c2'),'foreignKey':'DescriptionId'});db[_0x1a56('0xb9')][_0x1a56('0x11e')](db[_0x1a56('0xb9')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xb9')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xbb')][_0x1a56('0x11e')](db['FreshdeskConfiguration'],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':'Subjects','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1c1')});db['FreshdeskConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':_0x1a56('0x1c4'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x1a56('0xbc')][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':_0x1a56('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xbc')][_0x1a56('0x128')](db['FreshdeskAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db['FreshdeskConfiguration'][_0x1a56('0x12a')](db['Tag'],{'through':_0x1a56('0x1c9')});db['FreshdeskField'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':_0x1a56('0x1c5'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x1a56('0x11e')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x1a56('0x1be')});db['FreshdeskField'][_0x1a56('0x11e')](db[_0x1a56('0xbd')],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x1a56('0x11e')](db[_0x1a56('0x1ca')],{'as':_0x1a56('0x1bb'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bc')});db['VtigerConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1bd'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0x1ca')]['hasMany'](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1c4'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1b8'),'foreignKey':_0x1a56('0x1bf')});db['VtigerConfiguration']['belongsTo'](db[_0x1a56('0xbf')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc2')][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xc2')][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1a56('0xc2')][_0x1a56('0x11e')](db[_0x1a56('0xc2')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0xc2')]['belongsTo'](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':'VariableId'});db[_0x1a56('0xc3')][_0x1a56('0x11e')](db[_0x1a56('0xc4')],{'as':'Configurations','onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc4')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c4'),'foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xc4')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1b8'),'foreignKey':'FieldId'});db[_0x1a56('0xc4')][_0x1a56('0x128')](db[_0x1a56('0xc3')],{'as':'Account','foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0x1cb')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c5'),'foreignKey':'SubjectId'});db[_0x1a56('0x1cb')][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c2'),'foreignKey':_0x1a56('0x1be')});db['ServicenowField'][_0x1a56('0x11e')](db[_0x1a56('0x1cb')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db['ServicenowField']['belongsTo'](db[_0x1a56('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1a56('0xc7')][_0x1a56('0x11e')](db[_0x1a56('0x1cc')],{'as':_0x1a56('0x1bb'),'onDelete':_0x1a56('0x121'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc7')][_0x1a56('0x128')](db[_0x1a56('0x113')],{'as':'CloudProvider','foreignKey':_0x1a56('0x16c')});db[_0x1a56('0x1cc')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1bd'),'onDelete':'cascade','foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0x1cc')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c4'),'onDelete':_0x1a56('0x121'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1b8'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bf')});db[_0x1a56('0x1cc')]['belongsTo'](db[_0x1a56('0xc7')],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xc9')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c5'),'foreignKey':'SubjectId'});db[_0x1a56('0xc9')][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c2'),'foreignKey':_0x1a56('0x1be')});db['Dynamics365Field'][_0x1a56('0x11e')](db[_0x1a56('0xc9')],{'as':_0x1a56('0x1c6'),'foreignKey':_0x1a56('0x1bf')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xcb')][_0x1a56('0x11e')](db['FreshsalesConfiguration'],{'as':_0x1a56('0x1bb'),'onDelete':'cascade','foreignKey':_0x1a56('0x1bc')});db[_0x1a56('0xcd')][_0x1a56('0x11e')](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1bd'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xcd')]['hasMany'](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1c4'),'foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xcd')]['hasMany'](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1b8'),'foreignKey':_0x1a56('0x1bf')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x1a56('0x179'),'foreignKey':_0x1a56('0x1bc')});db['FreshsalesField'][_0x1a56('0x11e')](db[_0x1a56('0xcf')],{'as':_0x1a56('0x1c5'),'foreignKey':_0x1a56('0x1c1')});db[_0x1a56('0xcf')][_0x1a56('0x11e')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x1a56('0x1be')});db[_0x1a56('0xcf')][_0x1a56('0x11e')](db[_0x1a56('0xcf')],{'as':'Field','foreignKey':'FieldId'});db[_0x1a56('0xcf')][_0x1a56('0x128')](db[_0x1a56('0x95')],{'as':_0x1a56('0x95'),'foreignKey':_0x1a56('0x1c3')});db[_0x1a56('0xd5')][_0x1a56('0x128')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':'List','foreignKey':'ListId'});db[_0x1a56('0xd5')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':'ContactId'});db[_0x1a56('0xd5')]['belongsTo'](db[_0x1a56('0x6c')],{});db[_0x1a56('0xd5')]['belongsTo'](db['ChatMessage'],{});db[_0x1a56('0xd5')][_0x1a56('0x128')](db[_0x1a56('0x12')],{});db[_0x1a56('0xd5')][_0x1a56('0x128')](db[_0x1a56('0x70')],{});db[_0x1a56('0xd7')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x1a56('0xd7')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':'cascade','foreignKey':_0x1a56('0x1cd')});db[_0x1a56('0xdd')][_0x1a56('0x11e')](db['JscriptyQuestionReport'],{'foreignKey':_0x1a56('0x1ce'),'onDelete':_0x1a56('0x121')});db['JscriptySessionReport'][_0x1a56('0x11e')](db[_0x1a56('0xd9')],{'foreignKey':'SessionId','onDelete':_0x1a56('0x121')});db['SmsQueueReport'][_0x1a56('0x128')](db['SmsAccount'],{});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':'List','foreignKey':_0x1a56('0x175')});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x57')],{});db['SmsQueueReport'][_0x1a56('0x128')](db[_0x1a56('0x59')],{});db[_0x1a56('0x1cf')]['belongsTo'](db[_0x1a56('0x12')],{});db[_0x1a56('0x1cf')][_0x1a56('0x128')](db[_0x1a56('0x5b')],{});db['JscriptyProject'][_0x1a56('0x11e')](db[_0x1a56('0xdd')],{'foreignKey':'ProjectId'});db[_0x1a56('0xe4')][_0x1a56('0x11e')](db[_0x1a56('0xdb')],{'foreignKey':'ProjectId'});db[_0x1a56('0xe4')][_0x1a56('0x11e')](db['JscriptyAnswerReport'],{'foreignKey':_0x1a56('0x1d0')});db[_0x1a56('0xe8')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':'Users','through':_0x1a56('0x14c')});db[_0x1a56('0xed')][_0x1a56('0x12a')](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':'user_has_teams'});db[_0x1a56('0xed')][_0x1a56('0x12a')](db[_0x1a56('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x1a56('0xed')][_0x1a56('0x12a')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x1a56('0xed')][_0x1a56('0x12a')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x1a56('0x13c')});db[_0x1a56('0xed')]['belongsToMany'](db['FaxQueue'],{'through':_0x1a56('0x189'),'as':_0x1a56('0x13d')});db[_0x1a56('0xed')][_0x1a56('0x12a')](db[_0x1a56('0x5b')],{'through':_0x1a56('0x1d1'),'as':'SmsQueues'});db['Team'][_0x1a56('0x12a')](db[_0x1a56('0x65')],{'through':_0x1a56('0x192'),'as':_0x1a56('0x1d2')});db[_0x1a56('0xed')]['belongsToMany'](db[_0x1a56('0x112')],{'through':_0x1a56('0x1d3'),'as':_0x1a56('0x1d4')});db[_0x1a56('0xed')]['belongsToMany'](db[_0x1a56('0x101')],{'through':'TeamVoicePrefix','as':_0x1a56('0x1d5')});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db[_0x1a56('0x76')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':_0x1a56('0x1a2')});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db[_0x1a56('0x122')],{'as':_0x1a56('0x158'),'foreignKey':_0x1a56('0x1a2')});db[_0x1a56('0xf0')][_0x1a56('0x11e')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x1a56('0x1a2')});db[_0x1a56('0xf0')][_0x1a56('0x128')](db[_0x1a56('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x1a56('0xf0')]['belongsTo'](db[_0x1a56('0x2b')],{'as':_0x1a56('0x1d6'),'foreignKey':'TrunkBackupId'});db[_0x1a56('0xf0')]['belongsTo'](db['Interval'],{'as':_0x1a56('0x15b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0xf0')][_0x1a56('0x128')](db['SquareProject'],{'as':_0x1a56('0xe8'),'foreignKey':'SquareProjectId'});db[_0x1a56('0xf0')][_0x1a56('0x12a')](db[_0x1a56('0x100')],{'as':_0x1a56('0x12e'),'through':'campaigns_has_cm_lists'});db[_0x1a56('0xf0')][_0x1a56('0x12a')](db[_0x1a56('0x100')],{'as':_0x1a56('0x1d7'),'through':_0x1a56('0x1d8')});db['Attachment'][_0x1a56('0x128')](db[_0x1a56('0x6f')],{'as':_0x1a56('0x6f'),'foreignKey':_0x1a56('0x1d9')});db[_0x1a56('0xf7')][_0x1a56('0x128')](db['MailMessage'],{});db[_0x1a56('0xf7')]['belongsTo'](db[_0x1a56('0x3f')],{});db[_0x1a56('0xf7')][_0x1a56('0x128')](db['MailAccount'],{'foreignKey':_0x1a56('0x1da'),'as':_0x1a56('0x1db')});db['MailTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':'FromUserId','as':_0x1a56('0x1dc')});db[_0x1a56('0xf7')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0xf7')][_0x1a56('0x128')](db[_0x1a56('0x3d')],{'foreignKey':_0x1a56('0x1df'),'as':_0x1a56('0x1e0')});db[_0x1a56('0xf7')]['belongsTo'](db[_0x1a56('0x3b')],{'foreignKey':_0x1a56('0x1e1'),'as':_0x1a56('0x1e2')});db[_0x1a56('0xf9')][_0x1a56('0x128')](db[_0x1a56('0x6d')],{});db[_0x1a56('0xf9')]['belongsTo'](db['ChatInteraction'],{});db[_0x1a56('0xf9')][_0x1a56('0x128')](db[_0x1a56('0x66')],{'foreignKey':_0x1a56('0x1e3'),'as':_0x1a56('0x1db')});db[_0x1a56('0xf9')]['belongsTo'](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':_0x1a56('0x1dc')});db[_0x1a56('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0xf9')][_0x1a56('0x128')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x1a56('0x1e0')});db['ChatTransferReport']['belongsTo'](db[_0x1a56('0x66')],{'foreignKey':'ToChatWebsiteId','as':_0x1a56('0x1e2')});db[_0x1a56('0xfb')][_0x1a56('0x128')](db[_0x1a56('0x50')],{});db[_0x1a56('0xfb')][_0x1a56('0x128')](db['FaxInteraction'],{});db[_0x1a56('0xfb')][_0x1a56('0x128')](db['FaxAccount'],{'foreignKey':_0x1a56('0x1e5'),'as':'FromAccount'});db[_0x1a56('0xfb')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':_0x1a56('0x1dc')});db[_0x1a56('0xfb')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db['FaxTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x52')],{'foreignKey':_0x1a56('0x1e6'),'as':_0x1a56('0x1e0')});db['FaxTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x4a')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x63')],{});db[_0x1a56('0xfd')][_0x1a56('0x128')](db['OpenchannelInteraction'],{});db[_0x1a56('0xfd')][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x1a56('0x1db')});db[_0x1a56('0xfd')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':_0x1a56('0x1dc')});db[_0x1a56('0xfd')][_0x1a56('0x128')](db['User'],{'foreignKey':_0x1a56('0x1dd'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x1a56('0x65')],{'foreignKey':_0x1a56('0x1e7'),'as':_0x1a56('0x1e0')});db[_0x1a56('0xfd')][_0x1a56('0x128')](db[_0x1a56('0x5d')],{'foreignKey':_0x1a56('0x1e8'),'as':_0x1a56('0x1e2')});db[_0x1a56('0xff')][_0x1a56('0x128')](db[_0x1a56('0x59')],{});db['SmsTransferReport'][_0x1a56('0x128')](db['SmsInteraction'],{});db['SmsTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x146')],{'foreignKey':_0x1a56('0x1e9'),'as':_0x1a56('0x1db')});db[_0x1a56('0xff')]['belongsTo'](db[_0x1a56('0x12')],{'foreignKey':'FromUserId','as':_0x1a56('0x1dc')});db[_0x1a56('0xff')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0xff')]['belongsTo'](db[_0x1a56('0x5b')],{'foreignKey':_0x1a56('0x1ea'),'as':_0x1a56('0x1e0')});db[_0x1a56('0xff')][_0x1a56('0x128')](db[_0x1a56('0x146')],{'foreignKey':'ToSmsAccountId','as':_0x1a56('0x1e2')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x16f')],{'as':_0x1a56('0x170'),'foreignKey':'ListId','onDelete':_0x1a56('0x121')});db[_0x1a56('0x100')]['hasMany'](db[_0x1a56('0x7f')],{'as':_0x1a56('0x1eb'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x74')],{'as':_0x1a56('0x12c'),'onDelete':'cascade','foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x7a')],{'as':_0x1a56('0x157'),'foreignKey':_0x1a56('0x175')});db['CmList']['hasMany'](db[_0x1a56('0x122')],{'as':_0x1a56('0x123'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x11e')](db[_0x1a56('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x1a56('0x175')});db[_0x1a56('0x100')][_0x1a56('0x12a')](db[_0x1a56('0x1b')],{'as':'Queues','through':_0x1a56('0x15f')});db['CmList']['belongsToMany'](db[_0x1a56('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x1a56('0x101')][_0x1a56('0x11e')](db[_0x1a56('0x18')],{'as':_0x1a56('0x120'),'onDelete':_0x1a56('0x121')});db[_0x1a56('0x101')][_0x1a56('0x12a')](db['User'],{'as':_0x1a56('0x160'),'through':_0x1a56('0x117')});db[_0x1a56('0x101')]['belongsToMany'](db['Team'],{'through':_0x1a56('0x1ec'),'as':_0x1a56('0x178')});db[_0x1a56('0x103')]['hasMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x187'),'foreignKey':_0x1a56('0x129')});db[_0x1a56('0x103')][_0x1a56('0x11e')](db[_0x1a56('0x104')],{'as':_0x1a56('0x1ed'),'foreignKey':_0x1a56('0x129'),'onDelete':_0x1a56('0x121')});db['UserProfileSection']['hasMany'](db[_0x1a56('0x105')],{'as':_0x1a56('0x1ee'),'foreignKey':_0x1a56('0x1ef'),'onDelete':_0x1a56('0x121')});db['WhatsappAccount'][_0x1a56('0x11e')](db['Disposition'],{'as':_0x1a56('0x170'),'foreignKey':_0x1a56('0x1f0'),'onDelete':'cascade'});db[_0x1a56('0x108')][_0x1a56('0x11e')](db['CannedAnswer'],{'as':_0x1a56('0x172'),'foreignKey':_0x1a56('0x1f0')});db[_0x1a56('0x108')][_0x1a56('0x11e')](db[_0x1a56('0x1f1')],{'as':'Messages','foreignKey':_0x1a56('0x1f0')});db['WhatsappAccount']['hasMany'](db['WhatsappInteraction'],{'as':_0x1a56('0x173')});db['WhatsappAccount'][_0x1a56('0x11e')](db['WhatsappApplication'],{'as':_0x1a56('0x150')});db['WhatsappAccount'][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x108')]['belongsTo'](db[_0x1a56('0x87')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x1a56('0x108')]['belongsToMany'](db[_0x1a56('0x12')],{'as':'Agents','through':_0x1a56('0x14a')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'onDelete':_0x1a56('0x16b')});db['WhatsappApplication']['belongsTo'](db[_0x1a56('0x112')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db[_0x1a56('0x108')],{'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db['Interval'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x15c')});db[_0x1a56('0x10a')][_0x1a56('0x128')](db['Tag'],{'onDelete':_0x1a56('0x16b'),'foreignKey':_0x1a56('0x181')});db[_0x1a56('0x10c')]['hasMany'](db[_0x1a56('0x1f1')],{'as':_0x1a56('0x162'),'onDelete':'cascade','foreignKey':_0x1a56('0x1f2')});db[_0x1a56('0x10c')][_0x1a56('0x128')](db[_0x1a56('0x108')],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x1a56('0x128')](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db['WhatsappInteraction'][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x17a'),'foreignKey':_0x1a56('0x11c')});db[_0x1a56('0x10c')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0x1a56('0x17c')});db[_0x1a56('0x10c')][_0x1a56('0x12a')](db[_0x1a56('0x90')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x1a56('0x10c')]['belongsToMany'](db[_0x1a56('0x12')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x1a56('0x1f2')});db['WhatsappMessage'][_0x1a56('0x128')](db['User'],{'as':_0x1a56('0x12')});db[_0x1a56('0x1f1')][_0x1a56('0x128')](db[_0x1a56('0x74')],{'onDelete':'cascade','as':_0x1a56('0x168')});db[_0x1a56('0x1f1')][_0x1a56('0x128')](db['WhatsappInteraction'],{'onDelete':_0x1a56('0x121'),'as':_0x1a56('0x17f'),'foreignKey':'WhatsappInteractionId'});db[_0x1a56('0x1f1')][_0x1a56('0x128')](db[_0x1a56('0x108')],{'as':'Account','foreignKey':_0x1a56('0x1f0')});db['WhatsappQueueReport']['belongsTo'](db[_0x1a56('0x108')],{});db[_0x1a56('0x10e')][_0x1a56('0x128')](db[_0x1a56('0x100')],{'as':_0x1a56('0x174'),'foreignKey':_0x1a56('0x175')});db[_0x1a56('0x10e')]['belongsTo'](db[_0x1a56('0x74')],{'as':_0x1a56('0x168'),'foreignKey':_0x1a56('0x169')});db[_0x1a56('0x10e')][_0x1a56('0x128')](db['WhatsappInteraction'],{});db[_0x1a56('0x10e')][_0x1a56('0x128')](db['WhatsappQueue'],{});db[_0x1a56('0x10e')]['belongsTo'](db[_0x1a56('0x1f1')],{});db[_0x1a56('0x10e')][_0x1a56('0x128')](db[_0x1a56('0x12')],{});db[_0x1a56('0x110')]['belongsTo'](db[_0x1a56('0x1f1')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1a56('0x10c')],{});db[_0x1a56('0x110')]['belongsTo'](db[_0x1a56('0x108')],{'foreignKey':_0x1a56('0x1f3'),'as':_0x1a56('0x1db')});db[_0x1a56('0x110')]['belongsTo'](db[_0x1a56('0x108')],{'foreignKey':_0x1a56('0x1f4'),'as':_0x1a56('0x1e2')});db[_0x1a56('0x110')][_0x1a56('0x128')](db[_0x1a56('0x112')],{'foreignKey':_0x1a56('0x1f5'),'as':_0x1a56('0x1e0')});db[_0x1a56('0x110')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1e4'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x1a56('0x128')](db[_0x1a56('0x12')],{'foreignKey':_0x1a56('0x1dd'),'as':_0x1a56('0x1de')});db[_0x1a56('0x112')]['belongsToMany'](db[_0x1a56('0x12')],{'as':_0x1a56('0x160'),'through':_0x1a56('0x36'),'foreignKey':_0x1a56('0x1f6')});db[_0x1a56('0x112')][_0x1a56('0x12a')](db[_0x1a56('0xed')],{'through':_0x1a56('0x1d3'),'as':_0x1a56('0x178')});db[_0x1a56('0x119')][_0x1a56('0x128')](db[_0x1a56('0x12')],{'as':_0x1a56('0x1f7'),'foreignKey':_0x1a56('0x11c'),'onDelete':'cascade','hooks':!![]});db[_0x1a56('0x113')][_0x1a56('0x11b')](db[_0x1a56('0xc7')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0x1a56('0x113')][_0x1a56('0x11b')](db[_0x1a56('0x16a')],{'as':_0x1a56('0x16d'),'onDelete':_0x1a56('0x16b')});db[_0x1a56('0x113')][_0x1a56('0x11b')](db['MailServerOut'],{'as':'Smtp','onDelete':'restrict'});module[_0x1a56('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe2cb=['Account','Owner','mail_interaction_has_tags','Tags','Attachments','MailInteractionId','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','Disposition','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','user_has_fax_interactions','Interaction','AttachmentId','SmsAccountId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatMessage','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CmHopper','JscriptySessions','Company','CompanyId','cm_contact_has_tags','Campaign','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Automation','Any','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticCustomReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','SalesforceAccount','Description','Field','FieldId','SugarcrmAccount','SugarcrmConfiguration','Subject','VariableId','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Field','ToId','SessionId','ProjectId','team_has_fax_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToQueue','ToAccount','ChatTransferReport','FromAccount','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToUserId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','xcall','utf8mb4','database','password','options','username','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueue','FaxQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','VoiceContext','Applications','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','mandatoryDispositionPauseId','Agents','team_has_mail_queues'];(function(_0x5d95be,_0x462e3c){var _0x1e5f22=function(_0x32707b){while(--_0x32707b){_0x5d95be['push'](_0x5d95be['shift']());}};_0x1e5f22(++_0x462e3c);}(_0xe2cb,0x90));var _0xbe2c=function(_0xbea377,_0x3af693){_0xbea377=_0xbea377-0x0;var _0x21785d=_0xe2cb[_0xbea377];return _0x21785d;};'use strict';var config=require(_0xbe2c('0x0'));var Sequelize=require(_0xbe2c('0x1'));var _=require(_0xbe2c('0x2'));var jstz=require(_0xbe2c('0x3'));var timezone=jstz['determine']();config[_0xbe2c('0x1')]=_[_0xbe2c('0x4')](config[_0xbe2c('0x1')],{'database':_0xbe2c('0x5'),'username':'xcall','password':_0xbe2c('0x6'),'options':{'host':_0xbe2c('0x7'),'port':0xcea,'dialect':_0xbe2c('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbe2c('0x9')](),'define':{'charset':_0xbe2c('0xa'),'collate':_0xbe2c('0xb')}}});config[_0xbe2c('0xc')]=_[_0xbe2c('0x4')](config[_0xbe2c('0xc')],{'database':_0xbe2c('0x5'),'username':_0xbe2c('0xd'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbe2c('0x8'),'dialectOptions':{'charset':_0xbe2c('0xe')},'logging':![],'timezone':timezone[_0xbe2c('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbe2c('0x1')][_0xbe2c('0xf')],config[_0xbe2c('0x1')]['username'],config[_0xbe2c('0x1')][_0xbe2c('0x10')],config['sequelize'][_0xbe2c('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbe2c('0xc')][_0xbe2c('0xf')],config[_0xbe2c('0xc')][_0xbe2c('0x12')],config[_0xbe2c('0xc')]['password'],config[_0xbe2c('0xc')][_0xbe2c('0x11')])};db['User']=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/user/user.model');db[_0xbe2c('0x14')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x15'));db['VoiceContext']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x16'));db[_0xbe2c('0x17')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x18'));db[_0xbe2c('0x19')]=db['sequelize'][_0xbe2c('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xbe2c('0x1a')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x1b'));db['VoiceRecording']=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xbe2c('0x1c')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/screenRecording/screenRecording.model');db[_0xbe2c('0x1d')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x1e'));db['VoiceMailMessage']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x1f'));db[_0xbe2c('0x20')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x21'));db[_0xbe2c('0x22')]=db['sequelize']['import'](_0xbe2c('0x23'));db['VoiceAgentReport']=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xbe2c('0x24')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x25'));db[_0xbe2c('0x26')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/memberReport/memberReport.model');db[_0xbe2c('0x27')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x28'));db[_0xbe2c('0x29')]=db['sequelize'][_0xbe2c('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xbe2c('0x2a')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x2b'));db[_0xbe2c('0x2c')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x2d'));db[_0xbe2c('0x2e')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x2f'));db[_0xbe2c('0x30')]=db[_0xbe2c('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xbe2c('0x31')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x32'));db[_0xbe2c('0x33')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x34'));db[_0xbe2c('0x35')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xbe2c('0x36')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xbe2c('0x37')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x38'));db[_0xbe2c('0x39')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x3a'));db[_0xbe2c('0x3b')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x3c'));db[_0xbe2c('0x3d')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0xbe2c('0x3e')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xbe2c('0x3f')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x40'));db[_0xbe2c('0x41')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x42'));db[_0xbe2c('0x43')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x44'));db[_0xbe2c('0x45')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x46'));db[_0xbe2c('0x47')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x48'));db[_0xbe2c('0x49')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x4a'));db[_0xbe2c('0x4b')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/faxApplication/faxApplication.model');db[_0xbe2c('0x4c')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x4d'));db[_0xbe2c('0x4e')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x4f'));db['FaxQueue']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x50'));db[_0xbe2c('0x51')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x52'));db[_0xbe2c('0x53')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x54'));db[_0xbe2c('0x55')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/smsApplication/smsApplication.model');db[_0xbe2c('0x56')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x57'));db[_0xbe2c('0x58')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/smsMessage/smsMessage.model');db[_0xbe2c('0x59')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/smsQueue/smsQueue.model');db[_0xbe2c('0x5a')]=db['sequelize']['import'](_0xbe2c('0x5b'));db['OpenchannelApplication']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x5c'));db[_0xbe2c('0x5d')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x5e'));db['OpenchannelMessage']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x5f'));db[_0xbe2c('0x60')]=db[_0xbe2c('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xbe2c('0x61')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x62'));db[_0xbe2c('0x63')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x64'));db[_0xbe2c('0x65')]=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db[_0xbe2c('0x66')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x67'));db['ChatMessage']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x68'));db[_0xbe2c('0x69')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x6a'));db[_0xbe2c('0x6b')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x6c'));db[_0xbe2c('0x6d')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/chatGroup/chatGroup.model');db[_0xbe2c('0x6e')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x6f'));db[_0xbe2c('0x70')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x71'));db[_0xbe2c('0x72')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x73'));db['CmHopper']=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x74'));db[_0xbe2c('0x75')]=db['sequelize'][_0xbe2c('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xbe2c('0x76')]=db['sequelize'][_0xbe2c('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x77'));db['ReportAgentPreview']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x78'));db[_0xbe2c('0x79')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x7a'));db[_0xbe2c('0x7b')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x7c'));db['Automation']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x7d'));db[_0xbe2c('0x7e')]=db['sequelize']['import'](_0xbe2c('0x7f'));db['Disposition']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x80'));db['Condition']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x81'));db[_0xbe2c('0x82')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/interval/interval.model');db[_0xbe2c('0x83')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/pause/pause.model');db['Cdr']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x84'));db[_0xbe2c('0x85')]=db[_0xbe2c('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xbe2c('0x86')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x87'));db[_0xbe2c('0x88')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x89'));db[_0xbe2c('0x8a')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x8b'));db[_0xbe2c('0x8c')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x8d'));db[_0xbe2c('0x8e')]=db['sequelize'][_0xbe2c('0x13')]('../api/trigger/trigger.model');db[_0xbe2c('0x8f')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x90'));db[_0xbe2c('0x91')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x92'));db[_0xbe2c('0x93')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x94'));db['AnalyticCustomReport']=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x95'));db['AnalyticDefaultReport']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x96'));db[_0xbe2c('0x97')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x98'));db['AnalyticMetric']=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0x99'));db[_0xbe2c('0x9a')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x9b'));db['SalesforceAccount']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x9c'));db[_0xbe2c('0x9d')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xbe2c('0x9e')]=db['sequelize']['import'](_0xbe2c('0x9f'));db['SugarcrmAccount']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xa0'));db['SugarcrmConfiguration']=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0xa1'));db[_0xbe2c('0xa2')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xbe2c('0xa3')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xbe2c('0xa4')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xa5'));db['DeskField']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xa6'));db[_0xbe2c('0xa7')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xa8'));db['ZohoConfiguration']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xa9'));db[_0xbe2c('0xaa')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0xab'));db['ZendeskAccount']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xac'));db[_0xbe2c('0xad')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xae'));db['ZendeskField']=db['sequelize']['import'](_0xbe2c('0xaf'));db[_0xbe2c('0xb0')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xb1'));db['FreshdeskConfiguration']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xb2'));db[_0xbe2c('0xb3')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xb4'));db['VtigerAccount']=db[_0xbe2c('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db['sequelize'][_0xbe2c('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xbe2c('0xb5')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xb6'));db[_0xbe2c('0xb7')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xb8'));db[_0xbe2c('0xb9')]=db[_0xbe2c('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xbe2c('0xba')]=db['sequelize'][_0xbe2c('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xbe2c('0xbb')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xbc'));db[_0xbe2c('0xbd')]=db['sequelize']['import'](_0xbe2c('0xbe'));db['Dynamics365Field']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xbf'));db[_0xbe2c('0xc0')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xbe2c('0xc1')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xc2'));db[_0xbe2c('0xc3')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xc4'));db[_0xbe2c('0x91')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x92'));db[_0xbe2c('0xc5')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/network/network.model');db[_0xbe2c('0xc6')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xc7'));db['ChatInternalMessage']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xc8'));db[_0xbe2c('0xc9')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xca'));db[_0xbe2c('0xcb')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xbe2c('0xcc')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xcd'));db[_0xbe2c('0xce')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xbe2c('0xcf')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xd0'));db[_0xbe2c('0xd1')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0xbe2c('0xd2')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xd3'));db[_0xbe2c('0xd4')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xd5'));db[_0xbe2c('0xd6')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xd7'));db[_0xbe2c('0xd8')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/squareProject/squareProject.model');db[_0xbe2c('0xd9')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xda'));db[_0xbe2c('0xdb')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xdc'));db[_0xbe2c('0xdd')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/team/team.model');db[_0xbe2c('0xde')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/license/license.model');db['Campaign']=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0xdf'));db[_0xbe2c('0xe0')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xe1'));db[_0xbe2c('0xe2')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xe3'));db[_0xbe2c('0xe4')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xe5'));db[_0xbe2c('0xe6')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xe7'));db['ChatTransferReport']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xe8'));db['FaxTransferReport']=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xbe2c('0xe9')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xea'));db[_0xbe2c('0xeb')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xec'));db[_0xbe2c('0xed')]=db[_0xbe2c('0x1')]['import']('../api/cmList/cmList.model');db[_0xbe2c('0xee')]=db['sequelize'][_0xbe2c('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xbe2c('0xef')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xf0'));db[_0xbe2c('0xf1')]=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0xf2'));db[_0xbe2c('0xf3')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xf4'));db['UserNotification']=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/userNotification/userNotification.model');db[_0xbe2c('0xf5')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0xbe2c('0xf6')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0xbe2c('0xf7')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0xf8'));db['WhatsappQueueReport']=db[_0xbe2c('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xbe2c('0xf9')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xfa'));db[_0xbe2c('0xfb')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xfc'));db['CloudProvider']=db['sequelize'][_0xbe2c('0x13')](_0xbe2c('0xfd'));db[_0xbe2c('0xfe')]=db[_0xbe2c('0x1')]['import'](_0xbe2c('0xff'));db['TeamVoicePrefix']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x100'));db['UserVoicePrefix']=db[_0xbe2c('0x1')]['import'](_0xbe2c('0x101'));db[_0xbe2c('0x102')]=db[_0xbe2c('0x1')][_0xbe2c('0x13')](_0xbe2c('0x103'));db[_0xbe2c('0x104')][_0xbe2c('0x105')](db['VoiceMail'],{'as':_0xbe2c('0x1d'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x107')});db['User'][_0xbe2c('0x105')](db[_0xbe2c('0x102')],{'as':_0xbe2c('0x108'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x10a')],{'as':_0xbe2c('0x10b'),'foreignKey':'UserId'});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x10c')],{'as':_0xbe2c('0x10d'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x17')],{'as':_0xbe2c('0x10e'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db['CmHopperFinal'],{'as':_0xbe2c('0x10f'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xbe2c('0x110')],{'as':_0xbe2c('0x111'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x112')],{'as':_0xbe2c('0x112'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x5d')],{'as':_0xbe2c('0x113'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x66')],{'as':'ChatInteractions','foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db['SmsInteraction'],{'as':_0xbe2c('0x114'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')][_0xbe2c('0x109')](db[_0xbe2c('0x4c')],{'as':_0xbe2c('0x115'),'foreignKey':_0xbe2c('0x107')});db['User']['hasMany'](db[_0xbe2c('0x3e')],{'as':_0xbe2c('0x116'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')]['hasMany'](db[_0xbe2c('0xf7')],{'as':'WhatsappInteractions','foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x104')]['hasMany'](db['UserNotification'],{'as':'UserNotifications','foreignKey':'SenderId'});db['User'][_0xbe2c('0x117')](db[_0xbe2c('0xef')],{'as':'UserProfile','foreignKey':_0xbe2c('0x118')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db['ChatGroup'],{'as':_0xbe2c('0x11a'),'through':_0xbe2c('0x11b')});db[_0xbe2c('0x104')]['belongsToMany'](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x11c'),'through':_0xbe2c('0x11d')});db[_0xbe2c('0x104')]['belongsToMany'](db['CmList'],{'as':_0xbe2c('0x11e'),'through':_0xbe2c('0x11f')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db['Team'],{'through':_0xbe2c('0x120')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x3e')],{'as':_0xbe2c('0x116'),'through':_0xbe2c('0x121')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db['ChatInteraction'],{'as':_0xbe2c('0x122'),'through':_0xbe2c('0x123')});db[_0xbe2c('0x104')]['belongsToMany'](db[_0xbe2c('0x4c')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xbe2c('0x104')]['belongsToMany'](db[_0xbe2c('0x56')],{'as':'SmsInteractions','through':_0xbe2c('0x124')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db['OpenchannelInteraction'],{'as':_0xbe2c('0x113'),'through':_0xbe2c('0x125')});db['User'][_0xbe2c('0x119')](db[_0xbe2c('0xf7')],{'as':_0xbe2c('0x126'),'through':'user_has_whatsapp_interactions'});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db['VoiceQueue'],{'as':_0xbe2c('0x127'),'through':_0xbe2c('0x2a'),'required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0xee')],{'as':_0xbe2c('0x128'),'through':_0xbe2c('0x129'),'required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x3b')],{'as':_0xbe2c('0x12a'),'through':_0xbe2c('0x2e'),'required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x6b')],{'as':_0xbe2c('0x12b'),'through':_0xbe2c('0x2c'),'required':![],'hooks':!![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x12c')],{'as':_0xbe2c('0x12d'),'through':'UserFaxQueue','required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x59')],{'as':'SmsQueues','through':_0xbe2c('0x31'),'required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x60')],{'as':_0xbe2c('0x12e'),'through':_0xbe2c('0x33'),'required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0xfb')],{'as':_0xbe2c('0x12f'),'through':'UserWhatsappQueue','required':![]});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0xed')],{'through':_0xbe2c('0x11f')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x61')],{'as':_0xbe2c('0x130'),'through':_0xbe2c('0x131')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x49')],{'as':_0xbe2c('0x132'),'through':_0xbe2c('0x133')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db['MailAccount'],{'as':'MailAccounts','through':_0xbe2c('0x134')});db[_0xbe2c('0x104')][_0xbe2c('0x119')](db[_0xbe2c('0x5a')],{'as':'OpenchannelAccounts','through':_0xbe2c('0x135')});db['User'][_0xbe2c('0x119')](db['SmsAccount'],{'as':_0xbe2c('0x136'),'through':_0xbe2c('0x137')});db[_0xbe2c('0x104')]['belongsToMany'](db[_0xbe2c('0xf5')],{'as':_0xbe2c('0x138'),'through':_0xbe2c('0x139')});db['User'][_0xbe2c('0x119')](db[_0xbe2c('0xd8')],{'as':_0xbe2c('0x13a'),'through':_0xbe2c('0x13b')});db[_0xbe2c('0x14')][_0xbe2c('0x109')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x13c')});db[_0xbe2c('0x13d')][_0xbe2c('0x109')](db['VoiceExtension'],{'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x17')][_0xbe2c('0x109')](db[_0xbe2c('0x17')],{'as':_0xbe2c('0x13e'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x19')][_0xbe2c('0x119')](db[_0xbe2c('0x88')],{'as':'Sounds','through':_0xbe2c('0x13f')});db['VoiceQueue'][_0xbe2c('0x109')](db[_0xbe2c('0x10c')],{'as':_0xbe2c('0x140'),'foreignKey':'VoiceQueueId'});db[_0xbe2c('0x1a')]['hasMany'](db['CmHopper'],{'as':_0xbe2c('0x141'),'foreignKey':_0xbe2c('0x142')});db[_0xbe2c('0x1a')][_0xbe2c('0x109')](db[_0xbe2c('0x76')],{'as':_0xbe2c('0x10f'),'foreignKey':_0xbe2c('0x142')});db[_0xbe2c('0x1a')][_0xbe2c('0x109')](db[_0xbe2c('0x110')],{'as':_0xbe2c('0x143'),'foreignKey':_0xbe2c('0x142')});db[_0xbe2c('0x1a')][_0xbe2c('0x109')](db[_0xbe2c('0x112')],{'as':_0xbe2c('0x112'),'foreignKey':'VoiceQueueId'});db[_0xbe2c('0x1a')][_0xbe2c('0x109')](db[_0xbe2c('0x75')],{'as':_0xbe2c('0x144'),'foreignKey':_0xbe2c('0x142')});db['VoiceQueue'][_0xbe2c('0x109')](db[_0xbe2c('0xcc')],{'as':'JscriptySessions','foreignKey':_0xbe2c('0x142')});db[_0xbe2c('0x1a')][_0xbe2c('0x117')](db['Trunk'],{'as':'Trunk','foreignKey':_0xbe2c('0x145')});db[_0xbe2c('0x1a')]['belongsTo'](db[_0xbe2c('0x27')],{'as':_0xbe2c('0x146'),'foreignKey':_0xbe2c('0x147')});db['VoiceQueue'][_0xbe2c('0x117')](db['Interval'],{'as':_0xbe2c('0x82'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x1a')][_0xbe2c('0x117')](db[_0xbe2c('0x83')],{'as':_0xbe2c('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xbe2c('0x119')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x11e'),'through':_0xbe2c('0x14a')});db[_0xbe2c('0x1a')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':'Agents','through':_0xbe2c('0x2a')});db['VoiceQueue'][_0xbe2c('0x119')](db[_0xbe2c('0xdd')],{'as':_0xbe2c('0x14b'),'through':_0xbe2c('0xfe')});db[_0xbe2c('0x1a')]['belongsToMany'](db['CmList'],{'as':_0xbe2c('0x14c'),'through':'voice_queues_has_cm_blacklists'});db[_0xbe2c('0x10a')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x104'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x1c')][_0xbe2c('0x117')](db['User'],{'as':'User','foreignKey':_0xbe2c('0x107')});db['VoiceMail'][_0xbe2c('0x109')](db['VoiceMailMessage'],{'as':_0xbe2c('0x14d'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x14e'),'sourceKey':_0xbe2c('0x14f')});db['VoiceMailMessage'][_0xbe2c('0x117')](db[_0xbe2c('0x1d')],{'foreignKey':_0xbe2c('0x14e'),'targetKey':_0xbe2c('0x14f')});db[_0xbe2c('0x20')][_0xbe2c('0x109')](db['VoiceQueueReport'],{'as':_0xbe2c('0x150'),'foreignKey':'uniqueid','constraints':![]});db[_0xbe2c('0x20')][_0xbe2c('0x109')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xbe2c('0x20')]['belongsTo'](db['User'],{'as':_0xbe2c('0x104'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x20')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x36')]['belongsTo'](db[_0xbe2c('0x39')],{'as':_0xbe2c('0x39'),'foreignKey':_0xbe2c('0x153')});db['MailServerIn'][_0xbe2c('0x117')](db[_0xbe2c('0x154')],{'as':_0xbe2c('0x154'),'foreignKey':_0xbe2c('0x155'),'onDelete':_0xbe2c('0x156')});db['MailServerOut'][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{'as':_0xbe2c('0x39'),'foreignKey':_0xbe2c('0x153')});db[_0xbe2c('0x37')][_0xbe2c('0x117')](db[_0xbe2c('0x154')],{'as':_0xbe2c('0x154'),'foreignKey':'CloudProviderId','onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x39')][_0xbe2c('0x105')](db[_0xbe2c('0x36')],{'as':_0xbe2c('0x157'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x39')][_0xbe2c('0x105')](db['MailServerOut'],{'as':_0xbe2c('0x158'),'onDelete':'cascade'});db[_0xbe2c('0x39')][_0xbe2c('0x109')](db['Disposition'],{'as':_0xbe2c('0x159'),'foreignKey':'MailAccountId','onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x39')]['hasMany'](db['CannedAnswer'],{'as':_0xbe2c('0x15a'),'foreignKey':_0xbe2c('0x153')});db[_0xbe2c('0x39')]['hasMany'](db['MailMessage'],{'as':_0xbe2c('0x14d'),'foreignKey':_0xbe2c('0x153')});db[_0xbe2c('0x39')][_0xbe2c('0x109')](db['MailInteraction'],{'as':_0xbe2c('0x15b')});db[_0xbe2c('0x39')][_0xbe2c('0x109')](db[_0xbe2c('0x41')],{'as':_0xbe2c('0x13e')});db[_0xbe2c('0x39')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0x39')]['belongsTo'](db[_0xbe2c('0x8c')],{'as':_0xbe2c('0x8c'),'foreignKey':'TemplateId'});db[_0xbe2c('0x39')]['belongsTo'](db[_0xbe2c('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xbe2c('0x15e')});db[_0xbe2c('0x39')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x134')});db[_0xbe2c('0x3b')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x2e')});db[_0xbe2c('0x3b')][_0xbe2c('0x119')](db[_0xbe2c('0xdd')],{'through':_0xbe2c('0x160'),'as':_0xbe2c('0x14b')});db[_0xbe2c('0x3e')]['hasMany'](db[_0xbe2c('0x3f')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction'][_0xbe2c('0x117')](db['MailAccount'],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x153')});db[_0xbe2c('0x3e')]['belongsTo'](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x3e')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x162'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x3e')]['belongsToMany'](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x163'),'as':_0xbe2c('0x164')});db[_0xbe2c('0x3e')]['belongsToMany'](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x163'),'as':'ThroughTags'});db[_0xbe2c('0x3e')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':'Users','through':_0xbe2c('0x121'),'foreignKey':'MailInteractionId'});db[_0xbe2c('0x3f')][_0xbe2c('0x109')](db[_0xbe2c('0xe2')],{'as':_0xbe2c('0x165'),'onDelete':'cascade'});db[_0xbe2c('0x3f')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x104')});db[_0xbe2c('0x3f')]['belongsTo'](db['CmContact'],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x151')});db[_0xbe2c('0x3f')][_0xbe2c('0x117')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0xbe2c('0x166')});db[_0xbe2c('0x3f')][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x153')});db[_0xbe2c('0x3f')][_0xbe2c('0x117')](db[_0xbe2c('0x61')],{'as':'ChatWebsite','foreignKey':_0xbe2c('0x167')});db[_0xbe2c('0x3f')][_0xbe2c('0x117')](db[_0xbe2c('0x69')],{'as':_0xbe2c('0x69'),'foreignKey':_0xbe2c('0x168')});db[_0xbe2c('0x41')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x41')][_0xbe2c('0x117')](db['MailQueue'],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x41')][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{'onDelete':_0xbe2c('0x156')});db['MailApplication'][_0xbe2c('0x117')](db[_0xbe2c('0x82')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x41')][_0xbe2c('0x117')](db[_0xbe2c('0x8a')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x169')});db['MailQueueReport'][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{});db[_0xbe2c('0x43')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0x43')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbe2c('0x43')][_0xbe2c('0x117')](db['MailInteraction'],{});db[_0xbe2c('0x43')][_0xbe2c('0x117')](db[_0xbe2c('0x3f')],{});db[_0xbe2c('0x43')]['belongsTo'](db[_0xbe2c('0x104')],{});db['MailQueueReport'][_0xbe2c('0x117')](db[_0xbe2c('0x3b')],{});db[_0xbe2c('0x45')]['hasMany'](db[_0xbe2c('0x47')],{'as':_0xbe2c('0x16a'),'onDelete':_0xbe2c('0x106')});db['FaxAccount'][_0xbe2c('0x109')](db[_0xbe2c('0x16b')],{'as':_0xbe2c('0x159'),'foreignKey':_0xbe2c('0x16c'),'onDelete':_0xbe2c('0x106')});db['FaxAccount'][_0xbe2c('0x109')](db['CannedAnswer'],{'as':_0xbe2c('0x15a'),'foreignKey':_0xbe2c('0x16c')});db[_0xbe2c('0x49')][_0xbe2c('0x109')](db[_0xbe2c('0x4c')],{'as':_0xbe2c('0x15b')});db[_0xbe2c('0x49')][_0xbe2c('0x109')](db[_0xbe2c('0x4b')],{'as':_0xbe2c('0x13e')});db[_0xbe2c('0x49')][_0xbe2c('0x109')](db['VoiceExtension'],{'as':_0xbe2c('0x16d'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x49')]['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0xbe2c('0x49')][_0xbe2c('0x117')](db[_0xbe2c('0x27')],{'as':_0xbe2c('0x27')});db[_0xbe2c('0x49')][_0xbe2c('0x117')](db['CmList'],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db['FaxAccount']['belongsTo'](db[_0xbe2c('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xbe2c('0x15e')});db[_0xbe2c('0x49')][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x15f'),'through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db['User'],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x4b')][_0xbe2c('0x117')](db[_0xbe2c('0x12c')],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x4b')][_0xbe2c('0x117')](db[_0xbe2c('0x49')],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x4b')]['belongsTo'](db[_0xbe2c('0x8a')],{'onDelete':_0xbe2c('0x156'),'foreignKey':'TagId'});db['FaxInteraction'][_0xbe2c('0x109')](db[_0xbe2c('0x4e')],{'as':_0xbe2c('0x14d'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x16e')});db[_0xbe2c('0x4c')][_0xbe2c('0x117')](db[_0xbe2c('0x49')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xbe2c('0x4c')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x4c')][_0xbe2c('0x117')](db['User'],{'as':_0xbe2c('0x162'),'foreignKey':'UserId'});db[_0xbe2c('0x4c')]['belongsToMany'](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x16f'),'as':_0xbe2c('0x164')});db['FaxInteraction'][_0xbe2c('0x119')](db['Tag'],{'through':_0xbe2c('0x16f'),'as':_0xbe2c('0x170')});db[_0xbe2c('0x4c')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x171'),'through':_0xbe2c('0x172'),'foreignKey':'FaxInteractionId'});db[_0xbe2c('0x4e')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x104')});db[_0xbe2c('0x4e')][_0xbe2c('0x117')](db[_0xbe2c('0x4c')],{'as':_0xbe2c('0x173'),'foreignKey':_0xbe2c('0x16e')});db['FaxMessage']['belongsTo'](db[_0xbe2c('0x72')],{'onDelete':'cascade','as':_0xbe2c('0x151')});db[_0xbe2c('0x4e')]['belongsTo'](db[_0xbe2c('0xe2')],{'as':_0xbe2c('0xe2'),'foreignKey':_0xbe2c('0x174')});db[_0xbe2c('0x4e')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xbe2c('0x12c')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x30')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':'Teams'});db['FaxQueueReport']['belongsTo'](db['FaxAccount'],{});db[_0xbe2c('0x51')]['belongsTo'](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0x51')]['belongsTo'](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db['FaxQueueReport'][_0xbe2c('0x117')](db[_0xbe2c('0x4c')],{});db[_0xbe2c('0x51')][_0xbe2c('0x117')](db[_0xbe2c('0x4e')],{});db['FaxQueueReport'][_0xbe2c('0x117')](db['User'],{});db[_0xbe2c('0x51')][_0xbe2c('0x117')](db[_0xbe2c('0x12c')],{});db[_0xbe2c('0x53')][_0xbe2c('0x109')](db[_0xbe2c('0x16b')],{'as':_0xbe2c('0x159'),'foreignKey':_0xbe2c('0x175'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x53')]['hasMany'](db[_0xbe2c('0x7e')],{'as':_0xbe2c('0x15a'),'foreignKey':_0xbe2c('0x175')});db[_0xbe2c('0x53')][_0xbe2c('0x109')](db['SmsMessage'],{'as':_0xbe2c('0x14d'),'foreignKey':_0xbe2c('0x175')});db[_0xbe2c('0x53')][_0xbe2c('0x109')](db[_0xbe2c('0x56')],{'as':'Interactions'});db[_0xbe2c('0x53')][_0xbe2c('0x109')](db[_0xbe2c('0x55')],{'as':_0xbe2c('0x13e')});db[_0xbe2c('0x53')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0xbe2c('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbe2c('0x53')][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x137')});db[_0xbe2c('0x55')][_0xbe2c('0x117')](db['User'],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x55')]['belongsTo'](db[_0xbe2c('0x59')],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x55')]['belongsTo'](db[_0xbe2c('0x53')],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db[_0xbe2c('0x82')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x55')][_0xbe2c('0x117')](db[_0xbe2c('0x8a')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x169')});db[_0xbe2c('0x56')][_0xbe2c('0x109')](db[_0xbe2c('0x58')],{'as':_0xbe2c('0x14d'),'onDelete':_0xbe2c('0x106'),'foreignKey':'SmsInteractionId'});db[_0xbe2c('0x56')][_0xbe2c('0x117')](db[_0xbe2c('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x56')]['belongsTo'](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x162'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x56')][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'through':'sms_interaction_has_tags','as':_0xbe2c('0x164')});db[_0xbe2c('0x56')]['belongsToMany'](db[_0xbe2c('0x8a')],{'through':'sms_interaction_has_tags','as':_0xbe2c('0x170')});db['SmsInteraction'][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x171'),'through':_0xbe2c('0x124'),'foreignKey':_0xbe2c('0x176')});db[_0xbe2c('0x58')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x104')});db[_0xbe2c('0x58')][_0xbe2c('0x117')](db['CmContact'],{'onDelete':'cascade','as':_0xbe2c('0x151')});db['SmsMessage'][_0xbe2c('0x117')](db['SmsInteraction'],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x173'),'foreignKey':_0xbe2c('0x176')});db[_0xbe2c('0x58')][_0xbe2c('0x117')](db[_0xbe2c('0x53')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x175')});db['SmsQueue'][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x31'),'foreignKey':_0xbe2c('0x177')});db['SmsQueue'][_0xbe2c('0x119')](db[_0xbe2c('0xdd')],{'through':_0xbe2c('0x178'),'as':_0xbe2c('0x14b')});db[_0xbe2c('0x5a')][_0xbe2c('0x109')](db[_0xbe2c('0x16b')],{'as':_0xbe2c('0x159'),'foreignKey':_0xbe2c('0x179'),'onDelete':_0xbe2c('0x106')});db['OpenchannelAccount'][_0xbe2c('0x109')](db['CannedAnswer'],{'as':_0xbe2c('0x15a'),'foreignKey':_0xbe2c('0x179')});db[_0xbe2c('0x5a')]['hasMany'](db[_0xbe2c('0x5d')],{'as':_0xbe2c('0x15b'),'foreignKey':_0xbe2c('0x179')});db[_0xbe2c('0x5a')][_0xbe2c('0x109')](db[_0xbe2c('0x17a')],{'as':_0xbe2c('0x14d'),'foreignKey':_0xbe2c('0x179')});db[_0xbe2c('0x5a')][_0xbe2c('0x109')](db[_0xbe2c('0x17b')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0xbe2c('0x5a')]['belongsTo'](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0x5a')][_0xbe2c('0x117')](db[_0xbe2c('0x83')],{'as':_0xbe2c('0x149'),'foreignKey':_0xbe2c('0x15e')});db['OpenchannelAccount'][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x135')});db['OpenchannelApplication']['belongsTo'](db[_0xbe2c('0x104')],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x17b')]['belongsTo'](db[_0xbe2c('0x60')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x17c')});db[_0xbe2c('0x17b')][_0xbe2c('0x117')](db[_0xbe2c('0x5a')],{'onDelete':'restrict','foreignKey':_0xbe2c('0x179')});db['OpenchannelApplication'][_0xbe2c('0x117')](db[_0xbe2c('0x82')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x17b')]['belongsTo'](db[_0xbe2c('0x8a')],{'onDelete':_0xbe2c('0x156'),'foreignKey':'TagId'});db[_0xbe2c('0x5d')][_0xbe2c('0x109')](db[_0xbe2c('0x17a')],{'as':_0xbe2c('0x14d'),'onDelete':_0xbe2c('0x106'),'foreignKey':'OpenchannelInteractionId'});db[_0xbe2c('0x5d')][_0xbe2c('0x117')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xbe2c('0x179')});db[_0xbe2c('0x5d')]['belongsTo'](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x5d')]['belongsTo'](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x162'),'foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x5d')]['belongsToMany'](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x17d'),'as':_0xbe2c('0x164')});db[_0xbe2c('0x5d')][_0xbe2c('0x119')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xbe2c('0x5d')][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x171'),'through':_0xbe2c('0x125'),'foreignKey':_0xbe2c('0x17e')});db[_0xbe2c('0x17a')][_0xbe2c('0x117')](db['User'],{'onDelete':'cascade','as':_0xbe2c('0x104')});db[_0xbe2c('0x17a')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x151')});db[_0xbe2c('0x17a')][_0xbe2c('0x117')](db[_0xbe2c('0x5d')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x173'),'foreignKey':_0xbe2c('0x17e')});db[_0xbe2c('0x17a')][_0xbe2c('0x117')](db[_0xbe2c('0xe2')],{'as':_0xbe2c('0xe2'),'foreignKey':'AttachmentId'});db[_0xbe2c('0x17a')][_0xbe2c('0x117')](db[_0xbe2c('0x5a')],{'as':'Account','foreignKey':_0xbe2c('0x179')});db['OpenchannelQueue'][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x33'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0xbe2c('0xdd')],{'through':_0xbe2c('0x17f'),'as':_0xbe2c('0x14b')});db[_0xbe2c('0x61')][_0xbe2c('0x109')](db[_0xbe2c('0x16b')],{'as':_0xbe2c('0x159'),'foreignKey':_0xbe2c('0x167'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x61')][_0xbe2c('0x109')](db['CannedAnswer'],{'as':_0xbe2c('0x15a'),'foreignKey':_0xbe2c('0x167')});db[_0xbe2c('0x61')][_0xbe2c('0x109')](db[_0xbe2c('0x6e')],{'as':_0xbe2c('0x180')});db['ChatWebsite']['hasMany'](db[_0xbe2c('0x66')],{'as':'Interactions'});db[_0xbe2c('0x61')][_0xbe2c('0x109')](db[_0xbe2c('0x65')],{'as':_0xbe2c('0x13e')});db[_0xbe2c('0x61')][_0xbe2c('0x109')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':'List','foreignKey':_0xbe2c('0x15d')});db['ChatWebsite']['belongsTo'](db[_0xbe2c('0x82')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xbe2c('0x61')][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{'as':_0xbe2c('0x39'),'foreignKey':_0xbe2c('0x153')});db[_0xbe2c('0x61')][_0xbe2c('0x117')](db[_0xbe2c('0x83')],{'as':_0xbe2c('0x149'),'foreignKey':_0xbe2c('0x15e')});db['ChatWebsite'][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x131')});db['OpenchannelQueueReport']['belongsTo'](db[_0xbe2c('0x5a')],{});db[_0xbe2c('0x63')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':'List','foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0x63')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbe2c('0x63')][_0xbe2c('0x117')](db[_0xbe2c('0x5d')],{});db[_0xbe2c('0x63')][_0xbe2c('0x117')](db[_0xbe2c('0x17a')],{});db[_0xbe2c('0x63')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{});db[_0xbe2c('0x63')][_0xbe2c('0x117')](db[_0xbe2c('0x60')],{});db[_0xbe2c('0x65')]['belongsTo'](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x181'),'foreignKey':_0xbe2c('0x107'),'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x65')][_0xbe2c('0x117')](db[_0xbe2c('0x6b')],{'as':_0xbe2c('0x182'),'foreignKey':_0xbe2c('0x183'),'onDelete':_0xbe2c('0x156')});db['ChatApplication'][_0xbe2c('0x117')](db[_0xbe2c('0x61')],{'as':_0xbe2c('0x184'),'foreignKey':_0xbe2c('0x167'),'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x65')]['belongsTo'](db[_0xbe2c('0x8a')],{'onDelete':'restrict','foreignKey':'TagId'});db['ChatInteraction'][_0xbe2c('0x109')](db[_0xbe2c('0x185')],{'as':_0xbe2c('0x14d'),'onDelete':_0xbe2c('0x106'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xbe2c('0x117')](db[_0xbe2c('0x61')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x167')});db['ChatInteraction'][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x66')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x162'),'foreignKey':_0xbe2c('0x107')});db['ChatInteraction'][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x186'),'as':'Tags'});db[_0xbe2c('0x66')][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x186'),'as':_0xbe2c('0x170')});db[_0xbe2c('0x66')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x171'),'through':_0xbe2c('0x123'),'foreignKey':_0xbe2c('0x187')});db[_0xbe2c('0x185')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x104')});db[_0xbe2c('0x185')][_0xbe2c('0x117')](db['CmContact'],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x151'),'foreignKey':'ContactId'});db['ChatMessage'][_0xbe2c('0x117')](db[_0xbe2c('0x66')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x173'),'foreignKey':_0xbe2c('0x187')});db['ChatMessage']['belongsTo'](db[_0xbe2c('0xe2')],{'as':_0xbe2c('0xe2'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0xbe2c('0x117')](db[_0xbe2c('0x61')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x167')});db[_0xbe2c('0x69')][_0xbe2c('0x109')](db['Attachment'],{'as':_0xbe2c('0x165'),'foreignKey':_0xbe2c('0x168'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x69')]['belongsTo'](db[_0xbe2c('0x72')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x69')][_0xbe2c('0x117')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xbe2c('0x6b')][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x15f'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0xbe2c('0x188'),'as':_0xbe2c('0x14b')});db[_0xbe2c('0x6d')][_0xbe2c('0x109')](db[_0xbe2c('0x189')],{'as':_0xbe2c('0x14d'),'foreignKey':_0xbe2c('0x18a'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x6d')][_0xbe2c('0x119')](db['User'],{'as':_0xbe2c('0x140'),'through':_0xbe2c('0x11b')});db[_0xbe2c('0x6e')][_0xbe2c('0x117')](db[_0xbe2c('0x61')],{'as':'Website','foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xbe2c('0x109')](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x11c'),'foreignKey':'CompanyId'});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db[_0xbe2c('0x18b')],{'as':_0xbe2c('0x141'),'foreignKey':_0xbe2c('0x152')});db['CmContact'][_0xbe2c('0x109')](db[_0xbe2c('0x76')],{'as':'HopperFinals','foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db[_0xbe2c('0x110')],{'as':'HopperHistories','foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db[_0xbe2c('0x112')],{'as':_0xbe2c('0x112'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db[_0xbe2c('0xcc')],{'as':_0xbe2c('0x18c'),'foreignKey':_0xbe2c('0x152')});db['CmContact'][_0xbe2c('0x109')](db[_0xbe2c('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0xbe2c('0x152'),'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db['ChatInteraction'],{'as':_0xbe2c('0x122'),'foreignKey':'ContactId','onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db[_0xbe2c('0x56')],{'as':_0xbe2c('0x114'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db[_0xbe2c('0x4c')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xbe2c('0x72')][_0xbe2c('0x109')](db['MailInteraction'],{'as':_0xbe2c('0x116'),'foreignKey':_0xbe2c('0x152'),'onDelete':'restrict'});db[_0xbe2c('0x72')][_0xbe2c('0x117')](db['CmCompany'],{'as':_0xbe2c('0x18d'),'foreignKey':_0xbe2c('0x18e')});db[_0xbe2c('0x72')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x72')]['belongsToMany'](db['User'],{'as':_0xbe2c('0x171'),'through':_0xbe2c('0x11d')});db[_0xbe2c('0x72')][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'as':_0xbe2c('0x164'),'through':_0xbe2c('0x18f')});db[_0xbe2c('0x72')]['belongsToMany'](db['Tag'],{'through':_0xbe2c('0x18f'),'as':_0xbe2c('0x170')});db[_0xbe2c('0x18b')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':'Contact','foreignKey':_0xbe2c('0x152'),'onDelete':'cascade'});db[_0xbe2c('0x18b')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':'List','foreignKey':_0xbe2c('0x15d'),'onDelete':'cascade'});db[_0xbe2c('0x18b')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0xbe2c('0x107')});db[_0xbe2c('0x18b')][_0xbe2c('0x117')](db[_0xbe2c('0x1a')],{'as':_0xbe2c('0x182'),'foreignKey':_0xbe2c('0x142'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x18b')][_0xbe2c('0x117')](db['Campaign'],{'as':_0xbe2c('0x190'),'foreignKey':_0xbe2c('0x191'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x18b')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x162'),'foreignKey':_0xbe2c('0x192')});db['CmHopperBlack'][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':'ContactId','onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x75')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xbe2c('0x75')]['belongsTo'](db[_0xbe2c('0x1a')],{'as':_0xbe2c('0x182'),'foreignKey':_0xbe2c('0x142'),'onDelete':'cascade'});db['CmHopperBlack'][_0xbe2c('0x117')](db['Campaign'],{'as':_0xbe2c('0x190'),'foreignKey':_0xbe2c('0x191'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0xbe2c('0x193')],{'as':{'plural':_0xbe2c('0x194'),'singular':_0xbe2c('0x195')},'foreignKey':_0xbe2c('0x196'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x197')][_0xbe2c('0x109')](db['Condition'],{'as':{'plural':_0xbe2c('0x198'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0xbe2c('0x197')][_0xbe2c('0x109')](db[_0xbe2c('0x7b')],{'as':_0xbe2c('0x199'),'foreignKey':_0xbe2c('0x19a'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x16b')][_0xbe2c('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xbe2c('0x19b'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0x82')][_0xbe2c('0x109')](db[_0xbe2c('0x82')],{'as':_0xbe2c('0x19c'),'foreignKey':_0xbe2c('0x148'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xbe2c('0x82')][_0xbe2c('0x109')](db[_0xbe2c('0x17')],{'as':'Extensions','foreignKey':_0xbe2c('0x148'),'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x82')][_0xbe2c('0x109')](db[_0xbe2c('0x41')],{'as':_0xbe2c('0x19d'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x82')][_0xbe2c('0x109')](db[_0xbe2c('0x65')],{'as':'ChatApplications','foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x82')][_0xbe2c('0x109')](db[_0xbe2c('0x4b')],{'as':_0xbe2c('0x19e'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x82')]['hasMany'](db[_0xbe2c('0x55')],{'as':_0xbe2c('0x19f'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x86')][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{});db['Schedule'][_0xbe2c('0x117')](db[_0xbe2c('0x1a0')],{'foreignKey':_0xbe2c('0x1a1')});db[_0xbe2c('0x86')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0xbe2c('0x1a2')});db['Sound'][_0xbe2c('0x119')](db[_0xbe2c('0x19')],{'as':_0xbe2c('0x1a3'),'through':_0xbe2c('0x13f'),'onDelete':'restrict'});db[_0xbe2c('0x8a')][_0xbe2c('0x119')](db[_0xbe2c('0x72')],{'through':'cm_contact_has_tags'});db[_0xbe2c('0x8a')]['belongsToMany'](db[_0xbe2c('0x66')],{'through':_0xbe2c('0x186')});db['Tag'][_0xbe2c('0x119')](db[_0xbe2c('0x3e')],{'through':_0xbe2c('0x163')});db[_0xbe2c('0x8a')][_0xbe2c('0x119')](db[_0xbe2c('0x56')],{'through':_0xbe2c('0x1a4')});db['Tag'][_0xbe2c('0x119')](db[_0xbe2c('0x4c')],{'through':_0xbe2c('0x16f')});db[_0xbe2c('0x8a')][_0xbe2c('0x119')](db['OpenchannelInteraction'],{'through':_0xbe2c('0x17d')});db[_0xbe2c('0x8a')][_0xbe2c('0x119')](db['WhatsappInteraction'],{'through':_0xbe2c('0x1a5')});db[_0xbe2c('0x8e')]['hasMany'](db[_0xbe2c('0x193')],{'as':{'plural':_0xbe2c('0x1a6'),'singular':_0xbe2c('0x1a7')},'foreignKey':_0xbe2c('0x1a8'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x8e')][_0xbe2c('0x109')](db[_0xbe2c('0x193')],{'as':{'plural':_0xbe2c('0x1a9'),'singular':_0xbe2c('0x1aa')},'foreignKey':_0xbe2c('0x1ab'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x8e')]['hasMany'](db[_0xbe2c('0x7b')],{'as':'Actions','foreignKey':_0xbe2c('0x1ac'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db[_0xbe2c('0x1ad')][_0xbe2c('0x109')](db[_0xbe2c('0x9a')],{'as':_0xbe2c('0x1ae'),'onDelete':'cascade','foreignKey':_0xbe2c('0x1a2'),'hooks':!![]});db[_0xbe2c('0x1a0')][_0xbe2c('0x109')](db['AnalyticFieldReport'],{'as':_0xbe2c('0x1ae'),'onDelete':_0xbe2c('0x106'),'foreignKey':'DefaultReportId'});db[_0xbe2c('0x1af')][_0xbe2c('0x109')](db[_0xbe2c('0x9a')],{'as':_0xbe2c('0x1ae'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b0')});db[_0xbe2c('0x9a')][_0xbe2c('0x117')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xbe2c('0x109')](db[_0xbe2c('0x9d')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0x9d')][_0xbe2c('0x109')](db['SalesforceField'],{'as':_0xbe2c('0x1b3'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0x9d')][_0xbe2c('0x109')](db[_0xbe2c('0x9e')],{'as':_0xbe2c('0x1b5'),'onDelete':'cascade','foreignKey':_0xbe2c('0x1b6')});db['SalesforceConfiguration'][_0xbe2c('0x109')](db[_0xbe2c('0x9e')],{'as':_0xbe2c('0x1ae'),'onDelete':'cascade','foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xbe2c('0x117')](db[_0xbe2c('0x1b7')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x1b2')});db['SalesforceField'][_0xbe2c('0x109')](db[_0xbe2c('0x9e')],{'as':'Subject','foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0x9e')][_0xbe2c('0x109')](db[_0xbe2c('0x9e')],{'as':_0xbe2c('0x1b8'),'foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0x9e')][_0xbe2c('0x109')](db[_0xbe2c('0x9e')],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0x9e')][_0xbe2c('0x117')](db['Variable'],{'as':_0xbe2c('0x8f'),'foreignKey':'VariableId'});db[_0xbe2c('0x1bb')][_0xbe2c('0x109')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0x1bc')][_0xbe2c('0x109')](db['SugarcrmField'],{'as':_0xbe2c('0x1b3'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b4')});db['SugarcrmConfiguration'][_0xbe2c('0x109')](db[_0xbe2c('0xa2')],{'as':_0xbe2c('0x1b5'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0x1bc')]['hasMany'](db[_0xbe2c('0xa2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0x1bc')][_0xbe2c('0x117')](db[_0xbe2c('0x1bb')],{'as':_0xbe2c('0x161'),'foreignKey':'AccountId'});db[_0xbe2c('0xa2')]['hasMany'](db[_0xbe2c('0xa2')],{'as':_0xbe2c('0x1bd'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0xbe2c('0x109')](db[_0xbe2c('0xa2')],{'as':'Description','foreignKey':_0xbe2c('0x1b6')});db['SugarcrmField'][_0xbe2c('0x109')](db['SugarcrmField'],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xa2')][_0xbe2c('0x117')](db[_0xbe2c('0x8f')],{'as':'Variable','foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0xa3')][_0xbe2c('0x109')](db[_0xbe2c('0xa4')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':'AccountId'});db[_0xbe2c('0xa4')][_0xbe2c('0x109')](db[_0xbe2c('0x1bf')],{'as':_0xbe2c('0x1b3'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xa4')]['hasMany'](db[_0xbe2c('0x1bf')],{'as':'Descriptions','onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b6')});db['DeskConfiguration'][_0xbe2c('0x109')](db['DeskField'],{'as':_0xbe2c('0x1ae'),'onDelete':'cascade','foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xa4')][_0xbe2c('0x117')](db[_0xbe2c('0xa3')],{'as':'Account','foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0xa4')]['belongsToMany'](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x1c0')});db[_0xbe2c('0x1bf')]['hasMany'](db[_0xbe2c('0x1bf')],{'as':'Subject','foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0x1bf')]['hasMany'](db[_0xbe2c('0x1bf')],{'as':'Description','foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0x1bf')][_0xbe2c('0x109')](db[_0xbe2c('0x1bf')],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db['DeskField'][_0xbe2c('0x117')](db[_0xbe2c('0x8f')],{'as':_0xbe2c('0x8f'),'foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0xa7')][_0xbe2c('0x109')](db[_0xbe2c('0x1c1')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0x1c1')][_0xbe2c('0x109')](db[_0xbe2c('0xaa')],{'as':_0xbe2c('0x1b3'),'onDelete':_0xbe2c('0x106'),'foreignKey':'SubjectId'});db[_0xbe2c('0x1c1')][_0xbe2c('0x109')](db[_0xbe2c('0xaa')],{'as':_0xbe2c('0x1b5'),'onDelete':_0xbe2c('0x106'),'foreignKey':'DescriptionId'});db[_0xbe2c('0x1c1')][_0xbe2c('0x109')](db[_0xbe2c('0xaa')],{'as':_0xbe2c('0x1ae'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0x1c1')][_0xbe2c('0x117')](db[_0xbe2c('0xa7')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0xaa')][_0xbe2c('0x109')](db['ZohoField'],{'as':_0xbe2c('0x1bd'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xaa')][_0xbe2c('0x109')](db[_0xbe2c('0xaa')],{'as':_0xbe2c('0x1b8'),'foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0xaa')][_0xbe2c('0x109')](db['ZohoField'],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xaa')][_0xbe2c('0x117')](db[_0xbe2c('0x8f')],{'as':_0xbe2c('0x8f'),'foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0x1c2')][_0xbe2c('0x109')](db[_0xbe2c('0xad')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db[_0xbe2c('0x1c3')],{'as':_0xbe2c('0x1b3'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xad')]['hasMany'](db[_0xbe2c('0x1c3')],{'as':_0xbe2c('0x1b5'),'foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0xad')][_0xbe2c('0x109')](db['ZendeskField'],{'as':_0xbe2c('0x1ae'),'foreignKey':_0xbe2c('0x1ba')});db['ZendeskConfiguration'][_0xbe2c('0x117')](db['ZendeskAccount'],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0xad')][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x1c4')});db[_0xbe2c('0x1c3')][_0xbe2c('0x109')](db[_0xbe2c('0x1c3')],{'as':_0xbe2c('0x1bd'),'foreignKey':'SubjectId'});db[_0xbe2c('0x1c3')][_0xbe2c('0x109')](db['ZendeskField'],{'as':'Description','foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0x1c3')][_0xbe2c('0x109')](db[_0xbe2c('0x1c3')],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0x1c3')]['belongsTo'](db[_0xbe2c('0x8f')],{'as':_0xbe2c('0x8f'),'foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0xb0')][_0xbe2c('0x109')](db[_0xbe2c('0x1c5')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':'AccountId'});db[_0xbe2c('0x1c5')][_0xbe2c('0x109')](db[_0xbe2c('0xb3')],{'as':'Subjects','onDelete':_0xbe2c('0x106'),'foreignKey':'SubjectId'});db[_0xbe2c('0x1c5')][_0xbe2c('0x109')](db[_0xbe2c('0xb3')],{'as':_0xbe2c('0x1b5'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xbe2c('0x1c5')][_0xbe2c('0x109')](db[_0xbe2c('0xb3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0x1c5')][_0xbe2c('0x117')](db[_0xbe2c('0xb0')],{'as':'Account','foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0x1c5')][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x1c6')});db['FreshdeskField'][_0xbe2c('0x109')](db[_0xbe2c('0xb3')],{'as':_0xbe2c('0x1bd'),'foreignKey':_0xbe2c('0x1b4')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0xbe2c('0x1b8'),'foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0xb3')][_0xbe2c('0x109')](db[_0xbe2c('0xb3')],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xb3')][_0xbe2c('0x117')](db['Variable'],{'as':_0xbe2c('0x8f'),'foreignKey':_0xbe2c('0x1be')});db['VtigerAccount'][_0xbe2c('0x109')](db[_0xbe2c('0x1c7')],{'as':_0xbe2c('0x1b1'),'onDelete':'cascade','foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0x1c7')]['hasMany'](db[_0xbe2c('0xb5')],{'as':'Subjects','foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0x1c7')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xbe2c('0x1c7')][_0xbe2c('0x109')](db['VtigerField'],{'as':_0xbe2c('0x1ae'),'foreignKey':_0xbe2c('0x1ba')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0xbe2c('0x161'),'foreignKey':'AccountId'});db[_0xbe2c('0xb5')]['hasMany'](db['VtigerField'],{'as':_0xbe2c('0x1bd'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xb5')][_0xbe2c('0x109')](db[_0xbe2c('0xb5')],{'as':_0xbe2c('0x1b8'),'foreignKey':_0xbe2c('0x1b6')});db['VtigerField'][_0xbe2c('0x109')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0xbe2c('0xb5')][_0xbe2c('0x117')](db['Variable'],{'as':_0xbe2c('0x8f'),'foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0xb7')][_0xbe2c('0x109')](db[_0xbe2c('0xb9')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0xb9')]['hasMany'](db['ServicenowField'],{'as':_0xbe2c('0x1b3'),'foreignKey':_0xbe2c('0x1b4')});db['ServicenowConfiguration']['hasMany'](db[_0xbe2c('0xba')],{'as':'Descriptions','foreignKey':_0xbe2c('0x1b6')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Fields','foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xb9')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xbe2c('0x1b2')});db['ServicenowField'][_0xbe2c('0x109')](db[_0xbe2c('0xba')],{'as':_0xbe2c('0x1bd'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xba')][_0xbe2c('0x109')](db[_0xbe2c('0xba')],{'as':_0xbe2c('0x1b8'),'foreignKey':_0xbe2c('0x1b6')});db['ServicenowField'][_0xbe2c('0x109')](db[_0xbe2c('0xba')],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xba')][_0xbe2c('0x117')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xbe2c('0xbb')][_0xbe2c('0x109')](db[_0xbe2c('0xbd')],{'as':_0xbe2c('0x1b1'),'onDelete':_0xbe2c('0x106'),'foreignKey':'AccountId'});db[_0xbe2c('0xbb')][_0xbe2c('0x117')](db[_0xbe2c('0x154')],{'as':_0xbe2c('0x154'),'foreignKey':_0xbe2c('0x155')});db['Dynamics365Configuration']['hasMany'](db[_0xbe2c('0x1c8')],{'as':_0xbe2c('0x1b3'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xbd')][_0xbe2c('0x109')](db[_0xbe2c('0x1c8')],{'as':_0xbe2c('0x1b5'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0xbd')][_0xbe2c('0x109')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xbd')]['belongsTo'](db[_0xbe2c('0xbb')],{'as':'Account','foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0x1c8')][_0xbe2c('0x109')](db[_0xbe2c('0x1c8')],{'as':_0xbe2c('0x1bd'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0x1c8')][_0xbe2c('0x109')](db[_0xbe2c('0x1c8')],{'as':_0xbe2c('0x1b8'),'foreignKey':'DescriptionId'});db[_0xbe2c('0x1c8')][_0xbe2c('0x109')](db[_0xbe2c('0x1c8')],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0x1c8')]['belongsTo'](db['Variable'],{'as':_0xbe2c('0x8f'),'foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0xc0')][_0xbe2c('0x109')](db[_0xbe2c('0xc1')],{'as':'Configurations','onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0xc1')]['hasMany'](db[_0xbe2c('0xc3')],{'as':_0xbe2c('0x1b3'),'foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xc1')]['hasMany'](db['FreshsalesField'],{'as':_0xbe2c('0x1b5'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Fields','foreignKey':_0xbe2c('0x1ba')});db['FreshsalesConfiguration'][_0xbe2c('0x117')](db['FreshsalesAccount'],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x1b2')});db[_0xbe2c('0xc3')][_0xbe2c('0x109')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xbe2c('0x1b4')});db[_0xbe2c('0xc3')][_0xbe2c('0x109')](db['FreshsalesField'],{'as':'Description','foreignKey':_0xbe2c('0x1b6')});db[_0xbe2c('0xc3')][_0xbe2c('0x109')](db['FreshsalesField'],{'as':_0xbe2c('0x1b9'),'foreignKey':_0xbe2c('0x1ba')});db[_0xbe2c('0xc3')][_0xbe2c('0x117')](db[_0xbe2c('0x8f')],{'as':'Variable','foreignKey':_0xbe2c('0x1be')});db[_0xbe2c('0xc6')][_0xbe2c('0x117')](db['ChatWebsite'],{});db[_0xbe2c('0xc6')][_0xbe2c('0x117')](db['CmList'],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0xc6')]['belongsTo'](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0xc6')][_0xbe2c('0x117')](db[_0xbe2c('0x66')],{});db[_0xbe2c('0xc6')][_0xbe2c('0x117')](db[_0xbe2c('0x185')],{});db[_0xbe2c('0xc6')]['belongsTo'](db[_0xbe2c('0x104')],{});db[_0xbe2c('0xc6')][_0xbe2c('0x117')](db['ChatQueue'],{});db['ChatInternalMessage'][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xbe2c('0x189')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1c9')});db[_0xbe2c('0xcc')][_0xbe2c('0x109')](db[_0xbe2c('0xcb')],{'foreignKey':'SessionId','onDelete':_0xbe2c('0x106')});db[_0xbe2c('0xcc')][_0xbe2c('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0xbe2c('0x1ca'),'onDelete':'cascade'});db[_0xbe2c('0xce')][_0xbe2c('0x117')](db['SmsAccount'],{});db[_0xbe2c('0xce')][_0xbe2c('0x117')](db['CmList'],{'as':_0xbe2c('0x15c'),'foreignKey':'ListId'});db['SmsQueueReport'][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbe2c('0xce')]['belongsTo'](db[_0xbe2c('0x56')],{});db[_0xbe2c('0xce')]['belongsTo'](db[_0xbe2c('0x58')],{});db[_0xbe2c('0xce')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{});db[_0xbe2c('0xce')][_0xbe2c('0x117')](db[_0xbe2c('0x59')],{});db['JscriptyProject']['hasMany'](db[_0xbe2c('0xcc')],{'foreignKey':_0xbe2c('0x1cb')});db[_0xbe2c('0xd2')]['hasMany'](db[_0xbe2c('0xcb')],{'foreignKey':_0xbe2c('0x1cb')});db[_0xbe2c('0xd2')][_0xbe2c('0x109')](db[_0xbe2c('0xc9')],{'foreignKey':_0xbe2c('0x1cb')});db['SquareProject'][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':'Users','through':_0xbe2c('0x13b')});db[_0xbe2c('0xdd')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x120')});db['Team'][_0xbe2c('0x119')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xbe2c('0x127')});db[_0xbe2c('0xdd')][_0xbe2c('0x119')](db[_0xbe2c('0x3b')],{'through':_0xbe2c('0x160'),'as':_0xbe2c('0x12a')});db[_0xbe2c('0xdd')][_0xbe2c('0x119')](db[_0xbe2c('0x6b')],{'through':_0xbe2c('0x188'),'as':_0xbe2c('0x12b')});db[_0xbe2c('0xdd')]['belongsToMany'](db[_0xbe2c('0x12c')],{'through':_0xbe2c('0x1cc'),'as':_0xbe2c('0x12d')});db[_0xbe2c('0xdd')][_0xbe2c('0x119')](db[_0xbe2c('0x59')],{'through':_0xbe2c('0x178'),'as':'SmsQueues'});db[_0xbe2c('0xdd')][_0xbe2c('0x119')](db[_0xbe2c('0x60')],{'through':'team_has_openchannel_queues','as':_0xbe2c('0x12e')});db['Team'][_0xbe2c('0x119')](db[_0xbe2c('0xfb')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xbe2c('0xdd')][_0xbe2c('0x119')](db[_0xbe2c('0xee')],{'through':_0xbe2c('0x1cd'),'as':_0xbe2c('0x128')});db[_0xbe2c('0x190')][_0xbe2c('0x109')](db[_0xbe2c('0x18b')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xbe2c('0x190')][_0xbe2c('0x109')](db[_0xbe2c('0x76')],{'as':'HopperFinals','foreignKey':_0xbe2c('0x191')});db[_0xbe2c('0x190')][_0xbe2c('0x109')](db[_0xbe2c('0x110')],{'as':_0xbe2c('0x143'),'foreignKey':_0xbe2c('0x191')});db['Campaign'][_0xbe2c('0x109')](db[_0xbe2c('0x75')],{'as':'HopperBlacks','foreignKey':_0xbe2c('0x191')});db[_0xbe2c('0x190')][_0xbe2c('0x117')](db[_0xbe2c('0x27')],{'as':'Trunk','foreignKey':_0xbe2c('0x145')});db['Campaign'][_0xbe2c('0x117')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xbe2c('0x147')});db[_0xbe2c('0x190')][_0xbe2c('0x117')](db[_0xbe2c('0x82')],{'as':_0xbe2c('0x82'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0x190')][_0xbe2c('0x117')](db[_0xbe2c('0xd8')],{'as':_0xbe2c('0xd8'),'foreignKey':_0xbe2c('0x1ce')});db[_0xbe2c('0x190')][_0xbe2c('0x119')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x11e'),'through':_0xbe2c('0x1cf')});db[_0xbe2c('0x190')][_0xbe2c('0x119')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x14c'),'through':_0xbe2c('0x1d0')});db[_0xbe2c('0xe2')][_0xbe2c('0x117')](db[_0xbe2c('0x69')],{'as':_0xbe2c('0x69'),'foreignKey':'ChatOfflineMessageId'});db[_0xbe2c('0xe6')][_0xbe2c('0x117')](db['MailMessage'],{});db['MailTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x3e')],{});db[_0xbe2c('0xe6')][_0xbe2c('0x117')](db[_0xbe2c('0x39')],{'foreignKey':_0xbe2c('0x1d1'),'as':'FromAccount'});db[_0xbe2c('0xe6')]['belongsTo'](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1d2'),'as':_0xbe2c('0x1d3')});db[_0xbe2c('0xe6')]['belongsTo'](db[_0xbe2c('0x104')],{'foreignKey':'ToUserId','as':_0xbe2c('0x1d4')});db[_0xbe2c('0xe6')][_0xbe2c('0x117')](db[_0xbe2c('0x3b')],{'foreignKey':'ToMailQueueId','as':_0xbe2c('0x1d5')});db[_0xbe2c('0xe6')][_0xbe2c('0x117')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0xbe2c('0x1d6')});db[_0xbe2c('0x1d7')][_0xbe2c('0x117')](db[_0xbe2c('0x185')],{});db['ChatTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x66')],{});db[_0xbe2c('0x1d7')]['belongsTo'](db[_0xbe2c('0x61')],{'foreignKey':'FromChatWebsiteId','as':_0xbe2c('0x1d8')});db[_0xbe2c('0x1d7')][_0xbe2c('0x117')](db['User'],{'foreignKey':_0xbe2c('0x1d2'),'as':_0xbe2c('0x1d3')});db['ChatTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'foreignKey':'ToUserId','as':_0xbe2c('0x1d4')});db['ChatTransferReport']['belongsTo'](db[_0xbe2c('0x6b')],{'foreignKey':_0xbe2c('0x1d9'),'as':_0xbe2c('0x1d5')});db[_0xbe2c('0x1d7')]['belongsTo'](db[_0xbe2c('0x61')],{'foreignKey':'ToChatWebsiteId','as':_0xbe2c('0x1d6')});db['FaxTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x4e')],{});db[_0xbe2c('0x1da')][_0xbe2c('0x117')](db[_0xbe2c('0x4c')],{});db['FaxTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x49')],{'foreignKey':_0xbe2c('0x1db'),'as':'FromAccount'});db[_0xbe2c('0x1da')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1d2'),'as':_0xbe2c('0x1d3')});db[_0xbe2c('0x1da')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'foreignKey':'ToUserId','as':_0xbe2c('0x1d4')});db['FaxTransferReport']['belongsTo'](db[_0xbe2c('0x12c')],{'foreignKey':_0xbe2c('0x1dc'),'as':_0xbe2c('0x1d5')});db['FaxTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x49')],{'foreignKey':'ToFaxAccountId','as':_0xbe2c('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0xbe2c('0x17a')],{});db[_0xbe2c('0xe9')][_0xbe2c('0x117')](db[_0xbe2c('0x5d')],{});db['OpenchannelTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x5a')],{'foreignKey':_0xbe2c('0x1dd'),'as':_0xbe2c('0x1d8')});db[_0xbe2c('0xe9')]['belongsTo'](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1d2'),'as':'FromAgent'});db[_0xbe2c('0xe9')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'foreignKey':'ToUserId','as':_0xbe2c('0x1d4')});db[_0xbe2c('0xe9')][_0xbe2c('0x117')](db[_0xbe2c('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0xbe2c('0xe9')][_0xbe2c('0x117')](db[_0xbe2c('0x5a')],{'foreignKey':_0xbe2c('0x1de'),'as':_0xbe2c('0x1d6')});db['SmsTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x58')],{});db[_0xbe2c('0xeb')][_0xbe2c('0x117')](db[_0xbe2c('0x56')],{});db['SmsTransferReport'][_0xbe2c('0x117')](db['SmsAccount'],{'foreignKey':_0xbe2c('0x1df'),'as':_0xbe2c('0x1d8')});db['SmsTransferReport']['belongsTo'](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1d2'),'as':_0xbe2c('0x1d3')});db[_0xbe2c('0xeb')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1e0'),'as':'ToAgent'});db['SmsTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0x59')],{'foreignKey':_0xbe2c('0x1e1'),'as':_0xbe2c('0x1d5')});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0xbe2c('0x1e2'),'as':_0xbe2c('0x1d6')});db[_0xbe2c('0xed')]['hasMany'](db[_0xbe2c('0x16b')],{'as':_0xbe2c('0x159'),'foreignKey':_0xbe2c('0x15d'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0xed')][_0xbe2c('0x109')](db[_0xbe2c('0x79')],{'as':'CustomFields','foreignKey':'ListId'});db[_0xbe2c('0xed')][_0xbe2c('0x109')](db['CmContact'],{'as':_0xbe2c('0x11c'),'onDelete':'cascade','foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0xed')][_0xbe2c('0x109')](db[_0xbe2c('0x76')],{'as':_0xbe2c('0x10f'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0xed')][_0xbe2c('0x109')](db[_0xbe2c('0x110')],{'as':_0xbe2c('0x111'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0xed')][_0xbe2c('0x109')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0xed')][_0xbe2c('0x119')](db[_0xbe2c('0x1a')],{'as':_0xbe2c('0x1e3'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x11f')});db[_0xbe2c('0xee')]['hasMany'](db[_0xbe2c('0x17')],{'as':_0xbe2c('0x10e'),'onDelete':_0xbe2c('0x106')});db[_0xbe2c('0xee')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':_0xbe2c('0x129')});db[_0xbe2c('0xee')][_0xbe2c('0x119')](db[_0xbe2c('0xdd')],{'through':_0xbe2c('0x1cd'),'as':_0xbe2c('0x14b')});db[_0xbe2c('0xef')]['hasMany'](db['User'],{'as':_0xbe2c('0x171'),'foreignKey':_0xbe2c('0x118')});db[_0xbe2c('0xef')]['hasMany'](db[_0xbe2c('0xf1')],{'as':_0xbe2c('0x1e4'),'foreignKey':_0xbe2c('0x118'),'onDelete':_0xbe2c('0x106')});db['UserProfileSection'][_0xbe2c('0x109')](db[_0xbe2c('0xf3')],{'as':_0xbe2c('0x1e5'),'foreignKey':_0xbe2c('0x1e6'),'onDelete':'cascade'});db[_0xbe2c('0xf5')][_0xbe2c('0x109')](db[_0xbe2c('0x16b')],{'as':_0xbe2c('0x159'),'foreignKey':_0xbe2c('0x1e7'),'onDelete':_0xbe2c('0x106')});db['WhatsappAccount'][_0xbe2c('0x109')](db['CannedAnswer'],{'as':_0xbe2c('0x15a'),'foreignKey':_0xbe2c('0x1e7')});db[_0xbe2c('0xf5')][_0xbe2c('0x109')](db[_0xbe2c('0x1e8')],{'as':_0xbe2c('0x14d'),'foreignKey':_0xbe2c('0x1e7')});db[_0xbe2c('0xf5')][_0xbe2c('0x109')](db[_0xbe2c('0xf7')],{'as':'Interactions'});db['WhatsappAccount'][_0xbe2c('0x109')](db['WhatsappApplication'],{'as':_0xbe2c('0x13e')});db[_0xbe2c('0xf5')][_0xbe2c('0x117')](db['CmList'],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db[_0xbe2c('0xf5')][_0xbe2c('0x117')](db[_0xbe2c('0x83')],{'as':_0xbe2c('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xbe2c('0xf5')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x15f'),'through':'user_has_whatsapp_accounts'});db[_0xbe2c('0xf6')]['belongsTo'](db['User'],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0xf6')][_0xbe2c('0x117')](db['WhatsappQueue'],{'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0xf6')][_0xbe2c('0x117')](db[_0xbe2c('0xf5')],{'onDelete':'restrict'});db[_0xbe2c('0xf6')]['belongsTo'](db['Interval'],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x148')});db[_0xbe2c('0xf6')][_0xbe2c('0x117')](db[_0xbe2c('0x8a')],{'onDelete':_0xbe2c('0x156'),'foreignKey':_0xbe2c('0x169')});db[_0xbe2c('0xf7')][_0xbe2c('0x109')](db[_0xbe2c('0x1e8')],{'as':_0xbe2c('0x14d'),'onDelete':_0xbe2c('0x106'),'foreignKey':_0xbe2c('0x1e9')});db['WhatsappInteraction'][_0xbe2c('0x117')](db[_0xbe2c('0xf5')],{'as':_0xbe2c('0x161'),'foreignKey':_0xbe2c('0x1e7')});db[_0xbe2c('0xf7')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':_0xbe2c('0x151'),'foreignKey':_0xbe2c('0x152')});db[_0xbe2c('0xf7')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':'Owner','foreignKey':'UserId'});db[_0xbe2c('0xf7')][_0xbe2c('0x119')](db[_0xbe2c('0x8a')],{'through':_0xbe2c('0x1a5'),'as':_0xbe2c('0x164')});db[_0xbe2c('0xf7')][_0xbe2c('0x119')](db['Tag'],{'through':_0xbe2c('0x1a5'),'as':_0xbe2c('0x170')});db[_0xbe2c('0xf7')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x171'),'through':_0xbe2c('0x1ea'),'foreignKey':_0xbe2c('0x1e9')});db[_0xbe2c('0x1e8')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':_0xbe2c('0x104')});db[_0xbe2c('0x1e8')][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x151')});db[_0xbe2c('0x1e8')]['belongsTo'](db[_0xbe2c('0xf7')],{'onDelete':_0xbe2c('0x106'),'as':_0xbe2c('0x173'),'foreignKey':_0xbe2c('0x1e9')});db['WhatsappMessage'][_0xbe2c('0x117')](db[_0xbe2c('0xf5')],{'as':_0xbe2c('0x161'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xbe2c('0x117')](db[_0xbe2c('0xf5')],{});db[_0xbe2c('0x1eb')][_0xbe2c('0x117')](db[_0xbe2c('0xed')],{'as':_0xbe2c('0x15c'),'foreignKey':_0xbe2c('0x15d')});db['WhatsappQueueReport'][_0xbe2c('0x117')](db[_0xbe2c('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappQueueReport'][_0xbe2c('0x117')](db['WhatsappInteraction'],{});db[_0xbe2c('0x1eb')]['belongsTo'](db[_0xbe2c('0xfb')],{});db[_0xbe2c('0x1eb')][_0xbe2c('0x117')](db[_0xbe2c('0x1e8')],{});db[_0xbe2c('0x1eb')]['belongsTo'](db[_0xbe2c('0x104')],{});db[_0xbe2c('0xf9')][_0xbe2c('0x117')](db[_0xbe2c('0x1e8')],{});db[_0xbe2c('0xf9')][_0xbe2c('0x117')](db[_0xbe2c('0xf7')],{});db[_0xbe2c('0xf9')][_0xbe2c('0x117')](db[_0xbe2c('0xf5')],{'foreignKey':_0xbe2c('0x1ec'),'as':'FromAccount'});db[_0xbe2c('0xf9')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xbe2c('0x1ed'),'as':'ToAccount'});db['WhatsappTransferReport'][_0xbe2c('0x117')](db[_0xbe2c('0xfb')],{'foreignKey':_0xbe2c('0x1ee'),'as':'ToQueue'});db[_0xbe2c('0xf9')]['belongsTo'](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1d2'),'as':'FromAgent'});db[_0xbe2c('0xf9')]['belongsTo'](db[_0xbe2c('0x104')],{'foreignKey':_0xbe2c('0x1e0'),'as':_0xbe2c('0x1d4')});db[_0xbe2c('0xfb')][_0xbe2c('0x119')](db[_0xbe2c('0x104')],{'as':'Agents','through':_0xbe2c('0x35'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xbe2c('0x119')](db[_0xbe2c('0xdd')],{'through':_0xbe2c('0x1ef'),'as':_0xbe2c('0x14b')});db[_0xbe2c('0x102')][_0xbe2c('0x117')](db[_0xbe2c('0x104')],{'as':'user','foreignKey':_0xbe2c('0x107'),'onDelete':_0xbe2c('0x106'),'hooks':!![]});db['CloudProvider'][_0xbe2c('0x105')](db['Dynamics365Account'],{'as':_0xbe2c('0xbb'),'onDelete':_0xbe2c('0x156')});db['CloudProvider']['hasOne'](db[_0xbe2c('0x36')],{'as':_0xbe2c('0x157'),'onDelete':_0xbe2c('0x156')});db[_0xbe2c('0x154')]['hasOne'](db[_0xbe2c('0x37')],{'as':_0xbe2c('0x158'),'onDelete':_0xbe2c('0x156')});module[_0xbe2c('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 134ed1e..8115210 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1f=['./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceQueue','/api/screen/recordings','/api/voice/mails/messages','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/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/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/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/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts'];(function(_0x4c1176,_0xf999e9){var _0x2aca97=function(_0xb3cb82){while(--_0xb3cb82){_0x4c1176['push'](_0x4c1176['shift']());}};_0x2aca97(++_0xf999e9);}(_0xed1f,0x6a));var _0xfed1=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xed1f[_0x25e7cb];return _0x375d92;};'use strict';var path=require(_0xfed1('0x0'));var express=require(_0xfed1('0x1'));var errors=require(_0xfed1('0x2'));var config=require(_0xfed1('0x3'));var setupLoggers=require(_0xfed1('0x4'))[_0xfed1('0x5')];var clientSideLogs=require(_0xfed1('0x6'));exports[_0xfed1('0x7')]=function(_0x2209b3){return setupLoggers(_0x2209b3)[_0xfed1('0x8')](function(){_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa'),require(_0xfed1('0xb')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc'),require(_0xfed1('0xd')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe'),require('./api/voiceContext'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xf'),require('./api/voiceExtension'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x10'),require('./api/voiceMusicOnHold'));_0x2209b3[_0xfed1('0x9')]('/api/voice/queues',require(_0xfed1('0x11')));_0x2209b3[_0xfed1('0x9')]('/api/voice/recordings',require('./api/voiceRecording'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x12'),require('./api/screenRecording'));_0x2209b3[_0xfed1('0x9')]('/api/voice/mails',require('./api/voiceMail'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x13'),require('./api/voiceMailMessage'));_0x2209b3[_0xfed1('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x14'),require(_0xfed1('0x15')));_0x2209b3[_0xfed1('0x9')]('/api/voice/agents/reports',require(_0xfed1('0x16')));_0x2209b3['use'](_0xfed1('0x17'),require(_0xfed1('0x18')));_0x2209b3['use'](_0xfed1('0x19'),require(_0xfed1('0x1a')));_0x2209b3['use']('/api/trunks',require('./api/trunk'));_0x2209b3[_0xfed1('0x9')]('/api/voice/transfers/reports',require(_0xfed1('0x1b')));_0x2209b3[_0xfed1('0x9')]('/api/mail/out_servers',require(_0xfed1('0x1c')));_0x2209b3[_0xfed1('0x9')]('/api/mail/accounts',require(_0xfed1('0x1d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x1e'),require(_0xfed1('0x1f')));_0x2209b3['use'](_0xfed1('0x20'),require('./api/mailSubstatus'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x21'),require(_0xfed1('0x22')));_0x2209b3['use'](_0xfed1('0x23'),require('./api/mailMessage'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x24'),require(_0xfed1('0x25')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x26'),require(_0xfed1('0x27')));_0x2209b3['use'](_0xfed1('0x28'),require(_0xfed1('0x29')));_0x2209b3['use'](_0xfed1('0x2a'),require(_0xfed1('0x2b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x2c'),require(_0xfed1('0x2d')));_0x2209b3[_0xfed1('0x9')]('/api/fax/applications',require(_0xfed1('0x2e')));_0x2209b3['use'](_0xfed1('0x2f'),require('./api/faxInteraction'));_0x2209b3['use'](_0xfed1('0x30'),require(_0xfed1('0x31')));_0x2209b3[_0xfed1('0x9')]('/api/fax/queues',require(_0xfed1('0x32')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x33'),require(_0xfed1('0x34')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x35'),require('./api/smsAccount'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x36'),require('./api/smsApplication'));_0x2209b3['use'](_0xfed1('0x37'),require(_0xfed1('0x38')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x39'),require(_0xfed1('0x3a')));_0x2209b3['use'](_0xfed1('0x3b'),require(_0xfed1('0x3c')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x3d'),require(_0xfed1('0x3e')));_0x2209b3['use'](_0xfed1('0x3f'),require('./api/openchannelApplication'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x40'),require(_0xfed1('0x41')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x42'),require(_0xfed1('0x43')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x44'),require('./api/openchannelQueue'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x45'),require(_0xfed1('0x46')));_0x2209b3[_0xfed1('0x9')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x47'),require(_0xfed1('0x48')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x49'),require(_0xfed1('0x4a')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x4b'),require('./api/chatMessage'));_0x2209b3['use'](_0xfed1('0x4c'),require(_0xfed1('0x4d')));_0x2209b3['use'](_0xfed1('0x4e'),require(_0xfed1('0x4f')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x50'),require(_0xfed1('0x51')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x52'),require(_0xfed1('0x53')));_0x2209b3[_0xfed1('0x9')]('/api/cm/companies',require('./api/cmCompany'));_0x2209b3['use'](_0xfed1('0x54'),require(_0xfed1('0x55')));_0x2209b3[_0xfed1('0x9')]('/api/cm/hopper',require(_0xfed1('0x56')));_0x2209b3['use'](_0xfed1('0x57'),require(_0xfed1('0x58')));_0x2209b3[_0xfed1('0x9')]('/api/cm/hopper_final',require(_0xfed1('0x59')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x5a'),require('./api/cmHopperHistory'));_0x2209b3[_0xfed1('0x9')]('/api/cm/custom_fields',require(_0xfed1('0x5b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x5c'),require(_0xfed1('0x5d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x5e'),require(_0xfed1('0x5f')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x60'),require('./api/cannedAnswer'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x61'),require(_0xfed1('0x62')));_0x2209b3['use']('/api/conditions',require(_0xfed1('0x63')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x64'),require(_0xfed1('0x65')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x66'),require(_0xfed1('0x67')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x68'),require(_0xfed1('0x69')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x6a'),require('./api/voiceQueuesLog'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x6b'),require(_0xfed1('0x6c')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x6d'),require(_0xfed1('0x6e')));_0x2209b3['use'](_0xfed1('0x6f'),require(_0xfed1('0x70')));_0x2209b3[_0xfed1('0x9')]('/api/templates',require(_0xfed1('0x71')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x72'),require(_0xfed1('0x73')));_0x2209b3['use'](_0xfed1('0x74'),require(_0xfed1('0x75')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x76'),require(_0xfed1('0x77')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x78'),require(_0xfed1('0x79')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x7a'),require(_0xfed1('0x7b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x7c'),require(_0xfed1('0x7d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x7e'),require(_0xfed1('0x7f')));_0x2209b3[_0xfed1('0x9')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x80'),require(_0xfed1('0x81')));_0x2209b3[_0xfed1('0x9')]('/api/analytics/tree_reports',require(_0xfed1('0x82')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x2209b3['use'](_0xfed1('0x83'),require(_0xfed1('0x84')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x85'),require(_0xfed1('0x86')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x87'),require(_0xfed1('0x88')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x89'),require('./api/intSugarcrmConfiguration'));_0x2209b3['use'](_0xfed1('0x8a'),require(_0xfed1('0x8b')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x8c'),require(_0xfed1('0x8d')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x8e'),require(_0xfed1('0x8f')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x90'),require(_0xfed1('0x91')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x92'),require(_0xfed1('0x93')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x94'),require(_0xfed1('0x95')));_0x2209b3['use']('/api/integrations/zoho/fields',require(_0xfed1('0x96')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x97'),require(_0xfed1('0x98')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x99'),require(_0xfed1('0x9a')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x9b'),require(_0xfed1('0x9c')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x9d'),require(_0xfed1('0x9e')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/freshdesk/configurations',require(_0xfed1('0x9f')));_0x2209b3['use']('/api/integrations/freshdesk/fields',require(_0xfed1('0xa0')));_0x2209b3['use'](_0xfed1('0xa1'),require('./api/intVtigerAccount'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa2'),require('./api/intVtigerConfiguration'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa3'),require('./api/intVtigerField'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa4'),require(_0xfed1('0xa5')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/servicenow/configurations',require(_0xfed1('0xa6')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa7'),require(_0xfed1('0xa8')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xa9'),require(_0xfed1('0xaa')));_0x2209b3[_0xfed1('0x9')]('/api/integrations/dynamics365/configurations',require(_0xfed1('0xab')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xac'),require(_0xfed1('0xad')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xae'),require('./api/intFreshsalesAccount'));_0x2209b3['use']('/api/integrations/freshsales/configurations',require(_0xfed1('0xaf')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb0'),require(_0xfed1('0xb1')));_0x2209b3['use'](_0xfed1('0xb2'),require('./api/network'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb3'),require(_0xfed1('0xb4')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb5'),require('./api/chatInternalMessage'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xb6'),require(_0xfed1('0xb7')));_0x2209b3['use'](_0xfed1('0xb8'),require(_0xfed1('0xb9')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xba'),require('./api/jscriptySessionReport'));_0x2209b3[_0xfed1('0x9')]('/api/sms/reports/queue',require(_0xfed1('0xbb')));_0x2209b3[_0xfed1('0x9')]('/api/square/reports',require('./api/squareReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xbc'),require(_0xfed1('0xbd')));_0x2209b3[_0xfed1('0x9')]('/api/jscripty/projects',require(_0xfed1('0xbe')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xbf'),require(_0xfed1('0xc0')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc1'),require('./api/squareOdbc'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc2'),require('./api/squareProject'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc3'),require(_0xfed1('0xc4')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xc5'),require(_0xfed1('0xc6')));_0x2209b3['use']('/api/teams',require(_0xfed1('0xc7')));_0x2209b3['use'](_0xfed1('0xc8'),require(_0xfed1('0xc9')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xca'),require(_0xfed1('0xcb')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xcc'),require(_0xfed1('0xcd')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xce'),require('./api/attachment'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xcf'),require('./api/plugin'));_0x2209b3['use'](_0xfed1('0xd0'),require('./api/mailTransferReport'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xd1'),require(_0xfed1('0xd2')));_0x2209b3['use'](_0xfed1('0xd3'),require(_0xfed1('0xd4')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xd5'),require(_0xfed1('0xd6')));_0x2209b3['use'](_0xfed1('0xd7'),require(_0xfed1('0xd8')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xd9'),require(_0xfed1('0xda')));_0x2209b3['use'](_0xfed1('0xdb'),require(_0xfed1('0xdc')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xdd'),require(_0xfed1('0xde')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xdf'),require(_0xfed1('0xe0')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe1'),require('./api/userProfileResource'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe2'),require(_0xfed1('0xe3')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe4'),require('./api/whatsappAccount'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe5'),require(_0xfed1('0xe6')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe7'),require(_0xfed1('0xe8')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xe9'),require(_0xfed1('0xea')));_0x2209b3['use']('/api/whatsapp/reports/queue',require(_0xfed1('0xeb')));_0x2209b3['use'](_0xfed1('0xec'),require(_0xfed1('0xed')));_0x2209b3[_0xfed1('0x9')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x2209b3[_0xfed1('0x9')]('/api/cloudProviders',require(_0xfed1('0xee')));_0x2209b3['use'](_0xfed1('0xef'),require(_0xfed1('0xf0')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xf1'),require(_0xfed1('0xf2')));_0x2209b3['use'](_0xfed1('0xf3'),require(_0xfed1('0xf4')));_0x2209b3['use'](_0xfed1('0xf5'),require(_0xfed1('0xf6')));_0x2209b3['use'](_0xfed1('0xf7'),require(_0xfed1('0xf8')));_0x2209b3[_0xfed1('0x9')]('/api/jira',require(_0xfed1('0xf9')));_0x2209b3[_0xfed1('0x9')]('/api/rpc',require(_0xfed1('0xfa')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xfb'),require('./api/version'));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xfc'),require('./api/system'));_0x2209b3['use'](_0xfed1('0xfd'),require(_0xfed1('0xfe')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0xff'),require(_0xfed1('0x100')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x101'),clientSideLogs);_0x2209b3[_0xfed1('0x9')](_0xfed1('0x102'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config[_0xfed1('0x105')],'/apidoc')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x106'),express['static'](path[_0xfed1('0x104')](config[_0xfed1('0x105')],'/www')));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x107'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config['root'],_0xfed1('0x107'))));_0x2209b3[_0xfed1('0x9')](_0xfed1('0x108'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config[_0xfed1('0x105')],_0xfed1('0x109'),_0xfed1('0x10a'))));_0x2209b3['use'](_0xfed1('0x10b'),express[_0xfed1('0x103')](path[_0xfed1('0x104')](config['root'],_0xfed1('0x10c'))));_0x2209b3[_0xfed1('0x10d')](_0xfed1('0x10e'))['get'](errors[0x194]);_0x2209b3['route']('/*')[_0xfed1('0x10f')](function(_0x45a0fc,_0x37723b){_0x37723b[_0xfed1('0x110')](path[_0xfed1('0x111')](_0x2209b3[_0xfed1('0x10f')](_0xfed1('0x112'))+_0xfed1('0x113')));});return _0x2209b3;});}; \ No newline at end of file +var _0x2eb2=['/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/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/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/snippet','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/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/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/tag','/api/templates','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x2eb2[_0x550d12];return _0x12103d;};'use strict';var path=require('path');var express=require(_0x22eb('0x0'));var errors=require(_0x22eb('0x1'));var config=require(_0x22eb('0x2'));var setupLoggers=require(_0x22eb('0x3'))[_0x22eb('0x4')];var clientSideLogs=require(_0x22eb('0x5'));exports['default']=function(_0x27732f){return setupLoggers(_0x27732f)['then'](function(){_0x27732f['use'](_0x22eb('0x6'),require(_0x22eb('0x7')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9'),require(_0x22eb('0xa')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb'),require(_0x22eb('0xc')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd'),require(_0x22eb('0xe')));_0x27732f[_0x22eb('0x8')]('/api/voice/mohs',require(_0x22eb('0xf')));_0x27732f['use']('/api/voice/queues',require(_0x22eb('0x10')));_0x27732f['use'](_0x22eb('0x11'),require(_0x22eb('0x12')));_0x27732f['use']('/api/screen/recordings',require(_0x22eb('0x13')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x14'),require(_0x22eb('0x15')));_0x27732f[_0x22eb('0x8')]('/api/voice/mails/messages',require(_0x22eb('0x16')));_0x27732f['use'](_0x22eb('0x17'),require('./api/voiceCallReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x18'),require('./api/voiceDialReport'));_0x27732f['use']('/api/voice/agents/reports',require(_0x22eb('0x19')));_0x27732f['use']('/api/voice/queues/reports',require(_0x22eb('0x1a')));_0x27732f['use']('/api/members/reports',require(_0x22eb('0x1b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x1c'),require(_0x22eb('0x1d')));_0x27732f[_0x22eb('0x8')]('/api/voice/transfers/reports',require(_0x22eb('0x1e')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x1f'),require(_0x22eb('0x20')));_0x27732f[_0x22eb('0x8')]('/api/mail/accounts',require(_0x22eb('0x21')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x22'),require('./api/mailQueue'));_0x27732f['use'](_0x22eb('0x23'),require(_0x22eb('0x24')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x25'),require(_0x22eb('0x26')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x27'),require('./api/mailMessage'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x28'),require(_0x22eb('0x29')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x2a'),require('./api/mailQueueReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x2b'),require(_0x22eb('0x2c')));_0x27732f['use'](_0x22eb('0x2d'),require(_0x22eb('0x2e')));_0x27732f['use'](_0x22eb('0x2f'),require(_0x22eb('0x30')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x31'),require(_0x22eb('0x32')));_0x27732f['use']('/api/fax/interactions',require(_0x22eb('0x33')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x34'),require(_0x22eb('0x35')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x36'),require(_0x22eb('0x37')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x38'),require(_0x22eb('0x39')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x3a'),require('./api/smsAccount'));_0x27732f[_0x22eb('0x8')]('/api/sms/applications',require(_0x22eb('0x3b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x3c'),require(_0x22eb('0x3d')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x3e'),require(_0x22eb('0x3f')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x40'),require(_0x22eb('0x41')));_0x27732f['use']('/api/openchannel/accounts',require(_0x22eb('0x42')));_0x27732f['use']('/api/openchannel/applications',require(_0x22eb('0x43')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x44'),require(_0x22eb('0x45')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x46'),require(_0x22eb('0x47')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x48'),require(_0x22eb('0x49')));_0x27732f['use'](_0x22eb('0x4a'),require('./api/chatWebsite'));_0x27732f['use'](_0x22eb('0x4b'),require(_0x22eb('0x4c')));_0x27732f['use'](_0x22eb('0x4d'),require(_0x22eb('0x4e')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x4f'),require(_0x22eb('0x50')));_0x27732f['use'](_0x22eb('0x51'),require(_0x22eb('0x52')));_0x27732f['use'](_0x22eb('0x53'),require(_0x22eb('0x54')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x55'),require(_0x22eb('0x56')));_0x27732f['use']('/api/chat/groups',require(_0x22eb('0x57')));_0x27732f[_0x22eb('0x8')]('/api/chat/proactive_actions',require(_0x22eb('0x58')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x59'),require('./api/cmCompany'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x5a'),require(_0x22eb('0x5b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x5c'),require(_0x22eb('0x5d')));_0x27732f['use'](_0x22eb('0x5e'),require(_0x22eb('0x5f')));_0x27732f['use'](_0x22eb('0x60'),require(_0x22eb('0x61')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x62'),require(_0x22eb('0x63')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x64'),require(_0x22eb('0x65')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x66'),require(_0x22eb('0x67')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x68'),require(_0x22eb('0x69')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x6a'),require(_0x22eb('0x6b')));_0x27732f[_0x22eb('0x8')]('/api/dispositions',require(_0x22eb('0x6c')));_0x27732f[_0x22eb('0x8')]('/api/conditions',require(_0x22eb('0x6d')));_0x27732f[_0x22eb('0x8')]('/api/intervals',require('./api/interval'));_0x27732f['use'](_0x22eb('0x6e'),require(_0x22eb('0x6f')));_0x27732f['use']('/api/cdr',require(_0x22eb('0x70')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x71'),require(_0x22eb('0x72')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x73'),require(_0x22eb('0x74')));_0x27732f[_0x22eb('0x8')]('/api/sounds',require('./api/sound'));_0x27732f[_0x22eb('0x8')]('/api/tags',require(_0x22eb('0x75')));_0x27732f['use'](_0x22eb('0x76'),require('./api/template'));_0x27732f['use']('/api/triggers',require('./api/trigger'));_0x27732f[_0x22eb('0x8')]('/api/variables',require(_0x22eb('0x77')));_0x27732f[_0x22eb('0x8')]('/api/integrations',require(_0x22eb('0x78')));_0x27732f['use'](_0x22eb('0x79'),require(_0x22eb('0x7a')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x7b'),require(_0x22eb('0x7c')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x7d'),require(_0x22eb('0x7e')));_0x27732f[_0x22eb('0x8')]('/api/analytics/extracted_reports',require(_0x22eb('0x7f')));_0x27732f[_0x22eb('0x8')]('/api/analytics/metrics',require(_0x22eb('0x80')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x81'),require(_0x22eb('0x82')));_0x27732f['use'](_0x22eb('0x83'),require(_0x22eb('0x84')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x85'),require(_0x22eb('0x86')));_0x27732f[_0x22eb('0x8')]('/api/integrations/salesforce/configurations',require(_0x22eb('0x87')));_0x27732f['use'](_0x22eb('0x88'),require('./api/intSalesforceField'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x89'),require(_0x22eb('0x8a')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x8b'),require('./api/intSugarcrmConfiguration'));_0x27732f['use'](_0x22eb('0x8c'),require(_0x22eb('0x8d')));_0x27732f['use'](_0x22eb('0x8e'),require(_0x22eb('0x8f')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x90'),require(_0x22eb('0x91')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x92'),require(_0x22eb('0x93')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x94'),require(_0x22eb('0x95')));_0x27732f['use'](_0x22eb('0x96'),require(_0x22eb('0x97')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x98'),require(_0x22eb('0x99')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9a'),require(_0x22eb('0x9b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9c'),require(_0x22eb('0x9d')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9e'),require(_0x22eb('0x9f')));_0x27732f['use']('/api/integrations/freshdesk/accounts',require(_0x22eb('0xa0')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa1'),require(_0x22eb('0xa2')));_0x27732f[_0x22eb('0x8')]('/api/integrations/freshdesk/fields',require(_0x22eb('0xa3')));_0x27732f[_0x22eb('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa4'),require(_0x22eb('0xa5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa6'),require(_0x22eb('0xa7')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa8'),require(_0x22eb('0xa9')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xaa'),require(_0x22eb('0xab')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xac'),require('./api/intServicenowField'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xad'),require(_0x22eb('0xae')));_0x27732f['use'](_0x22eb('0xaf'),require('./api/intDynamics365Configuration'));_0x27732f[_0x22eb('0x8')]('/api/integrations/dynamics365/fields',require(_0x22eb('0xb0')));_0x27732f[_0x22eb('0x8')]('/api/integrations/freshsales/accounts',require(_0x22eb('0xb1')));_0x27732f[_0x22eb('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb2'),require(_0x22eb('0xb3')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb4'),require(_0x22eb('0xb5')));_0x27732f['use'](_0x22eb('0xb6'),require('./api/chatQueueReport'));_0x27732f['use'](_0x22eb('0xb7'),require(_0x22eb('0xb8')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb9'),require(_0x22eb('0xba')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xbb'),require(_0x22eb('0xbc')));_0x27732f['use']('/api/jscripty/sessions/reports',require(_0x22eb('0xbd')));_0x27732f[_0x22eb('0x8')]('/api/sms/reports/queue',require(_0x22eb('0xbe')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xbf'),require(_0x22eb('0xc0')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc1'),require('./api/squareReportDetail'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc2'),require(_0x22eb('0xc3')));_0x27732f['use']('/api/settings',require(_0x22eb('0xc4')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc5'),require('./api/squareOdbc'));_0x27732f[_0x22eb('0x8')]('/api/square/projects',require(_0x22eb('0xc6')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc7'),require(_0x22eb('0xc8')));_0x27732f['use'](_0x22eb('0xc9'),require(_0x22eb('0xca')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xcb'),require(_0x22eb('0xcc')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xcd'),require(_0x22eb('0xce')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xcf'),require(_0x22eb('0xd0')));_0x27732f['use'](_0x22eb('0xd1'),require(_0x22eb('0xd2')));_0x27732f['use']('/api/attachments',require('./api/attachment'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd3'),require('./api/plugin'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd4'),require(_0x22eb('0xd5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd6'),require('./api/chatTransferReport'));_0x27732f['use'](_0x22eb('0xd7'),require(_0x22eb('0xd8')));_0x27732f[_0x22eb('0x8')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x27732f[_0x22eb('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd9'),require('./api/cmList'));_0x27732f['use'](_0x22eb('0xda'),require(_0x22eb('0xdb')));_0x27732f['use'](_0x22eb('0xdc'),require(_0x22eb('0xdd')));_0x27732f[_0x22eb('0x8')]('/api/userProfile/sections',require(_0x22eb('0xde')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xdf'),require(_0x22eb('0xe0')));_0x27732f[_0x22eb('0x8')]('/api/userNotifications',require(_0x22eb('0xe1')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xe2'),require('./api/whatsappAccount'));_0x27732f['use'](_0x22eb('0xe3'),require(_0x22eb('0xe4')));_0x27732f[_0x22eb('0x8')]('/api/whatsapp/interactions',require(_0x22eb('0xe5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xe6'),require('./api/whatsappMessage'));_0x27732f[_0x22eb('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xe7'),require(_0x22eb('0xe8')));_0x27732f['use'](_0x22eb('0xe9'),require(_0x22eb('0xea')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xeb'),require(_0x22eb('0xec')));_0x27732f['use'](_0x22eb('0xed'),require('./api/realtime'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xee'),require(_0x22eb('0xef')));_0x27732f['use'](_0x22eb('0xf0'),require(_0x22eb('0xf1')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xf2'),require(_0x22eb('0xf3')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xf4'),require(_0x22eb('0xf5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xf6'),require(_0x22eb('0xf7')));_0x27732f['use'](_0x22eb('0xf8'),require(_0x22eb('0xf9')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfa'),require('./api/version'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfb'),require('./api/system'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfc'),require(_0x22eb('0xfd')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfe'),require(_0x22eb('0xff')));_0x27732f[_0x22eb('0x8')]('/api/logs',clientSideLogs);_0x27732f[_0x22eb('0x8')](_0x22eb('0x100'),express['static'](path['join'](config[_0x22eb('0x101')],_0x22eb('0x100'))));_0x27732f[_0x22eb('0x8')](_0x22eb('0x102'),express[_0x22eb('0x103')](path['join'](config['root'],_0x22eb('0x102'))));_0x27732f[_0x22eb('0x8')]('/demo',express[_0x22eb('0x103')](path[_0x22eb('0x104')](config[_0x22eb('0x101')],'/demo')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x105'),express[_0x22eb('0x103')](path[_0x22eb('0x104')](config[_0x22eb('0x101')],_0x22eb('0x106'),_0x22eb('0x107'))));_0x27732f[_0x22eb('0x8')]('/plugins',express['static'](path['join'](config[_0x22eb('0x101')],'/server/files/plugins')));_0x27732f['route'](_0x22eb('0x108'))[_0x22eb('0x109')](errors[0x194]);_0x27732f['route']('/*')[_0x22eb('0x109')](function(_0x5099fb,_0x210b08){_0x210b08[_0x22eb('0x10a')](path['resolve'](_0x27732f[_0x22eb('0x109')](_0x22eb('0x10b'))+_0x22eb('0x10c')));});return _0x27732f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f1bc9e4..bfb9a86 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb631=['../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.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/pause/pause.rpc','../api/sound/sound.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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc'];(function(_0xf1a005,_0x361fee){var _0x5313f6=function(_0x3753f8){while(--_0x3753f8){_0xf1a005['push'](_0xf1a005['shift']());}};_0x5313f6(++_0x361fee);}(_0xb631,0xcc));var _0x1b63=function(_0x3cfed3,_0x4c88c1){_0x3cfed3=_0x3cfed3-0x0;var _0x13ef6b=_0xb631[_0x3cfed3];return _0x13ef6b;};'use strict';var jayson=require(_0x1b63('0x0'));var _=require(_0x1b63('0x1'));var config=require(_0x1b63('0x2'));exports[_0x1b63('0x3')]=function(){return new Promise(function(_0xd1df5c,_0x1e7c63){var _0x1440c4={};_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x5')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/voiceExtension/voiceExtension.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x6')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x7')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x8')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x9')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0xa')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0xb')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0xc')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0xd')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0xe')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0xf')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x10')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x11')));_0x1440c4=_['merge'](_0x1440c4,require('../api/mailInteraction/mailInteraction.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x12')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x13')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x14')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x15')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/faxApplication/faxApplication.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x16')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/faxMessage/faxMessage.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x17')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x18')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x19')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x1a')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x1b')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x1c')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x1d')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x1e')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x1f')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x20')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x21')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x22')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x23')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x24')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x25')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x26')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x27')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x28')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x29')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2a')));_0x1440c4=_['merge'](_0x1440c4,require('../api/interval/interval.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2b')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2c')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/template/template.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x2d')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x2e')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x2f')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x30')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x31')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x32')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x33')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x34')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x35')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x36')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x37')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x38')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x39')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3a')));_0x1440c4=_['merge'](_0x1440c4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3b')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/squareOdbc/squareOdbc.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3c')));_0x1440c4=_['merge'](_0x1440c4,require('../api/squareRecording/squareRecording.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/squareMessage/squareMessage.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/campaign/campaign.rpc'));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x3d')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x3e')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x3f')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x40')));_0x1440c4=_['merge'](_0x1440c4,require(_0x1b63('0x41')));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1440c4=_[_0x1b63('0x4')](_0x1440c4,require(_0x1b63('0x42')));var _0x556585=jayson[_0x1b63('0x43')](_0x1440c4)[_0x1b63('0x44')]();var _0x387e52=config[_0x1b63('0x45')][_0x1b63('0x46')]||config['port']+0x1;var _0x352024=config[_0x1b63('0x45')]['ip']||'localhost';_0x556585['on'](_0x1b63('0x47'),function(_0x1da6b7){return _0x1e7c63(_0x1da6b7);});_0x556585[_0x1b63('0x3')](_0x387e52,_0x352024,function(){console[_0x1b63('0x48')](_0x1b63('0x49'),_0x352024,_0x387e52);require(_0x1b63('0x4a'))[_0x1b63('0x4b')]();return _0xd1df5c('RPC\x20listening\x20on\x20'+_0x352024+':'+_0x387e52);});});}; \ No newline at end of file +var _0xcfd3=['../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise'];(function(_0x3e68c3,_0x1b99c8){var _0xd2f2a=function(_0x57882a){while(--_0x57882a){_0x3e68c3['push'](_0x3e68c3['shift']());}};_0xd2f2a(++_0x1b99c8);}(_0xcfd3,0x16c));var _0x3cfd=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xcfd3[_0x1064bc];return _0x5edc45;};'use strict';var jayson=require(_0x3cfd('0x0'));var _=require('lodash');var config=require(_0x3cfd('0x1'));exports[_0x3cfd('0x2')]=function(){return new Promise(function(_0x256724,_0x234810){var _0x4c5f55={};_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x3')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x5')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/voiceQueue/voiceQueue.rpc'));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x6')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x7')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x8')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x9')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0xa')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0xb')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0xc')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0xd')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0xe')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0xf')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x10')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x11')));_0x4c5f55=_['merge'](_0x4c5f55,require('../api/mailInteraction/mailInteraction.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x12')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x13')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x14')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x15')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/faxApplication/faxApplication.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x16')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x17')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x18')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x19')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x1a')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x1b')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x1c')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x1d')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x1e')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x1f')));_0x4c5f55=_['merge'](_0x4c5f55,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x20')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x21')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x22')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x23')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x24')));_0x4c5f55=_['merge'](_0x4c5f55,require('../api/cmHopper/cmHopper.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x25')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x26')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x27')));_0x4c5f55=_['merge'](_0x4c5f55,require('../api/interval/interval.rpc'));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x28')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x29')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x2a')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x2b')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x2c')));_0x4c5f55=_['merge'](_0x4c5f55,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x2d')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x2e')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x2f')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x30')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x31')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x32')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x33')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x34')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require('../api/squareOdbc/squareOdbc.rpc'));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x35')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x36')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x37')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x38')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x39')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x3a')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x3b')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x3c')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x3d')));_0x4c5f55=_[_0x3cfd('0x4')](_0x4c5f55,require(_0x3cfd('0x3e')));_0x4c5f55=_['merge'](_0x4c5f55,require(_0x3cfd('0x3f')));var _0x2541ed=jayson['server'](_0x4c5f55)['http']();var _0x1274d1=config[_0x3cfd('0x40')][_0x3cfd('0x41')]||config[_0x3cfd('0x41')]+0x1;var _0x332aa5=config[_0x3cfd('0x40')]['ip']||_0x3cfd('0x42');_0x2541ed['on'](_0x3cfd('0x43'),function(_0x1bc29c){return _0x234810(_0x1bc29c);});_0x2541ed['listen'](_0x1274d1,_0x332aa5,function(){console[_0x3cfd('0x44')](_0x3cfd('0x45'),_0x332aa5,_0x1274d1);require(_0x3cfd('0x46'))[_0x3cfd('0x47')]();return _0x256724(_0x3cfd('0x48')+_0x332aa5+':'+_0x1274d1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index bf7059f..d36a044 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 _0xb657=['recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','no\x20code','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xb657,0x150));var _0x7b65=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb657[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0x7b65('0x0'));var _=require(_0x7b65('0x1'));var EventEmitter=require(_0x7b65('0x2'))[_0x7b65('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x7b65('0x4'));function AGIChannel(_0x11b3d4){var _0x1489f0=this,_0x1ba76f=new AGIReply(),_0x1f5805=![],_0x3616d1={};EventEmitter[_0x7b65('0x5')](_0x1489f0);_0x11b3d4['setEncoding'](_0x7b65('0x6'));_0x11b3d4[_0x7b65('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ba76f[_0x7b65('0x8')](_0x7b65('0x6'));_0x1ba76f['on']('headers',function(_0x1e3457){for(var _0x26eb78 in _0x1e3457){_0x1489f0[_0x26eb78]=_0x1e3457[_0x26eb78];}_0x1489f0[_0x7b65('0x9')]('ready');});_0x1ba76f['on'](_0x7b65('0xa'),function(_0x414202){if(_0x414202[_0x7b65('0xb')]()==_0x7b65('0xc')){_0x1489f0[_0x7b65('0x9')]('hangup');return;}if(_0x414202[_0x7b65('0xd')](0x0,0xb)=='520-Invalid'){_0x1f5805=!![];}if(_0x1f5805){_0x3616d1['rx']+=_0x414202+'\x0a';if(_0x414202['search'](_0x7b65('0xe'))!=-0x1){_0x1f5805=![];}}else{_0x3616d1['rx']=_0x414202;}if(_0x1f5805){return;}if(typeof _0x3616d1['cb']=='function'){var _0x454263=_0x3616d1['rx'][_0x7b65('0xd')](0x0,0x3),_0x356103=null,_0x3c86a4=null;_0x454263=parseInt(_0x454263);if(isNaN(_0x454263)){_0x3616d1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7b65('0xf')});return;}if(_0x454263!=0xc8){_0x3616d1['cb'](null,{'code':_0x454263,'result':-0x1,'extra':'KO'});return;}_0x356103=_0x3616d1['rx']['substring'](0x4)['replace']('result=','');if(_0x356103[_0x7b65('0x10')]('\x20')!=-0x1){_0x356103=_0x356103['substr'](0x0,_0x356103['indexOf']('\x20'));}if(_[_0x7b65('0x11')](_0x356103,'-1')){_0x356103=parseInt(_0x356103);}_0x3c86a4=_0x3616d1['rx'][_0x7b65('0x12')]('\x20');if(_0x3c86a4[_0x7b65('0x13')]==0x3){_0x3c86a4=_0x3c86a4[0x2][_0x7b65('0xd')](0x1,_0x3c86a4[0x2][_0x7b65('0x13')]-0x1);}else if(_0x3c86a4[_0x7b65('0x13')]>0x3){var _0x39d1a3=/\((.+)\)/;var _0x9a878e=_0x3616d1['rx'][_0x7b65('0x14')](_0x39d1a3);if(_0x9a878e){_0x3c86a4=_0x9a878e[0x1];}else{_0x3c86a4=null;}}else{_0x3c86a4=null;}_0x3616d1['cb'](null,{'code':_0x454263,'result':_0x356103,'extra':_0x3c86a4});}});_0x11b3d4['on'](_0x7b65('0x15'),function(_0x3e7a97){_0x1489f0[_0x7b65('0x9')]('error',new AGIError(_0x7b65('0x16'),_0x3e7a97[_0x7b65('0x17')]));});_0x11b3d4['on'](_0x7b65('0x18'),function(){_0x1489f0[_0x7b65('0x9')]('close',new AGIError(_0x7b65('0x19')));});_0x11b3d4['on'](_0x7b65('0x1a'),function(){_0x1489f0[_0x7b65('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11b3d4[_0x7b65('0x1b')]();});_0x11b3d4[_0x7b65('0x1c')](_0x1ba76f);this[_0x7b65('0x1d')]=function(_0x4353cb,_0x28add0){var _0x4353cb=_0x4353cb||'',_0x28add0=typeof _0x28add0==_0x7b65('0x1e')?_0x28add0:new Function();_0x3616d1={'tx':_0x4353cb,'rx':'','cb':_0x28add0};_0x11b3d4[_0x7b65('0x1f')](_0x4353cb+'\x0a');},this[_0x7b65('0x18')]=function(){_0x11b3d4[_0x7b65('0x1b')]();};}util[_0x7b65('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x7b65('0x21')][_0x7b65('0x22')]=function(_0x1789db){return this[_0x7b65('0x1d')][_0x7b65('0x23')](this,_0x1789db);};AGIChannel[_0x7b65('0x21')]['answer']=function(){return this[_0x7b65('0x22')](_0x7b65('0x24'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x25')]=function(_0x48b6eb,_0x5a6cf6,_0x184e76){_0x48b6eb=_0x48b6eb===undefined?_0x7b65('0x26'):_0x48b6eb;_0x5a6cf6=_0x5a6cf6===undefined?'5':_0x5a6cf6;_0x184e76=_0x184e76===undefined?'1':_0x184e76;return this[_0x7b65('0x22')](util[_0x7b65('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x48b6eb,_0x5a6cf6*0x3e8,_0x184e76));};AGIChannel['prototype'][_0x7b65('0x28')]=function(_0x4a6408){_0x4a6408=_0x4a6408||_0x7b65('0x29');return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x2a'),_0x4a6408));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2b')]=function(_0x3ebfce,_0x216c88){if(_[_0x7b65('0x2c')](_0x216c88)){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88[_0x7b65('0x2e')](',')));}return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x2d'),_0x3ebfce,_0x216c88));};AGIChannel[_0x7b65('0x21')]['setContext']=function(_0x49e3eb){return this[_0x7b65('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x49e3eb));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x2f')]=function(_0x3be95){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x30'),_0x3be95));};AGIChannel['prototype'][_0x7b65('0x31')]=function(_0x339bf9){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x32'),_0x339bf9));};AGIChannel[_0x7b65('0x21')][_0x7b65('0xc')]=function(){return this[_0x7b65('0x22')](_0x7b65('0x33'));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x34')]=function(_0x23e9b7,_0x467f29){var _0x136e27=_[_0x7b65('0x35')](_0x467f29)||_[_0x7b65('0x36')](_0x467f29)?_0x467f29[_0x7b65('0x37')]():_0x467f29;return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x38'),_0x23e9b7,_0x136e27?_0x136e27[_0x7b65('0x37')]()[_0x7b65('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3a')]=function(_0x39c97d,_0x27267d){return this['sendRequest'](util['format'](_0x7b65('0x3b'),_0x39c97d,_0x27267d));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3c')]=function(_0x35afc0,_0x167062){return this[_0x7b65('0x22')](util['format'](_0x7b65('0x3d'),_0x35afc0,_0x167062));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x3e')]=function(_0xf87fde,_0xe31bc6){return this['sendRequest'](util[_0x7b65('0x27')](_0x7b65('0x3f'),_0xf87fde,_0xe31bc6));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x40')]=function(_0xabc38b,_0x47f719,_0x4e0e9b){_0x47f719=_0x47f719||this['extension'];_0x4e0e9b=_0x4e0e9b||0x1;this[_0x7b65('0x41')](_0xabc38b);this[_0x7b65('0x2f')](_0x47f719);this['setPriority'](_0x4e0e9b);return this[_0x7b65('0x28')](util[_0x7b65('0x27')](_0x7b65('0x42'),_0xabc38b,_0x47f719,_0x4e0e9b));};AGIChannel['prototype'][_0x7b65('0x43')]=function(_0x39e729){return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x44'),_0x39e729));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x45')]=function(_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x19aa39,_0x482d2c){_0x54b55a=_0x54b55a||_0x7b65('0x46');_0x564a56=_0x564a56||'';_0x20b175=_0x20b175===undefined?-0x1:_0x20b175==='-1'?-0x1:_0x20b175*0x3e8;_0x19aa39=_0x19aa39===undefined?'':'s='+_0x19aa39;_0x482d2c=_0x482d2c?_0x7b65('0x47'):'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x48'),_0x2afd32,_0x54b55a,_0x564a56,_0x20b175,_0x482d2c,_0x19aa39));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x49')]=function(_0x5a25b8,_0x15d3a1){_0x15d3a1=_0x15d3a1||'';return this[_0x7b65('0x22')](util[_0x7b65('0x27')](_0x7b65('0x4a'),_0x5a25b8,_0x15d3a1));};AGIChannel[_0x7b65('0x21')][_0x7b65('0x4b')]=function(_0x27684a){return this[_0x7b65('0x2b')](_0x7b65('0x4c'),_0x27684a);};AGIChannel['prototype'][_0x7b65('0x4d')]=function(_0x13211f){return this[_0x7b65('0x2b')](_0x7b65('0x4e'),_0x13211f);};AGIChannel['prototype'][_0x7b65('0x15')]=function(_0x13adcd,_0x23bf51){this['noop'](util[_0x7b65('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x13adcd['id'],_0x13adcd[_0x7b65('0x4f')],_0x23bf51));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7b65('0x50')]=AGIChannel; \ No newline at end of file +var _0xf03a=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setPriority','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','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./reply','call','setEncoding','setTimeout','utf8','headers','emit','ready','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','answer','ANSWER','getData'];(function(_0x5837b1,_0x54229a){var _0x490d8b=function(_0x3af82d){while(--_0x3af82d){_0x5837b1['push'](_0x5837b1['shift']());}};_0x490d8b(++_0x54229a);}(_0xf03a,0x1a0));var _0xaf03=function(_0x4c52a7,_0x202922){_0x4c52a7=_0x4c52a7-0x0;var _0x2c4023=_0xf03a[_0x4c52a7];return _0x2c4023;};'use strict';var util=require('util');var _=require(_0xaf03('0x0'));var EventEmitter=require(_0xaf03('0x1'))[_0xaf03('0x2')];var AGIReply=require(_0xaf03('0x3'));var AGIError=require('./error');function AGIChannel(_0x41924e){var _0xfe64f3=this,_0x4f13f3=new AGIReply(),_0x3aa47d=![],_0x10a6a5={};EventEmitter[_0xaf03('0x4')](_0xfe64f3);_0x41924e[_0xaf03('0x5')]('utf8');_0x41924e[_0xaf03('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4f13f3['setEncoding'](_0xaf03('0x7'));_0x4f13f3['on'](_0xaf03('0x8'),function(_0x33a463){for(var _0x28127e in _0x33a463){_0xfe64f3[_0x28127e]=_0x33a463[_0x28127e];}_0xfe64f3[_0xaf03('0x9')](_0xaf03('0xa'));});_0x4f13f3['on']('line',function(_0x1f3a5c){if(_0x1f3a5c[_0xaf03('0xb')]()==_0xaf03('0xc')){_0xfe64f3[_0xaf03('0x9')](_0xaf03('0xc'));return;}if(_0x1f3a5c['substring'](0x0,0xb)==_0xaf03('0xd')){_0x3aa47d=!![];}if(_0x3aa47d){_0x10a6a5['rx']+=_0x1f3a5c+'\x0a';if(_0x1f3a5c[_0xaf03('0xe')](_0xaf03('0xf'))!=-0x1){_0x3aa47d=![];}}else{_0x10a6a5['rx']=_0x1f3a5c;}if(_0x3aa47d){return;}if(typeof _0x10a6a5['cb']==_0xaf03('0x10')){var _0x37156e=_0x10a6a5['rx']['substring'](0x0,0x3),_0x216ccd=null,_0x2b1ccf=null;_0x37156e=parseInt(_0x37156e);if(isNaN(_0x37156e)){_0x10a6a5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x37156e!=0xc8){_0x10a6a5['cb'](null,{'code':_0x37156e,'result':-0x1,'extra':'KO'});return;}_0x216ccd=_0x10a6a5['rx'][_0xaf03('0x11')](0x4)[_0xaf03('0x12')](_0xaf03('0x13'),'');if(_0x216ccd['indexOf']('\x20')!=-0x1){_0x216ccd=_0x216ccd['substr'](0x0,_0x216ccd[_0xaf03('0x14')]('\x20'));}if(_[_0xaf03('0x15')](_0x216ccd,'-1')){_0x216ccd=parseInt(_0x216ccd);}_0x2b1ccf=_0x10a6a5['rx'][_0xaf03('0x16')]('\x20');if(_0x2b1ccf[_0xaf03('0x17')]==0x3){_0x2b1ccf=_0x2b1ccf[0x2][_0xaf03('0x11')](0x1,_0x2b1ccf[0x2][_0xaf03('0x17')]-0x1);}else if(_0x2b1ccf['length']>0x3){var _0xcdc24=/\((.+)\)/;var _0x136ad9=_0x10a6a5['rx'][_0xaf03('0x18')](_0xcdc24);if(_0x136ad9){_0x2b1ccf=_0x136ad9[0x1];}else{_0x2b1ccf=null;}}else{_0x2b1ccf=null;}_0x10a6a5['cb'](null,{'code':_0x37156e,'result':_0x216ccd,'extra':_0x2b1ccf});}});_0x41924e['on'](_0xaf03('0x19'),function(_0x24a074){_0xfe64f3[_0xaf03('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x24a074[_0xaf03('0x1a')]));});_0x41924e['on'](_0xaf03('0x1b'),function(){_0xfe64f3[_0xaf03('0x9')](_0xaf03('0x1b'),new AGIError(_0xaf03('0x1c')));});_0x41924e['on']('timeout',function(){_0xfe64f3[_0xaf03('0x9')]('timeout',new AGIError(_0xaf03('0x1d')));_0x41924e[_0xaf03('0x1e')]();});_0x41924e[_0xaf03('0x1f')](_0x4f13f3);this[_0xaf03('0x20')]=function(_0x2962f5,_0x3664b6){var _0x2962f5=_0x2962f5||'',_0x3664b6=typeof _0x3664b6==_0xaf03('0x10')?_0x3664b6:new Function();_0x10a6a5={'tx':_0x2962f5,'rx':'','cb':_0x3664b6};_0x41924e[_0xaf03('0x21')](_0x2962f5+'\x0a');},this[_0xaf03('0x1b')]=function(){_0x41924e['destroy']();};}util[_0xaf03('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xaf03('0x23')][_0xaf03('0x24')]=function(_0x21b865){return this['command']['sync'](this,_0x21b865);};AGIChannel[_0xaf03('0x23')][_0xaf03('0x25')]=function(){return this['sendRequest'](_0xaf03('0x26'));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x27')]=function(_0x1b1ac8,_0x25115f,_0x148227){_0x1b1ac8=_0x1b1ac8===undefined?'beep':_0x1b1ac8;_0x25115f=_0x25115f===undefined?'5':_0x25115f;_0x148227=_0x148227===undefined?'1':_0x148227;return this['sendRequest'](util[_0xaf03('0x28')](_0xaf03('0x29'),_0x1b1ac8,_0x25115f*0x3e8,_0x148227));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x2a')]=function(_0x416728){_0x416728=_0x416728||_0xaf03('0x2b');return this[_0xaf03('0x24')](util[_0xaf03('0x28')](_0xaf03('0x2c'),_0x416728));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x2d')]=function(_0x1d75f5,_0xe05319){if(_['isArray'](_0xe05319)){return this[_0xaf03('0x24')](util[_0xaf03('0x28')]('EXEC\x20%s\x20%s',_0x1d75f5,_0xe05319[_0xaf03('0x2e')](',')));}return this['sendRequest'](util[_0xaf03('0x28')](_0xaf03('0x2f'),_0x1d75f5,_0xe05319));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x30')]=function(_0xbe619e){return this[_0xaf03('0x24')](util['format'](_0xaf03('0x31'),_0xbe619e));};AGIChannel['prototype'][_0xaf03('0x32')]=function(_0x27c443){return this[_0xaf03('0x24')](util[_0xaf03('0x28')]('SET\x20EXTENSION\x20%s',_0x27c443));};AGIChannel['prototype']['setPriority']=function(_0x450238){return this[_0xaf03('0x24')](util[_0xaf03('0x28')](_0xaf03('0x33'),_0x450238));};AGIChannel['prototype'][_0xaf03('0xc')]=function(){return this[_0xaf03('0x24')](_0xaf03('0x34'));};AGIChannel[_0xaf03('0x23')]['setVariable']=function(_0x233f73,_0x5f17de){var _0x3eae73=_[_0xaf03('0x35')](_0x5f17de)||_[_0xaf03('0x36')](_0x5f17de)?_0x5f17de[_0xaf03('0x37')]():_0x5f17de;return this[_0xaf03('0x24')](util[_0xaf03('0x28')](_0xaf03('0x38'),_0x233f73,_0x3eae73?_0x3eae73[_0xaf03('0x37')]()[_0xaf03('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xaf03('0x39')]=function(_0x14a32f,_0x304c3f){return this[_0xaf03('0x24')](util[_0xaf03('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x14a32f,_0x304c3f));};AGIChannel[_0xaf03('0x23')]['sayDigits']=function(_0xe5df11,_0x477b31){return this[_0xaf03('0x24')](util[_0xaf03('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0xe5df11,_0x477b31));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x3a')]=function(_0x41a323,_0x4034b4){return this[_0xaf03('0x24')](util[_0xaf03('0x28')](_0xaf03('0x3b'),_0x41a323,_0x4034b4));};AGIChannel['prototype']['continueAt']=function(_0x2e5c2a,_0x4eaf92,_0xb5581d){_0x4eaf92=_0x4eaf92||this[_0xaf03('0x3c')];_0xb5581d=_0xb5581d||0x1;this[_0xaf03('0x30')](_0x2e5c2a);this[_0xaf03('0x32')](_0x4eaf92);this[_0xaf03('0x3d')](_0xb5581d);return this['noop'](util[_0xaf03('0x28')](_0xaf03('0x3e'),_0x2e5c2a,_0x4eaf92,_0xb5581d));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x3f')]=function(_0x11c11e){return this[_0xaf03('0x24')](util[_0xaf03('0x28')](_0xaf03('0x40'),_0x11c11e));};AGIChannel['prototype'][_0xaf03('0x41')]=function(_0x196744,_0x1344d0,_0x41f6f1,_0x5dcd7b,_0x149706,_0x3d2e3){_0x1344d0=_0x1344d0||_0xaf03('0x42');_0x41f6f1=_0x41f6f1||'';_0x5dcd7b=_0x5dcd7b===undefined?-0x1:_0x5dcd7b==='-1'?-0x1:_0x5dcd7b*0x3e8;_0x149706=_0x149706===undefined?'':'s='+_0x149706;_0x3d2e3=_0x3d2e3?_0xaf03('0x43'):'';return this[_0xaf03('0x24')](util[_0xaf03('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x196744,_0x1344d0,_0x41f6f1,_0x5dcd7b,_0x3d2e3,_0x149706));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x44')]=function(_0x747a09,_0x1d4a6e){_0x1d4a6e=_0x1d4a6e||'';return this['sendRequest'](util[_0xaf03('0x28')](_0xaf03('0x45'),_0x747a09,_0x1d4a6e));};AGIChannel[_0xaf03('0x23')][_0xaf03('0x46')]=function(_0x2ad042){return this[_0xaf03('0x2d')](_0xaf03('0x47'),_0x2ad042);};AGIChannel['prototype'][_0xaf03('0x48')]=function(_0x4466bc){return this[_0xaf03('0x2d')](_0xaf03('0x49'),_0x4466bc);};AGIChannel['prototype'][_0xaf03('0x19')]=function(_0x538fef,_0x5a073b){this[_0xaf03('0x2a')](util[_0xaf03('0x28')](_0xaf03('0x4a'),_0x538fef['id'],_0x538fef['label'],_0x5a073b));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xaf03('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f4e0938..c44c1cf 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 _0x6876=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','exports','util','Server\x20closed.'];(function(_0x33da63,_0x328b76){var _0x5814ff=function(_0x7c6228){while(--_0x7c6228){_0x33da63['push'](_0x33da63['shift']());}};_0x5814ff(++_0x328b76);}(_0x6876,0xe8));var _0x6687=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0x6876[_0x5a2291];return _0x10e3f5;};'use strict';var util=require(_0x6687('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6687('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x6687('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x6687('0x3'),'E_AGI_SOCKET_ERROR':_0x6687('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x6687('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6687('0x6'),'E_AGI_IVR_ENTRY':_0x6687('0x7')};function AGIError(_0x4f5ff3){var _0x4f5ff3=_0x4f5ff3||null,_0x4a97f8=_0x4a97f8||[],_0x2833d7=0x1,_0x4c5ed2='';if(!error[_0x4f5ff3]){_0x4f5ff3=_0x6687('0x8');}_0x4a97f8['push'](error[_0x4f5ff3]);while(arguments[_0x2833d7]){_0x4a97f8[_0x6687('0x9')](arguments[_0x2833d7]);_0x2833d7++;}_0x4c5ed2=util['format'][_0x6687('0xa')](util,_0x4a97f8);this['message']=_0x4c5ed2;this[_0x6687('0xb')]=_0x4f5ff3;}module[_0x6687('0xc')]=AGIError; \ No newline at end of file +var _0x4dd4=['format','apply','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.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push'];(function(_0x5b23ad,_0x44bc95){var _0x223d52=function(_0x1017d7){while(--_0x1017d7){_0x5b23ad['push'](_0x5b23ad['shift']());}};_0x223d52(++_0x44bc95);}(_0x4dd4,0x194));var _0x44dd=function(_0x33c8ea,_0x36f559){_0x33c8ea=_0x33c8ea-0x0;var _0x259834=_0x4dd4[_0x33c8ea];return _0x259834;};'use strict';var util=require(_0x44dd('0x0'));var error={'E_AGI_UNDEFINED':_0x44dd('0x1'),'E_AGI_ARGUMENT_PORT':_0x44dd('0x2'),'E_AGI_SERVER_ERROR':_0x44dd('0x3'),'E_AGI_SERVER_CLOSE':_0x44dd('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x44dd('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x44dd('0x6'),'E_AGI_SOCKET_ERROR':_0x44dd('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x44dd('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x44dd('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x722f38){var _0x722f38=_0x722f38||null,_0x257c20=_0x257c20||[],_0x4b1efb=0x1,_0x56254c='';if(!error[_0x722f38]){_0x722f38=_0x44dd('0xa');}_0x257c20[_0x44dd('0xb')](error[_0x722f38]);while(arguments[_0x4b1efb]){_0x257c20[_0x44dd('0xb')](arguments[_0x4b1efb]);_0x4b1efb++;}_0x56254c=util[_0x44dd('0xc')][_0x44dd('0xd')](util,_0x257c20);this['message']=_0x56254c;this[_0x44dd('0xe')]=_0x722f38;}module[_0x44dd('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 18d619a..c74470e 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 _0x1126=['max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','vswitch','default','target','default\x20on\x20switch\x20not\x20found','includes'];(function(_0x504398,_0x30be07){var _0x5a5b40=function(_0x287c28){while(--_0x287c28){_0x504398['push'](_0x504398['shift']());}};_0x5a5b40(++_0x30be07);}(_0x1126,0x177));var _0x6112=function(_0x13f6bb,_0x1d625f){_0x13f6bb=_0x13f6bb-0x0;var _0x413673=_0x1126[_0x13f6bb];return _0x413673;};'use strict';var _=require(_0x6112('0x0'));var logger=require(_0x6112('0x1'))(_0x6112('0x2'));var verticesWithRetry=[_0x6112('0x3'),_0x6112('0x4'),'getsecretdigits'];var Graph=function(){this[_0x6112('0x5')]={};this[_0x6112('0x6')]={};this[_0x6112('0x7')]=0x0;};Graph[_0x6112('0x8')][_0x6112('0x9')]=function(_0x2915e4){this[_0x6112('0x5')][_0x2915e4['id']]=_0x2915e4;this[_0x6112('0x6')][_0x2915e4['id']]=[];};Graph['prototype'][_0x6112('0xa')]=function(_0xceaad0,_0x4ccf39,_0x25182e){this[_0x6112('0x6')][_0xceaad0][_0x6112('0xb')]({'target':_0x4ccf39,'condition':_0x25182e});this[_0x6112('0x7')]+=0x1;};Graph[_0x6112('0x8')]['size']=function(){return _[_0x6112('0xc')](this['vertices']);};Graph['prototype'][_0x6112('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x6112('0x8')][_0x6112('0xe')]=function(_0x43a7e7){return this[_0x6112('0x5')][_0x43a7e7];};Graph[_0x6112('0x8')][_0x6112('0xf')]=function(_0x571d32,_0x175410){if(!this[_0x6112('0x5')][_0x571d32]){return logger[_0x6112('0x10')](_0x6112('0x11'));}var _0x5da0c2=_0x175410(this[_0x6112('0x5')][_0x571d32]);if(!_0x5da0c2){return logger['info'](_0x6112('0x12'));}if(this[_0x6112('0x6')][_0x571d32][_0x6112('0x13')]===0x0){return logger[_0x6112('0x10')](_0x6112('0x14'));}for(var _0x19bc2e=0x0,_0x58bacb=[],_0x663811=![];_0x19bc2e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[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','extension','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name','message','error','[%s]\x20%s','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','omit','hasOwnProperty','isArray','length','source','target','addEdge','getSquareProject','then','catch','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','production','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','priority','code','result','isUndefined','toString','response','agicommand\x20not\x20found'];(function(_0x40498c,_0x51aea5){var _0x1fe202=function(_0x88e5ab){while(--_0x88e5ab){_0x40498c['push'](_0x40498c['shift']());}};_0x1fe202(++_0x51aea5);}(_0x7f11,0x1c9));var _0x17f1=function(_0xd9b578,_0x200000){_0xd9b578=_0xd9b578-0x0;var _0x1e7e2f=_0x7f11[_0xd9b578];return _0x1e7e2f;};'use strict';var parser=require(_0x17f1('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require('util');var moment=require(_0x17f1('0x1'));var config=require(_0x17f1('0x2'));var logger=require('../../config/logger')(_0x17f1('0x3'));var utilLicense=require(_0x17f1('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x17f1('0x5'));var Graph=require(_0x17f1('0x6'));var Vertices=require(_0x17f1('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x17f1('0x3')]=_[_0x17f1('0x8')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x3c8ed0){process[_0x17f1('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3c8ed0);agiHandler(_0x3c8ed0);}catch(_0x5b40ff){logger['error'](_0x5b40ff['stack']);}});});}function listeningHandler(){console[_0x17f1('0xa')](_0x17f1('0xb'),config[_0x17f1('0x3')][_0x17f1('0xc')]);logger['info'](util[_0x17f1('0xd')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x17f1('0x3')]['ip'],config[_0x17f1('0x3')][_0x17f1('0xc')]));}function errorHandler(_0x37e5f8){if(_0x37e5f8&&_0x37e5f8[_0x17f1('0xe')]&&_0x37e5f8[_0x17f1('0xf')]){logger[_0x17f1('0x10')](util[_0x17f1('0xd')](_0x17f1('0x11'),_0x37e5f8['name'],_0x37e5f8[_0x17f1('0xf')]));}else{logger[_0x17f1('0x10')](util[_0x17f1('0xd')](_0x17f1('0x12'),_0x37e5f8[_0x17f1('0x13')]));}}function closeHandler(){logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x15'),this[_0x17f1('0x16')],this[_0x17f1('0x17')],this[_0x17f1('0x18')],this[_0x17f1('0x19')],this[_0x17f1('0x1a')]));try{createSquareReport(this);}catch(_0x400a82){logger[_0x17f1('0x10')](_0x400a82[_0x17f1('0x13')]);}}function timeoutHandler(){logger['info'](util[_0x17f1('0xd')](_0x17f1('0x1b'),this[_0x17f1('0x16')],this['calleridname'],this[_0x17f1('0x18')],this[_0x17f1('0x19')],this[_0x17f1('0x1a')]));}function hangupHandler(){logger['info'](util[_0x17f1('0xd')](_0x17f1('0x1c'),this[_0x17f1('0x16')],this['calleridname'],this[_0x17f1('0x18')],this[_0x17f1('0x19')],this[_0x17f1('0x1a')]));this[_0x17f1('0x1d')]=!![];}function getRoot(_0x1831ae){return parser[_0x17f1('0x1e')](_0x1831ae,{'object':!![]})[_0x17f1('0x1f')][_0x17f1('0x20')];}function addVertex(_0x1f62dd,_0x2f1cf5,_0x1b67a6){_0x2f1cf5[_0x17f1('0x21')]=_0x1b67a6;if(_0x2f1cf5['hasOwnProperty'](_0x17f1('0x22'))){_0x2f1cf5[_0x17f1('0x23')]=parseInt(_0x2f1cf5['retry'],0xa);}_0x1f62dd[_0x17f1('0x24')](_[_0x17f1('0x25')](_0x2f1cf5,'mxCell'));}function initGraph(_0x2e897c,_0x3391ea){var _0x18e77d=new Graph();for(var _0x341b67 in _0x2e897c){if(_0x2e897c[_0x17f1('0x26')](_0x341b67)){if(_[_0x17f1('0x27')](_0x2e897c[_0x341b67])){for(var _0x1d2a26=0x0;_0x1d2a26<_0x2e897c[_0x341b67][_0x17f1('0x28')];_0x1d2a26+=0x1){addVertex(_0x18e77d,_0x2e897c[_0x341b67][_0x1d2a26],_0x341b67);}}else{addVertex(_0x18e77d,_0x2e897c[_0x341b67],_0x341b67);}}}for(var _0x54792d=0x0;_0x54792d<_0x3391ea[_0x17f1('0x28')];_0x54792d+=0x1){if(_0x3391ea[_0x54792d][_0x17f1('0x29')]&&_0x3391ea[_0x54792d][_0x17f1('0x2a')]){_0x18e77d[_0x17f1('0x2b')](_0x3391ea[_0x54792d][_0x17f1('0x29')],_0x3391ea[_0x54792d][_0x17f1('0x2a')],_0x3391ea[_0x54792d]['value']);}}return _0x18e77d;}function getSquareProject(_0x3eaa55,_0x75a273){rpc[_0x17f1('0x2c')](_0x3eaa55)[_0x17f1('0x2d')](function(_0x435ea7){_0x75a273(null,_0x435ea7);})[_0x17f1('0x2e')](function(_0x11f32a){_0x75a273(null,_0x11f32a);});}function createSquareReport(_0x211abd,_0x1f47fe){rpc['createSquareReport'](_0x211abd)['then'](function(_0x38850b){if(_0x1f47fe){_0x1f47fe(null,_0x38850b);}})[_0x17f1('0x2e')](function(_0x58c05f){if(_0x1f47fe){_0x1f47fe(null,_0x58c05f);}});}function setChannelVariables(_0x2a9db3){for(var _0x3cb786 in _0x2a9db3){if(_0x2a9db3[_0x17f1('0x26')](_0x3cb786)){if(_0x3cb786[_0x17f1('0x2f')](_0x17f1('0x30'))===0x0){_0x2a9db3[_0x3cb786['substring'](0x4)]=_0x2a9db3[_0x3cb786];delete _0x2a9db3[_0x3cb786];}}}}function getLogFromObject(_0x338d11){return util[_0x17f1('0x31')](_0x338d11,{'showHidden':![],'depth':null});}function agiHandler(_0x1a3b0a){var _0x3bfc5a,_0x285765,_0x32a6d3,_0x3641d2,_0x590e1b;logger[_0x17f1('0x32')](_0x17f1('0x33'),JSON[_0x17f1('0x34')](_0x1a3b0a,null,0x2));logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x35'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a[_0x17f1('0x17')],_0x1a3b0a[_0x17f1('0x18')],_0x1a3b0a[_0x17f1('0x19')],_0x1a3b0a[_0x17f1('0x1a')]));_0x1a3b0a['on']('error',errorHandler);_0x1a3b0a['on'](_0x17f1('0x36'),closeHandler);_0x1a3b0a['on']('timeout',timeoutHandler);_0x1a3b0a['evtHangup']=![];_0x1a3b0a['on'](_0x17f1('0x37'),hangupHandler);var _0x12b75a=getSquareProject['sync'](null,_0x1a3b0a[_0x17f1('0x16')]);if(_0x12b75a){if(_0x12b75a[_0x17f1('0x38')]){_0x3bfc5a=getRoot(_0x12b75a[_0x17f1('0x38')]);if(_0x3bfc5a&&_0x3bfc5a['start']){logger[_0x17f1('0x32')](_0x17f1('0x20'),JSON[_0x17f1('0x34')](_0x3bfc5a,null,0x2));_0x1a3b0a['joinAt']=moment()[_0x17f1('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x285765=initGraph(_[_0x17f1('0x25')](_0x3bfc5a,_0x17f1('0x39')),_0x3bfc5a['mxCell']);_0x32a6d3=new Vertices(_0x1a3b0a,rpc,mailRpc);logger[_0x17f1('0x14')](util['format'](_0x17f1('0x3a'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a[_0x17f1('0x17')],_0x1a3b0a['callerid'],_0x1a3b0a['dnid'],_0x1a3b0a['uniqueid']));_0x285765[_0x17f1('0x3b')](_0x3bfc5a[_0x17f1('0x3c')]['id'],function(_0x111c3f){try{_0x111c3f=_0x32a6d3['clear'](_0x111c3f);logger[_0x17f1('0x32')](_0x17f1('0x3d'),JSON['stringify'](_0x111c3f,null,0x2));if(_0x111c3f[_0x17f1('0x21')]===_0x17f1('0x3e')){logger[_0x17f1('0x14')](_0x17f1('0x3f'));_0x1a3b0a['context']=_0x111c3f['context']||_0x1a3b0a['context'];_0x1a3b0a['extension']=_0x111c3f['extension'];_0x1a3b0a[_0x17f1('0x40')]=_0x111c3f[_0x17f1('0x40')]?_0x111c3f[_0x17f1('0x40')]-0x1:0x1;return null;}else if(_0x111c3f&&_0x32a6d3[_0x111c3f['agicommand']]){_0x590e1b=_0x32a6d3[_0x111c3f[_0x17f1('0x21')]](_0x111c3f);logger[_0x17f1('0x14')]('response',JSON[_0x17f1('0x34')](_0x590e1b,null,0x2));if(_0x590e1b&&_0x590e1b[_0x17f1('0x41')]===AGI_CODE_SUCCESS&&_0x590e1b[_0x17f1('0x42')]!==AGI_RESULT_ERROR&&!_0x1a3b0a[_0x17f1('0x1d')]){logger[_0x17f1('0x32')]('response',getLogFromObject(_0x590e1b));return _[_0x17f1('0x43')](_0x590e1b[_0x17f1('0x42')])?null:_0x590e1b[_0x17f1('0x42')][_0x17f1('0x44')]();}else{logger[_0x17f1('0x10')](_0x17f1('0x45'),getLogFromObject(_0x590e1b));return null;}}else{logger[_0x17f1('0x10')](_0x17f1('0x46'));return null;}}catch(_0x56310f){logger[_0x17f1('0x10')](_0x56310f['stack']);return null;}});if(_0x3bfc5a[_0x17f1('0x47')]){logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x48'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a[_0x17f1('0x17')],_0x1a3b0a[_0x17f1('0x18')],_0x1a3b0a[_0x17f1('0x19')],_0x1a3b0a[_0x17f1('0x1a')]));_0x285765['traverseBFS'](_0x3bfc5a['finally']['id'],function(_0xa806fa){try{_0xa806fa=_0x32a6d3[_0x17f1('0x49')](_0xa806fa);logger[_0x17f1('0x32')](_0x17f1('0x3d'),JSON[_0x17f1('0x34')](_0xa806fa,null,0x2));if(_0xa806fa&&_0x32a6d3[_0xa806fa[_0x17f1('0x21')]]){_0x590e1b=_0x32a6d3[_0xa806fa[_0x17f1('0x21')]](_0xa806fa);if(_0x590e1b){logger[_0x17f1('0x32')]('response',getLogFromObject(_0x590e1b));return _[_0x17f1('0x43')](_0x590e1b[_0x17f1('0x42')])?null:_0x590e1b[_0x17f1('0x42')][_0x17f1('0x44')]();}else{logger[_0x17f1('0x10')]('response',getLogFromObject(_0x590e1b));return null;}}else{logger[_0x17f1('0x10')](_0x17f1('0x46'));return null;}}catch(_0x24eb41){logger[_0x17f1('0x10')](_0x24eb41[_0x17f1('0x13')]);return null;}});}logger['info'](util[_0x17f1('0xd')](_0x17f1('0x4a'),_0x1a3b0a[_0x17f1('0x16')],_0x1a3b0a['calleridname'],_0x1a3b0a[_0x17f1('0x18')],_0x1a3b0a[_0x17f1('0x19')],_0x1a3b0a[_0x17f1('0x1a')]));logger['info'](util[_0x17f1('0xd')](_0x17f1('0x4b'),_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a[_0x17f1('0x40')],0xa)+0x1));_0x1a3b0a[_0x17f1('0x4e')](_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a[_0x17f1('0x40')],0xa)+0x1);_0x1a3b0a[_0x17f1('0x36')]();}}else{logger[_0x17f1('0x10')](util['format']('Project\x20%s\x20not\x20published',_0x1a3b0a[_0x17f1('0x16')]));_0x1a3b0a['continueAt'](_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a['priority'],0xa)+0x1);_0x1a3b0a[_0x17f1('0x36')]();}}else{logger[_0x17f1('0x10')](util[_0x17f1('0xd')](_0x17f1('0x4f'),_0x1a3b0a['arg_1']));_0x1a3b0a[_0x17f1('0x4e')](_0x1a3b0a[_0x17f1('0x4c')],_0x1a3b0a[_0x17f1('0x4d')],parseInt(_0x1a3b0a[_0x17f1('0x40')],0xa)+0x1);_0x1a3b0a[_0x17f1('0x36')]();}}function main(){var _0xc89d95;return utilLicense['getLicense']()[_0x17f1('0x2d')](function(_0x445de9){if(_0x445de9){if(_0x445de9[_0x17f1('0x50')]){if(_0x445de9['callysquare']&&_0x445de9[_0x17f1('0x51')]>0x0){logger[_0x17f1('0x14')](util[_0x17f1('0xd')](_0x17f1('0x52'),_0x445de9['callysquare']));_0xc89d95=_0x445de9['callysquare'];}else{logger[_0x17f1('0x14')](_0x17f1('0x53'));}}else{logger[_0x17f1('0x14')](_0x17f1('0x54'));_0xc89d95=-0x1;}}})[_0x17f1('0x2e')](function(_0x355f9a){logger[_0x17f1('0x10')](_0x17f1('0x55'),_0x355f9a[_0x17f1('0x13')]);})[_0x17f1('0x47')](function(){var _0x36c632=require(_0x17f1('0x56'))(config[_0x17f1('0x3')]['port'],config['agi']['ip'],_0xc89d95);_0x36c632['on'](_0x17f1('0x10'),errorHandler);_0x36c632['on']('listening',listeningHandler);_0x36c632['on'](_0x17f1('0x57'),connectionHandler);_0x36c632['on'](_0x17f1('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x12e9=['./project','defaults','127.0.0.1','error','stack','push','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','close','projectUpdate','util','../../config/logger','agi','./rpc'];(function(_0x5e6c33,_0x4f157a){var _0x142bc9=function(_0x2d2415){while(--_0x2d2415){_0x5e6c33['push'](_0x5e6c33['shift']());}};_0x142bc9(++_0x4f157a);}(_0x12e9,0x66));var _0x912e=function(_0xc80177,_0x2f1a5c){_0xc80177=_0xc80177-0x0;var _0x4dd84e=_0x12e9[_0xc80177];return _0x4dd84e;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x912e('0x0'));var config=require('../../config/environment');var logger=require(_0x912e('0x1'))(_0x912e('0x2'));var utilLicense=require('../../config/license/util');var rpc=require(_0x912e('0x3'));var Project=require(_0x912e('0x4'));var projects=[];config['agi']=_[_0x912e('0x5')](config[_0x912e('0x2')],{'ip':_0x912e('0x6'),'port':0x11dd});function connectionHandler(_0x31622c){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x31622c);agiHandler(_0x31622c);}catch(_0x2e950a){logger[_0x912e('0x7')](_0x2e950a[_0x912e('0x8')]);}});});}function projectUpdateHandler(_0x7ac782){try{var _0x1d9857=_['findIndex'](projects,['id',_0x7ac782['id']]);if(_0x1d9857>-0x1){if(_0x7ac782['deleted']===!![]){projects['splice'](_0x1d9857,0x1);}else{projects[_0x1d9857]=_0x7ac782;}}else{projects[_0x912e('0x9')](_0x7ac782);}}catch(_0x2344a0){logger[_0x912e('0x7')](_0x2344a0[_0x912e('0x8')]);}}function listeningHandler(){console[_0x912e('0xa')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x912e('0x2')][_0x912e('0xb')]);logger[_0x912e('0xc')](util[_0x912e('0xd')](_0x912e('0xe'),config[_0x912e('0x2')]['ip'],config[_0x912e('0x2')][_0x912e('0xb')]));}function errorHandler(_0x3c153b){if(_0x3c153b&&_0x3c153b[_0x912e('0xf')]&&_0x3c153b[_0x912e('0x10')]){logger[_0x912e('0x7')](util['format'](_0x912e('0x11'),_0x3c153b['name'],_0x3c153b['message']));}else{logger[_0x912e('0x7')](util[_0x912e('0xd')](_0x912e('0x12'),_0x3c153b['stack']));}}function closeHandler(){logger['info'](util[_0x912e('0xd')](_0x912e('0x13'),this[_0x912e('0x14')],this['calleridname'],this[_0x912e('0x15')],this[_0x912e('0x16')],this[_0x912e('0x17')]));try{createSquareReport(this);}catch(_0x1d3345){logger[_0x912e('0x7')](_0x1d3345['stack']);}}function timeoutHandler(){logger[_0x912e('0xc')](util[_0x912e('0xd')](_0x912e('0x18'),this[_0x912e('0x14')],this[_0x912e('0x19')],this[_0x912e('0x15')],this[_0x912e('0x16')],this[_0x912e('0x17')]));}function hangupHandler(){logger[_0x912e('0xc')](util[_0x912e('0xd')](_0x912e('0x1a'),this['arg_1'],this[_0x912e('0x19')],this['callerid'],this[_0x912e('0x16')],this['uniqueid']));this[_0x912e('0x1b')]=!![];}function createSquareReport(_0x5e3562,_0x59feaa){rpc[_0x912e('0x1c')](_0x5e3562)[_0x912e('0x1d')](function(_0x892de0){if(_0x59feaa){_0x59feaa(null,_0x892de0);}})[_0x912e('0x1e')](function(_0x2bedf3){if(_0x59feaa){_0x59feaa(null,_0x2bedf3);}});}function setChannelVariables(_0x5ba003){for(var _0x92f64d in _0x5ba003){if(_0x5ba003[_0x912e('0x1f')](_0x92f64d)){if(_0x92f64d[_0x912e('0x20')]('agi_')===0x0){_0x5ba003[_0x92f64d[_0x912e('0x21')](0x4)]=_0x5ba003[_0x92f64d];delete _0x5ba003[_0x92f64d];}}}}function agiHandler(_0x52c388){logger[_0x912e('0x22')](_0x912e('0x23'),JSON[_0x912e('0x24')](_0x52c388,null,0x2));logger[_0x912e('0xc')](util[_0x912e('0xd')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x52c388[_0x912e('0x14')],_0x52c388[_0x912e('0x19')],_0x52c388[_0x912e('0x15')],_0x52c388['dnid'],_0x52c388[_0x912e('0x17')]));_0x52c388['on']('error',errorHandler);_0x52c388['on']('close',closeHandler);_0x52c388['on']('timeout',timeoutHandler);_0x52c388[_0x912e('0x1b')]=![];_0x52c388['on']('hangup',hangupHandler);var _0x4cbb33=_['find'](projects,[_0x912e('0xf'),_0x52c388[_0x912e('0x14')]]);if(!_0x4cbb33)return Project[_0x912e('0x25')](_0x52c388);if(!_0x4cbb33[_0x912e('0x26')])return Project[_0x912e('0x27')](_0x52c388);return Project[_0x912e('0x28')](_0x4cbb33,_0x52c388);}function main(){var _0x1d4294;return utilLicense[_0x912e('0x29')]()[_0x912e('0x1d')](function(_0x2c3993){if(!_0x2c3993)return;if(_0x2c3993[_0x912e('0x2a')]){if(_0x2c3993[_0x912e('0x2b')]&&_0x2c3993[_0x912e('0x2b')]>0x0){logger['info'](util['format'](_0x912e('0x2c'),_0x2c3993['callysquare']));_0x1d4294=_0x2c3993[_0x912e('0x2b')];}else{logger[_0x912e('0xc')](_0x912e('0x2d'));}}else{logger[_0x912e('0xc')](_0x912e('0x2e'));_0x1d4294=-0x1;}})[_0x912e('0x1d')](function(){return Project[_0x912e('0x2f')]();})[_0x912e('0x1d')](function(_0x7314f1){projects=_0x7314f1;return;})[_0x912e('0x1e')](function(_0x5dd9e9){logger[_0x912e('0x7')](_0x912e('0x30'),_0x5dd9e9[_0x912e('0x8')]);})[_0x912e('0x31')](function(){var _0xc8089b=require('./server')(config[_0x912e('0x2')]['port'],config[_0x912e('0x2')]['ip'],_0x1d4294);_0xc8089b['on'](_0x912e('0x7'),errorHandler);_0xc8089b['on'](_0x912e('0x32'),listeningHandler);_0xc8089b['on']('connection',connectionHandler);_0xc8089b['on'](_0x912e('0x33'),closeHandler);_0xc8089b['on'](_0x912e('0x34'),projectUpdateHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 045d653..32a791d 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 _0xd795=['then','error','message','result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request'];(function(_0x5291e4,_0x22677d){var _0x589405=function(_0x1db485){while(--_0x1db485){_0x5291e4['push'](_0x5291e4['shift']());}};_0x589405(++_0x22677d);}(_0xd795,0x151));var _0x5d79=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd795[_0x279d37];return _0x530173;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5d79('0x0'));var client=jayson[_0x5d79('0x1')][_0x5d79('0x2')]({'port':0x232b});function request(_0x242826,_0x46d1e9){return new BPromise(function(_0x118ffb,_0x111ba7){return client[_0x5d79('0x3')](_0x242826,_0x46d1e9)[_0x5d79('0x4')](function(_0x56ed3f){if(_0x56ed3f[_0x5d79('0x5')]){return _0x111ba7(_0x56ed3f['error'][_0x5d79('0x6')]);}else{return _0x118ffb(_0x56ed3f[_0x5d79('0x7')]);}})[_0x5d79('0x8')](function(_0x4048b1){return _0x111ba7(_0x4048b1);});});}exports[_0x5d79('0x9')]=function(_0x5d4976,_0x170beb){return request(_0x5d79('0xa'),{'account':_0x5d4976,'message':_0x170beb});}; \ No newline at end of file +var _0x5f2b=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x5f2b,0x198));var _0xb5f2=function(_0x333b16,_0xa82f1a){_0x333b16=_0x333b16-0x0;var _0x35d9ec=_0x5f2b[_0x333b16];return _0x35d9ec;};'use strict';var BPromise=require(_0xb5f2('0x0'));var jayson=require(_0xb5f2('0x1'));var client=jayson[_0xb5f2('0x2')][_0xb5f2('0x3')]({'port':0x232b});function request(_0x4cc158,_0x32a621){return new BPromise(function(_0x1c19c3,_0x2ee160){return client[_0xb5f2('0x4')](_0x4cc158,_0x32a621)[_0xb5f2('0x5')](function(_0x75e839){if(_0x75e839['error']){return _0x2ee160(_0x75e839[_0xb5f2('0x6')][_0xb5f2('0x7')]);}else{return _0x1c19c3(_0x75e839[_0xb5f2('0x8')]);}})[_0xb5f2('0x9')](function(_0x18d7ac){return _0x2ee160(_0x18d7ac);});});}exports['sendMailMessage']=function(_0x4e419f,_0x46cb24){return request(_0xb5f2('0xa'),{'account':_0x4e419f,'message':_0x46cb24});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js new file mode 100644 index 0000000..cb210a5 --- /dev/null +++ b/server/services/agi/project.js @@ -0,0 +1,18 @@ +// ************************************************************************* +// * * +// * xCALLY Motion - The Omnichannel Contact Center * +// * Copyright (c) Xenialab s.r.l. All Rights Reserved * +// * * +// ************************************************************************* +// * * +// * Email: info@xcally.com * +// * Website: https://www.xcally.com * +// * * +// ************************************************************************* +// * * +// * The SOFTWARE PRODUCT is protected by copyright laws and international * +// * copyright treaties, as well as other intellectual property laws and * +// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * +// * * +// ************************************************************************* +var _0x4e5b=['response','code','result','evtHangup','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','clear','vertex','isUndefined','agicommand\x20not\x20found','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','arg_1','calleridname','callerid','uniqueid','traverseBFS','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x4e5b,0x158));var _0xb4e5=function(_0x2c09ee,_0x12794b){_0x2c09ee=_0x2c09ee-0x0;var _0x3a27a5=_0x4e5b[_0x2c09ee];return _0x3a27a5;};'use strict';var _=require(_0xb4e5('0x0'));var moment=require(_0xb4e5('0x1'));var parser=require(_0xb4e5('0x2'));var util=require(_0xb4e5('0x3'));var logger=require(_0xb4e5('0x4'))(_0xb4e5('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xb4e5('0x6'));var Graph=require(_0xb4e5('0x7'));var Vertices=require(_0xb4e5('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb4e5('0x9')]()[_0xb4e5('0xa')](function(_0x2792b2){logger[_0xb4e5('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x2792b2['stack']);return[];});}function addVertex(_0x2a8e91,_0x1daff3,_0xd489ae){_0x1daff3[_0xb4e5('0xc')]=_0xd489ae;if(_0x1daff3['hasOwnProperty'](_0xb4e5('0xd'))){_0x1daff3[_0xb4e5('0xe')]=parseInt(_0x1daff3['retry'],0xa);}_0x2a8e91[_0xb4e5('0xf')](_[_0xb4e5('0x10')](_0x1daff3,_0xb4e5('0x11')));}function initGraph(_0x337b26,_0x4db44e){var _0x57e1c8=new Graph();for(var _0x2d2451 in _0x337b26){if(_0x337b26[_0xb4e5('0x12')](_0x2d2451)){if(_[_0xb4e5('0x13')](_0x337b26[_0x2d2451])){for(var _0x38e7c4=0x0;_0x38e7c4<_0x337b26[_0x2d2451][_0xb4e5('0x14')];_0x38e7c4+=0x1){addVertex(_0x57e1c8,_0x337b26[_0x2d2451][_0x38e7c4],_0x2d2451);}}else{addVertex(_0x57e1c8,_0x337b26[_0x2d2451],_0x2d2451);}}}for(var _0x4e4efb=0x0;_0x4e4efb<_0x4db44e[_0xb4e5('0x14')];_0x4e4efb+=0x1){if(_0x4db44e[_0x4e4efb][_0xb4e5('0x15')]&&_0x4db44e[_0x4e4efb][_0xb4e5('0x16')]){_0x57e1c8[_0xb4e5('0x17')](_0x4db44e[_0x4e4efb][_0xb4e5('0x15')],_0x4db44e[_0x4e4efb][_0xb4e5('0x16')],_0x4db44e[_0x4e4efb][_0xb4e5('0x18')]);}}return _0x57e1c8;}function getRoot(_0x54ea3f){return parser[_0xb4e5('0x19')](_0x54ea3f,{'object':!![]})['mxGraphModel'][_0xb4e5('0x1a')];}function inspect(_0x4c0797){return util[_0xb4e5('0x1b')](_0x4c0797,{'showHidden':![],'depth':null});}function initialize(_0x205f7f,_0x55d36c){var _0x250ebb=getRoot(_0x205f7f[_0xb4e5('0x1c')]);if(!_0x250ebb||!_0x250ebb[_0xb4e5('0x1d')])return;var _0x49b3cd,_0x46f5f8,_0x391c20;logger[_0xb4e5('0x1e')](_0xb4e5('0x1a'),JSON[_0xb4e5('0x1f')](_0x250ebb,null,0x2));_0x55d36c[_0xb4e5('0x20')]=moment()[_0xb4e5('0x21')](_0xb4e5('0x22'));_0x49b3cd=initGraph(_[_0xb4e5('0x10')](_0x250ebb,_0xb4e5('0x11')),_0x250ebb[_0xb4e5('0x11')]);_0x46f5f8=new Vertices(_0x55d36c,rpc,mailRpc);logger[_0xb4e5('0x23')](util[_0xb4e5('0x21')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x55d36c[_0xb4e5('0x24')],_0x55d36c[_0xb4e5('0x25')],_0x55d36c[_0xb4e5('0x26')],_0x55d36c['dnid'],_0x55d36c[_0xb4e5('0x27')]));_0x49b3cd[_0xb4e5('0x28')](_0x250ebb[_0xb4e5('0x1d')]['id'],function(_0x89d726){try{_0x89d726=_0x46f5f8['clear'](_0x89d726);logger[_0xb4e5('0x1e')]('vertex',JSON[_0xb4e5('0x1f')](_0x89d726,null,0x2));if(_0x89d726['agicommand']===_0xb4e5('0x29')){logger[_0xb4e5('0x23')](_0xb4e5('0x2a'));_0x55d36c[_0xb4e5('0x2b')]=_0x89d726[_0xb4e5('0x2b')]||_0x55d36c[_0xb4e5('0x2b')];_0x55d36c[_0xb4e5('0x2c')]=_0x89d726[_0xb4e5('0x2c')];_0x55d36c[_0xb4e5('0x2d')]=_0x89d726['priority']?_0x89d726[_0xb4e5('0x2d')]-0x1:0x1;return null;}else if(_0x89d726&&_0x46f5f8[_0x89d726[_0xb4e5('0xc')]]){_0x391c20=_0x46f5f8[_0x89d726['agicommand']](_0x89d726);logger['info'](_0xb4e5('0x2e'),JSON[_0xb4e5('0x1f')](_0x391c20,null,0x2));if(_0x391c20&&_0x391c20[_0xb4e5('0x2f')]===AGI_CODE_SUCCESS&&_0x391c20[_0xb4e5('0x30')]!==AGI_RESULT_ERROR&&!_0x55d36c[_0xb4e5('0x31')]){logger[_0xb4e5('0x1e')](_0xb4e5('0x2e'),inspect(_0x391c20));return _['isUndefined'](_0x391c20[_0xb4e5('0x30')])?null:_0x391c20[_0xb4e5('0x30')][_0xb4e5('0x32')]();}else{logger['error']('response',inspect(_0x391c20));return null;}}else{logger[_0xb4e5('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x344c0d){logger[_0xb4e5('0xb')](_0x344c0d['stack']);return null;}});if(_0x250ebb[_0xb4e5('0x33')]){logger[_0xb4e5('0x23')](util[_0xb4e5('0x21')](_0xb4e5('0x34'),_0x55d36c[_0xb4e5('0x24')],_0x55d36c['calleridname'],_0x55d36c[_0xb4e5('0x26')],_0x55d36c[_0xb4e5('0x35')],_0x55d36c[_0xb4e5('0x27')]));_0x49b3cd[_0xb4e5('0x28')](_0x250ebb['finally']['id'],function(_0x2a7b0e){try{_0x2a7b0e=_0x46f5f8[_0xb4e5('0x36')](_0x2a7b0e);logger[_0xb4e5('0x1e')](_0xb4e5('0x37'),JSON[_0xb4e5('0x1f')](_0x2a7b0e,null,0x2));if(_0x2a7b0e&&_0x46f5f8[_0x2a7b0e[_0xb4e5('0xc')]]){_0x391c20=_0x46f5f8[_0x2a7b0e[_0xb4e5('0xc')]](_0x2a7b0e);if(_0x391c20){logger['debug'](_0xb4e5('0x2e'),inspect(_0x391c20));return _[_0xb4e5('0x38')](_0x391c20[_0xb4e5('0x30')])?null:_0x391c20['result']['toString']();}else{logger[_0xb4e5('0xb')](_0xb4e5('0x2e'),inspect(_0x391c20));return null;}}else{logger[_0xb4e5('0xb')](_0xb4e5('0x39'));return null;}}catch(_0x5d6191){logger[_0xb4e5('0xb')](_0x5d6191[_0xb4e5('0x3a')]);return null;}});}logger[_0xb4e5('0x23')](util['format'](_0xb4e5('0x3b'),_0x55d36c['arg_1'],_0x55d36c['calleridname'],_0x55d36c['callerid'],_0x55d36c[_0xb4e5('0x35')],_0x55d36c[_0xb4e5('0x27')]));logger[_0xb4e5('0x23')](util[_0xb4e5('0x21')](_0xb4e5('0x3c'),_0x55d36c[_0xb4e5('0x2b')],_0x55d36c['extension'],parseInt(_0x55d36c[_0xb4e5('0x2d')],0xa)+0x1));_0x55d36c[_0xb4e5('0x3d')](_0x55d36c[_0xb4e5('0x2b')],_0x55d36c[_0xb4e5('0x2c')],parseInt(_0x55d36c['priority'],0xa)+0x1);_0x55d36c['close']();}function handleNotFound(_0xc3d8c1){logger[_0xb4e5('0xb')](util[_0xb4e5('0x21')](_0xb4e5('0x3e'),_0xc3d8c1[_0xb4e5('0x24')]));_0xc3d8c1[_0xb4e5('0x3d')](_0xc3d8c1['context'],_0xc3d8c1['extension'],parseInt(_0xc3d8c1[_0xb4e5('0x2d')],0xa)+0x1);_0xc3d8c1[_0xb4e5('0x3f')]();}function handleUnpublished(_0x3e29c0){logger[_0xb4e5('0xb')](util[_0xb4e5('0x21')](_0xb4e5('0x40'),_0x3e29c0[_0xb4e5('0x24')]));_0x3e29c0[_0xb4e5('0x3d')](_0x3e29c0['context'],_0x3e29c0[_0xb4e5('0x2c')],parseInt(_0x3e29c0[_0xb4e5('0x2d')],0xa)+0x1);_0x3e29c0[_0xb4e5('0x3f')]();}module['exports']={'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 54e99ea..cfd3913 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 _0x7e12=['inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','slice','trim','length','emit','headers','util','stream','call','_inBody'];(function(_0x4d45dd,_0x21fc83){var _0x4313d0=function(_0x5b4020){while(--_0x5b4020){_0x4d45dd['push'](_0x4d45dd['shift']());}};_0x4313d0(++_0x21fc83);}(_0x7e12,0x17c));var _0x27e1=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x7e12[_0x2555d0];return _0x3bb486;};'use strict';var util=require(_0x27e1('0x0'));var Transform=require(_0x27e1('0x1'))['Transform'];function AGIReply(_0x22264){Transform[_0x27e1('0x2')](this,_0x22264);this['_localBuffer']='';this[_0x27e1('0x3')]=![];}util[_0x27e1('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x27e1('0x5')]=function(_0x58caeb,_0x5da441,_0x30e084){var _0x41b95a='\x0a',_0x2bd783=['\x0a\x0a',_0x27e1('0x6')],_0x4768ba=-0x1,_0x38d22c=-0x1,_0x23e772='',_0x382056=0x0,_0x112725='',_0x3afdd4='';this[_0x27e1('0x7')]+=_0x58caeb[_0x27e1('0x8')]();_0x112725=this[_0x27e1('0x7')];if(!this[_0x27e1('0x3')]){_0x382056=0x0;while(_0x2bd783[_0x382056]){while((_0x38d22c=_0x112725[_0x27e1('0x9')](_0x2bd783[_0x382056]))!=-0x1){_0x23e772=_0x2bd783[_0x382056];_0x3afdd4=_0x112725[_0x27e1('0xa')](0x0,_0x38d22c);_0x112725=_0x112725[_0x27e1('0xa')](_0x38d22c+_0x23e772['length']);var _0x50834c=_0x3afdd4['split'](_0x41b95a),_0x65bccd=0x0,_0x3af836={},_0x2efdd9='',_0xb4fa0c='',_0x37ee0e=-0x1;while(_0x50834c[_0x65bccd]){_0x37ee0e=_0x50834c[_0x65bccd][_0x27e1('0x9')](':');if(_0x37ee0e!=-0x1){_0x2efdd9=_0x50834c[_0x65bccd][_0x27e1('0xb')](0x0,_0x37ee0e)[_0x27e1('0xc')]();_0xb4fa0c=_0x50834c[_0x65bccd][_0x27e1('0xb')](_0x37ee0e+0x1)['trim']();if(_0x2efdd9[_0x27e1('0xd')]>0x0){_0x3af836[_0x2efdd9]=_0xb4fa0c;}}else{}_0x65bccd++;}this[_0x27e1('0xe')](_0x27e1('0xf'),_0x3af836);this['_inBody']=!![];}_0x382056++;}this[_0x27e1('0x7')]=_0x112725;}else{while((_0x4768ba=_0x112725['indexOf'](_0x41b95a))!=-0x1){_0x3afdd4=_0x112725[_0x27e1('0xa')](0x0,_0x4768ba);this[_0x27e1('0xe')]('line',_0x3afdd4);_0x112725=_0x112725['substring'](_0x4768ba+_0x41b95a[_0x27e1('0xd')]);}this['_localBuffer']=_0x112725;}_0x30e084();};module['exports']=AGIReply; \ No newline at end of file +var _0x03bc=['headers','_inBody','substring','exports','util','Transform','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','length','split','indexOf','slice'];(function(_0x1a53c2,_0x4724a1){var _0x1b0d17=function(_0x3427c1){while(--_0x3427c1){_0x1a53c2['push'](_0x1a53c2['shift']());}};_0x1b0d17(++_0x4724a1);}(_0x03bc,0xb8));var _0xc03b=function(_0x44995,_0x420422){_0x44995=_0x44995-0x0;var _0xe8ee2b=_0x03bc[_0x44995];return _0xe8ee2b;};'use strict';var util=require(_0xc03b('0x0'));var Transform=require('stream')[_0xc03b('0x1')];function AGIReply(_0x1b04c7){Transform['call'](this,_0x1b04c7);this[_0xc03b('0x2')]='';this['_inBody']=![];}util[_0xc03b('0x3')](AGIReply,Transform);AGIReply[_0xc03b('0x4')][_0xc03b('0x5')]=function(_0x163bf3,_0x476e8e,_0x48e3de){var _0x31eda8='\x0a',_0x5982de=['\x0a\x0a',_0xc03b('0x6')],_0x4dd542=-0x1,_0xfccf77=-0x1,_0x64dd0a='',_0x2c9c10=0x0,_0x26cbb8='',_0x38ef04='';this[_0xc03b('0x2')]+=_0x163bf3['toString']();_0x26cbb8=this[_0xc03b('0x2')];if(!this['_inBody']){_0x2c9c10=0x0;while(_0x5982de[_0x2c9c10]){while((_0xfccf77=_0x26cbb8['indexOf'](_0x5982de[_0x2c9c10]))!=-0x1){_0x64dd0a=_0x5982de[_0x2c9c10];_0x38ef04=_0x26cbb8['substring'](0x0,_0xfccf77);_0x26cbb8=_0x26cbb8['substring'](_0xfccf77+_0x64dd0a[_0xc03b('0x7')]);var _0x5e1e2b=_0x38ef04[_0xc03b('0x8')](_0x31eda8),_0x4a3ed4=0x0,_0x4c90a5={},_0x5c0ef4='',_0x90a00a='',_0x410e9f=-0x1;while(_0x5e1e2b[_0x4a3ed4]){_0x410e9f=_0x5e1e2b[_0x4a3ed4][_0xc03b('0x9')](':');if(_0x410e9f!=-0x1){_0x5c0ef4=_0x5e1e2b[_0x4a3ed4][_0xc03b('0xa')](0x0,_0x410e9f)['trim']();_0x90a00a=_0x5e1e2b[_0x4a3ed4][_0xc03b('0xa')](_0x410e9f+0x1)['trim']();if(_0x5c0ef4['length']>0x0){_0x4c90a5[_0x5c0ef4]=_0x90a00a;}}else{}_0x4a3ed4++;}this['emit'](_0xc03b('0xb'),_0x4c90a5);this[_0xc03b('0xc')]=!![];}_0x2c9c10++;}this[_0xc03b('0x2')]=_0x26cbb8;}else{while((_0x4dd542=_0x26cbb8[_0xc03b('0x9')](_0x31eda8))!=-0x1){_0x38ef04=_0x26cbb8[_0xc03b('0xd')](0x0,_0x4dd542);this['emit']('line',_0x38ef04);_0x26cbb8=_0x26cbb8[_0xc03b('0xd')](_0x4dd542+_0x31eda8[_0xc03b('0x7')]);}this[_0xc03b('0x2')]=_0x26cbb8;}_0x48e3de();};module[_0xc03b('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 652dcb4..a080dd7 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 _0xad9c=['getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowMailAccount','Smtp','CloudProvider','getVoiceQueueById'];(function(_0x3d9361,_0x272ecc){var _0x5841a3=function(_0x3b0eb2){while(--_0x3b0eb2){_0x3d9361['push'](_0x3d9361['shift']());}};_0x5841a3(++_0x272ecc);}(_0xad9c,0x11c));var _0xcad9=function(_0x55d5c6,_0x27a2a8){_0x55d5c6=_0x55d5c6-0x0;var _0x486837=_0xad9c[_0x55d5c6];return _0x486837;};'use strict';var BPromise=require(_0xcad9('0x0'));var moment=require(_0xcad9('0x1'));var _=require(_0xcad9('0x2'));var util=require(_0xcad9('0x3'));var jayson=require(_0xcad9('0x4'));var client=jayson[_0xcad9('0x5')][_0xcad9('0x6')]({'port':0x2329});function request(_0x2e1072,_0x58fa99){return new BPromise(function(_0x135a2e,_0x25e677){return client[_0xcad9('0x7')](_0x2e1072,_0x58fa99)[_0xcad9('0x8')](function(_0x568dc9){if(_0x568dc9['error']){return _0x25e677(_0x568dc9[_0xcad9('0x9')][_0xcad9('0xa')]);}else{return _0x135a2e(_0x568dc9[_0xcad9('0xb')]);}})[_0xcad9('0xc')](function(_0x3b767c){return _0x25e677(_0x3b767c);});});}exports[_0xcad9('0xd')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xcad9('0xe'),_0xcad9('0xf')]}});};exports[_0xcad9('0x10')]=function(_0x495293){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x495293},'attributes':['production']}});};exports['getMailAccountById']=function(_0x173bd9){return request(_0xcad9('0x11'),{'options':{'raw':![],'where':{'id':_0x173bd9},'include':[{'model':'MailServerOut','as':_0xcad9('0x12'),'include':[{'model':_0xcad9('0x13'),'as':_0xcad9('0x13')}]}],'attributes':['id',_0xcad9('0xe'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4da5e5){return request('ShowSquareProject',{'options':{'where':{'id':_0x4da5e5},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x14')]=function(_0x28595e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x28595e},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x15')]=function(_0x487044){return request(_0xcad9('0x16'),{'options':{'where':{'id':_0x487044},'attributes':['name']}});};exports[_0xcad9('0x17')]=function(_0x30dfde){return request(_0xcad9('0x18'),{'options':{'where':{'id':_0x30dfde},'attributes':[_0xcad9('0x19')]}});};exports[_0xcad9('0x1a')]=function(_0x3b01f5){return request(_0xcad9('0x1b'),{'options':{'where':{'id':_0x3b01f5},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x1c')]=function(_0x2d0d52){return request(_0xcad9('0x1d'),{'options':{'where':{'phone':_0x2d0d52['phone']},'attributes':['id']}});};exports[_0xcad9('0x1e')]=function(_0x4bb9f7){return request(_0xcad9('0x1f'),{'options':{'where':{'id':_0x4bb9f7},'attributes':['name']}});};exports['getSoundById']=function(_0x59932b){return request(_0xcad9('0x20'),{'options':{'where':{'id':_0x59932b},'attributes':[_0xcad9('0x21')]}});};exports['getIntervalById']=function(_0x45a641){return request(_0xcad9('0x22'),{'options':{'raw':![],'where':{'id':_0x45a641},'include':[{'model':_0xcad9('0x23'),'as':_0xcad9('0x24')}]}});};exports[_0xcad9('0x25')]=function(_0x155bd0){return request(_0xcad9('0x26'),{'options':{'where':{'id':_0x155bd0},'attributes':['id',_0xcad9('0xe')]}});};exports[_0xcad9('0x27')]=function(_0xdd2422){return request(_0xcad9('0x28'),{'body':_0xdd2422});};exports[_0xcad9('0x29')]=function(_0x253142){return request(_0xcad9('0x2a'),{'body':_0x253142});};exports[_0xcad9('0x2b')]=function(_0x4d6879){return request(_0xcad9('0x2c'),{'body':_['merge'](_0x4d6879,{'project_name':_0x4d6879[_0xcad9('0x2d')],'prev_project_name':_0x4d6879[_0xcad9('0x2e')]||'','is_subproject':_0x4d6879[_0xcad9('0x2e')]?!![]:![],'leaveAt':moment()[_0xcad9('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xcad9('0x30')]=function(_0xbdcf68){return request(_0xcad9('0x31'),{'body':_0xbdcf68});};exports[_0xcad9('0x32')]=function(_0x3504b5){return request(_0xcad9('0x33'),{'body':_0x3504b5});};exports['createCmContact']=function(_0x557664){return request(_0xcad9('0x34'),{'options':{'raw':![],'where':{'phone':_0x557664[_0xcad9('0x35')],'ListId':_0x557664[_0xcad9('0x36')]}}})[_0xcad9('0x8')](function(_0x120442){if(_0x120442){return _0x120442;}return request('CreateCmContact',{'body':_0x557664});});};exports[_0xcad9('0x37')]=function(_0xeade5f){return request('ShowPause',{'options':{'where':{'id':_0xeade5f},'attributes':[_0xcad9('0xe')]}});};exports[_0xcad9('0x38')]=function(_0x4849a8,_0x27c153){return request(_0xcad9('0x39'),{'body':{'interface':_0x27c153},'options':{'where':_0x4849a8}});};exports[_0xcad9('0x3a')]=function(_0x2bfa51,_0x4760e8,_0x40f11e){return request('PauseUser',{'body':{'type':_0x4760e8,'uniqueid':_0x40f11e},'options':{'where':_0x2bfa51}});};exports[_0xcad9('0x3b')]=function(_0x1b8c65){return request(_0xcad9('0x3c'),{'body':{},'options':{'where':_0x1b8c65}});};exports['agentLogout']=function(_0x37bfe3){return request('LogoutUser',{'body':{},'options':{'where':_0x37bfe3}});}; \ No newline at end of file +var _0x5ed2=['LogoutUser','lodash','jayson/promise','client','request','then','error','message','result','catch','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout'];(function(_0x243f66,_0x57833e){var _0x155018=function(_0x4786a1){while(--_0x4786a1){_0x243f66['push'](_0x243f66['shift']());}};_0x155018(++_0x57833e);}(_0x5ed2,0x114));var _0x25ed=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0x5ed2[_0x1be9ce];return _0x164439;};'use strict';var _=require(_0x25ed('0x0'));var moment=require('moment');var jayson=require(_0x25ed('0x1'));var client=jayson[_0x25ed('0x2')]['http']({'port':0x2329});function request(_0x468494,_0xb12505){return new Promise(function(_0x591e52,_0x1ce8d8){return client[_0x25ed('0x3')](_0x468494,_0xb12505)[_0x25ed('0x4')](function(_0x36991f){if(_0x36991f['error']){return _0x1ce8d8(_0x36991f[_0x25ed('0x5')][_0x25ed('0x6')]);}else{return _0x591e52(_0x36991f[_0x25ed('0x7')]);}})[_0x25ed('0x8')](function(_0x5921bb){return _0x1ce8d8(_0x5921bb);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x25ed('0x9')]}});};exports[_0x25ed('0xa')]=function(_0x3eef35){return request(_0x25ed('0xb'),{'options':{'raw':![],'where':{'name':_0x3eef35},'attributes':['production']}});};exports[_0x25ed('0xc')]=function(_0x252c54){return request(_0x25ed('0xd'),{'options':{'raw':![],'where':{'id':_0x252c54},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x25ed('0xe'),'as':_0x25ed('0xe')}]}],'attributes':['id',_0x25ed('0xf'),_0x25ed('0x10')],'smtp':!![]}});};exports[_0x25ed('0x11')]=function(_0x2c48c7){return request('ShowSquareProject',{'options':{'where':{'id':_0x2c48c7},'attributes':[_0x25ed('0xf')]}});};exports[_0x25ed('0x12')]=function(_0x4730c5){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4730c5},'attributes':[_0x25ed('0xf')]}});};exports['getVariableById']=function(_0x3e9b5e){return request(_0x25ed('0x13'),{'options':{'where':{'id':_0x3e9b5e},'attributes':[_0x25ed('0xf')]}});};exports['getSquareOdbcById']=function(_0xfabdb){return request(_0x25ed('0x14'),{'options':{'where':{'id':_0xfabdb},'attributes':[_0x25ed('0x15')]}});};exports[_0x25ed('0x16')]=function(_0x405667){return request(_0x25ed('0x17'),{'options':{'where':{'id':_0x405667},'attributes':['name']}});};exports[_0x25ed('0x18')]=function(_0x3a86ae){return request('GetContactByPhone',{'options':{'where':{'phone':_0x3a86ae[_0x25ed('0x19')]},'attributes':['id']}});};exports[_0x25ed('0x1a')]=function(_0x3ec467){return request('ShowTrunk',{'options':{'where':{'id':_0x3ec467},'attributes':[_0x25ed('0xf')]}});};exports[_0x25ed('0x1b')]=function(_0x3ba174){return request(_0x25ed('0x1c'),{'options':{'where':{'id':_0x3ba174},'attributes':[_0x25ed('0x1d')]}});};exports[_0x25ed('0x1e')]=function(_0x257d6d){return request(_0x25ed('0x1f'),{'options':{'raw':![],'where':{'id':_0x257d6d},'include':[{'model':_0x25ed('0x20'),'as':_0x25ed('0x21')}]}});};exports[_0x25ed('0x22')]=function(_0x4a8135){return request(_0x25ed('0x23'),{'options':{'where':{'id':_0x4a8135},'attributes':['id',_0x25ed('0xf')]}});};exports[_0x25ed('0x24')]=function(_0x453181){return request(_0x25ed('0x25'),{'body':_0x453181});};exports['createSquareDetailsReport']=function(_0x2e0b7c){return request(_0x25ed('0x26'),{'body':_0x2e0b7c});};exports[_0x25ed('0x27')]=function(_0x18d8fb){return request('CreateSquareReport',{'body':_[_0x25ed('0x28')](_0x18d8fb,{'project_name':_0x18d8fb[_0x25ed('0x29')],'prev_project_name':_0x18d8fb[_0x25ed('0x2a')]||'','is_subproject':_0x18d8fb['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x25ed('0x2b'))})});};exports['createSquareRecording']=function(_0x2e7de5){return request(_0x25ed('0x2c'),{'body':_0x2e7de5});};exports['createSquareMessage']=function(_0x38d6e0){return request(_0x25ed('0x2d'),{'body':_0x38d6e0});};exports['createCmContact']=function(_0x26456f){return request(_0x25ed('0x2e'),{'options':{'raw':![],'where':{'phone':_0x26456f[_0x25ed('0x19')],'ListId':_0x26456f[_0x25ed('0x2f')]}}})[_0x25ed('0x4')](function(_0x1988a4){if(_0x1988a4){return _0x1988a4;}return request(_0x25ed('0x30'),{'body':_0x26456f});});};exports['getPauseById']=function(_0x10cd5e){return request('ShowPause',{'options':{'where':{'id':_0x10cd5e},'attributes':[_0x25ed('0xf')]}});};exports[_0x25ed('0x31')]=function(_0x12f751,_0x58a1e4){return request(_0x25ed('0x32'),{'body':{'interface':_0x58a1e4},'options':{'where':_0x12f751}});};exports['agentPause']=function(_0x2a24bc,_0x1ad655,_0x3cdf24){return request(_0x25ed('0x33'),{'body':{'type':_0x1ad655,'uniqueid':_0x3cdf24},'options':{'where':_0x2a24bc}});};exports['agentUnpause']=function(_0x2c7ccf){return request(_0x25ed('0x34'),{'body':{},'options':{'where':_0x2c7ccf}});};exports[_0x25ed('0x35')]=function(_0x3b2104){return request(_0x25ed('0x36'),{'body':{},'options':{'where':_0x3b2104}});}; \ 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 e36f4f7..e9e368e 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 _0x4fb4=['./lex','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fb4,0x190));var _0x44fb=function(_0x2195ac,_0x1670c8){_0x2195ac=_0x2195ac-0x0;var _0x8bfa1d=_0x4fb4[_0x2195ac];return _0x8bfa1d;};var polly=require('./polly');var lex=require(_0x44fb('0x0'));module[_0x44fb('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2678=['exports','./lex'];(function(_0x5860e9,_0x380ea6){var _0xe97184=function(_0x43000e){while(--_0x43000e){_0x5860e9['push'](_0x5860e9['shift']());}};_0xe97184(++_0x380ea6);}(_0x2678,0x1bb));var _0x8267=function(_0x4f79a5,_0x438dd7){_0x4f79a5=_0x4f79a5-0x0;var _0x2ee2f1=_0x2678[_0x4f79a5];return _0x2ee2f1;};var polly=require('./polly');var lex=require(_0x8267('0x0'));module[_0x8267('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5c98453..3e695b3 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 _0xa571=['exports','./lib/api'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xa571,0x107));var _0x1a57=function(_0x7633c,_0x1e45bf){_0x7633c=_0x7633c-0x0;var _0x1b77e2=_0xa571[_0x7633c];return _0x1b77e2;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0x6f7a=['./lib/api','exports'];(function(_0x4f79e8,_0x13e19f){var _0x3a520a=function(_0x2dc79d){while(--_0x2dc79d){_0x4f79e8['push'](_0x4f79e8['shift']());}};_0x3a520a(++_0x13e19f);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x5c916f,_0x3b12d1){_0x5c916f=_0x5c916f-0x0;var _0x3102f9=_0x6f7a[_0x5c916f];return _0x3102f9;};'use strict';var lex=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]=function(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8){return lex(_0x205e14,_0x982062,_0x4dd99d,_0x93614a,_0x407de3,_0x12ecb8);}; \ 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 a766296..42ad279 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(_0x193cbf,_0x4f4a7e){var _0x5e4b2e=function(_0x1e6db3){while(--_0x1e6db3){_0x193cbf['push'](_0x193cbf['shift']());}};_0x5e4b2e(++_0x4f4a7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x4d0212,_0x4d82b3){var _0xaeb9ac=function(_0x280f44){while(--_0x280f44){_0x4d0212['push'](_0x4d0212['shift']());}};_0xaeb9ac(++_0x4d82b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 f9eb101..378c928 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 _0xb5c9=['./lib/api'];(function(_0x22a33a,_0x4a7487){var _0x2d0a92=function(_0x4c27e2){while(--_0x4c27e2){_0x22a33a['push'](_0x22a33a['shift']());}};_0x2d0a92(++_0x4a7487);}(_0xb5c9,0x1ca));var _0x9b5c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb5c9[_0xbca1b1];return _0x4e1686;};'use strict';var polly=require(_0x9b5c('0x0'));module['exports']=function(_0x2bea80,_0x50b9b0,_0x80013f,_0x295eaa,_0x38a22c,_0x543b2a,_0x3cdcd4){return polly(_0x2bea80,_0x50b9b0,_0x80013f,_0x295eaa,_0x38a22c,_0x543b2a,_0x3cdcd4);}; \ No newline at end of file +var _0xbc6e=['exports'];(function(_0x5ebf9d,_0x392822){var _0xefbd7b=function(_0x412e96){while(--_0x412e96){_0x5ebf9d['push'](_0x5ebf9d['shift']());}};_0xefbd7b(++_0x392822);}(_0xbc6e,0x190));var _0xebc6=function(_0xe11ae3,_0x4bc71f){_0xe11ae3=_0xe11ae3-0x0;var _0x553424=_0xbc6e[_0xe11ae3];return _0x553424;};'use strict';var polly=require('./lib/api');module[_0xebc6('0x0')]=function(_0xca628d,_0x49953b,_0x43cb1a,_0x3a2b35,_0x13f93e,_0x32d43d,_0x412eac){return polly(_0xca628d,_0x49953b,_0x43cb1a,_0x3a2b35,_0x13f93e,_0x32d43d,_0x412eac);}; \ 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 2bfc2af..5a226dd 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 _0x57ac=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','synthesizeSpeech'];(function(_0x4445c6,_0x48ddaa){var _0x136da6=function(_0x3bcc3f){while(--_0x3bcc3f){_0x4445c6['push'](_0x4445c6['shift']());}};_0x136da6(++_0x48ddaa);}(_0x57ac,0x141));var _0xc57a=function(_0x531722,_0x161aa9){_0x531722=_0x531722-0x0;var _0x3f1769=_0x57ac[_0x531722];return _0x3f1769;};'use strict';var fs=require('fs');var path=require(_0xc57a('0x0'));var BPromise=require(_0xc57a('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x27202a,_0x2ebf61,_0x1d2a38){return new BPromise(function(_0x47b7b9,_0x402c8d){_0x27202a[_0xc57a('0x2')](_0x2ebf61,function(_0x2a823d,_0x30f689){if(_0x2a823d){_0x402c8d(_0x2a823d);}else if(_0x30f689){if(_0x30f689[_0xc57a('0x3')]instanceof Buffer){fs[_0xc57a('0x4')](_0x1d2a38,_0x30f689[_0xc57a('0x3')],function(_0x344976){if(_0x344976){_0x402c8d(_0x344976);}else{_0x47b7b9();}});}else{_0x402c8d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x402c8d(new Error(_0xc57a('0x5')));}});});}module[_0xc57a('0x6')]=function(_0x1a60d4,_0x3e7a4a,_0x10a1df,_0x53213b,_0x2ca1dd,_0x278149,_0x170dfb){var _0x1ec0ec=new AWS[(_0xc57a('0x7'))]({'accessKeyId':_0x1a60d4,'secretAccessKey':_0x3e7a4a,'region':_0x10a1df});var _0x18267d={'Text':_0x2ca1dd,'TextType':_0x278149||'text','OutputFormat':_0xc57a('0x8'),'VoiceId':_0x53213b};return pollyResult(_0x1ec0ec,_0x18267d,_0x170dfb);}; \ No newline at end of file +var _0xba7f=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','AudioStream'];(function(_0xef7f3b,_0x4f689f){var _0x5bc9e3=function(_0x247b0d){while(--_0x247b0d){_0xef7f3b['push'](_0xef7f3b['shift']());}};_0x5bc9e3(++_0x4f689f);}(_0xba7f,0x8c));var _0xfba7=function(_0x16bb57,_0x4c6da5){_0x16bb57=_0x16bb57-0x0;var _0x23e75c=_0xba7f[_0x16bb57];return _0x23e75c;};'use strict';var fs=require('fs');var path=require(_0xfba7('0x0'));var BPromise=require(_0xfba7('0x1'));var rs=require(_0xfba7('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x457c06,_0x5ad674,_0x778033){return new BPromise(function(_0x3cc49b,_0x49fc0a){_0x457c06['synthesizeSpeech'](_0x5ad674,function(_0x26c073,_0x1ea965){if(_0x26c073){_0x49fc0a(_0x26c073);}else if(_0x1ea965){if(_0x1ea965[_0xfba7('0x3')]instanceof Buffer){fs['writeFile'](_0x778033,_0x1ea965['AudioStream'],function(_0x155d48){if(_0x155d48){_0x49fc0a(_0x155d48);}else{_0x3cc49b();}});}else{_0x49fc0a(new Error(_0xfba7('0x4')));}}else{_0x49fc0a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xfba7('0x5')]=function(_0x254b53,_0x7e10ae,_0x318cfb,_0x59e66d,_0x3d5d35,_0x2a1554,_0x197491){var _0x4a4ab4=new AWS[(_0xfba7('0x6'))]({'accessKeyId':_0x254b53,'secretAccessKey':_0x7e10ae,'region':_0x318cfb});var _0x34a225={'Text':_0x3d5d35,'TextType':_0x2a1554||_0xfba7('0x7'),'OutputFormat':_0xfba7('0x8'),'VoiceId':_0x59e66d};return pollyResult(_0x4a4ab4,_0x34a225,_0x197491);}; \ 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 7139009..6acb6c3 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 _0x339e=['exports'];(function(_0x579f2a,_0x46c6ac){var _0x260aac=function(_0x2fc829){while(--_0x2fc829){_0x579f2a['push'](_0x579f2a['shift']());}};_0x260aac(++_0x46c6ac);}(_0x339e,0xc0));var _0xe339=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0x339e[_0x2feb53];return _0x5700ee;};'use strict';var asr=require('./lib/api');module[_0xe339('0x0')]=function(_0x5422d6,_0x3c0270,_0x3ce3fa,_0x1698bd){return asr(_0x5422d6,_0x3c0270,_0x3ce3fa);}; \ No newline at end of file +var _0xd7f6=['exports','./lib/api'];(function(_0x50a77e,_0x1d91f5){var _0x315f38=function(_0x3068ad){while(--_0x3068ad){_0x50a77e['push'](_0x50a77e['shift']());}};_0x315f38(++_0x1d91f5);}(_0xd7f6,0x16b));var _0x6d7f=function(_0x4eeb45,_0x49543a){_0x4eeb45=_0x4eeb45-0x0;var _0x4a2a1f=_0xd7f6[_0x4eeb45];return _0x4a2a1f;};'use strict';var asr=require(_0x6d7f('0x0'));module[_0x6d7f('0x1')]=function(_0x2aea2e,_0x4fcb70,_0x39af98,_0x319ce7){return asr(_0x2aea2e,_0x4fcb70,_0x39af98);}; \ 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 3ec0a0c..28804e8 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 _0xe28e=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe28e,0x1ba));var _0xee28=function(_0x55fda3,_0x5f10f5){_0x55fda3=_0x55fda3-0x0;var _0x8d0d7a=_0xe28e[_0x55fda3];return _0x8d0d7a;};'use strict';var url=require(_0xee28('0x0'));var BPromise=require(_0xee28('0x1'));var fs=require('fs');var host=_0xee28('0x2');module[_0xee28('0x3')]=function(_0x415017,_0x117a12,_0x3e541a){return new BPromise(function(_0x9f2216,_0xdc22c0){var _0x40fdf8;if(typeof _0x415017!==_0xee28('0x4')||_0x415017[_0xee28('0x5')]===0x0){return _0xdc22c0(_0xee28('0x6'));}if(typeof _0x117a12!=='string'||_0x117a12[_0xee28('0x5')]===0x0){return _0xdc22c0(_0xee28('0x7'));}if(typeof _0x3e541a!==_0xee28('0x8')&&(typeof _0x3e541a!==_0xee28('0x4')||_0x3e541a[_0xee28('0x5')]===0x0)){return _0xdc22c0(_0xee28('0x9'));}try{_0x40fdf8=fs[_0xee28('0xa')](_0x415017)['toString']('base64');}catch(_0x561fe4){return _0xdc22c0(_0x561fe4);}return _0x9f2216({'method':_0xee28('0xb'),'uri':host+_0xee28('0xc')+_0x117a12,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xee28('0xd'),'languageCode':_0x3e541a},'audio':{'content':_0x40fdf8}},'json':!![]});});}; \ No newline at end of file +var _0x78f0=['base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x78f0,0x15d));var _0x078f=function(_0x35f044,_0x52efe7){_0x35f044=_0x35f044-0x0;var _0x527190=_0x78f0[_0x35f044];return _0x527190;};'use strict';var url=require(_0x078f('0x0'));var BPromise=require(_0x078f('0x1'));var fs=require('fs');var host=_0x078f('0x2');module[_0x078f('0x3')]=function(_0x11b4c1,_0x2bde34,_0x34a715){return new BPromise(function(_0x316f1c,_0x5785fd){var _0x2f3d53;if(typeof _0x11b4c1!==_0x078f('0x4')||_0x11b4c1[_0x078f('0x5')]===0x0){return _0x5785fd(_0x078f('0x6'));}if(typeof _0x2bde34!=='string'||_0x2bde34[_0x078f('0x5')]===0x0){return _0x5785fd(_0x078f('0x7'));}if(typeof _0x34a715!=='undefined'&&(typeof _0x34a715!==_0x078f('0x4')||_0x34a715[_0x078f('0x5')]===0x0)){return _0x5785fd(_0x078f('0x8'));}try{_0x2f3d53=fs[_0x078f('0x9')](_0x11b4c1)[_0x078f('0xa')](_0x078f('0xb'));}catch(_0x4207d0){return _0x5785fd(_0x4207d0);}return _0x316f1c({'method':_0x078f('0xc'),'uri':host+'/v1/speech:recognize?key='+_0x2bde34,'body':{'config':{'encoding':_0x078f('0xd'),'sampleRateHertz':_0x078f('0xe'),'languageCode':_0x34a715},'audio':{'content':_0x2f3d53}},'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 5b2d913..846495b 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 _0x440f=['exports'];(function(_0x2fd627,_0x4fdbcf){var _0x3c469a=function(_0x239d7d){while(--_0x239d7d){_0x2fd627['push'](_0x2fd627['shift']());}};_0x3c469a(++_0x4fdbcf);}(_0x440f,0xaf));var _0xf440=function(_0x4cd0da,_0x19d59d){_0x4cd0da=_0x4cd0da-0x0;var _0x3ff50d=_0x440f[_0x4cd0da];return _0x3ff50d;};var asr=require('./asr');module[_0xf440('0x0')]={'asr':asr}; \ No newline at end of file +var _0x6dd7=['./asr','exports'];(function(_0x157314,_0x3904d8){var _0x222997=function(_0x27507f){while(--_0x27507f){_0x157314['push'](_0x157314['shift']());}};_0x222997(++_0x3904d8);}(_0x6dd7,0x110));var _0x76dd=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0x6dd7[_0x12c66e];return _0x19481a;};var asr=require(_0x76dd('0x0'));module[_0x76dd('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 1d7392d..f1638bf 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 _0x8718=['channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','statusMessage','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','generate','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','tmp','.mp3','from','audioContent','writeFile','777','resolve','.wav','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','transcript','alternatives','join','googleASR\x20confidence','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','isFallback','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','confidence','awsPolly','polly','awsLex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x8718,0x118));var _0x8871=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x8718[_0x1fa759];return _0x2da9f4;};'use strict';var apiai=require(_0x8871('0x0'));var BPromise=require(_0x8871('0x1'));var dialogflow=require(_0x8871('0x2'));var fs=require('fs');var http=require(_0x8871('0x3'));var https=require('https');var md5=require(_0x8871('0x4'));var path=require(_0x8871('0x5'));var querystring=require(_0x8871('0x6'));var rp=require(_0x8871('0x7'));var rs=require(_0x8871('0x8'));var sox=require('sox');var tts=require(_0x8871('0x9'));var urlParse=require(_0x8871('0xa'))[_0x8871('0xb')];var util=require(_0x8871('0xc'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x8871('0xd'));var tilde=require(_0x8871('0xe'));var logger=require(_0x8871('0xf'))('agi');var ISPEECH_API=_0x8871('0x10');function downloadFile(_0x5b57fb,_0x2e751a){return new BPromise(function(_0x3be563,_0x49796e){var _0x1d51e2=urlParse(_0x5b57fb);var _0x3c652d=_0x1d51e2[_0x8871('0x11')]===_0x8871('0x12')?https:http;var _0x46d5ac={'host':_0x1d51e2['host'],'path':_0x1d51e2['path'],'headers':{'user-agent':_0x8871('0x13')}};_0x3c652d[_0x8871('0x14')](_0x46d5ac,function(_0x5a0199){if(_0x5a0199[_0x8871('0x15')]!==0xc8){logger[_0x8871('0x16')](_0x8871('0x17')+_0x5b57fb+'\x20failed,\x20status\x20code\x20=\x20'+_0x5a0199[_0x8871('0x15')]+'\x20('+_0x5a0199['statusMessage']+')');_0x49796e(new Error(_0x8871('0x17')+_0x5b57fb+_0x8871('0x18')+_0x5a0199[_0x8871('0x15')]+'\x20('+_0x5a0199['statusMessage']+')'));return;}var _0x38fae7=fs[_0x8871('0x19')](_0x2e751a);_0x38fae7['on'](_0x8871('0x1a'),function(){logger['info'](_0x8871('0x1b'));_0x38fae7[_0x8871('0x1c')](_0x3be563);});_0x38fae7['on']('error',function(_0x39eed8){fs[_0x8871('0x1d')](_0x2e751a);logger[_0x8871('0x16')](_0x8871('0x1e'),_0x39eed8);_0x49796e(_0x39eed8);});_0x5a0199[_0x8871('0x1f')](_0x38fae7);})['on']('error',function(_0x578f5b){logger[_0x8871('0x16')](_0x578f5b);_0x49796e(_0x578f5b);})[_0x8871('0x20')]();});}function uploadFile(_0x410fde){return new BPromise(function(_0x52ff79,_0x525abf){var _0x5675b4=urlParse(_0x410fde);var _0x2d2501=_0x5675b4['protocol']===_0x8871('0x12')?https:http;var _0x14a268={'host':_0x5675b4[_0x8871('0x21')],'path':_0x5675b4[_0x8871('0x5')],'headers':{'user-agent':_0x8871('0x13')}};_0x2d2501['get'](_0x14a268,function(_0x1b8115){if(_0x1b8115['statusCode']!==0xc8){_0x525abf(new Error(_0x8871('0x17')+_0x410fde+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b8115[_0x8871('0x15')]+'\x20('+_0x1b8115[_0x8871('0x22')]+')'));return;}var _0xcdfcec='';_0x1b8115['on'](_0x8871('0x23'),function(_0x5b92b7){_0xcdfcec+=_0x5b92b7;});_0x1b8115['on']('end',function(){_0x52ff79(_0xcdfcec);});})['on'](_0x8871('0x16'),function(_0x314250){_0x525abf(_0x314250);})[_0x8871('0x20')]();});}function convertFile(_0x113827,_0x17387f){return new BPromise(function(_0x1eab1b,_0x5a39ab){var _0x392dee=sox[_0x8871('0x24')](_0x113827,_0x17387f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x392dee['on'](_0x8871('0x16'),function(_0x550742){logger[_0x8871('0x16')](_0x8871('0x25'),_0x550742);_0x5a39ab(_0x550742);});_0x392dee['on'](_0x8871('0x20'),function(){logger[_0x8871('0x26')](_0x8871('0x27'));_0x1eab1b();});_0x392dee[_0x8871('0x28')]();});}function base64Decode(_0x499b8e,_0x592e57){var _0x2b3651=path['resolve'](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+'.wav');fs[_0x8871('0x2a')](_0x2b3651,_0x499b8e,_0x8871('0x2b'));return convertFile(_0x2b3651,_0x592e57)[_0x8871('0x2c')](function(){try{fs['unlink'](_0x2b3651);fs[_0x8871('0x2d')](_0x592e57,'777');}catch(_0x3ba807){logger[_0x8871('0x16')](_0x3ba807);}return _0x592e57[_0x8871('0x2e')]('.')[0x0];});}function base64Encode(_0x2a462b){var _0x45af7c=fs[_0x8871('0x2f')](_0x2a462b);return new Buffer(_0x45af7c)[_0x8871('0x30')](_0x8871('0x2b'));}exports[_0x8871('0x31')]=function(_0x475854,_0x2bdce5,_0x345fc6,_0x51c7fe,_0x23ea7d,_0x5d69b5){var _0x2ec833,_0x479539;var _0x10c268=_0x8871('0x32');var _0x2182b1=_0x8871('0x33')+_0x475854;var _0x5666e4={};if(_0x2bdce5===_0x8871('0x34')){_0x5666e4[_0x8871('0x35')]={'ssml':_0x345fc6};}else{_0x5666e4[_0x8871('0x35')]={'text':_0x345fc6};};_0x5666e4[_0x8871('0x36')]={'languageCode':_0x51c7fe,'ssmlGender':_0x23ea7d};_0x5666e4[_0x8871('0x37')]={'audioEncoding':_0x8871('0x38'),'sampleRateHertz':0x1f40};var _0x28ce3a={'url':_0x10c268+'text:synthesize'+_0x2182b1,'method':_0x8871('0x39'),'json':!![],'body':_0x5666e4};return rp(_0x28ce3a)[_0x8871('0x2c')](function(_0x289582){return new BPromise(function(_0x1d5041,_0x24db55){_0x2ec833=path['resolve'](__dirname,_0x8871('0x3a'),rs[_0x8871('0x29')](0x4)+_0x8871('0x3b'));var _0x9de691=Buffer[_0x8871('0x3c')](_0x289582[_0x8871('0x3d')],_0x8871('0x2b'));return fs[_0x8871('0x3e')](_0x2ec833,_0x9de691,function(_0x513250){_0x24db55(_0x513250);},function(_0x14f35e){fs[_0x8871('0x2d')](_0x2ec833,_0x8871('0x3f'));_0x1d5041(_0x14f35e);});});})['then'](function(_0x1310a6){_0x479539=path[_0x8871('0x40')](__dirname,_0x8871('0x3a'),rs['generate'](0x4)+_0x8871('0x41'));return convertFile(_0x2ec833,_0x479539);})[_0x8871('0x2c')](function(){try{fs[_0x8871('0x1d')](_0x2ec833);fs[_0x8871('0x2d')](_0x479539,_0x8871('0x3f'));}catch(_0x3fedda){logger[_0x8871('0x16')](_0x3fedda);}logger[_0x8871('0x26')](_0x8871('0x42'),_0x479539[_0x8871('0x2e')]('.')[0x0]);return _0x479539[_0x8871('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x35281b,_0x720e0b){var _0x593fa7=_0x8871('0x43');var _0x356d65,_0x4eb0fe;var _0x1b14d3;var _0x3a276b={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x593fa7,'headers':{'Content-Type':_0x8871('0x44')},'body':_0x8871('0x45')+encodeURIComponent(JSON[_0x8871('0x46')]([[[_0x8871('0x47'),JSON['stringify']([_0x35281b,_0x720e0b||'en',![],_0x8871('0x48')]),null,_0x8871('0x49')]]]))};return rp(_0x3a276b)[_0x8871('0x2c')](function(_0x1f283c){try{_0x1b14d3=eval(_0x1f283c['slice'](0x5))[0x0][0x2];}catch(_0x470261){throw new Error(_0x8871('0x4a')+_0x1f283c[_0x8871('0x23')]);}if(!_0x1b14d3){if(_0x35281b[_0x8871('0x4b')]>0xc8){throw new Error(_0x8871('0x4c'));}else{throw new Error(_0x8871('0x4d')+_0x720e0b+_0x8871('0x4e'));}}try{_0x1b14d3=eval(_0x1b14d3)[0x0];}catch(_0x50b6bc){throw new Error(_0x8871('0x4a')+res['data']);}const _0x1b0b86=_0x1b14d3;_0x356d65=path['resolve'](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+_0x8871('0x3b'));fs[_0x8871('0x2a')](_0x356d65,_0x1b14d3,{'encoding':'base64'});_0x4eb0fe=path['resolve'](__dirname,_0x8871('0x3a'),rs[_0x8871('0x29')](0x4)+_0x8871('0x41'));return convertFile(_0x356d65,_0x4eb0fe);})[_0x8871('0x2c')](function(){try{fs['unlink'](_0x356d65);fs[_0x8871('0x2d')](_0x4eb0fe,_0x8871('0x3f'));}catch(_0x2f4393){logger['error'](_0x2f4393);}logger[_0x8871('0x26')](_0x8871('0x4f'),_0x4eb0fe['split']('.')[0x0]);return _0x4eb0fe[_0x8871('0x2e')]('.')[0x0];});};exports[_0x8871('0x50')]=function(_0x57fac8,_0x9301a7,_0x3bb2ba){return google[_0x8871('0x51')](_0x57fac8,_0x9301a7,_0x3bb2ba)[_0x8871('0x2c')](function(_0x4d8e08){logger[_0x8871('0x26')](_0x4d8e08[_0x8871('0x52')]);return rp(_0x4d8e08);})[_0x8871('0x2c')](function(_0x4274ec){var _0x21d8fd='';var _0x307b5c=0x0;try{fs[_0x8871('0x1d')](_0x57fac8);}catch(_0x1b7a0b){logger[_0x8871('0x16')](_0x1b7a0b);}if(_0x4274ec&&_0x4274ec['results']){_0x21d8fd=_0x4274ec[_0x8871('0x53')][_0x8871('0x54')](function(_0x6db02a){return _0x6db02a&&_0x6db02a['alternatives'][0x0]&&_0x6db02a['alternatives'][0x0][_0x8871('0x55')]?_0x6db02a[_0x8871('0x56')][0x0][_0x8871('0x55')]:'';})[_0x8871('0x57')]('\x0a');_0x307b5c=_0x4274ec[_0x8871('0x53')][_0x8871('0x54')](function(_0x4e8592){return _0x4e8592&&_0x4e8592[_0x8871('0x56')][0x0]&&_0x4e8592[_0x8871('0x56')][0x0]['confidence']?_0x4e8592[_0x8871('0x56')][0x0]['confidence']:0x0;})[_0x8871('0x57')]('\x0a');}logger[_0x8871('0x26')]('googleASR\x20transcription',_0x21d8fd);logger[_0x8871('0x26')](_0x8871('0x58'),_0x307b5c);return{'transcript':_0x21d8fd,'confidence':_0x307b5c};})['catch'](function(_0x5c4d29){logger['error'](_0x8871('0x59'),_0x5c4d29[_0x8871('0x15')],_0x5c4d29['name'],_0x5c4d29[_0x8871('0x5a')]);});};exports['googleDialogflow']=function(_0x179930,_0x8f350f,_0xf69d71,_0x56ae0d){var _0x21991c=apiai(_0x8f350f,{'language':_0x56ae0d||'en'});return _0x21991c[_0x8871('0x5b')](_0xf69d71,{'sessionId':md5(_0x179930)})['then'](function(_0x290e9f){logger[_0x8871('0x26')](JSON[_0x8871('0x46')](_0x290e9f));return{'source':_0x290e9f[_0x8871('0x5c')][_0x8871('0x5d')],'resolvedQuery':_0x290e9f[_0x8871('0x5c')][_0x8871('0x5e')],'action':_0x290e9f['result']['action'],'actionIncomplete':_0x290e9f['result']['actionIncomplete'],'speech':_0x290e9f[_0x8871('0x5c')][_0x8871('0x5f')][_0x8871('0x60')],'score':_0x290e9f[_0x8871('0x5c')][_0x8871('0x61')],'statusCode':_0x290e9f[_0x8871('0x62')][_0x8871('0x63')],'endConversation':_0x290e9f[_0x8871('0x5c')][_0x8871('0x64')][_0x8871('0x65')]||![],'isFallbackIntent':_0x290e9f[_0x8871('0x5c')]['metadata'][_0x8871('0x66')]};});};exports[_0x8871('0x67')]=function(_0x514553,_0x3a06ba,_0x95d53b,_0x300aef,_0x17052a,_0x583cf0){var _0x43f47=_0x300aef['replace'](/\\n/g,'\x0a');var _0x4b69e8={'credentials':{'private_key':_0x43f47,'client_email':_0x95d53b}};var _0x4cdd56=new dialogflow[(_0x8871('0x68'))](_0x4b69e8);var _0x3e6812=_0x4cdd56[_0x8871('0x69')](_0x3a06ba,md5(_0x514553));var _0x2ee965={'session':_0x3e6812,'queryInput':{'text':{'text':_0x17052a,'languageCode':_0x583cf0}}};return _0x4cdd56['detectIntent'](_0x2ee965)[_0x8871('0x2c')](function(_0x3d72c5){if(_0x3d72c5&&_0x3d72c5[_0x8871('0x4b')]){logger['info'](_0x8871('0x6a'),JSON['stringify'](_0x3d72c5));var _0xcd1057=_0x3d72c5[0x0];if(_0xcd1057){var _0x3a974e={'action':_0xcd1057[_0x8871('0x6b')][_0x8871('0x6c')],'allRequiredParamsPresent':_0xcd1057[_0x8871('0x6b')][_0x8871('0x6d')],'endConversation':_0xcd1057[_0x8871('0x6b')][_0x8871('0x6e')]&&_0xcd1057[_0x8871('0x6b')]['diagnosticInfo'][_0x8871('0x6f')]?_0xcd1057[_0x8871('0x6b')][_0x8871('0x6e')][_0x8871('0x6f')]['end_conversation'][_0x8871('0x70')]:![],'fulfillmentText':_0xcd1057[_0x8871('0x6b')]['fulfillmentText'],'intentName':_0xcd1057[_0x8871('0x6b')][_0x8871('0x71')]['name'],'intentDisplayName':_0xcd1057['queryResult'][_0x8871('0x71')]['displayName'],'isFallbackIntent':_0xcd1057[_0x8871('0x6b')][_0x8871('0x71')][_0x8871('0x72')],'languageCode':_0xcd1057[_0x8871('0x6b')]['languageCode'],'queryText':_0xcd1057[_0x8871('0x6b')]['queryText'],'responseId':_0xcd1057['responseId'],'score':_0xcd1057[_0x8871('0x6b')][_0x8871('0x73')],'speech':_0xcd1057['queryResult'][_0x8871('0x74')],'providerResponse':JSON[_0x8871('0x46')](_0x3d72c5)};return _0x3a974e;}}});};exports[_0x8871('0x75')]=function(_0x3e4638,_0x4adc97,_0x58371c,_0x45c0f2){return tilde[_0x8871('0x51')](_0x3e4638,_0x4adc97,_0x58371c,_0x45c0f2)['then'](function(_0x552973){try{fs[_0x8871('0x1d')](_0x3e4638);}catch(_0x5099d4){logger[_0x8871('0x16')](_0x5099d4);}logger['info'](_0x8871('0x76'),_0x552973[_0x8871('0x55')]);logger['info']('Tilde\x20ASR\x20confidence',_0x552973[_0x8871('0x77')]);return _0x552973;});};exports[_0x8871('0x78')]=function(_0x22d26b,_0x53faa7,_0x509243,_0x19fd47,_0x226245,_0x3d1148){var _0xceab1d=path[_0x8871('0x40')](__dirname,'tmp',rs['generate'](0x4)+_0x8871('0x3b'));var _0x4623bf;return aws[_0x8871('0x79')](_0x22d26b,_0x53faa7,_0x509243,_0x19fd47,_0x226245,_0x3d1148,_0xceab1d)[_0x8871('0x2c')](function(){_0x4623bf=path[_0x8871('0x40')](__dirname,_0x8871('0x3a'),rs['generate'](0x4)+_0x8871('0x41'));return convertFile(_0xceab1d,_0x4623bf);})[_0x8871('0x2c')](function(){try{fs[_0x8871('0x1d')](_0xceab1d);fs[_0x8871('0x2d')](_0x4623bf,_0x8871('0x3f'));}catch(_0x496551){logger[_0x8871('0x16')](_0x496551);}return _0x4623bf[_0x8871('0x2e')]('.')[0x0];});};exports[_0x8871('0x7a')]=function(_0x2120fd,_0x55d705,_0x3f3ace,_0x3dcd61,_0x33e31c,_0x2384c2){return aws['lex'](_0x2120fd,_0x55d705,_0x3f3ace,_0x3dcd61,_0x33e31c,_0x2384c2)[_0x8871('0x2c')](function(_0x586906){logger[_0x8871('0x26')](JSON['stringify'](_0x586906));return _0x586906;});};exports['ispeechTTS']=function(_0x369378,_0x495d46,_0x1ae612,_0x58ffdf){var _0x402378=util['format'](_0x8871('0x7b'),ISPEECH_API,_0x369378,encodeURIComponent(_0x495d46),_0x1ae612,_0x58ffdf);var _0x44643d=path[_0x8871('0x40')](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+'.mp3');var _0x2a863a;return downloadFile(_0x402378,_0x44643d)['then'](function(){_0x2a863a=path[_0x8871('0x40')](__dirname,'tmp',rs[_0x8871('0x29')](0x4)+_0x8871('0x41'));return convertFile(_0x44643d,_0x2a863a);})['then'](function(){try{fs[_0x8871('0x1d')](_0x44643d);fs[_0x8871('0x2d')](_0x2a863a,_0x8871('0x3f'));}catch(_0x29adfa){logger['error'](_0x29adfa);}return _0x2a863a[_0x8871('0x2e')]('.')[0x0];});};exports[_0x8871('0x7c')]=function(_0x3aa22d,_0x4dbcf1,_0x384b69,_0x5812bc){var _0x550a08=util[_0x8871('0x7d')](_0x8871('0x7e'),ISPEECH_API,_0x4dbcf1,_0x384b69,base64Encode(_0x3aa22d),_0x5812bc?util['format'](_0x8871('0x7f'),encodeURIComponent(_0x5812bc)):_0x8871('0x80'));return uploadFile(_0x550a08)[_0x8871('0x2c')](function(_0xb808a4){return querystring['parse'](_0xb808a4);});};exports['sestekNDA']=function(_0x3fbf9d,_0x5c65e0){return sestek[_0x8871('0x81')](_0x3fbf9d,_0x5c65e0)['then'](function(_0x22384c){logger[_0x8871('0x26')](JSON[_0x8871('0x46')](_0x22384c));var _0x28380d={'speech':_0x22384c[_0x8871('0x82')],'action':_0x22384c[_0x8871('0x83')]?_0x22384c[_0x8871('0x83')][_0x8871('0x84')]:undefined,'actiondata':_0x22384c[_0x8871('0x83')]?_0x22384c[_0x8871('0x83')][_0x8871('0x85')]:undefined};if(_0x22384c['channelData']&&_0x22384c['channelData'][_0x8871('0x86')]){return base64Decode(_0x22384c[_0x8871('0x83')][_0x8871('0x86')][_0x8871('0x87')],path[_0x8871('0x40')](__dirname,_0x8871('0x3a'),rs['generate'](0x4)+_0x8871('0x41')))['then'](function(_0x491946){_0x28380d['audiofile']=_0x491946;return _0x28380d;});}return _0x28380d;});};exports[_0x8871('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0xd83a=['transcode','error\x20convert','finish\x20to\x20convert','.wav','writeFileSync','base64','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','chmodSync','resolve','tmp','generate','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','info','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','end','https:','get'];(function(_0x230a47,_0xa8a5e0){var _0x505fdd=function(_0x552c12){while(--_0x552c12){_0x230a47['push'](_0x230a47['shift']());}};_0x505fdd(++_0xa8a5e0);}(_0xd83a,0x6b));var _0xad83=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd83a[_0x14add3];return _0x4a174f;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xad83('0x0'));var dialogflow=require(_0xad83('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xad83('0x2'));var md5=require('md5');var path=require(_0xad83('0x3'));var querystring=require(_0xad83('0x4'));var rp=require(_0xad83('0x5'));var rs=require(_0xad83('0x6'));var sox=require(_0xad83('0x7'));var tts=require(_0xad83('0x8'));var urlParse=require(_0xad83('0x9'))[_0xad83('0xa')];var util=require(_0xad83('0xb'));var aws=require('./aws');var google=require('./google');var sestek=require(_0xad83('0xc'));var tilde=require(_0xad83('0xd'));var logger=require(_0xad83('0xe'))(_0xad83('0xf'));var ISPEECH_API=_0xad83('0x10');function downloadFile(_0x160dc2,_0x2cce07){return new BPromise(function(_0x28013c,_0x594858){var _0x592e7d=urlParse(_0x160dc2);var _0x1931a4=_0x592e7d[_0xad83('0x11')]==='https:'?https:http;var _0x4ae83a={'host':_0x592e7d[_0xad83('0x12')],'path':_0x592e7d[_0xad83('0x3')],'headers':{'user-agent':_0xad83('0x13')}};_0x1931a4['get'](_0x4ae83a,function(_0x55c4ee){if(_0x55c4ee[_0xad83('0x14')]!==0xc8){logger[_0xad83('0x15')](_0xad83('0x16')+_0x160dc2+_0xad83('0x17')+_0x55c4ee[_0xad83('0x14')]+'\x20('+_0x55c4ee[_0xad83('0x18')]+')');_0x594858(new Error('request\x20to\x20'+_0x160dc2+_0xad83('0x17')+_0x55c4ee['statusCode']+'\x20('+_0x55c4ee[_0xad83('0x18')]+')'));return;}var _0x17a0c0=fs[_0xad83('0x19')](_0x2cce07);_0x17a0c0['on'](_0xad83('0x1a'),function(){logger['info'](_0xad83('0x1b'));_0x17a0c0[_0xad83('0x1c')](_0x28013c);});_0x17a0c0['on']('error',function(_0x180200){fs[_0xad83('0x1d')](_0x2cce07);logger['error'](_0xad83('0x1e'),_0x180200);_0x594858(_0x180200);});_0x55c4ee['pipe'](_0x17a0c0);})['on']('error',function(_0xd05085){logger['error'](_0xd05085);_0x594858(_0xd05085);})[_0xad83('0x1f')]();});}function uploadFile(_0x303cf9){return new BPromise(function(_0x50c39f,_0x28d835){var _0x1c4f46=urlParse(_0x303cf9);var _0x2a5750=_0x1c4f46[_0xad83('0x11')]===_0xad83('0x20')?https:http;var _0x2969e7={'host':_0x1c4f46['host'],'path':_0x1c4f46[_0xad83('0x3')],'headers':{'user-agent':_0xad83('0x13')}};_0x2a5750[_0xad83('0x21')](_0x2969e7,function(_0x207a29){if(_0x207a29[_0xad83('0x14')]!==0xc8){_0x28d835(new Error(_0xad83('0x16')+_0x303cf9+_0xad83('0x17')+_0x207a29[_0xad83('0x14')]+'\x20('+_0x207a29[_0xad83('0x18')]+')'));return;}var _0x341c0b='';_0x207a29['on']('data',function(_0x325c47){_0x341c0b+=_0x325c47;});_0x207a29['on'](_0xad83('0x1f'),function(){_0x50c39f(_0x341c0b);});})['on']('error',function(_0x364e86){_0x28d835(_0x364e86);})[_0xad83('0x1f')]();});}function convertFile(_0xde01f,_0x2e1d24){return new BPromise(function(_0x17c6da,_0x4bd51){var _0xfa809a=sox[_0xad83('0x22')](_0xde01f,_0x2e1d24,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xfa809a['on'](_0xad83('0x15'),function(_0xf446fe){logger['error'](_0xad83('0x23'),_0xf446fe);_0x4bd51(_0xf446fe);});_0xfa809a['on']('end',function(){logger['info'](_0xad83('0x24'));_0x17c6da();});_0xfa809a['start']();});}function base64Decode(_0x289465,_0x309987){var _0x2fb9a8=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xad83('0x25'));fs[_0xad83('0x26')](_0x2fb9a8,_0x289465,_0xad83('0x27'));return convertFile(_0x2fb9a8,_0x309987)['then'](function(){try{fs[_0xad83('0x1d')](_0x2fb9a8);fs['chmodSync'](_0x309987,_0xad83('0x28'));}catch(_0x3cb71c){logger[_0xad83('0x15')](_0x3cb71c);}return _0x309987[_0xad83('0x29')]('.')[0x0];});}function base64Encode(_0x8847cf){var _0x483f75=fs['readFileSync'](_0x8847cf);return new Buffer(_0x483f75)[_0xad83('0x2a')](_0xad83('0x27'));}exports[_0xad83('0x2b')]=function(_0x28a1b3,_0x1be657,_0x5b53c2,_0x8b497c,_0x4190c4,_0x362971){var _0x1af4ec,_0x508e7d;var _0x1dafa2=_0xad83('0x2c');var _0x588678=_0xad83('0x2d')+_0x28a1b3;var _0x279326={};if(_0x1be657==='ssml'){_0x279326['input']={'ssml':_0x5b53c2};}else{_0x279326[_0xad83('0x2e')]={'text':_0x5b53c2};};_0x279326[_0xad83('0x2f')]={'languageCode':_0x8b497c,'ssmlGender':_0x4190c4};_0x279326['audioConfig']={'audioEncoding':_0xad83('0x30'),'sampleRateHertz':0x1f40};var _0x3e0a92={'url':_0x1dafa2+_0xad83('0x31')+_0x588678,'method':_0xad83('0x32'),'json':!![],'body':_0x279326};return rp(_0x3e0a92)[_0xad83('0x33')](function(_0x7cf7dd){return new BPromise(function(_0x15a1e2,_0x5383fd){_0x1af4ec=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xad83('0x34'));var _0x37ae23=Buffer[_0xad83('0x35')](_0x7cf7dd[_0xad83('0x36')],_0xad83('0x27'));return fs[_0xad83('0x37')](_0x1af4ec,_0x37ae23,function(_0x50a02d){_0x5383fd(_0x50a02d);},function(_0x3cc5da){fs[_0xad83('0x38')](_0x1af4ec,_0xad83('0x28'));_0x15a1e2(_0x3cc5da);});});})[_0xad83('0x33')](function(_0x33e730){_0x508e7d=path[_0xad83('0x39')](__dirname,_0xad83('0x3a'),rs[_0xad83('0x3b')](0x4)+_0xad83('0x25'));return convertFile(_0x1af4ec,_0x508e7d);})['then'](function(){try{fs[_0xad83('0x1d')](_0x1af4ec);fs[_0xad83('0x38')](_0x508e7d,_0xad83('0x28'));}catch(_0x52ec03){logger[_0xad83('0x15')](_0x52ec03);}logger['info'](_0xad83('0x3c'),_0x508e7d[_0xad83('0x29')]('.')[0x0]);return _0x508e7d[_0xad83('0x29')]('.')[0x0];});};exports[_0xad83('0x3d')]=function(_0x5eb600,_0xe3dec6){var _0x54c6d2=_0xad83('0x3e');var _0x3f88fe,_0x460ec9;var _0x4b29b5;var _0x217a19={'encoding':_0xad83('0x3f'),'method':_0xad83('0x32'),'timeout':0x2710,'url':_0x54c6d2,'headers':{'Content-Type':_0xad83('0x40')},'body':_0xad83('0x41')+encodeURIComponent(JSON[_0xad83('0x42')]([[[_0xad83('0x43'),JSON[_0xad83('0x42')]([_0x5eb600,_0xe3dec6||'en',![],_0xad83('0x44')]),null,'generic']]]))};return rp(_0x217a19)[_0xad83('0x33')](function(_0x4e175b){try{_0x4b29b5=eval(_0x4e175b[_0xad83('0x45')](0x5))[0x0][0x2];}catch(_0x4d8f50){throw new Error(_0xad83('0x46')+_0x4e175b['data']);}if(!_0x4b29b5){if(_0x5eb600[_0xad83('0x47')]>0xc8){throw new Error(_0xad83('0x48'));}else{throw new Error(_0xad83('0x49')+_0xe3dec6+_0xad83('0x4a'));}}try{_0x4b29b5=eval(_0x4b29b5)[0x0];}catch(_0x2c4f0b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xad83('0x4b')]);}const _0x1ead35=_0x4b29b5;_0x3f88fe=path[_0xad83('0x39')](__dirname,_0xad83('0x3a'),rs[_0xad83('0x3b')](0x4)+_0xad83('0x34'));fs[_0xad83('0x26')](_0x3f88fe,_0x4b29b5,{'encoding':_0xad83('0x27')});_0x460ec9=path[_0xad83('0x39')](__dirname,_0xad83('0x3a'),rs[_0xad83('0x3b')](0x4)+'.wav');return convertFile(_0x3f88fe,_0x460ec9);})[_0xad83('0x33')](function(){try{fs[_0xad83('0x1d')](_0x3f88fe);fs[_0xad83('0x38')](_0x460ec9,_0xad83('0x28'));}catch(_0x41d61c){logger['error'](_0x41d61c);}logger[_0xad83('0x4c')](_0xad83('0x4d'),_0x460ec9[_0xad83('0x29')]('.')[0x0]);return _0x460ec9[_0xad83('0x29')]('.')[0x0];});};exports['googleASR']=function(_0x37ed02,_0x2eae24,_0x404d83){return google[_0xad83('0x4e')](_0x37ed02,_0x2eae24,_0x404d83)[_0xad83('0x33')](function(_0x4af6ba){logger[_0xad83('0x4c')](_0x4af6ba[_0xad83('0x4f')]);return rp(_0x4af6ba);})[_0xad83('0x33')](function(_0x12f69f){var _0x37a417='';var _0x555f56=0x0;try{fs[_0xad83('0x1d')](_0x37ed02);}catch(_0x17e2f5){logger['error'](_0x17e2f5);}if(_0x12f69f&&_0x12f69f[_0xad83('0x50')]){_0x37a417=_0x12f69f['results']['map'](function(_0x432876){return _0x432876&&_0x432876[_0xad83('0x51')][0x0]&&_0x432876[_0xad83('0x51')][0x0]['transcript']?_0x432876[_0xad83('0x51')][0x0][_0xad83('0x52')]:'';})[_0xad83('0x53')]('\x0a');_0x555f56=_0x12f69f['results'][_0xad83('0x54')](function(_0x1741ac){return _0x1741ac&&_0x1741ac[_0xad83('0x51')][0x0]&&_0x1741ac[_0xad83('0x51')][0x0][_0xad83('0x55')]?_0x1741ac['alternatives'][0x0][_0xad83('0x55')]:0x0;})['join']('\x0a');}logger[_0xad83('0x4c')]('googleASR\x20transcription',_0x37a417);logger[_0xad83('0x4c')](_0xad83('0x56'),_0x555f56);return{'transcript':_0x37a417,'confidence':_0x555f56};})[_0xad83('0x57')](function(_0x5a1ac8){logger[_0xad83('0x15')](_0xad83('0x58'),_0x5a1ac8[_0xad83('0x14')],_0x5a1ac8[_0xad83('0x59')],_0x5a1ac8['message']);});};exports[_0xad83('0x5a')]=function(_0x36defa,_0xc3fa5e,_0x4b01a2,_0x4b5f12){var _0x12fec5=apiai(_0xc3fa5e,{'language':_0x4b5f12||'en'});return _0x12fec5[_0xad83('0x5b')](_0x4b01a2,{'sessionId':md5(_0x36defa)})['then'](function(_0x618c33){logger[_0xad83('0x4c')](JSON[_0xad83('0x42')](_0x618c33));return{'source':_0x618c33[_0xad83('0x5c')][_0xad83('0x5d')],'resolvedQuery':_0x618c33[_0xad83('0x5c')][_0xad83('0x5e')],'action':_0x618c33[_0xad83('0x5c')][_0xad83('0x5f')],'actionIncomplete':_0x618c33[_0xad83('0x5c')][_0xad83('0x60')],'speech':_0x618c33[_0xad83('0x5c')][_0xad83('0x61')][_0xad83('0x62')],'score':_0x618c33[_0xad83('0x5c')][_0xad83('0x63')],'statusCode':_0x618c33[_0xad83('0x64')][_0xad83('0x65')],'endConversation':_0x618c33['result'][_0xad83('0x66')][_0xad83('0x67')]||![],'isFallbackIntent':_0x618c33[_0xad83('0x5c')][_0xad83('0x66')][_0xad83('0x68')]};});};exports['googleDialogflowV2']=function(_0x45bd30,_0x170ed4,_0x1cf50a,_0x48775e,_0x1c760c,_0x1dd3ab){var _0x243618=_0x48775e[_0xad83('0x69')](/\\n/g,'\x0a');var _0x5a4eab={'credentials':{'private_key':_0x243618,'client_email':_0x1cf50a}};var _0x474d1a=new dialogflow[(_0xad83('0x6a'))](_0x5a4eab);var _0x3ad372=_0x474d1a['sessionPath'](_0x170ed4,md5(_0x45bd30));var _0x4bed2a={'session':_0x3ad372,'queryInput':{'text':{'text':_0x1c760c,'languageCode':_0x1dd3ab}}};return _0x474d1a[_0xad83('0x6b')](_0x4bed2a)[_0xad83('0x33')](function(_0x37a463){if(_0x37a463&&_0x37a463['length']){logger[_0xad83('0x4c')](_0xad83('0x6c'),JSON[_0xad83('0x42')](_0x37a463));var _0x1ddace=_0x37a463[0x0];if(_0x1ddace){var _0x484fe1={'action':_0x1ddace[_0xad83('0x6d')][_0xad83('0x5f')],'allRequiredParamsPresent':_0x1ddace[_0xad83('0x6d')]['allRequiredParamsPresent'],'endConversation':_0x1ddace['queryResult'][_0xad83('0x6e')]&&_0x1ddace['queryResult'][_0xad83('0x6e')]['fields']?_0x1ddace[_0xad83('0x6d')][_0xad83('0x6e')][_0xad83('0x6f')][_0xad83('0x70')][_0xad83('0x71')]:![],'fulfillmentText':_0x1ddace[_0xad83('0x6d')][_0xad83('0x72')],'intentName':_0x1ddace[_0xad83('0x6d')][_0xad83('0x73')][_0xad83('0x59')],'intentDisplayName':_0x1ddace[_0xad83('0x6d')][_0xad83('0x73')]['displayName'],'isFallbackIntent':_0x1ddace[_0xad83('0x6d')][_0xad83('0x73')][_0xad83('0x74')],'languageCode':_0x1ddace[_0xad83('0x6d')]['languageCode'],'queryText':_0x1ddace[_0xad83('0x6d')][_0xad83('0x75')],'responseId':_0x1ddace[_0xad83('0x76')],'score':_0x1ddace[_0xad83('0x6d')][_0xad83('0x77')],'speech':_0x1ddace[_0xad83('0x6d')][_0xad83('0x72')],'providerResponse':JSON[_0xad83('0x42')](_0x37a463)};return _0x484fe1;}}});};exports[_0xad83('0x78')]=function(_0x532bca,_0x2a7fc7,_0x5b403c,_0x289cda){return tilde['asr'](_0x532bca,_0x2a7fc7,_0x5b403c,_0x289cda)[_0xad83('0x33')](function(_0x1f3658){try{fs[_0xad83('0x1d')](_0x532bca);}catch(_0x3274c9){logger['error'](_0x3274c9);}logger[_0xad83('0x4c')](_0xad83('0x79'),_0x1f3658[_0xad83('0x52')]);logger[_0xad83('0x4c')](_0xad83('0x7a'),_0x1f3658[_0xad83('0x55')]);return _0x1f3658;});};exports[_0xad83('0x7b')]=function(_0x109d41,_0x2ebd09,_0x36966f,_0x28f76e,_0x3190a4,_0x1e40fa){var _0x365903=path['resolve'](__dirname,_0xad83('0x3a'),rs[_0xad83('0x3b')](0x4)+'.mp3');var _0x5285d9;return aws[_0xad83('0x7c')](_0x109d41,_0x2ebd09,_0x36966f,_0x28f76e,_0x3190a4,_0x1e40fa,_0x365903)[_0xad83('0x33')](function(){_0x5285d9=path[_0xad83('0x39')](__dirname,'tmp',rs[_0xad83('0x3b')](0x4)+_0xad83('0x25'));return convertFile(_0x365903,_0x5285d9);})['then'](function(){try{fs[_0xad83('0x1d')](_0x365903);fs[_0xad83('0x38')](_0x5285d9,_0xad83('0x28'));}catch(_0x2e2f0d){logger[_0xad83('0x15')](_0x2e2f0d);}return _0x5285d9['split']('.')[0x0];});};exports[_0xad83('0x7d')]=function(_0x3a97f4,_0x1c57e8,_0x405ab7,_0x591fb0,_0x51a83c,_0x5aadfb){return aws[_0xad83('0x7e')](_0x3a97f4,_0x1c57e8,_0x405ab7,_0x591fb0,_0x51a83c,_0x5aadfb)['then'](function(_0x2aed0c){logger['info'](JSON[_0xad83('0x42')](_0x2aed0c));return _0x2aed0c;});};exports[_0xad83('0x7f')]=function(_0x5a7132,_0x4bf119,_0x55c4d3,_0x1ad26a){var _0x3040ba=util[_0xad83('0x80')](_0xad83('0x81'),ISPEECH_API,_0x5a7132,encodeURIComponent(_0x4bf119),_0x55c4d3,_0x1ad26a);var _0x473ca8=path[_0xad83('0x39')](__dirname,_0xad83('0x3a'),rs[_0xad83('0x3b')](0x4)+_0xad83('0x34'));var _0x35bb97;return downloadFile(_0x3040ba,_0x473ca8)[_0xad83('0x33')](function(){_0x35bb97=path[_0xad83('0x39')](__dirname,'tmp',rs[_0xad83('0x3b')](0x4)+_0xad83('0x25'));return convertFile(_0x473ca8,_0x35bb97);})[_0xad83('0x33')](function(){try{fs[_0xad83('0x1d')](_0x473ca8);fs[_0xad83('0x38')](_0x35bb97,_0xad83('0x28'));}catch(_0x567fc4){logger[_0xad83('0x15')](_0x567fc4);}return _0x35bb97[_0xad83('0x29')]('.')[0x0];});};exports[_0xad83('0x82')]=function(_0xbb9a46,_0x44a906,_0x5f4095,_0x68d38d){var _0x28c512=util[_0xad83('0x80')](_0xad83('0x83'),ISPEECH_API,_0x44a906,_0x5f4095,base64Encode(_0xbb9a46),_0x68d38d?util[_0xad83('0x80')]('model=%s',encodeURIComponent(_0x68d38d)):_0xad83('0x84'));return uploadFile(_0x28c512)[_0xad83('0x33')](function(_0x4b05df){return querystring[_0xad83('0xa')](_0x4b05df);});};exports[_0xad83('0x85')]=function(_0x2d710e,_0x238747){return sestek[_0xad83('0x86')](_0x2d710e,_0x238747)[_0xad83('0x33')](function(_0x2bf074){logger[_0xad83('0x4c')](JSON[_0xad83('0x42')](_0x2bf074));var _0x4f01c8={'speech':_0x2bf074[_0xad83('0x87')],'action':_0x2bf074[_0xad83('0x88')]?_0x2bf074[_0xad83('0x88')][_0xad83('0x89')]:undefined,'actiondata':_0x2bf074['channelData']?_0x2bf074[_0xad83('0x88')][_0xad83('0x8a')]:undefined};if(_0x2bf074['channelData']&&_0x2bf074['channelData']['AudioFromTts']){return base64Decode(_0x2bf074['channelData'][_0xad83('0x8b')]['Data'],path[_0xad83('0x39')](__dirname,'tmp',rs[_0xad83('0x3b')](0x4)+_0xad83('0x25')))[_0xad83('0x33')](function(_0x4adc26){_0x4f01c8['audiofile']=_0x4adc26;return _0x4f01c8;});}return _0x4f01c8;});};exports[_0xad83('0x8c')]=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 787b2a2..49af2b1 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 _0x94c3=['exports','./nda'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x94c3,0xad));var _0x394c=function(_0xf81792,_0x3b5a65){_0xf81792=_0xf81792-0x0;var _0x34aaad=_0x94c3[_0xf81792];return _0x34aaad;};var nda=require(_0x394c('0x0'));module[_0x394c('0x1')]={'nda':nda}; \ No newline at end of file +var _0xd9a5=['./nda','exports'];(function(_0x8db694,_0x19fefe){var _0x3c4564=function(_0xcb63d9){while(--_0xcb63d9){_0x8db694['push'](_0x8db694['shift']());}};_0x3c4564(++_0x19fefe);}(_0xd9a5,0x144));var _0x5d9a=function(_0x918e69,_0x1121cd){_0x918e69=_0x918e69-0x0;var _0x5002e9=_0xd9a5[_0x918e69];return _0x5002e9;};var nda=require(_0x5d9a('0x0'));module[_0x5d9a('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 c88dc4b..f6f2979 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 _0xc94f=['channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','extension','text','project','body'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0xc94f,0xcd));var _0xfc94=function(_0x28afbe,_0x4d655b){_0x28afbe=_0x28afbe-0x0;var _0x16a494=_0xc94f[_0x28afbe];return _0x16a494;};'use strict';var rp=require(_0xfc94('0x0'));var url=require('url');var logger=require(_0xfc94('0x1'))(_0xfc94('0x2'));module['exports']=function(_0x203041,_0x4b0493){var _0xfc710d={'method':_0xfc94('0x3'),'uri':url[_0xfc94('0x4')](_0x4b0493[_0xfc94('0x5')],'/token'),'form':{'grant_type':'password','username':_0x4b0493['username'],'password':_0x4b0493[_0xfc94('0x6')]},'json':!![]};return rp(_0xfc710d)[_0xfc94('0x7')](function(_0x4dc395){var _0xe044e8={'method':'POST','uri':url[_0xfc94('0x4')](_0x4b0493[_0xfc94('0x8')],_0xfc94('0x9')),'body':{'type':_0x4b0493[_0xfc94('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x203041[_0xfc94('0xb')]},'from':{'id':_0x203041[_0xfc94('0xc')],'name':_0x203041[_0xfc94('0xd')]},'recipient':{'id':_0x203041[_0xfc94('0xe')],'name':_0x203041[_0xfc94('0xf')]},'text':_0x4b0493[_0xfc94('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4dc395['access_token']},'json':!![]};if(_0x4b0493[_0xfc94('0x11')]){_0xe044e8[_0xfc94('0x12')][_0xfc94('0x13')][_0xfc94('0x14')]=_0x4b0493['project'];}if(_0x4b0493[_0xfc94('0x15')]=='1'){_0xe044e8[_0xfc94('0x12')][_0xfc94('0x13')][_0xfc94('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfc94('0x17')};}if(_0x4b0493['custom_action']){_0xe044e8[_0xfc94('0x12')]['channelData'][_0xfc94('0x18')]=_0x4b0493['custom_action'];if(_0x4b0493[_0xfc94('0x19')]){_0xe044e8[_0xfc94('0x12')][_0xfc94('0x13')]['CustomActionData']=_0x4b0493[_0xfc94('0x19')];}}logger[_0xfc94('0x1a')](JSON[_0xfc94('0x1b')](_0xe044e8));return rp(_0xe044e8);});}; \ No newline at end of file +var _0x5668=['project','body','channelData','ProjectName','custom_action','CustomAction','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','calleridname','dnid'];(function(_0x594a1c,_0x41c755){var _0x233378=function(_0x173a91){while(--_0x173a91){_0x594a1c['push'](_0x594a1c['shift']());}};_0x233378(++_0x41c755);}(_0x5668,0x8b));var _0x8566=function(_0x439ab3,_0x276d5b){_0x439ab3=_0x439ab3-0x0;var _0x439285=_0x5668[_0x439ab3];return _0x439285;};'use strict';var rp=require(_0x8566('0x0'));var url=require(_0x8566('0x1'));var logger=require(_0x8566('0x2'))(_0x8566('0x3'));module[_0x8566('0x4')]=function(_0x3b3cf3,_0x3c842a){var _0x198ca6={'method':_0x8566('0x5'),'uri':url[_0x8566('0x6')](_0x3c842a[_0x8566('0x7')],_0x8566('0x8')),'form':{'grant_type':_0x8566('0x9'),'username':_0x3c842a['username'],'password':_0x3c842a[_0x8566('0x9')]},'json':!![]};return rp(_0x198ca6)[_0x8566('0xa')](function(_0x49f55a){var _0x4aaf3f={'method':_0x8566('0x5'),'uri':url['resolve'](_0x3c842a['ndassistant_url'],_0x8566('0xb')),'body':{'type':_0x3c842a['ndaactivity_type']||_0x8566('0xc'),'channelId':_0x8566('0xd'),'conversation':{'id':_0x3b3cf3[_0x8566('0xe')]},'from':{'id':_0x3b3cf3['callerid'],'name':_0x3b3cf3[_0x8566('0xf')]},'recipient':{'id':_0x3b3cf3[_0x8566('0x10')],'name':_0x3b3cf3['extension']},'text':_0x3c842a['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x49f55a['access_token']},'json':!![]};if(_0x3c842a[_0x8566('0x11')]){_0x4aaf3f[_0x8566('0x12')][_0x8566('0x13')][_0x8566('0x14')]=_0x3c842a[_0x8566('0x11')];}if(_0x3c842a['ndagenerate_audio']=='1'){_0x4aaf3f['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3c842a[_0x8566('0x15')]){_0x4aaf3f[_0x8566('0x12')][_0x8566('0x13')][_0x8566('0x16')]=_0x3c842a[_0x8566('0x15')];if(_0x3c842a['custom_action_data']){_0x4aaf3f[_0x8566('0x12')][_0x8566('0x13')][_0x8566('0x17')]=_0x3c842a['custom_action_data'];}}logger[_0x8566('0x18')](JSON[_0x8566('0x19')](_0x4aaf3f));return rp(_0x4aaf3f);});}; \ 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 2533f0a..e54a039 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 _0x0b42=['./lib/api'];(function(_0x1ef2ba,_0x7ae746){var _0x2c08cf=function(_0x1a286e){while(--_0x1a286e){_0x1ef2ba['push'](_0x1ef2ba['shift']());}};_0x2c08cf(++_0x7ae746);}(_0x0b42,0x10f));var _0x20b4=function(_0x19b092,_0x496ca5){_0x19b092=_0x19b092-0x0;var _0xf5fa43=_0x0b42[_0x19b092];return _0xf5fa43;};'use strict';var asr=require(_0x20b4('0x0'));module['exports']=function(_0xfbb313,_0x53c5ea,_0x48963c,_0x57eaf1){return asr(_0xfbb313,_0x53c5ea,_0x48963c,_0x57eaf1);}; \ No newline at end of file +var _0x882e=['exports','./lib/api'];(function(_0x3020db,_0x349ebc){var _0x41abf9=function(_0x3ecb78){while(--_0x3ecb78){_0x3020db['push'](_0x3020db['shift']());}};_0x41abf9(++_0x349ebc);}(_0x882e,0x189));var _0xe882=function(_0x55951d,_0x54e104){_0x55951d=_0x55951d-0x0;var _0x3213cb=_0x882e[_0x55951d];return _0x3213cb;};'use strict';var asr=require(_0xe882('0x0'));module[_0xe882('0x1')]=function(_0xe935d9,_0x3e90b8,_0x4380e8,_0x40d6e4){return asr(_0xe935d9,_0x3e90b8,_0x4380e8,_0x40d6e4);}; \ 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 3d0b1d9..bb27ff8 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 _0x5a3e=['close','error','stringify','terminate','parse','status','result','final','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','createReadStream','send'];(function(_0x12549d,_0x153ef9){var _0x4a11e6=function(_0x3ef18b){while(--_0x3ef18b){_0x12549d['push'](_0x12549d['shift']());}};_0x4a11e6(++_0x153ef9);}(_0x5a3e,0x1a6));var _0xe5a3=function(_0x3ea06e,_0x43e53c){_0x3ea06e=_0x3ea06e-0x0;var _0x44bc81=_0x5a3e[_0x3ea06e];return _0x44bc81;};'use strict';var BPromise=require(_0xe5a3('0x0'));var _=require(_0xe5a3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe5a3('0x2'));var crypto=require(_0xe5a3('0x3'));var logger=require('../../../../../../config/logger')(_0xe5a3('0x4'));module[_0xe5a3('0x5')]=function(_0x45edf3,_0x41ecaf,_0x183205,_0x21abb7){return new BPromise(function(_0x5ce9a0,_0x2e1f17){logger[_0xe5a3('0x6')](_0xe5a3('0x7'),_0x21abb7||_0xe5a3('0x8'));var _0x458b60=new WebSocket(_0x21abb7||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5bd7b9='';var _0x5cf442='0';var _0x5297d2='1';var _0x1a2479=_0xe5a3('0x9');function _0x29def7(_0x17c00b){var _0x3f2567=crypto[_0xe5a3('0xa')](_0xe5a3('0xb'));_0x3f2567[_0xe5a3('0xc')](_0x17c00b);return _0x3f2567[_0xe5a3('0xd')](_0xe5a3('0xe'));}function _0x1b62cc(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xb0b10a=moment()[_0xe5a3('0xf')]();var _0x9b1e6b=_0x29def7(_0xb0b10a+_0x41ecaf+_0x183205);_0x458b60['send'](JSON['stringify']({'appID':_0x41ecaf,'timestamp':_0xb0b10a,'appKey':_0x9b1e6b}));var _0x37567e=fs[_0xe5a3('0x10')](_0x45edf3);_0x37567e['on']('data',function(_0x48f788){_0x458b60[_0xe5a3('0x11')](_0x48f788);});_0x37567e['on'](_0xe5a3('0x12'),function(){_0x458b60[_0xe5a3('0x11')]('EOS');});}catch(_0x2aa8e4){logger[_0xe5a3('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xe5a3('0x14')](_0x2aa8e4));_0x458b60[_0xe5a3('0x15')]();}}function _0x50df65(_0x4b9fae){try{if(_0x4b9fae){var _0x3d2b99=JSON[_0xe5a3('0x16')](_0x4b9fae);switch(_0x3d2b99[_0xe5a3('0x17')]){case 0x0:if(_0x3d2b99[_0xe5a3('0x18')]){if(_0x3d2b99[_0xe5a3('0x18')][_0xe5a3('0x19')]){logger[_0xe5a3('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe5a3('0x14')](_0x3d2b99[_0xe5a3('0x18')]['hypotheses']));_0x5bd7b9=_0x3d2b99['result']['hypotheses'][0x0][_0xe5a3('0x1a')];_0x5cf442=_0x3d2b99['result']['hypotheses'][0x0][_0xe5a3('0x1b')];_0x5297d2='0';_0x1a2479=_0xe5a3('0x1c');_0x458b60[_0xe5a3('0x15')]();}}break;case 0x1:logger[_0xe5a3('0x6')](_0xe5a3('0x9'));_0x5297d2='1';_0x1a2479=_0xe5a3('0x9');break;case 0x2:logger[_0xe5a3('0x6')](_0xe5a3('0x1d'));_0x5297d2='2';_0x1a2479=_0xe5a3('0x1d');break;case 0x9:logger[_0xe5a3('0x6')](_0xe5a3('0x1e'));_0x5297d2='9';_0x1a2479='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xe5a3('0x6')](_0xe5a3('0x1f'));_0x5297d2='10';_0x1a2479='Authentication\x20failed.';break;case 0xb:logger[_0xe5a3('0x6')](_0xe5a3('0x20'));_0x5297d2='11';_0x1a2479='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a6434){logger['error'](_0xe5a3('0x21'),JSON[_0xe5a3('0x14')](_0x4a6434));_0x458b60['terminate']();}}function _0x361f84(){logger[_0xe5a3('0x6')](_0xe5a3('0x22'));_0x5ce9a0({'transcript':_0x5bd7b9,'confidence':_0x5cf442,'status':_0x5297d2,'status_message':_0x1a2479});}function _0x1df174(_0x41249a){logger[_0xe5a3('0x13')](_0xe5a3('0x23'));if(!_[_0xe5a3('0x24')](_0x41249a)){logger[_0xe5a3('0x13')](_[_0xe5a3('0x25')](_0x41249a)?JSON[_0xe5a3('0x14')](_0x41249a):_0x41249a);}}_0x458b60['on'](_0xe5a3('0x26'),_0x1b62cc);_0x458b60['on'](_0xe5a3('0x27'),_0x50df65);_0x458b60['on'](_0xe5a3('0x12'),_0x361f84);_0x458b60['on'](_0xe5a3('0x13'),_0x1df174);});}; \ No newline at end of file +var _0x7860=['isNil','open','message','lodash','moment','crypto','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7860,0xb7));var _0x0786=function(_0x1b0293,_0x585d4b){_0x1b0293=_0x1b0293-0x0;var _0x25b73a=_0x7860[_0x1b0293];return _0x25b73a;};'use strict';var BPromise=require('bluebird');var _=require(_0x0786('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0786('0x1'));var crypto=require(_0x0786('0x2'));var logger=require('../../../../../../config/logger')('agi');module[_0x0786('0x3')]=function(_0x30f696,_0x23618c,_0xf95aed,_0x10e3e3){return new BPromise(function(_0x2d701e,_0x4b2a57){logger[_0x0786('0x4')](_0x0786('0x5'),_0x10e3e3||_0x0786('0x6'));var _0x505966=new WebSocket(_0x10e3e3||_0x0786('0x6'),{'perMessageDeflate':![]});var _0x5be239='';var _0x13a9ad='0';var _0x597ff2='1';var _0x290808=_0x0786('0x7');function _0x71fb71(_0x36472c){var _0x47131e=crypto[_0x0786('0x8')]('sha1');_0x47131e[_0x0786('0x9')](_0x36472c);return _0x47131e[_0x0786('0xa')](_0x0786('0xb'));}function _0x1e7cd5(){try{logger[_0x0786('0x4')](_0x0786('0xc'));var _0x4b57ca=moment()['unix']();var _0x426ab5=_0x71fb71(_0x4b57ca+_0x23618c+_0xf95aed);_0x505966[_0x0786('0xd')](JSON[_0x0786('0xe')]({'appID':_0x23618c,'timestamp':_0x4b57ca,'appKey':_0x426ab5}));var _0x2b1f33=fs['createReadStream'](_0x30f696);_0x2b1f33['on'](_0x0786('0xf'),function(_0x48cd21){_0x505966[_0x0786('0xd')](_0x48cd21);});_0x2b1f33['on'](_0x0786('0x10'),function(){_0x505966['send'](_0x0786('0x11'));});}catch(_0x553732){logger[_0x0786('0x12')](_0x0786('0x13'),JSON[_0x0786('0xe')](_0x553732));_0x505966[_0x0786('0x14')]();}}function _0x327692(_0x26d7fe){try{if(_0x26d7fe){var _0x53d91d=JSON[_0x0786('0x15')](_0x26d7fe);switch(_0x53d91d['status']){case 0x0:if(_0x53d91d[_0x0786('0x16')]){if(_0x53d91d[_0x0786('0x16')][_0x0786('0x17')]){logger['info'](_0x0786('0x18'),JSON['stringify'](_0x53d91d[_0x0786('0x16')][_0x0786('0x19')]));_0x5be239=_0x53d91d[_0x0786('0x16')]['hypotheses'][0x0]['transcript'];_0x13a9ad=_0x53d91d[_0x0786('0x16')][_0x0786('0x19')][0x0]['likelihood'];_0x597ff2='0';_0x290808=_0x0786('0x1a');_0x505966['terminate']();}}break;case 0x1:logger[_0x0786('0x4')](_0x0786('0x7'));_0x597ff2='1';_0x290808='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x0786('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x597ff2='2';_0x290808=_0x0786('0x1b');break;case 0x9:logger[_0x0786('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x597ff2='9';_0x290808='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x0786('0x4')](_0x0786('0x1c'));_0x597ff2='10';_0x290808=_0x0786('0x1c');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x597ff2='11';_0x290808=_0x0786('0x1d');}}}catch(_0x5232a6){logger[_0x0786('0x12')](_0x0786('0x1e'),JSON[_0x0786('0xe')](_0x5232a6));_0x505966[_0x0786('0x14')]();}}function _0x5e8aa7(){logger[_0x0786('0x4')](_0x0786('0x1f'));_0x2d701e({'transcript':_0x5be239,'confidence':_0x13a9ad,'status':_0x597ff2,'status_message':_0x290808});}function _0x460e6b(_0x7d3ea5){logger['error'](_0x0786('0x20'));if(!_[_0x0786('0x21')](_0x7d3ea5)){logger[_0x0786('0x12')](_['isObject'](_0x7d3ea5)?JSON[_0x0786('0xe')](_0x7d3ea5):_0x7d3ea5);}}_0x505966['on'](_0x0786('0x22'),_0x1e7cd5);_0x505966['on'](_0x0786('0x23'),_0x327692);_0x505966['on'](_0x0786('0x10'),_0x5e8aa7);_0x505966['on'](_0x0786('0x12'),_0x460e6b);});}; \ 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 191b9d5..40c45c2 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 _0x29a2=['exports'];(function(_0x2d4a19,_0x13979a){var _0x3c67de=function(_0x55a428){while(--_0x55a428){_0x2d4a19['push'](_0x2d4a19['shift']());}};_0x3c67de(++_0x13979a);}(_0x29a2,0x162));var _0x229a=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x29a2[_0x513aa5];return _0x1a1a7c;};var asr=require('./asr');module[_0x229a('0x0')]={'asr':asr}; \ No newline at end of file +var _0x5936=['./asr'];(function(_0x41df4b,_0x31a3f6){var _0x98e2db=function(_0x722627){while(--_0x722627){_0x41df4b['push'](_0x41df4b['shift']());}};_0x98e2db(++_0x31a3f6);}(_0x5936,0xf8));var _0x6593=function(_0x340cfd,_0x1f50f5){_0x340cfd=_0x340cfd-0x0;var _0x19aebc=_0x5936[_0x340cfd];return _0x19aebc;};var asr=require(_0x6593('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 ed6fbc0..1c7c606 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 _0x7ac8=['./error','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter'];(function(_0x34e439,_0x1b04ed){var _0x5ef36f=function(_0x318b7d){while(--_0x318b7d){_0x34e439['push'](_0x34e439['shift']());}};_0x5ef36f(++_0x1b04ed);}(_0x7ac8,0x162));var _0x87ac=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0x7ac8[_0x20e375];return _0x55ac5d;};'use strict';var util=require(_0x87ac('0x0'));var net=require(_0x87ac('0x1'));var EventEmitter=require('events')[_0x87ac('0x2')];var AGIError=require(_0x87ac('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x582ab7,_0x2a8f83,_0x387d70){var _0x1f563d=this,_0x582ab7=_0x582ab7||0x11dd,_0x2a8f83=_0x2a8f83||'127.0.0.1',_0x47de67=null,_0x4abc82=0x0;EventEmitter[_0x87ac('0x4')](_0x1f563d);function _0x117b9e(){if(!_0x582ab7){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x6'),new AGIError(_0x87ac('0x7')));return![];}_0x47de67=net['createServer']();_0x47de67[_0x87ac('0x8')](_0x582ab7,_0x2a8f83);_0x47de67['on']('listening',function(){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x9'));});_0x47de67['on']('connection',function(_0x16f130){_0x47de67[_0x87ac('0xa')](function(_0x687fa4,_0x40b89a){if(_0x687fa4){_0x1f563d['emit'](_0x87ac('0x6'),new AGIError(_0x87ac('0xb'),_0x687fa4));}else if(_0x387d70&&_0x387d70<0x0){_0x1f563d[_0x87ac('0x5')]('error',new AGIError(_0x87ac('0xc')));_0x16f130['destroy']();}else if(_0x387d70&&_0x387d70>0x0&&_0x387d70<_0x40b89a){_0x4abc82+=0x1;_0x1f563d[_0x87ac('0x5')](_0x87ac('0x6'),new AGIError(_0x87ac('0xd'),_0x4abc82));_0x16f130[_0x87ac('0xe')]();}else{var _0x5eefea=new AGIChannel(_0x16f130);_0x5eefea['on'](_0x87ac('0xf'),function(){_0x1f563d['emit']('connection',_0x5eefea);});}});});_0x47de67['on'](_0x87ac('0x6'),function(_0x4352e3){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x6'),new AGIError(_0x87ac('0xb'),_0x4352e3[_0x87ac('0x10')]));});_0x47de67['on'](_0x87ac('0x11'),function(){_0x1f563d[_0x87ac('0x5')](_0x87ac('0x11'),new AGIError(_0x87ac('0x12')));});}process[_0x87ac('0x13')](function(){_0x117b9e();});};util[_0x87ac('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x8dea3f,_0x3d72e6,_0x3cef33){return new AGIServer(_0x8dea3f,_0x3d72e6,_0x3cef33);}; \ No newline at end of file +var _0x3c77=['projectUpdate','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','connection','code','close','nextTick','inherits','exports','util','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','data','parse'];(function(_0x350c87,_0x2b44ef){var _0x163800=function(_0xb99c9){while(--_0xb99c9){_0x350c87['push'](_0x350c87['shift']());}};_0x163800(++_0x2b44ef);}(_0x3c77,0x9d));var _0x73c7=function(_0x52e674,_0x399620){_0x52e674=_0x52e674-0x0;var _0x2ca255=_0x3c77[_0x52e674];return _0x2ca255;};'use strict';var util=require(_0x73c7('0x0'));var net=require('net');var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x73c7('0x1'));var AGIServer=function(_0x3530b3,_0xe1113a,_0x254499){var _0xd30d84=this;var _0x21b22b=null;var _0x552f1c=0x0;if(!_0x3530b3)_0x3530b3=0x11dd;if(!_0xe1113a)_0xe1113a=_0x73c7('0x2');EventEmitter[_0x73c7('0x3')](_0xd30d84);function _0x2641fa(){if(!_0x3530b3){_0xd30d84[_0x73c7('0x4')](_0x73c7('0x5'),new AGIError(_0x73c7('0x6')));return![];}_0x21b22b=net['createServer']();_0x21b22b[_0x73c7('0x7')](_0x3530b3,_0xe1113a);_0x21b22b['on'](_0x73c7('0x8'),function(){_0xd30d84[_0x73c7('0x4')](_0x73c7('0x8'));});_0x21b22b['on']('connection',function(_0x1a057e){_0x1a057e['on'](_0x73c7('0x9'),function(_0x3d2ea4){try{var _0x2287ff=JSON[_0x73c7('0xa')](_0x3d2ea4);_0xd30d84[_0x73c7('0x4')](_0x73c7('0xb'),_0x2287ff);}catch(_0xe2a590){return;}});_0x21b22b[_0x73c7('0xc')](function(_0x139b45,_0x41f57d){if(_0x139b45){_0xd30d84[_0x73c7('0x4')]('error',new AGIError(_0x73c7('0xd'),_0x139b45));}else if(_0x254499&&_0x254499<0x0){_0xd30d84['emit']('error',new AGIError(_0x73c7('0xe')));_0x1a057e['destroy']();}else if(_0x254499&&_0x254499>0x0&&_0x254499<_0x41f57d){_0x552f1c+=0x1;_0xd30d84[_0x73c7('0x4')]('error',new AGIError(_0x73c7('0xf'),_0x552f1c));_0x1a057e[_0x73c7('0x10')]();}else{var _0x566687=new AGIChannel(_0x1a057e);_0x566687['on'](_0x73c7('0x11'),function(){_0xd30d84[_0x73c7('0x4')](_0x73c7('0x12'),_0x566687);});}});});_0x21b22b['on']('error',function(_0x52d76c){_0xd30d84[_0x73c7('0x4')](_0x73c7('0x5'),new AGIError(_0x73c7('0xd'),_0x52d76c[_0x73c7('0x13')]));});_0x21b22b['on'](_0x73c7('0x14'),function(){_0xd30d84[_0x73c7('0x4')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x73c7('0x15')](function(){_0x2641fa();});};util[_0x73c7('0x16')](AGIServer,EventEmitter);module[_0x73c7('0x17')]=function(_0x26e9f0,_0xb3f5dc,_0x214657){return new AGIServer(_0x26e9f0,_0xb3f5dc,_0x214657);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8f37344..a94833a 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 _0x180d=['sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','forEach','%s[%s][%s]','variable\x20%s\x20set','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','test','mindigit','maxdigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','user','bcc','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','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','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','getSoundPath','format','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','key','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','isConfigured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x180d,0xf9));var _0xd180=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x180d[_0x21a9d9];return _0x46adce;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xd180('0x0'));var sh=require(_0xd180('0x1'));var odbc=require(_0xd180('0x2'))();var rs=require(_0xd180('0x3'));var moment=require(_0xd180('0x4'));var Mustache=require('mustache');var rp=require(_0xd180('0x5'));var logger=require(_0xd180('0x6'))(_0xd180('0x7'));var config=require(_0xd180('0x8'));var shared=require(_0xd180('0x9'));var scripts=require(_0xd180('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xd180('0xb')];var verticesWithRetry=[_0xd180('0xc'),_0xd180('0xd'),_0xd180('0xe')];var AGIVertices=function(_0xd8fa8b,_0x42f372,_0x19f7b0){this[_0xd180('0xf')]=_0xd8fa8b;this[_0xd180('0x10')]=_0x42f372;this[_0xd180('0x11')]=_0x19f7b0;};AGIVertices[_0xd180('0x12')][_0xd180('0x13')]=function(_0x2f2dd4,_0x3fdebf){this['rpc'][_0xd180('0x14')](_0x2f2dd4)[_0xd180('0x15')](function(_0x1384c9){_0x3fdebf(null,_0x1384c9?_0x1384c9[_0xd180('0x16')]:![]);})[_0xd180('0x17')](function(_0x51f9fe){_0x3fdebf(_0x51f9fe);});};AGIVertices['prototype'][_0xd180('0x18')]=function(_0x2af39b,_0x18fb15){this[_0xd180('0x10')][_0xd180('0x19')](_0x2af39b)[_0xd180('0x15')](function(_0x4f80a4){_0x18fb15(null,_0x4f80a4?_0x4f80a4['name']:![]);})[_0xd180('0x17')](function(_0x50c4e6){_0x18fb15(_0x50c4e6);});};AGIVertices['prototype'][_0xd180('0x1a')]=function(_0x488435,_0x462a38){this[_0xd180('0x10')][_0xd180('0x1b')](_0x488435)[_0xd180('0x15')](function(_0x543e14){_0x462a38(null,_0x543e14?_0x543e14[_0xd180('0x16')]:![]);})['catch'](function(_0x3ed54d){_0x462a38(_0x3ed54d);});};AGIVertices[_0xd180('0x12')][_0xd180('0x1c')]=function(_0x2401fe,_0x1db22a){this[_0xd180('0x10')][_0xd180('0x1d')](_0x2401fe)['then'](function(_0x2a172d){_0x1db22a(null,_0x2a172d?_0x2a172d['dsn']:![]);})[_0xd180('0x17')](function(_0x3e6f03){_0x1db22a(_0x3e6f03);});};AGIVertices[_0xd180('0x12')][_0xd180('0x1e')]=function(_0x38c4f0,_0x25594f){this[_0xd180('0x10')][_0xd180('0x1f')](_0x38c4f0)[_0xd180('0x15')](function(_0x183110){_0x25594f(null,_0x183110?_0x183110[_0xd180('0x16')]:![]);})['catch'](function(_0x1ddd4e){_0x25594f(_0x1ddd4e);});};AGIVertices[_0xd180('0x12')]['getTrunk']=function(_0x7118d2,_0x3787dc){this[_0xd180('0x10')]['getTrunkById'](_0x7118d2)[_0xd180('0x15')](function(_0x24bae4){_0x3787dc(null,_0x24bae4?_0x24bae4[_0xd180('0x16')]:![]);})['catch'](function(_0x33f684){_0x3787dc(_0x33f684);});};AGIVertices[_0xd180('0x12')]['getSound']=function(_0x34c095,_0x38d44e){var _0xa20dd=this;this[_0xd180('0x10')][_0xd180('0x20')](_0x34c095)[_0xd180('0x15')](function(_0x23bb24){_0x38d44e(null,_0x23bb24?_0xa20dd['getSoundPath'](_0x23bb24[_0xd180('0x21')]):![]);})[_0xd180('0x17')](function(_0x159be6){_0x38d44e(_0x159be6);});};AGIVertices[_0xd180('0x12')][_0xd180('0x22')]=function(_0x9c93e2,_0x1d4f8f){this['rpc'][_0xd180('0x23')](_0x9c93e2)[_0xd180('0x15')](function(_0x4b412f){_0x1d4f8f(null,_0x4b412f?_0x4b412f:![]);})['catch'](function(_0x214924){_0x1d4f8f(_0x214924);});};AGIVertices[_0xd180('0x12')]['sendMailMessage']=function(_0x7be087,_0x2a7424,_0x45a5a4){this[_0xd180('0x11')][_0xd180('0x24')](_0x7be087,_0x2a7424)[_0xd180('0x15')](function(){_0x45a5a4(null);})[_0xd180('0x17')](function(_0x53a657){_0x45a5a4(_0x53a657);});};AGIVertices['prototype'][_0xd180('0x25')]=function(_0xaf4d30,_0x655d06){this[_0xd180('0x10')][_0xd180('0x26')](_0xaf4d30)[_0xd180('0x15')](function(_0x4bec06){if(_0x4bec06){if(_0x4bec06['IntervalId']){_0x655d06(null,[_0x4bec06[_0xd180('0x27')]]);}else{_0x655d06(null,_[_0xd180('0x28')](_0x4bec06['Intervals'],_0xd180('0x27')));}}else{_0x655d06(null,![]);}})[_0xd180('0x17')](function(_0x4053b8){_0x655d06(_0x4053b8);});};AGIVertices[_0xd180('0x12')][_0xd180('0x29')]=function(_0x44850d){return util[_0xd180('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x44850d);};AGIVertices[_0xd180('0x12')]['getQueryOdbc']=function(_0x5858a6,_0x17e51a,_0x3375ff){odbc['open'](_0x5858a6,function(_0x1a8925){if(_0x1a8925){logger['error'](_0xd180('0x2b'),_0x1a8925);_0x3375ff(_0x1a8925);}else{logger['info'](_0xd180('0x2c'));odbc[_0xd180('0x2d')](_0x17e51a,function(_0x55509b,_0x57d116){if(_0x55509b){logger[_0xd180('0x2e')]('Error\x20executing\x20query\x20%s',_0x17e51a);_0x3375ff(_0x55509b);}else{logger[_0xd180('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x17e51a);odbc[_0xd180('0x2f')](function(_0x457bed){if(_0x457bed){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x457bed);}_0x3375ff(null,_0x57d116);});}});}});};AGIVertices['prototype'][_0xd180('0x30')]=function(_0x56d24e,_0x25570f){this[_0xd180('0x10')][_0xd180('0x31')](_0x56d24e)[_0xd180('0x15')](function(_0x158452){_0x25570f(null,_0x158452?_0x158452:![]);})[_0xd180('0x17')](function(_0x197946){_0x25570f(_0x197946);});};AGIVertices[_0xd180('0x12')][_0xd180('0x32')]=function(_0x58b657,_0x244758){this['rpc'][_0xd180('0x32')](_0x58b657)['then'](function(_0x2118f8){_0x244758(null,_0x2118f8);})['catch'](function(_0x15e82a){_0x244758(_0x15e82a);});};AGIVertices[_0xd180('0x12')][_0xd180('0x33')]=function(_0x501e2d,_0xacdf07,_0x518f94){this[_0xd180('0x10')][_0xd180('0x33')]({'uniqueid':this['channel'][_0xd180('0x34')],'node':_0x501e2d[_0xd180('0x35')],'application':_0x501e2d[_0xd180('0x36')],'data':_0xacdf07||null,'project_name':this[_0xd180('0xf')][_0xd180('0x37')],'callerid':this['channel'][_0xd180('0x38')]})[_0xd180('0x15')](function(_0x200bd6){if(_0x518f94){_0x518f94(null,_0x200bd6);}})[_0xd180('0x17')](function(_0x547b2b){if(_0x518f94){_0x518f94(_0x547b2b);}});};AGIVertices[_0xd180('0x12')][_0xd180('0x39')]=function(_0x328a35,_0x22b59f,_0x51da49,_0x4c7916){this['rpc'][_0xd180('0x39')]({'uniqueid':this[_0xd180('0xf')]['uniqueid'],'callerid':this[_0xd180('0xf')][_0xd180('0x38')],'calleridname':this[_0xd180('0xf')][_0xd180('0x3a')],'context':this['channel'][_0xd180('0x3b')],'extension':this[_0xd180('0xf')][_0xd180('0x3c')],'priority':this[_0xd180('0xf')]['priority'],'accountcode':this['channel'][_0xd180('0x3d')],'dnid':this[_0xd180('0xf')][_0xd180('0x3e')],'projectName':this[_0xd180('0xf')]['arg_1'],'saveName':_0x22b59f,'filename':_0x328a35[_0xd180('0x3f')]||_0x22b59f,'savePath':_0x51da49})['then'](function(_0x37973b){_0x4c7916(null,_0x37973b);})[_0xd180('0x17')](function(_0x2a4948){_0x4c7916(_0x2a4948);});};AGIVertices[_0xd180('0x12')][_0xd180('0x40')]=function(_0x1fa95c,_0x5c0c01,_0x56a646,_0x3b82d2,_0x48460d){this[_0xd180('0x10')][_0xd180('0x40')]({'uniqueid':this['channel'][_0xd180('0x34')],'body':_0x1fa95c,'direction':_0x5c0c01,'providerName':_0x56a646,'providerResponse':_0x3b82d2})['then'](function(_0x1d906f){if(_0x48460d){_0x48460d(null,_0x1d906f);}})[_0xd180('0x17')](function(_0x572205){if(_0x48460d){_0x48460d(_0x572205);}});};AGIVertices[_0xd180('0x12')]['createCmContact']=function(_0x4bb7b1,_0x1ee9aa){this[_0xd180('0x10')]['createCmContact']({'firstName':_[_0xd180('0x41')](_0x4bb7b1[_0xd180('0x16')])||_[_0xd180('0x42')](_0x4bb7b1[_0xd180('0x16')])?_0xd180('0x43')+Math[_0xd180('0x44')]():_0x4bb7b1['name'],'lastName':_[_0xd180('0x41')](_0x4bb7b1[_0xd180('0x45')])||_[_0xd180('0x42')](_0x4bb7b1[_0xd180('0x45')])?null:_0x4bb7b1['lastName'],'phone':_0x4bb7b1[_0xd180('0x46')],'ListId':_0x4bb7b1[_0xd180('0x47')],'scheduledat':_0x4bb7b1['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xd180('0x48'),'description':_0xd180('0x49')+_0x4bb7b1[_0xd180('0x4a')]['toString'](),'priority':_0x4bb7b1[_0xd180('0x4b')]})[_0xd180('0x15')](function(_0x440356){_0x1ee9aa(null,_0x440356);})[_0xd180('0x17')](function(_0x59a757){_0x1ee9aa(_0x59a757);});};AGIVertices[_0xd180('0x12')]['getPause']=function(_0x27f243,_0x2f0a30){this[_0xd180('0x10')]['getPauseById'](_0x27f243)[_0xd180('0x15')](function(_0xa38223){_0x2f0a30(null,_0xa38223?_0xa38223[_0xd180('0x16')]:![]);})[_0xd180('0x17')](function(_0x1ae574){_0x2f0a30(_0x1ae574);});};AGIVertices[_0xd180('0x12')][_0xd180('0x4c')]=function(_0xa26588,_0x16e64e,_0x1acb16){var _0x4681d9={'role':_0xd180('0x4d')};_0x4681d9[_0xa26588]=this['channel'][_0xd180('0x38')];this['rpc'][_0xd180('0x4c')](_0x4681d9,_0x16e64e,this[_0xd180('0xf')][_0xd180('0x34')])[_0xd180('0x15')](function(_0x10df19){_0x1acb16(null,_[_0xd180('0x42')](_0x10df19)?![]:!![]);})['catch'](function(_0x345dfe){logger[_0xd180('0x4e')](_0x345dfe);_0x1acb16(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x4f')]=function(_0x3b8fd2,_0x3def67){var _0x15c299={'role':_0xd180('0x4d')};_0x15c299[_0x3b8fd2]=this['channel']['callerid'];this[_0xd180('0x10')][_0xd180('0x4f')](_0x15c299)['then'](function(_0x469827){_0x3def67(null,_[_0xd180('0x42')](_0x469827)?![]:!![]);})[_0xd180('0x17')](function(_0xd14d6e){logger[_0xd180('0x4e')](_0xd14d6e);_0x3def67(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x50')]=function(_0x5b767f,_0xb9b684){var _0x2add43={'role':'agent'};_0x2add43[_0x5b767f]=this[_0xd180('0xf')][_0xd180('0x38')];this[_0xd180('0x10')][_0xd180('0x50')](_0x2add43)[_0xd180('0x15')](function(_0x9ae61){_0xb9b684(null,_[_0xd180('0x42')](_0x9ae61)?![]:!![]);})[_0xd180('0x17')](function(_0x2ca65f){logger[_0xd180('0x4e')](_0x2ca65f);_0xb9b684(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x51')]=function(_0x350ec4,_0x52131e){var _0x41141c={'role':_0xd180('0x4d')};_0x41141c[_0x350ec4]=this[_0xd180('0xf')][_0xd180('0x38')];var _0x57411c=_0x350ec4!='internal'?util[_0xd180('0x2a')](_0xd180('0x52'),_0xd180('0x53'),this[_0xd180('0xf')][_0xd180('0x38')]):undefined;this[_0xd180('0x10')][_0xd180('0x51')](_0x41141c,_0x57411c)[_0xd180('0x15')](function(_0x31aa39){_0x52131e(null,_[_0xd180('0x42')](_0x31aa39)?![]:!![]);})[_0xd180('0x17')](function(_0x51bc70){logger[_0xd180('0x4e')](_0x51bc70);_0x52131e(null,![]);});};AGIVertices[_0xd180('0x12')][_0xd180('0x54')]=function(_0x4f3a55,_0x5d4944){sh['exec'](_[_0xd180('0x55')](_0x4f3a55),function(_0x2f0d20,_0x38632a){var _0xc60cb4=_0x38632a[_0xd180('0x56')](/(\r\n|\n|\r)/gm,'');_0x5d4944(null,_0xc60cb4);});};AGIVertices[_0xd180('0x12')]['googleCloudTTS']=function(_0x5c8f1d,_0x31aa07){scripts[_0xd180('0x57')](_0x5c8f1d[_0xd180('0x58')],_0x5c8f1d[_0xd180('0x59')]||_0xd180('0x5a'),_0x5c8f1d[_0xd180('0x5a')],_0x5c8f1d[_0xd180('0x5b')]||'en-US',_0x5c8f1d[_0xd180('0x5c')]||_0xd180('0x5d'),_0x5c8f1d[_0xd180('0x5e')]||'MP3')['then'](function(_0x4ff406){_0x31aa07(null,_0x4ff406);})['catch'](function(_0x1270f9){_0x31aa07(_0x1270f9);});};AGIVertices[_0xd180('0x12')][_0xd180('0x5f')]=function(_0x108161,_0x56c075){scripts[_0xd180('0x5f')](_0x108161['text'],_0x108161['google_tts_language']||'en',0x1)[_0xd180('0x15')](function(_0x43729d){_0x56c075(null,_0x43729d);})[_0xd180('0x17')](function(_0x1c1011){_0x56c075(_0x1c1011);});};AGIVertices['prototype'][_0xd180('0x60')]=function(_0x30588a,_0x2ee7cf){var _0x32c813={'uri':_0x30588a[_0xd180('0x61')],'method':_0x30588a[_0xd180('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x30588a[_0xd180('0x63')])===_0xd180('0x64')&&parseInt(_0x30588a[_0xd180('0x63')])>=0x1?parseInt(_0x30588a[_0xd180('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xd180('0x65')]([_0xd180('0x66'),'PUT'],_0x32c813[_0xd180('0x62')]['toUpperCase']())){try{_0x32c813[_0xd180('0x67')]=_0x30588a['rawBody']?JSON[_0xd180('0x68')](_0x30588a[_0xd180('0xb')]):{};}catch(_0x37f1a2){logger['error'](_0xd180('0x69'),_0x37f1a2);}}try{_0x32c813[_0xd180('0x6a')]=_0x30588a[_0xd180('0x6b')]?JSON[_0xd180('0x68')](_0x30588a[_0xd180('0x6b')]):{};}catch(_0x34409a){logger['error'](_0xd180('0x6c'),_0x34409a);}if(_0x30588a['computedVariables']){try{var _0x33f58d=require(_0x30588a[_0xd180('0x6d')])[_0xd180('0x6e')](this,_0x32c813);_0x32c813[_0xd180('0x6f')]=Mustache['render'](_0x30588a['url'],_0x33f58d,{},['$$','$$']);if(_0x32c813[_0xd180('0x6a')]){_0x32c813['headers']=JSON[_0xd180('0x68')](Mustache['render'](JSON['stringify'](_0x32c813['headers']),_0x33f58d,{},['$$','$$']));}if(_0x32c813[_0xd180('0x67')]){_0x32c813['body']=JSON[_0xd180('0x68')](Mustache[_0xd180('0x70')](JSON[_0xd180('0x71')](_0x32c813[_0xd180('0x67')]),_0x33f58d,{},['$$','$$']));}}catch(_0x279df1){logger[_0xd180('0x4e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x279df1);}}rp(_0x32c813)['then'](function(_0x371fee){var _0x20bfff={'statusCode':_0x371fee[_0xd180('0x72')]||0xc8,'statusMessage':_0x371fee[_0xd180('0x73')]||'OK','headers':_0x371fee[_0xd180('0x6a')]||{},'body':_0x371fee[_0xd180('0x67')]||{}};_0x2ee7cf(null,_0x20bfff);})[_0xd180('0x17')](function(_0x1f30d6){var _0x1043c0={'statusCode':_0x1f30d6[_0xd180('0x72')]||0x1f4,'statusMessage':_0x1f30d6[_0xd180('0x74')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1f30d6['options'][_0xd180('0x6a')]||{},'body':_0x1f30d6[_0xd180('0x75')]['body']||{}};_0x2ee7cf(null,_0x1043c0);});};AGIVertices[_0xd180('0x12')][_0xd180('0x76')]=function(_0x132847,_0x5bfd5e){scripts[_0xd180('0x76')](this[_0xd180('0xf')]['uniqueid'],_0x132847['key'],_0x132847[_0xd180('0x5a')],_0x132847[_0xd180('0x77')]||'en')[_0xd180('0x15')](function(_0x165d2c){_0x5bfd5e(null,_0x165d2c);})['catch'](function(_0x289c34){_0x5bfd5e(_0x289c34);});};AGIVertices['prototype'][_0xd180('0x78')]=function(_0x50e499,_0x93f7f0){scripts[_0xd180('0x78')](this[_0xd180('0xf')]['uniqueid'],_0x50e499[_0xd180('0x79')],_0x50e499[_0xd180('0x7a')],_0x50e499[_0xd180('0x7b')],_0x50e499['text'],_0x50e499[_0xd180('0x7c')]||'en')[_0xd180('0x15')](function(_0x104bf2){_0x93f7f0(null,_0x104bf2);})[_0xd180('0x17')](function(_0x1cd947){_0x93f7f0(_0x1cd947);});};AGIVertices[_0xd180('0x12')][_0xd180('0x7d')]=function(_0x299045,_0x22172a){scripts[_0xd180('0x7d')](this[_0xd180('0xf')],_0x299045)[_0xd180('0x15')](function(_0x23e329){_0x22172a(null,_0x23e329);})[_0xd180('0x17')](function(_0xed34f7){_0x22172a(_0xed34f7);});};AGIVertices[_0xd180('0x12')][_0xd180('0x7e')]=function(_0x2cf157,_0x195273){scripts['ispeechTTS'](_0x2cf157['key'],_0x2cf157[_0xd180('0x5a')],_0x2cf157['ispeech_tts_language']||_0xd180('0x7f'),_0x2cf157[_0xd180('0x80')])['then'](function(_0x46689f){_0x195273(null,_0x46689f);})['catch'](function(_0x2d41e5){_0x195273(_0x2d41e5);});};AGIVertices[_0xd180('0x12')][_0xd180('0x81')]=function(_0x21562a,_0x458321,_0x147edd){scripts[_0xd180('0x81')](_0x458321,_0x21562a[_0xd180('0x82')],_0x21562a[_0xd180('0x83')]||'en-US',this['isConfigured'](_0x21562a[_0xd180('0x84')])?_0x21562a[_0xd180('0x84')]:undefined)['then'](function(_0x57cfc6){_0x147edd(null,_0x57cfc6);})[_0xd180('0x17')](function(_0x1cd704){_0x147edd(_0x1cd704);});};AGIVertices[_0xd180('0x12')]['awsPolly']=function(_0x55b5ed,_0x1f3f44){scripts['awsPolly'](_0x55b5ed[_0xd180('0x85')],_0x55b5ed[_0xd180('0x86')],_0x55b5ed[_0xd180('0x87')],_0x55b5ed[_0xd180('0x88')]||'Amy',_0x55b5ed[_0xd180('0x5a')],_0x55b5ed[_0xd180('0x89')]||_0xd180('0x5a'))[_0xd180('0x15')](function(_0x3b79eb){_0x1f3f44(null,_0x3b79eb);})[_0xd180('0x17')](function(_0x3c6de2){_0x1f3f44(_0x3c6de2);});};AGIVertices['prototype'][_0xd180('0x8a')]=function(_0x995a23,_0x4ff159){scripts[_0xd180('0x8a')](this[_0xd180('0xf')][_0xd180('0x34')],_0x995a23[_0xd180('0x85')],_0x995a23[_0xd180('0x86')],_0x995a23[_0xd180('0x8b')],_0x995a23[_0xd180('0x5a')],_0x995a23[_0xd180('0x8c')])['then'](function(_0xa5458){_0x4ff159(null,_0xa5458);})['catch'](function(_0x7471ca){_0x4ff159(_0x7471ca);});};AGIVertices[_0xd180('0x12')]['googleASR']=function(_0x17544c,_0x242d0b,_0x1e38ee){scripts[_0xd180('0x8d')](_0x242d0b,_0x17544c[_0xd180('0x82')],_0x17544c[_0xd180('0x8e')]||'en-US')[_0xd180('0x15')](function(_0x29ee3b){_0x1e38ee(null,_0x29ee3b);})['catch'](function(_0x514706){_0x1e38ee(_0x514706);});};AGIVertices[_0xd180('0x12')][_0xd180('0x8f')]=function(_0x34ed39,_0x303292,_0x413307){scripts[_0xd180('0x8f')](_0x303292,_0x34ed39[_0xd180('0x90')],_0x34ed39['appsecret'],_0x34ed39[_0xd180('0x6f')])[_0xd180('0x15')](function(_0x97bcb){_0x413307(null,_0x97bcb);})[_0xd180('0x17')](function(_0xbf0d26){_0x413307(_0xbf0d26);});};AGIVertices[_0xd180('0x12')][_0xd180('0x91')]=function(_0x5e9980){var _0x581125=_[_0xd180('0x65')](verticesWithRetry,_0x5e9980[_0xd180('0x36')])?_0x5e9980:_[_0xd180('0x92')](_0x5e9980);for(var _0x22e42e in _0x581125){if(_0x581125[_0xd180('0x93')](_0x22e42e)){if(_0x581125[_0x22e42e]&&_[_0xd180('0x94')](_0x581125[_0x22e42e])){if(_[_0xd180('0x65')](recursiveMapAttributes,_0x22e42e)){_0x581125[_0x22e42e]=this[_0xd180('0x95')](_0x581125[_0x22e42e]);}else{_0x581125[_0x22e42e]=this[_0xd180('0x96')](_0x581125[_0x22e42e]);}}}}return _0x581125;};AGIVertices[_0xd180('0x12')][_0xd180('0x97')]=function(_0x14a5c6){for(var _0x1ad48f in _0x14a5c6){if(_0x14a5c6[_0xd180('0x93')](_0x1ad48f)){if(_[_0xd180('0x98')](_0x14a5c6[_0x1ad48f])){this[_0xd180('0x97')](_0x14a5c6[_0x1ad48f]);}else if(_[_0xd180('0x99')](_0x14a5c6[_0x1ad48f])){for(var _0x44a055=0x0;_0x44a055<_0x14a5c6[_0x1ad48f][_0xd180('0x9a')];_0x44a055++){this[_0xd180('0x97')](_0x14a5c6[_0x1ad48f][_0x44a055]);}}else if(_[_0xd180('0x94')](_0x14a5c6[_0x1ad48f])){_0x14a5c6[_0x1ad48f]=this[_0xd180('0x96')](_0x14a5c6[_0x1ad48f]);}}}};AGIVertices[_0xd180('0x12')][_0xd180('0x9b')]=function(_0x256a68,_0x512bed){for(var _0x38692d in _0x256a68){if(_0x256a68[_0xd180('0x93')](_0x38692d)){if(_[_0xd180('0x98')](_0x256a68[_0x38692d])){if(!_['isEmpty'](_0x256a68[_0x38692d])){this[_0xd180('0x9b')](_0x256a68[_0x38692d],util['format'](_0xd180('0x9c'),_0x512bed,_0x38692d));}}else if(_[_0xd180('0x99')](_0x256a68[_0x38692d])){for(var _0x53aa66=0x0;_0x53aa66<_0x256a68[_0x38692d]['length'];_0x53aa66++){this[_0xd180('0x9b')](_0x256a68[_0x38692d][_0x53aa66],util[_0xd180('0x2a')]('%s.%s',_0x512bed,_0x38692d+'['+_0x53aa66+']'));}}else{if(!_[_0xd180('0x42')](_0x256a68[_0x38692d])){this['channel'][_0xd180('0x9d')](util['format'](_0xd180('0x9c'),_0x512bed,_0x38692d),_0x256a68[_0x38692d]);}}}}};AGIVertices[_0xd180('0x12')][_0xd180('0x95')]=function(_0x59a33e){try{var _0x6ca5a1=JSON[_0xd180('0x68')](_0x59a33e);this['recursiveNodeIndex'](_0x6ca5a1);return JSON[_0xd180('0x71')](_0x6ca5a1);}catch(_0x597736){return this[_0xd180('0x96')](_0x59a33e);}};AGIVertices[_0xd180('0x12')][_0xd180('0x96')]=function(_0x421a70){var _0x4080bd=_0x421a70[_0xd180('0x9e')]('{');for(var _0xb02088=0x1;_0xb02088<_0x4080bd[_0xd180('0x9a')];_0xb02088+=0x1){var _0x928ff9=_0x4080bd[_0xb02088]['split']('}');if(_0x928ff9[_0xd180('0x9a')]>0x1){_0x421a70=_0x421a70[_0xd180('0x9f')]('{'+_0x928ff9[0x0]+'}',this[_0xd180('0xf')]['getVariable'](_0x928ff9[0x0])['extra']||_0x928ff9[0x0]);}}if(_0x4080bd[_0xd180('0x9a')]===0x1){return _0x421a70[_0xd180('0xa0')]();}return this['replaceAllVariables'](_0x421a70);};AGIVertices[_0xd180('0x12')]['getAndSetVariable']=function(_0x8b7179,_0x14b678){var _0x75b99e=this[_0xd180('0xf')]['getVariable'](_0x8b7179);if(_0x75b99e['result']===-0x1){return _0x75b99e;}logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xa1'),_0x14b678,_0x75b99e[_0xd180('0xa2')]));return this[_0xd180('0xf')]['setVariable'](_0x14b678,_0x75b99e[_0xd180('0xa2')]);};AGIVertices[_0xd180('0x12')]['isConfigured']=function(_0x1b54af){return _0x1b54af&&_0x1b54af!=='0'&&_0x1b54af!=='-1'&&_0x1b54af!=='';};AGIVertices['prototype'][_0xd180('0xa3')]=function(_0x30c42f){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x30c42f,'-');_0x30c42f[_0xd180('0xa4')]=_0x30c42f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd180('0x12')][_0xd180('0xa5')]=function(_0x12806d){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x12806d[_0xd180('0x35')]));if(!this['isConfigured'](_0x12806d[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20text\x20configured');}var _0xd19890='\x22'+_0x12806d[_0xd180('0x5a')]+'\x22';if(this[_0xd180('0xa7')](_0x12806d[_0xd180('0x75')])){_0xd19890+=','+_0x12806d[_0xd180('0x75')];}var _0x5250ba=this['channel']['exec'](_0xd180('0xa8'),_0xd19890);if(_0x5250ba[_0xd180('0xa9')]===-0x1){return _0x5250ba;}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xaa'),_0xd19890));};AGIVertices[_0xd180('0x12')][_0xd180('0xab')]=function(_0x533df4){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xac'),_0x533df4[_0xd180('0x35')]));if(!this['isConfigured'](_0x533df4[_0xd180('0xad')])){return this[_0xd180('0xf')]['noop'](_0xd180('0xae'));}var _0x414b7a=_0x533df4[_0xd180('0xad')];if(this[_0xd180('0xa7')](_0x533df4[_0xd180('0x75')])){_0x414b7a+=','+_0x533df4[_0xd180('0x75')];}var _0x27feed=this['channel'][_0xd180('0xaf')](_0xd180('0xb0'),_0x414b7a);if(_0x27feed[_0xd180('0xa9')]===-0x1){return _0x27feed;}var _0xfc14e5=this['getAndSetVariable'](_0xd180('0xb1'),'MRCP_RECOG_CONFIDENCE');if(_0xfc14e5[_0xd180('0xa9')]===-0x1){return _0xfc14e5;}var _0x3a3be6=this[_0xd180('0xb2')](_0xd180('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x3a3be6['result']===-0x1){return _0x3a3be6;}var _0xba017f=this[_0xd180('0xb2')](_0xd180('0xb4'),'MRCP_RECOG_INSTANCE');if(_0xba017f[_0xd180('0xa9')]===-0x1){return _0xba017f;}return this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0xb5'),_0x414b7a));};AGIVertices[_0xd180('0x12')][_0xd180('0x7')]=function(_0x4c49c3){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xb6'),_0x4c49c3['label']));return this[_0xd180('0xf')][_0xd180('0x7')]([_0x4c49c3[_0xd180('0xb7')],_0x4c49c3['args']]);};AGIVertices[_0xd180('0x12')][_0xd180('0xb8')]=function(_0x55c5cd){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xb9'),_0x55c5cd['label']));if(this[_0xd180('0xa7')](_0x55c5cd['timeout'])){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xba'),_0x55c5cd[_0xd180('0x63')]));var _0x476bf1=this[_0xd180('0xf')][_0xd180('0xbb')](_0x55c5cd[_0xd180('0x63')]);if(_0x476bf1[_0xd180('0xa9')]===-0x1){return _0x476bf1;}}return this['channel'][_0xd180('0xb8')]();};AGIVertices[_0xd180('0x12')][_0xd180('0x48')]=function(_0x129591){logger[_0xd180('0x2e')](util['format'](_0xd180('0xbc'),_0x129591[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x129591['list_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x129591,_0xd180('0xbd'));}_0x129591['scheduledAt']=moment();if(this[_0xd180('0xa7')](_0x129591[_0xd180('0xbe')])){_0x129591['scheduledAt']=moment()[_0xd180('0xbf')](_0x129591[_0xd180('0xbe')],_0xd180('0xc0'));}if(!this[_0xd180('0xa7')](_0x129591[_0xd180('0x4b')])){_0x129591[_0xd180('0x4b')]=0x2;}this['createCmContact'][_0xd180('0x6e')](this,_0x129591);return this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0xc1'),_0x129591[_0xd180('0x46')],_0x129591[_0xd180('0x47')],_0x129591[_0xd180('0x4a')]));};AGIVertices[_0xd180('0x12')]['custom_app']=function(_0x1f9707){logger['info'](util[_0xd180('0x2a')](_0xd180('0xc2'),_0x1f9707['label']));var _0x563ed8=this[_0xd180('0xf')]['exec'](_0x1f9707[_0xd180('0xc3')],_0x1f9707[_0xd180('0x75')]);if(_0x563ed8[_0xd180('0xa9')]===-0x1){return _0x563ed8;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s\x20%s',_0x1f9707[_0xd180('0xc3')],_0x1f9707[_0xd180('0x75')]));};AGIVertices['prototype'][_0xd180('0xc4')]=function(_0x3cdaf9){logger[_0xd180('0x2e')](util['format'](_0xd180('0xc5'),_0x3cdaf9[_0xd180('0x35')]));if(!this['isConfigured'](_0x3cdaf9[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}var _0x2a66ea='\x22'+_0x3cdaf9[_0xd180('0x5a')]+'\x22';if(this[_0xd180('0xa7')](_0x3cdaf9[_0xd180('0x75')])){_0x2a66ea+=','+_0x3cdaf9['options'];}var _0x39d986=this['channel'][_0xd180('0xaf')](_0xd180('0xa8'),_0x2a66ea);if(_0x39d986[_0xd180('0xa9')]===-0x1){return _0x39d986;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xaa'),_0x2a66ea));};AGIVertices[_0xd180('0x12')]['sestektts']=function(_0x235000){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x235000['label']));if(!this[_0xd180('0xa7')](_0x235000[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}var _0x5aa243='\x22'+_0x235000[_0xd180('0x5a')]+'\x22';if(this[_0xd180('0xa7')](_0x235000['options'])){_0x5aa243+=','+_0x235000[_0xd180('0x75')];}var _0x571208=this[_0xd180('0xf')]['exec'](_0xd180('0xa8'),_0x5aa243);if(_0x571208[_0xd180('0xa9')]===-0x1){return _0x571208;}return this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xaa'),_0x5aa243));};AGIVertices['prototype'][_0xd180('0xc7')]=function(_0x29239f){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xc8'),_0x29239f['label']));if(!this[_0xd180('0xa7')](_0x29239f[_0xd180('0xad')])){return this[_0xd180('0xf')]['noop']('no\x20grammar\x20configured');}var _0x21df88=_0x29239f[_0xd180('0xad')];if(this[_0xd180('0xa7')](_0x29239f['options'])){_0x21df88+=','+_0x29239f['options'];}var _0x41b945=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0xb0'),_0x21df88);if(_0x41b945[_0xd180('0xa9')]===-0x1){return _0x41b945;}var _0x493aa3=this[_0xd180('0xb2')]('RECOG_CONFIDENCE()',_0xd180('0xc9'));if(_0x493aa3['result']===-0x1){return _0x493aa3;}var _0x3072d6=this['getAndSetVariable'](_0xd180('0xb3'),_0xd180('0xca'));if(_0x3072d6[_0xd180('0xa9')]===-0x1){return _0x3072d6;}var _0x202fbd=this[_0xd180('0xb2')](_0xd180('0xb4'),'LUMENVOX_ASR_INSTANCE');if(_0x202fbd[_0xd180('0xa9')]===-0x1){return _0x202fbd;}return this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0xb5'),_0x21df88));};AGIVertices[_0xd180('0x12')][_0xd180('0xcb')]=function(_0xc8d0bf){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xc8d0bf[_0xd180('0x35')]));if(!this['isConfigured'](_0xc8d0bf[_0xd180('0xad')])){return this[_0xd180('0xf')]['noop'](_0xd180('0xae'));}var _0x4679bc=_0xc8d0bf[_0xd180('0xad')];if(this[_0xd180('0xa7')](_0xc8d0bf[_0xd180('0x75')])){_0x4679bc+=','+_0xc8d0bf[_0xd180('0x75')];}var _0x2360f7=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0xb0'),_0x4679bc);if(_0x2360f7[_0xd180('0xa9')]===-0x1){return _0x2360f7;}var _0x31ccdb=this[_0xd180('0xb2')]('RECOG_CONFIDENCE()',_0xd180('0xcc'));if(_0x31ccdb[_0xd180('0xa9')]===-0x1){return _0x31ccdb;}var _0x2c3634=this[_0xd180('0xb2')](_0xd180('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x2c3634[_0xd180('0xa9')]===-0x1){return _0x2c3634;}var _0x4ab5f6=this[_0xd180('0xb2')](_0xd180('0xb4'),_0xd180('0xcd'));if(_0x4ab5f6[_0xd180('0xa9')]===-0x1){return _0x4ab5f6;}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xb5'),_0x4679bc));};AGIVertices['prototype'][_0xd180('0xce')]=function(_0x5d46cc){logger['info'](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5d46cc[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x5d46cc[_0xd180('0xcf')])){return this[_0xd180('0xf')]['error'](_0x5d46cc,_0xd180('0xd0'));}var _0x14eaa1=this[_0xd180('0x1c')][_0xd180('0x6e')](this,_0x5d46cc['odbc_id']);if(!_0x14eaa1){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x5d46cc,_0xd180('0xd1'));}if(!this[_0xd180('0xa7')](_0x5d46cc['query'])){return this[_0xd180('0xf')]['error'](_0x5d46cc,_0xd180('0xd2'));}var _0x261423=_0x5d46cc[_0xd180('0x2d')][_0xd180('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('query:\x20%s',_0x261423));var _0x217185=this['getQueryOdbc']['sync'](this,_0x14eaa1,_0x261423);this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x5d46cc,_0x261423);if(!this[_0xd180('0xa7')](_0x5d46cc[_0xd180('0xd3')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4959e0=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x5d46cc['variable_id']);if(!_0x4959e0){return this['channel'][_0xd180('0x4e')](_0x5d46cc,'no\x20variable\x20found');}var _0x4edd51=this;_0x217185['forEach'](function(_0x2e6a94,_0x2e2601){Object['keys'](_0x2e6a94)[_0xd180('0xd4')](function(_0x5b38d8){_0x4edd51['channel']['setVariable'](util[_0xd180('0x2a')](_0xd180('0xd5'),_0x4959e0,_0x2e2601,_0x5b38d8),_0x2e6a94[_0x5b38d8]);});});this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')]('%s_ROWS_COUNT',_0x4959e0),_0x217185[_0xd180('0x9a')]);return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xd6'),_0x4959e0));};AGIVertices[_0xd180('0x12')]['dial']=function(_0x529d6e){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x529d6e['label']));if(!this['isConfigured'](_0x529d6e[_0xd180('0xd7')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x529d6e,_0xd180('0xd8'));}var _0x426fb5=this[_0xd180('0x1e')]['sync'](this,_0x529d6e['sip_id']);if(!_0x426fb5){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x529d6e,_0xd180('0xd9'));}var _0xbd6c8f=this[_0xd180('0xf')]['exec'](_0xd180('0xda'),[util[_0xd180('0x2a')]('SIP/%s',_0x426fb5),_0x529d6e['timeout'],_0x529d6e['opts'],_0x529d6e[_0xd180('0x61')]]);if(_0xbd6c8f[_0xd180('0xa9')]===-0x1){return _0xbd6c8f;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s',_0xd180('0xda')));};AGIVertices[_0xd180('0x12')][_0xd180('0xdb')]=function(_0x2df58e){logger['info'](util[_0xd180('0x2a')](_0xd180('0xdc'),_0x2df58e[_0xd180('0x35')]));if(!this['isConfigured'](_0x2df58e[_0xd180('0x82')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xdd'));}if(!this[_0xd180('0xa7')](_0x2df58e[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}this['channel'][_0xd180('0xde')]=!![];this['createSquareDetailsReport'](_0x2df58e);this[_0xd180('0x40')](_0x2df58e[_0xd180('0x5a')],'in','','');this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xdf'),_0x2df58e[_0xd180('0x5a')]));var _0x1c4d0f=this['googleDialogflow'][_0xd180('0x6e')](this,_0x2df58e);if(_0x1c4d0f){for(var _0x59ce47 in _0x1c4d0f){if(_0x1c4d0f[_0xd180('0x93')](_0x59ce47)){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0xe0'),_0x59ce47[_0xd180('0xe1')]()),_0x1c4d0f[_0x59ce47]);}}this[_0xd180('0x40')](_0x1c4d0f[_0xd180('0xe2')],_0xd180('0xe3'),_0xd180('0xdb'),'');return this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xe4'),_0x1c4d0f[_0xd180('0xe2')]));}return this[_0xd180('0xf')]['error'](_0x2df58e,_0xd180('0xe5'));};AGIVertices['prototype']['dialogflowV2']=function(_0x46246b){logger[_0xd180('0x2e')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x46246b[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x79')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xe6'));}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x7a')])){return this[_0xd180('0xf')]['noop']('no\x20client_email\x20configured');}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x7b')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20private_key\x20configured');}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x7c')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xe7'));}if(!this[_0xd180('0xa7')](_0x46246b[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}this['channel'][_0xd180('0xde')]=!![];this[_0xd180('0x33')](_0x46246b);this[_0xd180('0x40')](_0x46246b['text'],'in','','');this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0xe8'),_0x46246b[_0xd180('0x5a')]));var _0x12976a=this[_0xd180('0x78')][_0xd180('0x6e')](this,_0x46246b);if(_0x12976a){for(var _0x49c169 in _0x12976a){if(_0x12976a[_0xd180('0x93')](_0x49c169)){if(_0x49c169!==_0xd180('0xe9')){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0xe0'),_0x49c169[_0xd180('0xe1')]()),_0x12976a[_0x49c169]);}}}this['createSquareMessage'](_0x12976a[_0xd180('0xe2')],_0xd180('0xe3'),'dialogflowV2',_0x12976a[_0xd180('0xe9')]);return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xea'),_0x12976a[_0xd180('0xe2')]));}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x46246b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xd180('0x12')][_0xd180('0xeb')]=function(_0x345c6b){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xec'),_0x345c6b[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x345c6b[_0xd180('0xed')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xee'));}if(!this[_0xd180('0xa7')](_0x345c6b['username'])){return this[_0xd180('0xf')]['noop'](_0xd180('0xef'));}if(!this[_0xd180('0xa7')](_0x345c6b[_0xd180('0xf0')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xf1'));}if(!this['isConfigured'](_0x345c6b['ndassistant_url'])){return this[_0xd180('0xf')]['noop']('no\x20text\x20configured');}this[_0xd180('0xf')][_0xd180('0xde')]=!![];this[_0xd180('0x33')](_0x345c6b);this[_0xd180('0x40')](_0x345c6b['text'],'in','','');this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xf2'),_0x345c6b[_0xd180('0x5a')]));var _0x5983f4=this[_0xd180('0x7d')]['sync'](this,_0x345c6b);if(_0x5983f4){for(var _0xa25b5d in _0x5983f4){if(_0x5983f4[_0xd180('0x93')](_0xa25b5d)){this['channel'][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0xf3'),_0xa25b5d['toUpperCase']()),_0x5983f4[_0xa25b5d]);}}this[_0xd180('0x40')](_0x5983f4[_0xd180('0xe2')],_0xd180('0xe3'),_0xd180('0xeb'),'');if(_0x5983f4[_0xd180('0xf4')]){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0xf5'),_0x5983f4[_0xd180('0xf4')]));var _0x44eff0=this[_0xd180('0xf')][_0xd180('0xf6')](_0x5983f4[_0xd180('0xf4')]);try{fs['unlink'](_0x5983f4[_0xd180('0xf4')]+_0xd180('0xf7'));}catch(_0x192792){logger[_0xd180('0x4e')](_0x192792);}return _0x44eff0;}else{return this['channel']['noop'](util['format'](_0xd180('0xf8'),_0x5983f4[_0xd180('0xe2')]));}}return this['channel']['error'](_0x345c6b,_0xd180('0xf9'));};AGIVertices['prototype'][_0xd180('0xfa')]=function(_0x16d492){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xfb'),_0x16d492[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0xa6')]('end');};AGIVertices[_0xd180('0x12')][_0xd180('0xfc')]=function(_0x4fe5eb){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0xfd'),_0x4fe5eb[_0xd180('0x35')]));var _0x58c82d='';if(_0x4fe5eb[_0xd180('0xfe')]){if(!this[_0xd180('0xa7')](_0x4fe5eb[_0xd180('0xfe')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x4fe5eb,_0xd180('0xff'));}else{var _0xcb941e=parseInt(_0x4fe5eb[_0xd180('0xfe')],0xa);if(isNaN(_0xcb941e)){_0x58c82d=_0x4fe5eb[_0xd180('0xfe')];}else{_0x58c82d=this['getTrunk'][_0xd180('0x6e')](this,_0x4fe5eb[_0xd180('0xfe')]);if(!_0x58c82d){return this['channel'][_0xd180('0x4e')](_0x4fe5eb,_0xd180('0x100'));}}}}else if(_0x4fe5eb[_0xd180('0x101')]){_0x58c82d=_0x4fe5eb[_0xd180('0x101')];}else{return this[_0xd180('0xf')]['error'](_0x4fe5eb,_0xd180('0xff'));}var _0x541eb0=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0xda'),[util[_0xd180('0x2a')](_0xd180('0x102'),_0x58c82d,_0x4fe5eb[_0xd180('0x46')]),_0x4fe5eb[_0xd180('0x63')],_0x4fe5eb[_0xd180('0x103')],_0x4fe5eb[_0xd180('0x61')]]);if(_0x541eb0[_0xd180('0xa9')]===-0x1){return _0x541eb0;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s',_0xd180('0xda')));};AGIVertices[_0xd180('0x12')][_0xd180('0x104')]=function(_0x3b68ce){logger[_0xd180('0x2e')](util['format'](_0xd180('0x105'),_0x3b68ce[_0xd180('0x35')]));return this['channel'][_0xd180('0xa6')](_0xd180('0x104'));};AGIVertices[_0xd180('0x12')][_0xd180('0xd')]=function(_0xd5b788){logger[_0xd180('0x2e')](util['format'](_0xd180('0x106'),_0xd5b788['label']));if(_0xd5b788['retry']===0x0){return this[_0xd180('0xa3')](_0xd5b788);}_0xd5b788[_0xd180('0xa4')]-=0x1;if(!this[_0xd180('0xa7')](_0xd5b788['file_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0xd5b788,_0xd180('0x107'));}var _0x1f4c2d=this[_0xd180('0x108')][_0xd180('0x6e')](this,_0xd5b788[_0xd180('0x109')]);if(!_0x1f4c2d){return this['channel']['error'](_0xd5b788,_0xd180('0x10a'));}if(!this[_0xd180('0xa7')](_0xd5b788['variable_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0xd180('0x10b'));}var _0x3212ff=this['channel'][_0xd180('0x10c')](_0x1f4c2d,_0xd5b788[_0xd180('0x10d')],_0xd5b788['maxdigit']);var _0x1e4324=_0x3212ff['result']?_0x3212ff[_0xd180('0xa9')][_0xd180('0xa0')]():'';logger[_0xd180('0x2e')](_0xd180('0x10e'),JSON[_0xd180('0x71')](_0x3212ff));if(_0x3212ff[_0xd180('0xa9')]===-0x1){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0xd5b788,_0x1e4324);return _0x3212ff;}else if(_0x3212ff['extra']===_0xd180('0x63')){_0x3212ff[_0xd180('0xa9')]=_0x1e4324[_0xd180('0x9a')]>=parseInt(_0xd5b788[_0xd180('0x10f')])?'x':'i';}else{_0x3212ff[_0xd180('0xa9')]=_0x1e4324[_0xd180('0x9a')]>=parseInt(_0xd5b788[_0xd180('0x10f')])&&_0x1e4324[_0xd180('0x9a')]<=parseInt(_0xd5b788[_0xd180('0x110')])?'x':'i';}var _0x1d887a=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0xd5b788[_0xd180('0xd3')]);if(!_0x1d887a){return this[_0xd180('0xf')]['error'](_0xd5b788,'no\x20variable\x20found');}this[_0xd180('0xf')][_0xd180('0x9d')](_0x1d887a,_0x1e4324);if(this[_0xd180('0xa7')](_0xd5b788[_0xd180('0x111')])){var _0x23847a=parseInt(_0xd5b788['hiddendigitsnum'],0xa);var _0x3d8bef=rs['generate']({'charset':'*','length':_0x23847a});var _0x14f3ed=_0x1e4324[_0xd180('0x9a')];if(_0x14f3ed>0x0){if(_0x14f3ed>_0x23847a){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0xd5b788,_0xd5b788['hiddendigitspos']==='first'?_0x3d8bef+_0x1e4324[_0xd180('0x112')](_0x23847a):_0x1e4324[_0xd180('0x112')](0x0,_0x14f3ed-_0x23847a)+_0x3d8bef);}else{this['createSquareDetailsReport'][_0xd180('0x6e')](this,_0xd5b788,rs[_0xd180('0x113')]({'charset':'*','length':_0x14f3ed}));}}else{this[_0xd180('0x33')]['sync'](this,_0xd5b788,'');}}else{this[_0xd180('0x33')][_0xd180('0x6e')](this,_0xd5b788,_0x1e4324);}return _0x3212ff;};AGIVertices[_0xd180('0x12')]['getsecretdigits']=function(_0x473a6b){logger['info'](util[_0xd180('0x2a')](_0xd180('0x114'),_0x473a6b[_0xd180('0x35')]));return this[_0xd180('0xd')](_0x473a6b);};AGIVertices[_0xd180('0x12')][_0xd180('0x115')]=function(_0x348ea0){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x348ea0['label']));this['createSquareDetailsReport'][_0xd180('0x6e')](this,_0x348ea0,_0x348ea0[_0xd180('0x116')]);return this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0x117'),_0x348ea0[_0xd180('0x116')]));};AGIVertices['prototype'][_0xd180('0x118')]=function(_0x17f5b0){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x119'),_0x17f5b0[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x17f5b0[_0xd180('0x85')])||!this[_0xd180('0xa7')](_0x17f5b0[_0xd180('0x86')])){return this['channel'][_0xd180('0xa6')](_0xd180('0x11a'));}if(!this[_0xd180('0xa7')](_0x17f5b0['text'])){return this['channel'][_0xd180('0xa6')](_0xd180('0xc6'));}this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x11b'),_0x17f5b0[_0xd180('0x5a')]));var _0x400b73=this[_0xd180('0x11c')]['sync'](this,_0x17f5b0);if(_0x400b73){this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x11d'),_0x400b73));var _0x31aa19=this[_0xd180('0xf')]['streamFile'](_0x400b73);try{fs[_0xd180('0x11e')](_0x400b73+_0xd180('0xf7'));}catch(_0x4955c6){logger[_0xd180('0x4e')](_0x4955c6);}return _0x31aa19;}return this['channel'][_0xd180('0x4e')](_0x17f5b0,_0xd180('0x11f'));};AGIVertices[_0xd180('0x12')][_0xd180('0x120')]=function(_0x4c32f9){logger['info'](util[_0xd180('0x2a')](_0xd180('0x121'),_0x4c32f9['label']));if(!this[_0xd180('0xa7')](_0x4c32f9[_0xd180('0x85')])||!this['isConfigured'](_0x4c32f9['aws_secret_access_key'])){return this['channel']['noop'](_0xd180('0x11a'));}if(!this[_0xd180('0xa7')](_0x4c32f9[_0xd180('0x8c')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x122'));}if(!this[_0xd180('0xa7')](_0x4c32f9['text'])){return this['channel'][_0xd180('0xa6')](_0xd180('0xc6'));}this[_0xd180('0xf')][_0xd180('0xde')]=!![];this[_0xd180('0x33')](_0x4c32f9);this['createSquareMessage'](_0x4c32f9[_0xd180('0x5a')],'in','','');this[_0xd180('0xf')][_0xd180('0xa6')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x4c32f9[_0xd180('0x5a')]));var _0x4395af=this[_0xd180('0x8a')][_0xd180('0x6e')](this,_0x4c32f9);if(_0x4395af){for(var _0x3ffadb in _0x4395af){if(_0x4395af[_0xd180('0x93')](_0x3ffadb)&&_[_0xd180('0x94')](_0x4395af[_0x3ffadb])){this['channel']['setVariable'](util[_0xd180('0x2a')]('AWS_LEX_%s',_0x3ffadb[_0xd180('0xe1')]()),_0x4395af[_0x3ffadb]);}}if(_[_0xd180('0x42')](_0x4395af[_0xd180('0x74')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x123'));}else{this[_0xd180('0x40')](_0x4395af[_0xd180('0x74')],_0xd180('0xe3'),_0xd180('0x124'),'');return this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0x125'),_0x4395af['message']));}}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x4c32f9,_0xd180('0x126'));};AGIVertices['prototype'][_0xd180('0x127')]=function(_0x25f0fc){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x25f0fc[_0xd180('0x35')],_0x25f0fc[_0xd180('0x63')]));if(!this[_0xd180('0xa7')](_0x25f0fc['key'])){return this['channel'][_0xd180('0xa6')](_0xd180('0xdd'));}var _0x8411d5=_0xd180('0x128');var _0x571d89=util['format'](_0xd180('0x129'),FILES_PATH,rs[_0xd180('0x113')](0x4));var _0xe62729=util['format']('%s.%s',_0x571d89,_0x8411d5);var _0x599765=!![];if(_0x25f0fc[_0xd180('0x12a')]==='NOBEEP'){_0x599765=![];}var _0xb0a06a=this[_0xd180('0xf')]['recordFile'](_0x571d89,_0x8411d5,_0x25f0fc[_0xd180('0x12b')],_0x25f0fc['timeout'],undefined,_0x599765);if(_0xb0a06a[_0xd180('0xa9')]!==-0x1){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x12c'),_0xe62729));var _0x130c49=this[_0xd180('0x8d')]['sync'](this,_0x25f0fc,_0xe62729);if(_0x130c49){for(var _0x4d60c6 in _0x130c49){if(_0x130c49[_0xd180('0x93')](_0x4d60c6)){this[_0xd180('0xf')]['setVariable'](util[_0xd180('0x2a')](_0xd180('0x12d'),_0x4d60c6[_0xd180('0xe1')]()),_0x130c49[_0x4d60c6]);}}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x12e'),JSON[_0xd180('0x71')](_0x130c49)));}}return _0xb0a06a;};AGIVertices['prototype'][_0xd180('0x12f')]=function(_0x4e5f79){logger['info'](util['format'](_0xd180('0x130'),_0x4e5f79['label']));if(!this[_0xd180('0xa7')](_0x4e5f79[_0xd180('0x90')])){return this['channel'][_0xd180('0xa6')](_0xd180('0x131'));}if(!this[_0xd180('0xa7')](_0x4e5f79[_0xd180('0x132')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x133'));}var _0x1fa624=_0xd180('0x128');var _0xf5f18e=util[_0xd180('0x2a')](_0xd180('0x129'),FILES_PATH,rs[_0xd180('0x113')](0x4));var _0x447e8d=util[_0xd180('0x2a')](_0xd180('0x9c'),_0xf5f18e,_0x1fa624);var _0x318d76=!![];if(_0x4e5f79['beep']===_0xd180('0x134')){_0x318d76=![];}var _0x25b0c7=this['channel'][_0xd180('0x135')](_0xf5f18e,_0x1fa624,_0x4e5f79[_0xd180('0x12b')],_0x4e5f79['timeout'],undefined,_0x318d76);if(_0x25b0c7[_0xd180('0xa9')]!==-0x1){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('tilde\x20%s\x20file\x20created',_0x447e8d));var _0x344f75=this[_0xd180('0x8f')][_0xd180('0x6e')](this,_0x4e5f79,_0x447e8d);if(_0x344f75){for(var _0x31f204 in _0x344f75){if(_0x344f75[_0xd180('0x93')](_0x31f204)){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0x136'),_0x31f204['toUpperCase']()),_0x344f75[_0x31f204]);}}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x137'),JSON['stringify'](_0x344f75)));}}return _0x25b0c7;};AGIVertices[_0xd180('0x12')][_0xd180('0x138')]=function(_0x3f7c78){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x139'),_0x3f7c78[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0x13a')](_0x3f7c78[_0xd180('0x3b')],_0x3f7c78[_0xd180('0x3c')],_0x3f7c78[_0xd180('0x13b')]);};AGIVertices[_0xd180('0x12')]['gotoif']=function(_0x495a97){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x13c'),_0x495a97['label']));if(!this['isConfigured'](_0x495a97[_0xd180('0x13d')])){return this['channel'][_0xd180('0x4e')](_0x495a97,_0xd180('0x13e'));}try{var _0x5bce1f=eval(_0x495a97[_0xd180('0x13d')])?_0xd180('0x13f'):_0xd180('0x140');this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0x495a97[_0xd180('0x13d')],_0x5bce1f));return{'code':0xc8,'result':_0x5bce1f};}catch(_0x205e9f){return{'code':0xc8,'result':_0xd180('0x140')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x141')]=function(_0x53a6f5){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x142'),_0x53a6f5[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x53a6f5[_0xd180('0x143')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x53a6f5,'no\x20interval\x20configured');}var _0x301c66=this['getIntervals'][_0xd180('0x6e')](this,_0x53a6f5['interval_id']);if(!_0x301c66){return this['channel'][_0xd180('0x4e')](_0x53a6f5,_0xd180('0x144'));}for(var _0x2ee832=0x0;_0x2ee832<_0x301c66['length'];_0x2ee832+=0x1){var _0x4c83f1=this['channel']['getVariable'](util[_0xd180('0x2a')](_0xd180('0x145'),_0x301c66[_0x2ee832]));if(_0x4c83f1[_0xd180('0xa9')]===-0x1){return _0x4c83f1;}logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('IFTIME\x20%s\x20%s',_0x301c66[_0x2ee832],_0x4c83f1['extra']));if(_0x4c83f1[_0xd180('0xa2')]===_0xd180('0x13f')){logger['info'](util[_0xd180('0x2a')](_0xd180('0x146'),_0x301c66[_0x2ee832],_0xd180('0x13f')));this['channel']['noop'](util[_0xd180('0x2a')]('IFTIME\x20%s\x20%s',_0x301c66[_0x2ee832],_0xd180('0x13f')));return{'code':0xc8,'result':_0xd180('0x13f')};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x146'),_0x301c66[_0x2ee832],_0xd180('0x140')));this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('IFTIME\x20%s\x20%s',_0x301c66[_0x2ee832],_0xd180('0x140')));}}return{'code':0xc8,'result':_0xd180('0x140')};};AGIVertices['prototype'][_0xd180('0x147')]=function(_0x56f68f){logger['info'](util[_0xd180('0x2a')](_0xd180('0x148'),_0x56f68f['label']));return this[_0xd180('0xf')][_0xd180('0x147')]();};AGIVertices['prototype'][_0xd180('0x149')]=function(_0x9bdb93){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x14a'),_0x9bdb93['label']));if(!this[_0xd180('0xa7')](_0x9bdb93[_0xd180('0x82')])){return this['channel'][_0xd180('0xa6')](_0xd180('0xdd'));}var _0x177e18=_0xd180('0x128');var _0x532a4b=util[_0xd180('0x2a')](_0xd180('0x129'),FILES_PATH,rs[_0xd180('0x113')](0x4));var _0xb8f0db=util[_0xd180('0x2a')]('%s.%s',_0x532a4b,_0x177e18);var _0x2a8a0e=!![];if(_0x9bdb93[_0xd180('0x12a')]===_0xd180('0x134')){_0x2a8a0e=![];}var _0x54e8b1=this['channel'][_0xd180('0x135')](_0x532a4b,_0x177e18,_0x9bdb93[_0xd180('0x12b')],_0x9bdb93[_0xd180('0x63')],undefined,_0x2a8a0e);if(_0x54e8b1[_0xd180('0xa9')]!==-0x1){this[_0xd180('0xf')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0xb8f0db));var _0x16fa13=this['ispeechASR'][_0xd180('0x6e')](this,_0x9bdb93,_0xb8f0db);if(_0x16fa13){for(var _0xd0cc03 in _0x16fa13){if(_0x16fa13[_0xd180('0x93')](_0xd0cc03)){this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0x14b'),_0xd0cc03[_0xd180('0xe1')]()),_0x16fa13[_0xd0cc03]);}}return this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')]('IspeechASR\x20Result\x20%s',JSON[_0xd180('0x71')](_0x16fa13)));}}return _0x54e8b1;};AGIVertices[_0xd180('0x12')][_0xd180('0x14c')]=function(_0x3aee70){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x14d'),_0x3aee70['label']));if(!this[_0xd180('0xa7')](_0x3aee70['key'])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xdd'));}if(!this[_0xd180('0xa7')](_0x3aee70['text'])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20text\x20configured');}this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x14e'),_0x3aee70[_0xd180('0x5a')]));var _0x71d36c=this['ispeechTTS'][_0xd180('0x6e')](this,_0x3aee70);if(_0x71d36c){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x14f'),_0x71d36c));var _0x220bfe=this[_0xd180('0xf')][_0xd180('0xf6')](_0x71d36c,_0x3aee70[_0xd180('0x12b')]);try{fs[_0xd180('0x11e')](_0x71d36c+_0xd180('0xf7'));}catch(_0x368392){logger[_0xd180('0x4e')](_0x368392);}return _0x220bfe;}return this[_0xd180('0xf')]['error'](_0x3aee70,_0xd180('0x150'));};AGIVertices[_0xd180('0x12')]['login']=function(_0x59c480){logger[_0xd180('0x2e')](util['format'](_0xd180('0x151'),_0x59c480['label']));if(!this['isConfigured'](_0x59c480['findBy'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x59c480,_0xd180('0x152'));}logger[_0xd180('0x2e')](util['format'](_0xd180('0x153'),this['channel'][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));var _0x408860=this['agentLogin']['sync'](this,_0x59c480[_0xd180('0x154')]);if(_0x408860){logger['info'](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')]['callerid'],_0x59c480['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0x59c480[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x157')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x158')]=function(_0x20131c){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x159'),_0x20131c['label']));if(!this[_0xd180('0xa7')](_0x20131c[_0xd180('0x154')])){return this['channel'][_0xd180('0x4e')](_0x20131c,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd180('0x2a')](_0xd180('0x153'),this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));var _0x37cb28=this['agentLogout'][_0xd180('0x6e')](this,_0x20131c[_0xd180('0x154')]);if(_0x37cb28){logger[_0xd180('0x2e')](util['format'](_0xd180('0x155'),this['channel'][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));this[_0xd180('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x15a')};}else{logger[_0xd180('0x2e')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0x20131c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd180('0x12')][_0xd180('0x15b')]=function(_0x306fac){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x15c'),_0x306fac['label']));if(!this[_0xd180('0xa7')](_0x306fac[_0xd180('0x15d')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x306fac,_0xd180('0x15e'));}this['channel'][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x15f'),_0x306fac['operation']));var _0x3b2e7f=eval(_0x306fac[_0xd180('0x15d')]);if(!this[_0xd180('0xa7')](_0x306fac[_0xd180('0xd3')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x10b'));}var _0xaed2ee=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x306fac[_0xd180('0xd3')]);if(!_0xaed2ee){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x306fac,_0xd180('0x160'));}if(_[_0xd180('0x99')](_0x3b2e7f)){var _0x5941ca=this;_0x3b2e7f['forEach'](function(_0x3f26b4,_0x55b1ad){_0x5941ca['channel'][_0xd180('0x9d')](util['format'](_0xd180('0x161'),_0xaed2ee,_0x55b1ad),_0x3f26b4);});return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x162'),_0xaed2ee));}else{return this[_0xd180('0xf')][_0xd180('0x9d')](_0xaed2ee,_0x3b2e7f);}};AGIVertices[_0xd180('0x12')]['menu']=function(_0x472a60){logger['info'](util[_0xd180('0x2a')](_0xd180('0x163'),_0x472a60[_0xd180('0x35')]));if(_0x472a60['retry']===0x0){return this['maxRetry'](_0x472a60);}_0x472a60[_0xd180('0xa4')]-=0x1;if(!this[_0xd180('0xa7')](_0x472a60[_0xd180('0x109')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x472a60,_0xd180('0x107'));}var _0x1a2df4=this['getSound']['sync'](this,_0x472a60[_0xd180('0x109')]);if(!_0x1a2df4){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x472a60,_0xd180('0x10a'));}var _0x481543=this[_0xd180('0xf')]['getData'](_0x1a2df4,_0x472a60[_0xd180('0x10d')],_0x472a60[_0xd180('0x164')]);var _0x5724bf=_0x481543['result'];if(_0x481543[_0xd180('0xa9')]===-0x1){this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x472a60,'-1');return _0x481543;}else if(_0x481543['extra']===_0xd180('0x63')){_0x481543[_0xd180('0xa9')]=_0x481543['result']['length']>0x0?_0x481543[_0xd180('0xa9')]:'t';}else if(_[_0xd180('0x41')](_0x481543[_0xd180('0xa9')])){_0x481543['result']='#';_0x5724bf='#';}if(!this[_0xd180('0xa7')](_0x472a60['variable_id'])){this['channel'][_0xd180('0xa6')](_0xd180('0x10b'));}else{var _0xe6bb0e=this['getVariable']['sync'](this,_0x472a60[_0xd180('0xd3')]);if(!_0xe6bb0e){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x472a60,_0xd180('0x160'));}this[_0xd180('0xf')][_0xd180('0x9d')](_0xe6bb0e,_0x5724bf);}this[_0xd180('0x33')]['sync'](this,_0x472a60,_0x5724bf);return _0x481543;};AGIVertices[_0xd180('0x12')][_0xd180('0xa6')]=function(_0x1625be){logger['info'](util[_0xd180('0x2a')](_0xd180('0x165'),_0x1625be[_0xd180('0x35')]));return this['channel'][_0xd180('0xa6')](_0x1625be[_0xd180('0x166')]||_0x1625be[_0xd180('0x35')]);};AGIVertices[_0xd180('0x12')][_0xd180('0x167')]=function(_0xa44a57){logger[_0xd180('0x2e')](util['format'](_0xd180('0x168'),_0xa44a57['label']));if(!this[_0xd180('0xa7')](_0xa44a57[_0xd180('0x154')])){return this[_0xd180('0xf')]['error'](_0xa44a57,_0xd180('0x152'));}logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd180('0xf')][_0xd180('0x38')],_0xa44a57['findBy']));var _0x5d5418=this[_0xd180('0x169')][_0xd180('0x6e')](this,_0xa44a57[_0xd180('0x16a')]);var _0x254bcf=this[_0xd180('0x4c')]['sync'](this,_0xa44a57['findBy'],_0x5d5418);if(_0x254bcf){logger['info'](util[_0xd180('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd180('0xf')]['callerid'],_0xa44a57[_0xd180('0x154')]));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0xa44a57[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x15a')};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x156'),this[_0xd180('0xf')][_0xd180('0x38')],_0xa44a57['findBy']));this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')][_0xd180('0x38')],_0xa44a57[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x157')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x16b')]=function(_0x809229){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x16c'),_0x809229[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x809229[_0xd180('0x109')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x809229,_0xd180('0x107'));}var _0x315b94=this[_0xd180('0x108')][_0xd180('0x6e')](this,_0x809229['file_id']);if(!_0x315b94){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x809229,_0xd180('0x10a'));}var _0x55887f=this['channel']['exec'](_0xd180('0x16d'),[_0x315b94,_0x809229[_0xd180('0x103')]]);if(_0x55887f['result']===-0x1){return _0x55887f;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x16e'),_0xd180('0x16d'),_0x315b94));};AGIVertices[_0xd180('0x12')]['queue']=function(_0x40c8ed){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x40c8ed[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x40c8ed[_0xd180('0x16f')])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x40c8ed,_0xd180('0x170'));}var _0x5ea932='';var _0x1c0923=parseInt(_0x40c8ed[_0xd180('0x16f')],0xa);if(isNaN(_0x1c0923)){_0x5ea932=_0x40c8ed[_0xd180('0x16f')];}else{_0x5ea932=this[_0xd180('0x18')][_0xd180('0x6e')](this,_0x40c8ed[_0xd180('0x16f')]);if(!_0x5ea932){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x40c8ed,_0xd180('0x171'));}}var _0x51645e='';if(this[_0xd180('0xa7')](_0x40c8ed['file_id'])){var _0x139737=this[_0xd180('0x108')][_0xd180('0x6e')](this,_0x40c8ed[_0xd180('0x109')]);if(_0x139737){_0x51645e=_0x139737;}}this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x40c8ed,_0x5ea932);if(_0x40c8ed['opts'][_0xd180('0x172')]('x')<0x0){_0x40c8ed['opts']+='x';}if(_0x40c8ed[_0xd180('0x103')][_0xd180('0x172')]('X')<0x0){_0x40c8ed['opts']+='X';}this[_0xd180('0xf')][_0xd180('0x9d')](_0xd180('0x173'),_0x5ea932?_0x5ea932[_0xd180('0x174')]():'');var _0x4eb833=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0x175'),[_0x5ea932,_0x40c8ed[_0xd180('0x103')],_0x40c8ed[_0xd180('0x61')],_0x51645e,_0x40c8ed[_0xd180('0x63')],_0x40c8ed['agi'],_0x40c8ed['macro'],_0x40c8ed[_0xd180('0x176')],'',_0x40c8ed[_0xd180('0x177')]]);if(_0x4eb833[_0xd180('0xa9')]===-0x1){return _0x4eb833;}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Executed\x20command\x20%s\x20%s',_0xd180('0x175'),_0x5ea932));};AGIVertices['prototype']['record']=function(_0x35d84a){logger['info'](util[_0xd180('0x2a')](_0xd180('0x178'),_0x35d84a['label']));var _0x90b9aa=_0x35d84a[_0xd180('0x179')]||'wav';var _0x40a677=util['format'](_0xd180('0x17a'),this[_0xd180('0xf')]['uniqueid'],rs[_0xd180('0x113')](0x5));var _0x540534=util[_0xd180('0x2a')](_0xd180('0x17b'),FILES_PATH,_0x40a677,_0x90b9aa);var _0x17519d=util[_0xd180('0x2a')](_0xd180('0x129'),FILES_PATH,_0x40a677);this[_0xd180('0x39')][_0xd180('0x6e')](this,_0x35d84a,_0x40a677,_0x540534);this[_0xd180('0xf')][_0xd180('0x9d')](_0xd180('0x17c'),_0x40a677);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x17519d,_0x90b9aa,_0x35d84a[_0xd180('0x17d')],_0x35d84a[_0xd180('0x63')]);return this[_0xd180('0xf')]['recordFile'](_0x17519d,_0x90b9aa,_0x35d84a[_0xd180('0x17d')],_0x35d84a[_0xd180('0x63')],undefined,!![]);};AGIVertices[_0xd180('0x12')][_0xd180('0x17e')]=function(_0x4a338b){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x17f'),_0x4a338b[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x4a338b[_0xd180('0x61')])){return this['channel'][_0xd180('0xa6')](_0xd180('0x180'));}var _0x5a3706=this[_0xd180('0x60')][_0xd180('0x6e')](this,_0x4a338b);logger['info'](util['format'](_0xd180('0x181'),util['inspect'](_0x5a3706,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4a338b[_0xd180('0xd3')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x182'));}var _0x42ba81=this[_0xd180('0x13')]['sync'](this,_0x4a338b[_0xd180('0xd3')]);if(!_0x42ba81){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x4a338b,_0xd180('0x160'));}this[_0xd180('0xf')][_0xd180('0x9d')](util[_0xd180('0x2a')](_0xd180('0x183'),_0x42ba81),_0x5a3706[_0xd180('0x72')]?_0x5a3706[_0xd180('0x72')]:_0xd180('0x184'));this[_0xd180('0xf')]['setVariable'](util['format'](_0xd180('0x185'),_0x42ba81),_0x5a3706[_0xd180('0x73')]?_0x5a3706[_0xd180('0x73')]:'OK');if(_0x5a3706[_0xd180('0x67')]){try{this['saveRestApiResult'](_0x5a3706[_0xd180('0x67')],_0x42ba81);}catch(_0x37348f){logger['error'](util[_0xd180('0x2a')](_0xd180('0x186'),_0x42ba81));}}return this[_0xd180('0xf')]['noop'](util[_0xd180('0x2a')](_0xd180('0xd6'),_0x42ba81));};AGIVertices['prototype']['saydigits']=function(_0x23fd08){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x23fd08[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0x187')](_0x23fd08[_0xd180('0x188')]['replace'](/\s+/g,''),_0x23fd08[_0xd180('0x17d')]);};AGIVertices[_0xd180('0x12')]['saynumber']=function(_0x59b4da){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x189'),_0x59b4da[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0x18a')](_0x59b4da[_0xd180('0x64')][_0xd180('0x56')](/\s+/g,''),_0x59b4da[_0xd180('0x17d')]);};AGIVertices[_0xd180('0x12')][_0xd180('0x18b')]=function(_0xda8ea5){logger['info'](util[_0xd180('0x2a')](_0xd180('0x18c'),_0xda8ea5['label']));return this[_0xd180('0xf')][_0xd180('0x18d')](_0xda8ea5[_0xd180('0x5a')],_0xda8ea5[_0xd180('0x17d')]);};AGIVertices[_0xd180('0x12')]['sendMail']=function(_0x2028eb){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2028eb['label']));if(!this['isConfigured'](_0x2028eb[_0xd180('0x18e')])){return this[_0xd180('0xf')]['noop'](_0xd180('0x18f'));}var _0x3a24e1=this[_0xd180('0x22')]['sync'](this,_0x2028eb[_0xd180('0x18e')]);if(!_0x3a24e1||!_0x3a24e1[_0xd180('0x190')]){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x2028eb,_0xd180('0x191'));}var _0x2f5960={'from':util[_0xd180('0x2a')]('\x22%s\x22\x20<%s>',_0x3a24e1[_0xd180('0x16')],_0x3a24e1['email']||_0x3a24e1['Smtp'][_0xd180('0x192')]),'to':_0x2028eb['to']||'','cc':_0x2028eb['cc']||'','bcc':_0x2028eb[_0xd180('0x193')]||'','subject':_0x2028eb['subject'],'html':_0x2028eb[_0xd180('0x5a')],'text':_0x2028eb[_0xd180('0x5a')]};if(this['isConfigured'](_0x2028eb['template_id'])){}logger[_0xd180('0x194')]('sendMail\x20message',JSON[_0xd180('0x71')](_0x2f5960));this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x2028eb,_0x2028eb[_0xd180('0x18e')]);this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x195'),_0x3a24e1[_0xd180('0x16')]));this[_0xd180('0x24')][_0xd180('0x6e')](this,_0x3a24e1[_0xd180('0x196')],_0x2f5960);return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x197'));};AGIVertices['prototype'][_0xd180('0x198')]=function(_0x196f1b){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x199'),_0x196f1b[_0xd180('0x35')]));return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x19a'));};AGIVertices[_0xd180('0x12')][_0xd180('0x19b')]=function(_0x1adfc1){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x19c'),_0x1adfc1[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x1adfc1['sms_account_id'])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20sms\x20account\x20configured');}var _0x379f94=this[_0xd180('0x30')][_0xd180('0x6e')](this,_0x1adfc1[_0xd180('0x19d')]);if(!_0x379f94){return this[_0xd180('0xf')]['error'](_0x1adfc1,'no\x20sms\x20account\x20found');}var _0x2a2c2d={'body':_0x1adfc1['sms_text'],'phone':_0x1adfc1['to']||'','SmsAccountId':_0x379f94['id']};logger[_0xd180('0x194')](_0xd180('0x19e'),JSON[_0xd180('0x71')](_0x2a2c2d));this[_0xd180('0x33')][_0xd180('0x6e')](this,_0x1adfc1,_0x1adfc1[_0xd180('0x19d')]);this[_0xd180('0xf')]['noop'](util['format'](_0xd180('0x19f'),_0x379f94[_0xd180('0x16')]));this['createSmsMessage']['sync'](this,_0x2a2c2d);return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1a0'));};AGIVertices[_0xd180('0x12')][_0xd180('0x1a1')]=function(_0x2408d8){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x1a2'),_0x2408d8[_0xd180('0x35')]));if(!this[_0xd180('0xa7')](_0x2408d8['variable_id'])){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x2408d8,_0xd180('0x1a3'));}var _0x293864=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x2408d8['variable_id']);if(!_0x293864){return this['channel'][_0xd180('0x4e')](_0x2408d8,_0xd180('0x160'));}return this['channel'][_0xd180('0x9d')](_0x293864,_0x2408d8[_0xd180('0x1a4')]);};AGIVertices[_0xd180('0x12')][_0xd180('0x1a5')]=function(_0x29b6c0){logger['info'](util[_0xd180('0x2a')](_0xd180('0x1a6'),_0x29b6c0[_0xd180('0x35')]));this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1a7'));if(_0x29b6c0['answer']===_0xd180('0x1a8')){this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1a9'));return this[_0xd180('0xf')][_0xd180('0xb8')]();}return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1aa'));};AGIVertices[_0xd180('0x12')][_0xd180('0x1ab')]=function(_0x1c143f){logger['info'](util[_0xd180('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1c143f['label']));if(!this[_0xd180('0xa7')](_0x1c143f[_0xd180('0x1ac')])){return this[_0xd180('0xf')]['error'](_0x1c143f,'no\x20subproject\x20selected');}var _0x206b6b=this[_0xd180('0x1a')][_0xd180('0x6e')](this,_0x1c143f['project_id']);if(!this['isConfigured'](_0x206b6b)){return this[_0xd180('0xf')][_0xd180('0x4e')](_0x1c143f,util[_0xd180('0x2a')](_0xd180('0x1ad'),_0x1c143f[_0xd180('0x1ac')]));}if(_0x206b6b===this['channel']['arg_1']){return this['channel']['error'](_0x1c143f,_0xd180('0x1ae'));}this['createSquareDetailsReport'][_0xd180('0x6e')](this,_0x1c143f,_0x206b6b);var _0x258640=this[_0xd180('0xf')][_0xd180('0xaf')](_0xd180('0x1af'),util[_0xd180('0x2a')](_0xd180('0x1b0'),config[_0xd180('0x7')]['host']||_0xd180('0x1b1'),_0x206b6b,this[_0xd180('0xf')][_0xd180('0x37')]));if(_0x258640[_0xd180('0xa9')]===-0x1){return _0x258640;}return this[_0xd180('0xf')][_0xd180('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0xd180('0x1af'),_0x206b6b));};AGIVertices[_0xd180('0x12')][_0xd180('0x1b2')]=function(_0x2b2829){logger['info'](util['format'](_0xd180('0x1b3'),_0x2b2829[_0xd180('0x35')]));var _0x5046c6=this[_0xd180('0x54')]['sync'](this,_0x2b2829['command']);this['createSquareDetailsReport']['sync'](this,_0x2b2829,_0x2b2829['command']);if(this[_0xd180('0xa7')](_0x2b2829[_0xd180('0xd3')])){var _0x50cf01=this[_0xd180('0x13')][_0xd180('0x6e')](this,_0x2b2829['variable_id']);if(_0x50cf01){this['channel']['setVariable'](_0x50cf01,_0x5046c6);return this['channel'][_0xd180('0xa6')](util['format'](_0xd180('0x1b4'),_0x2b2829['command'],_0x50cf01));}}return this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2b2829[_0xd180('0xb7')]));};AGIVertices[_0xd180('0x12')]['google_cloud_tts']=function(_0x57393a){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x1b5'),_0x57393a['label']));_0x57393a[_0xd180('0x5a')]=_0x57393a[_0xd180('0x5a')][_0xd180('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd180('0xa7')](_0x57393a[_0xd180('0x58')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0x1b6'));}if(!this[_0xd180('0xa7')](_0x57393a[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')](_0xd180('0xc6'));}this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x1b7'),_0x57393a[_0xd180('0x5a')]));var _0x305044=this[_0xd180('0x57')]['sync'](this,_0x57393a);if(_0x305044){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x305044));var _0x4a1805=this[_0xd180('0xf')]['streamFile'](_0x305044);try{fs[_0xd180('0x11e')](_0x305044+_0xd180('0xf7'));}catch(_0x273181){logger['error'](_0x273181);}return _0x4a1805;}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x57393a,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd180('0x12')][_0xd180('0x1b8')]=function(_0x24aa7c){logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x1b9'),_0x24aa7c[_0xd180('0x35')]));_0x24aa7c[_0xd180('0x5a')]=_0x24aa7c[_0xd180('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd180('0xa7')](_0x24aa7c[_0xd180('0x5a')])){return this[_0xd180('0xf')][_0xd180('0xa6')]('no\x20text\x20configured');}this[_0xd180('0xf')][_0xd180('0xa6')](util['format'](_0xd180('0x1ba'),_0x24aa7c[_0xd180('0x5a')]));var _0x51df09=this[_0xd180('0x5f')][_0xd180('0x6e')](this,_0x24aa7c);if(_0x51df09){this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x1bb'),_0x51df09));var _0x16de35=this['channel']['streamFile'](_0x51df09);try{fs[_0xd180('0x11e')](_0x51df09+_0xd180('0xf7'));}catch(_0x1d47f7){logger['error'](_0x1d47f7);}return _0x16de35;}return this[_0xd180('0xf')][_0xd180('0x4e')](_0x24aa7c,_0xd180('0x1bc'));};AGIVertices[_0xd180('0x12')][_0xd180('0x1bd')]=function(_0x4dd8b0){logger['info'](util[_0xd180('0x2a')](_0xd180('0x1be'),_0x4dd8b0['label']));if(!this[_0xd180('0xa7')](_0x4dd8b0[_0xd180('0x154')])){return this['channel'][_0xd180('0x4e')](_0x4dd8b0,'no\x20find\x20by\x20configured');}logger[_0xd180('0x2e')](util['format'](_0xd180('0x153'),this['channel'][_0xd180('0x38')],_0x4dd8b0[_0xd180('0x154')]));var _0x443ede=this['agentUnpause'][_0xd180('0x6e')](this,_0x4dd8b0[_0xd180('0x154')]);if(_0x443ede){logger['info'](util['format'](_0xd180('0x155'),this['channel'][_0xd180('0x38')],_0x4dd8b0['findBy']));this[_0xd180('0xf')][_0xd180('0xa6')](util[_0xd180('0x2a')](_0xd180('0x155'),this[_0xd180('0xf')][_0xd180('0x38')],_0x4dd8b0[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x15a')};}else{logger[_0xd180('0x2e')](util[_0xd180('0x2a')](_0xd180('0x156'),this['channel'][_0xd180('0x38')],_0x4dd8b0[_0xd180('0x154')]));this['channel']['noop'](util['format'](_0xd180('0x156'),this[_0xd180('0xf')]['callerid'],_0x4dd8b0[_0xd180('0x154')]));return{'code':0xc8,'result':_0xd180('0x157')};}};AGIVertices[_0xd180('0x12')][_0xd180('0x1bf')]=function(_0x14f9cb){logger[_0xd180('0x2e')](util[_0xd180('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x14f9cb[_0xd180('0x35')]));var _0x185219=this[_0xd180('0xf')][_0xd180('0xaf')]('VOICEMAIL',[_0x14f9cb[_0xd180('0x1c0')],_0x14f9cb['options']]);if(_0x185219[_0xd180('0xa9')]===-0x1){return _0x185219;}return this['channel']['noop'](util[_0xd180('0x2a')](_0xd180('0x16e'),_0xd180('0x1c1'),_0x14f9cb['mailbox']));};AGIVertices[_0xd180('0x12')]['vswitch']=function(_0x3d5ea1){logger[_0xd180('0x2e')](util['format'](_0xd180('0x1c2'),_0x3d5ea1['label']));if(!this['isConfigured'](_0x3d5ea1['variable_id'])){return this[_0xd180('0xf')]['error'](_0x3d5ea1,_0xd180('0x1a3'));}var _0x39c060=this[_0xd180('0x13')]['sync'](this,_0x3d5ea1[_0xd180('0xd3')]);if(!_0x39c060){return this['channel'][_0xd180('0x4e')](_0x3d5ea1,_0xd180('0x160'));}var _0x233552=this['channel']['getVariable'](_0x39c060);return{'code':0xc8,'result':_0x233552[_0xd180('0xa2')]?_0x233552[_0xd180('0xa2')]:'-'};};String[_0xd180('0x12')]['replaceAll']=function(_0x3aae01,_0x36de41){return this['split'](_0x3aae01)['join'](_0x36de41);};module[_0xd180('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x67da=['map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','MP3','google_tts_language','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','result','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','command','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','sestektts','no\x20grammar\x20configured','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','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','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','message','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','generate','beep','NOBEEP','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','forEach','variable\x20%s[key]\x20set','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','saveRestApiResult','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','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','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','getVoiceQueue','getVoiceQueueById','name','catch','prototype','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x67da,0x192));var _0xa67d=function(_0x5853ba,_0xcf1932){_0x5853ba=_0x5853ba-0x0;var _0x2c6aef=_0x67da[_0x5853ba];return _0x2c6aef;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa67d('0x0'));var sh=require(_0xa67d('0x1'));var odbc=require(_0xa67d('0x2'))();var rs=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var Mustache=require(_0xa67d('0x5'));var rp=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0xa67d('0xa');var recursiveMapAttributes=['rawHeaders',_0xa67d('0xb')];var verticesWithRetry=[_0xa67d('0xc'),_0xa67d('0xd'),_0xa67d('0xe')];var AGIVertices=function(_0x23cbc5,_0x285e16,_0x330a9f){this[_0xa67d('0xf')]=_0x23cbc5;this[_0xa67d('0x10')]=_0x285e16;this[_0xa67d('0x11')]=_0x330a9f;};AGIVertices['prototype'][_0xa67d('0x12')]=function(_0x3edd8d,_0x386665){this[_0xa67d('0x10')]['getVariableById'](_0x3edd8d)[_0xa67d('0x13')](function(_0x431f21){_0x386665(null,_0x431f21?_0x431f21['name']:![]);})['catch'](function(_0x304ee2){_0x386665(_0x304ee2);});};AGIVertices['prototype'][_0xa67d('0x14')]=function(_0x5c4cc3,_0x5d757b){this[_0xa67d('0x10')][_0xa67d('0x15')](_0x5c4cc3)['then'](function(_0x3f24cd){_0x5d757b(null,_0x3f24cd?_0x3f24cd[_0xa67d('0x16')]:![]);})[_0xa67d('0x17')](function(_0x288e5f){_0x5d757b(_0x288e5f);});};AGIVertices['prototype']['getSquareProject']=function(_0x4f443b,_0x4fa50f){this[_0xa67d('0x10')]['getSquareProjectById'](_0x4f443b)[_0xa67d('0x13')](function(_0xf8422c){_0x4fa50f(null,_0xf8422c?_0xf8422c[_0xa67d('0x16')]:![]);})[_0xa67d('0x17')](function(_0x273788){_0x4fa50f(_0x273788);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x19')]=function(_0x5538a5,_0x2c769a){this[_0xa67d('0x10')][_0xa67d('0x1a')](_0x5538a5)[_0xa67d('0x13')](function(_0x28f38b){_0x2c769a(null,_0x28f38b?_0x28f38b[_0xa67d('0x1b')]:![]);})['catch'](function(_0x3f1898){_0x2c769a(_0x3f1898);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1c')]=function(_0xed6c3e,_0x48f240){this[_0xa67d('0x10')]['getUserById'](_0xed6c3e)[_0xa67d('0x13')](function(_0x415141){_0x48f240(null,_0x415141?_0x415141[_0xa67d('0x16')]:![]);})[_0xa67d('0x17')](function(_0x559009){_0x48f240(_0x559009);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1d')]=function(_0x5ed92a,_0x321003){this[_0xa67d('0x10')][_0xa67d('0x1e')](_0x5ed92a)[_0xa67d('0x13')](function(_0x18ea95){_0x321003(null,_0x18ea95?_0x18ea95[_0xa67d('0x16')]:![]);})['catch'](function(_0x435e56){_0x321003(_0x435e56);});};AGIVertices[_0xa67d('0x18')]['getSound']=function(_0x2ac61a,_0x83b547){var _0x12d324=this;this[_0xa67d('0x10')][_0xa67d('0x1f')](_0x2ac61a)[_0xa67d('0x13')](function(_0x42c858){_0x83b547(null,_0x42c858?_0x12d324[_0xa67d('0x20')](_0x42c858[_0xa67d('0x21')]):![]);})[_0xa67d('0x17')](function(_0x2d0ce5){_0x83b547(_0x2d0ce5);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x22')]=function(_0x393269,_0x5e4f04){this[_0xa67d('0x10')][_0xa67d('0x23')](_0x393269)[_0xa67d('0x13')](function(_0x2703f5){_0x5e4f04(null,_0x2703f5?_0x2703f5:![]);})[_0xa67d('0x17')](function(_0x531343){_0x5e4f04(_0x531343);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x24')]=function(_0x3f57ed,_0x318090,_0x39faa1){this[_0xa67d('0x11')][_0xa67d('0x24')](_0x3f57ed,_0x318090)[_0xa67d('0x13')](function(){_0x39faa1(null);})[_0xa67d('0x17')](function(_0x2aa9c3){_0x39faa1(_0x2aa9c3);});};AGIVertices['prototype'][_0xa67d('0x25')]=function(_0x5ee31e,_0x26d827){this[_0xa67d('0x10')][_0xa67d('0x26')](_0x5ee31e)['then'](function(_0x22e032){if(_0x22e032){if(_0x22e032[_0xa67d('0x27')]){_0x26d827(null,[_0x22e032[_0xa67d('0x28')]]);}else{_0x26d827(null,_[_0xa67d('0x29')](_0x22e032[_0xa67d('0x2a')],_0xa67d('0x28')));}}else{_0x26d827(null,![]);}})['catch'](function(_0x20f178){_0x26d827(_0x20f178);});};AGIVertices[_0xa67d('0x18')]['getSoundPath']=function(_0x48f968){return util['format'](_0xa67d('0x2b'),FILES_PATH,_0x48f968);};AGIVertices['prototype'][_0xa67d('0x2c')]=function(_0x219652,_0x323f66,_0x37ad23){odbc[_0xa67d('0x2d')](_0x219652,function(_0x44310e){if(_0x44310e){logger[_0xa67d('0x2e')](_0xa67d('0x2f'),_0x44310e);_0x37ad23(_0x44310e);}else{logger[_0xa67d('0x30')](_0xa67d('0x31'));odbc[_0xa67d('0x32')](_0x323f66,function(_0x392447,_0x1427f1){if(_0x392447){logger['info']('Error\x20executing\x20query\x20%s',_0x323f66);_0x37ad23(_0x392447);}else{logger['info'](_0xa67d('0x33'),_0x323f66);odbc['close'](function(_0x1c6fee){if(_0x1c6fee){logger[_0xa67d('0x2e')](_0xa67d('0x34'),_0x1c6fee);}_0x37ad23(null,_0x1427f1);});}});}});};AGIVertices[_0xa67d('0x18')]['getSmsAccount']=function(_0xffa987,_0x46669f){this[_0xa67d('0x10')][_0xa67d('0x35')](_0xffa987)[_0xa67d('0x13')](function(_0x2d1457){_0x46669f(null,_0x2d1457?_0x2d1457:![]);})[_0xa67d('0x17')](function(_0x5b51dc){_0x46669f(_0x5b51dc);});};AGIVertices['prototype'][_0xa67d('0x36')]=function(_0x46ed8b,_0x32b70c){this[_0xa67d('0x10')][_0xa67d('0x36')](_0x46ed8b)[_0xa67d('0x13')](function(_0x57a27d){_0x32b70c(null,_0x57a27d);})[_0xa67d('0x17')](function(_0x4e3bf7){_0x32b70c(_0x4e3bf7);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x37')]=function(_0x2f698c,_0x5c88fb,_0x372085){this[_0xa67d('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0xa67d('0x38')],'node':_0x2f698c['label'],'application':_0x2f698c[_0xa67d('0x39')],'data':_0x5c88fb||null,'project_name':this[_0xa67d('0xf')][_0xa67d('0x3a')],'callerid':this['channel'][_0xa67d('0x3b')]})['then'](function(_0x214c7a){if(_0x372085){_0x372085(null,_0x214c7a);}})[_0xa67d('0x17')](function(_0x572ff0){if(_0x372085){_0x372085(_0x572ff0);}});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x3c')]=function(_0x43687e,_0x2f4fb2,_0x2a4b13,_0x213645){this[_0xa67d('0x10')][_0xa67d('0x3c')]({'uniqueid':this['channel'][_0xa67d('0x38')],'callerid':this[_0xa67d('0xf')][_0xa67d('0x3b')],'calleridname':this[_0xa67d('0xf')][_0xa67d('0x3d')],'context':this['channel']['context'],'extension':this[_0xa67d('0xf')][_0xa67d('0x3e')],'priority':this[_0xa67d('0xf')][_0xa67d('0x3f')],'accountcode':this[_0xa67d('0xf')]['accountcode'],'dnid':this[_0xa67d('0xf')]['dnid'],'projectName':this[_0xa67d('0xf')][_0xa67d('0x3a')],'saveName':_0x2f4fb2,'filename':_0x43687e[_0xa67d('0x40')]||_0x2f4fb2,'savePath':_0x2a4b13})[_0xa67d('0x13')](function(_0x21e38d){_0x213645(null,_0x21e38d);})['catch'](function(_0x38b76e){_0x213645(_0x38b76e);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x41')]=function(_0x5833c2,_0x256251,_0x3d544a,_0x4e455b,_0x43bedb){this[_0xa67d('0x10')]['createSquareMessage']({'uniqueid':this['channel'][_0xa67d('0x38')],'body':_0x5833c2,'direction':_0x256251,'providerName':_0x3d544a,'providerResponse':_0x4e455b})[_0xa67d('0x13')](function(_0x905bfe){if(_0x43bedb){_0x43bedb(null,_0x905bfe);}})[_0xa67d('0x17')](function(_0xffce3f){if(_0x43bedb){_0x43bedb(_0xffce3f);}});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x42')]=function(_0x3eb819,_0x242a01){this['rpc'][_0xa67d('0x42')]({'firstName':_[_0xa67d('0x43')](_0x3eb819['name'])||_[_0xa67d('0x44')](_0x3eb819[_0xa67d('0x16')])?'callback_'+Math[_0xa67d('0x45')]():_0x3eb819['name'],'lastName':_[_0xa67d('0x43')](_0x3eb819[_0xa67d('0x46')])||_[_0xa67d('0x44')](_0x3eb819[_0xa67d('0x46')])?null:_0x3eb819[_0xa67d('0x46')],'phone':_0x3eb819[_0xa67d('0x47')],'ListId':_0x3eb819[_0xa67d('0x48')],'scheduledat':_0x3eb819[_0xa67d('0x49')],'callbackUniqueid':this[_0xa67d('0xf')][_0xa67d('0x38')],'tags':_0xa67d('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x3eb819[_0xa67d('0x49')][_0xa67d('0x4b')](),'priority':_0x3eb819[_0xa67d('0x4c')]})[_0xa67d('0x13')](function(_0x539307){_0x242a01(null,_0x539307);})[_0xa67d('0x17')](function(_0x260e92){_0x242a01(_0x260e92);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x4d')]=function(_0x34e35f,_0x1639fe){this[_0xa67d('0x10')][_0xa67d('0x4e')](_0x34e35f)['then'](function(_0x569521){_0x1639fe(null,_0x569521?_0x569521['name']:![]);})[_0xa67d('0x17')](function(_0x5d4b5c){_0x1639fe(_0x5d4b5c);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x4f')]=function(_0x295a3c,_0x5e9e68,_0x4278f0){var _0x472b28={'role':_0xa67d('0x50')};_0x472b28[_0x295a3c]=this[_0xa67d('0xf')]['callerid'];this['rpc'][_0xa67d('0x4f')](_0x472b28,_0x5e9e68,this[_0xa67d('0xf')][_0xa67d('0x38')])[_0xa67d('0x13')](function(_0x32200d){_0x4278f0(null,_[_0xa67d('0x44')](_0x32200d)?![]:!![]);})[_0xa67d('0x17')](function(_0x5af704){logger[_0xa67d('0x2e')](_0x5af704);_0x4278f0(null,![]);});};AGIVertices[_0xa67d('0x18')]['agentUnpause']=function(_0x1a8574,_0x3d6d59){var _0x467c46={'role':'agent'};_0x467c46[_0x1a8574]=this[_0xa67d('0xf')][_0xa67d('0x3b')];this['rpc'][_0xa67d('0x51')](_0x467c46)[_0xa67d('0x13')](function(_0xb96936){_0x3d6d59(null,_['isNil'](_0xb96936)?![]:!![]);})[_0xa67d('0x17')](function(_0x17a89e){logger[_0xa67d('0x2e')](_0x17a89e);_0x3d6d59(null,![]);});};AGIVertices['prototype'][_0xa67d('0x52')]=function(_0x4ed172,_0x3e368f){var _0x4a2e2f={'role':_0xa67d('0x50')};_0x4a2e2f[_0x4ed172]=this[_0xa67d('0xf')][_0xa67d('0x3b')];this[_0xa67d('0x10')][_0xa67d('0x52')](_0x4a2e2f)['then'](function(_0x175028){_0x3e368f(null,_['isNil'](_0x175028)?![]:!![]);})[_0xa67d('0x17')](function(_0x24fa84){logger[_0xa67d('0x2e')](_0x24fa84);_0x3e368f(null,![]);});};AGIVertices['prototype'][_0xa67d('0x53')]=function(_0xaaf8cf,_0x192e62){var _0x3856ef={'role':_0xa67d('0x50')};_0x3856ef[_0xaaf8cf]=this[_0xa67d('0xf')][_0xa67d('0x3b')];var _0x50dfac=_0xaaf8cf!=_0xa67d('0x54')?util[_0xa67d('0x55')](_0xa67d('0x56'),_0xa67d('0x57'),this[_0xa67d('0xf')][_0xa67d('0x3b')]):undefined;this[_0xa67d('0x10')][_0xa67d('0x53')](_0x3856ef,_0x50dfac)[_0xa67d('0x13')](function(_0x59dd9e){_0x192e62(null,_[_0xa67d('0x44')](_0x59dd9e)?![]:!![]);})[_0xa67d('0x17')](function(_0x2a21c5){logger['error'](_0x2a21c5);_0x192e62(null,![]);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x58')]=function(_0x41ca15,_0x3c44fd){sh[_0xa67d('0x59')](_['trim'](_0x41ca15),function(_0x544929,_0x275bd6){var _0x2f80b4=_0x275bd6[_0xa67d('0x5a')](/(\r\n|\n|\r)/gm,'');_0x3c44fd(null,_0x2f80b4);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x5b')]=function(_0x189dd6,_0x28441d){scripts['googleCloudTTS'](_0x189dd6[_0xa67d('0x5c')],_0x189dd6['google_cloud_tts_text_type']||_0xa67d('0x5d'),_0x189dd6[_0xa67d('0x5d')],_0x189dd6['languageCode']||_0xa67d('0x5e'),_0x189dd6[_0xa67d('0x5f')]||_0xa67d('0x60'),_0x189dd6['audioEncoding']||_0xa67d('0x61'))[_0xa67d('0x13')](function(_0x3a7c2e){_0x28441d(null,_0x3a7c2e);})[_0xa67d('0x17')](function(_0x1032c2){_0x28441d(_0x1032c2);});};AGIVertices[_0xa67d('0x18')]['googleTTS']=function(_0x3cc975,_0x4cb621){scripts['googleTTS'](_0x3cc975[_0xa67d('0x5d')],_0x3cc975[_0xa67d('0x62')]||'en',0x1)['then'](function(_0x2997b4){_0x4cb621(null,_0x2997b4);})['catch'](function(_0x356ae5){_0x4cb621(_0x356ae5);});};AGIVertices[_0xa67d('0x18')]['restAPI']=function(_0xbe51dc,_0x16e9ff){var _0x19d8f7={'uri':_0xbe51dc[_0xa67d('0x63')],'method':_0xbe51dc[_0xa67d('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xbe51dc['timeout'])===_0xa67d('0x65')&&parseInt(_0xbe51dc[_0xa67d('0x66')])>=0x1?parseInt(_0xbe51dc['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa67d('0x67')]([_0xa67d('0x68'),_0xa67d('0x69')],_0x19d8f7[_0xa67d('0x64')][_0xa67d('0x6a')]())){try{_0x19d8f7[_0xa67d('0x6b')]=_0xbe51dc[_0xa67d('0xb')]?JSON[_0xa67d('0x6c')](_0xbe51dc[_0xa67d('0xb')]):{};}catch(_0x144a49){logger[_0xa67d('0x2e')](_0xa67d('0x6d'),_0x144a49);}}try{_0x19d8f7[_0xa67d('0x6e')]=_0xbe51dc[_0xa67d('0x6f')]?JSON[_0xa67d('0x6c')](_0xbe51dc[_0xa67d('0x6f')]):{};}catch(_0x572877){logger[_0xa67d('0x2e')](_0xa67d('0x70'),_0x572877);}if(_0xbe51dc[_0xa67d('0x71')]){try{var _0x3adf5f=require(_0xbe51dc[_0xa67d('0x71')])[_0xa67d('0x72')](this,_0x19d8f7);_0x19d8f7['uri']=Mustache[_0xa67d('0x73')](_0xbe51dc['url'],_0x3adf5f,{},['$$','$$']);if(_0x19d8f7[_0xa67d('0x6e')]){_0x19d8f7[_0xa67d('0x6e')]=JSON['parse'](Mustache[_0xa67d('0x73')](JSON[_0xa67d('0x74')](_0x19d8f7['headers']),_0x3adf5f,{},['$$','$$']));}if(_0x19d8f7[_0xa67d('0x6b')]){_0x19d8f7[_0xa67d('0x6b')]=JSON[_0xa67d('0x6c')](Mustache[_0xa67d('0x73')](JSON[_0xa67d('0x74')](_0x19d8f7[_0xa67d('0x6b')]),_0x3adf5f,{},['$$','$$']));}}catch(_0x386ec5){logger[_0xa67d('0x2e')](_0xa67d('0x75'),_0x386ec5);}}rp(_0x19d8f7)['then'](function(_0x17e18f){var _0x48b888={'statusCode':_0x17e18f[_0xa67d('0x76')]||0xc8,'statusMessage':_0x17e18f[_0xa67d('0x77')]||'OK','headers':_0x17e18f[_0xa67d('0x6e')]||{},'body':_0x17e18f[_0xa67d('0x6b')]||{}};_0x16e9ff(null,_0x48b888);})[_0xa67d('0x17')](function(_0x1a01b1){var _0x4a6a81={'statusCode':_0x1a01b1[_0xa67d('0x76')]||0x1f4,'statusMessage':_0x1a01b1['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1a01b1[_0xa67d('0x78')]['headers']||{},'body':_0x1a01b1[_0xa67d('0x78')][_0xa67d('0x6b')]||{}};_0x16e9ff(null,_0x4a6a81);});};AGIVertices[_0xa67d('0x18')]['googleDialogflow']=function(_0x26ecf9,_0x43e41b){scripts[_0xa67d('0x79')](this[_0xa67d('0xf')][_0xa67d('0x38')],_0x26ecf9[_0xa67d('0x7a')],_0x26ecf9[_0xa67d('0x5d')],_0x26ecf9[_0xa67d('0x7b')]||'en')[_0xa67d('0x13')](function(_0x135227){_0x43e41b(null,_0x135227);})[_0xa67d('0x17')](function(_0x41464c){_0x43e41b(_0x41464c);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x7c')]=function(_0x3db95b,_0x3de989){scripts['googleDialogflowV2'](this[_0xa67d('0xf')]['uniqueid'],_0x3db95b[_0xa67d('0x7d')],_0x3db95b[_0xa67d('0x7e')],_0x3db95b[_0xa67d('0x7f')],_0x3db95b[_0xa67d('0x5d')],_0x3db95b[_0xa67d('0x80')]||'en')['then'](function(_0x4ad826){_0x3de989(null,_0x4ad826);})[_0xa67d('0x17')](function(_0x325183){_0x3de989(_0x325183);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x81')]=function(_0x5d16c2,_0x1f79ca){scripts['sestekNDA'](this['channel'],_0x5d16c2)['then'](function(_0x21581a){_0x1f79ca(null,_0x21581a);})[_0xa67d('0x17')](function(_0x20ca67){_0x1f79ca(_0x20ca67);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x82')]=function(_0x26358f,_0x521c89){scripts[_0xa67d('0x82')](_0x26358f[_0xa67d('0x7a')],_0x26358f[_0xa67d('0x5d')],_0x26358f['ispeech_tts_language']||'en-US',_0x26358f[_0xa67d('0x83')])['then'](function(_0x5be0ed){_0x521c89(null,_0x5be0ed);})['catch'](function(_0x174b7a){_0x521c89(_0x174b7a);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x84')]=function(_0x348061,_0x1c5301,_0x2669c0){scripts['ispeechASR'](_0x1c5301,_0x348061[_0xa67d('0x7a')],_0x348061[_0xa67d('0x85')]||_0xa67d('0x5e'),this[_0xa67d('0x86')](_0x348061[_0xa67d('0x87')])?_0x348061['model']:undefined)[_0xa67d('0x13')](function(_0x2a36cd){_0x2669c0(null,_0x2a36cd);})[_0xa67d('0x17')](function(_0x40c9d3){_0x2669c0(_0x40c9d3);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x88')]=function(_0x376a29,_0x32facb){scripts[_0xa67d('0x88')](_0x376a29['aws_access_key_id'],_0x376a29[_0xa67d('0x89')],_0x376a29[_0xa67d('0x8a')],_0x376a29[_0xa67d('0x8b')]||'Amy',_0x376a29[_0xa67d('0x5d')],_0x376a29[_0xa67d('0x8c')]||_0xa67d('0x5d'))[_0xa67d('0x13')](function(_0x190084){_0x32facb(null,_0x190084);})[_0xa67d('0x17')](function(_0x54a775){_0x32facb(_0x54a775);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x8d')]=function(_0x51dbf5,_0x2911dc){scripts[_0xa67d('0x8d')](this[_0xa67d('0xf')][_0xa67d('0x38')],_0x51dbf5[_0xa67d('0x8e')],_0x51dbf5['aws_secret_access_key'],_0x51dbf5[_0xa67d('0x8f')],_0x51dbf5['text'],_0x51dbf5[_0xa67d('0x90')])['then'](function(_0x256e0e){_0x2911dc(null,_0x256e0e);})[_0xa67d('0x17')](function(_0x1d8a39){_0x2911dc(_0x1d8a39);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x91')]=function(_0x9633ba,_0x514e5a,_0x2d0a39){scripts[_0xa67d('0x91')](_0x514e5a,_0x9633ba['key'],_0x9633ba[_0xa67d('0x92')]||_0xa67d('0x5e'))['then'](function(_0x4107fe){_0x2d0a39(null,_0x4107fe);})[_0xa67d('0x17')](function(_0x1f2a42){_0x2d0a39(_0x1f2a42);});};AGIVertices[_0xa67d('0x18')][_0xa67d('0x93')]=function(_0x2ae823,_0xb54c2f,_0x4761c0){scripts['tildeASR'](_0xb54c2f,_0x2ae823[_0xa67d('0x94')],_0x2ae823['appsecret'],_0x2ae823[_0xa67d('0x95')])['then'](function(_0x4cda74){_0x4761c0(null,_0x4cda74);})[_0xa67d('0x17')](function(_0x14d65a){_0x4761c0(_0x14d65a);});};AGIVertices['prototype']['clear']=function(_0x32acda){var _0x5781ae=_[_0xa67d('0x67')](verticesWithRetry,_0x32acda[_0xa67d('0x39')])?_0x32acda:_[_0xa67d('0x96')](_0x32acda);for(var _0x1c9908 in _0x5781ae){if(_0x5781ae[_0xa67d('0x97')](_0x1c9908)){if(_0x5781ae[_0x1c9908]&&_[_0xa67d('0x98')](_0x5781ae[_0x1c9908])){if(_[_0xa67d('0x67')](recursiveMapAttributes,_0x1c9908)){_0x5781ae[_0x1c9908]=this[_0xa67d('0x99')](_0x5781ae[_0x1c9908]);}else{_0x5781ae[_0x1c9908]=this[_0xa67d('0x9a')](_0x5781ae[_0x1c9908]);}}}}return _0x5781ae;};AGIVertices[_0xa67d('0x18')][_0xa67d('0x9b')]=function(_0x128622){for(var _0xdc3296 in _0x128622){if(_0x128622[_0xa67d('0x97')](_0xdc3296)){if(_['isPlainObject'](_0x128622[_0xdc3296])){this[_0xa67d('0x9b')](_0x128622[_0xdc3296]);}else if(_[_0xa67d('0x9c')](_0x128622[_0xdc3296])){for(var _0x4e0c0e=0x0;_0x4e0c0e<_0x128622[_0xdc3296][_0xa67d('0x9d')];_0x4e0c0e++){this[_0xa67d('0x9b')](_0x128622[_0xdc3296][_0x4e0c0e]);}}else if(_[_0xa67d('0x98')](_0x128622[_0xdc3296])){_0x128622[_0xdc3296]=this[_0xa67d('0x9a')](_0x128622[_0xdc3296]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x360fd8,_0x330826){for(var _0x31792b in _0x360fd8){if(_0x360fd8[_0xa67d('0x97')](_0x31792b)){if(_[_0xa67d('0x9e')](_0x360fd8[_0x31792b])){if(!_[_0xa67d('0x43')](_0x360fd8[_0x31792b])){this['saveRestApiResult'](_0x360fd8[_0x31792b],util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x330826,_0x31792b));}}else if(_['isArray'](_0x360fd8[_0x31792b])){for(var _0x148e42=0x0;_0x148e42<_0x360fd8[_0x31792b][_0xa67d('0x9d')];_0x148e42++){this['saveRestApiResult'](_0x360fd8[_0x31792b][_0x148e42],util['format'](_0xa67d('0x9f'),_0x330826,_0x31792b+'['+_0x148e42+']'));}}else{if(!_[_0xa67d('0x44')](_0x360fd8[_0x31792b])){this['channel'][_0xa67d('0xa0')](util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x330826,_0x31792b),_0x360fd8[_0x31792b]);}}}}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x99')]=function(_0x17334d){try{var _0x3c64ec=JSON[_0xa67d('0x6c')](_0x17334d);this[_0xa67d('0x9b')](_0x3c64ec);return JSON['stringify'](_0x3c64ec);}catch(_0x2340d){return this['replaceAllVariables'](_0x17334d);}};AGIVertices[_0xa67d('0x18')]['replaceAllVariables']=function(_0x4f0a06){var _0x5a80c8=_0x4f0a06[_0xa67d('0xa1')]('{');for(var _0x3fcc23=0x1;_0x3fcc23<_0x5a80c8[_0xa67d('0x9d')];_0x3fcc23+=0x1){var _0x4638d9=_0x5a80c8[_0x3fcc23]['split']('}');if(_0x4638d9['length']>0x1){_0x4f0a06=_0x4f0a06[_0xa67d('0xa2')]('{'+_0x4638d9[0x0]+'}',this['channel'][_0xa67d('0x12')](_0x4638d9[0x0])[_0xa67d('0xa3')]||_0x4638d9[0x0]);}}if(_0x5a80c8[_0xa67d('0x9d')]===0x1){return _0x4f0a06['toString']();}return this[_0xa67d('0x9a')](_0x4f0a06);};AGIVertices[_0xa67d('0x18')]['getAndSetVariable']=function(_0x24ada4,_0x452974){var _0x2a25d8=this[_0xa67d('0xf')][_0xa67d('0x12')](_0x24ada4);if(_0x2a25d8[_0xa67d('0xa4')]===-0x1){return _0x2a25d8;}logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x452974,_0x2a25d8[_0xa67d('0xa3')]));return this[_0xa67d('0xf')]['setVariable'](_0x452974,_0x2a25d8['extra']);};AGIVertices[_0xa67d('0x18')]['isConfigured']=function(_0x3c6885){return _0x3c6885&&_0x3c6885!=='0'&&_0x3c6885!=='-1'&&_0x3c6885!=='';};AGIVertices[_0xa67d('0x18')][_0xa67d('0xa5')]=function(_0x21c36a){this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x21c36a,'-');_0x21c36a[_0xa67d('0xa6')]=_0x21c36a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa67d('0x18')]['mrcpsynth']=function(_0x2aae23){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xa7'),_0x2aae23['label']));if(!this['isConfigured'](_0x2aae23[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}var _0x3aeb16='\x22'+_0x2aae23[_0xa67d('0x5d')]+'\x22';if(this[_0xa67d('0x86')](_0x2aae23[_0xa67d('0x78')])){_0x3aeb16+=','+_0x2aae23[_0xa67d('0x78')];}var _0xc2dd13=this['channel'][_0xa67d('0x59')](_0xa67d('0xaa'),_0x3aeb16);if(_0xc2dd13['result']===-0x1){return _0xc2dd13;}return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xab'),_0x3aeb16));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xac')]=function(_0x41cd5b){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xad'),_0x41cd5b[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x41cd5b[_0xa67d('0xaf')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20grammar\x20configured');}var _0x4d58ec=_0x41cd5b[_0xa67d('0xaf')];if(this[_0xa67d('0x86')](_0x41cd5b[_0xa67d('0x78')])){_0x4d58ec+=','+_0x41cd5b['options'];}var _0x2d297e=this['channel'][_0xa67d('0x59')](_0xa67d('0xb0'),_0x4d58ec);if(_0x2d297e[_0xa67d('0xa4')]===-0x1){return _0x2d297e;}var _0x348b13=this[_0xa67d('0xb1')](_0xa67d('0xb2'),_0xa67d('0xb3'));if(_0x348b13[_0xa67d('0xa4')]===-0x1){return _0x348b13;}var _0x2527c7=this[_0xa67d('0xb1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x2527c7[_0xa67d('0xa4')]===-0x1){return _0x2527c7;}var _0x18f3f3=this[_0xa67d('0xb1')](_0xa67d('0xb4'),'MRCP_RECOG_INSTANCE');if(_0x18f3f3[_0xa67d('0xa4')]===-0x1){return _0x18f3f3;}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0xb5'),_0x4d58ec));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x8')]=function(_0x3cca2a){logger['info'](util[_0xa67d('0x55')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3cca2a[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0x8')]([_0x3cca2a[_0xa67d('0xb6')],_0x3cca2a['args']]);};AGIVertices[_0xa67d('0x18')]['answer']=function(_0x392109){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x392109[_0xa67d('0xae')]));if(this[_0xa67d('0x86')](_0x392109[_0xa67d('0x66')])){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x392109['timeout']));var _0xdeccac=this['channel'][_0xa67d('0xb7')](_0x392109[_0xa67d('0x66')]);if(_0xdeccac[_0xa67d('0xa4')]===-0x1){return _0xdeccac;}}return this[_0xa67d('0xf')][_0xa67d('0xb8')]();};AGIVertices[_0xa67d('0x18')][_0xa67d('0x4a')]=function(_0x146e13){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xb9'),_0x146e13[_0xa67d('0xae')]));if(!this['isConfigured'](_0x146e13['list_id'])){return this[_0xa67d('0xf')]['error'](_0x146e13,'no\x20list\x20selected');}_0x146e13[_0xa67d('0x49')]=moment();if(this[_0xa67d('0x86')](_0x146e13['delay'])){_0x146e13['scheduledAt']=moment()[_0xa67d('0xba')](_0x146e13['delay'],'minutes');}if(!this[_0xa67d('0x86')](_0x146e13[_0xa67d('0x4c')])){_0x146e13[_0xa67d('0x4c')]=0x2;}this[_0xa67d('0x42')][_0xa67d('0x72')](this,_0x146e13);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x146e13[_0xa67d('0x47')],_0x146e13[_0xa67d('0x48')],_0x146e13[_0xa67d('0x49')]));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xbb')]=function(_0x2a970c){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xbc'),_0x2a970c[_0xa67d('0xae')]));var _0x29c181=this['channel'][_0xa67d('0x59')](_0x2a970c[_0xa67d('0xbd')],_0x2a970c[_0xa67d('0x78')]);if(_0x29c181[_0xa67d('0xa4')]===-0x1){return _0x29c181;}return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xbe'),_0x2a970c[_0xa67d('0xbd')],_0x2a970c[_0xa67d('0x78')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x2c63f3){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2c63f3[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x2c63f3[_0xa67d('0x5d')])){return this['channel']['noop'](_0xa67d('0xa9'));}var _0x53d53e='\x22'+_0x2c63f3[_0xa67d('0x5d')]+'\x22';if(this[_0xa67d('0x86')](_0x2c63f3[_0xa67d('0x78')])){_0x53d53e+=','+_0x2c63f3[_0xa67d('0x78')];}var _0x21a8d4=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0xaa'),_0x53d53e);if(_0x21a8d4['result']===-0x1){return _0x21a8d4;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xab'),_0x53d53e));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xbf')]=function(_0x4ad0cd){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4ad0cd[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x4ad0cd[_0xa67d('0x5d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}var _0xe03c01='\x22'+_0x4ad0cd['text']+'\x22';if(this[_0xa67d('0x86')](_0x4ad0cd[_0xa67d('0x78')])){_0xe03c01+=','+_0x4ad0cd[_0xa67d('0x78')];}var _0x274673=this['channel'][_0xa67d('0x59')](_0xa67d('0xaa'),_0xe03c01);if(_0x274673['result']===-0x1){return _0x274673;}return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0xe03c01));};AGIVertices[_0xa67d('0x18')]['lumenvoxasr']=function(_0x35b06d){logger[_0xa67d('0x30')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x35b06d[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x35b06d['grammar'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xc0'));}var _0xc4e703=_0x35b06d[_0xa67d('0xaf')];if(this[_0xa67d('0x86')](_0x35b06d[_0xa67d('0x78')])){_0xc4e703+=','+_0x35b06d[_0xa67d('0x78')];}var _0x5e56a5=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0xb0'),_0xc4e703);if(_0x5e56a5[_0xa67d('0xa4')]===-0x1){return _0x5e56a5;}var _0x31830c=this[_0xa67d('0xb1')](_0xa67d('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x31830c[_0xa67d('0xa4')]===-0x1){return _0x31830c;}var _0x48b13e=this[_0xa67d('0xb1')](_0xa67d('0xc1'),_0xa67d('0xc2'));if(_0x48b13e[_0xa67d('0xa4')]===-0x1){return _0x48b13e;}var _0x386b6e=this[_0xa67d('0xb1')](_0xa67d('0xb4'),_0xa67d('0xc3'));if(_0x386b6e[_0xa67d('0xa4')]===-0x1){return _0x386b6e;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0xb5'),_0xc4e703));};AGIVertices[_0xa67d('0x18')]['sestekasr']=function(_0x1f4e0f){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xc4'),_0x1f4e0f[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x1f4e0f[_0xa67d('0xaf')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xc0'));}var _0x40c3a4=_0x1f4e0f[_0xa67d('0xaf')];if(this[_0xa67d('0x86')](_0x1f4e0f['options'])){_0x40c3a4+=','+_0x1f4e0f[_0xa67d('0x78')];}var _0x7f01e6=this[_0xa67d('0xf')][_0xa67d('0x59')]('MRCPRecog',_0x40c3a4);if(_0x7f01e6[_0xa67d('0xa4')]===-0x1){return _0x7f01e6;}var _0x22c799=this[_0xa67d('0xb1')](_0xa67d('0xb2'),_0xa67d('0xc5'));if(_0x22c799['result']===-0x1){return _0x22c799;}var _0x5c4f2c=this['getAndSetVariable'](_0xa67d('0xc1'),_0xa67d('0xc6'));if(_0x5c4f2c[_0xa67d('0xa4')]===-0x1){return _0x5c4f2c;}var _0x1339df=this['getAndSetVariable'](_0xa67d('0xb4'),_0xa67d('0xc7'));if(_0x1339df[_0xa67d('0xa4')]===-0x1){return _0x1339df;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0xb5'),_0x40c3a4));};AGIVertices['prototype'][_0xa67d('0xc8')]=function(_0x2af58b){logger['info'](util[_0xa67d('0x55')](_0xa67d('0xc9'),_0x2af58b[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x2af58b[_0xa67d('0xca')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x2af58b,_0xa67d('0xcb'));}var _0x1beeac=this[_0xa67d('0x19')][_0xa67d('0x72')](this,_0x2af58b[_0xa67d('0xca')]);if(!_0x1beeac){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x2af58b,'no\x20odbc\x20database\x20found');}if(!this[_0xa67d('0x86')](_0x2af58b[_0xa67d('0x32')])){return this['channel'][_0xa67d('0x2e')](_0x2af58b,_0xa67d('0xcc'));}var _0x5a36b6=_0x2af58b[_0xa67d('0x32')][_0xa67d('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xcd'),_0x5a36b6));var _0x3bfab1=this[_0xa67d('0x2c')][_0xa67d('0x72')](this,_0x1beeac,_0x5a36b6);this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x2af58b,_0x5a36b6);if(!this[_0xa67d('0x86')](_0x2af58b[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xcf'));}var _0x57e43c=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x2af58b[_0xa67d('0xce')]);if(!_0x57e43c){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x2af58b,_0xa67d('0xd0'));}var _0x3975bd=this;_0x3bfab1['forEach'](function(_0x46ba20,_0x54500a){Object[_0xa67d('0xd1')](_0x46ba20)['forEach'](function(_0x26b304){_0x3975bd[_0xa67d('0xf')][_0xa67d('0xa0')](util['format'](_0xa67d('0xd2'),_0x57e43c,_0x54500a,_0x26b304),_0x46ba20[_0x26b304]);});});this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')](_0xa67d('0xd3'),_0x57e43c),_0x3bfab1[_0xa67d('0x9d')]);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xd4'),_0x57e43c));};AGIVertices['prototype'][_0xa67d('0xd5')]=function(_0x147196){logger[_0xa67d('0xd6')](util[_0xa67d('0x55')](_0xa67d('0xd7'),_0x147196[_0xa67d('0xae')]));if(!this['isConfigured'](_0x147196['sip_id'])){return this[_0xa67d('0xf')]['error'](_0x147196,_0xa67d('0xd8'));}var _0x2899cb=this['getUser'][_0xa67d('0x72')](this,_0x147196[_0xa67d('0xd9')]);if(!_0x2899cb){return this['channel'][_0xa67d('0x2e')](_0x147196,'no\x20user\x20found');}var _0xd7958b=this[_0xa67d('0xf')]['exec']('DIAL',[util[_0xa67d('0x55')](_0xa67d('0xda'),_0x2899cb),_0x147196['timeout'],_0x147196[_0xa67d('0xdb')],_0x147196['url']]);if(_0xd7958b[_0xa67d('0xa4')]===-0x1){return _0xd7958b;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Executed\x20command\x20%s',_0xa67d('0xdc')));};AGIVertices['prototype'][_0xa67d('0xdd')]=function(_0x8ad00e){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xde'),_0x8ad00e[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x8ad00e[_0xa67d('0x7a')])){return this['channel'][_0xa67d('0xa8')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x8ad00e[_0xa67d('0x5d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x8ad00e);this[_0xa67d('0x41')](_0x8ad00e[_0xa67d('0x5d')],'in','','');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Trying\x20Dialogflow:\x20%s',_0x8ad00e[_0xa67d('0x5d')]));var _0x52c266=this['googleDialogflow'][_0xa67d('0x72')](this,_0x8ad00e);if(_0x52c266){for(var _0x55dc94 in _0x52c266){if(_0x52c266[_0xa67d('0x97')](_0x55dc94)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util['format'](_0xa67d('0xdf'),_0x55dc94[_0xa67d('0x6a')]()),_0x52c266[_0x55dc94]);}}this[_0xa67d('0x41')](_0x52c266[_0xa67d('0xe0')],_0xa67d('0xe1'),_0xa67d('0xdd'),'');return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xe2'),_0x52c266[_0xa67d('0xe0')]));}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x8ad00e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xa67d('0x18')]['dialogflowV2']=function(_0x23df5a){logger['info'](util['format'](_0xa67d('0xe3'),_0x23df5a[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x23df5a[_0xa67d('0x7d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xe4'));}if(!this[_0xa67d('0x86')](_0x23df5a['client_email'])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xe5'));}if(!this[_0xa67d('0x86')](_0x23df5a[_0xa67d('0x7f')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xe6'));}if(!this[_0xa67d('0x86')](_0x23df5a['dialogflowV2_language'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x23df5a['text'])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['bot']=!![];this[_0xa67d('0x37')](_0x23df5a);this[_0xa67d('0x41')](_0x23df5a['text'],'in','','');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xe7'),_0x23df5a[_0xa67d('0x5d')]));var _0x501572=this[_0xa67d('0x7c')][_0xa67d('0x72')](this,_0x23df5a);if(_0x501572){for(var _0x362ad8 in _0x501572){if(_0x501572[_0xa67d('0x97')](_0x362ad8)){if(_0x362ad8!==_0xa67d('0xe8')){this[_0xa67d('0xf')][_0xa67d('0xa0')](util['format']('DIALOGFLOW_%s',_0x362ad8['toUpperCase']()),_0x501572[_0x362ad8]);}}}this[_0xa67d('0x41')](_0x501572['speech'],'out',_0xa67d('0xe9'),_0x501572[_0xa67d('0xe8')]);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('DialogflowV2\x20Result\x20%s',_0x501572[_0xa67d('0xe0')]));}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x23df5a,_0xa67d('0xea'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0xeb')]=function(_0xda8e9d){logger[_0xa67d('0x30')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xda8e9d[_0xa67d('0xae')]));if(!this['isConfigured'](_0xda8e9d['ndauth_url'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xec'));}if(!this[_0xa67d('0x86')](_0xda8e9d[_0xa67d('0xed')])){return this['channel'][_0xa67d('0xa8')]('no\x20username\x20configured');}if(!this[_0xa67d('0x86')](_0xda8e9d[_0xa67d('0xee')])){return this[_0xa67d('0xf')]['noop']('no\x20password\x20configured');}if(!this[_0xa67d('0x86')](_0xda8e9d[_0xa67d('0xef')])){return this['channel']['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')][_0xa67d('0xf0')]=!![];this[_0xa67d('0x37')](_0xda8e9d);this[_0xa67d('0x41')](_0xda8e9d[_0xa67d('0x5d')],'in','','');this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xf1'),_0xda8e9d[_0xa67d('0x5d')]));var _0x1a240a=this[_0xa67d('0x81')][_0xa67d('0x72')](this,_0xda8e9d);if(_0x1a240a){for(var _0x43ef9d in _0x1a240a){if(_0x1a240a[_0xa67d('0x97')](_0x43ef9d)){this[_0xa67d('0xf')]['setVariable'](util[_0xa67d('0x55')]('SESTEK_NDA_%s',_0x43ef9d[_0xa67d('0x6a')]()),_0x1a240a[_0x43ef9d]);}}this['createSquareMessage'](_0x1a240a[_0xa67d('0xe0')],_0xa67d('0xe1'),'sesteknda','');if(_0x1a240a[_0xa67d('0xf2')]){this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xf3'),_0x1a240a[_0xa67d('0xf2')]));var _0x138d9e=this['channel']['streamFile'](_0x1a240a[_0xa67d('0xf2')]);try{fs['unlink'](_0x1a240a['audiofile']+_0xa67d('0xf4'));}catch(_0x1a4777){logger[_0xa67d('0x2e')](_0x1a4777);}return _0x138d9e;}else{return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xf5'),_0x1a240a[_0xa67d('0xe0')]));}}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xda8e9d,_0xa67d('0xf6'));};AGIVertices[_0xa67d('0x18')]['end']=function(_0x38fa89){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xf7'),_0x38fa89[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['noop']('end');};AGIVertices[_0xa67d('0x18')][_0xa67d('0xf8')]=function(_0x5539dc){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0xf9'),_0x5539dc['label']));var _0x263b33='';if(_0x5539dc[_0xa67d('0xfa')]){if(!this[_0xa67d('0x86')](_0x5539dc[_0xa67d('0xfa')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5539dc,'no\x20trunk\x20selected');}else{var _0x2cbc3a=parseInt(_0x5539dc['trunk_id'],0xa);if(isNaN(_0x2cbc3a)){_0x263b33=_0x5539dc['trunk_id'];}else{_0x263b33=this[_0xa67d('0x1d')][_0xa67d('0x72')](this,_0x5539dc['trunk_id']);if(!_0x263b33){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5539dc,_0xa67d('0xfb'));}}}}else if(_0x5539dc[_0xa67d('0xfc')]){_0x263b33=_0x5539dc['trunk_name'];}else{return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5539dc,_0xa67d('0xfd'));}var _0x5b416f=this[_0xa67d('0xf')]['exec'](_0xa67d('0xdc'),[util[_0xa67d('0x55')](_0xa67d('0xfe'),_0x263b33,_0x5539dc[_0xa67d('0x47')]),_0x5539dc[_0xa67d('0x66')],_0x5539dc[_0xa67d('0xdb')],_0x5539dc[_0xa67d('0x63')]]);if(_0x5b416f[_0xa67d('0xa4')]===-0x1){return _0x5b416f;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xff'),_0xa67d('0xdc')));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x100')]=function(_0x1748d4){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1748d4[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x100'));};AGIVertices[_0xa67d('0x18')]['getdigits']=function(_0x33718c){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x101'),_0x33718c[_0xa67d('0xae')]));if(_0x33718c[_0xa67d('0xa6')]===0x0){return this[_0xa67d('0xa5')](_0x33718c);}_0x33718c[_0xa67d('0xa6')]-=0x1;if(!this[_0xa67d('0x86')](_0x33718c[_0xa67d('0x102')])){return this['channel']['error'](_0x33718c,_0xa67d('0x103'));}var _0x53dcb3=this[_0xa67d('0x104')][_0xa67d('0x72')](this,_0x33718c[_0xa67d('0x102')]);if(!_0x53dcb3){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x33718c,_0xa67d('0x105'));}if(!this[_0xa67d('0x86')](_0x33718c[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xa67d('0xcf'));}var _0x36ed18=this[_0xa67d('0xf')][_0xa67d('0x106')](_0x53dcb3,_0x33718c['response'],_0x33718c[_0xa67d('0x107')]);var _0x165d8d=_0x36ed18[_0xa67d('0xa4')]?_0x36ed18[_0xa67d('0xa4')][_0xa67d('0x4b')]():'';logger[_0xa67d('0x30')](_0xa67d('0x108'),JSON[_0xa67d('0x74')](_0x36ed18));if(_0x36ed18['result']===-0x1){this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x33718c,_0x165d8d);return _0x36ed18;}else if(_0x36ed18['extra']==='timeout'){_0x36ed18[_0xa67d('0xa4')]=_0x165d8d[_0xa67d('0x9d')]>=parseInt(_0x33718c[_0xa67d('0x109')])?'x':'i';}else{_0x36ed18['result']=_0x165d8d['length']>=parseInt(_0x33718c['mindigit'])&&_0x165d8d[_0xa67d('0x9d')]<=parseInt(_0x33718c[_0xa67d('0x107')])?'x':'i';}var _0x510987=this['getVariable'][_0xa67d('0x72')](this,_0x33718c[_0xa67d('0xce')]);if(!_0x510987){return this['channel'][_0xa67d('0x2e')](_0x33718c,_0xa67d('0xd0'));}this[_0xa67d('0xf')]['setVariable'](_0x510987,_0x165d8d);if(this['isConfigured'](_0x33718c[_0xa67d('0x10a')])){var _0x3be0ea=parseInt(_0x33718c[_0xa67d('0x10a')],0xa);var _0x17e4b=rs['generate']({'charset':'*','length':_0x3be0ea});var _0x1e03d1=_0x165d8d[_0xa67d('0x9d')];if(_0x1e03d1>0x0){if(_0x1e03d1>_0x3be0ea){this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x33718c,_0x33718c['hiddendigitspos']===_0xa67d('0x10b')?_0x17e4b+_0x165d8d[_0xa67d('0x10c')](_0x3be0ea):_0x165d8d[_0xa67d('0x10c')](0x0,_0x1e03d1-_0x3be0ea)+_0x17e4b);}else{this['createSquareDetailsReport'][_0xa67d('0x72')](this,_0x33718c,rs['generate']({'charset':'*','length':_0x1e03d1}));}}else{this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x33718c,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x33718c,_0x165d8d);}return _0x36ed18;};AGIVertices['prototype'][_0xa67d('0xe')]=function(_0x5d0372){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5d0372[_0xa67d('0xae')]));return this[_0xa67d('0xd')](_0x5d0372);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x10d')]=function(_0x225215){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x10e'),_0x225215[_0xa67d('0xae')]));this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x225215,_0x225215[_0xa67d('0x10f')]);return this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x110'),_0x225215[_0xa67d('0x10f')]));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x111')]=function(_0x42c7c0){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x112'),_0x42c7c0['label']));if(!this[_0xa67d('0x86')](_0x42c7c0['aws_access_key_id'])||!this['isConfigured'](_0x42c7c0[_0xa67d('0x89')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x113'));}if(!this[_0xa67d('0x86')](_0x42c7c0[_0xa67d('0x5d')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0xa9'));}this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x42c7c0[_0xa67d('0x5d')]));var _0x2c7142=this[_0xa67d('0x88')]['sync'](this,_0x42c7c0);if(_0x2c7142){this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')]('aws\x20Polly\x20%s\x20file\x20created',_0x2c7142));var _0x337cf7=this[_0xa67d('0xf')]['streamFile'](_0x2c7142);try{fs[_0xa67d('0x114')](_0x2c7142+'.wav');}catch(_0x13988c){logger[_0xa67d('0x2e')](_0x13988c);}return _0x337cf7;}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x42c7c0,_0xa67d('0x115'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x116')]=function(_0x500f0b){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x117'),_0x500f0b[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x500f0b[_0xa67d('0x8e')])||!this[_0xa67d('0x86')](_0x500f0b[_0xa67d('0x89')])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x113'));}if(!this['isConfigured'](_0x500f0b[_0xa67d('0x90')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x500f0b[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['bot']=!![];this[_0xa67d('0x37')](_0x500f0b);this[_0xa67d('0x41')](_0x500f0b['text'],'in','','');this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x118'),_0x500f0b[_0xa67d('0x5d')]));var _0x16812e=this['awsLex'][_0xa67d('0x72')](this,_0x500f0b);if(_0x16812e){for(var _0x29c37d in _0x16812e){if(_0x16812e['hasOwnProperty'](_0x29c37d)&&_[_0xa67d('0x98')](_0x16812e[_0x29c37d])){this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('AWS_LEX_%s',_0x29c37d[_0xa67d('0x6a')]()),_0x16812e[_0x29c37d]);}}if(_['isNil'](_0x16812e['message'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x119'));}else{this[_0xa67d('0x41')](_0x16812e['message'],'out',_0xa67d('0x11a'),'');return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x11b'),_0x16812e[_0xa67d('0x11c')]));}}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x500f0b,_0xa67d('0x11d'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x11e')]=function(_0x41172c){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x41172c[_0xa67d('0xae')],_0x41172c[_0xa67d('0x66')]));if(!this[_0xa67d('0x86')](_0x41172c[_0xa67d('0x7a')])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x11f'));}var _0x6820=_0xa67d('0x120');var _0x1d2d55=util['format'](_0xa67d('0x121'),FILES_PATH,rs[_0xa67d('0x122')](0x4));var _0x4b8e2a=util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x1d2d55,_0x6820);var _0x40575c=!![];if(_0x41172c[_0xa67d('0x123')]===_0xa67d('0x124')){_0x40575c=![];}var _0x2cf23a=this[_0xa67d('0xf')]['recordFile'](_0x1d2d55,_0x6820,_0x41172c['intKey'],_0x41172c[_0xa67d('0x66')],undefined,_0x40575c);if(_0x2cf23a[_0xa67d('0xa4')]!==-0x1){this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x125'),_0x4b8e2a));var _0x3dbfda=this[_0xa67d('0x91')][_0xa67d('0x72')](this,_0x41172c,_0x4b8e2a);if(_0x3dbfda){for(var _0x3ce8a1 in _0x3dbfda){if(_0x3dbfda[_0xa67d('0x97')](_0x3ce8a1)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('GOOGLE_ASR_%s',_0x3ce8a1[_0xa67d('0x6a')]()),_0x3dbfda[_0x3ce8a1]);}}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x3dbfda)));}}return _0x2cf23a;};AGIVertices[_0xa67d('0x18')][_0xa67d('0x126')]=function(_0x19da4b){logger['info'](util['format'](_0xa67d('0x127'),_0x19da4b['label']));if(!this[_0xa67d('0x86')](_0x19da4b['appid'])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20appid\x20configured');}if(!this[_0xa67d('0x86')](_0x19da4b[_0xa67d('0x128')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x129'));}var _0x1b631c=_0xa67d('0x120');var _0x2f1a1a=util[_0xa67d('0x55')]('%s/recordings/%s',FILES_PATH,rs[_0xa67d('0x122')](0x4));var _0x3d0300=util[_0xa67d('0x55')](_0xa67d('0x9f'),_0x2f1a1a,_0x1b631c);var _0x443c35=!![];if(_0x19da4b[_0xa67d('0x123')]===_0xa67d('0x124')){_0x443c35=![];}var _0x5076f0=this[_0xa67d('0xf')]['recordFile'](_0x2f1a1a,_0x1b631c,_0x19da4b[_0xa67d('0x12a')],_0x19da4b[_0xa67d('0x66')],undefined,_0x443c35);if(_0x5076f0['result']!==-0x1){this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')]('tilde\x20%s\x20file\x20created',_0x3d0300));var _0x403e32=this['tildeASR']['sync'](this,_0x19da4b,_0x3d0300);if(_0x403e32){for(var _0x4e4a3a in _0x403e32){if(_0x403e32[_0xa67d('0x97')](_0x4e4a3a)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util['format'](_0xa67d('0x12b'),_0x4e4a3a[_0xa67d('0x6a')]()),_0x403e32[_0x4e4a3a]);}}return this['channel'][_0xa67d('0xa8')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xa67d('0x74')](_0x403e32)));}}return _0x5076f0;};AGIVertices[_0xa67d('0x18')][_0xa67d('0x12c')]=function(_0x4e3e46){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x12d'),_0x4e3e46[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['continueAt'](_0x4e3e46[_0xa67d('0x12e')],_0x4e3e46['extension'],_0x4e3e46['priority']);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x12f')]=function(_0x3ae555){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3ae555[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x3ae555['condition'])){return this['channel']['error'](_0x3ae555,_0xa67d('0x130'));}try{var _0x3011d1=eval(_0x3ae555[_0xa67d('0x131')])?_0xa67d('0x132'):_0xa67d('0x133');this['channel']['noop'](util['format'](_0xa67d('0x134'),_0x3ae555[_0xa67d('0x131')],_0x3011d1));return{'code':0xc8,'result':_0x3011d1};}catch(_0x44ebea){return{'code':0xc8,'result':_0xa67d('0x133')};}};AGIVertices[_0xa67d('0x18')]['gotoiftime']=function(_0x4f26cd){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x135'),_0x4f26cd[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x4f26cd[_0xa67d('0x136')])){return this[_0xa67d('0xf')]['error'](_0x4f26cd,_0xa67d('0x137'));}var _0x46c467=this[_0xa67d('0x25')]['sync'](this,_0x4f26cd[_0xa67d('0x136')]);if(!_0x46c467){return this[_0xa67d('0xf')]['error'](_0x4f26cd,_0xa67d('0x138'));}for(var _0x204e15=0x0;_0x204e15<_0x46c467[_0xa67d('0x9d')];_0x204e15+=0x1){var _0x50d5f8=this[_0xa67d('0xf')][_0xa67d('0x12')](util[_0xa67d('0x55')]('IFTIME(%s?true:false)',_0x46c467[_0x204e15]));if(_0x50d5f8[_0xa67d('0xa4')]===-0x1){return _0x50d5f8;}logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x139'),_0x46c467[_0x204e15],_0x50d5f8[_0xa67d('0xa3')]));if(_0x50d5f8[_0xa67d('0xa3')]===_0xa67d('0x132')){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x139'),_0x46c467[_0x204e15],_0xa67d('0x132')));this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x139'),_0x46c467[_0x204e15],_0xa67d('0x132')));return{'code':0xc8,'result':'true'};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('IFTIME\x20%s\x20%s',_0x46c467[_0x204e15],_0xa67d('0x133')));this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('IFTIME\x20%s\x20%s',_0x46c467[_0x204e15],_0xa67d('0x133')));}}return{'code':0xc8,'result':_0xa67d('0x133')};};AGIVertices['prototype']['hangup']=function(_0x43e92b){logger['info'](util['format'](_0xa67d('0x13a'),_0x43e92b[_0xa67d('0xae')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0xa67d('0x13b')]=function(_0x62b5c1){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x13c'),_0x62b5c1[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x62b5c1[_0xa67d('0x7a')])){return this[_0xa67d('0xf')]['noop'](_0xa67d('0x11f'));}var _0x5bf004=_0xa67d('0x120');var _0x5ea2fd=util[_0xa67d('0x55')](_0xa67d('0x121'),FILES_PATH,rs[_0xa67d('0x122')](0x4));var _0x4ee367=util['format'](_0xa67d('0x9f'),_0x5ea2fd,_0x5bf004);var _0x2e3b51=!![];if(_0x62b5c1['beep']===_0xa67d('0x124')){_0x2e3b51=![];}var _0xde8c6e=this[_0xa67d('0xf')][_0xa67d('0x13d')](_0x5ea2fd,_0x5bf004,_0x62b5c1[_0xa67d('0x12a')],_0x62b5c1[_0xa67d('0x66')],undefined,_0x2e3b51);if(_0xde8c6e['result']!==-0x1){this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x13e'),_0x4ee367));var _0x1da847=this[_0xa67d('0x84')][_0xa67d('0x72')](this,_0x62b5c1,_0x4ee367);if(_0x1da847){for(var _0x4c33a6 in _0x1da847){if(_0x1da847[_0xa67d('0x97')](_0x4c33a6)){this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('ISPEECH_ASR_%s',_0x4c33a6['toUpperCase']()),_0x1da847[_0x4c33a6]);}}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x1da847)));}}return _0xde8c6e;};AGIVertices['prototype'][_0xa67d('0x13f')]=function(_0x587a6a){logger['info'](util['format'](_0xa67d('0x140'),_0x587a6a['label']));if(!this[_0xa67d('0x86')](_0x587a6a[_0xa67d('0x7a')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20key\x20configured');}if(!this[_0xa67d('0x86')](_0x587a6a[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['noop'](util['format'](_0xa67d('0x141'),_0x587a6a[_0xa67d('0x5d')]));var _0x4439cb=this[_0xa67d('0x82')][_0xa67d('0x72')](this,_0x587a6a);if(_0x4439cb){this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x13e'),_0x4439cb));var _0x2eedf8=this[_0xa67d('0xf')][_0xa67d('0x142')](_0x4439cb,_0x587a6a[_0xa67d('0x12a')]);try{fs[_0xa67d('0x114')](_0x4439cb+_0xa67d('0xf4'));}catch(_0x3db40f){logger[_0xa67d('0x2e')](_0x3db40f);}return _0x2eedf8;}return this[_0xa67d('0xf')]['error'](_0x587a6a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa67d('0x18')][_0xa67d('0x143')]=function(_0x5b9ba4){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x144'),_0x5b9ba4[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x5b9ba4[_0xa67d('0x145')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5b9ba4,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa67d('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4[_0xa67d('0x145')]));var _0x1013e8=this[_0xa67d('0x53')][_0xa67d('0x72')](this,_0x5b9ba4['findBy']);if(_0x1013e8){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4[_0xa67d('0x145')]));this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')]['callerid'],_0x5b9ba4[_0xa67d('0x145')]));return{'code':0xc8,'result':_0xa67d('0x147')};}else{logger['info'](util[_0xa67d('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4[_0xa67d('0x145')]));this['channel']['noop'](util['format'](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x5b9ba4['findBy']));return{'code':0xc8,'result':_0xa67d('0x149')};}};AGIVertices['prototype']['logout']=function(_0x561aaa){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x561aaa[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x561aaa[_0xa67d('0x145')])){return this['channel'][_0xa67d('0x2e')](_0x561aaa,'no\x20find\x20by\x20configured');}logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x14a'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));var _0xfcdffc=this[_0xa67d('0x52')]['sync'](this,_0x561aaa[_0xa67d('0x145')]);if(_0xfcdffc){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x146'),this['channel']['callerid'],_0x561aaa[_0xa67d('0x145')]));this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));return{'code':0xc8,'result':_0xa67d('0x147')};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x561aaa[_0xa67d('0x145')]));return{'code':0xc8,'result':_0xa67d('0x149')};}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x14b')]=function(_0x147974){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x14c'),_0x147974[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x147974[_0xa67d('0x14d')])){return this[_0xa67d('0xf')]['error'](_0x147974,_0xa67d('0x14e'));}this['channel']['noop'](util[_0xa67d('0x55')]('math\x20%s',_0x147974[_0xa67d('0x14d')]));var _0x5e7e10=eval(_0x147974[_0xa67d('0x14d')]);if(!this[_0xa67d('0x86')](_0x147974[_0xa67d('0xce')])){return this['channel'][_0xa67d('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4c67a0=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x147974[_0xa67d('0xce')]);if(!_0x4c67a0){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x147974,_0xa67d('0xd0'));}if(_[_0xa67d('0x9c')](_0x5e7e10)){var _0x3a9bd2=this;_0x5e7e10[_0xa67d('0x14f')](function(_0x40456e,_0x4e9b27){_0x3a9bd2['channel'][_0xa67d('0xa0')](util['format']('%s[%s]',_0x4c67a0,_0x4e9b27),_0x40456e);});return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x150'),_0x4c67a0));}else{return this[_0xa67d('0xf')][_0xa67d('0xa0')](_0x4c67a0,_0x5e7e10);}};AGIVertices[_0xa67d('0x18')][_0xa67d('0xc')]=function(_0x5d64a8){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5d64a8[_0xa67d('0xae')]));if(_0x5d64a8['retry']===0x0){return this['maxRetry'](_0x5d64a8);}_0x5d64a8[_0xa67d('0xa6')]-=0x1;if(!this[_0xa67d('0x86')](_0x5d64a8[_0xa67d('0x102')])){return this[_0xa67d('0xf')]['error'](_0x5d64a8,_0xa67d('0x103'));}var _0x22074b=this['getSound'][_0xa67d('0x72')](this,_0x5d64a8['file_id']);if(!_0x22074b){return this['channel']['error'](_0x5d64a8,_0xa67d('0x105'));}var _0x166c01=this[_0xa67d('0xf')]['getData'](_0x22074b,_0x5d64a8[_0xa67d('0x151')],_0x5d64a8['digit']);var _0x3ae2af=_0x166c01[_0xa67d('0xa4')];if(_0x166c01[_0xa67d('0xa4')]===-0x1){this[_0xa67d('0x37')]['sync'](this,_0x5d64a8,'-1');return _0x166c01;}else if(_0x166c01[_0xa67d('0xa3')]===_0xa67d('0x66')){_0x166c01[_0xa67d('0xa4')]=_0x166c01[_0xa67d('0xa4')][_0xa67d('0x9d')]>0x0?_0x166c01[_0xa67d('0xa4')]:'t';}else if(_[_0xa67d('0x43')](_0x166c01[_0xa67d('0xa4')])){_0x166c01[_0xa67d('0xa4')]='#';_0x3ae2af='#';}if(!this[_0xa67d('0x86')](_0x5d64a8[_0xa67d('0xce')])){this[_0xa67d('0xf')][_0xa67d('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x130f9a=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x5d64a8[_0xa67d('0xce')]);if(!_0x130f9a){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5d64a8,_0xa67d('0xd0'));}this[_0xa67d('0xf')]['setVariable'](_0x130f9a,_0x3ae2af);}this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x5d64a8,_0x3ae2af);return _0x166c01;};AGIVertices[_0xa67d('0x18')][_0xa67d('0xa8')]=function(_0x48e85e){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x152'),_0x48e85e[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0x48e85e[_0xa67d('0x153')]||_0x48e85e[_0xa67d('0xae')]);};AGIVertices['prototype'][_0xa67d('0x154')]=function(_0x186de5){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x155'),_0x186de5[_0xa67d('0xae')]));if(!this['isConfigured'](_0x186de5['findBy'])){return this[_0xa67d('0xf')]['error'](_0x186de5,'no\x20find\x20by\x20configured');}logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x14a'),this[_0xa67d('0xf')]['callerid'],_0x186de5[_0xa67d('0x145')]));var _0x48ad65=this[_0xa67d('0x4d')][_0xa67d('0x72')](this,_0x186de5[_0xa67d('0x156')]);var _0x1435c7=this[_0xa67d('0x4f')][_0xa67d('0x72')](this,_0x186de5[_0xa67d('0x145')],_0x48ad65);if(_0x1435c7){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x186de5[_0xa67d('0x145')]));this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')]['callerid'],_0x186de5[_0xa67d('0x145')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x186de5[_0xa67d('0x145')]));this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x186de5[_0xa67d('0x145')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x157')]=function(_0x30316b){logger['info'](util[_0xa67d('0x55')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x30316b[_0xa67d('0xae')]));if(!this['isConfigured'](_0x30316b[_0xa67d('0x102')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x30316b,_0xa67d('0x103'));}var _0x310d58=this[_0xa67d('0x104')][_0xa67d('0x72')](this,_0x30316b[_0xa67d('0x102')]);if(!_0x310d58){return this['channel'][_0xa67d('0x2e')](_0x30316b,_0xa67d('0x105'));}var _0x113879=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0x158'),[_0x310d58,_0x30316b[_0xa67d('0xdb')]]);if(_0x113879[_0xa67d('0xa4')]===-0x1){return _0x113879;}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xbe'),_0xa67d('0x158'),_0x310d58));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x159')]=function(_0x41216a){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x15a'),_0x41216a[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x41216a['queue_id'])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x41216a,'no\x20queue\x20selected');}var _0x231423='';var _0x1e7e14=parseInt(_0x41216a['queue_id'],0xa);if(isNaN(_0x1e7e14)){_0x231423=_0x41216a[_0xa67d('0x15b')];}else{_0x231423=this[_0xa67d('0x14')][_0xa67d('0x72')](this,_0x41216a[_0xa67d('0x15b')]);if(!_0x231423){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x41216a,_0xa67d('0x15c'));}}var _0x40a0f7='';if(this['isConfigured'](_0x41216a[_0xa67d('0x102')])){var _0x4cc7a6=this[_0xa67d('0x104')][_0xa67d('0x72')](this,_0x41216a[_0xa67d('0x102')]);if(_0x4cc7a6){_0x40a0f7=_0x4cc7a6;}}this[_0xa67d('0x37')]['sync'](this,_0x41216a,_0x231423);if(_0x41216a['opts'][_0xa67d('0x15d')]('x')<0x0){_0x41216a[_0xa67d('0xdb')]+='x';}if(_0x41216a['opts']['indexOf']('X')<0x0){_0x41216a[_0xa67d('0xdb')]+='X';}this['channel'][_0xa67d('0xa0')](_0xa67d('0x15e'),_0x231423?_0x231423[_0xa67d('0x15f')]():'');var _0x34bef5=this['channel'][_0xa67d('0x59')](_0xa67d('0x160'),[_0x231423,_0x41216a[_0xa67d('0xdb')],_0x41216a[_0xa67d('0x63')],_0x40a0f7,_0x41216a[_0xa67d('0x66')],_0x41216a[_0xa67d('0x8')],_0x41216a[_0xa67d('0x161')],_0x41216a[_0xa67d('0x162')],'',_0x41216a[_0xa67d('0x163')]]);if(_0x34bef5['result']===-0x1){return _0x34bef5;}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0xbe'),_0xa67d('0x160'),_0x231423));};AGIVertices['prototype']['record']=function(_0xdec7b9){logger[_0xa67d('0x30')](util['format'](_0xa67d('0x164'),_0xdec7b9[_0xa67d('0xae')]));var _0xe8cc85=_0xdec7b9['recordingFormat']||_0xa67d('0x120');var _0x163849=util[_0xa67d('0x55')](_0xa67d('0x165'),this[_0xa67d('0xf')][_0xa67d('0x38')],rs[_0xa67d('0x122')](0x5));var _0x1902bf=util['format'](_0xa67d('0x166'),FILES_PATH,_0x163849,_0xe8cc85);var _0x550a25=util[_0xa67d('0x55')](_0xa67d('0x121'),FILES_PATH,_0x163849);this['createSquareRecording'][_0xa67d('0x72')](this,_0xdec7b9,_0x163849,_0x1902bf);this[_0xa67d('0xf')][_0xa67d('0xa0')](_0xa67d('0x167'),_0x163849);logger[_0xa67d('0x30')](_0xa67d('0x168'),_0x550a25,_0xe8cc85,_0xdec7b9[_0xa67d('0x169')],_0xdec7b9[_0xa67d('0x66')]);return this['channel'][_0xa67d('0x13d')](_0x550a25,_0xe8cc85,_0xdec7b9[_0xa67d('0x169')],_0xdec7b9[_0xa67d('0x66')],undefined,!![]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x16a')]=function(_0x38ac8c){logger['info'](util[_0xa67d('0x55')](_0xa67d('0x16b'),_0x38ac8c[_0xa67d('0xae')]));if(!this['isConfigured'](_0x38ac8c[_0xa67d('0x63')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x16c'));}var _0x551ffb=this[_0xa67d('0x16d')][_0xa67d('0x72')](this,_0x38ac8c);logger[_0xa67d('0x30')](util['format'](_0xa67d('0x16e'),util[_0xa67d('0x16f')](_0x551ffb,{'showHidden':![],'depth':null})));if(!this[_0xa67d('0x86')](_0x38ac8c[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x170'));}var _0x208aa2=this['getVariable'][_0xa67d('0x72')](this,_0x38ac8c['variable_id']);if(!_0x208aa2){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x38ac8c,'no\x20variable\x20found');}this[_0xa67d('0xf')]['setVariable'](util[_0xa67d('0x55')](_0xa67d('0x171'),_0x208aa2),_0x551ffb[_0xa67d('0x76')]?_0x551ffb[_0xa67d('0x76')]:'200');this[_0xa67d('0xf')][_0xa67d('0xa0')](util[_0xa67d('0x55')]('%s_STATUS_MESSAGE',_0x208aa2),_0x551ffb['statusMessage']?_0x551ffb[_0xa67d('0x77')]:'OK');if(_0x551ffb[_0xa67d('0x6b')]){try{this[_0xa67d('0x172')](_0x551ffb['body'],_0x208aa2);}catch(_0x3a99db){logger['error'](util[_0xa67d('0x55')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x208aa2));}}return this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0xd4'),_0x208aa2));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x173')]=function(_0x56ad54){logger['info'](util[_0xa67d('0x55')](_0xa67d('0x174'),_0x56ad54[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['sayDigits'](_0x56ad54['digits'][_0xa67d('0x5a')](/\s+/g,''),_0x56ad54[_0xa67d('0x169')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x175')]=function(_0x4aa48f){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4aa48f[_0xa67d('0xae')]));return this['channel'][_0xa67d('0x176')](_0x4aa48f[_0xa67d('0x65')][_0xa67d('0x5a')](/\s+/g,''),_0x4aa48f[_0xa67d('0x169')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x177')]=function(_0x2d6bb5){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x178'),_0x2d6bb5[_0xa67d('0xae')]));return this[_0xa67d('0xf')][_0xa67d('0x179')](_0x2d6bb5[_0xa67d('0x5d')],_0x2d6bb5[_0xa67d('0x169')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x17a')]=function(_0x152115){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x17b'),_0x152115['label']));if(!this['isConfigured'](_0x152115['account_id'])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x17c'));}var _0x8909b5=this[_0xa67d('0x22')][_0xa67d('0x72')](this,_0x152115['account_id']);if(!_0x8909b5||!_0x8909b5[_0xa67d('0x17d')]){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x152115,_0xa67d('0x17e'));}var _0x3038e1={'from':util['format'](_0xa67d('0x17f'),_0x8909b5['name'],_0x8909b5[_0xa67d('0x180')]||_0x8909b5[_0xa67d('0x17d')][_0xa67d('0x181')]),'to':_0x152115['to']||'','cc':_0x152115['cc']||'','bcc':_0x152115[_0xa67d('0x182')]||'','subject':_0x152115[_0xa67d('0x183')],'html':_0x152115[_0xa67d('0x5d')],'text':_0x152115[_0xa67d('0x5d')]};if(this[_0xa67d('0x86')](_0x152115[_0xa67d('0x184')])){}logger['debug'](_0xa67d('0x185'),JSON[_0xa67d('0x74')](_0x3038e1));this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x152115,_0x152115[_0xa67d('0x186')]);this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x187'),_0x8909b5[_0xa67d('0x16')]));this[_0xa67d('0x24')][_0xa67d('0x72')](this,_0x8909b5[_0xa67d('0x188')],_0x3038e1);return this[_0xa67d('0xf')][_0xa67d('0xa8')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa67d('0x18')]['sendFax']=function(_0x23fc96){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x189'),_0x23fc96[_0xa67d('0xae')]));return this[_0xa67d('0xf')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xa67d('0x18')][_0xa67d('0x18a')]=function(_0x10e651){logger['info'](util[_0xa67d('0x55')](_0xa67d('0x18b'),_0x10e651[_0xa67d('0xae')]));if(!this['isConfigured'](_0x10e651[_0xa67d('0x18c')])){return this['channel'][_0xa67d('0xa8')](_0xa67d('0x18d'));}var _0x21ba72=this[_0xa67d('0x18e')][_0xa67d('0x72')](this,_0x10e651[_0xa67d('0x18c')]);if(!_0x21ba72){return this['channel'][_0xa67d('0x2e')](_0x10e651,_0xa67d('0x18f'));}var _0x5c8789={'body':_0x10e651[_0xa67d('0x190')],'phone':_0x10e651['to']||'','SmsAccountId':_0x21ba72['id']};logger['debug'](_0xa67d('0x191'),JSON['stringify'](_0x5c8789));this[_0xa67d('0x37')][_0xa67d('0x72')](this,_0x10e651,_0x10e651['sms_account_id']);this['channel'][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x192'),_0x21ba72['name']));this['createSmsMessage'][_0xa67d('0x72')](this,_0x5c8789);return this[_0xa67d('0xf')]['noop'](_0xa67d('0x193'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x194')]=function(_0xb9b514){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x195'),_0xb9b514['label']));if(!this['isConfigured'](_0xb9b514[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xb9b514,_0xa67d('0x196'));}var _0x4f03d9=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0xb9b514[_0xa67d('0xce')]);if(!_0x4f03d9){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0xb9b514,_0xa67d('0xd0'));}return this['channel'][_0xa67d('0xa0')](_0x4f03d9,_0xb9b514[_0xa67d('0x197')]);};AGIVertices[_0xa67d('0x18')][_0xa67d('0x198')]=function(_0x235cb1){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('Enter\x20in\x20START\x20(%s)\x20block',_0x235cb1['label']));this['channel']['noop'](_0xa67d('0x199'));if(_0x235cb1[_0xa67d('0xb8')]===_0xa67d('0x19a')){this[_0xa67d('0xf')][_0xa67d('0xa8')]('Answer');return this[_0xa67d('0xf')][_0xa67d('0xb8')]();}return this['channel']['noop'](_0xa67d('0x19b'));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x19c')]=function(_0x5d4e94){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x19d'),_0x5d4e94[_0xa67d('0xae')]));if(!this[_0xa67d('0x86')](_0x5d4e94[_0xa67d('0x19e')])){return this['channel'][_0xa67d('0x2e')](_0x5d4e94,'no\x20subproject\x20selected');}var _0x31a9c0=this[_0xa67d('0x19f')][_0xa67d('0x72')](this,_0x5d4e94['project_id']);if(!this[_0xa67d('0x86')](_0x31a9c0)){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5d4e94,util['format'](_0xa67d('0x1a0'),_0x5d4e94['project_id']));}if(_0x31a9c0===this[_0xa67d('0xf')][_0xa67d('0x3a')]){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x5d4e94,_0xa67d('0x1a1'));}this[_0xa67d('0x37')]['sync'](this,_0x5d4e94,_0x31a9c0);var _0x2bbbd2=this[_0xa67d('0xf')][_0xa67d('0x59')](_0xa67d('0x1a2'),util['format'](_0xa67d('0x1a3'),config[_0xa67d('0x8')][_0xa67d('0x1a4')]||_0xa67d('0x1a5'),_0x31a9c0,this[_0xa67d('0xf')]['arg_1']));if(_0x2bbbd2[_0xa67d('0xa4')]===-0x1){return _0x2bbbd2;}return this['channel']['noop'](util[_0xa67d('0x55')]('Executed\x20command\x20%s\x20%s','AGI',_0x31a9c0));};AGIVertices['prototype'][_0xa67d('0x1a6')]=function(_0x5d6984){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1a7'),_0x5d6984['label']));var _0x5698a8=this[_0xa67d('0x58')][_0xa67d('0x72')](this,_0x5d6984[_0xa67d('0xb6')]);this[_0xa67d('0x37')]['sync'](this,_0x5d6984,_0x5d6984[_0xa67d('0xb6')]);if(this[_0xa67d('0x86')](_0x5d6984[_0xa67d('0xce')])){var _0x45dd11=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x5d6984[_0xa67d('0xce')]);if(_0x45dd11){this[_0xa67d('0xf')][_0xa67d('0xa0')](_0x45dd11,_0x5698a8);return this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x1a8'),_0x5d6984[_0xa67d('0xb6')],_0x45dd11));}}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x1a9'),_0x5d6984['command']));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1aa')]=function(_0x4fb85f){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1ab'),_0x4fb85f[_0xa67d('0xae')]));_0x4fb85f[_0xa67d('0x5d')]=_0x4fb85f[_0xa67d('0x5d')][_0xa67d('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa67d('0x86')](_0x4fb85f[_0xa67d('0x5c')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0x1ac'));}if(!this[_0xa67d('0x86')](_0x4fb85f[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4fb85f[_0xa67d('0x5d')]));var _0x2b0c3c=this['googleCloudTTS'][_0xa67d('0x72')](this,_0x4fb85f);if(_0x2b0c3c){this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2b0c3c));var _0x38c919=this['channel']['streamFile'](_0x2b0c3c);try{fs['unlink'](_0x2b0c3c+_0xa67d('0xf4'));}catch(_0x1fc06a){logger[_0xa67d('0x2e')](_0x1fc06a);}return _0x38c919;}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x4fb85f,_0xa67d('0x1ad'));};AGIVertices['prototype']['tts']=function(_0x55a82e){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1ae'),_0x55a82e[_0xa67d('0xae')]));_0x55a82e['text']=_0x55a82e[_0xa67d('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa67d('0x86')](_0x55a82e[_0xa67d('0x5d')])){return this[_0xa67d('0xf')][_0xa67d('0xa8')](_0xa67d('0xa9'));}this[_0xa67d('0xf')]['noop'](util['format'](_0xa67d('0x1af'),_0x55a82e[_0xa67d('0x5d')]));var _0x52374b=this[_0xa67d('0x1b0')]['sync'](this,_0x55a82e);if(_0x52374b){this[_0xa67d('0xf')][_0xa67d('0xa8')](util['format'](_0xa67d('0x1b1'),_0x52374b));var _0x22a1ab=this[_0xa67d('0xf')][_0xa67d('0x142')](_0x52374b);try{fs[_0xa67d('0x114')](_0x52374b+'.wav');}catch(_0x4bdc33){logger['error'](_0x4bdc33);}return _0x22a1ab;}return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x55a82e,_0xa67d('0x1b2'));};AGIVertices['prototype'][_0xa67d('0x1b3')]=function(_0x35ee19){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1b4'),_0x35ee19['label']));if(!this['isConfigured'](_0x35ee19[_0xa67d('0x145')])){return this['channel'][_0xa67d('0x2e')](_0x35ee19,'no\x20find\x20by\x20configured');}logger['info'](util[_0xa67d('0x55')](_0xa67d('0x14a'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19['findBy']));var _0x26daad=this[_0xa67d('0x51')]['sync'](this,_0x35ee19['findBy']);if(_0x26daad){logger[_0xa67d('0x30')](util[_0xa67d('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')](_0xa67d('0x146'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));this[_0xa67d('0xf')][_0xa67d('0xa8')](util[_0xa67d('0x55')](_0xa67d('0x148'),this[_0xa67d('0xf')][_0xa67d('0x3b')],_0x35ee19[_0xa67d('0x145')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1b5')]=function(_0x465026){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x465026['label']));var _0x3df284=this['channel'][_0xa67d('0x59')](_0xa67d('0x1b6'),[_0x465026['mailbox'],_0x465026[_0xa67d('0x78')]]);if(_0x3df284['result']===-0x1){return _0x3df284;}return this[_0xa67d('0xf')]['noop'](util[_0xa67d('0x55')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x465026['mailbox']));};AGIVertices[_0xa67d('0x18')][_0xa67d('0x1b7')]=function(_0x13e2d6){logger[_0xa67d('0x30')](util[_0xa67d('0x55')](_0xa67d('0x1b8'),_0x13e2d6['label']));if(!this[_0xa67d('0x86')](_0x13e2d6[_0xa67d('0xce')])){return this[_0xa67d('0xf')][_0xa67d('0x2e')](_0x13e2d6,_0xa67d('0x196'));}var _0x4c8241=this[_0xa67d('0x12')][_0xa67d('0x72')](this,_0x13e2d6[_0xa67d('0xce')]);if(!_0x4c8241){return this['channel'][_0xa67d('0x2e')](_0x13e2d6,_0xa67d('0xd0'));}var _0xec49ad=this[_0xa67d('0xf')][_0xa67d('0x12')](_0x4c8241);return{'code':0xc8,'result':_0xec49ad[_0xa67d('0xa3')]?_0xec49ad['extra']:'-'};};String['prototype'][_0xa67d('0xa2')]=function(_0x34e25d,_0x54352c){return this[_0xa67d('0xa1')](_0x34e25d)[_0xa67d('0x1b9')](_0x54352c);};module[_0xa67d('0x1ba')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 622480b..6a7e8cc 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 _0x152f=['[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','updateAcw','update','catch','finally','error','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','interface','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x3811da,_0x19326d){var _0x53c4c6=function(_0x11e5b2){while(--_0x11e5b2){_0x3811da['push'](_0x3811da['shift']());}};_0x53c4c6(++_0x19326d);}(_0x152f,0x101));var _0xf152=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x152f[_0x54d4fe];return _0x1ab5bb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf152('0x0'));var ami=require(_0xf152('0x1'));var logger=require('../../../config/logger')(_0xf152('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xf152('0x3'));function Acw(_0x76de10){this[_0xf152('0x4')]=_0x76de10['voiceQueues'];this[_0xf152('0x5')]=_0x76de10['agents'];this[_0xf152('0x6')]=_0x76de10['timers'];this[_0xf152('0x7')]={};ami['on'](_0xf152('0x8'),this[_0xf152('0x9')][_0xf152('0xa')](this));ami['on'](_0xf152('0xb'),this['syncHangupRequest'][_0xf152('0xa')](this));ami['on']('hangup',this[_0xf152('0xc')][_0xf152('0xa')](this));ami['on'](_0xf152('0xd'),this['syncAgentRingNoAnswer'][_0xf152('0xa')](this));ami['on']('attendedtransfer',this[_0xf152('0xe')]['bind'](this));ami['on'](_0xf152('0xf'),this[_0xf152('0x10')][_0xf152('0xa')](this));ami['on']('custom:agentConnectPreview',this[_0xf152('0x11')][_0xf152('0xa')](this));}function getDiff(_0x162f84){var _0x402ffd=moment()[_0xf152('0x12')](0x0);var _0x453fa3=moment(_0x162f84)[_0xf152('0x12')](0x0);return _0x402ffd[_0xf152('0x13')](_0x453fa3,_0xf152('0x14'));}Acw[_0xf152('0x15')][_0xf152('0x16')]=function(_0x16a036){try{var _0x263e70=this;var _0x1710a1=this[_0xf152('0x7')][_0x16a036]['interface'];var _0x352a29=this['channels'][_0x16a036][_0xf152('0x17')];var _0xe1aa95=this[_0xf152('0x4')][_0x352a29];var _0x5cb3f0=![];var _0x36d491=_0xf152('0x18');if(_0xe1aa95['mandatoryDisposition']){if(_0xe1aa95[_0xf152('0x19')]['name']){_0x5cb3f0=!![];_0x36d491=_0xe1aa95[_0xf152('0x19')][_0xf152('0x1a')];}}ami[_0xf152('0x1b')]({'action':_0xf152('0x1c'),'interface':_0x1710a1,'paused':!![],'reason':_0x36d491})[_0xf152('0x1d')](function(_0x4bd5a9){if(_0x263e70[_0xf152('0x5')][_0x1710a1]){return RpcUser[_0xf152('0x1e')](_0x263e70[_0xf152('0x5')][_0x1710a1]['id'])[_0xf152('0x1d')](function(_0x376032){if(_0x376032&&!_0x376032['voicePause']){logger[_0xf152('0x1f')](_0xf152('0x20'),_0x16a036,_0x1710a1,_0x352a29);var _0xc62028=_0x263e70[_0xf152('0x7')][_0x16a036][_0xf152('0x21')]&&_0x263e70[_0xf152('0x7')][_0x16a036][_0xf152('0x22')]?_0x263e70['channels'][_0x16a036][_0xf152('0x22')]:_0x16a036;return RpcUser[_0xf152('0x23')](_0x263e70[_0xf152('0x5')][_0x1710a1],_0x36d491,_0xc62028)['then'](function(_0x32603a){if(!_0x5cb3f0){_0x263e70[_0xf152('0x6')][_0x1710a1]={};logger[_0xf152('0x1f')](_0xf152('0x24'),_0x16a036,_0x263e70[_0xf152('0x4')][_0x352a29][_0xf152('0x25')],_0x1710a1,_0x352a29);_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x26')]=setTimeout(_0x263e70[_0xf152('0x27')]['bind'](_0x263e70,_0x1710a1),_0x263e70[_0xf152('0x4')][_0x352a29]['acwTimeout']*0x3e8);_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x29')]=_0x16a036;_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x17')]=_0x352a29;_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x2a')]=function(){var _0x1e1d27=getDiff(_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x28')]);clearTimeout(_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x26')]);_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x26')]=![];RpcVoiceAgentReport[_0xf152('0x2b')]({'acwtime':_0x1e1d27},_0x263e70[_0xf152('0x6')][_0x1710a1][_0xf152('0x29')],_0x1710a1)[_0xf152('0x1d')](function(_0x23d076){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x16a036,_0x1e1d27,_0x23d076);})['catch'](function(_0x574bc7){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x16a036,_0x574bc7);});delete _0x263e70[_0xf152('0x6')][_0x1710a1];};}});}else{logger[_0xf152('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x16a036,_0x1710a1,_0x352a29);}});}})[_0xf152('0x2c')](function(_0x4730c5){logger['error'](_0xf152('0x24'),_0x16a036,_0x263e70[_0xf152('0x4')][_0x352a29][_0xf152('0x25')],_0x1710a1,_0x352a29);})[_0xf152('0x2d')](function(){delete _0x263e70[_0xf152('0x7')][_0x16a036];});}catch(_0x19360e){logger[_0xf152('0x2e')](_0xf152('0x2f'),_0x19360e[_0xf152('0x30')]);}};Acw[_0xf152('0x15')][_0xf152('0x27')]=function(_0x3f9c92){try{var _0x10f910=this;if(_0x10f910[_0xf152('0x6')][_0x3f9c92]){_0x10f910['timers'][_0x3f9c92][_0xf152('0x26')]=![];var _0x28bbd6=_0x10f910[_0xf152('0x6')][_0x3f9c92]['uniqueid'];var _0x3f17de=_0x10f910[_0xf152('0x6')][_0x3f9c92][_0xf152('0x17')];var _0x52f366=_0x10f910[_0xf152('0x4')][_0x3f17de][_0xf152('0x25')];logger[_0xf152('0x1f')]('[%s][TIMER][STOP][AGENT:%s]',_0x28bbd6,_0x3f9c92);RpcUser[_0xf152('0x31')](this[_0xf152('0x5')][_0x3f9c92]);RpcVoiceAgentReport[_0xf152('0x2b')]({'acwtime':_0x52f366,'agentacw':!![]},_0x28bbd6,_0x3f9c92)['then'](function(_0x3f27ff){logger[_0xf152('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x28bbd6,_0x52f366,_0x3f27ff);})[_0xf152('0x2c')](function(_0x148619){logger[_0xf152('0x2e')](_0xf152('0x32'),_0x28bbd6,_0x148619);});}else{logger[_0xf152('0x2e')](_0xf152('0x33'),_0x3f9c92);if(_0x10f910[_0xf152('0x6')]){logger['info'](_0xf152('0x34'),JSON[_0xf152('0x35')](_0x10f910['timers']));}}}catch(_0x1df502){logger[_0xf152('0x2e')](_0xf152('0x36'),_0x1df502[_0xf152('0x30')]);}};Acw['prototype'][_0xf152('0x9')]=function(_0x30e86f){try{if(this[_0xf152('0x4')][_0x30e86f[_0xf152('0x17')]]&&(this[_0xf152('0x4')][_0x30e86f[_0xf152('0x17')]][_0xf152('0x2')]||this[_0xf152('0x4')][_0x30e86f[_0xf152('0x17')]][_0xf152('0x37')])){if(this[_0xf152('0x5')][_0x30e86f[_0xf152('0x38')]]){this['channels'][_0x30e86f[_0xf152('0x29')]]={'queue':_0x30e86f[_0xf152('0x17')],'interface':_0x30e86f['interface'],'destlinkedid':_0x30e86f['destlinkedid']};}}}catch(_0x46d407){logger[_0xf152('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x46d407[_0xf152('0x30')]);}};Acw[_0xf152('0x15')][_0xf152('0x11')]=function(_0x15818d){try{if(this[_0xf152('0x4')][_0x15818d[_0xf152('0x17')]]&&(this[_0xf152('0x4')][_0x15818d['queue']][_0xf152('0x2')]||this[_0xf152('0x4')][_0x15818d['queue']]['mandatoryDisposition'])){if(this[_0xf152('0x5')][_0x15818d[_0xf152('0x38')]]){this[_0xf152('0x7')][_0x15818d['uniqueid']]={'queue':_0x15818d[_0xf152('0x17')],'interface':_0x15818d[_0xf152('0x38')]};}}}catch(_0x22ebce){logger[_0xf152('0x2e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x22ebce['message']);}};Acw['prototype'][_0xf152('0x39')]=function(_0x36971a){try{if(this['channels'][_0x36971a[_0xf152('0x29')]]&&_[_0xf152('0x3a')](this[_0xf152('0x7')][_0x36971a[_0xf152('0x29')]]['attended'])){logger[_0xf152('0x1f')](_0xf152('0x3b'),_0x36971a[_0xf152('0x29')]);this[_0xf152('0x16')](_0x36971a[_0xf152('0x29')]);}else if(this[_0xf152('0x7')][_0x36971a[_0xf152('0x3c')]]&&_['isUndefined'](this[_0xf152('0x7')][_0x36971a[_0xf152('0x3c')]][_0xf152('0x21')])){logger[_0xf152('0x1f')]('[%s][HANGUP:LINKEDID]',_0x36971a[_0xf152('0x3c')]);this[_0xf152('0x16')](_0x36971a[_0xf152('0x3c')]);}}catch(_0x55d498){logger[_0xf152('0x2e')](_0xf152('0x3d'),_0x55d498['message']);}};Acw[_0xf152('0x15')]['syncHangup']=function(_0x260983){try{if(this[_0xf152('0x7')][_0x260983[_0xf152('0x29')]]&&this['channels'][_0x260983[_0xf152('0x29')]][_0xf152('0x21')]){logger[_0xf152('0x1f')](_0xf152('0x3e'),_0x260983['uniqueid']);this['startAcw'](_0x260983[_0xf152('0x29')]);}else if(this[_0xf152('0x7')][_0x260983[_0xf152('0x3c')]]&&this['channels'][_0x260983[_0xf152('0x3c')]]['attended']){logger[_0xf152('0x1f')](_0xf152('0x3f'),_0x260983[_0xf152('0x3c')]);this[_0xf152('0x16')](_0x260983['linkedid']);}}catch(_0x1e548a){logger[_0xf152('0x2e')](_0xf152('0x40'),_0x1e548a[_0xf152('0x30')]);}};Acw[_0xf152('0x15')][_0xf152('0xe')]=function(_0x268417){try{if(!_[_0xf152('0x41')](this[_0xf152('0x7')][_0x268417[_0xf152('0x42')]])){this[_0xf152('0x16')](_0x268417[_0xf152('0x42')]);if(this[_0xf152('0x7')][_0x268417['secondtransfereruniqueid']]){this[_0xf152('0x7')][_0x268417[_0xf152('0x43')]]['attended']=!![];this[_0xf152('0x7')][_0x268417[_0xf152('0x44')]]=this[_0xf152('0x7')][_0x268417[_0xf152('0x43')]];delete this[_0xf152('0x7')][_0x268417[_0xf152('0x43')]];}}else if(!_['isNil'](this[_0xf152('0x7')][_0x268417[_0xf152('0x44')]])){this[_0xf152('0x16')](_0x268417[_0xf152('0x44')]);if(this[_0xf152('0x7')][_0x268417['origtransfereruniqueid']]){this[_0xf152('0x7')][_0x268417[_0xf152('0x45')]][_0xf152('0x21')]=!![];this[_0xf152('0x7')][_0x268417[_0xf152('0x42')]]=this[_0xf152('0x7')][_0x268417[_0xf152('0x45')]];delete this[_0xf152('0x7')][_0x268417[_0xf152('0x45')]];}}}catch(_0x363526){logger['error'](_0xf152('0x46'),_0x363526[_0xf152('0x30')]);}};Acw['prototype'][_0xf152('0x10')]=function(_0x1da22e){try{if(this[_0xf152('0x7')][_0x1da22e[_0xf152('0x47')]]){logger[_0xf152('0x1f')](_0xf152('0x48'),JSON[_0xf152('0x35')](_0x1da22e[_0xf152('0x47')]));this[_0xf152('0x16')](_0x1da22e['transfereruniqueid']);}else if(this[_0xf152('0x7')][_0x1da22e[_0xf152('0x49')]]){logger[_0xf152('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x1da22e[_0xf152('0x49')]));this[_0xf152('0x16')](_0x1da22e['transfererlinkedid']);}}catch(_0x15d41c){logger[_0xf152('0x2e')](_0xf152('0x4a'),_0x15d41c['message']);}};Acw[_0xf152('0x15')][_0xf152('0x4b')]=function(_0x5e751e){try{if(this[_0xf152('0x4')][_0x5e751e[_0xf152('0x17')]]&&this[_0xf152('0x4')][_0x5e751e[_0xf152('0x17')]][_0xf152('0x4c')]===_0xf152('0x4d')){if(this[_0xf152('0x5')][_0x5e751e['interface']]){logger[_0xf152('0x1f')](_0xf152('0x4e'),_0x5e751e[_0xf152('0x29')],_0x5e751e[_0xf152('0x38')],_0x5e751e[_0xf152('0x17')]);return RpcUser[_0xf152('0x23')](this[_0xf152('0x5')][_0x5e751e[_0xf152('0x38')]],'Auto-Pause',_0x5e751e[_0xf152('0x29')]);}}}catch(_0x140be6){logger[_0xf152('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x140be6[_0xf152('0x30')]);}};module[_0xf152('0x4f')]=Acw; \ No newline at end of file +var _0x7ca5=['startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','attended','destlinkedid','savePause','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype'];(function(_0x37fff5,_0x2e32a4){var _0x51c788=function(_0x3738bd){while(--_0x3738bd){_0x37fff5['push'](_0x37fff5['shift']());}};_0x51c788(++_0x2e32a4);}(_0x7ca5,0x191));var _0x57ca=function(_0x4b931e,_0x23ea4a){_0x4b931e=_0x4b931e-0x0;var _0x4124d1=_0x7ca5[_0x4b931e];return _0x4124d1;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x57ca('0x0'));var ami=require(_0x57ca('0x1'));var logger=require(_0x57ca('0x2'))('acw');var RpcUser=require(_0x57ca('0x3'));var RpcVoiceAgentReport=require(_0x57ca('0x4'));function Acw(_0x4800bf){this[_0x57ca('0x5')]=_0x4800bf[_0x57ca('0x5')];this[_0x57ca('0x6')]=_0x4800bf['agents'];this[_0x57ca('0x7')]=_0x4800bf['timers'];this[_0x57ca('0x8')]={};ami['on'](_0x57ca('0x9'),this[_0x57ca('0xa')][_0x57ca('0xb')](this));ami['on'](_0x57ca('0xc'),this['syncHangupRequest'][_0x57ca('0xb')](this));ami['on'](_0x57ca('0xd'),this[_0x57ca('0xe')][_0x57ca('0xb')](this));ami['on'](_0x57ca('0xf'),this[_0x57ca('0x10')][_0x57ca('0xb')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x57ca('0xb')](this));ami['on'](_0x57ca('0x11'),this['syncBlindTransfer'][_0x57ca('0xb')](this));ami['on'](_0x57ca('0x12'),this[_0x57ca('0x13')]['bind'](this));}function getDiff(_0x3bd84a){var _0x29f5ea=moment()[_0x57ca('0x14')](0x0);var _0x475f0e=moment(_0x3bd84a)[_0x57ca('0x14')](0x0);return _0x29f5ea[_0x57ca('0x15')](_0x475f0e,_0x57ca('0x16'));}Acw[_0x57ca('0x17')][_0x57ca('0x18')]=function(_0x21ffdc){try{var _0xf2345=this;var _0x190a51=this['channels'][_0x21ffdc][_0x57ca('0x19')];var _0x1e3448=this[_0x57ca('0x8')][_0x21ffdc][_0x57ca('0x1a')];var _0x5d790e=this[_0x57ca('0x5')][_0x1e3448];var _0x53cac3=![];var _0x47f8b8=_0x57ca('0x1b');if(_0x5d790e[_0x57ca('0x1c')]){if(_0x5d790e[_0x57ca('0x1d')][_0x57ca('0x1e')]){_0x53cac3=!![];_0x47f8b8=_0x5d790e['mandatoryDispositionPause'][_0x57ca('0x1e')];}}ami[_0x57ca('0x1f')]({'action':_0x57ca('0x20'),'interface':_0x190a51,'paused':!![],'reason':_0x47f8b8})['then'](function(_0x1d4915){if(_0xf2345['agents'][_0x190a51]){return RpcUser[_0x57ca('0x21')](_0xf2345[_0x57ca('0x6')][_0x190a51]['id'])[_0x57ca('0x22')](function(_0x2b3ff8){if(_0x2b3ff8&&!_0x2b3ff8[_0x57ca('0x23')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x21ffdc,_0x190a51,_0x1e3448);var _0x530aa3=_0xf2345[_0x57ca('0x8')][_0x21ffdc][_0x57ca('0x24')]&&_0xf2345[_0x57ca('0x8')][_0x21ffdc][_0x57ca('0x25')]?_0xf2345[_0x57ca('0x8')][_0x21ffdc][_0x57ca('0x25')]:_0x21ffdc;return RpcUser[_0x57ca('0x26')](_0xf2345[_0x57ca('0x6')][_0x190a51],_0x47f8b8,_0x530aa3)[_0x57ca('0x22')](function(_0x4af3c1){if(!_0x53cac3){_0xf2345[_0x57ca('0x7')][_0x190a51]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21ffdc,_0xf2345[_0x57ca('0x5')][_0x1e3448][_0x57ca('0x27')],_0x190a51,_0x1e3448);_0xf2345[_0x57ca('0x7')][_0x190a51]['timer']=setTimeout(_0xf2345['stopAcw'][_0x57ca('0xb')](_0xf2345,_0x190a51),_0xf2345[_0x57ca('0x5')][_0x1e3448][_0x57ca('0x27')]*0x3e8);_0xf2345['timers'][_0x190a51][_0x57ca('0x28')]=moment()[_0x57ca('0x29')](_0x57ca('0x2a'));_0xf2345['timers'][_0x190a51][_0x57ca('0x2b')]=_0x21ffdc;_0xf2345[_0x57ca('0x7')][_0x190a51][_0x57ca('0x1a')]=_0x1e3448;_0xf2345[_0x57ca('0x7')][_0x190a51][_0x57ca('0x2c')]=function(){var _0x2fa6b6=getDiff(_0xf2345[_0x57ca('0x7')][_0x190a51]['lastPauseAt']);clearTimeout(_0xf2345[_0x57ca('0x7')][_0x190a51][_0x57ca('0x2d')]);_0xf2345[_0x57ca('0x7')][_0x190a51][_0x57ca('0x2d')]=![];RpcVoiceAgentReport[_0x57ca('0x2e')]({'acwtime':_0x2fa6b6},_0xf2345['timers'][_0x190a51][_0x57ca('0x2b')],_0x190a51)['then'](function(_0x226479){logger[_0x57ca('0x2f')](_0x57ca('0x30'),_0x21ffdc,_0x2fa6b6,_0x226479);})[_0x57ca('0x31')](function(_0x31f976){logger['error'](_0x57ca('0x32'),_0x21ffdc,_0x31f976);});delete _0xf2345['timers'][_0x190a51];};}});}else{logger[_0x57ca('0x2f')](_0x57ca('0x33'),_0x21ffdc,_0x190a51,_0x1e3448);}});}})[_0x57ca('0x31')](function(_0x40ddd1){logger[_0x57ca('0x34')](_0x57ca('0x35'),_0x21ffdc,_0xf2345[_0x57ca('0x5')][_0x1e3448][_0x57ca('0x27')],_0x190a51,_0x1e3448);})[_0x57ca('0x36')](function(){delete _0xf2345[_0x57ca('0x8')][_0x21ffdc];});}catch(_0x4ec4c2){logger[_0x57ca('0x34')]('[ACW][START]\x20%s',_0x4ec4c2[_0x57ca('0x37')]);}};Acw[_0x57ca('0x17')][_0x57ca('0x38')]=function(_0x43de59){try{var _0x22dee1=this;if(_0x22dee1[_0x57ca('0x7')][_0x43de59]){_0x22dee1['timers'][_0x43de59][_0x57ca('0x2d')]=![];var _0x4ec414=_0x22dee1[_0x57ca('0x7')][_0x43de59][_0x57ca('0x2b')];var _0x5b70de=_0x22dee1['timers'][_0x43de59]['queue'];var _0x4d0a6e=_0x22dee1[_0x57ca('0x5')][_0x5b70de][_0x57ca('0x27')];logger[_0x57ca('0x2f')](_0x57ca('0x39'),_0x4ec414,_0x43de59);RpcUser[_0x57ca('0x3a')](this[_0x57ca('0x6')][_0x43de59]);RpcVoiceAgentReport[_0x57ca('0x2e')]({'acwtime':_0x4d0a6e,'agentacw':!![]},_0x4ec414,_0x43de59)[_0x57ca('0x22')](function(_0x10b953){logger[_0x57ca('0x2f')](_0x57ca('0x30'),_0x4ec414,_0x4d0a6e,_0x10b953);})[_0x57ca('0x31')](function(_0x18cfcb){logger[_0x57ca('0x34')](_0x57ca('0x32'),_0x4ec414,_0x18cfcb);});}else{logger['error'](_0x57ca('0x3b'),_0x43de59);if(_0x22dee1[_0x57ca('0x7')]){logger[_0x57ca('0x2f')](_0x57ca('0x3c'),JSON[_0x57ca('0x3d')](_0x22dee1[_0x57ca('0x7')]));}}}catch(_0xd4d43c){logger[_0x57ca('0x34')](_0x57ca('0x3e'),_0xd4d43c[_0x57ca('0x37')]);}};Acw[_0x57ca('0x17')][_0x57ca('0xa')]=function(_0x2f6ea5){try{if(this[_0x57ca('0x5')][_0x2f6ea5['queue']]&&(this['voiceQueues'][_0x2f6ea5[_0x57ca('0x1a')]]['acw']||this[_0x57ca('0x5')][_0x2f6ea5[_0x57ca('0x1a')]][_0x57ca('0x1c')])){if(this[_0x57ca('0x6')][_0x2f6ea5['interface']]){this[_0x57ca('0x8')][_0x2f6ea5[_0x57ca('0x2b')]]={'queue':_0x2f6ea5[_0x57ca('0x1a')],'interface':_0x2f6ea5[_0x57ca('0x19')],'destlinkedid':_0x2f6ea5[_0x57ca('0x25')]};}}}catch(_0x35ca15){logger[_0x57ca('0x34')]('[ACW][syncAgentConnect]\x20%s',_0x35ca15[_0x57ca('0x37')]);}};Acw[_0x57ca('0x17')]['syncAgentConnectPreview']=function(_0x3bb317){try{if(this['voiceQueues'][_0x3bb317['queue']]&&(this[_0x57ca('0x5')][_0x3bb317['queue']][_0x57ca('0x3f')]||this[_0x57ca('0x5')][_0x3bb317['queue']]['mandatoryDisposition'])){if(this[_0x57ca('0x6')][_0x3bb317[_0x57ca('0x19')]]){this[_0x57ca('0x8')][_0x3bb317[_0x57ca('0x2b')]]={'queue':_0x3bb317[_0x57ca('0x1a')],'interface':_0x3bb317['interface']};}}}catch(_0x3a1d81){logger[_0x57ca('0x34')](_0x57ca('0x40'),_0x3a1d81[_0x57ca('0x37')]);}};Acw[_0x57ca('0x17')][_0x57ca('0x41')]=function(_0x28a358){try{if(this[_0x57ca('0x8')][_0x28a358[_0x57ca('0x2b')]]&&_[_0x57ca('0x42')](this[_0x57ca('0x8')][_0x28a358[_0x57ca('0x2b')]][_0x57ca('0x24')])){logger[_0x57ca('0x2f')](_0x57ca('0x43'),_0x28a358['uniqueid']);this[_0x57ca('0x18')](_0x28a358[_0x57ca('0x2b')]);}else if(this[_0x57ca('0x8')][_0x28a358['linkedid']]&&_[_0x57ca('0x42')](this[_0x57ca('0x8')][_0x28a358[_0x57ca('0x44')]]['attended'])){logger[_0x57ca('0x2f')]('[%s][HANGUP:LINKEDID]',_0x28a358['linkedid']);this[_0x57ca('0x18')](_0x28a358[_0x57ca('0x44')]);}}catch(_0x1da139){logger[_0x57ca('0x34')](_0x57ca('0x45'),_0x1da139[_0x57ca('0x37')]);}};Acw[_0x57ca('0x17')][_0x57ca('0xe')]=function(_0x127d31){try{if(this['channels'][_0x127d31[_0x57ca('0x2b')]]&&this['channels'][_0x127d31['uniqueid']]['attended']){logger['info'](_0x57ca('0x46'),_0x127d31[_0x57ca('0x2b')]);this[_0x57ca('0x18')](_0x127d31[_0x57ca('0x2b')]);}else if(this[_0x57ca('0x8')][_0x127d31[_0x57ca('0x44')]]&&this[_0x57ca('0x8')][_0x127d31[_0x57ca('0x44')]][_0x57ca('0x24')]){logger[_0x57ca('0x2f')](_0x57ca('0x47'),_0x127d31['linkedid']);this[_0x57ca('0x18')](_0x127d31[_0x57ca('0x44')]);}}catch(_0x9404e4){logger[_0x57ca('0x34')]('[ACW][syncHangup]\x20%s',_0x9404e4['message']);}};Acw[_0x57ca('0x17')]['syncAttendedTransfer']=function(_0x3ec133){try{if(!_[_0x57ca('0x48')](this['channels'][_0x3ec133[_0x57ca('0x49')]])){this[_0x57ca('0x18')](_0x3ec133[_0x57ca('0x49')]);if(this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4a')]]){this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4a')]]['attended']=!![];this['channels'][_0x3ec133[_0x57ca('0x4b')]]=this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4a')]];delete this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4a')]];}}else if(!_[_0x57ca('0x48')](this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4b')]])){this[_0x57ca('0x18')](_0x3ec133[_0x57ca('0x4b')]);if(this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4c')]]){this[_0x57ca('0x8')][_0x3ec133['origtransfereruniqueid']][_0x57ca('0x24')]=!![];this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x49')]]=this[_0x57ca('0x8')][_0x3ec133[_0x57ca('0x4c')]];delete this['channels'][_0x3ec133[_0x57ca('0x4c')]];}}}catch(_0x325781){logger['error'](_0x57ca('0x4d'),_0x325781['message']);}};Acw[_0x57ca('0x17')]['syncBlindTransfer']=function(_0x4fc5fe){try{if(this['channels'][_0x4fc5fe['transfereruniqueid']]){logger[_0x57ca('0x2f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x57ca('0x3d')](_0x4fc5fe[_0x57ca('0x4e')]));this[_0x57ca('0x18')](_0x4fc5fe['transfereruniqueid']);}else if(this['channels'][_0x4fc5fe[_0x57ca('0x4f')]]){logger[_0x57ca('0x2f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x57ca('0x3d')](_0x4fc5fe[_0x57ca('0x4f')]));this[_0x57ca('0x18')](_0x4fc5fe['transfererlinkedid']);}}catch(_0x30bb7e){logger['error'](_0x57ca('0x50'),_0x30bb7e[_0x57ca('0x37')]);}};Acw[_0x57ca('0x17')][_0x57ca('0x10')]=function(_0x242a6c){try{if(this['voiceQueues'][_0x242a6c[_0x57ca('0x1a')]]&&this[_0x57ca('0x5')][_0x242a6c[_0x57ca('0x1a')]][_0x57ca('0x51')]===_0x57ca('0x52')){if(this['agents'][_0x242a6c[_0x57ca('0x19')]]){logger[_0x57ca('0x2f')](_0x57ca('0x53'),_0x242a6c[_0x57ca('0x2b')],_0x242a6c[_0x57ca('0x19')],_0x242a6c[_0x57ca('0x1a')]);return RpcUser[_0x57ca('0x26')](this['agents'][_0x242a6c['interface']],'Auto-Pause',_0x242a6c[_0x57ca('0x2b')]);}}}catch(_0x5f228e){logger[_0x57ca('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5f228e['message']);}};module[_0x57ca('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 44762d2..66880c9 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 _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','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'];(function(_0x2b176c,_0x44bc61){var _0x22517e=function(_0xb7d2bb){while(--_0xb7d2bb){_0x2b176c['push'](_0x2b176c['shift']());}};_0x22517e(++_0x44bc61);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','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'];(function(_0x370306,_0x775ab){var _0x1f2888=function(_0x40e87a){while(--_0x40e87a){_0x370306['push'](_0x370306['shift']());}};_0x1f2888(++_0x775ab);}(_0xb7e7,0x121));var _0x7b7e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb7e7[_0x122096];return _0x3d1966;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b1e447a..5808026 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0xcb91[_0x21205e];return _0x136ebb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x3c5924,_0x4d295f){var _0x576958=function(_0x4a3e2d){while(--_0x4a3e2d){_0x3c5924['push'](_0x3c5924['shift']());}};_0x576958(++_0x4d295f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 939aafd..36f397a 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x702a=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x702a,0x9d));var _0xa702=function(_0x306c9a,_0x1c6480){_0x306c9a=_0x306c9a-0x0;var _0x54b80c=_0x702a[_0x306c9a];return _0x54b80c;};'use strict';var util=require(_0xa702('0x0'));var _=require('lodash');var moment=require(_0xa702('0x1'));function checkNameSurname(_0x100322,_0x323bd7,_0x5a8712){var _0x40b813='';if(!_[_0xa702('0x2')](_0x323bd7)&&_0xa702('0x3')===typeof _0x323bd7){_0x40b813+=_0x323bd7;}if(!_['isNil'](_0x5a8712)&&_0xa702('0x3')===typeof _0x5a8712){_0x40b813+='\x20'+_0x5a8712;}if(_0x40b813!==''){return _0x40b813;}return _0x100322;}function Action(_0x28fc8e,_0x345f5b,_0x4f6a20){this[_0xa702('0x4')]=_0x28fc8e;this[_0xa702('0x5')]=_0x4f6a20||undefined;this[_0xa702('0x6')]=checkNameSurname(_0x345f5b[_0xa702('0x7')]['phone'],_0x345f5b[_0xa702('0x7')][_0xa702('0x8')],_0x345f5b[_0xa702('0x7')][_0xa702('0x9')]);this[_0xa702('0xa')]=_0x345f5b[_0xa702('0x7')][_0xa702('0xb')];this[_0xa702('0xc')]=_0x28fc8e[_0xa702('0x6')];this[_0xa702('0xd')]=_0x345f5b['active']||![];this[_0xa702('0xe')]=_0x28fc8e[_0xa702('0xe')];this[_0xa702('0xf')]=_0x28fc8e[_0xa702('0xf')]||0x3;this[_0xa702('0x10')]=_0x345f5b[_0xa702('0x10')];this[_0xa702('0x11')]=_0x345f5b[_0xa702('0x11')];this[_0xa702('0x12')]=_0x345f5b[_0xa702('0x12')];this['countnoanswerretry']=_0x345f5b[_0xa702('0x13')];this[_0xa702('0x14')]=_0x345f5b[_0xa702('0x14')];this['countdropretry']=_0x345f5b[_0xa702('0x15')];this[_0xa702('0x16')]=_0x345f5b[_0xa702('0x16')];this[_0xa702('0x17')]=_0x345f5b['countmachineretry'];this[_0xa702('0x18')]=_0x345f5b[_0xa702('0x18')];this[_0xa702('0x19')]=_0x345f5b['ContactId'];this[_0xa702('0x1a')]=_0x345f5b['ListId'];this[_0xa702('0x1b')]=_0x345f5b[_0xa702('0x1b')];this[_0xa702('0x1c')]=_0x345f5b[_0xa702('0x1c')];this[_0xa702('0x1d')]=_0x345f5b['CampaignId'];this['idHopper']=_0x345f5b['id'];this[_0xa702('0x1e')]=_0x345f5b['Contact'][_0xa702('0x8')]||'';this[_0xa702('0x1f')]=moment()[_0xa702('0x20')](_0xa702('0x21'));this[_0xa702('0x22')]=_0x345f5b['callback'];this[_0xa702('0x23')]=_0x345f5b[_0xa702('0x23')];this[_0xa702('0x24')]=_0x345f5b[_0xa702('0x24')];this[_0xa702('0x25')]=_0x345f5b['recallme'];this[_0xa702('0x26')]='';this[_0xa702('0x27')]='';}Action['prototype'][_0xa702('0x28')]=function(){return util[_0xa702('0x20')](_0xa702('0x29'),this[_0xa702('0x6')],this['voiceQueue'][_0xa702('0x2a')]>0x0?this['number'][_0xa702('0x2b')](this[_0xa702('0x4')][_0xa702('0x2a')]):this[_0xa702('0xa')]);};Action[_0xa702('0x2c')][_0xa702('0x2d')]=function(){return this[_0xa702('0xc')];};module[_0xa702('0x2e')]=Action; \ No newline at end of file +var _0xb406=['countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x4c8108,_0x210dd5){var _0x1dced0=function(_0x16674f){while(--_0x16674f){_0x4c8108['push'](_0x4c8108['shift']());}};_0x1dced0(++_0x210dd5);}(_0xb406,0x1dc));var _0x6b40=function(_0x2b41ab,_0x3d7915){_0x2b41ab=_0x2b41ab-0x0;var _0x16ec4f=_0xb406[_0x2b41ab];return _0x16ec4f;};'use strict';var util=require(_0x6b40('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x418eca,_0x469d05,_0x24041a){var _0x440c3d='';if(!_[_0x6b40('0x1')](_0x469d05)&&_0x6b40('0x2')===typeof _0x469d05){_0x440c3d+=_0x469d05;}if(!_[_0x6b40('0x1')](_0x24041a)&&_0x6b40('0x2')===typeof _0x24041a){_0x440c3d+='\x20'+_0x24041a;}if(_0x440c3d!==''){return _0x440c3d;}return _0x418eca;}function Action(_0x2e6cc9,_0x96472,_0x5ad8ad){this[_0x6b40('0x3')]=_0x2e6cc9;this[_0x6b40('0x4')]=_0x5ad8ad||undefined;this[_0x6b40('0x5')]=checkNameSurname(_0x96472[_0x6b40('0x6')][_0x6b40('0x7')],_0x96472['Contact'][_0x6b40('0x8')],_0x96472['Contact']['lastName']);this[_0x6b40('0x9')]=_0x96472['Contact'][_0x6b40('0x7')];this[_0x6b40('0xa')]=_0x2e6cc9[_0x6b40('0x5')];this['active']=_0x96472['active']||![];this[_0x6b40('0xb')]=_0x2e6cc9[_0x6b40('0xb')];this[_0x6b40('0xc')]=_0x2e6cc9['dialQueueTimeout']||0x3;this['scheduledat']=_0x96472[_0x6b40('0xd')];this[_0x6b40('0xe')]=_0x96472['countbusyretry'];this['countcongestionretry']=_0x96472[_0x6b40('0xf')];this[_0x6b40('0x10')]=_0x96472[_0x6b40('0x10')];this[_0x6b40('0x11')]=_0x96472[_0x6b40('0x11')];this[_0x6b40('0x12')]=_0x96472['countdropretry'];this[_0x6b40('0x13')]=_0x96472[_0x6b40('0x13')];this[_0x6b40('0x14')]=_0x96472[_0x6b40('0x14')];this['countagentrejectretry']=_0x96472['countagentrejectretry'];this[_0x6b40('0x15')]=_0x96472[_0x6b40('0x15')];this['ListId']=_0x96472[_0x6b40('0x16')];this[_0x6b40('0x17')]=_0x96472[_0x6b40('0x17')];this[_0x6b40('0x18')]=_0x96472['VoiceQueueId'];this['CampaignId']=_0x96472['CampaignId'];this[_0x6b40('0x19')]=_0x96472['id'];this['ContactFirstName']=_0x96472[_0x6b40('0x6')]['firstName']||'';this['starttime']=moment()['format'](_0x6b40('0x1a'));this['callback']=_0x96472['callback'];this['callbackuniqueid']=_0x96472[_0x6b40('0x1b')];this['callbackat']=_0x96472['callbackat'];this['recallme']=_0x96472[_0x6b40('0x1c')];this[_0x6b40('0x1d')]='';this[_0x6b40('0x1e')]='';}Action[_0x6b40('0x1f')][_0x6b40('0x20')]=function(){return util[_0x6b40('0x21')](_0x6b40('0x22'),this['name'],this['voiceQueue'][_0x6b40('0x23')]>0x0?this['number']['substring'](this[_0x6b40('0x3')]['dialCutDigit']):this[_0x6b40('0x9')]);};Action['prototype'][_0x6b40('0x24')]=function(){return this[_0x6b40('0xa')];};module[_0x6b40('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ba883f7..b047b33 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27c8=['answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime'];(function(_0x3c5433,_0x515ff7){var _0x425f26=function(_0x5bafca){while(--_0x5bafca){_0x3c5433['push'](_0x3c5433['shift']());}};_0x425f26(++_0x515ff7);}(_0x27c8,0x6a));var _0x827c=function(_0x4a8cb1,_0x588041){_0x4a8cb1=_0x4a8cb1-0x0;var _0x7a04ed=_0x27c8[_0x4a8cb1];return _0x7a04ed;};'use strict';var util=require('util');var _=require(_0x827c('0x0'));var moment=require(_0x827c('0x1'));function getSeconds(_0x52699a,_0x47db79){var _0x3e1510=moment(_0x52699a)[_0x827c('0x2')](0x0);var _0x1a586a=moment(_0x47db79)[_0x827c('0x2')](0x0);return _0x3e1510[_0x827c('0x3')](_0x1a586a,_0x827c('0x4'));}function AgentComplete(_0x48ca05,_0x56b4eb){this[_0x827c('0x5')]=0x4;this[_0x827c('0x6')]=_0x827c('0x7');this[_0x827c('0x8')]=_0x48ca05[_0x827c('0x8')];this[_0x827c('0x9')]=_0x48ca05['type'];this['campaigntype']=_0x48ca05[_0x827c('0x9')]===_0x827c('0xa')?'queue':_0x48ca05['type'];this[_0x827c('0xb')]=_0x48ca05[_0x827c('0xb')];this['countcongestionretry']=_0x48ca05[_0x827c('0xc')];this[_0x827c('0xd')]=_0x48ca05[_0x827c('0xd')];this[_0x827c('0xe')]=_0x48ca05['countbusyretry']+_0x48ca05[_0x827c('0xc')]+_0x48ca05[_0x827c('0xd')]+_0x48ca05['countnosuchnumberretry']+_0x48ca05[_0x827c('0xf')]+_0x48ca05[_0x827c('0x10')]+_0x48ca05[_0x827c('0x11')]+_0x48ca05[_0x827c('0x12')];this[_0x827c('0x13')]=_0x48ca05['countnosuchnumberretry'];this['countdropretry']=_0x48ca05['countdropretry'];this[_0x827c('0x10')]=_0x48ca05[_0x827c('0x10')];this[_0x827c('0x11')]=_0x48ca05[_0x827c('0x11')];this['countagentrejectretry']=_0x48ca05[_0x827c('0x12')];this[_0x827c('0x14')]=_0x56b4eb[_0x827c('0x14')];this[_0x827c('0x15')]=_0x48ca05[_0x827c('0x16')];this['calleridnum']=_0x48ca05[_0x827c('0x17')];this['starttime']=_0x48ca05[_0x827c('0x18')];this[_0x827c('0x19')]=_0x48ca05['responsetime'];this[_0x827c('0x1a')]=_0x48ca05[_0x827c('0x1a')];this['endtime']=moment()['format'](_0x827c('0x1b'));this[_0x827c('0x1c')]=getSeconds(_0x48ca05[_0x827c('0x19')],_0x48ca05[_0x827c('0x18')]);this['holdtime']=getSeconds(_0x48ca05['answertime'],_0x48ca05['responsetime']);this['talktime']=getSeconds(this[_0x827c('0x1d')],_0x48ca05['answertime']);this[_0x827c('0x1e')]=_0x56b4eb[_0x827c('0x1e')];this[_0x827c('0x1f')]=_0x56b4eb[_0x827c('0x1f')];this['reason']=_0x56b4eb[_0x827c('0x20')];this[_0x827c('0x21')]=_0x48ca05[_0x827c('0x21')];this[_0x827c('0x22')]=_0x48ca05['callbackuniqueid'];this[_0x827c('0x23')]=_0x48ca05[_0x827c('0x23')];this[_0x827c('0x24')]=_0x48ca05[_0x827c('0x24')];this[_0x827c('0x25')]=_0x48ca05[_0x827c('0x25')];this[_0x827c('0x26')]=_0x48ca05[_0x827c('0x26')];this[_0x827c('0x27')]=_0x48ca05['UserId'];this['VoiceQueueId']=_0x48ca05[_0x827c('0x28')];this['CampaignId']=_0x48ca05['CampaignId'];this[_0x827c('0x29')]=_0x48ca05[_0x827c('0x29')]||'';this['originatecalleridname']=_0x48ca05[_0x827c('0x2a')]||'';}module[_0x827c('0x2b')]=AgentComplete; \ No newline at end of file +var _0x653c=['moment','seconds','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','answertime','endtime','format','holdtime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x653c,0x199));var _0xc653=function(_0x2bea1b,_0x3960e9){_0x2bea1b=_0x2bea1b-0x0;var _0x1665b1=_0x653c[_0x2bea1b];return _0x1665b1;};'use strict';var util=require('util');var _=require(_0xc653('0x0'));var moment=require(_0xc653('0x1'));function getSeconds(_0x4e1878,_0x5d25ad){var _0x12d0fd=moment(_0x4e1878)['milliseconds'](0x0);var _0x231f4a=moment(_0x5d25ad)['milliseconds'](0x0);return _0x12d0fd['diff'](_0x231f4a,_0xc653('0x2'));}function AgentComplete(_0xa17874,_0x2ac472){this[_0xc653('0x3')]=0x4;this['statedesc']=_0xc653('0x4');this[_0xc653('0x5')]=_0xa17874['scheduledat'];this['type']=_0xa17874[_0xc653('0x6')];this[_0xc653('0x7')]=_0xa17874[_0xc653('0x6')]===_0xc653('0x8')?'queue':_0xa17874[_0xc653('0x6')];this[_0xc653('0x9')]=_0xa17874[_0xc653('0x9')];this[_0xc653('0xa')]=_0xa17874['countcongestionretry'];this['countnoanswerretry']=_0xa17874['countnoanswerretry'];this[_0xc653('0xb')]=_0xa17874[_0xc653('0x9')]+_0xa17874['countcongestionretry']+_0xa17874[_0xc653('0xc')]+_0xa17874['countnosuchnumberretry']+_0xa17874['countdropretry']+_0xa17874[_0xc653('0xd')]+_0xa17874[_0xc653('0xe')]+_0xa17874[_0xc653('0xf')];this[_0xc653('0x10')]=_0xa17874[_0xc653('0x10')];this['countdropretry']=_0xa17874[_0xc653('0x11')];this[_0xc653('0xd')]=_0xa17874['countabandonedretry'];this[_0xc653('0xe')]=_0xa17874[_0xc653('0xe')];this['countagentrejectretry']=_0xa17874[_0xc653('0xf')];this[_0xc653('0x12')]=_0x2ac472['uniqueid'];this[_0xc653('0x13')]=_0xa17874[_0xc653('0x14')];this['calleridnum']=_0xa17874['number'];this[_0xc653('0x15')]=_0xa17874['starttime'];this[_0xc653('0x16')]=_0xa17874[_0xc653('0x16')];this[_0xc653('0x17')]=_0xa17874[_0xc653('0x17')];this[_0xc653('0x18')]=moment()[_0xc653('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0xa17874[_0xc653('0x16')],_0xa17874[_0xc653('0x15')]);this[_0xc653('0x1a')]=getSeconds(_0xa17874[_0xc653('0x17')],_0xa17874[_0xc653('0x16')]);this['talktime']=getSeconds(this['endtime'],_0xa17874[_0xc653('0x17')]);this[_0xc653('0x1b')]=_0x2ac472[_0xc653('0x1b')];this[_0xc653('0x1c')]=_0x2ac472[_0xc653('0x1c')];this[_0xc653('0x1d')]=_0x2ac472[_0xc653('0x1d')];this[_0xc653('0x1e')]=_0xa17874[_0xc653('0x1e')];this[_0xc653('0x1f')]=_0xa17874[_0xc653('0x1f')];this['callbackat']=_0xa17874['callbackat'];this['recallme']=_0xa17874[_0xc653('0x20')];this[_0xc653('0x21')]=_0xa17874[_0xc653('0x21')];this[_0xc653('0x22')]=_0xa17874[_0xc653('0x22')];this[_0xc653('0x23')]=_0xa17874[_0xc653('0x23')];this['VoiceQueueId']=_0xa17874[_0xc653('0x24')];this[_0xc653('0x25')]=_0xa17874[_0xc653('0x25')];this[_0xc653('0x26')]=_0xa17874[_0xc653('0x26')]||'';this[_0xc653('0x27')]=_0xa17874['originatecalleridname']||'';}module[_0xc653('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index eb9c455..12d6f03 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b67=['countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x42c797,_0x16382b){var _0x320035=function(_0x39f50b){while(--_0x39f50b){_0x42c797['push'](_0x42c797['shift']());}};_0x320035(++_0x16382b);}(_0x9b67,0xf6));var _0x79b6=function(_0x480a40,_0x104dcf){_0x480a40=_0x480a40-0x0;var _0x3f68f7=_0x9b67[_0x480a40];return _0x3f68f7;};'use strict';var util=require(_0x79b6('0x0'));var _=require(_0x79b6('0x1'));var moment=require(_0x79b6('0x2'));function getSeconds(_0x1f4b0b,_0x29728d){var _0x5523a1=moment(_0x1f4b0b)[_0x79b6('0x3')](0x0);var _0x1aeb24=moment(_0x29728d)['milliseconds'](0x0);return _0x5523a1['diff'](_0x1aeb24,_0x79b6('0x4'));}function Final(_0x174768){this[_0x79b6('0x5')]=_0x174768[_0x79b6('0x5')];this[_0x79b6('0x6')]=_0x174768[_0x79b6('0x6')];this[_0x79b6('0x7')]=_0x174768['type'];this[_0x79b6('0x8')]=_0x174768[_0x79b6('0x7')]===_0x79b6('0x9')?_0x79b6('0xa'):_0x174768[_0x79b6('0x7')];this['countbusyretry']=_0x174768[_0x79b6('0xb')];this[_0x79b6('0xc')]=_0x174768[_0x79b6('0xc')];this[_0x79b6('0xd')]=_0x174768['countnoanswerretry'];this['countglobal']=_0x174768[_0x79b6('0xb')]+_0x174768[_0x79b6('0xc')]+_0x174768[_0x79b6('0xd')]+_0x174768['countnosuchnumberretry']+_0x174768[_0x79b6('0xe')]+_0x174768[_0x79b6('0xf')]+_0x174768[_0x79b6('0x10')]+_0x174768[_0x79b6('0x11')];this[_0x79b6('0x12')]=_0x174768[_0x79b6('0x12')];this[_0x79b6('0xe')]=_0x174768[_0x79b6('0xe')];this[_0x79b6('0xf')]=_0x174768[_0x79b6('0xf')];this[_0x79b6('0x10')]=_0x174768[_0x79b6('0x10')];this[_0x79b6('0x11')]=_0x174768['countagentrejectretry'];this[_0x79b6('0xa')]=_0x174768[_0x79b6('0xa')];this[_0x79b6('0x13')]=_0x174768[_0x79b6('0x13')];this[_0x79b6('0x14')]=_0x174768[_0x79b6('0x14')];this[_0x79b6('0x15')]=_0x174768[_0x79b6('0x15')];this[_0x79b6('0x16')]=_0x174768[_0x79b6('0x16')];this[_0x79b6('0x17')]=_0x174768[_0x79b6('0x16')];this[_0x79b6('0x18')]=_0x174768['ringtime']||0x0;this[_0x79b6('0x19')]=_0x174768['holdtime']||0x0;this[_0x79b6('0x1a')]=_0x174768['talktime']||0x0;this[_0x79b6('0x1b')]=_0x174768[_0x79b6('0x1b')];this[_0x79b6('0x1c')]=_0x174768['callbackuniqueid'];this[_0x79b6('0x1d')]=_0x174768[_0x79b6('0x1d')];this['recallme']=_0x174768['recallme'];this[_0x79b6('0x1e')]=_0x174768[_0x79b6('0x1e')];this[_0x79b6('0x1f')]=_0x174768[_0x79b6('0x1f')];this[_0x79b6('0x20')]=_0x174768['UserId'];this[_0x79b6('0x21')]=_0x174768[_0x79b6('0x21')];this[_0x79b6('0x22')]=_0x174768[_0x79b6('0x22')];this['originatecalleridnum']=_0x174768['originatecalleridnum']||'';this[_0x79b6('0x23')]=_0x174768[_0x79b6('0x23')]||'';}module[_0x79b6('0x24')]=Final; \ No newline at end of file +var _0x9b67=['countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x57b443,_0x5145b4){var _0x1a763d=function(_0x513b90){while(--_0x513b90){_0x57b443['push'](_0x57b443['shift']());}};_0x1a763d(++_0x5145b4);}(_0x9b67,0xf6));var _0x79b6=function(_0x2c3e1a,_0x327d57){_0x2c3e1a=_0x2c3e1a-0x0;var _0x191573=_0x9b67[_0x2c3e1a];return _0x191573;};'use strict';var util=require(_0x79b6('0x0'));var _=require(_0x79b6('0x1'));var moment=require(_0x79b6('0x2'));function getSeconds(_0x1f4b0b,_0x29728d){var _0x5523a1=moment(_0x1f4b0b)[_0x79b6('0x3')](0x0);var _0x1aeb24=moment(_0x29728d)['milliseconds'](0x0);return _0x5523a1['diff'](_0x1aeb24,_0x79b6('0x4'));}function Final(_0x174768){this[_0x79b6('0x5')]=_0x174768[_0x79b6('0x5')];this[_0x79b6('0x6')]=_0x174768[_0x79b6('0x6')];this[_0x79b6('0x7')]=_0x174768['type'];this[_0x79b6('0x8')]=_0x174768[_0x79b6('0x7')]===_0x79b6('0x9')?_0x79b6('0xa'):_0x174768[_0x79b6('0x7')];this['countbusyretry']=_0x174768[_0x79b6('0xb')];this[_0x79b6('0xc')]=_0x174768[_0x79b6('0xc')];this[_0x79b6('0xd')]=_0x174768['countnoanswerretry'];this['countglobal']=_0x174768[_0x79b6('0xb')]+_0x174768[_0x79b6('0xc')]+_0x174768[_0x79b6('0xd')]+_0x174768['countnosuchnumberretry']+_0x174768[_0x79b6('0xe')]+_0x174768[_0x79b6('0xf')]+_0x174768[_0x79b6('0x10')]+_0x174768[_0x79b6('0x11')];this[_0x79b6('0x12')]=_0x174768[_0x79b6('0x12')];this[_0x79b6('0xe')]=_0x174768[_0x79b6('0xe')];this[_0x79b6('0xf')]=_0x174768[_0x79b6('0xf')];this[_0x79b6('0x10')]=_0x174768[_0x79b6('0x10')];this[_0x79b6('0x11')]=_0x174768['countagentrejectretry'];this[_0x79b6('0xa')]=_0x174768[_0x79b6('0xa')];this[_0x79b6('0x13')]=_0x174768[_0x79b6('0x13')];this[_0x79b6('0x14')]=_0x174768[_0x79b6('0x14')];this[_0x79b6('0x15')]=_0x174768[_0x79b6('0x15')];this[_0x79b6('0x16')]=_0x174768[_0x79b6('0x16')];this[_0x79b6('0x17')]=_0x174768[_0x79b6('0x16')];this[_0x79b6('0x18')]=_0x174768['ringtime']||0x0;this[_0x79b6('0x19')]=_0x174768['holdtime']||0x0;this[_0x79b6('0x1a')]=_0x174768['talktime']||0x0;this[_0x79b6('0x1b')]=_0x174768[_0x79b6('0x1b')];this[_0x79b6('0x1c')]=_0x174768['callbackuniqueid'];this[_0x79b6('0x1d')]=_0x174768[_0x79b6('0x1d')];this['recallme']=_0x174768['recallme'];this[_0x79b6('0x1e')]=_0x174768[_0x79b6('0x1e')];this[_0x79b6('0x1f')]=_0x174768[_0x79b6('0x1f')];this[_0x79b6('0x20')]=_0x174768['UserId'];this[_0x79b6('0x21')]=_0x174768[_0x79b6('0x21')];this[_0x79b6('0x22')]=_0x174768[_0x79b6('0x22')];this['originatecalleridnum']=_0x174768['originatecalleridnum']||'';this[_0x79b6('0x23')]=_0x174768[_0x79b6('0x23')]||'';}module[_0x79b6('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 6f7046e..87bc0c0 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5973=['milliseconds','diff','seconds','state','statedesc','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment'];(function(_0xc0043d,_0x583c02){var _0x4ed29a=function(_0x312ab2){while(--_0x312ab2){_0xc0043d['push'](_0xc0043d['shift']());}};_0x4ed29a(++_0x583c02);}(_0x5973,0x145));var _0x3597=function(_0x24741a,_0x36a3f9){_0x24741a=_0x24741a-0x0;var _0x4d57ac=_0x5973[_0x24741a];return _0x4d57ac;};'use strict';var util=require(_0x3597('0x0'));var _=require(_0x3597('0x1'));var moment=require(_0x3597('0x2'));function getSeconds(_0x4b1f15,_0x3bcf3c){var _0x379d9a=moment(_0x4b1f15)[_0x3597('0x3')](0x0);var _0x17d041=moment(_0x3bcf3c)[_0x3597('0x3')](0x0);return _0x379d9a[_0x3597('0x4')](_0x17d041,_0x3597('0x5'));}function Hangup(_0x5964d7,_0x4d6bff){this[_0x3597('0x6')]=0x4;this[_0x3597('0x7')]='Answer';this['scheduledat']=_0x5964d7['scheduledat'];this[_0x3597('0x8')]=_0x5964d7['type'];this[_0x3597('0x9')]=_0x5964d7['type']==='outbound'?'queue':_0x5964d7['type'];this[_0x3597('0xa')]=_0x5964d7[_0x3597('0xa')];this['countcongestionretry']=_0x5964d7[_0x3597('0xb')];this[_0x3597('0xc')]=_0x5964d7[_0x3597('0xc')];this['countglobal']=_0x5964d7[_0x3597('0xa')]+_0x5964d7[_0x3597('0xb')]+_0x5964d7[_0x3597('0xc')]+_0x5964d7[_0x3597('0xd')]+_0x5964d7[_0x3597('0xe')]+_0x5964d7['countabandonedretry']+_0x5964d7[_0x3597('0xf')]+_0x5964d7[_0x3597('0x10')];this[_0x3597('0xd')]=_0x5964d7[_0x3597('0xd')];this[_0x3597('0xe')]=_0x5964d7[_0x3597('0xe')];this['countabandonedretry']=_0x5964d7[_0x3597('0x11')];this['countmachineretry']=_0x5964d7['countmachineretry'];this[_0x3597('0x10')]=_0x5964d7[_0x3597('0x10')];this[_0x3597('0x12')]=_0x4d6bff[_0x3597('0x12')];this['calleridname']=_0x5964d7['name'];this[_0x3597('0x13')]=_0x5964d7[_0x3597('0x14')];this['starttime']=_0x5964d7[_0x3597('0x15')];this['responsetime']=_0x5964d7[_0x3597('0x16')];this[_0x3597('0x17')]=moment()['format'](_0x3597('0x18'));this[_0x3597('0x19')]=getSeconds(_0x5964d7[_0x3597('0x16')],_0x5964d7[_0x3597('0x15')]);this[_0x3597('0x1a')]=0x0;this[_0x3597('0x1b')]=getSeconds(this[_0x3597('0x17')],_0x5964d7[_0x3597('0x16')]);this[_0x3597('0x1c')]=_0x5964d7[_0x3597('0x1c')];this[_0x3597('0x1d')]='IVR';this[_0x3597('0x1e')]=_0x4d6bff['cause-txt'];this[_0x3597('0x1f')]=_0x5964d7[_0x3597('0x1f')];this[_0x3597('0x20')]=_0x5964d7[_0x3597('0x20')];this[_0x3597('0x21')]=_0x5964d7[_0x3597('0x21')];this['recallme']=_0x5964d7[_0x3597('0x22')];this['ContactId']=_0x5964d7[_0x3597('0x23')];this[_0x3597('0x24')]=_0x5964d7[_0x3597('0x24')];this['UserId']=_0x5964d7[_0x3597('0x25')];this[_0x3597('0x26')]=_0x5964d7[_0x3597('0x26')];this['CampaignId']=_0x5964d7[_0x3597('0x27')];}module[_0x3597('0x28')]=Hangup; \ No newline at end of file +var _0x684c=['seconds','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff'];(function(_0x256198,_0x1d03e6){var _0x285a83=function(_0x264167){while(--_0x264167){_0x256198['push'](_0x256198['shift']());}};_0x285a83(++_0x1d03e6);}(_0x684c,0x14c));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc684('0x0'));var _=require(_0xc684('0x1'));var moment=require('moment');function getSeconds(_0x4f57d7,_0x1dd192){var _0x1984a6=moment(_0x4f57d7)['milliseconds'](0x0);var _0x15ebfe=moment(_0x1dd192)[_0xc684('0x2')](0x0);return _0x1984a6[_0xc684('0x3')](_0x15ebfe,_0xc684('0x4'));}function Hangup(_0x7e03c0,_0x2b8d37){this[_0xc684('0x5')]=0x4;this['statedesc']=_0xc684('0x6');this[_0xc684('0x7')]=_0x7e03c0[_0xc684('0x7')];this[_0xc684('0x8')]=_0x7e03c0[_0xc684('0x8')];this['campaigntype']=_0x7e03c0[_0xc684('0x8')]===_0xc684('0x9')?_0xc684('0xa'):_0x7e03c0[_0xc684('0x8')];this[_0xc684('0xb')]=_0x7e03c0[_0xc684('0xb')];this[_0xc684('0xc')]=_0x7e03c0[_0xc684('0xc')];this[_0xc684('0xd')]=_0x7e03c0[_0xc684('0xd')];this[_0xc684('0xe')]=_0x7e03c0[_0xc684('0xb')]+_0x7e03c0[_0xc684('0xc')]+_0x7e03c0['countnoanswerretry']+_0x7e03c0[_0xc684('0xf')]+_0x7e03c0[_0xc684('0x10')]+_0x7e03c0[_0xc684('0x11')]+_0x7e03c0[_0xc684('0x12')]+_0x7e03c0['countagentrejectretry'];this[_0xc684('0xf')]=_0x7e03c0[_0xc684('0xf')];this[_0xc684('0x10')]=_0x7e03c0[_0xc684('0x10')];this['countabandonedretry']=_0x7e03c0[_0xc684('0x11')];this[_0xc684('0x12')]=_0x7e03c0['countmachineretry'];this[_0xc684('0x13')]=_0x7e03c0[_0xc684('0x13')];this[_0xc684('0x14')]=_0x2b8d37['uniqueid'];this['calleridname']=_0x7e03c0[_0xc684('0x15')];this[_0xc684('0x16')]=_0x7e03c0[_0xc684('0x17')];this[_0xc684('0x18')]=_0x7e03c0['starttime'];this[_0xc684('0x19')]=_0x7e03c0[_0xc684('0x19')];this[_0xc684('0x1a')]=moment()[_0xc684('0x1b')](_0xc684('0x1c'));this[_0xc684('0x1d')]=getSeconds(_0x7e03c0[_0xc684('0x19')],_0x7e03c0[_0xc684('0x18')]);this[_0xc684('0x1e')]=0x0;this['talktime']=getSeconds(this[_0xc684('0x1a')],_0x7e03c0['responsetime']);this[_0xc684('0xa')]=_0x7e03c0['queue'];this['membername']=_0xc684('0x1f');this['reason']=_0x2b8d37[_0xc684('0x20')];this[_0xc684('0x21')]=_0x7e03c0[_0xc684('0x21')];this[_0xc684('0x22')]=_0x7e03c0[_0xc684('0x22')];this[_0xc684('0x23')]=_0x7e03c0[_0xc684('0x23')];this[_0xc684('0x24')]=_0x7e03c0[_0xc684('0x24')];this[_0xc684('0x25')]=_0x7e03c0[_0xc684('0x25')];this['ListId']=_0x7e03c0[_0xc684('0x26')];this['UserId']=_0x7e03c0[_0xc684('0x27')];this[_0xc684('0x28')]=_0x7e03c0[_0xc684('0x28')];this[_0xc684('0x29')]=_0x7e03c0['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 76bba66..321da7b 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe08=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xfe08,0xeb));var _0x8fe0=function(_0x4b13ee,_0x587562){_0x4b13ee=_0x4b13ee-0x0;var _0x190d07=_0xfe08[_0x4b13ee];return _0x190d07;};'use strict';var util=require('util');var _=require(_0x8fe0('0x0'));var moment=require('moment');function getSeconds(_0x6c7708,_0x17bc06){var _0x263db1=moment(_0x6c7708)[_0x8fe0('0x1')](0x0);var _0x20034e=moment(_0x17bc06)['milliseconds'](0x0);return _0x263db1['diff'](_0x20034e,_0x8fe0('0x2'));}function History(_0x1d4bd7){this[_0x8fe0('0x3')]=_0x1d4bd7[_0x8fe0('0x3')];this[_0x8fe0('0x4')]=_0x1d4bd7[_0x8fe0('0x4')]||undefined;this['type']=_0x1d4bd7[_0x8fe0('0x5')];this[_0x8fe0('0x6')]=_0x1d4bd7[_0x8fe0('0x5')]==='outbound'?_0x8fe0('0x7'):_0x1d4bd7[_0x8fe0('0x5')];this['countbusyretry']=_0x1d4bd7['countbusyretry'];this['countcongestionretry']=_0x1d4bd7[_0x8fe0('0x8')];this[_0x8fe0('0x9')]=_0x1d4bd7[_0x8fe0('0x9')];this[_0x8fe0('0xa')]=_0x1d4bd7[_0x8fe0('0xb')]+_0x1d4bd7[_0x8fe0('0x8')]+_0x1d4bd7[_0x8fe0('0x9')]+_0x1d4bd7['countnosuchnumberretry']+_0x1d4bd7[_0x8fe0('0xc')]+_0x1d4bd7[_0x8fe0('0xd')]+_0x1d4bd7[_0x8fe0('0xe')]+_0x1d4bd7[_0x8fe0('0xf')];this[_0x8fe0('0x10')]=_0x1d4bd7[_0x8fe0('0x10')];this['countdropretry']=_0x1d4bd7[_0x8fe0('0xc')];this['countabandonedretry']=_0x1d4bd7['countabandonedretry'];this[_0x8fe0('0xe')]=_0x1d4bd7[_0x8fe0('0xe')];this[_0x8fe0('0xf')]=_0x1d4bd7[_0x8fe0('0xf')];this[_0x8fe0('0x7')]=_0x1d4bd7['queue'];this[_0x8fe0('0x11')]=_0x1d4bd7[_0x8fe0('0x12')];this[_0x8fe0('0x13')]=_0x1d4bd7[_0x8fe0('0x14')];this[_0x8fe0('0x15')]=_0x1d4bd7['starttime'];this[_0x8fe0('0x16')]=_0x1d4bd7[_0x8fe0('0x16')];this['endtime']=_0x1d4bd7[_0x8fe0('0x16')];this[_0x8fe0('0x17')]=getSeconds(_0x1d4bd7[_0x8fe0('0x16')],_0x1d4bd7[_0x8fe0('0x15')]);this['holdtime']=0x0;this[_0x8fe0('0x18')]=0x0;this[_0x8fe0('0x19')]=_0x1d4bd7[_0x8fe0('0x19')];this[_0x8fe0('0x1a')]=_0x1d4bd7[_0x8fe0('0x1a')];this[_0x8fe0('0x1b')]=_0x1d4bd7[_0x8fe0('0x1b')];this[_0x8fe0('0x1c')]=_0x1d4bd7[_0x8fe0('0x1c')];this['ContactId']=_0x1d4bd7[_0x8fe0('0x1d')];this['ListId']=_0x1d4bd7[_0x8fe0('0x1e')];this[_0x8fe0('0x1f')]=_0x1d4bd7[_0x8fe0('0x1f')];this['VoiceQueueId']=_0x1d4bd7[_0x8fe0('0x20')];this[_0x8fe0('0x21')]=_0x1d4bd7[_0x8fe0('0x21')];this[_0x8fe0('0x22')]=_0x1d4bd7[_0x8fe0('0x22')]||'';this[_0x8fe0('0x23')]=_0x1d4bd7[_0x8fe0('0x23')]||'';}module[_0x8fe0('0x24')]=History; \ No newline at end of file +var _0x3328=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId'];(function(_0x79b4c7,_0x3fc453){var _0x1b741a=function(_0x50b085){while(--_0x50b085){_0x79b4c7['push'](_0x79b4c7['shift']());}};_0x1b741a(++_0x3fc453);}(_0x3328,0x8e));var _0x8332=function(_0x869ded,_0x311134){_0x869ded=_0x869ded-0x0;var _0x4a168=_0x3328[_0x869ded];return _0x4a168;};'use strict';var util=require('util');var _=require(_0x8332('0x0'));var moment=require(_0x8332('0x1'));function getSeconds(_0x151241,_0xb53888){var _0x1d9001=moment(_0x151241)[_0x8332('0x2')](0x0);var _0x44646c=moment(_0xb53888)[_0x8332('0x2')](0x0);return _0x1d9001[_0x8332('0x3')](_0x44646c,_0x8332('0x4'));}function History(_0x22ea00){this[_0x8332('0x5')]=_0x22ea00[_0x8332('0x5')];this[_0x8332('0x6')]=_0x22ea00[_0x8332('0x6')]||undefined;this[_0x8332('0x7')]=_0x22ea00[_0x8332('0x7')];this['campaigntype']=_0x22ea00[_0x8332('0x7')]===_0x8332('0x8')?_0x8332('0x9'):_0x22ea00[_0x8332('0x7')];this[_0x8332('0xa')]=_0x22ea00[_0x8332('0xa')];this[_0x8332('0xb')]=_0x22ea00[_0x8332('0xb')];this['countnoanswerretry']=_0x22ea00[_0x8332('0xc')];this[_0x8332('0xd')]=_0x22ea00[_0x8332('0xa')]+_0x22ea00[_0x8332('0xb')]+_0x22ea00['countnoanswerretry']+_0x22ea00[_0x8332('0xe')]+_0x22ea00[_0x8332('0xf')]+_0x22ea00['countabandonedretry']+_0x22ea00[_0x8332('0x10')]+_0x22ea00[_0x8332('0x11')];this[_0x8332('0xe')]=_0x22ea00[_0x8332('0xe')];this[_0x8332('0xf')]=_0x22ea00['countdropretry'];this['countabandonedretry']=_0x22ea00['countabandonedretry'];this['countmachineretry']=_0x22ea00[_0x8332('0x10')];this[_0x8332('0x11')]=_0x22ea00[_0x8332('0x11')];this['queue']=_0x22ea00[_0x8332('0x9')];this['calleridname']=_0x22ea00['name'];this[_0x8332('0x12')]=_0x22ea00['number'];this['starttime']=_0x22ea00[_0x8332('0x13')];this[_0x8332('0x14')]=_0x22ea00[_0x8332('0x14')];this[_0x8332('0x15')]=_0x22ea00[_0x8332('0x14')];this['ringtime']=getSeconds(_0x22ea00[_0x8332('0x14')],_0x22ea00['starttime']);this['holdtime']=0x0;this[_0x8332('0x16')]=0x0;this['callback']=_0x22ea00[_0x8332('0x17')];this[_0x8332('0x18')]=_0x22ea00[_0x8332('0x18')];this['callbackat']=_0x22ea00['callbackat'];this[_0x8332('0x19')]=_0x22ea00[_0x8332('0x19')];this[_0x8332('0x1a')]=_0x22ea00[_0x8332('0x1a')];this[_0x8332('0x1b')]=_0x22ea00[_0x8332('0x1b')];this[_0x8332('0x1c')]=_0x22ea00[_0x8332('0x1c')];this['VoiceQueueId']=_0x22ea00[_0x8332('0x1d')];this[_0x8332('0x1e')]=_0x22ea00[_0x8332('0x1e')];this[_0x8332('0x1f')]=_0x22ea00[_0x8332('0x1f')]||'';this[_0x8332('0x20')]=_0x22ea00[_0x8332('0x20')]||'';}module[_0x8332('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 1b85941..4ad33b2 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 _0x2f6c=['responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','queueCallerAbandonCreateState','countdropretry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','strategy','rrmemory','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','true','Action','indexOf','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','response','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','m\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Interval','Error','stringify','milliseconds','seconds','emit','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\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','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','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','status','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','membername','AMD','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','countglobal','amd','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr]','Machine','countbusyretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime'];(function(_0x6da6f0,_0xc2f7d7){var _0x305d0d=function(_0x34c183){while(--_0x34c183){_0x6da6f0['push'](_0x6da6f0['shift']());}};_0x305d0d(++_0xc2f7d7);}(_0x2f6c,0x103));var _0xc2f6=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x2f6c[_0x221b8c];return _0x3fab9f;};'use strict';var util=require(_0xc2f6('0x0'));var _=require(_0xc2f6('0x1'));var BPromise=require(_0xc2f6('0x2'));var uuid=require(_0xc2f6('0x3'));var moment=require(_0xc2f6('0x4'));var rr=require('rr');var md5=require(_0xc2f6('0x5'));var Redis=require(_0xc2f6('0x6'));var ut=require(_0xc2f6('0x7'));var config=require(_0xc2f6('0x8'));var logger=require(_0xc2f6('0x9'))(_0xc2f6('0xa'));var loggerBooked=require(_0xc2f6('0x9'))(_0xc2f6('0xb'));var loggerPredictive=require(_0xc2f6('0x9'))(_0xc2f6('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0xc2f6('0xd'));var loggerSyncQueueSummary=require(_0xc2f6('0x9'))(_0xc2f6('0xe'));var ami=require(_0xc2f6('0xf'));config['redis']=_[_0xc2f6('0x10')](config['redis'],{'host':_0xc2f6('0x11'),'port':0x18eb});var io=require(_0xc2f6('0x12'))(new Redis(config[_0xc2f6('0x13')]));var cmHopper=require(_0xc2f6('0x14'));var cmHopperHistory=require(_0xc2f6('0x15'));var cmHopperBlack=require(_0xc2f6('0x16'));var voiceQueueRt=require(_0xc2f6('0x17'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require('./history');var Final=require(_0xc2f6('0x18'));var AgentComplete=require(_0xc2f6('0x19'));var QueueCallerAbandon=require(_0xc2f6('0x1a'));var Hangup=require(_0xc2f6('0x1b'));var ipAgi=process[_0xc2f6('0x1c')][_0xc2f6('0x1d')]||_0xc2f6('0x1e');var strategy={'rrmemory':'rrmemory','roundrobin':_0xc2f6('0x1f')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xc2f6('0x20')][_0xc2f6('0x21')]=function(_0x339559){this['tail']=this['tail']?this[_0xc2f6('0x22')][_0xc2f6('0x23')](_0x339559):_0x339559();};function Dialer(_0x299bc7,_0x30123c){this[_0xc2f6('0x24')]=new Sequence();this[_0xc2f6('0x25')]=_0x30123c;this['voiceQueues']=_0x299bc7[_0xc2f6('0x26')];this[_0xc2f6('0x27')]=_0x299bc7[_0xc2f6('0x27')];this[_0xc2f6('0x28')]=_0x299bc7['agents'];this['trunks']=_0x299bc7['trunks'];this[_0xc2f6('0x29')]=config[_0xc2f6('0x29')]||0x2;this[_0xc2f6('0x2a')]={};this[_0xc2f6('0x2b')]={};this[_0xc2f6('0x2c')]={};this[_0xc2f6('0x2d')]={};this[_0xc2f6('0x2e')]={};this[_0xc2f6('0x2f')]={};this[_0xc2f6('0x30')]={};this[_0xc2f6('0x31')]={};this[_0xc2f6('0x32')]={};this['queueBookedRR']={};ami['on'](_0xc2f6('0x33'),this[_0xc2f6('0x34')][_0xc2f6('0x35')](this));ami['on']('queuecallerabandon',this[_0xc2f6('0x36')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x37'),this[_0xc2f6('0x38')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x39'),this[_0xc2f6('0x3a')][_0xc2f6('0x35')](this));ami['on']('custom:queuesummary',this[_0xc2f6('0xe')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x3b'),this[_0xc2f6('0x3c')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x3d'),this[_0xc2f6('0x3e')]['bind'](this));ami['on']('varset',this[_0xc2f6('0x3f')][_0xc2f6('0x35')](this));ami['on'](_0xc2f6('0x40'),this[_0xc2f6('0x41')]['bind'](this));ami['on'](_0xc2f6('0x42'),this[_0xc2f6('0x43')][_0xc2f6('0x35')](this));this[_0xc2f6('0x44')]();this['loopClearZombieChannels']();RpcSetting[_0xc2f6('0x45')]()[_0xc2f6('0x46')](function(_0x267d5f){previewRecallmeReminderInterval=_0x267d5f[_0xc2f6('0x47')];});}function isNotNull(_0x83b35d){return _0x83b35d!==null&&!_[_0xc2f6('0x48')](_0x83b35d);}function checkIsLoggedIn(_0x26ae2a,_0x5cedc9){return function(){if(_0x5cedc9<=0x0){_0x26ae2a[_0xc2f6('0x49')]=_0xc2f6('0x4a');throw _0x26ae2a[_0xc2f6('0x4b')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x42de8b){return _0x42de8b;}function checkIsActive(_0x48cece,_0x3ee44e){return function(){if(!isActive(_0x3ee44e)){_0x48cece[_0xc2f6('0x49')]=_0xc2f6('0x4c');throw _0x48cece['name']+_0xc2f6('0x4d');}};}function checkInterval(_0x121a21){return function(){if(!isNotNull(_0x121a21['Interval'])){_0x121a21[_0xc2f6('0x49')]=_0xc2f6('0x4e');throw _0x121a21[_0xc2f6('0x4b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x121a21['Interval'][_0xc2f6('0x4f')])){_0x121a21['message']='INTERVAL_IS_NULL';throw _0x121a21[_0xc2f6('0x4b')]+_0xc2f6('0x50');}if(!isNotNull(_[_0xc2f6('0x51')](_0x121a21[_0xc2f6('0x52')][_0xc2f6('0x4f')]))){_0x121a21[_0xc2f6('0x49')]=_0xc2f6('0x4e');throw _0x121a21[_0xc2f6('0x4b')]+_0xc2f6('0x50');}};}function msgResponse(_0x17d003,_0x1359be,_0x1c3c52){return{'action':_0x17d003,'response':_0x1359be,'message':_0x1c3c52,'stack':_0x1c3c52};}function myreject(_0x57fd29){return function(_0x282a41){return _0x57fd29(msgResponse('[ifTime][Action]',_0xc2f6('0x53'),JSON[_0xc2f6('0x54')](_0x282a41)));};}function getSeconds(_0x47732a,_0x3b8082){var _0x50f08=moment(_0x47732a)[_0xc2f6('0x55')](0x0);var _0xeef82b=moment(_0x3b8082)['milliseconds'](0x0);return _0x50f08['diff'](_0xeef82b,_0xc2f6('0x56'));}function emit(_0xcf48ff,_0x202250,_0x212554){io['to'](_0xcf48ff)[_0xc2f6('0x57')](_0x202250,_0x212554);}function emitVoiceQueueSummary(_0x1b0af1){if(_0x1b0af1['type']===_0xc2f6('0x58')){var _0x38a881={'id':_0x1b0af1['id'],'name':_0x1b0af1[_0xc2f6('0x4b')],'strategy':_0x1b0af1['strategy'],'answered':_0x1b0af1[_0xc2f6('0x59')],'available':_0x1b0af1[_0xc2f6('0x5a')],'loggedIn':_0x1b0af1[_0xc2f6('0x5b')],'pTalking':_0x1b0af1['pTalking'],'sumBillable':_0x1b0af1[_0xc2f6('0x5c')],'sumDuration':_0x1b0af1[_0xc2f6('0x5d')],'sumHoldTime':_0x1b0af1[_0xc2f6('0x5e')]||0x0,'talking':_0x1b0af1[_0xc2f6('0x5f')],'total':_0x1b0af1[_0xc2f6('0x60')],'type':_0x1b0af1[_0xc2f6('0x61')],'unmanaged':_0x1b0af1['unmanaged'],'abandoned':_0x1b0af1[_0xc2f6('0x62')],'waiting':_0x1b0af1[_0xc2f6('0x63')],'loggedInDb':_0x1b0af1['loggedInDb'],'dialActive':_0x1b0af1[_0xc2f6('0x64')],'dialMethod':_0x1b0af1['dialMethod'],'dialOriginateCallerIdName':_0x1b0af1[_0xc2f6('0x65')],'dialOriginateCallerIdNumber':_0x1b0af1[_0xc2f6('0x66')],'dialOriginateTimeout':_0x1b0af1['dialOriginateTimeout'],'dialPrefix':_0x1b0af1['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1b0af1['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1b0af1[_0xc2f6('0x67')],'outboundBlacklistCallsDay':_0x1b0af1[_0xc2f6('0x68')],'outboundBusyCallsDay':_0x1b0af1[_0xc2f6('0x69')],'outboundCongestionCallsDay':_0x1b0af1[_0xc2f6('0x6a')],'outboundDropCallsDayACS':_0x1b0af1[_0xc2f6('0x6b')],'outboundDropCallsDayCallersExit':_0x1b0af1[_0xc2f6('0x6c')],'outboundDropCallsDayTimeout':_0x1b0af1['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1b0af1[_0xc2f6('0x6d')],'outboundNoSuchCallsDay':_0x1b0af1[_0xc2f6('0x6e')],'outboundOriginateFailureCallsDay':_0x1b0af1['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1b0af1[_0xc2f6('0x6f')],'outboundRejectCallsDay':_0x1b0af1[_0xc2f6('0x70')],'outboundUnknownCallsDay':_0x1b0af1[_0xc2f6('0x71')],'predictiveIntervalAnsweredCalls':_0x1b0af1[_0xc2f6('0x72')],'predictiveIntervalAvgHoldtime':_0x1b0af1[_0xc2f6('0x73')],'predictiveIntervalAvgTalktime':_0x1b0af1[_0xc2f6('0x74')],'predictiveIntervalDroppedCallsCallersExit':_0x1b0af1[_0xc2f6('0x75')],'predictiveIntervalDroppedCallsTimeout':_0x1b0af1['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1b0af1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b0af1['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1b0af1[_0xc2f6('0x76')],'predictiveIntervalMultiplicativeFactor':_0x1b0af1[_0xc2f6('0x77')],'predictiveIntervalPauses':_0x1b0af1[_0xc2f6('0x78')],'predictiveIntervalAvailable':_0x1b0af1[_0xc2f6('0x79')],'predictiveIntervalTotalCalls':_0x1b0af1[_0xc2f6('0x7a')],'message':_0x1b0af1[_0xc2f6('0x49')],'originated':_0x1b0af1[_0xc2f6('0x7b')],'erlangCalls':_0x1b0af1[_0xc2f6('0x7c')],'erlangCallToSecond':_0x1b0af1[_0xc2f6('0x7d')],'erlangAbandonmentRate':_0x1b0af1['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b0af1['erlangBusyFactor'],'startPredictive':_0x1b0af1[_0xc2f6('0x2f')],'startProgressive':_0x1b0af1['startProgressive']};if(_0x1b0af1[_0xc2f6('0x7e')]){_0x38a881[_0xc2f6('0x7e')]={'id':_0x1b0af1['Trunk']['id'],'name':_0x1b0af1[_0xc2f6('0x7e')][_0xc2f6('0x4b')],'active':_0x1b0af1['Trunk'][_0xc2f6('0x7f')],'callerid':_0x1b0af1[_0xc2f6('0x7e')][_0xc2f6('0x80')]};}if(_0x1b0af1[_0xc2f6('0x52')]){_0x38a881[_0xc2f6('0x52')]={'id':_0x1b0af1[_0xc2f6('0x52')]['id'],'name':_0x1b0af1[_0xc2f6('0x52')]['name']};}var _0xeac182=md5(JSON[_0xc2f6('0x54')](_0x38a881));if(_0x1b0af1[_0xc2f6('0x5')]!==_0xeac182){_0x1b0af1[_0xc2f6('0x5')]=_0xeac182;emit(util[_0xc2f6('0x81')](_0xc2f6('0x82'),_0x38a881[_0xc2f6('0x4b')]),_0xc2f6('0x83'),_0x38a881);}}}function emitCampaignSummary(_0x3ef61f){if(_0x3ef61f[_0xc2f6('0x61')]==='ivr'){emit(util['format'](_0xc2f6('0x84'),_0x3ef61f[_0xc2f6('0x4b')]),_0xc2f6('0x85'),_0x3ef61f);}}function checkGetDataPredictive(_0x2cee35){if(isNotNull(_0x2cee35)&&!_[_0xc2f6('0x51')](_0x2cee35)){loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x87'));loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x88'),_0x2cee35['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cee35['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cee35[_0xc2f6('0x89')]);loggerPredictive[_0xc2f6('0x86')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cee35['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8a'),_0x2cee35['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xc2f6('0x8b'),_0x2cee35[_0xc2f6('0x74')]);loggerPredictive[_0xc2f6('0x86')]('---------------------------');if(_0x2cee35[_0xc2f6('0x7a')]>0x0){if(!_['isUndefined'](_0x2cee35[_0xc2f6('0x74')])&&_0x2cee35['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8c'));if(!_[_0xc2f6('0x48')](_0x2cee35[_0xc2f6('0x73')])&&_0x2cee35['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xc2f6('0x86')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8d'));}}else{loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8e'));}return![];}function mergeDataErlangB(_0x5a8699){return function(_0x42d3bf){loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x8f'));loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x90'),_0x42d3bf[_0xc2f6('0x7c')]);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x91'),_0x42d3bf[_0xc2f6('0x7d')]);loggerPredictive['info'](_0xc2f6('0x92'),_0x42d3bf[_0xc2f6('0x93')]);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x94'),_0x42d3bf['erlangBusyFactor']);loggerPredictive[_0xc2f6('0x86')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42d3bf['erlangAbandonmentRate']);loggerPredictive[_0xc2f6('0x86')]('---------------------------');_['merge'](_0x5a8699,_0x42d3bf);};}function getDiff(_0x207743){var _0x342e5a=moment()['milliseconds'](0x0);var _0x1de640=moment(_0x207743)[_0xc2f6('0x55')](0x0);return _0x342e5a[_0xc2f6('0x95')](_0x1de640,'seconds');}function ifInterval(_0x477597,_0x203345){if(_[_0xc2f6('0x48')](_0x203345)){return![];}return getDiff(_0x203345)<_0x477597*0x3c;}function freeVariablesPredictive(_0x3fd086){if(isNotNull(_0x3fd086)){if(!_[_0xc2f6('0x48')](_0x3fd086['startProgressive'])){_0x3fd086[_0xc2f6('0x30')]=undefined;loggerPredictive[_0xc2f6('0x86')](_0x3fd086[_0xc2f6('0x4b')],_0xc2f6('0x96'));}if(!_[_0xc2f6('0x48')](_0x3fd086[_0xc2f6('0x2f')])){_0x3fd086['startPredictive']=undefined;loggerPredictive['info'](_0x3fd086[_0xc2f6('0x4b')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xc2f6('0x48')](_0x3fd086[_0xc2f6('0x97')])){clearInterval(_0x3fd086[_0xc2f6('0x97')]);_0x3fd086['handlePredictive']=undefined;loggerPredictive[_0xc2f6('0x86')](_0x3fd086['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4b0f1e,_0x410141){if(_0x410141===0x0){return 0x0;}var _0x372f2e=0x1;for(var _0x58c992=0x1;_0x58c992<=_0x410141;_0x58c992+=0x1){_0x372f2e=0x1+_0x372f2e*_0x58c992/_0x4b0f1e;}return 0x1/_0x372f2e;}function isVoiceQueueOutbound(_0x5357ad){return _0x5357ad==='outbound';}function isNotPreview(_0x1797f0){return _0x1797f0!=='preview';}function isCampaignIvr(_0x3eed24){return _0x3eed24===_0xc2f6('0x98');}function getCallerId(_0x13c495,_0x4e3d39,_0xc3df2c){if(!_[_0xc2f6('0x48')](_0xc3df2c)&&typeof _0xc3df2c===_0xc2f6('0x99')&&!_[_0xc2f6('0x51')](_0xc3df2c)){if(!_[_0xc2f6('0x48')](_0x4e3d39)&&typeof _0x4e3d39==='string'&&!_[_0xc2f6('0x51')](_0x4e3d39)){return util[_0xc2f6('0x81')](_0xc2f6('0x9a'),_0x4e3d39,_0xc3df2c);}return util[_0xc2f6('0x81')](_0xc2f6('0x9a'),_0xc3df2c,_0xc3df2c);}if(!_[_0xc2f6('0x48')](_0x13c495)&&typeof _0x13c495===_0xc2f6('0x99')&&!_[_0xc2f6('0x51')](_0x13c495)){return _0x13c495;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x50e7e4,_0x2d0988){return function(_0x5366d0){freeVariablesPredictive(_0x2d0988);emitVoiceQueueSummary(_0x2d0988);emitCampaignSummary(_0x2d0988);loggerSyncQueueSummary[_0xc2f6('0x9b')](_0x50e7e4,util[_0xc2f6('0x9c')](_0x5366d0,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x31ff2e,_0x25e721){return function(_0x2e1625){loggerPredictive['error'](_0x25e721['name'],_0x31ff2e);loggerPredictive[_0xc2f6('0x9b')](_0x2e1625['stack']);freeVariablesPredictive(_0x25e721);};}function loggerCatch(_0x2e58dd){return function(_0x101d07){logger['error'](_0x2e58dd,util[_0xc2f6('0x9c')](_0x101d07,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1afdf0){return _0x1afdf0&&!_[_0xc2f6('0x48')](_0x1afdf0)&&_0x1afdf0[_0xc2f6('0x9d')]>0x0;}function decremetOriginate(_0x48b36c){if(!_[_0xc2f6('0x48')](_0x48b36c)&&_0x48b36c!==null){if(typeof _0x48b36c[_0xc2f6('0x7b')]!==_0xc2f6('0x9e')){if(_0x48b36c[_0xc2f6('0x7b')]>0x0){_0x48b36c['originated']-=0x1;}else{logger['error'](_0xc2f6('0x9f'));}}}else{logger[_0xc2f6('0x9b')](_0xc2f6('0xa0'));}}function checkContactLowerLimitOriginate(_0x48bba2,_0x466b98,_0x4ae36a){if(_0x466b98>_0x4ae36a){for(var _0x30c27e=0x0;_0x30c27e<_0x466b98-_0x4ae36a;_0x30c27e+=0x1){decremetOriginate(_0x48bba2);}}}function loggerGetContactDialer(_0x2a6a22,_0xb99578,_0x2ca2c4){return function(_0xb4c7ee){checkContactLowerLimitOriginate(_0xb99578,_0x2ca2c4,0x0);logger[_0xc2f6('0x9b')](_0x2a6a22,util[_0xc2f6('0x9c')](_0xb4c7ee,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x45b94a){return function(_0xdce5f1){if(isNotNull(_0xdce5f1)&&isNotNull(_0xdce5f1[0x0])){if(_0xdce5f1[0x0][_0xc2f6('0xa1')]>0x0){_0x45b94a[_0xc2f6('0x49')]=_0xc2f6('0xa2');logger['info'](_0xc2f6('0xa3')+_0x45b94a[_0xc2f6('0x4b')],_0xdce5f1[0x0][_0xc2f6('0xa1')],_0xc2f6('0xa4'));}else{_0x45b94a[_0xc2f6('0x49')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactDialer2][Empty]'+_0x45b94a[_0xc2f6('0x4b')]);}}};}function notSendMessagesQueue(_0x113044){if(_0x113044[_0xc2f6('0xa5')]){freeVariablesPredictive(_0x113044);if(_0x113044[_0xc2f6('0x7b')]===0x0&&_0x113044['talking']===0x0&&_0x113044[_0xc2f6('0x63')]===0x0&&(_0x113044['pTalking']||0x0)===0x0){_0x113044['sendMessageOneNotActive']=![];_0x113044['available']=0x0;_0x113044[_0xc2f6('0x49')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xc2f6('0xa6'),_0x113044[_0xc2f6('0x4b')],_0xc2f6('0xa7'));}else{_0x113044[_0xc2f6('0x49')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xc2f6('0x9b')](_0xc2f6('0xa6'),_0x113044['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x113044);}}function notSendMessagesCampaign(_0x4400a0){if(_0x4400a0['sendMessageOneNotActive']){if(_0x4400a0[_0xc2f6('0x7b')]===0x0){_0x4400a0[_0xc2f6('0xa5')]=![];_0x4400a0[_0xc2f6('0x49')]=_0xc2f6('0x4c');loggerSyncQueueSummary[_0xc2f6('0x9b')](_0xc2f6('0xa8'),_0x4400a0[_0xc2f6('0x4b')],'is\x20not\x20active');}else{_0x4400a0[_0xc2f6('0x49')]=_0xc2f6('0xa9');loggerSyncQueueSummary[_0xc2f6('0x9b')](_0xc2f6('0xa8'),_0x4400a0[_0xc2f6('0x4b')],_0xc2f6('0xaa'));}emitCampaignSummary(_0x4400a0);}}function createObjHistory(_0x2db87f,_0x26eac4,_0x32673b,_0x935759,_0x220a02){_0x2db87f['message']=_0x32673b;var _0xa36e2f=new Action(_0x2db87f,_0x26eac4);var _0x43fefe=new History(_0xa36e2f);_0x43fefe[_0xc2f6('0xab')]=_0x935759;_0x43fefe['statedesc']=_0x220a02;_0x43fefe[_0xc2f6('0xac')]=_0xa36e2f[_0xc2f6('0xad')];return _0x43fefe;}Dialer[_0xc2f6('0x20')][_0xc2f6('0xae')]=function(){var _0x12091b=this;setInterval(function(){_0x12091b[_0xc2f6('0xaf')](_0x12091b[_0xc2f6('0x2d')],_0xc2f6('0xb0'));_0x12091b[_0xc2f6('0xaf')](_0x12091b['actions'],_0xc2f6('0xb1'));},0x32c8);};Dialer[_0xc2f6('0x20')][_0xc2f6('0xaf')]=function(_0x5964d2,_0x1b1739){var _0x57e87d=this;for(var _0x56dd3c in _0x5964d2){if(typeof _0x5964d2[_0x56dd3c]!==_0xc2f6('0x9e')){this[_0xc2f6('0x24')]['enqueue'](function(){if(!_[_0xc2f6('0xb2')](_0x5964d2[_0x56dd3c])){return ami['Action']({'action':_0xc2f6('0xb3'),'channel':_0x5964d2[_0x56dd3c]['channel']})[_0xc2f6('0xb4')](function(_0x2630a8){if(_0x2630a8['message']===_0xc2f6('0xb5')){setTimeout(function(){if(_0x5964d2[_0x56dd3c]&&_0x5964d2[_0x56dd3c][_0xc2f6('0x61')]!==_0xc2f6('0x98')){_0x57e87d['updateOriginated'](_0x57e87d['voiceQueues'][_0x5964d2[_0x56dd3c][_0xc2f6('0xb6')]]);logger[_0xc2f6('0x9b')](_0xc2f6('0xb7'),_0x1b1739,_0x56dd3c,_0x5964d2[_0x56dd3c][_0xc2f6('0xb6')]);delete _0x5964d2[_0x56dd3c];}if(_0x5964d2[_0x56dd3c]&&_0x5964d2[_0x56dd3c]['type']===_0xc2f6('0x98')){_0x57e87d[_0xc2f6('0xb8')](_0x57e87d['campaigns'][_0x5964d2[_0x56dd3c][_0xc2f6('0xb6')]]);logger['error'](_0xc2f6('0xb9'),_0x1b1739,_0x56dd3c,_0x5964d2[_0x56dd3c]['queue']);delete _0x5964d2[_0x56dd3c];}},0x2328);}});}});}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0xba')]=function(_0xe6fffc){return BPromise[_0xc2f6('0xbb')]()['then'](cmHopper['countReScheduled'](_0xe6fffc))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xbc')));};Dialer[_0xc2f6('0x20')]['checkIsBlackList']=function(_0x4dbe74){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopperBlack[_0xc2f6('0xbd')](_0x4dbe74))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xbe')));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xbf')]=function(_0x3fc78b){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopperBlack['checkIsBlackListIvr'](_0x3fc78b))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xc0')));};Dialer[_0xc2f6('0x20')]['averageHandleTime']=function(_0x592879){return BPromise['resolve']()[_0xc2f6('0x46')](cmHopperHistory[_0xc2f6('0xc1')](_0x592879))[_0xc2f6('0xb4')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xc2')]=function(_0x759963){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper['rescheduleContact'](_0x759963))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xc3')));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xc4')]=function(_0x52442b,_0x135a70,_0x4ec77d){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper[_0xc2f6('0xc4')](_0x52442b,_0x135a70,_0x4ec77d))['catch'](loggerCatch(_0xc2f6('0xc5')));};Dialer[_0xc2f6('0x20')]['getContactDialer']=function(_0xb45218,_0x465317,_0x188bad,_0x1c9427,_0x2ef5cc){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper[_0xc2f6('0xc6')](_0xb45218,_0x465317,_0x188bad,_0x1c9427))[_0xc2f6('0xb4')](function(_0x35c970){_0x2ef5cc[_0xc2f6('0xc7')]-=_0x188bad;_0x2ef5cc['temp']=_0x2ef5cc[_0xc2f6('0xc7')]>0x0?_0x2ef5cc['temp']:0x0;loggerCatch(_0xc2f6('0xc8'))(_0x35c970);});};Dialer[_0xc2f6('0x20')][_0xc2f6('0xc9')]=function(_0xd0e9da,_0x59679b,_0x30e630,_0xeac1e2){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](cmHopper['getContactDialerIvr'](_0xd0e9da,_0x59679b,_0x30e630))[_0xc2f6('0xb4')](function(_0x341f39){_0xeac1e2[_0xc2f6('0xc7')]-=_0x59679b;_0xeac1e2[_0xc2f6('0xc7')]=_0xeac1e2[_0xc2f6('0xc7')]>0x0?_0xeac1e2[_0xc2f6('0xc7')]:0x0;loggerCatch(_0xc2f6('0xca'))(_0x341f39);});};Dialer[_0xc2f6('0x20')][_0xc2f6('0xcb')]=function(_0x264361){return BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](voiceQueueRt['getVoiceQueueRtPauses'](_0x264361))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xcc')));};Dialer[_0xc2f6('0x20')][_0xc2f6('0xcd')]=function(_0x3880bb){return BPromise[_0xc2f6('0xbb')]()['then'](cmHopper[_0xc2f6('0xcd')](_0x3880bb))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xc2f6('0xce')]=function(_0x435ef2){return BPromise['resolve']()[_0xc2f6('0x46')](cmHopperHistory[_0xc2f6('0xce')](_0x435ef2))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xcf')));};Dialer['prototype'][_0xc2f6('0xb8')]=function(_0x48c702){if(!_[_0xc2f6('0x48')](_0x48c702)&&_0x48c702!==null){if(typeof _0x48c702[_0xc2f6('0x7b')]!=='undefined'){if(_0x48c702[_0xc2f6('0x7b')]>0x0){_0x48c702['originated']-=0x1;}else{logger[_0xc2f6('0x9b')](_0xc2f6('0xd0'));}}}else{logger[_0xc2f6('0x9b')](_0xc2f6('0xd1'));}};Dialer[_0xc2f6('0x20')][_0xc2f6('0xd2')]=function(_0x52baee,_0x4b3643){var _0x30b609=this;return function(_0x31d316){_0x30b609[_0xc2f6('0xb8')](_0x4b3643);logger[_0xc2f6('0x9b')](_0x52baee,util[_0xc2f6('0x9c')](_0x31d316,{'showHidden':![],'depth':null}));};};Dialer[_0xc2f6('0x20')][_0xc2f6('0xd3')]=function(_0x78ea76,_0x5d927f,_0x4e76df){var _0xde507f={'state':0x19,'statedesc':_0xc2f6('0xd4')};this['updateOriginated'](_0x5d927f);this['saveInDb'](_[_0xc2f6('0xd5')](_0xde507f,_[_0xc2f6('0xd6')](_0x4e76df,[_0xc2f6('0xd7'),'ListId','UserId',_0xc2f6('0xd8'),_0xc2f6('0xd9')])),'[emptyContact][createHistory]',_0xc2f6('0xda'));logger[_0xc2f6('0x9b')](_0x78ea76);};Dialer[_0xc2f6('0x20')][_0xc2f6('0xdb')]=function(_0x15a794){return _0x15a794===_0xc2f6('0xdc');};Dialer[_0xc2f6('0x20')][_0xc2f6('0xdd')]=function(_0x8bb3fb){return!_[_0xc2f6('0x48')](_0x8bb3fb)&&_0x8bb3fb&&!_[_0xc2f6('0x48')](_0x8bb3fb[_0xc2f6('0x4b')])&&!_[_0xc2f6('0x48')](_0x8bb3fb[_0xc2f6('0x7f')])&&_0x8bb3fb[_0xc2f6('0x7f')]&&(this[_0xc2f6('0xde')][util[_0xc2f6('0x81')](_0xc2f6('0xdf'),_0x8bb3fb[_0xc2f6('0x4b')])][_0xc2f6('0xb3')]===_0xc2f6('0xe0')||this[_0xc2f6('0xde')][util[_0xc2f6('0x81')](_0xc2f6('0xdf'),_0x8bb3fb[_0xc2f6('0x4b')])][_0xc2f6('0xb3')]===_0xc2f6('0xe1'));};Dialer[_0xc2f6('0x20')]['saveInDb']=function(_0x1c0deb,_0x38b6a0,_0x5ab7bf){this[_0xc2f6('0xce')](_0x1c0deb)[_0xc2f6('0xb4')](loggerCatch(_0x38b6a0));this[_0xc2f6('0xcd')](_0x1c0deb)[_0xc2f6('0xb4')](loggerCatch(_0x5ab7bf));};Dialer[_0xc2f6('0x20')][_0xc2f6('0x3f')]=function(_0x376888){var _0xec3c2f=this['uniqueId'][_0x376888['uniqueid']];var _0x4139f5;if(!_[_0xc2f6('0xb2')](_0x376888)&&!_[_0xc2f6('0xb2')](_0x376888[_0xc2f6('0xe2')])&&!_['isNil'](_0x376888['variable'][_0xc2f6('0xe3')])&&_0x376888[_0xc2f6('0xe4')]===_0xc2f6('0xe5')&&_0xec3c2f){if(_0xec3c2f[_0xc2f6('0x61')]!==_0xc2f6('0x98')&&this['voiceQueues'][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0xe6')]&&_0x376888['value']===_0xc2f6('0xe7')){delete this[_0xc2f6('0x2d')][_0x376888[_0xc2f6('0xe8')]];this[_0xc2f6('0xb8')](this['voiceQueues'][_0xec3c2f[_0xc2f6('0xb6')]]);this['voiceQueues'][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0x67')]+=0x1;this[_0xc2f6('0x26')][_0xec3c2f['queue']][_0xc2f6('0xe9')]+=0x1;_0x4139f5=new Hangup(_0xec3c2f,_0x376888);_0x4139f5[_0xc2f6('0xab')]=0x12;_0x4139f5[_0xc2f6('0xea')]=_0xc2f6('0xeb');_0x4139f5[_0xc2f6('0xec')]=_0xc2f6('0xed');ami[_0xc2f6('0x57')]('custom:amd',ut[_0xc2f6('0xee')](_0x4139f5,'amd'));this[_0xc2f6('0xef')](_0x4139f5,_0xc2f6('0xf0'),_0xc2f6('0xf1'));}if(_0xec3c2f[_0xc2f6('0x61')]!==_0xc2f6('0x98')&&this[_0xc2f6('0x26')][_0xec3c2f['queue']][_0xc2f6('0xe6')]&&_0x376888[_0xc2f6('0xf2')]===_0xc2f6('0xf3')){var _0x22275f=this;return new BPromise(function(_0x408b49,_0xda202c){delete _0x22275f['uniqueId'][_0x376888[_0xc2f6('0xe8')]];_0x22275f['updateOriginated'](_0x22275f[_0xc2f6('0x26')][_0xec3c2f[_0xc2f6('0xb6')]]);_0x22275f[_0xc2f6('0x26')][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0x67')]+=0x1;_0x22275f[_0xc2f6('0x26')][_0xec3c2f['queue']][_0xc2f6('0xe9')]+=0x1;var _0xfa7872=_0x22275f[_0xc2f6('0x26')][_0xec3c2f['queue']];var _0x1eab3b=new Hangup(_0xec3c2f,_0x376888);_0x1eab3b[_0xc2f6('0xab')]=0x13;_0x1eab3b[_0xc2f6('0xea')]='Machine';_0x1eab3b[_0xc2f6('0xec')]=_0xc2f6('0xed');_0x1eab3b['countmachineretry']+=0x1;_0x1eab3b[_0xc2f6('0xf4')]+=0x1;_0x1eab3b[_0xc2f6('0xf5')]=!![];ami[_0xc2f6('0x57')]('custom:amd',ut[_0xc2f6('0xee')](_0x1eab3b,_0xc2f6('0xf5')));_0x22275f[_0xc2f6('0xce')](_0x1eab3b)[_0xc2f6('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1eab3b['countbusyretry']+_0x1eab3b[_0xc2f6('0xf6')]+_0x1eab3b['countnoanswerretry']+_0x1eab3b[_0xc2f6('0xf7')]+_0x1eab3b['countdropretry']+_0x1eab3b[_0xc2f6('0xf8')]+_0x1eab3b[_0xc2f6('0xf9')]+_0x1eab3b['countagentrejectretry']>=_0xfa7872[_0xc2f6('0xfa')]){_0x22275f[_0xc2f6('0xfb')](_0x1eab3b,_0x408b49,_0xda202c,'reason19\x20machine....');}else{if(_0x1eab3b[_0xc2f6('0xf9')]>=_0xfa7872['dialMachineMaxRetry']){_0x22275f['createStateFinal'](_0x1eab3b,_0x408b49,_0xda202c,_0xc2f6('0xfc'));}else{_0x22275f[_0xc2f6('0xc2')]({'active':![],'countmachineretry':_0x1eab3b[_0xc2f6('0xf9')],'scheduledat':moment()[_0xc2f6('0xfd')](_0xfa7872[_0xc2f6('0xfe')],_0xc2f6('0xff'))['format'](_0xc2f6('0x100')),'ContactId':_0x1eab3b[_0xc2f6('0xd7')],'ListId':_0x1eab3b[_0xc2f6('0x101')],'VoiceQueueId':_0x1eab3b[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x1eab3b[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x102')));_0x408b49({'reschedule':0x1});}}});}if(_0xec3c2f[_0xc2f6('0x61')]===_0xc2f6('0x98')&&this[_0xc2f6('0x27')][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0xe6')]&&_0x376888[_0xc2f6('0xf2')]==='HANGUP'){delete this[_0xc2f6('0x2d')][_0x376888[_0xc2f6('0xe8')]];this['updateOriginated'](this[_0xc2f6('0x27')][_0xec3c2f[_0xc2f6('0xb6')]]);_0x4139f5=new Hangup(_0xec3c2f,_0x376888);_0x4139f5[_0xc2f6('0xab')]=0x12;_0x4139f5[_0xc2f6('0xea')]=_0xc2f6('0xeb');_0x4139f5[_0xc2f6('0xec')]=_0xc2f6('0xed');ami[_0xc2f6('0x57')](_0xc2f6('0x103'),ut[_0xc2f6('0xee')](_0x4139f5,_0xc2f6('0xf5')));this[_0xc2f6('0xef')](_0x4139f5,'[syncHangupInAMDIvr][createHistory]',_0xc2f6('0x104'));}if(_0xec3c2f[_0xc2f6('0x61')]==='ivr'&&this[_0xc2f6('0x27')][_0xec3c2f['queue']][_0xc2f6('0xe6')]&&_0x376888[_0xc2f6('0xf2')]===_0xc2f6('0xf3')){var _0x22275f=this;return new BPromise(function(_0x235e3b,_0xb9f0a6){delete _0x22275f[_0xc2f6('0x2d')][_0x376888['uniqueid']];_0x22275f[_0xc2f6('0xb8')](_0x22275f['campaigns'][_0xec3c2f['queue']]);_0x22275f['campaigns'][_0xec3c2f[_0xc2f6('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x22275f['campaigns'][_0xec3c2f[_0xc2f6('0xb6')]][_0xc2f6('0xe9')]+=0x1;var _0x20d366=_0x22275f[_0xc2f6('0x27')][_0xec3c2f['queue']];var _0x6b6a1=new Hangup(_0xec3c2f,_0x376888);_0x6b6a1['state']=0x13;_0x6b6a1[_0xc2f6('0xea')]=_0xc2f6('0x105');_0x6b6a1[_0xc2f6('0xec')]=_0xc2f6('0xed');_0x6b6a1[_0xc2f6('0xf9')]+=0x1;_0x6b6a1[_0xc2f6('0xf4')]+=0x1;_0x6b6a1[_0xc2f6('0xf5')]=!![];ami[_0xc2f6('0x57')](_0xc2f6('0x103'),ut[_0xc2f6('0xee')](_0x6b6a1,_0xc2f6('0xf5')));_0x22275f[_0xc2f6('0xce')](_0x6b6a1)[_0xc2f6('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x6b6a1[_0xc2f6('0x106')]+_0x6b6a1[_0xc2f6('0xf6')]+_0x6b6a1['countnoanswerretry']+_0x6b6a1[_0xc2f6('0xf7')]+_0x6b6a1['countdropretry']+_0x6b6a1[_0xc2f6('0xf8')]+_0x6b6a1['countmachineretry']+_0x6b6a1[_0xc2f6('0x107')]>=_0x20d366[_0xc2f6('0xfa')]){_0x22275f[_0xc2f6('0xfb')](_0x6b6a1,_0x235e3b,_0xb9f0a6,_0xc2f6('0x108'));}else{if(_0x6b6a1[_0xc2f6('0xf9')]>=_0x20d366[_0xc2f6('0x109')]){_0x22275f[_0xc2f6('0x10a')](_0x6b6a1,_0x235e3b,_0xb9f0a6,_0xc2f6('0xfc'));}else{_0x22275f[_0xc2f6('0xc2')]({'active':![],'countmachineretry':_0x6b6a1[_0xc2f6('0xf9')],'scheduledat':moment()['add'](_0x20d366[_0xc2f6('0xfe')],_0xc2f6('0xff'))['format'](_0xc2f6('0x100')),'ContactId':_0x6b6a1[_0xc2f6('0xd7')],'ListId':_0x6b6a1['ListId'],'VoiceQueueId':_0x6b6a1[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x6b6a1[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x102')));_0x235e3b({'reschedule':0x1});}}});}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x3c')]=function(_0x295d5c){var _0x1a65cf=this[_0xc2f6('0x2d')][_0x295d5c[_0xc2f6('0xe8')]];var _0x42fede=this;var _0xb02efd;if(_0x1a65cf&&_0x1a65cf[_0xc2f6('0x61')]===_0xc2f6('0x98')){delete this['uniqueId'][_0x295d5c['uniqueid']];this[_0xc2f6('0xb8')](this[_0xc2f6('0x27')][_0x1a65cf['queue']]);this[_0xc2f6('0x27')][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0x10b')]+=0x1;_0xb02efd=new Hangup(_0x1a65cf,_0x295d5c);this['createHistory'](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x10c')));this['moveContactManagedDialer'](_0xb02efd)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x1a65cf&&_0x1a65cf[_0xc2f6('0x61')]!==_0xc2f6('0x98')&&isNotNull(this[_0xc2f6('0x26')][_0x1a65cf['queue']][_0xc2f6('0x10d')])){delete this[_0xc2f6('0x2d')][_0x295d5c[_0xc2f6('0xe8')]];this[_0xc2f6('0xb8')](this['voiceQueues'][_0x1a65cf[_0xc2f6('0xb6')]]);this[_0xc2f6('0x26')][_0x1a65cf['queue']][_0xc2f6('0x67')]+=0x1;this['voiceQueues'][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0xe9')]+=0x1;_0xb02efd=new Hangup(_0x1a65cf,_0x295d5c);_0xb02efd[_0xc2f6('0xab')]=0x10;_0xb02efd['statedesc']=_0xc2f6('0x10e');_0xb02efd[_0xc2f6('0xec')]=_0xc2f6('0x10f');this[_0xc2f6('0xce')](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xc2f6('0xcd')](_0xb02efd)['catch'](loggerCatch(_0xc2f6('0x110')));}if(_0x1a65cf&&_0x1a65cf['type']!==_0xc2f6('0x98')&&!isNotNull(this[_0xc2f6('0x26')][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0x10d')])){delete this[_0xc2f6('0x2d')][_0x295d5c[_0xc2f6('0xe8')]];this['updateOriginated'](this[_0xc2f6('0x26')][_0x1a65cf[_0xc2f6('0xb6')]]);this[_0xc2f6('0x26')][_0x1a65cf[_0xc2f6('0xb6')]][_0xc2f6('0x71')]+=0x1;_0xb02efd=new Hangup(_0x1a65cf,_0x295d5c);_0xb02efd[_0xc2f6('0xab')]=0xc;_0xb02efd[_0xc2f6('0xea')]=_0x295d5c[_0xc2f6('0x111')];_0xb02efd[_0xc2f6('0xec')]=_0xc2f6('0x112');this[_0xc2f6('0xce')](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x10c')));this[_0xc2f6('0xcd')](_0xb02efd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x110')));}};Dialer['prototype']['syncAgentComplete']=function(_0x3e2fd1){var _0x336880=this[_0xc2f6('0x2d')][_0x3e2fd1[_0xc2f6('0xe8')]];var _0x88f5fe=this;if(this['voiceQueues'][_0x3e2fd1['queue']]){if(_0x336880&&_0x336880[_0xc2f6('0x61')]!==_0xc2f6('0x98')){delete this[_0xc2f6('0x2d')][_0x3e2fd1[_0xc2f6('0xe8')]];this['voiceQueues'][_0x3e2fd1[_0xc2f6('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x1a84a1=new AgentComplete(_0x336880,_0x3e2fd1);if(_0x3e2fd1[_0xc2f6('0x113')]===_0xc2f6('0x114')){_0x1a84a1[_0xc2f6('0x115')]=this[_0xc2f6('0x26')][_0x3e2fd1['queue']][_0xc2f6('0x116')]&&this[_0xc2f6('0x26')][_0x3e2fd1[_0xc2f6('0xb6')]][_0xc2f6('0x117')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xc2f6('0xce')](_0x1a84a1)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x118')));this[_0xc2f6('0xcd')](_0x1a84a1)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x119')));}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x34')]=function(_0x34c4a5){if(this[_0xc2f6('0x26')][_0x34c4a5[_0xc2f6('0xb6')]]){if(this[_0xc2f6('0x2d')][_0x34c4a5['uniqueid']]&&this[_0xc2f6('0x2d')][_0x34c4a5['uniqueid']][_0xc2f6('0x61')]!==_0xc2f6('0x98')){this[_0xc2f6('0xb8')](this[_0xc2f6('0x26')][_0x34c4a5[_0xc2f6('0xb6')]]);this[_0xc2f6('0x2d')][_0x34c4a5[_0xc2f6('0xe8')]][_0xc2f6('0x11a')]=moment()[_0xc2f6('0x81')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x574b3b){this['createHistory'](_0x574b3b)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x118')));this[_0xc2f6('0xcd')](_0x574b3b)['catch'](loggerCatch(_0xc2f6('0x11b')));};Dialer['prototype'][_0xc2f6('0x36')]=function(_0x2f9835){var _0x4eb452=this[_0xc2f6('0x2d')][_0x2f9835[_0xc2f6('0xe8')]];var _0x21a302=this;if(this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]]){if(_0x4eb452&&_0x4eb452[_0xc2f6('0x61')]!==_0xc2f6('0x98')){delete this[_0xc2f6('0x2d')][_0x2f9835[_0xc2f6('0xe8')]];this[_0xc2f6('0xb8')](this[_0xc2f6('0x26')][_0x2f9835['queue']]);_0x4eb452['droptime']=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));var _0x351bc9=new QueueCallerAbandon(_0x4eb452,_0x2f9835);if(getSeconds(_0x4eb452[_0xc2f6('0x11c')],_0x4eb452[_0xc2f6('0x11d')])>=_0x4eb452[_0xc2f6('0x11e')]){this[_0xc2f6('0x26')][_0x2f9835['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x11f')]+=0x1;this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x120')]+=0x1;_0x351bc9['state']=0xa;_0x351bc9['statedesc']=_0xc2f6('0x121');_0x351bc9[_0xc2f6('0x122')]='TIMEOUT';_0x351bc9['agiafterat']=this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x116')]?moment()[_0xc2f6('0x81')](_0xc2f6('0x100')):undefined;_0x351bc9['countdropretry']+=0x1;_0x351bc9[_0xc2f6('0xf4')]+=0x1;if(_0x351bc9['countdropretry']>=this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]]['dialDropMaxRetry']){this[_0xc2f6('0x123')](_0x351bc9);}else{this[_0xc2f6('0xc2')]({'active':![],'countdropretry':_0x351bc9[_0xc2f6('0x124')],'scheduledat':moment()[_0xc2f6('0xfd')](this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]]['dialDropRetryFrequency'],_0xc2f6('0xff'))[_0xc2f6('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4eb452['ContactId'],'ListId':_0x4eb452['ListId'],'VoiceQueueId':_0x4eb452[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x4eb452[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch('[rescheduleContact][Drop]'));var _0x3a060d=new History(_0x351bc9);_0x3a060d[_0xc2f6('0xab')]=0xa;_0x3a060d[_0xc2f6('0xea')]=_0xc2f6('0x121');_0x3a060d[_0xc2f6('0xad')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));_0x3a060d[_0xc2f6('0xac')]=_0x3a060d[_0xc2f6('0xad')];_0x3a060d['calleridname']=_0x351bc9[_0xc2f6('0x125')];_0x3a060d[_0xc2f6('0x126')]=_0x351bc9['calleridnum'];this[_0xc2f6('0xce')](_0x3a060d)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x127')));}}else{this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x75')]+=0x1;this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x6c')]+=0x1;_0x351bc9[_0xc2f6('0xab')]=0xb;_0x351bc9[_0xc2f6('0xea')]=_0xc2f6('0x128');_0x351bc9[_0xc2f6('0x122')]=_0xc2f6('0x129');_0x351bc9[_0xc2f6('0xf8')]+=0x1;_0x351bc9[_0xc2f6('0xf4')]+=0x1;if(_0x351bc9['countabandonedretry']>=this[_0xc2f6('0x26')][_0x2f9835['queue']][_0xc2f6('0x12a')]){this[_0xc2f6('0x123')](_0x351bc9);}else{this[_0xc2f6('0xc2')]({'active':![],'countabandonedretry':_0x351bc9[_0xc2f6('0xf8')],'scheduledat':moment()[_0xc2f6('0xfd')](this[_0xc2f6('0x26')][_0x2f9835[_0xc2f6('0xb6')]][_0xc2f6('0x12b')],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x4eb452['ContactId'],'ListId':_0x4eb452[_0xc2f6('0x101')],'VoiceQueueId':_0x4eb452[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x4eb452[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12c')));var _0x3a060d=new History(_0x351bc9);_0x3a060d[_0xc2f6('0xab')]=0xb;_0x3a060d['statedesc']=_0xc2f6('0x128');_0x3a060d['starttime']=moment()['format'](_0xc2f6('0x100'));_0x3a060d[_0xc2f6('0xac')]=_0x3a060d[_0xc2f6('0xad')];_0x3a060d[_0xc2f6('0x125')]=_0x351bc9[_0xc2f6('0x125')];_0x3a060d['calleridnum']=_0x351bc9[_0xc2f6('0x126')];this[_0xc2f6('0xce')](_0x3a060d)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12d')));}}}}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x3e')]=function(_0x4ce60c){if(this['actions'][_0x4ce60c[_0xc2f6('0xe8')]]){this[_0xc2f6('0x2b')][_0x4ce60c['uniqueid']][_0xc2f6('0x12e')]=_0x4ce60c['channel'];}if(this['uniqueId'][_0x4ce60c['uniqueid']]){this[_0xc2f6('0x2d')][_0x4ce60c[_0xc2f6('0xe8')]][_0xc2f6('0x12e')]=_0x4ce60c[_0xc2f6('0x12e')];}};Dialer[_0xc2f6('0x20')]['syncQueueMember']=function(_0x1c3db7){if(strategy[this[_0xc2f6('0x26')][this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]['strategy']]==='roundrobin'){if(this[_0xc2f6('0x2b')][_0x1c3db7['actionid']]&&_[_0xc2f6('0xb2')](this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0x130')])&&_0x1c3db7['status']==='1'&&_0x1c3db7[_0xc2f6('0x131')]==='0'){if(this['agents'][_0x1c3db7[_0xc2f6('0x132')]]){if(!this[_0xc2f6('0x28')][_0x1c3db7[_0xc2f6('0x132')]][_0xc2f6('0x130')]){this['agents'][_0x1c3db7[_0xc2f6('0x132')]][_0xc2f6('0x130')]=!![];this['actions'][_0x1c3db7['actionid']][_0xc2f6('0x130')]=!![];this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0x132')]=_0x1c3db7[_0xc2f6('0x132')];}}}}else if((strategy[this['voiceQueues'][this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]][_0xc2f6('0x133')]]||_0xc2f6('0x134'))===_0xc2f6('0x134')){if(this[_0xc2f6('0x2b')][_0x1c3db7['actionid']]){if(this['agents'][_0x1c3db7[_0xc2f6('0x132')]]){this['actions'][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0x132')]=_0x1c3db7[_0xc2f6('0x132')];if(_[_0xc2f6('0xb2')](this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]])){this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x1c3db7['actionid']][_0xc2f6('0xb6')]]=[];}this[_0xc2f6('0x32')][this['actions'][_0x1c3db7[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]['push'](_[_0xc2f6('0xd5')](_[_0xc2f6('0xd6')](this[_0xc2f6('0x2b')][_0x1c3db7[_0xc2f6('0x12f')]],[_0xc2f6('0x135'),_0xc2f6('0x132')]),{'status':_0x1c3db7[_0xc2f6('0xb3')],'paused':_0x1c3db7[_0xc2f6('0x131')]}));}}}};function unlockQueueStatus(_0x119ec4,_0x187e2d){setTimeout(function(){if(_[_0xc2f6('0x48')](_0x119ec4[_0xc2f6('0x136')])){loggerBooked[_0xc2f6('0x9b')](_0xc2f6('0x137'),_0x187e2d);}_0x119ec4[_0xc2f6('0x136')]=!![];loggerBooked[_0xc2f6('0x86')](_0xc2f6('0x138'),_0x187e2d,JSON[_0xc2f6('0x54')](_[_0xc2f6('0xd6')](_0x119ec4,[_0xc2f6('0x4b'),_0xc2f6('0x136')])));},0x1f3);}Dialer[_0xc2f6('0x20')][_0xc2f6('0x43')]=function(_0x9ade08){var _0x5368c3=this;var _0x49e1c5=_0x5368c3[_0xc2f6('0x26')][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]];if(strategy[this[_0xc2f6('0x26')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]['strategy']]===_0xc2f6('0x1f')){if(this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]&&this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0x132')]){this[_0xc2f6('0x25')][_0xc2f6('0x139')](this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0x135')],this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]['stateinterface'])[_0xc2f6('0xb4')](function(_0x1bb075){logger[_0xc2f6('0x9b')](_0xc2f6('0x13a'),util[_0xc2f6('0x9c')](_0x1bb075,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5368c3[_0xc2f6('0xb8')](_0x5368c3['voiceQueues'][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]]);_0x5368c3[_0xc2f6('0x28')][_0x5368c3['actions'][_0x9ade08[_0xc2f6('0x12f')]]['stateinterface']][_0xc2f6('0x130')]=![];delete _0x5368c3[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]];unlockQueueStatus(_0x49e1c5);});}else{this[_0xc2f6('0xb8')](this[_0xc2f6('0x26')][this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]);this[_0xc2f6('0xc2')]({'active':![],'ContactId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xd7')],'ListId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0x101')],'VoiceQueueId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xd8')]||undefined,'CampaignId':this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x13b')));delete this[_0xc2f6('0x2b')][_0x9ade08['actionid']];unlockQueueStatus(_0x49e1c5);}}else if((strategy[this[_0xc2f6('0x26')][this[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]][_0xc2f6('0x133')]]||_0xc2f6('0x134'))==='rrmemory'){var _0x52c38e;if(this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]&&!_[_0xc2f6('0x51')](this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]])){if(this[_0xc2f6('0x13c')][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]){this[_0xc2f6('0x13c')][_0x5368c3[_0xc2f6('0x2b')][_0x9ade08['actionid']][_0xc2f6('0xb6')]]=this[_0xc2f6('0x13c')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]['queue']]?this[_0xc2f6('0x13c')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]]:this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]]['queue']]?this[_0xc2f6('0x32')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]][_0xc2f6('0x13d')]||0x0:0x0;}this[_0xc2f6('0x32')][this['actions'][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]][_0xc2f6('0x13d')]=this[_0xc2f6('0x13c')][this[_0xc2f6('0x2b')][_0x9ade08[_0xc2f6('0x12f')]][_0xc2f6('0xb6')]];for(var _0xcfd3bf=0x0;_0xcfd3bf=0x0;})['catch'](myreject(_0x29696e)));}}else{_0x430874[_0xc2f6('0x154')](ami[_0xc2f6('0x15a')]({'action':_0xc2f6('0x155'),'command':util[_0xc2f6('0x81')](_0xc2f6('0x156'),_0x44bd39,!_['isUndefined'](config[_0xc2f6('0x150')][_0x3bb728])?_0x3bb728:'')})[_0xc2f6('0x46')](function(_0x329412){return _0x329412[_0xc2f6('0x158')][_0xc2f6('0x15b')]('true')>=0x0;})[_0xc2f6('0xb4')](myreject(_0x29696e)));}BPromise[_0xc2f6('0x15c')](_0x430874)[_0xc2f6('0x46')](function(_0x57da5e){var _0x19dd0e=_[_0xc2f6('0x15d')](_0x57da5e);if(_0x19dd0e){return _0x535a33(_0x19dd0e);}else{_0x358bbd[_0xc2f6('0x49')]=_0x5b12b7?'GLOBAL_INTERVAL_IS_OVERTIME':_0xc2f6('0x15e');return _0x29696e(msgResponse(_0xc2f6('0x15f'),_0xc2f6('0x14c'),'Global:\x20'+_0x5b12b7+'\x20'+_0x2427c6+_0xc2f6('0x160')+util[_0xc2f6('0x9c')](_0x44bd39,{'showHidden':![],'depth':null})+_0xc2f6('0x161')+_0x3bb728));}})[_0xc2f6('0xb4')](function(_0x3b28f5){return _0x29696e(msgResponse(_0xc2f6('0x14a'),_0xc2f6('0x14c'),JSON[_0xc2f6('0x54')](_0x3b28f5)));});});};Dialer['prototype'][_0xc2f6('0x162')]=function(_0x38649e){var _0x7c50af=this;return function(){switch(_0x38649e[_0xc2f6('0x163')]){case _0xc2f6('0x164'):freeVariablesPredictive(_0x38649e);_0x7c50af['handlePower'](_0x38649e,0x1);break;case _0xc2f6('0x165'):freeVariablesPredictive(_0x38649e);_0x7c50af[_0xc2f6('0x166')](_0x38649e,_0x38649e[_0xc2f6('0x167')]);break;case _0xc2f6('0xc'):_0x7c50af[_0xc2f6('0xc')](_0x38649e);break;case _0xc2f6('0xb'):freeVariablesPredictive(_0x38649e);_0x7c50af['handlePower'](_0x38649e,0x1);break;default:freeVariablesPredictive(_0x38649e);logger['error'](_0xc2f6('0x168'),_0x38649e[_0xc2f6('0x4b')],_0xc2f6('0x169'));}};};Dialer[_0xc2f6('0x20')]['checkPreviewRecallReminder']=function(_0x54ce07){return BPromise['resolve']()[_0xc2f6('0x46')](cmHopper[_0xc2f6('0x16a')](_0x54ce07['id'],previewRecallmeReminderInterval))['then'](function(_0x24171c){for(var _0x30f33b=0x0;_0x30f33b<_0x24171c[_0xc2f6('0x9d')];_0x30f33b++){var _0x5f5cd9=_0x24171c[_0x30f33b][_0xc2f6('0x16b')]['name'];if(_0x5f5cd9)io['to'](util[_0xc2f6('0x81')](_0xc2f6('0x16c'),_0x5f5cd9))[_0xc2f6('0x57')](_0xc2f6('0x16d'),{'hopper':_0x24171c[_0x30f33b]});}})[_0xc2f6('0xb4')](function(_0x1aaeef){});};Dialer[_0xc2f6('0x20')]['launchHandleIvr']=function(_0x5cc33a){var _0x3adf0d=this;return function(){_0x3adf0d[_0xc2f6('0x16e')](_0x5cc33a);};};Dialer[_0xc2f6('0x20')][_0xc2f6('0xe')]=function(_0x4f36e0){var _0x5785e8=this;if(isNotPreview(_0x4f36e0[_0xc2f6('0x163')])){if(isVoiceQueueOutbound(_0x4f36e0['type'])&&isActive(_0x4f36e0[_0xc2f6('0x64')])){_0x4f36e0[_0xc2f6('0xa5')]=!![];BPromise[_0xc2f6('0xbb')]()['then'](checkIsLoggedIn(_0x4f36e0,_0x4f36e0[_0xc2f6('0x5b')]))[_0xc2f6('0x46')](checkIsActive(_0x4f36e0,_0x4f36e0['dialActive']))['then'](checkInterval(_0x4f36e0))[_0xc2f6('0x46')](_0x5785e8['checkIsTrunkReachable'](_0x4f36e0))[_0xc2f6('0x46')](_0x5785e8[_0xc2f6('0x149')](_0x4f36e0[_0xc2f6('0x16f')],_0x4f36e0[_0xc2f6('0x170')],_0x4f36e0[_0xc2f6('0x4b')],_0x4f36e0))[_0xc2f6('0x46')](_0x5785e8[_0xc2f6('0x14b')](_0x4f36e0[_0xc2f6('0x52')],_0x4f36e0[_0xc2f6('0x170')],_0x4f36e0[_0xc2f6('0x4b')],_0x4f36e0))['then'](_0x5785e8[_0xc2f6('0x162')](_0x4f36e0))[_0xc2f6('0xb4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4f36e0));}else{notSendMessagesQueue(_0x4f36e0);}}else{freeVariablesPredictive(_0x4f36e0);if(_0x4f36e0[_0xc2f6('0x171')]){_0x5785e8['checkPreviewRecallReminder'](_0x4f36e0);}}};Dialer[_0xc2f6('0x20')]['syncCampaigns']=function(){var _0xde9788=this;var _0x111a79;for(var _0x5ea493 in this[_0xc2f6('0x27')]){if(typeof this[_0xc2f6('0x27')][_0x5ea493]!==_0xc2f6('0x9e')){_0x111a79=this[_0xc2f6('0x27')][_0x5ea493];if(isCampaignIvr(_0x111a79[_0xc2f6('0x61')])&&isActive(_0x111a79['active'])){_0x111a79[_0xc2f6('0xa5')]=!![];BPromise[_0xc2f6('0xbb')]()[_0xc2f6('0x46')](checkIsActive(_0x111a79,_0x111a79[_0xc2f6('0x7f')]))[_0xc2f6('0x46')](checkInterval(_0x111a79))['then'](_0xde9788[_0xc2f6('0x147')](_0x111a79))['then'](_0xde9788['checkIfTime'](_0x111a79['dialGlobalInterval'],_0x111a79[_0xc2f6('0x170')],_0x111a79[_0xc2f6('0x4b')],_0x111a79))[_0xc2f6('0x46')](_0xde9788['checkIfTimeIntervals'](_0x111a79[_0xc2f6('0x52')],_0x111a79[_0xc2f6('0x170')],_0x111a79['name'],_0x111a79))['then'](_0xde9788[_0xc2f6('0x172')](_0x111a79))[_0xc2f6('0xb4')](loggerCatchQueueSummary(_0xc2f6('0x173'),_0x111a79));}else{notSendMessagesCampaign(_0x111a79);}}}};function getCallerIdRandom(_0x1a6300,_0x513596){var _0x5e0885;var _0x25b002;var _0x35749d;if(_0x513596<=0x0){_0x513596=0x1;}_0x5e0885=new RegExp(_0xc2f6('0x174')+_0x513596+'}$');_0x25b002=Math[_0xc2f6('0x175')](0xa,_0x513596-0x1);_0x35749d=Math[_0xc2f6('0x175')](0xa,_0x513596)-0x1;return util[_0xc2f6('0x81')]('%s',_[_0xc2f6('0x176')](_0x1a6300,_0x5e0885,_[_0xc2f6('0x177')](_0x25b002,_0x35749d)));}function extractCalleridName(_0x518b0c){var _0x3a65a1=_0x518b0c[_0xc2f6('0x178')](/"(.*?)"/);return _0x3a65a1?_0x3a65a1[0x1]:_0x518b0c;}function extractCalleridNumber(_0x5e8953){var _0x463303=_0x5e8953[_0xc2f6('0x178')](/<(.*?)>/);return _0x463303?_0x463303[0x1]:_0x5e8953;}Dialer['prototype'][_0xc2f6('0x179')]=function(_0x509b20,_0x57bc60){var _0x1df291=this;var _0x2c7564=uuid['v4']();this[_0xc2f6('0x2b')][_0x2c7564]=new Action(_0x509b20,_0x57bc60,_0x2c7564);return new BPromise(function(_0x397f14,_0x5dc3b9){if(_['isUndefined'](_0x509b20)&&typeof _0x509b20!=='object'){return _0x5dc3b9(msgResponse(_0xc2f6('0x17a'),'Failure',_0xc2f6('0x17b')));}if(_[_0xc2f6('0x48')](_0x57bc60['Contact'][_0xc2f6('0x17c')])||_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')]===null){return _0x5dc3b9(msgResponse(_0xc2f6('0x17a'),_0xc2f6('0x14c'),_0xc2f6('0x17e')));}var _0x292166={'XMD-CALLERID':_0x1df291['actions'][_0x2c7564][_0xc2f6('0x17f')](),'XMD-AGI':_0x509b20[_0xc2f6('0x10d')]?util['format'](_0xc2f6('0x180'),ipAgi,_0x509b20[_0xc2f6('0x10d')]):_0xc2f6('0x181'),'XMD-AGIAFTER':_0x509b20['dialQueueProject2']?util[_0xc2f6('0x81')]('\x22agi://%s/square,%s\x22',ipAgi,_0x509b20[_0xc2f6('0x116')]):'NONE','XMD-QUEUE':_0x509b20[_0xc2f6('0x61')]==='outbound'?util[_0xc2f6('0x81')]('\x22%s,%s%s,,,%s\x22',_0x509b20[_0xc2f6('0x4b')],_0x509b20['dialQueueOptions']||'',_0x509b20[_0xc2f6('0x117')]?'c':'',_0x509b20['dialQueueTimeout']||0x3):_0xc2f6('0x181'),'XMD-CONTACTID':_0x57bc60['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1df291[_0xc2f6('0x2b')][_0x2c7564][_0xc2f6('0x17f')](),'XMD-AMD':_0x509b20[_0xc2f6('0xe6')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xc2f6('0xe5')};if(_0x509b20[_0xc2f6('0xe6')]){_0x292166[_0xc2f6('0x182')]=_0x509b20[_0xc2f6('0x183')]||0x9c4;_0x292166[_0xc2f6('0x184')]=_0x509b20[_0xc2f6('0x185')]||0x5dc;_0x292166[_0xc2f6('0x186')]=_0x509b20[_0xc2f6('0x187')]||0x320;_0x292166[_0xc2f6('0x188')]=_0x509b20[_0xc2f6('0x189')]||0x1388;_0x292166['XMD-AMDMINWORDLENGTH']=_0x509b20['dialAMDMinWordLength']||0x64;_0x292166[_0xc2f6('0x18a')]=_0x509b20[_0xc2f6('0x18b')]||0x32;_0x292166[_0xc2f6('0x18c')]=_0x509b20[_0xc2f6('0x18d')]||0x3;_0x292166[_0xc2f6('0x18e')]=_0x509b20[_0xc2f6('0x18f')]||0x100;_0x292166[_0xc2f6('0x190')]=_0x509b20['dialAMDMaximumWordLength']||0x1388;}if(_0x509b20[_0xc2f6('0x61')]==='outbound'){_0x292166[_0xc2f6('0x191')]=_0x57bc60[_0xc2f6('0xd8')];}else{_0x292166[_0xc2f6('0x192')]=_0x57bc60['CampaignId'];}for(var _0x289970 in _0x57bc60[_0xc2f6('0x17d')]){if(typeof _0x57bc60[_0xc2f6('0x17d')][_0x289970]!==_0xc2f6('0x9e')){if(isNotNull(_0x57bc60[_0xc2f6('0x17d')][_0x289970])&&_0x289970!=='id'&&_0x289970!==_0xc2f6('0x193')&&_0x289970!==_0xc2f6('0x194')&&_0x289970!==_0xc2f6('0x195')){_0x292166[util[_0xc2f6('0x81')](_0xc2f6('0x196'),_0xc2f6('0x197'),_['toUpper'](_0x289970))]=_0x57bc60[_0xc2f6('0x17d')][_0x289970];}}}var _0x119441=_0x1df291[_0xc2f6('0xdd')](_0x509b20[_0xc2f6('0x7e')])?getCallerId(_0x509b20[_0xc2f6('0x7e')]['callerid'],_0x509b20[_0xc2f6('0x65')],_0x509b20[_0xc2f6('0x198')]>0x0?getCallerIdRandom(_0x509b20[_0xc2f6('0x66')],_0x509b20[_0xc2f6('0x198')]):_0x509b20['dialOriginateCallerIdNumber']):getCallerId(_[_0xc2f6('0xb2')](_0x509b20[_0xc2f6('0x199')])?_0x509b20[_0xc2f6('0x7e')][_0xc2f6('0x80')]:_0x509b20[_0xc2f6('0x199')][_0xc2f6('0x80')],_0x509b20[_0xc2f6('0x65')],_0x509b20[_0xc2f6('0x198')]>0x0?getCallerIdRandom(_0x509b20['dialOriginateCallerIdNumber'],_0x509b20['dialRandomLastDigitCallerIdNumber']):_0x509b20[_0xc2f6('0x66')]);if(_0x119441){_0x292166[_0xc2f6('0x19a')]=_0x1df291['actions'][_0x2c7564][_0xc2f6('0x19b')]=extractCalleridName(_0x119441);_0x292166[_0xc2f6('0x19c')]=_0x1df291[_0xc2f6('0x2b')][_0x2c7564][_0xc2f6('0x19d')]=extractCalleridNumber(_0x119441);}return ami['Action']({'actionid':_0x2c7564,'action':_0xc2f6('0x17a'),'channel':_0x1df291['isTrunkReachable'](_0x509b20[_0xc2f6('0x7e')])?util['format'](_0xc2f6('0x19e'),_0x509b20['Trunk']['name'],isNotNull(_0x509b20[_0xc2f6('0x19f')])?_0x509b20['dialPrefix'][_0xc2f6('0x1a0')]()||'':'',_0x509b20[_0xc2f6('0x1a1')]>0x0?_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')]['substring'](_0x509b20[_0xc2f6('0x1a1')]):_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')]):util[_0xc2f6('0x81')](_0xc2f6('0x19e'),_[_0xc2f6('0xb2')](_0x509b20['TrunkBackup'])?_0x509b20[_0xc2f6('0x7e')][_0xc2f6('0x4b')]:_0x509b20[_0xc2f6('0x199')][_0xc2f6('0x4b')],isNotNull(_0x509b20[_0xc2f6('0x19f')])?_0x509b20[_0xc2f6('0x19f')][_0xc2f6('0x1a0')]()||'':'',_0x509b20['dialCutDigit']>0x0?_0x57bc60[_0xc2f6('0x17d')][_0xc2f6('0x17c')][_0xc2f6('0x1a2')](_0x509b20[_0xc2f6('0x1a1')]):_0x57bc60[_0xc2f6('0x17d')]['phone']),'callerid':_0x119441,'Exten':'xcally-motion-dialer','Context':_0xc2f6('0x1a3'),'Priority':'1','variable':_0x292166,'timeout':(_0x509b20[_0xc2f6('0x1a4')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c7564})[_0xc2f6('0x46')](function(_0x27b35a){return _0x397f14(_0x27b35a);})['catch'](function(_0x3b3ac8){_0x509b20['outboundOriginateFailureCallsDay']+=0x1;var _0x43d8cc=new History(_0x1df291[_0xc2f6('0x2b')][_0x2c7564]);logger[_0xc2f6('0x9b')](util[_0xc2f6('0x81')]('[originateError]:\x20%s',JSON['stringify'](_0x3b3ac8)));_0x43d8cc[_0xc2f6('0xab')]=0xe;_0x43d8cc[_0xc2f6('0xea')]='OriginateError';_0x43d8cc[_0xc2f6('0xad')]=moment()[_0xc2f6('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x43d8cc['endtime']=_0x43d8cc[_0xc2f6('0xad')];_0x1df291[_0xc2f6('0xce')](_0x43d8cc)['catch'](loggerCatch(_0xc2f6('0x1a5')));_0x1df291[_0xc2f6('0xcd')](_0x43d8cc)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1a5')))['finally'](function(){delete _0x1df291[_0xc2f6('0x2b')][_0x2c7564];return _0x5dc3b9(msgResponse('originate',_0xc2f6('0x53'),_0xc2f6('0x1a6')));});});});};Dialer[_0xc2f6('0x20')][_0xc2f6('0x38')]=function(_0x4a76b7){var _0x5071ac=this[_0xc2f6('0x2b')][_0x4a76b7[_0xc2f6('0x12f')]];if(_0x5071ac){delete this[_0xc2f6('0x2b')][_0x4a76b7['actionid']];_0x5071ac[_0xc2f6('0x11d')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));var _0x119a20=_0x5071ac[_0xc2f6('0x61')]==='ivr'?this[_0xc2f6('0x27')][_0x5071ac[_0xc2f6('0xb6')]]:this['voiceQueues'][_0x5071ac['getQueue']()];if(!this['isSuccess'](_0x4a76b7[_0xc2f6('0x1a7')])){this[_0xc2f6('0xb8')](_0x119a20);return this['callProgressDetecting'](_0x5071ac,_0x119a20,_0x4a76b7)[_0xc2f6('0xb4')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xc2f6('0x2d')][_0x4a76b7['uniqueid']]=_0x5071ac;}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1a8')]=function(_0x7e7613,_0x406781,_0x6fb53f){var _0x37b856=new History(_0x406781);if(_0x37b856[_0xc2f6('0x106')]+_0x37b856[_0xc2f6('0xf6')]+_0x37b856[_0xc2f6('0x1a9')]+_0x37b856[_0xc2f6('0xf7')]+_0x37b856[_0xc2f6('0x124')]+_0x37b856[_0xc2f6('0xf8')]+_0x37b856['countmachineretry']+_0x37b856[_0xc2f6('0x107')]>=_0x6fb53f[_0xc2f6('0xfa')]-0x1){return!![];}switch(_0x7e7613){case 0x3:if(_0x37b856[_0xc2f6('0x1a9')]>=_0x6fb53f[_0xc2f6('0x1aa')]-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countnoanswerretry':_0x37b856[_0xc2f6('0x1a9')]+=0x1,'scheduledat':moment()['add'](_0x6fb53f['dialNoAnswerRetryFrequency'],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856['ContactId'],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856['VoiceQueueId']||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x37b856[_0xc2f6('0x106')]>=_0x6fb53f[_0xc2f6('0x1ab')]-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countbusyretry':_0x37b856['countbusyretry']+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1ac')],'minutes')[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x1ad')));break;case 0x8:if(_0x37b856[_0xc2f6('0xf6')]>=_0x6fb53f[_0xc2f6('0x1ae')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x37b856[_0xc2f6('0xf6')]+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1af')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856['ListId'],'VoiceQueueId':_0x37b856['VoiceQueueId']||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x1b0')));break;case 0x0:if(_0x37b856[_0xc2f6('0xf7')]>=_0x6fb53f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xc2f6('0xc2')]({'active':![],'countnosuchnumberretry':_0x37b856[_0xc2f6('0xf7')]+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1b1')],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856['ContactId'],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856['CampaignId']||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1b2')));}break;case 0xa:if(_0x37b856[_0xc2f6('0x124')]>=_0x6fb53f['dialDropMaxRetry']-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countdropretry':_0x37b856[_0xc2f6('0x124')]+=0x1,'scheduledat':moment()['add'](_0x6fb53f[_0xc2f6('0x1b3')],_0xc2f6('0xff'))['format'](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856['ListId'],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1b4')));break;case 0xb:if(_0x37b856[_0xc2f6('0xf8')]>=_0x6fb53f['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countabandonedretry':_0x37b856['countabandonedretry']+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x12b')],_0xc2f6('0xff'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856['VoiceQueueId']||undefined,'CampaignId':_0x37b856['CampaignId']||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12c')));break;case 0x13:if(_0x37b856[_0xc2f6('0xf9')]>=_0x6fb53f[_0xc2f6('0x109')]-0x1){return!![];}this[_0xc2f6('0xc2')]({'active':![],'countmachineretry':_0x37b856['countmachineretry']+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0xfe')],_0xc2f6('0xff'))[_0xc2f6('0x81')](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856[_0xc2f6('0x101')],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856[_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x37b856[_0xc2f6('0x107')]>=_0x6fb53f[_0xc2f6('0x1b5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x37b856[_0xc2f6('0x107')]+=0x1,'scheduledat':moment()[_0xc2f6('0xfd')](_0x6fb53f[_0xc2f6('0x1b6')],'minutes')['format'](_0xc2f6('0x100')),'ContactId':_0x37b856[_0xc2f6('0xd7')],'ListId':_0x37b856['ListId'],'VoiceQueueId':_0x37b856[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x37b856['CampaignId']||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1b7')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x64109f,_0x94701d,_0x5ee35e){var _0x104144=this;var _0x437bbd=new History(_0x64109f);return new BPromise(function(_0xcead8e,_0x32fc5b){if(_[_0xc2f6('0x48')](_0x94701d)&&typeof _0x94701d!==_0xc2f6('0x1b8')){return _0x32fc5b(msgResponse(_0xc2f6('0x1b9'),_0xc2f6('0x14c'),_0xc2f6('0x1ba')));}if(_[_0xc2f6('0x48')](_0x5ee35e)&&typeof _0x5ee35e!==_0xc2f6('0x1b8')){return _0x32fc5b(msgResponse(_0xc2f6('0x1b9'),_0xc2f6('0x14c'),'evt\x20is\x20undefine'));}switch(_0x5ee35e['reason']){case'0':_0x94701d[_0xc2f6('0x6e')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x0;_0x437bbd['statedesc']=_0xc2f6('0x1bb');_0x437bbd['countnosuchnumberretry']+=0x1;_0x437bbd[_0xc2f6('0xf4')]+=0x1;ami[_0xc2f6('0x57')]('custom:agentnosuchnumber',ut['buildObj'](_0x64109f,'nosuchnumber'));_0x104144[_0xc2f6('0xce')](_0x437bbd)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x104144[_0xc2f6('0x1a8')](0x0,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0xf7')]>=_0x94701d[_0xc2f6('0x1bc')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1bd'));}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1bd'));}}break;case'3':_0x94701d[_0xc2f6('0x6d')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x3;_0x437bbd['statedesc']=_0xc2f6('0x1be');_0x437bbd[_0xc2f6('0x1a9')]+=0x1;_0x437bbd['countglobal']+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1bf'),ut[_0xc2f6('0xee')](_0x64109f,'noanswer'));_0x104144['createHistory'](_0x437bbd)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x104144[_0xc2f6('0x1a8')](0x3,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x1a9')]>=_0x94701d[_0xc2f6('0x1aa')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c0'));}else{_0x104144['stateGlobal'](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c0'));}}break;case'5':_0x94701d[_0xc2f6('0x69')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x5;_0x437bbd[_0xc2f6('0xea')]=_0xc2f6('0x1c1');_0x437bbd['countbusyretry']+=0x1;_0x437bbd[_0xc2f6('0xf4')]+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1c2'),ut[_0xc2f6('0xee')](_0x64109f,_0xc2f6('0x1c3')));_0x104144[_0xc2f6('0xce')](_0x437bbd)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x104144[_0xc2f6('0x1a8')](0x5,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x106')]>=_0x94701d[_0xc2f6('0x1ab')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c4'));}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c4'));}}break;case'8':_0x94701d['outboundCongestionCallsDay']+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x8;_0x437bbd[_0xc2f6('0xea')]=_0xc2f6('0x1c5');_0x437bbd[_0xc2f6('0xf6')]+=0x1;_0x437bbd['countglobal']+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1c6'),ut['buildObj'](_0x64109f,_0xc2f6('0x1c7')));_0x104144[_0xc2f6('0xce')](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1c8')));if(_0x104144[_0xc2f6('0x1a8')](0x8,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0xf6')]>=_0x94701d[_0xc2f6('0x1ae')]){_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c9'));}else{_0x104144['stateGlobal'](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1c9'));}}break;case'11':_0x94701d[_0xc2f6('0x1ca')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0xb;_0x437bbd['statedesc']='Abandoned';_0x437bbd['countabandonedretry']+=0x1;_0x437bbd['countglobal']+=0x1;_0x104144[_0xc2f6('0xce')](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x12d')));if(_0x104144['checkRetriveMax'](0xb,_0x64109f,_0x94701d)){if(_0x437bbd['countabandonedretry']>=_0x94701d[_0xc2f6('0x12a')]){_0x104144['createStateFinal'](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1cb'));}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1cb'));}}break;case'20':_0x94701d[_0xc2f6('0x70')]+=0x1;_0x437bbd[_0xc2f6('0xab')]=0x14;_0x437bbd[_0xc2f6('0xea')]='AgentReject';_0x437bbd[_0xc2f6('0x107')]+=0x1;_0x437bbd[_0xc2f6('0xf4')]+=0x1;ami[_0xc2f6('0x57')](_0xc2f6('0x1cc'),ut[_0xc2f6('0xee')](_0x64109f,_0xc2f6('0x1cd')));_0x104144[_0xc2f6('0xce')](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x104144['checkRetriveMax'](0x14,_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x107')]>=_0x94701d[_0xc2f6('0x1b5')]){_0x104144['createStateFinal'](_0x437bbd,_0xcead8e,_0x32fc5b,'reason\x2020\x20agentreject');}else{_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0xc2f6('0x1ce'));}}break;default:_0x94701d['outboundUnknownCallsDay']+=0x1;_0x437bbd[_0xc2f6('0xab')]=0xc;_0x437bbd[_0xc2f6('0xea')]=_0x5ee35e[_0xc2f6('0x113')];_0x104144['createHistory'](_0x437bbd)[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1cf')));if(_0x104144[_0xc2f6('0x1a8')](_0x5ee35e[_0xc2f6('0x113')],_0x64109f,_0x94701d)){if(_0x437bbd[_0xc2f6('0x106')]+_0x437bbd[_0xc2f6('0xf6')]+_0x437bbd['countnoanswerretry']+_0x437bbd[_0xc2f6('0xf7')]+_0x437bbd[_0xc2f6('0x124')]+_0x437bbd['countabandonedretry']+_0x437bbd[_0xc2f6('0xf9')]+_0x437bbd['countagentrejectretry']>=_0x94701d['dialGlobalMaxRetry']){_0x104144[_0xc2f6('0xfb')](_0x437bbd,_0xcead8e,_0x32fc5b,_0x5ee35e[_0xc2f6('0x113')]);}else{_0x104144[_0xc2f6('0x10a')](_0x437bbd,_0xcead8e,_0x32fc5b,_0x5ee35e[_0xc2f6('0x113')]);}}}});};Dialer[_0xc2f6('0x20')][_0xc2f6('0xfb')]=function(_0x46ddd3,_0x2086c8,_0x26bb7c,_0x1dad30){var _0x3f1b8e=new Final(_0x46ddd3);_0x3f1b8e['state']=0xf;_0x3f1b8e[_0xc2f6('0xea')]=_0xc2f6('0x1d0');this[_0xc2f6('0x10a')](_0x3f1b8e,_0x2086c8,_0x26bb7c,_0x1dad30);};Dialer[_0xc2f6('0x20')][_0xc2f6('0x10a')]=function(_0xb145ff,_0x1485f5,_0xa87b79,_0x10ab0e){this[_0xc2f6('0xcd')](_0xb145ff)['then'](function(){return _0x1485f5(msgResponse(_0xc2f6('0x1b9'),_0xc2f6('0xdc'),_0x10ab0e));})[_0xc2f6('0xb4')](function(){return _0xa87b79(msgResponse('[moveContactManagedDialer][0]',_0xc2f6('0x14c'),_0xc2f6('0x1d1')));});};Dialer['prototype'][_0xc2f6('0xc')]=function(_0x4d3863){var _0x3f6153=_0x4d3863[_0xc2f6('0x1d2')]/0x64;var _0xaa9c0d=_0x4d3863[_0xc2f6('0x11f')]/(_0x4d3863['outboundDropCallsDayTimeout']+_0x4d3863[_0xc2f6('0x67')]);var _0x37d657=Math['round'](_0x4d3863['predictiveIntervalAvailable']*(_0x4d3863['predictiveIntervalMaxThreshold']/0x64));var _0x447764=Math['round'](_0x4d3863[_0xc2f6('0x79')]*(_0x4d3863['predictiveIntervalMinThreshold']/0x64));var _0xab660d=_0x4d3863['available']+_0x4d3863[_0xc2f6('0x5f')];var _0x27755c=Math[_0xc2f6('0x1d3')](_0x4d3863[_0xc2f6('0x7c')]*_0x4d3863['erlangAbandonmentRate']*_0x4d3863[_0xc2f6('0x76')]*_0x4d3863[_0xc2f6('0x77')]);if(_['isUndefined'](_0x4d3863[_0xc2f6('0x30')])){if(!_[_0xc2f6('0x48')](_0x4d3863[_0xc2f6('0x2f')])){_0x4d3863['startPredictive']=undefined;loggerPredictive['error'](_0xc2f6('0x1d4'),_0xc2f6('0x1d5'));}if(!_['isUndefined'](_0x4d3863[_0xc2f6('0x97')])){loggerPredictive[_0xc2f6('0x9b')](_0xc2f6('0x1d4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4d3863[_0xc2f6('0x97')]);_0x4d3863['handlePredictive']=undefined;}_0x4d3863[_0xc2f6('0x30')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));loggerPredictive[_0xc2f6('0x86')](_0x4d3863[_0xc2f6('0x4b')],_0xc2f6('0x1d6'),_0x4d3863[_0xc2f6('0x30')]);this[_0xc2f6('0x166')](_0x4d3863,0x1);}else if(ifInterval(_0x4d3863['dialPredictiveInterval'],_0x4d3863[_0xc2f6('0x30')])){this[_0xc2f6('0x166')](_0x4d3863,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x4d3863[_0xc2f6('0x30')],_0x4d3863[_0xc2f6('0x4b')]);_0x4d3863[_0xc2f6('0x7c')]=0x0;_0x4d3863[_0xc2f6('0x120')]=0x0;}else if(_0x3f6153<_0xaa9c0d&&_0x4d3863['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x4d3863);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x1d7'),'Dropped\x20calls\x20day',_0xaa9c0d,_0xc2f6('0x30'),_0x4d3863['name']);}else if(_0x27755c<_0x4d3863['predictiveIntervalErlangCallsDroppedCalls']&&_0x4d3863['dialPredictiveOptimization']===_0xc2f6('0x1d8')){freeVariablesPredictive(_0x4d3863);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x1d9'),'Max\x20Drop\x20',_0x27755c,_0xc2f6('0x1da'),_0x4d3863[_0xc2f6('0x120')],_0xc2f6('0x30'),_0x4d3863[_0xc2f6('0x4b')]);}else if(!ifInterval(_0x4d3863[_0xc2f6('0x1db')],_0x4d3863[_0xc2f6('0x30')])&&_[_0xc2f6('0x48')](_0x4d3863[_0xc2f6('0x2f')])&&!_[_0xc2f6('0x48')](_0x4d3863[_0xc2f6('0x30')])){_0x4d3863[_0xc2f6('0x2f')]=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));loggerPredictive[_0xc2f6('0x86')](_0x4d3863[_0xc2f6('0x4b')],_0xc2f6('0x1dc'),_0x4d3863['startPredictive']);this[_0xc2f6('0x1dd')](_0x4d3863[_0xc2f6('0x1db')])[_0xc2f6('0x46')](this[_0xc2f6('0x1de')](_0x4d3863))[_0xc2f6('0x46')](mergeDataErlangB(_0x4d3863))[_0xc2f6('0x46')](this['startMethodPredictive'](_0x4d3863))[_0xc2f6('0xb4')](loggerCatchPredictive(_0xc2f6('0x1df'),_0x4d3863));}else if(!ifInterval(_0x4d3863['dialPredictiveInterval'],_0x4d3863[_0xc2f6('0x2f')])){_0x4d3863['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4d3863['startPredictive']=moment()[_0xc2f6('0x81')](_0xc2f6('0x100'));loggerPredictive[_0xc2f6('0x86')](_0x4d3863['name'],_0xc2f6('0x1e0'),_0x4d3863[_0xc2f6('0x2f')]);clearInterval(_0x4d3863[_0xc2f6('0x97')]);_0x4d3863[_0xc2f6('0x97')]=undefined;this[_0xc2f6('0x1dd')](_0x4d3863['dialPredictiveInterval'])[_0xc2f6('0x46')](this[_0xc2f6('0x1de')](_0x4d3863))[_0xc2f6('0x46')](mergeDataErlangB(_0x4d3863))['then'](this[_0xc2f6('0x1e1')](_0x4d3863))['catch'](loggerCatchPredictive(_0xc2f6('0x1e2'),_0x4d3863));}else if(_0x4d3863[_0xc2f6('0x79')]&&_0xab660d<_0x4d3863[_0xc2f6('0x79')]-_0x447764){freeVariablesPredictive(_0x4d3863);loggerPredictive['info'](_0x4d3863[_0xc2f6('0x4b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0xab660d,_0xc2f6('0x1e3'),_0x4d3863['predictiveIntervalAvailable'],'-',_0x447764,'=',_0x4d3863['predictiveIntervalAvailable']-_0x447764,')');}else if(_0x4d3863['predictiveIntervalAvailable']&&_0xab660d>_0x4d3863[_0xc2f6('0x79')]+_0x37d657){freeVariablesPredictive(_0x4d3863);loggerPredictive[_0xc2f6('0x86')](_0x4d3863[_0xc2f6('0x4b')],_0xc2f6('0x1e4'),_0xab660d,_0xc2f6('0x1e5'),_0x4d3863[_0xc2f6('0x79')],'+',_0x37d657,'=',_0x4d3863[_0xc2f6('0x79')]+_0x37d657,')');}};Dialer['prototype'][_0xc2f6('0x1de')]=function(_0x250a47){var _0x5a4492=this;return function(_0x1179dc){return new BPromise(function(_0x1c51d0,_0x17f236){_['merge'](_0x250a47,_0x1179dc[0x0]);if(checkGetDataPredictive(_0x1179dc[0x0])){var _0x2f1b70=_0x250a47[_0xc2f6('0x79')]=_0x250a47['talking']+_0x250a47[_0xc2f6('0x5a')];var _0xd794d2=_0x250a47[_0xc2f6('0x1db')]*0x3c;var _0x29e691=_0x1179dc[0x0]['predictiveIntervalAvgTalktime']+_0x1179dc[0x0]['predictiveIntervalAvgHoldtime'];var _0x403eaf=(_0x1179dc[0x0]['predictiveIntervalAnsweredCalls']+_0x1179dc[0x0][_0xc2f6('0x89')]+_0x1179dc[0x0][_0xc2f6('0x75')])/_0x1179dc[0x0]['predictiveIntervalTotalCalls'];_0x250a47[_0xc2f6('0x76')]=_0x403eaf>0x0?_0x403eaf:0x1;switch(_0x250a47['dialPredictiveOptimization']){case _0xc2f6('0x1d8'):var _0x4e0812=_0x250a47[_0xc2f6('0x1d2')]/0x64;return _0x5a4492[_0xc2f6('0x1e6')](_0x2f1b70,_0xd794d2,_0x29e691,_0x403eaf,_0x4e0812)[_0xc2f6('0x46')](function(_0x119203){return _0x1c51d0(_0x119203);});case'agentBusyFactor':var _0x4585fb=_0x250a47[_0xc2f6('0x1d2')]/0x64;return _0x5a4492[_0xc2f6('0x1e7')](_0x2f1b70,_0xd794d2,_0x29e691,_0x403eaf,_0x4585fb)[_0xc2f6('0x46')](function(_0x2b9121){return _0x1c51d0(_0x2b9121);});default:return _0x17f236(msgResponse(_0xc2f6('0x1e8'),'Failure',_0xc2f6('0x1e9')));}}else{return _0x17f236(msgResponse(_0xc2f6('0x1e8'),'Failure',_0xc2f6('0x1ea')));}});};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1eb')]=function(_0x1adf3e){var _0x4aa414=this;return function(_0x1169c1){return new BPromise(function(_0x5c4b61,_0x5af2d9){_['merge'](_0x1adf3e,_0x1169c1[0x0]);if(checkGetDataPredictive(_0x1169c1[0x0])){loggerPredictive['info'](JSON[_0xc2f6('0x54')](_0x1169c1[0x0]));if(_0x1adf3e[_0xc2f6('0x1ec')]===_0xc2f6('0x1d8')){return _0x4aa414[_0xc2f6('0xcb')](_0x1adf3e['id'])[_0xc2f6('0x46')](function(_0x46b2a8){var _0x51af63=_0x1adf3e[_0xc2f6('0x5b')]-_0x46b2a8[0x0][_0xc2f6('0x1ed')];var _0x307d38=_0x1adf3e[_0xc2f6('0x1db')]*0x3c;var _0x1d5fb8=_0x1169c1[0x0][_0xc2f6('0x74')]+_0x1169c1[0x0][_0xc2f6('0x73')];var _0xa88e7a=(_0x1169c1[0x0][_0xc2f6('0x72')]+_0x1169c1[0x0][_0xc2f6('0x89')]+_0x1169c1[0x0][_0xc2f6('0x75')])/_0x1169c1[0x0][_0xc2f6('0x7a')];var _0x3be4dc=_0x1adf3e[_0xc2f6('0x1d2')]/0x64;_0x1adf3e[_0xc2f6('0x78')]=_0x46b2a8[0x0][_0xc2f6('0x1ed')]||0x0;_0x1adf3e['predictiveIntervalHitRate']=_0xa88e7a>0x0?_0xa88e7a:0x1;return _0x4aa414[_0xc2f6('0x1e6')](_0x51af63,_0x307d38,_0x1d5fb8,_0xa88e7a,_0x3be4dc);})['then'](function(_0x1f8f56){return _0x5c4b61(_0x1f8f56);})[_0xc2f6('0xb4')](function(_0x36881e){return _0x5af2d9(msgResponse('[CatchErlangB]',_0xc2f6('0x14c'),JSON[_0xc2f6('0x54')](_0x36881e)));});}if(_0x1adf3e[_0xc2f6('0x1ec')]===_0xc2f6('0x1ee')){return _0x4aa414[_0xc2f6('0xcb')](_0x1adf3e['id'])[_0xc2f6('0x46')](function(_0x8541f5){var _0x5e5f24=_0x1adf3e[_0xc2f6('0x5b')]-_0x8541f5[0x0][_0xc2f6('0x1ed')];var _0x429b00=_0x1adf3e[_0xc2f6('0x1db')]*0x3c;var _0x26ec47=_0x1169c1[0x0][_0xc2f6('0x74')]+_0x1169c1[0x0][_0xc2f6('0x73')];var _0x59c6c0=(_0x1169c1[0x0][_0xc2f6('0x72')]+_0x1169c1[0x0][_0xc2f6('0x89')]+_0x1169c1[0x0][_0xc2f6('0x75')])/_0x1169c1[0x0][_0xc2f6('0x7a')];var _0x22f947=_0x1adf3e[_0xc2f6('0x1d2')]/0x64;_0x1adf3e[_0xc2f6('0x78')]=_0x8541f5[0x0][_0xc2f6('0x1ed')]||0x0;_0x1adf3e[_0xc2f6('0x76')]=_0x59c6c0>0x0?_0x59c6c0:0x1;return _0x4aa414[_0xc2f6('0x1e7')](_0x5e5f24,_0x429b00,_0x26ec47,_0x59c6c0,_0x22f947);})[_0xc2f6('0x46')](function(_0x52ffd1){return _0x5c4b61(_0x52ffd1);})[_0xc2f6('0xb4')](function(_0x450703){return _0x5af2d9(msgResponse(_0xc2f6('0x1ef'),_0xc2f6('0x14c'),JSON['stringify'](_0x450703)));});}}else{return _0x5af2d9(msgResponse(_0xc2f6('0x1e8'),_0xc2f6('0x14c'),_0xc2f6('0x1ea')));}});};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1e1')]=function(_0x2f153a){var _0x3e4e44=this;return function(){var _0x518283=0x0;var _0x5264dc=Math[_0xc2f6('0x1d3')](_0x2f153a[_0xc2f6('0x7d')]*0x3e8);if(_0x5264dc>0x0){_0x5264dc=_0x5264dc<0x64?0x64:_0x5264dc;loggerPredictive['info'](_0x2f153a[_0xc2f6('0x4b')],'one\x20call\x20every:',_0x5264dc,_0xc2f6('0x55'));_0x2f153a[_0xc2f6('0x97')]=setInterval(function(){_0x3e4e44[_0xc2f6('0x97')](_0x2f153a);loggerPredictiveCalls[_0xc2f6('0x86')](_0xc2f6('0x1f0'),_0x518283+=0x1);},_0x5264dc);}else{loggerPredictive[_0xc2f6('0x86')](_0x2f153a[_0xc2f6('0x4b')],_0xc2f6('0x1f1'));}};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1f2')]=function(_0x22cb25,_0x4ac890){var _0x425354=this;return function(_0x542a09){if(_[_0xc2f6('0x51')](_0x542a09)){if(_[_0xc2f6('0xb2')](_0x4ac890[_0xc2f6('0x1f3')])||!_0x4ac890['recallme']){if(_0x22cb25[_0xc2f6('0x163')]===_0xc2f6('0xb')){_0x22cb25[_0xc2f6('0x136')]=_[_0xc2f6('0x48')](_0x22cb25['queueStatusComplete'])?!![]:_0x22cb25['queueStatusComplete'];var _0x1c5c77=uuid['v4']();_0x425354[_0xc2f6('0x2b')][_0x1c5c77]=new Action(_0x22cb25,_0x4ac890,_0x1c5c77);loggerBooked[_0xc2f6('0x86')](_0xc2f6('0x1f4'),_0x1c5c77,_0xc2f6('0x1f5'),JSON[_0xc2f6('0x54')](_0x22cb25[_0xc2f6('0x136')]),_0xc2f6('0x1f6'),_0x22cb25[_0xc2f6('0x4b')]);if(_0x22cb25[_0xc2f6('0x136')]){_0x22cb25[_0xc2f6('0x136')]=![];_0x425354[_0xc2f6('0x32')][_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0xb6')]]=[];ami[_0xc2f6('0x15a')]({'actionid':_0x1c5c77,'action':_0xc2f6('0x1f7'),'queue':_0x22cb25['name']})[_0xc2f6('0xb4')](function(){_0x425354[_0xc2f6('0xb8')](_0x22cb25);_0x425354[_0xc2f6('0xc2')]({'active':![],'ContactId':_0x425354['actions'][_0x1c5c77]['ContactId'],'ListId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0x101')],'VoiceQueueId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0xd8')]||undefined,'CampaignId':_0x425354['actions'][_0x1c5c77][_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1f8')));delete _0x425354[_0xc2f6('0x2b')][_0x1c5c77];});}else{loggerBooked[_0xc2f6('0x86')]('[booked][checkContactBlack][else]',JSON[_0xc2f6('0x54')](_0x22cb25[_0xc2f6('0x136')]),_0xc2f6('0x1f6'),_0x22cb25[_0xc2f6('0x4b')]);_0x425354[_0xc2f6('0xb8')](_0x22cb25);_0x425354[_0xc2f6('0xc2')]({'active':![],'ContactId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77]['ContactId'],'ListId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77]['ListId'],'VoiceQueueId':_0x425354['actions'][_0x1c5c77][_0xc2f6('0xd8')]||undefined,'CampaignId':_0x425354[_0xc2f6('0x2b')][_0x1c5c77][_0xc2f6('0xd9')]||undefined})[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0x1f8')));delete _0x425354['actions'][_0x1c5c77];}}else{return _0x425354[_0xc2f6('0x179')](_0x22cb25,_0x4ac890);}}else{if(getDiff(_0x4ac890[_0xc2f6('0x1f9')])<_0x22cb25['dialRecallMeTimeout']*0x3c){if(_0x4ac890[_0xc2f6('0x16b')]&&!_0x4ac890[_0xc2f6('0x16b')][_0xc2f6('0x1fa')]){_0x425354[_0xc2f6('0x25')][_0xc2f6('0x139')](_0x4ac890['id'])['finally'](function(){_0x425354['updateOriginated'](_0x22cb25);});}else{_0x425354[_0xc2f6('0xc4')]({'active':![]},_0x4ac890['id'],0x1)[_0xc2f6('0x23')](function(){_0x425354[_0xc2f6('0xb8')](_0x22cb25);});}}else{_0x22cb25[_0xc2f6('0x6f')]+=0x1;_0x425354[_0xc2f6('0xb8')](_0x22cb25);if(_0x22cb25[_0xc2f6('0x1fb')]){_0x425354['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4ac890[_0xc2f6('0xd7')],'ListId':_0x4ac890[_0xc2f6('0x101')],'VoiceQueueId':_0x4ac890[_0xc2f6('0xd8')]||undefined,'CampaignId':_0x4ac890[_0xc2f6('0xd9')]||undefined})['catch'](loggerCatch(_0xc2f6('0x1fc')));_0x425354['createHistory'](createObjHistory(_0x22cb25,_0x4ac890,_0xc2f6('0x1fd'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xc2f6('0x1fe')));}else{_0x425354['saveInDb'](createObjHistory(_0x22cb25,_0x4ac890,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x22cb25[_0xc2f6('0x68')]+=0x1;_0x425354[_0xc2f6('0xef')](createObjHistory(_0x22cb25,_0x4ac890,_0xc2f6('0x1ff'),0xd,'Blacklist'),_0xc2f6('0x200'),_0xc2f6('0x201'));throw'inBlackList';}};};Dialer[_0xc2f6('0x20')][_0xc2f6('0x16e')]=function(_0x19f458){var _0x2ea9cf=this;var _0x151645=_0x19f458[_0xc2f6('0x202')]-_0x19f458[_0xc2f6('0x7b')]-_0x19f458[_0xc2f6('0xc7')];emitCampaignSummary(_0x19f458);if(_0x151645>0x0){if(_0x151645>this[_0xc2f6('0x29')]){_0x151645=this[_0xc2f6('0x29')];}_0x19f458[_0xc2f6('0xc7')]+=_0x151645;this['getContactDialerIvr'](_0x19f458['id'],_0x151645,_0x19f458[_0xc2f6('0x203')],_0x19f458)[_0xc2f6('0x46')](function(_0x37456e){_0x19f458[_0xc2f6('0xc7')]-=_0x151645;_0x19f458[_0xc2f6('0xc7')]=_0x19f458[_0xc2f6('0xc7')]>0x0?_0x19f458[_0xc2f6('0xc7')]:0x0;if(!checkContactEmpty(_0x37456e)){_0x19f458[_0xc2f6('0x49')]=_0xc2f6('0x204');logger['info'](_0xc2f6('0x205')+_0x19f458[_0xc2f6('0x4b')]);}else{_0x19f458[_0xc2f6('0x7b')]+=_0x37456e['length'];_0x19f458['message']=_0xc2f6('0x206');for(var _0x540373=0x0;_0x540373<_0x37456e['length'];_0x540373+=0x1){_0x19f458[_0xc2f6('0x207')]+=0x1;if(_[_0xc2f6('0xb2')](_0x37456e[_0x540373])||_[_0xc2f6('0xb2')](_0x37456e[_0x540373][_0xc2f6('0x17d')])||_[_0xc2f6('0xb2')](_0x37456e[_0x540373]['Contact'][_0xc2f6('0x17c')])){_0x2ea9cf[_0xc2f6('0xd3')](_0xc2f6('0x208'),_0x19f458,_0x37456e[_0x540373]);}else{_0x2ea9cf[_0xc2f6('0xbf')](_[_0xc2f6('0xd6')](_0x37456e[_0x540373],['CampaignId','Contact.phone']))[_0xc2f6('0x46')](_0x2ea9cf[_0xc2f6('0x1f2')](_0x19f458,_0x37456e[_0x540373]))['catch'](_0x2ea9cf[_0xc2f6('0xd2')](_0xc2f6('0x209'),_0x19f458));}}}})[_0xc2f6('0xb4')](loggerGetContactDialer(_0xc2f6('0x20a'),_0x19f458,_0x151645));}};Dialer[_0xc2f6('0x20')]['handlePower']=function(_0x413b6a,_0xfece92){var _0x3e8cac=this;var _0x5e26f6=[];var _0x41b3f5=_0xfece92>=0x1?_0xfece92:0x1;if(_0x413b6a[_0xc2f6('0x163')]===_0xc2f6('0xb')){_0x41b3f5=0x1;}var _0x182ff3=Math['floor'](_0x413b6a[_0xc2f6('0x5a')]*_0x41b3f5)-_0x413b6a[_0xc2f6('0x7b')]-_0x413b6a[_0xc2f6('0xc7')];emitVoiceQueueSummary(_0x413b6a);if(_0x413b6a[_0xc2f6('0x20b')]>0x0){var _0x11365b=_0x413b6a[_0xc2f6('0x20b')]-_0x413b6a[_0xc2f6('0x7b')]-_0x413b6a[_0xc2f6('0x5f')]-_0x413b6a[_0xc2f6('0xc7')]-_0x413b6a['pTalking'];if(_0x182ff3>_0x11365b){_0x182ff3=_0x11365b;}}if(_0x182ff3>0x0){if(_0x413b6a['dialMethod']==='booked'){_0x182ff3=0x1;}if(_0x182ff3>this[_0xc2f6('0x29')]){_0x182ff3=this[_0xc2f6('0x29')];}_0x413b6a[_0xc2f6('0xc7')]+=_0x182ff3;for(var _0x2776a4 in this[_0xc2f6('0x28')]){if(typeof this['agents'][_0x2776a4]!==_0xc2f6('0x9e')){if(this[_0xc2f6('0x28')][_0x2776a4]['state']===_0xc2f6('0x20c')&&this['agents'][_0x2776a4][_0xc2f6('0xb3')]==='reachable'){_0x5e26f6[_0xc2f6('0x154')](this['agents'][_0x2776a4]['id']);}}}this['getContactDialer'](_0x413b6a['id'],_0x5e26f6,_0x182ff3,_0x413b6a[_0xc2f6('0x203')],_0x413b6a)['then'](function(_0x25715b){_0x413b6a[_0xc2f6('0xc7')]-=_0x182ff3;_0x413b6a[_0xc2f6('0xc7')]=_0x413b6a[_0xc2f6('0xc7')]>0x0?_0x413b6a['temp']:0x0;if(!checkContactEmpty(_0x25715b)){_0x3e8cac['countReScheduled'](_0x413b6a)[_0xc2f6('0x46')](sendMessageReschedule(_0x413b6a))[_0xc2f6('0xb4')](loggerCatch(_0xc2f6('0xbc')));}else{_0x413b6a['originated']+=_0x25715b[_0xc2f6('0x9d')];_0x413b6a['message']=_0x413b6a[_0xc2f6('0x163')]==='booked'?'ACTIVE':'RUNNING';for(var _0x1bccd7=0x0;_0x1bccd7<_0x25715b[_0xc2f6('0x9d')];_0x1bccd7+=0x1){if(_['isNil'](_0x25715b[_0x1bccd7])||_[_0xc2f6('0xb2')](_0x25715b[_0x1bccd7][_0xc2f6('0x17d')])||_['isNil'](_0x25715b[_0x1bccd7]['Contact'][_0xc2f6('0x17c')])){_0x3e8cac[_0xc2f6('0xd3')](_0xc2f6('0x208'),_0x413b6a,_0x25715b[_0x1bccd7]);}else{_0x3e8cac[_0xc2f6('0xbd')](_[_0xc2f6('0xd6')](_0x25715b[_0x1bccd7],[_0xc2f6('0xd8'),_0xc2f6('0x20d')]))[_0xc2f6('0x46')](_0x3e8cac[_0xc2f6('0x1f2')](_0x413b6a,_0x25715b[_0x1bccd7]))[_0xc2f6('0xb4')](_0x3e8cac[_0xc2f6('0xd2')](_0xc2f6('0x208'),_0x413b6a));}}}})[_0xc2f6('0xb4')](loggerGetContactDialer('[getContactDialer2]',_0x413b6a,_0x182ff3));}};Dialer[_0xc2f6('0x20')][_0xc2f6('0x97')]=function(_0x58c79f){if(_0x58c79f[_0xc2f6('0x20b')]>0x0){var _0x599506=_0x58c79f[_0xc2f6('0x20b')]-_0x58c79f['originated']-_0x58c79f['talking'];if(_0x599506>0x0){this[_0xc2f6('0x20e')](_0x58c79f);}else{loggerPredictiveCalls[_0xc2f6('0x86')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x58c79f);}};Dialer[_0xc2f6('0x20')]['tryOriginatePredictive']=function(_0x3ffe63){var _0x17ede6=this;var _0x2162d2=[];_0x3ffe63[_0xc2f6('0x7b')]+=0x1;for(var _0xda5577 in this[_0xc2f6('0x28')]){if(typeof this[_0xc2f6('0x28')][_0xda5577]!=='undefined'){if(this[_0xc2f6('0x28')][_0xda5577][_0xc2f6('0xab')]===_0xc2f6('0x20c')&&this['agents'][_0xda5577][_0xc2f6('0xb3')]===_0xc2f6('0xe0')){_0x2162d2[_0xc2f6('0x154')](this['agents'][_0xda5577]['id']);}}}this[_0xc2f6('0xc6')](_0x3ffe63['id'],_0x2162d2,0x1,_0x3ffe63[_0xc2f6('0x203')],_0x3ffe63)[_0xc2f6('0x46')](function(_0x5dea38){if(!checkContactEmpty(_0x5dea38)){checkContactLowerLimitOriginate(_0x3ffe63,0x1,0x0);_0x17ede6[_0xc2f6('0xba')](_0x3ffe63)[_0xc2f6('0x46')](sendMessageReschedule(_0x3ffe63))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3ffe63[_0xc2f6('0x49')]=_0xc2f6('0x206');if(_[_0xc2f6('0xb2')](_0x5dea38[0x0])||_[_0xc2f6('0xb2')](_0x5dea38[0x0]['Contact'])||_[_0xc2f6('0xb2')](_0x5dea38[0x0][_0xc2f6('0x17d')][_0xc2f6('0x17c')])){_0x17ede6[_0xc2f6('0xd3')](_0xc2f6('0x208'),_0x3ffe63,_0x5dea38[0x0]);}else{_0x17ede6[_0xc2f6('0xbd')](_[_0xc2f6('0xd6')](_0x5dea38[0x0],['VoiceQueueId','Contact.phone']))['then'](_0x17ede6[_0xc2f6('0x1f2')](_0x3ffe63,_0x5dea38[0x0]))[_0xc2f6('0xb4')](_0x17ede6[_0xc2f6('0xd2')](_0xc2f6('0x20f'),_0x3ffe63));}}})[_0xc2f6('0xb4')](loggerGetContactDialer(_0xc2f6('0x210'),_0x3ffe63,0x1));emitVoiceQueueSummary(_0x3ffe63);};Dialer[_0xc2f6('0x20')]['abandonmentRate']=function(_0x38b23f,_0x202195,_0x56b264,_0x224100,_0xf0cc8a,_0x4c8999){loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x211'));loggerPredictive[_0xc2f6('0x86')]('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',_0x38b23f);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x212'),_0x202195);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x213'),_0x56b264);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x214'),_0x224100);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x215'),_0xf0cc8a);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x216'));return new BPromise(function(_0x29c2ae,_0x3ad9d){if(_0x38b23f<=0x0||isNaN(_0x38b23f)){return _0x3ad9d(msgResponse(_0xc2f6('0x217'),_0xc2f6('0x53'),'m\x20=\x20'+_0x38b23f));}if(_0x56b264<=0x0||isNaN(_0x56b264)){return _0x3ad9d(msgResponse('[abandonmentRate]','Error',_0xc2f6('0x218')+_0x56b264));}if(_0x224100<=0x0||isNaN(_0x224100)){return _0x3ad9d(msgResponse('[abandonmentRate]',_0xc2f6('0x53'),_0xc2f6('0x219')+_0x224100));}if(_0x202195<=0x0||isNaN(_0x202195)){return _0x3ad9d(msgResponse(_0xc2f6('0x217'),_0xc2f6('0x53'),'interval\x20=\x20'+_0x202195));}if(_0xf0cc8a<=0x0||isNaN(_0xf0cc8a)){return _0x3ad9d(msgResponse(_0xc2f6('0x217'),_0xc2f6('0x53'),_0xc2f6('0x21a')+_0xf0cc8a));}_0x4c8999=_0x4c8999||0x0;var _0x4ede73=0x1/_0x56b264;var _0x4682d7=0x0;var _0x3443cf=0x0;var _0x243a63=0x0;var _0x28970a=0x0;for(var _0x346e44=0x0;_0x243a63<_0xf0cc8a;_0x346e44+=0x1){_0x3443cf=_0x346e44/_0x202195;_0x4682d7=(_0x224100*_0x3443cf+_0x4c8999)/_0x4ede73;_0x243a63=erlangb(_0x4682d7,_0x38b23f);_0x28970a=_0x4682d7/_0x38b23f*(0x1-erlangb(_0x4682d7,_0x38b23f));}return _0x29c2ae({'erlangCalls':_0x346e44,'erlangCallToSecond':_0x202195/_0x346e44,'erlangAbandonmentRate':_0x243a63,'erlangBusyFactor':_0x28970a});});};Dialer[_0xc2f6('0x20')][_0xc2f6('0x1e7')]=function(_0x362988,_0x1c446e,_0xa411bd,_0x459b49,_0x332a89,_0x4173ff){loggerPredictive['info'](_0xc2f6('0x21b'));loggerPredictive['info'](_0xc2f6('0x21c'),_0x362988);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x212'),_0x1c446e);loggerPredictive[_0xc2f6('0x86')]('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',_0xa411bd);loggerPredictive[_0xc2f6('0x86')]('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',_0x459b49);loggerPredictive[_0xc2f6('0x86')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x332a89);loggerPredictive[_0xc2f6('0x86')](_0xc2f6('0x216'));return new BPromise(function(_0x2f1de5,_0x1d2783){if(_0x362988<=0x0||isNaN(_0x362988)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),_0xc2f6('0x21e')+_0x362988));}if(_0xa411bd<=0x0||isNaN(_0xa411bd)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),_0xc2f6('0x218')+_0xa411bd));}if(_0x459b49<=0x0||isNaN(_0x459b49)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),_0xc2f6('0x219')+_0x459b49));}if(_0x1c446e<=0x0||isNaN(_0x1c446e)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),_0xc2f6('0x53'),'interval\x20=\x20'+_0x1c446e));}if(_0x332a89<=0x0||isNaN(_0x332a89)){return _0x1d2783(msgResponse(_0xc2f6('0x21d'),'Error','Umin\x20=\x20'+_0x332a89));}_0x4173ff=_0x4173ff||0x0;var _0x285e23=0x1/_0xa411bd;var _0x15f404=0x0;var _0x60f9cb=0x0;var _0x2ca6cb=0x0;var _0x2727a9=0x0;for(var _0x2fb724=0x0;_0x2727a9<_0x332a89;_0x2fb724+=0x1){_0x60f9cb=_0x2fb724/_0x1c446e;_0x15f404=(_0x459b49*_0x60f9cb+_0x4173ff)/_0x285e23;_0x2ca6cb=erlangb(_0x15f404,_0x362988);_0x2727a9=_0x15f404/_0x362988*(0x1-erlangb(_0x15f404,_0x362988));}return _0x2f1de5({'erlangCalls':_0x2fb724,'erlangCallToSecond':_0x1c446e/_0x2fb724,'erlangAbandonmentRate':_0x2ca6cb,'erlangBusyFactor':_0x2727a9});});};module[_0xc2f6('0x21f')]=Dialer; \ No newline at end of file +var _0xe892=['campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','uniqueId','[uniqueid]','[actions]','Action','channel','catch','No\x20such\x20channel','voiceQueues','[Dialer][checkChannel]','queue','updateOriginated','countReScheduled','resolve','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','isTrunkReachable','active','status','reachable','SIP/%s','saveInDb','createHistory','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countnoanswerretry','countagentrejectretry','reason\x2019\x20machine....','add','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','starttime','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','true','content','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','launchHandleIvr','pow','random','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','startMethodPredictive','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','voicePause','run','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[countReScheduled]\x20','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[busyFactor]','m\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/setting','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncOriginateResponse','hangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','type','outbound','strategy','answered','available','pTalking','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','format','ivr','campaign:ivr:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe892,0x19c));var _0x2e89=function(_0x50085b,_0x3c2827){_0x50085b=_0x50085b-0x0;var _0x426b50=_0xe892[_0x50085b];return _0x426b50;};'use strict';var util=require(_0x2e89('0x0'));var _=require(_0x2e89('0x1'));var BPromise=require(_0x2e89('0x2'));var uuid=require(_0x2e89('0x3'));var moment=require(_0x2e89('0x4'));var rr=require('rr');var md5=require(_0x2e89('0x5'));var Redis=require(_0x2e89('0x6'));var ut=require('../preview/util/util');var config=require(_0x2e89('0x7'));var logger=require(_0x2e89('0x8'))(_0x2e89('0x9'));var loggerBooked=require(_0x2e89('0x8'))('booked');var loggerPredictive=require(_0x2e89('0x8'))(_0x2e89('0xa'));var loggerPredictiveCalls=require(_0x2e89('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x2e89('0x8'))(_0x2e89('0xb'));var ami=require('../ami');config[_0x2e89('0xc')]=_[_0x2e89('0xd')](config[_0x2e89('0xc')],{'host':_0x2e89('0xe'),'port':0x18eb});var io=require(_0x2e89('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x2e89('0x10'));var cmHopperHistory=require(_0x2e89('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x2e89('0x12'));var Action=require(_0x2e89('0x13'));var History=require(_0x2e89('0x14'));var Final=require('./final');var AgentComplete=require(_0x2e89('0x15'));var QueueCallerAbandon=require(_0x2e89('0x16'));var Hangup=require(_0x2e89('0x17'));var ipAgi=process['env'][_0x2e89('0x18')]||_0x2e89('0x19');var strategy={'rrmemory':_0x2e89('0x1a'),'roundrobin':_0x2e89('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2e89('0x1c')][_0x2e89('0x1d')]=function(_0x48e8a6){this[_0x2e89('0x1e')]=this['tail']?this[_0x2e89('0x1e')][_0x2e89('0x1f')](_0x48e8a6):_0x48e8a6();};function Dialer(_0x40cffd,_0x2c9c9a){this[_0x2e89('0x20')]=new Sequence();this[_0x2e89('0x21')]=_0x2c9c9a;this['voiceQueues']=_0x40cffd['voiceQueues'];this[_0x2e89('0x22')]=_0x40cffd[_0x2e89('0x22')];this[_0x2e89('0x23')]=_0x40cffd[_0x2e89('0x23')];this[_0x2e89('0x24')]=_0x40cffd[_0x2e89('0x24')];this[_0x2e89('0x25')]=config[_0x2e89('0x25')]||0x2;this['channels']={};this[_0x2e89('0x26')]={};this[_0x2e89('0x27')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x2e89('0x28')]={};this[_0x2e89('0x29')]={};this[_0x2e89('0x2a')]={};this[_0x2e89('0x2b')]={};this[_0x2e89('0x2c')]={};ami['on'](_0x2e89('0x2d'),this[_0x2e89('0x2e')][_0x2e89('0x2f')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x2e89('0x2f')](this));ami['on']('originateresponse',this[_0x2e89('0x30')][_0x2e89('0x2f')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x2e89('0x2f')](this));ami['on'](_0x2e89('0x31'),this['syncHangup'][_0x2e89('0x2f')](this));ami['on']('newexten',this['syncNewExten'][_0x2e89('0x2f')](this));ami['on'](_0x2e89('0x32'),this[_0x2e89('0x33')][_0x2e89('0x2f')](this));ami['on'](_0x2e89('0x34'),this[_0x2e89('0x35')][_0x2e89('0x2f')](this));ami['on'](_0x2e89('0x36'),this['syncQueueStatusComplete'][_0x2e89('0x2f')](this));this[_0x2e89('0x37')]();this[_0x2e89('0x38')]();RpcSetting[_0x2e89('0x39')]()[_0x2e89('0x3a')](function(_0x890cbf){previewRecallmeReminderInterval=_0x890cbf[_0x2e89('0x3b')];});}function isNotNull(_0x1fe9ab){return _0x1fe9ab!==null&&!_[_0x2e89('0x3c')](_0x1fe9ab);}function checkIsLoggedIn(_0x191ad4,_0x3afe55){return function(){if(_0x3afe55<=0x0){_0x191ad4[_0x2e89('0x3d')]='AGENTS_NOT_LOGGED';throw _0x191ad4[_0x2e89('0x3e')]+_0x2e89('0x3f');}};}function isActive(_0x5ecf95){return _0x5ecf95;}function checkIsActive(_0x1c3153,_0x599180){return function(){if(!isActive(_0x599180)){_0x1c3153[_0x2e89('0x3d')]=_0x2e89('0x40');throw _0x1c3153['name']+_0x2e89('0x41');}};}function checkInterval(_0x3a3a75){return function(){if(!isNotNull(_0x3a3a75[_0x2e89('0x42')])){_0x3a3a75['message']=_0x2e89('0x43');throw _0x3a3a75[_0x2e89('0x3e')]+_0x2e89('0x44');}if(!isNotNull(_0x3a3a75[_0x2e89('0x42')][_0x2e89('0x45')])){_0x3a3a75[_0x2e89('0x3d')]='INTERVAL_IS_NULL';throw _0x3a3a75[_0x2e89('0x3e')]+_0x2e89('0x44');}if(!isNotNull(_[_0x2e89('0x46')](_0x3a3a75[_0x2e89('0x42')][_0x2e89('0x45')]))){_0x3a3a75[_0x2e89('0x3d')]=_0x2e89('0x43');throw _0x3a3a75['name']+_0x2e89('0x44');}};}function msgResponse(_0x5e0020,_0x526d04,_0x278200){return{'action':_0x5e0020,'response':_0x526d04,'message':_0x278200,'stack':_0x278200};}function myreject(_0x54a3a8){return function(_0x3c76da){return _0x54a3a8(msgResponse(_0x2e89('0x47'),_0x2e89('0x48'),JSON[_0x2e89('0x49')](_0x3c76da)));};}function getSeconds(_0x53d7c2,_0x27c882){var _0x3bcfaa=moment(_0x53d7c2)[_0x2e89('0x4a')](0x0);var _0x489de9=moment(_0x27c882)[_0x2e89('0x4a')](0x0);return _0x3bcfaa['diff'](_0x489de9,_0x2e89('0x4b'));}function emit(_0x3777ce,_0x3842e5,_0x52ee8c){io['to'](_0x3777ce)['emit'](_0x3842e5,_0x52ee8c);}function emitVoiceQueueSummary(_0x44269d){if(_0x44269d[_0x2e89('0x4c')]===_0x2e89('0x4d')){var _0x22f838={'id':_0x44269d['id'],'name':_0x44269d[_0x2e89('0x3e')],'strategy':_0x44269d[_0x2e89('0x4e')],'answered':_0x44269d[_0x2e89('0x4f')],'available':_0x44269d[_0x2e89('0x50')],'loggedIn':_0x44269d['loggedIn'],'pTalking':_0x44269d[_0x2e89('0x51')],'sumBillable':_0x44269d['sumBillable'],'sumDuration':_0x44269d['sumDuration'],'sumHoldTime':_0x44269d[_0x2e89('0x52')]||0x0,'talking':_0x44269d[_0x2e89('0x53')],'total':_0x44269d[_0x2e89('0x54')],'type':_0x44269d[_0x2e89('0x4c')],'unmanaged':_0x44269d[_0x2e89('0x55')],'abandoned':_0x44269d[_0x2e89('0x56')],'waiting':_0x44269d[_0x2e89('0x57')],'loggedInDb':_0x44269d[_0x2e89('0x58')],'dialActive':_0x44269d[_0x2e89('0x59')],'dialMethod':_0x44269d[_0x2e89('0x5a')],'dialOriginateCallerIdName':_0x44269d[_0x2e89('0x5b')],'dialOriginateCallerIdNumber':_0x44269d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x44269d['dialOriginateTimeout'],'dialPrefix':_0x44269d[_0x2e89('0x5c')],'outboundAnswerAgiCallsDay':_0x44269d[_0x2e89('0x5d')],'outboundAnswerCallsDay':_0x44269d[_0x2e89('0x5e')],'outboundBlacklistCallsDay':_0x44269d['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x44269d[_0x2e89('0x5f')],'outboundCongestionCallsDay':_0x44269d[_0x2e89('0x60')],'outboundDropCallsDayACS':_0x44269d[_0x2e89('0x61')],'outboundDropCallsDayCallersExit':_0x44269d[_0x2e89('0x62')],'outboundDropCallsDayTimeout':_0x44269d['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x44269d[_0x2e89('0x63')],'outboundNoSuchCallsDay':_0x44269d[_0x2e89('0x64')],'outboundOriginateFailureCallsDay':_0x44269d['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x44269d[_0x2e89('0x65')],'outboundRejectCallsDay':_0x44269d[_0x2e89('0x66')],'outboundUnknownCallsDay':_0x44269d[_0x2e89('0x67')],'predictiveIntervalAnsweredCalls':_0x44269d[_0x2e89('0x68')],'predictiveIntervalAvgHoldtime':_0x44269d['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x44269d[_0x2e89('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x44269d[_0x2e89('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x44269d[_0x2e89('0x6b')],'predictiveIntervalErlangCalls':_0x44269d[_0x2e89('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x44269d[_0x2e89('0x6d')],'predictiveIntervalHitRate':_0x44269d[_0x2e89('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x44269d[_0x2e89('0x6f')],'predictiveIntervalPauses':_0x44269d[_0x2e89('0x70')],'predictiveIntervalAvailable':_0x44269d[_0x2e89('0x71')],'predictiveIntervalTotalCalls':_0x44269d[_0x2e89('0x72')],'message':_0x44269d['message'],'originated':_0x44269d[_0x2e89('0x73')],'erlangCalls':_0x44269d['erlangCalls'],'erlangCallToSecond':_0x44269d['erlangCallToSecond'],'erlangAbandonmentRate':_0x44269d[_0x2e89('0x74')],'erlangBusyFactor':_0x44269d[_0x2e89('0x75')],'startPredictive':_0x44269d[_0x2e89('0x28')],'startProgressive':_0x44269d['startProgressive']};if(_0x44269d[_0x2e89('0x76')]){_0x22f838['Trunk']={'id':_0x44269d['Trunk']['id'],'name':_0x44269d[_0x2e89('0x76')][_0x2e89('0x3e')],'active':_0x44269d['Trunk']['active'],'callerid':_0x44269d[_0x2e89('0x76')]['callerid']};}if(_0x44269d['Interval']){_0x22f838[_0x2e89('0x42')]={'id':_0x44269d[_0x2e89('0x42')]['id'],'name':_0x44269d[_0x2e89('0x42')][_0x2e89('0x3e')]};}var _0x35116a=md5(JSON[_0x2e89('0x49')](_0x22f838));if(_0x44269d['md5']!==_0x35116a){_0x44269d[_0x2e89('0x5')]=_0x35116a;emit(util[_0x2e89('0x77')]('voice:queue:%s',_0x22f838[_0x2e89('0x3e')]),'voice_queue:save',_0x22f838);}}}function emitCampaignSummary(_0x11b073){if(_0x11b073[_0x2e89('0x4c')]===_0x2e89('0x78')){emit(util[_0x2e89('0x77')](_0x2e89('0x79'),_0x11b073[_0x2e89('0x3e')]),_0x2e89('0x7a'),_0x11b073);}}function checkGetDataPredictive(_0x213a52){if(isNotNull(_0x213a52)&&!_[_0x2e89('0x46')](_0x213a52)){loggerPredictive[_0x2e89('0x7b')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x7c'),_0x213a52[_0x2e89('0x72')]);loggerPredictive[_0x2e89('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x213a52[_0x2e89('0x68')]);loggerPredictive[_0x2e89('0x7b')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x213a52[_0x2e89('0x6b')]);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x7d'),_0x213a52[_0x2e89('0x6a')]);loggerPredictive['info'](_0x2e89('0x7e'),_0x213a52[_0x2e89('0x7f')]);loggerPredictive[_0x2e89('0x7b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x213a52['predictiveIntervalAvgTalktime']);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x80'));if(_0x213a52[_0x2e89('0x72')]>0x0){if(!_[_0x2e89('0x3c')](_0x213a52[_0x2e89('0x69')])&&_0x213a52['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x81'));if(!_[_0x2e89('0x3c')](_0x213a52[_0x2e89('0x7f')])&&_0x213a52['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x82'));}else{loggerPredictive['info'](_0x2e89('0x83'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x57b8ba){return function(_0x4faad4){loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x84'));loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x85'),_0x4faad4[_0x2e89('0x86')]);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x87'),_0x4faad4['erlangCallToSecond']);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x88'),_0x4faad4[_0x2e89('0x74')]);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x89'),_0x4faad4['erlangBusyFactor']);loggerPredictive['info'](_0x2e89('0x88'),_0x4faad4['erlangAbandonmentRate']);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x80'));_[_0x2e89('0x8a')](_0x57b8ba,_0x4faad4);};}function getDiff(_0x37bfa0){var _0x4df179=moment()[_0x2e89('0x4a')](0x0);var _0x7c8da5=moment(_0x37bfa0)[_0x2e89('0x4a')](0x0);return _0x4df179[_0x2e89('0x8b')](_0x7c8da5,_0x2e89('0x4b'));}function ifInterval(_0x180335,_0x3bf0d3){if(_[_0x2e89('0x3c')](_0x3bf0d3)){return![];}return getDiff(_0x3bf0d3)<_0x180335*0x3c;}function freeVariablesPredictive(_0x485e70){if(isNotNull(_0x485e70)){if(!_['isUndefined'](_0x485e70['startProgressive'])){_0x485e70[_0x2e89('0x29')]=undefined;loggerPredictive[_0x2e89('0x7b')](_0x485e70['name'],_0x2e89('0x8c'));}if(!_[_0x2e89('0x3c')](_0x485e70[_0x2e89('0x28')])){_0x485e70[_0x2e89('0x28')]=undefined;loggerPredictive[_0x2e89('0x7b')](_0x485e70['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x2e89('0x3c')](_0x485e70[_0x2e89('0x8d')])){clearInterval(_0x485e70[_0x2e89('0x8d')]);_0x485e70[_0x2e89('0x8d')]=undefined;loggerPredictive[_0x2e89('0x7b')](_0x485e70[_0x2e89('0x3e')],_0x2e89('0x8e'));}}}function erlangb(_0x1e3dba,_0xf7a69e){if(_0xf7a69e===0x0){return 0x0;}var _0x5b0b23=0x1;for(var _0x14dcc3=0x1;_0x14dcc3<=_0xf7a69e;_0x14dcc3+=0x1){_0x5b0b23=0x1+_0x5b0b23*_0x14dcc3/_0x1e3dba;}return 0x1/_0x5b0b23;}function isVoiceQueueOutbound(_0x2c3cdf){return _0x2c3cdf===_0x2e89('0x4d');}function isNotPreview(_0x4e0344){return _0x4e0344!==_0x2e89('0x21');}function isCampaignIvr(_0x27821a){return _0x27821a===_0x2e89('0x78');}function getCallerId(_0x1cb167,_0x3ab511,_0x407bcb){if(!_[_0x2e89('0x3c')](_0x407bcb)&&typeof _0x407bcb===_0x2e89('0x8f')&&!_[_0x2e89('0x46')](_0x407bcb)){if(!_[_0x2e89('0x3c')](_0x3ab511)&&typeof _0x3ab511===_0x2e89('0x8f')&&!_[_0x2e89('0x46')](_0x3ab511)){return util[_0x2e89('0x77')](_0x2e89('0x90'),_0x3ab511,_0x407bcb);}return util[_0x2e89('0x77')](_0x2e89('0x90'),_0x407bcb,_0x407bcb);}if(!_[_0x2e89('0x3c')](_0x1cb167)&&typeof _0x1cb167===_0x2e89('0x8f')&&!_[_0x2e89('0x46')](_0x1cb167)){return _0x1cb167;}return _0x2e89('0x91');}function loggerCatchQueueSummary(_0x5ba16e,_0x3944dd){return function(_0x4255b5){freeVariablesPredictive(_0x3944dd);emitVoiceQueueSummary(_0x3944dd);emitCampaignSummary(_0x3944dd);loggerSyncQueueSummary['error'](_0x5ba16e,util[_0x2e89('0x92')](_0x4255b5,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xa847ec,_0x3078d3){return function(_0x385844){loggerPredictive[_0x2e89('0x93')](_0x3078d3[_0x2e89('0x3e')],_0xa847ec);loggerPredictive[_0x2e89('0x93')](_0x385844[_0x2e89('0x94')]);freeVariablesPredictive(_0x3078d3);};}function loggerCatch(_0x37f884){return function(_0x40502e){logger[_0x2e89('0x93')](_0x37f884,util[_0x2e89('0x92')](_0x40502e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4d38e2){return _0x4d38e2&&!_[_0x2e89('0x3c')](_0x4d38e2)&&_0x4d38e2[_0x2e89('0x95')]>0x0;}function decremetOriginate(_0x30de9a){if(!_[_0x2e89('0x3c')](_0x30de9a)&&_0x30de9a!==null){if(typeof _0x30de9a['originated']!==_0x2e89('0x96')){if(_0x30de9a[_0x2e89('0x73')]>0x0){_0x30de9a[_0x2e89('0x73')]-=0x1;}else{logger['error'](_0x2e89('0x97'));}}}else{logger[_0x2e89('0x93')](_0x2e89('0x98'));}}function checkContactLowerLimitOriginate(_0x1faf7a,_0x4b21d4,_0x3e7eb6){if(_0x4b21d4>_0x3e7eb6){for(var _0x5adc98=0x0;_0x5adc98<_0x4b21d4-_0x3e7eb6;_0x5adc98+=0x1){decremetOriginate(_0x1faf7a);}}}function loggerGetContactDialer(_0x2aa820,_0x421513,_0x40c752){return function(_0x258985){checkContactLowerLimitOriginate(_0x421513,_0x40c752,0x0);logger[_0x2e89('0x93')](_0x2aa820,util[_0x2e89('0x92')](_0x258985,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3eccc4){return function(_0x7124a6){if(isNotNull(_0x7124a6)&&isNotNull(_0x7124a6[0x0])){if(_0x7124a6[0x0][_0x2e89('0x99')]>0x0){_0x3eccc4[_0x2e89('0x3d')]='RESCHEDULED_CONTACTS';logger[_0x2e89('0x7b')]('[getContactDialer2][ReScheduled]'+_0x3eccc4[_0x2e89('0x3e')],_0x7124a6[0x0][_0x2e89('0x99')],_0x2e89('0x9a'));}else{_0x3eccc4['message']=_0x2e89('0x9b');logger[_0x2e89('0x7b')](_0x2e89('0x9c')+_0x3eccc4['name']);}}};}function notSendMessagesQueue(_0x5a61b3){if(_0x5a61b3['sendMessageOneNotActive']){freeVariablesPredictive(_0x5a61b3);if(_0x5a61b3[_0x2e89('0x73')]===0x0&&_0x5a61b3[_0x2e89('0x53')]===0x0&&_0x5a61b3[_0x2e89('0x57')]===0x0&&(_0x5a61b3[_0x2e89('0x51')]||0x0)===0x0){_0x5a61b3[_0x2e89('0x9d')]=![];_0x5a61b3[_0x2e89('0x50')]=0x0;_0x5a61b3['message']=_0x2e89('0x40');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5a61b3['name'],_0x2e89('0x9e'));}else{_0x5a61b3['message']=_0x2e89('0x9f');loggerSyncQueueSummary[_0x2e89('0x93')](_0x2e89('0xa0'),_0x5a61b3[_0x2e89('0x3e')],_0x2e89('0xa1'));}emitVoiceQueueSummary(_0x5a61b3);}}function notSendMessagesCampaign(_0x5323d4){if(_0x5323d4[_0x2e89('0x9d')]){if(_0x5323d4[_0x2e89('0x73')]===0x0){_0x5323d4[_0x2e89('0x9d')]=![];_0x5323d4[_0x2e89('0x3d')]=_0x2e89('0x40');loggerSyncQueueSummary[_0x2e89('0x93')](_0x2e89('0xa2'),_0x5323d4[_0x2e89('0x3e')],'is\x20not\x20active');}else{_0x5323d4[_0x2e89('0x3d')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x2e89('0x93')](_0x2e89('0xa2'),_0x5323d4[_0x2e89('0x3e')],'is\x20disactive');}emitCampaignSummary(_0x5323d4);}}function createObjHistory(_0x3598f9,_0x21243e,_0x3629f8,_0x100743,_0x5cb559){_0x3598f9[_0x2e89('0x3d')]=_0x3629f8;var _0x4cb502=new Action(_0x3598f9,_0x21243e);var _0x4744e3=new History(_0x4cb502);_0x4744e3[_0x2e89('0xa3')]=_0x100743;_0x4744e3[_0x2e89('0xa4')]=_0x5cb559;_0x4744e3[_0x2e89('0xa5')]=_0x4cb502['starttime'];return _0x4744e3;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x25e741=this;setInterval(function(){_0x25e741[_0x2e89('0xa6')](_0x25e741[_0x2e89('0xa7')],_0x2e89('0xa8'));_0x25e741[_0x2e89('0xa6')](_0x25e741['actions'],_0x2e89('0xa9'));},0x32c8);};Dialer[_0x2e89('0x1c')]['clearZombieChannels']=function(_0x2899f9,_0x43ea46){var _0x1cb1c0=this;for(var _0x1c7052 in _0x2899f9){if(typeof _0x2899f9[_0x1c7052]!==_0x2e89('0x96')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x2899f9[_0x1c7052])){return ami[_0x2e89('0xaa')]({'action':'status','channel':_0x2899f9[_0x1c7052][_0x2e89('0xab')]})[_0x2e89('0xac')](function(_0xb344f1){if(_0xb344f1[_0x2e89('0x3d')]===_0x2e89('0xad')){setTimeout(function(){if(_0x2899f9[_0x1c7052]&&_0x2899f9[_0x1c7052][_0x2e89('0x4c')]!=='ivr'){_0x1cb1c0['updateOriginated'](_0x1cb1c0[_0x2e89('0xae')][_0x2899f9[_0x1c7052]['queue']]);logger[_0x2e89('0x93')](_0x2e89('0xaf'),_0x43ea46,_0x1c7052,_0x2899f9[_0x1c7052][_0x2e89('0xb0')]);delete _0x2899f9[_0x1c7052];}if(_0x2899f9[_0x1c7052]&&_0x2899f9[_0x1c7052][_0x2e89('0x4c')]===_0x2e89('0x78')){_0x1cb1c0[_0x2e89('0xb1')](_0x1cb1c0['campaigns'][_0x2899f9[_0x1c7052][_0x2e89('0xb0')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x43ea46,_0x1c7052,_0x2899f9[_0x1c7052][_0x2e89('0xb0')]);delete _0x2899f9[_0x1c7052];}},0x2328);}});}});}}};Dialer[_0x2e89('0x1c')][_0x2e89('0xb2')]=function(_0x5db95d){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopper[_0x2e89('0xb2')](_0x5db95d))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x2e89('0x1c')][_0x2e89('0xb4')]=function(_0x16fa4b){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopperBlack[_0x2e89('0xb4')](_0x16fa4b))[_0x2e89('0xac')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x2e89('0x1c')][_0x2e89('0xb5')]=function(_0x2f623f){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopperBlack[_0x2e89('0xb5')](_0x2f623f))[_0x2e89('0xac')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x2e89('0xb6')]=function(_0x79132c){return BPromise[_0x2e89('0xb3')]()['then'](cmHopperHistory[_0x2e89('0xb7')](_0x79132c))['catch'](loggerCatch(_0x2e89('0xb8')));};Dialer['prototype'][_0x2e89('0xb9')]=function(_0x6c92da){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopper[_0x2e89('0xb9')](_0x6c92da))[_0x2e89('0xac')](loggerCatch(_0x2e89('0xba')));};Dialer['prototype'][_0x2e89('0xbb')]=function(_0x5749bd,_0x57649f,_0x293718){return BPromise['resolve']()[_0x2e89('0x3a')](cmHopper[_0x2e89('0xbb')](_0x5749bd,_0x57649f,_0x293718))[_0x2e89('0xac')](loggerCatch(_0x2e89('0xbc')));};Dialer['prototype'][_0x2e89('0xbd')]=function(_0x6dc26d,_0x41ada7,_0x4a3489,_0x3027dc,_0x595779){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopper[_0x2e89('0xbd')](_0x6dc26d,_0x41ada7,_0x4a3489,_0x3027dc))[_0x2e89('0xac')](function(_0x158c8c){_0x595779[_0x2e89('0xbe')]-=_0x4a3489;_0x595779[_0x2e89('0xbe')]=_0x595779[_0x2e89('0xbe')]>0x0?_0x595779[_0x2e89('0xbe')]:0x0;loggerCatch(_0x2e89('0xbf'))(_0x158c8c);});};Dialer[_0x2e89('0x1c')]['getContactDialerIvr']=function(_0x1f1a23,_0x2b015b,_0x4321b3,_0x57d141){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopper['getContactDialerIvr'](_0x1f1a23,_0x2b015b,_0x4321b3))[_0x2e89('0xac')](function(_0x105fab){_0x57d141[_0x2e89('0xbe')]-=_0x2b015b;_0x57d141[_0x2e89('0xbe')]=_0x57d141[_0x2e89('0xbe')]>0x0?_0x57d141[_0x2e89('0xbe')]:0x0;loggerCatch(_0x2e89('0xc0'))(_0x105fab);});};Dialer[_0x2e89('0x1c')][_0x2e89('0xc1')]=function(_0x1acab8){return BPromise[_0x2e89('0xb3')]()['then'](voiceQueueRt[_0x2e89('0xc1')](_0x1acab8))[_0x2e89('0xac')](loggerCatch(_0x2e89('0xc2')));};Dialer[_0x2e89('0x1c')][_0x2e89('0xc3')]=function(_0x5a84cf){return BPromise['resolve']()[_0x2e89('0x3a')](cmHopper[_0x2e89('0xc3')](_0x5a84cf))[_0x2e89('0xac')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x2e89('0x1c')]['createHistory']=function(_0x1e51c7){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopperHistory['createHistory'](_0x1e51c7))['catch'](loggerCatch(_0x2e89('0xc4')));};Dialer[_0x2e89('0x1c')][_0x2e89('0xb1')]=function(_0x408f19){if(!_['isUndefined'](_0x408f19)&&_0x408f19!==null){if(typeof _0x408f19[_0x2e89('0x73')]!=='undefined'){if(_0x408f19['originated']>0x0){_0x408f19[_0x2e89('0x73')]-=0x1;}else{logger[_0x2e89('0x93')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2e89('0x93')](_0x2e89('0xc5'));}};Dialer[_0x2e89('0x1c')][_0x2e89('0xc6')]=function(_0x29abc9,_0x54e601){var _0x1856c1=this;return function(_0x3118e7){_0x1856c1[_0x2e89('0xb1')](_0x54e601);logger[_0x2e89('0x93')](_0x29abc9,util[_0x2e89('0x92')](_0x3118e7,{'showHidden':![],'depth':null}));};};Dialer[_0x2e89('0x1c')][_0x2e89('0xc7')]=function(_0x4fc1e0,_0x3df300,_0x388f0e){var _0x5a161d={'state':0x19,'statedesc':_0x2e89('0xc8')};this[_0x2e89('0xb1')](_0x3df300);this['saveInDb'](_[_0x2e89('0x8a')](_0x5a161d,_[_0x2e89('0xc9')](_0x388f0e,['ContactId',_0x2e89('0xca'),_0x2e89('0xcb'),_0x2e89('0xcc'),_0x2e89('0xcd')])),_0x2e89('0xce'),'[emptyContact]');logger[_0x2e89('0x93')](_0x4fc1e0);};Dialer[_0x2e89('0x1c')]['isSuccess']=function(_0x341b09){return _0x341b09===_0x2e89('0xcf');};Dialer[_0x2e89('0x1c')][_0x2e89('0xd0')]=function(_0x3c5678){return!_['isUndefined'](_0x3c5678)&&_0x3c5678&&!_['isUndefined'](_0x3c5678[_0x2e89('0x3e')])&&!_[_0x2e89('0x3c')](_0x3c5678[_0x2e89('0xd1')])&&_0x3c5678[_0x2e89('0xd1')]&&(this[_0x2e89('0x24')][util['format']('SIP/%s',_0x3c5678[_0x2e89('0x3e')])][_0x2e89('0xd2')]===_0x2e89('0xd3')||this['trunks'][util['format'](_0x2e89('0xd4'),_0x3c5678['name'])][_0x2e89('0xd2')]==='unmonitored');};Dialer[_0x2e89('0x1c')][_0x2e89('0xd5')]=function(_0x1e4b12,_0x32553b,_0x4a8d84){this[_0x2e89('0xd6')](_0x1e4b12)[_0x2e89('0xac')](loggerCatch(_0x32553b));this[_0x2e89('0xc3')](_0x1e4b12)['catch'](loggerCatch(_0x4a8d84));};Dialer[_0x2e89('0x1c')][_0x2e89('0x33')]=function(_0x5ba5ea){var _0x3be75b=this[_0x2e89('0xa7')][_0x5ba5ea[_0x2e89('0xd7')]];var _0xe44e39;if(!_[_0x2e89('0xd8')](_0x5ba5ea)&&!_[_0x2e89('0xd8')](_0x5ba5ea[_0x2e89('0xd9')])&&!_[_0x2e89('0xd8')](_0x5ba5ea['variable'][_0x2e89('0xda')])&&_0x5ba5ea[_0x2e89('0xdb')]===_0x2e89('0xdc')&&_0x3be75b){if(_0x3be75b[_0x2e89('0x4c')]!==_0x2e89('0x78')&&this[_0x2e89('0xae')][_0x3be75b[_0x2e89('0xb0')]]['dialAMDActive']&&_0x5ba5ea[_0x2e89('0xdd')]===_0x2e89('0xde')){delete this[_0x2e89('0xa7')][_0x5ba5ea[_0x2e89('0xd7')]];this[_0x2e89('0xb1')](this[_0x2e89('0xae')][_0x3be75b[_0x2e89('0xb0')]]);this[_0x2e89('0xae')][_0x3be75b['queue']][_0x2e89('0x5e')]+=0x1;this['voiceQueues'][_0x3be75b[_0x2e89('0xb0')]][_0x2e89('0x5d')]+=0x1;_0xe44e39=new Hangup(_0x3be75b,_0x5ba5ea);_0xe44e39[_0x2e89('0xa3')]=0x12;_0xe44e39[_0x2e89('0xa4')]=_0x2e89('0xdf');_0xe44e39[_0x2e89('0xe0')]='AMD';ami[_0x2e89('0xe1')](_0x2e89('0xe2'),ut[_0x2e89('0xe3')](_0xe44e39,_0x2e89('0xe4')));this[_0x2e89('0xd5')](_0xe44e39,_0x2e89('0xe5'),_0x2e89('0xe6'));}if(_0x3be75b['type']!==_0x2e89('0x78')&&this['voiceQueues'][_0x3be75b[_0x2e89('0xb0')]][_0x2e89('0xe7')]&&_0x5ba5ea[_0x2e89('0xdd')]===_0x2e89('0xe8')){var _0x479803=this;return new BPromise(function(_0x3718db,_0xff30b2){delete _0x479803[_0x2e89('0xa7')][_0x5ba5ea[_0x2e89('0xd7')]];_0x479803[_0x2e89('0xb1')](_0x479803['voiceQueues'][_0x3be75b[_0x2e89('0xb0')]]);_0x479803['voiceQueues'][_0x3be75b[_0x2e89('0xb0')]][_0x2e89('0x5e')]+=0x1;_0x479803[_0x2e89('0xae')][_0x3be75b[_0x2e89('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x13e0f6=_0x479803[_0x2e89('0xae')][_0x3be75b[_0x2e89('0xb0')]];var _0x3e65e1=new Hangup(_0x3be75b,_0x5ba5ea);_0x3e65e1[_0x2e89('0xa3')]=0x13;_0x3e65e1[_0x2e89('0xa4')]=_0x2e89('0xe9');_0x3e65e1[_0x2e89('0xe0')]=_0x2e89('0xea');_0x3e65e1[_0x2e89('0xeb')]+=0x1;_0x3e65e1[_0x2e89('0xec')]+=0x1;_0x3e65e1['amd']=!![];ami[_0x2e89('0xe1')](_0x2e89('0xe2'),ut['buildObj'](_0x3e65e1,'amd'));_0x479803['createHistory'](_0x3e65e1)[_0x2e89('0xac')](loggerCatch(_0x2e89('0xed')));if(_0x3e65e1[_0x2e89('0xee')]+_0x3e65e1[_0x2e89('0xef')]+_0x3e65e1['countnoanswerretry']+_0x3e65e1[_0x2e89('0xf0')]+_0x3e65e1[_0x2e89('0xf1')]+_0x3e65e1['countabandonedretry']+_0x3e65e1[_0x2e89('0xeb')]+_0x3e65e1['countagentrejectretry']>=_0x13e0f6[_0x2e89('0xf2')]){_0x479803[_0x2e89('0xf3')](_0x3e65e1,_0x3718db,_0xff30b2,_0x2e89('0xf4'));}else{if(_0x3e65e1[_0x2e89('0xeb')]>=_0x13e0f6[_0x2e89('0xf5')]){_0x479803[_0x2e89('0xf6')](_0x3e65e1,_0x3718db,_0xff30b2,'reason\x2019\x20machine....');}else{_0x479803[_0x2e89('0xb9')]({'active':![],'countmachineretry':_0x3e65e1[_0x2e89('0xeb')],'scheduledat':moment()['add'](_0x13e0f6[_0x2e89('0xf7')],_0x2e89('0xf8'))[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x3e65e1[_0x2e89('0xfa')],'ListId':_0x3e65e1['ListId'],'VoiceQueueId':_0x3e65e1[_0x2e89('0xcc')]||undefined,'CampaignId':_0x3e65e1[_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0xfb')));_0x3718db({'reschedule':0x1});}}});}if(_0x3be75b[_0x2e89('0x4c')]===_0x2e89('0x78')&&this[_0x2e89('0x22')][_0x3be75b['queue']]['dialAMDActive']&&_0x5ba5ea['value']==='HANGUP'){delete this[_0x2e89('0xa7')][_0x5ba5ea[_0x2e89('0xd7')]];this[_0x2e89('0xb1')](this['campaigns'][_0x3be75b['queue']]);_0xe44e39=new Hangup(_0x3be75b,_0x5ba5ea);_0xe44e39[_0x2e89('0xa3')]=0x12;_0xe44e39['statedesc']=_0x2e89('0xdf');_0xe44e39[_0x2e89('0xe0')]=_0x2e89('0xea');ami[_0x2e89('0xe1')](_0x2e89('0xe2'),ut[_0x2e89('0xe3')](_0xe44e39,'amd'));this[_0x2e89('0xd5')](_0xe44e39,'[syncHangupInAMDIvr][createHistory]',_0x2e89('0xfc'));}if(_0x3be75b[_0x2e89('0x4c')]==='ivr'&&this[_0x2e89('0x22')][_0x3be75b[_0x2e89('0xb0')]][_0x2e89('0xe7')]&&_0x5ba5ea[_0x2e89('0xdd')]==='MACHINE'){var _0x479803=this;return new BPromise(function(_0x2e3063,_0x495488){delete _0x479803[_0x2e89('0xa7')][_0x5ba5ea['uniqueid']];_0x479803['updateOriginated'](_0x479803['campaigns'][_0x3be75b['queue']]);_0x479803[_0x2e89('0x22')][_0x3be75b[_0x2e89('0xb0')]][_0x2e89('0x5e')]+=0x1;_0x479803['campaigns'][_0x3be75b[_0x2e89('0xb0')]][_0x2e89('0x5d')]+=0x1;var _0x4d506a=_0x479803['campaigns'][_0x3be75b[_0x2e89('0xb0')]];var _0x4272ca=new Hangup(_0x3be75b,_0x5ba5ea);_0x4272ca['state']=0x13;_0x4272ca[_0x2e89('0xa4')]='Machine';_0x4272ca['membername']=_0x2e89('0xea');_0x4272ca['countmachineretry']+=0x1;_0x4272ca['countglobal']+=0x1;_0x4272ca[_0x2e89('0xe4')]=!![];ami[_0x2e89('0xe1')](_0x2e89('0xe2'),ut['buildObj'](_0x4272ca,'amd'));_0x479803[_0x2e89('0xd6')](_0x4272ca)[_0x2e89('0xac')](loggerCatch(_0x2e89('0xed')));if(_0x4272ca[_0x2e89('0xee')]+_0x4272ca['countcongestionretry']+_0x4272ca[_0x2e89('0xfd')]+_0x4272ca[_0x2e89('0xf0')]+_0x4272ca[_0x2e89('0xf1')]+_0x4272ca['countabandonedretry']+_0x4272ca[_0x2e89('0xeb')]+_0x4272ca[_0x2e89('0xfe')]>=_0x4d506a[_0x2e89('0xf2')]){_0x479803[_0x2e89('0xf3')](_0x4272ca,_0x2e3063,_0x495488,_0x2e89('0xf4'));}else{if(_0x4272ca[_0x2e89('0xeb')]>=_0x4d506a['dialMachineMaxRetry']){_0x479803['createStateFinal'](_0x4272ca,_0x2e3063,_0x495488,_0x2e89('0xff'));}else{_0x479803[_0x2e89('0xb9')]({'active':![],'countmachineretry':_0x4272ca[_0x2e89('0xeb')],'scheduledat':moment()[_0x2e89('0x100')](_0x4d506a['dialMachineRetryFrequency'],_0x2e89('0xf8'))[_0x2e89('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4272ca[_0x2e89('0xfa')],'ListId':_0x4272ca[_0x2e89('0xca')],'VoiceQueueId':_0x4272ca['VoiceQueueId']||undefined,'CampaignId':_0x4272ca[_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x2e3063({'reschedule':0x1});}}});}}};Dialer[_0x2e89('0x1c')]['syncHangup']=function(_0x17da9a){var _0x23cadf=this[_0x2e89('0xa7')][_0x17da9a[_0x2e89('0xd7')]];var _0x139ad9=this;var _0x4320b4;if(_0x23cadf&&_0x23cadf[_0x2e89('0x4c')]===_0x2e89('0x78')){delete this[_0x2e89('0xa7')][_0x17da9a[_0x2e89('0xd7')]];this['updateOriginated'](this[_0x2e89('0x22')][_0x23cadf[_0x2e89('0xb0')]]);this['campaigns'][_0x23cadf[_0x2e89('0xb0')]][_0x2e89('0x101')]+=0x1;_0x4320b4=new Hangup(_0x23cadf,_0x17da9a);this[_0x2e89('0xd6')](_0x4320b4)[_0x2e89('0xac')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2e89('0xc3')](_0x4320b4)['catch'](loggerCatch(_0x2e89('0x102')));}if(_0x23cadf&&_0x23cadf['type']!==_0x2e89('0x78')&&isNotNull(this[_0x2e89('0xae')][_0x23cadf[_0x2e89('0xb0')]][_0x2e89('0x103')])){delete this[_0x2e89('0xa7')][_0x17da9a['uniqueid']];this['updateOriginated'](this[_0x2e89('0xae')][_0x23cadf[_0x2e89('0xb0')]]);this[_0x2e89('0xae')][_0x23cadf[_0x2e89('0xb0')]][_0x2e89('0x5e')]+=0x1;this[_0x2e89('0xae')][_0x23cadf[_0x2e89('0xb0')]][_0x2e89('0x5d')]+=0x1;_0x4320b4=new Hangup(_0x23cadf,_0x17da9a);_0x4320b4[_0x2e89('0xa3')]=0x10;_0x4320b4[_0x2e89('0xa4')]=_0x2e89('0x104');_0x4320b4[_0x2e89('0xe0')]=_0x2e89('0x105');this['createHistory'](_0x4320b4)['catch'](loggerCatch(_0x2e89('0x106')));this[_0x2e89('0xc3')](_0x4320b4)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x102')));}if(_0x23cadf&&_0x23cadf[_0x2e89('0x4c')]!=='ivr'&&!isNotNull(this[_0x2e89('0xae')][_0x23cadf[_0x2e89('0xb0')]][_0x2e89('0x103')])){delete this['uniqueId'][_0x17da9a[_0x2e89('0xd7')]];this[_0x2e89('0xb1')](this[_0x2e89('0xae')][_0x23cadf['queue']]);this['voiceQueues'][_0x23cadf['queue']]['outboundUnknownCallsDay']+=0x1;_0x4320b4=new Hangup(_0x23cadf,_0x17da9a);_0x4320b4['state']=0xc;_0x4320b4[_0x2e89('0xa4')]=_0x17da9a[_0x2e89('0x107')];_0x4320b4[_0x2e89('0xe0')]=_0x2e89('0x108');this[_0x2e89('0xd6')](_0x4320b4)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x106')));this[_0x2e89('0xc3')](_0x4320b4)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x102')));}};Dialer[_0x2e89('0x1c')][_0x2e89('0x109')]=function(_0x418f34){var _0x184c93=this[_0x2e89('0xa7')][_0x418f34[_0x2e89('0xd7')]];var _0x215e5a=this;if(this[_0x2e89('0xae')][_0x418f34[_0x2e89('0xb0')]]){if(_0x184c93&&_0x184c93['type']!==_0x2e89('0x78')){delete this[_0x2e89('0xa7')][_0x418f34[_0x2e89('0xd7')]];this[_0x2e89('0xae')][_0x418f34[_0x2e89('0xb0')]][_0x2e89('0x5e')]+=0x1;var _0x35f590=new AgentComplete(_0x184c93,_0x418f34);if(_0x418f34[_0x2e89('0x10a')]===_0x2e89('0x10b')){_0x35f590[_0x2e89('0x10c')]=this[_0x2e89('0xae')][_0x418f34[_0x2e89('0xb0')]][_0x2e89('0x10d')]&&this[_0x2e89('0xae')][_0x418f34[_0x2e89('0xb0')]]['dialAgiAfterHangupAgent']?moment()[_0x2e89('0x77')](_0x2e89('0xf9')):undefined;}this[_0x2e89('0xd6')](_0x35f590)['catch'](loggerCatch(_0x2e89('0x10e')));this[_0x2e89('0xc3')](_0x35f590)[_0x2e89('0xac')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x2e89('0x2e')]=function(_0x4307dd){if(this['voiceQueues'][_0x4307dd['queue']]){if(this[_0x2e89('0xa7')][_0x4307dd[_0x2e89('0xd7')]]&&this['uniqueId'][_0x4307dd['uniqueid']][_0x2e89('0x4c')]!=='ivr'){this['updateOriginated'](this[_0x2e89('0xae')][_0x4307dd[_0x2e89('0xb0')]]);this[_0x2e89('0xa7')][_0x4307dd[_0x2e89('0xd7')]][_0x2e89('0x10f')]=moment()['format'](_0x2e89('0xf9'));}}};Dialer[_0x2e89('0x1c')][_0x2e89('0x110')]=function(_0x3d5f6b){this['createHistory'](_0x3d5f6b)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x10e')));this['moveContactManagedDialer'](_0x3d5f6b)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x111')));};Dialer[_0x2e89('0x1c')][_0x2e89('0x112')]=function(_0x37bc10){var _0x693b5d=this['uniqueId'][_0x37bc10['uniqueid']];var _0x17c335=this;if(this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]]){if(_0x693b5d&&_0x693b5d[_0x2e89('0x4c')]!==_0x2e89('0x78')){delete this['uniqueId'][_0x37bc10['uniqueid']];this[_0x2e89('0xb1')](this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]]);_0x693b5d[_0x2e89('0x113')]=moment()[_0x2e89('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1156ef=new QueueCallerAbandon(_0x693b5d,_0x37bc10);if(getSeconds(_0x693b5d['droptime'],_0x693b5d[_0x2e89('0x114')])>=_0x693b5d[_0x2e89('0x115')]){this['voiceQueues'][_0x37bc10['queue']][_0x2e89('0x6b')]+=0x1;this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]][_0x2e89('0x116')]+=0x1;this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]][_0x2e89('0x6d')]+=0x1;_0x1156ef[_0x2e89('0xa3')]=0xa;_0x1156ef[_0x2e89('0xa4')]='Drop';_0x1156ef[_0x2e89('0x117')]=_0x2e89('0x118');_0x1156ef[_0x2e89('0x10c')]=this[_0x2e89('0xae')][_0x37bc10['queue']][_0x2e89('0x10d')]?moment()[_0x2e89('0x77')](_0x2e89('0xf9')):undefined;_0x1156ef[_0x2e89('0xf1')]+=0x1;_0x1156ef[_0x2e89('0xec')]+=0x1;if(_0x1156ef['countdropretry']>=this['voiceQueues'][_0x37bc10[_0x2e89('0xb0')]][_0x2e89('0x119')]){this[_0x2e89('0x110')](_0x1156ef);}else{this[_0x2e89('0xb9')]({'active':![],'countdropretry':_0x1156ef['countdropretry'],'scheduledat':moment()[_0x2e89('0x100')](this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]][_0x2e89('0x11a')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x693b5d[_0x2e89('0xfa')],'ListId':_0x693b5d['ListId'],'VoiceQueueId':_0x693b5d[_0x2e89('0xcc')]||undefined,'CampaignId':_0x693b5d[_0x2e89('0xcd')]||undefined})['catch'](loggerCatch(_0x2e89('0x11b')));var _0x288de1=new History(_0x1156ef);_0x288de1[_0x2e89('0xa3')]=0xa;_0x288de1['statedesc']='Drop';_0x288de1['starttime']=moment()[_0x2e89('0x77')](_0x2e89('0xf9'));_0x288de1['endtime']=_0x288de1['starttime'];_0x288de1[_0x2e89('0x11c')]=_0x1156ef['calleridname'];_0x288de1[_0x2e89('0x11d')]=_0x1156ef[_0x2e89('0x11d')];this['createHistory'](_0x288de1)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x11e')));}}else{this['voiceQueues'][_0x37bc10['queue']][_0x2e89('0x6a')]+=0x1;this[_0x2e89('0xae')][_0x37bc10['queue']][_0x2e89('0x62')]+=0x1;_0x1156ef[_0x2e89('0xa3')]=0xb;_0x1156ef[_0x2e89('0xa4')]=_0x2e89('0x11f');_0x1156ef[_0x2e89('0x117')]=_0x2e89('0x120');_0x1156ef[_0x2e89('0x121')]+=0x1;_0x1156ef[_0x2e89('0xec')]+=0x1;if(_0x1156ef[_0x2e89('0x121')]>=this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x1156ef);}else{this[_0x2e89('0xb9')]({'active':![],'countabandonedretry':_0x1156ef[_0x2e89('0x121')],'scheduledat':moment()[_0x2e89('0x100')](this[_0x2e89('0xae')][_0x37bc10[_0x2e89('0xb0')]][_0x2e89('0x122')],_0x2e89('0xf8'))[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x693b5d[_0x2e89('0xfa')],'ListId':_0x693b5d['ListId'],'VoiceQueueId':_0x693b5d[_0x2e89('0xcc')]||undefined,'CampaignId':_0x693b5d[_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x288de1=new History(_0x1156ef);_0x288de1[_0x2e89('0xa3')]=0xb;_0x288de1[_0x2e89('0xa4')]=_0x2e89('0x11f');_0x288de1[_0x2e89('0x123')]=moment()[_0x2e89('0x77')](_0x2e89('0xf9'));_0x288de1[_0x2e89('0xa5')]=_0x288de1['starttime'];_0x288de1[_0x2e89('0x11c')]=_0x1156ef[_0x2e89('0x11c')];_0x288de1['calleridnum']=_0x1156ef[_0x2e89('0x11d')];this[_0x2e89('0xd6')](_0x288de1)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x124')));}}}}};Dialer[_0x2e89('0x1c')][_0x2e89('0x125')]=function(_0x43a0ef){if(this[_0x2e89('0x26')][_0x43a0ef['uniqueid']]){this[_0x2e89('0x26')][_0x43a0ef['uniqueid']][_0x2e89('0xab')]=_0x43a0ef['channel'];}if(this['uniqueId'][_0x43a0ef['uniqueid']]){this['uniqueId'][_0x43a0ef[_0x2e89('0xd7')]]['channel']=_0x43a0ef[_0x2e89('0xab')];}};Dialer[_0x2e89('0x1c')]['syncQueueMember']=function(_0x1b12c0){if(strategy[this[_0x2e89('0xae')][this[_0x2e89('0x26')][_0x1b12c0['actionid']]['queue']]['strategy']]===_0x2e89('0x1b')){if(this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]]&&_[_0x2e89('0xd8')](this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]][_0x2e89('0x127')])&&_0x1b12c0[_0x2e89('0xd2')]==='1'&&_0x1b12c0[_0x2e89('0x128')]==='0'){if(this[_0x2e89('0x23')][_0x1b12c0['stateinterface']]){if(!this['agents'][_0x1b12c0[_0x2e89('0x129')]]['locked']){this['agents'][_0x1b12c0['stateinterface']][_0x2e89('0x127')]=!![];this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]][_0x2e89('0x127')]=!![];this['actions'][_0x1b12c0['actionid']]['stateinterface']=_0x1b12c0[_0x2e89('0x129')];}}}}else if((strategy[this[_0x2e89('0xae')][this[_0x2e89('0x26')][_0x1b12c0['actionid']][_0x2e89('0xb0')]][_0x2e89('0x4e')]]||'rrmemory')===_0x2e89('0x1a')){if(this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]]){if(this['agents'][_0x1b12c0['stateinterface']]){this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]][_0x2e89('0x129')]=_0x1b12c0[_0x2e89('0x129')];if(_['isNil'](this[_0x2e89('0x2b')][this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]][_0x2e89('0xb0')]])){this[_0x2e89('0x2b')][this[_0x2e89('0x26')][_0x1b12c0['actionid']][_0x2e89('0xb0')]]=[];}this['queueBooked'][this['actions'][_0x1b12c0[_0x2e89('0x126')]][_0x2e89('0xb0')]][_0x2e89('0x12a')](_[_0x2e89('0x8a')](_[_0x2e89('0xc9')](this[_0x2e89('0x26')][_0x1b12c0[_0x2e89('0x126')]],[_0x2e89('0x12b'),_0x2e89('0x129')]),{'status':_0x1b12c0[_0x2e89('0xd2')],'paused':_0x1b12c0[_0x2e89('0x128')]}));}}}};function unlockQueueStatus(_0x110012,_0x34dbd5){setTimeout(function(){if(_['isUndefined'](_0x110012[_0x2e89('0x12c')])){loggerBooked[_0x2e89('0x93')](_0x2e89('0x12d'),_0x34dbd5);}_0x110012[_0x2e89('0x12c')]=!![];loggerBooked[_0x2e89('0x7b')](_0x2e89('0x12e'),_0x34dbd5,JSON[_0x2e89('0x49')](_[_0x2e89('0xc9')](_0x110012,[_0x2e89('0x3e'),_0x2e89('0x12c')])));},0x1f3);}Dialer[_0x2e89('0x1c')]['syncQueueStatusComplete']=function(_0x1e04b6){var _0x366e04=this;var _0x4dd8c3=_0x366e04[_0x2e89('0xae')][_0x366e04[_0x2e89('0x26')][_0x1e04b6['actionid']]['queue']];if(strategy[this[_0x2e89('0xae')][this['actions'][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]][_0x2e89('0x4e')]]==='roundrobin'){if(this[_0x2e89('0x26')][_0x1e04b6['actionid']]&&this['actions'][_0x1e04b6[_0x2e89('0x126')]]['stateinterface']){this['preview']['run'](this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0x12b')],this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0x129')])[_0x2e89('0xac')](function(_0x5e1196){logger[_0x2e89('0x93')](_0x2e89('0x12f'),util['inspect'](_0x5e1196,{'showHidden':![],'depth':null}));})[_0x2e89('0x1f')](function(){_0x366e04[_0x2e89('0xb1')](_0x366e04[_0x2e89('0xae')][_0x366e04[_0x2e89('0x26')][_0x1e04b6['actionid']][_0x2e89('0xb0')]]);_0x366e04[_0x2e89('0x23')][_0x366e04['actions'][_0x1e04b6[_0x2e89('0x126')]]['stateinterface']][_0x2e89('0x127')]=![];delete _0x366e04[_0x2e89('0x26')][_0x1e04b6['actionid']];unlockQueueStatus(_0x4dd8c3);});}else{this[_0x2e89('0xb1')](this[_0x2e89('0xae')][this[_0x2e89('0x26')][_0x1e04b6['actionid']][_0x2e89('0xb0')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]]['ContactId'],'ListId':this[_0x2e89('0x26')][_0x1e04b6['actionid']][_0x2e89('0xca')],'VoiceQueueId':this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xcc')]||undefined,'CampaignId':this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0x130')));delete this[_0x2e89('0x26')][_0x1e04b6['actionid']];unlockQueueStatus(_0x4dd8c3);}}else if((strategy[this[_0x2e89('0xae')][this[_0x2e89('0x26')][_0x1e04b6['actionid']][_0x2e89('0xb0')]][_0x2e89('0x4e')]]||_0x2e89('0x1a'))==='rrmemory'){var _0x569c2e;if(this['actions'][_0x1e04b6[_0x2e89('0x126')]]&&!_[_0x2e89('0x46')](this[_0x2e89('0x2b')][this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]]['queue']])){if(this[_0x2e89('0x2c')][_0x366e04[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]]){this[_0x2e89('0x2c')][_0x366e04[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]]=this[_0x2e89('0x2c')][this['actions'][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]]?this[_0x2e89('0x2c')][this['actions'][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]]:this[_0x2e89('0x2b')][this['actions'][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]]?this[_0x2e89('0x2b')][this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]][_0x2e89('0x131')]||0x0:0x0;}this[_0x2e89('0x2b')][this[_0x2e89('0x26')][_0x1e04b6[_0x2e89('0x126')]][_0x2e89('0xb0')]][_0x2e89('0x131')]=this['queueBookedRR'][this[_0x2e89('0x26')][_0x1e04b6['actionid']]['queue']];for(var _0x3c6d30=0x0;_0x3c6d30=0x0;})[_0x2e89('0xac')](myreject(_0x5e3cfe)));}}else{_0x4b0f42[_0x2e89('0x12a')](ami['Action']({'action':_0x2e89('0x149'),'command':util[_0x2e89('0x77')](_0x2e89('0x14a'),_0x4ce66a,!_['isUndefined'](config[_0x2e89('0x146')][_0x3555c5])?_0x3555c5:'')})[_0x2e89('0x3a')](function(_0x50258e){return _0x50258e[_0x2e89('0x14d')][_0x2e89('0x14e')](_0x2e89('0x14c'))>=0x0;})['catch'](myreject(_0x5e3cfe)));}BPromise[_0x2e89('0x14f')](_0x4b0f42)[_0x2e89('0x3a')](function(_0x41b096){var _0x16f453=_['some'](_0x41b096);if(_0x16f453){return _0x25e3dc(_0x16f453);}else{_0x102a9f[_0x2e89('0x3d')]=_0x5797d8?_0x2e89('0x150'):_0x2e89('0x151');return _0x5e3cfe(msgResponse('[ifTime][promiseAll]','Failure',_0x2e89('0x152')+_0x5797d8+'\x20'+_0x98e795+_0x2e89('0x153')+util[_0x2e89('0x92')](_0x4ce66a,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3555c5));}})[_0x2e89('0xac')](function(_0x4a03b0){return _0x5e3cfe(msgResponse('ifTime',_0x2e89('0x142'),JSON[_0x2e89('0x49')](_0x4a03b0)));});});};Dialer[_0x2e89('0x1c')][_0x2e89('0x154')]=function(_0x1dd7f4){var _0x1e1230=this;return function(){switch(_0x1dd7f4[_0x2e89('0x5a')]){case _0x2e89('0x155'):freeVariablesPredictive(_0x1dd7f4);_0x1e1230[_0x2e89('0x156')](_0x1dd7f4,0x1);break;case _0x2e89('0x157'):freeVariablesPredictive(_0x1dd7f4);_0x1e1230[_0x2e89('0x156')](_0x1dd7f4,_0x1dd7f4[_0x2e89('0x158')]);break;case _0x2e89('0xa'):_0x1e1230['predictive'](_0x1dd7f4);break;case'booked':freeVariablesPredictive(_0x1dd7f4);_0x1e1230[_0x2e89('0x156')](_0x1dd7f4,0x1);break;default:freeVariablesPredictive(_0x1dd7f4);logger['error'](_0x2e89('0x159'),_0x1dd7f4['name'],_0x2e89('0x15a'));}};};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x1f31fa){return BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](cmHopper[_0x2e89('0x15b')](_0x1f31fa['id'],previewRecallmeReminderInterval))['then'](function(_0x8546f4){for(var _0x22749f=0x0;_0x22749f<_0x8546f4[_0x2e89('0x95')];_0x22749f++){var _0x29d7c1=_0x8546f4[_0x22749f][_0x2e89('0x15c')][_0x2e89('0x3e')];if(_0x29d7c1)io['to'](util[_0x2e89('0x77')](_0x2e89('0x15d'),_0x29d7c1))[_0x2e89('0xe1')]('user:dialPreviewRecallReminder',{'hopper':_0x8546f4[_0x22749f]});}})[_0x2e89('0xac')](function(_0x51c12c){});};Dialer[_0x2e89('0x1c')]['launchHandleIvr']=function(_0x12ac60){var _0x5f11d8=this;return function(){_0x5f11d8[_0x2e89('0x15e')](_0x12ac60);};};Dialer[_0x2e89('0x1c')][_0x2e89('0xb')]=function(_0x235c7d){var _0xf1a601=this;if(isNotPreview(_0x235c7d['dialMethod'])){if(isVoiceQueueOutbound(_0x235c7d[_0x2e89('0x4c')])&&isActive(_0x235c7d[_0x2e89('0x59')])){_0x235c7d[_0x2e89('0x9d')]=!![];BPromise['resolve']()[_0x2e89('0x3a')](checkIsLoggedIn(_0x235c7d,_0x235c7d[_0x2e89('0x15f')]))[_0x2e89('0x3a')](checkIsActive(_0x235c7d,_0x235c7d[_0x2e89('0x59')]))['then'](checkInterval(_0x235c7d))['then'](_0xf1a601[_0x2e89('0x160')](_0x235c7d))[_0x2e89('0x3a')](_0xf1a601[_0x2e89('0x13f')](_0x235c7d[_0x2e89('0x161')],_0x235c7d[_0x2e89('0x162')],_0x235c7d['name'],_0x235c7d))[_0x2e89('0x3a')](_0xf1a601[_0x2e89('0x141')](_0x235c7d[_0x2e89('0x42')],_0x235c7d['dialTimezone'],_0x235c7d[_0x2e89('0x3e')],_0x235c7d))[_0x2e89('0x3a')](_0xf1a601[_0x2e89('0x154')](_0x235c7d))[_0x2e89('0xac')](loggerCatchQueueSummary('[syncQueueSummary]',_0x235c7d));}else{notSendMessagesQueue(_0x235c7d);}}else{freeVariablesPredictive(_0x235c7d);if(_0x235c7d[_0x2e89('0x163')]){_0xf1a601['checkPreviewRecallReminder'](_0x235c7d);}}};Dialer[_0x2e89('0x1c')][_0x2e89('0x13b')]=function(){var _0x16d1cb=this;var _0x2063d8;for(var _0x429169 in this[_0x2e89('0x22')]){if(typeof this[_0x2e89('0x22')][_0x429169]!==_0x2e89('0x96')){_0x2063d8=this['campaigns'][_0x429169];if(isCampaignIvr(_0x2063d8[_0x2e89('0x4c')])&&isActive(_0x2063d8['active'])){_0x2063d8[_0x2e89('0x9d')]=!![];BPromise[_0x2e89('0xb3')]()[_0x2e89('0x3a')](checkIsActive(_0x2063d8,_0x2063d8[_0x2e89('0xd1')]))['then'](checkInterval(_0x2063d8))[_0x2e89('0x3a')](_0x16d1cb[_0x2e89('0x160')](_0x2063d8))[_0x2e89('0x3a')](_0x16d1cb[_0x2e89('0x13f')](_0x2063d8['dialGlobalInterval'],_0x2063d8['dialTimezone'],_0x2063d8['name'],_0x2063d8))[_0x2e89('0x3a')](_0x16d1cb['checkIfTimeIntervals'](_0x2063d8[_0x2e89('0x42')],_0x2063d8['dialTimezone'],_0x2063d8[_0x2e89('0x3e')],_0x2063d8))['then'](_0x16d1cb[_0x2e89('0x164')](_0x2063d8))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x2063d8));}else{notSendMessagesCampaign(_0x2063d8);}}}};function getCallerIdRandom(_0x389ca5,_0x54bccf){var _0x59b6ce;var _0x30fad9;var _0x355f74;if(_0x54bccf<=0x0){_0x54bccf=0x1;}_0x59b6ce=new RegExp('\x5cw{0,'+_0x54bccf+'}$');_0x30fad9=Math[_0x2e89('0x165')](0xa,_0x54bccf-0x1);_0x355f74=Math[_0x2e89('0x165')](0xa,_0x54bccf)-0x1;return util[_0x2e89('0x77')]('%s',_['replace'](_0x389ca5,_0x59b6ce,_[_0x2e89('0x166')](_0x30fad9,_0x355f74)));}function extractCalleridName(_0x520390){var _0x558446=_0x520390['match'](/"(.*?)"/);return _0x558446?_0x558446[0x1]:_0x520390;}function extractCalleridNumber(_0x1d910a){var _0x397535=_0x1d910a['match'](/<(.*?)>/);return _0x397535?_0x397535[0x1]:_0x1d910a;}Dialer[_0x2e89('0x1c')]['actionOriginate']=function(_0x2db539,_0x317116){var _0x120568=this;var _0x27e371=uuid['v4']();this['actions'][_0x27e371]=new Action(_0x2db539,_0x317116,_0x27e371);return new BPromise(function(_0x6cd37d,_0x1d1d7d){if(_['isUndefined'](_0x2db539)&&typeof _0x2db539!=='object'){return _0x1d1d7d(msgResponse(_0x2e89('0x167'),_0x2e89('0x142'),'voiceQueue\x20is\x20undefine'));}if(_[_0x2e89('0x3c')](_0x317116[_0x2e89('0x168')][_0x2e89('0x169')])||_0x317116['Contact'][_0x2e89('0x169')]===null){return _0x1d1d7d(msgResponse(_0x2e89('0x167'),'Failure',_0x2e89('0x16a')));}var _0x30c0ad={'XMD-CALLERID':_0x120568[_0x2e89('0x26')][_0x27e371][_0x2e89('0x16b')](),'XMD-AGI':_0x2db539[_0x2e89('0x103')]?util[_0x2e89('0x77')](_0x2e89('0x16c'),ipAgi,_0x2db539[_0x2e89('0x103')]):'NONE','XMD-AGIAFTER':_0x2db539[_0x2e89('0x10d')]?util[_0x2e89('0x77')](_0x2e89('0x16c'),ipAgi,_0x2db539[_0x2e89('0x10d')]):_0x2e89('0x16d'),'XMD-QUEUE':_0x2db539['type']==='outbound'?util[_0x2e89('0x77')]('\x22%s,%s%s,,,%s\x22',_0x2db539[_0x2e89('0x3e')],_0x2db539[_0x2e89('0x16e')]||'',_0x2db539[_0x2e89('0x16f')]?'c':'',_0x2db539[_0x2e89('0x115')]||0x3):_0x2e89('0x16d'),'XMD-CONTACTID':_0x317116[_0x2e89('0xfa')],'XMD-CDRTYPE':_0x2e89('0x9'),'CALLERID(all)':_0x120568[_0x2e89('0x26')][_0x27e371]['getCaller'](),'XMD-AMD':_0x2db539['dialAMDActive']?_0x2e89('0x170'):_0x2e89('0x16d'),'XMD-DESTINATION':_0x2e89('0xdc')};if(_0x2db539['dialAMDActive']){_0x30c0ad['XMD-AMDINITIALSILENCE']=_0x2db539['dialAMDInitialSilence']||0x9c4;_0x30c0ad[_0x2e89('0x171')]=_0x2db539['dialAMDGreeting']||0x5dc;_0x30c0ad[_0x2e89('0x172')]=_0x2db539[_0x2e89('0x173')]||0x320;_0x30c0ad[_0x2e89('0x174')]=_0x2db539[_0x2e89('0x175')]||0x1388;_0x30c0ad['XMD-AMDMINWORDLENGTH']=_0x2db539[_0x2e89('0x176')]||0x64;_0x30c0ad['XMD-AMDBETWEENWORDSSILENCE']=_0x2db539[_0x2e89('0x177')]||0x32;_0x30c0ad[_0x2e89('0x178')]=_0x2db539['dialAMDMaximumNumberOfWords']||0x3;_0x30c0ad['XMD-AMDSILENCETHRESHOLD']=_0x2db539[_0x2e89('0x179')]||0x100;_0x30c0ad[_0x2e89('0x17a')]=_0x2db539[_0x2e89('0x17b')]||0x1388;}if(_0x2db539[_0x2e89('0x4c')]===_0x2e89('0x4d')){_0x30c0ad['XMD-VOICEQUEUEID']=_0x317116[_0x2e89('0xcc')];}else{_0x30c0ad[_0x2e89('0x17c')]=_0x317116[_0x2e89('0xcd')];}for(var _0x345785 in _0x317116[_0x2e89('0x168')]){if(typeof _0x317116[_0x2e89('0x168')][_0x345785]!==_0x2e89('0x96')){if(isNotNull(_0x317116[_0x2e89('0x168')][_0x345785])&&_0x345785!=='id'&&_0x345785!==_0x2e89('0x17d')&&_0x345785!==_0x2e89('0x17e')&&_0x345785!==_0x2e89('0x17f')){_0x30c0ad[util[_0x2e89('0x77')]('%s%s','XMD-',_['toUpper'](_0x345785))]=_0x317116[_0x2e89('0x168')][_0x345785];}}}var _0x523fdc=_0x120568[_0x2e89('0xd0')](_0x2db539[_0x2e89('0x76')])?getCallerId(_0x2db539[_0x2e89('0x76')][_0x2e89('0x180')],_0x2db539['dialOriginateCallerIdName'],_0x2db539[_0x2e89('0x181')]>0x0?getCallerIdRandom(_0x2db539[_0x2e89('0x182')],_0x2db539[_0x2e89('0x181')]):_0x2db539[_0x2e89('0x182')]):getCallerId(_[_0x2e89('0xd8')](_0x2db539[_0x2e89('0x13c')])?_0x2db539[_0x2e89('0x76')][_0x2e89('0x180')]:_0x2db539[_0x2e89('0x13c')][_0x2e89('0x180')],_0x2db539[_0x2e89('0x5b')],_0x2db539[_0x2e89('0x181')]>0x0?getCallerIdRandom(_0x2db539['dialOriginateCallerIdNumber'],_0x2db539[_0x2e89('0x181')]):_0x2db539[_0x2e89('0x182')]);if(_0x523fdc){_0x30c0ad['XMD-ORIGINATECALLERIDNAME']=_0x120568[_0x2e89('0x26')][_0x27e371][_0x2e89('0x183')]=extractCalleridName(_0x523fdc);_0x30c0ad[_0x2e89('0x184')]=_0x120568[_0x2e89('0x26')][_0x27e371][_0x2e89('0x185')]=extractCalleridNumber(_0x523fdc);}return ami['Action']({'actionid':_0x27e371,'action':_0x2e89('0x167'),'channel':_0x120568[_0x2e89('0xd0')](_0x2db539[_0x2e89('0x76')])?util[_0x2e89('0x77')](_0x2e89('0x186'),_0x2db539[_0x2e89('0x76')][_0x2e89('0x3e')],isNotNull(_0x2db539['dialPrefix'])?_0x2db539['dialPrefix'][_0x2e89('0x187')]()||'':'',_0x2db539['dialCutDigit']>0x0?_0x317116[_0x2e89('0x168')]['phone']['substring'](_0x2db539[_0x2e89('0x188')]):_0x317116[_0x2e89('0x168')][_0x2e89('0x169')]):util[_0x2e89('0x77')](_0x2e89('0x186'),_[_0x2e89('0xd8')](_0x2db539[_0x2e89('0x13c')])?_0x2db539[_0x2e89('0x76')][_0x2e89('0x3e')]:_0x2db539[_0x2e89('0x13c')][_0x2e89('0x3e')],isNotNull(_0x2db539['dialPrefix'])?_0x2db539[_0x2e89('0x5c')][_0x2e89('0x187')]()||'':'',_0x2db539['dialCutDigit']>0x0?_0x317116[_0x2e89('0x168')][_0x2e89('0x169')][_0x2e89('0x189')](_0x2db539[_0x2e89('0x188')]):_0x317116[_0x2e89('0x168')]['phone']),'callerid':_0x523fdc,'Exten':_0x2e89('0xdc'),'Context':'from-sip','Priority':'1','variable':_0x30c0ad,'timeout':(_0x2db539[_0x2e89('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x27e371})['then'](function(_0x1966de){return _0x6cd37d(_0x1966de);})[_0x2e89('0xac')](function(_0x5e136e){_0x2db539[_0x2e89('0x18b')]+=0x1;var _0x352055=new History(_0x120568[_0x2e89('0x26')][_0x27e371]);logger[_0x2e89('0x93')](util[_0x2e89('0x77')](_0x2e89('0x18c'),JSON['stringify'](_0x5e136e)));_0x352055[_0x2e89('0xa3')]=0xe;_0x352055[_0x2e89('0xa4')]=_0x2e89('0x18d');_0x352055['starttime']=moment()['format'](_0x2e89('0xf9'));_0x352055['endtime']=_0x352055['starttime'];_0x120568[_0x2e89('0xd6')](_0x352055)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x18e')));_0x120568[_0x2e89('0xc3')](_0x352055)[_0x2e89('0xac')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x120568['actions'][_0x27e371];return _0x1d1d7d(msgResponse('originate',_0x2e89('0x48'),_0x2e89('0x18f')));});});});};Dialer['prototype'][_0x2e89('0x30')]=function(_0x5b16df){var _0x1de955=this[_0x2e89('0x26')][_0x5b16df[_0x2e89('0x126')]];if(_0x1de955){delete this[_0x2e89('0x26')][_0x5b16df[_0x2e89('0x126')]];_0x1de955[_0x2e89('0x114')]=moment()[_0x2e89('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x436e30=_0x1de955[_0x2e89('0x4c')]==='ivr'?this[_0x2e89('0x22')][_0x1de955[_0x2e89('0xb0')]]:this[_0x2e89('0xae')][_0x1de955[_0x2e89('0x190')]()];if(!this['isSuccess'](_0x5b16df[_0x2e89('0x191')])){this['updateOriginated'](_0x436e30);return this[_0x2e89('0x192')](_0x1de955,_0x436e30,_0x5b16df)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x5b16df[_0x2e89('0xd7')]]=_0x1de955;}};Dialer[_0x2e89('0x1c')][_0x2e89('0x193')]=function(_0x3e20e0,_0x542727,_0x375f79){var _0x609abd=new History(_0x542727);if(_0x609abd[_0x2e89('0xee')]+_0x609abd['countcongestionretry']+_0x609abd[_0x2e89('0xfd')]+_0x609abd[_0x2e89('0xf0')]+_0x609abd[_0x2e89('0xf1')]+_0x609abd[_0x2e89('0x121')]+_0x609abd[_0x2e89('0xeb')]+_0x609abd['countagentrejectretry']>=_0x375f79[_0x2e89('0xf2')]-0x1){return!![];}switch(_0x3e20e0){case 0x3:if(_0x609abd[_0x2e89('0xfd')]>=_0x375f79[_0x2e89('0x194')]-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countnoanswerretry':_0x609abd[_0x2e89('0xfd')]+=0x1,'scheduledat':moment()[_0x2e89('0x100')](_0x375f79[_0x2e89('0x195')],'minutes')[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x609abd[_0x2e89('0xfa')],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd['CampaignId']||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0x196')));break;case 0x5:if(_0x609abd[_0x2e89('0xee')]>=_0x375f79[_0x2e89('0x197')]-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countbusyretry':_0x609abd[_0x2e89('0xee')]+=0x1,'scheduledat':moment()[_0x2e89('0x100')](_0x375f79[_0x2e89('0x198')],'minutes')['format'](_0x2e89('0xf9')),'ContactId':_0x609abd[_0x2e89('0xfa')],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd['CampaignId']||undefined})['catch'](loggerCatch(_0x2e89('0x199')));break;case 0x8:if(_0x609abd['countcongestionretry']>=_0x375f79[_0x2e89('0x19a')]-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countcongestionretry':_0x609abd[_0x2e89('0xef')]+=0x1,'scheduledat':moment()['add'](_0x375f79['dialCongestionRetryFrequency'],'minutes')[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x609abd['ContactId'],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd[_0x2e89('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x609abd[_0x2e89('0xf0')]>=_0x375f79[_0x2e89('0x19b')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x609abd['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2e89('0x100')](_0x375f79[_0x2e89('0x19c')],_0x2e89('0xf8'))[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x609abd['ContactId'],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd[_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x609abd[_0x2e89('0xf1')]>=_0x375f79[_0x2e89('0x119')]-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countdropretry':_0x609abd[_0x2e89('0xf1')]+=0x1,'scheduledat':moment()[_0x2e89('0x100')](_0x375f79[_0x2e89('0x11a')],_0x2e89('0xf8'))[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x609abd[_0x2e89('0xfa')],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd[_0x2e89('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x609abd[_0x2e89('0x121')]>=_0x375f79['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countabandonedretry':_0x609abd['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x375f79[_0x2e89('0x122')],_0x2e89('0xf8'))[_0x2e89('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x609abd[_0x2e89('0xfa')],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd['VoiceQueueId']||undefined,'CampaignId':_0x609abd[_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0x19d')));break;case 0x13:if(_0x609abd[_0x2e89('0xeb')]>=_0x375f79['dialMachineMaxRetry']-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countmachineretry':_0x609abd[_0x2e89('0xeb')]+=0x1,'scheduledat':moment()[_0x2e89('0x100')](_0x375f79[_0x2e89('0xf7')],_0x2e89('0xf8'))[_0x2e89('0x77')](_0x2e89('0xf9')),'ContactId':_0x609abd[_0x2e89('0xfa')],'ListId':_0x609abd['ListId'],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd[_0x2e89('0xcd')]||undefined})['catch'](loggerCatch(_0x2e89('0xfb')));break;case 0x14:if(_0x609abd[_0x2e89('0xfe')]>=_0x375f79[_0x2e89('0x19e')]-0x1){return!![];}this[_0x2e89('0xb9')]({'active':![],'countagentrejectretry':_0x609abd[_0x2e89('0xfe')]+=0x1,'scheduledat':moment()['add'](_0x375f79[_0x2e89('0x19f')],_0x2e89('0xf8'))['format'](_0x2e89('0xf9')),'ContactId':_0x609abd[_0x2e89('0xfa')],'ListId':_0x609abd[_0x2e89('0xca')],'VoiceQueueId':_0x609abd[_0x2e89('0xcc')]||undefined,'CampaignId':_0x609abd[_0x2e89('0xcd')]||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1a0')));break;default:return!![];}};Dialer[_0x2e89('0x1c')]['callProgressDetecting']=function(_0x3dceb5,_0xb2132e,_0x26bf6e){var _0x37a4e3=this;var _0xb83e48=new History(_0x3dceb5);return new BPromise(function(_0x22f853,_0x619a5c){if(_[_0x2e89('0x3c')](_0xb2132e)&&typeof _0xb2132e!=='object'){return _0x619a5c(msgResponse(_0x2e89('0x1a1'),_0x2e89('0x142'),'entity\x20is\x20undefine'));}if(_[_0x2e89('0x3c')](_0x26bf6e)&&typeof _0x26bf6e!=='object'){return _0x619a5c(msgResponse(_0x2e89('0x1a1'),_0x2e89('0x142'),_0x2e89('0x1a2')));}switch(_0x26bf6e['reason']){case'0':_0xb2132e['outboundNoSuchCallsDay']+=0x1;_0xb83e48[_0x2e89('0xa3')]=0x0;_0xb83e48['statedesc']=_0x2e89('0x1a3');_0xb83e48[_0x2e89('0xf0')]+=0x1;_0xb83e48[_0x2e89('0xec')]+=0x1;ami[_0x2e89('0xe1')](_0x2e89('0x1a4'),ut[_0x2e89('0xe3')](_0x3dceb5,_0x2e89('0x1a5')));_0x37a4e3[_0x2e89('0xd6')](_0xb83e48)[_0x2e89('0xac')](loggerCatch(_0x2e89('0xed')));if(_0x37a4e3['checkRetriveMax'](0x0,_0x3dceb5,_0xb2132e)){if(_0xb83e48[_0x2e89('0xf0')]>=_0xb2132e['dialNoSuchNumberMaxRetry']){_0x37a4e3[_0x2e89('0xf6')](_0xb83e48,_0x22f853,_0x619a5c,'reason\x200\x20no\x20such\x20number....');}else{_0x37a4e3[_0x2e89('0xf3')](_0xb83e48,_0x22f853,_0x619a5c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xb2132e[_0x2e89('0x63')]+=0x1;_0xb83e48[_0x2e89('0xa3')]=0x3;_0xb83e48[_0x2e89('0xa4')]=_0x2e89('0x1a6');_0xb83e48[_0x2e89('0xfd')]+=0x1;_0xb83e48[_0x2e89('0xec')]+=0x1;ami[_0x2e89('0xe1')](_0x2e89('0x1a7'),ut[_0x2e89('0xe3')](_0x3dceb5,'noanswer'));_0x37a4e3[_0x2e89('0xd6')](_0xb83e48)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1a8')));if(_0x37a4e3[_0x2e89('0x193')](0x3,_0x3dceb5,_0xb2132e)){if(_0xb83e48[_0x2e89('0xfd')]>=_0xb2132e['dialNoAnswerMaxRetry']){_0x37a4e3['createStateFinal'](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1a9'));}else{_0x37a4e3['stateGlobal'](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1a9'));}}break;case'5':_0xb2132e[_0x2e89('0x5f')]+=0x1;_0xb83e48[_0x2e89('0xa3')]=0x5;_0xb83e48[_0x2e89('0xa4')]=_0x2e89('0x1aa');_0xb83e48[_0x2e89('0xee')]+=0x1;_0xb83e48['countglobal']+=0x1;ami[_0x2e89('0xe1')]('custom:agentbusy',ut[_0x2e89('0xe3')](_0x3dceb5,_0x2e89('0x1ab')));_0x37a4e3['createHistory'](_0xb83e48)['catch'](loggerCatch(_0x2e89('0x1ac')));if(_0x37a4e3[_0x2e89('0x193')](0x5,_0x3dceb5,_0xb2132e)){if(_0xb83e48[_0x2e89('0xee')]>=_0xb2132e[_0x2e89('0x197')]){_0x37a4e3[_0x2e89('0xf6')](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1ad'));}else{_0x37a4e3[_0x2e89('0xf3')](_0xb83e48,_0x22f853,_0x619a5c,'reason\x205\x20busy');}}break;case'8':_0xb2132e['outboundCongestionCallsDay']+=0x1;_0xb83e48[_0x2e89('0xa3')]=0x8;_0xb83e48[_0x2e89('0xa4')]='Congestion';_0xb83e48[_0x2e89('0xef')]+=0x1;_0xb83e48[_0x2e89('0xec')]+=0x1;ami['emit'](_0x2e89('0x1ae'),ut[_0x2e89('0xe3')](_0x3dceb5,_0x2e89('0x1af')));_0x37a4e3[_0x2e89('0xd6')](_0xb83e48)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1b0')));if(_0x37a4e3[_0x2e89('0x193')](0x8,_0x3dceb5,_0xb2132e)){if(_0xb83e48[_0x2e89('0xef')]>=_0xb2132e[_0x2e89('0x19a')]){_0x37a4e3[_0x2e89('0xf6')](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1b1'));}else{_0x37a4e3[_0x2e89('0xf3')](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1b1'));}}break;case'11':_0xb2132e['outboundAbandonedCallsDay']+=0x1;_0xb83e48[_0x2e89('0xa3')]=0xb;_0xb83e48[_0x2e89('0xa4')]='Abandoned';_0xb83e48[_0x2e89('0x121')]+=0x1;_0xb83e48[_0x2e89('0xec')]+=0x1;_0x37a4e3[_0x2e89('0xd6')](_0xb83e48)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x124')));if(_0x37a4e3[_0x2e89('0x193')](0xb,_0x3dceb5,_0xb2132e)){if(_0xb83e48[_0x2e89('0x121')]>=_0xb2132e[_0x2e89('0x1b2')]){_0x37a4e3[_0x2e89('0xf6')](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1b3'));}else{_0x37a4e3['stateGlobal'](_0xb83e48,_0x22f853,_0x619a5c,'reason\x2011\x20abandoned');}}break;case'20':_0xb2132e[_0x2e89('0x66')]+=0x1;_0xb83e48[_0x2e89('0xa3')]=0x14;_0xb83e48[_0x2e89('0xa4')]=_0x2e89('0x1b4');_0xb83e48[_0x2e89('0xfe')]+=0x1;_0xb83e48[_0x2e89('0xec')]+=0x1;ami[_0x2e89('0xe1')](_0x2e89('0x1b5'),ut[_0x2e89('0xe3')](_0x3dceb5,_0x2e89('0x1b6')));_0x37a4e3[_0x2e89('0xd6')](_0xb83e48)[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1b7')));if(_0x37a4e3['checkRetriveMax'](0x14,_0x3dceb5,_0xb2132e)){if(_0xb83e48[_0x2e89('0xfe')]>=_0xb2132e['dialAgentRejectMaxRetry']){_0x37a4e3['createStateFinal'](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1b8'));}else{_0x37a4e3[_0x2e89('0xf3')](_0xb83e48,_0x22f853,_0x619a5c,_0x2e89('0x1b8'));}}break;default:_0xb2132e['outboundUnknownCallsDay']+=0x1;_0xb83e48[_0x2e89('0xa3')]=0xc;_0xb83e48[_0x2e89('0xa4')]=_0x26bf6e['reason'];_0x37a4e3[_0x2e89('0xd6')](_0xb83e48)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x37a4e3['checkRetriveMax'](_0x26bf6e['reason'],_0x3dceb5,_0xb2132e)){if(_0xb83e48['countbusyretry']+_0xb83e48['countcongestionretry']+_0xb83e48['countnoanswerretry']+_0xb83e48[_0x2e89('0xf0')]+_0xb83e48[_0x2e89('0xf1')]+_0xb83e48['countabandonedretry']+_0xb83e48[_0x2e89('0xeb')]+_0xb83e48[_0x2e89('0xfe')]>=_0xb2132e[_0x2e89('0xf2')]){_0x37a4e3[_0x2e89('0xf3')](_0xb83e48,_0x22f853,_0x619a5c,_0x26bf6e['reason']);}else{_0x37a4e3[_0x2e89('0xf6')](_0xb83e48,_0x22f853,_0x619a5c,_0x26bf6e[_0x2e89('0x10a')]);}}}});};Dialer[_0x2e89('0x1c')]['stateGlobal']=function(_0x4bcc34,_0x584945,_0x2b618a,_0x529195){var _0xe8746=new Final(_0x4bcc34);_0xe8746[_0x2e89('0xa3')]=0xf;_0xe8746['statedesc']=_0x2e89('0x1b9');this[_0x2e89('0xf6')](_0xe8746,_0x584945,_0x2b618a,_0x529195);};Dialer[_0x2e89('0x1c')]['createStateFinal']=function(_0x252d40,_0x3c58a0,_0x44be01,_0x5c9225){this[_0x2e89('0xc3')](_0x252d40)[_0x2e89('0x3a')](function(){return _0x3c58a0(msgResponse('[callProgressDetecting]',_0x2e89('0xcf'),_0x5c9225));})['catch'](function(){return _0x44be01(msgResponse('[moveContactManagedDialer][0]',_0x2e89('0x142'),_0x2e89('0x1ba')));});};Dialer['prototype'][_0x2e89('0xa')]=function(_0x515df2){var _0x380b24=_0x515df2[_0x2e89('0x1bb')]/0x64;var _0x34e2d2=_0x515df2[_0x2e89('0x116')]/(_0x515df2[_0x2e89('0x116')]+_0x515df2[_0x2e89('0x5e')]);var _0x5dc1ff=Math[_0x2e89('0x1bc')](_0x515df2[_0x2e89('0x71')]*(_0x515df2[_0x2e89('0x1bd')]/0x64));var _0x4d63c6=Math['round'](_0x515df2[_0x2e89('0x71')]*(_0x515df2[_0x2e89('0x1be')]/0x64));var _0x38c27c=_0x515df2['available']+_0x515df2[_0x2e89('0x53')];var _0xeb5809=Math[_0x2e89('0x1bf')](_0x515df2['erlangCalls']*_0x515df2[_0x2e89('0x74')]*_0x515df2[_0x2e89('0x6e')]*_0x515df2[_0x2e89('0x6f')]);if(_[_0x2e89('0x3c')](_0x515df2[_0x2e89('0x29')])){if(!_[_0x2e89('0x3c')](_0x515df2[_0x2e89('0x28')])){_0x515df2[_0x2e89('0x28')]=undefined;loggerPredictive['error'](_0x2e89('0x1c0'),_0x2e89('0x1c1'));}if(!_[_0x2e89('0x3c')](_0x515df2['handlePredictive'])){loggerPredictive[_0x2e89('0x93')](_0x2e89('0x1c0'),_0x2e89('0x1c2'));clearInterval(_0x515df2['handlePredictive']);_0x515df2[_0x2e89('0x8d')]=undefined;}_0x515df2[_0x2e89('0x29')]=moment()[_0x2e89('0x77')](_0x2e89('0xf9'));loggerPredictive[_0x2e89('0x7b')](_0x515df2[_0x2e89('0x3e')],_0x2e89('0x1c3'),_0x515df2[_0x2e89('0x29')]);this[_0x2e89('0x156')](_0x515df2,0x1);}else if(ifInterval(_0x515df2[_0x2e89('0x1c4')],_0x515df2[_0x2e89('0x29')])){this[_0x2e89('0x156')](_0x515df2,0x1);loggerPredictiveCalls[_0x2e89('0x7b')](_0x2e89('0x1c5'),_0x515df2[_0x2e89('0x29')],_0x515df2[_0x2e89('0x3e')]);_0x515df2[_0x2e89('0x86')]=0x0;_0x515df2[_0x2e89('0x6d')]=0x0;}else if(_0x380b24<_0x34e2d2&&_0x515df2[_0x2e89('0x1c6')]===_0x2e89('0x1c7')){freeVariablesPredictive(_0x515df2);loggerPredictive['info'](_0x2e89('0x1c8'),_0x2e89('0x1c9'),_0x34e2d2,_0x2e89('0x29'),_0x515df2[_0x2e89('0x3e')]);}else if(_0xeb5809<_0x515df2[_0x2e89('0x6d')]&&_0x515df2['dialPredictiveOptimization']===_0x2e89('0x1c7')){freeVariablesPredictive(_0x515df2);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x1ca'),_0x2e89('0x1cb'),_0xeb5809,_0x2e89('0x1cc'),_0x515df2[_0x2e89('0x6d')],_0x2e89('0x29'),_0x515df2[_0x2e89('0x3e')]);}else if(!ifInterval(_0x515df2[_0x2e89('0x1c4')],_0x515df2[_0x2e89('0x29')])&&_[_0x2e89('0x3c')](_0x515df2[_0x2e89('0x28')])&&!_[_0x2e89('0x3c')](_0x515df2[_0x2e89('0x29')])){_0x515df2[_0x2e89('0x28')]=moment()[_0x2e89('0x77')](_0x2e89('0xf9'));loggerPredictive[_0x2e89('0x7b')](_0x515df2[_0x2e89('0x3e')],_0x2e89('0x1cd'),_0x515df2[_0x2e89('0x28')]);this['averageHandleTime'](_0x515df2[_0x2e89('0x1c4')])['then'](this[_0x2e89('0x1ce')](_0x515df2))[_0x2e89('0x3a')](mergeDataErlangB(_0x515df2))[_0x2e89('0x3a')](this['startMethodPredictive'](_0x515df2))[_0x2e89('0xac')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x515df2));}else if(!ifInterval(_0x515df2[_0x2e89('0x1c4')],_0x515df2[_0x2e89('0x28')])){_0x515df2[_0x2e89('0x6d')]=0x0;_0x515df2[_0x2e89('0x28')]=moment()[_0x2e89('0x77')](_0x2e89('0xf9'));loggerPredictive[_0x2e89('0x7b')](_0x515df2['name'],_0x2e89('0x1cf'),_0x515df2[_0x2e89('0x28')]);clearInterval(_0x515df2[_0x2e89('0x8d')]);_0x515df2[_0x2e89('0x8d')]=undefined;this[_0x2e89('0xb6')](_0x515df2[_0x2e89('0x1c4')])['then'](this[_0x2e89('0x1ce')](_0x515df2))[_0x2e89('0x3a')](mergeDataErlangB(_0x515df2))['then'](this['startMethodPredictive'](_0x515df2))['catch'](loggerCatchPredictive(_0x2e89('0x1d0'),_0x515df2));}else if(_0x515df2[_0x2e89('0x71')]&&_0x38c27c<_0x515df2[_0x2e89('0x71')]-_0x4d63c6){freeVariablesPredictive(_0x515df2);loggerPredictive[_0x2e89('0x7b')](_0x515df2[_0x2e89('0x3e')],_0x2e89('0x1d1'),_0x38c27c,')\x20are\x20less\x20than\x20threshold\x20(',_0x515df2['predictiveIntervalAvailable'],'-',_0x4d63c6,'=',_0x515df2['predictiveIntervalAvailable']-_0x4d63c6,')');}else if(_0x515df2['predictiveIntervalAvailable']&&_0x38c27c>_0x515df2[_0x2e89('0x71')]+_0x5dc1ff){freeVariablesPredictive(_0x515df2);loggerPredictive[_0x2e89('0x7b')](_0x515df2['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x38c27c,_0x2e89('0x1d2'),_0x515df2['predictiveIntervalAvailable'],'+',_0x5dc1ff,'=',_0x515df2[_0x2e89('0x71')]+_0x5dc1ff,')');}};Dialer[_0x2e89('0x1c')][_0x2e89('0x1ce')]=function(_0x14e59c){var _0x315060=this;return function(_0x2b64b1){return new BPromise(function(_0x46bae8,_0x265adc){_[_0x2e89('0x8a')](_0x14e59c,_0x2b64b1[0x0]);if(checkGetDataPredictive(_0x2b64b1[0x0])){var _0x11a8ff=_0x14e59c['predictiveIntervalAvailable']=_0x14e59c[_0x2e89('0x53')]+_0x14e59c[_0x2e89('0x50')];var _0x4fb75c=_0x14e59c[_0x2e89('0x1c4')]*0x3c;var _0x140854=_0x2b64b1[0x0][_0x2e89('0x69')]+_0x2b64b1[0x0][_0x2e89('0x7f')];var _0x433dff=(_0x2b64b1[0x0][_0x2e89('0x68')]+_0x2b64b1[0x0][_0x2e89('0x6b')]+_0x2b64b1[0x0][_0x2e89('0x6a')])/_0x2b64b1[0x0][_0x2e89('0x72')];_0x14e59c['predictiveIntervalHitRate']=_0x433dff>0x0?_0x433dff:0x1;switch(_0x14e59c[_0x2e89('0x1c6')]){case'dropRate':var _0xd9c878=_0x14e59c['dialPredictiveOptimizationPercentage']/0x64;return _0x315060[_0x2e89('0x1d3')](_0x11a8ff,_0x4fb75c,_0x140854,_0x433dff,_0xd9c878)[_0x2e89('0x3a')](function(_0xce5b90){return _0x46bae8(_0xce5b90);});case'agentBusyFactor':var _0x20d242=_0x14e59c[_0x2e89('0x1bb')]/0x64;return _0x315060[_0x2e89('0x1d4')](_0x11a8ff,_0x4fb75c,_0x140854,_0x433dff,_0x20d242)[_0x2e89('0x3a')](function(_0x43dba4){return _0x46bae8(_0x43dba4);});default:return _0x265adc(msgResponse(_0x2e89('0x1d5'),'Failure',_0x2e89('0x1d6')));}}else{return _0x265adc(msgResponse('[getDataPredictive]',_0x2e89('0x142'),'check\x20failure'));}});};};Dialer[_0x2e89('0x1c')][_0x2e89('0x1d7')]=function(_0x5ae85a){var _0x4e4b2a=this;return function(_0x31d1fa){return new BPromise(function(_0x17f6d5,_0x5ea560){_[_0x2e89('0x8a')](_0x5ae85a,_0x31d1fa[0x0]);if(checkGetDataPredictive(_0x31d1fa[0x0])){loggerPredictive[_0x2e89('0x7b')](JSON[_0x2e89('0x49')](_0x31d1fa[0x0]));if(_0x5ae85a[_0x2e89('0x1c6')]===_0x2e89('0x1c7')){return _0x4e4b2a[_0x2e89('0xc1')](_0x5ae85a['id'])[_0x2e89('0x3a')](function(_0x7a405){var _0x10caa0=_0x5ae85a[_0x2e89('0x15f')]-_0x7a405[0x0][_0x2e89('0x1d8')];var _0x4ae42a=_0x5ae85a[_0x2e89('0x1c4')]*0x3c;var _0x16aae1=_0x31d1fa[0x0][_0x2e89('0x69')]+_0x31d1fa[0x0][_0x2e89('0x7f')];var _0x287f81=(_0x31d1fa[0x0][_0x2e89('0x68')]+_0x31d1fa[0x0][_0x2e89('0x6b')]+_0x31d1fa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x31d1fa[0x0][_0x2e89('0x72')];var _0x4f4027=_0x5ae85a['dialPredictiveOptimizationPercentage']/0x64;_0x5ae85a[_0x2e89('0x70')]=_0x7a405[0x0]['outboundQueuePauses']||0x0;_0x5ae85a[_0x2e89('0x6e')]=_0x287f81>0x0?_0x287f81:0x1;return _0x4e4b2a[_0x2e89('0x1d3')](_0x10caa0,_0x4ae42a,_0x16aae1,_0x287f81,_0x4f4027);})[_0x2e89('0x3a')](function(_0x1aeef1){return _0x17f6d5(_0x1aeef1);})['catch'](function(_0x504df7){return _0x5ea560(msgResponse(_0x2e89('0x1d9'),_0x2e89('0x142'),JSON[_0x2e89('0x49')](_0x504df7)));});}if(_0x5ae85a[_0x2e89('0x1c6')]==='agentBusyFactor'){return _0x4e4b2a[_0x2e89('0xc1')](_0x5ae85a['id'])[_0x2e89('0x3a')](function(_0x209063){var _0x3a620a=_0x5ae85a[_0x2e89('0x15f')]-_0x209063[0x0][_0x2e89('0x1d8')];var _0x52f95e=_0x5ae85a['dialPredictiveInterval']*0x3c;var _0x1e25a7=_0x31d1fa[0x0][_0x2e89('0x69')]+_0x31d1fa[0x0]['predictiveIntervalAvgHoldtime'];var _0x309bbf=(_0x31d1fa[0x0][_0x2e89('0x68')]+_0x31d1fa[0x0][_0x2e89('0x6b')]+_0x31d1fa[0x0][_0x2e89('0x6a')])/_0x31d1fa[0x0][_0x2e89('0x72')];var _0x30abc3=_0x5ae85a[_0x2e89('0x1bb')]/0x64;_0x5ae85a['predictiveIntervalPauses']=_0x209063[0x0][_0x2e89('0x1d8')]||0x0;_0x5ae85a[_0x2e89('0x6e')]=_0x309bbf>0x0?_0x309bbf:0x1;return _0x4e4b2a[_0x2e89('0x1d4')](_0x3a620a,_0x52f95e,_0x1e25a7,_0x309bbf,_0x30abc3);})[_0x2e89('0x3a')](function(_0x6d0be6){return _0x17f6d5(_0x6d0be6);})[_0x2e89('0xac')](function(_0x30dcbd){return _0x5ea560(msgResponse('[CatchErlangB]',_0x2e89('0x142'),JSON[_0x2e89('0x49')](_0x30dcbd)));});}}else{return _0x5ea560(msgResponse(_0x2e89('0x1d5'),_0x2e89('0x142'),_0x2e89('0x1da')));}});};};Dialer[_0x2e89('0x1c')][_0x2e89('0x1db')]=function(_0x2dae0b){var _0xd27685=this;return function(){var _0xb5e6a6=0x0;var _0x3deef8=Math[_0x2e89('0x1bf')](_0x2dae0b[_0x2e89('0x1dc')]*0x3e8);if(_0x3deef8>0x0){_0x3deef8=_0x3deef8<0x64?0x64:_0x3deef8;loggerPredictive['info'](_0x2dae0b[_0x2e89('0x3e')],_0x2e89('0x1dd'),_0x3deef8,'milliseconds');_0x2dae0b[_0x2e89('0x8d')]=setInterval(function(){_0xd27685[_0x2e89('0x8d')](_0x2dae0b);loggerPredictiveCalls[_0x2e89('0x7b')](_0x2e89('0x1de'),_0xb5e6a6+=0x1);},_0x3deef8);}else{loggerPredictive[_0x2e89('0x7b')](_0x2dae0b[_0x2e89('0x3e')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x2e89('0x1c')][_0x2e89('0x1df')]=function(_0x22e60a,_0x3db306){var _0x48ebad=this;return function(_0x19339f){if(_[_0x2e89('0x46')](_0x19339f)){if(_[_0x2e89('0xd8')](_0x3db306['UserId'])||!_0x3db306[_0x2e89('0x1e0')]){if(_0x22e60a['dialMethod']===_0x2e89('0x1e1')){_0x22e60a[_0x2e89('0x12c')]=_['isUndefined'](_0x22e60a[_0x2e89('0x12c')])?!![]:_0x22e60a[_0x2e89('0x12c')];var _0x1d73f7=uuid['v4']();_0x48ebad[_0x2e89('0x26')][_0x1d73f7]=new Action(_0x22e60a,_0x3db306,_0x1d73f7);loggerBooked[_0x2e89('0x7b')](_0x2e89('0x1e2'),_0x1d73f7,_0x2e89('0x1e3'),JSON[_0x2e89('0x49')](_0x22e60a['queueStatusComplete']),_0x2e89('0x1e4'),_0x22e60a[_0x2e89('0x3e')]);if(_0x22e60a[_0x2e89('0x12c')]){_0x22e60a[_0x2e89('0x12c')]=![];_0x48ebad[_0x2e89('0x2b')][_0x48ebad['actions'][_0x1d73f7][_0x2e89('0xb0')]]=[];ami[_0x2e89('0xaa')]({'actionid':_0x1d73f7,'action':_0x2e89('0x1e5'),'queue':_0x22e60a['name']})[_0x2e89('0xac')](function(){_0x48ebad[_0x2e89('0xb1')](_0x22e60a);_0x48ebad['rescheduleContact']({'active':![],'ContactId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7]['ContactId'],'ListId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7][_0x2e89('0xca')],'VoiceQueueId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7][_0x2e89('0xcc')]||undefined,'CampaignId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7]['CampaignId']||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1e6')));delete _0x48ebad[_0x2e89('0x26')][_0x1d73f7];});}else{loggerBooked[_0x2e89('0x7b')](_0x2e89('0x1e7'),JSON['stringify'](_0x22e60a[_0x2e89('0x12c')]),_0x2e89('0x1e4'),_0x22e60a['name']);_0x48ebad[_0x2e89('0xb1')](_0x22e60a);_0x48ebad['rescheduleContact']({'active':![],'ContactId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7]['ContactId'],'ListId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7][_0x2e89('0xca')],'VoiceQueueId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7][_0x2e89('0xcc')]||undefined,'CampaignId':_0x48ebad[_0x2e89('0x26')][_0x1d73f7]['CampaignId']||undefined})[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1e6')));delete _0x48ebad[_0x2e89('0x26')][_0x1d73f7];}}else{return _0x48ebad[_0x2e89('0x1e8')](_0x22e60a,_0x3db306);}}else{if(getDiff(_0x3db306['scheduledat'])<_0x22e60a['dialRecallMeTimeout']*0x3c){if(_0x3db306['Agent']&&!_0x3db306[_0x2e89('0x15c')][_0x2e89('0x1e9')]){_0x48ebad['preview'][_0x2e89('0x1ea')](_0x3db306['id'])['finally'](function(){_0x48ebad[_0x2e89('0xb1')](_0x22e60a);});}else{_0x48ebad[_0x2e89('0xbb')]({'active':![]},_0x3db306['id'],0x1)['finally'](function(){_0x48ebad[_0x2e89('0xb1')](_0x22e60a);});}}else{_0x22e60a[_0x2e89('0x65')]+=0x1;_0x48ebad[_0x2e89('0xb1')](_0x22e60a);if(_0x22e60a['dialRecallInQueue']){_0x48ebad[_0x2e89('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3db306[_0x2e89('0xfa')],'ListId':_0x3db306['ListId'],'VoiceQueueId':_0x3db306[_0x2e89('0xcc')]||undefined,'CampaignId':_0x3db306['CampaignId']||undefined})[_0x2e89('0xac')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x48ebad[_0x2e89('0xd6')](createObjHistory(_0x22e60a,_0x3db306,_0x2e89('0x1eb'),0x17,_0x2e89('0x1ec')))[_0x2e89('0xac')](loggerCatch(_0x2e89('0x1ed')));}else{_0x48ebad[_0x2e89('0xd5')](createObjHistory(_0x22e60a,_0x3db306,_0x2e89('0x1ee'),0x16,_0x2e89('0x1ef')),'[Originate][HistoryRecallClose][historyCatch]',_0x2e89('0x1f0'));}}}}else{_0x22e60a[_0x2e89('0x1f1')]+=0x1;_0x48ebad['saveInDb'](createObjHistory(_0x22e60a,_0x3db306,_0x2e89('0x1f2'),0xd,_0x2e89('0x1f3')),_0x2e89('0x1f4'),_0x2e89('0x1f5'));throw _0x2e89('0x1f6');}};};Dialer[_0x2e89('0x1c')][_0x2e89('0x15e')]=function(_0x28c7e8){var _0x525e11=this;var _0x28dc87=_0x28c7e8[_0x2e89('0x1f7')]-_0x28c7e8[_0x2e89('0x73')]-_0x28c7e8['temp'];emitCampaignSummary(_0x28c7e8);if(_0x28dc87>0x0){if(_0x28dc87>this['maxNumberOriginate']){_0x28dc87=this[_0x2e89('0x25')];}_0x28c7e8['temp']+=_0x28dc87;this[_0x2e89('0x1f8')](_0x28c7e8['id'],_0x28dc87,_0x28c7e8[_0x2e89('0x1f9')],_0x28c7e8)['then'](function(_0x32abce){_0x28c7e8[_0x2e89('0xbe')]-=_0x28dc87;_0x28c7e8['temp']=_0x28c7e8[_0x2e89('0xbe')]>0x0?_0x28c7e8['temp']:0x0;if(!checkContactEmpty(_0x32abce)){_0x28c7e8['message']=_0x2e89('0x9b');logger[_0x2e89('0x7b')]('[getContactCampaign2][Empty]'+_0x28c7e8['name']);}else{_0x28c7e8[_0x2e89('0x73')]+=_0x32abce[_0x2e89('0x95')];_0x28c7e8[_0x2e89('0x3d')]=_0x2e89('0x1fa');for(var _0x342f69=0x0;_0x342f69<_0x32abce[_0x2e89('0x95')];_0x342f69+=0x1){_0x28c7e8[_0x2e89('0x1fb')]+=0x1;if(_[_0x2e89('0xd8')](_0x32abce[_0x342f69])||_[_0x2e89('0xd8')](_0x32abce[_0x342f69]['Contact'])||_[_0x2e89('0xd8')](_0x32abce[_0x342f69][_0x2e89('0x168')]['phone'])){_0x525e11[_0x2e89('0xc7')](_0x2e89('0x1fc'),_0x28c7e8,_0x32abce[_0x342f69]);}else{_0x525e11[_0x2e89('0xb5')](_[_0x2e89('0xc9')](_0x32abce[_0x342f69],[_0x2e89('0xcd'),_0x2e89('0x1fd')]))[_0x2e89('0x3a')](_0x525e11[_0x2e89('0x1df')](_0x28c7e8,_0x32abce[_0x342f69]))[_0x2e89('0xac')](_0x525e11[_0x2e89('0xc6')](_0x2e89('0x1fe'),_0x28c7e8));}}}})['catch'](loggerGetContactDialer(_0x2e89('0x1ff'),_0x28c7e8,_0x28dc87));}};Dialer[_0x2e89('0x1c')][_0x2e89('0x156')]=function(_0x4ecb86,_0x2951da){var _0x2a7e8e=this;var _0x521dcd=[];var _0x10b3ed=_0x2951da>=0x1?_0x2951da:0x1;if(_0x4ecb86['dialMethod']===_0x2e89('0x1e1')){_0x10b3ed=0x1;}var _0x2aae69=Math['floor'](_0x4ecb86[_0x2e89('0x50')]*_0x10b3ed)-_0x4ecb86[_0x2e89('0x73')]-_0x4ecb86['temp'];emitVoiceQueueSummary(_0x4ecb86);if(_0x4ecb86['dialLimitQueue']>0x0){var _0xe70d5a=_0x4ecb86['dialLimitQueue']-_0x4ecb86['originated']-_0x4ecb86['talking']-_0x4ecb86[_0x2e89('0xbe')]-_0x4ecb86[_0x2e89('0x51')];if(_0x2aae69>_0xe70d5a){_0x2aae69=_0xe70d5a;}}if(_0x2aae69>0x0){if(_0x4ecb86[_0x2e89('0x5a')]==='booked'){_0x2aae69=0x1;}if(_0x2aae69>this[_0x2e89('0x25')]){_0x2aae69=this['maxNumberOriginate'];}_0x4ecb86[_0x2e89('0xbe')]+=_0x2aae69;for(var _0x41d383 in this[_0x2e89('0x23')]){if(typeof this[_0x2e89('0x23')][_0x41d383]!==_0x2e89('0x96')){if(this['agents'][_0x41d383][_0x2e89('0xa3')]===_0x2e89('0x200')&&this[_0x2e89('0x23')][_0x41d383][_0x2e89('0xd2')]==='reachable'){_0x521dcd[_0x2e89('0x12a')](this[_0x2e89('0x23')][_0x41d383]['id']);}}}this['getContactDialer'](_0x4ecb86['id'],_0x521dcd,_0x2aae69,_0x4ecb86['dialOrderByScheduledAt'],_0x4ecb86)[_0x2e89('0x3a')](function(_0x578c8c){_0x4ecb86['temp']-=_0x2aae69;_0x4ecb86[_0x2e89('0xbe')]=_0x4ecb86[_0x2e89('0xbe')]>0x0?_0x4ecb86[_0x2e89('0xbe')]:0x0;if(!checkContactEmpty(_0x578c8c)){_0x2a7e8e[_0x2e89('0xb2')](_0x4ecb86)['then'](sendMessageReschedule(_0x4ecb86))[_0x2e89('0xac')](loggerCatch(_0x2e89('0x201')));}else{_0x4ecb86[_0x2e89('0x73')]+=_0x578c8c[_0x2e89('0x95')];_0x4ecb86[_0x2e89('0x3d')]=_0x4ecb86[_0x2e89('0x5a')]==='booked'?_0x2e89('0x170'):'RUNNING';for(var _0x3b65e5=0x0;_0x3b65e5<_0x578c8c[_0x2e89('0x95')];_0x3b65e5+=0x1){if(_[_0x2e89('0xd8')](_0x578c8c[_0x3b65e5])||_['isNil'](_0x578c8c[_0x3b65e5][_0x2e89('0x168')])||_[_0x2e89('0xd8')](_0x578c8c[_0x3b65e5][_0x2e89('0x168')][_0x2e89('0x169')])){_0x2a7e8e[_0x2e89('0xc7')](_0x2e89('0x1fc'),_0x4ecb86,_0x578c8c[_0x3b65e5]);}else{_0x2a7e8e[_0x2e89('0xb4')](_[_0x2e89('0xc9')](_0x578c8c[_0x3b65e5],['VoiceQueueId',_0x2e89('0x1fd')]))[_0x2e89('0x3a')](_0x2a7e8e[_0x2e89('0x1df')](_0x4ecb86,_0x578c8c[_0x3b65e5]))[_0x2e89('0xac')](_0x2a7e8e[_0x2e89('0xc6')](_0x2e89('0x1fc'),_0x4ecb86));}}}})[_0x2e89('0xac')](loggerGetContactDialer('[getContactDialer2]',_0x4ecb86,_0x2aae69));}};Dialer[_0x2e89('0x1c')][_0x2e89('0x8d')]=function(_0x5dbf6e){if(_0x5dbf6e['dialLimitQueue']>0x0){var _0x1dede5=_0x5dbf6e[_0x2e89('0x202')]-_0x5dbf6e[_0x2e89('0x73')]-_0x5dbf6e['talking'];if(_0x1dede5>0x0){this[_0x2e89('0x203')](_0x5dbf6e);}else{loggerPredictiveCalls[_0x2e89('0x7b')](_0x2e89('0x204'));}}else{this[_0x2e89('0x203')](_0x5dbf6e);}};Dialer[_0x2e89('0x1c')]['tryOriginatePredictive']=function(_0x4f6fe5){var _0x1921f3=this;var _0x5ac21d=[];_0x4f6fe5[_0x2e89('0x73')]+=0x1;for(var _0x40a3af in this[_0x2e89('0x23')]){if(typeof this[_0x2e89('0x23')][_0x40a3af]!=='undefined'){if(this['agents'][_0x40a3af][_0x2e89('0xa3')]===_0x2e89('0x200')&&this[_0x2e89('0x23')][_0x40a3af][_0x2e89('0xd2')]===_0x2e89('0xd3')){_0x5ac21d['push'](this[_0x2e89('0x23')][_0x40a3af]['id']);}}}this[_0x2e89('0xbd')](_0x4f6fe5['id'],_0x5ac21d,0x1,_0x4f6fe5[_0x2e89('0x1f9')],_0x4f6fe5)[_0x2e89('0x3a')](function(_0x3b3ac5){if(!checkContactEmpty(_0x3b3ac5)){checkContactLowerLimitOriginate(_0x4f6fe5,0x1,0x0);_0x1921f3[_0x2e89('0xb2')](_0x4f6fe5)[_0x2e89('0x3a')](sendMessageReschedule(_0x4f6fe5))[_0x2e89('0xac')](loggerCatch(_0x2e89('0x201')));}else{_0x4f6fe5[_0x2e89('0x3d')]=_0x2e89('0x1fa');if(_['isNil'](_0x3b3ac5[0x0])||_[_0x2e89('0xd8')](_0x3b3ac5[0x0]['Contact'])||_[_0x2e89('0xd8')](_0x3b3ac5[0x0][_0x2e89('0x168')][_0x2e89('0x169')])){_0x1921f3['emptyContact'](_0x2e89('0x1fc'),_0x4f6fe5,_0x3b3ac5[0x0]);}else{_0x1921f3[_0x2e89('0xb4')](_[_0x2e89('0xc9')](_0x3b3ac5[0x0],['VoiceQueueId',_0x2e89('0x1fd')]))[_0x2e89('0x3a')](_0x1921f3[_0x2e89('0x1df')](_0x4f6fe5,_0x3b3ac5[0x0]))[_0x2e89('0xac')](_0x1921f3['loggerHandler'](_0x2e89('0x205'),_0x4f6fe5));}}})['catch'](loggerGetContactDialer(_0x2e89('0x206'),_0x4f6fe5,0x1));emitVoiceQueueSummary(_0x4f6fe5);};Dialer[_0x2e89('0x1c')][_0x2e89('0x1d3')]=function(_0x498c50,_0x3a4d19,_0x4bc409,_0x3664c8,_0x256f7a,_0x1ba464){loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x207'));loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x208'),_0x498c50);loggerPredictive[_0x2e89('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a4d19);loggerPredictive['info']('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',_0x4bc409);loggerPredictive[_0x2e89('0x7b')]('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',_0x3664c8);loggerPredictive['info'](_0x2e89('0x209'),_0x256f7a);loggerPredictive['info'](_0x2e89('0x80'));return new BPromise(function(_0x3bcd4d,_0x2b5af0){if(_0x498c50<=0x0||isNaN(_0x498c50)){return _0x2b5af0(msgResponse(_0x2e89('0x20a'),_0x2e89('0x48'),'m\x20=\x20'+_0x498c50));}if(_0x4bc409<=0x0||isNaN(_0x4bc409)){return _0x2b5af0(msgResponse(_0x2e89('0x20a'),'Error',_0x2e89('0x20b')+_0x4bc409));}if(_0x3664c8<=0x0||isNaN(_0x3664c8)){return _0x2b5af0(msgResponse(_0x2e89('0x20a'),'Error',_0x2e89('0x20c')+_0x3664c8));}if(_0x3a4d19<=0x0||isNaN(_0x3a4d19)){return _0x2b5af0(msgResponse(_0x2e89('0x20a'),_0x2e89('0x48'),_0x2e89('0x20d')+_0x3a4d19));}if(_0x256f7a<=0x0||isNaN(_0x256f7a)){return _0x2b5af0(msgResponse(_0x2e89('0x20a'),'Error',_0x2e89('0x20e')+_0x256f7a));}_0x1ba464=_0x1ba464||0x0;var _0x50599e=0x1/_0x4bc409;var _0x3cae82=0x0;var _0x2e8f2d=0x0;var _0x48e03a=0x0;var _0x365b63=0x0;for(var _0x3ea914=0x0;_0x48e03a<_0x256f7a;_0x3ea914+=0x1){_0x2e8f2d=_0x3ea914/_0x3a4d19;_0x3cae82=(_0x3664c8*_0x2e8f2d+_0x1ba464)/_0x50599e;_0x48e03a=erlangb(_0x3cae82,_0x498c50);_0x365b63=_0x3cae82/_0x498c50*(0x1-erlangb(_0x3cae82,_0x498c50));}return _0x3bcd4d({'erlangCalls':_0x3ea914,'erlangCallToSecond':_0x3a4d19/_0x3ea914,'erlangAbandonmentRate':_0x48e03a,'erlangBusyFactor':_0x365b63});});};Dialer[_0x2e89('0x1c')][_0x2e89('0x1d4')]=function(_0x46d76f,_0x1ba25a,_0x4fff6c,_0x443985,_0x48d196,_0x38dee0){loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x20f'));loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x208'),_0x46d76f);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x210'),_0x1ba25a);loggerPredictive['info'](_0x2e89('0x211'),_0x4fff6c);loggerPredictive['info'](_0x2e89('0x212'),_0x443985);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x48d196);loggerPredictive[_0x2e89('0x7b')](_0x2e89('0x80'));return new BPromise(function(_0x50af44,_0x247421){if(_0x46d76f<=0x0||isNaN(_0x46d76f)){return _0x247421(msgResponse(_0x2e89('0x213'),_0x2e89('0x48'),_0x2e89('0x214')+_0x46d76f));}if(_0x4fff6c<=0x0||isNaN(_0x4fff6c)){return _0x247421(msgResponse(_0x2e89('0x213'),_0x2e89('0x48'),_0x2e89('0x20b')+_0x4fff6c));}if(_0x443985<=0x0||isNaN(_0x443985)){return _0x247421(msgResponse(_0x2e89('0x213'),_0x2e89('0x48'),_0x2e89('0x20c')+_0x443985));}if(_0x1ba25a<=0x0||isNaN(_0x1ba25a)){return _0x247421(msgResponse(_0x2e89('0x213'),_0x2e89('0x48'),_0x2e89('0x20d')+_0x1ba25a));}if(_0x48d196<=0x0||isNaN(_0x48d196)){return _0x247421(msgResponse(_0x2e89('0x213'),'Error','Umin\x20=\x20'+_0x48d196));}_0x38dee0=_0x38dee0||0x0;var _0x236998=0x1/_0x4fff6c;var _0x28fae5=0x0;var _0x5adef9=0x0;var _0x547b0e=0x0;var _0x6da4c7=0x0;for(var _0x1fb1aa=0x0;_0x6da4c7<_0x48d196;_0x1fb1aa+=0x1){_0x5adef9=_0x1fb1aa/_0x1ba25a;_0x28fae5=(_0x443985*_0x5adef9+_0x38dee0)/_0x236998;_0x547b0e=erlangb(_0x28fae5,_0x46d76f);_0x6da4c7=_0x28fae5/_0x46d76f*(0x1-erlangb(_0x28fae5,_0x46d76f));}return _0x50af44({'erlangCalls':_0x1fb1aa,'erlangCallToSecond':_0x1ba25a/_0x1fb1aa,'erlangAbandonmentRate':_0x547b0e,'erlangBusyFactor':_0x6da4c7});});};module[_0x2e89('0x215')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 6c235a7..d6516e3 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x363f=['milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x363f,0x1cb));var _0xf363=function(_0x5d7358,_0x594ab7){_0x5d7358=_0x5d7358-0x0;var _0x558421=_0x363f[_0x5d7358];return _0x558421;};'use strict';var util=require(_0xf363('0x0'));var _=require(_0xf363('0x1'));var moment=require(_0xf363('0x2'));function getSeconds(_0x41c7bd,_0x1e2b3d){var _0x7dff70=moment(_0x41c7bd)[_0xf363('0x3')](0x0);var _0x522fbb=moment(_0x1e2b3d)['milliseconds'](0x0);return _0x7dff70[_0xf363('0x4')](_0x522fbb,_0xf363('0x5'));}function QueueCallerAbandon(_0x3203dd,_0x304fb1){this[_0xf363('0x6')]=_0x3203dd['scheduledat'];this[_0xf363('0x7')]=_0x3203dd[_0xf363('0x7')];this[_0xf363('0x8')]=_0x3203dd[_0xf363('0x7')]==='outbound'?_0xf363('0x9'):_0x3203dd[_0xf363('0x7')];this[_0xf363('0xa')]=_0x3203dd[_0xf363('0xa')];this['countcongestionretry']=_0x3203dd[_0xf363('0xb')];this[_0xf363('0xc')]=_0x3203dd[_0xf363('0xc')];this[_0xf363('0xd')]=_0x3203dd[_0xf363('0xa')]+_0x3203dd[_0xf363('0xb')]+_0x3203dd['countnoanswerretry']+_0x3203dd[_0xf363('0xe')]+_0x3203dd[_0xf363('0xf')]+_0x3203dd[_0xf363('0x10')]+_0x3203dd['countmachineretry']+_0x3203dd[_0xf363('0x11')];this[_0xf363('0xe')]=_0x3203dd[_0xf363('0xe')];this[_0xf363('0xf')]=_0x3203dd['countdropretry'];this[_0xf363('0x10')]=_0x3203dd[_0xf363('0x10')];this['countmachineretry']=_0x3203dd[_0xf363('0x12')];this[_0xf363('0x11')]=_0x3203dd[_0xf363('0x11')];this[_0xf363('0x13')]=_0x304fb1[_0xf363('0x13')];this[_0xf363('0x14')]=_0x3203dd['name'];this['calleridnum']=_0x3203dd['number'];this[_0xf363('0x15')]=_0x3203dd['starttime'];this['responsetime']=_0x3203dd[_0xf363('0x16')];this[_0xf363('0x17')]=_0x3203dd[_0xf363('0x17')];this[_0xf363('0x18')]=this[_0xf363('0x17')];this[_0xf363('0x19')]=getSeconds(_0x3203dd[_0xf363('0x16')],_0x3203dd['starttime']);this[_0xf363('0x1a')]=getSeconds(this[_0xf363('0x17')],_0x3203dd['responsetime']);this[_0xf363('0x1b')]=0x0;this[_0xf363('0x9')]=_0x304fb1[_0xf363('0x9')];this[_0xf363('0x1c')]=_0x304fb1[_0xf363('0x1d')];this[_0xf363('0x1e')]=_0x304fb1['reason'];this[_0xf363('0x1f')]=_0x3203dd['callback'];this[_0xf363('0x20')]=_0x3203dd['callbackuniqueid'];this[_0xf363('0x21')]=_0x3203dd['callbackat'];this[_0xf363('0x22')]=_0x3203dd[_0xf363('0x22')];this[_0xf363('0x23')]=_0x3203dd['ContactId'];this[_0xf363('0x24')]=_0x3203dd[_0xf363('0x24')];this[_0xf363('0x25')]=_0x3203dd['UserId'];this[_0xf363('0x26')]=_0x3203dd['VoiceQueueId'];this[_0xf363('0x27')]=_0x3203dd[_0xf363('0x27')];this[_0xf363('0x28')]=_0x3203dd['originatecalleridnum']||'';this[_0xf363('0x29')]=_0x3203dd[_0xf363('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x98ae=['campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat'];(function(_0x5b7191,_0x4f3672){var _0xb52e1=function(_0x25c28a){while(--_0x25c28a){_0x5b7191['push'](_0x5b7191['shift']());}};_0xb52e1(++_0x4f3672);}(_0x98ae,0x142));var _0xe98a=function(_0x3726f5,_0x1e7c3b){_0x3726f5=_0x3726f5-0x0;var _0x16c259=_0x98ae[_0x3726f5];return _0x16c259;};'use strict';var util=require(_0xe98a('0x0'));var _=require(_0xe98a('0x1'));var moment=require(_0xe98a('0x2'));function getSeconds(_0x515b67,_0x511368){var _0x2d028d=moment(_0x515b67)[_0xe98a('0x3')](0x0);var _0x45a2fa=moment(_0x511368)['milliseconds'](0x0);return _0x2d028d[_0xe98a('0x4')](_0x45a2fa,_0xe98a('0x5'));}function QueueCallerAbandon(_0x56e86c,_0x1cc98d){this[_0xe98a('0x6')]=_0x56e86c[_0xe98a('0x6')];this['type']=_0x56e86c['type'];this[_0xe98a('0x7')]=_0x56e86c['type']===_0xe98a('0x8')?_0xe98a('0x9'):_0x56e86c[_0xe98a('0xa')];this[_0xe98a('0xb')]=_0x56e86c[_0xe98a('0xb')];this[_0xe98a('0xc')]=_0x56e86c[_0xe98a('0xc')];this[_0xe98a('0xd')]=_0x56e86c['countnoanswerretry'];this[_0xe98a('0xe')]=_0x56e86c[_0xe98a('0xb')]+_0x56e86c[_0xe98a('0xc')]+_0x56e86c[_0xe98a('0xd')]+_0x56e86c[_0xe98a('0xf')]+_0x56e86c[_0xe98a('0x10')]+_0x56e86c[_0xe98a('0x11')]+_0x56e86c[_0xe98a('0x12')]+_0x56e86c['countagentrejectretry'];this['countnosuchnumberretry']=_0x56e86c['countnosuchnumberretry'];this[_0xe98a('0x10')]=_0x56e86c['countdropretry'];this[_0xe98a('0x11')]=_0x56e86c[_0xe98a('0x11')];this['countmachineretry']=_0x56e86c['countmachineretry'];this['countagentrejectretry']=_0x56e86c[_0xe98a('0x13')];this[_0xe98a('0x14')]=_0x1cc98d[_0xe98a('0x14')];this[_0xe98a('0x15')]=_0x56e86c[_0xe98a('0x16')];this[_0xe98a('0x17')]=_0x56e86c[_0xe98a('0x18')];this[_0xe98a('0x19')]=_0x56e86c[_0xe98a('0x19')];this[_0xe98a('0x1a')]=_0x56e86c[_0xe98a('0x1a')];this['droptime']=_0x56e86c[_0xe98a('0x1b')];this[_0xe98a('0x1c')]=this[_0xe98a('0x1b')];this[_0xe98a('0x1d')]=getSeconds(_0x56e86c[_0xe98a('0x1a')],_0x56e86c[_0xe98a('0x19')]);this[_0xe98a('0x1e')]=getSeconds(this['droptime'],_0x56e86c[_0xe98a('0x1a')]);this[_0xe98a('0x1f')]=0x0;this[_0xe98a('0x9')]=_0x1cc98d[_0xe98a('0x9')];this[_0xe98a('0x20')]=_0x1cc98d[_0xe98a('0x21')];this[_0xe98a('0x22')]=_0x1cc98d[_0xe98a('0x22')];this[_0xe98a('0x23')]=_0x56e86c[_0xe98a('0x23')];this['callbackuniqueid']=_0x56e86c[_0xe98a('0x24')];this[_0xe98a('0x25')]=_0x56e86c[_0xe98a('0x25')];this[_0xe98a('0x26')]=_0x56e86c[_0xe98a('0x26')];this[_0xe98a('0x27')]=_0x56e86c[_0xe98a('0x27')];this['ListId']=_0x56e86c[_0xe98a('0x28')];this[_0xe98a('0x29')]=_0x56e86c['UserId'];this['VoiceQueueId']=_0x56e86c[_0xe98a('0x2a')];this[_0xe98a('0x2b')]=_0x56e86c['CampaignId'];this['originatecalleridnum']=_0x56e86c[_0xe98a('0x2c')]||'';this[_0xe98a('0x2d')]=_0x56e86c[_0xe98a('0x2d')]||'';}module[_0xe98a('0x2e')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2d534e7..0177e4f 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(_0x8a34a9,_0x365707){var _0x5bfebb=function(_0x2ddc23){while(--_0x2ddc23){_0x8a34a9['push'](_0x8a34a9['shift']());}};_0x5bfebb(++_0x365707);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x2a87c4,_0x255a21){var _0x2f2ee4=function(_0x2c6d35){while(--_0x2c6d35){_0x2a87c4['push'](_0x2a87c4['shift']());}};_0x2f2ee4(++_0x255a21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 268bab0..c68c578 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 _0x02ce=['operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','path','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncReceiveFax','hangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','channel','name','info','uniqueid','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus'];(function(_0x53734e,_0x4d5240){var _0x422ab4=function(_0x33a2a5){while(--_0x33a2a5){_0x53734e['push'](_0x53734e['shift']());}};_0x422ab4(++_0x4d5240);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4573b7,_0x4ce14c){_0x4573b7=_0x4573b7-0x0;var _0x6879be=_0x02ce[_0x4573b7];return _0x6879be;};'use strict';var util=require(_0xe02c('0x0'));var _=require(_0xe02c('0x1'));var BPromise=require(_0xe02c('0x2'));var uuid=require('uuid');var moment=require(_0xe02c('0x3'));var path=require('path');var tiff2pdf=require(_0xe02c('0x4'));var gs=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var ami=require(_0xe02c('0x8'));var rpcDb=require(_0xe02c('0x9'));var Channel=require(_0xe02c('0xa'));var ut=require(_0xe02c('0xb'));var Action=require(_0xe02c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xe02c('0xd'));function Fax(_0x2d85d7){this[_0xe02c('0xe')]={};this[_0xe02c('0xf')]=_0x2d85d7[_0xe02c('0xf')];this[_0xe02c('0x10')]=_0x2d85d7[_0xe02c('0x10')];this[_0xe02c('0x11')]={};ami['on'](_0xe02c('0x12'),this[_0xe02c('0x13')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x15'),this[_0xe02c('0x16')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x17'),this[_0xe02c('0x18')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x19'),this['syncNewExten'][_0xe02c('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xe02c('0x14')](this));ami['on']('receivefax',this[_0xe02c('0x1a')]['bind'](this));ami['on'](_0xe02c('0x1b'),this['syncHangup'][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x1c'),this['syncOriginateResponse'][_0xe02c('0x14')](this));}Fax[_0xe02c('0x1d')]['syncNewchannel']=function(_0x12a564){if(_0x12a564[_0xe02c('0x1e')]==='from-voip-provider'){for(var _0x52917f in this[_0xe02c('0xf')]){if(this['faxAccounts'][_0xe02c('0x1f')](_0x52917f)){if(_0x12a564[_0xe02c('0x20')]===this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x21')]){this[_0xe02c('0xe')][_0x12a564['uniqueid']]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']]['channel']=_0x12a564[_0xe02c('0x22')];this[_0xe02c('0xe')][_0x12a564['uniqueid']]['id']=this[_0xe02c('0xf')][_0x52917f]['id'];this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x23')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}}}}if(this[_0xe02c('0x11')][_0x12a564[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x12a564[_0xe02c('0x25')]]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x22')]=_0x12a564[_0xe02c('0x22')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}};Fax[_0xe02c('0x1d')][_0xe02c('0x16')]=function(_0x1c14d6){if(this['channels'][_0x1c14d6[_0xe02c('0x25')]]){for(var _0x3790eb in _0x1c14d6[_0xe02c('0x27')]){if(_0x1c14d6['variable'][_0xe02c('0x1f')](_0x3790eb)){this[_0xe02c('0xe')][_0x1c14d6[_0xe02c('0x25')]][_0x3790eb]=_0x1c14d6[_0xe02c('0x28')];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x18')]=function(_0x22a285){if(this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]['channelstate']=_0x22a285[_0xe02c('0x29')];this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]][_0xe02c('0x2a')]=_0x22a285[_0xe02c('0x2a')];}};Fax[_0xe02c('0x1d')]['syncNewExten']=function(_0x436bcc){if(this[_0xe02c('0xe')][_0x436bcc['uniqueid']]){for(var _0x1ce34c in _0x436bcc[_0xe02c('0x27')]){if(_0x436bcc[_0xe02c('0x27')][_0xe02c('0x1f')](_0x1ce34c)){this[_0xe02c('0xe')][_0x436bcc['uniqueid']][_0x1ce34c]=_0x436bcc['value'];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x2b')]=function(_0x57928e){if(this[_0xe02c('0xe')][_0x57928e['uniqueid']]){this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x2c')]=_0x57928e[_0xe02c('0x2c')];this[_0xe02c('0xe')][_0x57928e['uniqueid']][_0xe02c('0x2d')]=_0x57928e['status'];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x57928e[_0xe02c('0x21')];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]]['filename']=_0x57928e[_0xe02c('0x2e')];logger[_0xe02c('0x24')](_0x57928e['uniqueid'],_0xe02c('0x2f'));}};Fax[_0xe02c('0x1d')]['syncReceiveFax']=function(_0x396a06){var _0x4e4df6=this;if(this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]){var _0x5b05e1=this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]['id'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x30')]=_0x396a06[_0xe02c('0x30')];this['channels'][_0x396a06[_0xe02c('0x25')]]['pagestransferred']=_0x396a06['pagestransferred'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x396a06[_0xe02c('0x21')];this['channels'][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x31')]=_0x396a06[_0xe02c('0x31')];this['channels'][_0x396a06['uniqueid']][_0xe02c('0x32')]=_0x396a06[_0xe02c('0x32')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x2e')]=_0x396a06[_0xe02c('0x2e')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x33')]=_0x396a06['calleridnum'];if(this[_0xe02c('0xe')][_0x396a06['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x396a06[_0xe02c('0x2e')],_0xe02c('0x34'),function(_0x958cbc){logger[_0xe02c('0x24')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x35'),_0x958cbc[_0xe02c('0x36')]);attachment[_0xe02c('0x37')]({'name':path['parse'](_0x396a06['filename'])[_0xe02c('0x23')],'basename':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])['name']+_0xe02c('0x39'),'type':_0xe02c('0x3a')})[_0xe02c('0x3b')](function(_0x1fb73c){faxAccount[_0xe02c('0x3c')](_0x5b05e1,{'from':_0x396a06[_0xe02c('0x33')],'mapKey':_0xe02c('0x7'),'body':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])[_0xe02c('0x23')]+'.pdf','AttachmentId':_0x1fb73c['id']})[_0xe02c('0x3d')](function(_0x18895e){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x3f'),JSON[_0xe02c('0x40')](_0x18895e));});})[_0xe02c('0x3d')](function(_0x3502a5){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x41'),JSON[_0xe02c('0x40')](_0x3502a5));});});}logger[_0xe02c('0x24')](_0x396a06['uniqueid'],_0xe02c('0x41'));}};Fax['prototype'][_0xe02c('0x42')]=function(_0x324911){if(this[_0xe02c('0x11')][_0x324911[_0xe02c('0x25')]]){_[_0xe02c('0x43')](this[_0xe02c('0xe')][_0x324911[_0xe02c('0x25')]],_[_0xe02c('0x44')](_0x324911,[_0xe02c('0x45'),_0xe02c('0x46')]));}};function updateStatus(_0x4f2a6e){if(_0x4f2a6e[_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](_0x4f2a6e[_0xe02c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe02c('0x3b')](function(_0x5ab97d){ut[_0xe02c('0x49')]('[Fax][Message][Error][Updated]',_0x5ab97d);})['catch'](function(_0x5b66f4){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5b66f4);});}else{ut['logger'](_0xe02c('0x4a'));}}Fax[_0xe02c('0x1d')][_0xe02c('0x4b')]=function(_0x35fbe2,_0x5d963d,_0x274beb){var _0x133f3a=this;var _0x4d2bff={};if(_0x5d963d){_0x4d2bff={'read':_0x5d963d};}else{_0x4d2bff={'failMessage':_0x274beb};}if(this[_0xe02c('0x11')][_0x35fbe2][_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](this['actions'][_0x35fbe2]['AttachmentId'],_0x4d2bff)[_0xe02c('0x3b')](function(_0x44a9f3){ut[_0xe02c('0x49')]('[Fax][Message][Updated]',_0x44a9f3);})[_0xe02c('0x3d')](function(_0x53765c){ut['logger'](_0xe02c('0x4c'),_0x53765c);})[_0xe02c('0x4d')](function(){delete _0x133f3a['channels'][_0x35fbe2];delete _0x133f3a[_0xe02c('0x11')][_0x35fbe2];});}else{ut[_0xe02c('0x49')](_0xe02c('0x4e'));delete this['channels'][_0x35fbe2];delete this[_0xe02c('0x11')][_0x35fbe2];}};Fax[_0xe02c('0x1d')]['syncHangup']=function(_0x3788e8){var _0x31ba51=this;if(this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]){if(this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]['id']=this[_0xe02c('0x11')][_0x3788e8['uniqueid']]['id'];this['channels'][_0x3788e8['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]['name'];}logger['info'](_0x3788e8[_0xe02c('0x25')],this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]?_0xe02c('0x4f'):_0xe02c('0x50'),JSON['stringify'](this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]));if(this['actions'][_0x3788e8['uniqueid']]){if(this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x51')]===_0xe02c('0x52')){this[_0xe02c('0x4b')](_0x3788e8[_0xe02c('0x25')],!![]);}else{this[_0xe02c('0x4b')](_0x3788e8['uniqueid'],![],this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxstatusstring']?_0xe02c('0x53')+this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x55')]=function(_0x5d2119){var _0xa7133f=this;return new BPromise(function(_0x44bfd0,_0x4cc74d){_0xa7133f[_0xe02c('0x56')](_0x5d2119,_0xa7133f[_0xe02c('0xf')][_0x5d2119[_0xe02c('0x57')]])[_0xe02c('0x3b')](function(_0x323f3b){ut[_0xe02c('0x49')](_0xe02c('0x58'),_0x323f3b);_0x44bfd0(ut['message'](_0xe02c('0x59')));})['catch'](function(_0x558344){ut['logger'](_0xe02c('0x5a'),_0x558344);updateStatus(_0x5d2119);_0x4cc74d(ut[_0xe02c('0x36')](_0xe02c('0x5b')));});});};Fax[_0xe02c('0x1d')]['checkAfterSend']=function(_0x32e149){var _0x327777=this;return new BPromise(function(_0x503bb3,_0x597a64){var _0x4b0ec3=_0x327777[_0xe02c('0x5c')](_0x327777[_0xe02c('0xf')][_0x32e149['FaxAccountId']]['Trunk'],_0x32e149);if(_0x4b0ec3[_0xe02c('0x5d')]){_0x503bb3(ut[_0xe02c('0x36')](_0xe02c('0x5e')));}else{_0x597a64(ut[_0xe02c('0x36')](_0x4b0ec3[_0xe02c('0x36')]));}});};function originate(_0x5bb01d,_0x39c7db,_0x12ac9f){return new BPromise(function(_0x3f277b,_0x2776c0){if(_0x12ac9f){var _0x11c506=util[_0xe02c('0x5f')]('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[_0xe02c('0x38')](_0x5bb01d[_0xe02c('0x60')])['name'],_0x5bb01d[_0xe02c('0x60')]);gs[_0xe02c('0x61')](_0x11c506)[_0xe02c('0x3b')](function(){_0x5bb01d[_0xe02c('0x60')]=util['format'](_0xe02c('0x62'),path[_0xe02c('0x38')](_0x5bb01d['path'])['dir'],path['parse'](_0x5bb01d[_0xe02c('0x60')])[_0xe02c('0x23')]);_0x39c7db[_0xe02c('0x63')]=_0x5bb01d[_0xe02c('0x60')];ut[_0xe02c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))[_0xe02c('0x3b')](function(_0x4cc653){_0x3f277b(_0x4cc653);})['catch'](function(_0x4c3c91){_0x2776c0(_0x4c3c91);});})[_0xe02c('0x3d')](function(_0x43d7f7){_0x2776c0(_0x43d7f7);});}else{ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))['then'](function(_0x182805){_0x3f277b(_0x182805);})['catch'](function(_0x5a5dba){_0x2776c0(_0x5a5dba);});}});}Fax[_0xe02c('0x1d')][_0xe02c('0x56')]=function(_0x331061,_0x1bbf6a){var _0xea4547=this;return new BPromise(function(_0x2d132e,_0x748217){var _0x12aaea=uuid['v4']();var _0x5ead59=ut[_0xe02c('0x66')](_0x331061,_0x1bbf6a);_0xea4547[_0xe02c('0x11')][_0x12aaea]=new Action(_0x12aaea,_0x1bbf6a,_0x331061);var _0x2386cf=_0xea4547[_0xe02c('0x11')][_0x12aaea];if(path[_0xe02c('0x38')](_0x331061[_0xe02c('0x60')])[_0xe02c('0x67')]===_0xe02c('0x39')){originate(_0x2386cf,_0x5ead59,!![])[_0xe02c('0x3b')](function(_0x411cd5){_0x2d132e(_0x411cd5);})['catch'](function(_0x58acfd){_0x748217(_0x58acfd);});}else{originate(_0x2386cf,_0x5ead59,![])[_0xe02c('0x3b')](function(_0x2a5d54){_0x2d132e(_0x2a5d54);})[_0xe02c('0x3d')](function(_0x76fb21){_0x748217(_0x76fb21);});}});};Fax[_0xe02c('0x1d')]['isTrunkReachable']=function(_0x405b16){return!_[_0xe02c('0x68')](_0x405b16)&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x23')])&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x69')])&&_0x405b16[_0xe02c('0x69')]&&!_[_0xe02c('0x68')](this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])])&&!_['isNil'](this['trunks'][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16['name'])][_0xe02c('0x2d')])&&(this['trunks'][util[_0xe02c('0x5f')]('SIP/%s',_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6b')||this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6c'));};Fax[_0xe02c('0x1d')]['checkTrunk']=function(_0x5a118f,_0x4d6753){if(!this[_0xe02c('0x6d')](_0x5a118f)){ut[_0xe02c('0x49')](_0xe02c('0x6e'),_[_0xe02c('0x68')](_0x5a118f)?'':_0x5a118f[_0xe02c('0x23')]+_0xe02c('0x6f'));return{'isValid':![],'message':_0xe02c('0x70')};}if(_[_0xe02c('0x68')](_0x4d6753[_0xe02c('0x7')])){ut[_0xe02c('0x49')](_0xe02c('0x71'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':_0xe02c('0x72')};}if(_['isNil'](_0x4d6753['path'])){ut[_0xe02c('0x49')](_0xe02c('0x73'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xe02c('0x74')};};module[_0xe02c('0x75')]=Fax; \ No newline at end of file +var _0x02ce=['operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','path','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncReceiveFax','hangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','channel','name','info','uniqueid','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus'];(function(_0x4b596b,_0x40c78){var _0x4abbad=function(_0x4741c4){while(--_0x4741c4){_0x4b596b['push'](_0x4b596b['shift']());}};_0x4abbad(++_0x40c78);}(_0x02ce,0x1ac));var _0xe02c=function(_0x41db6a,_0x2096f3){_0x41db6a=_0x41db6a-0x0;var _0x289183=_0x02ce[_0x41db6a];return _0x289183;};'use strict';var util=require(_0xe02c('0x0'));var _=require(_0xe02c('0x1'));var BPromise=require(_0xe02c('0x2'));var uuid=require('uuid');var moment=require(_0xe02c('0x3'));var path=require('path');var tiff2pdf=require(_0xe02c('0x4'));var gs=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var ami=require(_0xe02c('0x8'));var rpcDb=require(_0xe02c('0x9'));var Channel=require(_0xe02c('0xa'));var ut=require(_0xe02c('0xb'));var Action=require(_0xe02c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xe02c('0xd'));function Fax(_0x2d85d7){this[_0xe02c('0xe')]={};this[_0xe02c('0xf')]=_0x2d85d7[_0xe02c('0xf')];this[_0xe02c('0x10')]=_0x2d85d7[_0xe02c('0x10')];this[_0xe02c('0x11')]={};ami['on'](_0xe02c('0x12'),this[_0xe02c('0x13')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x15'),this[_0xe02c('0x16')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x17'),this[_0xe02c('0x18')][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x19'),this['syncNewExten'][_0xe02c('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xe02c('0x14')](this));ami['on']('receivefax',this[_0xe02c('0x1a')]['bind'](this));ami['on'](_0xe02c('0x1b'),this['syncHangup'][_0xe02c('0x14')](this));ami['on'](_0xe02c('0x1c'),this['syncOriginateResponse'][_0xe02c('0x14')](this));}Fax[_0xe02c('0x1d')]['syncNewchannel']=function(_0x12a564){if(_0x12a564[_0xe02c('0x1e')]==='from-voip-provider'){for(var _0x52917f in this[_0xe02c('0xf')]){if(this['faxAccounts'][_0xe02c('0x1f')](_0x52917f)){if(_0x12a564[_0xe02c('0x20')]===this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x21')]){this[_0xe02c('0xe')][_0x12a564['uniqueid']]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']]['channel']=_0x12a564[_0xe02c('0x22')];this[_0xe02c('0xe')][_0x12a564['uniqueid']]['id']=this[_0xe02c('0xf')][_0x52917f]['id'];this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0xf')][_0x52917f][_0xe02c('0x23')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}}}}if(this[_0xe02c('0x11')][_0x12a564[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x12a564[_0xe02c('0x25')]]={};this[_0xe02c('0xe')][_0x12a564['uniqueid']][_0xe02c('0x22')]=_0x12a564[_0xe02c('0x22')];logger[_0xe02c('0x24')](_0x12a564[_0xe02c('0x25')],_0xe02c('0x26'));}};Fax[_0xe02c('0x1d')][_0xe02c('0x16')]=function(_0x1c14d6){if(this['channels'][_0x1c14d6[_0xe02c('0x25')]]){for(var _0x3790eb in _0x1c14d6[_0xe02c('0x27')]){if(_0x1c14d6['variable'][_0xe02c('0x1f')](_0x3790eb)){this[_0xe02c('0xe')][_0x1c14d6[_0xe02c('0x25')]][_0x3790eb]=_0x1c14d6[_0xe02c('0x28')];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x18')]=function(_0x22a285){if(this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]]['channelstate']=_0x22a285[_0xe02c('0x29')];this[_0xe02c('0xe')][_0x22a285[_0xe02c('0x25')]][_0xe02c('0x2a')]=_0x22a285[_0xe02c('0x2a')];}};Fax[_0xe02c('0x1d')]['syncNewExten']=function(_0x436bcc){if(this[_0xe02c('0xe')][_0x436bcc['uniqueid']]){for(var _0x1ce34c in _0x436bcc[_0xe02c('0x27')]){if(_0x436bcc[_0xe02c('0x27')][_0xe02c('0x1f')](_0x1ce34c)){this[_0xe02c('0xe')][_0x436bcc['uniqueid']][_0x1ce34c]=_0x436bcc['value'];}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x2b')]=function(_0x57928e){if(this[_0xe02c('0xe')][_0x57928e['uniqueid']]){this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x2c')]=_0x57928e[_0xe02c('0x2c')];this[_0xe02c('0xe')][_0x57928e['uniqueid']][_0xe02c('0x2d')]=_0x57928e['status'];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x57928e[_0xe02c('0x21')];this[_0xe02c('0xe')][_0x57928e[_0xe02c('0x25')]]['filename']=_0x57928e[_0xe02c('0x2e')];logger[_0xe02c('0x24')](_0x57928e['uniqueid'],_0xe02c('0x2f'));}};Fax[_0xe02c('0x1d')]['syncReceiveFax']=function(_0x396a06){var _0x4e4df6=this;if(this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]){var _0x5b05e1=this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]]['id'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x30')]=_0x396a06[_0xe02c('0x30')];this['channels'][_0x396a06[_0xe02c('0x25')]]['pagestransferred']=_0x396a06['pagestransferred'];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x21')]=_0x396a06[_0xe02c('0x21')];this['channels'][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x31')]=_0x396a06[_0xe02c('0x31')];this['channels'][_0x396a06['uniqueid']][_0xe02c('0x32')]=_0x396a06[_0xe02c('0x32')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x2e')]=_0x396a06[_0xe02c('0x2e')];this[_0xe02c('0xe')][_0x396a06[_0xe02c('0x25')]][_0xe02c('0x33')]=_0x396a06['calleridnum'];if(this[_0xe02c('0xe')][_0x396a06['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x396a06[_0xe02c('0x2e')],_0xe02c('0x34'),function(_0x958cbc){logger[_0xe02c('0x24')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x35'),_0x958cbc[_0xe02c('0x36')]);attachment[_0xe02c('0x37')]({'name':path['parse'](_0x396a06['filename'])[_0xe02c('0x23')],'basename':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])['name']+_0xe02c('0x39'),'type':_0xe02c('0x3a')})[_0xe02c('0x3b')](function(_0x1fb73c){faxAccount[_0xe02c('0x3c')](_0x5b05e1,{'from':_0x396a06[_0xe02c('0x33')],'mapKey':_0xe02c('0x7'),'body':path[_0xe02c('0x38')](_0x396a06[_0xe02c('0x2e')])[_0xe02c('0x23')]+'.pdf','AttachmentId':_0x1fb73c['id']})[_0xe02c('0x3d')](function(_0x18895e){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x3f'),JSON[_0xe02c('0x40')](_0x18895e));});})[_0xe02c('0x3d')](function(_0x3502a5){logger[_0xe02c('0x3e')](_0x396a06[_0xe02c('0x25')],_0xe02c('0x41'),JSON[_0xe02c('0x40')](_0x3502a5));});});}logger[_0xe02c('0x24')](_0x396a06['uniqueid'],_0xe02c('0x41'));}};Fax['prototype'][_0xe02c('0x42')]=function(_0x324911){if(this[_0xe02c('0x11')][_0x324911[_0xe02c('0x25')]]){_[_0xe02c('0x43')](this[_0xe02c('0xe')][_0x324911[_0xe02c('0x25')]],_[_0xe02c('0x44')](_0x324911,[_0xe02c('0x45'),_0xe02c('0x46')]));}};function updateStatus(_0x4f2a6e){if(_0x4f2a6e[_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](_0x4f2a6e[_0xe02c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe02c('0x3b')](function(_0x5ab97d){ut[_0xe02c('0x49')]('[Fax][Message][Error][Updated]',_0x5ab97d);})['catch'](function(_0x5b66f4){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x5b66f4);});}else{ut['logger'](_0xe02c('0x4a'));}}Fax[_0xe02c('0x1d')][_0xe02c('0x4b')]=function(_0x35fbe2,_0x5d963d,_0x274beb){var _0x133f3a=this;var _0x4d2bff={};if(_0x5d963d){_0x4d2bff={'read':_0x5d963d};}else{_0x4d2bff={'failMessage':_0x274beb};}if(this[_0xe02c('0x11')][_0x35fbe2][_0xe02c('0x47')]){faxMessage[_0xe02c('0x48')](this['actions'][_0x35fbe2]['AttachmentId'],_0x4d2bff)[_0xe02c('0x3b')](function(_0x44a9f3){ut[_0xe02c('0x49')]('[Fax][Message][Updated]',_0x44a9f3);})[_0xe02c('0x3d')](function(_0x53765c){ut['logger'](_0xe02c('0x4c'),_0x53765c);})[_0xe02c('0x4d')](function(){delete _0x133f3a['channels'][_0x35fbe2];delete _0x133f3a[_0xe02c('0x11')][_0x35fbe2];});}else{ut[_0xe02c('0x49')](_0xe02c('0x4e'));delete this['channels'][_0x35fbe2];delete this[_0xe02c('0x11')][_0x35fbe2];}};Fax[_0xe02c('0x1d')]['syncHangup']=function(_0x3788e8){var _0x31ba51=this;if(this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]){if(this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]){this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]['id']=this[_0xe02c('0x11')][_0x3788e8['uniqueid']]['id'];this['channels'][_0x3788e8['uniqueid']][_0xe02c('0x23')]=this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]['name'];}logger['info'](_0x3788e8[_0xe02c('0x25')],this[_0xe02c('0x11')][_0x3788e8[_0xe02c('0x25')]]?_0xe02c('0x4f'):_0xe02c('0x50'),JSON['stringify'](this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]]));if(this['actions'][_0x3788e8['uniqueid']]){if(this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x51')]===_0xe02c('0x52')){this[_0xe02c('0x4b')](_0x3788e8[_0xe02c('0x25')],!![]);}else{this[_0xe02c('0x4b')](_0x3788e8['uniqueid'],![],this[_0xe02c('0xe')][_0x3788e8['uniqueid']]['faxstatusstring']?_0xe02c('0x53')+this[_0xe02c('0xe')][_0x3788e8[_0xe02c('0x25')]][_0xe02c('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xe02c('0x1d')][_0xe02c('0x55')]=function(_0x5d2119){var _0xa7133f=this;return new BPromise(function(_0x44bfd0,_0x4cc74d){_0xa7133f[_0xe02c('0x56')](_0x5d2119,_0xa7133f[_0xe02c('0xf')][_0x5d2119[_0xe02c('0x57')]])[_0xe02c('0x3b')](function(_0x323f3b){ut[_0xe02c('0x49')](_0xe02c('0x58'),_0x323f3b);_0x44bfd0(ut['message'](_0xe02c('0x59')));})['catch'](function(_0x558344){ut['logger'](_0xe02c('0x5a'),_0x558344);updateStatus(_0x5d2119);_0x4cc74d(ut[_0xe02c('0x36')](_0xe02c('0x5b')));});});};Fax[_0xe02c('0x1d')]['checkAfterSend']=function(_0x32e149){var _0x327777=this;return new BPromise(function(_0x503bb3,_0x597a64){var _0x4b0ec3=_0x327777[_0xe02c('0x5c')](_0x327777[_0xe02c('0xf')][_0x32e149['FaxAccountId']]['Trunk'],_0x32e149);if(_0x4b0ec3[_0xe02c('0x5d')]){_0x503bb3(ut[_0xe02c('0x36')](_0xe02c('0x5e')));}else{_0x597a64(ut[_0xe02c('0x36')](_0x4b0ec3[_0xe02c('0x36')]));}});};function originate(_0x5bb01d,_0x39c7db,_0x12ac9f){return new BPromise(function(_0x3f277b,_0x2776c0){if(_0x12ac9f){var _0x11c506=util[_0xe02c('0x5f')]('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[_0xe02c('0x38')](_0x5bb01d[_0xe02c('0x60')])['name'],_0x5bb01d[_0xe02c('0x60')]);gs[_0xe02c('0x61')](_0x11c506)[_0xe02c('0x3b')](function(){_0x5bb01d[_0xe02c('0x60')]=util['format'](_0xe02c('0x62'),path[_0xe02c('0x38')](_0x5bb01d['path'])['dir'],path['parse'](_0x5bb01d[_0xe02c('0x60')])[_0xe02c('0x23')]);_0x39c7db[_0xe02c('0x63')]=_0x5bb01d[_0xe02c('0x60')];ut[_0xe02c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))[_0xe02c('0x3b')](function(_0x4cc653){_0x3f277b(_0x4cc653);})['catch'](function(_0x4c3c91){_0x2776c0(_0x4c3c91);});})[_0xe02c('0x3d')](function(_0x43d7f7){_0x2776c0(_0x43d7f7);});}else{ami[_0xe02c('0x64')](ut[_0xe02c('0x65')](_0x5bb01d,_0x39c7db))['then'](function(_0x182805){_0x3f277b(_0x182805);})['catch'](function(_0x5a5dba){_0x2776c0(_0x5a5dba);});}});}Fax[_0xe02c('0x1d')][_0xe02c('0x56')]=function(_0x331061,_0x1bbf6a){var _0xea4547=this;return new BPromise(function(_0x2d132e,_0x748217){var _0x12aaea=uuid['v4']();var _0x5ead59=ut[_0xe02c('0x66')](_0x331061,_0x1bbf6a);_0xea4547[_0xe02c('0x11')][_0x12aaea]=new Action(_0x12aaea,_0x1bbf6a,_0x331061);var _0x2386cf=_0xea4547[_0xe02c('0x11')][_0x12aaea];if(path[_0xe02c('0x38')](_0x331061[_0xe02c('0x60')])[_0xe02c('0x67')]===_0xe02c('0x39')){originate(_0x2386cf,_0x5ead59,!![])[_0xe02c('0x3b')](function(_0x411cd5){_0x2d132e(_0x411cd5);})['catch'](function(_0x58acfd){_0x748217(_0x58acfd);});}else{originate(_0x2386cf,_0x5ead59,![])[_0xe02c('0x3b')](function(_0x2a5d54){_0x2d132e(_0x2a5d54);})[_0xe02c('0x3d')](function(_0x76fb21){_0x748217(_0x76fb21);});}});};Fax[_0xe02c('0x1d')]['isTrunkReachable']=function(_0x405b16){return!_[_0xe02c('0x68')](_0x405b16)&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x23')])&&!_[_0xe02c('0x68')](_0x405b16[_0xe02c('0x69')])&&_0x405b16[_0xe02c('0x69')]&&!_[_0xe02c('0x68')](this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])])&&!_['isNil'](this['trunks'][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16['name'])][_0xe02c('0x2d')])&&(this['trunks'][util[_0xe02c('0x5f')]('SIP/%s',_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6b')||this[_0xe02c('0x10')][util[_0xe02c('0x5f')](_0xe02c('0x6a'),_0x405b16[_0xe02c('0x23')])][_0xe02c('0x2d')]===_0xe02c('0x6c'));};Fax[_0xe02c('0x1d')]['checkTrunk']=function(_0x5a118f,_0x4d6753){if(!this[_0xe02c('0x6d')](_0x5a118f)){ut[_0xe02c('0x49')](_0xe02c('0x6e'),_[_0xe02c('0x68')](_0x5a118f)?'':_0x5a118f[_0xe02c('0x23')]+_0xe02c('0x6f'));return{'isValid':![],'message':_0xe02c('0x70')};}if(_[_0xe02c('0x68')](_0x4d6753[_0xe02c('0x7')])){ut[_0xe02c('0x49')](_0xe02c('0x71'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':_0xe02c('0x72')};}if(_['isNil'](_0x4d6753['path'])){ut[_0xe02c('0x49')](_0xe02c('0x73'),JSON[_0xe02c('0x40')](_0x4d6753));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xe02c('0x74')};};module[_0xe02c('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f406afd..b7b0aed 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 _0x4588=['inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4588,0x155));var _0x8458=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x4588[_0x23b655];return _0x364b32;};'use strict';var util=require(_0x8458('0x0'));var BPromise=require(_0x8458('0x1'));var logger=require(_0x8458('0x2'))(_0x8458('0x3'));var _=require(_0x8458('0x4'));var faxAccount=require(_0x8458('0x5'));function loggerCatch(_0x29c90f){return function(_0x38ffd8){logger[_0x8458('0x6')](_0x29c90f,util[_0x8458('0x7')](_0x38ffd8,{'showHidden':![],'depth':null}));};}exports[_0x8458('0x8')]=function(_0x3a47f9,_0x51f67e){return BPromise[_0x8458('0x9')]()['then'](faxAccount[_0x8458('0x8')](_0x3a47f9,_0x51f67e))[_0x8458('0xa')](loggerCatch(_0x8458('0xb')));}; \ No newline at end of file +var _0xc2fd=['notify','catch','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x473052,_0x36de92){var _0x3982ca=function(_0x17a192){while(--_0x17a192){_0x473052['push'](_0x473052['shift']());}};_0x3982ca(++_0x36de92);}(_0xc2fd,0x65));var _0xdc2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc2fd[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0xdc2f('0x0'));var BPromise=require(_0xdc2f('0x1'));var logger=require(_0xdc2f('0x2'))(_0xdc2f('0x3'));var _=require('lodash');var faxAccount=require(_0xdc2f('0x4'));function loggerCatch(_0xfa38de){return function(_0x30de62){logger[_0xdc2f('0x5')](_0xfa38de,util[_0xdc2f('0x6')](_0x30de62,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x49b923,_0xa890b6){return BPromise[_0xdc2f('0x7')]()[_0xdc2f('0x8')](faxAccount[_0xdc2f('0x9')](_0x49b923,_0xa890b6))[_0xdc2f('0xa')](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 f417f8d..b667823 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 _0x09ee=['util','../../../../config/logger','bluebird','child_process','execute','info','inspect'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x09ee,0x149));var _0xe09e=function(_0x1e1858,_0x2bc0ec){_0x1e1858=_0x1e1858-0x0;var _0x4d8d7a=_0x09ee[_0x1e1858];return _0x4d8d7a;};'use strict';var util=require(_0xe09e('0x0'));var logger=require(_0xe09e('0x1'))('fax');var BPromise=require(_0xe09e('0x2'));var exec=require(_0xe09e('0x3'))['exec'];exports[_0xe09e('0x4')]=function(_0x21f55e){return new BPromise(function(_0x1d70de,_0x1703c9){exec(_0x21f55e,function(_0x2db072,_0x1144cd,_0x36b613){logger['info']('Exec\x20gs',_0x1144cd);if(_0x2db072){logger[_0xe09e('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0xe09e('0x6')](_0x2db072,{'showHidden':![],'depth':null}),_0x1144cd,_0x36b613);_0x1703c9(_0x2db072);}_0x1d70de(_0x1144cd);});});}; \ No newline at end of file +var _0x0848=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0848,0xdb));var _0x8084=function(_0x929dab,_0x5b26e5){_0x929dab=_0x929dab-0x0;var _0x24f366=_0x0848[_0x929dab];return _0x24f366;};'use strict';var util=require(_0x8084('0x0'));var logger=require('../../../../config/logger')(_0x8084('0x1'));var BPromise=require(_0x8084('0x2'));var exec=require(_0x8084('0x3'))[_0x8084('0x4')];exports[_0x8084('0x5')]=function(_0x38744e){return new BPromise(function(_0x517d8b,_0x3f7453){exec(_0x38744e,function(_0x3b8e64,_0x422fb4,_0x52ecb3){logger[_0x8084('0x6')]('Exec\x20gs',_0x422fb4);if(_0x3b8e64){logger['info'](_0x8084('0x7'),_0x8084('0x8'),util[_0x8084('0x9')](_0x3b8e64,{'showHidden':![],'depth':null}),_0x422fb4,_0x52ecb3);_0x3f7453(_0x3b8e64);}_0x517d8b(_0x422fb4);});});}; \ 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 0580a33..917cf49 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 _0x1333=['channel','xcally-motion-fax','from-sip','lodash','moment','fax','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','t38timeout','localstationid','path','variablesAction','uniqueid','originate'];(function(_0x5a2407,_0x424b22){var _0x78524b=function(_0x5bbb6f){while(--_0x5bbb6f){_0x5a2407['push'](_0x5a2407['shift']());}};_0x78524b(++_0x424b22);}(_0x1333,0x137));var _0x3133=function(_0x484a4d,_0x31f4b3){_0x484a4d=_0x484a4d-0x0;var _0x515e22=_0x1333[_0x484a4d];return _0x515e22;};'use strict';var util=require('util');var _=require(_0x3133('0x0'));var moment=require(_0x3133('0x1'));var logger=require('../../../../config/logger')(_0x3133('0x2'));exports['message']=function(_0x445a37){return{'message':_0x445a37};};exports[_0x3133('0x3')]=function(_0x29f4df,_0x2d3bf6){logger[_0x3133('0x4')](_0x29f4df,util[_0x3133('0x5')](_0x2d3bf6,{'showHidden':![],'depth':null}));};exports[_0x3133('0x6')]=function(_0x246397,_0x23d25d){var _0xce7964={'XMF-ECM':_0x23d25d[_0x3133('0x7')],'XMF-HEADERINFO':_0x23d25d[_0x3133('0x8')],'XMF-MINRATE':_0x23d25d[_0x3133('0x9')],'XMF-MAXRATE':_0x23d25d[_0x3133('0xa')],'XMF-MODEM':util[_0x3133('0xb')](_0x3133('0xc'),_0x23d25d['modem']),'XMF-GATEWAY':_0x23d25d['gateway'],'XMF-FAXDETECT':_0x23d25d['faxdetect'],'XMF-T38TIMEOUT':_0x23d25d[_0x3133('0xd')],'XMF-LOCALSTATIONID':_0x23d25d[_0x3133('0xe')],'XMF-PATH':_0x246397[_0x3133('0xf')]};return _0xce7964;};exports[_0x3133('0x10')]=function(_0x217125,_0x3a8ff3){return{'actionid':_0x217125[_0x3133('0x11')],'action':_0x3133('0x12'),'channel':_0x217125[_0x3133('0x13')],'Exten':_0x3133('0x14'),'Context':_0x3133('0x15'),'Priority':'1','callerid':util[_0x3133('0xb')]('\x22%s\x22\x20<%s>',_0x217125['headerinfo']?_0x217125[_0x3133('0x8')]:'',_0x217125[_0x3133('0xe')]),'variable':_0x3a8ff3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x217125[_0x3133('0x11')]};}; \ No newline at end of file +var _0xed51=['maxrate','modem','gateway','faxdetect','t38timeout','uniqueid','format','\x22%s\x22\x20<%s>','headerinfo','localstationid','lodash','fax','message','info','inspect','ecm','minrate'];(function(_0x3cb98e,_0x2ce8ad){var _0x22eb26=function(_0x396cb6){while(--_0x396cb6){_0x3cb98e['push'](_0x3cb98e['shift']());}};_0x22eb26(++_0x2ce8ad);}(_0xed51,0x1d5));var _0x1ed5=function(_0x31e2cb,_0x56ab33){_0x31e2cb=_0x31e2cb-0x0;var _0x2da091=_0xed51[_0x31e2cb];return _0x2da091;};'use strict';var util=require('util');var _=require(_0x1ed5('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x1ed5('0x1'));exports[_0x1ed5('0x2')]=function(_0x41d5ed){return{'message':_0x41d5ed};};exports['logger']=function(_0x41518d,_0x61e3de){logger[_0x1ed5('0x3')](_0x41518d,util[_0x1ed5('0x4')](_0x61e3de,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x39f90d,_0x3b5627){var _0x28b986={'XMF-ECM':_0x3b5627[_0x1ed5('0x5')],'XMF-HEADERINFO':_0x3b5627['headerinfo'],'XMF-MINRATE':_0x3b5627[_0x1ed5('0x6')],'XMF-MAXRATE':_0x3b5627[_0x1ed5('0x7')],'XMF-MODEM':util['format']('\x22%s\x22',_0x3b5627[_0x1ed5('0x8')]),'XMF-GATEWAY':_0x3b5627[_0x1ed5('0x9')],'XMF-FAXDETECT':_0x3b5627[_0x1ed5('0xa')],'XMF-T38TIMEOUT':_0x3b5627[_0x1ed5('0xb')],'XMF-LOCALSTATIONID':_0x3b5627['localstationid'],'XMF-PATH':_0x39f90d['path']};return _0x28b986;};exports['variablesAction']=function(_0x59c889,_0x3bf612){return{'actionid':_0x59c889[_0x1ed5('0xc')],'action':'originate','channel':_0x59c889['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x1ed5('0xd')](_0x1ed5('0xe'),_0x59c889['headerinfo']?_0x59c889[_0x1ed5('0xf')]:'',_0x59c889[_0x1ed5('0x10')]),'variable':_0x3bf612,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x59c889[_0x1ed5('0xc')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bc839a6..d4d1fe1 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 _0x80cc=['./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','listen','catch','util','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x80cc,0xfa));var _0xc80c=function(_0x11ea79,_0x511dc6){_0x11ea79=_0x11ea79-0x0;var _0x107ef2=_0x80cc[_0x11ea79];return _0x107ef2;};'use strict';var BPromise=require('bluebird');var util=require(_0xc80c('0x0'));var moment=require('moment');var server=require(_0xc80c('0x1'));var Realtime=require(_0xc80c('0x2'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xc80c('0x3'));var Dialer=require(_0xc80c('0x4'));var Preview=require(_0xc80c('0x5'));var Fax=require(_0xc80c('0x6'));var user=require(_0xc80c('0x7'));var voiceQueue=require(_0xc80c('0x8'));var voiceQueueReport=require(_0xc80c('0x9'));var voiceCallReport=require(_0xc80c('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xc80c('0xb'));var template=require(_0xc80c('0xc'));var cmHopperHistory=require(_0xc80c('0xd'));var campaign=require(_0xc80c('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xc80c('0xf'));var zendesk=require(_0xc80c('0x10'));var salesforce=require(_0xc80c('0x11'));var sugarcrm=require(_0xc80c('0x12'));var freshdesk=require(_0xc80c('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc80c('0x14'));var vtiger=require(_0xc80c('0x15'));var freshsales=require(_0xc80c('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xc80c('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xc80c('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc80c('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc80c('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc80c('0x1b')]()[_0xc80c('0x1c')](user[_0xc80c('0x1d')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x1e')]())[_0xc80c('0x1c')](user[_0xc80c('0x1f')]())['then'](realtime[_0xc80c('0x20')]())[_0xc80c('0x1c')](trunk[_0xc80c('0x21')]())[_0xc80c('0x1c')](realtime['initTrunks']())[_0xc80c('0x1c')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())[_0xc80c('0x1c')](trigger[_0xc80c('0x22')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x23')]())['then'](template[_0xc80c('0x24')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x25')]())[_0xc80c('0x1c')](zendesk[_0xc80c('0x26')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x27')]())[_0xc80c('0x1c')](salesforce[_0xc80c('0x28')]())['then'](realtime[_0xc80c('0x29')]())[_0xc80c('0x1c')](sugarcrm[_0xc80c('0x2a')]())[_0xc80c('0x1c')](realtime['initSugarcrmAccounts']())[_0xc80c('0x1c')](freshdesk[_0xc80c('0x2b')]())[_0xc80c('0x1c')](realtime['initFreshdeskAccounts']())[_0xc80c('0x1c')](desk['getDeskAccounts']())[_0xc80c('0x1c')](realtime[_0xc80c('0x2c')]())[_0xc80c('0x1c')](zoho['getZohoAccounts']())[_0xc80c('0x1c')](realtime[_0xc80c('0x2d')]())[_0xc80c('0x1c')](vtiger[_0xc80c('0x2e')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x2f')]())[_0xc80c('0x1c')](freshsales[_0xc80c('0x30')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x31')]())['then'](servicenow['getServicenowAccounts']())['then'](realtime[_0xc80c('0x32')]())[_0xc80c('0x1c')](dynamics365[_0xc80c('0x33')]())['then'](realtime['initDynamics365Accounts']())[_0xc80c('0x1c')](campaign[_0xc80c('0x34')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x35')]())[_0xc80c('0x1c')](voiceExtension['getVoiceExtensions']())[_0xc80c('0x1c')](realtime[_0xc80c('0x36')]())['then'](faxAccount[_0xc80c('0x37')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x38')]())[_0xc80c('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xc80c('0x1b')]()[_0xc80c('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xc80c('0x1c')](realtime[_0xc80c('0x39')]())[_0xc80c('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xc80c('0x3a')]())['then'](cmHopperHistory[_0xc80c('0x3b')]())['then'](realtime[_0xc80c('0x3c')]())[_0xc80c('0x1c')](voiceCallReport[_0xc80c('0x3d')]())[_0xc80c('0x1c')](realtime[_0xc80c('0x3e')]())['catch'](function(_0x2fdeb2){logger['error'](_0xc80c('0x3f'),util[_0xc80c('0x40')](_0x2fdeb2,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc80c('0x41')](realtime,preview,fax)[_0xc80c('0x1c')](function(_0x162167){return initRealtime();})['then'](function(){return initParams();})[_0xc80c('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xc80c('0x42')](function(_0x3d3ef2){logger['error']('[index.js][main]',util['inspect'](_0x3d3ef2,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x9849=['listen','sync','catch','[index.js][main]','inspect','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','../../config/logger','ami','hour','get','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','error'];(function(_0x963390,_0x445fd2){var _0xc1da02=function(_0x2e958d){while(--_0x2e958d){_0x963390['push'](_0x963390['shift']());}};_0xc1da02(++_0x445fd2);}(_0x9849,0x8d));var _0x9984=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9849[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require('bluebird');var util=require(_0x9984('0x0'));var moment=require('moment');var server=require(_0x9984('0x1'));var Realtime=require(_0x9984('0x2'));var Report=require(_0x9984('0x3'));var Acw=require(_0x9984('0x4'));var Trigger=require(_0x9984('0x5'));var Dialer=require(_0x9984('0x6'));var Preview=require(_0x9984('0x7'));var Fax=require(_0x9984('0x8'));var user=require(_0x9984('0x9'));var voiceQueue=require(_0x9984('0xa'));var voiceQueueReport=require(_0x9984('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x9984('0xc'));var trigger=require(_0x9984('0xd'));var template=require(_0x9984('0xe'));var cmHopperHistory=require(_0x9984('0xf'));var campaign=require(_0x9984('0x10'));var voiceExtension=require(_0x9984('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x9984('0x12'));var salesforce=require(_0x9984('0x13'));var sugarcrm=require(_0x9984('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x9984('0x15'));var zoho=require(_0x9984('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x9984('0x17'))(_0x9984('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x9984('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9984('0x1a')](_0x9984('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9984('0x1b')]()['then'](user[_0x9984('0x1c')]())['then'](realtime['initAgents']())[_0x9984('0x1d')](user[_0x9984('0x1e')]())[_0x9984('0x1d')](realtime[_0x9984('0x1f')]())[_0x9984('0x1d')](trunk[_0x9984('0x20')]())[_0x9984('0x1d')](realtime[_0x9984('0x21')]())[_0x9984('0x1d')](voiceQueue[_0x9984('0x22')]())[_0x9984('0x1d')](realtime['initVoiceQueues']())[_0x9984('0x1d')](trigger[_0x9984('0x23')]())[_0x9984('0x1d')](realtime[_0x9984('0x24')]())[_0x9984('0x1d')](template['getTemplates']())[_0x9984('0x1d')](realtime[_0x9984('0x25')]())['then'](zendesk[_0x9984('0x26')]())['then'](realtime[_0x9984('0x27')]())[_0x9984('0x1d')](salesforce[_0x9984('0x28')]())['then'](realtime['initSalesforceAccounts']())[_0x9984('0x1d')](sugarcrm[_0x9984('0x29')]())[_0x9984('0x1d')](realtime['initSugarcrmAccounts']())[_0x9984('0x1d')](freshdesk[_0x9984('0x2a')]())[_0x9984('0x1d')](realtime[_0x9984('0x2b')]())[_0x9984('0x1d')](desk['getDeskAccounts']())[_0x9984('0x1d')](realtime[_0x9984('0x2c')]())[_0x9984('0x1d')](zoho[_0x9984('0x2d')]())[_0x9984('0x1d')](realtime['initZohoAccounts']())['then'](vtiger[_0x9984('0x2e')]())[_0x9984('0x1d')](realtime[_0x9984('0x2f')]())['then'](freshsales['getFreshsalesAccounts']())[_0x9984('0x1d')](realtime[_0x9984('0x30')]())[_0x9984('0x1d')](servicenow[_0x9984('0x31')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365[_0x9984('0x32')]())[_0x9984('0x1d')](realtime[_0x9984('0x33')]())[_0x9984('0x1d')](campaign[_0x9984('0x34')]())[_0x9984('0x1d')](realtime[_0x9984('0x35')]())[_0x9984('0x1d')](voiceExtension[_0x9984('0x36')]())[_0x9984('0x1d')](realtime['initVoiceExtensions']())[_0x9984('0x1d')](faxAccount[_0x9984('0x37')]())[_0x9984('0x1d')](realtime[_0x9984('0x38')]())[_0x9984('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x9984('0x1b')]()[_0x9984('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x9984('0x1d')](realtime[_0x9984('0x39')]())[_0x9984('0x1d')](cmHopperHistory[_0x9984('0x3a')]())[_0x9984('0x1d')](realtime[_0x9984('0x3b')]())['then'](cmHopperHistory[_0x9984('0x3c')]())['then'](realtime['initCampaignHopperHistory']())[_0x9984('0x1d')](voiceCallReport[_0x9984('0x3d')]())[_0x9984('0x1d')](realtime['initVoiceCallReports']())['catch'](function(_0x335df2){logger[_0x9984('0x3e')]('[index.js][initParams]',util['inspect'](_0x335df2,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9984('0x3f')](realtime,preview,fax)[_0x9984('0x1d')](function(_0x60aeec){return initRealtime();})[_0x9984('0x1d')](function(){return initParams();})[_0x9984('0x1d')](function(){report[_0x9984('0x40')]();setInterval(initRealtime,0x1388);})[_0x9984('0x41')](function(_0x464b07){logger['error'](_0x9984('0x42'),util[_0x9984('0x43')](_0x464b07,{'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 6961a3d..33dd7fa 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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x2fbf2c,_0xb5a8f9){var _0x132005=function(_0xaa95bb){while(--_0xaa95bb){_0x2fbf2c['push'](_0x2fbf2c['shift']());}};_0x132005(++_0xb5a8f9);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file +var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x1b8625,_0x3b940c){var _0xeb3257=function(_0xb417cb){while(--_0xb417cb){_0x1b8625['push'](_0x1b8625['shift']());}};_0xeb3257(++_0x3b940c);}(_0x70e0,0x17b));var _0x070e=function(_0x34882e,_0x297c11){_0x34882e=_0x34882e-0x0;var _0x1b5c4a=_0x70e0[_0x34882e];return _0x1b5c4a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 93f3fb1..ba43281 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 _0x2ae4=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','originated','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x2ae4,0x6e));var _0x42ae=function(_0x287009,_0x16e129){_0x287009=_0x287009-0x0;var _0x54f613=_0x2ae4[_0x287009];return _0x54f613;};'use strict';function Campaign(_0x3be0d2){this['id']=_0x3be0d2['id']||0x0;this[_0x42ae('0x0')]=_0x3be0d2['name']||'';this['type']=_0x3be0d2['type']||'campaign';this[_0x42ae('0x1')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x42ae('0x2')]='';this[_0x42ae('0x3')]=!![];this['active']=_0x3be0d2[_0x42ae('0x4')];this[_0x42ae('0x5')]=_0x3be0d2[_0x42ae('0x5')];this[_0x42ae('0x6')]=_0x3be0d2[_0x42ae('0x6')]||null;this[_0x42ae('0x7')]=_0x3be0d2[_0x42ae('0x7')]?_0x3be0d2[_0x42ae('0x7')]:null;this['dialOriginateCallerIdName']=_0x3be0d2[_0x42ae('0x8')];this['dialOriginateCallerIdNumber']=_0x3be0d2['dialOriginateCallerIdNumber'];this[_0x42ae('0x9')]=_0x3be0d2['dialOriginateTimeout']||0x1e;this[_0x42ae('0xa')]=_0x3be0d2[_0x42ae('0xa')];this[_0x42ae('0xb')]=_0x3be0d2[_0x42ae('0xb')];this[_0x42ae('0xc')]=_0x3be0d2[_0x42ae('0xc')];this[_0x42ae('0xd')]=_0x3be0d2[_0x42ae('0xd')];this[_0x42ae('0xe')]=_0x3be0d2[_0x42ae('0xe')];this[_0x42ae('0xf')]=_0x3be0d2['dialNoAnswerRetryFrequency'];this[_0x42ae('0x10')]=_0x3be0d2['dialGlobalMaxRetry'];this[_0x42ae('0x11')]=_0x3be0d2[_0x42ae('0x11')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3be0d2['dialNoSuchNumberRetryFrequency']||0x96;this[_0x42ae('0x12')]=_0x3be0d2['dialDropMaxRetry']||0x3;this[_0x42ae('0x13')]=_0x3be0d2[_0x42ae('0x13')]||0x96;this[_0x42ae('0x14')]=_0x3be0d2[_0x42ae('0x14')]||0x3;this[_0x42ae('0x15')]=_0x3be0d2[_0x42ae('0x15')]||0x96;this[_0x42ae('0x16')]=_0x3be0d2[_0x42ae('0x16')]||0x3;this[_0x42ae('0x17')]=_0x3be0d2[_0x42ae('0x17')]||0x96;this[_0x42ae('0x18')]=_0x3be0d2[_0x42ae('0x18')]||0x3;this[_0x42ae('0x19')]=_0x3be0d2['dialAgentRejectRetryFrequency']||0x96;this[_0x42ae('0x1a')]=_0x3be0d2[_0x42ae('0x1a')]||_0x42ae('0x1b');this[_0x42ae('0x1c')]=_0x3be0d2[_0x42ae('0x1c')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3be0d2[_0x42ae('0x1d')]||undefined;this[_0x42ae('0x1e')]=_0x3be0d2[_0x42ae('0x1e')]||undefined;this[_0x42ae('0x1f')]=_0x3be0d2['TrunkBackup']?_0x3be0d2[_0x42ae('0x1f')]:undefined;this['Trunk']=_0x3be0d2['Trunk']?_0x3be0d2[_0x42ae('0x20')]:undefined;this[_0x42ae('0x21')]=_0x3be0d2[_0x42ae('0x21')]?_0x3be0d2[_0x42ae('0x21')]:undefined;this['SquareProject']=_0x3be0d2['SquareProject']?_0x3be0d2[_0x42ae('0x22')]:undefined;this['dialQueueProject']=_0x3be0d2[_0x42ae('0x22')]?_0x3be0d2[_0x42ae('0x22')][_0x42ae('0x0')]:undefined;this[_0x42ae('0x23')]=_0x3be0d2[_0x42ae('0x23')]||![];this[_0x42ae('0x24')]=_0x3be0d2[_0x42ae('0x24')];this[_0x42ae('0x25')]=_0x3be0d2[_0x42ae('0x25')];this['dialAMDAfterGreetingSilence']=_0x3be0d2['dialAMDAfterGreetingSilence'];this[_0x42ae('0x26')]=_0x3be0d2[_0x42ae('0x26')];this[_0x42ae('0x27')]=_0x3be0d2[_0x42ae('0x27')];this[_0x42ae('0x28')]=_0x3be0d2[_0x42ae('0x28')];this[_0x42ae('0x29')]=_0x3be0d2[_0x42ae('0x29')];this[_0x42ae('0x2a')]=_0x3be0d2[_0x42ae('0x2a')];this[_0x42ae('0x2b')]=_0x3be0d2[_0x42ae('0x2b')];}module['exports']=Campaign; \ No newline at end of file +var _0x27da=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x27da,0xf5));var _0xa27d=function(_0x3eaf00,_0x9ded0f){_0x3eaf00=_0x3eaf00-0x0;var _0x825c50=_0x27da[_0x3eaf00];return _0x825c50;};'use strict';function Campaign(_0x29e707){this['id']=_0x29e707['id']||0x0;this[_0xa27d('0x0')]=_0x29e707[_0xa27d('0x0')]||'';this[_0xa27d('0x1')]=_0x29e707['type']||_0xa27d('0x2');this[_0xa27d('0x3')]=0x0;this['temp']=0x0;this[_0xa27d('0x4')]=0x0;this[_0xa27d('0x5')]=0x0;this[_0xa27d('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0xa27d('0x7')]=_0x29e707[_0xa27d('0x7')];this['limitCalls']=_0x29e707[_0xa27d('0x8')];this[_0xa27d('0x9')]=_0x29e707[_0xa27d('0x9')]||null;this[_0xa27d('0xa')]=_0x29e707[_0xa27d('0xa')]?_0x29e707[_0xa27d('0xa')]:null;this['dialOriginateCallerIdName']=_0x29e707[_0xa27d('0xb')];this[_0xa27d('0xc')]=_0x29e707[_0xa27d('0xc')];this['dialOriginateTimeout']=_0x29e707[_0xa27d('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x29e707[_0xa27d('0xe')];this[_0xa27d('0xf')]=_0x29e707[_0xa27d('0xf')];this['dialBusyMaxRetry']=_0x29e707[_0xa27d('0x10')];this['dialBusyRetryFrequency']=_0x29e707[_0xa27d('0x11')];this[_0xa27d('0x12')]=_0x29e707['dialNoAnswerMaxRetry'];this[_0xa27d('0x13')]=_0x29e707[_0xa27d('0x13')];this['dialGlobalMaxRetry']=_0x29e707[_0xa27d('0x14')];this[_0xa27d('0x15')]=_0x29e707[_0xa27d('0x15')]||0x3;this[_0xa27d('0x16')]=_0x29e707[_0xa27d('0x16')]||0x96;this[_0xa27d('0x17')]=_0x29e707[_0xa27d('0x17')]||0x3;this[_0xa27d('0x18')]=_0x29e707[_0xa27d('0x18')]||0x96;this[_0xa27d('0x19')]=_0x29e707[_0xa27d('0x19')]||0x3;this[_0xa27d('0x1a')]=_0x29e707[_0xa27d('0x1a')]||0x96;this[_0xa27d('0x1b')]=_0x29e707[_0xa27d('0x1b')]||0x3;this[_0xa27d('0x1c')]=_0x29e707[_0xa27d('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x29e707[_0xa27d('0x1d')]||0x3;this[_0xa27d('0x1e')]=_0x29e707[_0xa27d('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x29e707[_0xa27d('0x1f')]||_0xa27d('0x20');this[_0xa27d('0x21')]=_0x29e707[_0xa27d('0x21')]||undefined;this[_0xa27d('0x22')]=_0x29e707['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xa27d('0x23')]=_0x29e707[_0xa27d('0x23')]||undefined;this[_0xa27d('0x24')]=_0x29e707['TrunkBackup']?_0x29e707[_0xa27d('0x24')]:undefined;this['Trunk']=_0x29e707['Trunk']?_0x29e707['Trunk']:undefined;this[_0xa27d('0x25')]=_0x29e707[_0xa27d('0x25')]?_0x29e707[_0xa27d('0x25')]:undefined;this['SquareProject']=_0x29e707[_0xa27d('0x26')]?_0x29e707[_0xa27d('0x26')]:undefined;this[_0xa27d('0x27')]=_0x29e707[_0xa27d('0x26')]?_0x29e707['SquareProject'][_0xa27d('0x0')]:undefined;this[_0xa27d('0x28')]=_0x29e707[_0xa27d('0x28')]||![];this['dialAMDInitialSilence']=_0x29e707[_0xa27d('0x29')];this[_0xa27d('0x2a')]=_0x29e707[_0xa27d('0x2a')];this[_0xa27d('0x2b')]=_0x29e707[_0xa27d('0x2b')];this[_0xa27d('0x2c')]=_0x29e707['dialAMDTotalAnalysisTime'];this[_0xa27d('0x2d')]=_0x29e707[_0xa27d('0x2d')];this[_0xa27d('0x2e')]=_0x29e707[_0xa27d('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x29e707[_0xa27d('0x2f')];this[_0xa27d('0x30')]=_0x29e707[_0xa27d('0x30')];this[_0xa27d('0x31')]=_0x29e707[_0xa27d('0x31')];}module[_0xa27d('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index cf6b2c6..83b122b 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(_0x33b055,_0x3f9370){var _0x88fa1c=function(_0x3c0ec4){while(--_0x3c0ec4){_0x33b055['push'](_0x33b055['shift']());}};_0x88fa1c(++_0x3f9370);}(_0x8ff4,0x11f));var _0x48ff=function(_0x2724ab,_0x4890a8){_0x2724ab=_0x2724ab-0x0;var _0x3e05d8=_0x8ff4[_0x2724ab];return _0x3e05d8;};'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 _0xdbc6=['transfercalleridnum','transferconnectedlinenum','exports','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','tag','disposition','monitorFilename','queue','monitors'];(function(_0x285115,_0x22f186){var _0x3b00a5=function(_0x433817){while(--_0x433817){_0x285115['push'](_0x285115['shift']());}};_0x3b00a5(++_0x22f186);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x2eac59,_0x2a5b64){_0x2eac59=_0x2eac59-0x0;var _0x268bd9=_0xdbc6[_0x2eac59];return _0x268bd9;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x6dbc('0x0')]='';this['calleridnum']=0x0;this[_0x6dbc('0x1')]='';this[_0x6dbc('0x2')]=undefined;this[_0x6dbc('0x3')]=undefined;this[_0x6dbc('0x4')]=0x0;this[_0x6dbc('0x5')]='';this[_0x6dbc('0x6')]=0x0;this['linkedid']=0x0;this[_0x6dbc('0x7')]=0x0;this[_0x6dbc('0x8')]=![];this['answertime']=null;this[_0x6dbc('0x9')]=null;this[_0x6dbc('0xa')]=![];this[_0x6dbc('0xb')]=![];this[_0x6dbc('0xc')]='';this[_0x6dbc('0xd')]='';this['duration']=0x0;this[_0x6dbc('0xe')]=0x0;this[_0x6dbc('0xf')]=0x0;this['type']=null;this[_0x6dbc('0x10')]=null;this[_0x6dbc('0x11')]=null;this['monitor']=![];this[_0x6dbc('0x12')]=null;this[_0x6dbc('0x13')]=null;this[_0x6dbc('0x14')]=[];this[_0x6dbc('0x15')]=undefined;this[_0x6dbc('0x16')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x6dbc('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 38dbc60..1db50a1 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 _0x43a4=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43a4,0x8d));var _0x443a=function(_0x776414,_0x10d2de){_0x776414=_0x776414-0x0;var _0x7ec5f6=_0x43a4[_0x776414];return _0x7ec5f6;};'use strict';function DeskAccount(_0xcbffd8){this['id']=_0xcbffd8['id']||0x0;this[_0x443a('0x0')]=_0xcbffd8[_0x443a('0x0')]||'';this[_0x443a('0x1')]=_0xcbffd8[_0x443a('0x1')]||'';this[_0x443a('0x2')]=_0xcbffd8['remoteUri']||'';this[_0x443a('0x3')]=_0xcbffd8[_0x443a('0x3')]||'';this['password']=_0xcbffd8[_0x443a('0x4')]||'';this[_0x443a('0x5')]=_0xcbffd8[_0x443a('0x5')]||'';this[_0x443a('0x6')]=_0xcbffd8[_0x443a('0x6')]||'';this[_0x443a('0x7')]=_0xcbffd8['token']||'';this[_0x443a('0x8')]=_0xcbffd8['tokenSecret']||'';this[_0x443a('0x9')]=_0xcbffd8[_0x443a('0x9')]||'';this['serverUrl']=_0xcbffd8[_0x443a('0xa')]||'';this[_0x443a('0xb')]=_0xcbffd8[_0x443a('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x86c6=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x86c6,0x1b5));var _0x686c=function(_0x495898,_0x4417db){_0x495898=_0x495898-0x0;var _0x29117a=_0x86c6[_0x495898];return _0x29117a;};'use strict';function DeskAccount(_0x304160){this['id']=_0x304160['id']||0x0;this[_0x686c('0x0')]=_0x304160[_0x686c('0x0')]||'';this[_0x686c('0x1')]=_0x304160[_0x686c('0x1')]||'';this[_0x686c('0x2')]=_0x304160['remoteUri']||'';this['authType']=_0x304160[_0x686c('0x3')]||'';this[_0x686c('0x4')]=_0x304160[_0x686c('0x4')]||'';this[_0x686c('0x5')]=_0x304160[_0x686c('0x5')]||'';this[_0x686c('0x6')]=_0x304160[_0x686c('0x6')]||'';this[_0x686c('0x7')]=_0x304160[_0x686c('0x7')]||'';this[_0x686c('0x8')]=_0x304160['tokenSecret']||'';this[_0x686c('0x9')]=_0x304160[_0x686c('0x9')]||'';this[_0x686c('0xa')]=_0x304160[_0x686c('0xa')]||'';this[_0x686c('0xb')]=_0x304160[_0x686c('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 3d4d4a5..7de8046 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 _0x8fc2=['Configurations','CloudProvider','exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0x8fc2,0x12c));var _0x28fc=function(_0x8b1862,_0x41368a){_0x8b1862=_0x8b1862-0x0;var _0x5dad8d=_0x8fc2[_0x8b1862];return _0x5dad8d;};'use strict';function Dynamics365Account(_0x1d651b){this['id']=_0x1d651b['id']||0x0;this[_0x28fc('0x0')]=_0x1d651b[_0x28fc('0x0')]||'';this['username']=_0x1d651b['username']||'';this[_0x28fc('0x1')]=_0x1d651b['password']||'';this['remoteUri']=_0x1d651b[_0x28fc('0x2')]||'';this['tenantId']=_0x1d651b[_0x28fc('0x3')]||'';this['clientId']=_0x1d651b[_0x28fc('0x4')]||'';this['clientSecret']=_0x1d651b[_0x28fc('0x5')]||{};this[_0x28fc('0x6')]=_0x1d651b['serverUrl']||'';this[_0x28fc('0x7')]=_0x1d651b[_0x28fc('0x7')]||![];this[_0x28fc('0x8')]=_0x1d651b[_0x28fc('0x8')]||{};this['CloudProvider']=_0x1d651b[_0x28fc('0x9')]||{};}module[_0x28fc('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xb494=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x392288,_0x54ee4f){var _0x3e1eb9=function(_0x24188c){while(--_0x24188c){_0x392288['push'](_0x392288['shift']());}};_0x3e1eb9(++_0x54ee4f);}(_0xb494,0x1ea));var _0x4b49=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xb494[_0xef8146];return _0x5a6cb0;};'use strict';function Dynamics365Account(_0x5f4e7e){this['id']=_0x5f4e7e['id']||0x0;this[_0x4b49('0x0')]=_0x5f4e7e['name']||'';this[_0x4b49('0x1')]=_0x5f4e7e[_0x4b49('0x1')]||'';this['password']=_0x5f4e7e[_0x4b49('0x2')]||'';this[_0x4b49('0x3')]=_0x5f4e7e[_0x4b49('0x3')]||'';this[_0x4b49('0x4')]=_0x5f4e7e[_0x4b49('0x4')]||'';this['clientId']=_0x5f4e7e[_0x4b49('0x5')]||'';this[_0x4b49('0x6')]=_0x5f4e7e[_0x4b49('0x6')]||{};this[_0x4b49('0x7')]=_0x5f4e7e['serverUrl']||'';this[_0x4b49('0x8')]=_0x5f4e7e['modernAuthentication']||![];this[_0x4b49('0x9')]=_0x5f4e7e[_0x4b49('0x9')]||{};this['CloudProvider']=_0x5f4e7e['CloudProvider']||{};}module[_0x4b49('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 53947d9..4171549 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 _0x1106=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x18ab26,_0x2cb289){var _0x4009b2=function(_0x1817c9){while(--_0x1817c9){_0x18ab26['push'](_0x18ab26['shift']());}};_0x4009b2(++_0x2cb289);}(_0x1106,0x99));var _0x6110=function(_0x49df79,_0x45d796){_0x49df79=_0x49df79-0x0;var _0x34febf=_0x1106[_0x49df79];return _0x34febf;};'use strict';function FaxAccount(_0x1255f2){this['id']=_0x1255f2['id']||0x0;this[_0x6110('0x0')]=_0x1255f2[_0x6110('0x0')]||'';this[_0x6110('0x1')]=_0x1255f2['description'];this[_0x6110('0x2')]=_0x1255f2[_0x6110('0x2')];this[_0x6110('0x3')]=_0x1255f2[_0x6110('0x3')];this[_0x6110('0x4')]=_0x1255f2[_0x6110('0x4')];this[_0x6110('0x5')]=_0x1255f2['minrate']||0x960;this[_0x6110('0x6')]=_0x1255f2[_0x6110('0x6')]||0x3840;this[_0x6110('0x7')]=_0x1255f2[_0x6110('0x7')]||_0x6110('0x8');this[_0x6110('0x9')]=_0x1255f2['gateway']||'no';this[_0x6110('0xa')]=_0x1255f2[_0x6110('0xa')]||'no';this[_0x6110('0xb')]=_0x1255f2[_0x6110('0xb')]||0x1388;this[_0x6110('0xc')]=_0x1255f2[_0x6110('0xc')]||_0x6110('0xd');this[_0x6110('0xe')]=_0x1255f2[_0x6110('0xe')]?_0x1255f2[_0x6110('0xe')]:undefined;this[_0x6110('0xf')]=_0x1255f2[_0x6110('0xf')];this['key']=_0x1255f2[_0x6110('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x85d0=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','t38timeout','tech','Trunk','ListId','key'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0x85d0,0x97));var _0x085d=function(_0x1bd405,_0x471909){_0x1bd405=_0x1bd405-0x0;var _0x48af49=_0x85d0[_0x1bd405];return _0x48af49;};'use strict';function FaxAccount(_0x38512f){this['id']=_0x38512f['id']||0x0;this[_0x085d('0x0')]=_0x38512f['name']||'';this['description']=_0x38512f[_0x085d('0x1')];this[_0x085d('0x2')]=_0x38512f[_0x085d('0x2')];this[_0x085d('0x3')]=_0x38512f[_0x085d('0x3')];this['localstationid']=_0x38512f[_0x085d('0x4')];this['minrate']=_0x38512f[_0x085d('0x5')]||0x960;this[_0x085d('0x6')]=_0x38512f[_0x085d('0x6')]||0x3840;this['modem']=_0x38512f[_0x085d('0x7')]||'v17,v27,v29';this[_0x085d('0x8')]=_0x38512f[_0x085d('0x8')]||'no';this['faxdetect']=_0x38512f['faxdetect']||'no';this[_0x085d('0x9')]=_0x38512f[_0x085d('0x9')]||0x1388;this[_0x085d('0xa')]=_0x38512f[_0x085d('0xa')]||'SIP';this[_0x085d('0xb')]=_0x38512f[_0x085d('0xb')]?_0x38512f[_0x085d('0xb')]:undefined;this['ListId']=_0x38512f[_0x085d('0xc')];this[_0x085d('0xd')]=_0x38512f[_0x085d('0xd')];}module[_0x085d('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4702862..7785383 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 _0x2b01=['exports','name','username','apiKey','token','serverUrl','Configurations'];(function(_0x2cea0e,_0x217e1b){var _0x95c171=function(_0x393e82){while(--_0x393e82){_0x2cea0e['push'](_0x2cea0e['shift']());}};_0x95c171(++_0x217e1b);}(_0x2b01,0x1e4));var _0x12b0=function(_0x1a1b24,_0x2a2514){_0x1a1b24=_0x1a1b24-0x0;var _0x3ee752=_0x2b01[_0x1a1b24];return _0x3ee752;};'use strict';function FreshdeskAccount(_0x551f78){this['id']=_0x551f78['id']||0x0;this[_0x12b0('0x0')]=_0x551f78[_0x12b0('0x0')]||'';this[_0x12b0('0x1')]=_0x551f78[_0x12b0('0x1')]||'';this[_0x12b0('0x2')]=_0x551f78[_0x12b0('0x3')]||'';this['remoteUri']=_0x551f78['remoteUri']||'';this[_0x12b0('0x4')]=_0x551f78[_0x12b0('0x4')]||'';this[_0x12b0('0x5')]=_0x551f78['Configurations']||{};}module[_0x12b0('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x5817=['serverUrl','name','username','apiKey','token','remoteUri'];(function(_0x4ee092,_0x5e9420){var _0x15d06b=function(_0x42d1d1){while(--_0x42d1d1){_0x4ee092['push'](_0x4ee092['shift']());}};_0x15d06b(++_0x5e9420);}(_0x5817,0x145));var _0x7581=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5817[_0x3b380d];return _0x54502b;};'use strict';function FreshdeskAccount(_0x444df1){this['id']=_0x444df1['id']||0x0;this[_0x7581('0x0')]=_0x444df1[_0x7581('0x0')]||'';this[_0x7581('0x1')]=_0x444df1[_0x7581('0x1')]||'';this[_0x7581('0x2')]=_0x444df1[_0x7581('0x3')]||'';this[_0x7581('0x4')]=_0x444df1[_0x7581('0x4')]||'';this[_0x7581('0x5')]=_0x444df1[_0x7581('0x5')]||'';this['Configurations']=_0x444df1['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f22cfbf..4c9ae7d 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 _0x2b83=['username','apiKey','token','serverUrl','Configurations','name'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x2b83,0x1d3));var _0x32b8=function(_0x3f6e13,_0x517137){_0x3f6e13=_0x3f6e13-0x0;var _0x5b5264=_0x2b83[_0x3f6e13];return _0x5b5264;};'use strict';function FreshsalesAccount(_0x52d8cb){this['id']=_0x52d8cb['id']||0x0;this[_0x32b8('0x0')]=_0x52d8cb[_0x32b8('0x0')]||'';this['username']=_0x52d8cb[_0x32b8('0x1')]||'';this[_0x32b8('0x2')]=_0x52d8cb[_0x32b8('0x3')]||'';this['remoteUri']=_0x52d8cb['remoteUri']||'';this[_0x32b8('0x4')]=_0x52d8cb[_0x32b8('0x4')]||'';this['Configurations']=_0x52d8cb[_0x32b8('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x0309=['name','username','apiKey','token','remoteUri','serverUrl','exports'];(function(_0x2cad46,_0x37b1ea){var _0x5b0245=function(_0x9e64eb){while(--_0x9e64eb){_0x2cad46['push'](_0x2cad46['shift']());}};_0x5b0245(++_0x37b1ea);}(_0x0309,0x165));var _0x9030=function(_0xcad719,_0x4bc600){_0xcad719=_0xcad719-0x0;var _0x4e9e5b=_0x0309[_0xcad719];return _0x4e9e5b;};'use strict';function FreshsalesAccount(_0x15c656){this['id']=_0x15c656['id']||0x0;this['name']=_0x15c656[_0x9030('0x0')]||'';this['username']=_0x15c656[_0x9030('0x1')]||'';this[_0x9030('0x2')]=_0x15c656[_0x9030('0x3')]||'';this[_0x9030('0x4')]=_0x15c656[_0x9030('0x4')]||'';this[_0x9030('0x5')]=_0x15c656[_0x9030('0x5')]||'';this['Configurations']=_0x15c656['Configurations']||{};}module[_0x9030('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 53f8469..9e3a783 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 _0xb6c6=['queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','lastAssignedTo','motionChannel','voice','variables','exports','uniqueid','calleridnum','calleridname'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0xb6c6,0x12d));var _0x6b6c=function(_0x553184,_0x18908e){_0x553184=_0x553184-0x0;var _0x39804e=_0xb6c6[_0x553184];return _0x39804e;};'use strict';function QueueReport(){this['type']='inbound';this[_0x6b6c('0x0')]='';this[_0x6b6c('0x1')]='';this[_0x6b6c('0x2')]='';this[_0x6b6c('0x3')]='';this[_0x6b6c('0x4')]=null;this[_0x6b6c('0x5')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x6b6c('0x6')]=null;this[_0x6b6c('0x7')]=0x1;this['channel']='';this[_0x6b6c('0x8')]='';this[_0x6b6c('0x9')]='';this[_0x6b6c('0xa')]='';this[_0x6b6c('0xb')]='';this['exten']='';this[_0x6b6c('0xc')]='';this[_0x6b6c('0xd')]=0x0;this['assigned']=![];this[_0x6b6c('0xe')]='';this[_0x6b6c('0xf')]=_0x6b6c('0x10');this['mohtime']=0x0;this[_0x6b6c('0x11')]={};}module[_0x6b6c('0x12')]=QueueReport; \ No newline at end of file +var _0xb077=['queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0xb077,0x1c6));var _0x7b07=function(_0x13db71,_0xea8a3b){_0x13db71=_0x13db71-0x0;var _0x300282=_0xb077[_0x13db71];return _0x300282;};'use strict';function QueueReport(){this[_0x7b07('0x0')]=_0x7b07('0x1');this[_0x7b07('0x2')]='';this[_0x7b07('0x3')]='';this[_0x7b07('0x4')]='';this[_0x7b07('0x5')]='';this[_0x7b07('0x6')]=null;this[_0x7b07('0x7')]=null;this[_0x7b07('0x8')]=0x1;this[_0x7b07('0x9')]=0x1;this['queuecallerabandon']=![];this[_0x7b07('0xa')]=null;this['queuecallercomplete']=![];this[_0x7b07('0xb')]=null;this[_0x7b07('0xc')]=![];this[_0x7b07('0xd')]=null;this[_0x7b07('0xe')]=0x1;this[_0x7b07('0xf')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0x7b07('0x10')]='';this[_0x7b07('0x11')]='';this[_0x7b07('0x12')]='';this[_0x7b07('0x13')]='';this[_0x7b07('0x14')]=0x0;this[_0x7b07('0x15')]=![];this[_0x7b07('0x16')]='';this[_0x7b07('0x17')]='voice';this[_0x7b07('0x18')]=0x0;this[_0x7b07('0x19')]={};}module[_0x7b07('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b953c58..20526e6 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 _0xa212=['securityToken','type','serverUrl','Configurations','name','remoteUri','clientId','clientSecret'];(function(_0x2b7b04,_0x5491aa){var _0x4b0728=function(_0x4947a3){while(--_0x4947a3){_0x2b7b04['push'](_0x2b7b04['shift']());}};_0x4b0728(++_0x5491aa);}(_0xa212,0xec));var _0x2a21=function(_0x2369de,_0x5e3e41){_0x2369de=_0x2369de-0x0;var _0x5cf9b2=_0xa212[_0x2369de];return _0x5cf9b2;};'use strict';function SalesforceAccount(_0x34134a){this['id']=_0x34134a['id']||0x0;this[_0x2a21('0x0')]=_0x34134a[_0x2a21('0x0')]||'';this['username']=_0x34134a['username']||'';this['remoteUri']=_0x34134a[_0x2a21('0x1')]||'';this['password']=_0x34134a['password']||'';this[_0x2a21('0x2')]=_0x34134a[_0x2a21('0x2')]||'';this[_0x2a21('0x3')]=_0x34134a[_0x2a21('0x3')]||'';this[_0x2a21('0x4')]=_0x34134a['securityToken']||'';this[_0x2a21('0x5')]=_0x34134a[_0x2a21('0x5')]||'integrationTab';this['serverUrl']=_0x34134a[_0x2a21('0x6')]||'';this[_0x2a21('0x7')]=_0x34134a[_0x2a21('0x7')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xb49b=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb49b,0x1ba));var _0xbb49=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xb49b[_0x5ddb1c];return _0x354adc;};'use strict';function SalesforceAccount(_0x3c32a7){this['id']=_0x3c32a7['id']||0x0;this[_0xbb49('0x0')]=_0x3c32a7[_0xbb49('0x0')]||'';this[_0xbb49('0x1')]=_0x3c32a7[_0xbb49('0x1')]||'';this[_0xbb49('0x2')]=_0x3c32a7['remoteUri']||'';this['password']=_0x3c32a7[_0xbb49('0x3')]||'';this[_0xbb49('0x4')]=_0x3c32a7[_0xbb49('0x4')]||'';this[_0xbb49('0x5')]=_0x3c32a7['clientSecret']||'';this[_0xbb49('0x6')]=_0x3c32a7['securityToken']||'';this[_0xbb49('0x7')]=_0x3c32a7[_0xbb49('0x7')]||_0xbb49('0x8');this[_0xbb49('0x9')]=_0x3c32a7[_0xbb49('0x9')]||'';this[_0xbb49('0xa')]=_0x3c32a7[_0xbb49('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 01435c8..23b27fc 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 _0x3222=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0x3222,0x94));var _0x2322=function(_0x17a310,_0x46ec78){_0x17a310=_0x17a310-0x0;var _0x145786=_0x3222[_0x17a310];return _0x145786;};'use strict';function ServicenowAccount(_0x4f1da8){this['id']=_0x4f1da8['id']||0x0;this['name']=_0x4f1da8[_0x2322('0x0')]||'';this[_0x2322('0x1')]=_0x4f1da8['username']||'';this[_0x2322('0x2')]=_0x4f1da8[_0x2322('0x2')]||'';this[_0x2322('0x3')]=_0x4f1da8[_0x2322('0x3')]||'';this['serverUrl']=_0x4f1da8[_0x2322('0x4')]||'';this[_0x2322('0x5')]=_0x4f1da8['Configurations']||{};}module[_0x2322('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc591=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x396101,_0x2d5b6c){var _0x4006c0=function(_0x365cec){while(--_0x365cec){_0x396101['push'](_0x396101['shift']());}};_0x4006c0(++_0x2d5b6c);}(_0xc591,0x12b));var _0x1c59=function(_0x50af9c,_0xf03b1e){_0x50af9c=_0x50af9c-0x0;var _0x5b5e5a=_0xc591[_0x50af9c];return _0x5b5e5a;};'use strict';function ServicenowAccount(_0x38b348){this['id']=_0x38b348['id']||0x0;this[_0x1c59('0x0')]=_0x38b348[_0x1c59('0x0')]||'';this['username']=_0x38b348[_0x1c59('0x1')]||'';this[_0x1c59('0x2')]=_0x38b348['password']||'';this[_0x1c59('0x3')]=_0x38b348[_0x1c59('0x3')]||'';this[_0x1c59('0x4')]=_0x38b348['serverUrl']||'';this[_0x1c59('0x5')]=_0x38b348[_0x1c59('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 c41cc15..5cdc2bb 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 _0xb455=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4343f1,_0x325dce){var _0x5d84a0=function(_0x53c23f){while(--_0x53c23f){_0x4343f1['push'](_0x4343f1['shift']());}};_0x5d84a0(++_0x325dce);}(_0xb455,0xdf));var _0x5b45=function(_0x4cac72,_0x24d93b){_0x4cac72=_0x4cac72-0x0;var _0x143234=_0xb455[_0x4cac72];return _0x143234;};'use strict';function SugarcrmAccount(_0xe82cef){this['id']=_0xe82cef['id']||0x0;this[_0x5b45('0x0')]=_0xe82cef[_0x5b45('0x0')]||'';this[_0x5b45('0x1')]=_0xe82cef['username']||'';this[_0x5b45('0x2')]=_0xe82cef[_0x5b45('0x2')]||'';this[_0x5b45('0x3')]=_0xe82cef[_0x5b45('0x3')]||'';this[_0x5b45('0x4')]=_0xe82cef[_0x5b45('0x4')]||'';this[_0x5b45('0x5')]=_0xe82cef['Configurations']||{};}module[_0x5b45('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x78e7=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x13aa0a,_0x55079e){var _0xf05be=function(_0xb9541f){while(--_0xb9541f){_0x13aa0a['push'](_0x13aa0a['shift']());}};_0xf05be(++_0x55079e);}(_0x78e7,0xb0));var _0x778e=function(_0x19ef95,_0x2b55f6){_0x19ef95=_0x19ef95-0x0;var _0x21093c=_0x78e7[_0x19ef95];return _0x21093c;};'use strict';function SugarcrmAccount(_0x5cdcc7){this['id']=_0x5cdcc7['id']||0x0;this[_0x778e('0x0')]=_0x5cdcc7[_0x778e('0x0')]||'';this[_0x778e('0x1')]=_0x5cdcc7[_0x778e('0x1')]||'';this[_0x778e('0x2')]=_0x5cdcc7[_0x778e('0x2')]||'';this[_0x778e('0x3')]=_0x5cdcc7[_0x778e('0x3')]||'';this[_0x778e('0x4')]=_0x5cdcc7[_0x778e('0x4')]||'';this['Configurations']=_0x5cdcc7[_0x778e('0x5')]||{};}module[_0x778e('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9fac711..0126c6e 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 _0x1d57=['unknown','address','exports','name','accountcode','state','stateTime','status'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1d57,0x123));var _0x71d5=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0x1d57[_0x39cc8f];return _0x15e616;};'use strict';function Telephone(_0xafc682){this['id']=_0xafc682['id']||0x0;this[_0x71d5('0x0')]=_0xafc682[_0x71d5('0x0')]||'';this[_0x71d5('0x1')]=_0xafc682['accountcode']||'';this[_0x71d5('0x2')]='unknown';this[_0x71d5('0x3')]=0x0;this[_0x71d5('0x4')]=_0x71d5('0x5');this[_0x71d5('0x6')]='';}module[_0x71d5('0x7')]=Telephone; \ No newline at end of file +var _0x52ed=['name','accountcode','unknown','stateTime','status','address'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x52ed,0x132));var _0xd52e=function(_0x4c0658,_0x833e86){_0x4c0658=_0x4c0658-0x0;var _0x1ebcd7=_0x52ed[_0x4c0658];return _0x1ebcd7;};'use strict';function Telephone(_0xcb9b8){this['id']=_0xcb9b8['id']||0x0;this[_0xd52e('0x0')]=_0xcb9b8[_0xd52e('0x0')]||'';this[_0xd52e('0x1')]=_0xcb9b8[_0xd52e('0x1')]||'';this['state']=_0xd52e('0x2');this[_0xd52e('0x3')]=0x0;this[_0xd52e('0x4')]=_0xd52e('0x2');this[_0xd52e('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 05571b0..a21f5a1 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x1a5916,_0x1036e9){var _0x1605fd=function(_0x3649be){while(--_0x3649be){_0x1a5916['push'](_0x1a5916['shift']());}};_0x1605fd(++_0x1036e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x40a056,_0x2f2dba){var _0x5d4130=function(_0x6b226f){while(--_0x6b226f){_0x40a056['push'](_0x40a056['shift']());}};_0x5d4130(++_0x2f2dba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 161643f..9a34136 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4fd218,_0x3ad1f1){var _0x398d42=function(_0x4cec0e){while(--_0x4cec0e){_0x4fd218['push'](_0x4fd218['shift']());}};_0x398d42(++_0x3ad1f1);}(_0xda2d,0x102));var _0xdda2=function(_0x33dcc2,_0x18dd35){_0x33dcc2=_0x33dcc2-0x0;var _0x300ce5=_0xda2d[_0x33dcc2];return _0x300ce5;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x296f8e,_0x37ae0b){var _0x4a3c35=function(_0xfad256){while(--_0xfad256){_0x296f8e['push'](_0x296f8e['shift']());}};_0x4a3c35(++_0x37ae0b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a5a53,_0x598a8c){_0x1a5a53=_0x1a5a53-0x0;var _0xf75355=_0xb10b[_0x1a5a53];return _0xf75355;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 797694a..2ae6b7f 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 _0x5d89=['indexOf','split','host','port','domainport','refresh','stateRegistry','address','exports','active','name','state','stateTime','status','unknown','registry'];(function(_0x4d2943,_0x501535){var _0x51f1b3=function(_0x3432da){while(--_0x3432da){_0x4d2943['push'](_0x4d2943['shift']());}};_0x51f1b3(++_0x501535);}(_0x5d89,0x139));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x33b9e1){this['id']=_0x33b9e1['id']||0x0;this[_0x95d8('0x0')]=_0x33b9e1['active']||![];this[_0x95d8('0x1')]=_0x33b9e1[_0x95d8('0x1')]||'';this[_0x95d8('0x2')]='unknown';this[_0x95d8('0x3')]=0x0;this[_0x95d8('0x4')]=_0x95d8('0x5');this[_0x95d8('0x6')]=_0x33b9e1[_0x95d8('0x6')]&&_0x33b9e1['registry'][_0x95d8('0x7')](':')?_0x33b9e1[_0x95d8('0x6')][_0x95d8('0x8')](':')[0x0]:'';this[_0x95d8('0x9')]='';this[_0x95d8('0xa')]='';this['domain']='';this[_0x95d8('0xb')]='';this[_0x95d8('0xc')]='';this[_0x95d8('0xd')]=_0x95d8('0x5');this['registrationtime']='';this[_0x95d8('0xe')]='';this['defaultuser']=_0x33b9e1['defaultuser']||'';}module[_0x95d8('0xf')]=Trunk; \ No newline at end of file +var _0x5285=['unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','name','state'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x5285,0x16e));var _0x5528=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x5285[_0x521929];return _0x632436;};'use strict';function Trunk(_0x2e6eb2){this['id']=_0x2e6eb2['id']||0x0;this['active']=_0x2e6eb2['active']||![];this[_0x5528('0x0')]=_0x2e6eb2[_0x5528('0x0')]||'';this[_0x5528('0x1')]=_0x5528('0x2');this[_0x5528('0x3')]=0x0;this[_0x5528('0x4')]='unknown';this[_0x5528('0x5')]=_0x2e6eb2[_0x5528('0x5')]&&_0x2e6eb2['registry'][_0x5528('0x6')](':')?_0x2e6eb2[_0x5528('0x5')][_0x5528('0x7')](':')[0x0]:'';this[_0x5528('0x8')]='';this['port']='';this[_0x5528('0x9')]='';this[_0x5528('0xa')]='';this[_0x5528('0xb')]='';this[_0x5528('0xc')]=_0x5528('0x2');this[_0x5528('0xd')]='';this['address']='';this['defaultuser']=_0x2e6eb2[_0x5528('0xe')]||'';}module[_0x5528('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 d101335..6bccd48 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 _0x83de=['exten','none','mandatoryDisposition','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x83de,0x1a4));var _0xe83d=function(_0x5f44ba,_0x1f318e){_0x5f44ba=_0x5f44ba-0x0;var _0x312dbe=_0x83de[_0x5f44ba];return _0x312dbe;};'use strict';function voiceExtension(_0x3351fe){this['id']=_0x3351fe['id']||0x0;this[_0xe83d('0x0')]=_0x3351fe[_0xe83d('0x0')]||'';this['recordingFormat']=_0x3351fe['recordingFormat']||_0xe83d('0x1');this[_0xe83d('0x2')]=_0x3351fe[_0xe83d('0x2')]||![];}module[_0xe83d('0x3')]=voiceExtension; \ No newline at end of file +var _0x25b3=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x2c192d,_0x1d7497){var _0xc2c57a=function(_0x5bdc51){while(--_0x5bdc51){_0x2c192d['push'](_0x2c192d['shift']());}};_0xc2c57a(++_0x1d7497);}(_0x25b3,0xd0));var _0x325b=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x25b3[_0x5a6644];return _0x3a2a5d;};'use strict';function voiceExtension(_0x395003){this['id']=_0x395003['id']||0x0;this[_0x325b('0x0')]=_0x395003[_0x325b('0x0')]||'';this['recordingFormat']=_0x395003[_0x325b('0x1')]||_0x325b('0x2');this[_0x325b('0x3')]=_0x395003['mandatoryDisposition']||![];}module[_0x325b('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 88d2373..9a8aed7 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 _0x7583=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','busy','invalid','unavailable','ringing','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated'];(function(_0x48fbd2,_0xc69e3f){var _0x22d60e=function(_0x52c1d7){while(--_0x52c1d7){_0x48fbd2['push'](_0x48fbd2['shift']());}};_0x22d60e(++_0xc69e3f);}(_0x7583,0x1c1));var _0x3758=function(_0x2040dd,_0x156a63){_0x2040dd=_0x2040dd-0x0;var _0x27688f=_0x7583[_0x2040dd];return _0x27688f;};'use strict';var statusDesc=[_0x3758('0x0'),'not_inuse','inuse',_0x3758('0x1'),_0x3758('0x2'),_0x3758('0x3'),_0x3758('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':'wav','wav49':_0x3758('0x5'),'gsm':_0x3758('0x6')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x3758('0x7')};function VoiceQueue(_0x3637e4){this['id']=_0x3637e4['id']||0x0;this[_0x3758('0x8')]=_0x3637e4[_0x3758('0x8')]||'';this[_0x3758('0x9')]=_0x3637e4[_0x3758('0x9')]||'';this[_0x3758('0xa')]=_0x3637e4[_0x3758('0xa')]||_0x3758('0xb');this[_0x3758('0xc')]=0x0;this[_0x3758('0xd')]=0x0;this[_0x3758('0xe')]=0x0;this[_0x3758('0xf')]=0x0;this[_0x3758('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x3758('0x11')]=0x0;this[_0x3758('0x12')]=0x0;this['abandoned']=0x0;this[_0x3758('0x13')]=0x0;this[_0x3758('0x14')]=0x0;this[_0x3758('0x15')]=_0x3637e4[_0x3758('0x15')]||![];this[_0x3758('0x16')]=_0x3637e4['acwTimeout']||0xa;this['autopause']=_0x3637e4[_0x3758('0x17')]||'no';this[_0x3758('0x18')]=!![];this[_0x3758('0x19')]='';this[_0x3758('0x1a')]=0x0;this['temp']=0x0;this[_0x3758('0x1b')]=_0x3637e4[_0x3758('0x1b')]||null;this[_0x3758('0x1c')]=_0x3637e4[_0x3758('0x1c')]?_0x3637e4[_0x3758('0x1c')]:null;this['dialActive']=_0x3637e4[_0x3758('0x1d')];this[_0x3758('0x1e')]=_0x3637e4[_0x3758('0x1e')]||_0x3758('0x1f');this[_0x3758('0x20')]=_0x3637e4[_0x3758('0x20')]||0x0;this[_0x3758('0x21')]=_0x3637e4[_0x3758('0x21')]||0x0;this[_0x3758('0x22')]=_0x3637e4['dialPowerLevel']||0x1;this[_0x3758('0x23')]=_0x3637e4[_0x3758('0x23')]||'dropRate';this[_0x3758('0x24')]=_0x3637e4['dialPredictiveOptimizationPercentage']||0.03;this[_0x3758('0x25')]=_0x3637e4[_0x3758('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x3637e4[_0x3758('0x26')]||_0x3758('0x27');this[_0x3758('0x28')]=_0x3637e4[_0x3758('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x3637e4[_0x3758('0x29')]||0x1e;this['dialQueueOptions']=_0x3637e4['dialQueueOptions']||_0x3758('0x2a');this['dialQueueTimeout']=_0x3637e4[_0x3758('0x2b')]||0x3;this['dialQueueProject']=_0x3637e4[_0x3758('0x2c')]||undefined;this[_0x3758('0x2d')]=_0x3637e4[_0x3758('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x3637e4[_0x3758('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x3637e4[_0x3758('0x2f')]||0x3;this[_0x3758('0x30')]=_0x3637e4[_0x3758('0x30')]||0x96;this[_0x3758('0x31')]=_0x3637e4[_0x3758('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3637e4[_0x3758('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3637e4[_0x3758('0x33')]||0x3;this[_0x3758('0x34')]=_0x3637e4[_0x3758('0x34')]||0x96;this[_0x3758('0x35')]=_0x3637e4[_0x3758('0x35')]||0x3;this['dialDropRetryFrequency']=_0x3637e4[_0x3758('0x36')]||0x96;this[_0x3758('0x37')]=_0x3637e4['dialAbandonedMaxRetry']||0x3;this[_0x3758('0x38')]=_0x3637e4[_0x3758('0x38')]||0x96;this[_0x3758('0x39')]=_0x3637e4[_0x3758('0x39')]||0x3;this[_0x3758('0x3a')]=_0x3637e4[_0x3758('0x3a')]||0x96;this[_0x3758('0x3b')]=_0x3637e4[_0x3758('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3637e4[_0x3758('0x3c')]||0x96;this['dialGlobalMaxRetry']=_0x3637e4[_0x3758('0x3d')]||0x4;this[_0x3758('0x3e')]=_0x3637e4[_0x3758('0x3e')]?_0x3637e4[_0x3758('0x3e')]:undefined;this[_0x3758('0x3f')]=_0x3637e4[_0x3758('0x3f')]?_0x3637e4[_0x3758('0x3f')]:undefined;this[_0x3758('0x40')]=_0x3637e4['dialPrefix']||undefined;this['Interval']=_0x3637e4[_0x3758('0x41')]?_0x3637e4[_0x3758('0x41')]:undefined;this[_0x3758('0x42')]=_0x3637e4[_0x3758('0x42')]||'DESC';this[_0x3758('0x43')]=_0x3637e4[_0x3758('0x43')]||undefined;this[_0x3758('0x44')]=_0x3637e4['dialCutDigit']||undefined;this[_0x3758('0x45')]=strategy[_0x3637e4['strategy']]||_0x3758('0x46');this[_0x3758('0x47')]=!![];this[_0x3758('0x48')]=_0x3637e4['dialAMDActive']||![];this[_0x3758('0x49')]=_0x3637e4[_0x3758('0x49')];this[_0x3758('0x4a')]=_0x3637e4['dialAMDGreeting'];this[_0x3758('0x4b')]=_0x3637e4[_0x3758('0x4b')];this[_0x3758('0x4c')]=_0x3637e4[_0x3758('0x4c')];this['dialAMDMinWordLength']=_0x3637e4['dialAMDMinWordLength'];this[_0x3758('0x4d')]=_0x3637e4[_0x3758('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x3637e4[_0x3758('0x4e')];this['dialAMDSilenceThreshold']=_0x3637e4[_0x3758('0x4f')];this[_0x3758('0x50')]=_0x3637e4['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x3758('0x51')]=0x0;this[_0x3758('0x52')]=_0x3637e4[_0x3758('0x52')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x3758('0x53')]=0x0;this[_0x3758('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3758('0x55')]=0x0;this[_0x3758('0x56')]=0x0;this[_0x3758('0x57')]=0x0;this[_0x3758('0x58')]=0x0;this[_0x3758('0x59')]=0x0;this[_0x3758('0x5a')]=0x0;this[_0x3758('0x5b')]=0x0;this[_0x3758('0x5c')]=0x0;this[_0x3758('0x5d')]=0x0;this[_0x3758('0x5e')]=undefined;this[_0x3758('0x5f')]=undefined;this[_0x3758('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x3758('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x3758('0x62')]=0x0;this[_0x3758('0x63')]=0x0;this[_0x3758('0x64')]=0x0;this[_0x3758('0x65')]=0x0;this[_0x3758('0x66')]=_0x3637e4[_0x3758('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x3637e4['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x3758('0x68')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x3758('0x69')]=0x1;this[_0x3758('0x6a')]=0x0;this[_0x3758('0x6b')]=0x0;this[_0x3758('0x6c')]=0x0;this[_0x3758('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x3637e4[_0x3758('0x6e')]||0x1e;this['dialRecallInQueue']=_0x3637e4['dialRecallInQueue']||![];this[_0x3758('0x6f')]=!!_0x3637e4[_0x3758('0x6f')]||![];this[_0x3758('0x70')]=!!_0x3637e4[_0x3758('0x70')]||![];this[_0x3758('0x71')]=_0x3637e4[_0x3758('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x3637e4[_0x3758('0x72')]||![];this[_0x3758('0x73')]=_0x3637e4['dialAgiAfterHangupAgent']||![];this[_0x3758('0x9')]=monitorFormat[_0x3637e4[_0x3758('0x9')]]?monitorFormat[_0x3637e4[_0x3758('0x9')]]:undefined;this[_0x3758('0x74')]=_0x3637e4[_0x3758('0x74')]||![];this[_0x3758('0x75')]=_0x3637e4[_0x3758('0x75')]?_0x3637e4[_0x3758('0x75')]:undefined;}module[_0x3758('0x76')]=VoiceQueue; \ No newline at end of file +var _0xe6e7=['temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message'];(function(_0x51a29e,_0x4cad0a){var _0x5dcaea=function(_0x4f0529){while(--_0x4f0529){_0x51a29e['push'](_0x51a29e['shift']());}};_0x5dcaea(++_0x4cad0a);}(_0xe6e7,0x1c7));var _0x7e6e=function(_0x1f89f3,_0x4dafd8){_0x1f89f3=_0x1f89f3-0x0;var _0x2c33bd=_0xe6e7[_0x1f89f3];return _0x2c33bd;};'use strict';var statusDesc=[_0x7e6e('0x0'),'not_inuse',_0x7e6e('0x1'),_0x7e6e('0x2'),_0x7e6e('0x3'),_0x7e6e('0x4'),_0x7e6e('0x5'),_0x7e6e('0x6'),_0x7e6e('0x7')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x7e6e('0x8')};var strategy={'rrmemory':_0x7e6e('0x9'),'roundrobin':_0x7e6e('0xa')};function VoiceQueue(_0x48f553){this['id']=_0x48f553['id']||0x0;this[_0x7e6e('0xb')]=_0x48f553[_0x7e6e('0xb')]||'';this[_0x7e6e('0xc')]=_0x48f553[_0x7e6e('0xc')]||'';this[_0x7e6e('0xd')]=_0x48f553[_0x7e6e('0xd')]||_0x7e6e('0xe');this[_0x7e6e('0xf')]=0x0;this[_0x7e6e('0x10')]=0x0;this[_0x7e6e('0x11')]=0x0;this['answered']=0x0;this[_0x7e6e('0x12')]=0x0;this[_0x7e6e('0x13')]=0x0;this[_0x7e6e('0x14')]=0x0;this['unmanaged']=0x0;this[_0x7e6e('0x15')]=0x0;this[_0x7e6e('0x16')]=0x0;this[_0x7e6e('0x17')]=0x0;this['acw']=_0x48f553[_0x7e6e('0x18')]||![];this[_0x7e6e('0x19')]=_0x48f553[_0x7e6e('0x19')]||0xa;this[_0x7e6e('0x1a')]=_0x48f553[_0x7e6e('0x1a')]||'no';this[_0x7e6e('0x1b')]=!![];this[_0x7e6e('0x1c')]='';this['originated']=0x0;this[_0x7e6e('0x1d')]=0x0;this[_0x7e6e('0x1e')]=_0x48f553[_0x7e6e('0x1e')]||null;this['dialGlobalInterval']=_0x48f553[_0x7e6e('0x1f')]?_0x48f553['dialGlobalInterval']:null;this['dialActive']=_0x48f553[_0x7e6e('0x20')];this[_0x7e6e('0x21')]=_0x48f553['dialMethod']||_0x7e6e('0x22');this[_0x7e6e('0x23')]=_0x48f553[_0x7e6e('0x23')]||0x0;this['dialLimitQueue']=_0x48f553[_0x7e6e('0x24')]||0x0;this[_0x7e6e('0x25')]=_0x48f553['dialPowerLevel']||0x1;this[_0x7e6e('0x26')]=_0x48f553[_0x7e6e('0x26')]||_0x7e6e('0x27');this[_0x7e6e('0x28')]=_0x48f553[_0x7e6e('0x28')]||0.03;this[_0x7e6e('0x29')]=_0x48f553[_0x7e6e('0x29')]||0x258;this[_0x7e6e('0x2a')]=_0x48f553['dialOriginateCallerIdName']||_0x7e6e('0x2b');this['dialOriginateCallerIdNumber']=_0x48f553[_0x7e6e('0x2c')]||_0x7e6e('0x2b');this[_0x7e6e('0x2d')]=_0x48f553[_0x7e6e('0x2d')]||0x1e;this[_0x7e6e('0x2e')]=_0x48f553[_0x7e6e('0x2e')]||'tTxX';this[_0x7e6e('0x2f')]=_0x48f553['dialQueueTimeout']||0x3;this[_0x7e6e('0x30')]=_0x48f553[_0x7e6e('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x48f553[_0x7e6e('0x31')]||0x3;this['dialCongestionRetryFrequency']=_0x48f553['dialCongestionRetryFrequency']||0x96;this[_0x7e6e('0x32')]=_0x48f553['dialBusyMaxRetry']||0x3;this[_0x7e6e('0x33')]=_0x48f553[_0x7e6e('0x33')]||0x96;this[_0x7e6e('0x34')]=_0x48f553[_0x7e6e('0x34')]||0x3;this[_0x7e6e('0x35')]=_0x48f553[_0x7e6e('0x35')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x48f553['dialNoSuchNumberMaxRetry']||0x3;this[_0x7e6e('0x36')]=_0x48f553[_0x7e6e('0x36')]||0x96;this[_0x7e6e('0x37')]=_0x48f553[_0x7e6e('0x37')]||0x3;this[_0x7e6e('0x38')]=_0x48f553[_0x7e6e('0x38')]||0x96;this[_0x7e6e('0x39')]=_0x48f553['dialAbandonedMaxRetry']||0x3;this[_0x7e6e('0x3a')]=_0x48f553[_0x7e6e('0x3a')]||0x96;this[_0x7e6e('0x3b')]=_0x48f553[_0x7e6e('0x3b')]||0x3;this[_0x7e6e('0x3c')]=_0x48f553[_0x7e6e('0x3c')]||0x96;this[_0x7e6e('0x3d')]=_0x48f553[_0x7e6e('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x48f553['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x48f553[_0x7e6e('0x3e')]||0x4;this[_0x7e6e('0x3f')]=_0x48f553[_0x7e6e('0x3f')]?_0x48f553[_0x7e6e('0x3f')]:undefined;this[_0x7e6e('0x40')]=_0x48f553['TrunkBackup']?_0x48f553['TrunkBackup']:undefined;this[_0x7e6e('0x41')]=_0x48f553[_0x7e6e('0x41')]||undefined;this[_0x7e6e('0x42')]=_0x48f553['Interval']?_0x48f553[_0x7e6e('0x42')]:undefined;this[_0x7e6e('0x43')]=_0x48f553[_0x7e6e('0x43')]||'DESC';this[_0x7e6e('0x44')]=_0x48f553[_0x7e6e('0x44')]||undefined;this['dialCutDigit']=_0x48f553[_0x7e6e('0x45')]||undefined;this[_0x7e6e('0x46')]=strategy[_0x48f553['strategy']]||_0x7e6e('0x9');this[_0x7e6e('0x47')]=!![];this[_0x7e6e('0x48')]=_0x48f553['dialAMDActive']||![];this[_0x7e6e('0x49')]=_0x48f553['dialAMDInitialSilence'];this[_0x7e6e('0x4a')]=_0x48f553[_0x7e6e('0x4a')];this['dialAMDAfterGreetingSilence']=_0x48f553[_0x7e6e('0x4b')];this['dialAMDTotalAnalysisTime']=_0x48f553[_0x7e6e('0x4c')];this[_0x7e6e('0x4d')]=_0x48f553[_0x7e6e('0x4d')];this[_0x7e6e('0x4e')]=_0x48f553[_0x7e6e('0x4e')];this[_0x7e6e('0x4f')]=_0x48f553[_0x7e6e('0x4f')];this[_0x7e6e('0x50')]=_0x48f553['dialAMDSilenceThreshold'];this[_0x7e6e('0x51')]=_0x48f553[_0x7e6e('0x51')];this[_0x7e6e('0x52')]=0x0;this[_0x7e6e('0x53')]=0x0;this[_0x7e6e('0x54')]=_0x48f553[_0x7e6e('0x54')];this[_0x7e6e('0x55')]=0x0;this[_0x7e6e('0x56')]=0x0;this[_0x7e6e('0x57')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x7e6e('0x58')]=0x0;this[_0x7e6e('0x59')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x7e6e('0x5a')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x7e6e('0x5b')]=0x0;this[_0x7e6e('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x7e6e('0x5d')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x7e6e('0x5e')]=undefined;this[_0x7e6e('0x5f')]=undefined;this['handlePredictive']=undefined;this[_0x7e6e('0x60')]=1.05;this[_0x7e6e('0x61')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x7e6e('0x62')]=0x0;this[_0x7e6e('0x63')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x7e6e('0x64')]=0x0;this[_0x7e6e('0x65')]=0x0;this[_0x7e6e('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x48f553[_0x7e6e('0x67')]||0x14;this[_0x7e6e('0x68')]=_0x48f553[_0x7e6e('0x67')]||0xa;this[_0x7e6e('0x69')]=0x0;this[_0x7e6e('0x6a')]=0x0;this[_0x7e6e('0x6b')]=0x1;this[_0x7e6e('0x6c')]=0x0;this[_0x7e6e('0x6d')]=0x0;this[_0x7e6e('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x7e6e('0x6f')]=_0x48f553[_0x7e6e('0x6f')]||0x1e;this[_0x7e6e('0x70')]=_0x48f553[_0x7e6e('0x70')]||![];this[_0x7e6e('0x71')]=!!_0x48f553[_0x7e6e('0x71')]||![];this[_0x7e6e('0x72')]=!!_0x48f553[_0x7e6e('0x72')]||![];this[_0x7e6e('0x73')]=_0x48f553[_0x7e6e('0x73')]||undefined;this[_0x7e6e('0x74')]=_0x48f553['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x48f553[_0x7e6e('0x75')]||![];this[_0x7e6e('0xc')]=monitorFormat[_0x48f553['monitor_format']]?monitorFormat[_0x48f553[_0x7e6e('0xc')]]:undefined;this[_0x7e6e('0x76')]=_0x48f553[_0x7e6e('0x76')]||![];this[_0x7e6e('0x77')]=_0x48f553[_0x7e6e('0x77')]?_0x48f553['mandatoryDispositionPause']:undefined;}module[_0x7e6e('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 477a7a5..fafb8e5 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 _0x0012=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0012,0x160));var _0x2001=function(_0x15faf8,_0x393a55){_0x15faf8=_0x15faf8-0x0;var _0x245288=_0x0012[_0x15faf8];return _0x245288;};'use strict';function VtigerAccount(_0xb3eb2a){this['id']=_0xb3eb2a['id']||0x0;this['name']=_0xb3eb2a[_0x2001('0x0')]||'';this['username']=_0xb3eb2a[_0x2001('0x1')]||'';this[_0x2001('0x2')]=_0xb3eb2a[_0x2001('0x2')]||'';this[_0x2001('0x3')]=_0xb3eb2a[_0x2001('0x3')]||'';this[_0x2001('0x4')]=_0xb3eb2a[_0x2001('0x4')]||'';this[_0x2001('0x5')]=_0xb3eb2a[_0x2001('0x5')]||{};}module[_0x2001('0x6')]=VtigerAccount; \ No newline at end of file +var _0xac4b=['exports','name','username','accessKey','remoteUri','Configurations'];(function(_0x45bfdb,_0x409458){var _0x529185=function(_0x18f91b){while(--_0x18f91b){_0x45bfdb['push'](_0x45bfdb['shift']());}};_0x529185(++_0x409458);}(_0xac4b,0x145));var _0xbac4=function(_0x165fd5,_0x103c15){_0x165fd5=_0x165fd5-0x0;var _0x15b980=_0xac4b[_0x165fd5];return _0x15b980;};'use strict';function VtigerAccount(_0x24c403){this['id']=_0x24c403['id']||0x0;this[_0xbac4('0x0')]=_0x24c403[_0xbac4('0x0')]||'';this[_0xbac4('0x1')]=_0x24c403[_0xbac4('0x1')]||'';this[_0xbac4('0x2')]=_0x24c403[_0xbac4('0x2')]||'';this[_0xbac4('0x3')]=_0x24c403[_0xbac4('0x3')]||'';this['serverUrl']=_0x24c403['serverUrl']||'';this[_0xbac4('0x4')]=_0x24c403[_0xbac4('0x4')]||{};}module[_0xbac4('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 61e4356..8dcca1a 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 _0x7efb=['Configurations','name','password','token','authType','type','integrationTab','serverUrl'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7efb,0x161));var _0xb7ef=function(_0x50dd32,_0x4de5f3){_0x50dd32=_0x50dd32-0x0;var _0x369653=_0x7efb[_0x50dd32];return _0x369653;};'use strict';function ZendeskAccount(_0x455f65){this['id']=_0x455f65['id']||0x0;this[_0xb7ef('0x0')]=_0x455f65[_0xb7ef('0x0')]||'';this['username']=_0x455f65['username']||'';this[_0xb7ef('0x1')]=_0x455f65[_0xb7ef('0x1')]||'';this['token']=_0x455f65[_0xb7ef('0x2')]||'';this['remoteUri']=_0x455f65['remoteUri']||'';this[_0xb7ef('0x3')]=_0x455f65[_0xb7ef('0x3')]||'';this[_0xb7ef('0x4')]=_0x455f65[_0xb7ef('0x4')]||_0xb7ef('0x5');this[_0xb7ef('0x6')]=_0x455f65[_0xb7ef('0x6')]||'';this[_0xb7ef('0x7')]=_0x455f65['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xbc98=['name','username','password','token','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x35d32c,_0x5bba8b){var _0x5ac55d=function(_0xac18e0){while(--_0xac18e0){_0x35d32c['push'](_0x35d32c['shift']());}};_0x5ac55d(++_0x5bba8b);}(_0xbc98,0x105));var _0x8bc9=function(_0x5b7016,_0x5b0705){_0x5b7016=_0x5b7016-0x0;var _0x54d9e0=_0xbc98[_0x5b7016];return _0x54d9e0;};'use strict';function ZendeskAccount(_0x1666cd){this['id']=_0x1666cd['id']||0x0;this['name']=_0x1666cd[_0x8bc9('0x0')]||'';this[_0x8bc9('0x1')]=_0x1666cd[_0x8bc9('0x1')]||'';this[_0x8bc9('0x2')]=_0x1666cd[_0x8bc9('0x2')]||'';this[_0x8bc9('0x3')]=_0x1666cd[_0x8bc9('0x3')]||'';this['remoteUri']=_0x1666cd['remoteUri']||'';this['authType']=_0x1666cd[_0x8bc9('0x4')]||'';this[_0x8bc9('0x5')]=_0x1666cd['type']||_0x8bc9('0x6');this[_0x8bc9('0x7')]=_0x1666cd[_0x8bc9('0x7')]||'';this[_0x8bc9('0x8')]=_0x1666cd[_0x8bc9('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 312db48..5280a1a 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 _0xd919=['host','zone','clientId','clientSecret','serverUrl','code','Configurations','exports','name','description'];(function(_0x509083,_0xa6676b){var _0x4b2495=function(_0x2a14f5){while(--_0x2a14f5){_0x509083['push'](_0x509083['shift']());}};_0x4b2495(++_0xa6676b);}(_0xd919,0x102));var _0x9d91=function(_0x5166df,_0xe2472e){_0x5166df=_0x5166df-0x0;var _0x272f9f=_0xd919[_0x5166df];return _0x272f9f;};'use strict';function ZohoAccount(_0x13930c){this['id']=_0x13930c['id']||0x0;this[_0x9d91('0x0')]=_0x13930c[_0x9d91('0x0')]||'';this[_0x9d91('0x1')]=_0x13930c[_0x9d91('0x1')]||'';this[_0x9d91('0x2')]=_0x13930c[_0x9d91('0x2')]||'';this[_0x9d91('0x3')]=_0x13930c[_0x9d91('0x3')]||'';this[_0x9d91('0x4')]=_0x13930c[_0x9d91('0x4')]||'';this[_0x9d91('0x5')]=_0x13930c[_0x9d91('0x5')]||'';this['serverUrl']=_0x13930c[_0x9d91('0x6')]||'';this[_0x9d91('0x7')]=_0x13930c[_0x9d91('0x7')]||'';this['refreshToken']=_0x13930c['refreshToken']||'';this[_0x9d91('0x8')]=_0x13930c['Configurations']||{};}module[_0x9d91('0x9')]=ZohoAccount; \ No newline at end of file +var _0xe4fc=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0xb41ad5,_0x1b0139){var _0x588d27=function(_0xdfcd51){while(--_0xdfcd51){_0xb41ad5['push'](_0xb41ad5['shift']());}};_0x588d27(++_0x1b0139);}(_0xe4fc,0x115));var _0xce4f=function(_0x1569fc,_0x115095){_0x1569fc=_0x1569fc-0x0;var _0x277783=_0xe4fc[_0x1569fc];return _0x277783;};'use strict';function ZohoAccount(_0x258f2e){this['id']=_0x258f2e['id']||0x0;this[_0xce4f('0x0')]=_0x258f2e['name']||'';this[_0xce4f('0x1')]=_0x258f2e[_0xce4f('0x1')]||'';this[_0xce4f('0x2')]=_0x258f2e[_0xce4f('0x2')]||'';this[_0xce4f('0x3')]=_0x258f2e[_0xce4f('0x3')]||'';this['clientId']=_0x258f2e[_0xce4f('0x4')]||'';this[_0xce4f('0x5')]=_0x258f2e[_0xce4f('0x5')]||'';this[_0xce4f('0x6')]=_0x258f2e[_0xce4f('0x6')]||'';this[_0xce4f('0x7')]=_0x258f2e[_0xce4f('0x7')]||'';this['refreshToken']=_0x258f2e[_0xce4f('0x8')]||'';this[_0xce4f('0x9')]=_0x258f2e[_0xce4f('0x9')]||{};}module[_0xce4f('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 36da099..ba5ca9b 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 _0x5bb8=['membername','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent'];(function(_0x24786e,_0x179471){var _0xb5c2b0=function(_0x34bfeb){while(--_0x34bfeb){_0x24786e['push'](_0x24786e['shift']());}};_0xb5c2b0(++_0x179471);}(_0x5bb8,0xd4));var _0x85bb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5bb8[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x85bb('0x0'));var _=require(_0x85bb('0x1'));var moment=require(_0x85bb('0x2'));function checkNameSurname(_0xa4482f,_0x49d393,_0x464bfb){var _0x7f2917='';if(!_[_0x85bb('0x3')](_0x49d393)&&_0x85bb('0x4')===typeof _0x49d393){_0x7f2917+=_0x49d393;}if(!_[_0x85bb('0x3')](_0x464bfb)&&_0x85bb('0x4')===typeof _0x464bfb){_0x7f2917+='\x20'+_0x464bfb;}if(_0x7f2917!==''){return _0x7f2917;}return _0xa4482f;}function Action(_0x3b0210,_0x240976,_0x5db46d,_0x222d2a,_0x17899e){this[_0x85bb('0x5')]=_0x5db46d||undefined;this['idContact']=_0x3b0210['id'];this[_0x85bb('0x6')]=_0x240976[_0x85bb('0x7')];this[_0x85bb('0x8')]=_0x240976[_0x85bb('0x8')];this[_0x85bb('0x9')]=_0x85bb('0x6');this[_0x85bb('0xa')]=![];this['membername']=_[_0x85bb('0x3')](_0x3b0210[_0x85bb('0xb')])?undefined:_0x3b0210[_0x85bb('0xb')][_0x85bb('0x7')];this[_0x85bb('0xc')]=this[_0x85bb('0xd')]?util['format']('SIP/%s',this[_0x85bb('0xd')]):_0x222d2a||undefined;this[_0x85bb('0xe')]=checkNameSurname(_0x3b0210[_0x85bb('0xf')][_0x85bb('0x10')],_0x3b0210[_0x85bb('0xf')][_0x85bb('0x11')],_0x3b0210[_0x85bb('0xf')][_0x85bb('0x12')]);this[_0x85bb('0x13')]=_0x3b0210[_0x85bb('0x13')]||![];this[_0x85bb('0x14')]=_0x3b0210[_0x85bb('0xf')]['phone'];this['scheduledat']=_0x3b0210[_0x85bb('0x15')];this['countbusyretry']=_0x3b0210[_0x85bb('0x16')]||0x0;this['countcongestionretry']=_0x3b0210[_0x85bb('0x17')]||0x0;this[_0x85bb('0x18')]=_0x3b0210[_0x85bb('0x18')]||0x0;this[_0x85bb('0x19')]=(_0x3b0210['countbusyretry']||0x0)+(_0x3b0210[_0x85bb('0x17')]||0x0)+(_0x3b0210[_0x85bb('0x18')]||0x0)+(_0x3b0210['countnosuchnumberretry']||0x0)+(_0x3b0210[_0x85bb('0x1a')]||0x0)+(_0x3b0210['countabandonedretry']||0x0)+(_0x3b0210[_0x85bb('0x1b')]||0x0)+(_0x3b0210[_0x85bb('0x1c')]||0x0);this['countnosuchnumberretry']=_0x3b0210[_0x85bb('0x1d')]||0x0;this['countdropretry']=_0x3b0210[_0x85bb('0x1a')]||0x0;this['countabandonedretry']=_0x3b0210['countabandonedretry']||0x0;this[_0x85bb('0x1b')]=_0x3b0210[_0x85bb('0x1b')]||0x0;this[_0x85bb('0x1c')]=_0x3b0210['countagentrejectretry']||0x0;this[_0x85bb('0x1e')]=_0x3b0210['callback'];this[_0x85bb('0x1f')]=_0x3b0210[_0x85bb('0x1f')];this[_0x85bb('0x20')]=_0x3b0210[_0x85bb('0x20')];this[_0x85bb('0x21')]=_0x3b0210[_0x85bb('0x21')];this[_0x85bb('0x22')]=_0x3b0210['ContactId'];this[_0x85bb('0x23')]=_0x3b0210[_0x85bb('0x23')];this[_0x85bb('0x24')]=_[_0x85bb('0x3')](_0x3b0210[_0x85bb('0xb')])?_0x3b0210[_0x85bb('0x24')]:_0x3b0210[_0x85bb('0xb')]['id'];this[_0x85bb('0x25')]=_0x3b0210['VoiceQueueId'];this['originatecalleridnum']='';this[_0x85bb('0x26')]='';}Action[_0x85bb('0x27')][_0x85bb('0x28')]=function(){return util[_0x85bb('0x29')](_0x85bb('0x2a'),this[_0x85bb('0xe')],this[_0x85bb('0x2b')]);};module[_0x85bb('0x2c')]=Action; \ No newline at end of file +var _0x866d=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid'];(function(_0x556f0a,_0x334c4a){var _0x494080=function(_0x594d3a){while(--_0x594d3a){_0x556f0a['push'](_0x556f0a['shift']());}};_0x494080(++_0x334c4a);}(_0x866d,0x82));var _0xd866=function(_0xc3f0cd,_0x3886a2){_0xc3f0cd=_0xc3f0cd-0x0;var _0x14a8c4=_0x866d[_0xc3f0cd];return _0x14a8c4;};'use strict';var util=require('util');var _=require(_0xd866('0x0'));var moment=require('moment');function checkNameSurname(_0x370216,_0xbac7fb,_0xb7e60b){var _0x3c4949='';if(!_[_0xd866('0x1')](_0xbac7fb)&&_0xd866('0x2')===typeof _0xbac7fb){_0x3c4949+=_0xbac7fb;}if(!_['isNil'](_0xb7e60b)&&'string'===typeof _0xb7e60b){_0x3c4949+='\x20'+_0xb7e60b;}if(_0x3c4949!==''){return _0x3c4949;}return _0x370216;}function Action(_0x3626a0,_0x748933,_0x250ad7,_0xa3aec8,_0x171cd9){this[_0xd866('0x3')]=_0x250ad7||undefined;this[_0xd866('0x4')]=_0x3626a0['id'];this[_0xd866('0x5')]=_0x748933[_0xd866('0x6')];this[_0xd866('0x7')]=_0x748933[_0xd866('0x7')];this[_0xd866('0x8')]=_0xd866('0x5');this['dialAnswer']=![];this[_0xd866('0x9')]=_['isNil'](_0x3626a0[_0xd866('0xa')])?undefined:_0x3626a0[_0xd866('0xa')][_0xd866('0x6')];this['channelAgent']=this[_0xd866('0x9')]?util[_0xd866('0xb')](_0xd866('0xc'),this[_0xd866('0x9')]):_0xa3aec8||undefined;this['calleridname']=checkNameSurname(_0x3626a0[_0xd866('0xd')][_0xd866('0xe')],_0x3626a0['Contact'][_0xd866('0xf')],_0x3626a0[_0xd866('0xd')][_0xd866('0x10')]);this[_0xd866('0x11')]=_0x3626a0['active']||![];this['calleridnum']=_0x3626a0['Contact'][_0xd866('0xe')];this[_0xd866('0x12')]=_0x3626a0[_0xd866('0x12')];this[_0xd866('0x13')]=_0x3626a0[_0xd866('0x13')]||0x0;this[_0xd866('0x14')]=_0x3626a0['countcongestionretry']||0x0;this[_0xd866('0x15')]=_0x3626a0['countnoanswerretry']||0x0;this[_0xd866('0x16')]=(_0x3626a0[_0xd866('0x13')]||0x0)+(_0x3626a0[_0xd866('0x14')]||0x0)+(_0x3626a0[_0xd866('0x15')]||0x0)+(_0x3626a0[_0xd866('0x17')]||0x0)+(_0x3626a0[_0xd866('0x18')]||0x0)+(_0x3626a0[_0xd866('0x19')]||0x0)+(_0x3626a0[_0xd866('0x1a')]||0x0)+(_0x3626a0[_0xd866('0x1b')]||0x0);this['countnosuchnumberretry']=_0x3626a0[_0xd866('0x17')]||0x0;this['countdropretry']=_0x3626a0[_0xd866('0x18')]||0x0;this[_0xd866('0x19')]=_0x3626a0[_0xd866('0x19')]||0x0;this['countmachineretry']=_0x3626a0[_0xd866('0x1a')]||0x0;this['countagentrejectretry']=_0x3626a0[_0xd866('0x1b')]||0x0;this[_0xd866('0x1c')]=_0x3626a0[_0xd866('0x1c')];this[_0xd866('0x1d')]=_0x3626a0[_0xd866('0x1d')];this['callbackat']=_0x3626a0[_0xd866('0x1e')];this[_0xd866('0x1f')]=_0x3626a0[_0xd866('0x1f')];this[_0xd866('0x20')]=_0x3626a0['ContactId'];this['ListId']=_0x3626a0[_0xd866('0x21')];this[_0xd866('0x22')]=_[_0xd866('0x1')](_0x3626a0[_0xd866('0xa')])?_0x3626a0[_0xd866('0x22')]:_0x3626a0[_0xd866('0xa')]['id'];this['VoiceQueueId']=_0x3626a0[_0xd866('0x23')];this[_0xd866('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0xd866('0x25')]=function(){return util['format'](_0xd866('0x26'),this['calleridname'],this['number']);};module[_0xd866('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9ccd18b..fed7475 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 _0xd6d6=['[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','custom:agentconnect','buildObj','acw','buildAcw','custom:agentcomplete','complete','[16]','createCustomerFinal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','uniqueid','\x20Queue','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','activeContact','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','phone','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','isFailure','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory'];(function(_0x2b1144,_0x1fb2fa){var _0x24591e=function(_0x258e6c){while(--_0x258e6c){_0x2b1144['push'](_0x2b1144['shift']());}};_0x24591e(++_0x1fb2fa);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x137560,_0x2ca4b2){_0x137560=_0x137560-0x0;var _0x11d3c2=_0xd6d6[_0x137560];return _0x11d3c2;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var BPromise=require(_0x6d6d('0x2'));var uuid=require(_0x6d6d('0x3'));var moment=require('moment');var md5=require(_0x6d6d('0x4'));var Redis=require(_0x6d6d('0x5'));var config=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var loggerAction=require(_0x6d6d('0x7'))(_0x6d6d('0x9'));var ami=require('../ami');var rpcDb=require(_0x6d6d('0xa'));var Action=require(_0x6d6d('0xb'));var ut=require(_0x6d6d('0xc'));config[_0x6d6d('0xd')]=_[_0x6d6d('0xe')](config[_0x6d6d('0xd')],{'host':_0x6d6d('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x6d6d('0x10')][_0x6d6d('0x11')]=function(_0x23b18a){this[_0x6d6d('0x12')]=this[_0x6d6d('0x12')]?this['tail'][_0x6d6d('0x13')](_0x23b18a):_0x23b18a();};function Preview(_0x158f82){this['sequence']=new Sequence();this['campaignsPreview']=_0x158f82[_0x6d6d('0x14')];this[_0x6d6d('0x15')]=_0x158f82[_0x6d6d('0x15')];this[_0x6d6d('0x16')]={};this[_0x6d6d('0x17')]=_0x158f82[_0x6d6d('0x17')];this[_0x6d6d('0x18')]=0x0;ami['on'](_0x6d6d('0x19'),this['syncOriginateResponse'][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1b'),this[_0x6d6d('0x1c')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1d'),this['syncHangupRequest'][_0x6d6d('0x1a')](this));ami['on']('dialend',this[_0x6d6d('0x1e')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x1f'),this['syncNewExten']['bind'](this));ami['on'](_0x6d6d('0x20'),this[_0x6d6d('0x21')][_0x6d6d('0x1a')](this));ami['on'](_0x6d6d('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x6d6d('0x23'),this['syncBlindTransfer'][_0x6d6d('0x1a')](this));this[_0x6d6d('0x24')](this[_0x6d6d('0x25')]);}function emit(_0x450352,_0x40d35b,_0x3242d8){io['to'](_0x450352)[_0x6d6d('0x26')](_0x40d35b,_0x3242d8);}function emitCampaignPreview(_0x230ad7){if(_0x230ad7[_0x6d6d('0x27')]===_0x6d6d('0x28')){var _0x24b10d={'id':_0x230ad7['id'],'name':_0x230ad7[_0x6d6d('0x29')],'strategy':_0x230ad7[_0x6d6d('0x2a')],'answered':_0x230ad7[_0x6d6d('0x2b')],'available':_0x230ad7[_0x6d6d('0x2c')],'loggedIn':_0x230ad7[_0x6d6d('0x2d')],'pTalking':_0x230ad7[_0x6d6d('0x2e')],'sumBillable':_0x230ad7['sumBillable'],'sumDuration':_0x230ad7[_0x6d6d('0x2f')],'sumHoldTime':_0x230ad7[_0x6d6d('0x30')]||0x0,'talking':_0x230ad7[_0x6d6d('0x31')],'total':_0x230ad7[_0x6d6d('0x32')],'type':_0x230ad7[_0x6d6d('0x27')],'unmanaged':_0x230ad7[_0x6d6d('0x33')],'abandoned':_0x230ad7['abandoned'],'waiting':_0x230ad7[_0x6d6d('0x34')],'loggedInDb':_0x230ad7[_0x6d6d('0x35')],'dialActive':_0x230ad7[_0x6d6d('0x36')],'dialMethod':_0x230ad7[_0x6d6d('0x37')],'dialOriginateCallerIdName':_0x230ad7[_0x6d6d('0x38')],'dialOriginateCallerIdNumber':_0x230ad7[_0x6d6d('0x39')],'dialOriginateTimeout':_0x230ad7[_0x6d6d('0x3a')],'dialPrefix':_0x230ad7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x230ad7[_0x6d6d('0x3b')],'outboundAnswerCallsDay':_0x230ad7[_0x6d6d('0x3c')],'outboundBlacklistCallsDay':_0x230ad7['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x230ad7['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x230ad7[_0x6d6d('0x3d')],'outboundDropCallsDayACS':_0x230ad7[_0x6d6d('0x3e')],'outboundDropCallsDayCallersExit':_0x230ad7[_0x6d6d('0x3f')],'outboundDropCallsDayTimeout':_0x230ad7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x230ad7[_0x6d6d('0x40')],'outboundNoSuchCallsDay':_0x230ad7[_0x6d6d('0x41')],'outboundOriginateFailureCallsDay':_0x230ad7[_0x6d6d('0x42')],'outboundReCallsDay':_0x230ad7[_0x6d6d('0x43')],'outboundRejectCallsDay':_0x230ad7[_0x6d6d('0x44')],'outboundUnknownCallsDay':_0x230ad7[_0x6d6d('0x45')],'outboundAbandonedCallsDay':_0x230ad7[_0x6d6d('0x46')],'predictiveIntervalAnsweredCalls':_0x230ad7[_0x6d6d('0x47')],'predictiveIntervalAvgHoldtime':_0x230ad7[_0x6d6d('0x48')],'predictiveIntervalAvgTalktime':_0x230ad7[_0x6d6d('0x49')],'predictiveIntervalDroppedCallsCallersExit':_0x230ad7['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x230ad7[_0x6d6d('0x4a')],'predictiveIntervalErlangCalls':_0x230ad7['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x230ad7[_0x6d6d('0x4b')],'predictiveIntervalHitRate':_0x230ad7[_0x6d6d('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x230ad7[_0x6d6d('0x4d')],'predictiveIntervalPauses':_0x230ad7[_0x6d6d('0x4e')],'predictiveIntervalAvailable':_0x230ad7['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x230ad7[_0x6d6d('0x4f')],'message':_0x230ad7['message'],'originated':_0x230ad7[_0x6d6d('0x50')],'erlangCalls':_0x230ad7[_0x6d6d('0x51')],'erlangCallToSecond':_0x230ad7['erlangCallToSecond'],'erlangAbandonmentRate':_0x230ad7[_0x6d6d('0x52')],'erlangBusyFactor':_0x230ad7[_0x6d6d('0x53')],'startPredictive':_0x230ad7[_0x6d6d('0x54')],'startProgressive':_0x230ad7[_0x6d6d('0x55')]};if(_0x230ad7[_0x6d6d('0x56')]){_0x24b10d[_0x6d6d('0x56')]={'id':_0x230ad7[_0x6d6d('0x56')]['id'],'name':_0x230ad7[_0x6d6d('0x56')][_0x6d6d('0x29')],'active':_0x230ad7[_0x6d6d('0x56')][_0x6d6d('0x57')],'callerid':_0x230ad7[_0x6d6d('0x56')][_0x6d6d('0x58')]};}if(_0x230ad7[_0x6d6d('0x59')]){_0x24b10d['Interval']={'id':_0x230ad7[_0x6d6d('0x59')]['id'],'name':_0x230ad7[_0x6d6d('0x59')][_0x6d6d('0x29')]};}var _0x5e4f38=md5(JSON['stringify'](_0x24b10d));if(_0x230ad7['md5']!==_0x5e4f38){_0x230ad7[_0x6d6d('0x4')]=_0x5e4f38;emit(util[_0x6d6d('0x5a')](_0x6d6d('0x5b'),_0x24b10d['name']),_0x6d6d('0x5c'),_0x24b10d);}}}function emitVoiceQueueChannelRemove(_0x2607c1){logger[_0x6d6d('0x5d')](_0x6d6d('0x5e'),JSON['stringify'](_0x2607c1));emit(util['format']('voice:queue:%s',_0x2607c1[_0x6d6d('0x29')]),_0x6d6d('0x5f'),_0x2607c1);io[_0x6d6d('0x26')](_0x6d6d('0x60'),_0x2607c1);}function notSendMessagesQueue(_0x4e918b){if(_0x4e918b[_0x6d6d('0x61')]){if(_0x4e918b[_0x6d6d('0x50')]===0x0&&_0x4e918b[_0x6d6d('0x2e')]===0x0){_0x4e918b[_0x6d6d('0x61')]=![];_0x4e918b[_0x6d6d('0x2c')]=0x0;_0x4e918b[_0x6d6d('0x62')]=0x0;_0x4e918b['message']=_0x6d6d('0x63');ut[_0x6d6d('0x64')](_0x6d6d('0x65'),_0x4e918b[_0x6d6d('0x29')]+_0x6d6d('0x66'));}else{_0x4e918b[_0x6d6d('0x67')]=_0x6d6d('0x68');ut['logger'](_0x6d6d('0x65'),_0x4e918b[_0x6d6d('0x29')]+_0x6d6d('0x69'));}emitCampaignPreview(_0x4e918b);}}Preview[_0x6d6d('0x10')][_0x6d6d('0x24')]=function(){var _0x5d9268=this;setInterval(function(){_0x5d9268[_0x6d6d('0x6a')]();},0x7cf);};Preview[_0x6d6d('0x10')]['syncCampaigns']=function(){var _0x452de2=this['campaignsPreview'];this[_0x6d6d('0x18')]+=0x1;for(var _0x43c03c in _0x452de2){if(_0x452de2['hasOwnProperty'](_0x43c03c)&&(_0x452de2[_0x43c03c][_0x6d6d('0x37')]===_0x6d6d('0x8')||_0x452de2[_0x43c03c][_0x6d6d('0x37')]===_0x6d6d('0x6b'))&&_0x452de2[_0x43c03c][_0x6d6d('0x27')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x6d6d('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x452de2['hasOwnProperty'](_0x43c03c)&&_0x452de2[_0x43c03c][_0x6d6d('0x37')]===_0x6d6d('0x8')&&_0x452de2[_0x43c03c][_0x6d6d('0x27')]==='outbound'){if(_0x452de2[_0x43c03c][_0x6d6d('0x36')]){this['setMessage'](_0x452de2[_0x43c03c]);if(_0x452de2[_0x43c03c][_0x6d6d('0x6c')])this[_0x6d6d('0x6d')](_0x452de2[_0x43c03c]);}else{notSendMessagesQueue(_0x452de2[_0x43c03c]);}}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x6e')]=function(_0x75f298){var _0x2669f0=this;this[_0x6d6d('0x6f')]['enqueue'](function(){if(!_[_0x6d6d('0x70')](_0x2669f0[_0x6d6d('0x16')][_0x75f298])){loggerAction[_0x6d6d('0x5d')](_0x6d6d('0x71'),_0x75f298,_0x6d6d('0x72'),_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x73')],_0x6d6d('0x74'),JSON[_0x6d6d('0x75')](_0x2669f0['campaignsPreview'][_0x2669f0['actions'][_0x75f298][_0x6d6d('0x73')]][_0x6d6d('0x50')]),_0x6d6d('0x76'),JSON[_0x6d6d('0x75')](_0x2669f0[_0x6d6d('0x25')][_0x2669f0['actions'][_0x75f298][_0x6d6d('0x73')]][_0x6d6d('0x2e')]),JSON[_0x6d6d('0x75')](_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x77')]),JSON[_0x6d6d('0x75')](_[_0x6d6d('0x78')](_0x2669f0[_0x6d6d('0x16')][_0x75f298],[_0x6d6d('0x79'),_0x6d6d('0x7a'),_0x6d6d('0x7b'),_0x6d6d('0x7c')])));return ami['Action']({'action':_0x6d6d('0x7d'),'channel':_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x7e')]})[_0x6d6d('0x7f')](function(_0x340bf9){if(_0x340bf9['message']===_0x6d6d('0x80')){setTimeout(function(){if(_0x2669f0[_0x6d6d('0x16')][_0x75f298]){ut[_0x6d6d('0x81')](_0x2669f0['campaignsPreview'][_0x2669f0['actions'][_0x75f298][_0x6d6d('0x73')]],'[clearZombieChannel]');if(_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x77')]===!![]){ut[_0x6d6d('0x82')](_0x2669f0[_0x6d6d('0x25')][_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x73')]],_0x6d6d('0x83'));ut[_0x6d6d('0x84')](_0x6d6d('0x85')+_0x75f298,_0x2669f0[_0x6d6d('0x16')][_0x75f298]['queue']);}ut[_0x6d6d('0x84')](_0x6d6d('0x86')+_0x75f298,_0x2669f0[_0x6d6d('0x16')][_0x75f298][_0x6d6d('0x73')]);delete _0x2669f0[_0x6d6d('0x16')][_0x75f298];}},0x2328);}});}});};Preview[_0x6d6d('0x10')][_0x6d6d('0x87')]=function(){var _0x5e5ace=this;loggerAction['info'](_0x6d6d('0x88'),_[_0x6d6d('0x89')](this['actions']));for(var _0x3e98a0 in this[_0x6d6d('0x16')]){if(_0x5e5ace[_0x6d6d('0x16')][_0x6d6d('0x8a')](_0x3e98a0)){_0x5e5ace[_0x6d6d('0x6e')](_0x3e98a0);}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x6d')]=function(_0x1ef7fb){var _0x2abd8c=this;rpcDb[_0x6d6d('0x8b')](_0x1ef7fb['id'],ut[_0x6d6d('0x8c')](this[_0x6d6d('0x17')]))[_0x6d6d('0x8d')](function(_0x2671ec){if(!_[_0x6d6d('0x70')](_0x2671ec)){for(var _0x50d8dd=0x0;_0x50d8dd<_0x2671ec[_0x6d6d('0x8e')];_0x50d8dd+=0x1){if(ut[_0x6d6d('0x8f')](_0x2671ec[_0x50d8dd]['scheduledat'])<_0x1ef7fb[_0x6d6d('0x90')]*0x3c){if(_0x2671ec[_0x50d8dd][_0x6d6d('0x91')]&&!_0x2671ec[_0x50d8dd][_0x6d6d('0x91')][_0x6d6d('0x92')]){_0x2abd8c[_0x6d6d('0x93')](_0x2671ec[_0x50d8dd]['id'])[_0x6d6d('0x8d')](ut[_0x6d6d('0x94')](_0x6d6d('0x95')))[_0x6d6d('0x7f')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x6d6d('0x96')](_0x2671ec[_0x50d8dd]['id']);}}else{var _0x325fe2=new Action(_0x2671ec[_0x50d8dd],_0x1ef7fb);_0x325fe2[_0x6d6d('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ef7fb[_0x6d6d('0x43')]+=0x1;ut['logCustomer'](_0x325fe2,0x17,_0x6d6d('0x98'));if(_0x1ef7fb['dialRecallInQueue']){rpcDb[_0x6d6d('0x99')](ut[_0x6d6d('0x9a')](_0x2671ec[_0x50d8dd]));rpcDb[_0x6d6d('0x9b')](_0x325fe2,_0x6d6d('0x9c'));}else{ut[_0x6d6d('0x9d')](_0x325fe2,0x16,_0x6d6d('0x9e'));rpcDb['createCustomerHistory'](_0x325fe2,_0x6d6d('0x9f'));rpcDb['createCustomerFinal'](_0x325fe2,_0x6d6d('0x9f'));}}}}})['catch'](ut[_0x6d6d('0x94')](_0x6d6d('0xa0')));};Preview[_0x6d6d('0x10')][_0x6d6d('0xa1')]=function(_0x29b68b){_0x29b68b[_0x6d6d('0x61')]=!![];if(ut[_0x6d6d('0xa2')](_0x29b68b['loggedIn'])){_0x29b68b['message']=_0x6d6d('0xa3');}else if(!ut['isActive'](_0x29b68b[_0x6d6d('0x36')])){_0x29b68b['message']=_0x6d6d('0x63');}else if(!this[_0x6d6d('0xa4')](_0x29b68b[_0x6d6d('0x56')])){if(!this[_0x6d6d('0xa4')](_0x29b68b[_0x6d6d('0xa5')])){_0x29b68b[_0x6d6d('0x67')]='TRUNK_IS_NOT_REACHABLE';}else{_0x29b68b[_0x6d6d('0x67')]=_0x6d6d('0xa6');}}else{_0x29b68b[_0x6d6d('0x67')]=_0x6d6d('0xa6');}emitCampaignPreview(_0x29b68b);};Preview[_0x6d6d('0x10')][_0x6d6d('0xa7')]=function(_0x30e31f,_0x589d64,_0x3fa820){var _0x4ec43e=this;var _0x2103a1=this[_0x6d6d('0x16')][_0x589d64];var _0x1aa25d=this[_0x6d6d('0x25')][_0x2103a1[_0x6d6d('0x73')]];var _0x1d1d1d;if(_0x1aa25d){switch(_0x3fa820){case'1':_0x1aa25d[_0x6d6d('0x41')]+=0x1;_0x2103a1[_0x6d6d('0xa8')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut['totalGlobal'](_0x2103a1);ut['logCustomer'](_0x2103a1,0x0,_0x6d6d('0xaa'));ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x2103a1,_0x6d6d('0xab')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xac'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,'Global');rpcDb['createCustomerFinal'](_0x1d1d1d,_0x6d6d('0xb0'));}else{if(_0x2103a1['countnosuchnumberretry']>=_0x1aa25d['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x2103a1,_0x6d6d('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0x6d6d('0xb1')](_0x2103a1,'countnosuchnumberretry',_0x1aa25d[_0x6d6d('0xb2')]),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1['activeContact']);}}delete this['actions'][_0x30e31f[_0x6d6d('0xb4')]];break;case _0x6d6d('0xb5'):var _0x26812a=moment()[_0x6d6d('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x2103a1[_0x6d6d('0xb6')]=_0x26812a;_0x2103a1[_0x6d6d('0xb7')]=_0x26812a;_0x2103a1[_0x6d6d('0x77')]=!![];_0x1aa25d[_0x6d6d('0x2e')]+=0x1;logger['info'](_0x6d6d('0xb8'),_0x2103a1['uniqueid'],'\x20Queue',_0x1aa25d['name'],_0x6d6d('0x76'),_0x1aa25d['pTalking']);ami[_0x6d6d('0x26')](_0x6d6d('0xb9'),ut[_0x6d6d('0xba')](_0x2103a1,'connect',this['campaignsPreview'][_0x2103a1[_0x6d6d('0x73')]]));if(_0x1aa25d[_0x6d6d('0xbb')]){ami['emit']('custom:agentConnectPreview',ut[_0x6d6d('0xbc')](_0x2103a1));}break;case'16':ami[_0x6d6d('0x26')](_0x6d6d('0xbd'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xbe'),this[_0x6d6d('0x25')][_0x2103a1[_0x6d6d('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2103a1,'complete'));_0x1aa25d['outboundAnswerCallsDay']+=0x1;_0x1aa25d['total']+=0x1;_0x1aa25d['answered']+=0x1;ut['decrementTalkink'](_0x1aa25d,_0x6d6d('0xbf'));_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x4,'Answer');rpcDb['createCustomerHistory'](_0x2103a1,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xc1'));rpcDb[_0x6d6d('0xc2')](_0x2103a1);_0x1aa25d[_0x6d6d('0x2f')]+=_0x2103a1['talktime'];_0x1aa25d['sumBillable']+=_0x2103a1[_0x6d6d('0xc3')];logger[_0x6d6d('0x5d')]('[syncHangup][talking][decrement]',_0x2103a1[_0x6d6d('0xc4')],_0x6d6d('0xc5'),_0x1aa25d[_0x6d6d('0x29')],_0x6d6d('0x76'),_0x1aa25d[_0x6d6d('0x2e')]);delete this['actions'][_0x30e31f[_0x6d6d('0xb4')]];break;case'BUSY':_0x1aa25d[_0x6d6d('0xc6')]+=0x1;_0x2103a1['countbusyretry']+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut['totalGlobal'](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x5,_0x6d6d('0xc7'));ami[_0x6d6d('0x26')](_0x6d6d('0xc8'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xc9')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xca'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xcc'));}else{if(_0x2103a1[_0x6d6d('0xcd')]>=_0x1aa25d[_0x6d6d('0xce')]){rpcDb['createCustomerFinal'](_0x2103a1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6d6d('0xcf')](ut['scheduledAt'](_0x2103a1,_0x6d6d('0xcd'),_0x1aa25d[_0x6d6d('0xd0')]),_0x2103a1['unlockAgent'],_0x2103a1['activeContact']);}}break;case _0x6d6d('0xd1'):_0x1aa25d['outboundNoAnswerCallsDay']+=0x1;_0x2103a1[_0x6d6d('0xd2')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x3,_0x6d6d('0xd3'));ami[_0x6d6d('0x26')](_0x6d6d('0xd4'),ut[_0x6d6d('0xba')](_0x2103a1,'noanswer'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xd5'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d['dialGlobalMaxRetry']){_0x1d1d1d=ut['cloneAction'](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xd6'));}else{if(_0x2103a1['countnoanswerretry']>=_0x1aa25d[_0x6d6d('0xd7')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6d6d('0xcf')](ut[_0x6d6d('0xb1')](_0x2103a1,_0x6d6d('0xd2'),_0x1aa25d[_0x6d6d('0xd8')]),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1['activeContact']);}}break;case _0x6d6d('0xd9'):_0x1aa25d[_0x6d6d('0x3d')]+=0x1;_0x2103a1['countcongestionretry']+=0x1;_0x2103a1['countglobal']=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x8,_0x6d6d('0xda'));ami[_0x6d6d('0x26')]('custom:agentcongestion',ut[_0x6d6d('0xba')](_0x2103a1,'congestion'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xdb'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xdc'));}else{if(_0x2103a1[_0x6d6d('0xdd')]>=_0x1aa25d[_0x6d6d('0xde')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xdb'));}else{rpcDb[_0x6d6d('0xcf')](ut[_0x6d6d('0xb1')](_0x2103a1,_0x6d6d('0xdd'),_0x1aa25d[_0x6d6d('0xd0')]),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1[_0x6d6d('0xdf')]);}}break;case _0x6d6d('0xe0'):_0x1aa25d[_0x6d6d('0x44')]+=0x1;_0x2103a1['countagentrejectretry']+=0x1;_0x2103a1['countglobal']=ut[_0x6d6d('0xad')](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0x14,_0x6d6d('0xe1'));ami[_0x6d6d('0x26')](_0x6d6d('0xe2'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xe3')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xe4'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0x14,_0x6d6d('0xe1'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xe5'));}else{if(_0x2103a1['countagentrejectretry']>=_0x1aa25d[_0x6d6d('0xe6')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xe5'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2103a1,'countagentrejectretry',_0x1aa25d[_0x6d6d('0xe7')]),_0x2103a1['unlockAgent'],_0x2103a1['activeContact']);}}break;case _0x6d6d('0xe8'):_0x1aa25d[_0x6d6d('0x46')]+=0x1;_0x2103a1[_0x6d6d('0xe9')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut['logCustomer'](_0x2103a1,0xb,_0x6d6d('0xea'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xeb'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut['cloneAction'](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb['createCustomerFinal'](_0x1d1d1d,_0x6d6d('0xeb'));}else{if(_0x2103a1['countabandonedetry']>=_0x1aa25d[_0x6d6d('0xec')]){rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xeb'));}else{rpcDb['rescheduleContact'](ut[_0x6d6d('0xb1')](_0x2103a1,_0x6d6d('0xe9'),_0x1aa25d['dialAbandonedRetryFrequency']),_0x2103a1[_0x6d6d('0xb3')],_0x2103a1[_0x6d6d('0xdf')]);}}break;case'18':_0x1aa25d[_0x6d6d('0x45')]+=0x1;_0x2103a1[_0x6d6d('0xed')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut['logCustomer'](_0x2103a1,0x12,_0x30e31f[_0x6d6d('0xee')]||_0x30e31f[_0x6d6d('0xef')]);ami['emit'](_0x6d6d('0xf0'),ut[_0x6d6d('0xba')](_0x2103a1,_0x6d6d('0xf1')));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xf2'));if(ut['totalGlobal'](_0x2103a1)>=_0x1aa25d['dialGlobalMaxRetry']){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,_0x6d6d('0xf2'));}else{rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xf2'));}delete this[_0x6d6d('0x16')][_0x30e31f['linkedid']];break;case'19':_0x1aa25d['outboundUnknownCallsDay']+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut[_0x6d6d('0xad')](_0x2103a1);ut['logCustomer'](_0x2103a1,0x13,_0x30e31f[_0x6d6d('0xee')]||_0x30e31f[_0x6d6d('0xef')]);ami[_0x6d6d('0x26')](_0x6d6d('0xf0'),ut[_0x6d6d('0xba')](_0x2103a1,'amd'));rpcDb[_0x6d6d('0x9b')](_0x2103a1,_0x6d6d('0xf3'));if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb['createCustomerFinal'](_0x1d1d1d,_0x6d6d('0xf3'));}else{rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xf3'));}delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xb4')]];break;default:if(_0x2103a1[_0x6d6d('0x77')]){ut[_0x6d6d('0x82')](_0x1aa25d,_0x6d6d('0xf4'));ut[_0x6d6d('0x84')](_0x6d6d('0xf5')+_0x1aa25d[_0x6d6d('0x29')],_0x30e31f);}_0x1aa25d[_0x6d6d('0x45')]+=0x1;_0x2103a1[_0x6d6d('0xa9')]=ut['totalGlobal'](_0x2103a1);ut[_0x6d6d('0x9d')](_0x2103a1,0xc,_0x30e31f[_0x6d6d('0xee')]||_0x30e31f[_0x6d6d('0xef')]);rpcDb[_0x6d6d('0x9b')](_0x2103a1,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x6d6d('0xad')](_0x2103a1)>=_0x1aa25d[_0x6d6d('0xae')]){_0x1d1d1d=ut[_0x6d6d('0xaf')](_0x2103a1,0xf,_0x6d6d('0xcb'));rpcDb[_0x6d6d('0xc0')](_0x1d1d1d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x6d6d('0xc0')](_0x2103a1,_0x6d6d('0xf6'));}delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xb4')]];}if(!(_0x2103a1['dialAnswer']&&_0x3fa820==='16')){ut[_0x6d6d('0x81')](_0x1aa25d,_0x6d6d('0xf7'));logger[_0x6d6d('0x5d')](_0x6d6d('0xf8'),_0x2103a1[_0x6d6d('0xc4')],_0x6d6d('0xc5'),_0x1aa25d[_0x6d6d('0x29')],_0x6d6d('0x74'),_0x1aa25d[_0x6d6d('0x50')]);}if(_0x3fa820!==_0x6d6d('0xb5')){delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xb4')]];delete this[_0x6d6d('0x16')][_0x30e31f[_0x6d6d('0xf9')]];}}};Preview[_0x6d6d('0x10')]['callProgressDetectingAgent']=function(_0x23d98a,_0x4cd7d8,_0x5e32ad){if(_[_0x6d6d('0xfa')](_0x4cd7d8)&&_0x6d6d('0xfb')!==typeof _0x4cd7d8){return;}if(_[_0x6d6d('0xfa')](_0x5e32ad)&&'object'!==typeof _0x5e32ad){return;}switch(_0x5e32ad[_0x6d6d('0xfc')]){case'0':ut[_0x6d6d('0xfd')](_0x23d98a,0x0,_0x6d6d('0xaa'));rpcDb[_0x6d6d('0xfe')](_0x23d98a,_0x6d6d('0xff'));break;case'3':ut[_0x6d6d('0xfd')](_0x23d98a,0x3,_0x6d6d('0xd3'));rpcDb[_0x6d6d('0xfe')](_0x23d98a,_0x6d6d('0x100'));break;case'5':ut[_0x6d6d('0xfd')](_0x23d98a,0x5,'Busy');rpcDb['createAgentHistory'](_0x23d98a,_0x6d6d('0x101'));break;case'8':ut[_0x6d6d('0xfd')](_0x23d98a,0x8,_0x6d6d('0xda'));rpcDb[_0x6d6d('0xfe')](_0x23d98a,_0x6d6d('0x102'));break;case'22':ut[_0x6d6d('0xfd')](_0x23d98a,0x16,_0x6d6d('0x103'));rpcDb['createAgentHistory'](_0x23d98a,_0x6d6d('0x104'));break;default:ut[_0x6d6d('0xfd')](_0x23d98a,0xc,_0x5e32ad[_0x6d6d('0xfc')]);rpcDb[_0x6d6d('0xfe')](_0x23d98a,'[callProgressDetectingAgent][logCongestion]');}ut[_0x6d6d('0x81')](_0x4cd7d8,_0x6d6d('0x105'));logger[_0x6d6d('0x5d')]('[originated][decrement][callProgressDetectingAgent]',_0x23d98a[_0x6d6d('0xc4')],_0x6d6d('0xc5'),_0x4cd7d8[_0x6d6d('0x29')],_0x6d6d('0x74'),_0x4cd7d8[_0x6d6d('0x50')]);delete this[_0x6d6d('0x16')][_0x23d98a[_0x6d6d('0xc4')]];};Preview[_0x6d6d('0x10')][_0x6d6d('0x106')]=function(_0xbe6d17,_0x193312,_0x1eafcb,_0x517f2f,_0x2f1b59){var _0x53160d=this;return new BPromise(function(_0x4b61e4,_0x4dc27b){if(_['isNil'](_0x193312)||_['isNil'](_0x193312[_0x6d6d('0x107')])||_['isNil'](_0x193312[_0x6d6d('0x107')]['phone'])||_[_0x6d6d('0x70')](_0x193312[_0x6d6d('0x7b')])){_0x4dc27b(ut['message']('Contact\x20is\x20undefined',_0x517f2f,_0x2f1b59));return;}var _0x23f498=uuid['v4']();var _0x5592fd=_0x53160d[_0x6d6d('0x25')][_0x193312[_0x6d6d('0x72')][_0x6d6d('0x29')]];var _0x53b797=_0x1eafcb?_0x53160d[_0x6d6d('0x17')][_0x1eafcb]['id']:undefined;_0x53160d['actions'][_0x23f498]=new Action(_0x193312,_0x5592fd,_0x23f498,_0x1eafcb,_0x53b797);var _0x38d705=_0x53160d[_0x6d6d('0x16')][_0x23f498];_0x38d705['unlockAgent']=_0x517f2f;_0x38d705['activeContact']=_0x2f1b59;_0x38d705[_0x6d6d('0x108')]=_0x1eafcb;if(_['isEmpty'](_0xbe6d17)){_0x53160d[_0x6d6d('0x109')](_0x38d705,_0x5592fd,_0x193312,_0x1eafcb)['then'](function(_0x3359c5){logger[_0x6d6d('0x5d')](_0x6d6d('0x10a'),'Queue:\x20'+_0x38d705['queue']+_0x6d6d('0x10b')+_0x38d705[_0x6d6d('0x10c')],JSON[_0x6d6d('0x75')](_0x3359c5));ami[_0x6d6d('0x26')](_0x6d6d('0x10d'),ut[_0x6d6d('0xba')](_0x38d705,_0x6d6d('0x10e'),_0x53160d['campaignsPreview'][_0x38d705[_0x6d6d('0x73')]]));_0x4b61e4(ut[_0x6d6d('0x67')](_0x6d6d('0x10f')));})[_0x6d6d('0x7f')](function(_0x2b483d){ut[_0x6d6d('0x64')](_0x6d6d('0x110'),_0x2b483d);_0x4dc27b(ut[_0x6d6d('0x67')](_0x6d6d('0x111'),_0x517f2f,_0x2f1b59));});}else{_0x5592fd['outboundBlacklistCallsDay']+=0x1;ut[_0x6d6d('0x112')](_0x38d705);rpcDb[_0x6d6d('0x113')](_0x38d705,_0x6d6d('0x114'));delete _0x53160d['actions'][_0x23f498];_0x4dc27b(ut['message'](_0x6d6d('0x115'),_0x517f2f,_0x2f1b59));}});};Preview[_0x6d6d('0x10')][_0x6d6d('0xa4')]=function(_0x112ed3){return!_[_0x6d6d('0x70')](_0x112ed3)&&!_[_0x6d6d('0x70')](_0x112ed3[_0x6d6d('0x29')])&&!_[_0x6d6d('0x70')](_0x112ed3[_0x6d6d('0x57')])&&_0x112ed3['active']&&!_['isNil'](this['trunks'][util[_0x6d6d('0x5a')](_0x6d6d('0x116'),_0x112ed3[_0x6d6d('0x29')])])&&!_[_0x6d6d('0x70')](this[_0x6d6d('0x15')][util[_0x6d6d('0x5a')](_0x6d6d('0x116'),_0x112ed3[_0x6d6d('0x29')])][_0x6d6d('0x7d')])&&(this[_0x6d6d('0x15')][util['format']('SIP/%s',_0x112ed3['name'])]['status']===_0x6d6d('0x117')||this['trunks'][util[_0x6d6d('0x5a')]('SIP/%s',_0x112ed3[_0x6d6d('0x29')])][_0x6d6d('0x7d')]==='unmonitored');};Preview['prototype'][_0x6d6d('0x93')]=function(_0xcbb056,_0x1269f3){var _0x1f44e0=this;return new BPromise(function(_0x577754,_0x5a5a4b){_0x1f44e0[_0x6d6d('0x118')](_0xcbb056,_0x1269f3)['then'](function(_0x2e25af){_0x577754(_['pick'](_0x2e25af,[_0x6d6d('0x67')]));})[_0x6d6d('0x7f')](function(_0x23c408){if(_0x23c408[_0x6d6d('0x119')]){rpcDb[_0x6d6d('0x11a')](_0xcbb056);}if(_0x23c408['active']){rpcDb['disableContact'](_0xcbb056);}_0x5a5a4b(_[_0x6d6d('0x78')](_0x23c408,[_0x6d6d('0x67')]));});});};Preview[_0x6d6d('0x10')][_0x6d6d('0x118')]=function(_0x3951e4,_0x1d863e){var _0x23f266=this;return new BPromise(function(_0xd26616,_0x576ef8){var _0x2670e4,_0x29005c;rpcDb[_0x6d6d('0x11b')](_0x3951e4)[_0x6d6d('0x8d')](function(_0x5d169e){if(!_['isNil'](_0x5d169e[0x0])){_0x29005c=_0x5d169e[0x0][_0x6d6d('0x11c')]?![]:!![];_0x2670e4=_0x5d169e[0x0]['recallme']?!![]:![];_0x2670e4=_0x1d863e?!![]:_0x2670e4;}var _0x4acf03=_0x23f266[_0x6d6d('0x11d')](_0x5d169e);if(_0x4acf03['isValid']){rpcDb['checkIsBlackList'](_[_0x6d6d('0x78')](_0x5d169e[0x0],[_0x6d6d('0x7b'),_0x6d6d('0x11e')]))[_0x6d6d('0x8d')](function(_0x523319){_0x23f266[_0x6d6d('0x106')](_0x523319,_0x5d169e[0x0],_0x1d863e,_0x29005c,_0x2670e4)[_0x6d6d('0x8d')](function(_0x25f457){_0xd26616(_0x25f457);})[_0x6d6d('0x7f')](function(_0x49c750){_0x576ef8(_0x49c750);});})[_0x6d6d('0x7f')](function(_0x148766){ut['logger']('[Preview][checkIsBlackList]',_0x148766);_0x576ef8(ut[_0x6d6d('0x67')](_0x6d6d('0x11f'),_0x29005c,_0x2670e4));});}else{_0x576ef8(ut['message'](_0x4acf03[_0x6d6d('0x67')],_0x29005c,_0x2670e4));}})[_0x6d6d('0x7f')](function(_0x3a7c8b){ut[_0x6d6d('0x64')](_0x6d6d('0x120'),_0x3a7c8b);_0x576ef8(ut[_0x6d6d('0x67')](_0x6d6d('0x11f'),![],!![]));});});};Preview[_0x6d6d('0x10')][_0x6d6d('0x11d')]=function(_0x3bd687){if(_[_0x6d6d('0x70')](_0x3bd687)||_[_0x6d6d('0x121')](_0x3bd687)||!_['isNil'](_0x3bd687[0x0][_0x6d6d('0x91')])&&_['isNil'](_0x3bd687[0x0][_0x6d6d('0x91')][_0x6d6d('0x29')])){ut[_0x6d6d('0x64')]('[Preview][validateContact][Empty\x20Contact]',_0x3bd687);return{'isValid':![],'message':'Empty\x20Contact'};}var _0xe718e8=this[_0x6d6d('0x25')][_0x3bd687[0x0][_0x6d6d('0x72')][_0x6d6d('0x29')]];_0xe718e8['message']=_0x6d6d('0xa6');if(_['isNil'](_0xe718e8)){ut[_0x6d6d('0x64')]('[Preview][validateContact][Empty\x20Campaign]',_0xe718e8);return{'isValid':![],'message':_0x6d6d('0x122')};}if(!this[_0x6d6d('0xa4')](_0xe718e8[_0x6d6d('0x56')])){ut['logger'](_0x6d6d('0x123'),'campaign\x20Name:\x20'+_0xe718e8[_0x6d6d('0x29')]+_0x6d6d('0x124'));if(!this['isTrunkReachable'](_0xe718e8[_0x6d6d('0xa5')])){ut['logger'](_0x6d6d('0x123'),_0xe718e8[_0x6d6d('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6d6d('0x125')};}}if(!ut[_0x6d6d('0x126')](_0xe718e8['dialActive'])){ut[_0x6d6d('0x64')](_0x6d6d('0x127'),_0xe718e8[_0x6d6d('0x29')]+_0x6d6d('0x128'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xe718e8[_0x6d6d('0x29')]+_0x6d6d('0x128')};}return{'isValid':!![],'message':_0x6d6d('0x129')};};Preview['prototype'][_0x6d6d('0x109')]=function(_0x1afe7a,_0x58c23d,_0x5a586c,_0x49e97f){var _0x253190=this;return new BPromise(function(_0x30f642,_0x3cb53d){var _0x11054e=_0x1afe7a[_0x6d6d('0xc4')];var _0x3204c6=_0x253190[_0x6d6d('0xa4')](_0x58c23d[_0x6d6d('0x56')])?util[_0x6d6d('0x5a')]('SIP/%s/%s%s',_0x58c23d[_0x6d6d('0x56')]['name'],_[_0x6d6d('0x70')](_0x58c23d['dialPrefix'])?'':_0x58c23d[_0x6d6d('0x12a')][_0x6d6d('0x12b')]()||'',_0x58c23d[_0x6d6d('0x12c')]>0x0?_0x5a586c[_0x6d6d('0x107')][_0x6d6d('0x12d')]['substring'](_0x58c23d['dialCutDigit']):_0x5a586c[_0x6d6d('0x107')]['phone']):util[_0x6d6d('0x5a')](_0x6d6d('0x12e'),_[_0x6d6d('0x70')](_0x58c23d['TrunkBackup'])?_0x58c23d[_0x6d6d('0x56')][_0x6d6d('0x29')]:_0x58c23d[_0x6d6d('0xa5')][_0x6d6d('0x29')],_[_0x6d6d('0x70')](_0x58c23d['dialPrefix'])?'':_0x58c23d[_0x6d6d('0x12a')][_0x6d6d('0x12b')]()||'',_0x58c23d[_0x6d6d('0x12c')]>0x0?_0x5a586c[_0x6d6d('0x107')][_0x6d6d('0x12d')]['substring'](_0x58c23d[_0x6d6d('0x12c')]):_0x5a586c['Contact']['phone']);var _0x509aea=_0x253190[_0x6d6d('0xa4')](_0x58c23d['Trunk'])?ut[_0x6d6d('0x12f')](_0x58c23d[_0x6d6d('0x56')][_0x6d6d('0x58')],_0x58c23d['dialOriginateCallerIdName'],_0x58c23d['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x58c23d[_0x6d6d('0x39')],_0x58c23d[_0x6d6d('0x130')]):_0x58c23d[_0x6d6d('0x39')]):ut[_0x6d6d('0x12f')](_[_0x6d6d('0x70')](_0x58c23d[_0x6d6d('0xa5')])?_0x58c23d[_0x6d6d('0x56')][_0x6d6d('0x58')]:_0x58c23d[_0x6d6d('0xa5')]['callerid'],_0x58c23d['dialOriginateCallerIdName'],_0x58c23d[_0x6d6d('0x130')]>0x0?ut[_0x6d6d('0x131')](_0x58c23d[_0x6d6d('0x39')],_0x58c23d['dialRandomLastDigitCallerIdNumber']):_0x58c23d[_0x6d6d('0x39')]);if(_0x509aea){_0x1afe7a[_0x6d6d('0x132')]=ut[_0x6d6d('0x133')](_0x509aea);_0x1afe7a[_0x6d6d('0x134')]=ut[_0x6d6d('0x135')](_0x509aea);}var _0x297c0d=ut[_0x6d6d('0x136')](_0x58c23d,_0x5a586c,_0x3204c6,_0x509aea,_0x11054e,_0x1afe7a);_[_0x6d6d('0x137')](_0x1afe7a,ut['toLowerVariables'](_0x297c0d));_0x1afe7a[_0x6d6d('0x97')]=moment()[_0x6d6d('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6d6d('0x138')](ut[_0x6d6d('0x139')](_0x1afe7a,_0x58c23d,_0x297c0d,_0x1afe7a[_0x6d6d('0xdf')],_0x49e97f))[_0x6d6d('0x8d')](function(_0x25fe97){_0x58c23d['originated']+=0x1;logger['info'](_0x6d6d('0x13a'),_0x11054e,_0x6d6d('0xc5'),_0x58c23d[_0x6d6d('0x29')],_0x6d6d('0x74'),_0x58c23d[_0x6d6d('0x50')]);_0x30f642(_0x25fe97);})[_0x6d6d('0x7f')](function(_0x33a6b0){ut[_0x6d6d('0xfd')](_0x1afe7a,0xe,_0x6d6d('0x13b'));rpcDb['createAgentHistory'](_0x1afe7a,_0x6d6d('0x13c'));_0x3cb53d(_0x33a6b0);});});};Preview['prototype']['syncNewExten']=function(_0x5b1a34){if(this[_0x6d6d('0x16')][_0x5b1a34[_0x6d6d('0xb4')]]){this[_0x6d6d('0x16')][_0x5b1a34[_0x6d6d('0xb4')]][_0x6d6d('0x7e')]=_0x5b1a34[_0x6d6d('0x7e')];}};Preview[_0x6d6d('0x10')][_0x6d6d('0x13d')]=function(_0x295e50){var _0x3e7fbc=this;var _0x5b2f13=this[_0x6d6d('0x16')][_0x295e50[_0x6d6d('0x13e')]];if(_0x5b2f13){if(_0x5b2f13[_0x6d6d('0x108')]&&this[_0x6d6d('0x17')][_0x5b2f13[_0x6d6d('0x108')]]){ut[_0x6d6d('0x13f')](_0x5b2f13,this[_0x6d6d('0x17')][_0x5b2f13[_0x6d6d('0x108')]][_0x6d6d('0x29')],this[_0x6d6d('0x17')][_0x5b2f13['lookAgent']]['id']);}var _0x2f8e24=_['clone'](_0x5b2f13);_0x2f8e24[_0x6d6d('0xb6')]=moment()[_0x6d6d('0x5a')](_0x6d6d('0x140'));var _0x54fc39=_0x3e7fbc['campaignsPreview'][_0x5b2f13[_0x6d6d('0x73')]];if(ut[_0x6d6d('0x141')](_0x295e50['response'])){if(_0x5b2f13[_0x6d6d('0xb3')]){rpcDb[_0x6d6d('0x11a')](_0x5b2f13[_0x6d6d('0x10c')]);}if(_0x5b2f13[_0x6d6d('0xdf')]){rpcDb[_0x6d6d('0x96')](_0x5b2f13[_0x6d6d('0x10c')]);}ami[_0x6d6d('0x26')](_0x6d6d('0x142'),ut[_0x6d6d('0xba')](_0x5b2f13,_0x6d6d('0x143'),this[_0x6d6d('0x25')][_0x5b2f13['queue']]));this[_0x6d6d('0x144')](_0x2f8e24,_0x54fc39,_0x295e50);}else{_0x5b2f13[_0x6d6d('0x97')]=moment()[_0x6d6d('0x5a')](_0x6d6d('0x140'));ut[_0x6d6d('0xfd')](_0x2f8e24,0x4,'Answer');rpcDb['createAgentHistory'](_0x2f8e24,_0x6d6d('0x145'));}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x1c')]=function(_0x1a87d6){var _0x23d3bf=this;var _0x2a4cf4=this['actions'][_0x1a87d6['linkedid']];var _0x1194f8;if(_0x2a4cf4){_0x1194f8=this[_0x6d6d('0x25')][_0x2a4cf4[_0x6d6d('0x73')]];logger[_0x6d6d('0x5d')](_0x6d6d('0x146'),_0x1a87d6[_0x6d6d('0xb4')],_0x6d6d('0xc5'),_0x1194f8[_0x6d6d('0x29')],'pTalking:\x20',_0x1194f8[_0x6d6d('0x2e')]);}if(this[_0x6d6d('0x16')][_0x1a87d6[_0x6d6d('0xb4')]]&&_0x1a87d6[_0x6d6d('0xb4')]!==_0x1a87d6['uniqueid']){if(_0x1a87d6[_0x6d6d('0x147')]==='16'&&this[_0x6d6d('0x16')][_0x1a87d6[_0x6d6d('0xb4')]][_0x6d6d('0x77')]){this[_0x6d6d('0xa7')](_0x1a87d6,_0x1a87d6['linkedid'],_0x1a87d6['cause']);}else if(this[_0x6d6d('0x16')][_0x1a87d6[_0x6d6d('0xb4')]][_0x6d6d('0x77')]){logger['info']('[syncHangup][talking][cause]',_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')],_0x6d6d('0xc5'),_0x1194f8[_0x6d6d('0x29')],'pTalking:\x20',_0x1194f8['pTalking']);this[_0x6d6d('0xa7')](_0x1a87d6,_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')]);}}else if(_0x2a4cf4&&_[_0x6d6d('0x70')](_0x2a4cf4[_0x6d6d('0x148')])&&_0x1194f8[_0x6d6d('0x149')]&&_0x1a87d6[_0x6d6d('0xb4')]===_0x1a87d6[_0x6d6d('0xc4')]&&_[_0x6d6d('0x70')](_0x1a87d6[_0x6d6d('0xfc')])&&_0x1a87d6[_0x6d6d('0x147')]==='16'&&_0x1a87d6['channelstate']==='6'&&_[_0x6d6d('0xfa')](_0x2a4cf4[_0x6d6d('0x14a')])){if(_0x2a4cf4['unlockAgent']){rpcDb[_0x6d6d('0x11a')](_0x2a4cf4[_0x6d6d('0x10c')]);}if(_0x2a4cf4[_0x6d6d('0xdf')]){rpcDb[_0x6d6d('0x96')](_0x2a4cf4[_0x6d6d('0x10c')]);}_0x1a87d6[_0x6d6d('0xfc')]='22';this[_0x6d6d('0x144')](_0x2a4cf4,_0x1194f8,_0x1a87d6);}else if(_0x2a4cf4&&_0x2a4cf4[_0x6d6d('0x14a')]){if(_0x1a87d6[_0x6d6d('0x147')]==='16'&&this[_0x6d6d('0x16')][_0x1a87d6['linkedid']]['dialAnswer']){logger['info'](_0x6d6d('0x14b'),_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')],'\x20Queue',_0x1194f8[_0x6d6d('0x29')],_0x6d6d('0x76'),_0x1194f8[_0x6d6d('0x2e')]);this['callProgressDetectingCustomer'](_0x1a87d6,_0x1a87d6['linkedid'],_0x1a87d6[_0x6d6d('0x147')]);}else if(this['actions'][_0x1a87d6[_0x6d6d('0xb4')]][_0x6d6d('0x77')]){logger[_0x6d6d('0x5d')](_0x6d6d('0x14c'),_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')],_0x6d6d('0xc5'),_0x1194f8[_0x6d6d('0x29')],_0x6d6d('0x76'),_0x1194f8[_0x6d6d('0x2e')]);this['callProgressDetectingCustomer'](_0x1a87d6,_0x1a87d6[_0x6d6d('0xb4')],_0x1a87d6[_0x6d6d('0x147')]);}}};Preview[_0x6d6d('0x10')]['syncDialEnd']=function(_0x3a47d4){if(this['actions'][_0x3a47d4['destlinkedid']]&&_0x3a47d4['destlinkedid']!==_0x3a47d4['destuniqueid']){this['callProgressDetectingCustomer'](_0x3a47d4,_0x3a47d4[_0x6d6d('0xf9')],_0x3a47d4['dialstatus']);}};Preview[_0x6d6d('0x10')][_0x6d6d('0x14d')]=function(_0x44a7ba){if(this[_0x6d6d('0x16')][_0x44a7ba['linkedid']]&&_0x44a7ba[_0x6d6d('0xb4')]!==_0x44a7ba[_0x6d6d('0xc4')]&&!this['actions'][_0x44a7ba['linkedid']][_0x6d6d('0x77')]){if(_0x44a7ba[_0x6d6d('0x147')]==='1'){this['callProgressDetectingCustomer'](_0x44a7ba,_0x44a7ba[_0x6d6d('0xb4')],_0x44a7ba[_0x6d6d('0x147')]);}}};Preview['prototype'][_0x6d6d('0x14e')]=function(_0x263039,_0x3becf6,_0x5a5f4d){if(this[_0x6d6d('0x16')][_0x263039]){if(_[_0x6d6d('0x70')](this[_0x6d6d('0x16')][_0x263039][_0x6d6d('0x14f')])){this[_0x6d6d('0x16')][_0x263039][_0x6d6d('0x14f')]={};}this['actions'][_0x263039][_0x6d6d('0x14f')][_0x3becf6]=_0x5a5f4d;}};Preview[_0x6d6d('0x10')][_0x6d6d('0x21')]=function(_0x48f8ad){try{if(!_[_0x6d6d('0x70')](_0x48f8ad)){if(ut[_0x6d6d('0x150')](_[_0x6d6d('0x151')](_0x48f8ad[_0x6d6d('0x152')])[0x0])){this[_0x6d6d('0x14e')](_0x48f8ad['uniqueid'],_[_0x6d6d('0x151')](_0x48f8ad['variable'])[0x0],_0x48f8ad[_0x6d6d('0x153')]);}}}catch(_0x37015c){logger['error']('[syncVarSet][Preview]',util[_0x6d6d('0x154')](_0x37015c,{'showHidden':![],'depth':null}));}};Preview[_0x6d6d('0x10')][_0x6d6d('0x155')]=function(_0x14cadd){if(_0x14cadd){if(this['actions'][_0x14cadd[_0x6d6d('0x156')]]){this[_0x6d6d('0x16')][_0x14cadd[_0x6d6d('0x156')]][_0x6d6d('0x14a')]=!![];}}};Preview[_0x6d6d('0x10')][_0x6d6d('0x157')]=function(_0x24fce3){if(_0x24fce3){if(this['actions'][_0x24fce3[_0x6d6d('0x158')]]){this[_0x6d6d('0x16')][_0x24fce3['transfererlinkedid']]['transfer']=!![];}}};module[_0x6d6d('0x159')]=Preview; \ No newline at end of file +var _0x8d0e=['rescheduleContact','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','logger','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','merge','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','clone','isFailure','unlockContact','idContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','reason','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','type','outbound','name','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','dialMethod','preview','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','scheduledat','Agent','[RecallMe]','logger2','disableContact','starttime','outboundReCallsDay','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry'];(function(_0x40c6a3,_0x450c45){var _0x309a7b=function(_0x234068){while(--_0x234068){_0x40c6a3['push'](_0x40c6a3['shift']());}};_0x309a7b(++_0x450c45);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x577ada,_0xd97308){_0x577ada=_0x577ada-0x0;var _0x3b1f1b=_0x8d0e[_0x577ada];return _0x3b1f1b;};'use strict';var util=require(_0xe8d0('0x0'));var _=require(_0xe8d0('0x1'));var BPromise=require(_0xe8d0('0x2'));var uuid=require(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var md5=require(_0xe8d0('0x5'));var Redis=require(_0xe8d0('0x6'));var config=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('preview');var loggerAction=require(_0xe8d0('0x8'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xe8d0('0x9'));var Action=require(_0xe8d0('0xa'));var ut=require(_0xe8d0('0xb'));config[_0xe8d0('0xc')]=_[_0xe8d0('0xd')](config[_0xe8d0('0xc')],{'host':_0xe8d0('0xe'),'port':0x18eb});var io=require(_0xe8d0('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe8d0('0x10')][_0xe8d0('0x11')]=function(_0x463159){this['tail']=this['tail']?this[_0xe8d0('0x12')][_0xe8d0('0x13')](_0x463159):_0x463159();};function Preview(_0x3da047){this[_0xe8d0('0x14')]=new Sequence();this[_0xe8d0('0x15')]=_0x3da047[_0xe8d0('0x16')];this['trunks']=_0x3da047[_0xe8d0('0x17')];this[_0xe8d0('0x18')]={};this['agents']=_0x3da047[_0xe8d0('0x19')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xe8d0('0x1a')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x1c'),this[_0xe8d0('0x1d')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x1e'),this['syncHangupRequest'][_0xe8d0('0x1b')](this));ami['on']('dialend',this[_0xe8d0('0x1f')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x20'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xe8d0('0x21')][_0xe8d0('0x1b')](this));ami['on'](_0xe8d0('0x22'),this[_0xe8d0('0x23')][_0xe8d0('0x1b')](this));ami['on']('blindtransfer',this[_0xe8d0('0x24')][_0xe8d0('0x1b')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x554402,_0x384a60,_0x35d131){io['to'](_0x554402)[_0xe8d0('0x25')](_0x384a60,_0x35d131);}function emitCampaignPreview(_0x1fbfe8){if(_0x1fbfe8[_0xe8d0('0x26')]===_0xe8d0('0x27')){var _0x1bd25c={'id':_0x1fbfe8['id'],'name':_0x1fbfe8[_0xe8d0('0x28')],'strategy':_0x1fbfe8[_0xe8d0('0x29')],'answered':_0x1fbfe8['answered'],'available':_0x1fbfe8[_0xe8d0('0x2a')],'loggedIn':_0x1fbfe8[_0xe8d0('0x2b')],'pTalking':_0x1fbfe8['pTalking'],'sumBillable':_0x1fbfe8[_0xe8d0('0x2c')],'sumDuration':_0x1fbfe8[_0xe8d0('0x2d')],'sumHoldTime':_0x1fbfe8[_0xe8d0('0x2e')]||0x0,'talking':_0x1fbfe8[_0xe8d0('0x2f')],'total':_0x1fbfe8[_0xe8d0('0x30')],'type':_0x1fbfe8[_0xe8d0('0x26')],'unmanaged':_0x1fbfe8[_0xe8d0('0x31')],'abandoned':_0x1fbfe8[_0xe8d0('0x32')],'waiting':_0x1fbfe8[_0xe8d0('0x33')],'loggedInDb':_0x1fbfe8[_0xe8d0('0x34')],'dialActive':_0x1fbfe8[_0xe8d0('0x35')],'dialMethod':_0x1fbfe8['dialMethod'],'dialOriginateCallerIdName':_0x1fbfe8[_0xe8d0('0x36')],'dialOriginateCallerIdNumber':_0x1fbfe8[_0xe8d0('0x37')],'dialOriginateTimeout':_0x1fbfe8[_0xe8d0('0x38')],'dialPrefix':_0x1fbfe8['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1fbfe8[_0xe8d0('0x39')],'outboundAnswerCallsDay':_0x1fbfe8[_0xe8d0('0x3a')],'outboundBlacklistCallsDay':_0x1fbfe8['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1fbfe8[_0xe8d0('0x3b')],'outboundCongestionCallsDay':_0x1fbfe8[_0xe8d0('0x3c')],'outboundDropCallsDayACS':_0x1fbfe8[_0xe8d0('0x3d')],'outboundDropCallsDayCallersExit':_0x1fbfe8[_0xe8d0('0x3e')],'outboundDropCallsDayTimeout':_0x1fbfe8[_0xe8d0('0x3f')],'outboundNoAnswerCallsDay':_0x1fbfe8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1fbfe8[_0xe8d0('0x40')],'outboundOriginateFailureCallsDay':_0x1fbfe8['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1fbfe8['outboundReCallsDay'],'outboundRejectCallsDay':_0x1fbfe8['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1fbfe8[_0xe8d0('0x41')],'outboundAbandonedCallsDay':_0x1fbfe8[_0xe8d0('0x42')],'predictiveIntervalAnsweredCalls':_0x1fbfe8[_0xe8d0('0x43')],'predictiveIntervalAvgHoldtime':_0x1fbfe8['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1fbfe8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1fbfe8[_0xe8d0('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x1fbfe8['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1fbfe8[_0xe8d0('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x1fbfe8[_0xe8d0('0x46')],'predictiveIntervalHitRate':_0x1fbfe8[_0xe8d0('0x47')],'predictiveIntervalMultiplicativeFactor':_0x1fbfe8[_0xe8d0('0x48')],'predictiveIntervalPauses':_0x1fbfe8[_0xe8d0('0x49')],'predictiveIntervalAvailable':_0x1fbfe8['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1fbfe8[_0xe8d0('0x4a')],'message':_0x1fbfe8[_0xe8d0('0x4b')],'originated':_0x1fbfe8[_0xe8d0('0x4c')],'erlangCalls':_0x1fbfe8[_0xe8d0('0x4d')],'erlangCallToSecond':_0x1fbfe8['erlangCallToSecond'],'erlangAbandonmentRate':_0x1fbfe8[_0xe8d0('0x4e')],'erlangBusyFactor':_0x1fbfe8[_0xe8d0('0x4f')],'startPredictive':_0x1fbfe8['startPredictive'],'startProgressive':_0x1fbfe8[_0xe8d0('0x50')]};if(_0x1fbfe8['Trunk']){_0x1bd25c[_0xe8d0('0x51')]={'id':_0x1fbfe8['Trunk']['id'],'name':_0x1fbfe8[_0xe8d0('0x51')]['name'],'active':_0x1fbfe8[_0xe8d0('0x51')][_0xe8d0('0x52')],'callerid':_0x1fbfe8[_0xe8d0('0x51')][_0xe8d0('0x53')]};}if(_0x1fbfe8['Interval']){_0x1bd25c[_0xe8d0('0x54')]={'id':_0x1fbfe8[_0xe8d0('0x54')]['id'],'name':_0x1fbfe8[_0xe8d0('0x54')]['name']};}var _0x2a66f8=md5(JSON[_0xe8d0('0x55')](_0x1bd25c));if(_0x1fbfe8[_0xe8d0('0x5')]!==_0x2a66f8){_0x1fbfe8[_0xe8d0('0x5')]=_0x2a66f8;emit(util[_0xe8d0('0x56')]('voice:queue:%s',_0x1bd25c[_0xe8d0('0x28')]),_0xe8d0('0x57'),_0x1bd25c);}}}function emitVoiceQueueChannelRemove(_0x10970d){logger[_0xe8d0('0x58')](_0xe8d0('0x59'),JSON[_0xe8d0('0x55')](_0x10970d));emit(util[_0xe8d0('0x56')](_0xe8d0('0x5a'),_0x10970d['name']),'voice_queue_channel:remove',_0x10970d);io[_0xe8d0('0x25')](_0xe8d0('0x5b'),_0x10970d);}function notSendMessagesQueue(_0x45e2dc){if(_0x45e2dc[_0xe8d0('0x5c')]){if(_0x45e2dc[_0xe8d0('0x4c')]===0x0&&_0x45e2dc['pTalking']===0x0){_0x45e2dc[_0xe8d0('0x5c')]=![];_0x45e2dc['available']=0x0;_0x45e2dc[_0xe8d0('0x5d')]=0x0;_0x45e2dc[_0xe8d0('0x4b')]=_0xe8d0('0x5e');ut['logger'](_0xe8d0('0x5f'),_0x45e2dc[_0xe8d0('0x28')]+_0xe8d0('0x60'));}else{_0x45e2dc[_0xe8d0('0x4b')]=_0xe8d0('0x61');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x45e2dc['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x45e2dc);}}Preview[_0xe8d0('0x10')]['loopCampaigns']=function(){var _0x1e6e8f=this;setInterval(function(){_0x1e6e8f[_0xe8d0('0x62')]();},0x7cf);};Preview[_0xe8d0('0x10')][_0xe8d0('0x62')]=function(){var _0x2fd21e=this[_0xe8d0('0x15')];this[_0xe8d0('0x63')]+=0x1;for(var _0x3cbca5 in _0x2fd21e){if(_0x2fd21e['hasOwnProperty'](_0x3cbca5)&&(_0x2fd21e[_0x3cbca5][_0xe8d0('0x64')]===_0xe8d0('0x65')||_0x2fd21e[_0x3cbca5]['dialMethod']==='booked')&&_0x2fd21e[_0x3cbca5][_0xe8d0('0x26')]===_0xe8d0('0x27')){if(this[_0xe8d0('0x63')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xe8d0('0x66')]();}}if(_0x2fd21e[_0xe8d0('0x67')](_0x3cbca5)&&_0x2fd21e[_0x3cbca5]['dialMethod']===_0xe8d0('0x65')&&_0x2fd21e[_0x3cbca5][_0xe8d0('0x26')]==='outbound'){if(_0x2fd21e[_0x3cbca5][_0xe8d0('0x35')]){this[_0xe8d0('0x68')](_0x2fd21e[_0x3cbca5]);if(_0x2fd21e[_0x3cbca5][_0xe8d0('0x69')])this[_0xe8d0('0x6a')](_0x2fd21e[_0x3cbca5]);}else{notSendMessagesQueue(_0x2fd21e[_0x3cbca5]);}}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6b')]=function(_0x11339d){var _0x1ce97d=this;this['sequence'][_0xe8d0('0x11')](function(){if(!_[_0xe8d0('0x6c')](_0x1ce97d[_0xe8d0('0x18')][_0x11339d])){loggerAction[_0xe8d0('0x58')](_0xe8d0('0x6d'),_0x11339d,_0xe8d0('0x6e'),_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x6f')],_0xe8d0('0x70'),JSON[_0xe8d0('0x55')](_0x1ce97d[_0xe8d0('0x15')][_0x1ce97d[_0xe8d0('0x18')][_0x11339d]['queue']][_0xe8d0('0x4c')]),_0xe8d0('0x71'),JSON[_0xe8d0('0x55')](_0x1ce97d[_0xe8d0('0x15')][_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x6f')]][_0xe8d0('0x72')]),JSON['stringify'](_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x73')]),JSON[_0xe8d0('0x55')](_[_0xe8d0('0x74')](_0x1ce97d['actions'][_0x11339d],[_0xe8d0('0x75'),'UserId',_0xe8d0('0x76'),_0xe8d0('0x77')])));return ami[_0xe8d0('0x78')]({'action':_0xe8d0('0x79'),'channel':_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x7a')]})[_0xe8d0('0x7b')](function(_0x52b8b2){if(_0x52b8b2[_0xe8d0('0x4b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1ce97d['actions'][_0x11339d]){ut[_0xe8d0('0x7c')](_0x1ce97d['campaignsPreview'][_0x1ce97d[_0xe8d0('0x18')][_0x11339d]['queue']],_0xe8d0('0x7d'));if(_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x73')]===!![]){ut[_0xe8d0('0x7e')](_0x1ce97d['campaignsPreview'][_0x1ce97d[_0xe8d0('0x18')][_0x11339d][_0xe8d0('0x6f')]],_0xe8d0('0x7d'));ut[_0xe8d0('0x7f')](_0xe8d0('0x80')+_0x11339d,_0x1ce97d['actions'][_0x11339d][_0xe8d0('0x6f')]);}ut[_0xe8d0('0x7f')](_0xe8d0('0x81')+_0x11339d,_0x1ce97d['actions'][_0x11339d][_0xe8d0('0x6f')]);delete _0x1ce97d['actions'][_0x11339d];}},0x2328);}});}});};Preview['prototype'][_0xe8d0('0x66')]=function(){var _0x37040a=this;loggerAction['info'](_0xe8d0('0x82'),_[_0xe8d0('0x83')](this['actions']));for(var _0x2a54c1 in this[_0xe8d0('0x18')]){if(_0x37040a[_0xe8d0('0x18')][_0xe8d0('0x67')](_0x2a54c1)){_0x37040a['clearZombieChannel'](_0x2a54c1);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x6a')]=function(_0x25e5ab){var _0x76316a=this;rpcDb['getContactRecallMe'](_0x25e5ab['id'],ut[_0xe8d0('0x84')](this[_0xe8d0('0x19')]))[_0xe8d0('0x85')](function(_0x35e0d5){if(!_[_0xe8d0('0x6c')](_0x35e0d5)){for(var _0x29667c=0x0;_0x29667c<_0x35e0d5['length'];_0x29667c+=0x1){if(ut['getDiff'](_0x35e0d5[_0x29667c][_0xe8d0('0x86')])<_0x25e5ab['dialRecallMeTimeout']*0x3c){if(_0x35e0d5[_0x29667c][_0xe8d0('0x87')]&&!_0x35e0d5[_0x29667c][_0xe8d0('0x87')]['voicePause']){_0x76316a['run'](_0x35e0d5[_0x29667c]['id'])[_0xe8d0('0x85')](ut['logger2'](_0xe8d0('0x88')))['catch'](ut[_0xe8d0('0x89')](_0xe8d0('0x88')));}else{rpcDb[_0xe8d0('0x8a')](_0x35e0d5[_0x29667c]['id']);}}else{var _0x4e2abc=new Action(_0x35e0d5[_0x29667c],_0x25e5ab);_0x4e2abc[_0xe8d0('0x8b')]=moment()[_0xe8d0('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x25e5ab[_0xe8d0('0x8c')]+=0x1;ut['logCustomer'](_0x4e2abc,0x17,_0xe8d0('0x8d'));if(_0x25e5ab['dialRecallInQueue']){rpcDb[_0xe8d0('0x8e')](ut[_0xe8d0('0x8f')](_0x35e0d5[_0x29667c]));rpcDb[_0xe8d0('0x90')](_0x4e2abc,_0xe8d0('0x91'));}else{ut[_0xe8d0('0x92')](_0x4e2abc,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e2abc,_0xe8d0('0x93'));rpcDb['createCustomerFinal'](_0x4e2abc,_0xe8d0('0x93'));}}}}})[_0xe8d0('0x7b')](ut[_0xe8d0('0x89')](_0xe8d0('0x94')));};Preview[_0xe8d0('0x10')][_0xe8d0('0x68')]=function(_0x177485){_0x177485[_0xe8d0('0x5c')]=!![];if(ut[_0xe8d0('0x95')](_0x177485[_0xe8d0('0x2b')])){_0x177485[_0xe8d0('0x4b')]=_0xe8d0('0x96');}else if(!ut[_0xe8d0('0x97')](_0x177485[_0xe8d0('0x35')])){_0x177485[_0xe8d0('0x4b')]='NOT_ACTIVE';}else if(!this[_0xe8d0('0x98')](_0x177485[_0xe8d0('0x51')])){if(!this[_0xe8d0('0x98')](_0x177485[_0xe8d0('0x99')])){_0x177485[_0xe8d0('0x4b')]='TRUNK_IS_NOT_REACHABLE';}else{_0x177485[_0xe8d0('0x4b')]=_0xe8d0('0x9a');}}else{_0x177485[_0xe8d0('0x4b')]=_0xe8d0('0x9a');}emitCampaignPreview(_0x177485);};Preview[_0xe8d0('0x10')][_0xe8d0('0x9b')]=function(_0x51eb0b,_0x13ceb4,_0x40cb5c){var _0x24be86=this;var _0x23955c=this[_0xe8d0('0x18')][_0x13ceb4];var _0x556d7e=this['campaignsPreview'][_0x23955c[_0xe8d0('0x6f')]];var _0x54c04f;if(_0x556d7e){switch(_0x40cb5c){case'1':_0x556d7e[_0xe8d0('0x40')]+=0x1;_0x23955c[_0xe8d0('0x9c')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x0,_0xe8d0('0x9e'));ami[_0xe8d0('0x25')](_0xe8d0('0x9f'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xa1')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xa2'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xa7'));}else{if(_0x23955c[_0xe8d0('0x9c')]>=_0x556d7e[_0xe8d0('0xa8')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0x9c'),_0x556d7e[_0xe8d0('0xaa')]),_0x23955c['unlockAgent'],_0x23955c[_0xe8d0('0xab')]);}}delete this['actions'][_0x51eb0b[_0xe8d0('0xac')]];break;case _0xe8d0('0xad'):var _0x22791b=moment()['format'](_0xe8d0('0xae'));_0x23955c[_0xe8d0('0xaf')]=_0x22791b;_0x23955c[_0xe8d0('0xb0')]=_0x22791b;_0x23955c[_0xe8d0('0x73')]=!![];_0x556d7e[_0xe8d0('0x72')]+=0x1;logger['info'](_0xe8d0('0xb1'),_0x23955c[_0xe8d0('0xb2')],_0xe8d0('0xb3'),_0x556d7e[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x556d7e[_0xe8d0('0x72')]);ami[_0xe8d0('0x25')](_0xe8d0('0xb4'),ut['buildObj'](_0x23955c,_0xe8d0('0xb5'),this[_0xe8d0('0x15')][_0x23955c[_0xe8d0('0x6f')]]));if(_0x556d7e[_0xe8d0('0xb6')]){ami['emit'](_0xe8d0('0xb7'),ut[_0xe8d0('0xb8')](_0x23955c));}break;case'16':ami[_0xe8d0('0x25')]('custom:agentcomplete',ut[_0xe8d0('0xa0')](_0x23955c,'complete',this[_0xe8d0('0x15')][_0x23955c['queue']]));emitVoiceQueueChannelRemove(ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xb9')));_0x556d7e[_0xe8d0('0x3a')]+=0x1;_0x556d7e[_0xe8d0('0x30')]+=0x1;_0x556d7e[_0xe8d0('0xba')]+=0x1;ut[_0xe8d0('0x7e')](_0x556d7e,_0xe8d0('0xbb'));_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x4,_0xe8d0('0xbd'));rpcDb[_0xe8d0('0x90')](_0x23955c,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xbe'));rpcDb[_0xe8d0('0xbf')](_0x23955c);_0x556d7e[_0xe8d0('0x2d')]+=_0x23955c[_0xe8d0('0xc0')];_0x556d7e[_0xe8d0('0x2c')]+=_0x23955c[_0xe8d0('0xc0')];logger[_0xe8d0('0x58')](_0xe8d0('0xc1'),_0x23955c[_0xe8d0('0xb2')],'\x20Queue',_0x556d7e[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x556d7e[_0xe8d0('0x72')]);delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xac')]];break;case'BUSY':_0x556d7e['outboundBusyCallsDay']+=0x1;_0x23955c[_0xe8d0('0xc2')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x5,_0xe8d0('0xc3'));ami['emit'](_0xe8d0('0xc4'),ut['buildObj'](_0x23955c,_0xe8d0('0xc5')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xc6'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut['cloneAction'](_0x23955c,0xf,'Global');rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xc7'));}else{if(_0x23955c[_0xe8d0('0xc2')]>=_0x556d7e[_0xe8d0('0xc8')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xc6'));}else{rpcDb[_0xe8d0('0xc9')](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0xc2'),_0x556d7e['dialBusyRetryFrequency']),_0x23955c[_0xe8d0('0xca')],_0x23955c[_0xe8d0('0xab')]);}}break;case _0xe8d0('0xcb'):_0x556d7e[_0xe8d0('0xcc')]+=0x1;_0x23955c['countnoanswerretry']+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x3,_0xe8d0('0xcd'));ami[_0xe8d0('0x25')](_0xe8d0('0xce'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xcf')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xd0'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e['dialGlobalMaxRetry']){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xd1'));}else{if(_0x23955c[_0xe8d0('0xd2')]>=_0x556d7e[_0xe8d0('0xd3')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xd0'));}else{rpcDb[_0xe8d0('0xc9')](ut['scheduledAt'](_0x23955c,'countnoanswerretry',_0x556d7e[_0xe8d0('0xd4')]),_0x23955c[_0xe8d0('0xca')],_0x23955c['activeContact']);}}break;case _0xe8d0('0xd5'):_0x556d7e[_0xe8d0('0x3c')]+=0x1;_0x23955c[_0xe8d0('0xd6')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0x8,_0xe8d0('0xd7'));ami[_0xe8d0('0x25')]('custom:agentcongestion',ut['buildObj'](_0x23955c,_0xe8d0('0xd8')));rpcDb[_0xe8d0('0x90')](_0x23955c,'[callProgressDetectingCustomer][logCongestion]');if(ut['totalGlobal'](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb['createCustomerFinal'](_0x54c04f,_0xe8d0('0xd9'));}else{if(_0x23955c['countcongestionretry']>=_0x556d7e['dialCongestionMaxRetry']){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xda'));}else{rpcDb[_0xe8d0('0xc9')](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0xd6'),_0x556d7e['dialBusyRetryFrequency']),_0x23955c[_0xe8d0('0xca')],_0x23955c[_0xe8d0('0xab')]);}}break;case'CANCEL':_0x556d7e[_0xe8d0('0xdb')]+=0x1;_0x23955c[_0xe8d0('0xdc')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut['logCustomer'](_0x23955c,0x14,_0xe8d0('0xdd'));ami[_0xe8d0('0x25')](_0xe8d0('0xde'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xdf')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xe0'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e['dialGlobalMaxRetry']){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0x14,_0xe8d0('0xdd'));rpcDb['createCustomerFinal'](_0x54c04f,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x23955c['countagentrejectretry']>=_0x556d7e['dialAgentRejectMaxRetry']){rpcDb[_0xe8d0('0xa6')](_0x23955c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xe8d0('0xa9')](_0x23955c,'countagentrejectretry',_0x556d7e[_0xe8d0('0xe1')]),_0x23955c[_0xe8d0('0xca')],_0x23955c[_0xe8d0('0xab')]);}}break;case _0xe8d0('0xe2'):_0x556d7e[_0xe8d0('0x42')]+=0x1;_0x23955c[_0xe8d0('0xe3')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0xb,_0xe8d0('0xe4'));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xe5'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,'Global');rpcDb[_0xe8d0('0xa6')](_0x54c04f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x23955c[_0xe8d0('0xe6')]>=_0x556d7e[_0xe8d0('0xe7')]){rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xe5'));}else{rpcDb[_0xe8d0('0xc9')](ut[_0xe8d0('0xa9')](_0x23955c,_0xe8d0('0xe3'),_0x556d7e[_0xe8d0('0xe8')]),_0x23955c['unlockAgent'],_0x23955c[_0xe8d0('0xab')]);}}break;case'18':_0x556d7e[_0xe8d0('0x41')]+=0x1;_0x23955c[_0xe8d0('0xe9')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut['logCustomer'](_0x23955c,0x12,_0x51eb0b['cause-txt']||_0x51eb0b[_0xe8d0('0xea')]);ami[_0xe8d0('0x25')](_0xe8d0('0xeb'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xec')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xed'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xed'));}else{rpcDb['createCustomerFinal'](_0x23955c,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xac')]];break;case'19':_0x556d7e[_0xe8d0('0x41')]+=0x1;_0x23955c[_0xe8d0('0xbc')]=ut[_0xe8d0('0x9d')](_0x23955c);ut['logCustomer'](_0x23955c,0x13,_0x51eb0b['cause-txt']||_0x51eb0b[_0xe8d0('0xea')]);ami['emit'](_0xe8d0('0xeb'),ut[_0xe8d0('0xa0')](_0x23955c,_0xe8d0('0xec')));rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xee'));if(ut[_0xe8d0('0x9d')](_0x23955c)>=_0x556d7e[_0xe8d0('0xa3')]){_0x54c04f=ut['cloneAction'](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,_0xe8d0('0xee'));}else{rpcDb[_0xe8d0('0xa6')](_0x23955c,_0xe8d0('0xee'));}delete this['actions'][_0x51eb0b['linkedid']];break;default:if(_0x23955c[_0xe8d0('0x73')]){ut['decrementTalkink'](_0x556d7e,_0xe8d0('0xef'));ut['loggerError'](_0xe8d0('0xf0')+_0x556d7e[_0xe8d0('0x28')],_0x51eb0b);}_0x556d7e[_0xe8d0('0x41')]+=0x1;_0x23955c['countglobal']=ut[_0xe8d0('0x9d')](_0x23955c);ut[_0xe8d0('0x92')](_0x23955c,0xc,_0x51eb0b['cause-txt']||_0x51eb0b[_0xe8d0('0xea')]);rpcDb[_0xe8d0('0x90')](_0x23955c,_0xe8d0('0xf1'));if(ut['totalGlobal'](_0x23955c)>=_0x556d7e['dialGlobalMaxRetry']){_0x54c04f=ut[_0xe8d0('0xa4')](_0x23955c,0xf,_0xe8d0('0xa5'));rpcDb[_0xe8d0('0xa6')](_0x54c04f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xe8d0('0xa6')](_0x23955c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe8d0('0x18')][_0x51eb0b['linkedid']];}if(!(_0x23955c['dialAnswer']&&_0x40cb5c==='16')){ut['updateOriginated'](_0x556d7e,_0xe8d0('0xf2'));logger['info'](_0xe8d0('0xf3'),_0x23955c['uniqueid'],_0xe8d0('0xb3'),_0x556d7e['name'],'originated:\x20',_0x556d7e[_0xe8d0('0x4c')]);}if(_0x40cb5c!=='ANSWER'){delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xac')]];delete this[_0xe8d0('0x18')][_0x51eb0b[_0xe8d0('0xf4')]];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0xf5')]=function(_0x57c5ae,_0x43062c,_0x5c7a76){if(_[_0xe8d0('0xf6')](_0x43062c)&&_0xe8d0('0xf7')!==typeof _0x43062c){return;}if(_[_0xe8d0('0xf6')](_0x5c7a76)&&_0xe8d0('0xf7')!==typeof _0x5c7a76){return;}switch(_0x5c7a76['reason']){case'0':ut[_0xe8d0('0xf8')](_0x57c5ae,0x0,_0xe8d0('0x9e'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfa'));break;case'3':ut[_0xe8d0('0xf8')](_0x57c5ae,0x3,_0xe8d0('0xcd'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe8d0('0xf8')](_0x57c5ae,0x5,_0xe8d0('0xc3'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfb'));break;case'8':ut[_0xe8d0('0xf8')](_0x57c5ae,0x8,_0xe8d0('0xd7'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfc'));break;case'22':ut['logAgent'](_0x57c5ae,0x16,_0xe8d0('0xfd'));rpcDb[_0xe8d0('0xf9')](_0x57c5ae,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x57c5ae,0xc,_0x5c7a76['reason']);rpcDb[_0xe8d0('0xf9')](_0x57c5ae,_0xe8d0('0xfc'));}ut[_0xe8d0('0x7c')](_0x43062c,_0xe8d0('0xfe'));logger['info'](_0xe8d0('0xff'),_0x57c5ae['uniqueid'],'\x20Queue',_0x43062c[_0xe8d0('0x28')],'originated:\x20',_0x43062c['originated']);delete this[_0xe8d0('0x18')][_0x57c5ae['uniqueid']];};Preview[_0xe8d0('0x10')][_0xe8d0('0x100')]=function(_0x57d57f,_0xc9a56d,_0xc6fd9a,_0x5dbf91,_0x436574){var _0x729c89=this;return new BPromise(function(_0x33f42e,_0x30fee6){if(_[_0xe8d0('0x6c')](_0xc9a56d)||_[_0xe8d0('0x6c')](_0xc9a56d[_0xe8d0('0x101')])||_[_0xe8d0('0x6c')](_0xc9a56d[_0xe8d0('0x101')][_0xe8d0('0x102')])||_[_0xe8d0('0x6c')](_0xc9a56d[_0xe8d0('0x76')])){_0x30fee6(ut[_0xe8d0('0x4b')]('Contact\x20is\x20undefined',_0x5dbf91,_0x436574));return;}var _0x2dd9b5=uuid['v4']();var _0x3ccf5d=_0x729c89[_0xe8d0('0x15')][_0xc9a56d[_0xe8d0('0x6e')][_0xe8d0('0x28')]];var _0x2f7371=_0xc6fd9a?_0x729c89[_0xe8d0('0x19')][_0xc6fd9a]['id']:undefined;_0x729c89[_0xe8d0('0x18')][_0x2dd9b5]=new Action(_0xc9a56d,_0x3ccf5d,_0x2dd9b5,_0xc6fd9a,_0x2f7371);var _0x4c073=_0x729c89[_0xe8d0('0x18')][_0x2dd9b5];_0x4c073[_0xe8d0('0xca')]=_0x5dbf91;_0x4c073[_0xe8d0('0xab')]=_0x436574;_0x4c073[_0xe8d0('0x103')]=_0xc6fd9a;if(_[_0xe8d0('0x104')](_0x57d57f)){_0x729c89[_0xe8d0('0x105')](_0x4c073,_0x3ccf5d,_0xc9a56d,_0xc6fd9a)[_0xe8d0('0x85')](function(_0x35b681){logger[_0xe8d0('0x58')](_0xe8d0('0x106'),'Queue:\x20'+_0x4c073[_0xe8d0('0x6f')]+_0xe8d0('0x107')+_0x4c073['idContact'],JSON['stringify'](_0x35b681));ami[_0xe8d0('0x25')]('custom:agentcalled',ut['buildObj'](_0x4c073,_0xe8d0('0x108'),_0x729c89[_0xe8d0('0x15')][_0x4c073['queue']]));_0x33f42e(ut['message'](_0xe8d0('0x109')));})[_0xe8d0('0x7b')](function(_0x57db94){ut[_0xe8d0('0x10a')](_0xe8d0('0x10b'),_0x57db94);_0x30fee6(ut['message']('Call\x20failed',_0x5dbf91,_0x436574));});}else{_0x3ccf5d[_0xe8d0('0x10c')]+=0x1;ut[_0xe8d0('0x10d')](_0x4c073);rpcDb[_0xe8d0('0x10e')](_0x4c073,_0xe8d0('0x10f'));delete _0x729c89[_0xe8d0('0x18')][_0x2dd9b5];_0x30fee6(ut['message'](_0xe8d0('0x110'),_0x5dbf91,_0x436574));}});};Preview[_0xe8d0('0x10')]['isTrunkReachable']=function(_0x5a5253){return!_[_0xe8d0('0x6c')](_0x5a5253)&&!_[_0xe8d0('0x6c')](_0x5a5253['name'])&&!_[_0xe8d0('0x6c')](_0x5a5253[_0xe8d0('0x52')])&&_0x5a5253['active']&&!_['isNil'](this[_0xe8d0('0x17')][util['format'](_0xe8d0('0x111'),_0x5a5253[_0xe8d0('0x28')])])&&!_[_0xe8d0('0x6c')](this[_0xe8d0('0x17')][util['format'](_0xe8d0('0x111'),_0x5a5253[_0xe8d0('0x28')])][_0xe8d0('0x79')])&&(this['trunks'][util['format'](_0xe8d0('0x111'),_0x5a5253[_0xe8d0('0x28')])][_0xe8d0('0x79')]===_0xe8d0('0x112')||this[_0xe8d0('0x17')][util[_0xe8d0('0x56')]('SIP/%s',_0x5a5253[_0xe8d0('0x28')])][_0xe8d0('0x79')]===_0xe8d0('0x113'));};Preview[_0xe8d0('0x10')]['run']=function(_0x29a256,_0x31d174){var _0x5f0a2f=this;return new BPromise(function(_0x183c1f,_0x4a520d){_0x5f0a2f[_0xe8d0('0x114')](_0x29a256,_0x31d174)[_0xe8d0('0x85')](function(_0x44816a){_0x183c1f(_['pick'](_0x44816a,[_0xe8d0('0x4b')]));})[_0xe8d0('0x7b')](function(_0x24b26f){if(_0x24b26f[_0xe8d0('0x115')]){rpcDb['unlockContact'](_0x29a256);}if(_0x24b26f[_0xe8d0('0x52')]){rpcDb[_0xe8d0('0x8a')](_0x29a256);}_0x4a520d(_[_0xe8d0('0x74')](_0x24b26f,['message']));});});};Preview[_0xe8d0('0x10')]['execRun']=function(_0xa57cb9,_0x48cae3){var _0x1e3993=this;return new BPromise(function(_0x52c05c,_0x4a667f){var _0x596011,_0x3e1c17;rpcDb[_0xe8d0('0x116')](_0xa57cb9)[_0xe8d0('0x85')](function(_0xd82505){if(!_[_0xe8d0('0x6c')](_0xd82505[0x0])){_0x3e1c17=_0xd82505[0x0]['recallme']?![]:!![];_0x596011=_0xd82505[0x0][_0xe8d0('0x117')]?!![]:![];_0x596011=_0x48cae3?!![]:_0x596011;}var _0x1ac76c=_0x1e3993[_0xe8d0('0x118')](_0xd82505);if(_0x1ac76c[_0xe8d0('0x119')]){rpcDb[_0xe8d0('0x11a')](_[_0xe8d0('0x74')](_0xd82505[0x0],[_0xe8d0('0x76'),_0xe8d0('0x11b')]))[_0xe8d0('0x85')](function(_0x598287){_0x1e3993[_0xe8d0('0x100')](_0x598287,_0xd82505[0x0],_0x48cae3,_0x3e1c17,_0x596011)['then'](function(_0xa3b334){_0x52c05c(_0xa3b334);})['catch'](function(_0x36efb3){_0x4a667f(_0x36efb3);});})[_0xe8d0('0x7b')](function(_0xa51da){ut[_0xe8d0('0x10a')](_0xe8d0('0x11c'),_0xa51da);_0x4a667f(ut['message'](_0xe8d0('0x11d'),_0x3e1c17,_0x596011));});}else{_0x4a667f(ut[_0xe8d0('0x4b')](_0x1ac76c[_0xe8d0('0x4b')],_0x3e1c17,_0x596011));}})['catch'](function(_0x21d2f7){ut[_0xe8d0('0x10a')](_0xe8d0('0x11e'),_0x21d2f7);_0x4a667f(ut[_0xe8d0('0x4b')](_0xe8d0('0x11d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x1b3a0d){if(_['isNil'](_0x1b3a0d)||_[_0xe8d0('0x104')](_0x1b3a0d)||!_[_0xe8d0('0x6c')](_0x1b3a0d[0x0][_0xe8d0('0x87')])&&_[_0xe8d0('0x6c')](_0x1b3a0d[0x0]['Agent'][_0xe8d0('0x28')])){ut[_0xe8d0('0x10a')](_0xe8d0('0x11f'),_0x1b3a0d);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2e35ef=this['campaignsPreview'][_0x1b3a0d[0x0][_0xe8d0('0x6e')][_0xe8d0('0x28')]];_0x2e35ef[_0xe8d0('0x4b')]=_0xe8d0('0x9a');if(_[_0xe8d0('0x6c')](_0x2e35ef)){ut[_0xe8d0('0x10a')](_0xe8d0('0x120'),_0x2e35ef);return{'isValid':![],'message':_0xe8d0('0x121')};}if(!this[_0xe8d0('0x98')](_0x2e35ef[_0xe8d0('0x51')])){ut['logger'](_0xe8d0('0x122'),_0xe8d0('0x123')+_0x2e35ef[_0xe8d0('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x2e35ef[_0xe8d0('0x99')])){ut[_0xe8d0('0x10a')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x2e35ef[_0xe8d0('0x28')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe8d0('0x124')};}}if(!ut[_0xe8d0('0x97')](_0x2e35ef[_0xe8d0('0x35')])){ut[_0xe8d0('0x10a')](_0xe8d0('0x125'),_0x2e35ef['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xe8d0('0x123')+_0x2e35ef[_0xe8d0('0x28')]+_0xe8d0('0x126')};}return{'isValid':!![],'message':_0xe8d0('0x127')};};Preview[_0xe8d0('0x10')]['execCall']=function(_0x110b6a,_0x951308,_0x235ccf,_0x5bda3a){var _0x31bfe=this;return new BPromise(function(_0x5cc742,_0x3e6b07){var _0x5a40c2=_0x110b6a[_0xe8d0('0xb2')];var _0x48bad4=_0x31bfe[_0xe8d0('0x98')](_0x951308[_0xe8d0('0x51')])?util[_0xe8d0('0x56')]('SIP/%s/%s%s',_0x951308['Trunk'][_0xe8d0('0x28')],_[_0xe8d0('0x6c')](_0x951308[_0xe8d0('0x128')])?'':_0x951308[_0xe8d0('0x128')][_0xe8d0('0x129')]()||'',_0x951308[_0xe8d0('0x12a')]>0x0?_0x235ccf[_0xe8d0('0x101')]['phone']['substring'](_0x951308[_0xe8d0('0x12a')]):_0x235ccf[_0xe8d0('0x101')]['phone']):util[_0xe8d0('0x56')]('SIP/%s/%s%s',_[_0xe8d0('0x6c')](_0x951308['TrunkBackup'])?_0x951308['Trunk'][_0xe8d0('0x28')]:_0x951308[_0xe8d0('0x99')]['name'],_['isNil'](_0x951308[_0xe8d0('0x128')])?'':_0x951308['dialPrefix'][_0xe8d0('0x129')]()||'',_0x951308['dialCutDigit']>0x0?_0x235ccf[_0xe8d0('0x101')][_0xe8d0('0x102')][_0xe8d0('0x12b')](_0x951308['dialCutDigit']):_0x235ccf[_0xe8d0('0x101')][_0xe8d0('0x102')]);var _0x5e7090=_0x31bfe[_0xe8d0('0x98')](_0x951308[_0xe8d0('0x51')])?ut[_0xe8d0('0x12c')](_0x951308[_0xe8d0('0x51')][_0xe8d0('0x53')],_0x951308[_0xe8d0('0x36')],_0x951308[_0xe8d0('0x12d')]>0x0?ut[_0xe8d0('0x12e')](_0x951308[_0xe8d0('0x37')],_0x951308['dialRandomLastDigitCallerIdNumber']):_0x951308[_0xe8d0('0x37')]):ut[_0xe8d0('0x12c')](_[_0xe8d0('0x6c')](_0x951308['TrunkBackup'])?_0x951308[_0xe8d0('0x51')][_0xe8d0('0x53')]:_0x951308['TrunkBackup'][_0xe8d0('0x53')],_0x951308[_0xe8d0('0x36')],_0x951308[_0xe8d0('0x12d')]>0x0?ut['getCallerIdRandom'](_0x951308['dialOriginateCallerIdNumber'],_0x951308['dialRandomLastDigitCallerIdNumber']):_0x951308['dialOriginateCallerIdNumber']);if(_0x5e7090){_0x110b6a[_0xe8d0('0x12f')]=ut['extractCalleridName'](_0x5e7090);_0x110b6a[_0xe8d0('0x130')]=ut['extractCalleridNumber'](_0x5e7090);}var _0x226957=ut['addVariables'](_0x951308,_0x235ccf,_0x48bad4,_0x5e7090,_0x5a40c2,_0x110b6a);_[_0xe8d0('0x131')](_0x110b6a,ut['toLowerVariables'](_0x226957));_0x110b6a[_0xe8d0('0x8b')]=moment()[_0xe8d0('0x56')](_0xe8d0('0xae'));ami[_0xe8d0('0x78')](ut[_0xe8d0('0x132')](_0x110b6a,_0x951308,_0x226957,_0x110b6a['activeContact'],_0x5bda3a))['then'](function(_0x21e895){_0x951308[_0xe8d0('0x4c')]+=0x1;logger['info']('[originated][increment]',_0x5a40c2,'\x20Queue',_0x951308[_0xe8d0('0x28')],_0xe8d0('0x70'),_0x951308['originated']);_0x5cc742(_0x21e895);})[_0xe8d0('0x7b')](function(_0x657240){ut[_0xe8d0('0xf8')](_0x110b6a,0xe,_0xe8d0('0x133'));rpcDb[_0xe8d0('0xf9')](_0x110b6a,_0xe8d0('0x134'));_0x3e6b07(_0x657240);});});};Preview[_0xe8d0('0x10')][_0xe8d0('0x135')]=function(_0x342d25){if(this['actions'][_0x342d25[_0xe8d0('0xac')]]){this['actions'][_0x342d25[_0xe8d0('0xac')]][_0xe8d0('0x7a')]=_0x342d25['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x11533f){var _0x50ff29=this;var _0x2ed64c=this[_0xe8d0('0x18')][_0x11533f['actionid']];if(_0x2ed64c){if(_0x2ed64c['lookAgent']&&this[_0xe8d0('0x19')][_0x2ed64c['lookAgent']]){ut[_0xe8d0('0x136')](_0x2ed64c,this[_0xe8d0('0x19')][_0x2ed64c['lookAgent']][_0xe8d0('0x28')],this['agents'][_0x2ed64c[_0xe8d0('0x103')]]['id']);}var _0x262bdc=_[_0xe8d0('0x137')](_0x2ed64c);_0x262bdc['responsetime']=moment()[_0xe8d0('0x56')](_0xe8d0('0xae'));var _0x1abe4d=_0x50ff29['campaignsPreview'][_0x2ed64c['queue']];if(ut[_0xe8d0('0x138')](_0x11533f['response'])){if(_0x2ed64c[_0xe8d0('0xca')]){rpcDb[_0xe8d0('0x139')](_0x2ed64c[_0xe8d0('0x13a')]);}if(_0x2ed64c[_0xe8d0('0xab')]){rpcDb['disableContact'](_0x2ed64c[_0xe8d0('0x13a')]);}ami['emit']('custom:agentringnoanswer',ut['buildObj'](_0x2ed64c,_0xe8d0('0x13b'),this[_0xe8d0('0x15')][_0x2ed64c[_0xe8d0('0x6f')]]));this[_0xe8d0('0xf5')](_0x262bdc,_0x1abe4d,_0x11533f);}else{_0x2ed64c[_0xe8d0('0x8b')]=moment()['format'](_0xe8d0('0xae'));ut['logAgent'](_0x262bdc,0x4,'Answer');rpcDb[_0xe8d0('0xf9')](_0x262bdc,_0xe8d0('0x13c'));}}};Preview[_0xe8d0('0x10')]['syncHangup']=function(_0x18d5d8){var _0x2f5242=this;var _0x391eb7=this[_0xe8d0('0x18')][_0x18d5d8[_0xe8d0('0xac')]];var _0x527668;if(_0x391eb7){_0x527668=this[_0xe8d0('0x15')][_0x391eb7[_0xe8d0('0x6f')]];logger[_0xe8d0('0x58')](_0xe8d0('0x13d'),_0x18d5d8[_0xe8d0('0xac')],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x527668[_0xe8d0('0x72')]);}if(this[_0xe8d0('0x18')][_0x18d5d8[_0xe8d0('0xac')]]&&_0x18d5d8['linkedid']!==_0x18d5d8[_0xe8d0('0xb2')]){if(_0x18d5d8['cause']==='16'&&this['actions'][_0x18d5d8[_0xe8d0('0xac')]][_0xe8d0('0x73')]){this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8['linkedid'],_0x18d5d8[_0xe8d0('0x13e')]);}else if(this[_0xe8d0('0x18')][_0x18d5d8[_0xe8d0('0xac')]][_0xe8d0('0x73')]){logger[_0xe8d0('0x58')](_0xe8d0('0x13f'),_0x18d5d8['linkedid'],_0x18d5d8[_0xe8d0('0x13e')],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x527668[_0xe8d0('0x72')]);this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8['linkedid'],_0x18d5d8['cause']);}}else if(_0x391eb7&&_[_0xe8d0('0x6c')](_0x391eb7[_0xe8d0('0x140')])&&_0x527668[_0xe8d0('0x141')]&&_0x18d5d8[_0xe8d0('0xac')]===_0x18d5d8[_0xe8d0('0xb2')]&&_[_0xe8d0('0x6c')](_0x18d5d8['reason'])&&_0x18d5d8[_0xe8d0('0x13e')]==='16'&&_0x18d5d8[_0xe8d0('0x142')]==='6'&&_[_0xe8d0('0xf6')](_0x391eb7[_0xe8d0('0x143')])){if(_0x391eb7[_0xe8d0('0xca')]){rpcDb['unlockContact'](_0x391eb7[_0xe8d0('0x13a')]);}if(_0x391eb7[_0xe8d0('0xab')]){rpcDb[_0xe8d0('0x8a')](_0x391eb7['idContact']);}_0x18d5d8[_0xe8d0('0x144')]='22';this[_0xe8d0('0xf5')](_0x391eb7,_0x527668,_0x18d5d8);}else if(_0x391eb7&&_0x391eb7[_0xe8d0('0x143')]){if(_0x18d5d8[_0xe8d0('0x13e')]==='16'&&this['actions'][_0x18d5d8[_0xe8d0('0xac')]][_0xe8d0('0x73')]){logger[_0xe8d0('0x58')](_0xe8d0('0x145'),_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8['cause'],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],_0xe8d0('0x71'),_0x527668[_0xe8d0('0x72')]);this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8[_0xe8d0('0x13e')]);}else if(this['actions'][_0x18d5d8[_0xe8d0('0xac')]]['dialAnswer']){logger[_0xe8d0('0x58')](_0xe8d0('0x13f'),_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8['cause'],_0xe8d0('0xb3'),_0x527668[_0xe8d0('0x28')],'pTalking:\x20',_0x527668[_0xe8d0('0x72')]);this[_0xe8d0('0x9b')](_0x18d5d8,_0x18d5d8[_0xe8d0('0xac')],_0x18d5d8[_0xe8d0('0x13e')]);}}};Preview[_0xe8d0('0x10')]['syncDialEnd']=function(_0x37ab7c){if(this[_0xe8d0('0x18')][_0x37ab7c['destlinkedid']]&&_0x37ab7c[_0xe8d0('0xf4')]!==_0x37ab7c['destuniqueid']){this['callProgressDetectingCustomer'](_0x37ab7c,_0x37ab7c[_0xe8d0('0xf4')],_0x37ab7c[_0xe8d0('0xea')]);}};Preview[_0xe8d0('0x10')]['syncHangupRequest']=function(_0x3eaa1f){if(this[_0xe8d0('0x18')][_0x3eaa1f['linkedid']]&&_0x3eaa1f[_0xe8d0('0xac')]!==_0x3eaa1f['uniqueid']&&!this[_0xe8d0('0x18')][_0x3eaa1f[_0xe8d0('0xac')]][_0xe8d0('0x73')]){if(_0x3eaa1f['cause']==='1'){this[_0xe8d0('0x9b')](_0x3eaa1f,_0x3eaa1f[_0xe8d0('0xac')],_0x3eaa1f[_0xe8d0('0x13e')]);}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x146')]=function(_0x28d34f,_0xf323b4,_0x783fa){if(this['actions'][_0x28d34f]){if(_[_0xe8d0('0x6c')](this[_0xe8d0('0x18')][_0x28d34f][_0xe8d0('0x147')])){this[_0xe8d0('0x18')][_0x28d34f][_0xe8d0('0x147')]={};}this[_0xe8d0('0x18')][_0x28d34f]['variables'][_0xf323b4]=_0x783fa;}};Preview[_0xe8d0('0x10')][_0xe8d0('0x21')]=function(_0x1fa83e){try{if(!_[_0xe8d0('0x6c')](_0x1fa83e)){if(ut[_0xe8d0('0x148')](_[_0xe8d0('0x149')](_0x1fa83e[_0xe8d0('0x14a')])[0x0])){this[_0xe8d0('0x146')](_0x1fa83e[_0xe8d0('0xb2')],_[_0xe8d0('0x149')](_0x1fa83e[_0xe8d0('0x14a')])[0x0],_0x1fa83e['value']);}}}catch(_0x475248){logger[_0xe8d0('0x14b')](_0xe8d0('0x14c'),util[_0xe8d0('0x14d')](_0x475248,{'showHidden':![],'depth':null}));}};Preview[_0xe8d0('0x10')]['syncAttendedTransfer']=function(_0x564361){if(_0x564361){if(this[_0xe8d0('0x18')][_0x564361[_0xe8d0('0x14e')]]){this[_0xe8d0('0x18')][_0x564361['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xe8d0('0x10')][_0xe8d0('0x24')]=function(_0xb5f1b3){if(_0xb5f1b3){if(this[_0xe8d0('0x18')][_0xb5f1b3[_0xe8d0('0x14f')]]){this[_0xe8d0('0x18')][_0xb5f1b3['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 33c0d11..20a40ee 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 _0x0f6d=['answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','then','getContactPreview','createAgentHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt'];(function(_0x23ee5e,_0x372ba0){var _0xf78e80=function(_0x54361c){while(--_0x54361c){_0x23ee5e['push'](_0x23ee5e['shift']());}};_0xf78e80(++_0x372ba0);}(_0x0f6d,0x178));var _0xd0f6=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x0f6d[_0x58c20f];return _0x3b0318;};'use strict';var util=require(_0xd0f6('0x0'));var BPromise=require('bluebird');var logger=require(_0xd0f6('0x1'))(_0xd0f6('0x2'));var _=require(_0xd0f6('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xd0f6('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd0f6('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xd0f6('0x6'));var voiceQueueReport=require(_0xd0f6('0x7'));function loggerCatch(_0x3dc3e6){return function(_0x2ecdd1){logger[_0xd0f6('0x8')](_0x3dc3e6,util[_0xd0f6('0x9')](_0x2ecdd1,{'showHidden':![],'depth':null}));};}function create(_0x6c7f0b){return BPromise[_0xd0f6('0xa')]()['then'](cmHopperHistory[_0xd0f6('0xb')](_0x6c7f0b))[_0xd0f6('0xc')](loggerCatch(_0xd0f6('0xd')));}function createAgent(_0x364bae){return BPromise['resolve']()['then'](agentReportPreview[_0xd0f6('0xb')](_0x364bae))[_0xd0f6('0xc')](loggerCatch(_0xd0f6('0xd')));}function moveContact(_0x24e0ac){return BPromise[_0xd0f6('0xa')]()['then'](cmHopper[_0xd0f6('0xe')](_0x24e0ac,!![]))[_0xd0f6('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xd0f6('0xf')]=function(_0x40ce48){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopperBlack[_0xd0f6('0xf')](_0x40ce48))[_0xd0f6('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xd0f6('0x11')]=function(_0x29f65a){return BPromise['resolve']()['then'](cmHopper[_0xd0f6('0x11')](_0x29f65a))[_0xd0f6('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0xd0f6('0xb')]=function(_0x3d7599,_0x3cb18c){create(_0x3d7599)[_0xd0f6('0xc')](loggerCatch(_0x3cb18c));moveContact(_0x3d7599)[_0xd0f6('0xc')](loggerCatch(_0x3cb18c));};exports[_0xd0f6('0x12')]=function(_0x216a59,_0x513d0f){createAgent(_0x216a59)[_0xd0f6('0xc')](loggerCatch(_0x513d0f));};exports['createCustomerHistory']=function(_0xbd0440,_0x55f080){create(_0xbd0440)[_0xd0f6('0xc')](loggerCatch(_0x55f080));};exports['createCustomerFinal']=function(_0x5834f2,_0xf72a75){moveContact(_0x5834f2)[_0xd0f6('0xc')](loggerCatch(_0xf72a75));};exports[_0xd0f6('0x13')]=function(_0x72dab6,_0x1a6d3c,_0x598d78){if(_0x1a6d3c){_0x72dab6[_0xd0f6('0x14')]=null;}if(_0x598d78){_0x72dab6['active']=![];}return BPromise['resolve']()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x13')](_0x72dab6))['catch'](loggerCatch(_0xd0f6('0x15')));};exports[_0xd0f6('0x16')]=function(_0x698719){return BPromise[_0xd0f6('0xa')]()['then'](cmHopper[_0xd0f6('0x16')](_0x698719))['catch'](loggerCatch(_0xd0f6('0x17')));};exports[_0xd0f6('0x18')]=function(_0x404646){return BPromise['resolve']()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x18')]({'UserId':null},_0x404646,0x1))[_0xd0f6('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x6ee9e8){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x18')]({'active':![]},_0x6ee9e8,0x1))[_0xd0f6('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xd0f6('0x19')]=function(_0x40bb9e){var _0xff354b={};_0xff354b['type']=_0x40bb9e[_0xd0f6('0x1a')];_0xff354b[_0xd0f6('0x1b')]=_0x40bb9e[_0xd0f6('0x1b')];_0xff354b[_0xd0f6('0x1c')]=_0x40bb9e[_0xd0f6('0x1c')];_0xff354b[_0xd0f6('0x1d')]=_0x40bb9e['calleridname'];_0xff354b[_0xd0f6('0x1e')]=_0x40bb9e[_0xd0f6('0x1e')];_0xff354b[_0xd0f6('0x1f')]=_0x40bb9e[_0xd0f6('0x20')];_0xff354b[_0xd0f6('0x21')]=_0x40bb9e['answertime'];_0xff354b[_0xd0f6('0x22')]=0x1;_0xff354b[_0xd0f6('0x23')]=_0x40bb9e[_0xd0f6('0x24')];_0xff354b['connectedlinename']=_0x40bb9e[_0xd0f6('0x25')];_0xff354b[_0xd0f6('0x26')]=_0xd0f6('0x27');_0xff354b[_0xd0f6('0x28')]=_0xd0f6('0x29');_0xff354b[_0xd0f6('0x2a')]=0x0;_0xff354b[_0xd0f6('0x2b')]=0x1;_0xff354b[_0xd0f6('0x2c')]=_0x40bb9e[_0xd0f6('0x25')];_0xff354b[_0xd0f6('0x2d')]=_0xd0f6('0x2e');return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](voiceQueueReport[_0xd0f6('0x2f')](_0xff354b))['catch'](loggerCatch(_0xd0f6('0x30')));};exports[_0xd0f6('0x31')]=function(_0x7abcc3,_0xa85c7c){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x31')](_0x7abcc3,_0xa85c7c))[_0xd0f6('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x3a1489){return BPromise[_0xd0f6('0xa')]()[_0xd0f6('0x10')](cmHopper[_0xd0f6('0x13')](_0x3a1489,!![],!![]))[_0xd0f6('0xc')](loggerCatch(_0xd0f6('0x32')));}; \ No newline at end of file +var _0xdb31=['lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','then','createHistory','catch','[createHistory]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','context','exten','xcally-motion-preview','holdtime','assigned'];(function(_0x163cb0,_0x304949){var _0x30cc1b=function(_0x162f19){while(--_0x162f19){_0x163cb0['push'](_0x163cb0['shift']());}};_0x30cc1b(++_0x304949);}(_0xdb31,0x16d));var _0x1db3=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0xdb31[_0x32e264];return _0x1d7175;};'use strict';var util=require(_0x1db3('0x0'));var BPromise=require(_0x1db3('0x1'));var logger=require('../../../config/logger')(_0x1db3('0x2'));var _=require(_0x1db3('0x3'));var cmHopper=require(_0x1db3('0x4'));var cmHopperFinal=require(_0x1db3('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1db3('0x6'));var agentReportPreview=require(_0x1db3('0x7'));var voiceQueueReport=require(_0x1db3('0x8'));function loggerCatch(_0x4a8685){return function(_0x513c08){logger[_0x1db3('0x9')](_0x4a8685,util['inspect'](_0x513c08,{'showHidden':![],'depth':null}));};}function create(_0x378175){return BPromise['resolve']()[_0x1db3('0xa')](cmHopperHistory[_0x1db3('0xb')](_0x378175))[_0x1db3('0xc')](loggerCatch(_0x1db3('0xd')));}function createAgent(_0x2bf0a8){return BPromise[_0x1db3('0xe')]()['then'](agentReportPreview[_0x1db3('0xb')](_0x2bf0a8))[_0x1db3('0xc')](loggerCatch(_0x1db3('0xd')));}function moveContact(_0x2b445f){return BPromise[_0x1db3('0xe')]()[_0x1db3('0xa')](cmHopper['moveContactManagedDialer'](_0x2b445f,!![]))[_0x1db3('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x1db3('0xf')]=function(_0x20820e){return BPromise[_0x1db3('0xe')]()[_0x1db3('0xa')](cmHopperBlack[_0x1db3('0xf')](_0x20820e))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x10')));};exports[_0x1db3('0x11')]=function(_0x1d7920){return BPromise[_0x1db3('0xe')]()['then'](cmHopper['getContactPreview'](_0x1d7920))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x12')));};exports['createHistory']=function(_0x4ef718,_0x51f29d){create(_0x4ef718)[_0x1db3('0xc')](loggerCatch(_0x51f29d));moveContact(_0x4ef718)['catch'](loggerCatch(_0x51f29d));};exports[_0x1db3('0x13')]=function(_0x4a2556,_0x43058e){createAgent(_0x4a2556)['catch'](loggerCatch(_0x43058e));};exports[_0x1db3('0x14')]=function(_0x36eea7,_0x21dc76){create(_0x36eea7)[_0x1db3('0xc')](loggerCatch(_0x21dc76));};exports[_0x1db3('0x15')]=function(_0x4a2bc6,_0x1668a5){moveContact(_0x4a2bc6)['catch'](loggerCatch(_0x1668a5));};exports['rescheduleContact']=function(_0x2dad8d,_0x396943,_0x11ce8c){if(_0x396943){_0x2dad8d['UserId']=null;}if(_0x11ce8c){_0x2dad8d[_0x1db3('0x16')]=![];}return BPromise['resolve']()[_0x1db3('0xa')](cmHopper[_0x1db3('0x17')](_0x2dad8d))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x18')));};exports[_0x1db3('0x19')]=function(_0x2a05cd){return BPromise[_0x1db3('0xe')]()[_0x1db3('0xa')](cmHopper[_0x1db3('0x19')](_0x2a05cd))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x1a')));};exports[_0x1db3('0x1b')]=function(_0x45d429){return BPromise[_0x1db3('0xe')]()[_0x1db3('0xa')](cmHopper[_0x1db3('0x1b')]({'UserId':null},_0x45d429,0x1))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x1c')));};exports['disableContact']=function(_0x28b5d9){return BPromise['resolve']()[_0x1db3('0xa')](cmHopper['unlockContact']({'active':![]},_0x28b5d9,0x1))[_0x1db3('0xc')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x4cb5f5){var _0x57c359={};_0x57c359[_0x1db3('0x1d')]=_0x4cb5f5[_0x1db3('0x1d')];_0x57c359[_0x1db3('0x1e')]=_0x4cb5f5[_0x1db3('0x1e')];_0x57c359[_0x1db3('0x1f')]=_0x4cb5f5['calleridnum'];_0x57c359[_0x1db3('0x20')]=_0x4cb5f5['calleridname'];_0x57c359[_0x1db3('0x21')]=_0x4cb5f5[_0x1db3('0x21')];_0x57c359[_0x1db3('0x22')]=_0x4cb5f5[_0x1db3('0x23')];_0x57c359[_0x1db3('0x24')]=_0x4cb5f5[_0x1db3('0x23')];_0x57c359['queuecallercomplete']=0x1;_0x57c359['queuecallercompleteAt']=_0x4cb5f5[_0x1db3('0x25')];_0x57c359['connectedlinename']=_0x4cb5f5['membername'];_0x57c359[_0x1db3('0x26')]='from-sip';_0x57c359[_0x1db3('0x27')]=_0x1db3('0x28');_0x57c359[_0x1db3('0x29')]=0x0;_0x57c359[_0x1db3('0x2a')]=0x1;_0x57c359[_0x1db3('0x2b')]=_0x4cb5f5[_0x1db3('0x2c')];_0x57c359[_0x1db3('0x2d')]=_0x1db3('0x2e');return BPromise[_0x1db3('0xe')]()['then'](voiceQueueReport['create'](_0x57c359))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x2f')));};exports['getContactRecallMe']=function(_0x5c46e2,_0x162903){return BPromise[_0x1db3('0xe')]()[_0x1db3('0xa')](cmHopper[_0x1db3('0x30')](_0x5c46e2,_0x162903))[_0x1db3('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x1db3('0x31')]=function(_0x10e291){return BPromise[_0x1db3('0xe')]()['then'](cmHopper[_0x1db3('0x17')](_0x10e291,!![],!![]))[_0x1db3('0xc')](loggerCatch(_0x1db3('0x32')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 6bf32c0..c67eb93 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 _0x781c=['addVariables','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','not_inuse','status','reachable','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','active','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','isActive','isNil'];(function(_0x4319db,_0x58e93b){var _0x35e467=function(_0x3233fc){while(--_0x3233fc){_0x4319db['push'](_0x4319db['shift']());}};_0x35e467(++_0x58e93b);}(_0x781c,0x1aa));var _0xc781=function(_0x585bb3,_0xb45590){_0x585bb3=_0x585bb3-0x0;var _0x2f5470=_0x781c[_0x585bb3];return _0x2f5470;};'use strict';var util=require(_0xc781('0x0'));var _=require(_0xc781('0x1'));var moment=require(_0xc781('0x2'));var logger=require(_0xc781('0x3'))(_0xc781('0x4'));var ipAgi=process[_0xc781('0x5')][_0xc781('0x6')]||_0xc781('0x7');function getSeconds(_0x7a942d,_0x1e2efe){var _0x15c2ba=moment(_0x7a942d)[_0xc781('0x8')](0x0);var _0x4f2e4b=moment(_0x1e2efe)[_0xc781('0x8')](0x0);return _0x15c2ba[_0xc781('0x9')](_0x4f2e4b,'seconds');}exports[_0xc781('0xa')]=function(_0x5e2ae2){return function(_0x528f90){logger[_0xc781('0xb')](_0x5e2ae2,util[_0xc781('0xc')](_0x528f90,{'showHidden':![],'depth':null}));};};exports[_0xc781('0xd')]=function(_0x48944a,_0x8cb846){logger[_0xc781('0xe')](_0x48944a,util[_0xc781('0xc')](_0x8cb846,{'showHidden':![],'depth':null}));};exports[_0xc781('0xf')]=function(_0x192cc5,_0x3eaf2d){logger[_0xc781('0xb')](_0x192cc5,util[_0xc781('0xc')](_0x3eaf2d,{'showHidden':![],'depth':null}));};exports[_0xc781('0x10')]=function(_0x4bf076){return function(_0x22626f){logger['info'](_0x4bf076,util[_0xc781('0xc')](_0x22626f,{'showHidden':![],'depth':null}));};};exports[_0xc781('0x11')]=function(_0x59261a,_0x2747cc,_0x53cb10){return{'message':_0x59261a,'unlock':_0x2747cc,'active':_0x53cb10};};exports[_0xc781('0x12')]=function(_0xa85410,_0x3c716b,_0x7eae76){if(!_[_0xc781('0x13')](_0x7eae76)&&'string'===typeof _0x7eae76&&!_[_0xc781('0x14')](_0x7eae76)){if(!_[_0xc781('0x13')](_0x3c716b)&&'string'===typeof _0x3c716b&&!_[_0xc781('0x14')](_0x3c716b)){return util['format'](_0xc781('0x15'),_0x3c716b,_0x7eae76);}return util[_0xc781('0x16')](_0xc781('0x15'),_0x7eae76,_0x7eae76);}if(!_[_0xc781('0x13')](_0xa85410)&&_0xc781('0x17')===typeof _0xa85410&&!_['isEmpty'](_0xa85410)){return _0xa85410;}return _0xc781('0x18');};exports[_0xc781('0x19')]=function(_0x88b787){if(_[_0xc781('0x1a')](_0x88b787)){return![];}return _0x88b787;};exports[_0xc781('0x1b')]=function(_0xd955f9,_0x4faa15,_0x12b777,_0x182c31,_0x91fc12,_0x1baf70){var _0xa73735={'XMD-QUEUE':_0x4faa15['Queue']?_0x4faa15['Queue'][_0xc781('0x1c')]:'','XMD-CALLERID':_0x182c31,'XMD-CALLERID-PREVIEW':_0x1baf70?util[_0xc781('0x16')](_0xc781('0x15'),_0x1baf70[_0xc781('0x1d')],_0x1baf70[_0xc781('0x1e')]):_0x182c31,'XMD-DIALID':_0x91fc12,'XMD-CONTACTID':_0x4faa15['ContactId'],'XMD-CDRTYPE':_0xc781('0x1f'),'CALLERID(all)':_0x182c31,'XMD-VOICEQUEUEID':_0x4faa15[_0xc781('0x20')],'XMD-DIALCHANNEL':_0x12b777,'XMD-DIALTIMEOUT':_0xd955f9['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xc781('0x16')](_0xc781('0x21'),_0xd955f9[_0xc781('0x22')]?'g':'',_[_0xc781('0x14')](_0xd955f9[_0xc781('0x23')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xd955f9['dialPreviewUrl']||'','XMD-AGI':_0xd955f9[_0xc781('0x24')]?util[_0xc781('0x16')](_0xc781('0x25'),ipAgi,_0xd955f9['dialQueueProject']):_0xc781('0x26'),'XMD-AGIAFTER':_0xd955f9[_0xc781('0x22')]?util[_0xc781('0x16')]('\x22agi://%s/square,%s\x22',ipAgi,_0xd955f9['dialQueueProject2']):_0xc781('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x1baf70?_0x1baf70[_0xc781('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x1baf70?_0x1baf70[_0xc781('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xc781('0x29')};if(!_['isEmpty'](_0xd955f9[_0xc781('0x23')])){_0xa73735[util['format']('%s',_0xc781('0x2a'))]=_0xd955f9[_0xc781('0x23')];_0xa73735[util[_0xc781('0x16')]('%s',_0xc781('0x2b'))]=_0x91fc12;}if(_0x4faa15&&_0x4faa15['Contact']){for(var _0x13a105 in _0x4faa15[_0xc781('0x2c')]){if(_0x4faa15['Contact'][_0xc781('0x2d')](_0x13a105)){if(!_['isNil'](_0x4faa15[_0xc781('0x2c')][_0x13a105])&&_0x13a105!=='id'&&_0x13a105!==_0xc781('0x2e')&&_0x13a105!==_0xc781('0x2f')&&_0x13a105!=='updatedAt'){_0xa73735[util[_0xc781('0x16')](_0xc781('0x30'),_0xc781('0x31'),_[_0xc781('0x32')](_0x13a105))]=_0x4faa15[_0xc781('0x2c')][_0x13a105];}}}}return _0xa73735;};exports['toLowerVariables']=function(_0x3dea36){var _0x261efe={};for(var _0x4c0860 in _0x3dea36){if(_0x3dea36[_0xc781('0x2d')](_0x4c0860)){_0x261efe[util[_0xc781('0x16')]('%s',_['toLower'](_0x4c0860))]=_0x3dea36[_0x4c0860];}}return{'variables':_0x261efe};};exports[_0xc781('0x33')]=function(_0x3ec60e,_0x38cd92){if(!_[_0xc781('0x1a')](_0x3ec60e)){if(_0x3ec60e[_0xc781('0x2d')](_0xc781('0x34'))){if(_0x3ec60e['originated']>0x0){_0x3ec60e[_0xc781('0x34')]-=0x1;}else{logger['error'](_0xc781('0x35'),_0x38cd92);}}}else{logger[_0xc781('0xb')](_0xc781('0x36'),_0x38cd92);}};exports[_0xc781('0x37')]=function(_0x2490a4){var _0x59b97d=moment()[_0xc781('0x16')](_0xc781('0x38'));_0x2490a4[_0xc781('0x39')]=0xd;_0x2490a4[_0xc781('0x3a')]=_0xc781('0x3b');_0x2490a4['starttime']=_0x59b97d;_0x2490a4[_0xc781('0x3c')]=_0x59b97d;_0x2490a4[_0xc781('0x3d')]=_0x59b97d;};exports[_0xc781('0x3e')]=function(_0x4c91d8,_0x34e607,_0x167d49){var _0x478f4b=moment()['format'](_0xc781('0x38'));_0x4c91d8['state']=_0x34e607;_0x4c91d8[_0xc781('0x3a')]=_0x167d49;_0x4c91d8['responsetime']=_0x478f4b;_0x4c91d8[_0xc781('0x3f')]=getSeconds(_0x4c91d8['responsetime'],_0x4c91d8[_0xc781('0x40')]);};exports[_0xc781('0x41')]=function(_0x35ad96,_0x1dc864,_0x55a120){_0x35ad96[_0xc781('0x42')]=_0x1dc864;_0x35ad96['UserId']=_0x55a120;};exports[_0xc781('0x43')]=function(_0x3e659f,_0xa627c5,_0x4edc81){var _0x4b9826=moment()[_0xc781('0x16')](_0xc781('0x38'));_0x3e659f[_0xc781('0x39')]=_0xa627c5;_0x3e659f[_0xc781('0x3a')]=_0x4edc81;_0x3e659f[_0xc781('0x3c')]=_0x3e659f[_0xc781('0x3c')]?_0x3e659f['responsetime']:_0x4b9826;_0x3e659f[_0xc781('0x3d')]=_0x3e659f[_0xc781('0x3d')]?_0x3e659f['endtime']:_0x4b9826;_0x3e659f[_0xc781('0x3f')]=getSeconds(_0x3e659f[_0xc781('0x3c')]||0x0,_0x3e659f['starttime']||0x0);_0x3e659f[_0xc781('0x44')]=_0x3e659f[_0xc781('0x45')]?getSeconds(_0x3e659f[_0xc781('0x3d')],_0x3e659f['answertime']):0x0;};exports[_0xc781('0x46')]=function(_0x57742d){return _0x57742d===_0xc781('0x47');};exports[_0xc781('0x48')]=function(_0x3e5986,_0xd2677e,_0x29a65a,_0x3f4253,_0x4ce638){var _0x30201d=_0x3f4253?_0xc781('0x49'):_0x3e5986[_0xc781('0x1d')];_0x30201d=_0x4ce638?_0xc781('0x4a'):_0x30201d;return{'actionid':_0x3e5986[_0xc781('0x4b')],'action':_0xc781('0x4c'),'channel':_0x3e5986[_0xc781('0x4d')],'callerid':util[_0xc781('0x16')](_0xc781('0x15'),_0x30201d,_0x3e5986[_0xc781('0x1e')]),'Exten':_0xc781('0x4e'),'Context':_0xc781('0x4f'),'Priority':'1','variable':_0x29a65a,'timeout':(_0xd2677e[_0xc781('0x50')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e5986[_0xc781('0x4b')]};};exports[_0xc781('0x51')]=function(_0x4c559f){return _0x4c559f['countbusyretry']+_0x4c559f[_0xc781('0x52')]+_0x4c559f[_0xc781('0x53')]+_0x4c559f[_0xc781('0x54')]+_0x4c559f[_0xc781('0x55')];};exports['cloneAction']=function(_0x14a0fe){var _0x1864f8=_[_0xc781('0x56')](_0x14a0fe);_0x1864f8[_0xc781('0x39')]=0xf;_0x1864f8[_0xc781('0x3a')]=_0xc781('0x57');return _0x1864f8;};exports[_0xc781('0x58')]=function(_0x8bd523,_0x32f028,_0x1464ff){var _0x2194d4={};_0x2194d4[_0x32f028]=_0x8bd523[_0x32f028];_0x2194d4['active']=![];_0x2194d4[_0xc781('0x59')]=moment()[_0xc781('0x5a')](_0x1464ff,_0xc781('0x5b'))[_0xc781('0x16')](_0xc781('0x38'));_0x2194d4[_0xc781('0x5c')]=_0x8bd523['ContactId'];_0x2194d4[_0xc781('0x5d')]=_0x8bd523[_0xc781('0x5d')];_0x2194d4['VoiceQueueId']=_0x8bd523[_0xc781('0x20')]||undefined;return _0x2194d4;};exports['decrementTalkink']=function(_0x1acd58,_0x5516de){if(!_[_0xc781('0x1a')](_0x1acd58)){if(_0x1acd58['pTalking']>0x0){_0x1acd58['pTalking']-=0x1;}else{logger[_0xc781('0xb')](_0x5516de,_0xc781('0x5e'));}}else{logger[_0xc781('0xb')](_0x5516de,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xc781('0x5f')]=function(_0x22b47c){if(_0x22b47c<=0x0){return!![];}return![];};exports[_0xc781('0x60')]=function(_0x59f44a,_0x501b7e,_0x4bd480){_0x59f44a[_0xc781('0x61')]=_0x501b7e;_0x59f44a[_0xc781('0x1c')]=_0x59f44a[_0xc781('0x62')];_0x59f44a[_0xc781('0x63')]=_0x59f44a[_0xc781('0x4d')];_0x59f44a[_0xc781('0x64')]=_0xc781('0x65');if(_0x4bd480){_0x59f44a[_0xc781('0x66')]=_0x4bd480[_0xc781('0x66')];}return _0x59f44a;};exports['buildAcw']=function(_0x356435){var _0x2ccc33={};_0x2ccc33[_0xc781('0x62')]=_0x356435[_0xc781('0x62')];_0x2ccc33[_0xc781('0x63')]=_0x356435[_0xc781('0x4d')];_0x2ccc33[_0xc781('0x4b')]=_0x356435[_0xc781('0x4b')];return _0x2ccc33;};exports['agentReadyId']=function(_0x328567){var _0x2f96cf=[];for(var _0x108c81 in _0x328567){if(_0x328567[_0xc781('0x2d')](_0x108c81)){if(!_[_0xc781('0x1a')](_0x328567[_0x108c81])&&_0x328567[_0x108c81][_0xc781('0x39')]===_0xc781('0x67')&&_0x328567[_0x108c81][_0xc781('0x68')]===_0xc781('0x69')){_0x2f96cf['push'](_0x328567[_0x108c81]['id']);}}}return _0x2f96cf;};exports[_0xc781('0x6a')]=function(_0x539670){var _0x52ba5a=moment()[_0xc781('0x8')](0x0);var _0x313f6f=moment(_0x539670)['milliseconds'](0x0);return _0x52ba5a['diff'](_0x313f6f,'seconds');};exports[_0xc781('0x6b')]=function(_0x42ea78){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x42ea78[_0xc781('0x5c')],'ListId':_0x42ea78[_0xc781('0x5d')],'VoiceQueueId':_0x42ea78[_0xc781('0x20')]||undefined,'CampaignId':_0x42ea78[_0xc781('0x6c')]||undefined};};exports['filterKey']=function(_0x37e2fd){if(_0x37e2fd===_0xc781('0x4b')||_0x37e2fd===_0xc781('0x6d')||_0x37e2fd==='queue'||_0x37e2fd===_0xc781('0x6e')||_0x37e2fd===_0xc781('0x6f')||_0x37e2fd===_0xc781('0x70')||_0x37e2fd==='membername'||_0x37e2fd===_0xc781('0x4d')||_0x37e2fd===_0xc781('0x1d')||_0x37e2fd===_0xc781('0x71')||_0x37e2fd===_0xc781('0x1e')||_0x37e2fd===_0xc781('0x59')||_0x37e2fd===_0xc781('0x72')||_0x37e2fd===_0xc781('0x52')||_0x37e2fd===_0xc781('0x53')||_0x37e2fd===_0xc781('0x73')||_0x37e2fd===_0xc781('0x74')||_0x37e2fd===_0xc781('0x75')||_0x37e2fd===_0xc781('0x76')||_0x37e2fd===_0xc781('0x77')||_0x37e2fd===_0xc781('0x5c')||_0x37e2fd==='ListId'||_0x37e2fd===_0xc781('0x78')||_0x37e2fd==='VoiceQueueId'||_0x37e2fd==='sipcallid'||_0x37e2fd===_0xc781('0x79')||_0x37e2fd===_0xc781('0x7a')||_0x37e2fd===_0xc781('0x7b')||_0x37e2fd===_0xc781('0x7c')||_0x37e2fd===_0xc781('0x7d')||_0x37e2fd==='xmd-dialtimeout'||_0x37e2fd===_0xc781('0x7e')||_0x37e2fd===_0xc781('0x7f')||_0x37e2fd===_0xc781('0x80')||_0x37e2fd===_0xc781('0x81')||_0x37e2fd==='xmd-cdrtype'||_0x37e2fd===_0xc781('0x82')||_0x37e2fd===_0xc781('0x83')||_0x37e2fd===_0xc781('0x84')||_0x37e2fd===_0xc781('0x85')||_0x37e2fd==='rtpaudioqosbridged'||_0x37e2fd===_0xc781('0x86')||_0x37e2fd===_0xc781('0x87')||_0x37e2fd==='rtpaudioqosloss'||_0x37e2fd===_0xc781('0x88')||_0x37e2fd==='rtpaudioqosrtt'||_0x37e2fd==='rtpaudioqosrttbridged'||_0x37e2fd===_0xc781('0x85')||_0x37e2fd===_0xc781('0x89')||_0x37e2fd===_0xc781('0x86')||_0x37e2fd==='rtpaudioqosjitterbridged'||_0x37e2fd===_0xc781('0x8a')||_0x37e2fd===_0xc781('0x88')||_0x37e2fd===_0xc781('0x8b')||_0x37e2fd===_0xc781('0x8c')||_0x37e2fd===_0xc781('0x8d')||_0x37e2fd===_0xc781('0x8e')||_0x37e2fd==='state'||_0x37e2fd==='statedesc'){return![];}return!![];};exports[_0xc781('0x8f')]=function(_0x29ce4d,_0x58e707){var _0x2e766a,_0x448d9b,_0x510265;if(_0x58e707<=0x0){_0x58e707=0x1;}_0x2e766a=new RegExp(_0xc781('0x90')+_0x58e707+'}$');_0x448d9b=Math['pow'](0xa,_0x58e707-0x1);_0x510265=Math[_0xc781('0x91')](0xa,_0x58e707)-0x1;return util[_0xc781('0x16')]('%s',_[_0xc781('0x92')](_0x29ce4d,_0x2e766a,_[_0xc781('0x93')](_0x448d9b,_0x510265)));};exports[_0xc781('0x94')]=function(_0x1c4ee9){var _0x28eec9=_0x1c4ee9[_0xc781('0x95')](/"(.*?)"/);return _0x28eec9?_0x28eec9[0x1]:_0x1c4ee9;};exports[_0xc781('0x96')]=function(_0x30352e){var _0xd4966c=_0x30352e[_0xc781('0x95')](/<(.*?)>/);return _0xd4966c?_0xd4966c[0x1]:_0x30352e;}; \ No newline at end of file +var _0x9bc4=['isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','variablesAction','calleridname','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','statedesc','Global','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive'];(function(_0x70ad66,_0x8dce7f){var _0x45585d=function(_0x343348){while(--_0x343348){_0x70ad66['push'](_0x70ad66['shift']());}};_0x45585d(++_0x8dce7f);}(_0x9bc4,0xf9));var _0x49bc=function(_0x394892,_0x5c7ee3){_0x394892=_0x394892-0x0;var _0x4e9f53=_0x9bc4[_0x394892];return _0x4e9f53;};'use strict';var util=require('util');var _=require(_0x49bc('0x0'));var moment=require(_0x49bc('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x49bc('0x2')][_0x49bc('0x3')]||'127.0.0.1';function getSeconds(_0xb52a53,_0x70dbe7){var _0x59a82d=moment(_0xb52a53)[_0x49bc('0x4')](0x0);var _0x1e0725=moment(_0x70dbe7)[_0x49bc('0x4')](0x0);return _0x59a82d[_0x49bc('0x5')](_0x1e0725,_0x49bc('0x6'));}exports[_0x49bc('0x7')]=function(_0x1d032f){return function(_0x238753){logger[_0x49bc('0x8')](_0x1d032f,util[_0x49bc('0x9')](_0x238753,{'showHidden':![],'depth':null}));};};exports[_0x49bc('0xa')]=function(_0x1aad85,_0x403f25){logger['info'](_0x1aad85,util[_0x49bc('0x9')](_0x403f25,{'showHidden':![],'depth':null}));};exports[_0x49bc('0xb')]=function(_0x330ad0,_0x2e78f9){logger['error'](_0x330ad0,util[_0x49bc('0x9')](_0x2e78f9,{'showHidden':![],'depth':null}));};exports[_0x49bc('0xc')]=function(_0x538a8c){return function(_0x12a1bc){logger[_0x49bc('0xd')](_0x538a8c,util[_0x49bc('0x9')](_0x12a1bc,{'showHidden':![],'depth':null}));};};exports[_0x49bc('0xe')]=function(_0x3ad038,_0x8abb0,_0x17cf4e){return{'message':_0x3ad038,'unlock':_0x8abb0,'active':_0x17cf4e};};exports['getCallerId']=function(_0x36aa5c,_0x417b82,_0x384937){if(!_[_0x49bc('0xf')](_0x384937)&&_0x49bc('0x10')===typeof _0x384937&&!_['isEmpty'](_0x384937)){if(!_[_0x49bc('0xf')](_0x417b82)&&_0x49bc('0x10')===typeof _0x417b82&&!_[_0x49bc('0x11')](_0x417b82)){return util[_0x49bc('0x12')]('\x22%s\x22\x20<%s>',_0x417b82,_0x384937);}return util[_0x49bc('0x12')]('\x22%s\x22\x20<%s>',_0x384937,_0x384937);}if(!_[_0x49bc('0xf')](_0x36aa5c)&&'string'===typeof _0x36aa5c&&!_[_0x49bc('0x11')](_0x36aa5c)){return _0x36aa5c;}return _0x49bc('0x13');};exports[_0x49bc('0x14')]=function(_0x5cec4e){if(_[_0x49bc('0x15')](_0x5cec4e)){return![];}return _0x5cec4e;};exports[_0x49bc('0x16')]=function(_0x532e3a,_0x381ee3,_0x440820,_0x524fbb,_0x2ea0f8,_0x3896e7){var _0x366dbe={'XMD-QUEUE':_0x381ee3[_0x49bc('0x17')]?_0x381ee3[_0x49bc('0x17')][_0x49bc('0x18')]:'','XMD-CALLERID':_0x524fbb,'XMD-CALLERID-PREVIEW':_0x3896e7?util[_0x49bc('0x12')](_0x49bc('0x19'),_0x3896e7['calleridname'],_0x3896e7[_0x49bc('0x1a')]):_0x524fbb,'XMD-DIALID':_0x2ea0f8,'XMD-CONTACTID':_0x381ee3[_0x49bc('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x524fbb,'XMD-VOICEQUEUEID':_0x381ee3[_0x49bc('0x1c')],'XMD-DIALCHANNEL':_0x440820,'XMD-DIALTIMEOUT':_0x532e3a[_0x49bc('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x49bc('0x12')]('\x22rtTxX%s%s\x22',_0x532e3a[_0x49bc('0x1e')]?'g':'',_[_0x49bc('0x11')](_0x532e3a[_0x49bc('0x1f')])?'':_0x49bc('0x20')),'XMD-DIALURL':_0x532e3a[_0x49bc('0x21')]||'','XMD-AGI':_0x532e3a['dialQueueProject']?util[_0x49bc('0x12')](_0x49bc('0x22'),ipAgi,_0x532e3a[_0x49bc('0x23')]):_0x49bc('0x24'),'XMD-AGIAFTER':_0x532e3a['dialQueueProject2']?util[_0x49bc('0x12')](_0x49bc('0x22'),ipAgi,_0x532e3a[_0x49bc('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3896e7?_0x3896e7[_0x49bc('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x3896e7?_0x3896e7[_0x49bc('0x26')]:'','XMD-DESTINATION':_0x49bc('0x27'),'SIPADDHEADER':_0x49bc('0x28')};if(!_[_0x49bc('0x11')](_0x532e3a[_0x49bc('0x1f')])){_0x366dbe[util['format']('%s',_0x49bc('0x29'))]=_0x532e3a[_0x49bc('0x1f')];_0x366dbe[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2ea0f8;}if(_0x381ee3&&_0x381ee3[_0x49bc('0x2a')]){for(var _0x5b96fb in _0x381ee3[_0x49bc('0x2a')]){if(_0x381ee3['Contact'][_0x49bc('0x2b')](_0x5b96fb)){if(!_[_0x49bc('0x15')](_0x381ee3['Contact'][_0x5b96fb])&&_0x5b96fb!=='id'&&_0x5b96fb!==_0x49bc('0x2c')&&_0x5b96fb!==_0x49bc('0x2d')&&_0x5b96fb!=='updatedAt'){_0x366dbe[util[_0x49bc('0x12')](_0x49bc('0x2e'),'XMD-',_['toUpper'](_0x5b96fb))]=_0x381ee3[_0x49bc('0x2a')][_0x5b96fb];}}}}return _0x366dbe;};exports['toLowerVariables']=function(_0x3a5be8){var _0x4b331b={};for(var _0x360dae in _0x3a5be8){if(_0x3a5be8['hasOwnProperty'](_0x360dae)){_0x4b331b[util[_0x49bc('0x12')]('%s',_[_0x49bc('0x2f')](_0x360dae))]=_0x3a5be8[_0x360dae];}}return{'variables':_0x4b331b};};exports['updateOriginated']=function(_0x5f4dc0,_0x82af1){if(!_['isNil'](_0x5f4dc0)){if(_0x5f4dc0[_0x49bc('0x2b')](_0x49bc('0x30'))){if(_0x5f4dc0['originated']>0x0){_0x5f4dc0[_0x49bc('0x30')]-=0x1;}else{logger['error'](_0x49bc('0x31'),_0x82af1);}}}else{logger[_0x49bc('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x82af1);}};exports['logBlacklist']=function(_0x401cba){var _0x1dc314=moment()[_0x49bc('0x12')](_0x49bc('0x32'));_0x401cba[_0x49bc('0x33')]=0xd;_0x401cba['statedesc']=_0x49bc('0x34');_0x401cba[_0x49bc('0x35')]=_0x1dc314;_0x401cba[_0x49bc('0x36')]=_0x1dc314;_0x401cba['endtime']=_0x1dc314;};exports[_0x49bc('0x37')]=function(_0x437049,_0x2b50a0,_0x54d984){var _0xc9fdbe=moment()['format'](_0x49bc('0x32'));_0x437049['state']=_0x2b50a0;_0x437049['statedesc']=_0x54d984;_0x437049['responsetime']=_0xc9fdbe;_0x437049[_0x49bc('0x38')]=getSeconds(_0x437049[_0x49bc('0x36')],_0x437049[_0x49bc('0x35')]);};exports[_0x49bc('0x39')]=function(_0x3ae3f2,_0x39e01f,_0x33949a){_0x3ae3f2[_0x49bc('0x3a')]=_0x39e01f;_0x3ae3f2[_0x49bc('0x3b')]=_0x33949a;};exports[_0x49bc('0x3c')]=function(_0x2fef66,_0x36c0bd,_0x2aaeac){var _0x242fd0=moment()[_0x49bc('0x12')](_0x49bc('0x32'));_0x2fef66['state']=_0x36c0bd;_0x2fef66['statedesc']=_0x2aaeac;_0x2fef66['responsetime']=_0x2fef66[_0x49bc('0x36')]?_0x2fef66['responsetime']:_0x242fd0;_0x2fef66[_0x49bc('0x3d')]=_0x2fef66[_0x49bc('0x3d')]?_0x2fef66[_0x49bc('0x3d')]:_0x242fd0;_0x2fef66[_0x49bc('0x38')]=getSeconds(_0x2fef66[_0x49bc('0x36')]||0x0,_0x2fef66[_0x49bc('0x35')]||0x0);_0x2fef66[_0x49bc('0x3e')]=_0x2fef66[_0x49bc('0x3f')]?getSeconds(_0x2fef66['endtime'],_0x2fef66[_0x49bc('0x3f')]):0x0;};exports[_0x49bc('0x40')]=function(_0x2467b0){return _0x2467b0==='Failure';};exports[_0x49bc('0x41')]=function(_0x4dd469,_0x541e52,_0x27ccb1,_0x5af2ad,_0x4904ab){var _0x378464=_0x5af2ad?'RECALL':_0x4dd469[_0x49bc('0x42')];_0x378464=_0x4904ab?_0x49bc('0x43'):_0x378464;return{'actionid':_0x4dd469['uniqueid'],'action':_0x49bc('0x44'),'channel':_0x4dd469[_0x49bc('0x45')],'callerid':util[_0x49bc('0x12')](_0x49bc('0x19'),_0x378464,_0x4dd469[_0x49bc('0x1a')]),'Exten':'xcally-motion-preview','Context':_0x49bc('0x46'),'Priority':'1','variable':_0x27ccb1,'timeout':(_0x541e52[_0x49bc('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4dd469[_0x49bc('0x48')]};};exports['totalGlobal']=function(_0x12029d){return _0x12029d[_0x49bc('0x49')]+_0x12029d[_0x49bc('0x4a')]+_0x12029d[_0x49bc('0x4b')]+_0x12029d[_0x49bc('0x4c')]+_0x12029d['countnosuchnumberretry'];};exports['cloneAction']=function(_0x10573a){var _0xfbaa75=_['clone'](_0x10573a);_0xfbaa75[_0x49bc('0x33')]=0xf;_0xfbaa75[_0x49bc('0x4d')]=_0x49bc('0x4e');return _0xfbaa75;};exports['scheduledAt']=function(_0x4947f3,_0x5e41b3,_0x174b10){var _0x59408a={};_0x59408a[_0x5e41b3]=_0x4947f3[_0x5e41b3];_0x59408a[_0x49bc('0x4f')]=![];_0x59408a[_0x49bc('0x50')]=moment()[_0x49bc('0x51')](_0x174b10,'minutes')[_0x49bc('0x12')](_0x49bc('0x32'));_0x59408a[_0x49bc('0x1b')]=_0x4947f3[_0x49bc('0x1b')];_0x59408a['ListId']=_0x4947f3[_0x49bc('0x52')];_0x59408a[_0x49bc('0x1c')]=_0x4947f3['VoiceQueueId']||undefined;return _0x59408a;};exports[_0x49bc('0x53')]=function(_0x366fa8,_0x804737){if(!_['isNil'](_0x366fa8)){if(_0x366fa8['pTalking']>0x0){_0x366fa8[_0x49bc('0x54')]-=0x1;}else{logger['error'](_0x804737,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x804737,_0x49bc('0x55'));}};exports[_0x49bc('0x56')]=function(_0x4dea57){if(_0x4dea57<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1460c9,_0xe5638,_0x110a3c){_0x1460c9[_0x49bc('0x57')]=_0xe5638;_0x1460c9[_0x49bc('0x18')]=_0x1460c9[_0x49bc('0x58')];_0x1460c9[_0x49bc('0x59')]=_0x1460c9['channelAgent'];_0x1460c9[_0x49bc('0x5a')]=_0x49bc('0x5b');if(_0x110a3c){_0x1460c9[_0x49bc('0x5c')]=_0x110a3c[_0x49bc('0x5c')];}return _0x1460c9;};exports['buildAcw']=function(_0x3e2d65){var _0x4204f1={};_0x4204f1[_0x49bc('0x58')]=_0x3e2d65['queue'];_0x4204f1['interface']=_0x3e2d65[_0x49bc('0x45')];_0x4204f1[_0x49bc('0x48')]=_0x3e2d65[_0x49bc('0x48')];return _0x4204f1;};exports[_0x49bc('0x5d')]=function(_0x53499f){var _0x206b84=[];for(var _0x211015 in _0x53499f){if(_0x53499f[_0x49bc('0x2b')](_0x211015)){if(!_[_0x49bc('0x15')](_0x53499f[_0x211015])&&_0x53499f[_0x211015][_0x49bc('0x33')]===_0x49bc('0x5e')&&_0x53499f[_0x211015][_0x49bc('0x5f')]==='reachable'){_0x206b84[_0x49bc('0x60')](_0x53499f[_0x211015]['id']);}}}return _0x206b84;};exports[_0x49bc('0x61')]=function(_0x11d5ed){var _0x41e5ab=moment()[_0x49bc('0x4')](0x0);var _0x4dbd5f=moment(_0x11d5ed)['milliseconds'](0x0);return _0x41e5ab[_0x49bc('0x5')](_0x4dbd5f,_0x49bc('0x6'));};exports[_0x49bc('0x62')]=function(_0x644e32){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x644e32[_0x49bc('0x1b')],'ListId':_0x644e32['ListId'],'VoiceQueueId':_0x644e32[_0x49bc('0x1c')]||undefined,'CampaignId':_0x644e32[_0x49bc('0x63')]||undefined};};exports['filterKey']=function(_0x10e068){if(_0x10e068===_0x49bc('0x48')||_0x10e068===_0x49bc('0x64')||_0x10e068==='queue'||_0x10e068===_0x49bc('0x65')||_0x10e068===_0x49bc('0x66')||_0x10e068===_0x49bc('0x67')||_0x10e068===_0x49bc('0x3a')||_0x10e068===_0x49bc('0x45')||_0x10e068===_0x49bc('0x42')||_0x10e068===_0x49bc('0x4f')||_0x10e068===_0x49bc('0x1a')||_0x10e068==='scheduledat'||_0x10e068===_0x49bc('0x49')||_0x10e068===_0x49bc('0x4a')||_0x10e068==='countnoanswerretry'||_0x10e068===_0x49bc('0x68')||_0x10e068===_0x49bc('0x69')||_0x10e068===_0x49bc('0x6a')||_0x10e068===_0x49bc('0x6b')||_0x10e068===_0x49bc('0x6c')||_0x10e068===_0x49bc('0x1b')||_0x10e068==='ListId'||_0x10e068===_0x49bc('0x3b')||_0x10e068===_0x49bc('0x1c')||_0x10e068===_0x49bc('0x6d')||_0x10e068===_0x49bc('0x6e')||_0x10e068===_0x49bc('0x6f')||_0x10e068===_0x49bc('0x70')||_0x10e068===_0x49bc('0x71')||_0x10e068==='xmd-dialurl'||_0x10e068==='xmd-dialtimeout'||_0x10e068==='xmd-dialoptions'||_0x10e068===_0x49bc('0x72')||_0x10e068===_0x49bc('0x73')||_0x10e068===_0x49bc('0x74')||_0x10e068===_0x49bc('0x75')||_0x10e068===_0x49bc('0x76')||_0x10e068===_0x49bc('0x77')||_0x10e068==='xmd-agi'||_0x10e068===_0x49bc('0x78')||_0x10e068===_0x49bc('0x79')||_0x10e068===_0x49bc('0x7a')||_0x10e068===_0x49bc('0x7b')||_0x10e068==='rtpaudioqosloss'||_0x10e068==='rtpaudioqoslossbridged'||_0x10e068==='rtpaudioqosrtt'||_0x10e068==='rtpaudioqosrttbridged'||_0x10e068===_0x49bc('0x78')||_0x10e068==='rtpaudioqosbridged'||_0x10e068===_0x49bc('0x7a')||_0x10e068===_0x49bc('0x7b')||_0x10e068==='rtpaudioqosloss'||_0x10e068===_0x49bc('0x7c')||_0x10e068===_0x49bc('0x7d')||_0x10e068===_0x49bc('0x7e')||_0x10e068===_0x49bc('0x7f')||_0x10e068==='bridgepvtcallid'||_0x10e068===_0x49bc('0x33')||_0x10e068===_0x49bc('0x4d')){return![];}return!![];};exports[_0x49bc('0x80')]=function(_0x4800d9,_0x36fa0b){var _0x535540,_0x2362e3,_0x5f094f;if(_0x36fa0b<=0x0){_0x36fa0b=0x1;}_0x535540=new RegExp('\x5cw{0,'+_0x36fa0b+'}$');_0x2362e3=Math[_0x49bc('0x81')](0xa,_0x36fa0b-0x1);_0x5f094f=Math[_0x49bc('0x81')](0xa,_0x36fa0b)-0x1;return util[_0x49bc('0x12')]('%s',_[_0x49bc('0x82')](_0x4800d9,_0x535540,_[_0x49bc('0x83')](_0x2362e3,_0x5f094f)));};exports[_0x49bc('0x84')]=function(_0x7ea47f){var _0x1202a9=_0x7ea47f[_0x49bc('0x85')](/"(.*?)"/);return _0x1202a9?_0x1202a9[0x1]:_0x7ea47f;};exports[_0x49bc('0x86')]=function(_0x47d450){var _0x2bd3fb=_0x47d450[_0x49bc('0x85')](/<(.*?)>/);return _0x2bd3fb?_0x2bd3fb[0x1]:_0x47d450;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f876059..72ff7eb 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 _0xe3e0=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel'];(function(_0x46f960,_0x9037c1){var _0x320b5a=function(_0x5418be){while(--_0x5418be){_0x46f960['push'](_0x46f960['shift']());}};_0x320b5a(++_0x9037c1);}(_0xe3e0,0xef));var _0x0e3e=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xe3e0[_0x2becba];return _0x90b5dd;};'use strict';exports[_0x0e3e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x0e3e('0x1'),'required':!![]},'membername':{'type':_0x0e3e('0x1'),'required':!![]},'penalty':{'type':_0x0e3e('0x2'),'required':![]},'paused':{'type':_0x0e3e('0x3'),'required':![]}};exports[_0x0e3e('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x0e3e('0x1'),'required':!![]},'paused':{'type':_0x0e3e('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x0e3e('0x1'),'required':![]}};exports[_0x0e3e('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x0e3e('0x1')},'format':{'type':_0x0e3e('0x1')},'mixmonitorid':{'type':_0x0e3e('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x0e3e('0x6')]={'uniqueid':{'type':_0x0e3e('0x1'),'required':!![]},'exten':{'type':_0x0e3e('0x1'),'required':!![]},'context':{'type':_0x0e3e('0x1')}}; \ No newline at end of file +var _0xd8f8=['voicequeuechannelhangup','queueadd','string','number','boolean','reload'];(function(_0x5c0315,_0x32c4ee){var _0x4c4b6a=function(_0x1e7dbf){while(--_0x1e7dbf){_0x5c0315['push'](_0x5c0315['shift']());}};_0x4c4b6a(++_0x32c4ee);}(_0xd8f8,0xd3));var _0x8d8f=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd8f8[_0x29d915];return _0x160f86;};'use strict';exports[_0x8d8f('0x0')]={'queue':{'type':_0x8d8f('0x1'),'required':!![]},'interface':{'type':_0x8d8f('0x1'),'required':!![]},'membername':{'type':_0x8d8f('0x1'),'required':!![]},'penalty':{'type':_0x8d8f('0x2'),'required':![]},'paused':{'type':_0x8d8f('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8d8f('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x8d8f('0x1'),'required':!![]},'paused':{'type':_0x8d8f('0x3')},'reason':{'type':_0x8d8f('0x1'),'required':![]}};exports[_0x8d8f('0x4')]={'module':{'type':_0x8d8f('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x8d8f('0x1'),'required':!![]},'filename':{'type':_0x8d8f('0x1')},'format':{'type':_0x8d8f('0x1')},'mixmonitorid':{'type':_0x8d8f('0x1')}};exports[_0x8d8f('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x8d8f('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x8d8f('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1c620f2..ffb25b4 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 _0x4b1c=['util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','agents','telephones','triggers','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','initTelephones','mergeFromDatabase','initTrunks','trunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','seconds','duration','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','bluebird'];(function(_0x2a563c,_0x30138e){var _0x3bcc5a=function(_0x372ba9){while(--_0x372ba9){_0x2a563c['push'](_0x2a563c['shift']());}};_0x3bcc5a(++_0x30138e);}(_0x4b1c,0x143));var _0xc4b1=function(_0x3a0bd9,_0x3e872b){_0x3a0bd9=_0x3a0bd9-0x0;var _0x2c4879=_0x4b1c[_0x3a0bd9];return _0x2c4879;};'use strict';var BPromise=require(_0xc4b1('0x0'));var util=require(_0xc4b1('0x1'));var _=require(_0xc4b1('0x2'));var moment=require(_0xc4b1('0x3'));var Agent=require(_0xc4b1('0x4'));var Telephone=require(_0xc4b1('0x5'));var Trunk=require(_0xc4b1('0x6'));var VoiceQueue=require(_0xc4b1('0x7'));var Trigger=require(_0xc4b1('0x8'));var Template=require(_0xc4b1('0x9'));var Campaign=require(_0xc4b1('0xa'));var VoiceExtension=require(_0xc4b1('0xb'));var ZendeskAccount=require(_0xc4b1('0xc'));var SalesforceAccount=require(_0xc4b1('0xd'));var FreshdeskAccount=require(_0xc4b1('0xe'));var SugarcrmAccount=require(_0xc4b1('0xf'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc4b1('0x10'));var VtigerAccount=require(_0xc4b1('0x11'));var ServicenowAccount=require(_0xc4b1('0x12'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xc4b1('0x13')]={};this[_0xc4b1('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0xc4b1('0x15')]={};this['campaigns']={};this[_0xc4b1('0x16')]={};this[_0xc4b1('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc4b1('0x18')]={};this[_0xc4b1('0x19')]={};this[_0xc4b1('0x1a')]={};this['outboundChannels']={};this[_0xc4b1('0x1b')]={};this['settings']={};this[_0xc4b1('0x1c')]={};this[_0xc4b1('0x1d')]={};this[_0xc4b1('0x1e')]={};this[_0xc4b1('0x1f')]={};this[_0xc4b1('0x20')]={};this['deskAccounts']={};this[_0xc4b1('0x21')]={};this[_0xc4b1('0x22')]={};this[_0xc4b1('0x23')]={};this[_0xc4b1('0x24')]={};this[_0xc4b1('0x25')]={};};function freeIsNotKey(_0x3dde87,_0x1e9495,_0x410b0b){var _0x3a59f3=_[_0xc4b1('0x26')](_0x3dde87,function(_0x5bb429,_0x12368b){return _0x5bb429[_0x410b0b];});for(var _0x1f9482 in _0x1e9495){if(_0x1e9495[_0xc4b1('0x27')](_0x1f9482)){if(!_0x3a59f3[_0x1f9482]){delete _0x1e9495[_0x1f9482];}}}}function freeIsNotKeySip(_0x87e24f,_0x3b6ee3){var _0x1e13b8=_[_0xc4b1('0x26')](_0x87e24f,function(_0x130e3d,_0x545a53){return util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x130e3d[_0xc4b1('0x2a')]);});for(var _0x382337 in _0x3b6ee3){if(_0x3b6ee3[_0xc4b1('0x27')](_0x382337)){if(!_0x1e13b8[_0x382337]){delete _0x3b6ee3[_0x382337];}}}}function freeIsNotKeyAgent(_0x3d15db,_0x791ae3){var _0x3a165d=_[_0xc4b1('0x26')](_0x3d15db,function(_0x40e66d,_0x811367){var _0x124b82=_[_0xc4b1('0x2b')](_0x40e66d['interface'])?util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x40e66d['name']):_0x40e66d[_0xc4b1('0x2c')];return _0x124b82;});for(var _0x306996 in _0x791ae3){if(_0x791ae3[_0xc4b1('0x27')](_0x306996)){if(!_0x3a165d[_0x306996]){delete _0x791ae3[_0x306996];}}}}function clearVoiceCallReports(_0x3a56db){_0x3a56db[_0xc4b1('0x2d')]=0x0;_0x3a56db[_0xc4b1('0x2e')]=0x0;_0x3a56db[_0xc4b1('0x2f')]=0x0;_0x3a56db[_0xc4b1('0x30')]=0x0;_0x3a56db['sumBillable']=0x0;}function clearCampaigns(_0x39a20b){if(!_[_0xc4b1('0x31')](_0x39a20b)){for(var _0x3e6199 in _0x39a20b){if(_0x39a20b[_0xc4b1('0x27')](_0x3e6199)){_0x39a20b[_0x3e6199][_0xc4b1('0x32')]=0x0;_0x39a20b[_0x3e6199][_0xc4b1('0x33')]=0x0;}}}}function clearVoiceQueues(_0x4132cb){if(!_[_0xc4b1('0x31')](_0x4132cb)){for(var _0x93dd0c in _0x4132cb){if(_0x4132cb[_0xc4b1('0x27')](_0x93dd0c)){_0x4132cb[_0x93dd0c][_0xc4b1('0x2d')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x2e')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x34')]=0x0;_0x4132cb[_0x93dd0c]['abandoned']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x2f')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x30')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x35')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x36')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x37')]=0x0;_0x4132cb[_0x93dd0c]['outboundBusyCallsDay']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x38')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x39')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3a')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3b')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3c')]=0x0;_0x4132cb[_0x93dd0c]['outboundBlacklistCallsDay']=0x0;_0x4132cb[_0x93dd0c]['outboundOriginateFailureCallsDay']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3d')]=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3e')]=0x0;_0x4132cb[_0x93dd0c]['outboundAnswerAgiCallsDay']=0x0;_0x4132cb[_0x93dd0c]['outboundAnswerCallsDay']=0x0;_0x4132cb[_0x93dd0c][_0xc4b1('0x3f')]=!![];}}}}Realtime[_0xc4b1('0x40')]['mergeFromDatabase']=function(_0x379f74,_0xbde6ef){for(var _0x16d024 in _0xbde6ef){if(_0x379f74['hasOwnProperty'](_0x16d024)){_0x379f74[_0x16d024]=_0xbde6ef[_0x16d024];}}};Realtime[_0xc4b1('0x40')]['initAgents']=function(){var _0x2f06cd=this;return function(_0x3e974b){if(_0x3e974b){freeIsNotKeyAgent(_0x3e974b,_0x2f06cd['agents']);for(var _0x1d7178=0x0,_0x1737fb={},_0x2e31a7={};_0x1d7178<_0x3e974b[_0xc4b1('0x41')];_0x1d7178+=0x1){_0x1737fb=_0x3e974b[_0x1d7178];var _0x2bd5bf=_[_0xc4b1('0x2b')](_0x1737fb[_0xc4b1('0x2c')])?util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x1737fb[_0xc4b1('0x2a')]):_0x1737fb['interface'];if(_['isUndefined'](_0x2f06cd[_0xc4b1('0x13')][_0x2bd5bf])){_0x2f06cd[_0xc4b1('0x13')][_0x2bd5bf]=new Agent(_0x1737fb);}else{_0x2f06cd['mergeFromDatabase'](_0x2f06cd[_0xc4b1('0x13')][_0x2bd5bf],_0x1737fb);}}}return _0x2f06cd[_0xc4b1('0x13')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x42')]=function(){var _0xbeec57=this;return function(_0xd847c8){if(_0xd847c8){freeIsNotKeySip(_0xd847c8,_0xbeec57[_0xc4b1('0x14')]);for(var _0x3a9c33=0x0,_0x5020f3={},_0x35d34d={};_0x3a9c33<_0xd847c8['length'];_0x3a9c33+=0x1){_0x5020f3=_0xd847c8[_0x3a9c33];if(_['isUndefined'](_0xbeec57[_0xc4b1('0x14')][util['format'](_0xc4b1('0x29'),_0x5020f3['name'])])){_0xbeec57[_0xc4b1('0x14')][util[_0xc4b1('0x28')]('SIP/%s',_0x5020f3[_0xc4b1('0x2a')])]=new Telephone(_0x5020f3);}else{_0xbeec57[_0xc4b1('0x43')](_0xbeec57[_0xc4b1('0x14')][util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x5020f3[_0xc4b1('0x2a')])],_0x5020f3);}}}return _0xbeec57[_0xc4b1('0x14')];};};Realtime['prototype'][_0xc4b1('0x44')]=function(){var _0x1fbb10=this;return function(_0x5d018f){if(_0x5d018f){freeIsNotKeySip(_0x5d018f,_0x1fbb10[_0xc4b1('0x45')]);for(var _0x306db8=0x0,_0x21f78a={},_0x4cd4c1={};_0x306db8<_0x5d018f[_0xc4b1('0x41')];_0x306db8+=0x1){_0x21f78a=_0x5d018f[_0x306db8];if(_[_0xc4b1('0x46')](_0x1fbb10['trunks'][util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x21f78a['name'])])){_0x1fbb10[_0xc4b1('0x45')][util['format'](_0xc4b1('0x29'),_0x21f78a['name'])]=new Trunk(_0x21f78a);}else{_0x1fbb10[_0xc4b1('0x43')](_0x1fbb10[_0xc4b1('0x45')][util[_0xc4b1('0x28')](_0xc4b1('0x29'),_0x21f78a[_0xc4b1('0x2a')])],_0x21f78a);}}}return _0x1fbb10[_0xc4b1('0x45')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x47')]=function(){var _0x55737d=this;return function(_0x33e176){if(_0x33e176){freeIsNotKey(_0x33e176,_0x55737d[_0xc4b1('0x48')],'name');for(var _0x4e5db9=0x0,_0x313ae5={},_0x377f10={};_0x4e5db9<_0x33e176['length'];_0x4e5db9+=0x1){_0x313ae5=_0x33e176[_0x4e5db9];if(_['isUndefined'](_0x55737d[_0xc4b1('0x48')][_0x313ae5['name']])){_0x55737d[_0xc4b1('0x48')][_0x313ae5['name']]=new VoiceQueue(_0x313ae5);}else{_0x55737d[_0xc4b1('0x43')](_0x55737d[_0xc4b1('0x48')][_0x313ae5[_0xc4b1('0x2a')]],_0x313ae5);}}}return _0x55737d[_0xc4b1('0x48')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x49')]=function(){var _0x317e03=this;return function(_0x335ddf){if(_0x335ddf){freeIsNotKey(_0x335ddf,_0x317e03[_0xc4b1('0x15')],'id');for(var _0x52d52c=0x0,_0x3aa318={},_0x3bd96b={};_0x52d52c<_0x335ddf[_0xc4b1('0x41')];_0x52d52c+=0x1){_0x3aa318=_0x335ddf[_0x52d52c];if(_[_0xc4b1('0x46')](_0x317e03['triggers'][_0x3aa318['id']])){_0x317e03[_0xc4b1('0x15')][_0x3aa318['id']]=new Trigger(_0x3aa318);}else{_0x317e03[_0xc4b1('0x43')](_0x317e03[_0xc4b1('0x15')][_0x3aa318['id']],_0x3aa318);}}}return _0x317e03[_0xc4b1('0x15')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4a')]=function(){var _0x3f3d51=this;return function(_0x33a73a){if(_0x33a73a){freeIsNotKey(_0x33a73a,_0x3f3d51[_0xc4b1('0x16')],'id');for(var _0x3563d1=0x0,_0x13260a={},_0x398eff={};_0x3563d1<_0x33a73a[_0xc4b1('0x41')];_0x3563d1+=0x1){_0x13260a=_0x33a73a[_0x3563d1];if(_[_0xc4b1('0x46')](_0x3f3d51[_0xc4b1('0x16')][_0x13260a['id']])){_0x3f3d51[_0xc4b1('0x16')][_0x13260a['id']]=new Template(_0x13260a);}else{_0x3f3d51[_0xc4b1('0x43')](_0x3f3d51['templates'][_0x13260a['id']],_0x13260a);}}}return _0x3f3d51[_0xc4b1('0x16')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x4e8fa5=this;return function(_0x353c0d){if(_0x353c0d){freeIsNotKey(_0x353c0d,_0x4e8fa5[_0xc4b1('0x1c')],'id');for(var _0x38f067=0x0,_0xa2c208={},_0x2f9703={};_0x38f067<_0x353c0d[_0xc4b1('0x41')];_0x38f067+=0x1){_0xa2c208=_0x353c0d[_0x38f067];if(_['isUndefined'](_0x4e8fa5['zendeskAccounts'][_0xa2c208['id']])){_0x4e8fa5['zendeskAccounts'][_0xa2c208['id']]=new ZendeskAccount(_0xa2c208);}else{_0x4e8fa5['mergeFromDatabase'](_0x4e8fa5['zendeskAccounts'][_0xa2c208['id']],_0xa2c208);}}}return _0x4e8fa5[_0xc4b1('0x1c')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4b')]=function(){var _0x284572=this;return function(_0x11e430){if(_0x11e430){freeIsNotKey(_0x11e430,_0x284572[_0xc4b1('0x1d')],'id');for(var _0x1da8ee=0x0,_0xd287e9={},_0x262f0a={};_0x1da8ee<_0x11e430[_0xc4b1('0x41')];_0x1da8ee+=0x1){_0xd287e9=_0x11e430[_0x1da8ee];if(_[_0xc4b1('0x46')](_0x284572[_0xc4b1('0x1d')][_0xd287e9['id']])){_0x284572[_0xc4b1('0x1d')][_0xd287e9['id']]=new SalesforceAccount(_0xd287e9);}else{_0x284572['mergeFromDatabase'](_0x284572[_0xc4b1('0x1d')][_0xd287e9['id']],_0xd287e9);}}}return _0x284572[_0xc4b1('0x1d')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4c')]=function(){var _0x9ba3fc=this;return function(_0x460e20){if(_0x460e20){freeIsNotKey(_0x460e20,_0x9ba3fc[_0xc4b1('0x1f')],'id');for(var _0x1a0ecf=0x0,_0xddc717={},_0x52adda={};_0x1a0ecf<_0x460e20[_0xc4b1('0x41')];_0x1a0ecf+=0x1){_0xddc717=_0x460e20[_0x1a0ecf];if(_['isUndefined'](_0x9ba3fc['freshdeskAccounts'][_0xddc717['id']])){_0x9ba3fc[_0xc4b1('0x1f')][_0xddc717['id']]=new FreshdeskAccount(_0xddc717);}else{_0x9ba3fc['mergeFromDatabase'](_0x9ba3fc[_0xc4b1('0x1f')][_0xddc717['id']],_0xddc717);}}}return _0x9ba3fc[_0xc4b1('0x1f')];};};Realtime[_0xc4b1('0x40')]['initZohoAccounts']=function(){var _0x4cb24a=this;return function(_0x56bb09){if(_0x56bb09){freeIsNotKey(_0x56bb09,_0x4cb24a['zohoAccounts'],'id');for(var _0x43faff=0x0,_0x2b33e4={},_0x3b91e={};_0x43faff<_0x56bb09[_0xc4b1('0x41')];_0x43faff+=0x1){_0x2b33e4=_0x56bb09[_0x43faff];if(_[_0xc4b1('0x46')](_0x4cb24a['zohoAccounts'][_0x2b33e4['id']])){_0x4cb24a[_0xc4b1('0x20')][_0x2b33e4['id']]=new ZohoAccount(_0x2b33e4);}else{_0x4cb24a[_0xc4b1('0x43')](_0x4cb24a['zohoAccounts'][_0x2b33e4['id']],_0x2b33e4);}}}return _0x4cb24a[_0xc4b1('0x20')];};};Realtime['prototype'][_0xc4b1('0x4d')]=function(){var _0x2fab6a=this;return function(_0x2b2c3c){if(_0x2b2c3c){freeIsNotKey(_0x2b2c3c,_0x2fab6a[_0xc4b1('0x4e')],'id');for(var _0x16932f=0x0,_0x5d0e4c={},_0x4eb12a={};_0x16932f<_0x2b2c3c['length'];_0x16932f+=0x1){_0x5d0e4c=_0x2b2c3c[_0x16932f];if(_[_0xc4b1('0x46')](_0x2fab6a[_0xc4b1('0x4e')][_0x5d0e4c['id']])){_0x2fab6a[_0xc4b1('0x4e')][_0x5d0e4c['id']]=new DeskAccount(_0x5d0e4c);}else{_0x2fab6a[_0xc4b1('0x43')](_0x2fab6a[_0xc4b1('0x4e')][_0x5d0e4c['id']],_0x5d0e4c);}}}return _0x2fab6a[_0xc4b1('0x4e')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x4f')]=function(){var _0x4a1078=this;return function(_0x6a6dce){if(_0x6a6dce){freeIsNotKey(_0x6a6dce,_0x4a1078[_0xc4b1('0x1e')],'id');for(var _0x2fe2c1=0x0,_0x5a502e={},_0x5978ab={};_0x2fe2c1<_0x6a6dce['length'];_0x2fe2c1+=0x1){_0x5a502e=_0x6a6dce[_0x2fe2c1];if(_[_0xc4b1('0x46')](_0x4a1078['sugarcrmAccounts'][_0x5a502e['id']])){_0x4a1078[_0xc4b1('0x1e')][_0x5a502e['id']]=new SugarcrmAccount(_0x5a502e);}else{_0x4a1078['mergeFromDatabase'](_0x4a1078[_0xc4b1('0x1e')][_0x5a502e['id']],_0x5a502e);}}}return _0x4a1078['sugarcrmAccounts'];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x50')]=function(){var _0x32a349=this;return function(_0x1b7630){if(_0x1b7630){freeIsNotKey(_0x1b7630,_0x32a349[_0xc4b1('0x21')],'id');for(var _0x177d86=0x0,_0x4860e5={},_0x1a58dc={};_0x177d86<_0x1b7630['length'];_0x177d86+=0x1){_0x4860e5=_0x1b7630[_0x177d86];if(_[_0xc4b1('0x46')](_0x32a349[_0xc4b1('0x21')][_0x4860e5['id']])){_0x32a349[_0xc4b1('0x21')][_0x4860e5['id']]=new VtigerAccount(_0x4860e5);}else{_0x32a349['mergeFromDatabase'](_0x32a349['vtigerAccounts'][_0x4860e5['id']],_0x4860e5);}}}return _0x32a349[_0xc4b1('0x21')];};};Realtime['prototype'][_0xc4b1('0x51')]=function(){var _0x100233=this;return function(_0x42424c){if(_0x42424c){freeIsNotKey(_0x42424c,_0x100233[_0xc4b1('0x22')],'id');for(var _0x3f5630=0x0,_0x13b4ff={},_0x359f2d={};_0x3f5630<_0x42424c[_0xc4b1('0x41')];_0x3f5630+=0x1){_0x13b4ff=_0x42424c[_0x3f5630];if(_[_0xc4b1('0x46')](_0x100233[_0xc4b1('0x22')][_0x13b4ff['id']])){_0x100233[_0xc4b1('0x22')][_0x13b4ff['id']]=new ServicenowAccount(_0x13b4ff);}else{_0x100233[_0xc4b1('0x43')](_0x100233[_0xc4b1('0x22')][_0x13b4ff['id']],_0x13b4ff);}}}return _0x100233[_0xc4b1('0x22')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x52')]=function(){var _0x2aa068=this;return function(_0x4c1ac1){if(_0x4c1ac1){freeIsNotKey(_0x4c1ac1,_0x2aa068['dynamics365Accounts'],'id');for(var _0x113261=0x0,_0x2907b5={},_0x5249b5={};_0x113261<_0x4c1ac1[_0xc4b1('0x41')];_0x113261+=0x1){_0x2907b5=_0x4c1ac1[_0x113261];if(_[_0xc4b1('0x46')](_0x2aa068['dynamics365Accounts'][_0x2907b5['id']])){_0x2aa068[_0xc4b1('0x23')][_0x2907b5['id']]=new Dynamics365Account(_0x2907b5);}else{_0x2aa068['mergeFromDatabase'](_0x2aa068[_0xc4b1('0x23')][_0x2907b5['id']],_0x2907b5);}}}return _0x2aa068[_0xc4b1('0x23')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x53')]=function(){var _0x2c852d=this;return function(_0x595e7c){if(_0x595e7c){freeIsNotKey(_0x595e7c,_0x2c852d[_0xc4b1('0x24')],'id');for(var _0x491951=0x0,_0x39d28e={},_0x2c6662={};_0x491951<_0x595e7c[_0xc4b1('0x41')];_0x491951+=0x1){_0x39d28e=_0x595e7c[_0x491951];if(_['isUndefined'](_0x2c852d[_0xc4b1('0x24')][_0x39d28e['id']])){_0x2c852d[_0xc4b1('0x24')][_0x39d28e['id']]=new FreshsalesAccount(_0x39d28e);}else{_0x2c852d[_0xc4b1('0x43')](_0x2c852d[_0xc4b1('0x24')][_0x39d28e['id']],_0x39d28e);}}}return _0x2c852d[_0xc4b1('0x24')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x54')]=function(){var _0x3da19e=this;return function(_0x5c6470){for(var _0x422602=0x0;_0x422602<_0x5c6470[_0xc4b1('0x41')];_0x422602+=0x1){_[_0xc4b1('0x55')](_0x3da19e['voiceQueues'][_0x5c6470[_0x422602][_0xc4b1('0x2a')]],_0x5c6470[_0x422602]);}return _0x3da19e[_0xc4b1('0x48')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x56')]=function(){var _0x2795b2=this;return function(_0x1a2f72){clearVoiceQueues(_0x2795b2[_0xc4b1('0x48')]);if(_0x1a2f72){_0x1a2f72=_[_0xc4b1('0x57')](_0x1a2f72,_0xc4b1('0x58'));for(var _0x5b6f76 in _0x1a2f72){if(_0x1a2f72[_0xc4b1('0x27')](_0x5b6f76)){var _0x26a781={};for(var _0x31945a=0x0;_0x31945a<_0x1a2f72[_0x5b6f76][_0xc4b1('0x41')];_0x31945a+=0x1){var _0x325f9e=_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x59')];if(_0x2795b2[_0xc4b1('0x48')][_0x325f9e]){if(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5a')]){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x34')]+=0x1;}if(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5b')]){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x5c')]+=0x1;}_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x2f')]+=moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5d')])[_0xc4b1('0x5e')](moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5f')]),'seconds')||0x0;if(_0x31945a===_0x1a2f72[_0x5b6f76][_0xc4b1('0x41')]-0x1){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x30')]+=moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x60')]||_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x61')]||_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x62')])[_0xc4b1('0x5e')](moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5f')]),'seconds')||0x0;_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x2d')]+=0x1;if(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x63')]){_0x2795b2[_0xc4b1('0x48')][_0x325f9e][_0xc4b1('0x2e')]+=0x1;_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x35')]+=moment(_0x1a2f72[_0x5b6f76][_0x31945a]['queuecallercompleteAt'])[_0xc4b1('0x5e')](moment(_0x1a2f72[_0x5b6f76][_0x31945a][_0xc4b1('0x5d')]),_0xc4b1('0x64'))||0x0;}}else{_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x30')]+=_0x2795b2['voiceQueues'][_0x325f9e][_0xc4b1('0x2f')]||0x0;}}}}}}return _0x2795b2[_0xc4b1('0x48')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x1f97c2=this;return function(_0x50fe71){clearVoiceCallReports(_0x1f97c2[_0xc4b1('0x17')]);if(_0x50fe71){for(var _0x44bfa7=0x0;_0x44bfa7<_0x50fe71[_0xc4b1('0x41')];_0x44bfa7+=0x1){_0x1f97c2['outbound'][_0xc4b1('0x2d')]+=0x1;_0x1f97c2[_0xc4b1('0x17')][_0xc4b1('0x30')]+=_0x50fe71[_0x44bfa7]['duration'];if(_0x50fe71[_0x44bfa7]['disposition']==='ANSWERED'){_0x1f97c2[_0xc4b1('0x17')]['answered']+=0x1;_0x1f97c2[_0xc4b1('0x17')][_0xc4b1('0x2f')]+=_0x50fe71[_0x44bfa7][_0xc4b1('0x65')]-_0x50fe71[_0x44bfa7]['billableseconds']||0x0;_0x1f97c2[_0xc4b1('0x17')]['sumBillable']+=_0x50fe71[_0x44bfa7]['billableseconds'];}}}return _0x1f97c2['outbound'];};};Realtime['prototype'][_0xc4b1('0x66')]=function(){var _0x1fa6c7=this;return function(_0x36fc78){if(_0x36fc78){freeIsNotKey(_0x36fc78,_0x1fa6c7['campaigns'],_0xc4b1('0x2a'));for(var _0x7d515a=0x0,_0x579597={};_0x7d515a<_0x36fc78[_0xc4b1('0x41')];_0x7d515a+=0x1){_0x579597=_0x36fc78[_0x7d515a];if(_[_0xc4b1('0x46')](_0x1fa6c7[_0xc4b1('0x67')][_0x579597[_0xc4b1('0x2a')]])){_0x1fa6c7['campaigns'][_0x579597[_0xc4b1('0x2a')]]=new Campaign(_0x579597);}else{_0x1fa6c7[_0xc4b1('0x43')](_0x1fa6c7['campaigns'][_0x579597[_0xc4b1('0x2a')]],_0x579597);_0x1fa6c7[_0xc4b1('0x67')][_0x579597[_0xc4b1('0x2a')]][_0xc4b1('0x68')]=_0x579597[_0xc4b1('0x69')]?_0x579597[_0xc4b1('0x69')][_0xc4b1('0x2a')]:undefined;}}}return _0x1fa6c7[_0xc4b1('0x67')];};};Realtime[_0xc4b1('0x40')][_0xc4b1('0x6a')]=function(){var _0x438597=this;return function(_0x1a9356){if(_0x1a9356){freeIsNotKey(_0x1a9356,_0x438597[_0xc4b1('0x18')],'id');for(var _0x488bb9=0x0,_0x19acbf={};_0x488bb9<_0x1a9356[_0xc4b1('0x41')];_0x488bb9+=0x1){_0x19acbf=_0x1a9356[_0x488bb9];if(_[_0xc4b1('0x46')](_0x438597['voiceExtensions'][_0x19acbf['id']])){_0x438597['voiceExtensions'][_0x19acbf['id']]=new VoiceExtension(_0x19acbf);}else{_0x438597[_0xc4b1('0x43')](_0x438597[_0xc4b1('0x18')][_0x19acbf['id']],_0x19acbf);}}}return _0x438597['voiceExtensions'];};};Realtime[_0xc4b1('0x40')]['initCampaignHopperHistory']=function(){var _0x58107d=this;return function(_0xdcbe4b){clearCampaigns(_0x58107d['campaigns']);for(var _0x4e7e26=0x0;_0x4e7e26<_0xdcbe4b[_0xc4b1('0x41')];_0x4e7e26+=0x1){_[_0xc4b1('0x55')](_0x58107d[_0xc4b1('0x67')][_0xdcbe4b[_0x4e7e26][_0xc4b1('0x2a')]],_0xdcbe4b[_0x4e7e26]);}return _0x58107d['campaigns'];};};Realtime['prototype'][_0xc4b1('0x6b')]=function(){var _0x23db4e=this;return function(_0x32fd75){if(_0x32fd75){freeIsNotKey(_0x32fd75,_0x23db4e[_0xc4b1('0x25')],'id');for(var _0x376736=0x0,_0x4ea096={},_0x6224c3={};_0x376736<_0x32fd75[_0xc4b1('0x41')];_0x376736+=0x1){_0x4ea096=_0x32fd75[_0x376736];if(_['isUndefined'](_0x23db4e[_0xc4b1('0x25')][_0x4ea096['id']])){_0x23db4e[_0xc4b1('0x25')][_0x4ea096['id']]=new FaxAccount(_0x4ea096);}else{_0x23db4e['mergeFromDatabase'](_0x23db4e[_0xc4b1('0x25')][_0x4ea096['id']],_0x4ea096);}}}return _0x23db4e[_0xc4b1('0x25')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9bf3=['initTrunks','isUndefined','initTriggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','dynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','sumBillable','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initFaxAccounts','faxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','initTelephones','telephones'];(function(_0x30bd19,_0x20705f){var _0x1eae32=function(_0x309205){while(--_0x309205){_0x30bd19['push'](_0x30bd19['shift']());}};_0x1eae32(++_0x20705f);}(_0x9bf3,0xf6));var _0x39bf=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x9bf3[_0x333714];return _0x4c211e;};'use strict';var BPromise=require(_0x39bf('0x0'));var util=require('util');var _=require(_0x39bf('0x1'));var moment=require(_0x39bf('0x2'));var Agent=require(_0x39bf('0x3'));var Telephone=require(_0x39bf('0x4'));var Trunk=require(_0x39bf('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x39bf('0x6'));var Template=require('../model/template');var Campaign=require(_0x39bf('0x7'));var VoiceExtension=require(_0x39bf('0x8'));var ZendeskAccount=require(_0x39bf('0x9'));var SalesforceAccount=require(_0x39bf('0xa'));var FreshdeskAccount=require(_0x39bf('0xb'));var SugarcrmAccount=require(_0x39bf('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x39bf('0xd'));var VtigerAccount=require(_0x39bf('0xe'));var ServicenowAccount=require(_0x39bf('0xf'));var Dynamics365Account=require(_0x39bf('0x10'));var FreshsalesAccount=require(_0x39bf('0x11'));var FaxAccount=require(_0x39bf('0x12'));var Realtime=function(){this[_0x39bf('0x13')]={};this['telephones']={};this[_0x39bf('0x14')]={};this[_0x39bf('0x15')]={};this[_0x39bf('0x16')]={};this[_0x39bf('0x17')]={};this['templates']={};this[_0x39bf('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x39bf('0x19')]={};this[_0x39bf('0x1a')]={};this[_0x39bf('0x1b')]={};this[_0x39bf('0x1c')]={};this[_0x39bf('0x1d')]={};this[_0x39bf('0x1e')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x39bf('0x1f')]={};this[_0x39bf('0x20')]={};this[_0x39bf('0x21')]={};this['vtigerAccounts']={};this[_0x39bf('0x22')]={};this['dynamics365Accounts']={};this[_0x39bf('0x23')]={};this['faxAccounts']={};};function freeIsNotKey(_0x510161,_0x5c84b9,_0x4dd38b){var _0x14e1fe=_[_0x39bf('0x24')](_0x510161,function(_0x4cdcd3,_0x20fa9d){return _0x4cdcd3[_0x4dd38b];});for(var _0x3af9d9 in _0x5c84b9){if(_0x5c84b9[_0x39bf('0x25')](_0x3af9d9)){if(!_0x14e1fe[_0x3af9d9]){delete _0x5c84b9[_0x3af9d9];}}}}function freeIsNotKeySip(_0x39d31c,_0x1e176b){var _0x42f428=_[_0x39bf('0x24')](_0x39d31c,function(_0x3a9133,_0x4becac){return util[_0x39bf('0x26')](_0x39bf('0x27'),_0x3a9133[_0x39bf('0x28')]);});for(var _0x4550b8 in _0x1e176b){if(_0x1e176b[_0x39bf('0x25')](_0x4550b8)){if(!_0x42f428[_0x4550b8]){delete _0x1e176b[_0x4550b8];}}}}function freeIsNotKeyAgent(_0x16bca8,_0x30dbab){var _0x13d2f9=_[_0x39bf('0x24')](_0x16bca8,function(_0x1e8f74,_0x8b8e5a){var _0x2721b6=_[_0x39bf('0x29')](_0x1e8f74[_0x39bf('0x2a')])?util[_0x39bf('0x26')](_0x39bf('0x27'),_0x1e8f74['name']):_0x1e8f74[_0x39bf('0x2a')];return _0x2721b6;});for(var _0x1948b6 in _0x30dbab){if(_0x30dbab[_0x39bf('0x25')](_0x1948b6)){if(!_0x13d2f9[_0x1948b6]){delete _0x30dbab[_0x1948b6];}}}}function clearVoiceCallReports(_0x3dac56){_0x3dac56[_0x39bf('0x2b')]=0x0;_0x3dac56[_0x39bf('0x2c')]=0x0;_0x3dac56[_0x39bf('0x2d')]=0x0;_0x3dac56[_0x39bf('0x2e')]=0x0;_0x3dac56['sumBillable']=0x0;}function clearCampaigns(_0x4f0636){if(!_['isEmpty'](_0x4f0636)){for(var _0x83e8b8 in _0x4f0636){if(_0x4f0636[_0x39bf('0x25')](_0x83e8b8)){_0x4f0636[_0x83e8b8][_0x39bf('0x2f')]=0x0;_0x4f0636[_0x83e8b8]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xa2e5da){if(!_[_0x39bf('0x30')](_0xa2e5da)){for(var _0x7c3ce9 in _0xa2e5da){if(_0xa2e5da['hasOwnProperty'](_0x7c3ce9)){_0xa2e5da[_0x7c3ce9]['total']=0x0;_0xa2e5da[_0x7c3ce9]['answered']=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x31')]=0x0;_0xa2e5da[_0x7c3ce9]['abandoned']=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x2d')]=0x0;_0xa2e5da[_0x7c3ce9]['sumDuration']=0x0;_0xa2e5da[_0x7c3ce9]['sumBillable']=0x0;_0xa2e5da[_0x7c3ce9]['outboundAnswerAgiCallsDay']=0x0;_0xa2e5da[_0x7c3ce9]['outboundNoAnswerCallsDay']=0x0;_0xa2e5da[_0x7c3ce9]['outboundBusyCallsDay']=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x32')]=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x33')]=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x34')]=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x35')]=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x36')]=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x37')]=0x0;_0xa2e5da[_0x7c3ce9]['outboundOriginateFailureCallsDay']=0x0;_0xa2e5da[_0x7c3ce9]['outboundRejectCallsDay']=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x38')]=0x0;_0xa2e5da[_0x7c3ce9]['outboundAnswerAgiCallsDay']=0x0;_0xa2e5da[_0x7c3ce9][_0x39bf('0x39')]=0x0;_0xa2e5da[_0x7c3ce9]['queueStatusComplete']=!![];}}}}Realtime[_0x39bf('0x3a')][_0x39bf('0x3b')]=function(_0x54685a,_0x1f8e3c){for(var _0x1c3ef2 in _0x1f8e3c){if(_0x54685a[_0x39bf('0x25')](_0x1c3ef2)){_0x54685a[_0x1c3ef2]=_0x1f8e3c[_0x1c3ef2];}}};Realtime[_0x39bf('0x3a')]['initAgents']=function(){var _0x54d0de=this;return function(_0x39f25f){if(_0x39f25f){freeIsNotKeyAgent(_0x39f25f,_0x54d0de['agents']);for(var _0x30abfd=0x0,_0x30c035={},_0x3c0874={};_0x30abfd<_0x39f25f[_0x39bf('0x3c')];_0x30abfd+=0x1){_0x30c035=_0x39f25f[_0x30abfd];var _0x54f0d6=_[_0x39bf('0x29')](_0x30c035[_0x39bf('0x2a')])?util[_0x39bf('0x26')](_0x39bf('0x27'),_0x30c035[_0x39bf('0x28')]):_0x30c035[_0x39bf('0x2a')];if(_['isUndefined'](_0x54d0de[_0x39bf('0x13')][_0x54f0d6])){_0x54d0de[_0x39bf('0x13')][_0x54f0d6]=new Agent(_0x30c035);}else{_0x54d0de[_0x39bf('0x3b')](_0x54d0de[_0x39bf('0x13')][_0x54f0d6],_0x30c035);}}}return _0x54d0de[_0x39bf('0x13')];};};Realtime['prototype'][_0x39bf('0x3d')]=function(){var _0x1a24f5=this;return function(_0x4b854b){if(_0x4b854b){freeIsNotKeySip(_0x4b854b,_0x1a24f5[_0x39bf('0x3e')]);for(var _0x3d6c2a=0x0,_0x5d3d80={},_0x54a7da={};_0x3d6c2a<_0x4b854b['length'];_0x3d6c2a+=0x1){_0x5d3d80=_0x4b854b[_0x3d6c2a];if(_['isUndefined'](_0x1a24f5['telephones'][util[_0x39bf('0x26')](_0x39bf('0x27'),_0x5d3d80[_0x39bf('0x28')])])){_0x1a24f5[_0x39bf('0x3e')][util[_0x39bf('0x26')](_0x39bf('0x27'),_0x5d3d80[_0x39bf('0x28')])]=new Telephone(_0x5d3d80);}else{_0x1a24f5[_0x39bf('0x3b')](_0x1a24f5[_0x39bf('0x3e')][util[_0x39bf('0x26')](_0x39bf('0x27'),_0x5d3d80[_0x39bf('0x28')])],_0x5d3d80);}}}return _0x1a24f5['telephones'];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x3f')]=function(){var _0x54122f=this;return function(_0x47681a){if(_0x47681a){freeIsNotKeySip(_0x47681a,_0x54122f['trunks']);for(var _0xfeb34e=0x0,_0x40a594={},_0xbf4638={};_0xfeb34e<_0x47681a['length'];_0xfeb34e+=0x1){_0x40a594=_0x47681a[_0xfeb34e];if(_['isUndefined'](_0x54122f[_0x39bf('0x14')][util[_0x39bf('0x26')](_0x39bf('0x27'),_0x40a594[_0x39bf('0x28')])])){_0x54122f[_0x39bf('0x14')][util[_0x39bf('0x26')](_0x39bf('0x27'),_0x40a594[_0x39bf('0x28')])]=new Trunk(_0x40a594);}else{_0x54122f[_0x39bf('0x3b')](_0x54122f['trunks'][util[_0x39bf('0x26')]('SIP/%s',_0x40a594[_0x39bf('0x28')])],_0x40a594);}}}return _0x54122f[_0x39bf('0x14')];};};Realtime[_0x39bf('0x3a')]['initVoiceQueues']=function(){var _0x3791b4=this;return function(_0x13c317){if(_0x13c317){freeIsNotKey(_0x13c317,_0x3791b4[_0x39bf('0x15')],_0x39bf('0x28'));for(var _0x4cd837=0x0,_0x2c9854={},_0x249ed4={};_0x4cd837<_0x13c317[_0x39bf('0x3c')];_0x4cd837+=0x1){_0x2c9854=_0x13c317[_0x4cd837];if(_[_0x39bf('0x40')](_0x3791b4[_0x39bf('0x15')][_0x2c9854[_0x39bf('0x28')]])){_0x3791b4['voiceQueues'][_0x2c9854[_0x39bf('0x28')]]=new VoiceQueue(_0x2c9854);}else{_0x3791b4[_0x39bf('0x3b')](_0x3791b4['voiceQueues'][_0x2c9854[_0x39bf('0x28')]],_0x2c9854);}}}return _0x3791b4['voiceQueues'];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x41')]=function(){var _0x262181=this;return function(_0x222994){if(_0x222994){freeIsNotKey(_0x222994,_0x262181[_0x39bf('0x16')],'id');for(var _0x2f5b11=0x0,_0x316e77={},_0x2fe145={};_0x2f5b11<_0x222994[_0x39bf('0x3c')];_0x2f5b11+=0x1){_0x316e77=_0x222994[_0x2f5b11];if(_[_0x39bf('0x40')](_0x262181[_0x39bf('0x16')][_0x316e77['id']])){_0x262181[_0x39bf('0x16')][_0x316e77['id']]=new Trigger(_0x316e77);}else{_0x262181['mergeFromDatabase'](_0x262181[_0x39bf('0x16')][_0x316e77['id']],_0x316e77);}}}return _0x262181[_0x39bf('0x16')];};};Realtime['prototype'][_0x39bf('0x42')]=function(){var _0x2dea8f=this;return function(_0x1a18e1){if(_0x1a18e1){freeIsNotKey(_0x1a18e1,_0x2dea8f[_0x39bf('0x43')],'id');for(var _0xa00806=0x0,_0x143a67={},_0x4512d7={};_0xa00806<_0x1a18e1['length'];_0xa00806+=0x1){_0x143a67=_0x1a18e1[_0xa00806];if(_[_0x39bf('0x40')](_0x2dea8f[_0x39bf('0x43')][_0x143a67['id']])){_0x2dea8f[_0x39bf('0x43')][_0x143a67['id']]=new Template(_0x143a67);}else{_0x2dea8f['mergeFromDatabase'](_0x2dea8f['templates'][_0x143a67['id']],_0x143a67);}}}return _0x2dea8f['templates'];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x44')]=function(){var _0x2055d8=this;return function(_0x450948){if(_0x450948){freeIsNotKey(_0x450948,_0x2055d8['zendeskAccounts'],'id');for(var _0x3e7917=0x0,_0x2590cd={},_0x35b70c={};_0x3e7917<_0x450948[_0x39bf('0x3c')];_0x3e7917+=0x1){_0x2590cd=_0x450948[_0x3e7917];if(_[_0x39bf('0x40')](_0x2055d8[_0x39bf('0x45')][_0x2590cd['id']])){_0x2055d8[_0x39bf('0x45')][_0x2590cd['id']]=new ZendeskAccount(_0x2590cd);}else{_0x2055d8[_0x39bf('0x3b')](_0x2055d8[_0x39bf('0x45')][_0x2590cd['id']],_0x2590cd);}}}return _0x2055d8[_0x39bf('0x45')];};};Realtime['prototype'][_0x39bf('0x46')]=function(){var _0x4fb7b7=this;return function(_0x26231f){if(_0x26231f){freeIsNotKey(_0x26231f,_0x4fb7b7[_0x39bf('0x47')],'id');for(var _0x1d71ad=0x0,_0x10a900={},_0x357aa8={};_0x1d71ad<_0x26231f['length'];_0x1d71ad+=0x1){_0x10a900=_0x26231f[_0x1d71ad];if(_[_0x39bf('0x40')](_0x4fb7b7[_0x39bf('0x47')][_0x10a900['id']])){_0x4fb7b7[_0x39bf('0x47')][_0x10a900['id']]=new SalesforceAccount(_0x10a900);}else{_0x4fb7b7[_0x39bf('0x3b')](_0x4fb7b7[_0x39bf('0x47')][_0x10a900['id']],_0x10a900);}}}return _0x4fb7b7['salesforceAccounts'];};};Realtime[_0x39bf('0x3a')]['initFreshdeskAccounts']=function(){var _0x27dc6e=this;return function(_0xe85576){if(_0xe85576){freeIsNotKey(_0xe85576,_0x27dc6e[_0x39bf('0x1f')],'id');for(var _0x4b5022=0x0,_0x5b6778={},_0x31742d={};_0x4b5022<_0xe85576[_0x39bf('0x3c')];_0x4b5022+=0x1){_0x5b6778=_0xe85576[_0x4b5022];if(_[_0x39bf('0x40')](_0x27dc6e['freshdeskAccounts'][_0x5b6778['id']])){_0x27dc6e[_0x39bf('0x1f')][_0x5b6778['id']]=new FreshdeskAccount(_0x5b6778);}else{_0x27dc6e['mergeFromDatabase'](_0x27dc6e['freshdeskAccounts'][_0x5b6778['id']],_0x5b6778);}}}return _0x27dc6e['freshdeskAccounts'];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x48')]=function(){var _0x3020e3=this;return function(_0x5cf43b){if(_0x5cf43b){freeIsNotKey(_0x5cf43b,_0x3020e3[_0x39bf('0x20')],'id');for(var _0x1055c9=0x0,_0x4f75d5={},_0x40db48={};_0x1055c9<_0x5cf43b[_0x39bf('0x3c')];_0x1055c9+=0x1){_0x4f75d5=_0x5cf43b[_0x1055c9];if(_[_0x39bf('0x40')](_0x3020e3[_0x39bf('0x20')][_0x4f75d5['id']])){_0x3020e3[_0x39bf('0x20')][_0x4f75d5['id']]=new ZohoAccount(_0x4f75d5);}else{_0x3020e3[_0x39bf('0x3b')](_0x3020e3['zohoAccounts'][_0x4f75d5['id']],_0x4f75d5);}}}return _0x3020e3[_0x39bf('0x20')];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x49')]=function(){var _0x3473e7=this;return function(_0x2d3915){if(_0x2d3915){freeIsNotKey(_0x2d3915,_0x3473e7['deskAccounts'],'id');for(var _0x2b536c=0x0,_0x3f63ca={},_0x1432ce={};_0x2b536c<_0x2d3915[_0x39bf('0x3c')];_0x2b536c+=0x1){_0x3f63ca=_0x2d3915[_0x2b536c];if(_[_0x39bf('0x40')](_0x3473e7[_0x39bf('0x21')][_0x3f63ca['id']])){_0x3473e7['deskAccounts'][_0x3f63ca['id']]=new DeskAccount(_0x3f63ca);}else{_0x3473e7[_0x39bf('0x3b')](_0x3473e7[_0x39bf('0x21')][_0x3f63ca['id']],_0x3f63ca);}}}return _0x3473e7[_0x39bf('0x21')];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x4a')]=function(){var _0x394b1f=this;return function(_0x351336){if(_0x351336){freeIsNotKey(_0x351336,_0x394b1f[_0x39bf('0x4b')],'id');for(var _0x5654c4=0x0,_0x5f3d11={},_0x5183bb={};_0x5654c4<_0x351336[_0x39bf('0x3c')];_0x5654c4+=0x1){_0x5f3d11=_0x351336[_0x5654c4];if(_[_0x39bf('0x40')](_0x394b1f['sugarcrmAccounts'][_0x5f3d11['id']])){_0x394b1f[_0x39bf('0x4b')][_0x5f3d11['id']]=new SugarcrmAccount(_0x5f3d11);}else{_0x394b1f[_0x39bf('0x3b')](_0x394b1f[_0x39bf('0x4b')][_0x5f3d11['id']],_0x5f3d11);}}}return _0x394b1f[_0x39bf('0x4b')];};};Realtime[_0x39bf('0x3a')][_0x39bf('0x4c')]=function(){var _0x5112c6=this;return function(_0x49bf6b){if(_0x49bf6b){freeIsNotKey(_0x49bf6b,_0x5112c6[_0x39bf('0x4d')],'id');for(var _0x42974b=0x0,_0xfabf59={},_0x2bcb0a={};_0x42974b<_0x49bf6b[_0x39bf('0x3c')];_0x42974b+=0x1){_0xfabf59=_0x49bf6b[_0x42974b];if(_[_0x39bf('0x40')](_0x5112c6['vtigerAccounts'][_0xfabf59['id']])){_0x5112c6[_0x39bf('0x4d')][_0xfabf59['id']]=new VtigerAccount(_0xfabf59);}else{_0x5112c6[_0x39bf('0x3b')](_0x5112c6['vtigerAccounts'][_0xfabf59['id']],_0xfabf59);}}}return _0x5112c6[_0x39bf('0x4d')];};};Realtime[_0x39bf('0x3a')]['initServicenowAccounts']=function(){var _0x1fb121=this;return function(_0x5e56d8){if(_0x5e56d8){freeIsNotKey(_0x5e56d8,_0x1fb121[_0x39bf('0x22')],'id');for(var _0x516da=0x0,_0x5f0036={},_0x44f868={};_0x516da<_0x5e56d8[_0x39bf('0x3c')];_0x516da+=0x1){_0x5f0036=_0x5e56d8[_0x516da];if(_[_0x39bf('0x40')](_0x1fb121[_0x39bf('0x22')][_0x5f0036['id']])){_0x1fb121[_0x39bf('0x22')][_0x5f0036['id']]=new ServicenowAccount(_0x5f0036);}else{_0x1fb121[_0x39bf('0x3b')](_0x1fb121[_0x39bf('0x22')][_0x5f0036['id']],_0x5f0036);}}}return _0x1fb121[_0x39bf('0x22')];};};Realtime[_0x39bf('0x3a')]['initDynamics365Accounts']=function(){var _0x2172b3=this;return function(_0x15fd8b){if(_0x15fd8b){freeIsNotKey(_0x15fd8b,_0x2172b3[_0x39bf('0x4e')],'id');for(var _0x58bd74=0x0,_0x925854={},_0x583232={};_0x58bd74<_0x15fd8b[_0x39bf('0x3c')];_0x58bd74+=0x1){_0x925854=_0x15fd8b[_0x58bd74];if(_['isUndefined'](_0x2172b3[_0x39bf('0x4e')][_0x925854['id']])){_0x2172b3[_0x39bf('0x4e')][_0x925854['id']]=new Dynamics365Account(_0x925854);}else{_0x2172b3['mergeFromDatabase'](_0x2172b3[_0x39bf('0x4e')][_0x925854['id']],_0x925854);}}}return _0x2172b3[_0x39bf('0x4e')];};};Realtime['prototype'][_0x39bf('0x4f')]=function(){var _0x14b0e0=this;return function(_0x575a07){if(_0x575a07){freeIsNotKey(_0x575a07,_0x14b0e0[_0x39bf('0x23')],'id');for(var _0xa0bcc8=0x0,_0x3b243d={},_0x446c0e={};_0xa0bcc8<_0x575a07[_0x39bf('0x3c')];_0xa0bcc8+=0x1){_0x3b243d=_0x575a07[_0xa0bcc8];if(_[_0x39bf('0x40')](_0x14b0e0['freshsalesAccounts'][_0x3b243d['id']])){_0x14b0e0[_0x39bf('0x23')][_0x3b243d['id']]=new FreshsalesAccount(_0x3b243d);}else{_0x14b0e0[_0x39bf('0x3b')](_0x14b0e0['freshsalesAccounts'][_0x3b243d['id']],_0x3b243d);}}}return _0x14b0e0[_0x39bf('0x23')];};};Realtime[_0x39bf('0x3a')]['initVoiceQueueHopperHistory']=function(){var _0x1277ac=this;return function(_0xc30cb9){for(var _0x153bd7=0x0;_0x153bd7<_0xc30cb9[_0x39bf('0x3c')];_0x153bd7+=0x1){_[_0x39bf('0x50')](_0x1277ac[_0x39bf('0x15')][_0xc30cb9[_0x153bd7][_0x39bf('0x28')]],_0xc30cb9[_0x153bd7]);}return _0x1277ac[_0x39bf('0x15')];};};Realtime['prototype'][_0x39bf('0x51')]=function(){var _0x1d4b69=this;return function(_0x32e6af){clearVoiceQueues(_0x1d4b69['voiceQueues']);if(_0x32e6af){_0x32e6af=_['groupBy'](_0x32e6af,_0x39bf('0x52'));for(var _0x4f331f in _0x32e6af){if(_0x32e6af[_0x39bf('0x25')](_0x4f331f)){var _0x11741c={};for(var _0x14effa=0x0;_0x14effa<_0x32e6af[_0x4f331f][_0x39bf('0x3c')];_0x14effa+=0x1){var _0x25c943=_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x53')];if(_0x1d4b69[_0x39bf('0x15')][_0x25c943]){if(_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x54')]){_0x1d4b69[_0x39bf('0x15')][_0x25c943]['unmanaged']+=0x1;}if(_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x55')]){_0x1d4b69[_0x39bf('0x15')][_0x25c943]['abandoned']+=0x1;}_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x2d')]+=moment(_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x56')])['diff'](moment(_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x57')]),_0x39bf('0x58'))||0x0;if(_0x14effa===_0x32e6af[_0x4f331f][_0x39bf('0x3c')]-0x1){_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x2e')]+=moment(_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x59')]||_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x5a')]||_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x5b')])[_0x39bf('0x5c')](moment(_0x32e6af[_0x4f331f][_0x14effa][_0x39bf('0x57')]),_0x39bf('0x58'))||0x0;_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x2b')]+=0x1;if(_0x32e6af[_0x4f331f][_0x14effa]['queuecallercomplete']){_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x2c')]+=0x1;_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x5d')]+=moment(_0x32e6af[_0x4f331f][_0x14effa]['queuecallercompleteAt'])[_0x39bf('0x5c')](moment(_0x32e6af[_0x4f331f][_0x14effa]['queuecallerleaveAt']),_0x39bf('0x58'))||0x0;}}else{_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x2e')]+=_0x1d4b69[_0x39bf('0x15')][_0x25c943][_0x39bf('0x2d')]||0x0;}}}}}}return _0x1d4b69[_0x39bf('0x15')];};};Realtime[_0x39bf('0x3a')]['initVoiceCallReports']=function(){var _0x1ce8dc=this;return function(_0x26e838){clearVoiceCallReports(_0x1ce8dc['outbound']);if(_0x26e838){for(var _0x205126=0x0;_0x205126<_0x26e838[_0x39bf('0x3c')];_0x205126+=0x1){_0x1ce8dc[_0x39bf('0x18')]['total']+=0x1;_0x1ce8dc[_0x39bf('0x18')]['sumDuration']+=_0x26e838[_0x205126][_0x39bf('0x5e')];if(_0x26e838[_0x205126][_0x39bf('0x5f')]===_0x39bf('0x60')){_0x1ce8dc[_0x39bf('0x18')]['answered']+=0x1;_0x1ce8dc[_0x39bf('0x18')][_0x39bf('0x2d')]+=_0x26e838[_0x205126]['duration']-_0x26e838[_0x205126]['billableseconds']||0x0;_0x1ce8dc[_0x39bf('0x18')][_0x39bf('0x5d')]+=_0x26e838[_0x205126][_0x39bf('0x61')];}}}return _0x1ce8dc[_0x39bf('0x18')];};};Realtime[_0x39bf('0x3a')]['initCampaigns']=function(){var _0x2b1429=this;return function(_0xfabbe){if(_0xfabbe){freeIsNotKey(_0xfabbe,_0x2b1429[_0x39bf('0x17')],_0x39bf('0x28'));for(var _0x2899ae=0x0,_0x425d7a={};_0x2899ae<_0xfabbe[_0x39bf('0x3c')];_0x2899ae+=0x1){_0x425d7a=_0xfabbe[_0x2899ae];if(_[_0x39bf('0x40')](_0x2b1429[_0x39bf('0x17')][_0x425d7a[_0x39bf('0x28')]])){_0x2b1429['campaigns'][_0x425d7a[_0x39bf('0x28')]]=new Campaign(_0x425d7a);}else{_0x2b1429[_0x39bf('0x3b')](_0x2b1429[_0x39bf('0x17')][_0x425d7a['name']],_0x425d7a);_0x2b1429[_0x39bf('0x17')][_0x425d7a[_0x39bf('0x28')]][_0x39bf('0x62')]=_0x425d7a[_0x39bf('0x63')]?_0x425d7a[_0x39bf('0x63')][_0x39bf('0x28')]:undefined;}}}return _0x2b1429[_0x39bf('0x17')];};};Realtime[_0x39bf('0x3a')]['initVoiceExtensions']=function(){var _0x2bf2fe=this;return function(_0x441afb){if(_0x441afb){freeIsNotKey(_0x441afb,_0x2bf2fe[_0x39bf('0x19')],'id');for(var _0x3342c2=0x0,_0x297f7a={};_0x3342c2<_0x441afb[_0x39bf('0x3c')];_0x3342c2+=0x1){_0x297f7a=_0x441afb[_0x3342c2];if(_[_0x39bf('0x40')](_0x2bf2fe[_0x39bf('0x19')][_0x297f7a['id']])){_0x2bf2fe[_0x39bf('0x19')][_0x297f7a['id']]=new VoiceExtension(_0x297f7a);}else{_0x2bf2fe[_0x39bf('0x3b')](_0x2bf2fe['voiceExtensions'][_0x297f7a['id']],_0x297f7a);}}}return _0x2bf2fe['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x49100c=this;return function(_0x467e5d){clearCampaigns(_0x49100c[_0x39bf('0x17')]);for(var _0x2734eb=0x0;_0x2734eb<_0x467e5d[_0x39bf('0x3c')];_0x2734eb+=0x1){_[_0x39bf('0x50')](_0x49100c[_0x39bf('0x17')][_0x467e5d[_0x2734eb]['name']],_0x467e5d[_0x2734eb]);}return _0x49100c[_0x39bf('0x17')];};};Realtime['prototype'][_0x39bf('0x64')]=function(){var _0x712440=this;return function(_0x28f8ab){if(_0x28f8ab){freeIsNotKey(_0x28f8ab,_0x712440['faxAccounts'],'id');for(var _0x2ea332=0x0,_0x366479={},_0x8d18d7={};_0x2ea332<_0x28f8ab[_0x39bf('0x3c')];_0x2ea332+=0x1){_0x366479=_0x28f8ab[_0x2ea332];if(_['isUndefined'](_0x712440[_0x39bf('0x65')][_0x366479['id']])){_0x712440[_0x39bf('0x65')][_0x366479['id']]=new FaxAccount(_0x366479);}else{_0x712440[_0x39bf('0x3b')](_0x712440['faxAccounts'][_0x366479['id']],_0x366479);}}}return _0x712440[_0x39bf('0x65')];};};module[_0x39bf('0x66')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e2a11b4..067abf2 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 _0x22dc=['queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','calleridpreview','originatecalleridnum','destinationchannel','callerid','disposition','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','membername','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','format','name','length','lastAssignedTo','isNil','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x598ec0,_0x3a55fa){var _0xfa9f44=function(_0x4dbfe5){while(--_0x4dbfe5){_0x598ec0['push'](_0x598ec0['shift']());}};_0xfa9f44(++_0x3a55fa);}(_0x22dc,0x199));var _0xc22d=function(_0x53f338,_0x33d378){_0x53f338=_0x53f338-0x0;var _0x5cdd92=_0x22dc[_0x53f338];return _0x5cdd92;};'use strict';var _=require(_0xc22d('0x0'));var moment=require(_0xc22d('0x1'));var util=require(_0xc22d('0x2'));var config=require('../../../config/environment');var ami=require(_0xc22d('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc22d('0x4'));var RpcMemberReport=require(_0xc22d('0x5'));var RpcVoiceQueueReport=require(_0xc22d('0x6'));var RpcVoiceRecording=require(_0xc22d('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xc22d('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc22d('0x9'));var VoiceDialReport=require(_0xc22d('0xa'));var UserReport=require(_0xc22d('0xb'));function Report(_0x1ba690){this[_0xc22d('0xc')]=_0x1ba690;this[_0xc22d('0xd')]=_0x1ba690[_0xc22d('0xd')];this[_0xc22d('0xe')]=_0x1ba690[_0xc22d('0xe')];}Report[_0xc22d('0xf')][_0xc22d('0x10')]=function(_0x534155){var _0x3b4c45=new VoiceQueueReport(this[_0xc22d('0xc')]);var _0xcc08e7=new VoiceAgentReport(this[_0xc22d('0xc')]);var _0x1aaf31=new VoiceDialReport(this[_0xc22d('0xc')]);var _0x29e3e6=new VoiceCallReport(this['realtime']);var _0x2dc4aa=new UserReport(this[_0xc22d('0xc')]);if(config[_0xc22d('0x11')]&&config[_0xc22d('0x11')]['disabled']){ami['on'](_0xc22d('0x12'),this[_0xc22d('0x13')][_0xc22d('0x14')](this));ami['on'](_0xc22d('0x15'),this[_0xc22d('0x16')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xc22d('0x17')]['bind'](this));ami['on'](_0xc22d('0x18'),this[_0xc22d('0x19')][_0xc22d('0x14')](this));ami['on'](_0xc22d('0x1a'),this[_0xc22d('0x1b')][_0xc22d('0x14')](this));ami['on'](_0xc22d('0x1c'),this[_0xc22d('0x1d')][_0xc22d('0x14')](this));}};Report[_0xc22d('0xf')][_0xc22d('0x1e')]=function(_0x1ffe30){var _0x1872fb;_0x1872fb=_[_0xc22d('0x1f')](this[_0xc22d('0xd')],function(_0x12a36b){return _0x12a36b[_0xc22d('0x20')]==_0x1ffe30||_0x12a36b['name']==_0x1ffe30;});if(_['isNil'](_0x1872fb)){var _0x5b53eb=_[_0xc22d('0x1f')](this['telephones'],function(_0x32cf3e){return _0x32cf3e[_0xc22d('0x20')]==_0x1ffe30||_0x32cf3e['name']==_0x1ffe30;});if(_0x5b53eb){_0x1872fb=_[_0xc22d('0x1f')](this[_0xc22d('0xd')],function(_0x2df361){return _0x2df361['interface']==util[_0xc22d('0x21')]('SIP/%s',_0x5b53eb[_0xc22d('0x22')]);});}}return _0x1872fb;};Report['prototype'][_0xc22d('0x13')]=function(_0x2b0703){for(var _0x187d2a=0x0;_0x187d2a<_0x2b0703[_0xc22d('0x23')];_0x187d2a+=0x1){var _0x2e478e=this[_0xc22d('0x1e')](_0x2b0703[_0x187d2a]['connectedlinenum']);if(_0x2e478e){_0x2b0703[_0x187d2a][_0xc22d('0x20')]=_0x2e478e[_0xc22d('0x20')];_0x2b0703[_0x187d2a]['assigned']=!![];_0x2b0703[_0x187d2a][_0xc22d('0x24')]=_0x2e478e[_0xc22d('0x22')];_0x2b0703[_0x187d2a]['interface']=_[_0xc22d('0x25')](_0x2e478e[_0xc22d('0x26')])?util['format']('SIP/%s',_0x2e478e[_0xc22d('0x22')]):_0x2e478e[_0xc22d('0x26')];if(_0x2b0703[_0x187d2a][_0xc22d('0x27')]){_0x2b0703[_0x187d2a]['queuecallercompleteAt']=moment()[_0xc22d('0x21')](_0xc22d('0x28'));}if(_0x2b0703[_0x187d2a][_0xc22d('0x29')]){_0x2b0703[_0x187d2a][_0xc22d('0x2a')]=moment()[_0xc22d('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x2b0703[_0x187d2a]);}RpcVoiceQueueReport[_0xc22d('0x2b')](_0x2b0703[_0x187d2a]);}};function extractCalleridNumber(_0x4b020d){var _0x53fc60=_0x4b020d['match'](/<(.*?)>/);return _0x53fc60?_0x53fc60[0x1]:_0x4b020d;}Report[_0xc22d('0xf')][_0xc22d('0x2c')]=function(_0x4f0816){for(var _0x2d64e7=0x0;_0x2d64e7',_0x1ac742[_0xc22d('0x42')],_0x1ac742[_0xc22d('0x30')]);}if(RpcVoiceTransferReport[_0xc22d('0x43')][_0x1ac742['linkedid']]){var _0x380313=RpcVoiceTransferReport[_0xc22d('0x43')][_0x1ac742[_0xc22d('0x44')]];_0x380313[_0xc22d('0x45')]=_0x1ac742[_0xc22d('0x46')];RpcVoiceTransferReport[_0xc22d('0x1b')](_0x380313);delete RpcVoiceTransferReport[_0xc22d('0x43')][_0x1ac742[_0xc22d('0x44')]];}if(_[_0xc22d('0x25')](_0x1ac742[_0xc22d('0x47')])){_0x1ac742['type']=this['getCallType'](_0x1ac742);}if(_[_0xc22d('0x25')](_0x1ac742['UserId'])){var _0x5c5ec3=_0x1ac742['channel'][_0xc22d('0x2f')]('-')[0x0];var _0x1cde98=this[_0xc22d('0xd')][_0x5c5ec3];if(!_0x1cde98)_0x1cde98=this[_0xc22d('0x2c')](_0x1ac742[_0xc22d('0x20')]);if(_0x1cde98){_0x1ac742['UserId']=_0x1cde98['id'];_0x1ac742[_0xc22d('0x48')]=_0x1cde98['name'];}}RpcVoiceCallReport[_0xc22d('0x2b')](_0x1ac742);if(_0x1ac742['monitor']){for(var _0x1db2ca=0x0;_0x1db2ca<_0x1ac742[_0xc22d('0x49')]['length'];_0x1db2ca+=0x1){_0x1ac742[_0xc22d('0x4a')]=_0x1ac742['monitors'][_0x1db2ca][_0xc22d('0x4b')];_0x1ac742[_0xc22d('0x4c')]=_0x1ac742['monitors'][_0x1db2ca][_0xc22d('0x4c')];if(_0x1ac742['exten']==_0xc22d('0x4d')){_0x1ac742['calleridnum']=_0x1ac742[_0xc22d('0x41')];_0x1ac742[_0xc22d('0x42')]=_0x1ac742['connectedlinename'];_0x1ac742[_0xc22d('0x41')]=_0x1ac742[_0xc22d('0x20')];_0x1ac742[_0xc22d('0x4e')]=_0x1ac742['membername'];_0x1ac742[_0xc22d('0x34')]=_0x1ac742['originatecalleridnum'];}else if(_0x1ac742['exten']=='xcally-motion-dialer'){_0x1ac742[_0xc22d('0x30')]=_0x1ac742[_0xc22d('0x33')];_0x1ac742[_0xc22d('0x34')]=_0x1ac742[_0xc22d('0x3c')];}RpcVoiceRecording[_0xc22d('0x2b')](_0x1ac742);}}};Report[_0xc22d('0xf')][_0xc22d('0x17')]=function(_0x153a1f){if(_[_0xc22d('0x4f')](_0x153a1f)){_0x153a1f[_0xc22d('0x50')](function(_0x22194d){RpcVoiceAgentReport['create'](_0x22194d);});}else{RpcVoiceAgentReport[_0xc22d('0x2b')](_0x153a1f);}};Report[_0xc22d('0xf')][_0xc22d('0x19')]=function(_0x15fa14){RpcVoiceDialReport[_0xc22d('0x2b')](_0x15fa14);var _0x245a90;var _0x38fcc1;var _0xc34d09=_0x15fa14[_0xc22d('0x2e')];if(_[_0xc22d('0x51')](_0xc34d09,_0xc22d('0x52'))){_0x38fcc1=_0xc34d09[_0xc22d('0x53')](_0xc34d09[_0xc22d('0x54')]('/')+0x1,_0xc34d09[_0xc22d('0x54')]('@'));_0x245a90=_['find'](this[_0xc22d('0xd')],function(_0x1d17d5){return _0x1d17d5[_0xc22d('0x55')]==_0x38fcc1||_0x1d17d5[_0xc22d('0x56')]==_0x38fcc1||_0x1d17d5['accountcode']==_0x38fcc1;});}else{_0x38fcc1=_0xc34d09[_0xc22d('0x53')](_0xc34d09[_0xc22d('0x54')]('/')+0x1,_0xc34d09[_0xc22d('0x57')]('-'));_0x245a90=this[_0xc22d('0x1e')](_0x38fcc1);}if(_0x245a90){_0x15fa14[_0xc22d('0x26')]=_['isNil'](_0x245a90[_0xc22d('0x26')])?util[_0xc22d('0x21')]('SIP/%s',_0x245a90[_0xc22d('0x22')]):_0x245a90['interface'];_0x15fa14[_0xc22d('0x48')]=_0x245a90['name'];_0x15fa14[_0xc22d('0x20')]=_0x245a90[_0xc22d('0x20')];RpcMemberReport[_0xc22d('0x19')](_0x15fa14);}};Report[_0xc22d('0xf')][_0xc22d('0x1b')]=function(_0x452ef1){RpcVoiceTransferReport[_0xc22d('0x43')][_0x452ef1[_0xc22d('0x58')]]=_0x452ef1;};Report[_0xc22d('0xf')][_0xc22d('0x1d')]=function(_0x5da085){RpcVoiceTransferReport['attendedTransfer'](_0x5da085);};module[_0xc22d('0x59')]=Report; \ No newline at end of file +var _0x8f8b=['name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode'];(function(_0x92194b,_0x4ab522){var _0xc29e4e=function(_0x2ead75){while(--_0x2ead75){_0x92194b['push'](_0x92194b['shift']());}};_0xc29e4e(++_0x4ab522);}(_0x8f8b,0x150));var _0xb8f8=function(_0x386fcb,_0x5c5136){_0x386fcb=_0x386fcb-0x0;var _0x43c8f1=_0x8f8b[_0x386fcb];return _0x43c8f1;};'use strict';var _=require('lodash');var moment=require(_0xb8f8('0x0'));var util=require('util');var config=require(_0xb8f8('0x1'));var ami=require(_0xb8f8('0x2'));var RpcVoiceAgentReport=require(_0xb8f8('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xb8f8('0x4'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xb8f8('0x5'));var VoiceQueueReport=require(_0xb8f8('0x6'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xb8f8('0x7'));var VoiceDialReport=require(_0xb8f8('0x8'));var UserReport=require(_0xb8f8('0x9'));function Report(_0x284939){this['realtime']=_0x284939;this[_0xb8f8('0xa')]=_0x284939[_0xb8f8('0xa')];this[_0xb8f8('0xb')]=_0x284939[_0xb8f8('0xb')];}Report[_0xb8f8('0xc')][_0xb8f8('0xd')]=function(_0x1ea37e){var _0x120742=new VoiceQueueReport(this['realtime']);var _0x5cad52=new VoiceAgentReport(this['realtime']);var _0x14e321=new VoiceDialReport(this[_0xb8f8('0xe')]);var _0x148300=new VoiceCallReport(this[_0xb8f8('0xe')]);var _0x5cc1fc=new UserReport(this[_0xb8f8('0xe')]);if(config['xdr']&&config['xdr'][_0xb8f8('0xf')]){ami['on'](_0xb8f8('0x10'),this[_0xb8f8('0x11')][_0xb8f8('0x12')](this));ami['on'](_0xb8f8('0x13'),this[_0xb8f8('0x14')][_0xb8f8('0x12')](this));ami['on'](_0xb8f8('0x15'),this[_0xb8f8('0x16')][_0xb8f8('0x12')](this));ami['on'](_0xb8f8('0x17'),this[_0xb8f8('0x18')][_0xb8f8('0x12')](this));ami['on'](_0xb8f8('0x19'),this[_0xb8f8('0x1a')][_0xb8f8('0x12')](this));ami['on'](_0xb8f8('0x1b'),this[_0xb8f8('0x1c')][_0xb8f8('0x12')](this));}};Report[_0xb8f8('0xc')][_0xb8f8('0x1d')]=function(_0x14232c){var _0x808ddb;_0x808ddb=_[_0xb8f8('0x1e')](this[_0xb8f8('0xa')],function(_0x3783ff){return _0x3783ff[_0xb8f8('0x1f')]==_0x14232c||_0x3783ff[_0xb8f8('0x20')]==_0x14232c;});if(_['isNil'](_0x808ddb)){var _0x2794ea=_[_0xb8f8('0x1e')](this['telephones'],function(_0x2cc2c3){return _0x2cc2c3[_0xb8f8('0x1f')]==_0x14232c||_0x2cc2c3['name']==_0x14232c;});if(_0x2794ea){_0x808ddb=_[_0xb8f8('0x1e')](this['agents'],function(_0x778372){return _0x778372[_0xb8f8('0x21')]==util[_0xb8f8('0x22')](_0xb8f8('0x23'),_0x2794ea['name']);});}}return _0x808ddb;};Report[_0xb8f8('0xc')]['voiceQueueReport']=function(_0x169937){for(var _0x4af6d0=0x0;_0x4af6d0<_0x169937[_0xb8f8('0x24')];_0x4af6d0+=0x1){var _0xf95c7e=this[_0xb8f8('0x1d')](_0x169937[_0x4af6d0][_0xb8f8('0x25')]);if(_0xf95c7e){_0x169937[_0x4af6d0][_0xb8f8('0x1f')]=_0xf95c7e[_0xb8f8('0x1f')];_0x169937[_0x4af6d0][_0xb8f8('0x26')]=!![];_0x169937[_0x4af6d0][_0xb8f8('0x27')]=_0xf95c7e[_0xb8f8('0x20')];_0x169937[_0x4af6d0]['interface']=_[_0xb8f8('0x28')](_0xf95c7e[_0xb8f8('0x21')])?util[_0xb8f8('0x22')](_0xb8f8('0x23'),_0xf95c7e[_0xb8f8('0x20')]):_0xf95c7e[_0xb8f8('0x21')];if(_0x169937[_0x4af6d0][_0xb8f8('0x29')]){_0x169937[_0x4af6d0]['queuecallercompleteAt']=moment()[_0xb8f8('0x22')](_0xb8f8('0x2a'));}if(_0x169937[_0x4af6d0][_0xb8f8('0x2b')]){_0x169937[_0x4af6d0][_0xb8f8('0x2c')]=moment()['format'](_0xb8f8('0x2a'));}RpcMemberReport[_0xb8f8('0x11')](_0x169937[_0x4af6d0]);}RpcVoiceQueueReport[_0xb8f8('0x2d')](_0x169937[_0x4af6d0]);}};function extractCalleridNumber(_0x5ae60a){var _0x1c7306=_0x5ae60a[_0xb8f8('0x2e')](/<(.*?)>/);return _0x1c7306?_0x1c7306[0x1]:_0x5ae60a;}Report[_0xb8f8('0xc')][_0xb8f8('0x2f')]=function(_0x5cc1d5){for(var _0x1fc93b=0x0;_0x1fc93b0x0?_0x2b67c2:0x0;this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]][_0xaf9a('0x6e')]=this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]][_0xaf9a('0x6e')]>_[_0xaf9a('0x6d')](_0x107590['loggedin'])?_['toNumber'](_0x107590['loggedin']):this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]][_0xaf9a('0x6e')];this[_0xaf9a('0x4f')](this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]],_0xaf9a('0x16'));}logger[_0xaf9a('0x45')](_0xaf9a('0x6f'),util[_0xaf9a('0x3d')](this[_0xaf9a('0x12')][_0x107590[_0xaf9a('0x67')]],{'showHidden':![],'depth':null}));ami[_0xaf9a('0x43')](_0xaf9a('0x70'),this[_0xaf9a('0x12')][_0x107590['queue']]);}}}catch(_0xfb790a){logger[_0xaf9a('0x3b')](_0xaf9a('0x71'),util[_0xaf9a('0x3d')](_0xfb790a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf9a('0x19')]=function(_0x1aba97){logger[_0xaf9a('0x45')](_0xaf9a('0x72'),util[_0xaf9a('0x3d')](_0x1aba97,{'showHidden':![],'depth':null}));this[_0xaf9a('0x13')]=!![];};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0x1b')]=function(_0x287b8e){try{if(this['isNotNull'](_0x287b8e)){logger[_0xaf9a('0x45')](_0xaf9a('0x73'),_0x287b8e[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x287b8e,{'showHidden':![],'depth':null}));if(_[_0xaf9a('0x74')](this[_0xaf9a('0xe')][_0x287b8e[_0xaf9a('0x48')]]))this['queueReports'][_0x287b8e[_0xaf9a('0x48')]]=[];if(_['isUndefined'](this['channels'][_0x287b8e[_0xaf9a('0x48')]]))this['channels'][_0x287b8e[_0xaf9a('0x48')]]={};var _0x17c220=new QueueReport();_0x17c220['name']=_0x287b8e[_0xaf9a('0x67')];_0x17c220[_0xaf9a('0x58')]=this[_0xaf9a('0x12')][_0x17c220[_0xaf9a('0x4d')]]&&this[_0xaf9a('0x12')][_0x17c220['name']][_0xaf9a('0x58')]?this['voiceQueues'][_0x17c220[_0xaf9a('0x4d')]][_0xaf9a('0x58')]||_0xaf9a('0x50'):_0xaf9a('0x50');_0x17c220[_0xaf9a('0x67')]=_0x287b8e['queue'];_0x17c220[_0xaf9a('0x75')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x17c220[_0xaf9a('0x77')]=_0x287b8e['position'];_0x17c220[_0xaf9a('0x78')]=_0x287b8e['count'];_0x17c220['uniqueid']=_0x287b8e[_0xaf9a('0x48')];_0x17c220['routealias']=this[_0xaf9a('0x10')][_0x287b8e[_0xaf9a('0x48')]]['routealias'];logger[_0xaf9a('0x69')](_0xaf9a('0x79'),_0x17c220['name'],_0x17c220[_0xaf9a('0x58')]);_['merge'](_0x17c220,_['pick'](_0x287b8e,_[_0xaf9a('0x7a')](_0x17c220)));this[_0xaf9a('0xe')][_0x287b8e[_0xaf9a('0x48')]][_0xaf9a('0x7b')](_0x17c220);this[_0xaf9a('0x10')][_0x287b8e[_0xaf9a('0x48')]]=_0x17c220;this['emitVoiceQueueChannelSave'](_0x17c220,_0xaf9a('0x1a'));}}catch(_0x92895d){logger[_0xaf9a('0x3b')](_0xaf9a('0x73'),_0x287b8e['uniqueid'],util[_0xaf9a('0x3d')](_0x92895d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf9a('0x7c')]=function(_0x577d45){try{if(this['isNotNull'](_0x577d45)){logger[_0xaf9a('0x45')](_0xaf9a('0x7d'),_0x577d45[_0xaf9a('0x48')],util['inspect'](_0x577d45,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x577d45['uniqueid']]){var _0x4eecfe=_['last'](this['queueReports'][_0x577d45[_0xaf9a('0x48')]]);_0x4eecfe[_0xaf9a('0x7e')]=![];_0x4eecfe[_0xaf9a('0x7f')]=null;_0x4eecfe['holdtime']=_0x577d45[_0xaf9a('0x80')];_0x4eecfe[_0xaf9a('0x81')]=_0x577d45[_0xaf9a('0x81')];_0x4eecfe['queuecallerabandon']=!![];_0x4eecfe[_0xaf9a('0x82')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x4eecfe[_0xaf9a('0x4c')]='ABANDONED';_0x4eecfe['lastAssignedTo']=null;logger[_0xaf9a('0x69')](_0xaf9a('0x83'),_0x4eecfe[_0xaf9a('0x4d')],_0x4eecfe['type']);this[_0xaf9a('0x10')][_0x577d45[_0xaf9a('0x48')]]=_0x4eecfe;this['emitVoiceQueueChannelRemove'](_0x4eecfe,_0xaf9a('0x1c'));}}}catch(_0x520e85){logger[_0xaf9a('0x3b')](_0xaf9a('0x7d'),_0x577d45[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x520e85,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')]['syncQueueCallerLeave']=function(_0x185122){try{if(this[_0xaf9a('0x63')](_0x185122)){logger['debug'](_0xaf9a('0x84'),_0x185122[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x185122,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x185122[_0xaf9a('0x48')]]){var _0x40fbca=_['last'](this[_0xaf9a('0xe')][_0x185122[_0xaf9a('0x48')]]);_0x40fbca['queuecallerleaveAt']=moment()[_0xaf9a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x40fbca[_0xaf9a('0x85')]=_0x185122[_0xaf9a('0x85')];_0x40fbca[_0xaf9a('0x86')]=_0x185122[_0xaf9a('0x86')];logger['info'](_0xaf9a('0x87'),_0x40fbca[_0xaf9a('0x4d')],_0x40fbca[_0xaf9a('0x58')],_0x185122['connectedlinenum'],_0x185122[_0xaf9a('0x86')]);this[_0xaf9a('0x10')][_0x185122[_0xaf9a('0x48')]]=_0x40fbca;this[_0xaf9a('0x44')](_0x40fbca,_0xaf9a('0x88'));}}}catch(_0x48e223){logger['error'](_0xaf9a('0x84'),_0x185122[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x48e223,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0x1f')]=function(_0xa898bb){try{if(this[_0xaf9a('0x63')](_0xa898bb)){logger[_0xaf9a('0x45')]('[%s][voiceQueueReport][agentconnect]',_0xa898bb['uniqueid'],util[_0xaf9a('0x3d')](_0xa898bb,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0xa898bb[_0xaf9a('0x48')]]){var _0x35ff45=_['last'](this[_0xaf9a('0xe')][_0xa898bb[_0xaf9a('0x48')]]);_0x35ff45[_0xaf9a('0x7e')]=!![];_0x35ff45[_0xaf9a('0x4c')]=_0xaf9a('0x89');logger['info'](_0xaf9a('0x8a'),_0x35ff45[_0xaf9a('0x4d')],_0x35ff45[_0xaf9a('0x58')]);}}}catch(_0xb7748e){logger[_0xaf9a('0x3b')]('[%s][voiceQueueReport][agentconnect]',_0xa898bb[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0xb7748e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')]['syncAgentComplete']=function(_0x1f6314){try{if(this[_0xaf9a('0x63')](_0x1f6314)){logger[_0xaf9a('0x45')]('[%s][voiceQueueReport][agentcomplete]',_0x1f6314[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x1f6314,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x1f6314[_0xaf9a('0x48')]]){var _0x4af3a4=_['last'](this['queueReports'][_0x1f6314[_0xaf9a('0x48')]]);_0x4af3a4[_0xaf9a('0x1c')]=![];_0x4af3a4[_0xaf9a('0x82')]=null;_0x4af3a4[_0xaf9a('0x8b')]=!![];_0x4af3a4[_0xaf9a('0x8c')]=_0x1f6314[_0xaf9a('0x8d')];_0x4af3a4[_0xaf9a('0x80')]=_0x1f6314['holdtime'];_0x4af3a4[_0xaf9a('0x7e')]=!![];_0x4af3a4[_0xaf9a('0x8e')]=![];_0x4af3a4[_0xaf9a('0x8f')]=null;if(!_0x4af3a4[_0xaf9a('0x90')]){if(_0x1f6314[_0xaf9a('0x91')]=='transfer'){_0x4af3a4[_0xaf9a('0x4c')]=_0xaf9a('0x92');logger[_0xaf9a('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4af3a4[_0xaf9a('0x4d')],_0x4af3a4[_0xaf9a('0x58')]);}else{if(_[_0xaf9a('0x93')](_0x1f6314['channel']['toLowerCase'](),'local/')){if(this[_0xaf9a('0xe')][_0x1f6314['linkedid']]){var _0x5c15db=_[_0xaf9a('0x94')](this[_0xaf9a('0xe')][_0x1f6314[_0xaf9a('0x95')]]);_0x5c15db[_0xaf9a('0x7e')]=![];_0x5c15db[_0xaf9a('0x8e')]=!![];_0x5c15db[_0xaf9a('0x8f')]=moment(_0x4af3a4['queuecallerjoinAt'])[_0xaf9a('0x96')](_0x1f6314[_0xaf9a('0x80')],_0xaf9a('0x97'))[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x5c15db[_0xaf9a('0x4c')]='FORWARDTRANSFER';_0x5c15db[_0xaf9a('0x90')]=!![];_0x5c15db[_0xaf9a('0x98')]=_0xaf9a('0x99');_0x5c15db[_0xaf9a('0x9a')]=_0x1f6314[_0xaf9a('0x9b')];_0x5c15db[_0xaf9a('0x9c')]=_0x1f6314[_0xaf9a('0x48')];logger[_0xaf9a('0x69')](_0xaf9a('0x9d'),_0x5c15db[_0xaf9a('0x4d')],_0x5c15db['type']);var _0x5eaa95=this['queueReports'][_0x1f6314[_0xaf9a('0x95')]];this[_0xaf9a('0xe')][_0x1f6314['linkedid']]=this['queueReports'][_0x1f6314[_0xaf9a('0x48')]];this[_0xaf9a('0xe')][_0x1f6314['uniqueid']]=_0x5eaa95;}}else{_0x4af3a4[_0xaf9a('0x4c')]=_0xaf9a('0x9e')+_0x1f6314[_0xaf9a('0x91')][_0xaf9a('0x9f')]();logger[_0xaf9a('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x4af3a4[_0xaf9a('0x4d')],_0x4af3a4[_0xaf9a('0x58')],_0x4af3a4[_0xaf9a('0x4c')]);}}}this[_0xaf9a('0x10')][_0x1f6314[_0xaf9a('0x48')]]=_0x4af3a4;this['emitVoiceQueueChannelRemove'](_0x4af3a4,_0xaf9a('0xa0'));}}}catch(_0x517f51){logger[_0xaf9a('0x3b')](_0xaf9a('0xa1'),_0x1f6314[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x517f51,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0x21')]=function(_0x2522b6){try{if(this[_0xaf9a('0x63')](_0x2522b6)){logger['debug']('[%s][voiceQueueReport][varset]',_0x2522b6[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x2522b6,{'showHidden':![],'depth':null}));this[_0xaf9a('0xa2')](_0x2522b6[_0xaf9a('0x48')],_[_0xaf9a('0x7a')](_0x2522b6[_0xaf9a('0xa3')])[0x0],_0x2522b6[_0xaf9a('0xa4')]);if(this[_0xaf9a('0xe')][_0x2522b6[_0xaf9a('0x48')]]){var _0x2006a0=_['last'](this[_0xaf9a('0xe')][_0x2522b6['uniqueid']]);if(_0x2006a0){if(this[_0xaf9a('0x63')](_0x2522b6['variable'])&&this[_0xaf9a('0x63')](_0x2522b6[_0xaf9a('0xa3')]['queuestatus'])){switch(_0x2522b6[_0xaf9a('0xa4')]){case _0xaf9a('0xa5'):_0x2006a0[_0xaf9a('0x8e')]=![];_0x2006a0[_0xaf9a('0x8f')]=null;break;case _0xaf9a('0xa6'):_0x2006a0['lastevent']='timeout';_0x2006a0[_0xaf9a('0x8e')]=!![];_0x2006a0['queuecallerexitAt']=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x2006a0[_0xaf9a('0xa7')]=moment()[_0xaf9a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xaf9a('0x45')](_0xaf9a('0xa8'),_0x2522b6['uniqueid'],util[_0xaf9a('0x3d')](_0x2006a0,{'showHidden':![],'depth':null}));ami[_0xaf9a('0x43')]('custom:timeout',_0x2006a0);break;default:_0x2006a0[_0xaf9a('0x8e')]=!![];_0x2006a0['queuecallerexitAt']=moment()['format'](_0xaf9a('0x76'));_0x2006a0[_0xaf9a('0xa7')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));}_0x2006a0[_0xaf9a('0x1c')]=![];_0x2006a0[_0xaf9a('0x82')]=null;_0x2006a0[_0xaf9a('0x4c')]=_0x2522b6[_0xaf9a('0xa4')];this[_0xaf9a('0x10')][_0x2522b6[_0xaf9a('0x48')]]=_0x2006a0;this[_0xaf9a('0x41')](_0x2006a0,_0xaf9a('0x20'));}else if(this[_0xaf9a('0x63')](_0x2522b6['variable'])&&this[_0xaf9a('0x63')](_0x2522b6['variable'][_0xaf9a('0xa9')])){if(!_0x2006a0['queuecallerabandon']){_0x2006a0[_0xaf9a('0x8e')]=!![];_0x2006a0[_0xaf9a('0x8f')]=moment()[_0xaf9a('0x49')](_0xaf9a('0x76'));_0x2006a0[_0xaf9a('0x4c')]=_0xaf9a('0xaa');_0x2006a0[_0xaf9a('0xa7')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf9a('0x10')][_0x2522b6[_0xaf9a('0x48')]]=_0x2006a0;}}logger[_0xaf9a('0x69')](_0xaf9a('0xab'),_0x2522b6['uniqueid'],_0x2006a0['name'],_0x2006a0['type'],_[_0xaf9a('0x7a')](_0x2522b6[_0xaf9a('0xa3')])[0x0],_0x2522b6[_0xaf9a('0xa4')]);_0x2006a0[_0xaf9a('0x15')]=this[_0xaf9a('0x15')][_0x2522b6[_0xaf9a('0x48')]];}}}}catch(_0x152f1f){logger[_0xaf9a('0x3b')](_0xaf9a('0xac'),_0x2522b6[_0xaf9a('0x48')],util[_0xaf9a('0x3d')](_0x152f1f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf9a('0xa')][_0xaf9a('0xa2')]=function(_0xa8fa0e,_0x3a6c62,_0x28283e){var _0x14fd68=[_0xaf9a('0xad'),_0xaf9a('0xae'),_0xaf9a('0xaf'),_0xaf9a('0xb0'),_0xaf9a('0xb1'),'rtpaudioqoslossbridged',_0xaf9a('0xb2'),_0xaf9a('0xb3'),_0xaf9a('0xb4'),_0xaf9a('0xb5'),_0xaf9a('0xb6'),'bridgepvtcallid',_0xaf9a('0xb7'),'memberdynamic','memberinterface',_0xaf9a('0xb8'),_0xaf9a('0x8d'),_0xaf9a('0xb9'),_0xaf9a('0xba')];if(!_[_0xaf9a('0x35')](_0x3a6c62)&&!_[_0xaf9a('0xbb')](_0x14fd68,_0x3a6c62)){if(_[_0xaf9a('0x74')](this[_0xaf9a('0x15')][_0xa8fa0e])){this['variables'][_0xa8fa0e]={};}this[_0xaf9a('0x15')][_0xa8fa0e][_0x3a6c62]=_0x28283e;}};VoiceQueueReport['prototype'][_0xaf9a('0x23')]=function(_0x2145d0){try{if(this[_0xaf9a('0x63')](_0x2145d0)){logger[_0xaf9a('0x45')]('[%s][voiceQueueReport][hangup]',_0x2145d0['uniqueid'],util[_0xaf9a('0x3d')](_0x2145d0,{'showHidden':![],'depth':null}));if(this[_0xaf9a('0xe')][_0x2145d0[_0xaf9a('0x48')]]){for(var _0x41245e=0x0,_0x547c16={};_0x41245e0x0?_0x302696:0x0;this['voiceQueues'][_0x3a8974[_0x98c0('0x62')]][_0x98c0('0x2b')]=this[_0x98c0('0x11')][_0x3a8974['queue']]['talking']>_[_0x98c0('0x66')](_0x3a8974[_0x98c0('0x67')])?_['toNumber'](_0x3a8974[_0x98c0('0x67')]):this['voiceQueues'][_0x3a8974['queue']][_0x98c0('0x2b')];this[_0x98c0('0x4a')](this[_0x98c0('0x11')][_0x3a8974['queue']],'queuesummary');}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x98c0('0x36')](this[_0x98c0('0x11')][_0x3a8974[_0x98c0('0x62')]],{'showHidden':![],'depth':null}));ami[_0x98c0('0x3c')](_0x98c0('0x69'),this['voiceQueues'][_0x3a8974[_0x98c0('0x62')]]);}}}catch(_0x554da0){logger[_0x98c0('0x34')](_0x98c0('0x61'),util[_0x98c0('0x36')](_0x554da0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98c0('0x9')]['syncQueueSummaryComplete']=function(_0x3524e5){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x98c0('0x36')](_0x3524e5,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x98c0('0x17')]=function(_0x3c462d){try{if(this[_0x98c0('0x5b')](_0x3c462d)){logger[_0x98c0('0x3e')](_0x98c0('0x6a'),_0x3c462d[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x3c462d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x98c0('0x37')][_0x3c462d[_0x98c0('0x41')]]))this[_0x98c0('0x37')][_0x3c462d[_0x98c0('0x41')]]=[];if(_[_0x98c0('0x5c')](this[_0x98c0('0xf')][_0x3c462d['uniqueid']]))this[_0x98c0('0xf')][_0x3c462d[_0x98c0('0x41')]]={};var _0x46049c=new QueueReport();_0x46049c[_0x98c0('0x44')]=_0x3c462d['queue'];_0x46049c['type']=this[_0x98c0('0x11')][_0x46049c[_0x98c0('0x44')]]&&this[_0x98c0('0x11')][_0x46049c['name']][_0x98c0('0x53')]?this['voiceQueues'][_0x46049c[_0x98c0('0x44')]][_0x98c0('0x53')]||_0x98c0('0x4b'):'inbound';_0x46049c[_0x98c0('0x62')]=_0x3c462d['queue'];_0x46049c[_0x98c0('0x6b')]=moment()[_0x98c0('0x42')](_0x98c0('0x6c'));_0x46049c[_0x98c0('0x6d')]=_0x3c462d['position'];_0x46049c[_0x98c0('0x6e')]=_0x3c462d[_0x98c0('0x6e')];_0x46049c[_0x98c0('0x41')]=_0x3c462d[_0x98c0('0x41')];_0x46049c[_0x98c0('0x6f')]=this['channels'][_0x3c462d[_0x98c0('0x41')]][_0x98c0('0x6f')];logger[_0x98c0('0x64')](_0x98c0('0x70'),_0x46049c[_0x98c0('0x44')],_0x46049c[_0x98c0('0x53')]);_['merge'](_0x46049c,_[_0x98c0('0x71')](_0x3c462d,_[_0x98c0('0x72')](_0x46049c)));this[_0x98c0('0x37')][_0x3c462d[_0x98c0('0x41')]]['push'](_0x46049c);this['channels'][_0x3c462d['uniqueid']]=_0x46049c;this[_0x98c0('0x3d')](_0x46049c,'queuecallerjoin');}}catch(_0x2b38a2){logger[_0x98c0('0x34')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3c462d[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x2b38a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98c0('0x9')]['syncQueueCallerAbandon']=function(_0x23a7c1){try{if(this[_0x98c0('0x5b')](_0x23a7c1)){logger[_0x98c0('0x3e')](_0x98c0('0x73'),_0x23a7c1[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x23a7c1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x23a7c1[_0x98c0('0x41')]]){var _0x1a4320=_[_0x98c0('0x74')](this['queueReports'][_0x23a7c1[_0x98c0('0x41')]]);_0x1a4320[_0x98c0('0x75')]=![];_0x1a4320['queuecallercompleteAt']=null;_0x1a4320['holdtime']=_0x23a7c1[_0x98c0('0x76')];_0x1a4320[_0x98c0('0x77')]=_0x23a7c1['originalposition'];_0x1a4320[_0x98c0('0x19')]=!![];_0x1a4320['queuecallerabandonAt']=moment()[_0x98c0('0x42')](_0x98c0('0x6c'));_0x1a4320[_0x98c0('0x48')]=_0x98c0('0x78');_0x1a4320['lastAssignedTo']=null;logger[_0x98c0('0x64')](_0x98c0('0x79'),_0x1a4320['name'],_0x1a4320['type']);this[_0x98c0('0xf')][_0x23a7c1['uniqueid']]=_0x1a4320;this[_0x98c0('0x3b')](_0x1a4320,_0x98c0('0x19'));}}}catch(_0x2eb66c){logger[_0x98c0('0x34')](_0x98c0('0x73'),_0x23a7c1['uniqueid'],util[_0x98c0('0x36')](_0x2eb66c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x98c0('0x1b')]=function(_0x1393cb){try{if(this[_0x98c0('0x5b')](_0x1393cb)){logger[_0x98c0('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x1393cb[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x1393cb,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1393cb[_0x98c0('0x41')]]){var _0x36dd3e=_[_0x98c0('0x74')](this[_0x98c0('0x37')][_0x1393cb[_0x98c0('0x41')]]);_0x36dd3e[_0x98c0('0x7a')]=moment()[_0x98c0('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x36dd3e[_0x98c0('0x7b')]=_0x1393cb[_0x98c0('0x7b')];_0x36dd3e[_0x98c0('0x7c')]=_0x1393cb[_0x98c0('0x7c')];logger[_0x98c0('0x64')](_0x98c0('0x7d'),_0x36dd3e[_0x98c0('0x44')],_0x36dd3e[_0x98c0('0x53')],_0x1393cb[_0x98c0('0x7b')],_0x1393cb[_0x98c0('0x7c')]);this[_0x98c0('0xf')][_0x1393cb['uniqueid']]=_0x36dd3e;this[_0x98c0('0x3d')](_0x36dd3e,'queuecallerleave');}}}catch(_0x3504cf){logger[_0x98c0('0x34')](_0x98c0('0x7e'),_0x1393cb[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x3504cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98c0('0x9')][_0x98c0('0x7f')]=function(_0x1d6613){try{if(this[_0x98c0('0x5b')](_0x1d6613)){logger[_0x98c0('0x3e')](_0x98c0('0x80'),_0x1d6613[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x1d6613,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1d6613[_0x98c0('0x41')]]){var _0x550342=_[_0x98c0('0x74')](this[_0x98c0('0x37')][_0x1d6613['uniqueid']]);_0x550342[_0x98c0('0x75')]=!![];_0x550342[_0x98c0('0x48')]=_0x98c0('0x81');logger['info'](_0x98c0('0x82'),_0x550342[_0x98c0('0x44')],_0x550342[_0x98c0('0x53')]);}}}catch(_0x1d2d0a){logger[_0x98c0('0x34')]('[%s][voiceQueueReport][agentconnect]',_0x1d6613[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x1d2d0a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98c0('0x9')][_0x98c0('0x1c')]=function(_0x43c3fa){try{if(this[_0x98c0('0x5b')](_0x43c3fa)){logger[_0x98c0('0x3e')]('[%s][voiceQueueReport][agentcomplete]',_0x43c3fa[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x43c3fa,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x43c3fa['uniqueid']]){var _0x17372b=_['last'](this[_0x98c0('0x37')][_0x43c3fa[_0x98c0('0x41')]]);_0x17372b[_0x98c0('0x19')]=![];_0x17372b[_0x98c0('0x83')]=null;_0x17372b[_0x98c0('0x84')]=!![];_0x17372b[_0x98c0('0x85')]=_0x43c3fa['membername'];_0x17372b[_0x98c0('0x76')]=_0x43c3fa['holdtime'];_0x17372b[_0x98c0('0x75')]=!![];_0x17372b[_0x98c0('0x86')]=![];_0x17372b[_0x98c0('0x87')]=null;if(!_0x17372b[_0x98c0('0x88')]){if(_0x43c3fa[_0x98c0('0x89')]==_0x98c0('0x88')){_0x17372b[_0x98c0('0x48')]='COMPLETED';logger[_0x98c0('0x64')](_0x98c0('0x8a'),_0x17372b[_0x98c0('0x44')],_0x17372b[_0x98c0('0x53')]);}else{if(_['startsWith'](_0x43c3fa[_0x98c0('0x32')][_0x98c0('0x8b')](),'local/')){if(this['queueReports'][_0x43c3fa[_0x98c0('0x8c')]]){var _0x595510=_[_0x98c0('0x74')](this['queueReports'][_0x43c3fa[_0x98c0('0x8c')]]);_0x595510[_0x98c0('0x75')]=![];_0x595510[_0x98c0('0x86')]=!![];_0x595510['queuecallerexitAt']=moment(_0x17372b['queuecallerjoinAt'])[_0x98c0('0x8d')](_0x43c3fa[_0x98c0('0x76')],'seconds')[_0x98c0('0x42')](_0x98c0('0x6c'));_0x595510[_0x98c0('0x48')]=_0x98c0('0x8e');_0x595510[_0x98c0('0x88')]=!![];_0x595510[_0x98c0('0x8f')]=_0x98c0('0x90');_0x595510[_0x98c0('0x91')]=_0x43c3fa[_0x98c0('0x92')];_0x595510[_0x98c0('0x93')]=_0x43c3fa['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x595510['name'],_0x595510['type']);var _0x2d2797=this[_0x98c0('0x37')][_0x43c3fa[_0x98c0('0x8c')]];this['queueReports'][_0x43c3fa[_0x98c0('0x8c')]]=this['queueReports'][_0x43c3fa[_0x98c0('0x41')]];this['queueReports'][_0x43c3fa[_0x98c0('0x41')]]=_0x2d2797;}}else{_0x17372b[_0x98c0('0x48')]=_0x98c0('0x94')+_0x43c3fa['reason'][_0x98c0('0x95')]();logger[_0x98c0('0x64')](_0x98c0('0x96'),_0x17372b[_0x98c0('0x44')],_0x17372b[_0x98c0('0x53')],_0x17372b[_0x98c0('0x48')]);}}}this[_0x98c0('0xf')][_0x43c3fa['uniqueid']]=_0x17372b;this[_0x98c0('0x3b')](_0x17372b,'agentcomplete');}}}catch(_0x5ec82a){logger[_0x98c0('0x34')](_0x98c0('0x97'),_0x43c3fa[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x5ec82a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x3bbc42){try{if(this[_0x98c0('0x5b')](_0x3bbc42)){logger['debug'](_0x98c0('0x98'),_0x3bbc42[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x3bbc42,{'showHidden':![],'depth':null}));this[_0x98c0('0x99')](_0x3bbc42[_0x98c0('0x41')],_[_0x98c0('0x72')](_0x3bbc42[_0x98c0('0x9a')])[0x0],_0x3bbc42['value']);if(this[_0x98c0('0x37')][_0x3bbc42[_0x98c0('0x41')]]){var _0x49f2c1=_[_0x98c0('0x74')](this[_0x98c0('0x37')][_0x3bbc42[_0x98c0('0x41')]]);if(_0x49f2c1){if(this[_0x98c0('0x5b')](_0x3bbc42['variable'])&&this[_0x98c0('0x5b')](_0x3bbc42[_0x98c0('0x9a')][_0x98c0('0x9b')])){switch(_0x3bbc42[_0x98c0('0x9c')]){case _0x98c0('0x9d'):_0x49f2c1['queuecallerexit']=![];_0x49f2c1[_0x98c0('0x87')]=null;break;case _0x98c0('0x9e'):_0x49f2c1['lastevent']=_0x98c0('0x9f');_0x49f2c1['queuecallerexit']=!![];_0x49f2c1[_0x98c0('0x87')]=moment()['format'](_0x98c0('0x6c'));_0x49f2c1[_0x98c0('0x7a')]=moment()[_0x98c0('0x42')](_0x98c0('0x6c'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3bbc42['uniqueid'],util['inspect'](_0x49f2c1,{'showHidden':![],'depth':null}));ami['emit'](_0x98c0('0xa0'),_0x49f2c1);break;default:_0x49f2c1[_0x98c0('0x86')]=!![];_0x49f2c1[_0x98c0('0x87')]=moment()['format'](_0x98c0('0x6c'));_0x49f2c1[_0x98c0('0x7a')]=moment()[_0x98c0('0x42')](_0x98c0('0x6c'));}_0x49f2c1[_0x98c0('0x19')]=![];_0x49f2c1[_0x98c0('0x83')]=null;_0x49f2c1[_0x98c0('0x48')]=_0x3bbc42[_0x98c0('0x9c')];this['channels'][_0x3bbc42[_0x98c0('0x41')]]=_0x49f2c1;this[_0x98c0('0x3b')](_0x49f2c1,_0x98c0('0x1e'));}else if(this[_0x98c0('0x5b')](_0x3bbc42[_0x98c0('0x9a')])&&this[_0x98c0('0x5b')](_0x3bbc42[_0x98c0('0x9a')]['queueposition'])){if(!_0x49f2c1['queuecallerabandon']){_0x49f2c1[_0x98c0('0x86')]=!![];_0x49f2c1[_0x98c0('0x87')]=moment()[_0x98c0('0x42')](_0x98c0('0x6c'));_0x49f2c1[_0x98c0('0x48')]=_0x98c0('0xa1');_0x49f2c1[_0x98c0('0x7a')]=moment()[_0x98c0('0x42')](_0x98c0('0x6c'));this[_0x98c0('0xf')][_0x3bbc42[_0x98c0('0x41')]]=_0x49f2c1;}}logger['info'](_0x98c0('0xa2'),_0x3bbc42[_0x98c0('0x41')],_0x49f2c1['name'],_0x49f2c1[_0x98c0('0x53')],_[_0x98c0('0x72')](_0x3bbc42[_0x98c0('0x9a')])[0x0],_0x3bbc42[_0x98c0('0x9c')]);_0x49f2c1[_0x98c0('0x14')]=this[_0x98c0('0x14')][_0x3bbc42[_0x98c0('0x41')]];}}}}catch(_0x1864a7){logger['error']('[%s][voiceQueueReport][varset]',_0x3bbc42[_0x98c0('0x41')],util[_0x98c0('0x36')](_0x1864a7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x98c0('0x9')][_0x98c0('0x99')]=function(_0x34d2cf,_0x24ad7d,_0x137d6d){var _0x290463=['rtpaudioqos','rtpaudioqosbridged',_0x98c0('0xa3'),_0x98c0('0xa4'),'rtpaudioqosloss',_0x98c0('0xa5'),_0x98c0('0xa6'),_0x98c0('0xa7'),_0x98c0('0xa8'),_0x98c0('0xa9'),_0x98c0('0xaa'),_0x98c0('0xab'),_0x98c0('0xac'),_0x98c0('0xad'),_0x98c0('0xae'),_0x98c0('0xaf'),_0x98c0('0xb0'),_0x98c0('0xb1'),_0x98c0('0xb2')];if(!_[_0x98c0('0x30')](_0x24ad7d)&&!_[_0x98c0('0xb3')](_0x290463,_0x24ad7d)){if(_['isUndefined'](this[_0x98c0('0x14')][_0x34d2cf])){this[_0x98c0('0x14')][_0x34d2cf]={};}this[_0x98c0('0x14')][_0x34d2cf][_0x24ad7d]=_0x137d6d;}};VoiceQueueReport[_0x98c0('0x9')][_0x98c0('0x20')]=function(_0x3315ed){try{if(this[_0x98c0('0x5b')](_0x3315ed)){logger['debug'](_0x98c0('0xb4'),_0x3315ed[_0x98c0('0x41')],util['inspect'](_0x3315ed,{'showHidden':![],'depth':null}));if(this[_0x98c0('0x37')][_0x3315ed[_0x98c0('0x41')]]){for(var _0x475c97=0x0,_0x3d3352={};_0x475c97=0x0?moment(_0x35cbb5[_0xd0c2('0x13')])[_0xd0c2('0xc')](_0x35cbb5[_0xd0c2('0x12')],_0xd0c2('0x14')):null,'data1':'outbound','data2':_0x35cbb5['accountcode'],'data3':_0x35cbb5[_0xd0c2('0x15')],'data4':_0x35cbb5[_0xd0c2('0x16')]||null,'role':_0xd0c2('0xd'),'internal':_0x35cbb5[_0xd0c2('0xe')]?_['toNumber'](_0x35cbb5[_0xd0c2('0xe')]):undefined,'uniqueid':_0x35cbb5[_0xd0c2('0xf')]},'log':_0xd0c2('0x5')});}; \ No newline at end of file +var _0x234e=['lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','Request','membername','TALKING','starttime','endtime','diff','seconds','dialstring','util','../client','queuecallerexitAt','CreateMemberReport','voice'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x234e,0x133));var _0xe234=function(_0x18a5b4,_0xd89201){_0x18a5b4=_0x18a5b4-0x0;var _0x534b89=_0x234e[_0x18a5b4];return _0x534b89;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xe234('0x0'));var client=require(_0xe234('0x1'));exports['voiceQueueReport']=function(_0x1b2646){var _0x5bea85=_0x1b2646['queuecallercompleteAt']||_0x1b2646[_0xe234('0x2')];return client['Request'](_0xe234('0x3'),{'body':{'channel':_0xe234('0x4'),'membername':_0x1b2646[_0xe234('0x5')],'interface':_[_0xe234('0x6')](_0x1b2646[_0xe234('0x7')])?util[_0xe234('0x8')](_0xe234('0x9'),_0x1b2646[_0xe234('0x5')]):_0x1b2646['interface'],'type':'TALKING','enterAt':_0x1b2646[_0xe234('0xa')],'exitAt':_0x5bea85,'duration':moment(_0x5bea85)['diff'](_0x1b2646[_0xe234('0xa')],'seconds'),'data1':_0xe234('0xb'),'data2':_0x1b2646[_0xe234('0xc')],'data3':_0x1b2646[_0xe234('0xd')],'data4':null,'data5':_0x1b2646[_0xe234('0xe')],'role':_0xe234('0xf'),'internal':_0x1b2646[_0xe234('0x10')]?_['toNumber'](_0x1b2646[_0xe234('0x10')]):undefined,'uniqueid':_0x1b2646[_0xe234('0x11')]},'log':_0xe234('0x3')});};exports['voiceDialReport']=function(_0x5f3d20){return client[_0xe234('0x12')]('CreateMemberReport',{'body':{'channel':_0xe234('0x4'),'membername':_0x5f3d20[_0xe234('0x13')],'interface':_0x5f3d20['interface'],'type':_0xe234('0x14'),'enterAt':_0x5f3d20[_0xe234('0x15')],'exitAt':_0x5f3d20['endtime'],'duration':moment(_0x5f3d20[_0xe234('0x16')])[_0xe234('0x17')](_0x5f3d20[_0xe234('0x15')],_0xe234('0x18'))>=0x0?moment(_0x5f3d20[_0xe234('0x16')])[_0xe234('0x17')](_0x5f3d20['starttime'],_0xe234('0x18')):null,'data1':'outbound','data2':_0x5f3d20['accountcode'],'data3':_0x5f3d20[_0xe234('0xd')],'data4':_0x5f3d20[_0xe234('0x19')]||null,'role':'agent','internal':_0x5f3d20[_0xe234('0x10')]?_['toNumber'](_0x5f3d20[_0xe234('0x10')]):undefined,'uniqueid':_0x5f3d20[_0xe234('0x11')]},'log':_0xe234('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 34b4385..c74f296 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 _0x0efe=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x0efe,0x110));var _0xe0ef=function(_0x30bd6c,_0x5b990a){_0x30bd6c=_0x30bd6c-0x0;var _0x448544=_0x0efe[_0x30bd6c];return _0x448544;};'use strict';var client=require(_0xe0ef('0x0'));exports[_0xe0ef('0x1')]=function(){return client['Request'](_0xe0ef('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe0ef('0x3'),_0xe0ef('0x4')]},'log':_0xe0ef('0x5')});}; \ No newline at end of file +var _0x1339=['getSettings','ShowSetting','stopRecordingOnTransfer','../client'];(function(_0x1e354d,_0x4cdd11){var _0x25445d=function(_0x2536d4){while(--_0x2536d4){_0x1e354d['push'](_0x1e354d['shift']());}};_0x25445d(++_0x4cdd11);}(_0x1339,0x1bf));var _0x9133=function(_0x388e13,_0x39724e){_0x388e13=_0x388e13-0x0;var _0x453c62=_0x1339[_0x388e13];return _0x453c62;};'use strict';var client=require(_0x9133('0x0'));exports[_0x9133('0x1')]=function(){return client['Request'](_0x9133('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9133('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 441d2f0..2b7b555 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 _0x8969=['html','GetTemplate','../client','getTemplates','Request','name'];(function(_0x57af8a,_0x392a38){var _0x315899=function(_0x2a29ea){while(--_0x2a29ea){_0x57af8a['push'](_0x57af8a['shift']());}};_0x315899(++_0x392a38);}(_0x8969,0xc2));var _0x9896=function(_0x2ddbfc,_0x206fad){_0x2ddbfc=_0x2ddbfc-0x0;var _0x1d2b2d=_0x8969[_0x2ddbfc];return _0x1d2b2d;};'use strict';var client=require(_0x9896('0x0'));exports[_0x9896('0x1')]=function(_0x217790){return function(_0x405a17){return client[_0x9896('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9896('0x3'),_0x9896('0x4')]},'log':_0x9896('0x5')});};}; \ No newline at end of file +var _0x5853=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0xd57f5d,_0x48a273){var _0x2131da=function(_0x1d776b){while(--_0x1d776b){_0xd57f5d['push'](_0xd57f5d['shift']());}};_0x2131da(++_0x48a273);}(_0x5853,0x113));var _0x3585=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x5853[_0x4f3c9b];return _0x84e58a;};'use strict';var client=require(_0x3585('0x0'));exports[_0x3585('0x1')]=function(_0x11a3e4){return function(_0x3f15f9){return client[_0x3585('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3585('0x3'),_0x3585('0x4')]},'log':_0x3585('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ef535af..f136b21 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 _0xf957=['AnyConditions','Actions','action','data2','data3','data4','data6','data7','../client','GetTrigger','name','channel','Condition','AllConditions','field','value'];(function(_0x10a39a,_0x2c6f68){var _0x1fa08b=function(_0x2bf76d){while(--_0x2bf76d){_0x10a39a['push'](_0x10a39a['shift']());}};_0x1fa08b(++_0x2c6f68);}(_0xf957,0x198));var _0x7f95=function(_0xc54428,_0x71395c){_0xc54428=_0xc54428-0x0;var _0x32caf0=_0xf957[_0xc54428];return _0x32caf0;};'use strict';var client=require(_0x7f95('0x0'));exports['getTriggers']=function(_0x1664de){return function(_0x2f3397){return client['Request'](_0x7f95('0x1'),{'options':{'raw':![],'attributes':['id',_0x7f95('0x2'),_0x7f95('0x3'),'status'],'include':[{'model':_0x7f95('0x4'),'as':_0x7f95('0x5'),'attributes':['id',_0x7f95('0x6'),'operator',_0x7f95('0x7')]},{'model':_0x7f95('0x4'),'as':_0x7f95('0x8'),'attributes':['id','field','operator',_0x7f95('0x7')]},{'model':'Action','as':_0x7f95('0x9'),'attributes':['id',_0x7f95('0xa'),'data1',_0x7f95('0xb'),_0x7f95('0xc'),_0x7f95('0xd'),'data5',_0x7f95('0xe'),_0x7f95('0xf')]}]},'log':_0x7f95('0x1')});};}; \ No newline at end of file +var _0x76c8=['Condition','AllConditions','field','operator','Action','Actions','action','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel','status'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x76c8,0x1aa));var _0x876c=function(_0x5dc27f,_0x135634){_0x5dc27f=_0x5dc27f-0x0;var _0x21933b=_0x76c8[_0x5dc27f];return _0x21933b;};'use strict';var client=require(_0x876c('0x0'));exports[_0x876c('0x1')]=function(_0x132441){return function(_0x29dbf1){return client['Request'](_0x876c('0x2'),{'options':{'raw':![],'attributes':['id',_0x876c('0x3'),_0x876c('0x4'),_0x876c('0x5')],'include':[{'model':_0x876c('0x6'),'as':_0x876c('0x7'),'attributes':['id',_0x876c('0x8'),_0x876c('0x9'),'value']},{'model':_0x876c('0x6'),'as':'AnyConditions','attributes':['id',_0x876c('0x8'),_0x876c('0x9'),'value']},{'model':_0x876c('0xa'),'as':_0x876c('0xb'),'attributes':['id',_0x876c('0xc'),'data1',_0x876c('0xd'),_0x876c('0xe'),_0x876c('0xf'),'data5',_0x876c('0x10'),_0x876c('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 90af82c..8bf2db7 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 _0x6d44=['Request','GetTrunk','name','defaultuser','../client','getTrunks'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x6d44,0x70));var _0x46d4=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x6d44[_0x4664db];return _0x5615b4;};'use strict';var client=require(_0x46d4('0x0'));exports[_0x46d4('0x1')]=function(_0x1cd59e){return function(_0x3528a4){return client[_0x46d4('0x2')](_0x46d4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x46d4('0x4'),'registry',_0x46d4('0x5')]},'log':_0x46d4('0x3')});};}; \ No newline at end of file +var _0x3d68=['getTrunks','Request','GetTrunk','name','defaultuser','../client'];(function(_0xa89a2,_0x14cc1e){var _0x27279e=function(_0x4a49f5){while(--_0x4a49f5){_0xa89a2['push'](_0xa89a2['shift']());}};_0x27279e(++_0x14cc1e);}(_0x3d68,0x107));var _0x83d6=function(_0x50d5b1,_0x271e11){_0x50d5b1=_0x50d5b1-0x0;var _0x23ec2c=_0x3d68[_0x50d5b1];return _0x23ec2c;};'use strict';var client=require(_0x83d6('0x0'));exports[_0x83d6('0x1')]=function(_0x181956){return function(_0x11676f){return client[_0x83d6('0x2')](_0x83d6('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x83d6('0x4'),'registry',_0x83d6('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6ca1e86..d7a5b7d 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x128c3b,_0x5c5814){var _0x537c4a=function(_0x3d3fa9){while(--_0x3d3fa9){_0x128c3b['push'](_0x128c3b['shift']());}};_0x537c4a(++_0x5c5814);}(_0xedd9,0xfc));var _0x9edd=function(_0xdbd7ed,_0x16adb9){_0xdbd7ed=_0xdbd7ed-0x0;var _0x1ee990=_0xedd9[_0xdbd7ed];return _0x1ee990;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x31a5d4,_0x273328){var _0x4e7af0=function(_0x119012){while(--_0x119012){_0x31a5d4['push'](_0x31a5d4['shift']());}};_0x4e7af0(++_0x273328);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xcb91[_0x22e9fe];return _0x47cd19;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b1223c5..c1cf4fe 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 _0xefc5=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0xefc5,0x1e0));var _0x5efc=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0xefc5[_0x38fb8b];return _0x1ec681;};'use strict';var client=require(_0x5efc('0x0'));exports['create']=function(_0x536fc1){return client[_0x5efc('0x1')](_0x5efc('0x2'),{'body':_0x536fc1,'log':_0x5efc('0x2')});};exports[_0x5efc('0x3')]=function(_0x22d026,_0x390d92,_0x31532a){return client[_0x5efc('0x1')]('UpdateVoiceAgentReport',{'body':_0x22d026,'options':{'where':{'uniqueid':_0x390d92,'interface':_0x31532a,'agentcomplete':!![]}},'log':_0x5efc('0x4')});}; \ No newline at end of file +var _0xfb77=['update','Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport'];(function(_0x53632c,_0x4a2c15){var _0x284fb2=function(_0x2f3808){while(--_0x2f3808){_0x53632c['push'](_0x53632c['shift']());}};_0x284fb2(++_0x4a2c15);}(_0xfb77,0xd5));var _0x7fb7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfb77[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7fb7('0x0'));exports[_0x7fb7('0x1')]=function(_0x4ce92b){return client['Request'](_0x7fb7('0x2'),{'body':_0x4ce92b,'log':_0x7fb7('0x2')});};exports[_0x7fb7('0x3')]=function(_0x5c6e66,_0xfb73fe,_0x4585e4){return client[_0x7fb7('0x4')](_0x7fb7('0x5'),{'body':_0x5c6e66,'options':{'where':{'uniqueid':_0xfb73fe,'interface':_0x4585e4,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 73e4505..06cefc3 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 _0xa113=['GetVoiceCallReport','outbound','startOf','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','GetVoiceCallReports','moment','util','lodash','Request','merge','calleridnum','callerid','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x15e578,_0x3b2d6f){var _0x4a33c7=function(_0x3ff3fb){while(--_0x3ff3fb){_0x15e578['push'](_0x15e578['shift']());}};_0x4a33c7(++_0x3b2d6f);}(_0xa113,0x195));var _0x3a11=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa113[_0x4baae2];return _0x1a2285;};'use strict';var moment=require(_0x3a11('0x0'));var util=require(_0x3a11('0x1'));var _=require(_0x3a11('0x2'));var client=require('../client');exports['create']=function(_0x1cc13d){return client[_0x3a11('0x3')]('CreateVoiceCallReport',{'body':_[_0x3a11('0x4')](_0x1cc13d,{'source':_0x1cc13d[_0x3a11('0x5')],'destinationcontext':_0x1cc13d['context'],'callerid':_0x1cc13d[_0x3a11('0x6')],'amaflags':_0x3a11('0x7')}),'log':_0x3a11('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x3a11('0x3')](_0x3a11('0x9'),{'options':{'where':{'type':[_0x3a11('0xa')],'createdAt':{'$between':[moment()[_0x3a11('0xb')]('day')[_0x3a11('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3a11('0xd')]('day')['format'](_0x3a11('0xe'))]}},'attributes':[_0x3a11('0xf'),_0x3a11('0x10'),'duration','billableseconds']},'log':_0x3a11('0x11')});};}; \ No newline at end of file +var _0xf6fe=['context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x3833b1,_0x39a37e){var _0x29fd05=function(_0x2fe5d4){while(--_0x2fe5d4){_0x3833b1['push'](_0x3833b1['shift']());}};_0x29fd05(++_0x39a37e);}(_0xf6fe,0xcb));var _0xef6f=function(_0x3d3404,_0x2a8e40){_0x3d3404=_0x3d3404-0x0;var _0x5e9cae=_0xf6fe[_0x3d3404];return _0x5e9cae;};'use strict';var moment=require(_0xef6f('0x0'));var util=require('util');var _=require(_0xef6f('0x1'));var client=require(_0xef6f('0x2'));exports[_0xef6f('0x3')]=function(_0x370311){return client[_0xef6f('0x4')](_0xef6f('0x5'),{'body':_[_0xef6f('0x6')](_0x370311,{'source':_0x370311['calleridnum'],'destinationcontext':_0x370311[_0xef6f('0x7')],'callerid':_0x370311[_0xef6f('0x8')],'amaflags':_0xef6f('0x9')}),'log':_0xef6f('0x5')});};exports[_0xef6f('0xa')]=function(){return function(){return client[_0xef6f('0x4')](_0xef6f('0xb'),{'options':{'where':{'type':[_0xef6f('0xc')],'createdAt':{'$between':[moment()[_0xef6f('0xd')](_0xef6f('0xe'))[_0xef6f('0xf')](_0xef6f('0x10')),moment()[_0xef6f('0x11')](_0xef6f('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type','disposition',_0xef6f('0x12'),_0xef6f('0x13')]},'log':_0xef6f('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 2ad1cfe..894da11 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 _0x98e8=['CreateVoiceDialReport','create','Request'];(function(_0x1cd822,_0x4ce89f){var _0x1ff5a4=function(_0x4d0800){while(--_0x4d0800){_0x1cd822['push'](_0x1cd822['shift']());}};_0x1ff5a4(++_0x4ce89f);}(_0x98e8,0xf1));var _0x898e=function(_0x15a966,_0x12af14){_0x15a966=_0x15a966-0x0;var _0x27747f=_0x98e8[_0x15a966];return _0x27747f;};'use strict';var client=require('../client');exports[_0x898e('0x0')]=function(_0x5d318c){return client[_0x898e('0x1')](_0x898e('0x2'),{'body':_0x5d318c,'log':_0x898e('0x2')});}; \ No newline at end of file +var _0x93a0=['CreateVoiceDialReport','../client','create','Request'];(function(_0x6caa3e,_0x434951){var _0x22bc05=function(_0x36ba4f){while(--_0x36ba4f){_0x6caa3e['push'](_0x6caa3e['shift']());}};_0x22bc05(++_0x434951);}(_0x93a0,0x1c5));var _0x093a=function(_0x145bee,_0x58c5b9){_0x145bee=_0x145bee-0x0;var _0x3cb268=_0x93a0[_0x145bee];return _0x3cb268;};'use strict';var client=require(_0x093a('0x0'));exports[_0x093a('0x1')]=function(_0xe47d2c){return client[_0x093a('0x2')](_0x093a('0x3'),{'body':_0xe47d2c,'log':_0x093a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b621739..1542c69 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 _0x87ae=['recordingFormat','getVoiceExtensions','Request'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x87ae,0xf5));var _0xe87a=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x87ae[_0x1d9aa0];return _0x226868;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xe87a('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xe87a('0x1')],'where':{'VoiceExtensionId':null}},'log':_0xe87a('0x2')});};}; \ No newline at end of file +var _0x803f=['../client','Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x2850a7,_0x4dfe65){var _0x3ed454=function(_0x451c42){while(--_0x451c42){_0x2850a7['push'](_0x2850a7['shift']());}};_0x3ed454(++_0x4dfe65);}(_0x803f,0x64));var _0xf803=function(_0x1c07ff,_0x362a3b){_0x1c07ff=_0x1c07ff-0x0;var _0x27a762=_0x803f[_0x1c07ff];return _0x27a762;};'use strict';var client=require(_0xf803('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xf803('0x1')](_0xf803('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xf803('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xf803('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 988963c..6516def 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 _0x1f1f=['active','mandatoryDispositionPause','TrunkBackup','name','Interval','Intervals','interval','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid'];(function(_0x39fa11,_0xf47bc6){var _0x2d70fb=function(_0x281063){while(--_0x281063){_0x39fa11['push'](_0x39fa11['shift']());}};_0x2d70fb(++_0xf47bc6);}(_0x1f1f,0x169));var _0xf1f1=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x1f1f[_0x135904];return _0x1ce7d5;};'use strict';var client=require(_0xf1f1('0x0'));exports[_0xf1f1('0x1')]=function(){return function(){return client[_0xf1f1('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf1f1('0x3'),_0xf1f1('0x4'),_0xf1f1('0x5'),_0xf1f1('0x6'),_0xf1f1('0x7'),_0xf1f1('0x8'),'dialMethod',_0xf1f1('0x9'),_0xf1f1('0xa'),_0xf1f1('0xb'),_0xf1f1('0xc'),'dialPredictiveOptimizationPercentage',_0xf1f1('0xd'),_0xf1f1('0xe'),_0xf1f1('0xf'),'dialOriginateTimeout',_0xf1f1('0x10'),_0xf1f1('0x11'),'dialQueueProject',_0xf1f1('0x12'),_0xf1f1('0x13'),'dialBusyMaxRetry',_0xf1f1('0x14'),_0xf1f1('0x15'),'dialNoAnswerRetryFrequency',_0xf1f1('0x16'),_0xf1f1('0x17'),'dialGlobalInterval',_0xf1f1('0x18'),_0xf1f1('0x19'),'dialAMDActive','dialAMDInitialSilence','dialAMDGreeting',_0xf1f1('0x1a'),_0xf1f1('0x1b'),_0xf1f1('0x1c'),_0xf1f1('0x1d'),_0xf1f1('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0xf1f1('0x1f'),_0xf1f1('0x20'),_0xf1f1('0x21'),_0xf1f1('0x22'),_0xf1f1('0x23'),_0xf1f1('0x24'),_0xf1f1('0x6'),_0xf1f1('0x25'),_0xf1f1('0x26'),_0xf1f1('0x27'),'dialNoSuchNumberMaxRetry',_0xf1f1('0x28'),_0xf1f1('0x29'),_0xf1f1('0x2a'),'dialAbandonedMaxRetry',_0xf1f1('0x2b'),'dialMachineMaxRetry',_0xf1f1('0x2c'),_0xf1f1('0x2d'),'dialAgentRejectRetryFrequency',_0xf1f1('0x2e'),_0xf1f1('0x2f'),_0xf1f1('0x30'),_0xf1f1('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xf1f1('0x32'),'attributes':['id','name',_0xf1f1('0x33'),_0xf1f1('0x34')]},{'model':'Pause','as':_0xf1f1('0x35'),'attributes':['id','name']},{'model':_0xf1f1('0x32'),'as':_0xf1f1('0x36'),'attributes':['id',_0xf1f1('0x37'),_0xf1f1('0x33'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0xf1f1('0x37')],'include':[{'model':_0xf1f1('0x38'),'as':_0xf1f1('0x39'),'attributes':['id',_0xf1f1('0x37'),_0xf1f1('0x3a')]}]}]},'log':_0xf1f1('0x1')});};}; \ No newline at end of file +var _0x1d0d=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting'];(function(_0x2e609d,_0x470f5f){var _0x28c179=function(_0x17969e){while(--_0x17969e){_0x2e609d['push'](_0x2e609d['shift']());}};_0x28c179(++_0x470f5f);}(_0x1d0d,0x9d));var _0xd1d0=function(_0x48aa37,_0x5e741d){_0x48aa37=_0x48aa37-0x0;var _0x31ea93=_0x1d0d[_0x48aa37];return _0x31ea93;};'use strict';var client=require(_0xd1d0('0x0'));exports[_0xd1d0('0x1')]=function(){return function(){return client[_0xd1d0('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xd1d0('0x3'),'acw','acwTimeout',_0xd1d0('0x4'),_0xd1d0('0x5'),_0xd1d0('0x6'),_0xd1d0('0x7'),_0xd1d0('0x8'),_0xd1d0('0x9'),_0xd1d0('0xa'),_0xd1d0('0xb'),_0xd1d0('0xc'),_0xd1d0('0xd'),'dialPredictiveInterval',_0xd1d0('0xe'),_0xd1d0('0xf'),_0xd1d0('0x10'),'dialQueueOptions',_0xd1d0('0x11'),_0xd1d0('0x12'),_0xd1d0('0x13'),_0xd1d0('0x14'),_0xd1d0('0x15'),_0xd1d0('0x16'),'dialNoAnswerMaxRetry',_0xd1d0('0x17'),_0xd1d0('0x18'),'dialTimezone','dialGlobalInterval',_0xd1d0('0x19'),_0xd1d0('0x1a'),_0xd1d0('0x1b'),'dialAMDInitialSilence',_0xd1d0('0x1c'),_0xd1d0('0x1d'),_0xd1d0('0x1e'),'dialAMDMinWordLength',_0xd1d0('0x1f'),_0xd1d0('0x20'),'dialAMDSilenceThreshold',_0xd1d0('0x21'),_0xd1d0('0x22'),_0xd1d0('0x23'),_0xd1d0('0x24'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xd1d0('0x25'),'dialQueueProject2',_0xd1d0('0x5'),_0xd1d0('0x26'),_0xd1d0('0x27'),_0xd1d0('0x28'),_0xd1d0('0x29'),_0xd1d0('0x2a'),_0xd1d0('0x2b'),_0xd1d0('0x2c'),_0xd1d0('0x2d'),_0xd1d0('0x2e'),_0xd1d0('0x2f'),'dialMachineRetryFrequency',_0xd1d0('0x30'),_0xd1d0('0x31'),'mandatoryDisposition',_0xd1d0('0x32'),'dialPredictiveIntervalMinThreshold',_0xd1d0('0x33'),_0xd1d0('0x34')],'include':[{'model':_0xd1d0('0x35'),'as':'Trunk','attributes':['id',_0xd1d0('0x3'),_0xd1d0('0x36'),'active']},{'model':_0xd1d0('0x37'),'as':_0xd1d0('0x38'),'attributes':['id',_0xd1d0('0x3')]},{'model':'Trunk','as':_0xd1d0('0x39'),'attributes':['id',_0xd1d0('0x3'),'callerid',_0xd1d0('0x3a')]},{'model':_0xd1d0('0x3b'),'as':_0xd1d0('0x3b'),'attributes':['id','name'],'include':[{'model':_0xd1d0('0x3b'),'as':_0xd1d0('0x3c'),'attributes':['id','name',_0xd1d0('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3ade82b..62c6ad2 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(_0x4bae53,_0x115177){var _0xd6fb6c=function(_0x223ecc){while(--_0x223ecc){_0x4bae53['push'](_0x4bae53['shift']());}};_0xd6fb6c(++_0x115177);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x37e979,_0x375a31){var _0x597754=function(_0x1d516e){while(--_0x1d516e){_0x37e979['push'](_0x37e979['shift']());}};_0x597754(++_0x375a31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 aab38d9..8976d22 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 _0x85b9=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x114ea9,_0x305a74){var _0x3d65ff=function(_0x46478a){while(--_0x46478a){_0x114ea9['push'](_0x114ea9['shift']());}};_0x3d65ff(++_0x305a74);}(_0x85b9,0x17f));var _0x985b=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x85b9[_0x45b034];return _0x509cb0;};'use strict';var client=require(_0x985b('0x0'));exports[_0x985b('0x1')]=function(_0x2ec2e7){return function(){return client[_0x985b('0x2')](_0x985b('0x3'),{'options':{'where':{'VoiceQueueId':_0x2ec2e7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xf689=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf689,0x9d));var _0x9f68=function(_0x414ffa,_0x1ea7a5){_0x414ffa=_0x414ffa-0x0;var _0x55a8fb=_0xf689[_0x414ffa];return _0x55a8fb;};'use strict';var client=require('../client');exports[_0x9f68('0x0')]=function(_0x370786){return function(){return client['Request'](_0x9f68('0x1'),{'options':{'where':{'VoiceQueueId':_0x370786,'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 2db294e..83a2114 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x35d0b8,_0x471c19){var _0x2fc4c9=function(_0x5e9cb1){while(--_0x5e9cb1){_0x35d0b8['push'](_0x35d0b8['shift']());}};_0x2fc4c9(++_0x471c19);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5e07bd,_0x346a93){var _0x283810=function(_0x3493de){while(--_0x3493de){_0x5e07bd['push'](_0x5e07bd['shift']());}};_0x283810(++_0x346a93);}(_0x7a54,0x106));var _0x47a5=function(_0x2a7283,_0x12d1ec){_0x2a7283=_0x2a7283-0x0;var _0x7f286d=_0x7a54[_0x2a7283];return _0x7f286d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 07a0e3b..ba752ac 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 _0x2529=['CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request'];(function(_0x29bd18,_0x5103e8){var _0x4b9e7e=function(_0x588741){while(--_0x588741){_0x29bd18['push'](_0x29bd18['shift']());}};_0x4b9e7e(++_0x5103e8);}(_0x2529,0x17d));var _0x9252=function(_0x13f050,_0x4c7195){_0x13f050=_0x13f050-0x0;var _0x24301a=_0x2529[_0x13f050];return _0x24301a;};'use strict';var client=require(_0x9252('0x0'));exports[_0x9252('0x1')]={};exports[_0x9252('0x2')]=function(_0x4d98fa){return client[_0x9252('0x3')](_0x9252('0x4'),{'body':{'result':_0x4d98fa[_0x9252('0x5')],'transfererchannel':_0x4d98fa[_0x9252('0x6')],'transferercalleridnum':_0x4d98fa[_0x9252('0x7')],'transferercalleridname':_0x4d98fa[_0x9252('0x8')],'transfererconnectedlinenum':_0x4d98fa[_0x9252('0x9')],'transfererconnectedlinename':_0x4d98fa['transfererconnectedlinename'],'transfereraccountcode':_0x4d98fa['transfereraccountcode'],'transferercontext':_0x4d98fa[_0x9252('0xa')],'transfererexten':_0x4d98fa[_0x9252('0xb')],'transfererlinkedid':_0x4d98fa[_0x9252('0xc')],'transfereechannel':_0x4d98fa[_0x9252('0xd')],'transfereecalleridnum':_0x4d98fa['transfereecalleridnum'],'transfereecalleridname':_0x4d98fa[_0x9252('0xe')],'transfereeconnectedlinenum':_0x4d98fa[_0x9252('0xf')],'transfereeconnectedlinename':_0x4d98fa['transfereeconnectedlinename'],'transfereeaccountcode':_0x4d98fa[_0x9252('0x10')],'transfereecontext':_0x4d98fa[_0x9252('0x11')],'transfereeexten':_0x4d98fa['transfereeexten'],'transfereelinkedid':_0x4d98fa[_0x9252('0x12')],'isexternal':_0x4d98fa[_0x9252('0x13')],'context':_0x4d98fa['context'],'extension':_0x4d98fa[_0x9252('0x14')],'type':'blind'},'log':_0x9252('0x4')});};exports['attendedTransfer']=function(_0x58facd){return client[_0x9252('0x3')](_0x9252('0x4'),{'body':{'result':_0x58facd['result'],'transfererchannel':_0x58facd[_0x9252('0x15')],'transferercalleridnum':_0x58facd[_0x9252('0x16')],'transferercalleridname':_0x58facd['origtransferercalleridname'],'transfererconnectedlinenum':_0x58facd[_0x9252('0x17')],'transfererconnectedlinename':_0x58facd[_0x9252('0x18')],'transfereraccountcode':_0x58facd[_0x9252('0x19')],'transferercontext':_0x58facd[_0x9252('0x1a')],'transfererexten':_0x58facd[_0x9252('0x1b')],'transfererlinkedid':_0x58facd['origtransfererlinkedid'],'transfereechannel':_0x58facd['transfertargetchannel'],'transfereecalleridnum':_0x58facd['transfertargetcalleridnum'],'transfereecalleridname':_0x58facd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x58facd[_0x9252('0x1c')],'transfereeconnectedlinename':_0x58facd[_0x9252('0x1d')],'transfereeaccountcode':_0x58facd['transfertargetaccountcode'],'transfereecontext':_0x58facd[_0x9252('0x1e')],'transfereeexten':_0x58facd['transfertargetexten'],'transfereelinkedid':_0x58facd[_0x9252('0x1f')],'isexternal':_0x58facd[_0x9252('0x13')],'context':_0x58facd[_0x9252('0x20')],'extension':_0x58facd[_0x9252('0x21')],'type':_0x9252('0x22')},'log':_0x9252('0x4')});}; \ No newline at end of file +var _0x7939=['context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7939,0x18e));var _0x9793=function(_0x1a8db2,_0x3494e6){_0x1a8db2=_0x1a8db2-0x0;var _0x58b389=_0x7939[_0x1a8db2];return _0x58b389;};'use strict';var client=require(_0x9793('0x0'));exports[_0x9793('0x1')]={};exports[_0x9793('0x2')]=function(_0x5689ec){return client[_0x9793('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x5689ec[_0x9793('0x4')],'transfererchannel':_0x5689ec[_0x9793('0x5')],'transferercalleridnum':_0x5689ec['transferercalleridnum'],'transferercalleridname':_0x5689ec[_0x9793('0x6')],'transfererconnectedlinenum':_0x5689ec[_0x9793('0x7')],'transfererconnectedlinename':_0x5689ec[_0x9793('0x8')],'transfereraccountcode':_0x5689ec[_0x9793('0x9')],'transferercontext':_0x5689ec[_0x9793('0xa')],'transfererexten':_0x5689ec['transfererexten'],'transfererlinkedid':_0x5689ec[_0x9793('0xb')],'transfereechannel':_0x5689ec[_0x9793('0xc')],'transfereecalleridnum':_0x5689ec[_0x9793('0xd')],'transfereecalleridname':_0x5689ec[_0x9793('0xe')],'transfereeconnectedlinenum':_0x5689ec[_0x9793('0xf')],'transfereeconnectedlinename':_0x5689ec[_0x9793('0x10')],'transfereeaccountcode':_0x5689ec[_0x9793('0x11')],'transfereecontext':_0x5689ec[_0x9793('0x12')],'transfereeexten':_0x5689ec[_0x9793('0x13')],'transfereelinkedid':_0x5689ec[_0x9793('0x14')],'isexternal':_0x5689ec[_0x9793('0x15')],'context':_0x5689ec[_0x9793('0x16')],'extension':_0x5689ec[_0x9793('0x17')],'type':_0x9793('0x18')},'log':_0x9793('0x19')});};exports['attendedTransfer']=function(_0x5b1a31){return client[_0x9793('0x3')](_0x9793('0x19'),{'body':{'result':_0x5b1a31[_0x9793('0x4')],'transfererchannel':_0x5b1a31[_0x9793('0x1a')],'transferercalleridnum':_0x5b1a31[_0x9793('0x1b')],'transferercalleridname':_0x5b1a31[_0x9793('0x1c')],'transfererconnectedlinenum':_0x5b1a31[_0x9793('0x1d')],'transfererconnectedlinename':_0x5b1a31[_0x9793('0x1e')],'transfereraccountcode':_0x5b1a31[_0x9793('0x1f')],'transferercontext':_0x5b1a31[_0x9793('0x20')],'transfererexten':_0x5b1a31['secondtransfererexten'],'transfererlinkedid':_0x5b1a31['origtransfererlinkedid'],'transfereechannel':_0x5b1a31[_0x9793('0x21')],'transfereecalleridnum':_0x5b1a31[_0x9793('0x22')],'transfereecalleridname':_0x5b1a31[_0x9793('0x23')],'transfereeconnectedlinenum':_0x5b1a31[_0x9793('0x24')],'transfereeconnectedlinename':_0x5b1a31[_0x9793('0x25')],'transfereeaccountcode':_0x5b1a31[_0x9793('0x26')],'transfereecontext':_0x5b1a31[_0x9793('0x27')],'transfereeexten':_0x5b1a31[_0x9793('0x28')],'transfereelinkedid':_0x5b1a31['transfertargetlinkedid'],'isexternal':_0x5b1a31[_0x9793('0x15')],'context':_0x5b1a31['origtransferercontext'],'extension':_0x5b1a31['origtransfererexten'],'type':_0x9793('0x29')},'log':_0x9793('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d01903c..0aae861 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 _0x4bd3=['loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','loggedInDb','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','find','undefined','voicechannel','map','uniqueid','%s.%s','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','channels','resolve','channel','destinationchannel','StopMixMonitor','stop','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','pick','keys','module','action','Reload','Action','then','message','catch','ami\x20disconnected','join','command','content','voiceQueues','hasOwnProperty','name','strategy','available'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x4bd3,0x174));var _0x34bd=function(_0x13c4a8,_0x4a592b){_0x13c4a8=_0x13c4a8-0x0;var _0x4eab39=_0x4bd3[_0x13c4a8];return _0x4eab39;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var jayson=require(_0x34bd('0x1'));var schema=require(_0x34bd('0x2'));var BPromise=require('bluebird');var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x34bd('0x3'));var ami=require(_0x34bd('0x4'));exports[_0x34bd('0x5')]=function(_0x5846f3,_0x2133c5,_0x2a15a2){return new BPromise(function(_0x5c2a7a,_0x3e8744){var _0x213716={'QueuePause':function(_0x51a4d7){return new Promise(function(_0xd600e1,_0x76de8d){var _0x3260ff=util[_0x34bd('0x6')](_0x34bd('0x7'),_0x34bd('0x8'),_0x51a4d7['name']);if(_0x5846f3[_0x34bd('0x9')]&&_0x5846f3[_0x34bd('0x9')][_0x3260ff]&&_0x5846f3[_0x34bd('0x9')][_0x3260ff][_0x34bd('0xa')]){_0x5846f3['timers'][_0x3260ff]['updateAcw']();}if(_0x5846f3[_0x34bd('0xb')][_0x3260ff]){_0x5846f3['agents'][_0x3260ff]['updateStatusRealtime']({'statePause':_0x51a4d7[_0x34bd('0xc')]?!![]:![]});}_0xd600e1({'code':0xc8,'message':_0x34bd('0xd')});});},'Reload':function(_0x282af4){var _0x1d627d=this;return new Promise(function(_0x2ee180,_0x14cd37){if(ami[_0x34bd('0xe')]()==![]){return _0x14cd37(_0x1d627d[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config['asterisk'][_0x34bd('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x282af4=_[_0x34bd('0x12')](_0x282af4,_[_0x34bd('0x13')](properties[_0x34bd('0x14')]));_0x282af4[_0x34bd('0x15')]=_0x34bd('0x16');return ami[_0x34bd('0x17')](_0x282af4)[_0x34bd('0x18')](function(_0x1c12e8){_0x2ee180({'code':0xc8,'message':_0x1c12e8[_0x34bd('0x19')]});})[_0x34bd('0x1a')](function(_0x4b5ebb){_0x14cd37(_0x1d627d['error'](0x1f5,_0x4b5ebb[_0x34bd('0x19')]));});});},'Command':function(_0x324f7d){var _0x265e70=this;return new Promise(function(_0x220666,_0x3976e4){if(ami[_0x34bd('0xe')]()==![]){return _0x3976e4(_0x265e70[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')]['username'],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}_0x324f7d=_[_0x34bd('0x12')](_0x324f7d,_0x34bd('0x1d'));_0x324f7d[_0x34bd('0x15')]='Command';return ami['Action'](_0x324f7d)['then'](function(_0x4edf84){_0x220666({'code':0xc8,'message':_0x4edf84[_0x34bd('0x1e')]});})['catch'](function(_0x10fc4b){_0x3976e4(_0x265e70[_0x34bd('0xf')](0x1f5,_0x10fc4b[_0x34bd('0x19')]));});});},'VoiceQueues':function(_0x5c3c85){return new Promise(function(_0x41bffd,_0x14479a){var _0x4f0dff=[];for(var _0x457006 in _0x5846f3['voiceQueues']){if(_0x5846f3[_0x34bd('0x1f')][_0x34bd('0x20')](_0x457006)){var _0x264c94=_0x5846f3[_0x34bd('0x1f')][_0x457006];var _0x56baf7={'id':_0x264c94['id'],'name':_0x264c94[_0x34bd('0x21')],'strategy':_0x264c94[_0x34bd('0x22')],'answered':_0x264c94['answered'],'available':_0x264c94[_0x34bd('0x23')],'loggedIn':_0x264c94[_0x34bd('0x24')],'pTalking':_0x264c94[_0x34bd('0x25')],'sumBillable':_0x264c94[_0x34bd('0x26')],'sumDuration':_0x264c94[_0x34bd('0x27')],'sumHoldTime':_0x264c94[_0x34bd('0x28')]||0x0,'talking':_0x264c94[_0x34bd('0x29')],'total':_0x264c94['total'],'type':_0x264c94[_0x34bd('0x2a')],'unmanaged':_0x264c94[_0x34bd('0x2b')],'abandoned':_0x264c94['abandoned'],'waiting':_0x264c94['waiting'],'loggedInDb':_0x264c94[_0x34bd('0x2c')]};if(_0x264c94[_0x34bd('0x2a')]===_0x34bd('0x2d')){_0x56baf7['dialActive']=_0x264c94['dialActive'];_0x56baf7[_0x34bd('0x2e')]=_0x264c94[_0x34bd('0x2e')];_0x56baf7[_0x34bd('0x2f')]=_0x264c94[_0x34bd('0x2f')];_0x56baf7['dialOriginateCallerIdNumber']=_0x264c94[_0x34bd('0x30')];_0x56baf7[_0x34bd('0x31')]=_0x264c94[_0x34bd('0x31')];_0x56baf7[_0x34bd('0x32')]=_0x264c94[_0x34bd('0x32')];_0x56baf7[_0x34bd('0x33')]=_0x264c94['temp'];_0x56baf7[_0x34bd('0x34')]=_0x264c94['outboundAnswerAgiCallsDay'];_0x56baf7[_0x34bd('0x35')]=_0x264c94[_0x34bd('0x35')];_0x56baf7[_0x34bd('0x36')]=_0x264c94['outboundBlacklistCallsDay'];_0x56baf7[_0x34bd('0x37')]=_0x264c94[_0x34bd('0x37')];_0x56baf7['outboundCongestionCallsDay']=_0x264c94[_0x34bd('0x38')];_0x56baf7[_0x34bd('0x39')]=_0x264c94[_0x34bd('0x39')];_0x56baf7['outboundDropCallsDayCallersExit']=_0x264c94[_0x34bd('0x3a')];_0x56baf7[_0x34bd('0x3b')]=_0x264c94['outboundDropCallsDayTimeout'];_0x56baf7[_0x34bd('0x3c')]=_0x264c94[_0x34bd('0x3c')];_0x56baf7[_0x34bd('0x3d')]=_0x264c94[_0x34bd('0x3d')];_0x56baf7[_0x34bd('0x3e')]=_0x264c94[_0x34bd('0x3e')];_0x56baf7['outboundReCallsDay']=_0x264c94['outboundReCallsDay'];_0x56baf7['outboundRejectCallsDay']=_0x264c94[_0x34bd('0x3f')];_0x56baf7[_0x34bd('0x40')]=_0x264c94['outboundUnknownCallsDay'];_0x56baf7['predictiveIntervalAnsweredCalls']=_0x264c94[_0x34bd('0x41')];_0x56baf7['predictiveIntervalAvgHoldtime']=_0x264c94['predictiveIntervalAvgHoldtime'];_0x56baf7[_0x34bd('0x42')]=_0x264c94[_0x34bd('0x42')];_0x56baf7[_0x34bd('0x43')]=_0x264c94[_0x34bd('0x43')];_0x56baf7[_0x34bd('0x44')]=_0x264c94['predictiveIntervalDroppedCallsTimeout'];_0x56baf7['predictiveIntervalErlangCalls']=_0x264c94[_0x34bd('0x45')];_0x56baf7['predictiveIntervalErlangCallsDroppedCalls']=_0x264c94[_0x34bd('0x46')];_0x56baf7[_0x34bd('0x47')]=_0x264c94[_0x34bd('0x47')];_0x56baf7[_0x34bd('0x48')]=_0x264c94[_0x34bd('0x48')];_0x56baf7['predictiveIntervalPauses']=_0x264c94[_0x34bd('0x49')];_0x56baf7[_0x34bd('0x4a')]=_0x264c94[_0x34bd('0x4a')];_0x56baf7[_0x34bd('0x4b')]=_0x264c94['predictiveIntervalTotalCalls'];_0x56baf7[_0x34bd('0x19')]=_0x264c94['message'];_0x56baf7[_0x34bd('0x4c')]=_0x264c94[_0x34bd('0x4c')];_0x56baf7['erlangCalls']=_0x264c94[_0x34bd('0x4d')];_0x56baf7['erlangCallToSecond']=_0x264c94[_0x34bd('0x4e')];_0x56baf7[_0x34bd('0x4f')]=_0x264c94[_0x34bd('0x4f')];_0x56baf7[_0x34bd('0x50')]=_0x264c94[_0x34bd('0x50')];_0x56baf7[_0x34bd('0x51')]=_0x264c94[_0x34bd('0x51')];_0x56baf7['startProgressive']=_0x264c94['startProgressive'];}if(_0x264c94['Trunk']){_0x56baf7[_0x34bd('0x52')]={'id':_0x264c94[_0x34bd('0x52')]['id'],'name':_0x264c94[_0x34bd('0x52')][_0x34bd('0x21')],'active':_0x264c94['Trunk'][_0x34bd('0x53')],'callerid':_0x264c94[_0x34bd('0x52')][_0x34bd('0x54')]};}if(_0x264c94[_0x34bd('0x55')]){_0x56baf7[_0x34bd('0x55')]={'id':_0x264c94['Interval']['id'],'name':_0x264c94[_0x34bd('0x55')]['name']};}_0x4f0dff['push'](_0x56baf7);}}_0x41bffd({'count':_0x4f0dff[_0x34bd('0x56')],'rows':_0x4f0dff});});},'UpdateVoiceQueue':function(_0x53a114){return new Promise(function(_0x8474fb,_0x293457){var _0x18d71e=_[_0x34bd('0x57')](_0x5846f3[_0x34bd('0x1f')],{'id':parseInt(_0x53a114['id'])});var _0x5b061a=_['omit'](_0x53a114,['id']);if(_0x18d71e){for(var _0x33e8e8 in _0x5b061a){if(typeof _0x5b061a[_0x33e8e8]!=='undefined'&&typeof _0x18d71e[_0x33e8e8]!==_0x34bd('0x58')){_0x18d71e[_0x33e8e8]=_0x5b061a[_0x33e8e8];}}_0x8474fb(_0x18d71e);}else{_0x293457();}});},'VoiceChannels':function(_0x223adb){return new Promise(function(_0x23b29,_0x540b04){var _0x4ad00c=_['values'](_0x5846f3['channels']);_0x23b29({'count':_0x4ad00c[_0x34bd('0x56')],'rows':_0x4ad00c});});},'VoiceChannelMixMonitor':function(_0x510c27){var _0x21d2ea=this;return new Promise(function(_0x5c0f86,_0x24033f){if(ami[_0x34bd('0xe')]()==![]){return _0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')]['username'],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}var _0x1f4d0b=schema(properties[_0x34bd('0x59')])[_0x34bd('0x2')](_0x510c27);if(_0x1f4d0b['length']>0x0){return _0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0x1f4d0b,'message')[_0x34bd('0x1c')](',\x20')));}var _0x1a935e=_['find'](_0x5846f3['channels'],{'uniqueid':_0x510c27[_0x34bd('0x5b')]});if(_0x1a935e&&_0x1a935e['channel']){var _0x499642=util[_0x34bd('0x6')](_0x34bd('0x5c'),_0x510c27['filename']||_0x510c27['uniqueid'],_0x510c27['format']||'wav');return ami[_0x34bd('0x17')]({'action':_0x34bd('0x5d'),'channel':_0x1a935e['channel'],'file':_0x499642,'options':'ai(mixmonitorid)'})['then'](function(_0x477fd4){var _0x7df072=_['find'](_0x1a935e[_0x34bd('0x5e')],{'filename':_0x34bd('0x5f')+_0x499642[_0x34bd('0x60')]()});if(_[_0x34bd('0x61')](_0x7df072)){_0x1a935e[_0x34bd('0x5e')][_0x34bd('0x62')]({'filename':'/var/spool/asterisk/monitor/'+_0x499642[_0x34bd('0x60')](),'createdAt':moment()[_0x34bd('0x6')](_0x34bd('0x63')),'mixmonitorid':_0x477fd4[_0x34bd('0x64')],'status':'rec'});}else{_0x7df072[_0x34bd('0x64')]=_0x477fd4['mixmonitorid'];_0x7df072[_0x34bd('0x65')]='rec';}_0x5c0f86({'code':0xc8,'message':[_0x510c27[_0x34bd('0x5b')],_0x34bd('0x66'),_0x477fd4[_0x34bd('0x64')]][_0x34bd('0x1c')]('\x20'),'mixmonitorid':_0x477fd4[_0x34bd('0x64')]});})[_0x34bd('0x1a')](function(_0x6db4ba){_0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f5,[_0x510c27[_0x34bd('0x5b')],_0x6db4ba[_0x34bd('0x19')][_0x34bd('0x60')]()]['join']('\x20')));});}else{return _0x24033f(_0x21d2ea[_0x34bd('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x15fea7){var _0x4f2091=this;return new Promise(function(_0x3fc297,_0x50ed7f){if(ami[_0x34bd('0xe')]()==![]){return _0x50ed7f(_0x4f2091[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')][_0x34bd('0x11')],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}var _0xeffa5d=schema(properties[_0x34bd('0x59')])[_0x34bd('0x2')](_0x15fea7);if(_0xeffa5d[_0x34bd('0x56')]>0x0){return _0x50ed7f(_0x4f2091[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0xeffa5d,_0x34bd('0x19'))[_0x34bd('0x1c')](',\x20')));}var _0x4a0c28=_['find'](_0x5846f3[_0x34bd('0x67')],{'uniqueid':_0x15fea7[_0x34bd('0x5b')]});if(_0x4a0c28){return BPromise[_0x34bd('0x68')]()[_0x34bd('0x18')](function(){if(_0x4a0c28[_0x34bd('0x69')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x4a0c28['channel'],'mixmonitorid':_0x15fea7['mixmonitorid']})[_0x34bd('0x1a')](function(_0x19fde8){});}})['then'](function(){if(_0x4a0c28[_0x34bd('0x6a')]){return ami[_0x34bd('0x17')]({'action':_0x34bd('0x6b'),'channel':_0x4a0c28['destinationchannel'],'mixmonitorid':_0x15fea7[_0x34bd('0x64')]})[_0x34bd('0x1a')](function(_0x2fac2a){});}})[_0x34bd('0x18')](function(_0x1d8e0f){var _0x26e763=_[_0x34bd('0x57')](_0x4a0c28[_0x34bd('0x5e')],{'mixmonitorid':_0x15fea7['mixmonitorid']});if(_0x26e763){_0x26e763['status']=_0x34bd('0x6c');}})['then'](function(){var _0x2959aa=util[_0x34bd('0x6')](_0x34bd('0x5c'),_0x15fea7['filename']||_0x15fea7['uniqueid'],_0x15fea7[_0x34bd('0x6')]||_0x34bd('0x6d'));var _0x3c2e61=_['find'](_0x4a0c28['monitors'],{'filename':_0x34bd('0x5f')+_0x2959aa[_0x34bd('0x60')]()});if(_0x3c2e61){_0x3c2e61[_0x34bd('0x65')]=_0x34bd('0x6c');}})[_0x34bd('0x18')](function(){_0x3fc297({'code':0xc8,'message':[_0x15fea7[_0x34bd('0x5b')],_0x34bd('0x6e')][_0x34bd('0x1c')]('\x20')});})[_0x34bd('0x1a')](function(_0x4f397f){_0x50ed7f(_0x4f2091['error'](0x1f5,[_0x15fea7[_0x34bd('0x5b')],_0x4f397f['message'][_0x34bd('0x60')]()][_0x34bd('0x1c')]('\x20')));});}else{return _0x50ed7f(_0x4f2091[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'VoiceQueuesChannels':function(_0x4a5e55){return new Promise(function(_0x50ae2e,_0x3d60fa){var _0x2273af=_[_0x34bd('0x70')](_0x5846f3['queueChannels']);_0x50ae2e({'count':_0x2273af[_0x34bd('0x56')],'rows':_0x2273af});});},'VoiceQueuesChannel':function(_0x4832d5){var _0x3ec753=this;return new Promise(function(_0x35d9be,_0x171a14){var _0x55876d=schema(properties[_0x34bd('0x71')])['validate'](_0x4832d5);if(_0x55876d['length']>0x0){return _0x171a14(_0x3ec753[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0x55876d,_0x34bd('0x19'))['join'](',\x20')));}var _0x3f909d=_[_0x34bd('0x57')](_0x5846f3[_0x34bd('0x72')],{'uniqueid':_0x4832d5['uniqueid']});if(_0x3f909d){_0x35d9be(_0x3f909d);}else{return _0x171a14(_0x3ec753[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x385ab3){var _0x44fc41=this;return new Promise(function(_0x19ad93,_0xbb9b5d){if(ami[_0x34bd('0xe')]()==![]){return _0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f4,[config[_0x34bd('0x10')]['ip'],config[_0x34bd('0x10')][_0x34bd('0x11')],'ami\x20disconnected'][_0x34bd('0x1c')]('\x20')));}var _0x507806=schema(properties[_0x34bd('0x73')])['validate'](_0x385ab3);if(_0x507806[_0x34bd('0x56')]>0x0){return _0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f4,_[_0x34bd('0x5a')](_0x507806,_0x34bd('0x19'))[_0x34bd('0x1c')](',\x20')));}var _0x4556ce=_[_0x34bd('0x57')](_0x5846f3[_0x34bd('0x72')],{'uniqueid':_0x385ab3[_0x34bd('0x5b')]});if(_0x4556ce&&_0x4556ce[_0x34bd('0x69')]){return ami['Action']({'action':'Hangup','channel':_0x4556ce[_0x34bd('0x69')]})[_0x34bd('0x18')](function(_0xfc56a3){_0x19ad93({'code':0xc8,'message':[_0x385ab3['uniqueid'],_0xfc56a3['message']['toLowerCase']()][_0x34bd('0x1c')]('\x20')});})[_0x34bd('0x1a')](function(_0x438458){_0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f5,[_0x385ab3[_0x34bd('0x5b')],_0x438458['message'][_0x34bd('0x60')]()]['join']('\x20')));});}else{return _0xbb9b5d(_0x44fc41[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x500a25){var _0x36ebad=this;return new Promise(function(_0x5df452,_0x242093){if(ami['isConnected']()==![]){return _0x242093(_0x36ebad[_0x34bd('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x34bd('0x10')][_0x34bd('0x11')],_0x34bd('0x1b')][_0x34bd('0x1c')]('\x20')));}var _0x2de8a0=schema(properties[_0x34bd('0x74')])[_0x34bd('0x2')](_0x500a25);if(_0x2de8a0[_0x34bd('0x56')]>0x0){return _0x242093(_0x36ebad['error'](0x1f4,_[_0x34bd('0x5a')](_0x2de8a0,_0x34bd('0x19'))[_0x34bd('0x1c')](',\x20')));}var _0x49d395=_['find'](_0x5846f3['queueChannels'],{'uniqueid':_0x500a25[_0x34bd('0x5b')]});if(_0x49d395&&_0x49d395[_0x34bd('0x69')]){return ami['Action']({'action':_0x34bd('0x75'),'channel':_0x49d395['channel'],'exten':_0x500a25[_0x34bd('0x76')],'context':_0x500a25[_0x34bd('0x77')]||_0x49d395[_0x34bd('0x77')],'priority':0x1})['then'](function(_0x474c2f){_0x5df452({'code':0xc8,'message':[_0x500a25['uniqueid'],_0x474c2f[_0x34bd('0x19')][_0x34bd('0x60')]()][_0x34bd('0x1c')]('\x20')});})[_0x34bd('0x1a')](function(_0x1fe8cc){_0x242093(_0x36ebad[_0x34bd('0xf')](0x1f5,[_0x500a25[_0x34bd('0x5b')],_0x1fe8cc[_0x34bd('0x19')][_0x34bd('0x60')]()][_0x34bd('0x1c')]('\x20')));});}else{return _0x242093(_0x36ebad[_0x34bd('0xf')](0x1f5,_0x34bd('0x6f')));}});},'Agents':function(_0x44c5d4){return new Promise(function(_0x48d9b9,_0x59c473){var _0x2c1b4f=_[_0x34bd('0x70')](_0x5846f3[_0x34bd('0xb')]);_0x48d9b9({'count':_0x2c1b4f[_0x34bd('0x56')],'rows':_0x2c1b4f});});},'Telephones':function(_0x36aca5){return new Promise(function(_0x49455c,_0x1799dd){var _0x1d4259=_[_0x34bd('0x70')](_0x5846f3[_0x34bd('0x78')]);_0x49455c({'count':_0x1d4259['length'],'rows':_0x1d4259});});},'Trunks':function(_0x2b838a){return new Promise(function(_0x572ac2,_0x5e329b){var _0x49ba99=_['values'](_0x5846f3[_0x34bd('0x79')]);_0x572ac2({'count':_0x49ba99[_0x34bd('0x56')],'rows':_0x49ba99});});},'OutboundChannels':function(_0x6ec278){return new Promise(function(_0x5c8e2e,_0x326888){var _0x21588f=_[_0x34bd('0x70')](_0x5846f3[_0x34bd('0x7a')]);_0x5c8e2e({'count':_0x21588f[_0x34bd('0x56')],'rows':_0x21588f});});},'Outbound':function(_0x1353b0){return new Promise(function(_0x4624fc,_0x5b0585){_0x4624fc(_0x5846f3[_0x34bd('0x2d')]);});},'Campaigns':function(_0x4456c5){return new Promise(function(_0x4451ef,_0x4be22a){var _0x5403fa=_[_0x34bd('0x70')](_0x5846f3['campaigns']);_0x4451ef({'count':_0x5403fa[_0x34bd('0x56')],'rows':_0x5403fa});});},'VoiceQueuesPreview':function(_0x384905){var _0x2e2ba1=this;return new Promise(function(_0x9f4df7,_0x22aa49){_0x2133c5[_0x34bd('0x7b')](_0x384905['id'])[_0x34bd('0x18')](function(_0xf45fee){_0x9f4df7({'code':0xc8,'message':_0xf45fee['message']});})[_0x34bd('0x1a')](function(_0x1ae798){_0x22aa49(_0x2e2ba1[_0x34bd('0xf')](0x1f4,_0x1ae798['message']));});});},'EventManager':function(_0x2b56eb){var _0x4022a0=this;return new Promise(function(_0xca91e2,_0x4502e6){if(!_0x2b56eb['event']){return _0x4502e6(_0x4022a0[_0x34bd('0xf')](0x1f4,_0x34bd('0x7c')));}ami[_0x34bd('0x7d')](_0x34bd('0x7e')+_0x2b56eb[_0x34bd('0x7f')],_0x2b56eb[_0x34bd('0x19')]);_0xca91e2({'code':0xc8,'message':_0x2b56eb});});},'FaxAccounts':function(_0x1203fc){return new Promise(function(_0x193f37,_0x15651a){var _0x3b95f6=_['values'](_0x5846f3[_0x34bd('0x80')]);_0x193f37({'count':_0x3b95f6[_0x34bd('0x56')],'rows':_0x3b95f6});});},'SendFax':function(_0x19d537){var _0x1e9839=this;return new Promise(function(_0x2f7caf,_0x38752d){_0x2a15a2[_0x34bd('0x81')](_0x19d537)[_0x34bd('0x18')](function(_0x199390){_0x2f7caf({'code':0xc8,'message':_0x199390[_0x34bd('0x19')]});})[_0x34bd('0x1a')](function(_0x1d735f){_0x38752d(_0x1e9839[_0x34bd('0xf')](0x1f4,_0x1d735f[_0x34bd('0x19')]));});});},'CheckAfterSend':function(_0x47a050){var _0x70c6a9=this;return new Promise(function(_0x545d68,_0x45ae98){_0x2a15a2[_0x34bd('0x82')](_0x47a050)[_0x34bd('0x18')](function(_0x24d607){_0x545d68({'code':0xc8,'message':_0x24d607[_0x34bd('0x19')]});})[_0x34bd('0x1a')](function(_0x334c57){_0x45ae98(_0x70c6a9[_0x34bd('0xf')](0x1f4,_0x334c57['message']));});});}};var _0x285f8a=jayson[_0x34bd('0x83')](_0x213716)[_0x34bd('0x84')]();_0x285f8a['on']('error',function(_0x4519eb){return _0x3e8744(_0x4519eb);});_0x285f8a[_0x34bd('0x5')](0x232a,_0x34bd('0x85'),function(){console[_0x34bd('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5c2a7a(_0x34bd('0x87')+0x232a);});});}; \ No newline at end of file +var _0x6363=['filename','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','Redirect','context','outboundChannels','campaigns','run','event','emit','faxAccounts','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','Reload','Action','message','command','action','Command','then','catch','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','%s.%s'];(function(_0x111c18,_0xd53027){var _0x2fdb4b=function(_0xc5bacd){while(--_0xc5bacd){_0x111c18['push'](_0x111c18['shift']());}};_0x2fdb4b(++_0xd53027);}(_0x6363,0x13a));var _0x3636=function(_0x1648c2,_0x217aac){_0x1648c2=_0x1648c2-0x0;var _0x400f26=_0x6363[_0x1648c2];return _0x400f26;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var jayson=require(_0x3636('0x1'));var schema=require(_0x3636('0x2'));var BPromise=require(_0x3636('0x3'));var moment=require(_0x3636('0x4'));var config=require(_0x3636('0x5'));var properties=require(_0x3636('0x6'));var ami=require(_0x3636('0x7'));exports[_0x3636('0x8')]=function(_0x1e62e9,_0x3d616f,_0x15728f){return new BPromise(function(_0x1f94ef,_0xdc928c){var _0x17b2a4={'QueuePause':function(_0x583dec){return new Promise(function(_0x19f917,_0x47f84e){var _0x25a0ac=util[_0x3636('0x9')](_0x3636('0xa'),_0x3636('0xb'),_0x583dec[_0x3636('0xc')]);if(_0x1e62e9[_0x3636('0xd')]&&_0x1e62e9[_0x3636('0xd')][_0x25a0ac]&&_0x1e62e9[_0x3636('0xd')][_0x25a0ac][_0x3636('0xe')]){_0x1e62e9['timers'][_0x25a0ac]['updateAcw']();}if(_0x1e62e9[_0x3636('0xf')][_0x25a0ac]){_0x1e62e9['agents'][_0x25a0ac][_0x3636('0x10')]({'statePause':_0x583dec[_0x3636('0x11')]?!![]:![]});}_0x19f917({'code':0xc8,'message':_0x3636('0x12')});});},'Reload':function(_0x13ca35){var _0xfcfee7=this;return new Promise(function(_0x319cd7,_0x2088fc){if(ami[_0x3636('0x13')]()==![]){return _0x2088fc(_0xfcfee7[_0x3636('0x14')](0x1f4,[config[_0x3636('0x15')]['ip'],config[_0x3636('0x15')][_0x3636('0x16')],_0x3636('0x17')][_0x3636('0x18')]('\x20')));}_0x13ca35=_[_0x3636('0x19')](_0x13ca35,_[_0x3636('0x1a')](properties[_0x3636('0x1b')]));_0x13ca35['action']=_0x3636('0x1c');return ami[_0x3636('0x1d')](_0x13ca35)['then'](function(_0xe3be56){_0x319cd7({'code':0xc8,'message':_0xe3be56['message']});})['catch'](function(_0xae6469){_0x2088fc(_0xfcfee7[_0x3636('0x14')](0x1f5,_0xae6469[_0x3636('0x1e')]));});});},'Command':function(_0xc1c96d){var _0xe0e633=this;return new Promise(function(_0x39e367,_0xa2b8fe){if(ami[_0x3636('0x13')]()==![]){return _0xa2b8fe(_0xe0e633['error'](0x1f4,[config['asterisk']['ip'],config[_0x3636('0x15')][_0x3636('0x16')],_0x3636('0x17')]['join']('\x20')));}_0xc1c96d=_[_0x3636('0x19')](_0xc1c96d,_0x3636('0x1f'));_0xc1c96d[_0x3636('0x20')]=_0x3636('0x21');return ami[_0x3636('0x1d')](_0xc1c96d)[_0x3636('0x22')](function(_0x4f5b0e){_0x39e367({'code':0xc8,'message':_0x4f5b0e['content']});})[_0x3636('0x23')](function(_0x4ee098){_0xa2b8fe(_0xe0e633['error'](0x1f5,_0x4ee098[_0x3636('0x1e')]));});});},'VoiceQueues':function(_0x57f7c6){return new Promise(function(_0x4182b7,_0x4c24cf){var _0x36f4c5=[];for(var _0x477c34 in _0x1e62e9[_0x3636('0x24')]){if(_0x1e62e9[_0x3636('0x24')][_0x3636('0x25')](_0x477c34)){var _0x20ca8b=_0x1e62e9[_0x3636('0x24')][_0x477c34];var _0x3c3d45={'id':_0x20ca8b['id'],'name':_0x20ca8b[_0x3636('0xc')],'strategy':_0x20ca8b[_0x3636('0x26')],'answered':_0x20ca8b[_0x3636('0x27')],'available':_0x20ca8b['available'],'loggedIn':_0x20ca8b[_0x3636('0x28')],'pTalking':_0x20ca8b[_0x3636('0x29')],'sumBillable':_0x20ca8b[_0x3636('0x2a')],'sumDuration':_0x20ca8b[_0x3636('0x2b')],'sumHoldTime':_0x20ca8b[_0x3636('0x2c')]||0x0,'talking':_0x20ca8b[_0x3636('0x2d')],'total':_0x20ca8b['total'],'type':_0x20ca8b[_0x3636('0x2e')],'unmanaged':_0x20ca8b[_0x3636('0x2f')],'abandoned':_0x20ca8b['abandoned'],'waiting':_0x20ca8b[_0x3636('0x30')],'loggedInDb':_0x20ca8b[_0x3636('0x31')]};if(_0x20ca8b[_0x3636('0x2e')]===_0x3636('0x32')){_0x3c3d45[_0x3636('0x33')]=_0x20ca8b['dialActive'];_0x3c3d45[_0x3636('0x34')]=_0x20ca8b[_0x3636('0x34')];_0x3c3d45[_0x3636('0x35')]=_0x20ca8b[_0x3636('0x35')];_0x3c3d45[_0x3636('0x36')]=_0x20ca8b[_0x3636('0x36')];_0x3c3d45[_0x3636('0x37')]=_0x20ca8b[_0x3636('0x37')];_0x3c3d45[_0x3636('0x38')]=_0x20ca8b['dialPrefix'];_0x3c3d45['temp']=_0x20ca8b[_0x3636('0x39')];_0x3c3d45['outboundAnswerAgiCallsDay']=_0x20ca8b['outboundAnswerAgiCallsDay'];_0x3c3d45[_0x3636('0x3a')]=_0x20ca8b[_0x3636('0x3a')];_0x3c3d45[_0x3636('0x3b')]=_0x20ca8b['outboundBlacklistCallsDay'];_0x3c3d45[_0x3636('0x3c')]=_0x20ca8b[_0x3636('0x3c')];_0x3c3d45[_0x3636('0x3d')]=_0x20ca8b[_0x3636('0x3d')];_0x3c3d45[_0x3636('0x3e')]=_0x20ca8b[_0x3636('0x3e')];_0x3c3d45[_0x3636('0x3f')]=_0x20ca8b[_0x3636('0x3f')];_0x3c3d45[_0x3636('0x40')]=_0x20ca8b[_0x3636('0x40')];_0x3c3d45[_0x3636('0x41')]=_0x20ca8b[_0x3636('0x41')];_0x3c3d45[_0x3636('0x42')]=_0x20ca8b['outboundNoSuchCallsDay'];_0x3c3d45[_0x3636('0x43')]=_0x20ca8b[_0x3636('0x43')];_0x3c3d45[_0x3636('0x44')]=_0x20ca8b[_0x3636('0x44')];_0x3c3d45['outboundRejectCallsDay']=_0x20ca8b['outboundRejectCallsDay'];_0x3c3d45[_0x3636('0x45')]=_0x20ca8b[_0x3636('0x45')];_0x3c3d45[_0x3636('0x46')]=_0x20ca8b['predictiveIntervalAnsweredCalls'];_0x3c3d45[_0x3636('0x47')]=_0x20ca8b[_0x3636('0x47')];_0x3c3d45['predictiveIntervalAvgTalktime']=_0x20ca8b['predictiveIntervalAvgTalktime'];_0x3c3d45[_0x3636('0x48')]=_0x20ca8b['predictiveIntervalDroppedCallsCallersExit'];_0x3c3d45[_0x3636('0x49')]=_0x20ca8b[_0x3636('0x49')];_0x3c3d45[_0x3636('0x4a')]=_0x20ca8b[_0x3636('0x4a')];_0x3c3d45[_0x3636('0x4b')]=_0x20ca8b[_0x3636('0x4b')];_0x3c3d45[_0x3636('0x4c')]=_0x20ca8b[_0x3636('0x4c')];_0x3c3d45[_0x3636('0x4d')]=_0x20ca8b['predictiveIntervalMultiplicativeFactor'];_0x3c3d45[_0x3636('0x4e')]=_0x20ca8b[_0x3636('0x4e')];_0x3c3d45[_0x3636('0x4f')]=_0x20ca8b[_0x3636('0x4f')];_0x3c3d45[_0x3636('0x50')]=_0x20ca8b[_0x3636('0x50')];_0x3c3d45[_0x3636('0x1e')]=_0x20ca8b[_0x3636('0x1e')];_0x3c3d45[_0x3636('0x51')]=_0x20ca8b['originated'];_0x3c3d45[_0x3636('0x52')]=_0x20ca8b[_0x3636('0x52')];_0x3c3d45[_0x3636('0x53')]=_0x20ca8b[_0x3636('0x53')];_0x3c3d45[_0x3636('0x54')]=_0x20ca8b[_0x3636('0x54')];_0x3c3d45[_0x3636('0x55')]=_0x20ca8b[_0x3636('0x55')];_0x3c3d45[_0x3636('0x56')]=_0x20ca8b[_0x3636('0x56')];_0x3c3d45[_0x3636('0x57')]=_0x20ca8b[_0x3636('0x57')];}if(_0x20ca8b[_0x3636('0x58')]){_0x3c3d45[_0x3636('0x58')]={'id':_0x20ca8b[_0x3636('0x58')]['id'],'name':_0x20ca8b['Trunk'][_0x3636('0xc')],'active':_0x20ca8b[_0x3636('0x58')][_0x3636('0x59')],'callerid':_0x20ca8b[_0x3636('0x58')][_0x3636('0x5a')]};}if(_0x20ca8b[_0x3636('0x5b')]){_0x3c3d45[_0x3636('0x5b')]={'id':_0x20ca8b[_0x3636('0x5b')]['id'],'name':_0x20ca8b[_0x3636('0x5b')][_0x3636('0xc')]};}_0x36f4c5[_0x3636('0x5c')](_0x3c3d45);}}_0x4182b7({'count':_0x36f4c5[_0x3636('0x5d')],'rows':_0x36f4c5});});},'UpdateVoiceQueue':function(_0x38b7fc){return new Promise(function(_0x594906,_0x4ed1d7){var _0x5b54f9=_[_0x3636('0x5e')](_0x1e62e9['voiceQueues'],{'id':parseInt(_0x38b7fc['id'])});var _0x5863a9=_[_0x3636('0x5f')](_0x38b7fc,['id']);if(_0x5b54f9){for(var _0xb39a2a in _0x5863a9){if(typeof _0x5863a9[_0xb39a2a]!==_0x3636('0x60')&&typeof _0x5b54f9[_0xb39a2a]!=='undefined'){_0x5b54f9[_0xb39a2a]=_0x5863a9[_0xb39a2a];}}_0x594906(_0x5b54f9);}else{_0x4ed1d7();}});},'VoiceChannels':function(_0x2683ea){return new Promise(function(_0x268080,_0x349349){var _0x179410=_[_0x3636('0x61')](_0x1e62e9[_0x3636('0x62')]);_0x268080({'count':_0x179410[_0x3636('0x5d')],'rows':_0x179410});});},'VoiceChannelMixMonitor':function(_0x3a350d){var _0xc929c7=this;return new Promise(function(_0x5ac865,_0x2276bb){if(ami[_0x3636('0x13')]()==![]){return _0x2276bb(_0xc929c7[_0x3636('0x14')](0x1f4,[config[_0x3636('0x15')]['ip'],config[_0x3636('0x15')][_0x3636('0x16')],'ami\x20disconnected'][_0x3636('0x18')]('\x20')));}var _0xf79c81=schema(properties[_0x3636('0x63')])[_0x3636('0x2')](_0x3a350d);if(_0xf79c81[_0x3636('0x5d')]>0x0){return _0x2276bb(_0xc929c7['error'](0x1f4,_[_0x3636('0x64')](_0xf79c81,_0x3636('0x1e'))[_0x3636('0x18')](',\x20')));}var _0x61522d=_[_0x3636('0x5e')](_0x1e62e9['channels'],{'uniqueid':_0x3a350d[_0x3636('0x65')]});if(_0x61522d&&_0x61522d['channel']){var _0x54deca=util[_0x3636('0x9')](_0x3636('0x66'),_0x3a350d[_0x3636('0x67')]||_0x3a350d[_0x3636('0x65')],_0x3a350d['format']||'wav');return ami[_0x3636('0x1d')]({'action':_0x3636('0x68'),'channel':_0x61522d[_0x3636('0x69')],'file':_0x54deca,'options':_0x3636('0x6a')})[_0x3636('0x22')](function(_0x3f342e){var _0x545e6f=_[_0x3636('0x5e')](_0x61522d[_0x3636('0x6b')],{'filename':_0x3636('0x6c')+_0x54deca[_0x3636('0x6d')]()});if(_[_0x3636('0x6e')](_0x545e6f)){_0x61522d[_0x3636('0x6b')][_0x3636('0x5c')]({'filename':_0x3636('0x6c')+_0x54deca['toLowerCase'](),'createdAt':moment()[_0x3636('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3f342e[_0x3636('0x6f')],'status':'rec'});}else{_0x545e6f[_0x3636('0x6f')]=_0x3f342e[_0x3636('0x6f')];_0x545e6f[_0x3636('0x70')]=_0x3636('0x71');}_0x5ac865({'code':0xc8,'message':[_0x3a350d[_0x3636('0x65')],_0x3636('0x72'),_0x3f342e['mixmonitorid']][_0x3636('0x18')]('\x20'),'mixmonitorid':_0x3f342e['mixmonitorid']});})[_0x3636('0x23')](function(_0x449657){_0x2276bb(_0xc929c7[_0x3636('0x14')](0x1f5,[_0x3a350d[_0x3636('0x65')],_0x449657['message'][_0x3636('0x6d')]()][_0x3636('0x18')]('\x20')));});}else{return _0x2276bb(_0xc929c7[_0x3636('0x14')](0x1f5,_0x3636('0x73')));}});},'VoiceChannelStopMixMonitor':function(_0x315c62){var _0x25b5cc=this;return new Promise(function(_0x802ea9,_0x11ec51){if(ami[_0x3636('0x13')]()==![]){return _0x11ec51(_0x25b5cc['error'](0x1f4,[config[_0x3636('0x15')]['ip'],config[_0x3636('0x15')][_0x3636('0x16')],_0x3636('0x17')][_0x3636('0x18')]('\x20')));}var _0xbeddf8=schema(properties[_0x3636('0x63')])[_0x3636('0x2')](_0x315c62);if(_0xbeddf8[_0x3636('0x5d')]>0x0){return _0x11ec51(_0x25b5cc[_0x3636('0x14')](0x1f4,_[_0x3636('0x64')](_0xbeddf8,_0x3636('0x1e'))[_0x3636('0x18')](',\x20')));}var _0x55d388=_[_0x3636('0x5e')](_0x1e62e9[_0x3636('0x62')],{'uniqueid':_0x315c62[_0x3636('0x65')]});if(_0x55d388){return BPromise[_0x3636('0x74')]()[_0x3636('0x22')](function(){if(_0x55d388[_0x3636('0x69')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x55d388[_0x3636('0x69')],'mixmonitorid':_0x315c62[_0x3636('0x6f')]})[_0x3636('0x23')](function(_0x477cae){});}})[_0x3636('0x22')](function(){if(_0x55d388[_0x3636('0x75')]){return ami[_0x3636('0x1d')]({'action':_0x3636('0x76'),'channel':_0x55d388['destinationchannel'],'mixmonitorid':_0x315c62[_0x3636('0x6f')]})['catch'](function(_0x2a461b){});}})[_0x3636('0x22')](function(_0x228716){var _0x4893ee=_[_0x3636('0x5e')](_0x55d388['monitors'],{'mixmonitorid':_0x315c62[_0x3636('0x6f')]});if(_0x4893ee){_0x4893ee[_0x3636('0x70')]=_0x3636('0x77');}})[_0x3636('0x22')](function(){var _0x951778=util[_0x3636('0x9')](_0x3636('0x66'),_0x315c62[_0x3636('0x67')]||_0x315c62[_0x3636('0x65')],_0x315c62[_0x3636('0x9')]||'wav');var _0x580b9d=_['find'](_0x55d388[_0x3636('0x6b')],{'filename':'/var/spool/asterisk/monitor/'+_0x951778[_0x3636('0x6d')]()});if(_0x580b9d){_0x580b9d[_0x3636('0x70')]=_0x3636('0x77');}})['then'](function(){_0x802ea9({'code':0xc8,'message':[_0x315c62[_0x3636('0x65')],_0x3636('0x78')][_0x3636('0x18')]('\x20')});})[_0x3636('0x23')](function(_0x595515){_0x11ec51(_0x25b5cc[_0x3636('0x14')](0x1f5,[_0x315c62['uniqueid'],_0x595515[_0x3636('0x1e')]['toLowerCase']()]['join']('\x20')));});}else{return _0x11ec51(_0x25b5cc[_0x3636('0x14')](0x1f5,_0x3636('0x73')));}});},'VoiceQueuesChannels':function(_0x7facfb){return new Promise(function(_0x3a980e,_0x323e43){var _0x44c747=_['values'](_0x1e62e9['queueChannels']);_0x3a980e({'count':_0x44c747[_0x3636('0x5d')],'rows':_0x44c747});});},'VoiceQueuesChannel':function(_0x561a43){var _0xf3ce3c=this;return new Promise(function(_0x2cae42,_0x329cef){var _0x1ed156=schema(properties[_0x3636('0x79')])[_0x3636('0x2')](_0x561a43);if(_0x1ed156[_0x3636('0x5d')]>0x0){return _0x329cef(_0xf3ce3c[_0x3636('0x14')](0x1f4,_['map'](_0x1ed156,_0x3636('0x1e'))['join'](',\x20')));}var _0x5d62a6=_[_0x3636('0x5e')](_0x1e62e9[_0x3636('0x7a')],{'uniqueid':_0x561a43[_0x3636('0x65')]});if(_0x5d62a6){_0x2cae42(_0x5d62a6);}else{return _0x329cef(_0xf3ce3c[_0x3636('0x14')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x29a8dc){var _0x4b9974=this;return new Promise(function(_0x534419,_0x292369){if(ami[_0x3636('0x13')]()==![]){return _0x292369(_0x4b9974[_0x3636('0x14')](0x1f4,[config[_0x3636('0x15')]['ip'],config[_0x3636('0x15')]['username'],_0x3636('0x17')][_0x3636('0x18')]('\x20')));}var _0x38df4d=schema(properties[_0x3636('0x7b')])[_0x3636('0x2')](_0x29a8dc);if(_0x38df4d[_0x3636('0x5d')]>0x0){return _0x292369(_0x4b9974[_0x3636('0x14')](0x1f4,_[_0x3636('0x64')](_0x38df4d,_0x3636('0x1e'))[_0x3636('0x18')](',\x20')));}var _0x41c3ef=_[_0x3636('0x5e')](_0x1e62e9['queueChannels'],{'uniqueid':_0x29a8dc['uniqueid']});if(_0x41c3ef&&_0x41c3ef['channel']){return ami[_0x3636('0x1d')]({'action':_0x3636('0x7c'),'channel':_0x41c3ef[_0x3636('0x69')]})['then'](function(_0x188b5c){_0x534419({'code':0xc8,'message':[_0x29a8dc['uniqueid'],_0x188b5c[_0x3636('0x1e')]['toLowerCase']()][_0x3636('0x18')]('\x20')});})['catch'](function(_0xcc4aec){_0x292369(_0x4b9974[_0x3636('0x14')](0x1f5,[_0x29a8dc['uniqueid'],_0xcc4aec[_0x3636('0x1e')]['toLowerCase']()]['join']('\x20')));});}else{return _0x292369(_0x4b9974[_0x3636('0x14')](0x1f5,_0x3636('0x73')));}});},'VoiceQueuesChannelRedirect':function(_0x3ff4db){var _0x30bdad=this;return new Promise(function(_0x3e0723,_0x3ef376){if(ami[_0x3636('0x13')]()==![]){return _0x3ef376(_0x30bdad[_0x3636('0x14')](0x1f4,[config[_0x3636('0x15')]['ip'],config[_0x3636('0x15')]['username'],_0x3636('0x17')][_0x3636('0x18')]('\x20')));}var _0x709ffc=schema(properties['voicequeuechannelredirect'])[_0x3636('0x2')](_0x3ff4db);if(_0x709ffc[_0x3636('0x5d')]>0x0){return _0x3ef376(_0x30bdad[_0x3636('0x14')](0x1f4,_['map'](_0x709ffc,_0x3636('0x1e'))[_0x3636('0x18')](',\x20')));}var _0x573dba=_['find'](_0x1e62e9[_0x3636('0x7a')],{'uniqueid':_0x3ff4db[_0x3636('0x65')]});if(_0x573dba&&_0x573dba['channel']){return ami[_0x3636('0x1d')]({'action':_0x3636('0x7d'),'channel':_0x573dba['channel'],'exten':_0x3ff4db['exten'],'context':_0x3ff4db[_0x3636('0x7e')]||_0x573dba[_0x3636('0x7e')],'priority':0x1})['then'](function(_0x1ffdd4){_0x3e0723({'code':0xc8,'message':[_0x3ff4db[_0x3636('0x65')],_0x1ffdd4['message'][_0x3636('0x6d')]()][_0x3636('0x18')]('\x20')});})[_0x3636('0x23')](function(_0x403604){_0x3ef376(_0x30bdad[_0x3636('0x14')](0x1f5,[_0x3ff4db[_0x3636('0x65')],_0x403604[_0x3636('0x1e')][_0x3636('0x6d')]()][_0x3636('0x18')]('\x20')));});}else{return _0x3ef376(_0x30bdad[_0x3636('0x14')](0x1f5,_0x3636('0x73')));}});},'Agents':function(_0x18d5a6){return new Promise(function(_0x331b59,_0x3d4c7f){var _0x56c9c1=_[_0x3636('0x61')](_0x1e62e9[_0x3636('0xf')]);_0x331b59({'count':_0x56c9c1[_0x3636('0x5d')],'rows':_0x56c9c1});});},'Telephones':function(_0x2645e5){return new Promise(function(_0x487ef2,_0xbbd8a2){var _0x270ddf=_[_0x3636('0x61')](_0x1e62e9['telephones']);_0x487ef2({'count':_0x270ddf[_0x3636('0x5d')],'rows':_0x270ddf});});},'Trunks':function(_0x3e823e){return new Promise(function(_0x58c9f7,_0x3fa861){var _0x28aa3f=_[_0x3636('0x61')](_0x1e62e9['trunks']);_0x58c9f7({'count':_0x28aa3f[_0x3636('0x5d')],'rows':_0x28aa3f});});},'OutboundChannels':function(_0x2acc4d){return new Promise(function(_0x2dcbf0,_0x1a47d1){var _0x12d9f4=_[_0x3636('0x61')](_0x1e62e9[_0x3636('0x7f')]);_0x2dcbf0({'count':_0x12d9f4[_0x3636('0x5d')],'rows':_0x12d9f4});});},'Outbound':function(_0x156879){return new Promise(function(_0x31aa2d,_0x55ba76){_0x31aa2d(_0x1e62e9['outbound']);});},'Campaigns':function(_0x1791eb){return new Promise(function(_0x3d517c,_0x4ae28b){var _0x2f597c=_[_0x3636('0x61')](_0x1e62e9[_0x3636('0x80')]);_0x3d517c({'count':_0x2f597c[_0x3636('0x5d')],'rows':_0x2f597c});});},'VoiceQueuesPreview':function(_0x48b60a){var _0xb8082a=this;return new Promise(function(_0x18e951,_0xf21ea7){_0x3d616f[_0x3636('0x81')](_0x48b60a['id'])['then'](function(_0x450d6b){_0x18e951({'code':0xc8,'message':_0x450d6b['message']});})['catch'](function(_0x4cbf20){_0xf21ea7(_0xb8082a['error'](0x1f4,_0x4cbf20[_0x3636('0x1e')]));});});},'EventManager':function(_0x32b521){var _0x25beb5=this;return new Promise(function(_0x14b59e,_0x30b5d3){if(!_0x32b521[_0x3636('0x82')]){return _0x30b5d3(_0x25beb5['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x3636('0x83')]('custom:'+_0x32b521['event'],_0x32b521[_0x3636('0x1e')]);_0x14b59e({'code':0xc8,'message':_0x32b521});});},'FaxAccounts':function(_0x3b10f8){return new Promise(function(_0x1ab5f9,_0x2974db){var _0x2b36ad=_[_0x3636('0x61')](_0x1e62e9[_0x3636('0x84')]);_0x1ab5f9({'count':_0x2b36ad[_0x3636('0x5d')],'rows':_0x2b36ad});});},'SendFax':function(_0x3f1699){var _0x565220=this;return new Promise(function(_0x408a3e,_0x2d2ef5){_0x15728f['send'](_0x3f1699)[_0x3636('0x22')](function(_0x477792){_0x408a3e({'code':0xc8,'message':_0x477792[_0x3636('0x1e')]});})[_0x3636('0x23')](function(_0x1459f9){_0x2d2ef5(_0x565220[_0x3636('0x14')](0x1f4,_0x1459f9[_0x3636('0x1e')]));});});},'CheckAfterSend':function(_0x2bbbeb){var _0x32768e=this;return new Promise(function(_0x12366b,_0xbabc14){_0x15728f['checkAfterSend'](_0x2bbbeb)['then'](function(_0x3f8192){_0x12366b({'code':0xc8,'message':_0x3f8192[_0x3636('0x1e')]});})[_0x3636('0x23')](function(_0x16c543){_0xbabc14(_0x32768e[_0x3636('0x14')](0x1f4,_0x16c543['message']));});});}};var _0x2c0769=jayson[_0x3636('0x85')](_0x17b2a4)[_0x3636('0x86')]();_0x2c0769['on']('error',function(_0x2a61db){return _0xdc928c(_0x2a61db);});_0x2c0769[_0x3636('0x8')](0x232a,_0x3636('0x87'),function(){console[_0x3636('0x88')](_0x3636('0x89'),0x232a);return _0x1f94ef(_0x3636('0x8a')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 7abc3c9..aca9ac4 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 _0x81bd=['Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt','union','resolve','then','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','','calleridname'];(function(_0x475e33,_0x42824a){var _0x318871=function(_0x54394c){while(--_0x54394c){_0x475e33['push'](_0x475e33['shift']());}};_0x318871(++_0x42824a);}(_0x81bd,0x7c));var _0xd81b=function(_0x11afe7,_0x2dcbae){_0x11afe7=_0x11afe7-0x0;var _0x2967b5=_0x81bd[_0x11afe7];return _0x2967b5;};'use strict';var _=require(_0xd81b('0x0'));var BPromise=require(_0xd81b('0x1'));var Redis=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var config=require(_0xd81b('0x4'));var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xd81b('0x7')]=_[_0xd81b('0x8')](config[_0xd81b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd81b('0x9'))(new Redis(config[_0xd81b('0x7')]));function emit(_0x1f3f2c,_0x562084,_0x5e14e8,_0xa4cf97,_0x5468d5){logger[_0xd81b('0xa')](_0xd81b('0xb'),_0x1f3f2c,_0x562084['id'],_0x5e14e8,_0xa4cf97,JSON[_0xd81b('0xc')](_0x5468d5));io['to'](_0x5e14e8)[_0xd81b('0xd')](_0xa4cf97,_0x5468d5);}exports[_0xd81b('0xe')]=function(_0x1ff60f,_0x4391be,_0x17e09f,_0x2090e1){var _0x23c789,_0x215b92;var _0x3914f7={};var _0x1afb8f=Number(_0x17e09f['data1']);var _0x21dfff=_0x17e09f['data2']?Boolean(Number(_0x17e09f[_0xd81b('0xf')])):![];var _0xe75568;var _0x5f0b6b=![];if(!_[_0xd81b('0x10')](_0x17e09f['data5'])){if(_0x17e09f[_0xd81b('0x11')]=='1')_0x5f0b6b=!![];}if(!_0x5f0b6b){if(_0x2090e1[_0xd81b('0x12')]){_0x3914f7['id']=_0x2090e1[_0xd81b('0x12')];}}if(!_0x3914f7['id']){_0x3914f7[_0xd81b('0x13')]=_0x1afb8f;_0xe75568=_0x17e09f[_0xd81b('0x14')]&&_0x17e09f['data3']!=='0'?_0x17e09f[_0xd81b('0x14')][_0xd81b('0x15')](','):['phone'];_0x3914f7[_0xd81b('0x16')]=_[_0xd81b('0x17')](_0xe75568,function(_0x4657cf){var _0x15e860={};_0x15e860[_0x4657cf]=_0x2090e1[_0xd81b('0x18')]?_0x2090e1[_0xd81b('0x19')]:_0x2090e1[_0xd81b('0x1a')];return _0x15e860;});}var _0x3d4d34=['id',_0xd81b('0x1b'),_0xd81b('0x1c'),_0xd81b('0x1d'),_0xd81b('0x1e'),_0xd81b('0x1f'),_0xd81b('0x13'),_0xd81b('0x20'),_0xd81b('0x21'),'updatedAt'];var _0x4d566e=_[_0xd81b('0x22')](_0x3d4d34,_0xe75568);BPromise[_0xd81b('0x23')]()[_0xd81b('0x24')](cmContactRpc['getContacts']({'attributes':_0x4d566e,'where':_0x3914f7}))[_0xd81b('0x24')](function(_0x6571a6){_0x215b92=_0x6571a6;if(!_['isEmpty'](_0x215b92)){if(_0x215b92[_0xd81b('0x25')]===0x1){_0x23c789=_0x215b92[0x0];logger[_0xd81b('0xa')](_0xd81b('0x26'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_0x23c789['id']);}else{logger[_0xd81b('0xa')](_0xd81b('0x28'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_[_0xd81b('0x17')](_0x215b92,'id')[_0xd81b('0x29')](','));}return;}else{logger[_0xd81b('0xa')](_0xd81b('0x2a'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);var _0x596389={'ListId':_0x1afb8f};var _0x28768f=_0x17e09f[_0xd81b('0x2b')]&&_0x17e09f[_0xd81b('0x2b')]!=='0'?_0x17e09f[_0xd81b('0x2b')]:_0xd81b('0x1d');if(_0x21dfff){logger[_0xd81b('0xa')](_0xd81b('0x2c'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);_0x596389[_0x28768f]=_[_0xd81b('0x10')](_0x2090e1['routeId'])?_0x2090e1[_0xd81b('0x1a')]:_0x2090e1['destcalleridnum'];if(_['isNil'](_0x2090e1[_0xd81b('0x18')])){_0x596389[_0xd81b('0x1b')]=_0x2090e1['calleridname']&&_0x2090e1['calleridname']!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x2e')]:_0xd81b('0x2f');}else{_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x30')]&&_0x2090e1[_0xd81b('0x30')]!==''?_0x2090e1[_0xd81b('0x30')]:_0xd81b('0x2f');}return BPromise['resolve']()['then'](cmContactRpc[_0xd81b('0x31')](_0x596389))[_0xd81b('0x24')](function(_0x50472a){_0x23c789=_0x50472a;_0x215b92['push'](_0x50472a);if(_0x23c789){logger['info'](_0xd81b('0x32'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id'],_0x23c789['id']);}return;});}else{logger[_0xd81b('0xa')](_0xd81b('0x33'),_0x2090e1[_0xd81b('0x27')],_0x4391be['id']);_0x596389[_0x28768f]=_[_0xd81b('0x10')](_0x2090e1[_0xd81b('0x18')])?_0x2090e1['calleridnum']:_0x2090e1[_0xd81b('0x19')];if(_['isNil'](_0x2090e1[_0xd81b('0x18')])){_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x2e')]&&_0x2090e1[_0xd81b('0x2e')]!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x2e')]:_0xd81b('0x2f');}else{_0x596389[_0xd81b('0x1b')]=_0x2090e1[_0xd81b('0x30')]&&_0x2090e1[_0xd81b('0x30')]!==_0xd81b('0x2d')?_0x2090e1[_0xd81b('0x30')]:_0xd81b('0x2f');}_0x23c789=_0x596389;_0x215b92['push'](_0x596389);return;}}})['then'](function(){if(_0x1ff60f){emit(_0x2090e1[_0xd81b('0x27')],_0x4391be,util[_0xd81b('0x34')](_0xd81b('0x35'),_0x1ff60f['name']),util[_0xd81b('0x34')](_0xd81b('0x36'),_0x17e09f['action'][_0xd81b('0x37')]()),{'evt':_[_0xd81b('0x38')](_0x2090e1,{'autoCreate':_0x21dfff}),'contact':_0x23c789===undefined?{}:_0x23c789,'contacts':_0x215b92['length']===0x0?undefined:_0x215b92});}});}; \ No newline at end of file +var _0x7bae=['data5','xmd-contactid','ListId','data3','map','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','routeId','','calleridname','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridnum','format','user:%s','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil'];(function(_0x155eef,_0x394e3d){var _0xd9afcd=function(_0x5b52bc){while(--_0x5b52bc){_0x155eef['push'](_0x155eef['shift']());}};_0xd9afcd(++_0x394e3d);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x7bae[_0x3826ad];return _0x17b900;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xe7ba('0x0'));var util=require(_0xe7ba('0x1'));var config=require('../../../../config/environment');var logger=require(_0xe7ba('0x2'))('trigger');var cmContactRpc=require(_0xe7ba('0x3'));config[_0xe7ba('0x4')]=_[_0xe7ba('0x5')](config[_0xe7ba('0x4')],{'host':_0xe7ba('0x6'),'port':0x18eb});var io=require(_0xe7ba('0x7'))(new Redis(config[_0xe7ba('0x4')]));function emit(_0x3c5e59,_0x10b307,_0x34fb18,_0x160565,_0x27b1d5){logger[_0xe7ba('0x8')](_0xe7ba('0x9'),_0x3c5e59,_0x10b307['id'],_0x34fb18,_0x160565,JSON['stringify'](_0x27b1d5));io['to'](_0x34fb18)[_0xe7ba('0xa')](_0x160565,_0x27b1d5);}exports[_0xe7ba('0xb')]=function(_0x375ebb,_0x276bc3,_0x15083a,_0x1672f0){var _0x99a86f,_0x448bcc;var _0x194447={};var _0x4b6597=Number(_0x15083a[_0xe7ba('0xc')]);var _0x588c8b=_0x15083a[_0xe7ba('0xd')]?Boolean(Number(_0x15083a[_0xe7ba('0xd')])):![];var _0x390596;var _0x17e4e6=![];if(!_[_0xe7ba('0xe')](_0x15083a[_0xe7ba('0xf')])){if(_0x15083a['data5']=='1')_0x17e4e6=!![];}if(!_0x17e4e6){if(_0x1672f0['xmd-contactid']){_0x194447['id']=_0x1672f0[_0xe7ba('0x10')];}}if(!_0x194447['id']){_0x194447[_0xe7ba('0x11')]=_0x4b6597;_0x390596=_0x15083a[_0xe7ba('0x12')]&&_0x15083a['data3']!=='0'?_0x15083a[_0xe7ba('0x12')]['split'](','):['phone'];_0x194447['$or']=_[_0xe7ba('0x13')](_0x390596,function(_0x4e87f5){var _0x41a773={};_0x41a773[_0x4e87f5]=_0x1672f0['routeId']?_0x1672f0['destcalleridnum']:_0x1672f0['calleridnum'];return _0x41a773;});}var _0x3f326a=['id',_0xe7ba('0x14'),_0xe7ba('0x15'),_0xe7ba('0x16'),_0xe7ba('0x17'),'fax',_0xe7ba('0x11'),_0xe7ba('0x18'),_0xe7ba('0x19'),_0xe7ba('0x1a')];var _0x4aaf35=_[_0xe7ba('0x1b')](_0x3f326a,_0x390596);BPromise[_0xe7ba('0x1c')]()['then'](cmContactRpc[_0xe7ba('0x1d')]({'attributes':_0x4aaf35,'where':_0x194447}))[_0xe7ba('0x1e')](function(_0x27c882){_0x448bcc=_0x27c882;if(!_[_0xe7ba('0x1f')](_0x448bcc)){if(_0x448bcc[_0xe7ba('0x20')]===0x1){_0x99a86f=_0x448bcc[0x0];logger[_0xe7ba('0x8')](_0xe7ba('0x21'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id'],_0x99a86f['id']);}else{logger[_0xe7ba('0x8')](_0xe7ba('0x23'),_0x1672f0['uniqueid'],_0x276bc3['id'],_['map'](_0x448bcc,'id')['join'](','));}return;}else{logger['info'](_0xe7ba('0x24'),_0x1672f0['uniqueid'],_0x276bc3['id']);var _0x4ecc0d={'ListId':_0x4b6597};var _0x5ece11=_0x15083a[_0xe7ba('0x25')]&&_0x15083a[_0xe7ba('0x25')]!=='0'?_0x15083a[_0xe7ba('0x25')]:_0xe7ba('0x16');if(_0x588c8b){logger[_0xe7ba('0x8')](_0xe7ba('0x26'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id']);_0x4ecc0d[_0x5ece11]=_[_0xe7ba('0xe')](_0x1672f0['routeId'])?_0x1672f0[_0xe7ba('0x27')]:_0x1672f0['destcalleridnum'];if(_[_0xe7ba('0xe')](_0x1672f0[_0xe7ba('0x28')])){_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0['calleridname']&&_0x1672f0['calleridname']!==_0xe7ba('0x29')?_0x1672f0[_0xe7ba('0x2a')]:_0xe7ba('0x2b');}else{_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0[_0xe7ba('0x2c')]&&_0x1672f0['destcalleridname']!==_0xe7ba('0x29')?_0x1672f0[_0xe7ba('0x2c')]:'Unknown';}return BPromise[_0xe7ba('0x1c')]()['then'](cmContactRpc['createContact'](_0x4ecc0d))[_0xe7ba('0x1e')](function(_0x134f21){_0x99a86f=_0x134f21;_0x448bcc[_0xe7ba('0x2d')](_0x134f21);if(_0x99a86f){logger['info'](_0xe7ba('0x2e'),_0x1672f0['uniqueid'],_0x276bc3['id'],_0x99a86f['id']);}return;});}else{logger[_0xe7ba('0x8')](_0xe7ba('0x2f'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id']);_0x4ecc0d[_0x5ece11]=_[_0xe7ba('0xe')](_0x1672f0[_0xe7ba('0x28')])?_0x1672f0['calleridnum']:_0x1672f0[_0xe7ba('0x30')];if(_[_0xe7ba('0xe')](_0x1672f0['routeId'])){_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0[_0xe7ba('0x2a')]&&_0x1672f0[_0xe7ba('0x2a')]!==''?_0x1672f0[_0xe7ba('0x2a')]:_0xe7ba('0x2b');}else{_0x4ecc0d['firstName']=_0x1672f0[_0xe7ba('0x2c')]&&_0x1672f0[_0xe7ba('0x2c')]!==_0xe7ba('0x29')?_0x1672f0['destcalleridname']:_0xe7ba('0x2b');}_0x99a86f=_0x4ecc0d;_0x448bcc[_0xe7ba('0x2d')](_0x4ecc0d);return;}}})['then'](function(){if(_0x375ebb){emit(_0x1672f0[_0xe7ba('0x22')],_0x276bc3,util[_0xe7ba('0x31')](_0xe7ba('0x32'),_0x375ebb['name']),util['format'](_0xe7ba('0x33'),_0x15083a[_0xe7ba('0x34')][_0xe7ba('0x35')]()),{'evt':_[_0xe7ba('0x36')](_0x1672f0,{'autoCreate':_0x588c8b}),'contact':_0x99a86f===undefined?{}:_0x99a86f,'contacts':_0x448bcc[_0xe7ba('0x20')]===0x0?undefined:_0x448bcc});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d561e7a..5849e9e 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 _0x83de=['every','checkConditions','AnyConditions','length','some','channel','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','null','substatus','undefined','offlineMessage','created','equals','exports','lodash','mustache','ioredis','./integration','./cmContact','./script','trigger','../ami','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','motionChannel','voice','checkTriggers','hasOwnProperty','status','checkTrigger','merge','Actions','interface','action','toLowerCase','contactmanager','browser','data1','TemplateId','data2','render','url','uri','buildUri','data3','location','uriLocation','data4','windowWidth','isNil','data5','800','windowHeight','data6','600','winArguments','format','user:%s','trigger:%s:%s','jscripty','name','trigger:%s','exec','integration','queue','routeId','script','query','search','replace','AllConditions'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0x83de,0x116));var _0xe83d=function(_0x4392ad,_0x4d0a27){_0x4392ad=_0x4392ad-0x0;var _0x117b76=_0x83de[_0x4392ad];return _0x117b76;};'use strict';var util=require('util');var _=require(_0xe83d('0x0'));var url=require('url');var Mustache=require(_0xe83d('0x1'));var Redis=require(_0xe83d('0x2'));var urlforward=require('./urlforward');var integration=require(_0xe83d('0x3'));var cmContact=require(_0xe83d('0x4'));var script=require(_0xe83d('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xe83d('0x6'));var ami=require(_0xe83d('0x7'));config[_0xe83d('0x8')]=_[_0xe83d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe83d('0xa'))(new Redis(config[_0xe83d('0x8')]));var operators={'equals':function(_0xa747c0,_0x4d2aa0){return _0xa747c0==_0x4d2aa0;},'not_equals':function(_0x1527f5,_0x5cb068){return _0x1527f5!=_0x5cb068;}};var barAndWebActions=['popup','url',_0xe83d('0xb')];function Trigger(_0x1da320){this[_0xe83d('0xc')]=_0x1da320['triggers'];this[_0xe83d('0xd')]=_0x1da320[_0xe83d('0xd')];this['voiceQueues']=_0x1da320[_0xe83d('0xe')];this['templates']=_0x1da320[_0xe83d('0xf')];this[_0xe83d('0x10')]=_0x1da320[_0xe83d('0x10')];this[_0xe83d('0x11')]=_0x1da320[_0xe83d('0x11')];this[_0xe83d('0x12')]=_0x1da320[_0xe83d('0x12')];this[_0xe83d('0x13')]=_0x1da320[_0xe83d('0x13')];this['sugarcrmAccounts']=_0x1da320[_0xe83d('0x14')];this['zohoAccounts']=_0x1da320[_0xe83d('0x15')];this[_0xe83d('0x16')]=_0x1da320[_0xe83d('0x16')];this[_0xe83d('0x17')]=_0x1da320[_0xe83d('0x17')];this['servicenowAccounts']=_0x1da320[_0xe83d('0x18')];this[_0xe83d('0x19')]=_0x1da320[_0xe83d('0x19')];this[_0xe83d('0x1a')]=_0x1da320[_0xe83d('0x1a')];this[_0xe83d('0x1b')]={'zendesk':this[_0xe83d('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xe83d('0x12')],'sugarcrm':this[_0xe83d('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0xe83d('0x16')],'vtiger':this[_0xe83d('0x17')],'dynamics365':this[_0xe83d('0x19')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0xe83d('0x1c'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x1f'),this[_0xe83d('0x1d')]['bind'](this));ami['on'](_0xe83d('0x20'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on']('custom:agentcomplete',this[_0xe83d('0x1d')]['bind'](this));ami['on'](_0xe83d('0x21'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x22'),this[_0xe83d('0x1d')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x23'),this['syncCustomEvent'][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x24'),this['syncCustomEvent'][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x25'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe83d('0x27'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x28'),this[_0xe83d('0x29')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x2a'),this[_0xe83d('0x29')]['bind'](this));ami['on'](_0xe83d('0x2b'),this[_0xe83d('0x29')]['bind'](this));ami['on']('custom:newinteraction',this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x2c'),this['syncCustomEvent'][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x2d'),this[_0xe83d('0x1d')]['bind'](this));ami['on'](_0xe83d('0x2e'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x2f'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x30'),this[_0xe83d('0x1d')][_0xe83d('0x1e')](this));ami['on'](_0xe83d('0x31'),this['syncCustomEvent'][_0xe83d('0x1e')](this));}Trigger[_0xe83d('0x32')][_0xe83d('0x33')]=function(_0xff24d5,_0x2450ca,_0x59d145){logger[_0xe83d('0x34')](_0xff24d5,_0x2450ca,JSON['stringify'](_0x59d145));io['to'](_0xff24d5)[_0xe83d('0x33')](_0x2450ca,_0x59d145);};Trigger[_0xe83d('0x32')][_0xe83d('0x1d')]=function(_0x480c2b){var _0x14e6d2=_['clone'](_0x480c2b);if(typeof _0x14e6d2[_0xe83d('0x35')]==='undefined'){_0x14e6d2[_0xe83d('0x35')]=_0xe83d('0x36');}this[_0xe83d('0x37')](_0x14e6d2);};Trigger[_0xe83d('0x32')][_0xe83d('0x29')]=function(_0x2c4ea8){if(this['agents'][_0x2c4ea8['interface']]){this['syncCustomEvent'](_0x2c4ea8);}};Trigger[_0xe83d('0x32')][_0xe83d('0x37')]=function(_0xba8495){var _0x362e0e;for(var _0x53f1a1 in this[_0xe83d('0xc')]){if(this[_0xe83d('0xc')][_0xe83d('0x38')](_0x53f1a1)){if(this[_0xe83d('0xc')][_0x53f1a1][_0xe83d('0x39')]){_0x362e0e=this[_0xe83d('0x3a')](this['triggers'][_0x53f1a1],_0xba8495);if(_0x362e0e){_[_0xe83d('0x3b')](_0xba8495,_0xba8495['variables']);for(var _0x2901de=0x0,_0x26dd21,_0x510003,_0x1bdd0d;_0x2901de0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x39e435,_0x3aef88){var _0x3e1fbf=function(_0x2c467a){while(--_0x2c467a){_0x39e435['push'](_0x39e435['shift']());}};_0x3e1fbf(++_0x3aef88);}(_0x3e74,0x175));var _0x43e7=function(_0x22ef99,_0x2a6b82){_0x22ef99=_0x22ef99-0x0;var _0x8f979c=_0x3e74[_0x22ef99];return _0x8f979c;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 f95f68f..309d99f 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 _0xfa56=['../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','resolve','data5','POST','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','isdisabled','info','systemuserid','userId','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Fields','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','headers','ticketId','format','user:%s','emit','trigger:browser:url','data7','serverUrl','stripTrailingSlash','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!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/logger','dynamics365'];(function(_0x56de00,_0xd08a91){var _0x1d6ce5=function(_0x109911){while(--_0x109911){_0x56de00['push'](_0x56de00['shift']());}};_0x1d6ce5(++_0xd08a91);}(_0xfa56,0x19a));var _0x6fa5=function(_0x3f9f54,_0x4a5fa5){_0x3f9f54=_0x3f9f54-0x0;var _0x3de22b=_0xfa56[_0x3f9f54];return _0x3de22b;};'use strict';var _=require(_0x6fa5('0x0'));var rp=require('request-promise');var util=require(_0x6fa5('0x1'));var intUtil=require('./util');var md5=require(_0x6fa5('0x2'));var Redis=require(_0x6fa5('0x3'));var logger=require(_0x6fa5('0x4'))(_0x6fa5('0x5'));var config=require(_0x6fa5('0x6'));config[_0x6fa5('0x7')]=_[_0x6fa5('0x8')](config[_0x6fa5('0x7')],{'host':_0x6fa5('0x9'),'port':0x18eb});var io=require(_0x6fa5('0xa'))(new Redis(config['redis']));function getAuthToken(_0x5b0132,_0x862094,_0x4f0b2a){if(_0x5b0132[_0x6fa5('0xb')]){_0x5b0132[_0x6fa5('0xc')]=_0x5b0132[_0x6fa5('0xd')]['data7'];_0x5b0132['tenantId']=_0x5b0132[_0x6fa5('0xd')]['data2'];return Promise[_0x6fa5('0xe')](_0x5b0132[_0x6fa5('0xd')][_0x6fa5('0xf')]);}var _0x572566={'method':_0x6fa5('0x10'),'uri':_0x862094,'form':{'client_id':_0x5b0132['clientId'],'resource':_0x5b0132[_0x6fa5('0xc')],'username':_0x5b0132[_0x6fa5('0x11')],'password':_0x5b0132[_0x6fa5('0x12')],'grant_type':'password','client_secret':_0x5b0132[_0x6fa5('0x13')]},'json':!![]};return rp(_0x572566)['then'](function(_0x40f2fc){return _0x40f2fc[_0x6fa5('0x14')];})['catch'](function(_0xb7f061){logger[_0x6fa5('0x15')]('['+[_0x4f0b2a[_0x6fa5('0x16')]()]+_0x6fa5('0x17'));return _0xb7f061[_0x6fa5('0x18')];});}function getUser(_0x4acb63,_0x21db1a,_0x5d6851,_0x4a50d7,_0xf795a7,_0x52330f){return new Promise(function(_0x5331e7,_0x21ec8c){return getAuthToken(_0x21db1a,_0x4a50d7,_0x52330f)['then'](function(_0x438816){var _0x1a89c8={'method':_0x6fa5('0x19'),'uri':_0xf795a7+_0x6fa5('0x1a'),'headers':{'Authorization':_0x6fa5('0x1b')+_0x438816,'OData-Version':_0x6fa5('0x1c')},'json':!![]};return rp(_0x1a89c8);})[_0x6fa5('0x1d')](function(_0x488988){var _0x13e1a2=_0x488988[_0x6fa5('0x1e')];var _0x5a070f=![];var _0x57be40=null;if(!_[_0x6fa5('0x1f')](_0x5d6851)){if(intUtil[_0x6fa5('0x20')](_0x5d6851[_0x6fa5('0x21')])){_0x4acb63[_0x6fa5('0x22')]=_0x5d6851[_0x6fa5('0x21')];for(_0x57be40=0x0;_0x57be40<_0x13e1a2[_0x6fa5('0x23')];_0x57be40++){if(_0x13e1a2[_0x57be40]['internalemailaddress']===_0x5d6851[_0x6fa5('0x21')]&&!_0x13e1a2[_0x57be40][_0x6fa5('0x24')]){_0x5a070f=!![];logger[_0x6fa5('0x25')]('['+[_0x52330f[_0x6fa5('0x16')]()]+']\x20Agent\x20found\x20'+_0x13e1a2[_0x57be40][_0x6fa5('0x26')]+'!');_0x4acb63['userId']=_0x13e1a2[_0x57be40][_0x6fa5('0x26')];}}}}if(!_0x5a070f){logger[_0x6fa5('0x25')]('['+[_0x52330f[_0x6fa5('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4acb63[_0x6fa5('0x22')]=_0x21db1a[_0x6fa5('0x11')];for(_0x57be40=0x0;_0x57be40<_0x13e1a2[_0x6fa5('0x23')];_0x57be40++){if(_0x13e1a2[_0x57be40]['internalemailaddress']===_0x21db1a[_0x6fa5('0x11')]){_0x4acb63[_0x6fa5('0x27')]=_0x13e1a2[_0x57be40][_0x6fa5('0x26')];}}}_0x5331e7(_0x4acb63);})[_0x6fa5('0x28')](function(_0x1f93bf){_0x21ec8c(_0x1f93bf[_0x6fa5('0x18')]);});});}function createEndUser(_0x5a6580,_0x5b5b97,_0x119c06,_0x4f7e2f,_0x4eb2c,_0x224637){return new Promise(function(_0x185cce,_0x5ac94b){return getAuthToken(_0x5b5b97,_0x119c06,_0x224637)['then'](function(_0x149ab8){var _0x35e485=_0x224637[_0x6fa5('0x29')]()===_0x6fa5('0x2a')?_0x4eb2c[_0x6fa5('0x2b')]:_0x4eb2c[_0x6fa5('0x2c')];var _0x59e7cc={'method':_0x6fa5('0x10'),'uri':_0x4f7e2f+_0x6fa5('0x2d'),'body':{'telephone1':_0x35e485,'fullname':_0x35e485,'firstname':_0x35e485,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6fa5('0x2e')+_0x5a6580[_0x6fa5('0x27')]+')'},'headers':{'Authorization':_0x6fa5('0x1b')+_0x149ab8,'OData-Version':_0x6fa5('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x59e7cc);})[_0x6fa5('0x1d')](function(_0x5c1b98){var _0x552da1=_0x5c1b98['headers']['odata-entityid'];var _0x372af2=_0x552da1[_0x6fa5('0x2f')](_0x552da1[_0x6fa5('0x30')]('(')+0x1,_0x552da1['lastIndexOf'](')'));_0x5a6580[_0x6fa5('0x31')]=_0x372af2;_0x185cce(_0x5a6580);})[_0x6fa5('0x28')](function(_0x74cf4c){_0x5ac94b(_0x74cf4c[_0x6fa5('0x18')]);});});}function getEndUser(_0x2d71c8,_0x97c747,_0x5dd5e1,_0x542c68,_0x191b16,_0x365bd8,_0x375de9){var _0x186378=_0x365bd8[_0x6fa5('0x29')]()===_0x6fa5('0x2a')?_0x191b16['destcalleridnum']:_0x191b16[_0x6fa5('0x2c')];return getAuthToken(_0x97c747,_0x5dd5e1,_0x365bd8)['then'](function(_0x296798){var _0x4d87c0={'method':_0x6fa5('0x19'),'uri':_0x542c68+_0x6fa5('0x32')+_0x186378[_0x6fa5('0x33')]('+',_0x6fa5('0x34'))+'\x27','headers':{'Authorization':_0x6fa5('0x1b')+_0x296798,'If-None-Match':null,'OData-Version':_0x6fa5('0x1c')},'json':!![]};return rp(_0x4d87c0);})[_0x6fa5('0x1d')](function(_0xcd38a1){var _0x31314d=![];if(!_0xcd38a1)return _0x31314d;var _0x3be4d2=_0xcd38a1[_0x6fa5('0x1e')];for(var _0x108c98=0x0;_0x108c98<_0x3be4d2[_0x6fa5('0x23')];_0x108c98++){if(_0x3be4d2[_0x108c98]['telephone1']===_0x186378){_0x31314d=!![];_0x2d71c8[_0x6fa5('0x31')]=_0x3be4d2[_0x108c98][_0x6fa5('0x35')];}}return _0x31314d;})['then'](function(_0x450c00){if(_0x450c00)return _0x2d71c8;if(_0x375de9==='nothing'){logger[_0x6fa5('0x25')]('['+[_0x365bd8[_0x6fa5('0x16')]()]+_0x6fa5('0x36'));return _0x2d71c8;}return createEndUser(_0x2d71c8,_0x97c747,_0x5dd5e1,_0x542c68,_0x191b16,_0x365bd8)[_0x6fa5('0x1d')](function(_0x490492){logger[_0x6fa5('0x25')]('['+[_0x365bd8[_0x6fa5('0x16')]()]+_0x6fa5('0x37'),_0x490492[_0x6fa5('0x31')]);return _0x490492;});});}function getCustomFields(_0x2f8086,_0x1e9df2,_0xc23625){var _0x2e01b1={};if(_0x2f8086[_0x6fa5('0x23')]>0x0){_[_0x6fa5('0x38')](_0x2f8086,function(_0x45e78e){if(_[_0x6fa5('0x39')]([_0x6fa5('0x3a'),'picklist'],_0x45e78e[_0x6fa5('0x3b')])&&_0x45e78e[_0x6fa5('0x3c')]&&!_0x45e78e[_0x6fa5('0x3d')]){var _0x37587a=_0x45e78e[_0x6fa5('0x3e')][_0x6fa5('0x29')]();var _0x367ef9=_0x37587a[_0x6fa5('0x2f')](0x0,_0x37587a[_0x6fa5('0x3f')]('_'));var _0x5eefc6=_0x37587a['substring'](_0x37587a['indexOf']('_')+0x1);if(_0x367ef9===_0xc23625){_0x2e01b1[_0x5eefc6]=_0x45e78e[_0x6fa5('0x40')];}}});}return _0x2e01b1;}function getTicket(_0x56d73d,_0x47bee0,_0x46cb4,_0x523fb7,_0x5d5dc3,_0x531972,_0x4c5866){return new Promise(function(_0x3e6b38,_0x23ddc6){var _0x296d9c;return getAuthToken(_0x47bee0,_0x46cb4,_0x4c5866)[_0x6fa5('0x1d')](function(_0x201b70){if(_0x531972[_0x6fa5('0x41')]===_0x6fa5('0x42')){_0x296d9c={'method':_0x6fa5('0x10'),'uri':_0x523fb7+_0x6fa5('0x43'),'body':Object[_0x6fa5('0x44')]({},{'title':intUtil[_0x6fa5('0x45')](_0x531972['Subjects'],_0x5d5dc3,'\x20'),'description':intUtil['getString'](_0x531972['Descriptions'],_0x5d5dc3,'\x0a'),'customerid_contact@odata.bind':_0x56d73d[_0x6fa5('0x31')]?'/contacts('+_0x56d73d[_0x6fa5('0x31')]+')':undefined,'ownerid@odata.bind':_0x6fa5('0x2e')+_0x56d73d['userId']+')','caseorigincode':'1'},getCustomFields(_0x531972[_0x6fa5('0x46')],_0x5d5dc3,_0x531972['ticketType'])),'headers':{'Authorization':_0x6fa5('0x1b')+_0x201b70,'OData-Version':_0x6fa5('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x531972[_0x6fa5('0x41')]===_0x6fa5('0x47')){var _0x4814db=_0x56d73d[_0x6fa5('0x31')]?[{'partyid_systemuser@odata.bind':_0x6fa5('0x2e')+_0x56d73d[_0x6fa5('0x27')]+')','participationtypemask':_0x56d73d[_0x6fa5('0x48')]===_0x6fa5('0x49')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x56d73d[_0x6fa5('0x31')]+')','participationtypemask':_0x56d73d[_0x6fa5('0x48')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6fa5('0x2e')+_0x56d73d[_0x6fa5('0x27')]+')','participationtypemask':_0x56d73d[_0x6fa5('0x48')]===_0x6fa5('0x49')?0x2:0x1}];_0x296d9c={'method':'POST','uri':_0x523fb7+_0x6fa5('0x4a'),'body':Object[_0x6fa5('0x44')]({},{'subject':intUtil['getString'](_0x531972[_0x6fa5('0x4b')],_0x5d5dc3,'\x20'),'phonenumber':String(_0x5d5dc3[_0x6fa5('0x2c')]),'description':intUtil[_0x6fa5('0x45')](_0x531972[_0x6fa5('0x4c')],_0x5d5dc3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x56d73d['enduserId']?'/contacts('+_0x56d73d[_0x6fa5('0x31')]+')':undefined,'ownerid@odata.bind':_0x6fa5('0x2e')+_0x56d73d['userId']+')','directioncode':_0x56d73d[_0x6fa5('0x48')]==='queue'?![]:!![],'phonecall_activity_parties':_0x4814db},getCustomFields(_0x531972[_0x6fa5('0x46')],_0x5d5dc3,_0x531972[_0x6fa5('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x201b70,'OData-Version':_0x6fa5('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x296d9c);})['then'](function(_0x105fb2){var _0x3510c0=_0x105fb2[_0x6fa5('0x4d')]['odata-entityid'];var _0x5c2d00=_0x3510c0[_0x6fa5('0x2f')](_0x3510c0[_0x6fa5('0x30')]('(')+0x1,_0x3510c0[_0x6fa5('0x30')](')'));_0x56d73d[_0x6fa5('0x4e')]=_0x5c2d00;_0x3e6b38(_0x56d73d);})['catch'](function(_0x4674d1){_0x23ddc6(_0x4674d1[_0x6fa5('0x18')]);});});}function emit(_0x530079,_0x3e72ff,_0x2a8ba2,_0x2eb67c){var _0x1e9390={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x530079,_0x2a8ba2,_0x2eb67c)};io['to'](util[_0x6fa5('0x4f')](_0x6fa5('0x50'),_0x3e72ff))[_0x6fa5('0x51')](_0x6fa5('0x52'),_0x1e9390);}exports['cs']=function(_0x36db02,_0x583bce,_0x12488b,_0x49e4aa,_0x2e37ee,_0x2706ca,_0x39888e,_0x1679eb){var _0x14f7c7={};_0x2706ca[_0x6fa5('0xc')]=_0x2706ca[_0x6fa5('0xb')]?intUtil['stripTrailingSlash'](_0x2706ca[_0x6fa5('0xd')][_0x6fa5('0x53')]):intUtil['stripTrailingSlash'](_0x2706ca[_0x6fa5('0xc')]);_0x2706ca[_0x6fa5('0x54')]=intUtil[_0x6fa5('0x55')](_0x2706ca[_0x6fa5('0x54')]);_0x14f7c7[_0x6fa5('0x48')]=_0x1679eb==='queue'||_0x1679eb===_0x6fa5('0x56')?'queue':_0x6fa5('0x2a');var _0x3f45b0=_0x2706ca[_0x6fa5('0xb')]?util[_0x6fa5('0x4f')](_0x6fa5('0x57'),_0x2706ca[_0x6fa5('0xd')][_0x6fa5('0x53')]):util[_0x6fa5('0x4f')](_0x6fa5('0x57'),_0x2706ca[_0x6fa5('0xc')]);var _0x4c3505=util[_0x6fa5('0x4f')](_0x6fa5('0x58'),_0x2706ca[_0x6fa5('0x59')]);var _0xf6b4b5=util[_0x6fa5('0x4f')](_0x6fa5('0x5a'),_0x2706ca[_0x6fa5('0x54')],_0x583bce[_0x6fa5('0x5b')],md5(_0x583bce[_0x6fa5('0x5b')]));if(_0x2e37ee&&_0x2e37ee[_0x6fa5('0x5c')]){logger[_0x6fa5('0x25')](_0x6fa5('0x5d'),_0x6fa5('0x5e'));_0x583bce[_0x6fa5('0x5f')]=_0xf6b4b5;}else if(_0x39888e&&_0x39888e['recordingFormat']&&_0x39888e[_0x6fa5('0x60')]!==_0x6fa5('0x61')){logger['info']('[OUTBOUND]',_0x6fa5('0x5e'));_0x583bce['recordingURL']=_0xf6b4b5;}else{_0x583bce[_0x6fa5('0x5f')]='';}return getUser(_0x14f7c7,_0x2706ca,_0x49e4aa,_0x4c3505,_0x3f45b0,_0x1679eb)[_0x6fa5('0x1d')](function(_0x285a91){logger['info']('['+_0x1679eb['toUpperCase']()+_0x6fa5('0x62'),_0x285a91['userId']);logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x285a91[_0x6fa5('0x22')]);return getEndUser(_0x285a91,_0x2706ca,_0x4c3505,_0x3f45b0,_0x583bce,_0x1679eb,_0x12488b['moduleCreate']);})[_0x6fa5('0x1d')](function(_0x1ad120){logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1ad120[_0x6fa5('0x31')]);logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+_0x6fa5('0x63'),_0x583bce[_0x6fa5('0x2c')]);return getTicket(_0x1ad120,_0x2706ca,_0x4c3505,_0x3f45b0,_0x583bce,_0x12488b,_0x1679eb);})[_0x6fa5('0x1d')](function(_0x1c0e2c){logger[_0x6fa5('0x25')](util[_0x6fa5('0x4f')]('['+_0x1679eb[_0x6fa5('0x16')]()+_0x6fa5('0x64'),_0x12488b[_0x6fa5('0x41')],_0x1c0e2c[_0x6fa5('0x4e')]));logger[_0x6fa5('0x25')](util[_0x6fa5('0x4f')]('['+_0x1679eb['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x1679eb));if(_0x1679eb!==_0x6fa5('0x56')){logger[_0x6fa5('0x25')]('['+_0x1679eb[_0x6fa5('0x16')]()+']',_0x6fa5('0x65'));emit(_0x2706ca[_0x6fa5('0xc')],_0x49e4aa[_0x6fa5('0x66')],_0x12488b['ticketType'],_0x1c0e2c['ticketId']);}})[_0x6fa5('0x28')](function(_0x4d007b){logger[_0x6fa5('0x15')]('['+_0x1679eb[_0x6fa5('0x16')]()+_0x6fa5('0x67'),_0x4d007b[_0x6fa5('0x18')]);});}; \ No newline at end of file +var _0xa0db=[']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','tenantId','CloudProvider','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','calleridnum','contacts','/systemusers(','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20created!','forEach','string','type','nameField','customField','idField','toLowerCase','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','Subjects','headers','odata-entityid','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!'];(function(_0x2e4082,_0x599105){var _0x3f82f1=function(_0x5f3029){while(--_0x5f3029){_0x2e4082['push'](_0x2e4082['shift']());}};_0x3f82f1(++_0x599105);}(_0xa0db,0x1a1));var _0xba0d=function(_0x183823,_0x322610){_0x183823=_0x183823-0x0;var _0x566bd1=_0xa0db[_0x183823];return _0x566bd1;};'use strict';var _=require(_0xba0d('0x0'));var rp=require(_0xba0d('0x1'));var util=require(_0xba0d('0x2'));var intUtil=require(_0xba0d('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0xba0d('0x4'))(_0xba0d('0x5'));var config=require(_0xba0d('0x6'));config['redis']=_[_0xba0d('0x7')](config[_0xba0d('0x8')],{'host':_0xba0d('0x9'),'port':0x18eb});var io=require(_0xba0d('0xa'))(new Redis(config[_0xba0d('0x8')]));function getAuthToken(_0x3769a6,_0x51be4e,_0x1976f2){if(_0x3769a6[_0xba0d('0xb')]){_0x3769a6[_0xba0d('0xc')]=_0x3769a6['CloudProvider']['data7'];_0x3769a6[_0xba0d('0xd')]=_0x3769a6[_0xba0d('0xe')][_0xba0d('0xf')];return Promise[_0xba0d('0x10')](_0x3769a6['CloudProvider'][_0xba0d('0x11')]);}var _0x5ebf18={'method':_0xba0d('0x12'),'uri':_0x51be4e,'form':{'client_id':_0x3769a6[_0xba0d('0x13')],'resource':_0x3769a6[_0xba0d('0xc')],'username':_0x3769a6[_0xba0d('0x14')],'password':_0x3769a6['password'],'grant_type':_0xba0d('0x15'),'client_secret':_0x3769a6[_0xba0d('0x16')]},'json':!![]};return rp(_0x5ebf18)[_0xba0d('0x17')](function(_0x4c5ce0){return _0x4c5ce0[_0xba0d('0x18')];})[_0xba0d('0x19')](function(_0x1eceb3){logger[_0xba0d('0x1a')]('['+[_0x1976f2['toUpperCase']()]+_0xba0d('0x1b'));return _0x1eceb3[_0xba0d('0x1c')];});}function getUser(_0x5b7bca,_0xdc3b13,_0x58263f,_0x1863c2,_0x385716,_0x4a3a86){return new Promise(function(_0x49f2c7,_0x2d26b4){return getAuthToken(_0xdc3b13,_0x1863c2,_0x4a3a86)['then'](function(_0x3ffddf){var _0x3212e4={'method':_0xba0d('0x1d'),'uri':_0x385716+_0xba0d('0x1e'),'headers':{'Authorization':_0xba0d('0x1f')+_0x3ffddf,'OData-Version':_0xba0d('0x20')},'json':!![]};return rp(_0x3212e4);})[_0xba0d('0x17')](function(_0xf96c20){var _0x70ec2b=_0xf96c20[_0xba0d('0x21')];var _0x574e59=![];var _0x34d4ad=null;if(!_[_0xba0d('0x22')](_0x58263f)){if(intUtil[_0xba0d('0x23')](_0x58263f[_0xba0d('0x24')])){_0x5b7bca[_0xba0d('0x25')]=_0x58263f['email'];for(_0x34d4ad=0x0;_0x34d4ad<_0x70ec2b[_0xba0d('0x26')];_0x34d4ad++){if(_0x70ec2b[_0x34d4ad][_0xba0d('0x27')]===_0x58263f[_0xba0d('0x24')]&&!_0x70ec2b[_0x34d4ad]['isdisabled']){_0x574e59=!![];logger[_0xba0d('0x28')]('['+[_0x4a3a86[_0xba0d('0x29')]()]+_0xba0d('0x2a')+_0x70ec2b[_0x34d4ad]['systemuserid']+'!');_0x5b7bca[_0xba0d('0x2b')]=_0x70ec2b[_0x34d4ad][_0xba0d('0x2c')];}}}}if(!_0x574e59){logger[_0xba0d('0x28')]('['+[_0x4a3a86[_0xba0d('0x29')]()]+_0xba0d('0x2d'));_0x5b7bca[_0xba0d('0x25')]=_0xdc3b13[_0xba0d('0x14')];for(_0x34d4ad=0x0;_0x34d4ad<_0x70ec2b[_0xba0d('0x26')];_0x34d4ad++){if(_0x70ec2b[_0x34d4ad][_0xba0d('0x27')]===_0xdc3b13[_0xba0d('0x14')]){_0x5b7bca[_0xba0d('0x2b')]=_0x70ec2b[_0x34d4ad][_0xba0d('0x2c')];}}}_0x49f2c7(_0x5b7bca);})[_0xba0d('0x19')](function(_0x189817){_0x2d26b4(_0x189817[_0xba0d('0x1c')]);});});}function createEndUser(_0x356e5a,_0x247968,_0x24159c,_0x515030,_0x517335,_0x53bf86){return new Promise(function(_0x2ac24b,_0x162d5e){return getAuthToken(_0x247968,_0x24159c,_0x53bf86)[_0xba0d('0x17')](function(_0x5728e2){var _0x4a596a=_0x53bf86['toLowerCase']()===_0xba0d('0x2e')?_0x517335['destcalleridnum']:_0x517335[_0xba0d('0x2f')];var _0x57a14d={'method':_0xba0d('0x12'),'uri':_0x515030+_0xba0d('0x30'),'body':{'telephone1':_0x4a596a,'fullname':_0x4a596a,'firstname':_0x4a596a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xba0d('0x31')+_0x356e5a[_0xba0d('0x2b')]+')'},'headers':{'Authorization':_0xba0d('0x1f')+_0x5728e2,'OData-Version':_0xba0d('0x20')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x57a14d);})[_0xba0d('0x17')](function(_0x2b4e72){var _0x36a418=_0x2b4e72['headers']['odata-entityid'];var _0x3641b6=_0x36a418[_0xba0d('0x32')](_0x36a418[_0xba0d('0x33')]('(')+0x1,_0x36a418[_0xba0d('0x33')](')'));_0x356e5a[_0xba0d('0x34')]=_0x3641b6;_0x2ac24b(_0x356e5a);})[_0xba0d('0x19')](function(_0x191fee){_0x162d5e(_0x191fee[_0xba0d('0x1c')]);});});}function getEndUser(_0x33428f,_0xa1c733,_0xf97ddb,_0x251a03,_0x492a93,_0x24ed41,_0x4ec46c){var _0x413ed1=_0x24ed41['toLowerCase']()===_0xba0d('0x2e')?_0x492a93[_0xba0d('0x35')]:_0x492a93[_0xba0d('0x2f')];return getAuthToken(_0xa1c733,_0xf97ddb,_0x24ed41)[_0xba0d('0x17')](function(_0x31cad3){var _0x2a7918={'method':_0xba0d('0x1d'),'uri':_0x251a03+_0xba0d('0x36')+_0x413ed1[_0xba0d('0x37')]('+',_0xba0d('0x38'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x31cad3,'If-None-Match':null,'OData-Version':_0xba0d('0x20')},'json':!![]};return rp(_0x2a7918);})['then'](function(_0x4453ac){var _0x597d80=![];if(!_0x4453ac)return _0x597d80;var _0x4ac081=_0x4453ac[_0xba0d('0x21')];for(var _0x578410=0x0;_0x578410<_0x4ac081['length'];_0x578410++){if(_0x4ac081[_0x578410]['telephone1']===_0x413ed1){_0x597d80=!![];_0x33428f[_0xba0d('0x34')]=_0x4ac081[_0x578410]['contactid'];}}return _0x597d80;})[_0xba0d('0x17')](function(_0x4aec4d){if(_0x4aec4d)return _0x33428f;if(_0x4ec46c===_0xba0d('0x39')){logger[_0xba0d('0x28')]('['+[_0x24ed41['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x33428f;}return createEndUser(_0x33428f,_0xa1c733,_0xf97ddb,_0x251a03,_0x492a93,_0x24ed41)['then'](function(_0x59d2a3){logger[_0xba0d('0x28')]('['+[_0x24ed41[_0xba0d('0x29')]()]+_0xba0d('0x3a'),_0x59d2a3[_0xba0d('0x34')]);return _0x59d2a3;});});}function getCustomFields(_0x122251,_0x75668d,_0x529a34){var _0x1e4122={};if(_0x122251[_0xba0d('0x26')]>0x0){_[_0xba0d('0x3b')](_0x122251,function(_0x3b7ac7){if(_['includes']([_0xba0d('0x3c'),'picklist'],_0x3b7ac7[_0xba0d('0x3d')])&&_0x3b7ac7[_0xba0d('0x3e')]&&!_0x3b7ac7[_0xba0d('0x3f')]){var _0x250bf8=_0x3b7ac7[_0xba0d('0x40')][_0xba0d('0x41')]();var _0xa2da59=_0x250bf8[_0xba0d('0x32')](0x0,_0x250bf8[_0xba0d('0x42')]('_'));var _0x2c9fa4=_0x250bf8['substring'](_0x250bf8[_0xba0d('0x42')]('_')+0x1);if(_0xa2da59===_0x529a34){_0x1e4122[_0x2c9fa4]=_0x3b7ac7['content'];}}});}return _0x1e4122;}function getTicket(_0x13f77d,_0x157d44,_0x5c4ad5,_0x3deeb4,_0x1933f8,_0x4d3f70,_0x7867c6){return new Promise(function(_0x42e20a,_0x24b2ff){var _0x48cbd8;return getAuthToken(_0x157d44,_0x5c4ad5,_0x7867c6)[_0xba0d('0x17')](function(_0x370adc){if(_0x4d3f70[_0xba0d('0x43')]===_0xba0d('0x44')){_0x48cbd8={'method':'POST','uri':_0x3deeb4+_0xba0d('0x45'),'body':Object[_0xba0d('0x46')]({},{'title':intUtil[_0xba0d('0x47')](_0x4d3f70['Subjects'],_0x1933f8,'\x20'),'description':intUtil[_0xba0d('0x47')](_0x4d3f70[_0xba0d('0x48')],_0x1933f8,'\x0a'),'customerid_contact@odata.bind':_0x13f77d[_0xba0d('0x34')]?_0xba0d('0x49')+_0x13f77d[_0xba0d('0x34')]+')':undefined,'ownerid@odata.bind':_0xba0d('0x31')+_0x13f77d['userId']+')','caseorigincode':'1'},getCustomFields(_0x4d3f70[_0xba0d('0x4a')],_0x1933f8,_0x4d3f70[_0xba0d('0x43')])),'headers':{'Authorization':_0xba0d('0x1f')+_0x370adc,'OData-Version':_0xba0d('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4d3f70[_0xba0d('0x43')]==='phonecall'){var _0x534c9f=_0x13f77d[_0xba0d('0x34')]?[{'partyid_systemuser@odata.bind':_0xba0d('0x31')+_0x13f77d[_0xba0d('0x2b')]+')','participationtypemask':_0x13f77d[_0xba0d('0x4b')]===_0xba0d('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0xba0d('0x49')+_0x13f77d[_0xba0d('0x34')]+')','participationtypemask':_0x13f77d[_0xba0d('0x4b')]===_0xba0d('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xba0d('0x31')+_0x13f77d['userId']+')','participationtypemask':_0x13f77d[_0xba0d('0x4b')]===_0xba0d('0x4c')?0x2:0x1}];_0x48cbd8={'method':_0xba0d('0x12'),'uri':_0x3deeb4+_0xba0d('0x4d'),'body':Object['assign']({},{'subject':intUtil[_0xba0d('0x47')](_0x4d3f70[_0xba0d('0x4e')],_0x1933f8,'\x20'),'phonenumber':String(_0x1933f8['calleridnum']),'description':intUtil[_0xba0d('0x47')](_0x4d3f70[_0xba0d('0x48')],_0x1933f8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x13f77d[_0xba0d('0x34')]?_0xba0d('0x49')+_0x13f77d[_0xba0d('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x13f77d['userId']+')','directioncode':_0x13f77d['callDirection']===_0xba0d('0x4c')?![]:!![],'phonecall_activity_parties':_0x534c9f},getCustomFields(_0x4d3f70[_0xba0d('0x4a')],_0x1933f8,_0x4d3f70[_0xba0d('0x43')])),'headers':{'Authorization':_0xba0d('0x1f')+_0x370adc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x48cbd8);})[_0xba0d('0x17')](function(_0x37e838){var _0x382e74=_0x37e838[_0xba0d('0x4f')][_0xba0d('0x50')];var _0x1dbaa2=_0x382e74[_0xba0d('0x32')](_0x382e74[_0xba0d('0x33')]('(')+0x1,_0x382e74[_0xba0d('0x33')](')'));_0x13f77d[_0xba0d('0x51')]=_0x1dbaa2;_0x42e20a(_0x13f77d);})[_0xba0d('0x19')](function(_0x39c918){_0x24b2ff(_0x39c918[_0xba0d('0x1c')]);});});}function emit(_0x333eeb,_0x45c17c,_0x545811,_0x580d98){var _0x158118={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x333eeb,_0x545811,_0x580d98)};io['to'](util[_0xba0d('0x52')]('user:%s',_0x45c17c))[_0xba0d('0x53')](_0xba0d('0x54'),_0x158118);}exports['cs']=function(_0x216aa7,_0x6602f,_0xfc119d,_0x1d5cce,_0x17f860,_0x5ee3ba,_0x8e230c,_0x1a48b8){var _0x3c570e={};_0x5ee3ba['remoteUri']=_0x5ee3ba[_0xba0d('0xb')]?intUtil[_0xba0d('0x55')](_0x5ee3ba[_0xba0d('0xe')]['data7']):intUtil[_0xba0d('0x55')](_0x5ee3ba[_0xba0d('0xc')]);_0x5ee3ba[_0xba0d('0x56')]=intUtil[_0xba0d('0x55')](_0x5ee3ba[_0xba0d('0x56')]);_0x3c570e[_0xba0d('0x4b')]=_0x1a48b8===_0xba0d('0x4c')||_0x1a48b8===_0xba0d('0x57')?_0xba0d('0x4c'):_0xba0d('0x2e');var _0x35723b=_0x5ee3ba[_0xba0d('0xb')]?util[_0xba0d('0x52')](_0xba0d('0x58'),_0x5ee3ba[_0xba0d('0xe')][_0xba0d('0x59')]):util[_0xba0d('0x52')](_0xba0d('0x58'),_0x5ee3ba[_0xba0d('0xc')]);var _0x4a619a=util[_0xba0d('0x52')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5ee3ba[_0xba0d('0xd')]);var _0x5c26dc=util[_0xba0d('0x52')](_0xba0d('0x5a'),_0x5ee3ba[_0xba0d('0x56')],_0x6602f[_0xba0d('0x5b')],md5(_0x6602f[_0xba0d('0x5b')]));if(_0x17f860&&_0x17f860[_0xba0d('0x5c')]){logger[_0xba0d('0x28')]('[QUEUE]','Recording\x20is\x20enabled!');_0x6602f[_0xba0d('0x5d')]=_0x5c26dc;}else if(_0x8e230c&&_0x8e230c[_0xba0d('0x5e')]&&_0x8e230c[_0xba0d('0x5e')]!==_0xba0d('0x5f')){logger['info'](_0xba0d('0x60'),_0xba0d('0x61'));_0x6602f[_0xba0d('0x5d')]=_0x5c26dc;}else{_0x6602f[_0xba0d('0x5d')]='';}return getUser(_0x3c570e,_0x5ee3ba,_0x1d5cce,_0x4a619a,_0x35723b,_0x1a48b8)[_0xba0d('0x17')](function(_0x26ef4b){logger[_0xba0d('0x28')]('['+_0x1a48b8['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x26ef4b['userId']);logger[_0xba0d('0x28')]('['+_0x1a48b8[_0xba0d('0x29')]()+_0xba0d('0x62'),_0x26ef4b[_0xba0d('0x25')]);return getEndUser(_0x26ef4b,_0x5ee3ba,_0x4a619a,_0x35723b,_0x6602f,_0x1a48b8,_0xfc119d[_0xba0d('0x63')]);})[_0xba0d('0x17')](function(_0x212d77){logger['info']('['+_0x1a48b8[_0xba0d('0x29')]()+_0xba0d('0x64'),_0x212d77[_0xba0d('0x34')]);logger[_0xba0d('0x28')]('['+_0x1a48b8[_0xba0d('0x29')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x6602f[_0xba0d('0x2f')]);return getTicket(_0x212d77,_0x5ee3ba,_0x4a619a,_0x35723b,_0x6602f,_0xfc119d,_0x1a48b8);})[_0xba0d('0x17')](function(_0x49755d){logger['info'](util[_0xba0d('0x52')]('['+_0x1a48b8[_0xba0d('0x29')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xfc119d[_0xba0d('0x43')],_0x49755d[_0xba0d('0x51')]));logger[_0xba0d('0x28')](util[_0xba0d('0x52')]('['+_0x1a48b8[_0xba0d('0x29')]()+']\x20Call\x20direction:\x20%s',_0x1a48b8));if(_0x1a48b8!=='unmanaged'){logger[_0xba0d('0x28')]('['+_0x1a48b8['toUpperCase']()+']',_0xba0d('0x65'));emit(_0x5ee3ba[_0xba0d('0xc')],_0x1d5cce[_0xba0d('0x66')],_0xfc119d[_0xba0d('0x43')],_0x49755d['ticketId']);}})[_0xba0d('0x19')](function(_0x3ac343){logger[_0xba0d('0x1a')]('['+_0x1a48b8[_0xba0d('0x29')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3ac343[_0xba0d('0x1c')]);});}; \ 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 f1ccf2c..f2b34ba 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 _0x1fe9=['variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','uniqueid','destcalleridname','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','calleridnum','catch','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','value','%s/api/v2/tickets','POST','then','%s/api/v2/agents','remoteUri','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','type','nameField','customField','toLowerCase','content','push','idField','variable'];(function(_0x423cea,_0x5dee91){var _0x1080a7=function(_0x97e4d8){while(--_0x97e4d8){_0x423cea['push'](_0x423cea['shift']());}};_0x1080a7(++_0x5dee91);}(_0x1fe9,0xde));var _0x91fe=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1fe9[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var rp=require(_0x91fe('0x0'));var md5=require(_0x91fe('0x1'));var util=require(_0x91fe('0x2'));var Redis=require(_0x91fe('0x3'));var intUtil=require(_0x91fe('0x4'));var config=require(_0x91fe('0x5'));var logger=require(_0x91fe('0x6'))(_0x91fe('0x7'));config[_0x91fe('0x8')]=_[_0x91fe('0x9')](config[_0x91fe('0x8')],{'host':_0x91fe('0xa'),'port':0x18eb});var io=require(_0x91fe('0xb'))(new Redis(config[_0x91fe('0x8')]));var headers={'Content-Type':_0x91fe('0xc'),'Accept':_0x91fe('0xc')};function emit(_0x4e28b1,_0x1c5182,_0x5aaa3a){io['to'](_0x4e28b1)[_0x91fe('0xd')](_0x1c5182,_0x5aaa3a);}function getTicket(_0x35608f,_0xdee5a6,_0x476081,_0x40f37b,_0x314226){logger[_0x91fe('0xe')](_0x91fe('0xf'));var _0x54c471=_[_0x91fe('0x10')]({'responder_id':_0xdee5a6['id'],'requester_id':_0x476081['id'],'name':util[_0x91fe('0x11')](_0x91fe('0x12'),_0x314226['calleridname']),'phone':_0x314226['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x91fe('0x13')](_0x40f37b[_0x91fe('0x14')],_0x314226,'\x20'),'description':intUtil[_0x91fe('0x13')](_0x40f37b[_0x91fe('0x15')],_0x314226,'
'),'tags':getTags(_0x40f37b[_0x91fe('0x16')],_0x91fe('0x17'))},getCustomFields(_0x40f37b[_0x91fe('0x18')],_0x314226));_0x54c471[_0x91fe('0x19')]=_['mapValues'](_['keyBy'](_0x54c471[_0x91fe('0x19')],'id'),_0x91fe('0x1a'));return request({'uri':util['format'](_0x91fe('0x1b'),_0x35608f['remoteUri']),'method':_0x91fe('0x1c'),'body':_0x54c471})[_0x91fe('0x1d')](function(_0x438c56){logger[_0x91fe('0xe')]('Ticket\x20created!');return _0x438c56;});}function getUser(_0x3c397f,_0x5c2f6b){if(intUtil['validateEmail'](_0x5c2f6b)){return request({'uri':util[_0x91fe('0x11')](_0x91fe('0x1e'),_0x3c397f[_0x91fe('0x1f')]),'qs':{'email':_0x5c2f6b}})['then'](function(_0x3fe292){if(_0x3fe292['length']){logger[_0x91fe('0xe')]('Agent\x20found!');return _[_0x91fe('0x20')](_0x3fe292,function(_0x3b3f45){return _0x3b3f45['contact']['email']===_0x5c2f6b;});}else{logger[_0x91fe('0xe')](_0x91fe('0x21'));return request({'uri':util['format'](_0x91fe('0x22'),_0x3c397f[_0x91fe('0x1f')])})[_0x91fe('0x1d')](function(_0x26c43c){logger[_0x91fe('0xe')]('Admin\x20account\x20selected.');return _0x26c43c;});}});}else{logger['info'](_0x91fe('0x23'));return request({'uri':util[_0x91fe('0x11')](_0x91fe('0x22'),_0x3c397f[_0x91fe('0x1f')])})[_0x91fe('0x1d')](function(_0xa7fd16){logger['info'](_0x91fe('0x24'));return _0xa7fd16;});}}function getEndUser(_0x43d067,_0x37c722,_0x2b775e){logger['info'](_0x91fe('0x25'),_0x2b775e);return request({'uri':util[_0x91fe('0x11')]('%s/api/v2/contacts',_0x43d067[_0x91fe('0x1f')]),'qs':{'phone':_0x2b775e}})[_0x91fe('0x1d')](function(_0x3f97ee){if(_0x3f97ee[_0x91fe('0x26')]){logger[_0x91fe('0xe')](_0x91fe('0x27'));return _['find'](_0x3f97ee,{'phone':_0x2b775e});}else{logger[_0x91fe('0xe')](_0x91fe('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x43d067[_0x91fe('0x1f')]),'method':_0x91fe('0x1c'),'body':{'name':_0x37c722,'phone':_0x2b775e}})['then'](function(_0x276eab){logger['info'](_0x91fe('0x29'));return _0x276eab;});}});}function getAuth(_0x2b1b8f){return util['format'](_0x91fe('0x2a'),new Buffer(_0x2b1b8f[_0x91fe('0x2b')]+':X')[_0x91fe('0x2c')](_0x91fe('0x2d')));}function request(_0x5a0f3c){logger[_0x91fe('0x2e')](_0x91fe('0x2f'),JSON[_0x91fe('0x30')](_0x5a0f3c));return rp(_[_0x91fe('0x9')](_0x5a0f3c,{'method':_0x91fe('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x40fc50,_0x5dd186){var _0x23c567=[];if(_0x40fc50&&_0x40fc50['length']>0x0){_0x23c567=_['map'](_0x40fc50,_0x5dd186);}return _0x23c567;}function getCustomFields(_0x9a0f05,_0x1f9f2f){var _0x3145cc=[];var _0x592ac2={'custom_fields':[]};if(_0x9a0f05[_0x91fe('0x26')]>0x0){_[_0x91fe('0x32')](_0x9a0f05,function(_0x1ca876){if(_[_0x91fe('0x33')](['string','picklist'],_0x1ca876[_0x91fe('0x34')])&&_0x1ca876[_0x91fe('0x35')]&&!_0x1ca876[_0x91fe('0x36')]){_0x592ac2[_0x1ca876[_0x91fe('0x35')][_0x91fe('0x37')]()]=_0x1ca876[_0x91fe('0x38')]['toString']();}else if(_[_0x91fe('0x33')](['string','picklist'],_0x1ca876[_0x91fe('0x34')])&&_0x1ca876['idField']&&_0x1ca876[_0x91fe('0x36')]){_0x592ac2['custom_fields'][_0x91fe('0x39')]({'id':_0x1ca876[_0x91fe('0x3a')],'value':_0x1ca876[_0x91fe('0x38')][_0x91fe('0x2c')]()});}else if(_0x1ca876[_0x91fe('0x34')]===_0x91fe('0x3b')&&_0x1ca876['variableName']&&_0x1ca876['idField']&&_0x1ca876[_0x91fe('0x36')]){_0x1f9f2f[_0x1ca876['variableName']]&&_0x592ac2[_0x91fe('0x19')][_0x91fe('0x39')]({'id':_0x1ca876[_0x91fe('0x3a')],'value':_0x1f9f2f[_0x1ca876[_0x91fe('0x3c')]][_0x91fe('0x2c')]()});}else if(_0x1ca876[_0x91fe('0x34')]===_0x91fe('0x3d')&&_0x1ca876['Variable']&&_0x1ca876[_0x91fe('0x3e')][_0x91fe('0x17')]&&_0x1ca876[_0x91fe('0x3a')]&&_0x1ca876[_0x91fe('0x36')]){_0x1f9f2f[_0x1ca876['Variable'][_0x91fe('0x17')]['toLowerCase']()]&&_0x592ac2[_0x91fe('0x19')][_0x91fe('0x39')]({'id':_0x1ca876['idField'],'value':_0x1f9f2f[_0x1ca876['Variable'][_0x91fe('0x17')][_0x91fe('0x37')]()][_0x91fe('0x2c')]()});}});}return _0x592ac2;}exports[_0x91fe('0x3f')]=function(_0x46b39d,_0x4f6233,_0x562ae5,_0xeac37,_0x49124a,_0x3d0dd7){var _0x573d27,_0x2d817d;_0x3d0dd7['remoteUri']=intUtil[_0x91fe('0x40')](_0x3d0dd7[_0x91fe('0x1f')]);_0x3d0dd7[_0x91fe('0x41')]=intUtil[_0x91fe('0x40')](_0x3d0dd7['serverUrl']);if(_0x49124a&&_0x49124a[_0x91fe('0x42')]){logger[_0x91fe('0xe')]('[QUEUE]',_0x91fe('0x43'));_0x4f6233[_0x91fe('0x44')]=util['format'](_0x91fe('0x45'),_0x3d0dd7[_0x91fe('0x41')],_0x4f6233['uniqueid'],md5(_0x4f6233['uniqueid']));}else{_0x4f6233[_0x91fe('0x44')]='';}headers[_0x91fe('0x46')]=getAuth(_0x3d0dd7);return getUser(_0x3d0dd7,_0xeac37[_0x91fe('0x47')])[_0x91fe('0x1d')](function(_0x588ea7){_0x573d27=_0x588ea7;logger[_0x91fe('0xe')](_0x91fe('0x48'),_0x573d27['id']);return getEndUser(_0x3d0dd7,_0x4f6233[_0x91fe('0x49')],_0x4f6233['calleridnum']);})[_0x91fe('0x1d')](function(_0xc04cb){_0x2d817d=_0xc04cb;logger['info'](_0x91fe('0x4a'),_0x2d817d['id']);return getTicket(_0x3d0dd7,_0x573d27,_0x2d817d,_0x562ae5,_0x4f6233);})['then'](function(_0xb4066e){if(_0xb4066e&&_0xb4066e['id']){logger[_0x91fe('0xe')](_0x91fe('0x4b'));logger[_0x91fe('0xe')]('The\x20Ticket\x20ID\x20is:',_0xb4066e['id']);logger[_0x91fe('0xe')](_0x91fe('0x4c'),_0x91fe('0x4d'));emit(util[_0x91fe('0x11')]('user:%s',_0xeac37[_0x91fe('0x17')]),_0x91fe('0x4e'),{'uri':util[_0x91fe('0x11')](_0x91fe('0x4f'),_0x3d0dd7['remoteUri'],_0xb4066e['id'])});}})['catch'](function(_0x33e0a8){logger[_0x91fe('0x50')]('[QUEUE]',JSON['stringify'](_0x33e0a8));});};exports[_0x91fe('0x51')]=function(_0x1afc98,_0xbcbd7b,_0xfd2391,_0x23dfb2,_0x16c80c,_0x29547d,_0x1ec675){var _0x4d94fd,_0x193a82;_0x29547d[_0x91fe('0x1f')]=intUtil[_0x91fe('0x40')](_0x29547d['remoteUri']);_0x29547d['serverUrl']=intUtil[_0x91fe('0x40')](_0x29547d[_0x91fe('0x41')]);if(_0x1ec675&&_0x1ec675[_0x91fe('0x52')]&&_0x1ec675[_0x91fe('0x52')]!==_0x91fe('0x53')){logger[_0x91fe('0xe')]('[OUTBOUND]',_0x91fe('0x43'));_0xbcbd7b[_0x91fe('0x44')]=util[_0x91fe('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29547d[_0x91fe('0x41')],_0xbcbd7b[_0x91fe('0x54')],md5(_0xbcbd7b[_0x91fe('0x54')]));}headers[_0x91fe('0x46')]=getAuth(_0x29547d);return getUser(_0x29547d,_0x23dfb2[_0x91fe('0x47')])[_0x91fe('0x1d')](function(_0x26f513){_0x4d94fd=_0x26f513;logger['info'](_0x91fe('0x48'),_0x4d94fd['id']);return getEndUser(_0x29547d,_0xbcbd7b[_0x91fe('0x55')],_0xbcbd7b['destcalleridnum']);})[_0x91fe('0x1d')](function(_0x35cf91){_0x193a82=_0x35cf91;logger[_0x91fe('0xe')](_0x91fe('0x4a'),_0x193a82['id']);return getTicket(_0x29547d,_0x4d94fd,_0x193a82,_0xfd2391,_0xbcbd7b);})['then'](function(_0x55fc5d){if(_0x55fc5d&&_0x55fc5d['id']){logger[_0x91fe('0xe')]('Ticket\x20created!');logger[_0x91fe('0xe')](_0x91fe('0x56'),_0x55fc5d['id']);logger[_0x91fe('0xe')](_0x91fe('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x91fe('0x11')](_0x91fe('0x58'),_0x23dfb2[_0x91fe('0x17')]),_0x91fe('0x4e'),{'uri':util[_0x91fe('0x11')](_0x91fe('0x4f'),_0x29547d['remoteUri'],_0x55fc5d['id'])});}})['catch'](function(_0x238e07){logger[_0x91fe('0x50')]('[OUTBOUND]',JSON[_0x91fe('0x30')](_0x238e07));});};exports[_0x91fe('0x59')]=function(_0x8e36f9,_0x25d8dc,_0x198352,_0xc0e214,_0x1fd672,_0x5701e3){var _0x5a4ea6,_0x41fafb;_0x5701e3[_0x91fe('0x1f')]=intUtil[_0x91fe('0x40')](_0x5701e3['remoteUri']);_0x5701e3[_0x91fe('0x41')]=intUtil[_0x91fe('0x40')](_0x5701e3[_0x91fe('0x41')]);if(_0x1fd672&&_0x1fd672['monitor_format']){logger[_0x91fe('0xe')]('['+_0x25d8dc[_0x91fe('0x5a')][_0x91fe('0x5b')]()+']',_0x91fe('0x43'));_0x25d8dc[_0x91fe('0x44')]=util['format'](_0x91fe('0x45'),_0x5701e3[_0x91fe('0x41')],_0x25d8dc[_0x91fe('0x54')],md5(_0x25d8dc[_0x91fe('0x54')]));}else{_0x25d8dc[_0x91fe('0x44')]='';}headers['Authorization']=getAuth(_0x5701e3);return getUser(_0x5701e3,'')[_0x91fe('0x1d')](function(_0x3eb285){_0x5a4ea6=_0x3eb285;logger[_0x91fe('0xe')]('The\x20User\x20ID\x20is:',_0x5a4ea6['id']);return getEndUser(_0x5701e3,_0x25d8dc['calleridname'],_0x25d8dc[_0x91fe('0x5c')]);})['then'](function(_0x479a35){_0x41fafb=_0x479a35;logger[_0x91fe('0xe')](_0x91fe('0x4a'),_0x41fafb['id']);return getTicket(_0x5701e3,_0x5a4ea6,_0x41fafb,_0x198352,_0x25d8dc);})['then'](function(_0x263291){if(_0x263291){logger[_0x91fe('0xe')](_0x91fe('0x4b'));logger[_0x91fe('0xe')](_0x91fe('0x56'),_0x263291['id']);}})[_0x91fe('0x5d')](function(_0x42fa89){logger[_0x91fe('0x50')]('['+_0x25d8dc['lastevent'][_0x91fe('0x5b')]()+']',JSON[_0x91fe('0x30')](_0x42fa89));});}; \ No newline at end of file +var _0x8d47=['user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','catch','error','unmanaged','toUpperCase','Authorization','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','custom_fields','mapValues','value','%s/api/v2/tickets','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','remoteUri','Enduser\x20found!','find','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','push','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0x8d47,0x184));var _0x78d4=function(_0x3f6281,_0x12d41d){_0x3f6281=_0x3f6281-0x0;var _0x58a481=_0x8d47[_0x3f6281];return _0x58a481;};'use strict';var _=require('lodash');var rp=require(_0x78d4('0x0'));var md5=require('md5');var util=require(_0x78d4('0x1'));var Redis=require(_0x78d4('0x2'));var intUtil=require(_0x78d4('0x3'));var config=require(_0x78d4('0x4'));var logger=require('../../../../config/logger')(_0x78d4('0x5'));config[_0x78d4('0x6')]=_[_0x78d4('0x7')](config['redis'],{'host':_0x78d4('0x8'),'port':0x18eb});var io=require(_0x78d4('0x9'))(new Redis(config[_0x78d4('0x6')]));var headers={'Content-Type':_0x78d4('0xa'),'Accept':'application/json'};function emit(_0x482a7d,_0x41a091,_0x1a164d){io['to'](_0x482a7d)[_0x78d4('0xb')](_0x41a091,_0x1a164d);}function getTicket(_0x5b504c,_0x37223a,_0x351896,_0x2f782f,_0x383810){logger[_0x78d4('0xc')](_0x78d4('0xd'));var _0x3bbb47=_[_0x78d4('0xe')]({'responder_id':_0x37223a['id'],'requester_id':_0x351896['id'],'name':util[_0x78d4('0xf')](_0x78d4('0x10'),_0x383810[_0x78d4('0x11')]),'phone':_0x383810[_0x78d4('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x78d4('0x13')](_0x2f782f[_0x78d4('0x14')],_0x383810,'\x20'),'description':intUtil[_0x78d4('0x13')](_0x2f782f['Descriptions'],_0x383810,_0x78d4('0x15')),'tags':getTags(_0x2f782f[_0x78d4('0x16')],'name')},getCustomFields(_0x2f782f['Fields'],_0x383810));_0x3bbb47[_0x78d4('0x17')]=_[_0x78d4('0x18')](_['keyBy'](_0x3bbb47[_0x78d4('0x17')],'id'),_0x78d4('0x19'));return request({'uri':util['format'](_0x78d4('0x1a'),_0x5b504c['remoteUri']),'method':'POST','body':_0x3bbb47})[_0x78d4('0x1b')](function(_0x34ff78){logger[_0x78d4('0xc')](_0x78d4('0x1c'));return _0x34ff78;});}function getUser(_0x1aff9a,_0x13838c){if(intUtil['validateEmail'](_0x13838c)){return request({'uri':util[_0x78d4('0xf')](_0x78d4('0x1d'),_0x1aff9a['remoteUri']),'qs':{'email':_0x13838c}})[_0x78d4('0x1b')](function(_0x3e1753){if(_0x3e1753[_0x78d4('0x1e')]){logger[_0x78d4('0xc')](_0x78d4('0x1f'));return _['find'](_0x3e1753,function(_0x2fd197){return _0x2fd197[_0x78d4('0x20')][_0x78d4('0x21')]===_0x13838c;});}else{logger['info'](_0x78d4('0x22'));return request({'uri':util[_0x78d4('0xf')](_0x78d4('0x23'),_0x1aff9a['remoteUri'])})[_0x78d4('0x1b')](function(_0x106667){logger[_0x78d4('0xc')](_0x78d4('0x24'));return _0x106667;});}});}else{logger[_0x78d4('0xc')](_0x78d4('0x25'));return request({'uri':util[_0x78d4('0xf')]('%s/api/v2/agents/me',_0x1aff9a[_0x78d4('0x26')])})['then'](function(_0x145a93){logger[_0x78d4('0xc')](_0x78d4('0x24'));return _0x145a93;});}}function getEndUser(_0x2eb9b3,_0x216782,_0x5ef13f){logger[_0x78d4('0xc')]('Searching\x20enduser\x20with\x20phone',_0x5ef13f);return request({'uri':util['format']('%s/api/v2/contacts',_0x2eb9b3['remoteUri']),'qs':{'phone':_0x5ef13f}})[_0x78d4('0x1b')](function(_0x5573da){if(_0x5573da[_0x78d4('0x1e')]){logger[_0x78d4('0xc')](_0x78d4('0x27'));return _[_0x78d4('0x28')](_0x5573da,{'phone':_0x5ef13f});}else{logger[_0x78d4('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x78d4('0xf')]('%s/api/v2/contacts',_0x2eb9b3[_0x78d4('0x26')]),'method':_0x78d4('0x29'),'body':{'name':_0x216782,'phone':_0x5ef13f}})[_0x78d4('0x1b')](function(_0x4f53d1){logger[_0x78d4('0xc')](_0x78d4('0x2a'));return _0x4f53d1;});}});}function getAuth(_0x687c48){return util[_0x78d4('0xf')](_0x78d4('0x2b'),new Buffer(_0x687c48[_0x78d4('0x2c')]+':X')['toString'](_0x78d4('0x2d')));}function request(_0x54fc18){logger[_0x78d4('0x2e')](_0x78d4('0x2f'),JSON[_0x78d4('0x30')](_0x54fc18));return rp(_[_0x78d4('0x7')](_0x54fc18,{'method':_0x78d4('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5cd1ba,_0x35d39b){var _0x4b85e2=[];if(_0x5cd1ba&&_0x5cd1ba[_0x78d4('0x1e')]>0x0){_0x4b85e2=_[_0x78d4('0x32')](_0x5cd1ba,_0x35d39b);}return _0x4b85e2;}function getCustomFields(_0x285e7c,_0x593d37){var _0x3e6335=[];var _0x391ed1={'custom_fields':[]};if(_0x285e7c[_0x78d4('0x1e')]>0x0){_['forEach'](_0x285e7c,function(_0x2ea0b6){if(_[_0x78d4('0x33')]([_0x78d4('0x34'),_0x78d4('0x35')],_0x2ea0b6[_0x78d4('0x36')])&&_0x2ea0b6[_0x78d4('0x37')]&&!_0x2ea0b6[_0x78d4('0x38')]){_0x391ed1[_0x2ea0b6['nameField'][_0x78d4('0x39')]()]=_0x2ea0b6[_0x78d4('0x3a')][_0x78d4('0x3b')]();}else if(_[_0x78d4('0x33')]([_0x78d4('0x34'),_0x78d4('0x35')],_0x2ea0b6[_0x78d4('0x36')])&&_0x2ea0b6[_0x78d4('0x3c')]&&_0x2ea0b6[_0x78d4('0x38')]){_0x391ed1[_0x78d4('0x17')][_0x78d4('0x3d')]({'id':_0x2ea0b6[_0x78d4('0x3c')],'value':_0x2ea0b6[_0x78d4('0x3a')]['toString']()});}else if(_0x2ea0b6[_0x78d4('0x36')]===_0x78d4('0x3e')&&_0x2ea0b6[_0x78d4('0x3f')]&&_0x2ea0b6[_0x78d4('0x3c')]&&_0x2ea0b6['customField']){_0x593d37[_0x2ea0b6['variableName']]&&_0x391ed1[_0x78d4('0x17')][_0x78d4('0x3d')]({'id':_0x2ea0b6[_0x78d4('0x3c')],'value':_0x593d37[_0x2ea0b6[_0x78d4('0x3f')]][_0x78d4('0x3b')]()});}else if(_0x2ea0b6['type']==='customVariable'&&_0x2ea0b6[_0x78d4('0x40')]&&_0x2ea0b6[_0x78d4('0x40')][_0x78d4('0x41')]&&_0x2ea0b6[_0x78d4('0x3c')]&&_0x2ea0b6[_0x78d4('0x38')]){_0x593d37[_0x2ea0b6['Variable'][_0x78d4('0x41')]['toLowerCase']()]&&_0x391ed1[_0x78d4('0x17')][_0x78d4('0x3d')]({'id':_0x2ea0b6[_0x78d4('0x3c')],'value':_0x593d37[_0x2ea0b6[_0x78d4('0x40')][_0x78d4('0x41')]['toLowerCase']()][_0x78d4('0x3b')]()});}});}return _0x391ed1;}exports[_0x78d4('0x42')]=function(_0x1215fb,_0x1b1749,_0x587792,_0x288aed,_0xef6e45,_0x1cca72){var _0x5d99e1,_0x43ec1b;_0x1cca72[_0x78d4('0x26')]=intUtil[_0x78d4('0x43')](_0x1cca72[_0x78d4('0x26')]);_0x1cca72[_0x78d4('0x44')]=intUtil[_0x78d4('0x43')](_0x1cca72[_0x78d4('0x44')]);if(_0xef6e45&&_0xef6e45[_0x78d4('0x45')]){logger[_0x78d4('0xc')]('[QUEUE]',_0x78d4('0x46'));_0x1b1749[_0x78d4('0x47')]=util['format'](_0x78d4('0x48'),_0x1cca72[_0x78d4('0x44')],_0x1b1749['uniqueid'],md5(_0x1b1749['uniqueid']));}else{_0x1b1749[_0x78d4('0x47')]='';}headers['Authorization']=getAuth(_0x1cca72);return getUser(_0x1cca72,_0x288aed[_0x78d4('0x21')])[_0x78d4('0x1b')](function(_0x440672){_0x5d99e1=_0x440672;logger[_0x78d4('0xc')](_0x78d4('0x49'),_0x5d99e1['id']);return getEndUser(_0x1cca72,_0x1b1749[_0x78d4('0x11')],_0x1b1749[_0x78d4('0x12')]);})[_0x78d4('0x1b')](function(_0x184451){_0x43ec1b=_0x184451;logger['info'](_0x78d4('0x4a'),_0x43ec1b['id']);return getTicket(_0x1cca72,_0x5d99e1,_0x43ec1b,_0x587792,_0x1b1749);})[_0x78d4('0x1b')](function(_0x7bb972){if(_0x7bb972&&_0x7bb972['id']){logger[_0x78d4('0xc')](_0x78d4('0x1c'));logger[_0x78d4('0xc')]('The\x20Ticket\x20ID\x20is:',_0x7bb972['id']);logger[_0x78d4('0xc')](_0x78d4('0x4b'),_0x78d4('0x4c'));emit(util[_0x78d4('0xf')](_0x78d4('0x4d'),_0x288aed[_0x78d4('0x41')]),_0x78d4('0x4e'),{'uri':util[_0x78d4('0xf')](_0x78d4('0x4f'),_0x1cca72[_0x78d4('0x26')],_0x7bb972['id'])});}})['catch'](function(_0x157755){logger['error'](_0x78d4('0x4b'),JSON[_0x78d4('0x30')](_0x157755));});};exports[_0x78d4('0x50')]=function(_0x4277bb,_0x34ea76,_0x13f33b,_0x454dba,_0x350235,_0x457572,_0x488d14){var _0x44cead,_0x4f3934;_0x457572[_0x78d4('0x26')]=intUtil[_0x78d4('0x43')](_0x457572[_0x78d4('0x26')]);_0x457572['serverUrl']=intUtil[_0x78d4('0x43')](_0x457572['serverUrl']);if(_0x488d14&&_0x488d14['recordingFormat']&&_0x488d14[_0x78d4('0x51')]!==_0x78d4('0x52')){logger[_0x78d4('0xc')](_0x78d4('0x53'),_0x78d4('0x46'));_0x34ea76[_0x78d4('0x47')]=util[_0x78d4('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x457572[_0x78d4('0x44')],_0x34ea76[_0x78d4('0x54')],md5(_0x34ea76[_0x78d4('0x54')]));}headers['Authorization']=getAuth(_0x457572);return getUser(_0x457572,_0x454dba[_0x78d4('0x21')])[_0x78d4('0x1b')](function(_0x55b695){_0x44cead=_0x55b695;logger[_0x78d4('0xc')](_0x78d4('0x49'),_0x44cead['id']);return getEndUser(_0x457572,_0x34ea76[_0x78d4('0x55')],_0x34ea76[_0x78d4('0x56')]);})[_0x78d4('0x1b')](function(_0x24f1f3){_0x4f3934=_0x24f1f3;logger['info'](_0x78d4('0x4a'),_0x4f3934['id']);return getTicket(_0x457572,_0x44cead,_0x4f3934,_0x13f33b,_0x34ea76);})['then'](function(_0x63fc74){if(_0x63fc74&&_0x63fc74['id']){logger[_0x78d4('0xc')](_0x78d4('0x1c'));logger[_0x78d4('0xc')](_0x78d4('0x57'),_0x63fc74['id']);logger[_0x78d4('0xc')](_0x78d4('0x53'),_0x78d4('0x4c'));emit(util[_0x78d4('0xf')]('user:%s',_0x454dba['name']),_0x78d4('0x4e'),{'uri':util[_0x78d4('0xf')]('%s/helpdesk/tickets/%d',_0x457572[_0x78d4('0x26')],_0x63fc74['id'])});}})[_0x78d4('0x58')](function(_0x17edad){logger[_0x78d4('0x59')](_0x78d4('0x53'),JSON[_0x78d4('0x30')](_0x17edad));});};exports[_0x78d4('0x5a')]=function(_0x226578,_0x425859,_0x5859d3,_0x2c9c4b,_0x2df144,_0x1a9b0b){var _0x179ea9,_0x484ed2;_0x1a9b0b[_0x78d4('0x26')]=intUtil[_0x78d4('0x43')](_0x1a9b0b[_0x78d4('0x26')]);_0x1a9b0b[_0x78d4('0x44')]=intUtil[_0x78d4('0x43')](_0x1a9b0b[_0x78d4('0x44')]);if(_0x2df144&&_0x2df144[_0x78d4('0x45')]){logger['info']('['+_0x425859['lastevent'][_0x78d4('0x5b')]()+']','Recording\x20is\x20enabled!');_0x425859[_0x78d4('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a9b0b[_0x78d4('0x44')],_0x425859[_0x78d4('0x54')],md5(_0x425859['uniqueid']));}else{_0x425859[_0x78d4('0x47')]='';}headers[_0x78d4('0x5c')]=getAuth(_0x1a9b0b);return getUser(_0x1a9b0b,'')[_0x78d4('0x1b')](function(_0x304355){_0x179ea9=_0x304355;logger['info'](_0x78d4('0x49'),_0x179ea9['id']);return getEndUser(_0x1a9b0b,_0x425859[_0x78d4('0x11')],_0x425859[_0x78d4('0x12')]);})[_0x78d4('0x1b')](function(_0x32b9a3){_0x484ed2=_0x32b9a3;logger[_0x78d4('0xc')](_0x78d4('0x4a'),_0x484ed2['id']);return getTicket(_0x1a9b0b,_0x179ea9,_0x484ed2,_0x5859d3,_0x425859);})['then'](function(_0x5e9176){if(_0x5e9176){logger[_0x78d4('0xc')](_0x78d4('0x1c'));logger['info'](_0x78d4('0x57'),_0x5e9176['id']);}})[_0x78d4('0x58')](function(_0x39e58a){logger['error']('['+_0x425859['lastevent'][_0x78d4('0x5b')]()+']',JSON[_0x78d4('0x30')](_0x39e58a));});}; \ 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 5941236..12ba987 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 _0xd62a=['YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','task','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','adminEmail','username','toLowerCase','destcalleridnum','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','GET','Getting\x20user\x20list','users','agentEmail','length','User\x20found:','userId','Admin\x20selected','userEmail','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts'];(function(_0x5f10d9,_0x16a7d5){var _0x1c7ec4=function(_0x36ef7e){while(--_0x36ef7e){_0x5f10d9['push'](_0x5f10d9['shift']());}};_0x1c7ec4(++_0x16a7d5);}(_0xd62a,0x1c2));var _0xad62=function(_0x42c70d,_0x492bae){_0x42c70d=_0x42c70d-0x0;var _0x242101=_0xd62a[_0x42c70d];return _0x242101;};'use strict';var _=require(_0xad62('0x0'));var rp=require('request-promise');var md5=require(_0xad62('0x1'));var util=require(_0xad62('0x2'));var moment=require(_0xad62('0x3'));var Promise=require(_0xad62('0x4'));var Redis=require('ioredis');var intUtil=require(_0xad62('0x5'));var config=require(_0xad62('0x6'));var logger=require(_0xad62('0x7'))(_0xad62('0x8'));config['redis']=_['defaults'](config[_0xad62('0x9')],{'host':_0xad62('0xa'),'port':0x18eb});var io=require(_0xad62('0xb'))(new Redis(config['redis']));function getAdminId(_0x650b76,_0x713e65,_0x1e3cbe,_0x410fea){return new Promise(function(_0x165db1,_0x55a63d){var _0x191391=![];var _0x653ffc={'method':'GET','uri':_0x410fea+_0xad62('0xc'),'json':!![]};_0x653ffc[_0xad62('0xd')]=_0x1e3cbe;logger[_0xad62('0xe')](_0xad62('0xf'));return rp(_0x653ffc)[_0xad62('0x10')](function(_0x6c465d){if(_0x6c465d){var _0x1fd257=_0x6c465d['users'];var _0x40631b=null;for(_0x40631b=0x0;_0x40631b<_0x1fd257['length'];_0x40631b++){if(_0x1fd257[_0x40631b][_0xad62('0x11')]===_0x650b76['adminEmail']){_0x650b76[_0xad62('0x12')]=_0x1fd257[_0x40631b]['id'];_0x191391=!![];}}if(_0x191391){logger[_0xad62('0xe')]('Admin\x20found:',_0x650b76[_0xad62('0x12')]);_0x165db1(_0x650b76);}else{_0x55a63d({'statusCode':0x194,'message':_0xad62('0x13')});}}else{_0x55a63d({'statusCode':0x194,'message':_0xad62('0x13')});}})[_0xad62('0x14')](function(_0x50ed7a){logger['error']('['+[_0x713e65[_0xad62('0x15')]()]+']',_0x50ed7a[_0xad62('0x16')]);_0x55a63d(_0x50ed7a);});});}function getUser(_0x42ba67,_0x5b57eb,_0x1fba44){return function(_0x3e9dc5){return new Promise(function(_0x93e388,_0x9d6112){var _0x81986f={'method':_0xad62('0x17'),'uri':_0x1fba44+_0xad62('0xc'),'json':!![]};_0x81986f['headers']=_0x5b57eb;logger[_0xad62('0xe')](_0xad62('0x18'));return rp(_0x81986f)[_0xad62('0x10')](function(_0x3ff887){if(_0x3ff887){var _0x4d3133=_0x3ff887[_0xad62('0x19')];var _0x337be2=![];var _0x48c310=null;if(_0x3e9dc5[_0xad62('0x1a')]!==null){logger[_0xad62('0xe')]('Getting\x20user\x20with\x20email',_0x3e9dc5[_0xad62('0x1a')]);_0x3e9dc5['userEmail']=_0x3e9dc5[_0xad62('0x1a')];for(_0x48c310=0x0;_0x48c310<_0x4d3133[_0xad62('0x1b')];_0x48c310++){if(_0x4d3133[_0x48c310][_0xad62('0x11')]===_0x3e9dc5[_0xad62('0x1a')]){_0x337be2=!![];_0x3e9dc5['userId']=_0x4d3133[_0x48c310]['id'];logger[_0xad62('0xe')](_0xad62('0x1c'),_0x3e9dc5[_0xad62('0x1d')]);}}}if(!_0x337be2){logger['info'](_0xad62('0x1e'));_0x3e9dc5[_0xad62('0x1f')]=_0x3e9dc5['adminEmail'];_0x3e9dc5[_0xad62('0x1d')]=_0x3e9dc5[_0xad62('0x12')];_0x337be2=!![];}if(_0x337be2){_0x93e388(_0x3e9dc5);}else{_0x9d6112({'statusCode':0x194,'message':_0xad62('0x13')});}}else{_0x9d6112({'statusCode':0x194,'message':_0xad62('0x13')});}})['catch'](function(_0x3bf20f){logger[_0xad62('0x20')]('['+[_0x42ba67['toUpperCase']()]+']',_0x3bf20f[_0xad62('0x16')]);_0x9d6112(_0x3bf20f);});});};}function searchContact(_0x31a161,_0x54ff47,_0x1a9237,_0x37242e){return new Promise(function(_0x5a6e2e,_0x1cf9bf){var _0x59ad63={'method':_0xad62('0x17'),'headers':_0x54ff47,'uri':_0x31a161+_0xad62('0x21')+_0x37242e+_0xad62('0x22')+_0x1a9237+_0xad62('0x23'),'json':!![]};rp(_0x59ad63)[_0xad62('0x10')](function(_0x266875){var _0x2f5aab=_[_0xad62('0x24')](_0x266875[_0xad62('0x25')]['contacts'],[_0x1a9237,_0x37242e]);_0x5a6e2e(_0x2f5aab);})[_0xad62('0x14')](function(_0xb2fc95){_0x1cf9bf(_0xb2fc95);});});}function getEndUser(_0x5a3de4,_0x34aa77,_0xc76f4){return function(_0x24866f){return new Promise(function(_0x4244ae,_0x15e56f){logger['info'](util[_0xad62('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x24866f['contactNumber']));searchContact(_0xc76f4,_0x34aa77,_0xad62('0x27'),_0x24866f[_0xad62('0x28')])[_0xad62('0x10')](function(_0x2e0e1b){if(_0x2e0e1b){_0x24866f[_0xad62('0x29')]=_0x2e0e1b['id'];logger['info'](_0xad62('0x2a'),_0x24866f[_0xad62('0x29')]);return _0x4244ae(_0x24866f);}searchContact(_0xc76f4,_0x34aa77,_0xad62('0x2b'),_0x24866f[_0xad62('0x28')])[_0xad62('0x10')](function(_0x1403b8){if(_0x1403b8){_0x24866f[_0xad62('0x29')]=_0x1403b8['id'];logger[_0xad62('0xe')](_0xad62('0x2c'),_0x24866f[_0xad62('0x29')]);return _0x4244ae(_0x24866f);}createEndUser(_0x24866f,_0x5a3de4,_0x34aa77,_0xc76f4)[_0xad62('0x10')](function(_0x1e86a3){logger[_0xad62('0xe')](_0xad62('0x2d'),_0x1e86a3[_0xad62('0x29')]);return _0x4244ae(_0x1e86a3);});});})[_0xad62('0x14')](function(_0x4b7221){_0x15e56f(_0x4b7221);});});};}function createEndUser(_0x3136b3,_0x3b3a34,_0x52b4e5,_0x15531e){return new Promise(function(_0x36bf64,_0x4dbd12){var _0x46b4c1=moment();var _0xa9080b={'method':_0xad62('0x2e'),'uri':_0x15531e+_0xad62('0x2f'),'body':{'contact':{'last_name':_0x3136b3[_0xad62('0x28')],'work_number':_0x3136b3[_0xad62('0x28')],'mobile_number':_0x3136b3[_0xad62('0x28')],'owner_id':_0x3136b3[_0xad62('0x1d')],'created_at':_0x46b4c1['format'](_0xad62('0x30'))}},'json':!![]};_0xa9080b[_0xad62('0xd')]=_0x52b4e5;logger['info'](_0xad62('0x31'));return rp(_0xa9080b)[_0xad62('0x10')](function(_0xb0a21c){_0x3136b3[_0xad62('0x29')]=_0xb0a21c[_0xad62('0x32')]['id'];_0x36bf64(_0x3136b3);})['catch'](function(_0x217331){logger[_0xad62('0x20')]('['+[_0x3b3a34[_0xad62('0x15')]()]+']',_0x217331['message']);_0x4dbd12(_0x217331[_0xad62('0x16')]);});});}function getTicket(_0x577fd7,_0xfff6a7,_0x46a848,_0x3a5a73,_0x5764d8){return function(_0x4c5862){logger[_0xad62('0xe')](_0xad62('0x33'));return new Promise(function(_0x562ee7,_0x40c20c){var _0x4fc8a4=moment();var _0x4ce6a9={'method':'POST','uri':_0x46a848+_0xad62('0x34'),'body':{'title':intUtil[_0xad62('0x35')](_0x3a5a73['Subjects'],_0x5764d8,'\x20'),'description':intUtil['getString'](_0x3a5a73[_0xad62('0x36')],_0x5764d8,'\x0a'),'owner_id':_0x4c5862[_0xad62('0x1d')],'creater_id':_0x4c5862[_0xad62('0x12')],'targetable_id':_0x4c5862[_0xad62('0x29')],'targetable_type':_0xad62('0x37'),'created_at':_0x4fc8a4[_0xad62('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4fc8a4['add'](0x1e,'m')[_0xad62('0x26')](_0xad62('0x30'))},'json':!![]};_0x4ce6a9[_0xad62('0xd')]=_0xfff6a7;return rp(_0x4ce6a9)[_0xad62('0x10')](function(_0x4d0f15){_0x4c5862['ticketId']=_0x4d0f15[_0xad62('0x38')]['id'];logger[_0xad62('0xe')]('Task\x20created:',_0x4c5862[_0xad62('0x39')]);_0x562ee7(_0x4c5862);})['catch'](function(_0x3e7c2c){logger[_0xad62('0x20')]('['+[_0x577fd7[_0xad62('0x15')]()]+']',_0x3e7c2c[_0xad62('0x16')]);_0x40c20c(_0x3e7c2c[_0xad62('0x16')]);});});};}function emit(_0x43bee1,_0x3cc764,_0x779b0f){var _0x3e4cfd={'uri':_0x43bee1+_0xad62('0x3a')+_0x779b0f};io['to'](util[_0xad62('0x26')](_0xad62('0x3b'),_0x3cc764))['emit'](_0xad62('0x3c'),_0x3e4cfd);}exports['cs']=function(_0x2adfe4,_0x24ad57,_0x49ea77,_0x5b95ab,_0x4a28cf,_0x44e887,_0x24fd18,_0x4b4f06){var _0x3f69fc={};var _0x24234e={'Authorization':_0xad62('0x3d')+_0x44e887[_0xad62('0x3e')]};_0x44e887['remoteUri']=intUtil[_0xad62('0x3f')](_0x44e887['remoteUri']);_0x44e887[_0xad62('0x40')]=intUtil[_0xad62('0x3f')](_0x44e887[_0xad62('0x40')]);var _0x141495=_0x44e887[_0xad62('0x41')];_0x3f69fc[_0xad62('0x42')]=_0x44e887[_0xad62('0x43')];_0x3f69fc[_0xad62('0x28')]=_0x4b4f06[_0xad62('0x44')]()==='outbound'?_0x24ad57[_0xad62('0x45')]:_0x24ad57['calleridnum'];_0x3f69fc['callDirection']=_0x4b4f06===_0xad62('0x46')||_0x4b4f06==='unmanaged'?'queue':_0xad62('0x47');if(_0x5b95ab){_0x3f69fc[_0xad62('0x1a')]=_0x5b95ab[_0xad62('0x11')];}var _0x5537ae=util[_0xad62('0x26')](_0xad62('0x48'),_0x44e887[_0xad62('0x40')],_0x24ad57[_0xad62('0x49')],md5(_0x24ad57[_0xad62('0x49')]));if(_0x4a28cf&&_0x4a28cf[_0xad62('0x4a')]){logger[_0xad62('0xe')](_0xad62('0x4b'),_0xad62('0x4c'));_0x24ad57[_0xad62('0x4d')]=_0x5537ae;}else if(_0x24fd18&&_0x24fd18['recordingFormat']&&_0x24fd18['recordingFormat']!==_0xad62('0x4e')){logger[_0xad62('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x24ad57[_0xad62('0x4d')]=_0x5537ae;}else{_0x24ad57['recordingURL']='';}return getAdminId(_0x3f69fc,_0x4b4f06,_0x24234e,_0x141495)['then'](getUser(_0x4b4f06,_0x24234e,_0x141495))[_0xad62('0x10')](getEndUser(_0x4b4f06,_0x24234e,_0x141495))[_0xad62('0x10')](getTicket(_0x4b4f06,_0x24234e,_0x141495,_0x49ea77,_0x24ad57))[_0xad62('0x10')](function(_0x4a1908){logger['info'](util[_0xad62('0x26')](_0xad62('0x4f'),_0x4a1908[_0xad62('0x39')]));if(_0x4b4f06!=='unmanaged'){logger['info']('['+[_0x4b4f06[_0xad62('0x15')]()]+']',_0xad62('0x50'));emit(_0x141495,_0x5b95ab[_0xad62('0x51')],_0x4a1908['endUserId']);}})['catch'](function(_0x35829f){logger[_0xad62('0x20')]('['+[_0x4b4f06['toUpperCase']()]+_0xad62('0x52'),util['inspect'](_0x35829f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x967d=[']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','Getting\x20admin\x20information','then','users','length','email','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','headers','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','adminId','Contact','ticketId','task','Task\x20created:','/contacts/','emit','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!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name'];(function(_0x7b60fc,_0x4a6208){var _0x351cf9=function(_0x57efb3){while(--_0x57efb3){_0x7b60fc['push'](_0x7b60fc['shift']());}};_0x351cf9(++_0x4a6208);}(_0x967d,0x15a));var _0xd967=function(_0x95655b,_0x3e1048){_0x95655b=_0x95655b-0x0;var _0x3aa956=_0x967d[_0x95655b];return _0x3aa956;};'use strict';var _=require(_0xd967('0x0'));var rp=require(_0xd967('0x1'));var md5=require(_0xd967('0x2'));var util=require(_0xd967('0x3'));var moment=require('moment');var Promise=require(_0xd967('0x4'));var Redis=require(_0xd967('0x5'));var intUtil=require(_0xd967('0x6'));var config=require(_0xd967('0x7'));var logger=require(_0xd967('0x8'))(_0xd967('0x9'));config['redis']=_[_0xd967('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd967('0xb')]));function getAdminId(_0x339d6e,_0x29ec32,_0x3ae5f6,_0x5c0678){return new Promise(function(_0x90f033,_0x33d322){var _0x1fc4da=![];var _0x17cf9a={'method':'GET','uri':_0x5c0678+'/api/selector/owners','json':!![]};_0x17cf9a['headers']=_0x3ae5f6;logger['info'](_0xd967('0xc'));return rp(_0x17cf9a)[_0xd967('0xd')](function(_0x11ca72){if(_0x11ca72){var _0x41bbbd=_0x11ca72[_0xd967('0xe')];var _0x2194de=null;for(_0x2194de=0x0;_0x2194de<_0x41bbbd[_0xd967('0xf')];_0x2194de++){if(_0x41bbbd[_0x2194de][_0xd967('0x10')]===_0x339d6e['adminEmail']){_0x339d6e['adminId']=_0x41bbbd[_0x2194de]['id'];_0x1fc4da=!![];}}if(_0x1fc4da){logger[_0xd967('0x11')](_0xd967('0x12'),_0x339d6e['adminId']);_0x90f033(_0x339d6e);}else{_0x33d322({'statusCode':0x194,'message':_0xd967('0x13')});}}else{_0x33d322({'statusCode':0x194,'message':_0xd967('0x13')});}})[_0xd967('0x14')](function(_0x287bb2){logger[_0xd967('0x15')]('['+[_0x29ec32[_0xd967('0x16')]()]+']',_0x287bb2[_0xd967('0x17')]);_0x33d322(_0x287bb2);});});}function getUser(_0x540394,_0x13b66d,_0x3d4f19){return function(_0xbc1bea){return new Promise(function(_0x16b3ee,_0x12cd8a){var _0x285850={'method':_0xd967('0x18'),'uri':_0x3d4f19+_0xd967('0x19'),'json':!![]};_0x285850[_0xd967('0x1a')]=_0x13b66d;logger['info']('Getting\x20user\x20list');return rp(_0x285850)[_0xd967('0xd')](function(_0x51cea8){if(_0x51cea8){var _0x38a569=_0x51cea8['users'];var _0x2dc6e9=![];var _0x4c9551=null;if(_0xbc1bea[_0xd967('0x1b')]!==null){logger['info'](_0xd967('0x1c'),_0xbc1bea[_0xd967('0x1b')]);_0xbc1bea['userEmail']=_0xbc1bea[_0xd967('0x1b')];for(_0x4c9551=0x0;_0x4c9551<_0x38a569[_0xd967('0xf')];_0x4c9551++){if(_0x38a569[_0x4c9551]['email']===_0xbc1bea[_0xd967('0x1b')]){_0x2dc6e9=!![];_0xbc1bea[_0xd967('0x1d')]=_0x38a569[_0x4c9551]['id'];logger[_0xd967('0x11')](_0xd967('0x1e'),_0xbc1bea[_0xd967('0x1d')]);}}}if(!_0x2dc6e9){logger['info'](_0xd967('0x1f'));_0xbc1bea['userEmail']=_0xbc1bea[_0xd967('0x20')];_0xbc1bea[_0xd967('0x1d')]=_0xbc1bea['adminId'];_0x2dc6e9=!![];}if(_0x2dc6e9){_0x16b3ee(_0xbc1bea);}else{_0x12cd8a({'statusCode':0x194,'message':_0xd967('0x13')});}}else{_0x12cd8a({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1eb00c){logger[_0xd967('0x15')]('['+[_0x540394['toUpperCase']()]+']',_0x1eb00c['message']);_0x12cd8a(_0x1eb00c);});});};}function searchContact(_0x181104,_0x167b5e,_0x4290af,_0x2853cf){return new Promise(function(_0x3d3be7,_0x43b716){var _0x2b86b7={'method':_0xd967('0x18'),'headers':_0x167b5e,'uri':_0x181104+_0xd967('0x21')+_0x2853cf+_0xd967('0x22')+_0x4290af+'&entities=contact','json':!![]};rp(_0x2b86b7)[_0xd967('0xd')](function(_0x361df9){var _0x42cdb7=_[_0xd967('0x23')](_0x361df9[_0xd967('0x24')][_0xd967('0x24')],[_0x4290af,_0x2853cf]);_0x3d3be7(_0x42cdb7);})[_0xd967('0x14')](function(_0x140668){_0x43b716(_0x140668);});});}function getEndUser(_0x12eae1,_0x2e87bf,_0x350cb8){return function(_0x4ef19d){return new Promise(function(_0x4cecf2,_0x2b940f){logger[_0xd967('0x11')](util[_0xd967('0x25')](_0xd967('0x26'),_0x4ef19d[_0xd967('0x27')]));searchContact(_0x350cb8,_0x2e87bf,'mobile_number',_0x4ef19d[_0xd967('0x27')])[_0xd967('0xd')](function(_0x148825){if(_0x148825){_0x4ef19d[_0xd967('0x28')]=_0x148825['id'];logger[_0xd967('0x11')](_0xd967('0x29'),_0x4ef19d['endUserId']);return _0x4cecf2(_0x4ef19d);}searchContact(_0x350cb8,_0x2e87bf,_0xd967('0x2a'),_0x4ef19d[_0xd967('0x27')])[_0xd967('0xd')](function(_0x1bf397){if(_0x1bf397){_0x4ef19d[_0xd967('0x28')]=_0x1bf397['id'];logger[_0xd967('0x11')]('Contact\x20found\x20work_number:',_0x4ef19d['endUserId']);return _0x4cecf2(_0x4ef19d);}createEndUser(_0x4ef19d,_0x12eae1,_0x2e87bf,_0x350cb8)['then'](function(_0x53e76e){logger[_0xd967('0x11')](_0xd967('0x2b'),_0x53e76e[_0xd967('0x28')]);return _0x4cecf2(_0x53e76e);});});})[_0xd967('0x14')](function(_0x945a15){_0x2b940f(_0x945a15);});});};}function createEndUser(_0x4771a6,_0x546c5d,_0x5bbdda,_0x2ff8e5){return new Promise(function(_0x5fb019,_0x2c5a4c){var _0x5e135f=moment();var _0x13a64b={'method':_0xd967('0x2c'),'uri':_0x2ff8e5+'/api/contacts','body':{'contact':{'last_name':_0x4771a6[_0xd967('0x27')],'work_number':_0x4771a6[_0xd967('0x27')],'mobile_number':_0x4771a6[_0xd967('0x27')],'owner_id':_0x4771a6[_0xd967('0x1d')],'created_at':_0x5e135f[_0xd967('0x25')](_0xd967('0x2d'))}},'json':!![]};_0x13a64b[_0xd967('0x1a')]=_0x5bbdda;logger[_0xd967('0x11')](_0xd967('0x2e'));return rp(_0x13a64b)['then'](function(_0x370e15){_0x4771a6['endUserId']=_0x370e15[_0xd967('0x2f')]['id'];_0x5fb019(_0x4771a6);})[_0xd967('0x14')](function(_0x5ca783){logger[_0xd967('0x15')]('['+[_0x546c5d[_0xd967('0x16')]()]+']',_0x5ca783['message']);_0x2c5a4c(_0x5ca783[_0xd967('0x17')]);});});}function getTicket(_0x401053,_0x411877,_0x165f1f,_0x5ca6f7,_0x258c6e){return function(_0x430f8b){logger[_0xd967('0x11')](_0xd967('0x30'));return new Promise(function(_0x3f8c19,_0x631be){var _0x1fa78a=moment();var _0x37e08e={'method':_0xd967('0x2c'),'uri':_0x165f1f+'/api/tasks','body':{'title':intUtil[_0xd967('0x31')](_0x5ca6f7[_0xd967('0x32')],_0x258c6e,'\x20'),'description':intUtil[_0xd967('0x31')](_0x5ca6f7[_0xd967('0x33')],_0x258c6e,'\x0a'),'owner_id':_0x430f8b[_0xd967('0x1d')],'creater_id':_0x430f8b[_0xd967('0x34')],'targetable_id':_0x430f8b[_0xd967('0x28')],'targetable_type':_0xd967('0x35'),'created_at':_0x1fa78a['format'](_0xd967('0x2d')),'due_date':_0x1fa78a['add'](0x1e,'m')[_0xd967('0x25')](_0xd967('0x2d'))},'json':!![]};_0x37e08e['headers']=_0x411877;return rp(_0x37e08e)[_0xd967('0xd')](function(_0x50dbf5){_0x430f8b[_0xd967('0x36')]=_0x50dbf5[_0xd967('0x37')]['id'];logger[_0xd967('0x11')](_0xd967('0x38'),_0x430f8b[_0xd967('0x36')]);_0x3f8c19(_0x430f8b);})[_0xd967('0x14')](function(_0x3df494){logger[_0xd967('0x15')]('['+[_0x401053['toUpperCase']()]+']',_0x3df494[_0xd967('0x17')]);_0x631be(_0x3df494['message']);});});};}function emit(_0x17e95c,_0x3af50a,_0x2ae8c6){var _0x5bc628={'uri':_0x17e95c+_0xd967('0x39')+_0x2ae8c6};io['to'](util[_0xd967('0x25')]('user:%s',_0x3af50a))[_0xd967('0x3a')](_0xd967('0x3b'),_0x5bc628);}exports['cs']=function(_0x1836be,_0x1c0791,_0x302ebd,_0x37c58c,_0x116fa8,_0x2d3d1a,_0x3a158b,_0x5080b7){var _0x3816b6={};var _0x35bd55={'Authorization':_0xd967('0x3c')+_0x2d3d1a[_0xd967('0x3d')]};_0x2d3d1a[_0xd967('0x3e')]=intUtil[_0xd967('0x3f')](_0x2d3d1a['remoteUri']);_0x2d3d1a[_0xd967('0x40')]=intUtil[_0xd967('0x3f')](_0x2d3d1a[_0xd967('0x40')]);var _0x393bb3=_0x2d3d1a[_0xd967('0x3e')];_0x3816b6[_0xd967('0x20')]=_0x2d3d1a[_0xd967('0x41')];_0x3816b6['contactNumber']=_0x5080b7[_0xd967('0x42')]()===_0xd967('0x43')?_0x1c0791[_0xd967('0x44')]:_0x1c0791[_0xd967('0x45')];_0x3816b6[_0xd967('0x46')]=_0x5080b7==='queue'||_0x5080b7==='unmanaged'?_0xd967('0x47'):_0xd967('0x43');if(_0x37c58c){_0x3816b6[_0xd967('0x1b')]=_0x37c58c[_0xd967('0x10')];}var _0x681a0c=util['format'](_0xd967('0x48'),_0x2d3d1a['serverUrl'],_0x1c0791[_0xd967('0x49')],md5(_0x1c0791[_0xd967('0x49')]));if(_0x116fa8&&_0x116fa8['monitor_format']){logger[_0xd967('0x11')](_0xd967('0x4a'),_0xd967('0x4b'));_0x1c0791[_0xd967('0x4c')]=_0x681a0c;}else if(_0x3a158b&&_0x3a158b[_0xd967('0x4d')]&&_0x3a158b[_0xd967('0x4d')]!==_0xd967('0x4e')){logger['info'](_0xd967('0x4f'),'Recording\x20is\x20enabled!');_0x1c0791[_0xd967('0x4c')]=_0x681a0c;}else{_0x1c0791[_0xd967('0x4c')]='';}return getAdminId(_0x3816b6,_0x5080b7,_0x35bd55,_0x393bb3)[_0xd967('0xd')](getUser(_0x5080b7,_0x35bd55,_0x393bb3))[_0xd967('0xd')](getEndUser(_0x5080b7,_0x35bd55,_0x393bb3))['then'](getTicket(_0x5080b7,_0x35bd55,_0x393bb3,_0x302ebd,_0x1c0791))[_0xd967('0xd')](function(_0x3abaee){logger[_0xd967('0x11')](util[_0xd967('0x25')](_0xd967('0x50'),_0x3abaee[_0xd967('0x36')]));if(_0x5080b7!==_0xd967('0x51')){logger[_0xd967('0x11')]('['+[_0x5080b7[_0xd967('0x16')]()]+']',_0xd967('0x52'));emit(_0x393bb3,_0x37c58c[_0xd967('0x53')],_0x3abaee[_0xd967('0x28')]);}})[_0xd967('0x14')](function(_0x49cf22){logger[_0xd967('0x15')]('['+[_0x5080b7[_0xd967('0x16')]()]+_0xd967('0x54'),util[_0xd967('0x55')](_0x49cf22,{'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 62c38cf..c150e3b 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 _0xe48e=['unmanaged','zendesk','sugarcrm','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound'];(function(_0x2a0cbe,_0xfbf284){var _0x515b89=function(_0x286dc3){while(--_0x286dc3){_0x2a0cbe['push'](_0x2a0cbe['shift']());}};_0x515b89(++_0xfbf284);}(_0xe48e,0x10b));var _0xee48=function(_0x4963f5,_0x3f56b1){_0x4963f5=_0x4963f5-0x0;var _0x2f4577=_0xe48e[_0x4963f5];return _0x2f4577;};'use strict';var _=require(_0xee48('0x0'));var util=require(_0xee48('0x1'));var zendesk=require(_0xee48('0x2'));var salesforce=require(_0xee48('0x3'));var sugarcrm=require(_0xee48('0x4'));var freshdesk=require(_0xee48('0x5'));var zoho=require('./zoho');var desk=require(_0xee48('0x6'));var vtiger=require(_0xee48('0x7'));var servicenow=require(_0xee48('0x8'));var dynamics365=require(_0xee48('0x9'));var freshsales=require(_0xee48('0xa'));var integrations=['zendesk',_0xee48('0xb'),'sugarcrm',_0xee48('0xc'),_0xee48('0xd'),_0xee48('0xe'),_0xee48('0xf'),_0xee48('0x10'),_0xee48('0x11'),_0xee48('0x12')];exports[_0xee48('0x13')]=function(_0x543ffb,_0x41580e,_0x1f1cad,_0xf93b26,_0x202e39,_0x486741){if(_0x1f1cad){if(_[_0xee48('0x14')](integrations,_0x543ffb['data1'][_0xee48('0x15')]())){try{var _0xa1877f=null;var _0x208165='';var _0x4bd6a3=_0x1f1cad[_0x543ffb[_0xee48('0x16')]['toLowerCase']()];if(_0x4bd6a3){var _0x5beede=_0x4bd6a3[_0x543ffb[_0xee48('0x17')]];if(_0x5beede){var _0x181254=_[_0xee48('0x18')](_0x5beede[_0xee48('0x19')],{'id':parseInt(_0x543ffb[_0xee48('0x1a')],0xa)});if(_0x181254){if(_0xf93b26){if(_0x202e39&&_0x41580e[_0xee48('0x1b')]){_0x208165=_0xee48('0x1b');}else if(_0x41580e['routeId']){_0x208165=_0xee48('0x1c');}else{console['log']('EVENT\x20UNKNOWN',_0x41580e);}}else{_0x208165=_0xee48('0x1d');}switch(_0x543ffb['data1']['toLowerCase']()){case _0xee48('0x1e'):zendesk[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case'salesforce':salesforce[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0x1f'):sugarcrm[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xc'):freshdesk[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xd'):zoho[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xe'):desk[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0xf'):vtiger[_0x208165](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741);break;case _0xee48('0x11'):freshsales['cs'](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741,_0x208165);break;case _0xee48('0x12'):servicenow['cs'](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741,_0x208165);break;case _0xee48('0x10'):dynamics365['cs'](_0x543ffb,_0x41580e,_0x181254,_0xf93b26,_0x202e39,_0x5beede,_0x486741,_0x208165);break;default:console['log'](_0xee48('0x20'));}}else{_0xa1877f=require(_0xee48('0x21'))(_0x543ffb[_0xee48('0x16')]['toLowerCase']());_0xa1877f[_0xee48('0x22')]('[EXEC]',util[_0xee48('0x23')](_0xee48('0x24'),_0x543ffb[_0xee48('0x16')]['toLowerCase'](),_0x543ffb[_0xee48('0x1a')]));}}else{_0xa1877f=require(_0xee48('0x21'))(_0x543ffb['data1']['toLowerCase']());_0xa1877f[_0xee48('0x22')]('[EXEC]',util[_0xee48('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x543ffb[_0xee48('0x16')][_0xee48('0x15')](),_0x543ffb[_0xee48('0x17')]));}}else{}}catch(_0x3b0f93){console['error'](_0x3b0f93);}}}}; \ No newline at end of file +var _0x0e3f=['dynamics365','servicenow','exec','data1','find','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','zendesk','salesforce','zoho','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','desk'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x0e3f,0x7f));var _0xf0e3=function(_0x579da9,_0x4e98f7){_0x579da9=_0x579da9-0x0;var _0x3fcafb=_0x0e3f[_0x579da9];return _0x3fcafb;};'use strict';var _=require('lodash');var util=require(_0xf0e3('0x0'));var zendesk=require(_0xf0e3('0x1'));var salesforce=require(_0xf0e3('0x2'));var sugarcrm=require(_0xf0e3('0x3'));var freshdesk=require(_0xf0e3('0x4'));var zoho=require(_0xf0e3('0x5'));var desk=require('./desk');var vtiger=require(_0xf0e3('0x6'));var servicenow=require(_0xf0e3('0x7'));var dynamics365=require(_0xf0e3('0x8'));var freshsales=require(_0xf0e3('0x9'));var integrations=['zendesk','salesforce',_0xf0e3('0xa'),_0xf0e3('0xb'),'zoho',_0xf0e3('0xc'),'vtiger',_0xf0e3('0xd'),'freshsales',_0xf0e3('0xe')];exports[_0xf0e3('0xf')]=function(_0x3cd310,_0x521460,_0x368608,_0x23f241,_0x3f0261,_0x52ffbf){if(_0x368608){if(_['includes'](integrations,_0x3cd310[_0xf0e3('0x10')]['toLowerCase']())){try{var _0x356000=null;var _0x169a03='';var _0x58d146=_0x368608[_0x3cd310[_0xf0e3('0x10')]['toLowerCase']()];if(_0x58d146){var _0x198632=_0x58d146[_0x3cd310['data2']];if(_0x198632){var _0x328e60=_[_0xf0e3('0x11')](_0x198632[_0xf0e3('0x12')],{'id':parseInt(_0x3cd310[_0xf0e3('0x13')],0xa)});if(_0x328e60){if(_0x23f241){if(_0x3f0261&&_0x521460[_0xf0e3('0x14')]){_0x169a03=_0xf0e3('0x14');}else if(_0x521460['routeId']){_0x169a03=_0xf0e3('0x15');}else{console[_0xf0e3('0x16')](_0xf0e3('0x17'),_0x521460);}}else{_0x169a03=_0xf0e3('0x18');}switch(_0x3cd310[_0xf0e3('0x10')][_0xf0e3('0x19')]()){case _0xf0e3('0x1a'):zendesk[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case _0xf0e3('0x1b'):salesforce[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case'sugarcrm':sugarcrm[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case _0xf0e3('0xb'):freshdesk[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case _0xf0e3('0x1c'):zoho[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case _0xf0e3('0xc'):desk[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case'vtiger':vtiger[_0x169a03](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf);break;case'freshsales':freshsales['cs'](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf,_0x169a03);break;case'servicenow':servicenow['cs'](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf,_0x169a03);break;case _0xf0e3('0xd'):dynamics365['cs'](_0x3cd310,_0x521460,_0x328e60,_0x23f241,_0x3f0261,_0x198632,_0x52ffbf,_0x169a03);break;default:console['log']('unknown\x20integration');}}else{_0x356000=require(_0xf0e3('0x1d'))(_0x3cd310['data1'][_0xf0e3('0x19')]());_0x356000[_0xf0e3('0x1e')](_0xf0e3('0x1f'),util[_0xf0e3('0x20')](_0xf0e3('0x21'),_0x3cd310[_0xf0e3('0x10')]['toLowerCase'](),_0x3cd310[_0xf0e3('0x13')]));}}else{_0x356000=require(_0xf0e3('0x1d'))(_0x3cd310['data1'][_0xf0e3('0x19')]());_0x356000[_0xf0e3('0x1e')](_0xf0e3('0x1f'),util[_0xf0e3('0x20')](_0xf0e3('0x22'),_0x3cd310[_0xf0e3('0x10')][_0xf0e3('0x19')](),_0x3cd310['data2']));}}else{}}catch(_0x17ef61){console[_0xf0e3('0x1e')](_0x17ef61);}}}}; \ 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 5d6d3df..00c1587 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 _0x7d9a=['queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','instanceUrl','[OUTBOUND]','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','WhatId','ticketType','Case','ContactId','account','AccountId','lead','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','length','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','upperFirst','includes','picklist','idField','toString','variable','variableName','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','clientSecret','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7d9a,0x114));var _0xa7d9=function(_0x462923,_0x292368){_0x462923=_0x462923-0x0;var _0x5d5707=_0x7d9a[_0x462923];return _0x5d5707;};'use strict';var _=require(_0xa7d9('0x0'));var rp=require(_0xa7d9('0x1'));var moment=require(_0xa7d9('0x2'));var BPromise=require('bluebird');var md5=require(_0xa7d9('0x3'));var jsforce=require(_0xa7d9('0x4'));var util=require(_0xa7d9('0x5'));var Redis=require(_0xa7d9('0x6'));var intUtil=require(_0xa7d9('0x7'));var config=require(_0xa7d9('0x8'));var logger=require('../../../../config/logger')(_0xa7d9('0x9'));config[_0xa7d9('0xa')]=_[_0xa7d9('0xb')](config[_0xa7d9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xa7d9('0xc'))(new Redis(config[_0xa7d9('0xa')]));function emit(_0x873b4d,_0x4de00,_0x1028f5){io['to'](_0x873b4d)[_0xa7d9('0xd')](_0x4de00,_0x1028f5);}function getTicket(_0x2b4976,_0x37ad17,_0x2cdf4b,_0x40473d,_0x2e6aad,_0x3fcf51,_0xeb0ffb,_0x51987f){var _0x4ffa63=Object[_0xa7d9('0xe')]({},{'OwnerId':_0x37ad17['id'],'Subject':intUtil['getString'](_0x40473d[_0xa7d9('0xf')],_0x2e6aad,'\x20'),'Description':intUtil[_0xa7d9('0x10')](_0x40473d[_0xa7d9('0x11')],_0x2e6aad,'\x0a')},getCustomFields(_0x3fcf51,_0x2e6aad));if(_0x2cdf4b){if(_0x40473d['ticketType']===_0xa7d9('0x12')){_0x4ffa63[_0xa7d9('0x13')]=moment[_0xa7d9('0x14')]();_0x4ffa63[_0xa7d9('0x15')]=![];_0x4ffa63[_0xa7d9('0x16')]=![];if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x18')||_0x2cdf4b[_0xa7d9('0x17')]==='lead'){_0x4ffa63[_0xa7d9('0x19')]=_0x2cdf4b['id'];}else if(_0x2cdf4b[_0xa7d9('0x17')]==='account'){_0x4ffa63[_0xa7d9('0x1a')]=_0x2cdf4b['id'];}}else if(_0x40473d[_0xa7d9('0x1b')]===_0xa7d9('0x1c')){if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x18')){_0x4ffa63[_0xa7d9('0x1d')]=_0x2cdf4b['id'];}else if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x1e')){_0x4ffa63[_0xa7d9('0x1f')]=_0x2cdf4b['id'];}else if(_0x2cdf4b[_0xa7d9('0x17')]===_0xa7d9('0x20')&&_0x40473d[_0xa7d9('0x21')]){_0x4ffa63[_0x40473d[_0xa7d9('0x21')]]=_0x2cdf4b['id'];}else{logger[_0xa7d9('0x22')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xeb0ffb[_0xa7d9('0x23')](_0x40473d[_0xa7d9('0x1b')])[_0xa7d9('0x24')](_0x4ffa63);}function getUser(_0xa85b99,_0x3a4519,_0x8d0e1e){if(!_[_0xa7d9('0x25')](_0x3a4519)&&intUtil[_0xa7d9('0x26')](_0x3a4519)){var _0x5bcc68={'Email':_0x3a4519};var _0x515b03={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x8d0e1e[_0xa7d9('0x23')](_0xa7d9('0x27'))[_0xa7d9('0x28')](_0x5bcc68,_0x515b03)[_0xa7d9('0x29')]()[_0xa7d9('0x2a')](function(_0x298d4b){if(_0x298d4b['length']){var _0x5d9a71=_['find'](_0x298d4b,function(_0x18edaa){return _0x18edaa[_0xa7d9('0x2b')]===_0x3a4519;});if(_0x5d9a71){logger[_0xa7d9('0x22')](_0xa7d9('0x2c'),_0x3a4519);return BPromise['resolve']({'id':_0x5d9a71['Id'],'name':_0x5d9a71['Name']});}}else{logger[_0xa7d9('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3a4519);return _0x8d0e1e[_0xa7d9('0x2d')]()[_0xa7d9('0x2a')](function(_0x19d4ed){return BPromise['resolve']({'id':_0x19d4ed[_0xa7d9('0x2e')],'name':_0x19d4ed[_0xa7d9('0x2f')]});});}});}else{logger[_0xa7d9('0x22')](_0xa7d9('0x30'),_0x3a4519);return _0x8d0e1e[_0xa7d9('0x2d')]()['then'](function(_0x4bb720){return BPromise['resolve']({'id':_0x4bb720['user_id'],'name':_0x4bb720['display_name']});});}}function getEndUser(_0x136983,_0x19b543,_0x2ad739,_0x52d344,_0x101523){var _0x1b886f={'$or':{'Phone':_0x52d344}};var _0x10a0b7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa7d9('0x31')]()['then'](function(){logger[_0xa7d9('0x22')](_0xa7d9('0x32'),_0x52d344,_0x19b543['moduleSearch']);switch(_0x19b543[_0xa7d9('0x33')]){case _0xa7d9('0x34'):var _0x2f9cef=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543['additionalSearchContact']){var _0x67d1a1={};_0x67d1a1[_0x19b543[_0xa7d9('0x36')]]=_0x52d344;_[_0xa7d9('0x37')](_0x2f9cef['$or'],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x38'))['find'](_0x2f9cef,_0x10a0b7)['execute']()[_0xa7d9('0x2a')](function(_0x135a1e){if(_0x135a1e&&_0x135a1e[_0xa7d9('0x39')]){return _0x135a1e;}else{var _0x3a6c1d=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x3a')]){var _0x2e8d2b={};_0x2e8d2b[_0x19b543[_0xa7d9('0x3a')]]=_0x52d344;_[_0xa7d9('0x37')](_0x3a6c1d[_0xa7d9('0x3b')],_0x2e8d2b);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x3c'))['find'](_0x3a6c1d,_0x10a0b7);}});case _0xa7d9('0x3d'):var _0x8d4ea2=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543['additionalSearchAccount']){var _0x67d1a1={};_0x67d1a1[_0x19b543['additionalSearchAccount']]=_0x52d344;_[_0xa7d9('0x37')](_0x8d4ea2['$or'],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')]('Account')[_0xa7d9('0x28')](_0x8d4ea2,_0x10a0b7)['execute']()['then'](function(_0x259db6){if(_0x259db6&&_0x259db6[_0xa7d9('0x39')]){return _0x259db6;}else{var _0x39a650=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x36')]){var _0x5344e0={};_0x5344e0[_0x19b543[_0xa7d9('0x36')]]=_0x52d344;_[_0xa7d9('0x37')](_0x39a650['$or'],_0x5344e0);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x38'))[_0xa7d9('0x28')](_0x39a650,_0x10a0b7)[_0xa7d9('0x2a')](function(_0x3f9fed){if(_0x3f9fed&&_0x3f9fed[_0xa7d9('0x39')]){return _0x3f9fed;}else{var _0x3131f0=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543['additionalSearchLead']){var _0x195bbc={};_0x195bbc[_0x19b543[_0xa7d9('0x3a')]]=_0x52d344;_[_0xa7d9('0x37')](_0x3131f0[_0xa7d9('0x3b')],_0x195bbc);}return _0x101523['sobject'](_0xa7d9('0x3c'))[_0xa7d9('0x28')](_0x3131f0,_0x10a0b7);}});}});case _0xa7d9('0x18'):var _0x2f9cef=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x36')]){var _0x67d1a1={};_0x67d1a1[_0x19b543[_0xa7d9('0x36')]]=_0x52d344;_[_0xa7d9('0x37')](_0x2f9cef[_0xa7d9('0x3b')],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')]('Contact')['find'](_0x2f9cef,_0x10a0b7)[_0xa7d9('0x29')]();case'lead':var _0x2e7148=_[_0xa7d9('0x35')](_0x1b886f);if(_0x19b543[_0xa7d9('0x3a')]){var _0x67d1a1={};_0x67d1a1[_0x19b543[_0xa7d9('0x3a')]]=_0x52d344;_[_0xa7d9('0x37')](_0x2e7148[_0xa7d9('0x3b')],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x3c'))[_0xa7d9('0x28')](_0x2e7148,_0x10a0b7);case'account':var _0x8d4ea2=_['cloneDeep'](_0x1b886f);if(_0x19b543[_0xa7d9('0x3e')]){var _0x67d1a1={};_0x67d1a1[_0x19b543['additionalSearchAccount']]=_0x52d344;_['merge'](_0x8d4ea2['$or'],_0x67d1a1);}return _0x101523[_0xa7d9('0x23')](_0xa7d9('0x3f'))[_0xa7d9('0x28')](_0x8d4ea2,_0x10a0b7);default:return null;}})[_0xa7d9('0x2a')](function(_0x468807){if(_0x468807&&_0x468807['length']){var _0x28b0ce=_[_0xa7d9('0x40')](_0x468807);if(_0x28b0ce){return BPromise[_0xa7d9('0x31')]({'id':_0x28b0ce['Id'],'name':_0x28b0ce[_0xa7d9('0x41')],'phone':_0x28b0ce[_0xa7d9('0x42')],'endUserType':_0x28b0ce['attributes'][_0xa7d9('0x43')]['toLowerCase']()});}}})['then'](function(_0x3a66c7){if(_0x3a66c7){logger[_0xa7d9('0x22')](_0xa7d9('0x44'),_0x3a66c7[_0xa7d9('0x17')],_0x52d344);return BPromise['resolve'](_0x3a66c7);}else{logger[_0xa7d9('0x22')](_0xa7d9('0x45'),_0x52d344);var _0x3de4cb={'Phone':_0x52d344};if(_0x19b543[_0xa7d9('0x46')]){if(_0x19b543[_0xa7d9('0x46')]==='contact'){logger[_0xa7d9('0x22')](_0xa7d9('0x47'),_0x52d344,_0x19b543[_0xa7d9('0x46')]);_0x3de4cb['LastName']=_0x2ad739!==_0xa7d9('0x48')?_0x2ad739:util[_0xa7d9('0x49')](_0xa7d9('0x4a'),_0x52d344);}else if(_0x19b543[_0xa7d9('0x46')]===_0xa7d9('0x20')){logger[_0xa7d9('0x22')](_0xa7d9('0x47'),_0x52d344,_0x19b543['moduleCreate']);_0x3de4cb[_0xa7d9('0x4b')]=_0x2ad739!==_0xa7d9('0x48')?_0x2ad739:util['format'](_0xa7d9('0x4a'),_0x52d344);_0x3de4cb['Company']='No\x20Company';}else if(_0x19b543[_0xa7d9('0x46')]===_0xa7d9('0x1e')){logger[_0xa7d9('0x22')](_0xa7d9('0x47'),_0x52d344,_0x19b543[_0xa7d9('0x46')]);_0x3de4cb[_0xa7d9('0x41')]=_0x2ad739!==_0xa7d9('0x48')?_0x2ad739:util[_0xa7d9('0x49')](_0xa7d9('0x4a'),_0x52d344);}else{return null;}}return _0x101523[_0xa7d9('0x23')](_[_0xa7d9('0x4c')](_0x19b543[_0xa7d9('0x46')]))[_0xa7d9('0x24')](_0x3de4cb)[_0xa7d9('0x2a')](function(_0x1d2978){return BPromise[_0xa7d9('0x31')]({'id':_0x1d2978['id'],'endUserType':_0x19b543[_0xa7d9('0x46')]});});}});}function getCustomFields(_0x469a5c,_0x3db162){var _0x49e28e={};if(_0x469a5c[_0xa7d9('0x39')]>0x0){_['forEach'](_0x469a5c,function(_0x3ee243){if(_[_0xa7d9('0x4d')](['string',_0xa7d9('0x4e')],_0x3ee243[_0xa7d9('0x43')])&&_0x3ee243[_0xa7d9('0x4f')]){_0x49e28e[_0x3ee243[_0xa7d9('0x4f')]]=_0x3ee243['content'][_0xa7d9('0x50')]();}else if(_0x3ee243[_0xa7d9('0x43')]===_0xa7d9('0x51')&&_0x3ee243[_0xa7d9('0x52')]&&_0x3ee243[_0xa7d9('0x4f')]){_0x3db162[_0x3ee243[_0xa7d9('0x52')]]&&(_0x49e28e[_0x3ee243['idField']]=_0x3db162[_0x3ee243[_0xa7d9('0x52')]][_0xa7d9('0x50')]());}else if(_0x3ee243['type']==='customVariable'&&_0x3ee243[_0xa7d9('0x53')]&&_0x3ee243[_0xa7d9('0x53')][_0xa7d9('0x54')]&&_0x3ee243[_0xa7d9('0x4f')]){_0x3db162[_0x3ee243[_0xa7d9('0x53')]['name'][_0xa7d9('0x55')]()]&&(_0x49e28e[_0x3ee243[_0xa7d9('0x4f')]]=_0x3db162[_0x3ee243['Variable'][_0xa7d9('0x54')][_0xa7d9('0x55')]()][_0xa7d9('0x50')]());}});}return _0x49e28e;}function getConnection(_0x21542a){var _0x357f87=_0x21542a[_0xa7d9('0x56')]['concat'](_0x21542a[_0xa7d9('0x57')]);var _0x2bc77c=new jsforce[(_0xa7d9('0x58'))]({'oauth2':{'loginUrl':_0x21542a[_0xa7d9('0x59')]||'https://login.salesforce.com','clientId':_0x21542a['clientId'],'clientSecret':_0x21542a[_0xa7d9('0x5a')]}});return _0x2bc77c['login'](_0x21542a['username'],_0x357f87)[_0xa7d9('0x2a')](function(){logger[_0xa7d9('0x22')](_0xa7d9('0x5b'));return _0x2bc77c;});}exports['queue']=function(_0x525816,_0x24aaee,_0x5b9a04,_0x31ee89,_0x23a443,_0x2cb89e){var _0x384fd0,_0x2ef5e7,_0x728aed,_0x3ebab9;_0x2cb89e['serverUrl']=intUtil[_0xa7d9('0x5c')](_0x2cb89e[_0xa7d9('0x5d')]);_0x2cb89e[_0xa7d9('0x59')]=intUtil[_0xa7d9('0x5c')](_0x2cb89e[_0xa7d9('0x59')]);if(_0x23a443&&_0x23a443[_0xa7d9('0x5e')]){logger[_0xa7d9('0x22')](_0xa7d9('0x5f'),_0xa7d9('0x60'));_0x24aaee[_0xa7d9('0x61')]=util[_0xa7d9('0x49')](_0xa7d9('0x62'),_0x2cb89e['serverUrl'],_0x24aaee[_0xa7d9('0x63')],md5(_0x24aaee['uniqueid']));}else{_0x24aaee['recordingURL']='';}return getConnection(_0x2cb89e)[_0xa7d9('0x2a')](function(_0x133603){_0x3ebab9=_0x133603;return getUser(_0x2cb89e,_0x31ee89[_0xa7d9('0x64')],_0x3ebab9);})[_0xa7d9('0x2a')](function(_0x31dbc3){_0x384fd0=_0x31dbc3;return getEndUser(_0x2cb89e,_0x5b9a04,_0x24aaee[_0xa7d9('0x65')],_0x24aaee['calleridnum'],_0x3ebab9);})[_0xa7d9('0x2a')](function(_0xddb00f){_0x2ef5e7=_0xddb00f;return getTicket(_0x2cb89e,_0x384fd0,_0x2ef5e7,_0x5b9a04,_0x24aaee,_0x5b9a04['Fields'],_0x3ebab9,_0xa7d9('0x66'));})[_0xa7d9('0x2a')](function(_0x36d230){_0x728aed=_0x36d230;logger[_0xa7d9('0x22')](_0xa7d9('0x67'),_0x728aed['id']);logger[_0xa7d9('0x22')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x728aed['id'],_0x31ee89[_0xa7d9('0x54')],_0x2cb89e['type']);switch(_0x2cb89e[_0xa7d9('0x43')]){case _0xa7d9('0x68'):emit(util['format'](_0xa7d9('0x69'),_0x31ee89[_0xa7d9('0x54')]),'trigger:salesforce:display',{'recordId':_0x728aed['id']});break;case'newTab':emit(util[_0xa7d9('0x49')](_0xa7d9('0x69'),_0x31ee89[_0xa7d9('0x54')]),_0xa7d9('0x6a'),{'uri':util['format'](_0xa7d9('0x6b'),_0x3ebab9['instanceUrl'],_0x728aed['id'])});break;default:logger[_0xa7d9('0x6c')](_0xa7d9('0x6d'));}})[_0xa7d9('0x6e')](function(_0x5a7032){logger[_0xa7d9('0x6c')]('[QUEUE]',_0x5a7032);});};exports['outbound']=function(_0x369278,_0xc01bbc,_0x44c214,_0x5ea58c,_0x538504,_0x4ac7ff,_0x394ae7){var _0x29c6cf,_0x4138a7,_0x1cafb8,_0x7cf374;_0x4ac7ff[_0xa7d9('0x5d')]=intUtil['stripTrailingSlash'](_0x4ac7ff[_0xa7d9('0x5d')]);_0x4ac7ff[_0xa7d9('0x59')]=intUtil[_0xa7d9('0x5c')](_0x4ac7ff['remoteUri']);if(_0x394ae7&&_0x394ae7[_0xa7d9('0x6f')]&&_0x394ae7[_0xa7d9('0x6f')]!==_0xa7d9('0x70')){logger['info']('[OUTBOUND]',_0xa7d9('0x60'));_0xc01bbc[_0xa7d9('0x61')]=util[_0xa7d9('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ac7ff['serverUrl'],_0xc01bbc[_0xa7d9('0x63')],md5(_0xc01bbc['uniqueid']));}return getConnection(_0x4ac7ff)[_0xa7d9('0x2a')](function(_0xa3bb9){_0x7cf374=_0xa3bb9;return getUser(_0x4ac7ff,_0x5ea58c[_0xa7d9('0x64')],_0x7cf374);})[_0xa7d9('0x2a')](function(_0xeee298){_0x29c6cf=_0xeee298;return getEndUser(_0x4ac7ff,_0x44c214,_0xc01bbc[_0xa7d9('0x71')],_0xc01bbc[_0xa7d9('0x72')],_0x7cf374);})['then'](function(_0x8019d2){_0x4138a7=_0x8019d2;return getTicket(_0x4ac7ff,_0x29c6cf,_0x4138a7,_0x44c214,_0xc01bbc,_0x44c214['Fields'],_0x7cf374,'outbound');})[_0xa7d9('0x2a')](function(_0x1ea47b){_0x1cafb8=_0x1ea47b;logger[_0xa7d9('0x22')](_0xa7d9('0x73'),_0x1cafb8['id']);logger[_0xa7d9('0x22')](_0xa7d9('0x74'),_0x1cafb8['id'],_0x5ea58c[_0xa7d9('0x54')],_0x4ac7ff[_0xa7d9('0x43')]);switch(_0x4ac7ff[_0xa7d9('0x43')]){case _0xa7d9('0x68'):emit(util[_0xa7d9('0x49')](_0xa7d9('0x69'),_0x5ea58c[_0xa7d9('0x54')]),_0xa7d9('0x75'),{'recordId':_0x1cafb8['id']});break;case _0xa7d9('0x76'):emit(util[_0xa7d9('0x49')](_0xa7d9('0x69'),_0x5ea58c[_0xa7d9('0x54')]),'trigger:browser:url',{'uri':util['format'](_0xa7d9('0x6b'),_0x7cf374[_0xa7d9('0x77')],_0x1cafb8['id'])});break;default:logger[_0xa7d9('0x6c')](_0xa7d9('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x3aeb25){logger[_0xa7d9('0x6c')](_0xa7d9('0x78'),_0x3aeb25);});};exports['unmanaged']=function(_0x52856a,_0x470398,_0x41589b,_0xcb5df4,_0x3ec21f,_0x5e89bf){var _0x3cd6cc,_0x16e962,_0x2ca7f1,_0x267c99;_0x5e89bf[_0xa7d9('0x5d')]=intUtil[_0xa7d9('0x5c')](_0x5e89bf['serverUrl']);_0x5e89bf[_0xa7d9('0x59')]=intUtil[_0xa7d9('0x5c')](_0x5e89bf[_0xa7d9('0x59')]);if(_0x3ec21f&&_0x3ec21f[_0xa7d9('0x5e')]){logger[_0xa7d9('0x22')]('['+_0x470398[_0xa7d9('0x79')][_0xa7d9('0x7a')]()+']',_0xa7d9('0x60'));_0x470398[_0xa7d9('0x61')]=util[_0xa7d9('0x49')](_0xa7d9('0x62'),_0x5e89bf[_0xa7d9('0x5d')],_0x470398[_0xa7d9('0x63')],md5(_0x470398[_0xa7d9('0x63')]));}else{_0x470398[_0xa7d9('0x61')]='';}return getConnection(_0x5e89bf)[_0xa7d9('0x2a')](function(_0x53d0dc){_0x267c99=_0x53d0dc;if(!_['isNil'](_0xcb5df4)){return getUser(_0x5e89bf,_0xcb5df4['name'],_0x267c99);}else{return getUser(_0x5e89bf,null,_0x267c99);}})['then'](function(_0xb1d04){_0x3cd6cc=_0xb1d04;return getEndUser(_0x5e89bf,_0x41589b,_0x470398['calleridname'],_0x470398[_0xa7d9('0x7b')],_0x267c99);})[_0xa7d9('0x2a')](function(_0x4fa7f3){_0x16e962=_0x4fa7f3;return getTicket(_0x5e89bf,_0x3cd6cc,_0x16e962,_0x41589b,_0x470398,_0x41589b['Fields'],_0x267c99);})['then'](function(_0x3b278a){_0x2ca7f1=_0x3b278a;logger['info']('['+_0x470398['lastevent']['toUpperCase']()+_0xa7d9('0x7c'),_0x2ca7f1['id']);logger[_0xa7d9('0x22')]('['+_0x470398['lastevent']['toUpperCase']()+_0xa7d9('0x7d'),_0x5e89bf['type']);})[_0xa7d9('0x6e')](function(_0x4289f5){logger[_0xa7d9('0x6c')]('['+_0x470398[_0xa7d9('0x79')][_0xa7d9('0x7a')]()+']',_0x4289f5);});}; \ No newline at end of file +var _0xa567=['serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','contact','endUserType','WhoId','account','ticketType','Case','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','account_contact_lead','additionalSearchAccount','Account','length','Lead','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue'];(function(_0x141ecf,_0x3509b9){var _0x279462=function(_0x3ed681){while(--_0x3ed681){_0x141ecf['push'](_0x141ecf['shift']());}};_0x279462(++_0x3509b9);}(_0xa567,0xa5));var _0x7a56=function(_0x5d4e45,_0x3ee978){_0x5d4e45=_0x5d4e45-0x0;var _0x39d238=_0xa567[_0x5d4e45];return _0x39d238;};'use strict';var _=require(_0x7a56('0x0'));var rp=require(_0x7a56('0x1'));var moment=require(_0x7a56('0x2'));var BPromise=require(_0x7a56('0x3'));var md5=require(_0x7a56('0x4'));var jsforce=require(_0x7a56('0x5'));var util=require('util');var Redis=require(_0x7a56('0x6'));var intUtil=require(_0x7a56('0x7'));var config=require('../../../../config/environment');var logger=require(_0x7a56('0x8'))('salesforce');config[_0x7a56('0x9')]=_[_0x7a56('0xa')](config[_0x7a56('0x9')],{'host':_0x7a56('0xb'),'port':0x18eb});var io=require(_0x7a56('0xc'))(new Redis(config['redis']));function emit(_0xb375e7,_0x2a51e8,_0x4d4f4b){io['to'](_0xb375e7)[_0x7a56('0xd')](_0x2a51e8,_0x4d4f4b);}function getTicket(_0x5de559,_0x1b23b4,_0x491e5d,_0x35375c,_0x540620,_0x341e51,_0x21fe18,_0xb86f2e){var _0x56dbf9=Object[_0x7a56('0xe')]({},{'OwnerId':_0x1b23b4['id'],'Subject':intUtil[_0x7a56('0xf')](_0x35375c['Subjects'],_0x540620,'\x20'),'Description':intUtil['getString'](_0x35375c[_0x7a56('0x10')],_0x540620,'\x0a')},getCustomFields(_0x341e51,_0x540620));if(_0x491e5d){if(_0x35375c['ticketType']===_0x7a56('0x11')){_0x56dbf9[_0x7a56('0x12')]=moment[_0x7a56('0x13')]();_0x56dbf9[_0x7a56('0x14')]=![];_0x56dbf9['IsRecurrence']=![];if(_0x491e5d['endUserType']===_0x7a56('0x15')||_0x491e5d[_0x7a56('0x16')]==='lead'){_0x56dbf9[_0x7a56('0x17')]=_0x491e5d['id'];}else if(_0x491e5d['endUserType']===_0x7a56('0x18')){_0x56dbf9['WhatId']=_0x491e5d['id'];}}else if(_0x35375c[_0x7a56('0x19')]===_0x7a56('0x1a')){if(_0x491e5d[_0x7a56('0x16')]==='contact'){_0x56dbf9['ContactId']=_0x491e5d['id'];}else if(_0x491e5d[_0x7a56('0x16')]===_0x7a56('0x18')){_0x56dbf9['AccountId']=_0x491e5d['id'];}else if(_0x491e5d['endUserType']===_0x7a56('0x1b')&&_0x35375c[_0x7a56('0x1c')]){_0x56dbf9[_0x35375c[_0x7a56('0x1c')]]=_0x491e5d['id'];}else{logger['info'](_0x7a56('0x1d'));}}}return _0x21fe18[_0x7a56('0x1e')](_0x35375c[_0x7a56('0x19')])[_0x7a56('0x1f')](_0x56dbf9);}function getUser(_0x10eec6,_0x279d6f,_0x191176){if(!_[_0x7a56('0x20')](_0x279d6f)&&intUtil[_0x7a56('0x21')](_0x279d6f)){var _0x4afe0d={'Email':_0x279d6f};var _0x36fd4f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x191176[_0x7a56('0x1e')](_0x7a56('0x22'))[_0x7a56('0x23')](_0x4afe0d,_0x36fd4f)[_0x7a56('0x24')]()[_0x7a56('0x25')](function(_0x8daae5){if(_0x8daae5['length']){var _0x44e796=_[_0x7a56('0x23')](_0x8daae5,function(_0x1596a4){return _0x1596a4[_0x7a56('0x26')]===_0x279d6f;});if(_0x44e796){logger[_0x7a56('0x27')](_0x7a56('0x28'),_0x279d6f);return BPromise['resolve']({'id':_0x44e796['Id'],'name':_0x44e796[_0x7a56('0x29')]});}}else{logger[_0x7a56('0x27')](_0x7a56('0x2a'),_0x279d6f);return _0x191176['identity']()[_0x7a56('0x25')](function(_0x504c72){return BPromise[_0x7a56('0x2b')]({'id':_0x504c72[_0x7a56('0x2c')],'name':_0x504c72[_0x7a56('0x2d')]});});}});}else{logger[_0x7a56('0x27')](_0x7a56('0x2a'),_0x279d6f);return _0x191176[_0x7a56('0x2e')]()[_0x7a56('0x25')](function(_0x35668e){return BPromise[_0x7a56('0x2b')]({'id':_0x35668e['user_id'],'name':_0x35668e[_0x7a56('0x2d')]});});}}function getEndUser(_0x2be52c,_0x15c788,_0x4b5218,_0x42a699,_0x3c9760){var _0x28b8e1={'$or':{'Phone':_0x42a699}};var _0x201825={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7a56('0x2b')]()[_0x7a56('0x25')](function(){logger[_0x7a56('0x27')](_0x7a56('0x2f'),_0x42a699,_0x15c788['moduleSearch']);switch(_0x15c788[_0x7a56('0x30')]){case _0x7a56('0x31'):var _0x2f8a00=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788['additionalSearchContact']){var _0x268a40={};_0x268a40[_0x15c788[_0x7a56('0x33')]]=_0x42a699;_[_0x7a56('0x34')](_0x2f8a00['$or'],_0x268a40);}return _0x3c9760[_0x7a56('0x1e')](_0x7a56('0x35'))[_0x7a56('0x23')](_0x2f8a00,_0x201825)[_0x7a56('0x24')]()[_0x7a56('0x25')](function(_0x3b9c3d){if(_0x3b9c3d&&_0x3b9c3d['length']){return _0x3b9c3d;}else{var _0x430e84=_['cloneDeep'](_0x28b8e1);if(_0x15c788['additionalSearchLead']){var _0x5d5a19={};_0x5d5a19[_0x15c788[_0x7a56('0x36')]]=_0x42a699;_[_0x7a56('0x34')](_0x430e84[_0x7a56('0x37')],_0x5d5a19);}return _0x3c9760[_0x7a56('0x1e')]('Lead')[_0x7a56('0x23')](_0x430e84,_0x201825);}});case _0x7a56('0x38'):var _0x43a77a=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788['additionalSearchAccount']){var _0x268a40={};_0x268a40[_0x15c788[_0x7a56('0x39')]]=_0x42a699;_[_0x7a56('0x34')](_0x43a77a[_0x7a56('0x37')],_0x268a40);}return _0x3c9760[_0x7a56('0x1e')](_0x7a56('0x3a'))[_0x7a56('0x23')](_0x43a77a,_0x201825)['execute']()['then'](function(_0x54e2dc){if(_0x54e2dc&&_0x54e2dc[_0x7a56('0x3b')]){return _0x54e2dc;}else{var _0x20ae86=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788[_0x7a56('0x33')]){var _0x4ca92a={};_0x4ca92a[_0x15c788['additionalSearchContact']]=_0x42a699;_['merge'](_0x20ae86['$or'],_0x4ca92a);}return _0x3c9760[_0x7a56('0x1e')]('Contact')[_0x7a56('0x23')](_0x20ae86,_0x201825)[_0x7a56('0x25')](function(_0x6b093){if(_0x6b093&&_0x6b093[_0x7a56('0x3b')]){return _0x6b093;}else{var _0x4bcc8e=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788[_0x7a56('0x36')]){var _0x123150={};_0x123150[_0x15c788[_0x7a56('0x36')]]=_0x42a699;_[_0x7a56('0x34')](_0x4bcc8e[_0x7a56('0x37')],_0x123150);}return _0x3c9760['sobject'](_0x7a56('0x3c'))[_0x7a56('0x23')](_0x4bcc8e,_0x201825);}});}});case _0x7a56('0x15'):var _0x2f8a00=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788[_0x7a56('0x33')]){var _0x268a40={};_0x268a40[_0x15c788['additionalSearchContact']]=_0x42a699;_[_0x7a56('0x34')](_0x2f8a00[_0x7a56('0x37')],_0x268a40);}return _0x3c9760[_0x7a56('0x1e')](_0x7a56('0x35'))[_0x7a56('0x23')](_0x2f8a00,_0x201825)[_0x7a56('0x24')]();case _0x7a56('0x1b'):var _0x250bb0=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788[_0x7a56('0x36')]){var _0x268a40={};_0x268a40[_0x15c788[_0x7a56('0x36')]]=_0x42a699;_[_0x7a56('0x34')](_0x250bb0[_0x7a56('0x37')],_0x268a40);}return _0x3c9760[_0x7a56('0x1e')](_0x7a56('0x3c'))[_0x7a56('0x23')](_0x250bb0,_0x201825);case _0x7a56('0x18'):var _0x43a77a=_[_0x7a56('0x32')](_0x28b8e1);if(_0x15c788[_0x7a56('0x39')]){var _0x268a40={};_0x268a40[_0x15c788[_0x7a56('0x39')]]=_0x42a699;_[_0x7a56('0x34')](_0x43a77a[_0x7a56('0x37')],_0x268a40);}return _0x3c9760['sobject'](_0x7a56('0x3a'))['find'](_0x43a77a,_0x201825);default:return null;}})[_0x7a56('0x25')](function(_0x8074bd){if(_0x8074bd&&_0x8074bd['length']){var _0x76c38e=_[_0x7a56('0x3d')](_0x8074bd);if(_0x76c38e){return BPromise['resolve']({'id':_0x76c38e['Id'],'name':_0x76c38e[_0x7a56('0x29')],'phone':_0x76c38e[_0x7a56('0x3e')],'endUserType':_0x76c38e[_0x7a56('0x3f')]['type'][_0x7a56('0x40')]()});}}})['then'](function(_0x3a2549){if(_0x3a2549){logger[_0x7a56('0x27')](_0x7a56('0x41'),_0x3a2549[_0x7a56('0x16')],_0x42a699);return BPromise['resolve'](_0x3a2549);}else{logger[_0x7a56('0x27')](_0x7a56('0x42'),_0x42a699);var _0xecdd28={'Phone':_0x42a699};if(_0x15c788[_0x7a56('0x43')]){if(_0x15c788[_0x7a56('0x43')]===_0x7a56('0x15')){logger[_0x7a56('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x42a699,_0x15c788['moduleCreate']);_0xecdd28[_0x7a56('0x44')]=_0x4b5218!==_0x7a56('0x45')?_0x4b5218:util[_0x7a56('0x46')](_0x7a56('0x47'),_0x42a699);}else if(_0x15c788[_0x7a56('0x43')]===_0x7a56('0x1b')){logger[_0x7a56('0x27')](_0x7a56('0x48'),_0x42a699,_0x15c788['moduleCreate']);_0xecdd28[_0x7a56('0x44')]=_0x4b5218!==_0x7a56('0x45')?_0x4b5218:util['format'](_0x7a56('0x47'),_0x42a699);_0xecdd28['Company']=_0x7a56('0x49');}else if(_0x15c788[_0x7a56('0x43')]===_0x7a56('0x18')){logger[_0x7a56('0x27')](_0x7a56('0x48'),_0x42a699,_0x15c788['moduleCreate']);_0xecdd28['Name']=_0x4b5218!==_0x7a56('0x45')?_0x4b5218:util['format'](_0x7a56('0x47'),_0x42a699);}else{return null;}}return _0x3c9760[_0x7a56('0x1e')](_[_0x7a56('0x4a')](_0x15c788[_0x7a56('0x43')]))[_0x7a56('0x1f')](_0xecdd28)[_0x7a56('0x25')](function(_0x2533bc){return BPromise[_0x7a56('0x2b')]({'id':_0x2533bc['id'],'endUserType':_0x15c788[_0x7a56('0x43')]});});}});}function getCustomFields(_0x4903bd,_0x47296e){var _0xb649a2={};if(_0x4903bd[_0x7a56('0x3b')]>0x0){_[_0x7a56('0x4b')](_0x4903bd,function(_0x2a9237){if(_['includes']([_0x7a56('0x4c'),_0x7a56('0x4d')],_0x2a9237[_0x7a56('0x4e')])&&_0x2a9237['idField']){_0xb649a2[_0x2a9237[_0x7a56('0x4f')]]=_0x2a9237[_0x7a56('0x50')][_0x7a56('0x51')]();}else if(_0x2a9237['type']===_0x7a56('0x52')&&_0x2a9237['variableName']&&_0x2a9237['idField']){_0x47296e[_0x2a9237['variableName']]&&(_0xb649a2[_0x2a9237[_0x7a56('0x4f')]]=_0x47296e[_0x2a9237[_0x7a56('0x53')]][_0x7a56('0x51')]());}else if(_0x2a9237[_0x7a56('0x4e')]==='customVariable'&&_0x2a9237['Variable']&&_0x2a9237[_0x7a56('0x54')][_0x7a56('0x55')]&&_0x2a9237['idField']){_0x47296e[_0x2a9237[_0x7a56('0x54')][_0x7a56('0x55')]['toLowerCase']()]&&(_0xb649a2[_0x2a9237['idField']]=_0x47296e[_0x2a9237[_0x7a56('0x54')][_0x7a56('0x55')][_0x7a56('0x40')]()][_0x7a56('0x51')]());}});}return _0xb649a2;}function getConnection(_0x1f7f71){var _0x23fdab=_0x1f7f71['password']['concat'](_0x1f7f71[_0x7a56('0x56')]);var _0x2bd8da=new jsforce[(_0x7a56('0x57'))]({'oauth2':{'loginUrl':_0x1f7f71[_0x7a56('0x58')]||_0x7a56('0x59'),'clientId':_0x1f7f71['clientId'],'clientSecret':_0x1f7f71[_0x7a56('0x5a')]}});return _0x2bd8da[_0x7a56('0x5b')](_0x1f7f71[_0x7a56('0x5c')],_0x23fdab)[_0x7a56('0x25')](function(){logger['info'](_0x7a56('0x5d'));return _0x2bd8da;});}exports[_0x7a56('0x5e')]=function(_0x3ac1a7,_0x2e39fd,_0x36ccb1,_0x407f50,_0xdbc33c,_0x3ad11d){var _0x8d3e9f,_0x367d5d,_0x102878,_0x46dc2d;_0x3ad11d[_0x7a56('0x5f')]=intUtil['stripTrailingSlash'](_0x3ad11d[_0x7a56('0x5f')]);_0x3ad11d[_0x7a56('0x58')]=intUtil[_0x7a56('0x60')](_0x3ad11d['remoteUri']);if(_0xdbc33c&&_0xdbc33c[_0x7a56('0x61')]){logger['info']('[QUEUE]',_0x7a56('0x62'));_0x2e39fd[_0x7a56('0x63')]=util['format'](_0x7a56('0x64'),_0x3ad11d[_0x7a56('0x5f')],_0x2e39fd[_0x7a56('0x65')],md5(_0x2e39fd[_0x7a56('0x65')]));}else{_0x2e39fd['recordingURL']='';}return getConnection(_0x3ad11d)[_0x7a56('0x25')](function(_0x513d74){_0x46dc2d=_0x513d74;return getUser(_0x3ad11d,_0x407f50[_0x7a56('0x66')],_0x46dc2d);})[_0x7a56('0x25')](function(_0x33e6f6){_0x8d3e9f=_0x33e6f6;return getEndUser(_0x3ad11d,_0x36ccb1,_0x2e39fd[_0x7a56('0x67')],_0x2e39fd[_0x7a56('0x68')],_0x46dc2d);})[_0x7a56('0x25')](function(_0x2c306c){_0x367d5d=_0x2c306c;return getTicket(_0x3ad11d,_0x8d3e9f,_0x367d5d,_0x36ccb1,_0x2e39fd,_0x36ccb1[_0x7a56('0x69')],_0x46dc2d,_0x7a56('0x5e'));})[_0x7a56('0x25')](function(_0x53a794){_0x102878=_0x53a794;logger[_0x7a56('0x27')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x102878['id']);logger[_0x7a56('0x27')](_0x7a56('0x6a'),_0x102878['id'],_0x407f50[_0x7a56('0x55')],_0x3ad11d[_0x7a56('0x4e')]);switch(_0x3ad11d[_0x7a56('0x4e')]){case _0x7a56('0x6b'):emit(util[_0x7a56('0x46')](_0x7a56('0x6c'),_0x407f50[_0x7a56('0x55')]),_0x7a56('0x6d'),{'recordId':_0x102878['id']});break;case _0x7a56('0x6e'):emit(util[_0x7a56('0x46')](_0x7a56('0x6c'),_0x407f50[_0x7a56('0x55')]),_0x7a56('0x6f'),{'uri':util['format'](_0x7a56('0x70'),_0x46dc2d[_0x7a56('0x71')],_0x102878['id'])});break;default:logger[_0x7a56('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x7a56('0x73')](function(_0x4d6f89){logger[_0x7a56('0x72')](_0x7a56('0x74'),_0x4d6f89);});};exports[_0x7a56('0x75')]=function(_0xa06791,_0x1e8392,_0x29be77,_0x51c598,_0x2fee64,_0x51d0bb,_0x2272f7){var _0x642494,_0x704fd3,_0x2da0b5,_0x48bfd9;_0x51d0bb[_0x7a56('0x5f')]=intUtil[_0x7a56('0x60')](_0x51d0bb[_0x7a56('0x5f')]);_0x51d0bb[_0x7a56('0x58')]=intUtil[_0x7a56('0x60')](_0x51d0bb[_0x7a56('0x58')]);if(_0x2272f7&&_0x2272f7['recordingFormat']&&_0x2272f7[_0x7a56('0x76')]!==_0x7a56('0x77')){logger[_0x7a56('0x27')](_0x7a56('0x78'),'Recording\x20is\x20enabled!');_0x1e8392[_0x7a56('0x63')]=util[_0x7a56('0x46')](_0x7a56('0x64'),_0x51d0bb['serverUrl'],_0x1e8392['uniqueid'],md5(_0x1e8392[_0x7a56('0x65')]));}return getConnection(_0x51d0bb)[_0x7a56('0x25')](function(_0x4327a1){_0x48bfd9=_0x4327a1;return getUser(_0x51d0bb,_0x51c598[_0x7a56('0x66')],_0x48bfd9);})['then'](function(_0x32c68a){_0x642494=_0x32c68a;return getEndUser(_0x51d0bb,_0x29be77,_0x1e8392['destcalleridname'],_0x1e8392[_0x7a56('0x79')],_0x48bfd9);})[_0x7a56('0x25')](function(_0x1034b8){_0x704fd3=_0x1034b8;return getTicket(_0x51d0bb,_0x642494,_0x704fd3,_0x29be77,_0x1e8392,_0x29be77[_0x7a56('0x69')],_0x48bfd9,_0x7a56('0x75'));})[_0x7a56('0x25')](function(_0x8fb6d1){_0x2da0b5=_0x8fb6d1;logger['info'](_0x7a56('0x7a'),_0x2da0b5['id']);logger[_0x7a56('0x27')](_0x7a56('0x7b'),_0x2da0b5['id'],_0x51c598[_0x7a56('0x55')],_0x51d0bb[_0x7a56('0x4e')]);switch(_0x51d0bb[_0x7a56('0x4e')]){case _0x7a56('0x6b'):emit(util[_0x7a56('0x46')](_0x7a56('0x6c'),_0x51c598['name']),_0x7a56('0x6d'),{'recordId':_0x2da0b5['id']});break;case _0x7a56('0x6e'):emit(util[_0x7a56('0x46')](_0x7a56('0x6c'),_0x51c598[_0x7a56('0x55')]),_0x7a56('0x6f'),{'uri':util[_0x7a56('0x46')](_0x7a56('0x70'),_0x48bfd9[_0x7a56('0x71')],_0x2da0b5['id'])});break;default:logger[_0x7a56('0x72')]('[OUTBOUND]',_0x7a56('0x7c'));}})[_0x7a56('0x73')](function(_0x2bcb3a){logger[_0x7a56('0x72')](_0x7a56('0x78'),_0x2bcb3a);});};exports[_0x7a56('0x7d')]=function(_0x5bf078,_0x5967ad,_0x2eb405,_0x402c79,_0x31e7da,_0xa224f){var _0x4079e1,_0x48886b,_0x4bddd5,_0x42d429;_0xa224f['serverUrl']=intUtil['stripTrailingSlash'](_0xa224f[_0x7a56('0x5f')]);_0xa224f[_0x7a56('0x58')]=intUtil[_0x7a56('0x60')](_0xa224f[_0x7a56('0x58')]);if(_0x31e7da&&_0x31e7da[_0x7a56('0x61')]){logger[_0x7a56('0x27')]('['+_0x5967ad[_0x7a56('0x7e')]['toUpperCase']()+']',_0x7a56('0x62'));_0x5967ad[_0x7a56('0x63')]=util[_0x7a56('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa224f[_0x7a56('0x5f')],_0x5967ad[_0x7a56('0x65')],md5(_0x5967ad[_0x7a56('0x65')]));}else{_0x5967ad[_0x7a56('0x63')]='';}return getConnection(_0xa224f)['then'](function(_0x46be30){_0x42d429=_0x46be30;if(!_[_0x7a56('0x20')](_0x402c79)){return getUser(_0xa224f,_0x402c79[_0x7a56('0x55')],_0x42d429);}else{return getUser(_0xa224f,null,_0x42d429);}})[_0x7a56('0x25')](function(_0x11c090){_0x4079e1=_0x11c090;return getEndUser(_0xa224f,_0x2eb405,_0x5967ad[_0x7a56('0x67')],_0x5967ad[_0x7a56('0x68')],_0x42d429);})[_0x7a56('0x25')](function(_0xcd3c9){_0x48886b=_0xcd3c9;return getTicket(_0xa224f,_0x4079e1,_0x48886b,_0x2eb405,_0x5967ad,_0x2eb405[_0x7a56('0x69')],_0x42d429);})['then'](function(_0x3a561f){_0x4bddd5=_0x3a561f;logger[_0x7a56('0x27')]('['+_0x5967ad[_0x7a56('0x7e')]['toUpperCase']()+_0x7a56('0x7f'),_0x4bddd5['id']);logger['info']('['+_0x5967ad[_0x7a56('0x7e')][_0x7a56('0x80')]()+_0x7a56('0x81'),_0xa224f['type']);})['catch'](function(_0x3bb35e){logger[_0x7a56('0x72')]('['+_0x5967ad['lastevent']['toUpperCase']()+']',_0x3bb35e);});}; \ 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 9f093f5..97379cc 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 _0x9e75=['sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','customField','variableName','customVariable','Variable','name','outbound','getString','Descriptions','Fields','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','format','%s/api/now/table/','remoteUri','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','active','true','userId','adminEmail','],\x20createEndUser\x20input\x20crm'];(function(_0x1f8d09,_0x556797){var _0x388031=function(_0x1cdc0a){while(--_0x1cdc0a){_0x1f8d09['push'](_0x1f8d09['shift']());}};_0x388031(++_0x556797);}(_0x9e75,0xb5));var _0x59e7=function(_0x5a4483,_0x3b66c6){_0x5a4483=_0x5a4483-0x0;var _0x3364fb=_0x9e75[_0x5a4483];return _0x3364fb;};'use strict';var _=require(_0x59e7('0x0'));var Promise=require(_0x59e7('0x1'));var rp=require('request-promise');var util=require(_0x59e7('0x2'));var md5=require(_0x59e7('0x3'));var Redis=require(_0x59e7('0x4'));var intUtil=require(_0x59e7('0x5'));var config=require(_0x59e7('0x6'));var logger=require('../../../../config/logger')(_0x59e7('0x7'));config[_0x59e7('0x8')]=_['defaults'](config['redis'],{'host':_0x59e7('0x9'),'port':0x18eb});var io=require(_0x59e7('0xa'))(new Redis(config[_0x59e7('0x8')]));function getAdminUser(_0x129f91,_0x323999,_0xac04e2,_0x4d0643,_0x4350af,_0x3737f6){return new Promise(function(_0x1a9fcb,_0x5760f8){var _0x3f4d78={'method':_0x59e7('0xb'),'uri':_0x4d0643+_0x59e7('0xc')+'&'+_0x4350af+'&'+_0x3737f6,'auth':_0x323999,'json':!![]};return rp(_0x3f4d78)[_0x59e7('0xd')](function(_0x13b442){if(_0x13b442[_0x59e7('0xe')][_0x59e7('0xf')]>0x0){_0xac04e2[_0x59e7('0x10')]=_0x13b442[_0x59e7('0xe')][0x0][_0x59e7('0x11')];}logger[_0x59e7('0x12')]('['+[_0x129f91['toUpperCase']()]+_0x59e7('0x13'),_0xac04e2);_0x1a9fcb(_0xac04e2);})[_0x59e7('0x14')](function(_0x9da049){logger[_0x59e7('0x15')]('['+[_0x129f91[_0x59e7('0x16')]()]+']',_0x9da049['message']);_0x5760f8(_0x9da049[_0x59e7('0x17')]);});});}function getUser(_0x2affc2,_0x19a8dc,_0x437945,_0x3789c8,_0x58275d){return function(_0x425b76){logger[_0x59e7('0x12')]('['+[_0x2affc2['toUpperCase']()]+_0x59e7('0x18'),_0x425b76);return new Promise(function(_0x1055d1,_0x48851d){if(intUtil[_0x59e7('0x19')](_0x425b76[_0x59e7('0x1a')])){var _0x59c3d8={'method':_0x59e7('0xb'),'uri':_0x437945+_0x59e7('0x1b')+_0x425b76['userEmail']+'&'+_0x3789c8+'&'+_0x58275d,'auth':_0x19a8dc,'json':!![]};logger['info']('['+[_0x2affc2['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x59c3d8);return rp(_0x59c3d8)[_0x59e7('0xd')](function(_0x399c64){logger[_0x59e7('0x12')]('['+[_0x2affc2['toUpperCase']()]+'],\x20getUser\x20entity',_0x399c64);if(_0x399c64[_0x59e7('0xe')][_0x59e7('0xf')]>0x0&&String(_0x399c64[_0x59e7('0xe')][0x0][_0x59e7('0x1c')])===_0x59e7('0x1d')){_0x425b76[_0x59e7('0x1e')]=_0x399c64[_0x59e7('0xe')][0x0][_0x59e7('0x11')];}else{_0x425b76[_0x59e7('0x1e')]=_0x425b76[_0x59e7('0x10')];_0x425b76[_0x59e7('0x1a')]=_0x425b76['adminEmail'];}logger[_0x59e7('0x12')]('['+[_0x2affc2[_0x59e7('0x16')]()]+'],\x20getUser\x20crm',_0x425b76);_0x1055d1(_0x425b76);})['catch'](function(_0xe7a7b9){logger[_0x59e7('0x15')]('['+[_0x2affc2[_0x59e7('0x16')]()]+']',_0xe7a7b9['message']);_0x48851d(_0xe7a7b9[_0x59e7('0x17')]);});}else{logger['info']('['+[_0x2affc2[_0x59e7('0x16')]()]+']\x20using\x20admin\x20profile');_0x425b76['userId']=_0x425b76[_0x59e7('0x10')];_0x425b76['userEmail']=_0x425b76[_0x59e7('0x1f')];_0x1055d1(_0x425b76);}});};}function createEndUser(_0x4bcf9c,_0xa4d207,_0x38e4eb,_0xef14b8,_0x22f376){logger[_0x59e7('0x12')]('['+[_0x4bcf9c[_0x59e7('0x16')]()]+_0x59e7('0x20'),_0x38e4eb);return new Promise(function(_0x293535,_0x9488c8){var _0x56ca8b={'method':'POST','uri':_0xef14b8+_0x59e7('0x21')+_0x22f376,'body':{'user_name':_0x38e4eb[_0x59e7('0x22')],'roles':_0x59e7('0x23'),'first_name':_0x38e4eb['endUserNumber'],'active':'true','date_format':'System','phone':_0x38e4eb[_0x59e7('0x22')]},'auth':_0xa4d207,'json':!![]};return rp(_0x56ca8b)['then'](function(_0xbc9e5){logger[_0x59e7('0x12')]('['+[_0x4bcf9c[_0x59e7('0x16')]()]+_0x59e7('0x24'),_0xbc9e5[_0x59e7('0xe')]);_0x38e4eb[_0x59e7('0x25')]=_0xbc9e5[_0x59e7('0xe')][_0x59e7('0x11')];_0x293535(_0x38e4eb);})[_0x59e7('0x14')](function(_0x2fb83b){logger[_0x59e7('0x15')]('['+[_0x4bcf9c[_0x59e7('0x16')]()]+']',_0x2fb83b['message']);_0x9488c8(_0x2fb83b[_0x59e7('0x17')]);});});}function getEndUser(_0xa1c400,_0x57433f,_0x4cbad5,_0x5d8311,_0x532506){return function(_0x4ea653){logger['info']('['+[_0xa1c400['toUpperCase']()]+_0x59e7('0x26'),_0x4ea653);return new Promise(function(_0x790908,_0x5bfc86){var _0x392970={'method':_0x59e7('0xb'),'uri':_0x4cbad5+_0x59e7('0x27')+_0x4ea653[_0x59e7('0x22')]+'&'+_0x5d8311+'&'+_0x532506,'auth':_0x57433f,'json':!![]};return rp(_0x392970)[_0x59e7('0xd')](function(_0x502230){if(_0x502230['result'][_0x59e7('0xf')]>0x0){_0x4ea653[_0x59e7('0x25')]=_0x502230[_0x59e7('0xe')][0x0]['sys_id'];logger[_0x59e7('0x12')]('['+[_0xa1c400[_0x59e7('0x16')]()]+'],\x20getEndUser\x20crm',_0x4ea653);_0x790908(_0x4ea653);}else{return createEndUser(_0xa1c400,_0x57433f,_0x4ea653,_0x4cbad5,_0x5d8311)[_0x59e7('0xd')](function(_0x4e0bdb){logger[_0x59e7('0x12')]('['+[_0xa1c400['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x4e0bdb);_0x790908(_0x4e0bdb);});}})[_0x59e7('0x14')](function(_0x6e069c){logger[_0x59e7('0x15')]('['+[_0xa1c400['toUpperCase']()]+']',_0x6e069c[_0x59e7('0x17')]);_0x5bfc86(_0x6e069c[_0x59e7('0x17')]);});});};}function getCustomFields(_0x26d23a,_0x1b37a3){var _0x226f9d={};if(_0x26d23a[_0x59e7('0xf')]>0x0){_[_0x59e7('0x28')](_0x26d23a,function(_0x1ffab6){if(_[_0x59e7('0x29')]([_0x59e7('0x2a'),_0x59e7('0x2b')],_0x1ffab6[_0x59e7('0x2c')])&&_0x1ffab6[_0x59e7('0x2d')]&&!_0x1ffab6['customField']){_0x226f9d[_0x1ffab6['nameField'][_0x59e7('0x2e')]()]=_0x1ffab6[_0x59e7('0x2f')][_0x59e7('0x30')]();}else if(_[_0x59e7('0x29')]([_0x59e7('0x2a'),_0x59e7('0x2b')],_0x1ffab6[_0x59e7('0x2c')])&&_0x1ffab6[_0x59e7('0x31')]&&_0x1ffab6[_0x59e7('0x32')]){_0x226f9d[_0x1ffab6['idField'][_0x59e7('0x2e')]()]=_0x1ffab6[_0x59e7('0x2f')][_0x59e7('0x30')]();}else if(_0x1ffab6[_0x59e7('0x2c')]==='variable'&&_0x1ffab6[_0x59e7('0x33')]&&_0x1ffab6[_0x59e7('0x31')]&&_0x1ffab6[_0x59e7('0x32')]){_0x226f9d[_0x1ffab6[_0x59e7('0x31')][_0x59e7('0x2e')]()]=_0x1b37a3[_0x1ffab6[_0x59e7('0x33')]][_0x59e7('0x30')]();}else if(_0x1ffab6['type']===_0x59e7('0x34')&&_0x1ffab6[_0x59e7('0x35')]&&_0x1ffab6[_0x59e7('0x35')][_0x59e7('0x36')]&&_0x1ffab6[_0x59e7('0x31')]&&_0x1ffab6[_0x59e7('0x32')]){_0x226f9d[_0x1ffab6[_0x59e7('0x31')][_0x59e7('0x2e')]()]=_0x1b37a3[_0x1ffab6[_0x59e7('0x35')][_0x59e7('0x36')][_0x59e7('0x2e')]()][_0x59e7('0x30')]();}});}return _0x226f9d;}function getTicket(_0x5caab3,_0x15a7f5,_0x4ea2f1,_0x7e477c,_0x33b3f8,_0x22396b){return function(_0x2b7de5){logger[_0x59e7('0x12')]('['+[_0x5caab3[_0x59e7('0x16')]()]+']\x20getTicket\x20input\x20crm',_0x2b7de5);return new Promise(function(_0x53c7ba,_0x416f84){var _0x32ef10=_0x5caab3[_0x59e7('0x2e')]()===_0x59e7('0x37')?_0x2b7de5[_0x59e7('0x1e')]:_0x2b7de5[_0x59e7('0x25')];var _0x5b4eb7={'method':'POST','uri':_0x4ea2f1+'incident'+'?'+_0x22396b,'body':Object['assign']({},{'active':_0x59e7('0x1d'),'caller_id':_0x32ef10,'assigned_to':_0x2b7de5[_0x59e7('0x1e')],'short_description':intUtil[_0x59e7('0x38')](_0x7e477c['Subjects'],_0x33b3f8,'\x20'),'description':intUtil[_0x59e7('0x38')](_0x7e477c[_0x59e7('0x39')],_0x33b3f8,'\x0a')},getCustomFields(_0x7e477c[_0x59e7('0x3a')],_0x33b3f8)),'auth':_0x15a7f5,'json':!![]};return rp(_0x5b4eb7)[_0x59e7('0xd')](function(_0x577a15){logger[_0x59e7('0x12')]('['+[_0x5caab3['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x577a15[_0x59e7('0xe')]);_0x2b7de5['ticketId']=_0x577a15[_0x59e7('0xe')][_0x59e7('0x11')];_0x2b7de5[_0x59e7('0x3b')]=_0x577a15[_0x59e7('0xe')][_0x59e7('0x3c')];logger[_0x59e7('0x12')]('['+[_0x5caab3[_0x59e7('0x16')]()]+_0x59e7('0x3d'),_0x2b7de5);_0x53c7ba(_0x2b7de5);})[_0x59e7('0x14')](function(_0x54ff1d){logger[_0x59e7('0x15')]('['+[_0x5caab3[_0x59e7('0x16')]()]+']',_0x54ff1d[_0x59e7('0x17')]);_0x416f84(_0x54ff1d[_0x59e7('0x17')]);});});};}function createRemoteTag(_0x1df474,_0x2347c1,_0x3b3d13,_0x3b595d){return new Promise(function(_0x59ee5c,_0x388676){var _0x37ffbf={'method':_0x59e7('0x3e'),'uri':_0x3b3d13+_0x59e7('0x3f')+'?'+_0x3b595d,'body':{'short_description':_0x1df474,'global':!![],'active':!![],'name':_0x1df474},'auth':_0x2347c1,'json':!![]};return rp(_0x37ffbf)['then'](function(_0x1b21cc){var _0xbb4583=_0x1b21cc[_0x59e7('0xe')]['sys_id'];_0x59ee5c(_0xbb4583);});});}function getRemoteTag(_0x5f9415,_0x435ca9,_0x550051,_0x42abc1,_0x1814c5){return new Promise(function(_0x7a6166,_0x531af9){var _0x5b5ca1={'method':_0x59e7('0xb'),'uri':_0x550051+_0x59e7('0x3f')+_0x59e7('0x40')+_0x5f9415+'&'+_0x42abc1,'auth':_0x435ca9,'json':!![]};return rp(_0x5b5ca1)[_0x59e7('0xd')](function(_0x429c88){if(_0x429c88['result']['length']>0x0){var _0x4a07d3=_0x429c88['result'][0x0][_0x59e7('0x11')];_0x7a6166(_0x4a07d3);}else{return createRemoteTag(_0x5f9415,_0x435ca9,_0x550051,_0x42abc1)['then'](function(_0x215315){_0x7a6166(_0x215315);});}});});}function assignTagToIncident(_0x2aaed6,_0x1537ac,_0xa87d69,_0x4bd53e,_0x16317f){return new Promise(function(_0x2b599a,_0x28e167){var _0x39754c={'method':'POST','uri':_0xa87d69+_0x59e7('0x41')+'?'+_0x16317f,'body':{'label':_0x2aaed6,'table':_0x59e7('0x42'),'id_type':_0x59e7('0x43'),'table_key':_0x4bd53e[_0x59e7('0x44')],'title':_0x59e7('0x45')+_0x4bd53e[_0x59e7('0x3b')],'id_display':_0x4bd53e['ticketNumber']},'auth':_0x1537ac,'json':!![]};return rp(_0x39754c)['then'](function(_0x5cff1b){_0x2b599a();})[_0x59e7('0x14')](function(){_0x2b599a();});});}function manageTags(_0x235168,_0x297e7e,_0x3842b9,_0x484fe7,_0x1e0d9e,_0x46ae8f,_0x10180f){return new Promise(function(_0x3f33c7,_0x4c823d){var _0x9ef4c8=[];_0x297e7e[_0x59e7('0x28')](function(_0x536a40){_0x9ef4c8[_0x59e7('0x46')](getRemoteTag(_0x536a40,_0x3842b9,_0x484fe7,_0x46ae8f,_0x10180f));});return Promise[_0x59e7('0x47')](_0x9ef4c8)[_0x59e7('0xd')](function(_0xca9f77){if(_0xca9f77[_0x59e7('0xf')]){logger[_0x59e7('0x12')]('['+[_0x235168['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xca9f77);var _0x5d3378=[];_0xca9f77[_0x59e7('0x28')](function(_0x375a2c){_0x5d3378['push'](assignTagToIncident(_0x375a2c,_0x3842b9,_0x484fe7,_0x1e0d9e,_0x46ae8f));});return Promise[_0x59e7('0x47')](_0x5d3378)[_0x59e7('0xd')](function(){_0x3f33c7();})['catch'](function(){_0x3f33c7();});}else{_0x3f33c7();}});});}function getTags(_0x46ca93,_0xe840e,_0x23dd57,_0x1f9b4b,_0x33ef67,_0xe473be){return function(_0xde1a3f){return new Promise(function(_0x15445d,_0x13846e){var _0x579c70=[];var _0x598e41=_0x1f9b4b[_0x59e7('0x48')];if(_0x598e41&&_0x598e41[_0x59e7('0xf')]>0x0){_0x579c70=_[_0x59e7('0x49')](_0x598e41,_0x59e7('0x36'));}if(_0x579c70[_0x59e7('0xf')]>0x0){return manageTags(_0x46ca93,_0x579c70,_0xe840e,_0x23dd57,_0xde1a3f,_0x33ef67,_0xe473be)[_0x59e7('0xd')](function(){_0x15445d(_0xde1a3f);});}else{_0x15445d(_0xde1a3f);}});};}function emit(_0x338651,_0x1402c0,_0x1eaddb){var _0x537dea=_0x59e7('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x59e7('0x4b');var _0x4f3ae3={'uri':_0x338651+_0x59e7('0x4c')+_0x1eaddb+_0x537dea};io['to'](util['format'](_0x59e7('0x4d'),_0x1402c0))[_0x59e7('0x4e')](_0x59e7('0x4f'),_0x4f3ae3);}exports['cs']=function(_0x1bf081,_0x115a0d,_0x4237c8,_0xa84792,_0x5005f6,_0x5de212,_0x2afba7,_0x5933de){var _0x2fa9fd={};var _0x395a5b={'user':_0x5de212[_0x59e7('0x50')],'pass':_0x5de212[_0x59e7('0x51')]};var _0x7e29e2=_0x59e7('0x52');var _0x11bfde=_0x59e7('0x53');_0x5de212['remoteUri']=intUtil['stripTrailingSlash'](_0x5de212['remoteUri']);_0x5de212[_0x59e7('0x54')]=intUtil[_0x59e7('0x55')](_0x5de212['serverUrl']);var _0x434b8f=util[_0x59e7('0x56')](_0x59e7('0x57'),_0x5de212[_0x59e7('0x58')]);_0x2fa9fd[_0x59e7('0x1a')]=!_['isNil'](_0xa84792)?_0xa84792[_0x59e7('0x59')]:null;_0x2fa9fd[_0x59e7('0x1f')]=_0x5de212[_0x59e7('0x59')];_0x2fa9fd[_0x59e7('0x22')]=_0x5933de[_0x59e7('0x2e')]()===_0x59e7('0x37')?_0x115a0d['destcalleridnum']:_0x115a0d[_0x59e7('0x5a')];_0x2fa9fd[_0x59e7('0x5b')]=_0x5933de===_0x59e7('0x5c')||_0x5933de==='unmanaged'?_0x59e7('0x5c'):_0x59e7('0x37');var _0x37f9d8=util[_0x59e7('0x56')](_0x59e7('0x5d'),_0x5de212[_0x59e7('0x54')],_0x115a0d[_0x59e7('0x5e')],md5(_0x115a0d[_0x59e7('0x5e')]));if(_0x5005f6&&_0x5005f6[_0x59e7('0x5f')]){logger[_0x59e7('0x12')](_0x59e7('0x60'),'Recording\x20is\x20enabled!');_0x115a0d[_0x59e7('0x61')]=_0x37f9d8;}else if(_0x2afba7&&_0x2afba7[_0x59e7('0x62')]&&_0x2afba7[_0x59e7('0x62')]!==_0x59e7('0x63')){logger[_0x59e7('0x12')](_0x59e7('0x64'),_0x59e7('0x65'));_0x115a0d['recordingURL']=_0x37f9d8;}else{_0x115a0d[_0x59e7('0x61')]='';}return getAdminUser(_0x5933de,_0x395a5b,_0x2fa9fd,_0x434b8f,_0x11bfde,_0x7e29e2)[_0x59e7('0xd')](getUser(_0x5933de,_0x395a5b,_0x434b8f,_0x11bfde,_0x7e29e2))['then'](getEndUser(_0x5933de,_0x395a5b,_0x434b8f,_0x11bfde,_0x7e29e2))[_0x59e7('0xd')](getTicket(_0x5933de,_0x395a5b,_0x434b8f,_0x4237c8,_0x115a0d,_0x11bfde))['then'](function(_0x7636b7){logger[_0x59e7('0x12')](util[_0x59e7('0x56')](_0x59e7('0x66'),_0x7636b7['ticketId']));logger[_0x59e7('0x12')](util[_0x59e7('0x56')](_0x59e7('0x67'),_0x5933de));if(_0x5933de!==_0x59e7('0x68')){logger[_0x59e7('0x12')]('['+[_0x5933de[_0x59e7('0x16')]()]+']',_0x59e7('0x69'));emit(_0x5de212[_0x59e7('0x58')],_0xa84792[_0x59e7('0x36')],_0x7636b7[_0x59e7('0x44')]);}})['catch'](function(_0xa8765f){logger['error']('['+[_0x5933de[_0x59e7('0x16')]()]+_0x59e7('0x6a'),util['inspect'](_0xa8765f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd52a=['Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','forEach','string','type','customField','nameField','toLowerCase','content','includes','picklist','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','Descriptions','Fields','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xd52a,0x75));var _0xad52=function(_0x3a0c83,_0x5d1a26){_0x3a0c83=_0x3a0c83-0x0;var _0x1e200a=_0xd52a[_0x3a0c83];return _0x1e200a;};'use strict';var _=require(_0xad52('0x0'));var Promise=require('bluebird');var rp=require(_0xad52('0x1'));var util=require(_0xad52('0x2'));var md5=require(_0xad52('0x3'));var Redis=require(_0xad52('0x4'));var intUtil=require(_0xad52('0x5'));var config=require(_0xad52('0x6'));var logger=require(_0xad52('0x7'))('servicenow');config['redis']=_[_0xad52('0x8')](config['redis'],{'host':_0xad52('0x9'),'port':0x18eb});var io=require(_0xad52('0xa'))(new Redis(config['redis']));function getAdminUser(_0x28e21e,_0x39c7e3,_0x354412,_0x4a4137,_0x234a68,_0x9bddfa){return new Promise(function(_0x2e8e47,_0x21e276){var _0x2d2b28={'method':_0xad52('0xb'),'uri':_0x4a4137+_0xad52('0xc')+'&'+_0x234a68+'&'+_0x9bddfa,'auth':_0x39c7e3,'json':!![]};return rp(_0x2d2b28)[_0xad52('0xd')](function(_0x237938){if(_0x237938[_0xad52('0xe')][_0xad52('0xf')]>0x0){_0x354412[_0xad52('0x10')]=_0x237938[_0xad52('0xe')][0x0][_0xad52('0x11')];}logger[_0xad52('0x12')]('['+[_0x28e21e['toUpperCase']()]+_0xad52('0x13'),_0x354412);_0x2e8e47(_0x354412);})[_0xad52('0x14')](function(_0xfdd05a){logger[_0xad52('0x15')]('['+[_0x28e21e[_0xad52('0x16')]()]+']',_0xfdd05a[_0xad52('0x17')]);_0x21e276(_0xfdd05a[_0xad52('0x17')]);});});}function getUser(_0x467729,_0x5fe05e,_0x5a7380,_0x4c060a,_0x1d6c2e){return function(_0x303fc4){logger[_0xad52('0x12')]('['+[_0x467729['toUpperCase']()]+_0xad52('0x18'),_0x303fc4);return new Promise(function(_0x3b8190,_0x48345d){if(intUtil['validateEmail'](_0x303fc4['userEmail'])){var _0x262b75={'method':_0xad52('0xb'),'uri':_0x5a7380+_0xad52('0x19')+_0x303fc4[_0xad52('0x1a')]+'&'+_0x4c060a+'&'+_0x1d6c2e,'auth':_0x5fe05e,'json':!![]};logger['info']('['+[_0x467729[_0xad52('0x16')]()]+'],\x20getUser\x20rp\x20obj',_0x262b75);return rp(_0x262b75)[_0xad52('0xd')](function(_0x34d23f){logger[_0xad52('0x12')]('['+[_0x467729[_0xad52('0x16')]()]+_0xad52('0x1b'),_0x34d23f);if(_0x34d23f[_0xad52('0xe')][_0xad52('0xf')]>0x0&&String(_0x34d23f[_0xad52('0xe')][0x0][_0xad52('0x1c')])===_0xad52('0x1d')){_0x303fc4[_0xad52('0x1e')]=_0x34d23f[_0xad52('0xe')][0x0][_0xad52('0x11')];}else{_0x303fc4[_0xad52('0x1e')]=_0x303fc4[_0xad52('0x10')];_0x303fc4[_0xad52('0x1a')]=_0x303fc4[_0xad52('0x1f')];}logger[_0xad52('0x12')]('['+[_0x467729['toUpperCase']()]+_0xad52('0x20'),_0x303fc4);_0x3b8190(_0x303fc4);})[_0xad52('0x14')](function(_0x428489){logger['error']('['+[_0x467729['toUpperCase']()]+']',_0x428489['message']);_0x48345d(_0x428489[_0xad52('0x17')]);});}else{logger[_0xad52('0x12')]('['+[_0x467729[_0xad52('0x16')]()]+']\x20using\x20admin\x20profile');_0x303fc4['userId']=_0x303fc4[_0xad52('0x10')];_0x303fc4[_0xad52('0x1a')]=_0x303fc4[_0xad52('0x1f')];_0x3b8190(_0x303fc4);}});};}function createEndUser(_0x33cb98,_0x2357f4,_0x261c3b,_0x186416,_0x274ef7){logger[_0xad52('0x12')]('['+[_0x33cb98['toUpperCase']()]+_0xad52('0x21'),_0x261c3b);return new Promise(function(_0x2ae212,_0x431577){var _0x4f378a={'method':_0xad52('0x22'),'uri':_0x186416+_0xad52('0x23')+_0x274ef7,'body':{'user_name':_0x261c3b[_0xad52('0x24')],'roles':'user','first_name':_0x261c3b[_0xad52('0x24')],'active':_0xad52('0x1d'),'date_format':'System','phone':_0x261c3b[_0xad52('0x24')]},'auth':_0x2357f4,'json':!![]};return rp(_0x4f378a)[_0xad52('0xd')](function(_0x2d0fe0){logger['info']('['+[_0x33cb98[_0xad52('0x16')]()]+_0xad52('0x25'),_0x2d0fe0[_0xad52('0xe')]);_0x261c3b[_0xad52('0x26')]=_0x2d0fe0[_0xad52('0xe')][_0xad52('0x11')];_0x2ae212(_0x261c3b);})['catch'](function(_0x16b230){logger[_0xad52('0x15')]('['+[_0x33cb98['toUpperCase']()]+']',_0x16b230[_0xad52('0x17')]);_0x431577(_0x16b230['message']);});});}function getEndUser(_0xfc8616,_0x13bcb5,_0x6ad173,_0x17ac1d,_0x1d79f5){return function(_0x10923c){logger[_0xad52('0x12')]('['+[_0xfc8616[_0xad52('0x16')]()]+'],\x20getEndUser\x20input\x20crm',_0x10923c);return new Promise(function(_0x2d33c5,_0x59b4bb){var _0x2b0e2d={'method':_0xad52('0xb'),'uri':_0x6ad173+'sys_user?sysparm_query=phone%3D'+_0x10923c[_0xad52('0x24')]+'&'+_0x17ac1d+'&'+_0x1d79f5,'auth':_0x13bcb5,'json':!![]};return rp(_0x2b0e2d)[_0xad52('0xd')](function(_0x47f42e){if(_0x47f42e[_0xad52('0xe')]['length']>0x0){_0x10923c[_0xad52('0x26')]=_0x47f42e[_0xad52('0xe')][0x0][_0xad52('0x11')];logger[_0xad52('0x12')]('['+[_0xfc8616[_0xad52('0x16')]()]+_0xad52('0x27'),_0x10923c);_0x2d33c5(_0x10923c);}else{return createEndUser(_0xfc8616,_0x13bcb5,_0x10923c,_0x6ad173,_0x17ac1d)[_0xad52('0xd')](function(_0x12eec1){logger[_0xad52('0x12')]('['+[_0xfc8616[_0xad52('0x16')]()]+'],\x20createEndUser\x20crm',_0x12eec1);_0x2d33c5(_0x12eec1);});}})[_0xad52('0x14')](function(_0x3dd2ed){logger[_0xad52('0x15')]('['+[_0xfc8616[_0xad52('0x16')]()]+']',_0x3dd2ed[_0xad52('0x17')]);_0x59b4bb(_0x3dd2ed[_0xad52('0x17')]);});});};}function getCustomFields(_0xe886d6,_0x277869){var _0x1f7dfb={};if(_0xe886d6['length']>0x0){_[_0xad52('0x28')](_0xe886d6,function(_0x4815b4){if(_['includes']([_0xad52('0x29'),'picklist'],_0x4815b4[_0xad52('0x2a')])&&_0x4815b4['nameField']&&!_0x4815b4[_0xad52('0x2b')]){_0x1f7dfb[_0x4815b4[_0xad52('0x2c')][_0xad52('0x2d')]()]=_0x4815b4[_0xad52('0x2e')]['toString']();}else if(_[_0xad52('0x2f')]([_0xad52('0x29'),_0xad52('0x30')],_0x4815b4['type'])&&_0x4815b4[_0xad52('0x31')]&&_0x4815b4[_0xad52('0x2b')]){_0x1f7dfb[_0x4815b4[_0xad52('0x31')][_0xad52('0x2d')]()]=_0x4815b4[_0xad52('0x2e')][_0xad52('0x32')]();}else if(_0x4815b4[_0xad52('0x2a')]===_0xad52('0x33')&&_0x4815b4[_0xad52('0x34')]&&_0x4815b4[_0xad52('0x31')]&&_0x4815b4[_0xad52('0x2b')]){_0x1f7dfb[_0x4815b4[_0xad52('0x31')][_0xad52('0x2d')]()]=_0x277869[_0x4815b4[_0xad52('0x34')]][_0xad52('0x32')]();}else if(_0x4815b4[_0xad52('0x2a')]===_0xad52('0x35')&&_0x4815b4[_0xad52('0x36')]&&_0x4815b4['Variable'][_0xad52('0x37')]&&_0x4815b4[_0xad52('0x31')]&&_0x4815b4['customField']){_0x1f7dfb[_0x4815b4[_0xad52('0x31')][_0xad52('0x2d')]()]=_0x277869[_0x4815b4[_0xad52('0x36')][_0xad52('0x37')]['toLowerCase']()]['toString']();}});}return _0x1f7dfb;}function getTicket(_0x489b52,_0x1c59b8,_0x2d5654,_0x79a69d,_0x12a672,_0x1d1728){return function(_0x2aa12a){logger[_0xad52('0x12')]('['+[_0x489b52[_0xad52('0x16')]()]+_0xad52('0x38'),_0x2aa12a);return new Promise(function(_0x4638ad,_0x8546ab){var _0x4fb71a=_0x489b52[_0xad52('0x2d')]()===_0xad52('0x39')?_0x2aa12a[_0xad52('0x1e')]:_0x2aa12a[_0xad52('0x26')];var _0x115ae3={'method':_0xad52('0x22'),'uri':_0x2d5654+'incident'+'?'+_0x1d1728,'body':Object[_0xad52('0x3a')]({},{'active':_0xad52('0x1d'),'caller_id':_0x4fb71a,'assigned_to':_0x2aa12a[_0xad52('0x1e')],'short_description':intUtil['getString'](_0x79a69d['Subjects'],_0x12a672,'\x20'),'description':intUtil['getString'](_0x79a69d[_0xad52('0x3b')],_0x12a672,'\x0a')},getCustomFields(_0x79a69d[_0xad52('0x3c')],_0x12a672)),'auth':_0x1c59b8,'json':!![]};return rp(_0x115ae3)[_0xad52('0xd')](function(_0x125f4d){logger[_0xad52('0x12')]('['+[_0x489b52[_0xad52('0x16')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x125f4d[_0xad52('0xe')]);_0x2aa12a[_0xad52('0x3d')]=_0x125f4d[_0xad52('0xe')]['sys_id'];_0x2aa12a[_0xad52('0x3e')]=_0x125f4d[_0xad52('0xe')][_0xad52('0x3f')];logger[_0xad52('0x12')]('['+[_0x489b52[_0xad52('0x16')]()]+']\x20getTicket\x20crm',_0x2aa12a);_0x4638ad(_0x2aa12a);})[_0xad52('0x14')](function(_0x354cd5){logger[_0xad52('0x15')]('['+[_0x489b52[_0xad52('0x16')]()]+']',_0x354cd5[_0xad52('0x17')]);_0x8546ab(_0x354cd5[_0xad52('0x17')]);});});};}function createRemoteTag(_0xa37e20,_0x55b3ab,_0x59ba12,_0x26912a){return new Promise(function(_0x4908f3,_0x138785){var _0x36d71f={'method':_0xad52('0x22'),'uri':_0x59ba12+'label'+'?'+_0x26912a,'body':{'short_description':_0xa37e20,'global':!![],'active':!![],'name':_0xa37e20},'auth':_0x55b3ab,'json':!![]};return rp(_0x36d71f)[_0xad52('0xd')](function(_0x57f28c){var _0xc26bb3=_0x57f28c[_0xad52('0xe')][_0xad52('0x11')];_0x4908f3(_0xc26bb3);});});}function getRemoteTag(_0x4bfbd0,_0x56f976,_0x366ae6,_0x1caa25,_0x34a12e){return new Promise(function(_0x36d692,_0x500f69){var _0x2f3817={'method':_0xad52('0xb'),'uri':_0x366ae6+_0xad52('0x40')+_0xad52('0x41')+_0x4bfbd0+'&'+_0x1caa25,'auth':_0x56f976,'json':!![]};return rp(_0x2f3817)[_0xad52('0xd')](function(_0x148512){if(_0x148512[_0xad52('0xe')]['length']>0x0){var _0x456c8f=_0x148512[_0xad52('0xe')][0x0][_0xad52('0x11')];_0x36d692(_0x456c8f);}else{return createRemoteTag(_0x4bfbd0,_0x56f976,_0x366ae6,_0x1caa25)[_0xad52('0xd')](function(_0x3c74b5){_0x36d692(_0x3c74b5);});}});});}function assignTagToIncident(_0x2ac743,_0x3cc218,_0x22a13d,_0x2f9c9d,_0x560dd4){return new Promise(function(_0x18ef05,_0x38f9e0){var _0x7192f3={'method':_0xad52('0x22'),'uri':_0x22a13d+'label_entry'+'?'+_0x560dd4,'body':{'label':_0x2ac743,'table':_0xad52('0x42'),'id_type':_0xad52('0x43'),'table_key':_0x2f9c9d[_0xad52('0x3d')],'title':_0xad52('0x44')+_0x2f9c9d[_0xad52('0x3e')],'id_display':_0x2f9c9d[_0xad52('0x3e')]},'auth':_0x3cc218,'json':!![]};return rp(_0x7192f3)[_0xad52('0xd')](function(_0x156944){_0x18ef05();})['catch'](function(){_0x18ef05();});});}function manageTags(_0x21f297,_0xcc6c8a,_0x500c0e,_0x163eb7,_0x41ae92,_0x3811b3,_0x16100e){return new Promise(function(_0x4a605d,_0x1db5c3){var _0x42f472=[];_0xcc6c8a[_0xad52('0x28')](function(_0x1685dc){_0x42f472['push'](getRemoteTag(_0x1685dc,_0x500c0e,_0x163eb7,_0x3811b3,_0x16100e));});return Promise[_0xad52('0x45')](_0x42f472)[_0xad52('0xd')](function(_0x1d659d){if(_0x1d659d[_0xad52('0xf')]){logger[_0xad52('0x12')]('['+[_0x21f297['toUpperCase']()]+_0xad52('0x46'),_0x1d659d);var _0x30d8df=[];_0x1d659d['forEach'](function(_0x3d521f){_0x30d8df[_0xad52('0x47')](assignTagToIncident(_0x3d521f,_0x500c0e,_0x163eb7,_0x41ae92,_0x3811b3));});return Promise[_0xad52('0x45')](_0x30d8df)['then'](function(){_0x4a605d();})['catch'](function(){_0x4a605d();});}else{_0x4a605d();}});});}function getTags(_0x416601,_0x30b710,_0x17c476,_0x1dc8b1,_0x5bd2b7,_0x159212){return function(_0x37d443){return new Promise(function(_0x44fa7b,_0x318f83){var _0x259191=[];var _0x159cf8=_0x1dc8b1[_0xad52('0x48')];if(_0x159cf8&&_0x159cf8[_0xad52('0xf')]>0x0){_0x259191=_[_0xad52('0x49')](_0x159cf8,_0xad52('0x37'));}if(_0x259191[_0xad52('0xf')]>0x0){return manageTags(_0x416601,_0x259191,_0x30b710,_0x17c476,_0x37d443,_0x5bd2b7,_0x159212)[_0xad52('0xd')](function(){_0x44fa7b(_0x37d443);});}else{_0x44fa7b(_0x37d443);}});};}function emit(_0x161314,_0x5867a9,_0xb355c1){var _0x5092b5=_0xad52('0x4a')+_0xad52('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xad52('0x4c');var _0xabaa55={'uri':_0x161314+_0xad52('0x4d')+_0xb355c1+_0x5092b5};io['to'](util[_0xad52('0x4e')]('user:%s',_0x5867a9))['emit'](_0xad52('0x4f'),_0xabaa55);}exports['cs']=function(_0x1146a5,_0x5bfae0,_0x3ad6bd,_0x1e11c4,_0x3c70a4,_0x260561,_0x3e645b,_0x329ca7){var _0x2fcfed={};var _0x30d914={'user':_0x260561[_0xad52('0x50')],'pass':_0x260561[_0xad52('0x51')]};var _0x29b21e='sysparm_limit=1';var _0x3facae=_0xad52('0x52');_0x260561[_0xad52('0x53')]=intUtil[_0xad52('0x54')](_0x260561['remoteUri']);_0x260561[_0xad52('0x55')]=intUtil[_0xad52('0x54')](_0x260561[_0xad52('0x55')]);var _0x521d9e=util['format'](_0xad52('0x56'),_0x260561[_0xad52('0x53')]);_0x2fcfed[_0xad52('0x1a')]=!_[_0xad52('0x57')](_0x1e11c4)?_0x1e11c4[_0xad52('0x58')]:null;_0x2fcfed[_0xad52('0x1f')]=_0x260561[_0xad52('0x58')];_0x2fcfed[_0xad52('0x24')]=_0x329ca7['toLowerCase']()==='outbound'?_0x5bfae0[_0xad52('0x59')]:_0x5bfae0[_0xad52('0x5a')];_0x2fcfed[_0xad52('0x5b')]=_0x329ca7==='queue'||_0x329ca7==='unmanaged'?_0xad52('0x5c'):_0xad52('0x39');var _0x1c0bcd=util[_0xad52('0x4e')](_0xad52('0x5d'),_0x260561[_0xad52('0x55')],_0x5bfae0[_0xad52('0x5e')],md5(_0x5bfae0['uniqueid']));if(_0x3c70a4&&_0x3c70a4[_0xad52('0x5f')]){logger[_0xad52('0x12')](_0xad52('0x60'),_0xad52('0x61'));_0x5bfae0[_0xad52('0x62')]=_0x1c0bcd;}else if(_0x3e645b&&_0x3e645b['recordingFormat']&&_0x3e645b[_0xad52('0x63')]!==_0xad52('0x64')){logger[_0xad52('0x12')](_0xad52('0x65'),'Recording\x20is\x20enabled!');_0x5bfae0[_0xad52('0x62')]=_0x1c0bcd;}else{_0x5bfae0[_0xad52('0x62')]='';}return getAdminUser(_0x329ca7,_0x30d914,_0x2fcfed,_0x521d9e,_0x3facae,_0x29b21e)[_0xad52('0xd')](getUser(_0x329ca7,_0x30d914,_0x521d9e,_0x3facae,_0x29b21e))[_0xad52('0xd')](getEndUser(_0x329ca7,_0x30d914,_0x521d9e,_0x3facae,_0x29b21e))[_0xad52('0xd')](getTicket(_0x329ca7,_0x30d914,_0x521d9e,_0x3ad6bd,_0x5bfae0,_0x3facae))[_0xad52('0xd')](function(_0x2a91d8){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2a91d8[_0xad52('0x3d')]));logger['info'](util[_0xad52('0x4e')](_0xad52('0x66'),_0x329ca7));if(_0x329ca7!==_0xad52('0x67')){logger[_0xad52('0x12')]('['+[_0x329ca7[_0xad52('0x16')]()]+']',_0xad52('0x68'));emit(_0x260561['remoteUri'],_0x1e11c4[_0xad52('0x37')],_0x2a91d8[_0xad52('0x3d')]);}})[_0xad52('0x14')](function(_0x43179a){logger['error']('['+[_0x329ca7[_0xad52('0x16')]()]+_0xad52('0x69'),util[_0xad52('0x6a')](_0x43179a,{'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 5c10d72..711308e 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 _0x8e49=['Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','string','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','customVariable','Variable','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','unmanaged','uri','monitor_format','lastevent','toUpperCase','error','lodash','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','date_start','replace','duration_hours','parent_type','Contacts','parent_name','direction','length','forEach','push','variableName','JSON','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil'];(function(_0x1e7c08,_0x33c5a5){var _0x2c6018=function(_0x3d4acf){while(--_0x3d4acf){_0x1e7c08['push'](_0x1e7c08['shift']());}};_0x2c6018(++_0x33c5a5);}(_0x8e49,0x1b3));var _0x98e4=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x8e49[_0x32bb6b];return _0x58dcb4;};'use strict';var _=require(_0x98e4('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x98e4('0x1'));var Redis=require(_0x98e4('0x2'));var intUtil=require('./util');var config=require(_0x98e4('0x3'));var logger=require('../../../../config/logger')(_0x98e4('0x4'));config[_0x98e4('0x5')]=_[_0x98e4('0x6')](config[_0x98e4('0x5')],{'host':_0x98e4('0x7'),'port':0x18eb});var io=require(_0x98e4('0x8'))(new Redis(config[_0x98e4('0x5')]));var def={'method':_0x98e4('0x9'),'json':!![]};function emit(_0x23920d,_0x2c7aa9,_0x3cc052){io['to'](_0x23920d)[_0x98e4('0xa')](_0x2c7aa9,_0x3cc052);}function getTicket(_0x16da2c,_0x4e8f1b,_0x29429c,_0x10cdb0,_0x246857,_0x4534b7,_0x2fd218,_0x494a3b){logger[_0x98e4('0xb')](_0x98e4('0xc'));var _0x1d690d=new Date();var _0x1aa801=[{'name':_0x98e4('0xd'),'value':intUtil['getString'](_0x10cdb0[_0x98e4('0xe')],_0x246857,'\x20')},{'name':_0x98e4('0xf'),'value':_0x4e8f1b['id']},{'name':'created_by','value':_0x4e8f1b['id']},{'name':_0x98e4('0x10'),'value':intUtil[_0x98e4('0x11')](_0x10cdb0['Descriptions'],_0x246857,'\x0a')},{'name':_0x98e4('0x12'),'value':_0x1d690d['toISOString']()['slice'](0x0,0x13)[_0x98e4('0x13')]('T','\x20')},{'name':_0x98e4('0x14'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x29429c['id']},{'name':_0x98e4('0x15'),'value':_0x98e4('0x16')},{'name':_0x98e4('0x17'),'value':_0x29429c[_0x98e4('0xd')]},{'name':_0x98e4('0x18'),'value':_0x494a3b}];if(_0x4534b7[_0x98e4('0x19')]){_[_0x98e4('0x1a')](_0x4534b7,function(_0x8e83c9){if(_0x246857[_0x8e83c9['variableName']]){_0x1aa801[_0x98e4('0x1b')]({'name':_0x8e83c9['idField'],'value':_0x246857[_0x8e83c9[_0x98e4('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x98e4('0x1d'),'rest_data':JSON['stringify']({'session':_0x2fd218['id'],'module_name':'Calls','name_value_list':_0x1aa801})}});}function getAuth(_0x5a27b2){return util['format'](_0x98e4('0x1e'),new Buffer(_0x5a27b2[_0x98e4('0x1f')]+':X')[_0x98e4('0x20')](_0x98e4('0x21')));}function getServerInfo(_0x4206ff){return request({'form':{'method':_0x98e4('0x22'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'session':_0x4206ff['id']})}});}function getUser(_0x3a502d,_0x48c34c,_0x22c1c1){if(!_[_0x98e4('0x24')](_0x48c34c)){logger['info'](_0x98e4('0x25'),_0x48c34c);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'session':_0x22c1c1['id'],'module_name':_0x98e4('0x26'),'query':util[_0x98e4('0x27')](_0x98e4('0x28'),_0x48c34c),'order_by':'','offset':'0','select_fields':['id',_0x98e4('0xd'),_0x98e4('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x98e4('0x2a')](function(_0x2cdb5){if(_0x2cdb5[_0x98e4('0x2b')][_0x98e4('0x19')]){var _0x34556c=_[_0x98e4('0x2c')](_0x2cdb5[_0x98e4('0x2b')],function(_0x3ae3c3){return _0x3ae3c3['name_value_list'][_0x98e4('0x29')][_0x98e4('0x2d')]===_0x48c34c;});if(_0x34556c){logger[_0x98e4('0xb')](_0x98e4('0x2e'));return BPromise['resolve']({'id':_0x34556c[_0x98e4('0x2f')]['id']['value'],'name':_0x34556c[_0x98e4('0x2f')][_0x98e4('0xd')][_0x98e4('0x2d')]});}}logger[_0x98e4('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x98e4('0x30')]({'id':_0x22c1c1[_0x98e4('0x2f')][_0x98e4('0x31')][_0x98e4('0x2d')],'name':_0x22c1c1[_0x98e4('0x2f')]['user_name'][_0x98e4('0x2d')]});});}else{logger[_0x98e4('0xb')](_0x98e4('0x32'));return BPromise[_0x98e4('0x30')]({'id':_0x22c1c1[_0x98e4('0x2f')][_0x98e4('0x31')][_0x98e4('0x2d')],'name':_0x22c1c1[_0x98e4('0x2f')]['user_name']['value']});}}function getEndUser(_0x233322,_0x4281e4,_0x7fa56a,_0x1dea47){logger['info']('Searching\x20enduser\x20with\x20phone',_0x7fa56a);return request({'form':{'method':_0x98e4('0x33'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x98e4('0x23')]({'session':_0x1dea47['id'],'module_name':_0x98e4('0x16'),'query':util[_0x98e4('0x27')](_0x98e4('0x34'),_0x7fa56a),'order_by':'','offset':'0','select_fields':['id',_0x98e4('0xd'),_0x98e4('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x98e4('0x2a')](function(_0x1a17a4){if(_0x1a17a4[_0x98e4('0x2b')][_0x98e4('0x19')]){var _0x124157=_[_0x98e4('0x2c')](_0x1a17a4[_0x98e4('0x2b')],function(_0x3cdc29){return _0x3cdc29[_0x98e4('0x2f')][_0x98e4('0x35')][_0x98e4('0x2d')]===_0x7fa56a;});if(_0x124157){logger[_0x98e4('0xb')](_0x98e4('0x36'));return BPromise[_0x98e4('0x30')]({'id':_0x124157[_0x98e4('0x2f')]['id'][_0x98e4('0x2d')],'name':_0x124157[_0x98e4('0x2f')][_0x98e4('0xd')][_0x98e4('0x2d')],'phone':_0x124157[_0x98e4('0x2f')][_0x98e4('0x35')][_0x98e4('0x2d')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x98e4('0x37'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'session':_0x1dea47['id'],'module_name':_0x98e4('0x16'),'name_value_list':[{'name':_0x98e4('0x38'),'value':_0x4281e4!==_0x98e4('0x39')?_0x4281e4:util[_0x98e4('0x27')](_0x98e4('0x3a'),_0x7fa56a)},{'name':_0x98e4('0x35'),'value':_0x7fa56a}]})}})[_0x98e4('0x2a')](function(_0xba1ffa){logger[_0x98e4('0xb')](_0x98e4('0x3b'));return BPromise[_0x98e4('0x30')]({'id':_0xba1ffa['id'],'name':_0xba1ffa[_0x98e4('0x2b')]['first_name'][_0x98e4('0x2d')],'phone':_0xba1ffa[_0x98e4('0x2b')][_0x98e4('0x35')][_0x98e4('0x2d')]});});}});}function request(_0x1548cf){logger[_0x98e4('0x3c')]('[HTTP]',JSON[_0x98e4('0x23')](_0x1548cf));return rp(_[_0x98e4('0x3d')](def,_0x1548cf));}function getTags(_0x5c6842,_0x3f90a5){var _0x135e09=[];if(_0x5c6842&&_0x5c6842[_0x98e4('0x19')]>0x0){_0x135e09=_['map'](_0x5c6842,_0x3f90a5);}return _0x135e09;}function getCustomFields(_0xc46ea,_0x13a266){var _0x55a919=[];var _0x28c67e={'custom_fields':[]};if(_0xc46ea[_0x98e4('0x19')]>0x0){_[_0x98e4('0x1a')](_0xc46ea,function(_0x582232){if(_0x582232['type']===_0x98e4('0x3e')&&_0x582232[_0x98e4('0x3f')]&&!_0x582232[_0x98e4('0x40')]){_0x28c67e[_0x582232[_0x98e4('0x3f')][_0x98e4('0x41')]()]=_0x582232[_0x98e4('0x42')][_0x98e4('0x20')]();}else if(_0x582232[_0x98e4('0x43')]===_0x98e4('0x3e')&&_0x582232[_0x98e4('0x44')]&&_0x582232['customField']){_0x28c67e[_0x98e4('0x45')][_0x98e4('0x1b')]({'id':_0x582232[_0x98e4('0x44')],'value':_0x582232['content'][_0x98e4('0x20')]()});}else if(_0x582232[_0x98e4('0x43')]===_0x98e4('0x46')&&_0x582232[_0x98e4('0x1c')]&&_0x582232['idField']&&_0x582232[_0x98e4('0x40')]){_0x13a266[_0x582232[_0x98e4('0x1c')]]&&_0x28c67e[_0x98e4('0x45')][_0x98e4('0x1b')]({'id':_0x582232[_0x98e4('0x44')],'value':_0x13a266[_0x582232[_0x98e4('0x1c')]][_0x98e4('0x20')]()});}else if(_0x582232[_0x98e4('0x43')]===_0x98e4('0x47')&&_0x582232[_0x98e4('0x48')]&&_0x582232[_0x98e4('0x48')][_0x98e4('0xd')]&&_0x582232[_0x98e4('0x44')]&&_0x582232['customField']){_0x13a266[_0x582232[_0x98e4('0x48')][_0x98e4('0xd')][_0x98e4('0x41')]()]&&_0x28c67e[_0x98e4('0x45')]['push']({'id':_0x582232[_0x98e4('0x44')],'value':_0x13a266[_0x582232[_0x98e4('0x48')][_0x98e4('0xd')]['toLowerCase']()][_0x98e4('0x20')]()});}});}return _0x28c67e;}function getConnection(_0xc354d2){return request({'method':_0x98e4('0x9'),'form':{'method':_0x98e4('0x49'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON[_0x98e4('0x23')]({'user_auth':{'user_name':_0xc354d2['username'],'password':_0xc354d2[_0x98e4('0x4a')],'encryption':'PLAIN'},'application':_0x98e4('0x4b')})}})[_0x98e4('0x2a')](function(_0x4362f7){var _0x3c1454=_0x4362f7;if(_0x3c1454['id']){def[_0x98e4('0x4c')]=_0x3c1454['id'];return BPromise[_0x98e4('0x30')](_0x3c1454);}else{throw new Error(util[_0x98e4('0x27')](_0x98e4('0x4d'),_0xc354d2['id']));}});}function setRelationship(_0x2e1bc8,_0x54646f,_0x21fd2c,_0x128d91){return request({'form':{'method':_0x98e4('0x4e'),'input_type':_0x98e4('0x1d'),'response_type':_0x98e4('0x1d'),'rest_data':JSON['stringify']({'session':_0x2e1bc8['id'],'module_name':_0x98e4('0x4f'),'module_id':_0x21fd2c['id'],'link_field_name':_0x128d91,'related_ids':[_0x54646f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x98e4('0x50')]=function(_0x420a83,_0x390c62,_0x269069,_0x3db23c,_0x578212,_0x1fab26){var _0x5e9bec,_0x3665b9,_0xf301dd,_0x5e3539;_0x1fab26[_0x98e4('0x51')]=intUtil[_0x98e4('0x52')](_0x1fab26[_0x98e4('0x51')]);_0x1fab26['serverUrl']=intUtil['stripTrailingSlash'](_0x1fab26[_0x98e4('0x53')]);def['uri']=util[_0x98e4('0x27')](_0x98e4('0x54'),_0x1fab26['remoteUri']);if(_0x578212&&_0x578212['monitor_format']){logger['info'](_0x98e4('0x55'),_0x98e4('0x56'));_0x390c62['recordingURL']=util[_0x98e4('0x27')](_0x98e4('0x57'),_0x1fab26[_0x98e4('0x53')],_0x390c62[_0x98e4('0x58')],md5(_0x390c62[_0x98e4('0x58')]));}else{_0x390c62[_0x98e4('0x59')]='';}return getConnection(_0x1fab26)[_0x98e4('0x2a')](function(_0xac6ab1){_0x5e3539=_0xac6ab1;return getUser(_0x1fab26,_0x3db23c['name'],_0x5e3539);})['then'](function(_0x219ca2){_0x5e9bec=_0x219ca2;logger[_0x98e4('0xb')](_0x98e4('0x5a'),_0x5e9bec['id']);return getEndUser(_0x1fab26,_0x390c62[_0x98e4('0x5b')],_0x390c62[_0x98e4('0x5c')],_0x5e3539);})[_0x98e4('0x2a')](function(_0x293406){_0x3665b9=_0x293406;logger[_0x98e4('0xb')](_0x98e4('0x5d'),_0x3665b9['id']);return getTicket(_0x1fab26,_0x5e9bec,_0x3665b9,_0x269069,_0x390c62,_0x269069[_0x98e4('0x5e')],_0x5e3539,_0x98e4('0x5f'));})[_0x98e4('0x2a')](function(_0x2d74f1){_0xf301dd=_0x2d74f1;logger[_0x98e4('0xb')](_0x98e4('0x60'));logger[_0x98e4('0xb')](_0x98e4('0x61'),_0xf301dd['id']);return setRelationship(_0x5e3539,_0x5e9bec,_0xf301dd,_0x98e4('0x62'));})[_0x98e4('0x2a')](function(){return setRelationship(_0x5e3539,_0x3665b9,_0xf301dd,_0x98e4('0x63'));})[_0x98e4('0x2a')](function(){return getServerInfo(_0x5e3539);})[_0x98e4('0x2a')](function(_0x2559d1){var _0x27add8=parseInt(_0x2559d1['version'][_0x98e4('0x64')](0x0));var _0x24ed9f=util[_0x98e4('0x27')](_0x98e4('0x65'),_0x1fab26[_0x98e4('0x51')],_0xf301dd['id']);if(_0x27add8>0x6){_0x24ed9f=util[_0x98e4('0x27')](_0x98e4('0x66'),_0x1fab26['remoteUri'],_0xf301dd['id']);}logger[_0x98e4('0xb')](_0x98e4('0x55'),_0x98e4('0x67'));emit(util[_0x98e4('0x27')](_0x98e4('0x68'),_0x3db23c[_0x98e4('0xd')]),_0x98e4('0x69'),{'uri':_0x24ed9f});})[_0x98e4('0x6a')](function(_0x24e0ea){logger['error']('[QUEUE]',JSON[_0x98e4('0x23')](_0x24e0ea));});};exports['outbound']=function(_0x109396,_0x3e583d,_0xf83529,_0x3104e4,_0x5c4f84,_0x3b1a8e,_0x34e26b){var _0xa5dbb1,_0x22355,_0x2c7829,_0x5188e0;_0x3b1a8e['remoteUri']=intUtil[_0x98e4('0x52')](_0x3b1a8e[_0x98e4('0x51')]);_0x3b1a8e['serverUrl']=intUtil['stripTrailingSlash'](_0x3b1a8e[_0x98e4('0x53')]);def['uri']=util[_0x98e4('0x27')](_0x98e4('0x54'),_0x3b1a8e['remoteUri']);if(_0x34e26b&&_0x34e26b[_0x98e4('0x6b')]&&_0x34e26b['recordingFormat']!==_0x98e4('0x6c')){logger[_0x98e4('0xb')](_0x98e4('0x6d'),_0x98e4('0x56'));_0x3e583d['recordingURL']=util[_0x98e4('0x27')](_0x98e4('0x57'),_0x3b1a8e[_0x98e4('0x53')],_0x3e583d[_0x98e4('0x58')],md5(_0x3e583d[_0x98e4('0x58')]));}return getConnection(_0x3b1a8e)[_0x98e4('0x2a')](function(_0x21ffdb){_0x5188e0=_0x21ffdb;return getUser(_0x3b1a8e,_0x3104e4[_0x98e4('0xd')],_0x5188e0);})[_0x98e4('0x2a')](function(_0x10a1fd){_0xa5dbb1=_0x10a1fd;logger['info'](_0x98e4('0x5a'),_0xa5dbb1['id']);return getEndUser(_0x3b1a8e,_0x3e583d[_0x98e4('0x6e')],_0x3e583d['destcalleridnum'],_0x5188e0);})[_0x98e4('0x2a')](function(_0x4ecf1f){_0x22355=_0x4ecf1f;logger[_0x98e4('0xb')](_0x98e4('0x5d'),_0x22355['id']);return getTicket(_0x3b1a8e,_0xa5dbb1,_0x22355,_0xf83529,_0x3e583d,_0xf83529[_0x98e4('0x5e')],_0x5188e0,_0x98e4('0x6f'));})['then'](function(_0xdabeb5){_0x2c7829=_0xdabeb5;logger[_0x98e4('0xb')](_0x98e4('0x60'));logger[_0x98e4('0xb')](_0x98e4('0x61'),_0x2c7829['id']);return setRelationship(_0x5188e0,_0xa5dbb1,_0x2c7829,_0x98e4('0x62'));})[_0x98e4('0x2a')](function(){return setRelationship(_0x5188e0,_0x22355,_0x2c7829,_0x98e4('0x63'));})[_0x98e4('0x2a')](function(){return getServerInfo(_0x5188e0);})['then'](function(_0x2279c5){var _0x21afa5=parseInt(_0x2279c5['version']['charAt'](0x0));var _0x593ff0=util[_0x98e4('0x27')](_0x98e4('0x65'),_0x3b1a8e[_0x98e4('0x51')],_0x2c7829['id']);if(_0x21afa5>0x6){_0x593ff0=util[_0x98e4('0x27')](_0x98e4('0x66'),_0x3b1a8e[_0x98e4('0x51')],_0x2c7829['id']);}logger[_0x98e4('0xb')](_0x98e4('0x6d'),_0x98e4('0x67'));emit(util[_0x98e4('0x27')](_0x98e4('0x68'),_0x3104e4['name']),_0x98e4('0x69'),{'uri':_0x593ff0});})[_0x98e4('0x6a')](function(_0x5c0554){logger['error'](_0x98e4('0x6d'),JSON[_0x98e4('0x23')](_0x5c0554));});};exports[_0x98e4('0x70')]=function(_0x5bb8bb,_0x1ea6bc,_0x53ffa1,_0x52e289,_0x2fa896,_0x4ac02b){var _0x13b8c7,_0xbe48dd,_0x2b443f,_0x4ef091;_0x4ac02b[_0x98e4('0x51')]=intUtil[_0x98e4('0x52')](_0x4ac02b[_0x98e4('0x51')]);_0x4ac02b[_0x98e4('0x53')]=intUtil['stripTrailingSlash'](_0x4ac02b[_0x98e4('0x53')]);def[_0x98e4('0x71')]=util[_0x98e4('0x27')]('%s/service/v4_1/rest.php',_0x4ac02b[_0x98e4('0x51')]);if(_0x2fa896&&_0x2fa896[_0x98e4('0x72')]){logger[_0x98e4('0xb')]('['+_0x1ea6bc[_0x98e4('0x73')][_0x98e4('0x74')]()+']',_0x98e4('0x56'));_0x1ea6bc['recordingURL']=util['format'](_0x98e4('0x57'),_0x4ac02b['serverUrl'],_0x1ea6bc['uniqueid'],md5(_0x1ea6bc['uniqueid']));}else{_0x1ea6bc[_0x98e4('0x59')]='';}return getConnection(_0x4ac02b)[_0x98e4('0x2a')](function(_0x572f5d){_0x4ef091=_0x572f5d;if(!_[_0x98e4('0x24')](_0x52e289)){return getUser(_0x4ac02b,_0x52e289[_0x98e4('0xd')],_0x4ef091);}else{return getUser(_0x4ac02b,null,_0x4ef091);}})[_0x98e4('0x2a')](function(_0x1a7650){_0x13b8c7=_0x1a7650;logger[_0x98e4('0xb')]('The\x20User\x20ID\x20is:',_0x13b8c7['id']);return getEndUser(_0x4ac02b,_0x1ea6bc[_0x98e4('0x5b')],_0x1ea6bc[_0x98e4('0x5c')],_0x4ef091);})[_0x98e4('0x2a')](function(_0x2420b6){_0xbe48dd=_0x2420b6;logger[_0x98e4('0xb')](_0x98e4('0x5d'),_0xbe48dd['id']);return getTicket(_0x4ac02b,_0x13b8c7,_0xbe48dd,_0x53ffa1,_0x1ea6bc,_0x53ffa1[_0x98e4('0x5e')],_0x4ef091,'Inbound');})['then'](function(_0x383819){_0x2b443f=_0x383819;logger[_0x98e4('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x2b443f['id']);return setRelationship(_0x4ef091,_0x13b8c7,_0x2b443f,'users');})['then'](function(){return setRelationship(_0x4ef091,_0xbe48dd,_0x2b443f,'contacts');})['then'](function(){return getServerInfo(_0x4ef091);})[_0x98e4('0x6a')](function(_0x583aac){logger[_0x98e4('0x75')]('['+_0x1ea6bc['lastevent'][_0x98e4('0x74')]()+']',JSON['stringify'](_0x583aac));});}; \ No newline at end of file +var _0x9f07=['remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Fields','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','calleridname','calleridnum','Inbound','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','redis','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','length','variableName','push','set_entry','JSON','stringify','Calls','apiKey','toString','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','idField','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue'];(function(_0x30c50c,_0x4c486d){var _0x528c67=function(_0x35ee0d){while(--_0x35ee0d){_0x30c50c['push'](_0x30c50c['shift']());}};_0x528c67(++_0x4c486d);}(_0x9f07,0x118));var _0x79f0=function(_0x415262,_0xacc412){_0x415262=_0x415262-0x0;var _0x5ad2b7=_0x9f07[_0x415262];return _0x5ad2b7;};'use strict';var _=require(_0x79f0('0x0'));var rp=require(_0x79f0('0x1'));var BPromise=require('bluebird');var md5=require(_0x79f0('0x2'));var util=require('util');var Redis=require(_0x79f0('0x3'));var intUtil=require('./util');var config=require(_0x79f0('0x4'));var logger=require(_0x79f0('0x5'))('sugarcrm');config['redis']=_[_0x79f0('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x79f0('0x7'))(new Redis(config[_0x79f0('0x8')]));var def={'method':_0x79f0('0x9'),'json':!![]};function emit(_0x4c8cf8,_0x46d371,_0x2aea15){io['to'](_0x4c8cf8)[_0x79f0('0xa')](_0x46d371,_0x2aea15);}function getTicket(_0x3945b8,_0x461362,_0x2dc465,_0x218490,_0x285e5c,_0x572255,_0x3f2b9f,_0xa77af7){logger[_0x79f0('0xb')](_0x79f0('0xc'));var _0x5a4fb0=new Date();var _0x4e6495=[{'name':_0x79f0('0xd'),'value':intUtil[_0x79f0('0xe')](_0x218490['Subjects'],_0x285e5c,'\x20')},{'name':_0x79f0('0xf'),'value':_0x461362['id']},{'name':_0x79f0('0x10'),'value':_0x461362['id']},{'name':_0x79f0('0x11'),'value':intUtil[_0x79f0('0xe')](_0x218490[_0x79f0('0x12')],_0x285e5c,'\x0a')},{'name':_0x79f0('0x13'),'value':_0x5a4fb0[_0x79f0('0x14')]()[_0x79f0('0x15')](0x0,0x13)[_0x79f0('0x16')]('T','\x20')},{'name':_0x79f0('0x17'),'value':'0'},{'name':_0x79f0('0x18'),'value':'15'},{'name':_0x79f0('0x19'),'value':_0x2dc465['id']},{'name':'parent_type','value':_0x79f0('0x1a')},{'name':'parent_name','value':_0x2dc465[_0x79f0('0xd')]},{'name':_0x79f0('0x1b'),'value':_0xa77af7}];if(_0x572255[_0x79f0('0x1c')]){_['forEach'](_0x572255,function(_0x42117a){if(_0x285e5c[_0x42117a[_0x79f0('0x1d')]]){_0x4e6495[_0x79f0('0x1e')]({'name':_0x42117a['idField'],'value':_0x285e5c[_0x42117a[_0x79f0('0x1d')]]});}});}return request({'form':{'method':_0x79f0('0x1f'),'input_type':'JSON','response_type':_0x79f0('0x20'),'rest_data':JSON[_0x79f0('0x21')]({'session':_0x3f2b9f['id'],'module_name':_0x79f0('0x22'),'name_value_list':_0x4e6495})}});}function getAuth(_0x244dc6){return util['format']('Basic\x20%s',new Buffer(_0x244dc6[_0x79f0('0x23')]+':X')[_0x79f0('0x24')]('base64'));}function getServerInfo(_0x1724c8){return request({'form':{'method':'get_server_info','input_type':_0x79f0('0x20'),'response_type':_0x79f0('0x20'),'rest_data':JSON[_0x79f0('0x21')]({'session':_0x1724c8['id']})}});}function getUser(_0xb4be01,_0x16b9b4,_0x4f5e61){if(!_['isNil'](_0x16b9b4)){logger['info'](_0x79f0('0x25'),_0x16b9b4);return request({'form':{'method':_0x79f0('0x26'),'input_type':'JSON','response_type':_0x79f0('0x20'),'rest_data':JSON[_0x79f0('0x21')]({'session':_0x4f5e61['id'],'module_name':_0x79f0('0x27'),'query':util['format'](_0x79f0('0x28'),_0x16b9b4),'order_by':'','offset':'0','select_fields':['id',_0x79f0('0xd'),_0x79f0('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x79f0('0x2a')](function(_0x19c57e){if(_0x19c57e['entry_list'][_0x79f0('0x1c')]){var _0xdaca68=_[_0x79f0('0x2b')](_0x19c57e[_0x79f0('0x2c')],function(_0x1bcf07){return _0x1bcf07['name_value_list'][_0x79f0('0x29')][_0x79f0('0x2d')]===_0x16b9b4;});if(_0xdaca68){logger[_0x79f0('0xb')](_0x79f0('0x2e'));return BPromise[_0x79f0('0x2f')]({'id':_0xdaca68[_0x79f0('0x30')]['id'][_0x79f0('0x2d')],'name':_0xdaca68['name_value_list'][_0x79f0('0xd')]['value']});}}logger['info'](_0x79f0('0x31'));return BPromise[_0x79f0('0x2f')]({'id':_0x4f5e61['name_value_list'][_0x79f0('0x32')][_0x79f0('0x2d')],'name':_0x4f5e61[_0x79f0('0x30')][_0x79f0('0x29')][_0x79f0('0x2d')]});});}else{logger[_0x79f0('0xb')](_0x79f0('0x33'));return BPromise[_0x79f0('0x2f')]({'id':_0x4f5e61[_0x79f0('0x30')]['user_id']['value'],'name':_0x4f5e61['name_value_list']['user_name']['value']});}}function getEndUser(_0x5c6b22,_0x2a11a8,_0x46ec4d,_0x5ea6c4){logger[_0x79f0('0xb')]('Searching\x20enduser\x20with\x20phone',_0x46ec4d);return request({'form':{'method':_0x79f0('0x26'),'input_type':_0x79f0('0x20'),'response_type':_0x79f0('0x20'),'rest_data':JSON[_0x79f0('0x21')]({'session':_0x5ea6c4['id'],'module_name':'Contacts','query':util[_0x79f0('0x34')](_0x79f0('0x35'),_0x46ec4d),'order_by':'','offset':'0','select_fields':['id',_0x79f0('0xd'),_0x79f0('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x79f0('0x2a')](function(_0x6785bd){if(_0x6785bd[_0x79f0('0x2c')][_0x79f0('0x1c')]){var _0xeea842=_[_0x79f0('0x2b')](_0x6785bd['entry_list'],function(_0x25b939){return _0x25b939[_0x79f0('0x30')][_0x79f0('0x36')][_0x79f0('0x2d')]===_0x46ec4d;});if(_0xeea842){logger[_0x79f0('0xb')]('Enduser\x20found!');return BPromise[_0x79f0('0x2f')]({'id':_0xeea842['name_value_list']['id'][_0x79f0('0x2d')],'name':_0xeea842['name_value_list'][_0x79f0('0xd')][_0x79f0('0x2d')],'phone':_0xeea842[_0x79f0('0x30')][_0x79f0('0x36')][_0x79f0('0x2d')]});}}else{logger[_0x79f0('0xb')](_0x79f0('0x37'));return request({'form':{'method':_0x79f0('0x1f'),'input_type':'JSON','response_type':_0x79f0('0x20'),'rest_data':JSON[_0x79f0('0x21')]({'session':_0x5ea6c4['id'],'module_name':_0x79f0('0x1a'),'name_value_list':[{'name':_0x79f0('0x38'),'value':_0x2a11a8!==_0x79f0('0x39')?_0x2a11a8:util['format'](_0x79f0('0x3a'),_0x46ec4d)},{'name':'phone_home','value':_0x46ec4d}]})}})[_0x79f0('0x2a')](function(_0x2179e6){logger['info']('Enduser\x20created.');return BPromise[_0x79f0('0x2f')]({'id':_0x2179e6['id'],'name':_0x2179e6[_0x79f0('0x2c')][_0x79f0('0x38')]['value'],'phone':_0x2179e6[_0x79f0('0x2c')][_0x79f0('0x36')][_0x79f0('0x2d')]});});}});}function request(_0x2fcb83){logger[_0x79f0('0x3b')](_0x79f0('0x3c'),JSON[_0x79f0('0x21')](_0x2fcb83));return rp(_[_0x79f0('0x3d')](def,_0x2fcb83));}function getTags(_0x58508b,_0x3170f7){var _0x3b08f1=[];if(_0x58508b&&_0x58508b[_0x79f0('0x1c')]>0x0){_0x3b08f1=_[_0x79f0('0x3e')](_0x58508b,_0x3170f7);}return _0x3b08f1;}function getCustomFields(_0x223cfc,_0x5e87ca){var _0x75211b=[];var _0x2daa1c={'custom_fields':[]};if(_0x223cfc[_0x79f0('0x1c')]>0x0){_[_0x79f0('0x3f')](_0x223cfc,function(_0x17c6d2){if(_0x17c6d2[_0x79f0('0x40')]===_0x79f0('0x41')&&_0x17c6d2[_0x79f0('0x42')]&&!_0x17c6d2[_0x79f0('0x43')]){_0x2daa1c[_0x17c6d2[_0x79f0('0x42')][_0x79f0('0x44')]()]=_0x17c6d2[_0x79f0('0x45')]['toString']();}else if(_0x17c6d2['type']==='string'&&_0x17c6d2['idField']&&_0x17c6d2['customField']){_0x2daa1c[_0x79f0('0x46')][_0x79f0('0x1e')]({'id':_0x17c6d2['idField'],'value':_0x17c6d2[_0x79f0('0x45')][_0x79f0('0x24')]()});}else if(_0x17c6d2[_0x79f0('0x40')]===_0x79f0('0x47')&&_0x17c6d2[_0x79f0('0x1d')]&&_0x17c6d2[_0x79f0('0x48')]&&_0x17c6d2['customField']){_0x5e87ca[_0x17c6d2['variableName']]&&_0x2daa1c['custom_fields'][_0x79f0('0x1e')]({'id':_0x17c6d2['idField'],'value':_0x5e87ca[_0x17c6d2[_0x79f0('0x1d')]][_0x79f0('0x24')]()});}else if(_0x17c6d2[_0x79f0('0x40')]===_0x79f0('0x49')&&_0x17c6d2['Variable']&&_0x17c6d2[_0x79f0('0x4a')][_0x79f0('0xd')]&&_0x17c6d2['idField']&&_0x17c6d2[_0x79f0('0x43')]){_0x5e87ca[_0x17c6d2['Variable'][_0x79f0('0xd')]['toLowerCase']()]&&_0x2daa1c[_0x79f0('0x46')][_0x79f0('0x1e')]({'id':_0x17c6d2[_0x79f0('0x48')],'value':_0x5e87ca[_0x17c6d2[_0x79f0('0x4a')]['name']['toLowerCase']()][_0x79f0('0x24')]()});}});}return _0x2daa1c;}function getConnection(_0x5f4ba1){return request({'method':'POST','form':{'method':_0x79f0('0x4b'),'input_type':_0x79f0('0x20'),'response_type':_0x79f0('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5f4ba1[_0x79f0('0x4c')],'password':_0x5f4ba1[_0x79f0('0x4d')],'encryption':_0x79f0('0x4e')},'application':_0x79f0('0x4f')})}})['then'](function(_0x3b8552){var _0x5ed2ea=_0x3b8552;if(_0x5ed2ea['id']){def[_0x79f0('0x50')]=_0x5ed2ea['id'];return BPromise[_0x79f0('0x2f')](_0x5ed2ea);}else{throw new Error(util[_0x79f0('0x34')]('Account\x20%d\x20is\x20not\x20valid',_0x5f4ba1['id']));}});}function setRelationship(_0x1c5e1b,_0x3f59dc,_0x337999,_0x24c671){return request({'form':{'method':_0x79f0('0x51'),'input_type':_0x79f0('0x20'),'response_type':_0x79f0('0x20'),'rest_data':JSON[_0x79f0('0x21')]({'session':_0x1c5e1b['id'],'module_name':_0x79f0('0x22'),'module_id':_0x337999['id'],'link_field_name':_0x24c671,'related_ids':[_0x3f59dc['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x79f0('0x52')]=function(_0x2dcca1,_0x3d1be7,_0x5d6122,_0x34b863,_0x1dcf35,_0xa2eeab){var _0x487fe6,_0x72103c,_0x592f7e,_0x2d78d8;_0xa2eeab[_0x79f0('0x53')]=intUtil[_0x79f0('0x54')](_0xa2eeab[_0x79f0('0x53')]);_0xa2eeab[_0x79f0('0x55')]=intUtil[_0x79f0('0x54')](_0xa2eeab['serverUrl']);def[_0x79f0('0x56')]=util[_0x79f0('0x34')](_0x79f0('0x57'),_0xa2eeab['remoteUri']);if(_0x1dcf35&&_0x1dcf35[_0x79f0('0x58')]){logger[_0x79f0('0xb')](_0x79f0('0x59'),'Recording\x20is\x20enabled!');_0x3d1be7[_0x79f0('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa2eeab[_0x79f0('0x55')],_0x3d1be7['uniqueid'],md5(_0x3d1be7[_0x79f0('0x5b')]));}else{_0x3d1be7[_0x79f0('0x5a')]='';}return getConnection(_0xa2eeab)[_0x79f0('0x2a')](function(_0x2c3b04){_0x2d78d8=_0x2c3b04;return getUser(_0xa2eeab,_0x34b863[_0x79f0('0xd')],_0x2d78d8);})['then'](function(_0x1f0d7f){_0x487fe6=_0x1f0d7f;logger[_0x79f0('0xb')](_0x79f0('0x5c'),_0x487fe6['id']);return getEndUser(_0xa2eeab,_0x3d1be7['calleridname'],_0x3d1be7['calleridnum'],_0x2d78d8);})[_0x79f0('0x2a')](function(_0x3ef7d5){_0x72103c=_0x3ef7d5;logger[_0x79f0('0xb')](_0x79f0('0x5d'),_0x72103c['id']);return getTicket(_0xa2eeab,_0x487fe6,_0x72103c,_0x5d6122,_0x3d1be7,_0x5d6122[_0x79f0('0x5e')],_0x2d78d8,'Inbound');})[_0x79f0('0x2a')](function(_0x4b8eee){_0x592f7e=_0x4b8eee;logger[_0x79f0('0xb')]('Ticket\x20created!');logger[_0x79f0('0xb')]('The\x20Ticket\x20ID\x20is:',_0x592f7e['id']);return setRelationship(_0x2d78d8,_0x487fe6,_0x592f7e,_0x79f0('0x5f'));})[_0x79f0('0x2a')](function(){return setRelationship(_0x2d78d8,_0x72103c,_0x592f7e,_0x79f0('0x60'));})['then'](function(){return getServerInfo(_0x2d78d8);})[_0x79f0('0x2a')](function(_0x1a022f){var _0x133d39=parseInt(_0x1a022f[_0x79f0('0x61')][_0x79f0('0x62')](0x0));var _0x21d951=util[_0x79f0('0x34')](_0x79f0('0x63'),_0xa2eeab['remoteUri'],_0x592f7e['id']);if(_0x133d39>0x6){_0x21d951=util[_0x79f0('0x34')](_0x79f0('0x64'),_0xa2eeab[_0x79f0('0x53')],_0x592f7e['id']);}logger[_0x79f0('0xb')](_0x79f0('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x79f0('0x34')](_0x79f0('0x65'),_0x34b863[_0x79f0('0xd')]),_0x79f0('0x66'),{'uri':_0x21d951});})[_0x79f0('0x67')](function(_0x47c303){logger[_0x79f0('0x68')](_0x79f0('0x59'),JSON[_0x79f0('0x21')](_0x47c303));});};exports['outbound']=function(_0xd5b1c,_0x897f30,_0x4430cb,_0x34e029,_0x12b204,_0x205a2b,_0x4cc1fe){var _0x290355,_0x37042f,_0x4b2031,_0x27a98e;_0x205a2b[_0x79f0('0x53')]=intUtil[_0x79f0('0x54')](_0x205a2b[_0x79f0('0x53')]);_0x205a2b[_0x79f0('0x55')]=intUtil['stripTrailingSlash'](_0x205a2b[_0x79f0('0x55')]);def[_0x79f0('0x56')]=util[_0x79f0('0x34')](_0x79f0('0x57'),_0x205a2b[_0x79f0('0x53')]);if(_0x4cc1fe&&_0x4cc1fe[_0x79f0('0x69')]&&_0x4cc1fe[_0x79f0('0x69')]!==_0x79f0('0x6a')){logger[_0x79f0('0xb')](_0x79f0('0x6b'),_0x79f0('0x6c'));_0x897f30[_0x79f0('0x5a')]=util[_0x79f0('0x34')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x205a2b[_0x79f0('0x55')],_0x897f30[_0x79f0('0x5b')],md5(_0x897f30['uniqueid']));}return getConnection(_0x205a2b)[_0x79f0('0x2a')](function(_0x1277f5){_0x27a98e=_0x1277f5;return getUser(_0x205a2b,_0x34e029['name'],_0x27a98e);})[_0x79f0('0x2a')](function(_0x241c1f){_0x290355=_0x241c1f;logger[_0x79f0('0xb')](_0x79f0('0x5c'),_0x290355['id']);return getEndUser(_0x205a2b,_0x897f30['destcalleridname'],_0x897f30[_0x79f0('0x6d')],_0x27a98e);})['then'](function(_0x19b972){_0x37042f=_0x19b972;logger[_0x79f0('0xb')](_0x79f0('0x5d'),_0x37042f['id']);return getTicket(_0x205a2b,_0x290355,_0x37042f,_0x4430cb,_0x897f30,_0x4430cb[_0x79f0('0x5e')],_0x27a98e,_0x79f0('0x6e'));})['then'](function(_0x58b496){_0x4b2031=_0x58b496;logger['info'](_0x79f0('0x6f'));logger[_0x79f0('0xb')](_0x79f0('0x70'),_0x4b2031['id']);return setRelationship(_0x27a98e,_0x290355,_0x4b2031,_0x79f0('0x5f'));})[_0x79f0('0x2a')](function(){return setRelationship(_0x27a98e,_0x37042f,_0x4b2031,'contacts');})[_0x79f0('0x2a')](function(){return getServerInfo(_0x27a98e);})[_0x79f0('0x2a')](function(_0x37fe6a){var _0x4ff468=parseInt(_0x37fe6a[_0x79f0('0x61')]['charAt'](0x0));var _0x177649=util[_0x79f0('0x34')](_0x79f0('0x63'),_0x205a2b[_0x79f0('0x53')],_0x4b2031['id']);if(_0x4ff468>0x6){_0x177649=util[_0x79f0('0x34')](_0x79f0('0x64'),_0x205a2b['remoteUri'],_0x4b2031['id']);}logger[_0x79f0('0xb')](_0x79f0('0x6b'),_0x79f0('0x71'));emit(util['format'](_0x79f0('0x65'),_0x34e029[_0x79f0('0xd')]),'trigger:browser:url',{'uri':_0x177649});})['catch'](function(_0x3e4639){logger['error'](_0x79f0('0x6b'),JSON['stringify'](_0x3e4639));});};exports['unmanaged']=function(_0x545553,_0x45328f,_0x57d7f0,_0x16164f,_0xdea567,_0x5ee45f){var _0x51bfa8,_0x265c7b,_0x489a1a,_0x4b9ed5;_0x5ee45f[_0x79f0('0x53')]=intUtil['stripTrailingSlash'](_0x5ee45f['remoteUri']);_0x5ee45f[_0x79f0('0x55')]=intUtil[_0x79f0('0x54')](_0x5ee45f[_0x79f0('0x55')]);def['uri']=util[_0x79f0('0x34')](_0x79f0('0x57'),_0x5ee45f[_0x79f0('0x53')]);if(_0xdea567&&_0xdea567[_0x79f0('0x58')]){logger[_0x79f0('0xb')]('['+_0x45328f['lastevent']['toUpperCase']()+']',_0x79f0('0x6c'));_0x45328f['recordingURL']=util[_0x79f0('0x34')](_0x79f0('0x72'),_0x5ee45f[_0x79f0('0x55')],_0x45328f['uniqueid'],md5(_0x45328f[_0x79f0('0x5b')]));}else{_0x45328f['recordingURL']='';}return getConnection(_0x5ee45f)[_0x79f0('0x2a')](function(_0x523311){_0x4b9ed5=_0x523311;if(!_[_0x79f0('0x73')](_0x16164f)){return getUser(_0x5ee45f,_0x16164f[_0x79f0('0xd')],_0x4b9ed5);}else{return getUser(_0x5ee45f,null,_0x4b9ed5);}})[_0x79f0('0x2a')](function(_0x5d31c1){_0x51bfa8=_0x5d31c1;logger['info'](_0x79f0('0x5c'),_0x51bfa8['id']);return getEndUser(_0x5ee45f,_0x45328f[_0x79f0('0x74')],_0x45328f[_0x79f0('0x75')],_0x4b9ed5);})[_0x79f0('0x2a')](function(_0x50d1fb){_0x265c7b=_0x50d1fb;logger[_0x79f0('0xb')](_0x79f0('0x5d'),_0x265c7b['id']);return getTicket(_0x5ee45f,_0x51bfa8,_0x265c7b,_0x57d7f0,_0x45328f,_0x57d7f0[_0x79f0('0x5e')],_0x4b9ed5,_0x79f0('0x76'));})['then'](function(_0x386fb6){_0x489a1a=_0x386fb6;logger[_0x79f0('0xb')](_0x79f0('0x6f'));logger[_0x79f0('0xb')](_0x79f0('0x70'),_0x489a1a['id']);return setRelationship(_0x4b9ed5,_0x51bfa8,_0x489a1a,'users');})[_0x79f0('0x2a')](function(){return setRelationship(_0x4b9ed5,_0x265c7b,_0x489a1a,'contacts');})['then'](function(){return getServerInfo(_0x4b9ed5);})[_0x79f0('0x67')](function(_0x22ebd4){logger['error']('['+_0x45328f[_0x79f0('0x77')][_0x79f0('0x78')]()+']',JSON[_0x79f0('0x21')](_0x22ebd4));});}; \ 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 9f84969..259dc1e 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 _0x3c99=['push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','variable','%s:\x20%s','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','util','getString','length','sortBy','type','string','content','variableName'];(function(_0x1939e0,_0x552adc){var _0x19ff37=function(_0xbb4df){while(--_0xbb4df){_0x1939e0['push'](_0x1939e0['shift']());}};_0x19ff37(++_0x552adc);}(_0x3c99,0xa0));var _0x93c9=function(_0x39feee,_0x7f34eb){_0x39feee=_0x39feee-0x0;var _0x5076e7=_0x3c99[_0x39feee];return _0x5076e7;};'use strict';var _=require('lodash');var util=require(_0x93c9('0x0'));exports[_0x93c9('0x1')]=function(_0x4f1971,_0xb35b83,_0x358e23){var _0x3c77a8=[];if(_0x4f1971[_0x93c9('0x2')]>0x0){var _0x4589fe=_[_0x93c9('0x3')](_0x4f1971,['id']);for(var _0x3a4cac=0x0;_0x3a4cac<_0x4589fe[_0x93c9('0x2')];_0x3a4cac++){var _0xc07574=_0x4589fe[_0x3a4cac];if(_0xc07574[_0x93c9('0x4')]===_0x93c9('0x5')){_0x3c77a8['push'](_0xc07574[_0x93c9('0x6')]);}else if(_0xc07574['type']==='variable'&&_0xc07574['variableName']){_0xb35b83[_0xc07574[_0x93c9('0x7')]]&&_0x3c77a8[_0x93c9('0x8')](_0xb35b83[_0xc07574[_0x93c9('0x7')]][_0x93c9('0x9')]());}else if(_0xc07574['type']===_0x93c9('0xa')&&_0xc07574['Variable']&&_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')]){_0xb35b83[_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')][_0x93c9('0xd')]()]&&_0x3c77a8[_0x93c9('0x8')](_0xb35b83[_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')]['toLowerCase']()][_0x93c9('0x9')]());}else if(_0xc07574['type']===_0x93c9('0xe')){if(_0xc07574[_0x93c9('0xf')]===_0x93c9('0x5')&&_0xc07574[_0x93c9('0x10')]){_0x3c77a8[_0x93c9('0x8')](util[_0x93c9('0x11')]('%s:\x20%s',_0xc07574[_0x93c9('0x10')],_0xc07574[_0x93c9('0x12')]));}else if(_0xc07574['keyType']===_0x93c9('0x13')&&_0xc07574[_0x93c9('0x7')]&&_0xc07574[_0x93c9('0x10')]){_0xb35b83[_0xc07574[_0x93c9('0x7')]]&&_0x3c77a8[_0x93c9('0x8')](util['format']('%s:\x20%s',_0xc07574[_0x93c9('0x10')],_0xb35b83[_0xc07574[_0x93c9('0x7')]]));}else if(_0xc07574[_0x93c9('0xf')]===_0x93c9('0xa')&&_0xc07574[_0x93c9('0xb')]&&_0xc07574[_0x93c9('0xb')]['name']&&_0xc07574[_0x93c9('0x10')]){_0xb35b83[_0xc07574['Variable'][_0x93c9('0xc')][_0x93c9('0xd')]()]&&_0x3c77a8[_0x93c9('0x8')](util[_0x93c9('0x11')](_0x93c9('0x14'),_0xc07574[_0x93c9('0x10')],_0xb35b83[_0xc07574[_0x93c9('0xb')][_0x93c9('0xc')][_0x93c9('0xd')]()]));}}}}return _0x3c77a8[_0x93c9('0x15')](_0x358e23);};exports[_0x93c9('0x16')]=function(_0x5df7ae){var _0x4331c6=_0x5df7ae[_0x93c9('0x17')](-0x1);if(_0x4331c6==='/'){_0x5df7ae=_0x5df7ae[_0x93c9('0x18')](0x0,_0x5df7ae['lastIndexOf'](_0x4331c6));}return _0x5df7ae;};exports[_0x93c9('0x19')]=function(_0x420052){if(!_[_0x93c9('0x1a')](_0x420052)&&_0x420052!==''){var _0x3aa585=/^(([^<>()\[\]\\.,;:\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 _0x3aa585[_0x93c9('0x1b')](String(_0x420052)[_0x93c9('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x6a06=['substring','lastIndexOf','validateEmail','lodash','getString','length','sortBy','string','content','type','variableName','push','customVariable','Variable','name','toLowerCase','keyValue','key','keyContent','keyType','format','%s:\x20%s','stripTrailingSlash'];(function(_0x1cc4b5,_0x3726c0){var _0x5e8b98=function(_0xd9c42){while(--_0xd9c42){_0x1cc4b5['push'](_0x1cc4b5['shift']());}};_0x5e8b98(++_0x3726c0);}(_0x6a06,0x173));var _0x66a0=function(_0x35d06a,_0x81abc0){_0x35d06a=_0x35d06a-0x0;var _0x3cf8a5=_0x6a06[_0x35d06a];return _0x3cf8a5;};'use strict';var _=require(_0x66a0('0x0'));var util=require('util');exports[_0x66a0('0x1')]=function(_0x44e3ab,_0x5adc3f,_0xb3e9cc){var _0x531581=[];if(_0x44e3ab[_0x66a0('0x2')]>0x0){var _0x5dacc4=_[_0x66a0('0x3')](_0x44e3ab,['id']);for(var _0x193365=0x0;_0x193365<_0x5dacc4['length'];_0x193365++){var _0x176d83=_0x5dacc4[_0x193365];if(_0x176d83['type']===_0x66a0('0x4')){_0x531581['push'](_0x176d83[_0x66a0('0x5')]);}else if(_0x176d83[_0x66a0('0x6')]==='variable'&&_0x176d83[_0x66a0('0x7')]){_0x5adc3f[_0x176d83[_0x66a0('0x7')]]&&_0x531581[_0x66a0('0x8')](_0x5adc3f[_0x176d83[_0x66a0('0x7')]]['toString']());}else if(_0x176d83[_0x66a0('0x6')]===_0x66a0('0x9')&&_0x176d83[_0x66a0('0xa')]&&_0x176d83['Variable'][_0x66a0('0xb')]){_0x5adc3f[_0x176d83[_0x66a0('0xa')][_0x66a0('0xb')][_0x66a0('0xc')]()]&&_0x531581[_0x66a0('0x8')](_0x5adc3f[_0x176d83[_0x66a0('0xa')][_0x66a0('0xb')]['toLowerCase']()]['toString']());}else if(_0x176d83[_0x66a0('0x6')]===_0x66a0('0xd')){if(_0x176d83['keyType']==='string'&&_0x176d83['key']){_0x531581[_0x66a0('0x8')](util['format']('%s:\x20%s',_0x176d83[_0x66a0('0xe')],_0x176d83[_0x66a0('0xf')]));}else if(_0x176d83[_0x66a0('0x10')]==='variable'&&_0x176d83[_0x66a0('0x7')]&&_0x176d83[_0x66a0('0xe')]){_0x5adc3f[_0x176d83['variableName']]&&_0x531581[_0x66a0('0x8')](util[_0x66a0('0x11')]('%s:\x20%s',_0x176d83[_0x66a0('0xe')],_0x5adc3f[_0x176d83[_0x66a0('0x7')]]));}else if(_0x176d83[_0x66a0('0x10')]==='customVariable'&&_0x176d83['Variable']&&_0x176d83[_0x66a0('0xa')][_0x66a0('0xb')]&&_0x176d83[_0x66a0('0xe')]){_0x5adc3f[_0x176d83['Variable']['name'][_0x66a0('0xc')]()]&&_0x531581[_0x66a0('0x8')](util['format'](_0x66a0('0x12'),_0x176d83[_0x66a0('0xe')],_0x5adc3f[_0x176d83['Variable']['name'][_0x66a0('0xc')]()]));}}}}return _0x531581['join'](_0xb3e9cc);};exports[_0x66a0('0x13')]=function(_0x2f0067){var _0x3097c7=_0x2f0067['slice'](-0x1);if(_0x3097c7==='/'){_0x2f0067=_0x2f0067[_0x66a0('0x14')](0x0,_0x2f0067[_0x66a0('0x15')](_0x3097c7));}return _0x2f0067;};exports[_0x66a0('0x16')]=function(_0x5962bc){if(!_['isNil'](_0x5962bc)&&_0x5962bc!==''){var _0x8ad44b=/^(([^<>()\[\]\\.,;:\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 _0x8ad44b['test'](String(_0x5962bc)[_0x66a0('0xc')]());}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 480f6b0..f345451 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x31bf07,_0x283387){var _0x59c9ab=function(_0xe944fd){while(--_0xe944fd){_0x31bf07['push'](_0x31bf07['shift']());}};_0x59c9ab(++_0x283387);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 2b6475b..4768dea 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 _0x4994=['%s/token:%s','Basic\x20%s','base64','debug','stringify','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','push','idField','variable','variableName','custom_fields','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','Authorization','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','%s/search.json','then','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token'];(function(_0xfcfc6,_0x14899c){var _0x32fdd6=function(_0x5a1efb){while(--_0x5a1efb){_0xfcfc6['push'](_0xfcfc6['shift']());}};_0x32fdd6(++_0x14899c);}(_0x4994,0xb1));var _0x4499=function(_0x56d0a5,_0x475130){_0x56d0a5=_0x56d0a5-0x0;var _0xfa01b4=_0x4994[_0x56d0a5];return _0xfa01b4;};'use strict';var _=require(_0x4499('0x0'));var rp=require(_0x4499('0x1'));var md5=require(_0x4499('0x2'));var util=require(_0x4499('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4499('0x4'));var config=require(_0x4499('0x5'));var logger=require(_0x4499('0x6'))(_0x4499('0x7'));config[_0x4499('0x8')]=_[_0x4499('0x9')](config[_0x4499('0x8')],{'host':_0x4499('0xa'),'port':0x18eb});var io=require(_0x4499('0xb'))(new Redis(config[_0x4499('0x8')]));function emit(_0xe547da,_0x5f12ce,_0x201b4b){io['to'](_0xe547da)[_0x4499('0xc')](_0x5f12ce,_0x201b4b);}var headers={'Content-Type':_0x4499('0xd'),'Accept':'application/json'};function getTicket(_0x29d146,_0x51a2e4,_0x4fec69,_0x1791ed,_0x5c6fbf){logger[_0x4499('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x4499('0xf')](_0x4499('0x10'),_0x29d146[_0x4499('0x11')]),'method':_0x4499('0x12'),'body':{'ticket':_[_0x4499('0x13')]({'requester_id':_0x4fec69['id'],'submitter_id':_0x51a2e4?_0x51a2e4['id']:undefined,'assignee_id':_0x51a2e4?_0x51a2e4['id']:undefined,'tags':getTags(_0x1791ed[_0x4499('0x14')],_0x4499('0x15')),'subject':intUtil[_0x4499('0x16')](_0x1791ed[_0x4499('0x17')],_0x5c6fbf,'\x20'),'description':intUtil[_0x4499('0x16')](_0x1791ed['Descriptions'],_0x5c6fbf,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4499('0x16')](_0x1791ed[_0x4499('0x18')],_0x5c6fbf,'\x0a')}},getCustomFields(_0x1791ed[_0x4499('0x19')],_0x5c6fbf))}})['then'](function(_0x1b775e){logger[_0x4499('0xe')](_0x4499('0x1a'));return _0x1b775e[_0x4499('0x1b')];});}function getUser(_0x2c9ff5,_0xc4829d){if(intUtil[_0x4499('0x1c')](_0xc4829d)){logger[_0x4499('0xe')]('Getting\x20agent\x20with\x20email',_0xc4829d);return request({'uri':util[_0x4499('0xf')](_0x4499('0x1d'),_0x2c9ff5['remoteUri']),'qs':{'query':util[_0x4499('0xf')]('type:user\x20role:agent\x20email:%s',_0xc4829d)}})[_0x4499('0x1e')](function(_0x5218c8){if(_0x5218c8['count']){logger['info']('Agent\x20found!');return _[_0x4499('0x1f')](_0x5218c8[_0x4499('0x20')],{'email':_0xc4829d,'role':_0x4499('0x21')});}else{logger[_0x4499('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4499('0xf')](_0x4499('0x22'),_0x2c9ff5[_0x4499('0x11')])})['then'](function(_0x3b61e4){logger[_0x4499('0xe')]('Admin\x20account\x20selected.');return _0x3b61e4[_0x4499('0x23')];});}});}else{logger['info'](_0x4499('0x24'));return request({'uri':util[_0x4499('0xf')](_0x4499('0x22'),_0x2c9ff5[_0x4499('0x11')])})[_0x4499('0x1e')](function(_0x3cfc6d){logger[_0x4499('0xe')](_0x4499('0x25'));return _0x3cfc6d[_0x4499('0x23')];});}}function getEndUser(_0x474bc8,_0x2373fb,_0x18691f){logger[_0x4499('0xe')](_0x4499('0x26'),_0x18691f);return request({'uri':util[_0x4499('0xf')](_0x4499('0x1d'),_0x474bc8[_0x4499('0x11')]),'qs':{'query':util[_0x4499('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x18691f)}})[_0x4499('0x1e')](function(_0x55734d){var _0x3d7881;if(_0x55734d[_0x4499('0x20')][_0x4499('0x27')]){_0x55734d[_0x4499('0x20')]=_[_0x4499('0x28')](_0x55734d[_0x4499('0x20')],{'suspended':![],'role':_0x4499('0x29')});if(_0x55734d['results']['length']){_0x3d7881=_[_0x4499('0x2a')](_0x55734d[_0x4499('0x20')]);}}if(_0x3d7881){logger[_0x4499('0xe')](_0x4499('0x2b'));return _0x3d7881;}else{logger['info'](_0x4499('0x2c'));return request({'uri':util[_0x4499('0xf')](_0x4499('0x2d'),_0x474bc8[_0x4499('0x11')]),'method':_0x4499('0x12'),'body':{'user':{'role':_0x4499('0x29'),'name':util[_0x4499('0xf')](_0x4499('0x2e'),_0x2373fb||_0x18691f),'phone':_0x18691f}}})['then'](function(_0x7b6e6b){logger['info'](_0x4499('0x2f'));return _0x7b6e6b[_0x4499('0x23')];});}});}function getAuth(_0x5498e3){var _0x1a2f34;if(_0x5498e3[_0x4499('0x30')]==='password'){_0x1a2f34=util[_0x4499('0xf')](_0x4499('0x31'),_0x5498e3[_0x4499('0x32')],_0x5498e3[_0x4499('0x33')]);}else if(_0x5498e3[_0x4499('0x30')]===_0x4499('0x34')){_0x1a2f34=util[_0x4499('0xf')](_0x4499('0x35'),_0x5498e3[_0x4499('0x32')],_0x5498e3[_0x4499('0x34')]);}return util['format'](_0x4499('0x36'),new Buffer(_0x1a2f34)['toString'](_0x4499('0x37')));}function request(_0x5d1ee2){logger[_0x4499('0x38')]('[HTTP]',JSON[_0x4499('0x39')](_0x5d1ee2));return rp(_['defaults'](_0x5d1ee2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4e8d37,_0x45b627){var _0x1fdc61=[];if(_0x4e8d37&&_0x4e8d37[_0x4499('0x27')]>0x0){_0x1fdc61=_['map'](_0x4e8d37,_0x45b627);}return _0x1fdc61;}function getCustomFields(_0x3461fc,_0x33d398){var _0x1b0106=[];var _0x5d8176={'custom_fields':[]};if(_0x3461fc[_0x4499('0x27')]>0x0){_[_0x4499('0x3a')](_0x3461fc,function(_0x356751){if(_[_0x4499('0x3b')]([_0x4499('0x3c'),_0x4499('0x3d')],_0x356751[_0x4499('0x3e')])&&_0x356751[_0x4499('0x3f')]&&!_0x356751[_0x4499('0x40')]){_0x5d8176[_0x356751[_0x4499('0x3f')][_0x4499('0x41')]()]=_0x356751[_0x4499('0x42')][_0x4499('0x43')]();}else if(_[_0x4499('0x3b')](['string','picklist'],_0x356751['type'])&&_0x356751['idField']&&_0x356751[_0x4499('0x40')]){_0x5d8176['custom_fields'][_0x4499('0x44')]({'id':_0x356751[_0x4499('0x45')],'value':_0x356751[_0x4499('0x42')][_0x4499('0x43')]()});}else if(_0x356751[_0x4499('0x3e')]===_0x4499('0x46')&&_0x356751[_0x4499('0x47')]&&_0x356751[_0x4499('0x45')]&&_0x356751[_0x4499('0x40')]){_0x33d398[_0x356751['variableName']]&&_0x5d8176[_0x4499('0x48')][_0x4499('0x44')]({'id':_0x356751['idField'],'value':_0x33d398[_0x356751[_0x4499('0x47')]][_0x4499('0x43')]()});}else if(_0x356751[_0x4499('0x3e')]===_0x4499('0x49')&&_0x356751[_0x4499('0x4a')]&&_0x356751[_0x4499('0x4a')][_0x4499('0x15')]&&_0x356751['idField']&&_0x356751[_0x4499('0x40')]){_0x33d398[_0x356751[_0x4499('0x4a')]['name'][_0x4499('0x41')]()]&&_0x5d8176[_0x4499('0x48')][_0x4499('0x44')]({'id':_0x356751[_0x4499('0x45')],'value':_0x33d398[_0x356751[_0x4499('0x4a')][_0x4499('0x15')][_0x4499('0x41')]()][_0x4499('0x43')]()});}});}return _0x5d8176;}exports[_0x4499('0x4b')]=function(_0xcf7d89,_0x2e620f,_0x33550d,_0x368b1c,_0x18af95,_0x56bc1a){var _0x16fc05,_0x4815e7;_0x56bc1a[_0x4499('0x11')]=intUtil['stripTrailingSlash'](_0x56bc1a['remoteUri']);_0x56bc1a[_0x4499('0x4c')]=intUtil[_0x4499('0x4d')](_0x56bc1a[_0x4499('0x4c')]);if(_0x18af95&&_0x18af95[_0x4499('0x4e')]){logger['info'](_0x4499('0x4f'),_0x4499('0x50'));_0x2e620f[_0x4499('0x51')]=util[_0x4499('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56bc1a[_0x4499('0x4c')],_0x2e620f[_0x4499('0x52')],md5(_0x2e620f[_0x4499('0x52')]));}else{_0x2e620f['recordingURL']='';}headers['Authorization']=getAuth(_0x56bc1a);return getUser(_0x56bc1a,_0x368b1c[_0x4499('0x53')])['then'](function(_0x1f44ab){_0x16fc05=_0x1f44ab;logger['info']('The\x20User\x20ID\x20is:',_0x16fc05['id']);return getEndUser(_0x56bc1a,_0x2e620f[_0x4499('0x54')],_0x2e620f[_0x4499('0x55')]);})[_0x4499('0x1e')](function(_0x57df14){_0x4815e7=_0x57df14;logger[_0x4499('0xe')](_0x4499('0x56'),_0x4815e7['id']);return getTicket(_0x56bc1a,_0x16fc05,_0x4815e7,_0x33550d,_0x2e620f);})['then'](function(_0x8ace0c){if(_0x8ace0c){logger[_0x4499('0xe')](_0x4499('0x57'),_0x8ace0c['id']);switch(_0x56bc1a['type']){case _0x4499('0x58'):logger[_0x4499('0xe')](_0x4499('0x4f'),_0x4499('0x59'));return request({'uri':util['format'](_0x4499('0x5a'),_0x56bc1a[_0x4499('0x11')],_0x16fc05['id'],_0x8ace0c['id']),'method':_0x4499('0x12')});case'newTab':logger[_0x4499('0xe')](_0x4499('0x4f'),_0x4499('0x5b'));emit(util[_0x4499('0xf')](_0x4499('0x5c'),_0x368b1c[_0x4499('0x15')]),'trigger:browser:url',{'uri':util[_0x4499('0xf')]('%s/agent/tickets/%s',_0x56bc1a[_0x4499('0x11')]['replace'](_0x4499('0x5d'),''),_0x8ace0c['id'])});break;default:logger[_0x4499('0x5e')](_0x4499('0x4f'),_0x4499('0x5f'));}}})[_0x4499('0x60')](function(_0x21f997){logger[_0x4499('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x21f997,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1eb036,_0x37ac75,_0x22a662,_0x137f1e,_0x2e7f41,_0x5e147b,_0x3195d5){var _0x516475,_0x44927e;_0x5e147b[_0x4499('0x11')]=intUtil[_0x4499('0x4d')](_0x5e147b[_0x4499('0x11')]);_0x5e147b[_0x4499('0x4c')]=intUtil[_0x4499('0x4d')](_0x5e147b[_0x4499('0x4c')]);if(_0x3195d5&&_0x3195d5[_0x4499('0x61')]&&_0x3195d5[_0x4499('0x61')]!==_0x4499('0x62')){logger[_0x4499('0xe')](_0x4499('0x63'),_0x4499('0x50'));_0x37ac75['recordingURL']=util['format'](_0x4499('0x64'),_0x5e147b[_0x4499('0x4c')],_0x37ac75[_0x4499('0x52')],md5(_0x37ac75[_0x4499('0x52')]));}headers['Authorization']=getAuth(_0x5e147b);return getUser(_0x5e147b,_0x137f1e[_0x4499('0x53')])[_0x4499('0x1e')](function(_0x59559d){_0x516475=_0x59559d;logger['info'](_0x4499('0x65'),_0x516475['id']);return getEndUser(_0x5e147b,_0x37ac75[_0x4499('0x66')],_0x37ac75[_0x4499('0x67')]);})[_0x4499('0x1e')](function(_0x36a8f8){_0x44927e=_0x36a8f8;logger[_0x4499('0xe')]('The\x20Enduser\x20ID\x20is:',_0x44927e['id']);return getTicket(_0x5e147b,_0x516475,_0x44927e,_0x22a662,_0x37ac75);})[_0x4499('0x1e')](function(_0x3c94b1){if(_0x3c94b1){logger['info'](_0x4499('0x57'),_0x3c94b1['id']);switch(_0x5e147b[_0x4499('0x3e')]){case _0x4499('0x58'):logger[_0x4499('0xe')](_0x4499('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4499('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5e147b[_0x4499('0x11')],_0x516475['id'],_0x3c94b1['id']),'method':_0x4499('0x12')});case _0x4499('0x68'):logger[_0x4499('0xe')](_0x4499('0x63'),_0x4499('0x5b'));emit(util['format'](_0x4499('0x5c'),_0x137f1e[_0x4499('0x15')]),_0x4499('0x69'),{'uri':util['format'](_0x4499('0x6a'),_0x5e147b['remoteUri'][_0x4499('0x6b')](_0x4499('0x5d'),''),_0x3c94b1['id'])});break;default:logger['error'](_0x4499('0x63'),_0x4499('0x5f'));}}})[_0x4499('0x60')](function(_0x30523a){logger[_0x4499('0x5e')](_0x4499('0x6c'),util[_0x4499('0x6d')](_0x30523a,{'showHidden':!![],'depth':null}));});};exports[_0x4499('0x6e')]=function(_0x3c372b,_0x573d64,_0x39441d,_0x64ad21,_0x18680f,_0x55b342){var _0x53f986,_0x2f5eba;_0x55b342[_0x4499('0x11')]=intUtil[_0x4499('0x4d')](_0x55b342['remoteUri']);_0x55b342[_0x4499('0x4c')]=intUtil[_0x4499('0x4d')](_0x55b342[_0x4499('0x4c')]);if(_0x18680f&&_0x18680f[_0x4499('0x4e')]){logger[_0x4499('0xe')]('['+_0x573d64[_0x4499('0x6f')][_0x4499('0x70')]()+']',_0x4499('0x50'));_0x573d64[_0x4499('0x51')]=util[_0x4499('0xf')](_0x4499('0x64'),_0x55b342[_0x4499('0x4c')],_0x573d64[_0x4499('0x52')],md5(_0x573d64['uniqueid']));}else{_0x573d64[_0x4499('0x51')]='';}headers[_0x4499('0x71')]=getAuth(_0x55b342);return getUser(_0x55b342)['then'](function(_0x2550f4){_0x53f986=_0x2550f4;logger[_0x4499('0xe')](_0x4499('0x65'),_0x53f986['id']);return getEndUser(_0x55b342,_0x573d64[_0x4499('0x54')],_0x573d64[_0x4499('0x55')]);})['then'](function(_0x46d163){_0x2f5eba=_0x46d163;logger[_0x4499('0xe')](_0x4499('0x56'),_0x2f5eba['id']);return getTicket(_0x55b342,_0x53f986,_0x2f5eba,_0x39441d,_0x573d64);})[_0x4499('0x1e')](function(_0x72ced6){if(_0x72ced6){logger[_0x4499('0xe')](_0x4499('0x57'),_0x72ced6['id']);}})[_0x4499('0x60')](function(_0x3befdd){logger[_0x4499('0x5e')]('['+_0x573d64['lastevent'][_0x4499('0x70')]()+']'+_0x4499('0x72'),util[_0x4499('0x6d')](_0x3befdd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x45b3=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','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','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','map','includes','picklist','type','nameField','content','string','push','variable','variableName','idField','customField','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0x45b3,0x161));var _0x345b=function(_0x8cdc3c,_0x10a3c8){_0x8cdc3c=_0x8cdc3c-0x0;var _0x401b4b=_0x45b3[_0x8cdc3c];return _0x401b4b;};'use strict';var _=require(_0x345b('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x345b('0x1'));var Redis=require('ioredis');var intUtil=require(_0x345b('0x2'));var config=require(_0x345b('0x3'));var logger=require(_0x345b('0x4'))('zendesk');config[_0x345b('0x5')]=_['defaults'](config['redis'],{'host':_0x345b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x345b('0x5')]));function emit(_0x13df4e,_0x233d5e,_0x4d0772){io['to'](_0x13df4e)['emit'](_0x233d5e,_0x4d0772);}var headers={'Content-Type':_0x345b('0x7'),'Accept':_0x345b('0x7')};function getTicket(_0x55f466,_0xd3a8a7,_0x39ee16,_0x175c1f,_0x2becad){logger[_0x345b('0x8')](_0x345b('0x9'));return request({'uri':util[_0x345b('0xa')]('%s/tickets.json',_0x55f466[_0x345b('0xb')]),'method':_0x345b('0xc'),'body':{'ticket':_[_0x345b('0xd')]({'requester_id':_0x39ee16['id'],'submitter_id':_0xd3a8a7?_0xd3a8a7['id']:undefined,'assignee_id':_0xd3a8a7?_0xd3a8a7['id']:undefined,'tags':getTags(_0x175c1f[_0x345b('0xe')],_0x345b('0xf')),'subject':intUtil[_0x345b('0x10')](_0x175c1f[_0x345b('0x11')],_0x2becad,'\x20'),'description':intUtil[_0x345b('0x10')](_0x175c1f['Descriptions'],_0x2becad,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x175c1f[_0x345b('0x12')],_0x2becad,'\x0a')}},getCustomFields(_0x175c1f[_0x345b('0x13')],_0x2becad))}})[_0x345b('0x14')](function(_0x1ca822){logger['info']('Ticket\x20created!');return _0x1ca822[_0x345b('0x15')];});}function getUser(_0x235628,_0x2d7bd3){if(intUtil[_0x345b('0x16')](_0x2d7bd3)){logger[_0x345b('0x8')](_0x345b('0x17'),_0x2d7bd3);return request({'uri':util[_0x345b('0xa')](_0x345b('0x18'),_0x235628[_0x345b('0xb')]),'qs':{'query':util[_0x345b('0xa')](_0x345b('0x19'),_0x2d7bd3)}})['then'](function(_0x434906){if(_0x434906['count']){logger['info'](_0x345b('0x1a'));return _['find'](_0x434906[_0x345b('0x1b')],{'email':_0x2d7bd3,'role':'agent'});}else{logger[_0x345b('0x8')](_0x345b('0x1c'));return request({'uri':util[_0x345b('0xa')](_0x345b('0x1d'),_0x235628['remoteUri'])})[_0x345b('0x14')](function(_0x541cab){logger[_0x345b('0x8')](_0x345b('0x1e'));return _0x541cab[_0x345b('0x1f')];});}});}else{logger[_0x345b('0x8')](_0x345b('0x1c'));return request({'uri':util[_0x345b('0xa')](_0x345b('0x1d'),_0x235628[_0x345b('0xb')])})['then'](function(_0x3dac94){logger[_0x345b('0x8')](_0x345b('0x1e'));return _0x3dac94[_0x345b('0x1f')];});}}function getEndUser(_0x3f3b7c,_0x5c9c40,_0x22e492){logger['info'](_0x345b('0x20'),_0x22e492);return request({'uri':util[_0x345b('0xa')](_0x345b('0x18'),_0x3f3b7c[_0x345b('0xb')]),'qs':{'query':util['format'](_0x345b('0x21'),_0x22e492)}})[_0x345b('0x14')](function(_0x4c959d){var _0x42e720;if(_0x4c959d['results'][_0x345b('0x22')]){_0x4c959d[_0x345b('0x1b')]=_[_0x345b('0x23')](_0x4c959d[_0x345b('0x1b')],{'suspended':![],'role':_0x345b('0x24')});if(_0x4c959d['results'][_0x345b('0x22')]){_0x42e720=_[_0x345b('0x25')](_0x4c959d[_0x345b('0x1b')]);}}if(_0x42e720){logger[_0x345b('0x8')]('Enduser\x20found!');return _0x42e720;}else{logger[_0x345b('0x8')](_0x345b('0x26'));return request({'uri':util['format'](_0x345b('0x27'),_0x3f3b7c[_0x345b('0xb')]),'method':_0x345b('0xc'),'body':{'user':{'role':'end-user','name':util['format'](_0x345b('0x28'),_0x5c9c40||_0x22e492),'phone':_0x22e492}}})[_0x345b('0x14')](function(_0x1c3753){logger[_0x345b('0x8')]('Enduser\x20created.');return _0x1c3753[_0x345b('0x1f')];});}});}function getAuth(_0x11ff9e){var _0x2386af;if(_0x11ff9e[_0x345b('0x29')]==='password'){_0x2386af=util[_0x345b('0xa')]('%s:%s',_0x11ff9e[_0x345b('0x2a')],_0x11ff9e[_0x345b('0x2b')]);}else if(_0x11ff9e[_0x345b('0x29')]===_0x345b('0x2c')){_0x2386af=util[_0x345b('0xa')](_0x345b('0x2d'),_0x11ff9e[_0x345b('0x2a')],_0x11ff9e['token']);}return util[_0x345b('0xa')](_0x345b('0x2e'),new Buffer(_0x2386af)[_0x345b('0x2f')](_0x345b('0x30')));}function request(_0x4ebc40){logger[_0x345b('0x31')]('[HTTP]',JSON[_0x345b('0x32')](_0x4ebc40));return rp(_[_0x345b('0x33')](_0x4ebc40,{'method':_0x345b('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5d9eff,_0x100c2c){var _0x15e6e8=[];if(_0x5d9eff&&_0x5d9eff['length']>0x0){_0x15e6e8=_[_0x345b('0x35')](_0x5d9eff,_0x100c2c);}return _0x15e6e8;}function getCustomFields(_0x31dce1,_0x5b5bb2){var _0x25edd7=[];var _0xe20e6f={'custom_fields':[]};if(_0x31dce1['length']>0x0){_['forEach'](_0x31dce1,function(_0x19a127){if(_[_0x345b('0x36')](['string',_0x345b('0x37')],_0x19a127[_0x345b('0x38')])&&_0x19a127[_0x345b('0x39')]&&!_0x19a127['customField']){_0xe20e6f[_0x19a127[_0x345b('0x39')]['toLowerCase']()]=_0x19a127[_0x345b('0x3a')][_0x345b('0x2f')]();}else if(_[_0x345b('0x36')]([_0x345b('0x3b'),_0x345b('0x37')],_0x19a127[_0x345b('0x38')])&&_0x19a127['idField']&&_0x19a127['customField']){_0xe20e6f['custom_fields'][_0x345b('0x3c')]({'id':_0x19a127['idField'],'value':_0x19a127['content'][_0x345b('0x2f')]()});}else if(_0x19a127['type']===_0x345b('0x3d')&&_0x19a127[_0x345b('0x3e')]&&_0x19a127[_0x345b('0x3f')]&&_0x19a127[_0x345b('0x40')]){_0x5b5bb2[_0x19a127['variableName']]&&_0xe20e6f[_0x345b('0x41')][_0x345b('0x3c')]({'id':_0x19a127[_0x345b('0x3f')],'value':_0x5b5bb2[_0x19a127[_0x345b('0x3e')]][_0x345b('0x2f')]()});}else if(_0x19a127[_0x345b('0x38')]===_0x345b('0x42')&&_0x19a127[_0x345b('0x43')]&&_0x19a127[_0x345b('0x43')][_0x345b('0xf')]&&_0x19a127['idField']&&_0x19a127[_0x345b('0x40')]){_0x5b5bb2[_0x19a127[_0x345b('0x43')][_0x345b('0xf')][_0x345b('0x44')]()]&&_0xe20e6f[_0x345b('0x41')][_0x345b('0x3c')]({'id':_0x19a127[_0x345b('0x3f')],'value':_0x5b5bb2[_0x19a127['Variable'][_0x345b('0xf')]['toLowerCase']()][_0x345b('0x2f')]()});}});}return _0xe20e6f;}exports[_0x345b('0x45')]=function(_0x493a3b,_0x1e2ead,_0x226480,_0x3d7187,_0xa8a4f4,_0x4b932b){var _0xc7e7a,_0x4e9b2a;_0x4b932b[_0x345b('0xb')]=intUtil[_0x345b('0x46')](_0x4b932b[_0x345b('0xb')]);_0x4b932b[_0x345b('0x47')]=intUtil['stripTrailingSlash'](_0x4b932b[_0x345b('0x47')]);if(_0xa8a4f4&&_0xa8a4f4['monitor_format']){logger[_0x345b('0x8')](_0x345b('0x48'),_0x345b('0x49'));_0x1e2ead[_0x345b('0x4a')]=util[_0x345b('0xa')](_0x345b('0x4b'),_0x4b932b[_0x345b('0x47')],_0x1e2ead[_0x345b('0x4c')],md5(_0x1e2ead[_0x345b('0x4c')]));}else{_0x1e2ead[_0x345b('0x4a')]='';}headers[_0x345b('0x4d')]=getAuth(_0x4b932b);return getUser(_0x4b932b,_0x3d7187['email'])['then'](function(_0xb05b8e){_0xc7e7a=_0xb05b8e;logger['info'](_0x345b('0x4e'),_0xc7e7a['id']);return getEndUser(_0x4b932b,_0x1e2ead[_0x345b('0x4f')],_0x1e2ead['calleridnum']);})[_0x345b('0x14')](function(_0x4874d9){_0x4e9b2a=_0x4874d9;logger[_0x345b('0x8')](_0x345b('0x50'),_0x4e9b2a['id']);return getTicket(_0x4b932b,_0xc7e7a,_0x4e9b2a,_0x226480,_0x1e2ead);})[_0x345b('0x14')](function(_0x585472){if(_0x585472){logger[_0x345b('0x8')](_0x345b('0x51'),_0x585472['id']);switch(_0x4b932b[_0x345b('0x38')]){case _0x345b('0x52'):logger['info'](_0x345b('0x48'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x345b('0xa')](_0x345b('0x53'),_0x4b932b[_0x345b('0xb')],_0xc7e7a['id'],_0x585472['id']),'method':'POST'});case _0x345b('0x54'):logger[_0x345b('0x8')](_0x345b('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x345b('0xa')]('user:%s',_0x3d7187[_0x345b('0xf')]),_0x345b('0x55'),{'uri':util['format'](_0x345b('0x56'),_0x4b932b[_0x345b('0xb')][_0x345b('0x57')](_0x345b('0x58'),''),_0x585472['id'])});break;default:logger[_0x345b('0x59')]('[QUEUE]',_0x345b('0x5a'));}}})[_0x345b('0x5b')](function(_0x453a34){logger['error'](_0x345b('0x5c'),util[_0x345b('0x5d')](_0x453a34,{'showHidden':!![],'depth':null}));});};exports[_0x345b('0x5e')]=function(_0x448ec7,_0x59d90d,_0x320743,_0x465423,_0xf154c1,_0x5df3ca,_0x15dea1){var _0x29f057,_0x677556;_0x5df3ca['remoteUri']=intUtil[_0x345b('0x46')](_0x5df3ca[_0x345b('0xb')]);_0x5df3ca['serverUrl']=intUtil[_0x345b('0x46')](_0x5df3ca[_0x345b('0x47')]);if(_0x15dea1&&_0x15dea1['recordingFormat']&&_0x15dea1[_0x345b('0x5f')]!=='none'){logger[_0x345b('0x8')](_0x345b('0x60'),_0x345b('0x49'));_0x59d90d[_0x345b('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5df3ca[_0x345b('0x47')],_0x59d90d['uniqueid'],md5(_0x59d90d[_0x345b('0x4c')]));}headers[_0x345b('0x4d')]=getAuth(_0x5df3ca);return getUser(_0x5df3ca,_0x465423[_0x345b('0x61')])[_0x345b('0x14')](function(_0x3e1024){_0x29f057=_0x3e1024;logger[_0x345b('0x8')](_0x345b('0x4e'),_0x29f057['id']);return getEndUser(_0x5df3ca,_0x59d90d[_0x345b('0x62')],_0x59d90d[_0x345b('0x63')]);})[_0x345b('0x14')](function(_0x96d830){_0x677556=_0x96d830;logger['info']('The\x20Enduser\x20ID\x20is:',_0x677556['id']);return getTicket(_0x5df3ca,_0x29f057,_0x677556,_0x320743,_0x59d90d);})[_0x345b('0x14')](function(_0x24f9cb){if(_0x24f9cb){logger['info'](_0x345b('0x51'),_0x24f9cb['id']);switch(_0x5df3ca[_0x345b('0x38')]){case _0x345b('0x52'):logger[_0x345b('0x8')](_0x345b('0x60'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x345b('0x53'),_0x5df3ca[_0x345b('0xb')],_0x29f057['id'],_0x24f9cb['id']),'method':_0x345b('0xc')});case _0x345b('0x54'):logger[_0x345b('0x8')](_0x345b('0x60'),_0x345b('0x64'));emit(util[_0x345b('0xa')](_0x345b('0x65'),_0x465423[_0x345b('0xf')]),_0x345b('0x55'),{'uri':util[_0x345b('0xa')]('%s/agent/tickets/%s',_0x5df3ca[_0x345b('0xb')][_0x345b('0x57')](_0x345b('0x58'),''),_0x24f9cb['id'])});break;default:logger[_0x345b('0x59')](_0x345b('0x60'),_0x345b('0x5a'));}}})['catch'](function(_0x4f1f50){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4f1f50,{'showHidden':!![],'depth':null}));});};exports[_0x345b('0x66')]=function(_0x1d6ad0,_0x10df59,_0x323bfb,_0x5e2fb9,_0x4aa94e,_0x37cdbe){var _0x3267c5,_0x9bcd89;_0x37cdbe[_0x345b('0xb')]=intUtil[_0x345b('0x46')](_0x37cdbe['remoteUri']);_0x37cdbe['serverUrl']=intUtil['stripTrailingSlash'](_0x37cdbe[_0x345b('0x47')]);if(_0x4aa94e&&_0x4aa94e[_0x345b('0x67')]){logger['info']('['+_0x10df59[_0x345b('0x68')][_0x345b('0x69')]()+']',_0x345b('0x49'));_0x10df59[_0x345b('0x4a')]=util[_0x345b('0xa')](_0x345b('0x4b'),_0x37cdbe['serverUrl'],_0x10df59['uniqueid'],md5(_0x10df59[_0x345b('0x4c')]));}else{_0x10df59[_0x345b('0x4a')]='';}headers['Authorization']=getAuth(_0x37cdbe);return getUser(_0x37cdbe)[_0x345b('0x14')](function(_0x3f9cdc){_0x3267c5=_0x3f9cdc;logger[_0x345b('0x8')](_0x345b('0x4e'),_0x3267c5['id']);return getEndUser(_0x37cdbe,_0x10df59[_0x345b('0x4f')],_0x10df59[_0x345b('0x6a')]);})['then'](function(_0x5dc254){_0x9bcd89=_0x5dc254;logger[_0x345b('0x8')]('The\x20Enduser\x20ID\x20is:',_0x9bcd89['id']);return getTicket(_0x37cdbe,_0x3267c5,_0x9bcd89,_0x323bfb,_0x10df59);})['then'](function(_0x3402d7){if(_0x3402d7){logger['info'](_0x345b('0x51'),_0x3402d7['id']);}})[_0x345b('0x5b')](function(_0x1e298f){logger[_0x345b('0x59')]('['+_0x10df59[_0x345b('0x68')][_0x345b('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x345b('0x5d')](_0x1e298f,{'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 4ab93c0..2fa159e 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 _0x7da8=['none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','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','findIndex','email','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','enduserType','log','CREATE\x20ERROR','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Owner','administrator','getString','Subjects','Description','Who_Id','First_Name','What_Id','Full_Name','Last_Name','$se_module','talktime','Call_Duration','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','Call_Result','complete','connect','Answered','rejected','abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat'];(function(_0x1900fe,_0x4b52f0){var _0x6b6776=function(_0x161ec4){while(--_0x161ec4){_0x1900fe['push'](_0x1900fe['shift']());}};_0x6b6776(++_0x4b52f0);}(_0x7da8,0xa6));var _0x87da=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7da8[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x87da('0x0'));var rp=require(_0x87da('0x1'));var md5=require(_0x87da('0x2'));var util=require(_0x87da('0x3'));var intUtil=require(_0x87da('0x4'));var moment=require(_0x87da('0x5'));var Redis=require(_0x87da('0x6'));var BPromise=require(_0x87da('0x7'));var config=require('../../../../config/environment');var logger=require(_0x87da('0x8'))(_0x87da('0x9'));config[_0x87da('0xa')]=_[_0x87da('0xb')](config['redis'],{'host':_0x87da('0xc'),'port':0x18eb});var io=require(_0x87da('0xd'))(new Redis(config['redis']));function emit(_0x13df28,_0x114ad3,_0x53fa8c){io['to'](_0x13df28)[_0x87da('0xe')](_0x114ad3,_0x53fa8c);}function request(_0x4cb8ba){logger[_0x87da('0xf')](_0x87da('0x10'),JSON[_0x87da('0x11')](_0x4cb8ba));return rp(_0x4cb8ba);}function getCustomFields(_0x17b806,_0x15fa0a){var _0x54012d={};if(_0x17b806[_0x87da('0x12')]>0x0){_['forEach'](_0x17b806,function(_0x2b444b){if(_[_0x87da('0x13')]([_0x87da('0x14'),_0x87da('0x15')],_0x2b444b[_0x87da('0x16')])&&_0x2b444b[_0x87da('0x17')]){_0x54012d[_0x2b444b[_0x87da('0x17')]]=_0x2b444b[_0x87da('0x18')]['toString']();}else if(_0x2b444b['type']===_0x87da('0x19')&&_0x2b444b[_0x87da('0x1a')]&&_0x2b444b[_0x87da('0x17')]&&_0x15fa0a[_0x2b444b['variableName']]){_0x54012d[_0x2b444b[_0x87da('0x17')]]=_0x15fa0a[_0x2b444b[_0x87da('0x1a')]][_0x87da('0x1b')]();}else if(_0x2b444b[_0x87da('0x16')]===_0x87da('0x1c')&&_0x2b444b[_0x87da('0x1d')]&&_0x2b444b[_0x87da('0x1d')][_0x87da('0x1e')]&&_0x2b444b[_0x87da('0x17')]&&_0x15fa0a[_0x2b444b[_0x87da('0x1d')][_0x87da('0x1e')][_0x87da('0x1f')]()]){_0x54012d[_0x2b444b[_0x87da('0x17')]]=_0x15fa0a[_0x2b444b[_0x87da('0x1d')]['name']['toLowerCase']()][_0x87da('0x1b')]();}});}return _0x54012d;}function getName(_0x4cde83){if(_0x4cde83[_0x87da('0x20')]('\x20')>0x0){var _0x277757=_0x4cde83[_0x87da('0x21')](/ (.+)/);if(_0x277757[0x1]){return _0x277757;}}return[_0x4cde83,_0x4cde83];}var accountsTokens={};function getAccessToken(_0x17ced5){return new Promise(function(_0x11d76c,_0x2ce586){if(!_[_0x87da('0x22')](accountsTokens[_0x17ced5['id']])&&!_[_0x87da('0x22')](accountsTokens[_0x17ced5['id']][_0x87da('0x23')])){if(moment()[_0x87da('0x24')](accountsTokens[_0x17ced5['id']][_0x87da('0x25')])){_0x11d76c(accountsTokens[_0x17ced5['id']][_0x87da('0x23')]);}}var _0x432522;switch(_0x17ced5[_0x87da('0x26')]){case'US':_0x432522=_0x87da('0x27');break;case'AU':_0x432522='https://accounts.zoho.com.au';break;case'EU':_0x432522=_0x87da('0x28');break;case'IN':_0x432522=_0x87da('0x29');break;case'CN':_0x432522=_0x87da('0x2a');break;default:_0x432522=_0x87da('0x28');break;}var _0x209c77={'method':_0x87da('0x2b'),'uri':_0x432522+'/oauth/v2/token','qs':{'refresh_token':_0x17ced5[_0x87da('0x2c')],'client_id':_0x17ced5[_0x87da('0x2d')],'client_secret':_0x17ced5['clientSecret'],'grant_type':_0x87da('0x2e')},'json':!![]};return rp(_0x209c77)[_0x87da('0x2f')](function(_0x3b5cd7){accountsTokens[_0x17ced5['id']]={'access_token':_0x3b5cd7[_0x87da('0x23')],'expires_in':moment()[_0x87da('0x30')](_0x3b5cd7[_0x87da('0x25')],_0x87da('0x31'))};_0x11d76c(_0x3b5cd7['access_token']);})['catch'](function(_0x3f1e3d){logger[_0x87da('0x32')](_0x87da('0x33'),_0x3f1e3d[_0x87da('0x34')]);_0x2ce586(_0x3f1e3d);});});}function getUser(_0x4485f0,_0x2de7a8,_0xa7fb97,_0x5c5be9){logger[_0x87da('0x35')](_0x87da('0x36'));return request({'method':_0x87da('0x37'),'uri':util[_0x87da('0x38')](_0x87da('0x39'),_0x2de7a8),'qs':{'type':_0x87da('0x3a')},'headers':{'Authorization':_0x87da('0x3b')+_0x4485f0},'json':!![]})[_0x87da('0x2f')](function(_0x53ab40){if(_0x53ab40[_0x87da('0x3c')]){var _0x2c2e00=-0x1;if(_['isArrayLikeObject'](_0x53ab40['users'])){if(!_[_0x87da('0x22')](_0x5c5be9)){_0x2c2e00=_[_0x87da('0x3d')](_0x53ab40[_0x87da('0x3c')],function(_0x34b13f){return _0x34b13f[_0x87da('0x3e')]===_0x5c5be9;});}if(_0x2c2e00>=0x0){logger[_0x87da('0x35')]('Agent\x20found!');}else{logger[_0x87da('0x35')]('Using\x20the\x20admin\x20account!');_0x2c2e00=_[_0x87da('0x3d')](_0x53ab40[_0x87da('0x3c')],function(_0x491816){return _0x491816[_0x87da('0x3f')][_0x87da('0x1e')]===_0x87da('0x40');});}return _0x53ab40['users'][_0x2c2e00];}else{if(_0x53ab40[_0x87da('0x41')]['profile'][_0x87da('0x1e')]===_0x87da('0x40')){logger[_0x87da('0x35')](_0x87da('0x42'));user=_0x53ab40[_0x87da('0x41')];return user;}else{logger[_0x87da('0x32')](_0x87da('0x43'),JSON['stringify'](_0x53ab40));throw new Error(_0x87da('0x44')+JSON['stringify'](_0x53ab40));}}}else{logger[_0x87da('0x32')](_0x87da('0x43'),JSON['stringify'](_0x53ab40));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x53ab40));}})[_0x87da('0x45')](function(_0x2bb603){console['error'](_0x2bb603);});}function getZohoUser(_0x5d5651,_0x417062){return new BPromise(function(_0x500caa,_0x4b2f97){request(_0x5d5651)[_0x87da('0x2f')](function(_0x150547){var _0x4039a3=null;if(_0x150547){_0x4039a3=_0x150547[_0x87da('0x46')][0x0];_0x4039a3['enduserType']=_0x417062;}_0x500caa(_0x4039a3);})[_0x87da('0x45')](function(_0x27209b){_0x4b2f97(_0x27209b);});});}function createEndUser(_0x23b0ff,_0x1db8bd,_0xfdf476,_0x5a15bb,_0x34044c,_0xe207e1){var _0xfdf476=getName(_0xfdf476);return request({'method':_0x87da('0x2b'),'uri':_0x87da('0x47')+_0x1db8bd+_0x87da('0x48')+_[_0x87da('0x49')](_0xe207e1[_0x87da('0x4a')])+'s','body':{'data':[{'Last_Name':_0xfdf476[0x1],'First_Name':_0xfdf476[0x0],'Phone':_0x5a15bb,'Owner':{'name':!_['isNil'](_0x34044c[_0x87da('0x4b')][_0x87da('0x1e')])?_0x34044c[_0x87da('0x4b')][_0x87da('0x1e')]:!_['isNil'](_0x34044c[_0x87da('0x4c')])?_0x34044c[_0x87da('0x4c')]+'\x20'+_0x34044c[_0x87da('0x4d')]:_0x34044c['last_name'],'id':_0x34044c['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23b0ff},'json':!![]})['then'](function(_0x2117c1){if(_0x2117c1&&_0x2117c1[_0x87da('0x46')][0x0]['code']===_0x87da('0x4e')){var _0x420556=_0x2117c1[_0x87da('0x46')][0x0][_0x87da('0x4f')];_0x420556[_0x87da('0x50')]=_[_0x87da('0x49')](_0xe207e1[_0x87da('0x4a')])+'s';return _0x420556;}logger[_0x87da('0x32')]('The\x20failing\x20result\x20is',JSON[_0x87da('0x11')](data));throw new Error('Error:\x20'+JSON[_0x87da('0x11')](data));})[_0x87da('0x45')](function(_0x5edb8d){console[_0x87da('0x51')](_0x87da('0x52'),_0x5edb8d);});}function getEndUser(_0x127e7d,_0x519c9a,_0x5b8595,_0x22a75f,_0x227887,_0x24189b,_0x205acc){var _0x2879a7={'method':_0x87da('0x37'),'uri':'','headers':{'Authorization':_0x87da('0x3b')+_0x127e7d},'json':!![]};switch(_0x205acc['moduleSearch']){case'contact_lead':_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x227887+'))';return getZohoUser(_0x2879a7,_0x87da('0x54'))[_0x87da('0x2f')](function(_0x3a98e9){if(_0x3a98e9)return _0x3a98e9;_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+_0x87da('0x55')+_0x227887+'))';return getZohoUser(_0x2879a7,_0x87da('0x56'))[_0x87da('0x2f')](function(_0x72feb2){if(_0x72feb2)return _0x72feb2;if(_0x205acc[_0x87da('0x4a')]!='nothing'){return createEndUser(_0x127e7d,_0x519c9a,_0x22a75f,_0x227887,_0x24189b,_0x205acc);}else{return{};}});});break;case _0x87da('0x57'):_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+_0x87da('0x58')+_0x227887+'))';return getZohoUser(_0x2879a7,'Contacts')['then'](function(_0x45ef5c){if(_0x45ef5c)return _0x45ef5c;if(_0x205acc['moduleCreate']!=_0x87da('0x59')){return createEndUser(_0x127e7d,_0x519c9a,_0x22a75f,_0x227887,_0x24189b,_0x205acc);}else{return{};}});break;case _0x87da('0x5a'):_0x2879a7[_0x87da('0x53')]=_0x87da('0x47')+_0x519c9a+_0x87da('0x55')+_0x227887+'))';return getZohoUser(_0x2879a7,_0x87da('0x56'))[_0x87da('0x2f')](function(_0x3d763e){if(_0x3d763e)return _0x3d763e;if(_0x205acc['moduleCreate']!='nothing'){return createEndUser(_0x127e7d,_0x519c9a,_0x22a75f,_0x227887,_0x24189b,_0x205acc);}else{return{};}});break;}}function getCall(_0x594724,_0x3cd1ed,_0x1fd5c0,_0x5d25d8,_0x1db518,_0x337eb3,_0x17e542,_0x184ac3){logger[_0x87da('0x35')]('Creating\x20new\x20call...');var _0x262d94={};_0x262d94[_0x87da('0x5b')]={'name':!_[_0x87da('0x22')](_0x5d25d8[_0x87da('0x4b')][_0x87da('0x1e')])&&!_[_0x87da('0x22')](_0x5d25d8[_0x87da('0x3f')][_0x87da('0x1e')])&&_0x5d25d8[_0x87da('0x3f')]['name']===_0x87da('0x5c')?_0x5d25d8['role'][_0x87da('0x1e')]:!_[_0x87da('0x22')](_0x5d25d8[_0x87da('0x4c')])?_0x5d25d8[_0x87da('0x4c')]+'\x20'+_0x5d25d8[_0x87da('0x4d')]:_0x5d25d8['last_name'],'id':_0x5d25d8['id']};_0x262d94['Subject']=intUtil[_0x87da('0x5d')](_0x337eb3[_0x87da('0x5e')],_0x17e542,'\x20');_0x262d94[_0x87da('0x5f')]=intUtil[_0x87da('0x5d')](_0x337eb3['Descriptions'],_0x17e542,'\x0a');if(_0x1db518[_0x87da('0x50')]===_0x87da('0x54')){_0x262d94[_0x87da('0x60')]={'name':!_[_0x87da('0x22')](_0x1db518['Full_Name'])?_0x1db518['Full_Name']:!_[_0x87da('0x22')](_0x1db518[_0x87da('0x61')])?_0x1db518[_0x87da('0x61')]+'\x20'+_0x1db518['Last_Name']:_0x1db518['Last_Name'],'id':_0x1db518['id']};}if(_0x1db518[_0x87da('0x50')]===_0x87da('0x56')){_0x262d94[_0x87da('0x62')]={'name':!_[_0x87da('0x22')](_0x1db518[_0x87da('0x63')])?_0x1db518[_0x87da('0x63')]:!_[_0x87da('0x22')](_0x1db518['First_Name'])?_0x1db518[_0x87da('0x61')]+'\x20'+_0x1db518[_0x87da('0x64')]:_0x1db518[_0x87da('0x64')],'id':_0x1db518['id']};_0x262d94[_0x87da('0x65')]=_['startCase'](_0x1db518[_0x87da('0x50')]);}if(_0x17e542[_0x87da('0x66')]){_0x262d94[_0x87da('0x67')]=moment['utc'](parseInt(_0x17e542['talktime'])*0x3e8)['format']('mm:ss');}else if(_0x17e542[_0x87da('0x68')]&&_0x17e542[_0x87da('0x69')]){_0x262d94[_0x87da('0x67')]=moment['utc'](moment(_0x17e542[_0x87da('0x69')],_0x87da('0x6a'))['diff'](moment(_0x17e542[_0x87da('0x6b')],'YYYY-MM-DDTHH:mm:ss')))[_0x87da('0x38')](_0x87da('0x6c'));}switch(_0x17e542[_0x87da('0x6d')]){case'called':_0x262d94[_0x87da('0x6e')]='Called';break;case _0x87da('0x6f'):case _0x87da('0x70'):_0x262d94[_0x87da('0x6e')]=_0x87da('0x71');break;case _0x87da('0x72'):_0x262d94['Call_Result']='Rejected';break;case _0x87da('0x73'):_0x262d94[_0x87da('0x6e')]='Abandoned';break;case'timeout':_0x262d94[_0x87da('0x6e')]=_0x87da('0x74');default:}_0x262d94[_0x87da('0x75')]=(_0x184ac3===_0x87da('0x76')?moment(_0x17e542[_0x87da('0x6b')])[_0x87da('0x38')](_0x87da('0x6a')):moment(_0x17e542[_0x87da('0x77')])[_0x87da('0x38')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x87da('0x38')]('YYYY-MM-DDTHH:mm:ss');_0x262d94['Call_Type']=_0x184ac3||_0x87da('0x78');_0x262d94=_[_0x87da('0x79')](_0x262d94,getCustomFields(_0x337eb3['Fields'],_0x17e542));return request({'method':_0x87da('0x2b'),'uri':_0x87da('0x47')+_0x3cd1ed+_0x87da('0x7a'),'headers':{'Authorization':_0x87da('0x3b')+_0x594724},'body':{'data':[_0x262d94]},'json':!![]})[_0x87da('0x2f')](function(_0x4cb44f){if(_0x4cb44f&&_0x4cb44f['data'][0x0][_0x87da('0x7b')]===_0x87da('0x4e')){logger[_0x87da('0x35')](_0x87da('0x7c'));return{'id':_0x4cb44f[_0x87da('0x46')][0x0][_0x87da('0x4f')]['id']};}})[_0x87da('0x45')](function(_0x49a85f){logger[_0x87da('0x35')](_0x87da('0x7d'),_0x49a85f[_0x87da('0x34')]);console['log'](_0x87da('0x7d'),_0x49a85f);});}exports[_0x87da('0x7e')]=function(_0xc59dba,_0x48f5c5,_0x4bc831,_0x52f289,_0x420696,_0x1bc36f){var _0x58736f,_0x39b904,_0x5e5801;_0x1bc36f[_0x87da('0x7f')]=intUtil[_0x87da('0x80')](_0x1bc36f[_0x87da('0x7f')]);_0x1bc36f[_0x87da('0x81')]=intUtil[_0x87da('0x80')](_0x1bc36f['serverUrl']);if(_0x420696&&_0x420696[_0x87da('0x82')]){logger[_0x87da('0x35')]('[QUEUE]','Recording\x20is\x20enabled!');_0x48f5c5[_0x87da('0x83')]=_0x1bc36f['serverUrl']+_0x87da('0x84')+_0x48f5c5[_0x87da('0x85')]+_0x87da('0x86')+md5(_0x48f5c5['uniqueid']);}else{_0x48f5c5[_0x87da('0x83')]='';}var _0x41bccb=_0x1bc36f[_0x87da('0x7f')]===_0x87da('0x87')?'eu':_0x87da('0x88');return getAccessToken(_0x1bc36f)[_0x87da('0x2f')](function(_0x2855f0){_0x5e5801=_0x2855f0;return getUser(_0x5e5801,_0x41bccb,_0x1bc36f,_0x52f289[_0x87da('0x3e')]);})[_0x87da('0x2f')](function(_0x12924d){_0x58736f=_0x12924d;logger[_0x87da('0x35')](_0x87da('0x89'),_0x58736f['id']);return getEndUser(_0x5e5801,_0x41bccb,_0x1bc36f,_0x48f5c5[_0x87da('0x8a')],_0x48f5c5[_0x87da('0x8b')],_0x58736f,_0x4bc831);})[_0x87da('0x2f')](function(_0x417662){_0x39b904=_0x417662;return getCall(_0x5e5801,_0x41bccb,_0x1bc36f,_0x58736f,_0x39b904,_0x4bc831,_0x48f5c5,_0x87da('0x78'));})[_0x87da('0x2f')](function(_0x3edd35){if(_0x3edd35){logger[_0x87da('0x35')]('The\x20Call\x20ID\x20is:',_0x3edd35['id']);logger[_0x87da('0x35')](_0x87da('0x8c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x87da('0x8d'),_0x52f289[_0x87da('0x1e')]),_0x87da('0x8e'),{'uri':_0x87da('0x8f')+_0x1bc36f[_0x87da('0x7f')]+_0x87da('0x90')+_0x3edd35['id']});}})[_0x87da('0x45')](function(_0x29a0ea){logger[_0x87da('0x32')](_0x87da('0x8c'),JSON[_0x87da('0x11')](_0x29a0ea));});};exports[_0x87da('0x76')]=function(_0x5f3b5d,_0x5a44d8,_0x20f93b,_0x351a36,_0xe987d1,_0x30c89a,_0x285f3a){var _0x1b7552,_0x17a3f5,_0x48bd44;_0x30c89a[_0x87da('0x7f')]=intUtil[_0x87da('0x80')](_0x30c89a['host']);_0x30c89a[_0x87da('0x81')]=intUtil[_0x87da('0x80')](_0x30c89a[_0x87da('0x81')]);if(_0x285f3a&&_0x285f3a[_0x87da('0x91')]&&_0x285f3a[_0x87da('0x91')]!==_0x87da('0x92')){logger[_0x87da('0x35')](_0x87da('0x93'),_0x87da('0x94'));_0x5a44d8[_0x87da('0x83')]=_0x30c89a['serverUrl']+_0x87da('0x84')+_0x5a44d8[_0x87da('0x85')]+_0x87da('0x86')+md5(_0x5a44d8['uniqueid']);}var _0x482277=_0x30c89a['host']===_0x87da('0x87')?'eu':_0x87da('0x88');return getAccessToken(_0x30c89a)['then'](function(_0x31153d){_0x48bd44=_0x31153d;return getUser(_0x48bd44,_0x482277,_0x30c89a,_0x351a36['email']);})[_0x87da('0x2f')](function(_0x165ff1){_0x1b7552=_0x165ff1;logger[_0x87da('0x35')](_0x87da('0x89'),_0x1b7552['id']);return getEndUser(_0x48bd44,_0x482277,_0x30c89a,_0x5a44d8[_0x87da('0x95')],_0x5a44d8[_0x87da('0x96')],_0x1b7552,_0x20f93b);})['then'](function(_0x120f74){_0x17a3f5=_0x120f74;return getCall(_0x48bd44,_0x482277,_0x30c89a,_0x1b7552,_0x17a3f5,_0x20f93b,_0x5a44d8,_0x87da('0x97'));})[_0x87da('0x2f')](function(_0x1a7c7e){if(_0x1a7c7e){logger[_0x87da('0x35')](_0x87da('0x98'),_0x1a7c7e['id']);logger[_0x87da('0x35')](_0x87da('0x93'),_0x87da('0x99'));emit(util[_0x87da('0x38')](_0x87da('0x8d'),_0x351a36[_0x87da('0x1e')]),'trigger:browser:url',{'uri':_0x87da('0x8f')+_0x30c89a[_0x87da('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1a7c7e['id']});}})['catch'](function(_0xd5615){logger[_0x87da('0x32')](_0x87da('0x93'),JSON['stringify'](_0xd5615));});};exports[_0x87da('0x9a')]=function(_0x3c35d4,_0x21718,_0x55e808,_0x33cf12,_0x3367e4,_0x263abe){var _0x3859c6,_0x1bc41b,_0x405158;_0x263abe[_0x87da('0x7f')]=intUtil[_0x87da('0x80')](_0x263abe[_0x87da('0x7f')]);_0x263abe[_0x87da('0x81')]=intUtil[_0x87da('0x80')](_0x263abe[_0x87da('0x81')]);if(_0x3367e4&&_0x3367e4[_0x87da('0x82')]){logger['info']('['+_0x21718[_0x87da('0x6d')][_0x87da('0x9b')]()+']',_0x87da('0x94'));_0x21718['recordingURL']=_0x263abe[_0x87da('0x81')]+_0x87da('0x84')+_0x21718[_0x87da('0x85')]+_0x87da('0x86')+md5(_0x21718[_0x87da('0x85')]);}else{_0x21718[_0x87da('0x83')]='';}var _0x290752=_0x263abe['host']===_0x87da('0x87')?'eu':_0x87da('0x88');return getAccessToken(_0x263abe)[_0x87da('0x2f')](function(_0x3720cc){_0x405158=_0x3720cc;return getUser(_0x405158,_0x290752,_0x263abe);})[_0x87da('0x2f')](function(_0x4db71c){_0x3859c6=_0x4db71c;logger['info'](_0x87da('0x89'),_0x3859c6['id']);return getEndUser(_0x405158,_0x290752,_0x263abe,_0x21718[_0x87da('0x8a')],_0x21718[_0x87da('0x8b')],_0x3859c6,_0x55e808);})[_0x87da('0x2f')](function(_0x4f1cd2){_0x1bc41b=_0x4f1cd2;return getCall(_0x405158,_0x290752,_0x263abe,_0x3859c6,_0x1bc41b,_0x55e808,_0x21718,_0x87da('0x78'));})[_0x87da('0x2f')](function(_0x56a469){if(_0x56a469){logger[_0x87da('0x35')](_0x87da('0x98'),_0x56a469['id']);}})[_0x87da('0x45')](function(_0x44332a){logger[_0x87da('0x32')]('['+_0x21718[_0x87da('0x6d')][_0x87da('0x9b')]()+']',JSON[_0x87da('0x11')](_0x44332a));});}; \ No newline at end of file +var _0xcb04=['split','isNil','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','refresh_token','then','add','seconds','catch','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','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','first_name','last_name','SUCCESS','details','enduserType','Error:\x20','moduleSearch','Contacts','uri','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','role','administrator','Subjects','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','trigger:browser:url','toUpperCase','calleridname','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','[HTTP]','length','includes','string','picklist','idField','content','toString','variableName','type','customVariable','Variable','toLowerCase','name','indexOf'];(function(_0x2a27d2,_0x1194e5){var _0x18f683=function(_0x553e0d){while(--_0x553e0d){_0x2a27d2['push'](_0x2a27d2['shift']());}};_0x18f683(++_0x1194e5);}(_0xcb04,0x7c));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4cb0('0x0'));var rp=require(_0x4cb0('0x1'));var md5=require('md5');var util=require(_0x4cb0('0x2'));var intUtil=require(_0x4cb0('0x3'));var moment=require(_0x4cb0('0x4'));var Redis=require(_0x4cb0('0x5'));var BPromise=require(_0x4cb0('0x6'));var config=require('../../../../config/environment');var logger=require(_0x4cb0('0x7'))(_0x4cb0('0x8'));config[_0x4cb0('0x9')]=_[_0x4cb0('0xa')](config[_0x4cb0('0x9')],{'host':_0x4cb0('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5dbaa7,_0x1870ae,_0x520a70){io['to'](_0x5dbaa7)[_0x4cb0('0xc')](_0x1870ae,_0x520a70);}function request(_0x49e46e){logger['debug'](_0x4cb0('0xd'),JSON['stringify'](_0x49e46e));return rp(_0x49e46e);}function getCustomFields(_0x33c6f7,_0x58fd56){var _0x51b863={};if(_0x33c6f7[_0x4cb0('0xe')]>0x0){_['forEach'](_0x33c6f7,function(_0x4385b2){if(_[_0x4cb0('0xf')]([_0x4cb0('0x10'),_0x4cb0('0x11')],_0x4385b2['type'])&&_0x4385b2[_0x4cb0('0x12')]){_0x51b863[_0x4385b2[_0x4cb0('0x12')]]=_0x4385b2[_0x4cb0('0x13')][_0x4cb0('0x14')]();}else if(_0x4385b2['type']==='variable'&&_0x4385b2[_0x4cb0('0x15')]&&_0x4385b2[_0x4cb0('0x12')]&&_0x58fd56[_0x4385b2[_0x4cb0('0x15')]]){_0x51b863[_0x4385b2[_0x4cb0('0x12')]]=_0x58fd56[_0x4385b2['variableName']][_0x4cb0('0x14')]();}else if(_0x4385b2[_0x4cb0('0x16')]===_0x4cb0('0x17')&&_0x4385b2[_0x4cb0('0x18')]&&_0x4385b2[_0x4cb0('0x18')]['name']&&_0x4385b2[_0x4cb0('0x12')]&&_0x58fd56[_0x4385b2[_0x4cb0('0x18')]['name'][_0x4cb0('0x19')]()]){_0x51b863[_0x4385b2[_0x4cb0('0x12')]]=_0x58fd56[_0x4385b2['Variable'][_0x4cb0('0x1a')][_0x4cb0('0x19')]()][_0x4cb0('0x14')]();}});}return _0x51b863;}function getName(_0x3bf528){if(_0x3bf528[_0x4cb0('0x1b')]('\x20')>0x0){var _0x3ef2f5=_0x3bf528[_0x4cb0('0x1c')](/ (.+)/);if(_0x3ef2f5[0x1]){return _0x3ef2f5;}}return[_0x3bf528,_0x3bf528];}var accountsTokens={};function getAccessToken(_0x44c763){return new Promise(function(_0x3c8978,_0x544180){if(!_[_0x4cb0('0x1d')](accountsTokens[_0x44c763['id']])&&!_[_0x4cb0('0x1d')](accountsTokens[_0x44c763['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x44c763['id']][_0x4cb0('0x1e')])){_0x3c8978(accountsTokens[_0x44c763['id']]['access_token']);}}var _0x2790e1;switch(_0x44c763['zone']){case'US':_0x2790e1=_0x4cb0('0x1f');break;case'AU':_0x2790e1=_0x4cb0('0x20');break;case'EU':_0x2790e1='https://accounts.zoho.eu';break;case'IN':_0x2790e1=_0x4cb0('0x21');break;case'CN':_0x2790e1=_0x4cb0('0x22');break;default:_0x2790e1=_0x4cb0('0x23');break;}var _0x296bc2={'method':_0x4cb0('0x24'),'uri':_0x2790e1+'/oauth/v2/token','qs':{'refresh_token':_0x44c763[_0x4cb0('0x25')],'client_id':_0x44c763[_0x4cb0('0x26')],'client_secret':_0x44c763['clientSecret'],'grant_type':_0x4cb0('0x27')},'json':!![]};return rp(_0x296bc2)[_0x4cb0('0x28')](function(_0x17951f){accountsTokens[_0x44c763['id']]={'access_token':_0x17951f['access_token'],'expires_in':moment()[_0x4cb0('0x29')](_0x17951f[_0x4cb0('0x1e')],_0x4cb0('0x2a'))};_0x3c8978(_0x17951f['access_token']);})[_0x4cb0('0x2b')](function(_0x4f7ce6){logger[_0x4cb0('0x2c')](_0x4cb0('0x2d'),_0x4f7ce6[_0x4cb0('0x2e')]);_0x544180(_0x4f7ce6);});});}function getUser(_0x8a572c,_0x5860c8,_0xce53be,_0x15dea8){logger[_0x4cb0('0x2f')](_0x4cb0('0x30'));return request({'method':_0x4cb0('0x31'),'uri':util[_0x4cb0('0x32')](_0x4cb0('0x33'),_0x5860c8),'qs':{'type':_0x4cb0('0x34')},'headers':{'Authorization':_0x4cb0('0x35')+_0x8a572c},'json':!![]})[_0x4cb0('0x28')](function(_0x1029e3){if(_0x1029e3[_0x4cb0('0x36')]){var _0x178dea=-0x1;if(_[_0x4cb0('0x37')](_0x1029e3[_0x4cb0('0x36')])){if(!_[_0x4cb0('0x1d')](_0x15dea8)){_0x178dea=_[_0x4cb0('0x38')](_0x1029e3['users'],function(_0x339b09){return _0x339b09[_0x4cb0('0x39')]===_0x15dea8;});}if(_0x178dea>=0x0){logger[_0x4cb0('0x2f')](_0x4cb0('0x3a'));}else{logger['info'](_0x4cb0('0x3b'));_0x178dea=_['findIndex'](_0x1029e3[_0x4cb0('0x36')],function(_0x3e2ebd){return _0x3e2ebd[_0x4cb0('0x3c')][_0x4cb0('0x1a')]===_0x4cb0('0x3d');});}return _0x1029e3[_0x4cb0('0x36')][_0x178dea];}else{if(_0x1029e3[_0x4cb0('0x3e')][_0x4cb0('0x3c')][_0x4cb0('0x1a')]==='Administrator'){logger['info'](_0x4cb0('0x3b'));user=_0x1029e3[_0x4cb0('0x3e')];return user;}else{logger[_0x4cb0('0x2c')](_0x4cb0('0x3f'),JSON[_0x4cb0('0x40')](_0x1029e3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x4cb0('0x40')](_0x1029e3));}}}else{logger[_0x4cb0('0x2c')](_0x4cb0('0x3f'),JSON[_0x4cb0('0x40')](_0x1029e3));throw new Error(_0x4cb0('0x41')+JSON[_0x4cb0('0x40')](_0x1029e3));}})[_0x4cb0('0x2b')](function(_0x1fe5fe){console[_0x4cb0('0x2c')](_0x1fe5fe);});}function getZohoUser(_0x398870,_0xc132aa){return new BPromise(function(_0x2ac068,_0x4fa651){request(_0x398870)[_0x4cb0('0x28')](function(_0x4d6b8f){var _0x29b060=null;if(_0x4d6b8f){_0x29b060=_0x4d6b8f[_0x4cb0('0x42')][0x0];_0x29b060['enduserType']=_0xc132aa;}_0x2ac068(_0x29b060);})[_0x4cb0('0x2b')](function(_0x35e673){_0x4fa651(_0x35e673);});});}function createEndUser(_0x4ce129,_0x1b6603,_0x3f8326,_0x1acf23,_0x41d45a,_0xb87515){var _0x3f8326=getName(_0x3f8326);return request({'method':_0x4cb0('0x24'),'uri':_0x4cb0('0x43')+_0x1b6603+'/crm/v2/'+_[_0x4cb0('0x44')](_0xb87515[_0x4cb0('0x45')])+'s','body':{'data':[{'Last_Name':_0x3f8326[0x1],'First_Name':_0x3f8326[0x0],'Phone':_0x1acf23,'Owner':{'name':!_[_0x4cb0('0x1d')](_0x41d45a['role'][_0x4cb0('0x1a')])?_0x41d45a['role'][_0x4cb0('0x1a')]:!_['isNil'](_0x41d45a['first_name'])?_0x41d45a[_0x4cb0('0x46')]+'\x20'+_0x41d45a[_0x4cb0('0x47')]:_0x41d45a[_0x4cb0('0x47')],'id':_0x41d45a['id']}}]},'headers':{'Authorization':_0x4cb0('0x35')+_0x4ce129},'json':!![]})['then'](function(_0x32eaa8){if(_0x32eaa8&&_0x32eaa8['data'][0x0]['code']===_0x4cb0('0x48')){var _0xac50ec=_0x32eaa8['data'][0x0][_0x4cb0('0x49')];_0xac50ec[_0x4cb0('0x4a')]=_[_0x4cb0('0x44')](_0xb87515[_0x4cb0('0x45')])+'s';return _0xac50ec;}logger[_0x4cb0('0x2c')](_0x4cb0('0x3f'),JSON[_0x4cb0('0x40')](data));throw new Error(_0x4cb0('0x4b')+JSON[_0x4cb0('0x40')](data));})['catch'](function(_0xe128a8){console['log']('CREATE\x20ERROR',_0xe128a8);});}function getEndUser(_0x29fe9c,_0x358833,_0x18a3f8,_0x46656b,_0x3f48f8,_0xaec213,_0x503626){var _0x7a3456={'method':'GET','uri':'','headers':{'Authorization':_0x4cb0('0x35')+_0x29fe9c},'json':!![]};switch(_0x503626[_0x4cb0('0x4c')]){case'contact_lead':_0x7a3456['uri']='https://www.zohoapis.'+_0x358833+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3f48f8+'))';return getZohoUser(_0x7a3456,_0x4cb0('0x4d'))['then'](function(_0xefd856){if(_0xefd856)return _0xefd856;_0x7a3456[_0x4cb0('0x4e')]=_0x4cb0('0x43')+_0x358833+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3f48f8+'))';return getZohoUser(_0x7a3456,'Leads')[_0x4cb0('0x28')](function(_0x2919ab){if(_0x2919ab)return _0x2919ab;if(_0x503626[_0x4cb0('0x45')]!=_0x4cb0('0x4f')){return createEndUser(_0x29fe9c,_0x358833,_0x46656b,_0x3f48f8,_0xaec213,_0x503626);}else{return{};}});});break;case _0x4cb0('0x50'):_0x7a3456[_0x4cb0('0x4e')]=_0x4cb0('0x43')+_0x358833+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3f48f8+'))';return getZohoUser(_0x7a3456,'Contacts')[_0x4cb0('0x28')](function(_0x154fe8){if(_0x154fe8)return _0x154fe8;if(_0x503626[_0x4cb0('0x45')]!=_0x4cb0('0x4f')){return createEndUser(_0x29fe9c,_0x358833,_0x46656b,_0x3f48f8,_0xaec213,_0x503626);}else{return{};}});break;case _0x4cb0('0x51'):_0x7a3456[_0x4cb0('0x4e')]=_0x4cb0('0x43')+_0x358833+_0x4cb0('0x52')+_0x3f48f8+'))';return getZohoUser(_0x7a3456,_0x4cb0('0x53'))[_0x4cb0('0x28')](function(_0x2d8dfd){if(_0x2d8dfd)return _0x2d8dfd;if(_0x503626[_0x4cb0('0x45')]!='nothing'){return createEndUser(_0x29fe9c,_0x358833,_0x46656b,_0x3f48f8,_0xaec213,_0x503626);}else{return{};}});break;}}function getCall(_0x560d7d,_0x5aaa62,_0x1e50c3,_0x21a168,_0x4394ea,_0x37b816,_0x22de6c,_0x20c7f0){logger[_0x4cb0('0x2f')](_0x4cb0('0x54'));var _0x4039a7={};_0x4039a7[_0x4cb0('0x55')]={'name':!_['isNil'](_0x21a168[_0x4cb0('0x56')][_0x4cb0('0x1a')])&&!_[_0x4cb0('0x1d')](_0x21a168[_0x4cb0('0x3c')][_0x4cb0('0x1a')])&&_0x21a168['profile'][_0x4cb0('0x1a')]===_0x4cb0('0x57')?_0x21a168[_0x4cb0('0x56')][_0x4cb0('0x1a')]:!_['isNil'](_0x21a168['first_name'])?_0x21a168['first_name']+'\x20'+_0x21a168[_0x4cb0('0x47')]:_0x21a168['last_name'],'id':_0x21a168['id']};_0x4039a7['Subject']=intUtil['getString'](_0x37b816[_0x4cb0('0x58')],_0x22de6c,'\x20');_0x4039a7[_0x4cb0('0x59')]=intUtil[_0x4cb0('0x5a')](_0x37b816['Descriptions'],_0x22de6c,'\x0a');if(_0x4394ea[_0x4cb0('0x4a')]===_0x4cb0('0x4d')){_0x4039a7[_0x4cb0('0x5b')]={'name':!_['isNil'](_0x4394ea[_0x4cb0('0x5c')])?_0x4394ea[_0x4cb0('0x5c')]:!_[_0x4cb0('0x1d')](_0x4394ea[_0x4cb0('0x5d')])?_0x4394ea[_0x4cb0('0x5d')]+'\x20'+_0x4394ea[_0x4cb0('0x5e')]:_0x4394ea[_0x4cb0('0x5e')],'id':_0x4394ea['id']};}if(_0x4394ea['enduserType']===_0x4cb0('0x53')){_0x4039a7['What_Id']={'name':!_[_0x4cb0('0x1d')](_0x4394ea[_0x4cb0('0x5c')])?_0x4394ea[_0x4cb0('0x5c')]:!_[_0x4cb0('0x1d')](_0x4394ea[_0x4cb0('0x5d')])?_0x4394ea[_0x4cb0('0x5d')]+'\x20'+_0x4394ea[_0x4cb0('0x5e')]:_0x4394ea['Last_Name'],'id':_0x4394ea['id']};_0x4039a7[_0x4cb0('0x5f')]=_[_0x4cb0('0x44')](_0x4394ea[_0x4cb0('0x4a')]);}if(_0x22de6c[_0x4cb0('0x60')]){_0x4039a7[_0x4cb0('0x61')]=moment[_0x4cb0('0x62')](parseInt(_0x22de6c[_0x4cb0('0x60')])*0x3e8)['format'](_0x4cb0('0x63'));}else if(_0x22de6c[_0x4cb0('0x64')]&&_0x22de6c[_0x4cb0('0x65')]){_0x4039a7['Call_Duration']=moment['utc'](moment(_0x22de6c[_0x4cb0('0x65')],_0x4cb0('0x66'))['diff'](moment(_0x22de6c[_0x4cb0('0x67')],_0x4cb0('0x66'))))[_0x4cb0('0x32')](_0x4cb0('0x63'));}switch(_0x22de6c[_0x4cb0('0x68')]){case _0x4cb0('0x69'):_0x4039a7[_0x4cb0('0x6a')]=_0x4cb0('0x6b');break;case _0x4cb0('0x6c'):case _0x4cb0('0x6d'):_0x4039a7['Call_Result']=_0x4cb0('0x6e');break;case _0x4cb0('0x6f'):_0x4039a7[_0x4cb0('0x6a')]='Rejected';break;case _0x4cb0('0x70'):_0x4039a7[_0x4cb0('0x6a')]='Abandoned';break;case _0x4cb0('0x71'):_0x4039a7['Call_Result']=_0x4cb0('0x72');default:}_0x4039a7[_0x4cb0('0x73')]=(_0x20c7f0===_0x4cb0('0x74')?moment(_0x22de6c[_0x4cb0('0x67')])['format'](_0x4cb0('0x66')):moment(_0x22de6c[_0x4cb0('0x75')])[_0x4cb0('0x32')](_0x4cb0('0x66')))||moment()[_0x4cb0('0x32')](_0x4cb0('0x66'));_0x4039a7[_0x4cb0('0x76')]=_0x20c7f0||'Inbound';_0x4039a7=_[_0x4cb0('0x77')](_0x4039a7,getCustomFields(_0x37b816[_0x4cb0('0x78')],_0x22de6c));return request({'method':_0x4cb0('0x24'),'uri':_0x4cb0('0x43')+_0x5aaa62+_0x4cb0('0x79'),'headers':{'Authorization':_0x4cb0('0x35')+_0x560d7d},'body':{'data':[_0x4039a7]},'json':!![]})[_0x4cb0('0x28')](function(_0x50bbb2){if(_0x50bbb2&&_0x50bbb2[_0x4cb0('0x42')][0x0][_0x4cb0('0x7a')]==='SUCCESS'){logger[_0x4cb0('0x2f')](_0x4cb0('0x7b'));return{'id':_0x50bbb2[_0x4cb0('0x42')][0x0][_0x4cb0('0x49')]['id']};}})[_0x4cb0('0x2b')](function(_0x12497d){logger[_0x4cb0('0x2f')]('err',_0x12497d[_0x4cb0('0x2e')]);console['log'](_0x4cb0('0x7c'),_0x12497d);});}exports[_0x4cb0('0x7d')]=function(_0x39edbc,_0x2de196,_0xe95e10,_0x396161,_0x4487df,_0x4b9eea){var _0x1694df,_0x5b3899,_0x5bbf98;_0x4b9eea['host']=intUtil[_0x4cb0('0x7e')](_0x4b9eea['host']);_0x4b9eea['serverUrl']=intUtil[_0x4cb0('0x7e')](_0x4b9eea['serverUrl']);if(_0x4487df&&_0x4487df[_0x4cb0('0x7f')]){logger[_0x4cb0('0x2f')](_0x4cb0('0x80'),_0x4cb0('0x81'));_0x2de196['recordingURL']=_0x4b9eea[_0x4cb0('0x82')]+_0x4cb0('0x83')+_0x2de196[_0x4cb0('0x84')]+_0x4cb0('0x85')+md5(_0x2de196[_0x4cb0('0x84')]);}else{_0x2de196[_0x4cb0('0x86')]='';}var _0x48b88c=_0x4b9eea[_0x4cb0('0x87')]===_0x4cb0('0x88')?'eu':_0x4cb0('0x89');return getAccessToken(_0x4b9eea)[_0x4cb0('0x28')](function(_0x18921c){_0x5bbf98=_0x18921c;return getUser(_0x5bbf98,_0x48b88c,_0x4b9eea,_0x396161[_0x4cb0('0x39')]);})['then'](function(_0x1fafd9){_0x1694df=_0x1fafd9;logger[_0x4cb0('0x2f')](_0x4cb0('0x8a'),_0x1694df['id']);return getEndUser(_0x5bbf98,_0x48b88c,_0x4b9eea,_0x2de196['calleridname'],_0x2de196[_0x4cb0('0x8b')],_0x1694df,_0xe95e10);})[_0x4cb0('0x28')](function(_0x12bf5a){_0x5b3899=_0x12bf5a;return getCall(_0x5bbf98,_0x48b88c,_0x4b9eea,_0x1694df,_0x5b3899,_0xe95e10,_0x2de196,'Inbound');})[_0x4cb0('0x28')](function(_0x3f1956){if(_0x3f1956){logger[_0x4cb0('0x2f')](_0x4cb0('0x8c'),_0x3f1956['id']);logger['info'](_0x4cb0('0x80'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4cb0('0x32')](_0x4cb0('0x8d'),_0x396161['name']),'trigger:browser:url',{'uri':_0x4cb0('0x8e')+_0x4b9eea[_0x4cb0('0x87')]+_0x4cb0('0x8f')+_0x3f1956['id']});}})[_0x4cb0('0x2b')](function(_0x34fd83){logger['error'](_0x4cb0('0x80'),JSON[_0x4cb0('0x40')](_0x34fd83));});};exports[_0x4cb0('0x74')]=function(_0x54c293,_0x4c154c,_0x56a58f,_0x3d679a,_0x13f52f,_0x26080d,_0x13901f){var _0xa9e644,_0x3474a8,_0x6bdaf3;_0x26080d['host']=intUtil[_0x4cb0('0x7e')](_0x26080d['host']);_0x26080d[_0x4cb0('0x82')]=intUtil[_0x4cb0('0x7e')](_0x26080d[_0x4cb0('0x82')]);if(_0x13901f&&_0x13901f[_0x4cb0('0x90')]&&_0x13901f[_0x4cb0('0x90')]!==_0x4cb0('0x91')){logger['info'](_0x4cb0('0x92'),_0x4cb0('0x81'));_0x4c154c[_0x4cb0('0x86')]=_0x26080d['serverUrl']+'/api/voice/recordings/'+_0x4c154c['uniqueid']+_0x4cb0('0x85')+md5(_0x4c154c[_0x4cb0('0x84')]);}var _0x4db1ed=_0x26080d[_0x4cb0('0x87')]===_0x4cb0('0x88')?'eu':_0x4cb0('0x89');return getAccessToken(_0x26080d)['then'](function(_0x44f0bf){_0x6bdaf3=_0x44f0bf;return getUser(_0x6bdaf3,_0x4db1ed,_0x26080d,_0x3d679a['email']);})[_0x4cb0('0x28')](function(_0x55831b){_0xa9e644=_0x55831b;logger[_0x4cb0('0x2f')]('The\x20User\x20ID\x20is:',_0xa9e644['id']);return getEndUser(_0x6bdaf3,_0x4db1ed,_0x26080d,_0x4c154c['destcalleridname'],_0x4c154c[_0x4cb0('0x93')],_0xa9e644,_0x56a58f);})['then'](function(_0x5f4ffc){_0x3474a8=_0x5f4ffc;return getCall(_0x6bdaf3,_0x4db1ed,_0x26080d,_0xa9e644,_0x3474a8,_0x56a58f,_0x4c154c,_0x4cb0('0x94'));})['then'](function(_0x38ccaf){if(_0x38ccaf){logger['info'](_0x4cb0('0x8c'),_0x38ccaf['id']);logger[_0x4cb0('0x2f')](_0x4cb0('0x92'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4cb0('0x32')]('user:%s',_0x3d679a[_0x4cb0('0x1a')]),_0x4cb0('0x95'),{'uri':'https://crm.'+_0x26080d[_0x4cb0('0x87')]+'/crm/EntityInfo.do?module=Calls&id='+_0x38ccaf['id']});}})['catch'](function(_0x179008){logger[_0x4cb0('0x2c')](_0x4cb0('0x92'),JSON[_0x4cb0('0x40')](_0x179008));});};exports['unmanaged']=function(_0x40a8b2,_0x54c6a3,_0x52e993,_0x25cc77,_0x4cd5aa,_0x58f9bd){var _0x4664ba,_0x55be63,_0x37f18d;_0x58f9bd['host']=intUtil[_0x4cb0('0x7e')](_0x58f9bd['host']);_0x58f9bd[_0x4cb0('0x82')]=intUtil[_0x4cb0('0x7e')](_0x58f9bd[_0x4cb0('0x82')]);if(_0x4cd5aa&&_0x4cd5aa['monitor_format']){logger['info']('['+_0x54c6a3[_0x4cb0('0x68')][_0x4cb0('0x96')]()+']','Recording\x20is\x20enabled!');_0x54c6a3[_0x4cb0('0x86')]=_0x58f9bd[_0x4cb0('0x82')]+_0x4cb0('0x83')+_0x54c6a3['uniqueid']+_0x4cb0('0x85')+md5(_0x54c6a3[_0x4cb0('0x84')]);}else{_0x54c6a3['recordingURL']='';}var _0x4d75d4=_0x58f9bd[_0x4cb0('0x87')]===_0x4cb0('0x88')?'eu':_0x4cb0('0x89');return getAccessToken(_0x58f9bd)['then'](function(_0x3ef2f8){_0x37f18d=_0x3ef2f8;return getUser(_0x37f18d,_0x4d75d4,_0x58f9bd);})[_0x4cb0('0x28')](function(_0x2e1f8c){_0x4664ba=_0x2e1f8c;logger[_0x4cb0('0x2f')](_0x4cb0('0x8a'),_0x4664ba['id']);return getEndUser(_0x37f18d,_0x4d75d4,_0x58f9bd,_0x54c6a3[_0x4cb0('0x97')],_0x54c6a3[_0x4cb0('0x8b')],_0x4664ba,_0x52e993);})['then'](function(_0xeec14a){_0x55be63=_0xeec14a;return getCall(_0x37f18d,_0x4d75d4,_0x58f9bd,_0x4664ba,_0x55be63,_0x52e993,_0x54c6a3,'Inbound');})[_0x4cb0('0x28')](function(_0x6bd143){if(_0x6bd143){logger['info'](_0x4cb0('0x8c'),_0x6bd143['id']);}})[_0x4cb0('0x2b')](function(_0x428396){logger[_0x4cb0('0x2c')]('['+_0x54c6a3[_0x4cb0('0x68')][_0x4cb0('0x96')]()+']',JSON['stringify'](_0x428396));});}; \ 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 e8d684a..a60d92b 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 _0x3d4d=['render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3'];(function(_0x3b3a17,_0x2c7c9a){var _0x4c5a33=function(_0x3d549f){while(--_0x3d549f){_0x3b3a17['push'](_0x3b3a17['shift']());}};_0x4c5a33(++_0x2c7c9a);}(_0x3d4d,0xe8));var _0xd3d4=function(_0x5bc1f4,_0x1a793f){_0x5bc1f4=_0x5bc1f4-0x0;var _0x5cd8ce=_0x3d4d[_0x5bc1f4];return _0x5cd8ce;};'use strict';var util=require(_0xd3d4('0x0'));var sh=require(_0xd3d4('0x1'));var Mustache=require(_0xd3d4('0x2'));var logger=require(_0xd3d4('0x3'))(_0xd3d4('0x4'));exports['exec']=function(_0x27f633,_0x2a2eb3){var _0x1331a2=_0x27f633[_0xd3d4('0x5')]?_0x27f633[_0xd3d4('0x5')]:_0xd3d4('0x6');var _0x628fd8=_0x27f633[_0xd3d4('0x7')]?Mustache[_0xd3d4('0x8')](_0x27f633['data3'],_0x2a2eb3):_0x2a2eb3;sh[_0xd3d4('0x9')](_0x628fd8,function(_0x2cb0a2,_0x39be57,_0x41aa7c){if(_0x2cb0a2!==0x0){logger[_0xd3d4('0xa')](util[_0xd3d4('0xb')](_0xd3d4('0xc'),_0x1331a2,_0x628fd8,_0x2cb0a2,_0x41aa7c));}else{logger[_0xd3d4('0xd')](util[_0xd3d4('0xb')](_0xd3d4('0xe'),_0x1331a2,_0x628fd8,_0x39be57));}});}; \ No newline at end of file +var _0x013b=['shelljs','mustache','../../../../config/logger','exec','data2','data3','render','error','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x3b348f,_0x55dd28){var _0x2ae8af=function(_0x4d94e3){while(--_0x4d94e3){_0x3b348f['push'](_0x3b348f['shift']());}};_0x2ae8af(++_0x55dd28);}(_0x013b,0xe3));var _0xb013=function(_0x572438,_0x1b94fe){_0x572438=_0x572438-0x0;var _0xc6e9a7=_0x013b[_0x572438];return _0xc6e9a7;};'use strict';var util=require(_0xb013('0x0'));var sh=require(_0xb013('0x1'));var Mustache=require(_0xb013('0x2'));var logger=require(_0xb013('0x3'))('trigger');exports[_0xb013('0x4')]=function(_0x4d45c1,_0x1b76a0){var _0x1a3abe=_0x4d45c1[_0xb013('0x5')]?_0x4d45c1['data2']:'Script';var _0x456b60=_0x4d45c1[_0xb013('0x6')]?Mustache[_0xb013('0x7')](_0x4d45c1[_0xb013('0x6')],_0x1b76a0):_0x1b76a0;sh[_0xb013('0x4')](_0x456b60,function(_0x7c8a,_0x16b5f1,_0x5e0920){if(_0x7c8a!==0x0){logger[_0xb013('0x8')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1a3abe,_0x456b60,_0x7c8a,_0x5e0920));}else{logger[_0xb013('0x9')](util[_0xb013('0xa')](_0xb013('0xb'),_0x1a3abe,_0x456b60,_0x16b5f1));}});}; \ 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 4cced9c..318c366 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 _0x5909=['data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','then','isNil','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','render','error','stack','GET','DELETE','POST','PUT'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0x5909,0x14b));var _0x9590=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x5909[_0x3a8dc1];return _0x4b3595;};'use strict';var rp=require(_0x9590('0x0'));var util=require(_0x9590('0x1'));var _=require(_0x9590('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x9590('0x3'));exports[_0x9590('0x4')]=function(_0x585f53,_0x4d8a74){var _0x5cfea2,_0x16bf21;var _0x1e45af={'method':_0x585f53[_0x9590('0x5')][_0x9590('0x6')](),'uri':Mustache['render'](_0x585f53[_0x9590('0x7')],_0x4d8a74),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x585f53[_0x9590('0x8')])===_0x9590('0x9')&&parseInt(_0x585f53[_0x9590('0x8')])>=0x1&&parseInt(_0x585f53[_0x9590('0x8')])<=0xa?parseInt(_0x585f53[_0x9590('0x8')])*0x3e8:0x5*0x3e8};try{_0x1e45af[_0x9590('0xa')]=_0x585f53[_0x9590('0xb')]?JSON['parse'](Mustache[_0x9590('0xc')](_0x585f53[_0x9590('0xb')],_0x4d8a74)):{};}catch(_0x53b423){logger[_0x9590('0xd')](_0x53b423[_0x9590('0xe')]);}switch(_0x585f53['data1']['toUpperCase']()){case _0x9590('0xf'):case _0x9590('0x10'):_0x5cfea2=null;_0x1e45af['qs']=_0x4d8a74;break;case _0x9590('0x11'):case _0x9590('0x12'):if(_0x585f53[_0x9590('0x13')]){try{_0x5cfea2=JSON[_0x9590('0x14')](Mustache[_0x9590('0xc')](_0x585f53[_0x9590('0x13')],_0x4d8a74));_0x1e45af[_0x9590('0x15')]=_0x5cfea2;}catch(_0x383237){logger[_0x9590('0xd')](_0x383237['stack']);logger['error'](_0x9590('0x16'));}}else{_0x5cfea2=_0x4d8a74;_0x1e45af[_0x9590('0x15')]=_0x5cfea2;}break;}logger['info'](util[_0x9590('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x585f53['data1'],_0x585f53[_0x9590('0x7')],JSON[_0x9590('0x18')](_0x1e45af)));rp(_0x1e45af)[_0x9590('0x19')](function(_0x348db9){_0x5cfea2=!_[_0x9590('0x1a')](_0x5cfea2)?',\x20request\x20body:\x20'+_0x5cfea2:'';_0x16bf21=typeof _0x348db9['body']===_0x9590('0x1b')?JSON[_0x9590('0x18')](_0x348db9['body']):_0x348db9['body'];logger[_0x9590('0x1c')](util['format'](_0x9590('0x1d'),_0x585f53[_0x9590('0x5')],_0x585f53[_0x9590('0x7')],_0x348db9[_0x9590('0x1e')],_0x16bf21));})[_0x9590('0x1f')](function(_0x4671f9){logger[_0x9590('0xd')](util[_0x9590('0x17')](_0x9590('0x20'),_0x585f53['data1'],_0x585f53['data2'],_0x4671f9[_0x9590('0x1e')],_0x4671f9[_0x9590('0x21')],_0x4671f9[_0x9590('0x22')]));});}; \ No newline at end of file +var _0x69c0=[',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','number','headers','parse','data6','error','stack','toUpperCase','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data1','stringify','isNil'];(function(_0x136628,_0xdd3206){var _0x35aad7=function(_0x542332){while(--_0x542332){_0x136628['push'](_0x136628['shift']());}};_0x35aad7(++_0xdd3206);}(_0x69c0,0x6c));var _0x069c=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x69c0[_0x1f1a97];return _0x29fc6a;};'use strict';var rp=require(_0x069c('0x0'));var util=require(_0x069c('0x1'));var _=require(_0x069c('0x2'));var Mustache=require(_0x069c('0x3'));var logger=require(_0x069c('0x4'))(_0x069c('0x5'));exports[_0x069c('0x6')]=function(_0x3a7d01,_0x284f03){var _0x1ce77c,_0x2fd4b6;var _0x217c02={'method':_0x3a7d01['data1']['toUpperCase'](),'uri':Mustache[_0x069c('0x7')](_0x3a7d01[_0x069c('0x8')],_0x284f03),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3a7d01[_0x069c('0x9')])===_0x069c('0xa')&&parseInt(_0x3a7d01[_0x069c('0x9')])>=0x1&&parseInt(_0x3a7d01[_0x069c('0x9')])<=0xa?parseInt(_0x3a7d01['data5'])*0x3e8:0x5*0x3e8};try{_0x217c02[_0x069c('0xb')]=_0x3a7d01['data6']?JSON[_0x069c('0xc')](Mustache[_0x069c('0x7')](_0x3a7d01[_0x069c('0xd')],_0x284f03)):{};}catch(_0xe5e870){logger[_0x069c('0xe')](_0xe5e870[_0x069c('0xf')]);}switch(_0x3a7d01['data1'][_0x069c('0x10')]()){case _0x069c('0x11'):case'DELETE':_0x1ce77c=null;_0x217c02['qs']=_0x284f03;break;case _0x069c('0x12'):case _0x069c('0x13'):if(_0x3a7d01[_0x069c('0x14')]){try{_0x1ce77c=JSON['parse'](Mustache['render'](_0x3a7d01[_0x069c('0x14')],_0x284f03));_0x217c02[_0x069c('0x15')]=_0x1ce77c;}catch(_0x43bcc2){logger[_0x069c('0xe')](_0x43bcc2[_0x069c('0xf')]);logger[_0x069c('0xe')](_0x069c('0x16'));}}else{_0x1ce77c=_0x284f03;_0x217c02[_0x069c('0x15')]=_0x1ce77c;}break;}logger[_0x069c('0x17')](util[_0x069c('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3a7d01[_0x069c('0x19')],_0x3a7d01['data2'],JSON[_0x069c('0x1a')](_0x217c02)));rp(_0x217c02)['then'](function(_0x4a2935){_0x1ce77c=!_[_0x069c('0x1b')](_0x1ce77c)?_0x069c('0x1c')+_0x1ce77c:'';_0x2fd4b6=typeof _0x4a2935['body']===_0x069c('0x1d')?JSON[_0x069c('0x1a')](_0x4a2935['body']):_0x4a2935[_0x069c('0x15')];logger[_0x069c('0x17')](util[_0x069c('0x18')](_0x069c('0x1e'),_0x3a7d01['data1'],_0x3a7d01[_0x069c('0x8')],_0x4a2935[_0x069c('0x1f')],_0x2fd4b6));})[_0x069c('0x20')](function(_0x3e6765){logger['error'](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3a7d01[_0x069c('0x19')],_0x3a7d01[_0x069c('0x8')],_0x3e6765[_0x069c('0x1f')],_0x3e6765[_0x069c('0x21')],_0x3e6765['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 35d8fa2..403c427 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 _0x6e93=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x6e93,0x1e1));var _0x36e9=function(_0x1387d8,_0x43145d){_0x1387d8=_0x1387d8-0x0;var _0x20c70c=_0x6e93[_0x1387d8];return _0x20c70c;};'use strict';var jayson=require(_0x36e9('0x0'));var BPromise=require(_0x36e9('0x1'));var logger=require(_0x36e9('0x2'))(_0x36e9('0x3'));var client=jayson[_0x36e9('0x4')][_0x36e9('0x5')]({'port':0x2329});client[_0x36e9('0x6')]=function(_0x3c4678,_0x51bcda){return new BPromise(function(_0x28618b,_0x4711d7){return client[_0x36e9('0x7')](_0x3c4678,_0x51bcda)['then'](function(_0x255b21){logger[_0x36e9('0x8')](_0x36e9('0x9'),_0x36e9('0x3'),_0x3c4678,_0x51bcda,_0x255b21);if(_0x255b21[_0x36e9('0xa')]){logger[_0x36e9('0xa')](_0x36e9('0x9'),_0x36e9('0x3'),_0x3c4678,_0x255b21[_0x36e9('0xa')][_0x36e9('0xb')],_0x51bcda);return _0x4711d7(_0x255b21[_0x36e9('0xa')][_0x36e9('0xb')]);}else{return _0x28618b(_0x255b21[_0x36e9('0xc')]);}})[_0x36e9('0xd')](function(_0xec5fd7){logger[_0x36e9('0xa')](_0x36e9('0x9'),_0x36e9('0x3'),_0x3c4678,_0xec5fd7,_0x51bcda);return _0x4711d7(_0xec5fd7);});});};module[_0x36e9('0xe')]=client; \ No newline at end of file +var _0x2e96=['../../config/logger','routing','client','http','Request','then','debug','error','message','result','catch','rpc','jayson/promise'];(function(_0x315cae,_0x13c014){var _0x48cb27=function(_0x33c073){while(--_0x33c073){_0x315cae['push'](_0x315cae['shift']());}};_0x48cb27(++_0x13c014);}(_0x2e96,0x151));var _0x62e9=function(_0x4cc2fa,_0x30d2a2){_0x4cc2fa=_0x4cc2fa-0x0;var _0xde14fc=_0x2e96[_0x4cc2fa];return _0xde14fc;};'use strict';var jayson=require(_0x62e9('0x0'));var BPromise=require('bluebird');var logger=require(_0x62e9('0x1'))(_0x62e9('0x2'));var client=jayson[_0x62e9('0x3')][_0x62e9('0x4')]({'port':0x2329});client[_0x62e9('0x5')]=function(_0x1f2a91,_0x557a59){return new BPromise(function(_0x459d3a,_0x5d8eb1){return client['request'](_0x1f2a91,_0x557a59)[_0x62e9('0x6')](function(_0x325dec){logger[_0x62e9('0x7')]('rpc',_0x62e9('0x2'),_0x1f2a91,_0x557a59,_0x325dec);if(_0x325dec[_0x62e9('0x8')]){logger[_0x62e9('0x8')]('rpc',_0x62e9('0x2'),_0x1f2a91,_0x325dec[_0x62e9('0x8')][_0x62e9('0x9')],_0x557a59);return _0x5d8eb1(_0x325dec['error']['message']);}else{return _0x459d3a(_0x325dec[_0x62e9('0xa')]);}})[_0x62e9('0xb')](function(_0x2b5ef8){logger[_0x62e9('0x8')](_0x62e9('0xc'),_0x62e9('0x2'),_0x1f2a91,_0x2b5ef8,_0x557a59);return _0x5d8eb1(_0x2b5ef8);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index df039a8..1927caa 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 _0x571a=['refresh','mailAccounts','listen','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','getMailAccounts','then','initMailAccounts'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x571a,0x96));var _0xa571=function(_0x49c373,_0x1e47e1){_0x49c373=_0x49c373-0x0;var _0x57905f=_0x571a[_0x49c373];return _0x57905f;};'use strict';var server=require(_0xa571('0x0'));var Realtime=require(_0xa571('0x1'));var EmailChannel=require(_0xa571('0x2'));var mailAccount=require(_0xa571('0x3'));var setting=require(_0xa571('0x4'));var logger=require(_0xa571('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa571('0x6')]()['then'](mailAccount[_0xa571('0x7')]())[_0xa571('0x8')](realtime[_0xa571('0x9')]())[_0xa571('0x8')](function(){email[_0xa571('0xa')](realtime[_0xa571('0xb')]);return realtime;});}function main(){return server[_0xa571('0xc')](realtime,email)['then'](function(){return initRealtime();})[_0xa571('0x8')](function(){return setting['getSettings']();})['then'](function(_0x37b8f7){return setInterval(initRealtime,_0x37b8f7[_0xa571('0xd')]*0x3e8);})[_0xa571('0xe')](function(_0x3a345b){logger['error'](_0xa571('0xf'),_0x3a345b);});}main(); \ No newline at end of file +var _0x180f=['email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger'];(function(_0x2e4b9f,_0x478e27){var _0x3e8984=function(_0x23528f){while(--_0x23528f){_0x2e4b9f['push'](_0x2e4b9f['shift']());}};_0x3e8984(++_0x478e27);}(_0x180f,0x1b5));var _0xf180=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x180f[_0x2ef44b];return _0x2405b9;};'use strict';var server=require(_0xf180('0x0'));var Realtime=require(_0xf180('0x1'));var EmailChannel=require(_0xf180('0x2'));var mailAccount=require(_0xf180('0x3'));var setting=require('./rpc/setting');var logger=require(_0xf180('0x4'))(_0xf180('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf180('0x6')]()[_0xf180('0x7')](mailAccount[_0xf180('0x8')]())[_0xf180('0x7')](realtime[_0xf180('0x9')]())[_0xf180('0x7')](function(){email['refresh'](realtime[_0xf180('0xa')]);return realtime;});}function main(){return server[_0xf180('0xb')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xf180('0xc')]();})[_0xf180('0x7')](function(_0x4d4835){return setInterval(initRealtime,_0x4d4835[_0xf180('0xd')]*0x3e8);})[_0xf180('0xe')](function(_0x2b0065){logger[_0xf180('0xf')](_0xf180('0x10'),_0x2b0065);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6b18ffc..782a748 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 _0x7fd1=['handleImapError','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','Smtp','lastSync','then','verified','verify','exports','lodash','moment','ioredis','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error'];(function(_0x165c51,_0x389bb0){var _0x1434f2=function(_0x1fa079){while(--_0x1fa079){_0x165c51['push'](_0x165c51['shift']());}};_0x1434f2(++_0x389bb0);}(_0x7fd1,0xc4));var _0x17fd=function(_0x5d8e31,_0xa6e523){_0x5d8e31=_0x5d8e31-0x0;var _0x502059=_0x7fd1[_0x5d8e31];return _0x502059;};'use strict';var _=require(_0x17fd('0x0'));var moment=require(_0x17fd('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x17fd('0x2'));var config=require('../../../config/environment');var logger=require(_0x17fd('0x3'))(_0x17fd('0x4'));config['redis']=_[_0x17fd('0x5')](config['redis'],{'host':_0x17fd('0x6'),'port':0x18eb});var io=require(_0x17fd('0x7'))(new Redis(config[_0x17fd('0x8')]));var EmailImap=require(_0x17fd('0x9'));var EmailSmtp=require(_0x17fd('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xa57016){logger[_0x17fd('0xb')](_0x17fd('0xc'));this[_0x17fd('0xd')]=_0xa57016[_0x17fd('0xd')];this['imapAccounts']={};this[_0x17fd('0xe')]=new EmailSmtp();}EmailChannel[_0x17fd('0xf')][_0x17fd('0x10')]=function(_0x123d5b){var _0x6b60d5=this[_0x17fd('0xd')][_0x123d5b];var _0x1beb5c={'id':_0x6b60d5['id'],'name':_0x6b60d5[_0x17fd('0x11')],'key':_0x6b60d5[_0x17fd('0x12')],'active':_0x6b60d5[_0x17fd('0x13')],'Imap':{'status':_0x6b60d5[_0x17fd('0x14')][_0x17fd('0x15')],'messageStatus':_0x6b60d5[_0x17fd('0x14')][_0x17fd('0x16')],'total':_0x6b60d5[_0x17fd('0x14')]['total']}};if(_[_0x17fd('0x17')](md5Accounts[_0x123d5b])){md5Accounts[_0x123d5b]={};}var _0x101c47=md5(JSON[_0x17fd('0x18')](_0x1beb5c));if(md5Accounts[_0x123d5b][_0x17fd('0x19')]!==_0x101c47){md5Accounts[_0x123d5b][_0x17fd('0x19')]=_0x101c47;io[_0x17fd('0x10')](_0x17fd('0x1a'),_0x1beb5c);}};EmailChannel['prototype'][_0x17fd('0x1b')]=function(_0x16fb67){for(var _0x113b82 in _0x16fb67){if(_0x16fb67[_0x17fd('0x1c')](_0x113b82)){if(_0x16fb67[_0x113b82][_0x17fd('0x14')]&&_0x16fb67[_0x113b82]['active']){var _0x3df7d3=_0x16fb67[_0x113b82]['Imap'];if(!_0x3df7d3[_0x17fd('0x1d')]&&_0x16fb67[_0x113b82][_0x17fd('0x1e')]!==_0x17fd('0x1f'))_0x3df7d3[_0x17fd('0x1d')]=_0x16fb67[_0x113b82]['provider'];if(!this[_0x17fd('0x20')][_0x17fd('0x1c')](_0x3df7d3['id'])){this['imapAccounts'][_0x3df7d3['id']]=new EmailImap(_0x3df7d3,_0x16fb67[_0x113b82][_0x17fd('0x4')]);this['imapAccounts'][_0x3df7d3['id']]['on'](_0x17fd('0x21'),this[_0x17fd('0x22')]['bind'](this,_0x113b82));this[_0x17fd('0x20')][_0x3df7d3['id']]['on'](_0x17fd('0x4'),this[_0x17fd('0x23')][_0x17fd('0x24')](this,_0x113b82));this[_0x17fd('0x20')][_0x3df7d3['id']]['on'](_0x17fd('0x25'),this[_0x17fd('0x26')][_0x17fd('0x24')](this,_0x113b82));this['imapAccounts'][_0x3df7d3['id']]['on'](_0x17fd('0x27'),this[_0x17fd('0x28')]['bind'](this,_0x113b82));}}else{if(_[_0x17fd('0x17')](this[_0x17fd('0xd')][_0x113b82][_0x17fd('0x14')])){this['mailAccounts'][_0x113b82][_0x17fd('0x14')]={};}this['mailAccounts'][_0x113b82][_0x17fd('0x14')][_0x17fd('0x15')]='disabled';this[_0x17fd('0xd')][_0x113b82][_0x17fd('0x14')]['messageStatus']='';this[_0x17fd('0x10')](_0x113b82);}}}};EmailChannel[_0x17fd('0xf')]['handleImapBox']=function(_0x542e97,_0x22db8f){if(this[_0x17fd('0xd')][_0x542e97]){this[_0x17fd('0xd')][_0x542e97]['Imap'][_0x17fd('0x15')]=_0x17fd('0x29');this[_0x17fd('0xd')][_0x542e97]['Imap'][_0x17fd('0x16')]=_0x22db8f[_0x17fd('0x11')];if(_0x22db8f['messages']){this[_0x17fd('0xd')][_0x542e97][_0x17fd('0x14')][_0x17fd('0x2a')]=_0x22db8f[_0x17fd('0x2b')]['total'];}return this[_0x17fd('0x10')](_0x542e97);}};EmailChannel[_0x17fd('0xf')][_0x17fd('0x23')]=function(_0x1ea1a1,_0x417472){logger['info'](_0x17fd('0x2c'),_0x417472[_0x17fd('0x2d')],_0x417472[_0x17fd('0x2e')],_0x417472['from'],_0x1ea1a1);if(this[_0x17fd('0xd')][_0x1ea1a1]){return mailAccount[_0x17fd('0x2f')](_0x1ea1a1,_0x417472)['then'](function(_0x28038f){if(_0x28038f){logger[_0x17fd('0xb')](_0x17fd('0x30'));}})[_0x17fd('0x31')](function(_0x477a6f){logger[_0x17fd('0x27')](_0x17fd('0x32'),JSON[_0x17fd('0x18')](_0x477a6f));});}};EmailChannel[_0x17fd('0xf')]['handleImapEnd']=function(_0x4250ee){if(this[_0x17fd('0xd')][_0x4250ee]&&this['mailAccounts'][_0x4250ee][_0x17fd('0x14')]){if(this['imapAccounts'][this[_0x17fd('0xd')][_0x4250ee][_0x17fd('0x14')]['id']]){delete this[_0x17fd('0x20')][this[_0x17fd('0xd')][_0x4250ee][_0x17fd('0x14')]['id']];}this[_0x17fd('0xd')][_0x4250ee][_0x17fd('0x14')]['lastSync']=moment();this[_0x17fd('0x10')](_0x4250ee);}};EmailChannel[_0x17fd('0xf')][_0x17fd('0x28')]=function(_0x51be76,_0x2fe0d2){if(this['mailAccounts'][_0x51be76]){this[_0x17fd('0xd')][_0x51be76]['Imap'][_0x17fd('0x15')]=_0x17fd('0x27');this[_0x17fd('0xd')][_0x51be76][_0x17fd('0x14')][_0x17fd('0x16')]=_0x2fe0d2;return this[_0x17fd('0x10')](_0x51be76);}};EmailChannel[_0x17fd('0xf')][_0x17fd('0x33')]=function(_0x424c72,_0x1c03a5){return this[_0x17fd('0xe')][_0x17fd('0x34')](_0x424c72,_0x1c03a5);};EmailChannel[_0x17fd('0xf')]['verifySmtp']=function(_0x29c3c5){var _0x3a7086=this;if(this[_0x17fd('0xd')][_0x29c3c5['id']]){if(_[_0x17fd('0x17')](this[_0x17fd('0xd')][_0x29c3c5['id']]['Smtp'])){this[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')]={};}this[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x36')]=moment();return new BPromise(function(_0x255b56,_0x118e2c){return _0x3a7086[_0x17fd('0xe')]['verify'](_0x29c3c5)[_0x17fd('0x37')](function(_0x3f3c5a){_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x15')]=_0x17fd('0x38');_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x16')]='';_0x3a7086[_0x17fd('0x10')](_0x29c3c5['id']);_0x255b56(_0x3f3c5a);})[_0x17fd('0x31')](function(_0x56db9b){_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']]['Smtp'][_0x17fd('0x15')]=_0x17fd('0x27');_0x3a7086[_0x17fd('0xd')][_0x29c3c5['id']][_0x17fd('0x35')][_0x17fd('0x16')]=_0x56db9b;_0x3a7086[_0x17fd('0x10')](_0x29c3c5['id']);_0x118e2c(_0x56db9b);});});}return this['smtp'][_0x17fd('0x39')](_0x29c3c5);};module[_0x17fd('0x3a')]=EmailChannel; \ No newline at end of file +var _0xded2=['handleImapBox','bind','end','handleImapEnd','error','handleImapError','status','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','md5','ioredis','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','Imap','messageStatus','isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','box'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xded2,0xeb));var _0x2ded=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xded2[_0x1d211b];return _0x47c88b;};'use strict';var _=require(_0x2ded('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x2ded('0x1'));var Redis=require(_0x2ded('0x2'));var config=require('../../../config/environment');var logger=require(_0x2ded('0x3'))(_0x2ded('0x4'));config['redis']=_[_0x2ded('0x5')](config[_0x2ded('0x6')],{'host':_0x2ded('0x7'),'port':0x18eb});var io=require(_0x2ded('0x8'))(new Redis(config[_0x2ded('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x2ded('0x9'));var mailAccount=require(_0x2ded('0xa'));var md5Accounts={};function EmailChannel(_0x28a547){logger[_0x2ded('0xb')](_0x2ded('0xc'));this[_0x2ded('0xd')]=_0x28a547['mailAccounts'];this[_0x2ded('0xe')]={};this[_0x2ded('0xf')]=new EmailSmtp();}EmailChannel[_0x2ded('0x10')]['emit']=function(_0xcf6f5){var _0x5780c3=this[_0x2ded('0xd')][_0xcf6f5];var _0x5adf2d={'id':_0x5780c3['id'],'name':_0x5780c3[_0x2ded('0x11')],'key':_0x5780c3[_0x2ded('0x12')],'active':_0x5780c3['active'],'Imap':{'status':_0x5780c3[_0x2ded('0x13')]['status'],'messageStatus':_0x5780c3[_0x2ded('0x13')][_0x2ded('0x14')],'total':_0x5780c3[_0x2ded('0x13')]['total']}};if(_[_0x2ded('0x15')](md5Accounts[_0xcf6f5])){md5Accounts[_0xcf6f5]={};}var _0x45c3df=md5(JSON[_0x2ded('0x16')](_0x5adf2d));if(md5Accounts[_0xcf6f5][_0x2ded('0x1')]!==_0x45c3df){md5Accounts[_0xcf6f5][_0x2ded('0x1')]=_0x45c3df;io[_0x2ded('0x17')](_0x2ded('0x18'),_0x5adf2d);}};EmailChannel[_0x2ded('0x10')][_0x2ded('0x19')]=function(_0x1f7200){for(var _0x2efd78 in _0x1f7200){if(_0x1f7200[_0x2ded('0x1a')](_0x2efd78)){if(_0x1f7200[_0x2efd78][_0x2ded('0x13')]&&_0x1f7200[_0x2efd78]['active']){var _0x9c0c1c=_0x1f7200[_0x2efd78]['Imap'];if(!_0x9c0c1c[_0x2ded('0x1b')]&&_0x1f7200[_0x2efd78][_0x2ded('0x1c')]!=='custom')_0x9c0c1c[_0x2ded('0x1b')]=_0x1f7200[_0x2efd78][_0x2ded('0x1c')];if(!this[_0x2ded('0xe')][_0x2ded('0x1a')](_0x9c0c1c['id'])){this[_0x2ded('0xe')][_0x9c0c1c['id']]=new EmailImap(_0x9c0c1c,_0x1f7200[_0x2efd78][_0x2ded('0x4')]);this[_0x2ded('0xe')][_0x9c0c1c['id']]['on'](_0x2ded('0x1d'),this[_0x2ded('0x1e')][_0x2ded('0x1f')](this,_0x2efd78));this[_0x2ded('0xe')][_0x9c0c1c['id']]['on'](_0x2ded('0x4'),this['handleImapEmail']['bind'](this,_0x2efd78));this[_0x2ded('0xe')][_0x9c0c1c['id']]['on'](_0x2ded('0x20'),this[_0x2ded('0x21')]['bind'](this,_0x2efd78));this[_0x2ded('0xe')][_0x9c0c1c['id']]['on'](_0x2ded('0x22'),this[_0x2ded('0x23')][_0x2ded('0x1f')](this,_0x2efd78));}}else{if(_[_0x2ded('0x15')](this[_0x2ded('0xd')][_0x2efd78][_0x2ded('0x13')])){this[_0x2ded('0xd')][_0x2efd78][_0x2ded('0x13')]={};}this['mailAccounts'][_0x2efd78][_0x2ded('0x13')][_0x2ded('0x24')]='disabled';this[_0x2ded('0xd')][_0x2efd78][_0x2ded('0x13')]['messageStatus']='';this[_0x2ded('0x17')](_0x2efd78);}}}};EmailChannel['prototype'][_0x2ded('0x1e')]=function(_0x52b804,_0x111a37){if(this[_0x2ded('0xd')][_0x52b804]){this[_0x2ded('0xd')][_0x52b804][_0x2ded('0x13')][_0x2ded('0x24')]=_0x2ded('0x25');this[_0x2ded('0xd')][_0x52b804][_0x2ded('0x13')][_0x2ded('0x14')]=_0x111a37['name'];if(_0x111a37['messages']){this['mailAccounts'][_0x52b804][_0x2ded('0x13')]['total']=_0x111a37[_0x2ded('0x26')][_0x2ded('0x27')];}return this['emit'](_0x52b804);}};EmailChannel[_0x2ded('0x10')]['handleImapEmail']=function(_0x1fa869,_0x4034b1){logger[_0x2ded('0xb')](_0x2ded('0x28'),_0x4034b1['firstName'],_0x4034b1['lastName'],_0x4034b1[_0x2ded('0x29')],_0x1fa869);if(this[_0x2ded('0xd')][_0x1fa869]){return mailAccount[_0x2ded('0x2a')](_0x1fa869,_0x4034b1)[_0x2ded('0x2b')](function(_0x195795){if(_0x195795){logger['info'](_0x2ded('0x2c'));}})[_0x2ded('0x2d')](function(_0x4077f2){logger[_0x2ded('0x22')](_0x2ded('0x2e'),JSON['stringify'](_0x4077f2));});}};EmailChannel[_0x2ded('0x10')]['handleImapEnd']=function(_0x5097b5){if(this['mailAccounts'][_0x5097b5]&&this[_0x2ded('0xd')][_0x5097b5][_0x2ded('0x13')]){if(this['imapAccounts'][this['mailAccounts'][_0x5097b5][_0x2ded('0x13')]['id']]){delete this[_0x2ded('0xe')][this[_0x2ded('0xd')][_0x5097b5][_0x2ded('0x13')]['id']];}this['mailAccounts'][_0x5097b5]['Imap']['lastSync']=moment();this[_0x2ded('0x17')](_0x5097b5);}};EmailChannel['prototype'][_0x2ded('0x23')]=function(_0x33f899,_0x4a28a5){if(this[_0x2ded('0xd')][_0x33f899]){this['mailAccounts'][_0x33f899]['Imap']['status']=_0x2ded('0x22');this[_0x2ded('0xd')][_0x33f899][_0x2ded('0x13')][_0x2ded('0x14')]=_0x4a28a5;return this[_0x2ded('0x17')](_0x33f899);}};EmailChannel[_0x2ded('0x10')][_0x2ded('0x2f')]=function(_0x39b491,_0x20b441){return this[_0x2ded('0xf')][_0x2ded('0x30')](_0x39b491,_0x20b441);};EmailChannel[_0x2ded('0x10')][_0x2ded('0x31')]=function(_0x12c300){var _0x5422bb=this;if(this[_0x2ded('0xd')][_0x12c300['id']]){if(_[_0x2ded('0x15')](this['mailAccounts'][_0x12c300['id']][_0x2ded('0x32')])){this[_0x2ded('0xd')][_0x12c300['id']][_0x2ded('0x32')]={};}this[_0x2ded('0xd')][_0x12c300['id']][_0x2ded('0x32')]['lastSync']=moment();return new BPromise(function(_0x4b6a48,_0x3802b5){return _0x5422bb[_0x2ded('0xf')][_0x2ded('0x33')](_0x12c300)[_0x2ded('0x2b')](function(_0x1d5dd1){_0x5422bb[_0x2ded('0xd')][_0x12c300['id']]['Smtp'][_0x2ded('0x24')]='verified';_0x5422bb['mailAccounts'][_0x12c300['id']][_0x2ded('0x32')][_0x2ded('0x14')]='';_0x5422bb[_0x2ded('0x17')](_0x12c300['id']);_0x4b6a48(_0x1d5dd1);})[_0x2ded('0x2d')](function(_0x15c4fd){_0x5422bb[_0x2ded('0xd')][_0x12c300['id']]['Smtp']['status']='error';_0x5422bb['mailAccounts'][_0x12c300['id']]['Smtp'][_0x2ded('0x14')]=_0x15c4fd;_0x5422bb[_0x2ded('0x17')](_0x12c300['id']);_0x3802b5(_0x15c4fd);});});}return this['smtp'][_0x2ded('0x33')](_0x12c300);};module[_0x2ded('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 9590bd4..777d50a 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 _0x524e=['mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','data5','password','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','message','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','upperFirst','exports','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x524e,0x15e));var _0xe524=function(_0x12d02d,_0x17f40a){_0x12d02d=_0x12d02d-0x0;var _0x1c8e08=_0x524e[_0x12d02d];return _0x1c8e08;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0xe524('0x0'));var simpleParser=require(_0xe524('0x1'))[_0xe524('0x2')];var Iconv=require(_0xe524('0x3'))[_0xe524('0x4')];var EventEmitter=require(_0xe524('0x5'))[_0xe524('0x6')];var utils=require(_0xe524('0x7'));var logger=require(_0xe524('0x8'))(_0xe524('0x9'));function EmailImap(_0x4f75d6,_0xaaeaa9){this[_0xe524('0xa')]=_0xe524('0xb');this['account']=this[_0xe524('0xc')](_0x4f75d6,_0xaaeaa9);this[_0xe524('0x0')]=new Imap(this[_0xe524('0xd')]);this[_0xe524('0x0')][_0xe524('0xe')](_0xe524('0xf'),this[_0xe524('0x10')][_0xe524('0x11')](this));this[_0xe524('0x0')][_0xe524('0xe')](_0xe524('0x12'),this[_0xe524('0x13')][_0xe524('0x11')](this));this[_0xe524('0x0')]['on'](_0xe524('0x14'),this[_0xe524('0x15')]['bind'](this));this['imap'][_0xe524('0x16')]();}util[_0xe524('0x17')](EmailImap,EventEmitter);EmailImap[_0xe524('0x18')][_0xe524('0xc')]=function(_0x20a852,_0x57c1b6){var _0x12ff75={'connTimeout':_0x20a852['connTimeout']?_0x20a852[_0xe524('0x19')]*0x3e8:0x2710,'authTimeout':_0x20a852[_0xe524('0x1a')]?_0x20a852['authTimeout']*0x3e8:0x1388};if(_0x20a852[_0xe524('0x1b')]){_0x12ff75['user']=_0x20a852[_0xe524('0x1c')];_0x12ff75['email']=_0x57c1b6||_0x20a852[_0xe524('0x1c')]||'anonymous@xcally.com';if(_0x20a852['modernAuthentication']){_0x12ff75['xoauth2']=utils[_0xe524('0x1d')](_0x20a852['CloudProvider'][_0xe524('0x1e')],_0x20a852[_0xe524('0x1c')]);}else{_0x12ff75[_0xe524('0x1f')]=_0x20a852[_0xe524('0x1f')];}}else{if(_0x20a852['authentication']){_0x12ff75[_0xe524('0x1c')]=_0x20a852[_0xe524('0x1c')];_0x12ff75['password']=_0x20a852[_0xe524('0x1f')];}}_0x12ff75[_0xe524('0x20')]=_0x20a852[_0xe524('0x20')];_0x12ff75[_0xe524('0x21')]=_0x20a852[_0xe524('0x21')]||0x3e1;if(_0x20a852[_0xe524('0x22')]){_0x12ff75[_0xe524('0x22')]=!![];}else{_0x12ff75[_0xe524('0x22')]=![];_0x12ff75[_0xe524('0x23')]='required';}return _0x12ff75;};EmailImap[_0xe524('0x18')]['handleReady']=function(){this['imap'][_0xe524('0x24')](this[_0xe524('0xa')],![],this[_0xe524('0x25')][_0xe524('0x11')](this));};EmailImap['prototype'][_0xe524('0x25')]=function(_0x4a03bc,_0x17e245){if(_0x4a03bc){this[_0xe524('0x15')](_0x4a03bc,!![]);}else{this[_0xe524('0x26')](_0xe524('0x27'),_0x17e245);this[_0xe524('0x28')]();}};EmailImap[_0xe524('0x18')][_0xe524('0x29')]=function(_0x583cc3){if(_0x583cc3){this['handleError'](_0x583cc3,!![]);}else{this[_0xe524('0x0')][_0xe524('0x12')]();}};EmailImap[_0xe524('0x18')][_0xe524('0x28')]=function(){this[_0xe524('0x0')]['search'](['UNSEEN'],this[_0xe524('0x2a')][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')][_0xe524('0x2a')]=function(_0x25c0a1,_0x517fa0){if(_0x25c0a1){this[_0xe524('0x15')](_0x25c0a1,!![]);}else{if(_0x517fa0[_0xe524('0x2b')]){try{var _0x4a4e15=this['imap'][_0xe524('0x2c')](_0x517fa0,{'bodies':'','markSeen':!![]});_0x4a4e15['on'](_0xe524('0x2d'),this['handleFetchMessage'][_0xe524('0x11')](this));_0x4a4e15['once'](_0xe524('0x14'),this['handleFetchError'][_0xe524('0x11')](this));_0x4a4e15[_0xe524('0xe')](_0xe524('0x12'),this['handleFetchEnd'][_0xe524('0x11')](this));}catch(_0x5238c9){logger[_0xe524('0x14')](_0x5238c9);}}else{this[_0xe524('0x0')][_0xe524('0x2e')](!![],this['handleCloseBox'][_0xe524('0x11')](this));}}};EmailImap[_0xe524('0x18')]['handleFetchMessage']=function(_0x27817e){_0x27817e['on'](_0xe524('0x2f'),this[_0xe524('0x30')][_0xe524('0x11')](this));_0x27817e['once'](_0xe524('0x31'),this[_0xe524('0x32')][_0xe524('0x11')](this));_0x27817e[_0xe524('0xe')](_0xe524('0x12'),this[_0xe524('0x33')][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')]['handleMessageBody']=function(_0x150a9f){simpleParser(_0x150a9f,{'Iconv':Iconv},this['handleSimpleParser'][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0xe524('0x18')]['handleMessageEnd']=function(){};EmailImap[_0xe524('0x18')][_0xe524('0x34')]=function(_0x38758e,_0x3103e9){if(_0x38758e){logger[_0xe524('0x14')](_0x38758e);}else{var _0x10f911=this;utils[_0xe524('0x35')](this[_0xe524('0xd')],_0x3103e9,function(_0x5e8e64){_0x10f911[_0xe524('0x26')](_0xe524('0x9'),_0x5e8e64);});}};EmailImap[_0xe524('0x18')][_0xe524('0x36')]=function(){this[_0xe524('0x0')][_0xe524('0x2e')](!![],this[_0xe524('0x29')][_0xe524('0x11')](this));};EmailImap['prototype'][_0xe524('0x37')]=function(_0x849307){this[_0xe524('0x15')](_0x849307);this['imap'][_0xe524('0x2e')](!![],this['handleCloseBox'][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')][_0xe524('0x13')]=function(){this[_0xe524('0x26')](_0xe524('0x12'));};EmailImap[_0xe524('0x18')][_0xe524('0x15')]=function(_0x52cd0e,_0x8969fb){logger[_0xe524('0x14')](_0xe524('0x15'),this[_0xe524('0xd')][_0xe524('0x9')],JSON[_0xe524('0x38')](_0x52cd0e));var _0x4a4a16='';if(_0x52cd0e){if(_0x52cd0e[_0xe524('0x39')]){_0x4a4a16=_0x52cd0e[_0xe524('0x39')];}else{for(var _0x3fe124 in _0x52cd0e){if(_0x52cd0e['hasOwnProperty'](_0x3fe124)){_0x4a4a16+=_[_0xe524('0x3a')](_0x3fe124)+':\x20'+_0x52cd0e[_0x3fe124]+'\x0a';}}}}if(_0x8969fb){this['imap']['end']();}else{this[_0xe524('0x26')](_0xe524('0x14'),_0x4a4a16);this['emit'](_0xe524('0x12'));}};module[_0xe524('0x3b')]=EmailImap; \ No newline at end of file +var _0xd9eb=['stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','required','openBox','handleOpenBox','emit','readUnseen','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','error','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleCloseBox'];(function(_0x2c59d4,_0x45d4ca){var _0x1afe54=function(_0x1db9de){while(--_0x1db9de){_0x2c59d4['push'](_0x2c59d4['shift']());}};_0x1afe54(++_0x45d4ca);}(_0xd9eb,0xca));var _0xbd9e=function(_0x450076,_0x10983b){_0x450076=_0x450076-0x0;var _0x2029cc=_0xd9eb[_0x450076];return _0x2029cc;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var Imap=require(_0xbd9e('0x2'));var simpleParser=require(_0xbd9e('0x3'))[_0xbd9e('0x4')];var Iconv=require(_0xbd9e('0x5'))[_0xbd9e('0x6')];var EventEmitter=require(_0xbd9e('0x7'))[_0xbd9e('0x8')];var utils=require(_0xbd9e('0x9'));var logger=require(_0xbd9e('0xa'))(_0xbd9e('0xb'));function EmailImap(_0x20c36a,_0x4ade3f){this[_0xbd9e('0xc')]=_0xbd9e('0xd');this[_0xbd9e('0xe')]=this[_0xbd9e('0xf')](_0x20c36a,_0x4ade3f);this[_0xbd9e('0x2')]=new Imap(this[_0xbd9e('0xe')]);this[_0xbd9e('0x2')][_0xbd9e('0x10')](_0xbd9e('0x11'),this[_0xbd9e('0x12')][_0xbd9e('0x13')](this));this[_0xbd9e('0x2')]['once'](_0xbd9e('0x14'),this[_0xbd9e('0x15')]['bind'](this));this[_0xbd9e('0x2')]['on']('error',this[_0xbd9e('0x16')][_0xbd9e('0x13')](this));this[_0xbd9e('0x2')][_0xbd9e('0x17')]();}util[_0xbd9e('0x18')](EmailImap,EventEmitter);EmailImap[_0xbd9e('0x19')][_0xbd9e('0xf')]=function(_0x261f51,_0x47e6a0){var _0x3c56bd={'connTimeout':_0x261f51[_0xbd9e('0x1a')]?_0x261f51[_0xbd9e('0x1a')]*0x3e8:0x2710,'authTimeout':_0x261f51[_0xbd9e('0x1b')]?_0x261f51[_0xbd9e('0x1b')]*0x3e8:0x1388};if(_0x261f51[_0xbd9e('0x1c')]){_0x3c56bd[_0xbd9e('0x1d')]=_0x261f51[_0xbd9e('0x1d')];_0x3c56bd[_0xbd9e('0xb')]=_0x47e6a0||_0x261f51[_0xbd9e('0x1d')]||_0xbd9e('0x1e');if(_0x261f51['modernAuthentication']){_0x3c56bd[_0xbd9e('0x1f')]=utils[_0xbd9e('0x20')](_0x261f51[_0xbd9e('0x21')][_0xbd9e('0x22')],_0x261f51[_0xbd9e('0x1d')]);}else{_0x3c56bd['password']=_0x261f51[_0xbd9e('0x23')];}}else{if(_0x261f51[_0xbd9e('0x24')]){_0x3c56bd[_0xbd9e('0x1d')]=_0x261f51[_0xbd9e('0x1d')];_0x3c56bd[_0xbd9e('0x23')]=_0x261f51['password'];}}_0x3c56bd[_0xbd9e('0x25')]=_0x261f51['host'];_0x3c56bd['port']=_0x261f51[_0xbd9e('0x26')]||0x3e1;if(_0x261f51[_0xbd9e('0x27')]){_0x3c56bd[_0xbd9e('0x27')]=!![];}else{_0x3c56bd[_0xbd9e('0x27')]=![];_0x3c56bd['autotls']=_0xbd9e('0x28');}return _0x3c56bd;};EmailImap[_0xbd9e('0x19')]['handleReady']=function(){this['imap'][_0xbd9e('0x29')](this[_0xbd9e('0xc')],![],this[_0xbd9e('0x2a')][_0xbd9e('0x13')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x5d82ff,_0x3031af){if(_0x5d82ff){this['handleError'](_0x5d82ff,!![]);}else{this[_0xbd9e('0x2b')]('box',_0x3031af);this[_0xbd9e('0x2c')]();}};EmailImap[_0xbd9e('0x19')]['handleCloseBox']=function(_0x469153){if(_0x469153){this[_0xbd9e('0x16')](_0x469153,!![]);}else{this[_0xbd9e('0x2')][_0xbd9e('0x14')]();}};EmailImap[_0xbd9e('0x19')][_0xbd9e('0x2c')]=function(){this[_0xbd9e('0x2')]['search']([_0xbd9e('0x2d')],this['handleReadUnseen'][_0xbd9e('0x13')](this));};EmailImap['prototype'][_0xbd9e('0x2e')]=function(_0x4289aa,_0x5485ec){if(_0x4289aa){this[_0xbd9e('0x16')](_0x4289aa,!![]);}else{if(_0x5485ec[_0xbd9e('0x2f')]){try{var _0x47efbe=this[_0xbd9e('0x2')][_0xbd9e('0x30')](_0x5485ec,{'bodies':'','markSeen':!![]});_0x47efbe['on']('message',this[_0xbd9e('0x31')][_0xbd9e('0x13')](this));_0x47efbe[_0xbd9e('0x10')]('error',this[_0xbd9e('0x32')][_0xbd9e('0x13')](this));_0x47efbe[_0xbd9e('0x10')](_0xbd9e('0x14'),this['handleFetchEnd']['bind'](this));}catch(_0x55b09e){logger[_0xbd9e('0x33')](_0x55b09e);}}else{this['imap'][_0xbd9e('0x34')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0xbd9e('0x19')]['handleFetchMessage']=function(_0x360784){_0x360784['on'](_0xbd9e('0x35'),this[_0xbd9e('0x36')][_0xbd9e('0x13')](this));_0x360784[_0xbd9e('0x10')](_0xbd9e('0x37'),this['handleMessageAttributes'][_0xbd9e('0x13')](this));_0x360784['once'](_0xbd9e('0x14'),this['handleMessageEnd']['bind'](this));};EmailImap['prototype'][_0xbd9e('0x36')]=function(_0x4859e7){simpleParser(_0x4859e7,{'Iconv':Iconv},this['handleSimpleParser'][_0xbd9e('0x13')](this));};EmailImap['prototype'][_0xbd9e('0x38')]=function(){};EmailImap['prototype'][_0xbd9e('0x39')]=function(){};EmailImap[_0xbd9e('0x19')][_0xbd9e('0x3a')]=function(_0x2b86a3,_0xa47f29){if(_0x2b86a3){logger['error'](_0x2b86a3);}else{var _0x2d4ad0=this;utils[_0xbd9e('0x3b')](this['account'],_0xa47f29,function(_0x24eb19){_0x2d4ad0[_0xbd9e('0x2b')](_0xbd9e('0xb'),_0x24eb19);});}};EmailImap[_0xbd9e('0x19')][_0xbd9e('0x3c')]=function(){this['imap'][_0xbd9e('0x34')](!![],this[_0xbd9e('0x3d')][_0xbd9e('0x13')](this));};EmailImap[_0xbd9e('0x19')][_0xbd9e('0x32')]=function(_0x221182){this['handleError'](_0x221182);this[_0xbd9e('0x2')][_0xbd9e('0x34')](!![],this[_0xbd9e('0x3d')]['bind'](this));};EmailImap[_0xbd9e('0x19')][_0xbd9e('0x15')]=function(){this['emit']('end');};EmailImap['prototype'][_0xbd9e('0x16')]=function(_0xb4e570,_0x547885){logger[_0xbd9e('0x33')](_0xbd9e('0x16'),this[_0xbd9e('0xe')][_0xbd9e('0xb')],JSON[_0xbd9e('0x3e')](_0xb4e570));var _0x45d9fc='';if(_0xb4e570){if(_0xb4e570[_0xbd9e('0x3f')]){_0x45d9fc=_0xb4e570[_0xbd9e('0x3f')];}else{for(var _0x47b980 in _0xb4e570){if(_0xb4e570[_0xbd9e('0x40')](_0x47b980)){_0x45d9fc+=_[_0xbd9e('0x41')](_0x47b980)+':\x20'+_0xb4e570[_0x47b980]+'\x0a';}}}}if(_0x547885){this[_0xbd9e('0x2')][_0xbd9e('0x14')]();}else{this['emit']('error',_0x45d9fc);this[_0xbd9e('0x2b')](_0xbd9e('0x14'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 25a0bdb..be742ee 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 _0xbbcb=['sendMail','verify','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x153588,_0x190799){var _0x4af2a4=function(_0x15e8ec){while(--_0x15e8ec){_0x153588['push'](_0x153588['shift']());}};_0x4af2a4(++_0x190799);}(_0xbbcb,0x177));var _0xbbbc=function(_0x50609f,_0x5a23af){_0x50609f=_0x50609f-0x0;var _0x20a2e4=_0xbbcb[_0x50609f];return _0x20a2e4;};'use strict';var nodemailer=require(_0xbbbc('0x0'));var inlineBase64=require(_0xbbbc('0x1'));function EmailSmtp(){}EmailSmtp[_0xbbbc('0x2')][_0xbbbc('0x3')]=function(_0x5d1e0c,_0x5038a3){return new Promise(function(_0x5e709c,_0x1c7ae0){var _0x20b141=nodemailer[_0xbbbc('0x4')](_0x5d1e0c);_0x20b141['use']('compile',inlineBase64());_0x20b141[_0xbbbc('0x5')](_0x5038a3,function(_0x4d6ac3,_0x14eb25){if(_0x4d6ac3){_0x1c7ae0(_0x4d6ac3['toString']());}else{_0x5e709c(_0x14eb25);}});});};EmailSmtp[_0xbbbc('0x2')][_0xbbbc('0x6')]=function(_0x10143a){return new Promise(function(_0x43c68e,_0x14f262){var _0x432269=nodemailer[_0xbbbc('0x4')](_0x10143a);_0x432269[_0xbbbc('0x6')](function(_0x26d16e,_0x16eb49){if(_0x26d16e){_0x14f262(_0x26d16e[_0xbbbc('0x7')]());}else{if(_0x16eb49){_0x43c68e(_0x16eb49);}else{_0x14f262(_0xbbbc('0x8'));}}});});};module[_0xbbbc('0x9')]=EmailSmtp; \ No newline at end of file +var _0x0aec=['send','use','compile','sendMail','toString','verify','createTransport','exports','nodemailer','prototype'];(function(_0x22291e,_0x4b0d59){var _0x3cd8d9=function(_0x59dd5a){while(--_0x59dd5a){_0x22291e['push'](_0x22291e['shift']());}};_0x3cd8d9(++_0x4b0d59);}(_0x0aec,0x102));var _0xc0ae=function(_0x1ab06d,_0x2e2300){_0x1ab06d=_0x1ab06d-0x0;var _0x3645cf=_0x0aec[_0x1ab06d];return _0x3645cf;};'use strict';var nodemailer=require(_0xc0ae('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xc0ae('0x1')][_0xc0ae('0x2')]=function(_0x33ce9c,_0x284dc7){return new Promise(function(_0x20ddd0,_0x1b097c){var _0x15403c=nodemailer['createTransport'](_0x33ce9c);_0x15403c[_0xc0ae('0x3')](_0xc0ae('0x4'),inlineBase64());_0x15403c[_0xc0ae('0x5')](_0x284dc7,function(_0x5ccfd1,_0x2b0443){if(_0x5ccfd1){_0x1b097c(_0x5ccfd1[_0xc0ae('0x6')]());}else{_0x20ddd0(_0x2b0443);}});});};EmailSmtp['prototype'][_0xc0ae('0x7')]=function(_0x4e8864){return new Promise(function(_0x239357,_0x506714){var _0x5cd8c9=nodemailer[_0xc0ae('0x8')](_0x4e8864);_0x5cd8c9['verify'](function(_0x356690,_0x16cd77){if(_0x356690){_0x506714(_0x356690['toString']());}else{if(_0x16cd77){_0x239357(_0x16cd77);}else{_0x506714('Not\x20verifired');}}});});};module[_0xc0ae('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 bc7314a..38a6a40 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 _0x7a9d=['application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','generate','html','test','includes','push','replace','_IMG','\x20[Attachment:\x20','\x20]','body','message','originTo','originCc','bcc','attachments','attach','attachment','attachment-','format','%s-%s','join','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter'];(function(_0x2f83ff,_0x26e088){var _0x33af8f=function(_0x3afa08){while(--_0x3afa08){_0x2f83ff['push'](_0x2f83ff['shift']());}};_0x33af8f(++_0x26e088);}(_0x7a9d,0xe9));var _0xd7a9=function(_0x5b201e,_0x191138){_0x5b201e=_0x5b201e-0x0;var _0x2ffc51=_0x7a9d[_0x5b201e];return _0x2ffc51;};'use strict';var _=require(_0xd7a9('0x0'));var moment=require(_0xd7a9('0x1'));var random=require(_0xd7a9('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0xd7a9('0x3'));var logger=require(_0xd7a9('0x4'))(_0xd7a9('0x5'));var config=require(_0xd7a9('0x6'));function getAddress(_0x4ec0f9){var _0xbe9bbb=_[_0xd7a9('0x7')](_0x4ec0f9[_0xd7a9('0x8')]);return _0xbe9bbb&&_0xbe9bbb[_0xd7a9('0x9')]?_0xbe9bbb[_0xd7a9('0x9')]:_0xd7a9('0xa')+random['generate'](0x6)+_0xd7a9('0xb');}function getFirstName(_0x13f00e){var _0xf167a3=_[_0xd7a9('0x7')](_0x13f00e[_0xd7a9('0x8')]);if(_0xf167a3&&_0xf167a3['name']){if(_0xf167a3[_0xd7a9('0xc')]==_0xf167a3[_0xd7a9('0x9')]){return _0xf167a3['name'][_0xd7a9('0xd')](0x0,_0xf167a3[_0xd7a9('0xc')][_0xd7a9('0xe')]('@'));}var _0x3a7124=_0xf167a3['name'][_0xd7a9('0xf')](/\s+/);return _0x3a7124[_0xd7a9('0x10')]>0x1?_0x3a7124[_0xd7a9('0x11')](0x0,-0x1)['join']('\x20'):_0xf167a3['name'];}return _0xd7a9('0x12');}function getLastName(_0x47bcc0){var _0x368ad9=_['head'](_0x47bcc0['value']);if(_0x368ad9&&_0x368ad9[_0xd7a9('0xc')]){var _0x3b5439=_0x368ad9[_0xd7a9('0xc')][_0xd7a9('0xf')](/\s+/);return _0x3b5439[_0xd7a9('0x10')]>0x1?_0x3b5439[_0xd7a9('0x13')]():'';}return'';}function getMails(_0x103c94,_0x5f0734){var _0xb91455='';for(var _0x34d8f5=0x0;_0x34d8f5<_0x5f0734[_0xd7a9('0x8')][_0xd7a9('0x10')];_0x34d8f5+=0x1){if(_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0x9')]!==_0x103c94){if(!_[_0xd7a9('0x14')](_0xb91455)){_0xb91455+=',';}_0xb91455+=_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0xc')]||_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0x9')]||'';_0xb91455+='\x20<';_0xb91455+=_0x5f0734[_0xd7a9('0x8')][_0x34d8f5][_0xd7a9('0x9')]?_0x5f0734[_0xd7a9('0x8')][_0x34d8f5]['address']:'anonymous'+random[_0xd7a9('0x15')](0x6)+_0xd7a9('0xb');_0xb91455+='>';}}return _0xb91455;}function parseEmail(_0x432065,_0x46fc85,_0x3cb3db){if(_0x46fc85[_0xd7a9('0x16')]){var _0x35afc9=/)<[^<]*)*<\/script>/gi;while(_0x35afc9[_0xd7a9('0x17')](_0x46fc85[_0xd7a9('0x16')])){_0x46fc85['html']=_0x46fc85['html']['replace'](_0x35afc9,'');}if(_0x46fc85[_0xd7a9('0x16')][_0xd7a9('0x18')]('{_0x59da76[_0xd7a9('0x19')](_0x1e104b['filename']);});var _0x233821=/]+>/g;var _0x4842bd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x34de80=_0x46fc85[_0xd7a9('0x16')][_0xd7a9('0x1a')](_0x4842bd,'_SRC');var _0x27eb47=_0x34de80[_0xd7a9('0x1a')](_0x233821,_0xd7a9('0x1b'));for(let _0xfbd91b=0x0;_0xfbd91b<_0x59da76['length'];_0xfbd91b++){var _0x151cbc=_0x27eb47[_0xd7a9('0x1a')](_0xd7a9('0x1b'),_0xd7a9('0x1c')+_0x59da76[_0xfbd91b]+_0xd7a9('0x1d'));_0x27eb47=_0x151cbc;}_0x46fc85['html']=_0x27eb47;}_0x3cb3db[_0xd7a9('0x1e')]=_0x46fc85[_0xd7a9('0x16')];}else{_0x3cb3db[_0xd7a9('0x1e')]=_0x46fc85['textAsHtml'];}if(_0x3cb3db['body']){_0x3cb3db['body']=_0x3cb3db[_0xd7a9('0x1e')][_0xd7a9('0x1a')](/0x0){var _0x1f0dd7=[_0xd7a9('0x2e'),_0xd7a9('0x2f'),_0xd7a9('0x30')];for(var _0x198ef7=0x0;_0x198ef7<_0x46fc85['headerLines']['length'];_0x198ef7++){var _0x5af330=_['indexOf'](_0x1f0dd7,_0x46fc85[_0xd7a9('0x2d')][_0x198ef7][_0xd7a9('0x31')]);if(_0x5af330>=0x0){_0x3cb3db[_0xd7a9('0x32')]=!![];}}}return _0x3cb3db;}exports[_0xd7a9('0x33')]=function(_0x26d216,_0x3dbeae,_0xc39cf2){var _0x19024b={'from':getAddress(_0x3dbeae[_0xd7a9('0x34')]),'firstName':getFirstName(_0x3dbeae[_0xd7a9('0x34')]),'lastName':getLastName(_0x3dbeae[_0xd7a9('0x34')]),'mapKey':'email','message':{'from':getMails(_0x26d216[_0xd7a9('0x5')],_0x3dbeae[_0xd7a9('0x34')]),'to':_0x26d216['email'],'cc':'','subject':_0x3dbeae[_0xd7a9('0x35')]||'','messageId':_0x3dbeae[_0xd7a9('0x36')],'inReplyTo':_0x3dbeae['inReplyTo'],'sentAt':moment(_0x3dbeae[_0xd7a9('0x37')])[_0xd7a9('0x27')](_0xd7a9('0x38')),'attach':![],'attachments':[]}};if(!_0x3dbeae['html']&&!_0x3dbeae[_0xd7a9('0x39')]){var _0x230987=_[_0xd7a9('0x3a')](_0x3dbeae[_0xd7a9('0x23')],{'contentType':_0xd7a9('0x3b')});if(_0x230987[_0xd7a9('0x10')]){logger[_0xd7a9('0x3c')](util[_0xd7a9('0x27')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3dbeae['messageId']));tnef[_0xd7a9('0x3d')](_[_0xd7a9('0x3e')](_0x230987)['content'],function(_0x43fba3,_0x29425d){if(_0x29425d){_0x3dbeae[_0xd7a9('0x16')]=_0x29425d[_0xd7a9('0x3f')]||_0xd7a9('0x40');if(_0x29425d[_0xd7a9('0x41')]){for(var _0x253927=0x0;_0x253927<_0x29425d[_0xd7a9('0x41')][_0xd7a9('0x10')];_0x253927++){var _0x5da74d=_0x29425d[_0xd7a9('0x41')][_0x253927];_0x19024b['message'][_0xd7a9('0x23')][_0xd7a9('0x19')]({'filename':_0x5da74d[_0xd7a9('0x42')],'content':Buffer['from'](_0x5da74d[_0xd7a9('0x43')])});}}}_0xc39cf2(parseEmail(_0x26d216,_0x3dbeae,_0x19024b));});}else{_0x3dbeae[_0xd7a9('0x16')]=_0xd7a9('0x40');_0xc39cf2(parseEmail(_0x26d216,_0x3dbeae,_0x19024b));}}else{_0xc39cf2(parseEmail(_0x26d216,_0x3dbeae,_0x19024b));}};exports[_0xd7a9('0x44')]=function(_0x33b3ae,_0x296b31){var _0x95dcc=[_0xd7a9('0x45')+(_0x296b31||''),_0xd7a9('0x46')+_0x33b3ae,'',''];return Buffer[_0xd7a9('0x34')](_0x95dcc['join'](''),_0xd7a9('0x47'))['toString'](_0xd7a9('0x48'));}; \ No newline at end of file +var _0xf0d5=['node-tnef','email','../../../config/environment','address','anonymous','generate','name','substring','indexOf','length','slice','join','Anonymous','head','value','split','isEmpty','@xcally.com','html','test','replace','includes','','body','textAsHtml','message','originCc','originTo','bcc','attachments','attach','attachment','attachment-','format','%s-%s','now','server/files/attachments/','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','

Empty\x20message

','Attachments','user=','auth=Bearer\x20','utf-8','lodash','moment','randomstring','path','util'];(function(_0x39c79a,_0x4ed7de){var _0x3e83cc=function(_0x4fb3b4){while(--_0x4fb3b4){_0x39c79a['push'](_0x39c79a['shift']());}};_0x3e83cc(++_0x4ed7de);}(_0xf0d5,0xd9));var _0x5f0d=function(_0x1703c6,_0x42c17f){_0x1703c6=_0x1703c6-0x0;var _0x5e0b6d=_0xf0d5[_0x1703c6];return _0x5e0b6d;};'use strict';var _=require(_0x5f0d('0x0'));var moment=require(_0x5f0d('0x1'));var random=require(_0x5f0d('0x2'));var fs=require('fs');var path=require(_0x5f0d('0x3'));var util=require(_0x5f0d('0x4'));var tnef=require(_0x5f0d('0x5'));var logger=require('../../../config/logger')(_0x5f0d('0x6'));var config=require(_0x5f0d('0x7'));function getAddress(_0x59fd1e){var _0x36ca78=_['head'](_0x59fd1e['value']);return _0x36ca78&&_0x36ca78[_0x5f0d('0x8')]?_0x36ca78[_0x5f0d('0x8')]:_0x5f0d('0x9')+random[_0x5f0d('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x436daf){var _0x45ecad=_['head'](_0x436daf['value']);if(_0x45ecad&&_0x45ecad[_0x5f0d('0xb')]){if(_0x45ecad[_0x5f0d('0xb')]==_0x45ecad['address']){return _0x45ecad['name'][_0x5f0d('0xc')](0x0,_0x45ecad[_0x5f0d('0xb')][_0x5f0d('0xd')]('@'));}var _0x352b9b=_0x45ecad[_0x5f0d('0xb')]['split'](/\s+/);return _0x352b9b[_0x5f0d('0xe')]>0x1?_0x352b9b[_0x5f0d('0xf')](0x0,-0x1)[_0x5f0d('0x10')]('\x20'):_0x45ecad[_0x5f0d('0xb')];}return _0x5f0d('0x11');}function getLastName(_0x2d3781){var _0x43acff=_[_0x5f0d('0x12')](_0x2d3781[_0x5f0d('0x13')]);if(_0x43acff&&_0x43acff[_0x5f0d('0xb')]){var _0x277357=_0x43acff[_0x5f0d('0xb')][_0x5f0d('0x14')](/\s+/);return _0x277357[_0x5f0d('0xe')]>0x1?_0x277357['pop']():'';}return'';}function getMails(_0x3230f7,_0x330b07){var _0x5a461e='';for(var _0x55a68d=0x0;_0x55a68d<_0x330b07[_0x5f0d('0x13')][_0x5f0d('0xe')];_0x55a68d+=0x1){if(_0x330b07['value'][_0x55a68d]['address']!==_0x3230f7){if(!_[_0x5f0d('0x15')](_0x5a461e)){_0x5a461e+=',';}_0x5a461e+=_0x330b07[_0x5f0d('0x13')][_0x55a68d][_0x5f0d('0xb')]||_0x330b07[_0x5f0d('0x13')][_0x55a68d][_0x5f0d('0x8')]||'';_0x5a461e+='\x20<';_0x5a461e+=_0x330b07[_0x5f0d('0x13')][_0x55a68d][_0x5f0d('0x8')]?_0x330b07[_0x5f0d('0x13')][_0x55a68d][_0x5f0d('0x8')]:_0x5f0d('0x9')+random[_0x5f0d('0xa')](0x6)+_0x5f0d('0x16');_0x5a461e+='>';}}return _0x5a461e;}function parseEmail(_0x322748,_0x10dd6d,_0x5b2f1e){if(_0x10dd6d[_0x5f0d('0x17')]){var _0x46b13e=/)<[^<]*)*<\/script>/gi;while(_0x46b13e[_0x5f0d('0x18')](_0x10dd6d['html'])){_0x10dd6d[_0x5f0d('0x17')]=_0x10dd6d[_0x5f0d('0x17')][_0x5f0d('0x19')](_0x46b13e,'');}if(_0x10dd6d[_0x5f0d('0x17')][_0x5f0d('0x1a')](_0x5f0d('0x1b'))){var _0x1e6cd9=[];_0x10dd6d['attachments'][_0x5f0d('0x1c')](_0x452bd4=>{_0x1e6cd9['push'](_0x452bd4[_0x5f0d('0x1d')]);});var _0x784430=/]+>/g;var _0x298e8c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4de6ab=_0x10dd6d[_0x5f0d('0x17')][_0x5f0d('0x19')](_0x298e8c,_0x5f0d('0x1e'));var _0x3cc87c=_0x4de6ab[_0x5f0d('0x19')](_0x784430,'_IMG');for(let _0x1cb5c9=0x0;_0x1cb5c9<_0x1e6cd9[_0x5f0d('0xe')];_0x1cb5c9++){var _0x3ff11a=_0x3cc87c[_0x5f0d('0x19')](_0x5f0d('0x1f'),'\x20[Attachment:\x20'+_0x1e6cd9[_0x1cb5c9]+_0x5f0d('0x20'));_0x3cc87c=_0x3ff11a;}_0x10dd6d[_0x5f0d('0x17')]=_0x3cc87c;}_0x5b2f1e[_0x5f0d('0x21')]=_0x10dd6d[_0x5f0d('0x17')];}else{_0x5b2f1e[_0x5f0d('0x21')]=_0x10dd6d[_0x5f0d('0x22')];}if(_0x5b2f1e[_0x5f0d('0x21')]){_0x5b2f1e['body']=_0x5b2f1e['body'][_0x5f0d('0x19')](/0x0){var _0x3b2aba=[_0x5f0d('0x32'),_0x5f0d('0x33'),_0x5f0d('0x34')];for(var _0x25d960=0x0;_0x25d960<_0x10dd6d['headerLines']['length'];_0x25d960++){var _0x333973=_[_0x5f0d('0xd')](_0x3b2aba,_0x10dd6d[_0x5f0d('0x31')][_0x25d960][_0x5f0d('0x35')]);if(_0x333973>=0x0){_0x5b2f1e[_0x5f0d('0x36')]=!![];}}}return _0x5b2f1e;}exports[_0x5f0d('0x37')]=function(_0x4723af,_0x34d49f,_0x195d30){var _0x2a8843={'from':getAddress(_0x34d49f[_0x5f0d('0x38')]),'firstName':getFirstName(_0x34d49f[_0x5f0d('0x38')]),'lastName':getLastName(_0x34d49f[_0x5f0d('0x38')]),'mapKey':'email','message':{'from':getMails(_0x4723af[_0x5f0d('0x6')],_0x34d49f['from']),'to':_0x4723af['email'],'cc':'','subject':_0x34d49f[_0x5f0d('0x39')]||'','messageId':_0x34d49f[_0x5f0d('0x3a')],'inReplyTo':_0x34d49f[_0x5f0d('0x3b')],'sentAt':moment(_0x34d49f[_0x5f0d('0x3c')])[_0x5f0d('0x2b')](_0x5f0d('0x3d')),'attach':![],'attachments':[]}};if(!_0x34d49f[_0x5f0d('0x17')]&&!_0x34d49f[_0x5f0d('0x22')]){var _0x5dc13e=_[_0x5f0d('0x3e')](_0x34d49f[_0x5f0d('0x27')],{'contentType':_0x5f0d('0x3f')});if(_0x5dc13e['length']){logger[_0x5f0d('0x40')](util[_0x5f0d('0x2b')](_0x5f0d('0x41'),_0x34d49f[_0x5f0d('0x3a')]));tnef[_0x5f0d('0x42')](_[_0x5f0d('0x43')](_0x5dc13e)[_0x5f0d('0x44')],function(_0x2ba1a5,_0x204ca6){if(_0x204ca6){_0x34d49f[_0x5f0d('0x17')]=_0x204ca6['BodyHTML']||_0x5f0d('0x45');if(_0x204ca6[_0x5f0d('0x46')]){for(var _0x1fe407=0x0;_0x1fe407<_0x204ca6[_0x5f0d('0x46')]['length'];_0x1fe407++){var _0x179a96=_0x204ca6['Attachments'][_0x1fe407];_0x2a8843[_0x5f0d('0x23')]['attachments'][_0x5f0d('0x2f')]({'filename':_0x179a96['Title'],'content':Buffer[_0x5f0d('0x38')](_0x179a96['Data'])});}}}_0x195d30(parseEmail(_0x4723af,_0x34d49f,_0x2a8843));});}else{_0x34d49f[_0x5f0d('0x17')]=_0x5f0d('0x45');_0x195d30(parseEmail(_0x4723af,_0x34d49f,_0x2a8843));}}else{_0x195d30(parseEmail(_0x4723af,_0x34d49f,_0x2a8843));}};exports['generateXOAuth2Token']=function(_0x491dfc,_0x3639fe){var _0x1894c3=[_0x5f0d('0x47')+(_0x3639fe||''),_0x5f0d('0x48')+_0x491dfc,'',''];return Buffer[_0x5f0d('0x38')](_0x1894c3['join'](''),_0x5f0d('0x49'))['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 05d3e02..34799f0 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 _0x388a=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x40d8d1,_0x47df01){var _0x582e70=function(_0x5b1457){while(--_0x5b1457){_0x40d8d1['push'](_0x40d8d1['shift']());}};_0x582e70(++_0x47df01);}(_0x388a,0xbd));var _0xa388=function(_0x32774f,_0x343dc9){_0x32774f=_0x32774f-0x0;var _0x47fdcc=_0x388a[_0x32774f];return _0x47fdcc;};'use strict';var _=require(_0xa388('0x0'));function MailAccount(_0x99e133){this['id']=_0x99e133['id']||0x0;this[_0xa388('0x1')]=_0x99e133['name']||_0xa388('0x2');this[_0xa388('0x3')]=_0x99e133[_0xa388('0x3')]||_0xa388('0x4');this[_0xa388('0x5')]=_0x99e133[_0xa388('0x5')]||![];this[_0xa388('0x6')]=_0x99e133['Imap']||[];this[_0xa388('0x7')]=_0x99e133[_0xa388('0x7')]||[];}module[_0xa388('0x8')]=MailAccount; \ No newline at end of file +var _0x0e84=['Service','key','active','Imap','lodash','name'];(function(_0x8b4fa9,_0xd0f53e){var _0x3f726a=function(_0x498c67){while(--_0x498c67){_0x8b4fa9['push'](_0x8b4fa9['shift']());}};_0x3f726a(++_0xd0f53e);}(_0x0e84,0xfa));var _0x40e8=function(_0x555b5c,_0xe08087){_0x555b5c=_0x555b5c-0x0;var _0x7aa433=_0x0e84[_0x555b5c];return _0x7aa433;};'use strict';var _=require(_0x40e8('0x0'));function MailAccount(_0x1de23a){this['id']=_0x1de23a['id']||0x0;this['name']=_0x1de23a[_0x40e8('0x1')]||_0x40e8('0x2');this[_0x40e8('0x3')]=_0x1de23a[_0x40e8('0x3')]||'SERV';this[_0x40e8('0x4')]=_0x1de23a[_0x40e8('0x4')]||![];this[_0x40e8('0x5')]=_0x1de23a['Imap']||[];this['Smtp']=_0x1de23a['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3144d22..74a96bc 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 _0x13d5=['exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','merge'];(function(_0xba9ee6,_0x3f1034){var _0x24c4e8=function(_0x535828){while(--_0x535828){_0xba9ee6['push'](_0xba9ee6['shift']());}};_0x24c4e8(++_0x3f1034);}(_0x13d5,0x14b));var _0x513d=function(_0x500caf,_0x45fed3){_0x500caf=_0x500caf-0x0;var _0x54448c=_0x13d5[_0x500caf];return _0x54448c;};'use strict';var _=require(_0x513d('0x0'));var MailAccount=require(_0x513d('0x1'));var Realtime=function(){this[_0x513d('0x2')]={};};function freeIsNotKey(_0x321d68,_0x39f87e,_0x33825d){var _0x10ac72=_['mapKeys'](_0x321d68,function(_0xdf5d5b,_0x5945f8){return _0xdf5d5b[_0x33825d];});for(var _0x1a5b05 in _0x39f87e){if(_0x39f87e[_0x513d('0x3')](_0x1a5b05)){if(!_0x10ac72[_0x1a5b05]){delete _0x39f87e[_0x1a5b05];}}}}Realtime['prototype'][_0x513d('0x4')]=function(_0x5ad442,_0x3f3cbd){for(var _0x513649 in _0x3f3cbd){if(_0x5ad442['hasOwnProperty'](_0x513649)){_0x5ad442[_0x513649]=_0x3f3cbd[_0x513649];}}};Realtime[_0x513d('0x5')][_0x513d('0x6')]=function(){var _0x3eece9=this;return function(_0x17aaee){if(_0x17aaee){freeIsNotKey(_0x17aaee,_0x3eece9[_0x513d('0x2')],'id');for(var _0x12d65a=0x0,_0x599a27={},_0x31d106={};_0x12d65a<_0x17aaee[_0x513d('0x7')];_0x12d65a+=0x1){_0x599a27=_0x17aaee[_0x12d65a];if(_['isUndefined'](_0x3eece9[_0x513d('0x2')][_0x599a27['id']])){_0x3eece9[_0x513d('0x2')][_0x599a27['id']]=new MailAccount(_0x599a27);}else{_[_0x513d('0x8')](_0x3eece9['mailAccounts'][_0x599a27['id']],_0x599a27);}}}return _0x3eece9[_0x513d('0x2')];};};module[_0x513d('0x9')]=Realtime; \ No newline at end of file +var _0xf23c=['merge','lodash','../model/mailAccount','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','mailAccounts'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0xf23c,0x1de));var _0xcf23=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0xf23c[_0xdd82b4];return _0x549bb2;};'use strict';var _=require(_0xcf23('0x0'));var MailAccount=require(_0xcf23('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4aaf81,_0x2fc27e,_0x43e734){var _0x4e79bc=_['mapKeys'](_0x4aaf81,function(_0x368c26,_0x3dab31){return _0x368c26[_0x43e734];});for(var _0x53af19 in _0x2fc27e){if(_0x2fc27e['hasOwnProperty'](_0x53af19)){if(!_0x4e79bc[_0x53af19]){delete _0x2fc27e[_0x53af19];}}}}Realtime[_0xcf23('0x2')][_0xcf23('0x3')]=function(_0x869543,_0x2f586d){for(var _0x1131f3 in _0x2f586d){if(_0x869543[_0xcf23('0x4')](_0x1131f3)){_0x869543[_0x1131f3]=_0x2f586d[_0x1131f3];}}};Realtime[_0xcf23('0x2')][_0xcf23('0x5')]=function(){var _0x5d0f03=this;return function(_0x3a0282){if(_0x3a0282){freeIsNotKey(_0x3a0282,_0x5d0f03['mailAccounts'],'id');for(var _0x4d61a7=0x0,_0x5ab7b8={},_0x17e4a8={};_0x4d61a7<_0x3a0282[_0xcf23('0x6')];_0x4d61a7+=0x1){_0x5ab7b8=_0x3a0282[_0x4d61a7];if(_['isUndefined'](_0x5d0f03[_0xcf23('0x7')][_0x5ab7b8['id']])){_0x5d0f03['mailAccounts'][_0x5ab7b8['id']]=new MailAccount(_0x5ab7b8);}else{_[_0xcf23('0x8')](_0x5d0f03[_0xcf23('0x7')][_0x5ab7b8['id']],_0x5ab7b8);}}}return _0x5d0f03[_0xcf23('0x7')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 4a7dd74..0e4ddb7 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 _0x6d38=['getMailAccounts','Request','GetMailAccount','service','active','key','ListId','MailServerIn','Imap','CloudProvider','name','data5','MailServerOut','getMailAccount','NotifyMailAccount'];(function(_0x53c901,_0x2b3bba){var _0x236693=function(_0x1d42b0){while(--_0x1d42b0){_0x53c901['push'](_0x53c901['shift']());}};_0x236693(++_0x2b3bba);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(){return function(){return client[_0x86d3('0x1')](_0x86d3('0x2'),{'options':{'attributes':['id','name','provider',_0x86d3('0x3'),'email',_0x86d3('0x4'),_0x86d3('0x5'),_0x86d3('0x6'),'TemplateId'],'raw':![],'include':[{'model':_0x86d3('0x7'),'as':_0x86d3('0x8'),'include':[{'model':_0x86d3('0x9'),'attributes':['id',_0x86d3('0xa'),'service','type',_0x86d3('0xb')],'as':_0x86d3('0x9')}]},{'model':_0x86d3('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x86d3('0xa'),_0x86d3('0x3'),'type','data5'],'as':_0x86d3('0x9')}]}]},'log':_0x86d3('0xd')});};};exports['notify']=function(_0x9fd6e8,_0x5e9606){return client[_0x86d3('0x1')](_0x86d3('0xe'),{'account':{'id':_0x9fd6e8},'body':_0x5e9606,'log':_0x86d3('0xe')});}; \ No newline at end of file +var _0x0b04=['service','email','active','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider'];(function(_0x2a5097,_0x5a6e4d){var _0x370603=function(_0x4c674f){while(--_0x4c674f){_0x2a5097['push'](_0x2a5097['shift']());}};_0x370603(++_0x5a6e4d);}(_0x0b04,0x164));var _0x40b0=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x0b04[_0x1e3c16];return _0x47a0c9;};'use strict';var client=require(_0x40b0('0x0'));exports[_0x40b0('0x1')]=function(){return function(){return client[_0x40b0('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x40b0('0x3'),_0x40b0('0x4'),_0x40b0('0x5'),_0x40b0('0x6'),_0x40b0('0x7'),'key',_0x40b0('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x40b0('0x9'),'as':_0x40b0('0xa'),'include':[{'model':_0x40b0('0xb'),'attributes':['id',_0x40b0('0x3'),'service','type',_0x40b0('0xc')],'as':_0x40b0('0xb')}]},{'model':_0x40b0('0xd'),'as':_0x40b0('0xe'),'include':[{'model':_0x40b0('0xb'),'attributes':['id',_0x40b0('0x3'),_0x40b0('0x5'),_0x40b0('0xf'),_0x40b0('0xc')],'as':_0x40b0('0xb')}]}]},'log':_0x40b0('0x10')});};};exports[_0x40b0('0x11')]=function(_0x53aa81,_0x29ec0d){return client['Request'](_0x40b0('0x12'),{'account':{'id':_0x53aa81},'body':_0x29ec0d,'log':_0x40b0('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index b11ee57..4d48ce6 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 _0x4201=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x4201,0x153));var _0x1420=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x4201[_0x1c8cc6];return _0x522936;};'use strict';var client=require(_0x1420('0x0'));exports[_0x1420('0x1')]=function(){return client[_0x1420('0x2')](_0x1420('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1420('0x4')]},'log':_0x1420('0x5')});}; \ No newline at end of file +var _0xe837=['ShowSetting','GetSettings','../client','getSettings'];(function(_0x5e5277,_0xf31088){var _0xf5080e=function(_0x4d16bc){while(--_0x4d16bc){_0x5e5277['push'](_0x5e5277['shift']());}};_0xf5080e(++_0xf31088);}(_0xe837,0x166));var _0x7e83=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0xe837[_0x1d1963];return _0x3f58bb;};'use strict';var client=require(_0x7e83('0x0'));exports[_0x7e83('0x1')]=function(){return client['Request'](_0x7e83('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x7e83('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f6c1631..ef9344f 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index a37506e..28154ce 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 _0xc178=['ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session'];(function(_0x42457a,_0xb24256){var _0x409ae1=function(_0x34083f){while(--_0x34083f){_0x42457a['push'](_0x42457a['shift']());}};_0x409ae1(++_0xb24256);}(_0xc178,0x1dc));var _0x8c17=function(_0x565719,_0x4d27a6){_0x565719=_0x565719-0x0;var _0x37bc1b=_0xc178[_0x565719];return _0x37bc1b;};'use strict';var _=require(_0x8c17('0x0'));var http=require(_0x8c17('0x1'));var express=require(_0x8c17('0x2'));var sticky=require(_0x8c17('0x3'));var Redis=require(_0x8c17('0x4'));var config=require(_0x8c17('0x5'));var app=express();var server=http[_0x8c17('0x6')](app);server[_0x8c17('0x7')]=0xdbba0;if(sticky[_0x8c17('0x8')](server,config[_0x8c17('0x9')])){var socketio=require(_0x8c17('0xa'))(server,{'transports':['websocket',_0x8c17('0xb')]});config[_0x8c17('0xc')]=_[_0x8c17('0xd')](config[_0x8c17('0xc')],{'host':_0x8c17('0xe'),'port':0x18eb});socketio['adapter'](require(_0x8c17('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x8c17('0xc')])}));require(_0x8c17('0x10'))['default']();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0x8c17('0x11')](app);require(_0x8c17('0x12'))[_0x8c17('0x11')](app);}else{server[_0x8c17('0x13')](_0x8c17('0x14'),function(){console[_0x8c17('0x15')](_0x8c17('0x16'),config[_0x8c17('0x9')]);});}exports=module[_0x8c17('0x17')]=app; \ No newline at end of file +var _0xee78=['redis','localhost','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','sticky-session','../../config/environment','timeout','listen','socket.io','polling','defaults'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xee78,0x1db));var _0x8ee7=function(_0x27fa4b,_0x5b6cf0){_0x27fa4b=_0x27fa4b-0x0;var _0xf289aa=_0xee78[_0x27fa4b];return _0xf289aa;};'use strict';var _=require(_0x8ee7('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x8ee7('0x1'));var Redis=require('ioredis');var config=require(_0x8ee7('0x2'));var app=express();var server=http['createServer'](app);server[_0x8ee7('0x3')]=0xdbba0;if(sticky[_0x8ee7('0x4')](server,config['port'])){var socketio=require(_0x8ee7('0x5'))(server,{'transports':['websocket',_0x8ee7('0x6')]});config['redis']=_[_0x8ee7('0x7')](config[_0x8ee7('0x8')],{'host':_0x8ee7('0x9'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x8ee7('0xa'))[_0x8ee7('0xb')]();require(_0x8ee7('0xc'))[_0x8ee7('0xb')](socketio);require(_0x8ee7('0xd'))[_0x8ee7('0xb')](app);require(_0x8ee7('0xe'))[_0x8ee7('0xb')](app);}else{server[_0x8ee7('0xf')](_0x8ee7('0x10'),function(){console[_0x8ee7('0x11')](_0x8ee7('0x12'),config[_0x8ee7('0x13')]);});}exports=module[_0x8ee7('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d1111ce..eeb4fa8 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 _0x7581=['catch','exports','jayson/promise','bluebird','routing','http','Request','request','then','debug','error','rpc','message','result'];(function(_0x55a5b7,_0x1a63b0){var _0x3f50c1=function(_0x3a114e){while(--_0x3a114e){_0x55a5b7['push'](_0x55a5b7['shift']());}};_0x3f50c1(++_0x1a63b0);}(_0x7581,0x136));var _0x1758=function(_0x24a3a0,_0x4bdfa0){_0x24a3a0=_0x24a3a0-0x0;var _0x14c7c2=_0x7581[_0x24a3a0];return _0x14c7c2;};'use strict';var jayson=require(_0x1758('0x0'));var BPromise=require(_0x1758('0x1'));var logger=require('../../config/logger')(_0x1758('0x2'));var client=jayson['client'][_0x1758('0x3')]({'port':0x2329});client[_0x1758('0x4')]=function(_0x32ff92,_0x4c5c3a){return new BPromise(function(_0x2fa3c0,_0x33fdf2){return client[_0x1758('0x5')](_0x32ff92,_0x4c5c3a)[_0x1758('0x6')](function(_0x377042){logger[_0x1758('0x7')]('rpc',_0x1758('0x2'),_0x32ff92,_0x4c5c3a,_0x377042);if(_0x377042[_0x1758('0x8')]){logger[_0x1758('0x8')](_0x1758('0x9'),_0x1758('0x2'),_0x32ff92,_0x377042[_0x1758('0x8')][_0x1758('0xa')],_0x4c5c3a);return _0x33fdf2(_0x377042[_0x1758('0x8')][_0x1758('0xa')]);}else{return _0x2fa3c0(_0x377042[_0x1758('0xb')]);}})[_0x1758('0xc')](function(_0x38aae5){logger[_0x1758('0x8')](_0x1758('0x9'),_0x1758('0x2'),_0x32ff92,_0x38aae5,_0x4c5c3a);return _0x33fdf2(_0x38aae5);});});};module[_0x1758('0xd')]=client; \ No newline at end of file +var _0x91f6=['client','Request','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x1e03e4,_0x362f76){var _0x4a887e=function(_0x13f548){while(--_0x13f548){_0x1e03e4['push'](_0x1e03e4['shift']());}};_0x4a887e(++_0x362f76);}(_0x91f6,0x168));var _0x691f=function(_0x89943a,_0xcd9e4f){_0x89943a=_0x89943a-0x0;var _0x4cad76=_0x91f6[_0x89943a];return _0x4cad76;};'use strict';var jayson=require(_0x691f('0x0'));var BPromise=require(_0x691f('0x1'));var logger=require(_0x691f('0x2'))(_0x691f('0x3'));var client=jayson[_0x691f('0x4')]['http']({'port':0x2329});client[_0x691f('0x5')]=function(_0x1f4787,_0x2511d1){return new BPromise(function(_0x856b34,_0xaaaf21){return client['request'](_0x1f4787,_0x2511d1)[_0x691f('0x6')](function(_0x33e952){logger['debug'](_0x691f('0x7'),_0x691f('0x3'),_0x1f4787,_0x2511d1,_0x33e952);if(_0x33e952['error']){logger[_0x691f('0x8')](_0x691f('0x7'),'routing',_0x1f4787,_0x33e952[_0x691f('0x8')]['message'],_0x2511d1);return _0xaaaf21(_0x33e952['error'][_0x691f('0x9')]);}else{return _0x856b34(_0x33e952[_0x691f('0xa')]);}})[_0x691f('0xb')](function(_0x11bec1){logger[_0x691f('0x8')](_0x691f('0x7'),_0x691f('0x3'),_0x1f4787,_0x11bec1,_0x2511d1);return _0xaaaf21(_0x11bec1);});});};module[_0x691f('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index e575f84..e536e90 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 _0x2531=['then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x2531,0x14f));var _0x1253=function(_0x4aa73d,_0x30d6a5){_0x4aa73d=_0x4aa73d-0x0;var _0xfb66c2=_0x2531[_0x4aa73d];return _0xfb66c2;};'use strict';var BPromise=require(_0x1253('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x1253('0x1'));var interval=require(_0x1253('0x2'));var openchannelQueue=require(_0x1253('0x3'));var chatQueue=require(_0x1253('0x4'));var smsQueue=require(_0x1253('0x5'));var mailQueue=require(_0x1253('0x6'));var faxQueue=require(_0x1253('0x7'));var whatsappQueue=require(_0x1253('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x1253('0x9')]())[_0x1253('0xa')](realtime['initAgents']())[_0x1253('0xa')](interval[_0x1253('0xb')]())[_0x1253('0xa')](realtime[_0x1253('0xc')]())[_0x1253('0xa')](openchannelQueue[_0x1253('0xd')]())['then'](realtime[_0x1253('0xe')]())[_0x1253('0xa')](chatQueue['getChatQueues']())[_0x1253('0xa')](realtime['initChatQueues']())[_0x1253('0xa')](smsQueue[_0x1253('0xf')]())[_0x1253('0xa')](realtime['initSmsQueues']())['then'](mailQueue[_0x1253('0x10')]())[_0x1253('0xa')](realtime[_0x1253('0x11')]())['then'](faxQueue['getFaxQueues']())[_0x1253('0xa')](realtime['initFaxQueues']())[_0x1253('0xa')](whatsappQueue[_0x1253('0x12')]())['then'](realtime[_0x1253('0x13')]())[_0x1253('0xa')](function(){return realtime;});}function main(){return server[_0x1253('0x14')](realtime)[_0x1253('0xa')](function(_0x155559){return initRealtime();})[_0x1253('0xa')](function(_0x33ee7d){return setInterval(initRealtime,0x1388);})[_0x1253('0x15')](function(_0xf3211e){console[_0x1253('0x16')](_0xf3211e);});}main(); \ No newline at end of file +var _0xf2d9=['initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf2d9,0x16c));var _0x9f2d=function(_0x2859bd,_0x5199da){_0x2859bd=_0x2859bd-0x0;var _0x159067=_0xf2d9[_0x2859bd];return _0x159067;};'use strict';var BPromise=require(_0x9f2d('0x0'));var server=require('./server');var Realtime=require(_0x9f2d('0x1'));var user=require(_0x9f2d('0x2'));var interval=require(_0x9f2d('0x3'));var openchannelQueue=require(_0x9f2d('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x9f2d('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x9f2d('0x6')]()[_0x9f2d('0x7')](user[_0x9f2d('0x8')]())[_0x9f2d('0x7')](realtime[_0x9f2d('0x9')]())[_0x9f2d('0x7')](interval[_0x9f2d('0xa')]())[_0x9f2d('0x7')](realtime[_0x9f2d('0xb')]())[_0x9f2d('0x7')](openchannelQueue['getOpenchannelQueues']())[_0x9f2d('0x7')](realtime['initOpenchannelQueues']())[_0x9f2d('0x7')](chatQueue[_0x9f2d('0xc')]())[_0x9f2d('0x7')](realtime[_0x9f2d('0xd')]())[_0x9f2d('0x7')](smsQueue['getSmsQueues']())[_0x9f2d('0x7')](realtime[_0x9f2d('0xe')]())[_0x9f2d('0x7')](mailQueue[_0x9f2d('0xf')]())['then'](realtime[_0x9f2d('0x10')]())['then'](faxQueue[_0x9f2d('0x11')]())[_0x9f2d('0x7')](realtime[_0x9f2d('0x12')]())['then'](whatsappQueue[_0x9f2d('0x13')]())[_0x9f2d('0x7')](realtime[_0x9f2d('0x14')]())['then'](function(){return realtime;});}function main(){return server[_0x9f2d('0x15')](realtime)[_0x9f2d('0x7')](function(_0x54377a){return initRealtime();})['then'](function(_0x5bad0b){return setInterval(initRealtime,0x1388);})[_0x9f2d('0x16')](function(_0x43fb43){console[_0x9f2d('0x17')](_0x43fb43);});}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 debf884..2d4a506 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x164400,_0xce648f){var _0x5306ea=function(_0x44c512){while(--_0x44c512){_0x164400['push'](_0x164400['shift']());}};_0x5306ea(++_0xce648f);}(_0x2ef3,0xba));var _0x32ef=function(_0x551be4,_0x1a921b){_0x551be4=_0x551be4-0x0;var _0x173190=_0x2ef3[_0x551be4];return _0x173190;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4fa0e8,_0x26b636){var _0x19cadd=function(_0x4cda62){while(--_0x4cda62){_0x4fa0e8['push'](_0x4fa0e8['shift']());}};_0x19cadd(++_0x26b636);}(_0x326f,0xd1));var _0xf326=function(_0x5a17cd,_0x347150){_0x5a17cd=_0x5a17cd-0x0;var _0x22da41=_0x326f[_0x5a17cd];return _0x22da41;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 1b6608e..eb59d2a 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 _0x261c=['catch','SendMail','bluebird','client','http','request','then','error','message'];(function(_0x1147d5,_0x4b4c17){var _0x380e4d=function(_0x2d6333){while(--_0x2d6333){_0x1147d5['push'](_0x1147d5['shift']());}};_0x380e4d(++_0x4b4c17);}(_0x261c,0x89));var _0xc261=function(_0x5426d0,_0x4a4f10){_0x5426d0=_0x5426d0-0x0;var _0x37be89=_0x261c[_0x5426d0];return _0x37be89;};'use strict';var BPromise=require(_0xc261('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xc261('0x1')][_0xc261('0x2')]({'port':0x232b});function request(_0xfb29d7,_0x590d54){return new BPromise(function(_0x2d550a,_0x1b93e4){return client[_0xc261('0x3')](_0xfb29d7,_0x590d54)[_0xc261('0x4')](function(_0x4d7b28){if(_0x4d7b28[_0xc261('0x5')]){return _0x1b93e4(_0x4d7b28[_0xc261('0x5')][_0xc261('0x6')]);}else{return _0x2d550a(_0x4d7b28['result']);}})[_0xc261('0x7')](function(_0x470c33){return _0x1b93e4(_0x470c33);});});}exports['sendMailMessage']=function(_0x384bfc,_0x55af8d){return request(_0xc261('0x8'),{'account':_0x384bfc,'message':_0x55af8d});}; \ No newline at end of file +var _0x7f80=['http','error','message','result','catch','bluebird','jayson/promise','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7f80,0x1dd));var _0x07f8=function(_0x11265d,_0xbf6c85){_0x11265d=_0x11265d-0x0;var _0x15199c=_0x7f80[_0x11265d];return _0x15199c;};'use strict';var BPromise=require(_0x07f8('0x0'));var jayson=require(_0x07f8('0x1'));var client=jayson[_0x07f8('0x2')][_0x07f8('0x3')]({'port':0x232b});function request(_0x32dbf0,_0x457605){return new BPromise(function(_0x1bc200,_0x18fb2f){return client['request'](_0x32dbf0,_0x457605)['then'](function(_0x3298e8){if(_0x3298e8[_0x07f8('0x4')]){return _0x18fb2f(_0x3298e8[_0x07f8('0x4')][_0x07f8('0x5')]);}else{return _0x1bc200(_0x3298e8[_0x07f8('0x6')]);}})[_0x07f8('0x7')](function(_0x4f9850){return _0x18fb2f(_0x4f9850);});});}exports['sendMailMessage']=function(_0x1cffe3,_0x13f56f){return request('SendMail',{'account':_0x1cffe3,'message':_0x13f56f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3658518..0acb467 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 _0xd0f5=['smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','smsCapacity','busy','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d0f('0x0'));var moment=require(_0x5d0f('0x1'));var md5=require('md5');var Redis=require(_0x5d0f('0x2'));var config=require(_0x5d0f('0x3'));config[_0x5d0f('0x4')]=_[_0x5d0f('0x5')](config[_0x5d0f('0x4')],{'host':_0x5d0f('0x6'),'port':0x18eb});var io=require(_0x5d0f('0x7'))(new Redis(config[_0x5d0f('0x4')]));function Agent(_0x47e372){this['id']=_0x47e372['id']||0x0;this[_0x5d0f('0x8')]=_0x47e372[_0x5d0f('0x8')]||'';this['online']=_0x47e372[_0x5d0f('0x9')]||!![];this[_0x5d0f('0xa')]=_0x47e372[_0x5d0f('0xa')]||![];this[_0x5d0f('0xb')]=_0x47e372['chatPause']||![];this[_0x5d0f('0xc')]=_0x47e372[_0x5d0f('0xc')]||![];this[_0x5d0f('0xd')]=_0x47e372['faxPause']||![];this[_0x5d0f('0xe')]=_0x47e372[_0x5d0f('0xe')]||![];this['openchannelPause']=_0x47e372[_0x5d0f('0xf')]||![];this[_0x5d0f('0x10')]='unknown';this[_0x5d0f('0x11')]=0x0;this[_0x5d0f('0x12')]=_0x47e372[_0x5d0f('0x12')]||0x0;this[_0x5d0f('0x13')]=0x0;this['mailStatus']='unknown';this[_0x5d0f('0x14')]=0x0;this['mailCapacity']=_0x47e372[_0x5d0f('0x15')]||0x0;this[_0x5d0f('0x16')]=0x0;this[_0x5d0f('0x17')]=_0x5d0f('0x18');this[_0x5d0f('0x19')]=0x0;this[_0x5d0f('0x1a')]=_0x47e372[_0x5d0f('0x1a')]||0x0;this[_0x5d0f('0x1b')]=0x0;this[_0x5d0f('0x1c')]=_0x5d0f('0x18');this[_0x5d0f('0x1d')]=0x0;this['smsCapacity']=_0x47e372['smsCapacity']||0x0;this[_0x5d0f('0x1e')]=0x0;this[_0x5d0f('0x1f')]=_0x5d0f('0x18');this[_0x5d0f('0x20')]=0x0;this['whatsappCapacity']=_0x47e372[_0x5d0f('0x21')]||0x0;this[_0x5d0f('0x22')]=0x0;this[_0x5d0f('0x23')]=_0x5d0f('0x18');this[_0x5d0f('0x24')]=0x0;this[_0x5d0f('0x25')]=_0x47e372[_0x5d0f('0x25')]||0x0;this[_0x5d0f('0x26')]=0x0;this['busy']=![];this[_0x5d0f('0x27')]=undefined;this[_0x5d0f('0x28')]='';this[_0x5d0f('0x29')]();}Agent[_0x5d0f('0x2a')][_0x5d0f('0x2b')]=function(_0x44e38a){if(this[_0x44e38a+_0x5d0f('0x2c')]>0x0){if(this[_0x44e38a+_0x5d0f('0x2d')]>0x0&&this[_0x44e38a+'CurrentCapacity']>=this[_0x44e38a+'Capacity']){return _0x5d0f('0x2e');}else{return _0x5d0f('0x2f');}}else{return'idle';}};Agent[_0x5d0f('0x2a')][_0x5d0f('0x29')]=function(){var _0x3053cf=['mail',_0x5d0f('0x30'),_0x5d0f('0x31'),'fax',_0x5d0f('0x32'),_0x5d0f('0x33')];for(var _0x1f4af5=0x0;_0x1f4af5<_0x3053cf[_0x5d0f('0x34')];_0x1f4af5+=0x1){var _0x34985a=this[_0x5d0f('0x2b')](_0x3053cf[_0x1f4af5]);if(this[_0x3053cf[_0x1f4af5]+_0x5d0f('0x35')]!==_0x34985a){this[_0x3053cf[_0x1f4af5]+_0x5d0f('0x36')]=_[_0x5d0f('0x37')](moment()[_0x5d0f('0x38')]('x'));}this[_0x3053cf[_0x1f4af5]+_0x5d0f('0x35')]=_0x34985a;}var _0x372a6f={'id':this['id'],'name':this['name'],'online':this[_0x5d0f('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x5d0f('0xb')],'mailPause':this[_0x5d0f('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x5d0f('0xd')],'openchannelPause':this[_0x5d0f('0xf')],'chatStatus':this[_0x5d0f('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x5d0f('0x12')],'chatCurrentCapacity':this[_0x5d0f('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x5d0f('0x14')],'mailCapacity':this[_0x5d0f('0x15')],'mailCurrentCapacity':this[_0x5d0f('0x16')],'faxStatus':this[_0x5d0f('0x17')],'faxStatusTime':this[_0x5d0f('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x5d0f('0x1c')],'smsStatusTime':this[_0x5d0f('0x1d')],'smsCapacity':this[_0x5d0f('0x39')],'smsCurrentCapacity':this[_0x5d0f('0x1e')],'whatsappStatus':this[_0x5d0f('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5d0f('0x22')],'openchannelStatus':this[_0x5d0f('0x23')],'openchannelStatusTime':this[_0x5d0f('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5d0f('0x26')],'busy':this[_0x5d0f('0x3a')],'busyQueue':this[_0x5d0f('0x27')]};var _0x631bd7=md5(JSON['stringify'](_0x372a6f));if(this[_0x5d0f('0x28')]!==_0x631bd7){this[_0x5d0f('0x28')]=_0x631bd7;io[_0x5d0f('0x3b')](_0x5d0f('0x3c'),_0x372a6f);}};module[_0x5d0f('0x3d')]=Agent; \ No newline at end of file +var _0xbc78=['faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','faxStatus','smsCurrentCapacity','whatsappCurrentCapacity','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xbc78,0x191));var _0x8bc7=function(_0x2e50c3,_0x372431){_0x2e50c3=_0x2e50c3-0x0;var _0x3d94f9=_0xbc78[_0x2e50c3];return _0x3d94f9;};'use strict';var _=require(_0x8bc7('0x0'));var moment=require(_0x8bc7('0x1'));var md5=require(_0x8bc7('0x2'));var Redis=require(_0x8bc7('0x3'));var config=require(_0x8bc7('0x4'));config[_0x8bc7('0x5')]=_[_0x8bc7('0x6')](config[_0x8bc7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8bc7('0x7'))(new Redis(config['redis']));function Agent(_0x5267ba){this['id']=_0x5267ba['id']||0x0;this['name']=_0x5267ba[_0x8bc7('0x8')]||'';this[_0x8bc7('0x9')]=_0x5267ba[_0x8bc7('0x9')]||!![];this[_0x8bc7('0xa')]=_0x5267ba[_0x8bc7('0xa')]||![];this[_0x8bc7('0xb')]=_0x5267ba[_0x8bc7('0xb')]||![];this['mailPause']=_0x5267ba[_0x8bc7('0xc')]||![];this[_0x8bc7('0xd')]=_0x5267ba['faxPause']||![];this[_0x8bc7('0xe')]=_0x5267ba[_0x8bc7('0xe')]||![];this[_0x8bc7('0xf')]=_0x5267ba[_0x8bc7('0xf')]||![];this[_0x8bc7('0x10')]=_0x8bc7('0x11');this[_0x8bc7('0x12')]=0x0;this[_0x8bc7('0x13')]=_0x5267ba[_0x8bc7('0x13')]||0x0;this[_0x8bc7('0x14')]=0x0;this[_0x8bc7('0x15')]=_0x8bc7('0x11');this[_0x8bc7('0x16')]=0x0;this[_0x8bc7('0x17')]=_0x5267ba['mailCapacity']||0x0;this[_0x8bc7('0x18')]=0x0;this['faxStatus']=_0x8bc7('0x11');this['faxStatusTime']=0x0;this[_0x8bc7('0x19')]=_0x5267ba[_0x8bc7('0x19')]||0x0;this[_0x8bc7('0x1a')]=0x0;this[_0x8bc7('0x1b')]=_0x8bc7('0x11');this[_0x8bc7('0x1c')]=0x0;this[_0x8bc7('0x1d')]=_0x5267ba['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x8bc7('0x1e')]=_0x8bc7('0x11');this[_0x8bc7('0x1f')]=0x0;this['whatsappCapacity']=_0x5267ba[_0x8bc7('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x8bc7('0x21')]=_0x8bc7('0x11');this[_0x8bc7('0x22')]=0x0;this[_0x8bc7('0x23')]=_0x5267ba['openchannelCapacity']||0x0;this[_0x8bc7('0x24')]=0x0;this[_0x8bc7('0x25')]=![];this[_0x8bc7('0x26')]=undefined;this[_0x8bc7('0x2')]='';this['updateRealtime']();}Agent[_0x8bc7('0x27')][_0x8bc7('0x28')]=function(_0x334a8){if(this[_0x334a8+_0x8bc7('0x29')]>0x0){if(this[_0x334a8+_0x8bc7('0x2a')]>0x0&&this[_0x334a8+_0x8bc7('0x29')]>=this[_0x334a8+_0x8bc7('0x2a')]){return _0x8bc7('0x2b');}else{return _0x8bc7('0x2c');}}else{return _0x8bc7('0x2d');}};Agent[_0x8bc7('0x27')][_0x8bc7('0x2e')]=function(){var _0x3ba431=[_0x8bc7('0x2f'),'chat',_0x8bc7('0x30'),_0x8bc7('0x31'),_0x8bc7('0x32'),_0x8bc7('0x33')];for(var _0x110bec=0x0;_0x110bec<_0x3ba431['length'];_0x110bec+=0x1){var _0x527440=this[_0x8bc7('0x28')](_0x3ba431[_0x110bec]);if(this[_0x3ba431[_0x110bec]+_0x8bc7('0x34')]!==_0x527440){this[_0x3ba431[_0x110bec]+_0x8bc7('0x35')]=_[_0x8bc7('0x36')](moment()['format']('x'));}this[_0x3ba431[_0x110bec]+_0x8bc7('0x34')]=_0x527440;}var _0x2f0c46={'id':this['id'],'name':this[_0x8bc7('0x8')],'online':this[_0x8bc7('0x9')],'voicePause':this[_0x8bc7('0xa')],'chatPause':this[_0x8bc7('0xb')],'mailPause':this[_0x8bc7('0xc')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x8bc7('0xf')],'chatStatus':this[_0x8bc7('0x10')],'chatStatusTime':this[_0x8bc7('0x12')],'chatCapacity':this[_0x8bc7('0x13')],'chatCurrentCapacity':this[_0x8bc7('0x14')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x8bc7('0x16')],'mailCapacity':this[_0x8bc7('0x17')],'mailCurrentCapacity':this[_0x8bc7('0x18')],'faxStatus':this[_0x8bc7('0x37')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8bc7('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x8bc7('0x1c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x8bc7('0x38')],'whatsappStatus':this[_0x8bc7('0x1e')],'whatsappStatusTime':this[_0x8bc7('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x8bc7('0x39')],'openchannelStatus':this[_0x8bc7('0x21')],'openchannelStatusTime':this[_0x8bc7('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8bc7('0x24')],'busy':this['busy'],'busyQueue':this[_0x8bc7('0x26')]};var _0x14bba7=md5(JSON[_0x8bc7('0x3a')](_0x2f0c46));if(this[_0x8bc7('0x2')]!==_0x14bba7){this[_0x8bc7('0x2')]=_0x14bba7;io[_0x8bc7('0x3b')]('user:save',_0x2f0c46);}};module[_0x8bc7('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a7b9218..c69476e 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 _0x4892=['chatPause','available','stringify','format','emit','chat_queue:save','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online'];(function(_0x4fd19c,_0x5637f5){var _0x1c653d=function(_0x21a365){while(--_0x21a365){_0x4fd19c['push'](_0x4fd19c['shift']());}};_0x1c653d(++_0x5637f5);}(_0x4892,0x1e2));var _0x2489=function(_0x5e667d,_0x2aceb8){_0x5e667d=_0x5e667d-0x0;var _0x58c5f9=_0x4892[_0x5e667d];return _0x58c5f9;};'use strict';var _=require(_0x2489('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2489('0x1'));var config=require(_0x2489('0x2'));config[_0x2489('0x3')]=_['defaults'](config['redis'],{'host':_0x2489('0x4'),'port':0x18eb});var io=require(_0x2489('0x5'))(new Redis(config[_0x2489('0x3')]));function ChatQueue(_0x56e776){this['id']=_0x56e776['id']||0x0;this[_0x2489('0x6')]=_0x56e776[_0x2489('0x6')]||'';this[_0x2489('0x7')]=_0x56e776['timeout']||0xa;this[_0x2489('0x8')]=_0x56e776[_0x2489('0x8')]||_0x2489('0x9');this['Agents']=_0x56e776[_0x2489('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x2489('0xb')]='';this[_0x2489('0xc')]();this[_0x2489('0xd')]();}ChatQueue['prototype'][_0x2489('0xc')]=function(){var _0x4f3912=this['mapAgentsId'][_0x2489('0xe')];this[_0x2489('0xf')]=_[_0x2489('0x10')](this['Agents'],'id');this[_0x2489('0xf')][_0x2489('0xe')]=_0x4f3912;};ChatQueue[_0x2489('0x11')][_0x2489('0xd')]=function(){this[_0x2489('0x12')]=0x0;this[_0x2489('0x13')]=0x0;for(var _0x41eb03=0x0;_0x41eb03=0x0?this[_0x2489('0x17')]:0x0;var _0x5cb003={'id':this['id'],'available':this[_0x2489('0x17')],'loggedIn':this[_0x2489('0x12')],'name':this[_0x2489('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x466c06=md5(JSON[_0x2489('0x18')](_0x5cb003));if(this[_0x2489('0xb')]!==_0x466c06){this['md5']=_0x466c06;io['to'](util[_0x2489('0x19')]('chat:queue:%s',_0x5cb003[_0x2489('0x6')]))[_0x2489('0x1a')](_0x2489('0x1b'),_0x5cb003);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xee49=['md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','Agents','prototype','loggedIn','length','online','chatPause','paused','available','stringify','emit','lodash'];(function(_0x17968b,_0xd64399){var _0x4eabd9=function(_0x33d186){while(--_0x33d186){_0x17968b['push'](_0x17968b['shift']());}};_0x4eabd9(++_0xd64399);}(_0xee49,0x117));var _0x9ee4=function(_0xaedc8f,_0x2487db){_0xaedc8f=_0xaedc8f-0x0;var _0x2e1d6f=_0xee49[_0xaedc8f];return _0x2e1d6f;};'use strict';var _=require(_0x9ee4('0x0'));var md5=require(_0x9ee4('0x1'));var util=require(_0x9ee4('0x2'));var Redis=require(_0x9ee4('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x9ee4('0x4')](config[_0x9ee4('0x5')],{'host':_0x9ee4('0x6'),'port':0x18eb});var io=require(_0x9ee4('0x7'))(new Redis(config['redis']));function ChatQueue(_0x20c249){this['id']=_0x20c249['id']||0x0;this[_0x9ee4('0x8')]=_0x20c249['name']||'';this[_0x9ee4('0x9')]=_0x20c249[_0x9ee4('0x9')]||0xa;this[_0x9ee4('0xa')]=_0x20c249[_0x9ee4('0xa')]||_0x9ee4('0xb');this['Agents']=_0x20c249['Agents'];this[_0x9ee4('0xc')]={};this[_0x9ee4('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x9ee4('0xe')]();}ChatQueue['prototype'][_0x9ee4('0xf')]=function(){var _0x4b90a=this['mapAgentsId'][_0x9ee4('0x10')];this[_0x9ee4('0xc')]=_[_0x9ee4('0x11')](this[_0x9ee4('0x12')],'id');this[_0x9ee4('0xc')][_0x9ee4('0x10')]=_0x4b90a;};ChatQueue[_0x9ee4('0x13')][_0x9ee4('0xe')]=function(){this[_0x9ee4('0x14')]=0x0;this['paused']=0x0;for(var _0x392978=0x0;_0x392978=0x0?this['available']:0x0;var _0x328de0={'id':this['id'],'available':this[_0x9ee4('0x19')],'loggedIn':this[_0x9ee4('0x14')],'name':this[_0x9ee4('0x8')],'paused':this[_0x9ee4('0x18')],'waiting':this['waiting']};var _0x15d3a5=md5(JSON[_0x9ee4('0x1a')](_0x328de0));if(this[_0x9ee4('0x1')]!==_0x15d3a5){this['md5']=_0x15d3a5;io['to'](util['format']('chat:queue:%s',_0x328de0[_0x9ee4('0x8')]))[_0x9ee4('0x1b')]('chat_queue:save',_0x328de0);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 802126f..568d59d 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 _0xa8aa=['loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','prototype'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8aa,0xe4));var _0xaa8a=function(_0x916813,_0xbe72d2){_0x916813=_0x916813-0x0;var _0x4b8240=_0xa8aa[_0x916813];return _0x4b8240;};'use strict';var _=require('lodash');var md5=require(_0xaa8a('0x0'));var util=require(_0xaa8a('0x1'));var Redis=require('ioredis');var config=require(_0xaa8a('0x2'));config[_0xaa8a('0x3')]=_['defaults'](config[_0xaa8a('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xaa8a('0x4'))(new Redis(config[_0xaa8a('0x3')]));function FaxQueue(_0x3a7fec){this['id']=_0x3a7fec['id']||0x0;this['name']=_0x3a7fec[_0xaa8a('0x5')]||'';this['timeout']=_0x3a7fec[_0xaa8a('0x6')]||0xa;this['strategy']=_0x3a7fec[_0xaa8a('0x7')]||_0xaa8a('0x8');this[_0xaa8a('0x9')]=_0x3a7fec[_0xaa8a('0x9')];this['mapAgentsId']={};this[_0xaa8a('0xa')]=0x0;this[_0xaa8a('0x0')]='';this[_0xaa8a('0xb')]();this[_0xaa8a('0xc')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x89bec5=this[_0xaa8a('0xd')]['_rr'];this[_0xaa8a('0xd')]=_['map'](this[_0xaa8a('0x9')],'id');this[_0xaa8a('0xd')]['_rr']=_0x89bec5;};FaxQueue[_0xaa8a('0xe')][_0xaa8a('0xc')]=function(){this[_0xaa8a('0xf')]=0x0;this[_0xaa8a('0x10')]=0x0;for(var _0x3a1d14=0x0;_0x3a1d14=0x0?this[_0xaa8a('0x14')]:0x0;var _0x515cbc={'id':this['id'],'available':this[_0xaa8a('0x14')],'loggedIn':this[_0xaa8a('0xf')],'name':this['name'],'paused':this[_0xaa8a('0x10')],'waiting':this['waiting']};var _0x359b18=md5(JSON[_0xaa8a('0x15')](_0x515cbc));if(this[_0xaa8a('0x0')]!==_0x359b18){this[_0xaa8a('0x0')]=_0x359b18;io['to'](util[_0xaa8a('0x16')](_0xaa8a('0x17'),_0x515cbc[_0xaa8a('0x5')]))[_0xaa8a('0x18')](_0xaa8a('0x19'),_0x515cbc);}};module[_0xaa8a('0x1a')]=FaxQueue; \ No newline at end of file +var _0xff98=['_rr','map','loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','../../../config/environment','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x478963,_0x539bd8){var _0x33797d=function(_0x13db26){while(--_0x13db26){_0x478963['push'](_0x478963['shift']());}};_0x33797d(++_0x539bd8);}(_0xff98,0x138));var _0x8ff9=function(_0x141e55,_0x25d0d9){_0x141e55=_0x141e55-0x0;var _0x5a869a=_0xff98[_0x141e55];return _0x5a869a;};'use strict';var _=require(_0x8ff9('0x0'));var md5=require(_0x8ff9('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x8ff9('0x2'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8ff9('0x3'))(new Redis(config[_0x8ff9('0x4')]));function FaxQueue(_0x47c4c0){this['id']=_0x47c4c0['id']||0x0;this[_0x8ff9('0x5')]=_0x47c4c0['name']||'';this['timeout']=_0x47c4c0[_0x8ff9('0x6')]||0xa;this['strategy']=_0x47c4c0[_0x8ff9('0x7')]||_0x8ff9('0x8');this[_0x8ff9('0x9')]=_0x47c4c0[_0x8ff9('0x9')];this[_0x8ff9('0xa')]={};this[_0x8ff9('0xb')]=0x0;this[_0x8ff9('0x1')]='';this[_0x8ff9('0xc')]();this['updateRealtime']();}FaxQueue['prototype'][_0x8ff9('0xc')]=function(){var _0x5f1c29=this[_0x8ff9('0xa')][_0x8ff9('0xd')];this[_0x8ff9('0xa')]=_[_0x8ff9('0xe')](this['Agents'],'id');this[_0x8ff9('0xa')][_0x8ff9('0xd')]=_0x5f1c29;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x8ff9('0xf')]=0x0;this[_0x8ff9('0x10')]=0x0;for(var _0x5c2659=0x0;_0x5c2659=0x0?this[_0x8ff9('0x13')]:0x0;var _0x35dd8b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8ff9('0xf')],'name':this[_0x8ff9('0x5')],'paused':this[_0x8ff9('0x10')],'waiting':this[_0x8ff9('0xb')]};var _0x409b4e=md5(JSON[_0x8ff9('0x14')](_0x35dd8b));if(this[_0x8ff9('0x1')]!==_0x409b4e){this[_0x8ff9('0x1')]=_0x409b4e;io['to'](util[_0x8ff9('0x15')](_0x8ff9('0x16'),_0x35dd8b[_0x8ff9('0x5')]))[_0x8ff9('0x17')]('fax_queue:save',_0x35dd8b);}};module[_0x8ff9('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b0a4768..874ad45 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 _0x5679=['exports','name','Intervals'];(function(_0x20bdff,_0x3bcf0d){var _0x5edb15=function(_0x34daa3){while(--_0x34daa3){_0x20bdff['push'](_0x20bdff['shift']());}};_0x5edb15(++_0x3bcf0d);}(_0x5679,0x199));var _0x9567=function(_0x2c97be,_0x1079a2){_0x2c97be=_0x2c97be-0x0;var _0x382e46=_0x5679[_0x2c97be];return _0x382e46;};'use strict';function Interval(_0x4fa227){this['id']=_0x4fa227['id']||0x0;this[_0x9567('0x0')]=_0x4fa227[_0x9567('0x0')]||'';this[_0x9567('0x1')]=_0x4fa227[_0x9567('0x1')]||{};}module[_0x9567('0x2')]=Interval; \ No newline at end of file +var _0x40a7=['name','Intervals'];(function(_0xa4b84e,_0x3ae254){var _0x36e2fe=function(_0x2d0907){while(--_0x2d0907){_0xa4b84e['push'](_0xa4b84e['shift']());}};_0x36e2fe(++_0x3ae254);}(_0x40a7,0x1ee));var _0x740a=function(_0x55e01d,_0x5caada){_0x55e01d=_0x55e01d-0x0;var _0x3137fa=_0x40a7[_0x55e01d];return _0x3137fa;};'use strict';function Interval(_0x208dc0){this['id']=_0x208dc0['id']||0x0;this[_0x740a('0x0')]=_0x208dc0['name']||'';this[_0x740a('0x1')]=_0x208dc0[_0x740a('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index fc7ea89..a190c61 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 _0x764b=['beepall','Agents','updateRouting','updateRealtime','prototype','_rr','length','online','loggedIn','available','paused','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x1776e3,_0x14e945){var _0x102946=function(_0x3455c7){while(--_0x3455c7){_0x1776e3['push'](_0x1776e3['shift']());}};_0x102946(++_0x14e945);}(_0x764b,0x146));var _0xb764=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x764b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb764('0x0'));var md5=require(_0xb764('0x1'));var util=require('util');var Redis=require(_0xb764('0x2'));var config=require(_0xb764('0x3'));config[_0xb764('0x4')]=_[_0xb764('0x5')](config[_0xb764('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb764('0x6'))(new Redis(config[_0xb764('0x4')]));function MailQueue(_0x3fe267){this['id']=_0x3fe267['id']||0x0;this['name']=_0x3fe267[_0xb764('0x7')]||'';this[_0xb764('0x8')]=_0x3fe267['timeout']||0xa;this[_0xb764('0x9')]=_0x3fe267[_0xb764('0x9')]||_0xb764('0xa');this[_0xb764('0xb')]=_0x3fe267['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb764('0x1')]='';this[_0xb764('0xc')]();this[_0xb764('0xd')]();}MailQueue[_0xb764('0xe')][_0xb764('0xc')]=function(){var _0x421db9=this['mapAgentsId'][_0xb764('0xf')];this['mapAgentsId']=_['map'](this[_0xb764('0xb')],'id');this['mapAgentsId'][_0xb764('0xf')]=_0x421db9;};MailQueue[_0xb764('0xe')][_0xb764('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x488f23=0x0;_0x488f23=0x0?this['available']:0x0;var _0x57a637={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb764('0x12')],'name':this[_0xb764('0x7')],'paused':this['paused'],'waiting':this[_0xb764('0x15')]};var _0x3e3cc4=md5(JSON[_0xb764('0x16')](_0x57a637));if(this['md5']!==_0x3e3cc4){this[_0xb764('0x1')]=_0x3e3cc4;io['to'](util[_0xb764('0x17')](_0xb764('0x18'),_0x57a637[_0xb764('0x7')]))[_0xb764('0x19')](_0xb764('0x1a'),_0x57a637);}};module[_0xb764('0x1b')]=MailQueue; \ No newline at end of file +var _0xf38d=['updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0xf38d,0x160));var _0xdf38=function(_0xea136a,_0x3e53b8){_0xea136a=_0xea136a-0x0;var _0x39591b=_0xf38d[_0xea136a];return _0x39591b;};'use strict';var _=require(_0xdf38('0x0'));var md5=require(_0xdf38('0x1'));var util=require(_0xdf38('0x2'));var Redis=require(_0xdf38('0x3'));var config=require(_0xdf38('0x4'));config[_0xdf38('0x5')]=_['defaults'](config[_0xdf38('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xdf38('0x6'))(new Redis(config[_0xdf38('0x5')]));function MailQueue(_0x22f7d6){this['id']=_0x22f7d6['id']||0x0;this[_0xdf38('0x7')]=_0x22f7d6[_0xdf38('0x7')]||'';this[_0xdf38('0x8')]=_0x22f7d6[_0xdf38('0x8')]||0xa;this[_0xdf38('0x9')]=_0x22f7d6[_0xdf38('0x9')]||'beepall';this[_0xdf38('0xa')]=_0x22f7d6['Agents'];this[_0xdf38('0xb')]={};this['waiting']=0x0;this[_0xdf38('0x1')]='';this[_0xdf38('0xc')]();this['updateRealtime']();}MailQueue[_0xdf38('0xd')][_0xdf38('0xc')]=function(){var _0xb1c1fe=this[_0xdf38('0xb')][_0xdf38('0xe')];this[_0xdf38('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xdf38('0xe')]=_0xb1c1fe;};MailQueue[_0xdf38('0xd')][_0xdf38('0xf')]=function(){this[_0xdf38('0x10')]=0x0;this[_0xdf38('0x11')]=0x0;for(var _0x227d5c=0x0;_0x227d5c=0x0?this[_0xdf38('0x14')]:0x0;var _0x2d048a={'id':this['id'],'available':this[_0xdf38('0x14')],'loggedIn':this[_0xdf38('0x10')],'name':this[_0xdf38('0x7')],'paused':this[_0xdf38('0x11')],'waiting':this[_0xdf38('0x15')]};var _0x59ef70=md5(JSON[_0xdf38('0x16')](_0x2d048a));if(this[_0xdf38('0x1')]!==_0x59ef70){this['md5']=_0x59ef70;io['to'](util[_0xdf38('0x17')](_0xdf38('0x18'),_0x2d048a['name']))[_0xdf38('0x19')](_0xdf38('0x1a'),_0x2d048a);}};module[_0xdf38('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 e46ccf4..f32ee3c 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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x19ab90,_0x23773c){var _0x45b682=function(_0x21ae73){while(--_0x21ae73){_0x19ab90['push'](_0x19ab90['shift']());}};_0x45b682(++_0x23773c);}(_0xadb5,0xad));var _0x5adb=function(_0x3b0cf2,_0x4533f1){_0x3b0cf2=_0x3b0cf2-0x0;var _0xcc39dc=_0xadb5[_0x3b0cf2];return _0xcc39dc;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0x2ef3,0xba));var _0x32ef=function(_0x384c77,_0x38fb50){_0x384c77=_0x384c77-0x0;var _0x318c7a=_0x2ef3[_0x384c77];return _0x318c7a;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 36c4bcc..d6cf68f 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 _0x3036=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','exports','util','ioredis','../../../config/environment','defaults','redis','name','timeout'];(function(_0x243931,_0x4a2a9e){var _0x4a26a0=function(_0x5c25a5){while(--_0x5c25a5){_0x243931['push'](_0x243931['shift']());}};_0x4a26a0(++_0x4a2a9e);}(_0x3036,0x1a9));var _0x6303=function(_0x36f45d,_0x962c3e){_0x36f45d=_0x36f45d-0x0;var _0x4bdf50=_0x3036[_0x36f45d];return _0x4bdf50;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x6303('0x0'));var Redis=require(_0x6303('0x1'));var config=require(_0x6303('0x2'));config['redis']=_[_0x6303('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6303('0x4')]));function SmsQueue(_0x48d0c8){this['id']=_0x48d0c8['id']||0x0;this[_0x6303('0x5')]=_0x48d0c8[_0x6303('0x5')]||'';this[_0x6303('0x6')]=_0x48d0c8['timeout']||0xa;this[_0x6303('0x7')]=_0x48d0c8[_0x6303('0x7')]||_0x6303('0x8');this[_0x6303('0x9')]=_0x48d0c8[_0x6303('0x9')];this[_0x6303('0xa')]={};this[_0x6303('0xb')]=0x0;this[_0x6303('0xc')]='';this[_0x6303('0xd')]();this['updateRealtime']();}SmsQueue[_0x6303('0xe')][_0x6303('0xd')]=function(){var _0x3ac7ef=this[_0x6303('0xa')][_0x6303('0xf')];this['mapAgentsId']=_[_0x6303('0x10')](this[_0x6303('0x9')],'id');this[_0x6303('0xa')][_0x6303('0xf')]=_0x3ac7ef;};SmsQueue[_0x6303('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2726ef=0x0;_0x2726ef=0x0?this[_0x6303('0x16')]:0x0;var _0x36a6af={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6303('0x13')],'name':this[_0x6303('0x5')],'paused':this[_0x6303('0x15')],'waiting':this[_0x6303('0xb')]};var _0x33474f=md5(JSON[_0x6303('0x17')](_0x36a6af));if(this[_0x6303('0xc')]!==_0x33474f){this[_0x6303('0xc')]=_0x33474f;io['to'](util[_0x6303('0x18')](_0x6303('0x19'),_0x36a6af[_0x6303('0x5')]))['emit']('sms_queue:save',_0x36a6af);}};module[_0x6303('0x1a')]=SmsQueue; \ No newline at end of file +var _0x4b1f=['waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','paused','available','loggedIn','stringify','format','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x2f7270,_0x307af1){var _0xe1d89a=function(_0x1ba203){while(--_0x1ba203){_0x2f7270['push'](_0x2f7270['shift']());}};_0xe1d89a(++_0x307af1);}(_0x4b1f,0x195));var _0xf4b1=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x4b1f[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xf4b1('0x0'));var md5=require(_0xf4b1('0x1'));var util=require('util');var Redis=require(_0xf4b1('0x2'));var config=require(_0xf4b1('0x3'));config[_0xf4b1('0x4')]=_['defaults'](config[_0xf4b1('0x4')],{'host':_0xf4b1('0x5'),'port':0x18eb});var io=require(_0xf4b1('0x6'))(new Redis(config['redis']));function SmsQueue(_0x5f26a3){this['id']=_0x5f26a3['id']||0x0;this[_0xf4b1('0x7')]=_0x5f26a3[_0xf4b1('0x7')]||'';this[_0xf4b1('0x8')]=_0x5f26a3[_0xf4b1('0x8')]||0xa;this[_0xf4b1('0x9')]=_0x5f26a3['strategy']||'beepall';this['Agents']=_0x5f26a3[_0xf4b1('0xa')];this['mapAgentsId']={};this[_0xf4b1('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0xf4b1('0xc')]();}SmsQueue[_0xf4b1('0xd')][_0xf4b1('0xe')]=function(){var _0x253fa8=this[_0xf4b1('0xf')][_0xf4b1('0x10')];this[_0xf4b1('0xf')]=_[_0xf4b1('0x11')](this[_0xf4b1('0xa')],'id');this[_0xf4b1('0xf')][_0xf4b1('0x10')]=_0x253fa8;};SmsQueue[_0xf4b1('0xd')][_0xf4b1('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3ea6f3=0x0;_0x3ea6f3=0x0?this[_0xf4b1('0x13')]:0x0;var _0x420f9e={'id':this['id'],'available':this[_0xf4b1('0x13')],'loggedIn':this[_0xf4b1('0x14')],'name':this[_0xf4b1('0x7')],'paused':this[_0xf4b1('0x12')],'waiting':this['waiting']};var _0x220cad=md5(JSON[_0xf4b1('0x15')](_0x420f9e));if(this['md5']!==_0x220cad){this[_0xf4b1('0x1')]=_0x220cad;io['to'](util[_0xf4b1('0x16')]('sms:queue:%s',_0x420f9e[_0xf4b1('0x7')]))[_0xf4b1('0x17')](_0xf4b1('0x18'),_0x420f9e);}};module[_0xf4b1('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3b62cd1..741e065 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 _0xaab8=['prototype','loggedIn','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','map','_rr'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xaab8,0xcf));var _0x8aab=function(_0x4872ce,_0x1eb5fc){_0x4872ce=_0x4872ce-0x0;var _0x2ad042=_0xaab8[_0x4872ce];return _0x2ad042;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x8aab('0x0'));var config=require(_0x8aab('0x1'));config[_0x8aab('0x2')]=_[_0x8aab('0x3')](config[_0x8aab('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x8aab('0x4'))(new Redis(config[_0x8aab('0x2')]));function WhatsappQueue(_0x50a4f4){this['id']=_0x50a4f4['id']||0x0;this['name']=_0x50a4f4[_0x8aab('0x5')]||'';this[_0x8aab('0x6')]=_0x50a4f4[_0x8aab('0x6')]||0xa;this['strategy']=_0x50a4f4[_0x8aab('0x7')]||_0x8aab('0x8');this[_0x8aab('0x9')]=_0x50a4f4[_0x8aab('0x9')];this[_0x8aab('0xa')]={};this[_0x8aab('0xb')]=0x0;this[_0x8aab('0xc')]='';this['updateRouting']();this[_0x8aab('0xd')]();}WhatsappQueue['prototype'][_0x8aab('0xe')]=function(){var _0x1054cc=this[_0x8aab('0xa')]['_rr'];this['mapAgentsId']=_[_0x8aab('0xf')](this['Agents'],'id');this[_0x8aab('0xa')][_0x8aab('0x10')]=_0x1054cc;};WhatsappQueue[_0x8aab('0x11')][_0x8aab('0xd')]=function(){this[_0x8aab('0x12')]=0x0;this['paused']=0x0;for(var _0x11692b=0x0;_0x11692b=0x0?this[_0x8aab('0x16')]:0x0;var _0x2dfe8c={'id':this['id'],'available':this[_0x8aab('0x16')],'loggedIn':this[_0x8aab('0x12')],'name':this[_0x8aab('0x5')],'paused':this[_0x8aab('0x15')],'waiting':this[_0x8aab('0xb')]};var _0x1a5bfb=md5(JSON[_0x8aab('0x17')](_0x2dfe8c));if(this[_0x8aab('0xc')]!==_0x1a5bfb){this[_0x8aab('0xc')]=_0x1a5bfb;io['to'](util[_0x8aab('0x18')](_0x8aab('0x19'),_0x2dfe8c[_0x8aab('0x5')]))['emit'](_0x8aab('0x1a'),_0x2dfe8c);}};module[_0x8aab('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xee11=['whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','paused','length','online','loggedIn','whatsappPause','available','stringify','format'];(function(_0x40ec7c,_0x3a29c3){var _0x2a8161=function(_0x34520d){while(--_0x34520d){_0x40ec7c['push'](_0x40ec7c['shift']());}};_0x2a8161(++_0x3a29c3);}(_0xee11,0x1d4));var _0x1ee1=function(_0x519de3,_0xe7c04e){_0x519de3=_0x519de3-0x0;var _0x3e21d9=_0xee11[_0x519de3];return _0x3e21d9;};'use strict';var _=require(_0x1ee1('0x0'));var md5=require(_0x1ee1('0x1'));var util=require('util');var Redis=require(_0x1ee1('0x2'));var config=require(_0x1ee1('0x3'));config[_0x1ee1('0x4')]=_[_0x1ee1('0x5')](config[_0x1ee1('0x4')],{'host':_0x1ee1('0x6'),'port':0x18eb});var io=require(_0x1ee1('0x7'))(new Redis(config[_0x1ee1('0x4')]));function WhatsappQueue(_0x405c9f){this['id']=_0x405c9f['id']||0x0;this[_0x1ee1('0x8')]=_0x405c9f[_0x1ee1('0x8')]||'';this[_0x1ee1('0x9')]=_0x405c9f['timeout']||0xa;this[_0x1ee1('0xa')]=_0x405c9f[_0x1ee1('0xa')]||_0x1ee1('0xb');this[_0x1ee1('0xc')]=_0x405c9f[_0x1ee1('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x1ee1('0x1')]='';this[_0x1ee1('0xd')]();this[_0x1ee1('0xe')]();}WhatsappQueue[_0x1ee1('0xf')][_0x1ee1('0xd')]=function(){var _0x4edcbb=this[_0x1ee1('0x10')]['_rr'];this['mapAgentsId']=_['map'](this[_0x1ee1('0xc')],'id');this[_0x1ee1('0x10')]['_rr']=_0x4edcbb;};WhatsappQueue[_0x1ee1('0xf')][_0x1ee1('0xe')]=function(){this['loggedIn']=0x0;this[_0x1ee1('0x11')]=0x0;for(var _0x25c3fb=0x0;_0x25c3fb=0x0?this[_0x1ee1('0x16')]:0x0;var _0x3a4754={'id':this['id'],'available':this[_0x1ee1('0x16')],'loggedIn':this[_0x1ee1('0x14')],'name':this[_0x1ee1('0x8')],'paused':this[_0x1ee1('0x11')],'waiting':this['waiting']};var _0x12e083=md5(JSON[_0x1ee1('0x17')](_0x3a4754));if(this[_0x1ee1('0x1')]!==_0x12e083){this[_0x1ee1('0x1')]=_0x12e083;io['to'](util[_0x1ee1('0x18')](_0x1ee1('0x19'),_0x3a4754['name']))[_0x1ee1('0x1a')](_0x1ee1('0x1b'),_0x3a4754);}};module[_0x1ee1('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 4b58d52..3f8b727 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(_0x33884d,_0x2d27b2){var _0x576efd=function(_0x4fc961){while(--_0x4fc961){_0x33884d['push'](_0x33884d['shift']());}};_0x576efd(++_0x2d27b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x547515,_0x41c2c4){_0x547515=_0x547515-0x0;var _0x2fdecf=_0xb10b[_0x547515];return _0x2fdecf;};'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(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 4fbdfe6..73c56a4 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 _0x6cb4=['update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6cb4,0xe3));var _0x46cb=function(_0x532eed,_0x1ff6d8){_0x532eed=_0x532eed-0x0;var _0x1c239c=_0x6cb4[_0x532eed];return _0x1c239c;};'use strict';var client=require(_0x46cb('0x0'));exports[_0x46cb('0x1')]=function(_0x2c5f57,_0x1b6059){return client[_0x46cb('0x2')]('UpdateChatInteraction',{'body':_0x1b6059,'options':{'where':{'id':_0x2c5f57}},'log':_0x46cb('0x3')});};exports[_0x46cb('0x4')]=function(_0x662259,_0x3089e9){return client[_0x46cb('0x2')](_0x46cb('0x5'),{'body':_0x3089e9,'options':{'where':{'id':_0x662259}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xdc17=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2a43fc,_0x3f309f){var _0x3c5022=function(_0x257102){while(--_0x257102){_0x2a43fc['push'](_0x2a43fc['shift']());}};_0x3c5022(++_0x3f309f);}(_0xdc17,0x11f));var _0x7dc1=function(_0x4d3abe,_0x4e4459){_0x4d3abe=_0x4d3abe-0x0;var _0x2df124=_0xdc17[_0x4d3abe];return _0x2df124;};'use strict';var client=require(_0x7dc1('0x0'));exports[_0x7dc1('0x1')]=function(_0x5953ed,_0x3f6c3c){return client[_0x7dc1('0x2')](_0x7dc1('0x3'),{'body':_0x3f6c3c,'options':{'where':{'id':_0x5953ed}},'log':_0x7dc1('0x4')});};exports[_0x7dc1('0x5')]=function(_0x509ff0,_0x4a5ac7){return client[_0x7dc1('0x2')](_0x7dc1('0x6'),{'body':_0x4a5ac7,'options':{'where':{'id':_0x509ff0}},'log':_0x7dc1('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a301720..3896ff5 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 _0x4162=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x20c893,_0xbef2b4){var _0xc705e8=function(_0x449739){while(--_0x449739){_0x20c893['push'](_0x20c893['shift']());}};_0xc705e8(++_0xbef2b4);}(_0x4162,0x1b3));var _0x2416=function(_0x54e88b,_0x29a4da){_0x54e88b=_0x54e88b-0x0;var _0x53a57e=_0x4162[_0x54e88b];return _0x53a57e;};'use strict';var client=require(_0x2416('0x0'));exports['create']=function(_0xe3e5be){return client[_0x2416('0x1')](_0x2416('0x2'),{'body':_0xe3e5be,'log':_0x2416('0x3')});}; \ No newline at end of file +var _0x9090=['createChatMessage','create'];(function(_0x18e2b6,_0x5e188b){var _0x1b34b0=function(_0x207e53){while(--_0x207e53){_0x18e2b6['push'](_0x18e2b6['shift']());}};_0x1b34b0(++_0x5e188b);}(_0x9090,0x1db));var _0x0909=function(_0x7f03be,_0x155bb3){_0x7f03be=_0x7f03be-0x0;var _0x28da01=_0x9090[_0x7f03be];return _0x28da01;};'use strict';var client=require('../client');exports[_0x0909('0x0')]=function(_0x26e9b8){return client['Request']('CreateChatMessage',{'body':_0x26e9b8,'log':_0x0909('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index cbb10fd..057fd24 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 _0x9c50=['chatPause','GetChatQueue','timeout','Agents','name'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x9c50,0xec));var _0x09c5=function(_0x46cd25,_0x771a25){_0x46cd25=_0x46cd25-0x0;var _0x556def=_0x9c50[_0x46cd25];return _0x556def;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client['Request'](_0x09c5('0x0'),{'options':{'raw':![],'attributes':['id','name',_0x09c5('0x1'),'strategy'],'include':[{'model':'User','as':_0x09c5('0x2'),'attributes':['id',_0x09c5('0x3'),'online',_0x09c5('0x4')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x06f4=['online','chatPause','../client','getChatQueues','GetChatQueue','name','User'];(function(_0x21380b,_0x263c7a){var _0x2c8ea0=function(_0x35ddd4){while(--_0x35ddd4){_0x21380b['push'](_0x21380b['shift']());}};_0x2c8ea0(++_0x263c7a);}(_0x06f4,0x136));var _0x406f=function(_0x4443b4,_0x1e0450){_0x4443b4=_0x4443b4-0x0;var _0x29b364=_0x06f4[_0x4443b4];return _0x29b364;};'use strict';var client=require(_0x406f('0x0'));exports[_0x406f('0x1')]=function(){return function(){return client['Request'](_0x406f('0x2'),{'options':{'raw':![],'attributes':['id',_0x406f('0x3'),'timeout','strategy'],'include':[{'model':_0x406f('0x4'),'as':'Agents','attributes':['id',_0x406f('0x3'),_0x406f('0x5'),_0x406f('0x6')]}]},'log':_0x406f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 44ad657..3ec1b26 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 _0x21a3=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x117a90,_0x1deb3d){var _0x1c73cd=function(_0x420778){while(--_0x420778){_0x117a90['push'](_0x117a90['shift']());}};_0x1c73cd(++_0x1deb3d);}(_0x21a3,0x66));var _0x321a=function(_0xb64e9e,_0x519fb2){_0xb64e9e=_0xb64e9e-0x0;var _0x1c63f4=_0x21a3[_0xb64e9e];return _0x1c63f4;};'use strict';var client=require(_0x321a('0x0'));exports['create']=function(_0x2b85b5){return client[_0x321a('0x1')](_0x321a('0x2'),{'body':_0x2b85b5,'log':_0x321a('0x2')});};exports[_0x321a('0x3')]=function(_0x185e2a,_0x5df495){return client['Request'](_0x321a('0x4'),{'body':_0x5df495,'options':{'where':{'uniqueid':_0x185e2a},'order':[['id',_0x321a('0x5')]],'limit':0x1},'log':_0x321a('0x4')});}; \ No newline at end of file +var _0xc874=['../client','Request','update','UpdateChatQueueReport','DESC'];(function(_0x266539,_0x2511fe){var _0x4c8cf1=function(_0x3c9014){while(--_0x3c9014){_0x266539['push'](_0x266539['shift']());}};_0x4c8cf1(++_0x2511fe);}(_0xc874,0x154));var _0x4c87=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0xc874[_0x343e44];return _0xa5130e;};'use strict';var client=require(_0x4c87('0x0'));exports['create']=function(_0x24f552){return client[_0x4c87('0x1')]('CreateChatQueueReport',{'body':_0x24f552,'log':'CreateChatQueueReport'});};exports[_0x4c87('0x2')]=function(_0x13c057,_0x1c3dbc){return client['Request'](_0x4c87('0x3'),{'body':_0x1c3dbc,'options':{'where':{'uniqueid':_0x13c057},'order':[['id',_0x4c87('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index eef717a..523f68c 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(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x7a54,0x106));var _0x47a5=function(_0x37764f,_0x4a9dbf){_0x37764f=_0x37764f-0x0;var _0x3742a6=_0x7a54[_0x37764f];return _0x3742a6;};'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(_0x46c3d7,_0x45bf58){var _0x121592=function(_0x3b549a){while(--_0x3b549a){_0x46c3d7['push'](_0x46c3d7['shift']());}};_0x121592(++_0x45bf58);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 1b7fe9b..bcac2cd 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 _0x1f58=['create','Request','CreateFaxMessage','../client'];(function(_0x38e7eb,_0x5315b9){var _0x420b11=function(_0xe5347){while(--_0xe5347){_0x38e7eb['push'](_0x38e7eb['shift']());}};_0x420b11(++_0x5315b9);}(_0x1f58,0x19f));var _0x81f5=function(_0x120c9e,_0xb7938f){_0x120c9e=_0x120c9e-0x0;var _0x25eff5=_0x1f58[_0x120c9e];return _0x25eff5;};'use strict';var client=require(_0x81f5('0x0'));exports[_0x81f5('0x1')]=function(_0x57a721){return client[_0x81f5('0x2')](_0x81f5('0x3'),{'body':_0x57a721,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x48e7=['createFaxMessage','../client','Request'];(function(_0x3304c4,_0x3e555a){var _0x30730c=function(_0xfbef1b){while(--_0xfbef1b){_0x3304c4['push'](_0x3304c4['shift']());}};_0x30730c(++_0x3e555a);}(_0x48e7,0x1cf));var _0x748e=function(_0x4f746d,_0x5c0073){_0x4f746d=_0x4f746d-0x0;var _0xce1322=_0x48e7[_0x4f746d];return _0xce1322;};'use strict';var client=require(_0x748e('0x0'));exports['create']=function(_0x20bd6e){return client[_0x748e('0x1')]('CreateFaxMessage',{'body':_0x20bd6e,'log':_0x748e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f8a6d9d..5d15736 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 _0x45de=['Request','GetFaxQueue','name','Agents','faxPause','getFaxQueues'];(function(_0x12ce9f,_0x3fa7f2){var _0x2da60e=function(_0x4e6363){while(--_0x4e6363){_0x12ce9f['push'](_0x12ce9f['shift']());}};_0x2da60e(++_0x3fa7f2);}(_0x45de,0x1e5));var _0xe45d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x45de[_0x3b380d];return _0x54502b;};'use strict';var client=require('../client');exports[_0xe45d('0x0')]=function(){return function(){return client[_0xe45d('0x1')](_0xe45d('0x2'),{'options':{'raw':![],'attributes':['id',_0xe45d('0x3'),'timeout','strategy'],'include':[{'model':'User','as':_0xe45d('0x4'),'attributes':['id','name','online',_0xe45d('0x5')]}]},'log':_0xe45d('0x0')});};}; \ No newline at end of file +var _0x59f9=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','online'];(function(_0x49ca69,_0x55157c){var _0x3d2e97=function(_0x12ff23){while(--_0x12ff23){_0x49ca69['push'](_0x49ca69['shift']());}};_0x3d2e97(++_0x55157c);}(_0x59f9,0x119));var _0x959f=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0x59f9[_0x31cc0e];return _0x144862;};'use strict';var client=require(_0x959f('0x0'));exports[_0x959f('0x1')]=function(){return function(){return client[_0x959f('0x2')](_0x959f('0x3'),{'options':{'raw':![],'attributes':['id',_0x959f('0x4'),_0x959f('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x959f('0x4'),_0x959f('0x6'),_0x959f('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 35541cc..8d5bb7e 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 _0x12e5=['../client','CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC'];(function(_0x434e1a,_0x16f187){var _0x15081a=function(_0x2f94ec){while(--_0x2f94ec){_0x434e1a['push'](_0x434e1a['shift']());}};_0x15081a(++_0x16f187);}(_0x12e5,0xe6));var _0x512e=function(_0x1af6b4,_0x1dcdbe){_0x1af6b4=_0x1af6b4-0x0;var _0x51190f=_0x12e5[_0x1af6b4];return _0x51190f;};'use strict';var client=require(_0x512e('0x0'));exports['create']=function(_0xbba0fa){return client['Request'](_0x512e('0x1'),{'body':_0xbba0fa,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x1c2b8b,_0x7307da){return client[_0x512e('0x2')](_0x512e('0x3'),{'body':_0x7307da,'options':{'where':{'uniqueid':_0x1c2b8b},'order':[['id',_0x512e('0x4')]],'limit':0x1},'log':_0x512e('0x3')});}; \ No newline at end of file +var _0xb444=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x1826d0,_0x32a217){var _0xa7a757=function(_0x30574b){while(--_0x30574b){_0x1826d0['push'](_0x1826d0['shift']());}};_0xa7a757(++_0x32a217);}(_0xb444,0xcc));var _0x4b44=function(_0x5ce6dc,_0x16cdec){_0x5ce6dc=_0x5ce6dc-0x0;var _0x128837=_0xb444[_0x5ce6dc];return _0x128837;};'use strict';var client=require('../client');exports[_0x4b44('0x0')]=function(_0x3df092){return client[_0x4b44('0x1')](_0x4b44('0x2'),{'body':_0x3df092,'log':_0x4b44('0x2')});};exports[_0x4b44('0x3')]=function(_0x4e3797,_0x292511){return client['Request'](_0x4b44('0x4'),{'body':_0x292511,'options':{'where':{'uniqueid':_0x4e3797},'order':[['id',_0x4b44('0x5')]],'limit':0x1},'log':_0x4b44('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5d1d321..1b09625 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 _0xca2a=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x4ade91,_0x50aaa3){var _0x238bec=function(_0x370855){while(--_0x370855){_0x4ade91['push'](_0x4ade91['shift']());}};_0x238bec(++_0x50aaa3);}(_0xca2a,0x9e));var _0xaca2=function(_0x553cca,_0x20e9b5){_0x553cca=_0x553cca-0x0;var _0x464da1=_0xca2a[_0x553cca];return _0x464da1;};'use strict';var client=require(_0xaca2('0x0'));exports[_0xaca2('0x1')]=function(){return function(){return client[_0xaca2('0x2')](_0xaca2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xaca2('0x4'),'as':_0xaca2('0x5'),'attributes':['id',_0xaca2('0x6'),_0xaca2('0x7')]}]},'log':_0xaca2('0x1')});};}; \ No newline at end of file +var _0x605a=['Intervals','interval','getIntervals','../client','Request','GetInterval','name'];(function(_0x3be951,_0x9d9eed){var _0x53e527=function(_0x483a9f){while(--_0x483a9f){_0x3be951['push'](_0x3be951['shift']());}};_0x53e527(++_0x9d9eed);}(_0x605a,0x168));var _0xa605=function(_0x33c449,_0x3be818){_0x33c449=_0x33c449-0x0;var _0x3b8c80=_0x605a[_0x33c449];return _0x3b8c80;};'use strict';var client=require(_0xa605('0x0'));exports['getIntervals']=function(){return function(){return client[_0xa605('0x1')](_0xa605('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa605('0x3')],'include':[{'model':'Interval','as':_0xa605('0x4'),'attributes':['id','name',_0xa605('0x5')]}]},'log':_0xa605('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 4ab3ea9..f9fd40b 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 _0x1eba=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x1eba[_0x30ae5e];return _0x1f2e93;};'use strict';var client=require(_0xa1eb('0x0'));exports[_0xa1eb('0x1')]=function(_0x406a58,_0x2158d5){return client[_0xa1eb('0x2')]('UpdateMailInteraction',{'body':_0x2158d5,'options':{'where':{'id':_0x406a58}},'log':'updateMailInteraction'});};exports[_0xa1eb('0x3')]=function(_0x34be5a,_0x16a13a){return client[_0xa1eb('0x2')](_0xa1eb('0x4'),{'body':_0x16a13a,'options':{'where':{'id':_0x34be5a}},'log':_0xa1eb('0x5')});}; \ No newline at end of file +var _0xaebd=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction'];(function(_0x50b5f1,_0x23557a){var _0x49f7f7=function(_0x515671){while(--_0x515671){_0x50b5f1['push'](_0x50b5f1['shift']());}};_0x49f7f7(++_0x23557a);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1d9457,_0x15049c){_0x1d9457=_0x1d9457-0x0;var _0xdc14d1=_0xaebd[_0x1d9457];return _0xdc14d1;};'use strict';var client=require(_0xdaeb('0x0'));exports['update']=function(_0x2e2d0c,_0xac84fd){return client[_0xdaeb('0x1')](_0xdaeb('0x2'),{'body':_0xac84fd,'options':{'where':{'id':_0x2e2d0c}},'log':_0xdaeb('0x3')});};exports['addTags']=function(_0x44e982,_0x1c617a){return client[_0xdaeb('0x1')](_0xdaeb('0x4'),{'body':_0x1c617a,'options':{'where':{'id':_0x44e982}},'log':_0xdaeb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index bfbda8a..aca8af8 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 _0x7f37=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x354bbe,_0x5390ee){var _0x3eec63=function(_0x3f36c2){while(--_0x3f36c2){_0x354bbe['push'](_0x354bbe['shift']());}};_0x3eec63(++_0x5390ee);}(_0x7f37,0x182));var _0x77f3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7f37[_0x53ccf2];return _0x5a2964;};'use strict';var client=require(_0x77f3('0x0'));exports[_0x77f3('0x1')]=function(_0x3bf6c){return client[_0x77f3('0x2')](_0x77f3('0x3'),{'body':_0x3bf6c,'log':_0x77f3('0x4')});}; \ No newline at end of file +var _0xc202=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0xc202,0x1ae));var _0x2c20=function(_0x586794,_0x42c594){_0x586794=_0x586794-0x0;var _0x20fa81=_0xc202[_0x586794];return _0x20fa81;};'use strict';var client=require(_0x2c20('0x0'));exports['create']=function(_0x21c359){return client[_0x2c20('0x1')](_0x2c20('0x2'),{'body':_0x21c359,'log':_0x2c20('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d9b91a7..f23cbf4 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 _0x60ae=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','online'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x60ae,0xbe));var _0xe60a=function(_0x2b51c2,_0x401991){_0x2b51c2=_0x2b51c2-0x0;var _0x234ecd=_0x60ae[_0x2b51c2];return _0x234ecd;};'use strict';var client=require('../client');exports[_0xe60a('0x0')]=function(){return function(){return client[_0xe60a('0x1')](_0xe60a('0x2'),{'options':{'raw':![],'attributes':['id',_0xe60a('0x3'),_0xe60a('0x4'),_0xe60a('0x5')],'include':[{'model':_0xe60a('0x6'),'as':'Agents','attributes':['id',_0xe60a('0x3'),_0xe60a('0x7'),_0xe60a('0x8')]}]},'log':_0xe60a('0x0')});};}; \ No newline at end of file +var _0x6d5c=['GetMailQueue','timeout','strategy','Agents','name','online','mailPause','../client','getMailQueues','Request'];(function(_0x162d70,_0x3192e8){var _0x3fd813=function(_0xf81745){while(--_0xf81745){_0x162d70['push'](_0x162d70['shift']());}};_0x3fd813(++_0x3192e8);}(_0x6d5c,0x179));var _0xc6d5=function(_0x2948fd,_0x427606){_0x2948fd=_0x2948fd-0x0;var _0x1bf851=_0x6d5c[_0x2948fd];return _0x1bf851;};'use strict';var client=require(_0xc6d5('0x0'));exports[_0xc6d5('0x1')]=function(){return function(){return client[_0xc6d5('0x2')](_0xc6d5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc6d5('0x4'),_0xc6d5('0x5')],'include':[{'model':'User','as':_0xc6d5('0x6'),'attributes':['id',_0xc6d5('0x7'),_0xc6d5('0x8'),_0xc6d5('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 207ff40..6476e69 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 _0xd85a=['update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x4d962b,_0x57bf97){var _0x15ca5d=function(_0xa8ee01){while(--_0xa8ee01){_0x4d962b['push'](_0x4d962b['shift']());}};_0x15ca5d(++_0x57bf97);}(_0xd85a,0x82));var _0xad85=function(_0x47ec61,_0x21c69a){_0x47ec61=_0x47ec61-0x0;var _0x3d9d9c=_0xd85a[_0x47ec61];return _0x3d9d9c;};'use strict';var client=require(_0xad85('0x0'));exports[_0xad85('0x1')]=function(_0x35a208){return client['Request']('CreateMailQueueReport',{'body':_0x35a208,'log':'CreateMailQueueReport'});};exports[_0xad85('0x2')]=function(_0x3b154b,_0x18489f){return client[_0xad85('0x3')](_0xad85('0x4'),{'body':_0x18489f,'options':{'where':{'uniqueid':_0x3b154b},'order':[['id',_0xad85('0x5')]],'limit':0x1},'log':_0xad85('0x4')});}; \ No newline at end of file +var _0xfcff=['CreateMailQueueReport','UpdateMailQueueReport','DESC','create','Request'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0xfcff,0x10c));var _0xffcf=function(_0x5c451d,_0x5c76cf){_0x5c451d=_0x5c451d-0x0;var _0x10edfd=_0xfcff[_0x5c451d];return _0x10edfd;};'use strict';var client=require('../client');exports[_0xffcf('0x0')]=function(_0x949e16){return client[_0xffcf('0x1')](_0xffcf('0x2'),{'body':_0x949e16,'log':'CreateMailQueueReport'});};exports['update']=function(_0x24be8e,_0x32005b){return client[_0xffcf('0x1')](_0xffcf('0x3'),{'body':_0x32005b,'options':{'where':{'uniqueid':_0x24be8e},'order':[['id',_0xffcf('0x4')]],'limit':0x1},'log':_0xffcf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index cff6aaf..100e0d1 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 _0x9933=['updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9933,0x18f));var _0x3993=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9933[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x3993('0x0'));exports['update']=function(_0x503ed6,_0x5368a1){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x5368a1,'options':{'where':{'id':_0x503ed6}},'log':_0x3993('0x1')});};exports['addTags']=function(_0x23c5b1,_0x2d1b0d){return client[_0x3993('0x2')](_0x3993('0x3'),{'body':_0x2d1b0d,'options':{'where':{'id':_0x23c5b1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x507e=['AddTagsToOpenchannelInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request'];(function(_0x4aaacb,_0x266135){var _0x361416=function(_0x55c26f){while(--_0x55c26f){_0x4aaacb['push'](_0x4aaacb['shift']());}};_0x361416(++_0x266135);}(_0x507e,0x11b));var _0xe507=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x507e[_0x4e697a];return _0x88850c;};'use strict';var client=require('../client');exports[_0xe507('0x0')]=function(_0x4f9c56,_0x3fba3c){return client['Request'](_0xe507('0x1'),{'body':_0x3fba3c,'options':{'where':{'id':_0x4f9c56}},'log':_0xe507('0x2')});};exports[_0xe507('0x3')]=function(_0x106c05,_0x5c511e){return client[_0xe507('0x4')](_0xe507('0x5'),{'body':_0x5c511e,'options':{'where':{'id':_0x106c05}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 07185b4..1edaea4 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 _0xde95=['../client','create'];(function(_0x34f8c8,_0x40602c){var _0x555272=function(_0x103f95){while(--_0x103f95){_0x34f8c8['push'](_0x34f8c8['shift']());}};_0x555272(++_0x40602c);}(_0xde95,0x7c));var _0x5de9=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xde95[_0x4a3898];return _0x25ceb0;};'use strict';var client=require(_0x5de9('0x0'));exports[_0x5de9('0x1')]=function(_0x21e221){return client['Request']('CreateOpenchannelMessage',{'body':_0x21e221,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x46d5=['CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x507d5a,_0x5f48bc){var _0x36572a=function(_0x35f020){while(--_0x35f020){_0x507d5a['push'](_0x507d5a['shift']());}};_0x36572a(++_0x5f48bc);}(_0x46d5,0x16a));var _0x546d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x46d5[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports[_0x546d('0x0')]=function(_0xcbbae5){return client['Request'](_0x546d('0x1'),{'body':_0xcbbae5,'log':_0x546d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index a58ac63..546722b 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 _0x0849=['getOpenchannelQueues','name','timeout','User','Agents','online','../client'];(function(_0xddea0b,_0x4e413c){var _0x44de97=function(_0x33f0c6){while(--_0x33f0c6){_0xddea0b['push'](_0xddea0b['shift']());}};_0x44de97(++_0x4e413c);}(_0x0849,0xca));var _0x9084=function(_0x24ee9b,_0x389de0){_0x24ee9b=_0x24ee9b-0x0;var _0x54c5d1=_0x0849[_0x24ee9b];return _0x54c5d1;};'use strict';var client=require(_0x9084('0x0'));exports[_0x9084('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9084('0x2'),_0x9084('0x3'),'strategy'],'include':[{'model':_0x9084('0x4'),'as':_0x9084('0x5'),'attributes':['id',_0x9084('0x2'),_0x9084('0x6'),'openchannelPause']}]},'log':_0x9084('0x1')});};}; \ No newline at end of file +var _0x7ea8=['GetOpenchannelQueue','name','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0xb6cfbd,_0xad6da9){var _0x46e0fb=function(_0x29a353){while(--_0x29a353){_0xb6cfbd['push'](_0xb6cfbd['shift']());}};_0x46e0fb(++_0xad6da9);}(_0x7ea8,0x1d1));var _0x87ea=function(_0x1dd4d8,_0x1cef07){_0x1dd4d8=_0x1dd4d8-0x0;var _0x1a7273=_0x7ea8[_0x1dd4d8];return _0x1a7273;};'use strict';var client=require(_0x87ea('0x0'));exports[_0x87ea('0x1')]=function(){return function(){return client[_0x87ea('0x2')](_0x87ea('0x3'),{'options':{'raw':![],'attributes':['id',_0x87ea('0x4'),'timeout',_0x87ea('0x5')],'include':[{'model':_0x87ea('0x6'),'as':_0x87ea('0x7'),'attributes':['id','name','online',_0x87ea('0x8')]}]},'log':_0x87ea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ac3eed4..a883c42 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 _0x2539=['CreateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x1d2009,_0x28ccaf){var _0x2df180=function(_0x27003){while(--_0x27003){_0x1d2009['push'](_0x1d2009['shift']());}};_0x2df180(++_0x28ccaf);}(_0x2539,0x147));var _0x9253=function(_0x3b91a0,_0x39d03d){_0x3b91a0=_0x3b91a0-0x0;var _0x52859a=_0x2539[_0x3b91a0];return _0x52859a;};'use strict';var client=require(_0x9253('0x0'));exports[_0x9253('0x1')]=function(_0x35542a){return client[_0x9253('0x2')](_0x9253('0x3'),{'body':_0x35542a,'log':_0x9253('0x3')});};exports['update']=function(_0x2a18dc,_0xecd5e9){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0xecd5e9,'options':{'where':{'uniqueid':_0x2a18dc},'order':[['id',_0x9253('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x9055=['DESC','../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x1fcc1e,_0x39efee){var _0x13497a=function(_0x56d1fe){while(--_0x56d1fe){_0x1fcc1e['push'](_0x1fcc1e['shift']());}};_0x13497a(++_0x39efee);}(_0x9055,0xa2));var _0x5905=function(_0x28fe92,_0x403572){_0x28fe92=_0x28fe92-0x0;var _0x3ff255=_0x9055[_0x28fe92];return _0x3ff255;};'use strict';var client=require(_0x5905('0x0'));exports[_0x5905('0x1')]=function(_0x5e069f){return client['Request'](_0x5905('0x2'),{'body':_0x5e069f,'log':_0x5905('0x2')});};exports[_0x5905('0x3')]=function(_0x115bc2,_0x3667e8){return client[_0x5905('0x4')](_0x5905('0x5'),{'body':_0x3667e8,'options':{'where':{'uniqueid':_0x115bc2},'order':[['id',_0x5905('0x6')]],'limit':0x1},'log':_0x5905('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index efc8e92..d73ec68 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 _0xad36=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xad36,0x11c));var _0x6ad3=function(_0x3da3af,_0x1496ac){_0x3da3af=_0x3da3af-0x0;var _0x57fce9=_0xad36[_0x3da3af];return _0x57fce9;};'use strict';var client=require('../client');exports[_0x6ad3('0x0')]=function(_0x3e139,_0x31d949){return client[_0x6ad3('0x1')](_0x6ad3('0x2'),{'body':_0x31d949,'options':{'where':{'id':_0x3e139}},'log':_0x6ad3('0x3')});};exports[_0x6ad3('0x4')]=function(_0x17a9b2,_0x3d8fee){return client['Request'](_0x6ad3('0x5'),{'body':_0x3d8fee,'options':{'where':{'id':_0x17a9b2}},'log':_0x6ad3('0x6')});}; \ No newline at end of file +var _0xb7cf=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x49c541,_0x2db112){var _0x488f8d=function(_0x309d6c){while(--_0x309d6c){_0x49c541['push'](_0x49c541['shift']());}};_0x488f8d(++_0x2db112);}(_0xb7cf,0xca));var _0xfb7c=function(_0x486c22,_0x306c6d){_0x486c22=_0x486c22-0x0;var _0xbad918=_0xb7cf[_0x486c22];return _0xbad918;};'use strict';var client=require(_0xfb7c('0x0'));exports[_0xfb7c('0x1')]=function(_0x3baed3,_0x2c52ed){return client[_0xfb7c('0x2')]('UpdateSmsInteraction',{'body':_0x2c52ed,'options':{'where':{'id':_0x3baed3}},'log':_0xfb7c('0x3')});};exports[_0xfb7c('0x4')]=function(_0xf6b92f,_0xf47c1d){return client[_0xfb7c('0x2')](_0xfb7c('0x5'),{'body':_0xf47c1d,'options':{'where':{'id':_0xf6b92f}},'log':_0xfb7c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 88cfa29..70686ac 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 _0x3806=['createSmsMessage','Request'];(function(_0x45e299,_0x37704d){var _0x1a895f=function(_0x5c12ac){while(--_0x5c12ac){_0x45e299['push'](_0x45e299['shift']());}};_0x1a895f(++_0x37704d);}(_0x3806,0x77));var _0x6380=function(_0x5eb1d6,_0x2a79e9){_0x5eb1d6=_0x5eb1d6-0x0;var _0x328f8c=_0x3806[_0x5eb1d6];return _0x328f8c;};'use strict';var client=require('../client');exports['create']=function(_0x4e23cf){return client[_0x6380('0x0')]('CreateSmsMessage',{'body':_0x4e23cf,'log':_0x6380('0x1')});}; \ No newline at end of file +var _0xedae=['createSmsMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xedae,0xa4));var _0xeeda=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xedae[_0x2f3848];return _0x102668;};'use strict';var client=require('../client');exports['create']=function(_0x505560){return client['Request']('CreateSmsMessage',{'body':_0x505560,'log':_0xeeda('0x0')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index bbeec30..669183f 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x267f2b,_0x139286){var _0x367d07=function(_0x33c247){while(--_0x33c247){_0x267f2b['push'](_0x267f2b['shift']());}};_0x367d07(++_0x139286);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0xe4a6bf,_0x1aa34b){var _0x2702a7=function(_0x103f96){while(--_0x103f96){_0xe4a6bf['push'](_0xe4a6bf['shift']());}};_0x2702a7(++_0x1aa34b);}(_0xe706,0xa3));var _0x6e70=function(_0x5ecaab,_0x2f3053){_0x5ecaab=_0x5ecaab-0x0;var _0x3db1a8=_0xe706[_0x5ecaab];return _0x3db1a8;};'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 af978cb..2017802 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0xa59b6e,_0x3fd4c8){var _0x578fc3=function(_0x5d7cb6){while(--_0x5d7cb6){_0xa59b6e['push'](_0xa59b6e['shift']());}};_0x578fc3(++_0x3fd4c8);}(_0x55ca,0x126));var _0xa55c=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x55ca[_0x458363];return _0x4d0290;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x5864a4,_0x121187){var _0x391d49=function(_0x6caeae){while(--_0x6caeae){_0x5864a4['push'](_0x5864a4['shift']());}};_0x391d49(++_0x121187);}(_0x55ca,0x126));var _0xa55c=function(_0x8d8f23,_0x8c1961){_0x8d8f23=_0x8d8f23-0x0;var _0x22bf54=_0x55ca[_0x8d8f23];return _0x22bf54;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 05311a6..d1caca8 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(_0x373370,_0x433cda){var _0x7cb97b=function(_0x3e6854){while(--_0x3e6854){_0x373370['push'](_0x373370['shift']());}};_0x7cb97b(++_0x433cda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x10ef29,_0x246697){var _0x329848=function(_0x2f387b){while(--_0x2f387b){_0x10ef29['push'](_0x10ef29['shift']());}};_0x329848(++_0x246697);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 bd7bdcc..70da5e9 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 _0x1a38=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x1813d0,_0x3685b1){var _0x485e3d=function(_0x334a02){while(--_0x334a02){_0x1813d0['push'](_0x1813d0['shift']());}};_0x485e3d(++_0x3685b1);}(_0x1a38,0xb0));var _0x81a3=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x1a38[_0xb833b1];return _0x1ab87a;};'use strict';var client=require(_0x81a3('0x0'));exports[_0x81a3('0x1')]=function(_0xfb6477,_0x5eb8e9){return client['Request']('UpdateWhatsappInteraction',{'body':_0x5eb8e9,'options':{'where':{'id':_0xfb6477}},'log':_0x81a3('0x2')});};exports[_0x81a3('0x3')]=function(_0x2faf46,_0x28fd86){return client[_0x81a3('0x4')](_0x81a3('0x5'),{'body':_0x28fd86,'options':{'where':{'id':_0x2faf46}},'log':_0x81a3('0x6')});}; \ No newline at end of file +var _0xa6ce=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x454820,_0x45f473){var _0x1a57c1=function(_0x537da1){while(--_0x537da1){_0x454820['push'](_0x454820['shift']());}};_0x1a57c1(++_0x45f473);}(_0xa6ce,0x15e));var _0xea6c=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xa6ce[_0x86b219];return _0x1f320c;};'use strict';var client=require(_0xea6c('0x0'));exports['update']=function(_0x325367,_0x37bf44){return client['Request'](_0xea6c('0x1'),{'body':_0x37bf44,'options':{'where':{'id':_0x325367}},'log':_0xea6c('0x2')});};exports['addTags']=function(_0x5620a1,_0x2ac723){return client[_0xea6c('0x3')](_0xea6c('0x4'),{'body':_0x2ac723,'options':{'where':{'id':_0x5620a1}},'log':_0xea6c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 08f8c12..883843c 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 _0x192b=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x61a8a0,_0x3db16b){var _0x1f85d7=function(_0x511493){while(--_0x511493){_0x61a8a0['push'](_0x61a8a0['shift']());}};_0x1f85d7(++_0x3db16b);}(_0x192b,0x1cc));var _0xb192=function(_0x582b12,_0x4a9f8e){_0x582b12=_0x582b12-0x0;var _0x5a362a=_0x192b[_0x582b12];return _0x5a362a;};'use strict';var client=require(_0xb192('0x0'));exports[_0xb192('0x1')]=function(_0x335e4b){return client[_0xb192('0x2')](_0xb192('0x3'),{'body':_0x335e4b,'log':_0xb192('0x4')});}; \ No newline at end of file +var _0x718e=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0x718e,0x11e));var _0xe718=function(_0x4941c6,_0x3ca9f8){_0x4941c6=_0x4941c6-0x0;var _0x4d3654=_0x718e[_0x4941c6];return _0x4d3654;};'use strict';var client=require('../client');exports[_0xe718('0x0')]=function(_0x2f88b6){return client[_0xe718('0x1')](_0xe718('0x2'),{'body':_0x2f88b6,'log':_0xe718('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bf9ff18..d42e55e 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 _0x390d=['timeout','User','name','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x443f79,_0x33e446){var _0x3847e4=function(_0x42fa01){while(--_0x42fa01){_0x443f79['push'](_0x443f79['shift']());}};_0x3847e4(++_0x33e446);}(_0x390d,0x14d));var _0xd390=function(_0x28eb5a,_0x318185){_0x28eb5a=_0x28eb5a-0x0;var _0x5b71c0=_0x390d[_0x28eb5a];return _0x5b71c0;};'use strict';var client=require(_0xd390('0x0'));exports[_0xd390('0x1')]=function(){return function(){return client[_0xd390('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xd390('0x3'),'strategy'],'include':[{'model':_0xd390('0x4'),'as':'Agents','attributes':['id',_0xd390('0x5'),_0xd390('0x6'),_0xd390('0x7')]}]},'log':_0xd390('0x1')});};}; \ No newline at end of file +var _0xb00d=['Agents','online','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xb00d,0xfe));var _0xdb00=function(_0x47b7c9,_0x3848b2){_0x47b7c9=_0x47b7c9-0x0;var _0x435aaf=_0xb00d[_0x47b7c9];return _0x435aaf;};'use strict';var client=require(_0xdb00('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xdb00('0x1'),{'options':{'raw':![],'attributes':['id',_0xdb00('0x2'),_0xdb00('0x3'),_0xdb00('0x4')],'include':[{'model':_0xdb00('0x5'),'as':_0xdb00('0x6'),'attributes':['id','name',_0xdb00('0x7'),_0xdb00('0x8')]}]},'log':_0xdb00('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5669246..fe6a3c8 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 _0x299e=['create','Request','CreateWhatsappQueueReport','update','DESC','../client'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x299e,0xd7));var _0xe299=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x299e[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xe299('0x0'));exports[_0xe299('0x1')]=function(_0x313a10){return client[_0xe299('0x2')](_0xe299('0x3'),{'body':_0x313a10,'log':'CreateWhatsappQueueReport'});};exports[_0xe299('0x4')]=function(_0x1e5f17,_0x10b2f0){return client[_0xe299('0x2')]('UpdateWhatsappQueueReport',{'body':_0x10b2f0,'options':{'where':{'uniqueid':_0x1e5f17},'order':[['id',_0xe299('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xc15a=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xc15a,0x16f));var _0xac15=function(_0x4592c1,_0x42da6c){_0x4592c1=_0x4592c1-0x0;var _0x207a18=_0xc15a[_0x4592c1];return _0x207a18;};'use strict';var client=require(_0xac15('0x0'));exports[_0xac15('0x1')]=function(_0x341eea){return client[_0xac15('0x2')]('CreateWhatsappQueueReport',{'body':_0x341eea,'log':_0xac15('0x3')});};exports[_0xac15('0x4')]=function(_0x5f2e58,_0x1b2a1e){return client[_0xac15('0x2')]('UpdateWhatsappQueueReport',{'body':_0x1b2a1e,'options':{'where':{'uniqueid':_0x5f2e58},'order':[['id',_0xac15('0x5')]],'limit':0x1},'log':_0xac15('0x6')});}; \ 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 283bd15..4fd90c4 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 _0x5a26=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x5a26,0x165));var _0x65a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a26[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x65a2('0x0'));var _=require(_0x65a2('0x1'));var util=require('util');var seqqueue=require(_0x65a2('0x2'));var logger=require(_0x65a2('0x3'))(_0x65a2('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x65a2('0x5')},'timeout':{'type':_0x65a2('0x6'),'message':_0x65a2('0x7')}});function writeLog(_0x1a3056,_0x4de9a0,_0x5a6fd8){return logger['info'](util[_0x65a2('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1a3056,_0x4de9a0[_0x65a2('0x9')],_0x5a6fd8));}function handleFindAgent(_0x530f8c){return function(_0x3ef77f){return _0x3ef77f[_0x65a2('0x9')]['toLowerCase']()===_0x530f8c['toLowerCase']();};}exports['consequence']=function(_0x58a332,_0x31c0e0,_0xd9115c,_0x5903f8){return function(_0x586d67){try{var _0x8b22ab={'name':_0x31c0e0[0x0],'timeout':_0x31c0e0[0x1]};var _0x34d15e=queue[_0x65a2('0x0')](_0x8b22ab,{'typecast':!![]});if(_0x34d15e[_0x65a2('0xa')]){logger[_0x65a2('0xb')](_0x65a2('0xc'),_0x58a332,_[_0x65a2('0xd')](_0x34d15e,_0x65a2('0xe'))[_0x65a2('0xf')](',\x20'));_0x586d67[_0x65a2('0x10')]();}else{var _0x3afca5=_[_0x65a2('0x11')](_0xd9115c['agents'],handleFindAgent(_0x8b22ab[_0x65a2('0x9')]));if(_0x3afca5){var _0x38d8ab=(_0x8b22ab['timeout']||0xa)*0x3e8;var _0x21e8c6,_0x4b5344;var _0x4881a4=seqqueue[_0x65a2('0x12')](_0x38d8ab);_0x4881a4['id']=_0x58a332;_0x4881a4[_0x65a2('0x13')]=_0x38d8ab;_0x4881a4[_0x65a2('0x14')]=_0x5903f8[_0x65a2('0x14')];writeLog(_0x58a332,_0x3afca5,util[_0x65a2('0x8')]('START:%s',_0x38d8ab));_0xd9115c[_0x65a2('0x15')][_0x58a332]['on'](_0x65a2('0x16'),function(){logger[_0x65a2('0x17')](_0x65a2('0x18'),_0x58a332);clearTimeout(_0x4b5344);_0x4b5344=undefined;_0x4881a4[_0x65a2('0x19')]();if(_0xd9115c['rules'][_0x58a332]){delete _0xd9115c['rules'][_0x58a332];}_0x586d67[_0x65a2('0x10')]();});_0xd9115c[_0x65a2('0x15')][_0x58a332]['on'](_0x65a2('0x1a'),function(){if(_0xd9115c[_0x65a2('0x15')][_0x58a332]){delete _0xd9115c[_0x65a2('0x15')][_0x58a332];}});_0x4b5344=setTimeout(function(){logger[_0x65a2('0x17')]('[%s][AGENT]\x20ROUTING\x20END',_0x58a332);clearTimeout(_0x4b5344);_0x4881a4[_0x65a2('0x19')]();_0x586d67['next']();},_0x38d8ab);strategy[_0x65a2('0x1b')](_0x4881a4,_0x3afca5,_0xd9115c,_0x5903f8);}else{logger[_0x65a2('0xb')](_0x65a2('0x1c'),_0x58a332,_0x8b22ab['name']);_0x586d67[_0x65a2('0x10')]();}}}catch(_0x2d22c4){console[_0x65a2('0x1d')](_0x2d22c4);logger['error'](_0x65a2('0x1e'),_0x58a332,_0x2d22c4[_0x65a2('0x1f')]);_0x586d67['stop']();}};}; \ No newline at end of file +var _0xebcd=['end','info','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','string','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','START:%s','rules'];(function(_0x4db010,_0x2a8951){var _0x4e25ab=function(_0x5a3b4c){while(--_0x5a3b4c){_0x4db010['push'](_0x4db010['shift']());}};_0x4e25ab(++_0x2a8951);}(_0xebcd,0x1c9));var _0xdebc=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xebcd[_0x506d83];return _0x335e8b;};'use strict';var schema=require(_0xdebc('0x0'));var _=require(_0xdebc('0x1'));var util=require('util');var seqqueue=require(_0xdebc('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xdebc('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xdebc('0x4'),'message':_0xdebc('0x5')}});function writeLog(_0x3c5b29,_0x2c7104,_0x10e875){return logger['info'](util[_0xdebc('0x6')](_0xdebc('0x7'),_0x3c5b29,_0x2c7104[_0xdebc('0x8')],_0x10e875));}function handleFindAgent(_0x261f5f){return function(_0x320a24){return _0x320a24[_0xdebc('0x8')][_0xdebc('0x9')]()===_0x261f5f['toLowerCase']();};}exports['consequence']=function(_0x5928ef,_0x150d77,_0x4e87c7,_0x321ed0){return function(_0x151a4c){try{var _0x1fe963={'name':_0x150d77[0x0],'timeout':_0x150d77[0x1]};var _0x31680a=queue[_0xdebc('0x0')](_0x1fe963,{'typecast':!![]});if(_0x31680a[_0xdebc('0xa')]){logger[_0xdebc('0xb')](_0xdebc('0xc'),_0x5928ef,_[_0xdebc('0xd')](_0x31680a,_0xdebc('0xe'))[_0xdebc('0xf')](',\x20'));_0x151a4c[_0xdebc('0x10')]();}else{var _0x2eee15=_['find'](_0x4e87c7[_0xdebc('0x11')],handleFindAgent(_0x1fe963[_0xdebc('0x8')]));if(_0x2eee15){var _0xfa1ed6=(_0x1fe963[_0xdebc('0x12')]||0xa)*0x3e8;var _0x29d7ab,_0x3819b1;var _0xeadc9=seqqueue[_0xdebc('0x13')](_0xfa1ed6);_0xeadc9['id']=_0x5928ef;_0xeadc9['atimeout']=_0xfa1ed6;_0xeadc9[_0xdebc('0x14')]=_0x321ed0[_0xdebc('0x14')];writeLog(_0x5928ef,_0x2eee15,util[_0xdebc('0x6')](_0xdebc('0x15'),_0xfa1ed6));_0x4e87c7[_0xdebc('0x16')][_0x5928ef]['on'](_0xdebc('0x17'),function(){logger[_0xdebc('0x18')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5928ef);clearTimeout(_0x3819b1);_0x3819b1=undefined;_0xeadc9[_0xdebc('0x19')]();if(_0x4e87c7[_0xdebc('0x16')][_0x5928ef]){delete _0x4e87c7[_0xdebc('0x16')][_0x5928ef];}_0x151a4c[_0xdebc('0x10')]();});_0x4e87c7[_0xdebc('0x16')][_0x5928ef]['on']('complete',function(){if(_0x4e87c7[_0xdebc('0x16')][_0x5928ef]){delete _0x4e87c7[_0xdebc('0x16')][_0x5928ef];}});_0x3819b1=setTimeout(function(){logger['info'](_0xdebc('0x1a'),_0x5928ef);clearTimeout(_0x3819b1);_0xeadc9[_0xdebc('0x19')]();_0x151a4c['next']();},_0xfa1ed6);strategy[_0xdebc('0x1b')](_0xeadc9,_0x2eee15,_0x4e87c7,_0x321ed0);}else{logger['error'](_0xdebc('0x1c'),_0x5928ef,_0x1fe963[_0xdebc('0x8')]);_0x151a4c['stop']();}}}catch(_0x672c44){console[_0xdebc('0x1d')](_0x672c44);logger[_0xdebc('0xb')](_0xdebc('0x1e'),_0x5928ef,_0x672c44[_0xdebc('0x1f')]);_0x151a4c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 36a98d7..8ecd90c 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 _0xa2b6=['isEmpty','body','create','then','catch','stringify','finally','stop','LexRuntime','$LATEST','message','toString','error','amazonlex','providerName','Message','dialogState','Failed','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','created'];(function(_0x2d83e3,_0x1413da){var _0x29eb0f=function(_0x29fa1b){while(--_0x29fa1b){_0x2d83e3['push'](_0x2d83e3['shift']());}};_0x29eb0f(++_0x1413da);}(_0xa2b6,0xc2));var _0x6a2b=function(_0x49faf,_0x327df2){_0x49faf=_0x49faf-0x0;var _0x3ce6cd=_0xa2b6[_0x49faf];return _0x3ce6cd;};'use strict';var _=require(_0x6a2b('0x0'));var moment=require(_0x6a2b('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x6a2b('0x2'))(_0x6a2b('0x3'));var rpc={'chatMessage':require(_0x6a2b('0x4')),'openchannelMessage':require(_0x6a2b('0x5')),'mailMessage':require(_0x6a2b('0x6')),'smsMessage':require(_0x6a2b('0x7')),'faxMessage':require(_0x6a2b('0x8')),'whatsappMessage':require(_0x6a2b('0x9'))};exports['consequence']=function(_0x425319,_0x3ea002){return function(_0x385769){try{if(!_['isNil'](this[_0x6a2b('0xa')]['UserId'])){logger[_0x6a2b('0xb')](_0x6a2b('0xc'),_0x425319,_0x6a2b('0xd'));return _0x385769[_0x6a2b('0xe')]();}var _0xc3a64d={'ContactId':this[_0x6a2b('0xf')]['id'],'sentAt':moment()['format'](_0x6a2b('0x10')),'direction':_0x6a2b('0x11')};if(this[_0x6a2b('0x12')]===_0x6a2b('0x13')||this[_0x6a2b('0x12')]==='whatsapp'){_0xc3a64d[_0x6a2b('0x14')]=this['interaction'][_0x6a2b('0x14')];}var _0x3134f7=this['channel'];if(_0x3134f7==='chat'){_0xc3a64d[_0x6a2b('0x15')]=this[_0x6a2b('0x16')]['id'];}else{_0xc3a64d[_[_0x6a2b('0x17')](_0x3134f7)+_0x6a2b('0x18')]=this[_0x6a2b('0x16')]['id'];}_0xc3a64d[_[_0x6a2b('0x17')](_0x3134f7)+'InteractionId']=this['interaction']['id'];if(this[_0x6a2b('0xa')][_0x6a2b('0x19')]){var _0x221699=_0x3ea002[0x4];if(!_[_0x6a2b('0x1a')](_0x221699)){_0xc3a64d[_0x6a2b('0x1b')]=utils['getMustacheRender'](_0x221699,this);return rpc[_0x3134f7+'Message'][_0x6a2b('0x1c')](_0xc3a64d)[_0x6a2b('0x1d')](function(_0x1e0818){logger[_0x6a2b('0xb')](_0x6a2b('0xc'),_0x425319,_0xc3a64d[_0x6a2b('0x1b')]);})[_0x6a2b('0x1e')](function(_0x314123){logger['error'](_0x6a2b('0xc'),_0x425319,JSON[_0x6a2b('0x1f')](_0x314123));})[_0x6a2b('0x20')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x425319);_0x385769[_0x6a2b('0x21')]();});}else{logger[_0x6a2b('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x425319);_0x385769[_0x6a2b('0x21')]();}}else{var _0x26adfd=this;var _0x1920a8=new AWS[(_0x6a2b('0x22'))]({'accessKeyId':_0x3ea002[0x0],'secretAccessKey':_0x3ea002[0x1],'region':_0x3ea002[0x2]});var _0x312ddd={'botAlias':_0x6a2b('0x23'),'botName':_0x3ea002[0x3],'inputText':this[_0x6a2b('0x24')][_0x6a2b('0x1b')],'userId':this[_0x6a2b('0x12')]+':'+this[_0x6a2b('0xa')]['id'][_0x6a2b('0x25')]()};_0x1920a8['postText'](_0x312ddd,function(_0x20f7d5,_0x5ee767){if(_0x20f7d5){logger[_0x6a2b('0x26')]('[%s][AMAZONLEX]\x20%s',_0x425319,_0x20f7d5[_0x6a2b('0x24')]);_0x385769[_0x6a2b('0xe')]();}else if(_0x5ee767&&_0x5ee767[_0x6a2b('0x24')]){_0x26adfd[_0x6a2b('0x1b')][_0x6a2b('0x27')]=_0x5ee767;_0xc3a64d[_0x6a2b('0x1b')]=_0x5ee767[_0x6a2b('0x24')];_0xc3a64d[_0x6a2b('0x28')]=_0x6a2b('0x27');_0xc3a64d['providerResponse']=JSON[_0x6a2b('0x1f')](_0x5ee767);return rpc[_0x3134f7+_0x6a2b('0x29')][_0x6a2b('0x1c')](_0xc3a64d)[_0x6a2b('0x1d')](function(_0x17e169){logger['info'](_0x6a2b('0xc'),_0x425319,_0xc3a64d[_0x6a2b('0x1b')]);if(_0x5ee767[_0x6a2b('0x2a')]==_0x6a2b('0x2b')){_0x385769[_0x6a2b('0xe')]();}else{_0x385769[_0x6a2b('0x21')]();}})[_0x6a2b('0x1e')](function(_0x5a0900){logger['error'](_0x6a2b('0xc'),_0x425319,JSON[_0x6a2b('0x1f')](_0x5a0900));_0x385769['next']();});}else{_0x385769[_0x6a2b('0xe')]();}});}}catch(_0x404ea0){logger['error'](_0x6a2b('0xc'),_0x425319,JSON[_0x6a2b('0x1f')](_0x404ea0));_0x385769[_0x6a2b('0x21')]();}};}; \ No newline at end of file +var _0x2834=['Message','then','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender'];(function(_0x3c6616,_0x13bc5c){var _0x3faf7a=function(_0x5610b4){while(--_0x5610b4){_0x3c6616['push'](_0x3c6616['shift']());}};_0x3faf7a(++_0x13bc5c);}(_0x2834,0x10a));var _0x4283=function(_0x51a153,_0x154509){_0x51a153=_0x51a153-0x0;var _0x1aabd5=_0x2834[_0x51a153];return _0x1aabd5;};'use strict';var _=require(_0x4283('0x0'));var moment=require(_0x4283('0x1'));var AWS=require(_0x4283('0x2'));var utils=require(_0x4283('0x3'));var logger=require(_0x4283('0x4'))(_0x4283('0x5'));var rpc={'chatMessage':require(_0x4283('0x6')),'openchannelMessage':require(_0x4283('0x7')),'mailMessage':require(_0x4283('0x8')),'smsMessage':require(_0x4283('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4283('0xa'))};exports[_0x4283('0xb')]=function(_0x24c6c2,_0x23750a){return function(_0xaf58e2){try{if(!_['isNil'](this['interaction'][_0x4283('0xc')])){logger[_0x4283('0xd')](_0x4283('0xe'),_0x24c6c2,_0x4283('0xf'));return _0xaf58e2[_0x4283('0x10')]();}var _0xa10808={'ContactId':this[_0x4283('0x11')]['id'],'sentAt':moment()[_0x4283('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4283('0x13')};if(this['channel']===_0x4283('0x14')||this[_0x4283('0x15')]===_0x4283('0x16')){_0xa10808[_0x4283('0x17')]=this[_0x4283('0x18')]['phone'];}var _0x14f22a=this[_0x4283('0x15')];if(_0x14f22a===_0x4283('0x19')){_0xa10808[_0x4283('0x1a')]=this['account']['id'];}else{_0xa10808[_[_0x4283('0x1b')](_0x14f22a)+_0x4283('0x1c')]=this[_0x4283('0x1d')]['id'];}_0xa10808[_[_0x4283('0x1b')](_0x14f22a)+_0x4283('0x1e')]=this[_0x4283('0x18')]['id'];if(this[_0x4283('0x18')][_0x4283('0x1f')]){var _0x1ea1ef=_0x23750a[0x4];if(!_[_0x4283('0x20')](_0x1ea1ef)){_0xa10808['body']=utils[_0x4283('0x21')](_0x1ea1ef,this);return rpc[_0x14f22a+_0x4283('0x22')]['create'](_0xa10808)[_0x4283('0x23')](function(_0x1c996d){logger[_0x4283('0xd')]('[%s][AMAZONLEX]\x20%s',_0x24c6c2,_0xa10808[_0x4283('0x24')]);})[_0x4283('0x25')](function(_0xbfa2aa){logger[_0x4283('0x26')]('[%s][AMAZONLEX]\x20%s',_0x24c6c2,JSON[_0x4283('0x27')](_0xbfa2aa));})[_0x4283('0x28')](function(){logger[_0x4283('0xd')](_0x4283('0x29'),_0x24c6c2);_0xaf58e2[_0x4283('0x2a')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x24c6c2);_0xaf58e2[_0x4283('0x2a')]();}}else{var _0x25f603=this;var _0x2edc56=new AWS[(_0x4283('0x2b'))]({'accessKeyId':_0x23750a[0x0],'secretAccessKey':_0x23750a[0x1],'region':_0x23750a[0x2]});var _0x4f8d1c={'botAlias':_0x4283('0x2c'),'botName':_0x23750a[0x3],'inputText':this[_0x4283('0x2d')][_0x4283('0x24')],'userId':this['channel']+':'+this['interaction']['id'][_0x4283('0x2e')]()};_0x2edc56[_0x4283('0x2f')](_0x4f8d1c,function(_0x21c483,_0x14d394){if(_0x21c483){logger['error'](_0x4283('0xe'),_0x24c6c2,_0x21c483[_0x4283('0x2d')]);_0xaf58e2[_0x4283('0x10')]();}else if(_0x14d394&&_0x14d394[_0x4283('0x2d')]){_0x25f603[_0x4283('0x24')]['amazonlex']=_0x14d394;_0xa10808[_0x4283('0x24')]=_0x14d394[_0x4283('0x2d')];_0xa10808['providerName']=_0x4283('0x30');_0xa10808[_0x4283('0x31')]=JSON[_0x4283('0x27')](_0x14d394);return rpc[_0x14f22a+_0x4283('0x22')]['create'](_0xa10808)[_0x4283('0x23')](function(_0x46a435){logger[_0x4283('0xd')](_0x4283('0xe'),_0x24c6c2,_0xa10808[_0x4283('0x24')]);if(_0x14d394['dialogState']=='Failed'){_0xaf58e2['next']();}else{_0xaf58e2[_0x4283('0x2a')]();}})[_0x4283('0x25')](function(_0x9194c7){logger['error'](_0x4283('0xe'),_0x24c6c2,JSON['stringify'](_0x9194c7));_0xaf58e2[_0x4283('0x10')]();});}else{_0xaf58e2[_0x4283('0x10')]();}});}}catch(_0x27d149){logger[_0x4283('0x26')](_0x4283('0xe'),_0x24c6c2,JSON[_0x4283('0x27')](_0x27d149));_0xaf58e2[_0x4283('0x2a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 721f301..8852439 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 _0xf94f=['update','catch','resolve','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','messageId','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Interaction'];(function(_0x258802,_0x253d57){var _0x2d3222=function(_0x22a5b5){while(--_0x22a5b5){_0x258802['push'](_0x258802['shift']());}};_0x2d3222(++_0x253d57);}(_0xf94f,0xda));var _0xff94=function(_0x184190,_0x58a277){_0x184190=_0x184190-0x0;var _0x643117=_0xf94f[_0x184190];return _0x643117;};'use strict';var _=require(_0xff94('0x0'));var moment=require('moment');var utils=require(_0xff94('0x1'));var logger=require(_0xff94('0x2'))(_0xff94('0x3'));var rpc={'chatMessage':require(_0xff94('0x4')),'openchannelMessage':require(_0xff94('0x5')),'mailMessage':require(_0xff94('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xff94('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xff94('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xff94('0x9')),'smsInteraction':require(_0xff94('0xa')),'faxInteraction':require(_0xff94('0xb')),'whatsappInteraction':require(_0xff94('0xc'))};var mailRpc=require(_0xff94('0xd'));exports[_0xff94('0xe')]=function(_0x2a8639,_0x4d94cb,_0x4ae20a,_0x5ebb2f){return function(_0x3db16d){try{var _0x24ac8d=this[_0xff94('0xf')];if(_0x24ac8d===_0xff94('0x10')&&_0x5ebb2f[_0xff94('0x11')][_0xff94('0x12')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2a8639,_0xff94('0x13'));return _0x3db16d[_0xff94('0x14')]();}if(_0x4d94cb[0x0]==='1'&&(_[_0xff94('0x15')](this[_0xff94('0x16')][_0xff94('0x17')])||!this[_0xff94('0x16')][_0xff94('0x17')])){logger[_0xff94('0x18')](_0xff94('0x19'),_0x2a8639,'Autoreply\x20already\x20sent');return _0x3db16d[_0xff94('0x14')]();}if(_0x4d94cb[0x0]==='2'&&this[_0xff94('0x16')]['autoreplyExecuted']){logger['info'](_0xff94('0x1a'),_0x2a8639,_0xff94('0x1b'));return _0x3db16d[_0xff94('0x14')]();}var _0x37f712={'ContactId':this['contact']['id'],'sentAt':moment()[_0xff94('0x1c')](_0xff94('0x1d')),'direction':_0xff94('0x1e')};if(this[_0xff94('0xf')]===_0xff94('0x10')){_0x37f712['body']=utils[_0xff94('0x1f')](_0x4d94cb[0x2],this);}else{_0x37f712['body']=utils[_0xff94('0x1f')](_0x4d94cb[0x1],this);}if(this['message']){_0x37f712['to']=this[_0xff94('0x20')][_0xff94('0x21')]||'';if(this[_0xff94('0xf')]===_0xff94('0x10')&&_0x4d94cb[0x1]==='1'){_0x37f712['cc']=this[_0xff94('0x20')]['cc']||'';}_0x37f712[_0xff94('0x21')]=this[_0xff94('0x20')]['to']||'';_0x37f712[_0xff94('0x22')]=this[_0xff94('0x20')]['phone']||'';_0x37f712[_0xff94('0x23')]=!![];if(this['message'][_0xff94('0x24')]){_0x37f712['subject']='';_0x37f712['subject']+=_[_0xff94('0x25')](this[_0xff94('0x20')][_0xff94('0x24')],_0xff94('0x26'))?'':_0xff94('0x27');_0x37f712[_0xff94('0x24')]+=this[_0xff94('0x20')][_0xff94('0x24')];}}if(this['channel']===_0xff94('0x28')){_0x37f712['ChatWebsiteId']=this[_0xff94('0x29')]['id'];}else{_0x37f712[_[_0xff94('0x2a')](this[_0xff94('0xf')])+_0xff94('0x2b')]=this['account']['id'];}_0x37f712[_[_0xff94('0x2a')](this['channel'])+_0xff94('0x2c')]=this[_0xff94('0x16')]['id'];var _0xeb27ef=this['interaction'];if(rpc[this[_0xff94('0xf')]+_0xff94('0x2d')]){if(this['channel']===_0xff94('0x10')){_0x37f712['inReplyTo']=this[_0xff94('0x20')][_0xff94('0x2e')];_0x37f712['html']=_0xff94('0x2f')+_[_0xff94('0x30')](_0x37f712[_0xff94('0x11')],_0xff94('0x31'),_0xff94('0x32'))+_0xff94('0x33');_0x37f712[_0xff94('0x34')]={'Auto-Submitted':_0xff94('0x35'),'X-Auto-Response-Suppress':_0xff94('0x36'),'Precedence':_0xff94('0x37')};return mailRpc[_0xff94('0x38')](this[_0xff94('0x29')][_0xff94('0x39')],_0x37f712)[_0xff94('0x3a')](function(_0x6a4c1e){logger['info'](_0xff94('0x3b'),_0x2a8639);_0x37f712[_0xff94('0x2e')]=_0x6a4c1e['message'][_0xff94('0x2e')];return rpc[_0x24ac8d+_0xff94('0x2d')][_0xff94('0x3c')](_0x37f712);})[_0xff94('0x3a')](function(_0x206e77){logger['info'](_0xff94('0x19'),_0x2a8639,JSON['stringify'](_0x206e77));})['catch'](function(_0x10768e){logger[_0xff94('0x3d')](_0xff94('0x3e'),_0x2a8639,JSON[_0xff94('0x3f')](_0x10768e));})[_0xff94('0x40')](function(){Promise['resolve']()['then'](function(){if(_0x4d94cb[0x0]!=='2'||_0xeb27ef['autoreplyExecuted'])return;return rpc[_0x24ac8d+_0xff94('0x41')][_0xff94('0x42')](_0xeb27ef['id'],{'autoreplyExecuted':!![]})[_0xff94('0x3a')](function(_0x10359c){logger[_0xff94('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a8639,JSON['stringify'](_0x10359c));})[_0xff94('0x43')](function(_0x1be228){logger[_0xff94('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a8639,JSON[_0xff94('0x3f')](_0x1be228));});})['then'](function(){_0x3db16d['next']();});});}else{return rpc[this[_0xff94('0xf')]+'Message'][_0xff94('0x3c')](_0x37f712)['then'](function(){logger[_0xff94('0x18')]('[%s][AUTOREPLY]\x20%s',_0x2a8639,_0x37f712[_0xff94('0x11')]);})[_0xff94('0x43')](function(_0x48895d){logger[_0xff94('0x3d')](_0xff94('0x19'),_0x2a8639,JSON[_0xff94('0x3f')](_0x48895d));})['finally'](function(){Promise[_0xff94('0x44')]()[_0xff94('0x3a')](function(){if(_0x4d94cb[0x0]!=='2'||_0xeb27ef[_0xff94('0x45')])return;return rpc[_0x24ac8d+'Interaction'][_0xff94('0x42')](_0xeb27ef['id'],{'autoreplyExecuted':!![]})[_0xff94('0x3a')](function(_0x2f9cf1){logger[_0xff94('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2a8639,JSON['stringify'](_0x2f9cf1));})[_0xff94('0x43')](function(_0xf8d444){logger[_0xff94('0x3d')](_0xff94('0x46'),_0x2a8639,JSON[_0xff94('0x3f')](_0xf8d444));});})[_0xff94('0x3a')](function(){_0x3db16d[_0xff94('0x14')]();});});}}}catch(_0x1f9bc8){logger[_0xff94('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x2a8639,JSON[_0xff94('0x3f')](_0x1f9bc8));_0x3db16d['stop']();}};}; \ No newline at end of file +var _0xdc2a=[''];(function(_0x22431e,_0x5af0a3){var _0xd978e9=function(_0x2bbdd7){while(--_0x2bbdd7){_0x22431e['push'](_0x22431e['shift']());}};_0xd978e9(++_0x5af0a3);}(_0xdc2a,0x166));var _0xadc2=function(_0x4fb667,_0x54bca8){_0x4fb667=_0x4fb667-0x0;var _0x18a9f2=_0xdc2a[_0x4fb667];return _0x18a9f2;};'use strict';var _=require(_0xadc2('0x0'));var moment=require(_0xadc2('0x1'));var utils=require('./utils');var logger=require(_0xadc2('0x2'))(_0xadc2('0x3'));var rpc={'chatMessage':require(_0xadc2('0x4')),'openchannelMessage':require(_0xadc2('0x5')),'mailMessage':require(_0xadc2('0x6')),'smsMessage':require(_0xadc2('0x7')),'faxMessage':require(_0xadc2('0x8')),'whatsappMessage':require(_0xadc2('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xadc2('0xa')),'mailInteraction':require(_0xadc2('0xb')),'smsInteraction':require(_0xadc2('0xc')),'faxInteraction':require(_0xadc2('0xd')),'whatsappInteraction':require(_0xadc2('0xe'))};var mailRpc=require('../../mailRpc');exports[_0xadc2('0xf')]=function(_0x3d34e0,_0x529914,_0x243025,_0x586bb4){return function(_0x333598){try{var _0x52c01a=this[_0xadc2('0x10')];if(_0x52c01a===_0xadc2('0x11')&&_0x586bb4[_0xadc2('0x12')][_0xadc2('0x13')]){logger['info'](_0xadc2('0x14'),_0x3d34e0,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x333598[_0xadc2('0x15')]();}if(_0x529914[0x0]==='1'&&(_[_0xadc2('0x16')](this[_0xadc2('0x17')][_0xadc2('0x18')])||!this[_0xadc2('0x17')][_0xadc2('0x18')])){logger['info'](_0xadc2('0x14'),_0x3d34e0,'Autoreply\x20already\x20sent');return _0x333598[_0xadc2('0x15')]();}if(_0x529914[0x0]==='2'&&this['interaction'][_0xadc2('0x19')]){logger[_0xadc2('0x1a')](_0xadc2('0x1b'),_0x3d34e0,_0xadc2('0x1c'));return _0x333598[_0xadc2('0x15')]();}var _0xf1c3f={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xadc2('0x1d')),'direction':_0xadc2('0x1e')};if(this[_0xadc2('0x10')]===_0xadc2('0x11')){_0xf1c3f[_0xadc2('0x12')]=utils['getMustacheRender'](_0x529914[0x2],this);}else{_0xf1c3f[_0xadc2('0x12')]=utils[_0xadc2('0x1f')](_0x529914[0x1],this);}if(this[_0xadc2('0x20')]){_0xf1c3f['to']=this[_0xadc2('0x20')]['from']||'';if(this[_0xadc2('0x10')]===_0xadc2('0x11')&&_0x529914[0x1]==='1'){_0xf1c3f['cc']=this['message']['cc']||'';}_0xf1c3f[_0xadc2('0x21')]=this[_0xadc2('0x20')]['to']||'';_0xf1c3f[_0xadc2('0x22')]=this[_0xadc2('0x20')][_0xadc2('0x22')]||'';_0xf1c3f[_0xadc2('0x23')]=!![];if(this[_0xadc2('0x20')][_0xadc2('0x24')]){_0xf1c3f['subject']='';_0xf1c3f[_0xadc2('0x24')]+=_[_0xadc2('0x25')](this['message'][_0xadc2('0x24')],_0xadc2('0x26'))?'':_0xadc2('0x27');_0xf1c3f[_0xadc2('0x24')]+=this['message']['subject'];}}if(this['channel']===_0xadc2('0x28')){_0xf1c3f[_0xadc2('0x29')]=this[_0xadc2('0x2a')]['id'];}else{_0xf1c3f[_[_0xadc2('0x2b')](this[_0xadc2('0x10')])+_0xadc2('0x2c')]=this[_0xadc2('0x2a')]['id'];}_0xf1c3f[_[_0xadc2('0x2b')](this[_0xadc2('0x10')])+_0xadc2('0x2d')]=this['interaction']['id'];var _0x5d7dfa=this[_0xadc2('0x17')];if(rpc[this[_0xadc2('0x10')]+_0xadc2('0x2e')]){if(this[_0xadc2('0x10')]===_0xadc2('0x11')){_0xf1c3f[_0xadc2('0x2f')]=this[_0xadc2('0x20')][_0xadc2('0x30')];_0xf1c3f['html']=_0xadc2('0x31')+_['replace'](_0xf1c3f[_0xadc2('0x12')],_0xadc2('0x32'),_0xadc2('0x33'))+'';_0xf1c3f[_0xadc2('0x34')]={'Auto-Submitted':_0xadc2('0x35'),'X-Auto-Response-Suppress':_0xadc2('0x36'),'Precedence':_0xadc2('0x37')};return mailRpc[_0xadc2('0x38')](this[_0xadc2('0x2a')]['smtpOptions'],_0xf1c3f)[_0xadc2('0x39')](function(_0x449af0){logger[_0xadc2('0x1a')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3d34e0);_0xf1c3f[_0xadc2('0x30')]=_0x449af0['message'][_0xadc2('0x30')];return rpc[_0x52c01a+'Message'][_0xadc2('0x3a')](_0xf1c3f);})[_0xadc2('0x39')](function(_0x59bb10){logger[_0xadc2('0x1a')](_0xadc2('0x14'),_0x3d34e0,JSON['stringify'](_0x59bb10));})[_0xadc2('0x3b')](function(_0x70aad0){logger[_0xadc2('0x3c')](_0xadc2('0x3d'),_0x3d34e0,JSON[_0xadc2('0x3e')](_0x70aad0));})[_0xadc2('0x3f')](function(){Promise['resolve']()[_0xadc2('0x39')](function(){if(_0x529914[0x0]!=='2'||_0x5d7dfa[_0xadc2('0x19')])return;return rpc[_0x52c01a+'Interaction'][_0xadc2('0x40')](_0x5d7dfa['id'],{'autoreplyExecuted':!![]})[_0xadc2('0x39')](function(_0x1d7eaf){logger['info'](_0xadc2('0x1b'),_0x3d34e0,JSON['stringify'](_0x1d7eaf));})[_0xadc2('0x3b')](function(_0xc5177){logger[_0xadc2('0x3c')](_0xadc2('0x41'),_0x3d34e0,JSON[_0xadc2('0x3e')](_0xc5177));});})[_0xadc2('0x39')](function(){_0x333598[_0xadc2('0x15')]();});});}else{return rpc[this['channel']+_0xadc2('0x2e')]['create'](_0xf1c3f)[_0xadc2('0x39')](function(){logger[_0xadc2('0x1a')](_0xadc2('0x14'),_0x3d34e0,_0xf1c3f[_0xadc2('0x12')]);})[_0xadc2('0x3b')](function(_0x4ca404){logger[_0xadc2('0x3c')](_0xadc2('0x14'),_0x3d34e0,JSON['stringify'](_0x4ca404));})[_0xadc2('0x3f')](function(){Promise[_0xadc2('0x42')]()['then'](function(){if(_0x529914[0x0]!=='2'||_0x5d7dfa[_0xadc2('0x19')])return;return rpc[_0x52c01a+_0xadc2('0x43')][_0xadc2('0x40')](_0x5d7dfa['id'],{'autoreplyExecuted':!![]})[_0xadc2('0x39')](function(_0x5840d1){logger['info'](_0xadc2('0x1b'),_0x3d34e0,JSON[_0xadc2('0x3e')](_0x5840d1));})['catch'](function(_0x39da12){logger[_0xadc2('0x3c')](_0xadc2('0x41'),_0x3d34e0,JSON[_0xadc2('0x3e')](_0x39da12));});})[_0xadc2('0x39')](function(){_0x333598[_0xadc2('0x15')]();});});}}}catch(_0x730173){logger[_0xadc2('0x3c')](_0xadc2('0x14'),_0x3d34e0,JSON[_0xadc2('0x3e')](_0x730173));_0x333598['stop']();}};}; \ 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 d9e716b..ce59ac3 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 _0x3ce0=['../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x2f9af1,_0x5e3b6a){var _0x3aad5a=function(_0x284c46){while(--_0x284c46){_0x2f9af1['push'](_0x2f9af1['shift']());}};_0x3aad5a(++_0x5e3b6a);}(_0x3ce0,0xcf));var _0x03ce=function(_0x7caf39,_0x34fe33){_0x7caf39=_0x7caf39-0x0;var _0x23585c=_0x3ce0[_0x7caf39];return _0x23585c;};'use strict';var moment=require('moment');var logger=require(_0x03ce('0x0'))(_0x03ce('0x1'));var rpc={'chatInteraction':require(_0x03ce('0x2')),'openchannelInteraction':require(_0x03ce('0x3')),'smsInteraction':require(_0x03ce('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x03ce('0x5'))};exports[_0x03ce('0x6')]=function(_0x30db23,_0xcd3711,_0x1c34a9,_0x24e5e1){return function(_0xf6f09b){try{logger[_0x03ce('0x7')](_0x03ce('0x8'),_0x30db23,_0xcd3711[0x0]);var _0x1eb6f2={'closed':0x1,'closedAt':moment()[_0x03ce('0x9')](_0x03ce('0xa')),'closeReason':'system','disposition':_0xcd3711[0x0]};if(rpc[_0x24e5e1['channel']+_0x03ce('0xb')]){rpc[_0x24e5e1[_0x03ce('0xc')]+'Interaction'][_0x03ce('0xd')](_0x24e5e1['interaction']['id'],_0x1eb6f2)[_0x03ce('0xe')](function(_0x4d7e76){logger[_0x03ce('0x7')](_0x03ce('0xf'),_0x30db23,_0x24e5e1[_0x03ce('0x10')]['id']);})[_0x03ce('0x11')](function(_0x111f20){logger[_0x03ce('0x12')](_0x03ce('0x13'),_0x30db23,JSON[_0x03ce('0x14')](_0x111f20));})[_0x03ce('0x15')](function(){_0xf6f09b[_0x03ce('0x16')]();});}}catch(_0x32b132){logger[_0x03ce('0x12')](_0x03ce('0x13'),_0x30db23,JSON[_0x03ce('0x14')](_0x32b132));_0xf6f09b[_0x03ce('0x16')]();}};}; \ No newline at end of file +var _0x4a40=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','interaction','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info'];(function(_0x41e793,_0x166684){var _0x2885fa=function(_0x383785){while(--_0x383785){_0x41e793['push'](_0x41e793['shift']());}};_0x2885fa(++_0x166684);}(_0x4a40,0xdf));var _0x04a4=function(_0x1e76e8,_0x41ec55){_0x1e76e8=_0x1e76e8-0x0;var _0x2d7a1f=_0x4a40[_0x1e76e8];return _0x2d7a1f;};'use strict';var moment=require(_0x04a4('0x0'));var logger=require(_0x04a4('0x1'))(_0x04a4('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x04a4('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x04a4('0x4')),'whatsappInteraction':require(_0x04a4('0x5'))};exports[_0x04a4('0x6')]=function(_0x6a3e7c,_0x29d92b,_0x1ba752,_0x36c96c){return function(_0x268b88){try{logger[_0x04a4('0x7')](_0x04a4('0x8'),_0x6a3e7c,_0x29d92b[0x0]);var _0x3d5fd8={'closed':0x1,'closedAt':moment()[_0x04a4('0x9')](_0x04a4('0xa')),'closeReason':_0x04a4('0xb'),'disposition':_0x29d92b[0x0]};if(rpc[_0x36c96c[_0x04a4('0xc')]+'Interaction']){rpc[_0x36c96c[_0x04a4('0xc')]+_0x04a4('0xd')][_0x04a4('0xe')](_0x36c96c['interaction']['id'],_0x3d5fd8)[_0x04a4('0xf')](function(_0x5efaf9){logger[_0x04a4('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x6a3e7c,_0x36c96c[_0x04a4('0x10')]['id']);})['catch'](function(_0x2a9302){logger[_0x04a4('0x11')](_0x04a4('0x12'),_0x6a3e7c,JSON[_0x04a4('0x13')](_0x2a9302));})['finally'](function(){_0x268b88[_0x04a4('0x14')]();});}}catch(_0x30515f){logger['error'](_0x04a4('0x12'),_0x6a3e7c,JSON[_0x04a4('0x13')](_0x30515f));_0x268b88[_0x04a4('0x14')]();}};}; \ 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 64f1823..60755e2 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 _0x74af=['Message','create','then','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','fulfillment','speech','providerName','providerResponse','stringify','result','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','account','AccountId','InteractionId','created','isEmpty'];(function(_0x37b86d,_0x3a3702){var _0x559494=function(_0x4a1038){while(--_0x4a1038){_0x37b86d['push'](_0x37b86d['shift']());}};_0x559494(++_0x3a3702);}(_0x74af,0x178));var _0xf74a=function(_0x40469b,_0x37da85){_0x40469b=_0x40469b-0x0;var _0x47fa10=_0x74af[_0x40469b];return _0x47fa10;};'use strict';var _=require(_0xf74a('0x0'));var moment=require(_0xf74a('0x1'));var apiai=require(_0xf74a('0x2'));var md5=require(_0xf74a('0x3'));var utils=require(_0xf74a('0x4'));var logger=require(_0xf74a('0x5'))('routing');var rpc={'chatMessage':require(_0xf74a('0x6')),'openchannelMessage':require(_0xf74a('0x7')),'mailMessage':require(_0xf74a('0x8')),'smsMessage':require(_0xf74a('0x9')),'faxMessage':require(_0xf74a('0xa')),'whatsappMessage':require(_0xf74a('0xb'))};exports[_0xf74a('0xc')]=function(_0x543438,_0x32601f){return function(_0x444108){try{if(!_[_0xf74a('0xd')](this[_0xf74a('0xe')][_0xf74a('0xf')])){logger[_0xf74a('0x10')](_0xf74a('0x11'),_0x543438,_0xf74a('0x12'));return _0x444108[_0xf74a('0x13')]();}var _0x15c591={'ContactId':this[_0xf74a('0x14')]['id'],'sentAt':moment()[_0xf74a('0x15')](_0xf74a('0x16')),'direction':_0xf74a('0x17')};if(this[_0xf74a('0x18')]==='sms'||this[_0xf74a('0x18')]==='whatsapp'){_0x15c591[_0xf74a('0x19')]=this[_0xf74a('0xe')][_0xf74a('0x19')];}var _0x1e58b4=this[_0xf74a('0x18')];if(_0x1e58b4===_0xf74a('0x1a')){_0x15c591['ChatWebsiteId']=this[_0xf74a('0x1b')]['id'];}else{_0x15c591[_['upperFirst'](_0x1e58b4)+_0xf74a('0x1c')]=this[_0xf74a('0x1b')]['id'];}_0x15c591[_['upperFirst'](_0x1e58b4)+_0xf74a('0x1d')]=this[_0xf74a('0xe')]['id'];if(this[_0xf74a('0xe')][_0xf74a('0x1e')]){var _0x5820b2=_0x32601f[0x2];if(!_[_0xf74a('0x1f')](_0x5820b2)){_0x15c591['body']=utils['getMustacheRender'](_0x5820b2,this);return rpc[_0x1e58b4+_0xf74a('0x20')][_0xf74a('0x21')](_0x15c591)[_0xf74a('0x22')](function(_0x5e3a30){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x543438,_0x15c591[_0xf74a('0x23')]);})[_0xf74a('0x24')](function(_0x226afb){logger[_0xf74a('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x543438,JSON['stringify'](_0x226afb));})[_0xf74a('0x26')](function(){logger['info'](_0xf74a('0x27'),_0x543438);_0x444108[_0xf74a('0x28')]();});}else{logger[_0xf74a('0x10')](_0xf74a('0x29'),_0x543438);_0x444108[_0xf74a('0x28')]();}}else{var _0x402b2a=this;var _0x32c37c=apiai(_0x32601f[0x0],{'language':_0x32601f[0x1]||'en'});return _0x32c37c['textRequest'](this[_0xf74a('0x2a')]['body'],{'sessionId':md5(this[_0xf74a('0xe')]['id'])})[_0xf74a('0x22')](function(_0x2a57d3){_0x402b2a[_0xf74a('0x23')][_0xf74a('0x2b')]=_0x2a57d3;_0x15c591[_0xf74a('0x23')]=_0x2a57d3['result'][_0xf74a('0x2c')][_0xf74a('0x2d')];_0x15c591[_0xf74a('0x2e')]=_0xf74a('0x2b');_0x15c591[_0xf74a('0x2f')]=JSON[_0xf74a('0x30')](_0x2a57d3);return rpc[_0x1e58b4+_0xf74a('0x20')][_0xf74a('0x21')](_0x15c591)[_0xf74a('0x22')](function(_0x5cc49d){logger[_0xf74a('0x10')](_0xf74a('0x11'),_0x543438,_0x15c591['body']);if(_0x2a57d3[_0xf74a('0x31')][_0xf74a('0x32')]['endConversation']){_0x444108[_0xf74a('0x13')]();}else{_0x444108['stop']();}})[_0xf74a('0x24')](function(_0x515b42){logger[_0xf74a('0x25')](_0xf74a('0x11'),_0x543438,JSON[_0xf74a('0x30')](_0x515b42));_0x444108[_0xf74a('0x13')]();});})['catch'](function(_0x5b165e){logger['error'](_0xf74a('0x11'),_0x543438,_0x5b165e['message']);_0x444108[_0xf74a('0x13')]();});}}catch(_0x11278a){logger['error'](_0xf74a('0x11'),_0x543438,JSON[_0xf74a('0x30')](_0x11278a));_0x444108[_0xf74a('0x28')]();}};}; \ No newline at end of file +var _0x446c=['[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','catch','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then'];(function(_0x544e5a,_0x3a2f01){var _0x5a58dc=function(_0x4d2a89){while(--_0x4d2a89){_0x544e5a['push'](_0x544e5a['shift']());}};_0x5a58dc(++_0x3a2f01);}(_0x446c,0x156));var _0xc446=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x446c[_0x16938f];return _0x5c66e9;};'use strict';var _=require(_0xc446('0x0'));var moment=require(_0xc446('0x1'));var apiai=require(_0xc446('0x2'));var md5=require(_0xc446('0x3'));var utils=require('./utils');var logger=require(_0xc446('0x4'))(_0xc446('0x5'));var rpc={'chatMessage':require(_0xc446('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc446('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc446('0x8'))};exports[_0xc446('0x9')]=function(_0x578895,_0x549fac){return function(_0x2eea75){try{if(!_[_0xc446('0xa')](this[_0xc446('0xb')][_0xc446('0xc')])){logger[_0xc446('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x578895,_0xc446('0xe'));return _0x2eea75[_0xc446('0xf')]();}var _0xbbd769={'ContactId':this[_0xc446('0x10')]['id'],'sentAt':moment()['format'](_0xc446('0x11')),'direction':_0xc446('0x12')};if(this[_0xc446('0x13')]===_0xc446('0x14')||this[_0xc446('0x13')]===_0xc446('0x15')){_0xbbd769[_0xc446('0x16')]=this[_0xc446('0xb')][_0xc446('0x16')];}var _0x2bc17f=this[_0xc446('0x13')];if(_0x2bc17f===_0xc446('0x17')){_0xbbd769[_0xc446('0x18')]=this[_0xc446('0x19')]['id'];}else{_0xbbd769[_[_0xc446('0x1a')](_0x2bc17f)+_0xc446('0x1b')]=this[_0xc446('0x19')]['id'];}_0xbbd769[_[_0xc446('0x1a')](_0x2bc17f)+_0xc446('0x1c')]=this['interaction']['id'];if(this[_0xc446('0xb')][_0xc446('0x1d')]){var _0x412678=_0x549fac[0x2];if(!_[_0xc446('0x1e')](_0x412678)){_0xbbd769[_0xc446('0x1f')]=utils[_0xc446('0x20')](_0x412678,this);return rpc[_0x2bc17f+_0xc446('0x21')][_0xc446('0x22')](_0xbbd769)[_0xc446('0x23')](function(_0x606af1){logger['info'](_0xc446('0x24'),_0x578895,_0xbbd769[_0xc446('0x1f')]);})['catch'](function(_0x3d1674){logger[_0xc446('0x25')](_0xc446('0x24'),_0x578895,JSON[_0xc446('0x26')](_0x3d1674));})[_0xc446('0x27')](function(){logger[_0xc446('0xd')](_0xc446('0x28'),_0x578895);_0x2eea75[_0xc446('0x29')]();});}else{logger[_0xc446('0xd')](_0xc446('0x2a'),_0x578895);_0x2eea75['stop']();}}else{var _0x35aedc=this;var _0x1ea08b=apiai(_0x549fac[0x0],{'language':_0x549fac[0x1]||'en'});return _0x1ea08b[_0xc446('0x2b')](this[_0xc446('0x2c')][_0xc446('0x1f')],{'sessionId':md5(this[_0xc446('0xb')]['id'])})[_0xc446('0x23')](function(_0x1b785a){_0x35aedc[_0xc446('0x1f')][_0xc446('0x2d')]=_0x1b785a;_0xbbd769[_0xc446('0x1f')]=_0x1b785a[_0xc446('0x2e')][_0xc446('0x2f')][_0xc446('0x30')];_0xbbd769[_0xc446('0x31')]=_0xc446('0x2d');_0xbbd769[_0xc446('0x32')]=JSON['stringify'](_0x1b785a);return rpc[_0x2bc17f+_0xc446('0x21')][_0xc446('0x22')](_0xbbd769)[_0xc446('0x23')](function(_0x2e5d8d){logger[_0xc446('0xd')](_0xc446('0x24'),_0x578895,_0xbbd769['body']);if(_0x1b785a['result'][_0xc446('0x33')][_0xc446('0x34')]){_0x2eea75[_0xc446('0xf')]();}else{_0x2eea75[_0xc446('0x29')]();}})['catch'](function(_0x420fcb){logger[_0xc446('0x25')](_0xc446('0x24'),_0x578895,JSON[_0xc446('0x26')](_0x420fcb));_0x2eea75[_0xc446('0xf')]();});})[_0xc446('0x35')](function(_0x39302a){logger[_0xc446('0x25')](_0xc446('0x24'),_0x578895,_0x39302a[_0xc446('0x2c')]);_0x2eea75['next']();});}}catch(_0x4aca0c){logger['error'](_0xc446('0x24'),_0x578895,JSON[_0xc446('0x26')](_0x4aca0c));_0x2eea75[_0xc446('0x29')]();}};}; \ 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 a3e131a..f656431 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 _0x0f3c=['chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','push','message','lodash','dialogflow','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0f3c,0x189));var _0xc0f3=function(_0x160d0d,_0x1e15e8){_0x160d0d=_0x160d0d-0x0;var _0xe9d470=_0x0f3c[_0x160d0d];return _0xe9d470;};'use strict';var _=require(_0xc0f3('0x0'));var dialogflow=require(_0xc0f3('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xc0f3('0x2'))(_0xc0f3('0x3'));var utils=require(_0xc0f3('0x4'));var rpc={'chatMessage':require(_0xc0f3('0x5')),'openchannelMessage':require(_0xc0f3('0x6')),'mailMessage':require(_0xc0f3('0x7')),'smsMessage':require(_0xc0f3('0x8')),'faxMessage':require(_0xc0f3('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x37d939,_0x2c517e,_0x48fc5d,_0x435864){return new Promise(function(_0x399c29,_0x5dd244){var _0x1fa4f9=_[_0xc0f3('0xa')](_0x48fc5d);_0x1fa4f9[_0xc0f3('0xb')]=_0x435864;return rpc[_0x2c517e+_0xc0f3('0xc')][_0xc0f3('0xd')](_0x1fa4f9)[_0xc0f3('0xe')](function(){logger[_0xc0f3('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x37d939,_0x1fa4f9[_0xc0f3('0xb')]);_0x399c29();})[_0xc0f3('0x10')](function(_0xadc11a){logger['error'](_0xc0f3('0x11'),_0x37d939,JSON[_0xc0f3('0x12')](_0xadc11a));_0x5dd244(_0xadc11a);});});}exports[_0xc0f3('0x13')]=function(_0x125e58,_0x5c6ff2){return function(_0x46eeb4){try{if(!_[_0xc0f3('0x14')](this[_0xc0f3('0x15')][_0xc0f3('0x16')])){logger[_0xc0f3('0xf')](_0xc0f3('0x11'),_0x125e58,_0xc0f3('0x17'));return _0x46eeb4[_0xc0f3('0x18')]();}var _0x63efe4={'ContactId':this[_0xc0f3('0x19')]['id'],'sentAt':moment()[_0xc0f3('0x1a')](_0xc0f3('0x1b')),'direction':_0xc0f3('0x1c')};if(this['channel']===_0xc0f3('0x1d')||this[_0xc0f3('0x1e')]===_0xc0f3('0x1f')){_0x63efe4[_0xc0f3('0x20')]=this[_0xc0f3('0x15')]['phone'];}var _0x3c4218=this[_0xc0f3('0x1e')];if(_0x3c4218===_0xc0f3('0x21')){_0x63efe4[_0xc0f3('0x22')]=this[_0xc0f3('0x23')]['id'];}else{_0x63efe4[_[_0xc0f3('0x24')](_0x3c4218)+'AccountId']=this[_0xc0f3('0x23')]['id'];}_0x63efe4[_['upperFirst'](_0x3c4218)+_0xc0f3('0x25')]=this[_0xc0f3('0x15')]['id'];if(this[_0xc0f3('0x15')]['created']){var _0x37a752=_0x5c6ff2[0x4];if(!_[_0xc0f3('0x26')](_0x37a752)){_0x63efe4['body']=utils[_0xc0f3('0x27')](_0x37a752,this);return rpc[_0x3c4218+_0xc0f3('0xc')][_0xc0f3('0xd')](_0x63efe4)['then'](function(_0x58f2b2){logger[_0xc0f3('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x125e58,_0x63efe4[_0xc0f3('0xb')]);})[_0xc0f3('0x10')](function(_0x2d6cea){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,JSON[_0xc0f3('0x12')](_0x2d6cea));})[_0xc0f3('0x29')](function(){logger[_0xc0f3('0xf')](_0xc0f3('0x2a'),_0x125e58);_0x46eeb4[_0xc0f3('0x2b')]();});}else{logger[_0xc0f3('0xf')](_0xc0f3('0x2c'),_0x125e58);_0x46eeb4[_0xc0f3('0x2b')]();}}else{var _0x43532d=this;var _0x11e7b9=_0x5c6ff2[0x2]['replace'](/\\n/g,'\x0a');var _0x1dc591={'credentials':{'private_key':_0x11e7b9,'client_email':_0x5c6ff2[0x1]}};var _0x459246=new dialogflow[(_0xc0f3('0x2d'))](_0x1dc591);var _0x4f2e88=_0x459246[_0xc0f3('0x2e')](_0x5c6ff2[0x0],md5(_0x43532d['interaction']['id']));var _0x4edb85={'session':_0x4f2e88,'queryInput':{'text':{'text':_0x43532d['message'][_0xc0f3('0xb')],'languageCode':_0x5c6ff2[0x3]||'en'}}};return _0x459246[_0xc0f3('0x2f')](_0x4edb85)['then'](function(_0x4d5e0b){if(_0x4d5e0b&&_0x4d5e0b[_0xc0f3('0x30')]){_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x31')]=_0x4d5e0b;var _0x1e732c=_0x4d5e0b[0x0];var _0xe830cb=_0x1e732c['queryResult'][_0xc0f3('0x32')]&&_0x1e732c[_0xc0f3('0x33')]['diagnosticInfo'][_0xc0f3('0x34')]?_0x1e732c[_0xc0f3('0x33')]['diagnosticInfo'][_0xc0f3('0x34')][_0xc0f3('0x35')][_0xc0f3('0x36')]:![];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x37')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x38')];_0x43532d['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1e732c['queryResult'][_0xc0f3('0x39')];_0x43532d['body'][_0xc0f3('0x3a')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x32')]&&_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x32')][_0xc0f3('0x34')]?_0x1e732c['queryResult'][_0xc0f3('0x32')][_0xc0f3('0x34')][_0xc0f3('0x35')]['boolValue']:![];_0x43532d[_0xc0f3('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x3b')]['name'];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x3c')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x3b')][_0xc0f3('0x3d')];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x3e')]=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x3b')][_0xc0f3('0x3f')];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x40')]=_0x1e732c[_0xc0f3('0x33')]['languageCode'];_0x43532d[_0xc0f3('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x1e732c[_0xc0f3('0x33')][_0xc0f3('0x41')];_0x43532d[_0xc0f3('0xb')][_0xc0f3('0x42')]=_0x1e732c['queryResult'][_0xc0f3('0x43')];_0x63efe4['providerName']=_0xc0f3('0x31');_0x63efe4[_0xc0f3('0x44')]=JSON['stringify'](_0x4d5e0b);var _0x568d21=[];for(var _0x341f9c=0x0;_0x341f9c<_0x4d5e0b[_0xc0f3('0x30')];_0x341f9c++){var _0x1268c3=_0x4d5e0b[_0x341f9c];if(_0x1268c3&&_0x1268c3[_0xc0f3('0x33')]&&_0x1268c3[_0xc0f3('0x33')]['fulfillmentText']){_0x568d21[_0xc0f3('0x45')](createMessage(_0x125e58,_0x3c4218,_0x63efe4,_0x1268c3[_0xc0f3('0x33')]['fulfillmentText']));}}return Promise['all'](_0x568d21)[_0xc0f3('0xe')](function(){if(_0xe830cb){_0x46eeb4[_0xc0f3('0x18')]();}else{_0x46eeb4[_0xc0f3('0x2b')]();}})[_0xc0f3('0x10')](function(_0x2c7d9d){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,JSON[_0xc0f3('0x12')](_0x2c7d9d));_0x46eeb4[_0xc0f3('0x18')]();});}})['catch'](function(_0x5e1cd5){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,_0x5e1cd5[_0xc0f3('0x46')]);_0x46eeb4[_0xc0f3('0x18')]();});}}catch(_0x2fdebc){logger[_0xc0f3('0x28')](_0xc0f3('0x11'),_0x125e58,JSON[_0xc0f3('0x12')](_0x2fdebc));_0x46eeb4['stop']();}};}; \ No newline at end of file +var _0xb56f=['upperFirst','InteractionId','created','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20%s','finally','stop','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','fulfillmentText','all','next','lodash','dialogflow','md5','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','body','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId'];(function(_0x19ab78,_0x29301c){var _0x5cbd77=function(_0x3c1d34){while(--_0x3c1d34){_0x19ab78['push'](_0x19ab78['shift']());}};_0x5cbd77(++_0x29301c);}(_0xb56f,0x141));var _0xfb56=function(_0x3e827a,_0x4e5081){_0x3e827a=_0x3e827a-0x0;var _0xae7388=_0xb56f[_0x3e827a];return _0xae7388;};'use strict';var _=require(_0xfb56('0x0'));var dialogflow=require(_0xfb56('0x1'));var md5=require(_0xfb56('0x2'));var moment=require('moment');var Promise=require(_0xfb56('0x3'));var logger=require(_0xfb56('0x4'))('routing');var utils=require(_0xfb56('0x5'));var rpc={'chatMessage':require(_0xfb56('0x6')),'openchannelMessage':require(_0xfb56('0x7')),'mailMessage':require(_0xfb56('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfb56('0x9'))};function createMessage(_0x5b3cbb,_0x58d1b2,_0x2e35ff,_0x1af6fe){return new Promise(function(_0x2cb6b2,_0x13350d){var _0x2c0d52=_[_0xfb56('0xa')](_0x2e35ff);_0x2c0d52['body']=_0x1af6fe;return rpc[_0x58d1b2+_0xfb56('0xb')][_0xfb56('0xc')](_0x2c0d52)[_0xfb56('0xd')](function(){logger[_0xfb56('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b3cbb,_0x2c0d52[_0xfb56('0xf')]);_0x2cb6b2();})[_0xfb56('0x10')](function(_0x3d825b){logger[_0xfb56('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b3cbb,JSON[_0xfb56('0x12')](_0x3d825b));_0x13350d(_0x3d825b);});});}exports[_0xfb56('0x13')]=function(_0x2ec9dd,_0x5d681b){return function(_0x55e877){try{if(!_[_0xfb56('0x14')](this[_0xfb56('0x15')][_0xfb56('0x16')])){logger[_0xfb56('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x2ec9dd,_0xfb56('0x17'));return _0x55e877['next']();}var _0x1d14af={'ContactId':this['contact']['id'],'sentAt':moment()[_0xfb56('0x18')](_0xfb56('0x19')),'direction':'out'};if(this[_0xfb56('0x1a')]===_0xfb56('0x1b')||this[_0xfb56('0x1a')]===_0xfb56('0x1c')){_0x1d14af[_0xfb56('0x1d')]=this[_0xfb56('0x15')][_0xfb56('0x1d')];}var _0x19d0b7=this[_0xfb56('0x1a')];if(_0x19d0b7===_0xfb56('0x1e')){_0x1d14af[_0xfb56('0x1f')]=this[_0xfb56('0x20')]['id'];}else{_0x1d14af[_['upperFirst'](_0x19d0b7)+_0xfb56('0x21')]=this[_0xfb56('0x20')]['id'];}_0x1d14af[_[_0xfb56('0x22')](_0x19d0b7)+_0xfb56('0x23')]=this[_0xfb56('0x15')]['id'];if(this['interaction'][_0xfb56('0x24')]){var _0x10c746=_0x5d681b[0x4];if(!_[_0xfb56('0x25')](_0x10c746)){_0x1d14af[_0xfb56('0xf')]=utils[_0xfb56('0x26')](_0x10c746,this);return rpc[_0x19d0b7+_0xfb56('0xb')][_0xfb56('0xc')](_0x1d14af)[_0xfb56('0xd')](function(_0x8de857){logger[_0xfb56('0xe')](_0xfb56('0x27'),_0x2ec9dd,_0x1d14af[_0xfb56('0xf')]);})[_0xfb56('0x10')](function(_0xafb0e9){logger[_0xfb56('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x2ec9dd,JSON[_0xfb56('0x12')](_0xafb0e9));})[_0xfb56('0x28')](function(){logger[_0xfb56('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2ec9dd);_0x55e877[_0xfb56('0x29')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2ec9dd);_0x55e877[_0xfb56('0x29')]();}}else{var _0x5b2582=this;var _0x5778a0=_0x5d681b[0x2][_0xfb56('0x2a')](/\\n/g,'\x0a');var _0x2a9cff={'credentials':{'private_key':_0x5778a0,'client_email':_0x5d681b[0x1]}};var _0x3706b7=new dialogflow[(_0xfb56('0x2b'))](_0x2a9cff);var _0x1b2fd3=_0x3706b7['sessionPath'](_0x5d681b[0x0],md5(_0x5b2582[_0xfb56('0x15')]['id']));var _0x1e0d4d={'session':_0x1b2fd3,'queryInput':{'text':{'text':_0x5b2582[_0xfb56('0x2c')][_0xfb56('0xf')],'languageCode':_0x5d681b[0x3]||'en'}}};return _0x3706b7[_0xfb56('0x2d')](_0x1e0d4d)['then'](function(_0x284c12){if(_0x284c12&&_0x284c12[_0xfb56('0x2e')]){_0x5b2582['body'][_0xfb56('0x2f')]=_0x284c12;var _0x341bb2=_0x284c12[0x0];var _0x304da3=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x31')]&&_0x341bb2[_0xfb56('0x30')][_0xfb56('0x31')][_0xfb56('0x32')]?_0x341bb2[_0xfb56('0x30')][_0xfb56('0x31')]['fields'][_0xfb56('0x33')][_0xfb56('0x34')]:![];_0x5b2582[_0xfb56('0xf')][_0xfb56('0x35')]=_0x341bb2['queryResult']['action'];_0x5b2582['body'][_0xfb56('0x36')]=_0x341bb2['queryResult'][_0xfb56('0x37')];_0x5b2582[_0xfb56('0xf')][_0xfb56('0x38')]=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x31')]&&_0x341bb2[_0xfb56('0x30')][_0xfb56('0x31')][_0xfb56('0x32')]?_0x341bb2[_0xfb56('0x30')][_0xfb56('0x31')][_0xfb56('0x32')][_0xfb56('0x33')][_0xfb56('0x34')]:![];_0x5b2582[_0xfb56('0xf')][_0xfb56('0x39')]=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x3a')][_0xfb56('0x3b')];_0x5b2582[_0xfb56('0xf')][_0xfb56('0x3c')]=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x3a')][_0xfb56('0x3d')];_0x5b2582['body'][_0xfb56('0x3e')]=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x3a')][_0xfb56('0x3f')];_0x5b2582[_0xfb56('0xf')]['DIALOGFLOWV2_LANGUAGECODE']=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x40')];_0x5b2582[_0xfb56('0xf')][_0xfb56('0x41')]=_0x341bb2[_0xfb56('0x30')][_0xfb56('0x42')];_0x5b2582[_0xfb56('0xf')]['DIALOGFLOWV2_SCORE']=_0x341bb2['queryResult'][_0xfb56('0x43')];_0x1d14af['providerName']=_0xfb56('0x2f');_0x1d14af['providerResponse']=JSON[_0xfb56('0x12')](_0x284c12);var _0x18b540=[];for(var _0x5ae7da=0x0;_0x5ae7da<_0x284c12[_0xfb56('0x2e')];_0x5ae7da++){var _0xb1115c=_0x284c12[_0x5ae7da];if(_0xb1115c&&_0xb1115c[_0xfb56('0x30')]&&_0xb1115c[_0xfb56('0x30')][_0xfb56('0x44')]){_0x18b540['push'](createMessage(_0x2ec9dd,_0x19d0b7,_0x1d14af,_0xb1115c[_0xfb56('0x30')][_0xfb56('0x44')]));}}return Promise[_0xfb56('0x45')](_0x18b540)['then'](function(){if(_0x304da3){_0x55e877['next']();}else{_0x55e877[_0xfb56('0x29')]();}})[_0xfb56('0x10')](function(_0x3f3ebe){logger[_0xfb56('0x11')](_0xfb56('0x27'),_0x2ec9dd,JSON['stringify'](_0x3f3ebe));_0x55e877[_0xfb56('0x46')]();});}})[_0xfb56('0x10')](function(_0x2cc3ab){logger[_0xfb56('0x11')](_0xfb56('0x27'),_0x2ec9dd,_0x2cc3ab[_0xfb56('0x2c')]);_0x55e877['next']();});}}catch(_0x59ec29){logger[_0xfb56('0x11')](_0xfb56('0x27'),_0x2ec9dd,JSON['stringify'](_0x59ec29));_0x55e877[_0xfb56('0x29')]();}};}; \ 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 7718cec..764f952 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 _0xd48f=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','stop','condition','priorityTrue','priorityFalse','next','findIndex','rules','info'];(function(_0x2e2ebd,_0x294539){var _0x1c0f8b=function(_0x8f78cf){while(--_0x8f78cf){_0x2e2ebd['push'](_0x2e2ebd['shift']());}};_0x1c0f8b(++_0x294539);}(_0xd48f,0xf6));var _0xfd48=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xd48f[_0x8a969d];return _0x1d8dc7;};'use strict';var schema=require(_0xfd48('0x0'));var _=require(_0xfd48('0x1'));var htmlToText=require(_0xfd48('0x2'));var utils=require(_0xfd48('0x3'));var logger=require(_0xfd48('0x4'))(_0xfd48('0x5'));var gotoif=schema({'condition':{'type':_0xfd48('0x6'),'required':!![],'message':_0xfd48('0x7')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xfd48('0x8'),'message':_0xfd48('0x9')}});exports[_0xfd48('0xa')]=function(_0x2b1f34,_0x1ab846){return function(_0x5df777){try{var _0x1fc65f={'condition':htmlToText[_0xfd48('0xb')](utils[_0xfd48('0xc')](_0x1ab846[0x0],this),{'wordwrap':![]})[_0xfd48('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ab846[0x1],'priorityFalse':_0x1ab846[0x2]};var _0x2b4ab1=gotoif[_0xfd48('0x0')](_0x1fc65f,{'typecast':!![]});if(_0x2b4ab1[_0xfd48('0xe')]){logger['error'](_0xfd48('0xf'),_0x2b1f34,_['map'](_0x2b4ab1,'message')['join'](',\x20'));_0x5df777[_0xfd48('0x10')]();}else{try{var _0x269906=eval('('+_0x1fc65f[_0xfd48('0x11')]+')');var _0x24b011=_0x269906?_0x1fc65f[_0xfd48('0x12')]:_0x1fc65f[_0xfd48('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2b1f34,_0x1fc65f[_0xfd48('0x11')],_0x269906,_0x24b011||_0xfd48('0x14'));if(_0x24b011){var _0x11753d=_[_0xfd48('0x15')](_0x5df777[_0xfd48('0x16')](),{'p':_0x24b011});if(_0x11753d>=0x0){logger[_0xfd48('0x17')](_0xfd48('0x18'),_0x2b1f34,_0x24b011||_0xfd48('0x14'),_0x11753d);_0x5df777['next'](_0x11753d);}else{logger[_0xfd48('0x17')](_0xfd48('0x19'),_0x2b1f34,_0x24b011||'next');_0x5df777[_0xfd48('0x10')]();}}else{_0x5df777[_0xfd48('0x14')]();}}catch(_0x2d7837){logger[_0xfd48('0x1a')](_0xfd48('0x1b'),_0x2b1f34,_0x2d7837[_0xfd48('0x1c')]);_0x5df777[_0xfd48('0x10')]();}}}catch(_0x1b37d7){logger[_0xfd48('0x1a')]('[%s][GOTOIF]\x20%s',_0x2b1f34,JSON[_0xfd48('0x1d')](_0x1b37d7));_0x5df777[_0xfd48('0x10')]();}};}; \ No newline at end of file +var _0xbfe0=['number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','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','stringify','validate','lodash','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x3aad88,_0x4cb6ad){var _0x2ab631=function(_0xa76b6e){while(--_0xa76b6e){_0x3aad88['push'](_0x3aad88['shift']());}};_0x2ab631(++_0x4cb6ad);}(_0xbfe0,0x173));var _0x0bfe=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xbfe0[_0x3a6efd];return _0x487b9a;};'use strict';var schema=require(_0x0bfe('0x0'));var _=require(_0x0bfe('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x0bfe('0x2'));var logger=require(_0x0bfe('0x3'))(_0x0bfe('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x0bfe('0x5')},'priorityTrue':{'type':_0x0bfe('0x6'),'message':_0x0bfe('0x7')},'priorityFalse':{'type':_0x0bfe('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x0bfe('0x8')]=function(_0x259bb8,_0x1e4d4f){return function(_0x5b8d1e){try{var _0x2f7da0={'condition':htmlToText[_0x0bfe('0x9')](utils[_0x0bfe('0xa')](_0x1e4d4f[0x0],this),{'wordwrap':![]})[_0x0bfe('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1e4d4f[0x1],'priorityFalse':_0x1e4d4f[0x2]};var _0x4f58d3=gotoif[_0x0bfe('0x0')](_0x2f7da0,{'typecast':!![]});if(_0x4f58d3[_0x0bfe('0xc')]){logger[_0x0bfe('0xd')](_0x0bfe('0xe'),_0x259bb8,_[_0x0bfe('0xf')](_0x4f58d3,_0x0bfe('0x10'))[_0x0bfe('0x11')](',\x20'));_0x5b8d1e[_0x0bfe('0x12')]();}else{try{var _0x1f318a=eval('('+_0x2f7da0[_0x0bfe('0x13')]+')');var _0x168caa=_0x1f318a?_0x2f7da0['priorityTrue']:_0x2f7da0[_0x0bfe('0x14')];logger[_0x0bfe('0x15')](_0x0bfe('0x16'),_0x259bb8,_0x2f7da0[_0x0bfe('0x13')],_0x1f318a,_0x168caa||_0x0bfe('0x17'));if(_0x168caa){var _0x2892ad=_[_0x0bfe('0x18')](_0x5b8d1e[_0x0bfe('0x19')](),{'p':_0x168caa});if(_0x2892ad>=0x0){logger['info'](_0x0bfe('0x1a'),_0x259bb8,_0x168caa||_0x0bfe('0x17'),_0x2892ad);_0x5b8d1e['next'](_0x2892ad);}else{logger[_0x0bfe('0x15')](_0x0bfe('0x1b'),_0x259bb8,_0x168caa||_0x0bfe('0x17'));_0x5b8d1e[_0x0bfe('0x12')]();}}else{_0x5b8d1e[_0x0bfe('0x17')]();}}catch(_0x24f06f){logger[_0x0bfe('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x259bb8,_0x24f06f[_0x0bfe('0x10')]);_0x5b8d1e[_0x0bfe('0x12')]();}}}catch(_0x29159d){logger['error'](_0x0bfe('0xe'),_0x259bb8,JSON[_0x0bfe('0x1c')](_0x29159d));_0x5b8d1e[_0x0bfe('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 d64593a..f73b432 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 _0x92c3=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x92c3,0xa6));var _0x392c=function(_0x1fa220,_0x5004c5){_0x1fa220=_0x1fa220-0x0;var _0x58eafb=_0x92c3[_0x1fa220];return _0x58eafb;};'use strict';var schema=require(_0x392c('0x0'));var _=require(_0x392c('0x1'));var logger=require(_0x392c('0x2'))(_0x392c('0x3'));var gotop=schema({'priority':{'type':_0x392c('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x392c('0x5')]=function(_0x412bbc,_0xed407d){return function(_0x4e979d){try{var _0x37ffda={'priority':_0xed407d[0x0]};var _0xe6f45b=gotop[_0x392c('0x0')](_0x37ffda,{'typecast':!![]});if(_0xe6f45b[_0x392c('0x6')]){logger[_0x392c('0x7')](_0x392c('0x8'),_0x412bbc,_[_0x392c('0x9')](_0xe6f45b,_0x392c('0xa'))[_0x392c('0xb')](',\x20'));_0x4e979d[_0x392c('0xc')]();}else{logger[_0x392c('0xd')](_0x392c('0xe'),_0x412bbc,_0x37ffda[_0x392c('0xf')]);if(_0x37ffda[_0x392c('0xf')]){var _0x4a55ea=_[_0x392c('0x10')](_0x4e979d[_0x392c('0x11')](),{'p':_0x37ffda[_0x392c('0xf')]});if(_0x4a55ea>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x412bbc,_0x37ffda[_0x392c('0xf')]||'next',_0x4a55ea);_0x4e979d[_0x392c('0x12')](_0x4a55ea);}else{logger[_0x392c('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x412bbc,_0x37ffda['priority']||_0x392c('0x12'));_0x4e979d[_0x392c('0xc')]();}}else{_0x4e979d['next']();}}}catch(_0x15caaa){logger[_0x392c('0x7')](_0x392c('0x8'),_0x412bbc,JSON[_0x392c('0x13')](_0x15caaa));_0x4e979d[_0x392c('0xc')]();}};}; \ No newline at end of file +var _0x2b7e=['validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','stop'];(function(_0xf02ce1,_0x515949){var _0x370f1d=function(_0x22e882){while(--_0x22e882){_0xf02ce1['push'](_0xf02ce1['shift']());}};_0x370f1d(++_0x515949);}(_0x2b7e,0x98));var _0xe2b7=function(_0x6939c2,_0x21592c){_0x6939c2=_0x6939c2-0x0;var _0xc07023=_0x2b7e[_0x6939c2];return _0xc07023;};'use strict';var schema=require(_0xe2b7('0x0'));var _=require(_0xe2b7('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xe2b7('0x2'),'required':!![],'message':_0xe2b7('0x3')}});exports[_0xe2b7('0x4')]=function(_0x330d95,_0x15f3eb){return function(_0x1e7436){try{var _0x2effce={'priority':_0x15f3eb[0x0]};var _0x2a069d=gotop[_0xe2b7('0x0')](_0x2effce,{'typecast':!![]});if(_0x2a069d[_0xe2b7('0x5')]){logger[_0xe2b7('0x6')](_0xe2b7('0x7'),_0x330d95,_[_0xe2b7('0x8')](_0x2a069d,_0xe2b7('0x9'))[_0xe2b7('0xa')](',\x20'));_0x1e7436['stop']();}else{logger[_0xe2b7('0xb')](_0xe2b7('0xc'),_0x330d95,_0x2effce[_0xe2b7('0xd')]);if(_0x2effce['priority']){var _0x2ba585=_[_0xe2b7('0xe')](_0x1e7436['rules'](),{'p':_0x2effce[_0xe2b7('0xd')]});if(_0x2ba585>=0x0){logger[_0xe2b7('0xb')](_0xe2b7('0xf'),_0x330d95,_0x2effce[_0xe2b7('0xd')]||_0xe2b7('0x10'),_0x2ba585);_0x1e7436[_0xe2b7('0x10')](_0x2ba585);}else{logger[_0xe2b7('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x330d95,_0x2effce['priority']||_0xe2b7('0x10'));_0x1e7436['stop']();}}else{_0x1e7436[_0xe2b7('0x10')]();}}}catch(_0x1a93b0){logger[_0xe2b7('0x6')](_0xe2b7('0x7'),_0x330d95,JSON[_0xe2b7('0x11')](_0x1a93b0));_0x1e7436[_0xe2b7('0x12')]();}};}; \ 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 9e910d2..f67d992 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 _0x56ff=['[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','interaction','Message','create','then','info'];(function(_0x3c9161,_0x106ab4){var _0x25dbf4=function(_0x595c49){while(--_0x595c49){_0x3c9161['push'](_0x3c9161['shift']());}};_0x25dbf4(++_0x106ab4);}(_0x56ff,0x66));var _0xf56f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x56ff[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf56f('0x0'));var utils=require(_0xf56f('0x1'));var logger=require('../../../../config/logger')(_0xf56f('0x2'));var rpc={'chatMessage':require(_0xf56f('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf56f('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf56f('0x5'))};exports[_0xf56f('0x6')]=function(_0x3f9855,_0x5c7395){return function(_0x2c65e9){try{var _0x4bdb26={'body':utils['getMustacheRender'](_0x5c7395[0x0],this),'ContactId':this[_0xf56f('0x7')]['id']};if(this[_0xf56f('0x8')]==='chat'){_0x4bdb26[_0xf56f('0x9')]=this['account']['id'];}else{_0x4bdb26[_[_0xf56f('0xa')](this[_0xf56f('0x8')])+_0xf56f('0xb')]=this[_0xf56f('0xc')]['id'];}_0x4bdb26[_[_0xf56f('0xa')](this[_0xf56f('0x8')])+'InteractionId']=this[_0xf56f('0xd')]['id'];if(rpc[this[_0xf56f('0x8')]+_0xf56f('0xe')]){return rpc[this[_0xf56f('0x8')]+_0xf56f('0xe')][_0xf56f('0xf')](_0x4bdb26)[_0xf56f('0x10')](function(_0x2ab689){logger[_0xf56f('0x11')](_0xf56f('0x12'),_0x3f9855,_0x4bdb26['body']);_0x2c65e9[_0xf56f('0x13')]();})[_0xf56f('0x14')](function(_0x537bd9){logger[_0xf56f('0x15')]('[%s][MESSAGE]\x20%s',_0x3f9855,JSON[_0xf56f('0x16')](_0x537bd9));_0x2c65e9[_0xf56f('0x17')]();});}}catch(_0x225800){logger[_0xf56f('0x15')](_0xf56f('0x12'),_0x3f9855,JSON['stringify'](_0x225800));_0x2c65e9[_0xf56f('0x17')]();}};}; \ No newline at end of file +var _0xbac0=['lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xbac0,0x8c));var _0x0bac=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xbac0[_0x555b2f];return _0x81c0a6;};'use strict';var _=require(_0x0bac('0x0'));var utils=require('./utils');var logger=require(_0x0bac('0x1'))(_0x0bac('0x2'));var rpc={'chatMessage':require(_0x0bac('0x3')),'openchannelMessage':require(_0x0bac('0x4')),'mailMessage':require(_0x0bac('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0bac('0x6')),'whatsappMessage':require(_0x0bac('0x7'))};exports[_0x0bac('0x8')]=function(_0x9b156c,_0x19619c){return function(_0x4654e9){try{var _0x2ad9ce={'body':utils[_0x0bac('0x9')](_0x19619c[0x0],this),'ContactId':this[_0x0bac('0xa')]['id']};if(this[_0x0bac('0xb')]===_0x0bac('0xc')){_0x2ad9ce[_0x0bac('0xd')]=this[_0x0bac('0xe')]['id'];}else{_0x2ad9ce[_[_0x0bac('0xf')](this['channel'])+'AccountId']=this[_0x0bac('0xe')]['id'];}_0x2ad9ce[_[_0x0bac('0xf')](this['channel'])+_0x0bac('0x10')]=this[_0x0bac('0x11')]['id'];if(rpc[this[_0x0bac('0xb')]+_0x0bac('0x12')]){return rpc[this['channel']+_0x0bac('0x12')][_0x0bac('0x13')](_0x2ad9ce)[_0x0bac('0x14')](function(_0x108e02){logger[_0x0bac('0x15')](_0x0bac('0x16'),_0x9b156c,_0x2ad9ce[_0x0bac('0x17')]);_0x4654e9[_0x0bac('0x18')]();})[_0x0bac('0x19')](function(_0x5b9089){logger[_0x0bac('0x1a')](_0x0bac('0x16'),_0x9b156c,JSON[_0x0bac('0x1b')](_0x5b9089));_0x4654e9['stop']();});}}catch(_0x36b2d3){logger[_0x0bac('0x1a')](_0x0bac('0x16'),_0x9b156c,JSON[_0x0bac('0x1b')](_0x36b2d3));_0x4654e9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 636018b..852ab4e 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 _0xbac3=['stringify','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0xbac3,0x69));var _0x3bac=function(_0x6fbc80,_0x355ace){_0x6fbc80=_0x6fbc80-0x0;var _0x57c2ff=_0xbac3[_0x6fbc80];return _0x57c2ff;};'use strict';var utils=require(_0x3bac('0x0'));var logger=require(_0x3bac('0x1'))('routing');exports['consequence']=function(_0x1492b7,_0x20e2f4){return function(_0x106136){try{logger[_0x3bac('0x2')](_0x3bac('0x3'),_0x1492b7,utils[_0x3bac('0x4')](_0x20e2f4[0x0],this));_0x106136[_0x3bac('0x5')]();}catch(_0xd2d69a){logger[_0x3bac('0x6')](_0x3bac('0x3'),_0x1492b7,JSON[_0x3bac('0x7')](_0xd2d69a));_0x106136['stop']();}};}; \ No newline at end of file +var _0x991b=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x991b,0x185));var _0xb991=function(_0x31d53f,_0x4c8826){_0x31d53f=_0x31d53f-0x0;var _0x438d91=_0x991b[_0x31d53f];return _0x438d91;};'use strict';var utils=require(_0xb991('0x0'));var logger=require(_0xb991('0x1'))(_0xb991('0x2'));exports[_0xb991('0x3')]=function(_0x9b3809,_0x1bb374){return function(_0x15b633){try{logger[_0xb991('0x4')](_0xb991('0x5'),_0x9b3809,utils[_0xb991('0x6')](_0x1bb374[0x0],this));_0x15b633[_0xb991('0x7')]();}catch(_0x4a5bd5){logger[_0xb991('0x8')]('[%s][NOOP]\x20%s',_0x9b3809,JSON['stringify'](_0x4a5bd5));_0x15b633[_0xb991('0x9')]();}};}; \ 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 8fb7937..61bd620 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 _0xf7fc=['[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','Queues','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','moment','../../../../config/environment','../../../../config/logger','routing','defaults','redis','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','waiting'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0xf7fc,0x1bb));var _0xcf7f=function(_0x54fae5,_0x323b8e){_0x54fae5=_0x54fae5-0x0;var _0xd761bd=_0xf7fc[_0x54fae5];return _0xd761bd;};'use strict';var schema=require(_0xcf7f('0x0'));var _=require(_0xcf7f('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0xcf7f('0x2'));var Redis=require('ioredis');var config=require(_0xcf7f('0x3'));var logger=require(_0xcf7f('0x4'))(_0xcf7f('0x5'));var strategy=require('./strategy');config['redis']=_[_0xcf7f('0x6')](config[_0xcf7f('0x7')],{'host':_0xcf7f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcf7f('0x7')]));var attributes=['id','queue_id',_0xcf7f('0x9'),_0xcf7f('0xa'),_0xcf7f('0xb'),_0xcf7f('0xc')];function emit(_0x2d78e9,_0x49040d,_0x29810f){io['to'](_0x2d78e9)[_0xcf7f('0xd')](_0x49040d,_0x29810f);}function emitChannelQueueInteraction(_0xd084aa,_0x177371,_0x33251d,_0x51a30,_0x447292,_0x484659,_0x28bd90,_0x3ae24a){var _0x1c21e1=_[_0xcf7f('0xe')](_0x33251d);_0x1c21e1[_0xcf7f('0xf')]=_0x3ae24a;_0x1c21e1[_0xcf7f('0xa')]=_0x177371;_0x1c21e1[_0xcf7f('0x9')]=_0x51a30;_0x1c21e1['id']=_0x447292;if(_0x484659){_0x28bd90[util['format'](_0xcf7f('0x10'),_0xd084aa)][_0x447292]=_[_0xcf7f('0x11')](_0x1c21e1,attributes);}else{delete _0x28bd90[util[_0xcf7f('0x12')]('%sQueuesWaitingInteractions',_0xd084aa)][_0x447292];}emit(util[_0xcf7f('0x12')](_0xcf7f('0x13'),_0xd084aa,_0x177371),util[_0xcf7f('0x12')]('%s_queue_waiting_interaction:%s',_0xd084aa,_0x484659?'save':_0xcf7f('0x14')),_[_0xcf7f('0x11')](_0x1c21e1,attributes));}var rpc={'openchannelQueueReport':require(_0xcf7f('0x15')),'mailQueueReport':require(_0xcf7f('0x16')),'chatQueueReport':require(_0xcf7f('0x17')),'smsQueueReport':require(_0xcf7f('0x18')),'faxQueueReport':require(_0xcf7f('0x19')),'whatsappQueueReport':require(_0xcf7f('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xcf7f('0x1b')},'timeout':{'type':_0xcf7f('0x1c'),'message':_0xcf7f('0x1d')}});function startRouting(_0x5ab572,_0x21183f,_0x3a36c1,_0x5f1833){if(_0x5ab572&&_0x21183f&&_0x3a36c1){_0x21183f['waiting']+=0x1;var _0x3bccc3={'uniqueid':_0x5ab572,'from':_0x3a36c1[_0xcf7f('0x1e')]?_0x3a36c1['body'][_0xcf7f('0xb')]:'','joinAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'ContactId':_0x3a36c1[_0xcf7f('0x20')]?_0x3a36c1['contact']['id']:null,'ListId':_0x3a36c1[_0xcf7f('0x21')]?_0x3a36c1[_0xcf7f('0x21')]['id']:null};_0x3bccc3[_[_0xcf7f('0x22')](_0x3a36c1['channel'])+'QueueId']=_0x21183f['id']||null;_0x3bccc3[_[_0xcf7f('0x22')](_0x3a36c1[_0xcf7f('0x23')])+_0xcf7f('0x24')]=_0x3a36c1[_0xcf7f('0x25')]?_0x3a36c1['interaction']['id']:null;_0x3bccc3[_['upperFirst'](_0x3a36c1[_0xcf7f('0x23')])+'MessageId']=_0x3a36c1[_0xcf7f('0x26')]?_0x3a36c1[_0xcf7f('0x26')]['id']:null;_0x3bccc3[_[_0xcf7f('0x22')](_0x3a36c1[_0xcf7f('0x23')])+(_0x3a36c1[_0xcf7f('0x23')]!=='chat'?_0xcf7f('0x27'):'WebsiteId')]=_0x3a36c1[_0xcf7f('0x9')]?_0x3a36c1['account']['id']:null;logger[_0xcf7f('0x28')](util[_0xcf7f('0x12')](_0xcf7f('0x29'),_0x5ab572,_0x21183f[_0xcf7f('0x2a')]));emitChannelQueueInteraction(_0x3a36c1[_0xcf7f('0x23')],_0x21183f[_0xcf7f('0x2a')],_0x3bccc3,_0x3a36c1[_0xcf7f('0x9')]['name'],_0x3a36c1['message']['id'],!![],_0x5f1833,_0x21183f['id']);if(rpc[_0x3a36c1[_0xcf7f('0x23')]+_0xcf7f('0x2b')]){return rpc[_0x3a36c1[_0xcf7f('0x23')]+_0xcf7f('0x2b')]['create'](_0x3bccc3)['catch'](function(_0x3538a6){logger[_0xcf7f('0x2c')](_0xcf7f('0x2d'));});}}}function stopRouting(_0x238fb0,_0x25d9f5,_0x72b0db,_0x4cc326){if(_0x238fb0&&_0x25d9f5){_0x25d9f5[_0xcf7f('0x2e')]-=0x1;var _0xfa6703={'leaveAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'acceptAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'reason':'accepted'};logger[_0xcf7f('0x28')](util[_0xcf7f('0x12')](_0xcf7f('0x2f'),_0x238fb0,_0x25d9f5['name']));emitChannelQueueInteraction(_0x72b0db[_0xcf7f('0x23')],_0x25d9f5[_0xcf7f('0x2a')],_0x72b0db[_0xcf7f('0x1e')],_0x72b0db['account'][_0xcf7f('0x2a')],_0x72b0db[_0xcf7f('0x26')]['id'],![],_0x4cc326,_0x25d9f5['id']);if(rpc[_0x72b0db[_0xcf7f('0x23')]+_0xcf7f('0x2b')]){return rpc[_0x72b0db[_0xcf7f('0x23')]+_0xcf7f('0x2b')]['update'](_0x238fb0,_0xfa6703)[_0xcf7f('0x30')](function(_0x5c6e98){logger['error'](_0xcf7f('0x31'));});}}}function endRouting(_0x3f5310,_0xca20e2,_0x5b4cb2,_0x5ee9ca){if(_0x3f5310&&_0xca20e2){_0xca20e2[_0xcf7f('0x2e')]-=0x1;var _0x43339b={'leaveAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'exitAt':moment()[_0xcf7f('0x12')](_0xcf7f('0x1f')),'reason':_0xcf7f('0x32')};logger['info'](util[_0xcf7f('0x12')](_0xcf7f('0x33'),_0x3f5310,_0xca20e2[_0xcf7f('0x2a')]));emitChannelQueueInteraction(_0x5b4cb2[_0xcf7f('0x23')],_0xca20e2[_0xcf7f('0x2a')],_0x5b4cb2[_0xcf7f('0x1e')],_0x5b4cb2[_0xcf7f('0x9')][_0xcf7f('0x2a')],_0x5b4cb2[_0xcf7f('0x26')]['id'],![],_0x5ee9ca);if(rpc[_0x5b4cb2[_0xcf7f('0x23')]+_0xcf7f('0x2b')]){return rpc[_0x5b4cb2[_0xcf7f('0x23')]+_0xcf7f('0x2b')][_0xcf7f('0x34')](_0x3f5310,_0x43339b)[_0xcf7f('0x30')](function(_0x5eb94b){logger['error'](_0xcf7f('0x31'));});}}}function handleFindQueue(_0x3834fc){return function(_0x33397c){return _0x33397c[_0xcf7f('0x2a')][_0xcf7f('0x35')]()===_0x3834fc[_0xcf7f('0x35')]();};}exports['consequence']=function(_0x284d84,_0x20c251,_0x14038c,_0x13ae28){return function(_0x5c7671){try{var _0x152225={'name':_0x20c251[0x0],'timeout':_0x20c251[0x1]};var _0x5a1459=queue[_0xcf7f('0x0')](_0x152225,{'typecast':!![]});if(_0x5a1459[_0xcf7f('0x36')]){logger[_0xcf7f('0x2c')](_0xcf7f('0x37'),_0x284d84,_[_0xcf7f('0x38')](_0x5a1459,_0xcf7f('0x26'))['join'](',\x20'));_0x5c7671[_0xcf7f('0x39')]();}else{var _0x3baff9=_['find'](_0x14038c[_0x13ae28['channel']+_0xcf7f('0x3a')],handleFindQueue(_0x152225[_0xcf7f('0x2a')]));if(_0x3baff9){startRouting(_0x284d84,_0x3baff9,_0x13ae28,_0x14038c);var _0x288be8=(_0x3baff9['timeout']||0xa)*0x3e8;var _0x5a09f4=(_0x152225[_0xcf7f('0x32')]||0x14)*0x3e8;var _0x4f4d1c,_0x27255e;if(_0x288be8>_0x5a09f4){_0x5a09f4=_0x288be8;}var _0x461e14=seqqueue['createQueue'](_0x288be8);_0x461e14['id']=_0x284d84;_0x461e14['atimeout']=_0x288be8;_0x461e14['qtimeout']=_0x5a09f4;_0x461e14[_0xcf7f('0x23')]=_0x13ae28[_0xcf7f('0x23')];_0x14038c[_0xcf7f('0x3b')][_0x284d84]['on'](_0xcf7f('0x3c'),function(){logger[_0xcf7f('0x28')](_0xcf7f('0x3d'),_0x284d84);stopRouting(_0x284d84,_0x3baff9,_0x13ae28,_0x14038c);clearTimeout(_0x4f4d1c);_0x4f4d1c=undefined;_0x461e14[_0xcf7f('0x3e')](!![]);if(_0x14038c[_0xcf7f('0x3b')][_0x284d84]){delete _0x14038c[_0xcf7f('0x3b')][_0x284d84];}_0x5c7671[_0xcf7f('0x39')]();});_0x14038c[_0xcf7f('0x3b')][_0x284d84]['on']('complete',function(){if(_0x14038c[_0xcf7f('0x3b')][_0x284d84]){delete _0x14038c[_0xcf7f('0x3b')][_0x284d84];}});_0x4f4d1c=setTimeout(function(){logger['info'](_0xcf7f('0x3f'),_0x284d84);endRouting(_0x284d84,_0x3baff9,_0x13ae28,_0x14038c);clearTimeout(_0x4f4d1c);_0x461e14['close'](!![]);_0x5c7671[_0xcf7f('0x40')]();},_0x5a09f4);switch(_0x3baff9['strategy']){case _0xcf7f('0x41'):strategy[_0xcf7f('0x41')](_0x461e14,_0x3baff9,_0x14038c,_0x13ae28);break;default:strategy[_0xcf7f('0x42')](_0x461e14,_0x3baff9,_0x14038c,_0x13ae28);}}else{logger[_0xcf7f('0x2c')](_0xcf7f('0x43'),_0x284d84,_0x152225['name']);_0x5c7671[_0xcf7f('0x39')]();}}}catch(_0x98590e){console[_0xcf7f('0x44')](_0x98590e);logger['error'](_0xcf7f('0x37'),_0x284d84,_0x98590e[_0xcf7f('0x45')]);_0x5c7671[_0xcf7f('0x39')]();}};}; \ No newline at end of file +var _0x52e1=['close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','log','stack','validate','lodash','util','moment','../../../../config/environment','../../../../config/logger','routing','redis','defaults','queue_id','queue','from','joinAt','emit','account','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','accepted','error','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x4b01b7,_0x183b04){var _0x2ed185=function(_0x4a1222){while(--_0x4a1222){_0x4b01b7['push'](_0x4b01b7['shift']());}};_0x2ed185(++_0x183b04);}(_0x52e1,0x175));var _0x152e=function(_0x2aeb58,_0x575b09){_0x2aeb58=_0x2aeb58-0x0;var _0x1f5acc=_0x52e1[_0x2aeb58];return _0x1f5acc;};'use strict';var schema=require(_0x152e('0x0'));var _=require(_0x152e('0x1'));var util=require(_0x152e('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x152e('0x3'));var Redis=require('ioredis');var config=require(_0x152e('0x4'));var logger=require(_0x152e('0x5'))(_0x152e('0x6'));var strategy=require('./strategy');config[_0x152e('0x7')]=_[_0x152e('0x8')](config[_0x152e('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x152e('0x7')]));var attributes=['id',_0x152e('0x9'),'account',_0x152e('0xa'),_0x152e('0xb'),_0x152e('0xc')];function emit(_0x6de60e,_0x2c4ecc,_0x55762f){io['to'](_0x6de60e)[_0x152e('0xd')](_0x2c4ecc,_0x55762f);}function emitChannelQueueInteraction(_0x409740,_0x2b77b6,_0x1f9ea6,_0x1f72d1,_0x232c15,_0x427da8,_0xe9454a,_0x53c899){var _0x5e2cb3=_['clone'](_0x1f9ea6);_0x5e2cb3['queue_id']=_0x53c899;_0x5e2cb3[_0x152e('0xa')]=_0x2b77b6;_0x5e2cb3[_0x152e('0xe')]=_0x1f72d1;_0x5e2cb3['id']=_0x232c15;if(_0x427da8){_0xe9454a[util[_0x152e('0xf')](_0x152e('0x10'),_0x409740)][_0x232c15]=_['pick'](_0x5e2cb3,attributes);}else{delete _0xe9454a[util[_0x152e('0xf')]('%sQueuesWaitingInteractions',_0x409740)][_0x232c15];}emit(util[_0x152e('0xf')](_0x152e('0x11'),_0x409740,_0x2b77b6),util[_0x152e('0xf')](_0x152e('0x12'),_0x409740,_0x427da8?_0x152e('0x13'):_0x152e('0x14')),_['pick'](_0x5e2cb3,attributes));}var rpc={'openchannelQueueReport':require(_0x152e('0x15')),'mailQueueReport':require(_0x152e('0x16')),'chatQueueReport':require(_0x152e('0x17')),'smsQueueReport':require(_0x152e('0x18')),'faxQueueReport':require(_0x152e('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x152e('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x152e('0x1b'),'message':_0x152e('0x1c')}});function startRouting(_0x30ecb5,_0x788b66,_0x16528d,_0x6115ee){if(_0x30ecb5&&_0x788b66&&_0x16528d){_0x788b66[_0x152e('0x1d')]+=0x1;var _0x4e924c={'uniqueid':_0x30ecb5,'from':_0x16528d[_0x152e('0x1e')]?_0x16528d[_0x152e('0x1e')][_0x152e('0xb')]:'','joinAt':moment()[_0x152e('0xf')](_0x152e('0x1f')),'ContactId':_0x16528d[_0x152e('0x20')]?_0x16528d[_0x152e('0x20')]['id']:null,'ListId':_0x16528d[_0x152e('0x21')]?_0x16528d[_0x152e('0x21')]['id']:null};_0x4e924c[_[_0x152e('0x22')](_0x16528d[_0x152e('0x23')])+_0x152e('0x24')]=_0x788b66['id']||null;_0x4e924c[_[_0x152e('0x22')](_0x16528d[_0x152e('0x23')])+_0x152e('0x25')]=_0x16528d['interaction']?_0x16528d['interaction']['id']:null;_0x4e924c[_['upperFirst'](_0x16528d[_0x152e('0x23')])+_0x152e('0x26')]=_0x16528d[_0x152e('0x27')]?_0x16528d[_0x152e('0x27')]['id']:null;_0x4e924c[_[_0x152e('0x22')](_0x16528d[_0x152e('0x23')])+(_0x16528d[_0x152e('0x23')]!=='chat'?_0x152e('0x28'):_0x152e('0x29'))]=_0x16528d[_0x152e('0xe')]?_0x16528d[_0x152e('0xe')]['id']:null;logger['info'](util['format'](_0x152e('0x2a'),_0x30ecb5,_0x788b66[_0x152e('0x2b')]));emitChannelQueueInteraction(_0x16528d[_0x152e('0x23')],_0x788b66['name'],_0x4e924c,_0x16528d[_0x152e('0xe')][_0x152e('0x2b')],_0x16528d['message']['id'],!![],_0x6115ee,_0x788b66['id']);if(rpc[_0x16528d[_0x152e('0x23')]+_0x152e('0x2c')]){return rpc[_0x16528d['channel']+_0x152e('0x2c')][_0x152e('0x2d')](_0x4e924c)[_0x152e('0x2e')](function(_0x51e4b3){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x4e8f80,_0x131343,_0x130ddd,_0x280ef3){if(_0x4e8f80&&_0x131343){_0x131343[_0x152e('0x1d')]-=0x1;var _0x57f913={'leaveAt':moment()[_0x152e('0xf')](_0x152e('0x1f')),'acceptAt':moment()[_0x152e('0xf')](_0x152e('0x1f')),'reason':_0x152e('0x2f')};logger['info'](util[_0x152e('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x4e8f80,_0x131343[_0x152e('0x2b')]));emitChannelQueueInteraction(_0x130ddd['channel'],_0x131343[_0x152e('0x2b')],_0x130ddd[_0x152e('0x1e')],_0x130ddd[_0x152e('0xe')][_0x152e('0x2b')],_0x130ddd[_0x152e('0x27')]['id'],![],_0x280ef3,_0x131343['id']);if(rpc[_0x130ddd['channel']+_0x152e('0x2c')]){return rpc[_0x130ddd[_0x152e('0x23')]+'QueueReport']['update'](_0x4e8f80,_0x57f913)[_0x152e('0x2e')](function(_0x4141b9){logger[_0x152e('0x30')](_0x152e('0x31'));});}}}function endRouting(_0x1e4ef5,_0x203495,_0x12ca82,_0x5adb11){if(_0x1e4ef5&&_0x203495){_0x203495[_0x152e('0x1d')]-=0x1;var _0x164569={'leaveAt':moment()[_0x152e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x152e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x152e('0x32')};logger[_0x152e('0x33')](util[_0x152e('0xf')](_0x152e('0x34'),_0x1e4ef5,_0x203495[_0x152e('0x2b')]));emitChannelQueueInteraction(_0x12ca82[_0x152e('0x23')],_0x203495[_0x152e('0x2b')],_0x12ca82[_0x152e('0x1e')],_0x12ca82[_0x152e('0xe')][_0x152e('0x2b')],_0x12ca82[_0x152e('0x27')]['id'],![],_0x5adb11);if(rpc[_0x12ca82[_0x152e('0x23')]+_0x152e('0x2c')]){return rpc[_0x12ca82[_0x152e('0x23')]+_0x152e('0x2c')]['update'](_0x1e4ef5,_0x164569)[_0x152e('0x2e')](function(_0x4ba71d){logger[_0x152e('0x30')](_0x152e('0x31'));});}}}function handleFindQueue(_0x5e5607){return function(_0x3bfd52){return _0x3bfd52[_0x152e('0x2b')][_0x152e('0x35')]()===_0x5e5607[_0x152e('0x35')]();};}exports[_0x152e('0x36')]=function(_0x1f32d7,_0x4ea09a,_0x3f3658,_0x40eadb){return function(_0x254d05){try{var _0x4016ff={'name':_0x4ea09a[0x0],'timeout':_0x4ea09a[0x1]};var _0x1b8d8d=queue[_0x152e('0x0')](_0x4016ff,{'typecast':!![]});if(_0x1b8d8d[_0x152e('0x37')]){logger[_0x152e('0x30')](_0x152e('0x38'),_0x1f32d7,_[_0x152e('0x39')](_0x1b8d8d,_0x152e('0x27'))['join'](',\x20'));_0x254d05['stop']();}else{var _0x226206=_[_0x152e('0x3a')](_0x3f3658[_0x40eadb[_0x152e('0x23')]+_0x152e('0x3b')],handleFindQueue(_0x4016ff['name']));if(_0x226206){startRouting(_0x1f32d7,_0x226206,_0x40eadb,_0x3f3658);var _0x504885=(_0x226206[_0x152e('0x32')]||0xa)*0x3e8;var _0x5b3fdf=(_0x4016ff[_0x152e('0x32')]||0x14)*0x3e8;var _0x42271d,_0x3ab9f6;if(_0x504885>_0x5b3fdf){_0x5b3fdf=_0x504885;}var _0x37bb14=seqqueue['createQueue'](_0x504885);_0x37bb14['id']=_0x1f32d7;_0x37bb14[_0x152e('0x3c')]=_0x504885;_0x37bb14[_0x152e('0x3d')]=_0x5b3fdf;_0x37bb14[_0x152e('0x23')]=_0x40eadb[_0x152e('0x23')];_0x3f3658[_0x152e('0x3e')][_0x1f32d7]['on'](_0x152e('0x3f'),function(){logger['info'](_0x152e('0x40'),_0x1f32d7);stopRouting(_0x1f32d7,_0x226206,_0x40eadb,_0x3f3658);clearTimeout(_0x42271d);_0x42271d=undefined;_0x37bb14[_0x152e('0x41')](!![]);if(_0x3f3658[_0x152e('0x3e')][_0x1f32d7]){delete _0x3f3658[_0x152e('0x3e')][_0x1f32d7];}_0x254d05[_0x152e('0x42')]();});_0x3f3658[_0x152e('0x3e')][_0x1f32d7]['on'](_0x152e('0x43'),function(){if(_0x3f3658[_0x152e('0x3e')][_0x1f32d7]){delete _0x3f3658[_0x152e('0x3e')][_0x1f32d7];}});_0x42271d=setTimeout(function(){logger['info'](_0x152e('0x44'),_0x1f32d7);endRouting(_0x1f32d7,_0x226206,_0x40eadb,_0x3f3658);clearTimeout(_0x42271d);_0x37bb14[_0x152e('0x41')](!![]);_0x254d05['next']();},_0x5b3fdf);switch(_0x226206[_0x152e('0x45')]){case _0x152e('0x46'):strategy['rrmemory'](_0x37bb14,_0x226206,_0x3f3658,_0x40eadb);break;default:strategy['beepall'](_0x37bb14,_0x226206,_0x3f3658,_0x40eadb);}}else{logger[_0x152e('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1f32d7,_0x4016ff['name']);_0x254d05[_0x152e('0x42')]();}}}catch(_0x38c8b6){console[_0x152e('0x47')](_0x38c8b6);logger[_0x152e('0x30')](_0x152e('0x38'),_0x1f32d7,_0x38c8b6[_0x152e('0x48')]);_0x254d05[_0x152e('0x42')]();}};}; \ 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 87d950a..578821b 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 _0xd902=['info','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','lodash','uuid','./util','routing','notificationId','agent','realtime','handleRun','bind','handleTimeout','squeue','drained','handleDrained','prototype','push','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0xd902,0x153));var _0x2d90=function(_0x2c5ec9,_0x4d69fe){_0x2c5ec9=_0x2c5ec9-0x0;var _0x460637=_0xd902[_0x2c5ec9];return _0x460637;};'use strict';var _=require(_0x2d90('0x0'));var uuid=require(_0x2d90('0x1'));var util=require(_0x2d90('0x2'));var logger=require('../../../../../config/logger')(_0x2d90('0x3'));var Agent=function(_0x52fca5,_0x1c59b2,_0x445af9,_0x26bbf3){this[_0x2d90('0x4')]=uuid['v4']();this['squeue']=_0x52fca5;this[_0x2d90('0x5')]=_0x1c59b2;this[_0x2d90('0x6')]=_0x445af9;this[_0x2d90('0x3')]=_0x26bbf3;this['squeue']['push'](this[_0x2d90('0x7')][_0x2d90('0x8')](this),this[_0x2d90('0x9')]['bind'](this));this[_0x2d90('0xa')]['on']('timeout',this[_0x2d90('0x9')][_0x2d90('0x8')](this));this[_0x2d90('0xa')]['on'](_0x2d90('0xb'),this[_0x2d90('0xc')][_0x2d90('0x8')](this));};Agent[_0x2d90('0xd')][_0x2d90('0xe')]=function(){this[_0x2d90('0xa')][_0x2d90('0xe')](this[_0x2d90('0x7')]['bind'](this),this[_0x2d90('0x9')][_0x2d90('0x8')](this));};Agent[_0x2d90('0xd')]['handleDrained']=function(){this[_0x2d90('0x9')](!![]);};Agent[_0x2d90('0xd')][_0x2d90('0x7')]=function(_0x3fe1cb){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x2d90('0xa')]['id'],this[_0x2d90('0x5')]['id']);if(_[_0x2d90('0xf')](this[_0x2d90('0x6')][_0x2d90('0x10')][this['agent']['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x2d90('0x5')]['id']);setTimeout(this[_0x2d90('0xe')][_0x2d90('0x8')](this),0x3e8);}else{if(this[_0x2d90('0x3')][_0x2d90('0x11')]||util[_0x2d90('0x12')](this[_0x2d90('0xa')]['id'],this['realtime']['agents'][this[_0x2d90('0x5')]['id']],this['squeue'][_0x2d90('0x13')],![])){this['realtime'][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']][_0x2d90('0x14')]=!![];this[_0x2d90('0x6')][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x2d90('0x4')],this[_0x2d90('0xa')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x2d90('0x3')]);util[_0x2d90('0x15')](this[_0x2d90('0xa')]['id'],this[_0x2d90('0x6')][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']],_0x2d90('0x16')+(this[_0x2d90('0x3')][_0x2d90('0x11')]?_0x2d90('0x17'):''));}else{logger['info'](_0x2d90('0x18'),this[_0x2d90('0xa')]['id'],this[_0x2d90('0x5')]['id']);setTimeout(this[_0x2d90('0xe')][_0x2d90('0x8')](this),0x3e8);}}};Agent[_0x2d90('0xd')][_0x2d90('0x9')]=function(_0x537932){if(_[_0x2d90('0xf')](this['realtime']['agents'][this[_0x2d90('0x5')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x2d90('0xa')]['id'],this[_0x2d90('0x5')]['id']);}else{logger[_0x2d90('0x19')](_0x2d90('0x1a'),this[_0x2d90('0xa')]['id'],this['agent']['id']);util[_0x2d90('0x1b')](this['notificationId'],this[_0x2d90('0xa')]['id'],this[_0x2d90('0x6')]['agents'][this[_0x2d90('0x5')]['id']],null,this[_0x2d90('0x3')]);this['realtime']['agents'][this[_0x2d90('0x5')]['id']][_0x2d90('0x14')]=![];this[_0x2d90('0x6')][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']]['busyQueue']=undefined;util[_0x2d90('0x15')](this[_0x2d90('0xa')]['id'],this['realtime'][_0x2d90('0x10')][this[_0x2d90('0x5')]['id']],_0x537932?'STOP':'TIMEOUT');}if(!_0x537932){setTimeout(this[_0x2d90('0xe')][_0x2d90('0x8')](this),0x3e8);}};function agent(_0x5041a2,_0x30db7a,_0x3f5dad,_0x2538c6){return new Agent(_0x5041a2,_0x30db7a,_0x3f5dad,_0x2538c6);}module['exports']=agent; \ No newline at end of file +var _0xfcd5=['channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','exports','uuid','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','bind','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xfcd5,0x7f));var _0x5fcd=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xfcd5[_0xb833b1];return _0x1ab87a;};'use strict';var _=require('lodash');var uuid=require(_0x5fcd('0x0'));var util=require('./util');var logger=require(_0x5fcd('0x1'))(_0x5fcd('0x2'));var Agent=function(_0x381044,_0x4c92bc,_0x29af6a,_0x33c7bc){this['notificationId']=uuid['v4']();this[_0x5fcd('0x3')]=_0x381044;this[_0x5fcd('0x4')]=_0x4c92bc;this[_0x5fcd('0x5')]=_0x29af6a;this[_0x5fcd('0x2')]=_0x33c7bc;this[_0x5fcd('0x3')][_0x5fcd('0x6')](this[_0x5fcd('0x7')]['bind'](this),this[_0x5fcd('0x8')][_0x5fcd('0x9')](this));this[_0x5fcd('0x3')]['on']('timeout',this[_0x5fcd('0x8')]['bind'](this));this['squeue']['on']('drained',this[_0x5fcd('0xa')][_0x5fcd('0x9')](this));};Agent[_0x5fcd('0xb')][_0x5fcd('0x6')]=function(){this[_0x5fcd('0x3')]['push'](this['handleRun'][_0x5fcd('0x9')](this),this[_0x5fcd('0x8')][_0x5fcd('0x9')](this));};Agent[_0x5fcd('0xb')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x5fcd('0x7')]=function(_0x5395a7){logger['info'](_0x5fcd('0xc'),this[_0x5fcd('0x3')]['id'],this[_0x5fcd('0x4')]['id']);if(_[_0x5fcd('0xd')](this['realtime'][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']])){logger[_0x5fcd('0xf')](_0x5fcd('0x10'),this['squeue']['id'],this[_0x5fcd('0x4')]['id']);setTimeout(this[_0x5fcd('0x6')][_0x5fcd('0x9')](this),0x3e8);}else{if(this[_0x5fcd('0x2')][_0x5fcd('0x11')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']],this[_0x5fcd('0x3')][_0x5fcd('0x12')],![])){this[_0x5fcd('0x5')][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']][_0x5fcd('0x13')]=!![];this[_0x5fcd('0x5')]['agents'][this['agent']['id']][_0x5fcd('0x14')]=undefined;util[_0x5fcd('0x15')](this[_0x5fcd('0x16')],this['squeue']['id'],this[_0x5fcd('0x5')][_0x5fcd('0xe')][this['agent']['id']],null,this[_0x5fcd('0x2')]);util[_0x5fcd('0x17')](this[_0x5fcd('0x3')]['id'],this['realtime'][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']],_0x5fcd('0x18')+(this[_0x5fcd('0x2')]['forcedOwnership']?':FORCED':''));}else{logger['info'](_0x5fcd('0x19'),this[_0x5fcd('0x3')]['id'],this['agent']['id']);setTimeout(this['push'][_0x5fcd('0x9')](this),0x3e8);}}};Agent['prototype'][_0x5fcd('0x8')]=function(_0x48c54f){if(_['isNil'](this[_0x5fcd('0x5')][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']])){return logger[_0x5fcd('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x5fcd('0x4')]['id']);}else{logger[_0x5fcd('0xf')](_0x5fcd('0x1a'),this[_0x5fcd('0x3')]['id'],this[_0x5fcd('0x4')]['id']);util[_0x5fcd('0x1b')](this[_0x5fcd('0x16')],this[_0x5fcd('0x3')]['id'],this[_0x5fcd('0x5')]['agents'][this['agent']['id']],null,this[_0x5fcd('0x2')]);this[_0x5fcd('0x5')]['agents'][this['agent']['id']][_0x5fcd('0x13')]=![];this[_0x5fcd('0x5')][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']]['busyQueue']=undefined;util[_0x5fcd('0x17')](this[_0x5fcd('0x3')]['id'],this[_0x5fcd('0x5')][_0x5fcd('0xe')][this[_0x5fcd('0x4')]['id']],_0x48c54f?'STOP':'TIMEOUT');}if(!_0x48c54f){setTimeout(this[_0x5fcd('0x6')]['bind'](this),0x3e8);}};function agent(_0x125e6a,_0x5acc9f,_0x20a750,_0xeccf3d){return new Agent(_0x125e6a,_0x5acc9f,_0x20a750,_0xeccf3d);}module[_0x5fcd('0x1c')]=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 2097903..b46e865 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 _0xec46=['squeue','queue','routing','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','busy','busyQueue','showNotification','info','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger'];(function(_0x13c19c,_0x1d4a84){var _0x594ee4=function(_0x326bb8){while(--_0x326bb8){_0x13c19c['push'](_0x13c19c['shift']());}};_0x594ee4(++_0x1d4a84);}(_0xec46,0x19c));var _0x6ec4=function(_0x273305,_0x57815f){_0x273305=_0x273305-0x0;var _0x12cf22=_0xec46[_0x273305];return _0x12cf22;};'use strict';var _=require(_0x6ec4('0x0'));var uuid=require(_0x6ec4('0x1'));var util=require(_0x6ec4('0x2'));var logger=require(_0x6ec4('0x3'))('routing');var Beepall=function(_0x5052d2,_0x307c5c,_0x157723,_0x86b9f8){this['notificationId']=uuid['v4']();this[_0x6ec4('0x4')]=_0x5052d2;this[_0x6ec4('0x5')]=_0x307c5c;this['realtime']=_0x157723;this[_0x6ec4('0x6')]=_0x86b9f8;this['squeue'][_0x6ec4('0x7')](this[_0x6ec4('0x8')][_0x6ec4('0x9')](this),this[_0x6ec4('0xa')][_0x6ec4('0x9')](this));this[_0x6ec4('0x4')]['on'](_0x6ec4('0xb'),this[_0x6ec4('0xa')][_0x6ec4('0x9')](this));this[_0x6ec4('0x4')]['on'](_0x6ec4('0xc'),this['handleDrained']['bind'](this));};Beepall[_0x6ec4('0xd')][_0x6ec4('0x7')]=function(){this[_0x6ec4('0x4')]['push'](this[_0x6ec4('0x8')]['bind'](this),this[_0x6ec4('0xa')]['bind'](this));};Beepall[_0x6ec4('0xd')][_0x6ec4('0xe')]=function(_0x44030f){this[_0x6ec4('0xa')](!![]);};Beepall[_0x6ec4('0xd')]['handleRun']=function(_0x472907){var _0x3368e9=!![];if(!_[_0x6ec4('0xf')](this[_0x6ec4('0x5')])&&!_[_0x6ec4('0xf')](this[_0x6ec4('0x5')][_0x6ec4('0x10')])&&this[_0x6ec4('0x5')][_0x6ec4('0x10')][_0x6ec4('0x11')]>0x0){for(var _0x1b7c00=0x0,_0x57825d;_0x1b7c000x0){for(var _0x35b790=0x0,_0x50cd9f;_0x35b7900x0&&_0x5c4deb[_0x28968e+_0x432f('0x26')]>=_0x5c4deb[_0x28968e+_0x432f('0x24')]){writeLog(_0x343d13,_0x5c4deb,_0x28968e[_0x432f('0x27')]()+_0x432f('0x28'));return![];}}return!![];};exports[_0x432f('0x29')]=function(_0x138a6a,_0x5a3d18,_0x294bfe,_0x4eeae1,_0x1f1fdd){return sendNotification(!![],_0x138a6a,_0x5a3d18,_0x294bfe,_0x4eeae1,_0x1f1fdd);};exports['hideNotification']=function(_0x20404d,_0x5a2c14,_0x3f768b,_0x489ba6,_0x325a9c){return sendNotification(![],_0x20404d,_0x5a2c14,_0x3f768b,_0x489ba6,_0x325a9c);};exports[_0x432f('0x2a')]=writeLog; \ No newline at end of file +var _0xacf4=['body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','emit','format','name','\x20interaction','account','notificationSound','notificationShake'];(function(_0x10d6c8,_0x5858b3){var _0x46934b=function(_0x4c50dc){while(--_0x4c50dc){_0x10d6c8['push'](_0x10d6c8['shift']());}};_0x46934b(++_0x5858b3);}(_0xacf4,0xe7));var _0x4acf=function(_0x5ba802,_0x34a96a){_0x5ba802=_0x5ba802-0x0;var _0x30866e=_0xacf4[_0x5ba802];return _0x30866e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x4acf('0x0'));var Mustache=require(_0x4acf('0x1'));var Redis=require(_0x4acf('0x2'));var config=require(_0x4acf('0x3'));var logger=require(_0x4acf('0x4'))(_0x4acf('0x5'));config[_0x4acf('0x6')]=_['defaults'](config[_0x4acf('0x6')],{'host':_0x4acf('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4acf('0x6')]));function emit(_0x2ba08a,_0x649ad2,_0x45a5a4){io['to'](_0x2ba08a)[_0x4acf('0x8')](_0x649ad2,_0x45a5a4);}function sendNotification(_0x50f5f4,_0x55f61d,_0x41970b,_0x59f559,_0x425c8d,_0x2c2cb4){io['to'](util[_0x4acf('0x9')]('user:%s',_0x59f559[_0x4acf('0xa')]))[_0x4acf('0x8')]('user:save',_0x59f559);var _0x5f22d9=_0x2c2cb4||{};var _0x1fe474=_0x41970b['split']('.');var _0x5bca4e={'uniqueid':_0x55f61d,'channel':_0x1fe474[0x0],'id':_0x1fe474[0x1],'title':_0x1fe474[0x0]+_0x4acf('0xb'),'interactionId':_0x1fe474[0x2],'queue':_0x425c8d?_0x425c8d[_0x4acf('0xa')]:null,'sound':_0x5f22d9[_0x4acf('0xc')][_0x4acf('0xd')],'shake':_0x5f22d9[_0x4acf('0xc')][_0x4acf('0xe')]};try{if(!_0x5f22d9[_0x4acf('0xf')]){_0x5f22d9[_0x4acf('0xf')]={};}if(_0x425c8d){_0x5f22d9[_0x4acf('0xf')][_0x4acf('0x10')]=_0x425c8d;}else if(_0x5f22d9[_0x4acf('0xf')]['queue']){delete _0x5f22d9[_0x4acf('0xf')]['queue'];}_0x5bca4e[_0x4acf('0x11')]=utils[_0x4acf('0x12')](_0x5f22d9[_0x4acf('0xc')]['notificationTemplate'],_0x5f22d9);}catch(_0x5207e7){_0x5bca4e[_0x4acf('0x11')]=_0x4acf('0x13');logger[_0x4acf('0x14')](util['format'](_0x4acf('0x15'),_0x55f61d,_0x5207e7[_0x4acf('0x16')]));}io['to'](util[_0x4acf('0x9')](_0x4acf('0x17'),_0x59f559[_0x4acf('0xa')]))[_0x4acf('0x8')](util[_0x4acf('0x9')](_0x4acf('0x18'),_0x50f5f4?_0x4acf('0x19'):_0x4acf('0x1a')),_0x5bca4e);}function writeLog(_0x1a3118,_0x5f0284,_0x28d698){return logger[_0x4acf('0x1b')](util['format'](_0x4acf('0x1c'),_0x1a3118,_0x5f0284[_0x4acf('0xa')],_0x28d698));}exports['isAgentAvailable']=function(_0x3b26ac,_0x34d154,_0x433b7a,_0x454555){if(_0x34d154['busy']){writeLog(_0x3b26ac,_0x34d154,_0x4acf('0x1d'));return![];}if(!_0x34d154[_0x4acf('0x1e')]){writeLog(_0x3b26ac,_0x34d154,'OFFLINE');return![];}if(_0x34d154[_0x433b7a+_0x4acf('0x1f')]){writeLog(_0x3b26ac,_0x34d154,_0x4acf('0x20'));return![];}if(_0x454555&&_0x34d154['hasOwnProperty'](_0x433b7a+_0x4acf('0x21'))&&_0x34d154[_0x4acf('0x22')](_0x433b7a+_0x4acf('0x23'))){if(_0x34d154[_0x433b7a+_0x4acf('0x21')]>0x0&&_0x34d154[_0x433b7a+'CurrentCapacity']>=_0x34d154[_0x433b7a+'Capacity']){writeLog(_0x3b26ac,_0x34d154,_0x433b7a[_0x4acf('0x24')]()+_0x4acf('0x25'));return![];}}return!![];};exports[_0x4acf('0x26')]=function(_0x42c90c,_0x14086c,_0x1b4da6,_0xb83274,_0x7a1e79){return sendNotification(!![],_0x42c90c,_0x14086c,_0x1b4da6,_0xb83274,_0x7a1e79);};exports[_0x4acf('0x27')]=function(_0x2a3830,_0x57989e,_0x3521c2,_0x3f5614,_0xd027c7){return sendNotification(![],_0x2a3830,_0x57989e,_0x3521c2,_0x3f5614,_0xd027c7);};exports[_0x4acf('0x28')]=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 f5ec11c..68aa41d 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 _0x66cd=['replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim'];(function(_0x54b011,_0x29963b){var _0x630659=function(_0x34cff3){while(--_0x34cff3){_0x54b011['push'](_0x54b011['shift']());}};_0x630659(++_0x29963b);}(_0x66cd,0xa4));var _0xd66c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x66cd[_0x432682];return _0x463d05;};'use strict';var schema=require(_0xd66c('0x0'));var sh=require(_0xd66c('0x1'));var _=require(_0xd66c('0x2'));var utils=require(_0xd66c('0x3'));var logger=require('../../../../config/logger')(_0xd66c('0x4'));var system=schema({'command':{'type':_0xd66c('0x5'),'required':!![],'message':_0xd66c('0x6')}});exports[_0xd66c('0x7')]=function(_0x20903e,_0x58116b){return function(_0x19c213){try{var _0x43b318={'command':_0x58116b[0x0]};var _0x142583=system['validate'](_0x43b318,{'typecast':!![]});if(_0x142583[_0xd66c('0x8')]){logger['error'](_0xd66c('0x9'),_0x20903e,_['map'](_0x142583,_0xd66c('0xa'))[_0xd66c('0xb')](',\x20'));logger[_0xd66c('0xc')](_0xd66c('0xd'),_0x20903e);_0x19c213[_0xd66c('0xe')]();}else{var _0x4cd181=this;var _0xc0e9a7=utils[_0xd66c('0xf')](_0x58116b[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x20903e,_0xc0e9a7);sh[_0xd66c('0x10')](_[_0xd66c('0x11')](_0xc0e9a7),function(_0x780f42,_0x569dd1){logger[_0xd66c('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x20903e,_0x780f42);if(_0x780f42==0x0){var _0x5bb143=_0x569dd1[_0xd66c('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xd66c('0x13')](_0x58116b[0x1])||_['isEmpty'](_0x58116b[0x1])){logger[_0xd66c('0xc')](_0xd66c('0x14'),_0x20903e);_0x4cd181[_0xd66c('0x15')][_0x58116b[0x1]]=_0x5bb143;}else{logger['info'](_0xd66c('0x16'),_0x20903e,_0x58116b[0x1],_0x5bb143);_0x4cd181['body'][_0x58116b[0x1]]=_0x5bb143;}}_0x19c213['next']();});}}catch(_0x14765a){logger[_0xd66c('0x17')](_0xd66c('0x9'),_0x20903e,_[_0xd66c('0x18')](_0x14765a)?JSON[_0xd66c('0x19')](_0x14765a):_0x14765a);logger[_0xd66c('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x20903e);_0x19c213['next']();}};}; \ No newline at end of file +var _0x36da=['lodash','./utils','../../../../config/logger','routing','string','consequence','validate','length','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','shelljs'];(function(_0x8146b9,_0x584040){var _0x2208c8=function(_0x591541){while(--_0x591541){_0x8146b9['push'](_0x8146b9['shift']());}};_0x2208c8(++_0x584040);}(_0x36da,0xd7));var _0xa36d=function(_0x38e5f0,_0x4fedd8){_0x38e5f0=_0x38e5f0-0x0;var _0x5b08dc=_0x36da[_0x38e5f0];return _0x5b08dc;};'use strict';var schema=require('validate');var sh=require(_0xa36d('0x0'));var _=require(_0xa36d('0x1'));var utils=require(_0xa36d('0x2'));var logger=require(_0xa36d('0x3'))(_0xa36d('0x4'));var system=schema({'command':{'type':_0xa36d('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa36d('0x6')]=function(_0x1ba311,_0x45973e){return function(_0x203abe){try{var _0x2fafad={'command':_0x45973e[0x0]};var _0x1af58d=system[_0xa36d('0x7')](_0x2fafad,{'typecast':!![]});if(_0x1af58d[_0xa36d('0x8')]){logger['error'](_0xa36d('0x9'),_0x1ba311,_[_0xa36d('0xa')](_0x1af58d,_0xa36d('0xb'))['join'](',\x20'));logger[_0xa36d('0xc')](_0xa36d('0xd'),_0x1ba311);_0x203abe[_0xa36d('0xe')]();}else{var _0x32ae43=this;var _0x3d0097=utils[_0xa36d('0xf')](_0x45973e[0x0],this);logger['info'](_0xa36d('0x10'),_0x1ba311,_0x3d0097);sh[_0xa36d('0x11')](_[_0xa36d('0x12')](_0x3d0097),function(_0x4db8e9,_0x55fe18){logger[_0xa36d('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1ba311,_0x4db8e9);if(_0x4db8e9==0x0){var _0x5c23a3=_0x55fe18[_0xa36d('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xa36d('0x14')](_0x45973e[0x1])||_['isEmpty'](_0x45973e[0x1])){logger[_0xa36d('0xc')](_0xa36d('0x15'),_0x1ba311);_0x32ae43[_0xa36d('0x16')][_0x45973e[0x1]]=_0x5c23a3;}else{logger['info'](_0xa36d('0x17'),_0x1ba311,_0x45973e[0x1],_0x5c23a3);_0x32ae43['body'][_0x45973e[0x1]]=_0x5c23a3;}}_0x203abe[_0xa36d('0xe')]();});}}catch(_0x2a514c){logger[_0xa36d('0x18')](_0xa36d('0x9'),_0x1ba311,_[_0xa36d('0x19')](_0x2a514c)?JSON[_0xa36d('0x1a')](_0x2a514c):_0x2a514c);logger[_0xa36d('0xc')](_0xa36d('0xd'),_0x1ba311);_0x203abe[_0xa36d('0xe')]();}};}; \ 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 1b4447d..e215f7e 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 _0xa05f=['number','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','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa05f,0x106));var _0xfa05=function(_0x565b76,_0x1d150b){_0x565b76=_0x565b76-0x0;var _0x80f363=_0xa05f[_0x565b76];return _0x80f363;};'use strict';var schema=require(_0xfa05('0x0'));var _=require(_0xfa05('0x1'));var rpc={'chatInteraction':require(_0xfa05('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xfa05('0x3')),'mailInteraction':require(_0xfa05('0x4')),'faxInteraction':require(_0xfa05('0x5')),'whatsappInteraction':require(_0xfa05('0x6'))};var logger=require('../../../../config/logger')(_0xfa05('0x7'));var tag=schema({'tag':{'type':_0xfa05('0x8'),'required':!![],'message':_0xfa05('0x9')}});exports[_0xfa05('0xa')]=function(_0xd78aff,_0x3c6920,_0x2e504d,_0x259c3f){return function(_0x2cac9b){try{var _0x49e1f3={'tag':_0x3c6920[0x0]};var _0x44420a=tag[_0xfa05('0x0')](_0x49e1f3,{'typecast':!![]});if(_0x44420a[_0xfa05('0xb')]){logger['error'](_0xfa05('0xc'),_0xd78aff,_[_0xfa05('0xd')](_0x44420a,_0xfa05('0xe'))[_0xfa05('0xf')](',\x20'));logger[_0xfa05('0x10')](_0xfa05('0x11'),_0xd78aff);_0x2cac9b[_0xfa05('0x12')]();}else{var _0x1d7ab7={'ids':[_0x3c6920[0x0]]};if(rpc[_0x259c3f[_0xfa05('0x13')]+_0xfa05('0x14')]){rpc[_0x259c3f[_0xfa05('0x13')]+_0xfa05('0x14')][_0xfa05('0x15')](_0x259c3f[_0xfa05('0x16')]['id'],_0x1d7ab7)[_0xfa05('0x17')](function(_0x3db5be){logger['info'](_0xfa05('0x18'),_0xd78aff,_0x3c6920[0x1],_0x259c3f[_0xfa05('0x13')],_0x259c3f[_0xfa05('0x16')]['id']);})[_0xfa05('0x19')](function(_0x2a1a81){logger[_0xfa05('0x1a')](_0xfa05('0xc'),_0xd78aff,JSON[_0xfa05('0x1b')](_0x2a1a81));logger[_0xfa05('0x10')](_0xfa05('0x11'),_0xd78aff);})[_0xfa05('0x1c')](function(){_0x2cac9b[_0xfa05('0x12')]();});}}}catch(_0x38febd){logger[_0xfa05('0x1a')]('[%s][TAG]\x20%s',_0xd78aff,_[_0xfa05('0x1d')](_0x38febd)?JSON['stringify'](_0x38febd):_0x38febd);logger[_0xfa05('0x10')](_0xfa05('0x11'),_0xd78aff);_0x2cac9b['next']();}};}; \ No newline at end of file +var _0xcce4=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','addTags','then','catch','error','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcce4,0x1c3));var _0x4cce=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xcce4[_0x171fdc];return _0x3782ea;};'use strict';var schema=require(_0x4cce('0x0'));var _=require(_0x4cce('0x1'));var rpc={'chatInteraction':require(_0x4cce('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x4cce('0x3')),'mailInteraction':require(_0x4cce('0x4')),'faxInteraction':require(_0x4cce('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x4cce('0x6'))(_0x4cce('0x7'));var tag=schema({'tag':{'type':_0x4cce('0x8'),'required':!![],'message':_0x4cce('0x9')}});exports['consequence']=function(_0x58ca93,_0x4f4545,_0x489a9e,_0x257295){return function(_0x3a907a){try{var _0x4593b1={'tag':_0x4f4545[0x0]};var _0x59cc50=tag[_0x4cce('0x0')](_0x4593b1,{'typecast':!![]});if(_0x59cc50['length']){logger['error'](_0x4cce('0xa'),_0x58ca93,_[_0x4cce('0xb')](_0x59cc50,_0x4cce('0xc'))[_0x4cce('0xd')](',\x20'));logger[_0x4cce('0xe')](_0x4cce('0xf'),_0x58ca93);_0x3a907a['next']();}else{var _0x13d67e={'ids':[_0x4f4545[0x0]]};if(rpc[_0x257295[_0x4cce('0x10')]+'Interaction']){rpc[_0x257295[_0x4cce('0x10')]+'Interaction'][_0x4cce('0x11')](_0x257295['interaction']['id'],_0x13d67e)[_0x4cce('0x12')](function(_0x27019b){logger[_0x4cce('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x58ca93,_0x4f4545[0x1],_0x257295[_0x4cce('0x10')],_0x257295['interaction']['id']);})[_0x4cce('0x13')](function(_0x12abac){logger[_0x4cce('0x14')](_0x4cce('0xa'),_0x58ca93,JSON['stringify'](_0x12abac));logger[_0x4cce('0xe')](_0x4cce('0xf'),_0x58ca93);})['finally'](function(){_0x3a907a[_0x4cce('0x15')]();});}}}catch(_0x1dd147){logger[_0x4cce('0x14')](_0x4cce('0xa'),_0x58ca93,_[_0x4cce('0x16')](_0x1dd147)?JSON['stringify'](_0x1dd147):_0x1dd147);logger[_0x4cce('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x58ca93);_0x3a907a[_0x4cce('0x15')]();}};}; \ 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 87507b9..6c6bdce 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 _0x619d=['info','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','params','stringify','utf8','application/json-rpc','then','parse','result','channelId=','&serviceId=','&sessionId=','&data='];(function(_0x342bf3,_0x1f18cc){var _0x1baa7a=function(_0x4ef8c3){while(--_0x4ef8c3){_0x342bf3['push'](_0x342bf3['shift']());}};_0x1baa7a(++_0x1f18cc);}(_0x619d,0x133));var _0xd619=function(_0x36c173,_0x4f0212){_0x36c173=_0x36c173-0x0;var _0x51a580=_0x619d[_0x36c173];return _0x51a580;};'use strict';var rp=require('request-promise');var logger=require(_0xd619('0x0'))('routing');var _=require(_0xd619('0x1'));var arr=[];exports['consequence']=function(_0x4ad0d2,_0x87c143){return function(_0x267fc9){var _0x5c078a=_0x87c143[0xa];var _0x52db06=_0x87c143[0xb];var _0x38f24f=_0x87c143[0xc];var _0x34608f=_0x87c143[0xd];var _0x1c2aac=_0x87c143[0xe];var _0xaf17cb=_0x87c143[0xf][_0xd619('0x2')](/\n/g,_0xd619('0x3'));var _0x44198f=_0x87c143[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xd619('0x4')](_0x52db06)){arr[_0xd619('0x5')](_0x52db06);var _0x2f9a35=_0x87c143[0x3];var _0x5357a8=_0x87c143[0x4];var _0x463b82=_0x87c143[0x1];var _0x5b7b02=_0x87c143[0x0];var _0x46c4c8={};_0x46c4c8[_0xd619('0x6')]=_0x87c143[0x8]+_0xd619('0x7')+_0x38f24f+'|'+_0x5c078a+'|'+_0x34608f+'|'+_0x52db06+'|'+_0x1c2aac;_0x46c4c8[_0xd619('0x8')]=_0x87c143[0x7]+'?params='+_0x38f24f+'|'+_0x5c078a+'|'+_0x34608f+'|'+_0x52db06+'|'+_0x1c2aac+'|'+_0xaf17cb+'|'+_0x44198f;_0x46c4c8['title']=_0x87c143[0x9];var _0x3b5378={};_0x3b5378[_0xd619('0x9')]=_0xd619('0xa');_0x3b5378[_0xd619('0xb')]='login';var _0x3cce7c=[];_0x3cce7c[_0xd619('0x5')](_0x87c143[0x2]);_0x3cce7c['push'](_0x87c143[0x5]);_0x3cce7c['push'](_0x87c143[0x6]);_0x3b5378[_0xd619('0xc')]=_0x3cce7c;_0x3b5378['id']=0x1;var _0x1cebc5=JSON[_0xd619('0xd')](_0x3b5378);var _0xa9ff5e={'encoding':_0xd619('0xe'),'method':'POST','timeout':0x2710,'url':_0x2f9a35,'headers':{'Content-Type':_0xd619('0xf')},'body':_0x1cebc5};return rp(_0xa9ff5e)[_0xd619('0x10')](function(_0x4cd9f0){const _0x240b3b=JSON[_0xd619('0x11')](_0x4cd9f0);if(!_0x240b3b[_0xd619('0x12')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x8a3879=_0x52db06;var _0x5aabd8=_0xd619('0x13')+_0x463b82+_0xd619('0x14')+_0x5b7b02+_0xd619('0x15')+_0x8a3879+_0xd619('0x16')+JSON['stringify'](_0x46c4c8);var _0xe7cc5b=_0x5357a8+'?'+_0x5aabd8;return rp(_0xe7cc5b);})[_0xd619('0x10')](function(_0x3a7fe1){logger[_0xd619('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4ad0d2,_0x3a7fe1);_0x267fc9[_0xd619('0x18')]();})[_0xd619('0x19')](function(_0x3f75ab){logger[_0xd619('0x1a')](_0xd619('0x1b'),_0x4ad0d2,_['isObject'](_0x3f75ab)?JSON['stringify'](_0x3f75ab):_0x3f75ab);_0x267fc9[_0xd619('0x18')]();});}else{logger[_0xd619('0x17')](_0xd619('0x1c'),_0x4ad0d2);_0x267fc9[_0xd619('0x1d')]();}};}; \ No newline at end of file +var _0x387d=['urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','stringify','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','stop','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','replace','\x20-\x20','includes','push'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x387d,0xc5));var _0xd387=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x387d[_0x17d9e3];return _0x14192d;};'use strict';var rp=require(_0xd387('0x0'));var logger=require(_0xd387('0x1'))('routing');var _=require('lodash');var arr=[];exports['consequence']=function(_0x436b62,_0x145ea7){return function(_0x442217){var _0x4cff5b=_0x145ea7[0xa];var _0x493736=_0x145ea7[0xb];var _0x18efe8=_0x145ea7[0xc];var _0x334184=_0x145ea7[0xd];var _0x5d9e6c=_0x145ea7[0xe];var _0x2339de=_0x145ea7[0xf][_0xd387('0x2')](/\n/g,_0xd387('0x3'));var _0x11a697=_0x145ea7[0x10][_0xd387('0x2')](/\n/g,'\x20');if(!arr[_0xd387('0x4')](_0x493736)){arr[_0xd387('0x5')](_0x493736);var _0x49900c=_0x145ea7[0x3];var _0x3f2d65=_0x145ea7[0x4];var _0x595865=_0x145ea7[0x1];var _0x34bdf4=_0x145ea7[0x0];var _0x30a39b={};_0x30a39b[_0xd387('0x6')]=_0x145ea7[0x8]+_0xd387('0x7')+_0x18efe8+'|'+_0x4cff5b+'|'+_0x334184+'|'+_0x493736+'|'+_0x5d9e6c;_0x30a39b[_0xd387('0x8')]=_0x145ea7[0x7]+_0xd387('0x7')+_0x18efe8+'|'+_0x4cff5b+'|'+_0x334184+'|'+_0x493736+'|'+_0x5d9e6c+'|'+_0x2339de+'|'+_0x11a697;_0x30a39b[_0xd387('0x9')]=_0x145ea7[0x9];var _0x10a326={};_0x10a326[_0xd387('0xa')]=_0xd387('0xb');_0x10a326[_0xd387('0xc')]='login';var _0x501efc=[];_0x501efc['push'](_0x145ea7[0x2]);_0x501efc[_0xd387('0x5')](_0x145ea7[0x5]);_0x501efc[_0xd387('0x5')](_0x145ea7[0x6]);_0x10a326['params']=_0x501efc;_0x10a326['id']=0x1;var _0x249840=JSON[_0xd387('0xd')](_0x10a326);var _0x166150={'encoding':_0xd387('0xe'),'method':_0xd387('0xf'),'timeout':0x2710,'url':_0x49900c,'headers':{'Content-Type':_0xd387('0x10')},'body':_0x249840};return rp(_0x166150)[_0xd387('0x11')](function(_0x49d374){const _0x101a6c=JSON['parse'](_0x49d374);if(!_0x101a6c[_0xd387('0x12')][_0xd387('0x13')]){throw new Error(_0xd387('0x14'));}var _0x1dfec3=_0x493736;var _0x3325b5=_0xd387('0x15')+_0x595865+_0xd387('0x16')+_0x34bdf4+'&sessionId='+_0x1dfec3+_0xd387('0x17')+JSON[_0xd387('0xd')](_0x30a39b);var _0x3325d1=_0x3f2d65+'?'+_0x3325b5;return rp(_0x3325d1);})[_0xd387('0x11')](function(_0x4c5fd6){logger[_0xd387('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x436b62,_0x4c5fd6);_0x442217[_0xd387('0x19')]();})['catch'](function(_0x1fe1ec){logger['error'](_0xd387('0x1a'),_0x436b62,_[_0xd387('0x1b')](_0x1fe1ec)?JSON[_0xd387('0xd')](_0x1fe1ec):_0x1fe1ec);_0x442217[_0xd387('0x19')]();});}else{logger[_0xd387('0x18')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x436b62);_0x442217[_0xd387('0x1c')]();}};}; \ 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 486eb03..c774fd3 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 _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x4b778b,_0x4cf753){var _0x1c7151=function(_0x47be9b){while(--_0x47be9b){_0x4b778b['push'](_0x4b778b['shift']());}};_0x1c7151(++_0x4cf753);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x575637,_0x145780){var _0x203d00=function(_0x23a65b){while(--_0x23a65b){_0x575637['push'](_0x575637['shift']());}};_0x203d00(++_0x145780);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 562179f..2cfa27d 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 _0xc788=['../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','map','interval','listen','rules','channel','message','interaction','isArray','length','applications','join','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','app','./interval','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','error','stack','routing\x20is\x20empty','agent','busy','agents','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','uuid','./applications/utils','../../../config/environment'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc788,0xc4));var _0x8c78=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0xc788[_0x515283];return _0x38f836;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x8c78('0x3'));var utils=require(_0x8c78('0x4'));var config=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x8c78('0x8')),'chatQueueReport':require(_0x8c78('0x9')),'smsQueueReport':require(_0x8c78('0xa')),'faxQueueReport':require(_0x8c78('0xb')),'whatsappQueueReport':require(_0x8c78('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x247188,_0x299d9d,_0x9bc075){return util[_0x8c78('0xd')](_0x8c78('0xe'),_0x247188,_0x299d9d||0x0,_0x9bc075||0x0);}function getIntervals(_0x39e116,_0x4f3e43){var _0x13db9c=[];if(!_['isNil'](_0x4f3e43[_0x8c78('0xf')])&&!_[_0x8c78('0x10')](_0x39e116[_0x4f3e43['IntervalId']])&&!_[_0x8c78('0x10')](_0x39e116[_0x4f3e43[_0x8c78('0xf')]]['Intervals'])){_0x13db9c=_[_0x8c78('0x11')](_0x39e116[_0x4f3e43['IntervalId']]['Intervals'],_0x8c78('0x12'));}else if(!_[_0x8c78('0x10')](_0x4f3e43[_0x8c78('0x12')])){_0x13db9c=[_0x4f3e43[_0x8c78('0x12')]];}return _0x13db9c;}exports[_0x8c78('0x13')]=function(_0x3d1306){_0x3d1306[_0x8c78('0x14')]={};return new BPromise(function(_0x930233,_0x2f44af){var _0x1157d0={'Start':function(_0x4ff4b0){var _0x1fa78e=this;return new Promise(function(_0x293cfe,_0x57ad11){if(_0x4ff4b0){try{var _0x45b85f=[];var _0x554464=getId(_0x4ff4b0[_0x8c78('0x15')],_0x4ff4b0[_0x8c78('0x16')]?_0x4ff4b0[_0x8c78('0x16')]['id']:0x0,_0x4ff4b0[_0x8c78('0x17')]?_0x4ff4b0['interaction']['id']:0x0);if(_0x4ff4b0['applications']&&_[_0x8c78('0x18')](_0x4ff4b0['applications'])&&_0x4ff4b0['applications'][_0x8c78('0x19')]){for(var _0x56c191=0x0;_0x56c191<_0x4ff4b0[_0x8c78('0x1a')][_0x8c78('0x19')];_0x56c191+=0x1){var _0x517cde=_0x4ff4b0[_0x8c78('0x1a')][_0x56c191];if(fs['existsSync'](path[_0x8c78('0x1b')](__dirname,_0x8c78('0x1a'),_0x517cde['app']+_0x8c78('0x1c')))){var _0x188cc3=[];switch(_0x517cde['app'][_0x8c78('0x1d')]()){case _0x8c78('0x1e'):var _0x3cda9a=_0x517cde[_0x8c78('0x1f')][_0x8c78('0x20')](',');if(_0x4ff4b0[_0x8c78('0x15')]===_0x8c78('0x21')){_0x188cc3[_0x8c78('0x22')](_0x3cda9a[0x0]);_0x188cc3[_0x8c78('0x22')](_0x3cda9a[0x1]);_0x188cc3['push'](_0x3cda9a[_0x8c78('0x23')](0x2,_0x3cda9a[_0x8c78('0x19')])[_0x8c78('0x1b')](','));}else{_0x188cc3['push'](_0x3cda9a[0x0]);_0x188cc3[_0x8c78('0x22')](_0x3cda9a['slice'](0x1,_0x3cda9a[_0x8c78('0x19')])[_0x8c78('0x1b')](','));}break;case _0x8c78('0x24'):var _0x496c51=_0x517cde[_0x8c78('0x1f')][_0x8c78('0x20')](',');_0x188cc3['push'](_0x496c51[0x0]);_0x188cc3[_0x8c78('0x22')](_0x496c51[0x1]);_0x188cc3[_0x8c78('0x22')](_0x496c51[_0x8c78('0x23')](0x2,_0x496c51[_0x8c78('0x19')])[_0x8c78('0x1b')](','));break;case _0x8c78('0x25'):var _0x5ba7d4=_0x517cde[_0x8c78('0x1f')]['split'](',');_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[0x0]);_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[0x1]);_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[0x2]);_0x188cc3['push'](_0x5ba7d4[0x3]);_0x188cc3[_0x8c78('0x22')](_0x5ba7d4[_0x8c78('0x23')](0x4,_0x5ba7d4['length'])[_0x8c78('0x1b')](','));break;case _0x8c78('0x26'):var _0x32bc1f=_0x517cde['appdata'][_0x8c78('0x20')](',');_0x188cc3[_0x8c78('0x22')](_0x32bc1f[0x0]);_0x188cc3[_0x8c78('0x22')](_0x32bc1f[0x1]);_0x188cc3['push'](_0x32bc1f[0x2]);_0x188cc3[_0x8c78('0x22')](_0x32bc1f[0x3]);_0x188cc3[_0x8c78('0x22')](_0x32bc1f['slice'](0x4,_0x32bc1f[_0x8c78('0x19')])[_0x8c78('0x1b')](','));break;case _0x8c78('0x16'):_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x1f')]);break;case _0x8c78('0x27'):_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x28')]);_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x1f')]);break;case'tvox':var _0x3e9bf1=utils[_0x8c78('0x29')](_0x4ff4b0[_0x8c78('0x2a')][_0x8c78('0x2b')],_0x4ff4b0);var _0x34481a=_0x517cde['appdata'][_0x8c78('0x20')](',');_0x188cc3[_0x8c78('0x22')](_0x34481a[0x0]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x1]);_0x188cc3['push'](_0x34481a[0x2]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x3]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x4]);_0x188cc3['push'](_0x34481a[0x5]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x6]);_0x188cc3['push'](_0x34481a[0x7]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x8]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0x9]);_0x188cc3[_0x8c78('0x22')](_0x34481a[0xa]);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0['interaction']['id']);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0['message']['id']);_0x188cc3[_0x8c78('0x22')](_0x517cde[_0x8c78('0x2c')]);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0['interaction']['ContactId']);_0x188cc3[_0x8c78('0x22')](_0x4ff4b0[_0x8c78('0x2d')][_0x8c78('0x2d')]);_0x188cc3[_0x8c78('0x22')](_0x3e9bf1);break;default:_0x188cc3=_[_0x8c78('0x10')](_0x517cde[_0x8c78('0x1f')])?[]:_0x517cde[_0x8c78('0x1f')][_0x8c78('0x20')](',');}var _0x1f0a2b={'id':util[_0x8c78('0xd')](_0x8c78('0x2e'),_0x554464,_0x517cde['id'],_0x517cde[_0x8c78('0x2f')]),'condition':require(_0x8c78('0x30'))['condition'](_0x554464,getIntervals(_0x3d1306[_0x8c78('0x31')],_0x517cde),_0x3d1306),'consequence':require(_0x8c78('0x32')+_0x517cde['app'])['consequence'](_0x554464,_0x188cc3,_0x3d1306,_0x4ff4b0),'p':_0x517cde[_0x8c78('0x33')]||0x0};logger[_0x8c78('0x34')]('Push\x20new\x20rule',_0x1f0a2b['id'],_0x8c78('0x35'),getIntervals(_0x3d1306[_0x8c78('0x31')],_0x517cde)['join'](_0x8c78('0x36')));_0x45b85f[_0x8c78('0x22')](_0x1f0a2b);}else{logger['error'](_0x8c78('0x37'),path[_0x8c78('0x1b')](__dirname,_0x8c78('0x1a'),_0x517cde[_0x8c78('0x2f')]+_0x8c78('0x1c')));}}_0x3d1306['rules'][_0x554464]=new RuleEngine(_0x45b85f);_0x3d1306['rules'][_0x554464][_0x8c78('0x38')](_0x4ff4b0,function(_0x2f6a6b){logger[_0x8c78('0x34')](_0x8c78('0x39'),JSON[_0x8c78('0x3a')](_0x2f6a6b[_0x8c78('0x3b')]));if(_0x3d1306[_0x8c78('0x14')][_0x554464]){_0x3d1306[_0x8c78('0x14')][_0x554464][_0x8c78('0x3c')](_0x8c78('0x3d'));}});return _0x293cfe({'code':0xc8,'message':_0x4ff4b0});}else{logger[_0x8c78('0x34')]('No\x20applications\x20to\x20execute');return _0x293cfe({'code':0xc8,'message':_0x4ff4b0});}}catch(_0x1015bf){logger[_0x8c78('0x3e')](_0x1015bf[_0x8c78('0x3f')]);return _0x57ad11(_0x1fa78e[_0x8c78('0x3e')](0x1f4,_0x1015bf));}}return _0x57ad11(_0x8c78('0x40'));});},'AcceptMessage':function(_0x556a51){var _0x356e47=this;return new Promise(function(_0x4588cd,_0x464601){if(_0x556a51[_0x8c78('0x41')]&&_0x556a51[_0x8c78('0x41')]['id']){if(_0x3d1306['agents'][_0x556a51[_0x8c78('0x41')]['id']]){_0x3d1306['agents'][_0x556a51['agent']['id']][_0x8c78('0x42')]=![];_0x3d1306[_0x8c78('0x43')][_0x556a51[_0x8c78('0x41')]['id']]['busyQueue']=undefined;}}if(_0x556a51[_0x8c78('0x16')]&&_0x556a51[_0x8c78('0x16')]['id']){try{var _0x41b995=getId(_0x556a51[_0x8c78('0x15')],_0x556a51[_0x8c78('0x16')]?_0x556a51[_0x8c78('0x16')]['id']:0x0,_0x556a51[_0x8c78('0x17')]?_0x556a51[_0x8c78('0x17')]['id']:0x0);if(_0x3d1306[_0x8c78('0x14')][_0x41b995]){_0x3d1306['rules'][_0x41b995][_0x8c78('0x3c')](_0x8c78('0x44'));if(rpc[_0x556a51[_0x8c78('0x15')]+_0x8c78('0x45')]){rpc[_0x556a51['channel']+_0x8c78('0x45')][_0x8c78('0x46')](_0x41b995,{'UserId':_0x556a51[_0x8c78('0x16')][_0x8c78('0x47')]})['catch'](function(_0x336b95){logger[_0x8c78('0x3e')](_0x8c78('0x48'));});}}return _0x4588cd({'code':0xc8,'message':_0x556a51});}catch(_0x551e0f){logger[_0x8c78('0x3e')](_0x551e0f['stack']);return _0x464601(_0x356e47[_0x8c78('0x3e')](0x1f4,_0x551e0f));}}logger[_0x8c78('0x3e')](_0x8c78('0x49'));return _0x464601(_0x356e47[_0x8c78('0x3e')](0x1f4,_0x8c78('0x49')));});},'RejectMessage':function(_0x462b89){var _0xf68e0=this;return new Promise(function(_0x38fec1,_0x19d807){if(_0x462b89[_0x8c78('0x41')]&&_0x462b89[_0x8c78('0x41')]['id']){try{if(_0x3d1306[_0x8c78('0x43')][_0x462b89[_0x8c78('0x41')]['id']]){_0x3d1306[_0x8c78('0x43')][_0x462b89['agent']['id']][_0x8c78('0x42')]=![];_0x3d1306[_0x8c78('0x43')][_0x462b89[_0x8c78('0x41')]['id']][_0x8c78('0x4a')]=undefined;}return _0x38fec1({'code':0xc8,'message':_0x462b89});}catch(_0x5d046f){logger[_0x8c78('0x3e')](_0x5d046f[_0x8c78('0x3f')]);return _0x19d807(_0xf68e0[_0x8c78('0x3e')](0x1f4,_0x5d046f));}}logger[_0x8c78('0x3e')](_0x8c78('0x49'));return _0x19d807(_0xf68e0[_0x8c78('0x3e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1e616c){var _0x42a34e=this;return new Promise(function(_0x486b61,_0x334432){if(_0x1e616c['channel']&&_0x1e616c[_0x8c78('0x17')]&&_0x1e616c[_0x8c78('0x17')]['id']){try{var _0x257533=getId(_0x1e616c[_0x8c78('0x15')],_0x1e616c[_0x8c78('0x16')]?_0x1e616c[_0x8c78('0x16')]['id']:0x0,_0x1e616c[_0x8c78('0x17')]?_0x1e616c['interaction']['id']:0x0);if(_0x3d1306[_0x8c78('0x14')][_0x257533]){_0x3d1306[_0x8c78('0x14')][_0x257533]['emit'](_0x8c78('0x44'));}return _0x486b61({'code':0xc8,'message':_0x1e616c});}catch(_0x3529aa){logger['error'](_0x3529aa[_0x8c78('0x3f')]);return _0x334432(_0x42a34e[_0x8c78('0x3e')](0x1f4,_0x3529aa));}}logger[_0x8c78('0x3e')](_0x8c78('0x49'));return _0x334432(_0x42a34e[_0x8c78('0x3e')](0x1f4,_0x8c78('0x49')));});},'AgentCapacity':function(_0x43f403){var _0x445630=this;return new Promise(function(_0x20a0d9,_0x1b3600){if(_0x3d1306[_0x8c78('0x43')][_0x8c78('0x4b')](_0x43f403['id'])){for(var _0x1468f2 in _0x43f403[_0x8c78('0x4c')]){if(_0x43f403['capacity'][_0x8c78('0x4b')](_0x1468f2)){if(_0x3d1306['agents'][_0x43f403['id']][_0x8c78('0x4b')](_0x1468f2+'CurrentCapacity')){_0x3d1306['agents'][_0x43f403['id']][_0x1468f2+'CurrentCapacity']=parseInt(_0x43f403[_0x8c78('0x4c')][_0x1468f2],0xa);}}}_0x3d1306['agents'][_0x43f403['id']]['updateRealtime']();return _0x20a0d9({'code':0xc8,'message':_0x3d1306['agents'][_0x43f403['id']]});}else{return _0x1b3600(_0x445630[_0x8c78('0x3e')](0x1f4,_0x8c78('0x4d')));}});},'Agents':function(_0x142b45){return new Promise(function(_0x19156a,_0x4d0b26){var _0x333272=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x43')]);_0x19156a({'count':_0x333272[_0x8c78('0x19')],'rows':_0x333272});});},'ChatQueues':function(_0x334d0a){return new Promise(function(_0x3c3332,_0x3990c2){var _0x54d561=[];for(var _0x25c255 in _0x3d1306[_0x8c78('0x4f')]){if(_0x3d1306[_0x8c78('0x4f')][_0x8c78('0x4b')](_0x25c255)){var _0x3e1ee0=_0x3d1306[_0x8c78('0x4f')][_0x25c255];var _0x4bdb7e={'id':_0x3e1ee0['id'],'available':_0x3e1ee0[_0x8c78('0x50')],'loggedIn':_0x3e1ee0['loggedIn'],'name':_0x3e1ee0[_0x8c78('0x51')],'paused':_0x3e1ee0[_0x8c78('0x52')],'waiting':_0x3e1ee0[_0x8c78('0x53')]};_0x54d561['push'](_0x4bdb7e);}}_0x3c3332({'count':_0x54d561[_0x8c78('0x19')],'rows':_0x54d561});});},'MailQueues':function(_0x3e2961){return new Promise(function(_0x3f3aff,_0x4fa0b0){var _0x1fa8a4=[];for(var _0x2240cd in _0x3d1306['mailQueues']){if(_0x3d1306[_0x8c78('0x54')][_0x8c78('0x4b')](_0x2240cd)){var _0x1763a7=_0x3d1306['mailQueues'][_0x2240cd];var _0x3780cd={'id':_0x1763a7['id'],'available':_0x1763a7[_0x8c78('0x50')],'loggedIn':_0x1763a7[_0x8c78('0x55')],'name':_0x1763a7[_0x8c78('0x51')],'paused':_0x1763a7[_0x8c78('0x52')],'waiting':_0x1763a7[_0x8c78('0x53')]};_0x1fa8a4[_0x8c78('0x22')](_0x3780cd);}}_0x3f3aff({'count':_0x1fa8a4[_0x8c78('0x19')],'rows':_0x1fa8a4});});},'OpenchannelQueues':function(_0x240f1e){return new Promise(function(_0x5646ff,_0x1f2b8f){var _0x21b400=[];for(var _0x3c6886 in _0x3d1306[_0x8c78('0x56')]){if(_0x3d1306[_0x8c78('0x56')][_0x8c78('0x4b')](_0x3c6886)){var _0x33b1e4=_0x3d1306[_0x8c78('0x56')][_0x3c6886];var _0x2c1cf5={'id':_0x33b1e4['id'],'available':_0x33b1e4['available'],'loggedIn':_0x33b1e4[_0x8c78('0x55')],'name':_0x33b1e4[_0x8c78('0x51')],'paused':_0x33b1e4['paused'],'waiting':_0x33b1e4['waiting']};_0x21b400[_0x8c78('0x22')](_0x2c1cf5);}}_0x5646ff({'count':_0x21b400['length'],'rows':_0x21b400});});},'SmsQueues':function(_0x103be3){return new Promise(function(_0x1c5c15,_0x3a3172){var _0x476835=[];for(var _0x1b2c45 in _0x3d1306[_0x8c78('0x57')]){if(_0x3d1306['smsQueues']['hasOwnProperty'](_0x1b2c45)){var _0x3e0e40=_0x3d1306[_0x8c78('0x57')][_0x1b2c45];var _0x44c309={'id':_0x3e0e40['id'],'available':_0x3e0e40[_0x8c78('0x50')],'loggedIn':_0x3e0e40[_0x8c78('0x55')],'name':_0x3e0e40['name'],'paused':_0x3e0e40[_0x8c78('0x52')],'waiting':_0x3e0e40[_0x8c78('0x53')]};_0x476835[_0x8c78('0x22')](_0x44c309);}}_0x1c5c15({'count':_0x476835[_0x8c78('0x19')],'rows':_0x476835});});},'FaxQueues':function(_0x1237a3){return new Promise(function(_0x9e1f41,_0x5d92c8){var _0x3a4c7a=[];for(var _0x155725 in _0x3d1306['faxQueues']){if(_0x3d1306[_0x8c78('0x58')][_0x8c78('0x4b')](_0x155725)){var _0xae45a8=_0x3d1306[_0x8c78('0x58')][_0x155725];var _0x3f2496={'id':_0xae45a8['id'],'available':_0xae45a8[_0x8c78('0x50')],'loggedIn':_0xae45a8[_0x8c78('0x55')],'name':_0xae45a8[_0x8c78('0x51')],'paused':_0xae45a8[_0x8c78('0x52')],'waiting':_0xae45a8[_0x8c78('0x53')]};_0x3a4c7a[_0x8c78('0x22')](_0x3f2496);}}_0x9e1f41({'count':_0x3a4c7a[_0x8c78('0x19')],'rows':_0x3a4c7a});});},'WhatsappQueues':function(_0x3ba98a){return new Promise(function(_0x3ed782,_0x16106d){var _0x400659=[];for(var _0x1b1876 in _0x3d1306['whatsappQueues']){if(_0x3d1306[_0x8c78('0x59')]['hasOwnProperty'](_0x1b1876)){var _0x5b12d8=_0x3d1306[_0x8c78('0x59')][_0x1b1876];var _0x28fbc1={'id':_0x5b12d8['id'],'available':_0x5b12d8[_0x8c78('0x50')],'loggedIn':_0x5b12d8[_0x8c78('0x55')],'name':_0x5b12d8['name'],'paused':_0x5b12d8[_0x8c78('0x52')],'waiting':_0x5b12d8[_0x8c78('0x53')]};_0x400659[_0x8c78('0x22')](_0x28fbc1);}}_0x3ed782({'count':_0x400659['length'],'rows':_0x400659});});},'ChatQueuesWaitingInteractions':function(_0x9722d1){return new Promise(function(_0xb84d81,_0x2fbf59){var _0x313ec9=_['values'](_0x3d1306[_0x8c78('0x5a')]);_0xb84d81({'count':_0x313ec9[_0x8c78('0x19')],'rows':_0x313ec9});});},'MailQueuesWaitingInteractions':function(_0x5e2fc3){return new Promise(function(_0x4a6bb3,_0x4d393e){var _0x269c5b=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x5b')]);_0x4a6bb3({'count':_0x269c5b[_0x8c78('0x19')],'rows':_0x269c5b});});},'OpenchannelQueuesWaitingInteractions':function(_0x4d03c1){return new Promise(function(_0xae30e3,_0x4da14f){var _0x2f6e82=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x5c')]);_0xae30e3({'count':_0x2f6e82[_0x8c78('0x19')],'rows':_0x2f6e82});});},'SmsQueuesWaitingInteractions':function(_0x37059a){return new Promise(function(_0x15dc4a,_0x5b1a37){var _0x5c67c9=_['values'](_0x3d1306[_0x8c78('0x5d')]);_0x15dc4a({'count':_0x5c67c9[_0x8c78('0x19')],'rows':_0x5c67c9});});},'FaxQueuesWaitingInteractions':function(_0x53b653){return new Promise(function(_0xb40796,_0x1e6d75){var _0x21c6ef=_['values'](_0x3d1306[_0x8c78('0x5e')]);_0xb40796({'count':_0x21c6ef['length'],'rows':_0x21c6ef});});},'WhatsappQueuesWaitingInteractions':function(_0x26ca11){return new Promise(function(_0x253e6f,_0x3f013b){var _0x401567=_[_0x8c78('0x4e')](_0x3d1306[_0x8c78('0x5f')]);_0x253e6f({'count':_0x401567[_0x8c78('0x19')],'rows':_0x401567});});}};var _0xda7142=jayson[_0x8c78('0x60')](_0x1157d0)[_0x8c78('0x61')]();_0xda7142['on'](_0x8c78('0x3e'),function(_0x4d71dd){logger['error'](JSON[_0x8c78('0x3a')](_0x4d71dd));return _0x2f44af(_0x4d71dd);});_0xda7142[_0x8c78('0x13')](0x232c,_0x8c78('0x62'),function(){console['log'](_0x8c78('0x63'),0x232c);return _0x930233(_0x8c78('0x64')+0x232c);});});}; \ No newline at end of file +var _0x4e81=['push','slice','dialogflow','appdata','amazonlex','tag','TagId','tvox','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','complete','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','waiting','mailQueues','available','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','.js','toLowerCase','split'];(function(_0x2abfa8,_0x449711){var _0x315c11=function(_0x18dd05){while(--_0x18dd05){_0x2abfa8['push'](_0x2abfa8['shift']());}};_0x315c11(++_0x449711);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x4e81[_0x2e655a];return _0x26f13b;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require('uuid');var utils=require(_0x14e8('0x3'));var config=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var rpc={'openchannelQueueReport':require(_0x14e8('0x7')),'mailQueueReport':require(_0x14e8('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x14e8('0x9')),'whatsappQueueReport':require(_0x14e8('0xa'))};var RuleEngine=require(_0x14e8('0xb'));function getId(_0x3c1b93,_0x11ec3b,_0x20f053){return util[_0x14e8('0xc')](_0x14e8('0xd'),_0x3c1b93,_0x11ec3b||0x0,_0x20f053||0x0);}function getIntervals(_0x294b39,_0x5602cc){var _0xbd3b87=[];if(!_[_0x14e8('0xe')](_0x5602cc[_0x14e8('0xf')])&&!_[_0x14e8('0xe')](_0x294b39[_0x5602cc[_0x14e8('0xf')]])&&!_[_0x14e8('0xe')](_0x294b39[_0x5602cc[_0x14e8('0xf')]][_0x14e8('0x10')])){_0xbd3b87=_['map'](_0x294b39[_0x5602cc[_0x14e8('0xf')]]['Intervals'],_0x14e8('0x11'));}else if(!_[_0x14e8('0xe')](_0x5602cc[_0x14e8('0x11')])){_0xbd3b87=[_0x5602cc['interval']];}return _0xbd3b87;}exports[_0x14e8('0x12')]=function(_0x4e1064){_0x4e1064[_0x14e8('0x13')]={};return new BPromise(function(_0x58d26e,_0x347216){var _0x3761a1={'Start':function(_0xc6101f){var _0x135996=this;return new Promise(function(_0x52e64f,_0x10c4a9){if(_0xc6101f){try{var _0x3793a0=[];var _0x30581=getId(_0xc6101f[_0x14e8('0x14')],_0xc6101f[_0x14e8('0x15')]?_0xc6101f[_0x14e8('0x15')]['id']:0x0,_0xc6101f[_0x14e8('0x16')]?_0xc6101f[_0x14e8('0x16')]['id']:0x0);if(_0xc6101f['applications']&&_[_0x14e8('0x17')](_0xc6101f[_0x14e8('0x18')])&&_0xc6101f[_0x14e8('0x18')][_0x14e8('0x19')]){for(var _0x246c5d=0x0;_0x246c5d<_0xc6101f['applications'][_0x14e8('0x19')];_0x246c5d+=0x1){var _0x1cefdc=_0xc6101f[_0x14e8('0x18')][_0x246c5d];if(fs['existsSync'](path[_0x14e8('0x1a')](__dirname,'applications',_0x1cefdc[_0x14e8('0x1b')]+_0x14e8('0x1c')))){var _0x3e8d5c=[];switch(_0x1cefdc[_0x14e8('0x1b')][_0x14e8('0x1d')]()){case'autoreply':var _0xf6bbdc=_0x1cefdc['appdata'][_0x14e8('0x1e')](',');if(_0xc6101f[_0x14e8('0x14')]==='mail'){_0x3e8d5c['push'](_0xf6bbdc[0x0]);_0x3e8d5c['push'](_0xf6bbdc[0x1]);_0x3e8d5c[_0x14e8('0x1f')](_0xf6bbdc[_0x14e8('0x20')](0x2,_0xf6bbdc[_0x14e8('0x19')])[_0x14e8('0x1a')](','));}else{_0x3e8d5c[_0x14e8('0x1f')](_0xf6bbdc[0x0]);_0x3e8d5c['push'](_0xf6bbdc[_0x14e8('0x20')](0x1,_0xf6bbdc[_0x14e8('0x19')])[_0x14e8('0x1a')](','));}break;case _0x14e8('0x21'):var _0x28035a=_0x1cefdc[_0x14e8('0x22')][_0x14e8('0x1e')](',');_0x3e8d5c['push'](_0x28035a[0x0]);_0x3e8d5c[_0x14e8('0x1f')](_0x28035a[0x1]);_0x3e8d5c[_0x14e8('0x1f')](_0x28035a[_0x14e8('0x20')](0x2,_0x28035a['length'])['join'](','));break;case'dialogflowv2':var _0x8fe0e2=_0x1cefdc[_0x14e8('0x22')]['split'](',');_0x3e8d5c[_0x14e8('0x1f')](_0x8fe0e2[0x0]);_0x3e8d5c[_0x14e8('0x1f')](_0x8fe0e2[0x1]);_0x3e8d5c[_0x14e8('0x1f')](_0x8fe0e2[0x2]);_0x3e8d5c[_0x14e8('0x1f')](_0x8fe0e2[0x3]);_0x3e8d5c['push'](_0x8fe0e2[_0x14e8('0x20')](0x4,_0x8fe0e2[_0x14e8('0x19')])[_0x14e8('0x1a')](','));break;case _0x14e8('0x23'):var _0x2d0246=_0x1cefdc['appdata'][_0x14e8('0x1e')](',');_0x3e8d5c[_0x14e8('0x1f')](_0x2d0246[0x0]);_0x3e8d5c[_0x14e8('0x1f')](_0x2d0246[0x1]);_0x3e8d5c[_0x14e8('0x1f')](_0x2d0246[0x2]);_0x3e8d5c['push'](_0x2d0246[0x3]);_0x3e8d5c[_0x14e8('0x1f')](_0x2d0246['slice'](0x4,_0x2d0246[_0x14e8('0x19')])[_0x14e8('0x1a')](','));break;case _0x14e8('0x15'):_0x3e8d5c[_0x14e8('0x1f')](_0x1cefdc[_0x14e8('0x22')]);break;case _0x14e8('0x24'):_0x3e8d5c[_0x14e8('0x1f')](_0x1cefdc[_0x14e8('0x25')]);_0x3e8d5c[_0x14e8('0x1f')](_0x1cefdc[_0x14e8('0x22')]);break;case _0x14e8('0x26'):var _0x4411e9=utils['getMustacheRender'](_0xc6101f['account']['notificationTemplate'],_0xc6101f);var _0x16ff09=_0x1cefdc['appdata'][_0x14e8('0x1e')](',');_0x3e8d5c['push'](_0x16ff09[0x0]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x1]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x2]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x3]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x4]);_0x3e8d5c['push'](_0x16ff09[0x5]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x6]);_0x3e8d5c['push'](_0x16ff09[0x7]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x8]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0x9]);_0x3e8d5c[_0x14e8('0x1f')](_0x16ff09[0xa]);_0x3e8d5c[_0x14e8('0x1f')](_0xc6101f[_0x14e8('0x16')]['id']);_0x3e8d5c[_0x14e8('0x1f')](_0xc6101f['message']['id']);_0x3e8d5c[_0x14e8('0x1f')](_0x1cefdc['ChatWebsiteId']);_0x3e8d5c[_0x14e8('0x1f')](_0xc6101f[_0x14e8('0x16')][_0x14e8('0x27')]);_0x3e8d5c['push'](_0xc6101f[_0x14e8('0x28')][_0x14e8('0x28')]);_0x3e8d5c['push'](_0x4411e9);break;default:_0x3e8d5c=_[_0x14e8('0xe')](_0x1cefdc[_0x14e8('0x22')])?[]:_0x1cefdc[_0x14e8('0x22')][_0x14e8('0x1e')](',');}var _0x77e8a0={'id':util[_0x14e8('0xc')](_0x14e8('0x29'),_0x30581,_0x1cefdc['id'],_0x1cefdc[_0x14e8('0x1b')]),'condition':require(_0x14e8('0x2a'))[_0x14e8('0x2b')](_0x30581,getIntervals(_0x4e1064[_0x14e8('0x2c')],_0x1cefdc),_0x4e1064),'consequence':require(_0x14e8('0x2d')+_0x1cefdc[_0x14e8('0x1b')])[_0x14e8('0x2e')](_0x30581,_0x3e8d5c,_0x4e1064,_0xc6101f),'p':_0x1cefdc[_0x14e8('0x2f')]||0x0};logger['info'](_0x14e8('0x30'),_0x77e8a0['id'],'on\x20interval',getIntervals(_0x4e1064['intervals'],_0x1cefdc)['join'](_0x14e8('0x31')));_0x3793a0['push'](_0x77e8a0);}else{logger[_0x14e8('0x32')](_0x14e8('0x33'),path[_0x14e8('0x1a')](__dirname,_0x14e8('0x18'),_0x1cefdc[_0x14e8('0x1b')]+_0x14e8('0x1c')));}}_0x4e1064[_0x14e8('0x13')][_0x30581]=new RuleEngine(_0x3793a0);_0x4e1064[_0x14e8('0x13')][_0x30581][_0x14e8('0x34')](_0xc6101f,function(_0x3f9da0){logger[_0x14e8('0x35')]('Applications\x20executed',JSON[_0x14e8('0x36')](_0x3f9da0[_0x14e8('0x37')]));if(_0x4e1064[_0x14e8('0x13')][_0x30581]){_0x4e1064[_0x14e8('0x13')][_0x30581]['emit'](_0x14e8('0x38'));}});return _0x52e64f({'code':0xc8,'message':_0xc6101f});}else{logger[_0x14e8('0x35')]('No\x20applications\x20to\x20execute');return _0x52e64f({'code':0xc8,'message':_0xc6101f});}}catch(_0x553002){logger[_0x14e8('0x32')](_0x553002['stack']);return _0x10c4a9(_0x135996['error'](0x1f4,_0x553002));}}return _0x10c4a9(_0x14e8('0x39'));});},'AcceptMessage':function(_0xce1e17){var _0x578d48=this;return new Promise(function(_0x31fd95,_0x11455b){if(_0xce1e17['agent']&&_0xce1e17[_0x14e8('0x3a')]['id']){if(_0x4e1064[_0x14e8('0x3b')][_0xce1e17[_0x14e8('0x3a')]['id']]){_0x4e1064[_0x14e8('0x3b')][_0xce1e17[_0x14e8('0x3a')]['id']][_0x14e8('0x3c')]=![];_0x4e1064[_0x14e8('0x3b')][_0xce1e17[_0x14e8('0x3a')]['id']][_0x14e8('0x3d')]=undefined;}}if(_0xce1e17[_0x14e8('0x15')]&&_0xce1e17[_0x14e8('0x15')]['id']){try{var _0x4083b8=getId(_0xce1e17[_0x14e8('0x14')],_0xce1e17[_0x14e8('0x15')]?_0xce1e17[_0x14e8('0x15')]['id']:0x0,_0xce1e17[_0x14e8('0x16')]?_0xce1e17['interaction']['id']:0x0);if(_0x4e1064[_0x14e8('0x13')][_0x4083b8]){_0x4e1064['rules'][_0x4083b8][_0x14e8('0x3e')](_0x14e8('0x3f'));if(rpc[_0xce1e17[_0x14e8('0x14')]+_0x14e8('0x40')]){rpc[_0xce1e17['channel']+'QueueReport']['update'](_0x4083b8,{'UserId':_0xce1e17[_0x14e8('0x15')]['UserId']})['catch'](function(_0xd2b281){logger[_0x14e8('0x32')]('error\x20update\x20queue\x20report');});}}return _0x31fd95({'code':0xc8,'message':_0xce1e17});}catch(_0x15058e){logger[_0x14e8('0x32')](_0x15058e[_0x14e8('0x41')]);return _0x11455b(_0x578d48[_0x14e8('0x32')](0x1f4,_0x15058e));}}logger['error']('message\x20is\x20empty');return _0x11455b(_0x578d48[_0x14e8('0x32')](0x1f4,_0x14e8('0x42')));});},'RejectMessage':function(_0x15464a){var _0x3a09b7=this;return new Promise(function(_0x41b5ab,_0x2fbac7){if(_0x15464a['agent']&&_0x15464a[_0x14e8('0x3a')]['id']){try{if(_0x4e1064[_0x14e8('0x3b')][_0x15464a[_0x14e8('0x3a')]['id']]){_0x4e1064[_0x14e8('0x3b')][_0x15464a['agent']['id']][_0x14e8('0x3c')]=![];_0x4e1064[_0x14e8('0x3b')][_0x15464a[_0x14e8('0x3a')]['id']][_0x14e8('0x3d')]=undefined;}return _0x41b5ab({'code':0xc8,'message':_0x15464a});}catch(_0x5d7e49){logger[_0x14e8('0x32')](_0x5d7e49[_0x14e8('0x41')]);return _0x2fbac7(_0x3a09b7[_0x14e8('0x32')](0x1f4,_0x5d7e49));}}logger[_0x14e8('0x32')](_0x14e8('0x42'));return _0x2fbac7(_0x3a09b7[_0x14e8('0x32')](0x1f4,_0x14e8('0x42')));});},'AbandonInteraction':function(_0x168b8a){var _0x5ab659=this;return new Promise(function(_0x5a1f22,_0x2fcc63){if(_0x168b8a[_0x14e8('0x14')]&&_0x168b8a[_0x14e8('0x16')]&&_0x168b8a[_0x14e8('0x16')]['id']){try{var _0x3f0b2a=getId(_0x168b8a['channel'],_0x168b8a['message']?_0x168b8a['message']['id']:0x0,_0x168b8a[_0x14e8('0x16')]?_0x168b8a[_0x14e8('0x16')]['id']:0x0);if(_0x4e1064[_0x14e8('0x13')][_0x3f0b2a]){_0x4e1064['rules'][_0x3f0b2a][_0x14e8('0x3e')](_0x14e8('0x3f'));}return _0x5a1f22({'code':0xc8,'message':_0x168b8a});}catch(_0x1d6683){logger['error'](_0x1d6683[_0x14e8('0x41')]);return _0x2fcc63(_0x5ab659[_0x14e8('0x32')](0x1f4,_0x1d6683));}}logger[_0x14e8('0x32')](_0x14e8('0x42'));return _0x2fcc63(_0x5ab659[_0x14e8('0x32')](0x1f4,_0x14e8('0x42')));});},'AgentCapacity':function(_0x3a157c){var _0x12a2b3=this;return new Promise(function(_0x2da07b,_0x455764){if(_0x4e1064[_0x14e8('0x3b')]['hasOwnProperty'](_0x3a157c['id'])){for(var _0x35e1ea in _0x3a157c[_0x14e8('0x43')]){if(_0x3a157c[_0x14e8('0x43')][_0x14e8('0x44')](_0x35e1ea)){if(_0x4e1064[_0x14e8('0x3b')][_0x3a157c['id']][_0x14e8('0x44')](_0x35e1ea+_0x14e8('0x45'))){_0x4e1064[_0x14e8('0x3b')][_0x3a157c['id']][_0x35e1ea+_0x14e8('0x45')]=parseInt(_0x3a157c[_0x14e8('0x43')][_0x35e1ea],0xa);}}}_0x4e1064[_0x14e8('0x3b')][_0x3a157c['id']][_0x14e8('0x46')]();return _0x2da07b({'code':0xc8,'message':_0x4e1064['agents'][_0x3a157c['id']]});}else{return _0x455764(_0x12a2b3[_0x14e8('0x32')](0x1f4,_0x14e8('0x47')));}});},'Agents':function(_0x5a35a0){return new Promise(function(_0x27315f,_0x2c2630){var _0x31e785=_[_0x14e8('0x48')](_0x4e1064[_0x14e8('0x3b')]);_0x27315f({'count':_0x31e785[_0x14e8('0x19')],'rows':_0x31e785});});},'ChatQueues':function(_0x139405){return new Promise(function(_0x5b6e28,_0x4c30dd){var _0x5c1609=[];for(var _0x17cded in _0x4e1064[_0x14e8('0x49')]){if(_0x4e1064[_0x14e8('0x49')][_0x14e8('0x44')](_0x17cded)){var _0x39de9d=_0x4e1064[_0x14e8('0x49')][_0x17cded];var _0x402956={'id':_0x39de9d['id'],'available':_0x39de9d['available'],'loggedIn':_0x39de9d[_0x14e8('0x4a')],'name':_0x39de9d[_0x14e8('0x4b')],'paused':_0x39de9d['paused'],'waiting':_0x39de9d[_0x14e8('0x4c')]};_0x5c1609[_0x14e8('0x1f')](_0x402956);}}_0x5b6e28({'count':_0x5c1609['length'],'rows':_0x5c1609});});},'MailQueues':function(_0x58fa2e){return new Promise(function(_0x5efe1b,_0x379734){var _0xf0cae3=[];for(var _0x1109d3 in _0x4e1064[_0x14e8('0x4d')]){if(_0x4e1064['mailQueues'][_0x14e8('0x44')](_0x1109d3)){var _0x62a69c=_0x4e1064[_0x14e8('0x4d')][_0x1109d3];var _0x2e7956={'id':_0x62a69c['id'],'available':_0x62a69c[_0x14e8('0x4e')],'loggedIn':_0x62a69c[_0x14e8('0x4a')],'name':_0x62a69c['name'],'paused':_0x62a69c[_0x14e8('0x4f')],'waiting':_0x62a69c[_0x14e8('0x4c')]};_0xf0cae3[_0x14e8('0x1f')](_0x2e7956);}}_0x5efe1b({'count':_0xf0cae3['length'],'rows':_0xf0cae3});});},'OpenchannelQueues':function(_0x5add74){return new Promise(function(_0x20a598,_0x53d0c8){var _0x25f63c=[];for(var _0x5cbce8 in _0x4e1064[_0x14e8('0x50')]){if(_0x4e1064['openchannelQueues'][_0x14e8('0x44')](_0x5cbce8)){var _0x362bda=_0x4e1064['openchannelQueues'][_0x5cbce8];var _0x1daa74={'id':_0x362bda['id'],'available':_0x362bda[_0x14e8('0x4e')],'loggedIn':_0x362bda[_0x14e8('0x4a')],'name':_0x362bda[_0x14e8('0x4b')],'paused':_0x362bda[_0x14e8('0x4f')],'waiting':_0x362bda[_0x14e8('0x4c')]};_0x25f63c[_0x14e8('0x1f')](_0x1daa74);}}_0x20a598({'count':_0x25f63c[_0x14e8('0x19')],'rows':_0x25f63c});});},'SmsQueues':function(_0x24ad58){return new Promise(function(_0x3858cf,_0x1bc9c1){var _0x2e0e7d=[];for(var _0x316a7e in _0x4e1064['smsQueues']){if(_0x4e1064['smsQueues']['hasOwnProperty'](_0x316a7e)){var _0xd7427f=_0x4e1064[_0x14e8('0x51')][_0x316a7e];var _0x10e994={'id':_0xd7427f['id'],'available':_0xd7427f['available'],'loggedIn':_0xd7427f[_0x14e8('0x4a')],'name':_0xd7427f['name'],'paused':_0xd7427f['paused'],'waiting':_0xd7427f['waiting']};_0x2e0e7d[_0x14e8('0x1f')](_0x10e994);}}_0x3858cf({'count':_0x2e0e7d[_0x14e8('0x19')],'rows':_0x2e0e7d});});},'FaxQueues':function(_0x17f546){return new Promise(function(_0x4d29e3,_0xfc647b){var _0x4f83e9=[];for(var _0x36a4e0 in _0x4e1064[_0x14e8('0x52')]){if(_0x4e1064[_0x14e8('0x52')][_0x14e8('0x44')](_0x36a4e0)){var _0x3ab99d=_0x4e1064[_0x14e8('0x52')][_0x36a4e0];var _0x1918bb={'id':_0x3ab99d['id'],'available':_0x3ab99d[_0x14e8('0x4e')],'loggedIn':_0x3ab99d[_0x14e8('0x4a')],'name':_0x3ab99d['name'],'paused':_0x3ab99d[_0x14e8('0x4f')],'waiting':_0x3ab99d['waiting']};_0x4f83e9[_0x14e8('0x1f')](_0x1918bb);}}_0x4d29e3({'count':_0x4f83e9[_0x14e8('0x19')],'rows':_0x4f83e9});});},'WhatsappQueues':function(_0x53b143){return new Promise(function(_0x33552f,_0x168397){var _0x1ba2a7=[];for(var _0x3b5131 in _0x4e1064[_0x14e8('0x53')]){if(_0x4e1064[_0x14e8('0x53')]['hasOwnProperty'](_0x3b5131)){var _0x33abe5=_0x4e1064[_0x14e8('0x53')][_0x3b5131];var _0xc8b6c1={'id':_0x33abe5['id'],'available':_0x33abe5[_0x14e8('0x4e')],'loggedIn':_0x33abe5['loggedIn'],'name':_0x33abe5[_0x14e8('0x4b')],'paused':_0x33abe5[_0x14e8('0x4f')],'waiting':_0x33abe5[_0x14e8('0x4c')]};_0x1ba2a7[_0x14e8('0x1f')](_0xc8b6c1);}}_0x33552f({'count':_0x1ba2a7['length'],'rows':_0x1ba2a7});});},'ChatQueuesWaitingInteractions':function(_0x23c21f){return new Promise(function(_0x5b7f09,_0x1e8886){var _0x4bbfe3=_['values'](_0x4e1064[_0x14e8('0x54')]);_0x5b7f09({'count':_0x4bbfe3[_0x14e8('0x19')],'rows':_0x4bbfe3});});},'MailQueuesWaitingInteractions':function(_0x392bd1){return new Promise(function(_0x11b496,_0xe8425f){var _0xfa52f=_[_0x14e8('0x48')](_0x4e1064[_0x14e8('0x55')]);_0x11b496({'count':_0xfa52f[_0x14e8('0x19')],'rows':_0xfa52f});});},'OpenchannelQueuesWaitingInteractions':function(_0x280a8c){return new Promise(function(_0x2ae8aa,_0x4f6c35){var _0x43dbee=_[_0x14e8('0x48')](_0x4e1064[_0x14e8('0x56')]);_0x2ae8aa({'count':_0x43dbee['length'],'rows':_0x43dbee});});},'SmsQueuesWaitingInteractions':function(_0x5a9e57){return new Promise(function(_0x2e24fa,_0x368292){var _0xc3ebbc=_[_0x14e8('0x48')](_0x4e1064[_0x14e8('0x57')]);_0x2e24fa({'count':_0xc3ebbc[_0x14e8('0x19')],'rows':_0xc3ebbc});});},'FaxQueuesWaitingInteractions':function(_0x7ad347){return new Promise(function(_0x196815,_0xe0027d){var _0x2cd26c=_[_0x14e8('0x48')](_0x4e1064[_0x14e8('0x58')]);_0x196815({'count':_0x2cd26c[_0x14e8('0x19')],'rows':_0x2cd26c});});},'WhatsappQueuesWaitingInteractions':function(_0x13ffd2){return new Promise(function(_0x5c6fcb,_0x37e95e){var _0x5ba06e=_[_0x14e8('0x48')](_0x4e1064[_0x14e8('0x59')]);_0x5c6fcb({'count':_0x5ba06e[_0x14e8('0x19')],'rows':_0x5ba06e});});}};var _0x177d9c=jayson[_0x14e8('0x5a')](_0x3761a1)[_0x14e8('0x5b')]();_0x177d9c['on']('error',function(_0x755ab8){logger[_0x14e8('0x32')](JSON['stringify'](_0x755ab8));return _0x347216(_0x755ab8);});_0x177d9c[_0x14e8('0x12')](0x232c,_0x14e8('0x5c'),function(){console[_0x14e8('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x58d26e(_0x14e8('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a0eb665..b14eea0 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 _0xe2aa=['jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','result','catch','rules','info','stop','length','push','format','iftime\x20%s','message','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird'];(function(_0xd3798a,_0x32434b){var _0x2af40c=function(_0x171b60){while(--_0x171b60){_0xd3798a['push'](_0xd3798a['shift']());}};_0x2af40c(++_0x32434b);}(_0xe2aa,0x14f));var _0xae2a=function(_0x6af35d,_0x56c294){_0x6af35d=_0x6af35d-0x0;var _0x4cca9f=_0xe2aa[_0x6af35d];return _0x4cca9f;};'use strict';var util=require('util');var BPromise=require(_0xae2a('0x0'));var jayson=require(_0xae2a('0x1'));var _=require(_0xae2a('0x2'));var logger=require(_0xae2a('0x3'))(_0xae2a('0x4'));var client=jayson[_0xae2a('0x5')][_0xae2a('0x6')]({'port':0x232a});function request(_0x212bb7,_0x124e85){return new BPromise(function(_0x26cdf2,_0xcf5093){return client['request'](_0x212bb7,_0x124e85)[_0xae2a('0x7')](function(_0x3ebb4c){if(_0x3ebb4c['error']){return _0xcf5093(_0x3ebb4c[_0xae2a('0x8')]['message']);}else{return _0x26cdf2(_0x3ebb4c[_0xae2a('0x9')]);}})[_0xae2a('0xa')](function(_0x415479){return _0xcf5093(_0x415479);});});}exports['condition']=function(_0x19c676,_0x31fba5,_0x210f7c){return function(_0x2967f8){if(_0x210f7c[_0xae2a('0xb')]&&!_0x210f7c[_0xae2a('0xb')][_0x19c676]){logger[_0xae2a('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x19c676);return _0x2967f8[_0xae2a('0xd')]();}var _0x33567c=[];for(var _0x4281b2=0x0;_0x4281b2<_0x31fba5[_0xae2a('0xe')];_0x4281b2+=0x1){_0x33567c[_0xae2a('0xf')](request('Command',{'command':util[_0xae2a('0x10')](_0xae2a('0x11'),_0x31fba5[_0x4281b2])})[_0xae2a('0x7')](function(_0x104d7c){return _0x104d7c&&_0x104d7c[_0xae2a('0x12')]&&_0x104d7c[_0xae2a('0x12')]['indexOf'](_0xae2a('0x13'))>=0x0?!![]:![];})[_0xae2a('0xa')](function(_0x5e2323){logger[_0xae2a('0x8')]('[%s][INTERVAL]\x20%s',_0x19c676,_0x31fba5[_0x4281b2]);}));}BPromise[_0xae2a('0x14')](_0x33567c)['then'](function(_0x4b36a6){var _0x24c707=_[_0xae2a('0x15')](_0x4b36a6);logger[_0xae2a('0xc')](_0xae2a('0x16'),_0x19c676,_0x31fba5[_0xae2a('0x17')](_0xae2a('0x18')),_0x24c707);_0x2967f8[_0xae2a('0x19')](_0x24c707);})[_0xae2a('0xa')](function(_0x2395f7){console[_0xae2a('0x1a')](_0x2395f7);logger[_0xae2a('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x19c676,_0x31fba5[_0xae2a('0x17')](_0xae2a('0x18')),_0x2395f7[_0xae2a('0x1b')]);_0x2967f8[_0xae2a('0xd')]();});};}; \ No newline at end of file +var _0x2fc7=['[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','then','indexOf','true'];(function(_0x175600,_0x317530){var _0x234437=function(_0x2bbb12){while(--_0x2bbb12){_0x175600['push'](_0x175600['shift']());}};_0x234437(++_0x317530);}(_0x2fc7,0x13b));var _0x72fc=function(_0x593353,_0xfce05e){_0x593353=_0x593353-0x0;var _0x45cb94=_0x2fc7[_0x593353];return _0x45cb94;};'use strict';var util=require(_0x72fc('0x0'));var BPromise=require(_0x72fc('0x1'));var jayson=require(_0x72fc('0x2'));var _=require(_0x72fc('0x3'));var logger=require(_0x72fc('0x4'))(_0x72fc('0x5'));var client=jayson['client'][_0x72fc('0x6')]({'port':0x232a});function request(_0x5c240e,_0xed2faa){return new BPromise(function(_0x2c69f7,_0x30992f){return client[_0x72fc('0x7')](_0x5c240e,_0xed2faa)['then'](function(_0x529fc6){if(_0x529fc6[_0x72fc('0x8')]){return _0x30992f(_0x529fc6[_0x72fc('0x8')][_0x72fc('0x9')]);}else{return _0x2c69f7(_0x529fc6[_0x72fc('0xa')]);}})[_0x72fc('0xb')](function(_0x3d959e){return _0x30992f(_0x3d959e);});});}exports[_0x72fc('0xc')]=function(_0x107761,_0x5e9d8d,_0x151f5e){return function(_0x4fe675){if(_0x151f5e[_0x72fc('0xd')]&&!_0x151f5e[_0x72fc('0xd')][_0x107761]){logger[_0x72fc('0xe')](_0x72fc('0xf'),_0x107761);return _0x4fe675[_0x72fc('0x10')]();}var _0x5d6bcf=[];for(var _0x5f009a=0x0;_0x5f009a<_0x5e9d8d[_0x72fc('0x11')];_0x5f009a+=0x1){_0x5d6bcf[_0x72fc('0x12')](request(_0x72fc('0x13'),{'command':util[_0x72fc('0x14')](_0x72fc('0x15'),_0x5e9d8d[_0x5f009a])})[_0x72fc('0x16')](function(_0x488e33){return _0x488e33&&_0x488e33[_0x72fc('0x9')]&&_0x488e33[_0x72fc('0x9')][_0x72fc('0x17')](_0x72fc('0x18'))>=0x0?!![]:![];})['catch'](function(_0x507eb4){logger[_0x72fc('0x8')](_0x72fc('0x19'),_0x107761,_0x5e9d8d[_0x5f009a]);}));}BPromise[_0x72fc('0x1a')](_0x5d6bcf)[_0x72fc('0x16')](function(_0x38d8ea){var _0x2e20c3=_[_0x72fc('0x1b')](_0x38d8ea);logger['info'](_0x72fc('0x1c'),_0x107761,_0x5e9d8d[_0x72fc('0x1d')](_0x72fc('0x1e')),_0x2e20c3);_0x4fe675[_0x72fc('0x1f')](_0x2e20c3);})[_0x72fc('0xb')](function(_0x4f830d){console[_0x72fc('0x20')](_0x4f830d);logger[_0x72fc('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x107761,_0x5e9d8d['join']('\x20|\x20'),_0x4f830d[_0x72fc('0x21')]);_0x4fe675[_0x72fc('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 8f01dbb..ea8c364 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 _0x2f68=['called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','complete','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','uniqueid','channel','membername','interface','lastevent','queue','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt'];(function(_0x1c04c5,_0x2514e5){var _0x1b6ef4=function(_0x40961f){while(--_0x40961f){_0x1c04c5['push'](_0x1c04c5['shift']());}};_0x1b6ef4(++_0x2514e5);}(_0x2f68,0x9a));var _0x82f6=function(_0x219e5d,_0x184f6d){_0x219e5d=_0x219e5d-0x0;var _0x5bbbe0=_0x2f68[_0x219e5d];return _0x5bbbe0;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var utils=require(_0x82f6('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24c877,_0x3a9c8f){utils['info'](util[_0x82f6('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x24c877[_0x82f6('0x3')],_0x24c877[_0x82f6('0x4')],_0x24c877['queue'],_0x24c877[_0x82f6('0x5')],_0x24c877[_0x82f6('0x6')],_0x24c877['calleridnum'],_0x24c877['connectedlinenum'],_0x24c877[_0x82f6('0x7')]));if(_0x24c877['queue']){utils['getVoiceQueueByName'](_0x24c877[_0x82f6('0x8')])[_0x82f6('0x9')](function(_0x250d71){if(_0x250d71){_0x24c877['type']=_0x250d71[_0x82f6('0xa')];_0x24c877[_0x82f6('0xb')]=_0x24c877['agentcomplete']?_0x250d71[_0x82f6('0xc')]:![];_0x24c877[_0x82f6('0xd')]=_0x24c877[_0x82f6('0xb')]?_0x250d71[_0x82f6('0xe')]:0x0;}utils[_0x82f6('0xf')](_0x82f6('0x10'),_0x24c877);});}else{utils['request'](_0x82f6('0x10'),_0x24c877);}if(_0x3a9c8f){delete transfers[_0x24c877[_0x82f6('0x3')]];}else{delete agents[_0x24c877['destuniqueid']];}}exports[_0x82f6('0x11')]=function(_0x1f8bf5){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x13'),_0x1f8bf5[_0x82f6('0x3')]),_0x1f8bf5);agents[_0x1f8bf5[_0x82f6('0x14')]]=_0x1f8bf5;agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x15')]=utils['now']();agents[_0x1f8bf5[_0x82f6('0x14')]]['lastevent']=_0x82f6('0x16');agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x17')]=null;agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x18')]=null;utils[_0x82f6('0x19')](util[_0x82f6('0x2')](_0x82f6('0x1a'),_0x1f8bf5[_0x82f6('0x3')],agents[_0x1f8bf5[_0x82f6('0x14')]][_0x82f6('0x5')],_0x1f8bf5[_0x82f6('0x14')]));}catch(_0x2652a9){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')]('[%s][agents][agentcalled]',_0x1f8bf5[_0x82f6('0x3')]),_0x2652a9);}};exports[_0x82f6('0x1c')]=function(_0x55cbce){try{if(!_[_0x82f6('0x1d')](agents[_0x55cbce[_0x82f6('0x14')]])){utils[_0x82f6('0x12')](util[_0x82f6('0x2')]('[%s][agents][agentringnoanswer]',_0x55cbce[_0x82f6('0x3')]),_0x55cbce);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x1e'),_0x55cbce['uniqueid'],agents[_0x55cbce['destuniqueid']][_0x82f6('0x5')],_0x55cbce[_0x82f6('0x14')]));agents[_0x55cbce['destuniqueid']]['agentringnoanswer']=!![];agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x1f')]=utils['now']();agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x7')]='timeout';agents[_0x55cbce['destuniqueid']][_0x82f6('0x20')]='timeout';agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x21')]=_0x55cbce['ringtime']?parseInt(_0x55cbce[_0x82f6('0x22')])/0x3e8:0x0;agents[_0x55cbce[_0x82f6('0x14')]][_0x82f6('0x23')]=0x0;unanswered[_0x82f6('0x24')](_0x55cbce['destuniqueid']);}}catch(_0x40a071){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x25'),_0x55cbce[_0x82f6('0x3')]),_0x40a071);}};exports[_0x82f6('0x26')]=function(_0x27e473){try{_[_0x82f6('0x27')](agents,function(_0x1e1aa4,_0x402449){if(_0x1e1aa4[_0x82f6('0x3')]==_0x27e473[_0x82f6('0x3')]&&!_[_0x82f6('0x28')](unanswered,_0x1e1aa4[_0x82f6('0x14')])){utils['debug'](util[_0x82f6('0x2')](_0x82f6('0x29'),_0x27e473[_0x82f6('0x3')]),_0x27e473);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x2a'),_0x27e473[_0x82f6('0x3')],_0x1e1aa4[_0x82f6('0x5')],_0x1e1aa4[_0x82f6('0x14')]));_0x1e1aa4[_0x82f6('0x1c')]=!![];_0x1e1aa4[_0x82f6('0x1f')]=utils[_0x82f6('0x2b')]();_0x1e1aa4[_0x82f6('0x7')]=_0x82f6('0x2c');_0x1e1aa4[_0x82f6('0x20')]=_0x82f6('0x2c');_0x1e1aa4[_0x82f6('0x21')]=_0x27e473[_0x82f6('0x21')];_0x1e1aa4['talktime']=0x0;writeDB(_0x1e1aa4);}});}catch(_0x13a409){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x29'),_0x27e473[_0x82f6('0x3')]),_0x13a409);}};exports[_0x82f6('0x2d')]=function(_0x34c2f1){try{if(agents[_0x34c2f1[_0x82f6('0x14')]]){utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x2e'),_0x34c2f1[_0x82f6('0x3')]),_0x34c2f1);utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x34c2f1[_0x82f6('0x3')],agents[_0x34c2f1['destuniqueid']]['membername'],_0x34c2f1[_0x82f6('0x14')]));agents[_0x34c2f1[_0x82f6('0x14')]]['agentconnectAt']=utils[_0x82f6('0x2b')]();agents[_0x34c2f1[_0x82f6('0x14')]][_0x82f6('0x17')]=_0x34c2f1['connectedlinenum'];agents[_0x34c2f1[_0x82f6('0x14')]]['connectedlinename']=_0x34c2f1[_0x82f6('0x18')];agents[_0x34c2f1['destuniqueid']][_0x82f6('0x21')]=_0x34c2f1['ringtime'];agents[_0x34c2f1[_0x82f6('0x14')]][_0x82f6('0x7')]='connect';_[_0x82f6('0x27')](agents,function(_0x368c11,_0x3e7c53){if(_0x368c11[_0x82f6('0x14')]!=_0x34c2f1['destuniqueid']&&_0x368c11[_0x82f6('0x3')]==_0x34c2f1[_0x82f6('0x3')]){_0x368c11[_0x82f6('0x23')]=0x0;_0x368c11[_0x82f6('0x21')]=_0x34c2f1['ringtime'];_0x368c11[_0x82f6('0x1c')]=!![];_0x368c11[_0x82f6('0x1f')]=utils['now']();_0x368c11[_0x82f6('0x7')]=_0x82f6('0x2f');_0x368c11[_0x82f6('0x20')]=_0x82f6('0x2f');_0x368c11[_0x82f6('0x30')]=_0x34c2f1['destuniqueid'];_0x368c11[_0x82f6('0x31')]=_0x34c2f1['membername'];writeDB(_0x368c11);}});}}catch(_0x139614){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x2e'),_0x34c2f1[_0x82f6('0x3')]),_0x139614);}};exports[_0x82f6('0x32')]=function(_0x43fefc){try{if(!_['isNil'](agents[_0x43fefc[_0x82f6('0x14')]])){utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x33'),_0x43fefc['uniqueid']),_0x43fefc);utils[_0x82f6('0x19')](util['format'](_0x82f6('0x34'),_0x43fefc[_0x82f6('0x3')],agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x5')],_0x43fefc[_0x82f6('0x14')]));agents[_0x43fefc[_0x82f6('0x14')]]['agentcomplete']=!![];agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x35')]=utils[_0x82f6('0x2b')]();agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x23')]=utils[_0x82f6('0x36')](agents[_0x43fefc[_0x82f6('0x14')]][_0x82f6('0x35')],agents[_0x43fefc['destuniqueid']][_0x82f6('0x37')]);agents[_0x43fefc[_0x82f6('0x14')]]['reason']=_0x43fefc[_0x82f6('0x20')];agents[_0x43fefc['destuniqueid']][_0x82f6('0x7')]='complete';writeDB(agents[_0x43fefc[_0x82f6('0x14')]]);}}catch(_0x31dec7){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x33'),_0x43fefc[_0x82f6('0x3')]),_0x31dec7);}};exports['blindtransfer']=function(_0x3cb1f0){try{if(!_[_0x82f6('0x1d')](agents[_0x3cb1f0['transfereruniqueid']])){utils['debug'](util[_0x82f6('0x2')](_0x82f6('0x38'),_0x3cb1f0[_0x82f6('0x3')]),_0x3cb1f0);utils['info'](util[_0x82f6('0x2')](_0x82f6('0x39'),_0x3cb1f0[_0x82f6('0x3')],agents[_0x3cb1f0[_0x82f6('0x3a')]]['membername'],agents[_0x3cb1f0['transfereruniqueid']][_0x82f6('0x3')]));agents[_0x3cb1f0[_0x82f6('0x3a')]][_0x82f6('0x3b')]=!![];agents[_0x3cb1f0['transfereruniqueid']][_0x82f6('0x3c')]=_0x82f6('0x3d');agents[_0x3cb1f0['transfereruniqueid']]['transferexten']=_0x3cb1f0['extension'];agents[_0x3cb1f0[_0x82f6('0x3a')]]['transferuniqueid']=agents[_0x3cb1f0[_0x82f6('0x3a')]]['uniqueid'];}}catch(_0x33c359){utils['error'](util[_0x82f6('0x2')]('[%s][agents][blindtransfer]',_0x3cb1f0[_0x82f6('0x3')]),_0x33c359);}};exports[_0x82f6('0x3e')]=function(_0x44de65){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x3f'),_0x44de65['origtransfereruniqueid']),_0x44de65);if(_0x44de65[_0x82f6('0x40')]==_0x44de65[_0x82f6('0x41')]){if(!_[_0x82f6('0x1d')](agents[_0x44de65['secondtransfereruniqueid']])){utils['info'](util[_0x82f6('0x2')](_0x82f6('0x42'),_0x44de65[_0x82f6('0x40')],agents[_0x44de65[_0x82f6('0x43')]]['membername']));agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x3b')]=!![];agents[_0x44de65[_0x82f6('0x43')]]['transfertype']='ATTENDED';agents[_0x44de65['secondtransfereruniqueid']][_0x82f6('0x44')]=_0x44de65[_0x82f6('0x45')];agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x46')]=_0x44de65[_0x82f6('0x40')];}if(_0x44de65[_0x82f6('0x47')]&&agents[_0x44de65[_0x82f6('0x47')]]){agents[_0x44de65[_0x82f6('0x47')]]['agententerreason']=0x1;transfers[_0x44de65[_0x82f6('0x47')]]=_[_0x82f6('0x48')](agents[_0x44de65[_0x82f6('0x47')]]);transfers[_0x44de65[_0x82f6('0x47')]]['calleridnum']=agents[_0x44de65['secondtransfereruniqueid']][_0x82f6('0x49')];transfers[_0x44de65[_0x82f6('0x47')]]['calleridname']=agents[_0x44de65[_0x82f6('0x43')]][_0x82f6('0x4a')];transfers[_0x44de65[_0x82f6('0x47')]]['agentcalledAt']=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x47')]][_0x82f6('0x37')]=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x47')]][_0x82f6('0x21')]=0x0;transfers[_0x44de65['transfereeuniqueid']][_0x82f6('0x4b')]=0x2;}}else if(_0x44de65[_0x82f6('0x43')]==_0x44de65[_0x82f6('0x4c')]){if(!_[_0x82f6('0x1d')](agents[_0x44de65[_0x82f6('0x40')]])){utils['info'](util[_0x82f6('0x2')](_0x82f6('0x42'),_0x44de65[_0x82f6('0x40')],agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x5')]));agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x3b')]=!![];agents[_0x44de65[_0x82f6('0x40')]]['transfertype']=_0x82f6('0x4d');agents[_0x44de65['origtransfereruniqueid']][_0x82f6('0x44')]=_0x44de65[_0x82f6('0x4e')];agents[_0x44de65['origtransfereruniqueid']][_0x82f6('0x46')]=_0x44de65[_0x82f6('0x43')];}if(_0x44de65[_0x82f6('0x4f')]&&agents[_0x44de65['transfertargetuniqueid']]){agents[_0x44de65['transfertargetuniqueid']][_0x82f6('0x4b')]=0x1;transfers[_0x44de65[_0x82f6('0x4f')]]=_['clone'](agents[_0x44de65['transfertargetuniqueid']]);transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x49')]=agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x49')];transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x4a')]=agents[_0x44de65[_0x82f6('0x40')]][_0x82f6('0x4a')];transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x15')]=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x4f')]]['agentconnectAt']=utils[_0x82f6('0x2b')]();transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x21')]=0x0;transfers[_0x44de65[_0x82f6('0x4f')]][_0x82f6('0x4b')]=0x2;}}}catch(_0x4ef838){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x3f'),_0x44de65['origtransfereruniqueid']),_0x4ef838);}};exports[_0x82f6('0x50')]=function(_0x192dc7){try{utils[_0x82f6('0x12')](util[_0x82f6('0x2')](_0x82f6('0x51'),_0x192dc7[_0x82f6('0x3')]),_0x192dc7);if(agents[_0x192dc7[_0x82f6('0x3')]]&&agents[_0x192dc7['uniqueid']][_0x82f6('0x20')]==='timeout'){if(_0x192dc7[_0x82f6('0x52')]==='21'){agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]=_0x82f6('0x53');agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]=_0x82f6('0x53');}utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x192dc7[_0x82f6('0x3')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')],agents[_0x192dc7[_0x82f6('0x3')]]['lastevent']));writeDB(agents[_0x192dc7[_0x82f6('0x3')]]);var _0x443547=unanswered['indexOf'](_0x192dc7['uniqueid']);if(_0x443547>-0x1){unanswered[_0x82f6('0x54')](_0x443547,0x1);}}if(transfers[_0x192dc7[_0x82f6('0x3')]]){transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x32')]=!![];transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x35')]=utils['now']();transfers[_0x192dc7[_0x82f6('0x3')]]['talktime']=utils[_0x82f6('0x36')](transfers[_0x192dc7['uniqueid']][_0x82f6('0x35')],transfers[_0x192dc7['uniqueid']][_0x82f6('0x37')]);transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]='agent';transfers[_0x192dc7[_0x82f6('0x3')]]['lastevent']=_0x82f6('0x55');utils[_0x82f6('0x19')](util[_0x82f6('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x192dc7[_0x82f6('0x3')],transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],transfers[_0x192dc7['uniqueid']]['reason'],transfers[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]));writeDB(transfers[_0x192dc7[_0x82f6('0x3')]],!![]);}if(agents[_0x192dc7[_0x82f6('0x3')]]&&agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x37')]){agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x32')]=!![];agents[_0x192dc7['uniqueid']][_0x82f6('0x35')]=utils[_0x82f6('0x2b')]();agents[_0x192dc7['uniqueid']][_0x82f6('0x23')]=utils[_0x82f6('0x36')](agents[_0x192dc7[_0x82f6('0x3')]]['agentcompleteAt'],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x37')]);agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x20')]=agents[_0x192dc7['uniqueid']][_0x82f6('0x3b')]?_0x82f6('0x3b'):_0x82f6('0x56');agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x7')]=_0x82f6('0x55');utils['info'](util[_0x82f6('0x2')](_0x82f6('0x57'),_0x192dc7[_0x82f6('0x3')],agents[_0x192dc7[_0x82f6('0x3')]][_0x82f6('0x5')],agents[_0x192dc7['uniqueid']][_0x82f6('0x20')],agents[_0x192dc7['uniqueid']][_0x82f6('0x7')]));writeDB(agents[_0x192dc7[_0x82f6('0x3')]]);}}catch(_0x425e33){utils[_0x82f6('0x1b')](util[_0x82f6('0x2')](_0x82f6('0x51'),_0x192dc7[_0x82f6('0x3')]),_0x425e33);}}; \ No newline at end of file +var _0xd404=['channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','agentconnect','info','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','secondtransfererlinkedid','transfertargetuniqueid','calleridname','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','agent','complete','[%s][agents][hangup]','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd404,0x15b));var _0x4d40=function(_0x160c49,_0x639006){_0x160c49=_0x160c49-0x0;var _0x25459a=_0xd404[_0x160c49];return _0x25459a;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xb6576c,_0x2322e5){utils['info'](util[_0x4d40('0x2')](_0x4d40('0x3'),_0xb6576c[_0x4d40('0x4')],_0xb6576c[_0x4d40('0x5')],_0xb6576c[_0x4d40('0x6')],_0xb6576c[_0x4d40('0x7')],_0xb6576c[_0x4d40('0x8')],_0xb6576c[_0x4d40('0x9')],_0xb6576c[_0x4d40('0xa')],_0xb6576c['lastevent']));if(_0xb6576c[_0x4d40('0x6')]){utils[_0x4d40('0xb')](_0xb6576c['queue'])[_0x4d40('0xc')](function(_0x5e31bc){if(_0x5e31bc){_0xb6576c['type']=_0x5e31bc[_0x4d40('0xd')];_0xb6576c[_0x4d40('0xe')]=_0xb6576c[_0x4d40('0xf')]?_0x5e31bc[_0x4d40('0x10')]:![];_0xb6576c[_0x4d40('0x11')]=_0xb6576c[_0x4d40('0xe')]?_0x5e31bc[_0x4d40('0x12')]:0x0;}utils[_0x4d40('0x13')](_0x4d40('0x14'),_0xb6576c);});}else{utils[_0x4d40('0x13')](_0x4d40('0x14'),_0xb6576c);}if(_0x2322e5){delete transfers[_0xb6576c[_0x4d40('0x4')]];}else{delete agents[_0xb6576c[_0x4d40('0x15')]];}}exports[_0x4d40('0x16')]=function(_0x5162f9){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x18'),_0x5162f9[_0x4d40('0x4')]),_0x5162f9);agents[_0x5162f9[_0x4d40('0x15')]]=_0x5162f9;agents[_0x5162f9['destuniqueid']][_0x4d40('0x19')]=utils[_0x4d40('0x1a')]();agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0x1b')]=_0x4d40('0x1c');agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0xa')]=null;agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0x1d')]=null;utils['info'](util['format'](_0x4d40('0x1e'),_0x5162f9[_0x4d40('0x4')],agents[_0x5162f9['destuniqueid']][_0x4d40('0x7')],_0x5162f9[_0x4d40('0x15')]));}catch(_0x4eec1d){utils[_0x4d40('0x1f')](util['format'](_0x4d40('0x18'),_0x5162f9[_0x4d40('0x4')]),_0x4eec1d);}};exports['agentringnoanswer']=function(_0x57c997){try{if(!_[_0x4d40('0x20')](agents[_0x57c997[_0x4d40('0x15')]])){utils['debug'](util[_0x4d40('0x2')](_0x4d40('0x21'),_0x57c997[_0x4d40('0x4')]),_0x57c997);utils['info'](util[_0x4d40('0x2')](_0x4d40('0x22'),_0x57c997[_0x4d40('0x4')],agents[_0x57c997['destuniqueid']]['membername'],_0x57c997[_0x4d40('0x15')]));agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x23')]=!![];agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x24')]=utils['now']();agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x1b')]='timeout';agents[_0x57c997['destuniqueid']][_0x4d40('0x25')]=_0x4d40('0x26');agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x27')]=_0x57c997[_0x4d40('0x28')]?parseInt(_0x57c997[_0x4d40('0x28')])/0x3e8:0x0;agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x29')]=0x0;unanswered[_0x4d40('0x2a')](_0x57c997[_0x4d40('0x15')]);}}catch(_0x1c0fcf){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x57c997[_0x4d40('0x4')]),_0x1c0fcf);}};exports[_0x4d40('0x2b')]=function(_0x1ac240){try{_[_0x4d40('0x2c')](agents,function(_0x598ca9,_0x18e601){if(_0x598ca9[_0x4d40('0x4')]==_0x1ac240[_0x4d40('0x4')]&&!_['includes'](unanswered,_0x598ca9[_0x4d40('0x15')])){utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x2d'),_0x1ac240[_0x4d40('0x4')]),_0x1ac240);utils['info'](util[_0x4d40('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ac240[_0x4d40('0x4')],_0x598ca9[_0x4d40('0x7')],_0x598ca9[_0x4d40('0x15')]));_0x598ca9[_0x4d40('0x23')]=!![];_0x598ca9['agentringnoanswerAt']=utils['now']();_0x598ca9[_0x4d40('0x1b')]=_0x4d40('0x2e');_0x598ca9[_0x4d40('0x25')]=_0x4d40('0x2e');_0x598ca9['holdtime']=_0x1ac240[_0x4d40('0x27')];_0x598ca9['talktime']=0x0;writeDB(_0x598ca9);}});}catch(_0x2fde16){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')](_0x4d40('0x2d'),_0x1ac240[_0x4d40('0x4')]),_0x2fde16);}};exports[_0x4d40('0x2f')]=function(_0x1d1ba9){try{if(agents[_0x1d1ba9[_0x4d40('0x15')]]){utils[_0x4d40('0x17')](util[_0x4d40('0x2')]('[%s][agents][agentconnect]',_0x1d1ba9[_0x4d40('0x4')]),_0x1d1ba9);utils[_0x4d40('0x30')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1d1ba9['uniqueid'],agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x7')],_0x1d1ba9['destuniqueid']));agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x31')]=utils[_0x4d40('0x1a')]();agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0xa')]=_0x1d1ba9['connectedlinenum'];agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x1d')]=_0x1d1ba9['connectedlinename'];agents[_0x1d1ba9['destuniqueid']][_0x4d40('0x27')]=_0x1d1ba9[_0x4d40('0x28')];agents[_0x1d1ba9['destuniqueid']][_0x4d40('0x1b')]=_0x4d40('0x32');_['forIn'](agents,function(_0x1e8427,_0x1a9586){if(_0x1e8427['destuniqueid']!=_0x1d1ba9[_0x4d40('0x15')]&&_0x1e8427[_0x4d40('0x4')]==_0x1d1ba9['uniqueid']){_0x1e8427[_0x4d40('0x29')]=0x0;_0x1e8427['holdtime']=_0x1d1ba9[_0x4d40('0x28')];_0x1e8427[_0x4d40('0x23')]=!![];_0x1e8427[_0x4d40('0x24')]=utils[_0x4d40('0x1a')]();_0x1e8427[_0x4d40('0x1b')]=_0x4d40('0x33');_0x1e8427[_0x4d40('0x25')]=_0x4d40('0x33');_0x1e8427[_0x4d40('0x34')]=_0x1d1ba9['destuniqueid'];_0x1e8427[_0x4d40('0x35')]=_0x1d1ba9[_0x4d40('0x7')];writeDB(_0x1e8427);}});}}catch(_0x1c2fa8){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')]('[%s][agents][agentconnect]',_0x1d1ba9[_0x4d40('0x4')]),_0x1c2fa8);}};exports['agentcomplete']=function(_0x2e7f75){try{if(!_[_0x4d40('0x20')](agents[_0x2e7f75[_0x4d40('0x15')]])){utils[_0x4d40('0x17')](util['format'](_0x4d40('0x36'),_0x2e7f75[_0x4d40('0x4')]),_0x2e7f75);utils['info'](util[_0x4d40('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2e7f75[_0x4d40('0x4')],agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x7')],_0x2e7f75[_0x4d40('0x15')]));agents[_0x2e7f75['destuniqueid']][_0x4d40('0xf')]=!![];agents[_0x2e7f75['destuniqueid']][_0x4d40('0x37')]=utils[_0x4d40('0x1a')]();agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x29')]=utils['diffTime'](agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x37')],agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x31')]);agents[_0x2e7f75['destuniqueid']][_0x4d40('0x25')]=_0x2e7f75[_0x4d40('0x25')];agents[_0x2e7f75['destuniqueid']][_0x4d40('0x1b')]='complete';writeDB(agents[_0x2e7f75[_0x4d40('0x15')]]);}}catch(_0x1777e8){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')](_0x4d40('0x36'),_0x2e7f75[_0x4d40('0x4')]),_0x1777e8);}};exports[_0x4d40('0x38')]=function(_0x37b6bf){try{if(!_[_0x4d40('0x20')](agents[_0x37b6bf['transfereruniqueid']])){utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x39'),_0x37b6bf[_0x4d40('0x4')]),_0x37b6bf);utils[_0x4d40('0x30')](util['format'](_0x4d40('0x3a'),_0x37b6bf[_0x4d40('0x4')],agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x7')],agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x4')]));agents[_0x37b6bf[_0x4d40('0x3b')]][_0x4d40('0x3c')]=!![];agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x3d')]=_0x4d40('0x3e');agents[_0x37b6bf[_0x4d40('0x3b')]][_0x4d40('0x3f')]=_0x37b6bf[_0x4d40('0x40')];agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x41')]=agents[_0x37b6bf[_0x4d40('0x3b')]]['uniqueid'];}}catch(_0x1000f4){utils['error'](util[_0x4d40('0x2')]('[%s][agents][blindtransfer]',_0x37b6bf[_0x4d40('0x4')]),_0x1000f4);}};exports[_0x4d40('0x42')]=function(_0x539df4){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x43'),_0x539df4[_0x4d40('0x44')]),_0x539df4);if(_0x539df4[_0x4d40('0x44')]==_0x539df4[_0x4d40('0x45')]){if(!_[_0x4d40('0x20')](agents[_0x539df4[_0x4d40('0x46')]])){utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x47'),_0x539df4[_0x4d40('0x44')],agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x7')]));agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x3c')]=!![];agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x3d')]=_0x4d40('0x48');agents[_0x539df4['secondtransfereruniqueid']][_0x4d40('0x3f')]=_0x539df4[_0x4d40('0x49')];agents[_0x539df4['secondtransfereruniqueid']]['transferuniqueid']=_0x539df4[_0x4d40('0x44')];}if(_0x539df4[_0x4d40('0x4a')]&&agents[_0x539df4['transfereeuniqueid']]){agents[_0x539df4['transfereeuniqueid']][_0x4d40('0x4b')]=0x1;transfers[_0x539df4['transfereeuniqueid']]=_[_0x4d40('0x4c')](agents[_0x539df4['transfereeuniqueid']]);transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x9')]=agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x9')];transfers[_0x539df4[_0x4d40('0x4a')]]['calleridname']=agents[_0x539df4['secondtransfereruniqueid']]['calleridname'];transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x19')]=utils[_0x4d40('0x1a')]();transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x31')]=utils['now']();transfers[_0x539df4[_0x4d40('0x4a')]]['holdtime']=0x0;transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x4b')]=0x2;}}else if(_0x539df4[_0x4d40('0x46')]==_0x539df4[_0x4d40('0x4d')]){if(!_[_0x4d40('0x20')](agents[_0x539df4[_0x4d40('0x44')]])){utils['info'](util['format'](_0x4d40('0x47'),_0x539df4[_0x4d40('0x44')],agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x7')]));agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x3c')]=!![];agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x3d')]='ATTENDED';agents[_0x539df4[_0x4d40('0x44')]]['transferexten']=_0x539df4['secondtransfererexten'];agents[_0x539df4['origtransfereruniqueid']][_0x4d40('0x41')]=_0x539df4[_0x4d40('0x46')];}if(_0x539df4[_0x4d40('0x4e')]&&agents[_0x539df4[_0x4d40('0x4e')]]){agents[_0x539df4['transfertargetuniqueid']][_0x4d40('0x4b')]=0x1;transfers[_0x539df4[_0x4d40('0x4e')]]=_[_0x4d40('0x4c')](agents[_0x539df4[_0x4d40('0x4e')]]);transfers[_0x539df4[_0x4d40('0x4e')]]['calleridnum']=agents[_0x539df4['origtransfereruniqueid']][_0x4d40('0x9')];transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x4f')]=agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x4f')];transfers[_0x539df4['transfertargetuniqueid']]['agentcalledAt']=utils[_0x4d40('0x1a')]();transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x31')]=utils[_0x4d40('0x1a')]();transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x27')]=0x0;transfers[_0x539df4[_0x4d40('0x4e')]][_0x4d40('0x4b')]=0x2;}}}catch(_0x3bce3d){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')]('[%s][agents][attendedtransfer]',_0x539df4['origtransfereruniqueid']),_0x3bce3d);}};exports['hangup']=function(_0x13872b){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')]('[%s][agents][hangup]',_0x13872b[_0x4d40('0x4')]),_0x13872b);if(agents[_0x13872b[_0x4d40('0x4')]]&&agents[_0x13872b['uniqueid']]['reason']===_0x4d40('0x26')){if(_0x13872b[_0x4d40('0x50')]==='21'){agents[_0x13872b['uniqueid']][_0x4d40('0x25')]=_0x4d40('0x51');agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]=_0x4d40('0x51');}utils[_0x4d40('0x30')](util['format'](_0x4d40('0x52'),_0x13872b['uniqueid'],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x7')],agents[_0x13872b['uniqueid']][_0x4d40('0x25')],agents[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(agents[_0x13872b[_0x4d40('0x4')]]);var _0x7df23=unanswered['indexOf'](_0x13872b[_0x4d40('0x4')]);if(_0x7df23>-0x1){unanswered[_0x4d40('0x53')](_0x7df23,0x1);}}if(transfers[_0x13872b[_0x4d40('0x4')]]){transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0xf')]=!![];transfers[_0x13872b['uniqueid']][_0x4d40('0x37')]=utils[_0x4d40('0x1a')]();transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x29')]=utils[_0x4d40('0x54')](transfers[_0x13872b[_0x4d40('0x4')]]['agentcompleteAt'],transfers[_0x13872b[_0x4d40('0x4')]]['agentconnectAt']);transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x25')]=_0x4d40('0x55');transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]='complete';utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x52'),_0x13872b[_0x4d40('0x4')],transfers[_0x13872b['uniqueid']][_0x4d40('0x7')],transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x25')],transfers[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(transfers[_0x13872b[_0x4d40('0x4')]],!![]);}if(agents[_0x13872b['uniqueid']]&&agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x31')]){agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0xf')]=!![];agents[_0x13872b['uniqueid']]['agentcompleteAt']=utils[_0x4d40('0x1a')]();agents[_0x13872b[_0x4d40('0x4')]]['talktime']=utils[_0x4d40('0x54')](agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x37')],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x31')]);agents[_0x13872b['uniqueid']][_0x4d40('0x25')]=agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x3c')]?_0x4d40('0x3c'):_0x4d40('0x55');agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]=_0x4d40('0x56');utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x52'),_0x13872b['uniqueid'],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x7')],agents[_0x13872b['uniqueid']][_0x4d40('0x25')],agents[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(agents[_0x13872b['uniqueid']]);}}catch(_0x33b8f3){utils[_0x4d40('0x1f')](util['format'](_0x4d40('0x57'),_0x13872b[_0x4d40('0x4')]),_0x33b8f3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index db94154..c229185 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 _0x4d0a=['error','[%s][calls][newchannel]','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','channelstate','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','interface','calleridnum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','now'];(function(_0x1fe0a4,_0x26be8a){var _0x379c3e=function(_0x21557e){while(--_0x21557e){_0x1fe0a4['push'](_0x1fe0a4['shift']());}};_0x379c3e(++_0x26be8a);}(_0x4d0a,0x176));var _0xa4d0=function(_0x27aa07,_0x1e833f){_0x27aa07=_0x27aa07-0x0;var _0x3804ca=_0x4d0a[_0x27aa07];return _0x3804ca;};'use strict';var _=require(_0xa4d0('0x0'));var util=require(_0xa4d0('0x1'));var utils=require(_0xa4d0('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xa4d0('0x3'),'FAILED','FAILED',_0xa4d0('0x3'),_0xa4d0('0x3'),_0xa4d0('0x3'),_0xa4d0('0x4'),_0xa4d0('0x5'),_0xa4d0('0x6'),_0xa4d0('0x6'),_0xa4d0('0x6')];var channels={};function writeDB(_0x651319){var _0xa93428;if(transfers[_0xa4d0('0x7')][_0x651319[_0xa4d0('0x8')]]){_0xa93428=_0x651319['uniqueid'];_0x651319[_0xa4d0('0x8')]=transfers[_0xa4d0('0x7')][_0x651319[_0xa4d0('0x8')]][_0xa4d0('0x9')];}utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x651319[_0xa4d0('0x8')],_0x651319[_0xa4d0('0xc')],_0x651319[_0xa4d0('0xd')],_0x651319[_0xa4d0('0xe')],_0x651319[_0xa4d0('0xf')],_0x651319[_0xa4d0('0x10')],_0x651319['connectedlinenum'],_0x651319[_0xa4d0('0x11')]));if(_0x651319[_0xa4d0('0x12')]){utils['getUserByInternal'](_0x651319[_0xa4d0('0x12')])[_0xa4d0('0x13')](function(_0x447e68){if(_0x447e68){_0x651319[_0xa4d0('0x14')]=_0x447e68['id'];}utils['request'](_0xa4d0('0x15'),_0x651319);});}else{utils[_0xa4d0('0x16')](_0xa4d0('0x15'),_0x651319);}if(channels[_0x651319[_0xa4d0('0x8')]]){delete channels[_0x651319[_0xa4d0('0x8')]];}else if(_0xa93428&&channels[_0xa93428]){if(!transfers['blinds'][_0xa93428]['recording'])delete transfers[_0xa4d0('0x7')][_0xa93428];delete channels[_0xa93428];}}exports[_0xa4d0('0x17')]=function(_0x59390d){try{utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')]('[%s][calls][newchannel]',_0x59390d[_0xa4d0('0x8')]),_0x59390d);if(_0x59390d[_0xa4d0('0x8')]==_0x59390d[_0xa4d0('0x19')]&&_0x59390d[_0xa4d0('0xc')]!=_0xa4d0('0x1a')){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x59390d[_0xa4d0('0x8')],_0x59390d[_0xa4d0('0x1b')],_0x59390d[_0xa4d0('0x1c')]));channels[_0x59390d[_0xa4d0('0x8')]]={'uniqueid':_0x59390d[_0xa4d0('0x8')],'accountcode':_0x59390d[_0xa4d0('0x12')],'source':_0x59390d[_0xa4d0('0x10')],'destination':_0x59390d['exten'],'destinationcontext':_0x59390d[_0xa4d0('0x1b')],'channel':_0x59390d[_0xa4d0('0xc')],'starttime':utils[_0xa4d0('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa4d0('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x5c2a4a){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x1f'),_0x59390d[_0xa4d0('0x8')]),_0x5c2a4a);}};exports['newstate']=function(_0x21f83a){try{utils['debug'](util[_0xa4d0('0xb')]('[%s][calls][newstate]',_0x21f83a['uniqueid']),_0x21f83a);if(!_[_0xa4d0('0x20')](channels[_0x21f83a[_0xa4d0('0x8')]])&&_0x21f83a['channelstate']==0x6){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x21f83a[_0xa4d0('0x8')],_0x21f83a[_0xa4d0('0x1b')],_0x21f83a[_0xa4d0('0xc')]));if(_[_0xa4d0('0x20')](channels[_0x21f83a['uniqueid']][_0xa4d0('0x21')])){channels[_0x21f83a['uniqueid']][_0xa4d0('0x21')]=utils[_0xa4d0('0x1d')]();}}else if(!_['isNil'](channels[_0x21f83a['linkedid']])&&_0x21f83a['channelstate']==0x6&&_0x21f83a[_0xa4d0('0x1b')]!=_0xa4d0('0x22')){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x23'),_0x21f83a['uniqueid'],_0x21f83a[_0xa4d0('0x19')],_0x21f83a[_0xa4d0('0x1b')],_0x21f83a[_0xa4d0('0xc')]));channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x12')]=_0x21f83a[_0xa4d0('0x12')];channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x24')]=_0x21f83a[_0xa4d0('0xc')];if(_[_0xa4d0('0x20')](channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x25')])){channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x25')]=utils['now']();}channels[_0x21f83a[_0xa4d0('0x19')]][_0xa4d0('0x26')]=dispositions[_[_0xa4d0('0x27')](_0x21f83a[_0xa4d0('0x28')])]||_0xa4d0('0x4');}}catch(_0x11c104){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x29'),_0x21f83a[_0xa4d0('0x8')]),_0x11c104);}};exports[_0xa4d0('0x2a')]=function(_0x109068){try{if(!_[_0xa4d0('0x20')](channels[_0x109068[_0xa4d0('0x8')]])){utils['debug'](util['format'](_0xa4d0('0x2b'),_0x109068[_0xa4d0('0x8')]),_0x109068);if(_[_0xa4d0('0x20')](channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x2c')])){channels[_0x109068['uniqueid']]['callerid']=_0x109068[_0xa4d0('0x2d')]+'\x20<'+_0x109068['calleridnum']+'>';}utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x2e'),_0x109068['uniqueid'],channels[_0x109068['uniqueid']]['callerid'],_0x109068['cause-txt']));channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x2f')]=utils['now']();channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x30')]=utils[_0xa4d0('0x31')](channels[_0x109068['uniqueid']][_0xa4d0('0x2f')],channels[_0x109068[_0xa4d0('0x8')]]['starttime']);channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x32')]=channels[_0x109068[_0xa4d0('0x8')]][_0xa4d0('0x25')]?utils[_0xa4d0('0x31')](channels[_0x109068['uniqueid']][_0xa4d0('0x2f')],channels[_0x109068[_0xa4d0('0x8')]]['answertime']):0x0;writeDB(channels[_0x109068[_0xa4d0('0x8')]]);}}catch(_0x169092){utils['error'](util['format'](_0xa4d0('0x2b'),_0x109068[_0xa4d0('0x8')]),_0x169092);}};exports['attendedtransfer']=function(_0x2315da){try{if(!_['isNil'](channels[_0x2315da[_0xa4d0('0x33')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x34'),_0x2315da[_0xa4d0('0x35')]),_0x2315da);if(channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0xc')]==_0x2315da[_0xa4d0('0x36')]){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x37'),_0x2315da['origtransfereruniqueid'],_0x2315da[_0xa4d0('0x33')],_0x2315da[_0xa4d0('0x38')]));channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x24')]=_0x2315da[_0xa4d0('0x38')];channels[_0x2315da[_0xa4d0('0x33')]]['userfield']='_attended';}else if(channels[_0x2315da[_0xa4d0('0x33')]]['channel']=_0x2315da[_0xa4d0('0x39')]){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x37'),_0x2315da[_0xa4d0('0x35')],_0x2315da['localtwolinkedid'],_0x2315da[_0xa4d0('0x3a')]));channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x24')]=_0x2315da[_0xa4d0('0x3a')];channels[_0x2315da[_0xa4d0('0x33')]][_0xa4d0('0x3b')]=_0xa4d0('0x3c');}}}catch(_0x53227d){utils[_0xa4d0('0x1e')](util['format'](_0xa4d0('0x34'),_0x2315da['origtransfereruniqueid']),_0x53227d);}};exports['musiconholdstart']=function(_0x3637e4){try{if(!_[_0xa4d0('0x20')](channels[_0x3637e4['uniqueid']])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstart]',_0x3637e4[_0xa4d0('0x8')]),_0x3637e4);channels[_0x3637e4[_0xa4d0('0x8')]][_0xa4d0('0x3d')]=utils[_0xa4d0('0x1d')]();utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3637e4[_0xa4d0('0x8')],channels[_0x3637e4['uniqueid']][_0xa4d0('0x3d')]));}}catch(_0x639164){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x3e'),_0x3637e4[_0xa4d0('0x8')]),_0x639164);}};exports[_0xa4d0('0x3f')]=function(_0x39363e){try{if(!_['isNil'](channels[_0x39363e[_0xa4d0('0x8')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x40'),_0x39363e[_0xa4d0('0x8')]),_0x39363e);if(!_[_0xa4d0('0x20')](channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')])){channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x41')]+=utils['diffTime'](utils[_0xa4d0('0x1d')](),channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')]);utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x39363e[_0xa4d0('0x8')],channels[_0x39363e[_0xa4d0('0x8')]]['mohtime']));delete channels[_0x39363e[_0xa4d0('0x8')]][_0xa4d0('0x3d')];}}}catch(_0x27a45b){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x40'),_0x39363e[_0xa4d0('0x8')]),_0x27a45b);}};exports['varset']=function(_0x21e148){try{if(!_[_0xa4d0('0x20')](channels[_0x21e148[_0xa4d0('0x8')]])){utils['debug'](util[_0xa4d0('0xb')](_0xa4d0('0x42'),_0x21e148[_0xa4d0('0x8')]),_0x21e148);if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x44')])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x46')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmd-phone'])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x47'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x48')]=_0x21e148[_0xa4d0('0x45')];channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x2c')]='\x22'+_0x21e148['value']+'\x22\x20<'+_0x21e148['value']+'>';}if(!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x49')])||!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x4a')])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x21e148[_0xa4d0('0x8')],!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x49')])?_0xa4d0('0x49'):_0xa4d0('0x4a'),_0x21e148['value']));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x2c')]=_0x21e148['value'];}if(!_['isNil'](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x4b')])||!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmcs-queue'])){utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x4c'),_0x21e148[_0xa4d0('0x8')],!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')]['xmd-queue'])?_0xa4d0('0x4b'):'xmcs-queue',_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']][_0xa4d0('0x4d')]=_0xa4d0('0x4e');channels[_0x21e148[_0xa4d0('0x8')]]['lastdata']=_0x21e148['value'];channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0xd')]=!![];}if(!_['isNil'](_0x21e148[_0xa4d0('0x43')]['xmd-contactid'])){utils['info'](util[_0xa4d0('0xb')](_0xa4d0('0x4f'),_0x21e148['uniqueid'],_0x21e148['value']));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x50')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148['variable'][_0xa4d0('0x51')])){utils[_0xa4d0('0xa')](util['format'](_0xa4d0('0x52'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']]['type']=_0x21e148['value'];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x53')])){utils['info'](util[_0xa4d0('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x21e148['uniqueid'],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148[_0xa4d0('0x8')]][_0xa4d0('0x54')]=_0x21e148[_0xa4d0('0x45')];}if(!_[_0xa4d0('0x20')](_0x21e148[_0xa4d0('0x43')][_0xa4d0('0x55')])){utils['info'](util[_0xa4d0('0xb')](_0xa4d0('0x56'),_0x21e148[_0xa4d0('0x8')],_0x21e148[_0xa4d0('0x45')]));channels[_0x21e148['uniqueid']][_0xa4d0('0x55')]=_0x21e148['value'];}}}catch(_0x591a64){utils[_0xa4d0('0x1e')](util[_0xa4d0('0xb')](_0xa4d0('0x42'),_0x21e148[_0xa4d0('0x8')]),_0x591a64);}};exports[_0xa4d0('0x57')]=function(_0x2c6064){try{if(!_[_0xa4d0('0x20')](channels[_0x2c6064[_0xa4d0('0x8')]])){utils[_0xa4d0('0x18')](util[_0xa4d0('0xb')](_0xa4d0('0x58'),_0x2c6064['uniqueid']),_0x2c6064);utils[_0xa4d0('0xa')](util[_0xa4d0('0xb')](_0xa4d0('0x59'),_0x2c6064[_0xa4d0('0x8')],_0x2c6064[_0xa4d0('0x5a')],_0x2c6064[_0xa4d0('0x5b')]));if(_0x2c6064[_0xa4d0('0x5a')][_0xa4d0('0x5c')]()==_0xa4d0('0x5d')&&_[_0xa4d0('0x5e')](_0x2c6064[_0xa4d0('0x5b')]['toLowerCase'](),'cdr')){var _0x21d246=_0x2c6064[_0xa4d0('0x5b')][_0xa4d0('0x5f')]('=');var _0x4d78f0=_0x21d246[0x0][_0xa4d0('0x60')](_0x21d246[0x0][_0xa4d0('0x61')]('(')+0x1,_0x21d246[0x0]['lastIndexOf'](')'));var _0x5820c4=_0x21d246[0x1];channels[_0x2c6064[_0xa4d0('0x8')]][_0x4d78f0]=_0x5820c4;}if(!_['includes']([_0xa4d0('0x2a'),_0xa4d0('0x62'),_0xa4d0('0x63'),_0xa4d0('0x5d'),'gotoif'],_0x2c6064[_0xa4d0('0x5a')][_0xa4d0('0x5c')]())){channels[_0x2c6064[_0xa4d0('0x8')]]['lastapplication']=_0x2c6064[_0xa4d0('0x5a')];channels[_0x2c6064[_0xa4d0('0x8')]][_0xa4d0('0x64')]=_0x2c6064[_0xa4d0('0x5b')];}}}catch(_0x63afb5){utils['error'](util[_0xa4d0('0xb')]('[%s][calls][newexten]',_0x2c6064[_0xa4d0('0x8')]),_0x63afb5);}}; \ No newline at end of file +var _0xc891=['gotoif','[%s][calls][newexten]','lodash','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','channel','info','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','now','transfer','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','hangup','noop','execif'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xc891,0x152));var _0x1c89=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc891[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x1c89('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0x1c89('0x1'));var dispositions=['NO\x20ANSWER',_0x1c89('0x2'),_0x1c89('0x2'),_0x1c89('0x3'),'NO\x20ANSWER',_0x1c89('0x3'),_0x1c89('0x4'),_0x1c89('0x5'),_0x1c89('0x2'),'FAILED',_0x1c89('0x2')];var channels={};function writeDB(_0x30aa4d){var _0x4cbacb;if(transfers[_0x1c89('0x6')][_0x30aa4d[_0x1c89('0x7')]]){_0x4cbacb=_0x30aa4d['uniqueid'];_0x30aa4d[_0x1c89('0x7')]=transfers['blinds'][_0x30aa4d[_0x1c89('0x7')]]['transfereeuniqueid'];}utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x30aa4d[_0x1c89('0x7')],_0x30aa4d['channel'],_0x30aa4d[_0x1c89('0x8')],_0x30aa4d[_0x1c89('0x9')],_0x30aa4d[_0x1c89('0xa')],_0x30aa4d[_0x1c89('0xb')],_0x30aa4d[_0x1c89('0xc')],_0x30aa4d[_0x1c89('0xd')]));if(_0x30aa4d[_0x1c89('0xe')]){utils[_0x1c89('0xf')](_0x30aa4d['accountcode'])[_0x1c89('0x10')](function(_0x514e4d){if(_0x514e4d){_0x30aa4d[_0x1c89('0x11')]=_0x514e4d['id'];}utils[_0x1c89('0x12')](_0x1c89('0x13'),_0x30aa4d);});}else{utils['request'](_0x1c89('0x13'),_0x30aa4d);}if(channels[_0x30aa4d[_0x1c89('0x7')]]){delete channels[_0x30aa4d[_0x1c89('0x7')]];}else if(_0x4cbacb&&channels[_0x4cbacb]){if(!transfers['blinds'][_0x4cbacb][_0x1c89('0x14')])delete transfers[_0x1c89('0x6')][_0x4cbacb];delete channels[_0x4cbacb];}}exports[_0x1c89('0x15')]=function(_0x671fb8){try{utils[_0x1c89('0x16')](util[_0x1c89('0x17')](_0x1c89('0x18'),_0x671fb8[_0x1c89('0x7')]),_0x671fb8);if(_0x671fb8[_0x1c89('0x7')]==_0x671fb8[_0x1c89('0x19')]&&_0x671fb8[_0x1c89('0x1a')]!='OutgoingSpoolFailed'){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x671fb8[_0x1c89('0x7')],_0x671fb8[_0x1c89('0x1c')],_0x671fb8[_0x1c89('0x1d')]));channels[_0x671fb8[_0x1c89('0x7')]]={'uniqueid':_0x671fb8['uniqueid'],'accountcode':_0x671fb8['accountcode'],'source':_0x671fb8[_0x1c89('0xb')],'destination':_0x671fb8[_0x1c89('0x1d')],'destinationcontext':_0x671fb8[_0x1c89('0x1c')],'channel':_0x671fb8[_0x1c89('0x1a')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1c89('0x3'),'amaflags':_0x1c89('0x1e')};}}catch(_0x4fbd33){utils[_0x1c89('0x1f')](util[_0x1c89('0x17')](_0x1c89('0x18'),_0x671fb8['uniqueid']),_0x4fbd33);}};exports[_0x1c89('0x20')]=function(_0x3f8957){try{utils[_0x1c89('0x16')](util['format'](_0x1c89('0x21'),_0x3f8957['uniqueid']),_0x3f8957);if(!_['isNil'](channels[_0x3f8957[_0x1c89('0x7')]])&&_0x3f8957[_0x1c89('0x22')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3f8957[_0x1c89('0x7')],_0x3f8957['context'],_0x3f8957['channel']));if(_[_0x1c89('0x23')](channels[_0x3f8957['uniqueid']][_0x1c89('0x24')])){channels[_0x3f8957['uniqueid']]['systemanswertime']=utils[_0x1c89('0x25')]();}}else if(!_[_0x1c89('0x23')](channels[_0x3f8957[_0x1c89('0x19')]])&&_0x3f8957['channelstate']==0x6&&_0x3f8957[_0x1c89('0x1c')]!=_0x1c89('0x26')){utils['info'](util[_0x1c89('0x17')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3f8957[_0x1c89('0x7')],_0x3f8957[_0x1c89('0x19')],_0x3f8957[_0x1c89('0x1c')],_0x3f8957[_0x1c89('0x1a')]));channels[_0x3f8957[_0x1c89('0x19')]][_0x1c89('0xe')]=_0x3f8957[_0x1c89('0xe')];channels[_0x3f8957[_0x1c89('0x19')]][_0x1c89('0x27')]=_0x3f8957[_0x1c89('0x1a')];if(_['isNil'](channels[_0x3f8957[_0x1c89('0x19')]]['answertime'])){channels[_0x3f8957['linkedid']][_0x1c89('0x28')]=utils[_0x1c89('0x25')]();}channels[_0x3f8957[_0x1c89('0x19')]][_0x1c89('0x29')]=dispositions[_[_0x1c89('0x2a')](_0x3f8957[_0x1c89('0x22')])]||_0x1c89('0x4');}}catch(_0x51be1f){utils[_0x1c89('0x1f')](util[_0x1c89('0x17')](_0x1c89('0x21'),_0x3f8957['uniqueid']),_0x51be1f);}};exports['hangup']=function(_0x5bf65f){try{if(!_['isNil'](channels[_0x5bf65f['uniqueid']])){utils[_0x1c89('0x16')](util[_0x1c89('0x17')](_0x1c89('0x2b'),_0x5bf65f[_0x1c89('0x7')]),_0x5bf65f);if(_[_0x1c89('0x23')](channels[_0x5bf65f[_0x1c89('0x7')]][_0x1c89('0x2c')])){channels[_0x5bf65f['uniqueid']][_0x1c89('0x2c')]=_0x5bf65f[_0x1c89('0x2d')]+'\x20<'+_0x5bf65f['calleridnum']+'>';}utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x2e'),_0x5bf65f[_0x1c89('0x7')],channels[_0x5bf65f[_0x1c89('0x7')]]['callerid'],_0x5bf65f[_0x1c89('0x2f')]));channels[_0x5bf65f[_0x1c89('0x7')]][_0x1c89('0x30')]=utils['now']();channels[_0x5bf65f[_0x1c89('0x7')]]['duration']=utils[_0x1c89('0x31')](channels[_0x5bf65f['uniqueid']][_0x1c89('0x30')],channels[_0x5bf65f[_0x1c89('0x7')]][_0x1c89('0x32')]);channels[_0x5bf65f[_0x1c89('0x7')]][_0x1c89('0x33')]=channels[_0x5bf65f[_0x1c89('0x7')]][_0x1c89('0x28')]?utils[_0x1c89('0x31')](channels[_0x5bf65f[_0x1c89('0x7')]]['endtime'],channels[_0x5bf65f[_0x1c89('0x7')]][_0x1c89('0x28')]):0x0;writeDB(channels[_0x5bf65f[_0x1c89('0x7')]]);}}catch(_0x1dc884){utils['error'](util[_0x1c89('0x17')](_0x1c89('0x2b'),_0x5bf65f[_0x1c89('0x7')]),_0x1dc884);}};exports['attendedtransfer']=function(_0x502d5e){try{if(!_[_0x1c89('0x23')](channels[_0x502d5e[_0x1c89('0x34')]])){utils['debug'](util[_0x1c89('0x17')](_0x1c89('0x35'),_0x502d5e[_0x1c89('0x36')]),_0x502d5e);if(channels[_0x502d5e[_0x1c89('0x34')]][_0x1c89('0x1a')]==_0x502d5e[_0x1c89('0x37')]){utils[_0x1c89('0x1b')](util['format'](_0x1c89('0x38'),_0x502d5e['origtransfereruniqueid'],_0x502d5e['localtwolinkedid'],_0x502d5e[_0x1c89('0x39')]));channels[_0x502d5e[_0x1c89('0x34')]][_0x1c89('0x27')]=_0x502d5e[_0x1c89('0x39')];channels[_0x502d5e[_0x1c89('0x34')]][_0x1c89('0x3a')]=_0x1c89('0x3b');}else if(channels[_0x502d5e[_0x1c89('0x34')]][_0x1c89('0x1a')]=_0x502d5e[_0x1c89('0x3c')]){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x38'),_0x502d5e[_0x1c89('0x36')],_0x502d5e[_0x1c89('0x34')],_0x502d5e[_0x1c89('0x3d')]));channels[_0x502d5e['localtwolinkedid']][_0x1c89('0x27')]=_0x502d5e['origtransfererchannel'];channels[_0x502d5e['localtwolinkedid']][_0x1c89('0x3a')]='_attended';}}}catch(_0x5be98e){utils[_0x1c89('0x1f')](util[_0x1c89('0x17')](_0x1c89('0x35'),_0x502d5e['origtransfereruniqueid']),_0x5be98e);}};exports[_0x1c89('0x3e')]=function(_0x5d1ce5){try{if(!_[_0x1c89('0x23')](channels[_0x5d1ce5['uniqueid']])){utils[_0x1c89('0x16')](util['format'](_0x1c89('0x3f'),_0x5d1ce5[_0x1c89('0x7')]),_0x5d1ce5);channels[_0x5d1ce5[_0x1c89('0x7')]]['musiconholdstartAt']=utils[_0x1c89('0x25')]();utils[_0x1c89('0x1b')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5d1ce5[_0x1c89('0x7')],channels[_0x5d1ce5[_0x1c89('0x7')]][_0x1c89('0x40')]));}}catch(_0x3cc93e){utils[_0x1c89('0x1f')](util[_0x1c89('0x17')](_0x1c89('0x3f'),_0x5d1ce5[_0x1c89('0x7')]),_0x3cc93e);}};exports[_0x1c89('0x41')]=function(_0x2dcfc4){try{if(!_[_0x1c89('0x23')](channels[_0x2dcfc4[_0x1c89('0x7')]])){utils[_0x1c89('0x16')](util[_0x1c89('0x17')](_0x1c89('0x42'),_0x2dcfc4[_0x1c89('0x7')]),_0x2dcfc4);if(!_[_0x1c89('0x23')](channels[_0x2dcfc4[_0x1c89('0x7')]][_0x1c89('0x40')])){channels[_0x2dcfc4[_0x1c89('0x7')]]['mohtime']+=utils[_0x1c89('0x31')](utils[_0x1c89('0x25')](),channels[_0x2dcfc4[_0x1c89('0x7')]][_0x1c89('0x40')]);utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x43'),_0x2dcfc4[_0x1c89('0x7')],channels[_0x2dcfc4['uniqueid']][_0x1c89('0x44')]));delete channels[_0x2dcfc4[_0x1c89('0x7')]][_0x1c89('0x40')];}}}catch(_0x5d1c58){utils[_0x1c89('0x1f')](util[_0x1c89('0x17')](_0x1c89('0x42'),_0x2dcfc4['uniqueid']),_0x5d1c58);}};exports[_0x1c89('0x45')]=function(_0x3367d3){try{if(!_['isNil'](channels[_0x3367d3['uniqueid']])){utils['debug'](util[_0x1c89('0x17')](_0x1c89('0x46'),_0x3367d3[_0x1c89('0x7')]),_0x3367d3);if(!_[_0x1c89('0x23')](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x48')])){utils[_0x1c89('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3367d3[_0x1c89('0x7')],_0x3367d3[_0x1c89('0x49')]));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x4a')]=_0x3367d3[_0x1c89('0x49')];}if(!_[_0x1c89('0x23')](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x4b')])){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x4c'),_0x3367d3['uniqueid'],_0x3367d3[_0x1c89('0x49')]));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x4d')]=_0x3367d3[_0x1c89('0x49')];channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x2c')]='\x22'+_0x3367d3['value']+_0x1c89('0x4e')+_0x3367d3[_0x1c89('0x49')]+'>';}if(!_[_0x1c89('0x23')](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x4f')])||!_['isNil'](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x50')])){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x51'),_0x3367d3[_0x1c89('0x7')],!_[_0x1c89('0x23')](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x4f')])?'xmd-callerid-preview':_0x1c89('0x50'),_0x3367d3[_0x1c89('0x49')]));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x2c')]=_0x3367d3['value'];}if(!_[_0x1c89('0x23')](_0x3367d3['variable'][_0x1c89('0x52')])||!_['isNil'](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x53')])){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x51'),_0x3367d3[_0x1c89('0x7')],!_[_0x1c89('0x23')](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x52')])?_0x1c89('0x52'):_0x1c89('0x53'),_0x3367d3[_0x1c89('0x49')]));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x54')]=_0x1c89('0x55');channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x56')]=_0x3367d3[_0x1c89('0x49')];channels[_0x3367d3['uniqueid']][_0x1c89('0x8')]=!![];}if(!_['isNil'](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x57')])){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x58'),_0x3367d3[_0x1c89('0x7')],_0x3367d3['value']));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x59')]=_0x3367d3[_0x1c89('0x49')];}if(!_[_0x1c89('0x23')](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x5a')])){utils[_0x1c89('0x1b')](util[_0x1c89('0x17')](_0x1c89('0x5b'),_0x3367d3[_0x1c89('0x7')],_0x3367d3[_0x1c89('0x49')]));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x5c')]=_0x3367d3[_0x1c89('0x49')];}if(!_['isNil'](_0x3367d3[_0x1c89('0x47')][_0x1c89('0x5d')])){utils['info'](util[_0x1c89('0x17')](_0x1c89('0x5e'),_0x3367d3[_0x1c89('0x7')],_0x3367d3['value']));channels[_0x3367d3[_0x1c89('0x7')]]['routeid']=_0x3367d3[_0x1c89('0x49')];}if(!_[_0x1c89('0x23')](_0x3367d3['variable'][_0x1c89('0x5f')])){utils['info'](util[_0x1c89('0x17')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3367d3[_0x1c89('0x7')],_0x3367d3[_0x1c89('0x49')]));channels[_0x3367d3[_0x1c89('0x7')]][_0x1c89('0x5f')]=_0x3367d3[_0x1c89('0x49')];}}}catch(_0x5acc6d){utils[_0x1c89('0x1f')](util[_0x1c89('0x17')](_0x1c89('0x46'),_0x3367d3[_0x1c89('0x7')]),_0x5acc6d);}};exports[_0x1c89('0x60')]=function(_0x553c0e){try{if(!_['isNil'](channels[_0x553c0e['uniqueid']])){utils[_0x1c89('0x16')](util['format']('[%s][calls][newexten]',_0x553c0e['uniqueid']),_0x553c0e);utils['info'](util[_0x1c89('0x17')](_0x1c89('0x61'),_0x553c0e[_0x1c89('0x7')],_0x553c0e[_0x1c89('0x62')],_0x553c0e[_0x1c89('0x63')]));if(_0x553c0e[_0x1c89('0x62')]['toLowerCase']()==_0x1c89('0x64')&&_[_0x1c89('0x65')](_0x553c0e[_0x1c89('0x63')][_0x1c89('0x66')](),_0x1c89('0x67'))){var _0x44de16=_0x553c0e[_0x1c89('0x63')][_0x1c89('0x68')]('=');var _0x1cf445=_0x44de16[0x0][_0x1c89('0x69')](_0x44de16[0x0][_0x1c89('0x6a')]('(')+0x1,_0x44de16[0x0][_0x1c89('0x6a')](')'));var _0x252963=_0x44de16[0x1];channels[_0x553c0e[_0x1c89('0x7')]][_0x1cf445]=_0x252963;}if(!_['includes']([_0x1c89('0x6b'),_0x1c89('0x6c'),_0x1c89('0x6d'),_0x1c89('0x64'),_0x1c89('0x6e')],_0x553c0e[_0x1c89('0x62')][_0x1c89('0x66')]())){channels[_0x553c0e[_0x1c89('0x7')]][_0x1c89('0x54')]=_0x553c0e[_0x1c89('0x62')];channels[_0x553c0e[_0x1c89('0x7')]][_0x1c89('0x56')]=_0x553c0e['appdata'];}}}catch(_0x5a1567){utils['error'](util[_0x1c89('0x17')](_0x1c89('0x6f'),_0x553c0e[_0x1c89('0x7')]),_0x5a1567);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 12fdfd9..6441ea9 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 _0xc1e7=['[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x433436,_0xcef474){var _0x564f79=function(_0x4b0e09){while(--_0x4b0e09){_0x433436['push'](_0x433436['shift']());}};_0x564f79(++_0xcef474);}(_0xc1e7,0x1e1));var _0x7c1e=function(_0x5e59ea,_0x4334bd){_0x5e59ea=_0x5e59ea-0x0;var _0x587b2d=_0xc1e7[_0x5e59ea];return _0x587b2d;};'use strict';var utils=require(_0x7c1e('0x0'));exports[_0x7c1e('0x1')]=function(){utils[_0x7c1e('0x2')](_0x7c1e('0x3'));};exports[_0x7c1e('0x4')]=function(){utils[_0x7c1e('0x2')](_0x7c1e('0x5'));};exports[_0x7c1e('0x6')]=function(){utils['info'](_0x7c1e('0x7'));};exports[_0x7c1e('0x8')]=function(_0x3937b1){utils[_0x7c1e('0x8')](_0x7c1e('0x9'),_0x3937b1);};exports[_0x7c1e('0xa')]=function(){utils['info'](_0x7c1e('0xb'));};exports['managerevent']=function(_0x72e227){}; \ No newline at end of file +var _0xbdf9=['managerevent','./utils','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted','error','close'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xbdf9,0x129));var _0x9bdf=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0xbdf9[_0x4d82e1];return _0x5f3bd9;};'use strict';var utils=require(_0x9bdf('0x0'));exports['connect']=function(){utils[_0x9bdf('0x1')](_0x9bdf('0x2'));};exports['shutdown']=function(){utils['info'](_0x9bdf('0x3'));};exports['fullybooted']=function(){utils[_0x9bdf('0x1')](_0x9bdf('0x4'));};exports[_0x9bdf('0x5')]=function(_0x2b7ec0){utils[_0x9bdf('0x5')]('[core]\x20error',_0x2b7ec0);};exports[_0x9bdf('0x6')]=function(){utils['info']('[core]\x20close');};exports[_0x9bdf('0x7')]=function(_0x37e23a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a9671d1..dc612d3 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 _0x7d10=['diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete'];(function(_0x4d6cb8,_0x359a9c){var _0x12fde2=function(_0x3d6d6b){while(--_0x3d6d6b){_0x4d6cb8['push'](_0x4d6cb8['shift']());}};_0x12fde2(++_0x359a9c);}(_0x7d10,0x18b));var _0x07d1=function(_0x542c88,_0x2fab58){_0x542c88=_0x542c88-0x0;var _0x396b09=_0x7d10[_0x542c88];return _0x396b09;};'use strict';var _=require(_0x07d1('0x0'));var util=require(_0x07d1('0x1'));var utils=require(_0x07d1('0x2'));var dials={};function writeDB(_0x5b9565){utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x5'),_0x5b9565[_0x07d1('0x6')],_0x5b9565[_0x07d1('0x7')],_0x5b9565[_0x07d1('0x8')],_0x5b9565['calleridnum'],_0x5b9565[_0x07d1('0x9')],_0x5b9565[_0x07d1('0xa')]));utils[_0x07d1('0xb')](_0x07d1('0xc'),_0x5b9565);delete dials[_0x5b9565[_0x07d1('0x6')]];}exports['newexten']=function(_0x1a6065){try{utils[_0x07d1('0xd')](util['format'](_0x07d1('0xe'),_0x1a6065[_0x07d1('0x6')]),_0x1a6065);utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0xf'),_0x1a6065[_0x07d1('0x6')],_0x1a6065[_0x07d1('0x10')],_0x1a6065['appdata']));if(_0x1a6065[_0x07d1('0x10')][_0x07d1('0x11')]()=='set'&&_[_0x07d1('0x12')](_0x1a6065['appdata'][_0x07d1('0x11')](),'cdr(routeid)')){var _0x3e320=_0x1a6065[_0x07d1('0x13')][_0x07d1('0x14')]('=');dials[_0x1a6065[_0x07d1('0x6')]]={'routeId':_0x3e320[0x1]};}}catch(_0x11c1aa){utils[_0x07d1('0x15')](util['format'](_0x07d1('0xe'),_0x1a6065[_0x07d1('0x6')]),_0x11c1aa);}};exports[_0x07d1('0x16')]=function(_0x5b612f){try{utils[_0x07d1('0xd')](util[_0x07d1('0x4')](_0x07d1('0x17'),_0x5b612f[_0x07d1('0x6')]),_0x5b612f);if(!_[_0x07d1('0x18')](_0x5b612f[_0x07d1('0x19')]['outboundrouteid'])){utils['info'](util['format'](_0x07d1('0x1a'),_0x5b612f['uniqueid'],_0x5b612f['value']));dials[_0x5b612f[_0x07d1('0x6')]]={'routeId':_0x5b612f['value']};}}catch(_0x22fb68){utils[_0x07d1('0x15')](util['format'](_0x07d1('0x17'),_0x5b612f[_0x07d1('0x6')]),_0x22fb68);}};exports[_0x07d1('0x1b')]=function(_0x32ba11){try{if(!_[_0x07d1('0x18')](dials[_0x32ba11[_0x07d1('0x6')]])){utils[_0x07d1('0xd')](util[_0x07d1('0x4')]('[%s][dials][dialbegin]',_0x32ba11[_0x07d1('0x6')]),_0x32ba11);dials[_0x32ba11[_0x07d1('0x6')]]=_[_0x07d1('0x1c')](dials[_0x32ba11[_0x07d1('0x6')]],_0x32ba11);dials[_0x32ba11[_0x07d1('0x6')]][_0x07d1('0x1d')]=utils[_0x07d1('0x1e')]();dials[_0x32ba11[_0x07d1('0x6')]]['lastevent']=_0x07d1('0x1f');utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x20'),_0x32ba11[_0x07d1('0x6')],dials[_0x32ba11['uniqueid']][_0x07d1('0x1d')]));}}catch(_0x53bdbf){utils[_0x07d1('0x15')](util[_0x07d1('0x4')]('[%s][dials][dialbegin]',_0x32ba11[_0x07d1('0x6')]),_0x53bdbf);}};exports[_0x07d1('0x21')]=function(_0x49e915){try{if(!_[_0x07d1('0x18')](dials[_0x49e915['uniqueid']])){utils[_0x07d1('0xd')](util[_0x07d1('0x4')]('[%s][dials][dialend]',_0x49e915[_0x07d1('0x6')]),_0x49e915);dials[_0x49e915['uniqueid']][_0x07d1('0xa')]=_0x49e915[_0x07d1('0xa')];if(_0x49e915[_0x07d1('0xa')]==_0x07d1('0x22')){dials[_0x49e915['uniqueid']]=_[_0x07d1('0x1c')](dials[_0x49e915[_0x07d1('0x6')]],_0x49e915);dials[_0x49e915[_0x07d1('0x6')]][_0x07d1('0x23')]=utils[_0x07d1('0x1e')]();dials[_0x49e915[_0x07d1('0x6')]][_0x07d1('0x24')]=_0x07d1('0x25');utils[_0x07d1('0x3')](util[_0x07d1('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x49e915[_0x07d1('0x6')],_0x49e915[_0x07d1('0xa')],dials[_0x49e915[_0x07d1('0x6')]][_0x07d1('0x23')]));}else{utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x26'),_0x49e915[_0x07d1('0x6')],_0x49e915[_0x07d1('0xa')]));}}}catch(_0x41eaba){utils[_0x07d1('0x15')](util[_0x07d1('0x4')](_0x07d1('0x27'),_0x49e915[_0x07d1('0x6')]),_0x41eaba);}};exports['hangup']=function(_0x57b257){try{if(!_[_0x07d1('0x18')](dials[_0x57b257[_0x07d1('0x6')]])){utils[_0x07d1('0xd')](util['format'](_0x07d1('0x28'),_0x57b257[_0x07d1('0x6')]),_0x57b257);utils[_0x07d1('0x3')](util[_0x07d1('0x4')](_0x07d1('0x29'),_0x57b257['uniqueid'],_0x57b257[_0x07d1('0x2a')],_0x57b257[_0x07d1('0x2b')],_0x57b257[_0x07d1('0x2c')]));dials[_0x57b257[_0x07d1('0x6')]]=_[_0x07d1('0x1c')](dials[_0x57b257['uniqueid']],{'endtime':utils[_0x07d1('0x1e')](),'lastevent':_0x07d1('0x2d')});dials[_0x57b257[_0x07d1('0x6')]]['duration']=utils[_0x07d1('0x2e')](dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x2f')],dials[_0x57b257['uniqueid']][_0x07d1('0x1d')]);dials[_0x57b257[_0x07d1('0x6')]]['holdtime']=utils[_0x07d1('0x2e')](dials[_0x57b257['uniqueid']]['answertime']||dials[_0x57b257[_0x07d1('0x6')]]['endtime'],dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x1d')]);dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x30')]=dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x23')]?utils['diffTime'](dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x2f')],dials[_0x57b257[_0x07d1('0x6')]][_0x07d1('0x23')]):0x0;writeDB(dials[_0x57b257[_0x07d1('0x6')]]);}}catch(_0x4aaea0){utils['error'](util[_0x07d1('0x4')]('[%s][dials][hangup]',_0x57b257[_0x07d1('0x6')]),_0x4aaea0);}}; \ No newline at end of file +var _0x9be9=['value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','./utils','info','uniqueid','channel','connectedlinenum','request','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','appdata','application','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid'];(function(_0x1e2191,_0x16c5ca){var _0x4c0c38=function(_0x3f9425){while(--_0x3f9425){_0x1e2191['push'](_0x1e2191['shift']());}};_0x4c0c38(++_0x16c5ca);}(_0x9be9,0x161));var _0x99be=function(_0x4e1556,_0x392321){_0x4e1556=_0x4e1556-0x0;var _0x3a5e96=_0x9be9[_0x4e1556];return _0x3a5e96;};'use strict';var _=require(_0x99be('0x0'));var util=require('util');var utils=require(_0x99be('0x1'));var dials={};function writeDB(_0x3c8074){utils[_0x99be('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3c8074[_0x99be('0x3')],_0x3c8074[_0x99be('0x4')],_0x3c8074['dialstring'],_0x3c8074['calleridnum'],_0x3c8074[_0x99be('0x5')],_0x3c8074['dialstatus']));utils[_0x99be('0x6')](_0x99be('0x7'),_0x3c8074);delete dials[_0x3c8074[_0x99be('0x3')]];}exports['newexten']=function(_0x5c0dae){try{utils[_0x99be('0x8')](util[_0x99be('0x9')](_0x99be('0xa'),_0x5c0dae[_0x99be('0x3')]),_0x5c0dae);utils[_0x99be('0x2')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5c0dae[_0x99be('0x3')],_0x5c0dae['application'],_0x5c0dae[_0x99be('0xb')]));if(_0x5c0dae[_0x99be('0xc')][_0x99be('0xd')]()=='set'&&_[_0x99be('0xe')](_0x5c0dae[_0x99be('0xb')][_0x99be('0xd')](),_0x99be('0xf'))){var _0x243c19=_0x5c0dae[_0x99be('0xb')][_0x99be('0x10')]('=');dials[_0x5c0dae[_0x99be('0x3')]]={'routeId':_0x243c19[0x1]};}}catch(_0x1ae9fc){utils[_0x99be('0x11')](util[_0x99be('0x9')](_0x99be('0xa'),_0x5c0dae['uniqueid']),_0x1ae9fc);}};exports[_0x99be('0x12')]=function(_0x296d0a){try{utils[_0x99be('0x8')](util[_0x99be('0x9')](_0x99be('0x13'),_0x296d0a[_0x99be('0x3')]),_0x296d0a);if(!_[_0x99be('0x14')](_0x296d0a[_0x99be('0x15')][_0x99be('0x16')])){utils['info'](util[_0x99be('0x9')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x296d0a['uniqueid'],_0x296d0a[_0x99be('0x17')]));dials[_0x296d0a['uniqueid']]={'routeId':_0x296d0a[_0x99be('0x17')]};}}catch(_0x4f23cb){utils[_0x99be('0x11')](util[_0x99be('0x9')]('[%s][dials][varset]',_0x296d0a['uniqueid']),_0x4f23cb);}};exports[_0x99be('0x18')]=function(_0x4cb582){try{if(!_[_0x99be('0x14')](dials[_0x4cb582[_0x99be('0x3')]])){utils[_0x99be('0x8')](util['format'](_0x99be('0x19'),_0x4cb582['uniqueid']),_0x4cb582);dials[_0x4cb582[_0x99be('0x3')]]=_[_0x99be('0x1a')](dials[_0x4cb582['uniqueid']],_0x4cb582);dials[_0x4cb582[_0x99be('0x3')]][_0x99be('0x1b')]=utils[_0x99be('0x1c')]();dials[_0x4cb582[_0x99be('0x3')]][_0x99be('0x1d')]=_0x99be('0x1e');utils['info'](util[_0x99be('0x9')](_0x99be('0x1f'),_0x4cb582[_0x99be('0x3')],dials[_0x4cb582[_0x99be('0x3')]][_0x99be('0x1b')]));}}catch(_0x38f7e5){utils['error'](util['format']('[%s][dials][dialbegin]',_0x4cb582[_0x99be('0x3')]),_0x38f7e5);}};exports[_0x99be('0x20')]=function(_0x325b06){try{if(!_[_0x99be('0x14')](dials[_0x325b06[_0x99be('0x3')]])){utils[_0x99be('0x8')](util[_0x99be('0x9')]('[%s][dials][dialend]',_0x325b06[_0x99be('0x3')]),_0x325b06);dials[_0x325b06[_0x99be('0x3')]]['dialstatus']=_0x325b06[_0x99be('0x21')];if(_0x325b06[_0x99be('0x21')]=='ANSWER'){dials[_0x325b06['uniqueid']]=_[_0x99be('0x1a')](dials[_0x325b06['uniqueid']],_0x325b06);dials[_0x325b06[_0x99be('0x3')]][_0x99be('0x22')]=utils[_0x99be('0x1c')]();dials[_0x325b06['uniqueid']][_0x99be('0x1d')]=_0x99be('0x23');utils[_0x99be('0x2')](util[_0x99be('0x9')](_0x99be('0x24'),_0x325b06[_0x99be('0x3')],_0x325b06[_0x99be('0x21')],dials[_0x325b06[_0x99be('0x3')]][_0x99be('0x22')]));}else{utils[_0x99be('0x2')](util['format'](_0x99be('0x25'),_0x325b06['uniqueid'],_0x325b06[_0x99be('0x21')]));}}}catch(_0x53baad){utils[_0x99be('0x11')](util[_0x99be('0x9')](_0x99be('0x26'),_0x325b06[_0x99be('0x3')]),_0x53baad);}};exports['hangup']=function(_0x1ee4e8){try{if(!_['isNil'](dials[_0x1ee4e8[_0x99be('0x3')]])){utils['debug'](util[_0x99be('0x9')](_0x99be('0x27'),_0x1ee4e8['uniqueid']),_0x1ee4e8);utils[_0x99be('0x2')](util['format'](_0x99be('0x28'),_0x1ee4e8[_0x99be('0x3')],_0x1ee4e8['calleridnum'],_0x1ee4e8['calleridname'],_0x1ee4e8['cause-txt']));dials[_0x1ee4e8[_0x99be('0x3')]]=_[_0x99be('0x1a')](dials[_0x1ee4e8[_0x99be('0x3')]],{'endtime':utils[_0x99be('0x1c')](),'lastevent':_0x99be('0x29')});dials[_0x1ee4e8['uniqueid']][_0x99be('0x2a')]=utils[_0x99be('0x2b')](dials[_0x1ee4e8[_0x99be('0x3')]]['endtime'],dials[_0x1ee4e8['uniqueid']][_0x99be('0x1b')]);dials[_0x1ee4e8['uniqueid']][_0x99be('0x2c')]=utils[_0x99be('0x2b')](dials[_0x1ee4e8[_0x99be('0x3')]][_0x99be('0x22')]||dials[_0x1ee4e8[_0x99be('0x3')]][_0x99be('0x2d')],dials[_0x1ee4e8[_0x99be('0x3')]]['starttime']);dials[_0x1ee4e8[_0x99be('0x3')]][_0x99be('0x2e')]=dials[_0x1ee4e8[_0x99be('0x3')]][_0x99be('0x22')]?utils['diffTime'](dials[_0x1ee4e8[_0x99be('0x3')]][_0x99be('0x2d')],dials[_0x1ee4e8[_0x99be('0x3')]]['answertime']):0x0;writeDB(dials[_0x1ee4e8['uniqueid']]);}}catch(_0x4e136e){utils[_0x99be('0x11')](util[_0x99be('0x9')]('[%s][dials][hangup]',_0x1ee4e8['uniqueid']),_0x4e136e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 786a3b4..6155ded 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 _0xcff8=['device','format','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','dialend','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]'];(function(_0x25c73a,_0xd0f8ef){var _0x1bd233=function(_0x4a0601){while(--_0x4a0601){_0x25c73a['push'](_0x25c73a['shift']());}};_0x1bd233(++_0xd0f8ef);}(_0xcff8,0x138));var _0x8cff=function(_0x39bfaa,_0x500102){_0x39bfaa=_0x39bfaa-0x0;var _0x37bb88=_0xcff8[_0x39bfaa];return _0x37bb88;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x8cff('0x0'));var util=require(_0x8cff('0x1'));var isXDREnabled=config[_0x8cff('0x2')]&&config['xdr'][_0x8cff('0x3')]?!config[_0x8cff('0x2')][_0x8cff('0x3')]:!![];var isProduction=config[_0x8cff('0x4')]===_0x8cff('0x5')||![];var isLocalAsterisk=config[_0x8cff('0x2')]&&config[_0x8cff('0x2')][_0x8cff('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x8cff('0x7')][_0x8cff('0x8')],config[_0x8cff('0x7')]['ip'],config['asterisk'][_0x8cff('0x9')],config[_0x8cff('0x7')][_0x8cff('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x8cff('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8cff('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x8cff('0xd'));var calls=require(_0x8cff('0xe'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x8cff('0xf'));var dials=require(_0x8cff('0x10'));var transfers=require(_0x8cff('0x11'));var core=require(_0x8cff('0x12'));ami['on'](_0x8cff('0x13'),core['connect']);ami['on']('shutdown',core[_0x8cff('0x14')]);ami['on'](_0x8cff('0x15'),core[_0x8cff('0x15')]);ami['on'](_0x8cff('0x16'),core[_0x8cff('0x16')]);ami['on'](_0x8cff('0x17'),core[_0x8cff('0x17')]);ami['on']('managerevent',core[_0x8cff('0x18')]);ami['on'](_0x8cff('0x19'),function(_0x3fbb31){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x1b'),_0x3fbb31[_0x8cff('0x1c')]),_0x3fbb31);members[_0x8cff('0x19')](_0x3fbb31);}catch(_0x1bbd92){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s][index][devicestatechange]',_0x3fbb31['device']),_0x1bbd92);}});ami['on'](_0x8cff('0x1e'),function(_0x26c9d2){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x1f'),_0x26c9d2['uniqueid']),_0x26c9d2);agents[_0x8cff('0x1e')](_0x26c9d2);}catch(_0x3b65d1){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s][index][agentcalled]',_0x26c9d2['uniqueid']),_0x3b65d1);}});ami['on'](_0x8cff('0x20'),function(_0x99754d){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x21'),_0x99754d[_0x8cff('0x22')]),_0x99754d);agents[_0x8cff('0x20')](_0x99754d);}catch(_0x2628a7){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x21'),_0x99754d[_0x8cff('0x22')]),_0x2628a7);}});ami['on'](_0x8cff('0x23'),function(_0x334726){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x24'),_0x334726[_0x8cff('0x22')]),_0x334726);agents[_0x8cff('0x23')](_0x334726);queues[_0x8cff('0x23')](_0x334726);}catch(_0x418232){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x24'),_0x334726['uniqueid']),_0x418232);}});ami['on'](_0x8cff('0x25'),function(_0x32a381){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x26'),_0x32a381[_0x8cff('0x22')]),_0x32a381);agents['agentcomplete'](_0x32a381);queues[_0x8cff('0x25')](_0x32a381);members[_0x8cff('0x25')](_0x32a381);}catch(_0x128df1){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x26'),_0x32a381[_0x8cff('0x22')]),_0x128df1);}});ami['on'](_0x8cff('0x27'),function(_0x2bd4ee){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x28'),_0x2bd4ee[_0x8cff('0x22')]),_0x2bd4ee);agents[_0x8cff('0x27')](_0x2bd4ee);queues[_0x8cff('0x27')](_0x2bd4ee);}catch(_0x57a26a){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x28'),_0x2bd4ee['uniqueid']),_0x57a26a);}});ami['on']('queuecallerjoin',function(_0xf02ad4){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x29'),_0xf02ad4[_0x8cff('0x22')]),_0xf02ad4);queues[_0x8cff('0x2a')](_0xf02ad4);recordings[_0x8cff('0x2a')](_0xf02ad4);}catch(_0x3a3af7){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x29'),_0xf02ad4[_0x8cff('0x22')]),_0x3a3af7);}});ami['on']('queuecallerleave',function(_0x2f5c4a){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x2b'),_0x2f5c4a[_0x8cff('0x22')]),_0x2f5c4a);queues['queuecallerleave'](_0x2f5c4a);}catch(_0xe83cde){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x2b'),_0x2f5c4a['uniqueid']),_0xe83cde);}});ami['on'](_0x8cff('0x2c'),function(_0x55f48d){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')]('[%s][index][musiconholdstart]',_0x55f48d['uniqueid']),_0x55f48d);queues['musiconholdstart'](_0x55f48d);calls['musiconholdstart'](_0x55f48d);}catch(_0x49694a){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x2d'),_0x55f48d[_0x8cff('0x22')]),_0x49694a);}});ami['on'](_0x8cff('0x2e'),function(_0x13ca68){try{utils['debug'](util[_0x8cff('0x1d')](_0x8cff('0x2f'),_0x13ca68[_0x8cff('0x22')]),_0x13ca68);queues[_0x8cff('0x2e')](_0x13ca68);calls[_0x8cff('0x2e')](_0x13ca68);}catch(_0x4ce5b9){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x2f'),_0x13ca68['uniqueid']),_0x4ce5b9);}});ami['on'](_0x8cff('0x30'),function(_0x260f0e){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x31'),_0x260f0e['uniqueid']),_0x260f0e);calls[_0x8cff('0x30')](_0x260f0e);recordings[_0x8cff('0x30')](_0x260f0e);}catch(_0x599b43){utils['error'](util[_0x8cff('0x1d')](_0x8cff('0x31'),_0x260f0e[_0x8cff('0x22')]),_0x599b43);}});ami['on'](_0x8cff('0x32'),function(_0x3297ee){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x33'),_0x3297ee[_0x8cff('0x22')]),_0x3297ee);calls[_0x8cff('0x32')](_0x3297ee);recordings[_0x8cff('0x32')](_0x3297ee);dials['hangup'](_0x3297ee);agents['hangup'](_0x3297ee);queues['hangup'](_0x3297ee);}catch(_0x503b9c){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x33'),_0x3297ee['uniqueid']),_0x503b9c);}});ami['on'](_0x8cff('0x34'),function(_0xa1cb21){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x35'),_0xa1cb21[_0x8cff('0x22')]),_0xa1cb21);members[_0x8cff('0x34')](_0xa1cb21);}catch(_0x5e8759){utils['error'](util[_0x8cff('0x1d')](_0x8cff('0x35'),_0xa1cb21[_0x8cff('0x22')]),_0x5e8759);}});ami['on'](_0x8cff('0x36'),function(_0x2971e3){try{utils[_0x8cff('0x1a')](util['format']('[%s][index][blindtransfer]',_0x2971e3[_0x8cff('0x22')]),_0x2971e3);queues[_0x8cff('0x36')](_0x2971e3);agents[_0x8cff('0x36')](_0x2971e3);transfers[_0x8cff('0x36')](_0x2971e3);recordings[_0x8cff('0x36')](_0x2971e3);}catch(_0x1a6042){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')](_0x8cff('0x37'),_0x2971e3[_0x8cff('0x22')]),_0x1a6042);}});ami['on'](_0x8cff('0x38'),function(_0x1965b5){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x39'),_0x1965b5[_0x8cff('0x3a')]),_0x1965b5);queues[_0x8cff('0x38')](_0x1965b5);transfers[_0x8cff('0x38')](_0x1965b5);agents[_0x8cff('0x38')](_0x1965b5);calls[_0x8cff('0x38')](_0x1965b5);}catch(_0x1873ea){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x39'),_0x1965b5['origtransfereruniqueid']),_0x1873ea);}});ami['on'](_0x8cff('0x3b'),function(_0x2f74e8){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x3c'),_0x2f74e8['uniqueid']),_0x2f74e8);queues[_0x8cff('0x3b')](_0x2f74e8);recordings[_0x8cff('0x3b')](_0x2f74e8);calls[_0x8cff('0x3b')](_0x2f74e8);dials[_0x8cff('0x3b')](_0x2f74e8);}catch(_0x2443c8){utils[_0x8cff('0x16')](util['format'](_0x8cff('0x3c'),_0x2f74e8['uniqueid']),_0x2443c8);}});ami['on'](_0x8cff('0x3d'),function(_0x3c3a1e){try{utils[_0x8cff('0x1a')](util[_0x8cff('0x1d')](_0x8cff('0x3e'),_0x3c3a1e['uniqueid']),_0x3c3a1e);calls[_0x8cff('0x3d')](_0x3c3a1e);recordings[_0x8cff('0x3d')](_0x3c3a1e);dials[_0x8cff('0x3d')](_0x3c3a1e);}catch(_0x5a3d76){utils['error'](util[_0x8cff('0x1d')](_0x8cff('0x3e'),_0x3c3a1e[_0x8cff('0x22')]),_0x5a3d76);}});ami['on'](_0x8cff('0x3f'),function(_0x10bbc3){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x40'),_0x10bbc3[_0x8cff('0x22')]),_0x10bbc3);calls['newchannel'](_0x10bbc3);recordings[_0x8cff('0x3f')](_0x10bbc3);}catch(_0x2b7ab1){utils['error'](util['format'](_0x8cff('0x40'),_0x10bbc3['uniqueid']),_0x2b7ab1);}});ami['on']('dialbegin',function(_0x460507){try{utils[_0x8cff('0x1a')](util['format'](_0x8cff('0x41'),_0x460507[_0x8cff('0x22')]),_0x460507);dials[_0x8cff('0x42')](_0x460507);}catch(_0x42daf9){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s]dialbegin',_0x460507[_0x8cff('0x22')]),_0x42daf9);}});ami['on'](_0x8cff('0x43'),function(_0xdc4951){try{utils['debug'](util[_0x8cff('0x1d')]('[%s][index][dialend]',_0xdc4951[_0x8cff('0x22')]),_0xdc4951);dials[_0x8cff('0x43')](_0xdc4951);}catch(_0x25ec8e){utils[_0x8cff('0x16')](util[_0x8cff('0x1d')]('[%s][index][dialend]',_0xdc4951[_0x8cff('0x22')]),_0x25ec8e);}});} \ No newline at end of file +var _0x9ea3=['info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected'];(function(_0x13eec6,_0x170127){var _0x585c24=function(_0x3052df){while(--_0x3052df){_0x13eec6['push'](_0x13eec6['shift']());}};_0x585c24(++_0x170127);}(_0x9ea3,0xc9));var _0x39ea=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9ea3[_0x4a9fb1];return _0x348672;};var AsteriskManager=require(_0x39ea('0x0'));var config=require(_0x39ea('0x1'));var utils=require('./utils');var util=require(_0x39ea('0x2'));var isXDREnabled=config[_0x39ea('0x3')]&&config['xdr'][_0x39ea('0x4')]?!config[_0x39ea('0x3')]['disabled']:!![];var isProduction=config[_0x39ea('0x5')]===_0x39ea('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x39ea('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x39ea('0x7')][_0x39ea('0x8')],config[_0x39ea('0x7')]['ip'],config[_0x39ea('0x7')][_0x39ea('0x9')],config[_0x39ea('0x7')][_0x39ea('0xa')],!![]);ami[_0x39ea('0xb')]();if(!isXDREnabled){utils[_0x39ea('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x39ea('0xc')](_0x39ea('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x39ea('0xe'));var queues=require(_0x39ea('0xf'));var recordings=require(_0x39ea('0x10'));var members=require(_0x39ea('0x11'));var dials=require(_0x39ea('0x12'));var transfers=require(_0x39ea('0x13'));var core=require(_0x39ea('0x14'));ami['on'](_0x39ea('0x15'),core['connect']);ami['on'](_0x39ea('0x16'),core[_0x39ea('0x16')]);ami['on'](_0x39ea('0x17'),core[_0x39ea('0x17')]);ami['on'](_0x39ea('0x18'),core[_0x39ea('0x18')]);ami['on'](_0x39ea('0x19'),core[_0x39ea('0x19')]);ami['on'](_0x39ea('0x1a'),core['managerevent']);ami['on']('devicestatechange',function(_0x394d21){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')](_0x39ea('0x1d'),_0x394d21[_0x39ea('0x1e')]),_0x394d21);members[_0x39ea('0x1f')](_0x394d21);}catch(_0x409b98){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x1d'),_0x394d21[_0x39ea('0x1e')]),_0x409b98);}});ami['on'](_0x39ea('0x20'),function(_0x45e134){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')](_0x39ea('0x21'),_0x45e134[_0x39ea('0x22')]),_0x45e134);agents[_0x39ea('0x20')](_0x45e134);}catch(_0x505fe1){utils['error'](util[_0x39ea('0x1c')](_0x39ea('0x21'),_0x45e134[_0x39ea('0x22')]),_0x505fe1);}});ami['on'](_0x39ea('0x23'),function(_0x59a1ac){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')]('[%s][index][agentringnoanswer]',_0x59a1ac[_0x39ea('0x22')]),_0x59a1ac);agents[_0x39ea('0x23')](_0x59a1ac);}catch(_0x5e61e5){utils['error'](util[_0x39ea('0x1c')]('[%s][index][agentringnoanswer]',_0x59a1ac[_0x39ea('0x22')]),_0x5e61e5);}});ami['on']('agentconnect',function(_0x4e9ae6){try{utils['debug'](util[_0x39ea('0x1c')](_0x39ea('0x24'),_0x4e9ae6[_0x39ea('0x22')]),_0x4e9ae6);agents[_0x39ea('0x25')](_0x4e9ae6);queues[_0x39ea('0x25')](_0x4e9ae6);}catch(_0x38d142){utils[_0x39ea('0x18')](util['format'](_0x39ea('0x24'),_0x4e9ae6[_0x39ea('0x22')]),_0x38d142);}});ami['on'](_0x39ea('0x26'),function(_0x1742da){try{utils[_0x39ea('0x1b')](util['format'](_0x39ea('0x27'),_0x1742da[_0x39ea('0x22')]),_0x1742da);agents['agentcomplete'](_0x1742da);queues[_0x39ea('0x26')](_0x1742da);members['agentcomplete'](_0x1742da);}catch(_0x2f3ad2){utils['error'](util[_0x39ea('0x1c')](_0x39ea('0x27'),_0x1742da[_0x39ea('0x22')]),_0x2f3ad2);}});ami['on']('queuecallerabandon',function(_0x22e1cf){try{utils['debug'](util['format'](_0x39ea('0x28'),_0x22e1cf[_0x39ea('0x22')]),_0x22e1cf);agents['queuecallerabandon'](_0x22e1cf);queues['queuecallerabandon'](_0x22e1cf);}catch(_0xf7af97){utils['error'](util['format'](_0x39ea('0x28'),_0x22e1cf[_0x39ea('0x22')]),_0xf7af97);}});ami['on'](_0x39ea('0x29'),function(_0x43d227){try{utils['debug'](util[_0x39ea('0x1c')](_0x39ea('0x2a'),_0x43d227[_0x39ea('0x22')]),_0x43d227);queues['queuecallerjoin'](_0x43d227);recordings[_0x39ea('0x29')](_0x43d227);}catch(_0x1a2b47){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x2a'),_0x43d227[_0x39ea('0x22')]),_0x1a2b47);}});ami['on'](_0x39ea('0x2b'),function(_0x4f614b){try{utils['debug'](util['format'](_0x39ea('0x2c'),_0x4f614b['uniqueid']),_0x4f614b);queues['queuecallerleave'](_0x4f614b);}catch(_0xe8a4f1){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')]('[%s][index][queuecallerleave]',_0x4f614b['uniqueid']),_0xe8a4f1);}});ami['on'](_0x39ea('0x2d'),function(_0x4ba2d1){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')]('[%s][index][musiconholdstart]',_0x4ba2d1['uniqueid']),_0x4ba2d1);queues[_0x39ea('0x2d')](_0x4ba2d1);calls[_0x39ea('0x2d')](_0x4ba2d1);}catch(_0x35be18){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x2e'),_0x4ba2d1[_0x39ea('0x22')]),_0x35be18);}});ami['on'](_0x39ea('0x2f'),function(_0x203d41){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')]('[%s][index][musiconholdstop]',_0x203d41[_0x39ea('0x22')]),_0x203d41);queues['musiconholdstop'](_0x203d41);calls[_0x39ea('0x2f')](_0x203d41);}catch(_0x3d5a7a){utils[_0x39ea('0x18')](util['format'](_0x39ea('0x30'),_0x203d41['uniqueid']),_0x3d5a7a);}});ami['on'](_0x39ea('0x31'),function(_0x599d76){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')]('[%s][index][newstate]',_0x599d76[_0x39ea('0x22')]),_0x599d76);calls[_0x39ea('0x31')](_0x599d76);recordings[_0x39ea('0x31')](_0x599d76);}catch(_0xc38c23){utils['error'](util[_0x39ea('0x1c')](_0x39ea('0x32'),_0x599d76[_0x39ea('0x22')]),_0xc38c23);}});ami['on'](_0x39ea('0x33'),function(_0x219156){try{utils['debug'](util[_0x39ea('0x1c')](_0x39ea('0x34'),_0x219156[_0x39ea('0x22')]),_0x219156);calls[_0x39ea('0x33')](_0x219156);recordings[_0x39ea('0x33')](_0x219156);dials[_0x39ea('0x33')](_0x219156);agents[_0x39ea('0x33')](_0x219156);queues['hangup'](_0x219156);}catch(_0x5d248c){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x34'),_0x219156[_0x39ea('0x22')]),_0x5d248c);}});ami['on'](_0x39ea('0x35'),function(_0x2f6a22){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')](_0x39ea('0x36'),_0x2f6a22['uniqueid']),_0x2f6a22);members['cdr'](_0x2f6a22);}catch(_0x31999f){utils[_0x39ea('0x18')](util['format']('[%s][index][cdr]',_0x2f6a22[_0x39ea('0x22')]),_0x31999f);}});ami['on'](_0x39ea('0x37'),function(_0x2bff45){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')](_0x39ea('0x38'),_0x2bff45[_0x39ea('0x22')]),_0x2bff45);queues[_0x39ea('0x37')](_0x2bff45);agents['blindtransfer'](_0x2bff45);transfers['blindtransfer'](_0x2bff45);recordings[_0x39ea('0x37')](_0x2bff45);}catch(_0x3bcf53){utils[_0x39ea('0x18')](util['format']('[%s][index][blindtransfer]',_0x2bff45[_0x39ea('0x22')]),_0x3bcf53);}});ami['on'](_0x39ea('0x39'),function(_0x38b18f){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')]('[%s][index][attendedtransfer]',_0x38b18f[_0x39ea('0x3a')]),_0x38b18f);queues['attendedtransfer'](_0x38b18f);transfers[_0x39ea('0x39')](_0x38b18f);agents['attendedtransfer'](_0x38b18f);calls[_0x39ea('0x39')](_0x38b18f);}catch(_0x378708){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x3b'),_0x38b18f[_0x39ea('0x3a')]),_0x378708);}});ami['on'](_0x39ea('0x3c'),function(_0x2f18cf){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')](_0x39ea('0x3d'),_0x2f18cf[_0x39ea('0x22')]),_0x2f18cf);queues[_0x39ea('0x3c')](_0x2f18cf);recordings[_0x39ea('0x3c')](_0x2f18cf);calls[_0x39ea('0x3c')](_0x2f18cf);dials['varset'](_0x2f18cf);}catch(_0x45411e){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x3d'),_0x2f18cf[_0x39ea('0x22')]),_0x45411e);}});ami['on'](_0x39ea('0x3e'),function(_0x4e1550){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')]('[%s][index][newexten]',_0x4e1550[_0x39ea('0x22')]),_0x4e1550);calls[_0x39ea('0x3e')](_0x4e1550);recordings[_0x39ea('0x3e')](_0x4e1550);dials['newexten'](_0x4e1550);}catch(_0x3f78c1){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')](_0x39ea('0x3f'),_0x4e1550[_0x39ea('0x22')]),_0x3f78c1);}});ami['on'](_0x39ea('0x40'),function(_0x833d0b){try{utils[_0x39ea('0x1b')](util['format'](_0x39ea('0x41'),_0x833d0b['uniqueid']),_0x833d0b);calls[_0x39ea('0x40')](_0x833d0b);recordings[_0x39ea('0x40')](_0x833d0b);}catch(_0x4973e5){utils[_0x39ea('0x18')](util[_0x39ea('0x1c')]('[%s][index][newchannel]',_0x833d0b[_0x39ea('0x22')]),_0x4973e5);}});ami['on'](_0x39ea('0x42'),function(_0x3b7d79){try{utils['debug'](util[_0x39ea('0x1c')](_0x39ea('0x43'),_0x3b7d79[_0x39ea('0x22')]),_0x3b7d79);dials[_0x39ea('0x42')](_0x3b7d79);}catch(_0xddba2d){utils['error'](util[_0x39ea('0x1c')](_0x39ea('0x44'),_0x3b7d79[_0x39ea('0x22')]),_0xddba2d);}});ami['on'](_0x39ea('0x45'),function(_0x58261c){try{utils[_0x39ea('0x1b')](util[_0x39ea('0x1c')](_0x39ea('0x46'),_0x58261c[_0x39ea('0x22')]),_0x58261c);dials[_0x39ea('0x45')](_0x58261c);}catch(_0x6cf4a1){utils['error'](util[_0x39ea('0x1c')](_0x39ea('0x46'),_0x58261c[_0x39ea('0x22')]),_0x6cf4a1);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 0dbab66..6ba0ab6 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 _0x117c=['Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','catch','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','exitAt','diffTime','enterAt','error','debug','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','isNil','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','data3','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x117c,0x8f));var _0xc117=function(_0x4486ee,_0x85b039){_0x4486ee=_0x4486ee-0x0;var _0x2713cb=_0x117c[_0x4486ee];return _0x2713cb;};'use strict';var _=require('lodash');var util=require(_0xc117('0x0'));var utils=require('./utils');var members={};var exclude=[_0xc117('0x1'),'Queue:'];function writeDB(_0x1ae4cc){utils['info'](util[_0xc117('0x2')](_0xc117('0x3'),_0x1ae4cc['uniqueid'],_0x1ae4cc[_0xc117('0x4')],_0x1ae4cc['channel'],_0x1ae4cc[_0xc117('0x5')],_0x1ae4cc['membername'],_0x1ae4cc['type']));if(_0x1ae4cc[_0xc117('0x4')]){utils[_0xc117('0x6')](_0x1ae4cc[_0xc117('0x4')])[_0xc117('0x7')](function(_0x2cbef0){if(_0x2cbef0){_0x1ae4cc[_0xc117('0x8')]=_0x2cbef0[_0xc117('0x9')];_0x1ae4cc[_0xc117('0xa')]=_0x2cbef0[_0xc117('0xa')];utils[_0xc117('0xb')](_0xc117('0xc'),_0x1ae4cc);}else{utils['getUserByName'](_0x1ae4cc[_0xc117('0x4')][_0xc117('0xd')]('/')[0x1])[_0xc117('0x7')](function(_0x5b76aa){if(_0x5b76aa){_0x1ae4cc[_0xc117('0x8')]=_0x5b76aa[_0xc117('0x9')];_0x1ae4cc[_0xc117('0xa')]=_0x5b76aa[_0xc117('0xa')];utils['request'](_0xc117('0xc'),_0x1ae4cc);}});}})[_0xc117('0xe')](function(_0x5baff4){utils['error'](util[_0xc117('0x2')]('[%s][members][writeDB]',_0x1ae4cc[_0xc117('0xf')]),_0x5baff4);});}delete members[_0x1ae4cc[_0xc117('0x4')]];}function startsWith(_0x3d3edd,_0x329c07){return _[_0xc117('0x10')](_0x3d3edd,function(_0xd579fe){return _[_0xc117('0x11')](_0x329c07,_0xd579fe);});}exports[_0xc117('0x12')]=function(_0x410929){try{utils['debug'](util[_0xc117('0x2')](_0xc117('0x13'),members[_0x410929['device']]?members[_0x410929[_0xc117('0x14')]][_0xc117('0xf')]:_0x410929[_0xc117('0x14')]),_0x410929);utils[_0xc117('0x15')](util[_0xc117('0x2')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x410929['device']]?members[_0x410929[_0xc117('0x14')]][_0xc117('0xf')]:_0x410929[_0xc117('0x14')],_0x410929[_0xc117('0x16')],_0x410929['device']));switch(_0x410929[_0xc117('0x16')]){case _0xc117('0x17'):case _0xc117('0x18'):if(!startsWith(exclude,_0x410929[_0xc117('0x14')])){members[_0x410929[_0xc117('0x14')]]={'channel':_0xc117('0x19'),'interface':_0x410929['device'],'type':_0xc117('0x1a'),'enterAt':utils['now'](),'role':_0xc117('0x1b')};}break;case _0xc117('0x1c'):if(!_['isNil'](members[_0x410929['device']])){members[_0x410929[_0xc117('0x14')]][_0xc117('0x1d')]=utils['now']();members[_0x410929[_0xc117('0x14')]]['duration']=utils[_0xc117('0x1e')](members[_0x410929[_0xc117('0x14')]]['exitAt'],members[_0x410929[_0xc117('0x14')]][_0xc117('0x1f')]);if(members[_0x410929[_0xc117('0x14')]][_0xc117('0xf')]){writeDB(members[_0x410929['device']]);}}break;default:break;}}catch(_0x232321){utils[_0xc117('0x20')](util[_0xc117('0x2')]('[%s][members][devicestatechange]',members[_0x410929[_0xc117('0x14')]]?members[_0x410929['device']][_0xc117('0xf')]:_0x410929[_0xc117('0x14')]),_0x232321);}};exports['agentcomplete']=function(_0x2bf05a){try{if(!_['isNil'](members[_0x2bf05a['interface']])){utils[_0xc117('0x21')](util[_0xc117('0x2')]('[%s][members][agentcomplete]',_0x2bf05a[_0xc117('0xf')]),_0x2bf05a);utils[_0xc117('0x15')](util[_0xc117('0x2')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2bf05a[_0xc117('0xf')],_0x2bf05a[_0xc117('0x4')],_0x2bf05a[_0xc117('0x22')]));members[_0x2bf05a[_0xc117('0x4')]]=_[_0xc117('0x23')](members[_0x2bf05a[_0xc117('0x4')]],{'data4':_0x2bf05a[_0xc117('0x22')],'uniqueid':_0x2bf05a[_0xc117('0xf')]});}}catch(_0x1eb188){utils[_0xc117('0x20')](util['format'](_0xc117('0x24'),_0x2bf05a[_0xc117('0xf')]),_0x1eb188);}};exports[_0xc117('0x25')]=function(_0x32dcb1){try{utils[_0xc117('0x21')](util[_0xc117('0x2')](_0xc117('0x26'),_0x32dcb1['uniqueid']),_0x32dcb1);if(_0x32dcb1[_0xc117('0x27')]){var _0x2725ec=_0x32dcb1[_0xc117('0x27')][_0xc117('0xd')]('-')[0x0];if(!_[_0xc117('0x28')](members[_0x2725ec])){members[_0x2725ec]=_['assign'](members[_0x2725ec],{'data1':members[_0x2725ec][_0xc117('0x29')]||_0x32dcb1['type'],'data2':members[_0x2725ec][_0xc117('0x5')]||_0x32dcb1[_0xc117('0x2a')],'data3':members[_0x2725ec]['data3']||_0x32dcb1[_0xc117('0x2b')],'uniqueid':members[_0x2725ec]['uniqueid']||_0x32dcb1[_0xc117('0xf')]});utils[_0xc117('0x15')](util['format'](_0xc117('0x2c'),_0x32dcb1[_0xc117('0xf')],members[_0x2725ec][_0xc117('0x29')],members[_0x2725ec][_0xc117('0x5')],members[_0x2725ec]['data3']));if(members[_0x2725ec][_0xc117('0x1d')]){writeDB(members[_0x2725ec]);}}}if(_0x32dcb1[_0xc117('0x2d')]){var _0x55c9c1=_0x32dcb1[_0xc117('0x2d')]['split']('-')[0x0];if(!_[_0xc117('0x28')](members[_0x55c9c1])){members[_0x55c9c1]=_[_0xc117('0x23')](members[_0x55c9c1],{'data1':members[_0x55c9c1]['data1']||_0x32dcb1[_0xc117('0x2e')],'data2':members[_0x55c9c1]['data2']||_0x32dcb1[_0xc117('0x2a')],'data3':members[_0x55c9c1][_0xc117('0x2f')]||_0x32dcb1[_0xc117('0x2b')],'uniqueid':members[_0x55c9c1][_0xc117('0xf')]||_0x32dcb1[_0xc117('0xf')]});utils['info'](util['format'](_0xc117('0x2c'),_0x32dcb1[_0xc117('0xf')],members[_0x55c9c1][_0xc117('0x29')],members[_0x55c9c1]['data2'],members[_0x55c9c1][_0xc117('0x2f')]));if(members[_0x55c9c1]['exitAt']){writeDB(members[_0x55c9c1]);}}}}catch(_0x40a51b){utils[_0xc117('0x20')](util['format'](_0xc117('0x26'),_0x32dcb1['uniqueid']),_0x40a51b);}}; \ No newline at end of file +var _0x9ef8=['uniqueid','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','duration','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','data2','membername','type','interface','getUserByInterface','then','internal','request','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x5d0108,_0x44adee){var _0x53e2e8=function(_0x2da537){while(--_0x2da537){_0x5d0108['push'](_0x5d0108['shift']());}};_0x53e2e8(++_0x44adee);}(_0x9ef8,0x17f));var _0x89ef=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x9ef8[_0x154940];return _0x401409;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var utils=require('./utils');var members={};var exclude=[_0x89ef('0x2'),_0x89ef('0x3')];function writeDB(_0x6ad29a){utils['info'](util[_0x89ef('0x4')](_0x89ef('0x5'),_0x6ad29a['uniqueid'],_0x6ad29a['interface'],_0x6ad29a['channel'],_0x6ad29a[_0x89ef('0x6')],_0x6ad29a[_0x89ef('0x7')],_0x6ad29a[_0x89ef('0x8')]));if(_0x6ad29a[_0x89ef('0x9')]){utils[_0x89ef('0xa')](_0x6ad29a[_0x89ef('0x9')])[_0x89ef('0xb')](function(_0x3d204a){if(_0x3d204a){_0x6ad29a[_0x89ef('0x7')]=_0x3d204a['name'];_0x6ad29a[_0x89ef('0xc')]=_0x3d204a[_0x89ef('0xc')];utils[_0x89ef('0xd')]('CreateMemberReport',_0x6ad29a);}else{utils[_0x89ef('0xe')](_0x6ad29a[_0x89ef('0x9')][_0x89ef('0xf')]('/')[0x1])[_0x89ef('0xb')](function(_0x2f1376){if(_0x2f1376){_0x6ad29a['membername']=_0x2f1376[_0x89ef('0x10')];_0x6ad29a['internal']=_0x2f1376[_0x89ef('0xc')];utils[_0x89ef('0xd')]('CreateMemberReport',_0x6ad29a);}});}})[_0x89ef('0x11')](function(_0x269192){utils[_0x89ef('0x12')](util[_0x89ef('0x4')](_0x89ef('0x13'),_0x6ad29a['uniqueid']),_0x269192);});}delete members[_0x6ad29a[_0x89ef('0x9')]];}function startsWith(_0x4b73a4,_0x4fc5b4){return _[_0x89ef('0x14')](_0x4b73a4,function(_0x1a89b7){return _['startsWith'](_0x4fc5b4,_0x1a89b7);});}exports[_0x89ef('0x15')]=function(_0x490877){try{utils[_0x89ef('0x16')](util['format'](_0x89ef('0x17'),members[_0x490877[_0x89ef('0x18')]]?members[_0x490877[_0x89ef('0x18')]][_0x89ef('0x19')]:_0x490877['device']),_0x490877);utils[_0x89ef('0x1a')](util[_0x89ef('0x4')](_0x89ef('0x1b'),members[_0x490877[_0x89ef('0x18')]]?members[_0x490877[_0x89ef('0x18')]][_0x89ef('0x19')]:_0x490877[_0x89ef('0x18')],_0x490877[_0x89ef('0x1c')],_0x490877[_0x89ef('0x18')]));switch(_0x490877[_0x89ef('0x1c')]){case _0x89ef('0x1d'):case _0x89ef('0x1e'):if(!startsWith(exclude,_0x490877[_0x89ef('0x18')])){members[_0x490877[_0x89ef('0x18')]]={'channel':_0x89ef('0x1f'),'interface':_0x490877[_0x89ef('0x18')],'type':_0x89ef('0x20'),'enterAt':utils['now'](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x490877[_0x89ef('0x18')]])){members[_0x490877[_0x89ef('0x18')]]['exitAt']=utils['now']();members[_0x490877[_0x89ef('0x18')]][_0x89ef('0x21')]=utils['diffTime'](members[_0x490877['device']][_0x89ef('0x22')],members[_0x490877[_0x89ef('0x18')]][_0x89ef('0x23')]);if(members[_0x490877[_0x89ef('0x18')]][_0x89ef('0x19')]){writeDB(members[_0x490877[_0x89ef('0x18')]]);}}break;default:break;}}catch(_0x2ebaff){utils['error'](util[_0x89ef('0x4')](_0x89ef('0x17'),members[_0x490877[_0x89ef('0x18')]]?members[_0x490877[_0x89ef('0x18')]]['uniqueid']:_0x490877['device']),_0x2ebaff);}};exports[_0x89ef('0x24')]=function(_0x24cabf){try{if(!_[_0x89ef('0x25')](members[_0x24cabf['interface']])){utils[_0x89ef('0x16')](util[_0x89ef('0x4')]('[%s][members][agentcomplete]',_0x24cabf[_0x89ef('0x19')]),_0x24cabf);utils[_0x89ef('0x1a')](util[_0x89ef('0x4')](_0x89ef('0x26'),_0x24cabf['uniqueid'],_0x24cabf[_0x89ef('0x9')],_0x24cabf[_0x89ef('0x27')]));members[_0x24cabf['interface']]=_[_0x89ef('0x28')](members[_0x24cabf[_0x89ef('0x9')]],{'data4':_0x24cabf[_0x89ef('0x27')],'uniqueid':_0x24cabf['uniqueid']});}}catch(_0xd46ed1){utils[_0x89ef('0x12')](util[_0x89ef('0x4')](_0x89ef('0x29'),_0x24cabf[_0x89ef('0x19')]),_0xd46ed1);}};exports[_0x89ef('0x2a')]=function(_0x184567){try{utils[_0x89ef('0x16')](util[_0x89ef('0x4')](_0x89ef('0x2b'),_0x184567[_0x89ef('0x19')]),_0x184567);if(_0x184567[_0x89ef('0x2c')]){var _0x43c5f1=_0x184567[_0x89ef('0x2c')][_0x89ef('0xf')]('-')[0x0];if(!_[_0x89ef('0x25')](members[_0x43c5f1])){members[_0x43c5f1]=_['assign'](members[_0x43c5f1],{'data1':members[_0x43c5f1]['data1']||_0x184567[_0x89ef('0x8')],'data2':members[_0x43c5f1][_0x89ef('0x6')]||_0x184567[_0x89ef('0x2d')],'data3':members[_0x43c5f1][_0x89ef('0x2e')]||_0x184567[_0x89ef('0x2f')],'uniqueid':members[_0x43c5f1]['uniqueid']||_0x184567[_0x89ef('0x19')]});utils['info'](util[_0x89ef('0x4')](_0x89ef('0x30'),_0x184567[_0x89ef('0x19')],members[_0x43c5f1][_0x89ef('0x31')],members[_0x43c5f1][_0x89ef('0x6')],members[_0x43c5f1][_0x89ef('0x2e')]));if(members[_0x43c5f1][_0x89ef('0x22')]){writeDB(members[_0x43c5f1]);}}}if(_0x184567[_0x89ef('0x32')]){var _0x57c6d6=_0x184567['destinationchannel'][_0x89ef('0xf')]('-')[0x0];if(!_[_0x89ef('0x25')](members[_0x57c6d6])){members[_0x57c6d6]=_[_0x89ef('0x28')](members[_0x57c6d6],{'data1':members[_0x57c6d6]['data1']||_0x184567[_0x89ef('0x8')],'data2':members[_0x57c6d6][_0x89ef('0x6')]||_0x184567[_0x89ef('0x2d')],'data3':members[_0x57c6d6][_0x89ef('0x2e')]||_0x184567['destination'],'uniqueid':members[_0x57c6d6][_0x89ef('0x19')]||_0x184567[_0x89ef('0x19')]});utils[_0x89ef('0x1a')](util[_0x89ef('0x4')](_0x89ef('0x30'),_0x184567[_0x89ef('0x19')],members[_0x57c6d6][_0x89ef('0x31')],members[_0x57c6d6]['data2'],members[_0x57c6d6]['data3']));if(members[_0x57c6d6][_0x89ef('0x22')]){writeDB(members[_0x57c6d6]);}}}}catch(_0x3cfa30){utils[_0x89ef('0x12')](util['format'](_0x89ef('0x2b'),_0x184567['uniqueid']),_0x3cfa30);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 36a43aa..131463e 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 _0x624d=['queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil'];(function(_0x1fd401,_0x4ed92b){var _0x4cf628=function(_0x5215ab){while(--_0x5215ab){_0x1fd401['push'](_0x1fd401['shift']());}};_0x4cf628(++_0x4ed92b);}(_0x624d,0x1ef));var _0xd624=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x624d[_0x3932eb];return _0x5316e5;};'use strict';var _=require('lodash');var util=require(_0xd624('0x0'));var utils=require(_0xd624('0x1'));var queues={};function writeDB(_0x4c1009){utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x4'),_0x4c1009[_0xd624('0x5')],_0x4c1009['channel'],_0x4c1009[_0xd624('0x6')],_0x4c1009[_0xd624('0x7')],_0x4c1009[_0xd624('0x8')],_0x4c1009[_0xd624('0x9')],_0x4c1009[_0xd624('0xa')]));if(_0x4c1009[_0xd624('0x6')]){utils[_0xd624('0xb')](_0x4c1009['queue'])['then'](function(_0x1a3c70){if(_0x1a3c70){_0x4c1009[_0xd624('0xc')]=_0x1a3c70[_0xd624('0xc')];}utils['request'](_0xd624('0xd'),_0x4c1009);});}else{utils[_0xd624('0xe')](_0xd624('0xd'),_0x4c1009);}if(_0x4c1009['transfereduniqueid']){delete queues[_0x4c1009[_0xd624('0xf')]];}else{delete queues[_0x4c1009[_0xd624('0x5')]];}}exports[_0xd624('0x10')]=function(_0x450425){try{utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x12'),_0x450425[_0xd624('0x5')]),_0x450425);utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x13'),_0x450425[_0xd624('0x5')],_0x450425[_0xd624('0x6')],_0x450425[_0xd624('0x14')]));queues[_0x450425[_0xd624('0x5')]]=_[_0xd624('0x15')](_0x450425,{'originalposition':_0x450425[_0xd624('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x6b3a98){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x12'),_0x450425[_0xd624('0x5')]),_0x6b3a98);}};exports[_0xd624('0x17')]=function(_0x4dc3dc){try{if(!_[_0xd624('0x18')](queues[_0x4dc3dc[_0xd624('0x5')]])){utils[_0xd624('0x11')](util['format']('[%s][queues][hangup]',_0x4dc3dc[_0xd624('0x5')]),_0x4dc3dc);if(queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x19')]){if(!queues[_0x4dc3dc['uniqueid']]['queuecallerabandon']&&!queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x1a')]){queues[_0x4dc3dc['uniqueid']][_0xd624('0x1b')]=!![];queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x1c')]=utils[_0xd624('0x1d')]();queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0xa')]='COMPLETEDBYAGENT';}utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4dc3dc[_0xd624('0x5')],queues[_0x4dc3dc['uniqueid']][_0xd624('0x1e')],queues[_0x4dc3dc[_0xd624('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4dc3dc[_0xd624('0x5')]]);}else if(queues[_0x4dc3dc[_0xd624('0x5')]]['transfereduniqueid']){utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4dc3dc[_0xd624('0x5')],queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0x1e')],queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0xf')]));queues[queues[_0x4dc3dc['uniqueid']][_0xd624('0xf')]]=queues[_0x4dc3dc[_0xd624('0x5')]];queues[queues[_0x4dc3dc[_0xd624('0x5')]][_0xd624('0xf')]][_0xd624('0x1f')]=0x2;delete queues[_0x4dc3dc['uniqueid']];}}}catch(_0x4e5610){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x20'),_0x4dc3dc[_0xd624('0x5')]),_0x4e5610);}};exports['varset']=function(_0x5a87d5){try{utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x21'),_0x5a87d5[_0xd624('0x5')]),_0x5a87d5);if(!_['isNil'](_0x5a87d5['variable'][_0xd624('0x22')])&&_0x5a87d5[_0xd624('0x23')][_0xd624('0x24')]()!==_0xd624('0x25')){if(!_[_0xd624('0x18')](queues[_0x5a87d5[_0xd624('0x5')]])){queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x26')]=![];queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x27')]=null;queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x1a')]=!![];queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x28')]=utils[_0xd624('0x1d')]();queues[_0x5a87d5['uniqueid']][_0xd624('0xa')]=_0x5a87d5[_0xd624('0x23')][_0xd624('0x24')]();utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x29'),_0x5a87d5[_0xd624('0x5')],queues[_0x5a87d5['uniqueid']][_0xd624('0x1e')],_0x5a87d5[_0xd624('0x23')],queues[_0x5a87d5[_0xd624('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x5a87d5[_0xd624('0x5')]]);}}else if(!_[_0xd624('0x18')](_0x5a87d5[_0xd624('0x2a')][_0xd624('0x2b')])){if(!_[_0xd624('0x18')](queues[_0x5a87d5[_0xd624('0x5')]])&&!queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x26')]){queues[_0x5a87d5['uniqueid']]['queuecallerabandon']=![];queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x27')]=null;queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0x1a')]=!![];queues[_0x5a87d5['uniqueid']][_0xd624('0x28')]=utils[_0xd624('0x1d')]();queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0xa')]=_0xd624('0x2c');utils[_0xd624('0x2')](util['format'](_0xd624('0x2d'),_0x5a87d5[_0xd624('0x5')],queues[_0x5a87d5['uniqueid']][_0xd624('0x1e')],_0x5a87d5[_0xd624('0x23')],queues[_0x5a87d5[_0xd624('0x5')]][_0xd624('0xa')]));}}}catch(_0x167bbb){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x21'),_0x5a87d5[_0xd624('0x5')]),_0x167bbb);}};exports[_0xd624('0x26')]=function(_0x21e264){try{if(!_[_0xd624('0x18')](queues[_0x21e264[_0xd624('0x5')]])){utils[_0xd624('0x11')](util['format'](_0xd624('0x2e'),_0x21e264['uniqueid']),_0x21e264);queues[_0x21e264['uniqueid']][_0xd624('0x1a')]=![];queues[_0x21e264['uniqueid']][_0xd624('0x28')]=null;queues[_0x21e264[_0xd624('0x5')]][_0xd624('0x26')]=!![];queues[_0x21e264['uniqueid']][_0xd624('0x27')]=utils['now']();queues[_0x21e264[_0xd624('0x5')]][_0xd624('0xa')]=_0xd624('0x2f');utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x21e264['uniqueid'],queues[_0x21e264['uniqueid']][_0xd624('0x1e')],queues[_0x21e264[_0xd624('0x5')]][_0xd624('0xa')]));}}catch(_0x3eee8d){utils[_0xd624('0x16')](util['format'](_0xd624('0x2e'),_0x21e264[_0xd624('0x5')]),_0x3eee8d);}};exports['queuecallerleave']=function(_0x5bbff5){try{if(!_[_0xd624('0x18')](queues[_0x5bbff5[_0xd624('0x5')]])){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x30'),_0x5bbff5[_0xd624('0x5')]),_0x5bbff5);utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x31'),_0x5bbff5[_0xd624('0x5')],queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x1e')],_0x5bbff5[_0xd624('0x32')],_0x5bbff5['connectedlinename']));queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x33')]=!![];queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x19')]=utils[_0xd624('0x1d')]();queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x34')]=utils['diffTime'](queues[_0x5bbff5[_0xd624('0x5')]]['queuecallerleaveAt'],queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x35')]);queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x14')]=_0x5bbff5[_0xd624('0x14')];queues[_0x5bbff5['uniqueid']][_0xd624('0x36')]=_0x5bbff5[_0xd624('0x36')];queues[_0x5bbff5[_0xd624('0x5')]]['connectedlinenum']=_0x5bbff5[_0xd624('0x32')];queues[_0x5bbff5[_0xd624('0x5')]][_0xd624('0x37')]=_0x5bbff5[_0xd624('0x37')];}}catch(_0x28eecf){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x30'),_0x5bbff5[_0xd624('0x5')]),_0x28eecf);}};exports['agentconnect']=function(_0x31bd66){try{if(!_[_0xd624('0x18')](queues[_0x31bd66[_0xd624('0x5')]])){utils[_0xd624('0x11')](util['format']('[%s][queues][agentconnect]',_0x31bd66['uniqueid']),_0x31bd66);utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x38'),_0x31bd66[_0xd624('0x5')],queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x1e')],_0x31bd66[_0xd624('0x39')],_0x31bd66['destaccountcode']));queues[_0x31bd66['uniqueid']][_0xd624('0x26')]=![];queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x26')]=![];queues[_0x31bd66[_0xd624('0x5')]]['queuecallerabandonAt']=null;queues[_0x31bd66[_0xd624('0x5')]]['queuecallerexit']=![];queues[_0x31bd66['uniqueid']][_0xd624('0xa')]=null;queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x28')]=null;queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x3a')]=!![];queues[_0x31bd66[_0xd624('0x5')]][_0xd624('0x9')]=_0x31bd66[_0xd624('0x3b')];queues[_0x31bd66[_0xd624('0x5')]]['lastAssignedTo']=_0x31bd66[_0xd624('0x39')];}}catch(_0x2094b6){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x3c'),_0x31bd66['uniqueid']),_0x2094b6);}};exports[_0xd624('0x3d')]=function(_0x2ea095){try{if(!_[_0xd624('0x18')](queues[_0x2ea095[_0xd624('0x5')]])){if(queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x19')]){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x3e'),_0x2ea095[_0xd624('0x5')]),_0x2ea095);queues[_0x2ea095[_0xd624('0x5')]]['queuecallerabandon']=![];queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x26')]=![];queues[_0x2ea095['uniqueid']][_0xd624('0x27')]=null;queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x1a')]=![];queues[_0x2ea095['uniqueid']][_0xd624('0x28')]=null;queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x3a')]=!![];queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x7')]=_0x2ea095[_0xd624('0x39')];queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x1b')]=!![];queues[_0x2ea095[_0xd624('0x5')]]['queuecallercompleteAt']=utils[_0xd624('0x1d')]();if(_0x2ea095['reason']==_0xd624('0x3f')){if(!queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x3f')]){queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0xa')]='TRANSFER';}}else{queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0xa')]=_0xd624('0x40')+_0x2ea095[_0xd624('0x41')][_0xd624('0x24')]();}utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2ea095['uniqueid'],queues[_0x2ea095[_0xd624('0x5')]][_0xd624('0x1e')],_0x2ea095[_0xd624('0x39')],queues[_0x2ea095[_0xd624('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2ea095[_0xd624('0x5')]]);}}}catch(_0x1fb9b8){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x3e'),_0x2ea095[_0xd624('0x5')]),_0x1fb9b8);}};exports[_0xd624('0x42')]=function(_0x34d01f){try{if(!_[_0xd624('0x18')](queues[_0x34d01f[_0xd624('0x43')]])){utils[_0xd624('0x11')](util['format'](_0xd624('0x44'),_0x34d01f[_0xd624('0x5')]),_0x34d01f);queues[_0x34d01f['transfereeuniqueid']][_0xd624('0x3f')]=!![];queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0x45')]=_0xd624('0x46');queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0x47')]=_0x34d01f['extension'];queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0x48')]=_0x34d01f['transfereeuniqueid'];queues[_0x34d01f[_0xd624('0x43')]][_0xd624('0xa')]=_0xd624('0x49');utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x4a'),_0x34d01f['uniqueid'],queues[_0x34d01f[_0xd624('0x43')]]['name'],_0x34d01f[_0xd624('0x43')],_0x34d01f[_0xd624('0x4b')]));}}catch(_0x2b176d){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x44'),_0x34d01f['uniqueid']),_0x2b176d);}};exports[_0xd624('0x4c')]=function(_0x10060e){try{utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x4d'),_0x10060e[_0xd624('0x4e')]),_0x10060e);if(_0x10060e[_0xd624('0x4e')]==_0x10060e[_0xd624('0x4f')]){if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x50')]])){utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x51'),_0x10060e[_0xd624('0x4e')],queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x1e')],_0x10060e[_0xd624('0x52')]));queues[_0x10060e[_0xd624('0x50')]]['transfer']=!![];queues[_0x10060e[_0xd624('0x50')]]['transfertype']=_0xd624('0x53');queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x47')]=_0x10060e['origtransfererexten'];queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x48')]=_0x10060e[_0xd624('0x4e')];queues[_0x10060e['secondtransfererlinkedid']][_0xd624('0xa')]=_0xd624('0x54');}if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x4f')]])){if(_0x10060e[_0xd624('0x55')]&&queues[_0x10060e[_0xd624('0x55')]]){queues[_0x10060e[_0xd624('0x55')]]['queuecallerenterreason']=0x1;queues[_0x10060e[_0xd624('0x43')]]=_[_0xd624('0x56')](queues[_0x10060e[_0xd624('0x55')]]);queues[_0x10060e[_0xd624('0x43')]][_0xd624('0xf')]=_0x10060e[_0xd624('0x57')];queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x1f')]=0x2;queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x8')]=queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x8')];queues[_0x10060e['transfereeuniqueid']][_0xd624('0x58')]=queues[_0x10060e[_0xd624('0x50')]][_0xd624('0x58')];queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x35')]=utils[_0xd624('0x1d')]();queues[_0x10060e[_0xd624('0x43')]]['queuecallerleaveAt']=utils[_0xd624('0x1d')]();queues[_0x10060e['transfereeuniqueid']][_0xd624('0x34')]=0x0;queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x59')]=0x0;utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x5a'),_0x10060e[_0xd624('0x4e')],queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x1e')],queues[_0x10060e[_0xd624('0x43')]][_0xd624('0x8')],queues[_0x10060e[_0xd624('0x43')]]['calleridname']));}else{utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x5b'),_0x10060e[_0xd624('0x4e')],queues[_0x10060e['origtransfererlinkedid']][_0xd624('0x1e')],_0x10060e[_0xd624('0x50')]));queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0xf')]=_0x10060e[_0xd624('0x50')];}}}else if(_0x10060e[_0xd624('0x5c')]==_0x10060e['secondtransfererlinkedid']){if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x4f')]])){utils[_0xd624('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x10060e[_0xd624('0x4e')],queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x1e')],_0x10060e[_0xd624('0x5c')],_0x10060e['secondtransfererexten']));queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x3f')]=!![];queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x45')]='ATTENDED';queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x47')]=_0x10060e[_0xd624('0x5d')];queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x48')]=_0x10060e[_0xd624('0x5c')];queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0xa')]=_0xd624('0x54');}if(!_[_0xd624('0x18')](queues[_0x10060e[_0xd624('0x50')]])){if(_0x10060e[_0xd624('0x5e')]&&queues[_0x10060e[_0xd624('0x5e')]]){queues[_0x10060e[_0xd624('0x5e')]][_0xd624('0x1f')]=0x1;queues[_0x10060e['transfertargetuniqueid']]=_[_0xd624('0x56')](queues[_0x10060e[_0xd624('0x5e')]]);queues[_0x10060e['transfertargetuniqueid']][_0xd624('0xf')]=_0x10060e[_0xd624('0x57')];queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x1f')]=0x2;queues[_0x10060e['transfertargetuniqueid']][_0xd624('0x8')]=queues[_0x10060e[_0xd624('0x4f')]][_0xd624('0x8')];queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x58')]=queues[_0x10060e['origtransfererlinkedid']]['calleridname'];queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x35')]=utils[_0xd624('0x1d')]();queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x19')]=utils[_0xd624('0x1d')]();queues[_0x10060e[_0xd624('0x57')]]['holdtime']=0x0;queues[_0x10060e['transfertargetuniqueid']]['mohtime']=0x0;utils['info'](util['format'](_0xd624('0x5f'),_0x10060e['origtransfereruniqueid'],queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x1e')],queues[_0x10060e[_0xd624('0x57')]][_0xd624('0xf')],queues[_0x10060e[_0xd624('0x57')]][_0xd624('0x8')],queues[_0x10060e['transfertargetuniqueid']][_0xd624('0x58')]));}else{utils[_0xd624('0x2')](util[_0xd624('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x10060e[_0xd624('0x4e')],queues[_0x10060e['secondtransfererlinkedid']]['name'],_0x10060e[_0xd624('0x4f')]));queues[_0x10060e[_0xd624('0x50')]][_0xd624('0xf')]=_0x10060e[_0xd624('0x4f')];}}}}catch(_0x2f8b91){utils['error'](util[_0xd624('0x3')]('[%s][queues][attendedtransfer]',_0x10060e[_0xd624('0x4e')]),_0x2f8b91);}};exports[_0xd624('0x60')]=function(_0x2122ec){try{if(!_[_0xd624('0x18')](queues[_0x2122ec[_0xd624('0x5')]])){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x61'),_0x2122ec[_0xd624('0x5')]),_0x2122ec);queues[_0x2122ec['uniqueid']][_0xd624('0x62')]=utils[_0xd624('0x1d')]();utils[_0xd624('0x2')](util[_0xd624('0x3')](_0xd624('0x63'),_0x2122ec[_0xd624('0x5')],queues[_0x2122ec[_0xd624('0x5')]][_0xd624('0x1e')],queues[_0x2122ec[_0xd624('0x5')]][_0xd624('0x62')]));}}catch(_0x51085e){utils['error'](util[_0xd624('0x3')](_0xd624('0x61'),_0x2122ec[_0xd624('0x5')]),_0x51085e);}};exports[_0xd624('0x64')]=function(_0x241f40){try{if(!_[_0xd624('0x18')](queues[_0x241f40[_0xd624('0x5')]])){if(!_[_0xd624('0x18')](queues[_0x241f40[_0xd624('0x5')]][_0xd624('0x62')])){utils[_0xd624('0x11')](util[_0xd624('0x3')](_0xd624('0x65'),_0x241f40[_0xd624('0x5')]),_0x241f40);queues[_0x241f40[_0xd624('0x5')]]['mohtime']+=utils[_0xd624('0x66')](utils[_0xd624('0x1d')](),queues[_0x241f40['uniqueid']][_0xd624('0x62')]);utils['info'](util['format'](_0xd624('0x67'),_0x241f40[_0xd624('0x5')],queues[_0x241f40[_0xd624('0x5')]][_0xd624('0x1e')],queues[_0x241f40[_0xd624('0x5')]][_0xd624('0x59')]));delete queues[_0x241f40[_0xd624('0x5')]]['musiconholdstartAt'];}}}catch(_0x372993){utils[_0xd624('0x16')](util[_0xd624('0x3')](_0xd624('0x65'),_0x241f40[_0xd624('0x5')]),_0x372993);}}; \ No newline at end of file +var _0x89e9=['variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','info','assign','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','debug','isNil'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x89e9,0x118));var _0x989e=function(_0x181845,_0x3f9fcb){_0x181845=_0x181845-0x0;var _0x19f33d=_0x89e9[_0x181845];return _0x19f33d;};'use strict';var _=require('lodash');var util=require(_0x989e('0x0'));var utils=require(_0x989e('0x1'));var queues={};function writeDB(_0x512990){utils['info'](util[_0x989e('0x2')](_0x989e('0x3'),_0x512990[_0x989e('0x4')],_0x512990[_0x989e('0x5')],_0x512990[_0x989e('0x6')],_0x512990['lastAssignedTo'],_0x512990[_0x989e('0x7')],_0x512990[_0x989e('0x8')],_0x512990['queuecallerexitreason']));if(_0x512990[_0x989e('0x6')]){utils[_0x989e('0x9')](_0x512990[_0x989e('0x6')])[_0x989e('0xa')](function(_0x12ed25){if(_0x12ed25){_0x512990[_0x989e('0xb')]=_0x12ed25['type'];}utils[_0x989e('0xc')]('CreateVoiceQueueReport',_0x512990);});}else{utils['request'](_0x989e('0xd'),_0x512990);}if(_0x512990[_0x989e('0xe')]){delete queues[_0x512990[_0x989e('0xe')]];}else{delete queues[_0x512990[_0x989e('0x4')]];}}exports['queuecallerjoin']=function(_0x50669d){try{utils['debug'](util[_0x989e('0x2')](_0x989e('0xf'),_0x50669d[_0x989e('0x4')]),_0x50669d);utils[_0x989e('0x10')](util[_0x989e('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x50669d[_0x989e('0x4')],_0x50669d[_0x989e('0x6')],_0x50669d['position']));queues[_0x50669d['uniqueid']]=_[_0x989e('0x11')](_0x50669d,{'originalposition':_0x50669d['position'],'queuecallerjoinAt':utils[_0x989e('0x12')](),'mohtime':0x0});}catch(_0x3767b7){utils['error'](util[_0x989e('0x2')](_0x989e('0xf'),_0x50669d[_0x989e('0x4')]),_0x3767b7);}};exports[_0x989e('0x13')]=function(_0x116af5){try{if(!_['isNil'](queues[_0x116af5[_0x989e('0x4')]])){utils['debug'](util['format'](_0x989e('0x14'),_0x116af5[_0x989e('0x4')]),_0x116af5);if(queues[_0x116af5[_0x989e('0x4')]][_0x989e('0x15')]){if(!queues[_0x116af5[_0x989e('0x4')]][_0x989e('0x16')]&&!queues[_0x116af5[_0x989e('0x4')]]['queuecallerexit']){queues[_0x116af5['uniqueid']][_0x989e('0x17')]=!![];queues[_0x116af5[_0x989e('0x4')]][_0x989e('0x18')]=utils['now']();queues[_0x116af5['uniqueid']][_0x989e('0x19')]=_0x989e('0x1a');}utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x1b'),_0x116af5[_0x989e('0x4')],queues[_0x116af5['uniqueid']][_0x989e('0x1c')],queues[_0x116af5[_0x989e('0x4')]][_0x989e('0x19')]));writeDB(queues[_0x116af5[_0x989e('0x4')]]);}else if(queues[_0x116af5[_0x989e('0x4')]][_0x989e('0xe')]){utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x1d'),_0x116af5[_0x989e('0x4')],queues[_0x116af5[_0x989e('0x4')]][_0x989e('0x1c')],queues[_0x116af5[_0x989e('0x4')]][_0x989e('0xe')]));queues[queues[_0x116af5[_0x989e('0x4')]][_0x989e('0xe')]]=queues[_0x116af5[_0x989e('0x4')]];queues[queues[_0x116af5[_0x989e('0x4')]]['transfereduniqueid']][_0x989e('0x1e')]=0x2;delete queues[_0x116af5[_0x989e('0x4')]];}}}catch(_0x29f16b){utils[_0x989e('0x1f')](util['format'](_0x989e('0x14'),_0x116af5[_0x989e('0x4')]),_0x29f16b);}};exports[_0x989e('0x20')]=function(_0x2e43ff){try{utils[_0x989e('0x21')](util[_0x989e('0x2')]('[%s][queues][varset]',_0x2e43ff[_0x989e('0x4')]),_0x2e43ff);if(!_[_0x989e('0x22')](_0x2e43ff[_0x989e('0x23')][_0x989e('0x24')])&&_0x2e43ff[_0x989e('0x25')][_0x989e('0x26')]()!==_0x989e('0x27')){if(!_[_0x989e('0x22')](queues[_0x2e43ff[_0x989e('0x4')]])){queues[_0x2e43ff[_0x989e('0x4')]][_0x989e('0x16')]=![];queues[_0x2e43ff['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2e43ff[_0x989e('0x4')]][_0x989e('0x28')]=!![];queues[_0x2e43ff['uniqueid']][_0x989e('0x29')]=utils[_0x989e('0x12')]();queues[_0x2e43ff[_0x989e('0x4')]][_0x989e('0x19')]=_0x2e43ff[_0x989e('0x25')]['toUpperCase']();utils['info'](util[_0x989e('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2e43ff[_0x989e('0x4')],queues[_0x2e43ff[_0x989e('0x4')]]['name'],_0x2e43ff['value'],queues[_0x2e43ff[_0x989e('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x2e43ff[_0x989e('0x4')]]);}}else if(!_['isNil'](_0x2e43ff['variable']['queueposition'])){if(!_[_0x989e('0x22')](queues[_0x2e43ff[_0x989e('0x4')]])&&!queues[_0x2e43ff[_0x989e('0x4')]][_0x989e('0x16')]){queues[_0x2e43ff['uniqueid']][_0x989e('0x16')]=![];queues[_0x2e43ff[_0x989e('0x4')]][_0x989e('0x2a')]=null;queues[_0x2e43ff['uniqueid']]['queuecallerexit']=!![];queues[_0x2e43ff[_0x989e('0x4')]]['queuecallerexitAt']=utils[_0x989e('0x12')]();queues[_0x2e43ff[_0x989e('0x4')]]['queuecallerexitreason']=_0x989e('0x2b');utils[_0x989e('0x10')](util[_0x989e('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2e43ff[_0x989e('0x4')],queues[_0x2e43ff[_0x989e('0x4')]]['name'],_0x2e43ff[_0x989e('0x25')],queues[_0x2e43ff[_0x989e('0x4')]][_0x989e('0x19')]));}}}catch(_0x5669cf){utils[_0x989e('0x1f')](util[_0x989e('0x2')](_0x989e('0x2c'),_0x2e43ff[_0x989e('0x4')]),_0x5669cf);}};exports[_0x989e('0x16')]=function(_0x1dc059){try{if(!_[_0x989e('0x22')](queues[_0x1dc059[_0x989e('0x4')]])){utils[_0x989e('0x21')](util[_0x989e('0x2')](_0x989e('0x2d'),_0x1dc059[_0x989e('0x4')]),_0x1dc059);queues[_0x1dc059[_0x989e('0x4')]][_0x989e('0x28')]=![];queues[_0x1dc059[_0x989e('0x4')]][_0x989e('0x29')]=null;queues[_0x1dc059[_0x989e('0x4')]][_0x989e('0x16')]=!![];queues[_0x1dc059[_0x989e('0x4')]][_0x989e('0x2a')]=utils[_0x989e('0x12')]();queues[_0x1dc059['uniqueid']][_0x989e('0x19')]=_0x989e('0x2e');utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x2f'),_0x1dc059[_0x989e('0x4')],queues[_0x1dc059['uniqueid']]['name'],queues[_0x1dc059[_0x989e('0x4')]][_0x989e('0x19')]));}}catch(_0x462531){utils[_0x989e('0x1f')](util[_0x989e('0x2')]('[%s][queues][queuecallerabandon]',_0x1dc059['uniqueid']),_0x462531);}};exports[_0x989e('0x30')]=function(_0x34bbbf){try{if(!_[_0x989e('0x22')](queues[_0x34bbbf[_0x989e('0x4')]])){utils['debug'](util[_0x989e('0x2')](_0x989e('0x31'),_0x34bbbf[_0x989e('0x4')]),_0x34bbbf);utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x32'),_0x34bbbf[_0x989e('0x4')],queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x1c')],_0x34bbbf[_0x989e('0x33')],_0x34bbbf[_0x989e('0x34')]));queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x30')]=!![];queues[_0x34bbbf['uniqueid']][_0x989e('0x15')]=utils[_0x989e('0x12')]();queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x35')]=utils[_0x989e('0x36')](queues[_0x34bbbf['uniqueid']][_0x989e('0x15')],queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x37')]);queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x38')]=_0x34bbbf[_0x989e('0x38')];queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x39')]=_0x34bbbf[_0x989e('0x39')];queues[_0x34bbbf['uniqueid']][_0x989e('0x33')]=_0x34bbbf[_0x989e('0x33')];queues[_0x34bbbf[_0x989e('0x4')]][_0x989e('0x34')]=_0x34bbbf[_0x989e('0x34')];}}catch(_0x27fbcc){utils[_0x989e('0x1f')](util[_0x989e('0x2')](_0x989e('0x31'),_0x34bbbf[_0x989e('0x4')]),_0x27fbcc);}};exports[_0x989e('0x3a')]=function(_0x4c7ecd){try{if(!_[_0x989e('0x22')](queues[_0x4c7ecd['uniqueid']])){utils['debug'](util[_0x989e('0x2')](_0x989e('0x3b'),_0x4c7ecd[_0x989e('0x4')]),_0x4c7ecd);utils['info'](util[_0x989e('0x2')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4c7ecd[_0x989e('0x4')],queues[_0x4c7ecd[_0x989e('0x4')]]['name'],_0x4c7ecd['membername'],_0x4c7ecd[_0x989e('0x3c')]));queues[_0x4c7ecd[_0x989e('0x4')]][_0x989e('0x16')]=![];queues[_0x4c7ecd['uniqueid']][_0x989e('0x16')]=![];queues[_0x4c7ecd['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4c7ecd[_0x989e('0x4')]][_0x989e('0x28')]=![];queues[_0x4c7ecd[_0x989e('0x4')]]['queuecallerexitreason']=null;queues[_0x4c7ecd[_0x989e('0x4')]][_0x989e('0x29')]=null;queues[_0x4c7ecd[_0x989e('0x4')]][_0x989e('0x3d')]=!![];queues[_0x4c7ecd[_0x989e('0x4')]][_0x989e('0x8')]=_0x4c7ecd[_0x989e('0x3c')];queues[_0x4c7ecd['uniqueid']]['lastAssignedTo']=_0x4c7ecd[_0x989e('0x3e')];}}catch(_0x20b8ce){utils[_0x989e('0x1f')](util[_0x989e('0x2')](_0x989e('0x3b'),_0x4c7ecd[_0x989e('0x4')]),_0x20b8ce);}};exports[_0x989e('0x3f')]=function(_0x584e62){try{if(!_['isNil'](queues[_0x584e62['uniqueid']])){if(queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x15')]){utils[_0x989e('0x21')](util[_0x989e('0x2')](_0x989e('0x40'),_0x584e62[_0x989e('0x4')]),_0x584e62);queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x16')]=![];queues[_0x584e62[_0x989e('0x4')]]['queuecallerabandon']=![];queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x2a')]=null;queues[_0x584e62['uniqueid']]['queuecallerexit']=![];queues[_0x584e62['uniqueid']][_0x989e('0x29')]=null;queues[_0x584e62['uniqueid']][_0x989e('0x3d')]=!![];queues[_0x584e62[_0x989e('0x4')]]['lastAssignedTo']=_0x584e62[_0x989e('0x3e')];queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x17')]=!![];queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x18')]=utils[_0x989e('0x12')]();if(_0x584e62['reason']=='transfer'){if(!queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x41')]){queues[_0x584e62[_0x989e('0x4')]]['queuecallerexitreason']=_0x989e('0x42');}}else{queues[_0x584e62[_0x989e('0x4')]]['queuecallerexitreason']=_0x989e('0x43')+_0x584e62[_0x989e('0x44')][_0x989e('0x26')]();}utils['info'](util['format'](_0x989e('0x45'),_0x584e62['uniqueid'],queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x1c')],_0x584e62['membername'],queues[_0x584e62[_0x989e('0x4')]][_0x989e('0x19')]));writeDB(queues[_0x584e62[_0x989e('0x4')]]);}}}catch(_0x33c61e){utils[_0x989e('0x1f')](util[_0x989e('0x2')](_0x989e('0x40'),_0x584e62[_0x989e('0x4')]),_0x33c61e);}};exports[_0x989e('0x46')]=function(_0x19ce99){try{if(!_[_0x989e('0x22')](queues[_0x19ce99[_0x989e('0x47')]])){utils[_0x989e('0x21')](util[_0x989e('0x2')](_0x989e('0x48'),_0x19ce99[_0x989e('0x4')]),_0x19ce99);queues[_0x19ce99[_0x989e('0x47')]][_0x989e('0x41')]=!![];queues[_0x19ce99['transfereeuniqueid']][_0x989e('0x49')]=_0x989e('0x4a');queues[_0x19ce99['transfereeuniqueid']][_0x989e('0x4b')]=_0x19ce99[_0x989e('0x4c')];queues[_0x19ce99[_0x989e('0x47')]][_0x989e('0x4d')]=_0x19ce99[_0x989e('0x47')];queues[_0x19ce99['transfereeuniqueid']][_0x989e('0x19')]=_0x989e('0x4e');utils[_0x989e('0x10')](util[_0x989e('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x19ce99[_0x989e('0x4')],queues[_0x19ce99[_0x989e('0x47')]][_0x989e('0x1c')],_0x19ce99['transfereeuniqueid'],_0x19ce99[_0x989e('0x4c')]));}}catch(_0x4d1236){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x19ce99[_0x989e('0x4')]),_0x4d1236);}};exports[_0x989e('0x4f')]=function(_0x9383eb){try{utils['debug'](util[_0x989e('0x2')](_0x989e('0x50'),_0x9383eb[_0x989e('0x51')]),_0x9383eb);if(_0x9383eb[_0x989e('0x51')]==_0x9383eb[_0x989e('0x52')]){if(!_[_0x989e('0x22')](queues[_0x9383eb[_0x989e('0x53')]])){utils[_0x989e('0x10')](util['format'](_0x989e('0x54'),_0x9383eb[_0x989e('0x51')],queues[_0x9383eb[_0x989e('0x53')]][_0x989e('0x1c')],_0x9383eb[_0x989e('0x55')]));queues[_0x9383eb[_0x989e('0x53')]][_0x989e('0x41')]=!![];queues[_0x9383eb['secondtransfererlinkedid']][_0x989e('0x49')]=_0x989e('0x56');queues[_0x9383eb['secondtransfererlinkedid']][_0x989e('0x4b')]=_0x9383eb[_0x989e('0x55')];queues[_0x9383eb[_0x989e('0x53')]]['transferuniqueid']=_0x9383eb[_0x989e('0x51')];queues[_0x9383eb[_0x989e('0x53')]]['queuecallerexitreason']=_0x989e('0x57');}if(!_[_0x989e('0x22')](queues[_0x9383eb['origtransfererlinkedid']])){if(_0x9383eb[_0x989e('0x58')]&&queues[_0x9383eb[_0x989e('0x58')]]){queues[_0x9383eb['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x9383eb[_0x989e('0x47')]]=_[_0x989e('0x59')](queues[_0x9383eb[_0x989e('0x58')]]);queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0xe')]=_0x9383eb[_0x989e('0x5a')];queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x1e')]=0x2;queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x7')]=queues[_0x9383eb[_0x989e('0x53')]][_0x989e('0x7')];queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x5b')]=queues[_0x9383eb[_0x989e('0x53')]][_0x989e('0x5b')];queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x37')]=utils[_0x989e('0x12')]();queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x15')]=utils['now']();queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x35')]=0x0;queues[_0x9383eb[_0x989e('0x47')]][_0x989e('0x5c')]=0x0;utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x5d'),_0x9383eb['origtransfereruniqueid'],queues[_0x9383eb[_0x989e('0x47')]]['name'],queues[_0x9383eb[_0x989e('0x47')]]['calleridnum'],queues[_0x9383eb['transfereeuniqueid']][_0x989e('0x5b')]));}else{utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x5e'),_0x9383eb[_0x989e('0x51')],queues[_0x9383eb[_0x989e('0x52')]][_0x989e('0x1c')],_0x9383eb[_0x989e('0x53')]));queues[_0x9383eb['origtransfererlinkedid']][_0x989e('0xe')]=_0x9383eb[_0x989e('0x53')];}}}else if(_0x9383eb['secondtransfereruniqueid']==_0x9383eb[_0x989e('0x53')]){if(!_[_0x989e('0x22')](queues[_0x9383eb[_0x989e('0x52')]])){utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x5f'),_0x9383eb[_0x989e('0x51')],queues[_0x9383eb['origtransfererlinkedid']][_0x989e('0x1c')],_0x9383eb[_0x989e('0x60')],_0x9383eb['secondtransfererexten']));queues[_0x9383eb[_0x989e('0x52')]][_0x989e('0x41')]=!![];queues[_0x9383eb[_0x989e('0x52')]]['transfertype']=_0x989e('0x56');queues[_0x9383eb['origtransfererlinkedid']]['transferexten']=_0x9383eb['secondtransfererexten'];queues[_0x9383eb['origtransfererlinkedid']][_0x989e('0x4d')]=_0x9383eb[_0x989e('0x60')];queues[_0x9383eb[_0x989e('0x52')]]['queuecallerexitreason']=_0x989e('0x57');}if(!_[_0x989e('0x22')](queues[_0x9383eb[_0x989e('0x53')]])){if(_0x9383eb[_0x989e('0x61')]&&queues[_0x9383eb['transfertargetlinkedid']]){queues[_0x9383eb[_0x989e('0x61')]]['queuecallerenterreason']=0x1;queues[_0x9383eb[_0x989e('0x5a')]]=_[_0x989e('0x59')](queues[_0x9383eb[_0x989e('0x61')]]);queues[_0x9383eb['transfertargetuniqueid']][_0x989e('0xe')]=_0x9383eb[_0x989e('0x5a')];queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x1e')]=0x2;queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x7')]=queues[_0x9383eb[_0x989e('0x52')]]['calleridnum'];queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x5b')]=queues[_0x9383eb[_0x989e('0x52')]][_0x989e('0x5b')];queues[_0x9383eb['transfertargetuniqueid']][_0x989e('0x37')]=utils[_0x989e('0x12')]();queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x15')]=utils[_0x989e('0x12')]();queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x35')]=0x0;queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x5c')]=0x0;utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x62'),_0x9383eb[_0x989e('0x51')],queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x1c')],queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0xe')],queues[_0x9383eb[_0x989e('0x5a')]][_0x989e('0x7')],queues[_0x9383eb[_0x989e('0x5a')]]['calleridname']));}else{utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x5e'),_0x9383eb['origtransfereruniqueid'],queues[_0x9383eb[_0x989e('0x53')]][_0x989e('0x1c')],_0x9383eb[_0x989e('0x52')]));queues[_0x9383eb[_0x989e('0x53')]]['transfereduniqueid']=_0x9383eb['origtransfererlinkedid'];}}}}catch(_0x46b2b7){utils[_0x989e('0x1f')](util[_0x989e('0x2')]('[%s][queues][attendedtransfer]',_0x9383eb['origtransfereruniqueid']),_0x46b2b7);}};exports[_0x989e('0x63')]=function(_0x45ea54){try{if(!_[_0x989e('0x22')](queues[_0x45ea54[_0x989e('0x4')]])){utils[_0x989e('0x21')](util[_0x989e('0x2')](_0x989e('0x64'),_0x45ea54[_0x989e('0x4')]),_0x45ea54);queues[_0x45ea54[_0x989e('0x4')]][_0x989e('0x65')]=utils[_0x989e('0x12')]();utils[_0x989e('0x10')](util[_0x989e('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x45ea54[_0x989e('0x4')],queues[_0x45ea54[_0x989e('0x4')]][_0x989e('0x1c')],queues[_0x45ea54[_0x989e('0x4')]]['musiconholdstartAt']));}}catch(_0x49d8a7){utils[_0x989e('0x1f')](util[_0x989e('0x2')](_0x989e('0x64'),_0x45ea54[_0x989e('0x4')]),_0x49d8a7);}};exports[_0x989e('0x66')]=function(_0x3b1223){try{if(!_[_0x989e('0x22')](queues[_0x3b1223['uniqueid']])){if(!_[_0x989e('0x22')](queues[_0x3b1223[_0x989e('0x4')]]['musiconholdstartAt'])){utils[_0x989e('0x21')](util[_0x989e('0x2')](_0x989e('0x67'),_0x3b1223[_0x989e('0x4')]),_0x3b1223);queues[_0x3b1223[_0x989e('0x4')]]['mohtime']+=utils['diffTime'](utils[_0x989e('0x12')](),queues[_0x3b1223['uniqueid']][_0x989e('0x65')]);utils[_0x989e('0x10')](util[_0x989e('0x2')](_0x989e('0x68'),_0x3b1223[_0x989e('0x4')],queues[_0x3b1223[_0x989e('0x4')]][_0x989e('0x1c')],queues[_0x3b1223[_0x989e('0x4')]][_0x989e('0x5c')]));delete queues[_0x3b1223[_0x989e('0x4')]][_0x989e('0x65')];}}}catch(_0x3ee43a){utils[_0x989e('0x1f')](util['format'](_0x989e('0x67'),_0x3b1223['uniqueid']),_0x3ee43a);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index ef01ee6..4bb97a0 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 _0xd01b=['channel','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','find','monitors','error','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','exten'];(function(_0x450559,_0x2d336b){var _0xdf7c0c=function(_0x1a2d29){while(--_0x1a2d29){_0x450559['push'](_0x450559['shift']());}};_0xdf7c0c(++_0x2d336b);}(_0xd01b,0x1de));var _0xbd01=function(_0x425213,_0x4ea76b){_0x425213=_0x425213-0x0;var _0x4d3448=_0xd01b[_0x425213];return _0x4d3448;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var utils=require(_0xbd01('0x1'));var transfers=require(_0xbd01('0x2'));var recordings={};function writeDB(_0x4e29b3){var _0x2b358f;utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x5'),_0x4e29b3[_0xbd01('0x6')]));if(transfers[_0xbd01('0x7')][_0x4e29b3[_0xbd01('0x6')]]){_0x2b358f=_0x4e29b3[_0xbd01('0x6')];_0x4e29b3[_0xbd01('0x6')]=transfers[_0xbd01('0x7')][_0x4e29b3[_0xbd01('0x6')]]['transfereeuniqueid'];}if(_0x4e29b3['accountcode']){utils[_0xbd01('0x8')](_0x4e29b3[_0xbd01('0x9')])[_0xbd01('0xa')](function(_0x32caee){if(_0x32caee){_0x4e29b3[_0xbd01('0xb')]=_0x32caee['name'];_0x4e29b3[_0xbd01('0xc')]=_0x32caee['id'];}utils[_0xbd01('0xd')](_0xbd01('0xe'),_0x4e29b3);});}else{utils[_0xbd01('0xd')](_0xbd01('0xe'),_0x4e29b3);}if(_0x2b358f)delete transfers[_0xbd01('0x7')][_0x2b358f];}exports[_0xbd01('0xf')]=function(_0x3e8b0f){try{utils['debug'](util['format'](_0xbd01('0x10'),_0x3e8b0f[_0xbd01('0x6')]),_0x3e8b0f);if(_0x3e8b0f[_0xbd01('0x6')]==_0x3e8b0f[_0xbd01('0x11')]){utils[_0xbd01('0x3')](util[_0xbd01('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3e8b0f['uniqueid'],_0x3e8b0f['context'],_0x3e8b0f[_0xbd01('0x12')]));recordings[_0x3e8b0f['uniqueid']]={'uniqueid':_0x3e8b0f[_0xbd01('0x6')],'accountcode':_0x3e8b0f[_0xbd01('0x9')],'exten':_0x3e8b0f['exten'],'context':_0x3e8b0f['context'],'channel':_0x3e8b0f[_0xbd01('0x13')],'monitors':[]};}}catch(_0x545ac8){utils['error'](util[_0xbd01('0x4')](_0xbd01('0x10'),_0x3e8b0f[_0xbd01('0x6')]),_0x545ac8);}};exports[_0xbd01('0x14')]=function(_0x440c4b){try{utils['debug'](util['format'](_0xbd01('0x15'),_0x440c4b['uniqueid']),_0x440c4b);if(!_[_0xbd01('0x16')](recordings[_0x440c4b[_0xbd01('0x6')]])&&_0x440c4b['channelstate']==0x6){utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x17'),_0x440c4b[_0xbd01('0x6')],_0x440c4b['context'],_0x440c4b['channel']));}else if(!_[_0xbd01('0x16')](recordings[_0x440c4b[_0xbd01('0x11')]])&&_0x440c4b[_0xbd01('0x18')]==0x6&&_0x440c4b[_0xbd01('0x19')]!=_0xbd01('0x1a')){utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x1b'),_0x440c4b[_0xbd01('0x6')],_0x440c4b[_0xbd01('0x11')],_0x440c4b[_0xbd01('0x19')],_0x440c4b[_0xbd01('0x13')]));recordings[_0x440c4b[_0xbd01('0x11')]][_0xbd01('0x9')]=_0x440c4b['accountcode'];}}catch(_0x237ec2){utils['error'](util[_0xbd01('0x4')]('[%s][recordings][newstate]',_0x440c4b['uniqueid']),_0x237ec2);}};exports[_0xbd01('0x1c')]=function(_0x146866){try{if(!_[_0xbd01('0x16')](_0x146866['variable'])&&!_['isNil'](_0x146866[_0xbd01('0x1d')][_0xbd01('0x1e')])){utils[_0xbd01('0x1f')](util[_0xbd01('0x4')]('[%s][recordings][varset]',_0x146866[_0xbd01('0x6')]),_0x146866);utils['info'](util[_0xbd01('0x4')](_0xbd01('0x20'),_0x146866[_0xbd01('0x6')],_0x146866[_0xbd01('0x1d')],_0x146866['value']));if(_[_0xbd01('0x21')](_0x146866[_0xbd01('0x22')],'.wav49')){_0x146866[_0xbd01('0x22')]=_0x146866[_0xbd01('0x22')][_0xbd01('0x23')](_0xbd01('0x24'),'.WAV');}if(recordings[_0x146866['linkedid']]){var _0x5611da=_[_0xbd01('0x25')](recordings[_0x146866[_0xbd01('0x11')]]['monitors'],{'value':_0x146866['value']});if(_[_0xbd01('0x16')](_0x5611da)){recordings[_0x146866['linkedid']][_0xbd01('0x26')]['push']({'value':_0x146866[_0xbd01('0x22')]});}}}}catch(_0xbc5b36){utils[_0xbd01('0x27')](util[_0xbd01('0x4')](_0xbd01('0x28'),_0x146866[_0xbd01('0x6')]),_0xbc5b36);}};exports['hangup']=function(_0x33d6af){try{if(!_['isNil'](recordings[_0x33d6af[_0xbd01('0x6')]])){utils['debug'](util[_0xbd01('0x4')]('[%s][recordings][hangup]',_0x33d6af[_0xbd01('0x6')]),_0x33d6af);utils['info'](util[_0xbd01('0x4')](_0xbd01('0x29'),_0x33d6af['uniqueid'],_0x33d6af['calleridnum'],_0x33d6af[_0xbd01('0x2a')],_0x33d6af[_0xbd01('0x2b')]));recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2c')]=_0x33d6af['calleridnum'];recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2a')]=_0x33d6af[_0xbd01('0x2a')];recordings[_0x33d6af[_0xbd01('0x6')]]['connectedlinenum']=_0x33d6af[_0xbd01('0x2d')];recordings[_0x33d6af[_0xbd01('0x6')]]['connectedlinename']=_0x33d6af[_0xbd01('0x2e')];if(recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2f')]==_0xbd01('0x30')&&recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x9')]){recordings[_0x33d6af[_0xbd01('0x6')]]['connectedlinenum']=recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x9')];recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x2e')]='';}recordings[_0x33d6af[_0xbd01('0x6')]][_0xbd01('0x26')][_0xbd01('0x31')](function(_0x41034c){var _0x5834a2=_['clone'](recordings[_0x33d6af[_0xbd01('0x6')]]);_0x5834a2['value']=_0x41034c[_0xbd01('0x22')];writeDB(_0x5834a2);});delete recordings[_0x33d6af['uniqueid']];}}catch(_0x30ad71){utils[_0xbd01('0x27')](util[_0xbd01('0x4')](_0xbd01('0x32'),_0x33d6af[_0xbd01('0x6')]),_0x30ad71);}};exports['newexten']=function(_0x4656ab){try{if(!_[_0xbd01('0x16')](recordings[_0x4656ab['uniqueid']])){utils['debug'](util['format'](_0xbd01('0x33'),_0x4656ab['uniqueid']),_0x4656ab);utils[_0xbd01('0x3')](util[_0xbd01('0x4')](_0xbd01('0x34'),_0x4656ab[_0xbd01('0x6')],_0x4656ab[_0xbd01('0x35')],_0x4656ab[_0xbd01('0x36')]));if(_0x4656ab['application'][_0xbd01('0x37')]()==_0xbd01('0x38')&&_['startsWith'](_0x4656ab[_0xbd01('0x36')]['toLowerCase'](),_0xbd01('0x39'))){var _0x254eac=_0x4656ab[_0xbd01('0x36')]['split']('=');var _0xe019a7=_0x254eac[0x0][_0xbd01('0x3a')](_0x254eac[0x0][_0xbd01('0x3b')]('(')+0x1,_0x254eac[0x0][_0xbd01('0x3b')](')'));var _0x7bea4b=_0x254eac[0x1];recordings[_0x4656ab[_0xbd01('0x6')]][_0xe019a7]=_0x7bea4b;}}}catch(_0x1b1a6f){utils[_0xbd01('0x27')](util[_0xbd01('0x4')](_0xbd01('0x33'),_0x4656ab[_0xbd01('0x6')]),_0x1b1a6f);}};exports['queuecallerjoin']=function(_0x192b51){try{if(!_[_0xbd01('0x16')](recordings[_0x192b51[_0xbd01('0x6')]])){utils[_0xbd01('0x1f')](util[_0xbd01('0x4')](_0xbd01('0x3c'),_0x192b51[_0xbd01('0x6')]),_0x192b51);utils[_0xbd01('0x3')](util['format'](_0xbd01('0x3d'),_0x192b51[_0xbd01('0x6')],_0x192b51[_0xbd01('0x3e')]));recordings[_0x192b51[_0xbd01('0x6')]]['queue']=_0x192b51[_0xbd01('0x3e')];}}catch(_0x18135f){utils[_0xbd01('0x27')](util[_0xbd01('0x4')]('[%s][recordings][queuecallerjoin]',_0x192b51[_0xbd01('0x6')]),_0x18135f);}};exports[_0xbd01('0x3f')]=function(_0x18a191){try{utils[_0xbd01('0x1f')](util[_0xbd01('0x4')](_0xbd01('0x40'),_0x18a191[_0xbd01('0x6')]),_0x18a191);utils[_0xbd01('0x3')](util['format'](_0xbd01('0x41'),_0x18a191[_0xbd01('0x6')],_0x18a191[_0xbd01('0x42')],_0x18a191[_0xbd01('0x43')],_0x18a191[_0xbd01('0x44')],_0x18a191['transfereecalleridname']));if(recordings[_0x18a191[_0xbd01('0x45')]]&&transfers[_0xbd01('0x7')][_0x18a191['transfereruniqueid']]){transfers[_0xbd01('0x7')][_0x18a191[_0xbd01('0x45')]][_0xbd01('0x46')]=!![];}}catch(_0x26d9cb){utils[_0xbd01('0x27')](util['format'](_0xbd01('0x40'),_0x18a191['uniqueid']),_0x26d9cb);}}; \ No newline at end of file +var _0x8742=['[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','blinds','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','appdata','application','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]'];(function(_0x3fda08,_0x38e5b8){var _0x4916b1=function(_0x35035a){while(--_0x35035a){_0x3fda08['push'](_0x3fda08['shift']());}};_0x4916b1(++_0x38e5b8);}(_0x8742,0xdd));var _0x2874=function(_0x4c7e3b,_0x2eee73){_0x4c7e3b=_0x4c7e3b-0x0;var _0x1f6a82=_0x8742[_0x4c7e3b];return _0x1f6a82;};'use strict';var _=require('lodash');var util=require(_0x2874('0x0'));var utils=require(_0x2874('0x1'));var transfers=require(_0x2874('0x2'));var recordings={};function writeDB(_0x2d29b5){var _0x43a4b8;utils['info'](util['format'](_0x2874('0x3'),_0x2d29b5[_0x2874('0x4')]));if(transfers['blinds'][_0x2d29b5[_0x2874('0x4')]]){_0x43a4b8=_0x2d29b5[_0x2874('0x4')];_0x2d29b5[_0x2874('0x4')]=transfers['blinds'][_0x2d29b5[_0x2874('0x4')]]['transfereeuniqueid'];}if(_0x2d29b5[_0x2874('0x5')]){utils['getUserByInternal'](_0x2d29b5[_0x2874('0x5')])[_0x2874('0x6')](function(_0x3368bb){if(_0x3368bb){_0x2d29b5[_0x2874('0x7')]=_0x3368bb[_0x2874('0x8')];_0x2d29b5[_0x2874('0x9')]=_0x3368bb['id'];}utils[_0x2874('0xa')](_0x2874('0xb'),_0x2d29b5);});}else{utils[_0x2874('0xa')](_0x2874('0xb'),_0x2d29b5);}if(_0x43a4b8)delete transfers[_0x2874('0xc')][_0x43a4b8];}exports['newchannel']=function(_0x4a90f6){try{utils[_0x2874('0xd')](util['format'](_0x2874('0xe'),_0x4a90f6[_0x2874('0x4')]),_0x4a90f6);if(_0x4a90f6[_0x2874('0x4')]==_0x4a90f6[_0x2874('0xf')]){utils['info'](util[_0x2874('0x10')](_0x2874('0x11'),_0x4a90f6[_0x2874('0x4')],_0x4a90f6[_0x2874('0x12')],_0x4a90f6[_0x2874('0x13')]));recordings[_0x4a90f6[_0x2874('0x4')]]={'uniqueid':_0x4a90f6[_0x2874('0x4')],'accountcode':_0x4a90f6['accountcode'],'exten':_0x4a90f6[_0x2874('0x13')],'context':_0x4a90f6[_0x2874('0x12')],'channel':_0x4a90f6[_0x2874('0x14')],'monitors':[]};}}catch(_0x16d4d1){utils[_0x2874('0x15')](util[_0x2874('0x10')]('[%s][recordings][newchannel]',_0x4a90f6[_0x2874('0x4')]),_0x16d4d1);}};exports[_0x2874('0x16')]=function(_0x54216a){try{utils['debug'](util[_0x2874('0x10')]('[%s][recordings][newstate]',_0x54216a[_0x2874('0x4')]),_0x54216a);if(!_[_0x2874('0x17')](recordings[_0x54216a[_0x2874('0x4')]])&&_0x54216a[_0x2874('0x18')]==0x6){utils[_0x2874('0x19')](util[_0x2874('0x10')](_0x2874('0x1a'),_0x54216a[_0x2874('0x4')],_0x54216a[_0x2874('0x12')],_0x54216a[_0x2874('0x14')]));}else if(!_[_0x2874('0x17')](recordings[_0x54216a['linkedid']])&&_0x54216a[_0x2874('0x18')]==0x6&&_0x54216a['context']!='transfer'){utils['info'](util[_0x2874('0x10')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x54216a[_0x2874('0x4')],_0x54216a[_0x2874('0xf')],_0x54216a['context'],_0x54216a[_0x2874('0x14')]));recordings[_0x54216a[_0x2874('0xf')]][_0x2874('0x5')]=_0x54216a[_0x2874('0x5')];}}catch(_0x580e4e){utils[_0x2874('0x15')](util[_0x2874('0x10')](_0x2874('0x1b'),_0x54216a[_0x2874('0x4')]),_0x580e4e);}};exports[_0x2874('0x1c')]=function(_0x35bb43){try{if(!_[_0x2874('0x17')](_0x35bb43['variable'])&&!_['isNil'](_0x35bb43[_0x2874('0x1d')][_0x2874('0x1e')])){utils[_0x2874('0xd')](util['format']('[%s][recordings][varset]',_0x35bb43[_0x2874('0x4')]),_0x35bb43);utils['info'](util[_0x2874('0x10')](_0x2874('0x1f'),_0x35bb43[_0x2874('0x4')],_0x35bb43[_0x2874('0x1d')],_0x35bb43['value']));if(_[_0x2874('0x20')](_0x35bb43[_0x2874('0x21')],_0x2874('0x22'))){_0x35bb43[_0x2874('0x21')]=_0x35bb43['value']['replace'](_0x2874('0x22'),_0x2874('0x23'));}if(recordings[_0x35bb43[_0x2874('0xf')]]){var _0x41d767=_[_0x2874('0x24')](recordings[_0x35bb43[_0x2874('0xf')]][_0x2874('0x25')],{'value':_0x35bb43[_0x2874('0x21')]});if(_['isNil'](_0x41d767)){recordings[_0x35bb43[_0x2874('0xf')]][_0x2874('0x25')][_0x2874('0x26')]({'value':_0x35bb43[_0x2874('0x21')]});}}}}catch(_0xe152cb){utils[_0x2874('0x15')](util[_0x2874('0x10')](_0x2874('0x27'),_0x35bb43[_0x2874('0x4')]),_0xe152cb);}};exports[_0x2874('0x28')]=function(_0x6c10d5){try{if(!_[_0x2874('0x17')](recordings[_0x6c10d5[_0x2874('0x4')]])){utils[_0x2874('0xd')](util['format']('[%s][recordings][hangup]',_0x6c10d5['uniqueid']),_0x6c10d5);utils[_0x2874('0x19')](util[_0x2874('0x10')](_0x2874('0x29'),_0x6c10d5[_0x2874('0x4')],_0x6c10d5['calleridnum'],_0x6c10d5[_0x2874('0x2a')],_0x6c10d5[_0x2874('0x2b')]));recordings[_0x6c10d5[_0x2874('0x4')]][_0x2874('0x2c')]=_0x6c10d5[_0x2874('0x2c')];recordings[_0x6c10d5[_0x2874('0x4')]]['calleridname']=_0x6c10d5[_0x2874('0x2a')];recordings[_0x6c10d5['uniqueid']]['connectedlinenum']=_0x6c10d5[_0x2874('0x2d')];recordings[_0x6c10d5[_0x2874('0x4')]][_0x2874('0x2e')]=_0x6c10d5[_0x2874('0x2e')];if(recordings[_0x6c10d5[_0x2874('0x4')]][_0x2874('0x2f')]==_0x2874('0x30')&&recordings[_0x6c10d5['uniqueid']][_0x2874('0x5')]){recordings[_0x6c10d5[_0x2874('0x4')]]['connectedlinenum']=recordings[_0x6c10d5[_0x2874('0x4')]][_0x2874('0x5')];recordings[_0x6c10d5[_0x2874('0x4')]][_0x2874('0x2e')]='';}recordings[_0x6c10d5['uniqueid']][_0x2874('0x25')][_0x2874('0x31')](function(_0x2b2172){var _0x5afc94=_['clone'](recordings[_0x6c10d5[_0x2874('0x4')]]);_0x5afc94[_0x2874('0x21')]=_0x2b2172[_0x2874('0x21')];writeDB(_0x5afc94);});delete recordings[_0x6c10d5[_0x2874('0x4')]];}}catch(_0x47faa3){utils[_0x2874('0x15')](util[_0x2874('0x10')](_0x2874('0x32'),_0x6c10d5[_0x2874('0x4')]),_0x47faa3);}};exports[_0x2874('0x33')]=function(_0x4e2e27){try{if(!_['isNil'](recordings[_0x4e2e27[_0x2874('0x4')]])){utils[_0x2874('0xd')](util['format'](_0x2874('0x34'),_0x4e2e27[_0x2874('0x4')]),_0x4e2e27);utils[_0x2874('0x19')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4e2e27[_0x2874('0x4')],_0x4e2e27['application'],_0x4e2e27[_0x2874('0x35')]));if(_0x4e2e27[_0x2874('0x36')]['toLowerCase']()==_0x2874('0x37')&&_[_0x2874('0x38')](_0x4e2e27[_0x2874('0x35')][_0x2874('0x39')](),_0x2874('0x3a'))){var _0x3169ae=_0x4e2e27[_0x2874('0x35')][_0x2874('0x3b')]('=');var _0x2e2042=_0x3169ae[0x0][_0x2874('0x3c')](_0x3169ae[0x0][_0x2874('0x3d')]('(')+0x1,_0x3169ae[0x0]['lastIndexOf'](')'));var _0x51ad73=_0x3169ae[0x1];recordings[_0x4e2e27['uniqueid']][_0x2e2042]=_0x51ad73;}}}catch(_0x4b4f8f){utils['error'](util[_0x2874('0x10')]('[%s][recordings][newexten]',_0x4e2e27[_0x2874('0x4')]),_0x4b4f8f);}};exports['queuecallerjoin']=function(_0x38e066){try{if(!_[_0x2874('0x17')](recordings[_0x38e066[_0x2874('0x4')]])){utils[_0x2874('0xd')](util['format']('[%s][recordings][queuecallerjoin]',_0x38e066[_0x2874('0x4')]),_0x38e066);utils[_0x2874('0x19')](util['format'](_0x2874('0x3e'),_0x38e066[_0x2874('0x4')],_0x38e066[_0x2874('0x3f')]));recordings[_0x38e066[_0x2874('0x4')]][_0x2874('0x3f')]=_0x38e066[_0x2874('0x3f')];}}catch(_0x3c61f8){utils[_0x2874('0x15')](util[_0x2874('0x10')](_0x2874('0x40'),_0x38e066[_0x2874('0x4')]),_0x3c61f8);}};exports[_0x2874('0x41')]=function(_0x2ab60a){try{utils[_0x2874('0xd')](util[_0x2874('0x10')](_0x2874('0x42'),_0x2ab60a[_0x2874('0x4')]),_0x2ab60a);utils[_0x2874('0x19')](util[_0x2874('0x10')](_0x2874('0x43'),_0x2ab60a[_0x2874('0x4')],_0x2ab60a[_0x2874('0x44')],_0x2ab60a[_0x2874('0x45')],_0x2ab60a['transfereecalleridnum'],_0x2ab60a['transfereecalleridname']));if(recordings[_0x2ab60a[_0x2874('0x46')]]&&transfers['blinds'][_0x2ab60a[_0x2874('0x46')]]){transfers[_0x2874('0xc')][_0x2ab60a[_0x2874('0x46')]][_0x2874('0x47')]=!![];}}catch(_0x17b3bf){utils[_0x2874('0x15')](util[_0x2874('0x10')](_0x2874('0x42'),_0x2ab60a['uniqueid']),_0x17b3bf);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 88ed46b..3d2ab42 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 _0x3699=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil'];(function(_0x3fb7a1,_0x365d08){var _0x117022=function(_0x70a506){while(--_0x70a506){_0x3fb7a1['push'](_0x3fb7a1['shift']());}};_0x117022(++_0x365d08);}(_0x3699,0x157));var _0x9369=function(_0x3763df,_0x2bcb27){_0x3763df=_0x3763df-0x0;var _0x545b39=_0x3699[_0x3763df];return _0x545b39;};'use strict';var _=require(_0x9369('0x0'));var util=require('util');var utils=require(_0x9369('0x1'));function writeDB(_0xa4a89b){utils[_0x9369('0x2')](util[_0x9369('0x3')](_0x9369('0x4'),_0xa4a89b[_0x9369('0x5')]===_0x9369('0x6')?_0xa4a89b[_0x9369('0x7')]:_0xa4a89b[_0x9369('0x8')],_0xa4a89b[_0x9369('0x5')]));utils[_0x9369('0x9')](_0x9369('0xa'),_0xa4a89b);}exports[_0x9369('0xb')]={};exports['blindtransfer']=function(_0x131d2b){try{utils[_0x9369('0xc')](util[_0x9369('0x3')](_0x9369('0xd'),_0x131d2b[_0x9369('0x8')]),_0x131d2b);utils[_0x9369('0x2')](util[_0x9369('0x3')](_0x9369('0xe'),_0x131d2b[_0x9369('0x8')],_0x131d2b[_0x9369('0xf')],_0x131d2b[_0x9369('0x10')],_0x131d2b['transfereecalleridnum'],_0x131d2b['transfereecalleridname']));_0x131d2b[_0x9369('0x5')]=_0x9369('0x11');exports[_0x9369('0xb')][_0x131d2b['transfereruniqueid']]=_0x131d2b;writeDB(_0x131d2b);}catch(_0x8362a1){utils[_0x9369('0x12')](util[_0x9369('0x3')]('[%s][transfers][blindtransfer]',_0x131d2b['uniqueid']),_0x8362a1);}};exports[_0x9369('0x13')]=function(_0x505647){try{utils[_0x9369('0xc')](util[_0x9369('0x3')]('[%s][transfers][attendedtransfer]',_0x505647['origtransfereruniqueid']),_0x505647);utils[_0x9369('0x2')](util[_0x9369('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x505647[_0x9369('0x7')],_0x505647[_0x9369('0x14')],_0x505647[_0x9369('0x15')],_0x505647[_0x9369('0x16')],_0x505647[_0x9369('0x17')]));_0x505647=_[_0x9369('0x18')](_0x505647,{'transfererchannel':_0x505647[_0x9369('0x19')],'transferercalleridnum':_0x505647[_0x9369('0x14')],'transferercalleridname':_0x505647['origtransferercalleridname'],'transfererconnectedlinenum':_0x505647[_0x9369('0x1a')],'transfererconnectedlinename':_0x505647[_0x9369('0x1b')],'transfereraccountcode':_0x505647[_0x9369('0x1c')],'transferercontext':_0x505647[_0x9369('0x1d')],'transfererexten':_0x505647[_0x9369('0x1e')],'transfererlinkedid':_0x505647[_0x9369('0x1f')],'context':_0x505647[_0x9369('0x20')],'extension':_0x505647[_0x9369('0x21')],'type':_0x9369('0x6')});if(_[_0x9369('0x22')](_0x505647['transfereechannel'])){_0x505647=_[_0x9369('0x18')](_0x505647,{'transfereechannel':_0x505647['transfertargetchannel'],'transfereecalleridnum':_0x505647[_0x9369('0x16')],'transfereecalleridname':_0x505647[_0x9369('0x17')],'transfereeconnectedlinenum':_0x505647[_0x9369('0x23')],'transfereeconnectedlinename':_0x505647[_0x9369('0x24')],'transfereeaccountcode':_0x505647[_0x9369('0x25')],'transfereecontext':_0x505647[_0x9369('0x26')],'transfereeexten':_0x505647[_0x9369('0x27')],'transfereelinkedid':_0x505647[_0x9369('0x28')]});}writeDB(_0x505647);}catch(_0x3c231b){utils[_0x9369('0x12')](util[_0x9369('0x3')](_0x9369('0x29'),_0x505647[_0x9369('0x7')]),_0x3c231b);}}; \ No newline at end of file +var _0x95c6=['format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','util'];(function(_0x3e4a43,_0x3890b6){var _0x3b335f=function(_0xaa66cc){while(--_0xaa66cc){_0x3e4a43['push'](_0x3e4a43['shift']());}};_0x3b335f(++_0x3890b6);}(_0x95c6,0x9f));var _0x695c=function(_0x340d1f,_0xc33126){_0x340d1f=_0x340d1f-0x0;var _0x2b2199=_0x95c6[_0x340d1f];return _0x2b2199;};'use strict';var _=require('lodash');var util=require(_0x695c('0x0'));var utils=require('./utils');function writeDB(_0xcd59a8){utils['info'](util[_0x695c('0x1')](_0x695c('0x2'),_0xcd59a8['type']===_0x695c('0x3')?_0xcd59a8[_0x695c('0x4')]:_0xcd59a8[_0x695c('0x5')],_0xcd59a8[_0x695c('0x6')]));utils['request'](_0x695c('0x7'),_0xcd59a8);}exports[_0x695c('0x8')]={};exports[_0x695c('0x9')]=function(_0x2403fc){try{utils[_0x695c('0xa')](util[_0x695c('0x1')](_0x695c('0xb'),_0x2403fc[_0x695c('0x5')]),_0x2403fc);utils[_0x695c('0xc')](util[_0x695c('0x1')](_0x695c('0xd'),_0x2403fc['uniqueid'],_0x2403fc[_0x695c('0xe')],_0x2403fc[_0x695c('0xf')],_0x2403fc['transfereecalleridnum'],_0x2403fc[_0x695c('0x10')]));_0x2403fc['type']=_0x695c('0x11');exports[_0x695c('0x8')][_0x2403fc[_0x695c('0x12')]]=_0x2403fc;writeDB(_0x2403fc);}catch(_0x3e363c){utils[_0x695c('0x13')](util[_0x695c('0x1')]('[%s][transfers][blindtransfer]',_0x2403fc[_0x695c('0x5')]),_0x3e363c);}};exports[_0x695c('0x14')]=function(_0x448429){try{utils[_0x695c('0xa')](util[_0x695c('0x1')](_0x695c('0x15'),_0x448429[_0x695c('0x4')]),_0x448429);utils[_0x695c('0xc')](util[_0x695c('0x1')](_0x695c('0x16'),_0x448429['origtransfereruniqueid'],_0x448429[_0x695c('0x17')],_0x448429[_0x695c('0x18')],_0x448429[_0x695c('0x19')],_0x448429[_0x695c('0x1a')]));_0x448429=_[_0x695c('0x1b')](_0x448429,{'transfererchannel':_0x448429[_0x695c('0x1c')],'transferercalleridnum':_0x448429[_0x695c('0x17')],'transferercalleridname':_0x448429[_0x695c('0x18')],'transfererconnectedlinenum':_0x448429[_0x695c('0x1d')],'transfererconnectedlinename':_0x448429['secondtransfererconnectedlinename'],'transfereraccountcode':_0x448429[_0x695c('0x1e')],'transferercontext':_0x448429[_0x695c('0x1f')],'transfererexten':_0x448429[_0x695c('0x20')],'transfererlinkedid':_0x448429['origtransfererlinkedid'],'context':_0x448429['origtransferercontext'],'extension':_0x448429[_0x695c('0x21')],'type':_0x695c('0x3')});if(_['isNil'](_0x448429[_0x695c('0x22')])){_0x448429=_['assign'](_0x448429,{'transfereechannel':_0x448429[_0x695c('0x23')],'transfereecalleridnum':_0x448429[_0x695c('0x19')],'transfereecalleridname':_0x448429[_0x695c('0x1a')],'transfereeconnectedlinenum':_0x448429[_0x695c('0x24')],'transfereeconnectedlinename':_0x448429[_0x695c('0x25')],'transfereeaccountcode':_0x448429['transfertargetaccountcode'],'transfereecontext':_0x448429[_0x695c('0x26')],'transfereeexten':_0x448429[_0x695c('0x27')],'transfereelinkedid':_0x448429['transfertargetlinkedid']});}writeDB(_0x448429);}catch(_0x345537){utils['error'](util[_0x695c('0x1')](_0x695c('0x15'),_0x448429[_0x695c('0x4')]),_0x345537);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 89d1935..701eeb2 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 _0x016c=['name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal'];(function(_0x348e9e,_0x591b78){var _0x13a00e=function(_0x34245b){while(--_0x34245b){_0x348e9e['push'](_0x348e9e['shift']());}};_0x13a00e(++_0x591b78);}(_0x016c,0x1da));var _0xc016=function(_0x3ebe35,_0x2c960c){_0x3ebe35=_0x3ebe35-0x0;var _0x4817f5=_0x016c[_0x3ebe35];return _0x4817f5;};'use strict';var BPromise=require(_0xc016('0x0'));var jayson=require(_0xc016('0x1'));var moment=require(_0xc016('0x2'));var util=require('util');var client=jayson['client'][_0xc016('0x3')]({'port':0x2329});var logger=require(_0xc016('0x4'))(_0xc016('0x5'));exports[_0xc016('0x6')]=function(_0x2b697e,_0x9be815){logger['info'](_0x2b697e,_0x9be815?util[_0xc016('0x7')](_0x9be815,{'showHidden':![],'depth':null}):'');};exports[_0xc016('0x8')]=function(_0x385e8e,_0x212e52){logger['debug'](_0x385e8e,_0x212e52?util['inspect'](_0x212e52,{'showHidden':![],'depth':null}):'');};exports[_0xc016('0x9')]=function(_0x2463f3,_0x5bff08){logger[_0xc016('0x9')](_0x2463f3,_0x5bff08?util[_0xc016('0x7')](_0x5bff08,{'showHidden':![],'depth':null}):'');};exports[_0xc016('0xa')]=function(_0x29fa2c,_0x7484d){return client[_0xc016('0xa')](_0x29fa2c,{'body':_0x7484d})[_0xc016('0xb')](function(_0x5d74aa){logger[_0xc016('0x8')](_0xc016('0xc'),_0x29fa2c,_0x5d74aa?util['inspect'](_0x5d74aa,{'showHidden':![],'depth':null}):'');})[_0xc016('0xd')](function(_0xeff5e7){logger[_0xc016('0x9')]('[utils][request]\x20name:%s',_0x29fa2c,_0xeff5e7?util['inspect'](_0xeff5e7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5b07ec){return client['request'](_0xc016('0xe'),{'options':{'raw':!![],'attributes':['id',_0xc016('0xf'),_0xc016('0x10'),'interface'],'where':_0x5b07ec,'limit':0x1}})[_0xc016('0xb')](function(_0x1b6e76){logger[_0xc016('0x8')](_0xc016('0x11'),JSON[_0xc016('0x12')](_0x5b07ec),_0x1b6e76?util[_0xc016('0x7')](_0x1b6e76,{'showHidden':![],'depth':null}):'');return _0x1b6e76[_0xc016('0x13')][_0xc016('0x14')]?_0x1b6e76[_0xc016('0x13')][0x0]:null;});}exports[_0xc016('0x15')]=function(_0x2601b6){return new BPromise(function(_0x31727f,_0x3bbce2){if(_0x2601b6){return getUser({'internal':_0x2601b6})[_0xc016('0xb')](function(_0x5435bd){logger[_0xc016('0x6')](_0xc016('0x16'),_0x2601b6,_0x5435bd?_0xc016('0x17'):_0xc016('0x18'));return _0x31727f(_0x5435bd);})[_0xc016('0xd')](function(_0x4e7aac){logger[_0xc016('0x9')](_0xc016('0x19'),_0x4e7aac?util[_0xc016('0x7')](_0x4e7aac,{'showHidden':![],'depth':null}):'');return _0x31727f(null);});}return _0x31727f(null);});};exports[_0xc016('0x1a')]=function(_0x1522fa){return new BPromise(function(_0x37ecd1,_0x48324b){if(_0x1522fa){return getUser({'interface':_0x1522fa})[_0xc016('0xb')](function(_0x2077fd){logger[_0xc016('0x6')](_0xc016('0x1b'),_0x1522fa,_0x2077fd?'found':_0xc016('0x18'));return _0x37ecd1(_0x2077fd);})[_0xc016('0xd')](function(_0x2468dc){logger[_0xc016('0x9')](_0xc016('0x1c'),_0x2468dc?util['inspect'](_0x2468dc,{'showHidden':![],'depth':null}):'');return _0x37ecd1(null);});}return _0x37ecd1(null);});};exports[_0xc016('0x1d')]=function(_0x5f0635){return new BPromise(function(_0x345717,_0x18a976){if(_0x5f0635){return getUser({'name':_0x5f0635})[_0xc016('0xb')](function(_0x590e84){logger[_0xc016('0x6')](_0xc016('0x1e'),_0x5f0635,_0x590e84?'found':_0xc016('0x18'));return _0x345717(_0x590e84);})[_0xc016('0xd')](function(_0x4bf43b){logger['error'](_0xc016('0x1f'),_0x4bf43b?util['inspect'](_0x4bf43b,{'showHidden':![],'depth':null}):'');return _0x345717(null);});}return _0x345717(null);});};exports[_0xc016('0x20')]=function(_0x965afb){return new BPromise(function(_0x1f2131,_0x55c529){if(_0x965afb){return client[_0xc016('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0xc016('0x21'),_0xc016('0x22'),'acwTimeout'],'where':{'name':_0x965afb},'limit':0x1}})[_0xc016('0xb')](function(_0x4aa50e){logger[_0xc016('0x8')](_0xc016('0x23'),_0x965afb,_0x4aa50e?util[_0xc016('0x7')](_0x4aa50e,{'showHidden':![],'depth':null}):'');logger[_0xc016('0x6')](_0xc016('0x24'),_0x965afb,_0x4aa50e?'found':_0xc016('0x18'));return _0x1f2131(_0x4aa50e[_0xc016('0x13')][_0xc016('0x14')]?_0x4aa50e[_0xc016('0x13')][0x0]:null);})[_0xc016('0xd')](function(_0x1678be){logger[_0xc016('0x9')](_0xc016('0x25'),_0x1678be?util[_0xc016('0x7')](_0x1678be,{'showHidden':![],'depth':null}):'');return _0x1f2131(null);});}return _0x1f2131(null);});};exports['addTime']=function(_0x585028,_0x240028){return moment(_0x585028)[_0xc016('0x26')](_0x240028,_0xc016('0x27'))[_0xc016('0x28')](_0xc016('0x29'));};exports[_0xc016('0x2a')]=function(_0x4a53b4,_0x3cb61c){return moment(_0x4a53b4)[_0xc016('0x2b')](_0x3cb61c,_0xc016('0x27'))['format'](_0xc016('0x29'));};exports[_0xc016('0x2c')]=function(_0x29f482,_0x190e69){return moment(_0x29f482)['diff'](moment(_0x190e69),_0xc016('0x27'));};exports[_0xc016('0x2d')]=function(_0x245cae,_0x336a3e){return parseInt(_0x245cae,0xa)+parseInt(_0x336a3e,0xa);};exports[_0xc016('0x2e')]=function(){return moment()[_0xc016('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc016('0x2f')]=function(_0x988293,_0x4a02ae){if(_0x4a02ae){return moment(_0x988293)[_0xc016('0x2f')](_0x4a02ae);}return!![];};exports['isBefore']=function(_0x5736eb,_0x320081){if(_0x320081){return moment(_0x5736eb)[_0xc016('0x30')](_0x320081);}else if(_0x5736eb){return!![];}return![];}; \ No newline at end of file +var _0x6033=['../../config/logger','info','inspect','debug','error','then','[utils][request]\x20name:%s','request','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','util','client'];(function(_0x1cd88e,_0x2b4d6a){var _0x510769=function(_0x3f9468){while(--_0x3f9468){_0x1cd88e['push'](_0x1cd88e['shift']());}};_0x510769(++_0x2b4d6a);}(_0x6033,0x177));var _0x3603=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6033[_0x502c7d];return _0x30b7ed;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x3603('0x0'));var moment=require('moment');var util=require(_0x3603('0x1'));var client=jayson[_0x3603('0x2')]['http']({'port':0x2329});var logger=require(_0x3603('0x3'))('xdr');exports[_0x3603('0x4')]=function(_0x3356fe,_0x3421e2){logger[_0x3603('0x4')](_0x3356fe,_0x3421e2?util[_0x3603('0x5')](_0x3421e2,{'showHidden':![],'depth':null}):'');};exports[_0x3603('0x6')]=function(_0x499eac,_0x166b62){logger[_0x3603('0x6')](_0x499eac,_0x166b62?util[_0x3603('0x5')](_0x166b62,{'showHidden':![],'depth':null}):'');};exports[_0x3603('0x7')]=function(_0x2a97a2,_0x32c0d5){logger[_0x3603('0x7')](_0x2a97a2,_0x32c0d5?util[_0x3603('0x5')](_0x32c0d5,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x29edec,_0x469c8e){return client['request'](_0x29edec,{'body':_0x469c8e})[_0x3603('0x8')](function(_0x34897e){logger[_0x3603('0x6')](_0x3603('0x9'),_0x29edec,_0x34897e?util[_0x3603('0x5')](_0x34897e,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x411ae5){logger[_0x3603('0x7')](_0x3603('0x9'),_0x29edec,_0x411ae5?util[_0x3603('0x5')](_0x411ae5,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3d8afc){return client[_0x3603('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x3603('0xb'),_0x3603('0xc'),_0x3603('0xd')],'where':_0x3d8afc,'limit':0x1}})[_0x3603('0x8')](function(_0x2eaefc){logger['debug'](_0x3603('0xe'),JSON[_0x3603('0xf')](_0x3d8afc),_0x2eaefc?util[_0x3603('0x5')](_0x2eaefc,{'showHidden':![],'depth':null}):'');return _0x2eaefc[_0x3603('0x10')][_0x3603('0x11')]?_0x2eaefc['result'][0x0]:null;});}exports[_0x3603('0x12')]=function(_0xe97f4a){return new BPromise(function(_0x558e23,_0x2fd380){if(_0xe97f4a){return getUser({'internal':_0xe97f4a})[_0x3603('0x8')](function(_0x75fd45){logger[_0x3603('0x4')](_0x3603('0x13'),_0xe97f4a,_0x75fd45?'found':_0x3603('0x14'));return _0x558e23(_0x75fd45);})[_0x3603('0x15')](function(_0x1ba8f4){logger[_0x3603('0x7')](_0x3603('0x16'),_0x1ba8f4?util[_0x3603('0x5')](_0x1ba8f4,{'showHidden':![],'depth':null}):'');return _0x558e23(null);});}return _0x558e23(null);});};exports['getUserByInterface']=function(_0x79c45a){return new BPromise(function(_0x272317,_0xba772d){if(_0x79c45a){return getUser({'interface':_0x79c45a})[_0x3603('0x8')](function(_0x38494e){logger['info'](_0x3603('0x17'),_0x79c45a,_0x38494e?_0x3603('0x18'):_0x3603('0x14'));return _0x272317(_0x38494e);})[_0x3603('0x15')](function(_0x210285){logger[_0x3603('0x7')](_0x3603('0x19'),_0x210285?util[_0x3603('0x5')](_0x210285,{'showHidden':![],'depth':null}):'');return _0x272317(null);});}return _0x272317(null);});};exports['getUserByName']=function(_0x577161){return new BPromise(function(_0x978f67,_0x537647){if(_0x577161){return getUser({'name':_0x577161})['then'](function(_0x505d66){logger['info'](_0x3603('0x1a'),_0x577161,_0x505d66?_0x3603('0x18'):_0x3603('0x14'));return _0x978f67(_0x505d66);})['catch'](function(_0x45dafa){logger[_0x3603('0x7')](_0x3603('0x1b'),_0x45dafa?util[_0x3603('0x5')](_0x45dafa,{'showHidden':![],'depth':null}):'');return _0x978f67(null);});}return _0x978f67(null);});};exports[_0x3603('0x1c')]=function(_0x17f62d){return new BPromise(function(_0x3138ad,_0x1fdb83){if(_0x17f62d){return client[_0x3603('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name','type','acw','acwTimeout'],'where':{'name':_0x17f62d},'limit':0x1}})[_0x3603('0x8')](function(_0x42b2f6){logger[_0x3603('0x6')](_0x3603('0x1d'),_0x17f62d,_0x42b2f6?util['inspect'](_0x42b2f6,{'showHidden':![],'depth':null}):'');logger[_0x3603('0x4')](_0x3603('0x1e'),_0x17f62d,_0x42b2f6?'found':_0x3603('0x14'));return _0x3138ad(_0x42b2f6[_0x3603('0x10')][_0x3603('0x11')]?_0x42b2f6[_0x3603('0x10')][0x0]:null);})[_0x3603('0x15')](function(_0x19487e){logger['error'](_0x3603('0x1f'),_0x19487e?util[_0x3603('0x5')](_0x19487e,{'showHidden':![],'depth':null}):'');return _0x3138ad(null);});}return _0x3138ad(null);});};exports[_0x3603('0x20')]=function(_0x13f8dd,_0x3e5b5b){return moment(_0x13f8dd)[_0x3603('0x21')](_0x3e5b5b,_0x3603('0x22'))[_0x3603('0x23')](_0x3603('0x24'));};exports['subtractTime']=function(_0x31eea4,_0x1348eb){return moment(_0x31eea4)['subtract'](_0x1348eb,'seconds')[_0x3603('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3603('0x25')]=function(_0x3c9112,_0x12cfc1){return moment(_0x3c9112)[_0x3603('0x26')](moment(_0x12cfc1),'seconds');};exports[_0x3603('0x27')]=function(_0x28d88c,_0x2bbc01){return parseInt(_0x28d88c,0xa)+parseInt(_0x2bbc01,0xa);};exports['now']=function(){return moment()[_0x3603('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x48222f,_0x59181f){if(_0x59181f){return moment(_0x48222f)[_0x3603('0x28')](_0x59181f);}return!![];};exports['isBefore']=function(_0x2dd0ab,_0x4a24e6){if(_0x4a24e6){return moment(_0x2dd0ab)[_0x3603('0x29')](_0x4a24e6);}else if(_0x2dd0ab){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 df6f137..72279c1 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 _0x144f=['statusCode','other','agent_name','test','setupLoggers','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','user','then','no-user','data','catch','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','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'];(function(_0xe1b2a8,_0x38f786){var _0x554804=function(_0x412030){while(--_0x412030){_0xe1b2a8['push'](_0xe1b2a8['shift']());}};_0x554804(++_0x38f786);}(_0x144f,0x1ef));var _0xf144=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x144f[_0x19950b];return _0x3c6b41;};var fs=require('fs-extra');var _=require(_0xf144('0x0'));var ewinston=require(_0xf144('0x1'));var path=require(_0xf144('0x2'));var util=require(_0xf144('0x3'));var fileLogger=require(_0xf144('0x4'))[_0xf144('0x5')];var safeTemplate=require(_0xf144('0x6'))['safeTemplate'];var maskSensitiveData=require(_0xf144('0x7'))[_0xf144('0x8')];function ClientSideLogger(){function _0x444114(_0x31e011){var _0x301594=path[_0xf144('0x9')](_0xf144('0xa'),_0xf144('0xb'),'xcally');var _0x961cf6=path['join'](_0xf144('0xc'),_0x31e011[_0xf144('0xd')]+'-'+_0x31e011[_0xf144('0xe')]);return fs['ensureDir'](path[_0xf144('0x9')](_0x301594,_0x961cf6))['then'](function(){var _0x3344b2=fileLogger(_0xf144('0xc'),path[_0xf144('0x9')](_0x301594,_0x961cf6));return _0x3344b2;})['catch'](function(_0x12729f){throw _0x12729f;});}this[_0xf144('0xb')]=function(_0x59851e,_0x4f0152,_0x1293de,_0x14811b){return _0x444114(_0x59851e[_0xf144('0xf')])[_0xf144('0x10')](function(_0x39e7f5){var _0xff76f8=_0x39e7f5[_0x4f0152];return _0xff76f8;})[_0xf144('0x10')](function(_0x50fd2b){var _0xa38c3e=_0x59851e['user']?_0x59851e[_0xf144('0xf')]['id']:_0xf144('0x11');var _0x3f5363=_0x14811b[_0xf144('0x12')];var _0x19d32e=_0x14811b['timestamp'];var _0x17e80c=new Date(Number(_0x19d32e));return _0x50fd2b(_0xa38c3e,_0x17e80c,_0x1293de,_0x3f5363);})[_0xf144('0x13')](function(_0x48a62c){fileLogger(_0xf144('0xc'))[_0xf144('0x14')](_0x48a62c);});};}function setupLoggers(_0x40a605){return new Promise(function(_0x16b1fc){var _0x1c1e82=new ClientSideLogger();var _0xae8e66=fileLogger(_0xf144('0x15'));var _0x204041=fileLogger(_0xf144('0x16'));_0x40a605[_0xf144('0x17')](_0xf144('0x18'),_0x1c1e82);_0x40a605[_0xf144('0x19')](ewinston[_0xf144('0x1a')]({'winstonInstance':_0xae8e66,'meta':![],'statusLevels':!![],'msg':function(_0x56f8d2,_0x5e8241){var _0x3dc66a=_0xf144('0x1b');if(!_[_0xf144('0x1c')](_0x56f8d2[_0xf144('0x1d')])){_0x3dc66a+=_0xf144('0x1e');var _0x5d3b87=_0x56f8d2[_0xf144('0x1d')];maskSensitiveData(_0x5d3b87);}return safeTemplate(util['format'](_0x3dc66a,_0x56f8d2[_0xf144('0x1f')],_0x56f8d2[_0xf144('0x20')]['x-forwarded-for']?_0x56f8d2[_0xf144('0x20')][_0xf144('0x21')]:_0x56f8d2[_0xf144('0x22')][_0xf144('0x23')]||_0x56f8d2['ip'],_0x56f8d2[_0xf144('0x24')],_0x5e8241['statusCode'],_0x5e8241[_0xf144('0x25')],_0x56f8d2[_0xf144('0xf')]?_0x56f8d2['user']['id']:null,_0x56f8d2[_0xf144('0xf')]?_0x56f8d2[_0xf144('0xf')]['name']:null,_0x56f8d2[_0xf144('0xf')]?_0x56f8d2[_0xf144('0xf')]['role']:null,_0x5d3b87?util[_0xf144('0x26')](_0x5d3b87,![],null):''));}}));_0x40a605['use'](ewinston[_0xf144('0x1a')]({'winstonInstance':_0x204041,'meta':![],'statusLevels':!![],'msg':function(_0x3a9347,_0x3e0524){var _0x516be3=_0xf144('0x27');if(_0x3a9347[_0xf144('0x1d')]&&_0x3a9347['body'][_0xf144('0x28')]&&_0x3a9347[_0xf144('0x1d')][_0xf144('0x29')]){_0x516be3=_0xf144('0x2a');}return util[_0xf144('0x2b')](_0x516be3,_0x3a9347['method'],_0x3a9347['headers'][_0xf144('0x21')]?_0x3a9347[_0xf144('0x20')][_0xf144('0x21')]:_0x3a9347[_0xf144('0x22')][_0xf144('0x23')]||_0x3a9347['ip'],_0x3a9347[_0xf144('0x24')],_0x3e0524[_0xf144('0x2c')],_0x3e0524['responseTime'],_0x3a9347[_0xf144('0xf')]?_0x3a9347['user']['id']:null,_0x3a9347[_0xf144('0xf')]?_0x3a9347['user'][_0xf144('0xe')]:null,_0x3a9347[_0xf144('0xf')]?_0x3a9347[_0xf144('0xf')][_0xf144('0xd')]:null,_0x3a9347[_0xf144('0x1d')]&&_0x3a9347[_0xf144('0x1d')][_0xf144('0x28')]?_0x3a9347[_0xf144('0x1d')][_0xf144('0x28')]:_0xf144('0x2d'),_0x3a9347[_0xf144('0x1d')]&&_0x3a9347[_0xf144('0x1d')][_0xf144('0x29')]?_0x3a9347['body']['agent_id']:'',_0x3a9347[_0xf144('0x1d')]&&_0x3a9347['body'][_0xf144('0x2e')]?_0x3a9347[_0xf144('0x1d')][_0xf144('0x2e')]:'');},'ignoreRoute':function(_0x218404){var _0x3c3c65=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3c3c65[_0xf144('0x2f')](_0x218404[_0xf144('0x24')]);}}));return _0x16b1fc();});}exports[_0xf144('0x30')]=setupLoggers; \ No newline at end of file +var _0xd9dc=['timestamp','catch','error','set','client-side-logger','use','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','name','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)','connection','responseTime','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','log','xcally','client','role','ensureDir','then','user','data'];(function(_0x7a319d,_0x235959){var _0x5c6b4e=function(_0x2e5b17){while(--_0x2e5b17){_0x7a319d['push'](_0x7a319d['shift']());}};_0x5c6b4e(++_0x235959);}(_0xd9dc,0x1f2));var _0xcd9d=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0xd9dc[_0x4d3187];return _0x107906;};var fs=require(_0xcd9d('0x0'));var _=require(_0xcd9d('0x1'));var ewinston=require(_0xcd9d('0x2'));var path=require(_0xcd9d('0x3'));var util=require(_0xcd9d('0x4'));var fileLogger=require(_0xcd9d('0x5'))[_0xcd9d('0x6')];var safeTemplate=require(_0xcd9d('0x7'))[_0xcd9d('0x8')];var maskSensitiveData=require('./mask-sensitive-data')[_0xcd9d('0x9')];function ClientSideLogger(){function _0x368e29(_0x1f6c67){var _0x284873=path[_0xcd9d('0xa')]('/var',_0xcd9d('0xb'),_0xcd9d('0xc'));var _0x3b1d1a=path[_0xcd9d('0xa')](_0xcd9d('0xd'),_0x1f6c67[_0xcd9d('0xe')]+'-'+_0x1f6c67['name']);return fs[_0xcd9d('0xf')](path['join'](_0x284873,_0x3b1d1a))[_0xcd9d('0x10')](function(){var _0x123376=fileLogger('client',path[_0xcd9d('0xa')](_0x284873,_0x3b1d1a));return _0x123376;})['catch'](function(_0x2647f0){throw _0x2647f0;});}this['log']=function(_0x3ce4e3,_0x3c1717,_0x40e67a,_0xeaa41d){return _0x368e29(_0x3ce4e3[_0xcd9d('0x11')])[_0xcd9d('0x10')](function(_0x5e26a5){var _0x5ed1b3=_0x5e26a5[_0x3c1717];return _0x5ed1b3;})[_0xcd9d('0x10')](function(_0x139d77){var _0xb9024d=_0x3ce4e3[_0xcd9d('0x11')]?_0x3ce4e3['user']['id']:'no-user';var _0x51ef9e=_0xeaa41d[_0xcd9d('0x12')];var _0x2002ae=_0xeaa41d[_0xcd9d('0x13')];var _0x95501=new Date(Number(_0x2002ae));return _0x139d77(_0xb9024d,_0x95501,_0x40e67a,_0x51ef9e);})[_0xcd9d('0x14')](function(_0x350c57){fileLogger('client')[_0xcd9d('0x15')](_0x350c57);});};}function setupLoggers(_0x18f8dc){return new Promise(function(_0x2f31ee){var _0x44a6e9=new ClientSideLogger();var _0x20b5ac=fileLogger('api');var _0xe25933=fileLogger('auth');_0x18f8dc[_0xcd9d('0x16')](_0xcd9d('0x17'),_0x44a6e9);_0x18f8dc[_0xcd9d('0x18')](ewinston[_0xcd9d('0x19')]({'winstonInstance':_0x20b5ac,'meta':![],'statusLevels':!![],'msg':function(_0x6e37e3,_0x18de47){var _0x538b90='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xcd9d('0x1a')](_0x6e37e3[_0xcd9d('0x1b')])){_0x538b90+=_0xcd9d('0x1c');var _0x456764=_0x6e37e3[_0xcd9d('0x1b')];maskSensitiveData(_0x456764);}return safeTemplate(util[_0xcd9d('0x1d')](_0x538b90,_0x6e37e3[_0xcd9d('0x1e')],_0x6e37e3[_0xcd9d('0x1f')][_0xcd9d('0x20')]?_0x6e37e3[_0xcd9d('0x1f')][_0xcd9d('0x20')]:_0x6e37e3['connection'][_0xcd9d('0x21')]||_0x6e37e3['ip'],_0x6e37e3[_0xcd9d('0x22')],_0x18de47[_0xcd9d('0x23')],_0x18de47['responseTime'],_0x6e37e3['user']?_0x6e37e3['user']['id']:null,_0x6e37e3[_0xcd9d('0x11')]?_0x6e37e3['user'][_0xcd9d('0x24')]:null,_0x6e37e3[_0xcd9d('0x11')]?_0x6e37e3[_0xcd9d('0x11')][_0xcd9d('0xe')]:null,_0x456764?util[_0xcd9d('0x25')](_0x456764,![],null):''));}}));_0x18f8dc[_0xcd9d('0x18')](ewinston[_0xcd9d('0x19')]({'winstonInstance':_0xe25933,'meta':![],'statusLevels':!![],'msg':function(_0x78e500,_0x7b1740){var _0x44113c=_0xcd9d('0x26');if(_0x78e500[_0xcd9d('0x1b')]&&_0x78e500[_0xcd9d('0x1b')][_0xcd9d('0x27')]&&_0x78e500[_0xcd9d('0x1b')][_0xcd9d('0x28')]){_0x44113c=_0xcd9d('0x29');}return util['format'](_0x44113c,_0x78e500['method'],_0x78e500['headers'][_0xcd9d('0x20')]?_0x78e500[_0xcd9d('0x1f')][_0xcd9d('0x20')]:_0x78e500[_0xcd9d('0x2a')][_0xcd9d('0x21')]||_0x78e500['ip'],_0x78e500['url'],_0x7b1740[_0xcd9d('0x23')],_0x7b1740[_0xcd9d('0x2b')],_0x78e500[_0xcd9d('0x11')]?_0x78e500[_0xcd9d('0x11')]['id']:null,_0x78e500[_0xcd9d('0x11')]?_0x78e500[_0xcd9d('0x11')][_0xcd9d('0x24')]:null,_0x78e500['user']?_0x78e500[_0xcd9d('0x11')][_0xcd9d('0xe')]:null,_0x78e500['body']&&_0x78e500[_0xcd9d('0x1b')]['device']?_0x78e500[_0xcd9d('0x1b')][_0xcd9d('0x27')]:_0xcd9d('0x2c'),_0x78e500[_0xcd9d('0x1b')]&&_0x78e500[_0xcd9d('0x1b')]['agent_id']?_0x78e500[_0xcd9d('0x1b')][_0xcd9d('0x28')]:'',_0x78e500['body']&&_0x78e500[_0xcd9d('0x1b')]['agent_name']?_0x78e500[_0xcd9d('0x1b')][_0xcd9d('0x2d')]:'');},'ignoreRoute':function(_0x192fe8){var _0x3b34f2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3b34f2['test'](_0x192fe8[_0xcd9d('0x22')]);}}));return _0x2f31ee();});}exports[_0xcd9d('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3086284..f0c8ad2 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17d5=['[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','length','stringify'];(function(_0x4c131c,_0x1dfe72){var _0x38bfc5=function(_0x120a41){while(--_0x120a41){_0x4c131c['push'](_0x4c131c['shift']());}};_0x38bfc5(++_0x1dfe72);}(_0x17d5,0x7a));var _0x517d=function(_0x25c953,_0x8ad5d3){_0x25c953=_0x25c953-0x0;var _0x95d4eb=_0x17d5[_0x25c953];return _0x95d4eb;};'use strict';var path=require(_0x517d('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0x517d('0x1'));var config=require(_0x517d('0x2'));var debugLevel=config[_0x517d('0x3')]?config[_0x517d('0x3')][_0x517d('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x517d('0x5'),'error':_0x517d('0x6'),'warn':_0x517d('0x7'),'info':_0x517d('0x8'),'print':_0x517d('0x9'),'success':_0x517d('0xa'),'http':'gray','verbose':'bold\x20magenta','debug':_0x517d('0xb'),'silly':_0x517d('0xc')};winston[_0x517d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x81aebf,_0x3e7aa6,_0x5d5746){var _0x4ab396=_0x81aebf||_0x517d('0xe');return path['join'](_0x4ab396,util[_0x517d('0xf')]('%s-%s.log',_0x3e7aa6,_0x5d5746));}function formatter(_0x5e7fb7,_0x44ceb4){_0x44ceb4[_0x517d('0x10')]=_0x44ceb4['message'][_0x517d('0x11')](/@@{/g,'{{{')[_0x517d('0x11')](/}@@/g,_0x517d('0x12'))[_0x517d('0x11')](/@{/g,'{{')[_0x517d('0x11')](/}@/g,'}}');return util['format'](_0x517d('0x13'),moment()[_0x517d('0xf')](_0x517d('0x14')),_0x44ceb4['level'][_0x517d('0x15')](),_0x5e7fb7,_0x44ceb4[_0x517d('0x10')]);}function fileFormat(_0x3cd329,_0xd1cbd5){_0xd1cbd5[_0x517d('0x10')]=_0xd1cbd5[_0x517d('0x10')][_0x517d('0x11')](/@@{/g,_0x517d('0x16'))['replace'](/}@@/g,_0x517d('0x12'))[_0x517d('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x2ba5ec=_0xd1cbd5[_0x517d('0x17')]&&Object['keys'](_0xd1cbd5[_0x517d('0x17')])[_0x517d('0x18')]?'\x0a\x09'+JSON[_0x517d('0x19')](_0xd1cbd5[_0x517d('0x17')]):'';return util['format'](_0x517d('0x1a'),moment()[_0x517d('0xf')](_0x517d('0x14')),_0xd1cbd5[_0x517d('0x1b')][_0x517d('0x15')](),_0x3cd329,_0xd1cbd5[_0x517d('0x10')],_0x2ba5ec);}function consoleLogger(){var _0xd8e02a=new winston[(_0x517d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x517d('0x1d'))][(_0x517d('0x1e'))]({'level':_0x517d('0x1f'),'json':![],'formatter':function(_0x3f4b10){return formatter('',_0x3f4b10);}})]});return _0xd8e02a;}function fileLogger(_0x10c155,_0x2282dd){var _0x1cbdd4=new winston[(_0x517d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x517d('0x20'))]({'name':util[_0x517d('0xf')](_0x517d('0x21'),_0x10c155,_0x517d('0x22')),'filename':getLogFileName(_0x2282dd,_0x10c155,'error'),'level':_0x517d('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x39a82f){return fileFormat(_0x10c155,_0x39a82f);}}),new winston[(_0x517d('0x1d'))][(_0x517d('0x20'))]({'name':util[_0x517d('0xf')](_0x517d('0x21'),_0x10c155,debugLevel),'filename':getLogFileName(_0x2282dd,_0x10c155,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x294621){return fileFormat(_0x10c155,_0x294621);}}),new winston[(_0x517d('0x1d'))][(_0x517d('0x1e'))]({'level':_0x517d('0x1f'),'json':![],'formatter':function(_0x5518fe){return fileFormat(_0x10c155,_0x5518fe);}})]});return _0x1cbdd4;}exports[_0x517d('0x23')]=consoleLogger;exports[_0x517d('0x24')]=fileLogger; \ No newline at end of file +var _0xd732=['meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','warn','transports','%s-%s','error','Console','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','keys'];(function(_0x2e35e5,_0x2b2325){var _0x265b31=function(_0x274d52){while(--_0x274d52){_0x2e35e5['push'](_0x2e35e5['shift']());}};_0x265b31(++_0x2b2325);}(_0xd732,0x110));var _0x2d73=function(_0x45c182,_0x3a76f1){_0x45c182=_0x45c182-0x0;var _0x2f41ad=_0xd732[_0x45c182];return _0x2f41ad;};'use strict';var path=require(_0x2d73('0x0'));var util=require(_0x2d73('0x1'));var moment=require(_0x2d73('0x2'));var winston=require('winston');var config=require(_0x2d73('0x3'));var debugLevel=config[_0x2d73('0x4')]?config[_0x2d73('0x4')][_0x2d73('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x2d73('0x6'),'warn':_0x2d73('0x7'),'info':'white','print':_0x2d73('0x8'),'success':_0x2d73('0x9'),'http':_0x2d73('0xa'),'verbose':_0x2d73('0xb'),'debug':_0x2d73('0xc'),'silly':'bold\x20cyan'};winston[_0x2d73('0xd')](XC_LOG_COLORS);function getLogFileName(_0x20c2b8,_0x31c743,_0xbc6ec5){var _0xd736b0=_0x20c2b8||_0x2d73('0xe');return path[_0x2d73('0xf')](_0xd736b0,util['format']('%s-%s.log',_0x31c743,_0xbc6ec5));}function formatter(_0x3475a0,_0x35e586){_0x35e586[_0x2d73('0x10')]=_0x35e586[_0x2d73('0x10')][_0x2d73('0x11')](/@@{/g,_0x2d73('0x12'))[_0x2d73('0x11')](/}@@/g,_0x2d73('0x13'))[_0x2d73('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x2d73('0x14')](_0x2d73('0x15'),moment()[_0x2d73('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),_0x35e586[_0x2d73('0x16')]['toUpperCase'](),_0x3475a0,_0x35e586[_0x2d73('0x10')]);}function fileFormat(_0x92d07d,_0x2d9b90){_0x2d9b90[_0x2d73('0x10')]=_0x2d9b90['message']['replace'](/@@{/g,'{{{')[_0x2d73('0x11')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x2d73('0x11')](/}@/g,'}}');var _0x125a04=_0x2d9b90['meta']&&Object[_0x2d73('0x17')](_0x2d9b90[_0x2d73('0x18')])[_0x2d73('0x19')]?'\x0a\x09'+JSON['stringify'](_0x2d9b90['meta']):'';return util[_0x2d73('0x14')](_0x2d73('0x1a'),moment()['format'](_0x2d73('0x1b')),_0x2d9b90['level'][_0x2d73('0x1c')](),_0x92d07d,_0x2d9b90[_0x2d73('0x10')],_0x125a04);}function consoleLogger(){var _0x3d66e4=new winston[(_0x2d73('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x2d73('0x1e'),'json':![],'formatter':function(_0x242543){return formatter('',_0x242543);}})]});return _0x3d66e4;}function fileLogger(_0x1c2834,_0x42363b){var _0x26b68f=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2d73('0x1f'))]['File']({'name':util[_0x2d73('0x14')](_0x2d73('0x20'),_0x1c2834,'error'),'filename':getLogFileName(_0x42363b,_0x1c2834,'error'),'level':_0x2d73('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2bcace){return fileFormat(_0x1c2834,_0x2bcace);}}),new winston[(_0x2d73('0x1f'))]['File']({'name':util[_0x2d73('0x14')]('%s-%s',_0x1c2834,debugLevel),'filename':getLogFileName(_0x42363b,_0x1c2834,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x429854){return fileFormat(_0x1c2834,_0x429854);}}),new winston[(_0x2d73('0x1f'))][(_0x2d73('0x22'))]({'level':'warn','json':![],'formatter':function(_0x4d43f7){return fileFormat(_0x1c2834,_0x4d43f7);}})]});return _0x26b68f;}exports[_0x2d73('0x23')]=consoleLogger;exports[_0x2d73('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9625235..e0ebf7e 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 _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0xc5a7fb,_0x5cac5b){var _0xe75710=function(_0x1d9ab4){while(--_0x1d9ab4){_0xc5a7fb['push'](_0xc5a7fb['shift']());}};_0xe75710(++_0x5cac5b);}(_0x14a0,0x8e));var _0x014a=function(_0x9c173d,_0x5d1ff5){_0x9c173d=_0x9c173d-0x0;var _0x503208=_0x14a0[_0x9c173d];return _0x503208;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x2fb3b8,_0x3da41b){var _0x4d3319=function(_0x541e07){while(--_0x541e07){_0x2fb3b8['push'](_0x2fb3b8['shift']());}};_0x4d3319(++_0x3da41b);}(_0x66fa,0x117));var _0xa66f=function(_0xc8f1d4,_0x31dff6){_0xc8f1d4=_0xc8f1d4-0x0;var _0x2d3174=_0x66fa[_0xc8f1d4];return _0x2d3174;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index d4e8da4..09299a8 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x3aea87,_0xbc220d){var _0x509124=function(_0x422da0){while(--_0x422da0){_0x3aea87['push'](_0x3aea87['shift']());}};_0x509124(++_0xbc220d);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file +var _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x18e3bb,_0x5a0e9a){var _0xe0b9a6=function(_0x374517){while(--_0x374517){_0x18e3bb['push'](_0x18e3bb['shift']());}};_0xe0b9a6(++_0x5a0e9a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file